diff --git a/3rdparty/bgfx/.appveyor.yml b/3rdparty/bgfx/.appveyor.yml index 15bcc62ba27..f0424f05bb0 100644 --- a/3rdparty/bgfx/.appveyor.yml +++ b/3rdparty/bgfx/.appveyor.yml @@ -5,7 +5,6 @@ os: environment: matrix: - - TOOLSET: vs2015 - TOOLSET: vs2017 configuration: diff --git a/3rdparty/bgfx/.travis.yml b/3rdparty/bgfx/.travis.yml index 0ed382fb6b1..8fc61d206ef 100644 --- a/3rdparty/bgfx/.travis.yml +++ b/3rdparty/bgfx/.travis.yml @@ -11,8 +11,8 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gcc-4.8 - - g++-4.8 + - gcc-5 + - g++-5 - clang before_script: @@ -20,7 +20,7 @@ before_script: - git clone --depth 1 https://github.com/bkaradzic/bimg ../bimg script: - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make build CXX="g++-4.8" CC="gcc-4.8"; fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make build CXX="g++-5" CC="gcc-5"; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then make build; fi branches: @@ -30,4 +30,4 @@ branches: notifications: email: false -osx_image: xcode7.3 +osx_image: xcode9.3 diff --git a/3rdparty/bgfx/3rdparty/.editorconfig b/3rdparty/bgfx/3rdparty/.editorconfig index f88ec278c17..ca5c3574bd5 100644 --- a/3rdparty/bgfx/3rdparty/.editorconfig +++ b/3rdparty/bgfx/3rdparty/.editorconfig @@ -16,11 +16,11 @@ indent_size = 4 indent_style = tab indent_size = 4 -[ocornut-imgui/*] +[dear-imgui/*] indent_style = space indent_size = 4 -[ocornut-imgui/*.inl] +[dear-imgui/*.inl] indent_style = space indent_size = 4 diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imconfig.h b/3rdparty/bgfx/3rdparty/dear-imgui/imconfig.h similarity index 97% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/imconfig.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/imconfig.h index 45d7d2b8919..44133c8fefb 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imconfig.h +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imconfig.h @@ -6,6 +6,8 @@ #pragma once +//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS + //---- Define your own ImVector<> type if you don't want to use the provided implementation defined in imgui.h //#include //#define ImVector std::vector @@ -13,7 +15,7 @@ //---- Define assertion handler. Defaults to calling assert(). #include -#define IM_ASSERT(_EXPR, ...) assert(_EXPR) +#define IM_ASSERT(_EXPR) assert(_EXPR) //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows. //#define IMGUI_API __declspec( dllexport ) diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/dear-imgui/imgui.cpp new file mode 100644 index 00000000000..7fb0508c75e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imgui.cpp @@ -0,0 +1,9096 @@ +// dear imgui, v1.67 WIP +// (main code and documentation) + +// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. +// Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase. +// Get latest version at https://github.com/ocornut/imgui +// Releases change-log at https://github.com/ocornut/imgui/releases +// Technical Support for Getting Started https://discourse.dearimgui.org/c/getting-started +// Gallery (please post your screenshots/video there!): https://github.com/ocornut/imgui/issues/1269 +// Developed by Omar Cornut and every direct or indirect contributors to the GitHub. +// This library is free but I need your support to sustain development and maintenance. +// If you work for a company, please consider financial support, see README. For individuals: https://www.patreon.com/imgui + +// It is recommended that you don't modify imgui.cpp! It will become difficult for you to update the library. +// Note that 'ImGui::' being a namespace, you can add functions into the namespace from your own source files, without +// modifying imgui.h or imgui.cpp. You may include imgui_internal.h to access internal data structures, but it doesn't +// come with any guarantee of forward compatibility. Discussing your changes on the GitHub Issue Tracker may lead you +// to a better solution or official support for them. + +/* + +Index of this file: + +DOCUMENTATION + +- MISSION STATEMENT +- END-USER GUIDE +- PROGRAMMER GUIDE (read me!) + - Read first + - How to update to a newer version of Dear ImGui + - Getting started with integrating Dear ImGui in your code/engine + - This is how a simple application may look like (2 variations) + - This is how a simple rendering function may look like + - Using gamepad/keyboard navigation controls +- API BREAKING CHANGES (read me when you update!) +- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS + - How can I tell whether to dispatch mouse/keyboard to imgui or to my application? + - How can I display an image? What is ImTextureID, how does it works? + - How can I have multiple widgets with the same label or without a label? A primer on labels and the ID Stack. + - How can I use my own math types instead of ImVec2/ImVec4? + - How can I load a different font than the default? + - How can I easily use icons in my application? + - How can I load multiple fonts? + - How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic? + - How can I use the drawing facilities without an ImGui window? (using ImDrawList API) + - I integrated Dear ImGui in my engine and the text or lines are blurry.. + - I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around.. + - How can I help? + +CODE +(search for "[SECTION]" in the code to find them) + +// [SECTION] FORWARD DECLARATIONS +// [SECTION] CONTEXT AND MEMORY ALLOCATORS +// [SECTION] MAIN USER FACING STRUCTURES (ImGuiStyle, ImGuiIO) +// [SECTION] MISC HELPER/UTILITIES (Maths, String, Format, Hash, File functions) +// [SECTION] MISC HELPER/UTILITIES (ImText* functions) +// [SECTION] MISC HELPER/UTILITIES (Color functions) +// [SECTION] ImGuiStorage +// [SECTION] ImGuiTextFilter +// [SECTION] ImGuiTextBuffer +// [SECTION] ImGuiListClipper +// [SECTION] RENDER HELPERS +// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +// [SECTION] TOOLTIPS +// [SECTION] POPUPS +// [SECTION] KEYBOARD/GAMEPAD NAVIGATION +// [SECTION] COLUMNS +// [SECTION] DRAG AND DROP +// [SECTION] LOGGING/CAPTURING +// [SECTION] SETTINGS +// [SECTION] PLATFORM DEPENDENT HELPERS +// [SECTION] METRICS/DEBUG WINDOW + +*/ + +//----------------------------------------------------------------------------- +// DOCUMENTATION +//----------------------------------------------------------------------------- + +/* + + MISSION STATEMENT + ================= + + - Easy to use to create code-driven and data-driven tools + - Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools + - Easy to hack and improve + - Minimize screen real-estate usage + - Minimize setup and maintenance + - Minimize state storage on user side + - Portable, minimize dependencies, run on target (consoles, phones, etc.) + - Efficient runtime and memory consumption (NB- we do allocate when "growing" content e.g. creating a window, + opening a tree node for the first time, etc. but a typical frame should not allocate anything) + + Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes: + - Doesn't look fancy, doesn't animate + - Limited layout features, intricate layouts are typically crafted in code + + + END-USER GUIDE + ============== + + - Double-click on title bar to collapse window. + - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin(). + - Click and drag on lower right corner to resize window (double-click to auto fit window to its contents). + - Click and drag on any empty space to move window. + - TAB/SHIFT+TAB to cycle through keyboard editable fields. + - CTRL+Click on a slider or drag box to input value as text. + - Use mouse wheel to scroll. + - Text editor: + - Hold SHIFT or use mouse to select text. + - CTRL+Left/Right to word jump. + - CTRL+Shift+Left/Right to select words. + - CTRL+A our Double-Click to select all. + - CTRL+X,CTRL+C,CTRL+V to use OS clipboard/ + - CTRL+Z,CTRL+Y to undo/redo. + - ESCAPE to revert text to its original value. + - You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!) + - Controls are automatically adjusted for OSX to match standard OSX text editing operations. + - General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard. + - General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at http://goo.gl/9LgVZW + + + PROGRAMMER GUIDE + ================ + + READ FIRST + + - Read the FAQ below this section! + - Your code creates the UI, if your code doesn't run the UI is gone! The UI can be highly dynamic, there are no construction + or destruction steps, less superfluous data retention on your side, less state duplication, less state synchronization, less bugs. + - Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features. + - You can learn about immediate-mode GUI principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861 + See README.md for more links describing the IMGUI paradigm. Dear ImGui is an implementation of the IMGUI paradigm. + + HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI + + - Overwrite all the sources files except for imconfig.h (if you have made modification to your copy of imconfig.h) + - Or maintain your own branch where you have imconfig.h modified. + - Read the "API BREAKING CHANGES" section (below). This is where we list occasional API breaking changes. + If a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed + from the public API. If you have a problem with a missing function/symbols, search for its name in the code, there will + likely be a comment about it. Please report any issue to the GitHub page! + - Try to keep your copy of dear imgui reasonably up to date. + + GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE + + - Run and study the examples and demo in imgui_demo.cpp to get acquainted with the library. + - Add the Dear ImGui source files to your projects or using your preferred build system. + It is recommended you build and statically link the .cpp files as part of your project and not as shared library (DLL). + - You can later customize the imconfig.h file to tweak some compile-time behavior, such as integrating imgui types with your own maths types. + - When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them. + - Dear ImGui never touches or knows about your GPU state. The only function that knows about GPU is the draw function that you provide. + Effectively it means you can create widgets at any time in your code, regardless of considerations of being in "update" vs "render" + phases of your own application. All rendering informatioe are stored into command-lists that you will retrieve after calling ImGui::Render(). + - Refer to the bindings and demo applications in the examples/ folder for instruction on how to setup your code. + - If you are running over a standard OS with a common graphics API, you should be able to use unmodified imgui_impl_*** files from the examples/ folder. + + HOW A SIMPLE APPLICATION MAY LOOK LIKE + EXHIBIT 1: USING THE EXAMPLE BINDINGS (imgui_impl_XXX.cpp files from the examples/ folder) + + // Application init: create a dear imgui context, setup some options, load fonts + ImGui::CreateContext(); + ImGuiIO& io = ImGui::GetIO(); + // TODO: Set optional io.ConfigFlags values, e.g. 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard' to enable keyboard controls. + // TODO: Fill optional fields of the io structure later. + // TODO: Load TTF/OTF fonts if you don't want to use the default font. + + // Initialize helper Platform and Renderer bindings (here we are using imgui_impl_win32 and imgui_impl_dx11) + ImGui_ImplWin32_Init(hwnd); + ImGui_ImplDX11_Init(g_pd3dDevice, g_pd3dDeviceContext); + + // Application main loop + while (true) + { + // Feed inputs to dear imgui, start new frame + ImGui_ImplDX11_NewFrame(); + ImGui_ImplWin32_NewFrame(); + ImGui::NewFrame(); + + // Any application code here + ImGui::Text("Hello, world!"); + + // Render dear imgui into screen + ImGui::Render(); + ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData()); + g_pSwapChain->Present(1, 0); + } + + // Shutdown + ImGui_ImplDX11_Shutdown(); + ImGui_ImplWin32_Shutdown(); + ImGui::DestroyContext(); + + HOW A SIMPLE APPLICATION MAY LOOK LIKE + EXHIBIT 2: IMPLEMENTING CUSTOM BINDING / CUSTOM ENGINE + + // Application init: create a dear imgui context, setup some options, load fonts + ImGui::CreateContext(); + ImGuiIO& io = ImGui::GetIO(); + // TODO: Set optional io.ConfigFlags values, e.g. 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard' to enable keyboard controls. + // TODO: Fill optional fields of the io structure later. + // TODO: Load TTF/OTF fonts if you don't want to use the default font. + + // Build and load the texture atlas into a texture + // (In the examples/ app this is usually done within the ImGui_ImplXXX_Init() function from one of the demo Renderer) + int width, height; + unsigned char* pixels = NULL; + io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); + + // At this point you've got the texture data and you need to upload that your your graphic system: + // After we have created the texture, store its pointer/identifier (_in whichever format your engine uses_) in 'io.Fonts->TexID'. + // This will be passed back to your via the renderer. Basically ImTextureID == void*. Read FAQ below for details about ImTextureID. + MyTexture* texture = MyEngine::CreateTextureFromMemoryPixels(pixels, width, height, TEXTURE_TYPE_RGBA32) + io.Fonts->TexID = (void*)texture; + + // Application main loop + while (true) + { + // Setup low-level inputs, e.g. on Win32: calling GetKeyboardState(), or write to those fields from your Windows message handlers, etc. + // (In the examples/ app this is usually done within the ImGui_ImplXXX_NewFrame() function from one of the demo Platform bindings) + io.DeltaTime = 1.0f/60.0f; // set the time elapsed since the previous frame (in seconds) + io.DisplaySize.x = 1920.0f; // set the current display width + io.DisplaySize.y = 1280.0f; // set the current display height here + io.MousePos = my_mouse_pos; // set the mouse position + io.MouseDown[0] = my_mouse_buttons[0]; // set the mouse button states + io.MouseDown[1] = my_mouse_buttons[1]; + + // Call NewFrame(), after this point you can use ImGui::* functions anytime + // (So you want to try calling NewFrame() as early as you can in your mainloop to be able to use imgui everywhere) + ImGui::NewFrame(); + + // Most of your application code here + ImGui::Text("Hello, world!"); + MyGameUpdate(); // may use any ImGui functions, e.g. ImGui::Begin("My window"); ImGui::Text("Hello, world!"); ImGui::End(); + MyGameRender(); // may use any ImGui functions as well! + + // Render imgui, swap buffers + // (You want to try calling EndFrame/Render as late as you can, to be able to use imgui in your own game rendering code) + ImGui::EndFrame(); + ImGui::Render(); + ImDrawData* draw_data = ImGui::GetDrawData(); + MyImGuiRenderFunction(draw_data); + SwapBuffers(); + } + + // Shutdown + ImGui::DestroyContext(); + + HOW A SIMPLE RENDERING FUNCTION MAY LOOK LIKE + + void void MyImGuiRenderFunction(ImDrawData* draw_data) + { + // TODO: Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled + // TODO: Setup viewport using draw_data->DisplaySize + // TODO: Setup orthographic projection matrix cover draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize + // TODO: Setup shader: vertex { float2 pos, float2 uv, u32 color }, fragment shader sample color from 1 texture, multiply by vertex color. + for (int n = 0; n < draw_data->CmdListsCount; n++) + { + const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data; // vertex buffer generated by ImGui + const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data; // index buffer generated by ImGui + for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) + { + const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; + if (pcmd->UserCallback) + { + pcmd->UserCallback(cmd_list, pcmd); + } + else + { + // The texture for the draw call is specified by pcmd->TextureId. + // The vast majority of draw calls will use the imgui texture atlas, which value you have set yourself during initialization. + MyEngineBindTexture((MyTexture*)pcmd->TextureId); + + // We are using scissoring to clip some objects. All low-level graphics API should supports it. + // - If your engine doesn't support scissoring yet, you may ignore this at first. You will get some small glitches + // (some elements visible outside their bounds) but you can fix that once everything else works! + // - Clipping coordinates are provided in imgui coordinates space (from draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize) + // In a single viewport application, draw_data->DisplayPos will always be (0,0) and draw_data->DisplaySize will always be == io.DisplaySize. + // However, in the interest of supporting multi-viewport applications in the future (see 'viewport' branch on github), + // always subtract draw_data->DisplayPos from clipping bounds to convert them to your viewport space. + // - Note that pcmd->ClipRect contains Min+Max bounds. Some graphics API may use Min+Max, other may use Min+Size (size being Max-Min) + ImVec2 pos = draw_data->DisplayPos; + MyEngineScissor((int)(pcmd->ClipRect.x - pos.x), (int)(pcmd->ClipRect.y - pos.y), (int)(pcmd->ClipRect.z - pos.x), (int)(pcmd->ClipRect.w - pos.y)); + + // Render 'pcmd->ElemCount/3' indexed triangles. + // By default the indices ImDrawIdx are 16-bits, you can change them to 32-bits in imconfig.h if your engine doesn't support 16-bits indices. + MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer); + } + idx_buffer += pcmd->ElemCount; + } + } + } + + - The examples/ folders contains many actual implementation of the pseudo-codes above. + - When calling NewFrame(), the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags are updated. + They tell you if Dear ImGui intends to use your inputs. When a flag is set you want to hide the corresponding inputs + from the rest of your application. In every cases you need to pass on the inputs to imgui. Refer to the FAQ for more information. + - Please read the FAQ below!. Amusingly, it is called a FAQ because people frequently run into the same issues! + + USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS + + - The gamepad/keyboard navigation is fairly functional and keeps being improved. + - Gamepad support is particularly useful to use dear imgui on a console system (e.g. PS4, Switch, XB1) without a mouse! + - You can ask questions and report issues at https://github.com/ocornut/imgui/issues/787 + - The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable. + - Gamepad: + - Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. + - Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). + Note that io.NavInputs[] is cleared by EndFrame(). + - See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. For each entry of io.NavInputs[], set the following values: + 0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks. + - We uses a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone. + Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.). + - You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://goo.gl/9LgVZW. + - If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo + to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved. + - Keyboard: + - Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. + NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. + - When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag + will be set. For more advanced uses, you may want to read from: + - io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set. + - io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used). + - or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions. + Please reach out if you think the game vs navigation input sharing could be improved. + - Mouse: + - PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback. + - Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (on your console/tablet/phone app) to share your PC mouse/keyboard. + - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag. + Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs dear imgui to move your mouse cursor along with navigation movements. + When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved. + When that happens your back-end NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the binding in examples/ do that. + (If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, imgui will misbehave as it will see your mouse as moving back and forth!) + (In a setup when you may not have easy control over the mouse cursor, e.g. uSynergy.c doesn't expose moving remote mouse cursor, you may want + to set a boolean to ignore your other external mouse positions until the external source is moved again.) + + + API BREAKING CHANGES + ==================== + + Occasionally introducing changes that are breaking the API. We try to make the breakage minor and easy to fix. + Below is a change-log of API breaking changes only. If you are using one of the functions listed, expect to have to fix some code. + When you are not sure about a old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. + You can read releases logs https://github.com/ocornut/imgui/releases for more details. + + - 2018/10/12 (1.66) - Renamed misc/stl/imgui_stl.* to misc/cpp/imgui_stdlib.* in prevision for other C++ helper files. + - 2018/09/28 (1.66) - renamed SetScrollHere() to SetScrollHereY(). Kept redirection function (will obsolete). + - 2018/09/06 (1.65) - renamed stb_truetype.h to imstb_truetype.h, stb_textedit.h to imstb_textedit.h, and stb_rect_pack.h to imstb_rectpack.h. + If you were conveniently using the imgui copy of those STB headers in your project you will have to update your include paths. + - 2018/09/05 (1.65) - renamed io.OptCursorBlink/io.ConfigCursorBlink to io.ConfigInputTextCursorBlink. (#1427) + - 2018/08/31 (1.64) - added imgui_widgets.cpp file, extracted and moved widgets code out of imgui.cpp into imgui_widgets.cpp. Re-ordered some of the code remaining in imgui.cpp. + NONE OF THE FUNCTIONS HAVE CHANGED. THE CODE IS SEMANTICALLY 100% IDENTICAL, BUT _EVERY_ FUNCTION HAS BEEN MOVED. + Because of this, any local modifications to imgui.cpp will likely conflict when you update. Read docs/CHANGELOG.txt for suggestions. + - 2018/08/22 (1.63) - renamed IsItemDeactivatedAfterChange() to IsItemDeactivatedAfterEdit() for consistency with new IsItemEdited() API. Kept redirection function (will obsolete soonish as IsItemDeactivatedAfterChange() is very recent). + - 2018/08/21 (1.63) - renamed ImGuiTextEditCallback to ImGuiInputTextCallback, ImGuiTextEditCallbackData to ImGuiInputTextCallbackData for consistency. Kept redirection types (will obsolete). + - 2018/08/21 (1.63) - removed ImGuiInputTextCallbackData::ReadOnly since it is a duplication of (ImGuiInputTextCallbackData::Flags & ImGuiInputTextFlags_ReadOnly). + - 2018/08/01 (1.63) - removed per-window ImGuiWindowFlags_ResizeFromAnySide beta flag in favor of a global io.ConfigResizeWindowsFromEdges to enable the feature. + - 2018/08/01 (1.63) - renamed io.OptCursorBlink to io.ConfigCursorBlink [-> io.ConfigInputTextCursorBlink in 1.65], io.OptMacOSXBehaviors to ConfigMacOSXBehaviors for consistency. + - 2018/07/22 (1.63) - changed ImGui::GetTime() return value from float to double to avoid accumulating floating point imprecisions over time. + - 2018/07/08 (1.63) - style: renamed ImGuiCol_ModalWindowDarkening to ImGuiCol_ModalWindowDimBg for consistency with other features. Kept redirection enum (will obsolete). + - 2018/06/06 (1.62) - renamed GetGlyphRangesChinese() to GetGlyphRangesChineseFull() to distinguish other variants and discourage using the full set. + - 2018/06/06 (1.62) - TreeNodeEx()/TreeNodeBehavior(): the ImGuiTreeNodeFlags_CollapsingHeader helper now include the ImGuiTreeNodeFlags_NoTreePushOnOpen flag. See Changelog for details. + - 2018/05/03 (1.61) - DragInt(): the default compile-time format string has been changed from "%.0f" to "%d", as we are not using integers internally any more. + If you used DragInt() with custom format strings, make sure you change them to use %d or an integer-compatible format. + To honor backward-compatibility, the DragInt() code will currently parse and modify format strings to replace %*f with %d, giving time to users to upgrade their code. + If you have IMGUI_DISABLE_OBSOLETE_FUNCTIONS enabled, the code will instead assert! You may run a reg-exp search on your codebase for e.g. "DragInt.*%f" to help you find them. + - 2018/04/28 (1.61) - obsoleted InputFloat() functions taking an optional "int decimal_precision" in favor of an equivalent and more flexible "const char* format", + consistent with other functions. Kept redirection functions (will obsolete). + - 2018/04/09 (1.61) - IM_DELETE() helper function added in 1.60 doesn't clear the input _pointer_ reference, more consistent with expectation and allows passing r-value. + - 2018/03/20 (1.60) - renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, _not_ used by core and only honored by some binding ahead of merging the Nav branch). + - 2018/03/12 (1.60) - removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered as the closing cross uses regular button colors now. + - 2018/03/08 (1.60) - changed ImFont::DisplayOffset.y to default to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer. If you were adding or subtracting to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. + - 2018/03/03 (1.60) - renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums. + - 2018/02/18 (1.60) - BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment. + - 2018/02/16 (1.60) - obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render(). Use ImGui::GetDrawData() to retrieve the ImDrawData* to display. + - 2018/02/07 (1.60) - reorganized context handling to be more explicit, + - YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END. + - removed Shutdown() function, as DestroyContext() serve this purpose. + - you may pass a ImFontAtlas* pointer to CreateContext() to share a font atlas between contexts. Otherwise CreateContext() will create its own font atlas instance. + - removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions(), and shared by all contexts. + - removed the default global context and font atlas instance, which were confusing for users of DLL reloading and users of multiple contexts. + - 2018/01/31 (1.60) - moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths. + - 2018/01/11 (1.60) - obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete). + - 2018/01/11 (1.60) - obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete). + - 2018/01/03 (1.60) - renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData. + - 2017/12/29 (1.60) - removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side. + - 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete). + - 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags + - 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame. + - 2017/12/14 (1.53) - using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. + - 2017/12/13 (1.53) - renamed GetItemsLineHeightWithSpacing() to GetFrameHeightWithSpacing(). Kept redirection function (will obsolete). + - 2017/12/13 (1.53) - obsoleted IsRootWindowFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootWindow). Kept redirection function (will obsolete). + - obsoleted IsRootWindowOrAnyChildFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows). Kept redirection function (will obsolete). + - 2017/12/12 (1.53) - renamed ImGuiTreeNodeFlags_AllowOverlapMode to ImGuiTreeNodeFlags_AllowItemOverlap. Kept redirection enum (will obsolete). + - 2017/12/10 (1.53) - removed SetNextWindowContentWidth(), prefer using SetNextWindowContentSize(). Kept redirection function (will obsolete). + - 2017/11/27 (1.53) - renamed ImGuiTextBuffer::append() helper to appendf(), appendv() to appendfv(). If you copied the 'Log' demo in your code, it uses appendv() so that needs to be renamed. + - 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up. + Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions. + - 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency. + - 2017/11/18 (1.53) - Style: renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg. + - 2017/11/18 (1.53) - Style: renamed style.ChildWindowRounding to style.ChildRounding, ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding. + - 2017/11/02 (1.53) - obsoleted IsRootWindowOrAnyChildHovered() in favor of using IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows); + - 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency. + - 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it. + - 2017/10/20 (1.52) - marked IsItemHoveredRect()/IsMouseHoveringWindow() as obsolete, in favor of using the newly introduced flags for IsItemHovered() and IsWindowHovered(). See https://github.com/ocornut/imgui/issues/1382 for details. + removed the IsItemRectHovered()/IsWindowRectHovered() names introduced in 1.51 since they were merely more consistent names for the two functions we are now obsoleting. + - 2017/10/17 (1.52) - marked the old 5-parameters version of Begin() as obsolete (still available). Use SetNextWindowSize()+Begin() instead! + - 2017/10/11 (1.52) - renamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete). + - 2017/09/25 (1.52) - removed SetNextWindowPosCenter() because SetNextWindowPos() now has the optional pivot information to do the same and more. Kept redirection function (will obsolete). + - 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your binding if you need to support unavailable mouse, make sure to replace "io.MousePos = ImVec2(-1,-1)" with "io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)". + - 2017/08/22 (1.51) - renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete). -> (1.52) use IsItemHovered(ImGuiHoveredFlags_RectOnly)! + - renamed IsMouseHoveringAnyWindow() to IsAnyWindowHovered() for consistency. Kept inline redirection function (will obsolete). + - renamed IsMouseHoveringWindow() to IsWindowRectHovered() for consistency. Kept inline redirection function (will obsolete). + - 2017/08/20 (1.51) - renamed GetStyleColName() to GetStyleColorName() for consistency. + - 2017/08/20 (1.51) - added PushStyleColor(ImGuiCol idx, ImU32 col) overload, which _might_ cause an "ambiguous call" compilation error if you are using ImColor() with implicit cast. Cast to ImU32 or ImVec4 explicily to fix. + - 2017/08/15 (1.51) - marked the weird IMGUI_ONCE_UPON_A_FRAME helper macro as obsolete. prefer using the more explicit ImGuiOnceUponAFrame. + - 2017/08/15 (1.51) - changed parameter order for BeginPopupContextWindow() from (const char*,int buttons,bool also_over_items) to (const char*,int buttons,bool also_over_items). Note that most calls relied on default parameters completely. + - 2017/08/13 (1.51) - renamed ImGuiCol_Columns*** to ImGuiCol_Separator***. Kept redirection enums (will obsolete). + - 2017/08/11 (1.51) - renamed ImGuiSetCond_*** types and flags to ImGuiCond_***. Kept redirection enums (will obsolete). + - 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton(). + - 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu. + - changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under "Color/Picker Widgets", to understand the various new options. + - changed prototype of rarely used 'ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)' to 'ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0))' + - 2017/07/20 (1.51) - removed IsPosHoveringAnyWindow(ImVec2), which was partly broken and misleading. ASSERT + redirect user to io.WantCaptureMouse + - 2017/05/26 (1.50) - removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset. + - 2017/05/01 (1.50) - renamed ImDrawList::PathFill() (rarely used directly) to ImDrawList::PathFillConvex() for clarity. + - 2016/11/06 (1.50) - BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild(). + - 2016/10/15 (1.50) - avoid 'void* user_data' parameter to io.SetClipboardTextFn/io.GetClipboardTextFn pointers. We pass io.ClipboardUserData to it. + - 2016/09/25 (1.50) - style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc. + - 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal. + - 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore. + If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. + If your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar. + This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color. + ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col) + { + float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a; + return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a); + } + If this is confusing, pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color. + - 2016/05/07 (1.49) - removed confusing set of GetInternalState(), GetInternalStateSize(), SetInternalState() functions. Now using CreateContext(), DestroyContext(), GetCurrentContext(), SetCurrentContext(). + - 2016/05/02 (1.49) - renamed SetNextTreeNodeOpened() to SetNextTreeNodeOpen(), no redirection. + - 2016/05/01 (1.49) - obsoleted old signature of CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false) as extra parameters were badly designed and rarely used. You can replace the "default_open = true" flag in new API with CollapsingHeader(label, ImGuiTreeNodeFlags_DefaultOpen). + - 2016/04/26 (1.49) - changed ImDrawList::PushClipRect(ImVec4 rect) to ImDrawList::PushClipRect(Imvec2 min,ImVec2 max,bool intersect_with_current_clip_rect=false). Note that higher-level ImGui::PushClipRect() is preferable because it will clip at logic/widget level, whereas ImDrawList::PushClipRect() only affect your renderer. + - 2016/04/03 (1.48) - removed style.WindowFillAlphaDefault setting which was redundant. Bake default BG alpha inside style.Colors[ImGuiCol_WindowBg] and all other Bg color values. (ref github issue #337). + - 2016/04/03 (1.48) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg, used by popups/menus and tooltips. popups/menus were previously using ImGuiCol_WindowBg. (ref github issue #337) + - 2016/03/21 (1.48) - renamed GetWindowFont() to GetFont(), GetWindowFontSize() to GetFontSize(). Kept inline redirection function (will obsolete). + - 2016/03/02 (1.48) - InputText() completion/history/always callbacks: if you modify the text buffer manually (without using DeleteChars()/InsertChars() helper) you need to maintain the BufTextLen field. added an assert. + - 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you. + - 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis. + - 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete. + - 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position. + GetCursorPos()/SetCursorPos() functions now include the scrolled amount. It shouldn't affect the majority of users, but take note that SetCursorPosX(100.0f) puts you at +100 from the starting x position which may include scrolling, not at +100 from the window left side. + GetContentRegionMax()/GetWindowContentRegionMin()/GetWindowContentRegionMax() functions allow include the scrolled amount. Typically those were used in cases where no scrolling would happen so it may not be a problem, but watch out! + - 2015/08/29 (1.45) - renamed style.ScrollbarWidth to style.ScrollbarSize + - 2015/08/05 (1.44) - split imgui.cpp into extra files: imgui_demo.cpp imgui_draw.cpp imgui_internal.h that you need to add to your project. + - 2015/07/18 (1.44) - fixed angles in ImDrawList::PathArcTo(), PathArcToFast() (introduced in 1.43) being off by an extra PI for no justifiable reason + - 2015/07/14 (1.43) - add new ImFontAtlas::AddFont() API. For the old AddFont***, moved the 'font_no' parameter of ImFontAtlas::AddFont** functions to the ImFontConfig structure. + you need to render your textured triangles with bilinear filtering to benefit from sub-pixel positioning of text. + - 2015/07/08 (1.43) - switched rendering data to use indexed rendering. this is saving a fair amount of CPU/GPU and enables us to get anti-aliasing for a marginal cost. + this necessary change will break your rendering function! the fix should be very easy. sorry for that :( + - if you are using a vanilla copy of one of the imgui_impl_XXXX.cpp provided in the example, you just need to update your copy and you can ignore the rest. + - the signature of the io.RenderDrawListsFn handler has changed! + old: ImGui_XXXX_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count) + new: ImGui_XXXX_RenderDrawLists(ImDrawData* draw_data). + argument: 'cmd_lists' becomes 'draw_data->CmdLists', 'cmd_lists_count' becomes 'draw_data->CmdListsCount' + ImDrawList: 'commands' becomes 'CmdBuffer', 'vtx_buffer' becomes 'VtxBuffer', 'IdxBuffer' is new. + ImDrawCmd: 'vtx_count' becomes 'ElemCount', 'clip_rect' becomes 'ClipRect', 'user_callback' becomes 'UserCallback', 'texture_id' becomes 'TextureId'. + - each ImDrawList now contains both a vertex buffer and an index buffer. For each command, render ElemCount/3 triangles using indices from the index buffer. + - if you REALLY cannot render indexed primitives, you can call the draw_data->DeIndexAllBuffers() method to de-index the buffers. This is slow and a waste of CPU/GPU. Prefer using indexed rendering! + - refer to code in the examples/ folder or ask on the GitHub if you are unsure of how to upgrade. please upgrade! + - 2015/07/10 (1.43) - changed SameLine() parameters from int to float. + - 2015/07/02 (1.42) - renamed SetScrollPosHere() to SetScrollFromCursorPos(). Kept inline redirection function (will obsolete). + - 2015/07/02 (1.42) - renamed GetScrollPosY() to GetScrollY(). Necessary to reduce confusion along with other scrolling functions, because positions (e.g. cursor position) are not equivalent to scrolling amount. + - 2015/06/14 (1.41) - changed ImageButton() default bg_col parameter from (0,0,0,1) (black) to (0,0,0,0) (transparent) - makes a difference when texture have transparence + - 2015/06/14 (1.41) - changed Selectable() API from (label, selected, size) to (label, selected, flags, size). Size override should have been rarely be used. Sorry! + - 2015/05/31 (1.40) - renamed GetWindowCollapsed() to IsWindowCollapsed() for consistency. Kept inline redirection function (will obsolete). + - 2015/05/31 (1.40) - renamed IsRectClipped() to IsRectVisible() for consistency. Note that return value is opposite! Kept inline redirection function (will obsolete). + - 2015/05/27 (1.40) - removed the third 'repeat_if_held' parameter from Button() - sorry! it was rarely used and inconsistent. Use PushButtonRepeat(true) / PopButtonRepeat() to enable repeat on desired buttons. + - 2015/05/11 (1.40) - changed BeginPopup() API, takes a string identifier instead of a bool. ImGui needs to manage the open/closed state of popups. Call OpenPopup() to actually set the "open" state of a popup. BeginPopup() returns true if the popup is opened. + - 2015/05/03 (1.40) - removed style.AutoFitPadding, using style.WindowPadding makes more sense (the default values were already the same). + - 2015/04/13 (1.38) - renamed IsClipped() to IsRectClipped(). Kept inline redirection function until 1.50. + - 2015/04/09 (1.38) - renamed ImDrawList::AddArc() to ImDrawList::AddArcFast() for compatibility with future API + - 2015/04/03 (1.38) - removed ImGuiCol_CheckHovered, ImGuiCol_CheckActive, replaced with the more general ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive. + - 2014/04/03 (1.38) - removed support for passing -FLT_MAX..+FLT_MAX as the range for a SliderFloat(). Use DragFloat() or Inputfloat() instead. + - 2015/03/17 (1.36) - renamed GetItemBoxMin()/GetItemBoxMax()/IsMouseHoveringBox() to GetItemRectMin()/GetItemRectMax()/IsMouseHoveringRect(). Kept inline redirection function until 1.50. + - 2015/03/15 (1.36) - renamed style.TreeNodeSpacing to style.IndentSpacing, ImGuiStyleVar_TreeNodeSpacing to ImGuiStyleVar_IndentSpacing + - 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function until 1.50. + - 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth (casing) + - 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function until 1.50. + - 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once. + - 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now. + - 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior + - 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing() + - 2015/02/01 (1.31) - removed IO.MemReallocFn (unused) + - 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions. + - 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader. + (1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels. + font init: const void* png_data; unsigned int png_size; ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size); <..Upload texture to GPU..> + became: unsigned char* pixels; int width, height; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); <..Upload texture to GPU>; io.Fonts->TexId = YourTextureIdentifier; + you now more flexibility to load multiple TTF fonts and manage the texture buffer for internal needs. + it is now recommended that you sample the font texture with bilinear interpolation. + (1.30) - added texture identifier in ImDrawCmd passed to your render function (we can now render images). make sure to set io.Fonts->TexID. + (1.30) - removed IO.PixelCenterOffset (unnecessary, can be handled in user projection matrix) + (1.30) - removed ImGui::IsItemFocused() in favor of ImGui::IsItemActive() which handles all widgets + - 2014/12/10 (1.18) - removed SetNewWindowDefaultPos() in favor of new generic API SetNextWindowPos(pos, ImGuiSetCondition_FirstUseEver) + - 2014/11/28 (1.17) - moved IO.Font*** options to inside the IO.Font-> structure (FontYOffset, FontTexUvForWhite, FontBaseScale, FontFallbackGlyph) + - 2014/11/26 (1.17) - reworked syntax of IMGUI_ONCE_UPON_A_FRAME helper macro to increase compiler compatibility + - 2014/11/07 (1.15) - renamed IsHovered() to IsItemHovered() + - 2014/10/02 (1.14) - renamed IMGUI_INCLUDE_IMGUI_USER_CPP to IMGUI_INCLUDE_IMGUI_USER_INL and imgui_user.cpp to imgui_user.inl (more IDE friendly) + - 2014/09/25 (1.13) - removed 'text_end' parameter from IO.SetClipboardTextFn (the string is now always zero-terminated for simplicity) + - 2014/09/24 (1.12) - renamed SetFontScale() to SetWindowFontScale() + - 2014/09/24 (1.12) - moved IM_MALLOC/IM_REALLOC/IM_FREE preprocessor defines to IO.MemAllocFn/IO.MemReallocFn/IO.MemFreeFn + - 2014/08/30 (1.09) - removed IO.FontHeight (now computed automatically) + - 2014/08/30 (1.09) - moved IMGUI_FONT_TEX_UV_FOR_WHITE preprocessor define to IO.FontTexUvForWhite + - 2014/08/28 (1.09) - changed the behavior of IO.PixelCenterOffset following various rendering fixes + + + FREQUENTLY ASKED QUESTIONS (FAQ), TIPS + ====================================== + + Q: How can I tell whether to dispatch mouse/keyboard to imgui or to my application? + A: You can read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags from the ImGuiIO structure (e.g. if (ImGui::GetIO().WantCaptureMouse) { ... } ) + - When 'io.WantCaptureMouse' is set, imgui wants to use your mouse state, and you may want to discard/hide the inputs from the rest of your application. + - When 'io.WantCaptureKeyboard' is set, imgui wants to use your keyboard state, and you may want to discard/hide the inputs from the rest of your application. + - When 'io.WantTextInput' is set to may want to notify your OS to popup an on-screen keyboard, if available (e.g. on a mobile phone, or console OS). + Note: you should always pass your mouse/keyboard inputs to imgui, even when the io.WantCaptureXXX flag are set false. + This is because imgui needs to detect that you clicked in the void to unfocus its own windows. + Note: The 'io.WantCaptureMouse' is more accurate that any attempt to "check if the mouse is hovering a window" (don't do that!). + It handle mouse dragging correctly (both dragging that started over your application or over an imgui window) and handle e.g. modal windows blocking inputs. + Those flags are updated by ImGui::NewFrame(). Preferably read the flags after calling NewFrame() if you can afford it, but reading them before is also + perfectly fine, as the bool toggle fairly rarely. If you have on a touch device, you might find use for an early call to UpdateHoveredWindowAndCaptureFlags(). + Note: Text input widget releases focus on "Return KeyDown", so the subsequent "Return KeyUp" event that your application receive will typically + have 'io.WantCaptureKeyboard=false'. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs + were targeted for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.) + + Q: How can I display an image? What is ImTextureID, how does it works? + A: Short explanation: + - You may use functions such as ImGui::Image(), ImGui::ImageButton() or lower-level ImDrawList::AddImage() to emit draw calls that will use your own textures. + - Actual textures are identified in a way that is up to the user/engine. Those identifiers are stored and passed as ImTextureID (void*) value. + - Loading image files from the disk and turning them into a texture is not within the scope of Dear ImGui (for a good reason). + Please read documentations or tutorials on your graphics API to understand how to display textures on the screen before moving onward. + + Long explanation: + - Dear ImGui's job is to create "meshes", defined in a renderer-agnostic format made of draw commands and vertices. + At the end of the frame those meshes (ImDrawList) will be displayed by your rendering function. They are made up of textured polygons and the code + to render them is generally fairly short (a few dozen lines). In the examples/ folder we provide functions for popular graphics API (OpenGL, DirectX, etc.). + - Each rendering function decides on a data type to represent "textures". The concept of what is a "texture" is entirely tied to your underlying engine/graphics API. + We carry the information to identify a "texture" in the ImTextureID type. + ImTextureID is nothing more that a void*, aka 4/8 bytes worth of data: just enough to store 1 pointer or 1 integer of your choice. + Dear ImGui doesn't know or understand what you are storing in ImTextureID, it merely pass ImTextureID values until they reach your rendering function. + - In the examples/ bindings, for each graphics API binding we decided on a type that is likely to be a good representation for specifying + an image from the end-user perspective. This is what the _examples_ rendering functions are using: + + OpenGL: ImTextureID = GLuint (see ImGui_ImplGlfwGL3_RenderDrawData() function in imgui_impl_glfw_gl3.cpp) + DirectX9: ImTextureID = LPDIRECT3DTEXTURE9 (see ImGui_ImplDX9_RenderDrawData() function in imgui_impl_dx9.cpp) + DirectX11: ImTextureID = ID3D11ShaderResourceView* (see ImGui_ImplDX11_RenderDrawData() function in imgui_impl_dx11.cpp) + DirectX12: ImTextureID = D3D12_GPU_DESCRIPTOR_HANDLE (see ImGui_ImplDX12_RenderDrawData() function in imgui_impl_dx12.cpp) + + For example, in the OpenGL example binding we store raw OpenGL texture identifier (GLuint) inside ImTextureID. + Whereas in the DirectX11 example binding we store a pointer to ID3D11ShaderResourceView inside ImTextureID, which is a higher-level structure + tying together both the texture and information about its format and how to read it. + - If you have a custom engine built over e.g. OpenGL, instead of passing GLuint around you may decide to use a high-level data type to carry information about + the texture as well as how to display it (shaders, etc.). The decision of what to use as ImTextureID can always be made better knowing how your codebase + is designed. If your engine has high-level data types for "textures" and "material" then you may want to use them. + If you are starting with OpenGL or DirectX or Vulkan and haven't built much of a rendering engine over them, keeping the default ImTextureID + representation suggested by the example bindings is probably the best choice. + (Advanced users may also decide to keep a low-level type in ImTextureID, and use ImDrawList callback and pass information to their renderer) + + User code may do: + + // Cast our texture type to ImTextureID / void* + MyTexture* texture = g_CoffeeTableTexture; + ImGui::Image((void*)texture, ImVec2(texture->Width, texture->Height)); + + The renderer function called after ImGui::Render() will receive that same value that the user code passed: + + // Cast ImTextureID / void* stored in the draw command as our texture type + MyTexture* texture = (MyTexture*)pcmd->TextureId; + MyEngineBindTexture2D(texture); + + Once you understand this design you will understand that loading image files and turning them into displayable textures is not within the scope of Dear ImGui. + This is by design and is actually a good thing, because it means your code has full control over your data types and how you display them. + If you want to display an image file (e.g. PNG file) into the screen, please refer to documentation and tutorials for the graphics API you are using. + + Here's a simplified OpenGL example using stb_image.h: + + // Use stb_image.h to load a PNG from disk and turn it into raw RGBA pixel data: + #define STB_IMAGE_IMPLEMENTATION + #include + [...] + int my_image_width, my_image_height; + unsigned char* my_image_data = stbi_load("my_image.png", &my_image_width, &my_image_height, NULL, 4); + + // Turn the RGBA pixel data into an OpenGL texture: + GLuint my_opengl_texture; + glGenTextures(1, &my_opengl_texture); + glBindTexture(GL_TEXTURE_2D, my_opengl_texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image_width, image_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data); + + // Now that we have an OpenGL texture, assuming our imgui rendering function (imgui_impl_xxx.cpp file) takes GLuint as ImTextureID, we can display it: + ImGui::Image((void*)(intptr_t)my_opengl_texture, ImVec2(my_image_width, my_image_height)); + + C/C++ tip: a void* is pointer-sized storage. You may safely store any pointer or integer into it by casting your value to ImTexture / void*, and vice-versa. + Because both end-points (user code and rendering function) are under your control, you know exactly what is stored inside the ImTexture / void*. + Examples: + + GLuint my_tex = XXX; + void* my_void_ptr; + my_void_ptr = (void*)(intptr_t)my_tex; // cast a GLuint into a void* (we don't take its address! we literally store the value inside the pointer) + my_tex = (GLuint)(intptr_t)my_void_ptr; // cast a void* into a GLuint + + ID3D11ShaderResourceView* my_dx11_srv = XXX; + void* my_void_ptr; + my_void_ptr = (void*)my_dx11_srv; // cast a ID3D11ShaderResourceView* into an opaque void* + my_dx11_srv = (ID3D11ShaderResourceView*)my_void_ptr; // cast a void* into a ID3D11ShaderResourceView* + + Finally, you may call ImGui::ShowMetricsWindow() to explore/visualize/understand how the ImDrawList are generated. + + Q: How can I have multiple widgets with the same label or without a label? + Q: I have multiple widgets with the same label, and only the first one works. Why is that? + A: A primer on labels and the ID Stack... + + Dear ImGui internally need to uniquely identify UI elements. + Elements that are typically not clickable (such as calls to the Text functions) don't need an ID. + Interactive widgets (such as calls to Button buttons) need a unique ID. + Unique ID are used internally to track active widgets and occasionally associate state to widgets. + Unique ID are implicitly built from the hash of multiple elements that identify the "path" to the UI element. + + - Unique ID are often derived from a string label: + + Button("OK"); // Label = "OK", ID = hash of (..., "OK") + Button("Cancel"); // Label = "Cancel", ID = hash of (..., "Cancel") + + - ID are uniquely scoped within windows, tree nodes, etc. which all pushes to the ID stack. Having + two buttons labeled "OK" in different windows or different tree locations is fine. + We used "..." above to signify whatever was already pushed to the ID stack previously: + + Begin("MyWindow"); + Button("OK"); // Label = "OK", ID = hash of ("MyWindow", "OK") + End(); + + - If you have a same ID twice in the same location, you'll have a conflict: + + Button("OK"); + Button("OK"); // ID collision! Interacting with either button will trigger the first one. + + Fear not! this is easy to solve and there are many ways to solve it! + + - Solving ID conflict in a simple/local context: + When passing a label you can optionally specify extra ID information within string itself. + Use "##" to pass a complement to the ID that won't be visible to the end-user. + This helps solving the simple collision cases when you know e.g. at compilation time which items + are going to be created: + + Begin("MyWindow"); + Button("Play"); // Label = "Play", ID = hash of ("MyWindow", "Play") + Button("Play##foo1"); // Label = "Play", ID = hash of ("MyWindow", "Play##foo1") // Different from above + Button("Play##foo2"); // Label = "Play", ID = hash of ("MyWindow", "Play##foo2") // Different from above + End(); + + - If you want to completely hide the label, but still need an ID: + + Checkbox("##On", &b); // Label = "", ID = hash of (..., "##On") // No visible label, just a checkbox! + + - Occasionally/rarely you might want change a label while preserving a constant ID. This allows + you to animate labels. For example you may want to include varying information in a window title bar, + but windows are uniquely identified by their ID. Use "###" to pass a label that isn't part of ID: + + Button("Hello###ID"); // Label = "Hello", ID = hash of (..., "ID") + Button("World###ID"); // Label = "World", ID = hash of (..., "ID") // Same as above, even though the label looks different + + sprintf(buf, "My game (%f FPS)###MyGame", fps); + Begin(buf); // Variable title, ID = hash of "MyGame" + + - Solving ID conflict in a more general manner: + Use PushID() / PopID() to create scopes and manipulate the ID stack, as to avoid ID conflicts + within the same window. This is the most convenient way of distinguishing ID when iterating and + creating many UI elements programmatically. + You can push a pointer, a string or an integer value into the ID stack. + Remember that ID are formed from the concatenation of _everything_ in the ID stack! + + Begin("Window"); + for (int i = 0; i < 100; i++) + { + PushID(i); // Push i to the id tack + Button("Click"); // Label = "Click", ID = Hash of ("Window", i, "Click") + PopID(); + } + for (int i = 0; i < 100; i++) + { + MyObject* obj = Objects[i]; + PushID(obj); + Button("Click"); // Label = "Click", ID = Hash of ("Window", obj pointer, "Click") + PopID(); + } + for (int i = 0; i < 100; i++) + { + MyObject* obj = Objects[i]; + PushID(obj->Name); + Button("Click"); // Label = "Click", ID = Hash of ("Window", obj->Name, "Click") + PopID(); + } + End(); + + - More example showing that you can stack multiple prefixes into the ID stack: + + Button("Click"); // Label = "Click", ID = hash of (..., "Click") + PushID("node"); + Button("Click"); // Label = "Click", ID = hash of (..., "node", "Click") + PushID(my_ptr); + Button("Click"); // Label = "Click", ID = hash of (..., "node", my_ptr, "Click") + PopID(); + PopID(); + + - Tree nodes implicitly creates a scope for you by calling PushID(). + + Button("Click"); // Label = "Click", ID = hash of (..., "Click") + if (TreeNode("node")) + { + Button("Click"); // Label = "Click", ID = hash of (..., "node", "Click") + TreePop(); + } + + - When working with trees, ID are used to preserve the open/close state of each tree node. + Depending on your use cases you may want to use strings, indices or pointers as ID. + e.g. when following a single pointer that may change over time, using a static string as ID + will preserve your node open/closed state when the targeted object change. + e.g. when displaying a list of objects, using indices or pointers as ID will preserve the + node open/closed state differently. See what makes more sense in your situation! + + Q: How can I use my own math types instead of ImVec2/ImVec4? + A: You can edit imconfig.h and setup the IM_VEC2_CLASS_EXTRA/IM_VEC4_CLASS_EXTRA macros to add implicit type conversions. + This way you'll be able to use your own types everywhere, e.g. passsing glm::vec2 to ImGui functions instead of ImVec2. + + Q: How can I load a different font than the default? + A: Use the font atlas to load the TTF/OTF file you want: + ImGuiIO& io = ImGui::GetIO(); + io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); + io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() + Default is ProggyClean.ttf, rendered at size 13, embedded in dear imgui's source code. + (Read the 'misc/fonts/README.txt' file for more details about font loading.) + + New programmers: remember that in C/C++ and most programming languages if you want to use a + backslash \ within a string literal, you need to write it double backslash "\\": + io.Fonts->AddFontFromFileTTF("MyDataFolder\MyFontFile.ttf", size_in_pixels); // WRONG (you are escape the M here!) + io.Fonts->AddFontFromFileTTF("MyDataFolder\\MyFontFile.ttf", size_in_pixels); // CORRECT + io.Fonts->AddFontFromFileTTF("MyDataFolder/MyFontFile.ttf", size_in_pixels); // ALSO CORRECT + + Q: How can I easily use icons in my application? + A: The most convenient and practical way is to merge an icon font such as FontAwesome inside you + main font. Then you can refer to icons within your strings. + (Read the 'misc/fonts/README.txt' file for more details about icons font loading.) + + Q: How can I load multiple fonts? + A: Use the font atlas to pack them into a single texture: + (Read the 'misc/fonts/README.txt' file and the code in ImFontAtlas for more details.) + + ImGuiIO& io = ImGui::GetIO(); + ImFont* font0 = io.Fonts->AddFontDefault(); + ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); + ImFont* font2 = io.Fonts->AddFontFromFileTTF("myfontfile2.ttf", size_in_pixels); + io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() + // the first loaded font gets used by default + // use ImGui::PushFont()/ImGui::PopFont() to change the font at runtime + + // Options + ImFontConfig config; + config.OversampleH = 3; + config.OversampleV = 1; + config.GlyphOffset.y -= 2.0f; // Move everything by 2 pixels up + config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters + io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, &config); + + // Combine multiple fonts into one (e.g. for icon fonts) + static ImWchar ranges[] = { 0xf000, 0xf3ff, 0 }; + ImFontConfig config; + config.MergeMode = true; + io.Fonts->AddFontDefault(); + io.Fonts->AddFontFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); // Merge icon font + io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs + + Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic? + A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. + + // Add default Japanese ranges + io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, io.Fonts->GetGlyphRangesJapanese()); + + // Or create your own custom ranges (e.g. for a game you can feed your entire game script and only build the characters the game need) + ImVector ranges; + ImFontAtlas::GlyphRangesBuilder builder; + builder.AddText("Hello world"); // Add a string (here "Hello world" contains 7 unique characters) + builder.AddChar(0x7262); // Add a specific character + builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges + builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted) + io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, ranges.Data); + + All your strings needs to use UTF-8 encoding. In C++11 you can encode a string literal in UTF-8 + by using the u8"hello" syntax. Specifying literal in your source code using a local code page + (such as CP-923 for Japanese or CP-1251 for Cyrillic) will NOT work! + Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8. + + Text input: it is up to your application to pass the right character code by calling io.AddInputCharacter(). + The applications in examples/ are doing that. + Windows: you can use the WM_CHAR or WM_UNICHAR or WM_IME_CHAR message (depending if your app is built using Unicode or MultiByte mode). + You may also use MultiByteToWideChar() or ToUnicode() to retrieve Unicode codepoints from MultiByte characters or keyboard state. + Windows: if your language is relying on an Input Method Editor (IME), you copy the HWND of your window to io.ImeWindowHandle in order for + the default implementation of io.ImeSetInputScreenPosFn() to set your Microsoft IME position correctly. + + Q: How can I use the drawing facilities without an ImGui window? (using ImDrawList API) + A: - You can create a dummy window. Call Begin() with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags. + (The ImGuiWindowFlags_NoDecoration flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse) + Then you can retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like. + - You can call ImGui::GetOverlayDrawList() and use this draw list to display contents over every other imgui windows. + - You can create your own ImDrawList instance. You'll need to initialize them ImGui::GetDrawListSharedData(), or create your own ImDrawListSharedData, + and then call your rendered code with your own ImDrawList or ImDrawData data. + + Q: I integrated Dear ImGui in my engine and the text or lines are blurry.. + A: In your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f). + Also make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension. + + Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around.. + A: You are probably mishandling the clipping rectangles in your render function. + Rectangles provided by ImGui are defined as (x1=left,y1=top,x2=right,y2=bottom) and NOT as (x1,y1,width,height). + + Q: How can I help? + A: - If you are experienced with Dear ImGui and C++, look at the github issues, or docs/TODO.txt and see how you want/can help! + - Convince your company to sponsor/fund development! Individual users: you can also become a Patron (patreon.com/imgui) or donate on PayPal! See README. + - Disclose your usage of dear imgui via a dev blog post, a tweet, a screenshot, a mention somewhere etc. + You may post screenshot or links in the gallery threads (github.com/ocornut/imgui/issues/1269). Visuals are ideal as they inspire other programmers. + But even without visuals, disclosing your use of dear imgui help the library grow credibility, and help other teams and programmers with taking decisions. + - If you have issues or if you need to hack into the library, even if you don't expect any support it is useful that you share your issues (on github or privately). + + - tip: you can call Begin() multiple times with the same name during the same frame, it will keep appending to the same window. + this is also useful to set yourself in the context of another window (to get/set other settings) + - tip: you can create widgets without a Begin()/End() block, they will go in an implicit window called "Debug". + - tip: the ImGuiOnceUponAFrame helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle + of a deep nested inner loop in your code. + - tip: you can call Render() multiple times (e.g for VR renders). + - tip: call and read the ShowDemoWindow() code in imgui_demo.cpp for more example of how to use ImGui! + +*/ + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include "imgui.h" +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif +#include "imgui_internal.h" + +#include // toupper, isprint +#include // vsnprintf, sscanf, printf +#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier +#include // intptr_t +#else +#include // intptr_t +#endif + +// Debug options +#define IMGUI_DEBUG_NAV_SCORING 0 +#define IMGUI_DEBUG_NAV_RECTS 0 + +// Visual Studio warnings +#ifdef _MSC_VER +#pragma warning (disable: 4127) // condition expression is constant +#pragma warning (disable: 4201) // nonstandard extension used: nameless struct/union +#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) +#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen +#endif + +// Clang/GCC warnings with -Weverything +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning : unknown warning group '-Wformat-pedantic *' // not all warnings are known by all clang versions.. so ignoring warnings triggers new warnings on some configuration. great! +#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. +#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok. +#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code. +#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. +#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. +#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // +#pragma clang diagnostic ignored "-Wdeprecated-declarations"// warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code) +#pragma clang diagnostic ignored "-Wunused-function" // warning : 'xxxx' defined but not used +#pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic. +#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size +#pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*' +#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function +#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value +#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked +#pragma GCC diagnostic ignored "-Wstrict-overflow" // warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false +#if __GNUC__ >= 8 +#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead +#endif +#endif + +// When using CTRL+TAB (or Gamepad Square+L/R) we delay the visual a little in order to reduce visual noise doing a fast switch. +static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in +static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time before the window list starts to appear + +// Window resizing from edges (when io.ConfigResizeWindowsFromEdges = true) +static const float RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS = 4.0f; // Extend outside and inside windows. Affect FindHoveredWindow(). +static const float RESIZE_WINDOWS_FROM_EDGES_FEEDBACK_TIMER = 0.04f; // Reduce visual noise by only highlighting the border after a certain time. + +//------------------------------------------------------------------------- +// [SECTION] FORWARD DECLARATIONS +//------------------------------------------------------------------------- + +static void SetCurrentWindow(ImGuiWindow* window); +static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond); +static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond); +static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond); +static void FindHoveredWindow(); +static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags); +static void CheckStacksSize(ImGuiWindow* window, bool write); +static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges); + +static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list); +static void AddWindowToDrawData(ImVector* out_list, ImGuiWindow* window); +static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window); + +static ImRect GetViewportRect(); + +// Settings +static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name); +static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line); +static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf); + +// Platform Dependents default implementation for IO functions +static const char* GetClipboardTextFn_DefaultImpl(void* user_data); +static void SetClipboardTextFn_DefaultImpl(void* user_data, const char* text); +static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y); + +namespace ImGui +{ +static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags); + +// Navigation +static void NavUpdate(); +static void NavUpdateWindowing(); +static void NavUpdateWindowingList(); +static void NavUpdateMoveResult(); +static float NavUpdatePageUpPageDown(int allowed_dir_flags); +static inline void NavUpdateAnyRequestFlag(); +static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id); +static ImVec2 NavCalcPreferredRefPos(); +static void NavSaveLastChildNavWindow(ImGuiWindow* nav_window); +static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window); + +// Misc +static void UpdateMouseInputs(); +static void UpdateMouseWheel(); +static void UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]); +} + +// Test engine hooks (imgui-test) +//#define IMGUI_ENABLE_TEST_ENGINE_HOOKS +#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS +extern void ImGuiTestEngineHook_PreNewFrame(); +extern void ImGuiTestEngineHook_PostNewFrame(); +extern void ImGuiTestEngineHook_ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg); +#endif + +//----------------------------------------------------------------------------- +// [SECTION] CONTEXT AND MEMORY ALLOCATORS +//----------------------------------------------------------------------------- + +// Current context pointer. Implicitly used by all Dear ImGui functions. Always assumed to be != NULL. +// CreateContext() will automatically set this pointer if it is NULL. Change to a different context by calling ImGui::SetCurrentContext(). +// If you use DLL hotreloading you might need to call SetCurrentContext() after reloading code from this file. +// ImGui functions are not thread-safe because of this pointer. If you want thread-safety to allow N threads to access N different contexts, you can: +// - Change this variable to use thread local storage. You may #define GImGui in imconfig.h for that purpose. Future development aim to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586 +// - Having multiple instances of the ImGui code compiled inside different namespace (easiest/safest, if you have a finite number of contexts) +#ifndef GImGui +ImGuiContext* GImGui = NULL; +#endif + +// Memory Allocator functions. Use SetAllocatorFunctions() to change them. +// If you use DLL hotreloading you might need to call SetAllocatorFunctions() after reloading code from this file. +// Otherwise, you probably don't want to modify them mid-program, and if you use global/static e.g. ImVector<> instances you may need to keep them accessible during program destruction. +#ifndef IMGUI_DISABLE_DEFAULT_ALLOCATORS +static void* MallocWrapper(size_t size, void* user_data) { (void)user_data; return malloc(size); } +static void FreeWrapper(void* ptr, void* user_data) { (void)user_data; free(ptr); } +#else +static void* MallocWrapper(size_t size, void* user_data) { (void)user_data; (void)size; IM_ASSERT(0); return NULL; } +static void FreeWrapper(void* ptr, void* user_data) { (void)user_data; (void)ptr; IM_ASSERT(0); } +#endif + +static void* (*GImAllocatorAllocFunc)(size_t size, void* user_data) = MallocWrapper; +static void (*GImAllocatorFreeFunc)(void* ptr, void* user_data) = FreeWrapper; +static void* GImAllocatorUserData = NULL; + +//----------------------------------------------------------------------------- +// [SECTION] MAIN USER FACING STRUCTURES (ImGuiStyle, ImGuiIO) +//----------------------------------------------------------------------------- + +ImGuiStyle::ImGuiStyle() +{ + Alpha = 1.0f; // Global alpha applies to everything in ImGui + WindowPadding = ImVec2(8,8); // Padding within a window + WindowRounding = 7.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows + WindowBorderSize = 1.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested. + WindowMinSize = ImVec2(32,32); // Minimum window size + WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text + ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows + ChildBorderSize = 1.0f; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested. + PopupRounding = 0.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows + PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested. + FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets) + FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets). + FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested. + ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines + ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label) + TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! + IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). + ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns + ScrollbarSize = 16.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar + ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar + GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar + GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text. + DisplayWindowPadding = ImVec2(20,20); // Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows. + DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. + MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. + AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU. + AntiAliasedFill = true; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) + CurveTessellationTol = 1.25f; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. + + // Default theme + ImGui::StyleColorsDark(this); +} + +// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you. +// Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times. +void ImGuiStyle::ScaleAllSizes(float scale_factor) +{ + WindowPadding = ImFloor(WindowPadding * scale_factor); + WindowRounding = ImFloor(WindowRounding * scale_factor); + WindowMinSize = ImFloor(WindowMinSize * scale_factor); + ChildRounding = ImFloor(ChildRounding * scale_factor); + PopupRounding = ImFloor(PopupRounding * scale_factor); + FramePadding = ImFloor(FramePadding * scale_factor); + FrameRounding = ImFloor(FrameRounding * scale_factor); + ItemSpacing = ImFloor(ItemSpacing * scale_factor); + ItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor); + TouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor); + IndentSpacing = ImFloor(IndentSpacing * scale_factor); + ColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor); + ScrollbarSize = ImFloor(ScrollbarSize * scale_factor); + ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor); + GrabMinSize = ImFloor(GrabMinSize * scale_factor); + GrabRounding = ImFloor(GrabRounding * scale_factor); + DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor); + DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor); + MouseCursorScale = ImFloor(MouseCursorScale * scale_factor); +} + +ImGuiIO::ImGuiIO() +{ + // Most fields are initialized with zero + memset(this, 0, sizeof(*this)); + + // Settings + ConfigFlags = ImGuiConfigFlags_None; + BackendFlags = ImGuiBackendFlags_None; + DisplaySize = ImVec2(-1.0f, -1.0f); + DeltaTime = 1.0f/60.0f; + IniSavingRate = 5.0f; + IniFilename = "imgui.ini"; + LogFilename = "imgui_log.txt"; + MouseDoubleClickTime = 0.30f; + MouseDoubleClickMaxDist = 6.0f; + for (int i = 0; i < ImGuiKey_COUNT; i++) + KeyMap[i] = -1; + KeyRepeatDelay = 0.250f; + KeyRepeatRate = 0.050f; + UserData = NULL; + + Fonts = NULL; + FontGlobalScale = 1.0f; + FontDefault = NULL; + FontAllowUserScaling = false; + DisplayFramebufferScale = ImVec2(1.0f, 1.0f); + DisplayVisibleMin = DisplayVisibleMax = ImVec2(0.0f, 0.0f); + + // Miscellaneous configuration options +#ifdef __APPLE__ + ConfigMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag +#else + ConfigMacOSXBehaviors = false; +#endif + ConfigInputTextCursorBlink = true; + ConfigResizeWindowsFromEdges = false; + + // Platform Functions + BackendPlatformName = BackendRendererName = NULL; + GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations + SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; + ClipboardUserData = NULL; + ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl; + ImeWindowHandle = NULL; + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + RenderDrawListsFn = NULL; +#endif + + // Input (NB: we already have memset zero the entire structure!) + MousePos = ImVec2(-FLT_MAX, -FLT_MAX); + MousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX); + MouseDragThreshold = 6.0f; + for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f; + for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f; + for (int i = 0; i < IM_ARRAYSIZE(NavInputsDownDuration); i++) NavInputsDownDuration[i] = -1.0f; +} + +// Pass in translated ASCII characters for text input. +// - with glfw you can get those from the callback set in glfwSetCharCallback() +// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message +void ImGuiIO::AddInputCharacter(ImWchar c) +{ + const int n = ImStrlenW(InputCharacters); + if (n + 1 < IM_ARRAYSIZE(InputCharacters)) + { + InputCharacters[n] = c; + InputCharacters[n+1] = '\0'; + } +} + +void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) +{ + // We can't pass more wchars than ImGuiIO::InputCharacters[] can hold so don't convert more + const int wchars_buf_len = sizeof(ImGuiIO::InputCharacters) / sizeof(ImWchar); + ImWchar wchars[wchars_buf_len]; + ImTextStrFromUtf8(wchars, wchars_buf_len, utf8_chars, NULL); + for (int i = 0; i < wchars_buf_len && wchars[i] != 0; i++) + AddInputCharacter(wchars[i]); +} + +//----------------------------------------------------------------------------- +// [SECTION] MISC HELPER/UTILITIES (Maths, String, Format, Hash, File functions) +//----------------------------------------------------------------------------- + +ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p) +{ + ImVec2 ap = p - a; + ImVec2 ab_dir = b - a; + float dot = ap.x * ab_dir.x + ap.y * ab_dir.y; + if (dot < 0.0f) + return a; + float ab_len_sqr = ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y; + if (dot > ab_len_sqr) + return b; + return a + ab_dir * dot / ab_len_sqr; +} + +bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) +{ + bool b1 = ((p.x - b.x) * (a.y - b.y) - (p.y - b.y) * (a.x - b.x)) < 0.0f; + bool b2 = ((p.x - c.x) * (b.y - c.y) - (p.y - c.y) * (b.x - c.x)) < 0.0f; + bool b3 = ((p.x - a.x) * (c.y - a.y) - (p.y - a.y) * (c.x - a.x)) < 0.0f; + return ((b1 == b2) && (b2 == b3)); +} + +void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w) +{ + ImVec2 v0 = b - a; + ImVec2 v1 = c - a; + ImVec2 v2 = p - a; + const float denom = v0.x * v1.y - v1.x * v0.y; + out_v = (v2.x * v1.y - v1.x * v2.y) / denom; + out_w = (v0.x * v2.y - v2.x * v0.y) / denom; + out_u = 1.0f - out_v - out_w; +} + +ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) +{ + ImVec2 proj_ab = ImLineClosestPoint(a, b, p); + ImVec2 proj_bc = ImLineClosestPoint(b, c, p); + ImVec2 proj_ca = ImLineClosestPoint(c, a, p); + float dist2_ab = ImLengthSqr(p - proj_ab); + float dist2_bc = ImLengthSqr(p - proj_bc); + float dist2_ca = ImLengthSqr(p - proj_ca); + float m = ImMin(dist2_ab, ImMin(dist2_bc, dist2_ca)); + if (m == dist2_ab) + return proj_ab; + if (m == dist2_bc) + return proj_bc; + return proj_ca; +} + +int ImStricmp(const char* str1, const char* str2) +{ + int d; + while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } + return d; +} + +int ImStrnicmp(const char* str1, const char* str2, size_t count) +{ + int d = 0; + while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; } + return d; +} + +void ImStrncpy(char* dst, const char* src, size_t count) +{ + if (count < 1) return; + strncpy(dst, src, count); + dst[count-1] = 0; +} + +char* ImStrdup(const char *str) +{ + size_t len = strlen(str) + 1; + void* buf = ImGui::MemAlloc(len); + return (char*)memcpy(buf, (const void*)str, len); +} + +const char* ImStrchrRange(const char* str, const char* str_end, char c) +{ + const char* p = (const char*)memchr(str, (int)c, str_end - str); + return p; +} + +int ImStrlenW(const ImWchar* str) +{ + //return (int)wcslen((const wchar_t*)str); // FIXME-OPT: Could use this when wchar_t are 16-bits + int n = 0; + while (*str++) n++; + return n; +} + +// Find end-of-line. Return pointer will point to either first \n, either str_end. +const char* ImStreolRange(const char* str, const char* str_end) +{ + const char* p = (const char*)memchr(str, '\n', str_end - str); + return p ? p : str_end; +} + +const ImWchar* ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin) // find beginning-of-line +{ + while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n') + buf_mid_line--; + return buf_mid_line; +} + +const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end) +{ + if (!needle_end) + needle_end = needle + strlen(needle); + + const char un0 = (char)toupper(*needle); + while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end)) + { + if (toupper(*haystack) == un0) + { + const char* b = needle + 1; + for (const char* a = haystack + 1; b < needle_end; a++, b++) + if (toupper(*a) != toupper(*b)) + break; + if (b == needle_end) + return haystack; + } + haystack++; + } + return NULL; +} + +// Trim str by offsetting contents when there's leading data + writing a \0 at the trailing position. We use this in situation where the cost is negligible. +void ImStrTrimBlanks(char* buf) +{ + char* p = buf; + while (p[0] == ' ' || p[0] == '\t') // Leading blanks + p++; + char* p_start = p; + while (*p != 0) // Find end of string + p++; + while (p > p_start && (p[-1] == ' ' || p[-1] == '\t')) // Trailing blanks + p--; + if (p_start != buf) // Copy memory if we had leading blanks + memmove(buf, p_start, p - p_start); + buf[p - p_start] = 0; // Zero terminate +} + +// A) MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size). +// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm. +// B) When buf==NULL vsnprintf() will return the output size. +#ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS + +#if defined(_MSC_VER) && !defined(vsnprintf) +#define vsnprintf _vsnprintf +#endif + +int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + int w = vsnprintf(buf, buf_size, fmt, args); + va_end(args); + if (buf == NULL) + return w; + if (w == -1 || w >= (int)buf_size) + w = (int)buf_size - 1; + buf[w] = 0; + return w; +} + +int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) +{ + int w = vsnprintf(buf, buf_size, fmt, args); + if (buf == NULL) + return w; + if (w == -1 || w >= (int)buf_size) + w = (int)buf_size - 1; + buf[w] = 0; + return w; +} +#endif // #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS + +// Pass data_size==0 for zero-terminated strings +// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements. +ImU32 ImHash(const void* data, int data_size, ImU32 seed) +{ + static ImU32 crc32_lut[256] = { 0 }; + if (!crc32_lut[1]) + { + const ImU32 polynomial = 0xEDB88320; + for (ImU32 i = 0; i < 256; i++) + { + ImU32 crc = i; + for (ImU32 j = 0; j < 8; j++) + crc = (crc >> 1) ^ (ImU32(-int(crc & 1)) & polynomial); + crc32_lut[i] = crc; + } + } + + seed = ~seed; + ImU32 crc = seed; + const unsigned char* current = (const unsigned char*)data; + + if (data_size > 0) + { + // Known size + while (data_size--) + crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++]; + } + else + { + // Zero-terminated string + while (unsigned char c = *current++) + { + // We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed. + // Because this syntax is rarely used we are optimizing for the common case. + // - If we reach ### in the string we discard the hash so far and reset to the seed. + // - We don't do 'current += 2; continue;' after handling ### to keep the code smaller. + if (c == '#' && current[0] == '#' && current[1] == '#') + crc = seed; + crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c]; + } + } + return ~crc; +} + +FILE* ImFileOpen(const char* filename, const char* mode) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__) + // We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames. Converting both strings from UTF-8 to wchar format (using a single allocation, because we can) + const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1; + const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1; + ImVector buf; + buf.resize(filename_wsize + mode_wsize); + ImTextStrFromUtf8(&buf[0], filename_wsize, filename, NULL); + ImTextStrFromUtf8(&buf[filename_wsize], mode_wsize, mode, NULL); + return _wfopen((wchar_t*)&buf[0], (wchar_t*)&buf[filename_wsize]); +#else + return fopen(filename, mode); +#endif +} + +// Load file content into memory +// Memory allocated with ImGui::MemAlloc(), must be freed by user using ImGui::MemFree() +void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, size_t* out_file_size, int padding_bytes) +{ + IM_ASSERT(filename && file_open_mode); + if (out_file_size) + *out_file_size = 0; + + FILE* f; + if ((f = ImFileOpen(filename, file_open_mode)) == NULL) + return NULL; + + long file_size_signed; + if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET)) + { + fclose(f); + return NULL; + } + + size_t file_size = (size_t)file_size_signed; + void* file_data = ImGui::MemAlloc(file_size + padding_bytes); + if (file_data == NULL) + { + fclose(f); + return NULL; + } + if (fread(file_data, 1, file_size, f) != file_size) + { + fclose(f); + ImGui::MemFree(file_data); + return NULL; + } + if (padding_bytes > 0) + memset((void*)(((char*)file_data) + file_size), 0, (size_t)padding_bytes); + + fclose(f); + if (out_file_size) + *out_file_size = file_size; + + return file_data; +} + +//----------------------------------------------------------------------------- +// [SECTION] MISC HELPERS/UTILITIES (ImText* functions) +//----------------------------------------------------------------------------- + +// Convert UTF-8 to 32-bits character, process single character input. +// Based on stb_from_utf8() from github.com/nothings/stb/ +// We handle UTF-8 decoding error by skipping forward. +int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end) +{ + unsigned int c = (unsigned int)-1; + const unsigned char* str = (const unsigned char*)in_text; + if (!(*str & 0x80)) + { + c = (unsigned int)(*str++); + *out_char = c; + return 1; + } + if ((*str & 0xe0) == 0xc0) + { + *out_char = 0xFFFD; // will be invalid but not end of string + if (in_text_end && in_text_end - (const char*)str < 2) return 1; + if (*str < 0xc2) return 2; + c = (unsigned int)((*str++ & 0x1f) << 6); + if ((*str & 0xc0) != 0x80) return 2; + c += (*str++ & 0x3f); + *out_char = c; + return 2; + } + if ((*str & 0xf0) == 0xe0) + { + *out_char = 0xFFFD; // will be invalid but not end of string + if (in_text_end && in_text_end - (const char*)str < 3) return 1; + if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3; + if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below + c = (unsigned int)((*str++ & 0x0f) << 12); + if ((*str & 0xc0) != 0x80) return 3; + c += (unsigned int)((*str++ & 0x3f) << 6); + if ((*str & 0xc0) != 0x80) return 3; + c += (*str++ & 0x3f); + *out_char = c; + return 3; + } + if ((*str & 0xf8) == 0xf0) + { + *out_char = 0xFFFD; // will be invalid but not end of string + if (in_text_end && in_text_end - (const char*)str < 4) return 1; + if (*str > 0xf4) return 4; + if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4; + if (*str == 0xf4 && str[1] > 0x8f) return 4; // str[1] < 0x80 is checked below + c = (unsigned int)((*str++ & 0x07) << 18); + if ((*str & 0xc0) != 0x80) return 4; + c += (unsigned int)((*str++ & 0x3f) << 12); + if ((*str & 0xc0) != 0x80) return 4; + c += (unsigned int)((*str++ & 0x3f) << 6); + if ((*str & 0xc0) != 0x80) return 4; + c += (*str++ & 0x3f); + // utf-8 encodings of values used in surrogate pairs are invalid + if ((c & 0xFFFFF800) == 0xD800) return 4; + *out_char = c; + return 4; + } + *out_char = 0; + return 0; +} + +int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining) +{ + ImWchar* buf_out = buf; + ImWchar* buf_end = buf + buf_size; + while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) + { + unsigned int c; + in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); + if (c == 0) + break; + if (c < 0x10000) // FIXME: Losing characters that don't fit in 2 bytes + *buf_out++ = (ImWchar)c; + } + *buf_out = 0; + if (in_text_remaining) + *in_text_remaining = in_text; + return (int)(buf_out - buf); +} + +int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end) +{ + int char_count = 0; + while ((!in_text_end || in_text < in_text_end) && *in_text) + { + unsigned int c; + in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); + if (c == 0) + break; + if (c < 0x10000) + char_count++; + } + return char_count; +} + +// Based on stb_to_utf8() from github.com/nothings/stb/ +static inline int ImTextCharToUtf8(char* buf, int buf_size, unsigned int c) +{ + if (c < 0x80) + { + buf[0] = (char)c; + return 1; + } + if (c < 0x800) + { + if (buf_size < 2) return 0; + buf[0] = (char)(0xc0 + (c >> 6)); + buf[1] = (char)(0x80 + (c & 0x3f)); + return 2; + } + if (c >= 0xdc00 && c < 0xe000) + { + return 0; + } + if (c >= 0xd800 && c < 0xdc00) + { + if (buf_size < 4) return 0; + buf[0] = (char)(0xf0 + (c >> 18)); + buf[1] = (char)(0x80 + ((c >> 12) & 0x3f)); + buf[2] = (char)(0x80 + ((c >> 6) & 0x3f)); + buf[3] = (char)(0x80 + ((c ) & 0x3f)); + return 4; + } + //else if (c < 0x10000) + { + if (buf_size < 3) return 0; + buf[0] = (char)(0xe0 + (c >> 12)); + buf[1] = (char)(0x80 + ((c>> 6) & 0x3f)); + buf[2] = (char)(0x80 + ((c ) & 0x3f)); + return 3; + } +} + +// Not optimal but we very rarely use this function. +int ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end) +{ + unsigned int dummy = 0; + return ImTextCharFromUtf8(&dummy, in_text, in_text_end); +} + +static inline int ImTextCountUtf8BytesFromChar(unsigned int c) +{ + if (c < 0x80) return 1; + if (c < 0x800) return 2; + if (c >= 0xdc00 && c < 0xe000) return 0; + if (c >= 0xd800 && c < 0xdc00) return 4; + return 3; +} + +int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end) +{ + char* buf_out = buf; + const char* buf_end = buf + buf_size; + while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) + { + unsigned int c = (unsigned int)(*in_text++); + if (c < 0x80) + *buf_out++ = (char)c; + else + buf_out += ImTextCharToUtf8(buf_out, (int)(buf_end-buf_out-1), c); + } + *buf_out = 0; + return (int)(buf_out - buf); +} + +int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end) +{ + int bytes_count = 0; + while ((!in_text_end || in_text < in_text_end) && *in_text) + { + unsigned int c = (unsigned int)(*in_text++); + if (c < 0x80) + bytes_count++; + else + bytes_count += ImTextCountUtf8BytesFromChar(c); + } + return bytes_count; +} + +//----------------------------------------------------------------------------- +// [SECTION] MISC HELPER/UTILTIES (Color functions) +// Note: The Convert functions are early design which are not consistent with other API. +//----------------------------------------------------------------------------- + +ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in) +{ + float s = 1.0f/255.0f; + return ImVec4( + ((in >> IM_COL32_R_SHIFT) & 0xFF) * s, + ((in >> IM_COL32_G_SHIFT) & 0xFF) * s, + ((in >> IM_COL32_B_SHIFT) & 0xFF) * s, + ((in >> IM_COL32_A_SHIFT) & 0xFF) * s); +} + +ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in) +{ + ImU32 out; + out = ((ImU32)IM_F32_TO_INT8_SAT(in.x)) << IM_COL32_R_SHIFT; + out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT; + out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT; + out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT; + return out; +} + +// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592 +// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv +void ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v) +{ + float K = 0.f; + if (g < b) + { + ImSwap(g, b); + K = -1.f; + } + if (r < g) + { + ImSwap(r, g); + K = -2.f / 6.f - K; + } + + const float chroma = r - (g < b ? g : b); + out_h = ImFabs(K + (g - b) / (6.f * chroma + 1e-20f)); + out_s = chroma / (r + 1e-20f); + out_v = r; +} + +// Convert hsv floats ([0-1],[0-1],[0-1]) to rgb floats ([0-1],[0-1],[0-1]), from Foley & van Dam p593 +// also http://en.wikipedia.org/wiki/HSL_and_HSV +void ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b) +{ + if (s == 0.0f) + { + // gray + out_r = out_g = out_b = v; + return; + } + + h = ImFmod(h, 1.0f) / (60.0f/360.0f); + int i = (int)h; + float f = h - (float)i; + float p = v * (1.0f - s); + float q = v * (1.0f - s * f); + float t = v * (1.0f - s * (1.0f - f)); + + switch (i) + { + case 0: out_r = v; out_g = t; out_b = p; break; + case 1: out_r = q; out_g = v; out_b = p; break; + case 2: out_r = p; out_g = v; out_b = t; break; + case 3: out_r = p; out_g = q; out_b = v; break; + case 4: out_r = t; out_g = p; out_b = v; break; + case 5: default: out_r = v; out_g = p; out_b = q; break; + } +} + +ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul) +{ + ImGuiStyle& style = GImGui->Style; + ImVec4 c = style.Colors[idx]; + c.w *= style.Alpha * alpha_mul; + return ColorConvertFloat4ToU32(c); +} + +ImU32 ImGui::GetColorU32(const ImVec4& col) +{ + ImGuiStyle& style = GImGui->Style; + ImVec4 c = col; + c.w *= style.Alpha; + return ColorConvertFloat4ToU32(c); +} + +const ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx) +{ + ImGuiStyle& style = GImGui->Style; + return style.Colors[idx]; +} + +ImU32 ImGui::GetColorU32(ImU32 col) +{ + float style_alpha = GImGui->Style.Alpha; + if (style_alpha >= 1.0f) + return col; + ImU32 a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT; + a = (ImU32)(a * style_alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range. + return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT); +} + +//----------------------------------------------------------------------------- +// [SECTION] ImGuiStorage +// Helper: Key->value storage +//----------------------------------------------------------------------------- + +// std::lower_bound but without the bullshit +static ImVector::iterator LowerBound(ImVector& data, ImGuiID key) +{ + ImVector::iterator first = data.begin(); + ImVector::iterator last = data.end(); + size_t count = (size_t)(last - first); + while (count > 0) + { + size_t count2 = count >> 1; + ImVector::iterator mid = first + count2; + if (mid->key < key) + { + first = ++mid; + count -= count2 + 1; + } + else + { + count = count2; + } + } + return first; +} + +// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. +void ImGuiStorage::BuildSortByKey() +{ + struct StaticFunc + { + static int IMGUI_CDECL PairCompareByID(const void* lhs, const void* rhs) + { + // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that. + if (((const Pair*)lhs)->key > ((const Pair*)rhs)->key) return +1; + if (((const Pair*)lhs)->key < ((const Pair*)rhs)->key) return -1; + return 0; + } + }; + if (Data.Size > 1) + ImQsort(Data.Data, (size_t)Data.Size, sizeof(Pair), StaticFunc::PairCompareByID); +} + +int ImGuiStorage::GetInt(ImGuiID key, int default_val) const +{ + ImVector::iterator it = LowerBound(const_cast&>(Data), key); + if (it == Data.end() || it->key != key) + return default_val; + return it->val_i; +} + +bool ImGuiStorage::GetBool(ImGuiID key, bool default_val) const +{ + return GetInt(key, default_val ? 1 : 0) != 0; +} + +float ImGuiStorage::GetFloat(ImGuiID key, float default_val) const +{ + ImVector::iterator it = LowerBound(const_cast&>(Data), key); + if (it == Data.end() || it->key != key) + return default_val; + return it->val_f; +} + +void* ImGuiStorage::GetVoidPtr(ImGuiID key) const +{ + ImVector::iterator it = LowerBound(const_cast&>(Data), key); + if (it == Data.end() || it->key != key) + return NULL; + return it->val_p; +} + +// References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. +int* ImGuiStorage::GetIntRef(ImGuiID key, int default_val) +{ + ImVector::iterator it = LowerBound(Data, key); + if (it == Data.end() || it->key != key) + it = Data.insert(it, Pair(key, default_val)); + return &it->val_i; +} + +bool* ImGuiStorage::GetBoolRef(ImGuiID key, bool default_val) +{ + return (bool*)GetIntRef(key, default_val ? 1 : 0); +} + +float* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val) +{ + ImVector::iterator it = LowerBound(Data, key); + if (it == Data.end() || it->key != key) + it = Data.insert(it, Pair(key, default_val)); + return &it->val_f; +} + +void** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val) +{ + ImVector::iterator it = LowerBound(Data, key); + if (it == Data.end() || it->key != key) + it = Data.insert(it, Pair(key, default_val)); + return &it->val_p; +} + +// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame) +void ImGuiStorage::SetInt(ImGuiID key, int val) +{ + ImVector::iterator it = LowerBound(Data, key); + if (it == Data.end() || it->key != key) + { + Data.insert(it, Pair(key, val)); + return; + } + it->val_i = val; +} + +void ImGuiStorage::SetBool(ImGuiID key, bool val) +{ + SetInt(key, val ? 1 : 0); +} + +void ImGuiStorage::SetFloat(ImGuiID key, float val) +{ + ImVector::iterator it = LowerBound(Data, key); + if (it == Data.end() || it->key != key) + { + Data.insert(it, Pair(key, val)); + return; + } + it->val_f = val; +} + +void ImGuiStorage::SetVoidPtr(ImGuiID key, void* val) +{ + ImVector::iterator it = LowerBound(Data, key); + if (it == Data.end() || it->key != key) + { + Data.insert(it, Pair(key, val)); + return; + } + it->val_p = val; +} + +void ImGuiStorage::SetAllInt(int v) +{ + for (int i = 0; i < Data.Size; i++) + Data[i].val_i = v; +} + +//----------------------------------------------------------------------------- +// [SECTION] ImGuiTextFilter +//----------------------------------------------------------------------------- + +// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" +ImGuiTextFilter::ImGuiTextFilter(const char* default_filter) +{ + if (default_filter) + { + ImStrncpy(InputBuf, default_filter, IM_ARRAYSIZE(InputBuf)); + Build(); + } + else + { + InputBuf[0] = 0; + CountGrep = 0; + } +} + +bool ImGuiTextFilter::Draw(const char* label, float width) +{ + if (width != 0.0f) + ImGui::PushItemWidth(width); + bool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); + if (width != 0.0f) + ImGui::PopItemWidth(); + if (value_changed) + Build(); + return value_changed; +} + +void ImGuiTextFilter::TextRange::split(char separator, ImVector* out) const +{ + out->resize(0); + const char* wb = b; + const char* we = wb; + while (we < e) + { + if (*we == separator) + { + out->push_back(TextRange(wb, we)); + wb = we + 1; + } + we++; + } + if (wb != we) + out->push_back(TextRange(wb, we)); +} + +void ImGuiTextFilter::Build() +{ + Filters.resize(0); + TextRange input_range(InputBuf, InputBuf+strlen(InputBuf)); + input_range.split(',', &Filters); + + CountGrep = 0; + for (int i = 0; i != Filters.Size; i++) + { + TextRange& f = Filters[i]; + while (f.b < f.e && ImCharIsBlankA(f.b[0])) + f.b++; + while (f.e > f.b && ImCharIsBlankA(f.e[-1])) + f.e--; + if (f.empty()) + continue; + if (Filters[i].b[0] != '-') + CountGrep += 1; + } +} + +bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const +{ + if (Filters.empty()) + return true; + + if (text == NULL) + text = ""; + + for (int i = 0; i != Filters.Size; i++) + { + const TextRange& f = Filters[i]; + if (f.empty()) + continue; + if (f.b[0] == '-') + { + // Subtract + if (ImStristr(text, text_end, f.begin()+1, f.end()) != NULL) + return false; + } + else + { + // Grep + if (ImStristr(text, text_end, f.begin(), f.end()) != NULL) + return true; + } + } + + // Implicit * grep + if (CountGrep == 0) + return true; + + return false; +} + +//----------------------------------------------------------------------------- +// [SECTION] ImGuiTextBuffer +//----------------------------------------------------------------------------- + +// On some platform vsnprintf() takes va_list by reference and modifies it. +// va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it. +#ifndef va_copy +#if defined(__GNUC__) || defined(__clang__) +#define va_copy(dest, src) __builtin_va_copy(dest, src) +#else +#define va_copy(dest, src) (dest = src) +#endif +#endif + +char ImGuiTextBuffer::EmptyString[1] = { 0 }; + +// Helper: Text buffer for logging/accumulating text +void ImGuiTextBuffer::appendfv(const char* fmt, va_list args) +{ + va_list args_copy; + va_copy(args_copy, args); + + int len = ImFormatStringV(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass. + if (len <= 0) + { + va_end(args_copy); + return; + } + + // Add zero-terminator the first time + const int write_off = (Buf.Size != 0) ? Buf.Size : 1; + const int needed_sz = write_off + len; + if (write_off + len >= Buf.Capacity) + { + int double_capacity = Buf.Capacity * 2; + Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity); + } + + Buf.resize(needed_sz); + ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy); + va_end(args_copy); +} + +void ImGuiTextBuffer::appendf(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + appendfv(fmt, args); + va_end(args); +} + +//----------------------------------------------------------------------------- +// [SECTION] ImGuiListClipper +// This is currently not as flexible/powerful as it should be, needs some rework (see TODO) +//----------------------------------------------------------------------------- + +static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height) +{ + // Set cursor position and a few other things so that SetScrollHereY() and Columns() can work when seeking cursor. + // FIXME: It is problematic that we have to do that here, because custom/equivalent end-user code would stumble on the same issue. + // The clipper should probably have a 4th step to display the last item in a regular manner. + ImGui::SetCursorPosY(pos_y); + ImGuiWindow* window = ImGui::GetCurrentWindow(); + window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height; // Setting those fields so that SetScrollHereY() can properly function after the end of our clipper usage. + window->DC.PrevLineSize.y = (line_height - GImGui->Style.ItemSpacing.y); // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list. + if (window->DC.ColumnsSet) + window->DC.ColumnsSet->LineMinY = window->DC.CursorPos.y; // Setting this so that cell Y position are set properly +} + +// Use case A: Begin() called from constructor with items_height<0, then called again from Sync() in StepNo 1 +// Use case B: Begin() called from constructor with items_height>0 +// FIXME-LEGACY: Ideally we should remove the Begin/End functions but they are part of the legacy API we still support. This is why some of the code in Step() calling Begin() and reassign some fields, spaghetti style. +void ImGuiListClipper::Begin(int count, float items_height) +{ + StartPosY = ImGui::GetCursorPosY(); + ItemsHeight = items_height; + ItemsCount = count; + StepNo = 0; + DisplayEnd = DisplayStart = -1; + if (ItemsHeight > 0.0f) + { + ImGui::CalcListClipping(ItemsCount, ItemsHeight, &DisplayStart, &DisplayEnd); // calculate how many to clip/display + if (DisplayStart > 0) + SetCursorPosYAndSetupDummyPrevLine(StartPosY + DisplayStart * ItemsHeight, ItemsHeight); // advance cursor + StepNo = 2; + } +} + +void ImGuiListClipper::End() +{ + if (ItemsCount < 0) + return; + // In theory here we should assert that ImGui::GetCursorPosY() == StartPosY + DisplayEnd * ItemsHeight, but it feels saner to just seek at the end and not assert/crash the user. + if (ItemsCount < INT_MAX) + SetCursorPosYAndSetupDummyPrevLine(StartPosY + ItemsCount * ItemsHeight, ItemsHeight); // advance cursor + ItemsCount = -1; + StepNo = 3; +} + +bool ImGuiListClipper::Step() +{ + if (ItemsCount == 0 || ImGui::GetCurrentWindowRead()->SkipItems) + { + ItemsCount = -1; + return false; + } + if (StepNo == 0) // Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height. + { + DisplayStart = 0; + DisplayEnd = 1; + StartPosY = ImGui::GetCursorPosY(); + StepNo = 1; + return true; + } + if (StepNo == 1) // Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. + { + if (ItemsCount == 1) { ItemsCount = -1; return false; } + float items_height = ImGui::GetCursorPosY() - StartPosY; + IM_ASSERT(items_height > 0.0f); // If this triggers, it means Item 0 hasn't moved the cursor vertically + Begin(ItemsCount-1, items_height); + DisplayStart++; + DisplayEnd++; + StepNo = 3; + return true; + } + if (StepNo == 2) // Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user still call Step(). Does nothing and switch to Step 3. + { + IM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0); + StepNo = 3; + return true; + } + if (StepNo == 3) // Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. + End(); + return false; +} + +//----------------------------------------------------------------------------- +// [SECTION] RENDER HELPERS +// Those (internal) functions are currently quite a legacy mess - their signature and behavior will change. +// Also see imgui_draw.cpp for some more which have been reworked to not rely on ImGui:: state. +//----------------------------------------------------------------------------- + +const char* ImGui::FindRenderedTextEnd(const char* text, const char* text_end) +{ + const char* text_display_end = text; + if (!text_end) + text_end = (const char*)-1; + + while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#')) + text_display_end++; + return text_display_end; +} + +// Internal ImGui functions to render text +// RenderText***() functions calls ImDrawList::AddText() calls ImBitmapFont::RenderText() +void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + // Hide anything after a '##' string + const char* text_display_end; + if (hide_text_after_hash) + { + text_display_end = FindRenderedTextEnd(text, text_end); + } + else + { + if (!text_end) + text_end = text + strlen(text); // FIXME-OPT + text_display_end = text_end; + } + + if (text != text_display_end) + { + window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end); + if (g.LogEnabled) + LogRenderedText(&pos, text, text_display_end); + } +} + +void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + if (!text_end) + text_end = text + strlen(text); // FIXME-OPT + + if (text != text_end) + { + window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width); + if (g.LogEnabled) + LogRenderedText(&pos, text, text_end); + } +} + +// Default clip_rect uses (pos_min,pos_max) +// Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges) +void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect) +{ + // Hide anything after a '##' string + const char* text_display_end = FindRenderedTextEnd(text, text_end); + const int text_len = (int)(text_display_end - text); + if (text_len == 0) + return; + + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + // Perform CPU side clipping for single clipped element to avoid using scissor state + ImVec2 pos = pos_min; + const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f); + + const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min; + const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max; + bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y); + if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min + need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y); + + // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment. + if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x); + if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y); + + // Render + if (need_clipping) + { + ImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y); + window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect); + } + else + { + window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL); + } + if (g.LogEnabled) + LogRenderedText(&pos, text, text_display_end); +} + +// Render a rectangle shaped with optional rounding and borders +void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding); + const float border_size = g.Style.FrameBorderSize; + if (border && border_size > 0.0f) + { + window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size); + window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size); + } +} + +void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + const float border_size = g.Style.FrameBorderSize; + if (border_size > 0.0f) + { + window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size); + window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size); + } +} + +// Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state +void ImGui::RenderArrow(ImVec2 p_min, ImGuiDir dir, float scale) +{ + ImGuiContext& g = *GImGui; + + const float h = g.FontSize * 1.00f; + float r = h * 0.40f * scale; + ImVec2 center = p_min + ImVec2(h * 0.50f, h * 0.50f * scale); + + ImVec2 a, b, c; + switch (dir) + { + case ImGuiDir_Up: + case ImGuiDir_Down: + if (dir == ImGuiDir_Up) r = -r; + a = ImVec2(+0.000f,+0.750f) * r; + b = ImVec2(-0.866f,-0.750f) * r; + c = ImVec2(+0.866f,-0.750f) * r; + break; + case ImGuiDir_Left: + case ImGuiDir_Right: + if (dir == ImGuiDir_Left) r = -r; + a = ImVec2(+0.750f,+0.000f) * r; + b = ImVec2(-0.750f,+0.866f) * r; + c = ImVec2(-0.750f,-0.866f) * r; + break; + case ImGuiDir_None: + case ImGuiDir_COUNT: + IM_ASSERT(0); + break; + } + + g.CurrentWindow->DrawList->AddTriangleFilled(center + a, center + b, center + c, GetColorU32(ImGuiCol_Text)); +} + +void ImGui::RenderBullet(ImVec2 pos) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + window->DrawList->AddCircleFilled(pos, g.FontSize*0.20f, GetColorU32(ImGuiCol_Text), 8); +} + +void ImGui::RenderCheckMark(ImVec2 pos, ImU32 col, float sz) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + float thickness = ImMax(sz / 5.0f, 1.0f); + sz -= thickness*0.5f; + pos += ImVec2(thickness*0.25f, thickness*0.25f); + + float third = sz / 3.0f; + float bx = pos.x + third; + float by = pos.y + sz - third*0.5f; + window->DrawList->PathLineTo(ImVec2(bx - third, by - third)); + window->DrawList->PathLineTo(ImVec2(bx, by)); + window->DrawList->PathLineTo(ImVec2(bx + third*2, by - third*2)); + window->DrawList->PathStroke(col, false, thickness); +} + +void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags) +{ + ImGuiContext& g = *GImGui; + if (id != g.NavId) + return; + if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw)) + return; + ImGuiWindow* window = g.CurrentWindow; + if (window->DC.NavHideHighlightOneFrame) + return; + + float rounding = (flags & ImGuiNavHighlightFlags_NoRounding) ? 0.0f : g.Style.FrameRounding; + ImRect display_rect = bb; + display_rect.ClipWith(window->ClipRect); + if (flags & ImGuiNavHighlightFlags_TypeDefault) + { + const float THICKNESS = 2.0f; + const float DISTANCE = 3.0f + THICKNESS * 0.5f; + display_rect.Expand(ImVec2(DISTANCE,DISTANCE)); + bool fully_visible = window->ClipRect.Contains(display_rect); + if (!fully_visible) + window->DrawList->PushClipRect(display_rect.Min, display_rect.Max); + window->DrawList->AddRect(display_rect.Min + ImVec2(THICKNESS*0.5f,THICKNESS*0.5f), display_rect.Max - ImVec2(THICKNESS*0.5f,THICKNESS*0.5f), GetColorU32(ImGuiCol_NavHighlight), rounding, ImDrawCornerFlags_All, THICKNESS); + if (!fully_visible) + window->DrawList->PopClipRect(); + } + if (flags & ImGuiNavHighlightFlags_TypeThin) + { + window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, ~0, 1.0f); + } +} + +//----------------------------------------------------------------------------- +// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +//----------------------------------------------------------------------------- + +// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods +ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) + : DrawListInst(&context->DrawListSharedData) +{ + Name = ImStrdup(name); + ID = ImHash(name, 0); + IDStack.push_back(ID); + Flags = 0; + Pos = ImVec2(0.0f, 0.0f); + Size = SizeFull = ImVec2(0.0f, 0.0f); + SizeContents = SizeContentsExplicit = ImVec2(0.0f, 0.0f); + WindowPadding = ImVec2(0.0f, 0.0f); + WindowRounding = 0.0f; + WindowBorderSize = 0.0f; + MoveId = GetID("#MOVE"); + ChildId = 0; + Scroll = ImVec2(0.0f, 0.0f); + ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); + ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); + ScrollbarSizes = ImVec2(0.0f, 0.0f); + ScrollbarX = ScrollbarY = false; + Active = WasActive = false; + WriteAccessed = false; + Collapsed = false; + WantCollapseToggle = false; + SkipItems = false; + Appearing = false; + Hidden = false; + HasCloseButton = false; + BeginCount = 0; + BeginOrderWithinParent = -1; + BeginOrderWithinContext = -1; + PopupId = 0; + AutoFitFramesX = AutoFitFramesY = -1; + AutoFitOnlyGrows = false; + AutoFitChildAxises = 0x00; + AutoPosLastDirection = ImGuiDir_None; + HiddenFramesRegular = HiddenFramesForResize = 0; + SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; + SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); + + LastFrameActive = -1; + ItemWidthDefault = 0.0f; + FontWindowScale = 1.0f; + SettingsIdx = -1; + + DrawList = &DrawListInst; + DrawList->_OwnerName = Name; + ParentWindow = NULL; + RootWindow = NULL; + RootWindowForTitleBarHighlight = NULL; + RootWindowForNav = NULL; + + NavLastIds[0] = NavLastIds[1] = 0; + NavRectRel[0] = NavRectRel[1] = ImRect(); + NavLastChildNavWindow = NULL; + + FocusIdxAllCounter = FocusIdxTabCounter = -1; + FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX; + FocusIdxAllRequestNext = FocusIdxTabRequestNext = INT_MAX; +} + +ImGuiWindow::~ImGuiWindow() +{ + IM_ASSERT(DrawList == &DrawListInst); + IM_DELETE(Name); + for (int i = 0; i != ColumnsStorage.Size; i++) + ColumnsStorage[i].~ImGuiColumnsSet(); +} + +ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHash(str, str_end ? (int)(str_end - str) : 0, seed); + ImGui::KeepAliveID(id); + return id; +} + +ImGuiID ImGuiWindow::GetID(const void* ptr) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHash(&ptr, sizeof(void*), seed); + ImGui::KeepAliveID(id); + return id; +} + +ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end) +{ + ImGuiID seed = IDStack.back(); + return ImHash(str, str_end ? (int)(str_end - str) : 0, seed); +} + +ImGuiID ImGuiWindow::GetIDNoKeepAlive(const void* ptr) +{ + ImGuiID seed = IDStack.back(); + return ImHash(&ptr, sizeof(void*), seed); +} + +// This is only used in rare/specific situations to manufacture an ID out of nowhere. +ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs) +{ + ImGuiID seed = IDStack.back(); + const int r_rel[4] = { (int)(r_abs.Min.x - Pos.x), (int)(r_abs.Min.y - Pos.y), (int)(r_abs.Max.x - Pos.x), (int)(r_abs.Max.y - Pos.y) }; + ImGuiID id = ImHash(&r_rel, sizeof(r_rel), seed); + ImGui::KeepAliveID(id); + return id; +} + +static void SetCurrentWindow(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + g.CurrentWindow = window; + if (window) + g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize(); +} + +void ImGui::SetNavID(ImGuiID id, int nav_layer) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.NavWindow); + IM_ASSERT(nav_layer == 0 || nav_layer == 1); + g.NavId = id; + g.NavWindow->NavLastIds[nav_layer] = id; +} + +void ImGui::SetNavIDWithRectRel(ImGuiID id, int nav_layer, const ImRect& rect_rel) +{ + ImGuiContext& g = *GImGui; + SetNavID(id, nav_layer); + g.NavWindow->NavRectRel[nav_layer] = rect_rel; + g.NavMousePosDirty = true; + g.NavDisableHighlight = false; + g.NavDisableMouseHover = true; +} + +void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + g.ActiveIdIsJustActivated = (g.ActiveId != id); + if (g.ActiveIdIsJustActivated) + { + g.ActiveIdTimer = 0.0f; + g.ActiveIdHasBeenEdited = false; + if (id != 0) + { + g.LastActiveId = id; + g.LastActiveIdTimer = 0.0f; + } + } + g.ActiveId = id; + g.ActiveIdAllowNavDirFlags = 0; + g.ActiveIdAllowOverlap = false; + g.ActiveIdWindow = window; + if (id) + { + g.ActiveIdIsAlive = id; + g.ActiveIdSource = (g.NavActivateId == id || g.NavInputId == id || g.NavJustTabbedId == id || g.NavJustMovedToId == id) ? ImGuiInputSource_Nav : ImGuiInputSource_Mouse; + } +} + +void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(id != 0); + + // Assume that SetFocusID() is called in the context where its NavLayer is the current layer, which is the case everywhere we call it. + const int nav_layer = window->DC.NavLayerCurrent; + if (g.NavWindow != window) + g.NavInitRequest = false; + g.NavId = id; + g.NavWindow = window; + g.NavLayer = nav_layer; + window->NavLastIds[nav_layer] = id; + if (window->DC.LastItemId == id) + window->NavRectRel[nav_layer] = ImRect(window->DC.LastItemRect.Min - window->Pos, window->DC.LastItemRect.Max - window->Pos); + + if (g.ActiveIdSource == ImGuiInputSource_Nav) + g.NavDisableMouseHover = true; + else + g.NavDisableHighlight = true; +} + +void ImGui::ClearActiveID() +{ + SetActiveID(0, NULL); +} + +void ImGui::SetHoveredID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + g.HoveredId = id; + g.HoveredIdAllowOverlap = false; + if (id != 0 && g.HoveredIdPreviousFrame != id) + g.HoveredIdTimer = g.HoveredIdNotActiveTimer = 0.0f; +} + +ImGuiID ImGui::GetHoveredID() +{ + ImGuiContext& g = *GImGui; + return g.HoveredId ? g.HoveredId : g.HoveredIdPreviousFrame; +} + +void ImGui::KeepAliveID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + if (g.ActiveId == id) + g.ActiveIdIsAlive = id; + if (g.ActiveIdPreviousFrame == id) + g.ActiveIdPreviousFrameIsAlive = true; +} + +void ImGui::MarkItemEdited(ImGuiID id) +{ + // This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit(). + // ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data. + (void)id; // Avoid unused variable warnings when asserts are compiled out. + ImGuiContext& g = *GImGui; + IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive); + //IM_ASSERT(g.CurrentWindow->DC.LastItemId == id); + g.ActiveIdHasBeenEdited = true; + g.CurrentWindow->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_Edited; +} + +static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) +{ + // An active popup disable hovering on other windows (apart from its own children) + // FIXME-OPT: This could be cached/stored within the window. + ImGuiContext& g = *GImGui; + if (g.NavWindow) + if (ImGuiWindow* focused_root_window = g.NavWindow->RootWindow) + if (focused_root_window->WasActive && focused_root_window != window->RootWindow) + { + // For the purpose of those flags we differentiate "standard popup" from "modal popup" + // NB: The order of those two tests is important because Modal windows are also Popups. + if (focused_root_window->Flags & ImGuiWindowFlags_Modal) + return false; + if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + return false; + } + + return true; +} + +// Advance cursor given item size for layout. +void ImGui::ItemSize(const ImVec2& size, float text_offset_y) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (window->SkipItems) + return; + + // Always align ourselves on pixel boundaries + const float line_height = ImMax(window->DC.CurrentLineSize.y, size.y); + const float text_base_offset = ImMax(window->DC.CurrentLineTextBaseOffset, text_offset_y); + //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG] + window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x + size.x, window->DC.CursorPos.y); + window->DC.CursorPos = ImVec2((float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x), (float)(int)(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y)); + window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x); + window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y); + //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG] + + window->DC.PrevLineSize.y = line_height; + window->DC.PrevLineTextBaseOffset = text_base_offset; + window->DC.CurrentLineSize.y = window->DC.CurrentLineTextBaseOffset = 0.0f; + + // Horizontal layout mode + if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) + SameLine(); +} + +void ImGui::ItemSize(const ImRect& bb, float text_offset_y) +{ + ItemSize(bb.GetSize(), text_offset_y); +} + +// Declare item bounding box for clipping and interaction. +// Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface +// declare their minimum size requirement to ItemSize() and then use a larger region for drawing/interaction, which is passed to ItemAdd(). +bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg) +{ +#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS + ImGuiTestEngineHook_ItemAdd(bb, id, nav_bb_arg); +#endif + + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + if (id != 0) + { + // Navigation processing runs prior to clipping early-out + // (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget + // (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests unfortunately, but it is still limited to one window. + // it may not scale very well for windows with ten of thousands of item, but at least NavMoveRequest is only set on user interaction, aka maximum once a frame. + // We could early out with "if (is_clipped && !g.NavInitRequest) return false;" but when we wouldn't be able to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick) + window->DC.NavLayerActiveMaskNext |= window->DC.NavLayerCurrentMask; + if (g.NavId == id || g.NavAnyRequest) + if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) + if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened)) + NavProcessItem(window, nav_bb_arg ? *nav_bb_arg : bb, id); + } + + window->DC.LastItemId = id; + window->DC.LastItemRect = bb; + window->DC.LastItemStatusFlags = 0; + + // Clipping test + const bool is_clipped = IsClippedEx(bb, id, false); + if (is_clipped) + return false; + //if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG] + + // We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them) + if (IsMouseHoveringRect(bb.Min, bb.Max)) + window->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_HoveredRect; + return true; +} + +// This is roughly matching the behavior of internal-facing ItemHoverable() +// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered() +// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId +bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (g.NavDisableMouseHover && !g.NavDisableHighlight) + return IsItemFocused(); + + // Test for bounding box overlap, as updated as ItemAdd() + if (!(window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect)) + return false; + IM_ASSERT((flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) == 0); // Flags not supported by this function + + // Test if we are hovering the right window (our window could be behind another window) + // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable to use IsItemHovered() after EndChild() itself. + // Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was the test that has been running for a long while. + //if (g.HoveredWindow != window) + // return false; + if (g.HoveredRootWindow != window->RootWindow && !(flags & ImGuiHoveredFlags_AllowWhenOverlapped)) + return false; + + // Test if another item is active (e.g. being dragged) + if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) + if (g.ActiveId != 0 && g.ActiveId != window->DC.LastItemId && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId) + return false; + + // Test if interactions on this window are blocked by an active popup or modal + if (!IsWindowContentHoverable(window, flags)) + return false; + + // Test if the item is disabled + if ((window->DC.ItemFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled)) + return false; + + // Special handling for the 1st item after Begin() which represent the title bar. When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect tht case. + if (window->DC.LastItemId == window->MoveId && window->WriteAccessed) + return false; + return true; +} + +// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered(). +bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) +{ + ImGuiContext& g = *GImGui; + if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap) + return false; + + ImGuiWindow* window = g.CurrentWindow; + if (g.HoveredWindow != window) + return false; + if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap) + return false; + if (!IsMouseHoveringRect(bb.Min, bb.Max)) + return false; + if (g.NavDisableMouseHover || !IsWindowContentHoverable(window, ImGuiHoveredFlags_None)) + return false; + if (window->DC.ItemFlags & ImGuiItemFlags_Disabled) + return false; + + SetHoveredID(id); + return true; +} + +bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (!bb.Overlaps(window->ClipRect)) + if (id == 0 || id != g.ActiveId) + if (clip_even_when_logged || !g.LogEnabled) + return true; + return false; +} + +bool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop) +{ + ImGuiContext& g = *GImGui; + + const bool is_tab_stop = (window->DC.ItemFlags & (ImGuiItemFlags_NoTabStop | ImGuiItemFlags_Disabled)) == 0; + window->FocusIdxAllCounter++; + if (is_tab_stop) + window->FocusIdxTabCounter++; + + // Process keyboard input at this point: TAB/Shift-TAB to tab out of the currently focused item. + // Note that we can always TAB out of a widget that doesn't allow tabbing in. + if (tab_stop && (g.ActiveId == id) && window->FocusIdxAllRequestNext == INT_MAX && window->FocusIdxTabRequestNext == INT_MAX && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab)) + window->FocusIdxTabRequestNext = window->FocusIdxTabCounter + (g.IO.KeyShift ? (is_tab_stop ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items. + + if (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent) + return true; + if (is_tab_stop && window->FocusIdxTabCounter == window->FocusIdxTabRequestCurrent) + { + g.NavJustTabbedId = id; + return true; + } + + return false; +} + +void ImGui::FocusableItemUnregister(ImGuiWindow* window) +{ + window->FocusIdxAllCounter--; + window->FocusIdxTabCounter--; +} + +ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_x, float default_y) +{ + ImGuiContext& g = *GImGui; + ImVec2 content_max; + if (size.x < 0.0f || size.y < 0.0f) + content_max = g.CurrentWindow->Pos + GetContentRegionMax(); + if (size.x <= 0.0f) + size.x = (size.x == 0.0f) ? default_x : ImMax(content_max.x - g.CurrentWindow->DC.CursorPos.x, 4.0f) + size.x; + if (size.y <= 0.0f) + size.y = (size.y == 0.0f) ? default_y : ImMax(content_max.y - g.CurrentWindow->DC.CursorPos.y, 4.0f) + size.y; + return size; +} + +float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x) +{ + if (wrap_pos_x < 0.0f) + return 0.0f; + + ImGuiWindow* window = GetCurrentWindowRead(); + if (wrap_pos_x == 0.0f) + wrap_pos_x = GetContentRegionMax().x + window->Pos.x; + else if (wrap_pos_x > 0.0f) + wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space + + return ImMax(wrap_pos_x - pos.x, 1.0f); +} + +void* ImGui::MemAlloc(size_t size) +{ + if (ImGuiContext* ctx = GImGui) + ctx->IO.MetricsActiveAllocations++; + return GImAllocatorAllocFunc(size, GImAllocatorUserData); +} + +void ImGui::MemFree(void* ptr) +{ + if (ptr) + if (ImGuiContext* ctx = GImGui) + ctx->IO.MetricsActiveAllocations--; + return GImAllocatorFreeFunc(ptr, GImAllocatorUserData); +} + +const char* ImGui::GetClipboardText() +{ + return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn(GImGui->IO.ClipboardUserData) : ""; +} + +void ImGui::SetClipboardText(const char* text) +{ + if (GImGui->IO.SetClipboardTextFn) + GImGui->IO.SetClipboardTextFn(GImGui->IO.ClipboardUserData, text); +} + +const char* ImGui::GetVersion() +{ + return IMGUI_VERSION; +} + +// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself +// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module +ImGuiContext* ImGui::GetCurrentContext() +{ + return GImGui; +} + +void ImGui::SetCurrentContext(ImGuiContext* ctx) +{ +#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC + IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this. +#else + GImGui = ctx; +#endif +} + +// Helper function to verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit +// If the user has inconsistent compilation settings, imgui configuration #define, packing pragma, etc. you may see different structures from what imgui.cpp sees which is highly problematic. +bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert) +{ + bool error = false; + if (strcmp(version, IMGUI_VERSION)!=0) { error = true; IM_ASSERT(strcmp(version,IMGUI_VERSION)==0 && "Mismatched version string!"); } + if (sz_io != sizeof(ImGuiIO)) { error = true; IM_ASSERT(sz_io == sizeof(ImGuiIO) && "Mismatched struct layout!"); } + if (sz_style != sizeof(ImGuiStyle)) { error = true; IM_ASSERT(sz_style == sizeof(ImGuiStyle) && "Mismatched struct layout!"); } + if (sz_vec2 != sizeof(ImVec2)) { error = true; IM_ASSERT(sz_vec2 == sizeof(ImVec2) && "Mismatched struct layout!"); } + if (sz_vec4 != sizeof(ImVec4)) { error = true; IM_ASSERT(sz_vec4 == sizeof(ImVec4) && "Mismatched struct layout!"); } + if (sz_vert != sizeof(ImDrawVert)) { error = true; IM_ASSERT(sz_vert == sizeof(ImDrawVert) && "Mismatched struct layout!"); } + return !error; +} + +void ImGui::SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void(*free_func)(void* ptr, void* user_data), void* user_data) +{ + GImAllocatorAllocFunc = alloc_func; + GImAllocatorFreeFunc = free_func; + GImAllocatorUserData = user_data; +} + +ImGuiContext* ImGui::CreateContext(ImFontAtlas* shared_font_atlas) +{ + ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas); + if (GImGui == NULL) + SetCurrentContext(ctx); + Initialize(ctx); + return ctx; +} + +void ImGui::DestroyContext(ImGuiContext* ctx) +{ + if (ctx == NULL) + ctx = GImGui; + Shutdown(ctx); + if (GImGui == ctx) + SetCurrentContext(NULL); + IM_DELETE(ctx); +} + +ImGuiIO& ImGui::GetIO() +{ + IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?"); + return GImGui->IO; +} + +ImGuiStyle& ImGui::GetStyle() +{ + IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?"); + return GImGui->Style; +} + +// Same value as passed to the old io.RenderDrawListsFn function. Valid after Render() and until the next call to NewFrame() +ImDrawData* ImGui::GetDrawData() +{ + ImGuiContext& g = *GImGui; + return g.DrawData.Valid ? &g.DrawData : NULL; +} + +double ImGui::GetTime() +{ + return GImGui->Time; +} + +int ImGui::GetFrameCount() +{ + return GImGui->FrameCount; +} + +static ImDrawList* GetOverlayDrawList(ImGuiWindow*) +{ + // This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'viewport' branches. + return &GImGui->OverlayDrawList; +} + +ImDrawList* ImGui::GetOverlayDrawList() +{ + return &GImGui->OverlayDrawList; +} + +ImDrawListSharedData* ImGui::GetDrawListSharedData() +{ + return &GImGui->DrawListSharedData; +} + +void ImGui::StartMouseMovingWindow(ImGuiWindow* window) +{ + // Set ActiveId even if the _NoMove flag is set. Without it, dragging away from a window with _NoMove would activate hover on other windows. + ImGuiContext& g = *GImGui; + FocusWindow(window); + SetActiveID(window->MoveId, window); + g.NavDisableHighlight = true; + g.ActiveIdClickOffset = g.IO.MousePos - window->RootWindow->Pos; + if (!(window->Flags & ImGuiWindowFlags_NoMove) && !(window->RootWindow->Flags & ImGuiWindowFlags_NoMove)) + g.MovingWindow = window; +} + +// Handle mouse moving window +// Note: moving window with the navigation keys (Square + d-pad / CTRL+TAB + Arrows) are processed in NavUpdateWindowing() +void ImGui::UpdateMouseMovingWindow() +{ + ImGuiContext& g = *GImGui; + if (g.MovingWindow != NULL) + { + // We actually want to move the root window. g.MovingWindow == window we clicked on (could be a child window). + // We track it to preserve Focus and so that generally ActiveIdWindow == MovingWindow and ActiveId == MovingWindow->MoveId for consistency. + KeepAliveID(g.ActiveId); + IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow); + ImGuiWindow* moving_window = g.MovingWindow->RootWindow; + if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos)) + { + ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset; + if (moving_window->Pos.x != pos.x || moving_window->Pos.y != pos.y) + { + MarkIniSettingsDirty(moving_window); + SetWindowPos(moving_window, pos, ImGuiCond_Always); + } + FocusWindow(g.MovingWindow); + } + else + { + ClearActiveID(); + g.MovingWindow = NULL; + } + } + else + { + // When clicking/dragging from a window that has the _NoMove flag, we still set the ActiveId in order to prevent hovering others. + if (g.ActiveIdWindow && g.ActiveIdWindow->MoveId == g.ActiveId) + { + KeepAliveID(g.ActiveId); + if (!g.IO.MouseDown[0]) + ClearActiveID(); + } + } +} + +static bool IsWindowActiveAndVisible(ImGuiWindow* window) +{ + return (window->Active) && (!window->Hidden); +} + +static void ImGui::UpdateMouseInputs() +{ + ImGuiContext& g = *GImGui; + + // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well) + if (IsMousePosValid(&g.IO.MousePos)) + g.IO.MousePos = g.LastValidMousePos = ImFloor(g.IO.MousePos); + + // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta + if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev)) + g.IO.MouseDelta = g.IO.MousePos - g.IO.MousePosPrev; + else + g.IO.MouseDelta = ImVec2(0.0f, 0.0f); + if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f) + g.NavDisableMouseHover = false; + + g.IO.MousePosPrev = g.IO.MousePos; + for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++) + { + g.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f; + g.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f; + g.IO.MouseDownDurationPrev[i] = g.IO.MouseDownDuration[i]; + g.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f; + g.IO.MouseDoubleClicked[i] = false; + if (g.IO.MouseClicked[i]) + { + if ((float)(g.Time - g.IO.MouseClickedTime[i]) < g.IO.MouseDoubleClickTime) + { + ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); + if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist) + g.IO.MouseDoubleClicked[i] = true; + g.IO.MouseClickedTime[i] = -FLT_MAX; // so the third click isn't turned into a double-click + } + else + { + g.IO.MouseClickedTime[i] = g.Time; + } + g.IO.MouseClickedPos[i] = g.IO.MousePos; + g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f); + g.IO.MouseDragMaxDistanceSqr[i] = 0.0f; + } + else if (g.IO.MouseDown[i]) + { + // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold + ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); + g.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(delta_from_click_pos)); + g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, delta_from_click_pos.x < 0.0f ? -delta_from_click_pos.x : delta_from_click_pos.x); + g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, delta_from_click_pos.y < 0.0f ? -delta_from_click_pos.y : delta_from_click_pos.y); + } + if (g.IO.MouseClicked[i]) // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation + g.NavDisableMouseHover = false; + } +} + +void ImGui::UpdateMouseWheel() +{ + ImGuiContext& g = *GImGui; + if (!g.HoveredWindow || g.HoveredWindow->Collapsed) + return; + if (g.IO.MouseWheel == 0.0f && g.IO.MouseWheelH == 0.0f) + return; + + // If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent (unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set). + ImGuiWindow* window = g.HoveredWindow; + ImGuiWindow* scroll_window = window; + while ((scroll_window->Flags & ImGuiWindowFlags_ChildWindow) && (scroll_window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(scroll_window->Flags & ImGuiWindowFlags_NoScrollbar) && !(scroll_window->Flags & ImGuiWindowFlags_NoMouseInputs) && scroll_window->ParentWindow) + scroll_window = scroll_window->ParentWindow; + const bool scroll_allowed = !(scroll_window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(scroll_window->Flags & ImGuiWindowFlags_NoMouseInputs); + + if (g.IO.MouseWheel != 0.0f) + { + if (g.IO.KeyCtrl && g.IO.FontAllowUserScaling) + { + // Zoom / Scale window + const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); + const float scale = new_font_scale / window->FontWindowScale; + window->FontWindowScale = new_font_scale; + + const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; + window->Pos += offset; + window->Size *= scale; + window->SizeFull *= scale; + } + else if (!g.IO.KeyCtrl && scroll_allowed) + { + // Mouse wheel vertical scrolling + float scroll_amount = 5 * scroll_window->CalcFontSize(); + scroll_amount = (float)(int)ImMin(scroll_amount, (scroll_window->ContentsRegionRect.GetHeight() + scroll_window->WindowPadding.y * 2.0f) * 0.67f); + SetWindowScrollY(scroll_window, scroll_window->Scroll.y - g.IO.MouseWheel * scroll_amount); + } + } + if (g.IO.MouseWheelH != 0.0f && scroll_allowed && !g.IO.KeyCtrl) + { + // Mouse wheel horizontal scrolling (for hardware that supports it) + float scroll_amount = scroll_window->CalcFontSize(); + SetWindowScrollX(scroll_window, scroll_window->Scroll.x - g.IO.MouseWheelH * scroll_amount); + } +} + +// The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app) +void ImGui::UpdateHoveredWindowAndCaptureFlags() +{ + ImGuiContext& g = *GImGui; + + // Find the window hovered by mouse: + // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow. + // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point of the frame. + // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. + FindHoveredWindow(); + + // Modal windows prevents cursor from hovering behind them. + ImGuiWindow* modal_window = GetFrontMostPopupModal(); + if (modal_window) + if (g.HoveredRootWindow && !IsWindowChildOf(g.HoveredRootWindow, modal_window)) + g.HoveredRootWindow = g.HoveredWindow = NULL; + + // Disabled mouse? + if (g.IO.ConfigFlags & ImGuiConfigFlags_NoMouse) + g.HoveredWindow = g.HoveredRootWindow = NULL; + + // We track click ownership. When clicked outside of a window the click is owned by the application and won't report hovering nor request capture even while dragging over our windows afterward. + int mouse_earliest_button_down = -1; + bool mouse_any_down = false; + for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++) + { + if (g.IO.MouseClicked[i]) + g.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL) || (!g.OpenPopupStack.empty()); + mouse_any_down |= g.IO.MouseDown[i]; + if (g.IO.MouseDown[i]) + if (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[i] < g.IO.MouseClickedTime[mouse_earliest_button_down]) + mouse_earliest_button_down = i; + } + const bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down]; + + // If mouse was first clicked outside of ImGui bounds we also cancel out hovering. + // FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02) + const bool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0; + if (!mouse_avail_to_imgui && !mouse_dragging_extern_payload) + g.HoveredWindow = g.HoveredRootWindow = NULL; + + // Update io.WantCaptureMouse for the user application (true = dispatch mouse info to imgui, false = dispatch mouse info to imgui + app) + if (g.WantCaptureMouseNextFrame != -1) + g.IO.WantCaptureMouse = (g.WantCaptureMouseNextFrame != 0); + else + g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (!g.OpenPopupStack.empty()); + + // Update io.WantCaptureKeyboard for the user application (true = dispatch keyboard info to imgui, false = dispatch keyboard info to imgui + app) + if (g.WantCaptureKeyboardNextFrame != -1) + g.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0); + else + g.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL); + if (g.IO.NavActive && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && !(g.IO.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard)) + g.IO.WantCaptureKeyboard = true; + + // Update io.WantTextInput flag, this is to allow systems without a keyboard (e.g. mobile, hand-held) to show a software keyboard if possible + g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false; +} + +void ImGui::NewFrame() +{ + IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() or ImGui::SetCurrentContext()?"); + ImGuiContext& g = *GImGui; + +#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS + ImGuiTestEngineHook_PreNewFrame(); +#endif + + // Check user data + // (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument) + IM_ASSERT(g.Initialized); + IM_ASSERT(g.IO.DeltaTime >= 0.0f && "Need a positive DeltaTime (zero is tolerated but will cause some timing issues)"); + IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value"); + IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?"); + IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?"); + IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting"); + IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)"); + IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?"); + for (int n = 0; n < ImGuiKey_COUNT; n++) + IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)"); + + // Perform simple check: required key mapping (we intentionally do NOT check all keys to not pressure user into setting up everything, but Space is required and was only recently added in 1.60 WIP) + if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) + IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && "ImGuiKey_Space is not mapped, required for keyboard navigation."); + + // Perform simple check: the beta io.ConfigResizeWindowsFromEdges option requires back-end to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly. + if (g.IO.ConfigResizeWindowsFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors)) + g.IO.ConfigResizeWindowsFromEdges = false; + + // Load settings on first frame (if not explicitly loaded manually before) + if (!g.SettingsLoaded) + { + IM_ASSERT(g.SettingsWindows.empty()); + if (g.IO.IniFilename) + LoadIniSettingsFromDisk(g.IO.IniFilename); + g.SettingsLoaded = true; + } + + // Save settings (with a delay after the last modification, so we don't spam disk too much) + if (g.SettingsDirtyTimer > 0.0f) + { + g.SettingsDirtyTimer -= g.IO.DeltaTime; + if (g.SettingsDirtyTimer <= 0.0f) + { + if (g.IO.IniFilename != NULL) + SaveIniSettingsToDisk(g.IO.IniFilename); + else + g.IO.WantSaveIniSettings = true; // Let user know they can call SaveIniSettingsToMemory(). user will need to clear io.WantSaveIniSettings themselves. + g.SettingsDirtyTimer = 0.0f; + } + } + + g.Time += g.IO.DeltaTime; + g.FrameScopeActive = true; + g.FrameCount += 1; + g.TooltipOverrideCount = 0; + g.WindowsActiveCount = 0; + + // Setup current font and draw list + g.IO.Fonts->Locked = true; + SetCurrentFont(GetDefaultFont()); + IM_ASSERT(g.Font->IsLoaded()); + g.DrawListSharedData.ClipRectFullscreen = ImVec4(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y); + g.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol; + + g.OverlayDrawList.Clear(); + g.OverlayDrawList.PushTextureID(g.IO.Fonts->TexID); + g.OverlayDrawList.PushClipRectFullScreen(); + g.OverlayDrawList.Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0); + + // Mark rendering data as invalid to prevent user who may have a handle on it to use it + g.DrawData.Clear(); + + // Drag and drop keep the source ID alive so even if the source disappear our state is consistent + if (g.DragDropActive && g.DragDropPayload.SourceId == g.ActiveId) + KeepAliveID(g.DragDropPayload.SourceId); + + // Clear reference to active widget if the widget isn't alive anymore + if (!g.HoveredIdPreviousFrame) + g.HoveredIdTimer = 0.0f; + if (!g.HoveredIdPreviousFrame || (g.HoveredId && g.ActiveId == g.HoveredId)) + g.HoveredIdNotActiveTimer = 0.0f; + if (g.HoveredId) + g.HoveredIdTimer += g.IO.DeltaTime; + if (g.HoveredId && g.ActiveId != g.HoveredId) + g.HoveredIdNotActiveTimer += g.IO.DeltaTime; + g.HoveredIdPreviousFrame = g.HoveredId; + g.HoveredId = 0; + g.HoveredIdAllowOverlap = false; + if (g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0) + ClearActiveID(); + if (g.ActiveId) + g.ActiveIdTimer += g.IO.DeltaTime; + g.LastActiveIdTimer += g.IO.DeltaTime; + g.ActiveIdPreviousFrame = g.ActiveId; + g.ActiveIdPreviousFrameWindow = g.ActiveIdWindow; + g.ActiveIdPreviousFrameHasBeenEdited = g.ActiveIdHasBeenEdited; + g.ActiveIdIsAlive = 0; + g.ActiveIdPreviousFrameIsAlive = false; + g.ActiveIdIsJustActivated = false; + if (g.ScalarAsInputTextId && g.ActiveId != g.ScalarAsInputTextId) + g.ScalarAsInputTextId = 0; + + // Drag and drop + g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr; + g.DragDropAcceptIdCurr = 0; + g.DragDropAcceptIdCurrRectSurface = FLT_MAX; + g.DragDropWithinSourceOrTarget = false; + + // Update keyboard input state + memcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration)); + for (int i = 0; i < IM_ARRAYSIZE(g.IO.KeysDown); i++) + g.IO.KeysDownDuration[i] = g.IO.KeysDown[i] ? (g.IO.KeysDownDuration[i] < 0.0f ? 0.0f : g.IO.KeysDownDuration[i] + g.IO.DeltaTime) : -1.0f; + + // Update gamepad/keyboard directional navigation + NavUpdate(); + + // Update mouse input state + UpdateMouseInputs(); + + // Calculate frame-rate for the user, as a purely luxurious feature + g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx]; + g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime; + g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame); + g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame))) : FLT_MAX; + + // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering) + UpdateMouseMovingWindow(); + UpdateHoveredWindowAndCaptureFlags(); + + // Background darkening/whitening + if (GetFrontMostPopupModal() != NULL || (g.NavWindowingTarget != NULL && g.NavWindowingHighlightAlpha > 0.0f)) + g.DimBgRatio = ImMin(g.DimBgRatio + g.IO.DeltaTime * 6.0f, 1.0f); + else + g.DimBgRatio = ImMax(g.DimBgRatio - g.IO.DeltaTime * 10.0f, 0.0f); + + g.MouseCursor = ImGuiMouseCursor_Arrow; + g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = g.WantTextInputNextFrame = -1; + g.PlatformImePos = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default + + // Mouse wheel scrolling, scale + UpdateMouseWheel(); + + // Pressing TAB activate widget focus + if (g.ActiveId == 0 && g.NavWindow != NULL && g.NavWindow->Active && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab, false)) + { + if (g.NavId != 0 && g.NavIdTabCounter != INT_MAX) + g.NavWindow->FocusIdxTabRequestNext = g.NavIdTabCounter + 1 + (g.IO.KeyShift ? -1 : 1); + else + g.NavWindow->FocusIdxTabRequestNext = g.IO.KeyShift ? -1 : 0; + } + g.NavIdTabCounter = INT_MAX; + + // Mark all windows as not visible + IM_ASSERT(g.WindowsFocusOrder.Size == g.Windows.Size); + for (int i = 0; i != g.Windows.Size; i++) + { + ImGuiWindow* window = g.Windows[i]; + window->WasActive = window->Active; + window->Active = false; + window->WriteAccessed = false; + } + + // Closing the focused window restore focus to the first active root window in descending z-order + if (g.NavWindow && !g.NavWindow->WasActive) + FocusPreviousWindowIgnoringOne(NULL); + + // No window should be open at the beginning of the frame. + // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear. + g.CurrentWindowStack.resize(0); + g.CurrentPopupStack.resize(0); + ClosePopupsOverWindow(g.NavWindow); + + // Create implicit/fallback window - which we will only render it if the user has added something to it. + // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. + // This fallback is particularly important as it avoid ImGui:: calls from crashing. + SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver); + Begin("Debug##Default"); + +#ifdef IMGUI_ENABLE_TEST_ENGINE_HOOKS + ImGuiTestEngineHook_PostNewFrame(); +#endif +} + +void ImGui::Initialize(ImGuiContext* context) +{ + ImGuiContext& g = *context; + IM_ASSERT(!g.Initialized && !g.SettingsLoaded); + + // Add .ini handle for ImGuiWindow type + ImGuiSettingsHandler ini_handler; + ini_handler.TypeName = "Window"; + ini_handler.TypeHash = ImHash("Window", 0, 0); + ini_handler.ReadOpenFn = SettingsHandlerWindow_ReadOpen; + ini_handler.ReadLineFn = SettingsHandlerWindow_ReadLine; + ini_handler.WriteAllFn = SettingsHandlerWindow_WriteAll; + g.SettingsHandlers.push_front(ini_handler); + + g.Initialized = true; +} + +// This function is merely here to free heap allocations. +void ImGui::Shutdown(ImGuiContext* context) +{ + // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame) + ImGuiContext& g = *context; + if (g.IO.Fonts && g.FontAtlasOwnedByContext) + { + g.IO.Fonts->Locked = false; + IM_DELETE(g.IO.Fonts); + } + g.IO.Fonts = NULL; + + // Cleanup of other data are conditional on actually having initialized ImGui. + if (!g.Initialized) + return; + + // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) + if (g.SettingsLoaded && g.IO.IniFilename != NULL) + { + ImGuiContext* backup_context = GImGui; + SetCurrentContext(context); + SaveIniSettingsToDisk(g.IO.IniFilename); + SetCurrentContext(backup_context); + } + + // Clear everything else + for (int i = 0; i < g.Windows.Size; i++) + IM_DELETE(g.Windows[i]); + g.Windows.clear(); + g.WindowsFocusOrder.clear(); + g.WindowsSortBuffer.clear(); + g.CurrentWindow = NULL; + g.CurrentWindowStack.clear(); + g.WindowsById.Clear(); + g.NavWindow = NULL; + g.HoveredWindow = NULL; + g.HoveredRootWindow = NULL; + g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; + g.MovingWindow = NULL; + g.ColorModifiers.clear(); + g.StyleModifiers.clear(); + g.FontStack.clear(); + g.OpenPopupStack.clear(); + g.CurrentPopupStack.clear(); + g.DrawDataBuilder.ClearFreeMemory(); + g.OverlayDrawList.ClearFreeMemory(); + g.PrivateClipboard.clear(); + g.InputTextState.TextW.clear(); + g.InputTextState.InitialText.clear(); + g.InputTextState.TempBuffer.clear(); + + for (int i = 0; i < g.SettingsWindows.Size; i++) + IM_DELETE(g.SettingsWindows[i].Name); + g.SettingsWindows.clear(); + g.SettingsHandlers.clear(); + + if (g.LogFile && g.LogFile != stdout) + { + fclose(g.LogFile); + g.LogFile = NULL; + } + g.LogClipboard.clear(); + + g.Initialized = false; +} + +// FIXME: Add a more explicit sort order in the window structure. +static int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs) +{ + const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs; + const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs; + if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup)) + return d; + if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip)) + return d; + return (a->BeginOrderWithinParent - b->BeginOrderWithinParent); +} + +static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window) +{ + out_sorted_windows->push_back(window); + if (window->Active) + { + int count = window->DC.ChildWindows.Size; + if (count > 1) + ImQsort(window->DC.ChildWindows.begin(), (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer); + for (int i = 0; i < count; i++) + { + ImGuiWindow* child = window->DC.ChildWindows[i]; + if (child->Active) + AddWindowToSortBuffer(out_sorted_windows, child); + } + } +} + +static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list) +{ + if (draw_list->CmdBuffer.empty()) + return; + + // Remove trailing command if unused + ImDrawCmd& last_cmd = draw_list->CmdBuffer.back(); + if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL) + { + draw_list->CmdBuffer.pop_back(); + if (draw_list->CmdBuffer.empty()) + return; + } + + // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. May trigger for you if you are using PrimXXX functions incorrectly. + IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); + IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); + IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); + + // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window) + // If this assert triggers because you are drawing lots of stuff manually: + // A) Make sure you are coarse clipping, because ImDrawList let all your vertices pass. You can use the Metrics window to inspect draw list contents. + // B) If you need/want meshes with more than 64K vertices, uncomment the '#define ImDrawIdx unsigned int' line in imconfig.h to set the index size to 4 bytes. + // You'll need to handle the 4-bytes indices to your renderer. For example, the OpenGL example code detect index size at compile-time by doing: + // glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset); + // Your own engine or render API may use different parameters or function calls to specify index sizes. 2 and 4 bytes indices are generally supported by most API. + // C) If for some reason you cannot use 4 bytes indices or don't want to, a workaround is to call BeginChild()/EndChild() before reaching the 64K limit to split your draw commands in multiple draw lists. + if (sizeof(ImDrawIdx) == 2) + IM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above"); + + out_list->push_back(draw_list); +} + +static void AddWindowToDrawData(ImVector* out_render_list, ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + g.IO.MetricsRenderWindows++; + AddDrawListToDrawData(out_render_list, window->DrawList); + for (int i = 0; i < window->DC.ChildWindows.Size; i++) + { + ImGuiWindow* child = window->DC.ChildWindows[i]; + if (IsWindowActiveAndVisible(child)) // clipped children may have been marked not active + AddWindowToDrawData(out_render_list, child); + } +} + +static void AddWindowToDrawDataSelectLayer(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (window->Flags & ImGuiWindowFlags_Tooltip) + AddWindowToDrawData(&g.DrawDataBuilder.Layers[1], window); + else + AddWindowToDrawData(&g.DrawDataBuilder.Layers[0], window); +} + +void ImDrawDataBuilder::FlattenIntoSingleLayer() +{ + int n = Layers[0].Size; + int size = n; + for (int i = 1; i < IM_ARRAYSIZE(Layers); i++) + size += Layers[i].Size; + Layers[0].resize(size); + for (int layer_n = 1; layer_n < IM_ARRAYSIZE(Layers); layer_n++) + { + ImVector& layer = Layers[layer_n]; + if (layer.empty()) + continue; + memcpy(&Layers[0][n], &layer[0], layer.Size * sizeof(ImDrawList*)); + n += layer.Size; + layer.resize(0); + } +} + +static void SetupDrawData(ImVector* draw_lists, ImDrawData* draw_data) +{ + ImGuiIO& io = ImGui::GetIO(); + draw_data->Valid = true; + draw_data->CmdLists = (draw_lists->Size > 0) ? draw_lists->Data : NULL; + draw_data->CmdListsCount = draw_lists->Size; + draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0; + draw_data->DisplayPos = ImVec2(0.0f, 0.0f); + draw_data->DisplaySize = io.DisplaySize; + for (int n = 0; n < draw_lists->Size; n++) + { + draw_data->TotalVtxCount += draw_lists->Data[n]->VtxBuffer.Size; + draw_data->TotalIdxCount += draw_lists->Data[n]->IdxBuffer.Size; + } +} + +// When using this function it is sane to ensure that float are perfectly rounded to integer values, to that e.g. (int)(max.x-min.x) in user's render produce correct result. +void ImGui::PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DrawList->PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect); + window->ClipRect = window->DrawList->_ClipRectStack.back(); +} + +void ImGui::PopClipRect() +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DrawList->PopClipRect(); + window->ClipRect = window->DrawList->_ClipRectStack.back(); +} + +// This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal. +void ImGui::EndFrame() +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.Initialized); + if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times. + return; + IM_ASSERT(g.FrameScopeActive && "Forgot to call ImGui::NewFrame()"); + + // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) + if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f) + { + g.IO.ImeSetInputScreenPosFn((int)g.PlatformImePos.x, (int)g.PlatformImePos.y); + g.PlatformImeLastPos = g.PlatformImePos; + } + + // Hide implicit "Debug" window if it hasn't been used + IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls, did you forget to call end on g.CurrentWindow->Name? + if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) + g.CurrentWindow->Active = false; + End(); + + // Show CTRL+TAB list + if (g.NavWindowingTarget) + NavUpdateWindowingList(); + + // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) + if (g.DragDropActive) + { + bool is_delivered = g.DragDropPayload.Delivery; + bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton)); + if (is_delivered || is_elapsed) + ClearDragDrop(); + } + + // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing. + if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount) + { + g.DragDropWithinSourceOrTarget = true; + SetTooltip("..."); + g.DragDropWithinSourceOrTarget = false; + } + + // Initiate moving window + if (g.ActiveId == 0 && g.HoveredId == 0) + { + if (!g.NavWindow || !g.NavWindow->Appearing) // Unless we just made a window/popup appear + { + // Click to focus window and start moving (after we're done with all our widgets) + if (g.IO.MouseClicked[0]) + { + if (g.HoveredRootWindow != NULL) + StartMouseMovingWindow(g.HoveredWindow); + else if (g.NavWindow != NULL && GetFrontMostPopupModal() == NULL) + FocusWindow(NULL); // Clicking on void disable focus + } + + // With right mouse button we close popups without changing focus + // (The left mouse button path calls FocusWindow which will lead NewFrame->ClosePopupsOverWindow to trigger) + if (g.IO.MouseClicked[1]) + { + // Find the top-most window between HoveredWindow and the front most Modal Window. + // This is where we can trim the popup stack. + ImGuiWindow* modal = GetFrontMostPopupModal(); + bool hovered_window_above_modal = false; + if (modal == NULL) + hovered_window_above_modal = true; + for (int i = g.Windows.Size - 1; i >= 0 && hovered_window_above_modal == false; i--) + { + ImGuiWindow* window = g.Windows[i]; + if (window == modal) + break; + if (window == g.HoveredWindow) + hovered_window_above_modal = true; + } + ClosePopupsOverWindow(hovered_window_above_modal ? g.HoveredWindow : modal); + } + } + } + + // Sort the window list so that all child windows are after their parent + // We cannot do that on FocusWindow() because childs may not exist yet + g.WindowsSortBuffer.resize(0); + g.WindowsSortBuffer.reserve(g.Windows.Size); + for (int i = 0; i != g.Windows.Size; i++) + { + ImGuiWindow* window = g.Windows[i]; + if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow)) // if a child is active its parent will add it + continue; + AddWindowToSortBuffer(&g.WindowsSortBuffer, window); + } + + IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong + g.Windows.swap(g.WindowsSortBuffer); + g.IO.MetricsActiveWindows = g.WindowsActiveCount; + + // Unlock font atlas + g.IO.Fonts->Locked = false; + + // Clear Input data for next frame + g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f; + memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); + memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs)); + + g.FrameScopeActive = false; + g.FrameCountEnded = g.FrameCount; +} + +void ImGui::Render() +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.Initialized); + + if (g.FrameCountEnded != g.FrameCount) + EndFrame(); + g.FrameCountRendered = g.FrameCount; + + // Gather ImDrawList to render (for each active window) + g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsRenderWindows = 0; + g.DrawDataBuilder.Clear(); + ImGuiWindow* windows_to_render_front_most[2]; + windows_to_render_front_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL; + windows_to_render_front_most[1] = g.NavWindowingTarget ? g.NavWindowingList : NULL; + for (int n = 0; n != g.Windows.Size; n++) + { + ImGuiWindow* window = g.Windows[n]; + if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_front_most[0] && window != windows_to_render_front_most[1]) + AddWindowToDrawDataSelectLayer(window); + } + for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_front_most); n++) + if (windows_to_render_front_most[n] && IsWindowActiveAndVisible(windows_to_render_front_most[n])) // NavWindowingTarget is always temporarily displayed as the front-most window + AddWindowToDrawDataSelectLayer(windows_to_render_front_most[n]); + g.DrawDataBuilder.FlattenIntoSingleLayer(); + + // Draw software mouse cursor if requested + if (g.IO.MouseDrawCursor) + RenderMouseCursor(&g.OverlayDrawList, g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor); + + if (!g.OverlayDrawList.VtxBuffer.empty()) + AddDrawListToDrawData(&g.DrawDataBuilder.Layers[0], &g.OverlayDrawList); + + // Setup ImDrawData structure for end-user + SetupDrawData(&g.DrawDataBuilder.Layers[0], &g.DrawData); + g.IO.MetricsRenderVertices = g.DrawData.TotalVtxCount; + g.IO.MetricsRenderIndices = g.DrawData.TotalIdxCount; + + // Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData() +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + if (g.DrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL) + g.IO.RenderDrawListsFn(&g.DrawData); +#endif +} + +// Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker. +// CalcTextSize("") should return ImVec2(0.0f, GImGui->FontSize) +ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) +{ + ImGuiContext& g = *GImGui; + + const char* text_display_end; + if (hide_text_after_double_hash) + text_display_end = FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string + else + text_display_end = text_end; + + ImFont* font = g.Font; + const float font_size = g.FontSize; + if (text == text_display_end) + return ImVec2(0.0f, font_size); + ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL); + + // Cancel out character spacing for the last character of a line (it is baked into glyph->AdvanceX field) + const float font_scale = font_size / font->FontSize; + const float character_spacing_x = 1.0f * font_scale; + if (text_size.x > 0.0f) + text_size.x -= character_spacing_x; + text_size.x = (float)(int)(text_size.x + 0.95f); + + return text_size; +} + +// Helper to calculate coarse clipping of large list of evenly sized items. +// NB: Prefer using the ImGuiListClipper higher-level helper if you can! Read comments and instructions there on how those use this sort of pattern. +// NB: 'items_count' is only used to clamp the result, if you don't know your count you can use INT_MAX +void ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (g.LogEnabled) + { + // If logging is active, do not perform any clipping + *out_items_display_start = 0; + *out_items_display_end = items_count; + return; + } + if (window->SkipItems) + { + *out_items_display_start = *out_items_display_end = 0; + return; + } + + // We create the union of the ClipRect and the NavScoringRect which at worst should be 1 page away from ClipRect + ImRect unclipped_rect = window->ClipRect; + if (g.NavMoveRequest) + unclipped_rect.Add(g.NavScoringRectScreen); + + const ImVec2 pos = window->DC.CursorPos; + int start = (int)((unclipped_rect.Min.y - pos.y) / items_height); + int end = (int)((unclipped_rect.Max.y - pos.y) / items_height); + + // When performing a navigation request, ensure we have one item extra in the direction we are moving to + if (g.NavMoveRequest && g.NavMoveClipDir == ImGuiDir_Up) + start--; + if (g.NavMoveRequest && g.NavMoveClipDir == ImGuiDir_Down) + end++; + + start = ImClamp(start, 0, items_count); + end = ImClamp(end + 1, start, items_count); + *out_items_display_start = start; + *out_items_display_end = end; +} + +// Find window given position, search front-to-back +// FIXME: Note that we have an inconsequential lag here: OuterRectClipped is updated in Begin(), so windows moved programatically +// with SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is +// called, aka before the next Begin(). Moving window isn't affected. +static void FindHoveredWindow() +{ + ImGuiContext& g = *GImGui; + + ImGuiWindow* hovered_window = NULL; + if (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoMouseInputs)) + hovered_window = g.MovingWindow; + + ImVec2 padding_regular = g.Style.TouchExtraPadding; + ImVec2 padding_for_resize_from_edges = g.IO.ConfigResizeWindowsFromEdges ? ImMax(g.Style.TouchExtraPadding, ImVec2(RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS, RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS)) : padding_regular; + for (int i = g.Windows.Size - 1; i >= 0 && hovered_window == NULL; i--) + { + ImGuiWindow* window = g.Windows[i]; + if (!window->Active || window->Hidden) + continue; + if (window->Flags & ImGuiWindowFlags_NoMouseInputs) + continue; + + // Using the clipped AABB, a child window will typically be clipped by its parent (not always) + ImRect bb(window->OuterRectClipped); + if ((window->Flags & ImGuiWindowFlags_ChildWindow) || (window->Flags & ImGuiWindowFlags_NoResize)) + bb.Expand(padding_regular); + else + bb.Expand(padding_for_resize_from_edges); + if (!bb.Contains(g.IO.MousePos)) + continue; + + // Those seemingly unnecessary extra tests are because the code here is a little different in viewport/docking branches. + if (hovered_window == NULL) + hovered_window = window; + if (hovered_window) + break; + } + + g.HoveredWindow = hovered_window; + g.HoveredRootWindow = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL; + +} + +// Test if mouse cursor is hovering given rectangle +// NB- Rectangle is clipped by our current clip setting +// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding) +bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip) +{ + ImGuiContext& g = *GImGui; + + // Clip + ImRect rect_clipped(r_min, r_max); + if (clip) + rect_clipped.ClipWith(g.CurrentWindow->ClipRect); + + // Expand for touch input + const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); + if (!rect_for_touch.Contains(g.IO.MousePos)) + return false; + return true; +} + +int ImGui::GetKeyIndex(ImGuiKey imgui_key) +{ + IM_ASSERT(imgui_key >= 0 && imgui_key < ImGuiKey_COUNT); + return GImGui->IO.KeyMap[imgui_key]; +} + +// Note that imgui doesn't know the semantic of each entry of io.KeysDown[]. Use your own indices/enums according to how your back-end/engine stored them into io.KeysDown[]! +bool ImGui::IsKeyDown(int user_key_index) +{ + if (user_key_index < 0) return false; + IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(GImGui->IO.KeysDown)); + return GImGui->IO.KeysDown[user_key_index]; +} + +int ImGui::CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate) +{ + if (t == 0.0f) + return 1; + if (t <= repeat_delay || repeat_rate <= 0.0f) + return 0; + const int count = (int)((t - repeat_delay) / repeat_rate) - (int)((t_prev - repeat_delay) / repeat_rate); + return (count > 0) ? count : 0; +} + +int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate) +{ + ImGuiContext& g = *GImGui; + if (key_index < 0) return false; + IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown)); + const float t = g.IO.KeysDownDuration[key_index]; + return CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, repeat_delay, repeat_rate); +} + +bool ImGui::IsKeyPressed(int user_key_index, bool repeat) +{ + ImGuiContext& g = *GImGui; + if (user_key_index < 0) return false; + IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); + const float t = g.IO.KeysDownDuration[user_key_index]; + if (t == 0.0f) + return true; + if (repeat && t > g.IO.KeyRepeatDelay) + return GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0; + return false; +} + +bool ImGui::IsKeyReleased(int user_key_index) +{ + ImGuiContext& g = *GImGui; + if (user_key_index < 0) return false; + IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); + return g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index]; +} + +bool ImGui::IsMouseDown(int button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseDown[button]; +} + +bool ImGui::IsAnyMouseDown() +{ + ImGuiContext& g = *GImGui; + for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++) + if (g.IO.MouseDown[n]) + return true; + return false; +} + +bool ImGui::IsMouseClicked(int button, bool repeat) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + const float t = g.IO.MouseDownDuration[button]; + if (t == 0.0f) + return true; + + if (repeat && t > g.IO.KeyRepeatDelay) + { + float delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate; + if ((ImFmod(t - delay, rate) > rate*0.5f) != (ImFmod(t - delay - g.IO.DeltaTime, rate) > rate*0.5f)) + return true; + } + + return false; +} + +bool ImGui::IsMouseReleased(int button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseReleased[button]; +} + +bool ImGui::IsMouseDoubleClicked(int button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseDoubleClicked[button]; +} + +bool ImGui::IsMouseDragging(int button, float lock_threshold) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (!g.IO.MouseDown[button]) + return false; + if (lock_threshold < 0.0f) + lock_threshold = g.IO.MouseDragThreshold; + return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold; +} + +ImVec2 ImGui::GetMousePos() +{ + return GImGui->IO.MousePos; +} + +// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed! +ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup() +{ + ImGuiContext& g = *GImGui; + if (g.CurrentPopupStack.Size > 0) + return g.OpenPopupStack[g.CurrentPopupStack.Size-1].OpenMousePos; + return g.IO.MousePos; +} + +// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position +bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) +{ + if (mouse_pos == NULL) + mouse_pos = &GImGui->IO.MousePos; + const float MOUSE_INVALID = -256000.0f; + return mouse_pos->x >= MOUSE_INVALID && mouse_pos->y >= MOUSE_INVALID; +} + +// NB: This is only valid if IsMousePosValid(). Back-ends in theory should always keep mouse position valid when dragging even outside the client window. +ImVec2 ImGui::GetMouseDragDelta(int button, float lock_threshold) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (lock_threshold < 0.0f) + lock_threshold = g.IO.MouseDragThreshold; + if (g.IO.MouseDown[button]) + if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold) + return g.IO.MousePos - g.IO.MouseClickedPos[button]; // Assume we can only get active with left-mouse button (at the moment). + return ImVec2(0.0f, 0.0f); +} + +void ImGui::ResetMouseDragDelta(int button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr + g.IO.MouseClickedPos[button] = g.IO.MousePos; +} + +ImGuiMouseCursor ImGui::GetMouseCursor() +{ + return GImGui->MouseCursor; +} + +void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type) +{ + GImGui->MouseCursor = cursor_type; +} + +void ImGui::CaptureKeyboardFromApp(bool capture) +{ + GImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0; +} + +void ImGui::CaptureMouseFromApp(bool capture) +{ + GImGui->WantCaptureMouseNextFrame = capture ? 1 : 0; +} + +bool ImGui::IsItemActive() +{ + ImGuiContext& g = *GImGui; + if (g.ActiveId) + { + ImGuiWindow* window = g.CurrentWindow; + return g.ActiveId == window->DC.LastItemId; + } + return false; +} + +bool ImGui::IsItemDeactivated() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + return (g.ActiveIdPreviousFrame == window->DC.LastItemId && g.ActiveIdPreviousFrame != 0 && g.ActiveId != window->DC.LastItemId); +} + +bool ImGui::IsItemDeactivatedAfterEdit() +{ + ImGuiContext& g = *GImGui; + return IsItemDeactivated() && (g.ActiveIdPreviousFrameHasBeenEdited || (g.ActiveId == 0 && g.ActiveIdHasBeenEdited)); +} + +bool ImGui::IsItemFocused() +{ + ImGuiContext& g = *GImGui; + return g.NavId && !g.NavDisableHighlight && g.NavId == g.CurrentWindow->DC.LastItemId; +} + +bool ImGui::IsItemClicked(int mouse_button) +{ + return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_None); +} + +bool ImGui::IsAnyItemHovered() +{ + ImGuiContext& g = *GImGui; + return g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0; +} + +bool ImGui::IsAnyItemActive() +{ + ImGuiContext& g = *GImGui; + return g.ActiveId != 0; +} + +bool ImGui::IsAnyItemFocused() +{ + ImGuiContext& g = *GImGui; + return g.NavId != 0 && !g.NavDisableHighlight; +} + +bool ImGui::IsItemVisible() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->ClipRect.Overlaps(window->DC.LastItemRect); +} + +bool ImGui::IsItemEdited() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_Edited) != 0; +} + +// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority. +void ImGui::SetItemAllowOverlap() +{ + ImGuiContext& g = *GImGui; + if (g.HoveredId == g.CurrentWindow->DC.LastItemId) + g.HoveredIdAllowOverlap = true; + if (g.ActiveId == g.CurrentWindow->DC.LastItemId) + g.ActiveIdAllowOverlap = true; +} + +ImVec2 ImGui::GetItemRectMin() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.LastItemRect.Min; +} + +ImVec2 ImGui::GetItemRectMax() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.LastItemRect.Max; +} + +ImVec2 ImGui::GetItemRectSize() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.LastItemRect.GetSize(); +} + +static ImRect GetViewportRect() +{ + ImGuiContext& g = *GImGui; + if (g.IO.DisplayVisibleMin.x != g.IO.DisplayVisibleMax.x && g.IO.DisplayVisibleMin.y != g.IO.DisplayVisibleMax.y) + return ImRect(g.IO.DisplayVisibleMin, g.IO.DisplayVisibleMax); + return ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y); +} + +static bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* parent_window = g.CurrentWindow; + + flags |= ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow; + flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag + + // Size + const ImVec2 content_avail = GetContentRegionAvail(); + ImVec2 size = ImFloor(size_arg); + const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00); + if (size.x <= 0.0f) + size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues) + if (size.y <= 0.0f) + size.y = ImMax(content_avail.y + size.y, 4.0f); + SetNextWindowSize(size); + + // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value. + char title[256]; + if (name) + ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id); + else + ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id); + + const float backup_border_size = g.Style.ChildBorderSize; + if (!border) + g.Style.ChildBorderSize = 0.0f; + bool ret = Begin(title, NULL, flags); + g.Style.ChildBorderSize = backup_border_size; + + ImGuiWindow* child_window = g.CurrentWindow; + child_window->ChildId = id; + child_window->AutoFitChildAxises = auto_fit_axises; + + // Process navigation-in immediately so NavInit can run on first frame + if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll)) + { + FocusWindow(child_window); + NavInitWindow(child_window, false); + SetActiveID(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item + g.ActiveIdSource = ImGuiInputSource_Nav; + } + return ret; +} + +bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + return BeginChildEx(str_id, window->GetID(str_id), size_arg, border, extra_flags); +} + +bool ImGui::BeginChild(ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) +{ + IM_ASSERT(id != 0); + return BeginChildEx(NULL, id, size_arg, border, extra_flags); +} + +void ImGui::EndChild() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss + if (window->BeginCount > 1) + { + End(); + } + else + { + ImVec2 sz = window->Size; + if (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f + sz.x = ImMax(4.0f, sz.x); + if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y)) + sz.y = ImMax(4.0f, sz.y); + End(); + + ImGuiWindow* parent_window = g.CurrentWindow; + ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz); + ItemSize(sz); + if ((window->DC.NavLayerActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened)) + { + ItemAdd(bb, window->ChildId); + RenderNavHighlight(bb, window->ChildId); + + // When browsing a window that has no activable items (scroll only) we keep a highlight on the child + if (window->DC.NavLayerActiveMask == 0 && window == g.NavWindow) + RenderNavHighlight(ImRect(bb.Min - ImVec2(2,2), bb.Max + ImVec2(2,2)), g.NavId, ImGuiNavHighlightFlags_TypeThin); + } + else + { + // Not navigable into + ItemAdd(bb, 0); + } + } +} + +// Helper to create a child window / scrolling region that looks like a normal widget frame. +bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags) +{ + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]); + PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding); + PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize); + PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding); + bool ret = BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags); + PopStyleVar(3); + PopStyleColor(); + return ret; +} + +void ImGui::EndChildFrame() +{ + EndChild(); +} + +// Save and compare stack sizes on Begin()/End() to detect usage errors +static void CheckStacksSize(ImGuiWindow* window, bool write) +{ + // NOT checking: DC.ItemWidth, DC.AllowKeyboardFocus, DC.ButtonRepeat, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin) + ImGuiContext& g = *GImGui; + int* p_backup = &window->DC.StackSizesBackup[0]; + { int current = window->IDStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; } // Too few or too many PopID()/TreePop() + { int current = window->DC.GroupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "BeginGroup/EndGroup Mismatch!"); p_backup++; } // Too few or too many EndGroup() + { int current = g.CurrentPopupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}// Too few or too many EndMenu()/EndPopup() + // For color, style and font stacks there is an incentive to use Push/Begin/Pop/.../End patterns, so we relax our checks a little to allow them. + { int current = g.ColorModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup >= current && "PushStyleColor/PopStyleColor Mismatch!"); p_backup++; } // Too few or too many PopStyleColor() + { int current = g.StyleModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup >= current && "PushStyleVar/PopStyleVar Mismatch!"); p_backup++; } // Too few or too many PopStyleVar() + { int current = g.FontStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup >= current && "PushFont/PopFont Mismatch!"); p_backup++; } // Too few or too many PopFont() + IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup)); +} + +static void SetWindowConditionAllowFlags(ImGuiWindow* window, ImGuiCond flags, bool enabled) +{ + window->SetWindowPosAllowFlags = enabled ? (window->SetWindowPosAllowFlags | flags) : (window->SetWindowPosAllowFlags & ~flags); + window->SetWindowSizeAllowFlags = enabled ? (window->SetWindowSizeAllowFlags | flags) : (window->SetWindowSizeAllowFlags & ~flags); + window->SetWindowCollapsedAllowFlags = enabled ? (window->SetWindowCollapsedAllowFlags | flags) : (window->SetWindowCollapsedAllowFlags & ~flags); +} + +ImGuiWindow* ImGui::FindWindowByID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id); +} + +ImGuiWindow* ImGui::FindWindowByName(const char* name) +{ + ImGuiID id = ImHash(name, 0); + return FindWindowByID(id); +} + +static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags) +{ + ImGuiContext& g = *GImGui; + + // Create window the first time + ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name); + window->Flags = flags; + g.WindowsById.SetVoidPtr(window->ID, window); + + // Default/arbitrary window position. Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. + window->Pos = ImVec2(60, 60); + + // User can disable loading and saving of settings. Tooltip and child windows also don't store settings. + if (!(flags & ImGuiWindowFlags_NoSavedSettings)) + if (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID)) + { + // Retrieve settings from .ini file + window->SettingsIdx = g.SettingsWindows.index_from_pointer(settings); + SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); + window->Pos = ImFloor(settings->Pos); + window->Collapsed = settings->Collapsed; + if (ImLengthSqr(settings->Size) > 0.00001f) + size = ImFloor(settings->Size); + } + window->Size = window->SizeFull = window->SizeFullAtLastBegin = ImFloor(size); + window->DC.CursorMaxPos = window->Pos; // So first call to CalcSizeContents() doesn't return crazy values + + if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) + { + window->AutoFitFramesX = window->AutoFitFramesY = 2; + window->AutoFitOnlyGrows = false; + } + else + { + if (window->Size.x <= 0.0f) + window->AutoFitFramesX = 2; + if (window->Size.y <= 0.0f) + window->AutoFitFramesY = 2; + window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); + } + + g.WindowsFocusOrder.push_back(window); + if (flags & ImGuiWindowFlags_NoBringToFrontOnFocus) + g.Windows.push_front(window); // Quite slow but rare and only once + else + g.Windows.push_back(window); + return window; +} + +static ImVec2 CalcSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size) +{ + ImGuiContext& g = *GImGui; + if (g.NextWindowData.SizeConstraintCond != 0) + { + // Using -1,-1 on either X/Y axis to preserve the current size. + ImRect cr = g.NextWindowData.SizeConstraintRect; + new_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x; + new_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y; + if (g.NextWindowData.SizeCallback) + { + ImGuiSizeCallbackData data; + data.UserData = g.NextWindowData.SizeCallbackUserData; + data.Pos = window->Pos; + data.CurrentSize = window->SizeFull; + data.DesiredSize = new_size; + g.NextWindowData.SizeCallback(&data); + new_size = data.DesiredSize; + } + } + + // Minimum size + if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize))) + { + new_size = ImMax(new_size, g.Style.WindowMinSize); + new_size.y = ImMax(new_size.y, window->TitleBarHeight() + window->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows + } + return new_size; +} + +static ImVec2 CalcSizeContents(ImGuiWindow* window) +{ + ImVec2 sz; + sz.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : (window->DC.CursorMaxPos.x - window->Pos.x + window->Scroll.x)); + sz.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : (window->DC.CursorMaxPos.y - window->Pos.y + window->Scroll.y)); + return sz + window->WindowPadding; +} + +static ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents) +{ + ImGuiContext& g = *GImGui; + ImGuiStyle& style = g.Style; + if (window->Flags & ImGuiWindowFlags_Tooltip) + { + // Tooltip always resize + return size_contents; + } + else + { + // When the window cannot fit all contents (either because of constraints, either because screen is too small): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding. + const bool is_popup = (window->Flags & ImGuiWindowFlags_Popup) != 0; + const bool is_menu = (window->Flags & ImGuiWindowFlags_ChildMenu) != 0; + ImVec2 size_min = style.WindowMinSize; + if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups) + size_min = ImMin(size_min, ImVec2(4.0f, 4.0f)); + ImVec2 size_auto_fit = ImClamp(size_contents, size_min, ImMax(size_min, g.IO.DisplaySize - style.DisplaySafeAreaPadding * 2.0f)); + ImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit); + if (size_auto_fit_after_constraint.x < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar)) + size_auto_fit.y += style.ScrollbarSize; + if (size_auto_fit_after_constraint.y < size_contents.y && !(window->Flags & ImGuiWindowFlags_NoScrollbar)) + size_auto_fit.x += style.ScrollbarSize; + return size_auto_fit; + } +} + +ImVec2 ImGui::CalcWindowExpectedSize(ImGuiWindow* window) +{ + ImVec2 size_contents = CalcSizeContents(window); + return CalcSizeAfterConstraint(window, CalcSizeAutoFit(window, size_contents)); +} + +float ImGui::GetWindowScrollMaxX(ImGuiWindow* window) +{ + return ImMax(0.0f, window->SizeContents.x - (window->SizeFull.x - window->ScrollbarSizes.x)); +} + +float ImGui::GetWindowScrollMaxY(ImGuiWindow* window) +{ + return ImMax(0.0f, window->SizeContents.y - (window->SizeFull.y - window->ScrollbarSizes.y)); +} + +static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window, bool snap_on_edges) +{ + ImGuiContext& g = *GImGui; + ImVec2 scroll = window->Scroll; + if (window->ScrollTarget.x < FLT_MAX) + { + float cr_x = window->ScrollTargetCenterRatio.x; + scroll.x = window->ScrollTarget.x - cr_x * (window->SizeFull.x - window->ScrollbarSizes.x); + } + if (window->ScrollTarget.y < FLT_MAX) + { + // 'snap_on_edges' allows for a discontinuity at the edge of scrolling limits to take account of WindowPadding so that scrolling to make the last item visible scroll far enough to see the padding. + float cr_y = window->ScrollTargetCenterRatio.y; + float target_y = window->ScrollTarget.y; + if (snap_on_edges && cr_y <= 0.0f && target_y <= window->WindowPadding.y) + target_y = 0.0f; + if (snap_on_edges && cr_y >= 1.0f && target_y >= window->SizeContents.y - window->WindowPadding.y + g.Style.ItemSpacing.y) + target_y = window->SizeContents.y; + scroll.y = target_y - (1.0f - cr_y) * (window->TitleBarHeight() + window->MenuBarHeight()) - cr_y * (window->SizeFull.y - window->ScrollbarSizes.y); + } + scroll = ImMax(scroll, ImVec2(0.0f, 0.0f)); + if (!window->Collapsed && !window->SkipItems) + { + scroll.x = ImMin(scroll.x, ImGui::GetWindowScrollMaxX(window)); + scroll.y = ImMin(scroll.y, ImGui::GetWindowScrollMaxY(window)); + } + return scroll; +} + +static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags) +{ + if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) + return ImGuiCol_PopupBg; + if (flags & ImGuiWindowFlags_ChildWindow) + return ImGuiCol_ChildBg; + return ImGuiCol_WindowBg; +} + +static void CalcResizePosSizeFromAnyCorner(ImGuiWindow* window, const ImVec2& corner_target, const ImVec2& corner_norm, ImVec2* out_pos, ImVec2* out_size) +{ + ImVec2 pos_min = ImLerp(corner_target, window->Pos, corner_norm); // Expected window upper-left + ImVec2 pos_max = ImLerp(window->Pos + window->Size, corner_target, corner_norm); // Expected window lower-right + ImVec2 size_expected = pos_max - pos_min; + ImVec2 size_constrained = CalcSizeAfterConstraint(window, size_expected); + *out_pos = pos_min; + if (corner_norm.x == 0.0f) + out_pos->x -= (size_constrained.x - size_expected.x); + if (corner_norm.y == 0.0f) + out_pos->y -= (size_constrained.y - size_expected.y); + *out_size = size_constrained; +} + +struct ImGuiResizeGripDef +{ + ImVec2 CornerPos; + ImVec2 InnerDir; + int AngleMin12, AngleMax12; +}; + +const ImGuiResizeGripDef resize_grip_def[4] = +{ + { ImVec2(1,1), ImVec2(-1,-1), 0, 3 }, // Lower right + { ImVec2(0,1), ImVec2(+1,-1), 3, 6 }, // Lower left + { ImVec2(0,0), ImVec2(+1,+1), 6, 9 }, // Upper left + { ImVec2(1,0), ImVec2(-1,+1), 9,12 }, // Upper right +}; + +static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_padding, float thickness) +{ + ImRect rect = window->Rect(); + if (thickness == 0.0f) rect.Max -= ImVec2(1,1); + if (border_n == 0) return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness); + if (border_n == 1) return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding); + if (border_n == 2) return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness); + if (border_n == 3) return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding); + IM_ASSERT(0); + return ImRect(); +} + +// Handle resize for: Resize Grips, Borders, Gamepad +static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]) +{ + ImGuiContext& g = *GImGui; + ImGuiWindowFlags flags = window->Flags; + if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) + return; + if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window. + return; + + const int resize_border_count = g.IO.ConfigResizeWindowsFromEdges ? 4 : 0; + const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f); + const float grip_hover_inner_size = (float)(int)(grip_draw_size * 0.75f); + const float grip_hover_outer_size = g.IO.ConfigResizeWindowsFromEdges ? RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS : 0.0f; + + ImVec2 pos_target(FLT_MAX, FLT_MAX); + ImVec2 size_target(FLT_MAX, FLT_MAX); + + // Manual resize grips + PushID("#RESIZE"); + for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++) + { + const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n]; + const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPos); + + // Using the FlattenChilds button flag we make the resize button accessible even if we are hovering over a child window + ImRect resize_rect(corner - grip.InnerDir * grip_hover_outer_size, corner + grip.InnerDir * grip_hover_inner_size); + if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x); + if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y); + bool hovered, held; + ButtonBehavior(resize_rect, window->GetID((void*)(intptr_t)resize_grip_n), &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus); + //GetOverlayDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)); + if (hovered || held) + g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE; + + if (held && g.IO.MouseDoubleClicked[0] && resize_grip_n == 0) + { + // Manual auto-fit when double-clicking + size_target = CalcSizeAfterConstraint(window, size_auto_fit); + ClearActiveID(); + } + else if (held) + { + // Resize from any of the four corners + // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position + ImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + ImLerp(grip.InnerDir * grip_hover_outer_size, grip.InnerDir * -grip_hover_inner_size, grip.CornerPos); // Corner of the window corresponding to our corner grip + CalcResizePosSizeFromAnyCorner(window, corner_target, grip.CornerPos, &pos_target, &size_target); + } + if (resize_grip_n == 0 || held || hovered) + resize_grip_col[resize_grip_n] = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip); + } + for (int border_n = 0; border_n < resize_border_count; border_n++) + { + bool hovered, held; + ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS); + ButtonBehavior(border_rect, window->GetID((void*)(intptr_t)(border_n + 4)), &hovered, &held, ImGuiButtonFlags_FlattenChildren); + //GetOverlayDrawList(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)); + if ((hovered && g.HoveredIdTimer > RESIZE_WINDOWS_FROM_EDGES_FEEDBACK_TIMER) || held) + { + g.MouseCursor = (border_n & 1) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS; + if (held) *border_held = border_n; + } + if (held) + { + ImVec2 border_target = window->Pos; + ImVec2 border_posn; + if (border_n == 0) { border_posn = ImVec2(0, 0); border_target.y = (g.IO.MousePos.y - g.ActiveIdClickOffset.y + RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS); } + if (border_n == 1) { border_posn = ImVec2(1, 0); border_target.x = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS); } + if (border_n == 2) { border_posn = ImVec2(0, 1); border_target.y = (g.IO.MousePos.y - g.ActiveIdClickOffset.y + RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS); } + if (border_n == 3) { border_posn = ImVec2(0, 0); border_target.x = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + RESIZE_WINDOWS_FROM_EDGES_HALF_THICKNESS); } + CalcResizePosSizeFromAnyCorner(window, border_target, border_posn, &pos_target, &size_target); + } + } + PopID(); + + // Navigation resize (keyboard/gamepad) + if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window) + { + ImVec2 nav_resize_delta; + if (g.NavInputSource == ImGuiInputSource_NavKeyboard && g.IO.KeyShift) + nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down); + if (g.NavInputSource == ImGuiInputSource_NavGamepad) + nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_Down); + if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f) + { + const float NAV_RESIZE_SPEED = 600.0f; + nav_resize_delta *= ImFloor(NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y)); + g.NavWindowingToggleLayer = false; + g.NavDisableMouseHover = true; + resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive); + // FIXME-NAV: Should store and accumulate into a separate size buffer to handle sizing constraints properly, right now a constraint will make us stuck. + size_target = CalcSizeAfterConstraint(window, window->SizeFull + nav_resize_delta); + } + } + + // Apply back modified position/size to window + if (size_target.x != FLT_MAX) + { + window->SizeFull = size_target; + MarkIniSettingsDirty(window); + } + if (pos_target.x != FLT_MAX) + { + window->Pos = ImFloor(pos_target); + MarkIniSettingsDirty(window); + } + + window->Size = window->SizeFull; +} + +void ImGui::UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window) +{ + window->ParentWindow = parent_window; + window->RootWindow = window->RootWindowForTitleBarHighlight = window->RootWindowForNav = window; + if (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip)) + window->RootWindow = parent_window->RootWindow; + if (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup))) + window->RootWindowForTitleBarHighlight = parent_window->RootWindowForTitleBarHighlight; + while (window->RootWindowForNav->Flags & ImGuiWindowFlags_NavFlattened) + window->RootWindowForNav = window->RootWindowForNav->ParentWindow; +} + +// Push a new ImGui window to add widgets to. +// - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair. +// - Begin/End can be called multiple times during the frame with the same window name to append content. +// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file). +// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file. +// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned. +// - Passing 'bool* p_open' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed. +bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) +{ + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + IM_ASSERT(name != NULL); // Window name required + IM_ASSERT(g.FrameScopeActive); // Forgot to call ImGui::NewFrame() + IM_ASSERT(g.FrameCountEnded != g.FrameCount); // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet + + // Find or create + ImGuiWindow* window = FindWindowByName(name); + const bool window_just_created = (window == NULL); + if (window_just_created) + { + ImVec2 size_on_first_use = (g.NextWindowData.SizeCond != 0) ? g.NextWindowData.SizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here. + window = CreateNewWindow(name, size_on_first_use, flags); + } + + // Automatically disable manual moving/resizing when NoInputs is set + if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs) + flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; + + if (flags & ImGuiWindowFlags_NavFlattened) + IM_ASSERT(flags & ImGuiWindowFlags_ChildWindow); + + const int current_frame = g.FrameCount; + const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame); + if (first_begin_of_the_frame) + window->Flags = (ImGuiWindowFlags)flags; + else + flags = window->Flags; + + // Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack + ImGuiWindow* parent_window_in_stack = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back(); + ImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow; + IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow)); + window->HasCloseButton = (p_open != NULL); + + // Update the Appearing flag + bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on + const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesForResize > 0); + if (flags & ImGuiWindowFlags_Popup) + { + ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size]; + window_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed + window_just_activated_by_user |= (window != popup_ref.Window); + } + window->Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize); + if (window->Appearing) + SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true); + + // Add to stack + g.CurrentWindowStack.push_back(window); + SetCurrentWindow(window); + CheckStacksSize(window, true); + if (flags & ImGuiWindowFlags_Popup) + { + ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size]; + popup_ref.Window = window; + g.CurrentPopupStack.push_back(popup_ref); + window->PopupId = popup_ref.PopupId; + } + + if (window_just_appearing_after_hidden_for_resize && !(flags & ImGuiWindowFlags_ChildWindow)) + window->NavLastIds[0] = 0; + + // Process SetNextWindow***() calls + bool window_pos_set_by_api = false; + bool window_size_x_set_by_api = false, window_size_y_set_by_api = false; + if (g.NextWindowData.PosCond) + { + window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.NextWindowData.PosCond) != 0; + if (window_pos_set_by_api && ImLengthSqr(g.NextWindowData.PosPivotVal) > 0.00001f) + { + // May be processed on the next frame if this is our first frame and we are measuring size + // FIXME: Look into removing the branch so everything can go through this same code path for consistency. + window->SetWindowPosVal = g.NextWindowData.PosVal; + window->SetWindowPosPivot = g.NextWindowData.PosPivotVal; + window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); + } + else + { + SetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond); + } + } + if (g.NextWindowData.SizeCond) + { + window_size_x_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.x > 0.0f); + window_size_y_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.y > 0.0f); + SetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond); + } + if (g.NextWindowData.ContentSizeCond) + { + // Adjust passed "client size" to become a "window size" + window->SizeContentsExplicit = g.NextWindowData.ContentSizeVal; + if (window->SizeContentsExplicit.y != 0.0f) + window->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight(); + } + else if (first_begin_of_the_frame) + { + window->SizeContentsExplicit = ImVec2(0.0f, 0.0f); + } + if (g.NextWindowData.CollapsedCond) + SetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond); + if (g.NextWindowData.FocusCond) + FocusWindow(window); + if (window->Appearing) + SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, false); + + // When reusing window again multiple times a frame, just append content (don't need to setup again) + if (first_begin_of_the_frame) + { + // Initialize + const bool window_is_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345) + UpdateWindowParentAndRootLinks(window, flags, parent_window); + + window->Active = true; + window->BeginOrderWithinParent = 0; + window->BeginOrderWithinContext = g.WindowsActiveCount++; + window->BeginCount = 0; + window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX); + window->LastFrameActive = current_frame; + window->IDStack.resize(1); + + // UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS + + // Update contents size from last frame for auto-fitting (or use explicit size) + window->SizeContents = CalcSizeContents(window); + if (window->HiddenFramesRegular > 0) + window->HiddenFramesRegular--; + if (window->HiddenFramesForResize > 0) + window->HiddenFramesForResize--; + + // Hide new windows for one frame until they calculate their size + if (window_just_created && (!window_size_x_set_by_api || !window_size_y_set_by_api)) + window->HiddenFramesForResize = 1; + + // Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows) + // We reset Size/SizeContents for reappearing popups/tooltips early in this function, so further code won't be tempted to use the old size. + if (window_just_activated_by_user && (flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0) + { + window->HiddenFramesForResize = 1; + if (flags & ImGuiWindowFlags_AlwaysAutoResize) + { + if (!window_size_x_set_by_api) + window->Size.x = window->SizeFull.x = 0.f; + if (!window_size_y_set_by_api) + window->Size.y = window->SizeFull.y = 0.f; + window->SizeContents = ImVec2(0.f, 0.f); + } + } + + SetCurrentWindow(window); + + // Lock border size and padding for the frame (so that altering them doesn't cause inconsistencies) + window->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize; + window->WindowPadding = style.WindowPadding; + if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f) + window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f); + window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x); + window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y; + + // Collapse window by double-clicking on title bar + // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing + if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse)) + { + // We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar. + ImRect title_bar_rect = window->TitleBarRect(); + if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseDoubleClicked[0]) + window->WantCollapseToggle = true; + if (window->WantCollapseToggle) + { + window->Collapsed = !window->Collapsed; + MarkIniSettingsDirty(window); + FocusWindow(window); + } + } + else + { + window->Collapsed = false; + } + window->WantCollapseToggle = false; + + // SIZE + + // Calculate auto-fit size, handle automatic resize + const ImVec2 size_auto_fit = CalcSizeAutoFit(window, window->SizeContents); + ImVec2 size_full_modified(FLT_MAX, FLT_MAX); + if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed) + { + // Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc. + if (!window_size_x_set_by_api) + window->SizeFull.x = size_full_modified.x = size_auto_fit.x; + if (!window_size_y_set_by_api) + window->SizeFull.y = size_full_modified.y = size_auto_fit.y; + } + else if (window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) + { + // Auto-fit may only grow window during the first few frames + // We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed. + if (!window_size_x_set_by_api && window->AutoFitFramesX > 0) + window->SizeFull.x = size_full_modified.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x; + if (!window_size_y_set_by_api && window->AutoFitFramesY > 0) + window->SizeFull.y = size_full_modified.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y; + if (!window->Collapsed) + MarkIniSettingsDirty(window); + } + + // Apply minimum/maximum window size constraints and final size + window->SizeFull = CalcSizeAfterConstraint(window, window->SizeFull); + window->Size = window->Collapsed && !(flags & ImGuiWindowFlags_ChildWindow) ? window->TitleBarRect().GetSize() : window->SizeFull; + + // SCROLLBAR STATUS + + // Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). + if (!window->Collapsed) + { + // When reading the current size we need to read it after size constraints have been applied + float size_x_for_scrollbars = size_full_modified.x != FLT_MAX ? window->SizeFull.x : window->SizeFullAtLastBegin.x; + float size_y_for_scrollbars = size_full_modified.y != FLT_MAX ? window->SizeFull.y : window->SizeFullAtLastBegin.y; + window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar)); + window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f)) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); + if (window->ScrollbarX && !window->ScrollbarY) + window->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars - style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar); + window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); + } + + // POSITION + + // Popup latch its initial position, will position itself when it appears next frame + if (window_just_activated_by_user) + { + window->AutoPosLastDirection = ImGuiDir_None; + if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api) + window->Pos = g.CurrentPopupStack.back().OpenPopupPos; + } + + // Position child window + if (flags & ImGuiWindowFlags_ChildWindow) + { + window->BeginOrderWithinParent = parent_window->DC.ChildWindows.Size; + parent_window->DC.ChildWindows.push_back(window); + if (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !window_is_child_tooltip) + window->Pos = parent_window->DC.CursorPos; + } + + const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFramesForResize == 0); + if (window_pos_with_pivot) + SetWindowPos(window, ImMax(style.DisplaySafeAreaPadding, window->SetWindowPosVal - window->SizeFull * window->SetWindowPosPivot), 0); // Position given a pivot (e.g. for centering) + else if ((flags & ImGuiWindowFlags_ChildMenu) != 0) + window->Pos = FindBestWindowPosForPopup(window); + else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize) + window->Pos = FindBestWindowPosForPopup(window); + else if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !window_is_child_tooltip) + window->Pos = FindBestWindowPosForPopup(window); + + // Clamp position so it stays visible + if (!(flags & ImGuiWindowFlags_ChildWindow)) + { + if (!window_pos_set_by_api && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. + { + ImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding); + window->Pos = ImMax(window->Pos + window->Size, padding) - window->Size; + window->Pos = ImMin(window->Pos, g.IO.DisplaySize - padding); + } + } + window->Pos = ImFloor(window->Pos); + + // Lock window rounding for the frame (so that altering them doesn't cause inconsistencies) + window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding; + + // Prepare for item focus requests + window->FocusIdxAllRequestCurrent = (window->FocusIdxAllRequestNext == INT_MAX || window->FocusIdxAllCounter == -1) ? INT_MAX : (window->FocusIdxAllRequestNext + (window->FocusIdxAllCounter+1)) % (window->FocusIdxAllCounter+1); + window->FocusIdxTabRequestCurrent = (window->FocusIdxTabRequestNext == INT_MAX || window->FocusIdxTabCounter == -1) ? INT_MAX : (window->FocusIdxTabRequestNext + (window->FocusIdxTabCounter+1)) % (window->FocusIdxTabCounter+1); + window->FocusIdxAllCounter = window->FocusIdxTabCounter = -1; + window->FocusIdxAllRequestNext = window->FocusIdxTabRequestNext = INT_MAX; + + // Apply scrolling + window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window, true); + window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); + + // Apply window focus (new and reactivated windows are moved to front) + bool want_focus = false; + if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing)) + if (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup)) + want_focus = true; + + // Handle manual resize: Resize Grips, Borders, Gamepad + int border_held = -1; + ImU32 resize_grip_col[4] = { 0 }; + const int resize_grip_count = g.IO.ConfigResizeWindowsFromEdges ? 2 : 1; // 4 + const float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f); + if (!window->Collapsed) + UpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]); + + // Default item width. Make it proportional to window size if window manually resizes + if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize)) + window->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f); + else + window->ItemWidthDefault = (float)(int)(g.FontSize * 16.0f); + + // DRAWING + + // Setup draw list and outer clipping rectangle + window->DrawList->Clear(); + window->DrawList->Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0); + window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID); + ImRect viewport_rect(GetViewportRect()); + if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_is_child_tooltip) + PushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true); + else + PushClipRect(viewport_rect.Min, viewport_rect.Max, true); + + // Draw modal window background (darkens what is behind them, all viewports) + const bool dim_bg_for_modal = (flags & ImGuiWindowFlags_Modal) && window == GetFrontMostPopupModal() && window->HiddenFramesForResize <= 0; + const bool dim_bg_for_window_list = g.NavWindowingTargetAnim && (window == g.NavWindowingTargetAnim->RootWindow); + if (dim_bg_for_modal || dim_bg_for_window_list) + { + const ImU32 dim_bg_col = GetColorU32(dim_bg_for_modal ? ImGuiCol_ModalWindowDimBg : ImGuiCol_NavWindowingDimBg, g.DimBgRatio); + window->DrawList->AddRectFilled(viewport_rect.Min, viewport_rect.Max, dim_bg_col); + } + + // Draw navigation selection/windowing rectangle background + if (dim_bg_for_window_list && window == g.NavWindowingTargetAnim) + { + ImRect bb = window->Rect(); + bb.Expand(g.FontSize); + if (!bb.Contains(viewport_rect)) // Avoid drawing if the window covers all the viewport anyway + window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha * 0.25f), g.Style.WindowRounding); + } + + // Draw window + handle manual resize + const float window_rounding = window->WindowRounding; + const float window_border_size = window->WindowBorderSize; + const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow; + const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight); + const ImRect title_bar_rect = window->TitleBarRect(); + if (window->Collapsed) + { + // Title bar only + float backup_border_size = style.FrameBorderSize; + g.Style.FrameBorderSize = window->WindowBorderSize; + ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed); + RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding); + g.Style.FrameBorderSize = backup_border_size; + } + else + { + // Window background + if (!(flags & ImGuiWindowFlags_NoBackground)) + { + ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags)); + if (g.NextWindowData.BgAlphaCond != 0) + bg_col = (bg_col & ~IM_COL32_A_MASK) | (IM_F32_TO_INT8_SAT(g.NextWindowData.BgAlphaVal) << IM_COL32_A_SHIFT); + window->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot); + } + g.NextWindowData.BgAlphaCond = 0; + + // Title bar + ImU32 title_bar_col = GetColorU32(window->Collapsed ? ImGuiCol_TitleBgCollapsed : title_bar_is_highlight ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg); + if (!(flags & ImGuiWindowFlags_NoTitleBar)) + window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawCornerFlags_Top); + + // Menu bar + if (flags & ImGuiWindowFlags_MenuBar) + { + ImRect menu_bar_rect = window->MenuBarRect(); + menu_bar_rect.ClipWith(window->Rect()); // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them. + window->DrawList->AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top); + if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y) + window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize); + } + + // Scrollbars + if (window->ScrollbarX) + Scrollbar(ImGuiLayoutType_Horizontal); + if (window->ScrollbarY) + Scrollbar(ImGuiLayoutType_Vertical); + + // Render resize grips (after their input handling so we don't have a frame of latency) + if (!(flags & ImGuiWindowFlags_NoResize)) + { + for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++) + { + const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n]; + const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPos); + window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, grip_draw_size) : ImVec2(grip_draw_size, window_border_size))); + window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(grip_draw_size, window_border_size) : ImVec2(window_border_size, grip_draw_size))); + window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12); + window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]); + } + } + + // Borders + if (window_border_size > 0.0f && !(flags & ImGuiWindowFlags_NoBackground)) + window->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), window_rounding, ImDrawCornerFlags_All, window_border_size); + if (border_held != -1) + { + ImRect border = GetResizeBorderRect(window, border_held, grip_draw_size, 0.0f); + window->DrawList->AddLine(border.Min, border.Max, GetColorU32(ImGuiCol_SeparatorActive), ImMax(1.0f, window_border_size)); + } + if (style.FrameBorderSize > 0 && !(flags & ImGuiWindowFlags_NoTitleBar)) + window->DrawList->AddLine(title_bar_rect.GetBL() + ImVec2(style.WindowBorderSize, -1), title_bar_rect.GetBR() + ImVec2(-style.WindowBorderSize, -1), GetColorU32(ImGuiCol_Border), style.FrameBorderSize); + } + + // Draw navigation selection/windowing rectangle border + if (g.NavWindowingTargetAnim == window) + { + float rounding = ImMax(window->WindowRounding, g.Style.WindowRounding); + ImRect bb = window->Rect(); + bb.Expand(g.FontSize); + if (bb.Contains(viewport_rect)) // If a window fits the entire viewport, adjust its highlight inward + { + bb.Expand(-g.FontSize - 1.0f); + rounding = window->WindowRounding; + } + window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_NavWindowingHighlight, g.NavWindowingHighlightAlpha), rounding, ~0, 3.0f); + } + + // Store a backup of SizeFull which we will use next frame to decide if we need scrollbars. + window->SizeFullAtLastBegin = window->SizeFull; + + // Update various regions. Variables they depends on are set above in this function. + // FIXME: window->ContentsRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it. + window->ContentsRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x; + window->ContentsRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + window->TitleBarHeight() + window->MenuBarHeight(); + window->ContentsRegionRect.Max.x = window->Pos.x - window->Scroll.x - window->WindowPadding.x + (window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : (window->Size.x - window->ScrollbarSizes.x)); + window->ContentsRegionRect.Max.y = window->Pos.y - window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y)); + + // Setup drawing context + // (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.) + window->DC.Indent.x = 0.0f + window->WindowPadding.x - window->Scroll.x; + window->DC.GroupOffset.x = 0.0f; + window->DC.ColumnsOffset.x = 0.0f; + window->DC.CursorStartPos = window->Pos + ImVec2(window->DC.Indent.x + window->DC.ColumnsOffset.x, window->TitleBarHeight() + window->MenuBarHeight() + window->WindowPadding.y - window->Scroll.y); + window->DC.CursorPos = window->DC.CursorStartPos; + window->DC.CursorPosPrevLine = window->DC.CursorPos; + window->DC.CursorMaxPos = window->DC.CursorStartPos; + window->DC.CurrentLineSize = window->DC.PrevLineSize = ImVec2(0.0f, 0.0f); + window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f; + window->DC.NavHideHighlightOneFrame = false; + window->DC.NavHasScroll = (GetScrollMaxY() > 0.0f); + window->DC.NavLayerActiveMask = window->DC.NavLayerActiveMaskNext; + window->DC.NavLayerActiveMaskNext = 0x00; + window->DC.MenuBarAppending = false; + window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; + window->DC.ChildWindows.resize(0); + window->DC.LayoutType = ImGuiLayoutType_Vertical; + window->DC.ParentLayoutType = parent_window ? parent_window->DC.LayoutType : ImGuiLayoutType_Vertical; + window->DC.ItemFlags = parent_window ? parent_window->DC.ItemFlags : ImGuiItemFlags_Default_; + window->DC.ItemWidth = window->ItemWidthDefault; + window->DC.TextWrapPos = -1.0f; // disabled + window->DC.ItemFlagsStack.resize(0); + window->DC.ItemWidthStack.resize(0); + window->DC.TextWrapPosStack.resize(0); + window->DC.ColumnsSet = NULL; + window->DC.TreeDepth = 0; + window->DC.TreeDepthMayJumpToParentOnPop = 0x00; + window->DC.StateStorage = &window->StateStorage; + window->DC.GroupStack.resize(0); + window->MenuColumns.Update(3, style.ItemSpacing.x, window_just_activated_by_user); + + if ((flags & ImGuiWindowFlags_ChildWindow) && (window->DC.ItemFlags != parent_window->DC.ItemFlags)) + { + window->DC.ItemFlags = parent_window->DC.ItemFlags; + window->DC.ItemFlagsStack.push_back(window->DC.ItemFlags); + } + + if (window->AutoFitFramesX > 0) + window->AutoFitFramesX--; + if (window->AutoFitFramesY > 0) + window->AutoFitFramesY--; + + // Apply focus (we need to call FocusWindow() AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there) + if (want_focus) + { + FocusWindow(window); + NavInitWindow(window, false); + } + + // Title bar + if (!(flags & ImGuiWindowFlags_NoTitleBar)) + { + // Close & collapse button are on layer 1 (same as menus) and don't default focus + const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags; + window->DC.ItemFlags |= ImGuiItemFlags_NoNavDefaultFocus; + window->DC.NavLayerCurrent++; + window->DC.NavLayerCurrentMask <<= 1; + + // Collapse button + if (!(flags & ImGuiWindowFlags_NoCollapse)) + if (CollapseButton(window->GetID("#COLLAPSE"), window->Pos)) + window->WantCollapseToggle = true; // Defer collapsing to next frame as we are too far in the Begin() function + + // Close button + if (p_open != NULL) + { + const float pad = style.FramePadding.y; + const float rad = g.FontSize * 0.5f; + if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-pad - rad, pad + rad), rad + 1)) + *p_open = false; + } + + window->DC.NavLayerCurrent--; + window->DC.NavLayerCurrentMask >>= 1; + window->DC.ItemFlags = item_flags_backup; + + // Title text (FIXME: refactor text alignment facilities along with RenderText helpers, this is too much code for what it does.) + ImVec2 text_size = CalcTextSize(name, NULL, true); + ImRect text_r = title_bar_rect; + float pad_left = (flags & ImGuiWindowFlags_NoCollapse) ? style.FramePadding.x : (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x); + float pad_right = (p_open == NULL) ? style.FramePadding.x : (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x); + if (style.WindowTitleAlign.x > 0.0f) + pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x); + text_r.Min.x += pad_left; + text_r.Max.x -= pad_right; + ImRect clip_rect = text_r; + clip_rect.Max.x = window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x); // Match the size of CloseButton() + RenderTextClipped(text_r.Min, text_r.Max, name, NULL, &text_size, style.WindowTitleAlign, &clip_rect); + } + + // Save clipped aabb so we can access it in constant-time in FindHoveredWindow() + window->OuterRectClipped = window->Rect(); + window->OuterRectClipped.ClipWith(window->ClipRect); + + // Pressing CTRL+C while holding on a window copy its content to the clipboard + // This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope. + // Maybe we can support CTRL+C on every element? + /* + if (g.ActiveId == move_id) + if (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C)) + LogToClipboard(); + */ + + // Inner rectangle + // We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame + // Note that if our window is collapsed we will end up with an inverted (~null) clipping rectangle which is the correct behavior. + window->InnerMainRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize; + window->InnerMainRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize); + window->InnerMainRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - window->WindowBorderSize; + window->InnerMainRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y - window->WindowBorderSize; + //window->DrawList->AddRect(window->InnerRect.Min, window->InnerRect.Max, IM_COL32_WHITE); + + // Inner clipping rectangle + // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result. + window->InnerClipRect.Min.x = ImFloor(0.5f + window->InnerMainRect.Min.x + ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize))); + window->InnerClipRect.Min.y = ImFloor(0.5f + window->InnerMainRect.Min.y); + window->InnerClipRect.Max.x = ImFloor(0.5f + window->InnerMainRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x*0.5f - window->WindowBorderSize))); + window->InnerClipRect.Max.y = ImFloor(0.5f + window->InnerMainRect.Max.y); + + // After Begin() we fill the last item / hovered data based on title bar data. It is a standard behavior (to allow creation of context menus on title bar only, etc.). + window->DC.LastItemId = window->MoveId; + window->DC.LastItemStatusFlags = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0; + window->DC.LastItemRect = title_bar_rect; + } + + PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true); + + // Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused) + if (first_begin_of_the_frame) + window->WriteAccessed = false; + + window->BeginCount++; + g.NextWindowData.Clear(); + + if (flags & ImGuiWindowFlags_ChildWindow) + { + // Child window can be out of sight and have "negative" clip windows. + // Mark them as collapsed so commands are skipped earlier (we can't manually collapse them because they have no title bar). + IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0); + + if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) + if (window->OuterRectClipped.Min.x >= window->OuterRectClipped.Max.x || window->OuterRectClipped.Min.y >= window->OuterRectClipped.Max.y) + window->HiddenFramesRegular = 1; + + // Completely hide along with parent or if parent is collapsed + if (parent_window && (parent_window->Collapsed || parent_window->Hidden)) + window->HiddenFramesRegular = 1; + } + + // Don't render if style alpha is 0.0 at the time of Begin(). This is arbitrary and inconsistent but has been there for a long while (may remove at some point) + if (style.Alpha <= 0.0f) + window->HiddenFramesRegular = 1; + + // Update the Hidden flag + window->Hidden = (window->HiddenFramesRegular > 0) || (window->HiddenFramesForResize); + + // Return false if we don't intend to display anything to allow user to perform an early out optimization + window->SkipItems = (window->Collapsed || !window->Active || window->Hidden) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && window->HiddenFramesForResize <= 0; + + return !window->SkipItems; +} + +// Old Begin() API with 5 parameters, avoid calling this version directly! Use SetNextWindowSize()/SetNextWindowBgAlpha() + Begin() instead. +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_first_use, float bg_alpha_override, ImGuiWindowFlags flags) +{ + // Old API feature: we could pass the initial window size as a parameter. This was misleading because it only had an effect if the window didn't have data in the .ini file. + if (size_first_use.x != 0.0f || size_first_use.y != 0.0f) + SetNextWindowSize(size_first_use, ImGuiCond_FirstUseEver); + + // Old API feature: override the window background alpha with a parameter. + if (bg_alpha_override >= 0.0f) + SetNextWindowBgAlpha(bg_alpha_override); + + return Begin(name, p_open, flags); +} +#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS + +void ImGui::End() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + if (window->DC.ColumnsSet != NULL) + EndColumns(); + PopClipRect(); // Inner window clip rectangle + + // Stop logging + if (!(window->Flags & ImGuiWindowFlags_ChildWindow)) // FIXME: add more options for scope of logging + LogFinish(); + + // Pop from window stack + g.CurrentWindowStack.pop_back(); + if (window->Flags & ImGuiWindowFlags_Popup) + g.CurrentPopupStack.pop_back(); + CheckStacksSize(window, false); + SetCurrentWindow(g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back()); +} + +void ImGui::BringWindowToFocusFront(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (g.WindowsFocusOrder.back() == window) + return; + for (int i = g.WindowsFocusOrder.Size - 2; i >= 0; i--) // We can ignore the front most window + if (g.WindowsFocusOrder[i] == window) + { + memmove(&g.WindowsFocusOrder[i], &g.WindowsFocusOrder[i + 1], (size_t)(g.WindowsFocusOrder.Size - i - 1) * sizeof(ImGuiWindow*)); + g.WindowsFocusOrder[g.WindowsFocusOrder.Size - 1] = window; + break; + } +} + +void ImGui::BringWindowToDisplayFront(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* current_front_window = g.Windows.back(); + if (current_front_window == window || current_front_window->RootWindow == window) + return; + for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window + if (g.Windows[i] == window) + { + memmove(&g.Windows[i], &g.Windows[i + 1], (size_t)(g.Windows.Size - i - 1) * sizeof(ImGuiWindow*)); + g.Windows[g.Windows.Size - 1] = window; + break; + } +} + +void ImGui::BringWindowToDisplayBack(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (g.Windows[0] == window) + return; + for (int i = 0; i < g.Windows.Size; i++) + if (g.Windows[i] == window) + { + memmove(&g.Windows[1], &g.Windows[0], (size_t)i * sizeof(ImGuiWindow*)); + g.Windows[0] = window; + break; + } +} + +// Moving window to front of display and set focus (which happens to be back of our sorted list) +void ImGui::FocusWindow(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + + if (g.NavWindow != window) + { + g.NavWindow = window; + if (window && g.NavDisableMouseHover) + g.NavMousePosDirty = true; + g.NavInitRequest = false; + g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId + g.NavIdIsAlive = false; + g.NavLayer = 0; + //printf("[%05d] FocusWindow(\"%s\")\n", g.FrameCount, window ? window->Name : NULL); + } + + // Passing NULL allow to disable keyboard focus + if (!window) + return; + + // Move the root window to the top of the pile + if (window->RootWindow) + window = window->RootWindow; + + // Steal focus on active widgets + if (window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement should be unnecessary. Need further testing before removing it.. + if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != window) + ClearActiveID(); + + // Bring to front + BringWindowToFocusFront(window); + if (!(window->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) + BringWindowToDisplayFront(window); +} + +void ImGui::FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window) +{ + ImGuiContext& g = *GImGui; + for (int i = g.WindowsFocusOrder.Size - 1; i >= 0; i--) + { + // We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user. + ImGuiWindow* window = g.WindowsFocusOrder[i]; + if (window != ignore_window && window->WasActive && !(window->Flags & ImGuiWindowFlags_ChildWindow)) + if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) + { + ImGuiWindow* focus_window = NavRestoreLastChildNavWindow(window); + FocusWindow(focus_window); + return; + } + } +} + +void ImGui::PushItemWidth(float item_width) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.ItemWidth = (item_width == 0.0f ? window->ItemWidthDefault : item_width); + window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); +} + +void ImGui::PushMultiItemsWidths(int components, float w_full) +{ + ImGuiWindow* window = GetCurrentWindow(); + const ImGuiStyle& style = GImGui->Style; + if (w_full <= 0.0f) + w_full = CalcItemWidth(); + const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.ItemInnerSpacing.x) * (components-1)) / (float)components)); + const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components-1))); + window->DC.ItemWidthStack.push_back(w_item_last); + for (int i = 0; i < components-1; i++) + window->DC.ItemWidthStack.push_back(w_item_one); + window->DC.ItemWidth = window->DC.ItemWidthStack.back(); +} + +void ImGui::PopItemWidth() +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.ItemWidthStack.pop_back(); + window->DC.ItemWidth = window->DC.ItemWidthStack.empty() ? window->ItemWidthDefault : window->DC.ItemWidthStack.back(); +} + +float ImGui::CalcItemWidth() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + float w = window->DC.ItemWidth; + if (w < 0.0f) + { + // Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well. + float width_to_right_edge = GetContentRegionAvail().x; + w = ImMax(1.0f, width_to_right_edge + w); + } + w = (float)(int)w; + return w; +} + +void ImGui::SetCurrentFont(ImFont* font) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? + IM_ASSERT(font->Scale > 0.0f); + g.Font = font; + g.FontBaseSize = g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale; + g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f; + + ImFontAtlas* atlas = g.Font->ContainerAtlas; + g.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel; + g.DrawListSharedData.Font = g.Font; + g.DrawListSharedData.FontSize = g.FontSize; +} + +void ImGui::PushFont(ImFont* font) +{ + ImGuiContext& g = *GImGui; + if (!font) + font = GetDefaultFont(); + SetCurrentFont(font); + g.FontStack.push_back(font); + g.CurrentWindow->DrawList->PushTextureID(font->ContainerAtlas->TexID); +} + +void ImGui::PopFont() +{ + ImGuiContext& g = *GImGui; + g.CurrentWindow->DrawList->PopTextureID(); + g.FontStack.pop_back(); + SetCurrentFont(g.FontStack.empty() ? GetDefaultFont() : g.FontStack.back()); +} + +void ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (enabled) + window->DC.ItemFlags |= option; + else + window->DC.ItemFlags &= ~option; + window->DC.ItemFlagsStack.push_back(window->DC.ItemFlags); +} + +void ImGui::PopItemFlag() +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.ItemFlagsStack.pop_back(); + window->DC.ItemFlags = window->DC.ItemFlagsStack.empty() ? ImGuiItemFlags_Default_ : window->DC.ItemFlagsStack.back(); +} + +// FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system. +void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus) +{ + PushItemFlag(ImGuiItemFlags_NoTabStop, !allow_keyboard_focus); +} + +void ImGui::PopAllowKeyboardFocus() +{ + PopItemFlag(); +} + +void ImGui::PushButtonRepeat(bool repeat) +{ + PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); +} + +void ImGui::PopButtonRepeat() +{ + PopItemFlag(); +} + +void ImGui::PushTextWrapPos(float wrap_pos_x) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.TextWrapPos = wrap_pos_x; + window->DC.TextWrapPosStack.push_back(wrap_pos_x); +} + +void ImGui::PopTextWrapPos() +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.TextWrapPosStack.pop_back(); + window->DC.TextWrapPos = window->DC.TextWrapPosStack.empty() ? -1.0f : window->DC.TextWrapPosStack.back(); +} + +// FIXME: This may incur a round-trip (if the end user got their data from a float4) but eventually we aim to store the in-flight colors as ImU32 +void ImGui::PushStyleColor(ImGuiCol idx, ImU32 col) +{ + ImGuiContext& g = *GImGui; + ImGuiColorMod backup; + backup.Col = idx; + backup.BackupValue = g.Style.Colors[idx]; + g.ColorModifiers.push_back(backup); + g.Style.Colors[idx] = ColorConvertU32ToFloat4(col); +} + +void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col) +{ + ImGuiContext& g = *GImGui; + ImGuiColorMod backup; + backup.Col = idx; + backup.BackupValue = g.Style.Colors[idx]; + g.ColorModifiers.push_back(backup); + g.Style.Colors[idx] = col; +} + +void ImGui::PopStyleColor(int count) +{ + ImGuiContext& g = *GImGui; + while (count > 0) + { + ImGuiColorMod& backup = g.ColorModifiers.back(); + g.Style.Colors[backup.Col] = backup.BackupValue; + g.ColorModifiers.pop_back(); + count--; + } +} + +struct ImGuiStyleVarInfo +{ + ImGuiDataType Type; + ImU32 Count; + ImU32 Offset; + void* GetVarPtr(ImGuiStyle* style) const { return (void*)((unsigned char*)style + Offset); } +}; + +static const ImGuiStyleVarInfo GStyleVarInfo[] = +{ + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) }, // ImGuiStyleVar_WindowPadding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) }, // ImGuiStyleVar_WindowRounding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowBorderSize) }, // ImGuiStyleVar_WindowBorderSize + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) }, // ImGuiStyleVar_WindowMinSize + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowTitleAlign) }, // ImGuiStyleVar_WindowTitleAlign + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildRounding) }, // ImGuiStyleVar_ChildRounding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildBorderSize) }, // ImGuiStyleVar_ChildBorderSize + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupRounding) }, // ImGuiStyleVar_PopupRounding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupBorderSize) }, // ImGuiStyleVar_PopupBorderSize + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameBorderSize) }, // ImGuiStyleVar_FrameBorderSize + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) }, // ImGuiStyleVar_IndentSpacing + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ScrollbarSize) }, // ImGuiStyleVar_ScrollbarSize + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, ScrollbarRounding) }, // ImGuiStyleVar_ScrollbarRounding + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabRounding) }, // ImGuiStyleVar_GrabRounding + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign +}; + +static const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx) +{ + IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_COUNT); + IM_ASSERT(IM_ARRAYSIZE(GStyleVarInfo) == ImGuiStyleVar_COUNT); + return &GStyleVarInfo[idx]; +} + +void ImGui::PushStyleVar(ImGuiStyleVar idx, float val) +{ + const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) + { + ImGuiContext& g = *GImGui; + float* pvar = (float*)var_info->GetVarPtr(&g.Style); + g.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar)); + *pvar = val; + return; + } + IM_ASSERT(0); // Called function with wrong-type? Variable is not a float. +} + +void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) +{ + const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2) + { + ImGuiContext& g = *GImGui; + ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style); + g.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar)); + *pvar = val; + return; + } + IM_ASSERT(0); // Called function with wrong-type? Variable is not a ImVec2. +} + +void ImGui::PopStyleVar(int count) +{ + ImGuiContext& g = *GImGui; + while (count > 0) + { + // We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it. + ImGuiStyleMod& backup = g.StyleModifiers.back(); + const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx); + void* data = info->GetVarPtr(&g.Style); + if (info->Type == ImGuiDataType_Float && info->Count == 1) { ((float*)data)[0] = backup.BackupFloat[0]; } + else if (info->Type == ImGuiDataType_Float && info->Count == 2) { ((float*)data)[0] = backup.BackupFloat[0]; ((float*)data)[1] = backup.BackupFloat[1]; } + g.StyleModifiers.pop_back(); + count--; + } +} + +const char* ImGui::GetStyleColorName(ImGuiCol idx) +{ + // Create switch-case from enum with regexp: ImGuiCol_{.*}, --> case ImGuiCol_\1: return "\1"; + switch (idx) + { + case ImGuiCol_Text: return "Text"; + case ImGuiCol_TextDisabled: return "TextDisabled"; + case ImGuiCol_WindowBg: return "WindowBg"; + case ImGuiCol_ChildBg: return "ChildBg"; + case ImGuiCol_PopupBg: return "PopupBg"; + case ImGuiCol_Border: return "Border"; + case ImGuiCol_BorderShadow: return "BorderShadow"; + case ImGuiCol_FrameBg: return "FrameBg"; + case ImGuiCol_FrameBgHovered: return "FrameBgHovered"; + case ImGuiCol_FrameBgActive: return "FrameBgActive"; + case ImGuiCol_TitleBg: return "TitleBg"; + case ImGuiCol_TitleBgActive: return "TitleBgActive"; + case ImGuiCol_TitleBgCollapsed: return "TitleBgCollapsed"; + case ImGuiCol_MenuBarBg: return "MenuBarBg"; + case ImGuiCol_ScrollbarBg: return "ScrollbarBg"; + case ImGuiCol_ScrollbarGrab: return "ScrollbarGrab"; + case ImGuiCol_ScrollbarGrabHovered: return "ScrollbarGrabHovered"; + case ImGuiCol_ScrollbarGrabActive: return "ScrollbarGrabActive"; + case ImGuiCol_CheckMark: return "CheckMark"; + case ImGuiCol_SliderGrab: return "SliderGrab"; + case ImGuiCol_SliderGrabActive: return "SliderGrabActive"; + case ImGuiCol_Button: return "Button"; + case ImGuiCol_ButtonHovered: return "ButtonHovered"; + case ImGuiCol_ButtonActive: return "ButtonActive"; + case ImGuiCol_Header: return "Header"; + case ImGuiCol_HeaderHovered: return "HeaderHovered"; + case ImGuiCol_HeaderActive: return "HeaderActive"; + case ImGuiCol_Separator: return "Separator"; + case ImGuiCol_SeparatorHovered: return "SeparatorHovered"; + case ImGuiCol_SeparatorActive: return "SeparatorActive"; + case ImGuiCol_ResizeGrip: return "ResizeGrip"; + case ImGuiCol_ResizeGripHovered: return "ResizeGripHovered"; + case ImGuiCol_ResizeGripActive: return "ResizeGripActive"; + case ImGuiCol_PlotLines: return "PlotLines"; + case ImGuiCol_PlotLinesHovered: return "PlotLinesHovered"; + case ImGuiCol_PlotHistogram: return "PlotHistogram"; + case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered"; + case ImGuiCol_TextSelectedBg: return "TextSelectedBg"; + case ImGuiCol_DragDropTarget: return "DragDropTarget"; + case ImGuiCol_NavHighlight: return "NavHighlight"; + case ImGuiCol_NavWindowingHighlight: return "NavWindowingHighlight"; + case ImGuiCol_NavWindowingDimBg: return "NavWindowingDimBg"; + case ImGuiCol_ModalWindowDimBg: return "ModalWindowDimBg"; + } + IM_ASSERT(0); + return "Unknown"; +} + +bool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent) +{ + if (window->RootWindow == potential_parent) + return true; + while (window != NULL) + { + if (window == potential_parent) + return true; + window = window->ParentWindow; + } + return false; +} + +bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags) +{ + IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0); // Flags not supported by this function + ImGuiContext& g = *GImGui; + + if (flags & ImGuiHoveredFlags_AnyWindow) + { + if (g.HoveredWindow == NULL) + return false; + } + else + { + switch (flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) + { + case ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows: + if (g.HoveredRootWindow != g.CurrentWindow->RootWindow) + return false; + break; + case ImGuiHoveredFlags_RootWindow: + if (g.HoveredWindow != g.CurrentWindow->RootWindow) + return false; + break; + case ImGuiHoveredFlags_ChildWindows: + if (g.HoveredWindow == NULL || !IsWindowChildOf(g.HoveredWindow, g.CurrentWindow)) + return false; + break; + default: + if (g.HoveredWindow != g.CurrentWindow) + return false; + break; + } + } + + if (!IsWindowContentHoverable(g.HoveredRootWindow, flags)) + return false; + if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) + if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != g.HoveredWindow->MoveId) + return false; + return true; +} + +bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags) +{ + ImGuiContext& g = *GImGui; + + if (flags & ImGuiFocusedFlags_AnyWindow) + return g.NavWindow != NULL; + + IM_ASSERT(g.CurrentWindow); // Not inside a Begin()/End() + switch (flags & (ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows)) + { + case ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows: + return g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow->RootWindow; + case ImGuiFocusedFlags_RootWindow: + return g.NavWindow == g.CurrentWindow->RootWindow; + case ImGuiFocusedFlags_ChildWindows: + return g.NavWindow && IsWindowChildOf(g.NavWindow, g.CurrentWindow); + default: + return g.NavWindow == g.CurrentWindow; + } +} + +// Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext) +// Note that NoNavFocus makes the window not reachable with CTRL+TAB but it can still be focused with mouse or programmaticaly. +// If you want a window to never be focused, you may use the e.g. NoInputs flag. +bool ImGui::IsWindowNavFocusable(ImGuiWindow* window) +{ + return window->Active && window == window->RootWindow && !(window->Flags & ImGuiWindowFlags_NoNavFocus); +} + +float ImGui::GetWindowWidth() +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->Size.x; +} + +float ImGui::GetWindowHeight() +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->Size.y; +} + +ImVec2 ImGui::GetWindowPos() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + return window->Pos; +} + +void ImGui::SetWindowScrollX(ImGuiWindow* window, float new_scroll_x) +{ + window->DC.CursorMaxPos.x += window->Scroll.x; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it. + window->Scroll.x = new_scroll_x; + window->DC.CursorMaxPos.x -= window->Scroll.x; +} + +void ImGui::SetWindowScrollY(ImGuiWindow* window, float new_scroll_y) +{ + window->DC.CursorMaxPos.y += window->Scroll.y; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it. + window->Scroll.y = new_scroll_y; + window->DC.CursorMaxPos.y -= window->Scroll.y; +} + +static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond) +{ + // Test condition (NB: bit 0 is always true) and clear flags for next time + if (cond && (window->SetWindowPosAllowFlags & cond) == 0) + return; + + IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. + window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); + window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX); + + // Set + const ImVec2 old_pos = window->Pos; + window->Pos = ImFloor(pos); + window->DC.CursorPos += (window->Pos - old_pos); // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor + window->DC.CursorMaxPos += (window->Pos - old_pos); // And more importantly we need to adjust this so size calculation doesn't get affected. +} + +void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + SetWindowPos(window, pos, cond); +} + +void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond) +{ + if (ImGuiWindow* window = FindWindowByName(name)) + SetWindowPos(window, pos, cond); +} + +ImVec2 ImGui::GetWindowSize() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->Size; +} + +static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond) +{ + // Test condition (NB: bit 0 is always true) and clear flags for next time + if (cond && (window->SetWindowSizeAllowFlags & cond) == 0) + return; + + IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. + window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); + + // Set + if (size.x > 0.0f) + { + window->AutoFitFramesX = 0; + window->SizeFull.x = ImFloor(size.x); + } + else + { + window->AutoFitFramesX = 2; + window->AutoFitOnlyGrows = false; + } + if (size.y > 0.0f) + { + window->AutoFitFramesY = 0; + window->SizeFull.y = ImFloor(size.y); + } + else + { + window->AutoFitFramesY = 2; + window->AutoFitOnlyGrows = false; + } +} + +void ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond) +{ + SetWindowSize(GImGui->CurrentWindow, size, cond); +} + +void ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond) +{ + if (ImGuiWindow* window = FindWindowByName(name)) + SetWindowSize(window, size, cond); +} + +static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond) +{ + // Test condition (NB: bit 0 is always true) and clear flags for next time + if (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0) + return; + window->SetWindowCollapsedAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); + + // Set + window->Collapsed = collapsed; +} + +void ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond) +{ + SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond); +} + +bool ImGui::IsWindowCollapsed() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->Collapsed; +} + +bool ImGui::IsWindowAppearing() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->Appearing; +} + +void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond) +{ + if (ImGuiWindow* window = FindWindowByName(name)) + SetWindowCollapsed(window, collapsed, cond); +} + +void ImGui::SetWindowFocus() +{ + FocusWindow(GImGui->CurrentWindow); +} + +void ImGui::SetWindowFocus(const char* name) +{ + if (name) + { + if (ImGuiWindow* window = FindWindowByName(name)) + FocusWindow(window); + } + else + { + FocusWindow(NULL); + } +} + +void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pivot) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. + g.NextWindowData.PosVal = pos; + g.NextWindowData.PosPivotVal = pivot; + g.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always; +} + +void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. + g.NextWindowData.SizeVal = size; + g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always; +} + +void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback, void* custom_callback_user_data) +{ + ImGuiContext& g = *GImGui; + g.NextWindowData.SizeConstraintCond = ImGuiCond_Always; + g.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max); + g.NextWindowData.SizeCallback = custom_callback; + g.NextWindowData.SizeCallbackUserData = custom_callback_user_data; +} + +void ImGui::SetNextWindowContentSize(const ImVec2& size) +{ + ImGuiContext& g = *GImGui; + g.NextWindowData.ContentSizeVal = size; // In Begin() we will add the size of window decorations (title bar, menu etc.) to that to form a SizeContents value. + g.NextWindowData.ContentSizeCond = ImGuiCond_Always; +} + +void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(cond == 0 || ImIsPowerOfTwo(cond)); // Make sure the user doesn't attempt to combine multiple condition flags. + g.NextWindowData.CollapsedVal = collapsed; + g.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always; +} + +void ImGui::SetNextWindowFocus() +{ + ImGuiContext& g = *GImGui; + g.NextWindowData.FocusCond = ImGuiCond_Always; // Using a Cond member for consistency (may transition all of them to single flag set for fast Clear() op) +} + +void ImGui::SetNextWindowBgAlpha(float alpha) +{ + ImGuiContext& g = *GImGui; + g.NextWindowData.BgAlphaVal = alpha; + g.NextWindowData.BgAlphaCond = ImGuiCond_Always; // Using a Cond member for consistency (may transition all of them to single flag set for fast Clear() op) +} + +// In window space (not screen space!) +ImVec2 ImGui::GetContentRegionMax() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + ImVec2 mx = window->ContentsRegionRect.Max - window->Pos; + if (window->DC.ColumnsSet) + mx.x = GetColumnOffset(window->DC.ColumnsSet->Current + 1) - window->WindowPadding.x; + return mx; +} + +ImVec2 ImGui::GetContentRegionAvail() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return GetContentRegionMax() - (window->DC.CursorPos - window->Pos); +} + +float ImGui::GetContentRegionAvailWidth() +{ + return GetContentRegionAvail().x; +} + +// In window space (not screen space!) +ImVec2 ImGui::GetWindowContentRegionMin() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->ContentsRegionRect.Min - window->Pos; +} + +ImVec2 ImGui::GetWindowContentRegionMax() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->ContentsRegionRect.Max - window->Pos; +} + +float ImGui::GetWindowContentRegionWidth() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->ContentsRegionRect.GetWidth(); +} + +float ImGui::GetTextLineHeight() +{ + ImGuiContext& g = *GImGui; + return g.FontSize; +} + +float ImGui::GetTextLineHeightWithSpacing() +{ + ImGuiContext& g = *GImGui; + return g.FontSize + g.Style.ItemSpacing.y; +} + +float ImGui::GetFrameHeight() +{ + ImGuiContext& g = *GImGui; + return g.FontSize + g.Style.FramePadding.y * 2.0f; +} + +float ImGui::GetFrameHeightWithSpacing() +{ + ImGuiContext& g = *GImGui; + return g.FontSize + g.Style.FramePadding.y * 2.0f + g.Style.ItemSpacing.y; +} + +ImDrawList* ImGui::GetWindowDrawList() +{ + ImGuiWindow* window = GetCurrentWindow(); + return window->DrawList; +} + +ImFont* ImGui::GetFont() +{ + return GImGui->Font; +} + +float ImGui::GetFontSize() +{ + return GImGui->FontSize; +} + +ImVec2 ImGui::GetFontTexUvWhitePixel() +{ + return GImGui->DrawListSharedData.TexUvWhitePixel; +} + +void ImGui::SetWindowFontScale(float scale) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + window->FontWindowScale = scale; + g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize(); +} + +// User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient. +// Conversion happens as we pass the value to user, but it makes our naming convention confusing because GetCursorPos() == (DC.CursorPos - window.Pos). May want to rename 'DC.CursorPos'. +ImVec2 ImGui::GetCursorPos() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.CursorPos - window->Pos + window->Scroll; +} + +float ImGui::GetCursorPosX() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.CursorPos.x - window->Pos.x + window->Scroll.x; +} + +float ImGui::GetCursorPosY() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.CursorPos.y - window->Pos.y + window->Scroll.y; +} + +void ImGui::SetCursorPos(const ImVec2& local_pos) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.CursorPos = window->Pos - window->Scroll + local_pos; + window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); +} + +void ImGui::SetCursorPosX(float x) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + x; + window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x); +} + +void ImGui::SetCursorPosY(float y) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.CursorPos.y = window->Pos.y - window->Scroll.y + y; + window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y); +} + +ImVec2 ImGui::GetCursorStartPos() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.CursorStartPos - window->Pos; +} + +ImVec2 ImGui::GetCursorScreenPos() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.CursorPos; +} + +void ImGui::SetCursorScreenPos(const ImVec2& screen_pos) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.CursorPos = screen_pos; + window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); +} + +float ImGui::GetScrollX() +{ + return GImGui->CurrentWindow->Scroll.x; +} + +float ImGui::GetScrollY() +{ + return GImGui->CurrentWindow->Scroll.y; +} + +float ImGui::GetScrollMaxX() +{ + return GetWindowScrollMaxX(GImGui->CurrentWindow); +} + +float ImGui::GetScrollMaxY() +{ + return GetWindowScrollMaxY(GImGui->CurrentWindow); +} + +void ImGui::SetScrollX(float scroll_x) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->ScrollTarget.x = scroll_x; + window->ScrollTargetCenterRatio.x = 0.0f; +} + +void ImGui::SetScrollY(float scroll_y) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->ScrollTarget.y = scroll_y + window->TitleBarHeight() + window->MenuBarHeight(); // title bar height canceled out when using ScrollTargetRelY + window->ScrollTargetCenterRatio.y = 0.0f; +} + +void ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio) +{ + // We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size + ImGuiWindow* window = GetCurrentWindow(); + IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f); + window->ScrollTarget.y = (float)(int)(pos_y + window->Scroll.y); + window->ScrollTargetCenterRatio.y = center_y_ratio; +} + +// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item. +void ImGui::SetScrollHereY(float center_y_ratio) +{ + ImGuiWindow* window = GetCurrentWindow(); + float target_y = window->DC.CursorPosPrevLine.y - window->Pos.y; // Top of last item, in window space + target_y += (window->DC.PrevLineSize.y * center_y_ratio) + (GImGui->Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line. + SetScrollFromPosY(target_y, center_y_ratio); +} + +void ImGui::ActivateItem(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + g.NavNextActivateId = id; +} + +void ImGui::SetKeyboardFocusHere(int offset) +{ + IM_ASSERT(offset >= -1); // -1 is allowed but not below + ImGuiWindow* window = GetCurrentWindow(); + window->FocusIdxAllRequestNext = window->FocusIdxAllCounter + 1 + offset; + window->FocusIdxTabRequestNext = INT_MAX; +} + +void ImGui::SetItemDefaultFocus() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (!window->Appearing) + return; + if (g.NavWindow == window->RootWindowForNav && (g.NavInitRequest || g.NavInitResultId != 0) && g.NavLayer == g.NavWindow->DC.NavLayerCurrent) + { + g.NavInitRequest = false; + g.NavInitResultId = g.NavWindow->DC.LastItemId; + g.NavInitResultRectRel = ImRect(g.NavWindow->DC.LastItemRect.Min - g.NavWindow->Pos, g.NavWindow->DC.LastItemRect.Max - g.NavWindow->Pos); + NavUpdateAnyRequestFlag(); + if (!IsItemVisible()) + SetScrollHereY(); + } +} + +void ImGui::SetStateStorage(ImGuiStorage* tree) +{ + ImGuiWindow* window = GetCurrentWindow(); + window->DC.StateStorage = tree ? tree : &window->StateStorage; +} + +ImGuiStorage* ImGui::GetStateStorage() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.StateStorage; +} + +void ImGui::PushID(const char* str_id) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + window->IDStack.push_back(window->GetIDNoKeepAlive(str_id)); +} + +void ImGui::PushID(const char* str_id_begin, const char* str_id_end) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + window->IDStack.push_back(window->GetIDNoKeepAlive(str_id_begin, str_id_end)); +} + +void ImGui::PushID(const void* ptr_id) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id)); +} + +void ImGui::PushID(int int_id) +{ + const void* ptr_id = (void*)(intptr_t)int_id; + ImGuiWindow* window = GetCurrentWindowRead(); + window->IDStack.push_back(window->GetIDNoKeepAlive(ptr_id)); +} + +void ImGui::PopID() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + window->IDStack.pop_back(); +} + +ImGuiID ImGui::GetID(const char* str_id) +{ + return GImGui->CurrentWindow->GetID(str_id); +} + +ImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end) +{ + return GImGui->CurrentWindow->GetID(str_id_begin, str_id_end); +} + +ImGuiID ImGui::GetID(const void* ptr_id) +{ + return GImGui->CurrentWindow->GetID(ptr_id); +} + +bool ImGui::IsRectVisible(const ImVec2& size) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size)); +} + +bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->ClipRect.Overlaps(ImRect(rect_min, rect_max)); +} + +// Lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) +void ImGui::BeginGroup() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + + window->DC.GroupStack.resize(window->DC.GroupStack.Size + 1); + ImGuiGroupData& group_data = window->DC.GroupStack.back(); + group_data.BackupCursorPos = window->DC.CursorPos; + group_data.BackupCursorMaxPos = window->DC.CursorMaxPos; + group_data.BackupIndent = window->DC.Indent; + group_data.BackupGroupOffset = window->DC.GroupOffset; + group_data.BackupCurrentLineSize = window->DC.CurrentLineSize; + group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset; + group_data.BackupLogLinePosY = window->DC.LogLinePosY; + group_data.BackupActiveIdIsAlive = g.ActiveIdIsAlive; + group_data.BackupActiveIdPreviousFrameIsAlive = g.ActiveIdPreviousFrameIsAlive; + group_data.AdvanceCursor = true; + + window->DC.GroupOffset.x = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffset.x; + window->DC.Indent = window->DC.GroupOffset; + window->DC.CursorMaxPos = window->DC.CursorPos; + window->DC.CurrentLineSize = ImVec2(0.0f, 0.0f); + window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; // To enforce Log carriage return +} + +void ImGui::EndGroup() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + IM_ASSERT(!window->DC.GroupStack.empty()); // Mismatched BeginGroup()/EndGroup() calls + + ImGuiGroupData& group_data = window->DC.GroupStack.back(); + + ImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos); + group_bb.Max = ImMax(group_bb.Min, group_bb.Max); + + window->DC.CursorPos = group_data.BackupCursorPos; + window->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos); + window->DC.Indent = group_data.BackupIndent; + window->DC.GroupOffset = group_data.BackupGroupOffset; + window->DC.CurrentLineSize = group_data.BackupCurrentLineSize; + window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset; + window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; // To enforce Log carriage return + + if (group_data.AdvanceCursor) + { + window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrentLineTextBaseOffset); // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now. + ItemSize(group_bb.GetSize(), group_data.BackupCurrentLineTextBaseOffset); + ItemAdd(group_bb, 0); + } + + // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group. + // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets. + // (and if you grep for LastItemId you'll notice it is only used in that context. + if ((group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId) // && g.ActiveIdWindow->RootWindow == window->RootWindow) + window->DC.LastItemId = g.ActiveId; + else if (!group_data.BackupActiveIdPreviousFrameIsAlive && g.ActiveIdPreviousFrameIsAlive) // && g.ActiveIdPreviousFrameWindow->RootWindow == window->RootWindow) + window->DC.LastItemId = g.ActiveIdPreviousFrame; + window->DC.LastItemRect = group_bb; + + window->DC.GroupStack.pop_back(); + + //window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // [Debug] +} + +// Gets back to previous line and continue with horizontal layout +// pos_x == 0 : follow right after previous item +// pos_x != 0 : align to specified x position (relative to window/group left) +// spacing_w < 0 : use default spacing if pos_x == 0, no spacing if pos_x != 0 +// spacing_w >= 0 : enforce spacing amount +void ImGui::SameLine(float pos_x, float spacing_w) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + if (pos_x != 0.0f) + { + if (spacing_w < 0.0f) spacing_w = 0.0f; + window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + pos_x + spacing_w + window->DC.GroupOffset.x + window->DC.ColumnsOffset.x; + window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y; + } + else + { + if (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x; + window->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w; + window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y; + } + window->DC.CurrentLineSize = window->DC.PrevLineSize; + window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset; +} + +void ImGui::Indent(float indent_w) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + window->DC.Indent.x += (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing; + window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x; +} + +void ImGui::Unindent(float indent_w) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + window->DC.Indent.x -= (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing; + window->DC.CursorPos.x = window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x; +} + +//----------------------------------------------------------------------------- +// [SECTION] TOOLTIPS +//----------------------------------------------------------------------------- + +void ImGui::BeginTooltip() +{ + ImGuiContext& g = *GImGui; + if (g.DragDropWithinSourceOrTarget) + { + // The default tooltip position is a little offset to give space to see the context menu (it's also clamped within the current viewport/monitor) + // In the context of a dragging tooltip we try to reduce that offset and we enforce following the cursor. + // Whatever we do we want to call SetNextWindowPos() to enforce a tooltip position and disable clipping the tooltip without our display area, like regular tooltip do. + //ImVec2 tooltip_pos = g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding; + ImVec2 tooltip_pos = g.IO.MousePos + ImVec2(16 * g.Style.MouseCursorScale, 8 * g.Style.MouseCursorScale); + SetNextWindowPos(tooltip_pos); + SetNextWindowBgAlpha(g.Style.Colors[ImGuiCol_PopupBg].w * 0.60f); + //PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This would be nice but e.g ColorButton with checkboard has issue with transparent colors :( + BeginTooltipEx(0, true); + } + else + { + BeginTooltipEx(0, false); + } +} + +// Not exposed publicly as BeginTooltip() because bool parameters are evil. Let's see if other needs arise first. +void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip) +{ + ImGuiContext& g = *GImGui; + char window_name[16]; + ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", g.TooltipOverrideCount); + if (override_previous_tooltip) + if (ImGuiWindow* window = FindWindowByName(window_name)) + if (window->Active) + { + // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. + window->Hidden = true; + window->HiddenFramesRegular = 1; + ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); + } + ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip|ImGuiWindowFlags_NoInputs|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize; + Begin(window_name, NULL, flags | extra_flags); +} + +void ImGui::EndTooltip() +{ + IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip); // Mismatched BeginTooltip()/EndTooltip() calls + End(); +} + +void ImGui::SetTooltipV(const char* fmt, va_list args) +{ + ImGuiContext& g = *GImGui; + if (g.DragDropWithinSourceOrTarget) + BeginTooltip(); + else + BeginTooltipEx(0, true); + TextV(fmt, args); + EndTooltip(); +} + +void ImGui::SetTooltip(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + SetTooltipV(fmt, args); + va_end(args); +} + +//----------------------------------------------------------------------------- +// [SECTION] POPUPS +//----------------------------------------------------------------------------- + +bool ImGui::IsPopupOpen(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id; +} + +bool ImGui::IsPopupOpen(const char* str_id) +{ + ImGuiContext& g = *GImGui; + return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == g.CurrentWindow->GetID(str_id); +} + +ImGuiWindow* ImGui::GetFrontMostPopupModal() +{ + ImGuiContext& g = *GImGui; + for (int n = g.OpenPopupStack.Size-1; n >= 0; n--) + if (ImGuiWindow* popup = g.OpenPopupStack.Data[n].Window) + if (popup->Flags & ImGuiWindowFlags_Modal) + return popup; + return NULL; +} + +void ImGui::OpenPopup(const char* str_id) +{ + ImGuiContext& g = *GImGui; + OpenPopupEx(g.CurrentWindow->GetID(str_id)); +} + +// Mark popup as open (toggle toward open state). +// Popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. +// Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). +// One open popup per level of the popup hierarchy (NB: when assigning we reset the Window member of ImGuiPopupRef to NULL) +void ImGui::OpenPopupEx(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* parent_window = g.CurrentWindow; + int current_stack_size = g.CurrentPopupStack.Size; + ImGuiPopupRef popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack. + popup_ref.PopupId = id; + popup_ref.Window = NULL; + popup_ref.ParentWindow = parent_window; + popup_ref.OpenFrameCount = g.FrameCount; + popup_ref.OpenParentId = parent_window->IDStack.back(); + popup_ref.OpenPopupPos = NavCalcPreferredRefPos(); + popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos; + + //printf("[%05d] OpenPopupEx(0x%08X)\n", g.FrameCount, id); + if (g.OpenPopupStack.Size < current_stack_size + 1) + { + g.OpenPopupStack.push_back(popup_ref); + } + else + { + // Gently handle the user mistakenly calling OpenPopup() every frame. It is a programming mistake! However, if we were to run the regular code path, the ui + // would become completely unusable because the popup will always be in hidden-while-calculating-size state _while_ claiming focus. Which would be a very confusing + // situation for the programmer. Instead, we silently allow the popup to proceed, it will keep reappearing and the programming error will be more obvious to understand. + if (g.OpenPopupStack[current_stack_size].PopupId == id && g.OpenPopupStack[current_stack_size].OpenFrameCount == g.FrameCount - 1) + { + g.OpenPopupStack[current_stack_size].OpenFrameCount = popup_ref.OpenFrameCount; + } + else + { + // Close child popups if any, then flag popup for open/reopen + g.OpenPopupStack.resize(current_stack_size + 1); + g.OpenPopupStack[current_stack_size] = popup_ref; + } + + // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by ClosePopupsOverWindow(). + // This is equivalent to what ClosePopupToLevel() does. + //if (g.OpenPopupStack[current_stack_size].PopupId == id) + // FocusWindow(parent_window); + } +} + +bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + { + ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! + IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item) + OpenPopupEx(id); + return true; + } + return false; +} + +void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window) +{ + ImGuiContext& g = *GImGui; + if (g.OpenPopupStack.empty()) + return; + + // When popups are stacked, clicking on a lower level popups puts focus back to it and close popups above it. + // Don't close our own child popup windows. + int n = 0; + if (ref_window) + { + for (n = 0; n < g.OpenPopupStack.Size; n++) + { + ImGuiPopupRef& popup = g.OpenPopupStack[n]; + if (!popup.Window) + continue; + IM_ASSERT((popup.Window->Flags & ImGuiWindowFlags_Popup) != 0); + if (popup.Window->Flags & ImGuiWindowFlags_ChildWindow) + continue; + + // Trim the stack if popups are not direct descendant of the reference window (which is often the NavWindow) + bool has_focus = false; + for (int m = n; m < g.OpenPopupStack.Size && !has_focus; m++) + has_focus = (g.OpenPopupStack[m].Window && g.OpenPopupStack[m].Window->RootWindow == ref_window->RootWindow); + if (!has_focus) + break; + } + } + if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the block below + ClosePopupToLevel(n); +} + +void ImGui::ClosePopupToLevel(int remaining) +{ + IM_ASSERT(remaining >= 0); + ImGuiContext& g = *GImGui; + ImGuiWindow* focus_window = (remaining > 0) ? g.OpenPopupStack[remaining-1].Window : g.OpenPopupStack[0].ParentWindow; + if (g.NavLayer == 0) + focus_window = NavRestoreLastChildNavWindow(focus_window); + FocusWindow(focus_window); + focus_window->DC.NavHideHighlightOneFrame = true; + g.OpenPopupStack.resize(remaining); +} + +void ImGui::ClosePopup(ImGuiID id) +{ + if (!IsPopupOpen(id)) + return; + ImGuiContext& g = *GImGui; + ClosePopupToLevel(g.OpenPopupStack.Size - 1); +} + +// Close the popup we have begin-ed into. +void ImGui::CloseCurrentPopup() +{ + ImGuiContext& g = *GImGui; + int popup_idx = g.CurrentPopupStack.Size - 1; + if (popup_idx < 0 || popup_idx >= g.OpenPopupStack.Size || g.CurrentPopupStack[popup_idx].PopupId != g.OpenPopupStack[popup_idx].PopupId) + return; + while (popup_idx > 0 && g.OpenPopupStack[popup_idx].Window && (g.OpenPopupStack[popup_idx].Window->Flags & ImGuiWindowFlags_ChildMenu)) + popup_idx--; + ClosePopupToLevel(popup_idx); +} + +bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags) +{ + ImGuiContext& g = *GImGui; + if (!IsPopupOpen(id)) + { + g.NextWindowData.Clear(); // We behave like Begin() and need to consume those values + return false; + } + + char name[20]; + if (extra_flags & ImGuiWindowFlags_ChildMenu) + ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.CurrentPopupStack.Size); // Recycle windows based on depth + else + ImFormatString(name, IM_ARRAYSIZE(name), "##Popup_%08x", id); // Not recycling, so we can close/open during the same frame + + bool is_open = Begin(name, NULL, extra_flags | ImGuiWindowFlags_Popup); + if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display) + EndPopup(); + + return is_open; +} + +bool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags) +{ + ImGuiContext& g = *GImGui; + if (g.OpenPopupStack.Size <= g.CurrentPopupStack.Size) // Early out for performance + { + g.NextWindowData.Clear(); // We behave like Begin() and need to consume those values + return false; + } + return BeginPopupEx(g.CurrentWindow->GetID(str_id), flags|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings); +} + +bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + const ImGuiID id = window->GetID(name); + if (!IsPopupOpen(id)) + { + g.NextWindowData.Clear(); // We behave like Begin() and need to consume those values + return false; + } + + // Center modal windows by default + // FIXME: Should test for (PosCond & window->SetWindowPosAllowFlags) with the upcoming window. + if (g.NextWindowData.PosCond == 0) + SetNextWindowPos(g.IO.DisplaySize * 0.5f, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); + + bool is_open = Begin(name, p_open, flags | ImGuiWindowFlags_Popup | ImGuiWindowFlags_Modal | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings); + if (!is_open || (p_open && !*p_open)) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + { + EndPopup(); + if (is_open) + ClosePopup(id); + return false; + } + return is_open; +} + +void ImGui::EndPopup() +{ + ImGuiContext& g = *GImGui; (void)g; + IM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls + IM_ASSERT(g.CurrentPopupStack.Size > 0); + + // Make all menus and popups wrap around for now, may need to expose that policy. + NavMoveRequestTryWrapping(g.CurrentWindow, ImGuiNavMoveFlags_LoopY); + + End(); +} + +// This is a helper to handle the simplest case of associating one named popup to one given widget. +// You may want to handle this on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters). +// You can pass a NULL str_id to use the identifier of the last item. +bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! + IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item) + if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + OpenPopupEx(id); + return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings); +} + +bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool also_over_items) +{ + if (!str_id) + str_id = "window_context"; + ImGuiID id = GImGui->CurrentWindow->GetID(str_id); + if (IsMouseReleased(mouse_button) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + if (also_over_items || !IsAnyItemHovered()) + OpenPopupEx(id); + return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings); +} + +bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button) +{ + if (!str_id) + str_id = "void_context"; + ImGuiID id = GImGui->CurrentWindow->GetID(str_id); + if (IsMouseReleased(mouse_button) && !IsWindowHovered(ImGuiHoveredFlags_AnyWindow)) + OpenPopupEx(id); + return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings); +} + +ImRect ImGui::GetWindowAllowedExtentRect(ImGuiWindow*) +{ + ImVec2 padding = GImGui->Style.DisplaySafeAreaPadding; + ImRect r_screen = GetViewportRect(); + r_screen.Expand(ImVec2((r_screen.GetWidth() > padding.x * 2) ? -padding.x : 0.0f, (r_screen.GetHeight() > padding.y * 2) ? -padding.y : 0.0f)); + return r_screen; +} + +// r_avoid = the rectangle to avoid (e.g. for tooltip it is a rectangle around the mouse cursor which we want to avoid. for popups it's a small point around the cursor.) +// r_outer = the visible area rectangle, minus safe area padding. If our popup size won't fit because of safe area padding we ignore it. +ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy) +{ + ImVec2 base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size); + //GImGui->OverlayDrawList.AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255)); + //GImGui->OverlayDrawList.AddRect(r_outer.Min, r_outer.Max, IM_COL32(0,255,0,255)); + + // Combo Box policy (we want a connecting edge) + if (policy == ImGuiPopupPositionPolicy_ComboBox) + { + const ImGuiDir dir_prefered_order[ImGuiDir_COUNT] = { ImGuiDir_Down, ImGuiDir_Right, ImGuiDir_Left, ImGuiDir_Up }; + for (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_COUNT; n++) + { + const ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n]; + if (n != -1 && dir == *last_dir) // Already tried this direction? + continue; + ImVec2 pos; + if (dir == ImGuiDir_Down) pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y); // Below, Toward Right (default) + if (dir == ImGuiDir_Right) pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y); // Above, Toward Right + if (dir == ImGuiDir_Left) pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y); // Below, Toward Left + if (dir == ImGuiDir_Up) pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y); // Above, Toward Left + if (!r_outer.Contains(ImRect(pos, pos + size))) + continue; + *last_dir = dir; + return pos; + } + } + + // Default popup policy + const ImGuiDir dir_prefered_order[ImGuiDir_COUNT] = { ImGuiDir_Right, ImGuiDir_Down, ImGuiDir_Up, ImGuiDir_Left }; + for (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_COUNT; n++) + { + const ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n]; + if (n != -1 && dir == *last_dir) // Already tried this direction? + continue; + float avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x); + float avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y); + if (avail_w < size.x || avail_h < size.y) + continue; + ImVec2 pos; + pos.x = (dir == ImGuiDir_Left) ? r_avoid.Min.x - size.x : (dir == ImGuiDir_Right) ? r_avoid.Max.x : base_pos_clamped.x; + pos.y = (dir == ImGuiDir_Up) ? r_avoid.Min.y - size.y : (dir == ImGuiDir_Down) ? r_avoid.Max.y : base_pos_clamped.y; + *last_dir = dir; + return pos; + } + + // Fallback, try to keep within display + *last_dir = ImGuiDir_None; + ImVec2 pos = ref_pos; + pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x); + pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y); + return pos; +} + +ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + + ImRect r_outer = GetWindowAllowedExtentRect(window); + if (window->Flags & ImGuiWindowFlags_ChildMenu) + { + // Child menus typically request _any_ position within the parent menu item, and then our FindBestWindowPosForPopup() function will move the new menu outside the parent bounds. + // This is how we end up with child menus appearing (most-commonly) on the right of the parent menu. + IM_ASSERT(g.CurrentWindow == window); + ImGuiWindow* parent_window = g.CurrentWindowStack[g.CurrentWindowStack.Size - 2]; + float horizontal_overlap = g.Style.ItemSpacing.x; // We want some overlap to convey the relative depth of each menu (currently the amount of overlap is hard-coded to style.ItemSpacing.x). + ImRect r_avoid; + if (parent_window->DC.MenuBarAppending) + r_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight()); + else + r_avoid = ImRect(parent_window->Pos.x + horizontal_overlap, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - horizontal_overlap - parent_window->ScrollbarSizes.x, FLT_MAX); + return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid); + } + if (window->Flags & ImGuiWindowFlags_Popup) + { + ImRect r_avoid = ImRect(window->Pos.x - 1, window->Pos.y - 1, window->Pos.x + 1, window->Pos.y + 1); + return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid); + } + if (window->Flags & ImGuiWindowFlags_Tooltip) + { + // Position tooltip (always follows mouse) + float sc = g.Style.MouseCursorScale; + ImVec2 ref_pos = NavCalcPreferredRefPos(); + ImRect r_avoid; + if (!g.NavDisableHighlight && g.NavDisableMouseHover && !(g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos)) + r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 16, ref_pos.y + 8); + else + r_avoid = ImRect(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24 * sc, ref_pos.y + 24 * sc); // FIXME: Hard-coded based on mouse cursor shape expectation. Exact dimension not very important. + ImVec2 pos = FindBestWindowPosForPopupEx(ref_pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid); + if (window->AutoPosLastDirection == ImGuiDir_None) + pos = ref_pos + ImVec2(2, 2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible. + return pos; + } + IM_ASSERT(0); + return window->Pos; +} + +//----------------------------------------------------------------------------- +// [SECTION] KEYBOARD/GAMEPAD NAVIGATION +//----------------------------------------------------------------------------- + +ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy) +{ + if (ImFabs(dx) > ImFabs(dy)) + return (dx > 0.0f) ? ImGuiDir_Right : ImGuiDir_Left; + return (dy > 0.0f) ? ImGuiDir_Down : ImGuiDir_Up; +} + +static float inline NavScoreItemDistInterval(float a0, float a1, float b0, float b1) +{ + if (a1 < b0) + return a1 - b0; + if (b1 < a0) + return a0 - b1; + return 0.0f; +} + +static void inline NavClampRectToVisibleAreaForMoveDir(ImGuiDir move_dir, ImRect& r, const ImRect& clip_rect) +{ + if (move_dir == ImGuiDir_Left || move_dir == ImGuiDir_Right) + { + r.Min.y = ImClamp(r.Min.y, clip_rect.Min.y, clip_rect.Max.y); + r.Max.y = ImClamp(r.Max.y, clip_rect.Min.y, clip_rect.Max.y); + } + else + { + r.Min.x = ImClamp(r.Min.x, clip_rect.Min.x, clip_rect.Max.x); + r.Max.x = ImClamp(r.Max.x, clip_rect.Min.x, clip_rect.Max.x); + } +} + +// Scoring function for directional navigation. Based on https://gist.github.com/rygorous/6981057 +static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (g.NavLayer != window->DC.NavLayerCurrent) + return false; + + const ImRect& curr = g.NavScoringRectScreen; // Current modified source rect (NB: we've applied Max.x = Min.x in NavUpdate() to inhibit the effect of having varied item width) + g.NavScoringCount++; + + // When entering through a NavFlattened border, we consider child window items as fully clipped for scoring + if (window->ParentWindow == g.NavWindow) + { + IM_ASSERT((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened); + if (!window->ClipRect.Contains(cand)) + return false; + cand.ClipWithFull(window->ClipRect); // This allows the scored item to not overlap other candidates in the parent window + } + + // We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items) + // For example, this ensure that items in one column are not reached when moving vertically from items in another column. + NavClampRectToVisibleAreaForMoveDir(g.NavMoveClipDir, cand, window->ClipRect); + + // Compute distance between boxes + // FIXME-NAV: Introducing biases for vertical navigation, needs to be removed. + float dbx = NavScoreItemDistInterval(cand.Min.x, cand.Max.x, curr.Min.x, curr.Max.x); + float dby = NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f)); // Scale down on Y to keep using box-distance for vertically touching items + if (dby != 0.0f && dbx != 0.0f) + dbx = (dbx/1000.0f) + ((dbx > 0.0f) ? +1.0f : -1.0f); + float dist_box = ImFabs(dbx) + ImFabs(dby); + + // Compute distance between centers (this is off by a factor of 2, but we only compare center distances with each other so it doesn't matter) + float dcx = (cand.Min.x + cand.Max.x) - (curr.Min.x + curr.Max.x); + float dcy = (cand.Min.y + cand.Max.y) - (curr.Min.y + curr.Max.y); + float dist_center = ImFabs(dcx) + ImFabs(dcy); // L1 metric (need this for our connectedness guarantee) + + // Determine which quadrant of 'curr' our candidate item 'cand' lies in based on distance + ImGuiDir quadrant; + float dax = 0.0f, day = 0.0f, dist_axial = 0.0f; + if (dbx != 0.0f || dby != 0.0f) + { + // For non-overlapping boxes, use distance between boxes + dax = dbx; + day = dby; + dist_axial = dist_box; + quadrant = ImGetDirQuadrantFromDelta(dbx, dby); + } + else if (dcx != 0.0f || dcy != 0.0f) + { + // For overlapping boxes with different centers, use distance between centers + dax = dcx; + day = dcy; + dist_axial = dist_center; + quadrant = ImGetDirQuadrantFromDelta(dcx, dcy); + } + else + { + // Degenerate case: two overlapping buttons with same center, break ties arbitrarily (note that LastItemId here is really the _previous_ item order, but it doesn't matter) + quadrant = (window->DC.LastItemId < g.NavId) ? ImGuiDir_Left : ImGuiDir_Right; + } + +#if IMGUI_DEBUG_NAV_SCORING + char buf[128]; + if (ImGui::IsMouseHoveringRect(cand.Min, cand.Max)) + { + ImFormatString(buf, IM_ARRAYSIZE(buf), "dbox (%.2f,%.2f->%.4f)\ndcen (%.2f,%.2f->%.4f)\nd (%.2f,%.2f->%.4f)\nnav %c, quadrant %c", dbx, dby, dist_box, dcx, dcy, dist_center, dax, day, dist_axial, "WENS"[g.NavMoveDir], "WENS"[quadrant]); + ImDrawList* draw_list = GetOverlayDrawList(window); + draw_list->AddRect(curr.Min, curr.Max, IM_COL32(255,200,0,100)); + draw_list->AddRect(cand.Min, cand.Max, IM_COL32(255,255,0,200)); + draw_list->AddRectFilled(cand.Max-ImVec2(4,4), cand.Max+ImGui::CalcTextSize(buf)+ImVec2(4,4), IM_COL32(40,0,0,150)); + draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Max, ~0U, buf); + } + else if (g.IO.KeyCtrl) // Hold to preview score in matching quadrant. Press C to rotate. + { + if (ImGui::IsKeyPressedMap(ImGuiKey_C)) { g.NavMoveDirLast = (ImGuiDir)((g.NavMoveDirLast + 1) & 3); g.IO.KeysDownDuration[g.IO.KeyMap[ImGuiKey_C]] = 0.01f; } + if (quadrant == g.NavMoveDir) + { + ImFormatString(buf, IM_ARRAYSIZE(buf), "%.0f/%.0f", dist_box, dist_center); + ImDrawList* draw_list = GetOverlayDrawList(window); + draw_list->AddRectFilled(cand.Min, cand.Max, IM_COL32(255, 0, 0, 200)); + draw_list->AddText(g.IO.FontDefault, 13.0f, cand.Min, IM_COL32(255, 255, 255, 255), buf); + } + } + #endif + + // Is it in the quadrant we're interesting in moving to? + bool new_best = false; + if (quadrant == g.NavMoveDir) + { + // Does it beat the current best candidate? + if (dist_box < result->DistBox) + { + result->DistBox = dist_box; + result->DistCenter = dist_center; + return true; + } + if (dist_box == result->DistBox) + { + // Try using distance between center points to break ties + if (dist_center < result->DistCenter) + { + result->DistCenter = dist_center; + new_best = true; + } + else if (dist_center == result->DistCenter) + { + // Still tied! we need to be extra-careful to make sure everything gets linked properly. We consistently break ties by symbolically moving "later" items + // (with higher index) to the right/downwards by an infinitesimal amount since we the current "best" button already (so it must have a lower index), + // this is fairly easy. This rule ensures that all buttons with dx==dy==0 will end up being linked in order of appearance along the x axis. + if (((g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) ? dby : dbx) < 0.0f) // moving bj to the right/down decreases distance + new_best = true; + } + } + } + + // Axial check: if 'curr' has no link at all in some direction and 'cand' lies roughly in that direction, add a tentative link. This will only be kept if no "real" matches + // are found, so it only augments the graph produced by the above method using extra links. (important, since it doesn't guarantee strong connectedness) + // This is just to avoid buttons having no links in a particular direction when there's a suitable neighbor. you get good graphs without this too. + // 2017/09/29: FIXME: This now currently only enabled inside menu bars, ideally we'd disable it everywhere. Menus in particular need to catch failure. For general navigation it feels awkward. + // Disabling it may lead to disconnected graphs when nodes are very spaced out on different axis. Perhaps consider offering this as an option? + if (result->DistBox == FLT_MAX && dist_axial < result->DistAxial) // Check axial match + if (g.NavLayer == 1 && !(g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu)) + if ((g.NavMoveDir == ImGuiDir_Left && dax < 0.0f) || (g.NavMoveDir == ImGuiDir_Right && dax > 0.0f) || (g.NavMoveDir == ImGuiDir_Up && day < 0.0f) || (g.NavMoveDir == ImGuiDir_Down && day > 0.0f)) + { + result->DistAxial = dist_axial; + new_best = true; + } + + return new_best; +} + +// We get there when either NavId == id, or when g.NavAnyRequest is set (which is updated by NavUpdateAnyRequestFlag above) +static void ImGui::NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id) +{ + ImGuiContext& g = *GImGui; + //if (!g.IO.NavActive) // [2017/10/06] Removed this possibly redundant test but I am not sure of all the side-effects yet. Some of the feature here will need to work regardless of using a _NoNavInputs flag. + // return; + + const ImGuiItemFlags item_flags = window->DC.ItemFlags; + const ImRect nav_bb_rel(nav_bb.Min - window->Pos, nav_bb.Max - window->Pos); + + // Process Init Request + if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent) + { + // Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback + if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus) || g.NavInitResultId == 0) + { + g.NavInitResultId = id; + g.NavInitResultRectRel = nav_bb_rel; + } + if (!(item_flags & ImGuiItemFlags_NoNavDefaultFocus)) + { + g.NavInitRequest = false; // Found a match, clear request + NavUpdateAnyRequestFlag(); + } + } + + // Process Move Request (scoring for navigation) + // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRectScreen + scoring from a rect wrapped according to current wrapping policy) + if ((g.NavId != id || (g.NavMoveRequestFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & ImGuiItemFlags_NoNav)) + { + ImGuiNavMoveResult* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; +#if IMGUI_DEBUG_NAV_SCORING + // [DEBUG] Score all items in NavWindow at all times + if (!g.NavMoveRequest) + g.NavMoveDir = g.NavMoveDirLast; + bool new_best = NavScoreItem(result, nav_bb) && g.NavMoveRequest; +#else + bool new_best = g.NavMoveRequest && NavScoreItem(result, nav_bb); +#endif + if (new_best) + { + result->ID = id; + result->Window = window; + result->RectRel = nav_bb_rel; + } + + const float VISIBLE_RATIO = 0.70f; + if ((g.NavMoveRequestFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) + if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) + if (NavScoreItem(&g.NavMoveResultLocalVisibleSet, nav_bb)) + { + result = &g.NavMoveResultLocalVisibleSet; + result->ID = id; + result->Window = window; + result->RectRel = nav_bb_rel; + } + } + + // Update window-relative bounding box of navigated item + if (g.NavId == id) + { + g.NavWindow = window; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window. + g.NavLayer = window->DC.NavLayerCurrent; + g.NavIdIsAlive = true; + g.NavIdTabCounter = window->FocusIdxTabCounter; + window->NavRectRel[window->DC.NavLayerCurrent] = nav_bb_rel; // Store item bounding box (relative to window position) + } +} + +bool ImGui::NavMoveRequestButNoResultYet() +{ + ImGuiContext& g = *GImGui; + return g.NavMoveRequest && g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0; +} + +void ImGui::NavMoveRequestCancel() +{ + ImGuiContext& g = *GImGui; + g.NavMoveRequest = false; + NavUpdateAnyRequestFlag(); +} + +void ImGui::NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.NavMoveRequestForward == ImGuiNavForward_None); + ImGui::NavMoveRequestCancel(); + g.NavMoveDir = move_dir; + g.NavMoveClipDir = clip_dir; + g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued; + g.NavMoveRequestFlags = move_flags; + g.NavWindow->NavRectRel[g.NavLayer] = bb_rel; +} + +void ImGui::NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags) +{ + ImGuiContext& g = *GImGui; + if (g.NavWindow != window || !NavMoveRequestButNoResultYet() || g.NavMoveRequestForward != ImGuiNavForward_None || g.NavLayer != 0) + return; + IM_ASSERT(move_flags != 0); // No points calling this with no wrapping + ImRect bb_rel = window->NavRectRel[0]; + + ImGuiDir clip_dir = g.NavMoveDir; + if (g.NavMoveDir == ImGuiDir_Left && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX))) + { + bb_rel.Min.x = bb_rel.Max.x = ImMax(window->SizeFull.x, window->SizeContents.x) - window->Scroll.x; + if (move_flags & ImGuiNavMoveFlags_WrapX) { bb_rel.TranslateY(-bb_rel.GetHeight()); clip_dir = ImGuiDir_Up; } + NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags); + } + if (g.NavMoveDir == ImGuiDir_Right && (move_flags & (ImGuiNavMoveFlags_WrapX | ImGuiNavMoveFlags_LoopX))) + { + bb_rel.Min.x = bb_rel.Max.x = -window->Scroll.x; + if (move_flags & ImGuiNavMoveFlags_WrapX) { bb_rel.TranslateY(+bb_rel.GetHeight()); clip_dir = ImGuiDir_Down; } + NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags); + } + if (g.NavMoveDir == ImGuiDir_Up && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY))) + { + bb_rel.Min.y = bb_rel.Max.y = ImMax(window->SizeFull.y, window->SizeContents.y) - window->Scroll.y; + if (move_flags & ImGuiNavMoveFlags_WrapY) { bb_rel.TranslateX(-bb_rel.GetWidth()); clip_dir = ImGuiDir_Left; } + NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags); + } + if (g.NavMoveDir == ImGuiDir_Down && (move_flags & (ImGuiNavMoveFlags_WrapY | ImGuiNavMoveFlags_LoopY))) + { + bb_rel.Min.y = bb_rel.Max.y = -window->Scroll.y; + if (move_flags & ImGuiNavMoveFlags_WrapY) { bb_rel.TranslateX(+bb_rel.GetWidth()); clip_dir = ImGuiDir_Right; } + NavMoveRequestForward(g.NavMoveDir, clip_dir, bb_rel, move_flags); + } +} + +static void ImGui::NavSaveLastChildNavWindow(ImGuiWindow* nav_window) +{ + ImGuiWindow* parent_window = nav_window; + while (parent_window && (parent_window->Flags & ImGuiWindowFlags_ChildWindow) != 0 && (parent_window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0) + parent_window = parent_window->ParentWindow; + if (parent_window && parent_window != nav_window) + parent_window->NavLastChildNavWindow = nav_window; +} + +// Call when we are expected to land on Layer 0 after FocusWindow() +static ImGuiWindow* ImGui::NavRestoreLastChildNavWindow(ImGuiWindow* window) +{ + return window->NavLastChildNavWindow ? window->NavLastChildNavWindow : window; +} + +static void NavRestoreLayer(int layer) +{ + ImGuiContext& g = *GImGui; + g.NavLayer = layer; + if (layer == 0) + g.NavWindow = ImGui::NavRestoreLastChildNavWindow(g.NavWindow); + if (layer == 0 && g.NavWindow->NavLastIds[0] != 0) + ImGui::SetNavIDWithRectRel(g.NavWindow->NavLastIds[0], layer, g.NavWindow->NavRectRel[0]); + else + ImGui::NavInitWindow(g.NavWindow, true); +} + +static inline void ImGui::NavUpdateAnyRequestFlag() +{ + ImGuiContext& g = *GImGui; + g.NavAnyRequest = g.NavMoveRequest || g.NavInitRequest || (IMGUI_DEBUG_NAV_SCORING && g.NavWindow != NULL); + if (g.NavAnyRequest) + IM_ASSERT(g.NavWindow != NULL); +} + +// This needs to be called before we submit any widget (aka in or before Begin) +void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(window == g.NavWindow); + bool init_for_nav = false; + if (!(window->Flags & ImGuiWindowFlags_NoNavInputs)) + if (!(window->Flags & ImGuiWindowFlags_ChildWindow) || (window->Flags & ImGuiWindowFlags_Popup) || (window->NavLastIds[0] == 0) || force_reinit) + init_for_nav = true; + if (init_for_nav) + { + SetNavID(0, g.NavLayer); + g.NavInitRequest = true; + g.NavInitRequestFromMove = false; + g.NavInitResultId = 0; + g.NavInitResultRectRel = ImRect(); + NavUpdateAnyRequestFlag(); + } + else + { + g.NavId = window->NavLastIds[0]; + } +} + +static ImVec2 ImGui::NavCalcPreferredRefPos() +{ + ImGuiContext& g = *GImGui; + if (g.NavDisableHighlight || !g.NavDisableMouseHover || !g.NavWindow) + { + // Mouse (we need a fallback in case the mouse becomes invalid after being used) + if (IsMousePosValid(&g.IO.MousePos)) + return g.IO.MousePos; + return g.LastValidMousePos; + } + else + { + // When navigation is active and mouse is disabled, decide on an arbitrary position around the bottom left of the currently navigated item. + const ImRect& rect_rel = g.NavWindow->NavRectRel[g.NavLayer]; + ImVec2 pos = g.NavWindow->Pos + ImVec2(rect_rel.Min.x + ImMin(g.Style.FramePadding.x * 4, rect_rel.GetWidth()), rect_rel.Max.y - ImMin(g.Style.FramePadding.y, rect_rel.GetHeight())); + ImRect visible_rect = GetViewportRect(); + return ImFloor(ImClamp(pos, visible_rect.Min, visible_rect.Max)); // ImFloor() is important because non-integer mouse position application in back-end might be lossy and result in undesirable non-zero delta. + } +} + +float ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode) +{ + ImGuiContext& g = *GImGui; + if (mode == ImGuiInputReadMode_Down) + return g.IO.NavInputs[n]; // Instant, read analog input (0.0f..1.0f, as provided by user) + + const float t = g.IO.NavInputsDownDuration[n]; + if (t < 0.0f && mode == ImGuiInputReadMode_Released) // Return 1.0f when just released, no repeat, ignore analog input. + return (g.IO.NavInputsDownDurationPrev[n] >= 0.0f ? 1.0f : 0.0f); + if (t < 0.0f) + return 0.0f; + if (mode == ImGuiInputReadMode_Pressed) // Return 1.0f when just pressed, no repeat, ignore analog input. + return (t == 0.0f) ? 1.0f : 0.0f; + if (mode == ImGuiInputReadMode_Repeat) + return (float)CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, g.IO.KeyRepeatDelay * 0.80f, g.IO.KeyRepeatRate * 0.80f); + if (mode == ImGuiInputReadMode_RepeatSlow) + return (float)CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, g.IO.KeyRepeatDelay * 1.00f, g.IO.KeyRepeatRate * 2.00f); + if (mode == ImGuiInputReadMode_RepeatFast) + return (float)CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, g.IO.KeyRepeatDelay * 0.80f, g.IO.KeyRepeatRate * 0.30f); + return 0.0f; +} + +ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor, float fast_factor) +{ + ImVec2 delta(0.0f, 0.0f); + if (dir_sources & ImGuiNavDirSourceFlags_Keyboard) + delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight_, mode) - GetNavInputAmount(ImGuiNavInput_KeyLeft_, mode), GetNavInputAmount(ImGuiNavInput_KeyDown_, mode) - GetNavInputAmount(ImGuiNavInput_KeyUp_, mode)); + if (dir_sources & ImGuiNavDirSourceFlags_PadDPad) + delta += ImVec2(GetNavInputAmount(ImGuiNavInput_DpadRight, mode) - GetNavInputAmount(ImGuiNavInput_DpadLeft, mode), GetNavInputAmount(ImGuiNavInput_DpadDown, mode) - GetNavInputAmount(ImGuiNavInput_DpadUp, mode)); + if (dir_sources & ImGuiNavDirSourceFlags_PadLStick) + delta += ImVec2(GetNavInputAmount(ImGuiNavInput_LStickRight, mode) - GetNavInputAmount(ImGuiNavInput_LStickLeft, mode), GetNavInputAmount(ImGuiNavInput_LStickDown, mode) - GetNavInputAmount(ImGuiNavInput_LStickUp, mode)); + if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakSlow)) + delta *= slow_factor; + if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakFast)) + delta *= fast_factor; + return delta; +} + +// Scroll to keep newly navigated item fully into view +// NB: We modify rect_rel by the amount we scrolled for, so it is immediately updated. +static void NavScrollToBringItemIntoView(ImGuiWindow* window, const ImRect& item_rect) +{ + ImRect window_rect(window->InnerMainRect.Min - ImVec2(1, 1), window->InnerMainRect.Max + ImVec2(1, 1)); + //g.OverlayDrawList.AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG] + if (window_rect.Contains(item_rect)) + return; + + ImGuiContext& g = *GImGui; + if (window->ScrollbarX && item_rect.Min.x < window_rect.Min.x) + { + window->ScrollTarget.x = item_rect.Min.x - window->Pos.x + window->Scroll.x - g.Style.ItemSpacing.x; + window->ScrollTargetCenterRatio.x = 0.0f; + } + else if (window->ScrollbarX && item_rect.Max.x >= window_rect.Max.x) + { + window->ScrollTarget.x = item_rect.Max.x - window->Pos.x + window->Scroll.x + g.Style.ItemSpacing.x; + window->ScrollTargetCenterRatio.x = 1.0f; + } + if (item_rect.Min.y < window_rect.Min.y) + { + window->ScrollTarget.y = item_rect.Min.y - window->Pos.y + window->Scroll.y - g.Style.ItemSpacing.y; + window->ScrollTargetCenterRatio.y = 0.0f; + } + else if (item_rect.Max.y >= window_rect.Max.y) + { + window->ScrollTarget.y = item_rect.Max.y - window->Pos.y + window->Scroll.y + g.Style.ItemSpacing.y; + window->ScrollTargetCenterRatio.y = 1.0f; + } +} + +static void ImGui::NavUpdate() +{ + ImGuiContext& g = *GImGui; + g.IO.WantSetMousePos = false; +#if 0 + if (g.NavScoringCount > 0) printf("[%05d] NavScoringCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.FrameCount, g.NavScoringCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest); +#endif + + // Set input source as Gamepad when buttons are pressed before we map Keyboard (some features differs when used with Gamepad vs Keyboard) + bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + if (nav_gamepad_active) + if (g.IO.NavInputs[ImGuiNavInput_Activate] > 0.0f || g.IO.NavInputs[ImGuiNavInput_Input] > 0.0f || g.IO.NavInputs[ImGuiNavInput_Cancel] > 0.0f || g.IO.NavInputs[ImGuiNavInput_Menu] > 0.0f) + g.NavInputSource = ImGuiInputSource_NavGamepad; + + // Update Keyboard->Nav inputs mapping + if (nav_keyboard_active) + { + #define NAV_MAP_KEY(_KEY, _NAV_INPUT) if (IsKeyDown(g.IO.KeyMap[_KEY])) { g.IO.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_NavKeyboard; } + NAV_MAP_KEY(ImGuiKey_Space, ImGuiNavInput_Activate ); + NAV_MAP_KEY(ImGuiKey_Enter, ImGuiNavInput_Input ); + NAV_MAP_KEY(ImGuiKey_Escape, ImGuiNavInput_Cancel ); + NAV_MAP_KEY(ImGuiKey_LeftArrow, ImGuiNavInput_KeyLeft_ ); + NAV_MAP_KEY(ImGuiKey_RightArrow,ImGuiNavInput_KeyRight_); + NAV_MAP_KEY(ImGuiKey_UpArrow, ImGuiNavInput_KeyUp_ ); + NAV_MAP_KEY(ImGuiKey_DownArrow, ImGuiNavInput_KeyDown_ ); + if (g.IO.KeyCtrl) g.IO.NavInputs[ImGuiNavInput_TweakSlow] = 1.0f; + if (g.IO.KeyShift) g.IO.NavInputs[ImGuiNavInput_TweakFast] = 1.0f; + if (g.IO.KeyAlt) g.IO.NavInputs[ImGuiNavInput_KeyMenu_] = 1.0f; + #undef NAV_MAP_KEY + } + memcpy(g.IO.NavInputsDownDurationPrev, g.IO.NavInputsDownDuration, sizeof(g.IO.NavInputsDownDuration)); + for (int i = 0; i < IM_ARRAYSIZE(g.IO.NavInputs); i++) + g.IO.NavInputsDownDuration[i] = (g.IO.NavInputs[i] > 0.0f) ? (g.IO.NavInputsDownDuration[i] < 0.0f ? 0.0f : g.IO.NavInputsDownDuration[i] + g.IO.DeltaTime) : -1.0f; + + // Process navigation init request (select first/default focus) + if (g.NavInitResultId != 0 && (!g.NavDisableHighlight || g.NavInitRequestFromMove)) + { + // Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called) + IM_ASSERT(g.NavWindow); + if (g.NavInitRequestFromMove) + SetNavIDWithRectRel(g.NavInitResultId, g.NavLayer, g.NavInitResultRectRel); + else + SetNavID(g.NavInitResultId, g.NavLayer); + g.NavWindow->NavRectRel[g.NavLayer] = g.NavInitResultRectRel; + } + g.NavInitRequest = false; + g.NavInitRequestFromMove = false; + g.NavInitResultId = 0; + g.NavJustMovedToId = 0; + + // Process navigation move request + if (g.NavMoveRequest) + NavUpdateMoveResult(); + + // When a forwarded move request failed, we restore the highlight that we disabled during the forward frame + if (g.NavMoveRequestForward == ImGuiNavForward_ForwardActive) + { + IM_ASSERT(g.NavMoveRequest); + if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0) + g.NavDisableHighlight = false; + g.NavMoveRequestForward = ImGuiNavForward_None; + } + + // Apply application mouse position movement, after we had a chance to process move request result. + if (g.NavMousePosDirty && g.NavIdIsAlive) + { + // Set mouse position given our knowledge of the navigated item position from last frame + if ((g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) && (g.IO.BackendFlags & ImGuiBackendFlags_HasSetMousePos)) + { + if (!g.NavDisableHighlight && g.NavDisableMouseHover && g.NavWindow) + { + g.IO.MousePos = g.IO.MousePosPrev = NavCalcPreferredRefPos(); + g.IO.WantSetMousePos = true; + } + } + g.NavMousePosDirty = false; + } + g.NavIdIsAlive = false; + g.NavJustTabbedId = 0; + IM_ASSERT(g.NavLayer == 0 || g.NavLayer == 1); + + // Store our return window (for returning from Layer 1 to Layer 0) and clear it as soon as we step back in our own Layer 0 + if (g.NavWindow) + NavSaveLastChildNavWindow(g.NavWindow); + if (g.NavWindow && g.NavWindow->NavLastChildNavWindow != NULL && g.NavLayer == 0) + g.NavWindow->NavLastChildNavWindow = NULL; + + // Update CTRL+TAB and Windowing features (hold Square to move/resize/etc.) + NavUpdateWindowing(); + + // Set output flags for user application + g.IO.NavActive = (nav_keyboard_active || nav_gamepad_active) && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs); + g.IO.NavVisible = (g.IO.NavActive && g.NavId != 0 && !g.NavDisableHighlight) || (g.NavWindowingTarget != NULL) || g.NavInitRequest; + + // Process NavCancel input (to close a popup, get back to parent, clear focus) + if (IsNavInputPressed(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed)) + { + if (g.ActiveId != 0) + { + ClearActiveID(); + } + else if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow) && !(g.NavWindow->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->ParentWindow) + { + // Exit child window + ImGuiWindow* child_window = g.NavWindow; + ImGuiWindow* parent_window = g.NavWindow->ParentWindow; + IM_ASSERT(child_window->ChildId != 0); + FocusWindow(parent_window); + SetNavID(child_window->ChildId, 0); + g.NavIdIsAlive = false; + if (g.NavDisableMouseHover) + g.NavMousePosDirty = true; + } + else if (g.OpenPopupStack.Size > 0) + { + // Close open popup/menu + if (!(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) + ClosePopupToLevel(g.OpenPopupStack.Size - 1); + } + else if (g.NavLayer != 0) + { + // Leave the "menu" layer + NavRestoreLayer(0); + } + else + { + // Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were + if (g.NavWindow && ((g.NavWindow->Flags & ImGuiWindowFlags_Popup) || !(g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow))) + g.NavWindow->NavLastIds[0] = 0; + g.NavId = 0; + } + } + + // Process manual activation request + g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavInputId = 0; + if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) + { + bool activate_down = IsNavInputDown(ImGuiNavInput_Activate); + bool activate_pressed = activate_down && IsNavInputPressed(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed); + if (g.ActiveId == 0 && activate_pressed) + g.NavActivateId = g.NavId; + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down) + g.NavActivateDownId = g.NavId; + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed) + g.NavActivatePressedId = g.NavId; + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && IsNavInputPressed(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed)) + g.NavInputId = g.NavId; + } + if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) + g.NavDisableHighlight = true; + if (g.NavActivateId != 0) + IM_ASSERT(g.NavActivateDownId == g.NavActivateId); + g.NavMoveRequest = false; + + // Process programmatic activation request + if (g.NavNextActivateId != 0) + g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavInputId = g.NavNextActivateId; + g.NavNextActivateId = 0; + + // Initiate directional inputs request + const int allowed_dir_flags = (g.ActiveId == 0) ? ~0 : g.ActiveIdAllowNavDirFlags; + if (g.NavMoveRequestForward == ImGuiNavForward_None) + { + g.NavMoveDir = ImGuiDir_None; + g.NavMoveRequestFlags = 0; + if (g.NavWindow && !g.NavWindowingTarget && allowed_dir_flags && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) + { + if ((allowed_dir_flags & (1<Flags & ImGuiWindowFlags_NoNavInputs) && !g.NavWindowingTarget) + { + // *Fallback* manual-scroll with Nav directional keys when window has no navigable item + ImGuiWindow* window = g.NavWindow; + const float scroll_speed = ImFloor(window->CalcFontSize() * 100 * g.IO.DeltaTime + 0.5f); // We need round the scrolling speed because sub-pixel scroll isn't reliably supported. + if (window->DC.NavLayerActiveMask == 0x00 && window->DC.NavHasScroll && g.NavMoveRequest) + { + if (g.NavMoveDir == ImGuiDir_Left || g.NavMoveDir == ImGuiDir_Right) + SetWindowScrollX(window, ImFloor(window->Scroll.x + ((g.NavMoveDir == ImGuiDir_Left) ? -1.0f : +1.0f) * scroll_speed)); + if (g.NavMoveDir == ImGuiDir_Up || g.NavMoveDir == ImGuiDir_Down) + SetWindowScrollY(window, ImFloor(window->Scroll.y + ((g.NavMoveDir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed)); + } + + // *Normal* Manual scroll with NavScrollXXX keys + // Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds. + ImVec2 scroll_dir = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down, 1.0f/10.0f, 10.0f); + if (scroll_dir.x != 0.0f && window->ScrollbarX) + { + SetWindowScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed)); + g.NavMoveFromClampedRefRect = true; + } + if (scroll_dir.y != 0.0f) + { + SetWindowScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed)); + g.NavMoveFromClampedRefRect = true; + } + } + + // Reset search results + g.NavMoveResultLocal.Clear(); + g.NavMoveResultLocalVisibleSet.Clear(); + g.NavMoveResultOther.Clear(); + + // When we have manually scrolled (without using navigation) and NavId becomes out of bounds, we project its bounding box to the visible area to restart navigation within visible items + if (g.NavMoveRequest && g.NavMoveFromClampedRefRect && g.NavLayer == 0) + { + ImGuiWindow* window = g.NavWindow; + ImRect window_rect_rel(window->InnerMainRect.Min - window->Pos - ImVec2(1,1), window->InnerMainRect.Max - window->Pos + ImVec2(1,1)); + if (!window_rect_rel.Contains(window->NavRectRel[g.NavLayer])) + { + float pad = window->CalcFontSize() * 0.5f; + window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(), pad), -ImMin(window_rect_rel.GetHeight(), pad))); // Terrible approximation for the intent of starting navigation from first fully visible item + window->NavRectRel[g.NavLayer].ClipWith(window_rect_rel); + g.NavId = 0; + } + g.NavMoveFromClampedRefRect = false; + } + + // For scoring we use a single segment on the left side our current item bounding box (not touching the edge to avoid box overlap with zero-spaced items) + ImRect nav_rect_rel = (g.NavWindow && !g.NavWindow->NavRectRel[g.NavLayer].IsInverted()) ? g.NavWindow->NavRectRel[g.NavLayer] : ImRect(0,0,0,0); + g.NavScoringRectScreen = g.NavWindow ? ImRect(g.NavWindow->Pos + nav_rect_rel.Min, g.NavWindow->Pos + nav_rect_rel.Max) : GetViewportRect(); + g.NavScoringRectScreen.TranslateY(nav_scoring_rect_offset_y); + g.NavScoringRectScreen.Min.x = ImMin(g.NavScoringRectScreen.Min.x + 1.0f, g.NavScoringRectScreen.Max.x); + g.NavScoringRectScreen.Max.x = g.NavScoringRectScreen.Min.x; + IM_ASSERT(!g.NavScoringRectScreen.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem(). + //g.OverlayDrawList.AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG] + g.NavScoringCount = 0; +#if IMGUI_DEBUG_NAV_RECTS + if (g.NavWindow) { for (int layer = 0; layer < 2; layer++) GetOverlayDrawList(g.NavWindow)->AddRect(g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Min, g.NavWindow->Pos + g.NavWindow->NavRectRel[layer].Max, IM_COL32(255,200,0,255)); } // [DEBUG] + if (g.NavWindow) { ImU32 col = (!g.NavWindow->Hidden) ? IM_COL32(255,0,255,255) : IM_COL32(255,0,0,255); ImVec2 p = NavCalcPreferredRefPos(); char buf[32]; ImFormatString(buf, 32, "%d", g.NavLayer); GetOverlayDrawList(g.NavWindow)->AddCircleFilled(p, 3.0f, col); GetOverlayDrawList(g.NavWindow)->AddText(NULL, 13.0f, p + ImVec2(8,-4), col, buf); } +#endif +} + +// Apply result from previous frame navigation directional move request +static void ImGui::NavUpdateMoveResult() +{ + ImGuiContext& g = *GImGui; + if (g.NavMoveResultLocal.ID == 0 && g.NavMoveResultOther.ID == 0) + { + // In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) + if (g.NavId != 0) + { + g.NavDisableHighlight = false; + g.NavDisableMouseHover = true; + } + return; + } + + // Select which result to use + ImGuiNavMoveResult* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; + + // PageUp/PageDown behavior first jumps to the bottom/top mostly visible item, _otherwise_ use the result from the previous/next page. + if (g.NavMoveRequestFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) + if (g.NavMoveResultLocalVisibleSet.ID != 0 && g.NavMoveResultLocalVisibleSet.ID != g.NavId) + result = &g.NavMoveResultLocalVisibleSet; + + // Maybe entering a flattened child from the outside? In this case solve the tie using the regular scoring rules. + if (result != &g.NavMoveResultOther && g.NavMoveResultOther.ID != 0 && g.NavMoveResultOther.Window->ParentWindow == g.NavWindow) + if ((g.NavMoveResultOther.DistBox < result->DistBox) || (g.NavMoveResultOther.DistBox == result->DistBox && g.NavMoveResultOther.DistCenter < result->DistCenter)) + result = &g.NavMoveResultOther; + IM_ASSERT(g.NavWindow && result->Window); + + // Scroll to keep newly navigated item fully into view. + if (g.NavLayer == 0) + { + ImRect rect_abs = ImRect(result->RectRel.Min + result->Window->Pos, result->RectRel.Max + result->Window->Pos); + NavScrollToBringItemIntoView(result->Window, rect_abs); + + // Estimate upcoming scroll so we can offset our result position so mouse position can be applied immediately after in NavUpdate() + ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(result->Window, false); + ImVec2 delta_scroll = result->Window->Scroll - next_scroll; + result->RectRel.Translate(delta_scroll); + + // Also scroll parent window to keep us into view if necessary (we could/should technically recurse back the whole the parent hierarchy). + if (result->Window->Flags & ImGuiWindowFlags_ChildWindow) + NavScrollToBringItemIntoView(result->Window->ParentWindow, ImRect(rect_abs.Min + delta_scroll, rect_abs.Max + delta_scroll)); + } + + ClearActiveID(); + g.NavWindow = result->Window; + SetNavIDWithRectRel(result->ID, g.NavLayer, result->RectRel); + g.NavJustMovedToId = result->ID; + g.NavMoveFromClampedRefRect = false; +} + +static float ImGui::NavUpdatePageUpPageDown(int allowed_dir_flags) +{ + ImGuiContext& g = *GImGui; + if (g.NavMoveDir == ImGuiDir_None && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs) && !g.NavWindowingTarget && g.NavLayer == 0) + { + ImGuiWindow* window = g.NavWindow; + bool page_up_held = IsKeyDown(g.IO.KeyMap[ImGuiKey_PageUp]) && (allowed_dir_flags & (1 << ImGuiDir_Up)); + bool page_down_held = IsKeyDown(g.IO.KeyMap[ImGuiKey_PageDown]) && (allowed_dir_flags & (1 << ImGuiDir_Down)); + if ((page_up_held && !page_down_held) || (page_down_held && !page_up_held)) + { + if (window->DC.NavLayerActiveMask == 0x00 && window->DC.NavHasScroll) + { + // Fallback manual-scroll when window has no navigable item + if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true)) + SetWindowScrollY(window, window->Scroll.y - window->InnerClipRect.GetHeight()); + else if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageDown], true)) + SetWindowScrollY(window, window->Scroll.y + window->InnerClipRect.GetHeight()); + } + else + { + const ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer]; + const float page_offset_y = ImMax(0.0f, window->InnerClipRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight()); + float nav_scoring_rect_offset_y = 0.0f; + if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageUp], true)) + { + nav_scoring_rect_offset_y = -page_offset_y; + g.NavMoveDir = ImGuiDir_Down; // Because our scoring rect is offset, we intentionally request the opposite direction (so we can always land on the last item) + g.NavMoveClipDir = ImGuiDir_Up; + g.NavMoveRequestFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet; + } + else if (IsKeyPressed(g.IO.KeyMap[ImGuiKey_PageDown], true)) + { + nav_scoring_rect_offset_y = +page_offset_y; + g.NavMoveDir = ImGuiDir_Up; // Because our scoring rect is offset, we intentionally request the opposite direction (so we can always land on the last item) + g.NavMoveClipDir = ImGuiDir_Down; + g.NavMoveRequestFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet; + } + return nav_scoring_rect_offset_y; + } + } + } + return 0.0f; +} + +static int FindWindowFocusIndex(ImGuiWindow* window) // FIXME-OPT O(N) +{ + ImGuiContext& g = *GImGui; + for (int i = g.WindowsFocusOrder.Size-1; i >= 0; i--) + if (g.WindowsFocusOrder[i] == window) + return i; + return -1; +} + +static ImGuiWindow* FindWindowNavFocusable(int i_start, int i_stop, int dir) // FIXME-OPT O(N) +{ + ImGuiContext& g = *GImGui; + for (int i = i_start; i >= 0 && i < g.WindowsFocusOrder.Size && i != i_stop; i += dir) + if (ImGui::IsWindowNavFocusable(g.WindowsFocusOrder[i])) + return g.WindowsFocusOrder[i]; + return NULL; +} + +static void NavUpdateWindowingHighlightWindow(int focus_change_dir) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.NavWindowingTarget); + if (g.NavWindowingTarget->Flags & ImGuiWindowFlags_Modal) + return; + + const int i_current = FindWindowFocusIndex(g.NavWindowingTarget); + ImGuiWindow* window_target = FindWindowNavFocusable(i_current + focus_change_dir, -INT_MAX, focus_change_dir); + if (!window_target) + window_target = FindWindowNavFocusable((focus_change_dir < 0) ? (g.WindowsFocusOrder.Size - 1) : 0, i_current, focus_change_dir); + if (window_target) // Don't reset windowing target if there's a single window in the list + g.NavWindowingTarget = g.NavWindowingTargetAnim = window_target; + g.NavWindowingToggleLayer = false; +} + +// Window management mode (hold to: change focus/move/resize, tap to: toggle menu layer) +static void ImGui::NavUpdateWindowing() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* apply_focus_window = NULL; + bool apply_toggle_layer = false; + + ImGuiWindow* modal_window = GetFrontMostPopupModal(); + if (modal_window != NULL) + { + g.NavWindowingTarget = NULL; + return; + } + + // Fade out + if (g.NavWindowingTargetAnim && g.NavWindowingTarget == NULL) + { + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha - g.IO.DeltaTime * 10.0f, 0.0f); + if (g.DimBgRatio <= 0.0f && g.NavWindowingHighlightAlpha <= 0.0f) + g.NavWindowingTargetAnim = NULL; + } + + // Start CTRL-TAB or Square+L/R window selection + bool start_windowing_with_gamepad = !g.NavWindowingTarget && IsNavInputPressed(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed); + bool start_windowing_with_keyboard = !g.NavWindowingTarget && g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab) && (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard); + if (start_windowing_with_gamepad || start_windowing_with_keyboard) + if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1)) + { + g.NavWindowingTarget = g.NavWindowingTargetAnim = window; + g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f; + g.NavWindowingToggleLayer = start_windowing_with_keyboard ? false : true; + g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_NavKeyboard : ImGuiInputSource_NavGamepad; + } + + // Gamepad update + g.NavWindowingTimer += g.IO.DeltaTime; + if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_NavGamepad) + { + // Highlight only appears after a brief time holding the button, so that a fast tap on PadMenu (to toggle NavLayer) doesn't add visual noise + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); + + // Select window to focus + const int focus_change_dir = (int)IsNavInputPressed(ImGuiNavInput_FocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputPressed(ImGuiNavInput_FocusNext, ImGuiInputReadMode_RepeatSlow); + if (focus_change_dir != 0) + { + NavUpdateWindowingHighlightWindow(focus_change_dir); + g.NavWindowingHighlightAlpha = 1.0f; + } + + // Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered front-most) + if (!IsNavInputDown(ImGuiNavInput_Menu)) + { + g.NavWindowingToggleLayer &= (g.NavWindowingHighlightAlpha < 1.0f); // Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore. + if (g.NavWindowingToggleLayer && g.NavWindow) + apply_toggle_layer = true; + else if (!g.NavWindowingToggleLayer) + apply_focus_window = g.NavWindowingTarget; + g.NavWindowingTarget = NULL; + } + } + + // Keyboard: Focus + if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_NavKeyboard) + { + // Visuals only appears after a brief time after pressing TAB the first time, so that a fast CTRL+TAB doesn't add visual noise + g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); // 1.0f + if (IsKeyPressedMap(ImGuiKey_Tab, true)) + NavUpdateWindowingHighlightWindow(g.IO.KeyShift ? +1 : -1); + if (!g.IO.KeyCtrl) + apply_focus_window = g.NavWindowingTarget; + } + + // Keyboard: Press and Release ALT to toggle menu layer + // FIXME: We lack an explicit IO variable for "is the imgui window focused", so compare mouse validity to detect the common case of back-end clearing releases all keys on ALT-TAB + if ((g.ActiveId == 0 || g.ActiveIdAllowOverlap) && IsNavInputPressed(ImGuiNavInput_KeyMenu_, ImGuiInputReadMode_Released)) + if (IsMousePosValid(&g.IO.MousePos) == IsMousePosValid(&g.IO.MousePosPrev)) + apply_toggle_layer = true; + + // Move window + if (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoMove)) + { + ImVec2 move_delta; + if (g.NavInputSource == ImGuiInputSource_NavKeyboard && !g.IO.KeyShift) + move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard, ImGuiInputReadMode_Down); + if (g.NavInputSource == ImGuiInputSource_NavGamepad) + move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down); + if (move_delta.x != 0.0f || move_delta.y != 0.0f) + { + const float NAV_MOVE_SPEED = 800.0f; + const float move_speed = ImFloor(NAV_MOVE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y)); // FIXME: Doesn't code variable framerate very well + g.NavWindowingTarget->RootWindow->Pos += move_delta * move_speed; + g.NavDisableMouseHover = true; + MarkIniSettingsDirty(g.NavWindowingTarget); + } + } + + // Apply final focus + if (apply_focus_window && (g.NavWindow == NULL || apply_focus_window != g.NavWindow->RootWindow)) + { + g.NavDisableHighlight = false; + g.NavDisableMouseHover = true; + apply_focus_window = NavRestoreLastChildNavWindow(apply_focus_window); + ClosePopupsOverWindow(apply_focus_window); + FocusWindow(apply_focus_window); + if (apply_focus_window->NavLastIds[0] == 0) + NavInitWindow(apply_focus_window, false); + + // If the window only has a menu layer, select it directly + if (apply_focus_window->DC.NavLayerActiveMask == (1 << 1)) + g.NavLayer = 1; + } + if (apply_focus_window) + g.NavWindowingTarget = NULL; + + // Apply menu/layer toggle + if (apply_toggle_layer && g.NavWindow) + { + // Move to parent menu if necessary + ImGuiWindow* new_nav_window = g.NavWindow; + while ((new_nav_window->DC.NavLayerActiveMask & (1 << 1)) == 0 && (new_nav_window->Flags & ImGuiWindowFlags_ChildWindow) != 0 && (new_nav_window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) == 0) + new_nav_window = new_nav_window->ParentWindow; + if (new_nav_window != g.NavWindow) + { + ImGuiWindow* old_nav_window = g.NavWindow; + FocusWindow(new_nav_window); + new_nav_window->NavLastChildNavWindow = old_nav_window; + } + g.NavDisableHighlight = false; + g.NavDisableMouseHover = true; + NavRestoreLayer((g.NavWindow->DC.NavLayerActiveMask & (1 << 1)) ? (g.NavLayer ^ 1) : 0); + } +} + +// Window has already passed the IsWindowNavFocusable() +static const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window) +{ + if (window->Flags & ImGuiWindowFlags_Popup) + return "(Popup)"; + if ((window->Flags & ImGuiWindowFlags_MenuBar) && strcmp(window->Name, "##MainMenuBar") == 0) + return "(Main menu bar)"; + return "(Untitled)"; +} + +// Overlay displayed when using CTRL+TAB. Called by EndFrame(). +void ImGui::NavUpdateWindowingList() +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.NavWindowingTarget != NULL); + + if (g.NavWindowingTimer < NAV_WINDOWING_LIST_APPEAR_DELAY) + return; + + if (g.NavWindowingList == NULL) + g.NavWindowingList = FindWindowByName("###NavWindowingList"); + SetNextWindowSizeConstraints(ImVec2(g.IO.DisplaySize.x * 0.20f, g.IO.DisplaySize.y * 0.20f), ImVec2(FLT_MAX, FLT_MAX)); + SetNextWindowPos(g.IO.DisplaySize * 0.5f, ImGuiCond_Always, ImVec2(0.5f, 0.5f)); + PushStyleVar(ImGuiStyleVar_WindowPadding, g.Style.WindowPadding * 2.0f); + Begin("###NavWindowingList", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings); + for (int n = g.WindowsFocusOrder.Size - 1; n >= 0; n--) + { + ImGuiWindow* window = g.WindowsFocusOrder[n]; + if (!IsWindowNavFocusable(window)) + continue; + const char* label = window->Name; + if (label == FindRenderedTextEnd(label)) + label = GetFallbackWindowNameForWindowingList(window); + Selectable(label, g.NavWindowingTarget == window); + } + End(); + PopStyleVar(); +} + +//----------------------------------------------------------------------------- +// [SECTION] COLUMNS +// In the current version, Columns are very weak. Needs to be replaced with a more full-featured system. +//----------------------------------------------------------------------------- + +void ImGui::NextColumn() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems || window->DC.ColumnsSet == NULL) + return; + + ImGuiContext& g = *GImGui; + PopItemWidth(); + PopClipRect(); + + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y); + if (++columns->Current < columns->Count) + { + // Columns 1+ cancel out IndentX + window->DC.ColumnsOffset.x = GetColumnOffset(columns->Current) - window->DC.Indent.x + g.Style.ItemSpacing.x; + window->DrawList->ChannelsSetCurrent(columns->Current); + } + else + { + window->DC.ColumnsOffset.x = 0.0f; + window->DrawList->ChannelsSetCurrent(0); + columns->Current = 0; + columns->LineMinY = columns->LineMaxY; + } + window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); + window->DC.CursorPos.y = columns->LineMinY; + window->DC.CurrentLineSize = ImVec2(0.0f, 0.0f); + window->DC.CurrentLineTextBaseOffset = 0.0f; + + PushColumnClipRect(); + PushItemWidth(GetColumnWidth() * 0.65f); // FIXME: Move on columns setup +} + +int ImGui::GetColumnIndex() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.ColumnsSet ? window->DC.ColumnsSet->Current : 0; +} + +int ImGui::GetColumnsCount() +{ + ImGuiWindow* window = GetCurrentWindowRead(); + return window->DC.ColumnsSet ? window->DC.ColumnsSet->Count : 1; +} + +static float OffsetNormToPixels(const ImGuiColumnsSet* columns, float offset_norm) +{ + return offset_norm * (columns->MaxX - columns->MinX); +} + +static float PixelsToOffsetNorm(const ImGuiColumnsSet* columns, float offset) +{ + return offset / (columns->MaxX - columns->MinX); +} + +static inline float GetColumnsRectHalfWidth() { return 4.0f; } + +static float GetDraggedColumnOffset(ImGuiColumnsSet* columns, int column_index) +{ + // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing + // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning. + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + IM_ASSERT(column_index > 0); // We are not supposed to drag column 0. + IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index)); + + float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + GetColumnsRectHalfWidth() - window->Pos.x; + x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing); + if ((columns->Flags & ImGuiColumnsFlags_NoPreserveWidths)) + x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing); + + return x; +} + +float ImGui::GetColumnOffset(int column_index) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + IM_ASSERT(columns != NULL); + + if (column_index < 0) + column_index = columns->Current; + IM_ASSERT(column_index < columns->Columns.Size); + + const float t = columns->Columns[column_index].OffsetNorm; + const float x_offset = ImLerp(columns->MinX, columns->MaxX, t); + return x_offset; +} + +static float GetColumnWidthEx(ImGuiColumnsSet* columns, int column_index, bool before_resize = false) +{ + if (column_index < 0) + column_index = columns->Current; + + float offset_norm; + if (before_resize) + offset_norm = columns->Columns[column_index + 1].OffsetNormBeforeResize - columns->Columns[column_index].OffsetNormBeforeResize; + else + offset_norm = columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm; + return OffsetNormToPixels(columns, offset_norm); +} + +float ImGui::GetColumnWidth(int column_index) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + IM_ASSERT(columns != NULL); + + if (column_index < 0) + column_index = columns->Current; + return OffsetNormToPixels(columns, columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm); +} + +void ImGui::SetColumnOffset(int column_index, float offset) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + IM_ASSERT(columns != NULL); + + if (column_index < 0) + column_index = columns->Current; + IM_ASSERT(column_index < columns->Columns.Size); + + const bool preserve_width = !(columns->Flags & ImGuiColumnsFlags_NoPreserveWidths) && (column_index < columns->Count-1); + const float width = preserve_width ? GetColumnWidthEx(columns, column_index, columns->IsBeingResized) : 0.0f; + + if (!(columns->Flags & ImGuiColumnsFlags_NoForceWithinWindow)) + offset = ImMin(offset, columns->MaxX - g.Style.ColumnsMinSpacing * (columns->Count - column_index)); + columns->Columns[column_index].OffsetNorm = PixelsToOffsetNorm(columns, offset - columns->MinX); + + if (preserve_width) + SetColumnOffset(column_index + 1, offset + ImMax(g.Style.ColumnsMinSpacing, width)); +} + +void ImGui::SetColumnWidth(int column_index, float width) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + IM_ASSERT(columns != NULL); + + if (column_index < 0) + column_index = columns->Current; + SetColumnOffset(column_index + 1, GetColumnOffset(column_index) + width); +} + +void ImGui::PushColumnClipRect(int column_index) +{ + ImGuiWindow* window = GetCurrentWindowRead(); + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + if (column_index < 0) + column_index = columns->Current; + + PushClipRect(columns->Columns[column_index].ClipRect.Min, columns->Columns[column_index].ClipRect.Max, false); +} + +static ImGuiColumnsSet* FindOrAddColumnsSet(ImGuiWindow* window, ImGuiID id) +{ + for (int n = 0; n < window->ColumnsStorage.Size; n++) + if (window->ColumnsStorage[n].ID == id) + return &window->ColumnsStorage[n]; + + window->ColumnsStorage.push_back(ImGuiColumnsSet()); + ImGuiColumnsSet* columns = &window->ColumnsStorage.back(); + columns->ID = id; + return columns; +} + +void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + + IM_ASSERT(columns_count > 1); + IM_ASSERT(window->DC.ColumnsSet == NULL); // Nested columns are currently not supported + + // Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget. + // In addition, when an identifier isn't explicitly provided we include the number of columns in the hash to make it uniquer. + PushID(0x11223347 + (str_id ? 0 : columns_count)); + ImGuiID id = window->GetID(str_id ? str_id : "columns"); + PopID(); + + // Acquire storage for the columns set + ImGuiColumnsSet* columns = FindOrAddColumnsSet(window, id); + IM_ASSERT(columns->ID == id); + columns->Current = 0; + columns->Count = columns_count; + columns->Flags = flags; + window->DC.ColumnsSet = columns; + + // Set state for first column + const float content_region_width = (window->SizeContentsExplicit.x != 0.0f) ? (window->SizeContentsExplicit.x) : (window->InnerClipRect.Max.x - window->Pos.x); + columns->MinX = window->DC.Indent.x - g.Style.ItemSpacing.x; // Lock our horizontal range + columns->MaxX = ImMax(content_region_width - window->Scroll.x, columns->MinX + 1.0f); + columns->StartPosY = window->DC.CursorPos.y; + columns->StartMaxPosX = window->DC.CursorMaxPos.x; + columns->LineMinY = columns->LineMaxY = window->DC.CursorPos.y; + window->DC.ColumnsOffset.x = 0.0f; + window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); + + // Clear data if columns count changed + if (columns->Columns.Size != 0 && columns->Columns.Size != columns_count + 1) + columns->Columns.resize(0); + + // Initialize defaults + columns->IsFirstFrame = (columns->Columns.Size == 0); + if (columns->Columns.Size == 0) + { + columns->Columns.reserve(columns_count + 1); + for (int n = 0; n < columns_count + 1; n++) + { + ImGuiColumnData column; + column.OffsetNorm = n / (float)columns_count; + columns->Columns.push_back(column); + } + } + + for (int n = 0; n < columns_count; n++) + { + // Compute clipping rectangle + ImGuiColumnData* column = &columns->Columns[n]; + float clip_x1 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(n) - 1.0f); + float clip_x2 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(n + 1) - 1.0f); + column->ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX); + column->ClipRect.ClipWith(window->ClipRect); + } + + window->DrawList->ChannelsSplit(columns->Count); + PushColumnClipRect(); + PushItemWidth(GetColumnWidth() * 0.65f); +} + +void ImGui::EndColumns() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + ImGuiColumnsSet* columns = window->DC.ColumnsSet; + IM_ASSERT(columns != NULL); + + PopItemWidth(); + PopClipRect(); + window->DrawList->ChannelsMerge(); + + columns->LineMaxY = ImMax(columns->LineMaxY, window->DC.CursorPos.y); + window->DC.CursorPos.y = columns->LineMaxY; + if (!(columns->Flags & ImGuiColumnsFlags_GrowParentContentsSize)) + window->DC.CursorMaxPos.x = columns->StartMaxPosX; // Restore cursor max pos, as columns don't grow parent + + // Draw columns borders and handle resize + bool is_being_resized = false; + if (!(columns->Flags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems) + { + const float y1 = columns->StartPosY; + const float y2 = window->DC.CursorPos.y; + int dragging_column = -1; + for (int n = 1; n < columns->Count; n++) + { + float x = window->Pos.x + GetColumnOffset(n); + const ImGuiID column_id = columns->ID + ImGuiID(n); + const float column_hw = GetColumnsRectHalfWidth(); // Half-width for interaction + const ImRect column_rect(ImVec2(x - column_hw, y1), ImVec2(x + column_hw, y2)); + KeepAliveID(column_id); + if (IsClippedEx(column_rect, column_id, false)) + continue; + + bool hovered = false, held = false; + if (!(columns->Flags & ImGuiColumnsFlags_NoResize)) + { + ButtonBehavior(column_rect, column_id, &hovered, &held); + if (hovered || held) + g.MouseCursor = ImGuiMouseCursor_ResizeEW; + if (held && !(columns->Columns[n].Flags & ImGuiColumnsFlags_NoResize)) + dragging_column = n; + } + + // Draw column (we clip the Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.) + const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator); + const float xi = (float)(int)x; + window->DrawList->AddLine(ImVec2(xi, ImMax(y1 + 1.0f, window->ClipRect.Min.y)), ImVec2(xi, ImMin(y2, window->ClipRect.Max.y)), col); + } + + // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame. + if (dragging_column != -1) + { + if (!columns->IsBeingResized) + for (int n = 0; n < columns->Count + 1; n++) + columns->Columns[n].OffsetNormBeforeResize = columns->Columns[n].OffsetNorm; + columns->IsBeingResized = is_being_resized = true; + float x = GetDraggedColumnOffset(columns, dragging_column); + SetColumnOffset(dragging_column, x); + } + } + columns->IsBeingResized = is_being_resized; + + window->DC.ColumnsSet = NULL; + window->DC.ColumnsOffset.x = 0.0f; + window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); +} + +// [2018-03: This is currently the only public API, while we are working on making BeginColumns/EndColumns user-facing] +void ImGui::Columns(int columns_count, const char* id, bool border) +{ + ImGuiWindow* window = GetCurrentWindow(); + IM_ASSERT(columns_count >= 1); + + ImGuiColumnsFlags flags = (border ? 0 : ImGuiColumnsFlags_NoBorder); + //flags |= ImGuiColumnsFlags_NoPreserveWidths; // NB: Legacy behavior + if (window->DC.ColumnsSet != NULL && window->DC.ColumnsSet->Count == columns_count && window->DC.ColumnsSet->Flags == flags) + return; + + if (window->DC.ColumnsSet != NULL) + EndColumns(); + + if (columns_count != 1) + BeginColumns(id, columns_count, flags); +} + +//----------------------------------------------------------------------------- +// [SECTION] DRAG AND DROP +//----------------------------------------------------------------------------- + +void ImGui::ClearDragDrop() +{ + ImGuiContext& g = *GImGui; + g.DragDropActive = false; + g.DragDropPayload.Clear(); + g.DragDropAcceptFlags = 0; + g.DragDropAcceptIdCurr = g.DragDropAcceptIdPrev = 0; + g.DragDropAcceptIdCurrRectSurface = FLT_MAX; + g.DragDropAcceptFrameCount = -1; + + g.DragDropPayloadBufHeap.clear(); + memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal)); +} + +// Call when current ID is active. +// When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource() +bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + bool source_drag_active = false; + ImGuiID source_id = 0; + ImGuiID source_parent_id = 0; + int mouse_button = 0; + if (!(flags & ImGuiDragDropFlags_SourceExtern)) + { + source_id = window->DC.LastItemId; + if (source_id != 0 && g.ActiveId != source_id) // Early out for most common case + return false; + if (g.IO.MouseDown[mouse_button] == false) + return false; + + if (source_id == 0) + { + // If you want to use BeginDragDropSource() on an item with no unique identifier for interaction, such as Text() or Image(), you need to: + // A) Read the explanation below, B) Use the ImGuiDragDropFlags_SourceAllowNullID flag, C) Swallow your programmer pride. + if (!(flags & ImGuiDragDropFlags_SourceAllowNullID)) + { + IM_ASSERT(0); + return false; + } + + // Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image() + // We build a throwaway ID based on current ID stack + relative AABB of items in window. + // THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled. + // We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive. + bool is_hovered = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect) != 0; + if (!is_hovered && (g.ActiveId == 0 || g.ActiveIdWindow != window)) + return false; + source_id = window->DC.LastItemId = window->GetIDFromRectangle(window->DC.LastItemRect); + if (is_hovered) + SetHoveredID(source_id); + if (is_hovered && g.IO.MouseClicked[mouse_button]) + { + SetActiveID(source_id, window); + FocusWindow(window); + } + if (g.ActiveId == source_id) // Allow the underlying widget to display/return hovered during the mouse release frame, else we would get a flicker. + g.ActiveIdAllowOverlap = is_hovered; + } + else + { + g.ActiveIdAllowOverlap = false; + } + if (g.ActiveId != source_id) + return false; + source_parent_id = window->IDStack.back(); + source_drag_active = IsMouseDragging(mouse_button); + } + else + { + window = NULL; + source_id = ImHash("#SourceExtern", 0); + source_drag_active = true; + } + + if (source_drag_active) + { + if (!g.DragDropActive) + { + IM_ASSERT(source_id != 0); + ClearDragDrop(); + ImGuiPayload& payload = g.DragDropPayload; + payload.SourceId = source_id; + payload.SourceParentId = source_parent_id; + g.DragDropActive = true; + g.DragDropSourceFlags = flags; + g.DragDropMouseButton = mouse_button; + } + g.DragDropSourceFrameCount = g.FrameCount; + g.DragDropWithinSourceOrTarget = true; + + if (!(flags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) + { + // Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit) + // We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents. + BeginTooltip(); + if (g.DragDropActive && g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip)) + { + ImGuiWindow* tooltip_window = g.CurrentWindow; + tooltip_window->SkipItems = true; + tooltip_window->HiddenFramesRegular = 1; + } + } + + if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern)) + window->DC.LastItemStatusFlags &= ~ImGuiItemStatusFlags_HoveredRect; + + return true; + } + return false; +} + +void ImGui::EndDragDropSource() +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.DragDropActive); + IM_ASSERT(g.DragDropWithinSourceOrTarget && "Not after a BeginDragDropSource()?"); + + if (!(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) + EndTooltip(); + + // Discard the drag if have not called SetDragDropPayload() + if (g.DragDropPayload.DataFrameCount == -1) + ClearDragDrop(); + g.DragDropWithinSourceOrTarget = false; +} + +// Use 'cond' to choose to submit payload on drag start or every frame +bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_size, ImGuiCond cond) +{ + ImGuiContext& g = *GImGui; + ImGuiPayload& payload = g.DragDropPayload; + if (cond == 0) + cond = ImGuiCond_Always; + + IM_ASSERT(type != NULL); + IM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && "Payload type can be at most 32 characters long"); + IM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0)); + IM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once); + IM_ASSERT(payload.SourceId != 0); // Not called between BeginDragDropSource() and EndDragDropSource() + + if (cond == ImGuiCond_Always || payload.DataFrameCount == -1) + { + // Copy payload + ImStrncpy(payload.DataType, type, IM_ARRAYSIZE(payload.DataType)); + g.DragDropPayloadBufHeap.resize(0); + if (data_size > sizeof(g.DragDropPayloadBufLocal)) + { + // Store in heap + g.DragDropPayloadBufHeap.resize((int)data_size); + payload.Data = g.DragDropPayloadBufHeap.Data; + memcpy(payload.Data, data, data_size); + } + else if (data_size > 0) + { + // Store locally + memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal)); + payload.Data = g.DragDropPayloadBufLocal; + memcpy(payload.Data, data, data_size); + } + else + { + payload.Data = NULL; + } + payload.DataSize = (int)data_size; + } + payload.DataFrameCount = g.FrameCount; + + return (g.DragDropAcceptFrameCount == g.FrameCount) || (g.DragDropAcceptFrameCount == g.FrameCount - 1); +} + +bool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id) +{ + ImGuiContext& g = *GImGui; + if (!g.DragDropActive) + return false; + + ImGuiWindow* window = g.CurrentWindow; + if (g.HoveredWindow == NULL || window->RootWindow != g.HoveredWindow->RootWindow) + return false; + IM_ASSERT(id != 0); + if (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId)) + return false; + if (window->SkipItems) + return false; + + IM_ASSERT(g.DragDropWithinSourceOrTarget == false); + g.DragDropTargetRect = bb; + g.DragDropTargetId = id; + g.DragDropWithinSourceOrTarget = true; + return true; +} + +// We don't use BeginDragDropTargetCustom() and duplicate its code because: +// 1) we use LastItemRectHoveredRect which handles items that pushes a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them. +// 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can. +// Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case) +bool ImGui::BeginDragDropTarget() +{ + ImGuiContext& g = *GImGui; + if (!g.DragDropActive) + return false; + + ImGuiWindow* window = g.CurrentWindow; + if (!(window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect)) + return false; + if (g.HoveredWindow == NULL || window->RootWindow != g.HoveredWindow->RootWindow) + return false; + + const ImRect& display_rect = (window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect) ? window->DC.LastItemDisplayRect : window->DC.LastItemRect; + ImGuiID id = window->DC.LastItemId; + if (id == 0) + id = window->GetIDFromRectangle(display_rect); + if (g.DragDropPayload.SourceId == id) + return false; + + IM_ASSERT(g.DragDropWithinSourceOrTarget == false); + g.DragDropTargetRect = display_rect; + g.DragDropTargetId = id; + g.DragDropWithinSourceOrTarget = true; + return true; +} + +bool ImGui::IsDragDropPayloadBeingAccepted() +{ + ImGuiContext& g = *GImGui; + return g.DragDropActive && g.DragDropAcceptIdPrev != 0; +} + +const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImGuiPayload& payload = g.DragDropPayload; + IM_ASSERT(g.DragDropActive); // Not called between BeginDragDropTarget() and EndDragDropTarget() ? + IM_ASSERT(payload.DataFrameCount != -1); // Forgot to call EndDragDropTarget() ? + if (type != NULL && !payload.IsDataType(type)) + return NULL; + + // Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints. + // NB: We currently accept NULL id as target. However, overlapping targets requires a unique ID to function! + const bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId); + ImRect r = g.DragDropTargetRect; + float r_surface = r.GetWidth() * r.GetHeight(); + if (r_surface < g.DragDropAcceptIdCurrRectSurface) + { + g.DragDropAcceptFlags = flags; + g.DragDropAcceptIdCurr = g.DragDropTargetId; + g.DragDropAcceptIdCurrRectSurface = r_surface; + } + + // Render default drop visuals + payload.Preview = was_accepted_previously; + flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame) + if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview) + { + // FIXME-DRAG: Settle on a proper default visuals for drop target. + r.Expand(3.5f); + bool push_clip_rect = !window->ClipRect.Contains(r); + if (push_clip_rect) window->DrawList->PushClipRect(r.Min-ImVec2(1,1), r.Max+ImVec2(1,1)); + window->DrawList->AddRect(r.Min, r.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, ~0, 2.0f); + if (push_clip_rect) window->DrawList->PopClipRect(); + } + + g.DragDropAcceptFrameCount = g.FrameCount; + payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased() + if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery)) + return NULL; + + return &payload; +} + +const ImGuiPayload* ImGui::GetDragDropPayload() +{ + ImGuiContext& g = *GImGui; + return g.DragDropActive ? &g.DragDropPayload : NULL; +} + +// We don't really use/need this now, but added it for the sake of consistency and because we might need it later. +void ImGui::EndDragDropTarget() +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.DragDropActive); + IM_ASSERT(g.DragDropWithinSourceOrTarget); + g.DragDropWithinSourceOrTarget = false; +} + +//----------------------------------------------------------------------------- +// [SECTION] LOGGING/CAPTURING +//----------------------------------------------------------------------------- + +// Pass text data straight to log (without being displayed) +void ImGui::LogText(const char* fmt, ...) +{ + ImGuiContext& g = *GImGui; + if (!g.LogEnabled) + return; + + va_list args; + va_start(args, fmt); + if (g.LogFile) + vfprintf(g.LogFile, fmt, args); + else + g.LogClipboard.appendfv(fmt, args); + va_end(args); +} + +// Internal version that takes a position to decide on newline placement and pad items according to their depth. +// We split text into individual lines to add current tree level padding +void ImGui::LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + if (!text_end) + text_end = FindRenderedTextEnd(text, text_end); + + const bool log_new_line = ref_pos && (ref_pos->y > window->DC.LogLinePosY + 1); + if (ref_pos) + window->DC.LogLinePosY = ref_pos->y; + + const char* text_remaining = text; + if (g.LogStartDepth > window->DC.TreeDepth) // Re-adjust padding if we have popped out of our starting depth + g.LogStartDepth = window->DC.TreeDepth; + const int tree_depth = (window->DC.TreeDepth - g.LogStartDepth); + for (;;) + { + // Split the string. Each new line (after a '\n') is followed by spacing corresponding to the current depth of our log entry. + const char* line_start = text_remaining; + const char* line_end = ImStreolRange(line_start, text_end); + const bool is_first_line = (line_start == text); + const bool is_last_line = (line_end == text_end); + if (!is_last_line || (line_start != line_end)) + { + const int char_count = (int)(line_end - line_start); + if (log_new_line || !is_first_line) + LogText(IM_NEWLINE "%*s%.*s", tree_depth*4, "", char_count, line_start); + else + LogText(" %.*s", char_count, line_start); + } + + if (is_last_line) + break; + text_remaining = line_end + 1; + } +} + +// Start logging ImGui output to TTY +void ImGui::LogToTTY(int max_depth) +{ + ImGuiContext& g = *GImGui; + if (g.LogEnabled) + return; + ImGuiWindow* window = g.CurrentWindow; + + IM_ASSERT(g.LogFile == NULL); + g.LogFile = stdout; + g.LogEnabled = true; + g.LogStartDepth = window->DC.TreeDepth; + if (max_depth >= 0) + g.LogAutoExpandMaxDepth = max_depth; +} + +// Start logging ImGui output to given file +void ImGui::LogToFile(int max_depth, const char* filename) +{ + ImGuiContext& g = *GImGui; + if (g.LogEnabled) + return; + ImGuiWindow* window = g.CurrentWindow; + + if (!filename) + { + filename = g.IO.LogFilename; + if (!filename) + return; + } + + IM_ASSERT(g.LogFile == NULL); + g.LogFile = ImFileOpen(filename, "ab"); + if (!g.LogFile) + { + IM_ASSERT(g.LogFile != NULL); // Consider this an error + return; + } + g.LogEnabled = true; + g.LogStartDepth = window->DC.TreeDepth; + if (max_depth >= 0) + g.LogAutoExpandMaxDepth = max_depth; +} + +// Start logging ImGui output to clipboard +void ImGui::LogToClipboard(int max_depth) +{ + ImGuiContext& g = *GImGui; + if (g.LogEnabled) + return; + ImGuiWindow* window = g.CurrentWindow; + + IM_ASSERT(g.LogFile == NULL); + g.LogFile = NULL; + g.LogEnabled = true; + g.LogStartDepth = window->DC.TreeDepth; + if (max_depth >= 0) + g.LogAutoExpandMaxDepth = max_depth; +} + +void ImGui::LogFinish() +{ + ImGuiContext& g = *GImGui; + if (!g.LogEnabled) + return; + + LogText(IM_NEWLINE); + if (g.LogFile != NULL) + { + if (g.LogFile == stdout) + fflush(g.LogFile); + else + fclose(g.LogFile); + g.LogFile = NULL; + } + if (g.LogClipboard.size() > 1) + { + SetClipboardText(g.LogClipboard.begin()); + g.LogClipboard.clear(); + } + g.LogEnabled = false; +} + +// Helper to display logging buttons +void ImGui::LogButtons() +{ + ImGuiContext& g = *GImGui; + + PushID("LogButtons"); + const bool log_to_tty = Button("Log To TTY"); SameLine(); + const bool log_to_file = Button("Log To File"); SameLine(); + const bool log_to_clipboard = Button("Log To Clipboard"); SameLine(); + PushItemWidth(80.0f); + PushAllowKeyboardFocus(false); + SliderInt("Depth", &g.LogAutoExpandMaxDepth, 0, 9, NULL); + PopAllowKeyboardFocus(); + PopItemWidth(); + PopID(); + + // Start logging at the end of the function so that the buttons don't appear in the log + if (log_to_tty) + LogToTTY(g.LogAutoExpandMaxDepth); + if (log_to_file) + LogToFile(g.LogAutoExpandMaxDepth, g.IO.LogFilename); + if (log_to_clipboard) + LogToClipboard(g.LogAutoExpandMaxDepth); +} + +//----------------------------------------------------------------------------- +// [SECTION] SETTINGS +//----------------------------------------------------------------------------- + +void ImGui::MarkIniSettingsDirty() +{ + ImGuiContext& g = *GImGui; + if (g.SettingsDirtyTimer <= 0.0f) + g.SettingsDirtyTimer = g.IO.IniSavingRate; +} + +void ImGui::MarkIniSettingsDirty(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings)) + if (g.SettingsDirtyTimer <= 0.0f) + g.SettingsDirtyTimer = g.IO.IniSavingRate; +} + +ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name) +{ + ImGuiContext& g = *GImGui; + g.SettingsWindows.push_back(ImGuiWindowSettings()); + ImGuiWindowSettings* settings = &g.SettingsWindows.back(); + settings->Name = ImStrdup(name); + settings->ID = ImHash(name, 0); + return settings; +} + +ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + for (int i = 0; i != g.SettingsWindows.Size; i++) + if (g.SettingsWindows[i].ID == id) + return &g.SettingsWindows[i]; + return NULL; +} + +void ImGui::LoadIniSettingsFromDisk(const char* ini_filename) +{ + size_t file_data_size = 0; + char* file_data = (char*)ImFileLoadToMemory(ini_filename, "rb", &file_data_size); + if (!file_data) + return; + LoadIniSettingsFromMemory(file_data, (size_t)file_data_size); + ImGui::MemFree(file_data); +} + +ImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name) +{ + ImGuiContext& g = *GImGui; + const ImGuiID type_hash = ImHash(type_name, 0, 0); + for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) + if (g.SettingsHandlers[handler_n].TypeHash == type_hash) + return &g.SettingsHandlers[handler_n]; + return NULL; +} + +// Zero-tolerance, no error reporting, cheap .ini parsing +void ImGui::LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.Initialized); + IM_ASSERT(g.SettingsLoaded == false && g.FrameCount == 0); + + // For user convenience, we allow passing a non zero-terminated string (hence the ini_size parameter). + // For our convenience and to make the code simpler, we'll also write zero-terminators within the buffer. So let's create a writable copy.. + if (ini_size == 0) + ini_size = strlen(ini_data); + char* buf = (char*)ImGui::MemAlloc(ini_size + 1); + char* buf_end = buf + ini_size; + memcpy(buf, ini_data, ini_size); + buf[ini_size] = 0; + + void* entry_data = NULL; + ImGuiSettingsHandler* entry_handler = NULL; + + char* line_end = NULL; + for (char* line = buf; line < buf_end; line = line_end + 1) + { + // Skip new lines markers, then find end of the line + while (*line == '\n' || *line == '\r') + line++; + line_end = line; + while (line_end < buf_end && *line_end != '\n' && *line_end != '\r') + line_end++; + line_end[0] = 0; + if (line[0] == ';') + continue; + if (line[0] == '[' && line_end > line && line_end[-1] == ']') + { + // Parse "[Type][Name]". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code. + line_end[-1] = 0; + const char* name_end = line_end - 1; + const char* type_start = line + 1; + char* type_end = (char*)(intptr_t)ImStrchrRange(type_start, name_end, ']'); + const char* name_start = type_end ? ImStrchrRange(type_end + 1, name_end, '[') : NULL; + if (!type_end || !name_start) + { + name_start = type_start; // Import legacy entries that have no type + type_start = "Window"; + } + else + { + *type_end = 0; // Overwrite first ']' + name_start++; // Skip second '[' + } + entry_handler = FindSettingsHandler(type_start); + entry_data = entry_handler ? entry_handler->ReadOpenFn(&g, entry_handler, name_start) : NULL; + } + else if (entry_handler != NULL && entry_data != NULL) + { + // Let type handler parse the line + entry_handler->ReadLineFn(&g, entry_handler, entry_data, line); + } + } + ImGui::MemFree(buf); + g.SettingsLoaded = true; +} + +void ImGui::SaveIniSettingsToDisk(const char* ini_filename) +{ + ImGuiContext& g = *GImGui; + g.SettingsDirtyTimer = 0.0f; + if (!ini_filename) + return; + + size_t ini_data_size = 0; + const char* ini_data = SaveIniSettingsToMemory(&ini_data_size); + FILE* f = ImFileOpen(ini_filename, "wt"); + if (!f) + return; + fwrite(ini_data, sizeof(char), ini_data_size, f); + fclose(f); +} + +// Call registered handlers (e.g. SettingsHandlerWindow_WriteAll() + custom handlers) to write their stuff into a text buffer +const char* ImGui::SaveIniSettingsToMemory(size_t* out_size) +{ + ImGuiContext& g = *GImGui; + g.SettingsDirtyTimer = 0.0f; + g.SettingsIniData.Buf.resize(0); + g.SettingsIniData.Buf.push_back(0); + for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) + { + ImGuiSettingsHandler* handler = &g.SettingsHandlers[handler_n]; + handler->WriteAllFn(&g, handler, &g.SettingsIniData); + } + if (out_size) + *out_size = (size_t)g.SettingsIniData.size(); + return g.SettingsIniData.c_str(); +} + +static void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name) +{ + ImGuiWindowSettings* settings = ImGui::FindWindowSettings(ImHash(name, 0)); + if (!settings) + settings = ImGui::CreateNewWindowSettings(name); + return (void*)settings; +} + +static void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line) +{ + ImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry; + float x, y; + int i; + if (sscanf(line, "Pos=%f,%f", &x, &y) == 2) settings->Pos = ImVec2(x, y); + else if (sscanf(line, "Size=%f,%f", &x, &y) == 2) settings->Size = ImMax(ImVec2(x, y), GImGui->Style.WindowMinSize); + else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0); +} + +static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf) +{ + // Gather data from windows that were active during this session + // (if a window wasn't opened in this session we preserve its settings) + ImGuiContext& g = *imgui_ctx; + for (int i = 0; i != g.Windows.Size; i++) + { + ImGuiWindow* window = g.Windows[i]; + if (window->Flags & ImGuiWindowFlags_NoSavedSettings) + continue; + + ImGuiWindowSettings* settings = (window->SettingsIdx != -1) ? &g.SettingsWindows[window->SettingsIdx] : ImGui::FindWindowSettings(window->ID); + if (!settings) + { + settings = ImGui::CreateNewWindowSettings(window->Name); + window->SettingsIdx = g.SettingsWindows.index_from_pointer(settings); + } + IM_ASSERT(settings->ID == window->ID); + settings->Pos = window->Pos; + settings->Size = window->SizeFull; + settings->Collapsed = window->Collapsed; + } + + // Write to text buffer + buf->reserve(buf->size() + g.SettingsWindows.Size * 96); // ballpark reserve + for (int i = 0; i != g.SettingsWindows.Size; i++) + { + const ImGuiWindowSettings* settings = &g.SettingsWindows[i]; + if (settings->Pos.x == FLT_MAX) + continue; + const char* name = settings->Name; + if (const char* p = strstr(name, "###")) // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() + name = p; + buf->appendf("[%s][%s]\n", handler->TypeName, name); + buf->appendf("Pos=%d,%d\n", (int)settings->Pos.x, (int)settings->Pos.y); + buf->appendf("Size=%d,%d\n", (int)settings->Size.x, (int)settings->Size.y); + buf->appendf("Collapsed=%d\n", settings->Collapsed); + buf->appendf("\n"); + } +} + +//----------------------------------------------------------------------------- +// [SECTION] PLATFORM DEPENDENT HELPERS +//----------------------------------------------------------------------------- + +#if defined(_WIN32) && !defined(_WINDOWS_) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#ifndef __MINGW32__ +#include +#else +#include +#endif +#endif + +// Win32 API clipboard implementation +#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_FUNCTIONS) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) + +#ifdef _MSC_VER +#pragma comment(lib, "user32") +#endif + +static const char* GetClipboardTextFn_DefaultImpl(void*) +{ + static ImVector buf_local; + buf_local.clear(); + if (!::OpenClipboard(NULL)) + return NULL; + HANDLE wbuf_handle = ::GetClipboardData(CF_UNICODETEXT); + if (wbuf_handle == NULL) + { + ::CloseClipboard(); + return NULL; + } + if (ImWchar* wbuf_global = (ImWchar*)::GlobalLock(wbuf_handle)) + { + int buf_len = ImTextCountUtf8BytesFromStr(wbuf_global, NULL) + 1; + buf_local.resize(buf_len); + ImTextStrToUtf8(buf_local.Data, buf_len, wbuf_global, NULL); + } + ::GlobalUnlock(wbuf_handle); + ::CloseClipboard(); + return buf_local.Data; +} + +static void SetClipboardTextFn_DefaultImpl(void*, const char* text) +{ + if (!::OpenClipboard(NULL)) + return; + const int wbuf_length = ImTextCountCharsFromUtf8(text, NULL) + 1; + HGLOBAL wbuf_handle = ::GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length * sizeof(ImWchar)); + if (wbuf_handle == NULL) + { + ::CloseClipboard(); + return; + } + ImWchar* wbuf_global = (ImWchar*)::GlobalLock(wbuf_handle); + ImTextStrFromUtf8(wbuf_global, wbuf_length, text, NULL); + ::GlobalUnlock(wbuf_handle); + ::EmptyClipboard(); + if (::SetClipboardData(CF_UNICODETEXT, wbuf_handle) == NULL) + ::GlobalFree(wbuf_handle); + ::CloseClipboard(); +} + +#else + +// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers +static const char* GetClipboardTextFn_DefaultImpl(void*) +{ + ImGuiContext& g = *GImGui; + return g.PrivateClipboard.empty() ? NULL : g.PrivateClipboard.begin(); +} + +// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers +static void SetClipboardTextFn_DefaultImpl(void*, const char* text) +{ + ImGuiContext& g = *GImGui; + g.PrivateClipboard.clear(); + const char* text_end = text + strlen(text); + g.PrivateClipboard.resize((int)(text_end - text) + 1); + memcpy(&g.PrivateClipboard[0], text, (size_t)(text_end - text)); + g.PrivateClipboard[(int)(text_end - text)] = 0; +} + +#endif + +// Win32 API IME support (for Asian languages, etc.) +#if defined(_WIN32) && !defined(__GNUC__) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) + +#include +#ifdef _MSC_VER +#pragma comment(lib, "imm32") +#endif + +static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y) +{ + // Notify OS Input Method Editor of text input position + if (HWND hwnd = (HWND)GImGui->IO.ImeWindowHandle) + if (HIMC himc = ::ImmGetContext(hwnd)) + { + COMPOSITIONFORM cf; + cf.ptCurrentPos.x = x; + cf.ptCurrentPos.y = y; + cf.dwStyle = CFS_FORCE_POSITION; + ::ImmSetCompositionWindow(himc, &cf); + ::ImmReleaseContext(hwnd, himc); + } +} + +#else + +static void ImeSetInputScreenPosFn_DefaultImpl(int, int) {} + +#endif + +//----------------------------------------------------------------------------- +// [SECTION] METRICS/DEBUG WINDOW +//----------------------------------------------------------------------------- + +void ImGui::ShowMetricsWindow(bool* p_open) +{ + if (!ImGui::Begin("ImGui Metrics", p_open)) + { + ImGui::End(); + return; + } + static bool show_draw_cmd_clip_rects = true; + static bool show_window_begin_order = false; + ImGuiIO& io = ImGui::GetIO(); + ImGui::Text("Dear ImGui %s", ImGui::GetVersion()); + ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); + ImGui::Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3); + ImGui::Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows); + ImGui::Text("%d allocations", io.MetricsActiveAllocations); + ImGui::Checkbox("Show clipping rectangles when hovering draw commands", &show_draw_cmd_clip_rects); + ImGui::Checkbox("Ctrl shows window begin order", &show_window_begin_order); + + ImGui::Separator(); + + struct Funcs + { + static void NodeDrawList(ImGuiWindow* window, ImDrawList* draw_list, const char* label) + { + bool node_open = ImGui::TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, draw_list->CmdBuffer.Size); + if (draw_list == ImGui::GetWindowDrawList()) + { + ImGui::SameLine(); + ImGui::TextColored(ImColor(255,100,100), "CURRENTLY APPENDING"); // Can't display stats for active draw list! (we don't have the data double-buffered) + if (node_open) ImGui::TreePop(); + return; + } + + ImDrawList* overlay_draw_list = GetOverlayDrawList(window); // Render additional visuals into the top-most draw list + if (window && IsItemHovered()) + overlay_draw_list->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255)); + if (!node_open) + return; + + int elem_offset = 0; + for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.begin(); pcmd < draw_list->CmdBuffer.end(); elem_offset += pcmd->ElemCount, pcmd++) + { + if (pcmd->UserCallback == NULL && pcmd->ElemCount == 0) + continue; + if (pcmd->UserCallback) + { + ImGui::BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData); + continue; + } + ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL; + bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %4d %s vtx, tex 0x%p, clip_rect (%4.0f,%4.0f)-(%4.0f,%4.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w); + if (show_draw_cmd_clip_rects && ImGui::IsItemHovered()) + { + ImRect clip_rect = pcmd->ClipRect; + ImRect vtxs_rect; + for (int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++) + vtxs_rect.Add(draw_list->VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos); + clip_rect.Floor(); overlay_draw_list->AddRect(clip_rect.Min, clip_rect.Max, IM_COL32(255,255,0,255)); + vtxs_rect.Floor(); overlay_draw_list->AddRect(vtxs_rect.Min, vtxs_rect.Max, IM_COL32(255,0,255,255)); + } + if (!pcmd_node_open) + continue; + + // Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted. + ImGuiListClipper clipper(pcmd->ElemCount/3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible. + while (clipper.Step()) + for (int prim = clipper.DisplayStart, vtx_i = elem_offset + clipper.DisplayStart*3; prim < clipper.DisplayEnd; prim++) + { + char buf[300]; + char *buf_p = buf, *buf_end = buf + IM_ARRAYSIZE(buf); + ImVec2 triangles_pos[3]; + for (int n = 0; n < 3; n++, vtx_i++) + { + ImDrawVert& v = draw_list->VtxBuffer[idx_buffer ? idx_buffer[vtx_i] : vtx_i]; + triangles_pos[n] = v.pos; + buf_p += ImFormatString(buf_p, (int)(buf_end - buf_p), "%s %04d: pos (%8.2f,%8.2f), uv (%.6f,%.6f), col %08X\n", (n == 0) ? "vtx" : " ", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col); + } + ImGui::Selectable(buf, false); + if (ImGui::IsItemHovered()) + { + ImDrawListFlags backup_flags = overlay_draw_list->Flags; + overlay_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines at is more readable for very large and thin triangles. + overlay_draw_list->AddPolyline(triangles_pos, 3, IM_COL32(255,255,0,255), true, 1.0f); + overlay_draw_list->Flags = backup_flags; + } + } + ImGui::TreePop(); + } + ImGui::TreePop(); + } + + static void NodeWindows(ImVector& windows, const char* label) + { + if (!ImGui::TreeNode(label, "%s (%d)", label, windows.Size)) + return; + for (int i = 0; i < windows.Size; i++) + Funcs::NodeWindow(windows[i], "Window"); + ImGui::TreePop(); + } + + static void NodeWindow(ImGuiWindow* window, const char* label) + { + if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window)) + return; + ImGuiWindowFlags flags = window->Flags; + NodeDrawList(window, window->DrawList, "DrawList"); + ImGui::BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y); + ImGui::BulletText("Flags: 0x%08X (%s%s%s%s%s%s%s%s%s..)", flags, + (flags & ImGuiWindowFlags_ChildWindow) ? "Child " : "", (flags & ImGuiWindowFlags_Tooltip) ? "Tooltip " : "", (flags & ImGuiWindowFlags_Popup) ? "Popup " : "", + (flags & ImGuiWindowFlags_Modal) ? "Modal " : "", (flags & ImGuiWindowFlags_ChildMenu) ? "ChildMenu " : "", (flags & ImGuiWindowFlags_NoSavedSettings) ? "NoSavedSettings " : "", + (flags & ImGuiWindowFlags_NoMouseInputs)? "NoMouseInputs":"", (flags & ImGuiWindowFlags_NoNavInputs) ? "NoNavInputs" : "", (flags & ImGuiWindowFlags_AlwaysAutoResize) ? "AlwaysAutoResize" : ""); + ImGui::BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f)", window->Scroll.x, GetWindowScrollMaxX(window), window->Scroll.y, GetWindowScrollMaxY(window)); + ImGui::BulletText("Active: %d/%d, WriteAccessed: %d, BeginOrderWithinContext: %d", window->Active, window->WasActive, window->WriteAccessed, (window->Active || window->WasActive) ? window->BeginOrderWithinContext : -1); + ImGui::BulletText("Appearing: %d, Hidden: %d (Reg %d Resize %d), SkipItems: %d", window->Appearing, window->Hidden, window->HiddenFramesRegular, window->HiddenFramesForResize, window->SkipItems); + ImGui::BulletText("NavLastIds: 0x%08X,0x%08X, NavLayerActiveMask: %X", window->NavLastIds[0], window->NavLastIds[1], window->DC.NavLayerActiveMask); + ImGui::BulletText("NavLastChildNavWindow: %s", window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : "NULL"); + if (!window->NavRectRel[0].IsInverted()) + ImGui::BulletText("NavRectRel[0]: (%.1f,%.1f)(%.1f,%.1f)", window->NavRectRel[0].Min.x, window->NavRectRel[0].Min.y, window->NavRectRel[0].Max.x, window->NavRectRel[0].Max.y); + else + ImGui::BulletText("NavRectRel[0]: "); + if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); + if (window->ParentWindow != NULL) NodeWindow(window->ParentWindow, "ParentWindow"); + if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows"); + if (window->ColumnsStorage.Size > 0 && ImGui::TreeNode("Columns", "Columns sets (%d)", window->ColumnsStorage.Size)) + { + for (int n = 0; n < window->ColumnsStorage.Size; n++) + { + const ImGuiColumnsSet* columns = &window->ColumnsStorage[n]; + if (ImGui::TreeNode((void*)(uintptr_t)columns->ID, "Columns Id: 0x%08X, Count: %d, Flags: 0x%04X", columns->ID, columns->Count, columns->Flags)) + { + ImGui::BulletText("Width: %.1f (MinX: %.1f, MaxX: %.1f)", columns->MaxX - columns->MinX, columns->MinX, columns->MaxX); + for (int column_n = 0; column_n < columns->Columns.Size; column_n++) + ImGui::BulletText("Column %02d: OffsetNorm %.3f (= %.1f px)", column_n, columns->Columns[column_n].OffsetNorm, OffsetNormToPixels(columns, columns->Columns[column_n].OffsetNorm)); + ImGui::TreePop(); + } + } + ImGui::TreePop(); + } + ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair)); + ImGui::TreePop(); + } + }; + + // Access private state, we are going to display the draw lists from last frame + ImGuiContext& g = *GImGui; + Funcs::NodeWindows(g.Windows, "Windows"); + if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.DrawDataBuilder.Layers[0].Size)) + { + for (int i = 0; i < g.DrawDataBuilder.Layers[0].Size; i++) + Funcs::NodeDrawList(NULL, g.DrawDataBuilder.Layers[0][i], "DrawList"); + ImGui::TreePop(); + } + if (ImGui::TreeNode("Popups", "Popups (%d)", g.OpenPopupStack.Size)) + { + for (int i = 0; i < g.OpenPopupStack.Size; i++) + { + ImGuiWindow* window = g.OpenPopupStack[i].Window; + ImGui::BulletText("PopupID: %08x, Window: '%s'%s%s", g.OpenPopupStack[i].PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? " ChildWindow" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? " ChildMenu" : ""); + } + ImGui::TreePop(); + } + if (ImGui::TreeNode("Internal state")) + { + const char* input_source_names[] = { "None", "Mouse", "Nav", "NavKeyboard", "NavGamepad" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT); + ImGui::Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL"); + ImGui::Text("HoveredRootWindow: '%s'", g.HoveredRootWindow ? g.HoveredRootWindow->Name : "NULL"); + ImGui::Text("HoveredId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not + ImGui::Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]); + ImGui::Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL"); + ImGui::Text("MovingWindow: '%s'", g.MovingWindow ? g.MovingWindow->Name : "NULL"); + ImGui::Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL"); + ImGui::Text("NavId: 0x%08X, NavLayer: %d", g.NavId, g.NavLayer); + ImGui::Text("NavInputSource: %s", input_source_names[g.NavInputSource]); + ImGui::Text("NavActive: %d, NavVisible: %d", g.IO.NavActive, g.IO.NavVisible); + ImGui::Text("NavActivateId: 0x%08X, NavInputId: 0x%08X", g.NavActivateId, g.NavInputId); + ImGui::Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover); + ImGui::Text("NavWindowingTarget: '%s'", g.NavWindowingTarget ? g.NavWindowingTarget->Name : "NULL"); + ImGui::Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize); + ImGui::TreePop(); + } + + + if (g.IO.KeyCtrl && show_window_begin_order) + { + for (int n = 0; n < g.Windows.Size; n++) + { + ImGuiWindow* window = g.Windows[n]; + if ((window->Flags & ImGuiWindowFlags_ChildWindow) || !window->WasActive) + continue; + char buf[32]; + ImFormatString(buf, IM_ARRAYSIZE(buf), "%d", window->BeginOrderWithinContext); + float font_size = ImGui::GetFontSize() * 2; + ImDrawList* overlay_draw_list = GetOverlayDrawList(window); + overlay_draw_list->AddRectFilled(window->Pos, window->Pos + ImVec2(font_size, font_size), IM_COL32(200, 100, 100, 255)); + overlay_draw_list->AddText(NULL, font_size, window->Pos, IM_COL32(255, 255, 255, 255), buf); + } + } + ImGui::End(); +} + +//----------------------------------------------------------------------------- + +// Include imgui_user.inl at the end of imgui.cpp to access private data/functions that aren't exposed. +// Prefer just including imgui_internal.h from your code rather than using this define. If a declaration is missing from imgui_internal.h add it or request it on the github. +#ifdef IMGUI_INCLUDE_IMGUI_USER_INL +#include "imgui_user.inl" +#endif + +//----------------------------------------------------------------------------- diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/imgui.h b/3rdparty/bgfx/3rdparty/dear-imgui/imgui.h new file mode 100644 index 00000000000..5c04146f9d6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imgui.h @@ -0,0 +1,2051 @@ +// dear imgui, v1.67 WIP +// (headers) + +// See imgui.cpp file for documentation. +// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code. +// Read 'Programmer guide' in imgui.cpp for notes on how to setup ImGui in your codebase. +// Get latest version at https://github.com/ocornut/imgui + +/* + +Index of this file: +// Header mess +// Forward declarations and basic types +// ImGui API (Dear ImGui end-user API) +// Flags & Enumerations +// ImGuiStyle +// ImGuiIO +// Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload) +// Obsolete functions +// Helpers (ImVector, ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) +// Draw List API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListFlags, ImDrawList, ImDrawData) +// Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFont) + +*/ + +#pragma once + +// Configuration file (edit imconfig.h or define IMGUI_USER_CONFIG to your own filename) +#ifdef IMGUI_USER_CONFIG +#include IMGUI_USER_CONFIG +#endif +#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) +#include "imconfig.h" +#endif + +//----------------------------------------------------------------------------- +// Header mess +//----------------------------------------------------------------------------- + +#include // FLT_MAX +#include // va_list +#include // ptrdiff_t, NULL +#include // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp + +// Version +// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens) +#define IMGUI_VERSION "1.66b" +#define IMGUI_VERSION_NUM 16602 +#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert)) + +// Define attributes of all API symbols declarations (e.g. for DLL under Windows) +// IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default bindings files (imgui_impl_xxx.h) +#ifndef IMGUI_API +#define IMGUI_API +#endif +#ifndef IMGUI_IMPL_API +#define IMGUI_IMPL_API IMGUI_API +#endif + +// Helper Macros +#ifndef IM_ASSERT +#include +#define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h +#endif + +#if 0 // defined(__clang__) || defined(__GNUC__) +#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) // Apply printf-style warnings to user functions. +#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) +#else +#define IM_FMTARGS(FMT) +#define IM_FMTLIST(FMT) +#endif +#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) // Size of a static C-style array. Don't use on pointers! +#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in modern C++. + +// Warnings +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" +#elif defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" +#endif + +//----------------------------------------------------------------------------- +// Forward declarations and basic types +//----------------------------------------------------------------------------- + +struct ImDrawChannel; // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit() +struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call) +struct ImDrawData; // All draw command lists required to render the frame +struct ImDrawList; // A single draw command list (generally one per window, conceptually you may see this as a dynamic "mesh" builder) +struct ImDrawListSharedData; // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself) +struct ImDrawVert; // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) +struct ImFont; // Runtime data for a single font within a parent ImFontAtlas +struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader +struct ImFontConfig; // Configuration data when adding a font or merging fonts +struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4 (*obsolete* please avoid using) +#ifndef ImTextureID +typedef void* ImTextureID; // User data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp) +#endif +struct ImGuiContext; // ImGui context (opaque) +struct ImGuiIO; // Main configuration and I/O between your application and ImGui +struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use) +struct ImGuiListClipper; // Helper to manually clip large list of items +struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro +struct ImGuiPayload; // User data payload for drag and drop operations +struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use) +struct ImGuiStorage; // Helper for key->value storage +struct ImGuiStyle; // Runtime data for styling/colors +struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbb][,ccccc]") +struct ImGuiTextBuffer; // Helper to hold and append into a text buffer (~string builder) + +// Typedefs and Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file) +// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists. +typedef unsigned int ImGuiID; // Unique ID used by widgets (typically hashed from a stack of string) +typedef unsigned short ImWchar; // Character for keyboard input/display +typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling +typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for Set*() +typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type +typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction +typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier (ImGui-side enum) +typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation +typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier +typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling +typedef int ImDrawCornerFlags; // -> enum ImDrawCornerFlags_ // Flags: for ImDrawList::AddRect*() etc. +typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList +typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas +typedef int ImGuiBackendFlags; // -> enum ImGuiBackendFlags_ // Flags: for io.BackendFlags +typedef int ImGuiColorEditFlags; // -> enum ImGuiColorEditFlags_ // Flags: for ColorEdit*(), ColorPicker*() +typedef int ImGuiColumnsFlags; // -> enum ImGuiColumnsFlags_ // Flags: for Columns(), BeginColumns() +typedef int ImGuiConfigFlags; // -> enum ImGuiConfigFlags_ // Flags: for io.ConfigFlags +typedef int ImGuiComboFlags; // -> enum ImGuiComboFlags_ // Flags: for BeginCombo() +typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: for *DragDrop*() +typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused() +typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc. +typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText*() +typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable() +typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: for TreeNode*(),CollapsingHeader() +typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin*() +typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data); +typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); + +// Scalar data types +typedef signed int ImS32; // 32-bit signed integer == int +typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors) +#if defined(_MSC_VER) && !defined(__clang__) +typedef signed __int64 ImS64; // 64-bit signed integer (pre and post C++11 with Visual Studio) +typedef unsigned __int64 ImU64; // 64-bit unsigned integer (pre and post C++11 with Visual Studio) +#elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100) +#include +typedef int64_t ImS64; // 64-bit signed integer (pre C++11) +typedef uint64_t ImU64; // 64-bit unsigned integer (pre C++11) +#else +typedef signed long long ImS64; // 64-bit signed integer (post C++11) +typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11) +#endif + +// 2D vector (often used to store positions, sizes, etc.) +struct ImVec2 +{ + float x, y; + ImVec2() { x = y = 0.0f; } + ImVec2(float _x, float _y) { x = _x; y = _y; } + float operator[] (size_t i) const { IM_ASSERT(i <= 1); return (&x)[i]; } // We very rarely use this [] operator, the assert overhead is fine. +#ifdef IM_VEC2_CLASS_EXTRA + IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2. +#endif +}; + +// 4D vector (often used to store floating-point colors) +struct ImVec4 +{ + float x, y, z, w; + ImVec4() { x = y = z = w = 0.0f; } + ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } +#ifdef IM_VEC4_CLASS_EXTRA + IM_VEC4_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4. +#endif +}; + +//----------------------------------------------------------------------------- +// ImGui: Dear ImGui end-user API +// (Inside a namespace so you can add extra functions in your own separate file. Please don't modify imgui.cpp/.h!) +//----------------------------------------------------------------------------- + +namespace ImGui +{ + // Context creation and access + // Each context create its own ImFontAtlas by default. You may instance one yourself and pass it to CreateContext() to share a font atlas between imgui contexts. + // All those functions are not reliant on the current context. + IMGUI_API ImGuiContext* CreateContext(ImFontAtlas* shared_font_atlas = NULL); + IMGUI_API void DestroyContext(ImGuiContext* ctx = NULL); // NULL = destroy current context + IMGUI_API ImGuiContext* GetCurrentContext(); + IMGUI_API void SetCurrentContext(ImGuiContext* ctx); + IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert); + + // Main + IMGUI_API ImGuiIO& GetIO(); // access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags) + IMGUI_API ImGuiStyle& GetStyle(); // access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame. + IMGUI_API void NewFrame(); // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame(). + IMGUI_API void EndFrame(); // ends the ImGui frame. automatically called by Render(), you likely don't need to call that yourself directly. If you don't need to render data (skipping rendering) you may call EndFrame() but you'll have wasted CPU already! If you don't need to render, better to not create any imgui windows and not call NewFrame() at all! + IMGUI_API void Render(); // ends the ImGui frame, finalize the draw data. (Obsolete: optionally call io.RenderDrawListsFn if set. Nowadays, prefer calling your render function yourself.) + IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render. (Obsolete: this used to be passed to your io.RenderDrawListsFn() function.) + + // Demo, Debug, Information + IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! + IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create about window. display Dear ImGui version, credits and build/system information. + IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics window. display Dear ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc. + IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) + IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles. + IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts. + IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). + IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.23" + + // Styles + IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); // new, recommended style (default) + IMGUI_API void StyleColorsClassic(ImGuiStyle* dst = NULL); // classic imgui style + IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); // best used with borders and a custom, thicker font + + // Windows + // - Begin() = push window to the stack and start appending to it. End() = pop window from the stack. + // - You may append multiple times to the same window during the same frame. + // - Passing 'bool* p_open != NULL' shows a window-closing widget in the upper-right corner of the window, which clicking will set the boolean to false when clicked. + // - Begin() return false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. + // Always call a matching End() for each Begin() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.] + IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); + IMGUI_API void End(); + + // Child Windows + // - Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window. Child windows can embed their own child. + // - For each independent axis of 'size': ==0.0f: use remaining host window size / >0.0f: fixed size / <0.0f: use remaining window size minus abs(size) / Each axis can use a different mode, e.g. ImVec2(0,400). + // - BeginChild() returns false to indicate the window is collapsed or fully clipped, so you may early out and omit submitting anything to the window. + // Always call a matching EndChild() for each BeginChild() call, regardless of its return value [this is due to legacy reason and is inconsistent with most other functions such as BeginMenu/EndMenu, BeginPopup/EndPopup, etc. where the EndXXX call should only be called if the corresponding BeginXXX function returned true.] + IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); + IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags flags = 0); + IMGUI_API void EndChild(); + + // Windows Utilities + IMGUI_API bool IsWindowAppearing(); + IMGUI_API bool IsWindowCollapsed(); + IMGUI_API bool IsWindowFocused(ImGuiFocusedFlags flags=0); // is current window focused? or its root/child, depending on flags. see flags for options. + IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags=0); // is current window hovered (and typically: not blocked by a popup/modal)? see flags for options. NB: If you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that! Please read the FAQ! + IMGUI_API ImDrawList* GetWindowDrawList(); // get draw list associated to the window, to append your own drawing primitives + IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (useful if you want to do your own drawing via the DrawList API) + IMGUI_API ImVec2 GetWindowSize(); // get current window size + IMGUI_API float GetWindowWidth(); // get current window width (shortcut for GetWindowSize().x) + IMGUI_API float GetWindowHeight(); // get current window height (shortcut for GetWindowSize().y) + IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates + IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos() + IMGUI_API float GetContentRegionAvailWidth(); // + IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates + IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates + IMGUI_API float GetWindowContentRegionWidth(); // + + IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0,0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc. + IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() + IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints. + IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin() + IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin() + IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin() + IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily modify ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground. + IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. + IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. + IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed(). + IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / front-most. prefer using SetNextWindowFocus(). + IMGUI_API void SetWindowFontScale(float scale); // set font scale. Adjust IO.FontGlobalScale if you want to scale all windows + IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position. + IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis. + IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state + IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus. + + // Windows Scrolling + IMGUI_API float GetScrollX(); // get scrolling amount [0..GetScrollMaxX()] + IMGUI_API float GetScrollY(); // get scrolling amount [0..GetScrollMaxY()] + IMGUI_API float GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.X - WindowSize.X + IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y + IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()] + IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()] + IMGUI_API void SetScrollHereY(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a "default/current item" visible, consider using SetItemDefaultFocus() instead. + IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. + + // Parameters stacks (shared) + IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font + IMGUI_API void PopFont(); + IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col); + IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col); + IMGUI_API void PopStyleColor(int count = 1); + IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); + IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); + IMGUI_API void PopStyleVar(int count = 1); + IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwise use GetColorU32() to get style color with style alpha baked in. + IMGUI_API ImFont* GetFont(); // get current font + IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied + IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API + IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier + IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied + IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied + + // Parameters stacks (current window) + IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side) + IMGUI_API void PopItemWidth(); + IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position + IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space + IMGUI_API void PopTextWrapPos(); + IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets + IMGUI_API void PopAllowKeyboardFocus(); + IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. + IMGUI_API void PopButtonRepeat(); + + // Cursor / Layout + IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. + IMGUI_API void SameLine(float pos_x = 0.0f, float spacing_w = -1.0f); // call between widgets or groups to layout them horizontally + IMGUI_API void NewLine(); // undo a SameLine() + IMGUI_API void Spacing(); // add vertical spacing + IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size + IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by style.IndentSpacing or indent_w if != 0 + IMGUI_API void Unindent(float indent_w = 0.0f); // move content position back to the left, by style.IndentSpacing or indent_w if != 0 + IMGUI_API void BeginGroup(); // lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) + IMGUI_API void EndGroup(); + IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position + IMGUI_API float GetCursorPosX(); // " + IMGUI_API float GetCursorPosY(); // " + IMGUI_API void SetCursorPos(const ImVec2& local_pos); // " + IMGUI_API void SetCursorPosX(float x); // " + IMGUI_API void SetCursorPosY(float y); // " + IMGUI_API ImVec2 GetCursorStartPos(); // initial cursor position + IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API) + IMGUI_API void SetCursorScreenPos(const ImVec2& screen_pos); // cursor position in absolute screen coordinates [0..io.DisplaySize] + IMGUI_API void AlignTextToFramePadding(); // vertically align upcoming text baseline to FramePadding.y so that it will align properly to regularly framed items (call if you have text on a line before a framed item) + IMGUI_API float GetTextLineHeight(); // ~ FontSize + IMGUI_API float GetTextLineHeightWithSpacing(); // ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text) + IMGUI_API float GetFrameHeight(); // ~ FontSize + style.FramePadding.y * 2 + IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) + + // ID stack/scopes + // Read the FAQ for more details about how ID are handled in dear imgui. If you are creating widgets in a loop you most + // likely want to push a unique identifier (e.g. object pointer, loop index) to uniquely differentiate them. + // You can also use the "##foobar" syntax within widget label to distinguish them from each others. + // In this header file we use the "label"/"name" terminology to denote a string that will be displayed and used as an ID, + // whereas "str_id" denote a string that is only used as an ID and not aimed to be displayed. + IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the entire stack! + IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); + IMGUI_API void PushID(const void* ptr_id); + IMGUI_API void PushID(int int_id); + IMGUI_API void PopID(); + IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself + IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end); + IMGUI_API ImGuiID GetID(const void* ptr_id); + + // Widgets: Text + IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. + IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // simple formatted text + IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1); + IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...) IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor(); + IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(2); + IMGUI_API void TextDisabled(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); + IMGUI_API void TextDisabledV(const char* fmt, va_list args) IM_FMTLIST(1); + IMGUI_API void TextWrapped(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize(). + IMGUI_API void TextWrappedV(const char* fmt, va_list args) IM_FMTLIST(1); + IMGUI_API void LabelText(const char* label, const char* fmt, ...) IM_FMTARGS(2); // display text+label aligned the same way as value+label widgets + IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2); + IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text() + IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1); + + // Widgets: Main + // Most widgets return true when the value has been changed or when pressed/selected + IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0)); // button + IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text + IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); // button behavior without the visuals, useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) + IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape + IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0)); + IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding + IMGUI_API bool Checkbox(const char* label, bool* v); + IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value); + IMGUI_API bool RadioButton(const char* label, bool active); // use with e.g. if (RadioButton("one", my_value==1)) { my_value = 1; } + IMGUI_API bool RadioButton(const char* label, int* v, int v_button); // shortcut to handle the above pattern when value is an integer + IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1,0), const char* overlay = NULL); + IMGUI_API void Bullet(); // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses + + // Widgets: Combo Box + // The new BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. + // The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. + IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0); + IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true! + IMGUI_API bool Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1); + IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0" + IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1); + + // Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard. manually input values aren't clamped, can go off-bounds) + // For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x + // Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. + // Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision). + IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound + IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", const char* format_max = NULL, float power = 1.0f); + IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d"); // If v_min >= v_max we have no bound + IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d"); + IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d"); + IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d"); + IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", const char* format_max = NULL); + IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* v, float v_speed, const void* v_min = NULL, const void* v_max = NULL, const char* format = NULL, float power = 1.0f); + IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* v, int components, float v_speed, const void* v_min = NULL, const void* v_max = NULL, const char* format = NULL, float power = 1.0f); + + // Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard. manually input values aren't clamped, can go off-bounds) + // Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. + IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for power curve sliders + IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg"); + IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d"); + IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%d"); + IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%d"); + IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = "%d"); + IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f); + IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f); + IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); + IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%d"); + IMGUI_API bool VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format = NULL, float power = 1.0f); + + // Widgets: Input with Keyboard + // If you want to use InputText() with a dynamic string type such as std::string or your own, see misc/cpp/imgui_stdlib.h + IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); + IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); + IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat2(const char* label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat3(const char* label, float v[3], const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat4(const char* label, float v[4], const char* format = "%.3f", ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* format = "%.6f", ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputScalar(const char* label, ImGuiDataType data_type, void* v, const void* step = NULL, const void* step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step = NULL, const void* step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags extra_flags = 0); + + // Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.) + // Note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can the pass the address of a first float element out of a contiguous structure, e.g. &myvector.x + IMGUI_API bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); + IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0); + IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); + IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL); + IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0)); // display a colored square/button, hover for details, return true when pressed. + IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. + + // Widgets: Trees + // TreeNode functions return true when the node is open, in which case you need to also call TreePop() when you are finished displaying the tree node contents. + IMGUI_API bool TreeNode(const char* label); + IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2); // helper variation to completely decorelate the id from the displayed string. Read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet(). + IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2); // " + IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2); + IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2); + IMGUI_API bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0); + IMGUI_API bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); + IMGUI_API bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); + IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); + IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); + IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired. + IMGUI_API void TreePush(const void* ptr_id = NULL); // " + IMGUI_API void TreePop(); // ~ Unindent()+PopId() + IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing() + IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode + IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state. + IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). + IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header + + // Widgets: Selectables + IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); // "bool selected" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height + IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); // "bool* p_selected" point to the selection state (read-write), as a convenient helper. + + // Widgets: List Boxes + IMGUI_API bool ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1); + IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1); + IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0,0)); // use if you want to reimplement ListBox() will custom data or interactions. if the function return true, you can output elements then call ListBoxFooter() afterwards. + IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // " + IMGUI_API void ListBoxFooter(); // terminate the scrolling region. only call ListBoxFooter() if ListBoxHeader() returned true! + + // Widgets: Data Plotting + IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)); + IMGUI_API void PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0)); + IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float)); + IMGUI_API void PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0)); + + // Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace) + IMGUI_API void Value(const char* prefix, bool b); + IMGUI_API void Value(const char* prefix, int v); + IMGUI_API void Value(const char* prefix, unsigned int v); + IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL); + + // Widgets: Menus + IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. + IMGUI_API void EndMainMenuBar(); // only call EndMainMenuBar() if BeginMainMenuBar() returns true! + IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window). + IMGUI_API void EndMenuBar(); // only call EndMenuBar() if BeginMenuBar() returns true! + IMGUI_API bool BeginMenu(const char* label, bool enabled = true); // create a sub-menu entry. only call EndMenu() if this returns true! + IMGUI_API void EndMenu(); // only call EndMenu() if BeginMenu() returns true! + IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment + IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL + + // Tooltips + IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items). + IMGUI_API void EndTooltip(); + IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip(). + IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); + + // Popups + IMGUI_API void OpenPopup(const char* str_id); // call to mark popup as open (don't call every frame!). popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). + IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it. only call EndPopup() if BeginPopup() returns true! + IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! + IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, int mouse_button = 1, bool also_over_items = true); // helper to open and begin popup when clicked on current window. + IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (where there are no imgui windows). + IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside) + IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true! + IMGUI_API bool OpenPopupOnItemClick(const char* str_id = NULL, int mouse_button = 1); // helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). return true when just opened. + IMGUI_API bool IsPopupOpen(const char* str_id); // return true if the popup is open + IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. + + // Columns + // You can also use SameLine(pos_x) for simplified columns. The columns API is work-in-progress and rather lacking (columns are arguably the worst part of dear imgui at the moment!) + IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true); + IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished + IMGUI_API int GetColumnIndex(); // get current column index + IMGUI_API float GetColumnWidth(int column_index = -1); // get column width (in pixels). pass -1 to use current column + IMGUI_API void SetColumnWidth(int column_index, float width); // set column width (in pixels). pass -1 to use current column + IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f + IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column + IMGUI_API int GetColumnsCount(); + + // Logging/Capture: all text output from interface is captured to tty/file/clipboard. By default, tree nodes are automatically opened during logging. + IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty + IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file + IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard + IMGUI_API void LogFinish(); // stop logging (close file, etc.) + IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard + IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed) + + // Drag and Drop + // [BETA API] Missing Demo code. API may evolve. + IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource() + IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. + IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true! + IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget() + IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. + IMGUI_API void EndDragDropTarget(); // only call EndDragDropTarget() if BeginDragDropTarget() returns true! + IMGUI_API const ImGuiPayload* GetDragDropPayload(); // peek directly into the current payload from anywhere. may return NULL. use ImGuiPayload::IsDataType() to test for the payload type. + + // Clipping + IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect); + IMGUI_API void PopClipRect(); + + // Focus, Activation + // (Prefer using "SetItemDefaultFocus()" over "if (IsWindowAppearing()) SetScrollHereY()" when applicable to signify "this is the default item") + IMGUI_API void SetItemDefaultFocus(); // make last item the default focused item of a window. + IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. + + // Item/Widgets Utilities + // See Demo Window under "Widgets->Querying Status" for an interactive visualization of many of those functions. + IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options. + IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false) + IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation? + IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) == IsMouseClicked(mouse_button) && IsItemHovered() + IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling) + IMGUI_API bool IsItemEdited(); // did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets. + IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing. + IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item). + IMGUI_API bool IsAnyItemHovered(); + IMGUI_API bool IsAnyItemActive(); + IMGUI_API bool IsAnyItemFocused(); + IMGUI_API ImVec2 GetItemRectMin(); // get bounding rectangle of last item, in screen space + IMGUI_API ImVec2 GetItemRectMax(); // " + IMGUI_API ImVec2 GetItemRectSize(); // get size of last item, in screen space + IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. + + // Miscellaneous Utilities + IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped. + IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. + IMGUI_API double GetTime(); + IMGUI_API int GetFrameCount(); + IMGUI_API ImDrawList* GetOverlayDrawList(); // this draw list will be the last rendered one, useful to quickly draw overlays shapes/text + IMGUI_API ImDrawListSharedData* GetDrawListSharedData(); // you may use this when creating your own ImDrawList instances + IMGUI_API const char* GetStyleColorName(ImGuiCol idx); + IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) + IMGUI_API ImGuiStorage* GetStateStorage(); + IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); + IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can. + IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame + IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window) + + // Color Utilities + IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in); + IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in); + IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v); + IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b); + + // Inputs Utilities + IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key] + IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. note that imgui doesn't know the semantic of each entry of io.KeysDown[]. Use your own indices/enums according to how your backend/engine stored them into io.KeysDown[]! + IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down). if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate + IMGUI_API bool IsKeyReleased(int user_key_index); // was key released (went from Down to !Down).. + IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate + IMGUI_API bool IsMouseDown(int button); // is mouse button held (0=left, 1=right, 2=middle) + IMGUI_API bool IsAnyMouseDown(); // is any mouse button held + IMGUI_API bool IsMouseClicked(int button, bool repeat = false); // did mouse button clicked (went from !Down to Down) (0=left, 1=right, 2=middle) + IMGUI_API bool IsMouseDoubleClicked(int button); // did mouse button double-clicked. a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime. + IMGUI_API bool IsMouseReleased(int button); // did mouse button released (went from Down to !Down) + IMGUI_API bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f); // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold + IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true); // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block. + IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // + IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls + IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve backup of mouse position at the time of opening popup we have BeginPopup() into + IMGUI_API ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); // dragging amount since clicking. if lock_threshold < -1.0f uses io.MouseDraggingThreshold + IMGUI_API void ResetMouseDragDelta(int button = 0); // + IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you + IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type + IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. + IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). + + // Clipboard Utilities (also see the LogToClipboard() function to capture or output text data to the clipboard) + IMGUI_API const char* GetClipboardText(); + IMGUI_API void SetClipboardText(const char* text); + + // Settings/.Ini Utilities + // The disk functions are automatically called if io.IniFilename != NULL (default is "imgui.ini"). + // Set io.IniFilename to NULL to load/save manually. Read io.WantSaveIniSettings description about handling .ini saving manually. + IMGUI_API void LoadIniSettingsFromDisk(const char* ini_filename); // call after CreateContext() and before the first call to NewFrame(). NewFrame() automatically calls LoadIniSettingsFromDisk(io.IniFilename). + IMGUI_API void LoadIniSettingsFromMemory(const char* ini_data, size_t ini_size=0); // call after CreateContext() and before the first call to NewFrame() to provide .ini data from your own data source. + IMGUI_API void SaveIniSettingsToDisk(const char* ini_filename); + IMGUI_API const char* SaveIniSettingsToMemory(size_t* out_ini_size = NULL); // return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings. + + // Memory Utilities + // All those functions are not reliant on the current context. + // If you reload the contents of imgui.cpp at runtime, you may need to call SetCurrentContext() + SetAllocatorFunctions() again. + IMGUI_API void SetAllocatorFunctions(void* (*alloc_func)(size_t sz, void* user_data), void(*free_func)(void* ptr, void* user_data), void* user_data = NULL); + IMGUI_API void* MemAlloc(size_t size); + IMGUI_API void MemFree(void* ptr); + +} // namespace ImGui + +//----------------------------------------------------------------------------- +// Flags & Enumerations +//----------------------------------------------------------------------------- + +// Flags for ImGui::Begin() +enum ImGuiWindowFlags_ +{ + ImGuiWindowFlags_None = 0, + ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar + ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip + ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window + ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programatically) + ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set. + ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it + ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame + ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f). + ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file + ImGuiWindowFlags_NoMouseInputs = 1 << 9, // Disable catching mouse, hovering test with pass through. + ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar + ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. + ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state + ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus) + ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) + ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) + ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) + ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window + ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) + ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, + ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse, + ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, + + // [Internal] + ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!) + ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild() + ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip() + ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup() + ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal() + ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For internal use by BeginMenu() + + // [Obsolete] + //ImGuiWindowFlags_ShowBorders = 1 << 7, // --> Set style.FrameBorderSize=1.0f / style.WindowBorderSize=1.0f to enable borders around windows and items + //ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigResizeWindowsFromEdges and make sure mouse cursors are supported by back-end (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) +}; + +// Flags for ImGui::InputText() +enum ImGuiInputTextFlags_ +{ + ImGuiInputTextFlags_None = 0, + ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ + ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef + ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z + ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs + ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus + ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified) + ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Callback on pressing TAB (for completion handling) + ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Callback on pressing Up/Down arrows (for history handling) + ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Callback on each iteration. User code may query cursor position, modify text buffer. + ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. + ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field + ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). + ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally + ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, // Insert mode + ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode + ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*' + ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID(). + ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input) + ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) + // [Internal] + ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline() +}; + +// Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() +enum ImGuiTreeNodeFlags_ +{ + ImGuiTreeNodeFlags_None = 0, + ImGuiTreeNodeFlags_Selected = 1 << 0, // Draw as selected + ImGuiTreeNodeFlags_Framed = 1 << 1, // Full colored frame (e.g. for CollapsingHeader) + ImGuiTreeNodeFlags_AllowItemOverlap = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one + ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack + ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) + ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open + ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Need double-click to open node + ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. + ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). + ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow + ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). + //ImGuITreeNodeFlags_SpanAllAvailWidth = 1 << 11, // FIXME: TODO: Extend hit box horizontally even if not framed + //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 12, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible + ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) + ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog + + // Obsolete names (will be removed) +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + , ImGuiTreeNodeFlags_AllowOverlapMode = ImGuiTreeNodeFlags_AllowItemOverlap +#endif +}; + +// Flags for ImGui::Selectable() +enum ImGuiSelectableFlags_ +{ + ImGuiSelectableFlags_None = 0, + ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window + ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) + ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too + ImGuiSelectableFlags_Disabled = 1 << 3 // Cannot be selected, display greyed out text +}; + +// Flags for ImGui::BeginCombo() +enum ImGuiComboFlags_ +{ + ImGuiComboFlags_None = 0, + ImGuiComboFlags_PopupAlignLeft = 1 << 0, // Align the popup toward the left by default + ImGuiComboFlags_HeightSmall = 1 << 1, // Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo() + ImGuiComboFlags_HeightRegular = 1 << 2, // Max ~8 items visible (default) + ImGuiComboFlags_HeightLarge = 1 << 3, // Max ~20 items visible + ImGuiComboFlags_HeightLargest = 1 << 4, // As many fitting items as possible + ImGuiComboFlags_NoArrowButton = 1 << 5, // Display on the preview box without the square arrow button + ImGuiComboFlags_NoPreview = 1 << 6, // Display only a square arrow button + ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest +}; + +// Flags for ImGui::IsWindowFocused() +enum ImGuiFocusedFlags_ +{ + ImGuiFocusedFlags_None = 0, + ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused + ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy) + ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use ImGui::GetIO().WantCaptureMouse instead. + ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows +}; + +// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered() +// Note: if you are trying to check whether your mouse should be dispatched to imgui or to your app, you should use the 'io.WantCaptureMouse' boolean for that. Please read the FAQ! +// Note: windows with the ImGuiWindowFlags_NoInputs flag are ignored by IsWindowHovered() calls. +enum ImGuiHoveredFlags_ +{ + ImGuiHoveredFlags_None = 0, // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. + ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered + ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy) + ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered + ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, // Return true even if a popup window is normally blocking access to this item/window + //ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet. + ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. + ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is overlapped by another window + ImGuiHoveredFlags_AllowWhenDisabled = 1 << 7, // Return true even if the item is disabled + ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, + ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows +}; + +// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload() +enum ImGuiDragDropFlags_ +{ + ImGuiDragDropFlags_None = 0, + // BeginDragDropSource() flags + ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior. + ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item. + ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. + ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit. + ImGuiDragDropFlags_SourceExtern = 1 << 4, // External source (from outside of imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. + ImGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5, // Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged) + // AcceptDragDropPayload() flags + ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered. + ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target. + ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site. + ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect // For peeking ahead and inspecting the payload before delivery. +}; + +// Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui. +#define IMGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F" // float[3]: Standard type for colors, without alpha. User code may use this type. +#define IMGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F" // float[4]: Standard type for colors. User code may use this type. + +// A primary data type +enum ImGuiDataType_ +{ + ImGuiDataType_S32, // int + ImGuiDataType_U32, // unsigned int + ImGuiDataType_S64, // long long, __int64 + ImGuiDataType_U64, // unsigned long long, unsigned __int64 + ImGuiDataType_Float, // float + ImGuiDataType_Double, // double + ImGuiDataType_COUNT +}; + +// A cardinal direction +enum ImGuiDir_ +{ + ImGuiDir_None = -1, + ImGuiDir_Left = 0, + ImGuiDir_Right = 1, + ImGuiDir_Up = 2, + ImGuiDir_Down = 3, + ImGuiDir_COUNT +}; + +// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array +enum ImGuiKey_ +{ + ImGuiKey_Tab, + ImGuiKey_LeftArrow, + ImGuiKey_RightArrow, + ImGuiKey_UpArrow, + ImGuiKey_DownArrow, + ImGuiKey_PageUp, + ImGuiKey_PageDown, + ImGuiKey_Home, + ImGuiKey_End, + ImGuiKey_Insert, + ImGuiKey_Delete, + ImGuiKey_Backspace, + ImGuiKey_Space, + ImGuiKey_Enter, + ImGuiKey_Escape, + ImGuiKey_A, // for text edit CTRL+A: select all + ImGuiKey_C, // for text edit CTRL+C: copy + ImGuiKey_V, // for text edit CTRL+V: paste + ImGuiKey_X, // for text edit CTRL+X: cut + ImGuiKey_Y, // for text edit CTRL+Y: redo + ImGuiKey_Z, // for text edit CTRL+Z: undo + ImGuiKey_COUNT +}; + +// Gamepad/Keyboard directional navigation +// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. +// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Back-end: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame(). +// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://goo.gl/9LgVZW. +enum ImGuiNavInput_ +{ + // Gamepad Mapping + ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) + ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) + ImGuiNavInput_Input, // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) + ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) + ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) + ImGuiNavInput_DpadRight, // + ImGuiNavInput_DpadUp, // + ImGuiNavInput_DpadDown, // + ImGuiNavInput_LStickLeft, // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down + ImGuiNavInput_LStickRight, // + ImGuiNavInput_LStickUp, // + ImGuiNavInput_LStickDown, // + ImGuiNavInput_FocusPrev, // next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) + ImGuiNavInput_FocusNext, // prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) + ImGuiNavInput_TweakSlow, // slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) + ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) + + // [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them. + // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[]. + ImGuiNavInput_KeyMenu_, // toggle menu // = io.KeyAlt + ImGuiNavInput_KeyLeft_, // move left // = Arrow keys + ImGuiNavInput_KeyRight_, // move right + ImGuiNavInput_KeyUp_, // move up + ImGuiNavInput_KeyDown_, // move down + ImGuiNavInput_COUNT, + ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyMenu_ +}; + +// Configuration flags stored in io.ConfigFlags. Set by user/application. +enum ImGuiConfigFlags_ +{ + ImGuiConfigFlags_None = 0, + ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[]. + ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui back-end to fill io.NavInputs[]. Back-end also needs to set ImGuiBackendFlags_HasGamepad. + ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your binding, otherwise ImGui will react as if the mouse is jumping around back and forth. + ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. + ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the back-end. + ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct back-end to not alter mouse cursor shape and visibility. Use if the back-end cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. + + // User storage (to allow your back-end/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core ImGui) + ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware. + ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse. +}; + +// Back-end capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom back-end. +enum ImGuiBackendFlags_ +{ + ImGuiBackendFlags_None = 0, + ImGuiBackendFlags_HasGamepad = 1 << 0, // Back-end supports gamepad and currently has one connected. + ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Back-end supports honoring GetMouseCursor() value to change the OS cursor shape. + ImGuiBackendFlags_HasSetMousePos = 1 << 2 // Back-end supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). +}; + +// Enumeration for PushStyleColor() / PopStyleColor() +enum ImGuiCol_ +{ + ImGuiCol_Text, + ImGuiCol_TextDisabled, + ImGuiCol_WindowBg, // Background of normal windows + ImGuiCol_ChildBg, // Background of child windows + ImGuiCol_PopupBg, // Background of popups, menus, tooltips windows + ImGuiCol_Border, + ImGuiCol_BorderShadow, + ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input + ImGuiCol_FrameBgHovered, + ImGuiCol_FrameBgActive, + ImGuiCol_TitleBg, + ImGuiCol_TitleBgActive, + ImGuiCol_TitleBgCollapsed, + ImGuiCol_MenuBarBg, + ImGuiCol_ScrollbarBg, + ImGuiCol_ScrollbarGrab, + ImGuiCol_ScrollbarGrabHovered, + ImGuiCol_ScrollbarGrabActive, + ImGuiCol_CheckMark, + ImGuiCol_SliderGrab, + ImGuiCol_SliderGrabActive, + ImGuiCol_Button, + ImGuiCol_ButtonHovered, + ImGuiCol_ButtonActive, + ImGuiCol_Header, + ImGuiCol_HeaderHovered, + ImGuiCol_HeaderActive, + ImGuiCol_Separator, + ImGuiCol_SeparatorHovered, + ImGuiCol_SeparatorActive, + ImGuiCol_ResizeGrip, + ImGuiCol_ResizeGripHovered, + ImGuiCol_ResizeGripActive, + ImGuiCol_PlotLines, + ImGuiCol_PlotLinesHovered, + ImGuiCol_PlotHistogram, + ImGuiCol_PlotHistogramHovered, + ImGuiCol_TextSelectedBg, + ImGuiCol_DragDropTarget, + ImGuiCol_NavHighlight, // Gamepad/keyboard: current highlighted item + ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB + ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active + ImGuiCol_ModalWindowDimBg, // Darken/colorize entire screen behind a modal window, when one is active + ImGuiCol_COUNT + + // Obsolete names (will be removed) +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + , ImGuiCol_ChildWindowBg = ImGuiCol_ChildBg, ImGuiCol_Column = ImGuiCol_Separator, ImGuiCol_ColumnHovered = ImGuiCol_SeparatorHovered, ImGuiCol_ColumnActive = ImGuiCol_SeparatorActive + , ImGuiCol_ModalWindowDarkening = ImGuiCol_ModalWindowDimBg + //ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered, // [unused since 1.60+] the close button now uses regular button colors. + //ImGuiCol_ComboBg, // [unused since 1.53+] ComboBg has been merged with PopupBg, so a redirect isn't accurate. +#endif +}; + +// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure. +// NB: the enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. During initialization, feel free to just poke into ImGuiStyle directly. +// NB: if changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. +enum ImGuiStyleVar_ +{ + // Enum name ......................// Member in ImGuiStyle structure (see ImGuiStyle for descriptions) + ImGuiStyleVar_Alpha, // float Alpha + ImGuiStyleVar_WindowPadding, // ImVec2 WindowPadding + ImGuiStyleVar_WindowRounding, // float WindowRounding + ImGuiStyleVar_WindowBorderSize, // float WindowBorderSize + ImGuiStyleVar_WindowMinSize, // ImVec2 WindowMinSize + ImGuiStyleVar_WindowTitleAlign, // ImVec2 WindowTitleAlign + ImGuiStyleVar_ChildRounding, // float ChildRounding + ImGuiStyleVar_ChildBorderSize, // float ChildBorderSize + ImGuiStyleVar_PopupRounding, // float PopupRounding + ImGuiStyleVar_PopupBorderSize, // float PopupBorderSize + ImGuiStyleVar_FramePadding, // ImVec2 FramePadding + ImGuiStyleVar_FrameRounding, // float FrameRounding + ImGuiStyleVar_FrameBorderSize, // float FrameBorderSize + ImGuiStyleVar_ItemSpacing, // ImVec2 ItemSpacing + ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ItemInnerSpacing + ImGuiStyleVar_IndentSpacing, // float IndentSpacing + ImGuiStyleVar_ScrollbarSize, // float ScrollbarSize + ImGuiStyleVar_ScrollbarRounding, // float ScrollbarRounding + ImGuiStyleVar_GrabMinSize, // float GrabMinSize + ImGuiStyleVar_GrabRounding, // float GrabRounding + ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign + ImGuiStyleVar_COUNT + + // Obsolete names (will be removed) +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + , ImGuiStyleVar_Count_ = ImGuiStyleVar_COUNT, ImGuiStyleVar_ChildWindowRounding = ImGuiStyleVar_ChildRounding +#endif +}; + +// Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton() +enum ImGuiColorEditFlags_ +{ + ImGuiColorEditFlags_None = 0, + ImGuiColorEditFlags_NoAlpha = 1 << 1, // // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer). + ImGuiColorEditFlags_NoPicker = 1 << 2, // // ColorEdit: disable picker when clicking on colored square. + ImGuiColorEditFlags_NoOptions = 1 << 3, // // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. + ImGuiColorEditFlags_NoSmallPreview = 1 << 4, // // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs) + ImGuiColorEditFlags_NoInputs = 1 << 5, // // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square). + ImGuiColorEditFlags_NoTooltip = 1 << 6, // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. + ImGuiColorEditFlags_NoLabel = 1 << 7, // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). + ImGuiColorEditFlags_NoSidePreview = 1 << 8, // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead. + ImGuiColorEditFlags_NoDragDrop = 1 << 9, // // ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source. + + // User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup. + ImGuiColorEditFlags_AlphaBar = 1 << 16, // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. + ImGuiColorEditFlags_AlphaPreview = 1 << 17, // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. + ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 18, // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. + ImGuiColorEditFlags_HDR = 1 << 19, // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). + ImGuiColorEditFlags_RGB = 1 << 20, // [Inputs] // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX. + ImGuiColorEditFlags_HSV = 1 << 21, // [Inputs] // " + ImGuiColorEditFlags_HEX = 1 << 22, // [Inputs] // " + ImGuiColorEditFlags_Uint8 = 1 << 23, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. + ImGuiColorEditFlags_Float = 1 << 24, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. + ImGuiColorEditFlags_PickerHueBar = 1 << 25, // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value. + ImGuiColorEditFlags_PickerHueWheel = 1 << 26, // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value. + + // [Internal] Masks + ImGuiColorEditFlags__InputsMask = ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_HSV|ImGuiColorEditFlags_HEX, + ImGuiColorEditFlags__DataTypeMask = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_Float, + ImGuiColorEditFlags__PickerMask = ImGuiColorEditFlags_PickerHueWheel|ImGuiColorEditFlags_PickerHueBar, + ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_PickerHueBar // Change application default using SetColorEditOptions() +}; + +// Enumeration for GetMouseCursor() +// User code may request binding to display given cursor by calling SetMouseCursor(), which is why we have some cursors that are marked unused here +enum ImGuiMouseCursor_ +{ + ImGuiMouseCursor_None = -1, + ImGuiMouseCursor_Arrow = 0, + ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. + ImGuiMouseCursor_ResizeAll, // (Unused by imgui functions) + ImGuiMouseCursor_ResizeNS, // When hovering over an horizontal border + ImGuiMouseCursor_ResizeEW, // When hovering over a vertical border or a column + ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window + ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window + ImGuiMouseCursor_Hand, // (Unused by imgui functions. Use for e.g. hyperlinks) + ImGuiMouseCursor_COUNT + + // Obsolete names (will be removed) +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + , ImGuiMouseCursor_Count_ = ImGuiMouseCursor_COUNT +#endif +}; + +// Enumateration for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions +// Represent a condition. +// Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always. +enum ImGuiCond_ +{ + ImGuiCond_Always = 1 << 0, // Set the variable + ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed) + ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the object/window has no persistently saved data (no entry in .ini file) + ImGuiCond_Appearing = 1 << 3 // Set the variable if the object/window is appearing after being hidden/inactive (or the first time) + + // Obsolete names (will be removed) +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + , ImGuiSetCond_Always = ImGuiCond_Always, ImGuiSetCond_Once = ImGuiCond_Once, ImGuiSetCond_FirstUseEver = ImGuiCond_FirstUseEver, ImGuiSetCond_Appearing = ImGuiCond_Appearing +#endif +}; + +//----------------------------------------------------------------------------- +// ImGuiStyle +// You may modify the ImGui::GetStyle() main instance during initialization and before NewFrame(). +// During the frame, use ImGui::PushStyleVar(ImGuiStyleVar_XXXX)/PopStyleVar() to alter the main style values, +// and ImGui::PushStyleColor(ImGuiCol_XXX)/PopStyleColor() for colors. +//----------------------------------------------------------------------------- + +struct ImGuiStyle +{ + float Alpha; // Global alpha applies to everything in ImGui. + ImVec2 WindowPadding; // Padding within a window. + float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. + float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). + ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. + float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows. + float ChildBorderSize; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + float PopupRounding; // Radius of popup window corners rounding. (Note that tooltip windows use WindowRounding) + float PopupBorderSize; // Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets). + float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). + float FrameBorderSize; // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). + ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines. + ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label). + ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! + float IndentSpacing; // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). + float ColumnsMinSpacing; // Minimum horizontal spacing between two columns. + float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar. + float ScrollbarRounding; // Radius of grab corners for scrollbar. + float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar. + float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. + ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered. + ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area by at least this amount. Only applies to regular windows. + ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! + float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. + bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. + bool AntiAliasedFill; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) + float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. + ImVec4 Colors[ImGuiCol_COUNT]; + + IMGUI_API ImGuiStyle(); + IMGUI_API void ScaleAllSizes(float scale_factor); +}; + +//----------------------------------------------------------------------------- +// ImGuiIO +// Communicate most settings and inputs/outputs to Dear ImGui using this structure. +// Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for general usage. +//----------------------------------------------------------------------------- + +struct ImGuiIO +{ + //------------------------------------------------------------------ + // Configuration (fill once) // Default value: + //------------------------------------------------------------------ + + ImGuiConfigFlags ConfigFlags; // = 0 // See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc. + ImGuiBackendFlags BackendFlags; // = 0 // See ImGuiBackendFlags_ enum. Set by back-end (imgui_impl_xxx files or custom back-end) to communicate features supported by the back-end. + ImVec2 DisplaySize; // // Main display size, in pixels. For clamping windows positions. + float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. + float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds. + const char* IniFilename; // = "imgui.ini" // Path to .ini file. Set NULL to disable automatic .ini loading/saving, if e.g. you want to manually load/save from memory. + const char* LogFilename; // = "imgui_log.txt" // Path to .log file (default parameter to ImGui::LogToFile when no file is specified). + float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. + float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. + float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. + int KeyMap[ImGuiKey_COUNT]; // // Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. + float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). + float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds. + void* UserData; // = NULL // Store your own data for retrieval by callbacks. + + ImFontAtlas* Fonts; // // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array. + float FontGlobalScale; // = 1.0f // Global scale all fonts + bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel. + ImFont* FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0]. + ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui. + ImVec2 DisplayVisibleMin; // (0.0f,0.0f) // [OBSOLETE] If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area. + ImVec2 DisplayVisibleMax; // (0.0f,0.0f) // [OBSOLETE: just use io.DisplaySize!] If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize + + // Miscellaneous configuration options + bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by back-end implementations. + bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl (was called io.OptMacOSXBehaviors prior to 1.63) + bool ConfigInputTextCursorBlink; // = true // Set to false to disable blinking cursor, for users who consider it distracting. (was called: io.OptCursorBlink prior to 1.63) + bool ConfigResizeWindowsFromEdges; // = false // [BETA] Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be the ImGuiWindowFlags_ResizeFromAnySide flag) + + //------------------------------------------------------------------ + // Platform Functions + // (the imgui_impl_xxxx back-end files are setting those up for you) + //------------------------------------------------------------------ + + // Optional: Platform/Renderer back-end name (informational only! will be displayed in About Window) + const char* BackendPlatformName; + const char* BackendRendererName; + + // Optional: Access OS clipboard + // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) + const char* (*GetClipboardTextFn)(void* user_data); + void (*SetClipboardTextFn)(void* user_data, const char* text); + void* ClipboardUserData; + + // Optional: Notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME on Windows) + // (default to use native imm32 api on Windows) + void (*ImeSetInputScreenPosFn)(int x, int y); + void* ImeWindowHandle; // (Windows) Set this to your HWND to get automatic IME cursor positioning. + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + // [OBSOLETE since 1.60+] Rendering function, will be automatically called in Render(). Please call your rendering function yourself now! + // You can obtain the ImDrawData* by calling ImGui::GetDrawData() after Render(). See example applications if you are unsure of how to implement this. + void (*RenderDrawListsFn)(ImDrawData* data); +#else + // This is only here to keep ImGuiIO the same size, so that IMGUI_DISABLE_OBSOLETE_FUNCTIONS can exceptionally be used outside of imconfig.h. + void* RenderDrawListsFnUnused; +#endif + + //------------------------------------------------------------------ + // Input - Fill before calling NewFrame() + //------------------------------------------------------------------ + + ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.) + bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. + float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. + float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all back-ends. + bool KeyCtrl; // Keyboard modifier pressed: Control + bool KeyShift; // Keyboard modifier pressed: Shift + bool KeyAlt; // Keyboard modifier pressed: Alt + bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows + bool KeysDown[512]; // Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). + ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper. + float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs (keyboard keys will be auto-mapped and be written here by ImGui::NewFrame, all values will be cleared back to zero in ImGui::EndFrame) + + // Functions + IMGUI_API void AddInputCharacter(ImWchar c); // Add new character into InputCharacters[] + IMGUI_API void AddInputCharactersUTF8(const char* utf8_chars); // Add new characters into InputCharacters[] from an UTF-8 string + inline void ClearInputCharacters() { InputCharacters[0] = 0; } // Clear the text input buffer manually + + //------------------------------------------------------------------ + // Output - Retrieve after calling NewFrame() + //------------------------------------------------------------------ + + bool WantCaptureMouse; // When io.WantCaptureMouse is true, imgui will use the mouse inputs, do not dispatch them to your main game/application (in both cases, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.). + bool WantCaptureKeyboard; // When io.WantCaptureKeyboard is true, imgui will use the keyboard inputs, do not dispatch them to your main game/application (in both cases, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.). + bool WantTextInput; // Mobile/console: when io.WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). + bool WantSetMousePos; // MousePos has been altered, back-end should reposition mouse on next frame. Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. + bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. IMPORTANT: You need to clear io.WantSaveIniSettings yourself. + bool NavActive; // Directional navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. + bool NavVisible; // Directional navigation is visible and allowed (will handle ImGuiKey_NavXXX events). + float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames + int MetricsRenderVertices; // Vertices output during last call to Render() + int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 + int MetricsRenderWindows; // Number of visible windows + int MetricsActiveWindows; // Number of active windows + int MetricsActiveAllocations; // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts. + ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. + + //------------------------------------------------------------------ + // [Internal] ImGui will maintain those fields. Forward compatibility not guaranteed! + //------------------------------------------------------------------ + + ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) + ImVec2 MouseClickedPos[5]; // Position at time of clicking + double MouseClickedTime[5]; // Time of last click (used to figure out double-click) + bool MouseClicked[5]; // Mouse button went from !Down to Down + bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? + bool MouseReleased[5]; // Mouse button went from Down to !Down + bool MouseDownOwned[5]; // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds. + float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) + float MouseDownDurationPrev[5]; // Previous time the mouse button has been down + ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point + float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point + float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed) + float KeysDownDurationPrev[512]; // Previous duration the key has been down + float NavInputsDownDuration[ImGuiNavInput_COUNT]; + float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; + + IMGUI_API ImGuiIO(); +}; + +//----------------------------------------------------------------------------- +// Misc data structures +//----------------------------------------------------------------------------- + +// Shared state of InputText(), passed as an argument to your callback when a ImGuiInputTextFlags_Callback* flag is used. +// The callback function should return 0 by default. +// Callbacks (follow a flag name and see comments in ImGuiInputTextFlags_ declarations for more details) +// - ImGuiInputTextFlags_CallbackCompletion: Callback on pressing TAB +// - ImGuiInputTextFlags_CallbackHistory: Callback on pressing Up/Down arrows +// - ImGuiInputTextFlags_CallbackAlways: Callback on each iteration +// - ImGuiInputTextFlags_CallbackCharFilter: Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard. +// - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. +struct ImGuiInputTextCallbackData +{ + ImGuiInputTextFlags EventFlag; // One ImGuiInputTextFlags_Callback* // Read-only + ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only + void* UserData; // What user passed to InputText() // Read-only + + // Arguments for the different callback events + // - To modify the text buffer in a callback, prefer using the InsertChars() / DeleteChars() function. InsertChars() will take care of calling the resize callback if necessary. + // - If you know your edits are not going to resize the underlying buffer allocation, you may modify the contents of 'Buf[]' directly. You need to update 'BufTextLen' accordingly (0 <= BufTextLen < BufSize) and set 'BufDirty'' to true so InputText can update its internal state. + ImWchar EventChar; // Character input // Read-write // [CharFilter] Replace character with another one, or set to zero to drop. return 1 is equivalent to setting EventChar=0; + ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only // [Completion,History] + char* Buf; // Text buffer // Read-write // [Resize] Can replace pointer / [Completion,History,Always] Only write to pointed data, don't replace the actual pointer! + int BufTextLen; // Text length (in bytes) // Read-write // [Resize,Completion,History,Always] Exclude zero-terminator storage. In C land: == strlen(some_text), in C++ land: string.length() + int BufSize; // Buffer size (in bytes) = capacity+1 // Read-only // [Resize,Completion,History,Always] Include zero-terminator storage. In C land == ARRAYSIZE(my_char_array), in C++ land: string.capacity()+1 + bool BufDirty; // Set if you modify Buf/BufTextLen! // Write // [Completion,History,Always] + int CursorPos; // // Read-write // [Completion,History,Always] + int SelectionStart; // // Read-write // [Completion,History,Always] == to SelectionEnd when no selection) + int SelectionEnd; // // Read-write // [Completion,History,Always] + + // Helper functions for text manipulation. + // Use those function to benefit from the CallbackResize behaviors. Calling those function reset the selection. + IMGUI_API ImGuiInputTextCallbackData(); + IMGUI_API void DeleteChars(int pos, int bytes_count); + IMGUI_API void InsertChars(int pos, const char* text, const char* text_end = NULL); + bool HasSelection() const { return SelectionStart != SelectionEnd; } +}; + +// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin(). +// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. +struct ImGuiSizeCallbackData +{ + void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints() + ImVec2 Pos; // Read-only. Window position, for reference. + ImVec2 CurrentSize; // Read-only. Current window size. + ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. +}; + +// Data payload for Drag and Drop operations: AcceptDragDropPayload(), GetDragDropPayload() +struct ImGuiPayload +{ + // Members + void* Data; // Data (copied and owned by dear imgui) + int DataSize; // Data size + + // [Internal] + ImGuiID SourceId; // Source item id + ImGuiID SourceParentId; // Source parent id (if available) + int DataFrameCount; // Data timestamp + char DataType[32+1]; // Data type tag (short user-supplied string, 32 characters max) + bool Preview; // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets) + bool Delivery; // Set when AcceptDragDropPayload() was called and mouse button is released over the target item. + + ImGuiPayload() { Clear(); } + void Clear() { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0, sizeof(DataType)); DataFrameCount = -1; Preview = Delivery = false; } + bool IsDataType(const char* type) const { return DataFrameCount != -1 && strcmp(type, DataType) == 0; } + bool IsPreview() const { return Preview; } + bool IsDelivery() const { return Delivery; } +}; + +//----------------------------------------------------------------------------- +// Obsolete functions (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details) +//----------------------------------------------------------------------------- + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +namespace ImGui +{ + // OBSOLETED in 1.66 (from Sep 2018) + static inline void SetScrollHere(float center_ratio=0.5f){ SetScrollHereY(center_ratio); } + // OBSOLETED in 1.63 (from Aug 2018) + static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } + // OBSOLETED in 1.61 (from Apr 2018) + IMGUI_API bool InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags = 0); // Use the 'const char* format' version instead of 'decimal_precision'! + IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags = 0); + IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags = 0); + // OBSOLETED in 1.60 (from Dec 2017) + static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } + static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } + static inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; } + // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + static inline void ShowTestWindow() { return ShowDemoWindow(); } + static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } + static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } + static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } + static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } + // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017) + IMGUI_API bool Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override = -1.0f, ImGuiWindowFlags flags = 0); // Use SetNextWindowSize(size, ImGuiCond_FirstUseEver) + SetNextWindowBgAlpha() instead. + static inline bool IsRootWindowOrAnyChildHovered() { return IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows); } + static inline void AlignFirstTextHeightToWidgets() { AlignTextToFramePadding(); } + static inline void SetNextWindowPosCenter(ImGuiCond c=0) { ImGuiIO& io = GetIO(); SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f), c, ImVec2(0.5f, 0.5f)); } + // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017) + static inline bool IsItemHoveredRect() { return IsItemHovered(ImGuiHoveredFlags_RectOnly); } + static inline bool IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // This was misleading and partly broken. You probably want to use the ImGui::GetIO().WantCaptureMouse flag instead. + static inline bool IsMouseHoveringAnyWindow() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } + static inline bool IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } +} +typedef ImGuiInputTextCallback ImGuiTextEditCallback; // OBSOLETE in 1.63 (from Aug 2018): made the names consistent +typedef ImGuiInputTextCallbackData ImGuiTextEditCallbackData; +#endif + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +// Helper: Lightweight std::vector<> like class to avoid dragging dependencies (also: Windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). +// *Important* Our implementation does NOT call C++ constructors/destructors. This is intentional, we do not require it but you have to be mindful of that. Do _not_ use this class as a std::vector replacement in your code! +template +class ImVector +{ +public: + int Size; + int Capacity; + T* Data; + + typedef T value_type; + typedef value_type* iterator; + typedef const value_type* const_iterator; + + inline ImVector() { Size = Capacity = 0; Data = NULL; } + inline ~ImVector() { if (Data) ImGui::MemFree(Data); } + inline ImVector(const ImVector& src) { Size = Capacity = 0; Data = NULL; operator=(src); } + inline ImVector& operator=(const ImVector& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(value_type)); return *this; } + + inline bool empty() const { return Size == 0; } + inline int size() const { return Size; } + inline int capacity() const { return Capacity; } + inline value_type& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; } + inline const value_type& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; } + + inline void clear() { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } } + inline iterator begin() { return Data; } + inline const_iterator begin() const { return Data; } + inline iterator end() { return Data + Size; } + inline const_iterator end() const { return Data + Size; } + inline value_type& front() { IM_ASSERT(Size > 0); return Data[0]; } + inline const value_type& front() const { IM_ASSERT(Size > 0); return Data[0]; } + inline value_type& back() { IM_ASSERT(Size > 0); return Data[Size - 1]; } + inline const value_type& back() const { IM_ASSERT(Size > 0); return Data[Size - 1]; } + inline void swap(ImVector& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } + + inline int _grow_capacity(int sz) const { int new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > sz ? new_capacity : sz; } + inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; } + inline void resize(int new_size,const value_type& v){ if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; } + inline void reserve(int new_capacity) + { + if (new_capacity <= Capacity) + return; + value_type* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(value_type)); + if (Data) + { + memcpy(new_data, Data, (size_t)Size * sizeof(value_type)); + ImGui::MemFree(Data); + } + Data = new_data; + Capacity = new_capacity; + } + + // NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden. + inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; } + inline void pop_back() { IM_ASSERT(Size > 0); Size--; } + inline void push_front(const value_type& v) { if (Size == 0) push_back(v); else insert(Data, v); } + inline iterator erase(const_iterator it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } + inline iterator erase(const_iterator it, const_iterator it_last){ IM_ASSERT(it >= Data && it < Data+Size && it_last > it && it_last <= Data+Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(value_type)); Size -= (int)count; return Data + off; } + inline iterator erase_unsorted(const_iterator it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; if (it < Data+Size-1) memcpy(Data + off, Data + Size - 1, sizeof(value_type)); Size--; return Data + off; } + inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; } + inline bool contains(const value_type& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; } + inline int index_from_pointer(const_iterator it) const { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; } +}; + +// Helper: IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE() macros to call MemAlloc + Placement New, Placement Delete + MemFree +// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. +// Defining a custom placement new() with a dummy parameter allows us to bypass including which on some platforms complains when user has disabled exceptions. +struct ImNewDummy {}; +inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; } +inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symetrical new() +#define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR) +#define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE +template void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } } + +// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. +// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame"); +struct ImGuiOnceUponAFrame +{ + ImGuiOnceUponAFrame() { RefFrame = -1; } + mutable int RefFrame; + operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; } +}; + +// Helper: Macro for ImGuiOnceUponAFrame. Attention: The macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces. +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // Will obsolete +#define IMGUI_ONCE_UPON_A_FRAME static ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf) +#endif + +// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" +struct ImGuiTextFilter +{ + IMGUI_API ImGuiTextFilter(const char* default_filter = ""); + IMGUI_API bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build + IMGUI_API bool PassFilter(const char* text, const char* text_end = NULL) const; + IMGUI_API void Build(); + void Clear() { InputBuf[0] = 0; Build(); } + bool IsActive() const { return !Filters.empty(); } + + // [Internal] + struct TextRange + { + const char* b; + const char* e; + + TextRange() { b = e = NULL; } + TextRange(const char* _b, const char* _e) { b = _b; e = _e; } + const char* begin() const { return b; } + const char* end () const { return e; } + bool empty() const { return b == e; } + IMGUI_API void split(char separator, ImVector* out) const; + }; + char InputBuf[256]; + ImVector Filters; + int CountGrep; +}; + +// Helper: Growable text buffer for logging/accumulating text +// (this could be called 'ImGuiTextBuilder' / 'ImGuiStringBuilder') +struct ImGuiTextBuffer +{ + ImVector Buf; + static char EmptyString[1]; + + ImGuiTextBuffer() { } + inline char operator[](int i) { IM_ASSERT(Buf.Data != NULL); return Buf.Data[i]; } + const char* begin() const { return Buf.Data ? &Buf.front() : EmptyString; } + const char* end() const { return Buf.Data ? &Buf.back() : EmptyString; } // Buf is zero-terminated, so end() will point on the zero-terminator + int size() const { return Buf.Data ? Buf.Size - 1 : 0; } + bool empty() { return Buf.Size <= 1; } + void clear() { Buf.clear(); } + void reserve(int capacity) { Buf.reserve(capacity); } + const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; } + IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2); + IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2); +}; + +// Helper: Key->Value storage +// Typically you don't have to worry about this since a storage is held within each Window. +// We use it to e.g. store collapse state for a tree (Int 0/1) +// This is optimized for efficient lookup (dichotomy into a contiguous buffer) and rare insertion (typically tied to user interactions aka max once a frame) +// You can use it as custom user storage for temporary values. Declare your own storage if, for example: +// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). +// - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient) +// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types. +struct ImGuiStorage +{ + struct Pair + { + ImGuiID key; + union { int val_i; float val_f; void* val_p; }; + Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } + Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } + Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } + }; + ImVector Data; + + // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) + // - Set***() functions find pair, insertion on demand if missing. + // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair. + void Clear() { Data.clear(); } + IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; + IMGUI_API void SetInt(ImGuiID key, int val); + IMGUI_API bool GetBool(ImGuiID key, bool default_val = false) const; + IMGUI_API void SetBool(ImGuiID key, bool val); + IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; + IMGUI_API void SetFloat(ImGuiID key, float val); + IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL + IMGUI_API void SetVoidPtr(ImGuiID key, void* val); + + // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. + // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. + // - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct) + // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; + IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); + IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false); + IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f); + IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL); + + // Use on your own storage if you know only integer are being stored (open/close all tree nodes) + IMGUI_API void SetAllInt(int val); + + // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. + IMGUI_API void BuildSortByKey(); +}; + +// Helper: Manually clip large list of items. +// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all. +// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. +// ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null. +// Usage: +// ImGuiListClipper clipper(1000); // we have 1000 elements, evenly spaced. +// while (clipper.Step()) +// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) +// ImGui::Text("line number %d", i); +// - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor). +// - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. +// - (Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.) +// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. +struct ImGuiListClipper +{ + float StartPosY; + float ItemsHeight; + int ItemsCount, StepNo, DisplayStart, DisplayEnd; + + // items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step). + // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing(). + // If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step(). + ImGuiListClipper(int items_count = -1, float items_height = -1.0f) { Begin(items_count, items_height); } // NB: Begin() initialize every fields (as we allow user to call Begin/End multiple times on a same instance if they want). + ~ImGuiListClipper() { IM_ASSERT(ItemsCount == -1); } // Assert if user forgot to call End() or Step() until false. + + IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. + IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1. + IMGUI_API void End(); // Automatically called on the last call of Step() that returns false. +}; + +// Helpers macros to generate 32-bits encoded colors +#ifdef IMGUI_USE_BGRA_PACKED_COLOR +#define IM_COL32_R_SHIFT 16 +#define IM_COL32_G_SHIFT 8 +#define IM_COL32_B_SHIFT 0 +#define IM_COL32_A_SHIFT 24 +#define IM_COL32_A_MASK 0xFF000000 +#else +#define IM_COL32_R_SHIFT 0 +#define IM_COL32_G_SHIFT 8 +#define IM_COL32_B_SHIFT 16 +#define IM_COL32_A_SHIFT 24 +#define IM_COL32_A_MASK 0xFF000000 +#endif +#define IM_COL32(R,G,B,A) (((ImU32)(A)<>IM_COL32_R_SHIFT)&0xFF) * sc; Value.y = (float)((rgba>>IM_COL32_G_SHIFT)&0xFF) * sc; Value.z = (float)((rgba>>IM_COL32_B_SHIFT)&0xFF) * sc; Value.w = (float)((rgba>>IM_COL32_A_SHIFT)&0xFF) * sc; } + ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } + ImColor(const ImVec4& col) { Value = col; } + inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } + inline operator ImVec4() const { return Value; } + + // FIXME-OBSOLETE: May need to obsolete/cleanup those helpers. + inline void SetHSV(float h, float s, float v, float a = 1.0f){ ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; } + static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r,g,b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r,g,b,a); } +}; + +//----------------------------------------------------------------------------- +// Draw List API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListFlags, ImDrawList, ImDrawData) +// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. +//----------------------------------------------------------------------------- + +// Draw callbacks for advanced uses. +// NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering, +// you can poke into the draw list for that! Draw callback may be useful for example to: A) Change your GPU render state, +// B) render a complex 3D scene inside a UI element without an intermediate texture/render target, etc. +// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }' +typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); + +// Typically, 1 command = 1 GPU draw call (unless command is a callback) +struct ImDrawCmd +{ + unsigned int ElemCount; // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. + ImVec4 ClipRect; // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates + ImTextureID TextureId; // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas. + ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. + void* UserCallbackData; // The draw callback code can access this. + + ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = (ImTextureID)NULL; UserCallback = NULL; UserCallbackData = NULL; } +}; + +// Vertex index (override with '#define ImDrawIdx unsigned int' in imconfig.h) +#ifndef ImDrawIdx +typedef unsigned short ImDrawIdx; +#endif + +// Vertex layout +#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT +struct ImDrawVert +{ + ImVec2 pos; + ImVec2 uv; + ImU32 col; +}; +#else +// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h +// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. +// The type has to be described within the macro (you can either declare the struct or use a typedef) +// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM. +IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT; +#endif + +// Draw channels are used by the Columns API to "split" the render list into different channels while building, so items of each column can be batched together. +// You can also use them to simulate drawing layers and submit primitives in a different order than how they will be rendered. +struct ImDrawChannel +{ + ImVector CmdBuffer; + ImVector IdxBuffer; +}; + +enum ImDrawCornerFlags_ +{ + ImDrawCornerFlags_TopLeft = 1 << 0, // 0x1 + ImDrawCornerFlags_TopRight = 1 << 1, // 0x2 + ImDrawCornerFlags_BotLeft = 1 << 2, // 0x4 + ImDrawCornerFlags_BotRight = 1 << 3, // 0x8 + ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight, // 0x3 + ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight, // 0xC + ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft, // 0x5 + ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight, // 0xA + ImDrawCornerFlags_All = 0xF // In your function calls you may use ~0 (= all bits sets) instead of ImDrawCornerFlags_All, as a convenience +}; + +enum ImDrawListFlags_ +{ + ImDrawListFlags_None = 0, + ImDrawListFlags_AntiAliasedLines = 1 << 0, // Lines are anti-aliased (*2 the number of triangles for 1.0f wide line, otherwise *3 the number of triangles) + ImDrawListFlags_AntiAliasedFill = 1 << 1 // Filled shapes have anti-aliased edges (*2 the number of vertices) +}; + +// Draw command list +// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering. +// Each ImGui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to access the current window draw list and draw custom primitives. +// You can interleave normal ImGui:: calls and adding primitives to the current draw list. +// All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), but you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well) +// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects. +struct ImDrawList +{ + // This is what you have to render + ImVector CmdBuffer; // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback. + ImVector IdxBuffer; // Index buffer. Each command consume ImDrawCmd::ElemCount of those + ImVector VtxBuffer; // Vertex buffer. + ImDrawListFlags Flags; // Flags, you may poke into these to adjust anti-aliasing settings per-primitive. + + // [Internal, used while building lists] + const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context) + const char* _OwnerName; // Pointer to owner window's name for debugging + unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size + ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) + ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) + ImVector _ClipRectStack; // [Internal] + ImVector _TextureIdStack; // [Internal] + ImVector _Path; // [Internal] current path building + int _ChannelsCurrent; // [Internal] current channel number (0) + int _ChannelsCount; // [Internal] number of active channels (1+) + ImVector _Channels; // [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size) + + // If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui) + ImDrawList(const ImDrawListSharedData* shared_data) { _Data = shared_data; _OwnerName = NULL; Clear(); } + ~ImDrawList() { ClearFreeMemory(); } + IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) + IMGUI_API void PushClipRectFullScreen(); + IMGUI_API void PopClipRect(); + IMGUI_API void PushTextureID(ImTextureID texture_id); + IMGUI_API void PopTextureID(); + inline ImVec2 GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); } + inline ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); } + + // Primitives + IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); + IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All, float thickness = 1.0f); // a: upper-left, b: lower-right, rounding_corners_flags: 4-bits corresponding to which corner to round + IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); // a: upper-left, b: lower-right + IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); + IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f); + IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col); + IMGUI_API void AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness = 1.0f); + IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col); + IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12, float thickness = 1.0f); + IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12); + IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); + IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL); + IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a = ImVec2(0,0), const ImVec2& uv_b = ImVec2(1,1), ImU32 col = 0xFFFFFFFF); + IMGUI_API void AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a = ImVec2(0,0), const ImVec2& uv_b = ImVec2(1,0), const ImVec2& uv_c = ImVec2(1,1), const ImVec2& uv_d = ImVec2(0,1), ImU32 col = 0xFFFFFFFF); + IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col, float rounding, int rounding_corners = ImDrawCornerFlags_All); + IMGUI_API void AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness); + IMGUI_API void AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col); // Note: Anti-aliased filling requires points to be in clockwise order. + IMGUI_API void AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0); + + // Stateful path API, add points then finish with PathFillConvex() or PathStroke() + inline void PathClear() { _Path.resize(0); } + inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); } + inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path[_Path.Size-1], &pos, 8) != 0) _Path.push_back(pos); } + inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); PathClear(); } // Note: Anti-aliased filling requires points to be in clockwise order. + inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); PathClear(); } + IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10); + IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle + IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0); + IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); + + // Channels + // - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives) + // - Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end) + IMGUI_API void ChannelsSplit(int channels_count); + IMGUI_API void ChannelsMerge(); + IMGUI_API void ChannelsSetCurrent(int channel_index); + + // Advanced + IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles. + IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible + IMGUI_API ImDrawList* CloneOutput() const; // Create a clone of the CmdBuffer/IdxBuffer/VtxBuffer. + + // Internal helpers + // NB: all primitives needs to be reserved via PrimReserve() beforehand! + IMGUI_API void Clear(); + IMGUI_API void ClearFreeMemory(); + IMGUI_API void PrimReserve(int idx_count, int vtx_count); + IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) + IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); + IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); + inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; } + inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } + inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } + IMGUI_API void UpdateClipRect(); + IMGUI_API void UpdateTextureID(); +}; + +// All draw data to render an ImGui frame +// (NB: the style and the naming convention here is a little inconsistent but we preserve them for backward compatibility purpose) +struct ImDrawData +{ + bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. + ImDrawList** CmdLists; // Array of ImDrawList* to render. The ImDrawList are owned by ImGuiContext and only pointed to from here. + int CmdListsCount; // Number of ImDrawList* to render + int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size + int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size + ImVec2 DisplayPos; // Upper-left position of the viewport to render (== upper-left of the orthogonal projection matrix to use) + ImVec2 DisplaySize; // Size of the viewport to render (== io.DisplaySize for the main viewport) (DisplayPos + DisplaySize == lower-right of the orthogonal projection matrix to use) + + // Functions + ImDrawData() { Valid = false; Clear(); } + ~ImDrawData() { Clear(); } + void Clear() { Valid = false; CmdLists = NULL; CmdListsCount = TotalVtxCount = TotalIdxCount = 0; DisplayPos = DisplaySize = ImVec2(0.f, 0.f); } // The ImDrawList are owned by ImGuiContext! + IMGUI_API void DeIndexAllBuffers(); // Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! + IMGUI_API void ScaleClipRects(const ImVec2& sc); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. +}; + +//----------------------------------------------------------------------------- +// Font API (ImFontConfig, ImFontGlyph, ImFontAtlasFlags, ImFontAtlas, ImFont) +//----------------------------------------------------------------------------- + +struct ImFontConfig +{ + void* FontData; // // TTF/OTF data + int FontDataSize; // // TTF/OTF data size + bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). + int FontNo; // 0 // Index of font within TTF/OTF file + float SizePixels; // // Size in pixels for rasterizer (more or less maps to the resulting font height). + int OversampleH; // 3 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. + int OversampleV; // 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. + bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. + ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. + ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input. + const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font + float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs + bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. + unsigned int RasterizerFlags; // 0x00 // Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one. + float RasterizerMultiply; // 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. + + // [Internal] + char Name[40]; // Name (strictly to ease debugging) + ImFont* DstFont; + + IMGUI_API ImFontConfig(); +}; + +struct ImFontGlyph +{ + ImWchar Codepoint; // 0x0000..0xFFFF + float AdvanceX; // Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in) + float X0, Y0, X1, Y1; // Glyph corners + float U0, V0, U1, V1; // Texture coordinates +}; + +enum ImFontAtlasFlags_ +{ + ImFontAtlasFlags_None = 0, + ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two + ImFontAtlasFlags_NoMouseCursors = 1 << 1 // Don't build software mouse cursors into the atlas +}; + +// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding: +// - One or more fonts. +// - Custom graphics data needed to render the shapes needed by Dear ImGui. +// - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas). +// It is the user-code responsibility to setup/build the atlas, then upload the pixel data into a texture accessible by your graphics api. +// - Optionally, call any of the AddFont*** functions. If you don't call any, the default font embedded in the code will be loaded for you. +// - Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data. +// - Upload the pixels data into a texture within your graphics system (see imgui_impl_xxxx.cpp examples) +// - Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture in a format natural to your graphics API. +// This value will be passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details. +// Common pitfalls: +// - If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the +// atlas is build (when calling GetTexData*** or Build()). We only copy the pointer, not the data. +// - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction. +// You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed, +// - Even though many functions are suffixed with "TTF", OTF data is supported just as well. +// - This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future! +struct ImFontAtlas +{ + IMGUI_API ImFontAtlas(); + IMGUI_API ~ImFontAtlas(); + IMGUI_API ImFont* AddFont(const ImFontConfig* font_cfg); + IMGUI_API ImFont* AddFontDefault(const ImFontConfig* font_cfg = NULL); + IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); + IMGUI_API ImFont* AddFontFromMemoryTTF(void* font_data, int font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after destruction of the atlas. Set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed. + IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp. + IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter. + IMGUI_API void ClearInputData(); // Clear input data (all ImFontConfig structures including sizes, TTF data, glyph ranges, etc.) = all the data used to build the texture and fonts. + IMGUI_API void ClearTexData(); // Clear output texture data (CPU side). Saves RAM once the texture has been copied to graphics memory. + IMGUI_API void ClearFonts(); // Clear output font data (glyphs storage, UV coordinates). + IMGUI_API void Clear(); // Clear all input and output. + + // Build atlas, retrieve pixel data. + // User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID(). + // The pitch is always = Width * BytesPerPixels (1 or 4) + // Building in RGBA32 format is provided for convenience and compatibility, but note that unless you manually manipulate or copy color data into + // the texture (e.g. when using the AddCustomRect*** api), then the RGB pixels emitted will always be white (~75% of memory/bandwidth waste. + IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions. + IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel + IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel + bool IsBuilt() { return Fonts.Size > 0 && (TexPixelsAlpha8 != NULL || TexPixelsRGBA32 != NULL); } + void SetTexID(ImTextureID id) { TexID = id; } + + //------------------------------------------- + // Glyph Ranges + //------------------------------------------- + + // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) + // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. + // NB: Consider using GlyphRangesBuilder to build glyph ranges from textual data. + IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin + IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters + IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs + IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs + IMGUI_API const ImWchar* GetGlyphRangesChineseSimplifiedCommon();// Default + Half-Width + Japanese Hiragana/Katakana + set of 2500 CJK Unified Ideographs for common simplified Chinese + IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters + IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters + + // Helpers to build glyph ranges from text data. Feed your application strings/characters to it then call BuildRanges(). + struct GlyphRangesBuilder + { + ImVector UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used) + GlyphRangesBuilder() { UsedChars.resize(0x10000 / 8); memset(UsedChars.Data, 0, 0x10000 / 8); } + bool GetBit(int n) const { return (UsedChars[n >> 3] & (1 << (n & 7))) != 0; } + void SetBit(int n) { UsedChars[n >> 3] |= 1 << (n & 7); } // Set bit 'c' in the array + void AddChar(ImWchar c) { SetBit(c); } // Add character + IMGUI_API void AddText(const char* text, const char* text_end = NULL); // Add string (each character of the UTF-8 string are added) + IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext + IMGUI_API void BuildRanges(ImVector* out_ranges); // Output new ranges + }; + + //------------------------------------------- + // Custom Rectangles/Glyphs API + //------------------------------------------- + + // You can request arbitrary rectangles to be packed into the atlas, for your own purposes. After calling Build(), you can query the rectangle position and render your pixels. + // You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), so you can render e.g. custom colorful icons and use them as regular glyphs. + struct CustomRect + { + unsigned int ID; // Input // User ID. Use <0x10000 to map into a font glyph, >=0x10000 for other/internal/custom texture data. + unsigned short Width, Height; // Input // Desired rectangle dimension + unsigned short X, Y; // Output // Packed position in Atlas + float GlyphAdvanceX; // Input // For custom font glyphs only (ID<0x10000): glyph xadvance + ImVec2 GlyphOffset; // Input // For custom font glyphs only (ID<0x10000): glyph display offset + ImFont* Font; // Input // For custom font glyphs only (ID<0x10000): target font + CustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; } + bool IsPacked() const { return X != 0xFFFF; } + }; + + IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList + IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font. + const CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; } + + // [Internal] + IMGUI_API void CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max); + IMGUI_API bool GetMouseCursorTexData(ImGuiMouseCursor cursor, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]); + + //------------------------------------------- + // Members + //------------------------------------------- + + bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert. + ImFontAtlasFlags Flags; // Build flags (see ImFontAtlasFlags_) + ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure. + int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. + int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. + + // [Internal] + // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. + unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight + unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 + int TexWidth; // Texture width calculated during Build(). + int TexHeight; // Texture height calculated during Build(). + ImVec2 TexUvScale; // = (1.0f/TexWidth, 1.0f/TexHeight) + ImVec2 TexUvWhitePixel; // Texture coordinates to a white pixel + ImVector Fonts; // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font. + ImVector CustomRects; // Rectangles for packing custom texture data into the atlas. + ImVector ConfigData; // Internal data + int CustomRectIds[1]; // Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList +}; + +// Font runtime data and rendering +// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). +struct ImFont +{ + // Members: Hot ~62/78 bytes + float FontSize; // // Height of characters, set during loading (don't change after loading) + float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale() + ImVec2 DisplayOffset; // = (0.f,0.f) // Offset font rendering by xx pixels + ImVector Glyphs; // // All glyphs. + ImVector IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI). + ImVector IndexLookup; // // Sparse. Index glyphs by Unicode code-point. + const ImFontGlyph* FallbackGlyph; // == FindGlyph(FontFallbackChar) + float FallbackAdvanceX; // == FallbackGlyph->AdvanceX + ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar() + + // Members: Cold ~18/26 bytes + short ConfigDataCount; // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. + ImFontConfig* ConfigData; // // Pointer within ContainerAtlas->ConfigData + ImFontAtlas* ContainerAtlas; // // What we has been loaded into + float Ascent, Descent; // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] + bool DirtyLookupTables; + int MetricsTotalSurface;// // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs) + + // Methods + IMGUI_API ImFont(); + IMGUI_API ~ImFont(); + IMGUI_API void ClearOutputData(); + IMGUI_API void BuildLookupTable(); + IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const; + IMGUI_API const ImFontGlyph*FindGlyphNoFallback(ImWchar c) const; + IMGUI_API void SetFallbackChar(ImWchar c); + float GetCharAdvance(ImWchar c) const { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; } + bool IsLoaded() const { return ContainerAtlas != NULL; } + const char* GetDebugName() const { return ConfigData ? ConfigData->Name : ""; } + + // 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. + // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable. + IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8 + IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const; + IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const; + IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const; + + // [Internal] + IMGUI_API void GrowIndex(int new_size); + IMGUI_API void AddGlyph(ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x); + IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + typedef ImFontGlyph Glyph; // OBSOLETE 1.52+ +#endif +}; + +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) && __GNUC__ >= 8 +#pragma GCC diagnostic pop +#endif + +// Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h) +#ifdef IMGUI_INCLUDE_IMGUI_USER_H +#include "imgui_user.h" +#endif diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_demo.cpp new file mode 100644 index 00000000000..1571bda1c34 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_demo.cpp @@ -0,0 +1,3772 @@ +// dear imgui, v1.67 WIP +// (demo code) + +// Message to the person tempted to delete this file when integrating Dear ImGui into their code base: +// Do NOT remove this file from your project! Think again! It is the most useful reference code that you and other coders +// will want to refer to and call. Have the ImGui::ShowDemoWindow() function wired in an always-available debug menu of +// your game/app! Removing this file from your project is hindering access to documentation for everyone in your team, +// likely leading you to poorer usage of the library. +// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow(). +// If you want to link core Dear ImGui in your shipped builds but want an easy guarantee that the demo will not be linked, +// you can setup your imconfig.h with #define IMGUI_DISABLE_DEMO_WINDOWS and those functions will be empty. +// In other situation, whenever you have Dear ImGui available you probably want this to be available for reference. +// Thank you, +// -Your beloved friend, imgui_demo.cpp (that you won't delete) + +// Message to beginner C/C++ programmers about the meaning of the 'static' keyword: +// In this demo code, we frequently we use 'static' variables inside functions. A static variable persist across calls, so it is +// essentially like a global variable but declared inside the scope of the function. We do this as a way to gather code and data +// in the same place, to make the demo source code faster to read, faster to write, and smaller in size. +// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant +// or used in threads. This might be a pattern you will want to use in your code, but most of the real data you would be editing is +// likely going to be stored outside your functions. + +/* + +Index of this file: + +// [SECTION] Forward Declarations, Helpers +// [SECTION] Demo Window / ShowDemoWindow() +// [SECTION] About Window / ShowAboutWindow() +// [SECTION] Style Editor / ShowStyleEditor() +// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar() +// [SECTION] Example App: Debug Console / ShowExampleAppConsole() +// [SECTION] Example App: Debug Log / ShowExampleAppLog() +// [SECTION] Example App: Simple Layout / ShowExampleAppLayout() +// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor() +// [SECTION] Example App: Long Text / ShowExampleAppLongText() +// [SECTION] Example App: Auto Resize / ShowExampleAppAutoResize() +// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize() +// [SECTION] Example App: Simple Overlay / ShowExampleAppSimpleOverlay() +// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles() +// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering() + +*/ + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include "imgui.h" +#include // toupper, isprint +#include // INT_MIN, INT_MAX +#include // sqrtf, powf, cosf, sinf, floorf, ceilf +#include // vsnprintf, sscanf, printf +#include // NULL, malloc, free, atoi +#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier +#include // intptr_t +#else +#include // intptr_t +#endif + +#ifdef _MSC_VER +#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen +#define vsnprintf _vsnprintf +#endif +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code) +#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' +#pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal +#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. +#if __has_warning("-Wreserved-id-macro") +#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // +#endif +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size +#pragma GCC diagnostic ignored "-Wformat-security" // warning : format string is not a string literal (potentially insecure) +#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function +#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value +#if (__GNUC__ >= 6) +#pragma GCC diagnostic ignored "-Wmisleading-indentation" // warning: this 'if' clause does not guard this statement // GCC 6.0+ only. See #883 on GitHub. +#endif +#endif + +// Play it nice with Windows users. Notepad in 2017 still doesn't display text data with Unix-style \n. +#ifdef _WIN32 +#define IM_NEWLINE "\r\n" +#else +#define IM_NEWLINE "\n" +#endif + +#define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B)) + +//----------------------------------------------------------------------------- +// [SECTION] Forward Declarations, Helpers +//----------------------------------------------------------------------------- + +#if !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && defined(IMGUI_DISABLE_TEST_WINDOWS) && !defined(IMGUI_DISABLE_DEMO_WINDOWS) // Obsolete name since 1.53, TEST->DEMO +#define IMGUI_DISABLE_DEMO_WINDOWS +#endif + +#if !defined(IMGUI_DISABLE_DEMO_WINDOWS) + +// Forward Declarations +static void ShowExampleAppMainMenuBar(); +static void ShowExampleAppConsole(bool* p_open); +static void ShowExampleAppLog(bool* p_open); +static void ShowExampleAppLayout(bool* p_open); +static void ShowExampleAppPropertyEditor(bool* p_open); +static void ShowExampleAppLongText(bool* p_open); +static void ShowExampleAppAutoResize(bool* p_open); +static void ShowExampleAppConstrainedResize(bool* p_open); +static void ShowExampleAppSimpleOverlay(bool* p_open); +static void ShowExampleAppWindowTitles(bool* p_open); +static void ShowExampleAppCustomRendering(bool* p_open); +static void ShowExampleMenuFile(); + +// Helper to display a little (?) mark which shows a tooltip when hovered. +static void ShowHelpMarker(const char* desc) +{ + ImGui::TextDisabled("(?)"); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); + ImGui::TextUnformatted(desc); + ImGui::PopTextWrapPos(); + ImGui::EndTooltip(); + } +} + +// Helper to display basic user controls. +void ImGui::ShowUserGuide() +{ + ImGui::BulletText("Double-click on title bar to collapse window."); + ImGui::BulletText("Click and drag on lower right corner to resize window\n(double-click to auto fit window to its contents)."); + ImGui::BulletText("Click and drag on any empty space to move window."); + ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields."); + ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text."); + if (ImGui::GetIO().FontAllowUserScaling) + ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents."); + ImGui::BulletText("Mouse Wheel to scroll."); + ImGui::BulletText("While editing text:\n"); + ImGui::Indent(); + ImGui::BulletText("Hold SHIFT or use mouse to select text."); + ImGui::BulletText("CTRL+Left/Right to word jump."); + ImGui::BulletText("CTRL+A or double-click to select all."); + ImGui::BulletText("CTRL+X,CTRL+C,CTRL+V to use clipboard."); + ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo."); + ImGui::BulletText("ESCAPE to revert."); + ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract."); + ImGui::Unindent(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Demo Window / ShowDemoWindow() +//----------------------------------------------------------------------------- + +// We split the contents of the big ShowDemoWindow() function into smaller functions (because the link time of very large functions grow non-linearly) +static void ShowDemoWindowWidgets(); +static void ShowDemoWindowLayout(); +static void ShowDemoWindowPopups(); +static void ShowDemoWindowColumns(); +static void ShowDemoWindowMisc(); + +// Demonstrate most Dear ImGui features (this is big function!) +// You may execute this function to experiment with the UI and understand what it does. You may then search for keywords in the code when you are interested by a specific feature. +void ImGui::ShowDemoWindow(bool* p_open) +{ + // Examples Apps (accessible from the "Examples" menu) + static bool show_app_main_menu_bar = false; + static bool show_app_console = false; + static bool show_app_log = false; + static bool show_app_layout = false; + static bool show_app_property_editor = false; + static bool show_app_long_text = false; + static bool show_app_auto_resize = false; + static bool show_app_constrained_resize = false; + static bool show_app_simple_overlay = false; + static bool show_app_window_titles = false; + static bool show_app_custom_rendering = false; + + if (show_app_main_menu_bar) ShowExampleAppMainMenuBar(); + if (show_app_console) ShowExampleAppConsole(&show_app_console); + if (show_app_log) ShowExampleAppLog(&show_app_log); + if (show_app_layout) ShowExampleAppLayout(&show_app_layout); + if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor); + if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text); + if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize); + if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize); + if (show_app_simple_overlay) ShowExampleAppSimpleOverlay(&show_app_simple_overlay); + if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles); + if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering); + + // Dear ImGui Apps (accessible from the "Help" menu) + static bool show_app_metrics = false; + static bool show_app_style_editor = false; + static bool show_app_about = false; + + if (show_app_metrics) { ImGui::ShowMetricsWindow(&show_app_metrics); } + if (show_app_style_editor) { ImGui::Begin("Style Editor", &show_app_style_editor); ImGui::ShowStyleEditor(); ImGui::End(); } + if (show_app_about) { ImGui::ShowAboutWindow(&show_app_about); } + + // Demonstrate the various window flags. Typically you would just use the default! + static bool no_titlebar = false; + static bool no_scrollbar = false; + static bool no_menu = false; + static bool no_move = false; + static bool no_resize = false; + static bool no_collapse = false; + static bool no_close = false; + static bool no_nav = false; + static bool no_background = false; + static bool no_bring_to_front = false; + + ImGuiWindowFlags window_flags = 0; + if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar; + if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar; + if (!no_menu) window_flags |= ImGuiWindowFlags_MenuBar; + if (no_move) window_flags |= ImGuiWindowFlags_NoMove; + if (no_resize) window_flags |= ImGuiWindowFlags_NoResize; + if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse; + if (no_nav) window_flags |= ImGuiWindowFlags_NoNav; + if (no_background) window_flags |= ImGuiWindowFlags_NoBackground; + if (no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus; + if (no_close) p_open = NULL; // Don't pass our bool* to Begin + + // We specify a default position/size in case there's no data in the .ini file. Typically this isn't required! We only do it to make the Demo applications a little more welcoming. + ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver); + + // Main body of the Demo window starts here. + if (!ImGui::Begin("ImGui Demo", p_open, window_flags)) + { + // Early out if the window is collapsed, as an optimization. + ImGui::End(); + return; + } + ImGui::Text("dear imgui says hello. (%s)", IMGUI_VERSION); + + // Most "big" widgets share a common width settings by default. + //ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f); // Use 2/3 of the space for widgets and 1/3 for labels (default) + ImGui::PushItemWidth(ImGui::GetFontSize() * -12); // Use fixed width for labels (by passing a negative value), the rest goes to widgets. We choose a width proportional to our font size. + + // Menu + if (ImGui::BeginMenuBar()) + { + if (ImGui::BeginMenu("Menu")) + { + ShowExampleMenuFile(); + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Examples")) + { + ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar); + ImGui::MenuItem("Console", NULL, &show_app_console); + ImGui::MenuItem("Log", NULL, &show_app_log); + ImGui::MenuItem("Simple layout", NULL, &show_app_layout); + ImGui::MenuItem("Property editor", NULL, &show_app_property_editor); + ImGui::MenuItem("Long text display", NULL, &show_app_long_text); + ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize); + ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize); + ImGui::MenuItem("Simple overlay", NULL, &show_app_simple_overlay); + ImGui::MenuItem("Manipulating window titles", NULL, &show_app_window_titles); + ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering); + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Help")) + { + ImGui::MenuItem("Metrics", NULL, &show_app_metrics); + ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor); + ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about); + ImGui::EndMenu(); + } + ImGui::EndMenuBar(); + } + + ImGui::Spacing(); + if (ImGui::CollapsingHeader("Help")) + { + ImGui::Text("PROGRAMMER GUIDE:"); + ImGui::BulletText("Please see the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!"); + ImGui::BulletText("Please see the comments in imgui.cpp."); + ImGui::BulletText("Please see the examples/ in application."); + ImGui::BulletText("Enable 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls."); + ImGui::BulletText("Enable 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls."); + ImGui::Separator(); + + ImGui::Text("USER GUIDE:"); + ImGui::ShowUserGuide(); + } + + if (ImGui::CollapsingHeader("Configuration")) + { + ImGuiIO& io = ImGui::GetIO(); + + if (ImGui::TreeNode("Configuration##2")) + { + ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard); + ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad); + ImGui::SameLine(); ShowHelpMarker("Required back-end to feed in gamepad inputs in io.NavInputs[] and set io.BackendFlags |= ImGuiBackendFlags_HasGamepad.\n\nRead instructions in imgui.cpp for details."); + ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos); + ImGui::SameLine(); ShowHelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos."); + ImGui::CheckboxFlags("io.ConfigFlags: NoMouse", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouse); + if (io.ConfigFlags & ImGuiConfigFlags_NoMouse) // Create a way to restore this flag otherwise we could be stuck completely! + { + if (fmodf((float)ImGui::GetTime(), 0.40f) < 0.20f) + { + ImGui::SameLine(); + ImGui::Text("<>"); + } + if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space))) + io.ConfigFlags &= ~ImGuiConfigFlags_NoMouse; + } + ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange); + ImGui::SameLine(); ShowHelpMarker("Instruct back-end to not alter mouse cursor shape and visibility."); + ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink); + ImGui::SameLine(); ShowHelpMarker("Set to false to disable blinking cursor, for users who consider it distracting"); + ImGui::Checkbox("io.ConfigResizeWindowsFromEdges [beta]", &io.ConfigResizeWindowsFromEdges); + ImGui::SameLine(); ShowHelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback."); + ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor); + ImGui::SameLine(); ShowHelpMarker("Instruct Dear ImGui to render a mouse cursor for you. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something)."); + ImGui::TreePop(); + ImGui::Separator(); + } + + if (ImGui::TreeNode("Backend Flags")) + { + ImGuiBackendFlags backend_flags = io.BackendFlags; // Make a local copy to avoid modifying the back-end flags. + ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasGamepad); + ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasMouseCursors); + ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", (unsigned int *)&backend_flags, ImGuiBackendFlags_HasSetMousePos); + ImGui::TreePop(); + ImGui::Separator(); + } + + if (ImGui::TreeNode("Style")) + { + ImGui::ShowStyleEditor(); + ImGui::TreePop(); + ImGui::Separator(); + } + + if (ImGui::TreeNode("Capture/Logging")) + { + ImGui::TextWrapped("The logging API redirects all text output so you can easily capture the content of a window or a block. Tree nodes can be automatically expanded."); + ShowHelpMarker("Try opening any of the contents below in this window and then click one of the \"Log To\" button."); + ImGui::LogButtons(); + ImGui::TextWrapped("You can also call ImGui::LogText() to output directly to the log without a visual output."); + if (ImGui::Button("Copy \"Hello, world!\" to clipboard")) + { + ImGui::LogToClipboard(); + ImGui::LogText("Hello, world!"); + ImGui::LogFinish(); + } + ImGui::TreePop(); + } + } + + if (ImGui::CollapsingHeader("Window options")) + { + ImGui::Checkbox("No titlebar", &no_titlebar); ImGui::SameLine(150); + ImGui::Checkbox("No scrollbar", &no_scrollbar); ImGui::SameLine(300); + ImGui::Checkbox("No menu", &no_menu); + ImGui::Checkbox("No move", &no_move); ImGui::SameLine(150); + ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300); + ImGui::Checkbox("No collapse", &no_collapse); + ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150); + ImGui::Checkbox("No nav", &no_nav); ImGui::SameLine(300); + ImGui::Checkbox("No background", &no_background); + ImGui::Checkbox("No bring to front", &no_bring_to_front); + } + + // All demo contents + ShowDemoWindowWidgets(); + ShowDemoWindowLayout(); + ShowDemoWindowPopups(); + ShowDemoWindowColumns(); + ShowDemoWindowMisc(); + + // End of ShowDemoWindow() + ImGui::End(); +} + +static void ShowDemoWindowWidgets() +{ + if (!ImGui::CollapsingHeader("Widgets")) + return; + + if (ImGui::TreeNode("Basic")) + { + static int clicked = 0; + if (ImGui::Button("Button")) + clicked++; + if (clicked & 1) + { + ImGui::SameLine(); + ImGui::Text("Thanks for clicking me!"); + } + + static bool check = true; + ImGui::Checkbox("checkbox", &check); + + static int e = 0; + ImGui::RadioButton("radio a", &e, 0); ImGui::SameLine(); + ImGui::RadioButton("radio b", &e, 1); ImGui::SameLine(); + ImGui::RadioButton("radio c", &e, 2); + + // Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style. + for (int i = 0; i < 7; i++) + { + if (i > 0) + ImGui::SameLine(); + ImGui::PushID(i); + ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i/7.0f, 0.8f, 0.8f)); + ImGui::Button("Click"); + ImGui::PopStyleColor(3); + ImGui::PopID(); + } + + // Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements (otherwise a Text+SameLine+Button sequence will have the text a little too high by default) + ImGui::AlignTextToFramePadding(); + ImGui::Text("Hold to repeat:"); + ImGui::SameLine(); + + // Arrow buttons with Repeater + static int counter = 0; + float spacing = ImGui::GetStyle().ItemInnerSpacing.x; + ImGui::PushButtonRepeat(true); + if (ImGui::ArrowButton("##left", ImGuiDir_Left)) { counter--; } + ImGui::SameLine(0.0f, spacing); + if (ImGui::ArrowButton("##right", ImGuiDir_Right)) { counter++; } + ImGui::PopButtonRepeat(); + ImGui::SameLine(); + ImGui::Text("%d", counter); + + ImGui::Text("Hover over me"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("I am a tooltip"); + + ImGui::SameLine(); + ImGui::Text("- or me"); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + ImGui::Text("I am a fancy tooltip"); + static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; + ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr)); + ImGui::EndTooltip(); + } + + ImGui::Separator(); + + ImGui::LabelText("label", "Value"); + + { + // Using the _simplified_ one-liner Combo() api here + // See "Combo" section for examples of how to use the more complete BeginCombo()/EndCombo() api. + const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" }; + static int item_current = 0; + ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items)); + ImGui::SameLine(); ShowHelpMarker("Refer to the \"Combo\" section below for an explanation of the full BeginCombo/EndCombo API, and demonstration of various flags.\n"); + } + + { + static char str0[128] = "Hello, world!"; + static int i0 = 123; + ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0)); + ImGui::SameLine(); ShowHelpMarker("USER:\nHold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp)."); + + ImGui::InputInt("input int", &i0); + ImGui::SameLine(); ShowHelpMarker("You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n"); + + static float f0 = 0.001f; + ImGui::InputFloat("input float", &f0, 0.01f, 1.0f); + + static double d0 = 999999.00000001; + ImGui::InputDouble("input double", &d0, 0.01f, 1.0f, "%.8f"); + + static float f1 = 1.e10f; + ImGui::InputFloat("input scientific", &f1, 0.0f, 0.0f, "%e"); + ImGui::SameLine(); ShowHelpMarker("You can input value using the scientific notation,\n e.g. \"1e+8\" becomes \"100000000\".\n"); + + static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f }; + ImGui::InputFloat3("input float3", vec4a); + } + + { + static int i1 = 50, i2 = 42; + ImGui::DragInt("drag int", &i1, 1); + ImGui::SameLine(); ShowHelpMarker("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input value."); + + ImGui::DragInt("drag int 0..100", &i2, 1, 0, 100, "%d%%"); + + static float f1=1.00f, f2=0.0067f; + ImGui::DragFloat("drag float", &f1, 0.005f); + ImGui::DragFloat("drag small float", &f2, 0.0001f, 0.0f, 0.0f, "%.06f ns"); + } + + { + static int i1=0; + ImGui::SliderInt("slider int", &i1, -1, 3); + ImGui::SameLine(); ShowHelpMarker("CTRL+click to input value."); + + static float f1=0.123f, f2=0.0f; + ImGui::SliderFloat("slider float", &f1, 0.0f, 1.0f, "ratio = %.3f"); + ImGui::SliderFloat("slider float (curve)", &f2, -10.0f, 10.0f, "%.4f", 2.0f); + static float angle = 0.0f; + ImGui::SliderAngle("slider angle", &angle); + } + + { + static float col1[3] = { 1.0f,0.0f,0.2f }; + static float col2[4] = { 0.4f,0.7f,0.0f,0.5f }; + ImGui::ColorEdit3("color 1", col1); + ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nClick and hold to use drag and drop.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n"); + + ImGui::ColorEdit4("color 2", col2); + } + + { + // List box + const char* listbox_items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" }; + static int listbox_item_current = 1; + ImGui::ListBox("listbox\n(single select)", &listbox_item_current, listbox_items, IM_ARRAYSIZE(listbox_items), 4); + + //static int listbox_item_current2 = 2; + //ImGui::PushItemWidth(-1); + //ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4); + //ImGui::PopItemWidth(); + } + + ImGui::TreePop(); + } + + // Testing ImGuiOnceUponAFrame helper. + //static ImGuiOnceUponAFrame once; + //for (int i = 0; i < 5; i++) + // if (once) + // ImGui::Text("This will be displayed only once."); + + if (ImGui::TreeNode("Trees")) + { + if (ImGui::TreeNode("Basic trees")) + { + for (int i = 0; i < 5; i++) + if (ImGui::TreeNode((void*)(intptr_t)i, "Child %d", i)) + { + ImGui::Text("blah blah"); + ImGui::SameLine(); + if (ImGui::SmallButton("button")) { }; + ImGui::TreePop(); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Advanced, with Selectable nodes")) + { + ShowHelpMarker("This is a more standard looking tree with selectable nodes.\nClick to select, CTRL+Click to toggle, click on arrows or double-click to open."); + static bool align_label_with_current_x_position = false; + ImGui::Checkbox("Align label with current X position)", &align_label_with_current_x_position); + ImGui::Text("Hello!"); + if (align_label_with_current_x_position) + ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing()); + + static int selection_mask = (1 << 2); // Dumb representation of what may be user-side selection state. You may carry selection state inside or outside your objects in whatever format you see fit. + int node_clicked = -1; // Temporary storage of what node we have clicked to process selection at the end of the loop. May be a pointer to your own node type, etc. + ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, ImGui::GetFontSize()*3); // Increase spacing to differentiate leaves from expanded contents. + for (int i = 0; i < 6; i++) + { + // Disable the default open on single-click behavior and pass in Selected flag according to our selection state. + ImGuiTreeNodeFlags node_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ((selection_mask & (1 << i)) ? ImGuiTreeNodeFlags_Selected : 0); + if (i < 3) + { + // Node + bool node_open = ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Node %d", i); + if (ImGui::IsItemClicked()) + node_clicked = i; + if (node_open) + { + ImGui::Text("Blah blah\nBlah Blah"); + ImGui::TreePop(); + } + } + else + { + // Leaf: The only reason we have a TreeNode at all is to allow selection of the leaf. Otherwise we can use BulletText() or TreeAdvanceToLabelPos()+Text(). + node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet + ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Leaf %d", i); + if (ImGui::IsItemClicked()) + node_clicked = i; + } + } + if (node_clicked != -1) + { + // Update selection state. Process outside of tree loop to avoid visual inconsistencies during the clicking-frame. + if (ImGui::GetIO().KeyCtrl) + selection_mask ^= (1 << node_clicked); // CTRL+click to toggle + else //if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, this commented bit preserve selection when clicking on item that is part of the selection + selection_mask = (1 << node_clicked); // Click to single-select + } + ImGui::PopStyleVar(); + if (align_label_with_current_x_position) + ImGui::Indent(ImGui::GetTreeNodeToLabelSpacing()); + ImGui::TreePop(); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Collapsing Headers")) + { + static bool closable_group = true; + ImGui::Checkbox("Enable extra group", &closable_group); + if (ImGui::CollapsingHeader("Header")) + { + ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered()); + for (int i = 0; i < 5; i++) + ImGui::Text("Some content %d", i); + } + if (ImGui::CollapsingHeader("Header with a close button", &closable_group)) + { + ImGui::Text("IsItemHovered: %d", ImGui::IsItemHovered()); + for (int i = 0; i < 5; i++) + ImGui::Text("More content %d", i); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Bullets")) + { + ImGui::BulletText("Bullet point 1"); + ImGui::BulletText("Bullet point 2\nOn multiple lines"); + ImGui::Bullet(); ImGui::Text("Bullet point 3 (two calls)"); + ImGui::Bullet(); ImGui::SmallButton("Button"); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Text")) + { + if (ImGui::TreeNode("Colored Text")) + { + // Using shortcut. You can use PushStyleColor()/PopStyleColor() for more flexibility. + ImGui::TextColored(ImVec4(1.0f,0.0f,1.0f,1.0f), "Pink"); + ImGui::TextColored(ImVec4(1.0f,1.0f,0.0f,1.0f), "Yellow"); + ImGui::TextDisabled("Disabled"); + ImGui::SameLine(); ShowHelpMarker("The TextDisabled color is stored in ImGuiStyle."); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Word Wrapping")) + { + // Using shortcut. You can use PushTextWrapPos()/PopTextWrapPos() for more flexibility. + ImGui::TextWrapped("This text should automatically wrap on the edge of the window. The current implementation for text wrapping follows simple rules suitable for English and possibly other languages."); + ImGui::Spacing(); + + static float wrap_width = 200.0f; + ImGui::SliderFloat("Wrap width", &wrap_width, -20, 600, "%.0f"); + + ImGui::Text("Test paragraph 1:"); + ImVec2 pos = ImGui::GetCursorScreenPos(); + ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255)); + ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); + ImGui::Text("The lazy dog is a good dog. This paragraph is made to fit within %.0f pixels. Testing a 1 character word. The quick brown fox jumps over the lazy dog.", wrap_width); + ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255)); + ImGui::PopTextWrapPos(); + + ImGui::Text("Test paragraph 2:"); + pos = ImGui::GetCursorScreenPos(); + ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255)); + ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); + ImGui::Text("aaaaaaaa bbbbbbbb, c cccccccc,dddddddd. d eeeeeeee ffffffff. gggggggg!hhhhhhhh"); + ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255)); + ImGui::PopTextWrapPos(); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("UTF-8 Text")) + { + // UTF-8 test with Japanese characters + // (Needs a suitable font, try Noto, or Arial Unicode, or M+ fonts. Read misc/fonts/README.txt for details.) + // - From C++11 you can use the u8"my text" syntax to encode literal strings as UTF-8 + // - For earlier compiler, you may be able to encode your sources as UTF-8 (e.g. Visual Studio save your file as 'UTF-8 without signature') + // - FOR THIS DEMO FILE ONLY, BECAUSE WE WANT TO SUPPORT OLD COMPILERS, WE ARE *NOT* INCLUDING RAW UTF-8 CHARACTERS IN THIS SOURCE FILE. + // Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application! + // Please use u8"text in any language" in your application! + // Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application. + ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details."); + ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string. + ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)"); + static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"; + //static char buf[32] = u8"NIHONGO"; // <- this is how you would write it with C++11, using real kanjis + ImGui::InputText("UTF-8 input", buf, IM_ARRAYSIZE(buf)); + ImGui::TreePop(); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Images")) + { + ImGuiIO& io = ImGui::GetIO(); + ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!"); + + // Here we are grabbing the font texture because that's the only one we have access to inside the demo code. + // Remember that ImTextureID is just storage for whatever you want it to be, it is essentially a value that will be passed to the render function inside the ImDrawCmd structure. + // If you use one of the default imgui_impl_XXXX.cpp renderer, they all have comments at the top of their file to specify what they expect to be stored in ImTextureID. + // (for example, the imgui_impl_dx11.cpp renderer expect a 'ID3D11ShaderResourceView*' pointer. The imgui_impl_glfw_gl3.cpp renderer expect a GLuint OpenGL texture identifier etc.) + // If you decided that ImTextureID = MyEngineTexture*, then you can pass your MyEngineTexture* pointers to ImGui::Image(), and gather width/height through your own functions, etc. + // Using ShowMetricsWindow() as a "debugger" to inspect the draw data that are being passed to your render will help you debug issues if you are confused about this. + // Consider using the lower-level ImDrawList::AddImage() API, via ImGui::GetWindowDrawList()->AddImage(). + ImTextureID my_tex_id = io.Fonts->TexID; + float my_tex_w = (float)io.Fonts->TexWidth; + float my_tex_h = (float)io.Fonts->TexHeight; + + ImGui::Text("%.0fx%.0f", my_tex_w, my_tex_h); + ImVec2 pos = ImGui::GetCursorScreenPos(); + ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), ImVec2(0,0), ImVec2(1,1), ImColor(255,255,255,255), ImColor(255,255,255,128)); + if (ImGui::IsItemHovered()) + { + ImGui::BeginTooltip(); + float region_sz = 32.0f; + float region_x = io.MousePos.x - pos.x - region_sz * 0.5f; if (region_x < 0.0f) region_x = 0.0f; else if (region_x > my_tex_w - region_sz) region_x = my_tex_w - region_sz; + float region_y = io.MousePos.y - pos.y - region_sz * 0.5f; if (region_y < 0.0f) region_y = 0.0f; else if (region_y > my_tex_h - region_sz) region_y = my_tex_h - region_sz; + float zoom = 4.0f; + ImGui::Text("Min: (%.2f, %.2f)", region_x, region_y); + ImGui::Text("Max: (%.2f, %.2f)", region_x + region_sz, region_y + region_sz); + ImVec2 uv0 = ImVec2((region_x) / my_tex_w, (region_y) / my_tex_h); + ImVec2 uv1 = ImVec2((region_x + region_sz) / my_tex_w, (region_y + region_sz) / my_tex_h); + ImGui::Image(my_tex_id, ImVec2(region_sz * zoom, region_sz * zoom), uv0, uv1, ImColor(255,255,255,255), ImColor(255,255,255,128)); + ImGui::EndTooltip(); + } + ImGui::TextWrapped("And now some textured buttons.."); + static int pressed_count = 0; + for (int i = 0; i < 8; i++) + { + ImGui::PushID(i); + int frame_padding = -1 + i; // -1 = uses default padding + if (ImGui::ImageButton(my_tex_id, ImVec2(32,32), ImVec2(0,0), ImVec2(32.0f/my_tex_w,32/my_tex_h), frame_padding, ImColor(0,0,0,255))) + pressed_count += 1; + ImGui::PopID(); + ImGui::SameLine(); + } + ImGui::NewLine(); + ImGui::Text("Pressed %d times.", pressed_count); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Combo")) + { + // Expose flags as checkbox for the demo + static ImGuiComboFlags flags = 0; + ImGui::CheckboxFlags("ImGuiComboFlags_PopupAlignLeft", (unsigned int*)&flags, ImGuiComboFlags_PopupAlignLeft); + if (ImGui::CheckboxFlags("ImGuiComboFlags_NoArrowButton", (unsigned int*)&flags, ImGuiComboFlags_NoArrowButton)) + flags &= ~ImGuiComboFlags_NoPreview; // Clear the other flag, as we cannot combine both + if (ImGui::CheckboxFlags("ImGuiComboFlags_NoPreview", (unsigned int*)&flags, ImGuiComboFlags_NoPreview)) + flags &= ~ImGuiComboFlags_NoArrowButton; // Clear the other flag, as we cannot combine both + + // General BeginCombo() API, you have full control over your selection data and display type. + // (your selection data could be an index, a pointer to the object, an id for the object, a flag stored in the object itself, etc.) + const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" }; + static const char* item_current = items[0]; // Here our selection is a single pointer stored outside the object. + if (ImGui::BeginCombo("combo 1", item_current, flags)) // The second parameter is the label previewed before opening the combo. + { + for (int n = 0; n < IM_ARRAYSIZE(items); n++) + { + bool is_selected = (item_current == items[n]); + if (ImGui::Selectable(items[n], is_selected)) + item_current = items[n]; + if (is_selected) + ImGui::SetItemDefaultFocus(); // Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch) + } + ImGui::EndCombo(); + } + + // Simplified one-liner Combo() API, using values packed in a single constant string + static int item_current_2 = 0; + ImGui::Combo("combo 2 (one-liner)", &item_current_2, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0"); + + // Simplified one-liner Combo() using an array of const char* + static int item_current_3 = -1; // If the selection isn't within 0..count, Combo won't display a preview + ImGui::Combo("combo 3 (array)", &item_current_3, items, IM_ARRAYSIZE(items)); + + // Simplified one-liner Combo() using an accessor function + struct FuncHolder { static bool ItemGetter(void* data, int idx, const char** out_str) { *out_str = ((const char**)data)[idx]; return true; } }; + static int item_current_4 = 0; + ImGui::Combo("combo 4 (function)", &item_current_4, &FuncHolder::ItemGetter, items, IM_ARRAYSIZE(items)); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Selectables")) + { + // Selectable() has 2 overloads: + // - The one taking "bool selected" as a read-only selection information. When Selectable() has been clicked is returns true and you can alter selection state accordingly. + // - The one taking "bool* p_selected" as a read-write selection information (convenient in some cases) + // The earlier is more flexible, as in real application your selection may be stored in a different manner (in flags within objects, as an external list, etc). + if (ImGui::TreeNode("Basic")) + { + static bool selection[5] = { false, true, false, false, false }; + ImGui::Selectable("1. I am selectable", &selection[0]); + ImGui::Selectable("2. I am selectable", &selection[1]); + ImGui::Text("3. I am not selectable"); + ImGui::Selectable("4. I am selectable", &selection[3]); + if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick)) + if (ImGui::IsMouseDoubleClicked(0)) + selection[4] = !selection[4]; + ImGui::TreePop(); + } + if (ImGui::TreeNode("Selection State: Single Selection")) + { + static int selected = -1; + for (int n = 0; n < 5; n++) + { + char buf[32]; + sprintf(buf, "Object %d", n); + if (ImGui::Selectable(buf, selected == n)) + selected = n; + } + ImGui::TreePop(); + } + if (ImGui::TreeNode("Selection State: Multiple Selection")) + { + ShowHelpMarker("Hold CTRL and click to select multiple items."); + static bool selection[5] = { false, false, false, false, false }; + for (int n = 0; n < 5; n++) + { + char buf[32]; + sprintf(buf, "Object %d", n); + if (ImGui::Selectable(buf, selection[n])) + { + if (!ImGui::GetIO().KeyCtrl) // Clear selection when CTRL is not held + memset(selection, 0, sizeof(selection)); + selection[n] ^= 1; + } + } + ImGui::TreePop(); + } + if (ImGui::TreeNode("Rendering more text into the same line")) + { + // Using the Selectable() override that takes "bool* p_selected" parameter and toggle your booleans automatically. + static bool selected[3] = { false, false, false }; + ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes"); + ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes"); + ImGui::Selectable("Hello.h", &selected[2]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes"); + ImGui::TreePop(); + } + if (ImGui::TreeNode("In columns")) + { + ImGui::Columns(3, NULL, false); + static bool selected[16] = { 0 }; + for (int i = 0; i < 16; i++) + { + char label[32]; sprintf(label, "Item %d", i); + if (ImGui::Selectable(label, &selected[i])) {} + ImGui::NextColumn(); + } + ImGui::Columns(1); + ImGui::TreePop(); + } + if (ImGui::TreeNode("Grid")) + { + static bool selected[16] = { true, false, false, false, false, true, false, false, false, false, true, false, false, false, false, true }; + for (int i = 0; i < 16; i++) + { + ImGui::PushID(i); + if (ImGui::Selectable("Sailor", &selected[i], 0, ImVec2(50,50))) + { + int x = i % 4, y = i / 4; + if (x > 0) selected[i - 1] ^= 1; + if (x < 3) selected[i + 1] ^= 1; + if (y > 0) selected[i - 4] ^= 1; + if (y < 3) selected[i + 4] ^= 1; + } + if ((i % 4) < 3) ImGui::SameLine(); + ImGui::PopID(); + } + ImGui::TreePop(); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Filtered Text Input")) + { + static char buf1[64] = ""; ImGui::InputText("default", buf1, 64); + static char buf2[64] = ""; ImGui::InputText("decimal", buf2, 64, ImGuiInputTextFlags_CharsDecimal); + static char buf3[64] = ""; ImGui::InputText("hexadecimal", buf3, 64, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); + static char buf4[64] = ""; ImGui::InputText("uppercase", buf4, 64, ImGuiInputTextFlags_CharsUppercase); + static char buf5[64] = ""; ImGui::InputText("no blank", buf5, 64, ImGuiInputTextFlags_CharsNoBlank); + struct TextFilters { static int FilterImGuiLetters(ImGuiInputTextCallbackData* data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) return 0; return 1; } }; + static char buf6[64] = ""; ImGui::InputText("\"imgui\" letters", buf6, 64, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters); + + ImGui::Text("Password input"); + static char bufpass[64] = "password123"; + ImGui::InputText("password", bufpass, 64, ImGuiInputTextFlags_Password | ImGuiInputTextFlags_CharsNoBlank); + ImGui::SameLine(); ShowHelpMarker("Display all characters as '*'.\nDisable clipboard cut and copy.\nDisable logging.\n"); + ImGui::InputText("password (clear)", bufpass, 64, ImGuiInputTextFlags_CharsNoBlank); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Multi-line Text Input")) + { + // Note: we are using a fixed-sized buffer for simplicity here. See ImGuiInputTextFlags_CallbackResize + // and the code in misc/cpp/imgui_stdlib.h for how to setup InputText() for dynamically resizing strings. + static bool read_only = false; + static char text[1024*16] = + "/*\n" + " The Pentium F00F bug, shorthand for F0 0F C7 C8,\n" + " the hexadecimal encoding of one offending instruction,\n" + " more formally, the invalid operand with locked CMPXCHG8B\n" + " instruction bug, is a design flaw in the majority of\n" + " Intel Pentium, Pentium MMX, and Pentium OverDrive\n" + " processors (all in the P5 microarchitecture).\n" + "*/\n\n" + "label:\n" + "\tlock cmpxchg8b eax\n"; + + ShowHelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. (This is not demonstrated in imgui_demo.cpp)"); + ImGui::Checkbox("Read-only", &read_only); + ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput | (read_only ? ImGuiInputTextFlags_ReadOnly : 0); + ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16), flags); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Plots Widgets")) + { + static bool animate = true; + ImGui::Checkbox("Animate", &animate); + + static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; + ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr)); + + // Create a dummy array of contiguous float values to plot + // Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float and the sizeof() of your structure in the Stride parameter. + static float values[90] = { 0 }; + static int values_offset = 0; + static double refresh_time = 0.0; + if (!animate || refresh_time == 0.0f) + refresh_time = ImGui::GetTime(); + while (refresh_time < ImGui::GetTime()) // Create dummy data at fixed 60 hz rate for the demo + { + static float phase = 0.0f; + values[values_offset] = cosf(phase); + values_offset = (values_offset+1) % IM_ARRAYSIZE(values); + phase += 0.10f*values_offset; + refresh_time += 1.0f/60.0f; + } + ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, "avg 0.0", -1.0f, 1.0f, ImVec2(0,80)); + ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0,80)); + + // Use functions to generate output + // FIXME: This is rather awkward because current plot API only pass in indices. We probably want an API passing floats and user provide sample rate/count. + struct Funcs + { + static float Sin(void*, int i) { return sinf(i * 0.1f); } + static float Saw(void*, int i) { return (i & 1) ? 1.0f : -1.0f; } + }; + static int func_type = 0, display_count = 70; + ImGui::Separator(); + ImGui::PushItemWidth(100); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::PopItemWidth(); + ImGui::SameLine(); + ImGui::SliderInt("Sample count", &display_count, 1, 400); + float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw; + ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); + ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); + ImGui::Separator(); + + // Animate a simple progress bar + static float progress = 0.0f, progress_dir = 1.0f; + if (animate) + { + progress += progress_dir * 0.4f * ImGui::GetIO().DeltaTime; + if (progress >= +1.1f) { progress = +1.1f; progress_dir *= -1.0f; } + if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; } + } + + // Typically we would use ImVec2(-1.0f,0.0f) to use all available width, or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth. + ImGui::ProgressBar(progress, ImVec2(0.0f,0.0f)); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::Text("Progress Bar"); + + float progress_saturated = (progress < 0.0f) ? 0.0f : (progress > 1.0f) ? 1.0f : progress; + char buf[32]; + sprintf(buf, "%d/%d", (int)(progress_saturated*1753), 1753); + ImGui::ProgressBar(progress, ImVec2(0.f,0.f), buf); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Color/Picker Widgets")) + { + static ImVec4 color = ImColor(114, 144, 154, 200); + + static bool alpha_preview = true; + static bool alpha_half_preview = false; + static bool drag_and_drop = true; + static bool options_menu = true; + static bool hdr = false; + ImGui::Checkbox("With Alpha Preview", &alpha_preview); + ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview); + ImGui::Checkbox("With Drag and Drop", &drag_and_drop); + ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options."); + ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets."); + int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions); + + ImGui::Text("Color widget:"); + ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nCTRL+click on individual component to input value.\n"); + ImGui::ColorEdit3("MyColor##1", (float*)&color, misc_flags); + + ImGui::Text("Color widget HSV with Alpha:"); + ImGui::ColorEdit4("MyColor##2", (float*)&color, ImGuiColorEditFlags_HSV | misc_flags); + + ImGui::Text("Color widget with Float Display:"); + ImGui::ColorEdit4("MyColor##2f", (float*)&color, ImGuiColorEditFlags_Float | misc_flags); + + ImGui::Text("Color button with Picker:"); + ImGui::SameLine(); ShowHelpMarker("With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\nWith the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only be used for the tooltip and picker popup."); + ImGui::ColorEdit4("MyColor##3", (float*)&color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | misc_flags); + + ImGui::Text("Color button with Custom Picker Popup:"); + + // Generate a dummy palette + static bool saved_palette_inited = false; + static ImVec4 saved_palette[32]; + if (!saved_palette_inited) + for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++) + { + ImGui::ColorConvertHSVtoRGB(n / 31.0f, 0.8f, 0.8f, saved_palette[n].x, saved_palette[n].y, saved_palette[n].z); + saved_palette[n].w = 1.0f; // Alpha + } + saved_palette_inited = true; + + static ImVec4 backup_color; + bool open_popup = ImGui::ColorButton("MyColor##3b", color, misc_flags); + ImGui::SameLine(); + open_popup |= ImGui::Button("Palette"); + if (open_popup) + { + ImGui::OpenPopup("mypicker"); + backup_color = color; + } + if (ImGui::BeginPopup("mypicker")) + { + // FIXME: Adding a drag and drop example here would be perfect! + ImGui::Text("MY CUSTOM COLOR PICKER WITH AN AMAZING PALETTE!"); + ImGui::Separator(); + ImGui::ColorPicker4("##picker", (float*)&color, misc_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview); + ImGui::SameLine(); + ImGui::BeginGroup(); + ImGui::Text("Current"); + ImGui::ColorButton("##current", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60,40)); + ImGui::Text("Previous"); + if (ImGui::ColorButton("##previous", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60,40))) + color = backup_color; + ImGui::Separator(); + ImGui::Text("Palette"); + for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++) + { + ImGui::PushID(n); + if ((n % 8) != 0) + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y); + if (ImGui::ColorButton("##palette", saved_palette[n], ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoTooltip, ImVec2(20,20))) + color = ImVec4(saved_palette[n].x, saved_palette[n].y, saved_palette[n].z, color.w); // Preserve alpha! + + if (ImGui::BeginDragDropTarget()) + { + if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F)) + memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 3); + if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F)) + memcpy((float*)&saved_palette[n], payload->Data, sizeof(float) * 4); + ImGui::EndDragDropTarget(); + } + + ImGui::PopID(); + } + ImGui::EndGroup(); + ImGui::EndPopup(); + } + + ImGui::Text("Color button only:"); + ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags, ImVec2(80,80)); + + ImGui::Text("Color picker:"); + static bool alpha = true; + static bool alpha_bar = true; + static bool side_preview = true; + static bool ref_color = false; + static ImVec4 ref_color_v(1.0f,0.0f,1.0f,0.5f); + static int inputs_mode = 2; + static int picker_mode = 0; + ImGui::Checkbox("With Alpha", &alpha); + ImGui::Checkbox("With Alpha Bar", &alpha_bar); + ImGui::Checkbox("With Side Preview", &side_preview); + if (side_preview) + { + ImGui::SameLine(); + ImGui::Checkbox("With Ref Color", &ref_color); + if (ref_color) + { + ImGui::SameLine(); + ImGui::ColorEdit4("##RefColor", &ref_color_v.x, ImGuiColorEditFlags_NoInputs | misc_flags); + } + } + ImGui::Combo("Inputs Mode", &inputs_mode, "All Inputs\0No Inputs\0RGB Input\0HSV Input\0HEX Input\0"); + ImGui::Combo("Picker Mode", &picker_mode, "Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0"); + ImGui::SameLine(); ShowHelpMarker("User can right-click the picker to change mode."); + ImGuiColorEditFlags flags = misc_flags; + if (!alpha) flags |= ImGuiColorEditFlags_NoAlpha; // This is by default if you call ColorPicker3() instead of ColorPicker4() + if (alpha_bar) flags |= ImGuiColorEditFlags_AlphaBar; + if (!side_preview) flags |= ImGuiColorEditFlags_NoSidePreview; + if (picker_mode == 1) flags |= ImGuiColorEditFlags_PickerHueBar; + if (picker_mode == 2) flags |= ImGuiColorEditFlags_PickerHueWheel; + if (inputs_mode == 1) flags |= ImGuiColorEditFlags_NoInputs; + if (inputs_mode == 2) flags |= ImGuiColorEditFlags_RGB; + if (inputs_mode == 3) flags |= ImGuiColorEditFlags_HSV; + if (inputs_mode == 4) flags |= ImGuiColorEditFlags_HEX; + ImGui::ColorPicker4("MyColor##4", (float*)&color, flags, ref_color ? &ref_color_v.x : NULL); + + ImGui::Text("Programmatically set defaults:"); + ImGui::SameLine(); ShowHelpMarker("SetColorEditOptions() is designed to allow you to set boot-time default.\nWe don't have Push/Pop functions because you can force options on a per-widget basis if needed, and the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid encouraging you to persistently save values that aren't forward-compatible."); + if (ImGui::Button("Default: Uint8 + HSV + Hue Bar")) + ImGui::SetColorEditOptions(ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_HSV | ImGuiColorEditFlags_PickerHueBar); + if (ImGui::Button("Default: Float + HDR + Hue Wheel")) + ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_PickerHueWheel); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Range Widgets")) + { + static float begin = 10, end = 90; + static int begin_i = 100, end_i = 1000; + ImGui::DragFloatRange2("range", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%"); + ImGui::DragIntRange2("range int (no bounds)", &begin_i, &end_i, 5, 0, 0, "Min: %d units", "Max: %d units"); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Data Types")) + { + // The DragScalar/InputScalar/SliderScalar functions allow various data types: signed/unsigned int/long long and float/double + // To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum to pass the type, + // and passing all arguments by address. + // This is the reason the test code below creates local variables to hold "zero" "one" etc. for each types. + // In practice, if you frequently use a given type that is not covered by the normal API entry points, you can wrap it + // yourself inside a 1 line function which can take typed argument as value instead of void*, and then pass their address + // to the generic function. For example: + // bool MySliderU64(const char *label, u64* value, u64 min = 0, u64 max = 0, const char* format = "%lld") + // { + // return SliderScalar(label, ImGuiDataType_U64, value, &min, &max, format); + // } + + // Limits (as helper variables that we can take the address of) + // Note that the SliderScalar function has a maximum usable range of half the natural type maximum, hence the /2 below. + #ifndef LLONG_MIN + ImS64 LLONG_MIN = -9223372036854775807LL - 1; + ImS64 LLONG_MAX = 9223372036854775807LL; + ImU64 ULLONG_MAX = (2ULL * 9223372036854775807LL + 1); + #endif + const ImS32 s32_zero = 0, s32_one = 1, s32_fifty = 50, s32_min = INT_MIN/2, s32_max = INT_MAX/2, s32_hi_a = INT_MAX/2 - 100, s32_hi_b = INT_MAX/2; + const ImU32 u32_zero = 0, u32_one = 1, u32_fifty = 50, u32_min = 0, u32_max = UINT_MAX/2, u32_hi_a = UINT_MAX/2 - 100, u32_hi_b = UINT_MAX/2; + const ImS64 s64_zero = 0, s64_one = 1, s64_fifty = 50, s64_min = LLONG_MIN/2, s64_max = LLONG_MAX/2, s64_hi_a = LLONG_MAX/2 - 100, s64_hi_b = LLONG_MAX/2; + const ImU64 u64_zero = 0, u64_one = 1, u64_fifty = 50, u64_min = 0, u64_max = ULLONG_MAX/2, u64_hi_a = ULLONG_MAX/2 - 100, u64_hi_b = ULLONG_MAX/2; + const float f32_zero = 0.f, f32_one = 1.f, f32_lo_a = -10000000000.0f, f32_hi_a = +10000000000.0f; + const double f64_zero = 0., f64_one = 1., f64_lo_a = -1000000000000000.0, f64_hi_a = +1000000000000000.0; + + // State + static ImS32 s32_v = -1; + static ImU32 u32_v = (ImU32)-1; + static ImS64 s64_v = -1; + static ImU64 u64_v = (ImU64)-1; + static float f32_v = 0.123f; + static double f64_v = 90000.01234567890123456789; + + const float drag_speed = 0.2f; + static bool drag_clamp = false; + ImGui::Text("Drags:"); + ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp); ImGui::SameLine(); ShowHelpMarker("As with every widgets in dear imgui, we never modify values unless there is a user interaction.\nYou can override the clamping limits by using CTRL+Click to input a value."); + ImGui::DragScalar("drag s32", ImGuiDataType_S32, &s32_v, drag_speed, drag_clamp ? &s32_zero : NULL, drag_clamp ? &s32_fifty : NULL); + ImGui::DragScalar("drag u32", ImGuiDataType_U32, &u32_v, drag_speed, drag_clamp ? &u32_zero : NULL, drag_clamp ? &u32_fifty : NULL, "%u ms"); + ImGui::DragScalar("drag s64", ImGuiDataType_S64, &s64_v, drag_speed, drag_clamp ? &s64_zero : NULL, drag_clamp ? &s64_fifty : NULL); + ImGui::DragScalar("drag u64", ImGuiDataType_U64, &u64_v, drag_speed, drag_clamp ? &u64_zero : NULL, drag_clamp ? &u64_fifty : NULL); + ImGui::DragScalar("drag float", ImGuiDataType_Float, &f32_v, 0.005f, &f32_zero, &f32_one, "%f", 1.0f); + ImGui::DragScalar("drag float ^2", ImGuiDataType_Float, &f32_v, 0.005f, &f32_zero, &f32_one, "%f", 2.0f); ImGui::SameLine(); ShowHelpMarker("You can use the 'power' parameter to increase tweaking precision on one side of the range."); + ImGui::DragScalar("drag double", ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, NULL, "%.10f grams", 1.0f); + ImGui::DragScalar("drag double ^2", ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, &f64_one, "0 < %.10f < 1", 2.0f); + + ImGui::Text("Sliders"); + ImGui::SliderScalar("slider s32 low", ImGuiDataType_S32, &s32_v, &s32_zero, &s32_fifty,"%d"); + ImGui::SliderScalar("slider s32 high", ImGuiDataType_S32, &s32_v, &s32_hi_a, &s32_hi_b, "%d"); + ImGui::SliderScalar("slider s32 full", ImGuiDataType_S32, &s32_v, &s32_min, &s32_max, "%d"); + ImGui::SliderScalar("slider u32 low", ImGuiDataType_U32, &u32_v, &u32_zero, &u32_fifty,"%u"); + ImGui::SliderScalar("slider u32 high", ImGuiDataType_U32, &u32_v, &u32_hi_a, &u32_hi_b, "%u"); + ImGui::SliderScalar("slider u32 full", ImGuiDataType_U32, &u32_v, &u32_min, &u32_max, "%u"); + ImGui::SliderScalar("slider s64 low", ImGuiDataType_S64, &s64_v, &s64_zero, &s64_fifty,"%I64d"); + ImGui::SliderScalar("slider s64 high", ImGuiDataType_S64, &s64_v, &s64_hi_a, &s64_hi_b, "%I64d"); + ImGui::SliderScalar("slider s64 full", ImGuiDataType_S64, &s64_v, &s64_min, &s64_max, "%I64d"); + ImGui::SliderScalar("slider u64 low", ImGuiDataType_U64, &u64_v, &u64_zero, &u64_fifty,"%I64u ms"); + ImGui::SliderScalar("slider u64 high", ImGuiDataType_U64, &u64_v, &u64_hi_a, &u64_hi_b, "%I64u ms"); + ImGui::SliderScalar("slider u64 full", ImGuiDataType_U64, &u64_v, &u64_min, &u64_max, "%I64u ms"); + ImGui::SliderScalar("slider float low", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one); + ImGui::SliderScalar("slider float low^2", ImGuiDataType_Float, &f32_v, &f32_zero, &f32_one, "%.10f", 2.0f); + ImGui::SliderScalar("slider float high", ImGuiDataType_Float, &f32_v, &f32_lo_a, &f32_hi_a, "%e"); + ImGui::SliderScalar("slider double low", ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f grams", 1.0f); + ImGui::SliderScalar("slider double low^2",ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f", 2.0f); + ImGui::SliderScalar("slider double high", ImGuiDataType_Double, &f64_v, &f64_lo_a, &f64_hi_a, "%e grams", 1.0f); + + static bool inputs_step = true; + ImGui::Text("Inputs"); + ImGui::Checkbox("Show step buttons", &inputs_step); + ImGui::InputScalar("input s32", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%d"); + ImGui::InputScalar("input s32 hex", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%08X", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("input u32", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%u"); + ImGui::InputScalar("input u32 hex", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%08X", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("input s64", ImGuiDataType_S64, &s64_v, inputs_step ? &s64_one : NULL); + ImGui::InputScalar("input u64", ImGuiDataType_U64, &u64_v, inputs_step ? &u64_one : NULL); + ImGui::InputScalar("input float", ImGuiDataType_Float, &f32_v, inputs_step ? &f32_one : NULL); + ImGui::InputScalar("input double", ImGuiDataType_Double, &f64_v, inputs_step ? &f64_one : NULL); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Multi-component Widgets")) + { + static float vec4f[4] = { 0.10f, 0.20f, 0.30f, 0.44f }; + static int vec4i[4] = { 1, 5, 100, 255 }; + + ImGui::InputFloat2("input float2", vec4f); + ImGui::DragFloat2("drag float2", vec4f, 0.01f, 0.0f, 1.0f); + ImGui::SliderFloat2("slider float2", vec4f, 0.0f, 1.0f); + ImGui::InputInt2("input int2", vec4i); + ImGui::DragInt2("drag int2", vec4i, 1, 0, 255); + ImGui::SliderInt2("slider int2", vec4i, 0, 255); + ImGui::Spacing(); + + ImGui::InputFloat3("input float3", vec4f); + ImGui::DragFloat3("drag float3", vec4f, 0.01f, 0.0f, 1.0f); + ImGui::SliderFloat3("slider float3", vec4f, 0.0f, 1.0f); + ImGui::InputInt3("input int3", vec4i); + ImGui::DragInt3("drag int3", vec4i, 1, 0, 255); + ImGui::SliderInt3("slider int3", vec4i, 0, 255); + ImGui::Spacing(); + + ImGui::InputFloat4("input float4", vec4f); + ImGui::DragFloat4("drag float4", vec4f, 0.01f, 0.0f, 1.0f); + ImGui::SliderFloat4("slider float4", vec4f, 0.0f, 1.0f); + ImGui::InputInt4("input int4", vec4i); + ImGui::DragInt4("drag int4", vec4i, 1, 0, 255); + ImGui::SliderInt4("slider int4", vec4i, 0, 255); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Vertical Sliders")) + { + const float spacing = 4; + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(spacing, spacing)); + + static int int_value = 0; + ImGui::VSliderInt("##int", ImVec2(18,160), &int_value, 0, 5); + ImGui::SameLine(); + + static float values[7] = { 0.0f, 0.60f, 0.35f, 0.9f, 0.70f, 0.20f, 0.0f }; + ImGui::PushID("set1"); + for (int i = 0; i < 7; i++) + { + if (i > 0) ImGui::SameLine(); + ImGui::PushID(i); + ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4)ImColor::HSV(i/7.0f, 0.5f, 0.5f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.5f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.5f)); + ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i/7.0f, 0.9f, 0.9f)); + ImGui::VSliderFloat("##v", ImVec2(18,160), &values[i], 0.0f, 1.0f, ""); + if (ImGui::IsItemActive() || ImGui::IsItemHovered()) + ImGui::SetTooltip("%.3f", values[i]); + ImGui::PopStyleColor(4); + ImGui::PopID(); + } + ImGui::PopID(); + + ImGui::SameLine(); + ImGui::PushID("set2"); + static float values2[4] = { 0.20f, 0.80f, 0.40f, 0.25f }; + const int rows = 3; + const ImVec2 small_slider_size(18, (160.0f-(rows-1)*spacing)/rows); + for (int nx = 0; nx < 4; nx++) + { + if (nx > 0) ImGui::SameLine(); + ImGui::BeginGroup(); + for (int ny = 0; ny < rows; ny++) + { + ImGui::PushID(nx*rows+ny); + ImGui::VSliderFloat("##v", small_slider_size, &values2[nx], 0.0f, 1.0f, ""); + if (ImGui::IsItemActive() || ImGui::IsItemHovered()) + ImGui::SetTooltip("%.3f", values2[nx]); + ImGui::PopID(); + } + ImGui::EndGroup(); + } + ImGui::PopID(); + + ImGui::SameLine(); + ImGui::PushID("set3"); + for (int i = 0; i < 4; i++) + { + if (i > 0) ImGui::SameLine(); + ImGui::PushID(i); + ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40); + ImGui::VSliderFloat("##v", ImVec2(40,160), &values[i], 0.0f, 1.0f, "%.2f\nsec"); + ImGui::PopStyleVar(); + ImGui::PopID(); + } + ImGui::PopID(); + ImGui::PopStyleVar(); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Drag and Drop")) + { + { + // ColorEdit widgets automatically act as drag source and drag target. + // They are using standardized payload strings IMGUI_PAYLOAD_TYPE_COLOR_3F and IMGUI_PAYLOAD_TYPE_COLOR_4F to allow your own widgets + // to use colors in their drag and drop interaction. Also see the demo in Color Picker -> Palette demo. + ImGui::BulletText("Drag and drop in standard widgets"); + ImGui::Indent(); + static float col1[3] = { 1.0f,0.0f,0.2f }; + static float col2[4] = { 0.4f,0.7f,0.0f,0.5f }; + ImGui::ColorEdit3("color 1", col1); + ImGui::ColorEdit4("color 2", col2); + ImGui::Unindent(); + } + + { + ImGui::BulletText("Drag and drop to copy/swap items"); + ImGui::Indent(); + enum Mode + { + Mode_Copy, + Mode_Move, + Mode_Swap + }; + static int mode = 0; + if (ImGui::RadioButton("Copy", mode == Mode_Copy)) { mode = Mode_Copy; } ImGui::SameLine(); + if (ImGui::RadioButton("Move", mode == Mode_Move)) { mode = Mode_Move; } ImGui::SameLine(); + if (ImGui::RadioButton("Swap", mode == Mode_Swap)) { mode = Mode_Swap; } + static const char* names[9] = { "Bobby", "Beatrice", "Betty", "Brianna", "Barry", "Bernard", "Bibi", "Blaine", "Bryn" }; + for (int n = 0; n < IM_ARRAYSIZE(names); n++) + { + ImGui::PushID(n); + if ((n % 3) != 0) + ImGui::SameLine(); + ImGui::Button(names[n], ImVec2(60,60)); + + // Our buttons are both drag sources and drag targets here! + if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None)) + { + ImGui::SetDragDropPayload("DND_DEMO_CELL", &n, sizeof(int)); // Set payload to carry the index of our item (could be anything) + if (mode == Mode_Copy) { ImGui::Text("Copy %s", names[n]); } // Display preview (could be anything, e.g. when dragging an image we could decide to display the filename and a small preview of the image, etc.) + if (mode == Mode_Move) { ImGui::Text("Move %s", names[n]); } + if (mode == Mode_Swap) { ImGui::Text("Swap %s", names[n]); } + ImGui::EndDragDropSource(); + } + if (ImGui::BeginDragDropTarget()) + { + if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("DND_DEMO_CELL")) + { + IM_ASSERT(payload->DataSize == sizeof(int)); + int payload_n = *(const int*)payload->Data; + if (mode == Mode_Copy) + { + names[n] = names[payload_n]; + } + if (mode == Mode_Move) + { + names[n] = names[payload_n]; + names[payload_n] = ""; + } + if (mode == Mode_Swap) + { + const char* tmp = names[n]; + names[n] = names[payload_n]; + names[payload_n] = tmp; + } + } + ImGui::EndDragDropTarget(); + } + ImGui::PopID(); + } + ImGui::Unindent(); + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Querying Status (Active/Focused/Hovered etc.)")) + { + // Display the value of IsItemHovered() and other common item state functions. Note that the flags can be combined. + // (because BulletText is an item itself and that would affect the output of IsItemHovered() we pass all state in a single call to simplify the code). + static int item_type = 1; + static bool b = false; + static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f }; + ImGui::RadioButton("Text", &item_type, 0); + ImGui::RadioButton("Button", &item_type, 1); + ImGui::RadioButton("CheckBox", &item_type, 2); + ImGui::RadioButton("SliderFloat", &item_type, 3); + ImGui::RadioButton("ColorEdit4", &item_type, 4); + ImGui::RadioButton("ListBox", &item_type, 5); + ImGui::Separator(); + bool ret = false; + if (item_type == 0) { ImGui::Text("ITEM: Text"); } // Testing text items with no identifier/interaction + if (item_type == 1) { ret = ImGui::Button("ITEM: Button"); } // Testing button + if (item_type == 2) { ret = ImGui::Checkbox("ITEM: CheckBox", &b); } // Testing checkbox + if (item_type == 3) { ret = ImGui::SliderFloat("ITEM: SliderFloat", &col4f[0], 0.0f, 1.0f); } // Testing basic item + if (item_type == 4) { ret = ImGui::ColorEdit4("ITEM: ColorEdit4", col4f); } // Testing multi-component items (IsItemXXX flags are reported merged) + if (item_type == 5) { const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); } + ImGui::BulletText( + "Return value = %d\n" + "IsItemFocused() = %d\n" + "IsItemHovered() = %d\n" + "IsItemHovered(_AllowWhenBlockedByPopup) = %d\n" + "IsItemHovered(_AllowWhenBlockedByActiveItem) = %d\n" + "IsItemHovered(_AllowWhenOverlapped) = %d\n" + "IsItemHovered(_RectOnly) = %d\n" + "IsItemActive() = %d\n" + "IsItemEdited() = %d\n" + "IsItemDeactivated() = %d\n" + "IsItemDeactivatedEdit() = %d\n" + "IsItemVisible() = %d\n" + "GetItemRectMin() = (%.1f, %.1f)\n" + "GetItemRectMax() = (%.1f, %.1f)\n" + "GetItemRectSize() = (%.1f, %.1f)", + ret, + ImGui::IsItemFocused(), + ImGui::IsItemHovered(), + ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup), + ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), + ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped), + ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly), + ImGui::IsItemActive(), + ImGui::IsItemEdited(), + ImGui::IsItemDeactivated(), + ImGui::IsItemDeactivatedAfterEdit(), + ImGui::IsItemVisible(), + ImGui::GetItemRectMin().x, ImGui::GetItemRectMin().y, + ImGui::GetItemRectMax().x, ImGui::GetItemRectMax().y, + ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y + ); + + static bool embed_all_inside_a_child_window = false; + ImGui::Checkbox("Embed everything inside a child window (for additional testing)", &embed_all_inside_a_child_window); + if (embed_all_inside_a_child_window) + ImGui::BeginChild("outer_child", ImVec2(0, ImGui::GetFontSize() * 20), true); + + // Testing IsWindowFocused() function with its various flags. Note that the flags can be combined. + ImGui::BulletText( + "IsWindowFocused() = %d\n" + "IsWindowFocused(_ChildWindows) = %d\n" + "IsWindowFocused(_ChildWindows|_RootWindow) = %d\n" + "IsWindowFocused(_RootWindow) = %d\n" + "IsWindowFocused(_AnyWindow) = %d\n", + ImGui::IsWindowFocused(), + ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows), + ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow), + ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow), + ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)); + + // Testing IsWindowHovered() function with its various flags. Note that the flags can be combined. + ImGui::BulletText( + "IsWindowHovered() = %d\n" + "IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n" + "IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n" + "IsWindowHovered(_ChildWindows) = %d\n" + "IsWindowHovered(_ChildWindows|_RootWindow) = %d\n" + "IsWindowHovered(_RootWindow) = %d\n" + "IsWindowHovered(_AnyWindow) = %d\n", + ImGui::IsWindowHovered(), + ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup), + ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), + ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows), + ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow), + ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow), + ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow)); + + ImGui::BeginChild("child", ImVec2(0, 50), true); + ImGui::Text("This is another child window for testing with the _ChildWindows flag."); + ImGui::EndChild(); + if (embed_all_inside_a_child_window) + ImGui::EndChild(); + + // Calling IsItemHovered() after begin returns the hovered status of the title bar. + // This is useful in particular if you want to create a context menu (with BeginPopupContextItem) associated to the title bar of a window. + static bool test_window = false; + ImGui::Checkbox("Hovered/Active tests after Begin() for title bar testing", &test_window); + if (test_window) + { + ImGui::Begin("Title bar Hovered/Active tests", &test_window); + if (ImGui::BeginPopupContextItem()) // <-- This is using IsItemHovered() + { + if (ImGui::MenuItem("Close")) { test_window = false; } + ImGui::EndPopup(); + } + ImGui::Text( + "IsItemHovered() after begin = %d (== is title bar hovered)\n" + "IsItemActive() after begin = %d (== is window being clicked/moved)\n", + ImGui::IsItemHovered(), ImGui::IsItemActive()); + ImGui::End(); + } + + ImGui::TreePop(); + } +} + +static void ShowDemoWindowLayout() +{ + if (!ImGui::CollapsingHeader("Layout")) + return; + + if (ImGui::TreeNode("Child regions")) + { + static bool disable_mouse_wheel = false; + static bool disable_menu = false; + ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel); + ImGui::Checkbox("Disable Menu", &disable_menu); + + static int line = 50; + bool goto_line = ImGui::Button("Goto"); + ImGui::SameLine(); + ImGui::PushItemWidth(100); + goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue); + ImGui::PopItemWidth(); + + // Child 1: no border, enable horizontal scrollbar + { + ImGui::BeginChild("Child1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0)); + for (int i = 0; i < 100; i++) + { + ImGui::Text("%04d: scrollable region", i); + if (goto_line && line == i) + ImGui::SetScrollHereY(); + } + if (goto_line && line >= 100) + ImGui::SetScrollHereY(); + ImGui::EndChild(); + } + + ImGui::SameLine(); + + // Child 2: rounded border + { + ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); + ImGui::BeginChild("Child2", ImVec2(0, 300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar)); + if (!disable_menu && ImGui::BeginMenuBar()) + { + if (ImGui::BeginMenu("Menu")) + { + ShowExampleMenuFile(); + ImGui::EndMenu(); + } + ImGui::EndMenuBar(); + } + ImGui::Columns(2); + for (int i = 0; i < 100; i++) + { + char buf[32]; + sprintf(buf, "%03d", i); + ImGui::Button(buf, ImVec2(-1.0f, 0.0f)); + ImGui::NextColumn(); + } + ImGui::EndChild(); + ImGui::PopStyleVar(); + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Widgets Width")) + { + static float f = 0.0f; + ImGui::Text("PushItemWidth(100)"); + ImGui::SameLine(); ShowHelpMarker("Fixed width."); + ImGui::PushItemWidth(100); + ImGui::DragFloat("float##1", &f); + ImGui::PopItemWidth(); + + ImGui::Text("PushItemWidth(GetWindowWidth() * 0.5f)"); + ImGui::SameLine(); ShowHelpMarker("Half of window width."); + ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f); + ImGui::DragFloat("float##2", &f); + ImGui::PopItemWidth(); + + ImGui::Text("PushItemWidth(GetContentRegionAvailWidth() * 0.5f)"); + ImGui::SameLine(); ShowHelpMarker("Half of available width.\n(~ right-cursor_pos)\n(works within a column set)"); + ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() * 0.5f); + ImGui::DragFloat("float##3", &f); + ImGui::PopItemWidth(); + + ImGui::Text("PushItemWidth(-100)"); + ImGui::SameLine(); ShowHelpMarker("Align to right edge minus 100"); + ImGui::PushItemWidth(-100); + ImGui::DragFloat("float##4", &f); + ImGui::PopItemWidth(); + + ImGui::Text("PushItemWidth(-1)"); + ImGui::SameLine(); ShowHelpMarker("Align to right edge"); + ImGui::PushItemWidth(-1); + ImGui::DragFloat("float##5", &f); + ImGui::PopItemWidth(); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Basic Horizontal Layout")) + { + ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceding item)"); + + // Text + ImGui::Text("Two items: Hello"); ImGui::SameLine(); + ImGui::TextColored(ImVec4(1,1,0,1), "Sailor"); + + // Adjust spacing + ImGui::Text("More spacing: Hello"); ImGui::SameLine(0, 20); + ImGui::TextColored(ImVec4(1,1,0,1), "Sailor"); + + // Button + ImGui::AlignTextToFramePadding(); + ImGui::Text("Normal buttons"); ImGui::SameLine(); + ImGui::Button("Banana"); ImGui::SameLine(); + ImGui::Button("Apple"); ImGui::SameLine(); + ImGui::Button("Corniflower"); + + // Button + ImGui::Text("Small buttons"); ImGui::SameLine(); + ImGui::SmallButton("Like this one"); ImGui::SameLine(); + ImGui::Text("can fit within a text block."); + + // Aligned to arbitrary position. Easy/cheap column. + ImGui::Text("Aligned"); + ImGui::SameLine(150); ImGui::Text("x=150"); + ImGui::SameLine(300); ImGui::Text("x=300"); + ImGui::Text("Aligned"); + ImGui::SameLine(150); ImGui::SmallButton("x=150"); + ImGui::SameLine(300); ImGui::SmallButton("x=300"); + + // Checkbox + static bool c1 = false, c2 = false, c3 = false, c4 = false; + ImGui::Checkbox("My", &c1); ImGui::SameLine(); + ImGui::Checkbox("Tailor", &c2); ImGui::SameLine(); + ImGui::Checkbox("Is", &c3); ImGui::SameLine(); + ImGui::Checkbox("Rich", &c4); + + // Various + static float f0 = 1.0f, f1 = 2.0f, f2 = 3.0f; + ImGui::PushItemWidth(80); + const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD" }; + static int item = -1; + ImGui::Combo("Combo", &item, items, IM_ARRAYSIZE(items)); ImGui::SameLine(); + ImGui::SliderFloat("X", &f0, 0.0f, 5.0f); ImGui::SameLine(); + ImGui::SliderFloat("Y", &f1, 0.0f, 5.0f); ImGui::SameLine(); + ImGui::SliderFloat("Z", &f2, 0.0f, 5.0f); + ImGui::PopItemWidth(); + + ImGui::PushItemWidth(80); + ImGui::Text("Lists:"); + static int selection[4] = { 0, 1, 2, 3 }; + for (int i = 0; i < 4; i++) + { + if (i > 0) ImGui::SameLine(); + ImGui::PushID(i); + ImGui::ListBox("", &selection[i], items, IM_ARRAYSIZE(items)); + ImGui::PopID(); + //if (ImGui::IsItemHovered()) ImGui::SetTooltip("ListBox %d hovered", i); + } + ImGui::PopItemWidth(); + + // Dummy + ImVec2 button_sz(40, 40); + ImGui::Button("A", button_sz); ImGui::SameLine(); + ImGui::Dummy(button_sz); ImGui::SameLine(); + ImGui::Button("B", button_sz); + + // Manually wrapping (we should eventually provide this as an automatic layout feature, but for now you can do it manually) + ImGui::Text("Manually wrapping:"); + ImGuiStyle& style = ImGui::GetStyle(); + int buttons_count = 20; + float window_visible_x2 = ImGui::GetWindowPos().x + ImGui::GetWindowContentRegionMax().x; + for (int n = 0; n < buttons_count; n++) + { + ImGui::PushID(n); + ImGui::Button("Box", button_sz); + float last_button_x2 = ImGui::GetItemRectMax().x; + float next_button_x2 = last_button_x2 + style.ItemSpacing.x + button_sz.x; // Expected position if next button was on same line + if (n + 1 < buttons_count && next_button_x2 < window_visible_x2) + ImGui::SameLine(); + ImGui::PopID(); + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Groups")) + { + ImGui::TextWrapped("(Using ImGui::BeginGroup()/EndGroup() to layout items. BeginGroup() basically locks the horizontal position. EndGroup() bundles the whole group so that you can use functions such as IsItemHovered() on it.)"); + ImGui::BeginGroup(); + { + ImGui::BeginGroup(); + ImGui::Button("AAA"); + ImGui::SameLine(); + ImGui::Button("BBB"); + ImGui::SameLine(); + ImGui::BeginGroup(); + ImGui::Button("CCC"); + ImGui::Button("DDD"); + ImGui::EndGroup(); + ImGui::SameLine(); + ImGui::Button("EEE"); + ImGui::EndGroup(); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("First group hovered"); + } + // Capture the group size and create widgets using the same size + ImVec2 size = ImGui::GetItemRectSize(); + const float values[5] = { 0.5f, 0.20f, 0.80f, 0.60f, 0.25f }; + ImGui::PlotHistogram("##values", values, IM_ARRAYSIZE(values), 0, NULL, 0.0f, 1.0f, size); + + ImGui::Button("ACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f, size.y)); + ImGui::SameLine(); + ImGui::Button("REACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f, size.y)); + ImGui::EndGroup(); + ImGui::SameLine(); + + ImGui::Button("LEVERAGE\nBUZZWORD", size); + ImGui::SameLine(); + + if (ImGui::ListBoxHeader("List", size)) + { + ImGui::Selectable("Selected", true); + ImGui::Selectable("Not Selected", false); + ImGui::ListBoxFooter(); + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Text Baseline Alignment")) + { + ImGui::TextWrapped("(This is testing the vertical alignment that occurs on text to keep it at the same baseline as widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets)"); + + ImGui::Text("One\nTwo\nThree"); ImGui::SameLine(); + ImGui::Text("Hello\nWorld"); ImGui::SameLine(); + ImGui::Text("Banana"); + + ImGui::Text("Banana"); ImGui::SameLine(); + ImGui::Text("Hello\nWorld"); ImGui::SameLine(); + ImGui::Text("One\nTwo\nThree"); + + ImGui::Button("HOP##1"); ImGui::SameLine(); + ImGui::Text("Banana"); ImGui::SameLine(); + ImGui::Text("Hello\nWorld"); ImGui::SameLine(); + ImGui::Text("Banana"); + + ImGui::Button("HOP##2"); ImGui::SameLine(); + ImGui::Text("Hello\nWorld"); ImGui::SameLine(); + ImGui::Text("Banana"); + + ImGui::Button("TEST##1"); ImGui::SameLine(); + ImGui::Text("TEST"); ImGui::SameLine(); + ImGui::SmallButton("TEST##2"); + + ImGui::AlignTextToFramePadding(); // If your line starts with text, call this to align it to upcoming widgets. + ImGui::Text("Text aligned to Widget"); ImGui::SameLine(); + ImGui::Button("Widget##1"); ImGui::SameLine(); + ImGui::Text("Widget"); ImGui::SameLine(); + ImGui::SmallButton("Widget##2"); ImGui::SameLine(); + ImGui::Button("Widget##3"); + + // Tree + const float spacing = ImGui::GetStyle().ItemInnerSpacing.x; + ImGui::Button("Button##1"); + ImGui::SameLine(0.0f, spacing); + if (ImGui::TreeNode("Node##1")) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data + + ImGui::AlignTextToFramePadding(); // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget. Otherwise you can use SmallButton (smaller fit). + bool node_open = ImGui::TreeNode("Node##2"); // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add child content. + ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2"); + if (node_open) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data + + // Bullet + ImGui::Button("Button##3"); + ImGui::SameLine(0.0f, spacing); + ImGui::BulletText("Bullet text"); + + ImGui::AlignTextToFramePadding(); + ImGui::BulletText("Node"); + ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##4"); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Scrolling")) + { + ImGui::TextWrapped("(Use SetScrollHereY() or SetScrollFromPosY() to scroll to a given position.)"); + static bool track = true; + static int track_line = 50, scroll_to_px = 200; + ImGui::Checkbox("Track", &track); + ImGui::PushItemWidth(100); + ImGui::SameLine(130); track |= ImGui::DragInt("##line", &track_line, 0.25f, 0, 99, "Line = %d"); + bool scroll_to = ImGui::Button("Scroll To Pos"); + ImGui::SameLine(130); scroll_to |= ImGui::DragInt("##pos_y", &scroll_to_px, 1.00f, 0, 9999, "Y = %d px"); + ImGui::PopItemWidth(); + if (scroll_to) track = false; + + for (int i = 0; i < 5; i++) + { + if (i > 0) ImGui::SameLine(); + ImGui::BeginGroup(); + ImGui::Text("%s", i == 0 ? "Top" : i == 1 ? "25%" : i == 2 ? "Center" : i == 3 ? "75%" : "Bottom"); + ImGui::BeginChild(ImGui::GetID((void*)(intptr_t)i), ImVec2(ImGui::GetWindowWidth() * 0.17f, 200.0f), true); + if (scroll_to) + ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + scroll_to_px, i * 0.25f); + for (int line = 0; line < 100; line++) + { + if (track && line == track_line) + { + ImGui::TextColored(ImVec4(1,1,0,1), "Line %d", line); + ImGui::SetScrollHereY(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom + } + else + { + ImGui::Text("Line %d", line); + } + } + float scroll_y = ImGui::GetScrollY(), scroll_max_y = ImGui::GetScrollMaxY(); + ImGui::EndChild(); + ImGui::Text("%.0f/%0.f", scroll_y, scroll_max_y); + ImGui::EndGroup(); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Horizontal Scrolling")) + { + ImGui::Bullet(); ImGui::TextWrapped("Horizontal scrolling for a window has to be enabled explicitly via the ImGuiWindowFlags_HorizontalScrollbar flag."); + ImGui::Bullet(); ImGui::TextWrapped("You may want to explicitly specify content width by calling SetNextWindowContentWidth() before Begin()."); + static int lines = 7; + ImGui::SliderInt("Lines", &lines, 1, 15); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f)); + ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar); + for (int line = 0; line < lines; line++) + { + // Display random stuff (for the sake of this trivial demo we are using basic Button+SameLine. If you want to create your own time line for a real application you may be better off + // manipulating the cursor position yourself, aka using SetCursorPos/SetCursorScreenPos to position the widgets yourself. You may also want to use the lower-level ImDrawList API) + int num_buttons = 10 + ((line & 1) ? line * 9 : line * 3); + for (int n = 0; n < num_buttons; n++) + { + if (n > 0) ImGui::SameLine(); + ImGui::PushID(n + line * 1000); + char num_buf[16]; + sprintf(num_buf, "%d", n); + const char* label = (!(n%15)) ? "FizzBuzz" : (!(n%3)) ? "Fizz" : (!(n%5)) ? "Buzz" : num_buf; + float hue = n*0.05f; + ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(hue, 0.6f, 0.6f)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(hue, 0.7f, 0.7f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(hue, 0.8f, 0.8f)); + ImGui::Button(label, ImVec2(40.0f + sinf((float)(line + n)) * 20.0f, 0.0f)); + ImGui::PopStyleColor(3); + ImGui::PopID(); + } + } + float scroll_x = ImGui::GetScrollX(), scroll_max_x = ImGui::GetScrollMaxX(); + ImGui::EndChild(); + ImGui::PopStyleVar(2); + float scroll_x_delta = 0.0f; + ImGui::SmallButton("<<"); if (ImGui::IsItemActive()) scroll_x_delta = -ImGui::GetIO().DeltaTime * 1000.0f; ImGui::SameLine(); + ImGui::Text("Scroll from code"); ImGui::SameLine(); + ImGui::SmallButton(">>"); if (ImGui::IsItemActive()) scroll_x_delta = +ImGui::GetIO().DeltaTime * 1000.0f; ImGui::SameLine(); + ImGui::Text("%.0f/%.0f", scroll_x, scroll_max_x); + if (scroll_x_delta != 0.0f) + { + ImGui::BeginChild("scrolling"); // Demonstrate a trick: you can use Begin to set yourself in the context of another window (here we are already out of your child window) + ImGui::SetScrollX(ImGui::GetScrollX() + scroll_x_delta); + ImGui::End(); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Clipping")) + { + static ImVec2 size(100, 100), offset(50, 20); + ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost."); + ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f"); + ImGui::TextWrapped("(Click and drag)"); + ImVec2 pos = ImGui::GetCursorScreenPos(); + ImVec4 clip_rect(pos.x, pos.y, pos.x + size.x, pos.y + size.y); + ImGui::InvisibleButton("##dummy", size); + if (ImGui::IsItemActive() && ImGui::IsMouseDragging()) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; } + ImGui::GetWindowDrawList()->AddRectFilled(pos, ImVec2(pos.x + size.x, pos.y + size.y), IM_COL32(90, 90, 120, 255)); + ImGui::GetWindowDrawList()->AddText(ImGui::GetFont(), ImGui::GetFontSize()*2.0f, ImVec2(pos.x + offset.x, pos.y + offset.y), IM_COL32(255, 255, 255, 255), "Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect); + ImGui::TreePop(); + } +} + +static void ShowDemoWindowPopups() +{ + if (!ImGui::CollapsingHeader("Popups & Modal windows")) + return; + + // Popups are windows with a few special properties: + // - They block normal mouse hovering detection outside them. (*) + // - Unless modal, they can be closed by clicking anywhere outside them, or by pressing ESCAPE. + // - Their visibility state (~bool) is held internally by imgui instead of being held by the programmer as we are used to with regular Begin() calls. + // (*) One can use IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup) to bypass it and detect hovering even when normally blocked by a popup. + // Those three properties are intimately connected. The library needs to hold their visibility state because it can close popups at any time. + + // Typical use for regular windows: + // bool my_tool_is_active = false; if (ImGui::Button("Open")) my_tool_is_active = true; [...] if (my_tool_is_active) Begin("My Tool", &my_tool_is_active) { [...] } End(); + // Typical use for popups: + // if (ImGui::Button("Open")) ImGui::OpenPopup("MyPopup"); if (ImGui::BeginPopup("MyPopup") { [...] EndPopup(); } + + // With popups we have to go through a library call (here OpenPopup) to manipulate the visibility state. + // This may be a bit confusing at first but it should quickly make sense. Follow on the examples below. + + if (ImGui::TreeNode("Popups")) + { + ImGui::TextWrapped("When a popup is active, it inhibits interacting with windows that are behind the popup. Clicking outside the popup closes it."); + + static int selected_fish = -1; + const char* names[] = { "Bream", "Haddock", "Mackerel", "Pollock", "Tilefish" }; + static bool toggles[] = { true, false, false, false, false }; + + // Simple selection popup + // (If you want to show the current selection inside the Button itself, you may want to build a string using the "###" operator to preserve a constant ID with a variable label) + if (ImGui::Button("Select..")) + ImGui::OpenPopup("my_select_popup"); + ImGui::SameLine(); + ImGui::TextUnformatted(selected_fish == -1 ? "" : names[selected_fish]); + if (ImGui::BeginPopup("my_select_popup")) + { + ImGui::Text("Aquarium"); + ImGui::Separator(); + for (int i = 0; i < IM_ARRAYSIZE(names); i++) + if (ImGui::Selectable(names[i])) + selected_fish = i; + ImGui::EndPopup(); + } + + // Showing a menu with toggles + if (ImGui::Button("Toggle..")) + ImGui::OpenPopup("my_toggle_popup"); + if (ImGui::BeginPopup("my_toggle_popup")) + { + for (int i = 0; i < IM_ARRAYSIZE(names); i++) + ImGui::MenuItem(names[i], "", &toggles[i]); + if (ImGui::BeginMenu("Sub-menu")) + { + ImGui::MenuItem("Click me"); + ImGui::EndMenu(); + } + + ImGui::Separator(); + ImGui::Text("Tooltip here"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("I am a tooltip over a popup"); + + if (ImGui::Button("Stacked Popup")) + ImGui::OpenPopup("another popup"); + if (ImGui::BeginPopup("another popup")) + { + for (int i = 0; i < IM_ARRAYSIZE(names); i++) + ImGui::MenuItem(names[i], "", &toggles[i]); + if (ImGui::BeginMenu("Sub-menu")) + { + ImGui::MenuItem("Click me"); + ImGui::EndMenu(); + } + ImGui::EndPopup(); + } + ImGui::EndPopup(); + } + + // Call the more complete ShowExampleMenuFile which we use in various places of this demo + if (ImGui::Button("File Menu..")) + ImGui::OpenPopup("my_file_popup"); + if (ImGui::BeginPopup("my_file_popup")) + { + ShowExampleMenuFile(); + ImGui::EndPopup(); + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Context menus")) + { + // BeginPopupContextItem() is a helper to provide common/simple popup behavior of essentially doing: + // if (IsItemHovered() && IsMouseReleased(0)) + // OpenPopup(id); + // return BeginPopup(id); + // For more advanced uses you may want to replicate and cuztomize this code. This the comments inside BeginPopupContextItem() implementation. + static float value = 0.5f; + ImGui::Text("Value = %.3f (<-- right-click here)", value); + if (ImGui::BeginPopupContextItem("item context menu")) + { + if (ImGui::Selectable("Set to zero")) value = 0.0f; + if (ImGui::Selectable("Set to PI")) value = 3.1415f; + ImGui::PushItemWidth(-1); + ImGui::DragFloat("##Value", &value, 0.1f, 0.0f, 0.0f); + ImGui::PopItemWidth(); + ImGui::EndPopup(); + } + + // We can also use OpenPopupOnItemClick() which is the same as BeginPopupContextItem() but without the Begin call. + // So here we will make it that clicking on the text field with the right mouse button (1) will toggle the visibility of the popup above. + ImGui::Text("(You can also right-click me to the same popup as above.)"); + ImGui::OpenPopupOnItemClick("item context menu", 1); + + // When used after an item that has an ID (here the Button), we can skip providing an ID to BeginPopupContextItem(). + // BeginPopupContextItem() will use the last item ID as the popup ID. + // In addition here, we want to include your editable label inside the button label. We use the ### operator to override the ID (read FAQ about ID for details) + static char name[32] = "Label1"; + char buf[64]; sprintf(buf, "Button: %s###Button", name); // ### operator override ID ignoring the preceding label + ImGui::Button(buf); + if (ImGui::BeginPopupContextItem()) + { + ImGui::Text("Edit name:"); + ImGui::InputText("##edit", name, IM_ARRAYSIZE(name)); + if (ImGui::Button("Close")) + ImGui::CloseCurrentPopup(); + ImGui::EndPopup(); + } + ImGui::SameLine(); ImGui::Text("(<-- right-click here)"); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Modals")) + { + ImGui::TextWrapped("Modal windows are like popups but the user cannot close them by clicking outside the window."); + + if (ImGui::Button("Delete..")) + ImGui::OpenPopup("Delete?"); + if (ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize)) + { + ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); + ImGui::Separator(); + + //static int dummy_i = 0; + //ImGui::Combo("Combo", &dummy_i, "Delete\0Delete harder\0"); + + static bool dont_ask_me_next_time = false; + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0)); + ImGui::Checkbox("Don't ask me next time", &dont_ask_me_next_time); + ImGui::PopStyleVar(); + + if (ImGui::Button("OK", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); } + ImGui::SetItemDefaultFocus(); + ImGui::SameLine(); + if (ImGui::Button("Cancel", ImVec2(120, 0))) { ImGui::CloseCurrentPopup(); } + ImGui::EndPopup(); + } + + if (ImGui::Button("Stacked modals..")) + ImGui::OpenPopup("Stacked 1"); + if (ImGui::BeginPopupModal("Stacked 1")) + { + ImGui::Text("Hello from Stacked The First\nUsing style.Colors[ImGuiCol_ModalWindowDimBg] behind it."); + static int item = 1; + ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0"); + static float color[4] = { 0.4f,0.7f,0.0f,0.5f }; + ImGui::ColorEdit4("color", color); // This is to test behavior of stacked regular popups over a modal + + if (ImGui::Button("Add another modal..")) + ImGui::OpenPopup("Stacked 2"); + if (ImGui::BeginPopupModal("Stacked 2")) + { + ImGui::Text("Hello from Stacked The Second!"); + if (ImGui::Button("Close")) + ImGui::CloseCurrentPopup(); + ImGui::EndPopup(); + } + + if (ImGui::Button("Close")) + ImGui::CloseCurrentPopup(); + ImGui::EndPopup(); + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Menus inside a regular window")) + { + ImGui::TextWrapped("Below we are testing adding menu items to a regular window. It's rather unusual but should work!"); + ImGui::Separator(); + // NB: As a quirk in this very specific example, we want to differentiate the parent of this menu from the parent of the various popup menus above. + // To do so we are encloding the items in a PushID()/PopID() block to make them two different menusets. If we don't, opening any popup above and hovering our menu here + // would open it. This is because once a menu is active, we allow to switch to a sibling menu by just hovering on it, which is the desired behavior for regular menus. + ImGui::PushID("foo"); + ImGui::MenuItem("Menu item", "CTRL+M"); + if (ImGui::BeginMenu("Menu inside a regular window")) + { + ShowExampleMenuFile(); + ImGui::EndMenu(); + } + ImGui::PopID(); + ImGui::Separator(); + ImGui::TreePop(); + } +} + +static void ShowDemoWindowColumns() +{ + if (!ImGui::CollapsingHeader("Columns")) + return; + + ImGui::PushID("Columns"); + + // Basic columns + if (ImGui::TreeNode("Basic")) + { + ImGui::Text("Without border:"); + ImGui::Columns(3, "mycolumns3", false); // 3-ways, no border + ImGui::Separator(); + for (int n = 0; n < 14; n++) + { + char label[32]; + sprintf(label, "Item %d", n); + if (ImGui::Selectable(label)) {} + //if (ImGui::Button(label, ImVec2(-1,0))) {} + ImGui::NextColumn(); + } + ImGui::Columns(1); + ImGui::Separator(); + + ImGui::Text("With border:"); + ImGui::Columns(4, "mycolumns"); // 4-ways, with border + ImGui::Separator(); + ImGui::Text("ID"); ImGui::NextColumn(); + ImGui::Text("Name"); ImGui::NextColumn(); + ImGui::Text("Path"); ImGui::NextColumn(); + ImGui::Text("Hovered"); ImGui::NextColumn(); + ImGui::Separator(); + const char* names[3] = { "One", "Two", "Three" }; + const char* paths[3] = { "/path/one", "/path/two", "/path/three" }; + static int selected = -1; + for (int i = 0; i < 3; i++) + { + char label[32]; + sprintf(label, "%04d", i); + if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SpanAllColumns)) + selected = i; + bool hovered = ImGui::IsItemHovered(); + ImGui::NextColumn(); + ImGui::Text(names[i]); ImGui::NextColumn(); + ImGui::Text(paths[i]); ImGui::NextColumn(); + ImGui::Text("%d", hovered); ImGui::NextColumn(); + } + ImGui::Columns(1); + ImGui::Separator(); + ImGui::TreePop(); + } + + // Create multiple items in a same cell before switching to next column + if (ImGui::TreeNode("Mixed items")) + { + ImGui::Columns(3, "mixed"); + ImGui::Separator(); + + ImGui::Text("Hello"); + ImGui::Button("Banana"); + ImGui::NextColumn(); + + ImGui::Text("ImGui"); + ImGui::Button("Apple"); + static float foo = 1.0f; + ImGui::InputFloat("red", &foo, 0.05f, 0, "%.3f"); + ImGui::Text("An extra line here."); + ImGui::NextColumn(); + + ImGui::Text("Sailor"); + ImGui::Button("Corniflower"); + static float bar = 1.0f; + ImGui::InputFloat("blue", &bar, 0.05f, 0, "%.3f"); + ImGui::NextColumn(); + + if (ImGui::CollapsingHeader("Category A")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); + if (ImGui::CollapsingHeader("Category B")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); + if (ImGui::CollapsingHeader("Category C")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); + ImGui::Columns(1); + ImGui::Separator(); + ImGui::TreePop(); + } + + // Word wrapping + if (ImGui::TreeNode("Word-wrapping")) + { + ImGui::Columns(2, "word-wrapping"); + ImGui::Separator(); + ImGui::TextWrapped("The quick brown fox jumps over the lazy dog."); + ImGui::TextWrapped("Hello Left"); + ImGui::NextColumn(); + ImGui::TextWrapped("The quick brown fox jumps over the lazy dog."); + ImGui::TextWrapped("Hello Right"); + ImGui::Columns(1); + ImGui::Separator(); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Borders")) + { + // NB: Future columns API should allow automatic horizontal borders. + static bool h_borders = true; + static bool v_borders = true; + ImGui::Checkbox("horizontal", &h_borders); + ImGui::SameLine(); + ImGui::Checkbox("vertical", &v_borders); + ImGui::Columns(4, NULL, v_borders); + for (int i = 0; i < 4*3; i++) + { + if (h_borders && ImGui::GetColumnIndex() == 0) + ImGui::Separator(); + ImGui::Text("%c%c%c", 'a'+i, 'a'+i, 'a'+i); + ImGui::Text("Width %.2f\nOffset %.2f", ImGui::GetColumnWidth(), ImGui::GetColumnOffset()); + ImGui::NextColumn(); + } + ImGui::Columns(1); + if (h_borders) + ImGui::Separator(); + ImGui::TreePop(); + } + + // Scrolling columns + /* + if (ImGui::TreeNode("Vertical Scrolling")) + { + ImGui::BeginChild("##header", ImVec2(0, ImGui::GetTextLineHeightWithSpacing()+ImGui::GetStyle().ItemSpacing.y)); + ImGui::Columns(3); + ImGui::Text("ID"); ImGui::NextColumn(); + ImGui::Text("Name"); ImGui::NextColumn(); + ImGui::Text("Path"); ImGui::NextColumn(); + ImGui::Columns(1); + ImGui::Separator(); + ImGui::EndChild(); + ImGui::BeginChild("##scrollingregion", ImVec2(0, 60)); + ImGui::Columns(3); + for (int i = 0; i < 10; i++) + { + ImGui::Text("%04d", i); ImGui::NextColumn(); + ImGui::Text("Foobar"); ImGui::NextColumn(); + ImGui::Text("/path/foobar/%04d/", i); ImGui::NextColumn(); + } + ImGui::Columns(1); + ImGui::EndChild(); + ImGui::TreePop(); + } + */ + + if (ImGui::TreeNode("Horizontal Scrolling")) + { + ImGui::SetNextWindowContentSize(ImVec2(1500.0f, 0.0f)); + ImGui::BeginChild("##ScrollingRegion", ImVec2(0, ImGui::GetFontSize() * 20), false, ImGuiWindowFlags_HorizontalScrollbar); + ImGui::Columns(10); + int ITEMS_COUNT = 2000; + ImGuiListClipper clipper(ITEMS_COUNT); // Also demonstrate using the clipper for large list + while (clipper.Step()) + { + for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) + for (int j = 0; j < 10; j++) + { + ImGui::Text("Line %d Column %d...", i, j); + ImGui::NextColumn(); + } + } + ImGui::Columns(1); + ImGui::EndChild(); + ImGui::TreePop(); + } + + bool node_open = ImGui::TreeNode("Tree within single cell"); + ImGui::SameLine(); ShowHelpMarker("NB: Tree node must be poped before ending the cell. There's no storage of state per-cell."); + if (node_open) + { + ImGui::Columns(2, "tree items"); + ImGui::Separator(); + if (ImGui::TreeNode("Hello")) { ImGui::BulletText("Sailor"); ImGui::TreePop(); } ImGui::NextColumn(); + if (ImGui::TreeNode("Bonjour")) { ImGui::BulletText("Marin"); ImGui::TreePop(); } ImGui::NextColumn(); + ImGui::Columns(1); + ImGui::Separator(); + ImGui::TreePop(); + } + ImGui::PopID(); +} + +static void ShowDemoWindowMisc() +{ + if (ImGui::CollapsingHeader("Filtering")) + { + static ImGuiTextFilter filter; + ImGui::Text("Filter usage:\n" + " \"\" display all lines\n" + " \"xxx\" display lines containing \"xxx\"\n" + " \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n" + " \"-xxx\" hide lines containing \"xxx\""); + filter.Draw(); + const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }; + for (int i = 0; i < IM_ARRAYSIZE(lines); i++) + if (filter.PassFilter(lines[i])) + ImGui::BulletText("%s", lines[i]); + } + + if (ImGui::CollapsingHeader("Inputs, Navigation & Focus")) + { + ImGuiIO& io = ImGui::GetIO(); + + ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse); + ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard); + ImGui::Text("WantTextInput: %d", io.WantTextInput); + ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos); + ImGui::Text("NavActive: %d, NavVisible: %d", io.NavActive, io.NavVisible); + + if (ImGui::TreeNode("Keyboard, Mouse & Navigation State")) + { + if (ImGui::IsMousePosValid()) + ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); + else + ImGui::Text("Mouse pos: "); + ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); + ImGui::Text("Mouse down:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } + ImGui::Text("Mouse clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } + ImGui::Text("Mouse dbl-clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } + ImGui::Text("Mouse released:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } + ImGui::Text("Mouse wheel: %.1f", io.MouseWheel); + + ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (io.KeysDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("%d (%.02f secs)", i, io.KeysDownDuration[i]); } + ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d", i); } + ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); } + ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); + + ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputs[i]); } + ImGui::Text("NavInputs pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text("[%d]", i); } + ImGui::Text("NavInputs duration:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputsDownDuration[i]); } + + ImGui::Button("Hovering me sets the\nkeyboard capture flag"); + if (ImGui::IsItemHovered()) + ImGui::CaptureKeyboardFromApp(true); + ImGui::SameLine(); + ImGui::Button("Holding me clears the\nthe keyboard capture flag"); + if (ImGui::IsItemActive()) + ImGui::CaptureKeyboardFromApp(false); + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Tabbing")) + { + ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields."); + static char buf[32] = "dummy"; + ImGui::InputText("1", buf, IM_ARRAYSIZE(buf)); + ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); + ImGui::InputText("3", buf, IM_ARRAYSIZE(buf)); + ImGui::PushAllowKeyboardFocus(false); + ImGui::InputText("4 (tab skip)", buf, IM_ARRAYSIZE(buf)); + //ImGui::SameLine(); ShowHelperMarker("Use ImGui::PushAllowKeyboardFocus(bool)\nto disable tabbing through certain widgets."); + ImGui::PopAllowKeyboardFocus(); + ImGui::InputText("5", buf, IM_ARRAYSIZE(buf)); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Focus from code")) + { + bool focus_1 = ImGui::Button("Focus on 1"); ImGui::SameLine(); + bool focus_2 = ImGui::Button("Focus on 2"); ImGui::SameLine(); + bool focus_3 = ImGui::Button("Focus on 3"); + int has_focus = 0; + static char buf[128] = "click on a button to set focus"; + + if (focus_1) ImGui::SetKeyboardFocusHere(); + ImGui::InputText("1", buf, IM_ARRAYSIZE(buf)); + if (ImGui::IsItemActive()) has_focus = 1; + + if (focus_2) ImGui::SetKeyboardFocusHere(); + ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); + if (ImGui::IsItemActive()) has_focus = 2; + + ImGui::PushAllowKeyboardFocus(false); + if (focus_3) ImGui::SetKeyboardFocusHere(); + ImGui::InputText("3 (tab skip)", buf, IM_ARRAYSIZE(buf)); + if (ImGui::IsItemActive()) has_focus = 3; + ImGui::PopAllowKeyboardFocus(); + + if (has_focus) + ImGui::Text("Item with focus: %d", has_focus); + else + ImGui::Text("Item with focus: "); + + // Use >= 0 parameter to SetKeyboardFocusHere() to focus an upcoming item + static float f3[3] = { 0.0f, 0.0f, 0.0f }; + int focus_ahead = -1; + if (ImGui::Button("Focus on X")) focus_ahead = 0; ImGui::SameLine(); + if (ImGui::Button("Focus on Y")) focus_ahead = 1; ImGui::SameLine(); + if (ImGui::Button("Focus on Z")) focus_ahead = 2; + if (focus_ahead != -1) ImGui::SetKeyboardFocusHere(focus_ahead); + ImGui::SliderFloat3("Float3", &f3[0], 0.0f, 1.0f); + + ImGui::TextWrapped("NB: Cursor & selection are preserved when refocusing last used item in code."); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Dragging")) + { + ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget."); + for (int button = 0; button < 3; button++) + ImGui::Text("IsMouseDragging(%d):\n w/ default threshold: %d,\n w/ zero threshold: %d\n w/ large threshold: %d", + button, ImGui::IsMouseDragging(button), ImGui::IsMouseDragging(button, 0.0f), ImGui::IsMouseDragging(button, 20.0f)); + ImGui::Button("Drag Me"); + if (ImGui::IsItemActive()) + { + // Draw a line between the button and the mouse cursor + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + draw_list->PushClipRectFullScreen(); + draw_list->AddLine(io.MouseClickedPos[0], io.MousePos, ImGui::GetColorU32(ImGuiCol_Button), 4.0f); + draw_list->PopClipRect(); + + // Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold) + // You can request a lower or higher threshold using the second parameter of IsMouseDragging() and GetMouseDragDelta() + ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f); + ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0); + ImVec2 mouse_delta = io.MouseDelta; + ImGui::SameLine(); ImGui::Text("Raw (%.1f, %.1f), WithLockThresold (%.1f, %.1f), MouseDelta (%.1f, %.1f)", value_raw.x, value_raw.y, value_with_lock_threshold.x, value_with_lock_threshold.y, mouse_delta.x, mouse_delta.y); + } + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Mouse cursors")) + { + const char* mouse_cursors_names[] = { "Arrow", "TextInput", "Move", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand" }; + IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT); + + ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]); + ImGui::Text("Hover to see mouse cursors:"); + ImGui::SameLine(); ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it."); + for (int i = 0; i < ImGuiMouseCursor_COUNT; i++) + { + char label[32]; + sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]); + ImGui::Bullet(); ImGui::Selectable(label, false); + if (ImGui::IsItemHovered() || ImGui::IsItemFocused()) + ImGui::SetMouseCursor(i); + } + ImGui::TreePop(); + } + } +} + +//----------------------------------------------------------------------------- +// [SECTION] About Window / ShowAboutWindow() +// Access from ImGui Demo -> Help -> About +//----------------------------------------------------------------------------- + +void ImGui::ShowAboutWindow(bool* p_open) +{ + ImGui::Begin("About Dear ImGui", p_open, ImGuiWindowFlags_AlwaysAutoResize); + ImGui::Text("Dear ImGui %s", ImGui::GetVersion()); + ImGui::Separator(); + ImGui::Text("By Omar Cornut and all dear imgui contributors."); + ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information."); + + static bool show_config_info = false; + ImGui::Checkbox("Config/Build Information", &show_config_info); + if (show_config_info) + { + ImGuiIO& io = ImGui::GetIO(); + ImGuiStyle& style = ImGui::GetStyle(); + + bool copy_to_clipboard = ImGui::Button("Copy to clipboard"); + ImGui::BeginChildFrame(ImGui::GetID("cfginfos"), ImVec2(0, ImGui::GetTextLineHeightWithSpacing() * 18), ImGuiWindowFlags_NoMove); + if (copy_to_clipboard) + ImGui::LogToClipboard(); + + ImGui::Text("Dear ImGui %s (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM); + ImGui::Separator(); + ImGui::Text("sizeof(size_t): %d, sizeof(ImDrawIdx): %d, sizeof(ImDrawVert): %d", (int)sizeof(size_t), (int)sizeof(ImDrawIdx), (int)sizeof(ImDrawVert)); + ImGui::Text("define: __cplusplus=%d", (int)__cplusplus); +#ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS"); +#endif +#ifdef IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS"); +#endif +#ifdef IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS"); +#endif +#ifdef IMGUI_DISABLE_WIN32_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_WIN32_FUNCTIONS"); +#endif +#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS"); +#endif +#ifdef IMGUI_DISABLE_MATH_FUNCTIONS + ImGui::Text("define: IMGUI_DISABLE_MATH_FUNCTIONS"); +#endif +#ifdef IMGUI_DISABLE_DEFAULT_ALLOCATORS + ImGui::Text("define: IMGUI_DISABLE_DEFAULT_ALLOCATORS"); +#endif +#ifdef IMGUI_USE_BGRA_PACKED_COLOR + ImGui::Text("define: IMGUI_USE_BGRA_PACKED_COLOR"); +#endif +#ifdef _WIN32 + ImGui::Text("define: _WIN32"); +#endif +#ifdef _WIN64 + ImGui::Text("define: _WIN64"); +#endif +#ifdef __linux__ + ImGui::Text("define: __linux__"); +#endif +#ifdef __APPLE__ + ImGui::Text("define: __APPLE__"); +#endif +#ifdef _MSC_VER + ImGui::Text("define: _MSC_VER=%d", _MSC_VER); +#endif +#ifdef __MINGW32__ + ImGui::Text("define: __MINGW32__"); +#endif +#ifdef __MINGW64__ + ImGui::Text("define: __MINGW64__"); +#endif +#ifdef __GNUC__ + ImGui::Text("define: __GNUC__=%d", (int)__GNUC__); +#endif +#ifdef __clang_version__ + ImGui::Text("define: __clang_version__=%s", __clang_version__); +#endif + ImGui::Separator(); + ImGui::Text("io.ConfigFlags: 0x%08X", io.ConfigFlags); + if (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) ImGui::Text(" NavEnableKeyboard"); + if (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) ImGui::Text(" NavEnableGamepad"); + if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) ImGui::Text(" NavEnableSetMousePos"); + if (io.ConfigFlags & ImGuiConfigFlags_NavNoCaptureKeyboard) ImGui::Text(" NavNoCaptureKeyboard"); + if (io.ConfigFlags & ImGuiConfigFlags_NoMouse) ImGui::Text(" NoMouse"); + if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange) ImGui::Text(" NoMouseCursorChange"); + if (io.ConfigFlags & ImGuiConfigFlags_IsSRGB) ImGui::Text(" IsSRGB"); + if (io.ConfigFlags & ImGuiConfigFlags_IsTouchScreen) ImGui::Text(" IsTouchScreen"); + if (io.MouseDrawCursor) ImGui::Text(" MouseDrawCursor"); + if (io.ConfigMacOSXBehaviors) ImGui::Text(" ConfigMacOSXBehaviors"); + if (io.ConfigInputTextCursorBlink) ImGui::Text(" ConfigInputTextCursorBlink"); + if (io.ConfigResizeWindowsFromEdges) ImGui::Text(" ConfigResizeWindowsFromEdges"); + ImGui::Text("io.BackendFlags: 0x%08X", io.BackendFlags); + if (io.BackendFlags & ImGuiBackendFlags_HasGamepad) ImGui::Text(" HasGamepad"); + if (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) ImGui::Text(" HasMouseCursors"); + if (io.BackendFlags & ImGuiBackendFlags_HasSetMousePos) ImGui::Text(" HasSetMousePos"); + ImGui::Text("io.BackendPlatformName: %s", io.BackendPlatformName ? io.BackendPlatformName : "NULL"); + ImGui::Text("io.BackendRendererName: %s", io.BackendRendererName ? io.BackendRendererName : "NULL"); + ImGui::Separator(); + ImGui::Text("io.Fonts: %d fonts, Flags: 0x%08X, TexSize: %d,%d", io.Fonts->Fonts.Size, io.Fonts->Flags, io.Fonts->TexWidth, io.Fonts->TexHeight); + ImGui::Text("io.DisplaySize: %.2f,%.2f", io.DisplaySize.x, io.DisplaySize.y); + ImGui::Separator(); + ImGui::Text("style.WindowPadding: %.2f,%.2f", style.WindowPadding.x, style.WindowPadding.y); + ImGui::Text("style.WindowBorderSize: %.2f", style.WindowBorderSize); + ImGui::Text("style.FramePadding: %.2f,%.2f", style.FramePadding.x, style.FramePadding.y); + ImGui::Text("style.FrameRounding: %.2f", style.FrameRounding); + ImGui::Text("style.FrameBorderSize: %.2f", style.FrameBorderSize); + ImGui::Text("style.ItemSpacing: %.2f,%.2f", style.ItemSpacing.x, style.ItemSpacing.y); + ImGui::Text("style.ItemInnerSpacing: %.2f,%.2f", style.ItemInnerSpacing.x, style.ItemInnerSpacing.y); + + if (copy_to_clipboard) + ImGui::LogFinish(); + ImGui::EndChildFrame(); + } + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Style Editor / ShowStyleEditor() +//----------------------------------------------------------------------------- + +// Demo helper function to select among default colors. See ShowStyleEditor() for more advanced options. +// Here we use the simplified Combo() api that packs items into a single literal string. Useful for quick combo boxes where the choices are known locally. +bool ImGui::ShowStyleSelector(const char* label) +{ + static int style_idx = -1; + if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0")) + { + switch (style_idx) + { + case 0: ImGui::StyleColorsClassic(); break; + case 1: ImGui::StyleColorsDark(); break; + case 2: ImGui::StyleColorsLight(); break; + } + return true; + } + return false; +} + +// Demo helper function to select among loaded fonts. +// Here we use the regular BeginCombo()/EndCombo() api which is more the more flexible one. +void ImGui::ShowFontSelector(const char* label) +{ + ImGuiIO& io = ImGui::GetIO(); + ImFont* font_current = ImGui::GetFont(); + if (ImGui::BeginCombo(label, font_current->GetDebugName())) + { + for (int n = 0; n < io.Fonts->Fonts.Size; n++) + if (ImGui::Selectable(io.Fonts->Fonts[n]->GetDebugName(), io.Fonts->Fonts[n] == font_current)) + io.FontDefault = io.Fonts->Fonts[n]; + ImGui::EndCombo(); + } + ImGui::SameLine(); + ShowHelpMarker( + "- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n" + "- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n" + "- Read FAQ and documentation in misc/fonts/ for more details.\n" + "- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame()."); +} + +void ImGui::ShowStyleEditor(ImGuiStyle* ref) +{ + // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it compares to an internally stored reference) + ImGuiStyle& style = ImGui::GetStyle(); + static ImGuiStyle ref_saved_style; + + // Default to using internal storage as reference + static bool init = true; + if (init && ref == NULL) + ref_saved_style = style; + init = false; + if (ref == NULL) + ref = &ref_saved_style; + + ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f); + + if (ImGui::ShowStyleSelector("Colors##Selector")) + ref_saved_style = style; + ImGui::ShowFontSelector("Fonts##Selector"); + + // Simplified Settings + if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f")) + style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding + { bool window_border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &window_border)) style.WindowBorderSize = window_border ? 1.0f : 0.0f; } + ImGui::SameLine(); + { bool frame_border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &frame_border)) style.FrameBorderSize = frame_border ? 1.0f : 0.0f; } + ImGui::SameLine(); + { bool popup_border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &popup_border)) style.PopupBorderSize = popup_border ? 1.0f : 0.0f; } + + // Save/Revert button + if (ImGui::Button("Save Ref")) + *ref = ref_saved_style = style; + ImGui::SameLine(); + if (ImGui::Button("Revert Ref")) + style = *ref; + ImGui::SameLine(); + ShowHelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. Use \"Export Colors\" below to save them somewhere."); + + if (ImGui::TreeNode("Rendering")) + { + ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well."); + ImGui::Checkbox("Anti-aliased fill", &style.AntiAliasedFill); + ImGui::PushItemWidth(100); + ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, "%.2f", 2.0f); + if (style.CurveTessellationTol < 0.10f) style.CurveTessellationTol = 0.10f; + ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero. + ImGui::PopItemWidth(); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Settings")) + { + ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); + ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 16.0f, "%.0f"); + ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); + ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f"); + ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); + ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); + ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); + ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); + ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); + ImGui::Text("BorderSize"); + ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f"); + ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f"); + ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f"); + ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f"); + ImGui::Text("Rounding"); + ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 14.0f, "%.0f"); + ImGui::SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 16.0f, "%.0f"); + ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"); + ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); + ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f"); + ImGui::Text("Alignment"); + ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f"); + ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); ShowHelpMarker("Alignment applies when a button is larger than its text content."); + ImGui::Text("Safe Area Padding"); ImGui::SameLine(); ShowHelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured)."); + ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Colors")) + { + static int output_dest = 0; + static bool output_only_modified = true; + if (ImGui::Button("Export Unsaved")) + { + if (output_dest == 0) + ImGui::LogToClipboard(); + else + ImGui::LogToTTY(); + ImGui::LogText("ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE); + for (int i = 0; i < ImGuiCol_COUNT; i++) + { + const ImVec4& col = style.Colors[i]; + const char* name = ImGui::GetStyleColorName(i); + if (!output_only_modified || memcmp(&col, &ref->Colors[i], sizeof(ImVec4)) != 0) + ImGui::LogText("colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE, name, 23-(int)strlen(name), "", col.x, col.y, col.z, col.w); + } + ImGui::LogFinish(); + } + ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0"); ImGui::PopItemWidth(); + ImGui::SameLine(); ImGui::Checkbox("Only Modified Colors", &output_only_modified); + + ImGui::Text("Tip: Left-click on colored square to open color picker,\nRight-click to open edit options menu."); + + static ImGuiTextFilter filter; + filter.Draw("Filter colors", 200); + + static ImGuiColorEditFlags alpha_flags = 0; + ImGui::RadioButton("Opaque", &alpha_flags, 0); ImGui::SameLine(); + ImGui::RadioButton("Alpha", &alpha_flags, ImGuiColorEditFlags_AlphaPreview); ImGui::SameLine(); + ImGui::RadioButton("Both", &alpha_flags, ImGuiColorEditFlags_AlphaPreviewHalf); + + ImGui::BeginChild("#colors", ImVec2(0, 300), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar | ImGuiWindowFlags_NavFlattened); + ImGui::PushItemWidth(-160); + for (int i = 0; i < ImGuiCol_COUNT; i++) + { + const char* name = ImGui::GetStyleColorName(i); + if (!filter.PassFilter(name)) + continue; + ImGui::PushID(i); + ImGui::ColorEdit4("##color", (float*)&style.Colors[i], ImGuiColorEditFlags_AlphaBar | alpha_flags); + if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0) + { + // Tips: in a real user application, you may want to merge and use an icon font into the main font, so instead of "Save"/"Revert" you'd use icons. + // Read the FAQ and misc/fonts/README.txt about using icon fonts. It's really easy and super convenient! + ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) ref->Colors[i] = style.Colors[i]; + ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) style.Colors[i] = ref->Colors[i]; + } + ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); + ImGui::TextUnformatted(name); + ImGui::PopID(); + } + ImGui::PopItemWidth(); + ImGui::EndChild(); + + ImGui::TreePop(); + } + + bool fonts_opened = ImGui::TreeNode("Fonts", "Fonts (%d)", ImGui::GetIO().Fonts->Fonts.Size); + if (fonts_opened) + { + ImFontAtlas* atlas = ImGui::GetIO().Fonts; + if (ImGui::TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) + { + ImGui::Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0,0), ImVec2(1,1), ImColor(255,255,255,255), ImColor(255,255,255,128)); + ImGui::TreePop(); + } + ImGui::PushItemWidth(100); + for (int i = 0; i < atlas->Fonts.Size; i++) + { + ImFont* font = atlas->Fonts[i]; + ImGui::PushID(font); + bool font_details_opened = ImGui::TreeNode(font, "Font %d: \'%s\', %.2f px, %d glyphs", i, font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size); + ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) ImGui::GetIO().FontDefault = font; + if (font_details_opened) + { + ImGui::PushFont(font); + ImGui::Text("The quick brown fox jumps over the lazy dog"); + ImGui::PopFont(); + ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font + ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)"); + ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, "%.0f"); + ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent); + ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar); + ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)sqrtf((float)font->MetricsTotalSurface), (int)sqrtf((float)font->MetricsTotalSurface)); + for (int config_i = 0; config_i < font->ConfigDataCount; config_i++) + if (ImFontConfig* cfg = &font->ConfigData[config_i]) + ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH); + if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size)) + { + // Display all glyphs of the fonts in separate pages of 256 characters + for (int base = 0; base < 0x10000; base += 256) + { + int count = 0; + for (int n = 0; n < 256; n++) + count += font->FindGlyphNoFallback((ImWchar)(base + n)) ? 1 : 0; + if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ? "glyphs" : "glyph")) + { + float cell_size = font->FontSize * 1; + float cell_spacing = style.ItemSpacing.y; + ImVec2 base_pos = ImGui::GetCursorScreenPos(); + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + for (int n = 0; n < 256; n++) + { + ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing)); + ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size); + const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base+n)); + draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255,255,255,100) : IM_COL32(255,255,255,50)); + if (glyph) + font->RenderChar(draw_list, cell_size, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base+n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string. + if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2)) + { + ImGui::BeginTooltip(); + ImGui::Text("Codepoint: U+%04X", base+n); + ImGui::Separator(); + ImGui::Text("AdvanceX: %.1f", glyph->AdvanceX); + ImGui::Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1); + ImGui::Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1); + ImGui::EndTooltip(); + } + } + ImGui::Dummy(ImVec2((cell_size + cell_spacing) * 16, (cell_size + cell_spacing) * 16)); + ImGui::TreePop(); + } + } + ImGui::TreePop(); + } + ImGui::TreePop(); + } + ImGui::PopID(); + } + static float window_scale = 1.0f; + ImGui::DragFloat("this window scale", &window_scale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale only this window + ImGui::DragFloat("global scale", &ImGui::GetIO().FontGlobalScale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale everything + ImGui::PopItemWidth(); + ImGui::SetWindowFontScale(window_scale); + ImGui::TreePop(); + } + + ImGui::PopItemWidth(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar() +//----------------------------------------------------------------------------- + +// Demonstrate creating a fullscreen menu bar and populating it. +static void ShowExampleAppMainMenuBar() +{ + if (ImGui::BeginMainMenuBar()) + { + if (ImGui::BeginMenu("File")) + { + ShowExampleMenuFile(); + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Edit")) + { + if (ImGui::MenuItem("Undo", "CTRL+Z")) {} + if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item + ImGui::Separator(); + if (ImGui::MenuItem("Cut", "CTRL+X")) {} + if (ImGui::MenuItem("Copy", "CTRL+C")) {} + if (ImGui::MenuItem("Paste", "CTRL+V")) {} + ImGui::EndMenu(); + } + ImGui::EndMainMenuBar(); + } +} + +static void ShowExampleMenuFile() +{ + ImGui::MenuItem("(dummy menu)", NULL, false, false); + if (ImGui::MenuItem("New")) {} + if (ImGui::MenuItem("Open", "Ctrl+O")) {} + if (ImGui::BeginMenu("Open Recent")) + { + ImGui::MenuItem("fish_hat.c"); + ImGui::MenuItem("fish_hat.inl"); + ImGui::MenuItem("fish_hat.h"); + if (ImGui::BeginMenu("More..")) + { + ImGui::MenuItem("Hello"); + ImGui::MenuItem("Sailor"); + if (ImGui::BeginMenu("Recurse..")) + { + ShowExampleMenuFile(); + ImGui::EndMenu(); + } + ImGui::EndMenu(); + } + ImGui::EndMenu(); + } + if (ImGui::MenuItem("Save", "Ctrl+S")) {} + if (ImGui::MenuItem("Save As..")) {} + ImGui::Separator(); + if (ImGui::BeginMenu("Options")) + { + static bool enabled = true; + ImGui::MenuItem("Enabled", "", &enabled); + ImGui::BeginChild("child", ImVec2(0, 60), true); + for (int i = 0; i < 10; i++) + ImGui::Text("Scrolling Text %d", i); + ImGui::EndChild(); + static float f = 0.5f; + static int n = 0; + static bool b = true; + ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); + ImGui::InputFloat("Input", &f, 0.1f); + ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); + ImGui::Checkbox("Check", &b); + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Colors")) + { + float sz = ImGui::GetTextLineHeight(); + for (int i = 0; i < ImGuiCol_COUNT; i++) + { + const char* name = ImGui::GetStyleColorName((ImGuiCol)i); + ImVec2 p = ImGui::GetCursorScreenPos(); + ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x+sz, p.y+sz), ImGui::GetColorU32((ImGuiCol)i)); + ImGui::Dummy(ImVec2(sz, sz)); + ImGui::SameLine(); + ImGui::MenuItem(name); + } + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Disabled", false)) // Disabled + { + IM_ASSERT(0); + } + if (ImGui::MenuItem("Checked", NULL, true)) {} + if (ImGui::MenuItem("Quit", "Alt+F4")) {} +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Debug Console / ShowExampleAppConsole() +//----------------------------------------------------------------------------- + +// Demonstrate creating a simple console window, with scrolling, filtering, completion and history. +// For the console example, here we are using a more C++ like approach of declaring a class to hold the data and the functions. +struct ExampleAppConsole +{ + char InputBuf[256]; + ImVector Items; + bool ScrollToBottom; + ImVector History; + int HistoryPos; // -1: new line, 0..History.Size-1 browsing history. + ImVector Commands; + + ExampleAppConsole() + { + ClearLog(); + memset(InputBuf, 0, sizeof(InputBuf)); + HistoryPos = -1; + Commands.push_back("HELP"); + Commands.push_back("HISTORY"); + Commands.push_back("CLEAR"); + Commands.push_back("CLASSIFY"); // "classify" is only here to provide an example of "C"+[tab] completing to "CL" and displaying matches. + AddLog("Welcome to Dear ImGui!"); + } + ~ExampleAppConsole() + { + ClearLog(); + for (int i = 0; i < History.Size; i++) + free(History[i]); + } + + // Portable helpers + static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } + static int Strnicmp(const char* str1, const char* str2, int n) { int d = 0; while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; } return d; } + static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = malloc(len); return (char*)memcpy(buff, (const void*)str, len); } + static void Strtrim(char* str) { char* str_end = str + strlen(str); while (str_end > str && str_end[-1] == ' ') str_end--; *str_end = 0; } + + void ClearLog() + { + for (int i = 0; i < Items.Size; i++) + free(Items[i]); + Items.clear(); + ScrollToBottom = true; + } + + void AddLog(const char* fmt, ...) IM_FMTARGS(2) + { + // FIXME-OPT + char buf[1024]; + va_list args; + va_start(args, fmt); + vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); + buf[IM_ARRAYSIZE(buf)-1] = 0; + va_end(args); + Items.push_back(Strdup(buf)); + ScrollToBottom = true; + } + + void Draw(const char* title, bool* p_open) + { + ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver); + if (!ImGui::Begin(title, p_open)) + { + ImGui::End(); + return; + } + + // As a specific feature guaranteed by the library, after calling Begin() the last Item represent the title bar. So e.g. IsItemHovered() will return true when hovering the title bar. + // Here we create a context menu only available from the title bar. + if (ImGui::BeginPopupContextItem()) + { + if (ImGui::MenuItem("Close Console")) + *p_open = false; + ImGui::EndPopup(); + } + + ImGui::TextWrapped("This example implements a console with basic coloring, completion and history. A more elaborate implementation may want to store entries along with extra data such as timestamp, emitter, etc."); + ImGui::TextWrapped("Enter 'HELP' for help, press TAB to use text completion."); + + // TODO: display items starting from the bottom + + if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.Size); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine(); + if (ImGui::SmallButton("Add Dummy Error")) { AddLog("[error] something went wrong"); } ImGui::SameLine(); + if (ImGui::SmallButton("Clear")) { ClearLog(); } ImGui::SameLine(); + bool copy_to_clipboard = ImGui::SmallButton("Copy"); ImGui::SameLine(); + if (ImGui::SmallButton("Scroll to bottom")) ScrollToBottom = true; + //static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); } + + ImGui::Separator(); + + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); + static ImGuiTextFilter filter; + filter.Draw("Filter (\"incl,-excl\") (\"error\")", 180); + ImGui::PopStyleVar(); + ImGui::Separator(); + + const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); // 1 separator, 1 input text + ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar); // Leave room for 1 separator + 1 InputText + if (ImGui::BeginPopupContextWindow()) + { + if (ImGui::Selectable("Clear")) ClearLog(); + ImGui::EndPopup(); + } + + // Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); + // NB- if you have thousands of entries this approach may be too inefficient and may require user-side clipping to only process visible items. + // You can seek and display only the lines that are visible using the ImGuiListClipper helper, if your elements are evenly spaced and you have cheap random access to the elements. + // To use the clipper we could replace the 'for (int i = 0; i < Items.Size; i++)' loop with: + // ImGuiListClipper clipper(Items.Size); + // while (clipper.Step()) + // for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) + // However, note that you can not use this code as is if a filter is active because it breaks the 'cheap random-access' property. We would need random-access on the post-filtered list. + // A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices that passed the filtering test, recomputing this array when user changes the filter, + // and appending newly elements as they are inserted. This is left as a task to the user until we can manage to improve this example code! + // If your items are of variable size you may want to implement code similar to what ImGuiListClipper does. Or split your data into fixed height items to allow random-seeking into your list. + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing + if (copy_to_clipboard) + ImGui::LogToClipboard(); + ImVec4 col_default_text = ImGui::GetStyleColorVec4(ImGuiCol_Text); + for (int i = 0; i < Items.Size; i++) + { + const char* item = Items[i]; + if (!filter.PassFilter(item)) + continue; + ImVec4 col = col_default_text; + if (strstr(item, "[error]")) col = ImColor(1.0f,0.4f,0.4f,1.0f); + else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f); + ImGui::PushStyleColor(ImGuiCol_Text, col); + ImGui::TextUnformatted(item); + ImGui::PopStyleColor(); + } + if (copy_to_clipboard) + ImGui::LogFinish(); + if (ScrollToBottom) + ImGui::SetScrollHereY(1.0f); + ScrollToBottom = false; + ImGui::PopStyleVar(); + ImGui::EndChild(); + ImGui::Separator(); + + // Command-line + bool reclaim_focus = false; + if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this)) + { + char* s = InputBuf; + Strtrim(s); + if (s[0]) + ExecCommand(s); + strcpy(s, ""); + reclaim_focus = true; + } + + // Auto-focus on window apparition + ImGui::SetItemDefaultFocus(); + if (reclaim_focus) + ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget + + ImGui::End(); + } + + void ExecCommand(const char* command_line) + { + AddLog("# %s\n", command_line); + + // Insert into history. First find match and delete it so it can be pushed to the back. This isn't trying to be smart or optimal. + HistoryPos = -1; + for (int i = History.Size-1; i >= 0; i--) + if (Stricmp(History[i], command_line) == 0) + { + free(History[i]); + History.erase(History.begin() + i); + break; + } + History.push_back(Strdup(command_line)); + + // Process command + if (Stricmp(command_line, "CLEAR") == 0) + { + ClearLog(); + } + else if (Stricmp(command_line, "HELP") == 0) + { + AddLog("Commands:"); + for (int i = 0; i < Commands.Size; i++) + AddLog("- %s", Commands[i]); + } + else if (Stricmp(command_line, "HISTORY") == 0) + { + int first = History.Size - 10; + for (int i = first > 0 ? first : 0; i < History.Size; i++) + AddLog("%3d: %s\n", i, History[i]); + } + else + { + AddLog("Unknown command: '%s'\n", command_line); + } + } + + static int TextEditCallbackStub(ImGuiInputTextCallbackData* data) // In C++11 you are better off using lambdas for this sort of forwarding callbacks + { + ExampleAppConsole* console = (ExampleAppConsole*)data->UserData; + return console->TextEditCallback(data); + } + + int TextEditCallback(ImGuiInputTextCallbackData* data) + { + //AddLog("cursor: %d, selection: %d-%d", data->CursorPos, data->SelectionStart, data->SelectionEnd); + switch (data->EventFlag) + { + case ImGuiInputTextFlags_CallbackCompletion: + { + // Example of TEXT COMPLETION + + // Locate beginning of current word + const char* word_end = data->Buf + data->CursorPos; + const char* word_start = word_end; + while (word_start > data->Buf) + { + const char c = word_start[-1]; + if (c == ' ' || c == '\t' || c == ',' || c == ';') + break; + word_start--; + } + + // Build a list of candidates + ImVector candidates; + for (int i = 0; i < Commands.Size; i++) + if (Strnicmp(Commands[i], word_start, (int)(word_end-word_start)) == 0) + candidates.push_back(Commands[i]); + + if (candidates.Size == 0) + { + // No match + AddLog("No match for \"%.*s\"!\n", (int)(word_end-word_start), word_start); + } + else if (candidates.Size == 1) + { + // Single match. Delete the beginning of the word and replace it entirely so we've got nice casing + data->DeleteChars((int)(word_start-data->Buf), (int)(word_end-word_start)); + data->InsertChars(data->CursorPos, candidates[0]); + data->InsertChars(data->CursorPos, " "); + } + else + { + // Multiple matches. Complete as much as we can, so inputing "C" will complete to "CL" and display "CLEAR" and "CLASSIFY" + int match_len = (int)(word_end - word_start); + for (;;) + { + int c = 0; + bool all_candidates_matches = true; + for (int i = 0; i < candidates.Size && all_candidates_matches; i++) + if (i == 0) + c = toupper(candidates[i][match_len]); + else if (c == 0 || c != toupper(candidates[i][match_len])) + all_candidates_matches = false; + if (!all_candidates_matches) + break; + match_len++; + } + + if (match_len > 0) + { + data->DeleteChars((int)(word_start - data->Buf), (int)(word_end-word_start)); + data->InsertChars(data->CursorPos, candidates[0], candidates[0] + match_len); + } + + // List matches + AddLog("Possible matches:\n"); + for (int i = 0; i < candidates.Size; i++) + AddLog("- %s\n", candidates[i]); + } + + break; + } + case ImGuiInputTextFlags_CallbackHistory: + { + // Example of HISTORY + const int prev_history_pos = HistoryPos; + if (data->EventKey == ImGuiKey_UpArrow) + { + if (HistoryPos == -1) + HistoryPos = History.Size - 1; + else if (HistoryPos > 0) + HistoryPos--; + } + else if (data->EventKey == ImGuiKey_DownArrow) + { + if (HistoryPos != -1) + if (++HistoryPos >= History.Size) + HistoryPos = -1; + } + + // A better implementation would preserve the data on the current input line along with cursor position. + if (prev_history_pos != HistoryPos) + { + const char* history_str = (HistoryPos >= 0) ? History[HistoryPos] : ""; + data->DeleteChars(0, data->BufTextLen); + data->InsertChars(0, history_str); + } + } + } + return 0; + } +}; + +static void ShowExampleAppConsole(bool* p_open) +{ + static ExampleAppConsole console; + console.Draw("Example: Console", p_open); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Debug Log / ShowExampleAppLog() +//----------------------------------------------------------------------------- + +// Usage: +// static ExampleAppLog my_log; +// my_log.AddLog("Hello %d world\n", 123); +// my_log.Draw("title"); +struct ExampleAppLog +{ + ImGuiTextBuffer Buf; + ImGuiTextFilter Filter; + ImVector LineOffsets; // Index to lines offset + bool ScrollToBottom; + + void Clear() { Buf.clear(); LineOffsets.clear(); } + + void AddLog(const char* fmt, ...) IM_FMTARGS(2) + { + int old_size = Buf.size(); + va_list args; + va_start(args, fmt); + Buf.appendfv(fmt, args); + va_end(args); + for (int new_size = Buf.size(); old_size < new_size; old_size++) + if (Buf[old_size] == '\n') + LineOffsets.push_back(old_size); + ScrollToBottom = true; + } + + void Draw(const char* title, bool* p_open = NULL) + { + ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver); + if (!ImGui::Begin(title, p_open)) + { + ImGui::End(); + return; + } + if (ImGui::Button("Clear")) Clear(); + ImGui::SameLine(); + bool copy = ImGui::Button("Copy"); + ImGui::SameLine(); + Filter.Draw("Filter", -100.0f); + ImGui::Separator(); + ImGui::BeginChild("scrolling", ImVec2(0,0), false, ImGuiWindowFlags_HorizontalScrollbar); + if (copy) ImGui::LogToClipboard(); + + if (Filter.IsActive()) + { + const char* buf_begin = Buf.begin(); + const char* line = buf_begin; + for (int line_no = 0; line != NULL; line_no++) + { + const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL; + if (Filter.PassFilter(line, line_end)) + ImGui::TextUnformatted(line, line_end); + line = line_end && line_end[1] ? line_end + 1 : NULL; + } + } + else + { + ImGui::TextUnformatted(Buf.begin()); + } + + if (ScrollToBottom) + ImGui::SetScrollHereY(1.0f); + ScrollToBottom = false; + ImGui::EndChild(); + ImGui::End(); + } +}; + +// Demonstrate creating a simple log window with basic filtering. +static void ShowExampleAppLog(bool* p_open) +{ + static ExampleAppLog log; + + // Demo: add random items (unless Ctrl is held) + static double last_time = -1.0; + double time = ImGui::GetTime(); + if (time - last_time >= 0.20f && !ImGui::GetIO().KeyCtrl) + { + const char* random_words[] = { "system", "info", "warning", "error", "fatal", "notice", "log" }; + log.AddLog("[%s] Hello, time is %.1f, frame count is %d\n", random_words[rand() % IM_ARRAYSIZE(random_words)], time, ImGui::GetFrameCount()); + last_time = time; + } + + log.Draw("Example: Log", p_open); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Simple Layout / ShowExampleAppLayout() +//----------------------------------------------------------------------------- + +// Demonstrate create a window with multiple child windows. +static void ShowExampleAppLayout(bool* p_open) +{ + ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver); + if (ImGui::Begin("Example: Layout", p_open, ImGuiWindowFlags_MenuBar)) + { + if (ImGui::BeginMenuBar()) + { + if (ImGui::BeginMenu("File")) + { + if (ImGui::MenuItem("Close")) *p_open = false; + ImGui::EndMenu(); + } + ImGui::EndMenuBar(); + } + + // left + static int selected = 0; + ImGui::BeginChild("left pane", ImVec2(150, 0), true); + for (int i = 0; i < 100; i++) + { + char label[128]; + sprintf(label, "MyObject %d", i); + if (ImGui::Selectable(label, selected == i)) + selected = i; + } + ImGui::EndChild(); + ImGui::SameLine(); + + // right + ImGui::BeginGroup(); + ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetFrameHeightWithSpacing())); // Leave room for 1 line below us + ImGui::Text("MyObject: %d", selected); + ImGui::Separator(); + ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "); + ImGui::EndChild(); + if (ImGui::Button("Revert")) {} + ImGui::SameLine(); + if (ImGui::Button("Save")) {} + ImGui::EndGroup(); + } + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Property Editor / ShowExampleAppPropertyEditor() +//----------------------------------------------------------------------------- + +// Demonstrate create a simple property editor. +static void ShowExampleAppPropertyEditor(bool* p_open) +{ + ImGui::SetNextWindowSize(ImVec2(430,450), ImGuiCond_FirstUseEver); + if (!ImGui::Begin("Example: Property editor", p_open)) + { + ImGui::End(); + return; + } + + ShowHelpMarker("This example shows how you may implement a property editor using two columns.\nAll objects/fields data are dummies here.\nRemember that in many simple cases, you can use ImGui::SameLine(xxx) to position\nyour cursor horizontally instead of using the Columns() API."); + + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2,2)); + ImGui::Columns(2); + ImGui::Separator(); + + struct funcs + { + static void ShowDummyObject(const char* prefix, int uid) + { + ImGui::PushID(uid); // Use object uid as identifier. Most commonly you could also use the object pointer as a base ID. + ImGui::AlignTextToFramePadding(); // Text and Tree nodes are less high than regular widgets, here we add vertical spacing to make the tree lines equal high. + bool node_open = ImGui::TreeNode("Object", "%s_%u", prefix, uid); + ImGui::NextColumn(); + ImGui::AlignTextToFramePadding(); + ImGui::Text("my sailor is rich"); + ImGui::NextColumn(); + if (node_open) + { + static float dummy_members[8] = { 0.0f,0.0f,1.0f,3.1416f,100.0f,999.0f }; + for (int i = 0; i < 8; i++) + { + ImGui::PushID(i); // Use field index as identifier. + if (i < 2) + { + ShowDummyObject("Child", 424242); + } + else + { + // Here we use a TreeNode to highlight on hover (we could use e.g. Selectable as well) + ImGui::AlignTextToFramePadding(); + ImGui::TreeNodeEx("Field", ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_Bullet, "Field_%d", i); + ImGui::NextColumn(); + ImGui::PushItemWidth(-1); + if (i >= 5) + ImGui::InputFloat("##value", &dummy_members[i], 1.0f); + else + ImGui::DragFloat("##value", &dummy_members[i], 0.01f); + ImGui::PopItemWidth(); + ImGui::NextColumn(); + } + ImGui::PopID(); + } + ImGui::TreePop(); + } + ImGui::PopID(); + } + }; + + // Iterate dummy objects with dummy members (all the same data) + for (int obj_i = 0; obj_i < 3; obj_i++) + funcs::ShowDummyObject("Object", obj_i); + + ImGui::Columns(1); + ImGui::Separator(); + ImGui::PopStyleVar(); + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Long Text / ShowExampleAppLongText() +//----------------------------------------------------------------------------- + +// Demonstrate/test rendering huge amount of text, and the incidence of clipping. +static void ShowExampleAppLongText(bool* p_open) +{ + ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver); + if (!ImGui::Begin("Example: Long text display", p_open)) + { + ImGui::End(); + return; + } + + static int test_type = 0; + static ImGuiTextBuffer log; + static int lines = 0; + ImGui::Text("Printing unusually long amount of text."); + ImGui::Combo("Test type", &test_type, "Single call to TextUnformatted()\0Multiple calls to Text(), clipped manually\0Multiple calls to Text(), not clipped (slow)\0"); + ImGui::Text("Buffer contents: %d lines, %d bytes", lines, log.size()); + if (ImGui::Button("Clear")) { log.clear(); lines = 0; } + ImGui::SameLine(); + if (ImGui::Button("Add 1000 lines")) + { + for (int i = 0; i < 1000; i++) + log.appendf("%i The quick brown fox jumps over the lazy dog\n", lines+i); + lines += 1000; + } + ImGui::BeginChild("Log"); + switch (test_type) + { + case 0: + // Single call to TextUnformatted() with a big buffer + ImGui::TextUnformatted(log.begin(), log.end()); + break; + case 1: + { + // Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper. + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); + ImGuiListClipper clipper(lines); + while (clipper.Step()) + for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) + ImGui::Text("%i The quick brown fox jumps over the lazy dog", i); + ImGui::PopStyleVar(); + break; + } + case 2: + // Multiple calls to Text(), not clipped (slow) + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); + for (int i = 0; i < lines; i++) + ImGui::Text("%i The quick brown fox jumps over the lazy dog", i); + ImGui::PopStyleVar(); + break; + } + ImGui::EndChild(); + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Auto Resize / ShowExampleAppAutoResize() +//----------------------------------------------------------------------------- + +// Demonstrate creating a window which gets auto-resized according to its content. +static void ShowExampleAppAutoResize(bool* p_open) +{ + if (!ImGui::Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags_AlwaysAutoResize)) + { + ImGui::End(); + return; + } + + static int lines = 10; + ImGui::Text("Window will resize every-frame to the size of its content.\nNote that you probably don't want to query the window size to\noutput your content because that would create a feedback loop."); + ImGui::SliderInt("Number of lines", &lines, 1, 20); + for (int i = 0; i < lines; i++) + ImGui::Text("%*sThis is line %d", i * 4, "", i); // Pad with space to extend size horizontally + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Constrained Resize / ShowExampleAppConstrainedResize() +//----------------------------------------------------------------------------- + +// Demonstrate creating a window with custom resize constraints. +static void ShowExampleAppConstrainedResize(bool* p_open) +{ + struct CustomConstraints // Helper functions to demonstrate programmatic constraints + { + static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize = ImVec2(IM_MAX(data->DesiredSize.x, data->DesiredSize.y), IM_MAX(data->DesiredSize.x, data->DesiredSize.y)); } + static void Step(ImGuiSizeCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); } + }; + + static bool auto_resize = false; + static int type = 0; + static int display_lines = 10; + if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only + if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only + if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100 + if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width 400-500 + if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 500)); // Height 400-500 + if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square + if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)100);// Fixed Step + + ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0; + if (ImGui::Begin("Example: Constrained Resize", p_open, flags)) + { + const char* desc[] = + { + "Resize vertical only", + "Resize horizontal only", + "Width > 100, Height > 100", + "Width 400-500", + "Height 400-500", + "Custom: Always Square", + "Custom: Fixed Steps (100)", + }; + if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine(); + if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine(); + if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); } + ImGui::PushItemWidth(200); + ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc)); + ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100); + ImGui::PopItemWidth(); + ImGui::Checkbox("Auto-resize", &auto_resize); + for (int i = 0; i < display_lines; i++) + ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, ""); + } + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Simple Overlay / ShowExampleAppSimpleOverlay() +//----------------------------------------------------------------------------- + +// Demonstrate creating a simple static window with no decoration + a context-menu to choose which corner of the screen to use. +static void ShowExampleAppSimpleOverlay(bool* p_open) +{ + const float DISTANCE = 10.0f; + static int corner = 0; + ImVec2 window_pos = ImVec2((corner & 1) ? ImGui::GetIO().DisplaySize.x - DISTANCE : DISTANCE, (corner & 2) ? ImGui::GetIO().DisplaySize.y - DISTANCE : DISTANCE); + ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f); + if (corner != -1) + ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot); + ImGui::SetNextWindowBgAlpha(0.3f); // Transparent background + if (ImGui::Begin("Example: Simple Overlay", p_open, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav)) + { + ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)"); + ImGui::Separator(); + if (ImGui::IsMousePosValid()) + ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y); + else + ImGui::Text("Mouse Position: "); + if (ImGui::BeginPopupContextWindow()) + { + if (ImGui::MenuItem("Custom", NULL, corner == -1)) corner = -1; + if (ImGui::MenuItem("Top-left", NULL, corner == 0)) corner = 0; + if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1; + if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2; + if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3; + if (p_open && ImGui::MenuItem("Close")) *p_open = false; + ImGui::EndPopup(); + } + } + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles() +//----------------------------------------------------------------------------- + +// Demonstrate using "##" and "###" in identifiers to manipulate ID generation. +// This apply to all regular items as well. Read FAQ section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." for details. +static void ShowExampleAppWindowTitles(bool*) +{ + // By default, Windows are uniquely identified by their title. + // You can use the "##" and "###" markers to manipulate the display/ID. + + // Using "##" to display same title but have unique identifier. + ImGui::SetNextWindowPos(ImVec2(100, 100), ImGuiCond_FirstUseEver); + ImGui::Begin("Same title as another window##1"); + ImGui::Text("This is window 1.\nMy title is the same as window 2, but my identifier is unique."); + ImGui::End(); + + ImGui::SetNextWindowPos(ImVec2(100, 200), ImGuiCond_FirstUseEver); + ImGui::Begin("Same title as another window##2"); + ImGui::Text("This is window 2.\nMy title is the same as window 1, but my identifier is unique."); + ImGui::End(); + + // Using "###" to display a changing title but keep a static identifier "AnimatedTitle" + char buf[128]; + sprintf(buf, "Animated title %c %d###AnimatedTitle", "|/-\\"[(int)(ImGui::GetTime() / 0.25f) & 3], ImGui::GetFrameCount()); + ImGui::SetNextWindowPos(ImVec2(100, 300), ImGuiCond_FirstUseEver); + ImGui::Begin(buf); + ImGui::Text("This window has a changing title."); + ImGui::End(); +} + +//----------------------------------------------------------------------------- +// [SECTION] Example App: Custom Rendering using ImDrawList API / ShowExampleAppCustomRendering() +//----------------------------------------------------------------------------- + +// Demonstrate using the low-level ImDrawList to draw custom shapes. +static void ShowExampleAppCustomRendering(bool* p_open) +{ + ImGui::SetNextWindowSize(ImVec2(350, 560), ImGuiCond_FirstUseEver); + if (!ImGui::Begin("Example: Custom rendering", p_open)) + { + ImGui::End(); + return; + } + + // Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of overloaded operators, etc. + // Define IM_VEC2_CLASS_EXTRA in imconfig.h to create implicit conversions between your types and ImVec2/ImVec4. + // ImGui defines overloaded operators but they are internal to imgui.cpp and not exposed outside (to avoid messing with your types) + // In this example we are not using the maths operators! + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + + // Primitives + ImGui::Text("Primitives"); + static float sz = 36.0f; + static float thickness = 4.0f; + static ImVec4 col = ImVec4(1.0f, 1.0f, 0.4f, 1.0f); + ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f"); + ImGui::DragFloat("Thickness", &thickness, 0.05f, 1.0f, 8.0f, "%.02f"); + ImGui::ColorEdit3("Color", &col.x); + { + const ImVec2 p = ImGui::GetCursorScreenPos(); + const ImU32 col32 = ImColor(col); + float x = p.x + 4.0f, y = p.y + 4.0f, spacing = 8.0f; + for (int n = 0; n < 2; n++) + { + float curr_thickness = (n == 0) ? 1.0f : thickness; + draw_list->AddCircle(ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 20, curr_thickness); x += sz+spacing; + draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 0.0f, ImDrawCornerFlags_All, curr_thickness); x += sz+spacing; + draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_All, curr_thickness); x += sz+spacing; + draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotRight, curr_thickness); x += sz+spacing; + draw_list->AddTriangle(ImVec2(x+sz*0.5f, y), ImVec2(x+sz,y+sz-0.5f), ImVec2(x,y+sz-0.5f), col32, curr_thickness); x += sz+spacing; + draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y ), col32, curr_thickness); x += sz+spacing; // Horizontal line (note: drawing a filled rectangle will be faster!) + draw_list->AddLine(ImVec2(x, y), ImVec2(x, y+sz), col32, curr_thickness); x += spacing; // Vertical line (note: drawing a filled rectangle will be faster!) + draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, curr_thickness); x += sz+spacing; // Diagonal line + draw_list->AddBezierCurve(ImVec2(x, y), ImVec2(x+sz*1.3f,y+sz*0.3f), ImVec2(x+sz-sz*1.3f,y+sz-sz*0.3f), ImVec2(x+sz, y+sz), col32, curr_thickness); + x = p.x + 4; + y += sz+spacing; + } + draw_list->AddCircleFilled(ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 32); x += sz+spacing; + draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32); x += sz+spacing; + draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f); x += sz+spacing; + draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotRight); x += sz+spacing; + draw_list->AddTriangleFilled(ImVec2(x+sz*0.5f, y), ImVec2(x+sz,y+sz-0.5f), ImVec2(x,y+sz-0.5f), col32); x += sz+spacing; + draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+thickness), col32); x += sz+spacing; // Horizontal line (faster than AddLine, but only handle integer thickness) + draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+thickness, y+sz), col32); x += spacing+spacing; // Vertical line (faster than AddLine, but only handle integer thickness) + draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+1, y+1), col32); x += sz; // Pixel (faster than AddLine) + draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x+sz, y+sz), IM_COL32(0,0,0,255), IM_COL32(255,0,0,255), IM_COL32(255,255,0,255), IM_COL32(0,255,0,255)); + ImGui::Dummy(ImVec2((sz+spacing)*8, (sz+spacing)*3)); + } + ImGui::Separator(); + { + static ImVector points; + static bool adding_line = false; + ImGui::Text("Canvas example"); + if (ImGui::Button("Clear")) points.clear(); + if (points.Size >= 2) { ImGui::SameLine(); if (ImGui::Button("Undo")) { points.pop_back(); points.pop_back(); } } + ImGui::Text("Left-click and drag to add lines,\nRight-click to undo"); + + // Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered() + // But you can also draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos(). + // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max). + ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates! + ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available + if (canvas_size.x < 50.0f) canvas_size.x = 50.0f; + if (canvas_size.y < 50.0f) canvas_size.y = 50.0f; + draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(50, 50, 50, 255), IM_COL32(50, 50, 60, 255), IM_COL32(60, 60, 70, 255), IM_COL32(50, 50, 60, 255)); + draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(255, 255, 255, 255)); + + bool adding_preview = false; + ImGui::InvisibleButton("canvas", canvas_size); + ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y); + if (adding_line) + { + adding_preview = true; + points.push_back(mouse_pos_in_canvas); + if (!ImGui::IsMouseDown(0)) + adding_line = adding_preview = false; + } + if (ImGui::IsItemHovered()) + { + if (!adding_line && ImGui::IsMouseClicked(0)) + { + points.push_back(mouse_pos_in_canvas); + adding_line = true; + } + if (ImGui::IsMouseClicked(1) && !points.empty()) + { + adding_line = adding_preview = false; + points.pop_back(); + points.pop_back(); + } + } + draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.) + for (int i = 0; i < points.Size - 1; i += 2) + draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i + 1].x, canvas_pos.y + points[i + 1].y), IM_COL32(255, 255, 0, 255), 2.0f); + draw_list->PopClipRect(); + if (adding_preview) + points.pop_back(); + } + ImGui::End(); +} + +// End of Demo code +#else + +void ImGui::ShowAboutWindow(bool*) {} +void ImGui::ShowDemoWindow(bool*) {} +void ImGui::ShowUserGuide() {} +void ImGui::ShowStyleEditor(ImGuiStyle*) {} + +#endif diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_draw.cpp similarity index 75% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp rename to 3rdparty/bgfx/3rdparty/dear-imgui/imgui_draw.cpp index a413d4543ae..9b0ca37ac02 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_draw.cpp @@ -1,45 +1,64 @@ -// dear imgui, v1.53 WIP +// dear imgui, v1.67 WIP // (drawing and font code) -// Contains implementation for -// - Default styles -// - ImDrawList -// - ImDrawData -// - ImFontAtlas -// - ImFont -// - Default font data +/* + +Index of this file: + +// [SECTION] STB libraries implementation +// [SECTION] Style functions +// [SECTION] ImDrawList +// [SECTION] ImDrawData +// [SECTION] Helpers ShadeVertsXXX functions +// [SECTION] ImFontConfig +// [SECTION] ImFontAtlas +// [SECTION] ImFontAtlas glyph ranges helpers + GlyphRangesBuilder +// [SECTION] ImFont +// [SECTION] Internal Render Helpers +// [SECTION] Decompression code +// [SECTION] Default font data (ProggyClean.ttf) + +*/ #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) #define _CRT_SECURE_NO_WARNINGS #endif #include "imgui.h" +#ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_PLACEMENT_NEW +#endif #include "imgui_internal.h" #include // vsnprintf, sscanf, printf #if !defined(alloca) -#ifdef _WIN32 +#if defined(__GLIBC__) || defined(__sun) || defined(__CYGWIN__) || defined(__APPLE__) +#include // alloca (glibc uses . Note that Cygwin may have _WIN32 defined, so the order matters here) +#elif defined(_WIN32) #include // alloca -#elif defined(__GLIBC__) || defined(__sun) -#include // alloca +#if !defined(alloca) +#define alloca _alloca // for clang with MS Codegen +#endif #else #include // alloca #endif #endif +// Visual Studio warnings #ifdef _MSC_VER #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen -#define snprintf _snprintf #endif +// Clang/GCC warnings with -Weverything #ifdef __clang__ #pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. #pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok. #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // +#if __has_warning("-Wcomma") +#pragma clang diagnostic ignored "-Wcomma" // warning : possible misuse of comma operator here // +#endif #if __has_warning("-Wreserved-id-macro") #pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // #endif @@ -50,16 +69,21 @@ #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function #pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value -#pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers +#if __GNUC__ >= 8 +#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead +#endif #endif //------------------------------------------------------------------------- -// STB libraries implementation +// [SECTION] STB libraries implementation //------------------------------------------------------------------------- -//#define IMGUI_STB_NAMESPACE ImGuiStb -//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION +// Compile time options: +//#define IMGUI_STB_NAMESPACE ImGuiStb +//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" +//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION +//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION #ifdef IMGUI_STB_NAMESPACE namespace IMGUI_STB_NAMESPACE @@ -75,30 +99,52 @@ namespace IMGUI_STB_NAMESPACE #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-function" #pragma clang diagnostic ignored "-Wmissing-prototypes" +#pragma clang diagnostic ignored "-Wimplicit-fallthrough" +#pragma clang diagnostic ignored "-Wcast-qual" // warning : cast from 'const xxxx *' to 'xxx *' drops const qualifier // #endif #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wtype-limits" // warning: comparison is always true due to limited range of data type [-Wtype-limits] +#pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'const xxxx *' to type 'xxxx *' casts away qualifiers #endif -#define STBRP_ASSERT(x) IM_ASSERT(x) +#ifndef STB_RECT_PACK_IMPLEMENTATION // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds) #ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION #define STBRP_STATIC +#define STBRP_ASSERT(x) IM_ASSERT(x) +#define STBRP_SORT ImQsort #define STB_RECT_PACK_IMPLEMENTATION #endif -#include "stb_rect_pack.h" +#ifdef IMGUI_STB_RECT_PACK_FILENAME +#include IMGUI_STB_RECT_PACK_FILENAME +#else +#include "imstb_rectpack.h" +#endif +#endif -#define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x)) -#define STBTT_free(x,u) ((void)(u), ImGui::MemFree(x)) -#define STBTT_assert(x) IM_ASSERT(x) +#ifndef STB_TRUETYPE_IMPLEMENTATION // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds) #ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION +#define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x)) +#define STBTT_free(x,u) ((void)(u), ImGui::MemFree(x)) +#define STBTT_assert(x) IM_ASSERT(x) +#define STBTT_fmod(x,y) ImFmod(x,y) +#define STBTT_sqrt(x) ImSqrt(x) +#define STBTT_pow(x,y) ImPow(x,y) +#define STBTT_fabs(x) ImFabs(x) +#define STBTT_ifloor(x) ((int)ImFloorStd(x)) +#define STBTT_iceil(x) ((int)ImCeil(x)) #define STBTT_STATIC #define STB_TRUETYPE_IMPLEMENTATION #else #define STBTT_DEF extern #endif -#include "stb_truetype.h" +#ifdef IMGUI_STB_TRUETYPE_FILENAME +#include IMGUI_STB_TRUETYPE_FILENAME +#else +#include "imstb_truetype.h" +#endif +#endif #ifdef __GNUC__ #pragma GCC diagnostic pop @@ -118,9 +164,59 @@ using namespace IMGUI_STB_NAMESPACE; #endif //----------------------------------------------------------------------------- -// Style functions +// [SECTION] Style functions //----------------------------------------------------------------------------- +void ImGui::StyleColorsDark(ImGuiStyle* dst) +{ + ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); + ImVec4* colors = style->Colors; + + colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); + colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f); + colors[ImGuiCol_ChildBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.00f); + colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); + colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); + colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); + colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f); + colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f); + colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); + colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); + colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f); + colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); + colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f); + colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f); + colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); + colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f); + colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); + colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); + colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); + colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f); + colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f); + colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f); + colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); + colors[ImGuiCol_Separator] = colors[ImGuiCol_Border]; + colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f); + colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f); + colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f); + colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); + colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); + colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); + colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); + colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); + colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); + colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f); + colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); +} + void ImGui::StyleColorsClassic(ImGuiStyle* dst) { ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); @@ -159,66 +255,19 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst) colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.16f); colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f); colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f); - colors[ImGuiCol_CloseButton] = ImVec4(0.50f, 0.50f, 0.90f, 0.50f); - colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.70f, 0.70f, 0.90f, 0.60f); - colors[ImGuiCol_CloseButtonActive] = ImVec4(0.70f, 0.70f, 0.70f, 1.00f); colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f); - colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); -} - -void ImGui::StyleColorsDark(ImGuiStyle* dst) -{ - ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); - ImVec4* colors = style->Colors; - - colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); - colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); - colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f); - colors[ImGuiCol_ChildBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.00f); - colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f); - colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); - colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f); - colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); - colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); - colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f); - colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f); - colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); - colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); - colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f); - colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); - colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f); - colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f); - colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f); - colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f); - colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f); - colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f); - colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f); - colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - colors[ImGuiCol_Separator] = colors[ImGuiCol_Border];//ImVec4(0.61f, 0.61f, 0.61f, 1.00f); - colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f); - colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f); - colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f); - colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); - colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); - colors[ImGuiCol_CloseButton] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f); - colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f); - colors[ImGuiCol_CloseButtonActive] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f); - colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); - colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); - colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); - colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); - colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); - colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); + colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f); + colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered]; + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); } +// Those light colors are better suited with a thicker font than the default one + FrameBorder void ImGui::StyleColorsLight(ImGuiStyle* dst) { ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); @@ -226,8 +275,6 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst) colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); - //colors[ImGuiCol_TextHovered] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); - //colors[ImGuiCol_TextActive] = ImVec4(1.00f, 1.00f, 0.00f, 1.00f); colors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f); colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); colors[ImGuiCol_PopupBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f); @@ -259,29 +306,43 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst) colors[ImGuiCol_ResizeGrip] = ImVec4(0.80f, 0.80f, 0.80f, 0.56f); colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); - colors[ImGuiCol_CloseButton] = ImVec4(0.59f, 0.59f, 0.59f, 0.50f); - colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f); - colors[ImGuiCol_CloseButtonActive] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f); colors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f); colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.45f, 0.00f, 1.00f); colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); - colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); + colors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); + colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered]; + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); } - //----------------------------------------------------------------------------- // ImDrawList //----------------------------------------------------------------------------- -static const ImVec4 GNullClipRect(-8192.0f, -8192.0f, +8192.0f, +8192.0f); // Large values that are easy to encode in a few bits+shift +ImDrawListSharedData::ImDrawListSharedData() +{ + Font = NULL; + FontSize = 0.0f; + CurveTessellationTol = 0.0f; + ClipRectFullscreen = ImVec4(-8192.0f, -8192.0f, +8192.0f, +8192.0f); + + // Const data + for (int i = 0; i < IM_ARRAYSIZE(CircleVtx12); i++) + { + const float a = ((float)i * 2 * IM_PI) / (float)IM_ARRAYSIZE(CircleVtx12); + CircleVtx12[i] = ImVec2(ImCos(a), ImSin(a)); + } +} void ImDrawList::Clear() { CmdBuffer.resize(0); IdxBuffer.resize(0); VtxBuffer.resize(0); + Flags = ImDrawListFlags_AntiAliasedLines | ImDrawListFlags_AntiAliasedFill; _VtxCurrentIdx = 0; _VtxWritePtr = NULL; _IdxWritePtr = NULL; @@ -315,8 +376,18 @@ void ImDrawList::ClearFreeMemory() _Channels.clear(); } +ImDrawList* ImDrawList::CloneOutput() const +{ + ImDrawList* dst = IM_NEW(ImDrawList(NULL)); + dst->CmdBuffer = CmdBuffer; + dst->IdxBuffer = IdxBuffer; + dst->VtxBuffer = VtxBuffer; + dst->Flags = Flags; + return dst; +} + // Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds -#define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : GNullClipRect) +#define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : _Data->ClipRectFullscreen) #define GetCurrentTextureId() (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : NULL) void ImDrawList::AddDrawCmd() @@ -324,7 +395,6 @@ void ImDrawList::AddDrawCmd() ImDrawCmd draw_cmd; draw_cmd.ClipRect = GetCurrentClipRect(); draw_cmd.TextureId = GetCurrentTextureId(); - draw_cmd.ViewId = (unsigned char)(GImGui->Style.ViewId); IM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w); CmdBuffer.push_back(draw_cmd); @@ -408,8 +478,7 @@ void ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_ void ImDrawList::PushClipRectFullScreen() { - PushClipRect(ImVec2(GNullClipRect.x, GNullClipRect.y), ImVec2(GNullClipRect.z, GNullClipRect.w)); - //PushClipRect(GetVisibleRect()); // FIXME-OPT: This would be more correct but we're not supposed to access ImGuiContext from here? + PushClipRect(ImVec2(_Data->ClipRectFullscreen.x, _Data->ClipRectFullscreen.y), ImVec2(_Data->ClipRectFullscreen.z, _Data->ClipRectFullscreen.w)); } void ImDrawList::PopClipRect() @@ -419,7 +488,7 @@ void ImDrawList::PopClipRect() UpdateClipRect(); } -void ImDrawList::PushTextureID(const ImTextureID& texture_id) +void ImDrawList::PushTextureID(ImTextureID texture_id) { _TextureIdStack.push_back(texture_id); UpdateTextureID(); @@ -460,7 +529,6 @@ void ImDrawList::ChannelsSplit(int channels_count) ImDrawCmd draw_cmd; draw_cmd.ClipRect = _ClipRectStack.back(); draw_cmd.TextureId = _TextureIdStack.back(); - draw_cmd.ViewId = (unsigned char)(GImGui->Style.ViewId); _Channels[i].CmdBuffer.push_back(draw_cmd); } } @@ -530,7 +598,7 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count) // Fully unrolled with inline call to keep our debug builds decently fast. void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col) { - ImVec2 b(c.x, a.y), d(a.x, c.y), uv(GImGui->FontTexUvWhitePixel); + ImVec2 b(c.x, a.y), d(a.x, c.y), uv(_Data->TexUvWhitePixel); ImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx; _IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx+1); _IdxWritePtr[2] = (ImDrawIdx)(idx+2); _IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx+2); _IdxWritePtr[5] = (ImDrawIdx)(idx+3); @@ -573,21 +641,19 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c } // TODO: Thickness anti-aliased lines cap are missing their AA fringe. -void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, bool closed, float thickness, bool anti_aliased) +void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, bool closed, float thickness) { if (points_count < 2) return; - const ImVec2 uv = GImGui->FontTexUvWhitePixel; - anti_aliased &= GImGui->Style.AntiAliasedLines; - //if (ImGui::GetIO().KeyCtrl) anti_aliased = false; // Debug + const ImVec2 uv = _Data->TexUvWhitePixel; int count = points_count; if (!closed) count = points_count-1; const bool thick_line = thickness > 1.0f; - if (anti_aliased) + if (Flags & ImDrawListFlags_AntiAliasedLines) { // Anti-aliased stroke const float AA_SIZE = 1.0f; @@ -754,18 +820,19 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 } } -void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col, bool anti_aliased) +void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col) { - const ImVec2 uv = GImGui->FontTexUvWhitePixel; - anti_aliased &= GImGui->Style.AntiAliasedShapes; - //if (ImGui::GetIO().KeyCtrl) anti_aliased = false; // Debug + if (points_count < 3) + return; - if (anti_aliased) + const ImVec2 uv = _Data->TexUvWhitePixel; + + if (Flags & ImDrawListFlags_AntiAliasedFill) { // Anti-aliased Fill const float AA_SIZE = 1.0f; const ImU32 col_trans = col & ~IM_COL32_A_MASK; - const int idx_count = (points_count-2)*3 + points_count*6; + const int idx_count = ImMax(0, (points_count-2)*3) + points_count*6; const int vtx_count = (points_count*2); PrimReserve(idx_count, vtx_count); @@ -839,20 +906,6 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun void ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12) { - static ImVec2 circle_vtx[12]; - static bool circle_vtx_builds = false; - const int circle_vtx_count = IM_ARRAYSIZE(circle_vtx); - if (!circle_vtx_builds) - { - for (int i = 0; i < circle_vtx_count; i++) - { - const float a = ((float)i / (float)circle_vtx_count) * 2*IM_PI; - circle_vtx[i].x = cosf(a); - circle_vtx[i].y = sinf(a); - } - circle_vtx_builds = true; - } - if (radius == 0.0f || a_min_of_12 > a_max_of_12) { _Path.push_back(centre); @@ -861,7 +914,7 @@ void ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int a_min_of_ _Path.reserve(_Path.Size + (a_max_of_12 - a_min_of_12 + 1)); for (int a = a_min_of_12; a <= a_max_of_12; a++) { - const ImVec2& c = circle_vtx[a % circle_vtx_count]; + const ImVec2& c = _Data->CircleVtx12[a % IM_ARRAYSIZE(_Data->CircleVtx12)]; _Path.push_back(ImVec2(centre.x + c.x * radius, centre.y + c.y * radius)); } } @@ -877,7 +930,7 @@ void ImDrawList::PathArcTo(const ImVec2& centre, float radius, float a_min, floa for (int i = 0; i <= num_segments; i++) { const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min); - _Path.push_back(ImVec2(centre.x + cosf(a) * radius, centre.y + sinf(a) * radius)); + _Path.push_back(ImVec2(centre.x + ImCos(a) * radius, centre.y + ImSin(a) * radius)); } } @@ -913,7 +966,7 @@ void ImDrawList::PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImV if (num_segments == 0) { // Auto-tessellated - PathBezierToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, GImGui->Style.CurveTessellationTol, 0); + PathBezierToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); } else { @@ -933,8 +986,8 @@ void ImDrawList::PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImV void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, int rounding_corners) { - rounding = ImMin(rounding, fabsf(b.x - a.x) * ( ((rounding_corners & ImDrawCornerFlags_Top) == ImDrawCornerFlags_Top) || ((rounding_corners & ImDrawCornerFlags_Bot) == ImDrawCornerFlags_Bot) ? 0.5f : 1.0f ) - 1.0f); - rounding = ImMin(rounding, fabsf(b.y - a.y) * ( ((rounding_corners & ImDrawCornerFlags_Left) == ImDrawCornerFlags_Left) || ((rounding_corners & ImDrawCornerFlags_Right) == ImDrawCornerFlags_Right) ? 0.5f : 1.0f ) - 1.0f); + rounding = ImMin(rounding, ImFabs(b.x - a.x) * ( ((rounding_corners & ImDrawCornerFlags_Top) == ImDrawCornerFlags_Top) || ((rounding_corners & ImDrawCornerFlags_Bot) == ImDrawCornerFlags_Bot) ? 0.5f : 1.0f ) - 1.0f); + rounding = ImMin(rounding, ImFabs(b.y - a.y) * ( ((rounding_corners & ImDrawCornerFlags_Left) == ImDrawCornerFlags_Left) || ((rounding_corners & ImDrawCornerFlags_Right) == ImDrawCornerFlags_Right) ? 0.5f : 1.0f ) - 1.0f); if (rounding <= 0.0f || rounding_corners == 0) { @@ -970,7 +1023,10 @@ void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float roun { if ((col & IM_COL32_A_MASK) == 0) return; - PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners_flags); + if (Flags & ImDrawListFlags_AntiAliasedLines) + PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.50f,0.50f), rounding, rounding_corners_flags); + else + PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.49f,0.49f), rounding, rounding_corners_flags); // Better looking lower-right corner and rounded non-AA shapes. PathStroke(col, true, thickness); } @@ -995,7 +1051,7 @@ void ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 if (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0) return; - const ImVec2 uv = GImGui->FontTexUvWhitePixel; + const ImVec2 uv = _Data->TexUvWhitePixel; PrimReserve(6, 4); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+1)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx+3)); @@ -1091,12 +1147,11 @@ void ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, if (text_begin == text_end) return; - // IMPORTANT: This is one of the few instance of breaking the encapsulation of ImDrawList, as we pull this from ImGui state, but it is just SO useful. - // Might just move Font/FontSize to ImDrawList? + // Pull default font/size from the shared ImDrawListSharedData instance if (font == NULL) - font = GImGui->Font; + font = _Data->Font; if (font_size == 0.0f) - font_size = GImGui->FontSize; + font_size = _Data->FontSize; IM_ASSERT(font->ContainerAtlas->TexID == _TextureIdStack.back()); // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font. @@ -1167,14 +1222,14 @@ void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, c PathRect(a, b, rounding, rounding_corners); PathFillConvex(col); int vert_end_idx = VtxBuffer.Size; - ImGui::ShadeVertsLinearUV(VtxBuffer.Data + vert_start_idx, VtxBuffer.Data + vert_end_idx, a, b, uv_a, uv_b, true); + ImGui::ShadeVertsLinearUV(this, vert_start_idx, vert_end_idx, a, b, uv_a, uv_b, true); if (push_texture_id) PopTextureID(); } //----------------------------------------------------------------------------- -// ImDrawData +// [SECTION] ImDrawData //----------------------------------------------------------------------------- // For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! @@ -1211,14 +1266,16 @@ void ImDrawData::ScaleClipRects(const ImVec2& scale) } //----------------------------------------------------------------------------- -// Shade functions +// [SECTION] Helpers ShadeVertsXXX functions //----------------------------------------------------------------------------- // Generic linear color gradient, write to RGB fields, leave A untouched. -void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDrawVert* vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1) +void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1) { ImVec2 gradient_extent = gradient_p1 - gradient_p0; float gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent); + ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx; + ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx; for (ImDrawVert* vert = vert_start; vert < vert_end; vert++) { float d = ImDot(vert->pos - gradient_p0, gradient_extent); @@ -1230,37 +1287,21 @@ void ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDra } } -// Scan and shade backward from the end of given vertices. Assume vertices are text only (= vert_start..vert_end going left to right) so we can break as soon as we are out the gradient bounds. -void ImGui::ShadeVertsLinearAlphaGradientForLeftToRightText(ImDrawVert* vert_start, ImDrawVert* vert_end, float gradient_p0_x, float gradient_p1_x) -{ - float gradient_extent_x = gradient_p1_x - gradient_p0_x; - float gradient_inv_length2 = 1.0f / (gradient_extent_x * gradient_extent_x); - int full_alpha_count = 0; - for (ImDrawVert* vert = vert_end - 1; vert >= vert_start; vert--) - { - float d = (vert->pos.x - gradient_p0_x) * (gradient_extent_x); - float alpha_mul = 1.0f - ImClamp(d * gradient_inv_length2, 0.0f, 1.0f); - if (alpha_mul >= 1.0f && ++full_alpha_count > 2) - return; // Early out - int a = (int)(((vert->col >> IM_COL32_A_SHIFT) & 0xFF) * alpha_mul); - vert->col = (vert->col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT); - } -} - // Distribute UV over (a, b) rectangle -void ImGui::ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp) +void ImGui::ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp) { const ImVec2 size = b - a; const ImVec2 uv_size = uv_b - uv_a; const ImVec2 scale = ImVec2( - size.x ? (uv_size.x / size.x) : 0.0f, - size.y ? (uv_size.y / size.y) : 0.0f); + size.x != 0.0f ? (uv_size.x / size.x) : 0.0f, + size.y != 0.0f ? (uv_size.y / size.y) : 0.0f); + ImDrawVert* vert_start = draw_list->VtxBuffer.Data + vert_start_idx; + ImDrawVert* vert_end = draw_list->VtxBuffer.Data + vert_end_idx; if (clamp) { const ImVec2 min = ImMin(uv_a, uv_b); const ImVec2 max = ImMax(uv_a, uv_b); - for (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex) vertex->uv = ImClamp(uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale), min, max); } @@ -1272,7 +1313,7 @@ void ImGui::ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, con } //----------------------------------------------------------------------------- -// ImFontConfig +// [SECTION] ImFontConfig //----------------------------------------------------------------------------- ImFontConfig::ImFontConfig() @@ -1288,6 +1329,8 @@ ImFontConfig::ImFontConfig() GlyphExtraSpacing = ImVec2(0.0f, 0.0f); GlyphOffset = ImVec2(0.0f, 0.0f); GlyphRanges = NULL; + GlyphMinAdvanceX = 0.0f; + GlyphMaxAdvanceX = FLT_MAX; MergeMode = false; RasterizerFlags = 0x00; RasterizerMultiply = 1.0f; @@ -1296,78 +1339,84 @@ ImFontConfig::ImFontConfig() } //----------------------------------------------------------------------------- -// ImFontAtlas +// [SECTION] ImFontAtlas //----------------------------------------------------------------------------- // A work of art lies ahead! (. = white layer, X = black layer, others are blank) // The white texels on the top left are the ones we'll use everywhere in ImGui to render filled shapes. -const int FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF = 90; +const int FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF = 108; const int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27; const unsigned int FONT_ATLAS_DEFAULT_TEX_DATA_ID = 0x80000000; static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] = { - "..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX" - "..- -X.....X- X.X - X.X -X.....X - X.....X" - "--- -XXX.XXX- X...X - X...X -X....X - X....X" - "X - X.X - X.....X - X.....X -X...X - X...X" - "XX - X.X -X.......X- X.......X -X..X.X - X.X..X" - "X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X" - "X..X - X.X - X.X - X.X -XX X.X - X.X XX" - "X...X - X.X - X.X - XX X.X XX - X.X - X.X " - "X....X - X.X - X.X - X.X X.X X.X - X.X - X.X " - "X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X " - "X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X " - "X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X " - "X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X " - "X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X " - "X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X " - "X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X " - "X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX " - "X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------" - "X.X X..X - -X.......X- X.......X - XX XX - " - "XX X..X - - X.....X - X.....X - X.X X.X - " - " X..X - X...X - X...X - X..X X..X - " - " XX - X.X - X.X - X...XXXXXXXXXXXXX...X - " - "------------ - X - X -X.....................X- " - " ----------------------------------- X...XXXXXXXXXXXXX...X - " - " - X..X X..X - " - " - X.X X.X - " - " - XX XX - " + "..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX- XX " + "..- -X.....X- X.X - X.X -X.....X - X.....X- X..X " + "--- -XXX.XXX- X...X - X...X -X....X - X....X- X..X " + "X - X.X - X.....X - X.....X -X...X - X...X- X..X " + "XX - X.X -X.......X- X.......X -X..X.X - X.X..X- X..X " + "X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X- X..XXX " + "X..X - X.X - X.X - X.X -XX X.X - X.X XX- X..X..XXX " + "X...X - X.X - X.X - XX X.X XX - X.X - X.X - X..X..X..XX " + "X....X - X.X - X.X - X.X X.X X.X - X.X - X.X - X..X..X..X.X " + "X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X -XXX X..X..X..X..X" + "X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X -X..XX........X..X" + "X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X -X...X...........X" + "X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X - X..............X" + "X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X - X.............X" + "X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X - X.............X" + "X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X - X............X" + "X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX - X...........X " + "X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------- X..........X " + "X.X X..X - -X.......X- X.......X - XX XX - - X..........X " + "XX X..X - - X.....X - X.....X - X.X X.X - - X........X " + " X..X - X...X - X...X - X..X X..X - - X........X " + " XX - X.X - X.X - X...XXXXXXXXXXXXX...X - - XXXXXXXXXX " + "------------ - X - X -X.....................X- ------------------" + " ----------------------------------- X...XXXXXXXXXXXXX...X - " + " - X..X X..X - " + " - X.X X.X - " + " - XX XX - " }; -static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_Count_][3] = +static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3] = { // Pos ........ Size ......... Offset ...... - { ImVec2(0,3), ImVec2(12,19), ImVec2( 0, 0) }, // ImGuiMouseCursor_Arrow - { ImVec2(13,0), ImVec2(7,16), ImVec2( 4, 8) }, // ImGuiMouseCursor_TextInput - { ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_Move - { ImVec2(21,0), ImVec2( 9,23), ImVec2( 5,11) }, // ImGuiMouseCursor_ResizeNS - { ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 5) }, // ImGuiMouseCursor_ResizeEW - { ImVec2(73,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNESW - { ImVec2(55,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNWSE + { ImVec2( 0,3), ImVec2(12,19), ImVec2( 0, 0) }, // ImGuiMouseCursor_Arrow + { ImVec2(13,0), ImVec2( 7,16), ImVec2( 1, 8) }, // ImGuiMouseCursor_TextInput + { ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_ResizeAll + { ImVec2(21,0), ImVec2( 9,23), ImVec2( 4,11) }, // ImGuiMouseCursor_ResizeNS + { ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 4) }, // ImGuiMouseCursor_ResizeEW + { ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNESW + { ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNWSE + { ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, // ImGuiMouseCursor_Hand }; - ImFontAtlas::ImFontAtlas() { - TexID = NULL; + Locked = false; + Flags = ImFontAtlasFlags_None; + TexID = (ImTextureID)NULL; TexDesiredWidth = 0; TexGlyphPadding = 1; + TexPixelsAlpha8 = NULL; TexPixelsRGBA32 = NULL; TexWidth = TexHeight = 0; - TexUvWhitePixel = ImVec2(0, 0); + TexUvScale = ImVec2(0.0f, 0.0f); + TexUvWhitePixel = ImVec2(0.0f, 0.0f); for (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++) CustomRectIds[n] = -1; } ImFontAtlas::~ImFontAtlas() { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); Clear(); } void ImFontAtlas::ClearInputData() { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); for (int i = 0; i < ConfigData.Size; i++) if (ConfigData[i].FontData && ConfigData[i].FontDataOwnedByAtlas) { @@ -1375,7 +1424,7 @@ void ImFontAtlas::ClearInputData() ConfigData[i].FontData = NULL; } - // When clearing this we lose access to the font name and other information used to build the font. + // When clearing this we lose access to the font name and other information used to build the font. for (int i = 0; i < Fonts.Size; i++) if (Fonts[i]->ConfigData >= ConfigData.Data && Fonts[i]->ConfigData < ConfigData.Data + ConfigData.Size) { @@ -1390,6 +1439,7 @@ void ImFontAtlas::ClearInputData() void ImFontAtlas::ClearTexData() { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); if (TexPixelsAlpha8) ImGui::MemFree(TexPixelsAlpha8); if (TexPixelsRGBA32) @@ -1400,11 +1450,9 @@ void ImFontAtlas::ClearTexData() void ImFontAtlas::ClearFonts() { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); for (int i = 0; i < Fonts.Size; i++) - { - Fonts[i]->~ImFont(); - ImGui::MemFree(Fonts[i]); - } + IM_DELETE(Fonts[i]); Fonts.clear(); } @@ -1437,13 +1485,16 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid // Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp if (!TexPixelsRGBA32) { - unsigned char* pixels; + unsigned char* pixels = NULL; GetTexDataAsAlpha8(&pixels, NULL, NULL); - TexPixelsRGBA32 = (unsigned int*)ImGui::MemAlloc((size_t)(TexWidth * TexHeight * 4)); - const unsigned char* src = pixels; - unsigned int* dst = TexPixelsRGBA32; - for (int n = TexWidth * TexHeight; n > 0; n--) - *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++)); + if (pixels) + { + TexPixelsRGBA32 = (unsigned int*)ImGui::MemAlloc((size_t)(TexWidth * TexHeight * 4)); + const unsigned char* src = pixels; + unsigned int* dst = TexPixelsRGBA32; + for (int n = TexWidth * TexHeight; n > 0; n--) + *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++)); + } } *out_pixels = (unsigned char*)TexPixelsRGBA32; @@ -1454,20 +1505,15 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); IM_ASSERT(font_cfg->FontData != NULL && font_cfg->FontDataSize > 0); IM_ASSERT(font_cfg->SizePixels > 0.0f); // Create new font if (!font_cfg->MergeMode) - { - ImFont* font = (ImFont*)ImGui::MemAlloc(sizeof(ImFont)); - IM_PLACEMENT_NEW(font) ImFont(); - Fonts.push_back(font); - } + Fonts.push_back(IM_NEW(ImFont)); else - { IM_ASSERT(!Fonts.empty()); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font. - } ConfigData.push_back(*font_cfg); ImFontConfig& new_font_cfg = ConfigData.back(); @@ -1485,9 +1531,9 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) return new_font_cfg.DstFont; } -// Default font TTF is compressed with stb_compress then base85 encoded (see extra_fonts/binary_to_compressed_c.cpp for encoder) -static unsigned int stb_decompress_length(unsigned char *input); -static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length); +// Default font TTF is compressed with stb_compress then base85 encoded (see misc/fonts/binary_to_compressed_c.cpp for encoder) +static unsigned int stb_decompress_length(const unsigned char *input); +static unsigned int stb_decompress(unsigned char *output, const unsigned char *input, unsigned int length); static const char* GetDefaultCompressedFontDataTTFBase85(); static unsigned int Decode85Byte(char c) { return c >= '\\' ? c-36 : c-35; } static void Decode85(const unsigned char* src, unsigned char* dst) @@ -1514,13 +1560,16 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template) if (font_cfg.SizePixels <= 0.0f) font_cfg.SizePixels = 13.0f; const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85(); - ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault()); + const ImWchar* glyph_ranges = font_cfg.GlyphRanges != NULL ? font_cfg.GlyphRanges : GetGlyphRangesDefault(); + ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, glyph_ranges); + font->DisplayOffset.y = 1.0f; return font; } ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) { - int data_size = 0; + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); + size_t data_size = 0; void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0); if (!data) { @@ -1533,14 +1582,15 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, // Store a short copy of filename into into the font name for convenience const char* p; for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {} - snprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels); + ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels); } - return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges); + return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges); } // NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build(). ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); IM_ASSERT(font_cfg.FontData == NULL); font_cfg.FontData = ttf_data; @@ -1553,9 +1603,9 @@ ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float si ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges) { - const unsigned int buf_decompressed_size = stb_decompress_length((unsigned char*)compressed_ttf_data); + const unsigned int buf_decompressed_size = stb_decompress_length((const unsigned char*)compressed_ttf_data); unsigned char* buf_decompressed_data = (unsigned char *)ImGui::MemAlloc(buf_decompressed_size); - stb_decompress(buf_decompressed_data, (unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size); + stb_decompress(buf_decompressed_data, (const unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size); ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig(); IM_ASSERT(font_cfg.FontData == NULL); @@ -1606,12 +1656,35 @@ void ImFontAtlas::CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, I { IM_ASSERT(TexWidth > 0 && TexHeight > 0); // Font atlas needs to be built before we can calculate UV coordinates IM_ASSERT(rect->IsPacked()); // Make sure the rectangle has been packed - *out_uv_min = ImVec2((float)rect->X / TexWidth, (float)rect->Y / TexHeight); - *out_uv_max = ImVec2((float)(rect->X + rect->Width) / TexWidth, (float)(rect->Y + rect->Height) / TexHeight); + *out_uv_min = ImVec2((float)rect->X * TexUvScale.x, (float)rect->Y * TexUvScale.y); + *out_uv_max = ImVec2((float)(rect->X + rect->Width) * TexUvScale.x, (float)(rect->Y + rect->Height) * TexUvScale.y); +} + +bool ImFontAtlas::GetMouseCursorTexData(ImGuiMouseCursor cursor_type, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2]) +{ + if (cursor_type <= ImGuiMouseCursor_None || cursor_type >= ImGuiMouseCursor_COUNT) + return false; + if (Flags & ImFontAtlasFlags_NoMouseCursors) + return false; + + IM_ASSERT(CustomRectIds[0] != -1); + ImFontAtlas::CustomRect& r = CustomRects[CustomRectIds[0]]; + IM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID); + ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][0] + ImVec2((float)r.X, (float)r.Y); + ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][1]; + *out_size = size; + *out_offset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][2]; + out_uv_border[0] = (pos) * TexUvScale; + out_uv_border[1] = (pos + size) * TexUvScale; + pos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1; + out_uv_fill[0] = (pos) * TexUvScale; + out_uv_fill[1] = (pos + size) * TexUvScale; + return true; } bool ImFontAtlas::Build() { + IM_ASSERT(!Locked && "Cannot modify a locked ImFontAtlas between NewFrame() and EndFrame/Render()!"); return ImFontAtlasBuildWithStbTruetype(this); } @@ -1638,9 +1711,10 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) ImFontAtlasBuildRegisterDefaultCustomRects(atlas); - atlas->TexID = NULL; + atlas->TexID = (ImTextureID)NULL; atlas->TexWidth = atlas->TexHeight = 0; - atlas->TexUvWhitePixel = ImVec2(0, 0); + atlas->TexUvScale = ImVec2(0.0f, 0.0f); + atlas->TexUvWhitePixel = ImVec2(0.0f, 0.0f); atlas->ClearTexData(); // Count glyphs/ranges @@ -1663,7 +1737,8 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) // Start packing const int max_tex_height = 1024*32; stbtt_pack_context spc = {}; - stbtt_PackBegin(&spc, NULL, atlas->TexWidth, max_tex_height, 0, atlas->TexGlyphPadding, NULL); + if (!stbtt_PackBegin(&spc, NULL, atlas->TexWidth, max_tex_height, 0, atlas->TexGlyphPadding, NULL)) + return false; stbtt_PackSetOversampling(&spc, 1, 1); // Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values). @@ -1686,9 +1761,10 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas)); const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo); - IM_ASSERT(font_offset >= 0); + IM_ASSERT(font_offset >= 0 && "FontData is incorrect, or FontNo cannot be found."); if (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset)) { + atlas->TexWidth = atlas->TexHeight = 0; // Reset output on failure ImGui::MemFree(tmp_array); return false; } @@ -1728,26 +1804,42 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) buf_packedchars_n += range.num_chars; } - // Pack + // Gather the sizes of all rectangle we need tmp.Rects = buf_rects + buf_rects_n; tmp.RectsCount = font_glyphs_count; buf_rects_n += font_glyphs_count; stbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV); int n = stbtt_PackFontRangesGatherRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects); IM_ASSERT(n == font_glyphs_count); + + // Detect missing glyphs and replace them with a zero-sized box instead of relying on the default glyphs + // This allows us merging overlapping icon fonts more easily. + int rect_i = 0; + for (int range_i = 0; range_i < tmp.RangesCount; range_i++) + for (int char_i = 0; char_i < tmp.Ranges[range_i].num_chars; char_i++, rect_i++) + if (stbtt_FindGlyphIndex(&tmp.FontInfo, tmp.Ranges[range_i].first_unicode_codepoint_in_range + char_i) == 0) + tmp.Rects[rect_i].w = tmp.Rects[rect_i].h = 0; + + // Pack stbrp_pack_rects((stbrp_context*)spc.pack_info, tmp.Rects, n); // Extend texture height + // Also mark missing glyphs as non-packed so we don't attempt to render into them for (int i = 0; i < n; i++) + { + if (tmp.Rects[i].w == 0 && tmp.Rects[i].h == 0) + tmp.Rects[i].was_packed = 0; if (tmp.Rects[i].was_packed) atlas->TexHeight = ImMax(atlas->TexHeight, tmp.Rects[i].y + tmp.Rects[i].h); + } } IM_ASSERT(buf_rects_n == total_glyphs_count); IM_ASSERT(buf_packedchars_n == total_glyphs_count); IM_ASSERT(buf_ranges_n == total_ranges_count); // Create texture - atlas->TexHeight = ImUpperPowerOfTwo(atlas->TexHeight); + atlas->TexHeight = (atlas->Flags & ImFontAtlasFlags_NoPowerOfTwoHeight) ? (atlas->TexHeight + 1) : ImUpperPowerOfTwo(atlas->TexHeight); + atlas->TexUvScale = ImVec2(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight); atlas->TexPixelsAlpha8 = (unsigned char*)ImGui::MemAlloc(atlas->TexWidth * atlas->TexHeight); memset(atlas->TexPixelsAlpha8, 0, atlas->TexWidth * atlas->TexHeight); spc.pixels = atlas->TexPixelsAlpha8; @@ -1782,16 +1874,18 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) ImFontConfig& cfg = atlas->ConfigData[input_i]; ImFontTempBuildData& tmp = tmp_array[input_i]; ImFont* dst_font = cfg.DstFont; // We can have multiple input fonts writing into a same destination font (when using MergeMode=true) + if (cfg.MergeMode) + dst_font->BuildLookupTable(); const float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels); int unscaled_ascent, unscaled_descent, unscaled_line_gap; stbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap); - const float ascent = unscaled_ascent * font_scale; - const float descent = unscaled_descent * font_scale; + const float ascent = ImFloor(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1)); + const float descent = ImFloor(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1)); ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent); - const float off_x = cfg.GlyphOffset.x; - const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f); + const float font_off_x = cfg.GlyphOffset.x; + const float font_off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f); for (int i = 0; i < tmp.RangesCount; i++) { @@ -1803,13 +1897,19 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) continue; const int codepoint = range.first_unicode_codepoint_in_range + char_idx; - if (cfg.MergeMode && dst_font->FindGlyph((unsigned short)codepoint)) + if (cfg.MergeMode && dst_font->FindGlyphNoFallback((ImWchar)codepoint)) continue; + float char_advance_x_org = pc.xadvance; + float char_advance_x_mod = ImClamp(char_advance_x_org, cfg.GlyphMinAdvanceX, cfg.GlyphMaxAdvanceX); + float char_off_x = font_off_x; + if (char_advance_x_org != char_advance_x_mod) + char_off_x += cfg.PixelSnapH ? (float)(int)((char_advance_x_mod - char_advance_x_org) * 0.5f) : (char_advance_x_mod - char_advance_x_org) * 0.5f; + stbtt_aligned_quad q; float dummy_x = 0.0f, dummy_y = 0.0f; stbtt_GetPackedQuad(range.chardata_for_range, atlas->TexWidth, atlas->TexHeight, char_idx, &dummy_x, &dummy_y, &q, 0); - dst_font->AddGlyph((ImWchar)codepoint, q.x0 + off_x, q.y0 + off_y, q.x1 + off_x, q.y1 + off_y, q.s0, q.t0, q.s1, q.t1, pc.xadvance); + dst_font->AddGlyph((ImWchar)codepoint, q.x0 + char_off_x, q.y0 + font_off_y, q.x1 + char_off_x, q.y1 + font_off_y, q.s0, q.t0, q.s1, q.t1, char_advance_x_mod); } } } @@ -1826,8 +1926,12 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas) { - if (atlas->CustomRectIds[0] < 0) + if (atlas->CustomRectIds[0] >= 0) + return; + if (!(atlas->Flags & ImFontAtlasFlags_NoMouseCursors)) atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF*2+1, FONT_ATLAS_DEFAULT_TEX_DATA_H); + else + atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, 2, 2); } void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent) @@ -1873,40 +1977,32 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* pack_context_opaq static void ImFontAtlasBuildRenderDefaultTexData(ImFontAtlas* atlas) { IM_ASSERT(atlas->CustomRectIds[0] >= 0); + IM_ASSERT(atlas->TexPixelsAlpha8 != NULL); ImFontAtlas::CustomRect& r = atlas->CustomRects[atlas->CustomRectIds[0]]; IM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID); - IM_ASSERT(r.Width == FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF*2+1); - IM_ASSERT(r.Height == FONT_ATLAS_DEFAULT_TEX_DATA_H); IM_ASSERT(r.IsPacked()); - IM_ASSERT(atlas->TexPixelsAlpha8 != NULL); - // Render/copy pixels - for (int y = 0, n = 0; y < FONT_ATLAS_DEFAULT_TEX_DATA_H; y++) - for (int x = 0; x < FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF; x++, n++) - { - const int offset0 = (int)(r.X + x) + (int)(r.Y + y) * atlas->TexWidth; - const int offset1 = offset0 + FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1; - atlas->TexPixelsAlpha8[offset0] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == '.' ? 0xFF : 0x00; - atlas->TexPixelsAlpha8[offset1] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == 'X' ? 0xFF : 0x00; - } - const ImVec2 tex_uv_scale(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight); - atlas->TexUvWhitePixel = ImVec2((r.X + 0.5f) * tex_uv_scale.x, (r.Y + 0.5f) * tex_uv_scale.y); - - // Setup mouse cursors - for (int type = 0; type < ImGuiMouseCursor_Count_; type++) + const int w = atlas->TexWidth; + if (!(atlas->Flags & ImFontAtlasFlags_NoMouseCursors)) { - ImGuiMouseCursorData& cursor_data = GImGui->MouseCursorData[type]; - ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][0] + ImVec2((float)r.X, (float)r.Y); - const ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][1]; - cursor_data.Type = type; - cursor_data.Size = size; - cursor_data.HotOffset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][2]; - cursor_data.TexUvMin[0] = (pos) * tex_uv_scale; - cursor_data.TexUvMax[0] = (pos + size) * tex_uv_scale; - pos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1; - cursor_data.TexUvMin[1] = (pos) * tex_uv_scale; - cursor_data.TexUvMax[1] = (pos + size) * tex_uv_scale; + // Render/copy pixels + IM_ASSERT(r.Width == FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF * 2 + 1 && r.Height == FONT_ATLAS_DEFAULT_TEX_DATA_H); + for (int y = 0, n = 0; y < FONT_ATLAS_DEFAULT_TEX_DATA_H; y++) + for (int x = 0; x < FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF; x++, n++) + { + const int offset0 = (int)(r.X + x) + (int)(r.Y + y) * w; + const int offset1 = offset0 + FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1; + atlas->TexPixelsAlpha8[offset0] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == '.' ? 0xFF : 0x00; + atlas->TexPixelsAlpha8[offset1] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == 'X' ? 0xFF : 0x00; + } } + else + { + IM_ASSERT(r.Width == 2 && r.Height == 2); + const int offset = (int)(r.X) + (int)(r.Y) * w; + atlas->TexPixelsAlpha8[offset] = atlas->TexPixelsAlpha8[offset + 1] = atlas->TexPixelsAlpha8[offset + w] = atlas->TexPixelsAlpha8[offset + w + 1] = 0xFF; + } + atlas->TexUvWhitePixel = ImVec2((r.X + 0.5f) * atlas->TexUvScale.x, (r.Y + 0.5f) * atlas->TexUvScale.y); } void ImFontAtlasBuildFinish(ImFontAtlas* atlas) @@ -1929,7 +2025,8 @@ void ImFontAtlasBuildFinish(ImFontAtlas* atlas) // Build all fonts lookup tables for (int i = 0; i < atlas->Fonts.Size; i++) - atlas->Fonts[i]->BuildLookupTable(); + if (atlas->Fonts[i]->DirtyLookupTables) + atlas->Fonts[i]->BuildLookupTable(); } // Retrieve list of range (2 int per range, values are inclusive) @@ -1955,7 +2052,7 @@ const ImWchar* ImFontAtlas::GetGlyphRangesKorean() return &ranges[0]; } -const ImWchar* ImFontAtlas::GetGlyphRangesChinese() +const ImWchar* ImFontAtlas::GetGlyphRangesChineseFull() { static const ImWchar ranges[] = { @@ -1969,67 +2066,140 @@ const ImWchar* ImFontAtlas::GetGlyphRangesChinese() return &ranges[0]; } -const ImWchar* ImFontAtlas::GetGlyphRangesJapanese() +static void UnpackAccumulativeOffsetsIntoRanges(int base_codepoint, const short* accumulative_offsets, int accumulative_offsets_count, ImWchar* out_ranges) { - // Store the 1946 ideograms code points as successive offsets from the initial unicode codepoint 0x4E00. Each offset has an implicit +1. - // This encoding is designed to helps us reduce the source code size. - // FIXME: Source a list of the revised 2136 joyo kanji list from 2010 and rebuild this. - // The current list was sourced from http://theinstructionlimit.com/author/renaudbedardrenaudbedard/page/3 - // Note that you may use ImFontAtlas::GlyphRangesBuilder to create your own ranges, by merging existing ranges or adding new characters. - static const short offsets_from_0x4E00[] = + for (int n = 0; n < accumulative_offsets_count; n++, out_ranges += 2) { - -1,0,1,3,0,0,0,0,1,0,5,1,1,0,7,4,6,10,0,1,9,9,7,1,3,19,1,10,7,1,0,1,0,5,1,0,6,4,2,6,0,0,12,6,8,0,3,5,0,1,0,9,0,0,8,1,1,3,4,5,13,0,0,8,2,17, - 4,3,1,1,9,6,0,0,0,2,1,3,2,22,1,9,11,1,13,1,3,12,0,5,9,2,0,6,12,5,3,12,4,1,2,16,1,1,4,6,5,3,0,6,13,15,5,12,8,14,0,0,6,15,3,6,0,18,8,1,6,14,1, - 5,4,12,24,3,13,12,10,24,0,0,0,1,0,1,1,2,9,10,2,2,0,0,3,3,1,0,3,8,0,3,2,4,4,1,6,11,10,14,6,15,3,4,15,1,0,0,5,2,2,0,0,1,6,5,5,6,0,3,6,5,0,0,1,0, - 11,2,2,8,4,7,0,10,0,1,2,17,19,3,0,2,5,0,6,2,4,4,6,1,1,11,2,0,3,1,2,1,2,10,7,6,3,16,0,8,24,0,0,3,1,1,3,0,1,6,0,0,0,2,0,1,5,15,0,1,0,0,2,11,19, - 1,4,19,7,6,5,1,0,0,0,0,5,1,0,1,9,0,0,5,0,2,0,1,0,3,0,11,3,0,2,0,0,0,0,0,9,3,6,4,12,0,14,0,0,29,10,8,0,14,37,13,0,31,16,19,0,8,30,1,20,8,3,48, - 21,1,0,12,0,10,44,34,42,54,11,18,82,0,2,1,2,12,1,0,6,2,17,2,12,7,0,7,17,4,2,6,24,23,8,23,39,2,16,23,1,0,5,1,2,15,14,5,6,2,11,0,8,6,2,2,2,14, - 20,4,15,3,4,11,10,10,2,5,2,1,30,2,1,0,0,22,5,5,0,3,1,5,4,1,0,0,2,2,21,1,5,1,2,16,2,1,3,4,0,8,4,0,0,5,14,11,2,16,1,13,1,7,0,22,15,3,1,22,7,14, - 22,19,11,24,18,46,10,20,64,45,3,2,0,4,5,0,1,4,25,1,0,0,2,10,0,0,0,1,0,1,2,0,0,9,1,2,0,0,0,2,5,2,1,1,5,5,8,1,1,1,5,1,4,9,1,3,0,1,0,1,1,2,0,0, - 2,0,1,8,22,8,1,0,0,0,0,4,2,1,0,9,8,5,0,9,1,30,24,2,6,4,39,0,14,5,16,6,26,179,0,2,1,1,0,0,0,5,2,9,6,0,2,5,16,7,5,1,1,0,2,4,4,7,15,13,14,0,0, - 3,0,1,0,0,0,2,1,6,4,5,1,4,9,0,3,1,8,0,0,10,5,0,43,0,2,6,8,4,0,2,0,0,9,6,0,9,3,1,6,20,14,6,1,4,0,7,2,3,0,2,0,5,0,3,1,0,3,9,7,0,3,4,0,4,9,1,6,0, - 9,0,0,2,3,10,9,28,3,6,2,4,1,2,32,4,1,18,2,0,3,1,5,30,10,0,2,2,2,0,7,9,8,11,10,11,7,2,13,7,5,10,0,3,40,2,0,1,6,12,0,4,5,1,5,11,11,21,4,8,3,7, - 8,8,33,5,23,0,0,19,8,8,2,3,0,6,1,1,1,5,1,27,4,2,5,0,3,5,6,3,1,0,3,1,12,5,3,3,2,0,7,7,2,1,0,4,0,1,1,2,0,10,10,6,2,5,9,7,5,15,15,21,6,11,5,20, - 4,3,5,5,2,5,0,2,1,0,1,7,28,0,9,0,5,12,5,5,18,30,0,12,3,3,21,16,25,32,9,3,14,11,24,5,66,9,1,2,0,5,9,1,5,1,8,0,8,3,3,0,1,15,1,4,8,1,2,7,0,7,2, - 8,3,7,5,3,7,10,2,1,0,0,2,25,0,6,4,0,10,0,4,2,4,1,12,5,38,4,0,4,1,10,5,9,4,0,14,4,2,5,18,20,21,1,3,0,5,0,7,0,3,7,1,3,1,1,8,1,0,0,0,3,2,5,2,11, - 6,0,13,1,3,9,1,12,0,16,6,2,1,0,2,1,12,6,13,11,2,0,28,1,7,8,14,13,8,13,0,2,0,5,4,8,10,2,37,42,19,6,6,7,4,14,11,18,14,80,7,6,0,4,72,12,36,27, - 7,7,0,14,17,19,164,27,0,5,10,7,3,13,6,14,0,2,2,5,3,0,6,13,0,0,10,29,0,4,0,3,13,0,3,1,6,51,1,5,28,2,0,8,0,20,2,4,0,25,2,10,13,10,0,16,4,0,1,0, - 2,1,7,0,1,8,11,0,0,1,2,7,2,23,11,6,6,4,16,2,2,2,0,22,9,3,3,5,2,0,15,16,21,2,9,20,15,15,5,3,9,1,0,0,1,7,7,5,4,2,2,2,38,24,14,0,0,15,5,6,24,14, - 5,5,11,0,21,12,0,3,8,4,11,1,8,0,11,27,7,2,4,9,21,59,0,1,39,3,60,62,3,0,12,11,0,3,30,11,0,13,88,4,15,5,28,13,1,4,48,17,17,4,28,32,46,0,16,0, - 18,11,1,8,6,38,11,2,6,11,38,2,0,45,3,11,2,7,8,4,30,14,17,2,1,1,65,18,12,16,4,2,45,123,12,56,33,1,4,3,4,7,0,0,0,3,2,0,16,4,2,4,2,0,7,4,5,2,26, - 2,25,6,11,6,1,16,2,6,17,77,15,3,35,0,1,0,5,1,0,38,16,6,3,12,3,3,3,0,9,3,1,3,5,2,9,0,18,0,25,1,3,32,1,72,46,6,2,7,1,3,14,17,0,28,1,40,13,0,20, - 15,40,6,38,24,12,43,1,1,9,0,12,6,0,6,2,4,19,3,7,1,48,0,9,5,0,5,6,9,6,10,15,2,11,19,3,9,2,0,1,10,1,27,8,1,3,6,1,14,0,26,0,27,16,3,4,9,6,2,23, - 9,10,5,25,2,1,6,1,1,48,15,9,15,14,3,4,26,60,29,13,37,21,1,6,4,0,2,11,22,23,16,16,2,2,1,3,0,5,1,6,4,0,0,4,0,0,8,3,0,2,5,0,7,1,7,3,13,2,4,10, - 3,0,2,31,0,18,3,0,12,10,4,1,0,7,5,7,0,5,4,12,2,22,10,4,2,15,2,8,9,0,23,2,197,51,3,1,1,4,13,4,3,21,4,19,3,10,5,40,0,4,1,1,10,4,1,27,34,7,21, - 2,17,2,9,6,4,2,3,0,4,2,7,8,2,5,1,15,21,3,4,4,2,2,17,22,1,5,22,4,26,7,0,32,1,11,42,15,4,1,2,5,0,19,3,1,8,6,0,10,1,9,2,13,30,8,2,24,17,19,1,4, - 4,25,13,0,10,16,11,39,18,8,5,30,82,1,6,8,18,77,11,13,20,75,11,112,78,33,3,0,0,60,17,84,9,1,1,12,30,10,49,5,32,158,178,5,5,6,3,3,1,3,1,4,7,6, - 19,31,21,0,2,9,5,6,27,4,9,8,1,76,18,12,1,4,0,3,3,6,3,12,2,8,30,16,2,25,1,5,5,4,3,0,6,10,2,3,1,0,5,1,19,3,0,8,1,5,2,6,0,0,0,19,1,2,0,5,1,2,5, - 1,3,7,0,4,12,7,3,10,22,0,9,5,1,0,2,20,1,1,3,23,30,3,9,9,1,4,191,14,3,15,6,8,50,0,1,0,0,4,0,0,1,0,2,4,2,0,2,3,0,2,0,2,2,8,7,0,1,1,1,3,3,17,11, - 91,1,9,3,2,13,4,24,15,41,3,13,3,1,20,4,125,29,30,1,0,4,12,2,21,4,5,5,19,11,0,13,11,86,2,18,0,7,1,8,8,2,2,22,1,2,6,5,2,0,1,2,8,0,2,0,5,2,1,0, - 2,10,2,0,5,9,2,1,2,0,1,0,4,0,0,10,2,5,3,0,6,1,0,1,4,4,33,3,13,17,3,18,6,4,7,1,5,78,0,4,1,13,7,1,8,1,0,35,27,15,3,0,0,0,1,11,5,41,38,15,22,6, - 14,14,2,1,11,6,20,63,5,8,27,7,11,2,2,40,58,23,50,54,56,293,8,8,1,5,1,14,0,1,12,37,89,8,8,8,2,10,6,0,0,0,4,5,2,1,0,1,1,2,7,0,3,3,0,4,6,0,3,2, - 19,3,8,0,0,0,4,4,16,0,4,1,5,1,3,0,3,4,6,2,17,10,10,31,6,4,3,6,10,126,7,3,2,2,0,9,0,0,5,20,13,0,15,0,6,0,2,5,8,64,50,3,2,12,2,9,0,0,11,8,20, - 109,2,18,23,0,0,9,61,3,0,28,41,77,27,19,17,81,5,2,14,5,83,57,252,14,154,263,14,20,8,13,6,57,39,38, + out_ranges[0] = out_ranges[1] = (ImWchar)(base_codepoint + accumulative_offsets[n]); + base_codepoint += accumulative_offsets[n]; + } + out_ranges[0] = 0; +} + +//------------------------------------------------------------------------- +// [SECTION] ImFontAtlas glyph ranges helpers + GlyphRangesBuilder +//------------------------------------------------------------------------- + +const ImWchar* ImFontAtlas::GetGlyphRangesChineseSimplifiedCommon() +{ + // Store 2500 regularly used characters for Simplified Chinese. + // Sourced from https://zh.wiktionary.org/wiki/%E9%99%84%E5%BD%95:%E7%8E%B0%E4%BB%A3%E6%B1%89%E8%AF%AD%E5%B8%B8%E7%94%A8%E5%AD%97%E8%A1%A8 + // This table covers 97.97% of all characters used during the month in July, 1987. + // You can use ImFontAtlas::GlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. + // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.) + static const short accumulative_offsets_from_0x4E00[] = + { + 0,1,2,4,1,1,1,1,2,1,3,2,1,2,2,1,1,1,1,1,5,2,1,2,3,3,3,2,2,4,1,1,1,2,1,5,2,3,1,2,1,2,1,1,2,1,1,2,2,1,4,1,1,1,1,5,10,1,2,19,2,1,2,1,2,1,2,1,2, + 1,5,1,6,3,2,1,2,2,1,1,1,4,8,5,1,1,4,1,1,3,1,2,1,5,1,2,1,1,1,10,1,1,5,2,4,6,1,4,2,2,2,12,2,1,1,6,1,1,1,4,1,1,4,6,5,1,4,2,2,4,10,7,1,1,4,2,4, + 2,1,4,3,6,10,12,5,7,2,14,2,9,1,1,6,7,10,4,7,13,1,5,4,8,4,1,1,2,28,5,6,1,1,5,2,5,20,2,2,9,8,11,2,9,17,1,8,6,8,27,4,6,9,20,11,27,6,68,2,2,1,1, + 1,2,1,2,2,7,6,11,3,3,1,1,3,1,2,1,1,1,1,1,3,1,1,8,3,4,1,5,7,2,1,4,4,8,4,2,1,2,1,1,4,5,6,3,6,2,12,3,1,3,9,2,4,3,4,1,5,3,3,1,3,7,1,5,1,1,1,1,2, + 3,4,5,2,3,2,6,1,1,2,1,7,1,7,3,4,5,15,2,2,1,5,3,22,19,2,1,1,1,1,2,5,1,1,1,6,1,1,12,8,2,9,18,22,4,1,1,5,1,16,1,2,7,10,15,1,1,6,2,4,1,2,4,1,6, + 1,1,3,2,4,1,6,4,5,1,2,1,1,2,1,10,3,1,3,2,1,9,3,2,5,7,2,19,4,3,6,1,1,1,1,1,4,3,2,1,1,1,2,5,3,1,1,1,2,2,1,1,2,1,1,2,1,3,1,1,1,3,7,1,4,1,1,2,1, + 1,2,1,2,4,4,3,8,1,1,1,2,1,3,5,1,3,1,3,4,6,2,2,14,4,6,6,11,9,1,15,3,1,28,5,2,5,5,3,1,3,4,5,4,6,14,3,2,3,5,21,2,7,20,10,1,2,19,2,4,28,28,2,3, + 2,1,14,4,1,26,28,42,12,40,3,52,79,5,14,17,3,2,2,11,3,4,6,3,1,8,2,23,4,5,8,10,4,2,7,3,5,1,1,6,3,1,2,2,2,5,28,1,1,7,7,20,5,3,29,3,17,26,1,8,4, + 27,3,6,11,23,5,3,4,6,13,24,16,6,5,10,25,35,7,3,2,3,3,14,3,6,2,6,1,4,2,3,8,2,1,1,3,3,3,4,1,1,13,2,2,4,5,2,1,14,14,1,2,2,1,4,5,2,3,1,14,3,12, + 3,17,2,16,5,1,2,1,8,9,3,19,4,2,2,4,17,25,21,20,28,75,1,10,29,103,4,1,2,1,1,4,2,4,1,2,3,24,2,2,2,1,1,2,1,3,8,1,1,1,2,1,1,3,1,1,1,6,1,5,3,1,1, + 1,3,4,1,1,5,2,1,5,6,13,9,16,1,1,1,1,3,2,3,2,4,5,2,5,2,2,3,7,13,7,2,2,1,1,1,1,2,3,3,2,1,6,4,9,2,1,14,2,14,2,1,18,3,4,14,4,11,41,15,23,15,23, + 176,1,3,4,1,1,1,1,5,3,1,2,3,7,3,1,1,2,1,2,4,4,6,2,4,1,9,7,1,10,5,8,16,29,1,1,2,2,3,1,3,5,2,4,5,4,1,1,2,2,3,3,7,1,6,10,1,17,1,44,4,6,2,1,1,6, + 5,4,2,10,1,6,9,2,8,1,24,1,2,13,7,8,8,2,1,4,1,3,1,3,3,5,2,5,10,9,4,9,12,2,1,6,1,10,1,1,7,7,4,10,8,3,1,13,4,3,1,6,1,3,5,2,1,2,17,16,5,2,16,6, + 1,4,2,1,3,3,6,8,5,11,11,1,3,3,2,4,6,10,9,5,7,4,7,4,7,1,1,4,2,1,3,6,8,7,1,6,11,5,5,3,24,9,4,2,7,13,5,1,8,82,16,61,1,1,1,4,2,2,16,10,3,8,1,1, + 6,4,2,1,3,1,1,1,4,3,8,4,2,2,1,1,1,1,1,6,3,5,1,1,4,6,9,2,1,1,1,2,1,7,2,1,6,1,5,4,4,3,1,8,1,3,3,1,3,2,2,2,2,3,1,6,1,2,1,2,1,3,7,1,8,2,1,2,1,5, + 2,5,3,5,10,1,2,1,1,3,2,5,11,3,9,3,5,1,1,5,9,1,2,1,5,7,9,9,8,1,3,3,3,6,8,2,3,2,1,1,32,6,1,2,15,9,3,7,13,1,3,10,13,2,14,1,13,10,2,1,3,10,4,15, + 2,15,15,10,1,3,9,6,9,32,25,26,47,7,3,2,3,1,6,3,4,3,2,8,5,4,1,9,4,2,2,19,10,6,2,3,8,1,2,2,4,2,1,9,4,4,4,6,4,8,9,2,3,1,1,1,1,3,5,5,1,3,8,4,6, + 2,1,4,12,1,5,3,7,13,2,5,8,1,6,1,2,5,14,6,1,5,2,4,8,15,5,1,23,6,62,2,10,1,1,8,1,2,2,10,4,2,2,9,2,1,1,3,2,3,1,5,3,3,2,1,3,8,1,1,1,11,3,1,1,4, + 3,7,1,14,1,2,3,12,5,2,5,1,6,7,5,7,14,11,1,3,1,8,9,12,2,1,11,8,4,4,2,6,10,9,13,1,1,3,1,5,1,3,2,4,4,1,18,2,3,14,11,4,29,4,2,7,1,3,13,9,2,2,5, + 3,5,20,7,16,8,5,72,34,6,4,22,12,12,28,45,36,9,7,39,9,191,1,1,1,4,11,8,4,9,2,3,22,1,1,1,1,4,17,1,7,7,1,11,31,10,2,4,8,2,3,2,1,4,2,16,4,32,2, + 3,19,13,4,9,1,5,2,14,8,1,1,3,6,19,6,5,1,16,6,2,10,8,5,1,2,3,1,5,5,1,11,6,6,1,3,3,2,6,3,8,1,1,4,10,7,5,7,7,5,8,9,2,1,3,4,1,1,3,1,3,3,2,6,16, + 1,4,6,3,1,10,6,1,3,15,2,9,2,10,25,13,9,16,6,2,2,10,11,4,3,9,1,2,6,6,5,4,30,40,1,10,7,12,14,33,6,3,6,7,3,1,3,1,11,14,4,9,5,12,11,49,18,51,31, + 140,31,2,2,1,5,1,8,1,10,1,4,4,3,24,1,10,1,3,6,6,16,3,4,5,2,1,4,2,57,10,6,22,2,22,3,7,22,6,10,11,36,18,16,33,36,2,5,5,1,1,1,4,10,1,4,13,2,7, + 5,2,9,3,4,1,7,43,3,7,3,9,14,7,9,1,11,1,1,3,7,4,18,13,1,14,1,3,6,10,73,2,2,30,6,1,11,18,19,13,22,3,46,42,37,89,7,3,16,34,2,2,3,9,1,7,1,1,1,2, + 2,4,10,7,3,10,3,9,5,28,9,2,6,13,7,3,1,3,10,2,7,2,11,3,6,21,54,85,2,1,4,2,2,1,39,3,21,2,2,5,1,1,1,4,1,1,3,4,15,1,3,2,4,4,2,3,8,2,20,1,8,7,13, + 4,1,26,6,2,9,34,4,21,52,10,4,4,1,5,12,2,11,1,7,2,30,12,44,2,30,1,1,3,6,16,9,17,39,82,2,2,24,7,1,7,3,16,9,14,44,2,1,2,1,2,3,5,2,4,1,6,7,5,3, + 2,6,1,11,5,11,2,1,18,19,8,1,3,24,29,2,1,3,5,2,2,1,13,6,5,1,46,11,3,5,1,1,5,8,2,10,6,12,6,3,7,11,2,4,16,13,2,5,1,1,2,2,5,2,28,5,2,23,10,8,4, + 4,22,39,95,38,8,14,9,5,1,13,5,4,3,13,12,11,1,9,1,27,37,2,5,4,4,63,211,95,2,2,2,1,3,5,2,1,1,2,2,1,1,1,3,2,4,1,2,1,1,5,2,2,1,1,2,3,1,3,1,1,1, + 3,1,4,2,1,3,6,1,1,3,7,15,5,3,2,5,3,9,11,4,2,22,1,6,3,8,7,1,4,28,4,16,3,3,25,4,4,27,27,1,4,1,2,2,7,1,3,5,2,28,8,2,14,1,8,6,16,25,3,3,3,14,3, + 3,1,1,2,1,4,6,3,8,4,1,1,1,2,3,6,10,6,2,3,18,3,2,5,5,4,3,1,5,2,5,4,23,7,6,12,6,4,17,11,9,5,1,1,10,5,12,1,1,11,26,33,7,3,6,1,17,7,1,5,12,1,11, + 2,4,1,8,14,17,23,1,2,1,7,8,16,11,9,6,5,2,6,4,16,2,8,14,1,11,8,9,1,1,1,9,25,4,11,19,7,2,15,2,12,8,52,7,5,19,2,16,4,36,8,1,16,8,24,26,4,6,2,9, + 5,4,36,3,28,12,25,15,37,27,17,12,59,38,5,32,127,1,2,9,17,14,4,1,2,1,1,8,11,50,4,14,2,19,16,4,17,5,4,5,26,12,45,2,23,45,104,30,12,8,3,10,2,2, + 3,3,1,4,20,7,2,9,6,15,2,20,1,3,16,4,11,15,6,134,2,5,59,1,2,2,2,1,9,17,3,26,137,10,211,59,1,2,4,1,4,1,1,1,2,6,2,3,1,1,2,3,2,3,1,3,4,4,2,3,3, + 1,4,3,1,7,2,2,3,1,2,1,3,3,3,2,2,3,2,1,3,14,6,1,3,2,9,6,15,27,9,34,145,1,1,2,1,1,1,1,2,1,1,1,1,2,2,2,3,1,2,1,1,1,2,3,5,8,3,5,2,4,1,3,2,2,2,12, + 4,1,1,1,10,4,5,1,20,4,16,1,15,9,5,12,2,9,2,5,4,2,26,19,7,1,26,4,30,12,15,42,1,6,8,172,1,1,4,2,1,1,11,2,2,4,2,1,2,1,10,8,1,2,1,4,5,1,2,5,1,8, + 4,1,3,4,2,1,6,2,1,3,4,1,2,1,1,1,1,12,5,7,2,4,3,1,1,1,3,3,6,1,2,2,3,3,3,2,1,2,12,14,11,6,6,4,12,2,8,1,7,10,1,35,7,4,13,15,4,3,23,21,28,52,5, + 26,5,6,1,7,10,2,7,53,3,2,1,1,1,2,163,532,1,10,11,1,3,3,4,8,2,8,6,2,2,23,22,4,2,2,4,2,1,3,1,3,3,5,9,8,2,1,2,8,1,10,2,12,21,20,15,105,2,3,1,1, + 3,2,3,1,1,2,5,1,4,15,11,19,1,1,1,1,5,4,5,1,1,2,5,3,5,12,1,2,5,1,11,1,1,15,9,1,4,5,3,26,8,2,1,3,1,1,15,19,2,12,1,2,5,2,7,2,19,2,20,6,26,7,5, + 2,2,7,34,21,13,70,2,128,1,1,2,1,1,2,1,1,3,2,2,2,15,1,4,1,3,4,42,10,6,1,49,85,8,1,2,1,1,4,4,2,3,6,1,5,7,4,3,211,4,1,2,1,2,5,1,2,4,2,2,6,5,6, + 10,3,4,48,100,6,2,16,296,5,27,387,2,2,3,7,16,8,5,38,15,39,21,9,10,3,7,59,13,27,21,47,5,21,6 }; - static ImWchar base_ranges[] = + static ImWchar base_ranges[] = // not zero-terminated { 0x0020, 0x00FF, // Basic Latin + Latin Supplement 0x3000, 0x30FF, // Punctuations, Hiragana, Katakana 0x31F0, 0x31FF, // Katakana Phonetic Extensions 0xFF00, 0xFFEF, // Half-width characters }; - static bool full_ranges_unpacked = false; - static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(offsets_from_0x4E00)*2 + 1]; - if (!full_ranges_unpacked) + static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00) * 2 + 1] = { 0 }; + if (!full_ranges[0]) { - // Unpack - int codepoint = 0x4e00; memcpy(full_ranges, base_ranges, sizeof(base_ranges)); - ImWchar* dst = full_ranges + IM_ARRAYSIZE(base_ranges);; - for (int n = 0; n < IM_ARRAYSIZE(offsets_from_0x4E00); n++, dst += 2) - dst[0] = dst[1] = (ImWchar)(codepoint += (offsets_from_0x4E00[n] + 1)); - dst[0] = 0; - full_ranges_unpacked = true; + UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_ARRAYSIZE(accumulative_offsets_from_0x4E00), full_ranges + IM_ARRAYSIZE(base_ranges)); + } + return &full_ranges[0]; +} + +const ImWchar* ImFontAtlas::GetGlyphRangesJapanese() +{ + // 1946 common ideograms code points for Japanese + // Sourced from http://theinstructionlimit.com/common-kanji-character-ranges-for-xna-spritefont-rendering + // FIXME: Source a list of the revised 2136 Joyo Kanji list from 2010 and rebuild this. + // You can use ImFontAtlas::GlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. + // (Stored as accumulative offsets from the initial unicode codepoint 0x4E00. This encoding is designed to helps us compact the source code size.) + static const short accumulative_offsets_from_0x4E00[] = + { + 0,1,2,4,1,1,1,1,2,1,6,2,2,1,8,5,7,11,1,2,10,10,8,2,4,20,2,11,8,2,1,2,1,6,2,1,7,5,3,7,1,1,13,7,9,1,4,6,1,2,1,10,1,1,9,2,2,4,5,6,14,1,1,9,3,18, + 5,4,2,2,10,7,1,1,1,3,2,4,3,23,2,10,12,2,14,2,4,13,1,6,10,3,1,7,13,6,4,13,5,2,3,17,2,2,5,7,6,4,1,7,14,16,6,13,9,15,1,1,7,16,4,7,1,19,9,2,7,15, + 2,6,5,13,25,4,14,13,11,25,1,1,1,2,1,2,2,3,10,11,3,3,1,1,4,4,2,1,4,9,1,4,3,5,5,2,7,12,11,15,7,16,4,5,16,2,1,1,6,3,3,1,1,2,7,6,6,7,1,4,7,6,1,1, + 2,1,12,3,3,9,5,8,1,11,1,2,3,18,20,4,1,3,6,1,7,3,5,5,7,2,2,12,3,1,4,2,3,2,3,11,8,7,4,17,1,9,25,1,1,4,2,2,4,1,2,7,1,1,1,3,1,2,6,16,1,2,1,1,3,12, + 20,2,5,20,8,7,6,2,1,1,1,1,6,2,1,2,10,1,1,6,1,3,1,2,1,4,1,12,4,1,3,1,1,1,1,1,10,4,7,5,13,1,15,1,1,30,11,9,1,15,38,14,1,32,17,20,1,9,31,2,21,9, + 4,49,22,2,1,13,1,11,45,35,43,55,12,19,83,1,3,2,3,13,2,1,7,3,18,3,13,8,1,8,18,5,3,7,25,24,9,24,40,3,17,24,2,1,6,2,3,16,15,6,7,3,12,1,9,7,3,3, + 3,15,21,5,16,4,5,12,11,11,3,6,3,2,31,3,2,1,1,23,6,6,1,4,2,6,5,2,1,1,3,3,22,2,6,2,3,17,3,2,4,5,1,9,5,1,1,6,15,12,3,17,2,14,2,8,1,23,16,4,2,23, + 8,15,23,20,12,25,19,47,11,21,65,46,4,3,1,5,6,1,2,5,26,2,1,1,3,11,1,1,1,2,1,2,3,1,1,10,2,3,1,1,1,3,6,3,2,2,6,6,9,2,2,2,6,2,5,10,2,4,1,2,1,2,2, + 3,1,1,3,1,2,9,23,9,2,1,1,1,1,5,3,2,1,10,9,6,1,10,2,31,25,3,7,5,40,1,15,6,17,7,27,180,1,3,2,2,1,1,1,6,3,10,7,1,3,6,17,8,6,2,2,1,3,5,5,8,16,14, + 15,1,1,4,1,2,1,1,1,3,2,7,5,6,2,5,10,1,4,2,9,1,1,11,6,1,44,1,3,7,9,5,1,3,1,1,10,7,1,10,4,2,7,21,15,7,2,5,1,8,3,4,1,3,1,6,1,4,2,1,4,10,8,1,4,5, + 1,5,10,2,7,1,10,1,1,3,4,11,10,29,4,7,3,5,2,3,33,5,2,19,3,1,4,2,6,31,11,1,3,3,3,1,8,10,9,12,11,12,8,3,14,8,6,11,1,4,41,3,1,2,7,13,1,5,6,2,6,12, + 12,22,5,9,4,8,9,9,34,6,24,1,1,20,9,9,3,4,1,7,2,2,2,6,2,28,5,3,6,1,4,6,7,4,2,1,4,2,13,6,4,4,3,1,8,8,3,2,1,5,1,2,2,3,1,11,11,7,3,6,10,8,6,16,16, + 22,7,12,6,21,5,4,6,6,3,6,1,3,2,1,2,8,29,1,10,1,6,13,6,6,19,31,1,13,4,4,22,17,26,33,10,4,15,12,25,6,67,10,2,3,1,6,10,2,6,2,9,1,9,4,4,1,2,16,2, + 5,9,2,3,8,1,8,3,9,4,8,6,4,8,11,3,2,1,1,3,26,1,7,5,1,11,1,5,3,5,2,13,6,39,5,1,5,2,11,6,10,5,1,15,5,3,6,19,21,22,2,4,1,6,1,8,1,4,8,2,4,2,2,9,2, + 1,1,1,4,3,6,3,12,7,1,14,2,4,10,2,13,1,17,7,3,2,1,3,2,13,7,14,12,3,1,29,2,8,9,15,14,9,14,1,3,1,6,5,9,11,3,38,43,20,7,7,8,5,15,12,19,15,81,8,7, + 1,5,73,13,37,28,8,8,1,15,18,20,165,28,1,6,11,8,4,14,7,15,1,3,3,6,4,1,7,14,1,1,11,30,1,5,1,4,14,1,4,2,7,52,2,6,29,3,1,9,1,21,3,5,1,26,3,11,14, + 11,1,17,5,1,2,1,3,2,8,1,2,9,12,1,1,2,3,8,3,24,12,7,7,5,17,3,3,3,1,23,10,4,4,6,3,1,16,17,22,3,10,21,16,16,6,4,10,2,1,1,2,8,8,6,5,3,3,3,39,25, + 15,1,1,16,6,7,25,15,6,6,12,1,22,13,1,4,9,5,12,2,9,1,12,28,8,3,5,10,22,60,1,2,40,4,61,63,4,1,13,12,1,4,31,12,1,14,89,5,16,6,29,14,2,5,49,18,18, + 5,29,33,47,1,17,1,19,12,2,9,7,39,12,3,7,12,39,3,1,46,4,12,3,8,9,5,31,15,18,3,2,2,66,19,13,17,5,3,46,124,13,57,34,2,5,4,5,8,1,1,1,4,3,1,17,5, + 3,5,3,1,8,5,6,3,27,3,26,7,12,7,2,17,3,7,18,78,16,4,36,1,2,1,6,2,1,39,17,7,4,13,4,4,4,1,10,4,2,4,6,3,10,1,19,1,26,2,4,33,2,73,47,7,3,8,2,4,15, + 18,1,29,2,41,14,1,21,16,41,7,39,25,13,44,2,2,10,1,13,7,1,7,3,5,20,4,8,2,49,1,10,6,1,6,7,10,7,11,16,3,12,20,4,10,3,1,2,11,2,28,9,2,4,7,2,15,1, + 27,1,28,17,4,5,10,7,3,24,10,11,6,26,3,2,7,2,2,49,16,10,16,15,4,5,27,61,30,14,38,22,2,7,5,1,3,12,23,24,17,17,3,3,2,4,1,6,2,7,5,1,1,5,1,1,9,4, + 1,3,6,1,8,2,8,4,14,3,5,11,4,1,3,32,1,19,4,1,13,11,5,2,1,8,6,8,1,6,5,13,3,23,11,5,3,16,3,9,10,1,24,3,198,52,4,2,2,5,14,5,4,22,5,20,4,11,6,41, + 1,5,2,2,11,5,2,28,35,8,22,3,18,3,10,7,5,3,4,1,5,3,8,9,3,6,2,16,22,4,5,5,3,3,18,23,2,6,23,5,27,8,1,33,2,12,43,16,5,2,3,6,1,20,4,2,9,7,1,11,2, + 10,3,14,31,9,3,25,18,20,2,5,5,26,14,1,11,17,12,40,19,9,6,31,83,2,7,9,19,78,12,14,21,76,12,113,79,34,4,1,1,61,18,85,10,2,2,13,31,11,50,6,33,159, + 179,6,6,7,4,4,2,4,2,5,8,7,20,32,22,1,3,10,6,7,28,5,10,9,2,77,19,13,2,5,1,4,4,7,4,13,3,9,31,17,3,26,2,6,6,5,4,1,7,11,3,4,2,1,6,2,20,4,1,9,2,6, + 3,7,1,1,1,20,2,3,1,6,2,3,6,2,4,8,1,5,13,8,4,11,23,1,10,6,2,1,3,21,2,2,4,24,31,4,10,10,2,5,192,15,4,16,7,9,51,1,2,1,1,5,1,1,2,1,3,5,3,1,3,4,1, + 3,1,3,3,9,8,1,2,2,2,4,4,18,12,92,2,10,4,3,14,5,25,16,42,4,14,4,2,21,5,126,30,31,2,1,5,13,3,22,5,6,6,20,12,1,14,12,87,3,19,1,8,2,9,9,3,3,23,2, + 3,7,6,3,1,2,3,9,1,3,1,6,3,2,1,3,11,3,1,6,10,3,2,3,1,2,1,5,1,1,11,3,6,4,1,7,2,1,2,5,5,34,4,14,18,4,19,7,5,8,2,6,79,1,5,2,14,8,2,9,2,1,36,28,16, + 4,1,1,1,2,12,6,42,39,16,23,7,15,15,3,2,12,7,21,64,6,9,28,8,12,3,3,41,59,24,51,55,57,294,9,9,2,6,2,15,1,2,13,38,90,9,9,9,3,11,7,1,1,1,5,6,3,2, + 1,2,2,3,8,1,4,4,1,5,7,1,4,3,20,4,9,1,1,1,5,5,17,1,5,2,6,2,4,1,4,5,7,3,18,11,11,32,7,5,4,7,11,127,8,4,3,3,1,10,1,1,6,21,14,1,16,1,7,1,3,6,9,65, + 51,4,3,13,3,10,1,1,12,9,21,110,3,19,24,1,1,10,62,4,1,29,42,78,28,20,18,82,6,3,15,6,84,58,253,15,155,264,15,21,9,14,7,58,40,39, + }; + static ImWchar base_ranges[] = // not zero-terminated + { + 0x0020, 0x00FF, // Basic Latin + Latin Supplement + 0x3000, 0x30FF, // Punctuations, Hiragana, Katakana + 0x31F0, 0x31FF, // Katakana Phonetic Extensions + 0xFF00, 0xFFEF, // Half-width characters + }; + static ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(accumulative_offsets_from_0x4E00)*2 + 1] = { 0 }; + if (!full_ranges[0]) + { + memcpy(full_ranges, base_ranges, sizeof(base_ranges)); + UnpackAccumulativeOffsetsIntoRanges(0x4E00, accumulative_offsets_from_0x4E00, IM_ARRAYSIZE(accumulative_offsets_from_0x4E00), full_ranges + IM_ARRAYSIZE(base_ranges)); } return &full_ranges[0]; } @@ -2059,10 +2229,6 @@ const ImWchar* ImFontAtlas::GetGlyphRangesThai() return &ranges[0]; } -//----------------------------------------------------------------------------- -// ImFontAtlas::GlyphRangesBuilder -//----------------------------------------------------------------------------- - void ImFontAtlas::GlyphRangesBuilder::AddText(const char* text, const char* text_end) { while (text_end ? (text < text_end) : *text) @@ -2098,14 +2264,14 @@ void ImFontAtlas::GlyphRangesBuilder::BuildRanges(ImVector* out_ranges) } //----------------------------------------------------------------------------- -// ImFont +// [SECTION] ImFont //----------------------------------------------------------------------------- ImFont::ImFont() { Scale = 1.0f; FallbackChar = (ImWchar)'?'; - DisplayOffset = ImVec2(0.0f, 1.0f); + DisplayOffset = ImVec2(0.0f, 0.0f); ClearOutputData(); } @@ -2134,6 +2300,7 @@ void ImFont::ClearOutputData() ConfigData = NULL; ContainerAtlas = NULL; Ascent = Descent = 0.0f; + DirtyLookupTables = true; MetricsTotalSurface = 0; } @@ -2146,30 +2313,30 @@ void ImFont::BuildLookupTable() IM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved IndexAdvanceX.clear(); IndexLookup.clear(); + DirtyLookupTables = false; GrowIndex(max_codepoint + 1); for (int i = 0; i < Glyphs.Size; i++) { int codepoint = (int)Glyphs[i].Codepoint; IndexAdvanceX[codepoint] = Glyphs[i].AdvanceX; - IndexLookup[codepoint] = (unsigned short)i; + IndexLookup[codepoint] = (ImWchar)i; } // Create a glyph to handle TAB // FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at "column 0" ?) - if (FindGlyph((unsigned short)' ')) + if (FindGlyph((ImWchar)' ')) { if (Glyphs.back().Codepoint != '\t') // So we can call this function multiple times Glyphs.resize(Glyphs.Size + 1); ImFontGlyph& tab_glyph = Glyphs.back(); - tab_glyph = *FindGlyph((unsigned short)' '); + tab_glyph = *FindGlyph((ImWchar)' '); tab_glyph.Codepoint = '\t'; tab_glyph.AdvanceX *= 4; IndexAdvanceX[(int)tab_glyph.Codepoint] = (float)tab_glyph.AdvanceX; - IndexLookup[(int)tab_glyph.Codepoint] = (unsigned short)(Glyphs.Size-1); + IndexLookup[(int)tab_glyph.Codepoint] = (ImWchar)(Glyphs.Size-1); } - FallbackGlyph = NULL; - FallbackGlyph = FindGlyph(FallbackChar); + FallbackGlyph = FindGlyphNoFallback(FallbackChar); FallbackAdvanceX = FallbackGlyph ? FallbackGlyph->AdvanceX : 0.0f; for (int i = 0; i < max_codepoint + 1; i++) if (IndexAdvanceX[i] < 0.0f) @@ -2188,28 +2355,31 @@ void ImFont::GrowIndex(int new_size) if (new_size <= IndexLookup.Size) return; IndexAdvanceX.resize(new_size, -1.0f); - IndexLookup.resize(new_size, (unsigned short)-1); + IndexLookup.resize(new_size, (ImWchar)-1); } +// x0/y0/x1/y1 are offset from the character upper-left layout position, in pixels. Therefore x0/y0 are often fairly close to zero. +// Not to be mistaken with texture coordinates, which are held by u0/v0/u1/v1 in normalized format (0.0..1.0 on each texture axis). void ImFont::AddGlyph(ImWchar codepoint, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x) { Glyphs.resize(Glyphs.Size + 1); ImFontGlyph& glyph = Glyphs.back(); glyph.Codepoint = (ImWchar)codepoint; - glyph.X0 = x0; - glyph.Y0 = y0; - glyph.X1 = x1; + glyph.X0 = x0; + glyph.Y0 = y0; + glyph.X1 = x1; glyph.Y1 = y1; - glyph.U0 = u0; - glyph.V0 = v0; - glyph.U1 = u1; + glyph.U0 = u0; + glyph.V0 = v0; + glyph.U1 = u1; glyph.V1 = v1; glyph.AdvanceX = advance_x + ConfigData->GlyphExtraSpacing.x; // Bake spacing into AdvanceX if (ConfigData->PixelSnapH) glyph.AdvanceX = (float)(int)(glyph.AdvanceX + 0.5f); - + // Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round) + DirtyLookupTables = true; MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + 1.99f); } @@ -2218,25 +2388,34 @@ void ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst) IM_ASSERT(IndexLookup.Size > 0); // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function. int index_size = IndexLookup.Size; - if (dst < index_size && IndexLookup.Data[dst] == (unsigned short)-1 && !overwrite_dst) // 'dst' already exists + if (dst < index_size && IndexLookup.Data[dst] == (ImWchar)-1 && !overwrite_dst) // 'dst' already exists return; if (src >= index_size && dst >= index_size) // both 'dst' and 'src' don't exist -> no-op return; GrowIndex(dst + 1); - IndexLookup[dst] = (src < index_size) ? IndexLookup.Data[src] : (unsigned short)-1; + IndexLookup[dst] = (src < index_size) ? IndexLookup.Data[src] : (ImWchar)-1; IndexAdvanceX[dst] = (src < index_size) ? IndexAdvanceX.Data[src] : 1.0f; } const ImFontGlyph* ImFont::FindGlyph(ImWchar c) const { - if (c < IndexLookup.Size) - { - const unsigned short i = IndexLookup[c]; - if (i != (unsigned short)-1) - return &Glyphs.Data[i]; - } - return FallbackGlyph; + if (c >= IndexLookup.Size) + return FallbackGlyph; + const ImWchar i = IndexLookup[c]; + if (i == (ImWchar)-1) + return FallbackGlyph; + return &Glyphs.Data[i]; +} + +const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const +{ + if (c >= IndexLookup.Size) + return NULL; + const ImWchar i = IndexLookup[c]; + if (i == (ImWchar)-1) + return NULL; + return &Glyphs.Data[i]; } const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const @@ -2294,7 +2473,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c } const float char_width = ((int)c < IndexAdvanceX.Size ? IndexAdvanceX[(int)c] : FallbackAdvanceX); - if (ImCharIsSpace(c)) + if (ImCharIsBlankW(c)) { if (inside_word) { @@ -2377,7 +2556,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons while (s < text_end) { const char c = *s; - if (ImCharIsSpace(c)) { s++; } else if (c == '\n') { s++; break; } else { break; } + if (ImCharIsBlankA(c)) { s++; } else if (c == '\n') { s++; break; } else { break; } } continue; } @@ -2432,7 +2611,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons return text_size; } -void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const +void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const { if (c == ' ' || c == '\t' || c == '\n' || c == '\r') // Match behavior of RenderText(), those 4 codepoints are hard-coded. return; @@ -2464,11 +2643,32 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col const bool word_wrap_enabled = (wrap_width > 0.0f); const char* word_wrap_eol = NULL; - // Skip non-visible lines + // Fast-forward to first visible line const char* s = text_begin; - if (!word_wrap_enabled && y + line_height < clip_rect.y) - while (s < text_end && *s != '\n') // Fast-forward to next line - s++; + if (y + line_height < clip_rect.y && !word_wrap_enabled) + while (y + line_height < clip_rect.y && s < text_end) + { + s = (const char*)memchr(s, '\n', text_end - s); + s = s ? s + 1 : text_end; + y += line_height; + } + + // For large text, scan for the last visible line in order to avoid over-reserving in the call to PrimReserve() + // Note that very large horizontal line will still be affected by the issue (e.g. a one megabyte string buffer without a newline will likely crash atm) + if (text_end - s > 10000 && !word_wrap_enabled) + { + const char* s_end = s; + float y_end = y; + while (y_end < clip_rect.w && s_end < text_end) + { + s_end = (const char*)memchr(s_end, '\n', text_end - s_end); + s_end = s_end ? s_end + 1 : text_end; + y_end += line_height; + } + text_end = s_end; + } + if (s == text_end) + return; // Reserve vertices for remaining worse case (over-reserving is useful and easily amortized) const int vtx_count_max = (int)(text_end - s) * 4; @@ -2502,7 +2702,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col while (s < text_end) { const char c = *s; - if (ImCharIsSpace(c)) { s++; } else if (c == '\n') { s++; break; } else { break; } + if (ImCharIsBlankA(c)) { s++; } else if (c == '\n') { s++; break; } else { break; } } continue; } @@ -2527,12 +2727,8 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col { x = pos.x; y += line_height; - if (y > clip_rect.w) - break; - if (!word_wrap_enabled && y + line_height < clip_rect.y) - while (s < text_end && *s != '\n') // Fast-forward to next line - s++; + break; // break out of main loop continue; } if (c == '\r') @@ -2540,7 +2736,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col } float char_width = 0.0f; - if (const ImFontGlyph* glyph = FindGlyph((unsigned short)c)) + if (const ImFontGlyph* glyph = FindGlyph((ImWchar)c)) { char_width = glyph->AdvanceX * scale; @@ -2619,14 +2815,57 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col } //----------------------------------------------------------------------------- -// Internals Drawing Helpers +// [SECTION] Internal Render Helpers +// (progressively moved from imgui.cpp to here when they are redesigned to stop accessing ImGui global state) //----------------------------------------------------------------------------- +// - RenderMouseCursor() +// - RenderArrowPointingAt() +// - RenderRectFilledRangeH() +//----------------------------------------------------------------------------- + +void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor) +{ + if (mouse_cursor == ImGuiMouseCursor_None) + return; + IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT); + + const ImU32 col_shadow = IM_COL32(0, 0, 0, 48); + const ImU32 col_border = IM_COL32(0, 0, 0, 255); // Black + const ImU32 col_fill = IM_COL32(255, 255, 255, 255); // White + + ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas; + ImVec2 offset, size, uv[4]; + if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2])) + { + pos -= offset; + const ImTextureID tex_id = font_atlas->TexID; + draw_list->PushTextureID(tex_id); + draw_list->AddImage(tex_id, pos + ImVec2(1,0)*scale, pos + ImVec2(1,0)*scale + size*scale, uv[2], uv[3], col_shadow); + draw_list->AddImage(tex_id, pos + ImVec2(2,0)*scale, pos + ImVec2(2,0)*scale + size*scale, uv[2], uv[3], col_shadow); + draw_list->AddImage(tex_id, pos, pos + size*scale, uv[2], uv[3], col_border); + draw_list->AddImage(tex_id, pos, pos + size*scale, uv[0], uv[1], col_fill); + draw_list->PopTextureID(); + } +} + +// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side. +void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col) +{ + switch (direction) + { + case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return; + case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return; + case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return; + case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return; + case ImGuiDir_None: case ImGuiDir_COUNT: break; // Fix warnings + } +} static inline float ImAcos01(float x) { if (x <= 0.0f) return IM_PI * 0.5f; if (x >= 1.0f) return 0.0f; - return acosf(x); + return ImAcos(x); //return (-0.69813170079773212f * x * x - 0.87266462599716477f) * x + 1.5707963267948966f; // Cheap approximation, may be enough for what we do. } @@ -2690,35 +2929,38 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im draw_list->PathFillConvex(col); } + //----------------------------------------------------------------------------- -// DEFAULT FONT DATA +// [SECTION] Decompression code //----------------------------------------------------------------------------- -// Compressed with stb_compress() then converted to a C array. -// Use the program in extra_fonts/binary_to_compressed_c.cpp to create the array from a TTF file. +// Compressed with stb_compress() then converted to a C array and encoded as base85. +// Use the program in misc/fonts/binary_to_compressed_c.cpp to create the array from a TTF file. +// The purpose of encoding as base85 instead of "0x00,0x01,..." style is only save on _source code_ size. // Decompression from stb.h (public domain) by Sean Barrett https://github.com/nothings/stb/blob/master/stb.h //----------------------------------------------------------------------------- -static unsigned int stb_decompress_length(unsigned char *input) +static unsigned int stb_decompress_length(const unsigned char *input) { return (input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11]; } -static unsigned char *stb__barrier, *stb__barrier2, *stb__barrier3, *stb__barrier4; +static unsigned char *stb__barrier_out_e, *stb__barrier_out_b; +static const unsigned char *stb__barrier_in_b; static unsigned char *stb__dout; -static void stb__match(unsigned char *data, unsigned int length) +static void stb__match(const unsigned char *data, unsigned int length) { // INVERSE of memmove... write each byte before copying the next... - IM_ASSERT (stb__dout + length <= stb__barrier); - if (stb__dout + length > stb__barrier) { stb__dout += length; return; } - if (data < stb__barrier4) { stb__dout = stb__barrier+1; return; } + IM_ASSERT(stb__dout + length <= stb__barrier_out_e); + if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; } + if (data < stb__barrier_out_b) { stb__dout = stb__barrier_out_e+1; return; } while (length--) *stb__dout++ = *data++; } -static void stb__lit(unsigned char *data, unsigned int length) +static void stb__lit(const unsigned char *data, unsigned int length) { - IM_ASSERT (stb__dout + length <= stb__barrier); - if (stb__dout + length > stb__barrier) { stb__dout += length; return; } - if (data < stb__barrier2) { stb__dout = stb__barrier+1; return; } + IM_ASSERT(stb__dout + length <= stb__barrier_out_e); + if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; } + if (data < stb__barrier_in_b) { stb__dout = stb__barrier_out_e+1; return; } memcpy(stb__dout, data, length); stb__dout += length; } @@ -2727,7 +2969,7 @@ static void stb__lit(unsigned char *data, unsigned int length) #define stb__in3(x) ((i[x] << 16) + stb__in2((x)+1)) #define stb__in4(x) ((i[x] << 24) + stb__in3((x)+1)) -static unsigned char *stb_decompress_token(unsigned char *i) +static const unsigned char *stb_decompress_token(const unsigned char *i) { if (*i >= 0x20) { // use fewer if's for cases that expand small if (*i >= 0x80) stb__match(stb__dout-i[1]-1, i[0] - 0x80 + 1), i += 2; @@ -2775,21 +3017,20 @@ static unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, uns return (unsigned int)(s2 << 16) + (unsigned int)s1; } -static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length) +static unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/) { unsigned int olen; if (stb__in4(0) != 0x57bC0000) return 0; if (stb__in4(4) != 0) return 0; // error! stream is > 4GB olen = stb_decompress_length(i); - stb__barrier2 = i; - stb__barrier3 = i+length; - stb__barrier = output + olen; - stb__barrier4 = output; + stb__barrier_in_b = i; + stb__barrier_out_e = output + olen; + stb__barrier_out_b = output; i += 16; stb__dout = output; for (;;) { - unsigned char *old_i = i; + const unsigned char *old_i = i; i = stb_decompress_token(i); if (i == old_i) { if (*i == 0x05 && i[1] == 0xfa) { @@ -2809,6 +3050,8 @@ static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsi } } +//----------------------------------------------------------------------------- +// [SECTION] Default font data (ProggyClean.ttf) //----------------------------------------------------------------------------- // ProggyClean.ttf // Copyright (c) 2004, 2005 Tristan Grimmer @@ -2816,7 +3059,8 @@ static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsi // Download and more information at http://upperbounds.net //----------------------------------------------------------------------------- // File: 'ProggyClean.ttf' (41208 bytes) -// Exported using binary_to_compressed_c.cpp +// Exported using misc/fonts/binary_to_compressed_c.cpp (with compression + base85 string encoding). +// The purpose of encoding as base85 instead of "0x00,0x01,..." style is only save on _source code_ size. //----------------------------------------------------------------------------- static const char proggy_clean_ttf_compressed_data_base85[11980+1] = "7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/" diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/imgui_internal.h b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_internal.h new file mode 100644 index 00000000000..0039d271d0e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_internal.h @@ -0,0 +1,1331 @@ +// dear imgui, v1.67 WIP +// (internal structures/api) + +// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! +// Set: +// #define IMGUI_DEFINE_MATH_OPERATORS +// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators) + +#pragma once + +#ifndef IMGUI_VERSION +#error Must include imgui.h before imgui_internal.h +#endif + +#include // FILE* +#include // NULL, malloc, free, qsort, atoi, atof +#include // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf +#include // INT_MIN, INT_MAX + +#ifdef _MSC_VER +#pragma warning (push) +#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport) +#endif + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h +#pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h +#pragma clang diagnostic ignored "-Wold-style-cast" +#endif + +//----------------------------------------------------------------------------- +// Forward Declarations +//----------------------------------------------------------------------------- + +struct ImRect; // An axis-aligned rectangle (2 points) +struct ImDrawDataBuilder; // Helper to build a ImDrawData instance +struct ImDrawListSharedData; // Data shared between all ImDrawList instances +struct ImGuiColorMod; // Stacked color modifier, backup of modified data so we can restore it +struct ImGuiColumnData; // Storage data for a single column +struct ImGuiColumnsSet; // Storage data for a columns set +struct ImGuiContext; // Main imgui context +struct ImGuiGroupData; // Stacked storage data for BeginGroup()/EndGroup() +struct ImGuiInputTextState; // Internal state of the currently focused/edited text input box +struct ImGuiItemHoveredDataBackup; // Backup and restore IsItemHovered() internal data +struct ImGuiMenuColumns; // Simple column measurement, currently used for MenuItem() only +struct ImGuiNavMoveResult; // Result of a directional navigation move query result +struct ImGuiNextWindowData; // Storage for SetNexWindow** functions +struct ImGuiPopupRef; // Storage for current popup stack +struct ImGuiSettingsHandler; // Storage for one type registered in the .ini file +struct ImGuiStyleMod; // Stacked style modifier, backup of modified data so we can restore it +struct ImGuiWindow; // Storage for one window +struct ImGuiWindowTempData; // Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame) +struct ImGuiWindowSettings; // Storage for window settings stored in .ini file (we keep one of those even if the actual window wasn't instanced during this session) + +// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists. +typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical +typedef int ImGuiButtonFlags; // -> enum ImGuiButtonFlags_ // Flags: for ButtonEx(), ButtonBehavior() +typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag() +typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags +typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight() +typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // Flags: for GetNavInputAmount2d() +typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests +typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for Separator() - internal +typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for SliderBehavior() +typedef int ImGuiDragFlags; // -> enum ImGuiDragFlags_ // Flags: for DragBehavior() + +//------------------------------------------------------------------------- +// STB libraries +//------------------------------------------------------------------------- + +namespace ImGuiStb +{ + +#undef STB_TEXTEDIT_STRING +#undef STB_TEXTEDIT_CHARTYPE +#define STB_TEXTEDIT_STRING ImGuiInputTextState +#define STB_TEXTEDIT_CHARTYPE ImWchar +#define STB_TEXTEDIT_GETWIDTH_NEWLINE -1.0f +#include "imstb_textedit.h" + +} // namespace ImGuiStb + +//----------------------------------------------------------------------------- +// Context +//----------------------------------------------------------------------------- + +#ifndef GImGui +extern IMGUI_API ImGuiContext* GImGui; // Current implicit ImGui context pointer +#endif + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +#define IM_PI 3.14159265358979323846f +#ifdef _WIN32 +#define IM_NEWLINE "\r\n" // Play it nice with Windows users (2018/05 news: Microsoft announced that Notepad will finally display Unix-style carriage returns!) +#else +#define IM_NEWLINE "\n" +#endif +#define IM_STATIC_ASSERT(_COND) typedef char static_assertion_##__line__[(_COND)?1:-1] +#define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose +#define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 + +// Enforce cdecl calling convention for functions called by the standard library, in case compilation settings changed the default to e.g. __vectorcall +#ifdef _MSC_VER +#define IMGUI_CDECL __cdecl +#else +#define IMGUI_CDECL +#endif + +// Helpers: UTF-8 <> wchar +IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count +IMGUI_API int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); // read one character. return input UTF-8 bytes count +IMGUI_API int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL); // return input UTF-8 bytes count +IMGUI_API int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end); // return number of UTF-8 code-points (NOT bytes count) +IMGUI_API int ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end); // return number of bytes to express one char in UTF-8 +IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string in UTF-8 + +// Helpers: Misc +IMGUI_API ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0); // Pass data_size==0 for zero-terminated strings +IMGUI_API void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, size_t* out_file_size = NULL, int padding_bytes = 0); +IMGUI_API FILE* ImFileOpen(const char* filename, const char* file_open_mode); +static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; } +static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; } +static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; } +static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; } +#define ImQsort qsort + +// Helpers: Geometry +IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p); +IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p); +IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p); +IMGUI_API void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w); +IMGUI_API ImGuiDir ImGetDirQuadrantFromDelta(float dx, float dy); + +// Helpers: String +IMGUI_API int ImStricmp(const char* str1, const char* str2); +IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count); +IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count); +IMGUI_API char* ImStrdup(const char* str); +IMGUI_API const char* ImStrchrRange(const char* str_begin, const char* str_end, char c); +IMGUI_API int ImStrlenW(const ImWchar* str); +IMGUI_API const char* ImStreolRange(const char* str, const char* str_end); // End end-of-line +IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line +IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end); +IMGUI_API void ImStrTrimBlanks(char* str); +IMGUI_API int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) IM_FMTARGS(3); +IMGUI_API int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) IM_FMTLIST(3); +IMGUI_API const char* ImParseFormatFindStart(const char* format); +IMGUI_API const char* ImParseFormatFindEnd(const char* format); +IMGUI_API const char* ImParseFormatTrimDecorations(const char* format, char* buf, int buf_size); +IMGUI_API int ImParseFormatPrecision(const char* format, int default_value); + +// Helpers: ImVec2/ImVec4 operators +// We are keeping those disabled by default so they don't leak in user space, to allow user enabling implicit cast operators between ImVec2 and their own types (using IM_VEC2_CLASS_EXTRA etc.) +// We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself. +#ifdef IMGUI_DEFINE_MATH_OPERATORS +static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x*rhs, lhs.y*rhs); } +static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x/rhs, lhs.y/rhs); } +static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); } +static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x-rhs.x, lhs.y-rhs.y); } +static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x*rhs.x, lhs.y*rhs.y); } +static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x/rhs.x, lhs.y/rhs.y); } +static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } +static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } +static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } +static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } +static inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x+rhs.x, lhs.y+rhs.y, lhs.z+rhs.z, lhs.w+rhs.w); } +static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-rhs.w); } +static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z, lhs.w*rhs.w); } +#endif + +// Helpers: Maths +// - Wrapper for standard libs functions. (Note that imgui_demo.cpp does _not_ use them to keep the code easy to copy) +#ifndef IMGUI_DISABLE_MATH_FUNCTIONS +static inline float ImFabs(float x) { return fabsf(x); } +static inline float ImSqrt(float x) { return sqrtf(x); } +static inline float ImPow(float x, float y) { return powf(x, y); } +static inline double ImPow(double x, double y) { return pow(x, y); } +static inline float ImFmod(float x, float y) { return fmodf(x, y); } +static inline double ImFmod(double x, double y) { return fmod(x, y); } +static inline float ImCos(float x) { return cosf(x); } +static inline float ImSin(float x) { return sinf(x); } +static inline float ImAcos(float x) { return acosf(x); } +static inline float ImAtan2(float y, float x) { return atan2f(y, x); } +static inline double ImAtof(const char* s) { return atof(s); } +static inline float ImFloorStd(float x) { return floorf(x); } // we already uses our own ImFloor() { return (float)(int)v } internally so the standard one wrapper is named differently (it's used by stb_truetype) +static inline float ImCeil(float x) { return ceilf(x); } +#endif +// - ImMin/ImMax/ImClamp/ImLerp/ImSwap are used by widgets which support for variety of types: signed/unsigned int/long long float/double, using templates here but we could also redefine them 6 times +template static inline T ImMin(T lhs, T rhs) { return lhs < rhs ? lhs : rhs; } +template static inline T ImMax(T lhs, T rhs) { return lhs >= rhs ? lhs : rhs; } +template static inline T ImClamp(T v, T mn, T mx) { return (v < mn) ? mn : (v > mx) ? mx : v; } +template static inline T ImLerp(T a, T b, float t) { return (T)(a + (b - a) * t); } +template static inline void ImSwap(T& a, T& b) { T tmp = a; a = b; b = tmp; } +// - Misc maths helpers +static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); } +static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); } +static inline ImVec2 ImClamp(const ImVec2& v, const ImVec2& mn, ImVec2 mx) { return ImVec2((v.x < mn.x) ? mn.x : (v.x > mx.x) ? mx.x : v.x, (v.y < mn.y) ? mn.y : (v.y > mx.y) ? mx.y : v.y); } +static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); } +static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); } +static inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); } +static inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; } +static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; } +static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; } +static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / ImSqrt(d); return fail_value; } +static inline float ImFloor(float f) { return (float)(int)f; } +static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)v.x, (float)(int)v.y); } +static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; } +static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); } +static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; } +static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } + +// Helper: ImPool<>. Basic keyed storage for contiguous instances, slow/amortized insertion, O(1) indexable, O(Log N) queries by ID over a dense/hot buffer, +// Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object. +typedef int ImPoolIdx; +template +struct IMGUI_API ImPool +{ + ImVector Data; // Contiguous data + ImGuiStorage Map; // ID->Index + ImPoolIdx FreeIdx; // Next free idx to use + + ImPool() { FreeIdx = 0; } + ~ImPool() { Clear(); } + T* GetByKey(ImGuiID key) { int idx = Map.GetInt(key, -1); return (idx != -1) ? &Data[idx] : NULL; } + T* GetByIndex(ImPoolIdx n) { return &Data[n]; } + ImPoolIdx GetIndex(const T* p) const { IM_ASSERT(p >= Data.Data && p < Data.Data + Data.Size); return (ImPoolIdx)(p - Data.Data); } + T* GetOrAddByKey(ImGuiID key) { int* p_idx = Map.GetIntRef(key, -1); if (*p_idx != -1) return &Data[*p_idx]; *p_idx = FreeIdx; return Add(); } + void Clear() { for (int n = 0; n < Map.Data.Size; n++) { int idx = Map.Data[n].val_i; if (idx != -1) Data[idx].~T(); } Map.Clear(); Data.clear(); FreeIdx = 0; } + T* Add() { int idx = FreeIdx; if (idx == Data.Size) { Data.resize(Data.Size + 1); FreeIdx++; } else { FreeIdx = *(int*)&Data[idx]; } IM_PLACEMENT_NEW(&Data[idx]) T(); return &Data[idx]; } + void Remove(ImGuiID key, const T* p) { Remove(key, GetIndex(p)); } + void Remove(ImGuiID key, ImPoolIdx idx) { Data[idx].~T(); *(int*)&Data[idx] = FreeIdx; FreeIdx = idx; Map.SetInt(key, -1); } + void Reserve(int capacity) { Data.reserve(capacity); Map.Data.reserve(capacity); } + int GetSize() const { return Data.Size; } +}; + +//----------------------------------------------------------------------------- +// Types +//----------------------------------------------------------------------------- + +// 1D vector (this odd construct is used to facilitate the transition between 1D and 2D and maintenance of some patches) +struct ImVec1 +{ + float x; + ImVec1() { x = 0.0f; } + ImVec1(float _x) { x = _x; } +}; + +enum ImGuiButtonFlags_ +{ + ImGuiButtonFlags_None = 0, + ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat + ImGuiButtonFlags_PressedOnClickRelease = 1 << 1, // return true on click + release on same item [DEFAULT if no PressedOn* flag is set] + ImGuiButtonFlags_PressedOnClick = 1 << 2, // return true on click (default requires click+release) + ImGuiButtonFlags_PressedOnRelease = 1 << 3, // return true on release (default requires click+release) + ImGuiButtonFlags_PressedOnDoubleClick = 1 << 4, // return true on double-click (default requires click+release) + ImGuiButtonFlags_FlattenChildren = 1 << 5, // allow interactions even if a child window is overlapping + ImGuiButtonFlags_AllowItemOverlap = 1 << 6, // require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap() + ImGuiButtonFlags_DontClosePopups = 1 << 7, // disable automatically closing parent popup on press // [UNUSED] + ImGuiButtonFlags_Disabled = 1 << 8, // disable interactions + ImGuiButtonFlags_AlignTextBaseLine = 1 << 9, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine + ImGuiButtonFlags_NoKeyModifiers = 1 << 10, // disable interaction if a key modifier is held + ImGuiButtonFlags_NoHoldingActiveID = 1 << 11, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only) + ImGuiButtonFlags_PressedOnDragDropHold = 1 << 12, // press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers) + ImGuiButtonFlags_NoNavFocus = 1 << 13 // don't override navigation focus when activated +}; + +enum ImGuiSliderFlags_ +{ + ImGuiSliderFlags_None = 0, + ImGuiSliderFlags_Vertical = 1 << 0 +}; + +enum ImGuiDragFlags_ +{ + ImGuiDragFlags_None = 0, + ImGuiDragFlags_Vertical = 1 << 0 +}; + +enum ImGuiColumnsFlags_ +{ + // Default: 0 + ImGuiColumnsFlags_None = 0, + ImGuiColumnsFlags_NoBorder = 1 << 0, // Disable column dividers + ImGuiColumnsFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers + ImGuiColumnsFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns + ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window + ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove. +}; + +enum ImGuiSelectableFlagsPrivate_ +{ + // NB: need to be in sync with last value of ImGuiSelectableFlags_ + ImGuiSelectableFlags_NoHoldingActiveID = 1 << 10, + ImGuiSelectableFlags_PressedOnClick = 1 << 11, + ImGuiSelectableFlags_PressedOnRelease = 1 << 12, + ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 13 +}; + +enum ImGuiSeparatorFlags_ +{ + ImGuiSeparatorFlags_None = 0, + ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar + ImGuiSeparatorFlags_Vertical = 1 << 1 +}; + +// Storage for LastItem data +enum ImGuiItemStatusFlags_ +{ + ImGuiItemStatusFlags_None = 0, + ImGuiItemStatusFlags_HoveredRect = 1 << 0, + ImGuiItemStatusFlags_HasDisplayRect = 1 << 1, + ImGuiItemStatusFlags_Edited = 1 << 2 // Value exposed by item was edited in the current frame (should match the bool return value of most widgets) +}; + +// FIXME: this is in development, not exposed/functional as a generic feature yet. +enum ImGuiLayoutType_ +{ + ImGuiLayoutType_Vertical, + ImGuiLayoutType_Horizontal +}; + +enum ImGuiAxis +{ + ImGuiAxis_None = -1, + ImGuiAxis_X = 0, + ImGuiAxis_Y = 1 +}; + +enum ImGuiPlotType +{ + ImGuiPlotType_Lines, + ImGuiPlotType_Histogram +}; + +enum ImGuiInputSource +{ + ImGuiInputSource_None = 0, + ImGuiInputSource_Mouse, + ImGuiInputSource_Nav, + ImGuiInputSource_NavKeyboard, // Only used occasionally for storage, not tested/handled by most code + ImGuiInputSource_NavGamepad, // " + ImGuiInputSource_COUNT +}; + +// FIXME-NAV: Clarify/expose various repeat delay/rate +enum ImGuiInputReadMode +{ + ImGuiInputReadMode_Down, + ImGuiInputReadMode_Pressed, + ImGuiInputReadMode_Released, + ImGuiInputReadMode_Repeat, + ImGuiInputReadMode_RepeatSlow, + ImGuiInputReadMode_RepeatFast +}; + +enum ImGuiNavHighlightFlags_ +{ + ImGuiNavHighlightFlags_None = 0, + ImGuiNavHighlightFlags_TypeDefault = 1 << 0, + ImGuiNavHighlightFlags_TypeThin = 1 << 1, + ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, + ImGuiNavHighlightFlags_NoRounding = 1 << 3 +}; + +enum ImGuiNavDirSourceFlags_ +{ + ImGuiNavDirSourceFlags_None = 0, + ImGuiNavDirSourceFlags_Keyboard = 1 << 0, + ImGuiNavDirSourceFlags_PadDPad = 1 << 1, + ImGuiNavDirSourceFlags_PadLStick = 1 << 2 +}; + +enum ImGuiNavMoveFlags_ +{ + ImGuiNavMoveFlags_None = 0, + ImGuiNavMoveFlags_LoopX = 1 << 0, // On failed request, restart from opposite side + ImGuiNavMoveFlags_LoopY = 1 << 1, + ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left) + ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful for provided for completeness + ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place) + ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5 // Store alternate result in NavMoveResultLocalVisibleSet that only comprise elements that are already fully visible. +}; + +enum ImGuiNavForward +{ + ImGuiNavForward_None, + ImGuiNavForward_ForwardQueued, + ImGuiNavForward_ForwardActive +}; + +enum ImGuiPopupPositionPolicy +{ + ImGuiPopupPositionPolicy_Default, + ImGuiPopupPositionPolicy_ComboBox +}; + +// 2D axis aligned bounding-box +// NB: we can't rely on ImVec2 math operators being available here +struct IMGUI_API ImRect +{ + ImVec2 Min; // Upper-left + ImVec2 Max; // Lower-right + + ImRect() : Min(FLT_MAX,FLT_MAX), Max(-FLT_MAX,-FLT_MAX) {} + ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {} + ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {} + ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {} + + ImVec2 GetCenter() const { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); } + ImVec2 GetSize() const { return ImVec2(Max.x - Min.x, Max.y - Min.y); } + float GetWidth() const { return Max.x - Min.x; } + float GetHeight() const { return Max.y - Min.y; } + ImVec2 GetTL() const { return Min; } // Top-left + ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right + ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left + ImVec2 GetBR() const { return Max; } // Bottom-right + bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; } + bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x <= Max.x && r.Max.y <= Max.y; } + bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; } + void Add(const ImVec2& p) { if (Min.x > p.x) Min.x = p.x; if (Min.y > p.y) Min.y = p.y; if (Max.x < p.x) Max.x = p.x; if (Max.y < p.y) Max.y = p.y; } + void Add(const ImRect& r) { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; } + void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; } + void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; } + void Translate(const ImVec2& d) { Min.x += d.x; Min.y += d.y; Max.x += d.x; Max.y += d.y; } + void TranslateX(float dx) { Min.x += dx; Max.x += dx; } + void TranslateY(float dy) { Min.y += dy; Max.y += dy; } + void ClipWith(const ImRect& r) { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); } // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display. + void ClipWithFull(const ImRect& r) { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped. + void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; } + bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; } +}; + +// Stacked color modifier, backup of modified data so we can restore it +struct ImGuiColorMod +{ + ImGuiCol Col; + ImVec4 BackupValue; +}; + +// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable. +struct ImGuiStyleMod +{ + ImGuiStyleVar VarIdx; + union { int BackupInt[2]; float BackupFloat[2]; }; + ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; } + ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; } + ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; } +}; + +// Stacked storage data for BeginGroup()/EndGroup() +struct ImGuiGroupData +{ + ImVec2 BackupCursorPos; + ImVec2 BackupCursorMaxPos; + ImVec1 BackupIndent; + ImVec1 BackupGroupOffset; + ImVec2 BackupCurrentLineSize; + float BackupCurrentLineTextBaseOffset; + float BackupLogLinePosY; + ImGuiID BackupActiveIdIsAlive; + bool BackupActiveIdPreviousFrameIsAlive; + bool AdvanceCursor; +}; + +// Simple column measurement, currently used for MenuItem() only.. This is very short-sighted/throw-away code and NOT a generic helper. +struct IMGUI_API ImGuiMenuColumns +{ + int Count; + float Spacing; + float Width, NextWidth; + float Pos[4], NextWidths[4]; + + ImGuiMenuColumns(); + void Update(int count, float spacing, bool clear); + float DeclColumns(float w0, float w1, float w2); + float CalcExtraSpace(float avail_w); +}; + +// Internal state of the currently focused/edited text input box +struct IMGUI_API ImGuiInputTextState +{ + ImGuiID ID; // widget id owning the text state + ImVector TextW; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer. + ImVector InitialText; // backup of end-user buffer at the time of focus (in UTF-8, unaltered) + ImVector TempBuffer; // temporary buffer for callback and other other operations. size=capacity. + int CurLenA, CurLenW; // we need to maintain our buffer length in both UTF-8 and wchar format. + int BufCapacityA; // end-user buffer capacity + float ScrollX; + ImGuiStb::STB_TexteditState StbState; + float CursorAnim; + bool CursorFollow; + bool SelectedAllMouseLock; + + // Temporarily set when active + ImGuiInputTextFlags UserFlags; + ImGuiInputTextCallback UserCallback; + void* UserCallbackData; + + ImGuiInputTextState() { memset(this, 0, sizeof(*this)); } + void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking + void CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); } + bool HasSelection() const { return StbState.select_start != StbState.select_end; } + void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; } + void SelectAll() { StbState.select_start = 0; StbState.cursor = StbState.select_end = CurLenW; StbState.has_preferred_x = false; } + void OnKeyPressed(int key); // Cannot be inline because we call in code in stb_textedit.h implementation +}; + +// Windows data saved in imgui.ini file +struct ImGuiWindowSettings +{ + char* Name; + ImGuiID ID; + ImVec2 Pos; + ImVec2 Size; + bool Collapsed; + + ImGuiWindowSettings() { Name = NULL; ID = 0; Pos = Size = ImVec2(0,0); Collapsed = false; } +}; + +struct ImGuiSettingsHandler +{ + const char* TypeName; // Short description stored in .ini file. Disallowed characters: '[' ']' + ImGuiID TypeHash; // == ImHash(TypeName, 0, 0) + void* (*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name); // Read: Called when entering into a new ini entry e.g. "[Window][Name]" + void (*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line); // Read: Called for every line of text within an ini entry + void (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); // Write: Output every entries into 'out_buf' + void* UserData; + + ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); } +}; + +// Storage for current popup stack +struct ImGuiPopupRef +{ + ImGuiID PopupId; // Set on OpenPopup() + ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup() + ImGuiWindow* ParentWindow; // Set on OpenPopup() + int OpenFrameCount; // Set on OpenPopup() + ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differenciate multiple menu sets from each others (e.g. inside menu bar vs loose menu items) + ImVec2 OpenPopupPos; // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse) + ImVec2 OpenMousePos; // Set on OpenPopup(), copy of mouse position at the time of opening popup +}; + +struct ImGuiColumnData +{ + float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right) + float OffsetNormBeforeResize; + ImGuiColumnsFlags Flags; // Not exposed + ImRect ClipRect; + + ImGuiColumnData() { OffsetNorm = OffsetNormBeforeResize = 0.0f; Flags = 0; } +}; + +struct ImGuiColumnsSet +{ + ImGuiID ID; + ImGuiColumnsFlags Flags; + bool IsFirstFrame; + bool IsBeingResized; + int Current; + int Count; + float MinX, MaxX; + float LineMinY, LineMaxY; + float StartPosY; // Copy of CursorPos + float StartMaxPosX; // Copy of CursorMaxPos + ImVector Columns; + + ImGuiColumnsSet() { Clear(); } + void Clear() + { + ID = 0; + Flags = 0; + IsFirstFrame = false; + IsBeingResized = false; + Current = 0; + Count = 1; + MinX = MaxX = 0.0f; + LineMinY = LineMaxY = 0.0f; + StartPosY = 0.0f; + StartMaxPosX = 0.0f; + Columns.clear(); + } +}; + +// Data shared between all ImDrawList instances +struct IMGUI_API ImDrawListSharedData +{ + ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas + ImFont* Font; // Current/default font (optional, for simplified AddText overload) + float FontSize; // Current/default font size (optional, for simplified AddText overload) + float CurveTessellationTol; + ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen() + + // Const data + // FIXME: Bake rounded corners fill/borders in atlas + ImVec2 CircleVtx12[12]; + + ImDrawListSharedData(); +}; + +struct ImDrawDataBuilder +{ + ImVector Layers[2]; // Global layers for: regular, tooltip + + void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); } + void ClearFreeMemory() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); } + IMGUI_API void FlattenIntoSingleLayer(); +}; + +struct ImGuiNavMoveResult +{ + ImGuiID ID; // Best candidate + ImGuiWindow* Window; // Best candidate window + float DistBox; // Best candidate box distance to current NavId + float DistCenter; // Best candidate center distance to current NavId + float DistAxial; + ImRect RectRel; // Best candidate bounding box in window relative space + + ImGuiNavMoveResult() { Clear(); } + void Clear() { ID = 0; Window = NULL; DistBox = DistCenter = DistAxial = FLT_MAX; RectRel = ImRect(); } +}; + +// Storage for SetNexWindow** functions +struct ImGuiNextWindowData +{ + ImGuiCond PosCond; + ImGuiCond SizeCond; + ImGuiCond ContentSizeCond; + ImGuiCond CollapsedCond; + ImGuiCond SizeConstraintCond; + ImGuiCond FocusCond; + ImGuiCond BgAlphaCond; + ImVec2 PosVal; + ImVec2 PosPivotVal; + ImVec2 SizeVal; + ImVec2 ContentSizeVal; + bool CollapsedVal; + ImRect SizeConstraintRect; + ImGuiSizeCallback SizeCallback; + void* SizeCallbackUserData; + float BgAlphaVal; + ImVec2 MenuBarOffsetMinVal; // This is not exposed publicly, so we don't clear it. + + ImGuiNextWindowData() + { + PosCond = SizeCond = ContentSizeCond = CollapsedCond = SizeConstraintCond = FocusCond = BgAlphaCond = 0; + PosVal = PosPivotVal = SizeVal = ImVec2(0.0f, 0.0f); + ContentSizeVal = ImVec2(0.0f, 0.0f); + CollapsedVal = false; + SizeConstraintRect = ImRect(); + SizeCallback = NULL; + SizeCallbackUserData = NULL; + BgAlphaVal = FLT_MAX; + MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f); + } + + void Clear() + { + PosCond = SizeCond = ContentSizeCond = CollapsedCond = SizeConstraintCond = FocusCond = BgAlphaCond = 0; + } +}; + +// Main imgui context +struct ImGuiContext +{ + bool Initialized; + bool FrameScopeActive; // Set by NewFrame(), cleared by EndFrame()/Render() + bool FontAtlasOwnedByContext; // Io.Fonts-> is owned by the ImGuiContext and will be destructed along with it. + ImGuiIO IO; + ImGuiStyle Style; + ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back() + float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window. + float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height. + ImDrawListSharedData DrawListSharedData; + + double Time; + int FrameCount; + int FrameCountEnded; + int FrameCountRendered; + ImVector Windows; // Windows, sorted in display order, back to front + ImVector WindowsFocusOrder; // Windows, sorted in focus order, back to front + ImVector WindowsSortBuffer; + ImVector CurrentWindowStack; + ImGuiStorage WindowsById; + int WindowsActiveCount; + ImGuiWindow* CurrentWindow; // Being drawn into + ImGuiWindow* HoveredWindow; // Will catch mouse inputs + ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only) + ImGuiID HoveredId; // Hovered widget + bool HoveredIdAllowOverlap; + ImGuiID HoveredIdPreviousFrame; + float HoveredIdTimer; // Measure contiguous hovering time + float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active + ImGuiID ActiveId; // Active widget + ImGuiID ActiveIdPreviousFrame; + ImGuiID ActiveIdIsAlive; // Active widget has been seen this frame (we can't use a bool as the ActiveId may change within the frame) + float ActiveIdTimer; + bool ActiveIdIsJustActivated; // Set at the time of activation for one frame + bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always) + bool ActiveIdHasBeenEdited; // Was the value associated to the widget Edited over the course of the Active state. + bool ActiveIdPreviousFrameIsAlive; + bool ActiveIdPreviousFrameHasBeenEdited; + int ActiveIdAllowNavDirFlags; // Active widget allows using directional navigation (e.g. can activate a button and move away from it) + ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior) + ImGuiWindow* ActiveIdWindow; + ImGuiWindow* ActiveIdPreviousFrameWindow; + ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard) + ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation. + float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation. + ImVec2 LastValidMousePos; + ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow. + ImVector ColorModifiers; // Stack for PushStyleColor()/PopStyleColor() + ImVector StyleModifiers; // Stack for PushStyleVar()/PopStyleVar() + ImVector FontStack; // Stack for PushFont()/PopFont() + ImVector OpenPopupStack; // Which popups are open (persistent) + ImVector CurrentPopupStack; // Which level of BeginPopup() we are in (reset every frame) + ImGuiNextWindowData NextWindowData; // Storage for SetNextWindow** functions + bool NextTreeNodeOpenVal; // Storage for SetNextTreeNode** functions + ImGuiCond NextTreeNodeOpenCond; + + // Navigation data (for gamepad/keyboard) + ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow' + ImGuiID NavId; // Focused item for navigation + ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem() + ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0 + ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0 + ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0 + ImGuiID NavJustTabbedId; // Just tabbed to this id. + ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest) + ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame + ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard. + ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring. + int NavScoringCount; // Metrics for debugging + ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed front-most. + ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f + ImGuiWindow* NavWindowingList; + float NavWindowingTimer; + float NavWindowingHighlightAlpha; + bool NavWindowingToggleLayer; + int NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later. + int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing + bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRefRectRel is valid + bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default) + bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover) + bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again. + bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest + bool NavInitRequest; // Init request for appearing window to select first item + bool NavInitRequestFromMove; + ImGuiID NavInitResultId; + ImRect NavInitResultRectRel; + bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items + bool NavMoveRequest; // Move request for this frame + ImGuiNavMoveFlags NavMoveRequestFlags; + ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu) + ImGuiDir NavMoveDir, NavMoveDirLast; // Direction of the move request (left/right/up/down), direction of the previous move request + ImGuiDir NavMoveClipDir; + ImGuiNavMoveResult NavMoveResultLocal; // Best move request candidate within NavWindow + ImGuiNavMoveResult NavMoveResultLocalVisibleSet; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag) + ImGuiNavMoveResult NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag) + + // Render + ImDrawData DrawData; // Main ImDrawData instance to pass render information to the user + ImDrawDataBuilder DrawDataBuilder; + float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list) + ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays + ImGuiMouseCursor MouseCursor; + + // Drag and Drop + bool DragDropActive; + bool DragDropWithinSourceOrTarget; + ImGuiDragDropFlags DragDropSourceFlags; + int DragDropSourceFrameCount; + int DragDropMouseButton; + ImGuiPayload DragDropPayload; + ImRect DragDropTargetRect; + ImGuiID DragDropTargetId; + ImGuiDragDropFlags DragDropAcceptFlags; + float DragDropAcceptIdCurrRectSurface; // Target item surface (we resolve overlapping targets by prioritizing the smaller surface) + ImGuiID DragDropAcceptIdCurr; // Target item id (set at the time of accepting the payload) + ImGuiID DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets) + int DragDropAcceptFrameCount; // Last time a target expressed a desire to accept the source + ImVector DragDropPayloadBufHeap; // We don't expose the ImVector<> directly + unsigned char DragDropPayloadBufLocal[8]; // Local buffer for small payloads + + // Widget state + ImGuiInputTextState InputTextState; + ImFont InputTextPasswordFont; + ImGuiID ScalarAsInputTextId; // Temporary text input when CTRL+clicking on a slider, etc. + ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets + ImVec4 ColorPickerRef; + bool DragCurrentAccumDirty; + float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings + float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio + ImVec2 ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage? + int TooltipOverrideCount; + ImVector PrivateClipboard; // If no custom clipboard handler is defined + ImVec2 PlatformImePos, PlatformImeLastPos; // Cursor position request & last passed to the OS Input Method Editor + + // Settings + bool SettingsLoaded; + float SettingsDirtyTimer; // Save .ini Settings to memory when time reaches zero + ImGuiTextBuffer SettingsIniData; // In memory .ini settings + ImVector SettingsHandlers; // List of .ini settings handlers + ImVector SettingsWindows; // ImGuiWindow .ini settings entries (parsed from the last loaded .ini file and maintained on saving) + + // Logging + bool LogEnabled; + FILE* LogFile; // If != NULL log to stdout/ file + ImGuiTextBuffer LogClipboard; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators. + int LogStartDepth; + int LogAutoExpandMaxDepth; + + // Misc + float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds. + int FramerateSecPerFrameIdx; + float FramerateSecPerFrameAccum; + int WantCaptureMouseNextFrame; // Explicit capture via CaptureKeyboardFromApp()/CaptureMouseFromApp() sets those flags + int WantCaptureKeyboardNextFrame; + int WantTextInputNextFrame; + char TempBuffer[1024*3+1]; // Temporary text buffer + + ImGuiContext(ImFontAtlas* shared_font_atlas) : OverlayDrawList(NULL) + { + Initialized = false; + FrameScopeActive = false; + Font = NULL; + FontSize = FontBaseSize = 0.0f; + FontAtlasOwnedByContext = shared_font_atlas ? false : true; + IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)(); + + Time = 0.0f; + FrameCount = 0; + FrameCountEnded = FrameCountRendered = -1; + WindowsActiveCount = 0; + CurrentWindow = NULL; + HoveredWindow = NULL; + HoveredRootWindow = NULL; + HoveredId = 0; + HoveredIdAllowOverlap = false; + HoveredIdPreviousFrame = 0; + HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f; + ActiveId = 0; + ActiveIdPreviousFrame = 0; + ActiveIdIsAlive = 0; + ActiveIdTimer = 0.0f; + ActiveIdIsJustActivated = false; + ActiveIdAllowOverlap = false; + ActiveIdHasBeenEdited = false; + ActiveIdPreviousFrameIsAlive = false; + ActiveIdPreviousFrameHasBeenEdited = false; + ActiveIdAllowNavDirFlags = 0; + ActiveIdClickOffset = ImVec2(-1,-1); + ActiveIdWindow = ActiveIdPreviousFrameWindow = NULL; + ActiveIdSource = ImGuiInputSource_None; + LastActiveId = 0; + LastActiveIdTimer = 0.0f; + LastValidMousePos = ImVec2(0.0f, 0.0f); + MovingWindow = NULL; + NextTreeNodeOpenVal = false; + NextTreeNodeOpenCond = 0; + + NavWindow = NULL; + NavId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0; + NavJustTabbedId = NavJustMovedToId = NavNextActivateId = 0; + NavInputSource = ImGuiInputSource_None; + NavScoringRectScreen = ImRect(); + NavScoringCount = 0; + NavWindowingTarget = NavWindowingTargetAnim = NavWindowingList = NULL; + NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f; + NavWindowingToggleLayer = false; + NavLayer = 0; + NavIdTabCounter = INT_MAX; + NavIdIsAlive = false; + NavMousePosDirty = false; + NavDisableHighlight = true; + NavDisableMouseHover = false; + NavAnyRequest = false; + NavInitRequest = false; + NavInitRequestFromMove = false; + NavInitResultId = 0; + NavMoveFromClampedRefRect = false; + NavMoveRequest = false; + NavMoveRequestFlags = 0; + NavMoveRequestForward = ImGuiNavForward_None; + NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None; + + DimBgRatio = 0.0f; + OverlayDrawList._Data = &DrawListSharedData; + OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging + MouseCursor = ImGuiMouseCursor_Arrow; + + DragDropActive = DragDropWithinSourceOrTarget = false; + DragDropSourceFlags = 0; + DragDropSourceFrameCount = -1; + DragDropMouseButton = -1; + DragDropTargetId = 0; + DragDropAcceptFlags = 0; + DragDropAcceptIdCurrRectSurface = 0.0f; + DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0; + DragDropAcceptFrameCount = -1; + memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal)); + + ScalarAsInputTextId = 0; + ColorEditOptions = ImGuiColorEditFlags__OptionsDefault; + DragCurrentAccumDirty = false; + DragCurrentAccum = 0.0f; + DragSpeedDefaultRatio = 1.0f / 100.0f; + ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f); + TooltipOverrideCount = 0; + PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX); + + SettingsLoaded = false; + SettingsDirtyTimer = 0.0f; + + LogEnabled = false; + LogFile = NULL; + LogStartDepth = 0; + LogAutoExpandMaxDepth = 2; + + memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame)); + FramerateSecPerFrameIdx = 0; + FramerateSecPerFrameAccum = 0.0f; + WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1; + memset(TempBuffer, 0, sizeof(TempBuffer)); + } +}; + +// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin(). +// This is going to be exposed in imgui.h when stabilized enough. +enum ImGuiItemFlags_ +{ + ImGuiItemFlags_NoTabStop = 1 << 0, // false + ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings. + ImGuiItemFlags_Disabled = 1 << 2, // false // [BETA] Disable interactions but doesn't affect visuals yet. See github.com/ocornut/imgui/issues/211 + ImGuiItemFlags_NoNav = 1 << 3, // false + ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false + ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window + ImGuiItemFlags_Default_ = 0 +}; + +// Transient per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the DC variable name in ImGuiWindow. +// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiWindowTempData is quite tenuous and could be reconsidered. +struct IMGUI_API ImGuiWindowTempData +{ + ImVec2 CursorPos; + ImVec2 CursorPosPrevLine; + ImVec2 CursorStartPos; // Initial position in client area with padding + ImVec2 CursorMaxPos; // Used to implicitly calculate the size of our contents, always growing during the frame. Turned into window->SizeContents at the beginning of next frame + ImVec2 CurrentLineSize; + float CurrentLineTextBaseOffset; + ImVec2 PrevLineSize; + float PrevLineTextBaseOffset; + float LogLinePosY; + int TreeDepth; + ImU32 TreeDepthMayJumpToParentOnPop; // Store a copy of !g.NavIdIsAlive for TreeDepth 0..31 + ImGuiID LastItemId; + ImGuiItemStatusFlags LastItemStatusFlags; + ImRect LastItemRect; // Interaction rect + ImRect LastItemDisplayRect; // End-user display rect (only valid if LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect) + bool NavHideHighlightOneFrame; + bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f) + int NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1) + int NavLayerCurrentMask; // = (1 << NavLayerCurrent) used by ItemAdd prior to clipping. + int NavLayerActiveMask; // Which layer have been written to (result from previous frame) + int NavLayerActiveMaskNext; // Which layer have been written to (buffer for current frame) + bool MenuBarAppending; // FIXME: Remove this + ImVec2 MenuBarOffset; // MenuBarOffset.x is sort of equivalent of a per-layer CursorPos.x, saved/restored as we switch to the menu bar. The only situation when MenuBarOffset.y is > 0 if when (SafeAreaPadding.y > FramePadding.y), often used on TVs. + ImVector ChildWindows; + ImGuiStorage* StateStorage; + ImGuiLayoutType LayoutType; + ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin() + + // We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings. + ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default] + float ItemWidth; // == ItemWidthStack.back(). 0.0: default, >0.0: width in pixels, <0.0: align xx pixels to the right of window + float TextWrapPos; // == TextWrapPosStack.back() [empty == -1.0f] + ImVectorItemFlagsStack; + ImVector ItemWidthStack; + ImVector TextWrapPosStack; + ImVectorGroupStack; + int StackSizesBackup[6]; // Store size of various stacks for asserting + + ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.) + ImVec1 GroupOffset; + ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API. + ImGuiColumnsSet* ColumnsSet; // Current columns set + + ImGuiWindowTempData() + { + CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f); + CurrentLineSize = PrevLineSize = ImVec2(0.0f, 0.0f); + CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f; + LogLinePosY = -1.0f; + TreeDepth = 0; + TreeDepthMayJumpToParentOnPop = 0x00; + LastItemId = 0; + LastItemStatusFlags = 0; + LastItemRect = LastItemDisplayRect = ImRect(); + NavHideHighlightOneFrame = false; + NavHasScroll = false; + NavLayerActiveMask = NavLayerActiveMaskNext = 0x00; + NavLayerCurrent = 0; + NavLayerCurrentMask = 1 << 0; + MenuBarAppending = false; + MenuBarOffset = ImVec2(0.0f, 0.0f); + StateStorage = NULL; + LayoutType = ParentLayoutType = ImGuiLayoutType_Vertical; + ItemWidth = 0.0f; + ItemFlags = ImGuiItemFlags_Default_; + TextWrapPos = -1.0f; + memset(StackSizesBackup, 0, sizeof(StackSizesBackup)); + + Indent = ImVec1(0.0f); + GroupOffset = ImVec1(0.0f); + ColumnsOffset = ImVec1(0.0f); + ColumnsSet = NULL; + } +}; + +// Storage for one window +struct IMGUI_API ImGuiWindow +{ + char* Name; + ImGuiID ID; // == ImHash(Name) + ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_ + ImVec2 Pos; // Position (always rounded-up to nearest pixel) + ImVec2 Size; // Current size (==SizeFull or collapsed title bar size) + ImVec2 SizeFull; // Size when non collapsed + ImVec2 SizeFullAtLastBegin; // Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars. + ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame. Include decoration, window title, border, menu, etc. + ImVec2 SizeContentsExplicit; // Size of contents explicitly set by the user via SetNextWindowContentSize() + ImVec2 WindowPadding; // Window padding at the time of begin. + float WindowRounding; // Window rounding at the time of begin. + float WindowBorderSize; // Window border size at the time of begin. + ImGuiID MoveId; // == window->GetID("#MOVE") + ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window) + ImVec2 Scroll; + ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change) + ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered + ImVec2 ScrollbarSizes; // Size taken by scrollbars on each axis + bool ScrollbarX, ScrollbarY; + bool Active; // Set to true on Begin(), unless Collapsed + bool WasActive; + bool WriteAccessed; // Set to true when any widget access the current window + bool Collapsed; // Set when collapsing window to become only title-bar + bool WantCollapseToggle; + bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed) + bool Appearing; // Set during the frame where the window is appearing (or re-appearing) + bool Hidden; // Do not display (== (HiddenFramesForResize > 0) || + bool HasCloseButton; // Set when the window has a close button (p_open != NULL) + int BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs) + int BeginOrderWithinParent; // Order within immediate parent window, if we are a child window. Otherwise 0. + int BeginOrderWithinContext; // Order within entire imgui context. This is mostly used for debugging submission order related issues. + ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling) + int AutoFitFramesX, AutoFitFramesY; + bool AutoFitOnlyGrows; + int AutoFitChildAxises; + ImGuiDir AutoPosLastDirection; + int HiddenFramesRegular; // Hide the window for N frames + int HiddenFramesForResize; // Hide the window for N frames while allowing items to be submitted so we can measure their size + ImGuiCond SetWindowPosAllowFlags; // store acceptable condition flags for SetNextWindowPos() use. + ImGuiCond SetWindowSizeAllowFlags; // store acceptable condition flags for SetNextWindowSize() use. + ImGuiCond SetWindowCollapsedAllowFlags; // store acceptable condition flags for SetNextWindowCollapsed() use. + ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) + ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right. + + ImGuiWindowTempData DC; // Temporary per-window data, reset at the beginning of the frame. This used to be called ImGuiDrawContext, hence the "DC" variable name. + ImVector IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack + ImRect ClipRect; // Current clipping rectangle. = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2. + ImRect OuterRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window. + ImRect InnerMainRect, InnerClipRect; + ImRect ContentsRegionRect; // FIXME: This is currently confusing/misleading. Maximum visible content position ~~ Pos + (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis + int LastFrameActive; // Last frame number the window was Active. + float ItemWidthDefault; + ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items + ImGuiStorage StateStorage; + ImVector ColumnsStorage; + float FontWindowScale; // User scale multiplier per-window + int SettingsIdx; // Index into SettingsWindow[] (indices are always valid as we only grow the array from the back) + + ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer) + ImDrawList DrawListInst; + ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL. + ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window. + ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active. + ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag. + + ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.) + ImGuiID NavLastIds[2]; // Last known NavId for this window, per layer (0/1) + ImRect NavRectRel[2]; // Reference rectangle, in window relative space + + // Navigation / Focus + // FIXME-NAV: Merge all this with the new Nav system, at least the request variables should be moved to ImGuiContext + int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister() + int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through) + int FocusIdxAllRequestCurrent; // Item being requested for focus + int FocusIdxTabRequestCurrent; // Tab-able item being requested for focus + int FocusIdxAllRequestNext; // Item being requested for focus, for next update (relies on layout to be stable between the frame pressing TAB and the next frame) + int FocusIdxTabRequestNext; // " + +public: + ImGuiWindow(ImGuiContext* context, const char* name); + ~ImGuiWindow(); + + ImGuiID GetID(const char* str, const char* str_end = NULL); + ImGuiID GetID(const void* ptr); + ImGuiID GetIDNoKeepAlive(const char* str, const char* str_end = NULL); + ImGuiID GetIDNoKeepAlive(const void* ptr); + ImGuiID GetIDFromRectangle(const ImRect& r_abs); + + // We don't use g.FontSize because the window may be != g.CurrentWidow. + ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x+Size.x, Pos.y+Size.y); } + float CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; } + float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; } + ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); } + float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; } + ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); } +}; + +// Backup and restore just enough data to be able to use IsItemHovered() on item A after another B in the same window has overwritten the data. +struct ImGuiItemHoveredDataBackup +{ + ImGuiID LastItemId; + ImGuiItemStatusFlags LastItemStatusFlags; + ImRect LastItemRect; + ImRect LastItemDisplayRect; + + ImGuiItemHoveredDataBackup() { Backup(); } + void Backup() { ImGuiWindow* window = GImGui->CurrentWindow; LastItemId = window->DC.LastItemId; LastItemStatusFlags = window->DC.LastItemStatusFlags; LastItemRect = window->DC.LastItemRect; LastItemDisplayRect = window->DC.LastItemDisplayRect; } + void Restore() const { ImGuiWindow* window = GImGui->CurrentWindow; window->DC.LastItemId = LastItemId; window->DC.LastItemStatusFlags = LastItemStatusFlags; window->DC.LastItemRect = LastItemRect; window->DC.LastItemDisplayRect = LastItemDisplayRect; } +}; + +//----------------------------------------------------------------------------- +// Internal API +// No guarantee of forward compatibility here. +//----------------------------------------------------------------------------- + +namespace ImGui +{ + // We should always have a CurrentWindow in the stack (there is an implicit "Debug" window) + // If this ever crash because g.CurrentWindow is NULL it means that either + // - ImGui::NewFrame() has never been called, which is illegal. + // - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal. + inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; } + inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; } + IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id); + IMGUI_API ImGuiWindow* FindWindowByName(const char* name); + IMGUI_API void FocusWindow(ImGuiWindow* window); + IMGUI_API void FocusPreviousWindowIgnoringOne(ImGuiWindow* ignore_window); + IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window); + IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window); + IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window); + IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window); + IMGUI_API ImVec2 CalcWindowExpectedSize(ImGuiWindow* window); + IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent); + IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window); + IMGUI_API void SetWindowScrollX(ImGuiWindow* window, float new_scroll_x); + IMGUI_API void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y); + IMGUI_API float GetWindowScrollMaxX(ImGuiWindow* window); + IMGUI_API float GetWindowScrollMaxY(ImGuiWindow* window); + IMGUI_API ImRect GetWindowAllowedExtentRect(ImGuiWindow* window); + IMGUI_API void SetCurrentFont(ImFont* font); + inline ImFont* GetDefaultFont() { ImGuiContext& g = *GImGui; return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; } + + // Init + IMGUI_API void Initialize(ImGuiContext* context); + IMGUI_API void Shutdown(ImGuiContext* context); // Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext(). + + // NewFrame + IMGUI_API void UpdateHoveredWindowAndCaptureFlags(); + IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window); + IMGUI_API void UpdateMouseMovingWindow(); + + // Settings + IMGUI_API void MarkIniSettingsDirty(); + IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window); + IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); + IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id); + IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name); + + // Basic Accessors + inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.LastItemId; } + inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; } + inline ImGuiID GetFocusID() { ImGuiContext& g = *GImGui; return g.NavId; } + IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window); + IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow* window); + IMGUI_API void ClearActiveID(); + IMGUI_API ImGuiID GetHoveredID(); + IMGUI_API void SetHoveredID(ImGuiID id); + IMGUI_API void KeepAliveID(ImGuiID id); + IMGUI_API void MarkItemEdited(ImGuiID id); + + // Basic Helpers for widget code + IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f); + IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f); + IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL); + IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id); + IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged); + IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested + IMGUI_API void FocusableItemUnregister(ImGuiWindow* window); + IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y); + IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x); + IMGUI_API void PushMultiItemsWidths(int components, float width_full = 0.0f); + IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled); + IMGUI_API void PopItemFlag(); + + // Popups, Modals, Tooltips + IMGUI_API void OpenPopupEx(ImGuiID id); + IMGUI_API void ClosePopup(ImGuiID id); + IMGUI_API void ClosePopupToLevel(int remaining); + IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window); + IMGUI_API bool IsPopupOpen(ImGuiID id); + IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); + IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true); + IMGUI_API ImGuiWindow* GetFrontMostPopupModal(); + IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window); + IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy = ImGuiPopupPositionPolicy_Default); + + // Navigation + IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit); + IMGUI_API bool NavMoveRequestButNoResultYet(); + IMGUI_API void NavMoveRequestCancel(); + IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags); + IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags); + IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode); + IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f); + IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate); + IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. + IMGUI_API void SetNavID(ImGuiID id, int nav_layer); + IMGUI_API void SetNavIDWithRectRel(ImGuiID id, int nav_layer, const ImRect& rect_rel); + + // Inputs + inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { const int key_index = GImGui->IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; } + inline bool IsNavInputDown(ImGuiNavInput n) { return GImGui->IO.NavInputs[n] > 0.0f; } + inline bool IsNavInputPressed(ImGuiNavInput n, ImGuiInputReadMode mode) { return GetNavInputAmount(n, mode) > 0.0f; } + inline bool IsNavInputPressedAnyOfTwo(ImGuiNavInput n1, ImGuiNavInput n2, ImGuiInputReadMode mode) { return (GetNavInputAmount(n1, mode) + GetNavInputAmount(n2, mode)) > 0.0f; } + + // Drag and Drop + IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id); + IMGUI_API void ClearDragDrop(); + IMGUI_API bool IsDragDropPayloadBeingAccepted(); + + // New Columns API (FIXME-WIP) + IMGUI_API void BeginColumns(const char* str_id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns(). + IMGUI_API void EndColumns(); // close columns + IMGUI_API void PushColumnClipRect(int column_index = -1); + + // Render helpers + // AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. THOSE FUNCTIONS ARE A MESS. THEIR SIGNATURE AND BEHAVIOR WILL CHANGE, THEY NEED TO BE REFACTORED INTO SOMETHING DECENT. + // NB: All position are in absolute pixels coordinates (we are never using window coordinates internally) + IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true); + IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width); + IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL); + IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f); + IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f); + IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0); + IMGUI_API void RenderArrow(ImVec2 pos, ImGuiDir dir, float scale = 1.0f); + IMGUI_API void RenderBullet(ImVec2 pos); + IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz); + IMGUI_API void RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight + IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text. + IMGUI_API void LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end = NULL); + + // Render helpers (those functions don't access any ImGui state!) + IMGUI_API void RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor = ImGuiMouseCursor_Arrow); + IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col); + IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding); + + // Widgets + IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0); + IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius); + IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos); + IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags); + IMGUI_API void Scrollbar(ImGuiLayoutType direction); + IMGUI_API void VerticalSeparator(); // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout. + + // Widgets low-level behaviors + IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0); + IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power, ImGuiDragFlags flags); + IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb); + IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f); + IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL); + IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextTreeNodeOpened() data, if any. May return true when logging + IMGUI_API void TreePushRawID(ImGuiID id); + + // Template functions are instantiated in imgui_widgets.cpp for a finite number of types. + // To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036). + // e.g. " extern template IMGUI_API float RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, float v); " + template IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, const T v_min, const T v_max, const char* format, float power, ImGuiDragFlags flags); + template IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, const T v_min, const T v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb); + template IMGUI_API float SliderCalcRatioFromValueT(ImGuiDataType data_type, T v, T v_min, T v_max, float power, float linear_zero_pos); + template IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v); + + // InputText + IMGUI_API bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); + IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* data_ptr, const char* format); + + // Color + IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags); + IMGUI_API void ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags); + IMGUI_API void ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags); + + // Plot + IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size); + + // Shade functions (write over already created vertices) + IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); + IMGUI_API void ShadeVertsLinearUV(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp); + +} // namespace ImGui + +// ImFontAtlas internals +IMGUI_API bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas); +IMGUI_API void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas); +IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); +IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* spc); +IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas); +IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor); +IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#ifdef _MSC_VER +#pragma warning (pop) +#endif diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_user.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/imgui_user.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_user.inl similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_user.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/imgui_user.inl diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp new file mode 100644 index 00000000000..7ed94956809 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp @@ -0,0 +1,5759 @@ +// dear imgui, v1.67 WIP +// (widgets code) + +/* + +Index of this file: + +// [SECTION] Forward Declarations +// [SECTION] Widgets: Text, etc. +// [SECTION] Widgets: Main (Button, Image, Checkbox, RadioButton, ProgressBar, Bullet, etc.) +// [SECTION] Widgets: Low-level Layout helpers (Spacing, Dummy, NewLine, Separator, etc.) +// [SECTION] Widgets: ComboBox +// [SECTION] Data Type and Data Formatting Helpers +// [SECTION] Widgets: DragScalar, DragFloat, DragInt, etc. +// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc. +// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc. +// [SECTION] Widgets: InputText, InputTextMultiline +// [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc. +// [SECTION] Widgets: TreeNode, CollapsingHeader, etc. +// [SECTION] Widgets: Selectable +// [SECTION] Widgets: ListBox +// [SECTION] Widgets: PlotLines, PlotHistogram +// [SECTION] Widgets: Value helpers +// [SECTION] Widgets: MenuItem, BeginMenu, EndMenu, etc. + +*/ + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include "imgui.h" +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif +#include "imgui_internal.h" + +#include // toupper, isprint +#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier +#include // intptr_t +#else +#include // intptr_t +#endif + +// Visual Studio warnings +#ifdef _MSC_VER +#pragma warning (disable: 4127) // condition expression is constant +#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen +#endif + +// Clang/GCC warnings with -Weverything +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code. +#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked +#if __GNUC__ >= 8 +#pragma GCC diagnostic ignored "-Wclass-memaccess" // warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead +#endif +#endif + +//------------------------------------------------------------------------- +// Data +//------------------------------------------------------------------------- + +// Those MIN/MAX values are not define because we need to point to them +static const ImS32 IM_S32_MIN = INT_MIN; // (-2147483647 - 1), (0x80000000); +static const ImS32 IM_S32_MAX = INT_MAX; // (2147483647), (0x7FFFFFFF) +static const ImU32 IM_U32_MIN = 0; +static const ImU32 IM_U32_MAX = UINT_MAX; // (0xFFFFFFFF) +#ifdef LLONG_MIN +static const ImS64 IM_S64_MIN = LLONG_MIN; // (-9223372036854775807ll - 1ll); +static const ImS64 IM_S64_MAX = LLONG_MAX; // (9223372036854775807ll); +#else +static const ImS64 IM_S64_MIN = -9223372036854775807LL - 1; +static const ImS64 IM_S64_MAX = 9223372036854775807LL; +#endif +static const ImU64 IM_U64_MIN = 0; +#ifdef ULLONG_MAX +static const ImU64 IM_U64_MAX = ULLONG_MAX; // (0xFFFFFFFFFFFFFFFFull); +#else +static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1); +#endif + +//------------------------------------------------------------------------- +// [SECTION] Forward Declarations +//------------------------------------------------------------------------- + +// Data Type helpers +static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* format); +static void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, void* arg_1, const void* arg_2); +static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* format); + +// For InputTextEx() +static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data); +static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end); +static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false); + +//------------------------------------------------------------------------- +// [SECTION] Widgets: Text, etc. +//------------------------------------------------------------------------- +// - TextUnformatted() +// - Text() +// - TextV() +// - TextColored() +// - TextColoredV() +// - TextDisabled() +// - TextDisabledV() +// - TextWrapped() +// - TextWrappedV() +// - LabelText() +// - LabelTextV() +// - BulletText() +// - BulletTextV() +//------------------------------------------------------------------------- + +void ImGui::TextUnformatted(const char* text, const char* text_end) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + IM_ASSERT(text != NULL); + const char* text_begin = text; + if (text_end == NULL) + text_end = text + strlen(text); // FIXME-OPT + + const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrentLineTextBaseOffset); + const float wrap_pos_x = window->DC.TextWrapPos; + const bool wrap_enabled = wrap_pos_x >= 0.0f; + if (text_end - text > 2000 && !wrap_enabled) + { + // Long text! + // Perform manual coarse clipping to optimize for long multi-line text + // - From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled. + // - We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line. + // - We use memchr(), pay attention that well optimized versions of those str/mem functions are much faster than a casually written loop. + const char* line = text; + const float line_height = GetTextLineHeight(); + const ImRect clip_rect = window->ClipRect; + ImVec2 text_size(0,0); + + if (text_pos.y <= clip_rect.Max.y) + { + ImVec2 pos = text_pos; + + // Lines to skip (can't skip when logging text) + if (!g.LogEnabled) + { + int lines_skippable = (int)((clip_rect.Min.y - text_pos.y) / line_height); + if (lines_skippable > 0) + { + int lines_skipped = 0; + while (line < text_end && lines_skipped < lines_skippable) + { + const char* line_end = (const char*)memchr(line, '\n', text_end - line); + if (!line_end) + line_end = text_end; + line = line_end + 1; + lines_skipped++; + } + pos.y += lines_skipped * line_height; + } + } + + // Lines to render + if (line < text_end) + { + ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height)); + while (line < text_end) + { + if (IsClippedEx(line_rect, 0, false)) + break; + + const char* line_end = (const char*)memchr(line, '\n', text_end - line); + if (!line_end) + line_end = text_end; + const ImVec2 line_size = CalcTextSize(line, line_end, false); + text_size.x = ImMax(text_size.x, line_size.x); + RenderText(pos, line, line_end, false); + line = line_end + 1; + line_rect.Min.y += line_height; + line_rect.Max.y += line_height; + pos.y += line_height; + } + + // Count remaining lines + int lines_skipped = 0; + while (line < text_end) + { + const char* line_end = (const char*)memchr(line, '\n', text_end - line); + if (!line_end) + line_end = text_end; + line = line_end + 1; + lines_skipped++; + } + pos.y += lines_skipped * line_height; + } + + text_size.y += (pos - text_pos).y; + } + + ImRect bb(text_pos, text_pos + text_size); + ItemSize(bb); + ItemAdd(bb, 0); + } + else + { + const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f; + const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width); + + // Account of baseline offset + ImRect bb(text_pos, text_pos + text_size); + ItemSize(text_size); + if (!ItemAdd(bb, 0)) + return; + + // Render (we don't hide text after ## in this end-user function) + RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width); + } +} + +void ImGui::Text(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + TextV(fmt, args); + va_end(args); +} + +void ImGui::TextV(const char* fmt, va_list args) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + TextUnformatted(g.TempBuffer, text_end); +} + +void ImGui::TextColored(const ImVec4& col, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + TextColoredV(col, fmt, args); + va_end(args); +} + +void ImGui::TextColoredV(const ImVec4& col, const char* fmt, va_list args) +{ + PushStyleColor(ImGuiCol_Text, col); + TextV(fmt, args); + PopStyleColor(); +} + +void ImGui::TextDisabled(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + TextDisabledV(fmt, args); + va_end(args); +} + +void ImGui::TextDisabledV(const char* fmt, va_list args) +{ + PushStyleColor(ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled]); + TextV(fmt, args); + PopStyleColor(); +} + +void ImGui::TextWrapped(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + TextWrappedV(fmt, args); + va_end(args); +} + +void ImGui::TextWrappedV(const char* fmt, va_list args) +{ + bool need_wrap = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position is one ia already set + if (need_wrap) PushTextWrapPos(0.0f); + TextV(fmt, args); + if (need_wrap) PopTextWrapPos(); +} + +void ImGui::LabelText(const char* label, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + LabelTextV(label, fmt, args); + va_end(args); +} + +// Add a label+text combo aligned to other label+value widgets +void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const float w = CalcItemWidth(); + + const ImVec2 label_size = CalcTextSize(label, NULL, true); + const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2)); + const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size); + ItemSize(total_bb, style.FramePadding.y); + if (!ItemAdd(total_bb, 0)) + return; + + // Render + const char* value_text_begin = &g.TempBuffer[0]; + const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImVec2(0.0f,0.5f)); + if (label_size.x > 0.0f) + RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); +} + +void ImGui::BulletText(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + BulletTextV(fmt, args); + va_end(args); +} + +// Text with a little bullet aligned to the typical tree node. +void ImGui::BulletTextV(const char* fmt, va_list args) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + const char* text_begin = g.TempBuffer; + const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + const ImVec2 label_size = CalcTextSize(text_begin, text_end, false); + const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it + const float line_height = ImMax(ImMin(window->DC.CurrentLineSize.y, g.FontSize + g.Style.FramePadding.y*2), g.FontSize); + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x*2) : 0.0f), ImMax(line_height, label_size.y))); // Empty text doesn't add padding + ItemSize(bb); + if (!ItemAdd(bb, 0)) + return; + + // Render + RenderBullet(bb.Min + ImVec2(style.FramePadding.x + g.FontSize*0.5f, line_height*0.5f)); + RenderText(bb.Min+ImVec2(g.FontSize + style.FramePadding.x*2, text_base_offset_y), text_begin, text_end, false); +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: Main +//------------------------------------------------------------------------- +// - ButtonBehavior() [Internal] +// - Button() +// - SmallButton() +// - InvisibleButton() +// - ArrowButton() +// - CloseButton() [Internal] +// - CollapseButton() [Internal] +// - Scrollbar() [Internal] +// - Image() +// - ImageButton() +// - Checkbox() +// - CheckboxFlags() +// - RadioButton() +// - ProgressBar() +// - Bullet() +//------------------------------------------------------------------------- + +bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + + if (flags & ImGuiButtonFlags_Disabled) + { + if (out_hovered) *out_hovered = false; + if (out_held) *out_held = false; + if (g.ActiveId == id) ClearActiveID(); + return false; + } + + // Default behavior requires click+release on same spot + if ((flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick)) == 0) + flags |= ImGuiButtonFlags_PressedOnClickRelease; + + ImGuiWindow* backup_hovered_window = g.HoveredWindow; + if ((flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window) + g.HoveredWindow = window; + + bool pressed = false; + bool hovered = ItemHoverable(bb, id); + + // Drag source doesn't report as hovered + if (hovered && g.DragDropActive && g.DragDropPayload.SourceId == id && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoDisableHover)) + hovered = false; + + // Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button + if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) + if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) + { + hovered = true; + SetHoveredID(id); + if (CalcTypematicPressedRepeatAmount(g.HoveredIdTimer + 0.0001f, g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, 0.01f, 0.70f)) // FIXME: Our formula for CalcTypematicPressedRepeatAmount() is fishy + { + pressed = true; + FocusWindow(window); + } + } + + if ((flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window) + g.HoveredWindow = backup_hovered_window; + + // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one. + if (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0)) + hovered = false; + + // Mouse + if (hovered) + { + if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt)) + { + // | CLICKING | HOLDING with ImGuiButtonFlags_Repeat + // PressedOnClickRelease | * | .. (NOT on release) <-- MOST COMMON! (*) only if both click/release were over bounds + // PressedOnClick | | .. + // PressedOnRelease | | .. (NOT on release) + // PressedOnDoubleClick | | .. + // FIXME-NAV: We don't honor those different behaviors. + if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0]) + { + SetActiveID(id, window); + if (!(flags & ImGuiButtonFlags_NoNavFocus)) + SetFocusID(id, window); + FocusWindow(window); + } + if (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0])) + { + pressed = true; + if (flags & ImGuiButtonFlags_NoHoldingActiveID) + ClearActiveID(); + else + SetActiveID(id, window); // Hold on ID + FocusWindow(window); + } + if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0]) + { + if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay)) // Repeat mode trumps + pressed = true; + ClearActiveID(); + } + + // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). + // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings. + if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && g.IO.MouseDownDuration[0] > 0.0f && IsMouseClicked(0, true)) + pressed = true; + } + + if (pressed) + g.NavDisableHighlight = true; + } + + // Gamepad/Keyboard navigation + // We report navigated item as hovered but we don't set g.HoveredId to not interfere with mouse. + if (g.NavId == id && !g.NavDisableHighlight && g.NavDisableMouseHover && (g.ActiveId == 0 || g.ActiveId == id || g.ActiveId == window->MoveId)) + hovered = true; + + if (g.NavActivateDownId == id) + { + bool nav_activated_by_code = (g.NavActivateId == id); + bool nav_activated_by_inputs = IsNavInputPressed(ImGuiNavInput_Activate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiInputReadMode_Repeat : ImGuiInputReadMode_Pressed); + if (nav_activated_by_code || nav_activated_by_inputs) + pressed = true; + if (nav_activated_by_code || nav_activated_by_inputs || g.ActiveId == id) + { + // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. + g.NavActivateId = id; // This is so SetActiveId assign a Nav source + SetActiveID(id, window); + if (!(flags & ImGuiButtonFlags_NoNavFocus)) + SetFocusID(id, window); + g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right) | (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); + } + } + + bool held = false; + if (g.ActiveId == id) + { + if (g.ActiveIdSource == ImGuiInputSource_Mouse) + { + if (g.ActiveIdIsJustActivated) + g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; + if (g.IO.MouseDown[0]) + { + held = true; + } + else + { + if (hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease)) + if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay)) // Repeat mode trumps + if (!g.DragDropActive) + pressed = true; + ClearActiveID(); + } + if (!(flags & ImGuiButtonFlags_NoNavFocus)) + g.NavDisableHighlight = true; + } + else if (g.ActiveIdSource == ImGuiInputSource_Nav) + { + if (g.NavActivateDownId != id) + ClearActiveID(); + } + } + + if (out_hovered) *out_hovered = hovered; + if (out_held) *out_held = held; + + return pressed; +} + +bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + + ImVec2 pos = window->DC.CursorPos; + if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) + pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y; + ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f); + + const ImRect bb(pos, pos + size); + ItemSize(bb, style.FramePadding.y); + if (!ItemAdd(bb, id)) + return false; + + if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat) + flags |= ImGuiButtonFlags_Repeat; + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); + if (pressed) + MarkItemEdited(id); + + // Render + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + RenderNavHighlight(bb, id); + RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); + RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb); + + // Automatically close popups + //if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup)) + // CloseCurrentPopup(); + + return pressed; +} + +bool ImGui::Button(const char* label, const ImVec2& size_arg) +{ + return ButtonEx(label, size_arg, 0); +} + +// Small buttons fits within text without additional vertical spacing. +bool ImGui::SmallButton(const char* label) +{ + ImGuiContext& g = *GImGui; + float backup_padding_y = g.Style.FramePadding.y; + g.Style.FramePadding.y = 0.0f; + bool pressed = ButtonEx(label, ImVec2(0, 0), ImGuiButtonFlags_AlignTextBaseLine); + g.Style.FramePadding.y = backup_padding_y; + return pressed; +} + +// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack. +// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id) +bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + // Cannot use zero-size for InvisibleButton(). Unlike Button() there is not way to fallback using the label size. + IM_ASSERT(size_arg.x != 0.0f && size_arg.y != 0.0f); + + const ImGuiID id = window->GetID(str_id); + ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f); + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); + ItemSize(bb); + if (!ItemAdd(bb, id)) + return false; + + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held); + + return pressed; +} + +bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiID id = window->GetID(str_id); + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); + const float default_size = GetFrameHeight(); + ItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f); + if (!ItemAdd(bb, id)) + return false; + + if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat) + flags |= ImGuiButtonFlags_Repeat; + + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); + + // Render + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + RenderNavHighlight(bb, id); + RenderFrame(bb.Min, bb.Max, col, true, g.Style.FrameRounding); + RenderArrow(bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), dir); + + return pressed; +} + +bool ImGui::ArrowButton(const char* str_id, ImGuiDir dir) +{ + float sz = GetFrameHeight(); + return ArrowButtonEx(str_id, dir, ImVec2(sz, sz), 0); +} + +// Button to close a window +bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + // We intentionally allow interaction when clipped so that a mechanical Alt,Right,Validate sequence close a window. + // (this isn't the regular behavior of buttons, but it doesn't affect the user much because navigation tends to keep items visible). + const ImRect bb(pos - ImVec2(radius,radius), pos + ImVec2(radius,radius)); + bool is_clipped = !ItemAdd(bb, id); + + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held); + if (is_clipped) + return pressed; + + // Render + ImVec2 center = bb.GetCenter(); + if (hovered) + window->DrawList->AddCircleFilled(center, ImMax(2.0f, radius), GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered), 9); + + float cross_extent = (radius * 0.7071f) - 1.0f; + ImU32 cross_col = GetColorU32(ImGuiCol_Text); + center -= ImVec2(0.5f, 0.5f); + window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), cross_col, 1.0f); + window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), cross_col, 1.0f); + + return pressed; +} + +bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + ImRect bb(pos, pos + ImVec2(g.FontSize, g.FontSize) + g.Style.FramePadding * 2.0f); + ItemAdd(bb, id); + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_None); + + ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + if (hovered || held) + window->DrawList->AddCircleFilled(bb.GetCenter() + ImVec2(0.0f, -0.5f), g.FontSize * 0.5f + 1.0f, col, 9); + RenderArrow(bb.Min + g.Style.FramePadding, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f); + + // Switch to moving the window after mouse is moved beyond the initial drag threshold + if (IsItemActive() && IsMouseDragging()) + StartMouseMovingWindow(window); + + return pressed; +} + +// Vertical/Horizontal scrollbar +// The entire piece of code below is rather confusing because: +// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab) +// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar +// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal. +void ImGui::Scrollbar(ImGuiLayoutType direction) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + const bool horizontal = (direction == ImGuiLayoutType_Horizontal); + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(horizontal ? "#SCROLLX" : "#SCROLLY"); + + // Render background + bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX); + float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f; + const ImRect window_rect = window->Rect(); + const float border_size = window->WindowBorderSize; + ImRect bb = horizontal + ? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size) + : ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size); + if (!horizontal) + bb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() : 0.0f); + if (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f) + return; + + int window_rounding_corners; + if (horizontal) + window_rounding_corners = ImDrawCornerFlags_BotLeft | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight); + else + window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0) | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight); + window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, window_rounding_corners); + bb.Expand(ImVec2(-ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f))); + + // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar) + float scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight(); + float scroll_v = horizontal ? window->Scroll.x : window->Scroll.y; + float win_size_avail_v = (horizontal ? window->SizeFull.x : window->SizeFull.y) - other_scrollbar_size_w; + float win_size_contents_v = horizontal ? window->SizeContents.x : window->SizeContents.y; + + // Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount) + // But we maintain a minimum size in pixel to allow for the user to still aim inside. + IM_ASSERT(ImMax(win_size_contents_v, win_size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers. + const float win_size_v = ImMax(ImMax(win_size_contents_v, win_size_avail_v), 1.0f); + const float grab_h_pixels = ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v); + const float grab_h_norm = grab_h_pixels / scrollbar_size_v; + + // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar(). + bool held = false; + bool hovered = false; + const bool previously_held = (g.ActiveId == id); + ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus); + + float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v); + float scroll_ratio = ImSaturate(scroll_v / scroll_max); + float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; + if (held && grab_h_norm < 1.0f) + { + float scrollbar_pos_v = horizontal ? bb.Min.x : bb.Min.y; + float mouse_pos_v = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y; + float* click_delta_to_grab_center_v = horizontal ? &g.ScrollbarClickDeltaToGrabCenter.x : &g.ScrollbarClickDeltaToGrabCenter.y; + + // Click position in scrollbar normalized space (0.0f->1.0f) + const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v); + SetHoveredID(id); + + bool seek_absolute = false; + if (!previously_held) + { + // On initial click calculate the distance between mouse and the center of the grab + if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm) + { + *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f; + } + else + { + seek_absolute = true; + *click_delta_to_grab_center_v = 0.0f; + } + } + + // Apply scroll + // It is ok to modify Scroll here because we are being called in Begin() after the calculation of SizeContents and before setting up our starting position + const float scroll_v_norm = ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm*0.5f) / (1.0f - grab_h_norm)); + scroll_v = (float)(int)(0.5f + scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v)); + if (horizontal) + window->Scroll.x = scroll_v; + else + window->Scroll.y = scroll_v; + + // Update values for rendering + scroll_ratio = ImSaturate(scroll_v / scroll_max); + grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; + + // Update distance to grab now that we have seeked and saturated + if (seek_absolute) + *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f; + } + + // Render + const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab); + ImRect grab_rect; + if (horizontal) + grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImMin(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, window_rect.Max.x), bb.Max.y); + else + grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImMin(ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels, window_rect.Max.y)); + window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding); +} + +void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); + if (border_col.w > 0.0f) + bb.Max += ImVec2(2, 2); + ItemSize(bb); + if (!ItemAdd(bb, 0)) + return; + + if (border_col.w > 0.0f) + { + window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f); + window->DrawList->AddImage(user_texture_id, bb.Min + ImVec2(1, 1), bb.Max - ImVec2(1, 1), uv0, uv1, GetColorU32(tint_col)); + } + else + { + window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col)); + } +} + +// frame_padding < 0: uses FramePadding from style (default) +// frame_padding = 0: no framing +// frame_padding > 0: set framing size +// The color used are the button colors. +bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + // Default to using texture ID as ID. User can still push string/integer prefixes. + // We could hash the size/uv to create a unique ID but that would prevent the user from animating UV. + PushID((void*)(intptr_t)user_texture_id); + const ImGuiID id = window->GetID("#image"); + PopID(); + + const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : style.FramePadding; + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2); + const ImRect image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size); + ItemSize(bb); + if (!ItemAdd(bb, id)) + return false; + + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held); + + // Render + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); + RenderNavHighlight(bb, id); + RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding)); + if (bg_col.w > 0.0f) + window->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, GetColorU32(bg_col)); + window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, GetColorU32(tint_col)); + + return pressed; +} + +bool ImGui::Checkbox(const char* label, bool* v) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + + const ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y*2, label_size.y + style.FramePadding.y*2)); // We want a square shape to we use Y twice + ItemSize(check_bb, style.FramePadding.y); + + ImRect total_bb = check_bb; + if (label_size.x > 0) + SameLine(0, style.ItemInnerSpacing.x); + const ImRect text_bb(window->DC.CursorPos + ImVec2(0,style.FramePadding.y), window->DC.CursorPos + ImVec2(0,style.FramePadding.y) + label_size); + if (label_size.x > 0) + { + ItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y); + total_bb = ImRect(ImMin(check_bb.Min, text_bb.Min), ImMax(check_bb.Max, text_bb.Max)); + } + + if (!ItemAdd(total_bb, id)) + return false; + + bool hovered, held; + bool pressed = ButtonBehavior(total_bb, id, &hovered, &held); + if (pressed) + { + *v = !(*v); + MarkItemEdited(id); + } + + RenderNavHighlight(total_bb, id); + RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding); + if (*v) + { + const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight()); + const float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f)); + RenderCheckMark(check_bb.Min + ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), check_bb.GetWidth() - pad*2.0f); + } + + if (g.LogEnabled) + LogRenderedText(&text_bb.Min, *v ? "[x]" : "[ ]"); + if (label_size.x > 0.0f) + RenderText(text_bb.Min, label); + + return pressed; +} + +bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value) +{ + bool v = ((*flags & flags_value) == flags_value); + bool pressed = Checkbox(label, &v); + if (pressed) + { + if (v) + *flags |= flags_value; + else + *flags &= ~flags_value; + } + + return pressed; +} + +bool ImGui::RadioButton(const char* label, bool active) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + + const ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y*2-1, label_size.y + style.FramePadding.y*2-1)); + ItemSize(check_bb, style.FramePadding.y); + + ImRect total_bb = check_bb; + if (label_size.x > 0) + SameLine(0, style.ItemInnerSpacing.x); + const ImRect text_bb(window->DC.CursorPos + ImVec2(0, style.FramePadding.y), window->DC.CursorPos + ImVec2(0, style.FramePadding.y) + label_size); + if (label_size.x > 0) + { + ItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y); + total_bb.Add(text_bb); + } + + if (!ItemAdd(total_bb, id)) + return false; + + ImVec2 center = check_bb.GetCenter(); + center.x = (float)(int)center.x + 0.5f; + center.y = (float)(int)center.y + 0.5f; + const float radius = check_bb.GetHeight() * 0.5f; + + bool hovered, held; + bool pressed = ButtonBehavior(total_bb, id, &hovered, &held); + if (pressed) + MarkItemEdited(id); + + RenderNavHighlight(total_bb, id); + window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16); + if (active) + { + const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight()); + const float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f)); + window->DrawList->AddCircleFilled(center, radius-pad, GetColorU32(ImGuiCol_CheckMark), 16); + } + + if (style.FrameBorderSize > 0.0f) + { + window->DrawList->AddCircle(center+ImVec2(1,1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize); + window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize); + } + + if (g.LogEnabled) + LogRenderedText(&text_bb.Min, active ? "(x)" : "( )"); + if (label_size.x > 0.0f) + RenderText(text_bb.Min, label); + + return pressed; +} + +bool ImGui::RadioButton(const char* label, int* v, int v_button) +{ + const bool pressed = RadioButton(label, *v == v_button); + if (pressed) + *v = v_button; + return pressed; +} + +// size_arg (for each axis) < 0.0f: align to end, 0.0f: auto, > 0.0f: specified size +void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* overlay) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + ImVec2 pos = window->DC.CursorPos; + ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y*2.0f)); + ItemSize(bb, style.FramePadding.y); + if (!ItemAdd(bb, 0)) + return; + + // Render + fraction = ImSaturate(fraction); + RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); + bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize)); + const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y); + RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding); + + // Default displaying the fraction as percentage string, but user can override it + char overlay_buf[32]; + if (!overlay) + { + ImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), "%.0f%%", fraction*100+0.01f); + overlay = overlay_buf; + } + + ImVec2 overlay_size = CalcTextSize(overlay, NULL); + if (overlay_size.x > 0.0f) + RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f,0.5f), &bb); +} + +void ImGui::Bullet() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const float line_height = ImMax(ImMin(window->DC.CurrentLineSize.y, g.FontSize + g.Style.FramePadding.y*2), g.FontSize); + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height)); + ItemSize(bb); + if (!ItemAdd(bb, 0)) + { + SameLine(0, style.FramePadding.x*2); + return; + } + + // Render and stay on same line + RenderBullet(bb.Min + ImVec2(style.FramePadding.x + g.FontSize*0.5f, line_height*0.5f)); + SameLine(0, style.FramePadding.x*2); +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: Low-level Layout helpers +//------------------------------------------------------------------------- +// - Spacing() +// - Dummy() +// - NewLine() +// - AlignTextToFramePadding() +// - Separator() +// - VerticalSeparator() [Internal] +// - SplitterBehavior() [Internal] +//------------------------------------------------------------------------- + +void ImGui::Spacing() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + ItemSize(ImVec2(0,0)); +} + +void ImGui::Dummy(const ImVec2& size) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); + ItemSize(bb); + ItemAdd(bb, 0); +} + +void ImGui::NewLine() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const ImGuiLayoutType backup_layout_type = window->DC.LayoutType; + window->DC.LayoutType = ImGuiLayoutType_Vertical; + if (window->DC.CurrentLineSize.y > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height. + ItemSize(ImVec2(0,0)); + else + ItemSize(ImVec2(0.0f, g.FontSize)); + window->DC.LayoutType = backup_layout_type; +} + +void ImGui::AlignTextToFramePadding() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + window->DC.CurrentLineSize.y = ImMax(window->DC.CurrentLineSize.y, g.FontSize + g.Style.FramePadding.y * 2); + window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); +} + +// Horizontal/vertical separating line +void ImGui::Separator() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + ImGuiContext& g = *GImGui; + + // Those flags should eventually be overridable by the user + ImGuiSeparatorFlags flags = (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal; + IM_ASSERT(ImIsPowerOfTwo((int)(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical)))); // Check that only 1 option is selected + if (flags & ImGuiSeparatorFlags_Vertical) + { + VerticalSeparator(); + return; + } + + // Horizontal Separator + if (window->DC.ColumnsSet) + PopClipRect(); + + float x1 = window->Pos.x; + float x2 = window->Pos.x + window->Size.x; + if (!window->DC.GroupStack.empty()) + x1 += window->DC.Indent.x; + + const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f)); + ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout. + if (!ItemAdd(bb, 0)) + { + if (window->DC.ColumnsSet) + PushColumnClipRect(); + return; + } + + window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x,bb.Min.y), GetColorU32(ImGuiCol_Separator)); + + if (g.LogEnabled) + LogRenderedText(&bb.Min, "--------------------------------"); + + if (window->DC.ColumnsSet) + { + PushColumnClipRect(); + window->DC.ColumnsSet->LineMinY = window->DC.CursorPos.y; + } +} + +void ImGui::VerticalSeparator() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + ImGuiContext& g = *GImGui; + + float y1 = window->DC.CursorPos.y; + float y2 = window->DC.CursorPos.y + window->DC.CurrentLineSize.y; + const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2)); + ItemSize(ImVec2(bb.GetWidth(), 0.0f)); + if (!ItemAdd(bb, 0)) + return; + + window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator)); + if (g.LogEnabled) + LogText(" |"); +} + +// Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise. +bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + + const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags; + window->DC.ItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus; + bool item_add = ItemAdd(bb, id); + window->DC.ItemFlags = item_flags_backup; + if (!item_add) + return false; + + bool hovered, held; + ImRect bb_interact = bb; + bb_interact.Expand(axis == ImGuiAxis_Y ? ImVec2(0.0f, hover_extend) : ImVec2(hover_extend, 0.0f)); + ButtonBehavior(bb_interact, id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap); + if (g.ActiveId != id) + SetItemAllowOverlap(); + + if (held || (g.HoveredId == id && g.HoveredIdPreviousFrame == id && g.HoveredIdTimer >= hover_visibility_delay)) + SetMouseCursor(axis == ImGuiAxis_Y ? ImGuiMouseCursor_ResizeNS : ImGuiMouseCursor_ResizeEW); + + ImRect bb_render = bb; + if (held) + { + ImVec2 mouse_delta_2d = g.IO.MousePos - g.ActiveIdClickOffset - bb_interact.Min; + float mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x; + + // Minimum pane size + float size_1_maximum_delta = ImMax(0.0f, *size1 - min_size1); + float size_2_maximum_delta = ImMax(0.0f, *size2 - min_size2); + if (mouse_delta < -size_1_maximum_delta) + mouse_delta = -size_1_maximum_delta; + if (mouse_delta > size_2_maximum_delta) + mouse_delta = size_2_maximum_delta; + + // Apply resize + if (mouse_delta != 0.0f) + { + if (mouse_delta < 0.0f) + IM_ASSERT(*size1 + mouse_delta >= min_size1); + if (mouse_delta > 0.0f) + IM_ASSERT(*size2 - mouse_delta >= min_size2); + *size1 += mouse_delta; + *size2 -= mouse_delta; + bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta)); + MarkItemEdited(id); + } + } + + // Render + const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator); + window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, g.Style.FrameRounding); + + return held; +} + + +//------------------------------------------------------------------------- +// [SECTION] Widgets: ComboBox +//------------------------------------------------------------------------- +// - BeginCombo() +// - EndCombo() +// - Combo() +//------------------------------------------------------------------------- + +static float CalcMaxPopupHeightFromItemCount(int items_count) +{ + ImGuiContext& g = *GImGui; + if (items_count <= 0) + return FLT_MAX; + return (g.FontSize + g.Style.ItemSpacing.y) * items_count - g.Style.ItemSpacing.y + (g.Style.WindowPadding.y * 2); +} + +bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags) +{ + // Always consume the SetNextWindowSizeConstraint() call in our early return paths + ImGuiContext& g = *GImGui; + ImGuiCond backup_next_window_size_constraint = g.NextWindowData.SizeConstraintCond; + g.NextWindowData.SizeConstraintCond = 0; + + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + IM_ASSERT((flags & (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)) != (ImGuiComboFlags_NoArrowButton | ImGuiComboFlags_NoPreview)); // Can't use both flags together + + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + + const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight(); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + const float w = (flags & ImGuiComboFlags_NoPreview) ? arrow_size : CalcItemWidth(); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); + const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); + ItemSize(total_bb, style.FramePadding.y); + if (!ItemAdd(total_bb, id, &frame_bb)) + return false; + + bool hovered, held; + bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held); + bool popup_open = IsPopupOpen(id); + + const ImRect value_bb(frame_bb.Min, frame_bb.Max - ImVec2(arrow_size, 0.0f)); + const ImU32 frame_col = GetColorU32(hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg); + RenderNavHighlight(frame_bb, id); + if (!(flags & ImGuiComboFlags_NoPreview)) + window->DrawList->AddRectFilled(frame_bb.Min, ImVec2(frame_bb.Max.x - arrow_size, frame_bb.Max.y), frame_col, style.FrameRounding, ImDrawCornerFlags_Left); + if (!(flags & ImGuiComboFlags_NoArrowButton)) + { + window->DrawList->AddRectFilled(ImVec2(frame_bb.Max.x - arrow_size, frame_bb.Min.y), frame_bb.Max, GetColorU32((popup_open || hovered) ? ImGuiCol_ButtonHovered : ImGuiCol_Button), style.FrameRounding, (w <= arrow_size) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Right); + RenderArrow(ImVec2(frame_bb.Max.x - arrow_size + style.FramePadding.y, frame_bb.Min.y + style.FramePadding.y), ImGuiDir_Down); + } + RenderFrameBorder(frame_bb.Min, frame_bb.Max, style.FrameRounding); + if (preview_value != NULL && !(flags & ImGuiComboFlags_NoPreview)) + RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, preview_value, NULL, NULL, ImVec2(0.0f,0.0f)); + if (label_size.x > 0) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); + + if ((pressed || g.NavActivateId == id) && !popup_open) + { + if (window->DC.NavLayerCurrent == 0) + window->NavLastIds[0] = id; + OpenPopupEx(id); + popup_open = true; + } + + if (!popup_open) + return false; + + if (backup_next_window_size_constraint) + { + g.NextWindowData.SizeConstraintCond = backup_next_window_size_constraint; + g.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w); + } + else + { + if ((flags & ImGuiComboFlags_HeightMask_) == 0) + flags |= ImGuiComboFlags_HeightRegular; + IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiComboFlags_HeightMask_)); // Only one + int popup_max_height_in_items = -1; + if (flags & ImGuiComboFlags_HeightRegular) popup_max_height_in_items = 8; + else if (flags & ImGuiComboFlags_HeightSmall) popup_max_height_in_items = 4; + else if (flags & ImGuiComboFlags_HeightLarge) popup_max_height_in_items = 20; + SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))); + } + + char name[16]; + ImFormatString(name, IM_ARRAYSIZE(name), "##Combo_%02d", g.CurrentPopupStack.Size); // Recycle windows based on depth + + // Peak into expected window size so we can position it + if (ImGuiWindow* popup_window = FindWindowByName(name)) + if (popup_window->WasActive) + { + ImVec2 size_expected = CalcWindowExpectedSize(popup_window); + if (flags & ImGuiComboFlags_PopupAlignLeft) + popup_window->AutoPosLastDirection = ImGuiDir_Left; + ImRect r_outer = GetWindowAllowedExtentRect(popup_window); + ImVec2 pos = FindBestWindowPosForPopupEx(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, r_outer, frame_bb, ImGuiPopupPositionPolicy_ComboBox); + SetNextWindowPos(pos); + } + + // Horizontally align ourselves with the framed text + ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings; + PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y)); + bool ret = Begin(name, NULL, window_flags); + PopStyleVar(); + if (!ret) + { + EndPopup(); + IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above + return false; + } + return true; +} + +void ImGui::EndCombo() +{ + EndPopup(); +} + +// Getter for the old Combo() API: const char*[] +static bool Items_ArrayGetter(void* data, int idx, const char** out_text) +{ + const char* const* items = (const char* const*)data; + if (out_text) + *out_text = items[idx]; + return true; +} + +// Getter for the old Combo() API: "item1\0item2\0item3\0" +static bool Items_SingleStringGetter(void* data, int idx, const char** out_text) +{ + // FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited. + const char* items_separated_by_zeros = (const char*)data; + int items_count = 0; + const char* p = items_separated_by_zeros; + while (*p) + { + if (idx == items_count) + break; + p += strlen(p) + 1; + items_count++; + } + if (!*p) + return false; + if (out_text) + *out_text = p; + return true; +} + +// Old API, prefer using BeginCombo() nowadays if you can. +bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int popup_max_height_in_items) +{ + ImGuiContext& g = *GImGui; + + // Call the getter to obtain the preview string which is a parameter to BeginCombo() + const char* preview_value = NULL; + if (*current_item >= 0 && *current_item < items_count) + items_getter(data, *current_item, &preview_value); + + // The old Combo() API exposed "popup_max_height_in_items". The new more general BeginCombo() API doesn't have/need it, but we emulate it here. + if (popup_max_height_in_items != -1 && !g.NextWindowData.SizeConstraintCond) + SetNextWindowSizeConstraints(ImVec2(0,0), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))); + + if (!BeginCombo(label, preview_value, ImGuiComboFlags_None)) + return false; + + // Display items + // FIXME-OPT: Use clipper (but we need to disable it on the appearing frame to make sure our call to SetItemDefaultFocus() is processed) + bool value_changed = false; + for (int i = 0; i < items_count; i++) + { + PushID((void*)(intptr_t)i); + const bool item_selected = (i == *current_item); + const char* item_text; + if (!items_getter(data, i, &item_text)) + item_text = "*Unknown item*"; + if (Selectable(item_text, item_selected)) + { + value_changed = true; + *current_item = i; + } + if (item_selected) + SetItemDefaultFocus(); + PopID(); + } + + EndCombo(); + return value_changed; +} + +// Combo box helper allowing to pass an array of strings. +bool ImGui::Combo(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items) +{ + const bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items); + return value_changed; +} + +// Combo box helper allowing to pass all items in a single string literal holding multiple zero-terminated items "item1\0item2\0" +bool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items) +{ + int items_count = 0; + const char* p = items_separated_by_zeros; // FIXME-OPT: Avoid computing this, or at least only when combo is open + while (*p) + { + p += strlen(p) + 1; + items_count++; + } + bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items); + return value_changed; +} + +//------------------------------------------------------------------------- +// [SECTION] Data Type and Data Formatting Helpers [Internal] +//------------------------------------------------------------------------- +// - PatchFormatStringFloatToInt() +// - DataTypeFormatString() +// - DataTypeApplyOp() +// - DataTypeApplyOpFromText() +// - GetMinimumStepAtDecimalPrecision +// - RoundScalarWithFormat<>() +//------------------------------------------------------------------------- + +struct ImGuiDataTypeInfo +{ + size_t Size; + const char* PrintFmt; // Unused + const char* ScanFmt; +}; + +static const ImGuiDataTypeInfo GDataTypeInfo[] = +{ + { sizeof(int), "%d", "%d" }, + { sizeof(unsigned int), "%u", "%u" }, +#ifdef _MSC_VER + { sizeof(ImS64), "%I64d","%I64d" }, + { sizeof(ImU64), "%I64u","%I64u" }, +#else + { sizeof(ImS64), "%lld", "%lld" }, + { sizeof(ImU64), "%llu", "%llu" }, +#endif + { sizeof(float), "%f", "%f" }, // float are promoted to double in va_arg + { sizeof(double), "%f", "%lf" }, +}; +IM_STATIC_ASSERT(IM_ARRAYSIZE(GDataTypeInfo) == ImGuiDataType_COUNT); + +// FIXME-LEGACY: Prior to 1.61 our DragInt() function internally used floats and because of this the compile-time default value for format was "%.0f". +// Even though we changed the compile-time default, we expect users to have carried %f around, which would break the display of DragInt() calls. +// To honor backward compatibility we are rewriting the format string, unless IMGUI_DISABLE_OBSOLETE_FUNCTIONS is enabled. What could possibly go wrong?! +static const char* PatchFormatStringFloatToInt(const char* fmt) +{ + if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '0' && fmt[3] == 'f' && fmt[4] == 0) // Fast legacy path for "%.0f" which is expected to be the most common case. + return "%d"; + const char* fmt_start = ImParseFormatFindStart(fmt); // Find % (if any, and ignore %%) + const char* fmt_end = ImParseFormatFindEnd(fmt_start); // Find end of format specifier, which itself is an exercise of confidence/recklessness (because snprintf is dependent on libc or user). + if (fmt_end > fmt_start && fmt_end[-1] == 'f') + { +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + if (fmt_start == fmt && fmt_end[0] == 0) + return "%d"; + ImGuiContext& g = *GImGui; + ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%.*s%%d%s", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision. + return g.TempBuffer; +#else + IM_ASSERT(0 && "DragInt(): Invalid format string!"); // Old versions used a default parameter of "%.0f", please replace with e.g. "%d" +#endif + } + return fmt; +} + +static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* format) +{ + if (data_type == ImGuiDataType_S32 || data_type == ImGuiDataType_U32) // Signedness doesn't matter when pushing the argument + return ImFormatString(buf, buf_size, format, *(const ImU32*)data_ptr); + if (data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64) // Signedness doesn't matter when pushing the argument + return ImFormatString(buf, buf_size, format, *(const ImU64*)data_ptr); + if (data_type == ImGuiDataType_Float) + return ImFormatString(buf, buf_size, format, *(const float*)data_ptr); + if (data_type == ImGuiDataType_Double) + return ImFormatString(buf, buf_size, format, *(const double*)data_ptr); + IM_ASSERT(0); + return 0; +} + +// FIXME: Adding support for clamping on boundaries of the data type would be nice. +static void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, void* arg1, const void* arg2) +{ + IM_ASSERT(op == '+' || op == '-'); + switch (data_type) + { + case ImGuiDataType_S32: + if (op == '+') *(int*)output = *(const int*)arg1 + *(const int*)arg2; + else if (op == '-') *(int*)output = *(const int*)arg1 - *(const int*)arg2; + return; + case ImGuiDataType_U32: + if (op == '+') *(unsigned int*)output = *(const unsigned int*)arg1 + *(const ImU32*)arg2; + else if (op == '-') *(unsigned int*)output = *(const unsigned int*)arg1 - *(const ImU32*)arg2; + return; + case ImGuiDataType_S64: + if (op == '+') *(ImS64*)output = *(const ImS64*)arg1 + *(const ImS64*)arg2; + else if (op == '-') *(ImS64*)output = *(const ImS64*)arg1 - *(const ImS64*)arg2; + return; + case ImGuiDataType_U64: + if (op == '+') *(ImU64*)output = *(const ImU64*)arg1 + *(const ImU64*)arg2; + else if (op == '-') *(ImU64*)output = *(const ImU64*)arg1 - *(const ImU64*)arg2; + return; + case ImGuiDataType_Float: + if (op == '+') *(float*)output = *(const float*)arg1 + *(const float*)arg2; + else if (op == '-') *(float*)output = *(const float*)arg1 - *(const float*)arg2; + return; + case ImGuiDataType_Double: + if (op == '+') *(double*)output = *(const double*)arg1 + *(const double*)arg2; + else if (op == '-') *(double*)output = *(const double*)arg1 - *(const double*)arg2; + return; + case ImGuiDataType_COUNT: break; + } + IM_ASSERT(0); +} + +// User can input math operators (e.g. +100) to edit a numerical values. +// NB: This is _not_ a full expression evaluator. We should probably add one and replace this dumb mess.. +static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* format) +{ + while (ImCharIsBlankA(*buf)) + buf++; + + // We don't support '-' op because it would conflict with inputing negative value. + // Instead you can use +-100 to subtract from an existing value + char op = buf[0]; + if (op == '+' || op == '*' || op == '/') + { + buf++; + while (ImCharIsBlankA(*buf)) + buf++; + } + else + { + op = 0; + } + if (!buf[0]) + return false; + + // Copy the value in an opaque buffer so we can compare at the end of the function if it changed at all. + IM_ASSERT(data_type < ImGuiDataType_COUNT); + int data_backup[2]; + IM_ASSERT(GDataTypeInfo[data_type].Size <= sizeof(data_backup)); + memcpy(data_backup, data_ptr, GDataTypeInfo[data_type].Size); + + if (format == NULL) + format = GDataTypeInfo[data_type].ScanFmt; + + int arg1i = 0; + if (data_type == ImGuiDataType_S32) + { + int* v = (int*)data_ptr; + int arg0i = *v; + float arg1f = 0.0f; + if (op && sscanf(initial_value_buf, format, &arg0i) < 1) + return false; + // Store operand in a float so we can use fractional value for multipliers (*1.1), but constant always parsed as integer so we can fit big integers (e.g. 2000000003) past float precision + if (op == '+') { if (sscanf(buf, "%d", &arg1i)) *v = (int)(arg0i + arg1i); } // Add (use "+-" to subtract) + else if (op == '*') { if (sscanf(buf, "%f", &arg1f)) *v = (int)(arg0i * arg1f); } // Multiply + else if (op == '/') { if (sscanf(buf, "%f", &arg1f) && arg1f != 0.0f) *v = (int)(arg0i / arg1f); } // Divide + else { if (sscanf(buf, format, &arg1i) == 1) *v = arg1i; } // Assign constant + } + else if (data_type == ImGuiDataType_U32 || data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64) + { + // Assign constant + // FIXME: We don't bother handling support for legacy operators since they are a little too crappy. Instead we may implement a proper expression evaluator in the future. + sscanf(buf, format, data_ptr); + } + else if (data_type == ImGuiDataType_Float) + { + // For floats we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in + format = "%f"; + float* v = (float*)data_ptr; + float arg0f = *v, arg1f = 0.0f; + if (op && sscanf(initial_value_buf, format, &arg0f) < 1) + return false; + if (sscanf(buf, format, &arg1f) < 1) + return false; + if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract) + else if (op == '*') { *v = arg0f * arg1f; } // Multiply + else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide + else { *v = arg1f; } // Assign constant + } + else if (data_type == ImGuiDataType_Double) + { + format = "%lf"; // scanf differentiate float/double unlike printf which forces everything to double because of ellipsis + double* v = (double*)data_ptr; + double arg0f = *v, arg1f = 0.0; + if (op && sscanf(initial_value_buf, format, &arg0f) < 1) + return false; + if (sscanf(buf, format, &arg1f) < 1) + return false; + if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract) + else if (op == '*') { *v = arg0f * arg1f; } // Multiply + else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide + else { *v = arg1f; } // Assign constant + } + return memcmp(data_backup, data_ptr, GDataTypeInfo[data_type].Size) != 0; +} + +static float GetMinimumStepAtDecimalPrecision(int decimal_precision) +{ + static const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f }; + if (decimal_precision < 0) + return FLT_MIN; + return (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : ImPow(10.0f, (float)-decimal_precision); +} + +template +static const char* ImAtoi(const char* src, TYPE* output) +{ + int negative = 0; + if (*src == '-') { negative = 1; src++; } + if (*src == '+') { src++; } + TYPE v = 0; + while (*src >= '0' && *src <= '9') + v = (v * 10) + (*src++ - '0'); + *output = negative ? -v : v; + return src; +} + +template +TYPE ImGui::RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, TYPE v) +{ + const char* fmt_start = ImParseFormatFindStart(format); + if (fmt_start[0] != '%' || fmt_start[1] == '%') // Don't apply if the value is not visible in the format string + return v; + char v_str[64]; + ImFormatString(v_str, IM_ARRAYSIZE(v_str), fmt_start, v); + const char* p = v_str; + while (*p == ' ') + p++; + if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) + v = (TYPE)ImAtof(p); + else + ImAtoi(p, (SIGNEDTYPE*)&v); + return v; +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: DragScalar, DragFloat, DragInt, etc. +//------------------------------------------------------------------------- +// - DragBehaviorT<>() [Internal] +// - DragBehavior() [Internal] +// - DragScalar() +// - DragScalarN() +// - DragFloat() +// - DragFloat2() +// - DragFloat3() +// - DragFloat4() +// - DragFloatRange2() +// - DragInt() +// - DragInt2() +// - DragInt3() +// - DragInt4() +// - DragIntRange2() +//------------------------------------------------------------------------- + +// This is called by DragBehavior() when the widget is active (held by mouse or being manipulated with Nav controls) +template +bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const TYPE v_min, const TYPE v_max, const char* format, float power, ImGuiDragFlags flags) +{ + ImGuiContext& g = *GImGui; + const ImGuiAxis axis = (flags & ImGuiDragFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X; + const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); + const bool has_min_max = (v_min != v_max); + + // Default tweak speed + if (v_speed == 0.0f && has_min_max && (v_max - v_min < FLT_MAX)) + v_speed = (float)((v_max - v_min) * g.DragSpeedDefaultRatio); + + // Inputs accumulates into g.DragCurrentAccum, which is flushed into the current value as soon as it makes a difference with our precision settings + float adjust_delta = 0.0f; + if (g.ActiveIdSource == ImGuiInputSource_Mouse && IsMousePosValid() && g.IO.MouseDragMaxDistanceSqr[0] > 1.0f*1.0f) + { + adjust_delta = g.IO.MouseDelta[axis]; + if (g.IO.KeyAlt) + adjust_delta *= 1.0f / 100.0f; + if (g.IO.KeyShift) + adjust_delta *= 10.0f; + } + else if (g.ActiveIdSource == ImGuiInputSource_Nav) + { + int decimal_precision = is_decimal ? ImParseFormatPrecision(format, 3) : 0; + adjust_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 1.0f / 10.0f, 10.0f)[axis]; + v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision)); + } + adjust_delta *= v_speed; + + // For vertical drag we currently assume that Up=higher value (like we do with vertical sliders). This may become a parameter. + if (axis == ImGuiAxis_Y) + adjust_delta = -adjust_delta; + + // Clear current value on activation + // Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right side, keep the 300. + bool is_just_activated = g.ActiveIdIsJustActivated; + bool is_already_past_limits_and_pushing_outward = has_min_max && ((*v >= v_max && adjust_delta > 0.0f) || (*v <= v_min && adjust_delta < 0.0f)); + if (is_just_activated || is_already_past_limits_and_pushing_outward) + { + g.DragCurrentAccum = 0.0f; + g.DragCurrentAccumDirty = false; + } + else if (adjust_delta != 0.0f) + { + g.DragCurrentAccum += adjust_delta; + g.DragCurrentAccumDirty = true; + } + + if (!g.DragCurrentAccumDirty) + return false; + + TYPE v_cur = *v; + FLOATTYPE v_old_ref_for_accum_remainder = (FLOATTYPE)0.0f; + + const bool is_power = (power != 1.0f && is_decimal && has_min_max && (v_max - v_min < FLT_MAX)); + if (is_power) + { + // Offset + round to user desired precision, with a curve on the v_min..v_max range to get more precision on one side of the range + FLOATTYPE v_old_norm_curved = ImPow((FLOATTYPE)(v_cur - v_min) / (FLOATTYPE)(v_max - v_min), (FLOATTYPE)1.0f / power); + FLOATTYPE v_new_norm_curved = v_old_norm_curved + (g.DragCurrentAccum / (v_max - v_min)); + v_cur = v_min + (TYPE)ImPow(ImSaturate((float)v_new_norm_curved), power) * (v_max - v_min); + v_old_ref_for_accum_remainder = v_old_norm_curved; + } + else + { + v_cur += (TYPE)g.DragCurrentAccum; + } + + // Round to user desired precision based on format string + v_cur = RoundScalarWithFormatT(format, data_type, v_cur); + + // Preserve remainder after rounding has been applied. This also allow slow tweaking of values. + g.DragCurrentAccumDirty = false; + if (is_power) + { + FLOATTYPE v_cur_norm_curved = ImPow((FLOATTYPE)(v_cur - v_min) / (FLOATTYPE)(v_max - v_min), (FLOATTYPE)1.0f / power); + g.DragCurrentAccum -= (float)(v_cur_norm_curved - v_old_ref_for_accum_remainder); + } + else + { + g.DragCurrentAccum -= (float)((SIGNEDTYPE)v_cur - (SIGNEDTYPE)*v); + } + + // Lose zero sign for float/double + if (v_cur == (TYPE)-0) + v_cur = (TYPE)0; + + // Clamp values (+ handle overflow/wrap-around for integer types) + if (*v != v_cur && has_min_max) + { + if (v_cur < v_min || (v_cur > *v && adjust_delta < 0.0f && !is_decimal)) + v_cur = v_min; + if (v_cur > v_max || (v_cur < *v && adjust_delta > 0.0f && !is_decimal)) + v_cur = v_max; + } + + // Apply result + if (*v == v_cur) + return false; + *v = v_cur; + return true; +} + +bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power, ImGuiDragFlags flags) +{ + ImGuiContext& g = *GImGui; + if (g.ActiveId == id) + { + if (g.ActiveIdSource == ImGuiInputSource_Mouse && !g.IO.MouseDown[0]) + ClearActiveID(); + else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated) + ClearActiveID(); + } + if (g.ActiveId != id) + return false; + + switch (data_type) + { + case ImGuiDataType_S32: return DragBehaviorT(data_type, (ImS32*)v, v_speed, v_min ? *(const ImS32* )v_min : IM_S32_MIN, v_max ? *(const ImS32* )v_max : IM_S32_MAX, format, power, flags); + case ImGuiDataType_U32: return DragBehaviorT(data_type, (ImU32*)v, v_speed, v_min ? *(const ImU32* )v_min : IM_U32_MIN, v_max ? *(const ImU32* )v_max : IM_U32_MAX, format, power, flags); + case ImGuiDataType_S64: return DragBehaviorT(data_type, (ImS64*)v, v_speed, v_min ? *(const ImS64* )v_min : IM_S64_MIN, v_max ? *(const ImS64* )v_max : IM_S64_MAX, format, power, flags); + case ImGuiDataType_U64: return DragBehaviorT(data_type, (ImU64*)v, v_speed, v_min ? *(const ImU64* )v_min : IM_U64_MIN, v_max ? *(const ImU64* )v_max : IM_U64_MAX, format, power, flags); + case ImGuiDataType_Float: return DragBehaviorT(data_type, (float*)v, v_speed, v_min ? *(const float* )v_min : -FLT_MAX, v_max ? *(const float* )v_max : FLT_MAX, format, power, flags); + case ImGuiDataType_Double: return DragBehaviorT(data_type, (double*)v, v_speed, v_min ? *(const double*)v_min : -DBL_MAX, v_max ? *(const double*)v_max : DBL_MAX, format, power, flags); + case ImGuiDataType_COUNT: break; + } + IM_ASSERT(0); + return false; +} + +bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* v, float v_speed, const void* v_min, const void* v_max, const char* format, float power) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + if (power != 1.0f) + IM_ASSERT(v_min != NULL && v_max != NULL); // When using a power curve the drag needs to have known bounds + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + const float w = CalcItemWidth(); + + const ImVec2 label_size = CalcTextSize(label, NULL, true); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); + const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); + const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); + + // NB- we don't call ItemSize() yet because we may turn into a text edit box below + if (!ItemAdd(total_bb, id, &frame_bb)) + { + ItemSize(total_bb, style.FramePadding.y); + return false; + } + const bool hovered = ItemHoverable(frame_bb, id); + + // Default format string when passing NULL + // Patch old "%.0f" format string to use "%d", read function comments for more details. + IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); + if (format == NULL) + format = GDataTypeInfo[data_type].PrintFmt; + else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) + format = PatchFormatStringFloatToInt(format); + + // Tabbing or CTRL-clicking on Drag turns it into an input box + bool start_text_input = false; + const bool tab_focus_requested = FocusableItemRegister(window, id); + if (tab_focus_requested || (hovered && (g.IO.MouseClicked[0] || g.IO.MouseDoubleClicked[0])) || g.NavActivateId == id || (g.NavInputId == id && g.ScalarAsInputTextId != id)) + { + SetActiveID(id, window); + SetFocusID(id, window); + FocusWindow(window); + g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); + if (tab_focus_requested || g.IO.KeyCtrl || g.IO.MouseDoubleClicked[0] || g.NavInputId == id) + { + start_text_input = true; + g.ScalarAsInputTextId = 0; + } + } + if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) + { + FocusableItemUnregister(window); + return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format); + } + + // Actual drag behavior + ItemSize(total_bb, style.FramePadding.y); + const bool value_changed = DragBehavior(id, data_type, v, v_speed, v_min, v_max, format, power, ImGuiDragFlags_None); + if (value_changed) + MarkItemEdited(id); + + // Draw frame + const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg); + RenderNavHighlight(frame_bb, id); + RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding); + + // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. + char value_buf[64]; + const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, v, format); + RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f)); + + if (label_size.x > 0.0f) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); + + return value_changed; +} + +bool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* v, int components, float v_speed, const void* v_min, const void* v_max, const char* format, float power) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + bool value_changed = false; + BeginGroup(); + PushID(label); + PushMultiItemsWidths(components); + size_t type_size = GDataTypeInfo[data_type].Size; + for (int i = 0; i < components; i++) + { + PushID(i); + value_changed |= DragScalar("##v", data_type, v, v_speed, v_min, v_max, format, power); + SameLine(0, g.Style.ItemInnerSpacing.x); + PopID(); + PopItemWidth(); + v = (void*)((char*)v + type_size); + } + PopID(); + + TextUnformatted(label, FindRenderedTextEnd(label)); + EndGroup(); + return value_changed; +} + +bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power) +{ + return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); +} + +bool ImGui::DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power) +{ + return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); +} + +bool ImGui::DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) +{ + return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); +} + +bool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) +{ + return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); +} + +bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* format, const char* format_max, float power) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + PushID(label); + BeginGroup(); + PushMultiItemsWidths(2); + + bool value_changed = DragFloat("##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), format, power); + PopItemWidth(); + SameLine(0, g.Style.ItemInnerSpacing.x); + value_changed |= DragFloat("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, format_max ? format_max : format, power); + PopItemWidth(); + SameLine(0, g.Style.ItemInnerSpacing.x); + + TextUnformatted(label, FindRenderedTextEnd(label)); + EndGroup(); + PopID(); + return value_changed; +} + +// NB: v_speed is float to allow adjusting the drag speed with more precision +bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* format) +{ + return DragScalar(label, ImGuiDataType_S32, v, v_speed, &v_min, &v_max, format); +} + +bool ImGui::DragInt2(const char* label, int v[2], float v_speed, int v_min, int v_max, const char* format) +{ + return DragScalarN(label, ImGuiDataType_S32, v, 2, v_speed, &v_min, &v_max, format); +} + +bool ImGui::DragInt3(const char* label, int v[3], float v_speed, int v_min, int v_max, const char* format) +{ + return DragScalarN(label, ImGuiDataType_S32, v, 3, v_speed, &v_min, &v_max, format); +} + +bool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int v_max, const char* format) +{ + return DragScalarN(label, ImGuiDataType_S32, v, 4, v_speed, &v_min, &v_max, format); +} + +bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* format, const char* format_max) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + PushID(label); + BeginGroup(); + PushMultiItemsWidths(2); + + bool value_changed = DragInt("##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), format); + PopItemWidth(); + SameLine(0, g.Style.ItemInnerSpacing.x); + value_changed |= DragInt("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, format_max ? format_max : format); + PopItemWidth(); + SameLine(0, g.Style.ItemInnerSpacing.x); + + TextUnformatted(label, FindRenderedTextEnd(label)); + EndGroup(); + PopID(); + + return value_changed; +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc. +//------------------------------------------------------------------------- +// - SliderBehaviorT<>() [Internal] +// - SliderBehavior() [Internal] +// - SliderScalar() +// - SliderScalarN() +// - SliderFloat() +// - SliderFloat2() +// - SliderFloat3() +// - SliderFloat4() +// - SliderAngle() +// - SliderInt() +// - SliderInt2() +// - SliderInt3() +// - SliderInt4() +// - VSliderScalar() +// - VSliderFloat() +// - VSliderInt() +//------------------------------------------------------------------------- + +template +float ImGui::SliderCalcRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_min, TYPE v_max, float power, float linear_zero_pos) +{ + if (v_min == v_max) + return 0.0f; + + const bool is_power = (power != 1.0f) && (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double); + const TYPE v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min); + if (is_power) + { + if (v_clamped < 0.0f) + { + const float f = 1.0f - (float)((v_clamped - v_min) / (ImMin((TYPE)0, v_max) - v_min)); + return (1.0f - ImPow(f, 1.0f/power)) * linear_zero_pos; + } + else + { + const float f = (float)((v_clamped - ImMax((TYPE)0, v_min)) / (v_max - ImMax((TYPE)0, v_min))); + return linear_zero_pos + ImPow(f, 1.0f/power) * (1.0f - linear_zero_pos); + } + } + + // Linear slider + return (float)((FLOATTYPE)(v_clamped - v_min) / (FLOATTYPE)(v_max - v_min)); +} + +namespace ImGui +{ + +float RoundScalarWithFormatFloat(const char* format, ImGuiDataType data_type, float v) +{ + return RoundScalarWithFormatT(format, data_type, v); +} + +float SliderCalcRatioFromValueFloat(ImGuiDataType data_type, float v, float v_min, float v_max, float power, float linear_zero_pos) +{ + return SliderCalcRatioFromValueT(data_type, v, v_min, v_max, power, linear_zero_pos); +} + +} // namespace ImGui + +// FIXME: Move some of the code into SliderBehavior(). Current responsability is larger than what the equivalent DragBehaviorT<> does, we also do some rendering, etc. +template +bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb) +{ + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X; + const bool is_decimal = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); + const bool is_power = (power != 1.0f) && is_decimal; + + const float grab_padding = 2.0f; + const float slider_sz = (bb.Max[axis] - bb.Min[axis]) - grab_padding * 2.0f; + float grab_sz = style.GrabMinSize; + SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max); + if (!is_decimal && v_range >= 0) // v_range < 0 may happen on integer overflows + grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit + grab_sz = ImMin(grab_sz, slider_sz); + const float slider_usable_sz = slider_sz - grab_sz; + const float slider_usable_pos_min = bb.Min[axis] + grab_padding + grab_sz*0.5f; + const float slider_usable_pos_max = bb.Max[axis] - grab_padding - grab_sz*0.5f; + + // For power curve sliders that cross over sign boundary we want the curve to be symmetric around 0.0f + float linear_zero_pos; // 0.0->1.0f + if (is_power && v_min * v_max < 0.0f) + { + // Different sign + const FLOATTYPE linear_dist_min_to_0 = ImPow(v_min >= 0 ? (FLOATTYPE)v_min : -(FLOATTYPE)v_min, (FLOATTYPE)1.0f/power); + const FLOATTYPE linear_dist_max_to_0 = ImPow(v_max >= 0 ? (FLOATTYPE)v_max : -(FLOATTYPE)v_max, (FLOATTYPE)1.0f/power); + linear_zero_pos = (float)(linear_dist_min_to_0 / (linear_dist_min_to_0 + linear_dist_max_to_0)); + } + else + { + // Same sign + linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f; + } + + // Process interacting with the slider + bool value_changed = false; + if (g.ActiveId == id) + { + bool set_new_value = false; + float clicked_t = 0.0f; + if (g.ActiveIdSource == ImGuiInputSource_Mouse) + { + if (!g.IO.MouseDown[0]) + { + ClearActiveID(); + } + else + { + const float mouse_abs_pos = g.IO.MousePos[axis]; + clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f; + if (axis == ImGuiAxis_Y) + clicked_t = 1.0f - clicked_t; + set_new_value = true; + } + } + else if (g.ActiveIdSource == ImGuiInputSource_Nav) + { + const ImVec2 delta2 = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 0.0f, 0.0f); + float delta = (axis == ImGuiAxis_X) ? delta2.x : -delta2.y; + if (g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated) + { + ClearActiveID(); + } + else if (delta != 0.0f) + { + clicked_t = SliderCalcRatioFromValueT(data_type, *v, v_min, v_max, power, linear_zero_pos); + const int decimal_precision = is_decimal ? ImParseFormatPrecision(format, 3) : 0; + if ((decimal_precision > 0) || is_power) + { + delta /= 100.0f; // Gamepad/keyboard tweak speeds in % of slider bounds + if (IsNavInputDown(ImGuiNavInput_TweakSlow)) + delta /= 10.0f; + } + else + { + if ((v_range >= -100.0f && v_range <= 100.0f) || IsNavInputDown(ImGuiNavInput_TweakSlow)) + delta = ((delta < 0.0f) ? -1.0f : +1.0f) / (float)v_range; // Gamepad/keyboard tweak speeds in integer steps + else + delta /= 100.0f; + } + if (IsNavInputDown(ImGuiNavInput_TweakFast)) + delta *= 10.0f; + set_new_value = true; + if ((clicked_t >= 1.0f && delta > 0.0f) || (clicked_t <= 0.0f && delta < 0.0f)) // This is to avoid applying the saturation when already past the limits + set_new_value = false; + else + clicked_t = ImSaturate(clicked_t + delta); + } + } + + if (set_new_value) + { + TYPE v_new; + if (is_power) + { + // Account for power curve scale on both sides of the zero + if (clicked_t < linear_zero_pos) + { + // Negative: rescale to the negative range before powering + float a = 1.0f - (clicked_t / linear_zero_pos); + a = ImPow(a, power); + v_new = ImLerp(ImMin(v_max, (TYPE)0), v_min, a); + } + else + { + // Positive: rescale to the positive range before powering + float a; + if (ImFabs(linear_zero_pos - 1.0f) > 1.e-6f) + a = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos); + else + a = clicked_t; + a = ImPow(a, power); + v_new = ImLerp(ImMax(v_min, (TYPE)0), v_max, a); + } + } + else + { + // Linear slider + if (is_decimal) + { + v_new = ImLerp(v_min, v_max, clicked_t); + } + else + { + // For integer values we want the clicking position to match the grab box so we round above + // This code is carefully tuned to work with large values (e.g. high ranges of U64) while preserving this property.. + FLOATTYPE v_new_off_f = (v_max - v_min) * clicked_t; + TYPE v_new_off_floor = (TYPE)(v_new_off_f); + TYPE v_new_off_round = (TYPE)(v_new_off_f + (FLOATTYPE)0.5); + if (!is_decimal && v_new_off_floor < v_new_off_round) + v_new = v_min + v_new_off_round; + else + v_new = v_min + v_new_off_floor; + } + } + + // Round to user desired precision based on format string + v_new = RoundScalarWithFormatT(format, data_type, v_new); + + // Apply result + if (*v != v_new) + { + *v = v_new; + value_changed = true; + } + } + } + + // Output grab position so it can be displayed by the caller + float grab_t = SliderCalcRatioFromValueT(data_type, *v, v_min, v_max, power, linear_zero_pos); + if (axis == ImGuiAxis_Y) + grab_t = 1.0f - grab_t; + const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t); + if (axis == ImGuiAxis_X) + *out_grab_bb = ImRect(grab_pos - grab_sz*0.5f, bb.Min.y + grab_padding, grab_pos + grab_sz*0.5f, bb.Max.y - grab_padding); + else + *out_grab_bb = ImRect(bb.Min.x + grab_padding, grab_pos - grab_sz*0.5f, bb.Max.x - grab_padding, grab_pos + grab_sz*0.5f); + + return value_changed; +} + +// For 32-bits and larger types, slider bounds are limited to half the natural type range. +// So e.g. an integer Slider between INT_MAX-10 and INT_MAX will fail, but an integer Slider between INT_MAX/2-10 and INT_MAX/2 will be ok. +// It would be possible to lift that limitation with some work but it doesn't seem to be worth it for sliders. +bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format, float power, ImGuiSliderFlags flags, ImRect* out_grab_bb) +{ + switch (data_type) + { + case ImGuiDataType_S32: + IM_ASSERT(*(const ImS32*)v_min >= IM_S32_MIN/2 && *(const ImS32*)v_max <= IM_S32_MAX/2); + return SliderBehaviorT(bb, id, data_type, (ImS32*)v, *(const ImS32*)v_min, *(const ImS32*)v_max, format, power, flags, out_grab_bb); + case ImGuiDataType_U32: + IM_ASSERT(*(const ImU32*)v_min <= IM_U32_MAX/2); + return SliderBehaviorT(bb, id, data_type, (ImU32*)v, *(const ImU32*)v_min, *(const ImU32*)v_max, format, power, flags, out_grab_bb); + case ImGuiDataType_S64: + IM_ASSERT(*(const ImS64*)v_min >= IM_S64_MIN/2 && *(const ImS64*)v_max <= IM_S64_MAX/2); + return SliderBehaviorT(bb, id, data_type, (ImS64*)v, *(const ImS64*)v_min, *(const ImS64*)v_max, format, power, flags, out_grab_bb); + case ImGuiDataType_U64: + IM_ASSERT(*(const ImU64*)v_min <= IM_U64_MAX/2); + return SliderBehaviorT(bb, id, data_type, (ImU64*)v, *(const ImU64*)v_min, *(const ImU64*)v_max, format, power, flags, out_grab_bb); + case ImGuiDataType_Float: + IM_ASSERT(*(const float*)v_min >= -FLT_MAX/2.0f && *(const float*)v_max <= FLT_MAX/2.0f); + return SliderBehaviorT(bb, id, data_type, (float*)v, *(const float*)v_min, *(const float*)v_max, format, power, flags, out_grab_bb); + case ImGuiDataType_Double: + IM_ASSERT(*(const double*)v_min >= -DBL_MAX/2.0f && *(const double*)v_max <= DBL_MAX/2.0f); + return SliderBehaviorT(bb, id, data_type, (double*)v, *(const double*)v_min, *(const double*)v_max, format, power, flags, out_grab_bb); + case ImGuiDataType_COUNT: break; + } + IM_ASSERT(0); + return false; +} + +bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format, float power) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + const float w = CalcItemWidth(); + + const ImVec2 label_size = CalcTextSize(label, NULL, true); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); + const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); + + // NB- we don't call ItemSize() yet because we may turn into a text edit box below + if (!ItemAdd(total_bb, id, &frame_bb)) + { + ItemSize(total_bb, style.FramePadding.y); + return false; + } + + // Default format string when passing NULL + // Patch old "%.0f" format string to use "%d", read function comments for more details. + IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); + if (format == NULL) + format = GDataTypeInfo[data_type].PrintFmt; + else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) + format = PatchFormatStringFloatToInt(format); + + // Tabbing or CTRL-clicking on Slider turns it into an input box + bool start_text_input = false; + const bool tab_focus_requested = FocusableItemRegister(window, id); + const bool hovered = ItemHoverable(frame_bb, id); + if (tab_focus_requested || (hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || (g.NavInputId == id && g.ScalarAsInputTextId != id)) + { + SetActiveID(id, window); + SetFocusID(id, window); + FocusWindow(window); + g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); + if (tab_focus_requested || g.IO.KeyCtrl || g.NavInputId == id) + { + start_text_input = true; + g.ScalarAsInputTextId = 0; + } + } + if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) + { + FocusableItemUnregister(window); + return InputScalarAsWidgetReplacement(frame_bb, id, label, data_type, v, format); + } + + ItemSize(total_bb, style.FramePadding.y); + + // Draw frame + const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg); + RenderNavHighlight(frame_bb, id); + RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding); + + // Slider behavior + ImRect grab_bb; + const bool value_changed = SliderBehavior(frame_bb, id, data_type, v, v_min, v_max, format, power, ImGuiSliderFlags_None, &grab_bb); + if (value_changed) + MarkItemEdited(id); + + // Render grab + window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding); + + // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. + char value_buf[64]; + const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, v, format); + RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f)); + + if (label_size.x > 0.0f) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); + + return value_changed; +} + +// Add multiple sliders on 1 line for compact edition of multiple components +bool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format, float power) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + bool value_changed = false; + BeginGroup(); + PushID(label); + PushMultiItemsWidths(components); + size_t type_size = GDataTypeInfo[data_type].Size; + for (int i = 0; i < components; i++) + { + PushID(i); + value_changed |= SliderScalar("##v", data_type, v, v_min, v_max, format, power); + SameLine(0, g.Style.ItemInnerSpacing.x); + PopID(); + PopItemWidth(); + v = (void*)((char*)v + type_size); + } + PopID(); + + TextUnformatted(label, FindRenderedTextEnd(label)); + EndGroup(); + return value_changed; +} + +bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power) +{ + return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); +} + +bool ImGui::SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) +{ + return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); +} + +bool ImGui::SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) +{ + return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); +} + +bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) +{ + return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); +} + +bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max, const char* format) +{ + if (format == NULL) + format = "%.0f deg"; + float v_deg = (*v_rad) * 360.0f / (2*IM_PI); + bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, format, 1.0f); + *v_rad = v_deg * (2*IM_PI) / 360.0f; + return value_changed; +} + +bool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const char* format) +{ + return SliderScalar(label, ImGuiDataType_S32, v, &v_min, &v_max, format); +} + +bool ImGui::SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format) +{ + return SliderScalarN(label, ImGuiDataType_S32, v, 2, &v_min, &v_max, format); +} + +bool ImGui::SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format) +{ + return SliderScalarN(label, ImGuiDataType_S32, v, 3, &v_min, &v_max, format); +} + +bool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format) +{ + return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format); +} + +bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType data_type, void* v, const void* v_min, const void* v_max, const char* format, float power) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + + const ImVec2 label_size = CalcTextSize(label, NULL, true); + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); + const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); + + ItemSize(bb, style.FramePadding.y); + if (!ItemAdd(frame_bb, id)) + return false; + + // Default format string when passing NULL + // Patch old "%.0f" format string to use "%d", read function comments for more details. + IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); + if (format == NULL) + format = GDataTypeInfo[data_type].PrintFmt; + else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) + format = PatchFormatStringFloatToInt(format); + + const bool hovered = ItemHoverable(frame_bb, id); + if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavInputId == id) + { + SetActiveID(id, window); + SetFocusID(id, window); + FocusWindow(window); + g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); + } + + // Draw frame + const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg); + RenderNavHighlight(frame_bb, id); + RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, g.Style.FrameRounding); + + // Slider behavior + ImRect grab_bb; + const bool value_changed = SliderBehavior(frame_bb, id, data_type, v, v_min, v_max, format, power, ImGuiSliderFlags_Vertical, &grab_bb); + if (value_changed) + MarkItemEdited(id); + + // Render grab + window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding); + + // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. + // For the vertical slider we allow centered text to overlap the frame padding + char value_buf[64]; + const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_ARRAYSIZE(value_buf), data_type, v, format); + RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.0f)); + if (label_size.x > 0.0f) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); + + return value_changed; +} + +bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format, float power) +{ + return VSliderScalar(label, size, ImGuiDataType_Float, v, &v_min, &v_max, format, power); +} + +bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format) +{ + return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format); +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc. +//------------------------------------------------------------------------- +// - ImParseFormatFindStart() [Internal] +// - ImParseFormatFindEnd() [Internal] +// - ImParseFormatTrimDecorations() [Internal] +// - ImParseFormatPrecision() [Internal] +// - InputScalarAsWidgetReplacement() [Internal] +// - InputScalar() +// - InputScalarN() +// - InputFloat() +// - InputFloat2() +// - InputFloat3() +// - InputFloat4() +// - InputInt() +// - InputInt2() +// - InputInt3() +// - InputInt4() +// - InputDouble() +//------------------------------------------------------------------------- + +// We don't use strchr() because our strings are usually very short and often start with '%' +const char* ImParseFormatFindStart(const char* fmt) +{ + while (char c = fmt[0]) + { + if (c == '%' && fmt[1] != '%') + return fmt; + else if (c == '%') + fmt++; + fmt++; + } + return fmt; +} + +const char* ImParseFormatFindEnd(const char* fmt) +{ + // Printf/scanf types modifiers: I/L/h/j/l/t/w/z. Other uppercase letters qualify as types aka end of the format. + if (fmt[0] != '%') + return fmt; + const unsigned int ignored_uppercase_mask = (1 << ('I'-'A')) | (1 << ('L'-'A')); + const unsigned int ignored_lowercase_mask = (1 << ('h'-'a')) | (1 << ('j'-'a')) | (1 << ('l'-'a')) | (1 << ('t'-'a')) | (1 << ('w'-'a')) | (1 << ('z'-'a')); + for (char c; (c = *fmt) != 0; fmt++) + { + if (c >= 'A' && c <= 'Z' && ((1 << (c - 'A')) & ignored_uppercase_mask) == 0) + return fmt + 1; + if (c >= 'a' && c <= 'z' && ((1 << (c - 'a')) & ignored_lowercase_mask) == 0) + return fmt + 1; + } + return fmt; +} + +// Extract the format out of a format string with leading or trailing decorations +// fmt = "blah blah" -> return fmt +// fmt = "%.3f" -> return fmt +// fmt = "hello %.3f" -> return fmt + 6 +// fmt = "%.3f hello" -> return buf written with "%.3f" +const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, int buf_size) +{ + const char* fmt_start = ImParseFormatFindStart(fmt); + if (fmt_start[0] != '%') + return fmt; + const char* fmt_end = ImParseFormatFindEnd(fmt_start); + if (fmt_end[0] == 0) // If we only have leading decoration, we don't need to copy the data. + return fmt_start; + ImStrncpy(buf, fmt_start, ImMin((int)(fmt_end + 1 - fmt_start), buf_size)); + return buf; +} + +// Parse display precision back from the display format string +// FIXME: This is still used by some navigation code path to infer a minimum tweak step, but we should aim to rework widgets so it isn't needed. +int ImParseFormatPrecision(const char* fmt, int default_precision) +{ + fmt = ImParseFormatFindStart(fmt); + if (fmt[0] != '%') + return default_precision; + fmt++; + while (*fmt >= '0' && *fmt <= '9') + fmt++; + int precision = INT_MAX; + if (*fmt == '.') + { + fmt = ImAtoi(fmt + 1, &precision); + if (precision < 0 || precision > 99) + precision = default_precision; + } + if (*fmt == 'e' || *fmt == 'E') // Maximum precision with scientific notation + precision = -1; + if ((*fmt == 'g' || *fmt == 'G') && precision == INT_MAX) + precision = -1; + return (precision == INT_MAX) ? default_precision : precision; +} + +// Create text input in place of an active drag/slider (used when doing a CTRL+Click on drag/slider widgets) +// FIXME: Logic is awkward and confusing. This should be reworked to facilitate using in other situations. +bool ImGui::InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* data_ptr, const char* format) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + + // Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen) + // On the first frame, g.ScalarAsInputTextId == 0, then on subsequent frames it becomes == id + SetActiveID(g.ScalarAsInputTextId, window); + SetHoveredID(0); + g.ActiveIdAllowNavDirFlags = (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); + + char fmt_buf[32]; + char data_buf[32]; + format = ImParseFormatTrimDecorations(format, fmt_buf, IM_ARRAYSIZE(fmt_buf)); + DataTypeFormatString(data_buf, IM_ARRAYSIZE(data_buf), data_type, data_ptr, format); + ImStrTrimBlanks(data_buf); + ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ((data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) ? ImGuiInputTextFlags_CharsScientific : ImGuiInputTextFlags_CharsDecimal); + bool value_changed = InputTextEx(label, data_buf, IM_ARRAYSIZE(data_buf), bb.GetSize(), flags); + if (g.ScalarAsInputTextId == 0) // First frame we started displaying the InputText widget + { + IM_ASSERT(g.ActiveId == id); // InputText ID expected to match the Slider ID + g.ScalarAsInputTextId = g.ActiveId; + SetHoveredID(id); + } + if (value_changed) + return DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialText.Data, data_type, data_ptr, NULL); + return false; +} + +// NB: format here must be a simple "%xx" format string with no prefix/suffix (unlike the Drag/Slider functions "format" argument) +bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_ptr, const void* step, const void* step_fast, const char* format, ImGuiInputTextFlags extra_flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); + if (format == NULL) + format = GDataTypeInfo[data_type].PrintFmt; + + char buf[64]; + DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, data_ptr, format); + + bool value_changed = false; + if ((extra_flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0) + extra_flags |= ImGuiInputTextFlags_CharsDecimal; + extra_flags |= ImGuiInputTextFlags_AutoSelectAll; + + if (step != NULL) + { + const float button_size = GetFrameHeight(); + + BeginGroup(); // The only purpose of the group here is to allow the caller to query item data e.g. IsItemActive() + PushID(label); + PushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2)); + if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) // PushId(label) + "" gives us the expected ID from outside point of view + value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialText.Data, data_type, data_ptr, format); + PopItemWidth(); + + // Step buttons + SameLine(0, style.ItemInnerSpacing.x); + if (ButtonEx("-", ImVec2(button_size, button_size), ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups)) + { + DataTypeApplyOp(data_type, '-', data_ptr, data_ptr, g.IO.KeyCtrl && step_fast ? step_fast : step); + value_changed = true; + } + SameLine(0, style.ItemInnerSpacing.x); + if (ButtonEx("+", ImVec2(button_size, button_size), ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups)) + { + DataTypeApplyOp(data_type, '+', data_ptr, data_ptr, g.IO.KeyCtrl && step_fast ? step_fast : step); + value_changed = true; + } + SameLine(0, style.ItemInnerSpacing.x); + TextUnformatted(label, FindRenderedTextEnd(label)); + + PopID(); + EndGroup(); + } + else + { + if (InputText(label, buf, IM_ARRAYSIZE(buf), extra_flags)) + value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialText.Data, data_type, data_ptr, format); + } + + return value_changed; +} + +bool ImGui::InputScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* step, const void* step_fast, const char* format, ImGuiInputTextFlags extra_flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + bool value_changed = false; + BeginGroup(); + PushID(label); + PushMultiItemsWidths(components); + size_t type_size = GDataTypeInfo[data_type].Size; + for (int i = 0; i < components; i++) + { + PushID(i); + value_changed |= InputScalar("##v", data_type, v, step, step_fast, format, extra_flags); + SameLine(0, g.Style.ItemInnerSpacing.x); + PopID(); + PopItemWidth(); + v = (void*)((char*)v + type_size); + } + PopID(); + + TextUnformatted(label, FindRenderedTextEnd(label)); + EndGroup(); + return value_changed; +} + +bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, const char* format, ImGuiInputTextFlags extra_flags) +{ + extra_flags |= ImGuiInputTextFlags_CharsScientific; + return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), format, extra_flags); +} + +bool ImGui::InputFloat2(const char* label, float v[2], const char* format, ImGuiInputTextFlags extra_flags) +{ + return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, extra_flags); +} + +bool ImGui::InputFloat3(const char* label, float v[3], const char* format, ImGuiInputTextFlags extra_flags) +{ + return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, extra_flags); +} + +bool ImGui::InputFloat4(const char* label, float v[4], const char* format, ImGuiInputTextFlags extra_flags) +{ + return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, extra_flags); +} + +// Prefer using "const char* format" directly, which is more flexible and consistent with other API. +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags) +{ + char format[16] = "%f"; + if (decimal_precision >= 0) + ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision); + return InputFloat(label, v, step, step_fast, format, extra_flags); +} + +bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags) +{ + char format[16] = "%f"; + if (decimal_precision >= 0) + ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision); + return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, extra_flags); +} + +bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags) +{ + char format[16] = "%f"; + if (decimal_precision >= 0) + ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision); + return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, extra_flags); +} + +bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags) +{ + char format[16] = "%f"; + if (decimal_precision >= 0) + ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision); + return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, extra_flags); +} +#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS + +bool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags extra_flags) +{ + // Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes. + const char* format = (extra_flags & ImGuiInputTextFlags_CharsHexadecimal) ? "%08X" : "%d"; + return InputScalar(label, ImGuiDataType_S32, (void*)v, (void*)(step>0 ? &step : NULL), (void*)(step_fast>0 ? &step_fast : NULL), format, extra_flags); +} + +bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags) +{ + return InputScalarN(label, ImGuiDataType_S32, v, 2, NULL, NULL, "%d", extra_flags); +} + +bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags) +{ + return InputScalarN(label, ImGuiDataType_S32, v, 3, NULL, NULL, "%d", extra_flags); +} + +bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags) +{ + return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, "%d", extra_flags); +} + +bool ImGui::InputDouble(const char* label, double* v, double step, double step_fast, const char* format, ImGuiInputTextFlags extra_flags) +{ + extra_flags |= ImGuiInputTextFlags_CharsScientific; + return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step>0.0 ? &step : NULL), (void*)(step_fast>0.0 ? &step_fast : NULL), format, extra_flags); +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: InputText, InputTextMultiline +//------------------------------------------------------------------------- +// - InputText() +// - InputTextMultiline() +// - InputTextEx() [Internal] +//------------------------------------------------------------------------- + +bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) +{ + IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline() + return InputTextEx(label, buf, (int)buf_size, ImVec2(0,0), flags, callback, user_data); +} + +bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) +{ + return InputTextEx(label, buf, (int)buf_size, size, flags | ImGuiInputTextFlags_Multiline, callback, user_data); +} + +static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end) +{ + int line_count = 0; + const char* s = text_begin; + while (char c = *s++) // We are only matching for \n so we can ignore UTF-8 decoding + if (c == '\n') + line_count++; + s--; + if (s[0] != '\n' && s[0] != '\r') + line_count++; + *out_text_end = s; + return line_count; +} + +static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) +{ + ImFont* font = GImGui->Font; + const float line_height = GImGui->FontSize; + const float scale = line_height / font->FontSize; + + ImVec2 text_size = ImVec2(0,0); + float line_width = 0.0f; + + const ImWchar* s = text_begin; + while (s < text_end) + { + unsigned int c = (unsigned int)(*s++); + if (c == '\n') + { + text_size.x = ImMax(text_size.x, line_width); + text_size.y += line_height; + line_width = 0.0f; + if (stop_on_new_line) + break; + continue; + } + if (c == '\r') + continue; + + const float char_width = font->GetCharAdvance((ImWchar)c) * scale; + line_width += char_width; + } + + if (text_size.x < line_width) + text_size.x = line_width; + + if (out_offset) + *out_offset = ImVec2(line_width, text_size.y + line_height); // offset allow for the possibility of sitting after a trailing \n + + if (line_width > 0 || text_size.y == 0.0f) // whereas size.y will ignore the trailing \n + text_size.y += line_height; + + if (remaining) + *remaining = s; + + return text_size; +} + +// Wrapper for stb_textedit.h to edit text (our wrapper is for: statically sized buffer, single-line, wchar characters. InputText converts between UTF-8 and wchar) +namespace ImGuiStb +{ + +static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING* obj) { return obj->CurLenW; } +static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING* obj, int idx) { return obj->TextW[idx]; } +static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx+char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; return GImGui->Font->GetCharAdvance(c) * (GImGui->FontSize / GImGui->Font->FontSize); } +static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x10000 ? 0 : key; } +static ImWchar STB_TEXTEDIT_NEWLINE = '\n'; +static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* obj, int line_start_idx) +{ + const ImWchar* text = obj->TextW.Data; + const ImWchar* text_remaining = NULL; + const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true); + r->x0 = 0.0f; + r->x1 = size.x; + r->baseline_y_delta = size.y; + r->ymin = 0.0f; + r->ymax = size.y; + r->num_chars = (int)(text_remaining - (text + line_start_idx)); +} + +static bool is_separator(unsigned int c) { return ImCharIsBlankW(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; } +static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->TextW[idx-1] ) && !is_separator( obj->TextW[idx] ) ) : 1; } +static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } +#ifdef __APPLE__ // FIXME: Move setting to IO structure +static int is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator( obj->TextW[idx-1] ) && is_separator( obj->TextW[idx] ) ) : 1; } +static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } +#else +static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } +#endif +#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h +#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL + +static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n) +{ + ImWchar* dst = obj->TextW.Data + pos; + + // We maintain our buffer length in both UTF-8 and wchar formats + obj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n); + obj->CurLenW -= n; + + // Offset remaining text (FIXME-OPT: Use memmove) + const ImWchar* src = obj->TextW.Data + pos + n; + while (ImWchar c = *src++) + *dst++ = c; + *dst = '\0'; +} + +static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const ImWchar* new_text, int new_text_len) +{ + const bool is_resizable = (obj->UserFlags & ImGuiInputTextFlags_CallbackResize) != 0; + const int text_len = obj->CurLenW; + IM_ASSERT(pos <= text_len); + + const int new_text_len_utf8 = ImTextCountUtf8BytesFromStr(new_text, new_text + new_text_len); + if (!is_resizable && (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufCapacityA)) + return false; + + // Grow internal buffer if needed + if (new_text_len + text_len + 1 > obj->TextW.Size) + { + if (!is_resizable) + return false; + IM_ASSERT(text_len < obj->TextW.Size); + obj->TextW.resize(text_len + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1); + } + + ImWchar* text = obj->TextW.Data; + if (pos != text_len) + memmove(text + pos + new_text_len, text + pos, (size_t)(text_len - pos) * sizeof(ImWchar)); + memcpy(text + pos, new_text, (size_t)new_text_len * sizeof(ImWchar)); + + obj->CurLenW += new_text_len; + obj->CurLenA += new_text_len_utf8; + obj->TextW[obj->CurLenW] = '\0'; + + return true; +} + +// We don't use an enum so we can build even with conflicting symbols (if another user of stb_textedit.h leak their STB_TEXTEDIT_K_* symbols) +#define STB_TEXTEDIT_K_LEFT 0x10000 // keyboard input to move cursor left +#define STB_TEXTEDIT_K_RIGHT 0x10001 // keyboard input to move cursor right +#define STB_TEXTEDIT_K_UP 0x10002 // keyboard input to move cursor up +#define STB_TEXTEDIT_K_DOWN 0x10003 // keyboard input to move cursor down +#define STB_TEXTEDIT_K_LINESTART 0x10004 // keyboard input to move cursor to start of line +#define STB_TEXTEDIT_K_LINEEND 0x10005 // keyboard input to move cursor to end of line +#define STB_TEXTEDIT_K_TEXTSTART 0x10006 // keyboard input to move cursor to start of text +#define STB_TEXTEDIT_K_TEXTEND 0x10007 // keyboard input to move cursor to end of text +#define STB_TEXTEDIT_K_DELETE 0x10008 // keyboard input to delete selection or character under cursor +#define STB_TEXTEDIT_K_BACKSPACE 0x10009 // keyboard input to delete selection or character left of cursor +#define STB_TEXTEDIT_K_UNDO 0x1000A // keyboard input to perform undo +#define STB_TEXTEDIT_K_REDO 0x1000B // keyboard input to perform redo +#define STB_TEXTEDIT_K_WORDLEFT 0x1000C // keyboard input to move cursor left one word +#define STB_TEXTEDIT_K_WORDRIGHT 0x1000D // keyboard input to move cursor right one word +#define STB_TEXTEDIT_K_SHIFT 0x20000 + +#define STB_TEXTEDIT_IMPLEMENTATION +#include "imstb_textedit.h" + +} + +void ImGuiInputTextState::OnKeyPressed(int key) +{ + stb_textedit_key(this, &StbState, key); + CursorFollow = true; + CursorAnimReset(); +} + +ImGuiInputTextCallbackData::ImGuiInputTextCallbackData() +{ + memset(this, 0, sizeof(*this)); +} + +// Public API to manipulate UTF-8 text +// We expose UTF-8 to the user (unlike the STB_TEXTEDIT_* functions which are manipulating wchar) +// FIXME: The existence of this rarely exercised code path is a bit of a nuisance. +void ImGuiInputTextCallbackData::DeleteChars(int pos, int bytes_count) +{ + IM_ASSERT(pos + bytes_count <= BufTextLen); + char* dst = Buf + pos; + const char* src = Buf + pos + bytes_count; + while (char c = *src++) + *dst++ = c; + *dst = '\0'; + + if (CursorPos + bytes_count >= pos) + CursorPos -= bytes_count; + else if (CursorPos >= pos) + CursorPos = pos; + SelectionStart = SelectionEnd = CursorPos; + BufDirty = true; + BufTextLen -= bytes_count; +} + +void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, const char* new_text_end) +{ + const bool is_resizable = (Flags & ImGuiInputTextFlags_CallbackResize) != 0; + const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text); + if (new_text_len + BufTextLen >= BufSize) + { + if (!is_resizable) + return; + + // Contrary to STB_TEXTEDIT_INSERTCHARS() this is working in the UTF8 buffer, hence the midly similar code (until we remove the U16 buffer alltogether!) + ImGuiContext& g = *GImGui; + ImGuiInputTextState* edit_state = &g.InputTextState; + IM_ASSERT(edit_state->ID != 0 && g.ActiveId == edit_state->ID); + IM_ASSERT(Buf == edit_state->TempBuffer.Data); + int new_buf_size = BufTextLen + ImClamp(new_text_len * 4, 32, ImMax(256, new_text_len)) + 1; + edit_state->TempBuffer.reserve(new_buf_size + 1); + Buf = edit_state->TempBuffer.Data; + BufSize = edit_state->BufCapacityA = new_buf_size; + } + + if (BufTextLen != pos) + memmove(Buf + pos + new_text_len, Buf + pos, (size_t)(BufTextLen - pos)); + memcpy(Buf + pos, new_text, (size_t)new_text_len * sizeof(char)); + Buf[BufTextLen + new_text_len] = '\0'; + + if (CursorPos >= pos) + CursorPos += new_text_len; + SelectionStart = SelectionEnd = CursorPos; + BufDirty = true; + BufTextLen += new_text_len; +} + +// Return false to discard a character. +static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) +{ + unsigned int c = *p_char; + + if (c < 128 && c != ' ' && !isprint((int)(c & 0xFF))) + { + bool pass = false; + pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline)); + pass |= (c == '\t' && (flags & ImGuiInputTextFlags_AllowTabInput)); + if (!pass) + return false; + } + + if (c >= 0xE000 && c <= 0xF8FF) // Filter private Unicode range. I don't imagine anybody would want to input them. GLFW on OSX seems to send private characters for special keys like arrow keys. + return false; + + if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank | ImGuiInputTextFlags_CharsScientific)) + { + if (flags & ImGuiInputTextFlags_CharsDecimal) + if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/')) + return false; + + if (flags & ImGuiInputTextFlags_CharsScientific) + if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/') && (c != 'e') && (c != 'E')) + return false; + + if (flags & ImGuiInputTextFlags_CharsHexadecimal) + if (!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F')) + return false; + + if (flags & ImGuiInputTextFlags_CharsUppercase) + if (c >= 'a' && c <= 'z') + *p_char = (c += (unsigned int)('A'-'a')); + + if (flags & ImGuiInputTextFlags_CharsNoBlank) + if (ImCharIsBlankW(c)) + return false; + } + + if (flags & ImGuiInputTextFlags_CallbackCharFilter) + { + ImGuiInputTextCallbackData callback_data; + memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData)); + callback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter; + callback_data.EventChar = (ImWchar)c; + callback_data.Flags = flags; + callback_data.UserData = user_data; + if (callback(&callback_data) != 0) + return false; + *p_char = callback_data.EventChar; + if (!callback_data.EventChar) + return false; + } + + return true; +} + +// Edit a string of text +// - buf_size account for the zero-terminator, so a buf_size of 6 can hold "Hello" but not "Hello!". +// This is so we can easily call InputText() on static arrays using ARRAYSIZE() and to match +// Note that in std::string world, capacity() would omit 1 byte used by the zero-terminator. +// - When active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while the InputText is active has no effect. +// - If you want to use ImGui::InputText() with std::string, see misc/cpp/imgui_stdlib.h +// (FIXME: Rather messy function partly because we are doing UTF8 > u16 > UTF8 conversions on the go to more easily handle stb_textedit calls. Ideally we should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188) +bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* callback_user_data) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys) + IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key) + + ImGuiContext& g = *GImGui; + const ImGuiIO& io = g.IO; + const ImGuiStyle& style = g.Style; + + const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; + const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0; + const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0; + const bool is_undoable = (flags & ImGuiInputTextFlags_NoUndoRedo) == 0; + const bool is_resizable = (flags & ImGuiInputTextFlags_CallbackResize) != 0; + if (is_resizable) + IM_ASSERT(callback != NULL); // Must provide a callback if you set the ImGuiInputTextFlags_CallbackResize flag! + + if (is_multiline) // Open group before calling GetID() because groups tracks id created within their scope, + BeginGroup(); + const ImGuiID id = window->GetID(label); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); + const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f)); + + ImGuiWindow* draw_window = window; + if (is_multiline) + { + ItemAdd(total_bb, id, &frame_bb); + if (!BeginChildFrame(id, frame_bb.GetSize())) + { + EndChildFrame(); + EndGroup(); + return false; + } + draw_window = GetCurrentWindow(); + draw_window->DC.NavLayerActiveMaskNext |= draw_window->DC.NavLayerCurrentMask; // This is to ensure that EndChild() will display a navigation highlight + size.x -= draw_window->ScrollbarSizes.x; + } + else + { + ItemSize(total_bb, style.FramePadding.y); + if (!ItemAdd(total_bb, id, &frame_bb)) + return false; + } + const bool hovered = ItemHoverable(frame_bb, id); + if (hovered) + g.MouseCursor = ImGuiMouseCursor_TextInput; + + // Password pushes a temporary font with only a fallback glyph + if (is_password) + { + const ImFontGlyph* glyph = g.Font->FindGlyph('*'); + ImFont* password_font = &g.InputTextPasswordFont; + password_font->FontSize = g.Font->FontSize; + password_font->Scale = g.Font->Scale; + password_font->DisplayOffset = g.Font->DisplayOffset; + password_font->Ascent = g.Font->Ascent; + password_font->Descent = g.Font->Descent; + password_font->ContainerAtlas = g.Font->ContainerAtlas; + password_font->FallbackGlyph = glyph; + password_font->FallbackAdvanceX = glyph->AdvanceX; + IM_ASSERT(password_font->Glyphs.empty() && password_font->IndexAdvanceX.empty() && password_font->IndexLookup.empty()); + PushFont(password_font); + } + + // NB: we are only allowed to access 'edit_state' if we are the active widget. + ImGuiInputTextState& edit_state = g.InputTextState; + + const bool focus_requested = FocusableItemRegister(window, id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0); // Using completion callback disable keyboard tabbing + const bool focus_requested_by_code = focus_requested && (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent); + const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code; + + const bool user_clicked = hovered && io.MouseClicked[0]; + const bool user_scrolled = is_multiline && g.ActiveId == 0 && edit_state.ID == id && g.ActiveIdPreviousFrame == draw_window->GetIDNoKeepAlive("#SCROLLY"); + const bool user_nav_input_start = (g.ActiveId != id) && ((g.NavInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_NavKeyboard)); + + bool clear_active_id = false; + + bool select_all = (g.ActiveId != id) && ((flags & ImGuiInputTextFlags_AutoSelectAll) != 0 || user_nav_input_start) && (!is_multiline); + if (focus_requested || user_clicked || user_scrolled || user_nav_input_start) + { + if (g.ActiveId != id) + { + // Start edition + // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar) + // From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode) + const int prev_len_w = edit_state.CurLenW; + const int init_buf_len = (int)strlen(buf); + edit_state.TextW.resize(buf_size+1); // wchar count <= UTF-8 count. we use +1 to make sure that .Data isn't NULL so it doesn't crash. + edit_state.InitialText.resize(init_buf_len + 1); // UTF-8. we use +1 to make sure that .Data isn't NULL so it doesn't crash. + memcpy(edit_state.InitialText.Data, buf, init_buf_len + 1); + const char* buf_end = NULL; + edit_state.CurLenW = ImTextStrFromUtf8(edit_state.TextW.Data, buf_size, buf, NULL, &buf_end); + edit_state.CurLenA = (int)(buf_end - buf); // We can't get the result from ImStrncpy() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. + edit_state.CursorAnimReset(); + + // Preserve cursor position and undo/redo stack if we come back to same widget + // FIXME: We should probably compare the whole buffer to be on the safety side. Comparing buf (utf8) and edit_state.Text (wchar). + const bool recycle_state = (edit_state.ID == id) && (prev_len_w == edit_state.CurLenW); + if (recycle_state) + { + // Recycle existing cursor/selection/undo stack but clamp position + // Note a single mouse click will override the cursor/position immediately by calling stb_textedit_click handler. + edit_state.CursorClamp(); + } + else + { + edit_state.ID = id; + edit_state.ScrollX = 0.0f; + stb_textedit_initialize_state(&edit_state.StbState, !is_multiline); + if (!is_multiline && focus_requested_by_code) + select_all = true; + } + if (flags & ImGuiInputTextFlags_AlwaysInsertMode) + edit_state.StbState.insert_mode = true; + if (!is_multiline && (focus_requested_by_tab || (user_clicked && io.KeyCtrl))) + select_all = true; + } + SetActiveID(id, window); + SetFocusID(id, window); + FocusWindow(window); + if (!is_multiline && !(flags & ImGuiInputTextFlags_CallbackHistory)) + g.ActiveIdAllowNavDirFlags |= ((1 << ImGuiDir_Up) | (1 << ImGuiDir_Down)); + } + else if (io.MouseClicked[0]) + { + // Release focus when we click outside + clear_active_id = true; + } + + bool value_changed = false; + bool enter_pressed = false; + int backup_current_text_length = 0; + + if (g.ActiveId == id) + { + if (!is_editable && !g.ActiveIdIsJustActivated) + { + // When read-only we always use the live data passed to the function + edit_state.TextW.resize(buf_size+1); + const char* buf_end = NULL; + edit_state.CurLenW = ImTextStrFromUtf8(edit_state.TextW.Data, edit_state.TextW.Size, buf, NULL, &buf_end); + edit_state.CurLenA = (int)(buf_end - buf); + edit_state.CursorClamp(); + } + + backup_current_text_length = edit_state.CurLenA; + edit_state.BufCapacityA = buf_size; + edit_state.UserFlags = flags; + edit_state.UserCallback = callback; + edit_state.UserCallbackData = callback_user_data; + + // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget. + // Down the line we should have a cleaner library-wide concept of Selected vs Active. + g.ActiveIdAllowOverlap = !io.MouseDown[0]; + g.WantTextInputNextFrame = 1; + + // Edit in progress + const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX; + const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f)); + + const bool is_osx = io.ConfigMacOSXBehaviors; + if (select_all || (hovered && !is_osx && io.MouseDoubleClicked[0])) + { + edit_state.SelectAll(); + edit_state.SelectedAllMouseLock = true; + } + else if (hovered && is_osx && io.MouseDoubleClicked[0]) + { + // Double-click select a word only, OS X style (by simulating keystrokes) + edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT); + edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT); + } + else if (io.MouseClicked[0] && !edit_state.SelectedAllMouseLock) + { + if (hovered) + { + stb_textedit_click(&edit_state, &edit_state.StbState, mouse_x, mouse_y); + edit_state.CursorAnimReset(); + } + } + else if (io.MouseDown[0] && !edit_state.SelectedAllMouseLock && (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f)) + { + stb_textedit_drag(&edit_state, &edit_state.StbState, mouse_x, mouse_y); + edit_state.CursorAnimReset(); + edit_state.CursorFollow = true; + } + if (edit_state.SelectedAllMouseLock && !io.MouseDown[0]) + edit_state.SelectedAllMouseLock = false; + + if (io.InputCharacters[0]) + { + // Process text input (before we check for Return because using some IME will effectively send a Return?) + // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters. + bool ignore_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); + if (!ignore_inputs && is_editable && !user_nav_input_start) + for (int n = 0; n < IM_ARRAYSIZE(io.InputCharacters) && io.InputCharacters[n]; n++) + { + // Insert character if they pass filtering + unsigned int c = (unsigned int)io.InputCharacters[n]; + if (InputTextFilterCharacter(&c, flags, callback, callback_user_data)) + edit_state.OnKeyPressed((int)c); + } + + // Consume characters + memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); + } + } + + bool cancel_edit = false; + if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id) + { + // Handle key-presses + const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0); + const bool is_osx = io.ConfigMacOSXBehaviors; + const bool is_shortcut_key = (is_osx ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl + const bool is_osx_shift_shortcut = is_osx && io.KeySuper && io.KeyShift && !io.KeyCtrl && !io.KeyAlt; + const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl + const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End + const bool is_ctrl_key_only = io.KeyCtrl && !io.KeyShift && !io.KeyAlt && !io.KeySuper; + const bool is_shift_key_only = io.KeyShift && !io.KeyCtrl && !io.KeyAlt && !io.KeySuper; + + const bool is_cut = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && is_editable && !is_password && (!is_multiline || edit_state.HasSelection()); + const bool is_copy = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || edit_state.HasSelection()); + const bool is_paste = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && is_editable; + const bool is_undo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Z)) && is_editable && is_undoable); + const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && is_editable && is_undoable; + + if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetWindowScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_DownArrow) && is_multiline) { if (io.KeyCtrl) SetWindowScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_Home)) { edit_state.OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_End)) { edit_state.OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_Delete) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); } + else if (IsKeyPressedMap(ImGuiKey_Backspace) && is_editable) + { + if (!edit_state.HasSelection()) + { + if (is_wordmove_key_down) edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT|STB_TEXTEDIT_K_SHIFT); + else if (is_osx && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART|STB_TEXTEDIT_K_SHIFT); + } + edit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask); + } + else if (IsKeyPressedMap(ImGuiKey_Enter)) + { + bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0; + if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl)) + { + enter_pressed = clear_active_id = true; + } + else if (is_editable) + { + unsigned int c = '\n'; // Insert new line + if (InputTextFilterCharacter(&c, flags, callback, callback_user_data)) + edit_state.OnKeyPressed((int)c); + } + } + else if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressedMap(ImGuiKey_Tab) && !io.KeyCtrl && !io.KeyShift && !io.KeyAlt && is_editable) + { + unsigned int c = '\t'; // Insert TAB + if (InputTextFilterCharacter(&c, flags, callback, callback_user_data)) + edit_state.OnKeyPressed((int)c); + } + else if (IsKeyPressedMap(ImGuiKey_Escape)) + { + clear_active_id = cancel_edit = true; + } + else if (is_undo || is_redo) + { + edit_state.OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO); + edit_state.ClearSelection(); + } + else if (is_shortcut_key && IsKeyPressedMap(ImGuiKey_A)) + { + edit_state.SelectAll(); + edit_state.CursorFollow = true; + } + else if (is_cut || is_copy) + { + // Cut, Copy + if (io.SetClipboardTextFn) + { + const int ib = edit_state.HasSelection() ? ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end) : 0; + const int ie = edit_state.HasSelection() ? ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end) : edit_state.CurLenW; + edit_state.TempBuffer.resize((ie-ib) * 4 + 1); + ImTextStrToUtf8(edit_state.TempBuffer.Data, edit_state.TempBuffer.Size, edit_state.TextW.Data+ib, edit_state.TextW.Data+ie); + SetClipboardText(edit_state.TempBuffer.Data); + } + if (is_cut) + { + if (!edit_state.HasSelection()) + edit_state.SelectAll(); + edit_state.CursorFollow = true; + stb_textedit_cut(&edit_state, &edit_state.StbState); + } + } + else if (is_paste) + { + if (const char* clipboard = GetClipboardText()) + { + // Filter pasted buffer + const int clipboard_len = (int)strlen(clipboard); + ImWchar* clipboard_filtered = (ImWchar*)MemAlloc((clipboard_len+1) * sizeof(ImWchar)); + int clipboard_filtered_len = 0; + for (const char* s = clipboard; *s; ) + { + unsigned int c; + s += ImTextCharFromUtf8(&c, s, NULL); + if (c == 0) + break; + if (c >= 0x10000 || !InputTextFilterCharacter(&c, flags, callback, callback_user_data)) + continue; + clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c; + } + clipboard_filtered[clipboard_filtered_len] = 0; + if (clipboard_filtered_len > 0) // If everything was filtered, ignore the pasting operation + { + stb_textedit_paste(&edit_state, &edit_state.StbState, clipboard_filtered, clipboard_filtered_len); + edit_state.CursorFollow = true; + } + MemFree(clipboard_filtered); + } + } + } + + if (g.ActiveId == id) + { + const char* apply_new_text = NULL; + int apply_new_text_length = 0; + if (cancel_edit) + { + // Restore initial value. Only return true if restoring to the initial value changes the current buffer contents. + if (is_editable && strcmp(buf, edit_state.InitialText.Data) != 0) + { + apply_new_text = edit_state.InitialText.Data; + apply_new_text_length = edit_state.InitialText.Size - 1; + } + } + + // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame. + // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage. + bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0); + if (apply_edit_back_to_user_buffer) + { + // Apply new value immediately - copy modified buffer back + // Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer + // FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect. + // FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks. + if (is_editable) + { + edit_state.TempBuffer.resize(edit_state.TextW.Size * 4 + 1); + ImTextStrToUtf8(edit_state.TempBuffer.Data, edit_state.TempBuffer.Size, edit_state.TextW.Data, NULL); + } + + // User callback + if ((flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory | ImGuiInputTextFlags_CallbackAlways)) != 0) + { + IM_ASSERT(callback != NULL); + + // The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment. + ImGuiInputTextFlags event_flag = 0; + ImGuiKey event_key = ImGuiKey_COUNT; + if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(ImGuiKey_Tab)) + { + event_flag = ImGuiInputTextFlags_CallbackCompletion; + event_key = ImGuiKey_Tab; + } + else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_UpArrow)) + { + event_flag = ImGuiInputTextFlags_CallbackHistory; + event_key = ImGuiKey_UpArrow; + } + else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_DownArrow)) + { + event_flag = ImGuiInputTextFlags_CallbackHistory; + event_key = ImGuiKey_DownArrow; + } + else if (flags & ImGuiInputTextFlags_CallbackAlways) + event_flag = ImGuiInputTextFlags_CallbackAlways; + + if (event_flag) + { + ImGuiInputTextCallbackData callback_data; + memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData)); + callback_data.EventFlag = event_flag; + callback_data.Flags = flags; + callback_data.UserData = callback_user_data; + + callback_data.EventKey = event_key; + callback_data.Buf = edit_state.TempBuffer.Data; + callback_data.BufTextLen = edit_state.CurLenA; + callback_data.BufSize = edit_state.BufCapacityA; + callback_data.BufDirty = false; + + // We have to convert from wchar-positions to UTF-8-positions, which can be pretty slow (an incentive to ditch the ImWchar buffer, see https://github.com/nothings/stb/issues/188) + ImWchar* text = edit_state.TextW.Data; + const int utf8_cursor_pos = callback_data.CursorPos = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.cursor); + const int utf8_selection_start = callback_data.SelectionStart = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.select_start); + const int utf8_selection_end = callback_data.SelectionEnd = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.select_end); + + // Call user code + callback(&callback_data); + + // Read back what user may have modified + IM_ASSERT(callback_data.Buf == edit_state.TempBuffer.Data); // Invalid to modify those fields + IM_ASSERT(callback_data.BufSize == edit_state.BufCapacityA); + IM_ASSERT(callback_data.Flags == flags); + if (callback_data.CursorPos != utf8_cursor_pos) { edit_state.StbState.cursor = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.CursorPos); edit_state.CursorFollow = true; } + if (callback_data.SelectionStart != utf8_selection_start) { edit_state.StbState.select_start = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionStart); } + if (callback_data.SelectionEnd != utf8_selection_end) { edit_state.StbState.select_end = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); } + if (callback_data.BufDirty) + { + IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text! + if (callback_data.BufTextLen > backup_current_text_length && is_resizable) + edit_state.TextW.resize(edit_state.TextW.Size + (callback_data.BufTextLen - backup_current_text_length)); + edit_state.CurLenW = ImTextStrFromUtf8(edit_state.TextW.Data, edit_state.TextW.Size, callback_data.Buf, NULL); + edit_state.CurLenA = callback_data.BufTextLen; // Assume correct length and valid UTF-8 from user, saves us an extra strlen() + edit_state.CursorAnimReset(); + } + } + } + + // Will copy result string if modified + if (is_editable && strcmp(edit_state.TempBuffer.Data, buf) != 0) + { + apply_new_text = edit_state.TempBuffer.Data; + apply_new_text_length = edit_state.CurLenA; + } + } + + // Copy result to user buffer + if (apply_new_text) + { + IM_ASSERT(apply_new_text_length >= 0); + if (backup_current_text_length != apply_new_text_length && is_resizable) + { + ImGuiInputTextCallbackData callback_data; + callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize; + callback_data.Flags = flags; + callback_data.Buf = buf; + callback_data.BufTextLen = apply_new_text_length; + callback_data.BufSize = ImMax(buf_size, apply_new_text_length + 1); + callback_data.UserData = callback_user_data; + callback(&callback_data); + buf = callback_data.Buf; + buf_size = callback_data.BufSize; + apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1); + IM_ASSERT(apply_new_text_length <= buf_size); + } + + // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size. + ImStrncpy(buf, edit_state.TempBuffer.Data, ImMin(apply_new_text_length + 1, buf_size)); + value_changed = true; + } + + // Clear temporary user storage + edit_state.UserFlags = 0; + edit_state.UserCallback = NULL; + edit_state.UserCallbackData = NULL; + } + + // Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value) + if (clear_active_id && g.ActiveId == id) + ClearActiveID(); + + // Render + // Select which buffer we are going to display. When ImGuiInputTextFlags_NoLiveEdit is set 'buf' might still be the old value. We set buf to NULL to prevent accidental usage from now on. + const char* buf_display = (g.ActiveId == id && is_editable) ? edit_state.TempBuffer.Data : buf; buf = NULL; + + // Set upper limit of single-line InputTextEx() at 2 million characters strings. The current pathological worst case is a long line + // without any carriage return, which would makes ImFont::RenderText() reserve too many vertices and probably crash. Avoid it altogether. + // Note that we only use this limit on single-line InputText(), so a pathologically large line on a InputTextMultiline() would still crash. + const int buf_display_max_length = 2 * 1024 * 1024; + + if (!is_multiline) + { + RenderNavHighlight(frame_bb, id); + RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); + } + + const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size + ImVec2 render_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding; + ImVec2 text_size(0.f, 0.f); + const bool is_currently_scrolling = (edit_state.ID == id && is_multiline && g.ActiveId == draw_window->GetIDNoKeepAlive("#SCROLLY")); + if (g.ActiveId == id || is_currently_scrolling) + { + edit_state.CursorAnim += io.DeltaTime; + + // This is going to be messy. We need to: + // - Display the text (this alone can be more easily clipped) + // - Handle scrolling, highlight selection, display cursor (those all requires some form of 1d->2d cursor position calculation) + // - Measure text height (for scrollbar) + // We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort) + // FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8. + const ImWchar* text_begin = edit_state.TextW.Data; + ImVec2 cursor_offset, select_start_offset; + + { + // Count lines + find lines numbers straddling 'cursor' and 'select_start' position. + const ImWchar* searches_input_ptr[2]; + searches_input_ptr[0] = text_begin + edit_state.StbState.cursor; + searches_input_ptr[1] = NULL; + int searches_remaining = 1; + int searches_result_line_number[2] = { -1, -999 }; + if (edit_state.StbState.select_start != edit_state.StbState.select_end) + { + searches_input_ptr[1] = text_begin + ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end); + searches_result_line_number[1] = -1; + searches_remaining++; + } + + // Iterate all lines to find our line numbers + // In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter. + searches_remaining += is_multiline ? 1 : 0; + int line_count = 0; + //for (const ImWchar* s = text_begin; (s = (const ImWchar*)wcschr((const wchar_t*)s, (wchar_t)'\n')) != NULL; s++) // FIXME-OPT: Could use this when wchar_t are 16-bits + for (const ImWchar* s = text_begin; *s != 0; s++) + if (*s == '\n') + { + line_count++; + if (searches_result_line_number[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count; if (--searches_remaining <= 0) break; } + if (searches_result_line_number[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count; if (--searches_remaining <= 0) break; } + } + line_count++; + if (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count; + if (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count; + + // Calculate 2d position by finding the beginning of the line and measuring distance + cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x; + cursor_offset.y = searches_result_line_number[0] * g.FontSize; + if (searches_result_line_number[1] >= 0) + { + select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x; + select_start_offset.y = searches_result_line_number[1] * g.FontSize; + } + + // Store text height (note that we haven't calculated text width at all, see GitHub issues #383, #1224) + if (is_multiline) + text_size = ImVec2(size.x, line_count * g.FontSize); + } + + // Scroll + if (edit_state.CursorFollow) + { + // Horizontal scroll in chunks of quarter width + if (!(flags & ImGuiInputTextFlags_NoHorizontalScroll)) + { + const float scroll_increment_x = size.x * 0.25f; + if (cursor_offset.x < edit_state.ScrollX) + edit_state.ScrollX = (float)(int)ImMax(0.0f, cursor_offset.x - scroll_increment_x); + else if (cursor_offset.x - size.x >= edit_state.ScrollX) + edit_state.ScrollX = (float)(int)(cursor_offset.x - size.x + scroll_increment_x); + } + else + { + edit_state.ScrollX = 0.0f; + } + + // Vertical scroll + if (is_multiline) + { + float scroll_y = draw_window->Scroll.y; + if (cursor_offset.y - g.FontSize < scroll_y) + scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize); + else if (cursor_offset.y - size.y >= scroll_y) + scroll_y = cursor_offset.y - size.y; + draw_window->DC.CursorPos.y += (draw_window->Scroll.y - scroll_y); // To avoid a frame of lag + draw_window->Scroll.y = scroll_y; + render_pos.y = draw_window->DC.CursorPos.y; + } + } + edit_state.CursorFollow = false; + const ImVec2 render_scroll = ImVec2(edit_state.ScrollX, 0.0f); + + // Draw selection + if (edit_state.StbState.select_start != edit_state.StbState.select_end) + { + const ImWchar* text_selected_begin = text_begin + ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end); + const ImWchar* text_selected_end = text_begin + ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end); + + float bg_offy_up = is_multiline ? 0.0f : -1.0f; // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection. + float bg_offy_dn = is_multiline ? 0.0f : 2.0f; + ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg); + ImVec2 rect_pos = render_pos + select_start_offset - render_scroll; + for (const ImWchar* p = text_selected_begin; p < text_selected_end; ) + { + if (rect_pos.y > clip_rect.w + g.FontSize) + break; + if (rect_pos.y < clip_rect.y) + { + //p = (const ImWchar*)wmemchr((const wchar_t*)p, '\n', text_selected_end - p); // FIXME-OPT: Could use this when wchar_t are 16-bits + //p = p ? p + 1 : text_selected_end; + while (p < text_selected_end) + if (*p++ == '\n') + break; + } + else + { + ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); + if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines + ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn)); + rect.ClipWith(clip_rect); + if (rect.Overlaps(clip_rect)) + draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color); + } + rect_pos.x = render_pos.x - render_scroll.x; + rect_pos.y += g.FontSize; + } + } + + const int buf_display_len = edit_state.CurLenA; + if (is_multiline || buf_display_len < buf_display_max_length) + draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + buf_display_len, 0.0f, is_multiline ? NULL : &clip_rect); + + // Draw blinking cursor + bool cursor_is_visible = (!g.IO.ConfigInputTextCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || ImFmod(g.InputTextState.CursorAnim, 1.20f) <= 0.80f; + ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll; + ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f); + if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect)) + draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text)); + + // Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.) + if (is_editable) + g.PlatformImePos = ImVec2(cursor_screen_pos.x - 1, cursor_screen_pos.y - g.FontSize); + } + else + { + // Render text only + const char* buf_end = NULL; + if (is_multiline) + text_size = ImVec2(size.x, InputTextCalcTextLenAndLineCount(buf_display, &buf_end) * g.FontSize); // We don't need width + else + buf_end = buf_display + strlen(buf_display); + if (is_multiline || (buf_end - buf_display) < buf_display_max_length) + draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos, GetColorU32(ImGuiCol_Text), buf_display, buf_end, 0.0f, is_multiline ? NULL : &clip_rect); + } + + if (is_multiline) + { + Dummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line + EndChildFrame(); + EndGroup(); + } + + if (is_password) + PopFont(); + + // Log as text + if (g.LogEnabled && !is_password) + LogRenderedText(&render_pos, buf_display, NULL); + + if (label_size.x > 0) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); + + if (value_changed) + MarkItemEdited(id); + + if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0) + return enter_pressed; + else + return value_changed; +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc. +//------------------------------------------------------------------------- +// - ColorEdit3() +// - ColorEdit4() +// - ColorPicker3() +// - RenderColorRectWithAlphaCheckerboard() [Internal] +// - ColorPicker4() +// - ColorButton() +// - SetColorEditOptions() +// - ColorTooltip() [Internal] +// - ColorEditOptionsPopup() [Internal] +// - ColorPickerOptionsPopup() [Internal] +//------------------------------------------------------------------------- + +bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags) +{ + return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha); +} + +// Edit colors components (each component in 0.0f..1.0f range). +// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. +// With typical options: Left-click on colored square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item. +bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const float square_sz = GetFrameHeight(); + const float w_extra = (flags & ImGuiColorEditFlags_NoSmallPreview) ? 0.0f : (square_sz + style.ItemInnerSpacing.x); + const float w_items_all = CalcItemWidth() - w_extra; + const char* label_display_end = FindRenderedTextEnd(label); + + BeginGroup(); + PushID(label); + + // If we're not showing any slider there's no point in doing any HSV conversions + const ImGuiColorEditFlags flags_untouched = flags; + if (flags & ImGuiColorEditFlags_NoInputs) + flags = (flags & (~ImGuiColorEditFlags__InputsMask)) | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_NoOptions; + + // Context menu: display and modify options (before defaults are applied) + if (!(flags & ImGuiColorEditFlags_NoOptions)) + ColorEditOptionsPopup(col, flags); + + // Read stored options + if (!(flags & ImGuiColorEditFlags__InputsMask)) + flags |= (g.ColorEditOptions & ImGuiColorEditFlags__InputsMask); + if (!(flags & ImGuiColorEditFlags__DataTypeMask)) + flags |= (g.ColorEditOptions & ImGuiColorEditFlags__DataTypeMask); + if (!(flags & ImGuiColorEditFlags__PickerMask)) + flags |= (g.ColorEditOptions & ImGuiColorEditFlags__PickerMask); + flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask)); + + const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0; + const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0; + const int components = alpha ? 4 : 3; + + // Convert to the formats we need + float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f }; + if (flags & ImGuiColorEditFlags_HSV) + ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); + int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) }; + + bool value_changed = false; + bool value_changed_as_float = false; + + if ((flags & (ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) + { + // RGB/HSV 0..255 Sliders + const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components-1)) / (float)components)); + const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.ItemInnerSpacing.x) * (components-1))); + + const bool hide_prefix = (w_item_one <= CalcTextSize((flags & ImGuiColorEditFlags_Float) ? "M:0.000" : "M:000").x); + const char* ids[4] = { "##X", "##Y", "##Z", "##W" }; + const char* fmt_table_int[3][4] = + { + { "%3d", "%3d", "%3d", "%3d" }, // Short display + { "R:%3d", "G:%3d", "B:%3d", "A:%3d" }, // Long display for RGBA + { "H:%3d", "S:%3d", "V:%3d", "A:%3d" } // Long display for HSVA + }; + const char* fmt_table_float[3][4] = + { + { "%0.3f", "%0.3f", "%0.3f", "%0.3f" }, // Short display + { "R:%0.3f", "G:%0.3f", "B:%0.3f", "A:%0.3f" }, // Long display for RGBA + { "H:%0.3f", "S:%0.3f", "V:%0.3f", "A:%0.3f" } // Long display for HSVA + }; + const int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_HSV) ? 2 : 1; + + PushItemWidth(w_item_one); + for (int n = 0; n < components; n++) + { + if (n > 0) + SameLine(0, style.ItemInnerSpacing.x); + if (n + 1 == components) + PushItemWidth(w_item_last); + if (flags & ImGuiColorEditFlags_Float) + value_changed = value_changed_as_float = value_changed | DragFloat(ids[n], &f[n], 1.0f/255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]); + else + value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]); + if (!(flags & ImGuiColorEditFlags_NoOptions)) + OpenPopupOnItemClick("context"); + } + PopItemWidth(); + PopItemWidth(); + } + else if ((flags & ImGuiColorEditFlags_HEX) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) + { + // RGB Hexadecimal Input + char buf[64]; + if (alpha) + ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255), ImClamp(i[3],0,255)); + else + ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255)); + PushItemWidth(w_items_all); + if (InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase)) + { + value_changed = true; + char* p = buf; + while (*p == '#' || ImCharIsBlankA(*p)) + p++; + i[0] = i[1] = i[2] = i[3] = 0; + if (alpha) + sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned) + else + sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]); + } + if (!(flags & ImGuiColorEditFlags_NoOptions)) + OpenPopupOnItemClick("context"); + PopItemWidth(); + } + + ImGuiWindow* picker_active_window = NULL; + if (!(flags & ImGuiColorEditFlags_NoSmallPreview)) + { + if (!(flags & ImGuiColorEditFlags_NoInputs)) + SameLine(0, style.ItemInnerSpacing.x); + + const ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f); + if (ColorButton("##ColorButton", col_v4, flags)) + { + if (!(flags & ImGuiColorEditFlags_NoPicker)) + { + // Store current color and open a picker + g.ColorPickerRef = col_v4; + OpenPopup("picker"); + SetNextWindowPos(window->DC.LastItemRect.GetBL() + ImVec2(-1,style.ItemSpacing.y)); + } + } + if (!(flags & ImGuiColorEditFlags_NoOptions)) + OpenPopupOnItemClick("context"); + + if (BeginPopup("picker")) + { + picker_active_window = g.CurrentWindow; + if (label != label_display_end) + { + TextUnformatted(label, label_display_end); + Spacing(); + } + ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar; + ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf; + PushItemWidth(square_sz * 12.0f); // Use 256 + bar sizes? + value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x); + PopItemWidth(); + EndPopup(); + } + } + + if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel)) + { + SameLine(0, style.ItemInnerSpacing.x); + TextUnformatted(label, label_display_end); + } + + // Convert back + if (picker_active_window == NULL) + { + if (!value_changed_as_float) + for (int n = 0; n < 4; n++) + f[n] = i[n] / 255.0f; + if (flags & ImGuiColorEditFlags_HSV) + ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]); + if (value_changed) + { + col[0] = f[0]; + col[1] = f[1]; + col[2] = f[2]; + if (alpha) + col[3] = f[3]; + } + } + + PopID(); + EndGroup(); + + // Drag and Drop Target + // NB: The flag test is merely an optional micro-optimization, BeginDragDropTarget() does the same test. + if ((window->DC.LastItemStatusFlags & ImGuiItemStatusFlags_HoveredRect) && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropTarget()) + { + if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F)) + { + memcpy((float*)col, payload->Data, sizeof(float) * 3); + value_changed = true; + } + if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F)) + { + memcpy((float*)col, payload->Data, sizeof(float) * components); + value_changed = true; + } + EndDragDropTarget(); + } + + // When picker is being actively used, use its active id so IsItemActive() will function on ColorEdit4(). + if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window) + window->DC.LastItemId = g.ActiveId; + + if (value_changed) + MarkItemEdited(window->DC.LastItemId); + + return value_changed; +} + +bool ImGui::ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags) +{ + float col4[4] = { col[0], col[1], col[2], 1.0f }; + if (!ColorPicker4(label, col4, flags | ImGuiColorEditFlags_NoAlpha)) + return false; + col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2]; + return true; +} + +static inline ImU32 ImAlphaBlendColor(ImU32 col_a, ImU32 col_b) +{ + float t = ((col_b >> IM_COL32_A_SHIFT) & 0xFF) / 255.f; + int r = ImLerp((int)(col_a >> IM_COL32_R_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_R_SHIFT) & 0xFF, t); + int g = ImLerp((int)(col_a >> IM_COL32_G_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_G_SHIFT) & 0xFF, t); + int b = ImLerp((int)(col_a >> IM_COL32_B_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_B_SHIFT) & 0xFF, t); + return IM_COL32(r, g, b, 0xFF); +} + +// Helper for ColorPicker4() +// NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that. +// I spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding alltogether. +void ImGui::RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 col, float grid_step, ImVec2 grid_off, float rounding, int rounding_corners_flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (((col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT) < 0xFF) + { + ImU32 col_bg1 = GetColorU32(ImAlphaBlendColor(IM_COL32(204,204,204,255), col)); + ImU32 col_bg2 = GetColorU32(ImAlphaBlendColor(IM_COL32(128,128,128,255), col)); + window->DrawList->AddRectFilled(p_min, p_max, col_bg1, rounding, rounding_corners_flags); + + int yi = 0; + for (float y = p_min.y + grid_off.y; y < p_max.y; y += grid_step, yi++) + { + float y1 = ImClamp(y, p_min.y, p_max.y), y2 = ImMin(y + grid_step, p_max.y); + if (y2 <= y1) + continue; + for (float x = p_min.x + grid_off.x + (yi & 1) * grid_step; x < p_max.x; x += grid_step * 2.0f) + { + float x1 = ImClamp(x, p_min.x, p_max.x), x2 = ImMin(x + grid_step, p_max.x); + if (x2 <= x1) + continue; + int rounding_corners_flags_cell = 0; + if (y1 <= p_min.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopRight; } + if (y2 >= p_max.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotRight; } + rounding_corners_flags_cell &= rounding_corners_flags; + window->DrawList->AddRectFilled(ImVec2(x1,y1), ImVec2(x2,y2), col_bg2, rounding_corners_flags_cell ? rounding : 0.0f, rounding_corners_flags_cell); + } + } + } + else + { + window->DrawList->AddRectFilled(p_min, p_max, col, rounding, rounding_corners_flags); + } +} + +// Helper for ColorPicker4() +static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w) +{ + ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32_BLACK); + ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir_Right, IM_COL32_WHITE); + ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32_BLACK); + ImGui::RenderArrowPointingAt(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir_Left, IM_COL32_WHITE); +} + +// Note: ColorPicker4() only accesses 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. +// FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..) +bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags, const float* ref_col) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = GetCurrentWindow(); + ImDrawList* draw_list = window->DrawList; + + ImGuiStyle& style = g.Style; + ImGuiIO& io = g.IO; + + PushID(label); + BeginGroup(); + + if (!(flags & ImGuiColorEditFlags_NoSidePreview)) + flags |= ImGuiColorEditFlags_NoSmallPreview; + + // Context menu: display and store options. + if (!(flags & ImGuiColorEditFlags_NoOptions)) + ColorPickerOptionsPopup(col, flags); + + // Read stored options + if (!(flags & ImGuiColorEditFlags__PickerMask)) + flags |= ((g.ColorEditOptions & ImGuiColorEditFlags__PickerMask) ? g.ColorEditOptions : ImGuiColorEditFlags__OptionsDefault) & ImGuiColorEditFlags__PickerMask; + IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask))); // Check that only 1 is selected + if (!(flags & ImGuiColorEditFlags_NoOptions)) + flags |= (g.ColorEditOptions & ImGuiColorEditFlags_AlphaBar); + + // Setup + int components = (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4; + bool alpha_bar = (flags & ImGuiColorEditFlags_AlphaBar) && !(flags & ImGuiColorEditFlags_NoAlpha); + ImVec2 picker_pos = window->DC.CursorPos; + float square_sz = GetFrameHeight(); + float bars_width = square_sz; // Arbitrary smallish width of Hue/Alpha picking bars + float sv_picker_size = ImMax(bars_width * 1, CalcItemWidth() - (alpha_bar ? 2 : 1) * (bars_width + style.ItemInnerSpacing.x)); // Saturation/Value picking box + float bar0_pos_x = picker_pos.x + sv_picker_size + style.ItemInnerSpacing.x; + float bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x; + float bars_triangles_half_sz = (float)(int)(bars_width * 0.20f); + + float backup_initial_col[4]; + memcpy(backup_initial_col, col, components * sizeof(float)); + + float wheel_thickness = sv_picker_size * 0.08f; + float wheel_r_outer = sv_picker_size * 0.50f; + float wheel_r_inner = wheel_r_outer - wheel_thickness; + ImVec2 wheel_center(picker_pos.x + (sv_picker_size + bars_width)*0.5f, picker_pos.y + sv_picker_size*0.5f); + + // Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic. + float triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027f); + ImVec2 triangle_pa = ImVec2(triangle_r, 0.0f); // Hue point. + ImVec2 triangle_pb = ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f); // Black point. + ImVec2 triangle_pc = ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f); // White point. + + float H,S,V; + ColorConvertRGBtoHSV(col[0], col[1], col[2], H, S, V); + + bool value_changed = false, value_changed_h = false, value_changed_sv = false; + + PushItemFlag(ImGuiItemFlags_NoNav, true); + if (flags & ImGuiColorEditFlags_PickerHueWheel) + { + // Hue wheel + SV triangle logic + InvisibleButton("hsv", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size)); + if (IsItemActive()) + { + ImVec2 initial_off = g.IO.MouseClickedPos[0] - wheel_center; + ImVec2 current_off = g.IO.MousePos - wheel_center; + float initial_dist2 = ImLengthSqr(initial_off); + if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1)) + { + // Interactive with Hue wheel + H = ImAtan2(current_off.y, current_off.x) / IM_PI*0.5f; + if (H < 0.0f) + H += 1.0f; + value_changed = value_changed_h = true; + } + float cos_hue_angle = ImCos(-H * 2.0f * IM_PI); + float sin_hue_angle = ImSin(-H * 2.0f * IM_PI); + if (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle))) + { + // Interacting with SV triangle + ImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle); + if (!ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated)) + current_off_unrotated = ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated); + float uu, vv, ww; + ImTriangleBarycentricCoords(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated, uu, vv, ww); + V = ImClamp(1.0f - vv, 0.0001f, 1.0f); + S = ImClamp(uu / V, 0.0001f, 1.0f); + value_changed = value_changed_sv = true; + } + } + if (!(flags & ImGuiColorEditFlags_NoOptions)) + OpenPopupOnItemClick("context"); + } + else if (flags & ImGuiColorEditFlags_PickerHueBar) + { + // SV rectangle logic + InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size)); + if (IsItemActive()) + { + S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size-1)); + V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size-1)); + value_changed = value_changed_sv = true; + } + if (!(flags & ImGuiColorEditFlags_NoOptions)) + OpenPopupOnItemClick("context"); + + // Hue bar logic + SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y)); + InvisibleButton("hue", ImVec2(bars_width, sv_picker_size)); + if (IsItemActive()) + { + H = ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size-1)); + value_changed = value_changed_h = true; + } + } + + // Alpha bar logic + if (alpha_bar) + { + SetCursorScreenPos(ImVec2(bar1_pos_x, picker_pos.y)); + InvisibleButton("alpha", ImVec2(bars_width, sv_picker_size)); + if (IsItemActive()) + { + col[3] = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size-1)); + value_changed = true; + } + } + PopItemFlag(); // ImGuiItemFlags_NoNav + + if (!(flags & ImGuiColorEditFlags_NoSidePreview)) + { + SameLine(0, style.ItemInnerSpacing.x); + BeginGroup(); + } + + if (!(flags & ImGuiColorEditFlags_NoLabel)) + { + const char* label_display_end = FindRenderedTextEnd(label); + if (label != label_display_end) + { + if ((flags & ImGuiColorEditFlags_NoSidePreview)) + SameLine(0, style.ItemInnerSpacing.x); + TextUnformatted(label, label_display_end); + } + } + + if (!(flags & ImGuiColorEditFlags_NoSidePreview)) + { + PushItemFlag(ImGuiItemFlags_NoNavDefaultFocus, true); + ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]); + if ((flags & ImGuiColorEditFlags_NoLabel)) + Text("Current"); + ColorButton("##current", col_v4, (flags & (ImGuiColorEditFlags_HDR|ImGuiColorEditFlags_AlphaPreview|ImGuiColorEditFlags_AlphaPreviewHalf|ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2)); + if (ref_col != NULL) + { + Text("Original"); + ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]); + if (ColorButton("##original", ref_col_v4, (flags & (ImGuiColorEditFlags_HDR|ImGuiColorEditFlags_AlphaPreview|ImGuiColorEditFlags_AlphaPreviewHalf|ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2))) + { + memcpy(col, ref_col, components * sizeof(float)); + value_changed = true; + } + } + PopItemFlag(); + EndGroup(); + } + + // Convert back color to RGB + if (value_changed_h || value_changed_sv) + ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]); + + // R,G,B and H,S,V slider color editor + bool value_changed_fix_hue_wrap = false; + if ((flags & ImGuiColorEditFlags_NoInputs) == 0) + { + PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x); + ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoSmallPreview | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf; + ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker; + if (flags & ImGuiColorEditFlags_RGB || (flags & ImGuiColorEditFlags__InputsMask) == 0) + if (ColorEdit4("##rgb", col, sub_flags | ImGuiColorEditFlags_RGB)) + { + // FIXME: Hackily differenciating using the DragInt (ActiveId != 0 && !ActiveIdAllowOverlap) vs. using the InputText or DropTarget. + // For the later we don't want to run the hue-wrap canceling code. If you are well versed in HSV picker please provide your input! (See #2050) + value_changed_fix_hue_wrap = (g.ActiveId != 0 && !g.ActiveIdAllowOverlap); + value_changed = true; + } + if (flags & ImGuiColorEditFlags_HSV || (flags & ImGuiColorEditFlags__InputsMask) == 0) + value_changed |= ColorEdit4("##hsv", col, sub_flags | ImGuiColorEditFlags_HSV); + if (flags & ImGuiColorEditFlags_HEX || (flags & ImGuiColorEditFlags__InputsMask) == 0) + value_changed |= ColorEdit4("##hex", col, sub_flags | ImGuiColorEditFlags_HEX); + PopItemWidth(); + } + + // Try to cancel hue wrap (after ColorEdit4 call), if any + if (value_changed_fix_hue_wrap) + { + float new_H, new_S, new_V; + ColorConvertRGBtoHSV(col[0], col[1], col[2], new_H, new_S, new_V); + if (new_H <= 0 && H > 0) + { + if (new_V <= 0 && V != new_V) + ColorConvertHSVtoRGB(H, S, new_V <= 0 ? V * 0.5f : new_V, col[0], col[1], col[2]); + else if (new_S <= 0) + ColorConvertHSVtoRGB(H, new_S <= 0 ? S * 0.5f : new_S, new_V, col[0], col[1], col[2]); + } + } + + ImVec4 hue_color_f(1, 1, 1, 1); ColorConvertHSVtoRGB(H, 1, 1, hue_color_f.x, hue_color_f.y, hue_color_f.z); + ImU32 hue_color32 = ColorConvertFloat4ToU32(hue_color_f); + ImU32 col32_no_alpha = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 1.0f)); + + const ImU32 hue_colors[6+1] = { IM_COL32(255,0,0,255), IM_COL32(255,255,0,255), IM_COL32(0,255,0,255), IM_COL32(0,255,255,255), IM_COL32(0,0,255,255), IM_COL32(255,0,255,255), IM_COL32(255,0,0,255) }; + ImVec2 sv_cursor_pos; + + if (flags & ImGuiColorEditFlags_PickerHueWheel) + { + // Render Hue Wheel + const float aeps = 1.5f / wheel_r_outer; // Half a pixel arc length in radians (2pi cancels out). + const int segment_per_arc = ImMax(4, (int)wheel_r_outer / 12); + for (int n = 0; n < 6; n++) + { + const float a0 = (n) /6.0f * 2.0f * IM_PI - aeps; + const float a1 = (n+1.0f)/6.0f * 2.0f * IM_PI + aeps; + const int vert_start_idx = draw_list->VtxBuffer.Size; + draw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc); + draw_list->PathStroke(IM_COL32_WHITE, false, wheel_thickness); + const int vert_end_idx = draw_list->VtxBuffer.Size; + + // Paint colors over existing vertices + ImVec2 gradient_p0(wheel_center.x + ImCos(a0) * wheel_r_inner, wheel_center.y + ImSin(a0) * wheel_r_inner); + ImVec2 gradient_p1(wheel_center.x + ImCos(a1) * wheel_r_inner, wheel_center.y + ImSin(a1) * wheel_r_inner); + ShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, vert_end_idx, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]); + } + + // Render Cursor + preview on Hue Wheel + float cos_hue_angle = ImCos(H * 2.0f * IM_PI); + float sin_hue_angle = ImSin(H * 2.0f * IM_PI); + ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f); + float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f; + int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32); + draw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments); + draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad+1, IM_COL32(128,128,128,255), hue_cursor_segments); + draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, IM_COL32_WHITE, hue_cursor_segments); + + // Render SV triangle (rotated according to hue) + ImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle); + ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle); + ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle); + ImVec2 uv_white = GetFontTexUvWhitePixel(); + draw_list->PrimReserve(6, 6); + draw_list->PrimVtx(tra, uv_white, hue_color32); + draw_list->PrimVtx(trb, uv_white, hue_color32); + draw_list->PrimVtx(trc, uv_white, IM_COL32_WHITE); + draw_list->PrimVtx(tra, uv_white, IM_COL32_BLACK_TRANS); + draw_list->PrimVtx(trb, uv_white, IM_COL32_BLACK); + draw_list->PrimVtx(trc, uv_white, IM_COL32_BLACK_TRANS); + draw_list->AddTriangle(tra, trb, trc, IM_COL32(128,128,128,255), 1.5f); + sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V)); + } + else if (flags & ImGuiColorEditFlags_PickerHueBar) + { + // Render SV Square + draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size,sv_picker_size), IM_COL32_WHITE, hue_color32, hue_color32, IM_COL32_WHITE); + draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size,sv_picker_size), IM_COL32_BLACK_TRANS, IM_COL32_BLACK_TRANS, IM_COL32_BLACK, IM_COL32_BLACK); + RenderFrameBorder(picker_pos, picker_pos + ImVec2(sv_picker_size,sv_picker_size), 0.0f); + sv_cursor_pos.x = ImClamp((float)(int)(picker_pos.x + ImSaturate(S) * sv_picker_size + 0.5f), picker_pos.x + 2, picker_pos.x + sv_picker_size - 2); // Sneakily prevent the circle to stick out too much + sv_cursor_pos.y = ImClamp((float)(int)(picker_pos.y + ImSaturate(1 - V) * sv_picker_size + 0.5f), picker_pos.y + 2, picker_pos.y + sv_picker_size - 2); + + // Render Hue Bar + for (int i = 0; i < 6; ++i) + draw_list->AddRectFilledMultiColor(ImVec2(bar0_pos_x, picker_pos.y + i * (sv_picker_size / 6)), ImVec2(bar0_pos_x + bars_width, picker_pos.y + (i + 1) * (sv_picker_size / 6)), hue_colors[i], hue_colors[i], hue_colors[i + 1], hue_colors[i + 1]); + float bar0_line_y = (float)(int)(picker_pos.y + H * sv_picker_size + 0.5f); + RenderFrameBorder(ImVec2(bar0_pos_x, picker_pos.y), ImVec2(bar0_pos_x + bars_width, picker_pos.y + sv_picker_size), 0.0f); + RenderArrowsForVerticalBar(draw_list, ImVec2(bar0_pos_x - 1, bar0_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f); + } + + // Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range) + float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f; + draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, col32_no_alpha, 12); + draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad+1, IM_COL32(128,128,128,255), 12); + draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, IM_COL32_WHITE, 12); + + // Render alpha bar + if (alpha_bar) + { + float alpha = ImSaturate(col[3]); + ImRect bar1_bb(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size); + RenderColorRectWithAlphaCheckerboard(bar1_bb.Min, bar1_bb.Max, IM_COL32(0,0,0,0), bar1_bb.GetWidth() / 2.0f, ImVec2(0.0f, 0.0f)); + draw_list->AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, col32_no_alpha, col32_no_alpha, col32_no_alpha & ~IM_COL32_A_MASK, col32_no_alpha & ~IM_COL32_A_MASK); + float bar1_line_y = (float)(int)(picker_pos.y + (1.0f - alpha) * sv_picker_size + 0.5f); + RenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0f); + RenderArrowsForVerticalBar(draw_list, ImVec2(bar1_pos_x - 1, bar1_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f); + } + + EndGroup(); + + if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0) + value_changed = false; + if (value_changed) + MarkItemEdited(window->DC.LastItemId); + + PopID(); + + return value_changed; +} + +// A little colored square. Return true when clicked. +// FIXME: May want to display/ignore the alpha component in the color display? Yet show it in the tooltip. +// 'desc_id' is not called 'label' because we don't display it next to the button, but only in the tooltip. +bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags, ImVec2 size) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiID id = window->GetID(desc_id); + float default_size = GetFrameHeight(); + if (size.x == 0.0f) + size.x = default_size; + if (size.y == 0.0f) + size.y = default_size; + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); + ItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f); + if (!ItemAdd(bb, id)) + return false; + + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held); + + if (flags & ImGuiColorEditFlags_NoAlpha) + flags &= ~(ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf); + + ImVec4 col_without_alpha(col.x, col.y, col.z, 1.0f); + float grid_step = ImMin(size.x, size.y) / 2.99f; + float rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5f); + ImRect bb_inner = bb; + float off = -0.75f; // The border (using Col_FrameBg) tends to look off when color is near-opaque and rounding is enabled. This offset seemed like a good middle ground to reduce those artifacts. + bb_inner.Expand(off); + if ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col.w < 1.0f) + { + float mid_x = (float)(int)((bb_inner.Min.x + bb_inner.Max.x) * 0.5f + 0.5f); + RenderColorRectWithAlphaCheckerboard(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col), grid_step, ImVec2(-grid_step + off, off), rounding, ImDrawCornerFlags_TopRight| ImDrawCornerFlags_BotRight); + window->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_without_alpha), rounding, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotLeft); + } + else + { + // Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha + ImVec4 col_source = (flags & ImGuiColorEditFlags_AlphaPreview) ? col : col_without_alpha; + if (col_source.w < 1.0f) + RenderColorRectWithAlphaCheckerboard(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding); + else + window->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding, ImDrawCornerFlags_All); + } + RenderNavHighlight(bb, id); + if (g.Style.FrameBorderSize > 0.0f) + RenderFrameBorder(bb.Min, bb.Max, rounding); + else + window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border + + // Drag and Drop Source + // NB: The ActiveId test is merely an optional micro-optimization, BeginDragDropSource() does the same test. + if (g.ActiveId == id && !(flags & ImGuiColorEditFlags_NoDragDrop) && BeginDragDropSource()) + { + if (flags & ImGuiColorEditFlags_NoAlpha) + SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, &col, sizeof(float) * 3, ImGuiCond_Once); + else + SetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F, &col, sizeof(float) * 4, ImGuiCond_Once); + ColorButton(desc_id, col, flags); + SameLine(); + TextUnformatted("Color"); + EndDragDropSource(); + } + + // Tooltip + if (!(flags & ImGuiColorEditFlags_NoTooltip) && hovered) + ColorTooltip(desc_id, &col.x, flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)); + + if (pressed) + MarkItemEdited(id); + + return pressed; +} + +void ImGui::SetColorEditOptions(ImGuiColorEditFlags flags) +{ + ImGuiContext& g = *GImGui; + if ((flags & ImGuiColorEditFlags__InputsMask) == 0) + flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__InputsMask; + if ((flags & ImGuiColorEditFlags__DataTypeMask) == 0) + flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__DataTypeMask; + if ((flags & ImGuiColorEditFlags__PickerMask) == 0) + flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__PickerMask; + IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__InputsMask))); // Check only 1 option is selected + IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__DataTypeMask))); // Check only 1 option is selected + IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask))); // Check only 1 option is selected + g.ColorEditOptions = flags; +} + +// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. +void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags) +{ + ImGuiContext& g = *GImGui; + + int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]); + BeginTooltipEx(0, true); + + const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text; + if (text_end > text) + { + TextUnformatted(text, text_end); + Separator(); + } + + ImVec2 sz(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2); + ColorButton("##preview", ImVec4(col[0], col[1], col[2], col[3]), (flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)) | ImGuiColorEditFlags_NoTooltip, sz); + SameLine(); + if (flags & ImGuiColorEditFlags_NoAlpha) + Text("#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]); + else + Text("#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]); + EndTooltip(); +} + +void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags) +{ + bool allow_opt_inputs = !(flags & ImGuiColorEditFlags__InputsMask); + bool allow_opt_datatype = !(flags & ImGuiColorEditFlags__DataTypeMask); + if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context")) + return; + ImGuiContext& g = *GImGui; + ImGuiColorEditFlags opts = g.ColorEditOptions; + if (allow_opt_inputs) + { + if (RadioButton("RGB", (opts & ImGuiColorEditFlags_RGB) != 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_RGB; + if (RadioButton("HSV", (opts & ImGuiColorEditFlags_HSV) != 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HSV; + if (RadioButton("HEX", (opts & ImGuiColorEditFlags_HEX) != 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HEX; + } + if (allow_opt_datatype) + { + if (allow_opt_inputs) Separator(); + if (RadioButton("0..255", (opts & ImGuiColorEditFlags_Uint8) != 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Uint8; + if (RadioButton("0.00..1.00", (opts & ImGuiColorEditFlags_Float) != 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Float; + } + + if (allow_opt_inputs || allow_opt_datatype) + Separator(); + if (Button("Copy as..", ImVec2(-1,0))) + OpenPopup("Copy"); + if (BeginPopup("Copy")) + { + int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]); + char buf[64]; + ImFormatString(buf, IM_ARRAYSIZE(buf), "(%.3ff, %.3ff, %.3ff, %.3ff)", col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]); + if (Selectable(buf)) + SetClipboardText(buf); + ImFormatString(buf, IM_ARRAYSIZE(buf), "(%d,%d,%d,%d)", cr, cg, cb, ca); + if (Selectable(buf)) + SetClipboardText(buf); + if (flags & ImGuiColorEditFlags_NoAlpha) + ImFormatString(buf, IM_ARRAYSIZE(buf), "0x%02X%02X%02X", cr, cg, cb); + else + ImFormatString(buf, IM_ARRAYSIZE(buf), "0x%02X%02X%02X%02X", cr, cg, cb, ca); + if (Selectable(buf)) + SetClipboardText(buf); + EndPopup(); + } + + g.ColorEditOptions = opts; + EndPopup(); +} + +void ImGui::ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags) +{ + bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask); + bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar); + if ((!allow_opt_picker && !allow_opt_alpha_bar) || !BeginPopup("context")) + return; + ImGuiContext& g = *GImGui; + if (allow_opt_picker) + { + ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function + PushItemWidth(picker_size.x); + for (int picker_type = 0; picker_type < 2; picker_type++) + { + // Draw small/thumbnail version of each picker type (over an invisible button for selection) + if (picker_type > 0) Separator(); + PushID(picker_type); + ImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoOptions|ImGuiColorEditFlags_NoLabel|ImGuiColorEditFlags_NoSidePreview|(flags & ImGuiColorEditFlags_NoAlpha); + if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar; + if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel; + ImVec2 backup_pos = GetCursorScreenPos(); + if (Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup + g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask); + SetCursorScreenPos(backup_pos); + ImVec4 dummy_ref_col; + memcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (picker_flags & ImGuiColorEditFlags_NoAlpha ? 3 : 4)); + ColorPicker4("##dummypicker", &dummy_ref_col.x, picker_flags); + PopID(); + } + PopItemWidth(); + } + if (allow_opt_alpha_bar) + { + if (allow_opt_picker) Separator(); + CheckboxFlags("Alpha Bar", (unsigned int*)&g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar); + } + EndPopup(); +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: TreeNode, CollapsingHeader, etc. +//------------------------------------------------------------------------- +// - TreeNode() +// - TreeNodeV() +// - TreeNodeEx() +// - TreeNodeExV() +// - TreeNodeBehavior() [Internal] +// - TreePush() +// - TreePop() +// - TreeAdvanceToLabelPos() +// - GetTreeNodeToLabelSpacing() +// - SetNextTreeNodeOpen() +// - CollapsingHeader() +//------------------------------------------------------------------------- + +bool ImGui::TreeNode(const char* str_id, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + bool is_open = TreeNodeExV(str_id, 0, fmt, args); + va_end(args); + return is_open; +} + +bool ImGui::TreeNode(const void* ptr_id, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + bool is_open = TreeNodeExV(ptr_id, 0, fmt, args); + va_end(args); + return is_open; +} + +bool ImGui::TreeNode(const char* label) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + return TreeNodeBehavior(window->GetID(label), 0, label, NULL); +} + +bool ImGui::TreeNodeV(const char* str_id, const char* fmt, va_list args) +{ + return TreeNodeExV(str_id, 0, fmt, args); +} + +bool ImGui::TreeNodeV(const void* ptr_id, const char* fmt, va_list args) +{ + return TreeNodeExV(ptr_id, 0, fmt, args); +} + +bool ImGui::TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + return TreeNodeBehavior(window->GetID(label), flags, label, NULL); +} + +bool ImGui::TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + bool is_open = TreeNodeExV(str_id, flags, fmt, args); + va_end(args); + return is_open; +} + +bool ImGui::TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + bool is_open = TreeNodeExV(ptr_id, flags, fmt, args); + va_end(args); + return is_open; +} + +bool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + return TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end); +} + +bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + return TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end); +} + +bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) +{ + if (flags & ImGuiTreeNodeFlags_Leaf) + return true; + + // We only write to the tree storage if the user clicks (or explicitly use SetNextTreeNode*** functions) + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImGuiStorage* storage = window->DC.StateStorage; + + bool is_open; + if (g.NextTreeNodeOpenCond != 0) + { + if (g.NextTreeNodeOpenCond & ImGuiCond_Always) + { + is_open = g.NextTreeNodeOpenVal; + storage->SetInt(id, is_open); + } + else + { + // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently. + const int stored_value = storage->GetInt(id, -1); + if (stored_value == -1) + { + is_open = g.NextTreeNodeOpenVal; + storage->SetInt(id, is_open); + } + else + { + is_open = stored_value != 0; + } + } + g.NextTreeNodeOpenCond = 0; + } + else + { + is_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0; + } + + // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior). + // NB- If we are above max depth we still allow manually opened nodes to be logged. + if (g.LogEnabled && !(flags & ImGuiTreeNodeFlags_NoAutoOpenOnLog) && window->DC.TreeDepth < g.LogAutoExpandMaxDepth) + is_open = true; + + return is_open; +} + +bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const bool display_frame = (flags & ImGuiTreeNodeFlags_Framed) != 0; + const ImVec2 padding = (display_frame || (flags & ImGuiTreeNodeFlags_FramePadding)) ? style.FramePadding : ImVec2(style.FramePadding.x, 0.0f); + + if (!label_end) + label_end = FindRenderedTextEnd(label); + const ImVec2 label_size = CalcTextSize(label, label_end, false); + + // We vertically grow up to current line height up the typical widget height. + const float text_base_offset_y = ImMax(padding.y, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it + const float frame_height = ImMax(ImMin(window->DC.CurrentLineSize.y, g.FontSize + style.FramePadding.y*2), label_size.y + padding.y*2); + ImRect frame_bb = ImRect(window->DC.CursorPos, ImVec2(window->Pos.x + GetContentRegionMax().x, window->DC.CursorPos.y + frame_height)); + if (display_frame) + { + // Framed header expand a little outside the default padding + frame_bb.Min.x -= (float)(int)(window->WindowPadding.x*0.5f) - 1; + frame_bb.Max.x += (float)(int)(window->WindowPadding.x*0.5f) - 1; + } + + const float text_offset_x = (g.FontSize + (display_frame ? padding.x*3 : padding.x*2)); // Collapser arrow width + Spacing + const float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x*2 : 0.0f); // Include collapser + ItemSize(ImVec2(text_width, frame_height), text_base_offset_y); + + // For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing + // (Ideally we'd want to add a flag for the user to specify if we want the hit test to be done up to the right side of the content or not) + const ImRect interact_bb = display_frame ? frame_bb : ImRect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + text_width + style.ItemSpacing.x*2, frame_bb.Max.y); + bool is_open = TreeNodeBehaviorIsOpen(id, flags); + + // Store a flag for the current depth to tell if we will allow closing this node when navigating one of its child. + // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop(). + // This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero. + if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) + window->DC.TreeDepthMayJumpToParentOnPop |= (1 << window->DC.TreeDepth); + + bool item_add = ItemAdd(interact_bb, id); + window->DC.LastItemStatusFlags |= ImGuiItemStatusFlags_HasDisplayRect; + window->DC.LastItemDisplayRect = frame_bb; + + if (!item_add) + { + if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) + TreePushRawID(id); + return is_open; + } + + // Flags that affects opening behavior: + // - 0(default) ..................... single-click anywhere to open + // - OpenOnDoubleClick .............. double-click anywhere to open + // - OpenOnArrow .................... single-click on arrow to open + // - OpenOnDoubleClick|OpenOnArrow .. single-click on arrow or double-click anywhere to open + ImGuiButtonFlags button_flags = ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowItemOverlap) ? ImGuiButtonFlags_AllowItemOverlap : 0); + if (!(flags & ImGuiTreeNodeFlags_Leaf)) + button_flags |= ImGuiButtonFlags_PressedOnDragDropHold; + if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) + button_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0); + + bool hovered, held, pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags); + if (!(flags & ImGuiTreeNodeFlags_Leaf)) + { + bool toggled = false; + if (pressed) + { + toggled = !(flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) || (g.NavActivateId == id); + if (flags & ImGuiTreeNodeFlags_OpenOnArrow) + toggled |= IsMouseHoveringRect(interact_bb.Min, ImVec2(interact_bb.Min.x + text_offset_x, interact_bb.Max.y)) && (!g.NavDisableMouseHover); + if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) + toggled |= g.IO.MouseDoubleClicked[0]; + if (g.DragDropActive && is_open) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again. + toggled = false; + } + + if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open) + { + toggled = true; + NavMoveRequestCancel(); + } + if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right && !is_open) // If there's something upcoming on the line we may want to give it the priority? + { + toggled = true; + NavMoveRequestCancel(); + } + + if (toggled) + { + is_open = !is_open; + window->DC.StateStorage->SetInt(id, is_open); + } + } + if (flags & ImGuiTreeNodeFlags_AllowItemOverlap) + SetItemAllowOverlap(); + + // Render + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); + const ImVec2 text_pos = frame_bb.Min + ImVec2(text_offset_x, text_base_offset_y); + if (display_frame) + { + // Framed type + RenderFrame(frame_bb.Min, frame_bb.Max, col, true, style.FrameRounding); + RenderNavHighlight(frame_bb, id, ImGuiNavHighlightFlags_TypeThin); + RenderArrow(frame_bb.Min + ImVec2(padding.x, text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f); + if (g.LogEnabled) + { + // NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here. + const char log_prefix[] = "\n##"; + const char log_suffix[] = "##"; + LogRenderedText(&text_pos, log_prefix, log_prefix+3); + RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size); + LogRenderedText(&text_pos, log_suffix+1, log_suffix+3); + } + else + { + RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size); + } + } + else + { + // Unframed typed for tree nodes + if (hovered || (flags & ImGuiTreeNodeFlags_Selected)) + { + RenderFrame(frame_bb.Min, frame_bb.Max, col, false); + RenderNavHighlight(frame_bb, id, ImGuiNavHighlightFlags_TypeThin); + } + + if (flags & ImGuiTreeNodeFlags_Bullet) + RenderBullet(frame_bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y)); + else if (!(flags & ImGuiTreeNodeFlags_Leaf)) + RenderArrow(frame_bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f); + if (g.LogEnabled) + LogRenderedText(&text_pos, ">"); + RenderText(text_pos, label, label_end, false); + } + + if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) + TreePushRawID(id); + return is_open; +} + +void ImGui::TreePush(const char* str_id) +{ + ImGuiWindow* window = GetCurrentWindow(); + Indent(); + window->DC.TreeDepth++; + PushID(str_id ? str_id : "#TreePush"); +} + +void ImGui::TreePush(const void* ptr_id) +{ + ImGuiWindow* window = GetCurrentWindow(); + Indent(); + window->DC.TreeDepth++; + PushID(ptr_id ? ptr_id : (const void*)"#TreePush"); +} + +void ImGui::TreePushRawID(ImGuiID id) +{ + ImGuiWindow* window = GetCurrentWindow(); + Indent(); + window->DC.TreeDepth++; + window->IDStack.push_back(id); +} + +void ImGui::TreePop() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + Unindent(); + + window->DC.TreeDepth--; + if (g.NavMoveDir == ImGuiDir_Left && g.NavWindow == window && NavMoveRequestButNoResultYet()) + if (g.NavIdIsAlive && (window->DC.TreeDepthMayJumpToParentOnPop & (1 << window->DC.TreeDepth))) + { + SetNavID(window->IDStack.back(), g.NavLayer); + NavMoveRequestCancel(); + } + window->DC.TreeDepthMayJumpToParentOnPop &= (1 << window->DC.TreeDepth) - 1; + + IM_ASSERT(window->IDStack.Size > 1); // There should always be 1 element in the IDStack (pushed during window creation). If this triggers you called TreePop/PopID too much. + PopID(); +} + +void ImGui::TreeAdvanceToLabelPos() +{ + ImGuiContext& g = *GImGui; + g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing(); +} + +// Horizontal distance preceding label when using TreeNode() or Bullet() +float ImGui::GetTreeNodeToLabelSpacing() +{ + ImGuiContext& g = *GImGui; + return g.FontSize + (g.Style.FramePadding.x * 2.0f); +} + +void ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiCond cond) +{ + ImGuiContext& g = *GImGui; + if (g.CurrentWindow->SkipItems) + return; + g.NextTreeNodeOpenVal = is_open; + g.NextTreeNodeOpenCond = cond ? cond : ImGuiCond_Always; +} + +// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag). +// This is basically the same as calling TreeNodeEx(label, ImGuiTreeNodeFlags_CollapsingHeader). You can remove the _NoTreePushOnOpen flag if you want behavior closer to normal TreeNode(). +bool ImGui::CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + return TreeNodeBehavior(window->GetID(label), flags | ImGuiTreeNodeFlags_CollapsingHeader, label); +} + +bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + if (p_open && !*p_open) + return false; + + ImGuiID id = window->GetID(label); + bool is_open = TreeNodeBehavior(id, flags | ImGuiTreeNodeFlags_CollapsingHeader | (p_open ? ImGuiTreeNodeFlags_AllowItemOverlap : 0), label); + if (p_open) + { + // Create a small overlapping close button // FIXME: We can evolve this into user accessible helpers to add extra buttons on title bars, headers, etc. + ImGuiContext& g = *GImGui; + ImGuiItemHoveredDataBackup last_item_backup; + float button_radius = g.FontSize * 0.5f; + ImVec2 button_center = ImVec2(ImMin(window->DC.LastItemRect.Max.x, window->ClipRect.Max.x) - g.Style.FramePadding.x - button_radius, window->DC.LastItemRect.GetCenter().y); + if (CloseButton(window->GetID((void*)(intptr_t)(id+1)), button_center, button_radius)) + *p_open = false; + last_item_backup.Restore(); + } + + return is_open; +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: Selectable +//------------------------------------------------------------------------- +// - Selectable() +//------------------------------------------------------------------------- + +// Tip: pass a non-visible label (e.g. "##dummy") then you can use the space to draw other text or image. +// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID or use ##unique_id. +bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet) // FIXME-OPT: Avoid if vertically clipped. + PopClipRect(); + + ImGuiID id = window->GetID(label); + ImVec2 label_size = CalcTextSize(label, NULL, true); + ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y); + ImVec2 pos = window->DC.CursorPos; + pos.y += window->DC.CurrentLineTextBaseOffset; + ImRect bb_inner(pos, pos + size); + ItemSize(bb_inner); + + // Fill horizontal space. + ImVec2 window_padding = window->WindowPadding; + float max_x = (flags & ImGuiSelectableFlags_SpanAllColumns) ? GetWindowContentRegionMax().x : GetContentRegionMax().x; + float w_draw = ImMax(label_size.x, window->Pos.x + max_x - window_padding.x - window->DC.CursorPos.x); + ImVec2 size_draw((size_arg.x != 0 && !(flags & ImGuiSelectableFlags_DrawFillAvailWidth)) ? size_arg.x : w_draw, size_arg.y != 0.0f ? size_arg.y : size.y); + ImRect bb(pos, pos + size_draw); + if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth)) + bb.Max.x += window_padding.x; + + // Selectables are tightly packed together, we extend the box to cover spacing between selectable. + float spacing_L = (float)(int)(style.ItemSpacing.x * 0.5f); + float spacing_U = (float)(int)(style.ItemSpacing.y * 0.5f); + float spacing_R = style.ItemSpacing.x - spacing_L; + float spacing_D = style.ItemSpacing.y - spacing_U; + bb.Min.x -= spacing_L; + bb.Min.y -= spacing_U; + bb.Max.x += spacing_R; + bb.Max.y += spacing_D; + if (!ItemAdd(bb, (flags & ImGuiSelectableFlags_Disabled) ? 0 : id)) + { + if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet) + PushColumnClipRect(); + return false; + } + + // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries + ImGuiButtonFlags button_flags = 0; + if (flags & ImGuiSelectableFlags_NoHoldingActiveID) button_flags |= ImGuiButtonFlags_NoHoldingActiveID; + if (flags & ImGuiSelectableFlags_PressedOnClick) button_flags |= ImGuiButtonFlags_PressedOnClick; + if (flags & ImGuiSelectableFlags_PressedOnRelease) button_flags |= ImGuiButtonFlags_PressedOnRelease; + if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled; + if (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; + bool hovered, held; + bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags); + if (flags & ImGuiSelectableFlags_Disabled) + selected = false; + + // Hovering selectable with mouse updates NavId accordingly so navigation can be resumed with gamepad/keyboard (this doesn't happen on most widgets) + if (pressed || hovered) + if (!g.NavDisableMouseHover && g.NavWindow == window && g.NavLayer == window->DC.NavLayerCurrent) + { + g.NavDisableHighlight = true; + SetNavID(id, window->DC.NavLayerCurrent); + } + if (pressed) + MarkItemEdited(id); + + // Render + if (hovered || selected) + { + const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); + RenderFrame(bb.Min, bb.Max, col, false, 0.0f); + RenderNavHighlight(bb, id, ImGuiNavHighlightFlags_TypeThin | ImGuiNavHighlightFlags_NoRounding); + } + + if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet) + { + PushColumnClipRect(); + bb.Max.x -= (GetContentRegionMax().x - max_x); + } + + if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); + RenderTextClipped(bb_inner.Min, bb.Max, label, NULL, &label_size, ImVec2(0.0f,0.0f)); + if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor(); + + // Automatically close popups + if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(window->DC.ItemFlags & ImGuiItemFlags_SelectableDontClosePopup)) + CloseCurrentPopup(); + return pressed; +} + +bool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags, const ImVec2& size_arg) +{ + if (Selectable(label, *p_selected, flags, size_arg)) + { + *p_selected = !*p_selected; + return true; + } + return false; +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: ListBox +//------------------------------------------------------------------------- +// - ListBox() +// - ListBoxHeader() +// - ListBoxFooter() +//------------------------------------------------------------------------- + +// FIXME: In principle this function should be called BeginListBox(). We should rename it after re-evaluating if we want to keep the same signature. +// Helper to calculate the size of a listbox and display a label on the right. +// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an non-visible label e.g. "##empty" +bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + const ImGuiStyle& style = GetStyle(); + const ImGuiID id = GetID(label); + const ImVec2 label_size = CalcTextSize(label, NULL, true); + + // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar. + ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y); + ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y)); + ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size); + ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); + window->DC.LastItemRect = bb; // Forward storage for ListBoxFooter.. dodgy. + + BeginGroup(); + if (label_size.x > 0) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); + + BeginChildFrame(id, frame_bb.GetSize()); + return true; +} + +// FIXME: In principle this function should be called EndListBox(). We should rename it after re-evaluating if we want to keep the same signature. +bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items) +{ + // Size default to hold ~7.25 items. + // We add +25% worth of item height to allow the user to see at a glance if there are more items up/down, without looking at the scrollbar. + // We don't add this extra bit if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size. + // I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution. + if (height_in_items < 0) + height_in_items = ImMin(items_count, 7); + const ImGuiStyle& style = GetStyle(); + float height_in_items_f = (height_in_items < items_count) ? (height_in_items + 0.25f) : (height_in_items + 0.00f); + + // We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild(). + ImVec2 size; + size.x = 0.0f; + size.y = GetTextLineHeightWithSpacing() * height_in_items_f + style.FramePadding.y * 2.0f; + return ListBoxHeader(label, size); +} + +// FIXME: In principle this function should be called EndListBox(). We should rename it after re-evaluating if we want to keep the same signature. +void ImGui::ListBoxFooter() +{ + ImGuiWindow* parent_window = GetCurrentWindow()->ParentWindow; + const ImRect bb = parent_window->DC.LastItemRect; + const ImGuiStyle& style = GetStyle(); + + EndChildFrame(); + + // Redeclare item size so that it includes the label (we have stored the full size in LastItemRect) + // We call SameLine() to restore DC.CurrentLine* data + SameLine(); + parent_window->DC.CursorPos = bb.Min; + ItemSize(bb, style.FramePadding.y); + EndGroup(); +} + +bool ImGui::ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_items) +{ + const bool value_changed = ListBox(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_items); + return value_changed; +} + +bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items) +{ + if (!ListBoxHeader(label, items_count, height_in_items)) + return false; + + // Assume all items have even height (= 1 line of text). If you need items of different or variable sizes you can create a custom version of ListBox() in your code without using the clipper. + ImGuiContext& g = *GImGui; + bool value_changed = false; + ImGuiListClipper clipper(items_count, GetTextLineHeightWithSpacing()); // We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to. + while (clipper.Step()) + for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) + { + const bool item_selected = (i == *current_item); + const char* item_text; + if (!items_getter(data, i, &item_text)) + item_text = "*Unknown item*"; + + PushID(i); + if (Selectable(item_text, item_selected)) + { + *current_item = i; + value_changed = true; + } + if (item_selected) + SetItemDefaultFocus(); + PopID(); + } + ListBoxFooter(); + if (value_changed) + MarkItemEdited(g.CurrentWindow->DC.LastItemId); + + return value_changed; +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: PlotLines, PlotHistogram +//------------------------------------------------------------------------- +// - PlotEx() [Internal] +// - PlotLines() +// - PlotHistogram() +//------------------------------------------------------------------------- + +void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + + const ImVec2 label_size = CalcTextSize(label, NULL, true); + if (graph_size.x == 0.0f) + graph_size.x = CalcItemWidth(); + if (graph_size.y == 0.0f) + graph_size.y = label_size.y + (style.FramePadding.y * 2); + + const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(graph_size.x, graph_size.y)); + const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); + const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0)); + ItemSize(total_bb, style.FramePadding.y); + if (!ItemAdd(total_bb, 0, &frame_bb)) + return; + const bool hovered = ItemHoverable(inner_bb, 0); + + // Determine scale from values if not specified + if (scale_min == FLT_MAX || scale_max == FLT_MAX) + { + float v_min = FLT_MAX; + float v_max = -FLT_MAX; + for (int i = 0; i < values_count; i++) + { + const float v = values_getter(data, i); + v_min = ImMin(v_min, v); + v_max = ImMax(v_max, v); + } + if (scale_min == FLT_MAX) + scale_min = v_min; + if (scale_max == FLT_MAX) + scale_max = v_max; + } + + RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); + + if (values_count > 0) + { + int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); + int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); + + // Tooltip on hover + int v_hovered = -1; + if (hovered) + { + const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f); + const int v_idx = (int)(t * item_count); + IM_ASSERT(v_idx >= 0 && v_idx < values_count); + + const float v0 = values_getter(data, (v_idx + values_offset) % values_count); + const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count); + if (plot_type == ImGuiPlotType_Lines) + SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1); + else if (plot_type == ImGuiPlotType_Histogram) + SetTooltip("%d: %8.4g", v_idx, v0); + v_hovered = v_idx; + } + + const float t_step = 1.0f / (float)res_w; + const float inv_scale = (scale_min == scale_max) ? 0.0f : (1.0f / (scale_max - scale_min)); + + float v0 = values_getter(data, (0 + values_offset) % values_count); + float t0 = 0.0f; + ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) * inv_scale) ); // Point in the normalized space of our target rectangle + float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min * inv_scale) : (scale_min < 0.0f ? 0.0f : 1.0f); // Where does the zero line stands + + const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram); + const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered); + + for (int n = 0; n < res_w; n++) + { + const float t1 = t0 + t_step; + const int v1_idx = (int)(t0 * item_count + 0.5f); + IM_ASSERT(v1_idx >= 0 && v1_idx < values_count); + const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count); + const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) * inv_scale) ); + + // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. + ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0); + ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t)); + if (plot_type == ImGuiPlotType_Lines) + { + window->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); + } + else if (plot_type == ImGuiPlotType_Histogram) + { + if (pos1.x >= pos0.x + 2.0f) + pos1.x -= 1.0f; + window->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); + } + + t0 = t1; + tp0 = tp1; + } + } + + // Text overlay + if (overlay_text) + RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f,0.0f)); + + if (label_size.x > 0.0f) + RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); +} + +struct ImGuiPlotArrayGetterData +{ + const float* Values; + int Stride; + + ImGuiPlotArrayGetterData(const float* values, int stride) { Values = values; Stride = stride; } +}; + +static float Plot_ArrayGetter(void* data, int idx) +{ + ImGuiPlotArrayGetterData* plot_data = (ImGuiPlotArrayGetterData*)data; + const float v = *(const float*)(const void*)((const unsigned char*)plot_data->Values + (size_t)idx * plot_data->Stride); + return v; +} + +void ImGui::PlotLines(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride) +{ + ImGuiPlotArrayGetterData data(values, stride); + PlotEx(ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); +} + +void ImGui::PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) +{ + PlotEx(ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); +} + +void ImGui::PlotHistogram(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride) +{ + ImGuiPlotArrayGetterData data(values, stride); + PlotEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); +} + +void ImGui::PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) +{ + PlotEx(ImGuiPlotType_Histogram, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); +} + +//------------------------------------------------------------------------- +// [SECTION] Widgets: Value helpers +// Those is not very useful, legacy API. +//------------------------------------------------------------------------- +// - Value() +//------------------------------------------------------------------------- + +void ImGui::Value(const char* prefix, bool b) +{ + Text("%s: %s", prefix, (b ? "true" : "false")); +} + +void ImGui::Value(const char* prefix, int v) +{ + Text("%s: %d", prefix, v); +} + +void ImGui::Value(const char* prefix, unsigned int v) +{ + Text("%s: %d", prefix, v); +} + +void ImGui::Value(const char* prefix, float v, const char* float_format) +{ + if (float_format) + { + char fmt[64]; + ImFormatString(fmt, IM_ARRAYSIZE(fmt), "%%s: %s", float_format); + Text(fmt, prefix, v); + } + else + { + Text("%s: %.3f", prefix, v); + } +} + +//------------------------------------------------------------------------- +// [SECTION] MenuItem, BeginMenu, EndMenu, etc. +//------------------------------------------------------------------------- +// - ImGuiMenuColumns [Internal] +// - BeginMainMenuBar() +// - EndMainMenuBar() +// - BeginMenuBar() +// - EndMenuBar() +// - BeginMenu() +// - EndMenu() +// - MenuItem() +//------------------------------------------------------------------------- + +// Helpers for internal use +ImGuiMenuColumns::ImGuiMenuColumns() +{ + Count = 0; + Spacing = Width = NextWidth = 0.0f; + memset(Pos, 0, sizeof(Pos)); + memset(NextWidths, 0, sizeof(NextWidths)); +} + +void ImGuiMenuColumns::Update(int count, float spacing, bool clear) +{ + IM_ASSERT(Count <= IM_ARRAYSIZE(Pos)); + Count = count; + Width = NextWidth = 0.0f; + Spacing = spacing; + if (clear) memset(NextWidths, 0, sizeof(NextWidths)); + for (int i = 0; i < Count; i++) + { + if (i > 0 && NextWidths[i] > 0.0f) + Width += Spacing; + Pos[i] = (float)(int)Width; + Width += NextWidths[i]; + NextWidths[i] = 0.0f; + } +} + +float ImGuiMenuColumns::DeclColumns(float w0, float w1, float w2) // not using va_arg because they promote float to double +{ + NextWidth = 0.0f; + NextWidths[0] = ImMax(NextWidths[0], w0); + NextWidths[1] = ImMax(NextWidths[1], w1); + NextWidths[2] = ImMax(NextWidths[2], w2); + for (int i = 0; i < 3; i++) + NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0f) ? Spacing : 0.0f); + return ImMax(Width, NextWidth); +} + +float ImGuiMenuColumns::CalcExtraSpace(float avail_w) +{ + return ImMax(0.0f, avail_w - Width); +} + +// For the main menu bar, which cannot be moved, we honor g.Style.DisplaySafeAreaPadding to ensure text can be visible on a TV set. +bool ImGui::BeginMainMenuBar() +{ + ImGuiContext& g = *GImGui; + g.NextWindowData.MenuBarOffsetMinVal = ImVec2(g.Style.DisplaySafeAreaPadding.x, ImMax(g.Style.DisplaySafeAreaPadding.y - g.Style.FramePadding.y, 0.0f)); + SetNextWindowPos(ImVec2(0.0f, 0.0f)); + SetNextWindowSize(ImVec2(g.IO.DisplaySize.x, g.NextWindowData.MenuBarOffsetMinVal.y + g.FontBaseSize + g.Style.FramePadding.y)); + PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); + PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0)); + ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar; + bool is_open = Begin("##MainMenuBar", NULL, window_flags) && BeginMenuBar(); + PopStyleVar(2); + g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f); + if (!is_open) + { + End(); + return false; + } + return true; +} + +void ImGui::EndMainMenuBar() +{ + EndMenuBar(); + + // When the user has left the menu layer (typically: closed menus through activation of an item), we restore focus to the previous window + ImGuiContext& g = *GImGui; + if (g.CurrentWindow == g.NavWindow && g.NavLayer == 0) + FocusPreviousWindowIgnoringOne(g.NavWindow); + + End(); +} + +bool ImGui::BeginMenuBar() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + if (!(window->Flags & ImGuiWindowFlags_MenuBar)) + return false; + + IM_ASSERT(!window->DC.MenuBarAppending); + BeginGroup(); // Backup position on layer 0 + PushID("##menubar"); + + // We don't clip with current window clipping rectangle as it is already set to the area below. However we clip with window full rect. + // We remove 1 worth of rounding to Max.x to that text in long menus and small windows don't tend to display over the lower-right rounded area, which looks particularly glitchy. + ImRect bar_rect = window->MenuBarRect(); + ImRect clip_rect(ImFloor(bar_rect.Min.x + 0.5f), ImFloor(bar_rect.Min.y + window->WindowBorderSize + 0.5f), ImFloor(ImMax(bar_rect.Min.x, bar_rect.Max.x - window->WindowRounding) + 0.5f), ImFloor(bar_rect.Max.y + 0.5f)); + clip_rect.ClipWith(window->OuterRectClipped); + PushClipRect(clip_rect.Min, clip_rect.Max, false); + + window->DC.CursorPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y); + window->DC.LayoutType = ImGuiLayoutType_Horizontal; + window->DC.NavLayerCurrent++; + window->DC.NavLayerCurrentMask <<= 1; + window->DC.MenuBarAppending = true; + AlignTextToFramePadding(); + return true; +} + +void ImGui::EndMenuBar() +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + ImGuiContext& g = *GImGui; + + // Nav: When a move request within one of our child menu failed, capture the request to navigate among our siblings. + if (NavMoveRequestButNoResultYet() && (g.NavMoveDir == ImGuiDir_Left || g.NavMoveDir == ImGuiDir_Right) && (g.NavWindow->Flags & ImGuiWindowFlags_ChildMenu)) + { + ImGuiWindow* nav_earliest_child = g.NavWindow; + while (nav_earliest_child->ParentWindow && (nav_earliest_child->ParentWindow->Flags & ImGuiWindowFlags_ChildMenu)) + nav_earliest_child = nav_earliest_child->ParentWindow; + if (nav_earliest_child->ParentWindow == window && nav_earliest_child->DC.ParentLayoutType == ImGuiLayoutType_Horizontal && g.NavMoveRequestForward == ImGuiNavForward_None) + { + // To do so we claim focus back, restore NavId and then process the movement request for yet another frame. + // This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth the hassle/cost) + IM_ASSERT(window->DC.NavLayerActiveMaskNext & 0x02); // Sanity check + FocusWindow(window); + SetNavIDWithRectRel(window->NavLastIds[1], 1, window->NavRectRel[1]); + g.NavLayer = 1; + g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection. + g.NavMoveRequestForward = ImGuiNavForward_ForwardQueued; + NavMoveRequestCancel(); + } + } + + IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar); + IM_ASSERT(window->DC.MenuBarAppending); + PopClipRect(); + PopID(); + window->DC.MenuBarOffset.x = window->DC.CursorPos.x - window->MenuBarRect().Min.x; // Save horizontal position so next append can reuse it. This is kinda equivalent to a per-layer CursorPos. + window->DC.GroupStack.back().AdvanceCursor = false; + EndGroup(); // Restore position on layer 0 + window->DC.LayoutType = ImGuiLayoutType_Vertical; + window->DC.NavLayerCurrent--; + window->DC.NavLayerCurrentMask >>= 1; + window->DC.MenuBarAppending = false; +} + +bool ImGui::BeginMenu(const char* label, bool enabled) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + + ImVec2 label_size = CalcTextSize(label, NULL, true); + + bool pressed; + bool menu_is_open = IsPopupOpen(id); + bool menuset_is_open = !(window->Flags & ImGuiWindowFlags_Popup) && (g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].OpenParentId == window->IDStack.back()); + ImGuiWindow* backed_nav_window = g.NavWindow; + if (menuset_is_open) + g.NavWindow = window; // Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent) + + // The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu (using FindBestWindowPosForPopup). + ImVec2 popup_pos, pos = window->DC.CursorPos; + if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) + { + // Menu inside an horizontal menu bar + // Selectable extend their highlight by half ItemSpacing in each direction. + // For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin() + popup_pos = ImVec2(pos.x - 1.0f - (float)(int)(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight()); + window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); + PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f); + float w = label_size.x; + pressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_PressedOnClick | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f)); + PopStyleVar(); + window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). + } + else + { + // Menu inside a menu + popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y); + float w = window->MenuColumns.DeclColumns(label_size.x, 0.0f, (float)(int)(g.FontSize * 1.20f)); // Feedback to next frame + float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w); + pressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_PressedOnClick | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f)); + if (!enabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); + RenderArrow(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.30f, 0.0f), ImGuiDir_Right); + if (!enabled) PopStyleColor(); + } + + const bool hovered = enabled && ItemHoverable(window->DC.LastItemRect, id); + if (menuset_is_open) + g.NavWindow = backed_nav_window; + + bool want_open = false, want_close = false; + if (window->DC.LayoutType == ImGuiLayoutType_Vertical) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) + { + // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive. + bool moving_within_opened_triangle = false; + if (g.HoveredWindow == window && g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].ParentWindow == window && !(window->Flags & ImGuiWindowFlags_MenuBar)) + { + if (ImGuiWindow* next_window = g.OpenPopupStack[g.CurrentPopupStack.Size].Window) + { + ImRect next_window_rect = next_window->Rect(); + ImVec2 ta = g.IO.MousePos - g.IO.MouseDelta; + ImVec2 tb = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR(); + ImVec2 tc = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR(); + float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, 5.0f, 30.0f); // add a bit of extra slack. + ta.x += (window->Pos.x < next_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues + tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale? + tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f); + moving_within_opened_triangle = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos); + //window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); window->DrawList->PopClipRect(); // Debug + } + } + + want_close = (menu_is_open && !hovered && g.HoveredWindow == window && g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrame != id && !moving_within_opened_triangle); + want_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed); + + if (g.NavActivateId == id) + { + want_close = menu_is_open; + want_open = !menu_is_open; + } + if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Right) // Nav-Right to open + { + want_open = true; + NavMoveRequestCancel(); + } + } + else + { + // Menu bar + if (menu_is_open && pressed && menuset_is_open) // Click an open menu again to close it + { + want_close = true; + want_open = menu_is_open = false; + } + else if (pressed || (hovered && menuset_is_open && !menu_is_open)) // First click to open, then hover to open others + { + want_open = true; + } + else if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Down) // Nav-Down to open + { + want_open = true; + NavMoveRequestCancel(); + } + } + + if (!enabled) // explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu("options", has_object)) { ..use object.. }' + want_close = true; + if (want_close && IsPopupOpen(id)) + ClosePopupToLevel(g.CurrentPopupStack.Size); + + if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.CurrentPopupStack.Size) + { + // Don't recycle same menu level in the same frame, first close the other menu and yield for a frame. + OpenPopup(label); + return false; + } + + menu_is_open |= want_open; + if (want_open) + OpenPopup(label); + + if (menu_is_open) + { + // Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu) + SetNextWindowPos(popup_pos, ImGuiCond_Always); + ImGuiWindowFlags flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; + if (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) + flags |= ImGuiWindowFlags_ChildWindow; + menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + } + + return menu_is_open; +} + +void ImGui::EndMenu() +{ + // Nav: When a left move request _within our child menu_ failed, close the menu. + // A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs. + // However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction. + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical) + { + ClosePopupToLevel(g.OpenPopupStack.Size - 1); + NavMoveRequestCancel(); + } + + EndPopup(); +} + +bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, bool enabled) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + ImGuiStyle& style = g.Style; + ImVec2 pos = window->DC.CursorPos; + ImVec2 label_size = CalcTextSize(label, NULL, true); + + ImGuiSelectableFlags flags = ImGuiSelectableFlags_PressedOnRelease | (enabled ? 0 : ImGuiSelectableFlags_Disabled); + bool pressed; + if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) + { + // Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful + // Note that in this situation we render neither the shortcut neither the selected tick mark + float w = label_size.x; + window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); + PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f); + pressed = Selectable(label, false, flags, ImVec2(w, 0.0f)); + PopStyleVar(); + window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). + } + else + { + ImVec2 shortcut_size = shortcut ? CalcTextSize(shortcut, NULL) : ImVec2(0.0f, 0.0f); + float w = window->MenuColumns.DeclColumns(label_size.x, shortcut_size.x, (float)(int)(g.FontSize * 1.20f)); // Feedback for next frame + float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w); + pressed = Selectable(label, false, flags | ImGuiSelectableFlags_DrawFillAvailWidth, ImVec2(w, 0.0f)); + if (shortcut_size.x > 0.0f) + { + PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); + RenderText(pos + ImVec2(window->MenuColumns.Pos[1] + extra_w, 0.0f), shortcut, NULL, false); + PopStyleColor(); + } + if (selected) + RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f); + } + return pressed; +} + +bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled) +{ + if (MenuItem(label, shortcut, p_selected ? *p_selected : false, enabled)) + { + if (p_selected) + *p_selected = !*p_selected; + return true; + } + return false; +} diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/stb_rect_pack.h b/3rdparty/bgfx/3rdparty/dear-imgui/imstb_rectpack.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/stb_rect_pack.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/imstb_rectpack.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/stb_textedit.h b/3rdparty/bgfx/3rdparty/dear-imgui/imstb_textedit.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/stb_textedit.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/imstb_textedit.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/stb_truetype.h b/3rdparty/bgfx/3rdparty/dear-imgui/imstb_truetype.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/stb_truetype.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/imstb_truetype.h diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/stb_rect_pack.h b/3rdparty/bgfx/3rdparty/dear-imgui/stb_rect_pack.h new file mode 100644 index 00000000000..1562c5ae26e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/stb_rect_pack.h @@ -0,0 +1 @@ +#include diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/stb_textedit.h b/3rdparty/bgfx/3rdparty/dear-imgui/stb_textedit.h new file mode 100644 index 00000000000..f1ea0988424 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/stb_textedit.h @@ -0,0 +1 @@ +#include diff --git a/3rdparty/bgfx/3rdparty/dear-imgui/stb_truetype.h b/3rdparty/bgfx/3rdparty/dear-imgui/stb_truetype.h new file mode 100644 index 00000000000..9b6a811178a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dear-imgui/stb_truetype.h @@ -0,0 +1 @@ +#include diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_picker.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_picker.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_picker.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_picker.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_picker.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_picker.inl similarity index 96% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_picker.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_picker.inl index a297eb3cfb1..3fd2e875a32 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_picker.inl +++ b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_picker.inl @@ -12,7 +12,7 @@ namespace ImGui // Setup ImVec2 picker_pos = ImGui::GetCursorScreenPos(); ImVec2 sv_picker_size = ImVec2(256.0f, 256.0f); // Saturation/Value picking box - float bars_width = ImGui::GetWindowFontSize() + style.FramePadding.y*2.0f; // Width of Hue/Alpha picking bars (using Framepadding.y to match the ColorButton sides) + float bars_width = ImGui::GetFontSize() + style.FramePadding.y*2.0f; // Width of Hue/Alpha picking bars (using Framepadding.y to match the ColorButton sides) float bar0_pos_x = picker_pos.x + sv_picker_size.x + style.ItemInnerSpacing.x; float bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_wheel.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_wheel.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_wheel.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_wheel.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_wheel.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_wheel.inl similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/color_wheel.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/color_wheel.inl diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/dock.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/dock.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/dock.inl similarity index 99% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/dock.inl index e9466ca8679..1dceb70400f 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/dock.inl +++ b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/dock.inl @@ -512,8 +512,6 @@ namespace ImGui Begin("##Overlay", NULL, - ImVec2(0, 0), - 0.f, ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize); @@ -968,8 +966,6 @@ namespace ImGui SetNextWindowSize(dock.size); bool ret = Begin(label, opened, - dock.size, - -1.0f, ImGuiWindowFlags_NoCollapse | extra_flags); m_end_action = EndAction_End; dock.pos = GetWindowPos(); diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/file_list.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/file_list.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/file_list.inl similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/file_list.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/file_list.inl diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/gizmo.h similarity index 85% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/gizmo.h index b929150b712..718d1b45603 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.h +++ b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/gizmo.h @@ -1,5 +1,5 @@ // https://github.com/CedricGuillemet/ImGuizmo -// v 1.04 WIP +// v 1.61 WIP // // The MIT License(MIT) // @@ -105,18 +105,21 @@ void EditTransform(const Camera& camera, matrix_t& matrix) namespace ImGuizmo { + // call inside your own window and before Manipulate() in order to draw gizmo to that window. + IMGUI_API void SetDrawlist(); + // call BeginFrame right after ImGui_XXXX_NewFrame(); - void BeginFrame(); + IMGUI_API void BeginFrame(); // return true if mouse cursor is over any gizmo control (axis, plan or screen component) - bool IsOver(); + IMGUI_API bool IsOver(); // return true if mouse IsOver or if the gizmo is in moving state - bool IsUsing(); + IMGUI_API bool IsUsing(); // enable/disable the gizmo. Stay in the state until next call to Enable. // gizmo is rendered with gray half transparent color when disabled - void Enable(bool enable); + IMGUI_API void Enable(bool enable); // helper functions for manualy editing translation/rotation/scale with an input float // translation, rotation and scale float points to 3 floats each @@ -130,13 +133,16 @@ namespace ImGuizmo // ImGuizmo::RecomposeMatrixFromComponents(matrixTranslation, matrixRotation, matrixScale, gizmoMatrix.m16); // // These functions have some numerical stability issues for now. Use with caution. - void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale); - void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix); + IMGUI_API void DecomposeMatrixToComponents(const float *matrix, float *translation, float *rotation, float *scale); + IMGUI_API void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float *scale, float *matrix); - void SetRect(float x, float y, float width, float height); + IMGUI_API void SetRect(float x, float y, float width, float height); + // default is false + IMGUI_API void SetOrthographic(bool isOrthographic); // Render a cube with face color corresponding to face normal. Usefull for debug/tests - void DrawCube(const float *view, const float *projection, float *matrix); + IMGUI_API void DrawCube(const float *view, const float *projection, const float *matrix); + IMGUI_API void DrawGrid(const float *view, const float *projection, const float *matrix, const float gridSize); // call it when you want a gizmo // Needs view and projection matrices. @@ -147,6 +153,7 @@ namespace ImGuizmo TRANSLATE, ROTATE, SCALE, + BOUNDS, }; enum MODE @@ -155,5 +162,5 @@ namespace ImGuizmo WORLD }; - void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0, float *snap = 0, float *localBounds = NULL, float *boundsSnap = NULL); + IMGUI_API void Manipulate(const float *view, const float *projection, OPERATION operation, MODE mode, float *matrix, float *deltaMatrix = 0, float *snap = 0, float *localBounds = NULL, float *boundsSnap = NULL); }; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/gizmo.inl similarity index 64% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/gizmo.inl index 1f2427ae88e..363bfada1eb 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/gizmo.inl +++ b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/gizmo.inl @@ -1,17 +1,17 @@ // The MIT License(MIT) -// +// // Copyright(c) 2016 Cedric Guillemet -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE @@ -30,7 +30,7 @@ namespace ImGuizmo static const float ZPI = 3.14159265358979323846f; static const float RAD2DEG = (180.f / ZPI); static const float DEG2RAD = (ZPI / 180.f); - + static const float gGizmoSizeClipSpace = 0.1f; const float screenRotateSize = 0.06f; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -62,6 +62,8 @@ namespace ImGuizmo //template T LERP(T x, T y, float z) { return (x + (y - x)*z); } template T Clamp(T x, T y, T z) { return ((xz) ? z : x)); } template T max(T x, T y) { return (x > y) ? x : y; } + template T min(T x, T y) { return (x < y) ? x : y; } + template bool IsWithin(T x, T y, T z) { return (x>=y) && (x<=z); } struct matrix_t; struct vec_t @@ -83,7 +85,7 @@ namespace ImGuizmo vec_t& operator -= (const vec_t& v) { x -= v.x; y -= v.y; z -= v.z; w -= v.w; return *this; } vec_t& operator += (const vec_t& v) { x += v.x; y += v.y; z += v.z; w += v.w; return *this; } vec_t& operator *= (const vec_t& v) { x *= v.x; y *= v.y; z *= v.z; w *= v.w; return *this; } - vec_t& operator *= (float v) { x *= v; y *= v; z *= v; w *= v; return *this; } + vec_t& operator *= (float v) { x *= v; y *= v; z *= v; w *= v; return *this; } vec_t operator * (float f) const; vec_t operator - () const; @@ -96,7 +98,7 @@ namespace ImGuizmo float LengthSq() const { return (x*x + y*y + z*z); }; vec_t Normalize() { (*this) *= (1.f / Length()); return (*this); } vec_t Normalize(const vec_t& v) { this->Set(v.x, v.y, v.z, v.w); this->Normalize(); return (*this); } - vec_t Abs() const; + vec_t Abs() const; void Cross(const vec_t& v) { vec_t res; @@ -124,7 +126,7 @@ namespace ImGuizmo { return (x * v.x) + (y * v.y) + (z * v.z); } - + void Transform(const matrix_t& matrix); void Transform(const vec_t & s, const matrix_t& matrix); @@ -138,13 +140,13 @@ namespace ImGuizmo }; vec_t makeVect(float _x, float _y, float _z = 0.f, float _w = 0.f) { vec_t res; res.x = _x; res.y = _y; res.z = _z; res.w = _w; return res; } + vec_t makeVect(ImVec2 v) { vec_t res; res.x = v.x; res.y = v.y; res.z = 0.f; res.w = 0.f; return res; } vec_t vec_t::operator * (float f) const { return makeVect(x * f, y * f, z * f, w *f); } vec_t vec_t::operator - () const { return makeVect(-x, -y, -z, -w); } vec_t vec_t::operator - (const vec_t& v) const { return makeVect(x - v.x, y - v.y, z - v.z, w - v.w); } vec_t vec_t::operator + (const vec_t& v) const { return makeVect(x + v.x, y + v.y, z + v.z, w + v.w); } vec_t vec_t::operator * (const vec_t& v) const { return makeVect(x * v.x, y * v.y, z * v.z, w * v.w); } vec_t vec_t::Abs() const { return makeVect(fabsf(x), fabsf(y), fabsf(z)); } - ImVec2 operator+ (const ImVec2& a, const ImVec2& b) { return ImVec2(a.x + b.x, a.y + b.y); } vec_t Normalized(const vec_t& v) { vec_t res; res = v; res.Normalize(); return res; } vec_t Cross(const vec_t& v1, const vec_t& v2) @@ -185,7 +187,7 @@ namespace ImGuizmo { vec_t right, up, dir, position; } v; - vec_t component[4]; + vec_t component[4]; }; matrix_t(const matrix_t& other) { memcpy(&m16[0], &other.m16[0], sizeof(float) * 16); } @@ -247,7 +249,7 @@ namespace ImGuizmo } float Inverse(const matrix_t &srcMatrix, bool affine = false); - void SetToIdentity() + void SetToIdentity() { v.right.Set(1.f, 0.f, 0.f, 0.f); v.up.Set(0.f, 1.f, 0.f, 0.f); @@ -266,7 +268,7 @@ namespace ImGuizmo } (*this) = tmpm; } - + void RotationAxis(const vec_t & axis, float angle); void OrthoNormalize() @@ -468,7 +470,7 @@ namespace ImGuizmo } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // + // enum MOVETYPE { @@ -476,9 +478,9 @@ namespace ImGuizmo MOVE_X, MOVE_Y, MOVE_Z, - MOVE_XY, - MOVE_XZ, MOVE_YZ, + MOVE_ZX, + MOVE_XY, MOVE_SCREEN, ROTATE_X, ROTATE_Y, @@ -487,18 +489,13 @@ namespace ImGuizmo SCALE_X, SCALE_Y, SCALE_Z, - SCALE_XYZ, - BOUNDS + SCALE_XYZ }; struct Context { Context() : mbUsing(false), mbEnable(true), mbUsingBounds(false) { - mX=0.f; - mY=0.f; - mWidth=0.f; - mHeight=0.f; } ImDrawList* mDrawList; @@ -521,6 +518,7 @@ namespace ImGuizmo vec_t mRayOrigin; vec_t mRayVector; + float mRadiusSquareCenter; ImVec2 mScreenSquareCenter; ImVec2 mScreenSquareMin; ImVec2 mScreenSquareMax; @@ -552,26 +550,28 @@ namespace ImGuizmo bool mBelowPlaneLimit[3]; float mAxisFactor[3]; - // bounds stretching - vec_t mBoundsPivot; - vec_t mBoundsAnchor; - vec_t mBoundsPlan; - vec_t mBoundsLocalPivot; - int mBoundsBestAxis; - int mBoundsAxis[2]; - bool mbUsingBounds; - matrix_t mBoundsMatrix; + // bounds stretching + vec_t mBoundsPivot; + vec_t mBoundsAnchor; + vec_t mBoundsPlan; + vec_t mBoundsLocalPivot; + int mBoundsBestAxis; + int mBoundsAxis[2]; + bool mbUsingBounds; + matrix_t mBoundsMatrix; // int mCurrentOperation; - float mX,mY,mWidth,mHeight; - /* - float mX = 0.f; - float mY = 0.f; - float mWidth = 0.f; - float mHeight = 0.f; - */ + float mX = 0.f; + float mY = 0.f; + float mWidth = 0.f; + float mHeight = 0.f; + float mXMax = 0.f; + float mYMax = 0.f; + float mDisplayRatio = 1.f; + + bool mIsOrthographic = false; }; static Context gContext; @@ -581,13 +581,18 @@ namespace ImGuizmo static const vec_t directionUnary[3] = { makeVect(1.f, 0.f, 0.f), makeVect(0.f, 1.f, 0.f), makeVect(0.f, 0.f, 1.f) }; static const ImU32 directionColor[3] = { 0xFF0000AA, 0xFF00AA00, 0xFFAA0000 }; - static const ImU32 selectionColor = 0xFF1080FF; + + // Alpha: 100%: FF, 87%: DE, 70%: B3, 54%: 8A, 50%: 80, 38%: 61, 12%: 1F + static const ImU32 planeColor[3] = { 0x610000AA, 0x6100AA00, 0x61AA0000 }; + static const ImU32 selectionColor = 0x8A1080FF; static const ImU32 inactiveColor = 0x99999999; static const ImU32 translationLineColor = 0xAAAAAAAA; - static const char *translationInfoMask[] = { "X : %5.3f", "Y : %5.3f", "Z : %5.3f", "X : %5.3f Y : %5.3f", "Y : %5.3f Z : %5.3f", "X : %5.3f Z : %5.3f", "X : %5.3f Y : %5.3f Z : %5.3f" }; + static const char *translationInfoMask[] = { "X : %5.3f", "Y : %5.3f", "Z : %5.3f", + "Y : %5.3f Z : %5.3f", "X : %5.3f Z : %5.3f", "X : %5.3f Y : %5.3f", + "X : %5.3f Y : %5.3f Z : %5.3f" }; static const char *scaleInfoMask[] = { "X : %5.2f", "Y : %5.2f", "Z : %5.2f", "XYZ : %5.2f" }; static const char *rotationInfoMask[] = { "X : %5.2f deg %5.2f rad", "Y : %5.2f deg %5.2f rad", "Z : %5.2f deg %5.2f rad", "Screen : %5.2f deg %5.2f rad" }; - static const int translationInfoIndex[] = { 0,0,0, 1,0,0, 2,0,0, 0,1,0, 1,2,0, 0,2,1, 0,1,2 }; + static const int translationInfoIndex[] = { 0,0,0, 1,0,0, 2,0,0, 1,2,0, 0,2,0, 0,1,0, 0,1,2 }; static const float quadMin = 0.5f; static const float quadMax = 0.8f; static const float quadUV[8] = { quadMin, quadMin, quadMin, quadMax, quadMax, quadMax, quadMax, quadMin }; @@ -595,7 +600,7 @@ namespace ImGuizmo static const float snapTension = 0.5f; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // + // static int GetMoveType(vec_t *gizmoHitProportion); static int GetRotateType(); static int GetScaleType(); @@ -607,11 +612,11 @@ namespace ImGuizmo trans *= 0.5f / trans.w; trans += makeVect(0.5f, 0.5f); trans.y = 1.f - trans.y; - trans.x *= gContext.mWidth; - trans.y *= gContext.mHeight; - trans.x += gContext.mX; - trans.y += gContext.mY; - return ImVec2(trans.x, trans.y); + trans.x *= gContext.mWidth; + trans.y *= gContext.mHeight; + trans.x += gContext.mX; + trans.y += gContext.mY; + return ImVec2(trans.x, trans.y); } static void ComputeCameraRay(vec_t &rayOrigin, vec_t &rayDir) @@ -621,9 +626,9 @@ namespace ImGuizmo matrix_t mViewProjInverse; mViewProjInverse.Inverse(gContext.mViewMat * gContext.mProjectionMat); - float mox = ((io.MousePos.x - gContext.mX) / gContext.mWidth) * 2.f - 1.f; - float moy = (1.f - ((io.MousePos.y - gContext.mY) / gContext.mHeight)) * 2.f - 1.f; - + float mox = ((io.MousePos.x - gContext.mX) / gContext.mWidth) * 2.f - 1.f; + float moy = (1.f - ((io.MousePos.y - gContext.mY) / gContext.mHeight)) * 2.f - 1.f; + rayOrigin.Transform(makeVect(mox, moy, 0.f, 1.f), mViewProjInverse); rayOrigin *= 1.f / rayOrigin.w; vec_t rayEnd; @@ -632,6 +637,62 @@ namespace ImGuizmo rayDir = Normalized(rayEnd - rayOrigin); } + static float GetSegmentLengthClipSpace(const vec_t& start, const vec_t& end) + { + vec_t startOfSegment = start; + startOfSegment.TransformPoint(gContext.mMVP); + if (fabsf(startOfSegment.w)> FLT_EPSILON) // check for axis aligned with camera direction + startOfSegment *= 1.f / startOfSegment.w; + + vec_t endOfSegment = end; + endOfSegment.TransformPoint(gContext.mMVP); + if (fabsf(endOfSegment.w)> FLT_EPSILON) // check for axis aligned with camera direction + endOfSegment *= 1.f / endOfSegment.w; + + vec_t clipSpaceAxis = endOfSegment - startOfSegment; + clipSpaceAxis.y /= gContext.mDisplayRatio; + float segmentLengthInClipSpace = sqrtf(clipSpaceAxis.x*clipSpaceAxis.x + clipSpaceAxis.y*clipSpaceAxis.y); + return segmentLengthInClipSpace; + } + + static float GetParallelogram(const vec_t& ptO, const vec_t& ptA, const vec_t& ptB) + { + vec_t pts[] = { ptO, ptA, ptB }; + for (unsigned int i = 0; i < 3; i++) + { + pts[i].TransformPoint(gContext.mMVP); + if (fabsf(pts[i].w)> FLT_EPSILON) // check for axis aligned with camera direction + pts[i] *= 1.f / pts[i].w; + } + vec_t segA = pts[1] - pts[0]; + vec_t segB = pts[2] - pts[0]; + segA.y /= gContext.mDisplayRatio; + segB.y /= gContext.mDisplayRatio; + vec_t segAOrtho = makeVect(-segA.y, segA.x); + segAOrtho.Normalize(); + float dt = segAOrtho.Dot3(segB); + float surface = sqrtf(segA.x*segA.x + segA.y*segA.y) * fabsf(dt); + return surface; + } + + inline vec_t PointOnSegment(const vec_t & point, const vec_t & vertPos1, const vec_t & vertPos2) + { + vec_t c = point - vertPos1; + vec_t V; + + V.Normalize(vertPos2 - vertPos1); + float d = (vertPos2 - vertPos1).Length(); + float t = V.Dot3(c); + + if (t < 0.f) + return vertPos1; + + if (t > d) + return vertPos2; + + return vertPos1 + V * t; + } + static float IntersectRayPlane(const vec_t & rOrigin, const vec_t& rVector, const vec_t& plan) { float numer = plan.Dot3(rOrigin) - plan.w; @@ -643,23 +704,44 @@ namespace ImGuizmo return -(numer / denom); } + static bool IsInContextRect( ImVec2 p ) + { + return IsWithin( p.x, gContext.mX, gContext.mXMax ) && IsWithin(p.y, gContext.mY, gContext.mYMax ); + } + void SetRect(float x, float y, float width, float height) { - gContext.mX = x; - gContext.mY = y; - gContext.mWidth = width; - gContext.mHeight = height; + gContext.mX = x; + gContext.mY = y; + gContext.mWidth = width; + gContext.mHeight = height; + gContext.mXMax = gContext.mX + gContext.mWidth; + gContext.mYMax = gContext.mY + gContext.mXMax; + gContext.mDisplayRatio = width / height; + } + + IMGUI_API void SetOrthographic(bool isOrthographic) + { + gContext.mIsOrthographic = isOrthographic; + } + + void SetDrawlist() + { + gContext.mDrawList = ImGui::GetWindowDrawList(); } void BeginFrame() { ImGuiIO& io = ImGui::GetIO(); - ImGui::Begin("gizmo", NULL, io.DisplaySize, 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus); - - gContext.mDrawList = ImGui::GetWindowDrawList(); + const ImU32 flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus; + ImGui::SetNextWindowSize(io.DisplaySize); + ImGui::PushStyleColor(ImGuiCol_WindowBg, 0); + ImGui::Begin("gizmo", NULL, flags); + gContext.mDrawList = ImGui::GetWindowDrawList(); ImGui::End(); + ImGui::PopStyleColor(); } bool IsUsing() @@ -675,11 +757,11 @@ namespace ImGuizmo void Enable(bool enable) { gContext.mbEnable = enable; - if (!enable) - { - gContext.mbUsing = false; - gContext.mbUsingBounds = false; - } + if (!enable) + { + gContext.mbUsing = false; + gContext.mbUsingBounds = false; + } } static float GetUniform(const vec_t& position, const matrix_t& mat) @@ -694,7 +776,7 @@ namespace ImGuizmo gContext.mMode = mode; gContext.mViewMat = *(matrix_t*)view; gContext.mProjectionMat = *(matrix_t*)projection; - + if (mode == LOCAL) { gContext.mModel = *(matrix_t*)matrix; @@ -718,7 +800,16 @@ namespace ImGuizmo gContext.mCameraEye = viewInverse.v.position; gContext.mCameraRight = viewInverse.v.right; gContext.mCameraUp = viewInverse.v.up; - gContext.mScreenFactor = 0.1f * GetUniform(gContext.mModel.v.position, gContext.mViewProjection); + + // compute scale from the size of camera right vector projected on screen at the matrix position + vec_t pointRight = viewInverse.v.right; + pointRight.TransformPoint(gContext.mViewProjection); + gContext.mScreenFactor = gGizmoSizeClipSpace / (pointRight.x / pointRight.w - gContext.mMVP.v.position.x / gContext.mMVP.v.position.w); + + vec_t rightViewInverse = viewInverse.v.right; + rightViewInverse.TransformVector(gContext.mModelInverse); + float rightLength = GetSegmentLengthClipSpace(makeVect(0.f, 0.f), rightViewInverse); + gContext.mScreenFactor = gGizmoSizeClipSpace / rightLength; ImVec2 centerSSpace = worldToPos(makeVect(0.f, 0.f), gContext.mMVP); gContext.mScreenSquareCenter = centerSSpace; @@ -738,9 +829,9 @@ namespace ImGuizmo colors[0] = (type == MOVE_SCREEN) ? selectionColor : 0xFFFFFFFF; for (int i = 0; i < 3; i++) { - int colorPlaneIndex = (i + 2) % 3; colors[i + 1] = (type == (int)(MOVE_X + i)) ? selectionColor : directionColor[i]; - colors[i + 4] = (type == (int)(MOVE_XY + i)) ? selectionColor : directionColor[colorPlaneIndex]; + colors[i + 4] = (type == (int)(MOVE_YZ + i)) ? selectionColor : planeColor[i]; + colors[i + 4] = (type == MOVE_SCREEN) ? selectionColor : colors[i + 4]; } break; case ROTATE: @@ -753,8 +844,8 @@ namespace ImGuizmo for (int i = 0; i < 3; i++) colors[i + 1] = (type == (int)(SCALE_X + i)) ? selectionColor : directionColor[i]; break; - default: - break; + case BOUNDS: + break; } } else @@ -764,11 +855,11 @@ namespace ImGuizmo } } - static void ComputeTripodAxisAndVisibility(int axisIndex, vec_t& dirPlaneX, vec_t& dirPlaneY, bool& belowAxisLimit, bool& belowPlaneLimit) + static void ComputeTripodAxisAndVisibility(int axisIndex, vec_t& dirAxis, vec_t& dirPlaneX, vec_t& dirPlaneY, bool& belowAxisLimit, bool& belowPlaneLimit) { - const int planNormal = (axisIndex + 2) % 3; - dirPlaneX = directionUnary[axisIndex]; - dirPlaneY = directionUnary[(axisIndex + 1) % 3]; + dirAxis = directionUnary[axisIndex]; + dirPlaneX = directionUnary[(axisIndex + 1) % 3]; + dirPlaneY = directionUnary[(axisIndex + 2) % 3]; if (gContext.mbUsing) { @@ -781,34 +872,34 @@ namespace ImGuizmo } else { - vec_t dirPlaneNormalWorld; - dirPlaneNormalWorld.TransformVector(directionUnary[planNormal], gContext.mModel); - dirPlaneNormalWorld.Normalize(); + // new method + float lenDir = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), dirAxis); + float lenDirMinus = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), -dirAxis); - vec_t dirPlaneXWorld(dirPlaneX); - dirPlaneXWorld.TransformVector(gContext.mModel); - dirPlaneXWorld.Normalize(); + float lenDirPlaneX = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), dirPlaneX); + float lenDirMinusPlaneX = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), -dirPlaneX); - vec_t dirPlaneYWorld(dirPlaneY); - dirPlaneYWorld.TransformVector(gContext.mModel); - dirPlaneYWorld.Normalize(); + float lenDirPlaneY = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), dirPlaneY); + float lenDirMinusPlaneY = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), -dirPlaneY); - vec_t cameraEyeToGizmo = Normalized(gContext.mModel.v.position - gContext.mCameraEye); - float dotCameraDirX = cameraEyeToGizmo.Dot3(dirPlaneXWorld); - float dotCameraDirY = cameraEyeToGizmo.Dot3(dirPlaneYWorld); - - // compute factor values - float mulAxisX = (dotCameraDirX > 0.f) ? -1.f : 1.f; - float mulAxisY = (dotCameraDirY > 0.f) ? -1.f : 1.f; + float mulAxis = (lenDir < lenDirMinus && fabsf(lenDir - lenDirMinus) > FLT_EPSILON) ? -1.f : 1.f; + float mulAxisX = (lenDirPlaneX < lenDirMinusPlaneX && fabsf(lenDirPlaneX - lenDirMinusPlaneX) > FLT_EPSILON) ? -1.f : 1.f; + float mulAxisY = (lenDirPlaneY < lenDirMinusPlaneY && fabsf(lenDirPlaneY - lenDirMinusPlaneY) > FLT_EPSILON) ? -1.f : 1.f; + dirAxis *= mulAxis; dirPlaneX *= mulAxisX; dirPlaneY *= mulAxisY; - belowAxisLimit = fabsf(dotCameraDirX) < angleLimit; - belowPlaneLimit = (fabsf(cameraEyeToGizmo.Dot3(dirPlaneNormalWorld)) > planeLimit); + // for axis + float axisLengthInClipSpace = GetSegmentLengthClipSpace(makeVect(0.f, 0.f, 0.f), dirAxis * gContext.mScreenFactor); + + float paraSurf = GetParallelogram(makeVect(0.f, 0.f, 0.f), dirPlaneX * gContext.mScreenFactor, dirPlaneY * gContext.mScreenFactor); + belowPlaneLimit = (paraSurf > 0.0025f); + belowAxisLimit = (axisLengthInClipSpace > 0.02f); // and store values - gContext.mAxisFactor[axisIndex] = mulAxisX; - gContext.mAxisFactor[(axisIndex+1)%3] = mulAxisY; + gContext.mAxisFactor[axisIndex] = mulAxis; + gContext.mAxisFactor[(axisIndex + 1) % 3] = mulAxisY; + gContext.mAxisFactor[(axisIndex + 2) % 3] = mulAxisY; gContext.mBelowAxisLimit[axisIndex] = belowAxisLimit; gContext.mBelowPlaneLimit[axisIndex] = belowPlaneLimit; } @@ -855,13 +946,26 @@ namespace ImGuizmo ImU32 colors[7]; ComputeColors(colors, type, ROTATE); - vec_t cameraToModelNormalized = Normalized(gContext.mModel.v.position - gContext.mCameraEye); + vec_t cameraToModelNormalized; + if (gContext.mIsOrthographic) + { + matrix_t viewInverse; + viewInverse.Inverse(*(matrix_t*)&gContext.mViewMat); + cameraToModelNormalized = viewInverse.v.dir; + } + else + { + cameraToModelNormalized = Normalized(gContext.mModel.v.position - gContext.mCameraEye); + } + cameraToModelNormalized.TransformVector(gContext.mModelInverse); - - for (int axis = 0; axis < 3; axis++) + + gContext.mRadiusSquareCenter = screenRotateSize * gContext.mHeight; + + for (int axis = 0; axis < 3; axis++) { ImVec2 circlePos[halfCircleSegmentCount]; - + float angleStart = atan2f(cameraToModelNormalized[(4-axis)%3], cameraToModelNormalized[(3 - axis) % 3]) + ZPI * 0.5f; for (unsigned int i = 0; i < halfCircleSegmentCount; i++) @@ -871,9 +975,14 @@ namespace ImGuizmo vec_t pos = makeVect(axisPos[axis], axisPos[(axis+1)%3], axisPos[(axis+2)%3]) * gContext.mScreenFactor; circlePos[i] = worldToPos(pos, gContext.mMVP); } - drawList->AddPolyline(circlePos, halfCircleSegmentCount, colors[3 - axis], false, 2, true); + + float radiusAxis = sqrtf( (ImLengthSqr(worldToPos(gContext.mModel.v.position, gContext.mViewProjection) - circlePos[0]) )); + if(radiusAxis > gContext.mRadiusSquareCenter) + gContext.mRadiusSquareCenter = radiusAxis; + + drawList->AddPolyline(circlePos, halfCircleSegmentCount, colors[3 - axis], false, 2); } - drawList->AddCircle(worldToPos(gContext.mModel.v.position, gContext.mViewProjection), screenRotateSize * gContext.mHeight, colors[0], 64); + drawList->AddCircle(worldToPos(gContext.mModel.v.position, gContext.mViewProjection), gContext.mRadiusSquareCenter, colors[0], 64, 3.f); if (gContext.mbUsing) { @@ -890,8 +999,8 @@ namespace ImGuizmo pos *= gContext.mScreenFactor; circlePos[i] = worldToPos(pos + gContext.mModel.v.position, gContext.mViewProjection); } - drawList->AddConvexPolyFilled(circlePos, halfCircleSegmentCount, 0x801080FF, true); - drawList->AddPolyline(circlePos, halfCircleSegmentCount, 0xFF1080FF, true, 2, true); + drawList->AddConvexPolyFilled(circlePos, halfCircleSegmentCount, 0x801080FF); + drawList->AddPolyline(circlePos, halfCircleSegmentCount, 0xFF1080FF, true, 2); ImVec2 destinationPosOnScreen = circlePos[1]; char tmps[512]; @@ -919,42 +1028,42 @@ namespace ImGuizmo ImU32 colors[7]; ComputeColors(colors, type, SCALE); - // draw screen cirle - drawList->AddCircleFilled(gContext.mScreenSquareCenter, 12.f, colors[0], 32); - // draw vec_t scaleDisplay = { 1.f, 1.f, 1.f, 1.f }; - + if (gContext.mbUsing) scaleDisplay = gContext.mScale; for (unsigned int i = 0; i < 3; i++) { - vec_t dirPlaneX, dirPlaneY; + vec_t dirPlaneX, dirPlaneY, dirAxis; bool belowAxisLimit, belowPlaneLimit; - ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + ComputeTripodAxisAndVisibility(i, dirAxis, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); // draw axis if (belowAxisLimit) { - ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP); - ImVec2 worldDirSSpaceNoScale = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP); - ImVec2 worldDirSSpace = worldToPos((dirPlaneX * scaleDisplay[i]) * gContext.mScreenFactor, gContext.mMVP); + ImVec2 baseSSpace = worldToPos(dirAxis * 0.1f * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpaceNoScale = worldToPos(dirAxis * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpace = worldToPos((dirAxis * scaleDisplay[i]) * gContext.mScreenFactor, gContext.mMVP); if (gContext.mbUsing) { - drawList->AddLine(baseSSpace, worldDirSSpaceNoScale, 0xFF404040, 6.f); - drawList->AddCircleFilled(worldDirSSpaceNoScale, 10.f, 0xFF404040); + drawList->AddLine(baseSSpace, worldDirSSpaceNoScale, 0xFF404040, 3.f); + drawList->AddCircleFilled(worldDirSSpaceNoScale, 6.f, 0xFF404040); } - - drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f); - drawList->AddCircleFilled(worldDirSSpace, 10.f, colors[i + 1]); + + drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 3.f); + drawList->AddCircleFilled(worldDirSSpace, 6.f, colors[i + 1]); if (gContext.mAxisFactor[i] < 0.f) - DrawHatchedAxis(dirPlaneX * scaleDisplay[i]); + DrawHatchedAxis(dirAxis * scaleDisplay[i]); } } - + + // draw screen cirle + drawList->AddCircleFilled(gContext.mScreenSquareCenter, 6.f, colors[0], 32); + if (gContext.mbUsing) { //ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection); @@ -979,48 +1088,63 @@ namespace ImGuizmo static void DrawTranslationGizmo(int type) { ImDrawList* drawList = gContext.mDrawList; - if (!drawList) - return; + if (!drawList) + return; // colors ImU32 colors[7]; ComputeColors(colors, type, TRANSLATE); - // draw screen quad - drawList->AddRectFilled(gContext.mScreenSquareMin, gContext.mScreenSquareMax, colors[0], 2.f); + const ImVec2 origin = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); // draw - for (unsigned int i = 0; i < 3; i++) + bool belowAxisLimit = false; + bool belowPlaneLimit = false; + for (unsigned int i = 0; i < 3; ++i) { - vec_t dirPlaneX, dirPlaneY; - bool belowAxisLimit, belowPlaneLimit; - ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); - + vec_t dirPlaneX, dirPlaneY, dirAxis; + ComputeTripodAxisAndVisibility(i, dirAxis, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + // draw axis if (belowAxisLimit) { - ImVec2 baseSSpace = worldToPos(dirPlaneX * 0.1f * gContext.mScreenFactor, gContext.mMVP); - ImVec2 worldDirSSpace = worldToPos(dirPlaneX * gContext.mScreenFactor, gContext.mMVP); + ImVec2 baseSSpace = worldToPos(dirAxis * 0.1f * gContext.mScreenFactor, gContext.mMVP); + ImVec2 worldDirSSpace = worldToPos(dirAxis * gContext.mScreenFactor, gContext.mMVP); + + drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 3.f); + + // Arrow head begin + ImVec2 dir(origin - worldDirSSpace); + + float d = sqrtf(ImLengthSqr(dir)); + dir /= d; // Normalize + dir *= 6.0f; + + ImVec2 ortogonalDir(dir.y, -dir.x); // Perpendicular vector + ImVec2 a(worldDirSSpace + dir); + drawList->AddTriangleFilled(worldDirSSpace - dir, a + ortogonalDir, a - ortogonalDir, colors[i + 1]); + // Arrow head end - drawList->AddLine(baseSSpace, worldDirSSpace, colors[i + 1], 6.f); - if (gContext.mAxisFactor[i] < 0.f) - DrawHatchedAxis(dirPlaneX); + DrawHatchedAxis(dirAxis); } // draw plane if (belowPlaneLimit) { ImVec2 screenQuadPts[4]; - for (int j = 0; j < 4; j++) + for (int j = 0; j < 4; ++j) { vec_t cornerWorldPos = (dirPlaneX * quadUV[j * 2] + dirPlaneY * quadUV[j * 2 + 1]) * gContext.mScreenFactor; screenQuadPts[j] = worldToPos(cornerWorldPos, gContext.mMVP); } - drawList->AddConvexPolyFilled(screenQuadPts, 4, colors[i + 4], true); + drawList->AddPolyline(screenQuadPts, 4, directionColor[i], true, 1.0f); + drawList->AddConvexPolyFilled(screenQuadPts, 4, colors[i + 4]); } } + drawList->AddCircleFilled(gContext.mScreenSquareCenter, 6.f, colors[0], 32); + if (gContext.mbUsing) { ImVec2 sourcePosOnScreen = worldToPos(gContext.mMatrixOrigin, gContext.mViewProjection); @@ -1041,180 +1165,257 @@ namespace ImGuizmo } } - static void HandleAndDrawLocalBounds(float *bounds, matrix_t *matrix, float *snapValues) + static bool CanActivate() { - ImGuiIO& io = ImGui::GetIO(); - ImDrawList* drawList = gContext.mDrawList; + if (ImGui::IsMouseClicked(0) && !ImGui::IsAnyItemHovered() && !ImGui::IsAnyItemActive()) + return true; + return false; + } - // compute best projection axis - vec_t bestAxisWorldDirection; - int bestAxis = gContext.mBoundsBestAxis; - if (!gContext.mbUsingBounds) - { - - float bestDot = 0.f; - for (unsigned int i = 0; i < 3; i++) - { - vec_t dirPlaneNormalWorld; - dirPlaneNormalWorld.TransformVector(directionUnary[i], gContext.mModelSource); - dirPlaneNormalWorld.Normalize(); + static void HandleAndDrawLocalBounds(float *bounds, matrix_t *matrix, float *snapValues, OPERATION operation) + { + ImGuiIO& io = ImGui::GetIO(); + ImDrawList* drawList = gContext.mDrawList; - float dt = Dot(Normalized(gContext.mCameraEye - gContext.mModelSource.v.position), dirPlaneNormalWorld); - if (fabsf(dt) >= bestDot) - { - bestDot = fabsf(dt); - bestAxis = i; - bestAxisWorldDirection = dirPlaneNormalWorld; - } - } - } + // compute best projection axis + vec_t axesWorldDirections[3]; + vec_t bestAxisWorldDirection = { 0.0f, 0.0f, 0.0f, 0.0f }; + int axes[3]; + unsigned int numAxes = 1; + axes[0] = gContext.mBoundsBestAxis; + int bestAxis = axes[0]; + if (!gContext.mbUsingBounds) + { + numAxes = 0; + float bestDot = 0.f; + for (unsigned int i = 0; i < 3; i++) + { + vec_t dirPlaneNormalWorld; + dirPlaneNormalWorld.TransformVector(directionUnary[i], gContext.mModelSource); + dirPlaneNormalWorld.Normalize(); - // corners - vec_t aabb[4]; + float dt = fabsf( Dot(Normalized(gContext.mCameraEye - gContext.mModelSource.v.position), dirPlaneNormalWorld) ); + if ( dt >= bestDot ) + { + bestDot = dt; + bestAxis = i; + bestAxisWorldDirection = dirPlaneNormalWorld; + } - int secondAxis = (bestAxis + 1) % 3; - int thirdAxis = (bestAxis + 2) % 3; + if( dt >= 0.1f ) + { + axes[numAxes] = i; + axesWorldDirections[numAxes] = dirPlaneNormalWorld; + ++numAxes; + } + } + } - for (int i = 0; i < 4; i++) - { - aabb[i][3] = aabb[i][bestAxis] = 0.f; - aabb[i][secondAxis] = bounds[secondAxis + 3 * (i >> 1)]; - aabb[i][thirdAxis] = bounds[thirdAxis + 3 * ((i >> 1) ^ (i & 1))]; - } + if( numAxes == 0 ) + { + axes[0] = bestAxis; + axesWorldDirections[0] = bestAxisWorldDirection; + numAxes = 1; + } + else if( bestAxis != axes[0] ) + { + unsigned int bestIndex = 0; + for (unsigned int i = 0; i < numAxes; i++) + { + if( axes[i] == bestAxis ) + { + bestIndex = i; + break; + } + } + int tempAxis = axes[0]; + axes[0] = axes[bestIndex]; + axes[bestIndex] = tempAxis; + vec_t tempDirection = axesWorldDirections[0]; + axesWorldDirections[0] = axesWorldDirections[bestIndex]; + axesWorldDirections[bestIndex] = tempDirection; + } - // draw bounds - unsigned int anchorAlpha = gContext.mbEnable ? 0xFF000000 : 0x80000000; + for (unsigned int axisIndex = 0; axisIndex < numAxes; ++axisIndex) + { + bestAxis = axes[axisIndex]; + bestAxisWorldDirection = axesWorldDirections[axisIndex]; - matrix_t boundsMVP = gContext.mModelSource * gContext.mViewProjection; - for (int i = 0; i < 4;i++) - { - ImVec2 worldBound1 = worldToPos(aabb[i], boundsMVP); - ImVec2 worldBound2 = worldToPos(aabb[(i+1)%4], boundsMVP); - float boundDistance = sqrtf(ImLengthSqr(worldBound1 - worldBound2)); - int stepCount = (int)(boundDistance / 10.f); - float stepLength = 1.f / (float)stepCount; - for (int j = 0; j < stepCount; j++) - { - float t1 = (float)j * stepLength; - float t2 = (float)j * stepLength + stepLength * 0.5f; - ImVec2 worldBoundSS1 = ImLerp(worldBound1, worldBound2, ImVec2(t1, t1)); - ImVec2 worldBoundSS2 = ImLerp(worldBound1, worldBound2, ImVec2(t2, t2)); - drawList->AddLine(worldBoundSS1, worldBoundSS2, 0xAAAAAA + anchorAlpha, 3.f); - } - vec_t midPoint = (aabb[i] + aabb[(i + 1) % 4] ) * 0.5f; - ImVec2 midBound = worldToPos(midPoint, boundsMVP); - static const float AnchorBigRadius = 8.f; - static const float AnchorSmallRadius = 6.f; - bool overBigAnchor = ImLengthSqr(worldBound1 - io.MousePos) <= (AnchorBigRadius*AnchorBigRadius); - bool overSmallAnchor = ImLengthSqr(midBound - io.MousePos) <= (AnchorBigRadius*AnchorBigRadius); + // corners + vec_t aabb[4]; - - unsigned int bigAnchorColor = overBigAnchor ? selectionColor : (0xAAAAAA + anchorAlpha); - unsigned int smallAnchorColor = overSmallAnchor ? selectionColor : (0xAAAAAA + anchorAlpha); - - drawList->AddCircleFilled(worldBound1, AnchorBigRadius, bigAnchorColor); - drawList->AddCircleFilled(midBound, AnchorSmallRadius, smallAnchorColor); - int oppositeIndex = (i + 2) % 4; - // big anchor on corners - if (!gContext.mbUsingBounds && gContext.mbEnable && overBigAnchor && io.MouseDown[0]) - { - gContext.mBoundsPivot.TransformPoint(aabb[(i + 2) % 4], gContext.mModelSource); - gContext.mBoundsAnchor.TransformPoint(aabb[i], gContext.mModelSource); - gContext.mBoundsPlan = BuildPlan(gContext.mBoundsAnchor, bestAxisWorldDirection); - gContext.mBoundsBestAxis = bestAxis; - gContext.mBoundsAxis[0] = secondAxis; - gContext.mBoundsAxis[1] = thirdAxis; + int secondAxis = (bestAxis + 1) % 3; + int thirdAxis = (bestAxis + 2) % 3; - gContext.mBoundsLocalPivot.Set(0.f); - gContext.mBoundsLocalPivot[secondAxis] = aabb[oppositeIndex][secondAxis]; - gContext.mBoundsLocalPivot[thirdAxis] = aabb[oppositeIndex][thirdAxis]; + for (int i = 0; i < 4; i++) + { + aabb[i][3] = aabb[i][bestAxis] = 0.f; + aabb[i][secondAxis] = bounds[secondAxis + 3 * (i >> 1)]; + aabb[i][thirdAxis] = bounds[thirdAxis + 3 * ((i >> 1) ^ (i & 1))]; + } - gContext.mbUsingBounds = true; - gContext.mBoundsMatrix = gContext.mModelSource; - } - // small anchor on middle of segment - if (!gContext.mbUsingBounds && gContext.mbEnable && overSmallAnchor && io.MouseDown[0]) - { - vec_t midPointOpposite = (aabb[(i + 2) % 4] + aabb[(i + 3) % 4]) * 0.5f; - gContext.mBoundsPivot.TransformPoint(midPointOpposite, gContext.mModelSource); - gContext.mBoundsAnchor.TransformPoint(midPoint, gContext.mModelSource); - gContext.mBoundsPlan = BuildPlan(gContext.mBoundsAnchor, bestAxisWorldDirection); - gContext.mBoundsBestAxis = bestAxis; - int indices[] = { secondAxis , thirdAxis }; - gContext.mBoundsAxis[0] = indices[i%2]; - gContext.mBoundsAxis[1] = -1; + // draw bounds + unsigned int anchorAlpha = gContext.mbEnable ? 0xFF000000 : 0x80000000; - gContext.mBoundsLocalPivot.Set(0.f); - gContext.mBoundsLocalPivot[gContext.mBoundsAxis[0]] = aabb[oppositeIndex][indices[i % 2]];// bounds[gContext.mBoundsAxis[0]] * (((i + 1) & 2) ? 1.f : -1.f); + matrix_t boundsMVP = gContext.mModelSource * gContext.mViewProjection; + for (int i = 0; i < 4;i++) + { + ImVec2 worldBound1 = worldToPos(aabb[i], boundsMVP); + ImVec2 worldBound2 = worldToPos(aabb[(i+1)%4], boundsMVP); + if( !IsInContextRect( worldBound1 ) || !IsInContextRect( worldBound2 ) ) + { + continue; + } + float boundDistance = sqrtf(ImLengthSqr(worldBound1 - worldBound2)); + int stepCount = (int)(boundDistance / 10.f); + stepCount = min( stepCount, 1000 ); + float stepLength = 1.f / (float)stepCount; + for (int j = 0; j < stepCount; j++) + { + float t1 = (float)j * stepLength; + float t2 = (float)j * stepLength + stepLength * 0.5f; + ImVec2 worldBoundSS1 = ImLerp(worldBound1, worldBound2, ImVec2(t1, t1)); + ImVec2 worldBoundSS2 = ImLerp(worldBound1, worldBound2, ImVec2(t2, t2)); + //drawList->AddLine(worldBoundSS1, worldBoundSS2, 0x000000 + anchorAlpha, 3.f); + drawList->AddLine(worldBoundSS1, worldBoundSS2, 0xAAAAAA + anchorAlpha, 2.f); + } + vec_t midPoint = (aabb[i] + aabb[(i + 1) % 4] ) * 0.5f; + ImVec2 midBound = worldToPos(midPoint, boundsMVP); + static const float AnchorBigRadius = 8.f; + static const float AnchorSmallRadius = 6.f; + bool overBigAnchor = ImLengthSqr(worldBound1 - io.MousePos) <= (AnchorBigRadius*AnchorBigRadius); + bool overSmallAnchor = ImLengthSqr(midBound - io.MousePos) <= (AnchorBigRadius*AnchorBigRadius); - gContext.mbUsingBounds = true; - gContext.mBoundsMatrix = gContext.mModelSource; - } - } - - if (gContext.mbUsingBounds) - { - matrix_t scale; - scale.SetToIdentity(); + int type = NONE; + vec_t gizmoHitProportion; - // compute projected mouse position on plan - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mBoundsPlan); - vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; + switch (operation) + { + case TRANSLATE: type = GetMoveType(&gizmoHitProportion); break; + case ROTATE: type = GetRotateType(); break; + case SCALE: type = GetScaleType(); break; + case BOUNDS: break; + } + if (type != NONE) + { + overBigAnchor = false; + overSmallAnchor = false; + } - // compute a reference and delta vectors base on mouse move - vec_t deltaVector = (newPos - gContext.mBoundsPivot).Abs(); - vec_t referenceVector = (gContext.mBoundsAnchor - gContext.mBoundsPivot).Abs(); - // for 1 or 2 axes, compute a ratio that's used for scale and snap it based on resulting length - for (int i = 0; i < 2; i++) - { - int axisIndex = gContext.mBoundsAxis[i]; - if (axisIndex == -1) - continue; + unsigned int bigAnchorColor = overBigAnchor ? selectionColor : (0xAAAAAA + anchorAlpha); + unsigned int smallAnchorColor = overSmallAnchor ? selectionColor : (0xAAAAAA + anchorAlpha); - float ratioAxis = 1.f; - vec_t axisDir = gContext.mBoundsMatrix.component[axisIndex].Abs(); + drawList->AddCircleFilled(worldBound1, AnchorBigRadius, 0xFF000000); + drawList->AddCircleFilled(worldBound1, AnchorBigRadius-1.2f, bigAnchorColor); - float dtAxis = axisDir.Dot(referenceVector); - float boundSize = bounds[axisIndex + 3] - bounds[axisIndex]; - if (dtAxis > FLT_EPSILON) - ratioAxis = axisDir.Dot(deltaVector) / dtAxis; + drawList->AddCircleFilled(midBound, AnchorSmallRadius, 0xFF000000); + drawList->AddCircleFilled(midBound, AnchorSmallRadius-1.2f, smallAnchorColor); + int oppositeIndex = (i + 2) % 4; + // big anchor on corners + if (!gContext.mbUsingBounds && gContext.mbEnable && overBigAnchor && CanActivate()) + { + gContext.mBoundsPivot.TransformPoint(aabb[(i + 2) % 4], gContext.mModelSource); + gContext.mBoundsAnchor.TransformPoint(aabb[i], gContext.mModelSource); + gContext.mBoundsPlan = BuildPlan(gContext.mBoundsAnchor, bestAxisWorldDirection); + gContext.mBoundsBestAxis = bestAxis; + gContext.mBoundsAxis[0] = secondAxis; + gContext.mBoundsAxis[1] = thirdAxis; - if (snapValues) - { - float length = boundSize * ratioAxis; - ComputeSnap(&length, snapValues[axisIndex]); - if (boundSize > FLT_EPSILON) - ratioAxis = length / boundSize; - } - scale.component[axisIndex] *= ratioAxis; - } + gContext.mBoundsLocalPivot.Set(0.f); + gContext.mBoundsLocalPivot[secondAxis] = aabb[oppositeIndex][secondAxis]; + gContext.mBoundsLocalPivot[thirdAxis] = aabb[oppositeIndex][thirdAxis]; - // transform matrix - matrix_t preScale, postScale; - preScale.Translation(-gContext.mBoundsLocalPivot); - postScale.Translation(gContext.mBoundsLocalPivot); - matrix_t res = preScale * scale * postScale * gContext.mBoundsMatrix; - *matrix = res; + gContext.mbUsingBounds = true; + gContext.mBoundsMatrix = gContext.mModelSource; + } + // small anchor on middle of segment + if (!gContext.mbUsingBounds && gContext.mbEnable && overSmallAnchor && CanActivate()) + { + vec_t midPointOpposite = (aabb[(i + 2) % 4] + aabb[(i + 3) % 4]) * 0.5f; + gContext.mBoundsPivot.TransformPoint(midPointOpposite, gContext.mModelSource); + gContext.mBoundsAnchor.TransformPoint(midPoint, gContext.mModelSource); + gContext.mBoundsPlan = BuildPlan(gContext.mBoundsAnchor, bestAxisWorldDirection); + gContext.mBoundsBestAxis = bestAxis; + int indices[] = { secondAxis , thirdAxis }; + gContext.mBoundsAxis[0] = indices[i%2]; + gContext.mBoundsAxis[1] = -1; - // info text - char tmps[512]; - ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); - ImFormatString(tmps, sizeof(tmps), "X: %.2f Y: %.2f Z:%.2f" - , (bounds[3] - bounds[0]) * gContext.mBoundsMatrix.component[0].Length() * scale.component[0].Length() - , (bounds[4] - bounds[1]) * gContext.mBoundsMatrix.component[1].Length() * scale.component[1].Length() - , (bounds[5] - bounds[2]) * gContext.mBoundsMatrix.component[2].Length() * scale.component[2].Length() - ); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); - drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); - } + gContext.mBoundsLocalPivot.Set(0.f); + gContext.mBoundsLocalPivot[gContext.mBoundsAxis[0]] = aabb[oppositeIndex][indices[i % 2]];// bounds[gContext.mBoundsAxis[0]] * (((i + 1) & 2) ? 1.f : -1.f); - if (!io.MouseDown[0]) - gContext.mbUsingBounds = false; + gContext.mbUsingBounds = true; + gContext.mBoundsMatrix = gContext.mModelSource; + } + } + + if (gContext.mbUsingBounds) + { + matrix_t scale; + scale.SetToIdentity(); + + // compute projected mouse position on plan + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mBoundsPlan); + vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; + + // compute a reference and delta vectors base on mouse move + vec_t deltaVector = (newPos - gContext.mBoundsPivot).Abs(); + vec_t referenceVector = (gContext.mBoundsAnchor - gContext.mBoundsPivot).Abs(); + + // for 1 or 2 axes, compute a ratio that's used for scale and snap it based on resulting length + for (int i = 0; i < 2; i++) + { + int axisIndex1 = gContext.mBoundsAxis[i]; + if (axisIndex1 == -1) + continue; + + float ratioAxis = 1.f; + vec_t axisDir = gContext.mBoundsMatrix.component[axisIndex1].Abs(); + + float dtAxis = axisDir.Dot(referenceVector); + float boundSize = bounds[axisIndex1 + 3] - bounds[axisIndex1]; + if (dtAxis > FLT_EPSILON) + ratioAxis = axisDir.Dot(deltaVector) / dtAxis; + + if (snapValues) + { + float length = boundSize * ratioAxis; + ComputeSnap(&length, snapValues[axisIndex1]); + if (boundSize > FLT_EPSILON) + ratioAxis = length / boundSize; + } + scale.component[axisIndex1] *= ratioAxis; + } + + // transform matrix + matrix_t preScale, postScale; + preScale.Translation(-gContext.mBoundsLocalPivot); + postScale.Translation(gContext.mBoundsLocalPivot); + matrix_t res = preScale * scale * postScale * gContext.mBoundsMatrix; + *matrix = res; + + // info text + char tmps[512]; + ImVec2 destinationPosOnScreen = worldToPos(gContext.mModel.v.position, gContext.mViewProjection); + ImFormatString(tmps, sizeof(tmps), "X: %.2f Y: %.2f Z:%.2f" + , (bounds[3] - bounds[0]) * gContext.mBoundsMatrix.component[0].Length() * scale.component[0].Length() + , (bounds[4] - bounds[1]) * gContext.mBoundsMatrix.component[1].Length() * scale.component[1].Length() + , (bounds[5] - bounds[2]) * gContext.mBoundsMatrix.component[2].Length() * scale.component[2].Length() + ); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 15, destinationPosOnScreen.y + 15), 0xFF000000, tmps); + drawList->AddText(ImVec2(destinationPosOnScreen.x + 14, destinationPosOnScreen.y + 14), 0xFFFFFFFF, tmps); + } + + if (!io.MouseDown[0]) + gContext.mbUsingBounds = false; + + if( gContext.mbUsingBounds ) + break; + } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // + // static int GetScaleType() { @@ -1226,25 +1427,24 @@ namespace ImGuizmo io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y) type = SCALE_XYZ; - const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir }; // compute for (unsigned int i = 0; i < 3 && type == NONE; i++) { - vec_t dirPlaneX, dirPlaneY; + vec_t dirPlaneX, dirPlaneY, dirAxis; bool belowAxisLimit, belowPlaneLimit; - ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); - dirPlaneX.TransformVector(gContext.mModel); - dirPlaneY.TransformVector(gContext.mModel); + ComputeTripodAxisAndVisibility(i, dirAxis, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); - const int planNormal = (i + 2) % 3; + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, dirAxis)); + vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal])); - vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; + const ImVec2 posOnPlanScreen = worldToPos(posOnPlan, gContext.mViewProjection); + const ImVec2 axisStartOnScreen = worldToPos(gContext.mModel.v.position + dirAxis * gContext.mScreenFactor * 0.1f, gContext.mViewProjection); + const ImVec2 axisEndOnScreen = worldToPos(gContext.mModel.v.position + dirAxis * gContext.mScreenFactor, gContext.mViewProjection); - const float dx = dirPlaneX.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - const float dy = dirPlaneY.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f) - type = SCALE_X + i; + vec_t closestPointOnAxis = PointOnSegment(makeVect(posOnPlanScreen), makeVect(axisStartOnScreen), makeVect(axisEndOnScreen)); + + if ((closestPointOnAxis - makeVect(posOnPlanScreen)).Length() < 12.f) // pixel size + type = SCALE_X + i; } return type; } @@ -1256,7 +1456,7 @@ namespace ImGuizmo vec_t deltaScreen = { io.MousePos.x - gContext.mScreenSquareCenter.x, io.MousePos.y - gContext.mScreenSquareCenter.y, 0.f, 0.f }; float dist = deltaScreen.Length(); - if (dist >= (screenRotateSize - 0.002f) * gContext.mHeight && dist < (screenRotateSize + 0.002f) * gContext.mHeight) + if (dist >= (gContext.mRadiusSquareCenter - 1.0f) && dist < (gContext.mRadiusSquareCenter + 1.0f)) type = ROTATE_SCREEN; const vec_t planNormals[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir}; @@ -1271,12 +1471,18 @@ namespace ImGuizmo if (Dot(Normalized(localPos), gContext.mRayVector) > FLT_EPSILON) continue; + vec_t idealPosOnCircle = Normalized(localPos); + idealPosOnCircle.TransformVector(gContext.mModelInverse); + ImVec2 idealPosOnCircleScreen = worldToPos(idealPosOnCircle * gContext.mScreenFactor, gContext.mMVP); - float distance = localPos.Length() / gContext.mScreenFactor; - if (distance > 0.9f && distance < 1.1f) + //gContext.mDrawList->AddCircle(idealPosOnCircleScreen, 5.f, 0xFFFFFFFF); + ImVec2 distanceOnScreen = idealPosOnCircleScreen - io.MousePos; + + float distance = makeVect(distanceOnScreen).Length(); + if (distance < 8.f) // pixel size type = ROTATE_X + i; } - + return type; } @@ -1290,29 +1496,32 @@ namespace ImGuizmo io.MousePos.y >= gContext.mScreenSquareMin.y && io.MousePos.y <= gContext.mScreenSquareMax.y) type = MOVE_SCREEN; - const vec_t direction[3] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir }; - // compute for (unsigned int i = 0; i < 3 && type == NONE; i++) { - vec_t dirPlaneX, dirPlaneY; + vec_t dirPlaneX, dirPlaneY, dirAxis; bool belowAxisLimit, belowPlaneLimit; - ComputeTripodAxisAndVisibility(i, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + ComputeTripodAxisAndVisibility(i, dirAxis, dirPlaneX, dirPlaneY, belowAxisLimit, belowPlaneLimit); + dirAxis.TransformVector(gContext.mModel); dirPlaneX.TransformVector(gContext.mModel); dirPlaneY.TransformVector(gContext.mModel); - const int planNormal = (i + 2) % 3; - - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, direction[planNormal])); + const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, BuildPlan(gContext.mModel.v.position, dirAxis)); vec_t posOnPlan = gContext.mRayOrigin + gContext.mRayVector * len; - const float dx = dirPlaneX.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - const float dy = dirPlaneY.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); - if (belowAxisLimit && dy > -0.1f && dy < 0.1f && dx > 0.1f && dx < 1.f) + const ImVec2 posOnPlanScreen = worldToPos(posOnPlan, gContext.mViewProjection); + const ImVec2 axisStartOnScreen = worldToPos(gContext.mModel.v.position + dirAxis * gContext.mScreenFactor * 0.1f, gContext.mViewProjection); + const ImVec2 axisEndOnScreen = worldToPos(gContext.mModel.v.position + dirAxis * gContext.mScreenFactor, gContext.mViewProjection); + + vec_t closestPointOnAxis = PointOnSegment(makeVect(posOnPlanScreen), makeVect(axisStartOnScreen), makeVect(axisEndOnScreen)); + + if ((closestPointOnAxis - makeVect(posOnPlanScreen)).Length() < 12.f) // pixel size type = MOVE_X + i; + const float dx = dirPlaneX.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); + const float dy = dirPlaneY.Dot3((posOnPlan - gContext.mModel.v.position) * (1.f / gContext.mScreenFactor)); if (belowPlaneLimit && dx >= quadUV[0] && dx <= quadUV[4] && dy >= quadUV[1] && dy <= quadUV[3]) - type = MOVE_XY + i; + type = MOVE_YZ + i; if (gizmoHitProportion) *gizmoHitProportion = makeVect(dx, dy, 0.f); @@ -1328,13 +1537,16 @@ namespace ImGuizmo // move if (gContext.mbUsing) { - const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); + ImGui::CaptureMouseFromApp(); + const float len = fabsf(IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan)); // near plan vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; + + // compute delta vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor; vec_t delta = newOrigin - gContext.mModel.v.position; - + // 1 axis constraint if (gContext.mCurrentOperation >= MOVE_X && gContext.mCurrentOperation <= MOVE_Z) { @@ -1386,11 +1598,25 @@ namespace ImGuizmo // find new possible way to move vec_t gizmoHitProportion; type = GetMoveType(&gizmoHitProportion); - if (io.MouseDown[0] && type != NONE) + if(type != NONE) { - gContext.mbUsing = true; - gContext.mCurrentOperation = type; - const vec_t movePlanNormal[] = { gContext.mModel.v.up, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.dir, gContext.mModel.v.right, gContext.mModel.v.up, -gContext.mCameraDir }; + ImGui::CaptureMouseFromApp(); + } + if (CanActivate() && type != NONE) + { + gContext.mbUsing = true; + gContext.mCurrentOperation = type; + vec_t movePlanNormal[] = { gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir, + gContext.mModel.v.right, gContext.mModel.v.up, gContext.mModel.v.dir, + -gContext.mCameraDir }; + + vec_t cameraToModelNormalized = Normalized(gContext.mModel.v.position - gContext.mCameraEye); + for (unsigned int i = 0; i < 3; i++) + { + vec_t orthoVector = Cross(movePlanNormal[i], cameraToModelNormalized); + movePlanNormal[i].Cross(orthoVector); + movePlanNormal[i].Normalize(); + } // pickup plan gContext.mTranslationPlan = BuildPlan(gContext.mModel.v.position, movePlanNormal[type - MOVE_X]); const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); @@ -1410,7 +1636,11 @@ namespace ImGuizmo { // find new possible way to scale type = GetScaleType(); - if (io.MouseDown[0] && type != NONE) + if(type != NONE) + { + ImGui::CaptureMouseFromApp(); + } + if (CanActivate() && type != NONE) { gContext.mbUsing = true; gContext.mCurrentOperation = type; @@ -1430,11 +1660,12 @@ namespace ImGuizmo // scale if (gContext.mbUsing) { + ImGui::CaptureMouseFromApp(); const float len = IntersectRayPlane(gContext.mRayOrigin, gContext.mRayVector, gContext.mTranslationPlan); vec_t newPos = gContext.mRayOrigin + gContext.mRayVector * len; vec_t newOrigin = newPos - gContext.mRelativeOrigin * gContext.mScreenFactor; vec_t delta = newOrigin - gContext.mModel.v.position; - + // 1 axis constraint if (gContext.mCurrentOperation >= SCALE_X && gContext.mCurrentOperation <= SCALE_Z) { @@ -1445,11 +1676,11 @@ namespace ImGuizmo vec_t baseVector = gContext.mTranslationPlanOrigin - gContext.mModel.v.position; float ratio = Dot(axisValue, baseVector + delta) / Dot(axisValue, baseVector); - + gContext.mScale[axisIndex] = max(ratio, 0.001f); } else - { + { float scaleDelta = (io.MousePos.x - gContext.mSaveMousePosx) * 0.01f; gContext.mScale.Set(max(1.f + scaleDelta, 0.001f)); } @@ -1468,10 +1699,10 @@ namespace ImGuizmo // compute matrix & delta matrix_t deltaMatrixScale; deltaMatrixScale.Scale(gContext.mScale * gContext.mScaleValueOrigin); - + matrix_t res = deltaMatrixScale * gContext.mModel; *(matrix_t*)matrix = res; - + if (deltaMatrix) { deltaMatrixScale.Scale(gContext.mScale); @@ -1493,13 +1724,18 @@ namespace ImGuizmo if (!gContext.mbUsing) { type = GetRotateType(); - + + if(type != NONE) + { + ImGui::CaptureMouseFromApp(); + } + if (type == ROTATE_SCREEN) { applyRotationLocaly = true; } - - if (io.MouseDown[0] && type != NONE) + + if (CanActivate() && type != NONE) { gContext.mbUsing = true; gContext.mCurrentOperation = type; @@ -1524,6 +1760,7 @@ namespace ImGuizmo // rotation if (gContext.mbUsing) { + ImGui::CaptureMouseFromApp(); gContext.mRotationAngle = ComputeAngleOnPlan(); if (snap) { @@ -1531,7 +1768,7 @@ namespace ImGuizmo ComputeSnap(&gContext.mRotationAngle, snapInRadian); } vec_t rotationAxisLocalSpace; - + rotationAxisLocalSpace.TransformVector(makeVect(gContext.mTranslationPlan.x, gContext.mTranslationPlan.y, gContext.mTranslationPlan.z, 0.f), gContext.mModelInverse); rotationAxisLocalSpace.Normalize(); @@ -1541,7 +1778,7 @@ namespace ImGuizmo matrix_t scaleOrigin; scaleOrigin.Scale(gContext.mModelScaleOrigin); - + if (applyRotationLocaly) { *(matrix_t*)matrix = scaleOrigin * deltaRotation * gContext.mModel; @@ -1573,7 +1810,7 @@ namespace ImGuizmo scale[0] = mat.v.right.Length(); scale[1] = mat.v.up.Length(); - scale[2] = mat.v.dir.Length(); + scale[2] = mat.v.dir.Length(); mat.OrthoNormalize(); @@ -1614,7 +1851,7 @@ namespace ImGuizmo { ComputeContext(view, projection, matrix, mode); - // set delta to identity + // set delta to identity if (deltaMatrix) ((matrix_t*)deltaMatrix)->SetToIdentity(); @@ -1624,48 +1861,52 @@ namespace ImGuizmo if (camSpacePosition.z < 0.001f) return; - // -- + // -- int type = NONE; if (gContext.mbEnable) { - if (!gContext.mbUsingBounds) - { - switch (operation) - { - case ROTATE: - HandleRotation(matrix, deltaMatrix, type, snap); - break; - case TRANSLATE: - HandleTranslation(matrix, deltaMatrix, type, snap); - break; - case SCALE: - HandleScale(matrix, deltaMatrix, type, snap); - break; - } - } + if (!gContext.mbUsingBounds) + { + switch (operation) + { + case ROTATE: + HandleRotation(matrix, deltaMatrix, type, snap); + break; + case TRANSLATE: + HandleTranslation(matrix, deltaMatrix, type, snap); + break; + case SCALE: + HandleScale(matrix, deltaMatrix, type, snap); + break; + case BOUNDS: + break; + } + } } - if (localBounds && !gContext.mbUsing) - HandleAndDrawLocalBounds(localBounds, (matrix_t*)matrix, boundsSnap); + if (localBounds && !gContext.mbUsing) + HandleAndDrawLocalBounds(localBounds, (matrix_t*)matrix, boundsSnap, operation); - if (!gContext.mbUsingBounds) - { - switch (operation) - { - case ROTATE: - DrawRotationGizmo(type); - break; - case TRANSLATE: - DrawTranslationGizmo(type); - break; - case SCALE: - DrawScaleGizmo(type); - break; - } - } + if (!gContext.mbUsingBounds) + { + switch (operation) + { + case ROTATE: + DrawRotationGizmo(type); + break; + case TRANSLATE: + DrawTranslationGizmo(type); + break; + case SCALE: + DrawScaleGizmo(type); + break; + case BOUNDS: + break; + } + } } - void DrawCube(const float *view, const float *projection, float *matrix) + void DrawCube(const float *view, const float *projection, const float *matrix) { matrix_t viewInverse; viewInverse.Inverse(*(matrix_t*)view); @@ -1678,7 +1919,7 @@ namespace ImGuizmo const int perpXIndex = (normalIndex + 1) % 3; const int perpYIndex = (normalIndex + 2) % 3; const float invert = (iFace > 2) ? -1.f : 1.f; - + const vec_t faceCoords[4] = { directionUnary[normalIndex] + directionUnary[perpXIndex] + directionUnary[perpYIndex], directionUnary[normalIndex] + directionUnary[perpXIndex] - directionUnary[perpYIndex], directionUnary[normalIndex] - directionUnary[perpXIndex] - directionUnary[perpYIndex], @@ -1705,7 +1946,7 @@ namespace ImGuizmo for (unsigned int iCoord = 0; iCoord < 4; iCoord++) faceCoordsScreen[iCoord] = worldToPos(faceCoords[iCoord] * 0.5f * invert, res); - // back face culling + // back face culling vec_t cullPos, cullNormal; cullPos.TransformPoint(faceCoords[0] * 0.5f * invert, model); cullNormal.TransformVector(directionUnary[normalIndex] * invert, model); @@ -1714,7 +1955,18 @@ namespace ImGuizmo continue; // draw face with lighter color - gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, directionColor[normalIndex] | 0x808080, true); + gContext.mDrawList->AddConvexPolyFilled(faceCoordsScreen, 4, directionColor[normalIndex] | 0x808080); + } + } + + void DrawGrid(const float *view, const float *projection, const float *matrix, const float gridSize) + { + matrix_t res = *(matrix_t*)matrix * *(matrix_t*)view * *(matrix_t*)projection; + + for (float f = -gridSize; f <= gridSize; f += 1.f) + { + gContext.mDrawList->AddLine(worldToPos(makeVect(f, 0.f, -gridSize), res), worldToPos(makeVect(f, 0.f, gridSize), res), 0xFF808080); + gContext.mDrawList->AddLine(worldToPos(makeVect(-gridSize, 0.f, f), res), worldToPos(makeVect(gridSize, 0.f, f), res), 0xFF808080); } } }; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/memory_editor.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/memory_editor.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/memory_editor.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/memory_editor.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/memory_editor.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl similarity index 97% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/memory_editor.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl index d8b1464c65d..9b1e930e650 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/memory_editor.inl +++ b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/memory_editor.inl @@ -16,7 +16,7 @@ namespace ImGui unsigned char* mem_data = (unsigned char*)mem_data_void; - BeginChild("##scrolling", ImVec2(0, -GetItemsLineHeightWithSpacing())); + BeginChild("##scrolling", ImVec2(0, -GetFrameHeight())); if (ImGui::BeginPopupContextWindow() ) { @@ -89,7 +89,7 @@ namespace ImGui struct FuncHolder { // FIXME: We should have a way to retrieve the text edit cursor position more easily in the API, this is rather tedious. - static int Callback(ImGuiTextEditCallbackData* data) + static int Callback(ImGuiInputTextCallbackData* data) { int* p_cursor_pos = (int*)data->UserData; if (!data->HasSelection()) @@ -202,7 +202,7 @@ namespace ImGui Separator(); - AlignFirstTextHeightToWidgets(); + AlignTextToFramePadding(); PushItemWidth(50); PushAllowKeyboardFocus(false); int rows_backup = Rows; diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/range_slider.h b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/range_slider.h similarity index 100% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/range_slider.h rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/range_slider.h diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/range_slider.inl b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl similarity index 90% rename from 3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/range_slider.inl rename to 3rdparty/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl index 5b3fc602fab..4d6d263cf10 100644 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/widgets/range_slider.inl +++ b/3rdparty/bgfx/3rdparty/dear-imgui/widgets/range_slider.inl @@ -4,6 +4,10 @@ namespace ImGui { +extern float RoundScalarWithFormatFloat(const char* format, ImGuiDataType data_type, float v); + +extern float SliderCalcRatioFromValueFloat(ImGuiDataType data_type, float v, float v_min, float v_max, float power, float linear_zero_pos); + // ~80% common code with ImGui::SliderBehavior bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v2, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags) { @@ -83,8 +87,11 @@ bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v new_value = ImLerp(v_min, v_max, clicked_t); } + char fmt[64]; + snprintf(fmt, 64, "%%.%df", decimal_precision); + // Round past decimal precision - new_value = RoundScalar(new_value, decimal_precision); + new_value = RoundScalarWithFormatFloat(fmt, ImGuiDataType_Float, new_value); if (*v1 != new_value || *v2 != new_value) { if (fabsf(*v1 - new_value) < fabsf(*v2 - new_value)) @@ -105,7 +112,7 @@ bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v } // Calculate slider grab positioning - float grab_t = SliderBehaviorCalcRatioFromValue(*v1, v_min, v_max, power, linear_zero_pos); + float grab_t = SliderCalcRatioFromValueFloat(ImGuiDataType_Float, *v1, v_min, v_max, power, linear_zero_pos); // Draw if (!is_horizontal) @@ -119,7 +126,7 @@ bool RangeSliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v1, float* v window->DrawList->AddRectFilled(grab_bb1.Min, grab_bb1.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding); // Calculate slider grab positioning - grab_t = SliderBehaviorCalcRatioFromValue(*v2, v_min, v_max, power, linear_zero_pos); + grab_t = SliderCalcRatioFromValueFloat(ImGuiDataType_Float, *v2, v_min, v_max, power, linear_zero_pos); // Draw if (!is_horizontal) @@ -172,7 +179,7 @@ bool RangeSliderFloat(const char* label, float* v1, float* v2, float v_min, floa if (!display_format) display_format = "(%.3f, %.3f)"; - int decimal_precision = ParseFormatPrecision(display_format, 3); + int decimal_precision = ImParseFormatPrecision(display_format, 3); // Tabbing or CTRL-clicking on Slider turns it into an input box bool start_text_input = false; @@ -188,8 +195,13 @@ bool RangeSliderFloat(const char* label, float* v1, float* v2, float v_min, floa g.ScalarAsInputTextId = 0; } } + if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) - return InputScalarAsWidgetReplacement(frame_bb, label, ImGuiDataType_Float, v1, id, decimal_precision); + { + char fmt[64]; + snprintf(fmt, 64, "%%.%df", decimal_precision); + return InputScalarAsWidgetReplacement(frame_bb, id, label, ImGuiDataType_Float, v1, fmt); + } ItemSize(total_bb, style.FramePadding.y); diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/PIXEventsCommon.h b/3rdparty/bgfx/3rdparty/dxsdk/include/PIXEventsCommon.h new file mode 100644 index 00000000000..515d1743472 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/PIXEventsCommon.h @@ -0,0 +1,483 @@ +/*==========================================================================; +* +* Copyright (C) Microsoft Corporation. All Rights Reserved. +* +* File: PIXEventsCommon.h +* Content: PIX include file +* Don't include this file directly - use pix3.h +* +****************************************************************************/ +#pragma once + +#ifndef _PIXEventsCommon_H_ +#define _PIXEventsCommon_H_ + +#if defined(_AMD64_) || defined(_X86_) +#include +#endif // _AMD64_ || _X86_ + +enum PIXEventType +{ + PIXEvent_EndEvent = 0x000, + PIXEvent_BeginEvent_VarArgs = 0x001, + PIXEvent_BeginEvent_NoArgs = 0x002, + PIXEvent_SetMarker_VarArgs = 0x007, + PIXEvent_SetMarker_NoArgs = 0x008, + + PIXEvent_EndEvent_OnContext = 0x010, + PIXEvent_BeginEvent_OnContext_VarArgs = 0x011, + PIXEvent_BeginEvent_OnContext_NoArgs = 0x012, + PIXEvent_SetMarker_OnContext_VarArgs = 0x017, + PIXEvent_SetMarker_OnContext_NoArgs = 0x018, +}; + +static const UINT64 PIXEventsReservedRecordSpaceQwords = 64; +//this is used to make sure SSE string copy always will end 16-byte write in the current block +//this way only a check if destination < limit can be performed, instead of destination < limit - 1 +//since both these are UINT64* and SSE writes in 16 byte chunks, 8 bytes are kept in reserve +//so even if SSE overwrites 8 extra bytes, those will still belong to the correct block +//on next iteration check destination will be greater than limit +//this is used as well for fixed size UMD events and PIXEndEvent since these require less space +//than other variable length user events and do not need big reserved space +static const UINT64 PIXEventsReservedTailSpaceQwords = 2; +static const UINT64 PIXEventsSafeFastCopySpaceQwords = PIXEventsReservedRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; +static const UINT64 PIXEventsGraphicsRecordSpaceQwords = 64; + +//Bits 7-19 (13 bits) +static const UINT64 PIXEventsBlockEndMarker = 0x00000000000FFF80; + +//Bits 10-19 (10 bits) +static const UINT64 PIXEventsTypeReadMask = 0x00000000000FFC00; +static const UINT64 PIXEventsTypeWriteMask = 0x00000000000003FF; +static const UINT64 PIXEventsTypeBitShift = 10; + +//Bits 20-63 (44 bits) +static const UINT64 PIXEventsTimestampReadMask = 0xFFFFFFFFFFF00000; +static const UINT64 PIXEventsTimestampWriteMask = 0x00000FFFFFFFFFFF; +static const UINT64 PIXEventsTimestampBitShift = 20; + +inline UINT64 PIXEncodeEventInfo(UINT64 timestamp, PIXEventType eventType) +{ + return ((timestamp & PIXEventsTimestampWriteMask) << PIXEventsTimestampBitShift) | + (((UINT64)eventType & PIXEventsTypeWriteMask) << PIXEventsTypeBitShift); +} + +//Bits 60-63 (4) +static const UINT64 PIXEventsStringAlignmentWriteMask = 0x000000000000000F; +static const UINT64 PIXEventsStringAlignmentReadMask = 0xF000000000000000; +static const UINT64 PIXEventsStringAlignmentBitShift = 60; + +//Bits 55-59 (5) +static const UINT64 PIXEventsStringCopyChunkSizeWriteMask = 0x000000000000001F; +static const UINT64 PIXEventsStringCopyChunkSizeReadMask = 0x0F80000000000000; +static const UINT64 PIXEventsStringCopyChunkSizeBitShift = 55; + +//Bit 54 +static const UINT64 PIXEventsStringIsANSIWriteMask = 0x0000000000000001; +static const UINT64 PIXEventsStringIsANSIReadMask = 0x0040000000000000; +static const UINT64 PIXEventsStringIsANSIBitShift = 54; + +//Bit 53 +static const UINT64 PIXEventsStringIsShortcutWriteMask = 0x0000000000000001; +static const UINT64 PIXEventsStringIsShortcutReadMask = 0x0020000000000000; +static const UINT64 PIXEventsStringIsShortcutBitShift = 53; + +inline UINT64 PIXEncodeStringInfo(UINT64 alignment, UINT64 copyChunkSize, BOOL isANSI, BOOL isShortcut) +{ + return ((alignment & PIXEventsStringAlignmentWriteMask) << PIXEventsStringAlignmentBitShift) | + ((copyChunkSize & PIXEventsStringCopyChunkSizeWriteMask) << PIXEventsStringCopyChunkSizeBitShift) | + (((UINT64)isANSI & PIXEventsStringIsANSIWriteMask) << PIXEventsStringIsANSIBitShift) | + (((UINT64)isShortcut & PIXEventsStringIsShortcutWriteMask) << PIXEventsStringIsShortcutBitShift); +} + +template +inline bool PIXIsPointerAligned(T* pointer) +{ + return !(((UINT64)pointer) & (alignment - 1)); +} + +template +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, T argument) +{ + if (destination < limit) + { + *((T*)destination) = argument; + ++destination; + } +} + +//floats must be cast to double during writing the data to be properly printed later when reading the data +//this is needed because when float is passed to varargs function it's cast to double +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, float argument) +{ + if (destination < limit) + { + *((double*)destination) = (double)(argument); + ++destination; + } +} + +//char has to be cast to a longer signed integer type +//this is due to printf not ignoring correctly the upper bits of unsigned long long for a char format specifier +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, char argument) +{ + if (destination < limit) + { + *((INT64*)destination) = (INT64)(argument); + ++destination; + } +} + +//unsigned char has to be cast to a longer unsigned integer type +//this is due to printf not ignoring correctly the upper bits of unsigned long long for a char format specifier +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, unsigned char argument) +{ + if (destination < limit) + { + *destination = (UINT64)(argument); + ++destination; + } +} + +//bool has to be cast to an integer since it's not explicitly supported by string format routines +//there's no format specifier for bool type, but it should work with integer format specifiers +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, bool argument) +{ + if (destination < limit) + { + *destination = (UINT64)(argument); + ++destination; + } +} + +inline void PIXCopyEventArgumentSlowest(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCSTR argument) +{ + *destination++ = PIXEncodeStringInfo(0, 8, TRUE, FALSE); + while (destination < limit) + { + UINT64 c = argument[0]; + if (!c) + { + *destination++ = 0; + return; + } + UINT64 x = c; + c = argument[1]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 8; + c = argument[2]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 16; + c = argument[3]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 24; + c = argument[4]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 32; + c = argument[5]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 40; + c = argument[6]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 48; + c = argument[7]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 56; + *destination++ = x; + argument += 8; + } +} + +inline void PIXCopyEventArgumentSlow(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCSTR argument) +{ + if (PIXIsPointerAligned<8>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 8, TRUE, FALSE); + UINT64* source = (UINT64*)argument; + while (destination < limit) + { + UINT64 qword = *source++; + *destination++ = qword; + //check if any of the characters is a terminating zero + if (!((qword & 0xFF00000000000000) && + (qword & 0xFF000000000000) && + (qword & 0xFF0000000000) && + (qword & 0xFF00000000) && + (qword & 0xFF000000) && + (qword & 0xFF0000) && + (qword & 0xFF00) && + (qword & 0xFF))) + { + break; + } + } + } + else + { + PIXCopyEventArgumentSlowest(destination, limit, argument); + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCSTR argument) +{ + if (destination < limit) + { + if (argument != nullptr) + { +#if defined(_AMD64_) || defined(_X86_) + if (PIXIsPointerAligned<16>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 16, TRUE, FALSE); + __m128i zero = _mm_setzero_si128(); + if (PIXIsPointerAligned<16>(destination)) + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_store_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi8(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 16; + } + } + else + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_storeu_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi8(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 16; + } + } + } + else +#endif // _AMD64_ || _X86_ + { + PIXCopyEventArgumentSlow(destination, limit, argument); + } + } + else + { + *destination++ = 0ull; + } + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PSTR argument) +{ + PIXCopyEventArgument(destination, limit, (PCSTR)argument); +} + +inline void PIXCopyEventArgumentSlowest(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCWSTR argument) +{ + *destination++ = PIXEncodeStringInfo(0, 8, FALSE, FALSE); + while (destination < limit) + { + UINT64 c = argument[0]; + if (!c) + { + *destination++ = 0; + return; + } + UINT64 x = c; + c = argument[1]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 16; + c = argument[2]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 32; + c = argument[3]; + if (!c) + { + *destination++ = x; + return; + } + x |= c << 48; + *destination++ = x; + argument += 4; + } +} + +inline void PIXCopyEventArgumentSlow(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCWSTR argument) +{ + if (PIXIsPointerAligned<8>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 8, FALSE, FALSE); + UINT64* source = (UINT64*)argument; + while (destination < limit) + { + UINT64 qword = *source++; + *destination++ = qword; + //check if any of the characters is a terminating zero + //TODO: check if reversed condition is faster + if (!((qword & 0xFFFF000000000000) && + (qword & 0xFFFF00000000) && + (qword & 0xFFFF0000) && + (qword & 0xFFFF))) + { + break; + } + } + } + else + { + PIXCopyEventArgumentSlowest(destination, limit, argument); + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PCWSTR argument) +{ + if (destination < limit) + { + if (argument != nullptr) + { +#if defined(_AMD64_) || defined(_X86_) + if (PIXIsPointerAligned<16>(argument)) + { + *destination++ = PIXEncodeStringInfo(0, 16, FALSE, FALSE); + __m128i zero = _mm_setzero_si128(); + if (PIXIsPointerAligned<16>(destination)) + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_store_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi16(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 8; + } + } + else + { + while (destination < limit) + { + __m128i mem = _mm_load_si128((__m128i*)argument); + _mm_storeu_si128((__m128i*)destination, mem); + //check if any of the characters is a terminating zero + __m128i res = _mm_cmpeq_epi16(mem, zero); + destination += 2; + if (_mm_movemask_epi8(res)) + break; + argument += 8; + } + } + } + else +#endif // _AMD64_ || _X86_ + { + PIXCopyEventArgumentSlow(destination, limit, argument); + } + } + else + { + *destination++ = 0ull; + } + } +} + +template<> +inline void PIXCopyEventArgument(_Out_writes_to_ptr_(limit) UINT64*& destination, _In_ const UINT64* limit, _In_ PWSTR argument) +{ + PIXCopyEventArgument(destination, limit, (PCWSTR)argument); +}; + +#if defined(__d3d12_x_h__) || defined(__d3d12_h__) + +inline void PIXSetMarkerOnContext(_In_ ID3D12GraphicsCommandList* commandList, _In_reads_bytes_(size) void* data, UINT size) +{ + commandList->SetMarker(D3D12_EVENT_METADATA, data, size); +} + +inline void PIXSetMarkerOnContext(_In_ ID3D12CommandQueue* commandQueue, _In_reads_bytes_(size) void* data, UINT size) +{ + commandQueue->SetMarker(D3D12_EVENT_METADATA, data, size); +} + +inline void PIXBeginEventOnContext(_In_ ID3D12GraphicsCommandList* commandList, _In_reads_bytes_(size) void* data, UINT size) +{ + commandList->BeginEvent(D3D12_EVENT_METADATA, data, size); +} + +inline void PIXBeginEventOnContext(_In_ ID3D12CommandQueue* commandQueue, _In_reads_bytes_(size) void* data, UINT size) +{ + commandQueue->BeginEvent(D3D12_EVENT_METADATA, data, size); +} +inline void PIXEndEventOnContext(_In_ ID3D12GraphicsCommandList* commandList) +{ + commandList->EndEvent(); +} + +inline void PIXEndEventOnContext(_In_ ID3D12CommandQueue* commandQueue) +{ + commandQueue->EndEvent(); +} + +#endif //__d3d12_x_h__ + +template struct PIXInferScopedEventType { typedef T Type; }; +template struct PIXInferScopedEventType { typedef T Type; }; +template struct PIXInferScopedEventType { typedef T Type; }; +template struct PIXInferScopedEventType { typedef T Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +template<> struct PIXInferScopedEventType { typedef void Type; }; +#endif //_PIXEventsCommon_H_ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/PIXEventsGenerated.h b/3rdparty/bgfx/3rdparty/dxsdk/include/PIXEventsGenerated.h new file mode 100644 index 00000000000..e963c485549 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/PIXEventsGenerated.h @@ -0,0 +1,10748 @@ +//This is a generated file. +#pragma once + +#ifndef _PIXEventsGenerated_H_ +#define _PIXEventsGenerated_H_ + +#ifndef _PIX3_H_ +#error "Don't include this file directly - use pix3.h" +#endif + +#include "PIXEventsCommon.h" + +//__declspec(noinline) is specified to stop compiler from making bad inlining decisions +//inline has to be specified for functions fully defined in header due to one definition rule +//supported context types for TContext are ID3D11DeviceContextX, ID3D11ComputeContextX and ID3D11DmaEngineContextX + +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXBeginEventAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXBeginEvent(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXBeginEventAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void PIXSetMarkerAllocate(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void PIXSetMarker(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXSetMarkerAllocate(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString) +{ + PIXBeginCPUEventOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString) +{ + PIXBeginCPUEventOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXBeginEvent(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXBeginCPUEventOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_BeginEvent_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXBeginEventOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString) +{ + PIXSetCPUMarkerOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString) +{ + PIXSetCPUMarkerOnContext(context, color, formatString); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +template +inline void PIXSetMarker(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXSetCPUMarkerOnContext(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + + UINT64 buffer[PIXEventsGraphicsRecordSpaceQwords]; + UINT64* destination = buffer; + UINT64* limit = buffer + PIXEventsGraphicsRecordSpaceQwords - PIXEventsReservedTailSpaceQwords; + + *destination++ = PIXEncodeEventInfo(0, PIXEvent_SetMarker_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = 0ull; + PIXSetMarkerOnContext(context, static_cast(buffer), static_cast(reinterpret_cast(destination) - reinterpret_cast(buffer))); +} + +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUSetMarkerForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUSetMarkerForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_SetMarker_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUSetMarkerForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + + +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +template +__declspec(noinline) inline void MakeCPUBeginEventForContextAllocate(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + UINT64 time = PIXEventsReplaceBlock(false); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_NoArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } +} + +template +inline void MakeCPUBeginEventForContext(UINT64 color, PVOID context, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_BeginEvent_OnContext_VarArgs); + *destination++ = color; + + PIXCopyEventArgument(destination, limit, context); + PIXCopyEventArgument(destination, limit, formatString); + PIXCopyEventArgument(destination, limit, a1); + PIXCopyEventArgument(destination, limit, a2); + PIXCopyEventArgument(destination, limit, a3); + PIXCopyEventArgument(destination, limit, a4); + PIXCopyEventArgument(destination, limit, a5); + PIXCopyEventArgument(destination, limit, a6); + PIXCopyEventArgument(destination, limit, a7); + PIXCopyEventArgument(destination, limit, a8); + PIXCopyEventArgument(destination, limit, a9); + PIXCopyEventArgument(destination, limit, a10); + PIXCopyEventArgument(destination, limit, a11); + PIXCopyEventArgument(destination, limit, a12); + PIXCopyEventArgument(destination, limit, a13); + PIXCopyEventArgument(destination, limit, a14); + PIXCopyEventArgument(destination, limit, a15); + PIXCopyEventArgument(destination, limit, a16); + + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUBeginEventForContextAllocate(color, context, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } +} + + +__declspec(noinline) inline void PIXEndEventAllocate() +{ + UINT64 time = PIXEventsReplaceBlock(true); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void PIXEndEvent() +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + PIXEndEventAllocate(); + } +} + +__declspec(noinline) inline void MakeCPUEndEventForContextAllocate(PVOID context) +{ + UINT64 time = PIXEventsReplaceBlock(true); + if (time) + { + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->limit; + if (destination < limit) + { + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent_OnContext); + PIXCopyEventArgument(destination, limit, context); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + } +} + +inline void MakeCPUEndEventForContext(PVOID context) +{ + PIXEventsThreadInfo* threadInfo = PIXGetThreadInfo(); + UINT64* destination = threadInfo->destination; + UINT64* limit = threadInfo->biasedLimit; + if (destination < limit) + { + limit += PIXEventsSafeFastCopySpaceQwords; + UINT64 time = PIXGetTimestampCounter(); + *destination++ = PIXEncodeEventInfo(time, PIXEvent_EndEvent_OnContext); + PIXCopyEventArgument(destination, limit, context); + *destination = PIXEventsBlockEndMarker; + threadInfo->destination = destination; + } + else if (limit != nullptr) + { + MakeCPUEndEventForContextAllocate(context); + } +} + +template +inline void PIXEndEvent(TContext* context) +{ + PIXEndCPUEventOnContext(context); + PIXEndEventOnContext(context); +} + +template +class PIXScopedEventObject +{ +private: + TContext* m_context; + +public: + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString) + : m_context(context) + { + PIXBeginEvent(context, color, formatString); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString) + : m_context(context) + { + PIXBeginEvent(context, color, formatString); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(TContext* context, UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + : m_context(context) + { + PIXBeginEvent(context, color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + ~PIXScopedEventObject() + { + PIXEndEvent(m_context); + } +}; + +template<> +class PIXScopedEventObject +{ +public: + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString) + { + PIXBeginEvent(color, formatString); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1) + { + PIXBeginEvent(color, formatString, a1); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2) + { + PIXBeginEvent(color, formatString, a1, a2); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3) + { + PIXBeginEvent(color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString) + { + PIXBeginEvent(color, formatString); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1) + { + PIXBeginEvent(color, formatString, a1); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2) + { + PIXBeginEvent(color, formatString, a1, a2); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3) + { + PIXBeginEvent(color, formatString, a1, a2, a3); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); + } + + template + PIXScopedEventObject(UINT64 color, _In_ PCWSTR formatString, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9, T10 a10, T11 a11, T12 a12, T13 a13, T14 a14, T15 a15, T16 a16) + { + PIXBeginEvent(color, formatString, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); + } + + ~PIXScopedEventObject() + { + PIXEndEvent(); + } +}; + +#define PIXConcatenate(a, b) a ## b +#define PIXGetScopedEventVariableName(a, b) PIXConcatenate(a, b) +#define PIXScopedEvent(context, ...) PIXScopedEventObject::Type> PIXGetScopedEventVariableName(pixEvent, __LINE__)(context, __VA_ARGS__) + +#endif diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10.h deleted file mode 100644 index 980838b336d..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10.h +++ /dev/null @@ -1,6804 +0,0 @@ -/*------------------------------------------------------------------------------------- - * - * Copyright (c) Microsoft Corporation - * - *-------------------------------------------------------------------------------------*/ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.00.0613 */ -/* @@MIDL_FILE_HEADING( ) */ - - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCSAL_H_VERSION__ -#define __REQUIRED_RPCSAL_H_VERSION__ 100 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif /* __RPCNDR_H_VERSION__ */ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __d3d10_h__ -#define __d3d10_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ID3D10DeviceChild_FWD_DEFINED__ -#define __ID3D10DeviceChild_FWD_DEFINED__ -typedef interface ID3D10DeviceChild ID3D10DeviceChild; - -#endif /* __ID3D10DeviceChild_FWD_DEFINED__ */ - - -#ifndef __ID3D10DepthStencilState_FWD_DEFINED__ -#define __ID3D10DepthStencilState_FWD_DEFINED__ -typedef interface ID3D10DepthStencilState ID3D10DepthStencilState; - -#endif /* __ID3D10DepthStencilState_FWD_DEFINED__ */ - - -#ifndef __ID3D10BlendState_FWD_DEFINED__ -#define __ID3D10BlendState_FWD_DEFINED__ -typedef interface ID3D10BlendState ID3D10BlendState; - -#endif /* __ID3D10BlendState_FWD_DEFINED__ */ - - -#ifndef __ID3D10RasterizerState_FWD_DEFINED__ -#define __ID3D10RasterizerState_FWD_DEFINED__ -typedef interface ID3D10RasterizerState ID3D10RasterizerState; - -#endif /* __ID3D10RasterizerState_FWD_DEFINED__ */ - - -#ifndef __ID3D10Resource_FWD_DEFINED__ -#define __ID3D10Resource_FWD_DEFINED__ -typedef interface ID3D10Resource ID3D10Resource; - -#endif /* __ID3D10Resource_FWD_DEFINED__ */ - - -#ifndef __ID3D10Buffer_FWD_DEFINED__ -#define __ID3D10Buffer_FWD_DEFINED__ -typedef interface ID3D10Buffer ID3D10Buffer; - -#endif /* __ID3D10Buffer_FWD_DEFINED__ */ - - -#ifndef __ID3D10Texture1D_FWD_DEFINED__ -#define __ID3D10Texture1D_FWD_DEFINED__ -typedef interface ID3D10Texture1D ID3D10Texture1D; - -#endif /* __ID3D10Texture1D_FWD_DEFINED__ */ - - -#ifndef __ID3D10Texture2D_FWD_DEFINED__ -#define __ID3D10Texture2D_FWD_DEFINED__ -typedef interface ID3D10Texture2D ID3D10Texture2D; - -#endif /* __ID3D10Texture2D_FWD_DEFINED__ */ - - -#ifndef __ID3D10Texture3D_FWD_DEFINED__ -#define __ID3D10Texture3D_FWD_DEFINED__ -typedef interface ID3D10Texture3D ID3D10Texture3D; - -#endif /* __ID3D10Texture3D_FWD_DEFINED__ */ - - -#ifndef __ID3D10View_FWD_DEFINED__ -#define __ID3D10View_FWD_DEFINED__ -typedef interface ID3D10View ID3D10View; - -#endif /* __ID3D10View_FWD_DEFINED__ */ - - -#ifndef __ID3D10ShaderResourceView_FWD_DEFINED__ -#define __ID3D10ShaderResourceView_FWD_DEFINED__ -typedef interface ID3D10ShaderResourceView ID3D10ShaderResourceView; - -#endif /* __ID3D10ShaderResourceView_FWD_DEFINED__ */ - - -#ifndef __ID3D10RenderTargetView_FWD_DEFINED__ -#define __ID3D10RenderTargetView_FWD_DEFINED__ -typedef interface ID3D10RenderTargetView ID3D10RenderTargetView; - -#endif /* __ID3D10RenderTargetView_FWD_DEFINED__ */ - - -#ifndef __ID3D10DepthStencilView_FWD_DEFINED__ -#define __ID3D10DepthStencilView_FWD_DEFINED__ -typedef interface ID3D10DepthStencilView ID3D10DepthStencilView; - -#endif /* __ID3D10DepthStencilView_FWD_DEFINED__ */ - - -#ifndef __ID3D10VertexShader_FWD_DEFINED__ -#define __ID3D10VertexShader_FWD_DEFINED__ -typedef interface ID3D10VertexShader ID3D10VertexShader; - -#endif /* __ID3D10VertexShader_FWD_DEFINED__ */ - - -#ifndef __ID3D10GeometryShader_FWD_DEFINED__ -#define __ID3D10GeometryShader_FWD_DEFINED__ -typedef interface ID3D10GeometryShader ID3D10GeometryShader; - -#endif /* __ID3D10GeometryShader_FWD_DEFINED__ */ - - -#ifndef __ID3D10PixelShader_FWD_DEFINED__ -#define __ID3D10PixelShader_FWD_DEFINED__ -typedef interface ID3D10PixelShader ID3D10PixelShader; - -#endif /* __ID3D10PixelShader_FWD_DEFINED__ */ - - -#ifndef __ID3D10InputLayout_FWD_DEFINED__ -#define __ID3D10InputLayout_FWD_DEFINED__ -typedef interface ID3D10InputLayout ID3D10InputLayout; - -#endif /* __ID3D10InputLayout_FWD_DEFINED__ */ - - -#ifndef __ID3D10SamplerState_FWD_DEFINED__ -#define __ID3D10SamplerState_FWD_DEFINED__ -typedef interface ID3D10SamplerState ID3D10SamplerState; - -#endif /* __ID3D10SamplerState_FWD_DEFINED__ */ - - -#ifndef __ID3D10Asynchronous_FWD_DEFINED__ -#define __ID3D10Asynchronous_FWD_DEFINED__ -typedef interface ID3D10Asynchronous ID3D10Asynchronous; - -#endif /* __ID3D10Asynchronous_FWD_DEFINED__ */ - - -#ifndef __ID3D10Query_FWD_DEFINED__ -#define __ID3D10Query_FWD_DEFINED__ -typedef interface ID3D10Query ID3D10Query; - -#endif /* __ID3D10Query_FWD_DEFINED__ */ - - -#ifndef __ID3D10Predicate_FWD_DEFINED__ -#define __ID3D10Predicate_FWD_DEFINED__ -typedef interface ID3D10Predicate ID3D10Predicate; - -#endif /* __ID3D10Predicate_FWD_DEFINED__ */ - - -#ifndef __ID3D10Counter_FWD_DEFINED__ -#define __ID3D10Counter_FWD_DEFINED__ -typedef interface ID3D10Counter ID3D10Counter; - -#endif /* __ID3D10Counter_FWD_DEFINED__ */ - - -#ifndef __ID3D10Device_FWD_DEFINED__ -#define __ID3D10Device_FWD_DEFINED__ -typedef interface ID3D10Device ID3D10Device; - -#endif /* __ID3D10Device_FWD_DEFINED__ */ - - -#ifndef __ID3D10Multithread_FWD_DEFINED__ -#define __ID3D10Multithread_FWD_DEFINED__ -typedef interface ID3D10Multithread ID3D10Multithread; - -#endif /* __ID3D10Multithread_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "dxgi.h" -#include "d3dcommon.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_d3d10_0000_0000 */ -/* [local] */ - -#ifndef _D3D10_CONSTANTS -#define _D3D10_CONSTANTS -#define D3D10_16BIT_INDEX_STRIP_CUT_VALUE ( 0xffff ) - -#define D3D10_32BIT_INDEX_STRIP_CUT_VALUE ( 0xffffffff ) - -#define D3D10_8BIT_INDEX_STRIP_CUT_VALUE ( 0xff ) - -#define D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT ( 9 ) - -#define D3D10_CLIP_OR_CULL_DISTANCE_COUNT ( 8 ) - -#define D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT ( 2 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT ( 14 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS ( 4 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT ( 15 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT ( 15 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) - -#define D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT ( 64 ) - -#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT ( 1 ) - -#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST ( 1 ) - -#define D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS ( 1 ) - -#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT ( 128 ) - -#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST ( 1 ) - -#define D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT ( 128 ) - -#define D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS ( 1 ) - -#define D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT ( 16 ) - -#define D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST ( 1 ) - -#define D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT ( 16 ) - -#define D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT ( 32 ) - -#define D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_COMMONSHADER_TEMP_REGISTER_COUNT ( 4096 ) - -#define D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST ( 3 ) - -#define D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS ( 3 ) - -#define D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX ( 10 ) - -#define D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN ( -10 ) - -#define D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE ( -8 ) - -#define D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE ( 7 ) - -#define D3D10_DEFAULT_BLEND_FACTOR_ALPHA ( 1.0f ) -#define D3D10_DEFAULT_BLEND_FACTOR_BLUE ( 1.0f ) -#define D3D10_DEFAULT_BLEND_FACTOR_GREEN ( 1.0f ) -#define D3D10_DEFAULT_BLEND_FACTOR_RED ( 1.0f ) -#define D3D10_DEFAULT_BORDER_COLOR_COMPONENT ( 0.0f ) -#define D3D10_DEFAULT_DEPTH_BIAS ( 0 ) - -#define D3D10_DEFAULT_DEPTH_BIAS_CLAMP ( 0.0f ) -#define D3D10_DEFAULT_MAX_ANISOTROPY ( 16.0f ) -#define D3D10_DEFAULT_MIP_LOD_BIAS ( 0.0f ) -#define D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX ( 0 ) - -#define D3D10_DEFAULT_SAMPLE_MASK ( 0xffffffff ) - -#define D3D10_DEFAULT_SCISSOR_ENDX ( 0 ) - -#define D3D10_DEFAULT_SCISSOR_ENDY ( 0 ) - -#define D3D10_DEFAULT_SCISSOR_STARTX ( 0 ) - -#define D3D10_DEFAULT_SCISSOR_STARTY ( 0 ) - -#define D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS ( 0.0f ) -#define D3D10_DEFAULT_STENCIL_READ_MASK ( 0xff ) - -#define D3D10_DEFAULT_STENCIL_REFERENCE ( 0 ) - -#define D3D10_DEFAULT_STENCIL_WRITE_MASK ( 0xff ) - -#define D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX ( 0 ) - -#define D3D10_DEFAULT_VIEWPORT_HEIGHT ( 0 ) - -#define D3D10_DEFAULT_VIEWPORT_MAX_DEPTH ( 0.0f ) -#define D3D10_DEFAULT_VIEWPORT_MIN_DEPTH ( 0.0f ) -#define D3D10_DEFAULT_VIEWPORT_TOPLEFTX ( 0 ) - -#define D3D10_DEFAULT_VIEWPORT_TOPLEFTY ( 0 ) - -#define D3D10_DEFAULT_VIEWPORT_WIDTH ( 0 ) - -#define D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) -#define D3D10_FLOAT32_MAX ( 3.402823466e+38f ) -#define D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) -#define D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR ( 2.4f ) -#define D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR ( 1.0f ) -#define D3D10_FLOAT_TO_SRGB_OFFSET ( 0.055f ) -#define D3D10_FLOAT_TO_SRGB_SCALE_1 ( 12.92f ) -#define D3D10_FLOAT_TO_SRGB_SCALE_2 ( 1.055f ) -#define D3D10_FLOAT_TO_SRGB_THRESHOLD ( 0.0031308f ) -#define D3D10_FTOI_INSTRUCTION_MAX_INPUT ( 2147483647.999f ) -#define D3D10_FTOI_INSTRUCTION_MIN_INPUT ( -2147483648.999f ) -#define D3D10_FTOU_INSTRUCTION_MAX_INPUT ( 4294967295.999f ) -#define D3D10_FTOU_INSTRUCTION_MIN_INPUT ( 0.0f ) -#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS ( 1 ) - -#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT ( 1 ) - -#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST ( 2 ) - -#define D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_GS_INPUT_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_GS_INPUT_REGISTER_COUNT ( 16 ) - -#define D3D10_GS_INPUT_REGISTER_READS_PER_INST ( 2 ) - -#define D3D10_GS_INPUT_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_GS_INPUT_REGISTER_VERTICES ( 6 ) - -#define D3D10_GS_OUTPUT_ELEMENTS ( 32 ) - -#define D3D10_GS_OUTPUT_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_GS_OUTPUT_REGISTER_COUNT ( 32 ) - -#define D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES ( 0 ) - -#define D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY ( 0 ) - -#define D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES ( 0 ) - -#define D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT ( 1 ) - -#define D3D10_IA_INSTANCE_ID_BIT_COUNT ( 32 ) - -#define D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT ( 32 ) - -#define D3D10_IA_PRIMITIVE_ID_BIT_COUNT ( 32 ) - -#define D3D10_IA_VERTEX_ID_BIT_COUNT ( 32 ) - -#define D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 16 ) - -#define D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 64 ) - -#define D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 16 ) - -#define D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT ( 0xffffffff ) - -#define D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER ( 0xffffffff ) - -#define D3D10_LINEAR_GAMMA ( 1.0f ) -#define D3D10_MAX_BORDER_COLOR_COMPONENT ( 1.0f ) -#define D3D10_MAX_DEPTH ( 1.0f ) -#define D3D10_MAX_MAXANISOTROPY ( 16 ) - -#define D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT ( 32 ) - -#define D3D10_MAX_POSITION_VALUE ( 3.402823466e+34f ) -#define D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP ( 17 ) - -#define D3D10_MIN_BORDER_COLOR_COMPONENT ( 0.0f ) -#define D3D10_MIN_DEPTH ( 0.0f ) -#define D3D10_MIN_MAXANISOTROPY ( 0 ) - -#define D3D10_MIP_LOD_BIAS_MAX ( 15.99f ) -#define D3D10_MIP_LOD_BIAS_MIN ( -16.0f ) -#define D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT ( 6 ) - -#define D3D10_MIP_LOD_RANGE_BIT_COUNT ( 8 ) - -#define D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH ( 1.4f ) -#define D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT ( 0 ) - -#define D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 13 ) - -#define D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 15 ) - -#define D3D10_PS_FRONTFACING_DEFAULT_VALUE ( 0xffffffff ) - -#define D3D10_PS_FRONTFACING_FALSE_VALUE ( 0 ) - -#define D3D10_PS_FRONTFACING_TRUE_VALUE ( 0xffffffff ) - -#define D3D10_PS_INPUT_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_PS_INPUT_REGISTER_COUNT ( 32 ) - -#define D3D10_PS_INPUT_REGISTER_READS_PER_INST ( 2 ) - -#define D3D10_PS_INPUT_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.0f ) -#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS ( 1 ) - -#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT ( 1 ) - -#define D3D10_PS_OUTPUT_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_PS_OUTPUT_REGISTER_COUNT ( 8 ) - -#define D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.5f ) -#define D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT ( 4096 ) - -#define D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP ( 27 ) - -#define D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) - -#define D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT ( 4096 ) - -#define D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 32 ) - -#define D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP ( 32 ) - -#define D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION ( 8192 ) - -#define D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT ( 1024 ) - -#define D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT ( 4096 ) - -#define D3D10_REQ_MAXANISOTROPY ( 16 ) - -#define D3D10_REQ_MIP_LEVELS ( 14 ) - -#define D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES ( 2048 ) - -#define D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT ( 4096 ) - -#define D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH ( 8192 ) - -#define D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES ( 128 ) - -#define D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP ( 20 ) - -#define D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT ( 4096 ) - -#define D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION ( 512 ) - -#define D3D10_REQ_TEXTURE1D_U_DIMENSION ( 8192 ) - -#define D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION ( 512 ) - -#define D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION ( 8192 ) - -#define D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION ( 2048 ) - -#define D3D10_REQ_TEXTURECUBE_DIMENSION ( 8192 ) - -#define D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL ( 0 ) - -#define D3D10_SHADER_MAJOR_VERSION ( 4 ) - -#define D3D10_SHADER_MINOR_VERSION ( 0 ) - -#define D3D10_SHIFT_INSTRUCTION_PAD_VALUE ( 0 ) - -#define D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT ( 5 ) - -#define D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ( 8 ) - -#define D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) - -#define D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 256 ) - -#define D3D10_SO_BUFFER_SLOT_COUNT ( 4 ) - -#define D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP ( 0xffffffff ) - -#define D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER ( 1 ) - -#define D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ( 64 ) - -#define D3D10_SRGB_GAMMA ( 2.2f ) -#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_1 ( 12.92f ) -#define D3D10_SRGB_TO_FLOAT_DENOMINATOR_2 ( 1.055f ) -#define D3D10_SRGB_TO_FLOAT_EXPONENT ( 2.4f ) -#define D3D10_SRGB_TO_FLOAT_OFFSET ( 0.055f ) -#define D3D10_SRGB_TO_FLOAT_THRESHOLD ( 0.04045f ) -#define D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP ( 0.5f ) -#define D3D10_STANDARD_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED ( 64 ) - -#define D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE ( 4 ) - -#define D3D10_STANDARD_PIXEL_COMPONENT_COUNT ( 128 ) - -#define D3D10_STANDARD_PIXEL_ELEMENT_COUNT ( 32 ) - -#define D3D10_STANDARD_VECTOR_SIZE ( 4 ) - -#define D3D10_STANDARD_VERTEX_ELEMENT_COUNT ( 16 ) - -#define D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT ( 64 ) - -#define D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) - -#define D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT ( 6 ) - -#define D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT ( 18 ) - -#define D3D10_UNBOUND_MEMORY_ACCESS_RESULT ( 0 ) - -#define D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX ( 15 ) - -#define D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE ( 16 ) - -#define D3D10_VIEWPORT_BOUNDS_MAX ( 16383 ) - -#define D3D10_VIEWPORT_BOUNDS_MIN ( -16384 ) - -#define D3D10_VS_INPUT_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_VS_INPUT_REGISTER_COUNT ( 16 ) - -#define D3D10_VS_INPUT_REGISTER_READS_PER_INST ( 2 ) - -#define D3D10_VS_INPUT_REGISTER_READ_PORTS ( 1 ) - -#define D3D10_VS_OUTPUT_REGISTER_COMPONENTS ( 4 ) - -#define D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_VS_OUTPUT_REGISTER_COUNT ( 16 ) - -#define D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT ( 10 ) - -#define D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP ( 25 ) - -#define D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP ( 25 ) - -#define D3D_MAJOR_VERSION ( 10 ) - -#define D3D_MINOR_VERSION ( 0 ) - -#define D3D_SPEC_DATE_DAY ( 8 ) - -#define D3D_SPEC_DATE_MONTH ( 8 ) - -#define D3D_SPEC_DATE_YEAR ( 2006 ) - -#define D3D_SPEC_VERSION ( 1.050005 ) -#endif -#if !defined( __d3d10_1_h__ ) && !(D3D10_HEADER_MINOR_VERSION >= 1) -#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT -#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT -#endif -#define _FACD3D10 ( 0x879 ) - -#define _FACD3D10DEBUG ( ( _FACD3D10 + 1 ) ) - -#define MAKE_D3D10_HRESULT( code ) MAKE_HRESULT( 1, _FACD3D10, code ) -#define MAKE_D3D10_STATUS( code ) MAKE_HRESULT( 0, _FACD3D10, code ) -/* Direct3D errors are now found in winerror.h */ -typedef -enum D3D10_INPUT_CLASSIFICATION - { - D3D10_INPUT_PER_VERTEX_DATA = 0, - D3D10_INPUT_PER_INSTANCE_DATA = 1 - } D3D10_INPUT_CLASSIFICATION; - -#define D3D10_APPEND_ALIGNED_ELEMENT ( 0xffffffff ) - -typedef struct D3D10_INPUT_ELEMENT_DESC - { - LPCSTR SemanticName; - UINT SemanticIndex; - DXGI_FORMAT Format; - UINT InputSlot; - UINT AlignedByteOffset; - D3D10_INPUT_CLASSIFICATION InputSlotClass; - UINT InstanceDataStepRate; - } D3D10_INPUT_ELEMENT_DESC; - -typedef -enum D3D10_FILL_MODE - { - D3D10_FILL_WIREFRAME = 2, - D3D10_FILL_SOLID = 3 - } D3D10_FILL_MODE; - -typedef D3D_PRIMITIVE_TOPOLOGY D3D10_PRIMITIVE_TOPOLOGY; - -typedef D3D_PRIMITIVE D3D10_PRIMITIVE; - -typedef -enum D3D10_CULL_MODE - { - D3D10_CULL_NONE = 1, - D3D10_CULL_FRONT = 2, - D3D10_CULL_BACK = 3 - } D3D10_CULL_MODE; - -typedef struct D3D10_SO_DECLARATION_ENTRY - { - LPCSTR SemanticName; - UINT SemanticIndex; - BYTE StartComponent; - BYTE ComponentCount; - BYTE OutputSlot; - } D3D10_SO_DECLARATION_ENTRY; - -typedef struct D3D10_VIEWPORT - { - INT TopLeftX; - INT TopLeftY; - UINT Width; - UINT Height; - FLOAT MinDepth; - FLOAT MaxDepth; - } D3D10_VIEWPORT; - -typedef -enum D3D10_RESOURCE_DIMENSION - { - D3D10_RESOURCE_DIMENSION_UNKNOWN = 0, - D3D10_RESOURCE_DIMENSION_BUFFER = 1, - D3D10_RESOURCE_DIMENSION_TEXTURE1D = 2, - D3D10_RESOURCE_DIMENSION_TEXTURE2D = 3, - D3D10_RESOURCE_DIMENSION_TEXTURE3D = 4 - } D3D10_RESOURCE_DIMENSION; - -typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION; - -typedef -enum D3D10_DSV_DIMENSION - { - D3D10_DSV_DIMENSION_UNKNOWN = 0, - D3D10_DSV_DIMENSION_TEXTURE1D = 1, - D3D10_DSV_DIMENSION_TEXTURE1DARRAY = 2, - D3D10_DSV_DIMENSION_TEXTURE2D = 3, - D3D10_DSV_DIMENSION_TEXTURE2DARRAY = 4, - D3D10_DSV_DIMENSION_TEXTURE2DMS = 5, - D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY = 6 - } D3D10_DSV_DIMENSION; - -typedef -enum D3D10_RTV_DIMENSION - { - D3D10_RTV_DIMENSION_UNKNOWN = 0, - D3D10_RTV_DIMENSION_BUFFER = 1, - D3D10_RTV_DIMENSION_TEXTURE1D = 2, - D3D10_RTV_DIMENSION_TEXTURE1DARRAY = 3, - D3D10_RTV_DIMENSION_TEXTURE2D = 4, - D3D10_RTV_DIMENSION_TEXTURE2DARRAY = 5, - D3D10_RTV_DIMENSION_TEXTURE2DMS = 6, - D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY = 7, - D3D10_RTV_DIMENSION_TEXTURE3D = 8 - } D3D10_RTV_DIMENSION; - -typedef -enum D3D10_USAGE - { - D3D10_USAGE_DEFAULT = 0, - D3D10_USAGE_IMMUTABLE = 1, - D3D10_USAGE_DYNAMIC = 2, - D3D10_USAGE_STAGING = 3 - } D3D10_USAGE; - -typedef -enum D3D10_BIND_FLAG - { - D3D10_BIND_VERTEX_BUFFER = 0x1L, - D3D10_BIND_INDEX_BUFFER = 0x2L, - D3D10_BIND_CONSTANT_BUFFER = 0x4L, - D3D10_BIND_SHADER_RESOURCE = 0x8L, - D3D10_BIND_STREAM_OUTPUT = 0x10L, - D3D10_BIND_RENDER_TARGET = 0x20L, - D3D10_BIND_DEPTH_STENCIL = 0x40L - } D3D10_BIND_FLAG; - -typedef -enum D3D10_CPU_ACCESS_FLAG - { - D3D10_CPU_ACCESS_WRITE = 0x10000L, - D3D10_CPU_ACCESS_READ = 0x20000L - } D3D10_CPU_ACCESS_FLAG; - -typedef -enum D3D10_RESOURCE_MISC_FLAG - { - D3D10_RESOURCE_MISC_GENERATE_MIPS = 0x1L, - D3D10_RESOURCE_MISC_SHARED = 0x2L, - D3D10_RESOURCE_MISC_TEXTURECUBE = 0x4L, - D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x10L, - D3D10_RESOURCE_MISC_GDI_COMPATIBLE = 0x20L - } D3D10_RESOURCE_MISC_FLAG; - -typedef -enum D3D10_MAP - { - D3D10_MAP_READ = 1, - D3D10_MAP_WRITE = 2, - D3D10_MAP_READ_WRITE = 3, - D3D10_MAP_WRITE_DISCARD = 4, - D3D10_MAP_WRITE_NO_OVERWRITE = 5 - } D3D10_MAP; - -typedef -enum D3D10_MAP_FLAG - { - D3D10_MAP_FLAG_DO_NOT_WAIT = 0x100000L - } D3D10_MAP_FLAG; - -typedef -enum D3D10_RAISE_FLAG - { - D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1L - } D3D10_RAISE_FLAG; - -typedef -enum D3D10_CLEAR_FLAG - { - D3D10_CLEAR_DEPTH = 0x1L, - D3D10_CLEAR_STENCIL = 0x2L - } D3D10_CLEAR_FLAG; - -typedef RECT D3D10_RECT; - -typedef struct D3D10_BOX - { - UINT left; - UINT top; - UINT front; - UINT right; - UINT bottom; - UINT back; - } D3D10_BOX; - - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0000_v0_0_s_ifspec; - -#ifndef __ID3D10DeviceChild_INTERFACE_DEFINED__ -#define __ID3D10DeviceChild_INTERFACE_DEFINED__ - -/* interface ID3D10DeviceChild */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10DeviceChild; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C00-342C-4106-A19F-4F2704F689F0") - ID3D10DeviceChild : public IUnknown - { - public: - virtual void STDMETHODCALLTYPE GetDevice( - /* [annotation] */ - _Out_ ID3D10Device **ppDevice) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPrivateData( - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrivateData( - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10DeviceChildVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10DeviceChild * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10DeviceChild * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10DeviceChild * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10DeviceChild * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10DeviceChild * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10DeviceChild * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10DeviceChild * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - END_INTERFACE - } ID3D10DeviceChildVtbl; - - interface ID3D10DeviceChild - { - CONST_VTBL struct ID3D10DeviceChildVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10DeviceChild_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10DeviceChild_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10DeviceChild_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10DeviceChild_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10DeviceChild_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10DeviceChild_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10DeviceChild_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10DeviceChild_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0001 */ -/* [local] */ - -typedef -enum D3D10_COMPARISON_FUNC - { - D3D10_COMPARISON_NEVER = 1, - D3D10_COMPARISON_LESS = 2, - D3D10_COMPARISON_EQUAL = 3, - D3D10_COMPARISON_LESS_EQUAL = 4, - D3D10_COMPARISON_GREATER = 5, - D3D10_COMPARISON_NOT_EQUAL = 6, - D3D10_COMPARISON_GREATER_EQUAL = 7, - D3D10_COMPARISON_ALWAYS = 8 - } D3D10_COMPARISON_FUNC; - -typedef -enum D3D10_DEPTH_WRITE_MASK - { - D3D10_DEPTH_WRITE_MASK_ZERO = 0, - D3D10_DEPTH_WRITE_MASK_ALL = 1 - } D3D10_DEPTH_WRITE_MASK; - -typedef -enum D3D10_STENCIL_OP - { - D3D10_STENCIL_OP_KEEP = 1, - D3D10_STENCIL_OP_ZERO = 2, - D3D10_STENCIL_OP_REPLACE = 3, - D3D10_STENCIL_OP_INCR_SAT = 4, - D3D10_STENCIL_OP_DECR_SAT = 5, - D3D10_STENCIL_OP_INVERT = 6, - D3D10_STENCIL_OP_INCR = 7, - D3D10_STENCIL_OP_DECR = 8 - } D3D10_STENCIL_OP; - -typedef struct D3D10_DEPTH_STENCILOP_DESC - { - D3D10_STENCIL_OP StencilFailOp; - D3D10_STENCIL_OP StencilDepthFailOp; - D3D10_STENCIL_OP StencilPassOp; - D3D10_COMPARISON_FUNC StencilFunc; - } D3D10_DEPTH_STENCILOP_DESC; - -typedef struct D3D10_DEPTH_STENCIL_DESC - { - BOOL DepthEnable; - D3D10_DEPTH_WRITE_MASK DepthWriteMask; - D3D10_COMPARISON_FUNC DepthFunc; - BOOL StencilEnable; - UINT8 StencilReadMask; - UINT8 StencilWriteMask; - D3D10_DEPTH_STENCILOP_DESC FrontFace; - D3D10_DEPTH_STENCILOP_DESC BackFace; - } D3D10_DEPTH_STENCIL_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0001_v0_0_s_ifspec; - -#ifndef __ID3D10DepthStencilState_INTERFACE_DEFINED__ -#define __ID3D10DepthStencilState_INTERFACE_DEFINED__ - -/* interface ID3D10DepthStencilState */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10DepthStencilState; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("2B4B1CC8-A4AD-41f8-8322-CA86FC3EC675") - ID3D10DepthStencilState : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_DEPTH_STENCIL_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10DepthStencilStateVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10DepthStencilState * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10DepthStencilState * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10DepthStencilState * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10DepthStencilState * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10DepthStencilState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10DepthStencilState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10DepthStencilState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10DepthStencilState * This, - /* [annotation] */ - _Out_ D3D10_DEPTH_STENCIL_DESC *pDesc); - - END_INTERFACE - } ID3D10DepthStencilStateVtbl; - - interface ID3D10DepthStencilState - { - CONST_VTBL struct ID3D10DepthStencilStateVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10DepthStencilState_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10DepthStencilState_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10DepthStencilState_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10DepthStencilState_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10DepthStencilState_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10DepthStencilState_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10DepthStencilState_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10DepthStencilState_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10DepthStencilState_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0002 */ -/* [local] */ - -typedef -enum D3D10_BLEND - { - D3D10_BLEND_ZERO = 1, - D3D10_BLEND_ONE = 2, - D3D10_BLEND_SRC_COLOR = 3, - D3D10_BLEND_INV_SRC_COLOR = 4, - D3D10_BLEND_SRC_ALPHA = 5, - D3D10_BLEND_INV_SRC_ALPHA = 6, - D3D10_BLEND_DEST_ALPHA = 7, - D3D10_BLEND_INV_DEST_ALPHA = 8, - D3D10_BLEND_DEST_COLOR = 9, - D3D10_BLEND_INV_DEST_COLOR = 10, - D3D10_BLEND_SRC_ALPHA_SAT = 11, - D3D10_BLEND_BLEND_FACTOR = 14, - D3D10_BLEND_INV_BLEND_FACTOR = 15, - D3D10_BLEND_SRC1_COLOR = 16, - D3D10_BLEND_INV_SRC1_COLOR = 17, - D3D10_BLEND_SRC1_ALPHA = 18, - D3D10_BLEND_INV_SRC1_ALPHA = 19 - } D3D10_BLEND; - -typedef -enum D3D10_BLEND_OP - { - D3D10_BLEND_OP_ADD = 1, - D3D10_BLEND_OP_SUBTRACT = 2, - D3D10_BLEND_OP_REV_SUBTRACT = 3, - D3D10_BLEND_OP_MIN = 4, - D3D10_BLEND_OP_MAX = 5 - } D3D10_BLEND_OP; - -typedef -enum D3D10_COLOR_WRITE_ENABLE - { - D3D10_COLOR_WRITE_ENABLE_RED = 1, - D3D10_COLOR_WRITE_ENABLE_GREEN = 2, - D3D10_COLOR_WRITE_ENABLE_BLUE = 4, - D3D10_COLOR_WRITE_ENABLE_ALPHA = 8, - D3D10_COLOR_WRITE_ENABLE_ALL = ( ( ( D3D10_COLOR_WRITE_ENABLE_RED | D3D10_COLOR_WRITE_ENABLE_GREEN ) | D3D10_COLOR_WRITE_ENABLE_BLUE ) | D3D10_COLOR_WRITE_ENABLE_ALPHA ) - } D3D10_COLOR_WRITE_ENABLE; - -typedef struct D3D10_BLEND_DESC - { - BOOL AlphaToCoverageEnable; - BOOL BlendEnable[ 8 ]; - D3D10_BLEND SrcBlend; - D3D10_BLEND DestBlend; - D3D10_BLEND_OP BlendOp; - D3D10_BLEND SrcBlendAlpha; - D3D10_BLEND DestBlendAlpha; - D3D10_BLEND_OP BlendOpAlpha; - UINT8 RenderTargetWriteMask[ 8 ]; - } D3D10_BLEND_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0002_v0_0_s_ifspec; - -#ifndef __ID3D10BlendState_INTERFACE_DEFINED__ -#define __ID3D10BlendState_INTERFACE_DEFINED__ - -/* interface ID3D10BlendState */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10BlendState; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EDAD8D19-8A35-4d6d-8566-2EA276CDE161") - ID3D10BlendState : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_BLEND_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10BlendStateVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10BlendState * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10BlendState * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10BlendState * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10BlendState * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10BlendState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10BlendState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10BlendState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10BlendState * This, - /* [annotation] */ - _Out_ D3D10_BLEND_DESC *pDesc); - - END_INTERFACE - } ID3D10BlendStateVtbl; - - interface ID3D10BlendState - { - CONST_VTBL struct ID3D10BlendStateVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10BlendState_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10BlendState_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10BlendState_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10BlendState_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10BlendState_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10BlendState_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10BlendState_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10BlendState_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10BlendState_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0003 */ -/* [local] */ - -typedef struct D3D10_RASTERIZER_DESC - { - D3D10_FILL_MODE FillMode; - D3D10_CULL_MODE CullMode; - BOOL FrontCounterClockwise; - INT DepthBias; - FLOAT DepthBiasClamp; - FLOAT SlopeScaledDepthBias; - BOOL DepthClipEnable; - BOOL ScissorEnable; - BOOL MultisampleEnable; - BOOL AntialiasedLineEnable; - } D3D10_RASTERIZER_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0003_v0_0_s_ifspec; - -#ifndef __ID3D10RasterizerState_INTERFACE_DEFINED__ -#define __ID3D10RasterizerState_INTERFACE_DEFINED__ - -/* interface ID3D10RasterizerState */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10RasterizerState; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("A2A07292-89AF-4345-BE2E-C53D9FBB6E9F") - ID3D10RasterizerState : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_RASTERIZER_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10RasterizerStateVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10RasterizerState * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10RasterizerState * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10RasterizerState * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10RasterizerState * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10RasterizerState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10RasterizerState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10RasterizerState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10RasterizerState * This, - /* [annotation] */ - _Out_ D3D10_RASTERIZER_DESC *pDesc); - - END_INTERFACE - } ID3D10RasterizerStateVtbl; - - interface ID3D10RasterizerState - { - CONST_VTBL struct ID3D10RasterizerStateVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10RasterizerState_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10RasterizerState_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10RasterizerState_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10RasterizerState_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10RasterizerState_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10RasterizerState_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10RasterizerState_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10RasterizerState_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10RasterizerState_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0004 */ -/* [local] */ - -#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) -inline UINT D3D10CalcSubresource( UINT MipSlice, UINT ArraySlice, UINT MipLevels ) -{ return MipSlice + ArraySlice * MipLevels; } -#endif -typedef struct D3D10_SUBRESOURCE_DATA - { - const void *pSysMem; - UINT SysMemPitch; - UINT SysMemSlicePitch; - } D3D10_SUBRESOURCE_DATA; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0004_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0004_v0_0_s_ifspec; - -#ifndef __ID3D10Resource_INTERFACE_DEFINED__ -#define __ID3D10Resource_INTERFACE_DEFINED__ - -/* interface ID3D10Resource */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Resource; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C01-342C-4106-A19F-4F2704F689F0") - ID3D10Resource : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE GetType( - /* [annotation] */ - _Out_ D3D10_RESOURCE_DIMENSION *rType) = 0; - - virtual void STDMETHODCALLTYPE SetEvictionPriority( - /* [annotation] */ - _In_ UINT EvictionPriority) = 0; - - virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10ResourceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Resource * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Resource * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Resource * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Resource * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Resource * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Resource * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Resource * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetType )( - ID3D10Resource * This, - /* [annotation] */ - _Out_ D3D10_RESOURCE_DIMENSION *rType); - - void ( STDMETHODCALLTYPE *SetEvictionPriority )( - ID3D10Resource * This, - /* [annotation] */ - _In_ UINT EvictionPriority); - - UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( - ID3D10Resource * This); - - END_INTERFACE - } ID3D10ResourceVtbl; - - interface ID3D10Resource - { - CONST_VTBL struct ID3D10ResourceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Resource_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Resource_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Resource_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Resource_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Resource_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Resource_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Resource_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Resource_GetType(This,rType) \ - ( (This)->lpVtbl -> GetType(This,rType) ) - -#define ID3D10Resource_SetEvictionPriority(This,EvictionPriority) \ - ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) - -#define ID3D10Resource_GetEvictionPriority(This) \ - ( (This)->lpVtbl -> GetEvictionPriority(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Resource_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0005 */ -/* [local] */ - -typedef struct D3D10_BUFFER_DESC - { - UINT ByteWidth; - D3D10_USAGE Usage; - UINT BindFlags; - UINT CPUAccessFlags; - UINT MiscFlags; - } D3D10_BUFFER_DESC; - -#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) -struct CD3D10_BUFFER_DESC : public D3D10_BUFFER_DESC -{ - CD3D10_BUFFER_DESC() - {} - explicit CD3D10_BUFFER_DESC( const D3D10_BUFFER_DESC& o ) : - D3D10_BUFFER_DESC( o ) - {} - explicit CD3D10_BUFFER_DESC( - UINT byteWidth, - UINT bindFlags, - D3D10_USAGE usage = D3D10_USAGE_DEFAULT, - UINT cpuaccessFlags = 0, - UINT miscFlags = 0 ) - { - ByteWidth = byteWidth; - Usage = usage; - BindFlags = bindFlags; - CPUAccessFlags = cpuaccessFlags ; - MiscFlags = miscFlags; - } - ~CD3D10_BUFFER_DESC() {} -// operator const D3D10_BUFFER_DESC&() const { return *this; } -}; -#endif - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0005_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0005_v0_0_s_ifspec; - -#ifndef __ID3D10Buffer_INTERFACE_DEFINED__ -#define __ID3D10Buffer_INTERFACE_DEFINED__ - -/* interface ID3D10Buffer */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Buffer; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C02-342C-4106-A19F-4F2704F689F0") - ID3D10Buffer : public ID3D10Resource - { - public: - virtual HRESULT STDMETHODCALLTYPE Map( - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ void **ppData) = 0; - - virtual void STDMETHODCALLTYPE Unmap( void) = 0; - - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_BUFFER_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10BufferVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Buffer * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Buffer * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Buffer * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Buffer * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Buffer * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Buffer * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Buffer * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetType )( - ID3D10Buffer * This, - /* [annotation] */ - _Out_ D3D10_RESOURCE_DIMENSION *rType); - - void ( STDMETHODCALLTYPE *SetEvictionPriority )( - ID3D10Buffer * This, - /* [annotation] */ - _In_ UINT EvictionPriority); - - UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( - ID3D10Buffer * This); - - HRESULT ( STDMETHODCALLTYPE *Map )( - ID3D10Buffer * This, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ void **ppData); - - void ( STDMETHODCALLTYPE *Unmap )( - ID3D10Buffer * This); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Buffer * This, - /* [annotation] */ - _Out_ D3D10_BUFFER_DESC *pDesc); - - END_INTERFACE - } ID3D10BufferVtbl; - - interface ID3D10Buffer - { - CONST_VTBL struct ID3D10BufferVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Buffer_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Buffer_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Buffer_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Buffer_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Buffer_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Buffer_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Buffer_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Buffer_GetType(This,rType) \ - ( (This)->lpVtbl -> GetType(This,rType) ) - -#define ID3D10Buffer_SetEvictionPriority(This,EvictionPriority) \ - ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) - -#define ID3D10Buffer_GetEvictionPriority(This) \ - ( (This)->lpVtbl -> GetEvictionPriority(This) ) - - -#define ID3D10Buffer_Map(This,MapType,MapFlags,ppData) \ - ( (This)->lpVtbl -> Map(This,MapType,MapFlags,ppData) ) - -#define ID3D10Buffer_Unmap(This) \ - ( (This)->lpVtbl -> Unmap(This) ) - -#define ID3D10Buffer_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Buffer_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0006 */ -/* [local] */ - -typedef struct D3D10_TEXTURE1D_DESC - { - UINT Width; - UINT MipLevels; - UINT ArraySize; - DXGI_FORMAT Format; - D3D10_USAGE Usage; - UINT BindFlags; - UINT CPUAccessFlags; - UINT MiscFlags; - } D3D10_TEXTURE1D_DESC; - -#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) -struct CD3D10_TEXTURE1D_DESC : public D3D10_TEXTURE1D_DESC -{ - CD3D10_TEXTURE1D_DESC() - {} - explicit CD3D10_TEXTURE1D_DESC( const D3D10_TEXTURE1D_DESC& o ) : - D3D10_TEXTURE1D_DESC( o ) - {} - explicit CD3D10_TEXTURE1D_DESC( - DXGI_FORMAT format, - UINT width, - UINT arraySize = 1, - UINT mipLevels = 0, - UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, - D3D10_USAGE usage = D3D10_USAGE_DEFAULT, - UINT cpuaccessFlags= 0, - UINT miscFlags = 0 ) - { - Width = width; - MipLevels = mipLevels; - ArraySize = arraySize; - Format = format; - Usage = usage; - BindFlags = bindFlags; - CPUAccessFlags = cpuaccessFlags; - MiscFlags = miscFlags; - } - ~CD3D10_TEXTURE1D_DESC() {} -// operator const D3D10_TEXTURE1D_DESC&() const { return *this; } -}; -#endif - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0006_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0006_v0_0_s_ifspec; - -#ifndef __ID3D10Texture1D_INTERFACE_DEFINED__ -#define __ID3D10Texture1D_INTERFACE_DEFINED__ - -/* interface ID3D10Texture1D */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Texture1D; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C03-342C-4106-A19F-4F2704F689F0") - ID3D10Texture1D : public ID3D10Resource - { - public: - virtual HRESULT STDMETHODCALLTYPE Map( - /* [annotation] */ - _In_ UINT Subresource, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ void **ppData) = 0; - - virtual void STDMETHODCALLTYPE Unmap( - /* [annotation] */ - _In_ UINT Subresource) = 0; - - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_TEXTURE1D_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10Texture1DVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Texture1D * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Texture1D * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Texture1D * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Texture1D * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Texture1D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Texture1D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Texture1D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetType )( - ID3D10Texture1D * This, - /* [annotation] */ - _Out_ D3D10_RESOURCE_DIMENSION *rType); - - void ( STDMETHODCALLTYPE *SetEvictionPriority )( - ID3D10Texture1D * This, - /* [annotation] */ - _In_ UINT EvictionPriority); - - UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( - ID3D10Texture1D * This); - - HRESULT ( STDMETHODCALLTYPE *Map )( - ID3D10Texture1D * This, - /* [annotation] */ - _In_ UINT Subresource, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ void **ppData); - - void ( STDMETHODCALLTYPE *Unmap )( - ID3D10Texture1D * This, - /* [annotation] */ - _In_ UINT Subresource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Texture1D * This, - /* [annotation] */ - _Out_ D3D10_TEXTURE1D_DESC *pDesc); - - END_INTERFACE - } ID3D10Texture1DVtbl; - - interface ID3D10Texture1D - { - CONST_VTBL struct ID3D10Texture1DVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Texture1D_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Texture1D_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Texture1D_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Texture1D_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Texture1D_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Texture1D_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Texture1D_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Texture1D_GetType(This,rType) \ - ( (This)->lpVtbl -> GetType(This,rType) ) - -#define ID3D10Texture1D_SetEvictionPriority(This,EvictionPriority) \ - ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) - -#define ID3D10Texture1D_GetEvictionPriority(This) \ - ( (This)->lpVtbl -> GetEvictionPriority(This) ) - - -#define ID3D10Texture1D_Map(This,Subresource,MapType,MapFlags,ppData) \ - ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,ppData) ) - -#define ID3D10Texture1D_Unmap(This,Subresource) \ - ( (This)->lpVtbl -> Unmap(This,Subresource) ) - -#define ID3D10Texture1D_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Texture1D_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0007 */ -/* [local] */ - -typedef struct D3D10_TEXTURE2D_DESC - { - UINT Width; - UINT Height; - UINT MipLevels; - UINT ArraySize; - DXGI_FORMAT Format; - DXGI_SAMPLE_DESC SampleDesc; - D3D10_USAGE Usage; - UINT BindFlags; - UINT CPUAccessFlags; - UINT MiscFlags; - } D3D10_TEXTURE2D_DESC; - -#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) -struct CD3D10_TEXTURE2D_DESC : public D3D10_TEXTURE2D_DESC -{ - CD3D10_TEXTURE2D_DESC() - {} - explicit CD3D10_TEXTURE2D_DESC( const D3D10_TEXTURE2D_DESC& o ) : - D3D10_TEXTURE2D_DESC( o ) - {} - explicit CD3D10_TEXTURE2D_DESC( - DXGI_FORMAT format, - UINT width, - UINT height, - UINT arraySize = 1, - UINT mipLevels = 0, - UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, - D3D10_USAGE usage = D3D10_USAGE_DEFAULT, - UINT cpuaccessFlags = 0, - UINT sampleCount = 1, - UINT sampleQuality = 0, - UINT miscFlags = 0 ) - { - Width = width; - Height = height; - MipLevels = mipLevels; - ArraySize = arraySize; - Format = format; - SampleDesc.Count = sampleCount; - SampleDesc.Quality = sampleQuality; - Usage = usage; - BindFlags = bindFlags; - CPUAccessFlags = cpuaccessFlags; - MiscFlags = miscFlags; - } - ~CD3D10_TEXTURE2D_DESC() {} -// operator const D3D10_TEXTURE2D_DESC&() const { return *this; } -}; -#endif -typedef struct D3D10_MAPPED_TEXTURE2D - { - void *pData; - UINT RowPitch; - } D3D10_MAPPED_TEXTURE2D; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0007_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0007_v0_0_s_ifspec; - -#ifndef __ID3D10Texture2D_INTERFACE_DEFINED__ -#define __ID3D10Texture2D_INTERFACE_DEFINED__ - -/* interface ID3D10Texture2D */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Texture2D; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C04-342C-4106-A19F-4F2704F689F0") - ID3D10Texture2D : public ID3D10Resource - { - public: - virtual HRESULT STDMETHODCALLTYPE Map( - /* [annotation] */ - _In_ UINT Subresource, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ D3D10_MAPPED_TEXTURE2D *pMappedTex2D) = 0; - - virtual void STDMETHODCALLTYPE Unmap( - /* [annotation] */ - _In_ UINT Subresource) = 0; - - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_TEXTURE2D_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10Texture2DVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Texture2D * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Texture2D * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Texture2D * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Texture2D * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Texture2D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Texture2D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Texture2D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetType )( - ID3D10Texture2D * This, - /* [annotation] */ - _Out_ D3D10_RESOURCE_DIMENSION *rType); - - void ( STDMETHODCALLTYPE *SetEvictionPriority )( - ID3D10Texture2D * This, - /* [annotation] */ - _In_ UINT EvictionPriority); - - UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( - ID3D10Texture2D * This); - - HRESULT ( STDMETHODCALLTYPE *Map )( - ID3D10Texture2D * This, - /* [annotation] */ - _In_ UINT Subresource, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ D3D10_MAPPED_TEXTURE2D *pMappedTex2D); - - void ( STDMETHODCALLTYPE *Unmap )( - ID3D10Texture2D * This, - /* [annotation] */ - _In_ UINT Subresource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Texture2D * This, - /* [annotation] */ - _Out_ D3D10_TEXTURE2D_DESC *pDesc); - - END_INTERFACE - } ID3D10Texture2DVtbl; - - interface ID3D10Texture2D - { - CONST_VTBL struct ID3D10Texture2DVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Texture2D_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Texture2D_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Texture2D_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Texture2D_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Texture2D_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Texture2D_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Texture2D_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Texture2D_GetType(This,rType) \ - ( (This)->lpVtbl -> GetType(This,rType) ) - -#define ID3D10Texture2D_SetEvictionPriority(This,EvictionPriority) \ - ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) - -#define ID3D10Texture2D_GetEvictionPriority(This) \ - ( (This)->lpVtbl -> GetEvictionPriority(This) ) - - -#define ID3D10Texture2D_Map(This,Subresource,MapType,MapFlags,pMappedTex2D) \ - ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,pMappedTex2D) ) - -#define ID3D10Texture2D_Unmap(This,Subresource) \ - ( (This)->lpVtbl -> Unmap(This,Subresource) ) - -#define ID3D10Texture2D_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Texture2D_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0008 */ -/* [local] */ - -typedef struct D3D10_TEXTURE3D_DESC - { - UINT Width; - UINT Height; - UINT Depth; - UINT MipLevels; - DXGI_FORMAT Format; - D3D10_USAGE Usage; - UINT BindFlags; - UINT CPUAccessFlags; - UINT MiscFlags; - } D3D10_TEXTURE3D_DESC; - -#if !defined( D3D10_NO_HELPERS ) && defined( __cplusplus ) -struct CD3D10_TEXTURE3D_DESC : public D3D10_TEXTURE3D_DESC -{ - CD3D10_TEXTURE3D_DESC() - {} - explicit CD3D10_TEXTURE3D_DESC( const D3D10_TEXTURE3D_DESC& o ) : - D3D10_TEXTURE3D_DESC( o ) - {} - explicit CD3D10_TEXTURE3D_DESC( - DXGI_FORMAT format, - UINT width, - UINT height, - UINT depth, - UINT mipLevels = 0, - UINT bindFlags = D3D10_BIND_SHADER_RESOURCE, - D3D10_USAGE usage = D3D10_USAGE_DEFAULT, - UINT cpuaccessFlags = 0, - UINT miscFlags = 0 ) - { - Width = width; - Height = height; - Depth = depth; - MipLevels = mipLevels; - Format = format; - Usage = usage; - BindFlags = bindFlags; - CPUAccessFlags = cpuaccessFlags; - MiscFlags = miscFlags; - } - ~CD3D10_TEXTURE3D_DESC() {} -// operator const D3D10_TEXTURE3D_DESC&() const { return *this; } -}; -#endif -typedef struct D3D10_MAPPED_TEXTURE3D - { - void *pData; - UINT RowPitch; - UINT DepthPitch; - } D3D10_MAPPED_TEXTURE3D; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0008_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0008_v0_0_s_ifspec; - -#ifndef __ID3D10Texture3D_INTERFACE_DEFINED__ -#define __ID3D10Texture3D_INTERFACE_DEFINED__ - -/* interface ID3D10Texture3D */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Texture3D; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C05-342C-4106-A19F-4F2704F689F0") - ID3D10Texture3D : public ID3D10Resource - { - public: - virtual HRESULT STDMETHODCALLTYPE Map( - /* [annotation] */ - _In_ UINT Subresource, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ D3D10_MAPPED_TEXTURE3D *pMappedTex3D) = 0; - - virtual void STDMETHODCALLTYPE Unmap( - /* [annotation] */ - _In_ UINT Subresource) = 0; - - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_TEXTURE3D_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10Texture3DVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Texture3D * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Texture3D * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Texture3D * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Texture3D * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Texture3D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Texture3D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Texture3D * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetType )( - ID3D10Texture3D * This, - /* [annotation] */ - _Out_ D3D10_RESOURCE_DIMENSION *rType); - - void ( STDMETHODCALLTYPE *SetEvictionPriority )( - ID3D10Texture3D * This, - /* [annotation] */ - _In_ UINT EvictionPriority); - - UINT ( STDMETHODCALLTYPE *GetEvictionPriority )( - ID3D10Texture3D * This); - - HRESULT ( STDMETHODCALLTYPE *Map )( - ID3D10Texture3D * This, - /* [annotation] */ - _In_ UINT Subresource, - /* [annotation] */ - _In_ D3D10_MAP MapType, - /* [annotation] */ - _In_ UINT MapFlags, - /* [annotation] */ - _Out_ D3D10_MAPPED_TEXTURE3D *pMappedTex3D); - - void ( STDMETHODCALLTYPE *Unmap )( - ID3D10Texture3D * This, - /* [annotation] */ - _In_ UINT Subresource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Texture3D * This, - /* [annotation] */ - _Out_ D3D10_TEXTURE3D_DESC *pDesc); - - END_INTERFACE - } ID3D10Texture3DVtbl; - - interface ID3D10Texture3D - { - CONST_VTBL struct ID3D10Texture3DVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Texture3D_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Texture3D_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Texture3D_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Texture3D_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Texture3D_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Texture3D_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Texture3D_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Texture3D_GetType(This,rType) \ - ( (This)->lpVtbl -> GetType(This,rType) ) - -#define ID3D10Texture3D_SetEvictionPriority(This,EvictionPriority) \ - ( (This)->lpVtbl -> SetEvictionPriority(This,EvictionPriority) ) - -#define ID3D10Texture3D_GetEvictionPriority(This) \ - ( (This)->lpVtbl -> GetEvictionPriority(This) ) - - -#define ID3D10Texture3D_Map(This,Subresource,MapType,MapFlags,pMappedTex3D) \ - ( (This)->lpVtbl -> Map(This,Subresource,MapType,MapFlags,pMappedTex3D) ) - -#define ID3D10Texture3D_Unmap(This,Subresource) \ - ( (This)->lpVtbl -> Unmap(This,Subresource) ) - -#define ID3D10Texture3D_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Texture3D_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0009 */ -/* [local] */ - -typedef -enum D3D10_TEXTURECUBE_FACE - { - D3D10_TEXTURECUBE_FACE_POSITIVE_X = 0, - D3D10_TEXTURECUBE_FACE_NEGATIVE_X = 1, - D3D10_TEXTURECUBE_FACE_POSITIVE_Y = 2, - D3D10_TEXTURECUBE_FACE_NEGATIVE_Y = 3, - D3D10_TEXTURECUBE_FACE_POSITIVE_Z = 4, - D3D10_TEXTURECUBE_FACE_NEGATIVE_Z = 5 - } D3D10_TEXTURECUBE_FACE; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0009_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0009_v0_0_s_ifspec; - -#ifndef __ID3D10View_INTERFACE_DEFINED__ -#define __ID3D10View_INTERFACE_DEFINED__ - -/* interface ID3D10View */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10View; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("C902B03F-60A7-49BA-9936-2A3AB37A7E33") - ID3D10View : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE GetResource( - /* [annotation] */ - _Out_ ID3D10Resource **ppResource) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10ViewVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10View * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10View * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10View * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10View * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10View * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10View * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10View * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetResource )( - ID3D10View * This, - /* [annotation] */ - _Out_ ID3D10Resource **ppResource); - - END_INTERFACE - } ID3D10ViewVtbl; - - interface ID3D10View - { - CONST_VTBL struct ID3D10ViewVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10View_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10View_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10View_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10View_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10View_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10View_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10View_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10View_GetResource(This,ppResource) \ - ( (This)->lpVtbl -> GetResource(This,ppResource) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10View_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0010 */ -/* [local] */ - -typedef struct D3D10_BUFFER_SRV - { - union - { - UINT FirstElement; - UINT ElementOffset; - } ; - union - { - UINT NumElements; - UINT ElementWidth; - } ; - } D3D10_BUFFER_SRV; - -typedef struct D3D10_TEX1D_SRV - { - UINT MostDetailedMip; - UINT MipLevels; - } D3D10_TEX1D_SRV; - -typedef struct D3D10_TEX1D_ARRAY_SRV - { - UINT MostDetailedMip; - UINT MipLevels; - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX1D_ARRAY_SRV; - -typedef struct D3D10_TEX2D_SRV - { - UINT MostDetailedMip; - UINT MipLevels; - } D3D10_TEX2D_SRV; - -typedef struct D3D10_TEX2D_ARRAY_SRV - { - UINT MostDetailedMip; - UINT MipLevels; - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX2D_ARRAY_SRV; - -typedef struct D3D10_TEX3D_SRV - { - UINT MostDetailedMip; - UINT MipLevels; - } D3D10_TEX3D_SRV; - -typedef struct D3D10_TEXCUBE_SRV - { - UINT MostDetailedMip; - UINT MipLevels; - } D3D10_TEXCUBE_SRV; - -typedef struct D3D10_TEX2DMS_SRV - { - UINT UnusedField_NothingToDefine; - } D3D10_TEX2DMS_SRV; - -typedef struct D3D10_TEX2DMS_ARRAY_SRV - { - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX2DMS_ARRAY_SRV; - -typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC - { - DXGI_FORMAT Format; - D3D10_SRV_DIMENSION ViewDimension; - union - { - D3D10_BUFFER_SRV Buffer; - D3D10_TEX1D_SRV Texture1D; - D3D10_TEX1D_ARRAY_SRV Texture1DArray; - D3D10_TEX2D_SRV Texture2D; - D3D10_TEX2D_ARRAY_SRV Texture2DArray; - D3D10_TEX2DMS_SRV Texture2DMS; - D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; - D3D10_TEX3D_SRV Texture3D; - D3D10_TEXCUBE_SRV TextureCube; - } ; - } D3D10_SHADER_RESOURCE_VIEW_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0010_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0010_v0_0_s_ifspec; - -#ifndef __ID3D10ShaderResourceView_INTERFACE_DEFINED__ -#define __ID3D10ShaderResourceView_INTERFACE_DEFINED__ - -/* interface ID3D10ShaderResourceView */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10ShaderResourceView; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C07-342C-4106-A19F-4F2704F689F0") - ID3D10ShaderResourceView : public ID3D10View - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10ShaderResourceViewVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10ShaderResourceView * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10ShaderResourceView * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10ShaderResourceView * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10ShaderResourceView * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10ShaderResourceView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10ShaderResourceView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10ShaderResourceView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetResource )( - ID3D10ShaderResourceView * This, - /* [annotation] */ - _Out_ ID3D10Resource **ppResource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10ShaderResourceView * This, - /* [annotation] */ - _Out_ D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); - - END_INTERFACE - } ID3D10ShaderResourceViewVtbl; - - interface ID3D10ShaderResourceView - { - CONST_VTBL struct ID3D10ShaderResourceViewVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10ShaderResourceView_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10ShaderResourceView_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10ShaderResourceView_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10ShaderResourceView_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10ShaderResourceView_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10ShaderResourceView_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10ShaderResourceView_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10ShaderResourceView_GetResource(This,ppResource) \ - ( (This)->lpVtbl -> GetResource(This,ppResource) ) - - -#define ID3D10ShaderResourceView_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10ShaderResourceView_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0011 */ -/* [local] */ - -typedef struct D3D10_BUFFER_RTV - { - union - { - UINT FirstElement; - UINT ElementOffset; - } ; - union - { - UINT NumElements; - UINT ElementWidth; - } ; - } D3D10_BUFFER_RTV; - -typedef struct D3D10_TEX1D_RTV - { - UINT MipSlice; - } D3D10_TEX1D_RTV; - -typedef struct D3D10_TEX1D_ARRAY_RTV - { - UINT MipSlice; - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX1D_ARRAY_RTV; - -typedef struct D3D10_TEX2D_RTV - { - UINT MipSlice; - } D3D10_TEX2D_RTV; - -typedef struct D3D10_TEX2DMS_RTV - { - UINT UnusedField_NothingToDefine; - } D3D10_TEX2DMS_RTV; - -typedef struct D3D10_TEX2D_ARRAY_RTV - { - UINT MipSlice; - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX2D_ARRAY_RTV; - -typedef struct D3D10_TEX2DMS_ARRAY_RTV - { - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX2DMS_ARRAY_RTV; - -typedef struct D3D10_TEX3D_RTV - { - UINT MipSlice; - UINT FirstWSlice; - UINT WSize; - } D3D10_TEX3D_RTV; - -typedef struct D3D10_RENDER_TARGET_VIEW_DESC - { - DXGI_FORMAT Format; - D3D10_RTV_DIMENSION ViewDimension; - union - { - D3D10_BUFFER_RTV Buffer; - D3D10_TEX1D_RTV Texture1D; - D3D10_TEX1D_ARRAY_RTV Texture1DArray; - D3D10_TEX2D_RTV Texture2D; - D3D10_TEX2D_ARRAY_RTV Texture2DArray; - D3D10_TEX2DMS_RTV Texture2DMS; - D3D10_TEX2DMS_ARRAY_RTV Texture2DMSArray; - D3D10_TEX3D_RTV Texture3D; - } ; - } D3D10_RENDER_TARGET_VIEW_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0011_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0011_v0_0_s_ifspec; - -#ifndef __ID3D10RenderTargetView_INTERFACE_DEFINED__ -#define __ID3D10RenderTargetView_INTERFACE_DEFINED__ - -/* interface ID3D10RenderTargetView */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10RenderTargetView; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C08-342C-4106-A19F-4F2704F689F0") - ID3D10RenderTargetView : public ID3D10View - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_RENDER_TARGET_VIEW_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10RenderTargetViewVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10RenderTargetView * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10RenderTargetView * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10RenderTargetView * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10RenderTargetView * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10RenderTargetView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10RenderTargetView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10RenderTargetView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetResource )( - ID3D10RenderTargetView * This, - /* [annotation] */ - _Out_ ID3D10Resource **ppResource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10RenderTargetView * This, - /* [annotation] */ - _Out_ D3D10_RENDER_TARGET_VIEW_DESC *pDesc); - - END_INTERFACE - } ID3D10RenderTargetViewVtbl; - - interface ID3D10RenderTargetView - { - CONST_VTBL struct ID3D10RenderTargetViewVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10RenderTargetView_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10RenderTargetView_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10RenderTargetView_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10RenderTargetView_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10RenderTargetView_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10RenderTargetView_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10RenderTargetView_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10RenderTargetView_GetResource(This,ppResource) \ - ( (This)->lpVtbl -> GetResource(This,ppResource) ) - - -#define ID3D10RenderTargetView_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10RenderTargetView_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0012 */ -/* [local] */ - -typedef struct D3D10_TEX1D_DSV - { - UINT MipSlice; - } D3D10_TEX1D_DSV; - -typedef struct D3D10_TEX1D_ARRAY_DSV - { - UINT MipSlice; - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX1D_ARRAY_DSV; - -typedef struct D3D10_TEX2D_DSV - { - UINT MipSlice; - } D3D10_TEX2D_DSV; - -typedef struct D3D10_TEX2D_ARRAY_DSV - { - UINT MipSlice; - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX2D_ARRAY_DSV; - -typedef struct D3D10_TEX2DMS_DSV - { - UINT UnusedField_NothingToDefine; - } D3D10_TEX2DMS_DSV; - -typedef struct D3D10_TEX2DMS_ARRAY_DSV - { - UINT FirstArraySlice; - UINT ArraySize; - } D3D10_TEX2DMS_ARRAY_DSV; - -typedef struct D3D10_DEPTH_STENCIL_VIEW_DESC - { - DXGI_FORMAT Format; - D3D10_DSV_DIMENSION ViewDimension; - union - { - D3D10_TEX1D_DSV Texture1D; - D3D10_TEX1D_ARRAY_DSV Texture1DArray; - D3D10_TEX2D_DSV Texture2D; - D3D10_TEX2D_ARRAY_DSV Texture2DArray; - D3D10_TEX2DMS_DSV Texture2DMS; - D3D10_TEX2DMS_ARRAY_DSV Texture2DMSArray; - } ; - } D3D10_DEPTH_STENCIL_VIEW_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0012_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0012_v0_0_s_ifspec; - -#ifndef __ID3D10DepthStencilView_INTERFACE_DEFINED__ -#define __ID3D10DepthStencilView_INTERFACE_DEFINED__ - -/* interface ID3D10DepthStencilView */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10DepthStencilView; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C09-342C-4106-A19F-4F2704F689F0") - ID3D10DepthStencilView : public ID3D10View - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10DepthStencilViewVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10DepthStencilView * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10DepthStencilView * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10DepthStencilView * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10DepthStencilView * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10DepthStencilView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10DepthStencilView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10DepthStencilView * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetResource )( - ID3D10DepthStencilView * This, - /* [annotation] */ - _Out_ ID3D10Resource **ppResource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10DepthStencilView * This, - /* [annotation] */ - _Out_ D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc); - - END_INTERFACE - } ID3D10DepthStencilViewVtbl; - - interface ID3D10DepthStencilView - { - CONST_VTBL struct ID3D10DepthStencilViewVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10DepthStencilView_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10DepthStencilView_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10DepthStencilView_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10DepthStencilView_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10DepthStencilView_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10DepthStencilView_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10DepthStencilView_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10DepthStencilView_GetResource(This,ppResource) \ - ( (This)->lpVtbl -> GetResource(This,ppResource) ) - - -#define ID3D10DepthStencilView_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10DepthStencilView_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10VertexShader_INTERFACE_DEFINED__ -#define __ID3D10VertexShader_INTERFACE_DEFINED__ - -/* interface ID3D10VertexShader */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10VertexShader; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C0A-342C-4106-A19F-4F2704F689F0") - ID3D10VertexShader : public ID3D10DeviceChild - { - public: - }; - - -#else /* C style interface */ - - typedef struct ID3D10VertexShaderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10VertexShader * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10VertexShader * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10VertexShader * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10VertexShader * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10VertexShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10VertexShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10VertexShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - END_INTERFACE - } ID3D10VertexShaderVtbl; - - interface ID3D10VertexShader - { - CONST_VTBL struct ID3D10VertexShaderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10VertexShader_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10VertexShader_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10VertexShader_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10VertexShader_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10VertexShader_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10VertexShader_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10VertexShader_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10VertexShader_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10GeometryShader_INTERFACE_DEFINED__ -#define __ID3D10GeometryShader_INTERFACE_DEFINED__ - -/* interface ID3D10GeometryShader */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10GeometryShader; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("6316BE88-54CD-4040-AB44-20461BC81F68") - ID3D10GeometryShader : public ID3D10DeviceChild - { - public: - }; - - -#else /* C style interface */ - - typedef struct ID3D10GeometryShaderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10GeometryShader * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10GeometryShader * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10GeometryShader * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10GeometryShader * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10GeometryShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10GeometryShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10GeometryShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - END_INTERFACE - } ID3D10GeometryShaderVtbl; - - interface ID3D10GeometryShader - { - CONST_VTBL struct ID3D10GeometryShaderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10GeometryShader_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10GeometryShader_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10GeometryShader_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10GeometryShader_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10GeometryShader_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10GeometryShader_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10GeometryShader_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10GeometryShader_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10PixelShader_INTERFACE_DEFINED__ -#define __ID3D10PixelShader_INTERFACE_DEFINED__ - -/* interface ID3D10PixelShader */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10PixelShader; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("4968B601-9D00-4cde-8346-8E7F675819B6") - ID3D10PixelShader : public ID3D10DeviceChild - { - public: - }; - - -#else /* C style interface */ - - typedef struct ID3D10PixelShaderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10PixelShader * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10PixelShader * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10PixelShader * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10PixelShader * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10PixelShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10PixelShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10PixelShader * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - END_INTERFACE - } ID3D10PixelShaderVtbl; - - interface ID3D10PixelShader - { - CONST_VTBL struct ID3D10PixelShaderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10PixelShader_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10PixelShader_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10PixelShader_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10PixelShader_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10PixelShader_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10PixelShader_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10PixelShader_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10PixelShader_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10InputLayout_INTERFACE_DEFINED__ -#define __ID3D10InputLayout_INTERFACE_DEFINED__ - -/* interface ID3D10InputLayout */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10InputLayout; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C0B-342C-4106-A19F-4F2704F689F0") - ID3D10InputLayout : public ID3D10DeviceChild - { - public: - }; - - -#else /* C style interface */ - - typedef struct ID3D10InputLayoutVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10InputLayout * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10InputLayout * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10InputLayout * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10InputLayout * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10InputLayout * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10InputLayout * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10InputLayout * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - END_INTERFACE - } ID3D10InputLayoutVtbl; - - interface ID3D10InputLayout - { - CONST_VTBL struct ID3D10InputLayoutVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10InputLayout_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10InputLayout_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10InputLayout_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10InputLayout_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10InputLayout_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10InputLayout_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10InputLayout_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10InputLayout_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0017 */ -/* [local] */ - -typedef -enum D3D10_FILTER - { - D3D10_FILTER_MIN_MAG_MIP_POINT = 0, - D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1, - D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4, - D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5, - D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10, - D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11, - D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14, - D3D10_FILTER_MIN_MAG_MIP_LINEAR = 0x15, - D3D10_FILTER_ANISOTROPIC = 0x55, - D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80, - D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81, - D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84, - D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85, - D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90, - D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91, - D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94, - D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95, - D3D10_FILTER_COMPARISON_ANISOTROPIC = 0xd5, - D3D10_FILTER_TEXT_1BIT = 0x80000000 - } D3D10_FILTER; - -typedef -enum D3D10_FILTER_TYPE - { - D3D10_FILTER_TYPE_POINT = 0, - D3D10_FILTER_TYPE_LINEAR = 1 - } D3D10_FILTER_TYPE; - -#define D3D10_FILTER_TYPE_MASK ( 0x3 ) - -#define D3D10_MIN_FILTER_SHIFT ( 4 ) - -#define D3D10_MAG_FILTER_SHIFT ( 2 ) - -#define D3D10_MIP_FILTER_SHIFT ( 0 ) - -#define D3D10_COMPARISON_FILTERING_BIT ( 0x80 ) - -#define D3D10_ANISOTROPIC_FILTERING_BIT ( 0x40 ) - -#define D3D10_TEXT_1BIT_BIT ( 0x80000000 ) - -#define D3D10_ENCODE_BASIC_FILTER( min, mag, mip, bComparison ) \ - ( ( D3D10_FILTER ) ( \ - ( ( bComparison ) ? D3D10_COMPARISON_FILTERING_BIT : 0 ) | \ - ( ( ( min ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MIN_FILTER_SHIFT ) | \ - ( ( ( mag ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MAG_FILTER_SHIFT ) | \ - ( ( ( mip ) & D3D10_FILTER_TYPE_MASK ) << D3D10_MIP_FILTER_SHIFT ) ) ) -#define D3D10_ENCODE_ANISOTROPIC_FILTER( bComparison ) \ - ( ( D3D10_FILTER ) ( \ - D3D10_ANISOTROPIC_FILTERING_BIT | \ - D3D10_ENCODE_BASIC_FILTER( D3D10_FILTER_TYPE_LINEAR, \ - D3D10_FILTER_TYPE_LINEAR, \ - D3D10_FILTER_TYPE_LINEAR, \ - bComparison ) ) ) -#define D3D10_DECODE_MIN_FILTER( d3d10Filter ) \ - ( ( D3D10_FILTER_TYPE ) \ - ( ( ( d3d10Filter ) >> D3D10_MIN_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) -#define D3D10_DECODE_MAG_FILTER( d3d10Filter ) \ - ( ( D3D10_FILTER_TYPE ) \ - ( ( ( d3d10Filter ) >> D3D10_MAG_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) -#define D3D10_DECODE_MIP_FILTER( d3d10Filter ) \ - ( ( D3D10_FILTER_TYPE ) \ - ( ( ( d3d10Filter ) >> D3D10_MIP_FILTER_SHIFT ) & D3D10_FILTER_TYPE_MASK ) ) -#define D3D10_DECODE_IS_COMPARISON_FILTER( d3d10Filter ) \ - ( ( d3d10Filter ) & D3D10_COMPARISON_FILTERING_BIT ) -#define D3D10_DECODE_IS_ANISOTROPIC_FILTER( d3d10Filter ) \ - ( ( ( d3d10Filter ) & D3D10_ANISOTROPIC_FILTERING_BIT ) && \ - ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIN_FILTER( d3d10Filter ) ) && \ - ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MAG_FILTER( d3d10Filter ) ) && \ - ( D3D10_FILTER_TYPE_LINEAR == D3D10_DECODE_MIP_FILTER( d3d10Filter ) ) ) -#define D3D10_DECODE_IS_TEXT_1BIT_FILTER( d3d10Filter ) \ - ( ( d3d10Filter ) == D3D10_TEXT_1BIT_BIT ) -typedef -enum D3D10_TEXTURE_ADDRESS_MODE - { - D3D10_TEXTURE_ADDRESS_WRAP = 1, - D3D10_TEXTURE_ADDRESS_MIRROR = 2, - D3D10_TEXTURE_ADDRESS_CLAMP = 3, - D3D10_TEXTURE_ADDRESS_BORDER = 4, - D3D10_TEXTURE_ADDRESS_MIRROR_ONCE = 5 - } D3D10_TEXTURE_ADDRESS_MODE; - -typedef struct D3D10_SAMPLER_DESC - { - D3D10_FILTER Filter; - D3D10_TEXTURE_ADDRESS_MODE AddressU; - D3D10_TEXTURE_ADDRESS_MODE AddressV; - D3D10_TEXTURE_ADDRESS_MODE AddressW; - FLOAT MipLODBias; - UINT MaxAnisotropy; - D3D10_COMPARISON_FUNC ComparisonFunc; - FLOAT BorderColor[ 4 ]; - FLOAT MinLOD; - FLOAT MaxLOD; - } D3D10_SAMPLER_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0017_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0017_v0_0_s_ifspec; - -#ifndef __ID3D10SamplerState_INTERFACE_DEFINED__ -#define __ID3D10SamplerState_INTERFACE_DEFINED__ - -/* interface ID3D10SamplerState */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10SamplerState; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C0C-342C-4106-A19F-4F2704F689F0") - ID3D10SamplerState : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_SAMPLER_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10SamplerStateVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10SamplerState * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10SamplerState * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10SamplerState * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10SamplerState * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10SamplerState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10SamplerState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10SamplerState * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10SamplerState * This, - /* [annotation] */ - _Out_ D3D10_SAMPLER_DESC *pDesc); - - END_INTERFACE - } ID3D10SamplerStateVtbl; - - interface ID3D10SamplerState - { - CONST_VTBL struct ID3D10SamplerStateVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10SamplerState_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10SamplerState_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10SamplerState_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10SamplerState_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10SamplerState_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10SamplerState_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10SamplerState_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10SamplerState_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10SamplerState_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0018 */ -/* [local] */ - -typedef -enum D3D10_FORMAT_SUPPORT - { - D3D10_FORMAT_SUPPORT_BUFFER = 0x1, - D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER = 0x2, - D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER = 0x4, - D3D10_FORMAT_SUPPORT_SO_BUFFER = 0x8, - D3D10_FORMAT_SUPPORT_TEXTURE1D = 0x10, - D3D10_FORMAT_SUPPORT_TEXTURE2D = 0x20, - D3D10_FORMAT_SUPPORT_TEXTURE3D = 0x40, - D3D10_FORMAT_SUPPORT_TEXTURECUBE = 0x80, - D3D10_FORMAT_SUPPORT_SHADER_LOAD = 0x100, - D3D10_FORMAT_SUPPORT_SHADER_SAMPLE = 0x200, - D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = 0x400, - D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = 0x800, - D3D10_FORMAT_SUPPORT_MIP = 0x1000, - D3D10_FORMAT_SUPPORT_MIP_AUTOGEN = 0x2000, - D3D10_FORMAT_SUPPORT_RENDER_TARGET = 0x4000, - D3D10_FORMAT_SUPPORT_BLENDABLE = 0x8000, - D3D10_FORMAT_SUPPORT_DEPTH_STENCIL = 0x10000, - D3D10_FORMAT_SUPPORT_CPU_LOCKABLE = 0x20000, - D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = 0x40000, - D3D10_FORMAT_SUPPORT_DISPLAY = 0x80000, - D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = 0x100000, - D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = 0x200000, - D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD = 0x400000, - D3D10_FORMAT_SUPPORT_SHADER_GATHER = 0x800000, - D3D10_FORMAT_SUPPORT_BACK_BUFFER_CAST = 0x1000000 - } D3D10_FORMAT_SUPPORT; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0018_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0018_v0_0_s_ifspec; - -#ifndef __ID3D10Asynchronous_INTERFACE_DEFINED__ -#define __ID3D10Asynchronous_INTERFACE_DEFINED__ - -/* interface ID3D10Asynchronous */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Asynchronous; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C0D-342C-4106-A19F-4F2704F689F0") - ID3D10Asynchronous : public ID3D10DeviceChild - { - public: - virtual void STDMETHODCALLTYPE Begin( void) = 0; - - virtual void STDMETHODCALLTYPE End( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetData( - /* [annotation] */ - _Out_writes_bytes_opt_(DataSize) void *pData, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_ UINT GetDataFlags) = 0; - - virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10AsynchronousVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Asynchronous * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Asynchronous * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Asynchronous * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Asynchronous * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Asynchronous * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Asynchronous * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Asynchronous * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *Begin )( - ID3D10Asynchronous * This); - - void ( STDMETHODCALLTYPE *End )( - ID3D10Asynchronous * This); - - HRESULT ( STDMETHODCALLTYPE *GetData )( - ID3D10Asynchronous * This, - /* [annotation] */ - _Out_writes_bytes_opt_(DataSize) void *pData, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_ UINT GetDataFlags); - - UINT ( STDMETHODCALLTYPE *GetDataSize )( - ID3D10Asynchronous * This); - - END_INTERFACE - } ID3D10AsynchronousVtbl; - - interface ID3D10Asynchronous - { - CONST_VTBL struct ID3D10AsynchronousVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Asynchronous_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Asynchronous_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Asynchronous_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Asynchronous_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Asynchronous_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Asynchronous_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Asynchronous_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Asynchronous_Begin(This) \ - ( (This)->lpVtbl -> Begin(This) ) - -#define ID3D10Asynchronous_End(This) \ - ( (This)->lpVtbl -> End(This) ) - -#define ID3D10Asynchronous_GetData(This,pData,DataSize,GetDataFlags) \ - ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) - -#define ID3D10Asynchronous_GetDataSize(This) \ - ( (This)->lpVtbl -> GetDataSize(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Asynchronous_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0019 */ -/* [local] */ - -typedef -enum D3D10_ASYNC_GETDATA_FLAG - { - D3D10_ASYNC_GETDATA_DONOTFLUSH = 0x1 - } D3D10_ASYNC_GETDATA_FLAG; - -typedef -enum D3D10_QUERY - { - D3D10_QUERY_EVENT = 0, - D3D10_QUERY_OCCLUSION = ( D3D10_QUERY_EVENT + 1 ) , - D3D10_QUERY_TIMESTAMP = ( D3D10_QUERY_OCCLUSION + 1 ) , - D3D10_QUERY_TIMESTAMP_DISJOINT = ( D3D10_QUERY_TIMESTAMP + 1 ) , - D3D10_QUERY_PIPELINE_STATISTICS = ( D3D10_QUERY_TIMESTAMP_DISJOINT + 1 ) , - D3D10_QUERY_OCCLUSION_PREDICATE = ( D3D10_QUERY_PIPELINE_STATISTICS + 1 ) , - D3D10_QUERY_SO_STATISTICS = ( D3D10_QUERY_OCCLUSION_PREDICATE + 1 ) , - D3D10_QUERY_SO_OVERFLOW_PREDICATE = ( D3D10_QUERY_SO_STATISTICS + 1 ) - } D3D10_QUERY; - -typedef -enum D3D10_QUERY_MISC_FLAG - { - D3D10_QUERY_MISC_PREDICATEHINT = 0x1 - } D3D10_QUERY_MISC_FLAG; - -typedef struct D3D10_QUERY_DESC - { - D3D10_QUERY Query; - UINT MiscFlags; - } D3D10_QUERY_DESC; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0019_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0019_v0_0_s_ifspec; - -#ifndef __ID3D10Query_INTERFACE_DEFINED__ -#define __ID3D10Query_INTERFACE_DEFINED__ - -/* interface ID3D10Query */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Query; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C0E-342C-4106-A19F-4F2704F689F0") - ID3D10Query : public ID3D10Asynchronous - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_QUERY_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10QueryVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Query * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Query * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Query * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Query * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Query * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Query * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Query * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *Begin )( - ID3D10Query * This); - - void ( STDMETHODCALLTYPE *End )( - ID3D10Query * This); - - HRESULT ( STDMETHODCALLTYPE *GetData )( - ID3D10Query * This, - /* [annotation] */ - _Out_writes_bytes_opt_(DataSize) void *pData, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_ UINT GetDataFlags); - - UINT ( STDMETHODCALLTYPE *GetDataSize )( - ID3D10Query * This); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Query * This, - /* [annotation] */ - _Out_ D3D10_QUERY_DESC *pDesc); - - END_INTERFACE - } ID3D10QueryVtbl; - - interface ID3D10Query - { - CONST_VTBL struct ID3D10QueryVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Query_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Query_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Query_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Query_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Query_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Query_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Query_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Query_Begin(This) \ - ( (This)->lpVtbl -> Begin(This) ) - -#define ID3D10Query_End(This) \ - ( (This)->lpVtbl -> End(This) ) - -#define ID3D10Query_GetData(This,pData,DataSize,GetDataFlags) \ - ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) - -#define ID3D10Query_GetDataSize(This) \ - ( (This)->lpVtbl -> GetDataSize(This) ) - - -#define ID3D10Query_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Query_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10Predicate_INTERFACE_DEFINED__ -#define __ID3D10Predicate_INTERFACE_DEFINED__ - -/* interface ID3D10Predicate */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Predicate; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C10-342C-4106-A19F-4F2704F689F0") - ID3D10Predicate : public ID3D10Query - { - public: - }; - - -#else /* C style interface */ - - typedef struct ID3D10PredicateVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Predicate * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Predicate * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Predicate * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Predicate * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Predicate * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Predicate * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Predicate * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *Begin )( - ID3D10Predicate * This); - - void ( STDMETHODCALLTYPE *End )( - ID3D10Predicate * This); - - HRESULT ( STDMETHODCALLTYPE *GetData )( - ID3D10Predicate * This, - /* [annotation] */ - _Out_writes_bytes_opt_(DataSize) void *pData, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_ UINT GetDataFlags); - - UINT ( STDMETHODCALLTYPE *GetDataSize )( - ID3D10Predicate * This); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Predicate * This, - /* [annotation] */ - _Out_ D3D10_QUERY_DESC *pDesc); - - END_INTERFACE - } ID3D10PredicateVtbl; - - interface ID3D10Predicate - { - CONST_VTBL struct ID3D10PredicateVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Predicate_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Predicate_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Predicate_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Predicate_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Predicate_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Predicate_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Predicate_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Predicate_Begin(This) \ - ( (This)->lpVtbl -> Begin(This) ) - -#define ID3D10Predicate_End(This) \ - ( (This)->lpVtbl -> End(This) ) - -#define ID3D10Predicate_GetData(This,pData,DataSize,GetDataFlags) \ - ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) - -#define ID3D10Predicate_GetDataSize(This) \ - ( (This)->lpVtbl -> GetDataSize(This) ) - - -#define ID3D10Predicate_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Predicate_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0021 */ -/* [local] */ - -typedef struct D3D10_QUERY_DATA_TIMESTAMP_DISJOINT - { - UINT64 Frequency; - BOOL Disjoint; - } D3D10_QUERY_DATA_TIMESTAMP_DISJOINT; - -typedef struct D3D10_QUERY_DATA_PIPELINE_STATISTICS - { - UINT64 IAVertices; - UINT64 IAPrimitives; - UINT64 VSInvocations; - UINT64 GSInvocations; - UINT64 GSPrimitives; - UINT64 CInvocations; - UINT64 CPrimitives; - UINT64 PSInvocations; - } D3D10_QUERY_DATA_PIPELINE_STATISTICS; - -typedef struct D3D10_QUERY_DATA_SO_STATISTICS - { - UINT64 NumPrimitivesWritten; - UINT64 PrimitivesStorageNeeded; - } D3D10_QUERY_DATA_SO_STATISTICS; - -typedef -enum D3D10_COUNTER - { - D3D10_COUNTER_GPU_IDLE = 0, - D3D10_COUNTER_VERTEX_PROCESSING = ( D3D10_COUNTER_GPU_IDLE + 1 ) , - D3D10_COUNTER_GEOMETRY_PROCESSING = ( D3D10_COUNTER_VERTEX_PROCESSING + 1 ) , - D3D10_COUNTER_PIXEL_PROCESSING = ( D3D10_COUNTER_GEOMETRY_PROCESSING + 1 ) , - D3D10_COUNTER_OTHER_GPU_PROCESSING = ( D3D10_COUNTER_PIXEL_PROCESSING + 1 ) , - D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION = ( D3D10_COUNTER_OTHER_GPU_PROCESSING + 1 ) , - D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION = ( D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION + 1 ) , - D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION + 1 ) , - D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION + 1 ) , - D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION = ( D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION + 1 ) , - D3D10_COUNTER_VS_MEMORY_LIMITED = ( D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION + 1 ) , - D3D10_COUNTER_VS_COMPUTATION_LIMITED = ( D3D10_COUNTER_VS_MEMORY_LIMITED + 1 ) , - D3D10_COUNTER_GS_MEMORY_LIMITED = ( D3D10_COUNTER_VS_COMPUTATION_LIMITED + 1 ) , - D3D10_COUNTER_GS_COMPUTATION_LIMITED = ( D3D10_COUNTER_GS_MEMORY_LIMITED + 1 ) , - D3D10_COUNTER_PS_MEMORY_LIMITED = ( D3D10_COUNTER_GS_COMPUTATION_LIMITED + 1 ) , - D3D10_COUNTER_PS_COMPUTATION_LIMITED = ( D3D10_COUNTER_PS_MEMORY_LIMITED + 1 ) , - D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE = ( D3D10_COUNTER_PS_COMPUTATION_LIMITED + 1 ) , - D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE = ( D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE + 1 ) , - D3D10_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000 - } D3D10_COUNTER; - -typedef -enum D3D10_COUNTER_TYPE - { - D3D10_COUNTER_TYPE_FLOAT32 = 0, - D3D10_COUNTER_TYPE_UINT16 = ( D3D10_COUNTER_TYPE_FLOAT32 + 1 ) , - D3D10_COUNTER_TYPE_UINT32 = ( D3D10_COUNTER_TYPE_UINT16 + 1 ) , - D3D10_COUNTER_TYPE_UINT64 = ( D3D10_COUNTER_TYPE_UINT32 + 1 ) - } D3D10_COUNTER_TYPE; - -typedef struct D3D10_COUNTER_DESC - { - D3D10_COUNTER Counter; - UINT MiscFlags; - } D3D10_COUNTER_DESC; - -typedef struct D3D10_COUNTER_INFO - { - D3D10_COUNTER LastDeviceDependentCounter; - UINT NumSimultaneousCounters; - UINT8 NumDetectableParallelUnits; - } D3D10_COUNTER_INFO; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0021_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0021_v0_0_s_ifspec; - -#ifndef __ID3D10Counter_INTERFACE_DEFINED__ -#define __ID3D10Counter_INTERFACE_DEFINED__ - -/* interface ID3D10Counter */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Counter; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C11-342C-4106-A19F-4F2704F689F0") - ID3D10Counter : public ID3D10Asynchronous - { - public: - virtual void STDMETHODCALLTYPE GetDesc( - /* [annotation] */ - _Out_ D3D10_COUNTER_DESC *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10CounterVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Counter * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Counter * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Counter * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10Counter * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Counter * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Counter * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Counter * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *Begin )( - ID3D10Counter * This); - - void ( STDMETHODCALLTYPE *End )( - ID3D10Counter * This); - - HRESULT ( STDMETHODCALLTYPE *GetData )( - ID3D10Counter * This, - /* [annotation] */ - _Out_writes_bytes_opt_(DataSize) void *pData, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_ UINT GetDataFlags); - - UINT ( STDMETHODCALLTYPE *GetDataSize )( - ID3D10Counter * This); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10Counter * This, - /* [annotation] */ - _Out_ D3D10_COUNTER_DESC *pDesc); - - END_INTERFACE - } ID3D10CounterVtbl; - - interface ID3D10Counter - { - CONST_VTBL struct ID3D10CounterVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Counter_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Counter_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Counter_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Counter_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10Counter_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Counter_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Counter_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10Counter_Begin(This) \ - ( (This)->lpVtbl -> Begin(This) ) - -#define ID3D10Counter_End(This) \ - ( (This)->lpVtbl -> End(This) ) - -#define ID3D10Counter_GetData(This,pData,DataSize,GetDataFlags) \ - ( (This)->lpVtbl -> GetData(This,pData,DataSize,GetDataFlags) ) - -#define ID3D10Counter_GetDataSize(This) \ - ( (This)->lpVtbl -> GetDataSize(This) ) - - -#define ID3D10Counter_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Counter_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10Device_INTERFACE_DEFINED__ -#define __ID3D10Device_INTERFACE_DEFINED__ - -/* interface ID3D10Device */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Device; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C0F-342C-4106-A19F-4F2704F689F0") - ID3D10Device : public IUnknown - { - public: - virtual void STDMETHODCALLTYPE VSSetConstantBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; - - virtual void STDMETHODCALLTYPE PSSetShaderResources( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; - - virtual void STDMETHODCALLTYPE PSSetShader( - /* [annotation] */ - _In_opt_ ID3D10PixelShader *pPixelShader) = 0; - - virtual void STDMETHODCALLTYPE PSSetSamplers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; - - virtual void STDMETHODCALLTYPE VSSetShader( - /* [annotation] */ - _In_opt_ ID3D10VertexShader *pVertexShader) = 0; - - virtual void STDMETHODCALLTYPE DrawIndexed( - /* [annotation] */ - _In_ UINT IndexCount, - /* [annotation] */ - _In_ UINT StartIndexLocation, - /* [annotation] */ - _In_ INT BaseVertexLocation) = 0; - - virtual void STDMETHODCALLTYPE Draw( - /* [annotation] */ - _In_ UINT VertexCount, - /* [annotation] */ - _In_ UINT StartVertexLocation) = 0; - - virtual void STDMETHODCALLTYPE PSSetConstantBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; - - virtual void STDMETHODCALLTYPE IASetInputLayout( - /* [annotation] */ - _In_opt_ ID3D10InputLayout *pInputLayout) = 0; - - virtual void STDMETHODCALLTYPE IASetVertexBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pStrides, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pOffsets) = 0; - - virtual void STDMETHODCALLTYPE IASetIndexBuffer( - /* [annotation] */ - _In_opt_ ID3D10Buffer *pIndexBuffer, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _In_ UINT Offset) = 0; - - virtual void STDMETHODCALLTYPE DrawIndexedInstanced( - /* [annotation] */ - _In_ UINT IndexCountPerInstance, - /* [annotation] */ - _In_ UINT InstanceCount, - /* [annotation] */ - _In_ UINT StartIndexLocation, - /* [annotation] */ - _In_ INT BaseVertexLocation, - /* [annotation] */ - _In_ UINT StartInstanceLocation) = 0; - - virtual void STDMETHODCALLTYPE DrawInstanced( - /* [annotation] */ - _In_ UINT VertexCountPerInstance, - /* [annotation] */ - _In_ UINT InstanceCount, - /* [annotation] */ - _In_ UINT StartVertexLocation, - /* [annotation] */ - _In_ UINT StartInstanceLocation) = 0; - - virtual void STDMETHODCALLTYPE GSSetConstantBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers) = 0; - - virtual void STDMETHODCALLTYPE GSSetShader( - /* [annotation] */ - _In_opt_ ID3D10GeometryShader *pShader) = 0; - - virtual void STDMETHODCALLTYPE IASetPrimitiveTopology( - /* [annotation] */ - _In_ D3D10_PRIMITIVE_TOPOLOGY Topology) = 0; - - virtual void STDMETHODCALLTYPE VSSetShaderResources( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; - - virtual void STDMETHODCALLTYPE VSSetSamplers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; - - virtual void STDMETHODCALLTYPE SetPredication( - /* [annotation] */ - _In_opt_ ID3D10Predicate *pPredicate, - /* [annotation] */ - _In_ BOOL PredicateValue) = 0; - - virtual void STDMETHODCALLTYPE GSSetShaderResources( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews) = 0; - - virtual void STDMETHODCALLTYPE GSSetSamplers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers) = 0; - - virtual void STDMETHODCALLTYPE OMSetRenderTargets( - /* [annotation] */ - _In_range_( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, - /* [annotation] */ - _In_opt_ ID3D10DepthStencilView *pDepthStencilView) = 0; - - virtual void STDMETHODCALLTYPE OMSetBlendState( - /* [annotation] */ - _In_opt_ ID3D10BlendState *pBlendState, - /* [annotation] */ - _In_ const FLOAT BlendFactor[ 4 ], - /* [annotation] */ - _In_ UINT SampleMask) = 0; - - virtual void STDMETHODCALLTYPE OMSetDepthStencilState( - /* [annotation] */ - _In_opt_ ID3D10DepthStencilState *pDepthStencilState, - /* [annotation] */ - _In_ UINT StencilRef) = 0; - - virtual void STDMETHODCALLTYPE SOSetTargets( - /* [annotation] */ - _In_range_( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppSOTargets, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pOffsets) = 0; - - virtual void STDMETHODCALLTYPE DrawAuto( void) = 0; - - virtual void STDMETHODCALLTYPE RSSetState( - /* [annotation] */ - _In_opt_ ID3D10RasterizerState *pRasterizerState) = 0; - - virtual void STDMETHODCALLTYPE RSSetViewports( - /* [annotation] */ - _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, - /* [annotation] */ - _In_reads_opt_(NumViewports) const D3D10_VIEWPORT *pViewports) = 0; - - virtual void STDMETHODCALLTYPE RSSetScissorRects( - /* [annotation] */ - _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, - /* [annotation] */ - _In_reads_opt_(NumRects) const D3D10_RECT *pRects) = 0; - - virtual void STDMETHODCALLTYPE CopySubresourceRegion( - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_ UINT DstX, - /* [annotation] */ - _In_ UINT DstY, - /* [annotation] */ - _In_ UINT DstZ, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource, - /* [annotation] */ - _In_ UINT SrcSubresource, - /* [annotation] */ - _In_opt_ const D3D10_BOX *pSrcBox) = 0; - - virtual void STDMETHODCALLTYPE CopyResource( - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource) = 0; - - virtual void STDMETHODCALLTYPE UpdateSubresource( - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_opt_ const D3D10_BOX *pDstBox, - /* [annotation] */ - _In_ const void *pSrcData, - /* [annotation] */ - _In_ UINT SrcRowPitch, - /* [annotation] */ - _In_ UINT SrcDepthPitch) = 0; - - virtual void STDMETHODCALLTYPE ClearRenderTargetView( - /* [annotation] */ - _In_ ID3D10RenderTargetView *pRenderTargetView, - /* [annotation] */ - _In_ const FLOAT ColorRGBA[ 4 ]) = 0; - - virtual void STDMETHODCALLTYPE ClearDepthStencilView( - /* [annotation] */ - _In_ ID3D10DepthStencilView *pDepthStencilView, - /* [annotation] */ - _In_ UINT ClearFlags, - /* [annotation] */ - _In_ FLOAT Depth, - /* [annotation] */ - _In_ UINT8 Stencil) = 0; - - virtual void STDMETHODCALLTYPE GenerateMips( - /* [annotation] */ - _In_ ID3D10ShaderResourceView *pShaderResourceView) = 0; - - virtual void STDMETHODCALLTYPE ResolveSubresource( - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource, - /* [annotation] */ - _In_ UINT SrcSubresource, - /* [annotation] */ - _In_ DXGI_FORMAT Format) = 0; - - virtual void STDMETHODCALLTYPE VSGetConstantBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; - - virtual void STDMETHODCALLTYPE PSGetShaderResources( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; - - virtual void STDMETHODCALLTYPE PSGetShader( - /* [annotation] */ - _Out_ ID3D10PixelShader **ppPixelShader) = 0; - - virtual void STDMETHODCALLTYPE PSGetSamplers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; - - virtual void STDMETHODCALLTYPE VSGetShader( - /* [annotation] */ - _Out_ ID3D10VertexShader **ppVertexShader) = 0; - - virtual void STDMETHODCALLTYPE PSGetConstantBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; - - virtual void STDMETHODCALLTYPE IAGetInputLayout( - /* [annotation] */ - _Out_ ID3D10InputLayout **ppInputLayout) = 0; - - virtual void STDMETHODCALLTYPE IAGetVertexBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppVertexBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pStrides, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pOffsets) = 0; - - virtual void STDMETHODCALLTYPE IAGetIndexBuffer( - /* [annotation] */ - _Out_opt_ ID3D10Buffer **pIndexBuffer, - /* [annotation] */ - _Out_opt_ DXGI_FORMAT *Format, - /* [annotation] */ - _Out_opt_ UINT *Offset) = 0; - - virtual void STDMETHODCALLTYPE GSGetConstantBuffers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers) = 0; - - virtual void STDMETHODCALLTYPE GSGetShader( - /* [annotation] */ - _Out_ ID3D10GeometryShader **ppGeometryShader) = 0; - - virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology( - /* [annotation] */ - _Out_ D3D10_PRIMITIVE_TOPOLOGY *pTopology) = 0; - - virtual void STDMETHODCALLTYPE VSGetShaderResources( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; - - virtual void STDMETHODCALLTYPE VSGetSamplers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; - - virtual void STDMETHODCALLTYPE GetPredication( - /* [annotation] */ - _Out_opt_ ID3D10Predicate **ppPredicate, - /* [annotation] */ - _Out_opt_ BOOL *pPredicateValue) = 0; - - virtual void STDMETHODCALLTYPE GSGetShaderResources( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews) = 0; - - virtual void STDMETHODCALLTYPE GSGetSamplers( - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers) = 0; - - virtual void STDMETHODCALLTYPE OMGetRenderTargets( - /* [annotation] */ - _In_range_( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilView **ppDepthStencilView) = 0; - - virtual void STDMETHODCALLTYPE OMGetBlendState( - /* [annotation] */ - _Out_opt_ ID3D10BlendState **ppBlendState, - /* [annotation] */ - _Out_opt_ FLOAT BlendFactor[ 4 ], - /* [annotation] */ - _Out_opt_ UINT *pSampleMask) = 0; - - virtual void STDMETHODCALLTYPE OMGetDepthStencilState( - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilState **ppDepthStencilState, - /* [annotation] */ - _Out_opt_ UINT *pStencilRef) = 0; - - virtual void STDMETHODCALLTYPE SOGetTargets( - /* [annotation] */ - _In_range_( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppSOTargets, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pOffsets) = 0; - - virtual void STDMETHODCALLTYPE RSGetState( - /* [annotation] */ - _Out_ ID3D10RasterizerState **ppRasterizerState) = 0; - - virtual void STDMETHODCALLTYPE RSGetViewports( - /* [annotation] */ - _Inout_ /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, - /* [annotation] */ - _Out_writes_opt_(*NumViewports) D3D10_VIEWPORT *pViewports) = 0; - - virtual void STDMETHODCALLTYPE RSGetScissorRects( - /* [annotation] */ - _Inout_ /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, - /* [annotation] */ - _Out_writes_opt_(*NumRects) D3D10_RECT *pRects) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetExceptionMode( - UINT RaiseFlags) = 0; - - virtual UINT STDMETHODCALLTYPE GetExceptionMode( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPrivateData( - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrivateData( - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData) = 0; - - virtual void STDMETHODCALLTYPE ClearState( void) = 0; - - virtual void STDMETHODCALLTYPE Flush( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBuffer( - /* [annotation] */ - _In_ const D3D10_BUFFER_DESC *pDesc, - /* [annotation] */ - _In_opt_ const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_opt_ ID3D10Buffer **ppBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateTexture1D( - /* [annotation] */ - _In_ const D3D10_TEXTURE1D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture1D **ppTexture1D) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateTexture2D( - /* [annotation] */ - _In_ const D3D10_TEXTURE2D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture2D **ppTexture2D) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateTexture3D( - /* [annotation] */ - _In_ const D3D10_TEXTURE3D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture3D **ppTexture3D) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView( - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10ShaderResourceView **ppSRView) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView( - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10RenderTargetView **ppRTView) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView( - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilView **ppDepthStencilView) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateInputLayout( - /* [annotation] */ - _In_reads_(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecodeWithInputSignature, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10InputLayout **ppInputLayout) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateVertexShader( - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10VertexShader **ppVertexShader) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateGeometryShader( - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10GeometryShader **ppGeometryShader) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _In_reads_opt_(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, - /* [annotation] */ - _In_range_( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, - /* [annotation] */ - _In_ UINT OutputStreamStride, - /* [annotation] */ - _Out_opt_ ID3D10GeometryShader **ppGeometryShader) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreatePixelShader( - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10PixelShader **ppPixelShader) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBlendState( - /* [annotation] */ - _In_ const D3D10_BLEND_DESC *pBlendStateDesc, - /* [annotation] */ - _Out_opt_ ID3D10BlendState **ppBlendState) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState( - /* [annotation] */ - _In_ const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilState **ppDepthStencilState) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState( - /* [annotation] */ - _In_ const D3D10_RASTERIZER_DESC *pRasterizerDesc, - /* [annotation] */ - _Out_opt_ ID3D10RasterizerState **ppRasterizerState) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateSamplerState( - /* [annotation] */ - _In_ const D3D10_SAMPLER_DESC *pSamplerDesc, - /* [annotation] */ - _Out_opt_ ID3D10SamplerState **ppSamplerState) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateQuery( - /* [annotation] */ - _In_ const D3D10_QUERY_DESC *pQueryDesc, - /* [annotation] */ - _Out_opt_ ID3D10Query **ppQuery) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreatePredicate( - /* [annotation] */ - _In_ const D3D10_QUERY_DESC *pPredicateDesc, - /* [annotation] */ - _Out_opt_ ID3D10Predicate **ppPredicate) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateCounter( - /* [annotation] */ - _In_ const D3D10_COUNTER_DESC *pCounterDesc, - /* [annotation] */ - _Out_opt_ ID3D10Counter **ppCounter) = 0; - - virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport( - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _Out_ UINT *pFormatSupport) = 0; - - virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _In_ UINT SampleCount, - /* [annotation] */ - _Out_ UINT *pNumQualityLevels) = 0; - - virtual void STDMETHODCALLTYPE CheckCounterInfo( - /* [annotation] */ - _Out_ D3D10_COUNTER_INFO *pCounterInfo) = 0; - - virtual HRESULT STDMETHODCALLTYPE CheckCounter( - /* [annotation] */ - _In_ const D3D10_COUNTER_DESC *pDesc, - /* [annotation] */ - _Out_ D3D10_COUNTER_TYPE *pType, - /* [annotation] */ - _Out_ UINT *pActiveCounters, - /* [annotation] */ - _Out_writes_opt_(*pNameLength) LPSTR szName, - /* [annotation] */ - _Inout_opt_ UINT *pNameLength, - /* [annotation] */ - _Out_writes_opt_(*pUnitsLength) LPSTR szUnits, - /* [annotation] */ - _Inout_opt_ UINT *pUnitsLength, - /* [annotation] */ - _Out_writes_opt_(*pDescriptionLength) LPSTR szDescription, - /* [annotation] */ - _Inout_opt_ UINT *pDescriptionLength) = 0; - - virtual UINT STDMETHODCALLTYPE GetCreationFlags( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE OpenSharedResource( - /* [annotation] */ - _In_ HANDLE hResource, - /* [annotation] */ - _In_ REFIID ReturnedInterface, - /* [annotation] */ - _Out_opt_ void **ppResource) = 0; - - virtual void STDMETHODCALLTYPE SetTextFilterSize( - /* [annotation] */ - _In_ UINT Width, - /* [annotation] */ - _In_ UINT Height) = 0; - - virtual void STDMETHODCALLTYPE GetTextFilterSize( - /* [annotation] */ - _Out_opt_ UINT *pWidth, - /* [annotation] */ - _Out_opt_ UINT *pHeight) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10DeviceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Device * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Device * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Device * This); - - void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); - - void ( STDMETHODCALLTYPE *PSSetShaderResources )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *PSSetShader )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10PixelShader *pPixelShader); - - void ( STDMETHODCALLTYPE *PSSetSamplers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers); - - void ( STDMETHODCALLTYPE *VSSetShader )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10VertexShader *pVertexShader); - - void ( STDMETHODCALLTYPE *DrawIndexed )( - ID3D10Device * This, - /* [annotation] */ - _In_ UINT IndexCount, - /* [annotation] */ - _In_ UINT StartIndexLocation, - /* [annotation] */ - _In_ INT BaseVertexLocation); - - void ( STDMETHODCALLTYPE *Draw )( - ID3D10Device * This, - /* [annotation] */ - _In_ UINT VertexCount, - /* [annotation] */ - _In_ UINT StartVertexLocation); - - void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); - - void ( STDMETHODCALLTYPE *IASetInputLayout )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10InputLayout *pInputLayout); - - void ( STDMETHODCALLTYPE *IASetVertexBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pStrides, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pOffsets); - - void ( STDMETHODCALLTYPE *IASetIndexBuffer )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10Buffer *pIndexBuffer, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _In_ UINT Offset); - - void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( - ID3D10Device * This, - /* [annotation] */ - _In_ UINT IndexCountPerInstance, - /* [annotation] */ - _In_ UINT InstanceCount, - /* [annotation] */ - _In_ UINT StartIndexLocation, - /* [annotation] */ - _In_ INT BaseVertexLocation, - /* [annotation] */ - _In_ UINT StartInstanceLocation); - - void ( STDMETHODCALLTYPE *DrawInstanced )( - ID3D10Device * This, - /* [annotation] */ - _In_ UINT VertexCountPerInstance, - /* [annotation] */ - _In_ UINT InstanceCount, - /* [annotation] */ - _In_ UINT StartVertexLocation, - /* [annotation] */ - _In_ UINT StartInstanceLocation); - - void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); - - void ( STDMETHODCALLTYPE *GSSetShader )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10GeometryShader *pShader); - - void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( - ID3D10Device * This, - /* [annotation] */ - _In_ D3D10_PRIMITIVE_TOPOLOGY Topology); - - void ( STDMETHODCALLTYPE *VSSetShaderResources )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *VSSetSamplers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers); - - void ( STDMETHODCALLTYPE *SetPredication )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10Predicate *pPredicate, - /* [annotation] */ - _In_ BOOL PredicateValue); - - void ( STDMETHODCALLTYPE *GSSetShaderResources )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *GSSetSamplers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers); - - void ( STDMETHODCALLTYPE *OMSetRenderTargets )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, - /* [annotation] */ - _In_opt_ ID3D10DepthStencilView *pDepthStencilView); - - void ( STDMETHODCALLTYPE *OMSetBlendState )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10BlendState *pBlendState, - /* [annotation] */ - _In_ const FLOAT BlendFactor[ 4 ], - /* [annotation] */ - _In_ UINT SampleMask); - - void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10DepthStencilState *pDepthStencilState, - /* [annotation] */ - _In_ UINT StencilRef); - - void ( STDMETHODCALLTYPE *SOSetTargets )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppSOTargets, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pOffsets); - - void ( STDMETHODCALLTYPE *DrawAuto )( - ID3D10Device * This); - - void ( STDMETHODCALLTYPE *RSSetState )( - ID3D10Device * This, - /* [annotation] */ - _In_opt_ ID3D10RasterizerState *pRasterizerState); - - void ( STDMETHODCALLTYPE *RSSetViewports )( - ID3D10Device * This, - /* [annotation] */ - _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, - /* [annotation] */ - _In_reads_opt_(NumViewports) const D3D10_VIEWPORT *pViewports); - - void ( STDMETHODCALLTYPE *RSSetScissorRects )( - ID3D10Device * This, - /* [annotation] */ - _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, - /* [annotation] */ - _In_reads_opt_(NumRects) const D3D10_RECT *pRects); - - void ( STDMETHODCALLTYPE *CopySubresourceRegion )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_ UINT DstX, - /* [annotation] */ - _In_ UINT DstY, - /* [annotation] */ - _In_ UINT DstZ, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource, - /* [annotation] */ - _In_ UINT SrcSubresource, - /* [annotation] */ - _In_opt_ const D3D10_BOX *pSrcBox); - - void ( STDMETHODCALLTYPE *CopyResource )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource); - - void ( STDMETHODCALLTYPE *UpdateSubresource )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_opt_ const D3D10_BOX *pDstBox, - /* [annotation] */ - _In_ const void *pSrcData, - /* [annotation] */ - _In_ UINT SrcRowPitch, - /* [annotation] */ - _In_ UINT SrcDepthPitch); - - void ( STDMETHODCALLTYPE *ClearRenderTargetView )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10RenderTargetView *pRenderTargetView, - /* [annotation] */ - _In_ const FLOAT ColorRGBA[ 4 ]); - - void ( STDMETHODCALLTYPE *ClearDepthStencilView )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10DepthStencilView *pDepthStencilView, - /* [annotation] */ - _In_ UINT ClearFlags, - /* [annotation] */ - _In_ FLOAT Depth, - /* [annotation] */ - _In_ UINT8 Stencil); - - void ( STDMETHODCALLTYPE *GenerateMips )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10ShaderResourceView *pShaderResourceView); - - void ( STDMETHODCALLTYPE *ResolveSubresource )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource, - /* [annotation] */ - _In_ UINT SrcSubresource, - /* [annotation] */ - _In_ DXGI_FORMAT Format); - - void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers); - - void ( STDMETHODCALLTYPE *PSGetShaderResources )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *PSGetShader )( - ID3D10Device * This, - /* [annotation] */ - _Out_ ID3D10PixelShader **ppPixelShader); - - void ( STDMETHODCALLTYPE *PSGetSamplers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers); - - void ( STDMETHODCALLTYPE *VSGetShader )( - ID3D10Device * This, - /* [annotation] */ - _Out_ ID3D10VertexShader **ppVertexShader); - - void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers); - - void ( STDMETHODCALLTYPE *IAGetInputLayout )( - ID3D10Device * This, - /* [annotation] */ - _Out_ ID3D10InputLayout **ppInputLayout); - - void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppVertexBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pStrides, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pOffsets); - - void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( - ID3D10Device * This, - /* [annotation] */ - _Out_opt_ ID3D10Buffer **pIndexBuffer, - /* [annotation] */ - _Out_opt_ DXGI_FORMAT *Format, - /* [annotation] */ - _Out_opt_ UINT *Offset); - - void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers); - - void ( STDMETHODCALLTYPE *GSGetShader )( - ID3D10Device * This, - /* [annotation] */ - _Out_ ID3D10GeometryShader **ppGeometryShader); - - void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( - ID3D10Device * This, - /* [annotation] */ - _Out_ D3D10_PRIMITIVE_TOPOLOGY *pTopology); - - void ( STDMETHODCALLTYPE *VSGetShaderResources )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *VSGetSamplers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers); - - void ( STDMETHODCALLTYPE *GetPredication )( - ID3D10Device * This, - /* [annotation] */ - _Out_opt_ ID3D10Predicate **ppPredicate, - /* [annotation] */ - _Out_opt_ BOOL *pPredicateValue); - - void ( STDMETHODCALLTYPE *GSGetShaderResources )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *GSGetSamplers )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers); - - void ( STDMETHODCALLTYPE *OMGetRenderTargets )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilView **ppDepthStencilView); - - void ( STDMETHODCALLTYPE *OMGetBlendState )( - ID3D10Device * This, - /* [annotation] */ - _Out_opt_ ID3D10BlendState **ppBlendState, - /* [annotation] */ - _Out_opt_ FLOAT BlendFactor[ 4 ], - /* [annotation] */ - _Out_opt_ UINT *pSampleMask); - - void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( - ID3D10Device * This, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilState **ppDepthStencilState, - /* [annotation] */ - _Out_opt_ UINT *pStencilRef); - - void ( STDMETHODCALLTYPE *SOGetTargets )( - ID3D10Device * This, - /* [annotation] */ - _In_range_( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppSOTargets, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pOffsets); - - void ( STDMETHODCALLTYPE *RSGetState )( - ID3D10Device * This, - /* [annotation] */ - _Out_ ID3D10RasterizerState **ppRasterizerState); - - void ( STDMETHODCALLTYPE *RSGetViewports )( - ID3D10Device * This, - /* [annotation] */ - _Inout_ /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, - /* [annotation] */ - _Out_writes_opt_(*NumViewports) D3D10_VIEWPORT *pViewports); - - void ( STDMETHODCALLTYPE *RSGetScissorRects )( - ID3D10Device * This, - /* [annotation] */ - _Inout_ /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, - /* [annotation] */ - _Out_writes_opt_(*NumRects) D3D10_RECT *pRects); - - HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( - ID3D10Device * This); - - HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( - ID3D10Device * This, - UINT RaiseFlags); - - UINT ( STDMETHODCALLTYPE *GetExceptionMode )( - ID3D10Device * This); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Device * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Device * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Device * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *ClearState )( - ID3D10Device * This); - - void ( STDMETHODCALLTYPE *Flush )( - ID3D10Device * This); - - HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_BUFFER_DESC *pDesc, - /* [annotation] */ - _In_opt_ const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_opt_ ID3D10Buffer **ppBuffer); - - HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_TEXTURE1D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture1D **ppTexture1D); - - HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_TEXTURE2D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture2D **ppTexture2D); - - HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_TEXTURE3D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture3D **ppTexture3D); - - HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10ShaderResourceView **ppSRView); - - HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10RenderTargetView **ppRTView); - - HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( - ID3D10Device * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilView **ppDepthStencilView); - - HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( - ID3D10Device * This, - /* [annotation] */ - _In_reads_(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecodeWithInputSignature, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10InputLayout **ppInputLayout); - - HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( - ID3D10Device * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10VertexShader **ppVertexShader); - - HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( - ID3D10Device * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10GeometryShader **ppGeometryShader); - - HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( - ID3D10Device * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _In_reads_opt_(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, - /* [annotation] */ - _In_range_( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, - /* [annotation] */ - _In_ UINT OutputStreamStride, - /* [annotation] */ - _Out_opt_ ID3D10GeometryShader **ppGeometryShader); - - HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( - ID3D10Device * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10PixelShader **ppPixelShader); - - HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_BLEND_DESC *pBlendStateDesc, - /* [annotation] */ - _Out_opt_ ID3D10BlendState **ppBlendState); - - HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilState **ppDepthStencilState); - - HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_RASTERIZER_DESC *pRasterizerDesc, - /* [annotation] */ - _Out_opt_ ID3D10RasterizerState **ppRasterizerState); - - HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_SAMPLER_DESC *pSamplerDesc, - /* [annotation] */ - _Out_opt_ ID3D10SamplerState **ppSamplerState); - - HRESULT ( STDMETHODCALLTYPE *CreateQuery )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_QUERY_DESC *pQueryDesc, - /* [annotation] */ - _Out_opt_ ID3D10Query **ppQuery); - - HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_QUERY_DESC *pPredicateDesc, - /* [annotation] */ - _Out_opt_ ID3D10Predicate **ppPredicate); - - HRESULT ( STDMETHODCALLTYPE *CreateCounter )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_COUNTER_DESC *pCounterDesc, - /* [annotation] */ - _Out_opt_ ID3D10Counter **ppCounter); - - HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( - ID3D10Device * This, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _Out_ UINT *pFormatSupport); - - HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( - ID3D10Device * This, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _In_ UINT SampleCount, - /* [annotation] */ - _Out_ UINT *pNumQualityLevels); - - void ( STDMETHODCALLTYPE *CheckCounterInfo )( - ID3D10Device * This, - /* [annotation] */ - _Out_ D3D10_COUNTER_INFO *pCounterInfo); - - HRESULT ( STDMETHODCALLTYPE *CheckCounter )( - ID3D10Device * This, - /* [annotation] */ - _In_ const D3D10_COUNTER_DESC *pDesc, - /* [annotation] */ - _Out_ D3D10_COUNTER_TYPE *pType, - /* [annotation] */ - _Out_ UINT *pActiveCounters, - /* [annotation] */ - _Out_writes_opt_(*pNameLength) LPSTR szName, - /* [annotation] */ - _Inout_opt_ UINT *pNameLength, - /* [annotation] */ - _Out_writes_opt_(*pUnitsLength) LPSTR szUnits, - /* [annotation] */ - _Inout_opt_ UINT *pUnitsLength, - /* [annotation] */ - _Out_writes_opt_(*pDescriptionLength) LPSTR szDescription, - /* [annotation] */ - _Inout_opt_ UINT *pDescriptionLength); - - UINT ( STDMETHODCALLTYPE *GetCreationFlags )( - ID3D10Device * This); - - HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( - ID3D10Device * This, - /* [annotation] */ - _In_ HANDLE hResource, - /* [annotation] */ - _In_ REFIID ReturnedInterface, - /* [annotation] */ - _Out_opt_ void **ppResource); - - void ( STDMETHODCALLTYPE *SetTextFilterSize )( - ID3D10Device * This, - /* [annotation] */ - _In_ UINT Width, - /* [annotation] */ - _In_ UINT Height); - - void ( STDMETHODCALLTYPE *GetTextFilterSize )( - ID3D10Device * This, - /* [annotation] */ - _Out_opt_ UINT *pWidth, - /* [annotation] */ - _Out_opt_ UINT *pHeight); - - END_INTERFACE - } ID3D10DeviceVtbl; - - interface ID3D10Device - { - CONST_VTBL struct ID3D10DeviceVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Device_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Device_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Device_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Device_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device_PSSetShader(This,pPixelShader) \ - ( (This)->lpVtbl -> PSSetShader(This,pPixelShader) ) - -#define ID3D10Device_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device_VSSetShader(This,pVertexShader) \ - ( (This)->lpVtbl -> VSSetShader(This,pVertexShader) ) - -#define ID3D10Device_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ - ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) - -#define ID3D10Device_Draw(This,VertexCount,StartVertexLocation) \ - ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) - -#define ID3D10Device_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device_IASetInputLayout(This,pInputLayout) \ - ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) - -#define ID3D10Device_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ - ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) - -#define ID3D10Device_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ - ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) - -#define ID3D10Device_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ - ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) - -#define ID3D10Device_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ - ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) - -#define ID3D10Device_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device_GSSetShader(This,pShader) \ - ( (This)->lpVtbl -> GSSetShader(This,pShader) ) - -#define ID3D10Device_IASetPrimitiveTopology(This,Topology) \ - ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) - -#define ID3D10Device_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device_SetPredication(This,pPredicate,PredicateValue) \ - ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) - -#define ID3D10Device_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ - ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) - -#define ID3D10Device_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ - ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) - -#define ID3D10Device_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ - ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) - -#define ID3D10Device_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ - ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) - -#define ID3D10Device_DrawAuto(This) \ - ( (This)->lpVtbl -> DrawAuto(This) ) - -#define ID3D10Device_RSSetState(This,pRasterizerState) \ - ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) - -#define ID3D10Device_RSSetViewports(This,NumViewports,pViewports) \ - ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) - -#define ID3D10Device_RSSetScissorRects(This,NumRects,pRects) \ - ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) - -#define ID3D10Device_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ - ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) - -#define ID3D10Device_CopyResource(This,pDstResource,pSrcResource) \ - ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) - -#define ID3D10Device_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ - ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) - -#define ID3D10Device_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ - ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) - -#define ID3D10Device_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ - ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) - -#define ID3D10Device_GenerateMips(This,pShaderResourceView) \ - ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) - -#define ID3D10Device_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ - ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) - -#define ID3D10Device_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device_PSGetShader(This,ppPixelShader) \ - ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader) ) - -#define ID3D10Device_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device_VSGetShader(This,ppVertexShader) \ - ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader) ) - -#define ID3D10Device_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device_IAGetInputLayout(This,ppInputLayout) \ - ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) - -#define ID3D10Device_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ - ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) - -#define ID3D10Device_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ - ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) - -#define ID3D10Device_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device_GSGetShader(This,ppGeometryShader) \ - ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader) ) - -#define ID3D10Device_IAGetPrimitiveTopology(This,pTopology) \ - ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) - -#define ID3D10Device_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device_GetPredication(This,ppPredicate,pPredicateValue) \ - ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) - -#define ID3D10Device_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ - ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) - -#define ID3D10Device_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ - ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) - -#define ID3D10Device_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ - ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) - -#define ID3D10Device_SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ - ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) - -#define ID3D10Device_RSGetState(This,ppRasterizerState) \ - ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) - -#define ID3D10Device_RSGetViewports(This,NumViewports,pViewports) \ - ( (This)->lpVtbl -> RSGetViewports(This,NumViewports,pViewports) ) - -#define ID3D10Device_RSGetScissorRects(This,NumRects,pRects) \ - ( (This)->lpVtbl -> RSGetScissorRects(This,NumRects,pRects) ) - -#define ID3D10Device_GetDeviceRemovedReason(This) \ - ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) - -#define ID3D10Device_SetExceptionMode(This,RaiseFlags) \ - ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) - -#define ID3D10Device_GetExceptionMode(This) \ - ( (This)->lpVtbl -> GetExceptionMode(This) ) - -#define ID3D10Device_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Device_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Device_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - -#define ID3D10Device_ClearState(This) \ - ( (This)->lpVtbl -> ClearState(This) ) - -#define ID3D10Device_Flush(This) \ - ( (This)->lpVtbl -> Flush(This) ) - -#define ID3D10Device_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ - ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) - -#define ID3D10Device_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ - ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) - -#define ID3D10Device_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ - ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) - -#define ID3D10Device_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ - ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) - -#define ID3D10Device_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ - ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) - -#define ID3D10Device_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ - ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) - -#define ID3D10Device_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ - ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) - -#define ID3D10Device_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ - ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) - -#define ID3D10Device_CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) \ - ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) ) - -#define ID3D10Device_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) \ - ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) ) - -#define ID3D10Device_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) \ - ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) ) - -#define ID3D10Device_CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) \ - ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) ) - -#define ID3D10Device_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ - ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) - -#define ID3D10Device_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ - ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) - -#define ID3D10Device_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ - ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) - -#define ID3D10Device_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ - ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) - -#define ID3D10Device_CreateQuery(This,pQueryDesc,ppQuery) \ - ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) - -#define ID3D10Device_CreatePredicate(This,pPredicateDesc,ppPredicate) \ - ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) - -#define ID3D10Device_CreateCounter(This,pCounterDesc,ppCounter) \ - ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) - -#define ID3D10Device_CheckFormatSupport(This,Format,pFormatSupport) \ - ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) - -#define ID3D10Device_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ - ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) - -#define ID3D10Device_CheckCounterInfo(This,pCounterInfo) \ - ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) - -#define ID3D10Device_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ - ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) - -#define ID3D10Device_GetCreationFlags(This) \ - ( (This)->lpVtbl -> GetCreationFlags(This) ) - -#define ID3D10Device_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ - ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) - -#define ID3D10Device_SetTextFilterSize(This,Width,Height) \ - ( (This)->lpVtbl -> SetTextFilterSize(This,Width,Height) ) - -#define ID3D10Device_GetTextFilterSize(This,pWidth,pHeight) \ - ( (This)->lpVtbl -> GetTextFilterSize(This,pWidth,pHeight) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Device_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0023 */ -/* [local] */ - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0023_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0023_v0_0_s_ifspec; - -#ifndef __ID3D10Multithread_INTERFACE_DEFINED__ -#define __ID3D10Multithread_INTERFACE_DEFINED__ - -/* interface ID3D10Multithread */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Multithread; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4E00-342C-4106-A19F-4F2704F689F0") - ID3D10Multithread : public IUnknown - { - public: - virtual void STDMETHODCALLTYPE Enter( void) = 0; - - virtual void STDMETHODCALLTYPE Leave( void) = 0; - - virtual BOOL STDMETHODCALLTYPE SetMultithreadProtected( - /* [annotation] */ - _In_ BOOL bMTProtect) = 0; - - virtual BOOL STDMETHODCALLTYPE GetMultithreadProtected( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10MultithreadVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Multithread * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Multithread * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Multithread * This); - - void ( STDMETHODCALLTYPE *Enter )( - ID3D10Multithread * This); - - void ( STDMETHODCALLTYPE *Leave )( - ID3D10Multithread * This); - - BOOL ( STDMETHODCALLTYPE *SetMultithreadProtected )( - ID3D10Multithread * This, - /* [annotation] */ - _In_ BOOL bMTProtect); - - BOOL ( STDMETHODCALLTYPE *GetMultithreadProtected )( - ID3D10Multithread * This); - - END_INTERFACE - } ID3D10MultithreadVtbl; - - interface ID3D10Multithread - { - CONST_VTBL struct ID3D10MultithreadVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Multithread_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Multithread_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Multithread_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Multithread_Enter(This) \ - ( (This)->lpVtbl -> Enter(This) ) - -#define ID3D10Multithread_Leave(This) \ - ( (This)->lpVtbl -> Leave(This) ) - -#define ID3D10Multithread_SetMultithreadProtected(This,bMTProtect) \ - ( (This)->lpVtbl -> SetMultithreadProtected(This,bMTProtect) ) - -#define ID3D10Multithread_GetMultithreadProtected(This) \ - ( (This)->lpVtbl -> GetMultithreadProtected(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Multithread_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_0000_0024 */ -/* [local] */ - -typedef -enum D3D10_CREATE_DEVICE_FLAG - { - D3D10_CREATE_DEVICE_SINGLETHREADED = 0x1, - D3D10_CREATE_DEVICE_DEBUG = 0x2, - D3D10_CREATE_DEVICE_SWITCH_TO_REF = 0x4, - D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8, - D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP = 0x10, - D3D10_CREATE_DEVICE_BGRA_SUPPORT = 0x20, - D3D10_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 0x80, - D3D10_CREATE_DEVICE_STRICT_VALIDATION = 0x200, - D3D10_CREATE_DEVICE_DEBUGGABLE = 0x400 - } D3D10_CREATE_DEVICE_FLAG; - - -#define D3D10_SDK_VERSION ( 29 ) - -#if !defined( D3D10_IGNORE_SDK_LAYERS ) -#include "d3d10sdklayers.h" -#endif -#include "d3d10misc.h" -#include "d3d10shader.h" -#include "d3d10effect.h" -DEFINE_GUID(IID_ID3D10DeviceChild,0x9B7E4C00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10DepthStencilState,0x2B4B1CC8,0xA4AD,0x41f8,0x83,0x22,0xCA,0x86,0xFC,0x3E,0xC6,0x75); -DEFINE_GUID(IID_ID3D10BlendState,0xEDAD8D19,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61); -DEFINE_GUID(IID_ID3D10RasterizerState,0xA2A07292,0x89AF,0x4345,0xBE,0x2E,0xC5,0x3D,0x9F,0xBB,0x6E,0x9F); -DEFINE_GUID(IID_ID3D10Resource,0x9B7E4C01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Buffer,0x9B7E4C02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Texture1D,0x9B7E4C03,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Texture2D,0x9B7E4C04,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Texture3D,0x9B7E4C05,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10View,0xC902B03F,0x60A7,0x49BA,0x99,0x36,0x2A,0x3A,0xB3,0x7A,0x7E,0x33); -DEFINE_GUID(IID_ID3D10ShaderResourceView,0x9B7E4C07,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10RenderTargetView,0x9B7E4C08,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10DepthStencilView,0x9B7E4C09,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10VertexShader,0x9B7E4C0A,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10GeometryShader,0x6316BE88,0x54CD,0x4040,0xAB,0x44,0x20,0x46,0x1B,0xC8,0x1F,0x68); -DEFINE_GUID(IID_ID3D10PixelShader,0x4968B601,0x9D00,0x4cde,0x83,0x46,0x8E,0x7F,0x67,0x58,0x19,0xB6); -DEFINE_GUID(IID_ID3D10InputLayout,0x9B7E4C0B,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10SamplerState,0x9B7E4C0C,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Asynchronous,0x9B7E4C0D,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Query,0x9B7E4C0E,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Predicate,0x9B7E4C10,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Counter,0x9B7E4C11,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Device,0x9B7E4C0F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Multithread,0x9B7E4E00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0024_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_0000_0024_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10_1.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10_1.h deleted file mode 100644 index 09f212b14d4..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10_1.h +++ /dev/null @@ -1,1788 +0,0 @@ -/*------------------------------------------------------------------------------------- - * - * Copyright (c) Microsoft Corporation - * - *-------------------------------------------------------------------------------------*/ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.00.0613 */ -/* @@MIDL_FILE_HEADING( ) */ - - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCSAL_H_VERSION__ -#define __REQUIRED_RPCSAL_H_VERSION__ 100 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif /* __RPCNDR_H_VERSION__ */ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __d3d10_1_h__ -#define __d3d10_1_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ID3D10BlendState1_FWD_DEFINED__ -#define __ID3D10BlendState1_FWD_DEFINED__ -typedef interface ID3D10BlendState1 ID3D10BlendState1; - -#endif /* __ID3D10BlendState1_FWD_DEFINED__ */ - - -#ifndef __ID3D10ShaderResourceView1_FWD_DEFINED__ -#define __ID3D10ShaderResourceView1_FWD_DEFINED__ -typedef interface ID3D10ShaderResourceView1 ID3D10ShaderResourceView1; - -#endif /* __ID3D10ShaderResourceView1_FWD_DEFINED__ */ - - -#ifndef __ID3D10Device1_FWD_DEFINED__ -#define __ID3D10Device1_FWD_DEFINED__ -typedef interface ID3D10Device1 ID3D10Device1; - -#endif /* __ID3D10Device1_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_d3d10_1_0000_0000 */ -/* [local] */ - -#if defined( __d3d10_h__ ) && !defined( D3D10_ARBITRARY_HEADER_ORDERING ) -#error d3d10.h is included before d3d10_1.h, and it will confuse tools that honor SAL annotations. \ -If possibly targeting d3d10.1, include d3d10_1.h instead of d3d10.h, or ensure d3d10_1.h is included before d3d10.h -#endif -#ifndef _D3D10_1_CONSTANTS -#define _D3D10_1_CONSTANTS -#define D3D10_1_DEFAULT_SAMPLE_MASK ( 0xffffffff ) - -#define D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP ( 0.6 ) -#define D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP ( 0.6f ) -#define D3D10_1_GS_INPUT_REGISTER_COUNT ( 32 ) - -#define D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT ( 32 ) - -#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS ( 128 ) - -#define D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ( 32 ) - -#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS ( 1 ) - -#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT ( 32 ) - -#define D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT ( 1 ) - -#define D3D10_1_SHADER_MAJOR_VERSION ( 4 ) - -#define D3D10_1_SHADER_MINOR_VERSION ( 1 ) - -#define D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES ( 2048 ) - -#define D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES ( 256 ) - -#define D3D10_1_SO_BUFFER_SLOT_COUNT ( 4 ) - -#define D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER ( 1 ) - -#define D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT ( 64 ) - -#define D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT ( 32 ) - -#define D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT ( 8 ) - -#define D3D10_1_VS_INPUT_REGISTER_COUNT ( 32 ) - -#define D3D10_1_VS_OUTPUT_REGISTER_COUNT ( 32 ) - -#endif -#include "d3d10.h" // - -typedef -enum D3D10_FEATURE_LEVEL1 - { - D3D10_FEATURE_LEVEL_10_0 = 0xa000, - D3D10_FEATURE_LEVEL_10_1 = 0xa100, - D3D10_FEATURE_LEVEL_9_1 = 0x9100, - D3D10_FEATURE_LEVEL_9_2 = 0x9200, - D3D10_FEATURE_LEVEL_9_3 = 0x9300 - } D3D10_FEATURE_LEVEL1; - -typedef struct D3D10_RENDER_TARGET_BLEND_DESC1 - { - BOOL BlendEnable; - D3D10_BLEND SrcBlend; - D3D10_BLEND DestBlend; - D3D10_BLEND_OP BlendOp; - D3D10_BLEND SrcBlendAlpha; - D3D10_BLEND DestBlendAlpha; - D3D10_BLEND_OP BlendOpAlpha; - UINT8 RenderTargetWriteMask; - } D3D10_RENDER_TARGET_BLEND_DESC1; - -typedef struct D3D10_BLEND_DESC1 - { - BOOL AlphaToCoverageEnable; - BOOL IndependentBlendEnable; - D3D10_RENDER_TARGET_BLEND_DESC1 RenderTarget[ 8 ]; - } D3D10_BLEND_DESC1; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0000_v0_0_s_ifspec; - -#ifndef __ID3D10BlendState1_INTERFACE_DEFINED__ -#define __ID3D10BlendState1_INTERFACE_DEFINED__ - -/* interface ID3D10BlendState1 */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10BlendState1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("EDAD8D99-8A35-4d6d-8566-2EA276CDE161") - ID3D10BlendState1 : public ID3D10BlendState - { - public: - virtual void STDMETHODCALLTYPE GetDesc1( - /* [annotation] */ - _Out_ D3D10_BLEND_DESC1 *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10BlendState1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10BlendState1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10BlendState1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10BlendState1 * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10BlendState1 * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10BlendState1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10BlendState1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10BlendState1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10BlendState1 * This, - /* [annotation] */ - _Out_ D3D10_BLEND_DESC *pDesc); - - void ( STDMETHODCALLTYPE *GetDesc1 )( - ID3D10BlendState1 * This, - /* [annotation] */ - _Out_ D3D10_BLEND_DESC1 *pDesc); - - END_INTERFACE - } ID3D10BlendState1Vtbl; - - interface ID3D10BlendState1 - { - CONST_VTBL struct ID3D10BlendState1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10BlendState1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10BlendState1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10BlendState1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10BlendState1_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10BlendState1_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10BlendState1_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10BlendState1_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10BlendState1_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - - -#define ID3D10BlendState1_GetDesc1(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10BlendState1_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_1_0000_0001 */ -/* [local] */ - -typedef struct D3D10_TEXCUBE_ARRAY_SRV1 - { - UINT MostDetailedMip; - UINT MipLevels; - UINT First2DArrayFace; - UINT NumCubes; - } D3D10_TEXCUBE_ARRAY_SRV1; - -typedef D3D_SRV_DIMENSION D3D10_SRV_DIMENSION1; - -typedef struct D3D10_SHADER_RESOURCE_VIEW_DESC1 - { - DXGI_FORMAT Format; - D3D10_SRV_DIMENSION1 ViewDimension; - union - { - D3D10_BUFFER_SRV Buffer; - D3D10_TEX1D_SRV Texture1D; - D3D10_TEX1D_ARRAY_SRV Texture1DArray; - D3D10_TEX2D_SRV Texture2D; - D3D10_TEX2D_ARRAY_SRV Texture2DArray; - D3D10_TEX2DMS_SRV Texture2DMS; - D3D10_TEX2DMS_ARRAY_SRV Texture2DMSArray; - D3D10_TEX3D_SRV Texture3D; - D3D10_TEXCUBE_SRV TextureCube; - D3D10_TEXCUBE_ARRAY_SRV1 TextureCubeArray; - } ; - } D3D10_SHADER_RESOURCE_VIEW_DESC1; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0001_v0_0_s_ifspec; - -#ifndef __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ -#define __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ - -/* interface ID3D10ShaderResourceView1 */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10ShaderResourceView1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C87-342C-4106-A19F-4F2704F689F0") - ID3D10ShaderResourceView1 : public ID3D10ShaderResourceView - { - public: - virtual void STDMETHODCALLTYPE GetDesc1( - /* [annotation] */ - _Out_ D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10ShaderResourceView1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10ShaderResourceView1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10ShaderResourceView1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10ShaderResourceView1 * This); - - void ( STDMETHODCALLTYPE *GetDevice )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _Out_ ID3D10Device **ppDevice); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *GetResource )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _Out_ ID3D10Resource **ppResource); - - void ( STDMETHODCALLTYPE *GetDesc )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _Out_ D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc); - - void ( STDMETHODCALLTYPE *GetDesc1 )( - ID3D10ShaderResourceView1 * This, - /* [annotation] */ - _Out_ D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc); - - END_INTERFACE - } ID3D10ShaderResourceView1Vtbl; - - interface ID3D10ShaderResourceView1 - { - CONST_VTBL struct ID3D10ShaderResourceView1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10ShaderResourceView1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10ShaderResourceView1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10ShaderResourceView1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10ShaderResourceView1_GetDevice(This,ppDevice) \ - ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) - -#define ID3D10ShaderResourceView1_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10ShaderResourceView1_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10ShaderResourceView1_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - - -#define ID3D10ShaderResourceView1_GetResource(This,ppResource) \ - ( (This)->lpVtbl -> GetResource(This,ppResource) ) - - -#define ID3D10ShaderResourceView1_GetDesc(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc(This,pDesc) ) - - -#define ID3D10ShaderResourceView1_GetDesc1(This,pDesc) \ - ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10ShaderResourceView1_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_1_0000_0002 */ -/* [local] */ - -typedef -enum D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS - { - D3D10_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff, - D3D10_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe - } D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS; - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0002_v0_0_s_ifspec; - -#ifndef __ID3D10Device1_INTERFACE_DEFINED__ -#define __ID3D10Device1_INTERFACE_DEFINED__ - -/* interface ID3D10Device1 */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Device1; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4C8F-342C-4106-A19F-4F2704F689F0") - ID3D10Device1 : public ID3D10Device - { - public: - virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10ShaderResourceView1 **ppSRView) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateBlendState1( - /* [annotation] */ - _In_ const D3D10_BLEND_DESC1 *pBlendStateDesc, - /* [annotation] */ - _Out_opt_ ID3D10BlendState1 **ppBlendState) = 0; - - virtual D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE GetFeatureLevel( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10Device1Vtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Device1 * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Device1 * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Device1 * This); - - void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); - - void ( STDMETHODCALLTYPE *PSSetShaderResources )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *PSSetShader )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10PixelShader *pPixelShader); - - void ( STDMETHODCALLTYPE *PSSetSamplers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers); - - void ( STDMETHODCALLTYPE *VSSetShader )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10VertexShader *pVertexShader); - - void ( STDMETHODCALLTYPE *DrawIndexed )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ UINT IndexCount, - /* [annotation] */ - _In_ UINT StartIndexLocation, - /* [annotation] */ - _In_ INT BaseVertexLocation); - - void ( STDMETHODCALLTYPE *Draw )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ UINT VertexCount, - /* [annotation] */ - _In_ UINT StartVertexLocation); - - void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); - - void ( STDMETHODCALLTYPE *IASetInputLayout )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10InputLayout *pInputLayout); - - void ( STDMETHODCALLTYPE *IASetVertexBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppVertexBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pStrides, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pOffsets); - - void ( STDMETHODCALLTYPE *IASetIndexBuffer )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10Buffer *pIndexBuffer, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _In_ UINT Offset); - - void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ UINT IndexCountPerInstance, - /* [annotation] */ - _In_ UINT InstanceCount, - /* [annotation] */ - _In_ UINT StartIndexLocation, - /* [annotation] */ - _In_ INT BaseVertexLocation, - /* [annotation] */ - _In_ UINT StartInstanceLocation); - - void ( STDMETHODCALLTYPE *DrawInstanced )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ UINT VertexCountPerInstance, - /* [annotation] */ - _In_ UINT InstanceCount, - /* [annotation] */ - _In_ UINT StartVertexLocation, - /* [annotation] */ - _In_ UINT StartInstanceLocation); - - void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppConstantBuffers); - - void ( STDMETHODCALLTYPE *GSSetShader )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10GeometryShader *pShader); - - void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ D3D10_PRIMITIVE_TOPOLOGY Topology); - - void ( STDMETHODCALLTYPE *VSSetShaderResources )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *VSSetSamplers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers); - - void ( STDMETHODCALLTYPE *SetPredication )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10Predicate *pPredicate, - /* [annotation] */ - _In_ BOOL PredicateValue); - - void ( STDMETHODCALLTYPE *GSSetShaderResources )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10ShaderResourceView *const *ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *GSSetSamplers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _In_reads_opt_(NumSamplers) ID3D10SamplerState *const *ppSamplers); - - void ( STDMETHODCALLTYPE *OMSetRenderTargets )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, - /* [annotation] */ - _In_reads_opt_(NumViews) ID3D10RenderTargetView *const *ppRenderTargetViews, - /* [annotation] */ - _In_opt_ ID3D10DepthStencilView *pDepthStencilView); - - void ( STDMETHODCALLTYPE *OMSetBlendState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10BlendState *pBlendState, - /* [annotation] */ - _In_ const FLOAT BlendFactor[ 4 ], - /* [annotation] */ - _In_ UINT SampleMask); - - void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10DepthStencilState *pDepthStencilState, - /* [annotation] */ - _In_ UINT StencilRef); - - void ( STDMETHODCALLTYPE *SOSetTargets )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, - /* [annotation] */ - _In_reads_opt_(NumBuffers) ID3D10Buffer *const *ppSOTargets, - /* [annotation] */ - _In_reads_opt_(NumBuffers) const UINT *pOffsets); - - void ( STDMETHODCALLTYPE *DrawAuto )( - ID3D10Device1 * This); - - void ( STDMETHODCALLTYPE *RSSetState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_opt_ ID3D10RasterizerState *pRasterizerState); - - void ( STDMETHODCALLTYPE *RSSetViewports )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, - /* [annotation] */ - _In_reads_opt_(NumViewports) const D3D10_VIEWPORT *pViewports); - - void ( STDMETHODCALLTYPE *RSSetScissorRects )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, - /* [annotation] */ - _In_reads_opt_(NumRects) const D3D10_RECT *pRects); - - void ( STDMETHODCALLTYPE *CopySubresourceRegion )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_ UINT DstX, - /* [annotation] */ - _In_ UINT DstY, - /* [annotation] */ - _In_ UINT DstZ, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource, - /* [annotation] */ - _In_ UINT SrcSubresource, - /* [annotation] */ - _In_opt_ const D3D10_BOX *pSrcBox); - - void ( STDMETHODCALLTYPE *CopyResource )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource); - - void ( STDMETHODCALLTYPE *UpdateSubresource )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_opt_ const D3D10_BOX *pDstBox, - /* [annotation] */ - _In_ const void *pSrcData, - /* [annotation] */ - _In_ UINT SrcRowPitch, - /* [annotation] */ - _In_ UINT SrcDepthPitch); - - void ( STDMETHODCALLTYPE *ClearRenderTargetView )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10RenderTargetView *pRenderTargetView, - /* [annotation] */ - _In_ const FLOAT ColorRGBA[ 4 ]); - - void ( STDMETHODCALLTYPE *ClearDepthStencilView )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10DepthStencilView *pDepthStencilView, - /* [annotation] */ - _In_ UINT ClearFlags, - /* [annotation] */ - _In_ FLOAT Depth, - /* [annotation] */ - _In_ UINT8 Stencil); - - void ( STDMETHODCALLTYPE *GenerateMips )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10ShaderResourceView *pShaderResourceView); - - void ( STDMETHODCALLTYPE *ResolveSubresource )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pDstResource, - /* [annotation] */ - _In_ UINT DstSubresource, - /* [annotation] */ - _In_ ID3D10Resource *pSrcResource, - /* [annotation] */ - _In_ UINT SrcSubresource, - /* [annotation] */ - _In_ DXGI_FORMAT Format); - - void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers); - - void ( STDMETHODCALLTYPE *PSGetShaderResources )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *PSGetShader )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ ID3D10PixelShader **ppPixelShader); - - void ( STDMETHODCALLTYPE *PSGetSamplers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers); - - void ( STDMETHODCALLTYPE *VSGetShader )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ ID3D10VertexShader **ppVertexShader); - - void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers); - - void ( STDMETHODCALLTYPE *IAGetInputLayout )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ ID3D10InputLayout **ppInputLayout); - - void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppVertexBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pStrides, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pOffsets); - - void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_opt_ ID3D10Buffer **pIndexBuffer, - /* [annotation] */ - _Out_opt_ DXGI_FORMAT *Format, - /* [annotation] */ - _Out_opt_ UINT *Offset); - - void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppConstantBuffers); - - void ( STDMETHODCALLTYPE *GSGetShader )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ ID3D10GeometryShader **ppGeometryShader); - - void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ D3D10_PRIMITIVE_TOPOLOGY *pTopology); - - void ( STDMETHODCALLTYPE *VSGetShaderResources )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *VSGetSamplers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers); - - void ( STDMETHODCALLTYPE *GetPredication )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_opt_ ID3D10Predicate **ppPredicate, - /* [annotation] */ - _Out_opt_ BOOL *pPredicateValue); - - void ( STDMETHODCALLTYPE *GSGetShaderResources )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10ShaderResourceView **ppShaderResourceViews); - - void ( STDMETHODCALLTYPE *GSGetSamplers )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, - /* [annotation] */ - _In_range_( 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, - /* [annotation] */ - _Out_writes_opt_(NumSamplers) ID3D10SamplerState **ppSamplers); - - void ( STDMETHODCALLTYPE *OMGetRenderTargets )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, - /* [annotation] */ - _Out_writes_opt_(NumViews) ID3D10RenderTargetView **ppRenderTargetViews, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilView **ppDepthStencilView); - - void ( STDMETHODCALLTYPE *OMGetBlendState )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_opt_ ID3D10BlendState **ppBlendState, - /* [annotation] */ - _Out_opt_ FLOAT BlendFactor[ 4 ], - /* [annotation] */ - _Out_opt_ UINT *pSampleMask); - - void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilState **ppDepthStencilState, - /* [annotation] */ - _Out_opt_ UINT *pStencilRef); - - void ( STDMETHODCALLTYPE *SOGetTargets )( - ID3D10Device1 * This, - /* [annotation] */ - _In_range_( 0, D3D10_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) ID3D10Buffer **ppSOTargets, - /* [annotation] */ - _Out_writes_opt_(NumBuffers) UINT *pOffsets); - - void ( STDMETHODCALLTYPE *RSGetState )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ ID3D10RasterizerState **ppRasterizerState); - - void ( STDMETHODCALLTYPE *RSGetViewports )( - ID3D10Device1 * This, - /* [annotation] */ - _Inout_ /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumViewports, - /* [annotation] */ - _Out_writes_opt_(*NumViewports) D3D10_VIEWPORT *pViewports); - - void ( STDMETHODCALLTYPE *RSGetScissorRects )( - ID3D10Device1 * This, - /* [annotation] */ - _Inout_ /*_range(0, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *NumRects, - /* [annotation] */ - _Out_writes_opt_(*NumRects) D3D10_RECT *pRects); - - HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( - ID3D10Device1 * This); - - HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( - ID3D10Device1 * This, - UINT RaiseFlags); - - UINT ( STDMETHODCALLTYPE *GetExceptionMode )( - ID3D10Device1 * This); - - HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _Inout_ UINT *pDataSize, - /* [annotation] */ - _Out_writes_bytes_opt_(*pDataSize) void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_ UINT DataSize, - /* [annotation] */ - _In_reads_bytes_opt_(DataSize) const void *pData); - - HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ REFGUID guid, - /* [annotation] */ - _In_opt_ const IUnknown *pData); - - void ( STDMETHODCALLTYPE *ClearState )( - ID3D10Device1 * This); - - void ( STDMETHODCALLTYPE *Flush )( - ID3D10Device1 * This); - - HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_BUFFER_DESC *pDesc, - /* [annotation] */ - _In_opt_ const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_opt_ ID3D10Buffer **ppBuffer); - - HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_TEXTURE1D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture1D **ppTexture1D); - - HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_TEXTURE2D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture2D **ppTexture2D); - - HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_TEXTURE3D_DESC *pDesc, - /* [annotation] */ - _In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D10_SUBRESOURCE_DATA *pInitialData, - /* [annotation] */ - _Out_ ID3D10Texture3D **ppTexture3D); - - HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10ShaderResourceView **ppSRView); - - HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10RenderTargetView **ppRTView); - - HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilView **ppDepthStencilView); - - HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( - ID3D10Device1 * This, - /* [annotation] */ - _In_reads_(NumElements) const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, - /* [annotation] */ - _In_range_( 0, D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecodeWithInputSignature, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10InputLayout **ppInputLayout); - - HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( - ID3D10Device1 * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10VertexShader **ppVertexShader); - - HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( - ID3D10Device1 * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10GeometryShader **ppGeometryShader); - - HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( - ID3D10Device1 * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _In_reads_opt_(NumEntries) const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, - /* [annotation] */ - _In_range_( 0, D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT ) UINT NumEntries, - /* [annotation] */ - _In_ UINT OutputStreamStride, - /* [annotation] */ - _Out_opt_ ID3D10GeometryShader **ppGeometryShader); - - HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( - ID3D10Device1 * This, - /* [annotation] */ - _In_reads_(BytecodeLength) const void *pShaderBytecode, - /* [annotation] */ - _In_ SIZE_T BytecodeLength, - /* [annotation] */ - _Out_opt_ ID3D10PixelShader **ppPixelShader); - - HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_BLEND_DESC *pBlendStateDesc, - /* [annotation] */ - _Out_opt_ ID3D10BlendState **ppBlendState); - - HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, - /* [annotation] */ - _Out_opt_ ID3D10DepthStencilState **ppDepthStencilState); - - HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_RASTERIZER_DESC *pRasterizerDesc, - /* [annotation] */ - _Out_opt_ ID3D10RasterizerState **ppRasterizerState); - - HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_SAMPLER_DESC *pSamplerDesc, - /* [annotation] */ - _Out_opt_ ID3D10SamplerState **ppSamplerState); - - HRESULT ( STDMETHODCALLTYPE *CreateQuery )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_QUERY_DESC *pQueryDesc, - /* [annotation] */ - _Out_opt_ ID3D10Query **ppQuery); - - HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_QUERY_DESC *pPredicateDesc, - /* [annotation] */ - _Out_opt_ ID3D10Predicate **ppPredicate); - - HRESULT ( STDMETHODCALLTYPE *CreateCounter )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_COUNTER_DESC *pCounterDesc, - /* [annotation] */ - _Out_opt_ ID3D10Counter **ppCounter); - - HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _Out_ UINT *pFormatSupport); - - HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ DXGI_FORMAT Format, - /* [annotation] */ - _In_ UINT SampleCount, - /* [annotation] */ - _Out_ UINT *pNumQualityLevels); - - void ( STDMETHODCALLTYPE *CheckCounterInfo )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_ D3D10_COUNTER_INFO *pCounterInfo); - - HRESULT ( STDMETHODCALLTYPE *CheckCounter )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_COUNTER_DESC *pDesc, - /* [annotation] */ - _Out_ D3D10_COUNTER_TYPE *pType, - /* [annotation] */ - _Out_ UINT *pActiveCounters, - /* [annotation] */ - _Out_writes_opt_(*pNameLength) LPSTR szName, - /* [annotation] */ - _Inout_opt_ UINT *pNameLength, - /* [annotation] */ - _Out_writes_opt_(*pUnitsLength) LPSTR szUnits, - /* [annotation] */ - _Inout_opt_ UINT *pUnitsLength, - /* [annotation] */ - _Out_writes_opt_(*pDescriptionLength) LPSTR szDescription, - /* [annotation] */ - _Inout_opt_ UINT *pDescriptionLength); - - UINT ( STDMETHODCALLTYPE *GetCreationFlags )( - ID3D10Device1 * This); - - HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ HANDLE hResource, - /* [annotation] */ - _In_ REFIID ReturnedInterface, - /* [annotation] */ - _Out_opt_ void **ppResource); - - void ( STDMETHODCALLTYPE *SetTextFilterSize )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ UINT Width, - /* [annotation] */ - _In_ UINT Height); - - void ( STDMETHODCALLTYPE *GetTextFilterSize )( - ID3D10Device1 * This, - /* [annotation] */ - _Out_opt_ UINT *pWidth, - /* [annotation] */ - _Out_opt_ UINT *pHeight); - - HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView1 )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ ID3D10Resource *pResource, - /* [annotation] */ - _In_opt_ const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, - /* [annotation] */ - _Out_opt_ ID3D10ShaderResourceView1 **ppSRView); - - HRESULT ( STDMETHODCALLTYPE *CreateBlendState1 )( - ID3D10Device1 * This, - /* [annotation] */ - _In_ const D3D10_BLEND_DESC1 *pBlendStateDesc, - /* [annotation] */ - _Out_opt_ ID3D10BlendState1 **ppBlendState); - - D3D10_FEATURE_LEVEL1 ( STDMETHODCALLTYPE *GetFeatureLevel )( - ID3D10Device1 * This); - - END_INTERFACE - } ID3D10Device1Vtbl; - - interface ID3D10Device1 - { - CONST_VTBL struct ID3D10Device1Vtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Device1_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Device1_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Device1_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Device1_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device1_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device1_PSSetShader(This,pPixelShader) \ - ( (This)->lpVtbl -> PSSetShader(This,pPixelShader) ) - -#define ID3D10Device1_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device1_VSSetShader(This,pVertexShader) \ - ( (This)->lpVtbl -> VSSetShader(This,pVertexShader) ) - -#define ID3D10Device1_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ - ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) - -#define ID3D10Device1_Draw(This,VertexCount,StartVertexLocation) \ - ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) - -#define ID3D10Device1_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device1_IASetInputLayout(This,pInputLayout) \ - ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) - -#define ID3D10Device1_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ - ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) - -#define ID3D10Device1_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ - ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) - -#define ID3D10Device1_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ - ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) - -#define ID3D10Device1_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ - ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) - -#define ID3D10Device1_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device1_GSSetShader(This,pShader) \ - ( (This)->lpVtbl -> GSSetShader(This,pShader) ) - -#define ID3D10Device1_IASetPrimitiveTopology(This,Topology) \ - ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) - -#define ID3D10Device1_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device1_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device1_SetPredication(This,pPredicate,PredicateValue) \ - ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) - -#define ID3D10Device1_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device1_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device1_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ - ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) - -#define ID3D10Device1_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ - ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) - -#define ID3D10Device1_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ - ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) - -#define ID3D10Device1_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ - ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) - -#define ID3D10Device1_DrawAuto(This) \ - ( (This)->lpVtbl -> DrawAuto(This) ) - -#define ID3D10Device1_RSSetState(This,pRasterizerState) \ - ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) - -#define ID3D10Device1_RSSetViewports(This,NumViewports,pViewports) \ - ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) - -#define ID3D10Device1_RSSetScissorRects(This,NumRects,pRects) \ - ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) - -#define ID3D10Device1_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ - ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) - -#define ID3D10Device1_CopyResource(This,pDstResource,pSrcResource) \ - ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) - -#define ID3D10Device1_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ - ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) - -#define ID3D10Device1_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ - ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) - -#define ID3D10Device1_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ - ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) - -#define ID3D10Device1_GenerateMips(This,pShaderResourceView) \ - ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) - -#define ID3D10Device1_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ - ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) - -#define ID3D10Device1_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device1_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device1_PSGetShader(This,ppPixelShader) \ - ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader) ) - -#define ID3D10Device1_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device1_VSGetShader(This,ppVertexShader) \ - ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader) ) - -#define ID3D10Device1_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device1_IAGetInputLayout(This,ppInputLayout) \ - ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) - -#define ID3D10Device1_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ - ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) - -#define ID3D10Device1_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ - ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) - -#define ID3D10Device1_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ - ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) - -#define ID3D10Device1_GSGetShader(This,ppGeometryShader) \ - ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader) ) - -#define ID3D10Device1_IAGetPrimitiveTopology(This,pTopology) \ - ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) - -#define ID3D10Device1_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device1_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device1_GetPredication(This,ppPredicate,pPredicateValue) \ - ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) - -#define ID3D10Device1_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ - ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) - -#define ID3D10Device1_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ - ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) - -#define ID3D10Device1_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ - ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) - -#define ID3D10Device1_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ - ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) - -#define ID3D10Device1_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ - ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) - -#define ID3D10Device1_SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ - ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) - -#define ID3D10Device1_RSGetState(This,ppRasterizerState) \ - ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) - -#define ID3D10Device1_RSGetViewports(This,NumViewports,pViewports) \ - ( (This)->lpVtbl -> RSGetViewports(This,NumViewports,pViewports) ) - -#define ID3D10Device1_RSGetScissorRects(This,NumRects,pRects) \ - ( (This)->lpVtbl -> RSGetScissorRects(This,NumRects,pRects) ) - -#define ID3D10Device1_GetDeviceRemovedReason(This) \ - ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) - -#define ID3D10Device1_SetExceptionMode(This,RaiseFlags) \ - ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) - -#define ID3D10Device1_GetExceptionMode(This) \ - ( (This)->lpVtbl -> GetExceptionMode(This) ) - -#define ID3D10Device1_GetPrivateData(This,guid,pDataSize,pData) \ - ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) - -#define ID3D10Device1_SetPrivateData(This,guid,DataSize,pData) \ - ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) - -#define ID3D10Device1_SetPrivateDataInterface(This,guid,pData) \ - ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) - -#define ID3D10Device1_ClearState(This) \ - ( (This)->lpVtbl -> ClearState(This) ) - -#define ID3D10Device1_Flush(This) \ - ( (This)->lpVtbl -> Flush(This) ) - -#define ID3D10Device1_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ - ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) - -#define ID3D10Device1_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ - ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) - -#define ID3D10Device1_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ - ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) - -#define ID3D10Device1_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ - ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) - -#define ID3D10Device1_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ - ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) - -#define ID3D10Device1_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ - ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) - -#define ID3D10Device1_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ - ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) - -#define ID3D10Device1_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ - ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) - -#define ID3D10Device1_CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) \ - ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,ppVertexShader) ) - -#define ID3D10Device1_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) \ - ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,ppGeometryShader) ) - -#define ID3D10Device1_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) \ - ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,OutputStreamStride,ppGeometryShader) ) - -#define ID3D10Device1_CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) \ - ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,ppPixelShader) ) - -#define ID3D10Device1_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ - ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) - -#define ID3D10Device1_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ - ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) - -#define ID3D10Device1_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ - ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) - -#define ID3D10Device1_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ - ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) - -#define ID3D10Device1_CreateQuery(This,pQueryDesc,ppQuery) \ - ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) - -#define ID3D10Device1_CreatePredicate(This,pPredicateDesc,ppPredicate) \ - ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) - -#define ID3D10Device1_CreateCounter(This,pCounterDesc,ppCounter) \ - ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) - -#define ID3D10Device1_CheckFormatSupport(This,Format,pFormatSupport) \ - ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) - -#define ID3D10Device1_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ - ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) - -#define ID3D10Device1_CheckCounterInfo(This,pCounterInfo) \ - ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) - -#define ID3D10Device1_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ - ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) - -#define ID3D10Device1_GetCreationFlags(This) \ - ( (This)->lpVtbl -> GetCreationFlags(This) ) - -#define ID3D10Device1_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ - ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) - -#define ID3D10Device1_SetTextFilterSize(This,Width,Height) \ - ( (This)->lpVtbl -> SetTextFilterSize(This,Width,Height) ) - -#define ID3D10Device1_GetTextFilterSize(This,pWidth,pHeight) \ - ( (This)->lpVtbl -> GetTextFilterSize(This,pWidth,pHeight) ) - - -#define ID3D10Device1_CreateShaderResourceView1(This,pResource,pDesc,ppSRView) \ - ( (This)->lpVtbl -> CreateShaderResourceView1(This,pResource,pDesc,ppSRView) ) - -#define ID3D10Device1_CreateBlendState1(This,pBlendStateDesc,ppBlendState) \ - ( (This)->lpVtbl -> CreateBlendState1(This,pBlendStateDesc,ppBlendState) ) - -#define ID3D10Device1_GetFeatureLevel(This) \ - ( (This)->lpVtbl -> GetFeatureLevel(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Device1_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10_1_0000_0003 */ -/* [local] */ - -#define D3D10_1_SDK_VERSION ( ( 0 + 0x20 ) ) - -#include "d3d10_1shader.h" - -/////////////////////////////////////////////////////////////////////////// -// D3D10CreateDevice1 -// ------------------ -// -// pAdapter -// If NULL, D3D10CreateDevice1 will choose the primary adapter and -// create a new instance from a temporarily created IDXGIFactory. -// If non-NULL, D3D10CreateDevice1 will register the appropriate -// device, if necessary (via IDXGIAdapter::RegisterDrver), before -// creating the device. -// DriverType -// Specifies the driver type to be created: hardware, reference or -// null. -// Software -// HMODULE of a DLL implementing a software rasterizer. Must be NULL for -// non-Software driver types. -// Flags -// Any of those documented for D3D10CreateDeviceAndSwapChain1. -// HardwareLevel -// Any of those documented for D3D10CreateDeviceAndSwapChain1. -// SDKVersion -// SDK version. Use the D3D10_1_SDK_VERSION macro. -// ppDevice -// Pointer to returned interface. -// -// Return Values -// Any of those documented for -// CreateDXGIFactory -// IDXGIFactory::EnumAdapters -// IDXGIAdapter::RegisterDriver -// D3D10CreateDevice1 -// -/////////////////////////////////////////////////////////////////////////// -typedef HRESULT (WINAPI* PFN_D3D10_CREATE_DEVICE1)(IDXGIAdapter *, - D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, ID3D10Device1**); - -HRESULT WINAPI D3D10CreateDevice1( - _In_opt_ IDXGIAdapter *pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - UINT Flags, - D3D10_FEATURE_LEVEL1 HardwareLevel, - UINT SDKVersion, - _Out_opt_ ID3D10Device1 **ppDevice); - -/////////////////////////////////////////////////////////////////////////// -// D3D10CreateDeviceAndSwapChain1 -// ------------------------------ -// -// ppAdapter -// If NULL, D3D10CreateDevice1 will choose the primary adapter and -// create a new instance from a temporarily created IDXGIFactory. -// If non-NULL, D3D10CreateDevice1 will register the appropriate -// device, if necessary (via IDXGIAdapter::RegisterDrver), before -// creating the device. -// DriverType -// Specifies the driver type to be created: hardware, reference or -// null. -// Software -// HMODULE of a DLL implementing a software rasterizer. Must be NULL for -// non-Software driver types. -// Flags -// Any of those documented for D3D10CreateDevice1. -// HardwareLevel -// Any of: -// D3D10_CREATE_LEVEL_10_0 -// D3D10_CREATE_LEVEL_10_1 -// SDKVersion -// SDK version. Use the D3D10_1_SDK_VERSION macro. -// pSwapChainDesc -// Swap chain description, may be NULL. -// ppSwapChain -// Pointer to returned interface. May be NULL. -// ppDevice -// Pointer to returned interface. -// -// Return Values -// Any of those documented for -// CreateDXGIFactory -// IDXGIFactory::EnumAdapters -// IDXGIAdapter::RegisterDriver -// D3D10CreateDevice1 -// IDXGIFactory::CreateSwapChain -// -/////////////////////////////////////////////////////////////////////////// -typedef HRESULT (WINAPI* PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1)(IDXGIAdapter *, - D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device1 **); - -HRESULT WINAPI D3D10CreateDeviceAndSwapChain1( - _In_opt_ IDXGIAdapter *pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - UINT Flags, - D3D10_FEATURE_LEVEL1 HardwareLevel, - UINT SDKVersion, - _In_opt_ DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, - _Out_opt_ IDXGISwapChain **ppSwapChain, - _Out_opt_ ID3D10Device1 **ppDevice); - -DEFINE_GUID(IID_ID3D10BlendState1,0xEDAD8D99,0x8A35,0x4d6d,0x85,0x66,0x2E,0xA2,0x76,0xCD,0xE1,0x61); -DEFINE_GUID(IID_ID3D10ShaderResourceView1,0x9B7E4C87,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10Device1,0x9B7E4C8F,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10_1_0000_0003_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10_1shader.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10_1shader.h deleted file mode 100644 index 91e5c9daedc..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10_1shader.h +++ /dev/null @@ -1,305 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// File: D3D10_1Shader.h -// Content: D3D10.1 Shader Types and APIs -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef __D3D10_1SHADER_H__ -#define __D3D10_1SHADER_H__ - -#include "d3d10shader.h" - - - - -//---------------------------------------------------------------------------- -// Shader debugging structures -//---------------------------------------------------------------------------- - -typedef enum _D3D10_SHADER_DEBUG_REGTYPE -{ - D3D10_SHADER_DEBUG_REG_INPUT, - D3D10_SHADER_DEBUG_REG_OUTPUT, - D3D10_SHADER_DEBUG_REG_CBUFFER, - D3D10_SHADER_DEBUG_REG_TBUFFER, - D3D10_SHADER_DEBUG_REG_TEMP, - D3D10_SHADER_DEBUG_REG_TEMPARRAY, - D3D10_SHADER_DEBUG_REG_TEXTURE, - D3D10_SHADER_DEBUG_REG_SAMPLER, - D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER, - D3D10_SHADER_DEBUG_REG_LITERAL, - D3D10_SHADER_DEBUG_REG_UNUSED, - D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS, - D3D11_SHADER_DEBUG_REG_UAV, - D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff, -} D3D10_SHADER_DEBUG_REGTYPE; - -typedef enum _D3D10_SHADER_DEBUG_SCOPETYPE -{ - D3D10_SHADER_DEBUG_SCOPE_GLOBAL, - D3D10_SHADER_DEBUG_SCOPE_BLOCK, - D3D10_SHADER_DEBUG_SCOPE_FORLOOP, - D3D10_SHADER_DEBUG_SCOPE_STRUCT, - D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS, - D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK, - D3D10_SHADER_DEBUG_SCOPE_NAMESPACE, - D3D10_SHADER_DEBUG_SCOPE_ANNOTATION, - D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff, -} D3D10_SHADER_DEBUG_SCOPETYPE; - -typedef enum _D3D10_SHADER_DEBUG_VARTYPE -{ - D3D10_SHADER_DEBUG_VAR_VARIABLE, - D3D10_SHADER_DEBUG_VAR_FUNCTION, - D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff, -} D3D10_SHADER_DEBUG_VARTYPE; - -///////////////////////////////////////////////////////////////////// -// These are the serialized structures that get written to the file -///////////////////////////////////////////////////////////////////// - -typedef struct _D3D10_SHADER_DEBUG_TOKEN_INFO -{ - UINT File; // offset into file list - UINT Line; // line # - UINT Column; // column # - - UINT TokenLength; - UINT TokenId; // offset to LPCSTR of length TokenLength in string datastore -} D3D10_SHADER_DEBUG_TOKEN_INFO; - -// Variable list -typedef struct _D3D10_SHADER_DEBUG_VAR_INFO -{ - // Index into token list for declaring identifier - UINT TokenId; - D3D10_SHADER_VARIABLE_TYPE Type; - // register and component for this variable, only valid/necessary for arrays - UINT Register; - UINT Component; - // gives the original variable that declared this variable - UINT ScopeVar; - // this variable's offset in its ScopeVar - UINT ScopeVarOffset; -} D3D10_SHADER_DEBUG_VAR_INFO; - -typedef struct _D3D10_SHADER_DEBUG_INPUT_INFO -{ - // index into array of variables of variable to initialize - UINT Var; - // input, cbuffer, tbuffer - D3D10_SHADER_DEBUG_REGTYPE InitialRegisterSet; - // set to cbuffer or tbuffer slot, geometry shader input primitive #, - // identifying register for indexable temp, or -1 - UINT InitialBank; - // -1 if temp, otherwise gives register in register set - UINT InitialRegister; - // -1 if temp, otherwise gives component - UINT InitialComponent; - // initial value if literal - UINT InitialValue; -} D3D10_SHADER_DEBUG_INPUT_INFO; - -typedef struct _D3D10_SHADER_DEBUG_SCOPEVAR_INFO -{ - // Index into variable token - UINT TokenId; - - D3D10_SHADER_DEBUG_VARTYPE VarType; // variable or function (different namespaces) - D3D10_SHADER_VARIABLE_CLASS Class; - UINT Rows; // number of rows (matrices) - UINT Columns; // number of columns (vectors and matrices) - - // In an array of structures, one struct member scope is provided, and - // you'll have to add the array stride times the index to the variable - // index you find, then find that variable in this structure's list of - // variables. - - // gives a scope to look up struct members. -1 if not a struct - UINT StructMemberScope; - - // number of array indices - UINT uArrayIndices; // a[3][2][1] has 3 indices - // maximum array index for each index - // offset to UINT[uArrayIndices] in UINT datastore - UINT ArrayElements; // a[3][2][1] has {3, 2, 1} - // how many variables each array index moves - // offset to UINT[uArrayIndices] in UINT datastore - UINT ArrayStrides; // a[3][2][1] has {2, 1, 1} - - UINT uVariables; - // index of the first variable, later variables are offsets from this one - UINT uFirstVariable; -} D3D10_SHADER_DEBUG_SCOPEVAR_INFO; - -// scope data, this maps variable names to debug variables (useful for the watch window) -typedef struct _D3D10_SHADER_DEBUG_SCOPE_INFO -{ - D3D10_SHADER_DEBUG_SCOPETYPE ScopeType; - UINT Name; // offset to name of scope in strings list - UINT uNameLen; // length of name string - UINT uVariables; - UINT VariableData; // Offset to UINT[uVariables] indexing the Scope Variable list -} D3D10_SHADER_DEBUG_SCOPE_INFO; - -// instruction outputs -typedef struct _D3D10_SHADER_DEBUG_OUTPUTVAR -{ - // index variable being written to, if -1 it's not going to a variable - UINT Var; - // range data that the compiler expects to be true - UINT uValueMin, uValueMax; - INT iValueMin, iValueMax; - FLOAT fValueMin, fValueMax; - - BOOL bNaNPossible, bInfPossible; -} D3D10_SHADER_DEBUG_OUTPUTVAR; - -typedef struct _D3D10_SHADER_DEBUG_OUTPUTREG_INFO -{ - // Only temp, indexable temp, and output are valid here - D3D10_SHADER_DEBUG_REGTYPE OutputRegisterSet; - // -1 means no output - UINT OutputReg; - // if a temp array, identifier for which one - UINT TempArrayReg; - // -1 means masked out - UINT OutputComponents[4]; - D3D10_SHADER_DEBUG_OUTPUTVAR OutputVars[4]; - // when indexing the output, get the value of this register, then add - // that to uOutputReg. If uIndexReg is -1, then there is no index. - // find the variable whose register is the sum (by looking in the ScopeVar) - // and component matches, then set it. This should only happen for indexable - // temps and outputs. - UINT IndexReg; - UINT IndexComp; -} D3D10_SHADER_DEBUG_OUTPUTREG_INFO; - -// per instruction data -typedef struct _D3D10_SHADER_DEBUG_INST_INFO -{ - UINT Id; // Which instruction this is in the bytecode - UINT Opcode; // instruction type - - // 0, 1, or 2 - UINT uOutputs; - - // up to two outputs per instruction - D3D10_SHADER_DEBUG_OUTPUTREG_INFO pOutputs[2]; - - // index into the list of tokens for this instruction's token - UINT TokenId; - - // how many function calls deep this instruction is - UINT NestingLevel; - - // list of scopes from outer-most to inner-most - // Number of scopes - UINT Scopes; - UINT ScopeInfo; // Offset to UINT[uScopes] specifying indices of the ScopeInfo Array - - // list of variables accessed by this instruction - // Number of variables - UINT AccessedVars; - UINT AccessedVarsInfo; // Offset to UINT[AccessedVars] specifying indices of the ScopeVariableInfo Array -} D3D10_SHADER_DEBUG_INST_INFO; - -typedef struct _D3D10_SHADER_DEBUG_FILE_INFO -{ - UINT FileName; // Offset to LPCSTR for file name - UINT FileNameLen; // Length of file name - UINT FileData; // Offset to LPCSTR of length FileLen - UINT FileLen; // Length of file -} D3D10_SHADER_DEBUG_FILE_INFO; - -typedef struct _D3D10_SHADER_DEBUG_INFO -{ - UINT Size; // sizeof(D3D10_SHADER_DEBUG_INFO) - UINT Creator; // Offset to LPCSTR for compiler version - UINT EntrypointName; // Offset to LPCSTR for Entry point name - UINT ShaderTarget; // Offset to LPCSTR for shader target - UINT CompileFlags; // flags used to compile - UINT Files; // number of included files - UINT FileInfo; // Offset to D3D10_SHADER_DEBUG_FILE_INFO[Files] - UINT Instructions; // number of instructions - UINT InstructionInfo; // Offset to D3D10_SHADER_DEBUG_INST_INFO[Instructions] - UINT Variables; // number of variables - UINT VariableInfo; // Offset to D3D10_SHADER_DEBUG_VAR_INFO[Variables] - UINT InputVariables; // number of variables to initialize before running - UINT InputVariableInfo; // Offset to D3D10_SHADER_DEBUG_INPUT_INFO[InputVariables] - UINT Tokens; // number of tokens to initialize - UINT TokenInfo; // Offset to D3D10_SHADER_DEBUG_TOKEN_INFO[Tokens] - UINT Scopes; // number of scopes - UINT ScopeInfo; // Offset to D3D10_SHADER_DEBUG_SCOPE_INFO[Scopes] - UINT ScopeVariables; // number of variables declared - UINT ScopeVariableInfo; // Offset to D3D10_SHADER_DEBUG_SCOPEVAR_INFO[Scopes] - UINT UintOffset; // Offset to the UINT datastore, all UINT offsets are from this offset - UINT StringOffset; // Offset to the string datastore, all string offsets are from this offset -} D3D10_SHADER_DEBUG_INFO; - -//---------------------------------------------------------------------------- -// ID3D10ShaderReflection1: -//---------------------------------------------------------------------------- - -// -// Interface definitions -// - - -typedef interface ID3D10ShaderReflection1 ID3D10ShaderReflection1; -typedef interface ID3D10ShaderReflection1 *LPD3D10SHADERREFLECTION1; - -// {C3457783-A846-47CE-9520-CEA6F66E7447} -DEFINE_GUID(IID_ID3D10ShaderReflection1, -0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47); - -#undef INTERFACE -#define INTERFACE ID3D10ShaderReflection1 - -DECLARE_INTERFACE_(ID3D10ShaderReflection1, IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; - - STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; - STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD(GetResourceBindingDescByName)(THIS_ LPCSTR Name, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; - - STDMETHOD(GetMovInstructionCount)(THIS_ _Out_ UINT* pCount) PURE; - STDMETHOD(GetMovcInstructionCount)(THIS_ _Out_ UINT* pCount) PURE; - STDMETHOD(GetConversionInstructionCount)(THIS_ _Out_ UINT* pCount) PURE; - STDMETHOD(GetBitwiseInstructionCount)(THIS_ _Out_ UINT* pCount) PURE; - - STDMETHOD(GetGSInputPrimitive)(THIS_ _Out_ D3D10_PRIMITIVE* pPrim) PURE; - STDMETHOD(IsLevel9Shader)(THIS_ _Out_ BOOL* pbLevel9Shader) PURE; - STDMETHOD(IsSampleFrequencyShader)(THIS_ _Out_ BOOL* pbSampleFrequency) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// APIs ////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //__D3D10_1SHADER_H__ - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10effect.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10effect.h deleted file mode 100644 index 9f5cf7b1e78..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10effect.h +++ /dev/null @@ -1,1458 +0,0 @@ - -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// File: D3D10Effect.h -// Content: D3D10 Stateblock/Effect Types & APIs -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef __D3D10EFFECT_H__ -#define __D3D10EFFECT_H__ - - - -#include "d3d10.h" - -////////////////////////////////////////////////////////////////////////////// -// File contents: -// -// 1) Stateblock enums, structs, interfaces, flat APIs -// 2) Effect enums, structs, interfaces, flat APIs -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_DEVICE_STATE_TYPES: -// -// Used in ID3D10StateBlockMask function calls -// -//---------------------------------------------------------------------------- - -typedef enum _D3D10_DEVICE_STATE_TYPES -{ - - D3D10_DST_SO_BUFFERS=1, // Single-value state (atomical gets/sets) - D3D10_DST_OM_RENDER_TARGETS, // Single-value state (atomical gets/sets) - D3D10_DST_OM_DEPTH_STENCIL_STATE, // Single-value state - D3D10_DST_OM_BLEND_STATE, // Single-value state - - D3D10_DST_VS, // Single-value state - D3D10_DST_VS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - D3D10_DST_VS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - D3D10_DST_VS_CONSTANT_BUFFERS, // Count: - - D3D10_DST_GS, // Single-value state - D3D10_DST_GS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - D3D10_DST_GS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - D3D10_DST_GS_CONSTANT_BUFFERS, // Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - - D3D10_DST_PS, // Single-value state - D3D10_DST_PS_SAMPLERS, // Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT - D3D10_DST_PS_SHADER_RESOURCES, // Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - D3D10_DST_PS_CONSTANT_BUFFERS, // Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - - D3D10_DST_IA_VERTEX_BUFFERS, // Count: D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - D3D10_DST_IA_INDEX_BUFFER, // Single-value state - D3D10_DST_IA_INPUT_LAYOUT, // Single-value state - D3D10_DST_IA_PRIMITIVE_TOPOLOGY, // Single-value state - - D3D10_DST_RS_VIEWPORTS, // Single-value state (atomical gets/sets) - D3D10_DST_RS_SCISSOR_RECTS, // Single-value state (atomical gets/sets) - D3D10_DST_RS_RASTERIZER_STATE, // Single-value state - - D3D10_DST_PREDICATION, // Single-value state -} D3D10_DEVICE_STATE_TYPES; - -//---------------------------------------------------------------------------- -// D3D10_DEVICE_STATE_TYPES: -// -// Used in ID3D10StateBlockMask function calls -// -//---------------------------------------------------------------------------- - -#ifndef D3D10_BYTES_FROM_BITS -#define D3D10_BYTES_FROM_BITS(x) (((x) + 7) / 8) -#endif // D3D10_BYTES_FROM_BITS - -typedef struct _D3D10_STATE_BLOCK_MASK -{ - BYTE VS; - BYTE VSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; - BYTE VSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; - BYTE VSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; - - BYTE GS; - BYTE GSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; - BYTE GSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; - BYTE GSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; - - BYTE PS; - BYTE PSSamplers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT)]; - BYTE PSShaderResources[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT)]; - BYTE PSConstantBuffers[D3D10_BYTES_FROM_BITS(D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT)]; - - BYTE IAVertexBuffers[D3D10_BYTES_FROM_BITS(D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)]; - BYTE IAIndexBuffer; - BYTE IAInputLayout; - BYTE IAPrimitiveTopology; - - BYTE OMRenderTargets; - BYTE OMDepthStencilState; - BYTE OMBlendState; - - BYTE RSViewports; - BYTE RSScissorRects; - BYTE RSRasterizerState; - - BYTE SOBuffers; - - BYTE Predication; -} D3D10_STATE_BLOCK_MASK; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10StateBlock ////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10StateBlock ID3D10StateBlock; -typedef interface ID3D10StateBlock *LPD3D10STATEBLOCK; - -// {0803425A-57F5-4dd6-9465-A87570834A08} -DEFINE_GUID(IID_ID3D10StateBlock, -0x803425a, 0x57f5, 0x4dd6, 0x94, 0x65, 0xa8, 0x75, 0x70, 0x83, 0x4a, 0x8); - -#undef INTERFACE -#define INTERFACE ID3D10StateBlock - -DECLARE_INTERFACE_(ID3D10StateBlock, IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - STDMETHOD(Capture)(THIS) PURE; - STDMETHOD(Apply)(THIS) PURE; - STDMETHOD(ReleaseAllDeviceObjects)(THIS) PURE; - STDMETHOD(GetDevice)(_Out_ THIS_ ID3D10Device **ppDevice) PURE; -}; - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -//---------------------------------------------------------------------------- -// D3D10_STATE_BLOCK_MASK and manipulation functions -// ------------------------------------------------- -// -// These functions exist to facilitate working with the D3D10_STATE_BLOCK_MASK -// structure. -// -// D3D10_STATE_BLOCK_MASK *pResult or *pMask -// The state block mask to operate on -// -// D3D10_STATE_BLOCK_MASK *pA, *pB -// The source state block masks for the binary union/intersect/difference -// operations. -// -// D3D10_DEVICE_STATE_TYPES StateType -// The specific state type to enable/disable/query -// -// UINT RangeStart, RangeLength, Entry -// The specific bit or range of bits for a given state type to operate on. -// Consult the comments for D3D10_DEVICE_STATE_TYPES and -// D3D10_STATE_BLOCK_MASK for information on the valid bit ranges for -// each state. -// -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10StateBlockMaskUnion(_In_ D3D10_STATE_BLOCK_MASK *pA, _In_ D3D10_STATE_BLOCK_MASK *pB, _Out_ D3D10_STATE_BLOCK_MASK *pResult); -HRESULT WINAPI D3D10StateBlockMaskIntersect(_In_ D3D10_STATE_BLOCK_MASK *pA, _In_ D3D10_STATE_BLOCK_MASK *pB, _Out_ D3D10_STATE_BLOCK_MASK *pResult); -HRESULT WINAPI D3D10StateBlockMaskDifference(_In_ D3D10_STATE_BLOCK_MASK *pA, _In_ D3D10_STATE_BLOCK_MASK *pB, _Out_ D3D10_STATE_BLOCK_MASK *pResult); -HRESULT WINAPI D3D10StateBlockMaskEnableCapture(_Inout_ D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT RangeStart, UINT RangeLength); -HRESULT WINAPI D3D10StateBlockMaskDisableCapture(_Inout_ D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT RangeStart, UINT RangeLength); -HRESULT WINAPI D3D10StateBlockMaskEnableAll(_Out_ D3D10_STATE_BLOCK_MASK *pMask); -HRESULT WINAPI D3D10StateBlockMaskDisableAll(_Out_ D3D10_STATE_BLOCK_MASK *pMask); -BOOL WINAPI D3D10StateBlockMaskGetSetting(_In_ D3D10_STATE_BLOCK_MASK *pMask, D3D10_DEVICE_STATE_TYPES StateType, UINT Entry); - -//---------------------------------------------------------------------------- -// D3D10CreateStateBlock -// --------------------- -// -// Creates a state block object based on the mask settings specified -// in a D3D10_STATE_BLOCK_MASK structure. -// -// ID3D10Device *pDevice -// The device interface to associate with this state block -// -// D3D10_STATE_BLOCK_MASK *pStateBlockMask -// A bit mask whose settings are used to generate a state block -// object. -// -// ID3D10StateBlock **ppStateBlock -// The resulting state block object. This object will save/restore -// only those pieces of state that were set in the state block -// bit mask -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10CreateStateBlock(_In_ ID3D10Device *pDevice, _In_ D3D10_STATE_BLOCK_MASK *pStateBlockMask, _Out_ ID3D10StateBlock **ppStateBlock); - -#ifdef __cplusplus -} -#endif //__cplusplus - -//---------------------------------------------------------------------------- -// D3D10_COMPILE & D3D10_EFFECT flags: -// ------------------------------------- -// -// These flags are passed in when creating an effect, and affect -// either compilation behavior or runtime effect behavior -// -// D3D10_EFFECT_COMPILE_CHILD_EFFECT -// Compile this .fx file to a child effect. Child effects have no initializers -// for any shared values as these are initialied in the master effect (pool). -// -// D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS -// By default, performance mode is enabled. Performance mode disallows -// mutable state objects by preventing non-literal expressions from appearing in -// state object definitions. Specifying this flag will disable the mode and allow -// for mutable state objects. -// -// D3D10_EFFECT_SINGLE_THREADED -// Do not attempt to synchronize with other threads loading effects into the -// same pool. -// -//---------------------------------------------------------------------------- - -#define D3D10_EFFECT_COMPILE_CHILD_EFFECT (1 << 0) -#define D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS (1 << 1) -#define D3D10_EFFECT_SINGLE_THREADED (1 << 3) - - -//---------------------------------------------------------------------------- -// D3D10_EFFECT_VARIABLE flags: -// ---------------------------- -// -// These flags describe an effect variable (global or annotation), -// and are returned in D3D10_EFFECT_VARIABLE_DESC::Flags. -// -// D3D10_EFFECT_VARIABLE_POOLED -// Indicates that the this variable or constant buffer resides -// in an effect pool. If this flag is not set, then the variable resides -// in a standalone effect (if ID3D10Effect::GetPool returns NULL) -// or a child effect (if ID3D10Effect::GetPool returns non-NULL) -// -// D3D10_EFFECT_VARIABLE_ANNOTATION -// Indicates that this is an annotation on a technique, pass, or global -// variable. Otherwise, this is a global variable. Annotations cannot -// be shared. -// -// D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT -// Indicates that the variable has been explicitly bound using the -// register keyword. -//---------------------------------------------------------------------------- - -#define D3D10_EFFECT_VARIABLE_POOLED (1 << 0) -#define D3D10_EFFECT_VARIABLE_ANNOTATION (1 << 1) -#define D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT (1 << 2) - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectType ////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_EFFECT_TYPE_DESC: -// -// Retrieved by ID3D10EffectType::GetDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_EFFECT_TYPE_DESC -{ - LPCSTR TypeName; // Name of the type - // (e.g. "float4" or "MyStruct") - - D3D10_SHADER_VARIABLE_CLASS Class; // (e.g. scalar, vector, object, etc.) - D3D10_SHADER_VARIABLE_TYPE Type; // (e.g. float, texture, vertexshader, etc.) - - UINT Elements; // Number of elements in this type - // (0 if not an array) - UINT Members; // Number of members - // (0 if not a structure) - UINT Rows; // Number of rows in this type - // (0 if not a numeric primitive) - UINT Columns; // Number of columns in this type - // (0 if not a numeric primitive) - - UINT PackedSize; // Number of bytes required to represent - // this data type, when tightly packed - UINT UnpackedSize; // Number of bytes occupied by this data - // type, when laid out in a constant buffer - UINT Stride; // Number of bytes to seek between elements, - // when laid out in a constant buffer -} D3D10_EFFECT_TYPE_DESC; - -typedef interface ID3D10EffectType ID3D10EffectType; -typedef interface ID3D10EffectType *LPD3D10EFFECTTYPE; - -// {4E9E1DDC-CD9D-4772-A837-00180B9B88FD} -DEFINE_GUID(IID_ID3D10EffectType, -0x4e9e1ddc, 0xcd9d, 0x4772, 0xa8, 0x37, 0x0, 0x18, 0xb, 0x9b, 0x88, 0xfd); - -#undef INTERFACE -#define INTERFACE ID3D10EffectType - -DECLARE_INTERFACE(ID3D10EffectType) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ D3D10_EFFECT_TYPE_DESC *pDesc) PURE; - STDMETHOD_(ID3D10EffectType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectType*, GetMemberTypeBySemantic)(THIS_ LPCSTR Semantic) PURE; - STDMETHOD_(LPCSTR, GetMemberName)(THIS_ UINT Index) PURE; - STDMETHOD_(LPCSTR, GetMemberSemantic)(THIS_ UINT Index) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectVariable ////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_EFFECT_VARIABLE_DESC: -// -// Retrieved by ID3D10EffectVariable::GetDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_EFFECT_VARIABLE_DESC -{ - LPCSTR Name; // Name of this variable, annotation, - // or structure member - LPCSTR Semantic; // Semantic string of this variable - // or structure member (NULL for - // annotations or if not present) - - UINT Flags; // D3D10_EFFECT_VARIABLE_* flags - UINT Annotations; // Number of annotations on this variable - // (always 0 for annotations) - - UINT BufferOffset; // Offset into containing cbuffer or tbuffer - // (always 0 for annotations or variables - // not in constant buffers) - - UINT ExplicitBindPoint; // Used if the variable has been explicitly bound - // using the register keyword. Check Flags for - // D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT; -} D3D10_EFFECT_VARIABLE_DESC; - -typedef interface ID3D10EffectVariable ID3D10EffectVariable; -typedef interface ID3D10EffectVariable *LPD3D10EFFECTVARIABLE; - -// {AE897105-00E6-45bf-BB8E-281DD6DB8E1B} -DEFINE_GUID(IID_ID3D10EffectVariable, -0xae897105, 0xe6, 0x45bf, 0xbb, 0x8e, 0x28, 0x1d, 0xd6, 0xdb, 0x8e, 0x1b); - -#undef INTERFACE -#define INTERFACE ID3D10EffectVariable - -// Forward defines -typedef interface ID3D10EffectScalarVariable ID3D10EffectScalarVariable; -typedef interface ID3D10EffectVectorVariable ID3D10EffectVectorVariable; -typedef interface ID3D10EffectMatrixVariable ID3D10EffectMatrixVariable; -typedef interface ID3D10EffectStringVariable ID3D10EffectStringVariable; -typedef interface ID3D10EffectShaderResourceVariable ID3D10EffectShaderResourceVariable; -typedef interface ID3D10EffectRenderTargetViewVariable ID3D10EffectRenderTargetViewVariable; -typedef interface ID3D10EffectDepthStencilViewVariable ID3D10EffectDepthStencilViewVariable; -typedef interface ID3D10EffectConstantBuffer ID3D10EffectConstantBuffer; -typedef interface ID3D10EffectShaderVariable ID3D10EffectShaderVariable; -typedef interface ID3D10EffectBlendVariable ID3D10EffectBlendVariable; -typedef interface ID3D10EffectDepthStencilVariable ID3D10EffectDepthStencilVariable; -typedef interface ID3D10EffectRasterizerVariable ID3D10EffectRasterizerVariable; -typedef interface ID3D10EffectSamplerVariable ID3D10EffectSamplerVariable; - -DECLARE_INTERFACE(ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectScalarVariable //////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectScalarVariable ID3D10EffectScalarVariable; -typedef interface ID3D10EffectScalarVariable *LPD3D10EFFECTSCALARVARIABLE; - -// {00E48F7B-D2C8-49e8-A86C-022DEE53431F} -DEFINE_GUID(IID_ID3D10EffectScalarVariable, -0xe48f7b, 0xd2c8, 0x49e8, 0xa8, 0x6c, 0x2, 0x2d, 0xee, 0x53, 0x43, 0x1f); - -#undef INTERFACE -#define INTERFACE ID3D10EffectScalarVariable - -DECLARE_INTERFACE_(ID3D10EffectScalarVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT ByteOffset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT ByteOffset, UINT ByteCount) PURE; - - STDMETHOD(SetFloat)(THIS_ float Value) PURE; - STDMETHOD(GetFloat)(THIS_ _Out_ float *pValue) PURE; - - STDMETHOD(SetFloatArray)(THIS_ _In_reads_(Count) float *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetFloatArray)(THIS_ _Out_writes_(Count) float *pData, UINT Offset, UINT Count) PURE; - - STDMETHOD(SetInt)(THIS_ int Value) PURE; - STDMETHOD(GetInt)(THIS_ _Out_ int *pValue) PURE; - - STDMETHOD(SetIntArray)(THIS_ _In_reads_(Count) int *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetIntArray)(THIS_ _Out_writes_(Count) int *pData, UINT Offset, UINT Count) PURE; - - STDMETHOD(SetBool)(THIS_ BOOL Value) PURE; - STDMETHOD(GetBool)(THIS_ _Out_ BOOL *pValue) PURE; - - STDMETHOD(SetBoolArray)(THIS_ _In_reads_(Count) BOOL *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetBoolArray)(THIS_ _Out_writes_(Count) BOOL *pData, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectVectorVariable //////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectVectorVariable ID3D10EffectVectorVariable; -typedef interface ID3D10EffectVectorVariable *LPD3D10EFFECTVECTORVARIABLE; - -// {62B98C44-1F82-4c67-BCD0-72CF8F217E81} -DEFINE_GUID(IID_ID3D10EffectVectorVariable, -0x62b98c44, 0x1f82, 0x4c67, 0xbc, 0xd0, 0x72, 0xcf, 0x8f, 0x21, 0x7e, 0x81); - -#undef INTERFACE -#define INTERFACE ID3D10EffectVectorVariable - -DECLARE_INTERFACE_(ID3D10EffectVectorVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT ByteOffset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT ByteOffset, UINT ByteCount) PURE; - - STDMETHOD(SetBoolVector) (THIS_ BOOL *pData) PURE; - STDMETHOD(SetIntVector) (THIS_ int *pData) PURE; - STDMETHOD(SetFloatVector)(THIS_ float *pData) PURE; - - STDMETHOD(GetBoolVector) (THIS_ BOOL *pData) PURE; - STDMETHOD(GetIntVector) (THIS_ int *pData) PURE; - STDMETHOD(GetFloatVector)(THIS_ float *pData) PURE; - - STDMETHOD(SetBoolVectorArray) (THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(SetIntVectorArray) (THIS_ int *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(SetFloatVectorArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; - - STDMETHOD(GetBoolVectorArray) (THIS_ BOOL *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetIntVectorArray) (THIS_ int *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetFloatVectorArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectMatrixVariable //////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectMatrixVariable ID3D10EffectMatrixVariable; -typedef interface ID3D10EffectMatrixVariable *LPD3D10EFFECTMATRIXVARIABLE; - -// {50666C24-B82F-4eed-A172-5B6E7E8522E0} -DEFINE_GUID(IID_ID3D10EffectMatrixVariable, -0x50666c24, 0xb82f, 0x4eed, 0xa1, 0x72, 0x5b, 0x6e, 0x7e, 0x85, 0x22, 0xe0); - -#undef INTERFACE -#define INTERFACE ID3D10EffectMatrixVariable - -DECLARE_INTERFACE_(ID3D10EffectMatrixVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT ByteOffset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT ByteOffset, UINT ByteCount) PURE; - - STDMETHOD(SetMatrix)(THIS_ float *pData) PURE; - STDMETHOD(GetMatrix)(THIS_ float *pData) PURE; - - STDMETHOD(SetMatrixArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetMatrixArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; - - STDMETHOD(SetMatrixTranspose)(THIS_ float *pData) PURE; - STDMETHOD(GetMatrixTranspose)(THIS_ float *pData) PURE; - - STDMETHOD(SetMatrixTransposeArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; - STDMETHOD(GetMatrixTransposeArray)(THIS_ float *pData, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectStringVariable //////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectStringVariable ID3D10EffectStringVariable; -typedef interface ID3D10EffectStringVariable *LPD3D10EFFECTSTRINGVARIABLE; - -// {71417501-8DF9-4e0a-A78A-255F9756BAFF} -DEFINE_GUID(IID_ID3D10EffectStringVariable, -0x71417501, 0x8df9, 0x4e0a, 0xa7, 0x8a, 0x25, 0x5f, 0x97, 0x56, 0xba, 0xff); - -#undef INTERFACE -#define INTERFACE ID3D10EffectStringVariable - -DECLARE_INTERFACE_(ID3D10EffectStringVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(GetString)(THIS_ _Out_ LPCSTR *ppString) PURE; - STDMETHOD(GetStringArray)(THIS_ _Out_writes_(Count) LPCSTR *ppStrings, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectShaderResourceVariable //////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectShaderResourceVariable ID3D10EffectShaderResourceVariable; -typedef interface ID3D10EffectShaderResourceVariable *LPD3D10EFFECTSHADERRESOURCEVARIABLE; - -// {C0A7157B-D872-4b1d-8073-EFC2ACD4B1FC} -DEFINE_GUID(IID_ID3D10EffectShaderResourceVariable, -0xc0a7157b, 0xd872, 0x4b1d, 0x80, 0x73, 0xef, 0xc2, 0xac, 0xd4, 0xb1, 0xfc); - - -#undef INTERFACE -#define INTERFACE ID3D10EffectShaderResourceVariable - -DECLARE_INTERFACE_(ID3D10EffectShaderResourceVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(SetResource)(THIS_ _In_opt_ ID3D10ShaderResourceView *pResource) PURE; - STDMETHOD(GetResource)(THIS_ _Out_ ID3D10ShaderResourceView **ppResource) PURE; - - STDMETHOD(SetResourceArray)(THIS_ _In_reads_(Count) ID3D10ShaderResourceView **ppResources, UINT Offset, UINT Count) PURE; - STDMETHOD(GetResourceArray)(THIS_ _Out_writes_(Count) ID3D10ShaderResourceView **ppResources, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectRenderTargetViewVariable ////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectRenderTargetViewVariable ID3D10EffectRenderTargetViewVariable; -typedef interface ID3D10EffectRenderTargetViewVariable *LPD3D10EFFECTRENDERTARGETVIEWVARIABLE; - -// {28CA0CC3-C2C9-40bb-B57F-67B737122B17} -DEFINE_GUID(IID_ID3D10EffectRenderTargetViewVariable, -0x28ca0cc3, 0xc2c9, 0x40bb, 0xb5, 0x7f, 0x67, 0xb7, 0x37, 0x12, 0x2b, 0x17); - -#undef INTERFACE -#define INTERFACE ID3D10EffectRenderTargetViewVariable - -DECLARE_INTERFACE_(ID3D10EffectRenderTargetViewVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(SetRenderTarget)(THIS_ _In_opt_ ID3D10RenderTargetView *pResource) PURE; - STDMETHOD(GetRenderTarget)(THIS_ _Out_ ID3D10RenderTargetView **ppResource) PURE; - - STDMETHOD(SetRenderTargetArray)(THIS_ _In_reads_(Count) ID3D10RenderTargetView **ppResources, UINT Offset, UINT Count) PURE; - STDMETHOD(GetRenderTargetArray)(THIS_ _Out_writes_(Count) ID3D10RenderTargetView **ppResources, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectDepthStencilViewVariable ////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectDepthStencilViewVariable ID3D10EffectDepthStencilViewVariable; -typedef interface ID3D10EffectDepthStencilViewVariable *LPD3D10EFFECTDEPTHSTENCILVIEWVARIABLE; - -// {3E02C918-CC79-4985-B622-2D92AD701623} -DEFINE_GUID(IID_ID3D10EffectDepthStencilViewVariable, -0x3e02c918, 0xcc79, 0x4985, 0xb6, 0x22, 0x2d, 0x92, 0xad, 0x70, 0x16, 0x23); - -#undef INTERFACE -#define INTERFACE ID3D10EffectDepthStencilViewVariable - -DECLARE_INTERFACE_(ID3D10EffectDepthStencilViewVariable, ID3D10EffectVariable) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(SetDepthStencil)(THIS_ _In_opt_ ID3D10DepthStencilView *pResource) PURE; - STDMETHOD(GetDepthStencil)(THIS_ _Out_ ID3D10DepthStencilView **ppResource) PURE; - - STDMETHOD(SetDepthStencilArray)(THIS_ _In_reads_(Count) ID3D10DepthStencilView **ppResources, UINT Offset, UINT Count) PURE; - STDMETHOD(GetDepthStencilArray)(THIS_ _Out_writes_(Count) ID3D10DepthStencilView **ppResources, UINT Offset, UINT Count) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectConstantBuffer //////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectConstantBuffer ID3D10EffectConstantBuffer; -typedef interface ID3D10EffectConstantBuffer *LPD3D10EFFECTCONSTANTBUFFER; - -// {56648F4D-CC8B-4444-A5AD-B5A3D76E91B3} -DEFINE_GUID(IID_ID3D10EffectConstantBuffer, -0x56648f4d, 0xcc8b, 0x4444, 0xa5, 0xad, 0xb5, 0xa3, 0xd7, 0x6e, 0x91, 0xb3); - -#undef INTERFACE -#define INTERFACE ID3D10EffectConstantBuffer - -DECLARE_INTERFACE_(ID3D10EffectConstantBuffer, ID3D10EffectVariable) -{ - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(SetConstantBuffer)(THIS_ _In_opt_ ID3D10Buffer *pConstantBuffer) PURE; - STDMETHOD(GetConstantBuffer)(THIS_ _Out_ ID3D10Buffer **ppConstantBuffer) PURE; - - STDMETHOD(SetTextureBuffer)(THIS_ _In_opt_ ID3D10ShaderResourceView *pTextureBuffer) PURE; - STDMETHOD(GetTextureBuffer)(THIS_ _Out_ ID3D10ShaderResourceView **ppTextureBuffer) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectShaderVariable //////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_EFFECT_SHADER_DESC: -// -// Retrieved by ID3D10EffectShaderVariable::GetShaderDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_EFFECT_SHADER_DESC -{ - CONST BYTE *pInputSignature; // Passed into CreateInputLayout, - // valid on VS and GS only - - BOOL IsInline; // Is this an anonymous shader variable - // resulting from an inline shader assignment? - - - // -- The following fields are not valid after Optimize() -- - CONST BYTE *pBytecode; // Shader bytecode - UINT BytecodeLength; - - LPCSTR SODecl; // Stream out declaration string (for GS with SO) - - UINT NumInputSignatureEntries; // Number of entries in the input signature - UINT NumOutputSignatureEntries; // Number of entries in the output signature -} D3D10_EFFECT_SHADER_DESC; - - -typedef interface ID3D10EffectShaderVariable ID3D10EffectShaderVariable; -typedef interface ID3D10EffectShaderVariable *LPD3D10EFFECTSHADERVARIABLE; - -// {80849279-C799-4797-8C33-0407A07D9E06} -DEFINE_GUID(IID_ID3D10EffectShaderVariable, -0x80849279, 0xc799, 0x4797, 0x8c, 0x33, 0x4, 0x7, 0xa0, 0x7d, 0x9e, 0x6); - -#undef INTERFACE -#define INTERFACE ID3D10EffectShaderVariable - -DECLARE_INTERFACE_(ID3D10EffectShaderVariable, ID3D10EffectVariable) -{ - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(GetShaderDesc)(THIS_ UINT ShaderIndex, _Out_ D3D10_EFFECT_SHADER_DESC *pDesc) PURE; - - STDMETHOD(GetVertexShader)(THIS_ UINT ShaderIndex, _Out_ ID3D10VertexShader **ppVS) PURE; - STDMETHOD(GetGeometryShader)(THIS_ UINT ShaderIndex, _Out_ ID3D10GeometryShader **ppGS) PURE; - STDMETHOD(GetPixelShader)(THIS_ UINT ShaderIndex, _Out_ ID3D10PixelShader **ppPS) PURE; - - STDMETHOD(GetInputSignatureElementDesc)(THIS_ UINT ShaderIndex, UINT Element, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; - STDMETHOD(GetOutputSignatureElementDesc)(THIS_ UINT ShaderIndex, UINT Element, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectBlendVariable ///////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectBlendVariable ID3D10EffectBlendVariable; -typedef interface ID3D10EffectBlendVariable *LPD3D10EFFECTBLENDVARIABLE; - -// {1FCD2294-DF6D-4eae-86B3-0E9160CFB07B} -DEFINE_GUID(IID_ID3D10EffectBlendVariable, -0x1fcd2294, 0xdf6d, 0x4eae, 0x86, 0xb3, 0xe, 0x91, 0x60, 0xcf, 0xb0, 0x7b); - -#undef INTERFACE -#define INTERFACE ID3D10EffectBlendVariable - -DECLARE_INTERFACE_(ID3D10EffectBlendVariable, ID3D10EffectVariable) -{ - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(GetBlendState)(THIS_ UINT Index, ID3D10BlendState **ppBlendState) PURE; - STDMETHOD(GetBackingStore)(THIS_ UINT Index, D3D10_BLEND_DESC *pBlendDesc) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectDepthStencilVariable ////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectDepthStencilVariable ID3D10EffectDepthStencilVariable; -typedef interface ID3D10EffectDepthStencilVariable *LPD3D10EFFECTDEPTHSTENCILVARIABLE; - -// {AF482368-330A-46a5-9A5C-01C71AF24C8D} -DEFINE_GUID(IID_ID3D10EffectDepthStencilVariable, -0xaf482368, 0x330a, 0x46a5, 0x9a, 0x5c, 0x1, 0xc7, 0x1a, 0xf2, 0x4c, 0x8d); - -#undef INTERFACE -#define INTERFACE ID3D10EffectDepthStencilVariable - -DECLARE_INTERFACE_(ID3D10EffectDepthStencilVariable, ID3D10EffectVariable) -{ - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(GetDepthStencilState)(THIS_ UINT Index, _Out_ ID3D10DepthStencilState **ppDepthStencilState) PURE; - STDMETHOD(GetBackingStore)(THIS_ UINT Index, _Out_ D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectRasterizerVariable //////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectRasterizerVariable ID3D10EffectRasterizerVariable; -typedef interface ID3D10EffectRasterizerVariable *LPD3D10EFFECTRASTERIZERVARIABLE; - -// {21AF9F0E-4D94-4ea9-9785-2CB76B8C0B34} -DEFINE_GUID(IID_ID3D10EffectRasterizerVariable, -0x21af9f0e, 0x4d94, 0x4ea9, 0x97, 0x85, 0x2c, 0xb7, 0x6b, 0x8c, 0xb, 0x34); - -#undef INTERFACE -#define INTERFACE ID3D10EffectRasterizerVariable - -DECLARE_INTERFACE_(ID3D10EffectRasterizerVariable, ID3D10EffectVariable) -{ - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(GetRasterizerState)(THIS_ UINT Index, _Out_ ID3D10RasterizerState **ppRasterizerState) PURE; - STDMETHOD(GetBackingStore)(THIS_ UINT Index, _Out_ D3D10_RASTERIZER_DESC *pRasterizerDesc) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectSamplerVariable /////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectSamplerVariable ID3D10EffectSamplerVariable; -typedef interface ID3D10EffectSamplerVariable *LPD3D10EFFECTSAMPLERVARIABLE; - -// {6530D5C7-07E9-4271-A418-E7CE4BD1E480} -DEFINE_GUID(IID_ID3D10EffectSamplerVariable, -0x6530d5c7, 0x7e9, 0x4271, 0xa4, 0x18, 0xe7, 0xce, 0x4b, 0xd1, 0xe4, 0x80); - -#undef INTERFACE -#define INTERFACE ID3D10EffectSamplerVariable - -DECLARE_INTERFACE_(ID3D10EffectSamplerVariable, ID3D10EffectVariable) -{ - STDMETHOD_(ID3D10EffectType*, GetType)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetMemberByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetMemberBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetElement)(THIS_ UINT Index) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetParentConstantBuffer)(THIS) PURE; - - STDMETHOD_(ID3D10EffectScalarVariable*, AsScalar)(THIS) PURE; - STDMETHOD_(ID3D10EffectVectorVariable*, AsVector)(THIS) PURE; - STDMETHOD_(ID3D10EffectMatrixVariable*, AsMatrix)(THIS) PURE; - STDMETHOD_(ID3D10EffectStringVariable*, AsString)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderResourceVariable*, AsShaderResource)(THIS) PURE; - STDMETHOD_(ID3D10EffectRenderTargetViewVariable*, AsRenderTargetView)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilViewVariable*, AsDepthStencilView)(THIS) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, AsConstantBuffer)(THIS) PURE; - STDMETHOD_(ID3D10EffectShaderVariable*, AsShader)(THIS) PURE; - STDMETHOD_(ID3D10EffectBlendVariable*, AsBlend)(THIS) PURE; - STDMETHOD_(ID3D10EffectDepthStencilVariable*, AsDepthStencil)(THIS) PURE; - STDMETHOD_(ID3D10EffectRasterizerVariable*, AsRasterizer)(THIS) PURE; - STDMETHOD_(ID3D10EffectSamplerVariable*, AsSampler)(THIS) PURE; - - STDMETHOD(SetRawValue)(THIS_ _In_reads_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - STDMETHOD(GetRawValue)(THIS_ _Out_writes_bytes_(ByteCount) void *pData, UINT Offset, UINT ByteCount) PURE; - - STDMETHOD(GetSampler)(THIS_ UINT Index, _Out_ ID3D10SamplerState **ppSampler) PURE; - STDMETHOD(GetBackingStore)(THIS_ UINT Index, _Out_ D3D10_SAMPLER_DESC *pSamplerDesc) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectPass ////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_PASS_DESC: -// -// Retrieved by ID3D10EffectPass::GetDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_PASS_DESC -{ - LPCSTR Name; // Name of this pass (NULL if not anonymous) - UINT Annotations; // Number of annotations on this pass - - BYTE *pIAInputSignature; // Signature from VS or GS (if there is no VS) - // or NULL if neither exists - SIZE_T IAInputSignatureSize; // Singature size in bytes - - UINT StencilRef; // Specified in SetDepthStencilState() - UINT SampleMask; // Specified in SetBlendState() - FLOAT BlendFactor[4]; // Specified in SetBlendState() -} D3D10_PASS_DESC; - -//---------------------------------------------------------------------------- -// D3D10_PASS_SHADER_DESC: -// -// Retrieved by ID3D10EffectPass::Get**ShaderDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_PASS_SHADER_DESC -{ - ID3D10EffectShaderVariable *pShaderVariable; // The variable that this shader came from. - // If this is an inline shader assignment, - // the returned interface will be an - // anonymous shader variable, which is - // not retrievable any other way. It's - // name in the variable description will - // be "$Anonymous". - // If there is no assignment of this type in - // the pass block, pShaderVariable != NULL, - // but pShaderVariable->IsValid() == FALSE. - - UINT ShaderIndex; // The element of pShaderVariable (if an array) - // or 0 if not applicable -} D3D10_PASS_SHADER_DESC; - -typedef interface ID3D10EffectPass ID3D10EffectPass; -typedef interface ID3D10EffectPass *LPD3D10EFFECTPASS; - -// {5CFBEB89-1A06-46e0-B282-E3F9BFA36A54} -DEFINE_GUID(IID_ID3D10EffectPass, -0x5cfbeb89, 0x1a06, 0x46e0, 0xb2, 0x82, 0xe3, 0xf9, 0xbf, 0xa3, 0x6a, 0x54); - -#undef INTERFACE -#define INTERFACE ID3D10EffectPass - -DECLARE_INTERFACE(ID3D10EffectPass) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ D3D10_PASS_DESC *pDesc) PURE; - - STDMETHOD(GetVertexShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; - STDMETHOD(GetGeometryShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; - STDMETHOD(GetPixelShaderDesc)(THIS_ D3D10_PASS_SHADER_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD(Apply)(THIS_ UINT Flags) PURE; - - STDMETHOD(ComputeStateBlockMask)(THIS_ _Out_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectTechnique ///////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_TECHNIQUE_DESC: -// -// Retrieved by ID3D10EffectTechnique::GetDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_TECHNIQUE_DESC -{ - LPCSTR Name; // Name of this technique (NULL if not anonymous) - UINT Passes; // Number of passes contained within - UINT Annotations; // Number of annotations on this technique -} D3D10_TECHNIQUE_DESC; - -typedef interface ID3D10EffectTechnique ID3D10EffectTechnique; -typedef interface ID3D10EffectTechnique *LPD3D10EFFECTTECHNIQUE; - -// {DB122CE8-D1C9-4292-B237-24ED3DE8B175} -DEFINE_GUID(IID_ID3D10EffectTechnique, -0xdb122ce8, 0xd1c9, 0x4292, 0xb2, 0x37, 0x24, 0xed, 0x3d, 0xe8, 0xb1, 0x75); - -#undef INTERFACE -#define INTERFACE ID3D10EffectTechnique - -DECLARE_INTERFACE(ID3D10EffectTechnique) -{ - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD(GetDesc)(THIS_ D3D10_TECHNIQUE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetAnnotationByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectPass*, GetPassByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectPass*, GetPassByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD(ComputeStateBlockMask)(THIS_ _Out_ D3D10_STATE_BLOCK_MASK *pStateBlockMask) PURE; -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10Effect ////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// D3D10_EFFECT_DESC: -// -// Retrieved by ID3D10Effect::GetDesc() -//---------------------------------------------------------------------------- - -typedef struct _D3D10_EFFECT_DESC -{ - - BOOL IsChildEffect; // TRUE if this is a child effect, - // FALSE if this is standalone or an effect pool. - - UINT ConstantBuffers; // Number of constant buffers in this effect, - // excluding the effect pool. - UINT SharedConstantBuffers; // Number of constant buffers shared in this - // effect's pool. - - UINT GlobalVariables; // Number of global variables in this effect, - // excluding the effect pool. - UINT SharedGlobalVariables; // Number of global variables shared in this - // effect's pool. - - UINT Techniques; // Number of techniques in this effect, - // excluding the effect pool. -} D3D10_EFFECT_DESC; - -typedef interface ID3D10Effect ID3D10Effect; -typedef interface ID3D10Effect *LPD3D10EFFECT; - -// {51B0CA8B-EC0B-4519-870D-8EE1CB5017C7} -DEFINE_GUID(IID_ID3D10Effect, -0x51b0ca8b, 0xec0b, 0x4519, 0x87, 0xd, 0x8e, 0xe1, 0xcb, 0x50, 0x17, 0xc7); - -#undef INTERFACE -#define INTERFACE ID3D10Effect - -DECLARE_INTERFACE_(ID3D10Effect, IUnknown) -{ - // IUnknown - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - STDMETHOD_(BOOL, IsValid)(THIS) PURE; - STDMETHOD_(BOOL, IsPool)(THIS) PURE; - - // Managing D3D Device - STDMETHOD(GetDevice)(THIS_ _Out_ ID3D10Device** ppDevice) PURE; - - // New Reflection APIs - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_EFFECT_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10EffectConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD_(ID3D10EffectVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(ID3D10EffectVariable*, GetVariableBySemantic)(THIS_ LPCSTR Semantic) PURE; - - STDMETHOD_(ID3D10EffectTechnique*, GetTechniqueByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10EffectTechnique*, GetTechniqueByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD(Optimize)(THIS) PURE; - STDMETHOD_(BOOL, IsOptimized)(THIS) PURE; - -}; - -////////////////////////////////////////////////////////////////////////////// -// ID3D10EffectPool ////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -typedef interface ID3D10EffectPool ID3D10EffectPool; -typedef interface ID3D10EffectPool *LPD3D10EFFECTPOOL; - -// {9537AB04-3250-412e-8213-FCD2F8677933} -DEFINE_GUID(IID_ID3D10EffectPool, -0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33); - -#undef INTERFACE -#define INTERFACE ID3D10EffectPool - -DECLARE_INTERFACE_(ID3D10EffectPool, IUnknown) -{ - // IUnknown - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - STDMETHOD_(ID3D10Effect*, AsEffect)(THIS) PURE; - - // No public methods -}; - -////////////////////////////////////////////////////////////////////////////// -// APIs ////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -//---------------------------------------------------------------------------- -// D3D10CreateEffectFromXXXX: -// -------------------------- -// Creates an effect from a binary effect or file -// -// Parameters: -// -// [in] -// -// -// pData -// Blob of effect data, either ASCII (uncompiled, for D3D10CompileEffectFromMemory) or binary (compiled, for D3D10CreateEffect*) -// DataLength -// Length of the data blob -// -// pSrcFileName -// Name of the ASCII Effect file pData was obtained from -// -// pDefines -// Optional NULL-terminated array of preprocessor macro definitions. -// pInclude -// Optional interface pointer to use for handling #include directives. -// If this parameter is NULL, #includes will be honored when compiling -// from file, and will error when compiling from resource or memory. -// HLSLFlags -// Compilation flags pertaining to shaders and data types, honored by -// the HLSL compiler -// FXFlags -// Compilation flags pertaining to Effect compilation, honored -// by the Effect compiler -// pDevice -// Pointer to the D3D10 device on which to create Effect resources -// pEffectPool -// Pointer to an Effect pool to share variables with or NULL -// -// [out] -// -// ppEffect -// Address of the newly created Effect interface -// ppEffectPool -// Address of the newly created Effect pool interface -// ppErrors -// If non-NULL, address of a buffer with error messages that occurred -// during parsing or compilation -// -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10CompileEffectFromMemory(_In_reads_bytes_(DataLength) void *pData, SIZE_T DataLength, LPCSTR pSrcFileName, _In_opt_ CONST D3D10_SHADER_MACRO *pDefines, - _In_opt_ ID3D10Include *pInclude, UINT HLSLFlags, UINT FXFlags, - _Out_ ID3D10Blob **ppCompiledEffect, _Out_opt_ ID3D10Blob **ppErrors); - -HRESULT WINAPI D3D10CreateEffectFromMemory(_In_reads_bytes_(DataLength) void *pData, SIZE_T DataLength, UINT FXFlags, _In_ ID3D10Device *pDevice, - _In_opt_ ID3D10EffectPool *pEffectPool, _Out_ ID3D10Effect **ppEffect); - -HRESULT WINAPI D3D10CreateEffectPoolFromMemory(_In_reads_bytes_(DataLength) void *pData, SIZE_T DataLength, UINT FXFlags, _In_ ID3D10Device *pDevice, - _Out_ ID3D10EffectPool **ppEffectPool); - - -//---------------------------------------------------------------------------- -// D3D10DisassembleEffect: -// ----------------------- -// Takes an effect interface, and returns a buffer containing text assembly. -// -// Parameters: -// pEffect -// Pointer to the runtime effect interface. -// EnableColorCode -// Emit HTML tags for color coding the output? -// ppDisassembly -// Returns a buffer containing the disassembled effect. -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10DisassembleEffect(_In_ ID3D10Effect *pEffect, BOOL EnableColorCode, _Out_ ID3D10Blob **ppDisassembly); - -#ifdef __cplusplus -} -#endif //__cplusplus - - -#endif //__D3D10EFFECT_H__ - - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10misc.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10misc.h deleted file mode 100644 index c46951fa890..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10misc.h +++ /dev/null @@ -1,146 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// File: D3D10Misc.h -// Content: D3D10 Device Creation APIs -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef __D3D10MISC_H__ -#define __D3D10MISC_H__ - -#include "d3d10.h" - -// ID3D10Blob has been made version-neutral and moved to d3dcommon.h. - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - - - -/////////////////////////////////////////////////////////////////////////// -// D3D10_DRIVER_TYPE -// ---------------- -// -// This identifier is used to determine the implementation of Direct3D10 -// to be used. -// -// Pass one of these values to D3D10CreateDevice -// -/////////////////////////////////////////////////////////////////////////// -typedef enum D3D10_DRIVER_TYPE -{ - D3D10_DRIVER_TYPE_HARDWARE = 0, - D3D10_DRIVER_TYPE_REFERENCE = 1, - D3D10_DRIVER_TYPE_NULL = 2, - D3D10_DRIVER_TYPE_SOFTWARE = 3, - D3D10_DRIVER_TYPE_WARP = 5, -} D3D10_DRIVER_TYPE; - -DEFINE_GUID(GUID_DeviceType, -0xd722fb4d, 0x7a68, 0x437a, 0xb2, 0x0c, 0x58, 0x04, 0xee, 0x24, 0x94, 0xa6); - -/////////////////////////////////////////////////////////////////////////// -// D3D10CreateDevice -// ------------------ -// -// pAdapter -// If NULL, D3D10CreateDevice will choose the primary adapter and -// create a new instance from a temporarily created IDXGIFactory. -// If non-NULL, D3D10CreateDevice will register the appropriate -// device, if necessary (via IDXGIAdapter::RegisterDrver), before -// creating the device. -// DriverType -// Specifies the driver type to be created: hardware, reference or -// null. -// Software -// HMODULE of a DLL implementing a software rasterizer. Must be NULL for -// non-Software driver types. -// Flags -// Any of those documented for D3D10CreateDevice. -// SDKVersion -// SDK version. Use the D3D10_SDK_VERSION macro. -// ppDevice -// Pointer to returned interface. -// -// Return Values -// Any of those documented for -// CreateDXGIFactory -// IDXGIFactory::EnumAdapters -// IDXGIAdapter::RegisterDriver -// D3D10CreateDevice -// -/////////////////////////////////////////////////////////////////////////// -HRESULT WINAPI D3D10CreateDevice( - _In_opt_ IDXGIAdapter *pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - UINT Flags, - UINT SDKVersion, - _Out_opt_ ID3D10Device **ppDevice); - -/////////////////////////////////////////////////////////////////////////// -// D3D10CreateDeviceAndSwapChain -// ------------------------------ -// -// ppAdapter -// If NULL, D3D10CreateDevice will choose the primary adapter and -// create a new instance from a temporarily created IDXGIFactory. -// If non-NULL, D3D10CreateDevice will register the appropriate -// device, if necessary (via IDXGIAdapter::RegisterDrver), before -// creating the device. -// DriverType -// Specifies the driver type to be created: hardware, reference or -// null. -// Software -// HMODULE of a DLL implementing a software rasterizer. Must be NULL for -// non-Software driver types. -// Flags -// Any of those documented for D3D10CreateDevice. -// SDKVersion -// SDK version. Use the D3D10_SDK_VERSION macro. -// pSwapChainDesc -// Swap chain description, may be NULL. -// ppSwapChain -// Pointer to returned interface. May be NULL. -// ppDevice -// Pointer to returned interface. -// -// Return Values -// Any of those documented for -// CreateDXGIFactory -// IDXGIFactory::EnumAdapters -// IDXGIAdapter::RegisterDriver -// D3D10CreateDevice -// IDXGIFactory::CreateSwapChain -// -/////////////////////////////////////////////////////////////////////////// -HRESULT WINAPI D3D10CreateDeviceAndSwapChain( - _In_opt_ IDXGIAdapter *pAdapter, - D3D10_DRIVER_TYPE DriverType, - HMODULE Software, - UINT Flags, - UINT SDKVersion, - _In_opt_ DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, - _Out_opt_ IDXGISwapChain **ppSwapChain, - _Out_opt_ ID3D10Device **ppDevice); - - -/////////////////////////////////////////////////////////////////////////// -// D3D10CreateBlob: -// ----------------- -// Creates a Buffer of n Bytes -////////////////////////////////////////////////////////////////////////// - -HRESULT WINAPI D3D10CreateBlob(SIZE_T NumBytes, _Out_ LPD3D10BLOB *ppBuffer); - - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif //__D3D10EFFECT_H__ - - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10sdklayers.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10sdklayers.h deleted file mode 100644 index 3a1e8c8692d..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10sdklayers.h +++ /dev/null @@ -1,1395 +0,0 @@ -/*------------------------------------------------------------------------------------- - * - * Copyright (c) Microsoft Corporation - * - *-------------------------------------------------------------------------------------*/ - - -/* this ALWAYS GENERATED file contains the definitions for the interfaces */ - - - /* File created by MIDL compiler version 8.00.0613 */ -/* @@MIDL_FILE_HEADING( ) */ - - - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 500 -#endif - -/* verify that the version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCSAL_H_VERSION__ -#define __REQUIRED_RPCSAL_H_VERSION__ 100 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of -#endif /* __RPCNDR_H_VERSION__ */ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -#ifndef __d3d10sdklayers_h__ -#define __d3d10sdklayers_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __ID3D10Debug_FWD_DEFINED__ -#define __ID3D10Debug_FWD_DEFINED__ -typedef interface ID3D10Debug ID3D10Debug; - -#endif /* __ID3D10Debug_FWD_DEFINED__ */ - - -#ifndef __ID3D10SwitchToRef_FWD_DEFINED__ -#define __ID3D10SwitchToRef_FWD_DEFINED__ -typedef interface ID3D10SwitchToRef ID3D10SwitchToRef; - -#endif /* __ID3D10SwitchToRef_FWD_DEFINED__ */ - - -#ifndef __ID3D10InfoQueue_FWD_DEFINED__ -#define __ID3D10InfoQueue_FWD_DEFINED__ -typedef interface ID3D10InfoQueue ID3D10InfoQueue; - -#endif /* __ID3D10InfoQueue_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" -#include "dxgi.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_d3d10sdklayers_0000_0000 */ -/* [local] */ - -#define D3D10_SDK_LAYERS_VERSION ( 11 ) - -#define D3D10_DEBUG_FEATURE_FLUSH_PER_RENDER_OP ( 0x1 ) - -#define D3D10_DEBUG_FEATURE_FINISH_PER_RENDER_OP ( 0x2 ) - -#define D3D10_DEBUG_FEATURE_PRESENT_PER_RENDER_OP ( 0x4 ) - - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0000_v0_0_s_ifspec; - -#ifndef __ID3D10Debug_INTERFACE_DEFINED__ -#define __ID3D10Debug_INTERFACE_DEFINED__ - -/* interface ID3D10Debug */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10Debug; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4E01-342C-4106-A19F-4F2704F689F0") - ID3D10Debug : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetFeatureMask( - UINT Mask) = 0; - - virtual UINT STDMETHODCALLTYPE GetFeatureMask( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetPresentPerRenderOpDelay( - UINT Milliseconds) = 0; - - virtual UINT STDMETHODCALLTYPE GetPresentPerRenderOpDelay( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetSwapChain( - /* [annotation] */ - _In_opt_ IDXGISwapChain *pSwapChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSwapChain( - /* [annotation] */ - _Out_ IDXGISwapChain **ppSwapChain) = 0; - - virtual HRESULT STDMETHODCALLTYPE Validate( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10DebugVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10Debug * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10Debug * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10Debug * This); - - HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( - ID3D10Debug * This, - UINT Mask); - - UINT ( STDMETHODCALLTYPE *GetFeatureMask )( - ID3D10Debug * This); - - HRESULT ( STDMETHODCALLTYPE *SetPresentPerRenderOpDelay )( - ID3D10Debug * This, - UINT Milliseconds); - - UINT ( STDMETHODCALLTYPE *GetPresentPerRenderOpDelay )( - ID3D10Debug * This); - - HRESULT ( STDMETHODCALLTYPE *SetSwapChain )( - ID3D10Debug * This, - /* [annotation] */ - _In_opt_ IDXGISwapChain *pSwapChain); - - HRESULT ( STDMETHODCALLTYPE *GetSwapChain )( - ID3D10Debug * This, - /* [annotation] */ - _Out_ IDXGISwapChain **ppSwapChain); - - HRESULT ( STDMETHODCALLTYPE *Validate )( - ID3D10Debug * This); - - END_INTERFACE - } ID3D10DebugVtbl; - - interface ID3D10Debug - { - CONST_VTBL struct ID3D10DebugVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10Debug_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10Debug_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10Debug_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10Debug_SetFeatureMask(This,Mask) \ - ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) - -#define ID3D10Debug_GetFeatureMask(This) \ - ( (This)->lpVtbl -> GetFeatureMask(This) ) - -#define ID3D10Debug_SetPresentPerRenderOpDelay(This,Milliseconds) \ - ( (This)->lpVtbl -> SetPresentPerRenderOpDelay(This,Milliseconds) ) - -#define ID3D10Debug_GetPresentPerRenderOpDelay(This) \ - ( (This)->lpVtbl -> GetPresentPerRenderOpDelay(This) ) - -#define ID3D10Debug_SetSwapChain(This,pSwapChain) \ - ( (This)->lpVtbl -> SetSwapChain(This,pSwapChain) ) - -#define ID3D10Debug_GetSwapChain(This,ppSwapChain) \ - ( (This)->lpVtbl -> GetSwapChain(This,ppSwapChain) ) - -#define ID3D10Debug_Validate(This) \ - ( (This)->lpVtbl -> Validate(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10Debug_INTERFACE_DEFINED__ */ - - -#ifndef __ID3D10SwitchToRef_INTERFACE_DEFINED__ -#define __ID3D10SwitchToRef_INTERFACE_DEFINED__ - -/* interface ID3D10SwitchToRef */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10SwitchToRef; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("9B7E4E02-342C-4106-A19F-4F2704F689F0") - ID3D10SwitchToRef : public IUnknown - { - public: - virtual BOOL STDMETHODCALLTYPE SetUseRef( - BOOL UseRef) = 0; - - virtual BOOL STDMETHODCALLTYPE GetUseRef( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10SwitchToRefVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10SwitchToRef * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10SwitchToRef * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10SwitchToRef * This); - - BOOL ( STDMETHODCALLTYPE *SetUseRef )( - ID3D10SwitchToRef * This, - BOOL UseRef); - - BOOL ( STDMETHODCALLTYPE *GetUseRef )( - ID3D10SwitchToRef * This); - - END_INTERFACE - } ID3D10SwitchToRefVtbl; - - interface ID3D10SwitchToRef - { - CONST_VTBL struct ID3D10SwitchToRefVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10SwitchToRef_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10SwitchToRef_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10SwitchToRef_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10SwitchToRef_SetUseRef(This,UseRef) \ - ( (This)->lpVtbl -> SetUseRef(This,UseRef) ) - -#define ID3D10SwitchToRef_GetUseRef(This) \ - ( (This)->lpVtbl -> GetUseRef(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10SwitchToRef_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10sdklayers_0000_0002 */ -/* [local] */ - -DEFINE_GUID(DXGI_DEBUG_D3D10, 0x243b4c52, 0x3606, 0x4d3a, 0x99, 0xd7, 0xa7, 0xe7, 0xb3, 0x3e, 0xd7, 0x6); -#define D3D10_REGKEY_PATH __TEXT("Software\\Microsoft\\Direct3D") -#define D3D10_MUTE_DEBUG_OUTPUT __TEXT("MuteDebugOutput") -#define D3D10_ENABLE_BREAK_ON_MESSAGE __TEXT("EnableBreakOnMessage") -#define D3D10_INFOQUEUE_STORAGE_FILTER_OVERRIDE __TEXT("InfoQueueStorageFilterOverride") -#define D3D10_MUTE_CATEGORY __TEXT("Mute_CATEGORY_%s") -#define D3D10_MUTE_SEVERITY __TEXT("Mute_SEVERITY_%s") -#define D3D10_MUTE_ID_STRING __TEXT("Mute_ID_%s") -#define D3D10_MUTE_ID_DECIMAL __TEXT("Mute_ID_%d") -#define D3D10_UNMUTE_SEVERITY_INFO __TEXT("Unmute_SEVERITY_INFO") -#define D3D10_BREAKON_CATEGORY __TEXT("BreakOn_CATEGORY_%s") -#define D3D10_BREAKON_SEVERITY __TEXT("BreakOn_SEVERITY_%s") -#define D3D10_BREAKON_ID_STRING __TEXT("BreakOn_ID_%s") -#define D3D10_BREAKON_ID_DECIMAL __TEXT("BreakOn_ID_%d") -#define D3D10_APPSIZE_STRING __TEXT("Size") -#define D3D10_APPNAME_STRING __TEXT("Name") -typedef -enum D3D10_MESSAGE_CATEGORY - { - D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED = 0, - D3D10_MESSAGE_CATEGORY_MISCELLANEOUS = ( D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED + 1 ) , - D3D10_MESSAGE_CATEGORY_INITIALIZATION = ( D3D10_MESSAGE_CATEGORY_MISCELLANEOUS + 1 ) , - D3D10_MESSAGE_CATEGORY_CLEANUP = ( D3D10_MESSAGE_CATEGORY_INITIALIZATION + 1 ) , - D3D10_MESSAGE_CATEGORY_COMPILATION = ( D3D10_MESSAGE_CATEGORY_CLEANUP + 1 ) , - D3D10_MESSAGE_CATEGORY_STATE_CREATION = ( D3D10_MESSAGE_CATEGORY_COMPILATION + 1 ) , - D3D10_MESSAGE_CATEGORY_STATE_SETTING = ( D3D10_MESSAGE_CATEGORY_STATE_CREATION + 1 ) , - D3D10_MESSAGE_CATEGORY_STATE_GETTING = ( D3D10_MESSAGE_CATEGORY_STATE_SETTING + 1 ) , - D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = ( D3D10_MESSAGE_CATEGORY_STATE_GETTING + 1 ) , - D3D10_MESSAGE_CATEGORY_EXECUTION = ( D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION + 1 ) , - D3D10_MESSAGE_CATEGORY_SHADER = ( D3D10_MESSAGE_CATEGORY_EXECUTION + 1 ) - } D3D10_MESSAGE_CATEGORY; - -typedef -enum D3D10_MESSAGE_SEVERITY - { - D3D10_MESSAGE_SEVERITY_CORRUPTION = 0, - D3D10_MESSAGE_SEVERITY_ERROR = ( D3D10_MESSAGE_SEVERITY_CORRUPTION + 1 ) , - D3D10_MESSAGE_SEVERITY_WARNING = ( D3D10_MESSAGE_SEVERITY_ERROR + 1 ) , - D3D10_MESSAGE_SEVERITY_INFO = ( D3D10_MESSAGE_SEVERITY_WARNING + 1 ) , - D3D10_MESSAGE_SEVERITY_MESSAGE = ( D3D10_MESSAGE_SEVERITY_INFO + 1 ) - } D3D10_MESSAGE_SEVERITY; - -typedef -enum D3D10_MESSAGE_ID - { - D3D10_MESSAGE_ID_UNKNOWN = 0, - D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_UNKNOWN + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD = ( D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD + 1 ) , - D3D10_MESSAGE_ID_STRING_FROM_APPLICATION = ( D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_THIS = ( D3D10_MESSAGE_ID_STRING_FROM_APPLICATION + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 = ( D3D10_MESSAGE_ID_CORRUPTED_THIS + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 + 1 ) , - D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING = ( D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 + 1 ) , - D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING + 1 ) , - D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = ( D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT + 1 ) , - D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = ( D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA + 1 ) , - D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA + 1 ) , - D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN + 1 ) , - D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS + 1 ) , - D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC = ( D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = ( D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = ( D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT + 1 ) , - D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX + 1 ) , - D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE + 1 ) , - D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY + 1 ) , - D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = ( D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC + 1 ) , - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS + 1 ) , - D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY + 1 ) , - D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS + 1 ) , - D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = ( D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED + 1 ) , - D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE + 1 ) , - D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = ( D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED + 1 ) , - D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED + 1 ) , - D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER = ( D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = ( D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT + 1 ) , - D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR + 1 ) , - D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = ( D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH + 1 ) , - D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = ( D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = ( D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY + 1 ) , - D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = ( D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID + 1 ) , - D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX + 1 ) , - D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE + 1 ) , - D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = ( D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , - D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = ( D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE + 1 ) , - D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = ( D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID + 1 ) , - D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID + 1 ) , - D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE + 1 ) , - D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS + 1 ) , - D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED + 1 ) , - D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN + 1 ) , - D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN + 1 ) , - D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = ( D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = ( D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN + 1 ) , - D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = ( D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE + 1 ) , - D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = ( D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED + 1 ) , - D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = ( D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED + 1 ) , - D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = ( D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED + 1 ) , - D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS + 1 ) , - D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = ( D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN + 1 ) , - D3D10_MESSAGE_ID_REF_THREADING_MODE = ( D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE + 1 ) , - D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = ( D3D10_MESSAGE_ID_REF_THREADING_MODE + 1 ) , - D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = ( D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION + 1 ) , - D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION = ( D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION + 1 ) , - D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION + 1 ) , - D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = ( D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE + 1 ) , - D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY = ( D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER + 1 ) , - D3D10_MESSAGE_ID_REF_INFO = ( D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_REF_INFO + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = ( D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING + 1 ) , - D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 + 1 ) , - D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT + 1 ) , - D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT + 1 ) , - D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = ( D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT + 1 ) , - D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN + 1 ) , - D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = ( D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET + 1 ) , - D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = ( D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC + 1 ) , - D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH + 1 ) , - D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = ( D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY + 1 ) , - D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY + 1 ) , - D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER = ( D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = ( D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER + 1 ) , - D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED + 1 ) , - D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN = ( D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , - D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN = ( D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN + 1 ) , - D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC = ( D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN + 1 ) , - D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER = ( D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC + 1 ) , - D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = ( D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER + 1 ) , - D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE = ( D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER + 1 ) , - D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED = ( D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE + 1 ) , - D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION = ( D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE = ( D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION + 1 ) , - D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = ( D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE + 1 ) , - D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION = ( D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS + 1 ) , - D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS = ( D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION + 1 ) , - D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN = ( D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS + 1 ) , - D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE = ( D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN + 1 ) , - D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE + 1 ) , - D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = ( D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = ( D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = ( D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE + 1 ) , - D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT + 1 ) , - D3D10_MESSAGE_ID_LIVE_OBJECT_SUMMARY = ( D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH + 1 ) , - D3D10_MESSAGE_ID_LIVE_BUFFER = ( D3D10_MESSAGE_ID_LIVE_OBJECT_SUMMARY + 1 ) , - D3D10_MESSAGE_ID_LIVE_TEXTURE1D = ( D3D10_MESSAGE_ID_LIVE_BUFFER + 1 ) , - D3D10_MESSAGE_ID_LIVE_TEXTURE2D = ( D3D10_MESSAGE_ID_LIVE_TEXTURE1D + 1 ) , - D3D10_MESSAGE_ID_LIVE_TEXTURE3D = ( D3D10_MESSAGE_ID_LIVE_TEXTURE2D + 1 ) , - D3D10_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = ( D3D10_MESSAGE_ID_LIVE_TEXTURE3D + 1 ) , - D3D10_MESSAGE_ID_LIVE_RENDERTARGETVIEW = ( D3D10_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW + 1 ) , - D3D10_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = ( D3D10_MESSAGE_ID_LIVE_RENDERTARGETVIEW + 1 ) , - D3D10_MESSAGE_ID_LIVE_VERTEXSHADER = ( D3D10_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW + 1 ) , - D3D10_MESSAGE_ID_LIVE_GEOMETRYSHADER = ( D3D10_MESSAGE_ID_LIVE_VERTEXSHADER + 1 ) , - D3D10_MESSAGE_ID_LIVE_PIXELSHADER = ( D3D10_MESSAGE_ID_LIVE_GEOMETRYSHADER + 1 ) , - D3D10_MESSAGE_ID_LIVE_INPUTLAYOUT = ( D3D10_MESSAGE_ID_LIVE_PIXELSHADER + 1 ) , - D3D10_MESSAGE_ID_LIVE_SAMPLER = ( D3D10_MESSAGE_ID_LIVE_INPUTLAYOUT + 1 ) , - D3D10_MESSAGE_ID_LIVE_BLENDSTATE = ( D3D10_MESSAGE_ID_LIVE_SAMPLER + 1 ) , - D3D10_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = ( D3D10_MESSAGE_ID_LIVE_BLENDSTATE + 1 ) , - D3D10_MESSAGE_ID_LIVE_RASTERIZERSTATE = ( D3D10_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE + 1 ) , - D3D10_MESSAGE_ID_LIVE_QUERY = ( D3D10_MESSAGE_ID_LIVE_RASTERIZERSTATE + 1 ) , - D3D10_MESSAGE_ID_LIVE_PREDICATE = ( D3D10_MESSAGE_ID_LIVE_QUERY + 1 ) , - D3D10_MESSAGE_ID_LIVE_COUNTER = ( D3D10_MESSAGE_ID_LIVE_PREDICATE + 1 ) , - D3D10_MESSAGE_ID_LIVE_DEVICE = ( D3D10_MESSAGE_ID_LIVE_COUNTER + 1 ) , - D3D10_MESSAGE_ID_LIVE_SWAPCHAIN = ( D3D10_MESSAGE_ID_LIVE_DEVICE + 1 ) , - D3D10_MESSAGE_ID_D3D10_MESSAGES_END = ( D3D10_MESSAGE_ID_LIVE_SWAPCHAIN + 1 ) , - D3D10_MESSAGE_ID_D3D10L9_MESSAGES_START = 0x100000, - D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = ( D3D10_MESSAGE_ID_D3D10L9_MESSAGES_START + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY + 1 ) , - D3D10_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE + 1 ) , - D3D10_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS = ( D3D10_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS = ( D3D10_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = ( D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE + 1 ) , - D3D10_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = ( D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE + 1 ) , - D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS + 1 ) , - D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = ( D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX + 1 ) , - D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = ( D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = ( D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK = ( D3D10_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = ( D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK + 1 ) , - D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = ( D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = ( D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT + 1 ) , - D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE + 1 ) , - D3D10_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = ( D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = ( D3D10_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX + 1 ) , - D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = ( D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER = ( D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = ( D3D10_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = ( D3D10_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = ( D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = ( D3D10_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES + 1 ) , - D3D10_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED + 1 ) , - D3D10_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = ( D3D10_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND + 1 ) , - D3D10_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE = ( D3D10_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE + 1 ) , - D3D10_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = ( D3D10_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED = ( D3D10_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 + 1 ) , - D3D10_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = ( D3D10_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = ( D3D10_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = ( D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION + 1 ) , - D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = ( D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = ( D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR + 1 ) , - D3D10_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP = ( D3D10_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA + 1 ) , - D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = ( D3D10_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP + 1 ) , - D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT = ( D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED + 1 ) , - D3D10_MESSAGE_ID_COPYRESOURCE_NO_3D_MISMATCHED_UPDATES = ( D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT + 1 ) , - D3D10_MESSAGE_ID_D3D10L9_MESSAGES_END = ( D3D10_MESSAGE_ID_COPYRESOURCE_NO_3D_MISMATCHED_UPDATES + 1 ) - } D3D10_MESSAGE_ID; - -typedef struct D3D10_MESSAGE - { - D3D10_MESSAGE_CATEGORY Category; - D3D10_MESSAGE_SEVERITY Severity; - D3D10_MESSAGE_ID ID; - /* [annotation] */ - _Field_size_(DescriptionByteLength) const char *pDescription; - SIZE_T DescriptionByteLength; - } D3D10_MESSAGE; - -typedef struct D3D10_INFO_QUEUE_FILTER_DESC - { - UINT NumCategories; - /* [annotation] */ - _Field_size_(NumCategories) D3D10_MESSAGE_CATEGORY *pCategoryList; - UINT NumSeverities; - /* [annotation] */ - _Field_size_(NumSeverities) D3D10_MESSAGE_SEVERITY *pSeverityList; - UINT NumIDs; - /* [annotation] */ - _Field_size_(NumIDs) D3D10_MESSAGE_ID *pIDList; - } D3D10_INFO_QUEUE_FILTER_DESC; - -typedef struct D3D10_INFO_QUEUE_FILTER - { - D3D10_INFO_QUEUE_FILTER_DESC AllowList; - D3D10_INFO_QUEUE_FILTER_DESC DenyList; - } D3D10_INFO_QUEUE_FILTER; - -#define D3D10_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024 - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0002_v0_0_s_ifspec; - -#ifndef __ID3D10InfoQueue_INTERFACE_DEFINED__ -#define __ID3D10InfoQueue_INTERFACE_DEFINED__ - -/* interface ID3D10InfoQueue */ -/* [unique][local][object][uuid] */ - - -EXTERN_C const IID IID_ID3D10InfoQueue; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1b940b17-2642-4d1f-ab1f-b99bad0c395f") - ID3D10InfoQueue : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetMessageCountLimit( - /* [annotation] */ - _In_ UINT64 MessageCountLimit) = 0; - - virtual void STDMETHODCALLTYPE ClearStoredMessages( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMessage( - /* [annotation] */ - _In_ UINT64 MessageIndex, - /* [annotation] */ - _Out_writes_bytes_opt_(*pMessageByteLength) D3D10_MESSAGE *pMessage, - /* [annotation] */ - _Inout_ SIZE_T *pMessageByteLength) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetNumMessagesAllowedByStorageFilter( void) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDeniedByStorageFilter( void) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessages( void) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetNumStoredMessagesAllowedByRetrievalFilter( void) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetNumMessagesDiscardedByMessageCountLimit( void) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetMessageCountLimit( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddStorageFilterEntries( - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStorageFilter( - /* [annotation] */ - _Out_writes_bytes_opt_(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, - /* [annotation] */ - _Inout_ SIZE_T *pFilterByteLength) = 0; - - virtual void STDMETHODCALLTYPE ClearStorageFilter( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PushEmptyStorageFilter( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PushCopyOfStorageFilter( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PushStorageFilter( - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter) = 0; - - virtual void STDMETHODCALLTYPE PopStorageFilter( void) = 0; - - virtual UINT STDMETHODCALLTYPE GetStorageFilterStackSize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddRetrievalFilterEntries( - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRetrievalFilter( - /* [annotation] */ - _Out_writes_bytes_opt_(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, - /* [annotation] */ - _Inout_ SIZE_T *pFilterByteLength) = 0; - - virtual void STDMETHODCALLTYPE ClearRetrievalFilter( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PushEmptyRetrievalFilter( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PushCopyOfRetrievalFilter( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE PushRetrievalFilter( - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter) = 0; - - virtual void STDMETHODCALLTYPE PopRetrievalFilter( void) = 0; - - virtual UINT STDMETHODCALLTYPE GetRetrievalFilterStackSize( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddMessage( - /* [annotation] */ - _In_ D3D10_MESSAGE_CATEGORY Category, - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity, - /* [annotation] */ - _In_ D3D10_MESSAGE_ID ID, - /* [annotation] */ - _In_ LPCSTR pDescription) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddApplicationMessage( - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity, - /* [annotation] */ - _In_ LPCSTR pDescription) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBreakOnCategory( - /* [annotation] */ - _In_ D3D10_MESSAGE_CATEGORY Category, - /* [annotation] */ - _In_ BOOL bEnable) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBreakOnSeverity( - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity, - /* [annotation] */ - _In_ BOOL bEnable) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetBreakOnID( - /* [annotation] */ - _In_ D3D10_MESSAGE_ID ID, - /* [annotation] */ - _In_ BOOL bEnable) = 0; - - virtual BOOL STDMETHODCALLTYPE GetBreakOnCategory( - /* [annotation] */ - _In_ D3D10_MESSAGE_CATEGORY Category) = 0; - - virtual BOOL STDMETHODCALLTYPE GetBreakOnSeverity( - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity) = 0; - - virtual BOOL STDMETHODCALLTYPE GetBreakOnID( - /* [annotation] */ - _In_ D3D10_MESSAGE_ID ID) = 0; - - virtual void STDMETHODCALLTYPE SetMuteDebugOutput( - /* [annotation] */ - _In_ BOOL bMute) = 0; - - virtual BOOL STDMETHODCALLTYPE GetMuteDebugOutput( void) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ID3D10InfoQueueVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ID3D10InfoQueue * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ID3D10InfoQueue * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *SetMessageCountLimit )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ UINT64 MessageCountLimit); - - void ( STDMETHODCALLTYPE *ClearStoredMessages )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *GetMessage )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ UINT64 MessageIndex, - /* [annotation] */ - _Out_writes_bytes_opt_(*pMessageByteLength) D3D10_MESSAGE *pMessage, - /* [annotation] */ - _Inout_ SIZE_T *pMessageByteLength); - - UINT64 ( STDMETHODCALLTYPE *GetNumMessagesAllowedByStorageFilter )( - ID3D10InfoQueue * This); - - UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDeniedByStorageFilter )( - ID3D10InfoQueue * This); - - UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessages )( - ID3D10InfoQueue * This); - - UINT64 ( STDMETHODCALLTYPE *GetNumStoredMessagesAllowedByRetrievalFilter )( - ID3D10InfoQueue * This); - - UINT64 ( STDMETHODCALLTYPE *GetNumMessagesDiscardedByMessageCountLimit )( - ID3D10InfoQueue * This); - - UINT64 ( STDMETHODCALLTYPE *GetMessageCountLimit )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *AddStorageFilterEntries )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter); - - HRESULT ( STDMETHODCALLTYPE *GetStorageFilter )( - ID3D10InfoQueue * This, - /* [annotation] */ - _Out_writes_bytes_opt_(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, - /* [annotation] */ - _Inout_ SIZE_T *pFilterByteLength); - - void ( STDMETHODCALLTYPE *ClearStorageFilter )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *PushEmptyStorageFilter )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *PushCopyOfStorageFilter )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *PushStorageFilter )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter); - - void ( STDMETHODCALLTYPE *PopStorageFilter )( - ID3D10InfoQueue * This); - - UINT ( STDMETHODCALLTYPE *GetStorageFilterStackSize )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *AddRetrievalFilterEntries )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter); - - HRESULT ( STDMETHODCALLTYPE *GetRetrievalFilter )( - ID3D10InfoQueue * This, - /* [annotation] */ - _Out_writes_bytes_opt_(*pFilterByteLength) D3D10_INFO_QUEUE_FILTER *pFilter, - /* [annotation] */ - _Inout_ SIZE_T *pFilterByteLength); - - void ( STDMETHODCALLTYPE *ClearRetrievalFilter )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *PushEmptyRetrievalFilter )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *PushCopyOfRetrievalFilter )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *PushRetrievalFilter )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_INFO_QUEUE_FILTER *pFilter); - - void ( STDMETHODCALLTYPE *PopRetrievalFilter )( - ID3D10InfoQueue * This); - - UINT ( STDMETHODCALLTYPE *GetRetrievalFilterStackSize )( - ID3D10InfoQueue * This); - - HRESULT ( STDMETHODCALLTYPE *AddMessage )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_CATEGORY Category, - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity, - /* [annotation] */ - _In_ D3D10_MESSAGE_ID ID, - /* [annotation] */ - _In_ LPCSTR pDescription); - - HRESULT ( STDMETHODCALLTYPE *AddApplicationMessage )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity, - /* [annotation] */ - _In_ LPCSTR pDescription); - - HRESULT ( STDMETHODCALLTYPE *SetBreakOnCategory )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_CATEGORY Category, - /* [annotation] */ - _In_ BOOL bEnable); - - HRESULT ( STDMETHODCALLTYPE *SetBreakOnSeverity )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity, - /* [annotation] */ - _In_ BOOL bEnable); - - HRESULT ( STDMETHODCALLTYPE *SetBreakOnID )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_ID ID, - /* [annotation] */ - _In_ BOOL bEnable); - - BOOL ( STDMETHODCALLTYPE *GetBreakOnCategory )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_CATEGORY Category); - - BOOL ( STDMETHODCALLTYPE *GetBreakOnSeverity )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_SEVERITY Severity); - - BOOL ( STDMETHODCALLTYPE *GetBreakOnID )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ D3D10_MESSAGE_ID ID); - - void ( STDMETHODCALLTYPE *SetMuteDebugOutput )( - ID3D10InfoQueue * This, - /* [annotation] */ - _In_ BOOL bMute); - - BOOL ( STDMETHODCALLTYPE *GetMuteDebugOutput )( - ID3D10InfoQueue * This); - - END_INTERFACE - } ID3D10InfoQueueVtbl; - - interface ID3D10InfoQueue - { - CONST_VTBL struct ID3D10InfoQueueVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ID3D10InfoQueue_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ID3D10InfoQueue_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ID3D10InfoQueue_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ID3D10InfoQueue_SetMessageCountLimit(This,MessageCountLimit) \ - ( (This)->lpVtbl -> SetMessageCountLimit(This,MessageCountLimit) ) - -#define ID3D10InfoQueue_ClearStoredMessages(This) \ - ( (This)->lpVtbl -> ClearStoredMessages(This) ) - -#define ID3D10InfoQueue_GetMessage(This,MessageIndex,pMessage,pMessageByteLength) \ - ( (This)->lpVtbl -> GetMessage(This,MessageIndex,pMessage,pMessageByteLength) ) - -#define ID3D10InfoQueue_GetNumMessagesAllowedByStorageFilter(This) \ - ( (This)->lpVtbl -> GetNumMessagesAllowedByStorageFilter(This) ) - -#define ID3D10InfoQueue_GetNumMessagesDeniedByStorageFilter(This) \ - ( (This)->lpVtbl -> GetNumMessagesDeniedByStorageFilter(This) ) - -#define ID3D10InfoQueue_GetNumStoredMessages(This) \ - ( (This)->lpVtbl -> GetNumStoredMessages(This) ) - -#define ID3D10InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(This) \ - ( (This)->lpVtbl -> GetNumStoredMessagesAllowedByRetrievalFilter(This) ) - -#define ID3D10InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(This) \ - ( (This)->lpVtbl -> GetNumMessagesDiscardedByMessageCountLimit(This) ) - -#define ID3D10InfoQueue_GetMessageCountLimit(This) \ - ( (This)->lpVtbl -> GetMessageCountLimit(This) ) - -#define ID3D10InfoQueue_AddStorageFilterEntries(This,pFilter) \ - ( (This)->lpVtbl -> AddStorageFilterEntries(This,pFilter) ) - -#define ID3D10InfoQueue_GetStorageFilter(This,pFilter,pFilterByteLength) \ - ( (This)->lpVtbl -> GetStorageFilter(This,pFilter,pFilterByteLength) ) - -#define ID3D10InfoQueue_ClearStorageFilter(This) \ - ( (This)->lpVtbl -> ClearStorageFilter(This) ) - -#define ID3D10InfoQueue_PushEmptyStorageFilter(This) \ - ( (This)->lpVtbl -> PushEmptyStorageFilter(This) ) - -#define ID3D10InfoQueue_PushCopyOfStorageFilter(This) \ - ( (This)->lpVtbl -> PushCopyOfStorageFilter(This) ) - -#define ID3D10InfoQueue_PushStorageFilter(This,pFilter) \ - ( (This)->lpVtbl -> PushStorageFilter(This,pFilter) ) - -#define ID3D10InfoQueue_PopStorageFilter(This) \ - ( (This)->lpVtbl -> PopStorageFilter(This) ) - -#define ID3D10InfoQueue_GetStorageFilterStackSize(This) \ - ( (This)->lpVtbl -> GetStorageFilterStackSize(This) ) - -#define ID3D10InfoQueue_AddRetrievalFilterEntries(This,pFilter) \ - ( (This)->lpVtbl -> AddRetrievalFilterEntries(This,pFilter) ) - -#define ID3D10InfoQueue_GetRetrievalFilter(This,pFilter,pFilterByteLength) \ - ( (This)->lpVtbl -> GetRetrievalFilter(This,pFilter,pFilterByteLength) ) - -#define ID3D10InfoQueue_ClearRetrievalFilter(This) \ - ( (This)->lpVtbl -> ClearRetrievalFilter(This) ) - -#define ID3D10InfoQueue_PushEmptyRetrievalFilter(This) \ - ( (This)->lpVtbl -> PushEmptyRetrievalFilter(This) ) - -#define ID3D10InfoQueue_PushCopyOfRetrievalFilter(This) \ - ( (This)->lpVtbl -> PushCopyOfRetrievalFilter(This) ) - -#define ID3D10InfoQueue_PushRetrievalFilter(This,pFilter) \ - ( (This)->lpVtbl -> PushRetrievalFilter(This,pFilter) ) - -#define ID3D10InfoQueue_PopRetrievalFilter(This) \ - ( (This)->lpVtbl -> PopRetrievalFilter(This) ) - -#define ID3D10InfoQueue_GetRetrievalFilterStackSize(This) \ - ( (This)->lpVtbl -> GetRetrievalFilterStackSize(This) ) - -#define ID3D10InfoQueue_AddMessage(This,Category,Severity,ID,pDescription) \ - ( (This)->lpVtbl -> AddMessage(This,Category,Severity,ID,pDescription) ) - -#define ID3D10InfoQueue_AddApplicationMessage(This,Severity,pDescription) \ - ( (This)->lpVtbl -> AddApplicationMessage(This,Severity,pDescription) ) - -#define ID3D10InfoQueue_SetBreakOnCategory(This,Category,bEnable) \ - ( (This)->lpVtbl -> SetBreakOnCategory(This,Category,bEnable) ) - -#define ID3D10InfoQueue_SetBreakOnSeverity(This,Severity,bEnable) \ - ( (This)->lpVtbl -> SetBreakOnSeverity(This,Severity,bEnable) ) - -#define ID3D10InfoQueue_SetBreakOnID(This,ID,bEnable) \ - ( (This)->lpVtbl -> SetBreakOnID(This,ID,bEnable) ) - -#define ID3D10InfoQueue_GetBreakOnCategory(This,Category) \ - ( (This)->lpVtbl -> GetBreakOnCategory(This,Category) ) - -#define ID3D10InfoQueue_GetBreakOnSeverity(This,Severity) \ - ( (This)->lpVtbl -> GetBreakOnSeverity(This,Severity) ) - -#define ID3D10InfoQueue_GetBreakOnID(This,ID) \ - ( (This)->lpVtbl -> GetBreakOnID(This,ID) ) - -#define ID3D10InfoQueue_SetMuteDebugOutput(This,bMute) \ - ( (This)->lpVtbl -> SetMuteDebugOutput(This,bMute) ) - -#define ID3D10InfoQueue_GetMuteDebugOutput(This) \ - ( (This)->lpVtbl -> GetMuteDebugOutput(This) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ID3D10InfoQueue_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_d3d10sdklayers_0000_0003 */ -/* [local] */ - -DEFINE_GUID(IID_ID3D10Debug,0x9B7E4E01,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10SwitchToRef,0x9B7E4E02,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); -DEFINE_GUID(IID_ID3D10InfoQueue,0x1b940b17,0x2642,0x4d1f,0xab,0x1f,0xb9,0x9b,0xad,0x0c,0x39,0x5f); - - -extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0003_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d10sdklayers_0000_0003_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10shader.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10shader.h deleted file mode 100644 index 63b9da055f9..00000000000 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d10shader.h +++ /dev/null @@ -1,547 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// File: D3D10Shader.h -// Content: D3D10 Shader Types and APIs -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef __D3D10SHADER_H__ -#define __D3D10SHADER_H__ - - -#include "d3d10.h" - - - - -//--------------------------------------------------------------------------- -// D3D10_TX_VERSION: -// -------------- -// Version token used to create a procedural texture filler in effects -// Used by D3D10Fill[]TX functions -//--------------------------------------------------------------------------- -#define D3D10_TX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor)) - - -//---------------------------------------------------------------------------- -// D3D10SHADER flags: -// ----------------- -// D3D10_SHADER_DEBUG -// Insert debug file/line/type/symbol information. -// -// D3D10_SHADER_SKIP_VALIDATION -// Do not validate the generated code against known capabilities and -// constraints. This option is only recommended when compiling shaders -// you KNOW will work. (ie. have compiled before without this option.) -// Shaders are always validated by D3D before they are set to the device. -// -// D3D10_SHADER_SKIP_OPTIMIZATION -// Instructs the compiler to skip optimization steps during code generation. -// Unless you are trying to isolate a problem in your code using this option -// is not recommended. -// -// D3D10_SHADER_PACK_MATRIX_ROW_MAJOR -// Unless explicitly specified, matrices will be packed in row-major order -// on input and output from the shader. -// -// D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR -// Unless explicitly specified, matrices will be packed in column-major -// order on input and output from the shader. This is generally more -// efficient, since it allows vector-matrix multiplication to be performed -// using a series of dot-products. -// -// D3D10_SHADER_PARTIAL_PRECISION -// Force all computations in resulting shader to occur at partial precision. -// This may result in faster evaluation of shaders on some hardware. -// -// D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT -// Force compiler to compile against the next highest available software -// target for vertex shaders. This flag also turns optimizations off, -// and debugging on. -// -// D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT -// Force compiler to compile against the next highest available software -// target for pixel shaders. This flag also turns optimizations off, -// and debugging on. -// -// D3D10_SHADER_NO_PRESHADER -// Disables Preshaders. Using this flag will cause the compiler to not -// pull out static expression for evaluation on the host cpu -// -// D3D10_SHADER_AVOID_FLOW_CONTROL -// Hint compiler to avoid flow-control constructs where possible. -// -// D3D10_SHADER_PREFER_FLOW_CONTROL -// Hint compiler to prefer flow-control constructs where possible. -// -// D3D10_SHADER_ENABLE_STRICTNESS -// By default, the HLSL/Effect compilers are not strict on deprecated syntax. -// Specifying this flag enables the strict mode. Deprecated syntax may be -// removed in a future release, and enabling syntax is a good way to make sure -// your shaders comply to the latest spec. -// -// D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY -// This enables older shaders to compile to 4_0 targets. -// -//---------------------------------------------------------------------------- - -#define D3D10_SHADER_DEBUG (1 << 0) -#define D3D10_SHADER_SKIP_VALIDATION (1 << 1) -#define D3D10_SHADER_SKIP_OPTIMIZATION (1 << 2) -#define D3D10_SHADER_PACK_MATRIX_ROW_MAJOR (1 << 3) -#define D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR (1 << 4) -#define D3D10_SHADER_PARTIAL_PRECISION (1 << 5) -#define D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT (1 << 6) -#define D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT (1 << 7) -#define D3D10_SHADER_NO_PRESHADER (1 << 8) -#define D3D10_SHADER_AVOID_FLOW_CONTROL (1 << 9) -#define D3D10_SHADER_PREFER_FLOW_CONTROL (1 << 10) -#define D3D10_SHADER_ENABLE_STRICTNESS (1 << 11) -#define D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12) -#define D3D10_SHADER_IEEE_STRICTNESS (1 << 13) -#define D3D10_SHADER_WARNINGS_ARE_ERRORS (1 << 18) -#define D3D10_SHADER_RESOURCES_MAY_ALIAS (1 << 19) -#define D3D10_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES (1 << 20) -#define D3D10_ALL_RESOURCES_BOUND (1 << 21) - - -// optimization level flags -#define D3D10_SHADER_OPTIMIZATION_LEVEL0 (1 << 14) -#define D3D10_SHADER_OPTIMIZATION_LEVEL1 0 -#define D3D10_SHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15)) -#define D3D10_SHADER_OPTIMIZATION_LEVEL3 (1 << 15) - - - - -typedef D3D_SHADER_MACRO D3D10_SHADER_MACRO; -typedef D3D10_SHADER_MACRO* LPD3D10_SHADER_MACRO; - - -typedef D3D_SHADER_VARIABLE_CLASS D3D10_SHADER_VARIABLE_CLASS; -typedef D3D10_SHADER_VARIABLE_CLASS* LPD3D10_SHADER_VARIABLE_CLASS; - -typedef D3D_SHADER_VARIABLE_FLAGS D3D10_SHADER_VARIABLE_FLAGS; -typedef D3D10_SHADER_VARIABLE_FLAGS* LPD3D10_SHADER_VARIABLE_FLAGS; - -typedef D3D_SHADER_VARIABLE_TYPE D3D10_SHADER_VARIABLE_TYPE; -typedef D3D10_SHADER_VARIABLE_TYPE* LPD3D10_SHADER_VARIABLE_TYPE; - -typedef D3D_SHADER_INPUT_FLAGS D3D10_SHADER_INPUT_FLAGS; -typedef D3D10_SHADER_INPUT_FLAGS* LPD3D10_SHADER_INPUT_FLAGS; - -typedef D3D_SHADER_INPUT_TYPE D3D10_SHADER_INPUT_TYPE; -typedef D3D10_SHADER_INPUT_TYPE* LPD3D10_SHADER_INPUT_TYPE; - -typedef D3D_SHADER_CBUFFER_FLAGS D3D10_SHADER_CBUFFER_FLAGS; -typedef D3D10_SHADER_CBUFFER_FLAGS* LPD3D10_SHADER_CBUFFER_FLAGS; - -typedef D3D_CBUFFER_TYPE D3D10_CBUFFER_TYPE; -typedef D3D10_CBUFFER_TYPE* LPD3D10_CBUFFER_TYPE; - -typedef D3D_NAME D3D10_NAME; - -typedef D3D_RESOURCE_RETURN_TYPE D3D10_RESOURCE_RETURN_TYPE; - -typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE; - -typedef D3D_INCLUDE_TYPE D3D10_INCLUDE_TYPE; - -// ID3D10Include has been made version-neutral and moved to d3dcommon.h. -typedef interface ID3DInclude ID3D10Include; -typedef interface ID3DInclude* LPD3D10INCLUDE; -#define IID_ID3D10Include IID_ID3DInclude - - -//---------------------------------------------------------------------------- -// ID3D10ShaderReflection: -//---------------------------------------------------------------------------- - -// -// Structure definitions -// - -typedef struct _D3D10_SHADER_DESC -{ - UINT Version; // Shader version - LPCSTR Creator; // Creator string - UINT Flags; // Shader compilation/parse flags - - UINT ConstantBuffers; // Number of constant buffers - UINT BoundResources; // Number of bound resources - UINT InputParameters; // Number of parameters in the input signature - UINT OutputParameters; // Number of parameters in the output signature - - UINT InstructionCount; // Number of emitted instructions - UINT TempRegisterCount; // Number of temporary registers used - UINT TempArrayCount; // Number of temporary arrays used - UINT DefCount; // Number of constant defines - UINT DclCount; // Number of declarations (input + output) - UINT TextureNormalInstructions; // Number of non-categorized texture instructions - UINT TextureLoadInstructions; // Number of texture load instructions - UINT TextureCompInstructions; // Number of texture comparison instructions - UINT TextureBiasInstructions; // Number of texture bias instructions - UINT TextureGradientInstructions; // Number of texture gradient instructions - UINT FloatInstructionCount; // Number of floating point arithmetic instructions used - UINT IntInstructionCount; // Number of signed integer arithmetic instructions used - UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used - UINT StaticFlowControlCount; // Number of static flow control instructions used - UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used - UINT MacroInstructionCount; // Number of macro instructions used - UINT ArrayInstructionCount; // Number of array instructions used - UINT CutInstructionCount; // Number of cut instructions used - UINT EmitInstructionCount; // Number of emit instructions used - D3D10_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology - UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count -} D3D10_SHADER_DESC; - -typedef struct _D3D10_SHADER_BUFFER_DESC -{ - LPCSTR Name; // Name of the constant buffer - D3D10_CBUFFER_TYPE Type; // Indicates that this is a CBuffer or TBuffer - UINT Variables; // Number of member variables - UINT Size; // Size of CB (in bytes) - UINT uFlags; // Buffer description flags -} D3D10_SHADER_BUFFER_DESC; - -typedef struct _D3D10_SHADER_VARIABLE_DESC -{ - LPCSTR Name; // Name of the variable - UINT StartOffset; // Offset in constant buffer's backing store - UINT Size; // Size of variable (in bytes) - UINT uFlags; // Variable flags - LPVOID DefaultValue; // Raw pointer to default value -} D3D10_SHADER_VARIABLE_DESC; - -typedef struct _D3D10_SHADER_TYPE_DESC -{ - D3D10_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.) - D3D10_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.) - UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) - UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) - UINT Elements; // Number of elements (0 if not an array) - UINT Members; // Number of members (0 if not a structure) - UINT Offset; // Offset from the start of structure (0 if not a structure member) -} D3D10_SHADER_TYPE_DESC; - -typedef struct _D3D10_SHADER_INPUT_BIND_DESC -{ - LPCSTR Name; // Name of the resource - D3D10_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.) - UINT BindPoint; // Starting bind point - UINT BindCount; // Number of contiguous bind points (for arrays) - - UINT uFlags; // Input binding flags - D3D10_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture) - D3D10_SRV_DIMENSION Dimension; // Dimension (if texture) - UINT NumSamples; // Number of samples (0 if not MS texture) -} D3D10_SHADER_INPUT_BIND_DESC; - -typedef struct _D3D10_SIGNATURE_PARAMETER_DESC -{ - LPCSTR SemanticName; // Name of the semantic - UINT SemanticIndex; // Index of the semantic - UINT Register; // Number of member variables - D3D10_NAME SystemValueType;// A predefined system value, or D3D10_NAME_UNDEFINED if not applicable - D3D10_REGISTER_COMPONENT_TYPE ComponentType;// Scalar type (e.g. uint, float, etc.) - BYTE Mask; // Mask to indicate which components of the register - // are used (combination of D3D10_COMPONENT_MASK values) - BYTE ReadWriteMask; // Mask to indicate whether a given component is - // never written (if this is an output signature) or - // always read (if this is an input signature). - // (combination of D3D10_COMPONENT_MASK values) - -} D3D10_SIGNATURE_PARAMETER_DESC; - - -// -// Interface definitions -// - - - - -typedef interface ID3D10ShaderReflectionType ID3D10ShaderReflectionType; -typedef interface ID3D10ShaderReflectionType *LPD3D10SHADERREFLECTIONTYPE; - -// {C530AD7D-9B16-4395-A979-BA2ECFF83ADD} -interface DECLSPEC_UUID("C530AD7D-9B16-4395-A979-BA2ECFF83ADD") ID3D10ShaderReflectionType; -DEFINE_GUID(IID_ID3D10ShaderReflectionType, -0xc530ad7d, 0x9b16, 0x4395, 0xa9, 0x79, 0xba, 0x2e, 0xcf, 0xf8, 0x3a, 0xdd); - -#undef INTERFACE -#define INTERFACE ID3D10ShaderReflectionType - -DECLARE_INTERFACE(ID3D10ShaderReflectionType) -{ - STDMETHOD(GetDesc)(THIS_ D3D10_SHADER_TYPE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10ShaderReflectionType*, GetMemberTypeByName)(THIS_ LPCSTR Name) PURE; - STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ UINT Index) PURE; -}; - -typedef interface ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable; -typedef interface ID3D10ShaderReflectionVariable *LPD3D10SHADERREFLECTIONVARIABLE; - -// {1BF63C95-2650-405d-99C1-3636BD1DA0A1} -interface DECLSPEC_UUID("1BF63C95-2650-405d-99C1-3636BD1DA0A1") ID3D10ShaderReflectionVariable; -DEFINE_GUID(IID_ID3D10ShaderReflectionVariable, -0x1bf63c95, 0x2650, 0x405d, 0x99, 0xc1, 0x36, 0x36, 0xbd, 0x1d, 0xa0, 0xa1); - -#undef INTERFACE -#define INTERFACE ID3D10ShaderReflectionVariable - -DECLARE_INTERFACE(ID3D10ShaderReflectionVariable) -{ - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_VARIABLE_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10ShaderReflectionType*, GetType)(THIS) PURE; -}; - -typedef interface ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer; -typedef interface ID3D10ShaderReflectionConstantBuffer *LPD3D10SHADERREFLECTIONCONSTANTBUFFER; - -// {66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0} -interface DECLSPEC_UUID("66C66A94-DDDD-4b62-A66A-F0DA33C2B4D0") ID3D10ShaderReflectionConstantBuffer; -DEFINE_GUID(IID_ID3D10ShaderReflectionConstantBuffer, -0x66c66a94, 0xdddd, 0x4b62, 0xa6, 0x6a, 0xf0, 0xda, 0x33, 0xc2, 0xb4, 0xd0); - -#undef INTERFACE -#define INTERFACE ID3D10ShaderReflectionConstantBuffer - -DECLARE_INTERFACE(ID3D10ShaderReflectionConstantBuffer) -{ - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_BUFFER_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10ShaderReflectionVariable*, GetVariableByName)(THIS_ LPCSTR Name) PURE; -}; - -typedef interface ID3D10ShaderReflection ID3D10ShaderReflection; -typedef interface ID3D10ShaderReflection *LPD3D10SHADERREFLECTION; - -// {D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA} -interface DECLSPEC_UUID("D40E20B6-F8F7-42ad-AB20-4BAF8F15DFAA") ID3D10ShaderReflection; -DEFINE_GUID(IID_ID3D10ShaderReflection, -0xd40e20b6, 0xf8f7, 0x42ad, 0xab, 0x20, 0x4b, 0xaf, 0x8f, 0x15, 0xdf, 0xaa); - -#undef INTERFACE -#define INTERFACE ID3D10ShaderReflection - -DECLARE_INTERFACE_(ID3D10ShaderReflection, IUnknown) -{ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - STDMETHOD(GetDesc)(THIS_ _Out_ D3D10_SHADER_DESC *pDesc) PURE; - - STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ UINT Index) PURE; - STDMETHOD_(ID3D10ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ LPCSTR Name) PURE; - - STDMETHOD(GetResourceBindingDesc)(THIS_ UINT ResourceIndex, _Out_ D3D10_SHADER_INPUT_BIND_DESC *pDesc) PURE; - - STDMETHOD(GetInputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; - STDMETHOD(GetOutputParameterDesc)(THIS_ UINT ParameterIndex, _Out_ D3D10_SIGNATURE_PARAMETER_DESC *pDesc) PURE; - -}; - -////////////////////////////////////////////////////////////////////////////// -// APIs ////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -//---------------------------------------------------------------------------- -// D3D10CompileShader: -// ------------------ -// Compiles a shader. -// -// Parameters: -// pSrcFile -// Source file name. -// hSrcModule -// Module handle. if NULL, current module will be used. -// pSrcResource -// Resource name in module. -// pSrcData -// Pointer to source code. -// SrcDataSize -// Size of source code, in bytes. -// pDefines -// Optional NULL-terminated array of preprocessor macro definitions. -// pInclude -// Optional interface pointer to use for handling #include directives. -// If this parameter is NULL, #includes will be honored when compiling -// from file, and will error when compiling from resource or memory. -// pFunctionName -// Name of the entrypoint function where execution should begin. -// pProfile -// Instruction set to be used when generating code. The D3D10 entry -// point currently supports only "vs_4_0", "ps_4_0", and "gs_4_0". -// Flags -// See D3D10_SHADER_xxx flags. -// ppShader -// Returns a buffer containing the created shader. This buffer contains -// the compiled shader code, as well as any embedded debug and symbol -// table info. (See D3D10GetShaderConstantTable) -// ppErrorMsgs -// Returns a buffer containing a listing of errors and warnings that were -// encountered during the compile. If you are running in a debugger, -// these are the same messages you will see in your debug output. -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10CompileShader(_In_reads_bytes_(SrcDataSize) LPCSTR pSrcData, SIZE_T SrcDataSize, _In_opt_ LPCSTR pFileName, _In_opt_ CONST D3D10_SHADER_MACRO* pDefines, _In_opt_ LPD3D10INCLUDE pInclude, - LPCSTR pFunctionName, LPCSTR pProfile, UINT Flags, _Out_ ID3D10Blob** ppShader, _Out_opt_ ID3D10Blob** ppErrorMsgs); - -//---------------------------------------------------------------------------- -// D3D10DisassembleShader: -// ---------------------- -// Takes a binary shader, and returns a buffer containing text assembly. -// -// Parameters: -// pShader -// Pointer to the shader byte code. -// BytecodeLength -// Size of the shader byte code in bytes. -// EnableColorCode -// Emit HTML tags for color coding the output? -// pComments -// Pointer to a comment string to include at the top of the shader. -// ppDisassembly -// Returns a buffer containing the disassembled shader. -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10DisassembleShader(_In_reads_bytes_(BytecodeLength) CONST void *pShader, SIZE_T BytecodeLength, BOOL EnableColorCode, _In_opt_ LPCSTR pComments, _Out_ ID3D10Blob** ppDisassembly); - - -//---------------------------------------------------------------------------- -// D3D10GetPixelShaderProfile/D3D10GetVertexShaderProfile/D3D10GetGeometryShaderProfile: -// ----------------------------------------------------- -// Returns the name of the HLSL profile best suited to a given device. -// -// Parameters: -// pDevice -// Pointer to the device in question -//---------------------------------------------------------------------------- - -LPCSTR WINAPI D3D10GetPixelShaderProfile(_In_ ID3D10Device *pDevice); - -LPCSTR WINAPI D3D10GetVertexShaderProfile(_In_ ID3D10Device *pDevice); - -LPCSTR WINAPI D3D10GetGeometryShaderProfile(_In_ ID3D10Device *pDevice); - -//---------------------------------------------------------------------------- -// D3D10ReflectShader: -// ------------------ -// Creates a shader reflection object that can be used to retrieve information -// about a compiled shader -// -// Parameters: -// pShaderBytecode -// Pointer to a compiled shader (same pointer that is passed into -// ID3D10Device::CreateShader) -// BytecodeLength -// Length of the shader bytecode buffer -// ppReflector -// [out] Returns a ID3D10ShaderReflection object that can be used to -// retrieve shader resource and constant buffer information -// -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10ReflectShader(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10ShaderReflection **ppReflector); - -//---------------------------------------------------------------------------- -// D3D10PreprocessShader -// --------------------- -// Creates a shader reflection object that can be used to retrieve information -// about a compiled shader -// -// Parameters: -// pSrcData -// Pointer to source code -// SrcDataSize -// Size of source code, in bytes -// pFileName -// Source file name (used for error output) -// pDefines -// Optional NULL-terminated array of preprocessor macro definitions. -// pInclude -// Optional interface pointer to use for handling #include directives. -// If this parameter is NULL, #includes will be honored when assembling -// from file, and will error when assembling from resource or memory. -// ppShaderText -// Returns a buffer containing a single large string that represents -// the resulting formatted token stream -// ppErrorMsgs -// Returns a buffer containing a listing of errors and warnings that were -// encountered during assembly. If you are running in a debugger, -// these are the same messages you will see in your debug output. -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10PreprocessShader(_In_reads_bytes_(SrcDataSize) LPCSTR pSrcData, SIZE_T SrcDataSize, _In_opt_ LPCSTR pFileName, _In_opt_ CONST D3D10_SHADER_MACRO* pDefines, - _In_opt_ LPD3D10INCLUDE pInclude, _Out_ ID3D10Blob** ppShaderText, _Out_opt_ ID3D10Blob** ppErrorMsgs); - -////////////////////////////////////////////////////////////////////////// -// -// Shader blob manipulation routines -// --------------------------------- -// -// void *pShaderBytecode - a buffer containing the result of an HLSL -// compilation. Typically this opaque buffer contains several -// discrete sections including the shader executable code, the input -// signature, and the output signature. This can typically be retrieved -// by calling ID3D10Blob::GetBufferPointer() on the returned blob -// from HLSL's compile APIs. -// -// UINT BytecodeLength - the length of pShaderBytecode. This can -// typically be retrieved by calling ID3D10Blob::GetBufferSize() -// on the returned blob from HLSL's compile APIs. -// -// ID3D10Blob **ppSignatureBlob(s) - a newly created buffer that -// contains only the signature portions of the original bytecode. -// This is a copy; the original bytecode is not modified. You may -// specify NULL for this parameter to have the bytecode validated -// for the presence of the corresponding signatures without actually -// copying them and creating a new blob. -// -// Returns E_INVALIDARG if any required parameters are NULL -// Returns E_FAIL is the bytecode is corrupt or missing signatures -// Returns S_OK on success -// -////////////////////////////////////////////////////////////////////////// - -HRESULT WINAPI D3D10GetInputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob); -HRESULT WINAPI D3D10GetOutputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob); -HRESULT WINAPI D3D10GetInputAndOutputSignatureBlob(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob **ppSignatureBlob); - -//---------------------------------------------------------------------------- -// D3D10GetShaderDebugInfo: -// ----------------------- -// Gets shader debug info. Debug info is generated by D3D10CompileShader and is -// embedded in the body of the shader. -// -// Parameters: -// pShaderBytecode -// Pointer to the function bytecode -// BytecodeLength -// Length of the shader bytecode buffer -// ppDebugInfo -// Buffer used to return debug info. For information about the layout -// of this buffer, see definition of D3D10_SHADER_DEBUG_INFO above. -//---------------------------------------------------------------------------- - -HRESULT WINAPI D3D10GetShaderDebugInfo(_In_reads_bytes_(BytecodeLength) CONST void *pShaderBytecode, SIZE_T BytecodeLength, _Out_ ID3D10Blob** ppDebugInfo); - -#ifdef __cplusplus -} -#endif //__cplusplus - - -#endif //__D3D10SHADER_H__ - diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11.h index 65466a3814b..a1824e768f8 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -7306,7 +7306,9 @@ enum D3D11_FEATURE D3D11_FEATURE_D3D9_OPTIONS1 = ( D3D11_FEATURE_MARKER_SUPPORT + 1 ) , D3D11_FEATURE_D3D11_OPTIONS2 = ( D3D11_FEATURE_D3D9_OPTIONS1 + 1 ) , D3D11_FEATURE_D3D11_OPTIONS3 = ( D3D11_FEATURE_D3D11_OPTIONS2 + 1 ) , - D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = ( D3D11_FEATURE_D3D11_OPTIONS3 + 1 ) + D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = ( D3D11_FEATURE_D3D11_OPTIONS3 + 1 ) , + D3D11_FEATURE_D3D11_OPTIONS4 = ( D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT + 1 ) , + D3D11_FEATURE_SHADER_CACHE = ( D3D11_FEATURE_D3D11_OPTIONS4 + 1 ) } D3D11_FEATURE; typedef struct D3D11_FEATURE_DATA_THREADING @@ -7463,6 +7465,19 @@ typedef struct D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT UINT MaxGPUVirtualAddressBitsPerProcess; } D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT; +typedef +enum D3D11_SHADER_CACHE_SUPPORT_FLAGS + { + D3D11_SHADER_CACHE_SUPPORT_NONE = 0, + D3D11_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = 0x1, + D3D11_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = 0x2 + } D3D11_SHADER_CACHE_SUPPORT_FLAGS; + +typedef struct D3D11_FEATURE_DATA_SHADER_CACHE + { + UINT SupportFlags; + } D3D11_FEATURE_DATA_SHADER_CACHE; + extern RPC_IF_HANDLE __MIDL_itf_d3d11_0000_0029_v0_0_c_ifspec; @@ -9661,6 +9676,9 @@ DEFINE_GUID(D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_NOGMC, 0xed418a9f, 0x0 DEFINE_GUID(D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_GMC, 0xab998b5b, 0x4258,0x44a9,0x9f,0xeb,0x94,0xe5,0x97,0xa6,0xba,0xae); DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, 0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0); DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, 0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x67,0xa1,0x63,0x07,0x3d,0x13); +DEFINE_GUID(D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e); +DEFINE_GUID(D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2, 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7); +DEFINE_GUID(D3D11_DECODER_PROFILE_VP8_VLD, 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7); typedef struct D3D11_VIDEO_DECODER_DESC { GUID Guid; @@ -9929,7 +9947,8 @@ enum D3D11_VIDEO_PROCESSOR_FEATURE_CAPS D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = 0x80, D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = 0x100, D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = 0x200, - D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400 + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = 0x400, + D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 = 0x800 } D3D11_VIDEO_PROCESSOR_FEATURE_CAPS; typedef @@ -14381,11 +14400,11 @@ enum D3D11_CREATE_DEVICE_FLAG #if !defined( D3D11_IGNORE_SDK_LAYERS ) #include "d3d11sdklayers.h" #endif -#include "d3d10_1.h" -#include "d3d10shader.h" -#include "d3d10_1shader.h" -#include "d3d10misc.h" -#include "d3d10effect.h" +// BK - #include "d3d10_1.h" +// BK - #include "d3d10shader.h" +// BK - #include "d3d10_1shader.h" +// BK - #include "d3d10misc.h" +// BK - #include "d3d10effect.h" /////////////////////////////////////////////////////////////////////////// // D3D11CreateDevice diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_1.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_1.h index 5ad94f83b8b..3ea2744f3f0 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_1.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_1.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_2.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_2.h index c8dccdc7ca5..eb7a1bfefa4 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_2.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_2.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_3.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_3.h index 76922367dc4..e8cb8898f07 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_3.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_3.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -100,6 +100,20 @@ typedef interface ID3D11DeviceContext3 ID3D11DeviceContext3; #endif /* __ID3D11DeviceContext3_FWD_DEFINED__ */ +#ifndef __ID3D11Fence_FWD_DEFINED__ +#define __ID3D11Fence_FWD_DEFINED__ +typedef interface ID3D11Fence ID3D11Fence; + +#endif /* __ID3D11Fence_FWD_DEFINED__ */ + + +#ifndef __ID3D11DeviceContext4_FWD_DEFINED__ +#define __ID3D11DeviceContext4_FWD_DEFINED__ +typedef interface ID3D11DeviceContext4 ID3D11DeviceContext4; + +#endif /* __ID3D11DeviceContext4_FWD_DEFINED__ */ + + #ifndef __ID3D11Device3_FWD_DEFINED__ #define __ID3D11Device3_FWD_DEFINED__ typedef interface ID3D11Device3 ID3D11Device3; @@ -2105,6 +2119,23 @@ EXTERN_C const IID IID_ID3D11Query1; #endif /* __ID3D11Query1_INTERFACE_DEFINED__ */ +/* interface __MIDL_itf_d3d11_3_0000_0007 */ +/* [local] */ + +typedef +enum D3D11_FENCE_FLAG + { + D3D11_FENCE_FLAG_NONE = 0x1, + D3D11_FENCE_FLAG_SHARED = 0x2, + D3D11_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x4 + } D3D11_FENCE_FLAG; + +DEFINE_ENUM_FLAG_OPERATORS(D3D11_FENCE_FLAG); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_3_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_3_0000_0007_v0_0_s_ifspec; + #ifndef __ID3D11DeviceContext3_INTERFACE_DEFINED__ #define __ID3D11DeviceContext3_INTERFACE_DEFINED__ @@ -3906,6 +3937,1988 @@ EXTERN_C const IID IID_ID3D11DeviceContext3; #endif /* __ID3D11DeviceContext3_INTERFACE_DEFINED__ */ +#ifndef __ID3D11Fence_INTERFACE_DEFINED__ +#define __ID3D11Fence_INTERFACE_DEFINED__ + +/* interface ID3D11Fence */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Fence; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("affde9d1-1df7-4bb7-8a34-0f46251dab80") + ID3D11Fence : public ID3D11DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateSharedHandle( + /* [annotation] */ + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + /* [annotation] */ + _In_ DWORD dwAccess, + /* [annotation] */ + _In_opt_ LPCWSTR lpName, + /* [annotation] */ + _Out_ HANDLE *pHandle) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetCompletedValue( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetEventOnCompletion( + /* [annotation] */ + _In_ UINT64 Value, + /* [annotation] */ + _In_ HANDLE hEvent) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D11FenceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Fence * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Fence * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Fence * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11Fence * This, + /* [annotation] */ + _Outptr_ ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Fence * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _Inout_ UINT *pDataSize, + /* [annotation] */ + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Fence * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Fence * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D11Fence * This, + /* [annotation] */ + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + /* [annotation] */ + _In_ DWORD dwAccess, + /* [annotation] */ + _In_opt_ LPCWSTR lpName, + /* [annotation] */ + _Out_ HANDLE *pHandle); + + UINT64 ( STDMETHODCALLTYPE *GetCompletedValue )( + ID3D11Fence * This); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnCompletion )( + ID3D11Fence * This, + /* [annotation] */ + _In_ UINT64 Value, + /* [annotation] */ + _In_ HANDLE hEvent); + + END_INTERFACE + } ID3D11FenceVtbl; + + interface ID3D11Fence + { + CONST_VTBL struct ID3D11FenceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Fence_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Fence_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Fence_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Fence_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11Fence_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Fence_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Fence_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11Fence_CreateSharedHandle(This,pAttributes,dwAccess,lpName,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pAttributes,dwAccess,lpName,pHandle) ) + +#define ID3D11Fence_GetCompletedValue(This) \ + ( (This)->lpVtbl -> GetCompletedValue(This) ) + +#define ID3D11Fence_SetEventOnCompletion(This,Value,hEvent) \ + ( (This)->lpVtbl -> SetEventOnCompletion(This,Value,hEvent) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Fence_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11DeviceContext4_INTERFACE_DEFINED__ +#define __ID3D11DeviceContext4_INTERFACE_DEFINED__ + +/* interface ID3D11DeviceContext4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11DeviceContext4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("917600da-f58c-4c33-98d8-3e15b390fa24") + ID3D11DeviceContext4 : public ID3D11DeviceContext3 + { + public: + virtual HRESULT STDMETHODCALLTYPE Signal( + /* [annotation] */ + _In_ ID3D11Fence *pFence, + /* [annotation] */ + _In_ UINT64 Value) = 0; + + virtual HRESULT STDMETHODCALLTYPE Wait( + /* [annotation] */ + _In_ ID3D11Fence *pFence, + /* [annotation] */ + _In_ UINT64 Value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D11DeviceContext4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11DeviceContext4 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11DeviceContext4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11DeviceContext4 * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_ ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _Inout_ UINT *pDataSize, + /* [annotation] */ + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_opt_ const IUnknown *pData); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSSetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSSetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11PixelShader *pPixelShader, + /* [annotation] */ + _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *PSSetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _In_reads_opt_(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *VSSetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11VertexShader *pVertexShader, + /* [annotation] */ + _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *DrawIndexed )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ UINT IndexCount, + /* [annotation] */ + _In_ UINT StartIndexLocation, + /* [annotation] */ + _In_ INT BaseVertexLocation); + + void ( STDMETHODCALLTYPE *Draw )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ UINT VertexCount, + /* [annotation] */ + _In_ UINT StartVertexLocation); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_ UINT Subresource, + /* [annotation] */ + _In_ D3D11_MAP MapType, + /* [annotation] */ + _In_ UINT MapFlags, + /* [annotation] */ + _Out_opt_ D3D11_MAPPED_SUBRESOURCE *pMappedResource); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_ UINT Subresource); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IASetInputLayout )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11InputLayout *pInputLayout); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppVertexBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pStrides, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11Buffer *pIndexBuffer, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _In_ UINT Offset); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ UINT IndexCountPerInstance, + /* [annotation] */ + _In_ UINT InstanceCount, + /* [annotation] */ + _In_ UINT StartIndexLocation, + /* [annotation] */ + _In_ INT BaseVertexLocation, + /* [annotation] */ + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ UINT VertexCountPerInstance, + /* [annotation] */ + _In_ UINT InstanceCount, + /* [annotation] */ + _In_ UINT StartVertexLocation, + /* [annotation] */ + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSSetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11GeometryShader *pShader, + /* [annotation] */ + _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ D3D11_PRIMITIVE_TOPOLOGY Topology); + + void ( STDMETHODCALLTYPE *VSSetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSSetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _In_reads_opt_(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *Begin )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Asynchronous *pAsync); + + void ( STDMETHODCALLTYPE *End )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Asynchronous *pAsync); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Asynchronous *pAsync, + /* [annotation] */ + _Out_writes_bytes_opt_( DataSize ) void *pData, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_ UINT GetDataFlags); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11Predicate *pPredicate, + /* [annotation] */ + _In_ BOOL PredicateValue); + + void ( STDMETHODCALLTYPE *GSSetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSSetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _In_reads_opt_(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + _In_opt_ ID3D11DepthStencilView *pDepthStencilView); + + void ( STDMETHODCALLTYPE *OMSetRenderTargetsAndUnorderedAccessViews )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ UINT NumRTVs, + /* [annotation] */ + _In_reads_opt_(NumRTVs) ID3D11RenderTargetView *const *ppRenderTargetViews, + /* [annotation] */ + _In_opt_ ID3D11DepthStencilView *pDepthStencilView, + /* [annotation] */ + _In_range_( 0, D3D11_1_UAV_SLOT_COUNT - 1 ) UINT UAVStartSlot, + /* [annotation] */ + _In_ UINT NumUAVs, + /* [annotation] */ + _In_reads_opt_(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + /* [annotation] */ + _In_reads_opt_(NumUAVs) const UINT *pUAVInitialCounts); + + void ( STDMETHODCALLTYPE *OMSetBlendState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11BlendState *pBlendState, + /* [annotation] */ + _In_opt_ const FLOAT BlendFactor[ 4 ], + /* [annotation] */ + _In_ UINT SampleMask); + + void ( STDMETHODCALLTYPE *OMSetDepthStencilState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11DepthStencilState *pDepthStencilState, + /* [annotation] */ + _In_ UINT StencilRef); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_SO_BUFFER_SLOT_COUNT) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppSOTargets, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pOffsets); + + void ( STDMETHODCALLTYPE *DrawAuto )( + ID3D11DeviceContext4 * This); + + void ( STDMETHODCALLTYPE *DrawIndexedInstancedIndirect )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + _In_ UINT AlignedByteOffsetForArgs); + + void ( STDMETHODCALLTYPE *DrawInstancedIndirect )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + _In_ UINT AlignedByteOffsetForArgs); + + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ UINT ThreadGroupCountX, + /* [annotation] */ + _In_ UINT ThreadGroupCountY, + /* [annotation] */ + _In_ UINT ThreadGroupCountZ); + + void ( STDMETHODCALLTYPE *DispatchIndirect )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Buffer *pBufferForArgs, + /* [annotation] */ + _In_ UINT AlignedByteOffsetForArgs); + + void ( STDMETHODCALLTYPE *RSSetState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11RasterizerState *pRasterizerState); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + /* [annotation] */ + _In_reads_opt_(NumViewports) const D3D11_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + /* [annotation] */ + _In_reads_opt_(NumRects) const D3D11_RECT *pRects); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_ UINT DstX, + /* [annotation] */ + _In_ UINT DstY, + /* [annotation] */ + _In_ UINT DstZ, + /* [annotation] */ + _In_ ID3D11Resource *pSrcResource, + /* [annotation] */ + _In_ UINT SrcSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ ID3D11Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *UpdateSubresource )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pDstBox, + /* [annotation] */ + _In_ const void *pSrcData, + /* [annotation] */ + _In_ UINT SrcRowPitch, + /* [annotation] */ + _In_ UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *CopyStructureCount )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Buffer *pDstBuffer, + /* [annotation] */ + _In_ UINT DstAlignedByteOffset, + /* [annotation] */ + _In_ ID3D11UnorderedAccessView *pSrcView); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11RenderTargetView *pRenderTargetView, + /* [annotation] */ + _In_ const FLOAT ColorRGBA[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11UnorderedAccessView *pUnorderedAccessView, + /* [annotation] */ + _In_ const UINT Values[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11UnorderedAccessView *pUnorderedAccessView, + /* [annotation] */ + _In_ const FLOAT Values[ 4 ]); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11DepthStencilView *pDepthStencilView, + /* [annotation] */ + _In_ UINT ClearFlags, + /* [annotation] */ + _In_ FLOAT Depth, + /* [annotation] */ + _In_ UINT8 Stencil); + + void ( STDMETHODCALLTYPE *GenerateMips )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11ShaderResourceView *pShaderResourceView); + + void ( STDMETHODCALLTYPE *SetResourceMinLOD )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + FLOAT MinLOD); + + FLOAT ( STDMETHODCALLTYPE *GetResourceMinLOD )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_ ID3D11Resource *pSrcResource, + /* [annotation] */ + _In_ UINT SrcSubresource, + /* [annotation] */ + _In_ DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *ExecuteCommandList )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11CommandList *pCommandList, + BOOL RestoreContextState); + + void ( STDMETHODCALLTYPE *HSSetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *HSSetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11HullShader *pHullShader, + /* [annotation] */ + _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *HSSetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _In_reads_opt_(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *HSSetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *DSSetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *DSSetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11DomainShader *pDomainShader, + /* [annotation] */ + _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *DSSetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _In_reads_opt_(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *DSSetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *CSSetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _In_reads_opt_(NumViews) ID3D11ShaderResourceView *const *ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *CSSetUnorderedAccessViews )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_1_UAV_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_1_UAV_SLOT_COUNT - StartSlot ) UINT NumUAVs, + /* [annotation] */ + _In_reads_opt_(NumUAVs) ID3D11UnorderedAccessView *const *ppUnorderedAccessViews, + /* [annotation] */ + _In_reads_opt_(NumUAVs) const UINT *pUAVInitialCounts); + + void ( STDMETHODCALLTYPE *CSSetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11ComputeShader *pComputeShader, + /* [annotation] */ + _In_reads_opt_(NumClassInstances) ID3D11ClassInstance *const *ppClassInstances, + UINT NumClassInstances); + + void ( STDMETHODCALLTYPE *CSSetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _In_reads_opt_(NumSamplers) ID3D11SamplerState *const *ppSamplers); + + void ( STDMETHODCALLTYPE *CSSetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *PSGetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *PSGetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11PixelShader **ppPixelShader, + /* [annotation] */ + _Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + _Inout_opt_ UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *PSGetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _Out_writes_opt_(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *VSGetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11VertexShader **ppVertexShader, + /* [annotation] */ + _Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + _Inout_opt_ UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *IAGetInputLayout )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11InputLayout **ppInputLayout); + + void ( STDMETHODCALLTYPE *IAGetVertexBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppVertexBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pStrides, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pOffsets); + + void ( STDMETHODCALLTYPE *IAGetIndexBuffer )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_opt_result_maybenull_ ID3D11Buffer **pIndexBuffer, + /* [annotation] */ + _Out_opt_ DXGI_FORMAT *Format, + /* [annotation] */ + _Out_opt_ UINT *Offset); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *GSGetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11GeometryShader **ppGeometryShader, + /* [annotation] */ + _Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + _Inout_opt_ UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *IAGetPrimitiveTopology )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Out_ D3D11_PRIMITIVE_TOPOLOGY *pTopology); + + void ( STDMETHODCALLTYPE *VSGetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *VSGetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _Out_writes_opt_(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *GetPredication )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_opt_result_maybenull_ ID3D11Predicate **ppPredicate, + /* [annotation] */ + _Out_opt_ BOOL *pPredicateValue); + + void ( STDMETHODCALLTYPE *GSGetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *GSGetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _Out_writes_opt_(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *OMGetRenderTargets )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + _Outptr_opt_result_maybenull_ ID3D11DepthStencilView **ppDepthStencilView); + + void ( STDMETHODCALLTYPE *OMGetRenderTargetsAndUnorderedAccessViews )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT ) UINT NumRTVs, + /* [annotation] */ + _Out_writes_opt_(NumRTVs) ID3D11RenderTargetView **ppRenderTargetViews, + /* [annotation] */ + _Outptr_opt_result_maybenull_ ID3D11DepthStencilView **ppDepthStencilView, + /* [annotation] */ + _In_range_( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 ) UINT UAVStartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot ) UINT NumUAVs, + /* [annotation] */ + _Out_writes_opt_(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews); + + void ( STDMETHODCALLTYPE *OMGetBlendState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_opt_result_maybenull_ ID3D11BlendState **ppBlendState, + /* [annotation] */ + _Out_opt_ FLOAT BlendFactor[ 4 ], + /* [annotation] */ + _Out_opt_ UINT *pSampleMask); + + void ( STDMETHODCALLTYPE *OMGetDepthStencilState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_opt_result_maybenull_ ID3D11DepthStencilState **ppDepthStencilState, + /* [annotation] */ + _Out_opt_ UINT *pStencilRef); + + void ( STDMETHODCALLTYPE *SOGetTargets )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppSOTargets); + + void ( STDMETHODCALLTYPE *RSGetState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11RasterizerState **ppRasterizerState); + + void ( STDMETHODCALLTYPE *RSGetViewports )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Inout_ /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *pNumViewports, + /* [annotation] */ + _Out_writes_opt_(*pNumViewports) D3D11_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSGetScissorRects )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Inout_ /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/ UINT *pNumRects, + /* [annotation] */ + _Out_writes_opt_(*pNumRects) D3D11_RECT *pRects); + + void ( STDMETHODCALLTYPE *HSGetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *HSGetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11HullShader **ppHullShader, + /* [annotation] */ + _Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + _Inout_opt_ UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *HSGetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _Out_writes_opt_(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *HSGetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *DSGetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *DSGetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11DomainShader **ppDomainShader, + /* [annotation] */ + _Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + _Inout_opt_ UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *DSGetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _Out_writes_opt_(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *DSGetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *CSGetShaderResources )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot ) UINT NumViews, + /* [annotation] */ + _Out_writes_opt_(NumViews) ID3D11ShaderResourceView **ppShaderResourceViews); + + void ( STDMETHODCALLTYPE *CSGetUnorderedAccessViews )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_1_UAV_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_1_UAV_SLOT_COUNT - StartSlot ) UINT NumUAVs, + /* [annotation] */ + _Out_writes_opt_(NumUAVs) ID3D11UnorderedAccessView **ppUnorderedAccessViews); + + void ( STDMETHODCALLTYPE *CSGetShader )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Outptr_result_maybenull_ ID3D11ComputeShader **ppComputeShader, + /* [annotation] */ + _Out_writes_opt_(*pNumClassInstances) ID3D11ClassInstance **ppClassInstances, + /* [annotation] */ + _Inout_opt_ UINT *pNumClassInstances); + + void ( STDMETHODCALLTYPE *CSGetSamplers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot ) UINT NumSamplers, + /* [annotation] */ + _Out_writes_opt_(NumSamplers) ID3D11SamplerState **ppSamplers); + + void ( STDMETHODCALLTYPE *CSGetConstantBuffers )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D11DeviceContext4 * This); + + void ( STDMETHODCALLTYPE *Flush )( + ID3D11DeviceContext4 * This); + + D3D11_DEVICE_CONTEXT_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D11DeviceContext4 * This); + + UINT ( STDMETHODCALLTYPE *GetContextFlags )( + ID3D11DeviceContext4 * This); + + HRESULT ( STDMETHODCALLTYPE *FinishCommandList )( + ID3D11DeviceContext4 * This, + BOOL RestoreDeferredContextState, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11CommandList **ppCommandList); + + void ( STDMETHODCALLTYPE *CopySubresourceRegion1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_ UINT DstX, + /* [annotation] */ + _In_ UINT DstY, + /* [annotation] */ + _In_ UINT DstZ, + /* [annotation] */ + _In_ ID3D11Resource *pSrcResource, + /* [annotation] */ + _In_ UINT SrcSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pSrcBox, + /* [annotation] */ + _In_ UINT CopyFlags); + + void ( STDMETHODCALLTYPE *UpdateSubresource1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pDstBox, + /* [annotation] */ + _In_ const void *pSrcData, + /* [annotation] */ + _In_ UINT SrcRowPitch, + /* [annotation] */ + _In_ UINT SrcDepthPitch, + /* [annotation] */ + _In_ UINT CopyFlags); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource); + + void ( STDMETHODCALLTYPE *DiscardView )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11View *pResourceView); + + void ( STDMETHODCALLTYPE *VSSetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pFirstConstant, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *HSSetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pFirstConstant, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *DSSetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pFirstConstant, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *GSSetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pFirstConstant, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *PSSetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pFirstConstant, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *CSSetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) ID3D11Buffer *const *ppConstantBuffers, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pFirstConstant, + /* [annotation] */ + _In_reads_opt_(NumBuffers) const UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *VSGetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pFirstConstant, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *HSGetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pFirstConstant, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *DSGetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pFirstConstant, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *GSGetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pFirstConstant, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *PSGetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pFirstConstant, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *CSGetConstantBuffers1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 ) UINT StartSlot, + /* [annotation] */ + _In_range_( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot ) UINT NumBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) ID3D11Buffer **ppConstantBuffers, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pFirstConstant, + /* [annotation] */ + _Out_writes_opt_(NumBuffers) UINT *pNumConstants); + + void ( STDMETHODCALLTYPE *SwapDeviceContextState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3DDeviceContextState *pState, + /* [annotation] */ + _Outptr_opt_ ID3DDeviceContextState **ppPreviousState); + + void ( STDMETHODCALLTYPE *ClearView )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11View *pView, + /* [annotation] */ + _In_ const FLOAT Color[ 4 ], + /* [annotation] */ + _In_reads_opt_(NumRects) const D3D11_RECT *pRect, + UINT NumRects); + + void ( STDMETHODCALLTYPE *DiscardView1 )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11View *pResourceView, + /* [annotation] */ + _In_reads_opt_(NumRects) const D3D11_RECT *pRects, + UINT NumRects); + + HRESULT ( STDMETHODCALLTYPE *UpdateTileMappings )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pTiledResource, + /* [annotation] */ + _In_ UINT NumTiledResourceRegions, + /* [annotation] */ + _In_reads_opt_(NumTiledResourceRegions) const D3D11_TILED_RESOURCE_COORDINATE *pTiledResourceRegionStartCoordinates, + /* [annotation] */ + _In_reads_opt_(NumTiledResourceRegions) const D3D11_TILE_REGION_SIZE *pTiledResourceRegionSizes, + /* [annotation] */ + _In_opt_ ID3D11Buffer *pTilePool, + /* [annotation] */ + _In_ UINT NumRanges, + /* [annotation] */ + _In_reads_opt_(NumRanges) const UINT *pRangeFlags, + /* [annotation] */ + _In_reads_opt_(NumRanges) const UINT *pTilePoolStartOffsets, + /* [annotation] */ + _In_reads_opt_(NumRanges) const UINT *pRangeTileCounts, + /* [annotation] */ + _In_ UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *CopyTileMappings )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDestTiledResource, + /* [annotation] */ + _In_ const D3D11_TILED_RESOURCE_COORDINATE *pDestRegionStartCoordinate, + /* [annotation] */ + _In_ ID3D11Resource *pSourceTiledResource, + /* [annotation] */ + _In_ const D3D11_TILED_RESOURCE_COORDINATE *pSourceRegionStartCoordinate, + /* [annotation] */ + _In_ const D3D11_TILE_REGION_SIZE *pTileRegionSize, + /* [annotation] */ + _In_ UINT Flags); + + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pTiledResource, + /* [annotation] */ + _In_ const D3D11_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + /* [annotation] */ + _In_ const D3D11_TILE_REGION_SIZE *pTileRegionSize, + /* [annotation] */ + _In_ ID3D11Buffer *pBuffer, + /* [annotation] */ + _In_ UINT64 BufferStartOffsetInBytes, + /* [annotation] */ + _In_ UINT Flags); + + void ( STDMETHODCALLTYPE *UpdateTiles )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDestTiledResource, + /* [annotation] */ + _In_ const D3D11_TILED_RESOURCE_COORDINATE *pDestTileRegionStartCoordinate, + /* [annotation] */ + _In_ const D3D11_TILE_REGION_SIZE *pDestTileRegionSize, + /* [annotation] */ + _In_ const void *pSourceTileData, + /* [annotation] */ + _In_ UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *ResizeTilePool )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Buffer *pTilePool, + /* [annotation] */ + _In_ UINT64 NewSizeInBytes); + + void ( STDMETHODCALLTYPE *TiledResourceBarrier )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_opt_ ID3D11DeviceChild *pTiledResourceOrViewAccessBeforeBarrier, + /* [annotation] */ + _In_opt_ ID3D11DeviceChild *pTiledResourceOrViewAccessAfterBarrier); + + BOOL ( STDMETHODCALLTYPE *IsAnnotationEnabled )( + ID3D11DeviceContext4 * This); + + void ( STDMETHODCALLTYPE *SetMarkerInt )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ LPCWSTR pLabel, + INT Data); + + void ( STDMETHODCALLTYPE *BeginEventInt )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ LPCWSTR pLabel, + INT Data); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D11DeviceContext4 * This); + + void ( STDMETHODCALLTYPE *Flush1 )( + ID3D11DeviceContext4 * This, + D3D11_CONTEXT_TYPE ContextType, + /* [annotation] */ + _In_opt_ HANDLE hEvent); + + void ( STDMETHODCALLTYPE *SetHardwareProtectionState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ BOOL HwProtectionEnable); + + void ( STDMETHODCALLTYPE *GetHardwareProtectionState )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _Out_ BOOL *pHwProtectionEnable); + + HRESULT ( STDMETHODCALLTYPE *Signal )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Fence *pFence, + /* [annotation] */ + _In_ UINT64 Value); + + HRESULT ( STDMETHODCALLTYPE *Wait )( + ID3D11DeviceContext4 * This, + /* [annotation] */ + _In_ ID3D11Fence *pFence, + /* [annotation] */ + _In_ UINT64 Value); + + END_INTERFACE + } ID3D11DeviceContext4Vtbl; + + interface ID3D11DeviceContext4 + { + CONST_VTBL struct ID3D11DeviceContext4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11DeviceContext4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11DeviceContext4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11DeviceContext4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11DeviceContext4_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11DeviceContext4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11DeviceContext4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11DeviceContext4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11DeviceContext4_VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_PSSetShader(This,pPixelShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> PSSetShader(This,pPixelShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext4_PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_VSSetShader(This,pVertexShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> VSSetShader(This,pVertexShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext4_DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) \ + ( (This)->lpVtbl -> DrawIndexed(This,IndexCount,StartIndexLocation,BaseVertexLocation) ) + +#define ID3D11DeviceContext4_Draw(This,VertexCount,StartVertexLocation) \ + ( (This)->lpVtbl -> Draw(This,VertexCount,StartVertexLocation) ) + +#define ID3D11DeviceContext4_Map(This,pResource,Subresource,MapType,MapFlags,pMappedResource) \ + ( (This)->lpVtbl -> Map(This,pResource,Subresource,MapType,MapFlags,pMappedResource) ) + +#define ID3D11DeviceContext4_Unmap(This,pResource,Subresource) \ + ( (This)->lpVtbl -> Unmap(This,pResource,Subresource) ) + +#define ID3D11DeviceContext4_PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_IASetInputLayout(This,pInputLayout) \ + ( (This)->lpVtbl -> IASetInputLayout(This,pInputLayout) ) + +#define ID3D11DeviceContext4_IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D11DeviceContext4_IASetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D11DeviceContext4_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D11DeviceContext4_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D11DeviceContext4_GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_GSSetShader(This,pShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> GSSetShader(This,pShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext4_IASetPrimitiveTopology(This,Topology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,Topology) ) + +#define ID3D11DeviceContext4_VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_Begin(This,pAsync) \ + ( (This)->lpVtbl -> Begin(This,pAsync) ) + +#define ID3D11DeviceContext4_End(This,pAsync) \ + ( (This)->lpVtbl -> End(This,pAsync) ) + +#define ID3D11DeviceContext4_GetData(This,pAsync,pData,DataSize,GetDataFlags) \ + ( (This)->lpVtbl -> GetData(This,pAsync,pData,DataSize,GetDataFlags) ) + +#define ID3D11DeviceContext4_SetPredication(This,pPredicate,PredicateValue) \ + ( (This)->lpVtbl -> SetPredication(This,pPredicate,PredicateValue) ) + +#define ID3D11DeviceContext4_GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumViews,ppRenderTargetViews,pDepthStencilView) ) + +#define ID3D11DeviceContext4_OMSetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,pDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) \ + ( (This)->lpVtbl -> OMSetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,pDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) ) + +#define ID3D11DeviceContext4_OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) \ + ( (This)->lpVtbl -> OMSetBlendState(This,pBlendState,BlendFactor,SampleMask) ) + +#define ID3D11DeviceContext4_OMSetDepthStencilState(This,pDepthStencilState,StencilRef) \ + ( (This)->lpVtbl -> OMSetDepthStencilState(This,pDepthStencilState,StencilRef) ) + +#define ID3D11DeviceContext4_SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) \ + ( (This)->lpVtbl -> SOSetTargets(This,NumBuffers,ppSOTargets,pOffsets) ) + +#define ID3D11DeviceContext4_DrawAuto(This) \ + ( (This)->lpVtbl -> DrawAuto(This) ) + +#define ID3D11DeviceContext4_DrawIndexedInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) \ + ( (This)->lpVtbl -> DrawIndexedInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) ) + +#define ID3D11DeviceContext4_DrawInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) \ + ( (This)->lpVtbl -> DrawInstancedIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) ) + +#define ID3D11DeviceContext4_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D11DeviceContext4_DispatchIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) \ + ( (This)->lpVtbl -> DispatchIndirect(This,pBufferForArgs,AlignedByteOffsetForArgs) ) + +#define ID3D11DeviceContext4_RSSetState(This,pRasterizerState) \ + ( (This)->lpVtbl -> RSSetState(This,pRasterizerState) ) + +#define ID3D11DeviceContext4_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D11DeviceContext4_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D11DeviceContext4_CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> CopySubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox) ) + +#define ID3D11DeviceContext4_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D11DeviceContext4_UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> UpdateSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D11DeviceContext4_CopyStructureCount(This,pDstBuffer,DstAlignedByteOffset,pSrcView) \ + ( (This)->lpVtbl -> CopyStructureCount(This,pDstBuffer,DstAlignedByteOffset,pSrcView) ) + +#define ID3D11DeviceContext4_ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,pRenderTargetView,ColorRGBA) ) + +#define ID3D11DeviceContext4_ClearUnorderedAccessViewUint(This,pUnorderedAccessView,Values) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,pUnorderedAccessView,Values) ) + +#define ID3D11DeviceContext4_ClearUnorderedAccessViewFloat(This,pUnorderedAccessView,Values) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,pUnorderedAccessView,Values) ) + +#define ID3D11DeviceContext4_ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,pDepthStencilView,ClearFlags,Depth,Stencil) ) + +#define ID3D11DeviceContext4_GenerateMips(This,pShaderResourceView) \ + ( (This)->lpVtbl -> GenerateMips(This,pShaderResourceView) ) + +#define ID3D11DeviceContext4_SetResourceMinLOD(This,pResource,MinLOD) \ + ( (This)->lpVtbl -> SetResourceMinLOD(This,pResource,MinLOD) ) + +#define ID3D11DeviceContext4_GetResourceMinLOD(This,pResource) \ + ( (This)->lpVtbl -> GetResourceMinLOD(This,pResource) ) + +#define ID3D11DeviceContext4_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D11DeviceContext4_ExecuteCommandList(This,pCommandList,RestoreContextState) \ + ( (This)->lpVtbl -> ExecuteCommandList(This,pCommandList,RestoreContextState) ) + +#define ID3D11DeviceContext4_HSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> HSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_HSSetShader(This,pHullShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> HSSetShader(This,pHullShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext4_HSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> HSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_HSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> HSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_DSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> DSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_DSSetShader(This,pDomainShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> DSSetShader(This,pDomainShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext4_DSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> DSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_DSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> DSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_CSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> CSSetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_CSSetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) \ + ( (This)->lpVtbl -> CSSetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews,pUAVInitialCounts) ) + +#define ID3D11DeviceContext4_CSSetShader(This,pComputeShader,ppClassInstances,NumClassInstances) \ + ( (This)->lpVtbl -> CSSetShader(This,pComputeShader,ppClassInstances,NumClassInstances) ) + +#define ID3D11DeviceContext4_CSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> CSSetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_CSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> CSSetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> VSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> PSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_PSGetShader(This,ppPixelShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> PSGetShader(This,ppPixelShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext4_PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> PSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_VSGetShader(This,ppVertexShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> VSGetShader(This,ppVertexShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext4_PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> PSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_IAGetInputLayout(This,ppInputLayout) \ + ( (This)->lpVtbl -> IAGetInputLayout(This,ppInputLayout) ) + +#define ID3D11DeviceContext4_IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) \ + ( (This)->lpVtbl -> IAGetVertexBuffers(This,StartSlot,NumBuffers,ppVertexBuffers,pStrides,pOffsets) ) + +#define ID3D11DeviceContext4_IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) \ + ( (This)->lpVtbl -> IAGetIndexBuffer(This,pIndexBuffer,Format,Offset) ) + +#define ID3D11DeviceContext4_GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> GSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_GSGetShader(This,ppGeometryShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> GSGetShader(This,ppGeometryShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext4_IAGetPrimitiveTopology(This,pTopology) \ + ( (This)->lpVtbl -> IAGetPrimitiveTopology(This,pTopology) ) + +#define ID3D11DeviceContext4_VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> VSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> VSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_GetPredication(This,ppPredicate,pPredicateValue) \ + ( (This)->lpVtbl -> GetPredication(This,ppPredicate,pPredicateValue) ) + +#define ID3D11DeviceContext4_GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> GSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> GSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) \ + ( (This)->lpVtbl -> OMGetRenderTargets(This,NumViews,ppRenderTargetViews,ppDepthStencilView) ) + +#define ID3D11DeviceContext4_OMGetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,ppDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews) \ + ( (This)->lpVtbl -> OMGetRenderTargetsAndUnorderedAccessViews(This,NumRTVs,ppRenderTargetViews,ppDepthStencilView,UAVStartSlot,NumUAVs,ppUnorderedAccessViews) ) + +#define ID3D11DeviceContext4_OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) \ + ( (This)->lpVtbl -> OMGetBlendState(This,ppBlendState,BlendFactor,pSampleMask) ) + +#define ID3D11DeviceContext4_OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) \ + ( (This)->lpVtbl -> OMGetDepthStencilState(This,ppDepthStencilState,pStencilRef) ) + +#define ID3D11DeviceContext4_SOGetTargets(This,NumBuffers,ppSOTargets) \ + ( (This)->lpVtbl -> SOGetTargets(This,NumBuffers,ppSOTargets) ) + +#define ID3D11DeviceContext4_RSGetState(This,ppRasterizerState) \ + ( (This)->lpVtbl -> RSGetState(This,ppRasterizerState) ) + +#define ID3D11DeviceContext4_RSGetViewports(This,pNumViewports,pViewports) \ + ( (This)->lpVtbl -> RSGetViewports(This,pNumViewports,pViewports) ) + +#define ID3D11DeviceContext4_RSGetScissorRects(This,pNumRects,pRects) \ + ( (This)->lpVtbl -> RSGetScissorRects(This,pNumRects,pRects) ) + +#define ID3D11DeviceContext4_HSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> HSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_HSGetShader(This,ppHullShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> HSGetShader(This,ppHullShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext4_HSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> HSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_HSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> HSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_DSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> DSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_DSGetShader(This,ppDomainShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> DSGetShader(This,ppDomainShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext4_DSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> DSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_DSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> DSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_CSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) \ + ( (This)->lpVtbl -> CSGetShaderResources(This,StartSlot,NumViews,ppShaderResourceViews) ) + +#define ID3D11DeviceContext4_CSGetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews) \ + ( (This)->lpVtbl -> CSGetUnorderedAccessViews(This,StartSlot,NumUAVs,ppUnorderedAccessViews) ) + +#define ID3D11DeviceContext4_CSGetShader(This,ppComputeShader,ppClassInstances,pNumClassInstances) \ + ( (This)->lpVtbl -> CSGetShader(This,ppComputeShader,ppClassInstances,pNumClassInstances) ) + +#define ID3D11DeviceContext4_CSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) \ + ( (This)->lpVtbl -> CSGetSamplers(This,StartSlot,NumSamplers,ppSamplers) ) + +#define ID3D11DeviceContext4_CSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) \ + ( (This)->lpVtbl -> CSGetConstantBuffers(This,StartSlot,NumBuffers,ppConstantBuffers) ) + +#define ID3D11DeviceContext4_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D11DeviceContext4_Flush(This) \ + ( (This)->lpVtbl -> Flush(This) ) + +#define ID3D11DeviceContext4_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + +#define ID3D11DeviceContext4_GetContextFlags(This) \ + ( (This)->lpVtbl -> GetContextFlags(This) ) + +#define ID3D11DeviceContext4_FinishCommandList(This,RestoreDeferredContextState,ppCommandList) \ + ( (This)->lpVtbl -> FinishCommandList(This,RestoreDeferredContextState,ppCommandList) ) + + +#define ID3D11DeviceContext4_CopySubresourceRegion1(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox,CopyFlags) \ + ( (This)->lpVtbl -> CopySubresourceRegion1(This,pDstResource,DstSubresource,DstX,DstY,DstZ,pSrcResource,SrcSubresource,pSrcBox,CopyFlags) ) + +#define ID3D11DeviceContext4_UpdateSubresource1(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch,CopyFlags) \ + ( (This)->lpVtbl -> UpdateSubresource1(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch,CopyFlags) ) + +#define ID3D11DeviceContext4_DiscardResource(This,pResource) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource) ) + +#define ID3D11DeviceContext4_DiscardView(This,pResourceView) \ + ( (This)->lpVtbl -> DiscardView(This,pResourceView) ) + +#define ID3D11DeviceContext4_VSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> VSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_HSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> HSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_DSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> DSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_GSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> GSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_PSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> PSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_CSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> CSSetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_VSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> VSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_HSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> HSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_DSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> DSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_GSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> GSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_PSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> PSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_CSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) \ + ( (This)->lpVtbl -> CSGetConstantBuffers1(This,StartSlot,NumBuffers,ppConstantBuffers,pFirstConstant,pNumConstants) ) + +#define ID3D11DeviceContext4_SwapDeviceContextState(This,pState,ppPreviousState) \ + ( (This)->lpVtbl -> SwapDeviceContextState(This,pState,ppPreviousState) ) + +#define ID3D11DeviceContext4_ClearView(This,pView,Color,pRect,NumRects) \ + ( (This)->lpVtbl -> ClearView(This,pView,Color,pRect,NumRects) ) + +#define ID3D11DeviceContext4_DiscardView1(This,pResourceView,pRects,NumRects) \ + ( (This)->lpVtbl -> DiscardView1(This,pResourceView,pRects,NumRects) ) + + +#define ID3D11DeviceContext4_UpdateTileMappings(This,pTiledResource,NumTiledResourceRegions,pTiledResourceRegionStartCoordinates,pTiledResourceRegionSizes,pTilePool,NumRanges,pRangeFlags,pTilePoolStartOffsets,pRangeTileCounts,Flags) \ + ( (This)->lpVtbl -> UpdateTileMappings(This,pTiledResource,NumTiledResourceRegions,pTiledResourceRegionStartCoordinates,pTiledResourceRegionSizes,pTilePool,NumRanges,pRangeFlags,pTilePoolStartOffsets,pRangeTileCounts,Flags) ) + +#define ID3D11DeviceContext4_CopyTileMappings(This,pDestTiledResource,pDestRegionStartCoordinate,pSourceTiledResource,pSourceRegionStartCoordinate,pTileRegionSize,Flags) \ + ( (This)->lpVtbl -> CopyTileMappings(This,pDestTiledResource,pDestRegionStartCoordinate,pSourceTiledResource,pSourceRegionStartCoordinate,pTileRegionSize,Flags) ) + +#define ID3D11DeviceContext4_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D11DeviceContext4_UpdateTiles(This,pDestTiledResource,pDestTileRegionStartCoordinate,pDestTileRegionSize,pSourceTileData,Flags) \ + ( (This)->lpVtbl -> UpdateTiles(This,pDestTiledResource,pDestTileRegionStartCoordinate,pDestTileRegionSize,pSourceTileData,Flags) ) + +#define ID3D11DeviceContext4_ResizeTilePool(This,pTilePool,NewSizeInBytes) \ + ( (This)->lpVtbl -> ResizeTilePool(This,pTilePool,NewSizeInBytes) ) + +#define ID3D11DeviceContext4_TiledResourceBarrier(This,pTiledResourceOrViewAccessBeforeBarrier,pTiledResourceOrViewAccessAfterBarrier) \ + ( (This)->lpVtbl -> TiledResourceBarrier(This,pTiledResourceOrViewAccessBeforeBarrier,pTiledResourceOrViewAccessAfterBarrier) ) + +#define ID3D11DeviceContext4_IsAnnotationEnabled(This) \ + ( (This)->lpVtbl -> IsAnnotationEnabled(This) ) + +#define ID3D11DeviceContext4_SetMarkerInt(This,pLabel,Data) \ + ( (This)->lpVtbl -> SetMarkerInt(This,pLabel,Data) ) + +#define ID3D11DeviceContext4_BeginEventInt(This,pLabel,Data) \ + ( (This)->lpVtbl -> BeginEventInt(This,pLabel,Data) ) + +#define ID3D11DeviceContext4_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + + +#define ID3D11DeviceContext4_Flush1(This,ContextType,hEvent) \ + ( (This)->lpVtbl -> Flush1(This,ContextType,hEvent) ) + +#define ID3D11DeviceContext4_SetHardwareProtectionState(This,HwProtectionEnable) \ + ( (This)->lpVtbl -> SetHardwareProtectionState(This,HwProtectionEnable) ) + +#define ID3D11DeviceContext4_GetHardwareProtectionState(This,pHwProtectionEnable) \ + ( (This)->lpVtbl -> GetHardwareProtectionState(This,pHwProtectionEnable) ) + + +#define ID3D11DeviceContext4_Signal(This,pFence,Value) \ + ( (This)->lpVtbl -> Signal(This,pFence,Value) ) + +#define ID3D11DeviceContext4_Wait(This,pFence,Value) \ + ( (This)->lpVtbl -> Wait(This,pFence,Value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11DeviceContext4_INTERFACE_DEFINED__ */ + + #ifndef __ID3D11Device3_INTERFACE_DEFINED__ #define __ID3D11Device3_INTERFACE_DEFINED__ @@ -4787,7 +6800,7 @@ EXTERN_C const IID IID_ID3D11Device3; #endif /* __ID3D11Device3_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_d3d11_3_0000_0009 */ +/* interface __MIDL_itf_d3d11_3_0000_0011 */ /* [local] */ DEFINE_GUID(IID_ID3D11Texture2D1,0x51218251,0x1E33,0x4617,0x9C,0xCB,0x4D,0x3A,0x43,0x67,0xE7,0xBB); @@ -4798,11 +6811,13 @@ DEFINE_GUID(IID_ID3D11RenderTargetView1,0xffbe2e23,0xf011,0x418a,0xac,0x56,0x5c, DEFINE_GUID(IID_ID3D11UnorderedAccessView1,0x7b3b6153,0xa886,0x4544,0xab,0x37,0x65,0x37,0xc8,0x50,0x04,0x03); DEFINE_GUID(IID_ID3D11Query1,0x631b4766,0x36dc,0x461d,0x8d,0xb6,0xc4,0x7e,0x13,0xe6,0x09,0x16); DEFINE_GUID(IID_ID3D11DeviceContext3,0xb4e3c01d,0xe79e,0x4637,0x91,0xb2,0x51,0x0e,0x9f,0x4c,0x9b,0x8f); +DEFINE_GUID(IID_ID3D11Fence,0xaffde9d1,0x1df7,0x4bb7,0x8a,0x34,0x0f,0x46,0x25,0x1d,0xab,0x80); +DEFINE_GUID(IID_ID3D11DeviceContext4,0x917600da,0xf58c,0x4c33,0x98,0xd8,0x3e,0x15,0xb3,0x90,0xfa,0x24); DEFINE_GUID(IID_ID3D11Device3,0xA05C8C37,0xD2C6,0x4732,0xB3,0xA0,0x9C,0xE0,0xB0,0xDC,0x9A,0xE6); -extern RPC_IF_HANDLE __MIDL_itf_d3d11_3_0000_0009_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d11_3_0000_0009_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_3_0000_0011_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_3_0000_0011_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_4.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_4.h new file mode 100644 index 00000000000..9664ecd314b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11_4.h @@ -0,0 +1,3093 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* @@MIDL_FILE_HEADING( ) */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d11_4_h__ +#define __d3d11_4_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D11Device4_FWD_DEFINED__ +#define __ID3D11Device4_FWD_DEFINED__ +typedef interface ID3D11Device4 ID3D11Device4; + +#endif /* __ID3D11Device4_FWD_DEFINED__ */ + + +#ifndef __ID3D11Device5_FWD_DEFINED__ +#define __ID3D11Device5_FWD_DEFINED__ +typedef interface ID3D11Device5 ID3D11Device5; + +#endif /* __ID3D11Device5_FWD_DEFINED__ */ + + +#ifndef __ID3D11Multithread_FWD_DEFINED__ +#define __ID3D11Multithread_FWD_DEFINED__ +typedef interface ID3D11Multithread ID3D11Multithread; + +#endif /* __ID3D11Multithread_FWD_DEFINED__ */ + + +#ifndef __ID3D11VideoContext2_FWD_DEFINED__ +#define __ID3D11VideoContext2_FWD_DEFINED__ +typedef interface ID3D11VideoContext2 ID3D11VideoContext2; + +#endif /* __ID3D11VideoContext2_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgi1_5.h" +#include "d3dcommon.h" +#include "d3d11_3.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d11_4_0000_0000 */ +/* [local] */ + +#ifdef __cplusplus +} +#endif +#include "d3d11_3.h" // +#ifdef __cplusplus +extern "C"{ +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_4_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_4_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D11Device4_INTERFACE_DEFINED__ +#define __ID3D11Device4_INTERFACE_DEFINED__ + +/* interface ID3D11Device4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Device4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8992ab71-02e6-4b8d-ba48-b056dcda42c4") + ID3D11Device4 : public ID3D11Device3 + { + public: + virtual HRESULT STDMETHODCALLTYPE RegisterDeviceRemovedEvent( + /* [annotation] */ + _In_ HANDLE hEvent, + /* [annotation] */ + _Out_ DWORD *pdwCookie) = 0; + + virtual void STDMETHODCALLTYPE UnregisterDeviceRemoved( + /* [annotation] */ + _In_ DWORD dwCookie) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D11Device4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Device4 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Device4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Device4 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_BUFFER_DESC *pDesc, + /* [annotation] */ + _In_opt_ const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11UnorderedAccessView **ppUAView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + _In_range_( 0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_reads_opt_(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + _In_range_( 0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT ) UINT NumEntries, + /* [annotation] */ + _In_reads_opt_(NumStrides) const UINT *pBufferStrides, + /* [annotation] */ + _In_range_( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumStrides, + /* [annotation] */ + _In_ UINT RasterizedStream, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateHullShader )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11HullShader **ppHullShader); + + HRESULT ( STDMETHODCALLTYPE *CreateDomainShader )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DomainShader **ppDomainShader); + + HRESULT ( STDMETHODCALLTYPE *CreateComputeShader )( + ID3D11Device4 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11ComputeShader **ppComputeShader); + + HRESULT ( STDMETHODCALLTYPE *CreateClassLinkage )( + ID3D11Device4 * This, + /* [annotation] */ + _COM_Outptr_ ID3D11ClassLinkage **ppLinkage); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_QUERY_DESC *pQueryDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext )( + ID3D11Device4 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext **ppDeferredContext); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _In_ REFIID ReturnedInterface, + /* [annotation] */ + _COM_Outptr_opt_ void **ppResource); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _Out_ UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _In_ UINT SampleCount, + /* [annotation] */ + _Out_ UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D11Device4 * This, + /* [annotation] */ + _Out_ D3D11_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_COUNTER_DESC *pDesc, + /* [annotation] */ + _Out_ D3D11_COUNTER_TYPE *pType, + /* [annotation] */ + _Out_ UINT *pActiveCounters, + /* [annotation] */ + _Out_writes_opt_(*pNameLength) LPSTR szName, + /* [annotation] */ + _Inout_opt_ UINT *pNameLength, + /* [annotation] */ + _Out_writes_opt_(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + _Inout_opt_ UINT *pUnitsLength, + /* [annotation] */ + _Out_writes_opt_(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + _Inout_opt_ UINT *pDescriptionLength); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D11Device4 * This, + D3D11_FEATURE Feature, + /* [annotation] */ + _Out_writes_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _Inout_ UINT *pDataSize, + /* [annotation] */ + _Out_writes_bytes_opt_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_reads_bytes_opt_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_opt_ const IUnknown *pData); + + D3D_FEATURE_LEVEL ( STDMETHODCALLTYPE *GetFeatureLevel )( + ID3D11Device4 * This); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D11Device4 * This); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D11Device4 * This); + + void ( STDMETHODCALLTYPE *GetImmediateContext )( + ID3D11Device4 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D11Device4 * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D11Device4 * This); + + void ( STDMETHODCALLTYPE *GetImmediateContext1 )( + ID3D11Device4 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext1 **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext1 )( + ID3D11Device4 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext1 **ppDeferredContext); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_BLEND_DESC1 *pBlendStateDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11BlendState1 **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_RASTERIZER_DESC1 *pRasterizerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RasterizerState1 **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateDeviceContextState )( + ID3D11Device4 * This, + UINT Flags, + /* [annotation] */ + _In_reads_( FeatureLevels ) const D3D_FEATURE_LEVEL *pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + REFIID EmulatedInterface, + /* [annotation] */ + _Out_opt_ D3D_FEATURE_LEVEL *pChosenFeatureLevel, + /* [annotation] */ + _Out_opt_ ID3DDeviceContextState **ppContextState); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _In_ REFIID returnedInterface, + /* [annotation] */ + _COM_Outptr_ void **ppResource); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResourceByName )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ LPCWSTR lpName, + /* [annotation] */ + _In_ DWORD dwDesiredAccess, + /* [annotation] */ + _In_ REFIID returnedInterface, + /* [annotation] */ + _COM_Outptr_ void **ppResource); + + void ( STDMETHODCALLTYPE *GetImmediateContext2 )( + ID3D11Device4 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext2 **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext2 )( + ID3D11Device4 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext2 **ppDeferredContext); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pTiledResource, + /* [annotation] */ + _Out_opt_ UINT *pNumTilesForEntireResource, + /* [annotation] */ + _Out_opt_ D3D11_PACKED_MIP_DESC *pPackedMipDesc, + /* [annotation] */ + _Out_opt_ D3D11_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + /* [annotation] */ + _Inout_opt_ UINT *pNumSubresourceTilings, + /* [annotation] */ + _In_ UINT FirstSubresourceTilingToGet, + /* [annotation] */ + _Out_writes_(*pNumSubresourceTilings) D3D11_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _In_ UINT SampleCount, + /* [annotation] */ + _In_ UINT Flags, + /* [annotation] */ + _Out_ UINT *pNumQualityLevels); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE2D_DESC1 *pDesc1, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc1->MipLevels * pDesc1->ArraySize)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture2D1 **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE3D_DESC1 *pDesc1, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc1->MipLevels)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture3D1 **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState2 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_RASTERIZER_DESC2 *pRasterizerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RasterizerState2 **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_SHADER_RESOURCE_VIEW_DESC1 *pDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11ShaderResourceView1 **ppSRView1); + + HRESULT ( STDMETHODCALLTYPE *CreateUnorderedAccessView1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_UNORDERED_ACCESS_VIEW_DESC1 *pDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11UnorderedAccessView1 **ppUAView1); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_RENDER_TARGET_VIEW_DESC1 *pDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RenderTargetView1 **ppRTView1); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery1 )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ const D3D11_QUERY_DESC1 *pQueryDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Query1 **ppQuery1); + + void ( STDMETHODCALLTYPE *GetImmediateContext3 )( + ID3D11Device4 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext3 **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext3 )( + ID3D11Device4 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext3 **ppDeferredContext); + + void ( STDMETHODCALLTYPE *WriteToSubresource )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pDstBox, + /* [annotation] */ + _In_ const void *pSrcData, + /* [annotation] */ + _In_ UINT SrcRowPitch, + /* [annotation] */ + _In_ UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *ReadFromSubresource )( + ID3D11Device4 * This, + /* [annotation] */ + _Out_ void *pDstData, + /* [annotation] */ + _In_ UINT DstRowPitch, + /* [annotation] */ + _In_ UINT DstDepthPitch, + /* [annotation] */ + _In_ ID3D11Resource *pSrcResource, + /* [annotation] */ + _In_ UINT SrcSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pSrcBox); + + HRESULT ( STDMETHODCALLTYPE *RegisterDeviceRemovedEvent )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ HANDLE hEvent, + /* [annotation] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterDeviceRemoved )( + ID3D11Device4 * This, + /* [annotation] */ + _In_ DWORD dwCookie); + + END_INTERFACE + } ID3D11Device4Vtbl; + + interface ID3D11Device4 + { + CONST_VTBL struct ID3D11Device4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Device4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Device4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Device4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Device4_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D11Device4_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D11Device4_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D11Device4_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D11Device4_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D11Device4_CreateUnorderedAccessView(This,pResource,pDesc,ppUAView) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pDesc,ppUAView) ) + +#define ID3D11Device4_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D11Device4_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D11Device4_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D11Device4_CreateVertexShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppVertexShader) ) + +#define ID3D11Device4_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppGeometryShader) ) + +#define ID3D11Device4_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,pBufferStrides,NumStrides,RasterizedStream,pClassLinkage,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,pBufferStrides,NumStrides,RasterizedStream,pClassLinkage,ppGeometryShader) ) + +#define ID3D11Device4_CreatePixelShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppPixelShader) ) + +#define ID3D11Device4_CreateHullShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppHullShader) \ + ( (This)->lpVtbl -> CreateHullShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppHullShader) ) + +#define ID3D11Device4_CreateDomainShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppDomainShader) \ + ( (This)->lpVtbl -> CreateDomainShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppDomainShader) ) + +#define ID3D11Device4_CreateComputeShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppComputeShader) \ + ( (This)->lpVtbl -> CreateComputeShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppComputeShader) ) + +#define ID3D11Device4_CreateClassLinkage(This,ppLinkage) \ + ( (This)->lpVtbl -> CreateClassLinkage(This,ppLinkage) ) + +#define ID3D11Device4_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D11Device4_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D11Device4_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device4_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D11Device4_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D11Device4_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D11Device4_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D11Device4_CreateDeferredContext(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device4_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D11Device4_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D11Device4_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D11Device4_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D11Device4_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D11Device4_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D11Device4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Device4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Device4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D11Device4_GetFeatureLevel(This) \ + ( (This)->lpVtbl -> GetFeatureLevel(This) ) + +#define ID3D11Device4_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D11Device4_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D11Device4_GetImmediateContext(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext(This,ppImmediateContext) ) + +#define ID3D11Device4_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D11Device4_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + + +#define ID3D11Device4_GetImmediateContext1(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext1(This,ppImmediateContext) ) + +#define ID3D11Device4_CreateDeferredContext1(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext1(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device4_CreateBlendState1(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState1(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D11Device4_CreateRasterizerState1(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState1(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device4_CreateDeviceContextState(This,Flags,pFeatureLevels,FeatureLevels,SDKVersion,EmulatedInterface,pChosenFeatureLevel,ppContextState) \ + ( (This)->lpVtbl -> CreateDeviceContextState(This,Flags,pFeatureLevels,FeatureLevels,SDKVersion,EmulatedInterface,pChosenFeatureLevel,ppContextState) ) + +#define ID3D11Device4_OpenSharedResource1(This,hResource,returnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource1(This,hResource,returnedInterface,ppResource) ) + +#define ID3D11Device4_OpenSharedResourceByName(This,lpName,dwDesiredAccess,returnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResourceByName(This,lpName,dwDesiredAccess,returnedInterface,ppResource) ) + + +#define ID3D11Device4_GetImmediateContext2(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext2(This,ppImmediateContext) ) + +#define ID3D11Device4_CreateDeferredContext2(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext2(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device4_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D11Device4_CheckMultisampleQualityLevels1(This,Format,SampleCount,Flags,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels1(This,Format,SampleCount,Flags,pNumQualityLevels) ) + + +#define ID3D11Device4_CreateTexture2D1(This,pDesc1,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D1(This,pDesc1,pInitialData,ppTexture2D) ) + +#define ID3D11Device4_CreateTexture3D1(This,pDesc1,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D1(This,pDesc1,pInitialData,ppTexture3D) ) + +#define ID3D11Device4_CreateRasterizerState2(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState2(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device4_CreateShaderResourceView1(This,pResource,pDesc1,ppSRView1) \ + ( (This)->lpVtbl -> CreateShaderResourceView1(This,pResource,pDesc1,ppSRView1) ) + +#define ID3D11Device4_CreateUnorderedAccessView1(This,pResource,pDesc1,ppUAView1) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView1(This,pResource,pDesc1,ppUAView1) ) + +#define ID3D11Device4_CreateRenderTargetView1(This,pResource,pDesc1,ppRTView1) \ + ( (This)->lpVtbl -> CreateRenderTargetView1(This,pResource,pDesc1,ppRTView1) ) + +#define ID3D11Device4_CreateQuery1(This,pQueryDesc1,ppQuery1) \ + ( (This)->lpVtbl -> CreateQuery1(This,pQueryDesc1,ppQuery1) ) + +#define ID3D11Device4_GetImmediateContext3(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext3(This,ppImmediateContext) ) + +#define ID3D11Device4_CreateDeferredContext3(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext3(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device4_WriteToSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> WriteToSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D11Device4_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,pSrcResource,SrcSubresource,pSrcBox) ) + + +#define ID3D11Device4_RegisterDeviceRemovedEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterDeviceRemovedEvent(This,hEvent,pdwCookie) ) + +#define ID3D11Device4_UnregisterDeviceRemoved(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterDeviceRemoved(This,dwCookie) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Device4_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11Device5_INTERFACE_DEFINED__ +#define __ID3D11Device5_INTERFACE_DEFINED__ + +/* interface ID3D11Device5 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Device5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8ffde202-a0e7-45df-9e01-e837801b5ea0") + ID3D11Device5 : public ID3D11Device4 + { + public: + virtual HRESULT STDMETHODCALLTYPE OpenSharedFence( + /* [annotation] */ + _In_ HANDLE hFence, + /* [annotation] */ + _In_ REFIID ReturnedInterface, + /* [annotation] */ + _COM_Outptr_opt_ void **ppFence) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateFence( + /* [annotation] */ + _In_ UINT64 InitialValue, + /* [annotation] */ + _In_ D3D11_FENCE_FLAG Flags, + /* [annotation] */ + _In_ REFIID ReturnedInterface, + /* [annotation] */ + _COM_Outptr_opt_ void **ppFence) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D11Device5Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Device5 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Device5 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Device5 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateBuffer )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_BUFFER_DESC *pDesc, + /* [annotation] */ + _In_opt_ const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Buffer **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE1D_DESC *pDesc, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture1D **ppTexture1D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE2D_DESC *pDesc, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc->MipLevels * pDesc->ArraySize)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture2D **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE3D_DESC *pDesc, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc->MipLevels)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture3D **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11ShaderResourceView **ppSRView); + + HRESULT ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11UnorderedAccessView **ppUAView); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RenderTargetView **ppRTView); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DepthStencilView **ppDepthStencilView); + + HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(NumElements) const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, + /* [annotation] */ + _In_range_( 0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT ) UINT NumElements, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecodeWithInputSignature, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11InputLayout **ppInputLayout); + + HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11VertexShader **ppVertexShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_reads_opt_(NumEntries) const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, + /* [annotation] */ + _In_range_( 0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT ) UINT NumEntries, + /* [annotation] */ + _In_reads_opt_(NumStrides) const UINT *pBufferStrides, + /* [annotation] */ + _In_range_( 0, D3D11_SO_BUFFER_SLOT_COUNT ) UINT NumStrides, + /* [annotation] */ + _In_ UINT RasterizedStream, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11GeometryShader **ppGeometryShader); + + HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11PixelShader **ppPixelShader); + + HRESULT ( STDMETHODCALLTYPE *CreateHullShader )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11HullShader **ppHullShader); + + HRESULT ( STDMETHODCALLTYPE *CreateDomainShader )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DomainShader **ppDomainShader); + + HRESULT ( STDMETHODCALLTYPE *CreateComputeShader )( + ID3D11Device5 * This, + /* [annotation] */ + _In_reads_(BytecodeLength) const void *pShaderBytecode, + /* [annotation] */ + _In_ SIZE_T BytecodeLength, + /* [annotation] */ + _In_opt_ ID3D11ClassLinkage *pClassLinkage, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11ComputeShader **ppComputeShader); + + HRESULT ( STDMETHODCALLTYPE *CreateClassLinkage )( + ID3D11Device5 * This, + /* [annotation] */ + _COM_Outptr_ ID3D11ClassLinkage **ppLinkage); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_BLEND_DESC *pBlendStateDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11BlendState **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DepthStencilState **ppDepthStencilState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_RASTERIZER_DESC *pRasterizerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RasterizerState **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_SAMPLER_DESC *pSamplerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11SamplerState **ppSamplerState); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_QUERY_DESC *pQueryDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Query **ppQuery); + + HRESULT ( STDMETHODCALLTYPE *CreatePredicate )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_QUERY_DESC *pPredicateDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Predicate **ppPredicate); + + HRESULT ( STDMETHODCALLTYPE *CreateCounter )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_COUNTER_DESC *pCounterDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Counter **ppCounter); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext )( + ID3D11Device5 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext **ppDeferredContext); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _In_ REFIID ReturnedInterface, + /* [annotation] */ + _COM_Outptr_opt_ void **ppResource); + + HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _Out_ UINT *pFormatSupport); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _In_ UINT SampleCount, + /* [annotation] */ + _Out_ UINT *pNumQualityLevels); + + void ( STDMETHODCALLTYPE *CheckCounterInfo )( + ID3D11Device5 * This, + /* [annotation] */ + _Out_ D3D11_COUNTER_INFO *pCounterInfo); + + HRESULT ( STDMETHODCALLTYPE *CheckCounter )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_COUNTER_DESC *pDesc, + /* [annotation] */ + _Out_ D3D11_COUNTER_TYPE *pType, + /* [annotation] */ + _Out_ UINT *pActiveCounters, + /* [annotation] */ + _Out_writes_opt_(*pNameLength) LPSTR szName, + /* [annotation] */ + _Inout_opt_ UINT *pNameLength, + /* [annotation] */ + _Out_writes_opt_(*pUnitsLength) LPSTR szUnits, + /* [annotation] */ + _Inout_opt_ UINT *pUnitsLength, + /* [annotation] */ + _Out_writes_opt_(*pDescriptionLength) LPSTR szDescription, + /* [annotation] */ + _Inout_opt_ UINT *pDescriptionLength); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D11Device5 * This, + D3D11_FEATURE Feature, + /* [annotation] */ + _Out_writes_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _Inout_ UINT *pDataSize, + /* [annotation] */ + _Out_writes_bytes_opt_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_reads_bytes_opt_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_opt_ const IUnknown *pData); + + D3D_FEATURE_LEVEL ( STDMETHODCALLTYPE *GetFeatureLevel )( + ID3D11Device5 * This); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D11Device5 * This); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D11Device5 * This); + + void ( STDMETHODCALLTYPE *GetImmediateContext )( + ID3D11Device5 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )( + ID3D11Device5 * This, + UINT RaiseFlags); + + UINT ( STDMETHODCALLTYPE *GetExceptionMode )( + ID3D11Device5 * This); + + void ( STDMETHODCALLTYPE *GetImmediateContext1 )( + ID3D11Device5 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext1 **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext1 )( + ID3D11Device5 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext1 **ppDeferredContext); + + HRESULT ( STDMETHODCALLTYPE *CreateBlendState1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_BLEND_DESC1 *pBlendStateDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11BlendState1 **ppBlendState); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_RASTERIZER_DESC1 *pRasterizerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RasterizerState1 **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateDeviceContextState )( + ID3D11Device5 * This, + UINT Flags, + /* [annotation] */ + _In_reads_( FeatureLevels ) const D3D_FEATURE_LEVEL *pFeatureLevels, + UINT FeatureLevels, + UINT SDKVersion, + REFIID EmulatedInterface, + /* [annotation] */ + _Out_opt_ D3D_FEATURE_LEVEL *pChosenFeatureLevel, + /* [annotation] */ + _Out_opt_ ID3DDeviceContextState **ppContextState); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResource1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _In_ REFIID returnedInterface, + /* [annotation] */ + _COM_Outptr_ void **ppResource); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedResourceByName )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ LPCWSTR lpName, + /* [annotation] */ + _In_ DWORD dwDesiredAccess, + /* [annotation] */ + _In_ REFIID returnedInterface, + /* [annotation] */ + _COM_Outptr_ void **ppResource); + + void ( STDMETHODCALLTYPE *GetImmediateContext2 )( + ID3D11Device5 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext2 **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext2 )( + ID3D11Device5 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext2 **ppDeferredContext); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pTiledResource, + /* [annotation] */ + _Out_opt_ UINT *pNumTilesForEntireResource, + /* [annotation] */ + _Out_opt_ D3D11_PACKED_MIP_DESC *pPackedMipDesc, + /* [annotation] */ + _Out_opt_ D3D11_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + /* [annotation] */ + _Inout_opt_ UINT *pNumSubresourceTilings, + /* [annotation] */ + _In_ UINT FirstSubresourceTilingToGet, + /* [annotation] */ + _Out_writes_(*pNumSubresourceTilings) D3D11_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ DXGI_FORMAT Format, + /* [annotation] */ + _In_ UINT SampleCount, + /* [annotation] */ + _In_ UINT Flags, + /* [annotation] */ + _Out_ UINT *pNumQualityLevels); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture2D1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE2D_DESC1 *pDesc1, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc1->MipLevels * pDesc1->ArraySize)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture2D1 **ppTexture2D); + + HRESULT ( STDMETHODCALLTYPE *CreateTexture3D1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_TEXTURE3D_DESC1 *pDesc1, + /* [annotation] */ + _In_reads_opt_(_Inexpressible_(pDesc1->MipLevels)) const D3D11_SUBRESOURCE_DATA *pInitialData, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Texture3D1 **ppTexture3D); + + HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState2 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_RASTERIZER_DESC2 *pRasterizerDesc, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RasterizerState2 **ppRasterizerState); + + HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_SHADER_RESOURCE_VIEW_DESC1 *pDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11ShaderResourceView1 **ppSRView1); + + HRESULT ( STDMETHODCALLTYPE *CreateUnorderedAccessView1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_UNORDERED_ACCESS_VIEW_DESC1 *pDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11UnorderedAccessView1 **ppUAView1); + + HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pResource, + /* [annotation] */ + _In_opt_ const D3D11_RENDER_TARGET_VIEW_DESC1 *pDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11RenderTargetView1 **ppRTView1); + + HRESULT ( STDMETHODCALLTYPE *CreateQuery1 )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ const D3D11_QUERY_DESC1 *pQueryDesc1, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11Query1 **ppQuery1); + + void ( STDMETHODCALLTYPE *GetImmediateContext3 )( + ID3D11Device5 * This, + /* [annotation] */ + _Outptr_ ID3D11DeviceContext3 **ppImmediateContext); + + HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext3 )( + ID3D11Device5 * This, + UINT ContextFlags, + /* [annotation] */ + _COM_Outptr_opt_ ID3D11DeviceContext3 **ppDeferredContext); + + void ( STDMETHODCALLTYPE *WriteToSubresource )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ ID3D11Resource *pDstResource, + /* [annotation] */ + _In_ UINT DstSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pDstBox, + /* [annotation] */ + _In_ const void *pSrcData, + /* [annotation] */ + _In_ UINT SrcRowPitch, + /* [annotation] */ + _In_ UINT SrcDepthPitch); + + void ( STDMETHODCALLTYPE *ReadFromSubresource )( + ID3D11Device5 * This, + /* [annotation] */ + _Out_ void *pDstData, + /* [annotation] */ + _In_ UINT DstRowPitch, + /* [annotation] */ + _In_ UINT DstDepthPitch, + /* [annotation] */ + _In_ ID3D11Resource *pSrcResource, + /* [annotation] */ + _In_ UINT SrcSubresource, + /* [annotation] */ + _In_opt_ const D3D11_BOX *pSrcBox); + + HRESULT ( STDMETHODCALLTYPE *RegisterDeviceRemovedEvent )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ HANDLE hEvent, + /* [annotation] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterDeviceRemoved )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedFence )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ HANDLE hFence, + /* [annotation] */ + _In_ REFIID ReturnedInterface, + /* [annotation] */ + _COM_Outptr_opt_ void **ppFence); + + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D11Device5 * This, + /* [annotation] */ + _In_ UINT64 InitialValue, + /* [annotation] */ + _In_ D3D11_FENCE_FLAG Flags, + /* [annotation] */ + _In_ REFIID ReturnedInterface, + /* [annotation] */ + _COM_Outptr_opt_ void **ppFence); + + END_INTERFACE + } ID3D11Device5Vtbl; + + interface ID3D11Device5 + { + CONST_VTBL struct ID3D11Device5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Device5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Device5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Device5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Device5_CreateBuffer(This,pDesc,pInitialData,ppBuffer) \ + ( (This)->lpVtbl -> CreateBuffer(This,pDesc,pInitialData,ppBuffer) ) + +#define ID3D11Device5_CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) \ + ( (This)->lpVtbl -> CreateTexture1D(This,pDesc,pInitialData,ppTexture1D) ) + +#define ID3D11Device5_CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D(This,pDesc,pInitialData,ppTexture2D) ) + +#define ID3D11Device5_CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D(This,pDesc,pInitialData,ppTexture3D) ) + +#define ID3D11Device5_CreateShaderResourceView(This,pResource,pDesc,ppSRView) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,ppSRView) ) + +#define ID3D11Device5_CreateUnorderedAccessView(This,pResource,pDesc,ppUAView) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pDesc,ppUAView) ) + +#define ID3D11Device5_CreateRenderTargetView(This,pResource,pDesc,ppRTView) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,ppRTView) ) + +#define ID3D11Device5_CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,ppDepthStencilView) ) + +#define ID3D11Device5_CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) \ + ( (This)->lpVtbl -> CreateInputLayout(This,pInputElementDescs,NumElements,pShaderBytecodeWithInputSignature,BytecodeLength,ppInputLayout) ) + +#define ID3D11Device5_CreateVertexShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppVertexShader) \ + ( (This)->lpVtbl -> CreateVertexShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppVertexShader) ) + +#define ID3D11Device5_CreateGeometryShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppGeometryShader) ) + +#define ID3D11Device5_CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,pBufferStrides,NumStrides,RasterizedStream,pClassLinkage,ppGeometryShader) \ + ( (This)->lpVtbl -> CreateGeometryShaderWithStreamOutput(This,pShaderBytecode,BytecodeLength,pSODeclaration,NumEntries,pBufferStrides,NumStrides,RasterizedStream,pClassLinkage,ppGeometryShader) ) + +#define ID3D11Device5_CreatePixelShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppPixelShader) \ + ( (This)->lpVtbl -> CreatePixelShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppPixelShader) ) + +#define ID3D11Device5_CreateHullShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppHullShader) \ + ( (This)->lpVtbl -> CreateHullShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppHullShader) ) + +#define ID3D11Device5_CreateDomainShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppDomainShader) \ + ( (This)->lpVtbl -> CreateDomainShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppDomainShader) ) + +#define ID3D11Device5_CreateComputeShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppComputeShader) \ + ( (This)->lpVtbl -> CreateComputeShader(This,pShaderBytecode,BytecodeLength,pClassLinkage,ppComputeShader) ) + +#define ID3D11Device5_CreateClassLinkage(This,ppLinkage) \ + ( (This)->lpVtbl -> CreateClassLinkage(This,ppLinkage) ) + +#define ID3D11Device5_CreateBlendState(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D11Device5_CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) \ + ( (This)->lpVtbl -> CreateDepthStencilState(This,pDepthStencilDesc,ppDepthStencilState) ) + +#define ID3D11Device5_CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device5_CreateSamplerState(This,pSamplerDesc,ppSamplerState) \ + ( (This)->lpVtbl -> CreateSamplerState(This,pSamplerDesc,ppSamplerState) ) + +#define ID3D11Device5_CreateQuery(This,pQueryDesc,ppQuery) \ + ( (This)->lpVtbl -> CreateQuery(This,pQueryDesc,ppQuery) ) + +#define ID3D11Device5_CreatePredicate(This,pPredicateDesc,ppPredicate) \ + ( (This)->lpVtbl -> CreatePredicate(This,pPredicateDesc,ppPredicate) ) + +#define ID3D11Device5_CreateCounter(This,pCounterDesc,ppCounter) \ + ( (This)->lpVtbl -> CreateCounter(This,pCounterDesc,ppCounter) ) + +#define ID3D11Device5_CreateDeferredContext(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device5_OpenSharedResource(This,hResource,ReturnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource(This,hResource,ReturnedInterface,ppResource) ) + +#define ID3D11Device5_CheckFormatSupport(This,Format,pFormatSupport) \ + ( (This)->lpVtbl -> CheckFormatSupport(This,Format,pFormatSupport) ) + +#define ID3D11Device5_CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels(This,Format,SampleCount,pNumQualityLevels) ) + +#define ID3D11Device5_CheckCounterInfo(This,pCounterInfo) \ + ( (This)->lpVtbl -> CheckCounterInfo(This,pCounterInfo) ) + +#define ID3D11Device5_CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) \ + ( (This)->lpVtbl -> CheckCounter(This,pDesc,pType,pActiveCounters,szName,pNameLength,szUnits,pUnitsLength,szDescription,pDescriptionLength) ) + +#define ID3D11Device5_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D11Device5_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11Device5_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11Device5_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D11Device5_GetFeatureLevel(This) \ + ( (This)->lpVtbl -> GetFeatureLevel(This) ) + +#define ID3D11Device5_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#define ID3D11Device5_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D11Device5_GetImmediateContext(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext(This,ppImmediateContext) ) + +#define ID3D11Device5_SetExceptionMode(This,RaiseFlags) \ + ( (This)->lpVtbl -> SetExceptionMode(This,RaiseFlags) ) + +#define ID3D11Device5_GetExceptionMode(This) \ + ( (This)->lpVtbl -> GetExceptionMode(This) ) + + +#define ID3D11Device5_GetImmediateContext1(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext1(This,ppImmediateContext) ) + +#define ID3D11Device5_CreateDeferredContext1(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext1(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device5_CreateBlendState1(This,pBlendStateDesc,ppBlendState) \ + ( (This)->lpVtbl -> CreateBlendState1(This,pBlendStateDesc,ppBlendState) ) + +#define ID3D11Device5_CreateRasterizerState1(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState1(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device5_CreateDeviceContextState(This,Flags,pFeatureLevels,FeatureLevels,SDKVersion,EmulatedInterface,pChosenFeatureLevel,ppContextState) \ + ( (This)->lpVtbl -> CreateDeviceContextState(This,Flags,pFeatureLevels,FeatureLevels,SDKVersion,EmulatedInterface,pChosenFeatureLevel,ppContextState) ) + +#define ID3D11Device5_OpenSharedResource1(This,hResource,returnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResource1(This,hResource,returnedInterface,ppResource) ) + +#define ID3D11Device5_OpenSharedResourceByName(This,lpName,dwDesiredAccess,returnedInterface,ppResource) \ + ( (This)->lpVtbl -> OpenSharedResourceByName(This,lpName,dwDesiredAccess,returnedInterface,ppResource) ) + + +#define ID3D11Device5_GetImmediateContext2(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext2(This,ppImmediateContext) ) + +#define ID3D11Device5_CreateDeferredContext2(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext2(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device5_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D11Device5_CheckMultisampleQualityLevels1(This,Format,SampleCount,Flags,pNumQualityLevels) \ + ( (This)->lpVtbl -> CheckMultisampleQualityLevels1(This,Format,SampleCount,Flags,pNumQualityLevels) ) + + +#define ID3D11Device5_CreateTexture2D1(This,pDesc1,pInitialData,ppTexture2D) \ + ( (This)->lpVtbl -> CreateTexture2D1(This,pDesc1,pInitialData,ppTexture2D) ) + +#define ID3D11Device5_CreateTexture3D1(This,pDesc1,pInitialData,ppTexture3D) \ + ( (This)->lpVtbl -> CreateTexture3D1(This,pDesc1,pInitialData,ppTexture3D) ) + +#define ID3D11Device5_CreateRasterizerState2(This,pRasterizerDesc,ppRasterizerState) \ + ( (This)->lpVtbl -> CreateRasterizerState2(This,pRasterizerDesc,ppRasterizerState) ) + +#define ID3D11Device5_CreateShaderResourceView1(This,pResource,pDesc1,ppSRView1) \ + ( (This)->lpVtbl -> CreateShaderResourceView1(This,pResource,pDesc1,ppSRView1) ) + +#define ID3D11Device5_CreateUnorderedAccessView1(This,pResource,pDesc1,ppUAView1) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView1(This,pResource,pDesc1,ppUAView1) ) + +#define ID3D11Device5_CreateRenderTargetView1(This,pResource,pDesc1,ppRTView1) \ + ( (This)->lpVtbl -> CreateRenderTargetView1(This,pResource,pDesc1,ppRTView1) ) + +#define ID3D11Device5_CreateQuery1(This,pQueryDesc1,ppQuery1) \ + ( (This)->lpVtbl -> CreateQuery1(This,pQueryDesc1,ppQuery1) ) + +#define ID3D11Device5_GetImmediateContext3(This,ppImmediateContext) \ + ( (This)->lpVtbl -> GetImmediateContext3(This,ppImmediateContext) ) + +#define ID3D11Device5_CreateDeferredContext3(This,ContextFlags,ppDeferredContext) \ + ( (This)->lpVtbl -> CreateDeferredContext3(This,ContextFlags,ppDeferredContext) ) + +#define ID3D11Device5_WriteToSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> WriteToSubresource(This,pDstResource,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D11Device5_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,pSrcResource,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,pSrcResource,SrcSubresource,pSrcBox) ) + + +#define ID3D11Device5_RegisterDeviceRemovedEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterDeviceRemovedEvent(This,hEvent,pdwCookie) ) + +#define ID3D11Device5_UnregisterDeviceRemoved(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterDeviceRemoved(This,dwCookie) ) + + +#define ID3D11Device5_OpenSharedFence(This,hFence,ReturnedInterface,ppFence) \ + ( (This)->lpVtbl -> OpenSharedFence(This,hFence,ReturnedInterface,ppFence) ) + +#define ID3D11Device5_CreateFence(This,InitialValue,Flags,ReturnedInterface,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,ReturnedInterface,ppFence) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Device5_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11Multithread_INTERFACE_DEFINED__ +#define __ID3D11Multithread_INTERFACE_DEFINED__ + +/* interface ID3D11Multithread */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11Multithread; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9B7E4E00-342C-4106-A19F-4F2704F689F0") + ID3D11Multithread : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE Enter( void) = 0; + + virtual void STDMETHODCALLTYPE Leave( void) = 0; + + virtual BOOL STDMETHODCALLTYPE SetMultithreadProtected( + /* [annotation] */ + _In_ BOOL bMTProtect) = 0; + + virtual BOOL STDMETHODCALLTYPE GetMultithreadProtected( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D11MultithreadVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11Multithread * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11Multithread * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11Multithread * This); + + void ( STDMETHODCALLTYPE *Enter )( + ID3D11Multithread * This); + + void ( STDMETHODCALLTYPE *Leave )( + ID3D11Multithread * This); + + BOOL ( STDMETHODCALLTYPE *SetMultithreadProtected )( + ID3D11Multithread * This, + /* [annotation] */ + _In_ BOOL bMTProtect); + + BOOL ( STDMETHODCALLTYPE *GetMultithreadProtected )( + ID3D11Multithread * This); + + END_INTERFACE + } ID3D11MultithreadVtbl; + + interface ID3D11Multithread + { + CONST_VTBL struct ID3D11MultithreadVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11Multithread_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11Multithread_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11Multithread_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11Multithread_Enter(This) \ + ( (This)->lpVtbl -> Enter(This) ) + +#define ID3D11Multithread_Leave(This) \ + ( (This)->lpVtbl -> Leave(This) ) + +#define ID3D11Multithread_SetMultithreadProtected(This,bMTProtect) \ + ( (This)->lpVtbl -> SetMultithreadProtected(This,bMTProtect) ) + +#define ID3D11Multithread_GetMultithreadProtected(This) \ + ( (This)->lpVtbl -> GetMultithreadProtected(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11Multithread_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D11VideoContext2_INTERFACE_DEFINED__ +#define __ID3D11VideoContext2_INTERFACE_DEFINED__ + +/* interface ID3D11VideoContext2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D11VideoContext2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C4E7374C-6243-4D1B-AE87-52B4F740E261") + ID3D11VideoContext2 : public ID3D11VideoContext1 + { + public: + virtual void STDMETHODCALLTYPE VideoProcessorSetOutputHDRMetaData( + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ DXGI_HDR_METADATA_TYPE Type, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _In_reads_bytes_opt_(Size) const void *pHDRMetaData) = 0; + + virtual void STDMETHODCALLTYPE VideoProcessorGetOutputHDRMetaData( + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ DXGI_HDR_METADATA_TYPE *pType, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _Out_writes_bytes_opt_(Size) void *pMetaData) = 0; + + virtual void STDMETHODCALLTYPE VideoProcessorSetStreamHDRMetaData( + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ DXGI_HDR_METADATA_TYPE Type, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _In_reads_bytes_opt_(Size) const void *pHDRMetaData) = 0; + + virtual void STDMETHODCALLTYPE VideoProcessorGetStreamHDRMetaData( + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ DXGI_HDR_METADATA_TYPE *pType, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _Out_writes_bytes_opt_(Size) void *pMetaData) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D11VideoContext2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D11VideoContext2 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D11VideoContext2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D11VideoContext2 * This); + + void ( STDMETHODCALLTYPE *GetDevice )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _Outptr_ ID3D11Device **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _Inout_ UINT *pDataSize, + /* [annotation] */ + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ REFGUID guid, + /* [annotation] */ + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *GetDecoderBuffer )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + D3D11_VIDEO_DECODER_BUFFER_TYPE Type, + /* [annotation] */ + _Out_ UINT *pBufferSize, + /* [annotation] */ + _Outptr_result_bytebuffer_(*pBufferSize) void **ppBuffer); + + HRESULT ( STDMETHODCALLTYPE *ReleaseDecoderBuffer )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ D3D11_VIDEO_DECODER_BUFFER_TYPE Type); + + HRESULT ( STDMETHODCALLTYPE *DecoderBeginFrame )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ ID3D11VideoDecoderOutputView *pView, + UINT ContentKeySize, + /* [annotation] */ + _In_reads_bytes_opt_(ContentKeySize) const void *pContentKey); + + HRESULT ( STDMETHODCALLTYPE *DecoderEndFrame )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder); + + HRESULT ( STDMETHODCALLTYPE *SubmitDecoderBuffers )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ UINT NumBuffers, + /* [annotation] */ + _In_reads_(NumBuffers) const D3D11_VIDEO_DECODER_BUFFER_DESC *pBufferDesc); + + APP_DEPRECATED_HRESULT ( STDMETHODCALLTYPE *DecoderExtension )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ const D3D11_VIDEO_DECODER_EXTENSION *pExtensionData); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputTargetRect )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_opt_ const RECT *pRect); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputBackgroundColor )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ BOOL YCbCr, + /* [annotation] */ + _In_ const D3D11_VIDEO_COLOR *pColor); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputColorSpace )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ const D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputAlphaFillMode )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE AlphaFillMode, + /* [annotation] */ + _In_ UINT StreamIndex); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputConstriction )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ SIZE Size); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputStereoMode )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ BOOL Enable); + + APP_DEPRECATED_HRESULT ( STDMETHODCALLTYPE *VideoProcessorSetOutputExtension )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ const GUID *pExtensionGuid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_ void *pData); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputTargetRect )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ BOOL *Enabled, + /* [annotation] */ + _Out_ RECT *pRect); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputBackgroundColor )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ BOOL *pYCbCr, + /* [annotation] */ + _Out_ D3D11_VIDEO_COLOR *pColor); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputColorSpace )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputAlphaFillMode )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE *pAlphaFillMode, + /* [annotation] */ + _Out_ UINT *pStreamIndex); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputConstriction )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ SIZE *pSize); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputStereoMode )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ BOOL *pEnabled); + + APP_DEPRECATED_HRESULT ( STDMETHODCALLTYPE *VideoProcessorGetOutputExtension )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ const GUID *pExtensionGuid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _Out_writes_bytes_(DataSize) void *pData); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamFrameFormat )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ D3D11_VIDEO_FRAME_FORMAT FrameFormat); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamColorSpace )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ const D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamOutputRate )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_OUTPUT_RATE OutputRate, + /* [annotation] */ + _In_ BOOL RepeatFrame, + /* [annotation] */ + _In_opt_ const DXGI_RATIONAL *pCustomRate); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamSourceRect )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_opt_ const RECT *pRect); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamDestRect )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_opt_ const RECT *pRect); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamAlpha )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ FLOAT Alpha); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamPalette )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ UINT Count, + /* [annotation] */ + _In_reads_opt_(Count) const UINT *pEntries); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamPixelAspectRatio )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_opt_ const DXGI_RATIONAL *pSourceAspectRatio, + /* [annotation] */ + _In_opt_ const DXGI_RATIONAL *pDestinationAspectRatio); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamLumaKey )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ FLOAT Lower, + /* [annotation] */ + _In_ FLOAT Upper); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamStereoFormat )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_STEREO_FORMAT Format, + /* [annotation] */ + _In_ BOOL LeftViewFrame0, + /* [annotation] */ + _In_ BOOL BaseViewFrame0, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE FlipMode, + /* [annotation] */ + _In_ int MonoOffset); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamAutoProcessingMode )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamFilter )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_FILTER Filter, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ int Level); + + APP_DEPRECATED_HRESULT ( STDMETHODCALLTYPE *VideoProcessorSetStreamExtension )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ const GUID *pExtensionGuid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _In_ void *pData); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamFrameFormat )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ D3D11_VIDEO_FRAME_FORMAT *pFrameFormat); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamColorSpace )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_COLOR_SPACE *pColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamOutputRate )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_OUTPUT_RATE *pOutputRate, + /* [annotation] */ + _Out_ BOOL *pRepeatFrame, + /* [annotation] */ + _Out_ DXGI_RATIONAL *pCustomRate); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamSourceRect )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ RECT *pRect); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamDestRect )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ RECT *pRect); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamAlpha )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ FLOAT *pAlpha); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamPalette )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ UINT Count, + /* [annotation] */ + _Out_writes_(Count) UINT *pEntries); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamPixelAspectRatio )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ DXGI_RATIONAL *pSourceAspectRatio, + /* [annotation] */ + _Out_ DXGI_RATIONAL *pDestinationAspectRatio); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamLumaKey )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ FLOAT *pLower, + /* [annotation] */ + _Out_ FLOAT *pUpper); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamStereoFormat )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnable, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_STEREO_FORMAT *pFormat, + /* [annotation] */ + _Out_ BOOL *pLeftViewFrame0, + /* [annotation] */ + _Out_ BOOL *pBaseViewFrame0, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE *pFlipMode, + /* [annotation] */ + _Out_ int *MonoOffset); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamAutoProcessingMode )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnabled); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamFilter )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_FILTER Filter, + /* [annotation] */ + _Out_ BOOL *pEnabled, + /* [annotation] */ + _Out_ int *pLevel); + + APP_DEPRECATED_HRESULT ( STDMETHODCALLTYPE *VideoProcessorGetStreamExtension )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ const GUID *pExtensionGuid, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _Out_writes_bytes_(DataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *VideoProcessorBlt )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ ID3D11VideoProcessorOutputView *pView, + /* [annotation] */ + _In_ UINT OutputFrame, + /* [annotation] */ + _In_ UINT StreamCount, + /* [annotation] */ + _In_reads_(StreamCount) const D3D11_VIDEO_PROCESSOR_STREAM *pStreams); + + HRESULT ( STDMETHODCALLTYPE *NegotiateCryptoSessionKeyExchange )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _Inout_updates_bytes_(DataSize) void *pData); + + void ( STDMETHODCALLTYPE *EncryptionBlt )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _In_ ID3D11Texture2D *pSrcSurface, + /* [annotation] */ + _In_ ID3D11Texture2D *pDstSurface, + /* [annotation] */ + _In_ UINT IVSize, + /* [annotation] */ + _Inout_opt_bytecount_(IVSize) void *pIV); + + void ( STDMETHODCALLTYPE *DecryptionBlt )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _In_ ID3D11Texture2D *pSrcSurface, + /* [annotation] */ + _In_ ID3D11Texture2D *pDstSurface, + /* [annotation] */ + _In_opt_ D3D11_ENCRYPTED_BLOCK_INFO *pEncryptedBlockInfo, + /* [annotation] */ + _In_ UINT ContentKeySize, + /* [annotation] */ + _In_reads_bytes_opt_(ContentKeySize) const void *pContentKey, + /* [annotation] */ + _In_ UINT IVSize, + /* [annotation] */ + _Inout_opt_bytecount_(IVSize) void *pIV); + + void ( STDMETHODCALLTYPE *StartSessionKeyRefresh )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _In_ UINT RandomNumberSize, + /* [annotation] */ + _Out_writes_bytes_(RandomNumberSize) void *pRandomNumber); + + void ( STDMETHODCALLTYPE *FinishSessionKeyRefresh )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession); + + HRESULT ( STDMETHODCALLTYPE *GetEncryptionBltKey )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _In_ UINT KeySize, + /* [annotation] */ + _Out_writes_bytes_(KeySize) void *pReadbackKey); + + HRESULT ( STDMETHODCALLTYPE *NegotiateAuthenticatedChannelKeyExchange )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11AuthenticatedChannel *pChannel, + /* [annotation] */ + _In_ UINT DataSize, + /* [annotation] */ + _Inout_updates_bytes_(DataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *QueryAuthenticatedChannel )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11AuthenticatedChannel *pChannel, + /* [annotation] */ + _In_ UINT InputSize, + /* [annotation] */ + _In_reads_bytes_(InputSize) const void *pInput, + /* [annotation] */ + _In_ UINT OutputSize, + /* [annotation] */ + _Out_writes_bytes_(OutputSize) void *pOutput); + + HRESULT ( STDMETHODCALLTYPE *ConfigureAuthenticatedChannel )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11AuthenticatedChannel *pChannel, + /* [annotation] */ + _In_ UINT InputSize, + /* [annotation] */ + _In_reads_bytes_(InputSize) const void *pInput, + /* [annotation] */ + _Out_ D3D11_AUTHENTICATED_CONFIGURE_OUTPUT *pOutput); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamRotation )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ D3D11_VIDEO_PROCESSOR_ROTATION Rotation); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamRotation )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnable, + /* [annotation] */ + _Out_ D3D11_VIDEO_PROCESSOR_ROTATION *pRotation); + + HRESULT ( STDMETHODCALLTYPE *SubmitDecoderBuffers1 )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ UINT NumBuffers, + /* [annotation] */ + _In_reads_(NumBuffers) const D3D11_VIDEO_DECODER_BUFFER_DESC1 *pBufferDesc); + + HRESULT ( STDMETHODCALLTYPE *GetDataForNewHardwareKey )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _In_ UINT PrivateInputSize, + /* [annotation] */ + _In_reads_(PrivateInputSize) const void *pPrivatInputData, + /* [annotation] */ + _Out_ UINT64 *pPrivateOutputData); + + HRESULT ( STDMETHODCALLTYPE *CheckCryptoSessionStatus )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11CryptoSession *pCryptoSession, + /* [annotation] */ + _Out_ D3D11_CRYPTO_SESSION_STATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *DecoderEnableDownsampling )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ DXGI_COLOR_SPACE_TYPE InputColorSpace, + /* [annotation] */ + _In_ const D3D11_VIDEO_SAMPLE_DESC *pOutputDesc, + /* [annotation] */ + _In_ UINT ReferenceFrameCount); + + HRESULT ( STDMETHODCALLTYPE *DecoderUpdateDownsampling )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoDecoder *pDecoder, + /* [annotation] */ + _In_ const D3D11_VIDEO_SAMPLE_DESC *pOutputDesc); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputColorSpace1 )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ DXGI_COLOR_SPACE_TYPE ColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputShaderUsage )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ BOOL ShaderUsage); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputColorSpace1 )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ DXGI_COLOR_SPACE_TYPE *pColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputShaderUsage )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ BOOL *pShaderUsage); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamColorSpace1 )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ DXGI_COLOR_SPACE_TYPE ColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamMirror )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ BOOL Enable, + /* [annotation] */ + _In_ BOOL FlipHorizontal, + /* [annotation] */ + _In_ BOOL FlipVertical); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamColorSpace1 )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ DXGI_COLOR_SPACE_TYPE *pColorSpace); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamMirror )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ BOOL *pEnable, + /* [annotation] */ + _Out_ BOOL *pFlipHorizontal, + /* [annotation] */ + _Out_ BOOL *pFlipVertical); + + HRESULT ( STDMETHODCALLTYPE *VideoProcessorGetBehaviorHints )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT OutputWidth, + /* [annotation] */ + _In_ UINT OutputHeight, + /* [annotation] */ + _In_ DXGI_FORMAT OutputFormat, + /* [annotation] */ + _In_ UINT StreamCount, + /* [annotation] */ + _In_reads_(StreamCount) const D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT *pStreams, + /* [annotation] */ + _Out_ UINT *pBehaviorHints); + + void ( STDMETHODCALLTYPE *VideoProcessorSetOutputHDRMetaData )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ DXGI_HDR_METADATA_TYPE Type, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _In_reads_bytes_opt_(Size) const void *pHDRMetaData); + + void ( STDMETHODCALLTYPE *VideoProcessorGetOutputHDRMetaData )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _Out_ DXGI_HDR_METADATA_TYPE *pType, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _Out_writes_bytes_opt_(Size) void *pMetaData); + + void ( STDMETHODCALLTYPE *VideoProcessorSetStreamHDRMetaData )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _In_ DXGI_HDR_METADATA_TYPE Type, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _In_reads_bytes_opt_(Size) const void *pHDRMetaData); + + void ( STDMETHODCALLTYPE *VideoProcessorGetStreamHDRMetaData )( + ID3D11VideoContext2 * This, + /* [annotation] */ + _In_ ID3D11VideoProcessor *pVideoProcessor, + /* [annotation] */ + _In_ UINT StreamIndex, + /* [annotation] */ + _Out_ DXGI_HDR_METADATA_TYPE *pType, + /* [annotation] */ + _In_ UINT Size, + /* [annotation] */ + _Out_writes_bytes_opt_(Size) void *pMetaData); + + END_INTERFACE + } ID3D11VideoContext2Vtbl; + + interface ID3D11VideoContext2 + { + CONST_VTBL struct ID3D11VideoContext2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D11VideoContext2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D11VideoContext2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D11VideoContext2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D11VideoContext2_GetDevice(This,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,ppDevice) ) + +#define ID3D11VideoContext2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D11VideoContext2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D11VideoContext2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + + +#define ID3D11VideoContext2_GetDecoderBuffer(This,pDecoder,Type,pBufferSize,ppBuffer) \ + ( (This)->lpVtbl -> GetDecoderBuffer(This,pDecoder,Type,pBufferSize,ppBuffer) ) + +#define ID3D11VideoContext2_ReleaseDecoderBuffer(This,pDecoder,Type) \ + ( (This)->lpVtbl -> ReleaseDecoderBuffer(This,pDecoder,Type) ) + +#define ID3D11VideoContext2_DecoderBeginFrame(This,pDecoder,pView,ContentKeySize,pContentKey) \ + ( (This)->lpVtbl -> DecoderBeginFrame(This,pDecoder,pView,ContentKeySize,pContentKey) ) + +#define ID3D11VideoContext2_DecoderEndFrame(This,pDecoder) \ + ( (This)->lpVtbl -> DecoderEndFrame(This,pDecoder) ) + +#define ID3D11VideoContext2_SubmitDecoderBuffers(This,pDecoder,NumBuffers,pBufferDesc) \ + ( (This)->lpVtbl -> SubmitDecoderBuffers(This,pDecoder,NumBuffers,pBufferDesc) ) + +#define ID3D11VideoContext2_DecoderExtension(This,pDecoder,pExtensionData) \ + ( (This)->lpVtbl -> DecoderExtension(This,pDecoder,pExtensionData) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputTargetRect(This,pVideoProcessor,Enable,pRect) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputTargetRect(This,pVideoProcessor,Enable,pRect) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputBackgroundColor(This,pVideoProcessor,YCbCr,pColor) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputBackgroundColor(This,pVideoProcessor,YCbCr,pColor) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputColorSpace(This,pVideoProcessor,pColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputColorSpace(This,pVideoProcessor,pColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputAlphaFillMode(This,pVideoProcessor,AlphaFillMode,StreamIndex) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputAlphaFillMode(This,pVideoProcessor,AlphaFillMode,StreamIndex) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputConstriction(This,pVideoProcessor,Enable,Size) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputConstriction(This,pVideoProcessor,Enable,Size) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputStereoMode(This,pVideoProcessor,Enable) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputStereoMode(This,pVideoProcessor,Enable) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputExtension(This,pVideoProcessor,pExtensionGuid,DataSize,pData) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputExtension(This,pVideoProcessor,pExtensionGuid,DataSize,pData) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputTargetRect(This,pVideoProcessor,Enabled,pRect) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputTargetRect(This,pVideoProcessor,Enabled,pRect) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputBackgroundColor(This,pVideoProcessor,pYCbCr,pColor) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputBackgroundColor(This,pVideoProcessor,pYCbCr,pColor) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputColorSpace(This,pVideoProcessor,pColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputColorSpace(This,pVideoProcessor,pColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputAlphaFillMode(This,pVideoProcessor,pAlphaFillMode,pStreamIndex) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputAlphaFillMode(This,pVideoProcessor,pAlphaFillMode,pStreamIndex) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputConstriction(This,pVideoProcessor,pEnabled,pSize) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputConstriction(This,pVideoProcessor,pEnabled,pSize) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputStereoMode(This,pVideoProcessor,pEnabled) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputStereoMode(This,pVideoProcessor,pEnabled) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputExtension(This,pVideoProcessor,pExtensionGuid,DataSize,pData) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputExtension(This,pVideoProcessor,pExtensionGuid,DataSize,pData) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamFrameFormat(This,pVideoProcessor,StreamIndex,FrameFormat) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamFrameFormat(This,pVideoProcessor,StreamIndex,FrameFormat) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamColorSpace(This,pVideoProcessor,StreamIndex,pColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamColorSpace(This,pVideoProcessor,StreamIndex,pColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamOutputRate(This,pVideoProcessor,StreamIndex,OutputRate,RepeatFrame,pCustomRate) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamOutputRate(This,pVideoProcessor,StreamIndex,OutputRate,RepeatFrame,pCustomRate) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamSourceRect(This,pVideoProcessor,StreamIndex,Enable,pRect) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamSourceRect(This,pVideoProcessor,StreamIndex,Enable,pRect) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamDestRect(This,pVideoProcessor,StreamIndex,Enable,pRect) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamDestRect(This,pVideoProcessor,StreamIndex,Enable,pRect) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamAlpha(This,pVideoProcessor,StreamIndex,Enable,Alpha) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamAlpha(This,pVideoProcessor,StreamIndex,Enable,Alpha) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamPalette(This,pVideoProcessor,StreamIndex,Count,pEntries) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamPalette(This,pVideoProcessor,StreamIndex,Count,pEntries) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamPixelAspectRatio(This,pVideoProcessor,StreamIndex,Enable,pSourceAspectRatio,pDestinationAspectRatio) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamPixelAspectRatio(This,pVideoProcessor,StreamIndex,Enable,pSourceAspectRatio,pDestinationAspectRatio) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamLumaKey(This,pVideoProcessor,StreamIndex,Enable,Lower,Upper) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamLumaKey(This,pVideoProcessor,StreamIndex,Enable,Lower,Upper) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamStereoFormat(This,pVideoProcessor,StreamIndex,Enable,Format,LeftViewFrame0,BaseViewFrame0,FlipMode,MonoOffset) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamStereoFormat(This,pVideoProcessor,StreamIndex,Enable,Format,LeftViewFrame0,BaseViewFrame0,FlipMode,MonoOffset) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamAutoProcessingMode(This,pVideoProcessor,StreamIndex,Enable) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamAutoProcessingMode(This,pVideoProcessor,StreamIndex,Enable) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamFilter(This,pVideoProcessor,StreamIndex,Filter,Enable,Level) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamFilter(This,pVideoProcessor,StreamIndex,Filter,Enable,Level) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamExtension(This,pVideoProcessor,StreamIndex,pExtensionGuid,DataSize,pData) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamExtension(This,pVideoProcessor,StreamIndex,pExtensionGuid,DataSize,pData) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamFrameFormat(This,pVideoProcessor,StreamIndex,pFrameFormat) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamFrameFormat(This,pVideoProcessor,StreamIndex,pFrameFormat) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamColorSpace(This,pVideoProcessor,StreamIndex,pColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamColorSpace(This,pVideoProcessor,StreamIndex,pColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamOutputRate(This,pVideoProcessor,StreamIndex,pOutputRate,pRepeatFrame,pCustomRate) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamOutputRate(This,pVideoProcessor,StreamIndex,pOutputRate,pRepeatFrame,pCustomRate) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamSourceRect(This,pVideoProcessor,StreamIndex,pEnabled,pRect) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamSourceRect(This,pVideoProcessor,StreamIndex,pEnabled,pRect) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamDestRect(This,pVideoProcessor,StreamIndex,pEnabled,pRect) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamDestRect(This,pVideoProcessor,StreamIndex,pEnabled,pRect) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamAlpha(This,pVideoProcessor,StreamIndex,pEnabled,pAlpha) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamAlpha(This,pVideoProcessor,StreamIndex,pEnabled,pAlpha) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamPalette(This,pVideoProcessor,StreamIndex,Count,pEntries) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamPalette(This,pVideoProcessor,StreamIndex,Count,pEntries) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamPixelAspectRatio(This,pVideoProcessor,StreamIndex,pEnabled,pSourceAspectRatio,pDestinationAspectRatio) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamPixelAspectRatio(This,pVideoProcessor,StreamIndex,pEnabled,pSourceAspectRatio,pDestinationAspectRatio) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamLumaKey(This,pVideoProcessor,StreamIndex,pEnabled,pLower,pUpper) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamLumaKey(This,pVideoProcessor,StreamIndex,pEnabled,pLower,pUpper) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamStereoFormat(This,pVideoProcessor,StreamIndex,pEnable,pFormat,pLeftViewFrame0,pBaseViewFrame0,pFlipMode,MonoOffset) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamStereoFormat(This,pVideoProcessor,StreamIndex,pEnable,pFormat,pLeftViewFrame0,pBaseViewFrame0,pFlipMode,MonoOffset) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamAutoProcessingMode(This,pVideoProcessor,StreamIndex,pEnabled) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamAutoProcessingMode(This,pVideoProcessor,StreamIndex,pEnabled) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamFilter(This,pVideoProcessor,StreamIndex,Filter,pEnabled,pLevel) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamFilter(This,pVideoProcessor,StreamIndex,Filter,pEnabled,pLevel) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamExtension(This,pVideoProcessor,StreamIndex,pExtensionGuid,DataSize,pData) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamExtension(This,pVideoProcessor,StreamIndex,pExtensionGuid,DataSize,pData) ) + +#define ID3D11VideoContext2_VideoProcessorBlt(This,pVideoProcessor,pView,OutputFrame,StreamCount,pStreams) \ + ( (This)->lpVtbl -> VideoProcessorBlt(This,pVideoProcessor,pView,OutputFrame,StreamCount,pStreams) ) + +#define ID3D11VideoContext2_NegotiateCryptoSessionKeyExchange(This,pCryptoSession,DataSize,pData) \ + ( (This)->lpVtbl -> NegotiateCryptoSessionKeyExchange(This,pCryptoSession,DataSize,pData) ) + +#define ID3D11VideoContext2_EncryptionBlt(This,pCryptoSession,pSrcSurface,pDstSurface,IVSize,pIV) \ + ( (This)->lpVtbl -> EncryptionBlt(This,pCryptoSession,pSrcSurface,pDstSurface,IVSize,pIV) ) + +#define ID3D11VideoContext2_DecryptionBlt(This,pCryptoSession,pSrcSurface,pDstSurface,pEncryptedBlockInfo,ContentKeySize,pContentKey,IVSize,pIV) \ + ( (This)->lpVtbl -> DecryptionBlt(This,pCryptoSession,pSrcSurface,pDstSurface,pEncryptedBlockInfo,ContentKeySize,pContentKey,IVSize,pIV) ) + +#define ID3D11VideoContext2_StartSessionKeyRefresh(This,pCryptoSession,RandomNumberSize,pRandomNumber) \ + ( (This)->lpVtbl -> StartSessionKeyRefresh(This,pCryptoSession,RandomNumberSize,pRandomNumber) ) + +#define ID3D11VideoContext2_FinishSessionKeyRefresh(This,pCryptoSession) \ + ( (This)->lpVtbl -> FinishSessionKeyRefresh(This,pCryptoSession) ) + +#define ID3D11VideoContext2_GetEncryptionBltKey(This,pCryptoSession,KeySize,pReadbackKey) \ + ( (This)->lpVtbl -> GetEncryptionBltKey(This,pCryptoSession,KeySize,pReadbackKey) ) + +#define ID3D11VideoContext2_NegotiateAuthenticatedChannelKeyExchange(This,pChannel,DataSize,pData) \ + ( (This)->lpVtbl -> NegotiateAuthenticatedChannelKeyExchange(This,pChannel,DataSize,pData) ) + +#define ID3D11VideoContext2_QueryAuthenticatedChannel(This,pChannel,InputSize,pInput,OutputSize,pOutput) \ + ( (This)->lpVtbl -> QueryAuthenticatedChannel(This,pChannel,InputSize,pInput,OutputSize,pOutput) ) + +#define ID3D11VideoContext2_ConfigureAuthenticatedChannel(This,pChannel,InputSize,pInput,pOutput) \ + ( (This)->lpVtbl -> ConfigureAuthenticatedChannel(This,pChannel,InputSize,pInput,pOutput) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamRotation(This,pVideoProcessor,StreamIndex,Enable,Rotation) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamRotation(This,pVideoProcessor,StreamIndex,Enable,Rotation) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamRotation(This,pVideoProcessor,StreamIndex,pEnable,pRotation) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamRotation(This,pVideoProcessor,StreamIndex,pEnable,pRotation) ) + + +#define ID3D11VideoContext2_SubmitDecoderBuffers1(This,pDecoder,NumBuffers,pBufferDesc) \ + ( (This)->lpVtbl -> SubmitDecoderBuffers1(This,pDecoder,NumBuffers,pBufferDesc) ) + +#define ID3D11VideoContext2_GetDataForNewHardwareKey(This,pCryptoSession,PrivateInputSize,pPrivatInputData,pPrivateOutputData) \ + ( (This)->lpVtbl -> GetDataForNewHardwareKey(This,pCryptoSession,PrivateInputSize,pPrivatInputData,pPrivateOutputData) ) + +#define ID3D11VideoContext2_CheckCryptoSessionStatus(This,pCryptoSession,pStatus) \ + ( (This)->lpVtbl -> CheckCryptoSessionStatus(This,pCryptoSession,pStatus) ) + +#define ID3D11VideoContext2_DecoderEnableDownsampling(This,pDecoder,InputColorSpace,pOutputDesc,ReferenceFrameCount) \ + ( (This)->lpVtbl -> DecoderEnableDownsampling(This,pDecoder,InputColorSpace,pOutputDesc,ReferenceFrameCount) ) + +#define ID3D11VideoContext2_DecoderUpdateDownsampling(This,pDecoder,pOutputDesc) \ + ( (This)->lpVtbl -> DecoderUpdateDownsampling(This,pDecoder,pOutputDesc) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputColorSpace1(This,pVideoProcessor,ColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputColorSpace1(This,pVideoProcessor,ColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorSetOutputShaderUsage(This,pVideoProcessor,ShaderUsage) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputShaderUsage(This,pVideoProcessor,ShaderUsage) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputColorSpace1(This,pVideoProcessor,pColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputColorSpace1(This,pVideoProcessor,pColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputShaderUsage(This,pVideoProcessor,pShaderUsage) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputShaderUsage(This,pVideoProcessor,pShaderUsage) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamColorSpace1(This,pVideoProcessor,StreamIndex,ColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamColorSpace1(This,pVideoProcessor,StreamIndex,ColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamMirror(This,pVideoProcessor,StreamIndex,Enable,FlipHorizontal,FlipVertical) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamMirror(This,pVideoProcessor,StreamIndex,Enable,FlipHorizontal,FlipVertical) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamColorSpace1(This,pVideoProcessor,StreamIndex,pColorSpace) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamColorSpace1(This,pVideoProcessor,StreamIndex,pColorSpace) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamMirror(This,pVideoProcessor,StreamIndex,pEnable,pFlipHorizontal,pFlipVertical) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamMirror(This,pVideoProcessor,StreamIndex,pEnable,pFlipHorizontal,pFlipVertical) ) + +#define ID3D11VideoContext2_VideoProcessorGetBehaviorHints(This,pVideoProcessor,OutputWidth,OutputHeight,OutputFormat,StreamCount,pStreams,pBehaviorHints) \ + ( (This)->lpVtbl -> VideoProcessorGetBehaviorHints(This,pVideoProcessor,OutputWidth,OutputHeight,OutputFormat,StreamCount,pStreams,pBehaviorHints) ) + + +#define ID3D11VideoContext2_VideoProcessorSetOutputHDRMetaData(This,pVideoProcessor,Type,Size,pHDRMetaData) \ + ( (This)->lpVtbl -> VideoProcessorSetOutputHDRMetaData(This,pVideoProcessor,Type,Size,pHDRMetaData) ) + +#define ID3D11VideoContext2_VideoProcessorGetOutputHDRMetaData(This,pVideoProcessor,pType,Size,pMetaData) \ + ( (This)->lpVtbl -> VideoProcessorGetOutputHDRMetaData(This,pVideoProcessor,pType,Size,pMetaData) ) + +#define ID3D11VideoContext2_VideoProcessorSetStreamHDRMetaData(This,pVideoProcessor,StreamIndex,Type,Size,pHDRMetaData) \ + ( (This)->lpVtbl -> VideoProcessorSetStreamHDRMetaData(This,pVideoProcessor,StreamIndex,Type,Size,pHDRMetaData) ) + +#define ID3D11VideoContext2_VideoProcessorGetStreamHDRMetaData(This,pVideoProcessor,StreamIndex,pType,Size,pMetaData) \ + ( (This)->lpVtbl -> VideoProcessorGetStreamHDRMetaData(This,pVideoProcessor,StreamIndex,pType,Size,pMetaData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D11VideoContext2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d11_4_0000_0004 */ +/* [local] */ + +typedef struct D3D11_FEATURE_DATA_D3D11_OPTIONS4 + { + BOOL ExtendedNV12SharedTextureSupported; + } D3D11_FEATURE_DATA_D3D11_OPTIONS4; + +DEFINE_GUID(IID_ID3D11Device4,0x8992ab71,0x02e6,0x4b8d,0xba,0x48,0xb0,0x56,0xdc,0xda,0x42,0xc4); +DEFINE_GUID(IID_ID3D11Device5,0x8ffde202,0xa0e7,0x45df,0x9e,0x01,0xe8,0x37,0x80,0x1b,0x5e,0xa0); +DEFINE_GUID(IID_ID3D11Multithread,0x9B7E4E00,0x342C,0x4106,0xA1,0x9F,0x4F,0x27,0x04,0xF6,0x89,0xF0); +DEFINE_GUID(IID_ID3D11VideoContext2,0xC4E7374C,0x6243,0x4D1B,0xAE,0x87,0x52,0xB4,0xF7,0x40,0xE2,0x61); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d11_4_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d11_4_0000_0004_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11sdklayers.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11sdklayers.h index 903163ba2c1..f22c9956bc5 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11sdklayers.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11sdklayers.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -1522,7 +1522,8 @@ enum D3D11_MESSAGE_ID D3D11_MESSAGE_ID_ENQUEUESETEVENT_OUTOFMEMORY_RETURN = ( D3D11_MESSAGE_ID_ENQUEUESETEVENT_INVALIDARG_RETURN + 1 ) , D3D11_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN = ( D3D11_MESSAGE_ID_ENQUEUESETEVENT_OUTOFMEMORY_RETURN + 1 ) , D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE = ( D3D11_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN + 1 ) , - D3D11_MESSAGE_ID_D3D11_MESSAGES_END = ( D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE + 1 ) , + D3D11_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT = ( D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE + 1 ) , + D3D11_MESSAGE_ID_D3D11_MESSAGES_END = ( D3D11_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT + 1 ) , D3D11_MESSAGE_ID_D3D11_1_MESSAGES_START = 0x300000, D3D11_MESSAGE_ID_CREATE_VIDEODECODER = ( D3D11_MESSAGE_ID_D3D11_1_MESSAGES_START + 1 ) , D3D11_MESSAGE_ID_CREATE_VIDEOPROCESSORENUM = ( D3D11_MESSAGE_ID_CREATE_VIDEODECODER + 1 ) , @@ -1911,7 +1912,8 @@ enum D3D11_MESSAGE_ID D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT + 1 ) , D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT + 1 ) , D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT + 1 ) , - D3D11_MESSAGE_ID_D3D11_1_MESSAGES_END = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT + 1 ) , + D3D11_MESSAGE_ID_GETCRYPTOSESSIONPRIVATEDATASIZE_INVALID_KEY_EXCHANGE_TYPE = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT + 1 ) , + D3D11_MESSAGE_ID_D3D11_1_MESSAGES_END = ( D3D11_MESSAGE_ID_GETCRYPTOSESSIONPRIVATEDATASIZE_INVALID_KEY_EXCHANGE_TYPE + 1 ) , D3D11_MESSAGE_ID_D3D11_2_MESSAGES_START = ( D3D11_MESSAGE_ID_D3D11_1_MESSAGES_END + 1 ) , D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDUSAGE = ( D3D11_MESSAGE_ID_D3D11_2_MESSAGES_START + 1 ) , D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDUSAGE = ( D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDUSAGE + 1 ) , @@ -2018,7 +2020,35 @@ enum D3D11_MESSAGE_ID D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = ( D3D11_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED + 1 ) , D3D11_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = ( D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY + 1 ) , D3D11_MESSAGE_ID_DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT = ( D3D11_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE + 1 ) , - D3D11_MESSAGE_ID_D3D11_3_MESSAGES_END = ( D3D11_MESSAGE_ID_DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT + 1 ) + D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTHDRMETADATA_NULLPARAM = ( D3D11_MESSAGE_ID_DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTHDRMETADATA_INVALIDSIZE = ( D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTHDRMETADATA_NULLPARAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTHDRMETADATA_NULLPARAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTHDRMETADATA_INVALIDSIZE + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTHDRMETADATA_INVALIDSIZE = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTHDRMETADATA_NULLPARAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_NULLPARAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTHDRMETADATA_INVALIDSIZE + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_NULLPARAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSIZE = ( D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_NULLPARAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSIZE + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_NULLPARAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSIZE = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFRAMEFORMAT_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSIZE + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFRAMEFORMAT_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMOUTPUTRATE_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSOURCERECT_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMOUTPUTRATE_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMDESTRECT_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSOURCERECT_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMALPHA_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMDESTRECT_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPALETTE_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMALPHA_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPALETTE_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMLUMAKEY_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSTEREOFORMAT_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMLUMAKEY_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSTEREOFORMAT_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFILTER_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMROTATION_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFILTER_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMROTATION_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_INVALIDSTREAM = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_CREATE_FENCE = ( D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_INVALIDSTREAM + 1 ) , + D3D11_MESSAGE_ID_LIVE_FENCE = ( D3D11_MESSAGE_ID_CREATE_FENCE + 1 ) , + D3D11_MESSAGE_ID_DESTROY_FENCE = ( D3D11_MESSAGE_ID_LIVE_FENCE + 1 ) , + D3D11_MESSAGE_ID_D3D11_3_MESSAGES_END = ( D3D11_MESSAGE_ID_DESTROY_FENCE + 1 ) } D3D11_MESSAGE_ID; typedef struct D3D11_MESSAGE diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11shadertracing.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11shadertracing.h index d06a785a1c4..95528f4374b 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11shadertracing.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d11shadertracing.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12.h index bf7f76852dd..2f9bdcc7a69 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ @@ -71,6 +71,13 @@ typedef interface ID3D12RootSignatureDeserializer ID3D12RootSignatureDeserialize #endif /* __ID3D12RootSignatureDeserializer_FWD_DEFINED__ */ +#ifndef __ID3D12VersionedRootSignatureDeserializer_FWD_DEFINED__ +#define __ID3D12VersionedRootSignatureDeserializer_FWD_DEFINED__ +typedef interface ID3D12VersionedRootSignatureDeserializer ID3D12VersionedRootSignatureDeserializer; + +#endif /* __ID3D12VersionedRootSignatureDeserializer_FWD_DEFINED__ */ + + #ifndef __ID3D12Pageable_FWD_DEFINED__ #define __ID3D12Pageable_FWD_DEFINED__ typedef interface ID3D12Pageable ID3D12Pageable; @@ -106,6 +113,13 @@ typedef interface ID3D12Fence ID3D12Fence; #endif /* __ID3D12Fence_FWD_DEFINED__ */ +#ifndef __ID3D12Fence1_FWD_DEFINED__ +#define __ID3D12Fence1_FWD_DEFINED__ +typedef interface ID3D12Fence1 ID3D12Fence1; + +#endif /* __ID3D12Fence1_FWD_DEFINED__ */ + + #ifndef __ID3D12PipelineState_FWD_DEFINED__ #define __ID3D12PipelineState_FWD_DEFINED__ typedef interface ID3D12PipelineState ID3D12PipelineState; @@ -148,6 +162,20 @@ typedef interface ID3D12GraphicsCommandList ID3D12GraphicsCommandList; #endif /* __ID3D12GraphicsCommandList_FWD_DEFINED__ */ +#ifndef __ID3D12GraphicsCommandList1_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList1_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList1 ID3D12GraphicsCommandList1; + +#endif /* __ID3D12GraphicsCommandList1_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList2_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList2_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList2 ID3D12GraphicsCommandList2; + +#endif /* __ID3D12GraphicsCommandList2_FWD_DEFINED__ */ + + #ifndef __ID3D12CommandQueue_FWD_DEFINED__ #define __ID3D12CommandQueue_FWD_DEFINED__ typedef interface ID3D12CommandQueue ID3D12CommandQueue; @@ -162,10 +190,151 @@ typedef interface ID3D12Device ID3D12Device; #endif /* __ID3D12Device_FWD_DEFINED__ */ +#ifndef __ID3D12PipelineLibrary_FWD_DEFINED__ +#define __ID3D12PipelineLibrary_FWD_DEFINED__ +typedef interface ID3D12PipelineLibrary ID3D12PipelineLibrary; + +#endif /* __ID3D12PipelineLibrary_FWD_DEFINED__ */ + + +#ifndef __ID3D12PipelineLibrary1_FWD_DEFINED__ +#define __ID3D12PipelineLibrary1_FWD_DEFINED__ +typedef interface ID3D12PipelineLibrary1 ID3D12PipelineLibrary1; + +#endif /* __ID3D12PipelineLibrary1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device1_FWD_DEFINED__ +#define __ID3D12Device1_FWD_DEFINED__ +typedef interface ID3D12Device1 ID3D12Device1; + +#endif /* __ID3D12Device1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device2_FWD_DEFINED__ +#define __ID3D12Device2_FWD_DEFINED__ +typedef interface ID3D12Device2 ID3D12Device2; + +#endif /* __ID3D12Device2_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device3_FWD_DEFINED__ +#define __ID3D12Device3_FWD_DEFINED__ +typedef interface ID3D12Device3 ID3D12Device3; + +#endif /* __ID3D12Device3_FWD_DEFINED__ */ + + +#ifndef __ID3D12ProtectedSession_FWD_DEFINED__ +#define __ID3D12ProtectedSession_FWD_DEFINED__ +typedef interface ID3D12ProtectedSession ID3D12ProtectedSession; + +#endif /* __ID3D12ProtectedSession_FWD_DEFINED__ */ + + +#ifndef __ID3D12ProtectedResourceSession_FWD_DEFINED__ +#define __ID3D12ProtectedResourceSession_FWD_DEFINED__ +typedef interface ID3D12ProtectedResourceSession ID3D12ProtectedResourceSession; + +#endif /* __ID3D12ProtectedResourceSession_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device4_FWD_DEFINED__ +#define __ID3D12Device4_FWD_DEFINED__ +typedef interface ID3D12Device4 ID3D12Device4; + +#endif /* __ID3D12Device4_FWD_DEFINED__ */ + + +#ifndef __ID3D12LifetimeOwner_FWD_DEFINED__ +#define __ID3D12LifetimeOwner_FWD_DEFINED__ +typedef interface ID3D12LifetimeOwner ID3D12LifetimeOwner; + +#endif /* __ID3D12LifetimeOwner_FWD_DEFINED__ */ + + +#ifndef __ID3D12SwapChainAssistant_FWD_DEFINED__ +#define __ID3D12SwapChainAssistant_FWD_DEFINED__ +typedef interface ID3D12SwapChainAssistant ID3D12SwapChainAssistant; + +#endif /* __ID3D12SwapChainAssistant_FWD_DEFINED__ */ + + +#ifndef __ID3D12LifetimeTracker_FWD_DEFINED__ +#define __ID3D12LifetimeTracker_FWD_DEFINED__ +typedef interface ID3D12LifetimeTracker ID3D12LifetimeTracker; + +#endif /* __ID3D12LifetimeTracker_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObject_FWD_DEFINED__ +#define __ID3D12StateObject_FWD_DEFINED__ +typedef interface ID3D12StateObject ID3D12StateObject; + +#endif /* __ID3D12StateObject_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObjectProperties_FWD_DEFINED__ +#define __ID3D12StateObjectProperties_FWD_DEFINED__ +typedef interface ID3D12StateObjectProperties ID3D12StateObjectProperties; + +#endif /* __ID3D12StateObjectProperties_FWD_DEFINED__ */ + + +#ifndef __ID3D12Device5_FWD_DEFINED__ +#define __ID3D12Device5_FWD_DEFINED__ +typedef interface ID3D12Device5 ID3D12Device5; + +#endif /* __ID3D12Device5_FWD_DEFINED__ */ + + +#ifndef __ID3D12Resource1_FWD_DEFINED__ +#define __ID3D12Resource1_FWD_DEFINED__ +typedef interface ID3D12Resource1 ID3D12Resource1; + +#endif /* __ID3D12Resource1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Heap1_FWD_DEFINED__ +#define __ID3D12Heap1_FWD_DEFINED__ +typedef interface ID3D12Heap1 ID3D12Heap1; + +#endif /* __ID3D12Heap1_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList3_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList3_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList3 ID3D12GraphicsCommandList3; + +#endif /* __ID3D12GraphicsCommandList3_FWD_DEFINED__ */ + + +#ifndef __ID3D12MetaCommand_FWD_DEFINED__ +#define __ID3D12MetaCommand_FWD_DEFINED__ +typedef interface ID3D12MetaCommand ID3D12MetaCommand; + +#endif /* __ID3D12MetaCommand_FWD_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList4_FWD_DEFINED__ +#define __ID3D12GraphicsCommandList4_FWD_DEFINED__ +typedef interface ID3D12GraphicsCommandList4 ID3D12GraphicsCommandList4; + +#endif /* __ID3D12GraphicsCommandList4_FWD_DEFINED__ */ + + +#ifndef __ID3D12Tools_FWD_DEFINED__ +#define __ID3D12Tools_FWD_DEFINED__ +typedef interface ID3D12Tools ID3D12Tools; + +#endif /* __ID3D12Tools_FWD_DEFINED__ */ + + /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" -#include "dxgi.h" +#include "dxgicommon.h" +#include "dxgiformat.h" #include "d3dcommon.h" #ifdef __cplusplus @@ -176,6 +345,9 @@ extern "C"{ /* interface __MIDL_itf_d3d12_0000_0000 */ /* [local] */ +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #ifndef _D3D12_CONSTANTS #define _D3D12_CONSTANTS #define D3D12_16BIT_INDEX_STRIP_CUT_VALUE ( 0xffff ) @@ -665,6 +837,8 @@ extern "C"{ #define D3D12_MAX_TEXTURE_DIMENSION_2_TO_EXP ( 17 ) +#define D3D12_MAX_VIEW_INSTANCE_COUNT ( 4 ) + #define D3D12_MINOR_VERSION ( 0 ) #define D3D12_MIN_BORDER_COLOR_COMPONENT ( 0.0f ) @@ -736,6 +910,22 @@ extern "C"{ #define D3D12_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT ( 0.5f ) #define D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT ( 16 ) +#define D3D12_RAYTRACING_AABB_BYTE_ALIGNMENT ( 8 ) + +#define D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT ( 256 ) + +#define D3D12_RAYTRACING_INSTANCE_DESCS_BYTE_ALIGNMENT ( 16 ) + +#define D3D12_RAYTRACING_MAX_ATTRIBUTE_SIZE_IN_BYTES ( 32 ) + +#define D3D12_RAYTRACING_MAX_DECLARABLE_TRACE_RECURSION_DEPTH ( 31 ) + +#define D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT ( 32 ) + +#define D3D12_RAYTRACING_SHADER_TABLE_BYTE_ALIGNMENT ( 64 ) + +#define D3D12_RAYTRACING_TRANSFORM3X4_BYTE_ALIGNMENT ( 16 ) + #define D3D12_REQ_BLEND_OBJECT_COUNT_PER_DEVICE ( 4096 ) #define D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP ( 27 ) @@ -791,6 +981,8 @@ extern "C"{ #define D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES ( 0xffffffff ) +#define D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES ( 32 ) + #define D3D12_SHADER_MAJOR_VERSION ( 5 ) #define D3D12_SHADER_MAX_INSTANCES ( 65535 ) @@ -887,12 +1079,28 @@ extern "C"{ #define D3D12_TILED_RESOURCE_TILE_SIZE_IN_BYTES ( 65536 ) +#define D3D12_TRACKED_WORKLOAD_MAX_INSTANCES ( 32 ) + #define D3D12_UAV_COUNTER_PLACEMENT_ALIGNMENT ( 4096 ) #define D3D12_UAV_SLOT_COUNT ( 64 ) #define D3D12_UNBOUND_MEMORY_ACCESS_RESULT ( 0 ) +#define D3D12_VIDEO_DECODE_MAX_ARGUMENTS ( 10 ) + +#define D3D12_VIDEO_DECODE_MAX_HISTOGRAM_COMPONENTS ( 4 ) + +#define D3D12_VIDEO_DECODE_MIN_BITSTREAM_OFFSET_ALIGNMENT ( 256 ) + +#define D3D12_VIDEO_DECODE_MIN_HISTOGRAM_OFFSET_ALIGNMENT ( 256 ) + +#define D3D12_VIDEO_DECODE_STATUS_MACROBLOCKS_AFFECTED_UNKNOWN ( 0xffffffff ) + +#define D3D12_VIDEO_PROCESS_MAX_FILTERS ( 32 ) + +#define D3D12_VIDEO_PROCESS_STEREO_VIEWS ( 2 ) + #define D3D12_VIEWPORT_AND_SCISSORRECT_MAX_INDEX ( 15 ) #define D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE ( 16 ) @@ -933,7 +1141,9 @@ enum D3D12_COMMAND_LIST_TYPE D3D12_COMMAND_LIST_TYPE_DIRECT = 0, D3D12_COMMAND_LIST_TYPE_BUNDLE = 1, D3D12_COMMAND_LIST_TYPE_COMPUTE = 2, - D3D12_COMMAND_LIST_TYPE_COPY = 3 + D3D12_COMMAND_LIST_TYPE_COPY = 3, + D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE = 4, + D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS = 5 } D3D12_COMMAND_LIST_TYPE; typedef @@ -948,7 +1158,8 @@ typedef enum D3D12_COMMAND_QUEUE_PRIORITY { D3D12_COMMAND_QUEUE_PRIORITY_NORMAL = 0, - D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100 + D3D12_COMMAND_QUEUE_PRIORITY_HIGH = 100, + D3D12_COMMAND_QUEUE_PRIORITY_GLOBAL_REALTIME = 10000 } D3D12_COMMAND_QUEUE_PRIORITY; typedef struct D3D12_COMMAND_QUEUE_DESC @@ -1091,6 +1302,19 @@ typedef struct D3D12_DEPTH_STENCIL_DESC D3D12_DEPTH_STENCILOP_DESC BackFace; } D3D12_DEPTH_STENCIL_DESC; +typedef struct D3D12_DEPTH_STENCIL_DESC1 + { + BOOL DepthEnable; + D3D12_DEPTH_WRITE_MASK DepthWriteMask; + D3D12_COMPARISON_FUNC DepthFunc; + BOOL StencilEnable; + UINT8 StencilReadMask; + UINT8 StencilWriteMask; + D3D12_DEPTH_STENCILOP_DESC FrontFace; + D3D12_DEPTH_STENCILOP_DESC BackFace; + BOOL DepthBoundsTestEnable; + } D3D12_DEPTH_STENCIL_DESC1; + typedef enum D3D12_BLEND { @@ -1630,16 +1854,70 @@ typedef struct D3D12_COMPUTE_PIPELINE_STATE_DESC D3D12_PIPELINE_STATE_FLAGS Flags; } D3D12_COMPUTE_PIPELINE_STATE_DESC; +struct D3D12_RT_FORMAT_ARRAY + { + DXGI_FORMAT RTFormats[ 8 ]; + UINT NumRenderTargets; + } ; +typedef struct D3D12_PIPELINE_STATE_STREAM_DESC + { + _In_ SIZE_T SizeInBytes; + _In_reads_(_Inexpressible_("Dependent on size of subobjects")) void *pPipelineStateSubobjectStream; + } D3D12_PIPELINE_STATE_STREAM_DESC; + +typedef +enum D3D12_PIPELINE_STATE_SUBOBJECT_TYPE + { + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE = 0, + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_HS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_GS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_STREAM_OUTPUT + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSO + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1 = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1 + 1 ) , + D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_MAX_VALID = ( D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_VIEW_INSTANCING + 1 ) + } D3D12_PIPELINE_STATE_SUBOBJECT_TYPE; + typedef enum D3D12_FEATURE { D3D12_FEATURE_D3D12_OPTIONS = 0, - D3D12_FEATURE_ARCHITECTURE = ( D3D12_FEATURE_D3D12_OPTIONS + 1 ) , - D3D12_FEATURE_FEATURE_LEVELS = ( D3D12_FEATURE_ARCHITECTURE + 1 ) , - D3D12_FEATURE_FORMAT_SUPPORT = ( D3D12_FEATURE_FEATURE_LEVELS + 1 ) , - D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS = ( D3D12_FEATURE_FORMAT_SUPPORT + 1 ) , - D3D12_FEATURE_FORMAT_INFO = ( D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS + 1 ) , - D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = ( D3D12_FEATURE_FORMAT_INFO + 1 ) + D3D12_FEATURE_ARCHITECTURE = 1, + D3D12_FEATURE_FEATURE_LEVELS = 2, + D3D12_FEATURE_FORMAT_SUPPORT = 3, + D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS = 4, + D3D12_FEATURE_FORMAT_INFO = 5, + D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = 6, + D3D12_FEATURE_SHADER_MODEL = 7, + D3D12_FEATURE_D3D12_OPTIONS1 = 8, + D3D12_FEATURE_PROTECTED_RESOURCE_SESSION_SUPPORT = 10, + D3D12_FEATURE_ROOT_SIGNATURE = 12, + D3D12_FEATURE_ARCHITECTURE1 = 16, + D3D12_FEATURE_D3D12_OPTIONS2 = 18, + D3D12_FEATURE_SHADER_CACHE = 19, + D3D12_FEATURE_COMMAND_QUEUE_PRIORITY = 20, + D3D12_FEATURE_D3D12_OPTIONS3 = 21, + D3D12_FEATURE_EXISTING_HEAPS = 22, + D3D12_FEATURE_D3D12_OPTIONS4 = 23, + D3D12_FEATURE_SERIALIZATION = 24, + D3D12_FEATURE_CROSS_NODE = 25, + D3D12_FEATURE_D3D12_OPTIONS5 = 27 } D3D12_FEATURE; typedef @@ -1657,7 +1935,8 @@ enum D3D12_TILED_RESOURCES_TIER D3D12_TILED_RESOURCES_TIER_NOT_SUPPORTED = 0, D3D12_TILED_RESOURCES_TIER_1 = 1, D3D12_TILED_RESOURCES_TIER_2 = 2, - D3D12_TILED_RESOURCES_TIER_3 = 3 + D3D12_TILED_RESOURCES_TIER_3 = 3, + D3D12_TILED_RESOURCES_TIER_4 = 4 } D3D12_TILED_RESOURCES_TIER; typedef @@ -1745,7 +2024,8 @@ enum D3D12_CROSS_NODE_SHARING_TIER D3D12_CROSS_NODE_SHARING_TIER_NOT_SUPPORTED = 0, D3D12_CROSS_NODE_SHARING_TIER_1_EMULATED = 1, D3D12_CROSS_NODE_SHARING_TIER_1 = 2, - D3D12_CROSS_NODE_SHARING_TIER_2 = 3 + D3D12_CROSS_NODE_SHARING_TIER_2 = 3, + D3D12_CROSS_NODE_SHARING_TIER_3 = 4 } D3D12_CROSS_NODE_SHARING_TIER; typedef @@ -1755,6 +2035,23 @@ enum D3D12_RESOURCE_HEAP_TIER D3D12_RESOURCE_HEAP_TIER_2 = 2 } D3D12_RESOURCE_HEAP_TIER; +typedef +enum D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER + { + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_NOT_SUPPORTED = 0, + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_1 = 1, + D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER_2 = 2 + } D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER; + +typedef +enum D3D12_VIEW_INSTANCING_TIER + { + D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, + D3D12_VIEW_INSTANCING_TIER_1 = 1, + D3D12_VIEW_INSTANCING_TIER_2 = 2, + D3D12_VIEW_INSTANCING_TIER_3 = 3 + } D3D12_VIEW_INSTANCING_TIER; + typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS { _Out_ BOOL DoublePrecisionFloatShaderOps; @@ -1774,6 +2071,35 @@ typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS _Out_ D3D12_RESOURCE_HEAP_TIER ResourceHeapTier; } D3D12_FEATURE_DATA_D3D12_OPTIONS; +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS1 + { + _Out_ BOOL WaveOps; + _Out_ UINT WaveLaneCountMin; + _Out_ UINT WaveLaneCountMax; + _Out_ UINT TotalLaneCount; + _Out_ BOOL ExpandedComputeResourceStates; + _Out_ BOOL Int64ShaderOps; + } D3D12_FEATURE_DATA_D3D12_OPTIONS1; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS2 + { + _Out_ BOOL DepthBoundsTestSupported; + _Out_ D3D12_PROGRAMMABLE_SAMPLE_POSITIONS_TIER ProgrammableSamplePositionsTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS2; + +typedef +enum D3D_ROOT_SIGNATURE_VERSION + { + D3D_ROOT_SIGNATURE_VERSION_1 = 0x1, + D3D_ROOT_SIGNATURE_VERSION_1_0 = 0x1, + D3D_ROOT_SIGNATURE_VERSION_1_1 = 0x2 + } D3D_ROOT_SIGNATURE_VERSION; + +typedef struct D3D12_FEATURE_DATA_ROOT_SIGNATURE + { + _Inout_ D3D_ROOT_SIGNATURE_VERSION HighestVersion; + } D3D12_FEATURE_DATA_ROOT_SIGNATURE; + typedef struct D3D12_FEATURE_DATA_ARCHITECTURE { _In_ UINT NodeIndex; @@ -1782,6 +2108,15 @@ typedef struct D3D12_FEATURE_DATA_ARCHITECTURE _Out_ BOOL CacheCoherentUMA; } D3D12_FEATURE_DATA_ARCHITECTURE; +typedef struct D3D12_FEATURE_DATA_ARCHITECTURE1 + { + _In_ UINT NodeIndex; + _Out_ BOOL TileBasedRenderer; + _Out_ BOOL UMA; + _Out_ BOOL CacheCoherentUMA; + _Out_ BOOL IsolatedMMU; + } D3D12_FEATURE_DATA_ARCHITECTURE1; + typedef struct D3D12_FEATURE_DATA_FEATURE_LEVELS { _In_ UINT NumFeatureLevels; @@ -1789,6 +2124,22 @@ typedef struct D3D12_FEATURE_DATA_FEATURE_LEVELS _Out_ D3D_FEATURE_LEVEL MaxSupportedFeatureLevel; } D3D12_FEATURE_DATA_FEATURE_LEVELS; +typedef +enum D3D_SHADER_MODEL + { + D3D_SHADER_MODEL_5_1 = 0x51, + D3D_SHADER_MODEL_6_0 = 0x60, + D3D_SHADER_MODEL_6_1 = 0x61, + D3D_SHADER_MODEL_6_2 = 0x62, + D3D_SHADER_MODEL_6_3 = 0x63, + D3D_SHADER_MODEL_6_4 = 0x64 + } D3D_SHADER_MODEL; + +typedef struct D3D12_FEATURE_DATA_SHADER_MODEL + { + _Inout_ D3D_SHADER_MODEL HighestShaderModel; + } D3D12_FEATURE_DATA_SHADER_MODEL; + typedef struct D3D12_FEATURE_DATA_FORMAT_SUPPORT { _In_ DXGI_FORMAT Format; @@ -1816,12 +2167,124 @@ typedef struct D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT UINT MaxGPUVirtualAddressBitsPerProcess; } D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT; +typedef +enum D3D12_SHADER_CACHE_SUPPORT_FLAGS + { + D3D12_SHADER_CACHE_SUPPORT_NONE = 0, + D3D12_SHADER_CACHE_SUPPORT_SINGLE_PSO = 0x1, + D3D12_SHADER_CACHE_SUPPORT_LIBRARY = 0x2, + D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = 0x4, + D3D12_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = 0x8 + } D3D12_SHADER_CACHE_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_SHADER_CACHE_SUPPORT_FLAGS ); +typedef struct D3D12_FEATURE_DATA_SHADER_CACHE + { + _Out_ D3D12_SHADER_CACHE_SUPPORT_FLAGS SupportFlags; + } D3D12_FEATURE_DATA_SHADER_CACHE; + +typedef struct D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY + { + _In_ D3D12_COMMAND_LIST_TYPE CommandListType; + _In_ UINT Priority; + _Out_ BOOL PriorityForTypeIsSupported; + } D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY; + +typedef +enum D3D12_COMMAND_LIST_SUPPORT_FLAGS + { + D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, + D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = ( 1 << D3D12_COMMAND_LIST_TYPE_DIRECT ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = ( 1 << D3D12_COMMAND_LIST_TYPE_BUNDLE ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = ( 1 << D3D12_COMMAND_LIST_TYPE_COMPUTE ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = ( 1 << D3D12_COMMAND_LIST_TYPE_COPY ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = ( 1 << D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE ) , + D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = ( 1 << D3D12_COMMAND_LIST_TYPE_VIDEO_PROCESS ) + } D3D12_COMMAND_LIST_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_LIST_SUPPORT_FLAGS ); +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 + { + _Out_ BOOL CopyQueueTimestampQueriesSupported; + _Out_ BOOL CastingFullyTypedFormatSupported; + _Out_ D3D12_COMMAND_LIST_SUPPORT_FLAGS WriteBufferImmediateSupportFlags; + _Out_ D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; + _Out_ BOOL BarycentricsSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS3; + +typedef struct D3D12_FEATURE_DATA_EXISTING_HEAPS + { + _Out_ BOOL Supported; + } D3D12_FEATURE_DATA_EXISTING_HEAPS; + +typedef +enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER + { + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0 = 0, + D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1 = ( D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0 + 1 ) + } D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 + { + _Out_ BOOL MSAA64KBAlignedTextureSupported; + _Out_ D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; + _Out_ BOOL Native16BitShaderOpsSupported; + } D3D12_FEATURE_DATA_D3D12_OPTIONS4; + +typedef +enum D3D12_HEAP_SERIALIZATION_TIER + { + D3D12_HEAP_SERIALIZATION_TIER_0 = 0, + D3D12_HEAP_SERIALIZATION_TIER_10 = 10 + } D3D12_HEAP_SERIALIZATION_TIER; + +typedef struct D3D12_FEATURE_DATA_SERIALIZATION + { + _In_ UINT NodeIndex; + _Out_ D3D12_HEAP_SERIALIZATION_TIER HeapSerializationTier; + } D3D12_FEATURE_DATA_SERIALIZATION; + +typedef struct D3D12_FEATURE_DATA_CROSS_NODE + { + D3D12_CROSS_NODE_SHARING_TIER SharingTier; + BOOL AtomicShaderInstructions; + } D3D12_FEATURE_DATA_CROSS_NODE; + +typedef +enum D3D12_RENDER_PASS_TIER + { + D3D12_RENDER_PASS_TIER_0 = 0, + D3D12_RENDER_PASS_TIER_1 = 1, + D3D12_RENDER_PASS_TIER_2 = 2 + } D3D12_RENDER_PASS_TIER; + +typedef +enum D3D12_RAYTRACING_TIER + { + D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, + D3D12_RAYTRACING_TIER_1_0 = 10 + } D3D12_RAYTRACING_TIER; + +typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 + { + _Out_ BOOL SRVOnlyTiledResourceTier3; + _Out_ D3D12_RENDER_PASS_TIER RenderPassesTier; + _Out_ D3D12_RAYTRACING_TIER RaytracingTier; + } D3D12_FEATURE_DATA_D3D12_OPTIONS5; + typedef struct D3D12_RESOURCE_ALLOCATION_INFO { UINT64 SizeInBytes; UINT64 Alignment; } D3D12_RESOURCE_ALLOCATION_INFO; +typedef struct D3D12_RESOURCE_ALLOCATION_INFO1 + { + UINT64 Offset; + UINT64 Alignment; + UINT64 SizeInBytes; + } D3D12_RESOURCE_ALLOCATION_INFO1; + typedef enum D3D12_HEAP_TYPE { @@ -1867,6 +2330,9 @@ enum D3D12_HEAP_FLAGS D3D12_HEAP_FLAG_SHARED_CROSS_ADAPTER = 0x20, D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES = 0x40, D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES = 0x80, + D3D12_HEAP_FLAG_HARDWARE_PROTECTED = 0x100, + D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH = 0x200, + D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS = 0x400, D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES = 0, D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS = 0xc0, D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES = 0x44, @@ -1910,7 +2376,8 @@ enum D3D12_RESOURCE_FLAGS D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS = 0x4, D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE = 0x8, D3D12_RESOURCE_FLAG_ALLOW_CROSS_ADAPTER = 0x10, - D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20 + D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS = 0x20, + D3D12_RESOURCE_FLAG_VIDEO_DECODE_REFERENCE_ONLY = 0x40 } D3D12_RESOURCE_FLAGS; DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESOURCE_FLAGS ); @@ -1950,6 +2417,18 @@ typedef struct D3D12_RANGE SIZE_T End; } D3D12_RANGE; +typedef struct D3D12_RANGE_UINT64 + { + UINT64 Begin; + UINT64 End; + } D3D12_RANGE_UINT64; + +typedef struct D3D12_SUBRESOURCE_RANGE_UINT64 + { + UINT Subresource; + D3D12_RANGE_UINT64 Range; + } D3D12_SUBRESOURCE_RANGE_UINT64; + typedef struct D3D12_SUBRESOURCE_INFO { UINT64 Offset; @@ -2042,9 +2521,16 @@ enum D3D12_RESOURCE_STATES D3D12_RESOURCE_STATE_COPY_SOURCE = 0x800, D3D12_RESOURCE_STATE_RESOLVE_DEST = 0x1000, D3D12_RESOURCE_STATE_RESOLVE_SOURCE = 0x2000, + D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE = 0x400000, D3D12_RESOURCE_STATE_GENERIC_READ = ( ( ( ( ( 0x1 | 0x2 ) | 0x40 ) | 0x80 ) | 0x200 ) | 0x800 ) , D3D12_RESOURCE_STATE_PRESENT = 0, - D3D12_RESOURCE_STATE_PREDICATION = 0x200 + D3D12_RESOURCE_STATE_PREDICATION = 0x200, + D3D12_RESOURCE_STATE_VIDEO_DECODE_READ = 0x10000, + D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE = 0x20000, + D3D12_RESOURCE_STATE_VIDEO_PROCESS_READ = 0x40000, + D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE = 0x80000, + D3D12_RESOURCE_STATE_VIDEO_ENCODE_READ = 0x200000, + D3D12_RESOURCE_STATE_VIDEO_ENCODE_WRITE = 0x800000 } D3D12_RESOURCE_STATES; DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESOURCE_STATES ); @@ -2130,6 +2616,42 @@ typedef struct D3D12_TEXTURE_COPY_LOCATION } ; } D3D12_TEXTURE_COPY_LOCATION; +typedef +enum D3D12_RESOLVE_MODE + { + D3D12_RESOLVE_MODE_DECOMPRESS = 0, + D3D12_RESOLVE_MODE_MIN = 1, + D3D12_RESOLVE_MODE_MAX = 2, + D3D12_RESOLVE_MODE_AVERAGE = 3 + } D3D12_RESOLVE_MODE; + +typedef struct D3D12_SAMPLE_POSITION + { + INT8 X; + INT8 Y; + } D3D12_SAMPLE_POSITION; + +typedef struct D3D12_VIEW_INSTANCE_LOCATION + { + UINT ViewportArrayIndex; + UINT RenderTargetArrayIndex; + } D3D12_VIEW_INSTANCE_LOCATION; + +typedef +enum D3D12_VIEW_INSTANCING_FLAGS + { + D3D12_VIEW_INSTANCING_FLAG_NONE = 0, + D3D12_VIEW_INSTANCING_FLAG_ENABLE_VIEW_INSTANCE_MASKING = 0x1 + } D3D12_VIEW_INSTANCING_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_VIEW_INSTANCING_FLAGS ); +typedef struct D3D12_VIEW_INSTANCING_DESC + { + UINT ViewInstanceCount; + _Field_size_full_(ViewInstanceCount) const D3D12_VIEW_INSTANCE_LOCATION *pViewInstanceLocations; + D3D12_VIEW_INSTANCING_FLAGS Flags; + } D3D12_VIEW_INSTANCING_DESC; + typedef enum D3D12_SHADER_COMPONENT_MAPPING { @@ -2235,6 +2757,11 @@ typedef struct D3D12_TEX2DMS_ARRAY_SRV UINT ArraySize; } D3D12_TEX2DMS_ARRAY_SRV; +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV + { + D3D12_GPU_VIRTUAL_ADDRESS Location; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV; + typedef enum D3D12_SRV_DIMENSION { @@ -2248,7 +2775,8 @@ enum D3D12_SRV_DIMENSION D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY = 7, D3D12_SRV_DIMENSION_TEXTURE3D = 8, D3D12_SRV_DIMENSION_TEXTURECUBE = 9, - D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10 + D3D12_SRV_DIMENSION_TEXTURECUBEARRAY = 10, + D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE = 11 } D3D12_SRV_DIMENSION; typedef struct D3D12_SHADER_RESOURCE_VIEW_DESC @@ -2268,6 +2796,7 @@ typedef struct D3D12_SHADER_RESOURCE_VIEW_DESC D3D12_TEX3D_SRV Texture3D; D3D12_TEXCUBE_SRV TextureCube; D3D12_TEXCUBE_ARRAY_SRV TextureCubeArray; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_SRV RaytracingAccelerationStructure; } ; } D3D12_SHADER_RESOURCE_VIEW_DESC; @@ -2647,7 +3176,8 @@ enum D3D12_FENCE_FLAGS { D3D12_FENCE_FLAG_NONE = 0, D3D12_FENCE_FLAG_SHARED = 0x1, - D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2 + D3D12_FENCE_FLAG_SHARED_CROSS_ADAPTER = 0x2, + D3D12_FENCE_FLAG_NON_MONITORED = 0x4 } D3D12_FENCE_FLAGS; DEFINE_ENUM_FLAG_OPERATORS( D3D12_FENCE_FLAGS ); @@ -2757,7 +3287,8 @@ enum D3D12_ROOT_SIGNATURE_FLAGS D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x8, D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10, D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20, - D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40 + D3D12_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40, + D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE = 0x80 } D3D12_ROOT_SIGNATURE_FLAGS; DEFINE_ENUM_FLAG_OPERATORS( D3D12_ROOT_SIGNATURE_FLAGS ); @@ -2796,10 +3327,80 @@ typedef struct D3D12_ROOT_SIGNATURE_DESC } D3D12_ROOT_SIGNATURE_DESC; typedef -enum D3D_ROOT_SIGNATURE_VERSION +enum D3D12_DESCRIPTOR_RANGE_FLAGS { - D3D_ROOT_SIGNATURE_VERSION_1 = 0x1 - } D3D_ROOT_SIGNATURE_VERSION; + D3D12_DESCRIPTOR_RANGE_FLAG_NONE = 0, + D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE = 0x1, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE = 0x2, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, + D3D12_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8, + D3D12_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS = 0x10000 + } D3D12_DESCRIPTOR_RANGE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DESCRIPTOR_RANGE_FLAGS ); +typedef struct D3D12_DESCRIPTOR_RANGE1 + { + D3D12_DESCRIPTOR_RANGE_TYPE RangeType; + UINT NumDescriptors; + UINT BaseShaderRegister; + UINT RegisterSpace; + D3D12_DESCRIPTOR_RANGE_FLAGS Flags; + UINT OffsetInDescriptorsFromTableStart; + } D3D12_DESCRIPTOR_RANGE1; + +typedef struct D3D12_ROOT_DESCRIPTOR_TABLE1 + { + UINT NumDescriptorRanges; + _Field_size_full_(NumDescriptorRanges) const D3D12_DESCRIPTOR_RANGE1 *pDescriptorRanges; + } D3D12_ROOT_DESCRIPTOR_TABLE1; + +typedef +enum D3D12_ROOT_DESCRIPTOR_FLAGS + { + D3D12_ROOT_DESCRIPTOR_FLAG_NONE = 0, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_VOLATILE = 0x2, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4, + D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC = 0x8 + } D3D12_ROOT_DESCRIPTOR_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_ROOT_DESCRIPTOR_FLAGS ); +typedef struct D3D12_ROOT_DESCRIPTOR1 + { + UINT ShaderRegister; + UINT RegisterSpace; + D3D12_ROOT_DESCRIPTOR_FLAGS Flags; + } D3D12_ROOT_DESCRIPTOR1; + +typedef struct D3D12_ROOT_PARAMETER1 + { + D3D12_ROOT_PARAMETER_TYPE ParameterType; + union + { + D3D12_ROOT_DESCRIPTOR_TABLE1 DescriptorTable; + D3D12_ROOT_CONSTANTS Constants; + D3D12_ROOT_DESCRIPTOR1 Descriptor; + } ; + D3D12_SHADER_VISIBILITY ShaderVisibility; + } D3D12_ROOT_PARAMETER1; + +typedef struct D3D12_ROOT_SIGNATURE_DESC1 + { + UINT NumParameters; + _Field_size_full_(NumParameters) const D3D12_ROOT_PARAMETER1 *pParameters; + UINT NumStaticSamplers; + _Field_size_full_(NumStaticSamplers) const D3D12_STATIC_SAMPLER_DESC *pStaticSamplers; + D3D12_ROOT_SIGNATURE_FLAGS Flags; + } D3D12_ROOT_SIGNATURE_DESC1; + +typedef struct D3D12_VERSIONED_ROOT_SIGNATURE_DESC + { + D3D_ROOT_SIGNATURE_VERSION Version; + union + { + D3D12_ROOT_SIGNATURE_DESC Desc_1_0; + D3D12_ROOT_SIGNATURE_DESC1 Desc_1_1; + } ; + } D3D12_VERSIONED_ROOT_SIGNATURE_DESC; @@ -2883,7 +3484,96 @@ EXTERN_C const IID IID_ID3D12RootSignatureDeserializer; #endif /* __ID3D12RootSignatureDeserializer_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_d3d12_0000_0002 */ +#ifndef __ID3D12VersionedRootSignatureDeserializer_INTERFACE_DEFINED__ +#define __ID3D12VersionedRootSignatureDeserializer_INTERFACE_DEFINED__ + +/* interface ID3D12VersionedRootSignatureDeserializer */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VersionedRootSignatureDeserializer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7F91CE67-090C-4BB7-B78E-ED8FF2E31DA0") + ID3D12VersionedRootSignatureDeserializer : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetRootSignatureDescAtVersion( + D3D_ROOT_SIGNATURE_VERSION convertToVersion, + _Out_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC **ppDesc) = 0; + + virtual const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *STDMETHODCALLTYPE GetUnconvertedRootSignatureDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VersionedRootSignatureDeserializerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VersionedRootSignatureDeserializer * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VersionedRootSignatureDeserializer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VersionedRootSignatureDeserializer * This); + + HRESULT ( STDMETHODCALLTYPE *GetRootSignatureDescAtVersion )( + ID3D12VersionedRootSignatureDeserializer * This, + D3D_ROOT_SIGNATURE_VERSION convertToVersion, + _Out_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC **ppDesc); + + const D3D12_VERSIONED_ROOT_SIGNATURE_DESC *( STDMETHODCALLTYPE *GetUnconvertedRootSignatureDesc )( + ID3D12VersionedRootSignatureDeserializer * This); + + END_INTERFACE + } ID3D12VersionedRootSignatureDeserializerVtbl; + + interface ID3D12VersionedRootSignatureDeserializer + { + CONST_VTBL struct ID3D12VersionedRootSignatureDeserializerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VersionedRootSignatureDeserializer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VersionedRootSignatureDeserializer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VersionedRootSignatureDeserializer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VersionedRootSignatureDeserializer_GetRootSignatureDescAtVersion(This,convertToVersion,ppDesc) \ + ( (This)->lpVtbl -> GetRootSignatureDescAtVersion(This,convertToVersion,ppDesc) ) + +#define ID3D12VersionedRootSignatureDeserializer_GetUnconvertedRootSignatureDesc(This) \ + ( (This)->lpVtbl -> GetUnconvertedRootSignatureDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VersionedRootSignatureDeserializer_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0003 */ /* [local] */ typedef HRESULT (WINAPI* PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)( @@ -2909,6 +3599,29 @@ HRESULT WINAPI D3D12CreateRootSignatureDeserializer( _In_ SIZE_T SrcDataSizeInBytes, _In_ REFIID pRootSignatureDeserializerInterface, _Out_ void** ppRootSignatureDeserializer); + +typedef HRESULT (WINAPI* PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE)( + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignature, + _Out_ ID3DBlob** ppBlob, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob); + +HRESULT WINAPI D3D12SerializeVersionedRootSignature( + _In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignature, + _Out_ ID3DBlob** ppBlob, + _Always_(_Outptr_opt_result_maybenull_) ID3DBlob** ppErrorBlob); + +typedef HRESULT (WINAPI* PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER)( + _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData, + _In_ SIZE_T SrcDataSizeInBytes, + _In_ REFIID pRootSignatureDeserializerInterface, + _Out_ void** ppRootSignatureDeserializer); + +HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializer( + _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData, + _In_ SIZE_T SrcDataSizeInBytes, + _In_ REFIID pRootSignatureDeserializerInterface, + _Out_ void** ppRootSignatureDeserializer); + typedef struct D3D12_CPU_DESCRIPTOR_HANDLE { SIZE_T ptr; @@ -2935,7 +3648,9 @@ enum D3D12_QUERY_HEAP_TYPE D3D12_QUERY_HEAP_TYPE_OCCLUSION = 0, D3D12_QUERY_HEAP_TYPE_TIMESTAMP = 1, D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS = 2, - D3D12_QUERY_HEAP_TYPE_SO_STATISTICS = 3 + D3D12_QUERY_HEAP_TYPE_SO_STATISTICS = 3, + D3D12_QUERY_HEAP_TYPE_VIDEO_DECODE_STATISTICS = 4, + D3D12_QUERY_HEAP_TYPE_COPY_QUEUE_TIMESTAMP = 5 } D3D12_QUERY_HEAP_TYPE; typedef struct D3D12_QUERY_HEAP_DESC @@ -2955,7 +3670,8 @@ enum D3D12_QUERY_TYPE D3D12_QUERY_TYPE_SO_STATISTICS_STREAM0 = 4, D3D12_QUERY_TYPE_SO_STATISTICS_STREAM1 = 5, D3D12_QUERY_TYPE_SO_STATISTICS_STREAM2 = 6, - D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3 = 7 + D3D12_QUERY_TYPE_SO_STATISTICS_STREAM3 = 7, + D3D12_QUERY_TYPE_VIDEO_DECODE_STATISTICS = 8 } D3D12_QUERY_TYPE; typedef @@ -3086,8 +3802,8 @@ typedef struct D3D12_COMMAND_SIGNATURE_DESC -extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0002_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0003_v0_0_s_ifspec; #ifndef __ID3D12Pageable_INTERFACE_DEFINED__ #define __ID3D12Pageable_INTERFACE_DEFINED__ @@ -3797,6 +4513,149 @@ EXTERN_C const IID IID_ID3D12Fence; #endif /* __ID3D12Fence_INTERFACE_DEFINED__ */ +#ifndef __ID3D12Fence1_INTERFACE_DEFINED__ +#define __ID3D12Fence1_INTERFACE_DEFINED__ + +/* interface ID3D12Fence1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Fence1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("433685fe-e22b-4ca0-a8db-b5b4f4dd0e4a") + ID3D12Fence1 : public ID3D12Fence + { + public: + virtual D3D12_FENCE_FLAGS STDMETHODCALLTYPE GetCreationFlags( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Fence1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Fence1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Fence1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Fence1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Fence1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Fence1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Fence1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Fence1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Fence1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + UINT64 ( STDMETHODCALLTYPE *GetCompletedValue )( + ID3D12Fence1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnCompletion )( + ID3D12Fence1 * This, + UINT64 Value, + HANDLE hEvent); + + HRESULT ( STDMETHODCALLTYPE *Signal )( + ID3D12Fence1 * This, + UINT64 Value); + + D3D12_FENCE_FLAGS ( STDMETHODCALLTYPE *GetCreationFlags )( + ID3D12Fence1 * This); + + END_INTERFACE + } ID3D12Fence1Vtbl; + + interface ID3D12Fence1 + { + CONST_VTBL struct ID3D12Fence1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Fence1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Fence1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Fence1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Fence1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Fence1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Fence1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Fence1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Fence1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Fence1_GetCompletedValue(This) \ + ( (This)->lpVtbl -> GetCompletedValue(This) ) + +#define ID3D12Fence1_SetEventOnCompletion(This,Value,hEvent) \ + ( (This)->lpVtbl -> SetEventOnCompletion(This,Value,hEvent) ) + +#define ID3D12Fence1_Signal(This,Value) \ + ( (This)->lpVtbl -> Signal(This,Value) ) + + +#define ID3D12Fence1_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Fence1_INTERFACE_DEFINED__ */ + + #ifndef __ID3D12PipelineState_INTERFACE_DEFINED__ #define __ID3D12PipelineState_INTERFACE_DEFINED__ @@ -4503,7 +5362,7 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; _In_reads_( NumRects) const D3D12_RECT *pRects) = 0; virtual void STDMETHODCALLTYPE OMSetBlendFactor( - _In_opt_ const FLOAT BlendFactor[ 4 ]) = 0; + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]) = 0; virtual void STDMETHODCALLTYPE OMSetStencilRef( _In_ UINT StencilRef) = 0; @@ -4520,13 +5379,13 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; virtual void STDMETHODCALLTYPE SetDescriptorHeaps( _In_ UINT NumDescriptorHeaps, - _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap **ppDescriptorHeaps) = 0; + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps) = 0; virtual void STDMETHODCALLTYPE SetComputeRootSignature( - _In_ ID3D12RootSignature *pRootSignature) = 0; + _In_opt_ ID3D12RootSignature *pRootSignature) = 0; virtual void STDMETHODCALLTYPE SetGraphicsRootSignature( - _In_ ID3D12RootSignature *pRootSignature) = 0; + _In_opt_ ID3D12RootSignature *pRootSignature) = 0; virtual void STDMETHODCALLTYPE SetComputeRootDescriptorTable( _In_ UINT RootParameterIndex, @@ -4597,7 +5456,7 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; virtual void STDMETHODCALLTYPE OMSetRenderTargets( _In_ UINT NumRenderTargetDescriptors, - _In_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, _In_ BOOL RTsSingleHandleToDescriptorRange, _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor) = 0; @@ -4815,7 +5674,7 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; void ( STDMETHODCALLTYPE *OMSetBlendFactor )( ID3D12GraphicsCommandList * This, - _In_opt_ const FLOAT BlendFactor[ 4 ]); + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); void ( STDMETHODCALLTYPE *OMSetStencilRef )( ID3D12GraphicsCommandList * This, @@ -4837,15 +5696,15 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( ID3D12GraphicsCommandList * This, _In_ UINT NumDescriptorHeaps, - _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap **ppDescriptorHeaps); + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); void ( STDMETHODCALLTYPE *SetComputeRootSignature )( ID3D12GraphicsCommandList * This, - _In_ ID3D12RootSignature *pRootSignature); + _In_opt_ ID3D12RootSignature *pRootSignature); void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( ID3D12GraphicsCommandList * This, - _In_ ID3D12RootSignature *pRootSignature); + _In_opt_ ID3D12RootSignature *pRootSignature); void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( ID3D12GraphicsCommandList * This, @@ -4932,7 +5791,7 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; void ( STDMETHODCALLTYPE *OMSetRenderTargets )( ID3D12GraphicsCommandList * This, _In_ UINT NumRenderTargetDescriptors, - _In_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, _In_ BOOL RTsSingleHandleToDescriptorRange, _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); @@ -5234,6 +6093,1358 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList; #endif /* __ID3D12GraphicsCommandList_INTERFACE_DEFINED__ */ +#ifndef __ID3D12GraphicsCommandList1_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList1_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("553103fb-1fe7-4557-bb38-946d7d0e7ca7") + ID3D12GraphicsCommandList1 : public ID3D12GraphicsCommandList + { + public: + virtual void STDMETHODCALLTYPE AtomicCopyBufferUINT( + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges) = 0; + + virtual void STDMETHODCALLTYPE AtomicCopyBufferUINT64( + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges) = 0; + + virtual void STDMETHODCALLTYPE OMSetDepthBounds( + _In_ FLOAT Min, + _In_ FLOAT Max) = 0; + + virtual void STDMETHODCALLTYPE SetSamplePositions( + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions) = 0; + + virtual void STDMETHODCALLTYPE ResolveSubresourceRegion( + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode) = 0; + + virtual void STDMETHODCALLTYPE SetViewInstanceMask( + _In_ UINT Mask) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList1 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList1 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList1 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList1 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT StencilRef); + + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList1 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList1 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList1 * This); + + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList1 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList1 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList1 * This, + _In_ UINT Mask); + + END_INTERFACE + } ID3D12GraphicsCommandList1Vtbl; + + interface ID3D12GraphicsCommandList1 + { + CONST_VTBL struct ID3D12GraphicsCommandList1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList1_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList1_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList1_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList1_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList1_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList1_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList1_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList1_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList1_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList1_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList1_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList1_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList1_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList1_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList1_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList1_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList1_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList1_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList1_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList1_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList1_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList1_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList1_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList1_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList1_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList1_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList1_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList1_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList1_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList1_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList1_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList1_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList1_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList1_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList1_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList1_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList1_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList1_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList1_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList1_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList1_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0018 */ +/* [local] */ + +typedef struct D3D12_WRITEBUFFERIMMEDIATE_PARAMETER + { + D3D12_GPU_VIRTUAL_ADDRESS Dest; + UINT32 Value; + } D3D12_WRITEBUFFERIMMEDIATE_PARAMETER; + +typedef +enum D3D12_WRITEBUFFERIMMEDIATE_MODE + { + D3D12_WRITEBUFFERIMMEDIATE_MODE_DEFAULT = 0, + D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_IN = 0x1, + D3D12_WRITEBUFFERIMMEDIATE_MODE_MARKER_OUT = 0x2 + } D3D12_WRITEBUFFERIMMEDIATE_MODE; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0018_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0018_v0_0_s_ifspec; + +#ifndef __ID3D12GraphicsCommandList2_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList2_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("38C3E585-FF17-412C-9150-4FC6F9D72A28") + ID3D12GraphicsCommandList2 : public ID3D12GraphicsCommandList1 + { + public: + virtual void STDMETHODCALLTYPE WriteBufferImmediate( + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList2 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList2 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList2 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList2 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList2 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList2 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT StencilRef); + + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList2 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList2 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList2 * This); + + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList2 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList2 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList2 * This, + _In_ UINT Mask); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList2 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + END_INTERFACE + } ID3D12GraphicsCommandList2Vtbl; + + interface ID3D12GraphicsCommandList2 + { + CONST_VTBL struct ID3D12GraphicsCommandList2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList2_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList2_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList2_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList2_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList2_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList2_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList2_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList2_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList2_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList2_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList2_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList2_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList2_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList2_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList2_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList2_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList2_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList2_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList2_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList2_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList2_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList2_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList2_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList2_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList2_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList2_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList2_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList2_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList2_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList2_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList2_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList2_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList2_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList2_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList2_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList2_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList2_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList2_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList2_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList2_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList2_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList2_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList2_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList2_INTERFACE_DEFINED__ */ + + #ifndef __ID3D12CommandQueue_INTERFACE_DEFINED__ #define __ID3D12CommandQueue_INTERFACE_DEFINED__ @@ -5501,6 +7712,27 @@ EXTERN_C const IID IID_ID3D12CommandQueue; #endif /* __ID3D12CommandQueue_INTERFACE_DEFINED__ */ +/* interface __MIDL_itf_d3d12_0000_0020 */ +/* [local] */ + +#ifdef __midl +#ifndef LUID_DEFINED +#define LUID_DEFINED 1 +typedef struct __LUID + { + DWORD LowPart; + LONG HighPart; + } LUID; + +typedef struct __LUID *PLUID; + +#endif +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0020_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0020_v0_0_s_ifspec; + #ifndef __ID3D12Device_INTERFACE_DEFINED__ #define __ID3D12Device_INTERFACE_DEFINED__ @@ -5622,7 +7854,7 @@ EXTERN_C const IID IID_ID3D12Device; virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource( _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, - _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_ const D3D12_RESOURCE_DESC *pDesc, D3D12_RESOURCE_STATES InitialResourceState, _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, @@ -5886,7 +8118,7 @@ EXTERN_C const IID IID_ID3D12Device; ID3D12Device * This, _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, - _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_ const D3D12_RESOURCE_DESC *pDesc, D3D12_RESOURCE_STATES InitialResourceState, _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riidResource, @@ -6094,8 +8326,8 @@ EXTERN_C const IID IID_ID3D12Device; #define ID3D12Device_GetCustomHeapProperties(This,nodeMask,heapType) \ ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) -#define ID3D12Device_CreateCommittedResource(This,pHeapProperties,HeapFlags,pResourceDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ - ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pResourceDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) +#define ID3D12Device_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) #define ID3D12Device_CreateHeap(This,pDesc,riid,ppvHeap) \ ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) @@ -6168,7 +8400,6820 @@ EXTERN_C const IID IID_ID3D12Device; #endif /* __ID3D12Device_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_d3d12_0000_0017 */ +#ifndef __ID3D12PipelineLibrary_INTERFACE_DEFINED__ +#define __ID3D12PipelineLibrary_INTERFACE_DEFINED__ + +/* interface ID3D12PipelineLibrary */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12PipelineLibrary; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c64226a8-9201-46af-b4cc-53fb9ff7414f") + ID3D12PipelineLibrary : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE StorePipeline( + _In_opt_ LPCWSTR pName, + _In_ ID3D12PipelineState *pPipeline) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadGraphicsPipeline( + _In_ LPCWSTR pName, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadComputePipeline( + _In_ LPCWSTR pName, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + virtual SIZE_T STDMETHODCALLTYPE GetSerializedSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Serialize( + _Out_writes_(DataSizeInBytes) void *pData, + SIZE_T DataSizeInBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12PipelineLibraryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12PipelineLibrary * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12PipelineLibrary * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12PipelineLibrary * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12PipelineLibrary * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12PipelineLibrary * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12PipelineLibrary * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12PipelineLibrary * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12PipelineLibrary * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *StorePipeline )( + ID3D12PipelineLibrary * This, + _In_opt_ LPCWSTR pName, + _In_ ID3D12PipelineState *pPipeline); + + HRESULT ( STDMETHODCALLTYPE *LoadGraphicsPipeline )( + ID3D12PipelineLibrary * This, + _In_ LPCWSTR pName, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *LoadComputePipeline )( + ID3D12PipelineLibrary * This, + _In_ LPCWSTR pName, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + SIZE_T ( STDMETHODCALLTYPE *GetSerializedSize )( + ID3D12PipelineLibrary * This); + + HRESULT ( STDMETHODCALLTYPE *Serialize )( + ID3D12PipelineLibrary * This, + _Out_writes_(DataSizeInBytes) void *pData, + SIZE_T DataSizeInBytes); + + END_INTERFACE + } ID3D12PipelineLibraryVtbl; + + interface ID3D12PipelineLibrary + { + CONST_VTBL struct ID3D12PipelineLibraryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12PipelineLibrary_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12PipelineLibrary_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12PipelineLibrary_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12PipelineLibrary_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12PipelineLibrary_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12PipelineLibrary_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12PipelineLibrary_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12PipelineLibrary_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12PipelineLibrary_StorePipeline(This,pName,pPipeline) \ + ( (This)->lpVtbl -> StorePipeline(This,pName,pPipeline) ) + +#define ID3D12PipelineLibrary_LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary_LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary_GetSerializedSize(This) \ + ( (This)->lpVtbl -> GetSerializedSize(This) ) + +#define ID3D12PipelineLibrary_Serialize(This,pData,DataSizeInBytes) \ + ( (This)->lpVtbl -> Serialize(This,pData,DataSizeInBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12PipelineLibrary_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12PipelineLibrary1_INTERFACE_DEFINED__ +#define __ID3D12PipelineLibrary1_INTERFACE_DEFINED__ + +/* interface ID3D12PipelineLibrary1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12PipelineLibrary1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("80eabf42-2568-4e5e-bd82-c37f86961dc3") + ID3D12PipelineLibrary1 : public ID3D12PipelineLibrary + { + public: + virtual HRESULT STDMETHODCALLTYPE LoadPipeline( + _In_ LPCWSTR pName, + _In_ const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12PipelineLibrary1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12PipelineLibrary1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12PipelineLibrary1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12PipelineLibrary1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12PipelineLibrary1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12PipelineLibrary1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12PipelineLibrary1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12PipelineLibrary1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12PipelineLibrary1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *StorePipeline )( + ID3D12PipelineLibrary1 * This, + _In_opt_ LPCWSTR pName, + _In_ ID3D12PipelineState *pPipeline); + + HRESULT ( STDMETHODCALLTYPE *LoadGraphicsPipeline )( + ID3D12PipelineLibrary1 * This, + _In_ LPCWSTR pName, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *LoadComputePipeline )( + ID3D12PipelineLibrary1 * This, + _In_ LPCWSTR pName, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + SIZE_T ( STDMETHODCALLTYPE *GetSerializedSize )( + ID3D12PipelineLibrary1 * This); + + HRESULT ( STDMETHODCALLTYPE *Serialize )( + ID3D12PipelineLibrary1 * This, + _Out_writes_(DataSizeInBytes) void *pData, + SIZE_T DataSizeInBytes); + + HRESULT ( STDMETHODCALLTYPE *LoadPipeline )( + ID3D12PipelineLibrary1 * This, + _In_ LPCWSTR pName, + _In_ const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + END_INTERFACE + } ID3D12PipelineLibrary1Vtbl; + + interface ID3D12PipelineLibrary1 + { + CONST_VTBL struct ID3D12PipelineLibrary1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12PipelineLibrary1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12PipelineLibrary1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12PipelineLibrary1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12PipelineLibrary1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12PipelineLibrary1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12PipelineLibrary1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12PipelineLibrary1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12PipelineLibrary1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12PipelineLibrary1_StorePipeline(This,pName,pPipeline) \ + ( (This)->lpVtbl -> StorePipeline(This,pName,pPipeline) ) + +#define ID3D12PipelineLibrary1_LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadGraphicsPipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary1_LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadComputePipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#define ID3D12PipelineLibrary1_GetSerializedSize(This) \ + ( (This)->lpVtbl -> GetSerializedSize(This) ) + +#define ID3D12PipelineLibrary1_Serialize(This,pData,DataSizeInBytes) \ + ( (This)->lpVtbl -> Serialize(This,pData,DataSizeInBytes) ) + + +#define ID3D12PipelineLibrary1_LoadPipeline(This,pName,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> LoadPipeline(This,pName,pDesc,riid,ppPipelineState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12PipelineLibrary1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0023 */ +/* [local] */ + +typedef +enum D3D12_MULTIPLE_FENCE_WAIT_FLAGS + { + D3D12_MULTIPLE_FENCE_WAIT_FLAG_NONE = 0, + D3D12_MULTIPLE_FENCE_WAIT_FLAG_ANY = 0x1, + D3D12_MULTIPLE_FENCE_WAIT_FLAG_ALL = 0 + } D3D12_MULTIPLE_FENCE_WAIT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_MULTIPLE_FENCE_WAIT_FLAGS ); +typedef +enum D3D12_RESIDENCY_PRIORITY + { + D3D12_RESIDENCY_PRIORITY_MINIMUM = 0x28000000, + D3D12_RESIDENCY_PRIORITY_LOW = 0x50000000, + D3D12_RESIDENCY_PRIORITY_NORMAL = 0x78000000, + D3D12_RESIDENCY_PRIORITY_HIGH = 0xa0010000, + D3D12_RESIDENCY_PRIORITY_MAXIMUM = 0xc8000000 + } D3D12_RESIDENCY_PRIORITY; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0023_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0023_v0_0_s_ifspec; + +#ifndef __ID3D12Device1_INTERFACE_DEFINED__ +#define __ID3D12Device1_INTERFACE_DEFINED__ + +/* interface ID3D12Device1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("77acce80-638e-4e65-8895-c1f23386863e") + ID3D12Device1 : public ID3D12Device + { + public: + virtual HRESULT STDMETHODCALLTYPE CreatePipelineLibrary( + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetEventOnMultipleFenceCompletion( + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetResidencyPriority( + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device1 * This, + _In_z_ LPCWSTR Name); + + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device1 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device1 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device1 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device1 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device1 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device1 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device1 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device1 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device1 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device1 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device1 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device1 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device1 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device1 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device1 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device1 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device1 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device1 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device1 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device1 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device1 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device1 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device1 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device1 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device1 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device1 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device1 * This); + + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device1 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device1 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device1 * This, + BOOL Enable); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device1 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device1 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device1 * This); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device1 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device1 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device1 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + END_INTERFACE + } ID3D12Device1Vtbl; + + interface ID3D12Device1 + { + CONST_VTBL struct ID3D12Device1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device1_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device1_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device1_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device1_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device1_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device1_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device1_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device1_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device1_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device1_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device1_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device1_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device1_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) + +#define ID3D12Device1_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) + +#define ID3D12Device1_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) + +#define ID3D12Device1_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device1_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device1_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device1_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device1_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device1_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device1_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device1_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device1_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device1_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device1_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device1_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device1_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device1_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device1_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device1_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D12Device1_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) + + +#define ID3D12Device1_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device1_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device1_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device2_INTERFACE_DEFINED__ +#define __ID3D12Device2_INTERFACE_DEFINED__ + +/* interface ID3D12Device2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("30baa41e-b15b-475c-a0bb-1af5c5b64328") + ID3D12Device2 : public ID3D12Device1 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreatePipelineState( + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device2 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device2 * This, + _In_z_ LPCWSTR Name); + + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device2 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device2 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device2 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device2 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device2 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device2 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device2 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device2 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device2 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device2 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device2 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device2 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device2 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device2 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device2 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device2 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device2 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device2 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device2 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device2 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device2 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device2 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device2 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device2 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device2 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device2 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device2 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device2 * This); + + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device2 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device2 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device2 * This, + BOOL Enable); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device2 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device2 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device2 * This); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device2 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device2 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device2 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device2 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + END_INTERFACE + } ID3D12Device2Vtbl; + + interface ID3D12Device2 + { + CONST_VTBL struct ID3D12Device2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device2_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device2_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device2_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device2_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device2_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device2_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device2_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device2_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device2_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device2_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device2_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device2_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device2_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) + +#define ID3D12Device2_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) + +#define ID3D12Device2_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) + +#define ID3D12Device2_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device2_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device2_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device2_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device2_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device2_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device2_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device2_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device2_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device2_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device2_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device2_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device2_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device2_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device2_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device2_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D12Device2_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) + + +#define ID3D12Device2_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device2_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device2_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device2_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0025 */ +/* [local] */ + +typedef +enum D3D12_RESIDENCY_FLAGS + { + D3D12_RESIDENCY_FLAG_NONE = 0, + D3D12_RESIDENCY_FLAG_DENY_OVERBUDGET = 0x1 + } D3D12_RESIDENCY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESIDENCY_FLAGS ); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0025_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0025_v0_0_s_ifspec; + +#ifndef __ID3D12Device3_INTERFACE_DEFINED__ +#define __ID3D12Device3_INTERFACE_DEFINED__ + +/* interface ID3D12Device3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("81dadc15-2bad-4392-93c5-101345c4aa98") + ID3D12Device3 : public ID3D12Device2 + { + public: + virtual HRESULT STDMETHODCALLTYPE OpenExistingHeapFromAddress( + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenExistingHeapFromFileMapping( + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnqueueMakeResident( + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device3 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device3 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device3 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device3 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device3 * This, + _In_z_ LPCWSTR Name); + + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device3 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device3 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device3 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device3 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device3 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device3 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device3 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device3 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device3 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device3 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device3 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device3 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device3 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device3 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device3 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device3 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device3 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device3 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device3 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device3 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device3 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device3 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device3 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device3 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device3 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device3 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device3 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device3 * This); + + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device3 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device3 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device3 * This, + BOOL Enable); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device3 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device3 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device3 * This); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device3 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device3 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device3 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device3 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device3 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device3 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device3 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + END_INTERFACE + } ID3D12Device3Vtbl; + + interface ID3D12Device3 + { + CONST_VTBL struct ID3D12Device3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device3_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device3_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device3_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device3_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device3_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device3_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device3_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device3_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device3_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device3_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device3_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device3_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device3_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device3_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device3_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device3_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device3_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) + +#define ID3D12Device3_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) + +#define ID3D12Device3_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) + +#define ID3D12Device3_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device3_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device3_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device3_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device3_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device3_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device3_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device3_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device3_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device3_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device3_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device3_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device3_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device3_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device3_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device3_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D12Device3_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) + + +#define ID3D12Device3_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device3_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device3_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device3_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device3_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device3_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device3_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device3_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0026 */ +/* [local] */ + +typedef +enum D3D12_COMMAND_LIST_FLAGS + { + D3D12_COMMAND_LIST_FLAG_NONE = 0 + } D3D12_COMMAND_LIST_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_LIST_FLAGS ); +typedef +enum D3D12_COMMAND_POOL_FLAGS + { + D3D12_COMMAND_POOL_FLAG_NONE = 0 + } D3D12_COMMAND_POOL_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_POOL_FLAGS ); +typedef +enum D3D12_COMMAND_RECORDER_FLAGS + { + D3D12_COMMAND_RECORDER_FLAG_NONE = 0 + } D3D12_COMMAND_RECORDER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMMAND_RECORDER_FLAGS ); +typedef +enum D3D12_PROTECTED_SESSION_STATUS + { + D3D12_PROTECTED_SESSION_STATUS_OK = 0, + D3D12_PROTECTED_SESSION_STATUS_INVALID = 1 + } D3D12_PROTECTED_SESSION_STATUS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0026_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0026_v0_0_s_ifspec; + +#ifndef __ID3D12ProtectedSession_INTERFACE_DEFINED__ +#define __ID3D12ProtectedSession_INTERFACE_DEFINED__ + +/* interface ID3D12ProtectedSession */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ProtectedSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A1533D18-0AC1-4084-85B9-89A96116806B") + ID3D12ProtectedSession : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE GetStatusFence( + REFIID riid, + _COM_Outptr_opt_ void **ppFence) = 0; + + virtual D3D12_PROTECTED_SESSION_STATUS STDMETHODCALLTYPE GetSessionStatus( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ProtectedSessionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ProtectedSession * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ProtectedSession * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ProtectedSession * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12ProtectedSession * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12ProtectedSession * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12ProtectedSession * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12ProtectedSession * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12ProtectedSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *GetStatusFence )( + ID3D12ProtectedSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppFence); + + D3D12_PROTECTED_SESSION_STATUS ( STDMETHODCALLTYPE *GetSessionStatus )( + ID3D12ProtectedSession * This); + + END_INTERFACE + } ID3D12ProtectedSessionVtbl; + + interface ID3D12ProtectedSession + { + CONST_VTBL struct ID3D12ProtectedSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ProtectedSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ProtectedSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ProtectedSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ProtectedSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12ProtectedSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12ProtectedSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12ProtectedSession_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12ProtectedSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12ProtectedSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->lpVtbl -> GetStatusFence(This,riid,ppFence) ) + +#define ID3D12ProtectedSession_GetSessionStatus(This) \ + ( (This)->lpVtbl -> GetSessionStatus(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ProtectedSession_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0027 */ +/* [local] */ + +typedef +enum D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS + { + D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_NONE = 0, + D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAG_SUPPORTED = 0x1 + } D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS ); +typedef struct D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT + { + UINT NodeIndex; + D3D12_PROTECTED_RESOURCE_SESSION_SUPPORT_FLAGS Support; + } D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_SUPPORT; + +typedef +enum D3D12_PROTECTED_RESOURCE_SESSION_FLAGS + { + D3D12_PROTECTED_RESOURCE_SESSION_FLAG_NONE = 0 + } D3D12_PROTECTED_RESOURCE_SESSION_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_PROTECTED_RESOURCE_SESSION_FLAGS ); +typedef struct D3D12_PROTECTED_RESOURCE_SESSION_DESC + { + UINT NodeMask; + D3D12_PROTECTED_RESOURCE_SESSION_FLAGS Flags; + } D3D12_PROTECTED_RESOURCE_SESSION_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0027_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0027_v0_0_s_ifspec; + +#ifndef __ID3D12ProtectedResourceSession_INTERFACE_DEFINED__ +#define __ID3D12ProtectedResourceSession_INTERFACE_DEFINED__ + +/* interface ID3D12ProtectedResourceSession */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ProtectedResourceSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6CD696F4-F289-40CC-8091-5A6C0A099C3D") + ID3D12ProtectedResourceSession : public ID3D12ProtectedSession + { + public: + virtual D3D12_PROTECTED_RESOURCE_SESSION_DESC STDMETHODCALLTYPE GetDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ProtectedResourceSessionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ProtectedResourceSession * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ProtectedResourceSession * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ProtectedResourceSession * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12ProtectedResourceSession * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12ProtectedResourceSession * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12ProtectedResourceSession * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12ProtectedResourceSession * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12ProtectedResourceSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *GetStatusFence )( + ID3D12ProtectedResourceSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppFence); + + D3D12_PROTECTED_SESSION_STATUS ( STDMETHODCALLTYPE *GetSessionStatus )( + ID3D12ProtectedResourceSession * This); + + D3D12_PROTECTED_RESOURCE_SESSION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12ProtectedResourceSession * This); + + END_INTERFACE + } ID3D12ProtectedResourceSessionVtbl; + + interface ID3D12ProtectedResourceSession + { + CONST_VTBL struct ID3D12ProtectedResourceSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ProtectedResourceSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ProtectedResourceSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ProtectedResourceSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ProtectedResourceSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12ProtectedResourceSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12ProtectedResourceSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12ProtectedResourceSession_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12ProtectedResourceSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12ProtectedResourceSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->lpVtbl -> GetStatusFence(This,riid,ppFence) ) + +#define ID3D12ProtectedResourceSession_GetSessionStatus(This) \ + ( (This)->lpVtbl -> GetSessionStatus(This) ) + + +#define ID3D12ProtectedResourceSession_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + + + + + +#endif /* __ID3D12ProtectedResourceSession_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Device4_INTERFACE_DEFINED__ +#define __ID3D12Device4_INTERFACE_DEFINED__ + +/* interface ID3D12Device4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("e865df17-a9ee-46f9-a463-3098315aa2e5") + ID3D12Device4 : public ID3D12Device3 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateCommandList1( + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateProtectedResourceSession( + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCommittedResource1( + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateHeap1( + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateReservedResource1( + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource) = 0; + + virtual D3D12_RESOURCE_ALLOCATION_INFO STDMETHODCALLTYPE GetResourceAllocationInfo1( + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device4 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device4 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device4 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device4 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device4 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device4 * This, + _In_z_ LPCWSTR Name); + + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device4 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device4 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device4 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device4 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device4 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device4 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device4 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device4 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device4 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device4 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device4 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device4 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device4 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device4 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device4 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device4 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device4 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device4 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device4 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device4 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device4 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device4 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device4 * This); + + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device4 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device4 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device4 * This, + BOOL Enable); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device4 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device4 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device4 * This); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device4 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device4 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device4 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device4 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device4 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device4 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device4 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device4 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device4 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device4 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device4 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device4 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + + END_INTERFACE + } ID3D12Device4Vtbl; + + interface ID3D12Device4 + { + CONST_VTBL struct ID3D12Device4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device4_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device4_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device4_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device4_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device4_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device4_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device4_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device4_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device4_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device4_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device4_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device4_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device4_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device4_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) + +#define ID3D12Device4_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) + +#define ID3D12Device4_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) + +#define ID3D12Device4_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device4_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device4_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device4_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device4_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device4_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device4_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device4_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device4_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device4_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device4_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device4_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device4_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device4_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device4_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device4_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D12Device4_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) + + +#define ID3D12Device4_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device4_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device4_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device4_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device4_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device4_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device4_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device4_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device4_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device4_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device4_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device4_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) + +#define ID3D12Device4_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + + + + + +#endif /* __ID3D12Device4_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0029 */ +/* [local] */ + +typedef +enum D3D12_LIFETIME_STATE + { + D3D12_LIFETIME_STATE_IN_USE = 0, + D3D12_LIFETIME_STATE_NOT_IN_USE = ( D3D12_LIFETIME_STATE_IN_USE + 1 ) + } D3D12_LIFETIME_STATE; + + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0029_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0029_v0_0_s_ifspec; + +#ifndef __ID3D12LifetimeOwner_INTERFACE_DEFINED__ +#define __ID3D12LifetimeOwner_INTERFACE_DEFINED__ + +/* interface ID3D12LifetimeOwner */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12LifetimeOwner; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("e667af9f-cd56-4f46-83ce-032e595d70a8") + ID3D12LifetimeOwner : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE LifetimeStateUpdated( + D3D12_LIFETIME_STATE NewState) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12LifetimeOwnerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12LifetimeOwner * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12LifetimeOwner * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12LifetimeOwner * This); + + void ( STDMETHODCALLTYPE *LifetimeStateUpdated )( + ID3D12LifetimeOwner * This, + D3D12_LIFETIME_STATE NewState); + + END_INTERFACE + } ID3D12LifetimeOwnerVtbl; + + interface ID3D12LifetimeOwner + { + CONST_VTBL struct ID3D12LifetimeOwnerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12LifetimeOwner_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12LifetimeOwner_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12LifetimeOwner_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12LifetimeOwner_LifetimeStateUpdated(This,NewState) \ + ( (This)->lpVtbl -> LifetimeStateUpdated(This,NewState) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12LifetimeOwner_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12SwapChainAssistant_INTERFACE_DEFINED__ +#define __ID3D12SwapChainAssistant_INTERFACE_DEFINED__ + +/* interface ID3D12SwapChainAssistant */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12SwapChainAssistant; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f1df64b6-57fd-49cd-8807-c0eb88b45c8f") + ID3D12SwapChainAssistant : public IUnknown + { + public: + virtual LUID STDMETHODCALLTYPE GetLUID( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSwapChainObject( + REFIID riid, + _COM_Outptr_ void **ppv) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCurrentResourceAndCommandQueue( + REFIID riidResource, + _COM_Outptr_ void **ppvResource, + REFIID riidQueue, + _COM_Outptr_ void **ppvQueue) = 0; + + virtual HRESULT STDMETHODCALLTYPE InsertImplicitSync( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12SwapChainAssistantVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12SwapChainAssistant * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12SwapChainAssistant * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12SwapChainAssistant * This); + + LUID ( STDMETHODCALLTYPE *GetLUID )( + ID3D12SwapChainAssistant * This); + + HRESULT ( STDMETHODCALLTYPE *GetSwapChainObject )( + ID3D12SwapChainAssistant * This, + REFIID riid, + _COM_Outptr_ void **ppv); + + HRESULT ( STDMETHODCALLTYPE *GetCurrentResourceAndCommandQueue )( + ID3D12SwapChainAssistant * This, + REFIID riidResource, + _COM_Outptr_ void **ppvResource, + REFIID riidQueue, + _COM_Outptr_ void **ppvQueue); + + HRESULT ( STDMETHODCALLTYPE *InsertImplicitSync )( + ID3D12SwapChainAssistant * This); + + END_INTERFACE + } ID3D12SwapChainAssistantVtbl; + + interface ID3D12SwapChainAssistant + { + CONST_VTBL struct ID3D12SwapChainAssistantVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12SwapChainAssistant_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12SwapChainAssistant_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12SwapChainAssistant_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12SwapChainAssistant_GetLUID(This) \ + ( (This)->lpVtbl -> GetLUID(This) ) + +#define ID3D12SwapChainAssistant_GetSwapChainObject(This,riid,ppv) \ + ( (This)->lpVtbl -> GetSwapChainObject(This,riid,ppv) ) + +#define ID3D12SwapChainAssistant_GetCurrentResourceAndCommandQueue(This,riidResource,ppvResource,riidQueue,ppvQueue) \ + ( (This)->lpVtbl -> GetCurrentResourceAndCommandQueue(This,riidResource,ppvResource,riidQueue,ppvQueue) ) + +#define ID3D12SwapChainAssistant_InsertImplicitSync(This) \ + ( (This)->lpVtbl -> InsertImplicitSync(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + + + + + +#endif /* __ID3D12SwapChainAssistant_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12LifetimeTracker_INTERFACE_DEFINED__ +#define __ID3D12LifetimeTracker_INTERFACE_DEFINED__ + +/* interface ID3D12LifetimeTracker */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12LifetimeTracker; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3fd03d36-4eb1-424a-a582-494ecb8ba813") + ID3D12LifetimeTracker : public ID3D12DeviceChild + { + public: + virtual HRESULT STDMETHODCALLTYPE DestroyOwnedObject( + _In_ ID3D12DeviceChild *pObject) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12LifetimeTrackerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12LifetimeTracker * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12LifetimeTracker * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12LifetimeTracker * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12LifetimeTracker * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12LifetimeTracker * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12LifetimeTracker * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12LifetimeTracker * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12LifetimeTracker * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *DestroyOwnedObject )( + ID3D12LifetimeTracker * This, + _In_ ID3D12DeviceChild *pObject); + + END_INTERFACE + } ID3D12LifetimeTrackerVtbl; + + interface ID3D12LifetimeTracker + { + CONST_VTBL struct ID3D12LifetimeTrackerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12LifetimeTracker_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12LifetimeTracker_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12LifetimeTracker_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12LifetimeTracker_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12LifetimeTracker_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12LifetimeTracker_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12LifetimeTracker_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12LifetimeTracker_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12LifetimeTracker_DestroyOwnedObject(This,pObject) \ + ( (This)->lpVtbl -> DestroyOwnedObject(This,pObject) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12LifetimeTracker_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0032 */ +/* [local] */ + +typedef +enum D3D12_META_COMMAND_PARAMETER_TYPE + { + D3D12_META_COMMAND_PARAMETER_TYPE_FLOAT = 0, + D3D12_META_COMMAND_PARAMETER_TYPE_UINT64 = 1, + D3D12_META_COMMAND_PARAMETER_TYPE_GPU_VIRTUAL_ADDRESS = 2, + D3D12_META_COMMAND_PARAMETER_TYPE_CPU_DESCRIPTOR_HANDLE_HEAP_TYPE_CBV_SRV_UAV = 3, + D3D12_META_COMMAND_PARAMETER_TYPE_GPU_DESCRIPTOR_HANDLE_HEAP_TYPE_CBV_SRV_UAV = 4 + } D3D12_META_COMMAND_PARAMETER_TYPE; + +typedef +enum D3D12_META_COMMAND_PARAMETER_FLAGS + { + D3D12_META_COMMAND_PARAMETER_FLAG_INPUT = 0x1, + D3D12_META_COMMAND_PARAMETER_FLAG_OUTPUT = 0x2 + } D3D12_META_COMMAND_PARAMETER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_META_COMMAND_PARAMETER_FLAGS ); +typedef +enum D3D12_META_COMMAND_PARAMETER_STAGE + { + D3D12_META_COMMAND_PARAMETER_STAGE_CREATION = 0, + D3D12_META_COMMAND_PARAMETER_STAGE_INITIALIZATION = 1, + D3D12_META_COMMAND_PARAMETER_STAGE_EXECUTION = 2 + } D3D12_META_COMMAND_PARAMETER_STAGE; + +typedef struct D3D12_META_COMMAND_PARAMETER_DESC + { + LPCWSTR Name; + D3D12_META_COMMAND_PARAMETER_TYPE Type; + D3D12_META_COMMAND_PARAMETER_FLAGS Flags; + D3D12_RESOURCE_STATES RequiredResourceState; + UINT StructureOffset; + } D3D12_META_COMMAND_PARAMETER_DESC; + +typedef +enum D3D12_GRAPHICS_STATES + { + D3D12_GRAPHICS_STATE_NONE = 0, + D3D12_GRAPHICS_STATE_IA_VERTEX_BUFFERS = ( 1 << 0 ) , + D3D12_GRAPHICS_STATE_IA_INDEX_BUFFER = ( 1 << 1 ) , + D3D12_GRAPHICS_STATE_IA_PRIMITIVE_TOPOLOGY = ( 1 << 2 ) , + D3D12_GRAPHICS_STATE_DESCRIPTOR_HEAP = ( 1 << 3 ) , + D3D12_GRAPHICS_STATE_GRAPHICS_ROOT_SIGNATURE = ( 1 << 4 ) , + D3D12_GRAPHICS_STATE_COMPUTE_ROOT_SIGNATURE = ( 1 << 5 ) , + D3D12_GRAPHICS_STATE_RS_VIEWPORTS = ( 1 << 6 ) , + D3D12_GRAPHICS_STATE_RS_SCISSOR_RECTS = ( 1 << 7 ) , + D3D12_GRAPHICS_STATE_PREDICATION = ( 1 << 8 ) , + D3D12_GRAPHICS_STATE_OM_RENDER_TARGETS = ( 1 << 9 ) , + D3D12_GRAPHICS_STATE_OM_STENCIL_REF = ( 1 << 10 ) , + D3D12_GRAPHICS_STATE_OM_BLEND_FACTOR = ( 1 << 11 ) , + D3D12_GRAPHICS_STATE_PIPELINE_STATE = ( 1 << 12 ) , + D3D12_GRAPHICS_STATE_SO_TARGETS = ( 1 << 13 ) , + D3D12_GRAPHICS_STATE_OM_DEPTH_BOUNDS = ( 1 << 14 ) , + D3D12_GRAPHICS_STATE_SAMPLE_POSITIONS = ( 1 << 15 ) , + D3D12_GRAPHICS_STATE_VIEW_INSTANCE_MASK = ( 1 << 16 ) + } D3D12_GRAPHICS_STATES; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_GRAPHICS_STATES ); +typedef struct D3D12_META_COMMAND_DESC + { + GUID Id; + LPCWSTR Name; + D3D12_GRAPHICS_STATES InitializationDirtyState; + D3D12_GRAPHICS_STATES ExecutionDirtyState; + } D3D12_META_COMMAND_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0032_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0032_v0_0_s_ifspec; + +#ifndef __ID3D12StateObject_INTERFACE_DEFINED__ +#define __ID3D12StateObject_INTERFACE_DEFINED__ + +/* interface ID3D12StateObject */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObject; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("47016943-fca8-4594-93ea-af258b55346d") + ID3D12StateObject : public ID3D12Pageable + { + public: + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObject * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObject * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObject * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12StateObject * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12StateObject * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12StateObject * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12StateObject * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12StateObject * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + END_INTERFACE + } ID3D12StateObjectVtbl; + + interface ID3D12StateObject + { + CONST_VTBL struct ID3D12StateObjectVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObject_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObject_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObject_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObject_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12StateObject_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12StateObject_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12StateObject_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12StateObject_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObject_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12StateObjectProperties_INTERFACE_DEFINED__ +#define __ID3D12StateObjectProperties_INTERFACE_DEFINED__ + +/* interface ID3D12StateObjectProperties */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObjectProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("de5fa827-9bf9-4f26-89ff-d7f56fde3860") + ID3D12StateObjectProperties : public IUnknown + { + public: + virtual void *STDMETHODCALLTYPE GetShaderIdentifier( + _In_ LPCWSTR pExportName) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetShaderStackSize( + _In_ LPCWSTR pExportName) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetPipelineStackSize( void) = 0; + + virtual void STDMETHODCALLTYPE SetPipelineStackSize( + UINT64 PipelineStackSizeInBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectPropertiesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObjectProperties * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObjectProperties * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObjectProperties * This); + + void *( STDMETHODCALLTYPE *GetShaderIdentifier )( + ID3D12StateObjectProperties * This, + _In_ LPCWSTR pExportName); + + UINT64 ( STDMETHODCALLTYPE *GetShaderStackSize )( + ID3D12StateObjectProperties * This, + _In_ LPCWSTR pExportName); + + UINT64 ( STDMETHODCALLTYPE *GetPipelineStackSize )( + ID3D12StateObjectProperties * This); + + void ( STDMETHODCALLTYPE *SetPipelineStackSize )( + ID3D12StateObjectProperties * This, + UINT64 PipelineStackSizeInBytes); + + END_INTERFACE + } ID3D12StateObjectPropertiesVtbl; + + interface ID3D12StateObjectProperties + { + CONST_VTBL struct ID3D12StateObjectPropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObjectProperties_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObjectProperties_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObjectProperties_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObjectProperties_GetShaderIdentifier(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderIdentifier(This,pExportName) ) + +#define ID3D12StateObjectProperties_GetShaderStackSize(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderStackSize(This,pExportName) ) + +#define ID3D12StateObjectProperties_GetPipelineStackSize(This) \ + ( (This)->lpVtbl -> GetPipelineStackSize(This) ) + +#define ID3D12StateObjectProperties_SetPipelineStackSize(This,PipelineStackSizeInBytes) \ + ( (This)->lpVtbl -> SetPipelineStackSize(This,PipelineStackSizeInBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObjectProperties_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0034 */ +/* [local] */ + +typedef +enum D3D12_STATE_SUBOBJECT_TYPE + { + D3D12_STATE_SUBOBJECT_TYPE_STATE_OBJECT_CONFIG = 0, + D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE = 1, + D3D12_STATE_SUBOBJECT_TYPE_LOCAL_ROOT_SIGNATURE = 2, + D3D12_STATE_SUBOBJECT_TYPE_NODE_MASK = 3, + D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY = 5, + D3D12_STATE_SUBOBJECT_TYPE_EXISTING_COLLECTION = 6, + D3D12_STATE_SUBOBJECT_TYPE_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 7, + D3D12_STATE_SUBOBJECT_TYPE_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 8, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG = 9, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG = 10, + D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP = 11, + D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID = ( D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP + 1 ) + } D3D12_STATE_SUBOBJECT_TYPE; + +typedef struct D3D12_STATE_SUBOBJECT + { + D3D12_STATE_SUBOBJECT_TYPE Type; + const void *pDesc; + } D3D12_STATE_SUBOBJECT; + +typedef +enum D3D12_STATE_OBJECT_FLAGS + { + D3D12_STATE_OBJECT_FLAG_NONE = 0, + D3D12_STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS = 0x1, + D3D12_STATE_OBJECT_FLAG_ALLOW_EXTERNAL_DEPENDENCIES_ON_LOCAL_DEFINITIONS = 0x2 + } D3D12_STATE_OBJECT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_STATE_OBJECT_FLAGS ); +typedef struct D3D12_STATE_OBJECT_CONFIG + { + D3D12_STATE_OBJECT_FLAGS Flags; + } D3D12_STATE_OBJECT_CONFIG; + +typedef struct D3D12_GLOBAL_ROOT_SIGNATURE + { + ID3D12RootSignature *pGlobalRootSignature; + } D3D12_GLOBAL_ROOT_SIGNATURE; + +typedef struct D3D12_LOCAL_ROOT_SIGNATURE + { + ID3D12RootSignature *pLocalRootSignature; + } D3D12_LOCAL_ROOT_SIGNATURE; + +typedef struct D3D12_NODE_MASK + { + UINT NodeMask; + } D3D12_NODE_MASK; + +typedef +enum D3D12_EXPORT_FLAGS + { + D3D12_EXPORT_FLAG_NONE = 0 + } D3D12_EXPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_EXPORT_FLAGS ); +typedef struct D3D12_EXPORT_DESC + { + LPCWSTR Name; + _In_opt_ LPCWSTR ExportToRename; + D3D12_EXPORT_FLAGS Flags; + } D3D12_EXPORT_DESC; + +typedef struct D3D12_DXIL_LIBRARY_DESC + { + D3D12_SHADER_BYTECODE DXILLibrary; + UINT NumExports; + _In_reads_(NumExports) D3D12_EXPORT_DESC *pExports; + } D3D12_DXIL_LIBRARY_DESC; + +typedef struct D3D12_EXISTING_COLLECTION_DESC + { + ID3D12StateObject *pExistingCollection; + UINT NumExports; + _In_reads_(NumExports) D3D12_EXPORT_DESC *pExports; + } D3D12_EXISTING_COLLECTION_DESC; + +typedef struct D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION + { + const D3D12_STATE_SUBOBJECT *pSubobjectToAssociate; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + } D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION; + +typedef struct D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION + { + LPCWSTR SubobjectToAssociate; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + } D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION; + +typedef +enum D3D12_HIT_GROUP_TYPE + { + D3D12_HIT_GROUP_TYPE_TRIANGLES = 0, + D3D12_HIT_GROUP_TYPE_PROCEDURAL_PRIMITIVE = 0x1 + } D3D12_HIT_GROUP_TYPE; + +typedef struct D3D12_HIT_GROUP_DESC + { + LPCWSTR HitGroupExport; + D3D12_HIT_GROUP_TYPE Type; + _In_opt_ LPCWSTR AnyHitShaderImport; + _In_opt_ LPCWSTR ClosestHitShaderImport; + _In_opt_ LPCWSTR IntersectionShaderImport; + } D3D12_HIT_GROUP_DESC; + +typedef struct D3D12_RAYTRACING_SHADER_CONFIG + { + UINT MaxPayloadSizeInBytes; + UINT MaxAttributeSizeInBytes; + } D3D12_RAYTRACING_SHADER_CONFIG; + +typedef struct D3D12_RAYTRACING_PIPELINE_CONFIG + { + UINT MaxTraceRecursionDepth; + } D3D12_RAYTRACING_PIPELINE_CONFIG; + +typedef +enum D3D12_STATE_OBJECT_TYPE + { + D3D12_STATE_OBJECT_TYPE_COLLECTION = 0, + D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE = 3 + } D3D12_STATE_OBJECT_TYPE; + +typedef struct D3D12_STATE_OBJECT_DESC + { + D3D12_STATE_OBJECT_TYPE Type; + UINT NumSubobjects; + _In_reads_(NumSubobjects) const D3D12_STATE_SUBOBJECT *pSubobjects; + } D3D12_STATE_OBJECT_DESC; + +typedef +enum D3D12_RAYTRACING_GEOMETRY_FLAGS + { + D3D12_RAYTRACING_GEOMETRY_FLAG_NONE = 0, + D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE = 0x1, + D3D12_RAYTRACING_GEOMETRY_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION = 0x2 + } D3D12_RAYTRACING_GEOMETRY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_GEOMETRY_FLAGS ); +typedef +enum D3D12_RAYTRACING_GEOMETRY_TYPE + { + D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES = 0, + D3D12_RAYTRACING_GEOMETRY_TYPE_PROCEDURAL_PRIMITIVE_AABBS = ( D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES + 1 ) + } D3D12_RAYTRACING_GEOMETRY_TYPE; + +typedef +enum D3D12_RAYTRACING_INSTANCE_FLAGS + { + D3D12_RAYTRACING_INSTANCE_FLAG_NONE = 0, + D3D12_RAYTRACING_INSTANCE_FLAG_TRIANGLE_CULL_DISABLE = 0x1, + D3D12_RAYTRACING_INSTANCE_FLAG_TRIANGLE_FRONT_COUNTERCLOCKWISE = 0x2, + D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_OPAQUE = 0x4, + D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_NON_OPAQUE = 0x8 + } D3D12_RAYTRACING_INSTANCE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_INSTANCE_FLAGS ); +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 StrideInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE; + +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_RANGE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 SizeInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_RANGE; + +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 SizeInBytes; + UINT64 StrideInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE; + +typedef struct D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS Transform3x4; + DXGI_FORMAT IndexFormat; + DXGI_FORMAT VertexFormat; + UINT IndexCount; + UINT VertexCount; + D3D12_GPU_VIRTUAL_ADDRESS IndexBuffer; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE VertexBuffer; + } D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC; + +typedef struct D3D12_RAYTRACING_AABB + { + FLOAT MinX; + FLOAT MinY; + FLOAT MinZ; + FLOAT MaxX; + FLOAT MaxY; + FLOAT MaxZ; + } D3D12_RAYTRACING_AABB; + +typedef struct D3D12_RAYTRACING_GEOMETRY_AABBS_DESC + { + UINT64 AABBCount; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE AABBs; + } D3D12_RAYTRACING_GEOMETRY_AABBS_DESC; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_NONE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_UPDATE = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_COMPACTION = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE = 0x4, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_BUILD = 0x8, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_MINIMIZE_MEMORY = 0x10, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE = 0x20 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS ); +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_CLONE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_COMPACT = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_VISUALIZATION_DECODE_FOR_TOOLS = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_SERIALIZE = 0x3, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_DESERIALIZE = 0x4 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL = 0x1 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE; + +typedef +enum D3D12_ELEMENTS_LAYOUT + { + D3D12_ELEMENTS_LAYOUT_ARRAY = 0, + D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS = 0x1 + } D3D12_ELEMENTS_LAYOUT; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE = 0x3 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS DestBuffer; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE InfoType; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE_DESC + { + UINT64 CompactedSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION_DESC + { + UINT64 DecodedSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION_DESC; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + UINT NumDescs; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER; + +// Regarding D3D12_BUILD_RAY_TRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER above, +// depending on Type field, NumDescs above is followed by either: +// D3D12_RAY_TRACING_INSTANCE_DESC InstanceDescs[NumDescs] +// or D3D12_RAY_TRACING_GEOMETRY_DESC GeometryDescs[NumDescs]. +// There is 4 bytes of padding between GeometryDesc structs in the array so alignment is natural when viewed by CPU. + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION_DESC + { + UINT64 SerializedSizeInBytes; + UINT64 NumBottomLevelAccelerationStructurePointers; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION_DESC; + +typedef struct D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER + { + GUID DriverOpaqueGUID; + BYTE DriverOpaqueVersioningData[ 16 ]; + } D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER; + +typedef +enum D3D12_SERIALIZED_DATA_TYPE + { + D3D12_SERIALIZED_DATA_RAYTRACING_ACCELERATION_STRUCTURE = 0 + } D3D12_SERIALIZED_DATA_TYPE; + +typedef +enum D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS + { + D3D12_DRIVER_MATCHING_IDENTIFIER_COMPATIBLE_WITH_DEVICE = 0, + D3D12_DRIVER_MATCHING_IDENTIFIER_UNSUPPORTED_TYPE = 0x1, + D3D12_DRIVER_MATCHING_IDENTIFIER_UNRECOGNIZED = 0x2, + D3D12_DRIVER_MATCHING_IDENTIFIER_INCOMPATIBLE_VERSION = 0x3, + D3D12_DRIVER_MATCHING_IDENTIFIER_INCOMPATIBLE_TYPE = 0x4 + } D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS; + +typedef struct D3D12_SERIALIZED_RAYTRACING_ACCELERATION_STRUCTURE_HEADER + { + D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER DriverMatchingIdentifier; + UINT64 SerializedSizeInBytesIncludingHeader; + UINT64 DeserializedSizeInBytes; + UINT64 NumBottomLevelAccelerationStructurePointersAfterHeader; + } D3D12_SERIALIZED_RAYTRACING_ACCELERATION_STRUCTURE_HEADER; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE_DESC + { + UINT64 CurrentSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_CURRENT_SIZE_DESC; + +typedef struct D3D12_RAYTRACING_INSTANCE_DESC + { + FLOAT Transform[ 3 ][ 4 ]; + UINT InstanceID : 24; + UINT InstanceMask : 8; + UINT InstanceContributionToHitGroupIndex : 24; + UINT Flags : 8; + D3D12_GPU_VIRTUAL_ADDRESS AccelerationStructure; + } D3D12_RAYTRACING_INSTANCE_DESC; + +typedef struct D3D12_RAYTRACING_GEOMETRY_DESC + { + D3D12_RAYTRACING_GEOMETRY_TYPE Type; + D3D12_RAYTRACING_GEOMETRY_FLAGS Flags; + union + { + D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC Triangles; + D3D12_RAYTRACING_GEOMETRY_AABBS_DESC AABBs; + } ; + } D3D12_RAYTRACING_GEOMETRY_DESC; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS Flags; + UINT NumDescs; + D3D12_ELEMENTS_LAYOUT DescsLayout; + union + { + D3D12_GPU_VIRTUAL_ADDRESS InstanceDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *pGeometryDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *const *ppGeometryDescs; + } ; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData; + D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS Inputs; + _In_opt_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData; + D3D12_GPU_VIRTUAL_ADDRESS ScratchAccelerationStructureData; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO + { + UINT64 ResultDataMaxSizeInBytes; + UINT64 ScratchDataSizeInBytes; + UINT64 UpdateScratchDataSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO; + +typedef +enum D3D12_RAY_FLAGS + { + D3D12_RAY_FLAG_NONE = 0, + D3D12_RAY_FLAG_FORCE_OPAQUE = 0x1, + D3D12_RAY_FLAG_FORCE_NON_OPAQUE = 0x2, + D3D12_RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH = 0x4, + D3D12_RAY_FLAG_SKIP_CLOSEST_HIT_SHADER = 0x8, + D3D12_RAY_FLAG_CULL_BACK_FACING_TRIANGLES = 0x10, + D3D12_RAY_FLAG_CULL_FRONT_FACING_TRIANGLES = 0x20, + D3D12_RAY_FLAG_CULL_OPAQUE = 0x40, + D3D12_RAY_FLAG_CULL_NON_OPAQUE = 0x80 + } D3D12_RAY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAY_FLAGS ); +typedef +enum D3D12_HIT_KIND + { + D3D12_HIT_KIND_TRIANGLE_FRONT_FACE = 0xfe, + D3D12_HIT_KIND_TRIANGLE_BACK_FACE = 0xff + } D3D12_HIT_KIND; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0034_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0034_v0_0_s_ifspec; + +#ifndef __ID3D12Device5_INTERFACE_DEFINED__ +#define __ID3D12Device5_INTERFACE_DEFINED__ + +/* interface ID3D12Device5 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Device5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8b4f173b-2fea-4b80-8f58-4307191ab95d") + ID3D12Device5 : public ID3D12Device4 + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateLifetimeTracker( + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker) = 0; + + virtual void STDMETHODCALLTYPE RemoveDevice( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumerateMetaCommands( + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumerateMetaCommandParameters( + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateMetaCommand( + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateStateObject( + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject) = 0; + + virtual void STDMETHODCALLTYPE GetRaytracingAccelerationStructurePrebuildInfo( + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo) = 0; + + virtual D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE CheckDriverMatchingIdentifier( + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Device5Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Device5 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Device5 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Device5 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Device5 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Device5 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Device5 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Device5 * This, + _In_z_ LPCWSTR Name); + + UINT ( STDMETHODCALLTYPE *GetNodeCount )( + ID3D12Device5 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandQueue )( + ID3D12Device5 * This, + _In_ const D3D12_COMMAND_QUEUE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppCommandQueue); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandAllocator )( + ID3D12Device5 * This, + _In_ D3D12_COMMAND_LIST_TYPE type, + REFIID riid, + _COM_Outptr_ void **ppCommandAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateGraphicsPipelineState )( + ID3D12Device5 * This, + _In_ const D3D12_GRAPHICS_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateComputePipelineState )( + ID3D12Device5 * This, + _In_ const D3D12_COMPUTE_PIPELINE_STATE_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ ID3D12CommandAllocator *pCommandAllocator, + _In_opt_ ID3D12PipelineState *pInitialState, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12Device5 * This, + D3D12_FEATURE Feature, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *CreateDescriptorHeap )( + ID3D12Device5 * This, + _In_ const D3D12_DESCRIPTOR_HEAP_DESC *pDescriptorHeapDesc, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + UINT ( STDMETHODCALLTYPE *GetDescriptorHandleIncrementSize )( + ID3D12Device5 * This, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapType); + + HRESULT ( STDMETHODCALLTYPE *CreateRootSignature )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + _In_reads_(blobLengthInBytes) const void *pBlobWithRootSignature, + _In_ SIZE_T blobLengthInBytes, + REFIID riid, + _COM_Outptr_ void **ppvRootSignature); + + void ( STDMETHODCALLTYPE *CreateConstantBufferView )( + ID3D12Device5 * This, + _In_opt_ const D3D12_CONSTANT_BUFFER_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateShaderResourceView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_SHADER_RESOURCE_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ ID3D12Resource *pCounterResource, + _In_opt_ const D3D12_UNORDERED_ACCESS_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateRenderTargetView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_RENDER_TARGET_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateDepthStencilView )( + ID3D12Device5 * This, + _In_opt_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DEPTH_STENCIL_VIEW_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CreateSampler )( + ID3D12Device5 * This, + _In_ const D3D12_SAMPLER_DESC *pDesc, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor); + + void ( STDMETHODCALLTYPE *CopyDescriptors )( + ID3D12Device5 * This, + _In_ UINT NumDestDescriptorRanges, + _In_reads_(NumDestDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pDestDescriptorRangeStarts, + _In_reads_opt_(NumDestDescriptorRanges) const UINT *pDestDescriptorRangeSizes, + _In_ UINT NumSrcDescriptorRanges, + _In_reads_(NumSrcDescriptorRanges) const D3D12_CPU_DESCRIPTOR_HANDLE *pSrcDescriptorRangeStarts, + _In_reads_opt_(NumSrcDescriptorRanges) const UINT *pSrcDescriptorRangeSizes, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + void ( STDMETHODCALLTYPE *CopyDescriptorsSimple )( + ID3D12Device5 * This, + _In_ UINT NumDescriptors, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptorRangeStart, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE SrcDescriptorRangeStart, + _In_ D3D12_DESCRIPTOR_HEAP_TYPE DescriptorHeapsType); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo )( + ID3D12Device5 * This, + _In_ UINT visibleMask, + _In_ UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs); + + D3D12_HEAP_PROPERTIES ( STDMETHODCALLTYPE *GetCustomHeapProperties )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + D3D12_HEAP_TYPE heapType); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreatePlacedResource )( + ID3D12Device5 * This, + _In_ ID3D12Heap *pHeap, + UINT64 HeapOffset, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource )( + ID3D12Device5 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateSharedHandle )( + ID3D12Device5 * This, + _In_ ID3D12DeviceChild *pObject, + _In_opt_ const SECURITY_ATTRIBUTES *pAttributes, + DWORD Access, + _In_opt_ LPCWSTR Name, + _Out_ HANDLE *pHandle); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandle )( + ID3D12Device5 * This, + _In_ HANDLE NTHandle, + REFIID riid, + _COM_Outptr_opt_ void **ppvObj); + + HRESULT ( STDMETHODCALLTYPE *OpenSharedHandleByName )( + ID3D12Device5 * This, + _In_ LPCWSTR Name, + DWORD Access, + /* [annotation][out] */ + _Out_ HANDLE *pNTHandle); + + HRESULT ( STDMETHODCALLTYPE *MakeResident )( + ID3D12Device5 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *Evict )( + ID3D12Device5 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects); + + HRESULT ( STDMETHODCALLTYPE *CreateFence )( + ID3D12Device5 * This, + UINT64 InitialValue, + D3D12_FENCE_FLAGS Flags, + REFIID riid, + _COM_Outptr_ void **ppFence); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( + ID3D12Device5 * This); + + void ( STDMETHODCALLTYPE *GetCopyableFootprints )( + ID3D12Device5 * This, + _In_ const D3D12_RESOURCE_DESC *pResourceDesc, + _In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource, + _In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources, + UINT64 BaseOffset, + _Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT *pLayouts, + _Out_writes_opt_(NumSubresources) UINT *pNumRows, + _Out_writes_opt_(NumSubresources) UINT64 *pRowSizeInBytes, + _Out_opt_ UINT64 *pTotalBytes); + + HRESULT ( STDMETHODCALLTYPE *CreateQueryHeap )( + ID3D12Device5 * This, + _In_ const D3D12_QUERY_HEAP_DESC *pDesc, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *SetStablePowerState )( + ID3D12Device5 * This, + BOOL Enable); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandSignature )( + ID3D12Device5 * This, + _In_ const D3D12_COMMAND_SIGNATURE_DESC *pDesc, + _In_opt_ ID3D12RootSignature *pRootSignature, + REFIID riid, + _COM_Outptr_opt_ void **ppvCommandSignature); + + void ( STDMETHODCALLTYPE *GetResourceTiling )( + ID3D12Device5 * This, + _In_ ID3D12Resource *pTiledResource, + _Out_opt_ UINT *pNumTilesForEntireResource, + _Out_opt_ D3D12_PACKED_MIP_INFO *pPackedMipDesc, + _Out_opt_ D3D12_TILE_SHAPE *pStandardTileShapeForNonPackedMips, + _Inout_opt_ UINT *pNumSubresourceTilings, + _In_ UINT FirstSubresourceTilingToGet, + _Out_writes_(*pNumSubresourceTilings) D3D12_SUBRESOURCE_TILING *pSubresourceTilingsForNonPackedMips); + + LUID ( STDMETHODCALLTYPE *GetAdapterLuid )( + ID3D12Device5 * This); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineLibrary )( + ID3D12Device5 * This, + _In_reads_(BlobLength) const void *pLibraryBlob, + SIZE_T BlobLength, + REFIID riid, + _COM_Outptr_ void **ppPipelineLibrary); + + HRESULT ( STDMETHODCALLTYPE *SetEventOnMultipleFenceCompletion )( + ID3D12Device5 * This, + _In_reads_(NumFences) ID3D12Fence *const *ppFences, + _In_reads_(NumFences) const UINT64 *pFenceValues, + UINT NumFences, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS Flags, + HANDLE hEvent); + + HRESULT ( STDMETHODCALLTYPE *SetResidencyPriority )( + ID3D12Device5 * This, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_reads_(NumObjects) const D3D12_RESIDENCY_PRIORITY *pPriorities); + + HRESULT ( STDMETHODCALLTYPE *CreatePipelineState )( + ID3D12Device5 * This, + const D3D12_PIPELINE_STATE_STREAM_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppPipelineState); + + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromAddress )( + ID3D12Device5 * This, + _In_ const void *pAddress, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *OpenExistingHeapFromFileMapping )( + ID3D12Device5 * This, + _In_ HANDLE hFileMapping, + REFIID riid, + _COM_Outptr_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *EnqueueMakeResident )( + ID3D12Device5 * This, + D3D12_RESIDENCY_FLAGS Flags, + UINT NumObjects, + _In_reads_(NumObjects) ID3D12Pageable *const *ppObjects, + _In_ ID3D12Fence *pFenceToSignal, + UINT64 FenceValueToSignal); + + HRESULT ( STDMETHODCALLTYPE *CreateCommandList1 )( + ID3D12Device5 * This, + _In_ UINT nodeMask, + _In_ D3D12_COMMAND_LIST_TYPE type, + _In_ D3D12_COMMAND_LIST_FLAGS flags, + REFIID riid, + _COM_Outptr_ void **ppCommandList); + + HRESULT ( STDMETHODCALLTYPE *CreateProtectedResourceSession )( + ID3D12Device5 * This, + _In_ const D3D12_PROTECTED_RESOURCE_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + HRESULT ( STDMETHODCALLTYPE *CreateCommittedResource1 )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_PROPERTIES *pHeapProperties, + D3D12_HEAP_FLAGS HeapFlags, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialResourceState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riidResource, + _COM_Outptr_opt_ void **ppvResource); + + HRESULT ( STDMETHODCALLTYPE *CreateHeap1 )( + ID3D12Device5 * This, + _In_ const D3D12_HEAP_DESC *pDesc, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvHeap); + + HRESULT ( STDMETHODCALLTYPE *CreateReservedResource1 )( + ID3D12Device5 * This, + _In_ const D3D12_RESOURCE_DESC *pDesc, + D3D12_RESOURCE_STATES InitialState, + _In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedSession, + REFIID riid, + _COM_Outptr_opt_ void **ppvResource); + + D3D12_RESOURCE_ALLOCATION_INFO ( STDMETHODCALLTYPE *GetResourceAllocationInfo1 )( + ID3D12Device5 * This, + UINT visibleMask, + UINT numResourceDescs, + _In_reads_(numResourceDescs) const D3D12_RESOURCE_DESC *pResourceDescs, + _Out_writes_opt_(numResourceDescs) D3D12_RESOURCE_ALLOCATION_INFO1 *pResourceAllocationInfo1); + + HRESULT ( STDMETHODCALLTYPE *CreateLifetimeTracker )( + ID3D12Device5 * This, + _In_ ID3D12LifetimeOwner *pOwner, + REFIID riid, + _COM_Outptr_ void **ppvTracker); + + void ( STDMETHODCALLTYPE *RemoveDevice )( + ID3D12Device5 * This); + + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12Device5 * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_META_COMMAND_DESC *pDescs); + + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandParameters )( + ID3D12Device5 * This, + _In_ REFGUID CommandId, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _Out_opt_ UINT *pTotalStructureSizeInBytes, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_META_COMMAND_PARAMETER_DESC *pParameterDescs); + + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12Device5 * This, + _In_ REFGUID CommandId, + _In_ UINT NodeMask, + _In_reads_bytes_opt_(CreationParametersDataSizeInBytes) const void *pCreationParametersData, + _In_ SIZE_T CreationParametersDataSizeInBytes, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12Device5 * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12Device5 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS ( STDMETHODCALLTYPE *CheckDriverMatchingIdentifier )( + ID3D12Device5 * This, + _In_ D3D12_SERIALIZED_DATA_TYPE SerializedDataType, + _In_ const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *pIdentifierToCheck); + + END_INTERFACE + } ID3D12Device5Vtbl; + + interface ID3D12Device5 + { + CONST_VTBL struct ID3D12Device5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Device5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Device5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Device5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Device5_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Device5_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Device5_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Device5_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Device5_GetNodeCount(This) \ + ( (This)->lpVtbl -> GetNodeCount(This) ) + +#define ID3D12Device5_CreateCommandQueue(This,pDesc,riid,ppCommandQueue) \ + ( (This)->lpVtbl -> CreateCommandQueue(This,pDesc,riid,ppCommandQueue) ) + +#define ID3D12Device5_CreateCommandAllocator(This,type,riid,ppCommandAllocator) \ + ( (This)->lpVtbl -> CreateCommandAllocator(This,type,riid,ppCommandAllocator) ) + +#define ID3D12Device5_CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateGraphicsPipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device5_CreateComputePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreateComputePipelineState(This,pDesc,riid,ppPipelineState) ) + +#define ID3D12Device5_CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList(This,nodeMask,type,pCommandAllocator,pInitialState,riid,ppCommandList) ) + +#define ID3D12Device5_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12Device5_CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateDescriptorHeap(This,pDescriptorHeapDesc,riid,ppvHeap) ) + +#define ID3D12Device5_GetDescriptorHandleIncrementSize(This,DescriptorHeapType) \ + ( (This)->lpVtbl -> GetDescriptorHandleIncrementSize(This,DescriptorHeapType) ) + +#define ID3D12Device5_CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) \ + ( (This)->lpVtbl -> CreateRootSignature(This,nodeMask,pBlobWithRootSignature,blobLengthInBytes,riid,ppvRootSignature) ) + +#define ID3D12Device5_CreateConstantBufferView(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateConstantBufferView(This,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateShaderResourceView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateUnorderedAccessView(This,pResource,pCounterResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateRenderTargetView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateDepthStencilView(This,pResource,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CreateSampler(This,pDesc,DestDescriptor) \ + ( (This)->lpVtbl -> CreateSampler(This,pDesc,DestDescriptor) ) + +#define ID3D12Device5_CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptors(This,NumDestDescriptorRanges,pDestDescriptorRangeStarts,pDestDescriptorRangeSizes,NumSrcDescriptorRanges,pSrcDescriptorRangeStarts,pSrcDescriptorRangeSizes,DescriptorHeapsType) ) + +#define ID3D12Device5_CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) \ + ( (This)->lpVtbl -> CopyDescriptorsSimple(This,NumDescriptors,DestDescriptorRangeStart,SrcDescriptorRangeStart,DescriptorHeapsType) ) + +#define ID3D12Device5_GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo(This,visibleMask,numResourceDescs,pResourceDescs) ) + +#define ID3D12Device5_GetCustomHeapProperties(This,nodeMask,heapType) \ + ( (This)->lpVtbl -> GetCustomHeapProperties(This,nodeMask,heapType) ) + +#define ID3D12Device5_CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,riidResource,ppvResource) ) + +#define ID3D12Device5_CreateHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device5_CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreatePlacedResource(This,pHeap,HeapOffset,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device5_CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource(This,pDesc,InitialState,pOptimizedClearValue,riid,ppvResource) ) + +#define ID3D12Device5_CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) \ + ( (This)->lpVtbl -> CreateSharedHandle(This,pObject,pAttributes,Access,Name,pHandle) ) + +#define ID3D12Device5_OpenSharedHandle(This,NTHandle,riid,ppvObj) \ + ( (This)->lpVtbl -> OpenSharedHandle(This,NTHandle,riid,ppvObj) ) + +#define ID3D12Device5_OpenSharedHandleByName(This,Name,Access,pNTHandle) \ + ( (This)->lpVtbl -> OpenSharedHandleByName(This,Name,Access,pNTHandle) ) + +#define ID3D12Device5_MakeResident(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> MakeResident(This,NumObjects,ppObjects) ) + +#define ID3D12Device5_Evict(This,NumObjects,ppObjects) \ + ( (This)->lpVtbl -> Evict(This,NumObjects,ppObjects) ) + +#define ID3D12Device5_CreateFence(This,InitialValue,Flags,riid,ppFence) \ + ( (This)->lpVtbl -> CreateFence(This,InitialValue,Flags,riid,ppFence) ) + +#define ID3D12Device5_GetDeviceRemovedReason(This) \ + ( (This)->lpVtbl -> GetDeviceRemovedReason(This) ) + +#define ID3D12Device5_GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) \ + ( (This)->lpVtbl -> GetCopyableFootprints(This,pResourceDesc,FirstSubresource,NumSubresources,BaseOffset,pLayouts,pNumRows,pRowSizeInBytes,pTotalBytes) ) + +#define ID3D12Device5_CreateQueryHeap(This,pDesc,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateQueryHeap(This,pDesc,riid,ppvHeap) ) + +#define ID3D12Device5_SetStablePowerState(This,Enable) \ + ( (This)->lpVtbl -> SetStablePowerState(This,Enable) ) + +#define ID3D12Device5_CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) \ + ( (This)->lpVtbl -> CreateCommandSignature(This,pDesc,pRootSignature,riid,ppvCommandSignature) ) + +#define ID3D12Device5_GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) \ + ( (This)->lpVtbl -> GetResourceTiling(This,pTiledResource,pNumTilesForEntireResource,pPackedMipDesc,pStandardTileShapeForNonPackedMips,pNumSubresourceTilings,FirstSubresourceTilingToGet,pSubresourceTilingsForNonPackedMips) ) + +#define ID3D12Device5_GetAdapterLuid(This) \ + ( (This)->lpVtbl -> GetAdapterLuid(This) ) + + +#define ID3D12Device5_CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) \ + ( (This)->lpVtbl -> CreatePipelineLibrary(This,pLibraryBlob,BlobLength,riid,ppPipelineLibrary) ) + +#define ID3D12Device5_SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) \ + ( (This)->lpVtbl -> SetEventOnMultipleFenceCompletion(This,ppFences,pFenceValues,NumFences,Flags,hEvent) ) + +#define ID3D12Device5_SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) \ + ( (This)->lpVtbl -> SetResidencyPriority(This,NumObjects,ppObjects,pPriorities) ) + + +#define ID3D12Device5_CreatePipelineState(This,pDesc,riid,ppPipelineState) \ + ( (This)->lpVtbl -> CreatePipelineState(This,pDesc,riid,ppPipelineState) ) + + +#define ID3D12Device5_OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromAddress(This,pAddress,riid,ppvHeap) ) + +#define ID3D12Device5_OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) \ + ( (This)->lpVtbl -> OpenExistingHeapFromFileMapping(This,hFileMapping,riid,ppvHeap) ) + +#define ID3D12Device5_EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) \ + ( (This)->lpVtbl -> EnqueueMakeResident(This,Flags,NumObjects,ppObjects,pFenceToSignal,FenceValueToSignal) ) + + +#define ID3D12Device5_CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) \ + ( (This)->lpVtbl -> CreateCommandList1(This,nodeMask,type,flags,riid,ppCommandList) ) + +#define ID3D12Device5_CreateProtectedResourceSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateProtectedResourceSession(This,pDesc,riid,ppSession) ) + +#define ID3D12Device5_CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) \ + ( (This)->lpVtbl -> CreateCommittedResource1(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pProtectedSession,riidResource,ppvResource) ) + +#define ID3D12Device5_CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) \ + ( (This)->lpVtbl -> CreateHeap1(This,pDesc,pProtectedSession,riid,ppvHeap) ) + +#define ID3D12Device5_CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) \ + ( (This)->lpVtbl -> CreateReservedResource1(This,pDesc,InitialState,pOptimizedClearValue,pProtectedSession,riid,ppvResource) ) + +#define ID3D12Device5_GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) \ + ( (This)->lpVtbl -> GetResourceAllocationInfo1(This,visibleMask,numResourceDescs,pResourceDescs,pResourceAllocationInfo1) ) + + +#define ID3D12Device5_CreateLifetimeTracker(This,pOwner,riid,ppvTracker) \ + ( (This)->lpVtbl -> CreateLifetimeTracker(This,pOwner,riid,ppvTracker) ) + +#define ID3D12Device5_RemoveDevice(This) \ + ( (This)->lpVtbl -> RemoveDevice(This) ) + +#define ID3D12Device5_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12Device5_EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandParameters(This,CommandId,Stage,pTotalStructureSizeInBytes,pParameterCount,pParameterDescs) ) + +#define ID3D12Device5_CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,NodeMask,pCreationParametersData,CreationParametersDataSizeInBytes,riid,ppMetaCommand) ) + +#define ID3D12Device5_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12Device5_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#define ID3D12Device5_CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) \ + ( (This)->lpVtbl -> CheckDriverMatchingIdentifier(This,SerializedDataType,pIdentifierToCheck) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Device5_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0035 */ +/* [local] */ + +typedef +enum D3D12_AUTO_BREADCRUMB_OP + { + D3D12_AUTO_BREADCRUMB_OP_SETMARKER = 0, + D3D12_AUTO_BREADCRUMB_OP_BEGINEVENT = 1, + D3D12_AUTO_BREADCRUMB_OP_ENDEVENT = 2, + D3D12_AUTO_BREADCRUMB_OP_DRAWINSTANCED = 3, + D3D12_AUTO_BREADCRUMB_OP_DRAWINDEXEDINSTANCED = 4, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEINDIRECT = 5, + D3D12_AUTO_BREADCRUMB_OP_DISPATCH = 6, + D3D12_AUTO_BREADCRUMB_OP_COPYBUFFERREGION = 7, + D3D12_AUTO_BREADCRUMB_OP_COPYTEXTUREREGION = 8, + D3D12_AUTO_BREADCRUMB_OP_COPYRESOURCE = 9, + D3D12_AUTO_BREADCRUMB_OP_COPYTILES = 10, + D3D12_AUTO_BREADCRUMB_OP_RESOLVESUBRESOURCE = 11, + D3D12_AUTO_BREADCRUMB_OP_CLEARRENDERTARGETVIEW = 12, + D3D12_AUTO_BREADCRUMB_OP_CLEARUNORDEREDACCESSVIEW = 13, + D3D12_AUTO_BREADCRUMB_OP_CLEARDEPTHSTENCILVIEW = 14, + D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER = 15, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEBUNDLE = 16, + D3D12_AUTO_BREADCRUMB_OP_PRESENT = 17, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEQUERYDATA = 18, + D3D12_AUTO_BREADCRUMB_OP_BEGINSUBMISSION = 19, + D3D12_AUTO_BREADCRUMB_OP_ENDSUBMISSION = 20, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME = 21, + D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES = 22, + D3D12_AUTO_BREADCRUMB_OP_ATOMICCOPYBUFFERUINT = 23, + D3D12_AUTO_BREADCRUMB_OP_ATOMICCOPYBUFFERUINT64 = 24, + D3D12_AUTO_BREADCRUMB_OP_RESOLVESUBRESOURCEREGION = 25, + D3D12_AUTO_BREADCRUMB_OP_WRITEBUFFERIMMEDIATE = 26, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME1 = 27, + D3D12_AUTO_BREADCRUMB_OP_SETPROTECTEDRESOURCESESSION = 28, + D3D12_AUTO_BREADCRUMB_OP_DECODEFRAME2 = 29, + D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES1 = 30, + D3D12_AUTO_BREADCRUMB_OP_BUILDRAYTRACINGACCELERATIONSTRUCTURE = 31, + D3D12_AUTO_BREADCRUMB_OP_EMITRAYTRACINGACCELERATIONSTRUCTUREPOSTBUILDINFO = 32, + D3D12_AUTO_BREADCRUMB_OP_COPYRAYTRACINGACCELERATIONSTRUCTURE = 33, + D3D12_AUTO_BREADCRUMB_OP_DISPATCHRAYS = 34, + D3D12_AUTO_BREADCRUMB_OP_INITIALIZEMETACOMMAND = 35, + D3D12_AUTO_BREADCRUMB_OP_EXECUTEMETACOMMAND = 36, + D3D12_AUTO_BREADCRUMB_OP_ESTIMATEMOTION = 37, + D3D12_AUTO_BREADCRUMB_OP_RESOLVEMOTIONVECTORHEAP = 38, + D3D12_AUTO_BREADCRUMB_OP_SETPIPELINESTATE1 = 39 + } D3D12_AUTO_BREADCRUMB_OP; + +typedef struct D3D12_AUTO_BREADCRUMB_NODE + { + const char *pCommandListDebugNameA; + const wchar_t *pCommandListDebugNameW; + const char *pCommandQueueDebugNameA; + const wchar_t *pCommandQueueDebugNameW; + ID3D12GraphicsCommandList *pCommandList; + ID3D12CommandQueue *pCommandQueue; + UINT32 BreadcrumbCount; + UINT32 *pLastBreadcrumbValue; + D3D12_AUTO_BREADCRUMB_OP *pCommandHistory; + struct D3D12_AUTO_BREADCRUMB_NODE *pNext; + } D3D12_AUTO_BREADCRUMB_NODE; + +typedef +enum D3D12_DRED_VERSION + { + D3D12_DRED_VERSION_1_0 = 0x1 + } D3D12_DRED_VERSION; + +typedef +enum D3D12_DRED_FLAGS + { + D3D12_DRED_FLAG_NONE = 0, + D3D12_DRED_FLAG_FORCE_ENABLE = 1, + D3D12_DRED_FLAG_DISABLE_AUTOBREADCRUMBS = 2 + } D3D12_DRED_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_DRED_FLAGS ); +typedef struct D3D12_DEVICE_REMOVED_EXTENDED_DATA + { + _In_ D3D12_DRED_FLAGS Flags; + _Out_ D3D12_AUTO_BREADCRUMB_NODE *pHeadAutoBreadcrumbNode; + } D3D12_DEVICE_REMOVED_EXTENDED_DATA; + +typedef struct D3D12_VERSIONED_DEVICE_REMOVED_EXTENDED_DATA + { + D3D12_DRED_VERSION Version; + union + { + D3D12_DEVICE_REMOVED_EXTENDED_DATA Dred_1_0; + } ; + } D3D12_VERSIONED_DEVICE_REMOVED_EXTENDED_DATA; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0035_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0035_v0_0_s_ifspec; + +#ifndef __ID3D12Resource1_INTERFACE_DEFINED__ +#define __ID3D12Resource1_INTERFACE_DEFINED__ + +/* interface ID3D12Resource1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Resource1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9D5E227A-4430-4161-88B3-3ECA6BB16E19") + ID3D12Resource1 : public ID3D12Resource + { + public: + virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession( + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Resource1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Resource1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Resource1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Resource1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Resource1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Resource1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Resource1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Resource1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Resource1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *Map )( + ID3D12Resource1 * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pReadRange, + _Outptr_opt_result_bytebuffer_(_Inexpressible_("Dependent on resource")) void **ppData); + + void ( STDMETHODCALLTYPE *Unmap )( + ID3D12Resource1 * This, + UINT Subresource, + _In_opt_ const D3D12_RANGE *pWrittenRange); + + D3D12_RESOURCE_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Resource1 * This); + + D3D12_GPU_VIRTUAL_ADDRESS ( STDMETHODCALLTYPE *GetGPUVirtualAddress )( + ID3D12Resource1 * This); + + HRESULT ( STDMETHODCALLTYPE *WriteToSubresource )( + ID3D12Resource1 * This, + UINT DstSubresource, + _In_opt_ const D3D12_BOX *pDstBox, + _In_ const void *pSrcData, + UINT SrcRowPitch, + UINT SrcDepthPitch); + + HRESULT ( STDMETHODCALLTYPE *ReadFromSubresource )( + ID3D12Resource1 * This, + _Out_ void *pDstData, + UINT DstRowPitch, + UINT DstDepthPitch, + UINT SrcSubresource, + _In_opt_ const D3D12_BOX *pSrcBox); + + HRESULT ( STDMETHODCALLTYPE *GetHeapProperties )( + ID3D12Resource1 * This, + _Out_opt_ D3D12_HEAP_PROPERTIES *pHeapProperties, + _Out_opt_ D3D12_HEAP_FLAGS *pHeapFlags); + + HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )( + ID3D12Resource1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession); + + END_INTERFACE + } ID3D12Resource1Vtbl; + + interface ID3D12Resource1 + { + CONST_VTBL struct ID3D12Resource1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Resource1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Resource1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Resource1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Resource1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Resource1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Resource1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Resource1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Resource1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Resource1_Map(This,Subresource,pReadRange,ppData) \ + ( (This)->lpVtbl -> Map(This,Subresource,pReadRange,ppData) ) + +#define ID3D12Resource1_Unmap(This,Subresource,pWrittenRange) \ + ( (This)->lpVtbl -> Unmap(This,Subresource,pWrittenRange) ) + +#define ID3D12Resource1_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) + +#define ID3D12Resource1_GetGPUVirtualAddress(This) \ + ( (This)->lpVtbl -> GetGPUVirtualAddress(This) ) + +#define ID3D12Resource1_WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) \ + ( (This)->lpVtbl -> WriteToSubresource(This,DstSubresource,pDstBox,pSrcData,SrcRowPitch,SrcDepthPitch) ) + +#define ID3D12Resource1_ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) \ + ( (This)->lpVtbl -> ReadFromSubresource(This,pDstData,DstRowPitch,DstDepthPitch,SrcSubresource,pSrcBox) ) + +#define ID3D12Resource1_GetHeapProperties(This,pHeapProperties,pHeapFlags) \ + ( (This)->lpVtbl -> GetHeapProperties(This,pHeapProperties,pHeapFlags) ) + + +#define ID3D12Resource1_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Resource1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Heap1_INTERFACE_DEFINED__ +#define __ID3D12Heap1_INTERFACE_DEFINED__ + +/* interface ID3D12Heap1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Heap1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("572F7389-2168-49E3-9693-D6DF5871BF6D") + ID3D12Heap1 : public ID3D12Heap + { + public: + virtual HRESULT STDMETHODCALLTYPE GetProtectedResourceSession( + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Heap1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Heap1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Heap1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Heap1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12Heap1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12Heap1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12Heap1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12Heap1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12Heap1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12Heap1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetProtectedResourceSession )( + ID3D12Heap1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppProtectedSession); + + END_INTERFACE + } ID3D12Heap1Vtbl; + + interface ID3D12Heap1 + { + CONST_VTBL struct ID3D12Heap1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Heap1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Heap1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Heap1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Heap1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12Heap1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12Heap1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12Heap1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12Heap1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12Heap1_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) + + +#define ID3D12Heap1_GetProtectedResourceSession(This,riid,ppProtectedSession) \ + ( (This)->lpVtbl -> GetProtectedResourceSession(This,riid,ppProtectedSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Heap1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12GraphicsCommandList3_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList3_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6FDA83A7-B84C-4E38-9AC8-C7BD22016B3D") + ID3D12GraphicsCommandList3 : public ID3D12GraphicsCommandList2 + { + public: + virtual void STDMETHODCALLTYPE SetProtectedResourceSession( + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList3 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList3 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList3 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList3 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList3 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList3 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList3 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList3 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList3 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList3 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList3 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList3 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT StencilRef); + + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList3 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList3 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList3 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList3 * This); + + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList3 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList3 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList3 * This, + _In_ UINT Mask); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList3 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList3 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + END_INTERFACE + } ID3D12GraphicsCommandList3Vtbl; + + interface ID3D12GraphicsCommandList3 + { + CONST_VTBL struct ID3D12GraphicsCommandList3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList3_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList3_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList3_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList3_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList3_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList3_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList3_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList3_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList3_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList3_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList3_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList3_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList3_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList3_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList3_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList3_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList3_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList3_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList3_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList3_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList3_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList3_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList3_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList3_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList3_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList3_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList3_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList3_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList3_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList3_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList3_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList3_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList3_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList3_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList3_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList3_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList3_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList3_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList3_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList3_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList3_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList3_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList3_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList3_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList3_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList3_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList3_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList3_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList3_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0038 */ +/* [local] */ + +typedef +enum D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE + { + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD = 0, + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE + 1 ) , + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS = ( D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR + 1 ) + } D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE; + +typedef struct D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS + { + D3D12_CLEAR_VALUE ClearValue; + } D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_BEGINNING_ACCESS + { + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE Type; + union + { + D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS Clear; + } ; + } D3D12_RENDER_PASS_BEGINNING_ACCESS; + +typedef +enum D3D12_RENDER_PASS_ENDING_ACCESS_TYPE + { + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD = 0, + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_DISCARD + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE + 1 ) , + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS = ( D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE + 1 ) + } D3D12_RENDER_PASS_ENDING_ACCESS_TYPE; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS + { + UINT SrcSubresource; + UINT DstSubresource; + UINT DstX; + UINT DstY; + D3D12_RECT SrcRect; + } D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS + { + ID3D12Resource *pSrcResource; + ID3D12Resource *pDstResource; + UINT SubresourceCount; + _Field_size_full_(SubresourceCount) const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_SUBRESOURCE_PARAMETERS *pSubresourceParameters; + DXGI_FORMAT Format; + D3D12_RESOLVE_MODE ResolveMode; + BOOL PreserveResolveSource; + } D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS; + +typedef struct D3D12_RENDER_PASS_ENDING_ACCESS + { + D3D12_RENDER_PASS_ENDING_ACCESS_TYPE Type; + union + { + D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS Resolve; + } ; + } D3D12_RENDER_PASS_ENDING_ACCESS; + +typedef struct D3D12_RENDER_PASS_RENDER_TARGET_DESC + { + D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptor; + D3D12_RENDER_PASS_BEGINNING_ACCESS BeginningAccess; + D3D12_RENDER_PASS_ENDING_ACCESS EndingAccess; + } D3D12_RENDER_PASS_RENDER_TARGET_DESC; + +typedef struct D3D12_RENDER_PASS_DEPTH_STENCIL_DESC + { + D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptor; + D3D12_RENDER_PASS_BEGINNING_ACCESS DepthBeginningAccess; + D3D12_RENDER_PASS_BEGINNING_ACCESS StencilBeginningAccess; + D3D12_RENDER_PASS_ENDING_ACCESS DepthEndingAccess; + D3D12_RENDER_PASS_ENDING_ACCESS StencilEndingAccess; + } D3D12_RENDER_PASS_DEPTH_STENCIL_DESC; + +typedef +enum D3D12_RENDER_PASS_FLAGS + { + D3D12_RENDER_PASS_FLAG_NONE = 0, + D3D12_RENDER_PASS_FLAG_ALLOW_UAV_WRITES = 0x1, + D3D12_RENDER_PASS_FLAG_SUSPENDING_PASS = 0x2, + D3D12_RENDER_PASS_FLAG_RESUMING_PASS = 0x4 + } D3D12_RENDER_PASS_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RENDER_PASS_FLAGS ); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0038_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0038_v0_0_s_ifspec; + +#ifndef __ID3D12MetaCommand_INTERFACE_DEFINED__ +#define __ID3D12MetaCommand_INTERFACE_DEFINED__ + +/* interface ID3D12MetaCommand */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12MetaCommand; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DBB84C27-36CE-4FC9-B801-F048C46AC570") + ID3D12MetaCommand : public ID3D12Pageable + { + public: + virtual UINT64 STDMETHODCALLTYPE GetRequiredParameterResourceSize( + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _In_ UINT ParameterIndex) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12MetaCommandVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12MetaCommand * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12MetaCommand * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12MetaCommand * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12MetaCommand * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12MetaCommand * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + UINT64 ( STDMETHODCALLTYPE *GetRequiredParameterResourceSize )( + ID3D12MetaCommand * This, + _In_ D3D12_META_COMMAND_PARAMETER_STAGE Stage, + _In_ UINT ParameterIndex); + + END_INTERFACE + } ID3D12MetaCommandVtbl; + + interface ID3D12MetaCommand + { + CONST_VTBL struct ID3D12MetaCommandVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12MetaCommand_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12MetaCommand_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12MetaCommand_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12MetaCommand_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12MetaCommand_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12MetaCommand_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12MetaCommand_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12MetaCommand_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12MetaCommand_GetRequiredParameterResourceSize(This,Stage,ParameterIndex) \ + ( (This)->lpVtbl -> GetRequiredParameterResourceSize(This,Stage,ParameterIndex) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12MetaCommand_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0039 */ +/* [local] */ + +typedef struct D3D12_DISPATCH_RAYS_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS_RANGE RayGenerationShaderRecord; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE MissShaderTable; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE HitGroupTable; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE CallableShaderTable; + UINT Width; + UINT Height; + UINT Depth; + } D3D12_DISPATCH_RAYS_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0039_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0039_v0_0_s_ifspec; + +#ifndef __ID3D12GraphicsCommandList4_INTERFACE_DEFINED__ +#define __ID3D12GraphicsCommandList4_INTERFACE_DEFINED__ + +/* interface ID3D12GraphicsCommandList4 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12GraphicsCommandList4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8754318e-d3a9-4541-98cf-645b50dc4874") + ID3D12GraphicsCommandList4 : public ID3D12GraphicsCommandList3 + { + public: + virtual void STDMETHODCALLTYPE BeginRenderPass( + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags) = 0; + + virtual void STDMETHODCALLTYPE EndRenderPass( void) = 0; + + virtual void STDMETHODCALLTYPE InitializeMetaCommand( + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes) = 0; + + virtual void STDMETHODCALLTYPE ExecuteMetaCommand( + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes) = 0; + + virtual void STDMETHODCALLTYPE BuildRaytracingAccelerationStructure( + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs) = 0; + + virtual void STDMETHODCALLTYPE EmitRaytracingAccelerationStructurePostbuildInfo( + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData) = 0; + + virtual void STDMETHODCALLTYPE CopyRaytracingAccelerationStructure( + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode) = 0; + + virtual void STDMETHODCALLTYPE SetPipelineState1( + _In_ ID3D12StateObject *pStateObject) = 0; + + virtual void STDMETHODCALLTYPE DispatchRays( + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12GraphicsCommandList4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12GraphicsCommandList4 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12GraphicsCommandList4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12GraphicsCommandList4 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12GraphicsCommandList4 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12GraphicsCommandList4 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12GraphicsCommandList4 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12GraphicsCommandList4 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12GraphicsCommandList4 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12GraphicsCommandList4 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12GraphicsCommandList4 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12CommandAllocator *pAllocator, + _In_opt_ ID3D12PipelineState *pInitialState); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *DrawInstanced )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT VertexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *DrawIndexedInstanced )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT IndexCountPerInstance, + _In_ UINT InstanceCount, + _In_ UINT StartIndexLocation, + _In_ INT BaseVertexLocation, + _In_ UINT StartInstanceLocation); + + void ( STDMETHODCALLTYPE *Dispatch )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT ThreadGroupCountX, + _In_ UINT ThreadGroupCountY, + _In_ UINT ThreadGroupCountZ); + + void ( STDMETHODCALLTYPE *CopyBufferRegion )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT64 NumBytes); + + void ( STDMETHODCALLTYPE *CopyTextureRegion )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pDst, + UINT DstX, + UINT DstY, + UINT DstZ, + _In_ const D3D12_TEXTURE_COPY_LOCATION *pSrc, + _In_opt_ const D3D12_BOX *pSrcBox); + + void ( STDMETHODCALLTYPE *CopyResource )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstResource, + _In_ ID3D12Resource *pSrcResource); + + void ( STDMETHODCALLTYPE *CopyTiles )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pTiledResource, + _In_ const D3D12_TILED_RESOURCE_COORDINATE *pTileRegionStartCoordinate, + _In_ const D3D12_TILE_REGION_SIZE *pTileRegionSize, + _In_ ID3D12Resource *pBuffer, + UINT64 BufferStartOffsetInBytes, + D3D12_TILE_COPY_FLAGS Flags); + + void ( STDMETHODCALLTYPE *ResolveSubresource )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_ DXGI_FORMAT Format); + + void ( STDMETHODCALLTYPE *IASetPrimitiveTopology )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_PRIMITIVE_TOPOLOGY PrimitiveTopology); + + void ( STDMETHODCALLTYPE *RSSetViewports )( + ID3D12GraphicsCommandList4 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumViewports, + _In_reads_( NumViewports) const D3D12_VIEWPORT *pViewports); + + void ( STDMETHODCALLTYPE *RSSetScissorRects )( + ID3D12GraphicsCommandList4 * This, + _In_range_(0, D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE) UINT NumRects, + _In_reads_( NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *OMSetBlendFactor )( + ID3D12GraphicsCommandList4 * This, + _In_reads_opt_(4) const FLOAT BlendFactor[ 4 ]); + + void ( STDMETHODCALLTYPE *OMSetStencilRef )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT StencilRef); + + void ( STDMETHODCALLTYPE *SetPipelineState )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12PipelineState *pPipelineState); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *ExecuteBundle )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12GraphicsCommandList *pCommandList); + + void ( STDMETHODCALLTYPE *SetDescriptorHeaps )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumDescriptorHeaps, + _In_reads_(NumDescriptorHeaps) ID3D12DescriptorHeap *const *ppDescriptorHeaps); + + void ( STDMETHODCALLTYPE *SetComputeRootSignature )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetGraphicsRootSignature )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12RootSignature *pRootSignature); + + void ( STDMETHODCALLTYPE *SetComputeRootDescriptorTable )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetGraphicsRootDescriptorTable )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE BaseDescriptor); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstant )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstant )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT SrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRoot32BitConstants )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetGraphicsRoot32BitConstants )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ UINT Num32BitValuesToSet, + _In_reads_(Num32BitValuesToSet*sizeof(UINT)) const void *pSrcData, + _In_ UINT DestOffsetIn32BitValues); + + void ( STDMETHODCALLTYPE *SetComputeRootConstantBufferView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootConstantBufferView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootShaderResourceView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootShaderResourceView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetComputeRootUnorderedAccessView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *SetGraphicsRootUnorderedAccessView )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT RootParameterIndex, + _In_ D3D12_GPU_VIRTUAL_ADDRESS BufferLocation); + + void ( STDMETHODCALLTYPE *IASetIndexBuffer )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ const D3D12_INDEX_BUFFER_VIEW *pView); + + void ( STDMETHODCALLTYPE *IASetVertexBuffers )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_VERTEX_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *SOSetTargets )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT StartSlot, + _In_ UINT NumViews, + _In_reads_opt_(NumViews) const D3D12_STREAM_OUTPUT_BUFFER_VIEW *pViews); + + void ( STDMETHODCALLTYPE *OMSetRenderTargets )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumRenderTargetDescriptors, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pRenderTargetDescriptors, + _In_ BOOL RTsSingleHandleToDescriptorRange, + _In_opt_ const D3D12_CPU_DESCRIPTOR_HANDLE *pDepthStencilDescriptor); + + void ( STDMETHODCALLTYPE *ClearDepthStencilView )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE DepthStencilView, + _In_ D3D12_CLEAR_FLAGS ClearFlags, + _In_ FLOAT Depth, + _In_ UINT8 Stencil, + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearRenderTargetView )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE RenderTargetView, + _In_ const FLOAT ColorRGBA[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewUint )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const UINT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *ClearUnorderedAccessViewFloat )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_GPU_DESCRIPTOR_HANDLE ViewGPUHandleInCurrentHeap, + _In_ D3D12_CPU_DESCRIPTOR_HANDLE ViewCPUHandle, + _In_ ID3D12Resource *pResource, + _In_ const FLOAT Values[ 4 ], + _In_ UINT NumRects, + _In_reads_(NumRects) const D3D12_RECT *pRects); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12GraphicsCommandList4 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12GraphicsCommandList4 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12GraphicsCommandList4 * This); + + void ( STDMETHODCALLTYPE *ExecuteIndirect )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12CommandSignature *pCommandSignature, + _In_ UINT MaxCommandCount, + _In_ ID3D12Resource *pArgumentBuffer, + _In_ UINT64 ArgumentBufferOffset, + _In_opt_ ID3D12Resource *pCountBuffer, + _In_ UINT64 CountBufferOffset); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *AtomicCopyBufferUINT64 )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstBuffer, + UINT64 DstOffset, + _In_ ID3D12Resource *pSrcBuffer, + UINT64 SrcOffset, + UINT Dependencies, + _In_reads_(Dependencies) ID3D12Resource *const *ppDependentResources, + _In_reads_(Dependencies) const D3D12_SUBRESOURCE_RANGE_UINT64 *pDependentSubresourceRanges); + + void ( STDMETHODCALLTYPE *OMSetDepthBounds )( + ID3D12GraphicsCommandList4 * This, + _In_ FLOAT Min, + _In_ FLOAT Max); + + void ( STDMETHODCALLTYPE *SetSamplePositions )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumSamplesPerPixel, + _In_ UINT NumPixels, + _In_reads_(NumSamplesPerPixel*NumPixels) D3D12_SAMPLE_POSITION *pSamplePositions); + + void ( STDMETHODCALLTYPE *ResolveSubresourceRegion )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12Resource *pDstResource, + _In_ UINT DstSubresource, + _In_ UINT DstX, + _In_ UINT DstY, + _In_ ID3D12Resource *pSrcResource, + _In_ UINT SrcSubresource, + _In_opt_ D3D12_RECT *pSrcRect, + _In_ DXGI_FORMAT Format, + _In_ D3D12_RESOLVE_MODE ResolveMode); + + void ( STDMETHODCALLTYPE *SetViewInstanceMask )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT Mask); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12GraphicsCommandList4 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12GraphicsCommandList4 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + void ( STDMETHODCALLTYPE *BeginRenderPass )( + ID3D12GraphicsCommandList4 * This, + _In_ UINT NumRenderTargets, + _In_reads_opt_(NumRenderTargets) const D3D12_RENDER_PASS_RENDER_TARGET_DESC *pRenderTargets, + _In_opt_ const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC *pDepthStencil, + D3D12_RENDER_PASS_FLAGS Flags); + + void ( STDMETHODCALLTYPE *EndRenderPass )( + ID3D12GraphicsCommandList4 * This); + + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(InitializationParametersDataSizeInBytes) const void *pInitializationParametersData, + _In_ SIZE_T InitializationParametersDataSizeInBytes); + + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_reads_bytes_opt_(ExecutionParametersDataSizeInBytes) const void *pExecutionParametersData, + _In_ SIZE_T ExecutionParametersDataSizeInBytes); + + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc, + _In_ UINT NumPostbuildInfoDescs, + _In_reads_opt_(NumPostbuildInfoDescs) const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pPostbuildInfoDescs); + + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostbuildInfo )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_DESC *pDesc, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12GraphicsCommandList4 * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + void ( STDMETHODCALLTYPE *SetPipelineState1 )( + ID3D12GraphicsCommandList4 * This, + _In_ ID3D12StateObject *pStateObject); + + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12GraphicsCommandList4 * This, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + END_INTERFACE + } ID3D12GraphicsCommandList4Vtbl; + + interface ID3D12GraphicsCommandList4 + { + CONST_VTBL struct ID3D12GraphicsCommandList4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12GraphicsCommandList4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12GraphicsCommandList4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12GraphicsCommandList4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12GraphicsCommandList4_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12GraphicsCommandList4_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12GraphicsCommandList4_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12GraphicsCommandList4_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12GraphicsCommandList4_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12GraphicsCommandList4_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12GraphicsCommandList4_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12GraphicsCommandList4_Reset(This,pAllocator,pInitialState) \ + ( (This)->lpVtbl -> Reset(This,pAllocator,pInitialState) ) + +#define ID3D12GraphicsCommandList4_ClearState(This,pPipelineState) \ + ( (This)->lpVtbl -> ClearState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList4_DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawInstanced(This,VertexCountPerInstance,InstanceCount,StartVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList4_DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) \ + ( (This)->lpVtbl -> DrawIndexedInstanced(This,IndexCountPerInstance,InstanceCount,StartIndexLocation,BaseVertexLocation,StartInstanceLocation) ) + +#define ID3D12GraphicsCommandList4_Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) \ + ( (This)->lpVtbl -> Dispatch(This,ThreadGroupCountX,ThreadGroupCountY,ThreadGroupCountZ) ) + +#define ID3D12GraphicsCommandList4_CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) \ + ( (This)->lpVtbl -> CopyBufferRegion(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,NumBytes) ) + +#define ID3D12GraphicsCommandList4_CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) \ + ( (This)->lpVtbl -> CopyTextureRegion(This,pDst,DstX,DstY,DstZ,pSrc,pSrcBox) ) + +#define ID3D12GraphicsCommandList4_CopyResource(This,pDstResource,pSrcResource) \ + ( (This)->lpVtbl -> CopyResource(This,pDstResource,pSrcResource) ) + +#define ID3D12GraphicsCommandList4_CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) \ + ( (This)->lpVtbl -> CopyTiles(This,pTiledResource,pTileRegionStartCoordinate,pTileRegionSize,pBuffer,BufferStartOffsetInBytes,Flags) ) + +#define ID3D12GraphicsCommandList4_ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) \ + ( (This)->lpVtbl -> ResolveSubresource(This,pDstResource,DstSubresource,pSrcResource,SrcSubresource,Format) ) + +#define ID3D12GraphicsCommandList4_IASetPrimitiveTopology(This,PrimitiveTopology) \ + ( (This)->lpVtbl -> IASetPrimitiveTopology(This,PrimitiveTopology) ) + +#define ID3D12GraphicsCommandList4_RSSetViewports(This,NumViewports,pViewports) \ + ( (This)->lpVtbl -> RSSetViewports(This,NumViewports,pViewports) ) + +#define ID3D12GraphicsCommandList4_RSSetScissorRects(This,NumRects,pRects) \ + ( (This)->lpVtbl -> RSSetScissorRects(This,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_OMSetBlendFactor(This,BlendFactor) \ + ( (This)->lpVtbl -> OMSetBlendFactor(This,BlendFactor) ) + +#define ID3D12GraphicsCommandList4_OMSetStencilRef(This,StencilRef) \ + ( (This)->lpVtbl -> OMSetStencilRef(This,StencilRef) ) + +#define ID3D12GraphicsCommandList4_SetPipelineState(This,pPipelineState) \ + ( (This)->lpVtbl -> SetPipelineState(This,pPipelineState) ) + +#define ID3D12GraphicsCommandList4_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12GraphicsCommandList4_ExecuteBundle(This,pCommandList) \ + ( (This)->lpVtbl -> ExecuteBundle(This,pCommandList) ) + +#define ID3D12GraphicsCommandList4_SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) \ + ( (This)->lpVtbl -> SetDescriptorHeaps(This,NumDescriptorHeaps,ppDescriptorHeaps) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetComputeRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootSignature(This,pRootSignature) \ + ( (This)->lpVtbl -> SetGraphicsRootSignature(This,pRootSignature) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetComputeRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) \ + ( (This)->lpVtbl -> SetGraphicsRootDescriptorTable(This,RootParameterIndex,BaseDescriptor) ) + +#define ID3D12GraphicsCommandList4_SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstant(This,RootParameterIndex,SrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetComputeRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) \ + ( (This)->lpVtbl -> SetGraphicsRoot32BitConstants(This,RootParameterIndex,Num32BitValuesToSet,pSrcData,DestOffsetIn32BitValues) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootConstantBufferView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootShaderResourceView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetComputeRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) \ + ( (This)->lpVtbl -> SetGraphicsRootUnorderedAccessView(This,RootParameterIndex,BufferLocation) ) + +#define ID3D12GraphicsCommandList4_IASetIndexBuffer(This,pView) \ + ( (This)->lpVtbl -> IASetIndexBuffer(This,pView) ) + +#define ID3D12GraphicsCommandList4_IASetVertexBuffers(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> IASetVertexBuffers(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList4_SOSetTargets(This,StartSlot,NumViews,pViews) \ + ( (This)->lpVtbl -> SOSetTargets(This,StartSlot,NumViews,pViews) ) + +#define ID3D12GraphicsCommandList4_OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) \ + ( (This)->lpVtbl -> OMSetRenderTargets(This,NumRenderTargetDescriptors,pRenderTargetDescriptors,RTsSingleHandleToDescriptorRange,pDepthStencilDescriptor) ) + +#define ID3D12GraphicsCommandList4_ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearDepthStencilView(This,DepthStencilView,ClearFlags,Depth,Stencil,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearRenderTargetView(This,RenderTargetView,ColorRGBA,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewUint(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) \ + ( (This)->lpVtbl -> ClearUnorderedAccessViewFloat(This,ViewGPUHandleInCurrentHeap,ViewCPUHandle,pResource,Values,NumRects,pRects) ) + +#define ID3D12GraphicsCommandList4_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12GraphicsCommandList4_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList4_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12GraphicsCommandList4_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12GraphicsCommandList4_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12GraphicsCommandList4_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList4_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12GraphicsCommandList4_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12GraphicsCommandList4_ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) \ + ( (This)->lpVtbl -> ExecuteIndirect(This,pCommandSignature,MaxCommandCount,pArgumentBuffer,ArgumentBufferOffset,pCountBuffer,CountBufferOffset) ) + + +#define ID3D12GraphicsCommandList4_AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList4_AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) \ + ( (This)->lpVtbl -> AtomicCopyBufferUINT64(This,pDstBuffer,DstOffset,pSrcBuffer,SrcOffset,Dependencies,ppDependentResources,pDependentSubresourceRanges) ) + +#define ID3D12GraphicsCommandList4_OMSetDepthBounds(This,Min,Max) \ + ( (This)->lpVtbl -> OMSetDepthBounds(This,Min,Max) ) + +#define ID3D12GraphicsCommandList4_SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) \ + ( (This)->lpVtbl -> SetSamplePositions(This,NumSamplesPerPixel,NumPixels,pSamplePositions) ) + +#define ID3D12GraphicsCommandList4_ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) \ + ( (This)->lpVtbl -> ResolveSubresourceRegion(This,pDstResource,DstSubresource,DstX,DstY,pSrcResource,SrcSubresource,pSrcRect,Format,ResolveMode) ) + +#define ID3D12GraphicsCommandList4_SetViewInstanceMask(This,Mask) \ + ( (This)->lpVtbl -> SetViewInstanceMask(This,Mask) ) + + +#define ID3D12GraphicsCommandList4_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12GraphicsCommandList4_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + + +#define ID3D12GraphicsCommandList4_BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) \ + ( (This)->lpVtbl -> BeginRenderPass(This,NumRenderTargets,pRenderTargets,pDepthStencil,Flags) ) + +#define ID3D12GraphicsCommandList4_EndRenderPass(This) \ + ( (This)->lpVtbl -> EndRenderPass(This) ) + +#define ID3D12GraphicsCommandList4_InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,pInitializationParametersData,InitializationParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList4_ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,pExecutionParametersData,ExecutionParametersDataSizeInBytes) ) + +#define ID3D12GraphicsCommandList4_BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc,NumPostbuildInfoDescs,pPostbuildInfoDescs) ) + +#define ID3D12GraphicsCommandList4_EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostbuildInfo(This,pDesc,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12GraphicsCommandList4_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12GraphicsCommandList4_SetPipelineState1(This,pStateObject) \ + ( (This)->lpVtbl -> SetPipelineState1(This,pStateObject) ) + +#define ID3D12GraphicsCommandList4_DispatchRays(This,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12GraphicsCommandList4_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Tools_INTERFACE_DEFINED__ +#define __ID3D12Tools_INTERFACE_DEFINED__ + +/* interface ID3D12Tools */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Tools; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7071e1f0-e84b-4b33-974f-12fa49de65c5") + ID3D12Tools : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE EnableShaderInstrumentation( + BOOL bEnable) = 0; + + virtual BOOL STDMETHODCALLTYPE ShaderInstrumentationEnabled( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ToolsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Tools * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Tools * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Tools * This); + + void ( STDMETHODCALLTYPE *EnableShaderInstrumentation )( + ID3D12Tools * This, + BOOL bEnable); + + BOOL ( STDMETHODCALLTYPE *ShaderInstrumentationEnabled )( + ID3D12Tools * This); + + END_INTERFACE + } ID3D12ToolsVtbl; + + interface ID3D12Tools + { + CONST_VTBL struct ID3D12ToolsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Tools_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Tools_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Tools_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Tools_EnableShaderInstrumentation(This,bEnable) \ + ( (This)->lpVtbl -> EnableShaderInstrumentation(This,bEnable) ) + +#define ID3D12Tools_ShaderInstrumentationEnabled(This) \ + ( (This)->lpVtbl -> ShaderInstrumentationEnabled(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Tools_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_0000_0041 */ /* [local] */ typedef struct D3D12_SUBRESOURCE_DATA @@ -6225,27 +15270,127 @@ typedef HRESULT (WINAPI* PFN_D3D12_GET_DEBUG_INTERFACE)( _In_ REFIID, _COM_Outpt HRESULT WINAPI D3D12GetDebugInterface( _In_ REFIID riid, _COM_Outptr_opt_ void** ppvDebug ); +// -------------------------------------------------------------------------------------------------------------------------------- +// D3D12EnableExperimentalFeatures +// +// Pass in a list of feature GUIDs to be enabled together. +// +// If a particular feature requires some configuration information on enablement, it will have +// a configuration struct that can be passed alongside the GUID. +// +// Some features might use an interface IID as the GUID. For these, once the feature is enabled via +// D3D12EnableExperimentalFeatures, D3D12GetDebugInterface can then be called with the IID to retrieve the interface +// for manipulating the feature. This allows for control that might not cleanly be expressed by just +// the configuration struct that D3D12EnableExperimentalFeatures provides. +// +// If this method is called and a change to existing feature enablement is made, +// all current D3D12 devices are set to DEVICE_REMOVED state, since under the covers there is really only one +// singleton device for a process. Removing the devices when configuration changes prevents +// mismatched expectations of how a device is supposed to work after it has been created from the app's point of view. +// +// The call returns E_NOINTERFACE if an unrecognized feature is passed in or Windows Developer mode is not on. +// The call returns E_INVALIDARG if the configuration of a feature is incorrect, the set of features passed +// in are known to be incompatible with each other, or other errors. +// Returns S_OK otherwise. +// +// -------------------------------------------------------------------------------------------------------------------------------- +HRESULT WINAPI D3D12EnableExperimentalFeatures( + UINT NumFeatures, + __in_ecount(NumFeatures) const IID* pIIDs, + __in_ecount_opt(NumFeatures) void* pConfigurationStructs, + __in_ecount_opt(NumFeatures) UINT* pConfigurationStructSizes); + +// -------------------------------------------------------------------------------------------------------------------------------- +// Experimental Feature: D3D12ExperimentalShaderModels +// +// Use with D3D12EnableExperimentalFeatures to enable experimental shader model support, +// meaning shader models that haven't been finalized for use in retail. +// +// Enabling D3D12ExperimentalShaderModels needs no configuration struct, pass NULL in the pConfigurationStructs array. +// +// -------------------------------------------------------------------------------------------------------------------------------- +static const UUID D3D12ExperimentalShaderModels = { /* 76f5573e-f13a-40f5-b297-81ce9e18933f */ + 0x76f5573e, + 0xf13a, + 0x40f5, + { 0xb2, 0x97, 0x81, 0xce, 0x9e, 0x18, 0x93, 0x3f } +}; +// -------------------------------------------------------------------------------------------------------------------------------- +// Experimental Feature: D3D12TiledResourceTier4 +// +// Use with D3D12EnableExperimentalFeatures to enable tiled resource tier 4 support, +// meaning texture tile data-inheritance is allowed. +// +// Enabling D3D12TiledResourceTier4 needs no configuration struct, pass NULL in the pConfigurationStructs array. +// +// -------------------------------------------------------------------------------------------------------------------------------- +static const UUID D3D12TiledResourceTier4 = { /* c9c4725f-a81a-4f56-8c5b-c51039d694fb */ + 0xc9c4725f, + 0xa81a, + 0x4f56, + { 0x8c, 0x5b, 0xc5, 0x10, 0x39, 0xd6, 0x94, 0xfb } +}; +// -------------------------------------------------------------------------------------------------------------------------------- +// Experimental Feature: D3D12MetaCommand +// +// Use with D3D12EnableExperimentalFeatures to enable the D3D12 Meta Command. +// +// Enabling D3D12MetaCommand needs no configuration struct, pass NULL in the pConfigurationStructs array. +// +// -------------------------------------------------------------------------------------------------------------------------------- +static const UUID D3D12MetaCommand = { /* C734C97E-8077-48C8-9FDC-D9D1DD31DD77 */ + 0xc734c97e, + 0x8077, + 0x48c8, + { 0x9f, 0xdc, 0xd9, 0xd1, 0xdd, 0x31, 0xdd, 0x77 } +}; +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion DEFINE_GUID(IID_ID3D12Object,0xc4fec28f,0x7966,0x4e95,0x9f,0x94,0xf4,0x31,0xcb,0x56,0xc3,0xb8); DEFINE_GUID(IID_ID3D12DeviceChild,0x905db94b,0xa00c,0x4140,0x9d,0xf5,0x2b,0x64,0xca,0x9e,0xa3,0x57); DEFINE_GUID(IID_ID3D12RootSignature,0xc54a6b66,0x72df,0x4ee8,0x8b,0xe5,0xa9,0x46,0xa1,0x42,0x92,0x14); DEFINE_GUID(IID_ID3D12RootSignatureDeserializer,0x34AB647B,0x3CC8,0x46AC,0x84,0x1B,0xC0,0x96,0x56,0x45,0xC0,0x46); +DEFINE_GUID(IID_ID3D12VersionedRootSignatureDeserializer,0x7F91CE67,0x090C,0x4BB7,0xB7,0x8E,0xED,0x8F,0xF2,0xE3,0x1D,0xA0); DEFINE_GUID(IID_ID3D12Pageable,0x63ee58fb,0x1268,0x4835,0x86,0xda,0xf0,0x08,0xce,0x62,0xf0,0xd6); DEFINE_GUID(IID_ID3D12Heap,0x6b3b2502,0x6e51,0x45b3,0x90,0xee,0x98,0x84,0x26,0x5e,0x8d,0xf3); DEFINE_GUID(IID_ID3D12Resource,0x696442be,0xa72e,0x4059,0xbc,0x79,0x5b,0x5c,0x98,0x04,0x0f,0xad); DEFINE_GUID(IID_ID3D12CommandAllocator,0x6102dee4,0xaf59,0x4b09,0xb9,0x99,0xb4,0x4d,0x73,0xf0,0x9b,0x24); DEFINE_GUID(IID_ID3D12Fence,0x0a753dcf,0xc4d8,0x4b91,0xad,0xf6,0xbe,0x5a,0x60,0xd9,0x5a,0x76); +DEFINE_GUID(IID_ID3D12Fence1,0x433685fe,0xe22b,0x4ca0,0xa8,0xdb,0xb5,0xb4,0xf4,0xdd,0x0e,0x4a); DEFINE_GUID(IID_ID3D12PipelineState,0x765a30f3,0xf624,0x4c6f,0xa8,0x28,0xac,0xe9,0x48,0x62,0x24,0x45); DEFINE_GUID(IID_ID3D12DescriptorHeap,0x8efb471d,0x616c,0x4f49,0x90,0xf7,0x12,0x7b,0xb7,0x63,0xfa,0x51); DEFINE_GUID(IID_ID3D12QueryHeap,0x0d9658ae,0xed45,0x469e,0xa6,0x1d,0x97,0x0e,0xc5,0x83,0xca,0xb4); DEFINE_GUID(IID_ID3D12CommandSignature,0xc36a797c,0xec80,0x4f0a,0x89,0x85,0xa7,0xb2,0x47,0x50,0x82,0xd1); DEFINE_GUID(IID_ID3D12CommandList,0x7116d91c,0xe7e4,0x47ce,0xb8,0xc6,0xec,0x81,0x68,0xf4,0x37,0xe5); DEFINE_GUID(IID_ID3D12GraphicsCommandList,0x5b160d0f,0xac1b,0x4185,0x8b,0xa8,0xb3,0xae,0x42,0xa5,0xa4,0x55); +DEFINE_GUID(IID_ID3D12GraphicsCommandList1,0x553103fb,0x1fe7,0x4557,0xbb,0x38,0x94,0x6d,0x7d,0x0e,0x7c,0xa7); +DEFINE_GUID(IID_ID3D12GraphicsCommandList2,0x38C3E585,0xFF17,0x412C,0x91,0x50,0x4F,0xC6,0xF9,0xD7,0x2A,0x28); DEFINE_GUID(IID_ID3D12CommandQueue,0x0ec870a6,0x5d7e,0x4c22,0x8c,0xfc,0x5b,0xaa,0xe0,0x76,0x16,0xed); DEFINE_GUID(IID_ID3D12Device,0x189819f1,0x1db6,0x4b57,0xbe,0x54,0x18,0x21,0x33,0x9b,0x85,0xf7); +DEFINE_GUID(IID_ID3D12PipelineLibrary,0xc64226a8,0x9201,0x46af,0xb4,0xcc,0x53,0xfb,0x9f,0xf7,0x41,0x4f); +DEFINE_GUID(IID_ID3D12PipelineLibrary1,0x80eabf42,0x2568,0x4e5e,0xbd,0x82,0xc3,0x7f,0x86,0x96,0x1d,0xc3); +DEFINE_GUID(IID_ID3D12Device1,0x77acce80,0x638e,0x4e65,0x88,0x95,0xc1,0xf2,0x33,0x86,0x86,0x3e); +DEFINE_GUID(IID_ID3D12Device2,0x30baa41e,0xb15b,0x475c,0xa0,0xbb,0x1a,0xf5,0xc5,0xb6,0x43,0x28); +DEFINE_GUID(IID_ID3D12Device3,0x81dadc15,0x2bad,0x4392,0x93,0xc5,0x10,0x13,0x45,0xc4,0xaa,0x98); +DEFINE_GUID(IID_ID3D12ProtectedSession,0xA1533D18,0x0AC1,0x4084,0x85,0xB9,0x89,0xA9,0x61,0x16,0x80,0x6B); +DEFINE_GUID(IID_ID3D12ProtectedResourceSession,0x6CD696F4,0xF289,0x40CC,0x80,0x91,0x5A,0x6C,0x0A,0x09,0x9C,0x3D); +DEFINE_GUID(IID_ID3D12Device4,0xe865df17,0xa9ee,0x46f9,0xa4,0x63,0x30,0x98,0x31,0x5a,0xa2,0xe5); +DEFINE_GUID(IID_ID3D12LifetimeOwner,0xe667af9f,0xcd56,0x4f46,0x83,0xce,0x03,0x2e,0x59,0x5d,0x70,0xa8); +DEFINE_GUID(IID_ID3D12SwapChainAssistant,0xf1df64b6,0x57fd,0x49cd,0x88,0x07,0xc0,0xeb,0x88,0xb4,0x5c,0x8f); +DEFINE_GUID(IID_ID3D12LifetimeTracker,0x3fd03d36,0x4eb1,0x424a,0xa5,0x82,0x49,0x4e,0xcb,0x8b,0xa8,0x13); +DEFINE_GUID(IID_ID3D12StateObject,0x47016943,0xfca8,0x4594,0x93,0xea,0xaf,0x25,0x8b,0x55,0x34,0x6d); +DEFINE_GUID(IID_ID3D12StateObjectProperties,0xde5fa827,0x9bf9,0x4f26,0x89,0xff,0xd7,0xf5,0x6f,0xde,0x38,0x60); +DEFINE_GUID(IID_ID3D12Device5,0x8b4f173b,0x2fea,0x4b80,0x8f,0x58,0x43,0x07,0x19,0x1a,0xb9,0x5d); +DEFINE_GUID(IID_ID3D12Resource1,0x9D5E227A,0x4430,0x4161,0x88,0xB3,0x3E,0xCA,0x6B,0xB1,0x6E,0x19); +DEFINE_GUID(IID_ID3D12Heap1,0x572F7389,0x2168,0x49E3,0x96,0x93,0xD6,0xDF,0x58,0x71,0xBF,0x6D); +DEFINE_GUID(IID_ID3D12GraphicsCommandList3,0x6FDA83A7,0xB84C,0x4E38,0x9A,0xC8,0xC7,0xBD,0x22,0x01,0x6B,0x3D); +DEFINE_GUID(IID_ID3D12MetaCommand,0xDBB84C27,0x36CE,0x4FC9,0xB8,0x01,0xF0,0x48,0xC4,0x6A,0xC5,0x70); +DEFINE_GUID(IID_ID3D12GraphicsCommandList4,0x8754318e,0xd3a9,0x4541,0x98,0xcf,0x64,0x5b,0x50,0xdc,0x48,0x74); +DEFINE_GUID(IID_ID3D12Tools,0x7071e1f0,0xe84b,0x4b33,0x97,0x4f,0x12,0xfa,0x49,0xde,0x65,0xc5); -extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0017_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0017_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0041_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0041_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12_1.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12_1.h new file mode 100644 index 00000000000..2f215870642 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12_1.h @@ -0,0 +1,2539 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d12_1_h__ +#define __d3d12_1_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D12CryptoSession_FWD_DEFINED__ +#define __ID3D12CryptoSession_FWD_DEFINED__ +typedef interface ID3D12CryptoSession ID3D12CryptoSession; + +#endif /* __ID3D12CryptoSession_FWD_DEFINED__ */ + + +#ifndef __ID3D12CryptoSessionPolicy_FWD_DEFINED__ +#define __ID3D12CryptoSessionPolicy_FWD_DEFINED__ +typedef interface ID3D12CryptoSessionPolicy ID3D12CryptoSessionPolicy; + +#endif /* __ID3D12CryptoSessionPolicy_FWD_DEFINED__ */ + + +#ifndef __ID3D12ContentProtectionDevice_FWD_DEFINED__ +#define __ID3D12ContentProtectionDevice_FWD_DEFINED__ +typedef interface ID3D12ContentProtectionDevice ID3D12ContentProtectionDevice; + +#endif /* __ID3D12ContentProtectionDevice_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoDecodeCommandList2_FWD_DEFINED__ +#define __ID3D12VideoDecodeCommandList2_FWD_DEFINED__ +typedef interface ID3D12VideoDecodeCommandList2 ID3D12VideoDecodeCommandList2; + +#endif /* __ID3D12VideoDecodeCommandList2_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoProcessCommandList2_FWD_DEFINED__ +#define __ID3D12VideoProcessCommandList2_FWD_DEFINED__ +typedef interface ID3D12VideoProcessCommandList2 ID3D12VideoProcessCommandList2; + +#endif /* __ID3D12VideoProcessCommandList2_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObjectPrototype_FWD_DEFINED__ +#define __ID3D12StateObjectPrototype_FWD_DEFINED__ +typedef interface ID3D12StateObjectPrototype ID3D12StateObjectPrototype; + +#endif /* __ID3D12StateObjectPrototype_FWD_DEFINED__ */ + + +#ifndef __ID3D12StateObjectPropertiesPrototype_FWD_DEFINED__ +#define __ID3D12StateObjectPropertiesPrototype_FWD_DEFINED__ +typedef interface ID3D12StateObjectPropertiesPrototype ID3D12StateObjectPropertiesPrototype; + +#endif /* __ID3D12StateObjectPropertiesPrototype_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceRaytracingPrototype_FWD_DEFINED__ +#define __ID3D12DeviceRaytracingPrototype_FWD_DEFINED__ +typedef interface ID3D12DeviceRaytracingPrototype ID3D12DeviceRaytracingPrototype; + +#endif /* __ID3D12DeviceRaytracingPrototype_FWD_DEFINED__ */ + + +#ifndef __ID3D12CommandListRaytracingPrototype_FWD_DEFINED__ +#define __ID3D12CommandListRaytracingPrototype_FWD_DEFINED__ +typedef interface ID3D12CommandListRaytracingPrototype ID3D12CommandListRaytracingPrototype; + +#endif /* __ID3D12CommandListRaytracingPrototype_FWD_DEFINED__ */ + + +#ifndef __ID3D12DeviceMetaCommand_FWD_DEFINED__ +#define __ID3D12DeviceMetaCommand_FWD_DEFINED__ +typedef interface ID3D12DeviceMetaCommand ID3D12DeviceMetaCommand; + +#endif /* __ID3D12DeviceMetaCommand_FWD_DEFINED__ */ + + +#ifndef __ID3D12MetaCommand_FWD_DEFINED__ +#define __ID3D12MetaCommand_FWD_DEFINED__ +typedef interface ID3D12MetaCommand ID3D12MetaCommand; + +#endif /* __ID3D12MetaCommand_FWD_DEFINED__ */ + + +#ifndef __ID3D12CommandListMetaCommand_FWD_DEFINED__ +#define __ID3D12CommandListMetaCommand_FWD_DEFINED__ +typedef interface ID3D12CommandListMetaCommand ID3D12CommandListMetaCommand; + +#endif /* __ID3D12CommandListMetaCommand_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgicommon.h" +#include "d3dcommon.h" +#include "d3d12.h" +#include "d3d12video.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d12_1_0000_0000 */ +/* [local] */ + +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define D3D12_FEATURE_VIDEO_DECODE_BITSTREAM_ENCRYPTION_SCHEMES static_cast(4) +#define D3D12_FEATURE_VIDEO_DECODE_BITSTREAM_ENCRYPTION_SCHEME_COUNT static_cast(12) +#define D3D12_FEATURE_VIDEO_CRYPTO_SESSION_SUPPORT static_cast(13) +#define D3D12_FEATURE_VIDEO_CONTENT_PROTECTION_SYSTEM_COUNT static_cast(14) +#define D3D12_FEATURE_VIDEO_CONTENT_PROTECTION_SYSTEM_SUPPORT static_cast(15) +#define D3D12_FEATURE_VIDEO_CRYPTO_SESSION_TRANSFORM_SUPPORT static_cast(16) +#define D3D12_BITSTREAM_ENCRYPTION_TYPE_CENC_AES_CTR_128 static_cast(1) +typedef struct D3D12_FEATURE_DATA_VIDEO_CONTENT_PROTECTION_SYSTEM_COUNT + { + UINT NodeIndex; + UINT ContentProtectionSystemCount; + } D3D12_FEATURE_DATA_VIDEO_CONTENT_PROTECTION_SYSTEM_COUNT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_CONTENT_PROTECTION_SYSTEM_SUPPORT + { + UINT NodeIndex; + UINT ContentProtectionSystemCount; + GUID *pContentProtectionSystems; + } D3D12_FEATURE_DATA_VIDEO_CONTENT_PROTECTION_SYSTEM_SUPPORT; + +typedef +enum D3D12_CRYPTO_SESSION_SUPPORT_FLAGS + { + D3D12_CRYPTO_SESSION_SUPPORT_FLAG_NONE = 0, + D3D12_CRYPTO_SESSION_SUPPORT_FLAG_SUPPORTED = 0x1, + D3D12_CRYPTO_SESSION_SUPPORT_FLAG_HEADER_DECRYPTION_REQUIRED = 0x2, + D3D12_CRYPTO_SESSION_SUPPORT_FLAG_INDEPENDENT_DECRYPTION_REQUIRED = 0x4, + D3D12_CRYPTO_SESSION_SUPPORT_FLAG_TRANSCRYPTION_REQUIRED = 0x8 + } D3D12_CRYPTO_SESSION_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_CRYPTO_SESSION_SUPPORT_FLAGS ); +typedef +enum D3D12_CRYPTO_SESSION_FLAGS + { + D3D12_CRYPTO_SESSION_FLAG_NONE = 0, + D3D12_CRYPTO_SESSION_FLAG_HARDWARE = 0x1 + } D3D12_CRYPTO_SESSION_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_CRYPTO_SESSION_FLAGS ); +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_BITSTREAM_ENCRYPTION_SCHEME_COUNT + { + UINT NodeIndex; + GUID DecodeProfile; + UINT EncryptionSchemeCount; + } D3D12_FEATURE_DATA_VIDEO_DECODE_BITSTREAM_ENCRYPTION_SCHEME_COUNT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_BITSTREAM_ENCRYPTION_SCHEMES + { + UINT NodeIndex; + GUID DecodeProfile; + UINT EncryptionSchemeCount; + _Field_size_full_(EncryptionSchemeCount) D3D12_BITSTREAM_ENCRYPTION_TYPE *pEncryptionSchemes; + } D3D12_FEATURE_DATA_VIDEO_DECODE_BITSTREAM_ENCRYPTION_SCHEMES; + +typedef struct D3D12_FEATURE_DATA_VIDEO_CRYPTO_SESSION_SUPPORT + { + UINT NodeIndex; + GUID DecodeProfile; + GUID ContentProtectionSystem; + D3D12_CRYPTO_SESSION_FLAGS Flags; + D3D12_BITSTREAM_ENCRYPTION_TYPE BitstreamEncryption; + UINT KeyBaseDataSize; + D3D12_CRYPTO_SESSION_SUPPORT_FLAGS Support; + } D3D12_FEATURE_DATA_VIDEO_CRYPTO_SESSION_SUPPORT; + +typedef struct D3D12_CRYPTO_SESSION_DESC + { + UINT NodeMask; + GUID DecodeProfile; + GUID ContentProtectionSystem; + D3D12_BITSTREAM_ENCRYPTION_TYPE BitstreamEncryption; + D3D12_CRYPTO_SESSION_FLAGS Flags; + } D3D12_CRYPTO_SESSION_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D12CryptoSession_INTERFACE_DEFINED__ +#define __ID3D12CryptoSession_INTERFACE_DEFINED__ + +/* interface ID3D12CryptoSession */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CryptoSession; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("FC7C6C9D-C27D-4904-835D-A5F2096EC65F") + ID3D12CryptoSession : public ID3D12ProtectedSession + { + public: + virtual D3D12_CRYPTO_SESSION_DESC STDMETHODCALLTYPE GetDesc( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetKeyBaseData( + UINT KeyInputDataSize, + _In_reads_bytes_( KeyInputDataSize ) const void *pKeyInputData, + UINT KeyBaseDataSize, + _Out_writes_bytes_( KeyBaseDataSize ) void *pKeyBaseData) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CryptoSessionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CryptoSession * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CryptoSession * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CryptoSession * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12CryptoSession * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12CryptoSession * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12CryptoSession * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12CryptoSession * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12CryptoSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *GetStatusFence )( + ID3D12CryptoSession * This, + REFIID riid, + _COM_Outptr_opt_ void **ppFence); + + D3D12_PROTECTED_SESSION_STATUS ( STDMETHODCALLTYPE *GetSessionStatus )( + ID3D12CryptoSession * This); + + D3D12_CRYPTO_SESSION_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12CryptoSession * This); + + HRESULT ( STDMETHODCALLTYPE *GetKeyBaseData )( + ID3D12CryptoSession * This, + UINT KeyInputDataSize, + _In_reads_bytes_( KeyInputDataSize ) const void *pKeyInputData, + UINT KeyBaseDataSize, + _Out_writes_bytes_( KeyBaseDataSize ) void *pKeyBaseData); + + END_INTERFACE + } ID3D12CryptoSessionVtbl; + + interface ID3D12CryptoSession + { + CONST_VTBL struct ID3D12CryptoSessionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CryptoSession_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CryptoSession_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CryptoSession_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CryptoSession_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12CryptoSession_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12CryptoSession_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12CryptoSession_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12CryptoSession_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12CryptoSession_GetStatusFence(This,riid,ppFence) \ + ( (This)->lpVtbl -> GetStatusFence(This,riid,ppFence) ) + +#define ID3D12CryptoSession_GetSessionStatus(This) \ + ( (This)->lpVtbl -> GetSessionStatus(This) ) + + +#define ID3D12CryptoSession_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) + +#define ID3D12CryptoSession_GetKeyBaseData(This,KeyInputDataSize,pKeyInputData,KeyBaseDataSize,pKeyBaseData) \ + ( (This)->lpVtbl -> GetKeyBaseData(This,KeyInputDataSize,pKeyInputData,KeyBaseDataSize,pKeyBaseData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CryptoSession_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CryptoSessionPolicy_INTERFACE_DEFINED__ +#define __ID3D12CryptoSessionPolicy_INTERFACE_DEFINED__ + +/* interface ID3D12CryptoSessionPolicy */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CryptoSessionPolicy; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("69FE3108-01A4-4AC3-AB91-F51E377A62AC") + ID3D12CryptoSessionPolicy : public ID3D12DeviceChild + { + public: + virtual UINT STDMETHODCALLTYPE GetKeyInfoSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetKeyInfo( + _Out_writes_bytes_( KeyInfoDataSize ) void *pKeyInfo, + UINT KeyInfoDataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCryptoSession( + REFIID riid, + _COM_Outptr_opt_ void **ppCryptoSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CryptoSessionPolicyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CryptoSessionPolicy * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CryptoSessionPolicy * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CryptoSessionPolicy * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12CryptoSessionPolicy * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12CryptoSessionPolicy * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12CryptoSessionPolicy * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12CryptoSessionPolicy * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12CryptoSessionPolicy * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + UINT ( STDMETHODCALLTYPE *GetKeyInfoSize )( + ID3D12CryptoSessionPolicy * This); + + HRESULT ( STDMETHODCALLTYPE *GetKeyInfo )( + ID3D12CryptoSessionPolicy * This, + _Out_writes_bytes_( KeyInfoDataSize ) void *pKeyInfo, + UINT KeyInfoDataSize); + + HRESULT ( STDMETHODCALLTYPE *GetCryptoSession )( + ID3D12CryptoSessionPolicy * This, + REFIID riid, + _COM_Outptr_opt_ void **ppCryptoSession); + + END_INTERFACE + } ID3D12CryptoSessionPolicyVtbl; + + interface ID3D12CryptoSessionPolicy + { + CONST_VTBL struct ID3D12CryptoSessionPolicyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CryptoSessionPolicy_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CryptoSessionPolicy_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CryptoSessionPolicy_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CryptoSessionPolicy_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12CryptoSessionPolicy_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12CryptoSessionPolicy_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12CryptoSessionPolicy_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12CryptoSessionPolicy_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12CryptoSessionPolicy_GetKeyInfoSize(This) \ + ( (This)->lpVtbl -> GetKeyInfoSize(This) ) + +#define ID3D12CryptoSessionPolicy_GetKeyInfo(This,pKeyInfo,KeyInfoDataSize) \ + ( (This)->lpVtbl -> GetKeyInfo(This,pKeyInfo,KeyInfoDataSize) ) + +#define ID3D12CryptoSessionPolicy_GetCryptoSession(This,riid,ppCryptoSession) \ + ( (This)->lpVtbl -> GetCryptoSession(This,riid,ppCryptoSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CryptoSessionPolicy_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_1_0000_0002 */ +/* [local] */ + +typedef +enum D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION + { + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION_NONE = 0, + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION_DECRYPT = 1, + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION_DECRYPT_WITH_HEADER = 2, + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION_TRANSCRYPT = 3, + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION_TRANSCRYPT_WITH_HEADER = 4, + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION_DECRYPT_HEADER = 5 + } D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION; + +typedef +enum D3D12_CRYPTO_SESSION_TRANSFORM_SUPPORT_FLAGS + { + D3D12_CRYPTO_SESSION_TRANSFORM_SUPPORT_FLAG_NONE = 0, + D3D12_CRYPTO_SESSION_TRANSFORM_SUPPORT_FLAG_SUPPORTED = 0x1 + } D3D12_CRYPTO_SESSION_TRANSFORM_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_CRYPTO_SESSION_TRANSFORM_SUPPORT_FLAGS ); +typedef struct D3D12_FEATURE_DATA_VIDEO_CRYPTO_SESSION_TRANSFORM_SUPPORT + { + UINT NodeIndex; + GUID DecodeProfile; + GUID ContentProtectionSystem; + D3D12_CRYPTO_SESSION_FLAGS Flags; + D3D12_BITSTREAM_ENCRYPTION_TYPE BitstreamEncryption; + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION Operation; + BOOL ProtectedOutputRequired; + UINT64 InputAlignment; + UINT64 InputPreambleSize; + UINT64 OutputAlignment; + UINT64 OutputPreambleSize; + D3D12_CRYPTO_SESSION_TRANSFORM_SUPPORT_FLAGS Support; + } D3D12_FEATURE_DATA_VIDEO_CRYPTO_SESSION_TRANSFORM_SUPPORT; + +typedef struct D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_HEADER_INPUT_ARGUMENTS + { + BOOL Enable; + _Field_size_bytes_full_(SliceHeadersSize) const void *pSliceHeaders; + UINT64 SliceHeadersSize; + _Field_size_full_(SliceHeaderCount) const DWORD *pSliceHeadersOffsets; + UINT64 SliceHeaderCount; + _Field_size_bytes_full_(ContextSize) const void *pContext; + UINT64 ContextSize; + } D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_HEADER_INPUT_ARGUMENTS; + +typedef struct D3D12_CRYPTO_SESSION_TRANSFORM_INPUT_ARGUMENTS + { + ID3D12CryptoSessionPolicy *pCryptoSessionPolicy; + ID3D12Resource *pBuffer; + UINT64 Size; + UINT64 Offset; + _Field_size_bytes_full_(IVSize) const void *pIV; + UINT IVSize; + UINT SubSampleMappingCount; + _Field_size_bytes_full_(SubSampleMappingCount) const void *pSubSampleMappingBlock; + UINT64 ContextSize; + _Field_size_bytes_full_(ContextSize) const void *pContext; + D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_HEADER_INPUT_ARGUMENTS EncryptedHeader; + } D3D12_CRYPTO_SESSION_TRANSFORM_INPUT_ARGUMENTS; + +typedef struct D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_OUTPUT_ARGUMENTS + { + BOOL Enable; + ID3D12ProtectedSession *pProtectedSession; + ID3D12Resource *pBuffer; + UINT64 Size; + UINT64 Offset; + } D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_OUTPUT_ARGUMENTS; + +typedef struct D3D12_CRYPTO_SESSION_TRANSFORM_TRANSCRYPT_OUTPUT_ARGUMENTS + { + BOOL Enable; + _Field_size_bytes_full_(IVSize) void *pIV; + UINT IVSize; + } D3D12_CRYPTO_SESSION_TRANSFORM_TRANSCRYPT_OUTPUT_ARGUMENTS; + +typedef struct D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_HEADER_OUTPUT_ARGUMENTS + { + BOOL Enable; + UINT64 SliceHeadersSize; + _Field_size_bytes_full_(SliceHeadersSize) const void *pSliceHeaders; + UINT64 ContextSize; + _Field_size_bytes_full_(ContextSize) const void *pContext; + } D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_HEADER_OUTPUT_ARGUMENTS; + +typedef struct D3D12_CRYPTO_SESSION_TRANSFORM_OUTPUT_ARGUMENTS + { + D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_OUTPUT_ARGUMENTS Decrypt; + D3D12_CRYPTO_SESSION_TRANSFORM_TRANSCRYPT_OUTPUT_ARGUMENTS Transcrypt; + D3D12_CRYPTO_SESSION_TRANSFORM_DECRYPT_HEADER_OUTPUT_ARGUMENTS ClearHeader; + } D3D12_CRYPTO_SESSION_TRANSFORM_OUTPUT_ARGUMENTS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0002_v0_0_s_ifspec; + +#ifndef __ID3D12ContentProtectionDevice_INTERFACE_DEFINED__ +#define __ID3D12ContentProtectionDevice_INTERFACE_DEFINED__ + +/* interface ID3D12ContentProtectionDevice */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12ContentProtectionDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("59975f53-bf5f-42f2-b84f-5e347c1e3d43") + ID3D12ContentProtectionDevice : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateCryptoSession( + _In_ const D3D12_CRYPTO_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateCryptoSessionPolicy( + _In_reads_bytes_( KeyInfoSize ) const void *pKeyInfo, + UINT KeyInfoSize, + _In_ ID3D12CryptoSession *pCryptoSession, + _In_ REFIID riid, + _COM_Outptr_ void **ppCryptoSessionPolicy) = 0; + + virtual HRESULT STDMETHODCALLTYPE TransformEncryptedData( + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION Operation, + _In_ const D3D12_CRYPTO_SESSION_TRANSFORM_OUTPUT_ARGUMENTS *pOutputArguments, + _In_ const D3D12_CRYPTO_SESSION_TRANSFORM_INPUT_ARGUMENTS *pInputArguments) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12ContentProtectionDeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12ContentProtectionDevice * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12ContentProtectionDevice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12ContentProtectionDevice * This); + + HRESULT ( STDMETHODCALLTYPE *CreateCryptoSession )( + ID3D12ContentProtectionDevice * This, + _In_ const D3D12_CRYPTO_SESSION_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppSession); + + HRESULT ( STDMETHODCALLTYPE *CreateCryptoSessionPolicy )( + ID3D12ContentProtectionDevice * This, + _In_reads_bytes_( KeyInfoSize ) const void *pKeyInfo, + UINT KeyInfoSize, + _In_ ID3D12CryptoSession *pCryptoSession, + _In_ REFIID riid, + _COM_Outptr_ void **ppCryptoSessionPolicy); + + HRESULT ( STDMETHODCALLTYPE *TransformEncryptedData )( + ID3D12ContentProtectionDevice * This, + D3D12_CRYPTO_SESSION_TRANSFORM_OPERATION Operation, + _In_ const D3D12_CRYPTO_SESSION_TRANSFORM_OUTPUT_ARGUMENTS *pOutputArguments, + _In_ const D3D12_CRYPTO_SESSION_TRANSFORM_INPUT_ARGUMENTS *pInputArguments); + + END_INTERFACE + } ID3D12ContentProtectionDeviceVtbl; + + interface ID3D12ContentProtectionDevice + { + CONST_VTBL struct ID3D12ContentProtectionDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12ContentProtectionDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12ContentProtectionDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12ContentProtectionDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12ContentProtectionDevice_CreateCryptoSession(This,pDesc,riid,ppSession) \ + ( (This)->lpVtbl -> CreateCryptoSession(This,pDesc,riid,ppSession) ) + +#define ID3D12ContentProtectionDevice_CreateCryptoSessionPolicy(This,pKeyInfo,KeyInfoSize,pCryptoSession,riid,ppCryptoSessionPolicy) \ + ( (This)->lpVtbl -> CreateCryptoSessionPolicy(This,pKeyInfo,KeyInfoSize,pCryptoSession,riid,ppCryptoSessionPolicy) ) + +#define ID3D12ContentProtectionDevice_TransformEncryptedData(This,Operation,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> TransformEncryptedData(This,Operation,pOutputArguments,pInputArguments) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12ContentProtectionDevice_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_1_0000_0003 */ +/* [local] */ + +typedef struct D3D12_VIDEO_DECODE_DECRYPTION_ARGUMENTS + { + ID3D12CryptoSessionPolicy *pCryptoSessionPolicy; + _Field_size_bytes_full_(IVSize) const void *pIV; + UINT IVSize; + _Field_size_bytes_full_(SubSampleMappingCount) const void *pSubSampleMappingBlock; + UINT SubSampleMappingCount; + UINT cBlocksStripeEncrypted; + UINT cBlocksStripeClear; + } D3D12_VIDEO_DECODE_DECRYPTION_ARGUMENTS; + +typedef struct D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS1 + { + UINT NumFrameArguments; + D3D12_VIDEO_DECODE_FRAME_ARGUMENT FrameArguments[ 10 ]; + D3D12_VIDEO_DECODE_REFERENCE_FRAMES ReferenceFrames; + D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM CompressedBitstream; + D3D12_VIDEO_DECODE_DECRYPTION_ARGUMENTS DecryptionArguments; + ID3D12VideoDecoderHeap *pHeap; + } D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0003_v0_0_s_ifspec; + +#ifndef __ID3D12VideoDecodeCommandList2_INTERFACE_DEFINED__ +#define __ID3D12VideoDecodeCommandList2_INTERFACE_DEFINED__ + +/* interface ID3D12VideoDecodeCommandList2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoDecodeCommandList2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EAD05737-EE1D-4442-9B18-7D992E9A8960") + ID3D12VideoDecodeCommandList2 : public ID3D12VideoDecodeCommandList1 + { + public: + virtual void STDMETHODCALLTYPE DecodeFrame2( + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS1 *pInputArguments) = 0; + + virtual void STDMETHODCALLTYPE SetProtectedResourceSession( + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoDecodeCommandList2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoDecodeCommandList2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoDecodeCommandList2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoDecodeCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoDecodeCommandList2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoDecodeCommandList2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoDecodeCommandList2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoDecodeCommandList2 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoDecodeCommandList2 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12VideoDecodeCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12VideoDecodeCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12CommandAllocator *pAllocator); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12VideoDecodeCommandList2 * This); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12VideoDecodeCommandList2 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12VideoDecodeCommandList2 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12VideoDecodeCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12VideoDecodeCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12VideoDecodeCommandList2 * This); + + void ( STDMETHODCALLTYPE *DecodeFrame )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12VideoDecodeCommandList2 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + void ( STDMETHODCALLTYPE *DecodeFrame1 )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *DecodeFrame2 )( + ID3D12VideoDecodeCommandList2 * This, + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS1 *pInputArguments); + + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12VideoDecodeCommandList2 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + END_INTERFACE + } ID3D12VideoDecodeCommandList2Vtbl; + + interface ID3D12VideoDecodeCommandList2 + { + CONST_VTBL struct ID3D12VideoDecodeCommandList2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoDecodeCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoDecodeCommandList2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoDecodeCommandList2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoDecodeCommandList2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoDecodeCommandList2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoDecodeCommandList2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoDecodeCommandList2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoDecodeCommandList2_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12VideoDecodeCommandList2_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12VideoDecodeCommandList2_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12VideoDecodeCommandList2_Reset(This,pAllocator) \ + ( (This)->lpVtbl -> Reset(This,pAllocator) ) + +#define ID3D12VideoDecodeCommandList2_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D12VideoDecodeCommandList2_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12VideoDecodeCommandList2_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12VideoDecodeCommandList2_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoDecodeCommandList2_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoDecodeCommandList2_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12VideoDecodeCommandList2_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12VideoDecodeCommandList2_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12VideoDecodeCommandList2_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12VideoDecodeCommandList2_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12VideoDecodeCommandList2_DecodeFrame(This,pDecoder,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> DecodeFrame(This,pDecoder,pOutputArguments,pInputArguments) ) + +#define ID3D12VideoDecodeCommandList2_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12VideoDecodeCommandList2_DecodeFrame1(This,pDecoder,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> DecodeFrame1(This,pDecoder,pOutputArguments,pInputArguments) ) + + +#define ID3D12VideoDecodeCommandList2_DecodeFrame2(This,pDecoder,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> DecodeFrame2(This,pDecoder,pOutputArguments,pInputArguments) ) + +#define ID3D12VideoDecodeCommandList2_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoDecodeCommandList2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12VideoProcessCommandList2_INTERFACE_DEFINED__ +#define __ID3D12VideoProcessCommandList2_INTERFACE_DEFINED__ + +/* interface ID3D12VideoProcessCommandList2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoProcessCommandList2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("569AB919-94DE-4529-8292-35DE97848059") + ID3D12VideoProcessCommandList2 : public ID3D12VideoProcessCommandList1 + { + public: + virtual void STDMETHODCALLTYPE SetProtectedResourceSession( + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoProcessCommandList2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoProcessCommandList2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoProcessCommandList2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoProcessCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoProcessCommandList2 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoProcessCommandList2 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoProcessCommandList2 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoProcessCommandList2 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoProcessCommandList2 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12VideoProcessCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12VideoProcessCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12CommandAllocator *pAllocator); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12VideoProcessCommandList2 * This); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12VideoProcessCommandList2 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12VideoProcessCommandList2 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12VideoProcessCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12VideoProcessCommandList2 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12VideoProcessCommandList2 * This); + + void ( STDMETHODCALLTYPE *ProcessFrames )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12VideoProcessCommandList2 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + void ( STDMETHODCALLTYPE *ProcessFrames1 )( + ID3D12VideoProcessCommandList2 * This, + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1 *pInputArguments); + + void ( STDMETHODCALLTYPE *SetProtectedResourceSession )( + ID3D12VideoProcessCommandList2 * This, + _In_opt_ ID3D12ProtectedResourceSession *pProtectedResourceSession); + + END_INTERFACE + } ID3D12VideoProcessCommandList2Vtbl; + + interface ID3D12VideoProcessCommandList2 + { + CONST_VTBL struct ID3D12VideoProcessCommandList2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoProcessCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoProcessCommandList2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoProcessCommandList2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoProcessCommandList2_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoProcessCommandList2_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoProcessCommandList2_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoProcessCommandList2_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoProcessCommandList2_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12VideoProcessCommandList2_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12VideoProcessCommandList2_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12VideoProcessCommandList2_Reset(This,pAllocator) \ + ( (This)->lpVtbl -> Reset(This,pAllocator) ) + +#define ID3D12VideoProcessCommandList2_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D12VideoProcessCommandList2_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12VideoProcessCommandList2_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12VideoProcessCommandList2_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoProcessCommandList2_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoProcessCommandList2_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12VideoProcessCommandList2_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12VideoProcessCommandList2_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12VideoProcessCommandList2_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12VideoProcessCommandList2_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12VideoProcessCommandList2_ProcessFrames(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) \ + ( (This)->lpVtbl -> ProcessFrames(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) ) + +#define ID3D12VideoProcessCommandList2_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12VideoProcessCommandList2_ProcessFrames1(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) \ + ( (This)->lpVtbl -> ProcessFrames1(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) ) + + +#define ID3D12VideoProcessCommandList2_SetProtectedResourceSession(This,pProtectedResourceSession) \ + ( (This)->lpVtbl -> SetProtectedResourceSession(This,pProtectedResourceSession) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoProcessCommandList2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12StateObjectPrototype_INTERFACE_DEFINED__ +#define __ID3D12StateObjectPrototype_INTERFACE_DEFINED__ + +/* interface ID3D12StateObjectPrototype */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObjectPrototype; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("47016943-fca8-4594-93ea-af258b55346d") + ID3D12StateObjectPrototype : public ID3D12Pageable + { + public: + virtual HRESULT STDMETHODCALLTYPE GetCachedBlob( + _COM_Outptr_ ID3DBlob **ppBlob) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectPrototypeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObjectPrototype * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObjectPrototype * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObjectPrototype * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12StateObjectPrototype * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12StateObjectPrototype * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12StateObjectPrototype * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12StateObjectPrototype * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12StateObjectPrototype * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + HRESULT ( STDMETHODCALLTYPE *GetCachedBlob )( + ID3D12StateObjectPrototype * This, + _COM_Outptr_ ID3DBlob **ppBlob); + + END_INTERFACE + } ID3D12StateObjectPrototypeVtbl; + + interface ID3D12StateObjectPrototype + { + CONST_VTBL struct ID3D12StateObjectPrototypeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObjectPrototype_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObjectPrototype_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObjectPrototype_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObjectPrototype_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12StateObjectPrototype_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12StateObjectPrototype_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12StateObjectPrototype_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12StateObjectPrototype_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12StateObjectPrototype_GetCachedBlob(This,ppBlob) \ + ( (This)->lpVtbl -> GetCachedBlob(This,ppBlob) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObjectPrototype_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12StateObjectPropertiesPrototype_INTERFACE_DEFINED__ +#define __ID3D12StateObjectPropertiesPrototype_INTERFACE_DEFINED__ + +/* interface ID3D12StateObjectPropertiesPrototype */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12StateObjectPropertiesPrototype; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("de5fa827-9bf9-4f26-89ff-d7f56fde3860") + ID3D12StateObjectPropertiesPrototype : public IUnknown + { + public: + virtual void *STDMETHODCALLTYPE GetShaderIdentifier( + _In_ LPCWSTR pExportName) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetShaderStackSize( + _In_ LPCWSTR pExportName) = 0; + + virtual UINT64 STDMETHODCALLTYPE GetPipelineStackSize( void) = 0; + + virtual void STDMETHODCALLTYPE SetPipelineStackSize( + UINT64 PipelineStackSizeInBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12StateObjectPropertiesPrototypeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12StateObjectPropertiesPrototype * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12StateObjectPropertiesPrototype * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12StateObjectPropertiesPrototype * This); + + void *( STDMETHODCALLTYPE *GetShaderIdentifier )( + ID3D12StateObjectPropertiesPrototype * This, + _In_ LPCWSTR pExportName); + + UINT64 ( STDMETHODCALLTYPE *GetShaderStackSize )( + ID3D12StateObjectPropertiesPrototype * This, + _In_ LPCWSTR pExportName); + + UINT64 ( STDMETHODCALLTYPE *GetPipelineStackSize )( + ID3D12StateObjectPropertiesPrototype * This); + + void ( STDMETHODCALLTYPE *SetPipelineStackSize )( + ID3D12StateObjectPropertiesPrototype * This, + UINT64 PipelineStackSizeInBytes); + + END_INTERFACE + } ID3D12StateObjectPropertiesPrototypeVtbl; + + interface ID3D12StateObjectPropertiesPrototype + { + CONST_VTBL struct ID3D12StateObjectPropertiesPrototypeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12StateObjectPropertiesPrototype_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12StateObjectPropertiesPrototype_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12StateObjectPropertiesPrototype_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12StateObjectPropertiesPrototype_GetShaderIdentifier(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderIdentifier(This,pExportName) ) + +#define ID3D12StateObjectPropertiesPrototype_GetShaderStackSize(This,pExportName) \ + ( (This)->lpVtbl -> GetShaderStackSize(This,pExportName) ) + +#define ID3D12StateObjectPropertiesPrototype_GetPipelineStackSize(This) \ + ( (This)->lpVtbl -> GetPipelineStackSize(This) ) + +#define ID3D12StateObjectPropertiesPrototype_SetPipelineStackSize(This,PipelineStackSizeInBytes) \ + ( (This)->lpVtbl -> SetPipelineStackSize(This,PipelineStackSizeInBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12StateObjectPropertiesPrototype_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_1_0000_0007 */ +/* [local] */ + +typedef +enum D3D12_STATE_SUBOBJECT_TYPE + { + D3D12_STATE_SUBOBJECT_TYPE_FLAGS = 0, + D3D12_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE = 1, + D3D12_STATE_SUBOBJECT_TYPE_LOCAL_ROOT_SIGNATURE = 2, + D3D12_STATE_SUBOBJECT_TYPE_NODE_MASK = 3, + D3D12_STATE_SUBOBJECT_TYPE_CACHED_STATE_OBJECT = 4, + D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY = 5, + D3D12_STATE_SUBOBJECT_TYPE_EXISTING_COLLECTION = 6, + D3D12_STATE_SUBOBJECT_TYPE_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 7, + D3D12_STATE_SUBOBJECT_TYPE_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION = 8, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG = 9, + D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG = 10, + D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP = 11, + D3D12_STATE_SUBOBJECT_TYPE_MAX_VALID = ( D3D12_STATE_SUBOBJECT_TYPE_HIT_GROUP + 1 ) + } D3D12_STATE_SUBOBJECT_TYPE; + +typedef struct D3D12_STATE_SUBOBJECT + { + D3D12_STATE_SUBOBJECT_TYPE Type; + const void *pDesc; + } D3D12_STATE_SUBOBJECT; + +typedef +enum D3D12_STATE_OBJECT_FLAGS + { + D3D12_STATE_OBJECT_FLAG_NONE = 0 + } D3D12_STATE_OBJECT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_STATE_OBJECT_FLAGS ); +typedef +enum D3D12_EXPORT_FLAGS + { + D3D12_EXPORT_FLAG_NONE = 0 + } D3D12_EXPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_EXPORT_FLAGS ); +typedef struct D3D12_EXPORT_DESC + { + LPCWSTR Name; + _In_opt_ LPCWSTR ExportToRename; + D3D12_EXPORT_FLAGS Flags; + } D3D12_EXPORT_DESC; + +typedef struct D3D12_DXIL_LIBRARY_DESC + { + D3D12_SHADER_BYTECODE DXILLibrary; + UINT NumExports; + _In_reads_(NumExports) D3D12_EXPORT_DESC *pExports; + } D3D12_DXIL_LIBRARY_DESC; + +typedef struct D3D12_EXISTING_COLLECTION_DESC + { + ID3D12StateObjectPrototype *pExistingCollection; + UINT NumExports; + _In_reads_(NumExports) D3D12_EXPORT_DESC *pExports; + } D3D12_EXISTING_COLLECTION_DESC; + +typedef struct D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION + { + const D3D12_STATE_SUBOBJECT *pSubobjectToAssociate; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + } D3D12_SUBOBJECT_TO_EXPORTS_ASSOCIATION; + +typedef struct D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION + { + LPCWSTR SubobjectToAssociate; + UINT NumExports; + _In_reads_(NumExports) LPCWSTR *pExports; + } D3D12_DXIL_SUBOBJECT_TO_EXPORTS_ASSOCIATION; + +typedef struct D3D12_HIT_GROUP_DESC + { + LPCWSTR HitGroupExport; + _In_opt_ LPCWSTR AnyHitShaderImport; + _In_opt_ LPCWSTR ClosestHitShaderImport; + _In_opt_ LPCWSTR IntersectionShaderImport; + } D3D12_HIT_GROUP_DESC; + +typedef struct D3D12_RAYTRACING_SHADER_CONFIG + { + UINT MaxPayloadSizeInBytes; + UINT MaxAttributeSizeInBytes; + } D3D12_RAYTRACING_SHADER_CONFIG; + +typedef struct D3D12_RAYTRACING_PIPELINE_CONFIG + { + UINT MaxTraceRecursionDepth; + } D3D12_RAYTRACING_PIPELINE_CONFIG; + +typedef +enum D3D12_STATE_OBJECT_TYPE + { + D3D12_STATE_OBJECT_TYPE_COLLECTION = 0, + D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE = 3 + } D3D12_STATE_OBJECT_TYPE; + +typedef struct D3D12_STATE_OBJECT_DESC + { + D3D12_STATE_OBJECT_TYPE Type; + UINT NumSubobjects; + _In_reads_(NumSubobjects) const D3D12_STATE_SUBOBJECT *pSubobjects; + } D3D12_STATE_OBJECT_DESC; + +typedef +enum D3D12_RAYTRACING_GEOMETRY_FLAGS + { + D3D12_RAYTRACING_GEOMETRY_FLAG_NONE = 0, + D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE = 0x1, + D3D12_RAYTRACING_GEOMETRY_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION = 0x2 + } D3D12_RAYTRACING_GEOMETRY_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_GEOMETRY_FLAGS ); +typedef +enum D3D12_RAYTRACING_GEOMETRY_TYPE + { + D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES = 0, + D3D12_RAYTRACING_GEOMETRY_TYPE_PROCEDURAL_PRIMITIVE_AABBS = ( D3D12_RAYTRACING_GEOMETRY_TYPE_TRIANGLES + 1 ) + } D3D12_RAYTRACING_GEOMETRY_TYPE; + +typedef +enum D3D12_RAYTRACING_INSTANCE_FLAGS + { + D3D12_RAYTRACING_INSTANCE_FLAG_NONE = 0, + D3D12_RAYTRACING_INSTANCE_FLAG_TRIANGLE_CULL_DISABLE = 0x1, + D3D12_RAYTRACING_INSTANCE_FLAG_TRIANGLE_FRONT_COUNTERCLOCKWISE = 0x2, + D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_OPAQUE = 0x4, + D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_NON_OPAQUE = 0x8 + } D3D12_RAYTRACING_INSTANCE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_INSTANCE_FLAGS ); +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 StrideInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE; + +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_RANGE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 SizeInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_RANGE; + +typedef struct D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE + { + D3D12_GPU_VIRTUAL_ADDRESS StartAddress; + UINT64 SizeInBytes; + UINT64 StrideInBytes; + } D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE; + +typedef struct D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS Transform; + DXGI_FORMAT IndexFormat; + DXGI_FORMAT VertexFormat; + UINT IndexCount; + UINT VertexCount; + D3D12_GPU_VIRTUAL_ADDRESS IndexBuffer; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE VertexBuffer; + } D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC; + +typedef struct D3D12_RAYTRACING_AABB + { + FLOAT MinX; + FLOAT MinY; + FLOAT MinZ; + FLOAT MaxX; + FLOAT MaxY; + FLOAT MaxZ; + } D3D12_RAYTRACING_AABB; + +typedef struct D3D12_RAYTRACING_GEOMETRY_AABBS_DESC + { + UINT64 AABBCount; + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE AABBs; + } D3D12_RAYTRACING_GEOMETRY_AABBS_DESC; + +typedef struct D3D12_RAYTRACING_GEOMETRY_DESC + { + D3D12_RAYTRACING_GEOMETRY_TYPE Type; + D3D12_RAYTRACING_GEOMETRY_FLAGS Flags; + union + { + D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC Triangles; + D3D12_RAYTRACING_GEOMETRY_AABBS_DESC AABBs; + } ; + } D3D12_RAYTRACING_GEOMETRY_DESC; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_NONE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_UPDATE = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_COMPACTION = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE = 0x4, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_BUILD = 0x8, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_MINIMIZE_MEMORY = 0x10, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE = 0x20 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS ); +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_CLONE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_COMPACT = 0x1, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_VISUALIZATION_DECODE_FOR_TOOLS = 0x2, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_SERIALIZE = 0x3, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE_DESERIALIZE = 0x4 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL = 0x1 + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE; + +typedef struct D3D12_RAYTRACING_INSTANCE_DESC + { + FLOAT Transform[ 12 ]; + UINT InstanceID : 24; + UINT InstanceMask : 8; + UINT InstanceContributionToHitGroupIndex : 24; + UINT Flags : 8; + D3D12_GPU_VIRTUAL_ADDRESS AccelerationStructure; + } D3D12_RAYTRACING_INSTANCE_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO + { + UINT64 ResultDataMaxSizeInBytes; + UINT64 ScratchDataSizeInBytes; + UINT64 UpdateScratchDataSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO; + +typedef +enum D3D12_ELEMENTS_LAYOUT + { + D3D12_ELEMENTS_LAYOUT_ARRAY = 0, + D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS = 0x1 + } D3D12_ELEMENTS_LAYOUT; + +typedef struct D3D12_GET_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO_DESC + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS Flags; + UINT NumDescs; + D3D12_ELEMENTS_LAYOUT DescsLayout; + union + { + const D3D12_RAYTRACING_GEOMETRY_DESC *pGeometryDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *const *ppGeometryDescs; + } ; + } D3D12_GET_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO_DESC; + +typedef +enum D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE = 0, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION = ( D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE + 1 ) , + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION = ( D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION + 1 ) + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE_DESC + { + UINT64 CompactedSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_COMPACTED_SIZE_DESC; + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION_DESC + { + UINT64 DecodedSizeInBytes; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TOOLS_VISUALIZATION_DESC; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER + { + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + UINT NumDescs; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER; + +// Regarding D3D12_BUILD_RAY_TRACING_ACCELERATION_STRUCTURE_TOOLS_VISUALIZATION_HEADER above, +// depending on Type field, NumDescs above is followed by either: +// D3D12_RAY_TRACING_INSTANCE_DESC InstanceDescs[NumDescs] +// or D3D12_RAY_TRACING_GEOMETRY_DESC GeometryDescs[NumDescs]. +// There is 4 bytes of padding between GeometryDesc structs in the array so alignment is natural when viewed by CPU. + +typedef struct D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION_DESC + { + UINT64 SerializedSizeInBytes; + UINT64 NumBottomLevelAccelerationStructurePointers; + } D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_SERIALIZATION_DESC; + +typedef struct D3D12_SERIALIZED_ACCELERATION_STRUCTURE_HEADER + { + UINT64 SerializedSizeInBytesIncludingHeader; + UINT64 DeserializedSizeInBytes; + UINT64 NumBottomLevelAccelerationStructurePointersAfterHeader; + } D3D12_SERIALIZED_ACCELERATION_STRUCTURE_HEADER; + +typedef struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS_RANGE DestAccelerationStructureData; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE Type; + UINT NumDescs; + D3D12_ELEMENTS_LAYOUT DescsLayout; + union + { + D3D12_GPU_VIRTUAL_ADDRESS InstanceDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *pGeometryDescs; + const D3D12_RAYTRACING_GEOMETRY_DESC *const *ppGeometryDescs; + } ; + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS Flags; + _In_opt_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE ScratchAccelerationStructureData; + } D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC; + +typedef struct D3D12_DISPATCH_RAYS_DESC + { + D3D12_GPU_VIRTUAL_ADDRESS_RANGE RayGenerationShaderRecord; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE MissShaderTable; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE HitGroupTable; + D3D12_GPU_VIRTUAL_ADDRESS_RANGE_AND_STRIDE CallableShaderTable; + UINT Width; + UINT Height; + } D3D12_DISPATCH_RAYS_DESC; + +#define D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT 256 +#define D3D12_RAYTRACING_INSTANCE_DESCS_BYTE_ALIGNMENT 16 +#define D3D12_RAYTRACING_MAX_ATTRIBUTE_SIZE_IN_BYTES 32 +#define D3D12_RAYTRACING_SHADER_RECORD_BYTE_ALIGNMENT 16 +#define D3D12_RAYTRACING_MAX_DECLARABLE_TRACE_RECURSION_DEPTH 31 +#define D3D12_RAYTRACING_AABB_BYTE_ALIGNMENT 4 + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0007_v0_0_s_ifspec; + +#ifndef __ID3D12DeviceRaytracingPrototype_INTERFACE_DEFINED__ +#define __ID3D12DeviceRaytracingPrototype_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceRaytracingPrototype */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceRaytracingPrototype; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f52ef3ca-f710-4ee4-b873-a7f504e43995") + ID3D12DeviceRaytracingPrototype : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateStateObject( + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject) = 0; + + virtual UINT STDMETHODCALLTYPE GetShaderIdentifierSize( void) = 0; + + virtual void STDMETHODCALLTYPE GetRaytracingAccelerationStructurePrebuildInfo( + _In_ D3D12_GET_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO_DESC *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceRaytracingPrototypeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceRaytracingPrototype * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceRaytracingPrototype * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceRaytracingPrototype * This); + + HRESULT ( STDMETHODCALLTYPE *CreateStateObject )( + ID3D12DeviceRaytracingPrototype * This, + const D3D12_STATE_OBJECT_DESC *pDesc, + REFIID riid, + _COM_Outptr_ void **ppStateObject); + + UINT ( STDMETHODCALLTYPE *GetShaderIdentifierSize )( + ID3D12DeviceRaytracingPrototype * This); + + void ( STDMETHODCALLTYPE *GetRaytracingAccelerationStructurePrebuildInfo )( + ID3D12DeviceRaytracingPrototype * This, + _In_ D3D12_GET_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO_DESC *pDesc, + _Out_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *pInfo); + + END_INTERFACE + } ID3D12DeviceRaytracingPrototypeVtbl; + + interface ID3D12DeviceRaytracingPrototype + { + CONST_VTBL struct ID3D12DeviceRaytracingPrototypeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceRaytracingPrototype_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceRaytracingPrototype_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceRaytracingPrototype_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceRaytracingPrototype_CreateStateObject(This,pDesc,riid,ppStateObject) \ + ( (This)->lpVtbl -> CreateStateObject(This,pDesc,riid,ppStateObject) ) + +#define ID3D12DeviceRaytracingPrototype_GetShaderIdentifierSize(This) \ + ( (This)->lpVtbl -> GetShaderIdentifierSize(This) ) + +#define ID3D12DeviceRaytracingPrototype_GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) \ + ( (This)->lpVtbl -> GetRaytracingAccelerationStructurePrebuildInfo(This,pDesc,pInfo) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceRaytracingPrototype_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CommandListRaytracingPrototype_INTERFACE_DEFINED__ +#define __ID3D12CommandListRaytracingPrototype_INTERFACE_DEFINED__ + +/* interface ID3D12CommandListRaytracingPrototype */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CommandListRaytracingPrototype; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3c69787a-28fa-4701-970a-37a1ed1f9cab") + ID3D12CommandListRaytracingPrototype : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE BuildRaytracingAccelerationStructure( + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc) = 0; + + virtual void STDMETHODCALLTYPE EmitRaytracingAccelerationStructurePostBuildInfo( + _In_ D3D12_GPU_VIRTUAL_ADDRESS_RANGE DestBuffer, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE InfoType, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData) = 0; + + virtual void STDMETHODCALLTYPE CopyRaytracingAccelerationStructure( + _In_ D3D12_GPU_VIRTUAL_ADDRESS_RANGE DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode) = 0; + + virtual void STDMETHODCALLTYPE DispatchRays( + _In_ ID3D12StateObjectPrototype *pRaytracingPipelineState, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CommandListRaytracingPrototypeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CommandListRaytracingPrototype * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CommandListRaytracingPrototype * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CommandListRaytracingPrototype * This); + + void ( STDMETHODCALLTYPE *BuildRaytracingAccelerationStructure )( + ID3D12CommandListRaytracingPrototype * This, + _In_ const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *pDesc); + + void ( STDMETHODCALLTYPE *EmitRaytracingAccelerationStructurePostBuildInfo )( + ID3D12CommandListRaytracingPrototype * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS_RANGE DestBuffer, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_TYPE InfoType, + _In_ UINT NumSourceAccelerationStructures, + _In_reads_( NumSourceAccelerationStructures ) const D3D12_GPU_VIRTUAL_ADDRESS *pSourceAccelerationStructureData); + + void ( STDMETHODCALLTYPE *CopyRaytracingAccelerationStructure )( + ID3D12CommandListRaytracingPrototype * This, + _In_ D3D12_GPU_VIRTUAL_ADDRESS_RANGE DestAccelerationStructureData, + _In_ D3D12_GPU_VIRTUAL_ADDRESS SourceAccelerationStructureData, + _In_ D3D12_RAYTRACING_ACCELERATION_STRUCTURE_COPY_MODE Mode); + + void ( STDMETHODCALLTYPE *DispatchRays )( + ID3D12CommandListRaytracingPrototype * This, + _In_ ID3D12StateObjectPrototype *pRaytracingPipelineState, + _In_ const D3D12_DISPATCH_RAYS_DESC *pDesc); + + END_INTERFACE + } ID3D12CommandListRaytracingPrototypeVtbl; + + interface ID3D12CommandListRaytracingPrototype + { + CONST_VTBL struct ID3D12CommandListRaytracingPrototypeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CommandListRaytracingPrototype_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CommandListRaytracingPrototype_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CommandListRaytracingPrototype_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CommandListRaytracingPrototype_BuildRaytracingAccelerationStructure(This,pDesc) \ + ( (This)->lpVtbl -> BuildRaytracingAccelerationStructure(This,pDesc) ) + +#define ID3D12CommandListRaytracingPrototype_EmitRaytracingAccelerationStructurePostBuildInfo(This,DestBuffer,InfoType,NumSourceAccelerationStructures,pSourceAccelerationStructureData) \ + ( (This)->lpVtbl -> EmitRaytracingAccelerationStructurePostBuildInfo(This,DestBuffer,InfoType,NumSourceAccelerationStructures,pSourceAccelerationStructureData) ) + +#define ID3D12CommandListRaytracingPrototype_CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) \ + ( (This)->lpVtbl -> CopyRaytracingAccelerationStructure(This,DestAccelerationStructureData,SourceAccelerationStructureData,Mode) ) + +#define ID3D12CommandListRaytracingPrototype_DispatchRays(This,pRaytracingPipelineState,pDesc) \ + ( (This)->lpVtbl -> DispatchRays(This,pRaytracingPipelineState,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CommandListRaytracingPrototype_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_1_0000_0009 */ +/* [local] */ + +typedef +enum D3D12_METACOMMAND_PARAMETER_TYPE + { + D3D12_METACOMMAND_PARAMETER_FLOAT = 0, + D3D12_METACOMMAND_PARAMETER_UINT64 = 1, + D3D12_METACOMMAND_PARAMETER_BUFFER_UAV = 2, + D3D12_METACOMMAND_PARAMETER_BINDPOINT_IN_SHADER = 3 + } D3D12_METACOMMAND_PARAMETER_TYPE; + +typedef +enum D3D12_METACOMMAND_PARAMETER_ATTRIBUTES + { + D3D12_METACOMMAND_PARAMETER_INPUT = 0x1, + D3D12_METACOMMAND_PARAMETER_OUTPUT = 0x2 + } D3D12_METACOMMAND_PARAMETER_ATTRIBUTES; + +DEFINE_ENUM_FLAG_OPERATORS( D3D12_METACOMMAND_PARAMETER_ATTRIBUTES ); +typedef +enum D3D12_METACOMMAND_PARAMETER_MUTABILITY + { + D3D12_METACOMMAND_PARAMETER_MUTABILITY_PER_EXECUTE = 0, + D3D12_METACOMMAND_PARAMETER_MUTABILITY_CREATION_ONLY = 1, + D3D12_METACOMMAND_PARAMETER_MUTABILITY_INITIALIZATION_ONLY = 2 + } D3D12_METACOMMAND_PARAMETER_MUTABILITY; + +typedef struct D3D12_METACOMMAND_PARAMETER_DESC + { + char Name[ 128 ]; + D3D12_METACOMMAND_PARAMETER_TYPE Type; + D3D12_METACOMMAND_PARAMETER_ATTRIBUTES Attributes; + D3D12_METACOMMAND_PARAMETER_MUTABILITY Mutability; + } D3D12_METACOMMAND_PARAMETER_DESC; + +typedef +enum D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE + { + D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE_CBV = 0, + D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE_SRV = ( D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE_CBV + 1 ) , + D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE_UAV = ( D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE_SRV + 1 ) + } D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE; + +typedef struct D3D12_BINDPOINT_IN_SHADER + { + D3D12_METACOMMAND_BINDPOINT_PARAMETER_TYPE Type; + UINT Register; + UINT Space; + } D3D12_BINDPOINT_IN_SHADER; + +typedef struct D3D12_METACOMMAND_PARAMETER_DATA + { + UINT ParameterIndex; + union + { + FLOAT FloatValue; + UINT64 UnsignedInt64Value; + D3D12_GPU_VIRTUAL_ADDRESS BufferLocation; + D3D12_BINDPOINT_IN_SHADER BindingInfo; + } ; + } D3D12_METACOMMAND_PARAMETER_DATA; + +typedef struct D3D12_METACOMMAND_DESCRIPTION + { + GUID Id; + char Name[ 128 ]; + UINT SignatureCount; + } D3D12_METACOMMAND_DESCRIPTION; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0009_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0009_v0_0_s_ifspec; + +#ifndef __ID3D12DeviceMetaCommand_INTERFACE_DEFINED__ +#define __ID3D12DeviceMetaCommand_INTERFACE_DEFINED__ + +/* interface ID3D12DeviceMetaCommand */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DeviceMetaCommand; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("547e33c7-ff86-4cd9-bea3-5d4a28375396") + ID3D12DeviceMetaCommand : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumerateMetaCommands( + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_METACOMMAND_DESCRIPTION *pDescs) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumerateMetaCommandSignature( + _In_ REFGUID CommandId, + _In_ UINT SignatureId, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_METACOMMAND_PARAMETER_DESC *pParameterDescs) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateMetaCommand( + _In_ REFGUID CommandId, + _In_ UINT SignatureId, + _In_opt_ ID3D12RootSignature *pRootSignature, + _In_ UINT NumParameters, + _In_reads_(NumParameters) const D3D12_METACOMMAND_PARAMETER_DATA *pParameters, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DeviceMetaCommandVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DeviceMetaCommand * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DeviceMetaCommand * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DeviceMetaCommand * This); + + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommands )( + ID3D12DeviceMetaCommand * This, + _Inout_ UINT *pNumMetaCommands, + _Out_writes_opt_(*pNumMetaCommands) D3D12_METACOMMAND_DESCRIPTION *pDescs); + + HRESULT ( STDMETHODCALLTYPE *EnumerateMetaCommandSignature )( + ID3D12DeviceMetaCommand * This, + _In_ REFGUID CommandId, + _In_ UINT SignatureId, + _Inout_ UINT *pParameterCount, + _Out_writes_opt_(*pParameterCount) D3D12_METACOMMAND_PARAMETER_DESC *pParameterDescs); + + HRESULT ( STDMETHODCALLTYPE *CreateMetaCommand )( + ID3D12DeviceMetaCommand * This, + _In_ REFGUID CommandId, + _In_ UINT SignatureId, + _In_opt_ ID3D12RootSignature *pRootSignature, + _In_ UINT NumParameters, + _In_reads_(NumParameters) const D3D12_METACOMMAND_PARAMETER_DATA *pParameters, + REFIID riid, + _COM_Outptr_ void **ppMetaCommand); + + END_INTERFACE + } ID3D12DeviceMetaCommandVtbl; + + interface ID3D12DeviceMetaCommand + { + CONST_VTBL struct ID3D12DeviceMetaCommandVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DeviceMetaCommand_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DeviceMetaCommand_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DeviceMetaCommand_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DeviceMetaCommand_EnumerateMetaCommands(This,pNumMetaCommands,pDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommands(This,pNumMetaCommands,pDescs) ) + +#define ID3D12DeviceMetaCommand_EnumerateMetaCommandSignature(This,CommandId,SignatureId,pParameterCount,pParameterDescs) \ + ( (This)->lpVtbl -> EnumerateMetaCommandSignature(This,CommandId,SignatureId,pParameterCount,pParameterDescs) ) + +#define ID3D12DeviceMetaCommand_CreateMetaCommand(This,CommandId,SignatureId,pRootSignature,NumParameters,pParameters,riid,ppMetaCommand) \ + ( (This)->lpVtbl -> CreateMetaCommand(This,CommandId,SignatureId,pRootSignature,NumParameters,pParameters,riid,ppMetaCommand) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DeviceMetaCommand_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12MetaCommand_INTERFACE_DEFINED__ +#define __ID3D12MetaCommand_INTERFACE_DEFINED__ + +/* interface ID3D12MetaCommand */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12MetaCommand; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8AFDA767-8003-494F-9E9A-4AA8864F3524") + ID3D12MetaCommand : public ID3D12Pageable + { + public: + virtual void STDMETHODCALLTYPE GetRequiredParameterResourceSize( + UINT32 ParameterIndex, + UINT64 *SizeInBytes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12MetaCommandVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12MetaCommand * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12MetaCommand * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12MetaCommand * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12MetaCommand * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12MetaCommand * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12MetaCommand * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + void ( STDMETHODCALLTYPE *GetRequiredParameterResourceSize )( + ID3D12MetaCommand * This, + UINT32 ParameterIndex, + UINT64 *SizeInBytes); + + END_INTERFACE + } ID3D12MetaCommandVtbl; + + interface ID3D12MetaCommand + { + CONST_VTBL struct ID3D12MetaCommandVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12MetaCommand_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12MetaCommand_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12MetaCommand_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12MetaCommand_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12MetaCommand_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12MetaCommand_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12MetaCommand_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12MetaCommand_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12MetaCommand_GetRequiredParameterResourceSize(This,ParameterIndex,SizeInBytes) \ + ( (This)->lpVtbl -> GetRequiredParameterResourceSize(This,ParameterIndex,SizeInBytes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12MetaCommand_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12CommandListMetaCommand_INTERFACE_DEFINED__ +#define __ID3D12CommandListMetaCommand_INTERFACE_DEFINED__ + +/* interface ID3D12CommandListMetaCommand */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12CommandListMetaCommand; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5A5F59F3-7124-4766-8E9E-CB637764FB0B") + ID3D12CommandListMetaCommand : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE InitializeMetaCommand( + _In_ ID3D12MetaCommand *pMetaCommand, + _In_ UINT NumParameters, + _In_reads_(NumParameters) const D3D12_METACOMMAND_PARAMETER_DATA *pParameters) = 0; + + virtual void STDMETHODCALLTYPE ExecuteMetaCommand( + _In_ ID3D12MetaCommand *pMetaCommand, + _In_ UINT NumParameters, + _In_reads_(NumParameters) const D3D12_METACOMMAND_PARAMETER_DATA *pParameters) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12CommandListMetaCommandVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12CommandListMetaCommand * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12CommandListMetaCommand * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12CommandListMetaCommand * This); + + void ( STDMETHODCALLTYPE *InitializeMetaCommand )( + ID3D12CommandListMetaCommand * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_ UINT NumParameters, + _In_reads_(NumParameters) const D3D12_METACOMMAND_PARAMETER_DATA *pParameters); + + void ( STDMETHODCALLTYPE *ExecuteMetaCommand )( + ID3D12CommandListMetaCommand * This, + _In_ ID3D12MetaCommand *pMetaCommand, + _In_ UINT NumParameters, + _In_reads_(NumParameters) const D3D12_METACOMMAND_PARAMETER_DATA *pParameters); + + END_INTERFACE + } ID3D12CommandListMetaCommandVtbl; + + interface ID3D12CommandListMetaCommand + { + CONST_VTBL struct ID3D12CommandListMetaCommandVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12CommandListMetaCommand_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12CommandListMetaCommand_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12CommandListMetaCommand_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12CommandListMetaCommand_InitializeMetaCommand(This,pMetaCommand,NumParameters,pParameters) \ + ( (This)->lpVtbl -> InitializeMetaCommand(This,pMetaCommand,NumParameters,pParameters) ) + +#define ID3D12CommandListMetaCommand_ExecuteMetaCommand(This,pMetaCommand,NumParameters,pParameters) \ + ( (This)->lpVtbl -> ExecuteMetaCommand(This,pMetaCommand,NumParameters,pParameters) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12CommandListMetaCommand_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12_1_0000_0012 */ +/* [local] */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion +DEFINE_GUID(IID_ID3D12CryptoSession,0xFC7C6C9D,0xC27D,0x4904,0x83,0x5D,0xA5,0xF2,0x09,0x6E,0xC6,0x5F); +DEFINE_GUID(IID_ID3D12CryptoSessionPolicy,0x69FE3108,0x01A4,0x4AC3,0xAB,0x91,0xF5,0x1E,0x37,0x7A,0x62,0xAC); +DEFINE_GUID(IID_ID3D12ContentProtectionDevice,0x59975f53,0xbf5f,0x42f2,0xb8,0x4f,0x5e,0x34,0x7c,0x1e,0x3d,0x43); +DEFINE_GUID(IID_ID3D12VideoDecodeCommandList2,0xEAD05737,0xEE1D,0x4442,0x9B,0x18,0x7D,0x99,0x2E,0x9A,0x89,0x60); +DEFINE_GUID(IID_ID3D12VideoProcessCommandList2,0x569AB919,0x94DE,0x4529,0x82,0x92,0x35,0xDE,0x97,0x84,0x80,0x59); +DEFINE_GUID(IID_ID3D12StateObjectPrototype,0x47016943,0xfca8,0x4594,0x93,0xea,0xaf,0x25,0x8b,0x55,0x34,0x6d); +DEFINE_GUID(IID_ID3D12StateObjectPropertiesPrototype,0xde5fa827,0x9bf9,0x4f26,0x89,0xff,0xd7,0xf5,0x6f,0xde,0x38,0x60); +DEFINE_GUID(IID_ID3D12DeviceRaytracingPrototype,0xf52ef3ca,0xf710,0x4ee4,0xb8,0x73,0xa7,0xf5,0x04,0xe4,0x39,0x95); +DEFINE_GUID(IID_ID3D12CommandListRaytracingPrototype,0x3c69787a,0x28fa,0x4701,0x97,0x0a,0x37,0xa1,0xed,0x1f,0x9c,0xab); +DEFINE_GUID(IID_ID3D12DeviceMetaCommand,0x547e33c7,0xff86,0x4cd9,0xbe,0xa3,0x5d,0x4a,0x28,0x37,0x53,0x96); +DEFINE_GUID(IID_ID3D12MetaCommand,0x8AFDA767,0x8003,0x494F,0x9E,0x9A,0x4A,0xA8,0x86,0x4F,0x35,0x24); +DEFINE_GUID(IID_ID3D12CommandListMetaCommand,0x5A5F59F3,0x7124,0x4766,0x8E,0x9E,0xCB,0x63,0x77,0x64,0xFB,0x0B); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0012_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12_1_0000_0012_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12sdklayers.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12sdklayers.h index b7a6dbd039c..78655167741 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12sdklayers.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12sdklayers.h @@ -8,7 +8,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ @@ -50,6 +50,34 @@ typedef interface ID3D12Debug ID3D12Debug; #endif /* __ID3D12Debug_FWD_DEFINED__ */ +#ifndef __ID3D12Debug1_FWD_DEFINED__ +#define __ID3D12Debug1_FWD_DEFINED__ +typedef interface ID3D12Debug1 ID3D12Debug1; + +#endif /* __ID3D12Debug1_FWD_DEFINED__ */ + + +#ifndef __ID3D12Debug2_FWD_DEFINED__ +#define __ID3D12Debug2_FWD_DEFINED__ +typedef interface ID3D12Debug2 ID3D12Debug2; + +#endif /* __ID3D12Debug2_FWD_DEFINED__ */ + + +#ifndef __ID3D12Debug3_FWD_DEFINED__ +#define __ID3D12Debug3_FWD_DEFINED__ +typedef interface ID3D12Debug3 ID3D12Debug3; + +#endif /* __ID3D12Debug3_FWD_DEFINED__ */ + + +#ifndef __ID3D12DebugDevice1_FWD_DEFINED__ +#define __ID3D12DebugDevice1_FWD_DEFINED__ +typedef interface ID3D12DebugDevice1 ID3D12DebugDevice1; + +#endif /* __ID3D12DebugDevice1_FWD_DEFINED__ */ + + #ifndef __ID3D12DebugDevice_FWD_DEFINED__ #define __ID3D12DebugDevice_FWD_DEFINED__ typedef interface ID3D12DebugDevice ID3D12DebugDevice; @@ -57,6 +85,13 @@ typedef interface ID3D12DebugDevice ID3D12DebugDevice; #endif /* __ID3D12DebugDevice_FWD_DEFINED__ */ +#ifndef __ID3D12DebugDevice2_FWD_DEFINED__ +#define __ID3D12DebugDevice2_FWD_DEFINED__ +typedef interface ID3D12DebugDevice2 ID3D12DebugDevice2; + +#endif /* __ID3D12DebugDevice2_FWD_DEFINED__ */ + + #ifndef __ID3D12DebugCommandQueue_FWD_DEFINED__ #define __ID3D12DebugCommandQueue_FWD_DEFINED__ typedef interface ID3D12DebugCommandQueue ID3D12DebugCommandQueue; @@ -64,6 +99,13 @@ typedef interface ID3D12DebugCommandQueue ID3D12DebugCommandQueue; #endif /* __ID3D12DebugCommandQueue_FWD_DEFINED__ */ +#ifndef __ID3D12DebugCommandList1_FWD_DEFINED__ +#define __ID3D12DebugCommandList1_FWD_DEFINED__ +typedef interface ID3D12DebugCommandList1 ID3D12DebugCommandList1; + +#endif /* __ID3D12DebugCommandList1_FWD_DEFINED__ */ + + #ifndef __ID3D12DebugCommandList_FWD_DEFINED__ #define __ID3D12DebugCommandList_FWD_DEFINED__ typedef interface ID3D12DebugCommandList ID3D12DebugCommandList; @@ -71,6 +113,20 @@ typedef interface ID3D12DebugCommandList ID3D12DebugCommandList; #endif /* __ID3D12DebugCommandList_FWD_DEFINED__ */ +#ifndef __ID3D12DebugCommandList2_FWD_DEFINED__ +#define __ID3D12DebugCommandList2_FWD_DEFINED__ +typedef interface ID3D12DebugCommandList2 ID3D12DebugCommandList2; + +#endif /* __ID3D12DebugCommandList2_FWD_DEFINED__ */ + + +#ifndef __ID3D12SharingContract_FWD_DEFINED__ +#define __ID3D12SharingContract_FWD_DEFINED__ +typedef interface ID3D12SharingContract ID3D12SharingContract; + +#endif /* __ID3D12SharingContract_FWD_DEFINED__ */ + + #ifndef __ID3D12InfoQueue_FWD_DEFINED__ #define __ID3D12InfoQueue_FWD_DEFINED__ typedef interface ID3D12InfoQueue ID3D12InfoQueue; @@ -91,6 +147,9 @@ extern "C"{ /* interface __MIDL_itf_d3d12sdklayers_0000_0000 */ /* [local] */ +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0000_v0_0_c_ifspec; @@ -177,14 +236,303 @@ EXTERN_C const IID IID_ID3D12Debug; /* [local] */ typedef -enum D3D12_DEBUG_FEATURE +enum D3D12_GPU_BASED_VALIDATION_FLAGS { - D3D12_DEBUG_FEATURE_NONE = 0, - D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DRAW = 0x1, - D3D12_DEBUG_FEATURE_TREAT_BUNDLE_AS_DISPATCH = 0x2 - } D3D12_DEBUG_FEATURE; + D3D12_GPU_BASED_VALIDATION_FLAGS_NONE = 0, + D3D12_GPU_BASED_VALIDATION_FLAGS_DISABLE_STATE_TRACKING = 0x1 + } D3D12_GPU_BASED_VALIDATION_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_GPU_BASED_VALIDATION_FLAGS) + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3D12Debug1_INTERFACE_DEFINED__ +#define __ID3D12Debug1_INTERFACE_DEFINED__ + +/* interface ID3D12Debug1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("affaa4ca-63fe-4d8e-b8ad-159000af4304") + ID3D12Debug1 : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE EnableDebugLayer( void) = 0; + + virtual void STDMETHODCALLTYPE SetEnableGPUBasedValidation( + BOOL Enable) = 0; + + virtual void STDMETHODCALLTYPE SetEnableSynchronizedCommandQueueValidation( + BOOL Enable) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug1 * This); + + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug1 * This); + + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug1 * This, + BOOL Enable); + + void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )( + ID3D12Debug1 * This, + BOOL Enable); + + END_INTERFACE + } ID3D12Debug1Vtbl; + + interface ID3D12Debug1 + { + CONST_VTBL struct ID3D12Debug1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug1_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + +#define ID3D12Debug1_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) ) + +#define ID3D12Debug1_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug1_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Debug2_INTERFACE_DEFINED__ +#define __ID3D12Debug2_INTERFACE_DEFINED__ + +/* interface ID3D12Debug2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("93a665c4-a3b2-4e5d-b692-a26ae14e3374") + ID3D12Debug2 : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE SetGPUBasedValidationFlags( + D3D12_GPU_BASED_VALIDATION_FLAGS Flags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug2 * This); + + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug2 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + END_INTERFACE + } ID3D12Debug2Vtbl; + + interface ID3D12Debug2 + { + CONST_VTBL struct ID3D12Debug2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug2_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12Debug3_INTERFACE_DEFINED__ +#define __ID3D12Debug3_INTERFACE_DEFINED__ + +/* interface ID3D12Debug3 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12Debug3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5cf4e58f-f671-4ff1-a542-3686e3d153d1") + ID3D12Debug3 : public ID3D12Debug + { + public: + virtual void STDMETHODCALLTYPE SetEnableGPUBasedValidation( + BOOL Enable) = 0; + + virtual void STDMETHODCALLTYPE SetEnableSynchronizedCommandQueueValidation( + BOOL Enable) = 0; + + virtual void STDMETHODCALLTYPE SetGPUBasedValidationFlags( + D3D12_GPU_BASED_VALIDATION_FLAGS Flags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12Debug3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12Debug3 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12Debug3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12Debug3 * This); + + void ( STDMETHODCALLTYPE *EnableDebugLayer )( + ID3D12Debug3 * This); + + void ( STDMETHODCALLTYPE *SetEnableGPUBasedValidation )( + ID3D12Debug3 * This, + BOOL Enable); + + void ( STDMETHODCALLTYPE *SetEnableSynchronizedCommandQueueValidation )( + ID3D12Debug3 * This, + BOOL Enable); + + void ( STDMETHODCALLTYPE *SetGPUBasedValidationFlags )( + ID3D12Debug3 * This, + D3D12_GPU_BASED_VALIDATION_FLAGS Flags); + + END_INTERFACE + } ID3D12Debug3Vtbl; + + interface ID3D12Debug3 + { + CONST_VTBL struct ID3D12Debug3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12Debug3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12Debug3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12Debug3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12Debug3_EnableDebugLayer(This) \ + ( (This)->lpVtbl -> EnableDebugLayer(This) ) + + +#define ID3D12Debug3_SetEnableGPUBasedValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableGPUBasedValidation(This,Enable) ) + +#define ID3D12Debug3_SetEnableSynchronizedCommandQueueValidation(This,Enable) \ + ( (This)->lpVtbl -> SetEnableSynchronizedCommandQueueValidation(This,Enable) ) + +#define ID3D12Debug3_SetGPUBasedValidationFlags(This,Flags) \ + ( (This)->lpVtbl -> SetGPUBasedValidationFlags(This,Flags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12Debug3_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0004 */ +/* [local] */ -DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEBUG_FEATURE ); typedef enum D3D12_RLDO_FLAGS { @@ -195,10 +543,169 @@ enum D3D12_RLDO_FLAGS } D3D12_RLDO_FLAGS; DEFINE_ENUM_FLAG_OPERATORS(D3D12_RLDO_FLAGS) +typedef +enum D3D12_DEBUG_DEVICE_PARAMETER_TYPE + { + D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS = 0, + D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = ( D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS + 1 ) , + D3D12_DEBUG_DEVICE_PARAMETER_GPU_SLOWDOWN_PERFORMANCE_FACTOR = ( D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS + 1 ) + } D3D12_DEBUG_DEVICE_PARAMETER_TYPE; + +typedef +enum D3D12_DEBUG_FEATURE + { + D3D12_DEBUG_FEATURE_NONE = 0, + D3D12_DEBUG_FEATURE_ALLOW_BEHAVIOR_CHANGING_DEBUG_AIDS = 0x1, + D3D12_DEBUG_FEATURE_CONSERVATIVE_RESOURCE_STATE_TRACKING = 0x2, + D3D12_DEBUG_FEATURE_DISABLE_VIRTUALIZED_BUNDLES_VALIDATION = 0x4, + D3D12_DEBUG_FEATURE_VALID_MASK = ( ( D3D12_DEBUG_FEATURE_ALLOW_BEHAVIOR_CHANGING_DEBUG_AIDS | D3D12_DEBUG_FEATURE_CONSERVATIVE_RESOURCE_STATE_TRACKING ) | D3D12_DEBUG_FEATURE_DISABLE_VIRTUALIZED_BUNDLES_VALIDATION ) + } D3D12_DEBUG_FEATURE; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_DEBUG_FEATURE) +typedef +enum D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE + { + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_NONE = 0, + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_STATE_TRACKING_ONLY = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_NONE + 1 ) , + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_UNGUARDED_VALIDATION = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_STATE_TRACKING_ONLY + 1 ) , + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_GUARDED_VALIDATION = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_UNGUARDED_VALIDATION + 1 ) , + NUM_D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODES = ( D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE_GUARDED_VALIDATION + 1 ) + } D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE; + +typedef +enum D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS + { + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_NONE = 0, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_TRACKING_ONLY_SHADERS = 0x1, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_UNGUARDED_VALIDATION_SHADERS = 0x2, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAG_FRONT_LOAD_CREATE_GUARDED_VALIDATION_SHADERS = 0x4, + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS_VALID_MASK = 0x7 + } D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS) +typedef struct D3D12_DEBUG_DEVICE_GPU_BASED_VALIDATION_SETTINGS + { + UINT MaxMessagesPerCommandList; + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE DefaultShaderPatchMode; + D3D12_GPU_BASED_VALIDATION_PIPELINE_STATE_CREATE_FLAGS PipelineStateCreateFlags; + } D3D12_DEBUG_DEVICE_GPU_BASED_VALIDATION_SETTINGS; + +typedef struct D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR + { + FLOAT SlowdownFactor; + } D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR; -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0001_v0_0_s_ifspec; + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_s_ifspec; + +#ifndef __ID3D12DebugDevice1_INTERFACE_DEFINED__ +#define __ID3D12DebugDevice1_INTERFACE_DEFINED__ + +/* interface ID3D12DebugDevice1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugDevice1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("a9b71770-d099-4a65-a698-3dee10020f88") + ID3D12DebugDevice1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetDebugParameter( + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDebugParameter( + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReportLiveDeviceObjects( + D3D12_RLDO_FLAGS Flags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugDevice1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugDevice1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugDevice1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugDevice1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugDevice1 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugDevice1 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + HRESULT ( STDMETHODCALLTYPE *ReportLiveDeviceObjects )( + ID3D12DebugDevice1 * This, + D3D12_RLDO_FLAGS Flags); + + END_INTERFACE + } ID3D12DebugDevice1Vtbl; + + interface ID3D12DebugDevice1 + { + CONST_VTBL struct ID3D12DebugDevice1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugDevice1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugDevice1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugDevice1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugDevice1_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugDevice1_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugDevice1_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->lpVtbl -> ReportLiveDeviceObjects(This,Flags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugDevice1_INTERFACE_DEFINED__ */ + #ifndef __ID3D12DebugDevice_INTERFACE_DEFINED__ #define __ID3D12DebugDevice_INTERFACE_DEFINED__ @@ -297,14 +804,132 @@ EXTERN_C const IID IID_ID3D12DebugDevice; #endif /* __ID3D12DebugDevice_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_d3d12sdklayers_0000_0002 */ +#ifndef __ID3D12DebugDevice2_INTERFACE_DEFINED__ +#define __ID3D12DebugDevice2_INTERFACE_DEFINED__ + +/* interface ID3D12DebugDevice2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugDevice2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("60eccbc1-378d-4df1-894c-f8ac5ce4d7dd") + ID3D12DebugDevice2 : public ID3D12DebugDevice + { + public: + virtual HRESULT STDMETHODCALLTYPE SetDebugParameter( + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDebugParameter( + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugDevice2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugDevice2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugDevice2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugDevice2 * This); + + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugDevice2 * This, + D3D12_DEBUG_FEATURE Mask); + + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugDevice2 * This); + + HRESULT ( STDMETHODCALLTYPE *ReportLiveDeviceObjects )( + ID3D12DebugDevice2 * This, + D3D12_RLDO_FLAGS Flags); + + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugDevice2 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugDevice2 * This, + D3D12_DEBUG_DEVICE_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + END_INTERFACE + } ID3D12DebugDevice2Vtbl; + + interface ID3D12DebugDevice2 + { + CONST_VTBL struct ID3D12DebugDevice2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugDevice2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugDevice2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugDevice2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugDevice2_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugDevice2_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + +#define ID3D12DebugDevice2_ReportLiveDeviceObjects(This,Flags) \ + ( (This)->lpVtbl -> ReportLiveDeviceObjects(This,Flags) ) + + +#define ID3D12DebugDevice2_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugDevice2_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugDevice2_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0007 */ /* [local] */ DEFINE_GUID(DXGI_DEBUG_D3D12, 0xcf59a98c, 0xa950, 0x4326, 0x91, 0xef, 0x9b, 0xba, 0xa1, 0x7b, 0xfd, 0x95); -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0002_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0007_v0_0_s_ifspec; #ifndef __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ #define __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ @@ -389,6 +1014,136 @@ EXTERN_C const IID IID_ID3D12DebugCommandQueue; #endif /* __ID3D12DebugCommandQueue_INTERFACE_DEFINED__ */ +/* interface __MIDL_itf_d3d12sdklayers_0000_0008 */ +/* [local] */ + +typedef +enum D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE + { + D3D12_DEBUG_COMMAND_LIST_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = 0 + } D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE; + +typedef struct D3D12_DEBUG_COMMAND_LIST_GPU_BASED_VALIDATION_SETTINGS + { + D3D12_GPU_BASED_VALIDATION_SHADER_PATCH_MODE ShaderPatchMode; + } D3D12_DEBUG_COMMAND_LIST_GPU_BASED_VALIDATION_SETTINGS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0008_v0_0_s_ifspec; + +#ifndef __ID3D12DebugCommandList1_INTERFACE_DEFINED__ +#define __ID3D12DebugCommandList1_INTERFACE_DEFINED__ + +/* interface ID3D12DebugCommandList1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandList1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("102ca951-311b-4b01-b11f-ecb83e061b37") + ID3D12DebugCommandList1 : public IUnknown + { + public: + virtual BOOL STDMETHODCALLTYPE AssertResourceState( + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDebugParameter( + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDebugParameter( + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugCommandList1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandList1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandList1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandList1 * This); + + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandList1 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugCommandList1 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugCommandList1 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + END_INTERFACE + } ID3D12DebugCommandList1Vtbl; + + interface ID3D12DebugCommandList1 + { + CONST_VTBL struct ID3D12DebugCommandList1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandList1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandList1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandList1_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + +#define ID3D12DebugCommandList1_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugCommandList1_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandList1_INTERFACE_DEFINED__ */ + + #ifndef __ID3D12DebugCommandList_INTERFACE_DEFINED__ #define __ID3D12DebugCommandList_INTERFACE_DEFINED__ @@ -490,7 +1245,242 @@ EXTERN_C const IID IID_ID3D12DebugCommandList; #endif /* __ID3D12DebugCommandList_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_d3d12sdklayers_0000_0004 */ +#ifndef __ID3D12DebugCommandList2_INTERFACE_DEFINED__ +#define __ID3D12DebugCommandList2_INTERFACE_DEFINED__ + +/* interface ID3D12DebugCommandList2 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12DebugCommandList2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("aeb575cf-4e06-48be-ba3b-c450fc96652e") + ID3D12DebugCommandList2 : public ID3D12DebugCommandList + { + public: + virtual HRESULT STDMETHODCALLTYPE SetDebugParameter( + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDebugParameter( + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12DebugCommandList2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12DebugCommandList2 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12DebugCommandList2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12DebugCommandList2 * This); + + BOOL ( STDMETHODCALLTYPE *AssertResourceState )( + ID3D12DebugCommandList2 * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + UINT State); + + HRESULT ( STDMETHODCALLTYPE *SetFeatureMask )( + ID3D12DebugCommandList2 * This, + D3D12_DEBUG_FEATURE Mask); + + D3D12_DEBUG_FEATURE ( STDMETHODCALLTYPE *GetFeatureMask )( + ID3D12DebugCommandList2 * This); + + HRESULT ( STDMETHODCALLTYPE *SetDebugParameter )( + ID3D12DebugCommandList2 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _In_reads_bytes_(DataSize) const void *pData, + UINT DataSize); + + HRESULT ( STDMETHODCALLTYPE *GetDebugParameter )( + ID3D12DebugCommandList2 * This, + D3D12_DEBUG_COMMAND_LIST_PARAMETER_TYPE Type, + _Out_writes_bytes_(DataSize) void *pData, + UINT DataSize); + + END_INTERFACE + } ID3D12DebugCommandList2Vtbl; + + interface ID3D12DebugCommandList2 + { + CONST_VTBL struct ID3D12DebugCommandList2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12DebugCommandList2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12DebugCommandList2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12DebugCommandList2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12DebugCommandList2_AssertResourceState(This,pResource,Subresource,State) \ + ( (This)->lpVtbl -> AssertResourceState(This,pResource,Subresource,State) ) + +#define ID3D12DebugCommandList2_SetFeatureMask(This,Mask) \ + ( (This)->lpVtbl -> SetFeatureMask(This,Mask) ) + +#define ID3D12DebugCommandList2_GetFeatureMask(This) \ + ( (This)->lpVtbl -> GetFeatureMask(This) ) + + +#define ID3D12DebugCommandList2_SetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> SetDebugParameter(This,Type,pData,DataSize) ) + +#define ID3D12DebugCommandList2_GetDebugParameter(This,Type,pData,DataSize) \ + ( (This)->lpVtbl -> GetDebugParameter(This,Type,pData,DataSize) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12DebugCommandList2_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12SharingContract_INTERFACE_DEFINED__ +#define __ID3D12SharingContract_INTERFACE_DEFINED__ + +/* interface ID3D12SharingContract */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12SharingContract; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0adf7d52-929c-4e61-addb-ffed30de66ef") + ID3D12SharingContract : public IUnknown + { + public: + virtual void STDMETHODCALLTYPE Present( + _In_ ID3D12Resource *pResource, + UINT Subresource, + _In_ HWND window) = 0; + + virtual void STDMETHODCALLTYPE SharedFenceSignal( + _In_ ID3D12Fence *pFence, + UINT64 FenceValue) = 0; + + virtual void STDMETHODCALLTYPE BeginCapturableWork( + _In_ REFGUID guid) = 0; + + virtual void STDMETHODCALLTYPE EndCapturableWork( + _In_ REFGUID guid) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12SharingContractVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12SharingContract * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12SharingContract * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12SharingContract * This); + + void ( STDMETHODCALLTYPE *Present )( + ID3D12SharingContract * This, + _In_ ID3D12Resource *pResource, + UINT Subresource, + _In_ HWND window); + + void ( STDMETHODCALLTYPE *SharedFenceSignal )( + ID3D12SharingContract * This, + _In_ ID3D12Fence *pFence, + UINT64 FenceValue); + + void ( STDMETHODCALLTYPE *BeginCapturableWork )( + ID3D12SharingContract * This, + _In_ REFGUID guid); + + void ( STDMETHODCALLTYPE *EndCapturableWork )( + ID3D12SharingContract * This, + _In_ REFGUID guid); + + END_INTERFACE + } ID3D12SharingContractVtbl; + + interface ID3D12SharingContract + { + CONST_VTBL struct ID3D12SharingContractVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12SharingContract_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12SharingContract_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12SharingContract_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12SharingContract_Present(This,pResource,Subresource,window) \ + ( (This)->lpVtbl -> Present(This,pResource,Subresource,window) ) + +#define ID3D12SharingContract_SharedFenceSignal(This,pFence,FenceValue) \ + ( (This)->lpVtbl -> SharedFenceSignal(This,pFence,FenceValue) ) + +#define ID3D12SharingContract_BeginCapturableWork(This,guid) \ + ( (This)->lpVtbl -> BeginCapturableWork(This,guid) ) + +#define ID3D12SharingContract_EndCapturableWork(This,guid) \ + ( (This)->lpVtbl -> EndCapturableWork(This,guid) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12SharingContract_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12sdklayers_0000_0012 */ /* [local] */ typedef @@ -926,10 +1916,10 @@ enum D3D12_MESSAGE_ID D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = ( D3D12_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN + 1 ) , D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = ( D3D12_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT + 1 ) , D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS = ( D3D12_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT + 1 ) , - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = ( D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS + 1 ) , - D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = ( D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER + 1 ) , - D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = ( D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER + 1 ) , - D3D12_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE = ( D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER + 1 ) , + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARRAYWITHDECODER = ( D3D12_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS + 1 ) , + D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARRAYWITHDECODER = ( D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARRAYWITHDECODER + 1 ) , + D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARRAYWITHDECODER = ( D3D12_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARRAYWITHDECODER + 1 ) , + D3D12_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE = ( D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARRAYWITHDECODER + 1 ) , D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDPRIORITY = ( D3D12_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE + 1 ) , D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDVIEW = ( D3D12_MESSAGE_ID_OFFERRESOURCES_INVALIDPRIORITY + 1 ) , D3D12_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = ( D3D12_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDVIEW + 1 ) , @@ -1268,10 +2258,7 @@ enum D3D12_MESSAGE_ID D3D12_MESSAGE_ID_CREATECOMMANDSIGNATURE_INVALID = ( D3D12_MESSAGE_ID_CREATE_SAMPLER_INVALID + 1 ) , D3D12_MESSAGE_ID_EXECUTE_INDIRECT_INVALID_PARAMETERS = ( D3D12_MESSAGE_ID_CREATECOMMANDSIGNATURE_INVALID + 1 ) , D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION = ( D3D12_MESSAGE_ID_EXECUTE_INDIRECT_INVALID_PARAMETERS + 1 ) , - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = ( D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION + 1 ) , - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = ( D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE + 1 ) , - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = ( D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_DECODENOTSUPPORTED + 1 ) , - D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = ( D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = ( D3D12_MESSAGE_ID_GETGPUVIRTUALADDRESS_INVALID_RESOURCE_DIMENSION + 4 ) , D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = ( D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX + 1 ) , D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = ( D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX + 1 ) , D3D12_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = ( D3D12_MESSAGE_ID_CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX + 1 ) , @@ -1316,8 +2303,8 @@ enum D3D12_MESSAGE_ID D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = ( D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE + 1 ) , D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = ( D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS + 1 ) , D3D12_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED = ( D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE + 1 ) , - D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPRTEDCOPYFLAGS = ( D3D12_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED + 1 ) , - D3D12_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED = ( D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPRTEDCOPYFLAGS + 1 ) , + D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDCOPYFLAGS = ( D3D12_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED = ( D3D12_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDCOPYFLAGS + 1 ) , D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSCANDATAOFFSET = ( D3D12_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED + 1 ) , D3D12_MESSAGE_ID_JPEGENCODE_INVALIDCOMPONENTS = ( D3D12_MESSAGE_ID_JPEGENCODE_INVALIDSCANDATAOFFSET + 1 ) , D3D12_MESSAGE_ID_JPEGENCODE_SOURCENOT2D = ( D3D12_MESSAGE_ID_JPEGENCODE_INVALIDCOMPONENTS + 1 ) , @@ -1335,8 +2322,8 @@ enum D3D12_MESSAGE_ID D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = ( D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE + 1 ) , D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = ( D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS + 1 ) , D3D12_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED = ( D3D12_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE + 1 ) , - D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = ( D3D12_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED + 1 ) , - D3D12_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = ( D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY + 1 ) , + D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTYPEFORQUERY = ( D3D12_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = ( D3D12_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTYPEFORQUERY + 1 ) , D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUE = ( D3D12_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE + 1 ) , D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDCLEARVALUEFORMAT = ( D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUE + 1 ) , D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDCLEARVALUEFORMAT = ( D3D12_MESSAGE_ID_CREATERESOURCE_UNRECOGNIZEDCLEARVALUEFORMAT + 1 ) , @@ -1456,9 +2443,292 @@ enum D3D12_MESSAGE_ID D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE = ( D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE + 1 ) , D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT = ( D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE + 1 ) , D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT = ( D3D12_MESSAGE_ID_NO_GRAPHICS_API_SUPPORT + 1 ) , - D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT + 1 ) + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_FLAGS_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_NO_COMPUTE_API_SUPPORT + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_ARGUMENT_UNINITIALIZED = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_RESOURCE_FLAGS_NOT_SUPPORTED + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_HEAP_INDEX_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_ARGUMENT_UNINITIALIZED + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TABLE_REGISTER_INDEX_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_HEAP_INDEX_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_UNINITIALIZED = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TABLE_REGISTER_INDEX_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TYPE_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_UNINITIALIZED + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SRV_RESOURCE_DIMENSION_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_DESCRIPTOR_TYPE_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UAV_RESOURCE_DIMENSION_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SRV_RESOURCE_DIMENSION_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UAV_RESOURCE_DIMENSION_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_COPYRESOURCE_NULLDST = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INCOMPATIBLE_RESOURCE_STATE + 1 ) , + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDSTRESOURCE = ( D3D12_MESSAGE_ID_COPYRESOURCE_NULLDST + 1 ) , + D3D12_MESSAGE_ID_COPYRESOURCE_NULLSRC = ( D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDDSTRESOURCE + 1 ) , + D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSRCRESOURCE = ( D3D12_MESSAGE_ID_COPYRESOURCE_NULLSRC + 1 ) , + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLDST = ( D3D12_MESSAGE_ID_COPYRESOURCE_INVALIDSRCRESOURCE + 1 ) , + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDDSTRESOURCE = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLDST + 1 ) , + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLSRC = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDDSTRESOURCE + 1 ) , + D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDSRCRESOURCE = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_NULLSRC + 1 ) , + D3D12_MESSAGE_ID_PIPELINE_STATE_TYPE_MISMATCH = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCE_INVALIDSRCRESOURCE + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_NOT_SET = ( D3D12_MESSAGE_ID_PIPELINE_STATE_TYPE_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_MISMATCH = ( D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_RESOURCE_BARRIER_ZERO_BARRIERS = ( D3D12_MESSAGE_ID_COMMAND_LIST_DISPATCH_ROOT_SIGNATURE_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_BEGIN_END_EVENT_MISMATCH = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_ZERO_BARRIERS + 1 ) , + D3D12_MESSAGE_ID_RESOURCE_BARRIER_POSSIBLE_BEFORE_AFTER_MISMATCH = ( D3D12_MESSAGE_ID_BEGIN_END_EVENT_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_BEGIN_END = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_POSSIBLE_BEFORE_AFTER_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INVALID_RESOURCE = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_BEGIN_END + 1 ) , + D3D12_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_INVALID_RESOURCE + 1 ) , + D3D12_MESSAGE_ID_OBJECT_EVICTED_WHILE_STILL_IN_USE = ( D3D12_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_DESCRIPTOR_ACCESS_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_OBJECT_EVICTED_WHILE_STILL_IN_USE + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_INVALIDLIBRARYBLOB = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_ROOT_DESCRIPTOR_ACCESS_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_DRIVERVERSIONMISMATCH = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_INVALIDLIBRARYBLOB + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_ADAPTERVERSIONMISMATCH = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_DRIVERVERSIONMISMATCH + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_UNSUPPORTED = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_ADAPTERVERSIONMISMATCH + 1 ) , + D3D12_MESSAGE_ID_CREATE_PIPELINELIBRARY = ( D3D12_MESSAGE_ID_CREATEPIPELINELIBRARY_UNSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_LIVE_PIPELINELIBRARY = ( D3D12_MESSAGE_ID_CREATE_PIPELINELIBRARY + 1 ) , + D3D12_MESSAGE_ID_DESTROY_PIPELINELIBRARY = ( D3D12_MESSAGE_ID_LIVE_PIPELINELIBRARY + 1 ) , + D3D12_MESSAGE_ID_STOREPIPELINE_NONAME = ( D3D12_MESSAGE_ID_DESTROY_PIPELINELIBRARY + 1 ) , + D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME = ( D3D12_MESSAGE_ID_STOREPIPELINE_NONAME + 1 ) , + D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND = ( D3D12_MESSAGE_ID_STOREPIPELINE_DUPLICATENAME + 1 ) , + D3D12_MESSAGE_ID_LOADPIPELINE_INVALIDDESC = ( D3D12_MESSAGE_ID_LOADPIPELINE_NAMENOTFOUND + 1 ) , + D3D12_MESSAGE_ID_PIPELINELIBRARY_SERIALIZE_NOTENOUGHMEMORY = ( D3D12_MESSAGE_ID_LOADPIPELINE_INVALIDDESC + 1 ) , + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_RT_OUTPUT_MISMATCH = ( D3D12_MESSAGE_ID_PIPELINELIBRARY_SERIALIZE_NOTENOUGHMEMORY + 1 ) , + D3D12_MESSAGE_ID_SETEVENTONMULTIPLEFENCECOMPLETION_INVALIDFLAGS = ( D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_PS_OUTPUT_RT_OUTPUT_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_CREATE_QUEUE_VIDEO_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_SETEVENTONMULTIPLEFENCECOMPLETION_INVALIDFLAGS + 1 ) , + D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_VIDEO_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_CREATE_QUEUE_VIDEO_NOT_SUPPORTED + 1 ) , + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_VIDEO_DECODE_STATISTICS_NOT_SUPPORTED = ( D3D12_MESSAGE_ID_CREATE_COMMAND_ALLOCATOR_VIDEO_NOT_SUPPORTED + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDLIST = ( D3D12_MESSAGE_ID_CREATEQUERY_HEAP_VIDEO_DECODE_STATISTICS_NOT_SUPPORTED + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEODECODER = ( D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDLIST + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEODECODESTREAM = ( D3D12_MESSAGE_ID_CREATE_VIDEODECODER + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDLIST = ( D3D12_MESSAGE_ID_CREATE_VIDEODECODESTREAM + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEODECODER = ( D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDLIST + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEODECODESTREAM = ( D3D12_MESSAGE_ID_LIVE_VIDEODECODER + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDLIST = ( D3D12_MESSAGE_ID_LIVE_VIDEODECODESTREAM + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEODECODER = ( D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDLIST + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEODECODESTREAM = ( D3D12_MESSAGE_ID_DESTROY_VIDEODECODER + 1 ) , + D3D12_MESSAGE_ID_DECODE_FRAME_INVALID_PARAMETERS = ( D3D12_MESSAGE_ID_DESTROY_VIDEODECODESTREAM + 1 ) , + D3D12_MESSAGE_ID_DEPRECATED_API = ( D3D12_MESSAGE_ID_DECODE_FRAME_INVALID_PARAMETERS + 1 ) , + D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE = ( D3D12_MESSAGE_ID_DEPRECATED_API + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_MISMATCHING_COMMAND_LIST_TYPE + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_CONSTANT_BUFFER_VIEW_NOT_SET = ( D3D12_MESSAGE_ID_COMMAND_LIST_DESCRIPTOR_TABLE_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_SHADER_RESOURCE_VIEW_NOT_SET = ( D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_CONSTANT_BUFFER_VIEW_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_UNORDERED_ACCESS_VIEW_NOT_SET = ( D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_SHADER_RESOURCE_VIEW_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_DISCARD_INVALID_SUBRESOURCE_RANGE = ( D3D12_MESSAGE_ID_COMMAND_LIST_ROOT_UNORDERED_ACCESS_VIEW_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_DISCARD_ONE_SUBRESOURCE_FOR_MIPS_WITH_RECTS = ( D3D12_MESSAGE_ID_DISCARD_INVALID_SUBRESOURCE_RANGE + 1 ) , + D3D12_MESSAGE_ID_DISCARD_NO_RECTS_FOR_NON_TEXTURE2D = ( D3D12_MESSAGE_ID_DISCARD_ONE_SUBRESOURCE_FOR_MIPS_WITH_RECTS + 1 ) , + D3D12_MESSAGE_ID_COPY_ON_SAME_SUBRESOURCE = ( D3D12_MESSAGE_ID_DISCARD_NO_RECTS_FOR_NON_TEXTURE2D + 1 ) , + D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PAGEABLE = ( D3D12_MESSAGE_ID_COPY_ON_SAME_SUBRESOURCE + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED = ( D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PAGEABLE + 1 ) , + D3D12_MESSAGE_ID_STATIC_DESCRIPTOR_INVALID_DESCRIPTOR_CHANGE = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_DATA_STATIC_DESCRIPTOR_INVALID_DATA_CHANGE = ( D3D12_MESSAGE_ID_STATIC_DESCRIPTOR_INVALID_DESCRIPTOR_CHANGE + 1 ) , + D3D12_MESSAGE_ID_DATA_STATIC_WHILE_SET_AT_EXECUTE_DESCRIPTOR_INVALID_DATA_CHANGE = ( D3D12_MESSAGE_ID_DATA_STATIC_DESCRIPTOR_INVALID_DATA_CHANGE + 1 ) , + D3D12_MESSAGE_ID_EXECUTE_BUNDLE_STATIC_DESCRIPTOR_DATA_STATIC_NOT_SET = ( D3D12_MESSAGE_ID_DATA_STATIC_WHILE_SET_AT_EXECUTE_DESCRIPTOR_INVALID_DATA_CHANGE + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_ACCESS_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_EXECUTE_BUNDLE_STATIC_DESCRIPTOR_DATA_STATIC_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SAMPLER_MODE_MISMATCH = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_ACCESS_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_CREATE_FENCE_INVALID_FLAGS = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_SAMPLER_MODE_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS = ( D3D12_MESSAGE_ID_CREATE_FENCE_INVALID_FLAGS + 1 ) , + D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PRIORITY = ( D3D12_MESSAGE_ID_RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS + 1 ) , + D3D12_MESSAGE_ID_CREATE_PASS = ( D3D12_MESSAGE_ID_SETRESIDENCYPRIORITY_INVALID_PRIORITY + 1 ) , + D3D12_MESSAGE_ID_DESTROY_PASS = ( D3D12_MESSAGE_ID_CREATE_PASS + 1 ) , + D3D12_MESSAGE_ID_LIVE_PASS = ( D3D12_MESSAGE_ID_DESTROY_PASS + 1 ) , + D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_LARGE_NUM_DESCRIPTORS = ( D3D12_MESSAGE_ID_LIVE_PASS + 1 ) , + D3D12_MESSAGE_ID_BEGIN_EVENT = ( D3D12_MESSAGE_ID_CREATE_DESCRIPTOR_HEAP_LARGE_NUM_DESCRIPTORS + 1 ) , + D3D12_MESSAGE_ID_END_EVENT = ( D3D12_MESSAGE_ID_BEGIN_EVENT + 1 ) , + D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS = ( D3D12_MESSAGE_ID_END_EVENT + 1 ) , + D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_DEPTHBOUNDSTEST_UNSUPPORTED = ( D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_DUPLICATE_SUBOBJECT = ( D3D12_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_DEPTHBOUNDSTEST_UNSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_UNKNOWN_SUBOBJECT = ( D3D12_MESSAGE_ID_CREATEPIPELINESTATE_DUPLICATE_SUBOBJECT + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_ZERO_SIZE_STREAM = ( D3D12_MESSAGE_ID_CREATEPIPELINESTATE_UNKNOWN_SUBOBJECT + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_STREAM = ( D3D12_MESSAGE_ID_CREATEPIPELINESTATE_ZERO_SIZE_STREAM + 1 ) , + D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CANNOT_DEDUCE_TYPE = ( D3D12_MESSAGE_ID_CREATEPIPELINESTATE_INVALID_STREAM + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_RESOURCE_DIMENSION_MISMATCH = ( D3D12_MESSAGE_ID_CREATEPIPELINESTATE_CANNOT_DEDUCE_TYPE + 1 ) , + D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_PRIVILEGE_FOR_GLOBAL_REALTIME = ( D3D12_MESSAGE_ID_COMMAND_LIST_STATIC_DESCRIPTOR_RESOURCE_DIMENSION_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_HARDWARE_SUPPORT_FOR_GLOBAL_REALTIME = ( D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_PRIVILEGE_FOR_GLOBAL_REALTIME + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_ARCHITECTURE = ( D3D12_MESSAGE_ID_CREATE_COMMAND_QUEUE_INSUFFICIENT_HARDWARE_SUPPORT_FOR_GLOBAL_REALTIME + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DST = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_ARCHITECTURE + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DST_RESOURCE_DIMENSION = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DST + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DST_RANGE_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DST_RESOURCE_DIMENSION + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_SRC = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DST_RANGE_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_SRC_RESOURCE_DIMENSION = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_SRC + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_SRC_RANGE_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_SRC_RESOURCE_DIMENSION + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_OFFSET_ALIGNMENT = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_SRC_RANGE_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_RESOURCES = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_OFFSET_ALIGNMENT + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_SUBRESOURCE_RANGES = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_RESOURCES + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_RESOURCE = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_NULL_DEPENDENT_SUBRESOURCE_RANGES + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_SUBRESOURCE_RANGE = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_RESOURCE + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_SUBRESOURCE_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DEPENDENT_SUBRESOURCE_RANGE + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_RANGE_OUT_OF_BOUNDS = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_SUBRESOURCE_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_ZERO_DEPENDENCIES = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_DEPENDENT_RANGE_OUT_OF_BOUNDS + 1 ) , + D3D12_MESSAGE_ID_DEVICE_CREATE_SHARED_HANDLE_INVALIDARG = ( D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_ZERO_DEPENDENCIES + 1 ) , + D3D12_MESSAGE_ID_DESCRIPTOR_HANDLE_WITH_INVALID_RESOURCE = ( D3D12_MESSAGE_ID_DEVICE_CREATE_SHARED_HANDLE_INVALIDARG + 1 ) , + D3D12_MESSAGE_ID_SETDEPTHBOUNDS_INVALIDARGS = ( D3D12_MESSAGE_ID_DESCRIPTOR_HANDLE_WITH_INVALID_RESOURCE + 1 ) , + D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_STATE_IMPRECISE = ( D3D12_MESSAGE_ID_SETDEPTHBOUNDS_INVALIDARGS + 1 ) , + D3D12_MESSAGE_ID_COMMAND_LIST_PIPELINE_STATE_NOT_SET = ( D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_RESOURCE_STATE_IMPRECISE + 1 ) , + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_MODEL_MISMATCH = ( D3D12_MESSAGE_ID_COMMAND_LIST_PIPELINE_STATE_NOT_SET + 1 ) , + D3D12_MESSAGE_ID_OBJECT_ACCESSED_WHILE_STILL_IN_USE = ( D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_SHADER_MODEL_MISMATCH + 1 ) , + D3D12_MESSAGE_ID_PROGRAMMABLE_MSAA_UNSUPPORTED = ( D3D12_MESSAGE_ID_OBJECT_ACCESSED_WHILE_STILL_IN_USE + 1 ) , + D3D12_MESSAGE_ID_SETSAMPLEPOSITIONS_INVALIDARGS = ( D3D12_MESSAGE_ID_PROGRAMMABLE_MSAA_UNSUPPORTED + 1 ) , + D3D12_MESSAGE_ID_RESOLVESUBRESOURCEREGION_INVALID_RECT = ( D3D12_MESSAGE_ID_SETSAMPLEPOSITIONS_INVALIDARGS + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDQUEUE = ( D3D12_MESSAGE_ID_RESOLVESUBRESOURCEREGION_INVALID_RECT + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDLIST = ( D3D12_MESSAGE_ID_CREATE_VIDEODECODECOMMANDQUEUE + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDQUEUE = ( D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDLIST + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDQUEUE = ( D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSCOMMANDQUEUE + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDLIST = ( D3D12_MESSAGE_ID_LIVE_VIDEODECODECOMMANDQUEUE + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDQUEUE = ( D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDLIST + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDQUEUE = ( D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSCOMMANDQUEUE + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDLIST = ( D3D12_MESSAGE_ID_DESTROY_VIDEODECODECOMMANDQUEUE + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDQUEUE = ( D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDLIST + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSOR = ( D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSCOMMANDQUEUE + 1 ) , + D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSSTREAM = ( D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSOR + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSOR = ( D3D12_MESSAGE_ID_CREATE_VIDEOPROCESSSTREAM + 1 ) , + D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSSTREAM = ( D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSOR + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSOR = ( D3D12_MESSAGE_ID_LIVE_VIDEOPROCESSSTREAM + 1 ) , + D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSSTREAM = ( D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSOR + 1 ) , + D3D12_MESSAGE_ID_PROCESS_FRAME_INVALID_PARAMETERS = ( D3D12_MESSAGE_ID_DESTROY_VIDEOPROCESSSTREAM + 1 ) , + D3D12_MESSAGE_ID_COPY_INVALIDLAYOUT = ( D3D12_MESSAGE_ID_PROCESS_FRAME_INVALID_PARAMETERS + 1 ) , + D3D12_MESSAGE_ID_CREATE_CRYPTO_SESSION = 1068, + D3D12_MESSAGE_ID_CREATE_CRYPTO_SESSION_POLICY = 1069, + D3D12_MESSAGE_ID_CREATE_PROTECTED_RESOURCE_SESSION = 1070, + D3D12_MESSAGE_ID_LIVE_CRYPTO_SESSION = 1071, + D3D12_MESSAGE_ID_LIVE_CRYPTO_SESSION_POLICY = 1072, + D3D12_MESSAGE_ID_LIVE_PROTECTED_RESOURCE_SESSION = 1073, + D3D12_MESSAGE_ID_DESTROY_CRYPTO_SESSION = 1074, + D3D12_MESSAGE_ID_DESTROY_CRYPTO_SESSION_POLICY = 1075, + D3D12_MESSAGE_ID_DESTROY_PROTECTED_RESOURCE_SESSION = 1076, + D3D12_MESSAGE_ID_PROTECTED_RESOURCE_SESSION_UNSUPPORTED = 1077, + D3D12_MESSAGE_ID_FENCE_INVALIDOPERATION = 1078, + D3D12_MESSAGE_ID_CREATEQUERY_HEAP_COPY_QUEUE_TIMESTAMPS_NOT_SUPPORTED = 1079, + D3D12_MESSAGE_ID_SAMPLEPOSITIONS_MISMATCH_DEFERRED = 1080, + D3D12_MESSAGE_ID_SAMPLEPOSITIONS_MISMATCH_RECORDTIME_ASSUMEDFROMFIRSTUSE = 1081, + D3D12_MESSAGE_ID_SAMPLEPOSITIONS_MISMATCH_RECORDTIME_ASSUMEDFROMCLEAR = 1082, + D3D12_MESSAGE_ID_CREATE_VIDEODECODERHEAP = 1083, + D3D12_MESSAGE_ID_LIVE_VIDEODECODERHEAP = 1084, + D3D12_MESSAGE_ID_DESTROY_VIDEODECODERHEAP = 1085, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_INVALIDARG_RETURN = 1086, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_OUTOFMEMORY_RETURN = 1087, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_INVALIDADDRESS = 1088, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_INVALIDHANDLE = 1089, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_INVALID_DEST = 1090, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_INVALID_MODE = 1091, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_INVALID_ALIGNMENT = 1092, + D3D12_MESSAGE_ID_WRITEBUFFERIMMEDIATE_NOT_SUPPORTED = 1093, + D3D12_MESSAGE_ID_SETVIEWINSTANCEMASK_INVALIDARGS = 1094, + D3D12_MESSAGE_ID_VIEW_INSTANCING_UNSUPPORTED = 1095, + D3D12_MESSAGE_ID_VIEW_INSTANCING_INVALIDARGS = 1096, + D3D12_MESSAGE_ID_COPYTEXTUREREGION_MISMATCH_DECODE_REFERENCE_ONLY_FLAG = 1097, + D3D12_MESSAGE_ID_COPYRESOURCE_MISMATCH_DECODE_REFERENCE_ONLY_FLAG = 1098, + D3D12_MESSAGE_ID_CREATE_VIDEO_DECODE_HEAP_CAPS_FAILURE = 1099, + D3D12_MESSAGE_ID_CREATE_VIDEO_DECODE_HEAP_CAPS_UNSUPPORTED = 1100, + D3D12_MESSAGE_ID_VIDEO_DECODE_SUPPORT_INVALID_INPUT = 1101, + D3D12_MESSAGE_ID_CREATE_VIDEO_DECODER_UNSUPPORTED = 1102, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_METADATA_ERROR = 1103, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_VIEW_INSTANCING_VERTEX_SIZE_EXCEEDED = 1104, + D3D12_MESSAGE_ID_CREATEGRAPHICSPIPELINESTATE_RUNTIME_INTERNAL_ERROR = 1105, + D3D12_MESSAGE_ID_NO_VIDEO_API_SUPPORT = 1106, + D3D12_MESSAGE_ID_VIDEO_PROCESS_SUPPORT_INVALID_INPUT = 1107, + D3D12_MESSAGE_ID_CREATE_VIDEO_PROCESSOR_CAPS_FAILURE = 1108, + D3D12_MESSAGE_ID_VIDEO_PROCESS_SUPPORT_UNSUPPORTED_FORMAT = 1109, + D3D12_MESSAGE_ID_VIDEO_DECODE_FRAME_INVALID_ARGUMENT = 1110, + D3D12_MESSAGE_ID_ENQUEUE_MAKE_RESIDENT_INVALID_FLAGS = 1111, + D3D12_MESSAGE_ID_OPENEXISTINGHEAP_UNSUPPORTED = 1112, + D3D12_MESSAGE_ID_VIDEO_PROCESS_FRAMES_INVALID_ARGUMENT = 1113, + D3D12_MESSAGE_ID_VIDEO_DECODE_SUPPORT_UNSUPPORTED = 1114, + D3D12_MESSAGE_ID_CREATE_COMMANDRECORDER = 1115, + D3D12_MESSAGE_ID_LIVE_COMMANDRECORDER = 1116, + D3D12_MESSAGE_ID_DESTROY_COMMANDRECORDER = 1117, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_VIDEO_NOT_SUPPORTED = 1118, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_INVALID_SUPPORT_FLAGS = 1119, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_INVALID_FLAGS = 1120, + D3D12_MESSAGE_ID_CREATE_COMMAND_RECORDER_MORE_RECORDERS_THAN_LOGICAL_PROCESSORS = 1121, + D3D12_MESSAGE_ID_CREATE_COMMANDPOOL = 1122, + D3D12_MESSAGE_ID_LIVE_COMMANDPOOL = 1123, + D3D12_MESSAGE_ID_DESTROY_COMMANDPOOL = 1124, + D3D12_MESSAGE_ID_CREATE_COMMAND_POOL_INVALID_FLAGS = 1125, + D3D12_MESSAGE_ID_CREATE_COMMAND_LIST_VIDEO_NOT_SUPPORTED = 1126, + D3D12_MESSAGE_ID_COMMAND_RECORDER_SUPPORT_FLAGS_MISMATCH = 1127, + D3D12_MESSAGE_ID_COMMAND_RECORDER_CONTENTION = 1128, + D3D12_MESSAGE_ID_COMMAND_RECORDER_USAGE_WITH_CREATECOMMANDLIST_COMMAND_LIST = 1129, + D3D12_MESSAGE_ID_COMMAND_ALLOCATOR_USAGE_WITH_CREATECOMMANDLIST1_COMMAND_LIST = 1130, + D3D12_MESSAGE_ID_CANNOT_EXECUTE_EMPTY_COMMAND_LIST = 1131, + D3D12_MESSAGE_ID_CANNOT_RESET_COMMAND_POOL_WITH_OPEN_COMMAND_LISTS = 1132, + D3D12_MESSAGE_ID_CANNOT_USE_COMMAND_RECORDER_WITHOUT_CURRENT_TARGET = 1133, + D3D12_MESSAGE_ID_CANNOT_CHANGE_COMMAND_RECORDER_TARGET_WHILE_RECORDING = 1134, + D3D12_MESSAGE_ID_COMMAND_POOL_SYNC = 1135, + D3D12_MESSAGE_ID_EVICT_UNDERFLOW = 1136, + D3D12_MESSAGE_ID_CREATE_META_COMMAND = 1137, + D3D12_MESSAGE_ID_LIVE_META_COMMAND = 1138, + D3D12_MESSAGE_ID_DESTROY_META_COMMAND = 1139, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALID_DST_RESOURCE = 1140, + D3D12_MESSAGE_ID_COPYBUFFERREGION_INVALID_SRC_RESOURCE = 1141, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_DST_RESOURCE = 1142, + D3D12_MESSAGE_ID_ATOMICCOPYBUFFER_INVALID_SRC_RESOURCE = 1143, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_NULL_BUFFER = 1144, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_NULL_RESOURCE_DESC = 1145, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_UNSUPPORTED = 1146, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_BUFFER_DIMENSION = 1147, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_BUFFER_FLAGS = 1148, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_BUFFER_OFFSET = 1149, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_RESOURCE_DIMENSION = 1150, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_INVALID_RESOURCE_FLAGS = 1151, + D3D12_MESSAGE_ID_CREATEPLACEDRESOURCEONBUFFER_OUTOFMEMORY_RETURN = 1152, + D3D12_MESSAGE_ID_CANNOT_CREATE_GRAPHICS_AND_VIDEO_COMMAND_RECORDER = 1153, + D3D12_MESSAGE_ID_UPDATETILEMAPPINGS_POSSIBLY_MISMATCHING_PROPERTIES = 1154, + D3D12_MESSAGE_ID_CREATE_COMMAND_LIST_INVALID_COMMAND_LIST_TYPE = 1155, + D3D12_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_INCOMPATIBLE_WITH_STRUCTURED_BUFFERS = 1156, + D3D12_MESSAGE_ID_COMPUTE_ONLY_DEVICE_OPERATION_UNSUPPORTED = 1157, + D3D12_MESSAGE_ID_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INVALID = 1158, + D3D12_MESSAGE_ID_EMIT_RAYTRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO_INVALID = 1159, + D3D12_MESSAGE_ID_COPY_RAYTRACING_ACCELERATION_STRUCTURE_INVALID = 1160, + D3D12_MESSAGE_ID_DISPATCH_RAYS_INVALID = 1161, + D3D12_MESSAGE_ID_GET_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO_INVALID = 1162, + D3D12_MESSAGE_ID_CREATE_LIFETIMETRACKER = 1163, + D3D12_MESSAGE_ID_LIVE_LIFETIMETRACKER = 1164, + D3D12_MESSAGE_ID_DESTROY_LIFETIMETRACKER = 1165, + D3D12_MESSAGE_ID_DESTROYOWNEDOBJECT_OBJECTNOTOWNED = 1166, + D3D12_MESSAGE_ID_CREATE_TRACKEDWORKLOAD = 1167, + D3D12_MESSAGE_ID_LIVE_TRACKEDWORKLOAD = 1168, + D3D12_MESSAGE_ID_DESTROY_TRACKEDWORKLOAD = 1169, + D3D12_MESSAGE_ID_RENDER_PASS_ERROR = 1170, + D3D12_MESSAGE_ID_META_COMMAND_ID_INVALID = 1171, + D3D12_MESSAGE_ID_META_COMMAND_UNSUPPORTED_PARAMS = 1172, + D3D12_MESSAGE_ID_META_COMMAND_FAILED_ENUMERATION = 1173, + D3D12_MESSAGE_ID_META_COMMAND_PARAMETER_SIZE_MISMATCH = 1174, + D3D12_MESSAGE_ID_UNINITIALIZED_META_COMMAND = 1175, + D3D12_MESSAGE_ID_META_COMMAND_INVALID_GPU_VIRTUAL_ADDRESS = 1176, + D3D12_MESSAGE_ID_CREATE_VIDEOENCODECOMMANDLIST = 1177, + D3D12_MESSAGE_ID_LIVE_VIDEOENCODECOMMANDLIST = 1178, + D3D12_MESSAGE_ID_DESTROY_VIDEOENCODECOMMANDLIST = 1179, + D3D12_MESSAGE_ID_CREATE_VIDEOENCODECOMMANDQUEUE = 1180, + D3D12_MESSAGE_ID_LIVE_VIDEOENCODECOMMANDQUEUE = 1181, + D3D12_MESSAGE_ID_DESTROY_VIDEOENCODECOMMANDQUEUE = 1182, + D3D12_MESSAGE_ID_CREATE_VIDEOMOTIONESTIMATOR = 1183, + D3D12_MESSAGE_ID_LIVE_VIDEOMOTIONESTIMATOR = 1184, + D3D12_MESSAGE_ID_DESTROY_VIDEOMOTIONESTIMATOR = 1185, + D3D12_MESSAGE_ID_CREATE_VIDEOMOTIONVECTORHEAP = 1186, + D3D12_MESSAGE_ID_LIVE_VIDEOMOTIONVECTORHEAP = 1187, + D3D12_MESSAGE_ID_DESTROY_VIDEOMOTIONVECTORHEAP = 1188, + D3D12_MESSAGE_ID_MULTIPLE_TRACKED_WORKLOADS = 1189, + D3D12_MESSAGE_ID_MULTIPLE_TRACKED_WORKLOAD_PAIRS = 1190, + D3D12_MESSAGE_ID_OUT_OF_ORDER_TRACKED_WORKLOAD_PAIR = 1191, + D3D12_MESSAGE_ID_CANNOT_ADD_TRACKED_WORKLOAD = 1192, + D3D12_MESSAGE_ID_INCOMPLETE_TRACKED_WORKLOAD_PAIR = 1193, + D3D12_MESSAGE_ID_CREATE_STATE_OBJECT_ERROR = 1194, + D3D12_MESSAGE_ID_GET_SHADER_IDENTIFIER_ERROR = 1195, + D3D12_MESSAGE_ID_GET_SHADER_STACK_SIZE_ERROR = 1196, + D3D12_MESSAGE_ID_GET_PIPELINE_STACK_SIZE_ERROR = 1197, + D3D12_MESSAGE_ID_SET_PIPELINE_STACK_SIZE_ERROR = 1198, + D3D12_MESSAGE_ID_GET_SHADER_IDENTIFIER_SIZE_INVALID = 1199, + D3D12_MESSAGE_ID_CHECK_DRIVER_MATCHING_IDENTIFIER_INVALID = 1200, + D3D12_MESSAGE_ID_CHECK_DRIVER_MATCHING_IDENTIFIER_DRIVER_REPORTED_ISSUE = 1201, + D3D12_MESSAGE_ID_RENDER_PASS_INVALID_RESOURCE_BARRIER = 1202, + D3D12_MESSAGE_ID_RENDER_PASS_DISALLOWED_API_CALLED = 1203, + D3D12_MESSAGE_ID_RENDER_PASS_CANNOT_NEST_RENDER_PASSES = 1204, + D3D12_MESSAGE_ID_RENDER_PASS_CANNOT_END_WITHOUT_BEGIN = 1205, + D3D12_MESSAGE_ID_RENDER_PASS_CANNOT_CLOSE_COMMAND_LIST = 1206, + D3D12_MESSAGE_ID_RENDER_PASS_GPU_WORK_WHILE_SUSPENDED = 1207, + D3D12_MESSAGE_ID_RENDER_PASS_MISMATCHING_SUSPEND_RESUME = 1208, + D3D12_MESSAGE_ID_RENDER_PASS_NO_PRIOR_SUSPEND_WITHIN_EXECUTECOMMANDLISTS = 1209, + D3D12_MESSAGE_ID_RENDER_PASS_NO_SUBSEQUENT_RESUME_WITHIN_EXECUTECOMMANDLISTS = 1210, + D3D12_MESSAGE_ID_TRACKED_WORKLOAD_COMMAND_QUEUE_MISMATCH = 1211, + D3D12_MESSAGE_ID_TRACKED_WORKLOAD_NOT_SUPPORTED = 1212, + D3D12_MESSAGE_ID_RENDER_PASS_MISMATCHING_NO_ACCESS = 1213, + D3D12_MESSAGE_ID_RENDER_PASS_UNSUPPORTED_RESOLVE = 1214, + D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_RENDER_PASS_UNSUPPORTED_RESOLVE + 1 ) } D3D12_MESSAGE_ID; +static_assert(D3D12_MESSAGE_ID_GPU_BASED_VALIDATION_UNSUPPORTED == 1000, "Publicly released SDK D3D12_MESSAGE_ID enum values must not be changed. New enum values must be added to the end of the list."); +static_assert(D3D12_MESSAGE_ID_COPY_INVALIDLAYOUT == 1067, "Publicly released SDK D3D12_MESSAGE_ID enum values must not be changed. New enum values must be added to the end of the list."); typedef struct D3D12_MESSAGE { D3D12_MESSAGE_CATEGORY Category; @@ -1487,8 +2757,8 @@ typedef struct D3D12_INFO_QUEUE_FILTER #define D3D12_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT 1024 -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0004_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0012_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0012_v0_0_s_ifspec; #ifndef __ID3D12InfoQueue_INTERFACE_DEFINED__ #define __ID3D12InfoQueue_INTERFACE_DEFINED__ @@ -1895,18 +3165,28 @@ EXTERN_C const IID IID_ID3D12InfoQueue; #endif /* __ID3D12InfoQueue_INTERFACE_DEFINED__ */ -/* interface __MIDL_itf_d3d12sdklayers_0000_0005 */ +/* interface __MIDL_itf_d3d12sdklayers_0000_0013 */ /* [local] */ +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion DEFINE_GUID(IID_ID3D12Debug,0x344488b7,0x6846,0x474b,0xb9,0x89,0xf0,0x27,0x44,0x82,0x45,0xe0); +DEFINE_GUID(IID_ID3D12Debug1,0xaffaa4ca,0x63fe,0x4d8e,0xb8,0xad,0x15,0x90,0x00,0xaf,0x43,0x04); +DEFINE_GUID(IID_ID3D12Debug2,0x93a665c4,0xa3b2,0x4e5d,0xb6,0x92,0xa2,0x6a,0xe1,0x4e,0x33,0x74); +DEFINE_GUID(IID_ID3D12Debug3,0x5cf4e58f,0xf671,0x4ff1,0xa5,0x42,0x36,0x86,0xe3,0xd1,0x53,0xd1); +DEFINE_GUID(IID_ID3D12DebugDevice1,0xa9b71770,0xd099,0x4a65,0xa6,0x98,0x3d,0xee,0x10,0x02,0x0f,0x88); DEFINE_GUID(IID_ID3D12DebugDevice,0x3febd6dd,0x4973,0x4787,0x81,0x94,0xe4,0x5f,0x9e,0x28,0x92,0x3e); +DEFINE_GUID(IID_ID3D12DebugDevice2,0x60eccbc1,0x378d,0x4df1,0x89,0x4c,0xf8,0xac,0x5c,0xe4,0xd7,0xdd); DEFINE_GUID(IID_ID3D12DebugCommandQueue,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3a); +DEFINE_GUID(IID_ID3D12DebugCommandList1,0x102ca951,0x311b,0x4b01,0xb1,0x1f,0xec,0xb8,0x3e,0x06,0x1b,0x37); DEFINE_GUID(IID_ID3D12DebugCommandList,0x09e0bf36,0x54ac,0x484f,0x88,0x47,0x4b,0xae,0xea,0xb6,0x05,0x3f); +DEFINE_GUID(IID_ID3D12DebugCommandList2,0xaeb575cf,0x4e06,0x48be,0xba,0x3b,0xc4,0x50,0xfc,0x96,0x65,0x2e); +DEFINE_GUID(IID_ID3D12SharingContract,0x0adf7d52,0x929c,0x4e61,0xad,0xdb,0xff,0xed,0x30,0xde,0x66,0xef); DEFINE_GUID(IID_ID3D12InfoQueue,0x0742a90b,0xc387,0x483f,0xb9,0x46,0x30,0xa7,0xe4,0xe6,0x14,0x58); -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0005_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0005_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0013_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0013_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12video.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12video.h new file mode 100644 index 00000000000..0e1f85fd758 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d12video.h @@ -0,0 +1,2452 @@ +/*------------------------------------------------------------------------------------- + * + * Copyright (c) Microsoft Corporation + * + *-------------------------------------------------------------------------------------*/ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __d3d12video_h__ +#define __d3d12video_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ID3D12VideoDecoderHeap_FWD_DEFINED__ +#define __ID3D12VideoDecoderHeap_FWD_DEFINED__ +typedef interface ID3D12VideoDecoderHeap ID3D12VideoDecoderHeap; + +#endif /* __ID3D12VideoDecoderHeap_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoDevice_FWD_DEFINED__ +#define __ID3D12VideoDevice_FWD_DEFINED__ +typedef interface ID3D12VideoDevice ID3D12VideoDevice; + +#endif /* __ID3D12VideoDevice_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoDecoder_FWD_DEFINED__ +#define __ID3D12VideoDecoder_FWD_DEFINED__ +typedef interface ID3D12VideoDecoder ID3D12VideoDecoder; + +#endif /* __ID3D12VideoDecoder_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoProcessor_FWD_DEFINED__ +#define __ID3D12VideoProcessor_FWD_DEFINED__ +typedef interface ID3D12VideoProcessor ID3D12VideoProcessor; + +#endif /* __ID3D12VideoProcessor_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoDecodeCommandList_FWD_DEFINED__ +#define __ID3D12VideoDecodeCommandList_FWD_DEFINED__ +typedef interface ID3D12VideoDecodeCommandList ID3D12VideoDecodeCommandList; + +#endif /* __ID3D12VideoDecodeCommandList_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoProcessCommandList_FWD_DEFINED__ +#define __ID3D12VideoProcessCommandList_FWD_DEFINED__ +typedef interface ID3D12VideoProcessCommandList ID3D12VideoProcessCommandList; + +#endif /* __ID3D12VideoProcessCommandList_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoDecodeCommandList1_FWD_DEFINED__ +#define __ID3D12VideoDecodeCommandList1_FWD_DEFINED__ +typedef interface ID3D12VideoDecodeCommandList1 ID3D12VideoDecodeCommandList1; + +#endif /* __ID3D12VideoDecodeCommandList1_FWD_DEFINED__ */ + + +#ifndef __ID3D12VideoProcessCommandList1_FWD_DEFINED__ +#define __ID3D12VideoProcessCommandList1_FWD_DEFINED__ +typedef interface ID3D12VideoProcessCommandList1 ID3D12VideoProcessCommandList1; + +#endif /* __ID3D12VideoProcessCommandList1_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "dxgicommon.h" +#include "d3d12.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_d3d12video_0000_0000 */ +/* [local] */ + +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +typedef +enum D3D12_VIDEO_FIELD_TYPE + { + D3D12_VIDEO_FIELD_TYPE_NONE = 0, + D3D12_VIDEO_FIELD_TYPE_INTERLACED_TOP_FIELD_FIRST = 1, + D3D12_VIDEO_FIELD_TYPE_INTERLACED_BOTTOM_FIELD_FIRST = 2 + } D3D12_VIDEO_FIELD_TYPE; + +typedef +enum D3D12_VIDEO_FRAME_STEREO_FORMAT + { + D3D12_VIDEO_FRAME_STEREO_FORMAT_NONE = 0, + D3D12_VIDEO_FRAME_STEREO_FORMAT_MONO = 1, + D3D12_VIDEO_FRAME_STEREO_FORMAT_HORIZONTAL = 2, + D3D12_VIDEO_FRAME_STEREO_FORMAT_VERTICAL = 3, + D3D12_VIDEO_FRAME_STEREO_FORMAT_SEPARATE = 4 + } D3D12_VIDEO_FRAME_STEREO_FORMAT; + +typedef struct D3D12_VIDEO_FORMAT + { + DXGI_FORMAT Format; + DXGI_COLOR_SPACE_TYPE ColorSpace; + } D3D12_VIDEO_FORMAT; + +typedef struct D3D12_VIDEO_SAMPLE + { + UINT Width; + UINT Height; + D3D12_VIDEO_FORMAT Format; + } D3D12_VIDEO_SAMPLE; + +typedef +enum D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE + { + D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE_NONE = 0, + D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE_FIELD_BASED = 1 + } D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE; + +typedef +enum D3D12_FEATURE_VIDEO + { + D3D12_FEATURE_VIDEO_DECODE_SUPPORT = 0, + D3D12_FEATURE_VIDEO_DECODE_PROFILES = 1, + D3D12_FEATURE_VIDEO_DECODE_FORMATS = 2, + D3D12_FEATURE_VIDEO_DECODE_CONVERSION_SUPPORT = 3, + D3D12_FEATURE_VIDEO_PROCESS_SUPPORT = 5, + D3D12_FEATURE_VIDEO_PROCESS_MAX_INPUT_STREAMS = 6, + D3D12_FEATURE_VIDEO_PROCESS_REFERENCE_INFO = 7, + D3D12_FEATURE_VIDEO_DECODER_HEAP_SIZE = 8, + D3D12_FEATURE_VIDEO_PROCESSOR_SIZE = 9, + D3D12_FEATURE_VIDEO_DECODE_PROFILE_COUNT = 10, + D3D12_FEATURE_VIDEO_DECODE_FORMAT_COUNT = 11, + D3D12_FEATURE_VIDEO_ARCHITECTURE = 17, + D3D12_FEATURE_VIDEO_DECODE_HISTOGRAM = 18 + } D3D12_FEATURE_VIDEO; + +typedef +enum D3D12_BITSTREAM_ENCRYPTION_TYPE + { + D3D12_BITSTREAM_ENCRYPTION_TYPE_NONE = 0 + } D3D12_BITSTREAM_ENCRYPTION_TYPE; + +typedef struct D3D12_VIDEO_DECODE_CONFIGURATION + { + GUID DecodeProfile; + D3D12_BITSTREAM_ENCRYPTION_TYPE BitstreamEncryption; + D3D12_VIDEO_FRAME_CODED_INTERLACE_TYPE InterlaceType; + } D3D12_VIDEO_DECODE_CONFIGURATION; + +typedef struct D3D12_VIDEO_DECODER_DESC + { + UINT NodeMask; + D3D12_VIDEO_DECODE_CONFIGURATION Configuration; + } D3D12_VIDEO_DECODER_DESC; + +typedef struct D3D12_VIDEO_DECODER_HEAP_DESC + { + UINT NodeMask; + D3D12_VIDEO_DECODE_CONFIGURATION Configuration; + UINT DecodeWidth; + UINT DecodeHeight; + DXGI_FORMAT Format; + DXGI_RATIONAL FrameRate; + UINT BitRate; + UINT MaxDecodePictureBufferCount; + } D3D12_VIDEO_DECODER_HEAP_DESC; + +typedef struct D3D12_VIDEO_SIZE_RANGE + { + UINT MaxWidth; + UINT MaxHeight; + UINT MinWidth; + UINT MinHeight; + } D3D12_VIDEO_SIZE_RANGE; + +typedef +enum D3D12_VIDEO_PROCESS_FILTER + { + D3D12_VIDEO_PROCESS_FILTER_BRIGHTNESS = 0, + D3D12_VIDEO_PROCESS_FILTER_CONTRAST = 1, + D3D12_VIDEO_PROCESS_FILTER_HUE = 2, + D3D12_VIDEO_PROCESS_FILTER_SATURATION = 3, + D3D12_VIDEO_PROCESS_FILTER_NOISE_REDUCTION = 4, + D3D12_VIDEO_PROCESS_FILTER_EDGE_ENHANCEMENT = 5, + D3D12_VIDEO_PROCESS_FILTER_ANAMORPHIC_SCALING = 6, + D3D12_VIDEO_PROCESS_FILTER_STEREO_ADJUSTMENT = 7 + } D3D12_VIDEO_PROCESS_FILTER; + +typedef +enum D3D12_VIDEO_PROCESS_FILTER_FLAGS + { + D3D12_VIDEO_PROCESS_FILTER_FLAG_NONE = 0, + D3D12_VIDEO_PROCESS_FILTER_FLAG_BRIGHTNESS = ( 1 << D3D12_VIDEO_PROCESS_FILTER_BRIGHTNESS ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_CONTRAST = ( 1 << D3D12_VIDEO_PROCESS_FILTER_CONTRAST ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_HUE = ( 1 << D3D12_VIDEO_PROCESS_FILTER_HUE ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_SATURATION = ( 1 << D3D12_VIDEO_PROCESS_FILTER_SATURATION ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_NOISE_REDUCTION = ( 1 << D3D12_VIDEO_PROCESS_FILTER_NOISE_REDUCTION ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_EDGE_ENHANCEMENT = ( 1 << D3D12_VIDEO_PROCESS_FILTER_EDGE_ENHANCEMENT ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_ANAMORPHIC_SCALING = ( 1 << D3D12_VIDEO_PROCESS_FILTER_ANAMORPHIC_SCALING ) , + D3D12_VIDEO_PROCESS_FILTER_FLAG_STEREO_ADJUSTMENT = ( 1 << D3D12_VIDEO_PROCESS_FILTER_STEREO_ADJUSTMENT ) + } D3D12_VIDEO_PROCESS_FILTER_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_PROCESS_FILTER_FLAGS ); +typedef +enum D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS + { + D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_NONE = 0, + D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_BOB = 0x1, + D3D12_VIDEO_PROCESS_DEINTERLACE_FLAG_CUSTOM = 0x80000000 + } D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS ); +typedef struct D3D12_VIDEO_PROCESS_ALPHA_BLENDING + { + BOOL Enable; + FLOAT Alpha; + } D3D12_VIDEO_PROCESS_ALPHA_BLENDING; + +typedef struct D3D12_VIDEO_PROCESS_LUMA_KEY + { + BOOL Enable; + FLOAT Lower; + FLOAT Upper; + } D3D12_VIDEO_PROCESS_LUMA_KEY; + +typedef struct D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC + { + DXGI_FORMAT Format; + DXGI_COLOR_SPACE_TYPE ColorSpace; + DXGI_RATIONAL SourceAspectRatio; + DXGI_RATIONAL DestinationAspectRatio; + DXGI_RATIONAL FrameRate; + D3D12_VIDEO_SIZE_RANGE SourceSizeRange; + D3D12_VIDEO_SIZE_RANGE DestinationSizeRange; + BOOL EnableOrientation; + D3D12_VIDEO_PROCESS_FILTER_FLAGS FilterFlags; + D3D12_VIDEO_FRAME_STEREO_FORMAT StereoFormat; + D3D12_VIDEO_FIELD_TYPE FieldType; + D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS DeinterlaceMode; + BOOL EnableAlphaBlending; + D3D12_VIDEO_PROCESS_LUMA_KEY LumaKey; + UINT NumPastFrames; + UINT NumFutureFrames; + BOOL EnableAutoProcessing; + } D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC; + +typedef +enum D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE + { + D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_OPAQUE = 0, + D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_BACKGROUND = 1, + D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_DESTINATION = 2, + D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE_SOURCE_STREAM = 3 + } D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE; + +typedef struct D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC + { + DXGI_FORMAT Format; + DXGI_COLOR_SPACE_TYPE ColorSpace; + D3D12_VIDEO_PROCESS_ALPHA_FILL_MODE AlphaFillMode; + UINT AlphaFillModeSourceStreamIndex; + FLOAT BackgroundColor[ 4 ]; + DXGI_RATIONAL FrameRate; + BOOL EnableStereo; + } D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0000_v0_0_s_ifspec; + +#ifndef __ID3D12VideoDecoderHeap_INTERFACE_DEFINED__ +#define __ID3D12VideoDecoderHeap_INTERFACE_DEFINED__ + +/* interface ID3D12VideoDecoderHeap */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoDecoderHeap; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0946B7C9-EBF6-4047-BB73-8683E27DBB1F") + ID3D12VideoDecoderHeap : public ID3D12Pageable + { + public: + virtual D3D12_VIDEO_DECODER_HEAP_DESC STDMETHODCALLTYPE GetDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoDecoderHeapVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoDecoderHeap * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoDecoderHeap * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoDecoderHeap * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoDecoderHeap * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoDecoderHeap * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoDecoderHeap * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoDecoderHeap * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoDecoderHeap * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_VIDEO_DECODER_HEAP_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12VideoDecoderHeap * This); + + END_INTERFACE + } ID3D12VideoDecoderHeapVtbl; + + interface ID3D12VideoDecoderHeap + { + CONST_VTBL struct ID3D12VideoDecoderHeapVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoDecoderHeap_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoDecoderHeap_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoDecoderHeap_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoDecoderHeap_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoDecoderHeap_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoDecoderHeap_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoDecoderHeap_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoDecoderHeap_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12VideoDecoderHeap_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + + + + + +#endif /* __ID3D12VideoDecoderHeap_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12VideoDevice_INTERFACE_DEFINED__ +#define __ID3D12VideoDevice_INTERFACE_DEFINED__ + +/* interface ID3D12VideoDevice */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoDevice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1F052807-0B46-4ACC-8A89-364F793718A4") + ID3D12VideoDevice : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( + D3D12_FEATURE_VIDEO FeatureVideo, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoDecoder( + _In_ const D3D12_VIDEO_DECODER_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppVideoDecoder) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoDecoderHeap( + _In_ const D3D12_VIDEO_DECODER_HEAP_DESC *pVideoDecoderHeapDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppVideoDecoderHeap) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoProcessor( + UINT NodeMask, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *pOutputStreamDesc, + UINT NumInputStreamDescs, + _In_reads_(NumInputStreamDescs) const D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs, + _In_ REFIID riid, + _COM_Outptr_ void **ppVideoProcessor) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoDeviceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoDevice * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoDevice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoDevice * This); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + ID3D12VideoDevice * This, + D3D12_FEATURE_VIDEO FeatureVideo, + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoDecoder )( + ID3D12VideoDevice * This, + _In_ const D3D12_VIDEO_DECODER_DESC *pDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppVideoDecoder); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoDecoderHeap )( + ID3D12VideoDevice * This, + _In_ const D3D12_VIDEO_DECODER_HEAP_DESC *pVideoDecoderHeapDesc, + _In_ REFIID riid, + _COM_Outptr_ void **ppVideoDecoderHeap); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoProcessor )( + ID3D12VideoDevice * This, + UINT NodeMask, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *pOutputStreamDesc, + UINT NumInputStreamDescs, + _In_reads_(NumInputStreamDescs) const D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs, + _In_ REFIID riid, + _COM_Outptr_ void **ppVideoProcessor); + + END_INTERFACE + } ID3D12VideoDeviceVtbl; + + interface ID3D12VideoDevice + { + CONST_VTBL struct ID3D12VideoDeviceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoDevice_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoDevice_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoDevice_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoDevice_CheckFeatureSupport(This,FeatureVideo,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,FeatureVideo,pFeatureSupportData,FeatureSupportDataSize) ) + +#define ID3D12VideoDevice_CreateVideoDecoder(This,pDesc,riid,ppVideoDecoder) \ + ( (This)->lpVtbl -> CreateVideoDecoder(This,pDesc,riid,ppVideoDecoder) ) + +#define ID3D12VideoDevice_CreateVideoDecoderHeap(This,pVideoDecoderHeapDesc,riid,ppVideoDecoderHeap) \ + ( (This)->lpVtbl -> CreateVideoDecoderHeap(This,pVideoDecoderHeapDesc,riid,ppVideoDecoderHeap) ) + +#define ID3D12VideoDevice_CreateVideoProcessor(This,NodeMask,pOutputStreamDesc,NumInputStreamDescs,pInputStreamDescs,riid,ppVideoProcessor) \ + ( (This)->lpVtbl -> CreateVideoProcessor(This,NodeMask,pOutputStreamDesc,NumInputStreamDescs,pInputStreamDescs,riid,ppVideoProcessor) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoDevice_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12VideoDecoder_INTERFACE_DEFINED__ +#define __ID3D12VideoDecoder_INTERFACE_DEFINED__ + +/* interface ID3D12VideoDecoder */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoDecoder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C59B6BDC-7720-4074-A136-17A156037470") + ID3D12VideoDecoder : public ID3D12Pageable + { + public: + virtual D3D12_VIDEO_DECODER_DESC STDMETHODCALLTYPE GetDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoDecoderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoDecoder * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoDecoder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoDecoder * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoDecoder * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoDecoder * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoDecoder * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoDecoder * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoDecoder * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_VIDEO_DECODER_DESC ( STDMETHODCALLTYPE *GetDesc )( + ID3D12VideoDecoder * This); + + END_INTERFACE + } ID3D12VideoDecoderVtbl; + + interface ID3D12VideoDecoder + { + CONST_VTBL struct ID3D12VideoDecoderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoDecoder_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoDecoder_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoDecoder_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoDecoder_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoDecoder_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoDecoder_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoDecoder_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoDecoder_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12VideoDecoder_GetDesc(This) \ + ( (This)->lpVtbl -> GetDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + + + + + +#endif /* __ID3D12VideoDecoder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12video_0000_0003 */ +/* [local] */ + +typedef +enum D3D12_VIDEO_DECODE_TIER + { + D3D12_VIDEO_DECODE_TIER_NOT_SUPPORTED = 0, + D3D12_VIDEO_DECODE_TIER_1 = 1, + D3D12_VIDEO_DECODE_TIER_2 = 2, + D3D12_VIDEO_DECODE_TIER_3 = 3 + } D3D12_VIDEO_DECODE_TIER; + +typedef +enum D3D12_VIDEO_DECODE_SUPPORT_FLAGS + { + D3D12_VIDEO_DECODE_SUPPORT_FLAG_NONE = 0, + D3D12_VIDEO_DECODE_SUPPORT_FLAG_SUPPORTED = 0x1 + } D3D12_VIDEO_DECODE_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_DECODE_SUPPORT_FLAGS ); +typedef +enum D3D12_VIDEO_DECODE_CONFIGURATION_FLAGS + { + D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_NONE = 0, + D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_HEIGHT_ALIGNMENT_MULTIPLE_32_REQUIRED = 0x1, + D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_POST_PROCESSING_SUPPORTED = 0x2, + D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_REFERENCE_ONLY_ALLOCATIONS_REQUIRED = 0x4, + D3D12_VIDEO_DECODE_CONFIGURATION_FLAG_ALLOW_RESOLUTION_CHANGE_ON_NON_KEY_FRAME = 0x8 + } D3D12_VIDEO_DECODE_CONFIGURATION_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_DECODE_CONFIGURATION_FLAGS ); +typedef +enum D3D12_VIDEO_DECODE_STATUS + { + D3D12_VIDEO_DECODE_STATUS_OK = 0, + D3D12_VIDEO_DECODE_STATUS_CONTINUE = 1, + D3D12_VIDEO_DECODE_STATUS_CONTINUE_SKIP_DISPLAY = 2, + D3D12_VIDEO_DECODE_STATUS_RESTART = 3 + } D3D12_VIDEO_DECODE_STATUS; + +typedef +enum D3D12_VIDEO_DECODE_ARGUMENT_TYPE + { + D3D12_VIDEO_DECODE_ARGUMENT_TYPE_PICTURE_PARAMETERS = 0, + D3D12_VIDEO_DECODE_ARGUMENT_TYPE_INVERSE_QUANTIZATION_MATRIX = 1, + D3D12_VIDEO_DECODE_ARGUMENT_TYPE_SLICE_CONTROL = 2, + D3D12_VIDEO_DECODE_ARGUMENT_TYPE_MAX_VALID = 3 + } D3D12_VIDEO_DECODE_ARGUMENT_TYPE; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_SUPPORT + { + UINT NodeIndex; + D3D12_VIDEO_DECODE_CONFIGURATION Configuration; + UINT Width; + UINT Height; + DXGI_FORMAT DecodeFormat; + DXGI_RATIONAL FrameRate; + UINT BitRate; + D3D12_VIDEO_DECODE_SUPPORT_FLAGS SupportFlags; + D3D12_VIDEO_DECODE_CONFIGURATION_FLAGS ConfigurationFlags; + D3D12_VIDEO_DECODE_TIER DecodeTier; + } D3D12_FEATURE_DATA_VIDEO_DECODE_SUPPORT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_PROFILE_COUNT + { + UINT NodeIndex; + UINT ProfileCount; + } D3D12_FEATURE_DATA_VIDEO_DECODE_PROFILE_COUNT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_PROFILES + { + UINT NodeIndex; + UINT ProfileCount; + _Field_size_full_(ProfileCount) GUID *pProfiles; + } D3D12_FEATURE_DATA_VIDEO_DECODE_PROFILES; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_FORMAT_COUNT + { + UINT NodeIndex; + D3D12_VIDEO_DECODE_CONFIGURATION Configuration; + UINT FormatCount; + } D3D12_FEATURE_DATA_VIDEO_DECODE_FORMAT_COUNT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_FORMATS + { + UINT NodeIndex; + D3D12_VIDEO_DECODE_CONFIGURATION Configuration; + UINT FormatCount; + _Field_size_full_(FormatCount) DXGI_FORMAT *pOutputFormats; + } D3D12_FEATURE_DATA_VIDEO_DECODE_FORMATS; + +typedef struct D3D12_FEATURE_DATA_VIDEO_ARCHITECTURE + { + BOOL IOCoherent; + } D3D12_FEATURE_DATA_VIDEO_ARCHITECTURE; + +typedef +enum D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT + { + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_Y = 0, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_U = 1, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_V = 2, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_R = 0, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_G = 1, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_B = 2, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_A = 3 + } D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT; + +typedef +enum D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS + { + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_NONE = 0, + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_Y = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_Y ) , + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_U = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_U ) , + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_V = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_V ) , + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_R = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_R ) , + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_G = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_G ) , + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_B = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_B ) , + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAG_A = ( 1 << D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_A ) + } D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS ); +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_HISTOGRAM + { + UINT NodeIndex; + GUID DecodeProfile; + UINT Width; + UINT Height; + DXGI_FORMAT DecodeFormat; + D3D12_VIDEO_DECODE_HISTOGRAM_COMPONENT_FLAGS Components; + UINT BinCount; + UINT CounterBitDepth; + } D3D12_FEATURE_DATA_VIDEO_DECODE_HISTOGRAM; + +typedef +enum D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAGS + { + D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAG_NONE = 0, + D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAG_SUPPORTED = 0x1 + } D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAGS ); +typedef +enum D3D12_VIDEO_SCALE_SUPPORT_FLAGS + { + D3D12_VIDEO_SCALE_SUPPORT_FLAG_NONE = 0, + D3D12_VIDEO_SCALE_SUPPORT_FLAG_POW2_ONLY = 0x1, + D3D12_VIDEO_SCALE_SUPPORT_FLAG_EVEN_DIMENSIONS_ONLY = 0x2 + } D3D12_VIDEO_SCALE_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_SCALE_SUPPORT_FLAGS ); +typedef struct D3D12_VIDEO_SCALE_SUPPORT + { + D3D12_VIDEO_SIZE_RANGE OutputSizeRange; + D3D12_VIDEO_SCALE_SUPPORT_FLAGS Flags; + } D3D12_VIDEO_SCALE_SUPPORT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODE_CONVERSION_SUPPORT + { + UINT NodeIndex; + D3D12_VIDEO_DECODE_CONFIGURATION Configuration; + D3D12_VIDEO_SAMPLE DecodeSample; + D3D12_VIDEO_FORMAT OutputFormat; + DXGI_RATIONAL FrameRate; + UINT BitRate; + D3D12_VIDEO_DECODE_CONVERSION_SUPPORT_FLAGS SupportFlags; + D3D12_VIDEO_SCALE_SUPPORT ScaleSupport; + } D3D12_FEATURE_DATA_VIDEO_DECODE_CONVERSION_SUPPORT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE + { + D3D12_VIDEO_DECODER_HEAP_DESC VideoDecoderHeapDesc; + UINT64 MemoryPoolL0Size; + UINT64 MemoryPoolL1Size; + } D3D12_FEATURE_DATA_VIDEO_DECODER_HEAP_SIZE; + +typedef struct D3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE + { + UINT NodeMask; + const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *pOutputStreamDesc; + UINT NumInputStreamDescs; + const D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs; + UINT64 MemoryPoolL0Size; + UINT64 MemoryPoolL1Size; + } D3D12_FEATURE_DATA_VIDEO_PROCESSOR_SIZE; + +typedef struct D3D12_QUERY_DATA_VIDEO_DECODE_STATISTICS + { + UINT64 Status; + UINT64 NumMacroblocksAffected; + DXGI_RATIONAL FrameRate; + UINT BitRate; + } D3D12_QUERY_DATA_VIDEO_DECODE_STATISTICS; + +typedef struct D3D12_VIDEO_DECODE_SUB_SAMPLE_MAPPING_BLOCK + { + UINT ClearSize; + UINT EncryptedSize; + } D3D12_VIDEO_DECODE_SUB_SAMPLE_MAPPING_BLOCK; + +typedef struct D3D12_VIDEO_DECODE_FRAME_ARGUMENT + { + D3D12_VIDEO_DECODE_ARGUMENT_TYPE Type; + UINT Size; + _Field_size_bytes_full_(Size) void *pData; + } D3D12_VIDEO_DECODE_FRAME_ARGUMENT; + +typedef struct D3D12_VIDEO_DECODE_REFERENCE_FRAMES + { + UINT NumTexture2Ds; + _Field_size_full_(NumTexture2Ds) ID3D12Resource **ppTexture2Ds; + _Field_size_full_(NumTexture2Ds) UINT *pSubresources; + _Field_size_full_opt_(NumTexture2Ds) ID3D12VideoDecoderHeap **ppHeaps; + } D3D12_VIDEO_DECODE_REFERENCE_FRAMES; + +typedef struct D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM + { + ID3D12Resource *pBuffer; + UINT64 Offset; + UINT64 Size; + } D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM; + +typedef struct D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS + { + BOOL Enable; + ID3D12Resource *pReferenceTexture2D; + UINT ReferenceSubresource; + DXGI_COLOR_SPACE_TYPE OutputColorSpace; + DXGI_COLOR_SPACE_TYPE DecodeColorSpace; + } D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS; + +typedef struct D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS + { + UINT NumFrameArguments; + D3D12_VIDEO_DECODE_FRAME_ARGUMENT FrameArguments[ 10 ]; + D3D12_VIDEO_DECODE_REFERENCE_FRAMES ReferenceFrames; + D3D12_VIDEO_DECODE_COMPRESSED_BITSTREAM CompressedBitstream; + ID3D12VideoDecoderHeap *pHeap; + } D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS; + +typedef struct D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS + { + ID3D12Resource *pOutputTexture2D; + UINT OutputSubresource; + D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS ConversionArguments; + } D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0003_v0_0_s_ifspec; + +#ifndef __ID3D12VideoProcessor_INTERFACE_DEFINED__ +#define __ID3D12VideoProcessor_INTERFACE_DEFINED__ + +/* interface ID3D12VideoProcessor */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoProcessor; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("304FDB32-BEDE-410A-8545-943AC6A46138") + ID3D12VideoProcessor : public ID3D12Pageable + { + public: + virtual UINT STDMETHODCALLTYPE GetNodeMask( void) = 0; + + virtual UINT STDMETHODCALLTYPE GetNumInputStreamDescs( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputStreamDescs( + UINT NumInputStreamDescs, + _Out_writes_(NumInputStreamDescs) D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs) = 0; + + virtual D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC STDMETHODCALLTYPE GetOutputStreamDesc( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoProcessorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoProcessor * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoProcessor * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoProcessor * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoProcessor * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoProcessor * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoProcessor * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoProcessor * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoProcessor * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + UINT ( STDMETHODCALLTYPE *GetNodeMask )( + ID3D12VideoProcessor * This); + + UINT ( STDMETHODCALLTYPE *GetNumInputStreamDescs )( + ID3D12VideoProcessor * This); + + HRESULT ( STDMETHODCALLTYPE *GetInputStreamDescs )( + ID3D12VideoProcessor * This, + UINT NumInputStreamDescs, + _Out_writes_(NumInputStreamDescs) D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *pInputStreamDescs); + + D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC ( STDMETHODCALLTYPE *GetOutputStreamDesc )( + ID3D12VideoProcessor * This); + + END_INTERFACE + } ID3D12VideoProcessorVtbl; + + interface ID3D12VideoProcessor + { + CONST_VTBL struct ID3D12VideoProcessorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoProcessor_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoProcessor_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoProcessor_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoProcessor_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoProcessor_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoProcessor_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoProcessor_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoProcessor_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + + +#define ID3D12VideoProcessor_GetNodeMask(This) \ + ( (This)->lpVtbl -> GetNodeMask(This) ) + +#define ID3D12VideoProcessor_GetNumInputStreamDescs(This) \ + ( (This)->lpVtbl -> GetNumInputStreamDescs(This) ) + +#define ID3D12VideoProcessor_GetInputStreamDescs(This,NumInputStreamDescs,pInputStreamDescs) \ + ( (This)->lpVtbl -> GetInputStreamDescs(This,NumInputStreamDescs,pInputStreamDescs) ) + +#define ID3D12VideoProcessor_GetOutputStreamDesc(This) \ + ( (This)->lpVtbl -> GetOutputStreamDesc(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + + + + + +#endif /* __ID3D12VideoProcessor_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12video_0000_0004 */ +/* [local] */ + +typedef +enum D3D12_VIDEO_PROCESS_FEATURE_FLAGS + { + D3D12_VIDEO_PROCESS_FEATURE_FLAG_NONE = 0, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_ALPHA_FILL = 0x1, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_LUMA_KEY = 0x2, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_STEREO = 0x4, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_ROTATION = 0x8, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_FLIP = 0x10, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_ALPHA_BLENDING = 0x20, + D3D12_VIDEO_PROCESS_FEATURE_FLAG_PIXEL_ASPECT_RATIO = 0x40 + } D3D12_VIDEO_PROCESS_FEATURE_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_PROCESS_FEATURE_FLAGS ); +typedef +enum D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAGS + { + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_NONE = 0, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_DENOISE = 0x1, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_DERINGING = 0x2, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_EDGE_ENHANCEMENT = 0x4, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_COLOR_CORRECTION = 0x8, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_FLESH_TONE_MAPPING = 0x10, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_IMAGE_STABILIZATION = 0x20, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_SUPER_RESOLUTION = 0x40, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_ANAMORPHIC_SCALING = 0x80, + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAG_CUSTOM = 0x80000000 + } D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAGS ); +typedef +enum D3D12_VIDEO_PROCESS_ORIENTATION + { + D3D12_VIDEO_PROCESS_ORIENTATION_DEFAULT = 0, + D3D12_VIDEO_PROCESS_ORIENTATION_FLIP_HORIZONTAL = 1, + D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_90 = 2, + D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_90_FLIP_HORIZONTAL = 3, + D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_180 = 4, + D3D12_VIDEO_PROCESS_ORIENTATION_FLIP_VERTICAL = 5, + D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_270 = 6, + D3D12_VIDEO_PROCESS_ORIENTATION_CLOCKWISE_270_FLIP_HORIZONTAL = 7 + } D3D12_VIDEO_PROCESS_ORIENTATION; + +typedef +enum D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS + { + D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_NONE = 0, + D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_FRAME_DISCONTINUITY = 0x1, + D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAG_FRAME_REPEAT = 0x2 + } D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS ); +typedef struct D3D12_VIDEO_PROCESS_FILTER_RANGE + { + INT Minimum; + INT Maximum; + INT Default; + FLOAT Multiplier; + } D3D12_VIDEO_PROCESS_FILTER_RANGE; + +typedef +enum D3D12_VIDEO_PROCESS_SUPPORT_FLAGS + { + D3D12_VIDEO_PROCESS_SUPPORT_FLAG_NONE = 0, + D3D12_VIDEO_PROCESS_SUPPORT_FLAG_SUPPORTED = 0x1 + } D3D12_VIDEO_PROCESS_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_PROCESS_SUPPORT_FLAGS ); +typedef struct D3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT + { + UINT NodeIndex; + D3D12_VIDEO_SAMPLE InputSample; + D3D12_VIDEO_FIELD_TYPE InputFieldType; + D3D12_VIDEO_FRAME_STEREO_FORMAT InputStereoFormat; + DXGI_RATIONAL InputFrameRate; + D3D12_VIDEO_FORMAT OutputFormat; + D3D12_VIDEO_FRAME_STEREO_FORMAT OutputStereoFormat; + DXGI_RATIONAL OutputFrameRate; + D3D12_VIDEO_PROCESS_SUPPORT_FLAGS SupportFlags; + D3D12_VIDEO_SCALE_SUPPORT ScaleSupport; + D3D12_VIDEO_PROCESS_FEATURE_FLAGS FeatureSupport; + D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS DeinterlaceSupport; + D3D12_VIDEO_PROCESS_AUTO_PROCESSING_FLAGS AutoProcessingSupport; + D3D12_VIDEO_PROCESS_FILTER_FLAGS FilterSupport; + D3D12_VIDEO_PROCESS_FILTER_RANGE FilterRangeSupport[ 32 ]; + } D3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT; + +typedef struct D3D12_FEATURE_DATA_VIDEO_PROCESS_MAX_INPUT_STREAMS + { + UINT NodeIndex; + UINT MaxInputStreams; + } D3D12_FEATURE_DATA_VIDEO_PROCESS_MAX_INPUT_STREAMS; + +typedef struct D3D12_FEATURE_DATA_VIDEO_PROCESS_REFERENCE_INFO + { + UINT NodeIndex; + D3D12_VIDEO_PROCESS_DEINTERLACE_FLAGS DeinterlaceMode; + D3D12_VIDEO_PROCESS_FILTER_FLAGS Filters; + D3D12_VIDEO_PROCESS_FEATURE_FLAGS FeatureSupport; + DXGI_RATIONAL InputFrameRate; + DXGI_RATIONAL OutputFrameRate; + BOOL EnableAutoProcessing; + UINT PastFrames; + UINT FutureFrames; + } D3D12_FEATURE_DATA_VIDEO_PROCESS_REFERENCE_INFO; + +typedef struct D3D12_VIDEO_PROCESS_REFERENCE_SET + { + UINT NumPastFrames; + ID3D12Resource **ppPastFrames; + UINT *pPastSubresources; + UINT NumFutureFrames; + ID3D12Resource **ppFutureFrames; + UINT *pFutureSubresources; + } D3D12_VIDEO_PROCESS_REFERENCE_SET; + +typedef struct D3D12_VIDEO_PROCESS_TRANSFORM + { + D3D12_RECT SourceRectangle; + D3D12_RECT DestinationRectangle; + D3D12_VIDEO_PROCESS_ORIENTATION Orientation; + } D3D12_VIDEO_PROCESS_TRANSFORM; + +typedef struct D3D12_VIDEO_PROCESS_INPUT_STREAM_RATE + { + UINT OutputIndex; + UINT InputFrameOrField; + } D3D12_VIDEO_PROCESS_INPUT_STREAM_RATE; + +typedef struct D3D12_VIDEO_PROCESS_INPUT_STREAM + { + ID3D12Resource *pTexture2D; + UINT Subresource; + D3D12_VIDEO_PROCESS_REFERENCE_SET ReferenceSet; + } D3D12_VIDEO_PROCESS_INPUT_STREAM; + +typedef struct D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS + { + D3D12_VIDEO_PROCESS_INPUT_STREAM InputStream[ 2 ]; + D3D12_VIDEO_PROCESS_TRANSFORM Transform; + D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS Flags; + D3D12_VIDEO_PROCESS_INPUT_STREAM_RATE RateInfo; + INT FilterLevels[ 32 ]; + D3D12_VIDEO_PROCESS_ALPHA_BLENDING AlphaBlending; + } D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS; + +typedef struct D3D12_VIDEO_PROCESS_OUTPUT_STREAM + { + ID3D12Resource *pTexture2D; + UINT Subresource; + } D3D12_VIDEO_PROCESS_OUTPUT_STREAM; + +typedef struct D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS + { + D3D12_VIDEO_PROCESS_OUTPUT_STREAM OutputStream[ 2 ]; + D3D12_RECT TargetRectangle; + } D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0004_v0_0_s_ifspec; + +#ifndef __ID3D12VideoDecodeCommandList_INTERFACE_DEFINED__ +#define __ID3D12VideoDecodeCommandList_INTERFACE_DEFINED__ + +/* interface ID3D12VideoDecodeCommandList */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoDecodeCommandList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B60536E-AD29-4E64-A269-F853837E5E53") + ID3D12VideoDecodeCommandList : public ID3D12CommandList + { + public: + virtual HRESULT STDMETHODCALLTYPE Close( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( + _In_ ID3D12CommandAllocator *pAllocator) = 0; + + virtual void STDMETHODCALLTYPE ClearState( void) = 0; + + virtual void STDMETHODCALLTYPE ResourceBarrier( + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers) = 0; + + virtual void STDMETHODCALLTYPE DiscardResource( + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion) = 0; + + virtual void STDMETHODCALLTYPE BeginQuery( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index) = 0; + + virtual void STDMETHODCALLTYPE EndQuery( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index) = 0; + + virtual void STDMETHODCALLTYPE ResolveQueryData( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset) = 0; + + virtual void STDMETHODCALLTYPE SetPredication( + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation) = 0; + + virtual void STDMETHODCALLTYPE SetMarker( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE BeginEvent( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE EndEvent( void) = 0; + + virtual void STDMETHODCALLTYPE DecodeFrame( + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments) = 0; + + virtual void STDMETHODCALLTYPE WriteBufferImmediate( + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoDecodeCommandListVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoDecodeCommandList * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoDecodeCommandList * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoDecodeCommandList * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoDecodeCommandList * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoDecodeCommandList * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoDecodeCommandList * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoDecodeCommandList * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoDecodeCommandList * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12VideoDecodeCommandList * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12VideoDecodeCommandList * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12VideoDecodeCommandList * This, + _In_ ID3D12CommandAllocator *pAllocator); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12VideoDecodeCommandList * This); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12VideoDecodeCommandList * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12VideoDecodeCommandList * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12VideoDecodeCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12VideoDecodeCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12VideoDecodeCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12VideoDecodeCommandList * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12VideoDecodeCommandList * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12VideoDecodeCommandList * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12VideoDecodeCommandList * This); + + void ( STDMETHODCALLTYPE *DecodeFrame )( + ID3D12VideoDecodeCommandList * This, + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12VideoDecodeCommandList * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + END_INTERFACE + } ID3D12VideoDecodeCommandListVtbl; + + interface ID3D12VideoDecodeCommandList + { + CONST_VTBL struct ID3D12VideoDecodeCommandListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoDecodeCommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoDecodeCommandList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoDecodeCommandList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoDecodeCommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoDecodeCommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoDecodeCommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoDecodeCommandList_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoDecodeCommandList_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12VideoDecodeCommandList_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12VideoDecodeCommandList_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12VideoDecodeCommandList_Reset(This,pAllocator) \ + ( (This)->lpVtbl -> Reset(This,pAllocator) ) + +#define ID3D12VideoDecodeCommandList_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D12VideoDecodeCommandList_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12VideoDecodeCommandList_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12VideoDecodeCommandList_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoDecodeCommandList_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoDecodeCommandList_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12VideoDecodeCommandList_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12VideoDecodeCommandList_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12VideoDecodeCommandList_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12VideoDecodeCommandList_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12VideoDecodeCommandList_DecodeFrame(This,pDecoder,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> DecodeFrame(This,pDecoder,pOutputArguments,pInputArguments) ) + +#define ID3D12VideoDecodeCommandList_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoDecodeCommandList_INTERFACE_DEFINED__ */ + + +#ifndef __ID3D12VideoProcessCommandList_INTERFACE_DEFINED__ +#define __ID3D12VideoProcessCommandList_INTERFACE_DEFINED__ + +/* interface ID3D12VideoProcessCommandList */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoProcessCommandList; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AEB2543A-167F-4682-ACC8-D159ED4A6209") + ID3D12VideoProcessCommandList : public ID3D12CommandList + { + public: + virtual HRESULT STDMETHODCALLTYPE Close( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( + _In_ ID3D12CommandAllocator *pAllocator) = 0; + + virtual void STDMETHODCALLTYPE ClearState( void) = 0; + + virtual void STDMETHODCALLTYPE ResourceBarrier( + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers) = 0; + + virtual void STDMETHODCALLTYPE DiscardResource( + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion) = 0; + + virtual void STDMETHODCALLTYPE BeginQuery( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index) = 0; + + virtual void STDMETHODCALLTYPE EndQuery( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index) = 0; + + virtual void STDMETHODCALLTYPE ResolveQueryData( + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset) = 0; + + virtual void STDMETHODCALLTYPE SetPredication( + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation) = 0; + + virtual void STDMETHODCALLTYPE SetMarker( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE BeginEvent( + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size) = 0; + + virtual void STDMETHODCALLTYPE EndEvent( void) = 0; + + virtual void STDMETHODCALLTYPE ProcessFrames( + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS *pInputArguments) = 0; + + virtual void STDMETHODCALLTYPE WriteBufferImmediate( + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoProcessCommandListVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoProcessCommandList * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoProcessCommandList * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoProcessCommandList * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoProcessCommandList * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoProcessCommandList * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoProcessCommandList * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoProcessCommandList * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoProcessCommandList * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12VideoProcessCommandList * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12VideoProcessCommandList * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12VideoProcessCommandList * This, + _In_ ID3D12CommandAllocator *pAllocator); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12VideoProcessCommandList * This); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12VideoProcessCommandList * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12VideoProcessCommandList * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12VideoProcessCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12VideoProcessCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12VideoProcessCommandList * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12VideoProcessCommandList * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12VideoProcessCommandList * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12VideoProcessCommandList * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12VideoProcessCommandList * This); + + void ( STDMETHODCALLTYPE *ProcessFrames )( + ID3D12VideoProcessCommandList * This, + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12VideoProcessCommandList * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + END_INTERFACE + } ID3D12VideoProcessCommandListVtbl; + + interface ID3D12VideoProcessCommandList + { + CONST_VTBL struct ID3D12VideoProcessCommandListVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoProcessCommandList_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoProcessCommandList_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoProcessCommandList_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoProcessCommandList_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoProcessCommandList_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoProcessCommandList_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoProcessCommandList_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoProcessCommandList_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12VideoProcessCommandList_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12VideoProcessCommandList_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12VideoProcessCommandList_Reset(This,pAllocator) \ + ( (This)->lpVtbl -> Reset(This,pAllocator) ) + +#define ID3D12VideoProcessCommandList_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D12VideoProcessCommandList_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12VideoProcessCommandList_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12VideoProcessCommandList_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoProcessCommandList_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoProcessCommandList_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12VideoProcessCommandList_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12VideoProcessCommandList_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12VideoProcessCommandList_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12VideoProcessCommandList_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12VideoProcessCommandList_ProcessFrames(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) \ + ( (This)->lpVtbl -> ProcessFrames(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) ) + +#define ID3D12VideoProcessCommandList_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoProcessCommandList_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12video_0000_0006 */ +/* [local] */ + +typedef struct D3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM + { + UINT64 Offset; + ID3D12Resource *pBuffer; + } D3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM; + +typedef struct D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1 + { + BOOL Enable; + ID3D12Resource *pReferenceTexture2D; + UINT ReferenceSubresource; + DXGI_COLOR_SPACE_TYPE OutputColorSpace; + DXGI_COLOR_SPACE_TYPE DecodeColorSpace; + UINT OutputWidth; + UINT OutputHeight; + } D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1; + +typedef struct D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 + { + ID3D12Resource *pOutputTexture2D; + UINT OutputSubresource; + D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS1 ConversionArguments; + D3D12_VIDEO_DECODE_OUTPUT_HISTOGRAM Histograms[ 4 ]; + } D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0006_v0_0_s_ifspec; + +#ifndef __ID3D12VideoDecodeCommandList1_INTERFACE_DEFINED__ +#define __ID3D12VideoDecodeCommandList1_INTERFACE_DEFINED__ + +/* interface ID3D12VideoDecodeCommandList1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoDecodeCommandList1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D52F011B-B56E-453C-A05A-A7F311C8F472") + ID3D12VideoDecodeCommandList1 : public ID3D12VideoDecodeCommandList + { + public: + virtual void STDMETHODCALLTYPE DecodeFrame1( + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoDecodeCommandList1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoDecodeCommandList1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoDecodeCommandList1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoDecodeCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoDecodeCommandList1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoDecodeCommandList1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoDecodeCommandList1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoDecodeCommandList1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoDecodeCommandList1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12VideoDecodeCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12VideoDecodeCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12CommandAllocator *pAllocator); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12VideoDecodeCommandList1 * This); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12VideoDecodeCommandList1 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12VideoDecodeCommandList1 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12VideoDecodeCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12VideoDecodeCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12VideoDecodeCommandList1 * This); + + void ( STDMETHODCALLTYPE *DecodeFrame )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12VideoDecodeCommandList1 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + void ( STDMETHODCALLTYPE *DecodeFrame1 )( + ID3D12VideoDecodeCommandList1 * This, + _In_ ID3D12VideoDecoder *pDecoder, + _In_ const D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS1 *pOutputArguments, + _In_ const D3D12_VIDEO_DECODE_INPUT_STREAM_ARGUMENTS *pInputArguments); + + END_INTERFACE + } ID3D12VideoDecodeCommandList1Vtbl; + + interface ID3D12VideoDecodeCommandList1 + { + CONST_VTBL struct ID3D12VideoDecodeCommandList1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoDecodeCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoDecodeCommandList1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoDecodeCommandList1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoDecodeCommandList1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoDecodeCommandList1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoDecodeCommandList1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoDecodeCommandList1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoDecodeCommandList1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12VideoDecodeCommandList1_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12VideoDecodeCommandList1_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12VideoDecodeCommandList1_Reset(This,pAllocator) \ + ( (This)->lpVtbl -> Reset(This,pAllocator) ) + +#define ID3D12VideoDecodeCommandList1_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D12VideoDecodeCommandList1_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12VideoDecodeCommandList1_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12VideoDecodeCommandList1_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoDecodeCommandList1_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoDecodeCommandList1_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12VideoDecodeCommandList1_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12VideoDecodeCommandList1_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12VideoDecodeCommandList1_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12VideoDecodeCommandList1_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12VideoDecodeCommandList1_DecodeFrame(This,pDecoder,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> DecodeFrame(This,pDecoder,pOutputArguments,pInputArguments) ) + +#define ID3D12VideoDecodeCommandList1_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12VideoDecodeCommandList1_DecodeFrame1(This,pDecoder,pOutputArguments,pInputArguments) \ + ( (This)->lpVtbl -> DecodeFrame1(This,pDecoder,pOutputArguments,pInputArguments) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoDecodeCommandList1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12video_0000_0007 */ +/* [local] */ + +typedef struct D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1 + { + D3D12_VIDEO_PROCESS_INPUT_STREAM InputStream[ 2 ]; + D3D12_VIDEO_PROCESS_TRANSFORM Transform; + D3D12_VIDEO_PROCESS_INPUT_STREAM_FLAGS Flags; + D3D12_VIDEO_PROCESS_INPUT_STREAM_RATE RateInfo; + INT FilterLevels[ 32 ]; + D3D12_VIDEO_PROCESS_ALPHA_BLENDING AlphaBlending; + D3D12_VIDEO_FIELD_TYPE FieldType; + } D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1; + + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0007_v0_0_s_ifspec; + +#ifndef __ID3D12VideoProcessCommandList1_INTERFACE_DEFINED__ +#define __ID3D12VideoProcessCommandList1_INTERFACE_DEFINED__ + +/* interface ID3D12VideoProcessCommandList1 */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3D12VideoProcessCommandList1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("542C5C4D-7596-434F-8C93-4EFA6766F267") + ID3D12VideoProcessCommandList1 : public ID3D12VideoProcessCommandList + { + public: + virtual void STDMETHODCALLTYPE ProcessFrames1( + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1 *pInputArguments) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3D12VideoProcessCommandList1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3D12VideoProcessCommandList1 * This, + REFIID riid, + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3D12VideoProcessCommandList1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3D12VideoProcessCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + ID3D12VideoProcessCommandList1 * This, + _In_ REFGUID guid, + _Inout_ UINT *pDataSize, + _Out_writes_bytes_opt_( *pDataSize ) void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + ID3D12VideoProcessCommandList1 * This, + _In_ REFGUID guid, + _In_ UINT DataSize, + _In_reads_bytes_opt_( DataSize ) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + ID3D12VideoProcessCommandList1 * This, + _In_ REFGUID guid, + _In_opt_ const IUnknown *pData); + + HRESULT ( STDMETHODCALLTYPE *SetName )( + ID3D12VideoProcessCommandList1 * This, + _In_z_ LPCWSTR Name); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + ID3D12VideoProcessCommandList1 * This, + REFIID riid, + _COM_Outptr_opt_ void **ppvDevice); + + D3D12_COMMAND_LIST_TYPE ( STDMETHODCALLTYPE *GetType )( + ID3D12VideoProcessCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ID3D12VideoProcessCommandList1 * This); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12CommandAllocator *pAllocator); + + void ( STDMETHODCALLTYPE *ClearState )( + ID3D12VideoProcessCommandList1 * This); + + void ( STDMETHODCALLTYPE *ResourceBarrier )( + ID3D12VideoProcessCommandList1 * This, + _In_ UINT NumBarriers, + _In_reads_(NumBarriers) const D3D12_RESOURCE_BARRIER *pBarriers); + + void ( STDMETHODCALLTYPE *DiscardResource )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12Resource *pResource, + _In_opt_ const D3D12_DISCARD_REGION *pRegion); + + void ( STDMETHODCALLTYPE *BeginQuery )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *EndQuery )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT Index); + + void ( STDMETHODCALLTYPE *ResolveQueryData )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12QueryHeap *pQueryHeap, + _In_ D3D12_QUERY_TYPE Type, + _In_ UINT StartIndex, + _In_ UINT NumQueries, + _In_ ID3D12Resource *pDestinationBuffer, + _In_ UINT64 AlignedDestinationBufferOffset); + + void ( STDMETHODCALLTYPE *SetPredication )( + ID3D12VideoProcessCommandList1 * This, + _In_opt_ ID3D12Resource *pBuffer, + _In_ UINT64 AlignedBufferOffset, + _In_ D3D12_PREDICATION_OP Operation); + + void ( STDMETHODCALLTYPE *SetMarker )( + ID3D12VideoProcessCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *BeginEvent )( + ID3D12VideoProcessCommandList1 * This, + UINT Metadata, + _In_reads_bytes_opt_(Size) const void *pData, + UINT Size); + + void ( STDMETHODCALLTYPE *EndEvent )( + ID3D12VideoProcessCommandList1 * This); + + void ( STDMETHODCALLTYPE *ProcessFrames )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS *pInputArguments); + + void ( STDMETHODCALLTYPE *WriteBufferImmediate )( + ID3D12VideoProcessCommandList1 * This, + UINT Count, + _In_reads_(Count) const D3D12_WRITEBUFFERIMMEDIATE_PARAMETER *pParams, + _In_reads_opt_(Count) const D3D12_WRITEBUFFERIMMEDIATE_MODE *pModes); + + void ( STDMETHODCALLTYPE *ProcessFrames1 )( + ID3D12VideoProcessCommandList1 * This, + _In_ ID3D12VideoProcessor *pVideoProcessor, + _In_ const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_ARGUMENTS *pOutputArguments, + UINT NumInputStreams, + _In_reads_(NumInputStreams) const D3D12_VIDEO_PROCESS_INPUT_STREAM_ARGUMENTS1 *pInputArguments); + + END_INTERFACE + } ID3D12VideoProcessCommandList1Vtbl; + + interface ID3D12VideoProcessCommandList1 + { + CONST_VTBL struct ID3D12VideoProcessCommandList1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3D12VideoProcessCommandList1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3D12VideoProcessCommandList1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3D12VideoProcessCommandList1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3D12VideoProcessCommandList1_GetPrivateData(This,guid,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,guid,pDataSize,pData) ) + +#define ID3D12VideoProcessCommandList1_SetPrivateData(This,guid,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,guid,DataSize,pData) ) + +#define ID3D12VideoProcessCommandList1_SetPrivateDataInterface(This,guid,pData) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,guid,pData) ) + +#define ID3D12VideoProcessCommandList1_SetName(This,Name) \ + ( (This)->lpVtbl -> SetName(This,Name) ) + + +#define ID3D12VideoProcessCommandList1_GetDevice(This,riid,ppvDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppvDevice) ) + + +#define ID3D12VideoProcessCommandList1_GetType(This) \ + ( (This)->lpVtbl -> GetType(This) ) + + +#define ID3D12VideoProcessCommandList1_Close(This) \ + ( (This)->lpVtbl -> Close(This) ) + +#define ID3D12VideoProcessCommandList1_Reset(This,pAllocator) \ + ( (This)->lpVtbl -> Reset(This,pAllocator) ) + +#define ID3D12VideoProcessCommandList1_ClearState(This) \ + ( (This)->lpVtbl -> ClearState(This) ) + +#define ID3D12VideoProcessCommandList1_ResourceBarrier(This,NumBarriers,pBarriers) \ + ( (This)->lpVtbl -> ResourceBarrier(This,NumBarriers,pBarriers) ) + +#define ID3D12VideoProcessCommandList1_DiscardResource(This,pResource,pRegion) \ + ( (This)->lpVtbl -> DiscardResource(This,pResource,pRegion) ) + +#define ID3D12VideoProcessCommandList1_BeginQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> BeginQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoProcessCommandList1_EndQuery(This,pQueryHeap,Type,Index) \ + ( (This)->lpVtbl -> EndQuery(This,pQueryHeap,Type,Index) ) + +#define ID3D12VideoProcessCommandList1_ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) \ + ( (This)->lpVtbl -> ResolveQueryData(This,pQueryHeap,Type,StartIndex,NumQueries,pDestinationBuffer,AlignedDestinationBufferOffset) ) + +#define ID3D12VideoProcessCommandList1_SetPredication(This,pBuffer,AlignedBufferOffset,Operation) \ + ( (This)->lpVtbl -> SetPredication(This,pBuffer,AlignedBufferOffset,Operation) ) + +#define ID3D12VideoProcessCommandList1_SetMarker(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> SetMarker(This,Metadata,pData,Size) ) + +#define ID3D12VideoProcessCommandList1_BeginEvent(This,Metadata,pData,Size) \ + ( (This)->lpVtbl -> BeginEvent(This,Metadata,pData,Size) ) + +#define ID3D12VideoProcessCommandList1_EndEvent(This) \ + ( (This)->lpVtbl -> EndEvent(This) ) + +#define ID3D12VideoProcessCommandList1_ProcessFrames(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) \ + ( (This)->lpVtbl -> ProcessFrames(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) ) + +#define ID3D12VideoProcessCommandList1_WriteBufferImmediate(This,Count,pParams,pModes) \ + ( (This)->lpVtbl -> WriteBufferImmediate(This,Count,pParams,pModes) ) + + +#define ID3D12VideoProcessCommandList1_ProcessFrames1(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) \ + ( (This)->lpVtbl -> ProcessFrames1(This,pVideoProcessor,pOutputArguments,NumInputStreams,pInputArguments) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3D12VideoProcessCommandList1_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3d12video_0000_0008 */ +/* [local] */ + +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_MPEG2, 0xee27417f, 0x5e28, 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_MPEG1_AND_MPEG2, 0x86695f12, 0x340e, 0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_H264, 0x1b81be68, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_H264_STEREO_PROGRESSIVE, 0xd79be8da, 0x0cf1, 0x4c81, 0xb8, 0x2a, 0x69, 0xa4, 0xe2, 0x36, 0xf4, 0x3d); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_H264_STEREO, 0xf9aaccbb, 0xc2b6, 0x4cfc, 0x87, 0x79, 0x57, 0x07, 0xb1, 0x76, 0x05, 0x52); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_H264_MULTIVIEW, 0x705b9d82, 0x76cf, 0x49d6, 0xb7, 0xe6, 0xac, 0x88, 0x72, 0xdb, 0x01, 0x3c); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_VC1, 0x1b81beA3, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_VC1_D2010, 0x1b81beA4, 0xa0c7, 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_MPEG4PT2_SIMPLE, 0xefd64d74, 0xc9e8,0x41d7,0xa5,0xe9,0xe9,0xb0,0xe3,0x9f,0xa3,0x19); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_MPEG4PT2_ADVSIMPLE_NOGMC, 0xed418a9f, 0x010d, 0x4eda, 0x9a, 0xe3, 0x9a, 0x65, 0x35, 0x8d, 0x8d, 0x2e); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN, 0x5b11d51b, 0x2f4c, 0x4452, 0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN10, 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_VP9, 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_VP9_10BIT_PROFILE2, 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7); +DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_VP8, 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7); +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion +DEFINE_GUID(IID_ID3D12VideoDecoderHeap,0x0946B7C9,0xEBF6,0x4047,0xBB,0x73,0x86,0x83,0xE2,0x7D,0xBB,0x1F); +DEFINE_GUID(IID_ID3D12VideoDevice,0x1F052807,0x0B46,0x4ACC,0x8A,0x89,0x36,0x4F,0x79,0x37,0x18,0xA4); +DEFINE_GUID(IID_ID3D12VideoDecoder,0xC59B6BDC,0x7720,0x4074,0xA1,0x36,0x17,0xA1,0x56,0x03,0x74,0x70); +DEFINE_GUID(IID_ID3D12VideoProcessor,0x304FDB32,0xBEDE,0x410A,0x85,0x45,0x94,0x3A,0xC6,0xA4,0x61,0x38); +DEFINE_GUID(IID_ID3D12VideoDecodeCommandList,0x3B60536E,0xAD29,0x4E64,0xA2,0x69,0xF8,0x53,0x83,0x7E,0x5E,0x53); +DEFINE_GUID(IID_ID3D12VideoProcessCommandList,0xAEB2543A,0x167F,0x4682,0xAC,0xC8,0xD1,0x59,0xED,0x4A,0x62,0x09); +DEFINE_GUID(IID_ID3D12VideoDecodeCommandList1,0xD52F011B,0xB56E,0x453C,0xA0,0x5A,0xA7,0xF3,0x11,0xC8,0xF4,0x72); +DEFINE_GUID(IID_ID3D12VideoProcessCommandList1,0x542C5C4D,0x7596,0x434F,0x8C,0x93,0x4E,0xFA,0x67,0x66,0xF2,0x67); + + +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0008_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3d12video_0000_0008_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d9types.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d9types.h index ef8e9de0093..d16102bdf54 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3d9types.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3d9types.h @@ -10,6 +10,7 @@ #ifndef _d3d9TYPES_H_ #define _d3d9TYPES_H_ + #ifndef DIRECT3D_VERSION #define DIRECT3D_VERSION 0x0900 #endif //DIRECT3D_VERSION @@ -78,6 +79,8 @@ typedef struct _D3DRECT { #define D3DRECT_DEFINED #endif + + #ifndef D3DMATRIX_DEFINED typedef struct _D3DMATRIX { union { @@ -94,6 +97,8 @@ typedef struct _D3DMATRIX { #define D3DMATRIX_DEFINED #endif + + typedef struct _D3DVIEWPORT9 { DWORD X; DWORD Y; /* Viewport Top left */ @@ -1166,6 +1171,24 @@ typedef enum _D3DSHADER_PARAM_SRCMOD_TYPE D3DSPSM_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum } D3DSHADER_PARAM_SRCMOD_TYPE; +// Source or dest token bits [15:14]: +// destination parameter modifiers +#define D3DSP_MIN_PRECISION_SHIFT 14 +#define D3DSP_MIN_PRECISION_MASK 0x0000C000 + +typedef enum _D3DSHADER_MIN_PRECISION +{ + D3DMP_DEFAULT = 0, // Default precision for the shader model + D3DMP_16 = 1, // 16 bit per component + D3DMP_2_8 = 2, // 10 bits (2.8) per component +} D3DSHADER_MIN_PRECISION; +// If the older D3DSPDM_PARTIALPRECISION is set, +// that is equivalent to the whole operation specifying +// D3DMP_16 (on all operands). The two encodings are not +// used together however. + + + // pixel shader version token #define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor)) @@ -1641,6 +1664,7 @@ typedef enum _D3DRESOURCETYPE { + /* CubeMap Face identifiers */ typedef enum _D3DCUBEMAP_FACES { diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h index d864e0cebdb..2766cfb6282 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcommon.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -100,6 +100,13 @@ typedef interface ID3D10Blob ID3D10Blob; #endif /* __ID3D10Blob_FWD_DEFINED__ */ +#ifndef __ID3DDestructionNotifier_FWD_DEFINED__ +#define __ID3DDestructionNotifier_FWD_DEFINED__ +typedef interface ID3DDestructionNotifier ID3DDestructionNotifier; + +#endif /* __ID3DDestructionNotifier_FWD_DEFINED__ */ + + /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" @@ -496,6 +503,119 @@ typedef ID3D10Blob ID3DBlob; typedef ID3DBlob* LPD3DBLOB; #define IID_ID3DBlob IID_ID3D10Blob +typedef void ( __stdcall *PFN_DESTRUCTION_CALLBACK )( + void *pData); + + + +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec; + +#ifndef __ID3DDestructionNotifier_INTERFACE_DEFINED__ +#define __ID3DDestructionNotifier_INTERFACE_DEFINED__ + +/* interface ID3DDestructionNotifier */ +/* [unique][local][object][uuid] */ + + +EXTERN_C const IID IID_ID3DDestructionNotifier; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("a06eb39a-50da-425b-8c31-4eecd6c270f3") + ID3DDestructionNotifier : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE RegisterDestructionCallback( + /* [annotation] */ + _In_ PFN_DESTRUCTION_CALLBACK callbackFn, + /* [annotation] */ + _In_ void *pData, + /* [annotation] */ + _Out_ UINT *pCallbackID) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterDestructionCallback( + /* [annotation] */ + _In_ UINT callbackID) = 0; + + }; + + +#else /* C style interface */ + + typedef struct ID3DDestructionNotifierVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ID3DDestructionNotifier * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ID3DDestructionNotifier * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ID3DDestructionNotifier * This); + + HRESULT ( STDMETHODCALLTYPE *RegisterDestructionCallback )( + ID3DDestructionNotifier * This, + /* [annotation] */ + _In_ PFN_DESTRUCTION_CALLBACK callbackFn, + /* [annotation] */ + _In_ void *pData, + /* [annotation] */ + _Out_ UINT *pCallbackID); + + HRESULT ( STDMETHODCALLTYPE *UnregisterDestructionCallback )( + ID3DDestructionNotifier * This, + /* [annotation] */ + _In_ UINT callbackID); + + END_INTERFACE + } ID3DDestructionNotifierVtbl; + + interface ID3DDestructionNotifier + { + CONST_VTBL struct ID3DDestructionNotifierVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ID3DDestructionNotifier_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ID3DDestructionNotifier_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ID3DDestructionNotifier_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define ID3DDestructionNotifier_RegisterDestructionCallback(This,callbackFn,pData,pCallbackID) \ + ( (This)->lpVtbl -> RegisterDestructionCallback(This,callbackFn,pData,pCallbackID) ) + +#define ID3DDestructionNotifier_UnregisterDestructionCallback(This,callbackID) \ + ( (This)->lpVtbl -> UnregisterDestructionCallback(This,callbackID) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ID3DDestructionNotifier_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_d3dcommon_0000_0002 */ +/* [local] */ + typedef enum _D3D_INCLUDE_TYPE { @@ -920,8 +1040,8 @@ DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x0 #define D3D_COMPONENT_MASK_W 8 -extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0001_v0_0_s_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_d3dcommon_0000_0002_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h index a4ca7913046..881ae755bc1 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dcompiler.h @@ -10,6 +10,7 @@ #ifndef __D3DCOMPILER_H__ #define __D3DCOMPILER_H__ +#include // Current name of the DLL shipped in the same SDK as this header. @@ -40,6 +41,8 @@ extern "C" { #endif //__cplusplus +// BK - pragma region Application Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) //---------------------------------------------------------------------------- // D3DReadFileToBlob: @@ -123,6 +126,16 @@ D3DWriteBlobToFile(_In_ ID3DBlob* pBlob, // D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY // This enables older shaders to compile to 4_0 targets. // +// D3DCOMPILE_DEBUG_NAME_FOR_SOURCE +// This enables a debug name to be generated based on source information. +// It requires D3DCOMPILE_DEBUG to be set, and is exclusive with +// D3DCOMPILE_DEBUG_NAME_FOR_BINARY. +// +// D3DCOMPILE_DEBUG_NAME_FOR_BINARY +// This enables a debug name to be generated based on compiled information. +// It requires D3DCOMPILE_DEBUG to be set, and is exclusive with +// D3DCOMPILE_DEBUG_NAME_FOR_SOURCE. +// //---------------------------------------------------------------------------- #define D3DCOMPILE_DEBUG (1 << 0) @@ -149,6 +162,8 @@ D3DWriteBlobToFile(_In_ ID3DBlob* pBlob, #define D3DCOMPILE_RESOURCES_MAY_ALIAS (1 << 19) #define D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES (1 << 20) #define D3DCOMPILE_ALL_RESOURCES_BOUND (1 << 21) +#define D3DCOMPILE_DEBUG_NAME_FOR_SOURCE (1 << 22) +#define D3DCOMPILE_DEBUG_NAME_FOR_BINARY (1 << 23) //---------------------------------------------------------------------------- // D3DCOMPILE_EFFECT flags: @@ -173,6 +188,14 @@ D3DWriteBlobToFile(_In_ ID3DBlob* pBlob, #define D3DCOMPILE_EFFECT_CHILD_EFFECT (1 << 0) #define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS (1 << 1) +//---------------------------------------------------------------------------- +// D3DCOMPILE Flags2: +// ----------------- +// Root signature flags. (passed in Flags2) +#define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST 0 +#define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 (1 << 4) +#define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 (1 << 5) + //---------------------------------------------------------------------------- // D3DCompile: // ---------- @@ -303,9 +326,9 @@ D3DReflect(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData, HRESULT WINAPI D3DReflectLibrary(__in_bcount(SrcDataSize) LPCVOID pSrcData, - SIZE_T SrcDataSize, - REFIID riid, - LPVOID * ppReflector); + __in SIZE_T SrcDataSize, + __in REFIID riid, + __out LPVOID * ppReflector); //---------------------------------------------------------------------------- // D3DDisassemble: @@ -350,7 +373,7 @@ D3DDisassembleRegion(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData, // Shader linking and Function Linking Graph (FLG) APIs //---------------------------------------------------------------------------- HRESULT WINAPI -D3DCreateLinker(interface ID3D11Linker ** ppLinker); +D3DCreateLinker(__out interface ID3D11Linker ** ppLinker); HRESULT WINAPI D3DLoadModule(_In_ LPCVOID pSrcData, @@ -455,6 +478,7 @@ typedef enum D3D_BLOB_PART D3D_BLOB_PDB, D3D_BLOB_PRIVATE_DATA, D3D_BLOB_ROOT_SIGNATURE, + D3D_BLOB_DEBUG_NAME, // Test parts are only produced by special compiler versions and so // are usually not present in shaders. @@ -532,8 +556,12 @@ D3DDecompressShaders(_In_reads_bytes_(SrcDataSize) LPCVOID pSrcData, _Out_writes_(uNumShaders) ID3DBlob** ppShaders, _Out_opt_ UINT* pTotalShaders); +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion +// BK - pragma region Desktop Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) //---------------------------------------------------------------------------- // D3DDisassemble10Effect: @@ -547,6 +575,8 @@ D3DDisassemble10Effect(_In_ interface ID3D10Effect *pEffect, _In_ UINT Flags, _Out_ ID3DBlob** ppDisassembly); +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ +// BK - pragma endregion #ifdef __cplusplus diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dx12.h b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dx12.h index bc4b6040d6a..36aebf8a614 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/d3dx12.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/d3dx12.h @@ -1349,9 +1349,12 @@ namespace MinGW_Workaround { inline D3D12_RESOURCE_DESC ID3D12ResourceGetDesc(ID3D12Resource* _resource) { - typedef void (STDMETHODCALLTYPE ID3D12Resource::*PFN_GET_GET_DESC)(D3D12_RESOURCE_DESC*); D3D12_RESOURCE_DESC desc; - (_resource->*(PFN_GET_GET_DESC)(&ID3D12Resource::GetDesc))(&desc); + union { + D3D12_RESOURCE_DESC (STDMETHODCALLTYPE ID3D12Resource::*w)(); + void (STDMETHODCALLTYPE ID3D12Resource::*f)(D3D12_RESOURCE_DESC *); + } conversion = { &ID3D12Resource::GetDesc }; + (_resource->*conversion.f)(&desc); return desc; } } diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi.h index 8c75e72b552..62f88aebcd4 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -140,8 +140,8 @@ typedef interface IDXGIDevice1 IDXGIDevice1; /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" +#include "dxgicommon.h" #include "dxgitype.h" -#include "d3dcommon.h" #ifdef __cplusplus extern "C"{ @@ -181,6 +181,8 @@ typedef struct DXGI_MAPPED_RECT } DXGI_MAPPED_RECT; #ifdef __midl +#ifndef LUID_DEFINED +#define LUID_DEFINED 1 typedef struct _LUID { DWORD LowPart; @@ -189,6 +191,7 @@ typedef struct _LUID typedef struct _LUID *PLUID; +#endif #endif typedef struct DXGI_ADAPTER_DESC { @@ -273,7 +276,9 @@ enum DXGI_SWAP_CHAIN_FLAG DXGI_SWAP_CHAIN_FLAG_FOREGROUND_LAYER = 128, DXGI_SWAP_CHAIN_FLAG_FULLSCREEN_VIDEO = 256, DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO = 512, - DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024 + DXGI_SWAP_CHAIN_FLAG_HW_PROTECTED = 1024, + DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING = 2048, + DXGI_SWAP_CHAIN_FLAG_RESTRICTED_TO_ALL_HOLOGRAPHIC_DISPLAYS = 4096 } DXGI_SWAP_CHAIN_FLAG; typedef struct DXGI_SWAP_CHAIN_DESC @@ -319,7 +324,7 @@ EXTERN_C const IID IID_IDXGIObject; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown) = 0; + _In_opt_ const IUnknown *pUnknown) = 0; virtual HRESULT STDMETHODCALLTYPE GetPrivateData( /* [annotation][in] */ @@ -369,7 +374,7 @@ EXTERN_C const IID IID_IDXGIObject; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIObject * This, @@ -488,7 +493,7 @@ EXTERN_C const IID IID_IDXGIDeviceSubObject; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIDeviceSubObject * This, @@ -626,7 +631,7 @@ EXTERN_C const IID IID_IDXGIResource; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIResource * This, @@ -788,7 +793,7 @@ EXTERN_C const IID IID_IDXGIKeyedMutex; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIKeyedMutex * This, @@ -953,7 +958,7 @@ EXTERN_C const IID IID_IDXGISurface; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISurface * This, @@ -1110,7 +1115,7 @@ EXTERN_C const IID IID_IDXGISurface1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISurface1 * This, @@ -1300,7 +1305,7 @@ EXTERN_C const IID IID_IDXGIAdapter; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIAdapter * This, @@ -1506,7 +1511,7 @@ EXTERN_C const IID IID_IDXGIOutput; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIOutput * This, @@ -1684,6 +1689,7 @@ EXTERN_C const IID IID_IDXGIOutput; #define DXGI_PRESENT_STEREO_TEMPORARY_MONO 0x00000020UL #define DXGI_PRESENT_RESTRICT_TO_OUTPUT 0x00000040UL #define DXGI_PRESENT_USE_DURATION 0x00000100UL +#define DXGI_PRESENT_ALLOW_TEARING 0x00000200UL extern RPC_IF_HANDLE __MIDL_itf_dxgi_0000_0008_v0_0_c_ifspec; @@ -1787,7 +1793,7 @@ EXTERN_C const IID IID_IDXGISwapChain; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISwapChain * This, @@ -2039,7 +2045,7 @@ EXTERN_C const IID IID_IDXGIFactory; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIFactory * This, @@ -2237,7 +2243,7 @@ EXTERN_C const IID IID_IDXGIDevice; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIDevice * This, @@ -2444,7 +2450,7 @@ EXTERN_C const IID IID_IDXGIFactory1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIFactory1 * This, @@ -2624,7 +2630,7 @@ EXTERN_C const IID IID_IDXGIAdapter1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIAdapter1 * This, @@ -2781,7 +2787,7 @@ EXTERN_C const IID IID_IDXGIDevice1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIDevice1 * This, diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_2.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_2.h index 6b34f63bb6b..b324a13836f 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_2.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_2.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -113,6 +113,9 @@ extern "C"{ /* interface __MIDL_itf_dxgi1_2_0000_0000 */ /* [local] */ +#include +// BK - pragma region Desktop Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_dxgi1_2_0000_0000_v0_0_c_ifspec; @@ -357,7 +360,7 @@ EXTERN_C const IID IID_IDXGIOutputDuplication; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIOutputDuplication * This, @@ -503,6 +506,10 @@ EXTERN_C const IID IID_IDXGIOutputDuplication; /* interface __MIDL_itf_dxgi1_2_0000_0002 */ /* [local] */ +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ +// BK - pragma endregion +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) typedef enum DXGI_ALPHA_MODE { @@ -575,7 +582,7 @@ EXTERN_C const IID IID_IDXGISurface2; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISurface2 * This, @@ -769,7 +776,7 @@ EXTERN_C const IID IID_IDXGIResource1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIResource1 * This, @@ -984,7 +991,7 @@ EXTERN_C const IID IID_IDXGIDevice2; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIDevice2 * This, @@ -1202,7 +1209,8 @@ typedef struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC typedef struct DXGI_PRESENT_PARAMETERS { UINT DirtyRectsCount; - RECT *pDirtyRects; + /* [annotation] */ + _Field_size_full_opt_(DirtyRectsCount) RECT *pDirtyRects; RECT *pScrollRect; POINT *pScrollOffset; } DXGI_PRESENT_PARAMETERS; @@ -1307,7 +1315,7 @@ EXTERN_C const IID IID_IDXGISwapChain1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISwapChain1 * This, @@ -1692,7 +1700,7 @@ EXTERN_C const IID IID_IDXGIFactory2; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIFactory2 * This, @@ -2041,7 +2049,7 @@ EXTERN_C const IID IID_IDXGIAdapter2; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIAdapter2 * This, @@ -2226,7 +2234,7 @@ EXTERN_C const IID IID_IDXGIOutput1; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIOutput1 * This, @@ -2438,6 +2446,8 @@ EXTERN_C const IID IID_IDXGIOutput1; /* interface __MIDL_itf_dxgi1_2_0000_0009 */ /* [local] */ +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion DEFINE_GUID(IID_IDXGIDisplayControl,0xea9dbf1a,0xc88e,0x4486,0x85,0x4a,0x98,0xaa,0x01,0x38,0xf3,0x0c); DEFINE_GUID(IID_IDXGIOutputDuplication,0x191cfac3,0xa341,0x470d,0xb2,0x6e,0xa8,0x64,0xf4,0x28,0x31,0x9c); DEFINE_GUID(IID_IDXGISurface2,0xaba496dd,0xb617,0x4cb8,0xa8,0x66,0xbc,0x44,0xd7,0xeb,0x1f,0xa2); diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_3.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_3.h index a11f6b65c82..3cedf32a06e 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_3.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_3.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -106,6 +106,9 @@ extern "C"{ /* interface __MIDL_itf_dxgi1_3_0000_0000 */ /* [local] */ +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #define DXGI_CREATE_FACTORY_DEBUG 0x1 HRESULT WINAPI CreateDXGIFactory2(UINT Flags, REFIID riid, _COM_Outptr_ void **ppFactory); HRESULT WINAPI DXGIGetDebugInterface1(UINT Flags, REFIID riid, _COM_Outptr_ void **pDebug); @@ -165,7 +168,7 @@ EXTERN_C const IID IID_IDXGIDevice3; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIDevice3 * This, @@ -427,7 +430,7 @@ EXTERN_C const IID IID_IDXGISwapChain2; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISwapChain2 * This, @@ -789,7 +792,7 @@ EXTERN_C const IID IID_IDXGIOutput2; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIOutput2 * This, @@ -1056,7 +1059,7 @@ EXTERN_C const IID IID_IDXGIFactory3; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIFactory3 * This, @@ -1318,6 +1321,10 @@ EXTERN_C const IID IID_IDXGIFactory3; /* interface __MIDL_itf_dxgi1_3_0000_0004 */ /* [local] */ +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) typedef struct DXGI_DECODE_SWAP_CHAIN_DESC { UINT Flags; @@ -1788,6 +1795,10 @@ enum DXGI_OVERLAY_SUPPORT_FLAG DXGI_OVERLAY_SUPPORT_FLAG_SCALING = 0x2 } DXGI_OVERLAY_SUPPORT_FLAG; +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ +// BK - pragma endregion +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) extern RPC_IF_HANDLE __MIDL_itf_dxgi1_3_0000_0007_v0_0_c_ifspec; @@ -1850,7 +1861,7 @@ EXTERN_C const IID IID_IDXGIOutput3; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIOutput3 * This, @@ -2082,6 +2093,8 @@ EXTERN_C const IID IID_IDXGIOutput3; /* interface __MIDL_itf_dxgi1_3_0000_0008 */ /* [local] */ +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion DEFINE_GUID(IID_IDXGIDevice3,0x6007896c,0x3244,0x4afd,0xbf,0x18,0xa6,0xd3,0xbe,0xda,0x50,0x23); DEFINE_GUID(IID_IDXGISwapChain2,0xa8be2ac4,0x199f,0x4946,0xb3,0x31,0x79,0x59,0x9f,0xb9,0x8d,0xe7); DEFINE_GUID(IID_IDXGIOutput2,0x595e39d1,0x2724,0x4663,0x99,0xb1,0xda,0x96,0x9d,0xe2,0x83,0x64); diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_4.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_4.h index 933d44692f9..f6d151b7cac 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_4.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_4.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ @@ -78,6 +78,9 @@ extern "C"{ /* interface __MIDL_itf_dxgi1_4_0000_0000 */ /* [local] */ +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) typedef enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG { @@ -167,7 +170,7 @@ EXTERN_C const IID IID_IDXGISwapChain3; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGISwapChain3 * This, @@ -596,7 +599,7 @@ EXTERN_C const IID IID_IDXGIOutput4; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIOutput4 * This, @@ -903,7 +906,7 @@ EXTERN_C const IID IID_IDXGIFactory4; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIFactory4 * This, @@ -1293,7 +1296,7 @@ EXTERN_C const IID IID_IDXGIAdapter3; /* [annotation][in] */ _In_ REFGUID Name, /* [annotation][in] */ - _In_ const IUnknown *pUnknown); + _In_opt_ const IUnknown *pUnknown); HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( IDXGIAdapter3 * This, @@ -1467,6 +1470,8 @@ EXTERN_C const IID IID_IDXGIAdapter3; /* interface __MIDL_itf_dxgi1_4_0000_0004 */ /* [local] */ +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion DEFINE_GUID(IID_IDXGISwapChain3,0x94d99bdb,0xf1f8,0x4ab0,0xb2,0x36,0x7d,0xa0,0x17,0x0e,0xda,0xb1); DEFINE_GUID(IID_IDXGIOutput4,0xdc7dca35,0x2196,0x414d,0x9F,0x53,0x61,0x78,0x84,0x03,0x2a,0x60); DEFINE_GUID(IID_IDXGIFactory4,0x1bc6ea02,0xef36,0x464f,0xbf,0x0c,0x21,0xca,0x39,0xe5,0x16,0x8a); diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_5.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_5.h new file mode 100644 index 00000000000..81ab7601695 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_5.h @@ -0,0 +1,1545 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* @@MIDL_FILE_HEADING( ) */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxgi1_5_h__ +#define __dxgi1_5_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDXGIOutput5_FWD_DEFINED__ +#define __IDXGIOutput5_FWD_DEFINED__ +typedef interface IDXGIOutput5 IDXGIOutput5; + +#endif /* __IDXGIOutput5_FWD_DEFINED__ */ + + +#ifndef __IDXGISwapChain4_FWD_DEFINED__ +#define __IDXGISwapChain4_FWD_DEFINED__ +typedef interface IDXGISwapChain4 IDXGISwapChain4; + +#endif /* __IDXGISwapChain4_FWD_DEFINED__ */ + + +#ifndef __IDXGIDevice4_FWD_DEFINED__ +#define __IDXGIDevice4_FWD_DEFINED__ +typedef interface IDXGIDevice4 IDXGIDevice4; + +#endif /* __IDXGIDevice4_FWD_DEFINED__ */ + + +#ifndef __IDXGIFactory5_FWD_DEFINED__ +#define __IDXGIFactory5_FWD_DEFINED__ +typedef interface IDXGIFactory5 IDXGIFactory5; + +#endif /* __IDXGIFactory5_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "dxgi1_4.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_dxgi1_5_0000_0000 */ +/* [local] */ + +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +typedef +enum DXGI_OUTDUPL_FLAG + { + DXGI_OUTDUPL_COMPOSITED_UI_CAPTURE_ONLY = 1 + } DXGI_OUTDUPL_FLAG; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0000_v0_0_s_ifspec; + +#ifndef __IDXGIOutput5_INTERFACE_DEFINED__ +#define __IDXGIOutput5_INTERFACE_DEFINED__ + +/* interface IDXGIOutput5 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIOutput5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("80A07424-AB52-42EB-833C-0C42FD282D98") + IDXGIOutput5 : public IDXGIOutput4 + { + public: + virtual HRESULT STDMETHODCALLTYPE DuplicateOutput1( + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [in] */ UINT Flags, + /* [annotation][in] */ + _In_ UINT SupportedFormatsCount, + /* [annotation][in] */ + _In_reads_(SupportedFormatsCount) const DXGI_FORMAT *pSupportedFormats, + /* [annotation][out] */ + _COM_Outptr_ IDXGIOutputDuplication **ppOutputDuplication) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIOutput5Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIOutput5 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIOutput5 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIOutput5 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIOutput5 * This, + /* [annotation][out] */ + _Out_ DXGI_OUTPUT_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList )( + IDXGIOutput5 * This, + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [annotation][out][in] */ + _Inout_ UINT *pNumModes, + /* [annotation][out] */ + _Out_writes_to_opt_(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ const DXGI_MODE_DESC *pModeToMatch, + /* [annotation][out] */ + _Out_ DXGI_MODE_DESC *pClosestMatch, + /* [annotation][in] */ + _In_opt_ IUnknown *pConcernedDevice); + + HRESULT ( STDMETHODCALLTYPE *WaitForVBlank )( + IDXGIOutput5 * This); + + HRESULT ( STDMETHODCALLTYPE *TakeOwnership )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + BOOL Exclusive); + + void ( STDMETHODCALLTYPE *ReleaseOwnership )( + IDXGIOutput5 * This); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControlCapabilities )( + IDXGIOutput5 * This, + /* [annotation][out] */ + _Out_ DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps); + + HRESULT ( STDMETHODCALLTYPE *SetGammaControl )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ const DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControl )( + IDXGIOutput5 * This, + /* [annotation][out] */ + _Out_ DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *SetDisplaySurface )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ IDXGISurface *pScanoutSurface); + + HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ IDXGISurface *pDestination); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGIOutput5 * This, + /* [annotation][out] */ + _Out_ DXGI_FRAME_STATISTICS *pStats); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList1 )( + IDXGIOutput5 * This, + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [annotation][out][in] */ + _Inout_ UINT *pNumModes, + /* [annotation][out] */ + _Out_writes_to_opt_(*pNumModes,*pNumModes) DXGI_MODE_DESC1 *pDesc); + + HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode1 )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ const DXGI_MODE_DESC1 *pModeToMatch, + /* [annotation][out] */ + _Out_ DXGI_MODE_DESC1 *pClosestMatch, + /* [annotation][in] */ + _In_opt_ IUnknown *pConcernedDevice); + + HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData1 )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ IDXGIResource *pDestination); + + HRESULT ( STDMETHODCALLTYPE *DuplicateOutput )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][out] */ + _COM_Outptr_ IDXGIOutputDuplication **ppOutputDuplication); + + BOOL ( STDMETHODCALLTYPE *SupportsOverlays )( + IDXGIOutput5 * This); + + HRESULT ( STDMETHODCALLTYPE *CheckOverlaySupport )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ DXGI_FORMAT EnumFormat, + /* [annotation][out] */ + _In_ IUnknown *pConcernedDevice, + /* [annotation][out] */ + _Out_ UINT *pFlags); + + HRESULT ( STDMETHODCALLTYPE *CheckOverlayColorSpaceSupport )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ DXGI_FORMAT Format, + /* [annotation][in] */ + _In_ DXGI_COLOR_SPACE_TYPE ColorSpace, + /* [annotation][in] */ + _In_ IUnknown *pConcernedDevice, + /* [annotation][out] */ + _Out_ UINT *pFlags); + + HRESULT ( STDMETHODCALLTYPE *DuplicateOutput1 )( + IDXGIOutput5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [in] */ UINT Flags, + /* [annotation][in] */ + _In_ UINT SupportedFormatsCount, + /* [annotation][in] */ + _In_reads_(SupportedFormatsCount) const DXGI_FORMAT *pSupportedFormats, + /* [annotation][out] */ + _COM_Outptr_ IDXGIOutputDuplication **ppOutputDuplication); + + END_INTERFACE + } IDXGIOutput5Vtbl; + + interface IDXGIOutput5 + { + CONST_VTBL struct IDXGIOutput5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIOutput5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIOutput5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIOutput5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIOutput5_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIOutput5_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIOutput5_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIOutput5_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIOutput5_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIOutput5_GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) \ + ( (This)->lpVtbl -> GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) ) + +#define IDXGIOutput5_FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) \ + ( (This)->lpVtbl -> FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) ) + +#define IDXGIOutput5_WaitForVBlank(This) \ + ( (This)->lpVtbl -> WaitForVBlank(This) ) + +#define IDXGIOutput5_TakeOwnership(This,pDevice,Exclusive) \ + ( (This)->lpVtbl -> TakeOwnership(This,pDevice,Exclusive) ) + +#define IDXGIOutput5_ReleaseOwnership(This) \ + ( (This)->lpVtbl -> ReleaseOwnership(This) ) + +#define IDXGIOutput5_GetGammaControlCapabilities(This,pGammaCaps) \ + ( (This)->lpVtbl -> GetGammaControlCapabilities(This,pGammaCaps) ) + +#define IDXGIOutput5_SetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> SetGammaControl(This,pArray) ) + +#define IDXGIOutput5_GetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> GetGammaControl(This,pArray) ) + +#define IDXGIOutput5_SetDisplaySurface(This,pScanoutSurface) \ + ( (This)->lpVtbl -> SetDisplaySurface(This,pScanoutSurface) ) + +#define IDXGIOutput5_GetDisplaySurfaceData(This,pDestination) \ + ( (This)->lpVtbl -> GetDisplaySurfaceData(This,pDestination) ) + +#define IDXGIOutput5_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + + +#define IDXGIOutput5_GetDisplayModeList1(This,EnumFormat,Flags,pNumModes,pDesc) \ + ( (This)->lpVtbl -> GetDisplayModeList1(This,EnumFormat,Flags,pNumModes,pDesc) ) + +#define IDXGIOutput5_FindClosestMatchingMode1(This,pModeToMatch,pClosestMatch,pConcernedDevice) \ + ( (This)->lpVtbl -> FindClosestMatchingMode1(This,pModeToMatch,pClosestMatch,pConcernedDevice) ) + +#define IDXGIOutput5_GetDisplaySurfaceData1(This,pDestination) \ + ( (This)->lpVtbl -> GetDisplaySurfaceData1(This,pDestination) ) + +#define IDXGIOutput5_DuplicateOutput(This,pDevice,ppOutputDuplication) \ + ( (This)->lpVtbl -> DuplicateOutput(This,pDevice,ppOutputDuplication) ) + + +#define IDXGIOutput5_SupportsOverlays(This) \ + ( (This)->lpVtbl -> SupportsOverlays(This) ) + + +#define IDXGIOutput5_CheckOverlaySupport(This,EnumFormat,pConcernedDevice,pFlags) \ + ( (This)->lpVtbl -> CheckOverlaySupport(This,EnumFormat,pConcernedDevice,pFlags) ) + + +#define IDXGIOutput5_CheckOverlayColorSpaceSupport(This,Format,ColorSpace,pConcernedDevice,pFlags) \ + ( (This)->lpVtbl -> CheckOverlayColorSpaceSupport(This,Format,ColorSpace,pConcernedDevice,pFlags) ) + + +#define IDXGIOutput5_DuplicateOutput1(This,pDevice,Flags,SupportedFormatsCount,pSupportedFormats,ppOutputDuplication) \ + ( (This)->lpVtbl -> DuplicateOutput1(This,pDevice,Flags,SupportedFormatsCount,pSupportedFormats,ppOutputDuplication) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIOutput5_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_5_0000_0001 */ +/* [local] */ + +typedef +enum DXGI_HDR_METADATA_TYPE + { + DXGI_HDR_METADATA_TYPE_NONE = 0, + DXGI_HDR_METADATA_TYPE_HDR10 = 1, + DXGI_HDR_METADATA_TYPE_HDR10PLUS = 2 + } DXGI_HDR_METADATA_TYPE; + +typedef struct DXGI_HDR_METADATA_HDR10 + { + UINT16 RedPrimary[ 2 ]; + UINT16 GreenPrimary[ 2 ]; + UINT16 BluePrimary[ 2 ]; + UINT16 WhitePoint[ 2 ]; + UINT MaxMasteringLuminance; + UINT MinMasteringLuminance; + UINT16 MaxContentLightLevel; + UINT16 MaxFrameAverageLightLevel; + } DXGI_HDR_METADATA_HDR10; + +typedef struct DXGI_HDR_METADATA_HDR10PLUS + { + BYTE Data[ 72 ]; + } DXGI_HDR_METADATA_HDR10PLUS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0001_v0_0_s_ifspec; + +#ifndef __IDXGISwapChain4_INTERFACE_DEFINED__ +#define __IDXGISwapChain4_INTERFACE_DEFINED__ + +/* interface IDXGISwapChain4 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGISwapChain4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3D585D5A-BD4A-489E-B1F4-3DBCB6452FFB") + IDXGISwapChain4 : public IDXGISwapChain3 + { + public: + virtual HRESULT STDMETHODCALLTYPE SetHDRMetaData( + /* [annotation][in] */ + _In_ DXGI_HDR_METADATA_TYPE Type, + /* [annotation][in] */ + _In_ UINT Size, + /* [annotation][size_is][in] */ + _In_reads_opt_(Size) void *pMetaData) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGISwapChain4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGISwapChain4 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGISwapChain4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGISwapChain4 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDevice )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppDevice); + + HRESULT ( STDMETHODCALLTYPE *Present )( + IDXGISwapChain4 * This, + /* [in] */ UINT SyncInterval, + /* [in] */ UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetBuffer )( + IDXGISwapChain4 * This, + /* [in] */ UINT Buffer, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][out][in] */ + _COM_Outptr_ void **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *SetFullscreenState )( + IDXGISwapChain4 * This, + /* [in] */ BOOL Fullscreen, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pTarget); + + HRESULT ( STDMETHODCALLTYPE *GetFullscreenState )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_opt_ BOOL *pFullscreen, + /* [annotation][out] */ + _COM_Outptr_opt_result_maybenull_ IDXGIOutput **ppTarget); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_SWAP_CHAIN_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *ResizeBuffers )( + IDXGISwapChain4 * This, + /* [in] */ UINT BufferCount, + /* [in] */ UINT Width, + /* [in] */ UINT Height, + /* [in] */ DXGI_FORMAT NewFormat, + /* [in] */ UINT SwapChainFlags); + + HRESULT ( STDMETHODCALLTYPE *ResizeTarget )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ const DXGI_MODE_DESC *pNewTargetParameters); + + HRESULT ( STDMETHODCALLTYPE *GetContainingOutput )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _COM_Outptr_ IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_FRAME_STATISTICS *pStats); + + HRESULT ( STDMETHODCALLTYPE *GetLastPresentCount )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ UINT *pLastPresentCount); + + HRESULT ( STDMETHODCALLTYPE *GetDesc1 )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_SWAP_CHAIN_DESC1 *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetFullscreenDesc )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetHwnd )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ HWND *pHwnd); + + HRESULT ( STDMETHODCALLTYPE *GetCoreWindow )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ REFIID refiid, + /* [annotation][out] */ + _COM_Outptr_ void **ppUnk); + + HRESULT ( STDMETHODCALLTYPE *Present1 )( + IDXGISwapChain4 * This, + /* [in] */ UINT SyncInterval, + /* [in] */ UINT PresentFlags, + /* [annotation][in] */ + _In_ const DXGI_PRESENT_PARAMETERS *pPresentParameters); + + BOOL ( STDMETHODCALLTYPE *IsTemporaryMonoSupported )( + IDXGISwapChain4 * This); + + HRESULT ( STDMETHODCALLTYPE *GetRestrictToOutput )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ IDXGIOutput **ppRestrictToOutput); + + HRESULT ( STDMETHODCALLTYPE *SetBackgroundColor )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ const DXGI_RGBA *pColor); + + HRESULT ( STDMETHODCALLTYPE *GetBackgroundColor )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_RGBA *pColor); + + HRESULT ( STDMETHODCALLTYPE *SetRotation )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ DXGI_MODE_ROTATION Rotation); + + HRESULT ( STDMETHODCALLTYPE *GetRotation )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_MODE_ROTATION *pRotation); + + HRESULT ( STDMETHODCALLTYPE *SetSourceSize )( + IDXGISwapChain4 * This, + UINT Width, + UINT Height); + + HRESULT ( STDMETHODCALLTYPE *GetSourceSize )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ UINT *pWidth, + /* [annotation][out] */ + _Out_ UINT *pHeight); + + HRESULT ( STDMETHODCALLTYPE *SetMaximumFrameLatency )( + IDXGISwapChain4 * This, + UINT MaxLatency); + + HRESULT ( STDMETHODCALLTYPE *GetMaximumFrameLatency )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ UINT *pMaxLatency); + + HANDLE ( STDMETHODCALLTYPE *GetFrameLatencyWaitableObject )( + IDXGISwapChain4 * This); + + HRESULT ( STDMETHODCALLTYPE *SetMatrixTransform )( + IDXGISwapChain4 * This, + const DXGI_MATRIX_3X2_F *pMatrix); + + HRESULT ( STDMETHODCALLTYPE *GetMatrixTransform )( + IDXGISwapChain4 * This, + /* [annotation][out] */ + _Out_ DXGI_MATRIX_3X2_F *pMatrix); + + UINT ( STDMETHODCALLTYPE *GetCurrentBackBufferIndex )( + IDXGISwapChain4 * This); + + HRESULT ( STDMETHODCALLTYPE *CheckColorSpaceSupport )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ DXGI_COLOR_SPACE_TYPE ColorSpace, + /* [annotation][out] */ + _Out_ UINT *pColorSpaceSupport); + + HRESULT ( STDMETHODCALLTYPE *SetColorSpace1 )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ DXGI_COLOR_SPACE_TYPE ColorSpace); + + HRESULT ( STDMETHODCALLTYPE *ResizeBuffers1 )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ UINT BufferCount, + /* [annotation][in] */ + _In_ UINT Width, + /* [annotation][in] */ + _In_ UINT Height, + /* [annotation][in] */ + _In_ DXGI_FORMAT Format, + /* [annotation][in] */ + _In_ UINT SwapChainFlags, + /* [annotation][in] */ + _In_reads_(BufferCount) const UINT *pCreationNodeMask, + /* [annotation][in] */ + _In_reads_(BufferCount) IUnknown *const *ppPresentQueue); + + HRESULT ( STDMETHODCALLTYPE *SetHDRMetaData )( + IDXGISwapChain4 * This, + /* [annotation][in] */ + _In_ DXGI_HDR_METADATA_TYPE Type, + /* [annotation][in] */ + _In_ UINT Size, + /* [annotation][size_is][in] */ + _In_reads_opt_(Size) void *pMetaData); + + END_INTERFACE + } IDXGISwapChain4Vtbl; + + interface IDXGISwapChain4 + { + CONST_VTBL struct IDXGISwapChain4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGISwapChain4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGISwapChain4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGISwapChain4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGISwapChain4_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGISwapChain4_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGISwapChain4_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGISwapChain4_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGISwapChain4_GetDevice(This,riid,ppDevice) \ + ( (This)->lpVtbl -> GetDevice(This,riid,ppDevice) ) + + +#define IDXGISwapChain4_Present(This,SyncInterval,Flags) \ + ( (This)->lpVtbl -> Present(This,SyncInterval,Flags) ) + +#define IDXGISwapChain4_GetBuffer(This,Buffer,riid,ppSurface) \ + ( (This)->lpVtbl -> GetBuffer(This,Buffer,riid,ppSurface) ) + +#define IDXGISwapChain4_SetFullscreenState(This,Fullscreen,pTarget) \ + ( (This)->lpVtbl -> SetFullscreenState(This,Fullscreen,pTarget) ) + +#define IDXGISwapChain4_GetFullscreenState(This,pFullscreen,ppTarget) \ + ( (This)->lpVtbl -> GetFullscreenState(This,pFullscreen,ppTarget) ) + +#define IDXGISwapChain4_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGISwapChain4_ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) \ + ( (This)->lpVtbl -> ResizeBuffers(This,BufferCount,Width,Height,NewFormat,SwapChainFlags) ) + +#define IDXGISwapChain4_ResizeTarget(This,pNewTargetParameters) \ + ( (This)->lpVtbl -> ResizeTarget(This,pNewTargetParameters) ) + +#define IDXGISwapChain4_GetContainingOutput(This,ppOutput) \ + ( (This)->lpVtbl -> GetContainingOutput(This,ppOutput) ) + +#define IDXGISwapChain4_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + +#define IDXGISwapChain4_GetLastPresentCount(This,pLastPresentCount) \ + ( (This)->lpVtbl -> GetLastPresentCount(This,pLastPresentCount) ) + + +#define IDXGISwapChain4_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#define IDXGISwapChain4_GetFullscreenDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetFullscreenDesc(This,pDesc) ) + +#define IDXGISwapChain4_GetHwnd(This,pHwnd) \ + ( (This)->lpVtbl -> GetHwnd(This,pHwnd) ) + +#define IDXGISwapChain4_GetCoreWindow(This,refiid,ppUnk) \ + ( (This)->lpVtbl -> GetCoreWindow(This,refiid,ppUnk) ) + +#define IDXGISwapChain4_Present1(This,SyncInterval,PresentFlags,pPresentParameters) \ + ( (This)->lpVtbl -> Present1(This,SyncInterval,PresentFlags,pPresentParameters) ) + +#define IDXGISwapChain4_IsTemporaryMonoSupported(This) \ + ( (This)->lpVtbl -> IsTemporaryMonoSupported(This) ) + +#define IDXGISwapChain4_GetRestrictToOutput(This,ppRestrictToOutput) \ + ( (This)->lpVtbl -> GetRestrictToOutput(This,ppRestrictToOutput) ) + +#define IDXGISwapChain4_SetBackgroundColor(This,pColor) \ + ( (This)->lpVtbl -> SetBackgroundColor(This,pColor) ) + +#define IDXGISwapChain4_GetBackgroundColor(This,pColor) \ + ( (This)->lpVtbl -> GetBackgroundColor(This,pColor) ) + +#define IDXGISwapChain4_SetRotation(This,Rotation) \ + ( (This)->lpVtbl -> SetRotation(This,Rotation) ) + +#define IDXGISwapChain4_GetRotation(This,pRotation) \ + ( (This)->lpVtbl -> GetRotation(This,pRotation) ) + + +#define IDXGISwapChain4_SetSourceSize(This,Width,Height) \ + ( (This)->lpVtbl -> SetSourceSize(This,Width,Height) ) + +#define IDXGISwapChain4_GetSourceSize(This,pWidth,pHeight) \ + ( (This)->lpVtbl -> GetSourceSize(This,pWidth,pHeight) ) + +#define IDXGISwapChain4_SetMaximumFrameLatency(This,MaxLatency) \ + ( (This)->lpVtbl -> SetMaximumFrameLatency(This,MaxLatency) ) + +#define IDXGISwapChain4_GetMaximumFrameLatency(This,pMaxLatency) \ + ( (This)->lpVtbl -> GetMaximumFrameLatency(This,pMaxLatency) ) + +#define IDXGISwapChain4_GetFrameLatencyWaitableObject(This) \ + ( (This)->lpVtbl -> GetFrameLatencyWaitableObject(This) ) + +#define IDXGISwapChain4_SetMatrixTransform(This,pMatrix) \ + ( (This)->lpVtbl -> SetMatrixTransform(This,pMatrix) ) + +#define IDXGISwapChain4_GetMatrixTransform(This,pMatrix) \ + ( (This)->lpVtbl -> GetMatrixTransform(This,pMatrix) ) + + +#define IDXGISwapChain4_GetCurrentBackBufferIndex(This) \ + ( (This)->lpVtbl -> GetCurrentBackBufferIndex(This) ) + +#define IDXGISwapChain4_CheckColorSpaceSupport(This,ColorSpace,pColorSpaceSupport) \ + ( (This)->lpVtbl -> CheckColorSpaceSupport(This,ColorSpace,pColorSpaceSupport) ) + +#define IDXGISwapChain4_SetColorSpace1(This,ColorSpace) \ + ( (This)->lpVtbl -> SetColorSpace1(This,ColorSpace) ) + +#define IDXGISwapChain4_ResizeBuffers1(This,BufferCount,Width,Height,Format,SwapChainFlags,pCreationNodeMask,ppPresentQueue) \ + ( (This)->lpVtbl -> ResizeBuffers1(This,BufferCount,Width,Height,Format,SwapChainFlags,pCreationNodeMask,ppPresentQueue) ) + + +#define IDXGISwapChain4_SetHDRMetaData(This,Type,Size,pMetaData) \ + ( (This)->lpVtbl -> SetHDRMetaData(This,Type,Size,pMetaData) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGISwapChain4_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_5_0000_0002 */ +/* [local] */ + +typedef +enum _DXGI_OFFER_RESOURCE_FLAGS + { + DXGI_OFFER_RESOURCE_FLAG_ALLOW_DECOMMIT = 0x1 + } DXGI_OFFER_RESOURCE_FLAGS; + +typedef +enum _DXGI_RECLAIM_RESOURCE_RESULTS + { + DXGI_RECLAIM_RESOURCE_RESULT_OK = 0, + DXGI_RECLAIM_RESOURCE_RESULT_DISCARDED = 1, + DXGI_RECLAIM_RESOURCE_RESULT_NOT_COMMITTED = 2 + } DXGI_RECLAIM_RESOURCE_RESULTS; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0002_v0_0_s_ifspec; + +#ifndef __IDXGIDevice4_INTERFACE_DEFINED__ +#define __IDXGIDevice4_INTERFACE_DEFINED__ + +/* interface IDXGIDevice4 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIDevice4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("95B4F95F-D8DA-4CA4-9EE6-3B76D5968A10") + IDXGIDevice4 : public IDXGIDevice3 + { + public: + virtual HRESULT STDMETHODCALLTYPE OfferResources1( + /* [annotation][in] */ + _In_ UINT NumResources, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IDXGIResource *const *ppResources, + /* [annotation][in] */ + _In_ DXGI_OFFER_RESOURCE_PRIORITY Priority, + /* [annotation][in] */ + _In_ UINT Flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReclaimResources1( + /* [annotation][in] */ + _In_ UINT NumResources, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IDXGIResource *const *ppResources, + /* [annotation][size_is][out] */ + _Out_writes_all_(NumResources) DXGI_RECLAIM_RESOURCE_RESULTS *pResults) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIDevice4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIDevice4 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIDevice4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIDevice4 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetAdapter )( + IDXGIDevice4 * This, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **pAdapter); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ const DXGI_SURFACE_DESC *pDesc, + /* [in] */ UINT NumSurfaces, + /* [in] */ DXGI_USAGE Usage, + /* [annotation][in] */ + _In_opt_ const DXGI_SHARED_RESOURCE *pSharedResource, + /* [annotation][out] */ + _COM_Outptr_ IDXGISurface **ppSurface); + + HRESULT ( STDMETHODCALLTYPE *QueryResourceResidency )( + IDXGIDevice4 * This, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IUnknown *const *ppResources, + /* [annotation][size_is][out] */ + _Out_writes_(NumResources) DXGI_RESIDENCY *pResidencyStatus, + /* [in] */ UINT NumResources); + + HRESULT ( STDMETHODCALLTYPE *SetGPUThreadPriority )( + IDXGIDevice4 * This, + /* [in] */ INT Priority); + + HRESULT ( STDMETHODCALLTYPE *GetGPUThreadPriority )( + IDXGIDevice4 * This, + /* [annotation][retval][out] */ + _Out_ INT *pPriority); + + HRESULT ( STDMETHODCALLTYPE *SetMaximumFrameLatency )( + IDXGIDevice4 * This, + /* [in] */ UINT MaxLatency); + + HRESULT ( STDMETHODCALLTYPE *GetMaximumFrameLatency )( + IDXGIDevice4 * This, + /* [annotation][out] */ + _Out_ UINT *pMaxLatency); + + HRESULT ( STDMETHODCALLTYPE *OfferResources )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ UINT NumResources, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IDXGIResource *const *ppResources, + /* [annotation][in] */ + _In_ DXGI_OFFER_RESOURCE_PRIORITY Priority); + + HRESULT ( STDMETHODCALLTYPE *ReclaimResources )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ UINT NumResources, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IDXGIResource *const *ppResources, + /* [annotation][size_is][out] */ + _Out_writes_all_opt_(NumResources) BOOL *pDiscarded); + + HRESULT ( STDMETHODCALLTYPE *EnqueueSetEvent )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent); + + void ( STDMETHODCALLTYPE *Trim )( + IDXGIDevice4 * This); + + HRESULT ( STDMETHODCALLTYPE *OfferResources1 )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ UINT NumResources, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IDXGIResource *const *ppResources, + /* [annotation][in] */ + _In_ DXGI_OFFER_RESOURCE_PRIORITY Priority, + /* [annotation][in] */ + _In_ UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *ReclaimResources1 )( + IDXGIDevice4 * This, + /* [annotation][in] */ + _In_ UINT NumResources, + /* [annotation][size_is][in] */ + _In_reads_(NumResources) IDXGIResource *const *ppResources, + /* [annotation][size_is][out] */ + _Out_writes_all_(NumResources) DXGI_RECLAIM_RESOURCE_RESULTS *pResults); + + END_INTERFACE + } IDXGIDevice4Vtbl; + + interface IDXGIDevice4 + { + CONST_VTBL struct IDXGIDevice4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIDevice4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIDevice4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIDevice4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIDevice4_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIDevice4_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIDevice4_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIDevice4_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIDevice4_GetAdapter(This,pAdapter) \ + ( (This)->lpVtbl -> GetAdapter(This,pAdapter) ) + +#define IDXGIDevice4_CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) \ + ( (This)->lpVtbl -> CreateSurface(This,pDesc,NumSurfaces,Usage,pSharedResource,ppSurface) ) + +#define IDXGIDevice4_QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) \ + ( (This)->lpVtbl -> QueryResourceResidency(This,ppResources,pResidencyStatus,NumResources) ) + +#define IDXGIDevice4_SetGPUThreadPriority(This,Priority) \ + ( (This)->lpVtbl -> SetGPUThreadPriority(This,Priority) ) + +#define IDXGIDevice4_GetGPUThreadPriority(This,pPriority) \ + ( (This)->lpVtbl -> GetGPUThreadPriority(This,pPriority) ) + + +#define IDXGIDevice4_SetMaximumFrameLatency(This,MaxLatency) \ + ( (This)->lpVtbl -> SetMaximumFrameLatency(This,MaxLatency) ) + +#define IDXGIDevice4_GetMaximumFrameLatency(This,pMaxLatency) \ + ( (This)->lpVtbl -> GetMaximumFrameLatency(This,pMaxLatency) ) + + +#define IDXGIDevice4_OfferResources(This,NumResources,ppResources,Priority) \ + ( (This)->lpVtbl -> OfferResources(This,NumResources,ppResources,Priority) ) + +#define IDXGIDevice4_ReclaimResources(This,NumResources,ppResources,pDiscarded) \ + ( (This)->lpVtbl -> ReclaimResources(This,NumResources,ppResources,pDiscarded) ) + +#define IDXGIDevice4_EnqueueSetEvent(This,hEvent) \ + ( (This)->lpVtbl -> EnqueueSetEvent(This,hEvent) ) + + +#define IDXGIDevice4_Trim(This) \ + ( (This)->lpVtbl -> Trim(This) ) + + +#define IDXGIDevice4_OfferResources1(This,NumResources,ppResources,Priority,Flags) \ + ( (This)->lpVtbl -> OfferResources1(This,NumResources,ppResources,Priority,Flags) ) + +#define IDXGIDevice4_ReclaimResources1(This,NumResources,ppResources,pResults) \ + ( (This)->lpVtbl -> ReclaimResources1(This,NumResources,ppResources,pResults) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIDevice4_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_5_0000_0003 */ +/* [local] */ + +typedef +enum DXGI_FEATURE + { + DXGI_FEATURE_PRESENT_ALLOW_TEARING = 0 + } DXGI_FEATURE; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0003_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0003_v0_0_s_ifspec; + +#ifndef __IDXGIFactory5_INTERFACE_DEFINED__ +#define __IDXGIFactory5_INTERFACE_DEFINED__ + +/* interface IDXGIFactory5 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIFactory5; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7632e1f5-ee65-4dca-87fd-84cd75f8838d") + IDXGIFactory5 : public IDXGIFactory4 + { + public: + virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport( + DXGI_FEATURE Feature, + /* [annotation] */ + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIFactory5Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIFactory5 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIFactory5 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIFactory5 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters )( + IDXGIFactory5 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )( + IDXGIFactory5 * This, + HWND WindowHandle, + UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )( + IDXGIFactory5 * This, + /* [annotation][out] */ + _Out_ HWND *pWindowHandle); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ DXGI_SWAP_CHAIN_DESC *pDesc, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )( + IDXGIFactory5 * This, + /* [in] */ HMODULE Module, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters1 )( + IDXGIFactory5 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter1 **ppAdapter); + + BOOL ( STDMETHODCALLTYPE *IsCurrent )( + IDXGIFactory5 * This); + + BOOL ( STDMETHODCALLTYPE *IsWindowedStereoEnabled )( + IDXGIFactory5 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForHwnd )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ HWND hWnd, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForCoreWindow )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ IUnknown *pWindow, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *GetSharedResourceAdapterLuid )( + IDXGIFactory5 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _Out_ LUID *pLuid); + + HRESULT ( STDMETHODCALLTYPE *RegisterStereoStatusWindow )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ HWND WindowHandle, + /* [annotation][in] */ + _In_ UINT wMsg, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterStereoStatusEvent )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterStereoStatus )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterOcclusionStatusWindow )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ HWND WindowHandle, + /* [annotation][in] */ + _In_ UINT wMsg, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterOcclusionStatusEvent )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterOcclusionStatus )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForComposition )( + IDXGIFactory5 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + IDXGIFactory5 * This); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapterByLuid )( + IDXGIFactory5 * This, + /* [annotation] */ + _In_ LUID AdapterLuid, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumWarpAdapter )( + IDXGIFactory5 * This, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + IDXGIFactory5 * This, + DXGI_FEATURE Feature, + /* [annotation] */ + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + END_INTERFACE + } IDXGIFactory5Vtbl; + + interface IDXGIFactory5 + { + CONST_VTBL struct IDXGIFactory5Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIFactory5_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIFactory5_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIFactory5_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIFactory5_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIFactory5_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIFactory5_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIFactory5_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIFactory5_EnumAdapters(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) ) + +#define IDXGIFactory5_MakeWindowAssociation(This,WindowHandle,Flags) \ + ( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) ) + +#define IDXGIFactory5_GetWindowAssociation(This,pWindowHandle) \ + ( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) ) + +#define IDXGIFactory5_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) ) + +#define IDXGIFactory5_CreateSoftwareAdapter(This,Module,ppAdapter) \ + ( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) ) + + +#define IDXGIFactory5_EnumAdapters1(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters1(This,Adapter,ppAdapter) ) + +#define IDXGIFactory5_IsCurrent(This) \ + ( (This)->lpVtbl -> IsCurrent(This) ) + + +#define IDXGIFactory5_IsWindowedStereoEnabled(This) \ + ( (This)->lpVtbl -> IsWindowedStereoEnabled(This) ) + +#define IDXGIFactory5_CreateSwapChainForHwnd(This,pDevice,hWnd,pDesc,pFullscreenDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForHwnd(This,pDevice,hWnd,pDesc,pFullscreenDesc,pRestrictToOutput,ppSwapChain) ) + +#define IDXGIFactory5_CreateSwapChainForCoreWindow(This,pDevice,pWindow,pDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForCoreWindow(This,pDevice,pWindow,pDesc,pRestrictToOutput,ppSwapChain) ) + +#define IDXGIFactory5_GetSharedResourceAdapterLuid(This,hResource,pLuid) \ + ( (This)->lpVtbl -> GetSharedResourceAdapterLuid(This,hResource,pLuid) ) + +#define IDXGIFactory5_RegisterStereoStatusWindow(This,WindowHandle,wMsg,pdwCookie) \ + ( (This)->lpVtbl -> RegisterStereoStatusWindow(This,WindowHandle,wMsg,pdwCookie) ) + +#define IDXGIFactory5_RegisterStereoStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterStereoStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory5_UnregisterStereoStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterStereoStatus(This,dwCookie) ) + +#define IDXGIFactory5_RegisterOcclusionStatusWindow(This,WindowHandle,wMsg,pdwCookie) \ + ( (This)->lpVtbl -> RegisterOcclusionStatusWindow(This,WindowHandle,wMsg,pdwCookie) ) + +#define IDXGIFactory5_RegisterOcclusionStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterOcclusionStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory5_UnregisterOcclusionStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterOcclusionStatus(This,dwCookie) ) + +#define IDXGIFactory5_CreateSwapChainForComposition(This,pDevice,pDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForComposition(This,pDevice,pDesc,pRestrictToOutput,ppSwapChain) ) + + +#define IDXGIFactory5_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + + +#define IDXGIFactory5_EnumAdapterByLuid(This,AdapterLuid,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumAdapterByLuid(This,AdapterLuid,riid,ppvAdapter) ) + +#define IDXGIFactory5_EnumWarpAdapter(This,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumWarpAdapter(This,riid,ppvAdapter) ) + + +#define IDXGIFactory5_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIFactory5_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_5_0000_0004 */ +/* [local] */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion +DEFINE_GUID(IID_IDXGIOutput5,0x80A07424,0xAB52,0x42EB,0x83,0x3C,0x0C,0x42,0xFD,0x28,0x2D,0x98); +DEFINE_GUID(IID_IDXGISwapChain4,0x3D585D5A,0xBD4A,0x489E,0xB1,0xF4,0x3D,0xBC,0xB6,0x45,0x2F,0xFB); +DEFINE_GUID(IID_IDXGIDevice4,0x95B4F95F,0xD8DA,0x4CA4,0x9E,0xE6,0x3B,0x76,0xD5,0x96,0x8A,0x10); +DEFINE_GUID(IID_IDXGIFactory5,0x7632e1f5,0xee65,0x4dca,0x87,0xfd,0x84,0xcd,0x75,0xf8,0x83,0x8d); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_5_0000_0004_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_6.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_6.h new file mode 100644 index 00000000000..4e0778bd242 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgi1_6.h @@ -0,0 +1,1516 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* @@MIDL_FILE_HEADING( ) */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxgi1_6_h__ +#define __dxgi1_6_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDXGIAdapter4_FWD_DEFINED__ +#define __IDXGIAdapter4_FWD_DEFINED__ +typedef interface IDXGIAdapter4 IDXGIAdapter4; + +#endif /* __IDXGIAdapter4_FWD_DEFINED__ */ + + +#ifndef __IDXGIOutput6_FWD_DEFINED__ +#define __IDXGIOutput6_FWD_DEFINED__ +typedef interface IDXGIOutput6 IDXGIOutput6; + +#endif /* __IDXGIOutput6_FWD_DEFINED__ */ + + +#ifndef __IDXGIFactory6_FWD_DEFINED__ +#define __IDXGIFactory6_FWD_DEFINED__ +typedef interface IDXGIFactory6 IDXGIFactory6; + +#endif /* __IDXGIFactory6_FWD_DEFINED__ */ + + +#ifndef __IDXGIFactory7_FWD_DEFINED__ +#define __IDXGIFactory7_FWD_DEFINED__ +typedef interface IDXGIFactory7 IDXGIFactory7; + +#endif /* __IDXGIFactory7_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "dxgi1_5.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_dxgi1_6_0000_0000 */ +/* [local] */ + +// Copyright (c) Microsoft Corporation. All Rights Reserved +#include +// BK - pragma region App Family +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +HRESULT WINAPI DXGIDeclareAdapterRemovalSupport(); +typedef +enum DXGI_ADAPTER_FLAG3 + { + DXGI_ADAPTER_FLAG3_NONE = 0, + DXGI_ADAPTER_FLAG3_REMOTE = 1, + DXGI_ADAPTER_FLAG3_SOFTWARE = 2, + DXGI_ADAPTER_FLAG3_ACG_COMPATIBLE = 4, + DXGI_ADAPTER_FLAG3_SUPPORT_MONITORED_FENCES = 8, + DXGI_ADAPTER_FLAG3_SUPPORT_NON_MONITORED_FENCES = 0x10, + DXGI_ADAPTER_FLAG3_KEYED_MUTEX_CONFORMANCE = 0x20, + DXGI_ADAPTER_FLAG3_FORCE_DWORD = 0xffffffff + } DXGI_ADAPTER_FLAG3; + +DEFINE_ENUM_FLAG_OPERATORS( DXGI_ADAPTER_FLAG3 ); +typedef struct DXGI_ADAPTER_DESC3 + { + WCHAR Description[ 128 ]; + UINT VendorId; + UINT DeviceId; + UINT SubSysId; + UINT Revision; + SIZE_T DedicatedVideoMemory; + SIZE_T DedicatedSystemMemory; + SIZE_T SharedSystemMemory; + LUID AdapterLuid; + DXGI_ADAPTER_FLAG3 Flags; + DXGI_GRAPHICS_PREEMPTION_GRANULARITY GraphicsPreemptionGranularity; + DXGI_COMPUTE_PREEMPTION_GRANULARITY ComputePreemptionGranularity; + } DXGI_ADAPTER_DESC3; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0000_v0_0_s_ifspec; + +#ifndef __IDXGIAdapter4_INTERFACE_DEFINED__ +#define __IDXGIAdapter4_INTERFACE_DEFINED__ + +/* interface IDXGIAdapter4 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIAdapter4; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3c8d99d1-4fbf-4181-a82c-af66bf7bd24e") + IDXGIAdapter4 : public IDXGIAdapter3 + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc3( + /* [annotation][out] */ + _Out_ DXGI_ADAPTER_DESC3 *pDesc) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIAdapter4Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIAdapter4 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIAdapter4 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIAdapter4 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumOutputs )( + IDXGIAdapter4 * This, + /* [in] */ UINT Output, + /* [annotation][out][in] */ + _COM_Outptr_ IDXGIOutput **ppOutput); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIAdapter4 * This, + /* [annotation][out] */ + _Out_ DXGI_ADAPTER_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *CheckInterfaceSupport )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ REFGUID InterfaceName, + /* [annotation][out] */ + _Out_ LARGE_INTEGER *pUMDVersion); + + HRESULT ( STDMETHODCALLTYPE *GetDesc1 )( + IDXGIAdapter4 * This, + /* [annotation][out] */ + _Out_ DXGI_ADAPTER_DESC1 *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetDesc2 )( + IDXGIAdapter4 * This, + /* [annotation][out] */ + _Out_ DXGI_ADAPTER_DESC2 *pDesc); + + HRESULT ( STDMETHODCALLTYPE *RegisterHardwareContentProtectionTeardownStatusEvent )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterHardwareContentProtectionTeardownStatus )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *QueryVideoMemoryInfo )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ UINT NodeIndex, + /* [annotation][in] */ + _In_ DXGI_MEMORY_SEGMENT_GROUP MemorySegmentGroup, + /* [annotation][out] */ + _Out_ DXGI_QUERY_VIDEO_MEMORY_INFO *pVideoMemoryInfo); + + HRESULT ( STDMETHODCALLTYPE *SetVideoMemoryReservation )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ UINT NodeIndex, + /* [annotation][in] */ + _In_ DXGI_MEMORY_SEGMENT_GROUP MemorySegmentGroup, + /* [annotation][in] */ + _In_ UINT64 Reservation); + + HRESULT ( STDMETHODCALLTYPE *RegisterVideoMemoryBudgetChangeNotificationEvent )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterVideoMemoryBudgetChangeNotification )( + IDXGIAdapter4 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *GetDesc3 )( + IDXGIAdapter4 * This, + /* [annotation][out] */ + _Out_ DXGI_ADAPTER_DESC3 *pDesc); + + END_INTERFACE + } IDXGIAdapter4Vtbl; + + interface IDXGIAdapter4 + { + CONST_VTBL struct IDXGIAdapter4Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIAdapter4_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIAdapter4_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIAdapter4_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIAdapter4_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIAdapter4_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIAdapter4_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIAdapter4_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIAdapter4_EnumOutputs(This,Output,ppOutput) \ + ( (This)->lpVtbl -> EnumOutputs(This,Output,ppOutput) ) + +#define IDXGIAdapter4_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIAdapter4_CheckInterfaceSupport(This,InterfaceName,pUMDVersion) \ + ( (This)->lpVtbl -> CheckInterfaceSupport(This,InterfaceName,pUMDVersion) ) + + +#define IDXGIAdapter4_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + + +#define IDXGIAdapter4_GetDesc2(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc2(This,pDesc) ) + + +#define IDXGIAdapter4_RegisterHardwareContentProtectionTeardownStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterHardwareContentProtectionTeardownStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIAdapter4_UnregisterHardwareContentProtectionTeardownStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterHardwareContentProtectionTeardownStatus(This,dwCookie) ) + +#define IDXGIAdapter4_QueryVideoMemoryInfo(This,NodeIndex,MemorySegmentGroup,pVideoMemoryInfo) \ + ( (This)->lpVtbl -> QueryVideoMemoryInfo(This,NodeIndex,MemorySegmentGroup,pVideoMemoryInfo) ) + +#define IDXGIAdapter4_SetVideoMemoryReservation(This,NodeIndex,MemorySegmentGroup,Reservation) \ + ( (This)->lpVtbl -> SetVideoMemoryReservation(This,NodeIndex,MemorySegmentGroup,Reservation) ) + +#define IDXGIAdapter4_RegisterVideoMemoryBudgetChangeNotificationEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterVideoMemoryBudgetChangeNotificationEvent(This,hEvent,pdwCookie) ) + +#define IDXGIAdapter4_UnregisterVideoMemoryBudgetChangeNotification(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterVideoMemoryBudgetChangeNotification(This,dwCookie) ) + + +#define IDXGIAdapter4_GetDesc3(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc3(This,pDesc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIAdapter4_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_6_0000_0001 */ +/* [local] */ + +typedef struct DXGI_OUTPUT_DESC1 + { + WCHAR DeviceName[ 32 ]; + RECT DesktopCoordinates; + BOOL AttachedToDesktop; + DXGI_MODE_ROTATION Rotation; + HMONITOR Monitor; + UINT BitsPerColor; + DXGI_COLOR_SPACE_TYPE ColorSpace; + FLOAT RedPrimary[ 2 ]; + FLOAT GreenPrimary[ 2 ]; + FLOAT BluePrimary[ 2 ]; + FLOAT WhitePoint[ 2 ]; + FLOAT MinLuminance; + FLOAT MaxLuminance; + FLOAT MaxFullFrameLuminance; + } DXGI_OUTPUT_DESC1; + +typedef +enum DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAGS + { + DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_FULLSCREEN = 1, + DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_WINDOWED = 2, + DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAG_CURSOR_STRETCHED = 4 + } DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAGS; + +DEFINE_ENUM_FLAG_OPERATORS( DXGI_HARDWARE_COMPOSITION_SUPPORT_FLAGS ); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0001_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0001_v0_0_s_ifspec; + +#ifndef __IDXGIOutput6_INTERFACE_DEFINED__ +#define __IDXGIOutput6_INTERFACE_DEFINED__ + +/* interface IDXGIOutput6 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIOutput6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("068346e8-aaec-4b84-add7-137f513f77a1") + IDXGIOutput6 : public IDXGIOutput5 + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDesc1( + /* [annotation][out] */ + _Out_ DXGI_OUTPUT_DESC1 *pDesc) = 0; + + virtual HRESULT STDMETHODCALLTYPE CheckHardwareCompositionSupport( + /* [annotation][out] */ + _Out_ UINT *pFlags) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIOutput6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIOutput6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIOutput6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIOutput6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *GetDesc )( + IDXGIOutput6 * This, + /* [annotation][out] */ + _Out_ DXGI_OUTPUT_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList )( + IDXGIOutput6 * This, + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [annotation][out][in] */ + _Inout_ UINT *pNumModes, + /* [annotation][out] */ + _Out_writes_to_opt_(*pNumModes,*pNumModes) DXGI_MODE_DESC *pDesc); + + HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ const DXGI_MODE_DESC *pModeToMatch, + /* [annotation][out] */ + _Out_ DXGI_MODE_DESC *pClosestMatch, + /* [annotation][in] */ + _In_opt_ IUnknown *pConcernedDevice); + + HRESULT ( STDMETHODCALLTYPE *WaitForVBlank )( + IDXGIOutput6 * This); + + HRESULT ( STDMETHODCALLTYPE *TakeOwnership )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + BOOL Exclusive); + + void ( STDMETHODCALLTYPE *ReleaseOwnership )( + IDXGIOutput6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControlCapabilities )( + IDXGIOutput6 * This, + /* [annotation][out] */ + _Out_ DXGI_GAMMA_CONTROL_CAPABILITIES *pGammaCaps); + + HRESULT ( STDMETHODCALLTYPE *SetGammaControl )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ const DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *GetGammaControl )( + IDXGIOutput6 * This, + /* [annotation][out] */ + _Out_ DXGI_GAMMA_CONTROL *pArray); + + HRESULT ( STDMETHODCALLTYPE *SetDisplaySurface )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ IDXGISurface *pScanoutSurface); + + HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ IDXGISurface *pDestination); + + HRESULT ( STDMETHODCALLTYPE *GetFrameStatistics )( + IDXGIOutput6 * This, + /* [annotation][out] */ + _Out_ DXGI_FRAME_STATISTICS *pStats); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeList1 )( + IDXGIOutput6 * This, + /* [in] */ DXGI_FORMAT EnumFormat, + /* [in] */ UINT Flags, + /* [annotation][out][in] */ + _Inout_ UINT *pNumModes, + /* [annotation][out] */ + _Out_writes_to_opt_(*pNumModes,*pNumModes) DXGI_MODE_DESC1 *pDesc); + + HRESULT ( STDMETHODCALLTYPE *FindClosestMatchingMode1 )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ const DXGI_MODE_DESC1 *pModeToMatch, + /* [annotation][out] */ + _Out_ DXGI_MODE_DESC1 *pClosestMatch, + /* [annotation][in] */ + _In_opt_ IUnknown *pConcernedDevice); + + HRESULT ( STDMETHODCALLTYPE *GetDisplaySurfaceData1 )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ IDXGIResource *pDestination); + + HRESULT ( STDMETHODCALLTYPE *DuplicateOutput )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][out] */ + _COM_Outptr_ IDXGIOutputDuplication **ppOutputDuplication); + + BOOL ( STDMETHODCALLTYPE *SupportsOverlays )( + IDXGIOutput6 * This); + + HRESULT ( STDMETHODCALLTYPE *CheckOverlaySupport )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ DXGI_FORMAT EnumFormat, + /* [annotation][out] */ + _In_ IUnknown *pConcernedDevice, + /* [annotation][out] */ + _Out_ UINT *pFlags); + + HRESULT ( STDMETHODCALLTYPE *CheckOverlayColorSpaceSupport )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ DXGI_FORMAT Format, + /* [annotation][in] */ + _In_ DXGI_COLOR_SPACE_TYPE ColorSpace, + /* [annotation][in] */ + _In_ IUnknown *pConcernedDevice, + /* [annotation][out] */ + _Out_ UINT *pFlags); + + HRESULT ( STDMETHODCALLTYPE *DuplicateOutput1 )( + IDXGIOutput6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [in] */ UINT Flags, + /* [annotation][in] */ + _In_ UINT SupportedFormatsCount, + /* [annotation][in] */ + _In_reads_(SupportedFormatsCount) const DXGI_FORMAT *pSupportedFormats, + /* [annotation][out] */ + _COM_Outptr_ IDXGIOutputDuplication **ppOutputDuplication); + + HRESULT ( STDMETHODCALLTYPE *GetDesc1 )( + IDXGIOutput6 * This, + /* [annotation][out] */ + _Out_ DXGI_OUTPUT_DESC1 *pDesc); + + HRESULT ( STDMETHODCALLTYPE *CheckHardwareCompositionSupport )( + IDXGIOutput6 * This, + /* [annotation][out] */ + _Out_ UINT *pFlags); + + END_INTERFACE + } IDXGIOutput6Vtbl; + + interface IDXGIOutput6 + { + CONST_VTBL struct IDXGIOutput6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIOutput6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIOutput6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIOutput6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIOutput6_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIOutput6_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIOutput6_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIOutput6_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIOutput6_GetDesc(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc(This,pDesc) ) + +#define IDXGIOutput6_GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) \ + ( (This)->lpVtbl -> GetDisplayModeList(This,EnumFormat,Flags,pNumModes,pDesc) ) + +#define IDXGIOutput6_FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) \ + ( (This)->lpVtbl -> FindClosestMatchingMode(This,pModeToMatch,pClosestMatch,pConcernedDevice) ) + +#define IDXGIOutput6_WaitForVBlank(This) \ + ( (This)->lpVtbl -> WaitForVBlank(This) ) + +#define IDXGIOutput6_TakeOwnership(This,pDevice,Exclusive) \ + ( (This)->lpVtbl -> TakeOwnership(This,pDevice,Exclusive) ) + +#define IDXGIOutput6_ReleaseOwnership(This) \ + ( (This)->lpVtbl -> ReleaseOwnership(This) ) + +#define IDXGIOutput6_GetGammaControlCapabilities(This,pGammaCaps) \ + ( (This)->lpVtbl -> GetGammaControlCapabilities(This,pGammaCaps) ) + +#define IDXGIOutput6_SetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> SetGammaControl(This,pArray) ) + +#define IDXGIOutput6_GetGammaControl(This,pArray) \ + ( (This)->lpVtbl -> GetGammaControl(This,pArray) ) + +#define IDXGIOutput6_SetDisplaySurface(This,pScanoutSurface) \ + ( (This)->lpVtbl -> SetDisplaySurface(This,pScanoutSurface) ) + +#define IDXGIOutput6_GetDisplaySurfaceData(This,pDestination) \ + ( (This)->lpVtbl -> GetDisplaySurfaceData(This,pDestination) ) + +#define IDXGIOutput6_GetFrameStatistics(This,pStats) \ + ( (This)->lpVtbl -> GetFrameStatistics(This,pStats) ) + + +#define IDXGIOutput6_GetDisplayModeList1(This,EnumFormat,Flags,pNumModes,pDesc) \ + ( (This)->lpVtbl -> GetDisplayModeList1(This,EnumFormat,Flags,pNumModes,pDesc) ) + +#define IDXGIOutput6_FindClosestMatchingMode1(This,pModeToMatch,pClosestMatch,pConcernedDevice) \ + ( (This)->lpVtbl -> FindClosestMatchingMode1(This,pModeToMatch,pClosestMatch,pConcernedDevice) ) + +#define IDXGIOutput6_GetDisplaySurfaceData1(This,pDestination) \ + ( (This)->lpVtbl -> GetDisplaySurfaceData1(This,pDestination) ) + +#define IDXGIOutput6_DuplicateOutput(This,pDevice,ppOutputDuplication) \ + ( (This)->lpVtbl -> DuplicateOutput(This,pDevice,ppOutputDuplication) ) + + +#define IDXGIOutput6_SupportsOverlays(This) \ + ( (This)->lpVtbl -> SupportsOverlays(This) ) + + +#define IDXGIOutput6_CheckOverlaySupport(This,EnumFormat,pConcernedDevice,pFlags) \ + ( (This)->lpVtbl -> CheckOverlaySupport(This,EnumFormat,pConcernedDevice,pFlags) ) + + +#define IDXGIOutput6_CheckOverlayColorSpaceSupport(This,Format,ColorSpace,pConcernedDevice,pFlags) \ + ( (This)->lpVtbl -> CheckOverlayColorSpaceSupport(This,Format,ColorSpace,pConcernedDevice,pFlags) ) + + +#define IDXGIOutput6_DuplicateOutput1(This,pDevice,Flags,SupportedFormatsCount,pSupportedFormats,ppOutputDuplication) \ + ( (This)->lpVtbl -> DuplicateOutput1(This,pDevice,Flags,SupportedFormatsCount,pSupportedFormats,ppOutputDuplication) ) + + +#define IDXGIOutput6_GetDesc1(This,pDesc) \ + ( (This)->lpVtbl -> GetDesc1(This,pDesc) ) + +#define IDXGIOutput6_CheckHardwareCompositionSupport(This,pFlags) \ + ( (This)->lpVtbl -> CheckHardwareCompositionSupport(This,pFlags) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIOutput6_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_6_0000_0002 */ +/* [local] */ + +typedef +enum DXGI_GPU_PREFERENCE + { + DXGI_GPU_PREFERENCE_UNSPECIFIED = 0, + DXGI_GPU_PREFERENCE_MINIMUM_POWER = ( DXGI_GPU_PREFERENCE_UNSPECIFIED + 1 ) , + DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE = ( DXGI_GPU_PREFERENCE_MINIMUM_POWER + 1 ) + } DXGI_GPU_PREFERENCE; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0002_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0002_v0_0_s_ifspec; + +#ifndef __IDXGIFactory6_INTERFACE_DEFINED__ +#define __IDXGIFactory6_INTERFACE_DEFINED__ + +/* interface IDXGIFactory6 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIFactory6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("c1b6694f-ff09-44a9-b03c-77900a0a1d17") + IDXGIFactory6 : public IDXGIFactory5 + { + public: + virtual HRESULT STDMETHODCALLTYPE EnumAdapterByGpuPreference( + /* [annotation] */ + _In_ UINT Adapter, + /* [annotation] */ + _In_ DXGI_GPU_PREFERENCE GpuPreference, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIFactory6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIFactory6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIFactory6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIFactory6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters )( + IDXGIFactory6 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )( + IDXGIFactory6 * This, + HWND WindowHandle, + UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )( + IDXGIFactory6 * This, + /* [annotation][out] */ + _Out_ HWND *pWindowHandle); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ DXGI_SWAP_CHAIN_DESC *pDesc, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )( + IDXGIFactory6 * This, + /* [in] */ HMODULE Module, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters1 )( + IDXGIFactory6 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter1 **ppAdapter); + + BOOL ( STDMETHODCALLTYPE *IsCurrent )( + IDXGIFactory6 * This); + + BOOL ( STDMETHODCALLTYPE *IsWindowedStereoEnabled )( + IDXGIFactory6 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForHwnd )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ HWND hWnd, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForCoreWindow )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ IUnknown *pWindow, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *GetSharedResourceAdapterLuid )( + IDXGIFactory6 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _Out_ LUID *pLuid); + + HRESULT ( STDMETHODCALLTYPE *RegisterStereoStatusWindow )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ HWND WindowHandle, + /* [annotation][in] */ + _In_ UINT wMsg, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterStereoStatusEvent )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterStereoStatus )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterOcclusionStatusWindow )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ HWND WindowHandle, + /* [annotation][in] */ + _In_ UINT wMsg, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterOcclusionStatusEvent )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterOcclusionStatus )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForComposition )( + IDXGIFactory6 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + IDXGIFactory6 * This); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapterByLuid )( + IDXGIFactory6 * This, + /* [annotation] */ + _In_ LUID AdapterLuid, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumWarpAdapter )( + IDXGIFactory6 * This, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + IDXGIFactory6 * This, + DXGI_FEATURE Feature, + /* [annotation] */ + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapterByGpuPreference )( + IDXGIFactory6 * This, + /* [annotation] */ + _In_ UINT Adapter, + /* [annotation] */ + _In_ DXGI_GPU_PREFERENCE GpuPreference, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + END_INTERFACE + } IDXGIFactory6Vtbl; + + interface IDXGIFactory6 + { + CONST_VTBL struct IDXGIFactory6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIFactory6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIFactory6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIFactory6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIFactory6_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIFactory6_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIFactory6_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIFactory6_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIFactory6_EnumAdapters(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) ) + +#define IDXGIFactory6_MakeWindowAssociation(This,WindowHandle,Flags) \ + ( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) ) + +#define IDXGIFactory6_GetWindowAssociation(This,pWindowHandle) \ + ( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) ) + +#define IDXGIFactory6_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) ) + +#define IDXGIFactory6_CreateSoftwareAdapter(This,Module,ppAdapter) \ + ( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) ) + + +#define IDXGIFactory6_EnumAdapters1(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters1(This,Adapter,ppAdapter) ) + +#define IDXGIFactory6_IsCurrent(This) \ + ( (This)->lpVtbl -> IsCurrent(This) ) + + +#define IDXGIFactory6_IsWindowedStereoEnabled(This) \ + ( (This)->lpVtbl -> IsWindowedStereoEnabled(This) ) + +#define IDXGIFactory6_CreateSwapChainForHwnd(This,pDevice,hWnd,pDesc,pFullscreenDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForHwnd(This,pDevice,hWnd,pDesc,pFullscreenDesc,pRestrictToOutput,ppSwapChain) ) + +#define IDXGIFactory6_CreateSwapChainForCoreWindow(This,pDevice,pWindow,pDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForCoreWindow(This,pDevice,pWindow,pDesc,pRestrictToOutput,ppSwapChain) ) + +#define IDXGIFactory6_GetSharedResourceAdapterLuid(This,hResource,pLuid) \ + ( (This)->lpVtbl -> GetSharedResourceAdapterLuid(This,hResource,pLuid) ) + +#define IDXGIFactory6_RegisterStereoStatusWindow(This,WindowHandle,wMsg,pdwCookie) \ + ( (This)->lpVtbl -> RegisterStereoStatusWindow(This,WindowHandle,wMsg,pdwCookie) ) + +#define IDXGIFactory6_RegisterStereoStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterStereoStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory6_UnregisterStereoStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterStereoStatus(This,dwCookie) ) + +#define IDXGIFactory6_RegisterOcclusionStatusWindow(This,WindowHandle,wMsg,pdwCookie) \ + ( (This)->lpVtbl -> RegisterOcclusionStatusWindow(This,WindowHandle,wMsg,pdwCookie) ) + +#define IDXGIFactory6_RegisterOcclusionStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterOcclusionStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory6_UnregisterOcclusionStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterOcclusionStatus(This,dwCookie) ) + +#define IDXGIFactory6_CreateSwapChainForComposition(This,pDevice,pDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForComposition(This,pDevice,pDesc,pRestrictToOutput,ppSwapChain) ) + + +#define IDXGIFactory6_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + + +#define IDXGIFactory6_EnumAdapterByLuid(This,AdapterLuid,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumAdapterByLuid(This,AdapterLuid,riid,ppvAdapter) ) + +#define IDXGIFactory6_EnumWarpAdapter(This,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumWarpAdapter(This,riid,ppvAdapter) ) + + +#define IDXGIFactory6_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + + +#define IDXGIFactory6_EnumAdapterByGpuPreference(This,Adapter,GpuPreference,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumAdapterByGpuPreference(This,Adapter,GpuPreference,riid,ppvAdapter) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIFactory6_INTERFACE_DEFINED__ */ + + +#ifndef __IDXGIFactory7_INTERFACE_DEFINED__ +#define __IDXGIFactory7_INTERFACE_DEFINED__ + +/* interface IDXGIFactory7 */ +/* [unique][local][uuid][object] */ + + +EXTERN_C const IID IID_IDXGIFactory7; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("a4966eed-76db-44da-84c1-ee9a7afb20a8") + IDXGIFactory7 : public IDXGIFactory6 + { + public: + virtual HRESULT STDMETHODCALLTYPE RegisterAdaptersChangedEvent( + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnregisterAdaptersChangedEvent( + /* [annotation][in] */ + _In_ DWORD dwCookie) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDXGIFactory7Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDXGIFactory7 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDXGIFactory7 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDXGIFactory7 * This); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateData )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [in] */ UINT DataSize, + /* [annotation][in] */ + _In_reads_bytes_(DataSize) const void *pData); + + HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][in] */ + _In_opt_ const IUnknown *pUnknown); + + HRESULT ( STDMETHODCALLTYPE *GetPrivateData )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ REFGUID Name, + /* [annotation][out][in] */ + _Inout_ UINT *pDataSize, + /* [annotation][out] */ + _Out_writes_bytes_(*pDataSize) void *pData); + + HRESULT ( STDMETHODCALLTYPE *GetParent )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][retval][out] */ + _COM_Outptr_ void **ppParent); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters )( + IDXGIFactory7 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *MakeWindowAssociation )( + IDXGIFactory7 * This, + HWND WindowHandle, + UINT Flags); + + HRESULT ( STDMETHODCALLTYPE *GetWindowAssociation )( + IDXGIFactory7 * This, + /* [annotation][out] */ + _Out_ HWND *pWindowHandle); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChain )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ DXGI_SWAP_CHAIN_DESC *pDesc, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSoftwareAdapter )( + IDXGIFactory7 * This, + /* [in] */ HMODULE Module, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter **ppAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapters1 )( + IDXGIFactory7 * This, + /* [in] */ UINT Adapter, + /* [annotation][out] */ + _COM_Outptr_ IDXGIAdapter1 **ppAdapter); + + BOOL ( STDMETHODCALLTYPE *IsCurrent )( + IDXGIFactory7 * This); + + BOOL ( STDMETHODCALLTYPE *IsWindowedStereoEnabled )( + IDXGIFactory7 * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForHwnd )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ HWND hWnd, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pFullscreenDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForCoreWindow )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ IUnknown *pWindow, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + HRESULT ( STDMETHODCALLTYPE *GetSharedResourceAdapterLuid )( + IDXGIFactory7 * This, + /* [annotation] */ + _In_ HANDLE hResource, + /* [annotation] */ + _Out_ LUID *pLuid); + + HRESULT ( STDMETHODCALLTYPE *RegisterStereoStatusWindow )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ HWND WindowHandle, + /* [annotation][in] */ + _In_ UINT wMsg, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterStereoStatusEvent )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterStereoStatus )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterOcclusionStatusWindow )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ HWND WindowHandle, + /* [annotation][in] */ + _In_ UINT wMsg, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *RegisterOcclusionStatusEvent )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + void ( STDMETHODCALLTYPE *UnregisterOcclusionStatus )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + HRESULT ( STDMETHODCALLTYPE *CreateSwapChainForComposition )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ IUnknown *pDevice, + /* [annotation][in] */ + _In_ const DXGI_SWAP_CHAIN_DESC1 *pDesc, + /* [annotation][in] */ + _In_opt_ IDXGIOutput *pRestrictToOutput, + /* [annotation][out] */ + _COM_Outptr_ IDXGISwapChain1 **ppSwapChain); + + UINT ( STDMETHODCALLTYPE *GetCreationFlags )( + IDXGIFactory7 * This); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapterByLuid )( + IDXGIFactory7 * This, + /* [annotation] */ + _In_ LUID AdapterLuid, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *EnumWarpAdapter )( + IDXGIFactory7 * This, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )( + IDXGIFactory7 * This, + DXGI_FEATURE Feature, + /* [annotation] */ + _Inout_updates_bytes_(FeatureSupportDataSize) void *pFeatureSupportData, + UINT FeatureSupportDataSize); + + HRESULT ( STDMETHODCALLTYPE *EnumAdapterByGpuPreference )( + IDXGIFactory7 * This, + /* [annotation] */ + _In_ UINT Adapter, + /* [annotation] */ + _In_ DXGI_GPU_PREFERENCE GpuPreference, + /* [annotation] */ + _In_ REFIID riid, + /* [annotation] */ + _COM_Outptr_ void **ppvAdapter); + + HRESULT ( STDMETHODCALLTYPE *RegisterAdaptersChangedEvent )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ HANDLE hEvent, + /* [annotation][out] */ + _Out_ DWORD *pdwCookie); + + HRESULT ( STDMETHODCALLTYPE *UnregisterAdaptersChangedEvent )( + IDXGIFactory7 * This, + /* [annotation][in] */ + _In_ DWORD dwCookie); + + END_INTERFACE + } IDXGIFactory7Vtbl; + + interface IDXGIFactory7 + { + CONST_VTBL struct IDXGIFactory7Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDXGIFactory7_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDXGIFactory7_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDXGIFactory7_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDXGIFactory7_SetPrivateData(This,Name,DataSize,pData) \ + ( (This)->lpVtbl -> SetPrivateData(This,Name,DataSize,pData) ) + +#define IDXGIFactory7_SetPrivateDataInterface(This,Name,pUnknown) \ + ( (This)->lpVtbl -> SetPrivateDataInterface(This,Name,pUnknown) ) + +#define IDXGIFactory7_GetPrivateData(This,Name,pDataSize,pData) \ + ( (This)->lpVtbl -> GetPrivateData(This,Name,pDataSize,pData) ) + +#define IDXGIFactory7_GetParent(This,riid,ppParent) \ + ( (This)->lpVtbl -> GetParent(This,riid,ppParent) ) + + +#define IDXGIFactory7_EnumAdapters(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters(This,Adapter,ppAdapter) ) + +#define IDXGIFactory7_MakeWindowAssociation(This,WindowHandle,Flags) \ + ( (This)->lpVtbl -> MakeWindowAssociation(This,WindowHandle,Flags) ) + +#define IDXGIFactory7_GetWindowAssociation(This,pWindowHandle) \ + ( (This)->lpVtbl -> GetWindowAssociation(This,pWindowHandle) ) + +#define IDXGIFactory7_CreateSwapChain(This,pDevice,pDesc,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChain(This,pDevice,pDesc,ppSwapChain) ) + +#define IDXGIFactory7_CreateSoftwareAdapter(This,Module,ppAdapter) \ + ( (This)->lpVtbl -> CreateSoftwareAdapter(This,Module,ppAdapter) ) + + +#define IDXGIFactory7_EnumAdapters1(This,Adapter,ppAdapter) \ + ( (This)->lpVtbl -> EnumAdapters1(This,Adapter,ppAdapter) ) + +#define IDXGIFactory7_IsCurrent(This) \ + ( (This)->lpVtbl -> IsCurrent(This) ) + + +#define IDXGIFactory7_IsWindowedStereoEnabled(This) \ + ( (This)->lpVtbl -> IsWindowedStereoEnabled(This) ) + +#define IDXGIFactory7_CreateSwapChainForHwnd(This,pDevice,hWnd,pDesc,pFullscreenDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForHwnd(This,pDevice,hWnd,pDesc,pFullscreenDesc,pRestrictToOutput,ppSwapChain) ) + +#define IDXGIFactory7_CreateSwapChainForCoreWindow(This,pDevice,pWindow,pDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForCoreWindow(This,pDevice,pWindow,pDesc,pRestrictToOutput,ppSwapChain) ) + +#define IDXGIFactory7_GetSharedResourceAdapterLuid(This,hResource,pLuid) \ + ( (This)->lpVtbl -> GetSharedResourceAdapterLuid(This,hResource,pLuid) ) + +#define IDXGIFactory7_RegisterStereoStatusWindow(This,WindowHandle,wMsg,pdwCookie) \ + ( (This)->lpVtbl -> RegisterStereoStatusWindow(This,WindowHandle,wMsg,pdwCookie) ) + +#define IDXGIFactory7_RegisterStereoStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterStereoStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory7_UnregisterStereoStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterStereoStatus(This,dwCookie) ) + +#define IDXGIFactory7_RegisterOcclusionStatusWindow(This,WindowHandle,wMsg,pdwCookie) \ + ( (This)->lpVtbl -> RegisterOcclusionStatusWindow(This,WindowHandle,wMsg,pdwCookie) ) + +#define IDXGIFactory7_RegisterOcclusionStatusEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterOcclusionStatusEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory7_UnregisterOcclusionStatus(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterOcclusionStatus(This,dwCookie) ) + +#define IDXGIFactory7_CreateSwapChainForComposition(This,pDevice,pDesc,pRestrictToOutput,ppSwapChain) \ + ( (This)->lpVtbl -> CreateSwapChainForComposition(This,pDevice,pDesc,pRestrictToOutput,ppSwapChain) ) + + +#define IDXGIFactory7_GetCreationFlags(This) \ + ( (This)->lpVtbl -> GetCreationFlags(This) ) + + +#define IDXGIFactory7_EnumAdapterByLuid(This,AdapterLuid,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumAdapterByLuid(This,AdapterLuid,riid,ppvAdapter) ) + +#define IDXGIFactory7_EnumWarpAdapter(This,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumWarpAdapter(This,riid,ppvAdapter) ) + + +#define IDXGIFactory7_CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) \ + ( (This)->lpVtbl -> CheckFeatureSupport(This,Feature,pFeatureSupportData,FeatureSupportDataSize) ) + + +#define IDXGIFactory7_EnumAdapterByGpuPreference(This,Adapter,GpuPreference,riid,ppvAdapter) \ + ( (This)->lpVtbl -> EnumAdapterByGpuPreference(This,Adapter,GpuPreference,riid,ppvAdapter) ) + + +#define IDXGIFactory7_RegisterAdaptersChangedEvent(This,hEvent,pdwCookie) \ + ( (This)->lpVtbl -> RegisterAdaptersChangedEvent(This,hEvent,pdwCookie) ) + +#define IDXGIFactory7_UnregisterAdaptersChangedEvent(This,dwCookie) \ + ( (This)->lpVtbl -> UnregisterAdaptersChangedEvent(This,dwCookie) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDXGIFactory7_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxgi1_6_0000_0004 */ +/* [local] */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ +// BK - pragma endregion +DEFINE_GUID(IID_IDXGIAdapter4,0x3c8d99d1,0x4fbf,0x4181,0xa8,0x2c,0xaf,0x66,0xbf,0x7b,0xd2,0x4e); +DEFINE_GUID(IID_IDXGIOutput6,0x068346e8,0xaaec,0x4b84,0xad,0xd7,0x13,0x7f,0x51,0x3f,0x77,0xa1); +DEFINE_GUID(IID_IDXGIFactory6,0xc1b6694f,0xff09,0x44a9,0xb0,0x3c,0x77,0x90,0x0a,0x0a,0x1d,0x17); +DEFINE_GUID(IID_IDXGIFactory7,0xa4966eed,0x76db,0x44da,0x84,0xc1,0xee,0x9a,0x7a,0xfb,0x20,0xa8); + + +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0004_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxgi1_6_0000_0004_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgicommon.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgicommon.h new file mode 100644 index 00000000000..d6fed0fac74 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgicommon.h @@ -0,0 +1,51 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// + +#ifndef __dxgicommon_h__ +#define __dxgicommon_h__ + + +typedef struct DXGI_RATIONAL +{ + UINT Numerator; + UINT Denominator; +} DXGI_RATIONAL; + +// The following values are used with DXGI_SAMPLE_DESC::Quality: +#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff +#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe + +typedef struct DXGI_SAMPLE_DESC +{ + UINT Count; + UINT Quality; +} DXGI_SAMPLE_DESC; + +typedef enum DXGI_COLOR_SPACE_TYPE +{ + DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0, + DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1, + DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2, + DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3, + DXGI_COLOR_SPACE_RESERVED = 4, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10, + DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11, + DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13, + DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15, + DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16, + DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17, + DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18, + DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19, + DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF +} DXGI_COLOR_SPACE_TYPE; + +#endif // __dxgicommon_h__ + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgidebug.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgidebug.h index 9ed929c1287..f50d0fd4503 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgidebug.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgidebug.h @@ -3,7 +3,7 @@ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ - /* File created by MIDL compiler version 8.00.0613 */ + /* File created by MIDL compiler version 8.01.0622 */ /* @@MIDL_FILE_HEADING( ) */ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgitype.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgitype.h index 8cb92ee99b6..8ea984f97fd 100644 --- a/3rdparty/bgfx/3rdparty/dxsdk/include/dxgitype.h +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxgitype.h @@ -4,6 +4,7 @@ #ifndef __dxgitype_h__ #define __dxgitype_h__ +#include "dxgicommon.h" #include "dxgiformat.h" #define _FACDXGI 0x87a @@ -33,7 +34,8 @@ # define DXGI_ERROR_NOT_CURRENTLY_AVAILABLE MAKE_DXGI_HRESULT(34) # define DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED MAKE_DXGI_HRESULT(35) # define DXGI_ERROR_REMOTE_OUTOFMEMORY MAKE_DXGI_HRESULT(36) -#endif // defined(__MINGW32__) || (_WIN32_WINNT < 0x0601) +#endif // for MINGW , winerror.h doesn't define DXGI error. +// DXGI error messages have moved to winerror.h #define DXGI_CPU_ACCESS_NONE ( 0 ) #define DXGI_CPU_ACCESS_DYNAMIC ( 1 ) @@ -78,12 +80,6 @@ typedef struct DXGI_GAMMA_CONTROL_CAPABILITIES float ControlPointPositions[1025]; } DXGI_GAMMA_CONTROL_CAPABILITIES; -typedef struct DXGI_RATIONAL -{ - UINT Numerator; - UINT Denominator; -} DXGI_RATIONAL; - typedef enum DXGI_MODE_SCANLINE_ORDER { DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, @@ -118,33 +114,6 @@ typedef struct DXGI_MODE_DESC DXGI_MODE_SCALING Scaling; } DXGI_MODE_DESC; -// The following values are used with DXGI_SAMPLE_DESC::Quality: -#define DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN 0xffffffff -#define DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN 0xfffffffe - -typedef struct DXGI_SAMPLE_DESC -{ - UINT Count; - UINT Quality; -} DXGI_SAMPLE_DESC; - -typedef enum DXGI_COLOR_SPACE_TYPE -{ - DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0, - DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2, - DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3, - DXGI_COLOR_SPACE_RESERVED = 4, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9, - DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10, - DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11, - DXGI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF -} DXGI_COLOR_SPACE_TYPE; - typedef struct DXGI_JPEG_DC_HUFFMAN_TABLE { BYTE CodeCounts[12]; diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/dxva2api.h b/3rdparty/bgfx/3rdparty/dxsdk/include/dxva2api.h new file mode 100644 index 00000000000..167d18c486e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/dxva2api.h @@ -0,0 +1,1945 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* @@MIDL_FILE_HEADING( ) */ + + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 500 +#endif + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCSAL_H_VERSION__ +#define __REQUIRED_RPCSAL_H_VERSION__ 100 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCNDR_H_VERSION__ */ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __dxva2api_h__ +#define __dxva2api_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDirect3DDeviceManager9_FWD_DEFINED__ +#define __IDirect3DDeviceManager9_FWD_DEFINED__ +typedef interface IDirect3DDeviceManager9 IDirect3DDeviceManager9; + +#endif /* __IDirect3DDeviceManager9_FWD_DEFINED__ */ + + +#ifndef __IDirectXVideoAccelerationService_FWD_DEFINED__ +#define __IDirectXVideoAccelerationService_FWD_DEFINED__ +typedef interface IDirectXVideoAccelerationService IDirectXVideoAccelerationService; + +#endif /* __IDirectXVideoAccelerationService_FWD_DEFINED__ */ + + +#ifndef __IDirectXVideoDecoderService_FWD_DEFINED__ +#define __IDirectXVideoDecoderService_FWD_DEFINED__ +typedef interface IDirectXVideoDecoderService IDirectXVideoDecoderService; + +#endif /* __IDirectXVideoDecoderService_FWD_DEFINED__ */ + + +#ifndef __IDirectXVideoProcessorService_FWD_DEFINED__ +#define __IDirectXVideoProcessorService_FWD_DEFINED__ +typedef interface IDirectXVideoProcessorService IDirectXVideoProcessorService; + +#endif /* __IDirectXVideoProcessorService_FWD_DEFINED__ */ + + +#ifndef __IDirectXVideoDecoder_FWD_DEFINED__ +#define __IDirectXVideoDecoder_FWD_DEFINED__ +typedef interface IDirectXVideoDecoder IDirectXVideoDecoder; + +#endif /* __IDirectXVideoDecoder_FWD_DEFINED__ */ + + +#ifndef __IDirectXVideoProcessor_FWD_DEFINED__ +#define __IDirectXVideoProcessor_FWD_DEFINED__ +typedef interface IDirectXVideoProcessor IDirectXVideoProcessor; + +#endif /* __IDirectXVideoProcessor_FWD_DEFINED__ */ + + +#ifndef __IDirectXVideoMemoryConfiguration_FWD_DEFINED__ +#define __IDirectXVideoMemoryConfiguration_FWD_DEFINED__ +typedef interface IDirectXVideoMemoryConfiguration IDirectXVideoMemoryConfiguration; + +#endif /* __IDirectXVideoMemoryConfiguration_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "unknwn.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +/* interface __MIDL_itf_dxva2api_0000_0000 */ +/* [local] */ + +// +// The following declarations within the 'if 0' block are dummy typedefs used to make +// the evr.idl file build. The actual definitions are contained in d3d9.h +// +#if 0 +typedef DWORD IDirect3DDevice9; + +typedef DWORD IDirect3DSurface9; + +typedef DWORD D3DFORMAT; + +typedef DWORD D3DPOOL; + +#endif +#ifndef DXVA2_API_DEFINED +#define DXVA2_API_DEFINED +DEFINE_GUID(DXVA2_ModeMPEG2_MoComp, 0xe6a9f44b, 0x61b0, 0x4563,0x9e,0xa4,0x63,0xd2,0xa3,0xc6,0xfe,0x66); +DEFINE_GUID(DXVA2_ModeMPEG2_IDCT, 0xbf22ad00, 0x03ea, 0x4690,0x80,0x77,0x47,0x33,0x46,0x20,0x9b,0x7e); +DEFINE_GUID(DXVA2_ModeMPEG2_VLD, 0xee27417f, 0x5e28, 0x4e65,0xbe,0xea,0x1d,0x26,0xb5,0x08,0xad,0xc9); +DEFINE_GUID(DXVA2_ModeMPEG1_VLD, 0x6f3ec719, 0x3735, 0x42cc,0x80,0x63,0x65,0xcc,0x3c,0xb3,0x66,0x16); +DEFINE_GUID(DXVA2_ModeMPEG2and1_VLD,0x86695f12, 0x340e, 0x4f04,0x9f,0xd3,0x92,0x53,0xdd,0x32,0x74,0x60); +DEFINE_GUID(DXVA2_ModeH264_A, 0x1b81be64, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_B, 0x1b81be65, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_C, 0x1b81be66, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_D, 0x1b81be67, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_E, 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_F, 0x1b81be69, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeH264_VLD_WithFMOASO_NoFGT, 0xd5f04ff9, 0x3418,0x45d8,0x95,0x61,0x32,0xa7,0x6a,0xae,0x2d,0xdd); +DEFINE_GUID(DXVA2_ModeH264_VLD_Stereo_Progressive_NoFGT, 0xd79be8da, 0x0cf1,0x4c81,0xb8,0x2a,0x69,0xa4,0xe2,0x36,0xf4,0x3d); +DEFINE_GUID(DXVA2_ModeH264_VLD_Stereo_NoFGT, 0xf9aaccbb, 0xc2b6,0x4cfc,0x87,0x79,0x57,0x07,0xb1,0x76,0x05,0x52); +DEFINE_GUID(DXVA2_ModeH264_VLD_Multiview_NoFGT, 0x705b9d82, 0x76cf,0x49d6,0xb7,0xe6,0xac,0x88,0x72,0xdb,0x01,0x3c); +DEFINE_GUID(DXVA2_ModeWMV8_A, 0x1b81be80, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeWMV8_B, 0x1b81be81, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeWMV9_A, 0x1b81be90, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeWMV9_B, 0x1b81be91, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeWMV9_C, 0x1b81be94, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeVC1_A, 0x1b81beA0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeVC1_B, 0x1b81beA1, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeVC1_C, 0x1b81beA2, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeVC1_D, 0x1b81beA3, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_ModeVC1_D2010,0x1b81beA4, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_NoEncrypt, 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5); +DEFINE_GUID(DXVA2_VideoProcProgressiveDevice, 0x5a54a0c9,0xc7ec,0x4bd9,0x8e,0xde,0xf3,0xc7,0x5d,0xc4,0x39,0x3b); +DEFINE_GUID(DXVA2_VideoProcBobDevice, 0x335aa36e,0x7884,0x43a4,0x9c,0x91,0x7f,0x87,0xfa,0xf3,0xe3,0x7e); +DEFINE_GUID(DXVA2_VideoProcSoftwareDevice, 0x4553d47f,0xee7e,0x4e3f,0x94,0x75,0xdb,0xf1,0x37,0x6c,0x48,0x10); +DEFINE_GUID(DXVA2_ModeMPEG4pt2_VLD_Simple, 0xefd64d74, 0xc9e8,0x41d7,0xa5,0xe9,0xe9,0xb0,0xe3,0x9f,0xa3,0x19); +DEFINE_GUID(DXVA2_ModeMPEG4pt2_VLD_AdvSimple_NoGMC, 0xed418a9f, 0x010d,0x4eda,0x9a,0xe3,0x9a,0x65,0x35,0x8d,0x8d,0x2e); +DEFINE_GUID(DXVA2_ModeMPEG4pt2_VLD_AdvSimple_GMC, 0xab998b5b, 0x4258,0x44a9,0x9f,0xeb,0x94,0xe5,0x97,0xa6,0xba,0xae); +DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main, 0x5b11d51b, 0x2f4c,0x4452,0xbc,0xc3,0x09,0xf2,0xa1,0x16,0x0c,0xc0); +DEFINE_GUID(DXVA2_ModeHEVC_VLD_Main10, 0x107af0e0, 0xef1a,0x4d19,0xab,0xa8,0x67,0xa1,0x63,0x07,0x3d,0x13); +DEFINE_GUID(DXVA2_ModeVP9_VLD_Profile0, 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e); +DEFINE_GUID(DXVA2_ModeVP9_VLD_10bit_Profile2, 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7); +DEFINE_GUID(DXVA2_ModeVP8_VLD, 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7); +#define DXVA2_ModeMPEG2_MOCOMP DXVA2_ModeMPEG2_MoComp +#define DXVA2_ModeWMV8_PostProc DXVA2_ModeWMV8_A +#define DXVA2_ModeWMV8_MoComp DXVA2_ModeWMV8_B +#define DXVA2_ModeWMV9_PostProc DXVA2_ModeWMV9_A +#define DXVA2_ModeWMV9_MoComp DXVA2_ModeWMV9_B +#define DXVA2_ModeWMV9_IDCT DXVA2_ModeWMV9_C +#define DXVA2_ModeVC1_PostProc DXVA2_ModeVC1_A +#define DXVA2_ModeVC1_MoComp DXVA2_ModeVC1_B +#define DXVA2_ModeVC1_IDCT DXVA2_ModeVC1_C +#define DXVA2_ModeVC1_VLD DXVA2_ModeVC1_D +#define DXVA2_ModeH264_MoComp_NoFGT DXVA2_ModeH264_A +#define DXVA2_ModeH264_MoComp_FGT DXVA2_ModeH264_B +#define DXVA2_ModeH264_IDCT_NoFGT DXVA2_ModeH264_C +#define DXVA2_ModeH264_IDCT_FGT DXVA2_ModeH264_D +#define DXVA2_ModeH264_VLD_NoFGT DXVA2_ModeH264_E +#define DXVA2_ModeH264_VLD_FGT DXVA2_ModeH264_F +#define DXVA2_E_NOT_INITIALIZED ((HRESULT)0x80041000L) +#define DXVA2_E_NEW_VIDEO_DEVICE ((HRESULT)0x80041001L) +#define DXVA2_E_VIDEO_DEVICE_LOCKED ((HRESULT)0x80041002L) +#define DXVA2_E_NOT_AVAILABLE ((HRESULT)0x80041003L) +#if defined(_WIN32) && !defined(_NO_COM) +DEFINE_GUID(IID_IDirect3DDeviceManager9, 0xa0cade0f,0x06d5,0x4cf4,0xa1,0xc7,0xf3,0xcd,0xd7,0x25,0xaa,0x75); +DEFINE_GUID(IID_IDirectXVideoAccelerationService, 0xfc51a550,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); +DEFINE_GUID(IID_IDirectXVideoDecoderService, 0xfc51a551,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); +DEFINE_GUID(IID_IDirectXVideoProcessorService, 0xfc51a552,0xd5e7,0x11d9,0xaf,0x55,0x00,0x05,0x4e,0x43,0xff,0x02); +DEFINE_GUID(IID_IDirectXVideoDecoder, 0xf2b0810a,0xfd00,0x43c9,0x91,0x8c,0xdf,0x94,0xe2,0xd8,0xef,0x7d); +DEFINE_GUID(IID_IDirectXVideoProcessor, 0x8c3a39f0,0x916e,0x4690,0x80,0x4f,0x4c,0x80,0x01,0x35,0x5d,0x25); +DEFINE_GUID(IID_IDirectXVideoMemoryConfiguration, 0xb7f916dd,0xdb3b,0x49c1,0x84,0xd7,0xe4,0x5e,0xf9,0x9e,0xc7,0x26); +#endif +#ifndef MAX_DEINTERLACE_SURFACES +#define MAX_DEINTERLACE_SURFACES 32 +#endif +#ifndef MAX_SUBSTREAMS +#define MAX_SUBSTREAMS 15 +#endif +#pragma warning( push ) +#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union +typedef struct _DXVA2_ExtendedFormat + { + union + { + struct + { + UINT SampleFormat : 8; + UINT VideoChromaSubsampling : 4; + UINT NominalRange : 3; + UINT VideoTransferMatrix : 3; + UINT VideoLighting : 4; + UINT VideoPrimaries : 5; + UINT VideoTransferFunction : 5; + } ; + UINT value; + } ; + } DXVA2_ExtendedFormat; + +#pragma warning( pop ) +typedef +enum _DXVA2_SampleFormat + { + DXVA2_SampleFormatMask = 0xff, + DXVA2_SampleUnknown = 0, + DXVA2_SampleProgressiveFrame = 2, + DXVA2_SampleFieldInterleavedEvenFirst = 3, + DXVA2_SampleFieldInterleavedOddFirst = 4, + DXVA2_SampleFieldSingleEven = 5, + DXVA2_SampleFieldSingleOdd = 6, + DXVA2_SampleSubStream = 7 + } DXVA2_SampleFormat; + +typedef +enum _DXVA2_VideoChromaSubSampling + { + DXVA2_VideoChromaSubsamplingMask = 0xf, + DXVA2_VideoChromaSubsampling_Unknown = 0, + DXVA2_VideoChromaSubsampling_ProgressiveChroma = 0x8, + DXVA2_VideoChromaSubsampling_Horizontally_Cosited = 0x4, + DXVA2_VideoChromaSubsampling_Vertically_Cosited = 0x2, + DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes = 0x1, + DXVA2_VideoChromaSubsampling_MPEG2 = ( DXVA2_VideoChromaSubsampling_Horizontally_Cosited | DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes ) , + DXVA2_VideoChromaSubsampling_MPEG1 = DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes, + DXVA2_VideoChromaSubsampling_DV_PAL = ( DXVA2_VideoChromaSubsampling_Horizontally_Cosited | DXVA2_VideoChromaSubsampling_Vertically_Cosited ) , + DXVA2_VideoChromaSubsampling_Cosited = ( ( DXVA2_VideoChromaSubsampling_Horizontally_Cosited | DXVA2_VideoChromaSubsampling_Vertically_Cosited ) | DXVA2_VideoChromaSubsampling_Vertically_AlignedChromaPlanes ) + } DXVA2_VideoChromaSubSampling; + +typedef +enum _DXVA2_NominalRange + { + DXVA2_NominalRangeMask = 0x7, + DXVA2_NominalRange_Unknown = 0, + DXVA2_NominalRange_Normal = 1, + DXVA2_NominalRange_Wide = 2, + DXVA2_NominalRange_0_255 = 1, + DXVA2_NominalRange_16_235 = 2, + DXVA2_NominalRange_48_208 = 3 + } DXVA2_NominalRange; + +typedef +enum _DXVA2_VideoTransferMatrix + { + DXVA2_VideoTransferMatrixMask = 0x7, + DXVA2_VideoTransferMatrix_Unknown = 0, + DXVA2_VideoTransferMatrix_BT709 = 1, + DXVA2_VideoTransferMatrix_BT601 = 2, + DXVA2_VideoTransferMatrix_SMPTE240M = 3 + } DXVA2_VideoTransferMatrix; + +typedef +enum _DXVA2_VideoLighting + { + DXVA2_VideoLightingMask = 0xf, + DXVA2_VideoLighting_Unknown = 0, + DXVA2_VideoLighting_bright = 1, + DXVA2_VideoLighting_office = 2, + DXVA2_VideoLighting_dim = 3, + DXVA2_VideoLighting_dark = 4 + } DXVA2_VideoLighting; + +typedef +enum _DXVA2_VideoPrimaries + { + DXVA2_VideoPrimariesMask = 0x1f, + DXVA2_VideoPrimaries_Unknown = 0, + DXVA2_VideoPrimaries_reserved = 1, + DXVA2_VideoPrimaries_BT709 = 2, + DXVA2_VideoPrimaries_BT470_2_SysM = 3, + DXVA2_VideoPrimaries_BT470_2_SysBG = 4, + DXVA2_VideoPrimaries_SMPTE170M = 5, + DXVA2_VideoPrimaries_SMPTE240M = 6, + DXVA2_VideoPrimaries_EBU3213 = 7, + DXVA2_VideoPrimaries_SMPTE_C = 8 + } DXVA2_VideoPrimaries; + +typedef +enum _DXVA2_VideoTransferFunction + { + DXVA2_VideoTransFuncMask = 0x1f, + DXVA2_VideoTransFunc_Unknown = 0, + DXVA2_VideoTransFunc_10 = 1, + DXVA2_VideoTransFunc_18 = 2, + DXVA2_VideoTransFunc_20 = 3, + DXVA2_VideoTransFunc_22 = 4, + DXVA2_VideoTransFunc_709 = 5, + DXVA2_VideoTransFunc_240M = 6, + DXVA2_VideoTransFunc_sRGB = 7, + DXVA2_VideoTransFunc_28 = 8 + } DXVA2_VideoTransferFunction; + +// +// Deprecated labels - please use the ones in the DXVA2_VideoTransferFunction enum. +// +#define DXVA2_VideoTransFunc_22_709 DXVA2_VideoTransFunc_709 +#define DXVA2_VideoTransFunc_22_240M DXVA2_VideoTransFunc_240M +#define DXVA2_VideoTransFunc_22_8bit_sRGB DXVA2_VideoTransFunc_sRGB +typedef struct _DXVA2_Frequency + { + UINT Numerator; + UINT Denominator; + } DXVA2_Frequency; + +typedef struct _DXVA2_VideoDesc + { + UINT SampleWidth; + UINT SampleHeight; + DXVA2_ExtendedFormat SampleFormat; + D3DFORMAT Format; + DXVA2_Frequency InputSampleFreq; + DXVA2_Frequency OutputFrameFreq; + UINT UABProtectionLevel; + UINT Reserved; + } DXVA2_VideoDesc; + + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0003 + { + DXVA2_DeinterlaceTech_Unknown = 0, + DXVA2_DeinterlaceTech_BOBLineReplicate = 0x1, + DXVA2_DeinterlaceTech_BOBVerticalStretch = 0x2, + DXVA2_DeinterlaceTech_BOBVerticalStretch4Tap = 0x4, + DXVA2_DeinterlaceTech_MedianFiltering = 0x8, + DXVA2_DeinterlaceTech_EdgeFiltering = 0x10, + DXVA2_DeinterlaceTech_FieldAdaptive = 0x20, + DXVA2_DeinterlaceTech_PixelAdaptive = 0x40, + DXVA2_DeinterlaceTech_MotionVectorSteered = 0x80, + DXVA2_DeinterlaceTech_InverseTelecine = 0x100, + DXVA2_DeinterlaceTech_Mask = 0x1ff + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0004 + { + DXVA2_NoiseFilterLumaLevel = 1, + DXVA2_NoiseFilterLumaThreshold = 2, + DXVA2_NoiseFilterLumaRadius = 3, + DXVA2_NoiseFilterChromaLevel = 4, + DXVA2_NoiseFilterChromaThreshold = 5, + DXVA2_NoiseFilterChromaRadius = 6, + DXVA2_DetailFilterLumaLevel = 7, + DXVA2_DetailFilterLumaThreshold = 8, + DXVA2_DetailFilterLumaRadius = 9, + DXVA2_DetailFilterChromaLevel = 10, + DXVA2_DetailFilterChromaThreshold = 11, + DXVA2_DetailFilterChromaRadius = 12 + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0005 + { + DXVA2_NoiseFilterTech_Unsupported = 0, + DXVA2_NoiseFilterTech_Unknown = 0x1, + DXVA2_NoiseFilterTech_Median = 0x2, + DXVA2_NoiseFilterTech_Temporal = 0x4, + DXVA2_NoiseFilterTech_BlockNoise = 0x8, + DXVA2_NoiseFilterTech_MosquitoNoise = 0x10, + DXVA2_NoiseFilterTech_Mask = 0x1f + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0006 + { + DXVA2_DetailFilterTech_Unsupported = 0, + DXVA2_DetailFilterTech_Unknown = 0x1, + DXVA2_DetailFilterTech_Edge = 0x2, + DXVA2_DetailFilterTech_Sharpening = 0x4, + DXVA2_DetailFilterTech_Mask = 0x7 + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0007 + { + DXVA2_ProcAmp_None = 0, + DXVA2_ProcAmp_Brightness = 0x1, + DXVA2_ProcAmp_Contrast = 0x2, + DXVA2_ProcAmp_Hue = 0x4, + DXVA2_ProcAmp_Saturation = 0x8, + DXVA2_ProcAmp_Mask = 0xf + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0008 + { + DXVA2_VideoProcess_None = 0, + DXVA2_VideoProcess_YUV2RGB = 0x1, + DXVA2_VideoProcess_StretchX = 0x2, + DXVA2_VideoProcess_StretchY = 0x4, + DXVA2_VideoProcess_AlphaBlend = 0x8, + DXVA2_VideoProcess_SubRects = 0x10, + DXVA2_VideoProcess_SubStreams = 0x20, + DXVA2_VideoProcess_SubStreamsExtended = 0x40, + DXVA2_VideoProcess_YUV2RGBExtended = 0x80, + DXVA2_VideoProcess_AlphaBlendExtended = 0x100, + DXVA2_VideoProcess_Constriction = 0x200, + DXVA2_VideoProcess_NoiseFilter = 0x400, + DXVA2_VideoProcess_DetailFilter = 0x800, + DXVA2_VideoProcess_PlanarAlpha = 0x1000, + DXVA2_VideoProcess_LinearScaling = 0x2000, + DXVA2_VideoProcess_GammaCompensated = 0x4000, + DXVA2_VideoProcess_MaintainsOriginalFieldData = 0x8000, + DXVA2_VideoProcess_Mask = 0xffff + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0009 + { + DXVA2_VPDev_HardwareDevice = 0x1, + DXVA2_VPDev_EmulatedDXVA1 = 0x2, + DXVA2_VPDev_SoftwareDevice = 0x4, + DXVA2_VPDev_Mask = 0x7 + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0010 + { + DXVA2_SampleData_RFF = 0x1, + DXVA2_SampleData_TFF = 0x2, + DXVA2_SampleData_RFF_TFF_Present = 0x4, + DXVA2_SampleData_Mask = 0xffff + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0011 + { + DXVA2_DestData_RFF = 0x1, + DXVA2_DestData_TFF = 0x2, + DXVA2_DestData_RFF_TFF_Present = 0x4, + DXVA2_DestData_Mask = 0xffff + } ; +typedef struct _DXVA2_VideoProcessorCaps + { + UINT DeviceCaps; + D3DPOOL InputPool; + UINT NumForwardRefSamples; + UINT NumBackwardRefSamples; + UINT Reserved; + UINT DeinterlaceTechnology; + UINT ProcAmpControlCaps; + UINT VideoProcessorOperations; + UINT NoiseFilterTechnology; + UINT DetailFilterTechnology; + } DXVA2_VideoProcessorCaps; + +#ifdef __midl +typedef LONG DXVA2_Fixed32; + +#else +#pragma warning( push ) +#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union +typedef struct _DXVA2_Fixed32 +{ + union { + struct { + USHORT Fraction; + SHORT Value; + }; + LONG ll; + }; +} DXVA2_Fixed32; +#pragma warning( pop ) +#endif +typedef struct _DXVA2_AYUVSample8 + { + UCHAR Cr; + UCHAR Cb; + UCHAR Y; + UCHAR Alpha; + } DXVA2_AYUVSample8; + +typedef struct _DXVA2_AYUVSample16 + { + USHORT Cr; + USHORT Cb; + USHORT Y; + USHORT Alpha; + } DXVA2_AYUVSample16; + +typedef LONGLONG REFERENCE_TIME; + +#if defined(_D3D9_H_) || defined(_d3d9P_H_) +typedef struct _DXVA2_VideoSample + { + REFERENCE_TIME Start; + REFERENCE_TIME End; + DXVA2_ExtendedFormat SampleFormat; + IDirect3DSurface9 *SrcSurface; + RECT SrcRect; + RECT DstRect; + DXVA2_AYUVSample8 Pal[ 16 ]; + DXVA2_Fixed32 PlanarAlpha; + DWORD SampleData; + } DXVA2_VideoSample; + +#endif // _D3D9_H_ +typedef struct _DXVA2_ValueRange + { + DXVA2_Fixed32 MinValue; + DXVA2_Fixed32 MaxValue; + DXVA2_Fixed32 DefaultValue; + DXVA2_Fixed32 StepSize; + } DXVA2_ValueRange; + +typedef struct _DXVA2_ProcAmpValues + { + DXVA2_Fixed32 Brightness; + DXVA2_Fixed32 Contrast; + DXVA2_Fixed32 Hue; + DXVA2_Fixed32 Saturation; + } DXVA2_ProcAmpValues; + +typedef struct _DXVA2_FilterValues + { + DXVA2_Fixed32 Level; + DXVA2_Fixed32 Threshold; + DXVA2_Fixed32 Radius; + } DXVA2_FilterValues; + +typedef struct _DXVA2_VideoProcessBltParams + { + REFERENCE_TIME TargetFrame; + RECT TargetRect; + SIZE ConstrictionSize; + UINT StreamingFlags; + DXVA2_AYUVSample16 BackgroundColor; + DXVA2_ExtendedFormat DestFormat; + DXVA2_ProcAmpValues ProcAmpValues; + DXVA2_Fixed32 Alpha; + DXVA2_FilterValues NoiseFilterLuma; + DXVA2_FilterValues NoiseFilterChroma; + DXVA2_FilterValues DetailFilterLuma; + DXVA2_FilterValues DetailFilterChroma; + DWORD DestData; + } DXVA2_VideoProcessBltParams; + + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0012 + { + DXVA2_PictureParametersBufferType = 0, + DXVA2_MacroBlockControlBufferType = 1, + DXVA2_ResidualDifferenceBufferType = 2, + DXVA2_DeblockingControlBufferType = 3, + DXVA2_InverseQuantizationMatrixBufferType = 4, + DXVA2_SliceControlBufferType = 5, + DXVA2_BitStreamDateBufferType = 6, + DXVA2_MotionVectorBuffer = 7, + DXVA2_FilmGrainBuffer = 8 + } ; + +enum __MIDL___MIDL_itf_dxva2api_0000_0000_0013 + { + DXVA2_VideoDecoderRenderTarget = 0, + DXVA2_VideoProcessorRenderTarget = 1, + DXVA2_VideoSoftwareRenderTarget = 2 + } ; +typedef struct _DXVA2_ConfigPictureDecode + { + GUID guidConfigBitstreamEncryption; + GUID guidConfigMBcontrolEncryption; + GUID guidConfigResidDiffEncryption; + UINT ConfigBitstreamRaw; + UINT ConfigMBcontrolRasterOrder; + UINT ConfigResidDiffHost; + UINT ConfigSpatialResid8; + UINT ConfigResid8Subtraction; + UINT ConfigSpatialHost8or9Clipping; + UINT ConfigSpatialResidInterleaved; + UINT ConfigIntraResidUnsigned; + UINT ConfigResidDiffAccelerator; + UINT ConfigHostInverseScan; + UINT ConfigSpecificIDCT; + UINT Config4GroupedCoefs; + USHORT ConfigMinRenderTargetBuffCount; + USHORT ConfigDecoderSpecific; + } DXVA2_ConfigPictureDecode; + +typedef struct _DXVA2_DecodeBufferDesc + { + DWORD CompressedBufferType; + UINT BufferIndex; + UINT DataOffset; + UINT DataSize; + UINT FirstMBaddress; + UINT NumMBsInBuffer; + UINT Width; + UINT Height; + UINT Stride; + UINT ReservedBits; + PVOID pvPVPState; + } DXVA2_DecodeBufferDesc; + +// The value in pvPVPState depends on the type of crypo used. For +// D3DCRYPTOTYPE_AES128_CTR, pvPState points to the following structure: + +typedef struct _DXVA2_AES_CTR_IV + { + UINT64 IV; + UINT64 Count; + } DXVA2_AES_CTR_IV; + +typedef struct _DXVA2_DecodeExtensionData + { + UINT Function; + PVOID pPrivateInputData; + UINT PrivateInputDataSize; + PVOID pPrivateOutputData; + UINT PrivateOutputDataSize; + } DXVA2_DecodeExtensionData; + +// DXVA2_DECODE_GET_DRIVER_HANDLE is an extension function that allows the +// driver to return a handle for the DXVA2 decode device that can be used to +// associate it with a IDirect3DCryptoSession9 interface. When this function +// is used: +// pPrivateInputData = NULL +// pPrivateInputDataSize = 0 +// pPrivateOutputData = HANDLE* +// pPrivateOutputDataSize = sizeof(HANDLE) +#define DXVA2_DECODE_GET_DRIVER_HANDLE 0x725 + +// DXVA2_DECODE_SPECIFY_ENCRYPTED_BLOCKS is an extension function that that allows +// the decoder to specify which portions of the compressed buffers are encrypted. +// If this fucntion is not used to specify this information, it is assumed that +// the entire buffer is encrypted. +// pPrivateInputData = D3DENCRYPTED_BLOCK_INFO*; +// PrivateInputDataSize = sizeof(D3DENCRYPTED_BLOCK_INFO); +// pPrivateOutputData = NULL; +// PrivateOutputDataSize = 0; +#define DXVA2_DECODE_SPECIFY_ENCRYPTED_BLOCKS 0x724 + +typedef struct _DXVA2_DecodeExecuteParams + { + UINT NumCompBuffers; + DXVA2_DecodeBufferDesc *pCompressedBuffers; + DXVA2_DecodeExtensionData *pExtensionData; + } DXVA2_DecodeExecuteParams; + +#if defined(_D3D9_H_) || defined(_d3d9P_H_) + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_dxva2api_0000_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxva2api_0000_0000_v0_0_s_ifspec; + +#ifndef __IDirect3DDeviceManager9_INTERFACE_DEFINED__ +#define __IDirect3DDeviceManager9_INTERFACE_DEFINED__ + +/* interface IDirect3DDeviceManager9 */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirect3DDeviceManager9; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("a0cade0f-06d5-4cf4-a1c7-f3cdd725aa75") + IDirect3DDeviceManager9 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ResetDevice( + /* [annotation][in] */ + _In_ IDirect3DDevice9 *pDevice, + /* [annotation][in] */ + _In_ UINT resetToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenDeviceHandle( + /* [annotation][out] */ + _Out_ HANDLE *phDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE CloseDeviceHandle( + /* [annotation][in] */ + _In_ HANDLE hDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE TestDevice( + /* [annotation][in] */ + _In_ HANDLE hDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE LockDevice( + /* [annotation][in] */ + _In_ HANDLE hDevice, + /* [annotation][out] */ + _Outptr_ IDirect3DDevice9 **ppDevice, + /* [annotation][in] */ + _In_ BOOL fBlock) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnlockDevice( + /* [annotation][in] */ + _In_ HANDLE hDevice, + /* [annotation][in] */ + _In_ BOOL fSaveState) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoService( + /* [annotation][in] */ + _In_ HANDLE hDevice, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][out] */ + _Outptr_ void **ppService) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirect3DDeviceManager9Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirect3DDeviceManager9 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirect3DDeviceManager9 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirect3DDeviceManager9 * This); + + HRESULT ( STDMETHODCALLTYPE *ResetDevice )( + IDirect3DDeviceManager9 * This, + /* [annotation][in] */ + _In_ IDirect3DDevice9 *pDevice, + /* [annotation][in] */ + _In_ UINT resetToken); + + HRESULT ( STDMETHODCALLTYPE *OpenDeviceHandle )( + IDirect3DDeviceManager9 * This, + /* [annotation][out] */ + _Out_ HANDLE *phDevice); + + HRESULT ( STDMETHODCALLTYPE *CloseDeviceHandle )( + IDirect3DDeviceManager9 * This, + /* [annotation][in] */ + _In_ HANDLE hDevice); + + HRESULT ( STDMETHODCALLTYPE *TestDevice )( + IDirect3DDeviceManager9 * This, + /* [annotation][in] */ + _In_ HANDLE hDevice); + + HRESULT ( STDMETHODCALLTYPE *LockDevice )( + IDirect3DDeviceManager9 * This, + /* [annotation][in] */ + _In_ HANDLE hDevice, + /* [annotation][out] */ + _Outptr_ IDirect3DDevice9 **ppDevice, + /* [annotation][in] */ + _In_ BOOL fBlock); + + HRESULT ( STDMETHODCALLTYPE *UnlockDevice )( + IDirect3DDeviceManager9 * This, + /* [annotation][in] */ + _In_ HANDLE hDevice, + /* [annotation][in] */ + _In_ BOOL fSaveState); + + HRESULT ( STDMETHODCALLTYPE *GetVideoService )( + IDirect3DDeviceManager9 * This, + /* [annotation][in] */ + _In_ HANDLE hDevice, + /* [annotation][in] */ + _In_ REFIID riid, + /* [annotation][out] */ + _Outptr_ void **ppService); + + END_INTERFACE + } IDirect3DDeviceManager9Vtbl; + + interface IDirect3DDeviceManager9 + { + CONST_VTBL struct IDirect3DDeviceManager9Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirect3DDeviceManager9_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirect3DDeviceManager9_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirect3DDeviceManager9_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirect3DDeviceManager9_ResetDevice(This,pDevice,resetToken) \ + ( (This)->lpVtbl -> ResetDevice(This,pDevice,resetToken) ) + +#define IDirect3DDeviceManager9_OpenDeviceHandle(This,phDevice) \ + ( (This)->lpVtbl -> OpenDeviceHandle(This,phDevice) ) + +#define IDirect3DDeviceManager9_CloseDeviceHandle(This,hDevice) \ + ( (This)->lpVtbl -> CloseDeviceHandle(This,hDevice) ) + +#define IDirect3DDeviceManager9_TestDevice(This,hDevice) \ + ( (This)->lpVtbl -> TestDevice(This,hDevice) ) + +#define IDirect3DDeviceManager9_LockDevice(This,hDevice,ppDevice,fBlock) \ + ( (This)->lpVtbl -> LockDevice(This,hDevice,ppDevice,fBlock) ) + +#define IDirect3DDeviceManager9_UnlockDevice(This,hDevice,fSaveState) \ + ( (This)->lpVtbl -> UnlockDevice(This,hDevice,fSaveState) ) + +#define IDirect3DDeviceManager9_GetVideoService(This,hDevice,riid,ppService) \ + ( (This)->lpVtbl -> GetVideoService(This,hDevice,riid,ppService) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirect3DDeviceManager9_INTERFACE_DEFINED__ */ + + +#ifndef __IDirectXVideoAccelerationService_INTERFACE_DEFINED__ +#define __IDirectXVideoAccelerationService_INTERFACE_DEFINED__ + +/* interface IDirectXVideoAccelerationService */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirectXVideoAccelerationService; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("fc51a550-d5e7-11d9-af55-00054e43ff02") + IDirectXVideoAccelerationService : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CreateSurface( + /* [annotation][in] */ + _In_ UINT Width, + /* [annotation][in] */ + _In_ UINT Height, + /* [annotation][in] */ + _In_ UINT BackBuffers, + /* [annotation][in] */ + _In_ D3DFORMAT Format, + /* [annotation][in] */ + _In_ D3DPOOL Pool, + /* [annotation][in] */ + _In_ DWORD Usage, + /* [annotation][in] */ + _In_ DWORD DxvaType, + /* [annotation][size_is][out] */ + _Out_writes_(BackBuffers+1) IDirect3DSurface9 **ppSurface, + /* [annotation][out][in] */ + _Inout_opt_ HANDLE *pSharedHandle) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirectXVideoAccelerationServiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirectXVideoAccelerationService * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirectXVideoAccelerationService * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirectXVideoAccelerationService * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDirectXVideoAccelerationService * This, + /* [annotation][in] */ + _In_ UINT Width, + /* [annotation][in] */ + _In_ UINT Height, + /* [annotation][in] */ + _In_ UINT BackBuffers, + /* [annotation][in] */ + _In_ D3DFORMAT Format, + /* [annotation][in] */ + _In_ D3DPOOL Pool, + /* [annotation][in] */ + _In_ DWORD Usage, + /* [annotation][in] */ + _In_ DWORD DxvaType, + /* [annotation][size_is][out] */ + _Out_writes_(BackBuffers+1) IDirect3DSurface9 **ppSurface, + /* [annotation][out][in] */ + _Inout_opt_ HANDLE *pSharedHandle); + + END_INTERFACE + } IDirectXVideoAccelerationServiceVtbl; + + interface IDirectXVideoAccelerationService + { + CONST_VTBL struct IDirectXVideoAccelerationServiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirectXVideoAccelerationService_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirectXVideoAccelerationService_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirectXVideoAccelerationService_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirectXVideoAccelerationService_CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) \ + ( (This)->lpVtbl -> CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirectXVideoAccelerationService_INTERFACE_DEFINED__ */ + + +#ifndef __IDirectXVideoDecoderService_INTERFACE_DEFINED__ +#define __IDirectXVideoDecoderService_INTERFACE_DEFINED__ + +/* interface IDirectXVideoDecoderService */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirectXVideoDecoderService; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("fc51a551-d5e7-11d9-af55-00054e43ff02") + IDirectXVideoDecoderService : public IDirectXVideoAccelerationService + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDecoderDeviceGuids( + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) GUID **pGuids) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDecoderRenderTargets( + /* [annotation][in] */ + _In_ REFGUID Guid, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) D3DFORMAT **pFormats) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDecoderConfigurations( + /* [annotation][in] */ + _In_ REFGUID Guid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _Reserved_ void *pReserved, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) DXVA2_ConfigPictureDecode **ppConfigs) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoDecoder( + /* [annotation][in] */ + _In_ REFGUID Guid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ const DXVA2_ConfigPictureDecode *pConfig, + /* [annotation][size_is][in] */ + _In_reads_(NumRenderTargets) IDirect3DSurface9 **ppDecoderRenderTargets, + /* [annotation][in] */ + _In_ UINT NumRenderTargets, + /* [annotation][out] */ + _Outptr_ IDirectXVideoDecoder **ppDecode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirectXVideoDecoderServiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirectXVideoDecoderService * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirectXVideoDecoderService * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirectXVideoDecoderService * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDirectXVideoDecoderService * This, + /* [annotation][in] */ + _In_ UINT Width, + /* [annotation][in] */ + _In_ UINT Height, + /* [annotation][in] */ + _In_ UINT BackBuffers, + /* [annotation][in] */ + _In_ D3DFORMAT Format, + /* [annotation][in] */ + _In_ D3DPOOL Pool, + /* [annotation][in] */ + _In_ DWORD Usage, + /* [annotation][in] */ + _In_ DWORD DxvaType, + /* [annotation][size_is][out] */ + _Out_writes_(BackBuffers+1) IDirect3DSurface9 **ppSurface, + /* [annotation][out][in] */ + _Inout_opt_ HANDLE *pSharedHandle); + + HRESULT ( STDMETHODCALLTYPE *GetDecoderDeviceGuids )( + IDirectXVideoDecoderService * This, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) GUID **pGuids); + + HRESULT ( STDMETHODCALLTYPE *GetDecoderRenderTargets )( + IDirectXVideoDecoderService * This, + /* [annotation][in] */ + _In_ REFGUID Guid, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) D3DFORMAT **pFormats); + + HRESULT ( STDMETHODCALLTYPE *GetDecoderConfigurations )( + IDirectXVideoDecoderService * This, + /* [annotation][in] */ + _In_ REFGUID Guid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _Reserved_ void *pReserved, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) DXVA2_ConfigPictureDecode **ppConfigs); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoDecoder )( + IDirectXVideoDecoderService * This, + /* [annotation][in] */ + _In_ REFGUID Guid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ const DXVA2_ConfigPictureDecode *pConfig, + /* [annotation][size_is][in] */ + _In_reads_(NumRenderTargets) IDirect3DSurface9 **ppDecoderRenderTargets, + /* [annotation][in] */ + _In_ UINT NumRenderTargets, + /* [annotation][out] */ + _Outptr_ IDirectXVideoDecoder **ppDecode); + + END_INTERFACE + } IDirectXVideoDecoderServiceVtbl; + + interface IDirectXVideoDecoderService + { + CONST_VTBL struct IDirectXVideoDecoderServiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirectXVideoDecoderService_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirectXVideoDecoderService_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirectXVideoDecoderService_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirectXVideoDecoderService_CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) \ + ( (This)->lpVtbl -> CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) ) + + +#define IDirectXVideoDecoderService_GetDecoderDeviceGuids(This,pCount,pGuids) \ + ( (This)->lpVtbl -> GetDecoderDeviceGuids(This,pCount,pGuids) ) + +#define IDirectXVideoDecoderService_GetDecoderRenderTargets(This,Guid,pCount,pFormats) \ + ( (This)->lpVtbl -> GetDecoderRenderTargets(This,Guid,pCount,pFormats) ) + +#define IDirectXVideoDecoderService_GetDecoderConfigurations(This,Guid,pVideoDesc,pReserved,pCount,ppConfigs) \ + ( (This)->lpVtbl -> GetDecoderConfigurations(This,Guid,pVideoDesc,pReserved,pCount,ppConfigs) ) + +#define IDirectXVideoDecoderService_CreateVideoDecoder(This,Guid,pVideoDesc,pConfig,ppDecoderRenderTargets,NumRenderTargets,ppDecode) \ + ( (This)->lpVtbl -> CreateVideoDecoder(This,Guid,pVideoDesc,pConfig,ppDecoderRenderTargets,NumRenderTargets,ppDecode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirectXVideoDecoderService_INTERFACE_DEFINED__ */ + + +#ifndef __IDirectXVideoProcessorService_INTERFACE_DEFINED__ +#define __IDirectXVideoProcessorService_INTERFACE_DEFINED__ + +/* interface IDirectXVideoProcessorService */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirectXVideoProcessorService; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("fc51a552-d5e7-11d9-af55-00054e43ff02") + IDirectXVideoProcessorService : public IDirectXVideoAccelerationService + { + public: + virtual HRESULT STDMETHODCALLTYPE RegisterVideoProcessorSoftwareDevice( + /* [annotation][in] */ + _In_ void *pCallbacks) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorDeviceGuids( + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) GUID **pGuids) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorRenderTargets( + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) D3DFORMAT **pFormats) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorSubStreamFormats( + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) D3DFORMAT **pFormats) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorCaps( + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][out] */ + _Out_ DXVA2_VideoProcessorCaps *pCaps) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetProcAmpRange( + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][in] */ + _In_ UINT ProcAmpCap, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFilterPropertyRange( + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][in] */ + _In_ UINT FilterSetting, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoProcessor( + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][in] */ + _In_ UINT MaxNumSubStreams, + /* [annotation][out] */ + _Outptr_ IDirectXVideoProcessor **ppVidProcess) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirectXVideoProcessorServiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirectXVideoProcessorService * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirectXVideoProcessorService * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirectXVideoProcessorService * This); + + HRESULT ( STDMETHODCALLTYPE *CreateSurface )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ UINT Width, + /* [annotation][in] */ + _In_ UINT Height, + /* [annotation][in] */ + _In_ UINT BackBuffers, + /* [annotation][in] */ + _In_ D3DFORMAT Format, + /* [annotation][in] */ + _In_ D3DPOOL Pool, + /* [annotation][in] */ + _In_ DWORD Usage, + /* [annotation][in] */ + _In_ DWORD DxvaType, + /* [annotation][size_is][out] */ + _Out_writes_(BackBuffers+1) IDirect3DSurface9 **ppSurface, + /* [annotation][out][in] */ + _Inout_opt_ HANDLE *pSharedHandle); + + HRESULT ( STDMETHODCALLTYPE *RegisterVideoProcessorSoftwareDevice )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ void *pCallbacks); + + HRESULT ( STDMETHODCALLTYPE *GetVideoProcessorDeviceGuids )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) GUID **pGuids); + + HRESULT ( STDMETHODCALLTYPE *GetVideoProcessorRenderTargets )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) D3DFORMAT **pFormats); + + HRESULT ( STDMETHODCALLTYPE *GetVideoProcessorSubStreamFormats )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][out] */ + _Out_ UINT *pCount, + /* [annotation][size_is][unique][out] */ + _Outptr_result_buffer_maybenull_(*pCount) D3DFORMAT **pFormats); + + HRESULT ( STDMETHODCALLTYPE *GetVideoProcessorCaps )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][out] */ + _Out_ DXVA2_VideoProcessorCaps *pCaps); + + HRESULT ( STDMETHODCALLTYPE *GetProcAmpRange )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][in] */ + _In_ UINT ProcAmpCap, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange); + + HRESULT ( STDMETHODCALLTYPE *GetFilterPropertyRange )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][in] */ + _In_ UINT FilterSetting, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoProcessor )( + IDirectXVideoProcessorService * This, + /* [annotation][in] */ + _In_ REFGUID VideoProcDeviceGuid, + /* [annotation][in] */ + _In_ const DXVA2_VideoDesc *pVideoDesc, + /* [annotation][in] */ + _In_ D3DFORMAT RenderTargetFormat, + /* [annotation][in] */ + _In_ UINT MaxNumSubStreams, + /* [annotation][out] */ + _Outptr_ IDirectXVideoProcessor **ppVidProcess); + + END_INTERFACE + } IDirectXVideoProcessorServiceVtbl; + + interface IDirectXVideoProcessorService + { + CONST_VTBL struct IDirectXVideoProcessorServiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirectXVideoProcessorService_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirectXVideoProcessorService_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirectXVideoProcessorService_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirectXVideoProcessorService_CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) \ + ( (This)->lpVtbl -> CreateSurface(This,Width,Height,BackBuffers,Format,Pool,Usage,DxvaType,ppSurface,pSharedHandle) ) + + +#define IDirectXVideoProcessorService_RegisterVideoProcessorSoftwareDevice(This,pCallbacks) \ + ( (This)->lpVtbl -> RegisterVideoProcessorSoftwareDevice(This,pCallbacks) ) + +#define IDirectXVideoProcessorService_GetVideoProcessorDeviceGuids(This,pVideoDesc,pCount,pGuids) \ + ( (This)->lpVtbl -> GetVideoProcessorDeviceGuids(This,pVideoDesc,pCount,pGuids) ) + +#define IDirectXVideoProcessorService_GetVideoProcessorRenderTargets(This,VideoProcDeviceGuid,pVideoDesc,pCount,pFormats) \ + ( (This)->lpVtbl -> GetVideoProcessorRenderTargets(This,VideoProcDeviceGuid,pVideoDesc,pCount,pFormats) ) + +#define IDirectXVideoProcessorService_GetVideoProcessorSubStreamFormats(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,pCount,pFormats) \ + ( (This)->lpVtbl -> GetVideoProcessorSubStreamFormats(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,pCount,pFormats) ) + +#define IDirectXVideoProcessorService_GetVideoProcessorCaps(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,pCaps) \ + ( (This)->lpVtbl -> GetVideoProcessorCaps(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,pCaps) ) + +#define IDirectXVideoProcessorService_GetProcAmpRange(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,ProcAmpCap,pRange) \ + ( (This)->lpVtbl -> GetProcAmpRange(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,ProcAmpCap,pRange) ) + +#define IDirectXVideoProcessorService_GetFilterPropertyRange(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,FilterSetting,pRange) \ + ( (This)->lpVtbl -> GetFilterPropertyRange(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,FilterSetting,pRange) ) + +#define IDirectXVideoProcessorService_CreateVideoProcessor(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,MaxNumSubStreams,ppVidProcess) \ + ( (This)->lpVtbl -> CreateVideoProcessor(This,VideoProcDeviceGuid,pVideoDesc,RenderTargetFormat,MaxNumSubStreams,ppVidProcess) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirectXVideoProcessorService_INTERFACE_DEFINED__ */ + + +#ifndef __IDirectXVideoDecoder_INTERFACE_DEFINED__ +#define __IDirectXVideoDecoder_INTERFACE_DEFINED__ + +/* interface IDirectXVideoDecoder */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirectXVideoDecoder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f2b0810a-fd00-43c9-918c-df94e2d8ef7d") + IDirectXVideoDecoder : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetVideoDecoderService( + /* [annotation][out] */ + _Outptr_ IDirectXVideoDecoderService **ppService) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCreationParameters( + /* [annotation][out] */ + _Out_opt_ GUID *pDeviceGuid, + /* [annotation][out] */ + _Out_opt_ DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_opt_ DXVA2_ConfigPictureDecode *pConfig, + /* [annotation][size_is][unique][out] */ + _Out_writes_(*pNumSurfaces) IDirect3DSurface9 ***pDecoderRenderTargets, + /* [annotation][out] */ + _Out_opt_ UINT *pNumSurfaces) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBuffer( + /* [annotation][in] */ + _In_ UINT BufferType, + /* [annotation][out] */ + _Out_ void **ppBuffer, + /* [annotation][out] */ + _Out_ UINT *pBufferSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( + /* [annotation][in] */ + _In_ UINT BufferType) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginFrame( + /* [annotation][in] */ + _In_ IDirect3DSurface9 *pRenderTarget, + /* [annotation][in] */ + _In_opt_ void *pvPVPData) = 0; + + virtual HRESULT STDMETHODCALLTYPE EndFrame( + /* [annotation][out] */ + _Inout_opt_ HANDLE *pHandleComplete) = 0; + + virtual HRESULT STDMETHODCALLTYPE Execute( + /* [annotation][in] */ + _In_ const DXVA2_DecodeExecuteParams *pExecuteParams) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirectXVideoDecoderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirectXVideoDecoder * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirectXVideoDecoder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirectXVideoDecoder * This); + + HRESULT ( STDMETHODCALLTYPE *GetVideoDecoderService )( + IDirectXVideoDecoder * This, + /* [annotation][out] */ + _Outptr_ IDirectXVideoDecoderService **ppService); + + HRESULT ( STDMETHODCALLTYPE *GetCreationParameters )( + IDirectXVideoDecoder * This, + /* [annotation][out] */ + _Out_opt_ GUID *pDeviceGuid, + /* [annotation][out] */ + _Out_opt_ DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_opt_ DXVA2_ConfigPictureDecode *pConfig, + /* [annotation][size_is][unique][out] */ + _Out_writes_(*pNumSurfaces) IDirect3DSurface9 ***pDecoderRenderTargets, + /* [annotation][out] */ + _Out_opt_ UINT *pNumSurfaces); + + HRESULT ( STDMETHODCALLTYPE *GetBuffer )( + IDirectXVideoDecoder * This, + /* [annotation][in] */ + _In_ UINT BufferType, + /* [annotation][out] */ + _Out_ void **ppBuffer, + /* [annotation][out] */ + _Out_ UINT *pBufferSize); + + HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( + IDirectXVideoDecoder * This, + /* [annotation][in] */ + _In_ UINT BufferType); + + HRESULT ( STDMETHODCALLTYPE *BeginFrame )( + IDirectXVideoDecoder * This, + /* [annotation][in] */ + _In_ IDirect3DSurface9 *pRenderTarget, + /* [annotation][in] */ + _In_opt_ void *pvPVPData); + + HRESULT ( STDMETHODCALLTYPE *EndFrame )( + IDirectXVideoDecoder * This, + /* [annotation][out] */ + _Inout_opt_ HANDLE *pHandleComplete); + + HRESULT ( STDMETHODCALLTYPE *Execute )( + IDirectXVideoDecoder * This, + /* [annotation][in] */ + _In_ const DXVA2_DecodeExecuteParams *pExecuteParams); + + END_INTERFACE + } IDirectXVideoDecoderVtbl; + + interface IDirectXVideoDecoder + { + CONST_VTBL struct IDirectXVideoDecoderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirectXVideoDecoder_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirectXVideoDecoder_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirectXVideoDecoder_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirectXVideoDecoder_GetVideoDecoderService(This,ppService) \ + ( (This)->lpVtbl -> GetVideoDecoderService(This,ppService) ) + +#define IDirectXVideoDecoder_GetCreationParameters(This,pDeviceGuid,pVideoDesc,pConfig,pDecoderRenderTargets,pNumSurfaces) \ + ( (This)->lpVtbl -> GetCreationParameters(This,pDeviceGuid,pVideoDesc,pConfig,pDecoderRenderTargets,pNumSurfaces) ) + +#define IDirectXVideoDecoder_GetBuffer(This,BufferType,ppBuffer,pBufferSize) \ + ( (This)->lpVtbl -> GetBuffer(This,BufferType,ppBuffer,pBufferSize) ) + +#define IDirectXVideoDecoder_ReleaseBuffer(This,BufferType) \ + ( (This)->lpVtbl -> ReleaseBuffer(This,BufferType) ) + +#define IDirectXVideoDecoder_BeginFrame(This,pRenderTarget,pvPVPData) \ + ( (This)->lpVtbl -> BeginFrame(This,pRenderTarget,pvPVPData) ) + +#define IDirectXVideoDecoder_EndFrame(This,pHandleComplete) \ + ( (This)->lpVtbl -> EndFrame(This,pHandleComplete) ) + +#define IDirectXVideoDecoder_Execute(This,pExecuteParams) \ + ( (This)->lpVtbl -> Execute(This,pExecuteParams) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirectXVideoDecoder_INTERFACE_DEFINED__ */ + + +#ifndef __IDirectXVideoProcessor_INTERFACE_DEFINED__ +#define __IDirectXVideoProcessor_INTERFACE_DEFINED__ + +/* interface IDirectXVideoProcessor */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirectXVideoProcessor; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8c3a39f0-916e-4690-804f-4c8001355d25") + IDirectXVideoProcessor : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorService( + /* [annotation][out] */ + _Outptr_ IDirectXVideoProcessorService **ppService) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCreationParameters( + /* [annotation][out] */ + _Out_opt_ GUID *pDeviceGuid, + /* [annotation][out] */ + _Out_opt_ DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_opt_ D3DFORMAT *pRenderTargetFormat, + /* [annotation][out] */ + _Out_opt_ UINT *pMaxNumSubStreams) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoProcessorCaps( + /* [annotation][out] */ + _Out_ DXVA2_VideoProcessorCaps *pCaps) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetProcAmpRange( + /* [annotation][in] */ + _In_ UINT ProcAmpCap, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFilterPropertyRange( + /* [annotation][in] */ + _In_ UINT FilterSetting, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange) = 0; + + virtual HRESULT STDMETHODCALLTYPE VideoProcessBlt( + /* [annotation][in] */ + _In_ IDirect3DSurface9 *pRenderTarget, + /* [annotation][in] */ + _In_ const DXVA2_VideoProcessBltParams *pBltParams, + /* [annotation][size_is][in] */ + _In_reads_(NumSamples) const DXVA2_VideoSample *pSamples, + /* [annotation][in] */ + _In_ UINT NumSamples, + /* [annotation][out] */ + _Inout_opt_ HANDLE *pHandleComplete) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirectXVideoProcessorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirectXVideoProcessor * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirectXVideoProcessor * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirectXVideoProcessor * This); + + HRESULT ( STDMETHODCALLTYPE *GetVideoProcessorService )( + IDirectXVideoProcessor * This, + /* [annotation][out] */ + _Outptr_ IDirectXVideoProcessorService **ppService); + + HRESULT ( STDMETHODCALLTYPE *GetCreationParameters )( + IDirectXVideoProcessor * This, + /* [annotation][out] */ + _Out_opt_ GUID *pDeviceGuid, + /* [annotation][out] */ + _Out_opt_ DXVA2_VideoDesc *pVideoDesc, + /* [annotation][out] */ + _Out_opt_ D3DFORMAT *pRenderTargetFormat, + /* [annotation][out] */ + _Out_opt_ UINT *pMaxNumSubStreams); + + HRESULT ( STDMETHODCALLTYPE *GetVideoProcessorCaps )( + IDirectXVideoProcessor * This, + /* [annotation][out] */ + _Out_ DXVA2_VideoProcessorCaps *pCaps); + + HRESULT ( STDMETHODCALLTYPE *GetProcAmpRange )( + IDirectXVideoProcessor * This, + /* [annotation][in] */ + _In_ UINT ProcAmpCap, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange); + + HRESULT ( STDMETHODCALLTYPE *GetFilterPropertyRange )( + IDirectXVideoProcessor * This, + /* [annotation][in] */ + _In_ UINT FilterSetting, + /* [annotation][out] */ + _Out_ DXVA2_ValueRange *pRange); + + HRESULT ( STDMETHODCALLTYPE *VideoProcessBlt )( + IDirectXVideoProcessor * This, + /* [annotation][in] */ + _In_ IDirect3DSurface9 *pRenderTarget, + /* [annotation][in] */ + _In_ const DXVA2_VideoProcessBltParams *pBltParams, + /* [annotation][size_is][in] */ + _In_reads_(NumSamples) const DXVA2_VideoSample *pSamples, + /* [annotation][in] */ + _In_ UINT NumSamples, + /* [annotation][out] */ + _Inout_opt_ HANDLE *pHandleComplete); + + END_INTERFACE + } IDirectXVideoProcessorVtbl; + + interface IDirectXVideoProcessor + { + CONST_VTBL struct IDirectXVideoProcessorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirectXVideoProcessor_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirectXVideoProcessor_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirectXVideoProcessor_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirectXVideoProcessor_GetVideoProcessorService(This,ppService) \ + ( (This)->lpVtbl -> GetVideoProcessorService(This,ppService) ) + +#define IDirectXVideoProcessor_GetCreationParameters(This,pDeviceGuid,pVideoDesc,pRenderTargetFormat,pMaxNumSubStreams) \ + ( (This)->lpVtbl -> GetCreationParameters(This,pDeviceGuid,pVideoDesc,pRenderTargetFormat,pMaxNumSubStreams) ) + +#define IDirectXVideoProcessor_GetVideoProcessorCaps(This,pCaps) \ + ( (This)->lpVtbl -> GetVideoProcessorCaps(This,pCaps) ) + +#define IDirectXVideoProcessor_GetProcAmpRange(This,ProcAmpCap,pRange) \ + ( (This)->lpVtbl -> GetProcAmpRange(This,ProcAmpCap,pRange) ) + +#define IDirectXVideoProcessor_GetFilterPropertyRange(This,FilterSetting,pRange) \ + ( (This)->lpVtbl -> GetFilterPropertyRange(This,FilterSetting,pRange) ) + +#define IDirectXVideoProcessor_VideoProcessBlt(This,pRenderTarget,pBltParams,pSamples,NumSamples,pHandleComplete) \ + ( (This)->lpVtbl -> VideoProcessBlt(This,pRenderTarget,pBltParams,pSamples,NumSamples,pHandleComplete) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirectXVideoProcessor_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxva2api_0000_0006 */ +/* [local] */ + +typedef /* [public][public][public] */ +enum __MIDL___MIDL_itf_dxva2api_0000_0006_0001 + { + DXVA2_SurfaceType_DecoderRenderTarget = 0, + DXVA2_SurfaceType_ProcessorRenderTarget = 1, + DXVA2_SurfaceType_D3DRenderTargetTexture = 2 + } DXVA2_SurfaceType; + + + +extern RPC_IF_HANDLE __MIDL_itf_dxva2api_0000_0006_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxva2api_0000_0006_v0_0_s_ifspec; + +#ifndef __IDirectXVideoMemoryConfiguration_INTERFACE_DEFINED__ +#define __IDirectXVideoMemoryConfiguration_INTERFACE_DEFINED__ + +/* interface IDirectXVideoMemoryConfiguration */ +/* [local][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDirectXVideoMemoryConfiguration; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("b7f916dd-db3b-49c1-84d7-e45ef99ec726") + IDirectXVideoMemoryConfiguration : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAvailableSurfaceTypeByIndex( + /* [annotation][in] */ + _In_ DWORD dwTypeIndex, + /* [annotation][out] */ + _Out_ DXVA2_SurfaceType *pdwType) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSurfaceType( + /* [annotation][in] */ + _In_ DXVA2_SurfaceType dwType) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDirectXVideoMemoryConfigurationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDirectXVideoMemoryConfiguration * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDirectXVideoMemoryConfiguration * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDirectXVideoMemoryConfiguration * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableSurfaceTypeByIndex )( + IDirectXVideoMemoryConfiguration * This, + /* [annotation][in] */ + _In_ DWORD dwTypeIndex, + /* [annotation][out] */ + _Out_ DXVA2_SurfaceType *pdwType); + + HRESULT ( STDMETHODCALLTYPE *SetSurfaceType )( + IDirectXVideoMemoryConfiguration * This, + /* [annotation][in] */ + _In_ DXVA2_SurfaceType dwType); + + END_INTERFACE + } IDirectXVideoMemoryConfigurationVtbl; + + interface IDirectXVideoMemoryConfiguration + { + CONST_VTBL struct IDirectXVideoMemoryConfigurationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDirectXVideoMemoryConfiguration_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDirectXVideoMemoryConfiguration_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDirectXVideoMemoryConfiguration_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDirectXVideoMemoryConfiguration_GetAvailableSurfaceTypeByIndex(This,dwTypeIndex,pdwType) \ + ( (This)->lpVtbl -> GetAvailableSurfaceTypeByIndex(This,dwTypeIndex,pdwType) ) + +#define IDirectXVideoMemoryConfiguration_SetSurfaceType(This,dwType) \ + ( (This)->lpVtbl -> SetSurfaceType(This,dwType) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDirectXVideoMemoryConfiguration_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_dxva2api_0000_0007 */ +/* [local] */ + +STDAPI DXVA2CreateDirect3DDeviceManager9( + _Out_ UINT* pResetToken, + _Outptr_ IDirect3DDeviceManager9** ppDeviceManager + ); +STDAPI DXVA2CreateVideoService( + _In_ IDirect3DDevice9* pDD, + _In_ REFIID riid, + _Outptr_ void** ppService + ); +#endif // _D3D9_H_ +__inline DXVA2_Fixed32 DXVA2FloatToFixed(_In_ const float _float_) +{ + DXVA2_Fixed32 _fixed_; + _fixed_.Fraction = LOWORD(_float_ * 0x10000); + _fixed_.Value = HIWORD(_float_ * 0x10000); + return _fixed_; +} +__inline float DXVA2FixedToFloat(_In_ const DXVA2_Fixed32 _fixed_) +{ + return (FLOAT)_fixed_.Value + (FLOAT)_fixed_.Fraction / 0x10000; +} +__inline const DXVA2_Fixed32 DXVA2_Fixed32TransparentAlpha() +{ + DXVA2_Fixed32 _fixed_ = {0, 0}; + return _fixed_; +} +__inline const DXVA2_Fixed32 DXVA2_Fixed32OpaqueAlpha() +{ + DXVA2_Fixed32 _fixed_ = {0, 1}; + return _fixed_; +} +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_dxva2api_0000_0007_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_dxva2api_0000_0007_v0_0_s_ifspec; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/pix3.h b/3rdparty/bgfx/3rdparty/dxsdk/include/pix3.h new file mode 100644 index 00000000000..311d6c240a1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/pix3.h @@ -0,0 +1,116 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: pix3.h + * Content: PIX include file + * + ****************************************************************************/ +#pragma once + +#ifndef _PIX3_H_ +#define _PIX3_H_ + +#include + +#ifndef __cplusplus +#error "Only C++ files can include pix.h. C is not supported." +#endif + +#if defined(XBOX) || defined(_XBOX_ONE) || defined(_DURANGO) +#include "pix3_xbox.h" +#else +#include "pix3_win.h" +#endif + +// +// The PIX event/marker APIs compile to nothing on retail builds and on x86 builds +// +#if (!defined(USE_PIX)) && ((defined(_DEBUG) || DBG || (defined(PROFILE) && !defined(FASTCAP)) || defined(PROFILE_BUILD)) && !defined(i386) && defined(_AMD64_) && !defined(_PREFAST_)) +#define USE_PIX +#endif + +#if defined(USE_PIX) && !defined(_AMD64_) && !defined(USE_PIX_ON_ALL_ARCHITECTURES) +#pragma message("Warning: Pix markers are only supported on AMD64") +#endif + +// These flags are used by both PIXBeginCapture and PIXGetCaptureState +#define PIX_CAPTURE_TIMING (1 << 0) +#define PIX_CAPTURE_GPU (1 << 1) +#define PIX_CAPTURE_FUNCTION_SUMMARY (1 << 2) +#define PIX_CAPTURE_FUNCTION_DETAILS (1 << 3) +#define PIX_CAPTURE_CALLGRAPH (1 << 4) +#define PIX_CAPTURE_INSTRUCTION_TRACE (1 << 5) +#define PIX_CAPTURE_SYSTEM_MONITOR_COUNTERS (1 << 6) +#define PIX_CAPTURE_VIDEO (1 << 7) +#define PIX_CAPTURE_AUDIO (1 << 8) + +typedef union PIXCaptureParameters +{ + struct GpuCaptureParameters + { + PVOID reserved; + } GpuCaptureParameters; + + struct TimingCaptureParameters + { + BOOL CaptureCallstacks; + PWSTR FileName; + } TimingCaptureParameters; + +} PIXCaptureParameters, *PPIXCaptureParameters; + + + +#if defined (USE_PIX) && (defined(_AMD64_) || defined(USE_PIX_ON_ALL_ARCHITECTURES)) + +#include "PIXEventsCommon.h" +#include "PIXEventsGenerated.h" + +// Starts a programmatically controlled capture. +// captureFlags uses the PIX_CAPTURE_* family of flags to specify the type of capture to take +extern "C" HRESULT WINAPI PIXBeginCapture(DWORD captureFlags, _In_opt_ const PPIXCaptureParameters captureParameters); + +// Stops a programmatically controlled capture +// If discard == TRUE, the captured data is discarded +// If discard == FALSE, the captured data is saved +extern "C" HRESULT WINAPI PIXEndCapture(BOOL discard); + +extern "C" DWORD WINAPI PIXGetCaptureState(); + +extern "C" void WINAPI PIXReportCounter(_In_ PCWSTR name, float value); + +#else + +// Eliminate these APIs when not using PIX +inline HRESULT PIXBeginCapture(DWORD, _In_opt_ const PIXCaptureParameters*) { return S_OK; } +inline HRESULT PIXEndCapture(BOOL) { return S_OK; } +inline DWORD PIXGetCaptureState() { return 0; } +inline void PIXReportCounter(_In_ PCWSTR, float) {} + +inline void PIXBeginEvent(UINT64, _In_ PCSTR, ...) {} +inline void PIXBeginEvent(UINT64, _In_ PCWSTR, ...) {} +inline void PIXBeginEvent(void*, UINT64, _In_ PCSTR, ...) {} +inline void PIXBeginEvent(void*, UINT64, _In_ PCWSTR, ...) {} +inline void PIXEndEvent() {} +inline void PIXEndEvent(void*) {} +inline void PIXSetMarker(UINT64, _In_ PCSTR, ...) {} +inline void PIXSetMarker(UINT64, _In_ PCWSTR, ...) {} +inline void PIXSetMarker(void*, UINT64, _In_ PCSTR, ...) {} +inline void PIXSetMarker(void*, UINT64, _In_ PCWSTR, ...) {} +inline void PIXScopedEvent(UINT64, _In_ PCSTR, ...) {} +inline void PIXScopedEvent(UINT64, _In_ PCWSTR, ...) {} +inline void PIXScopedEvent(void*, UINT64, _In_ PCSTR, ...) {} +inline void PIXScopedEvent(void*, UINT64, _In_ PCWSTR, ...) {} + +#endif // USE_PIX + +// Use these functions to specify colors to pass as metadata to a PIX event/marker API. +// Use PIX_COLOR() to specify a particular color for an event. +// Or, use PIX_COLOR_INDEX() to specify a set of unique event categories, and let PIX choose +// the colors to represent each category. +inline UINT PIX_COLOR(BYTE r, BYTE g, BYTE b) { return 0xff000000 | (r << 16) | (g << 8) | b; } +inline UINT PIX_COLOR_INDEX(BYTE i) { return i; } +const UINT PIX_COLOR_DEFAULT = PIX_COLOR_INDEX(0); + +#endif // _PIX3_H_ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/pix3_win.h b/3rdparty/bgfx/3rdparty/dxsdk/include/pix3_win.h new file mode 100644 index 00000000000..2b3dcd5b9d3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/pix3_win.h @@ -0,0 +1,53 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: PIX3_win.h + * Content: PIX include file + * Don't include this file directly - use pix3.h + * + ****************************************************************************/ + +#pragma once + +#ifndef _PIX3_H_ +#error "Don't include this file directly - use pix3.h" +#endif + +#ifndef _PIX3_WIN_H_ +#define _PIX3_WIN_H_ + +struct PIXEventsBlockInfo +{ +}; + +struct PIXEventsThreadInfo +{ + PIXEventsBlockInfo* block; + UINT64* biasedLimit; + UINT64* destination; + UINT64* limit; + UINT64 id; +}; + +// The following defines denote the different metadata values that have been used +// by tools to denote how to parse pix marker event data. The first two values +// are legacy values. +#define WINPIX_EVENT_UNICODE_VERSION 0 +#define WINPIX_EVENT_ANSI_VERSION 1 +#define WINPIX_EVENT_PIX3BLOB_VERSION 2 + +#define D3D12_EVENT_METADATA WINPIX_EVENT_PIX3BLOB_VERSION + +__forceinline UINT64 PIXGetTimestampCounter() +{ + LARGE_INTEGER time = {}; + QueryPerformanceCounter(&time); + return time.QuadPart; +} + +#define PIXSetCPUMarkerOnContext(context, metadata, ...) MakeCPUSetMarkerForContext(metadata, context, __VA_ARGS__) +#define PIXBeginCPUEventOnContext(context, metadata, ...) MakeCPUBeginEventForContext(metadata, context, __VA_ARGS__) +#define PIXEndCPUEventOnContext(context) MakeCPUEndEventForContext(context) + +#endif //_PIX3_WIN_H_ diff --git a/3rdparty/bgfx/3rdparty/dxsdk/include/winapifamily.h b/3rdparty/bgfx/3rdparty/dxsdk/include/winapifamily.h new file mode 100644 index 00000000000..388d5f068cb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/dxsdk/include/winapifamily.h @@ -0,0 +1,24 @@ +/** + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_WINAPIFAMILY +#define _INC_WINAPIFAMILY + +#define WINAPI_PARTITION_DESKTOP 0x1 +#define WINAPI_PARTITION_APP 0x2 + +#define WINAPI_FAMILY_APP WINAPI_PARTITION_APP +#define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP \ + | WINAPI_PARTITION_APP) + +/* WINAPI_FAMILY can be either desktop + App, or App. */ +#ifndef WINAPI_FAMILY +#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP +#endif + +#define WINAPI_FAMILY_PARTITION(v) ((WINAPI_FAMILY & v) == v) +#define WINAPI_FAMILY_ONE_PARTITION(vset, v) ((WINAPI_FAMILY & vset) == v) + +#endif diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp.h b/3rdparty/bgfx/3rdparty/fcpp/cpp.h index c8084af7e63..b9205bb6172 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp.h +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp.h @@ -35,16 +35,16 @@ #include #include -#ifndef toupper -#define toupper(c) ((c) + ('A' - 'a')) -#endif /* no toupper */ -#ifndef tolower -#define tolower(c) ((c) + ('a' - 'A')) -#endif /* no tolower */ +#ifndef fpp_toupper +#define fpp_toupper(c) ((c) + ('A' - 'a')) +#endif /* no fpp_toupper */ +#ifndef fpp_tolower +#define fpp_tolower(c) ((c) + ('a' - 'A')) +#endif /* no fpp_tolower */ -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 +#ifndef FPP_TRUE +#define FPP_TRUE 1 +#define FPP_FALSE 0 #endif #ifndef EOS /* @@ -52,7 +52,7 @@ */ #define EOS '\0' /* End of string */ #endif -#define EOF_CHAR 0 /* Returned by get() on eof */ +#define EOF_CHAR 0 /* Returned by fpp_get() on eof */ #define NULLST ((char *) NULL) /* Pointer to nowhere (linted) */ #define DEF_NOARGS (-1) /* #define foo vs #define foo() */ @@ -139,9 +139,9 @@ /* * These bits are set in ifstack[] */ -#define WAS_COMPILING 1 /* TRUE if compile set at entry */ -#define ELSE_SEEN 2 /* TRUE when #else processed */ -#define TRUE_SEEN 4 /* TRUE when #if TRUE processed */ +#define WAS_COMPILING 1 /* FPP_TRUE if compile set at entry */ +#define ELSE_SEEN 2 /* FPP_TRUE when #else processed */ +#define FPP_TRUE_SEEN 4 /* FPP_TRUE when #if FPP_TRUE processed */ /* * Define bits for the basic types and their adjectives diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp1.c b/3rdparty/bgfx/3rdparty/fcpp/cpp1.c index 17e6fc88cfe..e23e8e5702d 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp1.c +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp1.c @@ -34,14 +34,15 @@ void __stdargs _XCEXIT(long a) { return; } #endif #endif -FILE_LOCAL ReturnCode output(struct Global *, int); /* Output one character */ -FILE_LOCAL void sharp(struct Global *); -INLINE FILE_LOCAL ReturnCode cppmain(struct Global *); +FILE_LOCAL ReturnCode fpp_output(struct Global *, int); /* Output one character */ +FILE_LOCAL void fpp_sharp(struct Global *); +INLINE FILE_LOCAL ReturnCode fpp_cppmain(struct Global *); int fppPreProcess(struct fppTag *tags) { size_t i=0; ReturnCode ret; /* cpp return code */ + int retVal; /* fppPreProcess return code */ struct Global *global; global=(struct Global *)malloc(sizeof(struct Global)); @@ -55,17 +56,17 @@ int fppPreProcess(struct fppTag *tags) global->wrongline=0; global->errors=0; global->recursion=0; - global->rec_recover=TRUE; - global->instring=FALSE; - global->inmacro=FALSE; + global->rec_recover=FPP_TRUE; + global->instring=FPP_FALSE; + global->inmacro=FPP_FALSE; global->workp=NULL; - global->keepcomments = FALSE; /* Write out comments flag */ - global->cflag = FALSE; /* -C option (keep comments) */ - global->eflag = FALSE; /* -E option (never fail) */ + global->keepcomments = FPP_FALSE; /* Write out comments flag */ + global->cflag = FPP_FALSE; /* -C option (keep comments) */ + global->eflag = FPP_FALSE; /* -E option (never fail) */ global->nflag = 0; /* -N option (no predefines) */ - global->wflag = FALSE; /* -W option (write #defines) */ + global->wflag = FPP_FALSE; /* -W option (write #defines) */ - global->ifstack[0]=TRUE; /* #if information */ + global->ifstack[0]=FPP_TRUE; /* #if information */ global->ifptr = global->ifstack; global->incend = global->incdir; @@ -106,52 +107,59 @@ int fppPreProcess(struct fppTag *tags) global->first_file=NULL; global->userdata=NULL; - global->linelines=TRUE; - global->warnillegalcpp = FALSE; - global->outputLINE = TRUE; - global->warnnoinclude = TRUE; - global->showversion = TRUE; - global->showincluded = FALSE; - global->showspace = FALSE; - global->nestcomments = FALSE; - global->warnnestcomments = FALSE; - global->outputfile = TRUE; + global->linelines=FPP_TRUE; + global->warnillegalcpp = FPP_FALSE; + global->outputLINE = FPP_TRUE; + global->warnnoinclude = FPP_TRUE; + global->showversion = FPP_TRUE; + global->showincluded = FPP_FALSE; + global->showspace = FPP_FALSE; + global->nestcomments = FPP_FALSE; + global->warnnestcomments = FPP_FALSE; + global->outputfile = FPP_TRUE; global->included = 0; - global->comment = FALSE; - global->rightconcat = FALSE; + global->comment = FPP_FALSE; + global->rightconcat = FPP_FALSE; global->work[0] = '\0'; global->initialfunc = NULL; + global->allowincludelocal = FPP_TRUE; memset(global->symtab, 0, SBSIZE * sizeof(DEFBUF *)); - ret=initdefines(global); /* O.S. specific def's */ + ret=fpp_initdefines(global); /* O.S. specific def's */ if(ret) return(ret); - dooptions(global, tags); /* Command line -flags */ - ret=addfile(global, stdin, global->work); /* "open" main input file */ + fpp_dooptions(global, tags); /* Command line -flags */ + ret=fpp_addfile(global, stdin, global->work); /* "open" main input file */ global->out = global->outputfile; if(!ret) - ret=cppmain(global); /* Process main file */ + ret=fpp_cppmain(global); /* Process main file */ if ((i = (global->ifptr - global->ifstack)) != 0) { #if OLD_PREPROCESSOR - cwarn(global, ERROR_IFDEF_DEPTH, i); + fpp_cwarn(global, ERROR_IFDEF_DEPTH, i); #else - cerror(global, ERROR_IFDEF_DEPTH, i); + fpp_cerror(global, ERROR_IFDEF_DEPTH, i); #endif } fflush(stdout); // BK - fclose(stdout); + fpp_delalldefines(global); + retVal = IO_NORMAL; if (global->errors > 0 && !global->eflag) - return(IO_ERROR); - return(IO_NORMAL); /* No errors or -E option set */ + retVal = IO_ERROR; + free(global->tokenbuf); + free(global->functionname); + free(global->spacebuf); + free(global); + return retVal; /* No errors or -E option set */ } INLINE FILE_LOCAL -ReturnCode cppmain(struct Global *global) +ReturnCode fpp_cppmain(struct Global *global) { /* * Main process for cpp -- copies tokens from the current input @@ -175,7 +183,7 @@ ReturnCode cppmain(struct Global *global) char define = 0; /* probability of a function define phase in the program */ char prev = 0; /* previous type */ char go = 0; - char include = 0; + unsigned include = 0; char initfunc = 0; /* Initialize for reading tokens */ @@ -196,7 +204,7 @@ ReturnCode cppmain(struct Global *global) } if(global->showversion) - Error(global, VERSION_TEXT); + fpp_Error(global, VERSION_TEXT); /* * Explicitly output a #line at the start of cpp output so @@ -205,10 +213,10 @@ ReturnCode cppmain(struct Global *global) * the name of the first #include file instead. */ if(global->linelines) /* if #line lines are wanted! */ - sharp(global); + fpp_sharp(global); /* * This loop is started "from the top" at the beginning of each line - * wrongline is set TRUE in many places if it is necessary to write + * wrongline is set FPP_TRUE in many places if it is necessary to write * a #line record. (But we don't write them when expanding macros.) * * The counter variable has two different uses: at @@ -224,15 +232,15 @@ ReturnCode cppmain(struct Global *global) include = global->included; while(include--) { - openinclude(global, global->include[(unsigned)include], TRUE); + fpp_openinclude(global, global->include[(unsigned)include], FPP_TRUE); } for (;;) { counter = 0; /* Count empty lines */ for (;;) { /* For each line, ... */ - global->comment = FALSE; /* No comment yet! */ + global->comment = FPP_FALSE; /* No comment yet! */ global->chpos = 0; /* Count whitespaces */ - while (type[(c = get(global))] == SPA) /* Skip leading blanks */ + while (type[(c = fpp_get(global))] == SPA) /* Skip leading blanks */ if(global->showspace) { if(global->chposcomment) { /* A comment was output! */ - Putchar(global, '\n'); + fpp_Putchar(global, '\n'); } else ++counter; /* Do nothing now */ } else if (c == '#') { /* Is 1st non-space '#' */ - global->keepcomments = FALSE; /* Don't pass comments */ - ret = control(global, &counter); /* Yes, do a #command */ + global->keepcomments = FPP_FALSE; /* Don't pass comments */ + ret = fpp_control(global, &counter); /* Yes, do a #command */ if(ret) return(ret); global->keepcomments = (global->cflag && compiling); @@ -256,7 +264,7 @@ ReturnCode cppmain(struct Global *global) else if (c == EOF_CHAR) /* At end of file? */ break; else if (!compiling) { /* #ifdef false? */ - skipnl(global); /* Skip to newline */ + fpp_skipnl(global); /* Skip to newline */ counter++; /* Count it, too. */ } else { break; /* Actual token */ @@ -271,25 +279,25 @@ ReturnCode cppmain(struct Global *global) */ if(global->linelines) { /* if #line lines are wanted! */ if ((global->wrongline && global->infile->fp != NULL) || counter > 4) - sharp(global); /* Output # line number */ + fpp_sharp(global); /* Output # line number */ else { /* If just a few, stuff */ while (--counter >= 0) /* them out ourselves */ - Putchar(global, (int)'\n'); + fpp_Putchar(global, (int)'\n'); } } if(global->showspace) { /* Show all whitespaces! */ global->spacebuf[global->chpos] = '\0'; - Putstring(global, global->spacebuf); + fpp_Putstring(global, global->spacebuf); } /* * Process each token on this line. */ - unget(global); /* Reread the char. */ + fpp_unget(global); /* Reread the char. */ for (;;) { /* For the whole line, */ do { /* Token concat. loop */ - for (global->chpos = counter = 0; type[(c = get(global))] == SPA;) { + for (global->chpos = counter = 0; (type[(c = fpp_get(global))] == SPA);) { #if COMMENT_INVISIBLE if (c != COM_SEP) counter++; @@ -304,15 +312,15 @@ ReturnCode cppmain(struct Global *global) break; /* Exit line loop */ else if (counter > 0) { /* If we got any spaces */ if(!global->showspace) /* We don't output all spaces */ - Putchar(global, (int)' ');/* Output one space */ + fpp_Putchar(global, (int)' ');/* Output one space */ else { global->spacebuf[global->chpos] = '\0'; - Putstring(global, global->spacebuf); /* Output all whitespaces */ + fpp_Putstring(global, global->spacebuf); /* Output all whitespaces */ } } - if((ret=macroid(global, &c))) /* Grab the token */ + if((ret=fpp_macroid(global, &c))) /* Grab the token */ return(ret); - } while (type[c] == LET && catenate(global, &ret) && !ret); + } while (type[c] == LET && fpp_catenate(global, 0, &ret) && !ret); if(ret) /* If the loop was broken because of a fatal error! */ return(ret); @@ -323,7 +331,7 @@ ReturnCode cppmain(struct Global *global) case LET: go =0; /* Quite ordinary token */ - Putstring(global, global->tokenbuf); + fpp_Putstring(global, global->tokenbuf); if(!define) { /* Copy the name */ @@ -335,7 +343,10 @@ ReturnCode cppmain(struct Global *global) case DIG: /* Output a number */ case DOT: /* Dot may begin floats */ go = 0; - ret=scannumber(global, c, (ReturnCode(*)(struct Global *, int))output); + ret=fpp_scannumber(global, c, (ReturnCode(*)(struct Global *, int))fpp_output); + if(ret) + return(ret); + fpp_catenate(global, 1, &ret); /* Check to see if the number is the lhs of a macro concat */ if(ret) return(ret); break; @@ -343,8 +354,8 @@ ReturnCode cppmain(struct Global *global) go = 0; /* Copy it to output */ if(!global->webmode) { - ret=scanstring(global, c, - (ReturnCode(*)(struct Global *, int))output); + ret=fpp_scanstring(global, c, + (ReturnCode(*)(struct Global *, int))fpp_output); if(ret) return(ret); break; @@ -368,7 +379,7 @@ ReturnCode cppmain(struct Global *global) /* * Output the discovered function name to stderr! */ - Error(global, "#> Function defined at line %d: %s <#\n", + fpp_Error(global, "#> Function defined at line %d: %s <#\n", global->line, global->functionname); } @@ -382,9 +393,9 @@ ReturnCode cppmain(struct Global *global) break; } if(a==global->excluded) { - expstuff(global, "__brace__", "{"); - expstuff(global, "__init_func__", global->initialfunc); - initfunc = TRUE; + fpp_expstuff(global, "__brace__", "{"); + fpp_expstuff(global, "__init_func__", global->initialfunc); + initfunc = FPP_TRUE; } } @@ -400,7 +411,7 @@ ReturnCode cppmain(struct Global *global) define = 1; if(initfunc) { - Putchar(global, '}'); + fpp_Putchar(global, '}'); bracelevel--; initfunc=0; } @@ -462,57 +473,57 @@ ReturnCode cppmain(struct Global *global) } define--; /* decrease function probability */ - Putchar(global, c); /* Just output it */ + fpp_Putchar(global, c); /* Just output it */ break; } /* Switch ends */ prev = type[c]; } /* Line for loop */ if (c == '\n') { /* Compiling at EOL? */ - Putchar(global, '\n'); /* Output newline, if */ + fpp_Putchar(global, '\n'); /* Output newline, if */ if (global->infile->fp == NULL) /* Expanding a macro, */ - global->wrongline = TRUE; /* Output # line later */ + global->wrongline = FPP_TRUE; /* Output # line later */ } } /* Continue until EOF */ if(global->showbalance) { if(bracketlevel) { - cwarn(global, WARN_BRACKET_DEPTH, bracketlevel); + fpp_cwarn(global, WARN_BRACKET_DEPTH, bracketlevel); } if(parenlevel) { - cwarn(global, WARN_PAREN_DEPTH, parenlevel); + fpp_cwarn(global, WARN_PAREN_DEPTH, parenlevel); } if(bracelevel) { - cwarn(global, WARN_BRACE_DEPTH, bracelevel); + fpp_cwarn(global, WARN_BRACE_DEPTH, bracelevel); } } if (global->wflag) { - global->out = TRUE; /* enable output */ - outdefines(global); /* Write out #defines */ + global->out = FPP_TRUE; /* enable fpp_output */ + fpp_outdefines(global); /* Write out #defines */ } return(FPP_OK); } FILE_LOCAL -ReturnCode output(struct Global *global, int c) +ReturnCode fpp_output(struct Global *global, int c) { /* - * Output one character to stdout -- output() is passed as an - * argument to scanstring() + * Output one character to stdout -- fpp_output() is passed as an + * argument to fpp_scanstring() */ #if COMMENT_INVISIBLE if (c != TOK_SEP && c != COM_SEP) #else if (c != TOK_SEP) #endif - Putchar(global, c); + fpp_Putchar(global, c); return(FPP_OK); } -void Putchar(struct Global *global, int c) +void fpp_Putchar(struct Global *global, int c) { /* - * Output one character to stdout or to output function! + * Output one character to stdout or to fpp_output function! */ if(!global->out) return; @@ -526,20 +537,20 @@ void Putchar(struct Global *global, int c) #endif } -void Putstring(struct Global *global, char *string) +void fpp_Putstring(struct Global *global, char *string) { /* - * Output a string! One letter at a time to the Putchar routine! + * Output a string! One letter at a time to the fpp_Putchar routine! */ if(!string) return; while(*string) - Putchar(global, *string++); + fpp_Putchar(global, *string++); } -void Putint(struct Global *global, int number) +void fpp_Putint(struct Global *global, int number) { /* * Output the number as a string. @@ -551,12 +562,12 @@ void Putint(struct Global *global, int number) sprintf(buffer, "%d", number); while(*point) - Putchar(global, *point++); + fpp_Putchar(global, *point++); } FILE_LOCAL -void sharp(struct Global *global) +void fpp_sharp(struct Global *global) { /* * Output a line number line. @@ -564,14 +575,14 @@ void sharp(struct Global *global) char *name; if (global->keepcomments) /* Make sure # comes on */ - Putchar(global, '\n'); /* a fresh, new line. */ + fpp_Putchar(global, '\n'); /* a fresh, new line. */ /* printf("#%s %d", LINE_PREFIX, global->line); */ - Putchar(global, '#'); + fpp_Putchar(global, '#'); if(global->outputLINE) - Putstring(global, LINE_PREFIX); - Putchar(global, ' '); - Putint(global, global->line); + fpp_Putstring(global, LINE_PREFIX); + fpp_Putchar(global, ' '); + fpp_Putint(global, global->line); if (global->infile->fp != NULL) { name = (global->infile->progname != NULL) @@ -580,14 +591,14 @@ void sharp(struct Global *global) || (global->sharpfilename != NULL && !streq(name, global->sharpfilename))) { if (global->sharpfilename != NULL) free(global->sharpfilename); - global->sharpfilename = savestring(global, name); + global->sharpfilename = fpp_savestring(global, name); /* printf(" \"%s\"", name); */ - Putstring(global, " \""); - Putstring(global, name); - Putchar(global, '\"'); + fpp_Putstring(global, " \""); + fpp_Putstring(global, name); + fpp_Putchar(global, '\"'); } } - Putchar(global, '\n'); - global->wrongline = FALSE; + fpp_Putchar(global, '\n'); + global->wrongline = FPP_FALSE; return; } diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp2.c b/3rdparty/bgfx/3rdparty/fcpp/cpp2.c index 07597ee64d1..7e53180caaf 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp2.c +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp2.c @@ -28,10 +28,10 @@ SOFTWARE. #include #endif -FILE_LOCAL void dump_line(struct Global *, int *); -FILE_LOCAL ReturnCode doif(struct Global *, int); -INLINE FILE_LOCAL ReturnCode doinclude(struct Global *); -INLINE FILE_LOCAL int hasdirectory(char *, char *); +FILE_LOCAL void fpp_dump_line(struct Global *, int *); +FILE_LOCAL ReturnCode fpp_doif(struct Global *, int); +INLINE FILE_LOCAL ReturnCode fpp_doinclude(struct Global *); +INLINE FILE_LOCAL int fpp_hasdirectory(char *, char *); /* @@ -55,7 +55,7 @@ INLINE FILE_LOCAL int hasdirectory(char *, char *); #define L_pragma ('p' + ('a' << 1)) #define L_undef ('u' + ('d' << 1)) -ReturnCode control( struct Global *global, +ReturnCode fpp_control( struct Global *global, int *counter ) /* Pending newline counter */ { /* @@ -73,7 +73,7 @@ ReturnCode control( struct Global *global, char *ep; ReturnCode ret; - c = skipws( global ); + c = fpp_skipws( global ); if( c == '\n' || c == EOF_CHAR ) { @@ -83,10 +83,10 @@ ReturnCode control( struct Global *global, } if( !isdigit(c) ) - scanid( global, c ); /* Get #word to tokenbuf */ + fpp_scanid( global, c ); /* Get #word to tokenbuf */ else { - unget( global ); /* Hack -- allow #123 as a */ + fpp_unget( global ); /* Hack -- allow #123 as a */ strcpy( global->tokenbuf, "line" ); /* synonym for #line 123 */ } @@ -149,7 +149,7 @@ ReturnCode control( struct Global *global, * control keyword (or L_nogood if we think it's nonsense). */ if( global->infile->fp == NULL ) - cwarn( global, WARN_CONTROL_LINE_IN_MACRO, global->tokenbuf ); + fpp_cwarn( global, WARN_CONTROL_LINE_IN_MACRO, global->tokenbuf ); if( !compiling ) { /* Not compiling now */ @@ -160,7 +160,7 @@ ReturnCode control( struct Global *global, case L_ifndef: /* we must nest #if's */ if( ++global->ifptr >= &global->ifstack[BLK_NEST] ) { - cfatal( global, FATAL_TOO_MANY_NESTINGS, global->tokenbuf ); + fpp_cfatal( global, FATAL_TOO_MANY_NESTINGS, global->tokenbuf ); return( FPP_TOO_MANY_NESTED_STATEMENTS ); } @@ -177,7 +177,7 @@ ReturnCode control( struct Global *global, case L_undef: /* aren't */ case L_assert: /* compiling. */ case L_error: - dump_line( global, counter ); /* Ignore rest of line */ + fpp_dump_line( global, counter ); /* Ignore rest of line */ return(FPP_OK); } } @@ -186,7 +186,7 @@ ReturnCode control( struct Global *global, */ if( *counter > 0 && (hash == L_line || hash == L_pragma) ) { - Putchar( global, '\n' ); + fpp_Putchar( global, '\n' ); (*counter)--; } @@ -199,21 +199,21 @@ ReturnCode control( struct Global *global, * field and line number for the next input line. * Set wrongline to force it out later. */ - c = skipws( global ); + c = fpp_skipws( global ); global->workp = global->work; /* Save name in work */ while( c != '\n' && c != EOF_CHAR ) { - if( (ret = save( global, c )) ) + if( (ret = fpp_save( global, c )) ) return(ret); - c = get( global ); + c = fpp_get( global ); } - unget( global ); + fpp_unget( global ); - if( (ret = save( global, EOS )) ) + if( (ret = fpp_save( global, EOS )) ) return(ret); /* @@ -240,42 +240,42 @@ ReturnCode control( struct Global *global, /* Give up the old name if it's allocated. */ free( global->infile->progname ); - global->infile->progname = savestring( global, tp ); + global->infile->progname = fpp_savestring( global, tp ); } - global->wrongline = TRUE; /* Force output later */ + global->wrongline = FPP_TRUE; /* Force output later */ break; case L_include: - ret = doinclude( global ); + ret = fpp_doinclude( global ); if( ret ) return(ret); break; case L_define: - ret = dodefine( global ); + ret = fpp_dodefine( global ); if( ret ) return(ret); break; case L_undef: - doundef( global ); + fpp_doundef( global ); break; case L_else: if( global->ifptr == &global->ifstack[0] ) { - cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf ); + fpp_cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf ); - dump_line( global, counter ); + fpp_dump_line( global, counter ); return( FPP_OK ); } else if( (*global->ifptr & ELSE_SEEN) != 0 ) { - cerror( global, ERROR_STRING_MAY_NOT_FOLLOW_ELSE, global->tokenbuf ); + fpp_cerror( global, ERROR_STRING_MAY_NOT_FOLLOW_ELSE, global->tokenbuf ); - dump_line( global, counter ); + fpp_dump_line( global, counter ); return( FPP_OK ); } @@ -284,11 +284,11 @@ ReturnCode control( struct Global *global, if( (*global->ifptr & WAS_COMPILING) != 0 ) { - if( compiling || (*global->ifptr & TRUE_SEEN) != 0 ) - compiling = FALSE; + if( compiling || (*global->ifptr & FPP_TRUE_SEEN) != 0 ) + compiling = FPP_FALSE; else { - compiling = TRUE; + compiling = FPP_TRUE; } } break; @@ -296,31 +296,31 @@ ReturnCode control( struct Global *global, case L_elif: if( global->ifptr == &global->ifstack[0] ) { - cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf ); + fpp_cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf ); - dump_line( global, counter ); + fpp_dump_line( global, counter ); return( FPP_OK ); } else if( (*global->ifptr & ELSE_SEEN) != 0 ) { - cerror( global, ERROR_STRING_MAY_NOT_FOLLOW_ELSE, global->tokenbuf ); + fpp_cerror( global, ERROR_STRING_MAY_NOT_FOLLOW_ELSE, global->tokenbuf ); - dump_line( global, counter ); + fpp_dump_line( global, counter ); return( FPP_OK ); } - if( (*global->ifptr & (WAS_COMPILING | TRUE_SEEN)) != WAS_COMPILING ) + if( (*global->ifptr & (WAS_COMPILING | FPP_TRUE_SEEN)) != WAS_COMPILING ) { - compiling = FALSE; /* Done compiling stuff */ + compiling = FPP_FALSE; /* Done compiling stuff */ - dump_line( global, counter ); /* Skip this clause */ + fpp_dump_line( global, counter ); /* Skip this clause */ return( FPP_OK ); } - ret = doif( global, L_if ); + ret = fpp_doif( global, L_if ); if( ret ) return(ret); @@ -328,7 +328,7 @@ ReturnCode control( struct Global *global, break; case L_error: - cerror(global, ERROR_ERROR); + fpp_cerror(global, ERROR_ERROR); break; case L_if: @@ -338,7 +338,7 @@ ReturnCode control( struct Global *global, { *global->ifptr = WAS_COMPILING; - ret = doif( global, hash ); + ret = fpp_doif( global, hash ); if( ret ) return(ret); @@ -346,22 +346,22 @@ ReturnCode control( struct Global *global, break; } - cfatal( global, FATAL_TOO_MANY_NESTINGS, global->tokenbuf ); + fpp_cfatal( global, FATAL_TOO_MANY_NESTINGS, global->tokenbuf ); return( FPP_TOO_MANY_NESTED_STATEMENTS ); case L_endif: if( global->ifptr == &global->ifstack[0] ) { - cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf ); + fpp_cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf ); - dump_line( global, counter ); + fpp_dump_line( global, counter ); return(FPP_OK); } if( !compiling && (*global->ifptr & WAS_COMPILING) != 0 ) - global->wrongline = TRUE; + global->wrongline = FPP_TRUE; compiling = ((*global->ifptr & WAS_COMPILING) != 0); @@ -373,13 +373,13 @@ ReturnCode control( struct Global *global, { int result; - ret = eval( global, &result ); + ret = fpp_eval( global, &result ); if(ret) return(ret); if( result == 0 ) - cerror( global, ERROR_PREPROC_FAILURE ); + fpp_cerror( global, ERROR_PREPROC_FAILURE ); } break; @@ -388,14 +388,14 @@ ReturnCode control( struct Global *global, * #pragma is provided to pass "options" to later * passes of the compiler. cpp doesn't have any yet. */ - Putstring( global, "#pragma " ); + fpp_Putstring( global, "#pragma " ); - while( (c = get( global ) ) != '\n' && c != EOF_CHAR ) - Putchar( global, c ); + while( (c = fpp_get( global ) ) != '\n' && c != EOF_CHAR ) + fpp_Putchar( global, c ); - unget( global ); + fpp_unget( global ); - Putchar( global, '\n' ); + fpp_Putchar( global, '\n' ); break; @@ -407,18 +407,18 @@ ReturnCode control( struct Global *global, * This would allow #asm or similar extensions. */ if( global->warnillegalcpp ) - cwarn( global, WARN_ILLEGAL_COMMAND, global->tokenbuf ); + fpp_cwarn( global, WARN_ILLEGAL_COMMAND, global->tokenbuf ); - Putchar( global, '#' ); - Putstring( global, global->tokenbuf ); - Putchar( global, ' ' ); + fpp_Putchar( global, '#' ); + fpp_Putstring( global, global->tokenbuf ); + fpp_Putchar( global, ' ' ); - while( (c = get( global ) ) != '\n' && c != EOF_CHAR ) - Putchar( global, c ); + while( (c = fpp_get( global ) ) != '\n' && c != EOF_CHAR ) + fpp_Putchar( global, c ); - unget( global ); + fpp_unget( global ); - Putchar( global, '\n' ); + fpp_Putchar( global, '\n' ); break; } @@ -431,15 +431,15 @@ ReturnCode control( struct Global *global, * #if foo * #endif foo */ - dump_line( global, counter ); /* Take common exit */ + fpp_dump_line( global, counter ); /* Take common exit */ return( FPP_OK ); #else - if( skipws( global ) != '\n' ) + if( fpp_skipws( global ) != '\n' ) { - cwarn( global, WARN_UNEXPECTED_TEXT_IGNORED ); + fpp_cwarn( global, WARN_UNEXPECTED_TEXT_IGNORED ); - skipnl( global ); + fpp_skipnl( global ); } #endif } @@ -450,21 +450,21 @@ ReturnCode control( struct Global *global, } FILE_LOCAL -void dump_line(struct Global *global, int *counter) +void fpp_dump_line(struct Global *global, int *counter) { - skipnl( global ); /* Ignore rest of line */ + fpp_skipnl( global ); /* Ignore rest of line */ (*counter)++; } FILE_LOCAL -ReturnCode doif(struct Global *global, int hash) +ReturnCode fpp_doif(struct Global *global, int hash) { /* * Process an #if, #ifdef, or #ifndef. The latter two are straightforward, * while #if needs a subroutine of its own to evaluate the expression. * - * doif() is called only if compiling is TRUE. If false, compilation + * fpp_doif() is called only if compiling is FPP_TRUE. If false, compilation * is always supressed, so we don't need to evaluate anything. This * supresses unnecessary warnings. */ @@ -473,16 +473,16 @@ ReturnCode doif(struct Global *global, int hash) int found; ReturnCode ret; - if( (c = skipws( global ) ) == '\n' || c == EOF_CHAR ) + if( (c = fpp_skipws( global ) ) == '\n' || c == EOF_CHAR ) { - unget( global ); + fpp_unget( global ); - cerror( global, ERROR_MISSING_ARGUMENT ); + fpp_cerror( global, ERROR_MISSING_ARGUMENT ); #if !OLD_PREPROCESSOR - skipnl( global ); /* Prevent an extra */ + fpp_skipnl( global ); /* Prevent an extra */ - unget( global ); /* Error message */ + fpp_unget( global ); /* Error message */ #endif return(FPP_OK); @@ -490,14 +490,14 @@ ReturnCode doif(struct Global *global, int hash) if( hash == L_if ) { - unget( global ); + fpp_unget( global ); - ret = eval( global, &found ); + ret = fpp_eval( global, &found ); if( ret ) return( ret ); - found = (found != 0); /* Evaluate expr, != 0 is TRUE */ + found = (found != 0); /* Evaluate expr, != 0 is FPP_TRUE */ hash = L_ifdef; /* #if is now like #ifdef */ } @@ -506,34 +506,34 @@ ReturnCode doif(struct Global *global, int hash) if( type[c] != LET ) { /* Next non-blank isn't letter */ /* ... is an error */ - cerror( global, ERROR_MISSING_ARGUMENT ); + fpp_cerror( global, ERROR_MISSING_ARGUMENT ); #if !OLD_PREPROCESSOR - skipnl( global ); /* Prevent an extra */ + fpp_skipnl( global ); /* Prevent an extra */ - unget( global ); /* Error message */ + fpp_unget( global ); /* Error message */ #endif return(FPP_OK); } - found = ( lookid( global, c ) != NULL ); /* Look for it in symbol table */ + found = ( fpp_lookid( global, c ) != NULL ); /* Look for it in symbol table */ } if( found == (hash == L_ifdef) ) { - compiling = TRUE; + compiling = FPP_TRUE; - *global->ifptr |= TRUE_SEEN; + *global->ifptr |= FPP_TRUE_SEEN; } else - compiling = FALSE; + compiling = FPP_FALSE; return(FPP_OK); } INLINE FILE_LOCAL -ReturnCode doinclude( struct Global *global ) +ReturnCode fpp_doinclude( struct Global *global ) { /* * Process the #include control line. @@ -557,14 +557,14 @@ ReturnCode doinclude( struct Global *global ) int delim; ReturnCode ret; - delim = skipws( global ); + delim = fpp_skipws( global ); - if( (ret = macroid( global, &delim )) ) + if( (ret = fpp_macroid( global, &delim )) ) return(ret); if( delim != '<' && delim != '"' ) { - cerror( global, ERROR_INCLUDE_SYNTAX ); + fpp_cerror( global, ERROR_INCLUDE_SYNTAX ); return( FPP_OK ); } @@ -574,11 +574,11 @@ ReturnCode doinclude( struct Global *global ) global->workp = global->work; - while( (c = get(global)) != '\n' && c != EOF_CHAR ) - if( (ret = save( global, c )) ) /* Put it away. */ + while( (c = fpp_get(global)) != '\n' && c != EOF_CHAR ) + if( (ret = fpp_save( global, c )) ) /* Put it away. */ return( ret ); - unget( global ); /* Force nl after include */ + fpp_unget( global ); /* Force nl after include */ /* * The draft is unclear if the following should be done. @@ -589,21 +589,21 @@ ReturnCode doinclude( struct Global *global ) if( *global->workp != delim ) { - cerror( global, ERROR_INCLUDE_SYNTAX ); + fpp_cerror( global, ERROR_INCLUDE_SYNTAX ); return(FPP_OK); } *global->workp = EOS; /* Terminate filename */ - ret = openinclude( global, global->work, (delim == '"') ); + ret = fpp_openinclude( global, global->work, (delim == '"') ); if( ret && global->warnnoinclude ) { /* * Warn if #include file isn't there. */ - cwarn( global, WARN_CANNOT_OPEN_INCLUDE, global->work ); + fpp_cwarn( global, WARN_CANNOT_OPEN_INCLUDE, global->work ); } return( FPP_OK ); @@ -613,13 +613,13 @@ ReturnCode doinclude( struct Global *global ) ReturnCode MultiAssignLoad( struct Global *global, char *incptr, char *filename, char *tmpname ); #endif -ReturnCode openinclude( struct Global *global, +ReturnCode fpp_openinclude( struct Global *global, char *filename, /* Input file name */ - int searchlocal ) /* TRUE if #include "file" */ + int searchlocal ) /* FPP_TRUE if #include "file" */ { /* * Actually open an include file. This routine is only called from - * doinclude() above, but was written as a separate subroutine for + * fpp_doinclude() above, but was written as a separate subroutine for * programmer convenience. It searches the list of directories * and actually opens the file, linking it into the list of * active files. Returns ReturnCode. No error message is printed. @@ -631,11 +631,11 @@ ReturnCode openinclude( struct Global *global, if( filename[0] == '/' ) { - if( ! openfile( global, filename ) ) + if( ! fpp_openfile( global, filename ) ) return(FPP_OK); } - if( searchlocal ) + if( searchlocal && global->allowincludelocal ) { /* * Look in local directory first. @@ -645,12 +645,12 @@ ReturnCode openinclude( struct Global *global, * discarding the last pathname component of the source file * name then tacking on the #include argument. */ - if( hasdirectory( global->infile->filename, tmpname ) ) + if( fpp_hasdirectory( global->infile->filename, tmpname ) ) strcat( tmpname, filename ); else strcpy( tmpname, filename ); - if( ! openfile( global, tmpname ) ) + if( ! fpp_openfile( global, tmpname ) ) return(FPP_OK); } @@ -664,7 +664,7 @@ ReturnCode openinclude( struct Global *global, if( len + strlen(filename) >= sizeof(tmpname) ) { - cfatal( global, FATAL_FILENAME_BUFFER_OVERFLOW ); + fpp_cfatal( global, FATAL_FILENAME_BUFFER_OVERFLOW ); return( FPP_FILENAME_BUFFER_OVERFLOW ); } @@ -675,7 +675,7 @@ ReturnCode openinclude( struct Global *global, else sprintf( tmpname, "%s%s", *incptr, filename ); - if( !openfile( global, tmpname ) ) + if( !fpp_openfile( global, tmpname ) ) return(FPP_OK); } } @@ -684,25 +684,25 @@ ReturnCode openinclude( struct Global *global, } INLINE FILE_LOCAL -int hasdirectory( char *source, /* Directory to examine */ +int fpp_hasdirectory( char *source, /* Directory to examine */ char *result ) /* Put directory stuff here */ { /* * If a device or directory is found in the source filename string, the * node/device/directory part of the string is copied to result and - * hasdirectory returns TRUE. Else, nothing is copied and it returns FALSE. + * fpp_hasdirectory returns FPP_TRUE. Else, nothing is copied and it returns FPP_FALSE. */ char *tp2; if( (tp2 = strrchr( source, '/' ) ) == NULL ) - return(FALSE); + return(FPP_FALSE); strncpy( result, source, tp2 - source + 1 ); result[tp2 - source + 1] = EOS; - return( TRUE ); + return( FPP_TRUE ); } #ifdef _AMIGA @@ -742,7 +742,7 @@ ReturnCode MultiAssignLoad( struct Global *global, char *incptr, char *filename, // Normally we would pass the lock and filename // to the Load() routine, which would CD to the // directory and Open(filename), but in order to - // satisfy the exisiting openfile() function, we + // satisfy the exisiting fpp_openfile() function, we // bite the bullet and build the complete pathspec // rather than add the standard Load() routine. // @@ -750,7 +750,7 @@ ReturnCode MultiAssignLoad( struct Global *global, char *incptr, char *filename, { AddPart( tmpname, filename, NWORK ); - RtnCode = openfile( global, tmpname ); + RtnCode = fpp_openfile( global, tmpname ); if( ! RtnCode ) break; diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp3.c b/3rdparty/bgfx/3rdparty/fcpp/cpp3.c index 981c499ca8a..b67d4a29bfb 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp3.c +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp3.c @@ -25,20 +25,25 @@ SOFTWARE. #include "cppdef.h" #include "cpp.h" -ReturnCode openfile(struct Global *global, char *filename) +ReturnCode fpp_openfile(struct Global *global, char *filename) { /* * Open a file, add it to the linked list of open files. - * This is called only from openfile() in cpp2.c. + * This is called only from fpp_openfile() in cpp2.c. */ FILE *fp; ReturnCode ret; - if ((fp = fopen(filename, "r")) == NULL) + if (global->openfile) + fp = global->openfile(filename, "r", global->userdata); + else + fp = fopen(filename, "r"); + + if (fp == NULL) ret=FPP_OPEN_ERROR; else - ret=addfile(global, fp, filename); + ret=fpp_addfile(global, fp, filename); if(!ret && global->depends) { global->depends(filename, global->userdata); @@ -46,51 +51,51 @@ ReturnCode openfile(struct Global *global, char *filename) if(!ret && global->showincluded) { /* no error occured! */ - Error(global, "cpp: included \""); - Error(global, filename); - Error(global, "\"\n"); + fpp_Error(global, "cpp: included \""); + fpp_Error(global, filename); + fpp_Error(global, "\"\n"); } return(ret); } -ReturnCode addfile(struct Global *global, +ReturnCode fpp_addfile(struct Global *global, FILE *fp, /* Open file pointer */ char *filename) /* Name of the file */ { /* - * Initialize tables for this open file. This is called from openfile() + * Initialize tables for this open file. This is called from fpp_openfile() * above (for #include files), and from the entry to cpp to open the main - * input file. It calls a common routine, getfile() to build the FILEINFO - * structure which is used to read characters. (getfile() is also called + * input file. It calls a common routine, fpp_getfile() to build the FILEINFO + * structure which is used to read characters. (fpp_getfile() is also called * to setup a macro replacement.) */ FILEINFO *file; ReturnCode ret; - ret = getfile(global, NBUFF, filename, &file); + ret = fpp_getfile(global, NBUFF, filename, &file); if(ret) return(ret); file->fp = fp; /* Better remember FILE * */ file->buffer[0] = EOS; /* Initialize for first read */ global->line = 1; /* Working on line 1 now */ - global->wrongline = TRUE; /* Force out initial #line */ + global->wrongline = FPP_TRUE; /* Force out initial #line */ return(FPP_OK); } -int dooptions(struct Global *global, struct fppTag *tags) +int fpp_dooptions(struct Global *global, struct fppTag *tags) { /* - * dooptions is called to process command line arguments (-Detc). + * fpp_dooptions is called to process command line arguments (-Detc). * It is called only at cpp startup. */ DEFBUF *dp; - char end=FALSE; /* end of taglist */ + char end=FPP_FALSE; /* end of taglist */ while(tags && !end) { switch(tags->tag) { case FPPTAG_END: - end=TRUE; + end=FPP_TRUE; break; case FPPTAG_INITFUNC: global->initialfunc = (char *) tags->data; @@ -122,7 +127,7 @@ int dooptions(struct Global *global, struct fppTag *tags) case FPPTAG_OUTPUTINCLUDES: global->showincluded = tags->data?1:0; break; - case FPPTAG_IGNOREVERSION: + case FPPTAG_SHOWVERSION: global->showversion = tags->data?1:0; break; case FPPTAG_WARNILLEGALCPP: @@ -133,8 +138,8 @@ int dooptions(struct Global *global, struct fppTag *tags) break; case FPPTAG_KEEPCOMMENTS: if(tags->data) { - global->cflag = TRUE; - global->keepcomments = TRUE; + global->cflag = FPP_TRUE; + global->keepcomments = FPP_TRUE; } break; case FPPTAG_DEFINE: @@ -153,19 +158,19 @@ int dooptions(struct Global *global, struct fppTag *tags) /* * Now, save the word and its definition. */ - dp = defendel(global, symbol, FALSE); + dp = fpp_defendel(global, symbol, FPP_FALSE); if(!dp) return(FPP_OUT_OF_MEMORY); - dp->repl = savestring(global, text); + dp->repl = fpp_savestring(global, text); dp->nargs = DEF_NOARGS; } break; case FPPTAG_IGNORE_NONFATAL: - global->eflag = TRUE; + global->eflag = FPP_TRUE; break; case FPPTAG_INCLUDE_DIR: if (global->incend >= &global->incdir[NINCLUDE]) { - cfatal(global, FATAL_TOO_MANY_INCLUDE_DIRS); + fpp_cfatal(global, FATAL_TOO_MANY_INCLUDE_DIRS); return(FPP_TOO_MANY_INCLUDE_DIRS); } *global->incend++ = (char *)tags->data; @@ -173,7 +178,7 @@ int dooptions(struct Global *global, struct fppTag *tags) case FPPTAG_INCLUDE_FILE: case FPPTAG_INCLUDE_MACRO_FILE: if (global->included >= NINCLUDE) { - cfatal(global, FATAL_TOO_MANY_INCLUDE_FILES); + fpp_cfatal(global, FATAL_TOO_MANY_INCLUDE_FILES); return(FPP_TOO_MANY_INCLUDE_FILES); } global->include[(unsigned)global->included] = (char *)tags->data; @@ -196,7 +201,7 @@ int dooptions(struct Global *global, struct fppTag *tags) { SIZES *sizp; /* For -S */ int size; /* For -S */ - int isdatum; /* FALSE for -S* */ + int isdatum; /* FPP_FALSE for -S* */ int endtest; /* For -S */ char *text=(char *)tags->data; @@ -225,14 +230,14 @@ int dooptions(struct Global *global, struct fppTag *tags) sizp++; } if (sizp->bits != endtest) - cwarn(global, WARN_TOO_FEW_VALUES_TO_SIZEOF, NULL); + fpp_cwarn(global, WARN_TOO_FEW_VALUES_TO_SIZEOF, NULL); else if (*text != EOS) - cwarn(global, WARN_TOO_MANY_VALUES_TO_SIZEOF, NULL); + fpp_cwarn(global, WARN_TOO_MANY_VALUES_TO_SIZEOF, NULL); } break; case FPPTAG_UNDEFINE: - if (defendel(global, (char *)tags->data, TRUE) == NULL) - cwarn(global, WARN_NOT_DEFINED, tags->data); + if (fpp_defendel(global, (char *)tags->data, FPP_TRUE) == NULL) + fpp_cwarn(global, WARN_NOT_DEFINED, tags->data); break; case FPPTAG_OUTPUT_DEFINES: global->wflag++; @@ -265,8 +270,14 @@ int dooptions(struct Global *global, struct fppTag *tags) case FPPTAG_WEBMODE: global->webmode=(tags->data?1:0); break; + case FPPTAG_ALLOW_INCLUDE_LOCAL: + global->allowincludelocal=(tags->data?1:0); + break; + case FPPTAG_FILEOPENFUNC: +// global->openfile = (FILE* (*)(char *,char *))tags->data; + break; default: - cwarn(global, WARN_INTERNAL_ERROR, NULL); + fpp_cwarn(global, WARN_INTERNAL_ERROR, NULL); break; } tags++; @@ -274,7 +285,7 @@ int dooptions(struct Global *global, struct fppTag *tags) return(0); } -ReturnCode initdefines(struct Global *global) +ReturnCode fpp_initdefines(struct Global *global) { /* * Initialize the built-in #define's. There are two flavors: @@ -307,23 +318,23 @@ ReturnCode initdefines(struct Global *global) if (!(global->nflag & NFLAG_BUILTIN)) { for (pp = global->preset; *pp != NULL; pp++) { if (*pp[0] != EOS) { - dp = defendel(global, *pp, FALSE); + dp = fpp_defendel(global, *pp, FPP_FALSE); if(!dp) return(FPP_OUT_OF_MEMORY); - dp->repl = savestring(global, "1"); + dp->repl = fpp_savestring(global, "1"); dp->nargs = DEF_NOARGS; } } } /* * The magic pre-defines (__FILE__ and __LINE__ are - * initialized with negative argument counts. expand() + * initialized with negative argument counts. fpp_expand() * notices this and calls the appropriate routine. * DEF_NOARGS is one greater than the first "magic" definition. */ if (!(global->nflag & NFLAG_PREDEFINE)) { for (pp = global->magic, i = DEF_NOARGS; *pp != NULL; pp++) { - dp = defendel(global, *pp, FALSE); + dp = fpp_defendel(global, *pp, FPP_FALSE); if(!dp) return(FPP_OUT_OF_MEMORY); dp->nargs = --i; @@ -332,7 +343,7 @@ ReturnCode initdefines(struct Global *global) /* * Define __DATE__ as today's date. */ - dp = defendel(global, "__DATE__", FALSE); + dp = fpp_defendel(global, "__DATE__", FPP_FALSE); tp = malloc(14); if(!tp || !dp) return(FPP_OUT_OF_MEMORY); @@ -348,7 +359,7 @@ ReturnCode initdefines(struct Global *global) /* * Define __TIME__ as this moment's time. */ - dp = defendel(global, "__TIME__", FALSE); + dp = fpp_defendel(global, "__TIME__", FPP_FALSE); tp = malloc(11); if(!tp || !dp) return(FPP_OUT_OF_MEMORY); @@ -363,7 +374,7 @@ ReturnCode initdefines(struct Global *global) return(FPP_OK); } -void deldefines(struct Global *global) +void fpp_delbuiltindefines(struct Global *global) { /* * Delete the built-in #define's. @@ -376,25 +387,25 @@ void deldefines(struct Global *global) */ if (global->wflag < 2) { for (pp = global->preset; *pp != NULL; pp++) { - defendel(global, *pp, TRUE); + fpp_defendel(global, *pp, FPP_TRUE); } } /* * The magic pre-defines __FILE__ and __LINE__ */ for (pp = global->magic; *pp != NULL; pp++) { - defendel(global, *pp, TRUE); + fpp_defendel(global, *pp, FPP_TRUE); } #if OK_DATE /* * Undefine __DATE__. */ - defendel(global, "__DATE__", TRUE); + fpp_defendel(global, "__DATE__", FPP_TRUE); /* * Undefine __TIME__. */ - defendel(global, "__TIME__", TRUE); + fpp_defendel(global, "__TIME__", FPP_TRUE); #endif return; } diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp4.c b/3rdparty/bgfx/3rdparty/fcpp/cpp4.c index cfa871e6c41..c644dddb6f6 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp4.c +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp4.c @@ -24,15 +24,15 @@ SOFTWARE. #include "cppdef.h" #include "cpp.h" -INLINE FILE_LOCAL ReturnCode checkparm(struct Global *, int, DEFBUF *, int); -INLINE FILE_LOCAL ReturnCode stparmscan(struct Global *, int); -INLINE FILE_LOCAL ReturnCode textput(struct Global *, char *); -FILE_LOCAL ReturnCode charput(struct Global *, int); -INLINE FILE_LOCAL ReturnCode expcollect(struct Global *); -INLINE FILE_LOCAL char *doquoting(char *, char *); +INLINE FILE_LOCAL ReturnCode fpp_checkparm(struct Global *, int, DEFBUF *, int); +INLINE FILE_LOCAL ReturnCode fpp_stparmscan(struct Global *, int); +INLINE FILE_LOCAL ReturnCode fpp_textput(struct Global *, char *); +FILE_LOCAL ReturnCode fpp_charput(struct Global *, int); +INLINE FILE_LOCAL ReturnCode fpp_expcollect(struct Global *); +INLINE FILE_LOCAL char *fpp_doquoting(char *, char *); -ReturnCode dodefine(struct Global *global) +ReturnCode fpp_dodefine(struct Global *global) { /* * Called from control when a #define is scanned. This module @@ -61,63 +61,63 @@ ReturnCode dodefine(struct Global *global) * is not. * * The following subroutines are called from define(): - * checkparm called when a token is scanned. It checks through the + * fpp_checkparm called when a token is scanned. It checks through the * array of formal parameters. If a match is found, the * token is replaced by a control byte which will be used * to locate the parameter when the macro is expanded. - * textput puts a string in the macro work area (parm[]), updating + * fpp_textput puts a string in the macro work area (parm[]), updating * parmp to point to the first free byte in parm[]. - * textput() tests for work buffer overflow. - * charput puts a single character in the macro work area (parm[]) - * in a manner analogous to textput(). + * fpp_textput() tests for work buffer overflow. + * fpp_charput puts a single character in the macro work area (parm[]) + * in a manner analogous to fpp_textput(). */ int c; DEFBUF *dp; /* -> new definition */ - int isredefine; /* TRUE if redefined */ + int isredefine; /* FPP_TRUE if redefined */ char *old = NULL; /* Remember redefined */ ReturnCode ret; #if OK_CONCAT int quoting; /* Remember we saw a # */ #endif - if (type[(c = skipws(global))] != LET) { - cerror(global, ERROR_DEFINE_SYNTAX); - global->inmacro = FALSE; /* Stop hack */ + if (type[(c = fpp_skipws(global))] != LET) { + fpp_cerror(global, ERROR_DEFINE_SYNTAX); + global->inmacro = FPP_FALSE; /* Stop hack */ return(FPP_OK); } - isredefine = FALSE; /* Set if redefining */ - if ((dp = lookid(global, c)) == NULL) { /* If not known now */ - dp = defendel(global, global->tokenbuf, FALSE); /* Save the name */ + isredefine = FPP_FALSE; /* Set if redefining */ + if ((dp = fpp_lookid(global, c)) == NULL) { /* If not known now */ + dp = fpp_defendel(global, global->tokenbuf, FPP_FALSE); /* Save the name */ if(!dp) return(FPP_OUT_OF_MEMORY); } else { /* It's known: */ - isredefine = TRUE; /* Remember this fact */ + isredefine = FPP_TRUE; /* Remember this fact */ old = dp->repl; /* Remember replacement */ dp->repl = NULL; /* No replacement now */ } global->parlist[0] = global->parmp = global->parm; /* Setup parm buffer */ - if ((c = get(global)) == '(') { /* With arguments? */ + if ((c = fpp_get(global)) == '(') { /* With arguments? */ global->nargs = 0; /* Init formals counter */ do { /* Collect formal parms */ if (global->nargs >= LASTPARM) { - cfatal(global, FATAL_TOO_MANY_ARGUMENTS_MACRO); + fpp_cfatal(global, FATAL_TOO_MANY_ARGUMENTS_MACRO); return(FPP_TOO_MANY_ARGUMENTS); - } else if ((c = skipws(global)) == ')') + } else if ((c = fpp_skipws(global)) == ')') break; /* Got them all */ else if (type[c] != LET) { /* Bad formal syntax */ - cerror(global, ERROR_DEFINE_SYNTAX); - global->inmacro = FALSE; /* Stop hack */ + fpp_cerror(global, ERROR_DEFINE_SYNTAX); + global->inmacro = FPP_FALSE; /* Stop hack */ return(FPP_OK); } - scanid(global, c); /* Get the formal param */ + fpp_scanid(global, c); /* Get the formal param */ global->parlist[global->nargs++] = global->parmp; /* Save its start */ - ret=textput(global, global->tokenbuf); /* Save text in parm[] */ + ret=fpp_textput(global, global->tokenbuf); /* Save text in parm[] */ if(ret) return(ret); - } while ((c = skipws(global)) == ','); /* Get another argument */ + } while ((c = fpp_skipws(global)) == ','); /* Get another argument */ if (c != ')') { /* Must end at ) */ - cerror(global, ERROR_DEFINE_SYNTAX); - global->inmacro = FALSE; /* Stop hack */ + fpp_cerror(global, ERROR_DEFINE_SYNTAX); + global->inmacro = FPP_FALSE; /* Stop hack */ return(FPP_OK); } c = ' '; /* Will skip to body */ @@ -130,14 +130,14 @@ ReturnCode dodefine(struct Global *global) global->nargs = DEF_NOARGS; /* No () parameters */ } if (type[c] == SPA) /* At whitespace? */ - c = skipws(global); /* Not any more. */ + c = fpp_skipws(global); /* Not any more. */ global->workp = global->work; /* Replacement put here */ - global->inmacro = TRUE; /* Keep \ now */ + global->inmacro = FPP_TRUE; /* Keep \ now */ quoting = 0; /* No # seen yet. */ while (c != EOF_CHAR && c != '\n') { /* Compile macro body */ #if OK_CONCAT if (c == '#') { /* Token concatenation? */ - if ((c = get(global)) != '#') { /* No, not really */ + if ((c = fpp_get(global)) != '#') { /* No, not really */ quoting = 1; /* Maybe quoting op. */ continue; } @@ -145,16 +145,16 @@ ReturnCode dodefine(struct Global *global) --global->workp; /* Erase leading spaces */ // if ((ret=save(global, TOK_SEP))) /* Stuff a delimiter */ // return(ret); - c = skipws(global); /* Eat whitespace */ + c = fpp_skipws(global); /* Eat whitespace */ continue; } #endif switch (type[c]) { case LET: #if OK_CONCAT - ret=checkparm(global, c, dp, quoting); /* Might be a formal */ + ret=fpp_checkparm(global, c, dp, quoting); /* Might be a formal */ #else - ret=checkparm(c, dp); /* Might be a formal */ + ret=fpp_checkparm(c, dp); /* Might be a formal */ #endif if(ret) return(ret); @@ -162,24 +162,24 @@ ReturnCode dodefine(struct Global *global) case DIG: /* Number in mac. body */ case DOT: /* Maybe a float number */ - ret=scannumber(global, c, save); /* Scan it off */ + ret=fpp_scannumber(global, c, fpp_save); /* Scan it off */ if(ret) return(ret); break; case QUO: /* String in mac. body */ - ret=stparmscan(global, c); + ret=fpp_stparmscan(global, c); if(ret) return(ret); break; case BSH: /* Backslash */ - ret=save(global, '\\'); + ret=fpp_save(global, '\\'); if(ret) return(ret); - if ((c = get(global)) == '\n') - global->wrongline = TRUE; - ret=save(global, c); + if ((c = fpp_get(global)) == '\n') + global->wrongline = FPP_TRUE; + ret=fpp_save(global, c); if(ret) return(ret); break; @@ -195,27 +195,27 @@ ReturnCode dodefine(struct Global *global) c = ' '; /* Normalize tabs */ /* Fall through to store character */ default: /* Other character */ - ret=save(global, c); + ret=fpp_save(global, c); if(ret) return(ret); break; } - c = get(global); + c = fpp_get(global); quoting = 0; /* Only when immediately*/ /* preceding a formal */ } - global->inmacro = FALSE; /* Stop newline hack */ - unget(global); /* For control check */ + global->inmacro = FPP_FALSE; /* Stop newline hack */ + fpp_unget(global); /* For control check */ if (global->workp > global->work && global->workp[-1] == ' ') /* Drop trailing blank */ global->workp--; *global->workp = EOS; /* Terminate work */ - dp->repl = savestring(global, global->work); /* Save the string */ + dp->repl = fpp_savestring(global, global->work); /* Save the string */ dp->nargs = global->nargs; /* Save arg count */ if (isredefine) { /* Error if redefined */ if ((old != NULL && dp->repl != NULL && !streq(old, dp->repl)) || (old == NULL && dp->repl != NULL) || (old != NULL && dp->repl == NULL)) { - cerror(global, ERROR_REDEFINE, dp->name); + fpp_cerror(global, ERROR_REDEFINE, dp->name); } if (old != NULL) /* We don't need the */ free(old); /* old definition now. */ @@ -224,7 +224,7 @@ ReturnCode dodefine(struct Global *global) } INLINE FILE_LOCAL -ReturnCode checkparm(struct Global *global, +ReturnCode fpp_checkparm(struct Global *global, int c, DEFBUF *dp, int quoting) /* Preceded by a # ? */ @@ -233,7 +233,7 @@ ReturnCode checkparm(struct Global *global, * Replace this param if it's defined. Note that the macro name is a * possible replacement token. We stuff DEF_MAGIC in front of the token * which is treated as a LETTER by the token scanner and eaten by - * the output routine. This prevents the macro expander from + * the fpp_output routine. This prevents the macro expander from * looping if someone writes "#define foo foo". */ @@ -241,29 +241,29 @@ ReturnCode checkparm(struct Global *global, char *cp; ReturnCode ret=FPP_OK; - scanid(global, c); /* Get parm to tokenbuf */ + fpp_scanid(global, c); /* Get parm to tokenbuf */ for (i = 0; i < global->nargs; i++) { /* For each argument */ if (streq(global->parlist[i], global->tokenbuf)) { /* If it's known */ #if OK_CONCAT if (quoting) { /* Special handling of */ - ret=save(global, QUOTE_PARM); /* #formal inside defn */ + ret=fpp_save(global, QUOTE_PARM); /* #formal inside defn */ if(ret) return(ret); } #endif - ret=save(global, i + MAC_PARM); /* Save a magic cookie */ + ret=fpp_save(global, i + MAC_PARM); /* Save a magic cookie */ return(ret); /* And exit the search */ } } if (streq(dp->name, global->tokenbuf)) /* Macro name in body? */ - ret=save(global, DEF_MAGIC); /* Save magic marker */ - for (cp = global->tokenbuf; *cp != EOS;) /* And save */ - ret=save(global, *cp++); /* The token itself */ + ret=fpp_save(global, DEF_MAGIC); /* Save magic marker */ + for (cp = global->tokenbuf; *cp != EOS;) /* And fpp_save */ + ret=fpp_save(global, *cp++); /* The token itself */ return(ret); } INLINE FILE_LOCAL -ReturnCode stparmscan(struct Global *global, int delim) +ReturnCode fpp_stparmscan(struct Global *global, int delim) { /* * Normal string parameter scan. @@ -274,9 +274,9 @@ ReturnCode stparmscan(struct Global *global, int delim) ReturnCode ret; wp = (unsigned char *)global->workp; /* Here's where it starts */ - ret=scanstring(global, delim, save); + ret=fpp_scanstring(global, delim, fpp_save); if(ret) - return(ret); /* Exit on scanstring error */ + return(ret); /* Exit on fpp_scanstring error */ global->workp[-1] = EOS; /* Erase trailing quote */ wp++; /* -> first string content byte */ for (i = 0; i < global->nargs; i++) { @@ -292,23 +292,23 @@ ReturnCode stparmscan(struct Global *global, int delim) return(FPP_OK); } -void doundef(struct Global *global) +void fpp_doundef(struct Global *global) /* * Remove the symbol from the defined list. * Called from the #control processor. */ { int c; - if (type[(c = skipws(global))] != LET) - cerror(global, ERROR_ILLEGAL_UNDEF); + if (type[(c = fpp_skipws(global))] != LET) + fpp_cerror(global, ERROR_ILLEGAL_UNDEF); else { - scanid(global, c); /* Get name to tokenbuf */ - (void) defendel(global, global->tokenbuf, TRUE); + fpp_scanid(global, c); /* Get name to tokenbuf */ + (void) fpp_defendel(global, global->tokenbuf, FPP_TRUE); } } INLINE FILE_LOCAL -ReturnCode textput(struct Global *global, char *text) +ReturnCode fpp_textput(struct Global *global, char *text) { /* * Put the string in the parm[] buffer. @@ -318,7 +318,7 @@ ReturnCode textput(struct Global *global, char *text) size = strlen(text) + 1; if ((global->parmp + size) >= &global->parm[NPARMWORK]) { - cfatal(global, FATAL_MACRO_AREA_OVERFLOW); + fpp_cfatal(global, FATAL_MACRO_AREA_OVERFLOW); return(FPP_WORK_AREA_OVERFLOW); } else { strcpy(global->parmp, text); @@ -328,14 +328,14 @@ ReturnCode textput(struct Global *global, char *text) } FILE_LOCAL -ReturnCode charput(struct Global *global, int c) +ReturnCode fpp_charput(struct Global *global, int c) { /* * Put the byte in the parm[] buffer. */ if (global->parmp >= &global->parm[NPARMWORK]) { - cfatal(global, FATAL_MACRO_AREA_OVERFLOW); + fpp_cfatal(global, FATAL_MACRO_AREA_OVERFLOW); return(FPP_WORK_AREA_OVERFLOW); } *global->parmp++ = c; @@ -346,15 +346,15 @@ ReturnCode charput(struct Global *global, int c) * M a c r o E x p a n s i o n */ -ReturnCode expand(struct Global *global, DEFBUF *tokenp) +ReturnCode fpp_expand(struct Global *global, DEFBUF *tokenp) { /* * Expand a macro. Called from the cpp mainline routine (via subroutine - * macroid()) when a token is found in the symbol table. It calls - * expcollect() to parse actual parameters, checking for the correct number. + * fpp_macroid()) when a token is found in the symbol table. It calls + * fpp_expcollect() to parse actual parameters, checking for the correct number. * It then creates a "file" containing a single line containing the * macro with actual parameters inserted appropriately. This is - * "pushed back" onto the input stream. (When the get() routine runs + * "pushed back" onto the input stream. (When the fpp_get() routine runs * off the end of the macro line, it will dismiss the macro itself.) */ int c; @@ -368,12 +368,12 @@ ReturnCode expand(struct Global *global, DEFBUF *tokenp) if (global->recursion++ == 0) global->macro = tokenp; else if (global->recursion == RECURSION_LIMIT) { - cerror(global, ERROR_RECURSIVE_MACRO, tokenp->name, global->macro->name); + fpp_cerror(global, ERROR_RECURSIVE_MACRO, tokenp->name, global->macro->name); if (global->rec_recover) { do { - c = get(global); + c = fpp_get(global); } while (global->infile != NULL && global->infile->fp == NULL); - unget(global); + fpp_unget(global); global->recursion = 0; return(FPP_OK); } @@ -396,7 +396,7 @@ ReturnCode expand(struct Global *global, DEFBUF *tokenp) break; } } - ret=ungetstring(global, global->work); + ret=fpp_ungetstring(global, global->work); if(ret) return(ret); break; @@ -406,7 +406,7 @@ ReturnCode expand(struct Global *global, DEFBUF *tokenp) if (file->fp != NULL) { sprintf(global->work, "\"%s\"", (file->progname != NULL) ? file->progname : file->filename); - ret=ungetstring(global, global->work); + ret=fpp_ungetstring(global, global->work); if(ret) return(ret); break; @@ -417,14 +417,14 @@ ReturnCode expand(struct Global *global, DEFBUF *tokenp) case (-4): /* __FUNC__ */ sprintf(global->work, "\"%s\"", global->functionname[0]? global->functionname : ""); - ret=ungetstring(global, global->work); + ret=fpp_ungetstring(global, global->work); if(ret) return(ret); break; case (-5): /* __FUNC_LINE__ */ sprintf(global->work, "%d", global->funcline); - ret=ungetstring(global, global->work); + ret=fpp_ungetstring(global, global->work); if(ret) return(ret); break; @@ -434,11 +434,11 @@ ReturnCode expand(struct Global *global, DEFBUF *tokenp) * Nothing funny about this macro. */ if (tokenp->nargs < 0) { - cfatal(global, FATAL_ILLEGAL_MACRO, tokenp->name); + fpp_cfatal(global, FATAL_ILLEGAL_MACRO, tokenp->name); return(FPP_ILLEGAL_MACRO); } - while ((c = skipws(global)) == '\n') /* Look for (, skipping */ - global->wrongline = TRUE; /* spaces and newlines */ + while ((c = fpp_skipws(global)) == '\n') /* Look for (, skipping */ + global->wrongline = FPP_TRUE; /* spaces and newlines */ if (c != '(') { /* * If the programmer writes @@ -447,27 +447,27 @@ ReturnCode expand(struct Global *global, DEFBUF *tokenp) * foo [no ()] * just write foo to the output stream. */ - unget(global); - cwarn(global, WARN_MACRO_NEEDS_ARGUMENTS, tokenp->name); + fpp_unget(global); + fpp_cwarn(global, WARN_MACRO_NEEDS_ARGUMENTS, tokenp->name); /* fputs(tokenp->name, stdout); */ - Putstring(global, tokenp->name); + fpp_Putstring(global, tokenp->name); return(FPP_OK); - } else if (!(ret=expcollect(global))) { /* Collect arguments */ + } else if (!(ret=fpp_expcollect(global))) { /* Collect arguments */ if (tokenp->nargs != global->nargs) { /* Should be an error? */ - cwarn(global, WARN_WRONG_NUMBER_ARGUMENTS, tokenp->name); + fpp_cwarn(global, WARN_WRONG_NUMBER_ARGUMENTS, tokenp->name); } } else { /* Collect arguments */ return(ret); /* We failed in argument colleting! */ } case DEF_NOARGS: /* No parameters just stuffs */ - ret=expstuff(global, tokenp->name, tokenp->repl); /* expand macro */ + ret=fpp_expstuff(global, tokenp->name, tokenp->repl); /* expand macro */ } /* nargs switch */ return(ret); } INLINE FILE_LOCAL -ReturnCode expcollect(struct Global *global) +ReturnCode fpp_expcollect(struct Global *global) { /* * Collect the actual parameters for this macro. @@ -479,8 +479,8 @@ ReturnCode expcollect(struct Global *global) for (;;) { paren = 0; /* Collect next arg. */ - while ((c = skipws(global)) == '\n')/* Skip over whitespace */ - global->wrongline = TRUE; /* and newlines. */ + while ((c = fpp_skipws(global)) == '\n')/* Skip over whitespace */ + global->wrongline = FPP_TRUE; /* and newlines. */ if (c == ')') { /* At end of all args? */ /* * Note that there is a guard byte in parm[] @@ -490,22 +490,22 @@ ReturnCode expcollect(struct Global *global) break; /* Exit collection loop */ } else if (global->nargs >= LASTPARM) { - cfatal(global, FATAL_TOO_MANY_ARGUMENTS_EXPANSION); + fpp_cfatal(global, FATAL_TOO_MANY_ARGUMENTS_EXPANSION); return(FPP_TOO_MANY_ARGUMENTS); } global->parlist[global->nargs++] = global->parmp; /* At start of new arg */ - for (;; c = cget(global)) { /* Collect arg's bytes */ + for (;; c = fpp_cget(global)) { /* Collect arg's bytes */ if (c == EOF_CHAR) { - cerror(global, ERROR_EOF_IN_ARGUMENT); + fpp_cerror(global, ERROR_EOF_IN_ARGUMENT); return(FPP_EOF_IN_MACRO); /* Sorry. */ } else if (c == '\\') { /* Quote next character */ - charput(global, c); /* Save the \ for later */ - charput(global, cget(global)); /* Save the next char. */ + fpp_charput(global, c); /* Save the \ for later */ + fpp_charput(global, fpp_cget(global)); /* Save the next char. */ continue; /* And go get another */ } else if (type[c] == QUO) { /* Start of string? */ - ret=scanstring(global, c, (ReturnCode (*)(struct Global *, int))charput); /* Scan it off */ + ret=fpp_scanstring(global, c, (ReturnCode (*)(struct Global *, int))fpp_charput); /* Scan it off */ if(ret) return(ret); continue; /* Go get next char */ @@ -514,7 +514,7 @@ ReturnCode expcollect(struct Global *global) paren++; /* To know about commas */ else if (c == ')') { /* Other side too */ if (paren == 0) { /* At the end? */ - unget(global); /* Look at it later */ + fpp_unget(global); /* Look at it later */ break; /* Exit arg getter. */ } paren--; /* More to come. */ @@ -522,10 +522,10 @@ ReturnCode expcollect(struct Global *global) else if (c == ',' && paren == 0) /* Comma delimits args */ break; else if (c == '\n') /* Newline inside arg? */ - global->wrongline = TRUE; /* We'll need a #line */ - charput(global, c); /* Store this one */ + global->wrongline = FPP_TRUE; /* We'll need a #line */ + fpp_charput(global, c); /* Store this one */ } /* Collect an argument */ - charput(global, EOS); /* Terminate argument */ + fpp_charput(global, EOS); /* Terminate argument */ } /* Collect all args. */ return(FPP_OK); /* Normal return */ } @@ -534,7 +534,7 @@ ReturnCode expcollect(struct Global *global) #if OK_CONCAT INLINE FILE_LOCAL -char *doquoting(char *to, char *from) +char *fpp_doquoting(char *to, char *from) { *to++ = '"'; while (*from) { @@ -549,7 +549,7 @@ char *doquoting(char *to, char *from) #endif -ReturnCode expstuff(struct Global *global, +ReturnCode fpp_expstuff(struct Global *global, char *MacroName, char *MacroReplace) { @@ -568,7 +568,7 @@ ReturnCode expstuff(struct Global *global, char quoting; /* Quote macro argument */ #endif - ret = getfile(global, NBUFF, MacroName, &file); + ret = fpp_getfile(global, NBUFF, MacroName, &file); if(ret) return(ret); inp = MacroReplace; /* -> macro replacement */ @@ -599,7 +599,7 @@ ReturnCode expstuff(struct Global *global, } #endif if ((defp + size) >= defend) { - cfatal(global, FATAL_OUT_OF_SPACE_IN_ARGUMENT, MacroName); + fpp_cfatal(global, FATAL_OUT_OF_SPACE_IN_ARGUMENT, MacroName); return(FPP_OUT_OF_SPACE_IN_MACRO_EXPANSION); } /* @@ -611,7 +611,7 @@ ReturnCode expstuff(struct Global *global, } #if OK_CONCAT else if (quoting) - defp = doquoting(defp, global->parlist[c]); + defp = fpp_doquoting(defp, global->parlist[c]); #endif else { strcpy(defp, global->parlist[c]); @@ -620,7 +620,7 @@ else { } } else if (defp >= defend) { - cfatal(global, FATAL_OUT_OF_SPACE_IN_ARGUMENT, MacroName); + fpp_cfatal(global, FATAL_OUT_OF_SPACE_IN_ARGUMENT, MacroName); return(FPP_OUT_OF_SPACE_IN_MACRO_EXPANSION); } else *defp++ = c; diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp5.c b/3rdparty/bgfx/3rdparty/fcpp/cpp5.c index 598960d8701..2ca8326ac10 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp5.c +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp5.c @@ -24,12 +24,12 @@ SOFTWARE. #include "cppdef.h" #include "cpp.h" -INLINE FILE_LOCAL ReturnCode evallex(struct Global *, int, int *); -INLINE FILE_LOCAL ReturnCode dosizeof(struct Global *, int *); -INLINE FILE_LOCAL int bittest(int); -INLINE FILE_LOCAL int evalnum(struct Global *, int); -INLINE FILE_LOCAL int evalchar(struct Global *, int); -INLINE FILE_LOCAL int *evaleval(struct Global *, int *, int, int); +INLINE FILE_LOCAL ReturnCode fpp_evallex(struct Global *, int, int *); +INLINE FILE_LOCAL ReturnCode fpp_dosizeof(struct Global *, int *); +INLINE FILE_LOCAL int fpp_bittest(int); +INLINE FILE_LOCAL int fpp_evalnum(struct Global *, int); +INLINE FILE_LOCAL int fpp_evalchar(struct Global *, int); +INLINE FILE_LOCAL int *fpp_evaleval(struct Global *, int *, int, int); /* * Evaluate an #if expression. @@ -92,7 +92,7 @@ static char opdope[OP_MAX] = { typedef struct optab { char op; /* Operator */ char prec; /* Its precedence */ - char skip; /* Short-circuit: TRUE to skip */ + char skip; /* Short-circuit: FPP_TRUE to skip */ } OPTAB; #ifdef nomacargs @@ -216,18 +216,18 @@ SIZES size_table[] = { #endif /* OK_SIZEOF */ -ReturnCode eval(struct Global *global, int *eval) +ReturnCode fpp_eval(struct Global *global, int *eval) { /* * Evaluate an expression. Straight-forward operator precedence. - * This is called from control() on encountering an #if statement. + * This is called from fpp_control() on encountering an #if statement. * It calls the following routines: - * evallex Lexical analyser -- returns the type and value of + * fpp_evallex Lexical analyser -- returns the type and value of * the next input token. - * evaleval Evaluate the current operator, given the values on + * fpp_evaleval Evaluate the current operator, given the values on * the value stack. Returns a pointer to the (new) * value stack. - * For compatiblity with older cpp's, this return returns 1 (TRUE) + * For compatiblity with older cpp's, this return returns 1 (FPP_TRUE) * if a syntax error is detected. */ int op; /* Current operator */ @@ -240,7 +240,7 @@ ReturnCode eval(struct Global *global, int *eval) int value[NEXP]; /* Value stack */ OPTAB opstack[NEXP]; /* Operand stack */ ReturnCode ret; - char again=TRUE; + char again=FPP_TRUE; valp = value; opp = opstack; @@ -250,7 +250,7 @@ ReturnCode eval(struct Global *global, int *eval) binop = 0; while(again) { - ret=evallex(global, opp->skip, &op); + ret=fpp_evallex(global, opp->skip, &op); if(ret) return(ret); if (op == OP_SUB && binop == 0) @@ -263,27 +263,27 @@ ReturnCode eval(struct Global *global, int *eval) } if (op == DIG) { /* Value? */ if (binop != 0) { - cerror(global, ERROR_MISPLACED_CONSTANT); + fpp_cerror(global, ERROR_MISPLACED_CONSTANT); *eval=1; return(FPP_OK); } else if (valp >= &value[NEXP-1]) { - cerror(global, ERROR_IF_OVERFLOW); + fpp_cerror(global, ERROR_IF_OVERFLOW); *eval=1; return(FPP_OK); } else { *valp++ = global->evalue; binop = 1; } - again=TRUE; + again=FPP_TRUE; continue; } else if (op > OP_END) { - cerror(global, ERROR_ILLEGAL_IF_LINE); + fpp_cerror(global, ERROR_ILLEGAL_IF_LINE); *eval=1; return(FPP_OK); } prec = opdope[op]; if (binop != (prec & 1)) { - cerror(global, ERROR_OPERATOR, opname[op]); + fpp_cerror(global, ERROR_OPERATOR, opname[op]); *eval=1; return(FPP_OK); } @@ -300,7 +300,7 @@ ReturnCode eval(struct Global *global, int *eval) */ opp++; if (opp >= &opstack[NEXP]) { - cerror(global, ERROR_EXPR_OVERFLOW, opname[op]); + fpp_cerror(global, ERROR_EXPR_OVERFLOW, opname[op]); *eval=1; return(FPP_OK); } @@ -323,7 +323,7 @@ ReturnCode eval(struct Global *global, int *eval) else { /* Other ops leave */ opp->skip = op1; /* skipping unchanged. */ } - again=TRUE; + again=FPP_TRUE; continue; } /* @@ -338,11 +338,11 @@ ReturnCode eval(struct Global *global, int *eval) return(FPP_OK); } /* Read another op. */ - again=TRUE; + again=FPP_TRUE; continue; case OP_LPA: /* ( on stack */ if (op != OP_RPA) { /* Matches ) on input */ - cerror(global, ERROR_UNBALANCED_PARENS, opname[op]); + fpp_cerror(global, ERROR_UNBALANCED_PARENS, opname[op]); *eval=1; return(FPP_OK); } @@ -350,12 +350,12 @@ ReturnCode eval(struct Global *global, int *eval) /* -- Fall through */ case OP_QUE: /* Evaluate true expr. */ - again=TRUE; + again=FPP_TRUE; continue; case OP_COL: /* : on stack. */ opp--; /* Unstack : */ if (opp->op != OP_QUE) { /* Matches ? on stack? */ - cerror(global, ERROR_MISPLACED, opname[(unsigned)opp->op]); + fpp_cerror(global, ERROR_MISPLACED, opname[(unsigned)opp->op]); *eval=1; return(FPP_OK); } @@ -364,8 +364,8 @@ ReturnCode eval(struct Global *global, int *eval) */ default: /* Others: */ opp--; /* Unstack the operator */ - valp = evaleval(global, valp, op1, skip); - again=FALSE; + valp = fpp_evaleval(global, valp, op1, skip); + again=FPP_FALSE; } /* op1 switch end */ } while (!again); /* Stack unwind loop */ } @@ -373,16 +373,16 @@ ReturnCode eval(struct Global *global, int *eval) } INLINE FILE_LOCAL -ReturnCode evallex(struct Global *global, - int skip, /* TRUE if short-circuit evaluation */ +ReturnCode fpp_evallex(struct Global *global, + int skip, /* FPP_TRUE if short-circuit evaluation */ int *op) { /* - * Set *op to next eval operator or value. Called from eval(). It + * Set *op to next fpp_eval operator or value. Called from fpp_eval(). It * calls a special-purpose routines for 'char' strings and * numeric values: - * evalchar called to evaluate 'x' - * evalnum called to evaluate numbers. + * fpp_evalchar called to evaluate 'x' + * fpp_evalnum called to evaluate numbers. */ int c, c1, t; @@ -391,55 +391,55 @@ ReturnCode evallex(struct Global *global, do { /* while(loop); */ /* again: */ - loop=FALSE; + loop=FPP_FALSE; do { /* Collect the token */ - c = skipws(global); - if((ret=macroid(global, &c))) + c = fpp_skipws(global); + if((ret=fpp_macroid(global, &c))) return(ret); if (c == EOF_CHAR || c == '\n') { - unget(global); + fpp_unget(global); *op=OP_EOE; /* End of expression */ return(FPP_OK); } - } while ((t = type[c]) == LET && catenate(global, &ret) && !ret); + } while ((t = type[c]) == LET && fpp_catenate(global, 0, &ret) && !ret); if(ret) /* If the loop was broken because of a fatal error! */ return(ret); if (t == INV) { /* Total nonsense */ if (!skip) { if (isascii(c) && isprint(c)) - cerror(global, ERROR_ILLEGAL_CHARACTER, c); + fpp_cerror(global, ERROR_ILLEGAL_CHARACTER, c); else - cerror(global, ERROR_ILLEGAL_CHARACTER2, c); + fpp_cerror(global, ERROR_ILLEGAL_CHARACTER2, c); } return(FPP_ILLEGAL_CHARACTER); } else if (t == QUO) { /* ' or " */ if (c == '\'') { /* Character constant */ - global->evalue = evalchar(global, skip); /* Somewhat messy */ + global->evalue = fpp_evalchar(global, skip); /* Somewhat messy */ *op=DIG; /* Return a value */ return(FPP_OK); } - cerror(global, ERROR_STRING_IN_IF); + fpp_cerror(global, ERROR_STRING_IN_IF); return(FPP_CANT_USE_STRING_IN_IF); } else if (t == LET) { /* ID must be a macro */ if (streq(global->tokenbuf, "defined")) { /* Or defined name */ - c1 = c = skipws(global); + c1 = c = fpp_skipws(global); if (c == '(') /* Allow defined(name) */ - c = skipws(global); + c = fpp_skipws(global); if (type[c] == LET) { - global->evalue = (lookid(global, c) != NULL); + global->evalue = (fpp_lookid(global, c) != NULL); if (c1 != '(' /* Need to balance */ - || skipws(global) == ')') { /* Did we balance? */ + || fpp_skipws(global) == ')') { /* Did we balance? */ *op=DIG; return(FPP_OK); /* Parsed ok */ } } - cerror(global, ERROR_DEFINED_SYNTAX); + fpp_cerror(global, ERROR_DEFINED_SYNTAX); return(FPP_BAD_IF_DEFINED_SYNTAX); } #if OK_SIZEOF else if (streq(global->tokenbuf, "sizeof")) { /* New sizeof hackery */ - ret=dosizeof(global, op); /* Gets own routine */ + ret=fpp_dosizeof(global, op); /* Gets own routine */ return(ret); } #endif @@ -448,13 +448,13 @@ else if (streq(global->tokenbuf, "sizeof")) { /* New sizeof hackery */ return(FPP_OK); } else if (t == DIG) { /* Numbers are harder */ - global->evalue = evalnum(global, c); + global->evalue = fpp_evalnum(global, c); } else if (strchr("!=<>&|\\", c) != NULL) { /* * Process a possible multi-byte lexeme. */ - c1 = cget(global); /* Peek at next char */ + c1 = fpp_cget(global); /* Peek at next char */ switch (c) { case '!': if (c1 == '=') { @@ -465,8 +465,8 @@ else if (streq(global->tokenbuf, "sizeof")) { /* New sizeof hackery */ case '=': if (c1 != '=') { /* Can't say a=b in #if */ - unget(global); - cerror(global, ERROR_ILLEGAL_ASSIGN); + fpp_unget(global); + fpp_cerror(global, ERROR_ILLEGAL_ASSIGN); return (FPP_IF_ERROR); } *op=OP_EQ; @@ -493,14 +493,14 @@ else if (streq(global->tokenbuf, "sizeof")) { /* New sizeof hackery */ case '\\': if (c1 == '\n') { /* Multi-line if */ - loop=TRUE; + loop=FPP_TRUE; break; } - cerror(global, ERROR_ILLEGAL_BACKSLASH); + fpp_cerror(global, ERROR_ILLEGAL_BACKSLASH); return(FPP_IF_ERROR); } if(!loop) - unget(global); + fpp_unget(global); } } while(loop); *op=t; @@ -510,7 +510,7 @@ else if (streq(global->tokenbuf, "sizeof")) { /* New sizeof hackery */ #if OK_SIZEOF INLINE FILE_LOCAL -ReturnCode dosizeof(struct Global *global, int *result) +ReturnCode fpp_dosizeof(struct Global *global, int *result) { /* * Process the sizeof (basic type) operation in an #if string. @@ -525,44 +525,44 @@ ReturnCode dosizeof(struct Global *global, int *result) short typecode; ReturnCode ret; - if ((c = skipws(global)) != '(') { - unget(global); - cerror(global, ERROR_SIZEOF_SYNTAX); + if ((c = fpp_skipws(global)) != '(') { + fpp_unget(global); + fpp_cerror(global, ERROR_SIZEOF_SYNTAX); return(FPP_SIZEOF_ERROR); } /* * Scan off the tokens. */ typecode = 0; - while ((c = skipws(global))) { - if((ret=macroid(global, &c))) + while ((c = fpp_skipws(global))) { + if((ret=fpp_macroid(global, &c))) return(ret); /* (I) return on fail! */ if (c == EOF_CHAR || c == '\n') { /* End of line is a bug */ - unget(global); - cerror(global, ERROR_SIZEOF_SYNTAX); + fpp_unget(global); + fpp_cerror(global, ERROR_SIZEOF_SYNTAX); return(FPP_SIZEOF_ERROR); } else if (c == '(') { /* thing (*)() func ptr */ - if (skipws(global) == '*' - && skipws(global) == ')') { /* We found (*) */ - if (skipws(global) != '(') /* Let () be optional */ - unget(global); - else if (skipws(global) != ')') { - unget(global); - cerror(global, ERROR_SIZEOF_SYNTAX); + if (fpp_skipws(global) == '*' + && fpp_skipws(global) == ')') { /* We found (*) */ + if (fpp_skipws(global) != '(') /* Let () be optional */ + fpp_unget(global); + else if (fpp_skipws(global) != ')') { + fpp_unget(global); + fpp_cerror(global, ERROR_SIZEOF_SYNTAX); return(FPP_SIZEOF_ERROR); } typecode |= T_FPTR; /* Function pointer */ } else { /* Junk is a bug */ - unget(global); - cerror(global, ERROR_SIZEOF_SYNTAX); + fpp_unget(global); + fpp_cerror(global, ERROR_SIZEOF_SYNTAX); return(FPP_SIZEOF_ERROR); } } else if (type[c] != LET) /* Exit if not a type */ break; - else if (!catenate(global, &ret) && !ret) { /* Maybe combine tokens */ + else if (!fpp_catenate(global, 0, &ret) && !ret) { /* Maybe combine tokens */ /* * Look for this unexpandable token in basic_types. * The code accepts "int long" as well as "long int" @@ -574,7 +574,7 @@ ReturnCode dosizeof(struct Global *global, int *result) break; } if (tp->name == NULLST) { - cerror(global, ERROR_SIZEOF_UNKNOWN, global->tokenbuf); + fpp_cerror(global, ERROR_SIZEOF_UNKNOWN, global->tokenbuf); return(FPP_SIZEOF_ERROR); } typecode |= tp->type; /* Or in the type bit */ @@ -586,12 +586,12 @@ ReturnCode dosizeof(struct Global *global, int *result) */ if (c == '*') { typecode |= T_PTR; - c = skipws(global); + c = fpp_skipws(global); } if (c == ')') { /* Last syntax check */ for (testp = test_table; *testp != 0; testp++) { - if (!bittest(typecode & *testp)) { - cerror(global, ERROR_SIZEOF_ILLEGAL_TYPE); + if (!fpp_bittest(typecode & *testp)) { + fpp_cerror(global, ERROR_SIZEOF_ILLEGAL_TYPE); return(FPP_SIZEOF_ERROR); } } @@ -609,7 +609,7 @@ ReturnCode dosizeof(struct Global *global, int *result) typecode &= ~T_INT; } if ((typecode & ~T_PTR) == 0) { - cerror(global, ERROR_SIZEOF_NO_TYPE); + fpp_cerror(global, ERROR_SIZEOF_NO_TYPE); return(FPP_SIZEOF_ERROR); } /* @@ -623,19 +623,19 @@ ReturnCode dosizeof(struct Global *global, int *result) return(FPP_OK); } } /* We shouldn't fail */ - cerror(global, ERROR_SIZEOF_BUG, typecode); + fpp_cerror(global, ERROR_SIZEOF_BUG, typecode); return(FPP_SIZEOF_ERROR); } - unget(global); - cerror(global, ERROR_SIZEOF_SYNTAX); + fpp_unget(global); + fpp_cerror(global, ERROR_SIZEOF_SYNTAX); return(FPP_SIZEOF_ERROR); } INLINE FILE_LOCAL -int bittest(int value) +int fpp_bittest(int value) { /* - * TRUE if value is zero or exactly one bit is set in value. + * FPP_TRUE if value is zero or exactly one bit is set in value. */ #if (4096 & ~(-4096)) == 0 @@ -651,10 +651,10 @@ int bittest(int value) #endif /* OK_SIZEOF */ INLINE FILE_LOCAL -int evalnum(struct Global *global, int c) +int fpp_evalnum(struct Global *global, int c) { /* - * Expand number for #if lexical analysis. Note: evalnum recognizes + * Expand number for #if lexical analysis. Note: fpp_evalnum recognizes * the unsigned suffix, but only returns a signed int value. */ @@ -664,16 +664,16 @@ int evalnum(struct Global *global, int c) if (c != '0') base = 10; - else if ((c = cget(global)) == 'x' || c == 'X') { + else if ((c = fpp_cget(global)) == 'x' || c == 'X') { base = 16; - c = cget(global); + c = fpp_cget(global); } else base = 8; value = 0; for (;;) { c1 = c; if (isascii(c) && isupper(c1)) - c1 = tolower(c1); + c1 = fpp_tolower(c1); if (c1 >= 'a') c1 -= ('a' - 10); else c1 -= '0'; @@ -681,17 +681,17 @@ int evalnum(struct Global *global, int c) break; value *= base; value += c1; - c = cget(global); + c = fpp_cget(global); } if (c == 'u' || c == 'U') /* Unsigned nonsense */ - c = cget(global); - unget(global); + c = fpp_cget(global); + fpp_unget(global); return (value); } INLINE FILE_LOCAL -int evalchar(struct Global *global, - int skip) /* TRUE if short-circuit evaluation */ +int fpp_evalchar(struct Global *global, + int skip) /* FPP_TRUE if short-circuit evaluation */ /* * Get a character constant */ @@ -700,9 +700,9 @@ int evalchar(struct Global *global, int value; int count; - global->instring = TRUE; - if ((c = cget(global)) == '\\') { - switch ((c = cget(global))) { + global->instring = FPP_TRUE; + if ((c = fpp_cget(global)) == '\\') { + switch ((c = fpp_cget(global))) { case 'a': /* New in Standard */ #if ('a' == '\a' || '\a' == ALERT) value = ALERT; /* Use predefined value */ @@ -742,14 +742,14 @@ int evalchar(struct Global *global, case 'x': /* '\xFF' */ count = 3; value = 0; - while ((((c = get(global)) >= '0' && c <= '9') + while ((((c = fpp_get(global)) >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')) && (--count >= 0)) { value *= 16; value += (c <= '9') ? (c - '0') : ((c & 0xF) + 9); } - unget(global); + fpp_unget(global); break; default: @@ -759,9 +759,9 @@ int evalchar(struct Global *global, while (c >= '0' && c <= '7' && --count >= 0) { value *= 8; value += (c - '0'); - c = get(global); + c = fpp_get(global); } - unget(global); + fpp_unget(global); } else value = c; break; @@ -776,9 +776,9 @@ int evalchar(struct Global *global, #if BIG_ENDIAN count = 0; #endif - while ((c = get(global)) != '\'' && c != EOF_CHAR && c != '\n') { + while ((c = fpp_get(global)) != '\'' && c != EOF_CHAR && c != '\n') { if (!skip) - cwarn(global, WARN_MULTIBYTE_NOT_PORTABLE, c); + fpp_cwarn(global, WARN_MULTIBYTE_NOT_PORTABLE, c); #if BIG_ENDIAN count += BITS_CHAR; value += (c << count); @@ -787,15 +787,15 @@ int evalchar(struct Global *global, value += c; #endif } - global->instring = FALSE; + global->instring = FPP_FALSE; return (value); } INLINE FILE_LOCAL -int *evaleval(struct Global *global, +int *fpp_evaleval(struct Global *global, int *valp, int op, - int skip) /* TRUE if short-circuit evaluation */ + int skip) /* FPP_TRUE if short-circuit evaluation */ { /* * Apply the argument operator to the data on the value stack. @@ -804,7 +804,7 @@ int *evaleval(struct Global *global, * * OP_COL is a special case. * - * evaleval() returns the new pointer to the top of the value stack. + * fpp_evaleval() returns the new pointer to the top of the value stack. */ int v1, v2 = 0; @@ -827,7 +827,7 @@ int *evaleval(struct Global *global, case OP_MOD: if (v2 == 0) { if (!skip) { - cwarn(global, WARN_DIVISION_BY_ZERO, + fpp_cwarn(global, WARN_DIVISION_BY_ZERO, (op == OP_DIV) ? "divide" : "mod"); } v1 = 0; @@ -895,7 +895,7 @@ int *evaleval(struct Global *global, v1 = !v1; break; default: - cerror(global, ERROR_IF_OPERAND, op); + fpp_cerror(global, ERROR_IF_OPERAND, op); v1 = 0; } *valp++ = v1; diff --git a/3rdparty/bgfx/3rdparty/fcpp/cpp6.c b/3rdparty/bgfx/3rdparty/fcpp/cpp6.c index 30d22697cf5..bb1de15b8d2 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cpp6.c +++ b/3rdparty/bgfx/3rdparty/fcpp/cpp6.c @@ -24,52 +24,52 @@ SOFTWARE. #include "cppdef.h" #include "cpp.h" -INLINE FILE_LOCAL void outadefine(struct Global *, DEFBUF *); -INLINE FILE_LOCAL void domsg(struct Global *, ErrorCode, va_list); +INLINE FILE_LOCAL void fpp_outadefine(struct Global *, DEFBUF *); +INLINE FILE_LOCAL void fpp_domsg(struct Global *, ErrorCode, va_list); /* - * skipnl() skips over input text to the end of the line. - * skipws() skips over "whitespace" (spaces or tabs), but + * fpp_skipnl() skips over input text to the end of the line. + * fpp_skipws() skips over "whitespace" (spaces or tabs), but * not skip over the end of the line. It skips over * TOK_SEP, however (though that shouldn't happen). - * scanid() reads the next token (C identifier) into tokenbuf. + * fpp_scanid() reads the next token (C identifier) into tokenbuf. * The caller has already read the first character of - * the identifier. Unlike macroid(), the token is + * the identifier. Unlike fpp_macroid(), the token is * never expanded. - * macroid() reads the next token (C identifier) into tokenbuf. + * fpp_macroid() reads the next token (C identifier) into tokenbuf. * If it is a #defined macro, it is expanded, and - * macroid() returns TRUE, otherwise, FALSE. - * catenate() Does the dirty work of token concatenation, TRUE if it did. - * scanstring() Reads a string from the input stream, calling + * fpp_macroid() returns FPP_TRUE, otherwise, FPP_FALSE. + * fpp_catenate() Does the dirty work of token concatenation, FPP_TRUE if it did. + * fpp_scanstring() Reads a string from the input stream, calling * a user-supplied function for each character. - * This function may be output() to write the - * string to the output file, or save() to save + * This function may be fpp_output() to write the + * string to the output file, or fpp_save() to fpp_save * the string in the work buffer. - * scannumber() Reads a C numeric constant from the input stream, + * fpp_scannumber() Reads a C numeric constant from the input stream, * calling the user-supplied function for each - * character. (output() or save() as noted above.) - * save() Save one character in the work[] buffer. - * savestring() Saves a string in malloc() memory. - * getfile() Initialize a new FILEINFO structure, called when + * character. (fpp_output() or fpp_save() as noted above.) + * fpp_save() Save one character in the work[] buffer. + * fpp_savestring() Saves a string in malloc() memory. + * fpp_getfile() Initialize a new FILEINFO structure, called when * #include opens a new file, or a macro is to be * expanded. - * Getmem() Get a specified number of bytes from malloc memory. - * output() Write one character to stdout (calling Putchar) -- + * fpp_Getmem() Get a specified number of bytes from malloc memory. + * fpp_output() Write one character to stdout (calling fpp_Putchar) -- * implemented as a function so its address may be - * passed to scanstring() and scannumber(). - * lookid() Scans the next token (identifier) from the input + * passed to fpp_scanstring() and fpp_scannumber(). + * fpp_lookid() Scans the next token (identifier) from the input * stream. Looks for it in the #defined symbol table. * Returns a pointer to the definition, if found, or NULL * if not present. The identifier is stored in tokenbuf. - * defnedel() Define enter/delete subroutine. Updates the + * fpp_defendel() Define enter/delete subroutine. Updates the * symbol table. - * get() Read the next byte from the current input stream, + * fpp_get() Read the next byte from the current input stream, * handling end of (macro/file) input and embedded * comments appropriately. Note that the global - * instring is -- essentially -- a parameter to get(). - * cget() Like get(), but skip over TOK_SEP. - * unget() Push last gotten character back on the input stream. - * cerror() This routine format an print messages to the user. + * instring is -- essentially -- a parameter to fpp_get(). + * fpp_cget() Like fpp_get(), but skip over TOK_SEP. + * fpp_unget() Push last gotten character back on the input stream. + * fpp_cerror() This routine format an print messages to the user. */ /* @@ -121,7 +121,7 @@ char type[256] = { /* Character type codes Hex */ 000, 000, 000, 000, 000, 000, 000, 000, /* 80 .. FF */ }; -void skipnl(struct Global *global) +void fpp_skipnl(struct Global *global) { /* * Skip to the end of the current input line. @@ -129,12 +129,12 @@ void skipnl(struct Global *global) int c; do { /* Skip to newline */ - c = get(global); + c = fpp_get(global); } while (c != '\n' && c != EOF_CHAR); return; } -int skipws(struct Global *global) +int fpp_skipws(struct Global *global) { /* * Skip over whitespace @@ -142,7 +142,7 @@ int skipws(struct Global *global) int c; do { /* Skip whitespace */ - c = get(global); + c = fpp_get(global); #if COMMENT_INVISIBLE } while (type[c] == SPA || c == COM_SEP); #else @@ -151,19 +151,19 @@ int skipws(struct Global *global) return(c); } -void scanid(struct Global *global, +void fpp_scanid(struct Global *global, int c) /* First char of id */ { /* * Get the next token (an id) into the token buffer. - * Note: this code is duplicated in lookid(). + * Note: this code is duplicated in fpp_lookid(). * Change one, change both. */ int ct; if (c == DEF_MAGIC) /* Eat the magic token */ - c = get(global); /* undefiner. */ + c = fpp_get(global); /* undefiner. */ ct = 0; do { @@ -171,14 +171,14 @@ void scanid(struct Global *global, global->tokenbuf = realloc(global->tokenbuf, 1 + (global->tokenbsize *= 2)); global->tokenbuf[ct++] = c; - c = get(global); + c = fpp_get(global); } while (type[c] == LET || type[c] == DIG); - unget(global); + fpp_unget(global); global->tokenbuf[ct] = EOS; } -ReturnCode macroid(struct Global *global, int *c) +ReturnCode fpp_macroid(struct Global *global, int *c) { /* * If c is a letter, scan the id. if it's #defined, expand it and scan @@ -191,51 +191,53 @@ ReturnCode macroid(struct Global *global, int *c) if (global->infile != NULL && global->infile->fp != NULL) global->recursion = 0; - while (type[*c] == LET && (dp = lookid(global, *c)) != NULL) { - if((ret=expand(global, dp))) + while (type[*c] == LET && (dp = fpp_lookid(global, *c)) != NULL) { + if((ret=fpp_expand(global, dp))) return(ret); - *c = get(global); + *c = fpp_get(global); } return(FPP_OK); } -int catenate(struct Global *global, ReturnCode *ret) +int fpp_catenate(struct Global *global, int lhs_number, ReturnCode *ret) { /* - * A token was just read (via macroid). + * A token was just read (via fpp_macroid). * If the next character is TOK_SEP, concatenate the next token - * return TRUE -- which should recall macroid after refreshing - * macroid's argument. If it is not TOK_SEP, unget() the character - * and return FALSE. + * return FPP_TRUE -- which should recall fpp_macroid after refreshing + * fpp_macroid's argument. If it is not TOK_SEP, fpp_unget() the character + * and return FPP_FALSE. */ #if OK_CONCAT int c; - char *token1; + char *token1 = ""; #endif #if OK_CONCAT - if (get(global) != TOK_SEP) { /* Token concatenation */ - unget(global); - return (FALSE); + if (fpp_get(global) != TOK_SEP) { /* Token concatenation */ + fpp_unget(global); + return (FPP_FALSE); } else { - token1 = savestring(global, global->tokenbuf); /* Save first token */ - c=get(global); + if (lhs_number == 0) { /* The lhs number has already been emit */ + token1 = fpp_savestring(global, global->tokenbuf); /* Save first token */ + } + c= fpp_get(global); if(global->rightconcat) { - *ret=macroid(global, &c); /* Scan next token */ + *ret=fpp_macroid(global, &c); /* Scan next token */ if(*ret) - return(FALSE); + return(FPP_FALSE); } /* BK - BUG? Parses token into global->tokenbuf but never uses it. else - lookid(global, c); + fpp_lookid(global, c); */ switch(type[c]) { /* What was it? */ case LET: /* An identifier, ... */ if ((int)strlen(token1) + (int)strlen(global->tokenbuf) >= NWORK) { - cfatal(global, FATAL_WORK_AREA_OVERFLOW, token1); + fpp_cfatal(global, FATAL_WORK_AREA_OVERFLOW, token1); *ret=FPP_WORK_AREA_OVERFLOW; - return(FALSE); + return(FPP_FALSE); } sprintf(global->work, "%s%s", token1, global->tokenbuf); break; @@ -243,20 +245,20 @@ int catenate(struct Global *global, ReturnCode *ret) case DOT: /* Or maybe a float */ strcpy(global->work, token1); global->workp = global->work + strlen(global->work); - *ret=scannumber(global, c, save); + *ret=fpp_scannumber(global, c, fpp_save); if(*ret) - return(FALSE); - *ret=save(global, EOS); + return(FPP_FALSE); + *ret=fpp_save(global, EOS); if(*ret) - return(FALSE); + return(FPP_FALSE); break; default: /* An error, ... */ if (isprint(c)) - cerror(global, ERROR_STRANG_CHARACTER, c); + fpp_cerror(global, ERROR_STRANG_CHARACTER, c); else - cerror(global, ERROR_STRANG_CHARACTER2, c); + fpp_cerror(global, ERROR_STRANG_CHARACTER2, c); strcpy(global->work, token1); - unget(global); + fpp_unget(global); break; } /* @@ -265,18 +267,20 @@ int catenate(struct Global *global, ReturnCode *ret) * new (concatenated) token after freeing token1. * Finally, setup to read the new token. */ - free(token1); /* Free up memory */ - *ret=ungetstring(global, global->work); /* Unget the new thing, */ + if (lhs_number == 0) { + free(token1); /* Free up memory */ + } + *ret=fpp_ungetstring(global, global->work); /* Unget the new thing, */ if(*ret) - return(FALSE); - return(TRUE); + return(FPP_FALSE); + return(FPP_TRUE); } #else - return(FALSE); /* Not supported */ + return(FPP_FALSE); /* Not supported */ #endif } -ReturnCode scanstring(struct Global *global, +ReturnCode fpp_scanstring(struct Global *global, int delim, /* ' or " */ /* Output function: */ ReturnCode (*outfun)(struct Global *, int)) @@ -284,40 +288,40 @@ ReturnCode scanstring(struct Global *global, /* * Scan off a string. Warning if terminated by newline or EOF. * outfun() outputs the character -- to a buffer if in a macro. - * TRUE if ok, FALSE if error. + * FPP_TRUE if ok, FPP_FALSE if error. */ int c; ReturnCode ret; - global->instring = TRUE; /* Don't strip comments */ + global->instring = FPP_TRUE; /* Don't strip comments */ ret=(*outfun)(global, delim); if(ret) return(ret); - while ((c = get(global)) != delim + while ((c = fpp_get(global)) != delim && c != '\n' && c != EOF_CHAR) { ret=(*outfun)(global, c); if(ret) return(ret); if (c == '\\') { - ret=(*outfun)(global, get(global)); + ret=(*outfun)(global, fpp_get(global)); if(ret) return(ret); } } - global->instring = FALSE; + global->instring = FPP_FALSE; if (c == delim) { ret=(*outfun)(global, c); return(ret); } else { - cerror(global, ERROR_UNTERMINATED_STRING); - unget(global); + fpp_cerror(global, ERROR_UNTERMINATED_STRING); + fpp_unget(global); return(FPP_UNTERMINATED_STRING); } } -ReturnCode scannumber(struct Global *global, +ReturnCode fpp_scannumber(struct Global *global, int c, /* First char of number */ /* Output/store func: */ ReturnCode (*outfun)(struct Global *, int)) @@ -331,20 +335,20 @@ ReturnCode scannumber(struct Global *global, int expseen; /* 'e' seen in floater */ int signseen; /* '+' or '-' seen */ int octal89; /* For bad octal test */ - int dotflag; /* TRUE if '.' was seen */ + int dotflag; /* FPP_TRUE if '.' was seen */ ReturnCode ret; - char done=FALSE; + char done=FPP_FALSE; - expseen = FALSE; /* No exponent seen yet */ - signseen = TRUE; /* No +/- allowed yet */ - octal89 = FALSE; /* No bad octal yet */ + expseen = FPP_FALSE; /* No exponent seen yet */ + signseen = FPP_TRUE; /* No +/- allowed yet */ + octal89 = FPP_FALSE; /* No bad octal yet */ radix = 10; /* Assume decimal */ - if ((dotflag = (c == '.')) != FALSE) {/* . something? */ + if ((dotflag = (c == '.')) != FPP_FALSE) {/* . something? */ ret=(*outfun)(global, '.'); /* Always out the dot */ if(ret) return(ret); - if (type[(c = get(global))] != DIG) { /* If not a float numb, */ - unget(global); /* Rescan strange char */ + if (type[(c = fpp_get(global))] != DIG) { /* If not a float numb, */ + fpp_unget(global); /* Rescan strange char */ return(FPP_OK); /* All done for now */ } } /* End of float test */ @@ -353,13 +357,13 @@ ReturnCode scannumber(struct Global *global, if(ret) return(ret); radix = 8; /* Assume it's octal */ - c = get(global); /* Look for an 'x' */ - if (c == 'x' || c == 'X') { /* Did we get one? */ + c = fpp_get(global); /* Look for an 'x' */ + if (c == 'x' || c == 'X') { /* Did we fpp_get one? */ radix = 16; /* Remember new radix */ ret=(*outfun)(global, c); /* Stuff the 'x' */ if(ret) return(ret); - c = get(global); /* Get next character */ + c = fpp_get(global); /* Get next character */ } } while (!done) { /* Process curr. char. */ @@ -370,24 +374,24 @@ ReturnCode scannumber(struct Global *global, if (radix != 16 && (c == 'e' || c == 'E')) { if (expseen) /* Already saw 'E'? */ break; /* Exit loop, bad nbr. */ - expseen = TRUE; /* Set exponent seen */ - signseen = FALSE; /* We can read '+' now */ + expseen = FPP_TRUE; /* Set exponent seen */ + signseen = FPP_FALSE; /* We can read '+' now */ radix = 10; /* Decimal exponent */ } else if (radix != 16 && c == '.') { if (dotflag) /* Saw dot already? */ break; /* Exit loop, two dots */ - dotflag = TRUE; /* Remember the dot */ + dotflag = FPP_TRUE; /* Remember the dot */ radix = 10; /* Decimal fraction */ } else if (c == '+' || c == '-') { /* 1.0e+10 */ if (signseen) /* Sign in wrong place? */ break; /* Exit loop, not nbr. */ - /* signseen = TRUE; */ /* Remember we saw it */ + /* signseen = FPP_TRUE; */ /* Remember we saw it */ } else { /* Check the digit */ switch (c) { case '8': case '9': /* Sometimes wrong */ - octal89 = TRUE; /* Do check later */ + octal89 = FPP_TRUE; /* Do check later */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': break; /* Always ok */ @@ -397,15 +401,15 @@ ReturnCode scannumber(struct Global *global, if (radix == 16) /* Alpha's are ok only */ break; /* if reading hex. */ default: /* At number end */ - done=TRUE; /* Break from for loop */ + done=FPP_TRUE; /* Break from for loop */ continue; } /* End of switch */ } /* End general case */ ret=(*outfun)(global, c); /* Accept the character */ if(ret) return(ret); - signseen = TRUE; /* Don't read sign now */ - c = get(global); /* Read another char */ + signseen = FPP_TRUE; /* Don't read sign now */ + c = fpp_get(global); /* Read another char */ } /* End of scan loop */ /* * When we break out of the scan loop, c contains the first @@ -421,7 +425,7 @@ ReturnCode scannumber(struct Global *global, ret=(*outfun)(global, c); if(ret) return(ret); - c = get(global); /* Ungotten later */ + c = fpp_get(global); /* Ungotten later */ } } else { /* Else it's an integer */ /* @@ -429,54 +433,54 @@ ReturnCode scannumber(struct Global *global, * dotflag signals "saw 'L'", and * expseen signals "saw 'U'". */ - done=TRUE; + done=FPP_TRUE; while(done) { switch (c) { case 'l': case 'L': if (dotflag) { - done=FALSE; + done=FPP_FALSE; continue; } - dotflag = TRUE; + dotflag = FPP_TRUE; break; case 'u': case 'U': if (expseen) { - done=FALSE; + done=FPP_FALSE; continue; } - expseen = TRUE; + expseen = FPP_TRUE; break; default: - done=FALSE; + done=FPP_FALSE; continue; } ret=(*outfun)(global, c); /* Got 'L' or 'U'. */ if(ret) return(ret); - c = get(global); /* Look at next, too. */ + c = fpp_get(global); /* Look at next, too. */ } } - unget(global); /* Not part of a number */ + fpp_unget(global); /* Not part of a number */ if(!(global->webmode)) { if (octal89 && radix == 8) - cwarn(global, WARN_ILLEGAL_OCTAL); + fpp_cwarn(global, WARN_ILLEGAL_OCTAL); } return(FPP_OK); } -ReturnCode save(struct Global *global, int c) +ReturnCode fpp_save(struct Global *global, int c) { if (global->workp >= &global->work[NWORK]) { - cfatal(global, FATAL_WORK_BUFFER_OVERFLOW); + fpp_cfatal(global, FATAL_WORK_BUFFER_OVERFLOW); return(FPP_WORK_AREA_OVERFLOW); } else *global->workp++ = c; return(FPP_OK); } -char *savestring(struct Global *global, char *text) +char *fpp_savestring(struct Global *global, char *text) { /* * Store a string into free memory. @@ -488,7 +492,7 @@ char *savestring(struct Global *global, char *text) return (result); } -ReturnCode getfile(struct Global *global, +ReturnCode fpp_getfile(struct Global *global, size_t bufsize, /* Line or define buffer size */ char *name, FILEINFO **file) /* File or macro name string */ @@ -511,7 +515,7 @@ ReturnCode getfile(struct Global *global, return(FPP_OUT_OF_MEMORY); (*file)->parent = global->infile; /* Chain files together */ (*file)->fp = NULL; /* No file yet */ - (*file)->filename = savestring(global, name); /* Save file/macro name */ + (*file)->filename = fpp_savestring(global, name); /* Save file/macro name */ (*file)->progname = NULL; /* No #line seen yet */ (*file)->unrecur = 0; /* No macro fixup */ (*file)->bptr = (*file)->buffer; /* Initialize line ptr */ @@ -528,7 +532,7 @@ ReturnCode getfile(struct Global *global, * C P P S y m b o l T a b l e s */ -DEFBUF *lookid(struct Global *global, +DEFBUF *fpp_lookid(struct Global *global, int c) /* First character of token */ { /* @@ -544,16 +548,16 @@ DEFBUF *lookid(struct Global *global, nhash = 0; if ((isrecurse = (c == DEF_MAGIC))) /* If recursive macro */ - c = get(global); /* hack, skip DEF_MAGIC */ + c = fpp_get(global); /* hack, skip DEF_MAGIC */ ct = 0; do { if (ct == global->tokenbsize) global->tokenbuf = realloc(global->tokenbuf, 1 + (global->tokenbsize *= 2)); global->tokenbuf[ct++] = c; /* Store token byte */ nhash += c; /* Update hash value */ - c = get(global); + c = fpp_get(global); } while (type[c] == LET || type[c] == DIG); - unget(global); /* Rescan terminator */ + fpp_unget(global); /* Rescan terminator */ global->tokenbuf[ct] = EOS; /* Terminate token */ if (isrecurse) /* Recursive definition */ return(NULL); /* undefined just now */ @@ -568,15 +572,15 @@ DEFBUF *lookid(struct Global *global, return((temp == 0) ? dp : NULL); } -DEFBUF *defendel(struct Global *global, +DEFBUF *fpp_defendel(struct Global *global, char *name, - int delete) /* TRUE to delete a symbol */ + int delete) /* FPP_TRUE to delete a symbol */ { /* - * Enter this name in the lookup table (delete = FALSE) - * or delete this name (delete = TRUE). - * Returns a pointer to the define block (delete = FALSE) - * Returns NULL if the symbol wasn't defined (delete = TRUE). + * Enter this name in the lookup table (delete = FPP_FALSE) + * or delete this name (delete = FPP_TRUE). + * Returns a pointer to the define block (delete = FPP_FALSE) + * Returns NULL if the symbol wasn't defined (delete = FPP_TRUE). */ DEFBUF *dp; @@ -618,93 +622,115 @@ DEFBUF *defendel(struct Global *global, return(dp); } +void fpp_delalldefines(struct Global *global) +{ + /* + * Delete all the defines in the tables and free memory + */ -void outdefines(struct Global *global) + DEFBUF *dp; + DEFBUF *prevp; + int i; + + for (i = 0; i < SBSIZE; ++i) + { + prevp = global->symtab[i]; + while ((dp = prevp) != (DEFBUF *)NULL) { + prevp = dp->link; + free(dp->repl); /* Free the replacement */ + free((char *)dp); /* Free the symbol */ + } + global->symtab[i] = NULL; + } +} + + +void fpp_outdefines(struct Global *global) { DEFBUF *dp; DEFBUF **syp; - deldefines(global); /* Delete built-in #defines */ + fpp_delbuiltindefines(global); /* Delete built-in #defines */ for (syp = global->symtab; syp < &global->symtab[SBSIZE]; syp++) { if ((dp = *syp) != (DEFBUF *) NULL) { do { - outadefine(global, dp); + fpp_outadefine(global, dp); } while ((dp = dp->link) != (DEFBUF *) NULL); } } } INLINE FILE_LOCAL -void outadefine(struct Global *global, DEFBUF *dp) +void fpp_outadefine(struct Global *global, DEFBUF *dp) { char *cp; int c; /* printf("#define %s", dp->name); */ - Putstring(global, "#define "); - Putstring(global, dp->name); + fpp_Putstring(global, "#define "); + fpp_Putstring(global, dp->name); if (dp->nargs > 0) { int i; - Putchar(global, '('); + fpp_Putchar(global, '('); for (i = 1; i < dp->nargs; i++) { /* printf("__%d,", i); */ - Putstring(global, "__"); - Putint(global, i); - Putchar(global, ','); + fpp_Putstring(global, "__"); + fpp_Putint(global, i); + fpp_Putchar(global, ','); } /* printf("__%d)", i); */ - Putstring(global, "__"); - Putint(global, i); - Putchar(global, ')'); + fpp_Putstring(global, "__"); + fpp_Putint(global, i); + fpp_Putchar(global, ')'); } else if (dp->nargs == 0) { - Putstring(global, "()"); + fpp_Putstring(global, "()"); } if (dp->repl != NULL) { - Putchar(global, '\t'); + fpp_Putchar(global, '\t'); for (cp = dp->repl; (c = *cp++ & 0xFF) != EOS;) { if (c >= MAC_PARM && c < (MAC_PARM + PAR_MAC)) { /* printf("__%d", c - MAC_PARM + 1); */ - Putstring(global, "__"); - Putint(global, c - MAC_PARM + 1); + fpp_Putstring(global, "__"); + fpp_Putint(global, c - MAC_PARM + 1); } else if (isprint(c) || c == '\t' || c == '\n') - Putchar(global, c); + fpp_Putchar(global, c); else switch (c) { case QUOTE_PARM: - Putchar(global, '#'); + fpp_Putchar(global, '#'); break; case DEF_MAGIC: /* Special anti-recursion */ case MAC_PARM + PAR_MAC: /* Special "arg" marker */ break; case COM_SEP: #if COMMENT_INVISIBLE - Putstring(global, "/**/"); + fpp_Putstring(global, "/**/"); #else - Putchar(global, ' '); + fpp_Putchar(global, ' '); #endif break; case TOK_SEP: - Putstring(global, "##"); + fpp_Putstring(global, "##"); break; default: { /* Octal output! */ char buffer[32]; sprintf(buffer, "\\0%o", c); - Putstring(global, buffer); + fpp_Putstring(global, buffer); } } } } - Putchar(global, '\n'); + fpp_Putchar(global, '\n'); } /* * G E T */ -int get(struct Global *global) +int fpp_get(struct Global *global) { /* * Return the next character from a macro or the current file. @@ -760,12 +786,12 @@ int get(struct Global *global) if ((global->infile = file->parent) != NULL) { /* * There is an "ungotten" newline in the current - * infile buffer (set there by doinclude() in + * infile buffer (set there by fpp_doinclude() in * cpp1.c). Thus, we know that the mainline code * is skipping over blank lines and will do a * #line at its convenience. */ - global->wrongline = TRUE; /* Need a #line now */ + global->wrongline = FPP_TRUE; /* Need a #line now */ } } } @@ -802,13 +828,13 @@ int get(struct Global *global) if (global->instring) /* Strings just return */ return (c); /* the character. */ else if (c == '/') { /* Comment? */ - global->instring = TRUE; /* So get() won't loop */ + global->instring = FPP_TRUE; /* So fpp_get() won't loop */ /* Check next byte for '*' and if(cplusplus) also '/' */ - if ( (c = get(global)) != '*' ) + if ( (c = fpp_get(global)) != '*' ) if(!global->cplusplus || (global->cplusplus && c!='/')) { - global->instring = FALSE; /* Nope, no comment */ - unget(global); /* Push the char. back */ + global->instring = FPP_FALSE; /* Nope, no comment */ + fpp_unget(global); /* Push the char. back */ return ('/'); /* Return the slash */ } @@ -816,49 +842,49 @@ int get(struct Global *global) if (global->keepcomments) { /* If writing comments */ - global->comment = TRUE; /* information that a comment has been output */ + global->comment = FPP_TRUE; /* information that a comment has been output */ if(global->showspace) { /* Show all whitespaces! */ global->spacebuf[global->chpos] = '\0'; - Putstring(global, global->spacebuf); + fpp_Putstring(global, global->spacebuf); } if(c=='*') { - Putchar(global, '/'); /* Write out the */ - Putchar(global, '*'); /* initializer */ + fpp_Putchar(global, '/'); /* Write out the */ + fpp_Putchar(global, '*'); /* initializer */ } else { /* C++ style comment */ - Putchar(global, '/'); /* Write out the */ - Putchar(global, '/'); /* initializer */ + fpp_Putchar(global, '/'); /* Write out the */ + fpp_Putchar(global, '/'); /* initializer */ } } if(global->cplusplus && c=='/') { /* Eat C++ comment! */ do { - c=get(global); + c=fpp_get(global); if(global->keepcomments) - Putchar(global, c); + fpp_Putchar(global, c); } while(c!='\n' && c!=EOF_CHAR); /* eat all to EOL or EOF */ - global->instring = FALSE; /* End of comment */ + global->instring = FPP_FALSE; /* End of comment */ return(c); /* Return the end char */ } for (;;) { /* Eat a comment */ - c = get(global); + c = fpp_get(global); test: if (global->keepcomments && c != EOF_CHAR) - Putchar(global, c); + fpp_Putchar(global, c); switch (c) { case EOF_CHAR: - cerror(global, ERROR_EOF_IN_COMMENT); + fpp_cerror(global, ERROR_EOF_IN_COMMENT); return (EOF_CHAR); case '/': if(global->nestcomments || global->warnnestcomments) { - if((c = get(global)) != '*') + if((c = fpp_get(global)) != '*') goto test; if(global->warnnestcomments) { - cwarn(global, WARN_NESTED_COMMENT); + fpp_cwarn(global, WARN_NESTED_COMMENT); } if(global->nestcomments) comments++; @@ -866,16 +892,16 @@ int get(struct Global *global) break; case '*': - if ((c = get(global)) != '/') /* If comment doesn't */ + if ((c = fpp_get(global)) != '/') /* If comment doesn't */ goto test; /* end, look at next */ if (global->keepcomments) { /* Put out the comment */ - Putchar(global, c); /* terminator, too */ + fpp_Putchar(global, c); /* terminator, too */ } if(--comments) /* nested comment, continue! */ break; - global->instring = FALSE; /* End of comment, */ + global->instring = FPP_FALSE; /* End of comment, */ /* * A comment is syntactically "whitespace" -- * however, there are certain strange sequences @@ -905,18 +931,18 @@ int get(struct Global *global) case '\n': /* we'll need a #line */ if (!global->keepcomments) - global->wrongline = TRUE; /* later... */ + global->wrongline = FPP_TRUE; /* later... */ default: /* Anything else is */ break; /* Just a character */ } /* End switch */ } /* End comment loop */ } /* End if in comment */ else if (!global->inmacro && c == '\\') { /* If backslash, peek */ - if ((c = get(global)) == '\n') { /* for a . If so, */ - global->wrongline = TRUE; + if ((c = fpp_get(global)) == '\n') { /* for a . If so, */ + global->wrongline = FPP_TRUE; goto newline; } else { /* Backslash anything */ - unget(global); /* Get it later */ + fpp_unget(global); /* Get it later */ return ('\\'); /* Return the backslash */ } } else if (c == '\f' || c == VT) /* Form Feed, Vertical */ @@ -924,20 +950,20 @@ int get(struct Global *global) return (c); /* Just return the char */ } -void unget(struct Global *global) +void fpp_unget(struct Global *global) { /* * Backup the pointer to reread the last character. Fatal error - * (code bug) if we backup too far. unget() may be called, + * (code bug) if we backup too far. fpp_unget() may be called, * without problems, at end of file. Only one character may - * be ungotten. If you need to unget more, call ungetstring(). + * be ungotten. If you need to unget more, call fpp_ungetstring(). */ FILEINFO *file; if ((file = global->infile) == NULL) return; /* Unget after EOF */ if (--file->bptr < file->buffer) { - cfatal(global, FATAL_TOO_MUCH_PUSHBACK); + fpp_cfatal(global, FATAL_TOO_MUCH_PUSHBACK); /* This happens only if used the wrong way! */ return; } @@ -945,7 +971,7 @@ void unget(struct Global *global) --global->line; /* Unget the line number, too */ } -ReturnCode ungetstring(struct Global *global, char *text) +ReturnCode fpp_ungetstring(struct Global *global, char *text) { /* * Push a string back on the input stream. This is done by treating @@ -955,13 +981,13 @@ ReturnCode ungetstring(struct Global *global, char *text) FILEINFO *file; ReturnCode ret; - ret = getfile(global, strlen(text) + 1, "", &file); + ret = fpp_getfile(global, strlen(text) + 1, "", &file); if(!ret) strcpy(file->buffer, text); return(ret); } -int cget(struct Global *global) +int fpp_cget(struct Global *global) { /* * Get one character, absorb "funny space" after comments or @@ -970,7 +996,7 @@ int cget(struct Global *global) int c; do { - c = get(global); + c = fpp_get(global); #if COMMENT_INVISIBLE } while (c == TOK_SEP || c == COM_SEP); #else @@ -984,7 +1010,7 @@ int cget(struct Global *global) */ INLINE FILE_LOCAL -void domsg(struct Global *global, +void fpp_domsg(struct Global *global, ErrorCode error, /* error message number */ va_list arg) /* Something for the message */ { @@ -1083,8 +1109,8 @@ void domsg(struct Global *global, for (file = global->infile; file && !file->fp; file = file->parent) ; tp = file ? file->filename : 0; - Error(global, "%s\"%s\", line %d: %s: ", - MSG_PREFIX, tp, global->infile?global->line:(file?file->line:0), severity); + fpp_Error(global, "%s\"%s\", line %d: %s: ", + MSG_PREFIX, tp, global->infile?(global->infile->fp?global->line:file->line):0, severity); if(global->error) global->error(global->userdata, ErrorMessage[error], arg); #if defined(UNIX) @@ -1094,15 +1120,15 @@ void domsg(struct Global *global, else return; #endif - Error(global, "\n"); + fpp_Error(global, "\n"); if (file) /*OIS*0.92*/ while ((file = file->parent) != NULL) { /* Print #includes, too */ tp = file->parent ? "," : "."; if (file->fp == NULL) - Error(global, " from macro %s%s\n", file->filename, tp); + fpp_Error(global, " from macro %s%s\n", file->filename, tp); else - Error(global, " from file %s, line %d%s\n", + fpp_Error(global, " from file %s, line %d%s\n", (file->progname != NULL) ? file->progname : file->filename, file->line, tp); } @@ -1112,7 +1138,7 @@ void domsg(struct Global *global, global->errors++; } -void cerror(struct Global *global, +void fpp_cerror(struct Global *global, ErrorCode message, ...) /* arguments */ { @@ -1121,10 +1147,10 @@ void cerror(struct Global *global, */ va_list arg; va_start(arg, message); - domsg(global, message, arg); + fpp_domsg(global, message, arg); } -void Error(struct Global *global, char *format, ...) +void fpp_Error(struct Global *global, char *format, ...) { /* * Just get the arguments and send a decent string to the user error diff --git a/3rdparty/bgfx/3rdparty/fcpp/cppadd.h b/3rdparty/bgfx/3rdparty/fcpp/cppadd.h index 8494ac646af..a7ed2004515 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cppadd.h +++ b/3rdparty/bgfx/3rdparty/fcpp/cppadd.h @@ -67,7 +67,7 @@ struct Global { int errors; /* cpp error counter */ FILEINFO *infile; /* Current input file */ #if DEBUG - int debug; /* TRUE if debugging now */ + int debug; /* FPP_TRUE if debugging now */ #endif /* * This counter is incremented when a macro expansion is initiated. @@ -83,7 +83,7 @@ struct Global { int rec_recover; /* Unwind recursive macros */ /* - * instring is set TRUE when a string is scanned. It modifies the + * instring is set FPP_TRUE when a string is scanned. It modifies the * behavior of the "get next character" routine, causing all characters * to be passed to the caller (except ). Note especially that * comments and \ are not removed from the source. (This @@ -95,17 +95,17 @@ struct Global { * shouldn't delimit tokens, but we'll worry about that some other * time -- it is more important to prevent infinitly long output lines. * - * instring and inmarcor are parameters to the get() routine which + * instring and inmarcor are parameters to the fpp_get() routine which * were made global for speed. */ - int instring; /* TRUE if scanning string */ - int inmacro; /* TRUE if #defining a macro */ + int instring; /* FPP_TRUE if scanning string */ + int inmacro; /* FPP_TRUE if #defining a macro */ /* * work[] and workp are used to store one piece of text in a temporay * buffer. To initialize storage, set workp = work. To store one - * character, call save(c); (This will fatally exit if there isn't - * room.) To terminate the string, call save(EOS). Note that + * character, call fpp_save(c); (This will fatally exit if there isn't + * room.) To terminate the string, call fpp_save(EOS). Note that * the work buffer is used by several subroutines -- be sure your * data won't be overwritten. The extra byte in the allocation is * needed for string formal replacement. @@ -114,7 +114,7 @@ struct Global { char *workp; /* Work buffer pointer */ /* - * keepcomments is set TRUE by the -C option. If TRUE, comments + * keepcomments is set FPP_TRUE by the -C option. If FPP_TRUE, comments * are written directly to the output stream. This is needed if * the output from cpp is to be passed to lint (which uses commands * embedded in comments). cflag contains the permanent state of the @@ -138,10 +138,10 @@ struct Global { * ifstack[] holds information about nested #if's. It is always * accessed via *ifptr. The information is as follows: * WAS_COMPILING state of compiling flag at outer level. - * ELSE_SEEN set TRUE when #else seen to prevent 2nd #else. - * TRUE_SEEN set TRUE when #if or #elif succeeds - * ifstack[0] holds the compiling flag. It is TRUE if compilation - * is currently enabled. Note that this must be initialized TRUE. + * ELSE_SEEN set FPP_TRUE when #else seen to prevent 2nd #else. + * FPP_TRUE_SEEN set FPP_TRUE when #if or #elif succeeds + * ifstack[0] holds the compiling flag. It is FPP_TRUE if compilation + * is currently enabled. Note that this must be initialized FPP_TRUE. */ char ifstack[BLK_NEST]; /* #if information */ char *ifptr; /* -> current ifstack[] */ @@ -158,7 +158,7 @@ struct Global { */ char *include[NINCLUDE]; char includeshow[NINCLUDE]; /* show it or not! */ - char included; + unsigned included; /* * This is the table used to predefine target machine and operating @@ -176,7 +176,7 @@ struct Global { /* * This is the variable saying if Cpp should remove C++ style comments from - * the output. Default is... TRUE, yes, pronto, do it!!! + * the output. Default is... FPP_TRUE, yes, pronto, do it!!! */ char cplusplus; @@ -197,7 +197,7 @@ struct Global { DEFBUF *symtab[SBSIZE]; /* Symbol table queue headers */ - int evalue; /* Current value from evallex() */ + int evalue; /* Current value from fpp_evallex() */ void (*depends)(char *filename, void *); /* depends function */ @@ -225,7 +225,7 @@ struct Global { char showspace; /* display all whitespaces as they are */ - char comment; /* TRUE if a comment just has been written to output */ + char comment; /* FPP_TRUE if a comment just has been written to output */ char *spacebuf; /* Buffer to store whitespaces in if -H */ @@ -242,7 +242,7 @@ struct Global { char out; /* should we output anything now? */ char rightconcat; /* should the right part of a concatenation be avaluated - before the concat (TRUE) or after (FALSE) */ + before the concat (FPP_TRUE) or after (FPP_FALSE) */ char *initialfunc; /* file to include first in all functions */ char *excludedinit[20]; /* functions (names) excluded from the initfunc */ @@ -251,6 +251,10 @@ struct Global { char outputfunctions; /* output all discovered functions to stderr! */ char webmode; /* WWW process mode */ + + char allowincludelocal; + + FILE* (*openfile)(char *,char *, void *); }; typedef enum { @@ -359,55 +363,56 @@ typedef enum { } ReturnCode; /* Nasty defines to make them appear as three different functions! */ -#define cwarn cerror -#define cfatal cerror +#define fpp_cwarn fpp_cerror +#define fpp_cfatal fpp_cerror /********************************************************************** * PROTOTYPES: *********************************************************************/ int PREFIX fppPreProcess(REG(a0) struct fppTag *); -void Freemem(void *); -void Error(struct Global *, char *, ...); -void Putchar(struct Global *, int); -void Putstring(struct Global *, char *); -void Putint(struct Global *, int); -char *savestring(struct Global *, char *); -ReturnCode addfile(struct Global *, FILE *, char *); -int catenate(struct Global *, ReturnCode *); -void cerror(struct Global *, ErrorCode, ...); -ReturnCode control(struct Global *, int *); -ReturnCode dodefine(struct Global *); -int dooptions(struct Global *, struct fppTag *); -void doundef(struct Global *); -void dumpparm(char *); -ReturnCode expand(struct Global *, DEFBUF *); -int get(struct Global *); -ReturnCode initdefines(struct Global *); -void outdefines(struct Global *); -ReturnCode save(struct Global *, int); -void scanid(struct Global *, int); -ReturnCode scannumber(struct Global *, int, ReturnCode(*)(struct Global *, int)); -ReturnCode scanstring(struct Global *, int, ReturnCode(*)(struct Global *, int)); -void unget(struct Global *); -ReturnCode ungetstring(struct Global *, char *); -ReturnCode eval(struct Global *, int *); +void fpp_Freemem(void *); +void fpp_Error(struct Global *, char *, ...); +void fpp_Putchar(struct Global *, int); +void fpp_Putstring(struct Global *, char *); +void fpp_Putint(struct Global *, int); +char *fpp_savestring(struct Global *, char *); +ReturnCode fpp_addfile(struct Global *, FILE *, char *); +int fpp_catenate(struct Global *, int lhs_number, ReturnCode *); +void fpp_cerror(struct Global *, ErrorCode, ...); +ReturnCode fpp_control(struct Global *, int *); +ReturnCode fpp_dodefine(struct Global *); +int fpp_dooptions(struct Global *, struct fppTag *); +void fpp_doundef(struct Global *); +void fpp_dumpparm(char *); +ReturnCode fpp_expand(struct Global *, DEFBUF *); +int fpp_get(struct Global *); +ReturnCode fpp_initdefines(struct Global *); +void fpp_outdefines(struct Global *); +ReturnCode fpp_save(struct Global *, int); +void fpp_scanid(struct Global *, int); +ReturnCode fpp_scannumber(struct Global *, int, ReturnCode(*)(struct Global *, int)); +ReturnCode fpp_scanstring(struct Global *, int, ReturnCode(*)(struct Global *, int)); +void fpp_unget(struct Global *); +ReturnCode fpp_ungetstring(struct Global *, char *); +ReturnCode fpp_eval(struct Global *, int *); #ifdef DEBUG_EVAL -void dumpstack(OPTAB[NEXP], register OPTAB *, int [NEXP], register int *); +void fpp_dumpstack(OPTAB[NEXP], register OPTAB *, int [NEXP], register int *); #endif -void skipnl(struct Global *); -int skipws(struct Global *); -ReturnCode macroid(struct Global *, int *); -ReturnCode getfile(struct Global *, size_t, char *, FILEINFO **); -DEFBUF *lookid(struct Global *, int ); -DEFBUF *defendel(struct Global *, char *, int); +void fpp_skipnl(struct Global *); +int fpp_skipws(struct Global *); +ReturnCode fpp_macroid(struct Global *, int *); +ReturnCode fpp_getfile(struct Global *, size_t, char *, FILEINFO **); +DEFBUF *fpp_lookid(struct Global *, int ); +DEFBUF *fpp_defendel(struct Global *, char *, int); #if DEBUG -void dumpdef(char *); -void dumpadef(char *, register DEFBUF *); +void fpp_dumpdef(char *); +void fpp_dumpadef(char *, register DEFBUF *); #endif -ReturnCode openfile(struct Global *,char *); -int cget(struct Global *); -void deldefines(struct Global *); -char *Getmem(struct Global *, int); -ReturnCode openinclude(struct Global *, char *, int); -ReturnCode expstuff(struct Global *, char *, char *); +ReturnCode fpp_openfile(struct Global *,char *); +int fpp_cget(struct Global *); +void fpp_delbuiltindefines(struct Global *); +void fpp_delalldefines(struct Global *); +char *fpp_Getmem(struct Global *, int); +ReturnCode fpp_openinclude(struct Global *, char *, int); +ReturnCode fpp_expstuff(struct Global *, char *, char *); diff --git a/3rdparty/bgfx/3rdparty/fcpp/cppdef.h b/3rdparty/bgfx/3rdparty/fcpp/cppdef.h index c188a22409e..26ba17bfc28 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/cppdef.h +++ b/3rdparty/bgfx/3rdparty/fcpp/cppdef.h @@ -35,9 +35,9 @@ /* Convert Emacs's conventions for BIG_ENDIAN to cpp's convention. */ #ifdef BIG_ENDIAN #undef BIG_ENDIAN -#define BIG_ENDIAN TRUE +#define BIG_ENDIAN FPP_TRUE #else /* not BIG_ENDIAN */ -#define BIG_ENDIAN FALSE +#define BIG_ENDIAN FPP_FALSE #endif /* BIG_ENDIAN */ /* Emacs uses the names index and rindex and defines them as str(r)chr if nec; @@ -73,12 +73,12 @@ */ /* - * This redundant definition of TRUE and FALSE works around + * This redundant definition of FPP_TRUE and FPP_FALSE works around * a limitation of Decus C. */ -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 +#ifndef FPP_TRUE +#define FPP_TRUE 1 +#define FPP_FALSE 0 #endif /* @@ -134,27 +134,27 @@ * to be marked "static" even though they are referenced * by "extern" statements elsewhere. * - * OK_DOLLAR Should be set TRUE if $ is a valid alphabetic character + * OK_DOLLAR Should be set FPP_TRUE if $ is a valid alphabetic character * in identifiers (default), or zero if $ is invalid. - * Default is TRUE. + * Default is FPP_TRUE. * - * OK_CONCAT Should be set TRUE if # may be used to concatenate + * OK_CONCAT Should be set FPP_TRUE if # may be used to concatenate * tokens in macros (per the Ansi Draft Standard) or - * FALSE for old-style # processing (needed if cpp is + * FPP_FALSE for old-style # processing (needed if cpp is * to process assembler source code). */ -#define OK_CONCAT TRUE +#define OK_CONCAT FPP_TRUE /* - * OK_DATE Predefines the compilation date if set TRUE. + * OK_DATE Predefines the compilation date if set FPP_TRUE. * Not permitted by the Nov. 12, 1984 Draft Standard. */ -#define OK_DATE TRUE +#define OK_DATE FPP_TRUE /* * * OK_SIZEOF Permits sizeof in #if preprocessor expressions. * According to K&R V2 (page 232), this is not allowed. */ -#define OK_SIZEOF TRUE +#define OK_SIZEOF FPP_TRUE /* * S_CHAR etc. Define the sizeof the basic TARGET machine word types. * By default, sizes are set to the values for the HOST @@ -188,9 +188,9 @@ */ #if OLD_PREPROCESSOR -#define OK_DOLLAR FALSE -#define OK_CONCAT FALSE -#define COMMENT_INVISIBLE TRUE +#define OK_DOLLAR FPP_FALSE +#define OK_CONCAT FPP_FALSE +#define COMMENT_INVISIBLE FPP_TRUE #endif /* @@ -209,15 +209,15 @@ #endif /* - * BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series) + * BIG_ENDIAN is set FPP_TRUE on machines (such as the IBM 360 series) * where 'ab' stores 'a' in the high-bits and 'b' in the low-bits. - * It is set FALSE on machines (such as the PDP-11 and Vax-11) + * It is set FPP_FALSE on machines (such as the PDP-11 and Vax-11) * where 'ab' stores 'a' in the low-bits and 'b' in the high-bits. * (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested. * [I *seems* to be the other way around, according to the code /OIS] */ #ifndef BIG_ENDIAN -#define BIG_ENDIAN FALSE +#define BIG_ENDIAN FPP_FALSE #endif /* @@ -227,27 +227,27 @@ * expansions. This was removed from the Draft Ansi Standard. */ #ifndef COMMENT_INVISIBLE -#define COMMENT_INVISIBLE FALSE +#define COMMENT_INVISIBLE FPP_FALSE #endif /* * OK_DOLLAR enables use of $ as a valid "letter" in identifiers. * This is a permitted extension to the Ansi Standard and is required - * for e.g., VMS, RSX-11M, etc. It should be set FALSE if cpp is + * for e.g., VMS, RSX-11M, etc. It should be set FPP_FALSE if cpp is * used to preprocess assembler source on Unix systems. OLD_PREPROCESSOR - * sets OK_DOLLAR FALSE for that reason. + * sets OK_DOLLAR FPP_FALSE for that reason. */ #ifndef OK_DOLLAR -#define OK_DOLLAR TRUE +#define OK_DOLLAR FPP_TRUE #endif /* * OK_CONCAT enables (one possible implementation of) token concatenation. * If cpp is used to preprocess Unix assembler source, this should be - * set FALSE as the concatenation character, #, is used by the assembler. + * set FPP_FALSE as the concatenation character, #, is used by the assembler. */ #ifndef OK_CONCAT -#define OK_CONCAT TRUE +#define OK_CONCAT FPP_TRUE #endif /* @@ -256,7 +256,7 @@ * by the Draft Ansi Standard. */ #ifndef OK_DATE -#define OK_DATE TRUE +#define OK_DATE FPP_TRUE #endif /* @@ -267,7 +267,7 @@ * This option was added in the PDC process, under no. *OIS*0.92*. */ #ifndef OK_SIZEOF -#define OK_SIZEOF FALSE +#define OK_SIZEOF FPP_FALSE #endif /* @@ -275,7 +275,7 @@ */ #ifndef DEBUG -#define DEBUG FALSE +#define DEBUG FPP_FALSE #endif /* diff --git a/3rdparty/bgfx/3rdparty/fcpp/fpp.h b/3rdparty/bgfx/3rdparty/fcpp/fpp.h index fe25ac522c4..5fdcd23f6c7 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/fpp.h +++ b/3rdparty/bgfx/3rdparty/fcpp/fpp.h @@ -35,18 +35,21 @@ * */ +#ifdef __cplusplus +extern "C" { +#endif struct fppTag { int tag; void *data; }; -#ifndef TRUE -#define TRUE 1 +#ifndef FPP_TRUE +#define FPP_TRUE 1 #endif -#ifndef FALSE -#define FALSE 0 +#ifndef FPP_FALSE +#define FPP_FALSE 0 #endif #define NFLAG_BUILTIN 1 @@ -56,26 +59,26 @@ struct fppTag { #define FPPTAG_END 0 /* To make the preprocessed output keep the comments: */ -#define FPPTAG_KEEPCOMMENTS 1 /* data is TRUE or FALSE */ +#define FPPTAG_KEEPCOMMENTS 1 /* data is FPP_TRUE or FPP_FALSE */ /* To define symbols to the preprocessor: */ #define FPPTAG_DEFINE 2 /* data is the string "symbol" or "symbol=" */ /* To make the preprocessor ignore all non-fatal errors: */ -#define FPPTAG_IGNORE_NONFATAL 3 /* data is TRUE or FALSE */ +#define FPPTAG_IGNORE_NONFATAL 3 /* data is FPP_TRUE or FPP_FALSE */ /* To add an include directory to the include directory list: */ #define FPPTAG_INCLUDE_DIR 4 /* data is directory name ending with a '/' (on amiga a ':' is also valid) */ -/* To define all machine specific built-in #defines, default is TRUE: */ -#define FPPTAG_BUILTINS 5 /* data is TRUE or FALSE */ +/* To define all machine specific built-in #defines, default is FPP_TRUE: */ +#define FPPTAG_BUILTINS 5 /* data is FPP_TRUE or FPP_FALSE */ -/* To define predefines like __LINE__, __DATE__, etc. default is TRUE: */ -#define FPPTAG_PREDEFINES 6 /* data is TRUE or FALSE */ +/* To define predefines like __LINE__, __DATE__, etc. default is FPP_TRUE: */ +#define FPPTAG_PREDEFINES 6 /* data is FPP_TRUE or FPP_FALSE */ /* To make fpp leave C++ comments in the output: */ -#define FPPTAG_IGNORE_CPLUSPLUS 7 /* data is TRUE or FALSE */ +#define FPPTAG_IGNORE_CPLUSPLUS 7 /* data is FPP_TRUE or FPP_FALSE */ /* To define new sizes to #if sizeof: */ #define FPPTAG_SIZEOF_TABLE 8 /* data is sizeof table string */ @@ -84,7 +87,7 @@ struct fppTag { #define FPPTAG_UNDEFINE 9 /* data is symbol name */ /* Output all #defines: */ -#define FPPTAG_OUTPUT_DEFINES 10 /* data is TRUE or FALSE */ +#define FPPTAG_OUTPUT_DEFINES 10 /* data is FPP_TRUE or FPP_FALSE */ /* Initial input file name: */ #define FPPTAG_INPUT_NAME 11 /* data is string */ @@ -98,42 +101,42 @@ struct fppTag { /* User data, sent in the last argument to the input function: */ #define FPPTAG_USERDATA 14 /* data is user data */ -/* Whether to exclude #line instructions in the output, default is FALSE */ -#define FPPTAG_LINE 15 /* data is TRUE or FALSE */ +/* Whether to exclude #line instructions in the output, default is FPP_FALSE */ +#define FPPTAG_LINE 15 /* data is FPP_TRUE or FPP_FALSE */ /* Error function. This is called when FPP finds any warning/error/fatal: */ #define FPPTAG_ERROR 16 /* data is function pointer to a "void (*)(void *, char *, va_list)" */ /* Whether to warn for illegal cpp instructions */ -#define FPPTAG_WARNILLEGALCPP 17 /* data is boolean, default is FALSE */ +#define FPPTAG_WARNILLEGALCPP 17 /* data is boolean, default is FPP_FALSE */ /* Output the 'line' keyword on #line-lines? */ -#define FPPTAG_OUTPUTLINE 18 /* data is boolean, default is TRUE */ +#define FPPTAG_OUTPUTLINE 18 /* data is boolean, default is FPP_TRUE */ -/* Do not output the version information string */ -#define FPPTAG_IGNOREVERSION 19 /* data is boolean, default is FALSE */ +/* Output the version information string */ +#define FPPTAG_SHOWVERSION 19 /* data is boolean, default is FPP_TRUE */ /* Output all included file names to stderr */ -#define FPPTAG_OUTPUTINCLUDES 20 /* data is boolean, default is FALSE */ +#define FPPTAG_OUTPUTINCLUDES 20 /* data is boolean, default is FPP_FALSE */ /* Display warning if there is any brace, bracket or parentheses unbalance */ -#define FPPTAG_OUTPUTBALANCE 21 /* data is boolean, default is FALSE */ +#define FPPTAG_OUTPUTBALANCE 21 /* data is boolean, default is FPP_FALSE */ /* Display all whitespaces in the source */ -#define FPPTAG_OUTPUTSPACE 22 /* data is boolean, default is FALSE */ +#define FPPTAG_OUTPUTSPACE 22 /* data is boolean, default is FPP_FALSE */ /* Allow nested comments */ -#define FPPTAG_NESTED_COMMENTS 23 /* data is boolean, default is FALSE */ +#define FPPTAG_NESTED_COMMENTS 23 /* data is boolean, default is FPP_FALSE */ /* Enable warnings at nested comments */ -#define FPPTAG_WARN_NESTED_COMMENTS 24 /* data is boolean, default is FALSE */ +#define FPPTAG_WARN_NESTED_COMMENTS 24 /* data is boolean, default is FPP_FALSE */ /* Enable warnings at missing includes */ -#define FPPTAG_WARNMISSINCLUDE 25 /* data is boolean, default is TRUE */ +#define FPPTAG_WARNMISSINCLUDE 25 /* data is boolean, default is FPP_TRUE */ /* Output the main file */ -#define FPPTAG_OUTPUTMAIN 26 /* data is boolean, default is TRUE */ +#define FPPTAG_OUTPUTMAIN 26 /* data is boolean, default is FPP_TRUE */ /* Include file */ #define FPPTAG_INCLUDE_FILE 27 /* data is char pointer */ @@ -142,7 +145,7 @@ struct fppTag { #define FPPTAG_INCLUDE_MACRO_FILE 28 /* data is char pointer */ /* Evaluate the right part of a concatenate before the concat */ -#define FPPTAG_RIGHTCONCAT 29 /* data is boolean, default is FALSE */ +#define FPPTAG_RIGHTCONCAT 29 /* data is boolean, default is FPP_FALSE */ /* Include the specified file at the beginning of each function */ #define FPPTAG_INITFUNC 30 /* data is char pointer or NULL */ @@ -159,4 +162,15 @@ struct fppTag { /* Depends function: */ #define FPPTAG_DEPENDS 34 /* data is an depends funtion */ +/* Allow include "X" (rather than ) to search local files, default is FPP_TRUE */ +#define FPPTAG_ALLOW_INCLUDE_LOCAL 35 + +/* Fileopen function. If set, this is called when FPP tries to open a file: */ +#define FPPTAG_FILEOPENFUNC 36 /* data is function pointer to a + "FILE* (*)(char * filename, char * mode, void * userdata)", default is NULL */ + int fppPreProcess(struct fppTag *); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/3rdparty/bgfx/3rdparty/fcpp/usecpp.c b/3rdparty/bgfx/3rdparty/fcpp/usecpp.c index 3611ed247ee..0134d3c5000 100644 --- a/3rdparty/bgfx/3rdparty/fcpp/usecpp.c +++ b/3rdparty/bgfx/3rdparty/fcpp/usecpp.c @@ -128,8 +128,8 @@ FILE_LOCAL char DoString(struct fppTag **, char *); extern long __stack=8000; #endif -FILE_LOCAL char ignore=FALSE; /* if we should ignore strange flags! */ -FILE_LOCAL char display=FALSE; /* display all options in use! */ +FILE_LOCAL char ignore=FPP_FALSE; /* if we should ignore strange flags! */ +FILE_LOCAL char display=FPP_FALSE; /* display all options in use! */ FILE_LOCAL char dontreadprefs; /* set if only the command line is valid */ @@ -369,37 +369,37 @@ int SetOptions(int argc, char **argv, struct fppTag **tagptr) case 'H': /* display all whitespaces */ (*tagptr)->tag = FPPTAG_OUTPUTSPACE; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; case 'b': /* display unbalance */ (*tagptr)->tag = FPPTAG_OUTPUTBALANCE; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; case 'f': /* output all defined functions! */ (*tagptr)->tag = FPPTAG_DISPLAYFUNCTIONS; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; case 'F': /* output all included files! */ (*tagptr)->tag = FPPTAG_OUTPUTINCLUDES; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; case 'V': /* do not output version */ - (*tagptr)->tag = FPPTAG_IGNOREVERSION; - (*tagptr)->data= (void *)FALSE; + (*tagptr)->tag = FPPTAG_SHOWVERSION; + (*tagptr)->data= (void *)FPP_FALSE; (*tagptr)++; break; case 'C': /* Keep comments */ (*tagptr)->tag = FPPTAG_KEEPCOMMENTS; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; @@ -411,12 +411,12 @@ int SetOptions(int argc, char **argv, struct fppTag **tagptr) case 'd': /* Display all options */ fprintf(stderr, "FOUND -d flag!\n"); - display = TRUE; + display = FPP_TRUE; break; case 'E': /* Ignore non-fatal errors */ (*tagptr)->tag=FPPTAG_IGNORE_NONFATAL; - (*tagptr)->data=(void *)TRUE; + (*tagptr)->data=(void *)FPP_TRUE; (*tagptr)++; break; @@ -445,13 +445,13 @@ int SetOptions(int argc, char **argv, struct fppTag **tagptr) /* Do not output the 'line' keyword */ (*tagptr)->tag=FPPTAG_OUTPUTLINE; } - (*tagptr)->data=(void *)FALSE; + (*tagptr)->data=(void *)FPP_FALSE; (*tagptr)++; break; case 'M': /* Do not warn at missing includes */ (*tagptr)->tag=FPPTAG_WARNMISSINCLUDE; - (*tagptr)->data=(void *)FALSE; + (*tagptr)->data=(void *)FPP_FALSE; (*tagptr)++; break; @@ -466,31 +466,31 @@ int SetOptions(int argc, char **argv, struct fppTag **tagptr) case 'N': /* No machine specific built-ins */ (*tagptr)->tag=FPPTAG_BUILTINS; - (*tagptr)->data=(void *)FALSE; + (*tagptr)->data=(void *)FPP_FALSE; (*tagptr)++; break; case 'B': /* No predefines like __LINE__, etc. */ (*tagptr)->tag=FPPTAG_PREDEFINES; - (*tagptr)->data=(void *)FALSE; + (*tagptr)->data=(void *)FPP_FALSE; (*tagptr)++; break; case 'P': /* No C++ comments */ (*tagptr)->tag=FPPTAG_IGNORE_CPLUSPLUS; - (*tagptr)->data=(void *)TRUE; + (*tagptr)->data=(void *)FPP_TRUE; (*tagptr)++; break; case 'p': /* warn about illegal # - instructions */ (*tagptr)->tag = FPPTAG_WARNILLEGALCPP; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; case 'R': (*tagptr)->tag = FPPTAG_RIGHTCONCAT; - (*tagptr)->data= (void *)TRUE; + (*tagptr)->data= (void *)FPP_TRUE; (*tagptr)++; break; @@ -521,18 +521,18 @@ int SetOptions(int argc, char **argv, struct fppTag **tagptr) case 'w': /* Output all #defines but not the main file */ (*tagptr)->tag=FPPTAG_OUTPUTMAIN; - (*tagptr)->data=(void *)FALSE; + (*tagptr)->data=(void *)FPP_FALSE; (*tagptr)++; case 'W': /* Output all #defines */ if(!strncmp(ap, "WW", 2)) { (*tagptr)->tag=FPPTAG_WEBMODE; - (*tagptr)->data=(void *)TRUE; + (*tagptr)->data=(void *)FPP_TRUE; (*tagptr)++; } else { (*tagptr)->tag=FPPTAG_OUTPUT_DEFINES; - (*tagptr)->data=(void *)TRUE; + (*tagptr)->data=(void *)FPP_TRUE; (*tagptr)++; } break; diff --git a/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp b/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp index 261016ffc5e..a0d973abd02 100644 --- a/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp +++ b/3rdparty/bgfx/3rdparty/forsyth-too/forsythtriangleorderoptimizer.cpp @@ -14,18 +14,14 @@ // IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //----------------------------------------------------------------------------- +#include #include #include #include -#include #include namespace Forsyth { - typedef unsigned int uint; - typedef unsigned short uint16; - typedef unsigned char byte; - //----------------------------------------------------------------------------- // OptimizeFaces //----------------------------------------------------------------------------- @@ -36,13 +32,27 @@ namespace Forsyth // the number of indices in the list // vertexCount // the largest index value in indexList + // vertexBaseIndex + // starting vertex index subtracted from each index in indexList to + // allow safe operation on multiple objects in a single index buffer // newIndexList // a pointer to a preallocated buffer the same size as indexList to // hold the optimized index list // lruCacheSize // the size of the simulated post-transform cache (max:64) //----------------------------------------------------------------------------- - void OptimizeFaces(const uint16* indexList, uint indexCount, uint vertexCount, uint16* newIndexList, uint16 lruCacheSize); + template + void OptimizeFacesImpl(const IndexT* indexList, uint32_t indexCount, uint32_t vertexCount, IndexT vertexBaseIndex, IndexT* newIndexList, uint16_t lruCacheSize); + + void OptimizeFaces(const uint16_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint16_t vertexBaseIndex, uint16_t* newIndexList, uint16_t lruCacheSize) + { + OptimizeFacesImpl( indexList, indexCount, vertexCount, vertexBaseIndex, newIndexList, lruCacheSize ); + } + + void OptimizeFaces(const uint32_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint32_t vertexBaseIndex, uint32_t* newIndexList, uint16_t lruCacheSize) + { + OptimizeFacesImpl( indexList, indexCount, vertexCount, vertexBaseIndex, newIndexList, lruCacheSize ); + } namespace { @@ -82,7 +92,7 @@ namespace Forsyth return score; } - float ComputeVertexValenceScore(uint numActiveFaces) + float ComputeVertexValenceScore(uint32_t numActiveFaces) { const float FindVertexScore_ValenceBoostScale = 2.0f; const float FindVertexScore_ValenceBoostPower = 0.5f; @@ -100,7 +110,7 @@ namespace Forsyth const int kMaxVertexCacheSize = 64; - const uint kMaxPrecomputedVertexValenceScores = 64; + const uint32_t kMaxPrecomputedVertexValenceScores = 64; float s_vertexCacheScores[kMaxVertexCacheSize+1][kMaxVertexCacheSize]; float s_vertexValenceScores[kMaxPrecomputedVertexValenceScores]; @@ -114,7 +124,7 @@ namespace Forsyth } } - for (uint valence=0; valence + void OptimizeFacesImpl(const IndexT* indexList, uint32_t indexCount, uint32_t vertexCount, IndexT vertexBaseIndex, IndexT* newIndexList, uint16_t lruCacheSize) { - std::vector vertexDataList; + std::vector< OptimizeVertexData > vertexDataList; vertexDataList.resize(vertexCount); // compute face count per vertex - for (uint i=0; i= 0) && (index < vertexCount)); OptimizeVertexData& vertexData = vertexDataList[index]; vertexData.activeFaceListSize++; } - std::vector activeFaceList; + std::vector activeFaceList; - const uint16 kEvictedCacheIndex = std::numeric_limits::max(); + const IndexT kEvictedCacheIndex = std::numeric_limits::max(); { // allocate face list per vertex - uint curActiveFaceListPos = 0; - for (uint i=0; i processedFaceList; + std::vector processedFaceList; processedFaceList.resize(indexCount); - uint16 vertexCacheBuffer[(kMaxVertexCacheSize+3)*2]; - uint16* cache0 = vertexCacheBuffer; - uint16* cache1 = vertexCacheBuffer+(kMaxVertexCacheSize+3); - uint16 entriesInCache0 = 0; + IndexT vertexCacheBuffer[(kMaxVertexCacheSize+3)*2]; + IndexT* cache0 = vertexCacheBuffer; + IndexT* cache1 = vertexCacheBuffer+(kMaxVertexCacheSize+3); + IndexT entriesInCache0 = 0; - uint bestFace = 0; + uint32_t bestFace = 0; float bestScore = -1.f; const float maxValenceScore = FindVertexScore(1, kEvictedCacheIndex, lruCacheSize) * 3.f; - for (uint i = 0; i < indexCount; i += 3) + for (uint32_t i = 0; i < indexCount; i += 3) { if (bestScore < 0.f) { // no verts in the cache are used by any unprocessed faces so // search all unprocessed faces for a new starting point - for (uint j = 0; j < indexCount; j += 3) + for (uint32_t j = 0; j < indexCount; j += 3) { if (processedFaceList[j] == 0) { - uint face = j; + uint32_t face = j; float faceScore = 0.f; - for (uint k=0; k<3; ++k) + for (uint32_t k=0; k<3; ++k) { - uint16 index = indexList[face+k]; + IndexT index = indexList[face+k] - vertexBaseIndex; OptimizeVertexData& vertexData = vertexDataList[index]; assert(vertexData.activeFaceListSize > 0); assert(vertexData.cachePos0 >= lruCacheSize); @@ -269,13 +280,13 @@ namespace Forsyth } processedFaceList[bestFace] = 1; - uint16 entriesInCache1 = 0; + uint16_t entriesInCache1 = 0; // add bestFace to LRU cache and to newIndexList - for (uint v = 0; v < 3; ++v) + for (uint32_t v = 0; v < 3; ++v) { - uint16 index = indexList[bestFace+v]; - newIndexList[i+v] = index; + IndexT index = indexList[bestFace+v] - vertexBaseIndex; + newIndexList[i+v] = index + vertexBaseIndex; OptimizeVertexData& vertexData = vertexDataList[index]; @@ -292,9 +303,9 @@ namespace Forsyth } assert(vertexData.activeFaceListSize > 0); - uint* begin = &activeFaceList[vertexData.activeFaceListStart]; - uint* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1; - uint* it = std::find(begin, end, bestFace); + uint32_t* begin = &activeFaceList[vertexData.activeFaceListStart]; + uint32_t* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1; + uint32_t* it = std::find(begin, end, bestFace); assert(it != end); std::swap(*it, *(end-1)); --vertexData.activeFaceListSize; @@ -303,9 +314,9 @@ namespace Forsyth } // move the rest of the old verts in the cache down and compute their new scores - for (uint c0 = 0; c0 < entriesInCache0; ++c0) + for (uint32_t c0 = 0; c0 < entriesInCache0; ++c0) { - uint16 index = cache0[c0]; + IndexT index = cache0[c0]; OptimizeVertexData& vertexData = vertexDataList[index]; if (vertexData.cachePos1 >= entriesInCache1) @@ -318,19 +329,19 @@ namespace Forsyth // find the best scoring triangle in the current cache (including up to 3 that were just evicted) bestScore = -1.f; - for (uint c1 = 0; c1 < entriesInCache1; ++c1) + for (uint32_t c1 = 0; c1 < entriesInCache1; ++c1) { - uint16 index = cache1[c1]; + IndexT index = cache1[c1]; OptimizeVertexData& vertexData = vertexDataList[index]; vertexData.cachePos0 = vertexData.cachePos1; vertexData.cachePos1 = kEvictedCacheIndex; - for (uint j=0; j" #define YY_INT_ALIGNED short int @@ -8,8 +7,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 0 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -179,11 +178,17 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -201,11 +206,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -302,7 +302,7 @@ static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner ); void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner ); @@ -334,7 +334,7 @@ void glcpp_free (void * ,yyscan_t yyscanner ); /* Begin user sect3 */ -#define glcpp_wrap(n) 1 +#define glcpp_wrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -346,6 +346,9 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__noreturn__)) +#endif static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the @@ -390,7 +393,7 @@ static yyconst flex_int16_t yy_accept[174] = 9, 11, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, @@ -422,7 +425,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[46] = +static yyconst YY_CHAR yy_meta[46] = { 0, 1, 2, 3, 2, 3, 1, 1, 1, 1, 4, 5, 1, 1, 6, 1, 7, 7, 7, 1, 1, @@ -431,7 +434,7 @@ static yyconst flex_int32_t yy_meta[46] = 7, 7, 7, 7, 1 } ; -static yyconst flex_int16_t yy_base[191] = +static yyconst flex_uint16_t yy_base[191] = { 0, 0, 0, 43, 44, 55, 0, 47, 48, 99, 141, 102, 103, 106, 107, 435, 433, 436, 428, 436, 429, @@ -479,7 +482,7 @@ static yyconst flex_int16_t yy_def[191] = 173, 173, 173, 173, 173, 173, 173, 173, 173, 173 } ; -static yyconst flex_int16_t yy_nxt[482] = +static yyconst flex_uint16_t yy_nxt[482] = { 0, 16, 17, 18, 19, 20, 21, 22, 23, 24, 23, 23, 25, 26, 27, 28, 29, 30, 30, 31, 32, @@ -600,8 +603,8 @@ static yyconst flex_int16_t yy_chk[482] = #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -#line 1 "src/glsl/glcpp/glcpp-lex.l" -#line 2 "src/glsl/glcpp/glcpp-lex.l" +#line 1 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" +#line 2 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" /* * Copyright © 2010 Intel Corporation * @@ -767,7 +770,7 @@ match longer strings take priority over those matching shorter strings, we have to be careful to avoid OTHER matching and hiding something that CPP does care about. So we simply exclude all characters that appear in any other expressions. */ -#line 771 "src/glsl/glcpp/glcpp-lex.c" +#line 774 "" #define INITIAL 0 #define COMMENT 1 @@ -777,6 +780,14 @@ characters that appear in any other expressions. */ #define NEWLINE_CATCHUP 5 #define UNREACHABLE 6 +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + #define YY_EXTRA_TYPE glcpp_parser_t * /* Holds the entire state of the reentrant scanner. */ @@ -793,7 +804,7 @@ struct yyguts_t YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; int yy_n_chars; - int yyleng_r; + yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -844,19 +855,23 @@ void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *glcpp_get_in (yyscan_t yyscanner ); -void glcpp_set_in (FILE * in_str ,yyscan_t yyscanner ); +void glcpp_set_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *glcpp_get_out (yyscan_t yyscanner ); -void glcpp_set_out (FILE * out_str ,yyscan_t yyscanner ); +void glcpp_set_out (FILE * _out_str ,yyscan_t yyscanner ); -int glcpp_get_leng (yyscan_t yyscanner ); +yy_size_t glcpp_get_leng (yyscan_t yyscanner ); char *glcpp_get_text (yyscan_t yyscanner ); int glcpp_get_lineno (yyscan_t yyscanner ); -void glcpp_set_lineno (int line_number ,yyscan_t yyscanner ); +void glcpp_set_lineno (int _line_number ,yyscan_t yyscanner ); + +int glcpp_get_column (yyscan_t yyscanner ); + +void glcpp_set_column (int _column_no ,yyscan_t yyscanner ); YYSTYPE * glcpp_get_lval (yyscan_t yyscanner ); @@ -878,8 +893,12 @@ extern int glcpp_wrap (yyscan_t yyscanner ); #endif #endif +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif @@ -898,7 +917,7 @@ static int input (yyscan_t yyscanner ); #endif - static void yy_push_state (int new_state ,yyscan_t yyscanner); + static void yy_push_state (int _new_state ,yyscan_t yyscanner); static void yy_pop_state (yyscan_t yyscanner ); @@ -1000,7 +1019,7 @@ extern int glcpp_lex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -1010,12 +1029,43 @@ extern int glcpp_lex \ */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 195 "src/glsl/glcpp/glcpp-lex.l" + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + glcpp_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + glcpp__load_buffer_state(yyscanner ); + } + + { +#line 195 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" glcpp_parser_t *parser = yyextra; @@ -1076,39 +1126,9 @@ YY_DECL } /* Single-line comments */ -#line 1080 "src/glsl/glcpp/glcpp-lex.c" +#line 1130 "" - yylval = yylval_param; - - yylloc = yylloc_param; - - if ( !yyg->yy_init ) - { - yyg->yy_init = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yyg->yy_start ) - yyg->yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - glcpp_ensure_buffer_stack (yyscanner); - YY_CURRENT_BUFFER_LVALUE = - glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); - } - - glcpp__load_buffer_state(yyscanner ); - } - - while ( 1 ) /* loops until end-of-file is reached */ + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -1124,7 +1144,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1161,41 +1181,41 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 255 "src/glsl/glcpp/glcpp-lex.l" +#line 255 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { } YY_BREAK /* Multi-line comments */ case 2: YY_RULE_SETUP -#line 259 "src/glsl/glcpp/glcpp-lex.l" +#line 259 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { yy_push_state(COMMENT, yyscanner); } YY_BREAK case 3: YY_RULE_SETUP -#line 260 "src/glsl/glcpp/glcpp-lex.l" +#line 260 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 261 "src/glsl/glcpp/glcpp-lex.l" +#line 261 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; parser->commented_newlines++; } YY_BREAK case 5: YY_RULE_SETUP -#line 262 "src/glsl/glcpp/glcpp-lex.l" +#line 262 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 263 "src/glsl/glcpp/glcpp-lex.l" +#line 263 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { yylineno++; yycolumn = 0; parser->commented_newlines++; } YY_BREAK case 7: YY_RULE_SETUP -#line 264 "src/glsl/glcpp/glcpp-lex.l" +#line 264 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { yy_pop_state(yyscanner); /* In the start condition, we don't want any SPACE token. */ @@ -1205,7 +1225,7 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 271 "src/glsl/glcpp/glcpp-lex.l" +#line 271 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { /* If the '#' is the first non-whitespace, non-comment token on this @@ -1223,7 +1243,7 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 286 "src/glsl/glcpp/glcpp-lex.l" +#line 286 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->space_tokens = 0; @@ -1241,10 +1261,11 @@ YY_RULE_SETUP case 10: /* rule 10 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +YY_LINENO_REWIND_TO(yy_cp - 1); yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 300 "src/glsl/glcpp/glcpp-lex.l" +#line 300 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; } @@ -1253,7 +1274,7 @@ YY_RULE_SETUP * Simply pass them through to the main compiler's lexer/parser. */ case 11: YY_RULE_SETUP -#line 306 "src/glsl/glcpp/glcpp-lex.l" +#line 306 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_STRING_TOKEN (PRAGMA); @@ -1261,7 +1282,7 @@ YY_RULE_SETUP YY_BREAK case 12: YY_RULE_SETUP -#line 311 "src/glsl/glcpp/glcpp-lex.l" +#line 311 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_TOKEN (LINE); @@ -1270,7 +1291,7 @@ YY_RULE_SETUP case 13: /* rule 13 can match eol */ YY_RULE_SETUP -#line 316 "src/glsl/glcpp/glcpp-lex.l" +#line 316 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_TOKEN_NEVER_SKIP (NEWLINE); @@ -1280,7 +1301,7 @@ YY_RULE_SETUP * even when we are otherwise skipping. */ case 14: YY_RULE_SETUP -#line 323 "src/glsl/glcpp/glcpp-lex.l" +#line 323 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->lexing_directive = 1; @@ -1290,7 +1311,7 @@ YY_RULE_SETUP YY_BREAK case 15: YY_RULE_SETUP -#line 330 "src/glsl/glcpp/glcpp-lex.l" +#line 330 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->lexing_directive = 1; @@ -1301,10 +1322,11 @@ YY_RULE_SETUP case 16: /* rule 16 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +YY_LINENO_REWIND_TO(yy_bp + 2); yyg->yy_c_buf_p = yy_cp = yy_bp + 2; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 337 "src/glsl/glcpp/glcpp-lex.l" +#line 337 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->lexing_directive = 1; @@ -1315,10 +1337,11 @@ YY_RULE_SETUP case 17: /* rule 17 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ +YY_LINENO_REWIND_TO(yy_bp + 4); yyg->yy_c_buf_p = yy_cp = yy_bp + 4; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 344 "src/glsl/glcpp/glcpp-lex.l" +#line 344 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->lexing_directive = 1; @@ -1328,7 +1351,7 @@ YY_RULE_SETUP YY_BREAK case 18: YY_RULE_SETUP -#line 351 "src/glsl/glcpp/glcpp-lex.l" +#line 351 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->space_tokens = 0; @@ -1337,7 +1360,7 @@ YY_RULE_SETUP YY_BREAK case 19: YY_RULE_SETUP -#line 357 "src/glsl/glcpp/glcpp-lex.l" +#line 357 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->space_tokens = 0; @@ -1346,7 +1369,7 @@ YY_RULE_SETUP YY_BREAK case 20: YY_RULE_SETUP -#line 363 "src/glsl/glcpp/glcpp-lex.l" +#line 363 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_STRING_TOKEN (ERROR_TOKEN); @@ -1372,7 +1395,7 @@ YY_RULE_SETUP */ case 21: YY_RULE_SETUP -#line 386 "src/glsl/glcpp/glcpp-lex.l" +#line 386 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { if (! parser->skipping) { BEGIN DEFINE; @@ -1383,7 +1406,7 @@ YY_RULE_SETUP YY_BREAK case 22: YY_RULE_SETUP -#line 394 "src/glsl/glcpp/glcpp-lex.l" +#line 394 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; yyextra->space_tokens = 0; @@ -1392,7 +1415,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 400 "src/glsl/glcpp/glcpp-lex.l" +#line 400 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { /* Nothing to do here. Importantly, don't leave the * start condition, since it's legal to have space between the @@ -1402,7 +1425,7 @@ YY_RULE_SETUP /* This will catch any non-directive garbage after a HASH */ case 24: YY_RULE_SETUP -#line 407 "src/glsl/glcpp/glcpp-lex.l" +#line 407 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_TOKEN (GARBAGE); @@ -1414,7 +1437,7 @@ case 25: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 413 "src/glsl/glcpp/glcpp-lex.l" +#line 413 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_STRING_TOKEN (FUNC_IDENTIFIER); @@ -1423,7 +1446,7 @@ YY_RULE_SETUP /* An identifier not immediately followed by '(' */ case 26: YY_RULE_SETUP -#line 419 "src/glsl/glcpp/glcpp-lex.l" +#line 419 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; RETURN_STRING_TOKEN (OBJ_IDENTIFIER); @@ -1432,7 +1455,7 @@ YY_RULE_SETUP /* Whitespace */ case 27: YY_RULE_SETUP -#line 425 "src/glsl/glcpp/glcpp-lex.l" +#line 425 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { /* Just ignore it. Nothing to do here. */ } @@ -1441,7 +1464,7 @@ YY_RULE_SETUP case 28: /* rule 28 can match eol */ YY_RULE_SETUP -#line 430 "src/glsl/glcpp/glcpp-lex.l" +#line 430 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext); @@ -1452,7 +1475,7 @@ YY_RULE_SETUP * space. This is an error. */ case 29: YY_RULE_SETUP -#line 438 "src/glsl/glcpp/glcpp-lex.l" +#line 438 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { BEGIN INITIAL; glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext); @@ -1461,98 +1484,98 @@ YY_RULE_SETUP YY_BREAK case 30: YY_RULE_SETUP -#line 444 "src/glsl/glcpp/glcpp-lex.l" +#line 444 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_STRING_TOKEN (INTEGER_STRING); } YY_BREAK case 31: YY_RULE_SETUP -#line 448 "src/glsl/glcpp/glcpp-lex.l" +#line 448 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_STRING_TOKEN (INTEGER_STRING); } YY_BREAK case 32: YY_RULE_SETUP -#line 452 "src/glsl/glcpp/glcpp-lex.l" +#line 452 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_STRING_TOKEN (INTEGER_STRING); } YY_BREAK case 33: YY_RULE_SETUP -#line 456 "src/glsl/glcpp/glcpp-lex.l" +#line 456 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (LEFT_SHIFT); } YY_BREAK case 34: YY_RULE_SETUP -#line 460 "src/glsl/glcpp/glcpp-lex.l" +#line 460 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (RIGHT_SHIFT); } YY_BREAK case 35: YY_RULE_SETUP -#line 464 "src/glsl/glcpp/glcpp-lex.l" +#line 464 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (LESS_OR_EQUAL); } YY_BREAK case 36: YY_RULE_SETUP -#line 468 "src/glsl/glcpp/glcpp-lex.l" +#line 468 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (GREATER_OR_EQUAL); } YY_BREAK case 37: YY_RULE_SETUP -#line 472 "src/glsl/glcpp/glcpp-lex.l" +#line 472 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (EQUAL); } YY_BREAK case 38: YY_RULE_SETUP -#line 476 "src/glsl/glcpp/glcpp-lex.l" +#line 476 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (NOT_EQUAL); } YY_BREAK case 39: YY_RULE_SETUP -#line 480 "src/glsl/glcpp/glcpp-lex.l" +#line 480 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (AND); } YY_BREAK case 40: YY_RULE_SETUP -#line 484 "src/glsl/glcpp/glcpp-lex.l" +#line 484 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (OR); } YY_BREAK case 41: YY_RULE_SETUP -#line 488 "src/glsl/glcpp/glcpp-lex.l" +#line 488 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (PLUS_PLUS); } YY_BREAK case 42: YY_RULE_SETUP -#line 492 "src/glsl/glcpp/glcpp-lex.l" +#line 492 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (MINUS_MINUS); } YY_BREAK case 43: YY_RULE_SETUP -#line 496 "src/glsl/glcpp/glcpp-lex.l" +#line 496 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { if (! parser->skipping) { if (parser->is_gles) @@ -1563,42 +1586,42 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 504 "src/glsl/glcpp/glcpp-lex.l" +#line 504 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (DEFINED); } YY_BREAK case 45: YY_RULE_SETUP -#line 508 "src/glsl/glcpp/glcpp-lex.l" +#line 508 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_STRING_TOKEN (IDENTIFIER); } YY_BREAK case 46: YY_RULE_SETUP -#line 512 "src/glsl/glcpp/glcpp-lex.l" +#line 512 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_STRING_TOKEN (OTHER); } YY_BREAK case 47: YY_RULE_SETUP -#line 516 "src/glsl/glcpp/glcpp-lex.l" +#line 516 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_TOKEN (yytext[0]); } YY_BREAK case 48: YY_RULE_SETUP -#line 520 "src/glsl/glcpp/glcpp-lex.l" +#line 520 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { RETURN_STRING_TOKEN (OTHER); } YY_BREAK case 49: YY_RULE_SETUP -#line 524 "src/glsl/glcpp/glcpp-lex.l" +#line 524 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { if (yyextra->space_tokens) { RETURN_TOKEN (SPACE); @@ -1610,7 +1633,7 @@ YY_RULE_SETUP case 50: /* rule 50 can match eol */ YY_RULE_SETUP -#line 532 "src/glsl/glcpp/glcpp-lex.l" +#line 532 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { if (parser->commented_newlines) { BEGIN NEWLINE_CATCHUP; @@ -1628,7 +1651,7 @@ case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(DEFINE): case YY_STATE_EOF(HASH): -#line 545 "src/glsl/glcpp/glcpp-lex.l" +#line 545 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { if (YY_START == COMMENT) glcpp_error(yylloc, yyextra, "Unterminated comment"); @@ -1644,7 +1667,7 @@ case YY_STATE_EOF(HASH): * of the preceding patterns to match that input. */ case 51: YY_RULE_SETUP -#line 559 "src/glsl/glcpp/glcpp-lex.l" +#line 559 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" { glcpp_error(yylloc, yyextra, "Internal compiler error: Unexpected character: %s", yytext); @@ -1660,10 +1683,10 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 572 "src/glsl/glcpp/glcpp-lex.l" +#line 572 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1667 "src/glsl/glcpp/glcpp-lex.c" +#line 1690 "" case YY_STATE_EOF(DONE): case YY_STATE_EOF(NEWLINE_CATCHUP): case YY_STATE_EOF(UNREACHABLE): @@ -1797,6 +1820,7 @@ case YY_STATE_EOF(UNREACHABLE): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of glcpp_lex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1809,9 +1833,9 @@ case YY_STATE_EOF(UNREACHABLE): static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + yy_size_t number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) @@ -1840,7 +1864,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1853,21 +1877,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1898,7 +1922,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -1922,9 +1946,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); @@ -1943,15 +1967,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_current_state = yyg->yy_start; for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1976,11 +2000,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -1995,12 +2019,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 173); + (void)yyg; return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) { - register char *yy_cp; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_cp = yyg->yy_c_buf_p; @@ -2011,10 +2038,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yyg->yy_n_chars + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + yy_size_t number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + char *source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) @@ -2036,6 +2063,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner) yyg->yy_c_buf_p = yy_cp; } +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -2061,7 +2090,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -2189,7 +2218,7 @@ static void glcpp__load_buffer_state (yyscan_t yyscanner) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -2341,7 +2370,7 @@ void glcpp_pop_buffer_state (yyscan_t yyscanner) */ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) { - int num_to_alloc; + yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -2350,7 +2379,7 @@ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); @@ -2367,7 +2396,7 @@ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc @@ -2439,12 +2468,12 @@ YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -2469,7 +2498,7 @@ YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , return b; } - static void yy_push_state (int new_state , yyscan_t yyscanner) + static void yy_push_state (int _new_state , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth ) @@ -2491,7 +2520,7 @@ YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START; - BEGIN(new_state); + BEGIN(_new_state); } static void yy_pop_state (yyscan_t yyscanner) @@ -2515,7 +2544,9 @@ YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len , static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { - (void) fprintf( stderr, "%s\n", msg ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -2594,7 +2625,7 @@ FILE *glcpp_get_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int glcpp_get_leng (yyscan_t yyscanner) +yy_size_t glcpp_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -2621,51 +2652,51 @@ void glcpp_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) } /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void glcpp_set_lineno (int line_number , yyscan_t yyscanner) +void glcpp_set_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner); + YY_FATAL_ERROR( "glcpp_set_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void glcpp_set_column (int column_no , yyscan_t yyscanner) +void glcpp_set_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner); + YY_FATAL_ERROR( "glcpp_set_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see glcpp__switch_to_buffer */ -void glcpp_set_in (FILE * in_str , yyscan_t yyscanner) +void glcpp_set_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void glcpp_set_out (FILE * out_str , yyscan_t yyscanner) +void glcpp_set_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int glcpp_get_debug (yyscan_t yyscanner) @@ -2674,10 +2705,10 @@ int glcpp_get_debug (yyscan_t yyscanner) return yy_flex_debug; } -void glcpp_set_debug (int bdebug , yyscan_t yyscanner) +void glcpp_set_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ @@ -2840,7 +2871,10 @@ int glcpp_lex_destroy (yyscan_t yyscanner) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2849,7 +2883,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2859,11 +2893,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) void *glcpp_alloc (yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; return (void *) malloc( size ); } void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -2876,12 +2915,14 @@ void *glcpp_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) void glcpp_free (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see glcpp_realloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 572 "src/glsl/glcpp/glcpp-lex.l" +#line 572 "../../../3rdparty/glsl-optimizer/src/glsl/glcpp/glcpp-lex.l" diff --git a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp index 5d790f7fd72..b5cf24c7fe8 100644 --- a/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp +++ b/3rdparty/bgfx/3rdparty/glsl-optimizer/src/glsl/glsl_optimizer.cpp @@ -170,6 +170,10 @@ struct glslopt_shader { for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) ralloc_free(whole_program->_LinkedShaders[i]); + for(GLuint i =0;i< whole_program->NumShaders;i++) + ralloc_free(whole_program->Shaders[i]); + ralloc_free(whole_program->Shaders); + ralloc_free(whole_program->InfoLog); ralloc_free(whole_program); ralloc_free(rawOutput); ralloc_free(optimizedOutput); diff --git a/3rdparty/bgfx/3rdparty/glslang/.appveyor.yml b/3rdparty/bgfx/3rdparty/glslang/.appveyor.yml index 07e269bedff..5765d9e666e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/.appveyor.yml +++ b/3rdparty/bgfx/3rdparty/glslang/.appveyor.yml @@ -31,8 +31,11 @@ matrix: # scripts that run after cloning repository install: - - git clone https://github.com/google/googletest.git External/googletest - C:/Python27/python.exe update_glslang_sources.py + - git clone https://github.com/google/googletest.git External/googletest + - cd External/googletest + - git checkout 440527a61e1c91188195f7de212c63c77e8f0a45 + - cd ../.. build: parallel: true # enable MSBuild parallel builds @@ -40,7 +43,7 @@ build: build_script: - mkdir build && cd build - - cmake .. -DCMAKE_INSTALL_PREFIX=install + - cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_INSTALL_PREFIX=install .. - cmake --build . --config %CONFIGURATION% --target install test_script: @@ -60,6 +63,7 @@ after_test: # Zip all glslang artifacts for uploading and deploying - 7z a glslang-master-windows-"%PLATFORM%"-"%CONFIGURATION%".zip bin\glslangValidator.exe + bin\spirv-remap.exe include\glslang\* include\SPIRV\* lib\glslang%SUFFIX%.lib diff --git a/3rdparty/bgfx/3rdparty/glslang/.travis.yml b/3rdparty/bgfx/3rdparty/glslang/.travis.yml index 4fe4b5e5ba9..2478912177c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/.travis.yml +++ b/3rdparty/bgfx/3rdparty/glslang/.travis.yml @@ -48,12 +48,16 @@ install: - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then export CC=clang-3.6 CXX=clang++-3.6; fi - # Download Android NDK and Android CMake toolchain file. + # Download a recent Android NDK and use its android.toolchain.cmake file. - if [[ "$BUILD_NDK" == "ON" ]]; then - git clone --depth=1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk; export ANDROID_NDK=$HOME/android-ndk; - git clone --depth=1 https://github.com/taka-no-me/android-cmake.git $HOME/android-cmake; - export TOOLCHAIN_PATH=$HOME/android-cmake/android.toolchain.cmake; + git init $ANDROID_NDK; + pushd $ANDROID_NDK; + git remote add dneto0 https://github.com/dneto0/android-ndk.git; + git fetch --depth=1 dneto0 r17b-strip; + git checkout FETCH_HEAD; + popd; + export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake; fi before_script: @@ -63,10 +67,12 @@ before_script: script: - mkdir build && cd build # For Android, do release building using NDK without testing. + # Use android-14, the oldest native API level supporeted by NDK r17b. + # We can use newer API levels if we want. # For Linux and macOS, do debug/release building with testing. - if [[ "$BUILD_NDK" == "ON" ]]; then cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH} - -DANDROID_NATIVE_API_LEVEL=android-12 + -DANDROID_NATIVE_API_LEVEL=android-14 -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" -DBUILD_TESTING=OFF ..; diff --git a/3rdparty/bgfx/3rdparty/glslang/Android.mk b/3rdparty/bgfx/3rdparty/glslang/Android.mk new file mode 100644 index 00000000000..fda81a7cf25 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Android.mk @@ -0,0 +1,100 @@ +LOCAL_PATH := $(call my-dir) + +GLSLANG_OS_FLAGS := -DGLSLANG_OSINCLUDE_UNIX +# AMD and NV extensions are turned on by default in upstream Glslang. +GLSLANG_DEFINES:= -DAMD_EXTENSIONS -DNV_EXTENSIONS -DENABLE_HLSL $(GLSLANG_OS_FLAGS) + +include $(CLEAR_VARS) +LOCAL_MODULE:=OSDependent +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) +LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) +LOCAL_SRC_FILES:=glslang/OSDependent/Unix/ossource.cpp +LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/OSDependent/Unix/ +LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/OSDependent/Unix/ +include $(BUILD_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:=OGLCompiler +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) +LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) +LOCAL_SRC_FILES:=OGLCompilersDLL/InitializeDll.cpp +LOCAL_C_INCLUDES:=$(LOCAL_PATH)/OGLCompiler +LOCAL_STATIC_LIBRARIES:=OSDependent +include $(BUILD_STATIC_LIBRARY) + +# Build Glslang's HLSL parser library. +include $(CLEAR_VARS) +LOCAL_MODULE:=HLSL +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) +LOCAL_SRC_FILES:= \ + hlsl/hlslAttributes.cpp \ + hlsl/hlslGrammar.cpp \ + hlsl/hlslOpMap.cpp \ + hlsl/hlslParseables.cpp \ + hlsl/hlslParseHelper.cpp \ + hlsl/hlslScanContext.cpp \ + hlsl/hlslTokenStream.cpp +LOCAL_C_INCLUDES:=$(LOCAL_PATH) \ + $(LOCAL_PATH)/hlsl +include $(BUILD_STATIC_LIBRARY) + +include $(CLEAR_VARS) +GLSLANG_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT))) + +LOCAL_MODULE:=glslang +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) +LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) +LOCAL_SRC_FILES:= \ + glslang/GenericCodeGen/CodeGen.cpp \ + glslang/GenericCodeGen/Link.cpp \ + glslang/MachineIndependent/attribute.cpp \ + glslang/MachineIndependent/Constant.cpp \ + glslang/MachineIndependent/glslang_tab.cpp \ + glslang/MachineIndependent/InfoSink.cpp \ + glslang/MachineIndependent/Initialize.cpp \ + glslang/MachineIndependent/Intermediate.cpp \ + glslang/MachineIndependent/intermOut.cpp \ + glslang/MachineIndependent/IntermTraverse.cpp \ + glslang/MachineIndependent/iomapper.cpp \ + glslang/MachineIndependent/limits.cpp \ + glslang/MachineIndependent/linkValidate.cpp \ + glslang/MachineIndependent/parseConst.cpp \ + glslang/MachineIndependent/ParseContextBase.cpp \ + glslang/MachineIndependent/ParseHelper.cpp \ + glslang/MachineIndependent/PoolAlloc.cpp \ + glslang/MachineIndependent/propagateNoContraction.cpp \ + glslang/MachineIndependent/reflection.cpp \ + glslang/MachineIndependent/RemoveTree.cpp \ + glslang/MachineIndependent/Scan.cpp \ + glslang/MachineIndependent/ShaderLang.cpp \ + glslang/MachineIndependent/SymbolTable.cpp \ + glslang/MachineIndependent/Versions.cpp \ + glslang/MachineIndependent/preprocessor/PpAtom.cpp \ + glslang/MachineIndependent/preprocessor/PpContext.cpp \ + glslang/MachineIndependent/preprocessor/Pp.cpp \ + glslang/MachineIndependent/preprocessor/PpScanner.cpp \ + glslang/MachineIndependent/preprocessor/PpTokens.cpp +LOCAL_C_INCLUDES:=$(LOCAL_PATH) \ + $(LOCAL_PATH)/glslang/MachineIndependent \ + $(GLSLANG_OUT_PATH) +LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL +include $(BUILD_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE:=SPIRV +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES) +LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) +LOCAL_SRC_FILES:= \ + SPIRV/GlslangToSpv.cpp \ + SPIRV/InReadableOrder.cpp \ + SPIRV/Logger.cpp \ + SPIRV/SPVRemapper.cpp \ + SPIRV/SpvBuilder.cpp \ + SPIRV/SpvPostProcess.cpp \ + SPIRV/SpvTools.cpp \ + SPIRV/disassemble.cpp \ + SPIRV/doc.cpp +LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/SPIRV +LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/SPIRV +LOCAL_STATIC_LIBRARIES:=glslang +include $(BUILD_STATIC_LIBRARY) diff --git a/3rdparty/bgfx/3rdparty/glslang/BUILD.gn b/3rdparty/bgfx/3rdparty/glslang/BUILD.gn new file mode 100644 index 00000000000..5d5b1507420 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/BUILD.gn @@ -0,0 +1,153 @@ +# Copyright (C) 2018 Google, Inc. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +import("//build_overrides/glslang.gni") + +spirv_tools_dir = glslang_spirv_tools_dir + +config("glslang_public") { + include_dirs = [ "." ] +} + +source_set("glslang_sources") { + public_configs = [ ":glslang_public" ] + + sources = [ + "OGLCompilersDLL/InitializeDll.cpp", + "OGLCompilersDLL/InitializeDll.h", + "SPIRV/GLSL.ext.EXT.h", + "SPIRV/GLSL.ext.KHR.h", + "SPIRV/GLSL.std.450.h", + "SPIRV/GlslangToSpv.cpp", + "SPIRV/GlslangToSpv.h", + "SPIRV/InReadableOrder.cpp", + "SPIRV/Logger.cpp", + "SPIRV/Logger.h", + "SPIRV/SPVRemapper.cpp", + "SPIRV/SPVRemapper.h", + "SPIRV/SpvBuilder.cpp", + "SPIRV/SpvBuilder.h", + "SPIRV/SpvPostProcess.cpp", + "SPIRV/bitutils.h", + "SPIRV/disassemble.cpp", + "SPIRV/disassemble.h", + "SPIRV/doc.cpp", + "SPIRV/doc.h", + "SPIRV/hex_float.h", + "SPIRV/spirv.hpp", + "SPIRV/spvIR.h", + "glslang/GenericCodeGen/CodeGen.cpp", + "glslang/GenericCodeGen/Link.cpp", + "glslang/Include/BaseTypes.h", + "glslang/Include/Common.h", + "glslang/Include/ConstantUnion.h", + "glslang/Include/InfoSink.h", + "glslang/Include/InitializeGlobals.h", + "glslang/Include/PoolAlloc.h", + "glslang/Include/ResourceLimits.h", + "glslang/Include/ShHandle.h", + "glslang/Include/Types.h", + "glslang/Include/arrays.h", + "glslang/Include/intermediate.h", + "glslang/Include/revision.h", + "glslang/MachineIndependent/Constant.cpp", + "glslang/MachineIndependent/InfoSink.cpp", + "glslang/MachineIndependent/Initialize.cpp", + "glslang/MachineIndependent/Initialize.h", + "glslang/MachineIndependent/IntermTraverse.cpp", + "glslang/MachineIndependent/Intermediate.cpp", + "glslang/MachineIndependent/LiveTraverser.h", + "glslang/MachineIndependent/ParseContextBase.cpp", + "glslang/MachineIndependent/ParseHelper.cpp", + "glslang/MachineIndependent/ParseHelper.h", + "glslang/MachineIndependent/PoolAlloc.cpp", + "glslang/MachineIndependent/RemoveTree.cpp", + "glslang/MachineIndependent/RemoveTree.h", + "glslang/MachineIndependent/Scan.cpp", + "glslang/MachineIndependent/Scan.h", + "glslang/MachineIndependent/ScanContext.h", + "glslang/MachineIndependent/ShaderLang.cpp", + "glslang/MachineIndependent/SymbolTable.cpp", + "glslang/MachineIndependent/SymbolTable.h", + "glslang/MachineIndependent/Versions.cpp", + "glslang/MachineIndependent/Versions.h", + "glslang/MachineIndependent/attribute.cpp", + "glslang/MachineIndependent/attribute.h", + "glslang/MachineIndependent/gl_types.h", + "glslang/MachineIndependent/glslang.y", + "glslang/MachineIndependent/glslang_tab.cpp", + "glslang/MachineIndependent/glslang_tab.cpp.h", + "glslang/MachineIndependent/intermOut.cpp", + "glslang/MachineIndependent/iomapper.cpp", + "glslang/MachineIndependent/iomapper.h", + "glslang/MachineIndependent/limits.cpp", + "glslang/MachineIndependent/linkValidate.cpp", + "glslang/MachineIndependent/localintermediate.h", + "glslang/MachineIndependent/parseConst.cpp", + "glslang/MachineIndependent/parseVersions.h", + "glslang/MachineIndependent/preprocessor/Pp.cpp", + "glslang/MachineIndependent/preprocessor/PpAtom.cpp", + "glslang/MachineIndependent/preprocessor/PpContext.cpp", + "glslang/MachineIndependent/preprocessor/PpContext.h", + "glslang/MachineIndependent/preprocessor/PpScanner.cpp", + "glslang/MachineIndependent/preprocessor/PpTokens.cpp", + "glslang/MachineIndependent/preprocessor/PpTokens.h", + "glslang/MachineIndependent/propagateNoContraction.cpp", + "glslang/MachineIndependent/propagateNoContraction.h", + "glslang/MachineIndependent/reflection.cpp", + "glslang/MachineIndependent/reflection.h", + "glslang/OSDependent/osinclude.h", + "glslang/Public/ShaderLang.h", + ] + + defines = [] + if (is_win) { + sources += [ "glslang/OSDependent/Windows/ossource.cpp" ] + defines += [ "GLSLANG_OSINCLUDE_WIN32" ] + } else { + sources += [ "glslang/OSDependent/Unix/ossource.cpp" ] + defines += [ "GLSLANG_OSINCLUDE_UNIX" ] + } + + if (is_clang) { + cflags_cc = [ + "-Wno-implicit-fallthrough", + "-Wno-ignored-qualifiers", + "-Wno-unused-variable", + ] + } + + deps = [ + "${spirv_tools_dir}:spvtools_opt", + ] +} diff --git a/3rdparty/bgfx/3rdparty/glslang/CMakeLists.txt b/3rdparty/bgfx/3rdparty/glslang/CMakeLists.txt index 0d453cc6efd..7dc35b01ae4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/CMakeLists.txt +++ b/3rdparty/bgfx/3rdparty/glslang/CMakeLists.txt @@ -9,10 +9,19 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Adhere to GNU filesystem layout conventions include(GNUInstallDirs) +option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) + +set(LIB_TYPE STATIC) + +if(BUILD_SHARED_LIBS) + set(LIB_TYPE SHARED) +endif() + option(SKIP_GLSLANG_INSTALL "Skip installation" ${SKIP_GLSLANG_INSTALL}) if(NOT ${SKIP_GLSLANG_INSTALL}) set(ENABLE_GLSLANG_INSTALL ON) endif() +option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON) option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON) option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON) @@ -27,6 +36,30 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32) set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE) endif() +option(USE_CCACHE "Use ccache" OFF) +if(USE_CCACHE) + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + endif(CCACHE_FOUND) +endif() + +# Precompiled header macro. Parameters are source file list and filename for pch cpp file. +macro(glslang_pch SRCS PCHCPP) + if(MSVC) + if (CMAKE_GENERATOR MATCHES "^Visual Studio") + set(PCH_NAME "$(IntDir)\\pch.pch") + else() + set(PCH_NAME "${CMAKE_CURRENT_BINARY_DIR}/pch.pch") + endif() + # make source files use/depend on PCH_NAME + set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}") + # make PCHCPP file compile and generate PCH_NAME + set_source_files_properties(${PCHCPP} PROPERTIES COMPILE_FLAGS "/Ycpch.h /Fp${PCH_NAME} /Zm300" OBJECT_OUTPUTS "${PCH_NAME}") + list(APPEND ${SRCS} "${PCHCPP}") + endif() +endmacro(glslang_pch) + project(glslang) # make testing optional include(CTest) @@ -44,7 +77,7 @@ if(ENABLE_HLSL) endif(ENABLE_HLSL) if(WIN32) - set(CMAKE_DEBUG_POSTFIX "d") + set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Adds a postfix for debug-built libraries.") if(MSVC) include(ChooseMSVCCRT.cmake) endif(MSVC) @@ -94,9 +127,12 @@ endif() if(ENABLE_OPT) message(STATUS "optimizer enabled") - add_definitions(-DENABLE_OPT) -elseif(ENABLE_HLSL) - message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL") + add_definitions(-DENABLE_OPT=1) +else() + if(ENABLE_HLSL) + message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL") + endif() + add_definitions(-DENABLE_OPT=0) endif() add_subdirectory(glslang) diff --git a/3rdparty/bgfx/3rdparty/glslang/CODE_OF_CONDUCT.md b/3rdparty/bgfx/3rdparty/glslang/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..a11610bd300 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/CODE_OF_CONDUCT.md @@ -0,0 +1 @@ +A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil. diff --git a/3rdparty/bgfx/3rdparty/glslang/README.md b/3rdparty/bgfx/3rdparty/glslang/README.md index 7ade2dcd972..ba7160da543 100644 --- a/3rdparty/bgfx/3rdparty/glslang/README.md +++ b/3rdparty/bgfx/3rdparty/glslang/README.md @@ -57,20 +57,23 @@ branch. ### Dependencies +* A C++11 compiler. + (For MSVS: 2015 is recommended, 2013 is fully supported/tested, and 2010 support is attempted, but not tested.) * [CMake][cmake]: for generating compilation targets. +* make: _Linux_, ninja is an alternative, if configured. * [Python 2.7][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools.) * [bison][bison]: _optional_, but needed when changing the grammar (glslang.y). * [googletest][googletest]: _optional_, but should use if making any changes to glslang. ### Build steps +The following steps assume a Bash shell. On Windows, that could be the Git Bash +shell or some other shell of your choosing. + #### 1) Check-Out this project ```bash cd -# If using SSH -git clone git@github.com:KhronosGroup/glslang.git -# Or if using HTTPS git clone https://github.com/KhronosGroup/glslang.git ``` @@ -81,6 +84,15 @@ cd git clone https://github.com/google/googletest.git External/googletest ``` +If you want to use googletest with Visual Studio 2013, you also need to check out an older version: + +```bash +# to use googletest with Visual Studio 2013 +cd External/googletest +git checkout 440527a61e1c91188195f7de212c63c77e8f0a45 +cd ../.. +``` + If you wish to assure that SPIR-V generated from HLSL is legal for Vulkan, or wish to invoke -Os to reduce SPIR-V size from HLSL or GLSL, install spirv-tools with this: @@ -89,28 +101,27 @@ spirv-tools with this: ./update_glslang_sources.py ``` -For running the CMake GUI or Visual Studio with python dependencies, you will, -in addition to python within the cygwin environment, need a Windows [python][python] -installation, including selecting the `PATH` update. - #### 3) Configure -Assume the source directory is `$SOURCE_DIR` and -the build directory is `$BUILD_DIR`: - -For building on Linux (assuming using the Ninja generator): +Assume the source directory is `$SOURCE_DIR` and the build directory is +`$BUILD_DIR`. First ensure the build directory exists, then navigate to it: ```bash +mkdir -p $BUILD_DIR cd $BUILD_DIR +``` -cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \ - -DCMAKE_INSTALL_PREFIX=`pwd`/install $SOURCE_DIR +For building on Linux: + +```bash +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE_DIR +# "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo" ``` For building on Windows: ```bash -cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX=`pwd`/install +cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install" # The CMAKE_INSTALL_PREFIX part is for testing (explained later). ``` @@ -120,11 +131,11 @@ The CMake GUI also works for Windows (version 3.4.1 tested). ```bash # for Linux: -ninja install +make -j4 install # for Windows: -cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} \ - --target install +cmake --build . --config Release --target install +# "Release" (for --config) could also be "Debug", "MinSizeRel", or "RelWithDebInfo" ``` If using MSVC, after running CMake to configure, use the @@ -239,8 +250,11 @@ bool InitializeProcess(); void FinalizeProcess(); class TShader + setStrings(...); + setEnvInput(EShSourceHlsl or EShSourceGlsl, stage, EShClientVulkan or EShClientOpenGL, 100); + setEnvClient(EShClientVulkan or EShClientOpenGL, EShTargetVulkan_1_0 or EShTargetVulkan_1_1 or EShTargetOpenGL_450); + setEnvTarget(EShTargetSpv, EShTargetSpv_1_0 or EShTargetSpv_1_3); bool parse(...); - void setStrings(...); const char* getInfoLog(); class TProgram diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/CMakeLists.txt b/3rdparty/bgfx/3rdparty/glslang/SPIRV/CMakeLists.txt index b1c02777961..1997e74c30a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/CMakeLists.txt +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/CMakeLists.txt @@ -3,7 +3,9 @@ set(SOURCES InReadableOrder.cpp Logger.cpp SpvBuilder.cpp + SpvPostProcess.cpp doc.cpp + SpvTools.cpp disassemble.cpp) set(SPVREMAP_SOURCES @@ -14,6 +16,7 @@ set(HEADERS bitutils.h spirv.hpp GLSL.std.450.h + GLSL.ext.EXT.h GLSL.ext.KHR.h GlslangToSpv.h hex_float.h @@ -21,6 +24,7 @@ set(HEADERS SpvBuilder.h spvIR.h doc.h + SpvTools.h disassemble.h) set(SPVREMAP_HEADERS @@ -39,20 +43,31 @@ if(ENABLE_NV_EXTENSIONS) GLSL.ext.NV.h) endif(ENABLE_NV_EXTENSIONS) -add_library(SPIRV STATIC ${SOURCES} ${HEADERS}) +add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS}) set_property(TARGET SPIRV PROPERTY FOLDER glslang) set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON) +target_include_directories(SPIRV PUBLIC ..) -add_library(SPVRemapper STATIC ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) -set_property(TARGET SPVRemapper PROPERTY FOLDER glslang) -set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON) +if (ENABLE_SPVREMAPPER) + add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) + set_property(TARGET SPVRemapper PROPERTY FOLDER glslang) + set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON) +endif() + +if(WIN32 AND BUILD_SHARED_LIBS) + set_target_properties(SPIRV PROPERTIES PREFIX "") + if (ENABLE_SPVREMAPPER) + set_target_properties(SPVRemapper PROPERTIES PREFIX "") + endif() +endif() if(ENABLE_OPT) target_include_directories(SPIRV PRIVATE ${spirv-tools_SOURCE_DIR}/include PRIVATE ${spirv-tools_SOURCE_DIR}/source ) - target_link_libraries(SPIRV glslang SPIRV-Tools-opt SPVRemapper) + target_link_libraries(SPIRV glslang SPIRV-Tools-opt) + target_include_directories(SPIRV PUBLIC ../External) else() target_link_libraries(SPIRV glslang) endif(ENABLE_OPT) @@ -63,8 +78,23 @@ if(WIN32) endif(WIN32) if(ENABLE_GLSLANG_INSTALL) - install(TARGETS SPIRV SPVRemapper - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if(BUILD_SHARED_LIBS) + if (ENABLE_SPVREMAPPER) + install(TARGETS SPVRemapper + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + install(TARGETS SPIRV + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + else() + if (ENABLE_SPVREMAPPER) + install(TARGETS SPVRemapper + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + install(TARGETS SPIRV + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/) endif(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h index 7e97be38fe7..009d2f1cf09 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h @@ -27,13 +27,8 @@ #ifndef GLSLextAMD_H #define GLSLextAMD_H -enum BuiltIn; -enum Capability; -enum Decoration; -enum Op; - static const int GLSLextAMDVersion = 100; -static const int GLSLextAMDRevision = 6; +static const int GLSLextAMDRevision = 7; // SPV_AMD_shader_ballot static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot"; @@ -104,14 +99,10 @@ static const char* const E_SPV_AMD_gpu_shader_int16 = "SPV_AMD_gpu_shader_int16" // SPV_AMD_shader_image_load_store_lod static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader_image_load_store_lod"; -static const Capability CapabilityImageReadWriteLodAMD = static_cast(5015); - // SPV_AMD_shader_fragment_mask static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask"; -static const Capability CapabilityFragmentMaskAMD = static_cast(5010); - -static const Op OpFragmentMaskFetchAMD = static_cast(5011); -static const Op OpFragmentFetchAMD = static_cast(5012); +// SPV_AMD_gpu_shader_half_float_fetch +static const char* const E_SPV_AMD_gpu_shader_half_float_fetch = "SPV_AMD_gpu_shader_half_float_fetch"; #endif // #ifndef GLSLextAMD_H diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h new file mode 100644 index 00000000000..e29c055b9a2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h @@ -0,0 +1,38 @@ +/* +** Copyright (c) 2014-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef GLSLextEXT_H +#define GLSLextEXT_H + +static const int GLSLextEXTVersion = 100; +static const int GLSLextEXTRevision = 2; + +static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export"; +static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer"; +static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered"; +static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density"; + +#endif // #ifndef GLSLextEXT_H diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h index 2eb10ae629a..16b0d9cf130 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h @@ -27,10 +27,6 @@ #ifndef GLSLextKHR_H #define GLSLextKHR_H -enum BuiltIn; -enum Op; -enum Capability; - static const int GLSLextKHRVersion = 100; static const int GLSLextKHRRevision = 2; @@ -40,9 +36,9 @@ static const char* const E_SPV_KHR_device_group = "SPV_KHR_devic static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview"; static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters"; static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage"; +static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_storage"; static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class"; static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage"; -static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export"; -static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer"; +static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model"; #endif // #ifndef GLSLextKHR_H diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h index c01858be416..102d645c0b0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GLSL.ext.NV.h @@ -33,7 +33,7 @@ enum Op; enum Capability; static const int GLSLextNVVersion = 100; -static const int GLSLextNVRevision = 5; +static const int GLSLextNVRevision = 11; //SPV_NV_sample_mask_override_coverage const char* const E_SPV_NV_sample_mask_override_coverage = "SPV_NV_sample_mask_override_coverage"; @@ -51,4 +51,25 @@ const char* const E_SPV_NV_stereo_view_rendering = "SPV_NV_stereo_view_rendering //SPV_NVX_multiview_per_view_attributes const char* const E_SPV_NVX_multiview_per_view_attributes = "SPV_NVX_multiview_per_view_attributes"; -#endif // #ifndef GLSLextNV_H \ No newline at end of file +//SPV_NV_shader_subgroup_partitioned +const char* const E_SPV_NV_shader_subgroup_partitioned = "SPV_NV_shader_subgroup_partitioned"; + +//SPV_NV_fragment_shader_barycentric +const char* const E_SPV_NV_fragment_shader_barycentric = "SPV_NV_fragment_shader_barycentric"; + +//SPV_NV_compute_shader_derivatives +const char* const E_SPV_NV_compute_shader_derivatives = "SPV_NV_compute_shader_derivatives"; + +//SPV_NV_shader_image_footprint +const char* const E_SPV_NV_shader_image_footprint = "SPV_NV_shader_image_footprint"; + +//SPV_NV_mesh_shader +const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader"; + +//SPV_NV_raytracing +const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing"; + +//SPV_NV_shading_rate +const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate"; + +#endif // #ifndef GLSLextNV_H diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index c23aa921863..4c1dbd4a53b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2014-2016 LunarG, Inc. // Copyright (C) 2015-2016 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -44,6 +45,7 @@ namespace spv { #include "GLSL.std.450.h" #include "GLSL.ext.KHR.h" + #include "GLSL.ext.EXT.h" #ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" #endif @@ -52,16 +54,6 @@ namespace spv { #endif } -#ifdef ENABLE_OPT - #include "spirv-tools/optimizer.hpp" - #include "message.h" - #include "SPVRemapper.h" -#endif - -#ifdef ENABLE_OPT -using namespace spvtools; -#endif - // Glslang includes #include "../glslang/MachineIndependent/localintermediate.h" #include "../glslang/MachineIndependent/SymbolTable.h" @@ -97,7 +89,14 @@ private: spv::Builder* builder_; bool previous_flag_; }; -} + +struct OpDecorations { + spv::Decoration precision; + spv::Decoration noContraction; + spv::Decoration nonUniform; +}; + +} // namespace // // The main holder of information for translating glslang to SPIR-V. @@ -106,7 +105,8 @@ private: // class TGlslangToSpvTraverser : public glslang::TIntermTraverser { public: - TGlslangToSpvTraverser(const glslang::TIntermediate*, spv::SpvBuildLogger* logger, glslang::SpvOptions& options); + TGlslangToSpvTraverser(unsigned int spvVersion, const glslang::TIntermediate*, spv::SpvBuildLogger* logger, + glslang::SpvOptions& options); virtual ~TGlslangToSpvTraverser() { } bool visitAggregate(glslang::TVisit, glslang::TIntermAggregate*); @@ -123,20 +123,31 @@ public: void dumpSpv(std::vector& out); protected: + TGlslangToSpvTraverser(TGlslangToSpvTraverser&); + TGlslangToSpvTraverser& operator=(TGlslangToSpvTraverser&); + spv::Decoration TranslateInterpolationDecoration(const glslang::TQualifier& qualifier); spv::Decoration TranslateAuxiliaryStorageDecoration(const glslang::TQualifier& qualifier); + spv::Decoration TranslateNonUniformDecoration(const glslang::TQualifier& qualifier); + spv::Builder::AccessChain::CoherentFlags TranslateCoherent(const glslang::TType& type); + spv::MemoryAccessMask TranslateMemoryAccess(const spv::Builder::AccessChain::CoherentFlags &coherentFlags); + spv::ImageOperandsMask TranslateImageOperands(const spv::Builder::AccessChain::CoherentFlags &coherentFlags); + spv::Scope TranslateMemoryScope(const spv::Builder::AccessChain::CoherentFlags &coherentFlags); spv::BuiltIn TranslateBuiltInDecoration(glslang::TBuiltInVariable, bool memberDeclaration); spv::ImageFormat TranslateImageFormat(const glslang::TType& type); - spv::SelectionControlMask TranslateSelectionControl(glslang::TSelectionControl) const; - spv::LoopControlMask TranslateLoopControl(glslang::TLoopControl) const; + spv::SelectionControlMask TranslateSelectionControl(const glslang::TIntermSelection&) const; + spv::SelectionControlMask TranslateSwitchControl(const glslang::TIntermSwitch&) const; + spv::LoopControlMask TranslateLoopControl(const glslang::TIntermLoop&, unsigned int& dependencyLength) const; spv::StorageClass TranslateStorageClass(const glslang::TType&); + void addIndirectionIndexCapabilities(const glslang::TType& baseType, const glslang::TType& indexType); spv::Id createSpvVariable(const glslang::TIntermSymbol*); spv::Id getSampledType(const glslang::TSampler&); spv::Id getInvertedSwizzleType(const glslang::TIntermTyped&); spv::Id createInvertedSwizzle(spv::Decoration precision, const glslang::TIntermTyped&, spv::Id parentResult); void convertSwizzle(const glslang::TIntermAggregate&, std::vector& swizzle); spv::Id convertGlslangToSpvType(const glslang::TType& type); - spv::Id convertGlslangToSpvType(const glslang::TType& type, glslang::TLayoutPacking, const glslang::TQualifier&); + spv::Id convertGlslangToSpvType(const glslang::TType& type, glslang::TLayoutPacking, const glslang::TQualifier&, + bool lastBufferBlockMember); bool filterMember(const glslang::TType& member); spv::Id convertGlslangStructToSpvType(const glslang::TType&, const glslang::TTypeList* glslangStruct, glslang::TLayoutPacking, const glslang::TQualifier&); @@ -149,11 +160,12 @@ protected: glslang::TLayoutPacking getExplicitLayout(const glslang::TType& type) const; int getArrayStride(const glslang::TType& arrayType, glslang::TLayoutPacking, glslang::TLayoutMatrix); int getMatrixStride(const glslang::TType& matrixType, glslang::TLayoutPacking, glslang::TLayoutMatrix); - void updateMemberOffset(const glslang::TType& structType, const glslang::TType& memberType, int& currentOffset, int& nextOffset, glslang::TLayoutPacking, glslang::TLayoutMatrix); + void updateMemberOffset(const glslang::TType& structType, const glslang::TType& memberType, int& currentOffset, + int& nextOffset, glslang::TLayoutPacking, glslang::TLayoutMatrix); void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember); bool isShaderEntryPoint(const glslang::TIntermAggregate* node); - bool writableParam(glslang::TStorageQualifier); + bool writableParam(glslang::TStorageQualifier) const; bool originalParam(glslang::TStorageQualifier, const glslang::TType&, bool implicitThisParam); void makeFunctions(const glslang::TIntermSequence&); void makeGlobalInitializers(const glslang::TIntermSequence&); @@ -164,28 +176,40 @@ protected: spv::Id createImageTextureFunctionCall(glslang::TIntermOperator* node); spv::Id handleUserFunctionCall(const glslang::TIntermAggregate*); - spv::Id createBinaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison = true); - spv::Id createBinaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right); - spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); - spv::Id createUnaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); - spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id destTypeId, spv::Id operand, glslang::TBasicType typeProxy); + spv::Id createBinaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id left, spv::Id right, + glslang::TBasicType typeProxy, bool reduceComparison = true); + spv::Id createBinaryMatrixOperation(spv::Op, OpDecorations&, spv::Id typeId, spv::Id left, spv::Id right); + spv::Id createUnaryOperation(glslang::TOperator op, OpDecorations&, spv::Id typeId, spv::Id operand, + glslang::TBasicType typeProxy); + spv::Id createUnaryMatrixOperation(spv::Op op, OpDecorations&, spv::Id typeId, spv::Id operand, + glslang::TBasicType typeProxy); + spv::Id createConversion(glslang::TOperator op, OpDecorations&, spv::Id destTypeId, spv::Id operand, + glslang::TBasicType typeProxy); + spv::Id createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); spv::Id createAtomicOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); spv::Id createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); spv::Id CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, spv::Id typeId, std::vector& operands); + spv::Id createSubgroupOperation(glslang::TOperator op, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); spv::Id createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy); spv::Id createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId); spv::Id getSymbolId(const glslang::TIntermSymbol* node); - void addDecoration(spv::Id id, spv::Decoration dec); - void addDecoration(spv::Id id, spv::Decoration dec, unsigned value); - void addMemberDecoration(spv::Id id, int member, spv::Decoration dec); - void addMemberDecoration(spv::Id id, int member, spv::Decoration dec, unsigned value); +#ifdef NV_EXTENSIONS + void addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier & qualifier); +#endif spv::Id createSpvConstant(const glslang::TIntermTyped&); spv::Id createSpvConstantFromConstUnionArray(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst, bool specConstant); bool isTrivialLeaf(const glslang::TIntermTyped* node); bool isTrivial(const glslang::TIntermTyped* node); spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped& right); +#ifdef AMD_EXTENSIONS spv::Id getExtBuiltins(const char* name); +#endif + void addPre13Extension(const char* ext) + { + if (builder.getSpvVersion() < glslang::EShTargetSpv_1_3) + builder.addExtension(ext); + } glslang::SpvOptions& options; spv::Function* shaderEntry; @@ -209,8 +233,10 @@ protected: std::unordered_set rValueParameters; // set of formal function parameters passed as rValues, rather than a pointer std::unordered_map functionMap; std::unordered_map structMap[glslang::ElpCount][glslang::ElmCount]; - std::unordered_map > memberRemapper; // for mapping glslang block indices to spv indices (e.g., due to hidden members) + // for mapping glslang block indices to spv indices (e.g., due to hidden members): + std::unordered_map > memberRemapper; std::stack breakForLoop; // false means break for switch + std::unordered_map counterOriginator; }; // @@ -249,6 +275,16 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage) case EShLangGeometry: return spv::ExecutionModelGeometry; case EShLangFragment: return spv::ExecutionModelFragment; case EShLangCompute: return spv::ExecutionModelGLCompute; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: return spv::ExecutionModelRayGenerationNV; + case EShLangIntersectNV: return spv::ExecutionModelIntersectionNV; + case EShLangAnyHitNV: return spv::ExecutionModelAnyHitNV; + case EShLangClosestHitNV: return spv::ExecutionModelClosestHitNV; + case EShLangMissNV: return spv::ExecutionModelMissNV; + case EShLangCallableNV: return spv::ExecutionModelCallableNV; + case EShLangTaskNV: return spv::ExecutionModelTaskNV; + case EShLangMeshNV: return spv::ExecutionModelMeshNV; +#endif default: assert(0); return spv::ExecutionModelFragment; @@ -298,6 +334,13 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto case glslang::EvqBuffer: return useStorageBuffer ? spv::DecorationBlock : spv::DecorationBufferBlock; case glslang::EvqVaryingIn: return spv::DecorationBlock; case glslang::EvqVaryingOut: return spv::DecorationBlock; +#ifdef NV_EXTENSIONS + case glslang::EvqPayloadNV: return spv::DecorationBlock; + case glslang::EvqPayloadInNV: return spv::DecorationBlock; + case glslang::EvqHitAttrNV: return spv::DecorationBlock; + case glslang::EvqCallableDataNV: return spv::DecorationBlock; + case glslang::EvqCallableDataInNV: return spv::DecorationBlock; +#endif default: assert(0); break; @@ -308,12 +351,16 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type, bool useSto } // Translate glslang type to SPIR-V memory decorations. -void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector& memory) +void TranslateMemoryDecoration(const glslang::TQualifier& qualifier, std::vector& memory, bool useVulkanMemoryModel) { - if (qualifier.coherent) - memory.push_back(spv::DecorationCoherent); - if (qualifier.volatil) - memory.push_back(spv::DecorationVolatile); + if (!useVulkanMemoryModel) { + if (qualifier.coherent) + memory.push_back(spv::DecorationCoherent); + if (qualifier.volatil) { + memory.push_back(spv::DecorationVolatile); + memory.push_back(spv::DecorationCoherent); + } + } if (qualifier.restrict) memory.push_back(spv::DecorationRestrict); if (qualifier.readonly) @@ -352,8 +399,24 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type, glslang::T } case glslang::EvqVaryingIn: case glslang::EvqVaryingOut: - assert(type.getQualifier().layoutPacking == glslang::ElpNone); + if (type.getQualifier().isTaskMemory()) { + switch (type.getQualifier().layoutPacking) { + case glslang::ElpShared: return spv::DecorationGLSLShared; + case glslang::ElpPacked: return spv::DecorationGLSLPacked; + default: break; + } + } else { + assert(type.getQualifier().layoutPacking == glslang::ElpNone); + } return spv::DecorationMax; +#ifdef NV_EXTENSIONS + case glslang::EvqPayloadNV: + case glslang::EvqPayloadInNV: + case glslang::EvqHitAttrNV: + case glslang::EvqCallableDataNV: + case glslang::EvqCallableDataInNV: + return spv::DecorationMax; +#endif default: assert(0); return spv::DecorationMax; @@ -418,6 +481,116 @@ spv::Decoration TranslateNoContractionDecoration(const glslang::TQualifier& qual return spv::DecorationMax; } +// If glslang type is nonUniform, return SPIR-V NonUniform decoration. +spv::Decoration TGlslangToSpvTraverser::TranslateNonUniformDecoration(const glslang::TQualifier& qualifier) +{ + if (qualifier.isNonUniform()) { + builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addCapability(spv::CapabilityShaderNonUniformEXT); + return spv::DecorationNonUniformEXT; + } else + return spv::DecorationMax; +} + +spv::MemoryAccessMask TGlslangToSpvTraverser::TranslateMemoryAccess(const spv::Builder::AccessChain::CoherentFlags &coherentFlags) +{ + if (!glslangIntermediate->usingVulkanMemoryModel() || coherentFlags.isImage) { + return spv::MemoryAccessMaskNone; + } + spv::MemoryAccessMask mask = spv::MemoryAccessMaskNone; + if (coherentFlags.volatil || + coherentFlags.coherent || + coherentFlags.devicecoherent || + coherentFlags.queuefamilycoherent || + coherentFlags.workgroupcoherent || + coherentFlags.subgroupcoherent) { + mask = mask | spv::MemoryAccessMakePointerAvailableKHRMask | + spv::MemoryAccessMakePointerVisibleKHRMask; + } + if (coherentFlags.nonprivate) { + mask = mask | spv::MemoryAccessNonPrivatePointerKHRMask; + } + if (coherentFlags.volatil) { + mask = mask | spv::MemoryAccessVolatileMask; + } + if (mask != spv::MemoryAccessMaskNone) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } + return mask; +} + +spv::ImageOperandsMask TGlslangToSpvTraverser::TranslateImageOperands(const spv::Builder::AccessChain::CoherentFlags &coherentFlags) +{ + if (!glslangIntermediate->usingVulkanMemoryModel()) { + return spv::ImageOperandsMaskNone; + } + spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; + if (coherentFlags.volatil || + coherentFlags.coherent || + coherentFlags.devicecoherent || + coherentFlags.queuefamilycoherent || + coherentFlags.workgroupcoherent || + coherentFlags.subgroupcoherent) { + mask = mask | spv::ImageOperandsMakeTexelAvailableKHRMask | + spv::ImageOperandsMakeTexelVisibleKHRMask; + } + if (coherentFlags.nonprivate) { + mask = mask | spv::ImageOperandsNonPrivateTexelKHRMask; + } + if (coherentFlags.volatil) { + mask = mask | spv::ImageOperandsVolatileTexelKHRMask; + } + if (mask != spv::ImageOperandsMaskNone) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } + return mask; +} + +spv::Builder::AccessChain::CoherentFlags TGlslangToSpvTraverser::TranslateCoherent(const glslang::TType& type) +{ + spv::Builder::AccessChain::CoherentFlags flags; + flags.coherent = type.getQualifier().coherent; + flags.devicecoherent = type.getQualifier().devicecoherent; + flags.queuefamilycoherent = type.getQualifier().queuefamilycoherent; + // shared variables are implicitly workgroupcoherent in GLSL. + flags.workgroupcoherent = type.getQualifier().workgroupcoherent || + type.getQualifier().storage == glslang::EvqShared; + flags.subgroupcoherent = type.getQualifier().subgroupcoherent; + // *coherent variables are implicitly nonprivate in GLSL + flags.nonprivate = type.getQualifier().nonprivate || + flags.subgroupcoherent || + flags.workgroupcoherent || + flags.queuefamilycoherent || + flags.devicecoherent || + flags.coherent; + flags.volatil = type.getQualifier().volatil; + flags.isImage = type.getBasicType() == glslang::EbtSampler; + return flags; +} + +spv::Scope TGlslangToSpvTraverser::TranslateMemoryScope(const spv::Builder::AccessChain::CoherentFlags &coherentFlags) +{ + spv::Scope scope; + if (coherentFlags.coherent) { + // coherent defaults to Device scope in the old model, QueueFamilyKHR scope in the new model + scope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice; + } else if (coherentFlags.devicecoherent) { + scope = spv::ScopeDevice; + } else if (coherentFlags.queuefamilycoherent) { + scope = spv::ScopeQueueFamilyKHR; + } else if (coherentFlags.workgroupcoherent) { + scope = spv::ScopeWorkgroup; + } else if (coherentFlags.subgroupcoherent) { + scope = spv::ScopeSubgroup; + } else { + scope = spv::ScopeMax; + } + if (glslangIntermediate->usingVulkanMemoryModel() && scope == spv::ScopeDevice) { + builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); + } + return scope; +} + // Translate a glslang built-in variable to a SPIR-V built in decoration. Also generate // associated capabilities when required. For some built-in variables, a capability // is generated only when using the variable in an executable instruction, but not when @@ -482,6 +655,11 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI return spv::BuiltInSampleMask; case glslang::EbvLayer: +#ifdef NV_EXTENSIONS + if (glslangIntermediate->getStage() == EShLangMeshNV) { + return spv::BuiltInLayer; + } +#endif builder.addCapability(spv::CapabilityGeometry); if (glslangIntermediate->getStage() == EShLangVertex || glslangIntermediate->getStage() == EShLangTessControl || @@ -499,17 +677,17 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex; case glslang::EbvBaseVertex: - builder.addExtension(spv::E_SPV_KHR_shader_draw_parameters); + addPre13Extension(spv::E_SPV_KHR_shader_draw_parameters); builder.addCapability(spv::CapabilityDrawParameters); return spv::BuiltInBaseVertex; case glslang::EbvBaseInstance: - builder.addExtension(spv::E_SPV_KHR_shader_draw_parameters); + addPre13Extension(spv::E_SPV_KHR_shader_draw_parameters); builder.addCapability(spv::CapabilityDrawParameters); return spv::BuiltInBaseInstance; case glslang::EbvDrawId: - builder.addExtension(spv::E_SPV_KHR_shader_draw_parameters); + addPre13Extension(spv::E_SPV_KHR_shader_draw_parameters); builder.addCapability(spv::CapabilityDrawParameters); return spv::BuiltInDrawIndex; @@ -575,6 +753,46 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilitySubgroupBallotKHR); return spv::BuiltInSubgroupLtMaskKHR; + case glslang::EbvNumSubgroups: + builder.addCapability(spv::CapabilityGroupNonUniform); + return spv::BuiltInNumSubgroups; + + case glslang::EbvSubgroupID: + builder.addCapability(spv::CapabilityGroupNonUniform); + return spv::BuiltInSubgroupId; + + case glslang::EbvSubgroupSize2: + builder.addCapability(spv::CapabilityGroupNonUniform); + return spv::BuiltInSubgroupSize; + + case glslang::EbvSubgroupInvocation2: + builder.addCapability(spv::CapabilityGroupNonUniform); + return spv::BuiltInSubgroupLocalInvocationId; + + case glslang::EbvSubgroupEqMask2: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformBallot); + return spv::BuiltInSubgroupEqMask; + + case glslang::EbvSubgroupGeMask2: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformBallot); + return spv::BuiltInSubgroupGeMask; + + case glslang::EbvSubgroupGtMask2: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformBallot); + return spv::BuiltInSubgroupGtMask; + + case glslang::EbvSubgroupLeMask2: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformBallot); + return spv::BuiltInSubgroupLeMask; + + case glslang::EbvSubgroupLtMask2: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformBallot); + return spv::BuiltInSubgroupLtMask; #ifdef AMD_EXTENSIONS case glslang::EbvBaryCoordNoPersp: builder.addExtension(spv::E_SPV_AMD_shader_explicit_vertex_parameter); @@ -606,15 +824,25 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI #endif case glslang::EbvDeviceIndex: - builder.addExtension(spv::E_SPV_KHR_device_group); + addPre13Extension(spv::E_SPV_KHR_device_group); builder.addCapability(spv::CapabilityDeviceGroup); return spv::BuiltInDeviceIndex; case glslang::EbvViewIndex: - builder.addExtension(spv::E_SPV_KHR_multiview); + addPre13Extension(spv::E_SPV_KHR_multiview); builder.addCapability(spv::CapabilityMultiView); return spv::BuiltInViewIndex; + case glslang::EbvFragSizeEXT: + builder.addExtension(spv::E_SPV_EXT_fragment_invocation_density); + builder.addCapability(spv::CapabilityFragmentDensityEXT); + return spv::BuiltInFragSizeEXT; + + case glslang::EbvFragInvocationCountEXT: + builder.addExtension(spv::E_SPV_EXT_fragment_invocation_density); + builder.addCapability(spv::CapabilityFragmentDensityEXT); + return spv::BuiltInFragInvocationCountEXT; + #ifdef NV_EXTENSIONS case glslang::EbvViewportMaskNV: if (!memberDeclaration) { @@ -646,6 +874,72 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilityPerViewAttributesNV); } return spv::BuiltInViewportMaskPerViewNV; + case glslang::EbvFragFullyCoveredNV: + builder.addExtension(spv::E_SPV_EXT_fragment_fully_covered); + builder.addCapability(spv::CapabilityFragmentFullyCoveredEXT); + return spv::BuiltInFullyCoveredEXT; + case glslang::EbvFragmentSizeNV: + builder.addExtension(spv::E_SPV_NV_shading_rate); + builder.addCapability(spv::CapabilityShadingRateNV); + return spv::BuiltInFragmentSizeNV; + case glslang::EbvInvocationsPerPixelNV: + builder.addExtension(spv::E_SPV_NV_shading_rate); + builder.addCapability(spv::CapabilityShadingRateNV); + return spv::BuiltInInvocationsPerPixelNV; + + // raytracing + case glslang::EbvLaunchIdNV: + return spv::BuiltInLaunchIdNV; + case glslang::EbvLaunchSizeNV: + return spv::BuiltInLaunchSizeNV; + case glslang::EbvWorldRayOriginNV: + return spv::BuiltInWorldRayOriginNV; + case glslang::EbvWorldRayDirectionNV: + return spv::BuiltInWorldRayDirectionNV; + case glslang::EbvObjectRayOriginNV: + return spv::BuiltInObjectRayOriginNV; + case glslang::EbvObjectRayDirectionNV: + return spv::BuiltInObjectRayDirectionNV; + case glslang::EbvRayTminNV: + return spv::BuiltInRayTminNV; + case glslang::EbvRayTmaxNV: + return spv::BuiltInRayTmaxNV; + case glslang::EbvInstanceCustomIndexNV: + return spv::BuiltInInstanceCustomIndexNV; + case glslang::EbvHitTNV: + return spv::BuiltInHitTNV; + case glslang::EbvHitKindNV: + return spv::BuiltInHitKindNV; + case glslang::EbvObjectToWorldNV: + return spv::BuiltInObjectToWorldNV; + case glslang::EbvWorldToObjectNV: + return spv::BuiltInWorldToObjectNV; + case glslang::EbvIncomingRayFlagsNV: + return spv::BuiltInIncomingRayFlagsNV; + case glslang::EbvBaryCoordNV: + builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric); + builder.addCapability(spv::CapabilityFragmentBarycentricNV); + return spv::BuiltInBaryCoordNV; + case glslang::EbvBaryCoordNoPerspNV: + builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric); + builder.addCapability(spv::CapabilityFragmentBarycentricNV); + return spv::BuiltInBaryCoordNoPerspNV; + case glslang::EbvTaskCountNV: + return spv::BuiltInTaskCountNV; + case glslang::EbvPrimitiveCountNV: + return spv::BuiltInPrimitiveCountNV; + case glslang::EbvPrimitiveIndicesNV: + return spv::BuiltInPrimitiveIndicesNV; + case glslang::EbvClipDistancePerViewNV: + return spv::BuiltInClipDistancePerViewNV; + case glslang::EbvCullDistancePerViewNV: + return spv::BuiltInCullDistancePerViewNV; + case glslang::EbvLayerPerViewNV: + return spv::BuiltInLayerPerViewNV; + case glslang::EbvMeshViewCountNV: + return spv::BuiltInMeshViewCountNV; + case glslang::EbvMeshViewIndicesNV: + return spv::BuiltInMeshViewIndicesNV; #endif default: return spv::BuiltInMax; @@ -740,26 +1034,42 @@ spv::ImageFormat TGlslangToSpvTraverser::TranslateImageFormat(const glslang::TTy } } -spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSelectionControl(glslang::TSelectionControl selectionControl) const +spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSelectionControl(const glslang::TIntermSelection& selectionNode) const { - switch (selectionControl) { - case glslang::ESelectionControlNone: return spv::SelectionControlMaskNone; - case glslang::ESelectionControlFlatten: return spv::SelectionControlFlattenMask; - case glslang::ESelectionControlDontFlatten: return spv::SelectionControlDontFlattenMask; - default: return spv::SelectionControlMaskNone; - } + if (selectionNode.getFlatten()) + return spv::SelectionControlFlattenMask; + if (selectionNode.getDontFlatten()) + return spv::SelectionControlDontFlattenMask; + return spv::SelectionControlMaskNone; } -spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(glslang::TLoopControl loopControl) const +spv::SelectionControlMask TGlslangToSpvTraverser::TranslateSwitchControl(const glslang::TIntermSwitch& switchNode) const { - switch (loopControl) { - case glslang::ELoopControlNone: return spv::LoopControlMaskNone; - case glslang::ELoopControlUnroll: return spv::LoopControlUnrollMask; - case glslang::ELoopControlDontUnroll: return spv::LoopControlDontUnrollMask; - // TODO: DependencyInfinite - // TODO: DependencyLength - default: return spv::LoopControlMaskNone; + if (switchNode.getFlatten()) + return spv::SelectionControlFlattenMask; + if (switchNode.getDontFlatten()) + return spv::SelectionControlDontFlattenMask; + return spv::SelectionControlMaskNone; +} + +// return a non-0 dependency if the dependency argument must be set +spv::LoopControlMask TGlslangToSpvTraverser::TranslateLoopControl(const glslang::TIntermLoop& loopNode, + unsigned int& dependencyLength) const +{ + spv::LoopControlMask control = spv::LoopControlMaskNone; + + if (loopNode.getDontUnroll()) + control = control | spv::LoopControlDontUnrollMask; + if (loopNode.getUnroll()) + control = control | spv::LoopControlUnrollMask; + if (unsigned(loopNode.getLoopDependency()) == glslang::TIntermLoop::dependencyInfinite) + control = control | spv::LoopControlDependencyInfiniteMask; + else if (loopNode.getLoopDependency() > 0) { + control = control | spv::LoopControlDependencyLengthMask; + dependencyLength = loopNode.getLoopDependency(); } + + return control; } // Translate glslang type to SPIR-V storage class. @@ -779,13 +1089,17 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T } if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer) { - builder.addExtension(spv::E_SPV_KHR_storage_buffer_storage_class); + addPre13Extension(spv::E_SPV_KHR_storage_buffer_storage_class); return spv::StorageClassStorageBuffer; } if (type.getQualifier().isUniformOrBuffer()) { if (type.getQualifier().layoutPushConstant) return spv::StorageClassPushConstant; +#ifdef NV_EXTENSIONS + if (type.getQualifier().layoutShaderRecordNV) + return spv::StorageClassShaderRecordBufferNV; +#endif if (type.getBasicType() == glslang::EbtBlock) return spv::StorageClassUniform; return spv::StorageClassUniformConstant; @@ -796,6 +1110,13 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T case glslang::EvqGlobal: return spv::StorageClassPrivate; case glslang::EvqConstReadOnly: return spv::StorageClassFunction; case glslang::EvqTemporary: return spv::StorageClassFunction; +#ifdef NV_EXTENSIONS + case glslang::EvqPayloadNV: return spv::StorageClassRayPayloadNV; + case glslang::EvqPayloadInNV: return spv::StorageClassIncomingRayPayloadNV; + case glslang::EvqHitAttrNV: return spv::StorageClassHitAttributeNV; + case glslang::EvqCallableDataNV: return spv::StorageClassCallableDataNV; + case glslang::EvqCallableDataInNV: return spv::StorageClassIncomingCallableDataNV; +#endif default: assert(0); break; @@ -804,13 +1125,58 @@ spv::StorageClass TGlslangToSpvTraverser::TranslateStorageClass(const glslang::T return spv::StorageClassFunction; } +// Add capabilities pertaining to how an array is indexed. +void TGlslangToSpvTraverser::addIndirectionIndexCapabilities(const glslang::TType& baseType, + const glslang::TType& indexType) +{ + if (indexType.getQualifier().isNonUniform()) { + // deal with an asserted non-uniform index + // SPV_EXT_descriptor_indexing already added in TranslateNonUniformDecoration + if (baseType.getBasicType() == glslang::EbtSampler) { + if (baseType.getQualifier().hasAttachment()) + builder.addCapability(spv::CapabilityInputAttachmentArrayNonUniformIndexingEXT); + else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) + builder.addCapability(spv::CapabilityStorageTexelBufferArrayNonUniformIndexingEXT); + else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) + builder.addCapability(spv::CapabilityUniformTexelBufferArrayNonUniformIndexingEXT); + else if (baseType.isImage()) + builder.addCapability(spv::CapabilityStorageImageArrayNonUniformIndexingEXT); + else if (baseType.isTexture()) + builder.addCapability(spv::CapabilitySampledImageArrayNonUniformIndexingEXT); + } else if (baseType.getBasicType() == glslang::EbtBlock) { + if (baseType.getQualifier().storage == glslang::EvqBuffer) + builder.addCapability(spv::CapabilityStorageBufferArrayNonUniformIndexingEXT); + else if (baseType.getQualifier().storage == glslang::EvqUniform) + builder.addCapability(spv::CapabilityUniformBufferArrayNonUniformIndexingEXT); + } + } else { + // assume a dynamically uniform index + if (baseType.getBasicType() == glslang::EbtSampler) { + if (baseType.getQualifier().hasAttachment()) { + builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addCapability(spv::CapabilityInputAttachmentArrayDynamicIndexingEXT); + } else if (baseType.isImage() && baseType.getSampler().dim == glslang::EsdBuffer) { + builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addCapability(spv::CapabilityStorageTexelBufferArrayDynamicIndexingEXT); + } else if (baseType.isTexture() && baseType.getSampler().dim == glslang::EsdBuffer) { + builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addCapability(spv::CapabilityUniformTexelBufferArrayDynamicIndexingEXT); + } + } + } +} + // Return whether or not the given type is something that should be tied to a // descriptor set. bool IsDescriptorResource(const glslang::TType& type) { // uniform and buffer blocks are included, unless it is a push_constant if (type.getBasicType() == glslang::EbtBlock) - return type.getQualifier().isUniformOrBuffer() && ! type.getQualifier().layoutPushConstant; + return type.getQualifier().isUniformOrBuffer() && +#ifdef NV_EXTENSIONS + ! type.getQualifier().layoutShaderRecordNV && +#endif + ! type.getQualifier().layoutPushConstant; // non block... // basically samplerXXX/subpass/sampler/texture are all included @@ -846,6 +1212,16 @@ void InheritQualifiers(glslang::TQualifier& child, const glslang::TQualifier& pa child.sample = true; if (parent.coherent) child.coherent = true; + if (parent.devicecoherent) + child.devicecoherent = true; + if (parent.queuefamilycoherent) + child.queuefamilycoherent = true; + if (parent.workgroupcoherent) + child.workgroupcoherent = true; + if (parent.subgroupcoherent) + child.subgroupcoherent = true; + if (parent.nonprivate) + child.nonprivate = true; if (parent.volatil) child.volatil = true; if (parent.restrict) @@ -854,6 +1230,14 @@ void InheritQualifiers(glslang::TQualifier& child, const glslang::TQualifier& pa child.readonly = true; if (parent.writeonly) child.writeonly = true; +#ifdef NV_EXTENSIONS + if (parent.perPrimitiveNV) + child.perPrimitiveNV = true; + if (parent.perViewNV) + child.perViewNV = true; + if (parent.perTaskNV) + child.perTaskNV = true; +#endif } bool HasNonLayoutQualifiers(const glslang::TType& type, const glslang::TQualifier& qualifier) @@ -873,13 +1257,13 @@ bool HasNonLayoutQualifiers(const glslang::TType& type, const glslang::TQualifie // Implement the TGlslangToSpvTraverser class. // -TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* glslangIntermediate, +TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const glslang::TIntermediate* glslangIntermediate, spv::SpvBuildLogger* buildLogger, glslang::SpvOptions& options) : TIntermTraverser(true, false, true), options(options), shaderEntry(nullptr), currentFunction(nullptr), sequenceDepth(0), logger(buildLogger), - builder((glslang::GetKhronosToolId() << 16) | glslang::GetSpirvGeneratorVersion(), logger), + builder(spvVersion, (glslang::GetKhronosToolId() << 16) | glslang::GetSpirvGeneratorVersion(), logger), inEntryPoint(false), entryPointTerminated(false), linkageOnly(false), glslangIntermediate(glslangIntermediate) { @@ -899,20 +1283,25 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls std::string text; const std::vector& processes = glslangIntermediate->getProcesses(); for (int p = 0; p < (int)processes.size(); ++p) { - if (glslangIntermediate->getSpv().spv < 0x00010100) { + if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_1) { text.append("// OpModuleProcessed "); text.append(processes[p]); text.append("\n"); } else builder.addModuleProcessed(processes[p]); } - if (glslangIntermediate->getSpv().spv < 0x00010100 && (int)processes.size() > 0) + if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_1 && (int)processes.size() > 0) text.append("#line 1\n"); text.append(glslangIntermediate->getSourceText()); builder.setSourceText(text); } stdBuiltins = builder.import("GLSL.std.450"); - builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450); + if (glslangIntermediate->usingVulkanMemoryModel()) { + builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelVulkanKHR); + builder.addExtension(spv::E_SPV_KHR_vulkan_memory_model); + } else { + builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450); + } shaderEntry = builder.makeEntryPoint(glslangIntermediate->getEntryPointName().c_str()); entryPoint = builder.addEntryPoint(executionModel, shaderEntry, glslangIntermediate->getEntryPointName().c_str()); @@ -1039,8 +1428,52 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0), glslangIntermediate->getLocalSize(1), glslangIntermediate->getLocalSize(2)); +#ifdef NV_EXTENSIONS + if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) { + builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV); + builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); + } else if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupLinear) { + builder.addCapability(spv::CapabilityComputeDerivativeGroupLinearNV); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupLinearNV); + builder.addExtension(spv::E_SPV_NV_compute_shader_derivatives); + } +#endif break; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: + case EShLangIntersectNV: + case EShLangAnyHitNV: + case EShLangClosestHitNV: + case EShLangMissNV: + case EShLangCallableNV: + builder.addCapability(spv::CapabilityRayTracingNV); + builder.addExtension("SPV_NV_ray_tracing"); + break; + case EShLangTaskNV: + case EShLangMeshNV: + builder.addCapability(spv::CapabilityMeshShadingNV); + builder.addExtension(spv::E_SPV_NV_mesh_shader); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0), + glslangIntermediate->getLocalSize(1), + glslangIntermediate->getLocalSize(2)); + if (glslangIntermediate->getStage() == EShLangMeshNV) { + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices()); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputPrimitivesNV, glslangIntermediate->getPrimitives()); + + switch (glslangIntermediate->getOutputPrimitive()) { + case glslang::ElgPoints: mode = spv::ExecutionModeOutputPoints; break; + case glslang::ElgLines: mode = spv::ExecutionModeOutputLinesNV; break; + case glslang::ElgTriangles: mode = spv::ExecutionModeOutputTrianglesNV; break; + default: mode = spv::ExecutionModeMax; break; + } + if (mode != spv::ExecutionModeMax) + builder.addExecutionMode(shaderEntry, (spv::ExecutionMode)mode); + } + break; +#endif + default: break; } @@ -1049,6 +1482,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls // Finish creating SPV, after the traversal is complete. void TGlslangToSpvTraverser::finishSpv() { + // Finish the entry point function if (! entryPointTerminated) { builder.setBuildPoint(shaderEntry->getLastBlock()); builder.leaveFunction(); @@ -1058,7 +1492,9 @@ void TGlslangToSpvTraverser::finishSpv() for (auto it = iOSet.cbegin(); it != iOSet.cend(); ++it) entryPoint->addIdOperand(*it); - builder.eliminateDeadDecorations(); + // Add capabilities, extensions, remove unneeded decorations, etc., + // based on the resulting SPIR-V. + builder.postProcess(); } // Write the SPV into 'out'. @@ -1122,6 +1558,38 @@ void TGlslangToSpvTraverser::visitSymbol(glslang::TIntermSymbol* symbol) else builder.setAccessChainLValue(id); } + + // Process linkage-only nodes for any special additional interface work. + if (linkageOnly) { + if (glslangIntermediate->getHlslFunctionality1()) { + // Map implicit counter buffers to their originating buffers, which should have been + // seen by now, given earlier pruning of unused counters, and preservation of order + // of declaration. + if (symbol->getType().getQualifier().isUniformOrBuffer()) { + if (!glslangIntermediate->hasCounterBufferName(symbol->getName())) { + // Save possible originating buffers for counter buffers, keyed by + // making the potential counter-buffer name. + std::string keyName = symbol->getName().c_str(); + keyName = glslangIntermediate->addCounterBufferName(keyName); + counterOriginator[keyName] = symbol; + } else { + // Handle a counter buffer, by finding the saved originating buffer. + std::string keyName = symbol->getName().c_str(); + auto it = counterOriginator.find(keyName); + if (it != counterOriginator.end()) { + id = getSymbolId(it->second); + if (id != spv::NoResult) { + spv::Id counterId = getSymbolId(symbol); + if (counterId != spv::NoResult) { + builder.addExtension("SPV_GOOGLE_hlsl_functionality1"); + builder.addDecorationId(id, spv::DecorationHlslCounterBufferGOOGLE, counterId); + } + } + } + } + } + } + } } bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::TIntermBinary* node) @@ -1170,8 +1638,10 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T spv::Id leftRValue = accessChainLoad(node->getLeft()->getType()); // do the operation - rValue = createBinaryOperation(node->getOp(), TranslatePrecisionDecoration(node->getOperationPrecision()), - TranslateNoContractionDecoration(node->getType().getQualifier()), + OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()), + TranslateNoContractionDecoration(node->getType().getQualifier()), + TranslateNonUniformDecoration(node->getType().getQualifier()) }; + rValue = createBinaryOperation(node->getOp(), decorations, convertGlslangToSpvType(node->getType()), leftRValue, rValue, node->getType().getBasicType()); @@ -1181,7 +1651,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T // store the result builder.setAccessChain(lValue); - multiTypeStore(node->getType(), rValue); + multiTypeStore(node->getLeft()->getType(), rValue); // assignments are expressions having an rValue after they are evaluated... builder.clearAccessChain(); @@ -1218,7 +1688,7 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T } // normal case for indexing array or structure or block - builder.accessChainPush(builder.makeIntConstant(spvIndex)); + builder.accessChainPush(builder.makeIntConstant(spvIndex), TranslateCoherent(node->getLeft()->getType())); // Add capabilities here for accessing PointSize and clip/cull distance. // We have deferred generation of associated capabilities until now. @@ -1246,13 +1716,15 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T node->getRight()->traverse(this); spv::Id index = accessChainLoad(node->getRight()->getType()); + addIndirectionIndexCapabilities(node->getLeft()->getType(), node->getRight()->getType()); + // restore the saved access chain builder.setAccessChain(partial); if (! node->getLeft()->getType().isArray() && node->getLeft()->getType().isVector()) builder.accessChainPushComponent(index, convertGlslangToSpvType(node->getLeft()->getType())); else - builder.accessChainPush(index); + builder.accessChainPush(index, TranslateCoherent(node->getLeft()->getType())); } return false; case glslang::EOpVectorSwizzle: @@ -1298,8 +1770,10 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T spv::Id right = accessChainLoad(node->getRight()->getType()); // get result - spv::Id result = createBinaryOperation(node->getOp(), TranslatePrecisionDecoration(node->getOperationPrecision()), - TranslateNoContractionDecoration(node->getType().getQualifier()), + OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()), + TranslateNoContractionDecoration(node->getType().getQualifier()), + TranslateNonUniformDecoration(node->getType().getQualifier()) }; + spv::Id result = createBinaryOperation(node->getOp(), decorations, convertGlslangToSpvType(node->getType()), left, right, node->getLeft()->getType().getBasicType()); @@ -1337,15 +1811,26 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI if (node->getOp() == glslang::EOpArrayLength) { // Quite special; won't want to evaluate the operand. + // Currently, the front-end does not allow .length() on an array until it is sized, + // except for the last block membeor of an SSBO. + // TODO: If this changes, link-time sized arrays might show up here, and need their + // size extracted. + // Normal .length() would have been constant folded by the front-end. // So, this has to be block.lastMember.length(). // SPV wants "block" and member number as the operands, go get them. - assert(node->getOperand()->getType().isRuntimeSizedArray()); + glslang::TIntermTyped* block = node->getOperand()->getAsBinaryNode()->getLeft(); block->traverse(this); unsigned int member = node->getOperand()->getAsBinaryNode()->getRight()->getAsConstantUnion()->getConstArray()[0].getUConst(); spv::Id length = builder.createArrayLength(builder.accessChainGetLValue(), member); + // GLSL semantics say the result of .length() is an int, while SPIR-V says + // signedness must be 0. So, convert from SPIR-V unsigned back to GLSL's + // AST expectation of a signed result. + if (glslangIntermediate->getSource() == glslang::EShSourceGlsl) + length = builder.createUnaryOp(spv::OpBitcast, builder.makeIntType(32), length); + builder.clearAccessChain(); builder.setAccessChainRValue(length); @@ -1377,20 +1862,23 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI else operand = accessChainLoad(node->getOperand()->getType()); - spv::Decoration precision = TranslatePrecisionDecoration(node->getOperationPrecision()); - spv::Decoration noContraction = TranslateNoContractionDecoration(node->getType().getQualifier()); + OpDecorations decorations = { TranslatePrecisionDecoration(node->getOperationPrecision()), + TranslateNoContractionDecoration(node->getType().getQualifier()), + TranslateNonUniformDecoration(node->getType().getQualifier()) }; // it could be a conversion if (! result) - result = createConversion(node->getOp(), precision, noContraction, resultType(), operand, node->getOperand()->getBasicType()); + result = createConversion(node->getOp(), decorations, resultType(), operand, node->getOperand()->getBasicType()); // if not, then possibly an operation if (! result) - result = createUnaryOperation(node->getOp(), precision, noContraction, resultType(), operand, node->getOperand()->getBasicType()); + result = createUnaryOperation(node->getOp(), decorations, resultType(), operand, node->getOperand()->getBasicType()); if (result) { - if (invertedType) - result = createInvertedSwizzle(precision, *node->getOperand(), result); + if (invertedType) { + result = createInvertedSwizzle(decorations.precision, *node->getOperand(), result); + builder.addDecoration(result, decorations.nonUniform); + } builder.clearAccessChain(); builder.setAccessChainRValue(result); @@ -1411,16 +1899,14 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI one = builder.makeFloatConstant(1.0F); else if (node->getBasicType() == glslang::EbtDouble) one = builder.makeDoubleConstant(1.0); -#ifdef AMD_EXTENSIONS else if (node->getBasicType() == glslang::EbtFloat16) one = builder.makeFloat16Constant(1.0F); -#endif - else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) - one = builder.makeInt64Constant(1); -#ifdef AMD_EXTENSIONS + else if (node->getBasicType() == glslang::EbtInt8 || node->getBasicType() == glslang::EbtUint8) + one = builder.makeInt8Constant(1); else if (node->getBasicType() == glslang::EbtInt16 || node->getBasicType() == glslang::EbtUint16) one = builder.makeInt16Constant(1); -#endif + else if (node->getBasicType() == glslang::EbtInt64 || node->getBasicType() == glslang::EbtUint64) + one = builder.makeInt64Constant(1); else one = builder.makeIntConstant(1); glslang::TOperator op; @@ -1430,8 +1916,7 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI else op = glslang::EOpSub; - spv::Id result = createBinaryOperation(op, precision, - TranslateNoContractionDecoration(node->getType().getQualifier()), + spv::Id result = createBinaryOperation(op, decorations, convertGlslangToSpvType(node->getType()), operand, one, node->getType().getBasicType()); assert(result != spv::NoResult); @@ -1479,11 +1964,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt builder.setAccessChainRValue(result); return false; + } else if (node->getOp() == glslang::EOpImageStore || #ifdef AMD_EXTENSIONS - } else if (node->getOp() == glslang::EOpImageStore || node->getOp() == glslang::EOpImageStoreLod) { -#else - } else if (node->getOp() == glslang::EOpImageStore) { + node->getOp() == glslang::EOpImageStoreLod || #endif + node->getOp() == glslang::EOpImageAtomicStore) { // "imageStore" is a special case, which has no result return false; } @@ -1625,7 +2110,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpConstructBMat4x2: case glslang::EOpConstructBMat4x3: case glslang::EOpConstructBMat4x4: -#ifdef AMD_EXTENSIONS case glslang::EOpConstructF16Mat2x2: case glslang::EOpConstructF16Mat2x3: case glslang::EOpConstructF16Mat2x4: @@ -1635,7 +2119,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpConstructF16Mat4x2: case glslang::EOpConstructF16Mat4x3: case glslang::EOpConstructF16Mat4x4: -#endif isMatrix = true; // fall through case glslang::EOpConstructFloat: @@ -1646,16 +2129,30 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpConstructDVec2: case glslang::EOpConstructDVec3: case glslang::EOpConstructDVec4: -#ifdef AMD_EXTENSIONS case glslang::EOpConstructFloat16: case glslang::EOpConstructF16Vec2: case glslang::EOpConstructF16Vec3: case glslang::EOpConstructF16Vec4: -#endif case glslang::EOpConstructBool: case glslang::EOpConstructBVec2: case glslang::EOpConstructBVec3: case glslang::EOpConstructBVec4: + case glslang::EOpConstructInt8: + case glslang::EOpConstructI8Vec2: + case glslang::EOpConstructI8Vec3: + case glslang::EOpConstructI8Vec4: + case glslang::EOpConstructUint8: + case glslang::EOpConstructU8Vec2: + case glslang::EOpConstructU8Vec3: + case glslang::EOpConstructU8Vec4: + case glslang::EOpConstructInt16: + case glslang::EOpConstructI16Vec2: + case glslang::EOpConstructI16Vec3: + case glslang::EOpConstructI16Vec4: + case glslang::EOpConstructUint16: + case glslang::EOpConstructU16Vec2: + case glslang::EOpConstructU16Vec3: + case glslang::EOpConstructU16Vec4: case glslang::EOpConstructInt: case glslang::EOpConstructIVec2: case glslang::EOpConstructIVec3: @@ -1672,16 +2169,6 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpConstructU64Vec2: case glslang::EOpConstructU64Vec3: case glslang::EOpConstructU64Vec4: -#ifdef AMD_EXTENSIONS - case glslang::EOpConstructInt16: - case glslang::EOpConstructI16Vec2: - case glslang::EOpConstructI16Vec3: - case glslang::EOpConstructI16Vec4: - case glslang::EOpConstructUint16: - case glslang::EOpConstructU16Vec2: - case glslang::EOpConstructU16Vec3: - case glslang::EOpConstructU16Vec4: -#endif case glslang::EOpConstructStruct: case glslang::EOpConstructTextureSampler: { @@ -1757,14 +2244,24 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpMemoryBarrierImage: case glslang::EOpMemoryBarrierShared: case glslang::EOpGroupMemoryBarrier: + case glslang::EOpDeviceMemoryBarrier: case glslang::EOpAllMemoryBarrierWithGroupSync: - case glslang::EOpGroupMemoryBarrierWithGroupSync: + case glslang::EOpDeviceMemoryBarrierWithGroupSync: case glslang::EOpWorkgroupMemoryBarrier: case glslang::EOpWorkgroupMemoryBarrierWithGroupSync: + case glslang::EOpSubgroupBarrier: + case glslang::EOpSubgroupMemoryBarrier: + case glslang::EOpSubgroupMemoryBarrierBuffer: + case glslang::EOpSubgroupMemoryBarrierImage: + case glslang::EOpSubgroupMemoryBarrierShared: noReturnValue = true; // These all have 0 operands and will naturally finish up in the code below for 0 operands break; + case glslang::EOpAtomicStore: + noReturnValue = true; + // fallthrough + case glslang::EOpAtomicLoad: case glslang::EOpAtomicAdd: case glslang::EOpAtomicMin: case glslang::EOpAtomicMax: @@ -1790,6 +2287,16 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt atomic = true; break; +#ifdef NV_EXTENSIONS + case glslang::EOpIgnoreIntersectionNV: + case glslang::EOpTerminateRayNV: + case glslang::EOpTraceNV: + case glslang::EOpExecuteCallableNV: + case glslang::EOpWritePackedPrimitiveIndices4x8NV: + noReturnValue = true; + break; +#endif + default: break; } @@ -1811,7 +2318,10 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt spv::Id rightId = accessChainLoad(right->getType()); builder.setLine(node->getLoc().line); - result = createBinaryOperation(binOp, precision, TranslateNoContractionDecoration(node->getType().getQualifier()), + OpDecorations decorations = { precision, + TranslateNoContractionDecoration(node->getType().getQualifier()), + TranslateNonUniformDecoration(node->getType().getQualifier()) }; + result = createBinaryOperation(binOp, decorations, resultType(), leftId, rightId, left->getType().getBasicType(), reduceComparison); @@ -1860,6 +2370,8 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt case glslang::EOpAtomicXor: case glslang::EOpAtomicExchange: case glslang::EOpAtomicCompSwap: + case glslang::EOpAtomicLoad: + case glslang::EOpAtomicStore: case glslang::EOpAtomicCounterAdd: case glslang::EOpAtomicCounterSubtract: case glslang::EOpAtomicCounterMin: @@ -1909,11 +2421,15 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt result = createNoArgOperation(node->getOp(), precision, resultType()); break; case 1: - result = createUnaryOperation( - node->getOp(), precision, - TranslateNoContractionDecoration(node->getType().getQualifier()), - resultType(), operands.front(), - glslangOperands[0]->getAsTyped()->getBasicType()); + { + OpDecorations decorations = { precision, + TranslateNoContractionDecoration(node->getType().getQualifier()), + TranslateNonUniformDecoration(node->getType().getQualifier()) }; + result = createUnaryOperation( + node->getOp(), decorations, + resultType(), operands.front(), + glslangOperands[0]->getAsTyped()->getBasicType()); + } break; default: result = createMiscOperation(node->getOp(), precision, resultType(), operands, node->getBasicType()); @@ -1947,18 +2463,29 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt // next layer copies r-values into memory to use the access-chain mechanism bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang::TIntermSelection* node) { - // See if it simple and safe to generate OpSelect instead of using control flow. - // Crucially, side effects must be avoided, and there are performance trade-offs. - // Return true if good idea (and safe) for OpSelect, false otherwise. - const auto selectPolicy = [&]() -> bool { - if ((!node->getType().isScalar() && !node->getType().isVector()) || - node->getBasicType() == glslang::EbtVoid) - return false; - + // See if it simple and safe, or required, to execute both sides. + // Crucially, side effects must be either semantically required or avoided, + // and there are performance trade-offs. + // Return true if required or a good idea (and safe) to execute both sides, + // false otherwise. + const auto bothSidesPolicy = [&]() -> bool { + // do we have both sides? if (node->getTrueBlock() == nullptr || node->getFalseBlock() == nullptr) return false; + // required? (unless we write additional code to look for side effects + // and make performance trade-offs if none are present) + if (!node->getShortCircuit()) + return true; + + // if not required to execute both, decide based on performance/practicality... + + // see if OpSelect can handle it + if ((!node->getType().isScalar() && !node->getType().isVector()) || + node->getBasicType() == glslang::EbtVoid) + return false; + assert(node->getType() == node->getTrueBlock() ->getAsTyped()->getType() && node->getType() == node->getFalseBlock()->getAsTyped()->getType()); @@ -1971,10 +2498,14 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang operandOkay(node->getFalseBlock()->getAsTyped()); }; - // Emit OpSelect for this selection. - const auto handleAsOpSelect = [&]() { - node->getCondition()->traverse(this); - spv::Id condition = accessChainLoad(node->getCondition()->getType()); + spv::Id result = spv::NoResult; // upcoming result selecting between trueValue and falseValue + // emit the condition before doing anything with selection + node->getCondition()->traverse(this); + spv::Id condition = accessChainLoad(node->getCondition()->getType()); + + // Find a way of executing both sides and selecting the right result. + const auto executeBothSides = [&]() -> void { + // execute both sides node->getTrueBlock()->traverse(this); spv::Id trueValue = accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()); node->getFalseBlock()->traverse(this); @@ -1982,72 +2513,98 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang builder.setLine(node->getLoc().line); - // smear condition to vector, if necessary (AST is always scalar) - if (builder.isVector(trueValue)) - condition = builder.smearScalar(spv::NoPrecision, condition, - builder.makeVectorType(builder.makeBoolType(), - builder.getNumComponents(trueValue))); + // done if void + if (node->getBasicType() == glslang::EbtVoid) + return; - spv::Id select = builder.createTriOp(spv::OpSelect, - convertGlslangToSpvType(node->getType()), condition, - trueValue, falseValue); - builder.clearAccessChain(); - builder.setAccessChainRValue(select); + // emit code to select between trueValue and falseValue + + // see if OpSelect can handle it + if (node->getType().isScalar() || node->getType().isVector()) { + // Emit OpSelect for this selection. + + // smear condition to vector, if necessary (AST is always scalar) + if (builder.isVector(trueValue)) + condition = builder.smearScalar(spv::NoPrecision, condition, + builder.makeVectorType(builder.makeBoolType(), + builder.getNumComponents(trueValue))); + + // OpSelect + result = builder.createTriOp(spv::OpSelect, + convertGlslangToSpvType(node->getType()), condition, + trueValue, falseValue); + + builder.clearAccessChain(); + builder.setAccessChainRValue(result); + } else { + // We need control flow to select the result. + // TODO: Once SPIR-V OpSelect allows arbitrary types, eliminate this path. + result = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); + + // Selection control: + const spv::SelectionControlMask control = TranslateSelectionControl(*node); + + // make an "if" based on the value created by the condition + spv::Builder::If ifBuilder(condition, control, builder); + + // emit the "then" statement + builder.createStore(trueValue, result); + ifBuilder.makeBeginElse(); + // emit the "else" statement + builder.createStore(falseValue, result); + + // finish off the control flow + ifBuilder.makeEndIf(); + + builder.clearAccessChain(); + builder.setAccessChainLValue(result); + } }; - // Try for OpSelect + // Execute the one side needed, as per the condition + const auto executeOneSide = [&]() { + // Always emit control flow. + if (node->getBasicType() != glslang::EbtVoid) + result = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); - if (selectPolicy()) { + // Selection control: + const spv::SelectionControlMask control = TranslateSelectionControl(*node); + + // make an "if" based on the value created by the condition + spv::Builder::If ifBuilder(condition, control, builder); + + // emit the "then" statement + if (node->getTrueBlock() != nullptr) { + node->getTrueBlock()->traverse(this); + if (result != spv::NoResult) + builder.createStore(accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()), result); + } + + if (node->getFalseBlock() != nullptr) { + ifBuilder.makeBeginElse(); + // emit the "else" statement + node->getFalseBlock()->traverse(this); + if (result != spv::NoResult) + builder.createStore(accessChainLoad(node->getFalseBlock()->getAsTyped()->getType()), result); + } + + // finish off the control flow + ifBuilder.makeEndIf(); + + if (result != spv::NoResult) { + builder.clearAccessChain(); + builder.setAccessChainLValue(result); + } + }; + + // Try for OpSelect (or a requirement to execute both sides) + if (bothSidesPolicy()) { SpecConstantOpModeGuard spec_constant_op_mode_setter(&builder); if (node->getType().getQualifier().isSpecConstant()) spec_constant_op_mode_setter.turnOnSpecConstantOpMode(); - - handleAsOpSelect(); - return false; - } - - // Instead, emit control flow... - // Don't handle results as temporaries, because there will be two names - // and better to leave SSA to later passes. - spv::Id result = (node->getBasicType() == glslang::EbtVoid) - ? spv::NoResult - : builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); - - // emit the condition before doing anything with selection - node->getCondition()->traverse(this); - - // Selection control: - const spv::SelectionControlMask control = TranslateSelectionControl(node->getSelectionControl()); - - // make an "if" based on the value created by the condition - spv::Builder::If ifBuilder(accessChainLoad(node->getCondition()->getType()), control, builder); - - // emit the "then" statement - if (node->getTrueBlock() != nullptr) { - node->getTrueBlock()->traverse(this); - if (result != spv::NoResult) - builder.createStore(accessChainLoad(node->getTrueBlock()->getAsTyped()->getType()), result); - } - - if (node->getFalseBlock() != nullptr) { - ifBuilder.makeBeginElse(); - // emit the "else" statement - node->getFalseBlock()->traverse(this); - if (result != spv::NoResult) - builder.createStore(accessChainLoad(node->getFalseBlock()->getAsTyped()->getType()), result); - } - - // finish off the control flow - ifBuilder.makeEndIf(); - - if (result != spv::NoResult) { - // GLSL only has r-values as the result of a :?, but - // if we have an l-value, that can be more efficient if it will - // become the base of a complex r-value expression, because the - // next layer copies r-values into memory to use the access-chain mechanism - builder.clearAccessChain(); - builder.setAccessChainLValue(result); - } + executeBothSides(); + } else + executeOneSide(); return false; } @@ -2059,7 +2616,7 @@ bool TGlslangToSpvTraverser::visitSwitch(glslang::TVisit /* visit */, glslang::T spv::Id selector = accessChainLoad(node->getCondition()->getAsTyped()->getType()); // Selection control: - const spv::SelectionControlMask control = TranslateSelectionControl(node->getSelectionControl()); + const spv::SelectionControlMask control = TranslateSwitchControl(*node); // browse the children to sort out code segments int defaultSegment = -1; @@ -2119,9 +2676,8 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn builder.createBranch(&blocks.head); // Loop control: - const spv::LoopControlMask control = TranslateLoopControl(node->getLoopControl()); - - // TODO: dependency length + unsigned int dependencyLength = glslang::TIntermLoop::dependencyInfinite; + const spv::LoopControlMask control = TranslateLoopControl(*node, dependencyLength); // Spec requires back edges to target header blocks, and every header block // must dominate its merge block. Make a header block first to ensure these @@ -2131,7 +2687,7 @@ bool TGlslangToSpvTraverser::visitLoop(glslang::TVisit /* visit */, glslang::TIn // including merges of its own. builder.setLine(node->getLoc().line); builder.setBuildPoint(&blocks.head); - builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control); + builder.createLoopMerge(&blocks.merge, &blocks.continue_target, control, dependencyLength); if (node->testFirst() && node->getTest()) { spv::Block& test = builder.makeNewBlock(); builder.createBranch(&test); @@ -2235,32 +2791,59 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* // can still have a mapping to a SPIR-V Id. // This includes specialization constants. if (node->getQualifier().isConstant()) { - return createSpvConstant(*node); + spv::Id result = createSpvConstant(*node); + if (result != spv::NoResult) + return result; } // Now, handle actual variables spv::StorageClass storageClass = TranslateStorageClass(node->getType()); spv::Id spvType = convertGlslangToSpvType(node->getType()); -#ifdef AMD_EXTENSIONS const bool contains16BitType = node->getType().containsBasicType(glslang::EbtFloat16) || node->getType().containsBasicType(glslang::EbtInt16) || node->getType().containsBasicType(glslang::EbtUint16); if (contains16BitType) { - if (storageClass == spv::StorageClassInput || storageClass == spv::StorageClassOutput) { - builder.addExtension(spv::E_SPV_KHR_16bit_storage); + switch (storageClass) { + case spv::StorageClassInput: + case spv::StorageClassOutput: + addPre13Extension(spv::E_SPV_KHR_16bit_storage); builder.addCapability(spv::CapabilityStorageInputOutput16); - } else if (storageClass == spv::StorageClassPushConstant) { - builder.addExtension(spv::E_SPV_KHR_16bit_storage); + break; + case spv::StorageClassPushConstant: + addPre13Extension(spv::E_SPV_KHR_16bit_storage); builder.addCapability(spv::CapabilityStoragePushConstant16); - } else if (storageClass == spv::StorageClassUniform) { - builder.addExtension(spv::E_SPV_KHR_16bit_storage); - builder.addCapability(spv::CapabilityStorageUniform16); + break; + case spv::StorageClassUniform: + addPre13Extension(spv::E_SPV_KHR_16bit_storage); if (node->getType().getQualifier().storage == glslang::EvqBuffer) builder.addCapability(spv::CapabilityStorageUniformBufferBlock16); + else + builder.addCapability(spv::CapabilityStorageUniform16); + break; + case spv::StorageClassStorageBuffer: + addPre13Extension(spv::E_SPV_KHR_16bit_storage); + builder.addCapability(spv::CapabilityStorageUniformBufferBlock16); + break; + default: + break; + } + } + + const bool contains8BitType = node->getType().containsBasicType(glslang::EbtInt8) || + node->getType().containsBasicType(glslang::EbtUint8); + if (contains8BitType) { + if (storageClass == spv::StorageClassPushConstant) { + builder.addExtension(spv::E_SPV_KHR_8bit_storage); + builder.addCapability(spv::CapabilityStoragePushConstant8); + } else if (storageClass == spv::StorageClassUniform) { + builder.addExtension(spv::E_SPV_KHR_8bit_storage); + builder.addCapability(spv::CapabilityUniformAndStorageBuffer8BitAccess); + } else if (storageClass == spv::StorageClassStorageBuffer) { + builder.addExtension(spv::E_SPV_KHR_8bit_storage); + builder.addCapability(spv::CapabilityStorageBuffer8BitAccess); } } -#endif const char* name = node->getName().c_str(); if (glslang::IsAnonymous(name)) @@ -2274,6 +2857,12 @@ spv::Id TGlslangToSpvTraverser::getSampledType(const glslang::TSampler& sampler) { switch (sampler.type) { case glslang::EbtFloat: return builder.makeFloatType(32); +#ifdef AMD_EXTENSIONS + case glslang::EbtFloat16: + builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float_fetch); + builder.addCapability(spv::CapabilityFloat16ImageAMD); + return builder.makeFloatType(16); +#endif case glslang::EbtInt: return builder.makeIntType(32); case glslang::EbtUint: return builder.makeUintType(32); default: @@ -2316,13 +2905,14 @@ void TGlslangToSpvTraverser::convertSwizzle(const glslang::TIntermAggregate& nod // layout state rooted from the top-level type. spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type) { - return convertGlslangToSpvType(type, getExplicitLayout(type), type.getQualifier()); + return convertGlslangToSpvType(type, getExplicitLayout(type), type.getQualifier(), false); } // Do full recursive conversion of an arbitrary glslang type to a SPIR-V Id. // explicitLayout can be kept the same throughout the hierarchical recursive walk. // Mutually recursive with convertGlslangStructToSpvType(). -spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type, glslang::TLayoutPacking explicitLayout, const glslang::TQualifier& qualifier) +spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& type, + glslang::TLayoutPacking explicitLayout, const glslang::TQualifier& qualifier, bool lastBufferBlockMember) { spv::Id spvType = spv::NoResult; @@ -2337,12 +2927,9 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtDouble: spvType = builder.makeFloatType(64); break; -#ifdef AMD_EXTENSIONS case glslang::EbtFloat16: - builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); spvType = builder.makeFloatType(16); break; -#endif case glslang::EbtBool: // "transparent" bool doesn't exist in SPIR-V. The GLSL convention is // a 32-bit int where non-0 means true. @@ -2351,6 +2938,18 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty else spvType = builder.makeBoolType(); break; + case glslang::EbtInt8: + spvType = builder.makeIntType(8); + break; + case glslang::EbtUint8: + spvType = builder.makeUintType(8); + break; + case glslang::EbtInt16: + spvType = builder.makeIntType(16); + break; + case glslang::EbtUint16: + spvType = builder.makeUintType(16); + break; case glslang::EbtInt: spvType = builder.makeIntType(32); break; @@ -2363,20 +2962,15 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty case glslang::EbtUint64: spvType = builder.makeUintType(64); break; -#ifdef AMD_EXTENSIONS - case glslang::EbtInt16: - builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); - spvType = builder.makeIntType(16); - break; - case glslang::EbtUint16: - builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); - spvType = builder.makeUintType(16); - break; -#endif case glslang::EbtAtomicUint: builder.addCapability(spv::CapabilityAtomicStorage); spvType = builder.makeUintType(32); break; +#ifdef NV_EXTENSIONS + case glslang::EbtAccStructNV: + spvType = builder.makeAccelerationStructureNVType(); + break; +#endif case glslang::EbtSampler: { const glslang::TSampler& sampler = type.getSampler(); @@ -2436,8 +3030,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // Use a dummy glslang type for querying internal strides of // arrays of arrays, but using just a one-dimensional array. glslang::TType simpleArrayType(type, 0); // deference type of the array - while (simpleArrayType.getArraySizes().getNumDims() > 1) - simpleArrayType.getArraySizes().dereference(); + while (simpleArrayType.getArraySizes()->getNumDims() > 1) + simpleArrayType.getArraySizes()->dereference(); // Will compute the higher-order strides here, rather than making a whole // pile of types and doing repetitive recursion on their contents. @@ -2459,12 +3053,16 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty stride = getArrayStride(type, explicitLayout, qualifier.layoutMatrix); } - // Do the outer dimension, which might not be known for a runtime-sized array - if (type.isRuntimeSizedArray()) { - spvType = builder.makeRuntimeArray(spvType); - } else { - assert(type.getOuterArraySize() > 0); + // Do the outer dimension, which might not be known for a runtime-sized array. + // (Unsized arrays that survive through linking will be runtime-sized arrays) + if (type.isSizedArray()) spvType = builder.makeArrayType(spvType, makeArraySizeId(*type.getArraySizes(), 0), stride); + else { + if (!lastBufferBlockMember) { + builder.addExtension("SPV_EXT_descriptor_indexing"); + builder.addCapability(spv::CapabilityRuntimeDescriptorArrayEXT); + } + spvType = builder.makeRuntimeArray(spvType); } if (stride > 0) builder.addDecoration(spvType, spv::DecorationArrayStride, stride); @@ -2479,23 +3077,28 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty // bool TGlslangToSpvTraverser::filterMember(const glslang::TType& member) { +#ifdef NV_EXTENSIONS auto& extensions = glslangIntermediate->getRequestedExtensions(); - if (member.getFieldName() == "gl_ViewportMask" && - extensions.find("GL_NV_viewport_array2") == extensions.end()) - return true; if (member.getFieldName() == "gl_SecondaryViewportMaskNV" && extensions.find("GL_NV_stereo_view_rendering") == extensions.end()) return true; if (member.getFieldName() == "gl_SecondaryPositionNV" && extensions.find("GL_NV_stereo_view_rendering") == extensions.end()) return true; - if (member.getFieldName() == "gl_PositionPerViewNV" && - extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end()) - return true; - if (member.getFieldName() == "gl_ViewportMaskPerViewNV" && - extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end()) - return true; + + if (glslangIntermediate->getStage() != EShLangMeshNV) { + if (member.getFieldName() == "gl_ViewportMask" && + extensions.find("GL_NV_viewport_array2") == extensions.end()) + return true; + if (member.getFieldName() == "gl_PositionPerViewNV" && + extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end()) + return true; + if (member.getFieldName() == "gl_ViewportMaskPerViewNV" && + extensions.find("GL_NVX_multiview_per_view_attributes") == extensions.end()) + return true; + } +#endif return false; }; @@ -2532,7 +3135,10 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy memberQualifier.layoutLocation = qualifier.layoutLocation; // recurse - spvMembers.push_back(convertGlslangToSpvType(glslangMember, explicitLayout, memberQualifier)); + bool lastBufferBlockMember = qualifier.storage == glslang::EvqBuffer && + i == (int)glslangMembers->size() - 1; + spvMembers.push_back( + convertGlslangToSpvType(glslangMember, explicitLayout, memberQualifier, lastBufferBlockMember)); } } @@ -2570,99 +3176,113 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, InheritQualifiers(memberQualifier, qualifier); // using -1 above to indicate a hidden member - if (member >= 0) { - builder.addMemberName(spvType, member, glslangMember.getFieldName().c_str()); - addMemberDecoration(spvType, member, TranslateLayoutDecoration(glslangMember, memberQualifier.layoutMatrix)); - addMemberDecoration(spvType, member, TranslatePrecisionDecoration(glslangMember)); - // Add interpolation and auxiliary storage decorations only to top-level members of Input and Output storage classes - if (type.getQualifier().storage == glslang::EvqVaryingIn || - type.getQualifier().storage == glslang::EvqVaryingOut) { - if (type.getBasicType() == glslang::EbtBlock || - glslangIntermediate->getSource() == glslang::EShSourceHlsl) { - addMemberDecoration(spvType, member, TranslateInterpolationDecoration(memberQualifier)); - addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(memberQualifier)); - } + if (member < 0) + continue; + + builder.addMemberName(spvType, member, glslangMember.getFieldName().c_str()); + builder.addMemberDecoration(spvType, member, + TranslateLayoutDecoration(glslangMember, memberQualifier.layoutMatrix)); + builder.addMemberDecoration(spvType, member, TranslatePrecisionDecoration(glslangMember)); + // Add interpolation and auxiliary storage decorations only to + // top-level members of Input and Output storage classes + if (type.getQualifier().storage == glslang::EvqVaryingIn || + type.getQualifier().storage == glslang::EvqVaryingOut) { + if (type.getBasicType() == glslang::EbtBlock || + glslangIntermediate->getSource() == glslang::EShSourceHlsl) { + builder.addMemberDecoration(spvType, member, TranslateInterpolationDecoration(memberQualifier)); + builder.addMemberDecoration(spvType, member, TranslateAuxiliaryStorageDecoration(memberQualifier)); +#ifdef NV_EXTENSIONS + addMeshNVDecoration(spvType, member, memberQualifier); +#endif } - addMemberDecoration(spvType, member, TranslateInvariantDecoration(memberQualifier)); + } + builder.addMemberDecoration(spvType, member, TranslateInvariantDecoration(memberQualifier)); - if (type.getBasicType() == glslang::EbtBlock && - qualifier.storage == glslang::EvqBuffer) { - // Add memory decorations only to top-level members of shader storage block - std::vector memory; - TranslateMemoryDecoration(memberQualifier, memory); - for (unsigned int i = 0; i < memory.size(); ++i) - addMemberDecoration(spvType, member, memory[i]); - } + if (type.getBasicType() == glslang::EbtBlock && + qualifier.storage == glslang::EvqBuffer) { + // Add memory decorations only to top-level members of shader storage block + std::vector memory; + TranslateMemoryDecoration(memberQualifier, memory, glslangIntermediate->usingVulkanMemoryModel()); + for (unsigned int i = 0; i < memory.size(); ++i) + builder.addMemberDecoration(spvType, member, memory[i]); + } - // Location assignment was already completed correctly by the front end, - // just track whether a member needs to be decorated. - // Ignore member locations if the container is an array, as that's - // ill-specified and decisions have been made to not allow this. - if (! type.isArray() && memberQualifier.hasLocation()) - builder.addMemberDecoration(spvType, member, spv::DecorationLocation, memberQualifier.layoutLocation); + // Location assignment was already completed correctly by the front end, + // just track whether a member needs to be decorated. + // Ignore member locations if the container is an array, as that's + // ill-specified and decisions have been made to not allow this. + if (! type.isArray() && memberQualifier.hasLocation()) + builder.addMemberDecoration(spvType, member, spv::DecorationLocation, memberQualifier.layoutLocation); - if (qualifier.hasLocation()) // track for upcoming inheritance - locationOffset += glslangIntermediate->computeTypeLocationSize(glslangMember); + if (qualifier.hasLocation()) // track for upcoming inheritance + locationOffset += glslangIntermediate->computeTypeLocationSize( + glslangMember, glslangIntermediate->getStage()); - // component, XFB, others - if (glslangMember.getQualifier().hasComponent()) - builder.addMemberDecoration(spvType, member, spv::DecorationComponent, glslangMember.getQualifier().layoutComponent); - if (glslangMember.getQualifier().hasXfbOffset()) - builder.addMemberDecoration(spvType, member, spv::DecorationOffset, glslangMember.getQualifier().layoutXfbOffset); - else if (explicitLayout != glslang::ElpNone) { - // figure out what to do with offset, which is accumulating - int nextOffset; - updateMemberOffset(type, glslangMember, offset, nextOffset, explicitLayout, memberQualifier.layoutMatrix); - if (offset >= 0) - builder.addMemberDecoration(spvType, member, spv::DecorationOffset, offset); - offset = nextOffset; - } + // component, XFB, others + if (glslangMember.getQualifier().hasComponent()) + builder.addMemberDecoration(spvType, member, spv::DecorationComponent, + glslangMember.getQualifier().layoutComponent); + if (glslangMember.getQualifier().hasXfbOffset()) + builder.addMemberDecoration(spvType, member, spv::DecorationOffset, + glslangMember.getQualifier().layoutXfbOffset); + else if (explicitLayout != glslang::ElpNone) { + // figure out what to do with offset, which is accumulating + int nextOffset; + updateMemberOffset(type, glslangMember, offset, nextOffset, explicitLayout, memberQualifier.layoutMatrix); + if (offset >= 0) + builder.addMemberDecoration(spvType, member, spv::DecorationOffset, offset); + offset = nextOffset; + } - if (glslangMember.isMatrix() && explicitLayout != glslang::ElpNone) - builder.addMemberDecoration(spvType, member, spv::DecorationMatrixStride, getMatrixStride(glslangMember, explicitLayout, memberQualifier.layoutMatrix)); + if (glslangMember.isMatrix() && explicitLayout != glslang::ElpNone) + builder.addMemberDecoration(spvType, member, spv::DecorationMatrixStride, + getMatrixStride(glslangMember, explicitLayout, memberQualifier.layoutMatrix)); - // built-in variable decorations - spv::BuiltIn builtIn = TranslateBuiltInDecoration(glslangMember.getQualifier().builtIn, true); - if (builtIn != spv::BuiltInMax) - addMemberDecoration(spvType, member, spv::DecorationBuiltIn, (int)builtIn); + // built-in variable decorations + spv::BuiltIn builtIn = TranslateBuiltInDecoration(glslangMember.getQualifier().builtIn, true); + if (builtIn != spv::BuiltInMax) + builder.addMemberDecoration(spvType, member, spv::DecorationBuiltIn, (int)builtIn); + + // nonuniform + builder.addMemberDecoration(spvType, member, TranslateNonUniformDecoration(glslangMember.getQualifier())); + + if (glslangIntermediate->getHlslFunctionality1() && memberQualifier.semanticName != nullptr) { + builder.addExtension("SPV_GOOGLE_hlsl_functionality1"); + builder.addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE, + memberQualifier.semanticName); + } #ifdef NV_EXTENSIONS - if (builtIn == spv::BuiltInLayer) { - // SPV_NV_viewport_array2 extension - if (glslangMember.getQualifier().layoutViewportRelative){ - addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationViewportRelativeNV); - builder.addCapability(spv::CapabilityShaderViewportMaskNV); - builder.addExtension(spv::E_SPV_NV_viewport_array2); - } - if (glslangMember.getQualifier().layoutSecondaryViewportRelativeOffset != -2048){ - addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationSecondaryViewportRelativeNV, glslangMember.getQualifier().layoutSecondaryViewportRelativeOffset); - builder.addCapability(spv::CapabilityShaderStereoViewNV); - builder.addExtension(spv::E_SPV_NV_stereo_view_rendering); - } + if (builtIn == spv::BuiltInLayer) { + // SPV_NV_viewport_array2 extension + if (glslangMember.getQualifier().layoutViewportRelative){ + builder.addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationViewportRelativeNV); + builder.addCapability(spv::CapabilityShaderViewportMaskNV); + builder.addExtension(spv::E_SPV_NV_viewport_array2); } - if (glslangMember.getQualifier().layoutPassthrough) { - addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationPassthroughNV); - builder.addCapability(spv::CapabilityGeometryShaderPassthroughNV); - builder.addExtension(spv::E_SPV_NV_geometry_shader_passthrough); + if (glslangMember.getQualifier().layoutSecondaryViewportRelativeOffset != -2048){ + builder.addMemberDecoration(spvType, member, + (spv::Decoration)spv::DecorationSecondaryViewportRelativeNV, + glslangMember.getQualifier().layoutSecondaryViewportRelativeOffset); + builder.addCapability(spv::CapabilityShaderStereoViewNV); + builder.addExtension(spv::E_SPV_NV_stereo_view_rendering); } -#endif } + if (glslangMember.getQualifier().layoutPassthrough) { + builder.addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationPassthroughNV); + builder.addCapability(spv::CapabilityGeometryShaderPassthroughNV); + builder.addExtension(spv::E_SPV_NV_geometry_shader_passthrough); + } +#endif } // Decorate the structure - addDecoration(spvType, TranslateLayoutDecoration(type, qualifier.layoutMatrix)); - addDecoration(spvType, TranslateBlockDecoration(type, glslangIntermediate->usingStorageBuffer())); + builder.addDecoration(spvType, TranslateLayoutDecoration(type, qualifier.layoutMatrix)); + builder.addDecoration(spvType, TranslateBlockDecoration(type, glslangIntermediate->usingStorageBuffer())); if (type.getQualifier().hasStream() && glslangIntermediate->isMultiStream()) { builder.addCapability(spv::CapabilityGeometryStreams); builder.addDecoration(spvType, spv::DecorationStream, type.getQualifier().layoutStream); } - if (glslangIntermediate->getXfbMode()) { - builder.addCapability(spv::CapabilityTransformFeedback); - if (type.getQualifier().hasXfbStride()) - builder.addDecoration(spvType, spv::DecorationXfbStride, type.getQualifier().layoutXfbStride); - if (type.getQualifier().hasXfbBuffer()) - builder.addDecoration(spvType, spv::DecorationXfbBuffer, type.getQualifier().layoutXfbBuffer); - } } // Turn the expression forming the array size into an id. @@ -2693,7 +3313,15 @@ spv::Id TGlslangToSpvTraverser::makeArraySizeId(const glslang::TArraySizes& arra spv::Id TGlslangToSpvTraverser::accessChainLoad(const glslang::TType& type) { spv::Id nominalTypeId = builder.accessChainGetInferredType(); - spv::Id loadedId = builder.accessChainLoad(TranslatePrecisionDecoration(type), nominalTypeId); + + spv::Builder::AccessChain::CoherentFlags coherentFlags = builder.getAccessChain().coherentFlags; + coherentFlags |= TranslateCoherent(type); + + spv::Id loadedId = builder.accessChainLoad(TranslatePrecisionDecoration(type), + TranslateNonUniformDecoration(type.getQualifier()), + nominalTypeId, + spv::MemoryAccessMask(TranslateMemoryAccess(coherentFlags) & ~spv::MemoryAccessMakePointerAvailableKHRMask), + TranslateMemoryScope(coherentFlags)); // Need to convert to abstract types when necessary if (type.getBasicType() == glslang::EbtBool) { @@ -2749,7 +3377,12 @@ void TGlslangToSpvTraverser::accessChainStore(const glslang::TType& type, spv::I } } - builder.accessChainStore(rvalue); + spv::Builder::AccessChain::CoherentFlags coherentFlags = builder.getAccessChain().coherentFlags; + coherentFlags |= TranslateCoherent(type); + + builder.accessChainStore(rvalue, + spv::MemoryAccessMask(TranslateMemoryAccess(coherentFlags) & ~spv::MemoryAccessMakePointerVisibleKHRMask), + TranslateMemoryScope(coherentFlags)); } // For storing when types match at the glslang level, but not might match at the @@ -2795,7 +3428,7 @@ void TGlslangToSpvTraverser::multiTypeStore(const glslang::TType& type, spv::Id // set up the target storage builder.clearAccessChain(); builder.setAccessChainLValue(lValue); - builder.accessChainPush(builder.makeIntConstant(index)); + builder.accessChainPush(builder.makeIntConstant(index), TranslateCoherent(type)); // store the member multiTypeStore(glslangElementType, elementRValue); @@ -2815,7 +3448,7 @@ void TGlslangToSpvTraverser::multiTypeStore(const glslang::TType& type, spv::Id // set up the target storage builder.clearAccessChain(); builder.setAccessChainLValue(lValue); - builder.accessChainPush(builder.makeIntConstant(m)); + builder.accessChainPush(builder.makeIntConstant(m), TranslateCoherent(type)); // store the member multiTypeStore(glslangMemberType, memberRValue); @@ -2832,15 +3465,17 @@ glslang::TLayoutPacking TGlslangToSpvTraverser::getExplicitLayout(const glslang: if (type.getBasicType() != glslang::EbtBlock) return glslang::ElpNone; - // has to be a uniform or buffer block + // has to be a uniform or buffer block or task in/out blocks if (type.getQualifier().storage != glslang::EvqUniform && - type.getQualifier().storage != glslang::EvqBuffer) + type.getQualifier().storage != glslang::EvqBuffer && + !type.getQualifier().isTaskMemory()) return glslang::ElpNone; // return the layout to use switch (type.getQualifier().layoutPacking) { case glslang::ElpStd140: case glslang::ElpStd430: + case glslang::ElpScalar: return type.getQualifier().layoutPacking; default: return glslang::ElpNone; @@ -2852,7 +3487,7 @@ int TGlslangToSpvTraverser::getArrayStride(const glslang::TType& arrayType, glsl { int size; int stride; - glslangIntermediate->getBaseAlignment(arrayType, size, stride, explicitLayout == glslang::ElpStd140, matrixLayout == glslang::ElmRowMajor); + glslangIntermediate->getMemberAlignment(arrayType, size, stride, explicitLayout, matrixLayout == glslang::ElmRowMajor); return stride; } @@ -2867,7 +3502,7 @@ int TGlslangToSpvTraverser::getMatrixStride(const glslang::TType& matrixType, gl int size; int stride; - glslangIntermediate->getBaseAlignment(elementType, size, stride, explicitLayout == glslang::ElpStd140, matrixLayout == glslang::ElmRowMajor); + glslangIntermediate->getMemberAlignment(elementType, size, stride, explicitLayout, matrixLayout == glslang::ElmRowMajor); return stride; } @@ -2909,14 +3544,14 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& structType int memberSize; int dummyStride; - int memberAlignment = glslangIntermediate->getBaseAlignment(memberType, memberSize, dummyStride, explicitLayout == glslang::ElpStd140, matrixLayout == glslang::ElmRowMajor); + int memberAlignment = glslangIntermediate->getMemberAlignment(memberType, memberSize, dummyStride, explicitLayout, matrixLayout == glslang::ElmRowMajor); // Adjust alignment for HLSL rules // TODO: make this consistent in early phases of code: // adjusting this late means inconsistencies with earlier code, which for reflection is an issue // Until reflection is brought in sync with these adjustments, don't apply to $Global, // which is the most likely to rely on reflection, and least likely to rely implicit layouts - if (glslangIntermediate->usingHlslOFfsets() && + if (glslangIntermediate->usingHlslOffsets() && ! memberType.isArray() && memberType.isVector() && structType.getTypeName().compare("$Global") != 0) { int dummySize; int componentAlignment = glslangIntermediate->getBaseAlignmentScalar(memberType, dummySize); @@ -2928,7 +3563,7 @@ void TGlslangToSpvTraverser::updateMemberOffset(const glslang::TType& structType glslang::RoundToPow2(currentOffset, memberAlignment); // Bump up to vec4 if there is a bad straddle - if (glslangIntermediate->improperStraddle(memberType, memberSize, currentOffset)) + if (explicitLayout != glslang::ElpScalar && glslangIntermediate->improperStraddle(memberType, memberSize, currentOffset)) glslang::RoundToPow2(currentOffset, 16); nextOffset = currentOffset + memberSize; @@ -2948,6 +3583,14 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList& case glslang::EbvSecondaryViewportMaskNV: case glslang::EbvPositionPerViewNV: case glslang::EbvViewportMaskPerViewNV: + case glslang::EbvTaskCountNV: + case glslang::EbvPrimitiveCountNV: + case glslang::EbvPrimitiveIndicesNV: + case glslang::EbvClipDistancePerViewNV: + case glslang::EbvCullDistancePerViewNV: + case glslang::EbvLayerPerViewNV: + case glslang::EbvMeshViewCountNV: + case glslang::EbvMeshViewIndicesNV: #endif // Generate the associated capability. Delegate to TranslateBuiltInDecoration. // Alternately, we could just call this for any glslang built-in, since the @@ -2966,8 +3609,14 @@ bool TGlslangToSpvTraverser::isShaderEntryPoint(const glslang::TIntermAggregate* } // Does parameter need a place to keep writes, separate from the original? -bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier) +// Assumes called after originalParam(), which filters out block/buffer/opaque-based +// qualifiers such that we should have only in/out/inout/constreadonly here. +bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier) const { + assert(qualifier == glslang::EvqIn || + qualifier == glslang::EvqOut || + qualifier == glslang::EvqInOut || + qualifier == glslang::EvqConstReadOnly); return qualifier != glslang::EvqConstReadOnly; } @@ -2978,7 +3627,7 @@ bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier, if (implicitThisParam) // implicit this return true; if (glslangIntermediate->getSource() == glslang::EShSourceHlsl) - return false; + return paramType.getBasicType() == glslang::EbtBlock; return paramType.containsOpaque() || // sampler, etc. (paramType.getBasicType() == glslang::EbtBlock && qualifier == glslang::EvqBuffer); // SSBO } @@ -2986,11 +3635,11 @@ bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier, // Make all the functions, skeletally, without actually visiting their bodies. void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslFunctions) { - const auto getParamDecorations = [](std::vector& decorations, const glslang::TType& type) { + const auto getParamDecorations = [](std::vector& decorations, const glslang::TType& type, bool useVulkanMemoryModel) { spv::Decoration paramPrecision = TranslatePrecisionDecoration(type); if (paramPrecision != spv::NoPrecision) decorations.push_back(paramPrecision); - TranslateMemoryDecoration(type.getQualifier(), decorations); + TranslateMemoryDecoration(type.getQualifier(), decorations, useVulkanMemoryModel); }; for (int f = 0; f < (int)glslFunctions.size(); ++f) { @@ -3029,7 +3678,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF typeId = builder.makePointer(spv::StorageClassFunction, typeId); else rValueParameters.insert(parameters[p]->getAsSymbolNode()->getId()); - getParamDecorations(paramDecorations[p], paramType); + getParamDecorations(paramDecorations[p], paramType, glslangIntermediate->usingVulkanMemoryModel()); paramTypes.push_back(typeId); } @@ -3093,9 +3742,15 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& glslang::TSampler sampler = {}; bool cubeCompare = false; +#ifdef AMD_EXTENSIONS + bool f16ShadowCompare = false; +#endif if (node.isTexture() || node.isImage()) { sampler = glslangArguments[0]->getAsTyped()->getType().getSampler(); cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; +#ifdef AMD_EXTENSIONS + f16ShadowCompare = sampler.shadow && glslangArguments[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16; +#endif } for (int i = 0; i < (int)glslangArguments.size(); ++i) { @@ -3113,6 +3768,8 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& case glslang::EOpImageAtomicXor: case glslang::EOpImageAtomicExchange: case glslang::EOpImageAtomicCompSwap: + case glslang::EOpImageAtomicLoad: + case glslang::EOpImageAtomicStore: if (i == 0) lvalue = true; break; @@ -3120,6 +3777,21 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((sampler.ms && i == 3) || (! sampler.ms && i == 2)) lvalue = true; break; +#ifdef AMD_EXTENSIONS + case glslang::EOpSparseTexture: + if (((cubeCompare || f16ShadowCompare) && i == 3) || (! (cubeCompare || f16ShadowCompare) && i == 2)) + lvalue = true; + break; + case glslang::EOpSparseTextureClamp: + if (((cubeCompare || f16ShadowCompare) && i == 4) || (! (cubeCompare || f16ShadowCompare) && i == 3)) + lvalue = true; + break; + case glslang::EOpSparseTextureLod: + case glslang::EOpSparseTextureOffset: + if ((f16ShadowCompare && i == 4) || (! f16ShadowCompare && i == 3)) + lvalue = true; + break; +#else case glslang::EOpSparseTexture: if ((cubeCompare && i == 3) || (! cubeCompare && i == 2)) lvalue = true; @@ -3133,6 +3805,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 3) lvalue = true; break; +#endif case glslang::EOpSparseTextureFetch: if ((sampler.dim != glslang::EsdRect && i == 3) || (sampler.dim == glslang::EsdRect && i == 2)) lvalue = true; @@ -3141,6 +3814,23 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if ((sampler.dim != glslang::EsdRect && i == 4) || (sampler.dim == glslang::EsdRect && i == 3)) lvalue = true; break; +#ifdef AMD_EXTENSIONS + case glslang::EOpSparseTextureLodOffset: + case glslang::EOpSparseTextureGrad: + case glslang::EOpSparseTextureOffsetClamp: + if ((f16ShadowCompare && i == 5) || (! f16ShadowCompare && i == 4)) + lvalue = true; + break; + case glslang::EOpSparseTextureGradOffset: + case glslang::EOpSparseTextureGradClamp: + if ((f16ShadowCompare && i == 6) || (! f16ShadowCompare && i == 5)) + lvalue = true; + break; + case glslang::EOpSparseTextureGradOffsetClamp: + if ((f16ShadowCompare && i == 7) || (! f16ShadowCompare && i == 6)) + lvalue = true; + break; +#else case glslang::EOpSparseTextureLodOffset: case glslang::EOpSparseTextureGrad: case glslang::EOpSparseTextureOffsetClamp: @@ -3156,6 +3846,7 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 6) lvalue = true; break; +#endif case glslang::EOpSparseTextureGather: if ((sampler.shadow && i == 3) || (! sampler.shadow && i == 2)) lvalue = true; @@ -3179,6 +3870,25 @@ void TGlslangToSpvTraverser::translateArguments(const glslang::TIntermAggregate& if (i == 3) lvalue = true; break; +#endif +#ifdef NV_EXTENSIONS + case glslang::EOpImageSampleFootprintNV: + if (i == 4) + lvalue = true; + break; + case glslang::EOpImageSampleFootprintClampNV: + case glslang::EOpImageSampleFootprintLodNV: + if (i == 5) + lvalue = true; + break; + case glslang::EOpImageSampleFootprintGradNV: + if (i == 6) + lvalue = true; + break; + case glslang::EOpImageSampleFootprintGradClampNV: + if (i == 7) + lvalue = true; + break; #endif default: break; @@ -3205,11 +3915,17 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO builder.setLine(node->getLoc().line); - auto resultType = [&node,this]{ return convertGlslangToSpvType(node->getType()); }; - // Process a GLSL texturing op (will be SPV image) - const glslang::TSampler sampler = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType().getSampler() - : node->getAsUnaryNode()->getOperand()->getAsTyped()->getType().getSampler(); + + const glslang::TType &imageType = node->getAsAggregate() ? node->getAsAggregate()->getSequence()[0]->getAsTyped()->getType() + : node->getAsUnaryNode()->getOperand()->getAsTyped()->getType(); + const glslang::TSampler sampler = imageType.getSampler(); +#ifdef AMD_EXTENSIONS + bool f16ShadowCompare = (sampler.shadow && node->getAsAggregate()) + ? node->getAsAggregate()->getSequence()[1]->getAsTyped()->getType().getBasicType() == glslang::EbtFloat16 + : false; +#endif + std::vector arguments; if (node->getAsAggregate()) translateArguments(*node->getAsAggregate(), arguments); @@ -3255,11 +3971,26 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } } + int components = node->getType().getVectorSize(); + + if (node->getOp() == glslang::EOpTextureFetch) { + // These must produce 4 components, per SPIR-V spec. We'll add a conversion constructor if needed. + // This will only happen through the HLSL path for operator[], so we do not have to handle e.g. + // the EOpTexture/Proj/Lod/etc family. It would be harmless to do so, but would need more logic + // here around e.g. which ones return scalars or other types. + components = 4; + } + + glslang::TType returnType(node->getType().getBasicType(), glslang::EvqTemporary, components); + + auto resultType = [&returnType,this]{ return convertGlslangToSpvType(returnType); }; + // Check for image functions other than queries if (node->isImage()) { - std::vector operands; + std::vector operands; auto opIt = arguments.begin(); - operands.push_back(*(opIt++)); + spv::IdImmediate image = { true, *(opIt++) }; + operands.push_back(image); // Handle subpass operations // TODO: GLSL should change to have the "MS" only on the type rather than the @@ -3270,62 +4001,123 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO std::vector comps; comps.push_back(zero); comps.push_back(zero); - operands.push_back(builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps)); + spv::IdImmediate coord = { true, + builder.makeCompositeConstant(builder.makeVectorType(builder.makeIntType(32), 2), comps) }; + operands.push_back(coord); if (sampler.ms) { - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*(opIt++)); + spv::IdImmediate imageOperands = { false, spv::ImageOperandsSampleMask }; + operands.push_back(imageOperands); + spv::IdImmediate imageOperand = { true, *(opIt++) }; + operands.push_back(imageOperand); } spv::Id result = builder.createOp(spv::OpImageRead, resultType(), operands); builder.setPrecision(result, precision); return result; } - operands.push_back(*(opIt++)); + spv::IdImmediate coord = { true, *(opIt++) }; + operands.push_back(coord); #ifdef AMD_EXTENSIONS if (node->getOp() == glslang::EOpImageLoad || node->getOp() == glslang::EOpImageLoadLod) { #else if (node->getOp() == glslang::EOpImageLoad) { #endif + spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; if (sampler.ms) { - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*opIt); + mask = mask | spv::ImageOperandsSampleMask; + } #ifdef AMD_EXTENSIONS - } else if (cracked.lod) { + if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); - - operands.push_back(spv::ImageOperandsLodMask); - operands.push_back(*opIt); -#endif + mask = mask | spv::ImageOperandsLodMask; } - if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown) +#endif + mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); + mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask); + if (mask) { + spv::IdImmediate imageOperands = { false, (unsigned int)mask }; + operands.push_back(imageOperands); + } + if (mask & spv::ImageOperandsSampleMask) { + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); + } +#ifdef AMD_EXTENSIONS + if (mask & spv::ImageOperandsLodMask) { + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); + } +#endif + if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) { + spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; + operands.push_back(imageOperand); + } + + if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageReadWithoutFormat); - spv::Id result = builder.createOp(spv::OpImageRead, resultType(), operands); - builder.setPrecision(result, precision); - return result; + std::vector result(1, builder.createOp(spv::OpImageRead, resultType(), operands)); + builder.setPrecision(result[0], precision); + + // If needed, add a conversion constructor to the proper size. + if (components != node->getType().getVectorSize()) + result[0] = builder.createConstructor(precision, result, convertGlslangToSpvType(node->getType())); + + return result[0]; #ifdef AMD_EXTENSIONS } else if (node->getOp() == glslang::EOpImageStore || node->getOp() == glslang::EOpImageStoreLod) { #else } else if (node->getOp() == glslang::EOpImageStore) { #endif - if (sampler.ms) { - operands.push_back(*(opIt + 1)); - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*opIt); + + // Push the texel value before the operands #ifdef AMD_EXTENSIONS - } else if (cracked.lod) { + if (sampler.ms || cracked.lod) { +#else + if (sampler.ms) { +#endif + spv::IdImmediate texel = { true, *(opIt + 1) }; + operands.push_back(texel); + } else { + spv::IdImmediate texel = { true, *opIt }; + operands.push_back(texel); + } + + spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; + if (sampler.ms) { + mask = mask | spv::ImageOperandsSampleMask; + } +#ifdef AMD_EXTENSIONS + if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); - - operands.push_back(*(opIt + 1)); - operands.push_back(spv::ImageOperandsLodMask); - operands.push_back(*opIt); + mask = mask | spv::ImageOperandsLodMask; + } #endif - } else - operands.push_back(*opIt); + mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); + mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelVisibleKHRMask); + if (mask) { + spv::IdImmediate imageOperands = { false, (unsigned int)mask }; + operands.push_back(imageOperands); + } + if (mask & spv::ImageOperandsSampleMask) { + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); + } +#ifdef AMD_EXTENSIONS + if (mask & spv::ImageOperandsLodMask) { + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); + } +#endif + if (mask & spv::ImageOperandsMakeTexelAvailableKHRMask) { + spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; + operands.push_back(imageOperand); + } + builder.createNoResultOp(spv::OpImageWrite, operands); - if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown) + if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageWriteWithoutFormat); return spv::NoResult; #ifdef AMD_EXTENSIONS @@ -3334,20 +4126,40 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else if (node->getOp() == glslang::EOpSparseImageLoad) { #endif builder.addCapability(spv::CapabilitySparseResidency); - if (builder.getImageTypeFormat(builder.getImageType(operands.front())) == spv::ImageFormatUnknown) + if (builder.getImageTypeFormat(builder.getImageType(operands.front().word)) == spv::ImageFormatUnknown) builder.addCapability(spv::CapabilityStorageImageReadWithoutFormat); + spv::ImageOperandsMask mask = spv::ImageOperandsMaskNone; if (sampler.ms) { - operands.push_back(spv::ImageOperandsSampleMask); - operands.push_back(*opIt++); + mask = mask | spv::ImageOperandsSampleMask; + } #ifdef AMD_EXTENSIONS - } else if (cracked.lod) { + if (cracked.lod) { builder.addExtension(spv::E_SPV_AMD_shader_image_load_store_lod); builder.addCapability(spv::CapabilityImageReadWriteLodAMD); - operands.push_back(spv::ImageOperandsLodMask); - operands.push_back(*opIt++); + mask = mask | spv::ImageOperandsLodMask; + } #endif + mask = mask | TranslateImageOperands(TranslateCoherent(imageType)); + mask = (spv::ImageOperandsMask)(mask & ~spv::ImageOperandsMakeTexelAvailableKHRMask); + if (mask) { + spv::IdImmediate imageOperands = { false, (unsigned int)mask }; + operands.push_back(imageOperands); + } + if (mask & spv::ImageOperandsSampleMask) { + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); + } +#ifdef AMD_EXTENSIONS + if (mask & spv::ImageOperandsLodMask) { + spv::IdImmediate imageOperand = { true, *opIt++ }; + operands.push_back(imageOperand); + } +#endif + if (mask & spv::ImageOperandsMakeTexelVisibleKHRMask) { + spv::IdImmediate imageOperand = { true, builder.makeUintConstant(TranslateMemoryScope(TranslateCoherent(imageType))) }; + operands.push_back(imageOperand); } // Create the return type that was a special structure @@ -3366,9 +4178,18 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // GLSL "IMAGE_PARAMS" will involve in constructing an image texel pointer and this pointer, // as the first source operand, is required by SPIR-V atomic operations. - operands.push_back(sampler.ms ? *(opIt++) : builder.makeUintConstant(0)); // For non-MS, the value should be 0 + // For non-MS, the sample value should be 0 + spv::IdImmediate sample = { true, sampler.ms ? *(opIt++) : builder.makeUintConstant(0) }; + operands.push_back(sample); - spv::Id resultTypeId = builder.makePointer(spv::StorageClassImage, resultType()); + spv::Id resultTypeId; + // imageAtomicStore has a void return type so base the pointer type on + // the type of the value operand. + if (node->getOp() == glslang::EOpImageAtomicStore) { + resultTypeId = builder.makePointer(spv::StorageClassImage, builder.getTypeId(operands[2].word)); + } else { + resultTypeId = builder.makePointer(spv::StorageClassImage, resultType()); + } spv::Id pointer = builder.createOp(spv::OpImageTexelPointer, resultTypeId, operands); std::vector operands; @@ -3421,6 +4242,10 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO // Check for texture functions other than queries bool sparse = node->isSparseTexture(); +#ifdef NV_EXTENSIONS + bool imageFootprint = node->isImageFootprint(); +#endif + bool cubeCompare = sampler.dim == glslang::EsdCube && sampler.arrayed && sampler.shadow; // check for bias argument @@ -3434,6 +4259,9 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO #ifdef AMD_EXTENSIONS if (cracked.gather) ++nonBiasArgCount; // comp argument should be present when bias argument is present + + if (f16ShadowCompare) + ++nonBiasArgCount; #endif if (cracked.offset) ++nonBiasArgCount; @@ -3447,7 +4275,12 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO ++nonBiasArgCount; if (sparse) ++nonBiasArgCount; - +#ifdef NV_EXTENSIONS + if (imageFootprint) + //Following three extra arguments + // int granularity, bool coarse, out gl_TextureFootprint2DNV footprint + nonBiasArgCount += 3; +#endif if ((int)arguments.size() > nonBiasArgCount) bias = true; } @@ -3477,7 +4310,11 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO bool noImplicitLod = false; // sort out where Dref is coming from +#ifdef AMD_EXTENSIONS + if (cubeCompare || f16ShadowCompare) { +#else if (cubeCompare) { +#endif params.Dref = arguments[2]; ++extraArgs; } else if (sampler.shadow && cracked.gather) { @@ -3498,7 +4335,13 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO if (cracked.lod) { params.lod = arguments[2 + extraArgs]; ++extraArgs; - } else if (glslangIntermediate->getStage() != EShLangFragment) { + } else if (glslangIntermediate->getStage() != EShLangFragment +#ifdef NV_EXTENSIONS + // NV_compute_shader_derivatives layout qualifiers allow for implicit LODs + && !(glslangIntermediate->getStage() == EShLangCompute && + (glslangIntermediate->getLayoutDerivativeModeNone() != glslang::LayoutDerivativeNone)) +#endif + ) { // we need to invent the default lod for an explicit lod instruction for a non-fragment stage noImplicitLod = true; } @@ -3530,7 +4373,6 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO params.lodClamp = arguments[2 + extraArgs]; ++extraArgs; } - // sparse if (sparse) { params.texelOut = arguments[2 + extraArgs]; @@ -3546,13 +4388,81 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } else params.component = builder.makeIntConstant(0); } - +#ifdef NV_EXTENSIONS + spv::Id resultStruct = spv::NoResult; + if (imageFootprint) { + //Following three extra arguments + // int granularity, bool coarse, out gl_TextureFootprint2DNV footprint + params.granularity = arguments[2 + extraArgs]; + params.coarse = arguments[3 + extraArgs]; + resultStruct = arguments[4 + extraArgs]; + extraArgs += 3; + } +#endif // bias if (bias) { params.bias = arguments[2 + extraArgs]; ++extraArgs; } +#ifdef NV_EXTENSIONS + if (imageFootprint) { + builder.addExtension(spv::E_SPV_NV_shader_image_footprint); + builder.addCapability(spv::CapabilityImageFootprintNV); + + + //resultStructType(OpenGL type) contains 5 elements: + //struct gl_TextureFootprint2DNV { + // uvec2 anchor; + // uvec2 offset; + // uvec2 mask; + // uint lod; + // uint granularity; + //}; + //or + //struct gl_TextureFootprint3DNV { + // uvec3 anchor; + // uvec3 offset; + // uvec2 mask; + // uint lod; + // uint granularity; + //}; + spv::Id resultStructType = builder.getContainedTypeId(builder.getTypeId(resultStruct)); + assert(builder.isStructType(resultStructType)); + + //resType (SPIR-V type) contains 6 elements: + //Member 0 must be a Boolean type scalar(LOD), + //Member 1 must be a vector of integer type, whose Signedness operand is 0(anchor), + //Member 2 must be a vector of integer type, whose Signedness operand is 0(offset), + //Member 3 must be a vector of integer type, whose Signedness operand is 0(mask), + //Member 4 must be a scalar of integer type, whose Signedness operand is 0(lod), + //Member 5 must be a scalar of integer type, whose Signedness operand is 0(granularity). + std::vector members; + members.push_back(resultType()); + for (int i = 0; i < 5; i++) { + members.push_back(builder.getContainedTypeId(resultStructType, i)); + } + spv::Id resType = builder.makeStructType(members, "ResType"); + + //call ImageFootprintNV + spv::Id res = builder.createTextureCall(precision, resType, sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params); + + //copy resType (SPIR-V type) to resultStructType(OpenGL type) + for (int i = 0; i < 5; i++) { + builder.clearAccessChain(); + builder.setAccessChainLValue(resultStruct); + + //Accessing to a struct we created, no coherent flag is set + spv::Builder::AccessChain::CoherentFlags flags; + flags.clear(); + + builder.accessChainPush(builder.makeIntConstant(i), flags); + builder.accessChainStore(builder.createCompositeExtract(res, builder.getContainedTypeId(resType, i+1), i+1)); + } + return builder.createCompositeExtract(res, resultType(), 0); + } +#endif + // projective component (might not to move) // GLSL: "The texture coordinates consumed from P, not including the last component of P, // are divided by the last component of P." @@ -3577,7 +4487,24 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO } } - return builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params); + // nonprivate + if (imageType.getQualifier().nonprivate) { + params.nonprivate = true; + } + + // volatile + if (imageType.getQualifier().volatil) { + params.volatil = true; + } + + std::vector result( 1, + builder.createTextureCall(precision, resultType(), sparse, cracked.fetch, cracked.proj, cracked.gather, noImplicitLod, params) + ); + + if (components != node->getType().getVectorSize()) + result[0] = builder.createConstructor(precision, result, convertGlslangToSpvType(node->getType())); + + return result[0]; } spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAggregate* node) @@ -3598,19 +4525,18 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg // 3. Make the call // 4. Copy back the results - // 1. Evaluate the arguments + // 1. Evaluate the arguments and their types std::vector lValues; std::vector rValues; std::vector argTypes; for (int a = 0; a < (int)glslangArgs.size(); ++a) { - const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); + argTypes.push_back(&glslangArgs[a]->getAsTyped()->getType()); // build l-value builder.clearAccessChain(); glslangArgs[a]->traverse(this); - argTypes.push_back(¶mType); // keep outputs and pass-by-originals as l-values, evaluate others as r-values - if (writableParam(qualifiers[a]) || - originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) { + if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0) || + writableParam(qualifiers[a])) { // save l-value lValues.push_back(builder.getAccessChain()); } else { @@ -3627,26 +4553,33 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg int rValueCount = 0; std::vector spvArgs; for (int a = 0; a < (int)glslangArgs.size(); ++a) { - const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); spv::Id arg; - if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) { + if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0)) { builder.setAccessChain(lValues[lValueCount]); arg = builder.accessChainGetLValue(); ++lValueCount; } else if (writableParam(qualifiers[a])) { // need space to hold the copy - arg = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(paramType), "param"); + arg = builder.createVariable(spv::StorageClassFunction, builder.getContainedTypeId(function->getParamType(a)), "param"); if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) { // need to copy the input into output space builder.setAccessChain(lValues[lValueCount]); spv::Id copy = accessChainLoad(*argTypes[a]); builder.clearAccessChain(); builder.setAccessChainLValue(arg); - multiTypeStore(paramType, copy); + multiTypeStore(*argTypes[a], copy); } ++lValueCount; } else { - arg = rValues[rValueCount]; + // process r-value, which involves a copy for a type mismatch + if (function->getParamType(a) != convertGlslangToSpvType(*argTypes[a])) { + spv::Id argCopy = builder.createVariable(spv::StorageClassFunction, function->getParamType(a), "arg"); + builder.clearAccessChain(); + builder.setAccessChainLValue(argCopy); + multiTypeStore(*argTypes[a], rValues[rValueCount]); + arg = builder.createLoad(argCopy); + } else + arg = rValues[rValueCount]; ++rValueCount; } spvArgs.push_back(arg); @@ -3659,14 +4592,13 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg // 4. Copy back out an "out" arguments. lValueCount = 0; for (int a = 0; a < (int)glslangArgs.size(); ++a) { - const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); - if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) + if (originalParam(qualifiers[a], *argTypes[a], function->hasImplicitThis() && a == 0)) ++lValueCount; else if (writableParam(qualifiers[a])) { if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) { spv::Id copy = builder.createLoad(spvArgs[a]); builder.setAccessChain(lValues[lValueCount]); - multiTypeStore(paramType, copy); + multiTypeStore(*argTypes[a], copy); } ++lValueCount; } @@ -3676,18 +4608,12 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg } // Translate AST operation to SPV operation, already having SPV-based operands/types. -spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv::Decoration precision, - spv::Decoration noContraction, +spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, OpDecorations& decorations, spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison) { -#ifdef AMD_EXTENSIONS - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64 || typeProxy == glslang::EbtUint16; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16; -#else - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; -#endif + bool isUnsigned = isTypeUnsignedInt(typeProxy); + bool isFloat = isTypeFloat(typeProxy); bool isBool = typeProxy == glslang::EbtBool; spv::Op binOp = spv::OpNop; @@ -3724,7 +4650,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv assert(builder.isScalar(right)); needMatchingVectors = false; binOp = spv::OpVectorTimesScalar; - } else + } else if (isFloat) + binOp = spv::OpFMul; + else binOp = spv::OpIMul; break; case glslang::EOpVectorTimesMatrix: @@ -3819,15 +4747,16 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv if (binOp != spv::OpNop) { assert(comparison == false); if (builder.isMatrix(left) || builder.isMatrix(right)) - return createBinaryMatrixOperation(binOp, precision, noContraction, typeId, left, right); + return createBinaryMatrixOperation(binOp, decorations, typeId, left, right); // No matrix involved; make both operands be the same number of components, if needed if (needMatchingVectors) - builder.promoteScalar(precision, left, right); + builder.promoteScalar(decorations.precision, left, right); spv::Id result = builder.createBinOp(binOp, typeId, left, right); - addDecoration(result, noContraction); - return builder.setPrecision(result, precision); + builder.addDecoration(result, decorations.noContraction); + builder.addDecoration(result, decorations.nonUniform); + return builder.setPrecision(result, decorations.precision); } if (! comparison) @@ -3836,8 +4765,11 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv // Handle comparison instructions if (reduceComparison && (op == glslang::EOpEqual || op == glslang::EOpNotEqual) - && (builder.isVector(left) || builder.isMatrix(left) || builder.isAggregate(left))) - return builder.createCompositeCompare(precision, left, right, op == glslang::EOpEqual); + && (builder.isVector(left) || builder.isMatrix(left) || builder.isAggregate(left))) { + spv::Id result = builder.createCompositeCompare(decorations.precision, left, right, op == glslang::EOpEqual); + builder.addDecoration(result, decorations.nonUniform); + return result; + } switch (op) { case glslang::EOpLessThan: @@ -3896,8 +4828,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv if (binOp != spv::OpNop) { spv::Id result = builder.createBinOp(binOp, typeId, left, right); - addDecoration(result, noContraction); - return builder.setPrecision(result, precision); + builder.addDecoration(result, decorations.noContraction); + builder.addDecoration(result, decorations.nonUniform); + return builder.setPrecision(result, decorations.precision); } return 0; @@ -3917,7 +4850,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv // matrix op scalar op in {+, -, /} // scalar op matrix op in {+, -, /} // -spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id left, spv::Id right) +spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, OpDecorations& decorations, spv::Id typeId, + spv::Id left, spv::Id right) { bool firstClass = true; @@ -3926,7 +4860,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec case spv::OpFDiv: if (builder.isMatrix(left) && builder.isScalar(right)) { // turn matrix / scalar into a multiply... - right = builder.createBinOp(spv::OpFDiv, builder.getTypeId(right), builder.makeFloatConstant(1.0F), right); + spv::Id resultType = builder.getTypeId(right); + right = builder.createBinOp(spv::OpFDiv, resultType, builder.makeFpConstant(resultType, 1.0), right); op = spv::OpMatrixTimesScalar; } else firstClass = false; @@ -3955,8 +4890,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec if (firstClass) { spv::Id result = builder.createBinOp(op, typeId, left, right); - addDecoration(result, noContraction); - return builder.setPrecision(result, precision); + builder.addDecoration(result, decorations.noContraction); + builder.addDecoration(result, decorations.nonUniform); + return builder.setPrecision(result, decorations.precision); } // Handle component-wise +, -, *, %, and / for all combinations of type. @@ -3983,9 +4919,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec std::vector results; spv::Id smearVec = spv::NoResult; if (builder.isScalar(left)) - smearVec = builder.smearScalar(precision, left, vecType); + smearVec = builder.smearScalar(decorations.precision, left, vecType); else if (builder.isScalar(right)) - smearVec = builder.smearScalar(precision, right, vecType); + smearVec = builder.smearScalar(decorations.precision, right, vecType); // do each vector op for (unsigned int c = 0; c < numCols; ++c) { @@ -3994,12 +4930,15 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec spv::Id leftVec = leftMat ? builder.createCompositeExtract( left, vecType, indexes) : smearVec; spv::Id rightVec = rightMat ? builder.createCompositeExtract(right, vecType, indexes) : smearVec; spv::Id result = builder.createBinOp(op, vecType, leftVec, rightVec); - addDecoration(result, noContraction); - results.push_back(builder.setPrecision(result, precision)); + builder.addDecoration(result, decorations.noContraction); + builder.addDecoration(result, decorations.nonUniform); + results.push_back(builder.setPrecision(result, decorations.precision)); } // put the pieces together - return builder.setPrecision(builder.createCompositeConstruct(typeId, results), precision); + spv::Id result = builder.setPrecision(builder.createCompositeConstruct(typeId, results), decorations.precision); + builder.addDecoration(result, decorations.nonUniform); + return result; } default: assert(0); @@ -4007,25 +4946,21 @@ spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Dec } } -spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy) +spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, OpDecorations& decorations, spv::Id typeId, + spv::Id operand, glslang::TBasicType typeProxy) { spv::Op unaryOp = spv::OpNop; int extBuiltins = -1; int libCall = -1; -#ifdef AMD_EXTENSIONS - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64 || typeProxy == glslang::EbtUint16; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16; -#else - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; -#endif + bool isUnsigned = isTypeUnsignedInt(typeProxy); + bool isFloat = isTypeFloat(typeProxy); switch (op) { case glslang::EOpNegative: if (isFloat) { unaryOp = spv::OpFNegate; if (builder.isMatrixType(typeId)) - return createUnaryMatrixOperation(unaryOp, precision, noContraction, typeId, operand, typeProxy); + return createUnaryMatrixOperation(unaryOp, decorations, typeId, operand, typeProxy); } else unaryOp = spv::OpSNegate; break; @@ -4155,12 +5090,10 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: case glslang::EOpDoubleBitsToUint64: case glslang::EOpInt64BitsToDouble: case glslang::EOpUint64BitsToDouble: -#ifdef AMD_EXTENSIONS case glslang::EOpFloat16BitsToInt16: case glslang::EOpFloat16BitsToUint16: case glslang::EOpInt16BitsToFloat16: case glslang::EOpUint16BitsToFloat16: -#endif unaryOp = spv::OpBitcast; break; @@ -4205,10 +5138,12 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: case glslang::EOpUnpackInt2x32: case glslang::EOpPackUint2x32: case glslang::EOpUnpackUint2x32: - unaryOp = spv::OpBitcast; - break; - -#ifdef AMD_EXTENSIONS + case glslang::EOpPack16: + case glslang::EOpPack32: + case glslang::EOpPack64: + case glslang::EOpUnpack32: + case glslang::EOpUnpack16: + case glslang::EOpUnpack8: case glslang::EOpPackInt2x16: case glslang::EOpUnpackInt2x16: case glslang::EOpPackUint2x16: @@ -4221,7 +5156,6 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: case glslang::EOpUnpackFloat2x16: unaryOp = spv::OpBitcast; break; -#endif case glslang::EOpDPdx: unaryOp = spv::OpDPdx; @@ -4233,31 +5167,28 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: unaryOp = spv::OpFwidth; break; case glslang::EOpDPdxFine: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdxFine; break; case glslang::EOpDPdyFine: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdyFine; break; case glslang::EOpFwidthFine: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpFwidthFine; break; case glslang::EOpDPdxCoarse: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdxCoarse; break; case glslang::EOpDPdyCoarse: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpDPdyCoarse; break; case glslang::EOpFwidthCoarse: - builder.addCapability(spv::CapabilityDerivativeControl); unaryOp = spv::OpFwidthCoarse; break; case glslang::EOpInterpolateAtCentroid: - builder.addCapability(spv::CapabilityInterpolationFunction); +#ifdef AMD_EXTENSIONS + if (typeProxy == glslang::EbtFloat16) + builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); +#endif libCall = spv::GLSLstd450InterpolateAtCentroid; break; case glslang::EOpAny: @@ -4287,7 +5218,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: // Handle all of the atomics in one place, in createAtomicOperation() std::vector operands; operands.push_back(operand); - return createAtomicOperation(op, precision, typeId, operands, typeProxy); + return createAtomicOperation(op, decorations.precision, typeId, operands, typeProxy); } case glslang::EOpBitFieldReverse: @@ -4336,7 +5267,45 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: operands.push_back(operand); return createInvocationsOperation(op, typeId, operands, typeProxy); } - + case glslang::EOpSubgroupAll: + case glslang::EOpSubgroupAny: + case glslang::EOpSubgroupAllEqual: + case glslang::EOpSubgroupBroadcastFirst: + case glslang::EOpSubgroupBallot: + case glslang::EOpSubgroupInverseBallot: + case glslang::EOpSubgroupBallotBitCount: + case glslang::EOpSubgroupBallotInclusiveBitCount: + case glslang::EOpSubgroupBallotExclusiveBitCount: + case glslang::EOpSubgroupBallotFindLSB: + case glslang::EOpSubgroupBallotFindMSB: + case glslang::EOpSubgroupAdd: + case glslang::EOpSubgroupMul: + case glslang::EOpSubgroupMin: + case glslang::EOpSubgroupMax: + case glslang::EOpSubgroupAnd: + case glslang::EOpSubgroupOr: + case glslang::EOpSubgroupXor: + case glslang::EOpSubgroupInclusiveAdd: + case glslang::EOpSubgroupInclusiveMul: + case glslang::EOpSubgroupInclusiveMin: + case glslang::EOpSubgroupInclusiveMax: + case glslang::EOpSubgroupInclusiveAnd: + case glslang::EOpSubgroupInclusiveOr: + case glslang::EOpSubgroupInclusiveXor: + case glslang::EOpSubgroupExclusiveAdd: + case glslang::EOpSubgroupExclusiveMul: + case glslang::EOpSubgroupExclusiveMin: + case glslang::EOpSubgroupExclusiveMax: + case glslang::EOpSubgroupExclusiveAnd: + case glslang::EOpSubgroupExclusiveOr: + case glslang::EOpSubgroupExclusiveXor: + case glslang::EOpSubgroupQuadSwapHorizontal: + case glslang::EOpSubgroupQuadSwapVertical: + case glslang::EOpSubgroupQuadSwapDiagonal: { + std::vector operands; + operands.push_back(operand); + return createSubgroupOperation(op, typeId, operands, typeProxy); + } #ifdef AMD_EXTENSIONS case glslang::EOpMbcnt: extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot); @@ -4353,7 +5322,11 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: libCall = spv::CubeFaceCoordAMD; break; #endif - +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartition: + unaryOp = spv::OpGroupNonUniformPartitionNV; + break; +#endif default: return 0; } @@ -4367,12 +5340,14 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: id = builder.createUnaryOp(unaryOp, typeId, operand); } - addDecoration(id, noContraction); - return builder.setPrecision(id, precision); + builder.addDecoration(id, decorations.noContraction); + builder.addDecoration(id, decorations.nonUniform); + return builder.setPrecision(id, decorations.precision); } // Create a unary operation on a matrix -spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Decoration noContraction, spv::Id typeId, spv::Id operand, glslang::TBasicType /* typeProxy */) +spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, OpDecorations& decorations, spv::Id typeId, + spv::Id operand, glslang::TBasicType /* typeProxy */) { // Handle unary operations vector by vector. // The result type is the same type as the original type. @@ -4394,40 +5369,123 @@ spv::Id TGlslangToSpvTraverser::createUnaryMatrixOperation(spv::Op op, spv::Deco indexes.push_back(c); spv::Id srcVec = builder.createCompositeExtract(operand, srcVecType, indexes); spv::Id destVec = builder.createUnaryOp(op, destVecType, srcVec); - addDecoration(destVec, noContraction); - results.push_back(builder.setPrecision(destVec, precision)); + builder.addDecoration(destVec, decorations.noContraction); + builder.addDecoration(destVec, decorations.nonUniform); + results.push_back(builder.setPrecision(destVec, decorations.precision)); } // put the pieces together - return builder.setPrecision(builder.createCompositeConstruct(typeId, results), precision); + spv::Id result = builder.setPrecision(builder.createCompositeConstruct(typeId, results), decorations.precision); + builder.addDecoration(result, decorations.nonUniform); + return result; } -spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Decoration noContraction, spv::Id destType, spv::Id operand, glslang::TBasicType typeProxy) +// For converting integers where both the bitwidth and the signedness could +// change, but only do the width change here. The caller is still responsible +// for the signedness conversion. +spv::Id TGlslangToSpvTraverser::createIntWidthConversion(glslang::TOperator op, spv::Id operand, int vectorSize) +{ + // Get the result type width, based on the type to convert to. + int width = 32; + switch(op) { + case glslang::EOpConvInt16ToUint8: + case glslang::EOpConvIntToUint8: + case glslang::EOpConvInt64ToUint8: + case glslang::EOpConvUint16ToInt8: + case glslang::EOpConvUintToInt8: + case glslang::EOpConvUint64ToInt8: + width = 8; + break; + case glslang::EOpConvInt8ToUint16: + case glslang::EOpConvIntToUint16: + case glslang::EOpConvInt64ToUint16: + case glslang::EOpConvUint8ToInt16: + case glslang::EOpConvUintToInt16: + case glslang::EOpConvUint64ToInt16: + width = 16; + break; + case glslang::EOpConvInt8ToUint: + case glslang::EOpConvInt16ToUint: + case glslang::EOpConvInt64ToUint: + case glslang::EOpConvUint8ToInt: + case glslang::EOpConvUint16ToInt: + case glslang::EOpConvUint64ToInt: + width = 32; + break; + case glslang::EOpConvInt8ToUint64: + case glslang::EOpConvInt16ToUint64: + case glslang::EOpConvIntToUint64: + case glslang::EOpConvUint8ToInt64: + case glslang::EOpConvUint16ToInt64: + case glslang::EOpConvUintToInt64: + width = 64; + break; + + default: + assert(false && "Default missing"); + break; + } + + // Get the conversion operation and result type, + // based on the target width, but the source type. + spv::Id type = spv::NoType; + spv::Op convOp = spv::OpNop; + switch(op) { + case glslang::EOpConvInt8ToUint16: + case glslang::EOpConvInt8ToUint: + case glslang::EOpConvInt8ToUint64: + case glslang::EOpConvInt16ToUint8: + case glslang::EOpConvInt16ToUint: + case glslang::EOpConvInt16ToUint64: + case glslang::EOpConvIntToUint8: + case glslang::EOpConvIntToUint16: + case glslang::EOpConvIntToUint64: + case glslang::EOpConvInt64ToUint8: + case glslang::EOpConvInt64ToUint16: + case glslang::EOpConvInt64ToUint: + convOp = spv::OpSConvert; + type = builder.makeIntType(width); + break; + default: + convOp = spv::OpUConvert; + type = builder.makeUintType(width); + break; + } + + if (vectorSize > 0) + type = builder.makeVectorType(type, vectorSize); + + return builder.createUnaryOp(convOp, type, operand); +} + +spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecorations& decorations, spv::Id destType, + spv::Id operand, glslang::TBasicType typeProxy) { spv::Op convOp = spv::OpNop; spv::Id zero = 0; spv::Id one = 0; - spv::Id type = 0; int vectorSize = builder.isVectorType(destType) ? builder.getNumTypeComponents(destType) : 0; switch (op) { - case glslang::EOpConvIntToBool: - case glslang::EOpConvUintToBool: - case glslang::EOpConvInt64ToBool: - case glslang::EOpConvUint64ToBool: -#ifdef AMD_EXTENSIONS + case glslang::EOpConvInt8ToBool: + case glslang::EOpConvUint8ToBool: + zero = builder.makeUint8Constant(0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); case glslang::EOpConvInt16ToBool: case glslang::EOpConvUint16ToBool: -#endif - if (op == glslang::EOpConvInt64ToBool || op == glslang::EOpConvUint64ToBool) - zero = builder.makeUint64Constant(0); -#ifdef AMD_EXTENSIONS - else if (op == glslang::EOpConvInt16ToBool || op == glslang::EOpConvUint16ToBool) - zero = builder.makeUint16Constant(0); -#endif - else - zero = builder.makeUintConstant(0); + zero = builder.makeUint16Constant(0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); + case glslang::EOpConvIntToBool: + case glslang::EOpConvUintToBool: + zero = builder.makeUintConstant(0); + zero = makeSmearedConstant(zero, vectorSize); + return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); + case glslang::EOpConvInt64ToBool: + case glslang::EOpConvUint64ToBool: + zero = builder.makeUint64Constant(0); zero = makeSmearedConstant(zero, vectorSize); return builder.createBinOp(spv::OpINotEqual, destType, operand, zero); @@ -4441,12 +5499,10 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec zero = makeSmearedConstant(zero, vectorSize); return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); -#ifdef AMD_EXTENSIONS case glslang::EOpConvFloat16ToBool: zero = builder.makeFloat16Constant(0.0F); zero = makeSmearedConstant(zero, vectorSize); return builder.createBinOp(spv::OpFOrdNotEqual, destType, operand, zero); -#endif case glslang::EOpConvBoolToFloat: convOp = spv::OpSelect; @@ -4460,34 +5516,45 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec one = builder.makeDoubleConstant(1.0); break; -#ifdef AMD_EXTENSIONS case glslang::EOpConvBoolToFloat16: convOp = spv::OpSelect; zero = builder.makeFloat16Constant(0.0F); one = builder.makeFloat16Constant(1.0F); break; -#endif + + case glslang::EOpConvBoolToInt8: + zero = builder.makeInt8Constant(0); + one = builder.makeInt8Constant(1); + convOp = spv::OpSelect; + break; + + case glslang::EOpConvBoolToUint8: + zero = builder.makeUint8Constant(0); + one = builder.makeUint8Constant(1); + convOp = spv::OpSelect; + break; + + case glslang::EOpConvBoolToInt16: + zero = builder.makeInt16Constant(0); + one = builder.makeInt16Constant(1); + convOp = spv::OpSelect; + break; + + case glslang::EOpConvBoolToUint16: + zero = builder.makeUint16Constant(0); + one = builder.makeUint16Constant(1); + convOp = spv::OpSelect; + break; case glslang::EOpConvBoolToInt: case glslang::EOpConvBoolToInt64: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvBoolToInt16: -#endif if (op == glslang::EOpConvBoolToInt64) zero = builder.makeInt64Constant(0); -#ifdef AMD_EXTENSIONS - else if (op == glslang::EOpConvBoolToInt16) - zero = builder.makeInt16Constant(0); -#endif else zero = builder.makeIntConstant(0); if (op == glslang::EOpConvBoolToInt64) one = builder.makeInt64Constant(1); -#ifdef AMD_EXTENSIONS - else if (op == glslang::EOpConvBoolToInt16) - one = builder.makeInt16Constant(1); -#endif else one = builder.makeIntConstant(1); @@ -4496,104 +5563,94 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec case glslang::EOpConvBoolToUint: case glslang::EOpConvBoolToUint64: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvBoolToUint16: -#endif if (op == glslang::EOpConvBoolToUint64) zero = builder.makeUint64Constant(0); -#ifdef AMD_EXTENSIONS - else if (op == glslang::EOpConvBoolToUint16) - zero = builder.makeUint16Constant(0); -#endif else zero = builder.makeUintConstant(0); if (op == glslang::EOpConvBoolToUint64) one = builder.makeUint64Constant(1); -#ifdef AMD_EXTENSIONS - else if (op == glslang::EOpConvBoolToUint16) - one = builder.makeUint16Constant(1); -#endif else one = builder.makeUintConstant(1); convOp = spv::OpSelect; break; + case glslang::EOpConvInt8ToFloat16: + case glslang::EOpConvInt8ToFloat: + case glslang::EOpConvInt8ToDouble: + case glslang::EOpConvInt16ToFloat16: + case glslang::EOpConvInt16ToFloat: + case glslang::EOpConvInt16ToDouble: + case glslang::EOpConvIntToFloat16: case glslang::EOpConvIntToFloat: case glslang::EOpConvIntToDouble: case glslang::EOpConvInt64ToFloat: case glslang::EOpConvInt64ToDouble: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvInt16ToFloat: - case glslang::EOpConvInt16ToDouble: - case glslang::EOpConvInt16ToFloat16: - case glslang::EOpConvIntToFloat16: case glslang::EOpConvInt64ToFloat16: -#endif convOp = spv::OpConvertSToF; break; + case glslang::EOpConvUint8ToFloat16: + case glslang::EOpConvUint8ToFloat: + case glslang::EOpConvUint8ToDouble: + case glslang::EOpConvUint16ToFloat16: + case glslang::EOpConvUint16ToFloat: + case glslang::EOpConvUint16ToDouble: + case glslang::EOpConvUintToFloat16: case glslang::EOpConvUintToFloat: case glslang::EOpConvUintToDouble: case glslang::EOpConvUint64ToFloat: case glslang::EOpConvUint64ToDouble: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvUint16ToFloat: - case glslang::EOpConvUint16ToDouble: - case glslang::EOpConvUint16ToFloat16: - case glslang::EOpConvUintToFloat16: case glslang::EOpConvUint64ToFloat16: -#endif convOp = spv::OpConvertUToF; break; case glslang::EOpConvDoubleToFloat: case glslang::EOpConvFloatToDouble: -#ifdef AMD_EXTENSIONS case glslang::EOpConvDoubleToFloat16: case glslang::EOpConvFloat16ToDouble: case glslang::EOpConvFloatToFloat16: case glslang::EOpConvFloat16ToFloat: -#endif convOp = spv::OpFConvert; if (builder.isMatrixType(destType)) - return createUnaryMatrixOperation(convOp, precision, noContraction, destType, operand, typeProxy); + return createUnaryMatrixOperation(convOp, decorations, destType, operand, typeProxy); break; - case glslang::EOpConvFloatToInt: - case glslang::EOpConvDoubleToInt: - case glslang::EOpConvFloatToInt64: - case glslang::EOpConvDoubleToInt64: -#ifdef AMD_EXTENSIONS + case glslang::EOpConvFloat16ToInt8: + case glslang::EOpConvFloatToInt8: + case glslang::EOpConvDoubleToInt8: + case glslang::EOpConvFloat16ToInt16: case glslang::EOpConvFloatToInt16: case glslang::EOpConvDoubleToInt16: - case glslang::EOpConvFloat16ToInt16: case glslang::EOpConvFloat16ToInt: + case glslang::EOpConvFloatToInt: + case glslang::EOpConvDoubleToInt: case glslang::EOpConvFloat16ToInt64: -#endif + case glslang::EOpConvFloatToInt64: + case glslang::EOpConvDoubleToInt64: convOp = spv::OpConvertFToS; break; + case glslang::EOpConvUint8ToInt8: + case glslang::EOpConvInt8ToUint8: + case glslang::EOpConvUint16ToInt16: + case glslang::EOpConvInt16ToUint16: case glslang::EOpConvUintToInt: case glslang::EOpConvIntToUint: case glslang::EOpConvUint64ToInt64: case glslang::EOpConvInt64ToUint64: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvUint16ToInt16: - case glslang::EOpConvInt16ToUint16: -#endif if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. - if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) - zero = builder.makeUint64Constant(0); -#ifdef AMD_EXTENSIONS - else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) + if(op == glslang::EOpConvUint8ToInt8 || op == glslang::EOpConvInt8ToUint8) { + zero = builder.makeUint8Constant(0); + } else if (op == glslang::EOpConvUint16ToInt16 || op == glslang::EOpConvInt16ToUint16) { zero = builder.makeUint16Constant(0); -#endif - else + } else if (op == glslang::EOpConvUint64ToInt64 || op == glslang::EOpConvInt64ToUint64) { + zero = builder.makeUint64Constant(0); + } else { zero = builder.makeUintConstant(0); - + } zero = makeSmearedConstant(zero, vectorSize); // Use OpIAdd, instead of OpBitcast to do the conversion when // generating for OpSpecConstantOp instruction. @@ -4603,126 +5660,117 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec convOp = spv::OpBitcast; break; + case glslang::EOpConvFloat16ToUint8: + case glslang::EOpConvFloatToUint8: + case glslang::EOpConvDoubleToUint8: + case glslang::EOpConvFloat16ToUint16: + case glslang::EOpConvFloatToUint16: + case glslang::EOpConvDoubleToUint16: + case glslang::EOpConvFloat16ToUint: case glslang::EOpConvFloatToUint: case glslang::EOpConvDoubleToUint: case glslang::EOpConvFloatToUint64: case glslang::EOpConvDoubleToUint64: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvFloatToUint16: - case glslang::EOpConvDoubleToUint16: - case glslang::EOpConvFloat16ToUint16: - case glslang::EOpConvFloat16ToUint: case glslang::EOpConvFloat16ToUint64: -#endif convOp = spv::OpConvertFToU; break; - case glslang::EOpConvIntToInt64: - case glslang::EOpConvInt64ToInt: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvIntToInt16: + case glslang::EOpConvInt8ToInt16: + case glslang::EOpConvInt8ToInt: + case glslang::EOpConvInt8ToInt64: + case glslang::EOpConvInt16ToInt8: case glslang::EOpConvInt16ToInt: - case glslang::EOpConvInt64ToInt16: case glslang::EOpConvInt16ToInt64: -#endif + case glslang::EOpConvIntToInt8: + case glslang::EOpConvIntToInt16: + case glslang::EOpConvIntToInt64: + case glslang::EOpConvInt64ToInt8: + case glslang::EOpConvInt64ToInt16: + case glslang::EOpConvInt64ToInt: convOp = spv::OpSConvert; break; - case glslang::EOpConvUintToUint64: - case glslang::EOpConvUint64ToUint: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvUintToUint16: + case glslang::EOpConvUint8ToUint16: + case glslang::EOpConvUint8ToUint: + case glslang::EOpConvUint8ToUint64: + case glslang::EOpConvUint16ToUint8: case glslang::EOpConvUint16ToUint: - case glslang::EOpConvUint64ToUint16: case glslang::EOpConvUint16ToUint64: -#endif + case glslang::EOpConvUintToUint8: + case glslang::EOpConvUintToUint16: + case glslang::EOpConvUintToUint64: + case glslang::EOpConvUint64ToUint8: + case glslang::EOpConvUint64ToUint16: + case glslang::EOpConvUint64ToUint: convOp = spv::OpUConvert; break; - case glslang::EOpConvIntToUint64: - case glslang::EOpConvInt64ToUint: - case glslang::EOpConvUint64ToInt: - case glslang::EOpConvUintToInt64: -#ifdef AMD_EXTENSIONS + case glslang::EOpConvInt8ToUint16: + case glslang::EOpConvInt8ToUint: + case glslang::EOpConvInt8ToUint64: + case glslang::EOpConvInt16ToUint8: case glslang::EOpConvInt16ToUint: - case glslang::EOpConvUintToInt16: case glslang::EOpConvInt16ToUint64: - case glslang::EOpConvUint64ToInt16: - case glslang::EOpConvUint16ToInt: + case glslang::EOpConvIntToUint8: case glslang::EOpConvIntToUint16: - case glslang::EOpConvUint16ToInt64: + case glslang::EOpConvIntToUint64: + case glslang::EOpConvInt64ToUint8: case glslang::EOpConvInt64ToUint16: -#endif + case glslang::EOpConvInt64ToUint: + case glslang::EOpConvUint8ToInt16: + case glslang::EOpConvUint8ToInt: + case glslang::EOpConvUint8ToInt64: + case glslang::EOpConvUint16ToInt8: + case glslang::EOpConvUint16ToInt: + case glslang::EOpConvUint16ToInt64: + case glslang::EOpConvUintToInt8: + case glslang::EOpConvUintToInt16: + case glslang::EOpConvUintToInt64: + case glslang::EOpConvUint64ToInt8: + case glslang::EOpConvUint64ToInt16: + case glslang::EOpConvUint64ToInt: // OpSConvert/OpUConvert + OpBitCast - switch (op) { - case glslang::EOpConvIntToUint64: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvInt16ToUint64: -#endif - convOp = spv::OpSConvert; - type = builder.makeIntType(64); - break; - case glslang::EOpConvInt64ToUint: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvInt16ToUint: -#endif - convOp = spv::OpSConvert; - type = builder.makeIntType(32); - break; - case glslang::EOpConvUint64ToInt: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvUint16ToInt: -#endif - convOp = spv::OpUConvert; - type = builder.makeUintType(32); - break; - case glslang::EOpConvUintToInt64: -#ifdef AMD_EXTENSIONS - case glslang::EOpConvUint16ToInt64: -#endif - convOp = spv::OpUConvert; - type = builder.makeUintType(64); - break; -#ifdef AMD_EXTENSIONS - case glslang::EOpConvUintToInt16: - case glslang::EOpConvUint64ToInt16: - convOp = spv::OpUConvert; - type = builder.makeUintType(16); - break; - case glslang::EOpConvIntToUint16: - case glslang::EOpConvInt64ToUint16: - convOp = spv::OpSConvert; - type = builder.makeIntType(16); - break; -#endif - default: - assert(0); - break; - } - - if (vectorSize > 0) - type = builder.makeVectorType(type, vectorSize); - - operand = builder.createUnaryOp(convOp, type, operand); + operand = createIntWidthConversion(op, operand, vectorSize); if (builder.isInSpecConstCodeGenMode()) { // Build zero scalar or vector for OpIAdd. -#ifdef AMD_EXTENSIONS - if (op == glslang::EOpConvIntToUint64 || op == glslang::EOpConvUintToInt64 || - op == glslang::EOpConvInt16ToUint64 || op == glslang::EOpConvUint16ToInt64) - zero = builder.makeUint64Constant(0); - else if (op == glslang::EOpConvIntToUint16 || op == glslang::EOpConvUintToInt16 || - op == glslang::EOpConvInt64ToUint16 || op == glslang::EOpConvUint64ToInt16) + switch(op) { + case glslang::EOpConvInt16ToUint8: + case glslang::EOpConvIntToUint8: + case glslang::EOpConvInt64ToUint8: + case glslang::EOpConvUint16ToInt8: + case glslang::EOpConvUintToInt8: + case glslang::EOpConvUint64ToInt8: + zero = builder.makeUint8Constant(0); + break; + case glslang::EOpConvInt8ToUint16: + case glslang::EOpConvIntToUint16: + case glslang::EOpConvInt64ToUint16: + case glslang::EOpConvUint8ToInt16: + case glslang::EOpConvUintToInt16: + case glslang::EOpConvUint64ToInt16: zero = builder.makeUint16Constant(0); - else + break; + case glslang::EOpConvInt8ToUint: + case glslang::EOpConvInt16ToUint: + case glslang::EOpConvInt64ToUint: + case glslang::EOpConvUint8ToInt: + case glslang::EOpConvUint16ToInt: + case glslang::EOpConvUint64ToInt: zero = builder.makeUintConstant(0); -#else - if (op == glslang::EOpConvIntToUint64 || op == glslang::EOpConvUintToInt64) + break; + case glslang::EOpConvInt8ToUint64: + case glslang::EOpConvInt16ToUint64: + case glslang::EOpConvIntToUint64: + case glslang::EOpConvUint8ToInt64: + case glslang::EOpConvUint16ToInt64: + case glslang::EOpConvUintToInt64: zero = builder.makeUint64Constant(0); - else - zero = builder.makeUintConstant(0); -#endif - + break; + default: + assert(false && "Default missing"); + break; + } zero = makeSmearedConstant(zero, vectorSize); // Use OpIAdd, instead of OpBitcast to do the conversion when // generating for OpSpecConstantOp instruction. @@ -4746,7 +5794,9 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec } else result = builder.createUnaryOp(convOp, destType, operand); - return builder.setPrecision(result, precision); + result = builder.setPrecision(result, decorations.precision); + builder.addDecoration(result, decorations.nonUniform); + return result; } spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vectorSize) @@ -4817,8 +5867,14 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv opCode = spv::OpAtomicIDecrement; break; case glslang::EOpAtomicCounter: + case glslang::EOpImageAtomicLoad: + case glslang::EOpAtomicLoad: opCode = spv::OpAtomicLoad; break; + case glslang::EOpAtomicStore: + case glslang::EOpImageAtomicStore: + opCode = spv::OpAtomicStore; + break; default: assert(0); break; @@ -4829,48 +5885,94 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv // Sort out the operands // - mapping from glslang -> SPV - // - there are extra SPV operands with no glslang source + // - there are extra SPV operands that are optional in glslang // - compare-exchange swaps the value and comparator // - compare-exchange has an extra memory semantics // - EOpAtomicCounterDecrement needs a post decrement - std::vector spvAtomicOperands; // hold the spv operands - auto opIt = operands.begin(); // walk the glslang operands - spvAtomicOperands.push_back(*(opIt++)); - spvAtomicOperands.push_back(builder.makeUintConstant(spv::ScopeDevice)); // TBD: what is the correct scope? - spvAtomicOperands.push_back(builder.makeUintConstant(spv::MemorySemanticsMaskNone)); // TBD: what are the correct memory semantics? - if (opCode == spv::OpAtomicCompareExchange) { - // There are 2 memory semantics for compare-exchange. And the operand order of "comparator" and "new value" in GLSL - // differs from that in SPIR-V. Hence, special processing is required. - spvAtomicOperands.push_back(builder.makeUintConstant(spv::MemorySemanticsMaskNone)); - spvAtomicOperands.push_back(*(opIt + 1)); - spvAtomicOperands.push_back(*opIt); - opIt += 2; + spv::Id pointerId = 0, compareId = 0, valueId = 0; + // scope defaults to Device in the old model, QueueFamilyKHR in the new model + spv::Id scopeId; + if (glslangIntermediate->usingVulkanMemoryModel()) { + scopeId = builder.makeUintConstant(spv::ScopeQueueFamilyKHR); + } else { + scopeId = builder.makeUintConstant(spv::ScopeDevice); + } + // semantics default to relaxed + spv::Id semanticsId = builder.makeUintConstant(spv::MemorySemanticsMaskNone); + spv::Id semanticsId2 = semanticsId; + + pointerId = operands[0]; + if (opCode == spv::OpAtomicIIncrement || opCode == spv::OpAtomicIDecrement) { + // no additional operands + } else if (opCode == spv::OpAtomicCompareExchange) { + compareId = operands[1]; + valueId = operands[2]; + if (operands.size() > 3) { + scopeId = operands[3]; + semanticsId = builder.makeUintConstant(builder.getConstantScalar(operands[4]) | builder.getConstantScalar(operands[5])); + semanticsId2 = builder.makeUintConstant(builder.getConstantScalar(operands[6]) | builder.getConstantScalar(operands[7])); + } + } else if (opCode == spv::OpAtomicLoad) { + if (operands.size() > 1) { + scopeId = operands[1]; + semanticsId = builder.makeUintConstant(builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3])); + } + } else { + // atomic store or RMW + valueId = operands[1]; + if (operands.size() > 2) { + scopeId = operands[2]; + semanticsId = builder.makeUintConstant(builder.getConstantScalar(operands[3]) | builder.getConstantScalar(operands[4])); + } } - // Add the rest of the operands, skipping any that were dealt with above. - for (; opIt != operands.end(); ++opIt) - spvAtomicOperands.push_back(*opIt); + // Check for capabilities + unsigned semanticsImmediate = builder.getConstantScalar(semanticsId) | builder.getConstantScalar(semanticsId2); + if (semanticsImmediate & (spv::MemorySemanticsMakeAvailableKHRMask | spv::MemorySemanticsMakeVisibleKHRMask | spv::MemorySemanticsOutputMemoryKHRMask)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } - spv::Id resultId = builder.createOp(opCode, typeId, spvAtomicOperands); + if (glslangIntermediate->usingVulkanMemoryModel() && builder.getConstantScalar(scopeId) == spv::ScopeDevice) { + builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); + } - // GLSL and HLSL atomic-counter decrement return post-decrement value, - // while SPIR-V returns pre-decrement value. Translate between these semantics. - if (op == glslang::EOpAtomicCounterDecrement) - resultId = builder.createBinOp(spv::OpISub, typeId, resultId, builder.makeIntConstant(1)); + std::vector spvAtomicOperands; // hold the spv operands + spvAtomicOperands.push_back(pointerId); + spvAtomicOperands.push_back(scopeId); + spvAtomicOperands.push_back(semanticsId); + if (opCode == spv::OpAtomicCompareExchange) { + spvAtomicOperands.push_back(semanticsId2); + spvAtomicOperands.push_back(valueId); + spvAtomicOperands.push_back(compareId); + } else if (opCode != spv::OpAtomicLoad && opCode != spv::OpAtomicIIncrement && opCode != spv::OpAtomicIDecrement) { + spvAtomicOperands.push_back(valueId); + } - return resultId; + if (opCode == spv::OpAtomicStore) { + builder.createNoResultOp(opCode, spvAtomicOperands); + return 0; + } else { + spv::Id resultId = builder.createOp(opCode, typeId, spvAtomicOperands); + + // GLSL and HLSL atomic-counter decrement return post-decrement value, + // while SPIR-V returns pre-decrement value. Translate between these semantics. + if (op == glslang::EOpAtomicCounterDecrement) + resultId = builder.createBinOp(spv::OpISub, typeId, resultId, builder.makeIntConstant(1)); + + return resultId; + } } // Create group invocation operations. spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy) { #ifdef AMD_EXTENSIONS - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16; + bool isUnsigned = isTypeUnsignedInt(typeProxy); + bool isFloat = isTypeFloat(typeProxy); #endif spv::Op opCode = spv::OpNop; - std::vector spvGroupOperands; + std::vector spvGroupOperands; spv::GroupOperation groupOperation = spv::GroupOperationMax; if (op == glslang::EOpBallot || op == glslang::EOpReadFirstInvocation || @@ -4897,7 +5999,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op builder.addExtension(spv::E_SPV_AMD_shader_ballot); #endif - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); #ifdef AMD_EXTENSIONS switch (op) { case glslang::EOpMinInvocations: @@ -4907,7 +6008,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op case glslang::EOpMaxInvocationsNonUniform: case glslang::EOpAddInvocationsNonUniform: groupOperation = spv::GroupOperationReduce; - spvGroupOperands.push_back(groupOperation); break; case glslang::EOpMinInvocationsInclusiveScan: case glslang::EOpMaxInvocationsInclusiveScan: @@ -4916,7 +6016,6 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op case glslang::EOpMaxInvocationsInclusiveScanNonUniform: case glslang::EOpAddInvocationsInclusiveScanNonUniform: groupOperation = spv::GroupOperationInclusiveScan; - spvGroupOperands.push_back(groupOperation); break; case glslang::EOpMinInvocationsExclusiveScan: case glslang::EOpMaxInvocationsExclusiveScan: @@ -4925,16 +6024,23 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op case glslang::EOpMaxInvocationsExclusiveScanNonUniform: case glslang::EOpAddInvocationsExclusiveScanNonUniform: groupOperation = spv::GroupOperationExclusiveScan; - spvGroupOperands.push_back(groupOperation); break; default: break; } + spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(scope); + if (groupOperation != spv::GroupOperationMax) { + spv::IdImmediate groupOp = { false, (unsigned)groupOperation }; + spvGroupOperands.push_back(groupOp); + } #endif } - for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) - spvGroupOperands.push_back(*opIt); + for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) { + spv::IdImmediate op = { true, *opIt }; + spvGroupOperands.push_back(op); + } switch (op) { case glslang::EOpAnyInvocation: @@ -5073,7 +6179,8 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op } // Create group invocation operations on a vector -spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, spv::Id typeId, std::vector& operands) +spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv::GroupOperation groupOperation, + spv::Id typeId, std::vector& operands) { #ifdef AMD_EXTENSIONS assert(op == spv::OpGroupFMin || op == spv::OpGroupUMin || op == spv::OpGroupSMin || @@ -5106,18 +6213,23 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv for (int comp = 0; comp < numComponents; ++comp) { std::vector indexes; indexes.push_back(comp); - spv::Id scalar = builder.createCompositeExtract(operands[0], scalarType, indexes); - std::vector spvGroupOperands; + spv::IdImmediate scalar = { true, builder.createCompositeExtract(operands[0], scalarType, indexes) }; + std::vector spvGroupOperands; if (op == spv::OpSubgroupReadInvocationKHR) { spvGroupOperands.push_back(scalar); - spvGroupOperands.push_back(operands[1]); + spv::IdImmediate operand = { true, operands[1] }; + spvGroupOperands.push_back(operand); } else if (op == spv::OpGroupBroadcast) { - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); + spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(scope); spvGroupOperands.push_back(scalar); - spvGroupOperands.push_back(operands[1]); + spv::IdImmediate operand = { true, operands[1] }; + spvGroupOperands.push_back(operand); } else { - spvGroupOperands.push_back(builder.makeUintConstant(spv::ScopeSubgroup)); - spvGroupOperands.push_back(groupOperation); + spv::IdImmediate scope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(scope); + spv::IdImmediate groupOp = { false, (unsigned)groupOperation }; + spvGroupOperands.push_back(groupOp); spvGroupOperands.push_back(scalar); } @@ -5128,15 +6240,370 @@ spv::Id TGlslangToSpvTraverser::CreateInvocationsVectorOperation(spv::Op op, spv return builder.createCompositeConstruct(typeId, results); } +// Create subgroup invocation operations. +spv::Id TGlslangToSpvTraverser::createSubgroupOperation(glslang::TOperator op, spv::Id typeId, + std::vector& operands, glslang::TBasicType typeProxy) +{ + // Add the required capabilities. + switch (op) { + case glslang::EOpSubgroupElect: + builder.addCapability(spv::CapabilityGroupNonUniform); + break; + case glslang::EOpSubgroupAll: + case glslang::EOpSubgroupAny: + case glslang::EOpSubgroupAllEqual: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformVote); + break; + case glslang::EOpSubgroupBroadcast: + case glslang::EOpSubgroupBroadcastFirst: + case glslang::EOpSubgroupBallot: + case glslang::EOpSubgroupInverseBallot: + case glslang::EOpSubgroupBallotBitExtract: + case glslang::EOpSubgroupBallotBitCount: + case glslang::EOpSubgroupBallotInclusiveBitCount: + case glslang::EOpSubgroupBallotExclusiveBitCount: + case glslang::EOpSubgroupBallotFindLSB: + case glslang::EOpSubgroupBallotFindMSB: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformBallot); + break; + case glslang::EOpSubgroupShuffle: + case glslang::EOpSubgroupShuffleXor: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformShuffle); + break; + case glslang::EOpSubgroupShuffleUp: + case glslang::EOpSubgroupShuffleDown: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformShuffleRelative); + break; + case glslang::EOpSubgroupAdd: + case glslang::EOpSubgroupMul: + case glslang::EOpSubgroupMin: + case glslang::EOpSubgroupMax: + case glslang::EOpSubgroupAnd: + case glslang::EOpSubgroupOr: + case glslang::EOpSubgroupXor: + case glslang::EOpSubgroupInclusiveAdd: + case glslang::EOpSubgroupInclusiveMul: + case glslang::EOpSubgroupInclusiveMin: + case glslang::EOpSubgroupInclusiveMax: + case glslang::EOpSubgroupInclusiveAnd: + case glslang::EOpSubgroupInclusiveOr: + case glslang::EOpSubgroupInclusiveXor: + case glslang::EOpSubgroupExclusiveAdd: + case glslang::EOpSubgroupExclusiveMul: + case glslang::EOpSubgroupExclusiveMin: + case glslang::EOpSubgroupExclusiveMax: + case glslang::EOpSubgroupExclusiveAnd: + case glslang::EOpSubgroupExclusiveOr: + case glslang::EOpSubgroupExclusiveXor: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformArithmetic); + break; + case glslang::EOpSubgroupClusteredAdd: + case glslang::EOpSubgroupClusteredMul: + case glslang::EOpSubgroupClusteredMin: + case glslang::EOpSubgroupClusteredMax: + case glslang::EOpSubgroupClusteredAnd: + case glslang::EOpSubgroupClusteredOr: + case glslang::EOpSubgroupClusteredXor: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformClustered); + break; + case glslang::EOpSubgroupQuadBroadcast: + case glslang::EOpSubgroupQuadSwapHorizontal: + case glslang::EOpSubgroupQuadSwapVertical: + case glslang::EOpSubgroupQuadSwapDiagonal: + builder.addCapability(spv::CapabilityGroupNonUniform); + builder.addCapability(spv::CapabilityGroupNonUniformQuad); + break; +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedAdd: + case glslang::EOpSubgroupPartitionedMul: + case glslang::EOpSubgroupPartitionedMin: + case glslang::EOpSubgroupPartitionedMax: + case glslang::EOpSubgroupPartitionedAnd: + case glslang::EOpSubgroupPartitionedOr: + case glslang::EOpSubgroupPartitionedXor: + case glslang::EOpSubgroupPartitionedInclusiveAdd: + case glslang::EOpSubgroupPartitionedInclusiveMul: + case glslang::EOpSubgroupPartitionedInclusiveMin: + case glslang::EOpSubgroupPartitionedInclusiveMax: + case glslang::EOpSubgroupPartitionedInclusiveAnd: + case glslang::EOpSubgroupPartitionedInclusiveOr: + case glslang::EOpSubgroupPartitionedInclusiveXor: + case glslang::EOpSubgroupPartitionedExclusiveAdd: + case glslang::EOpSubgroupPartitionedExclusiveMul: + case glslang::EOpSubgroupPartitionedExclusiveMin: + case glslang::EOpSubgroupPartitionedExclusiveMax: + case glslang::EOpSubgroupPartitionedExclusiveAnd: + case glslang::EOpSubgroupPartitionedExclusiveOr: + case glslang::EOpSubgroupPartitionedExclusiveXor: + builder.addExtension(spv::E_SPV_NV_shader_subgroup_partitioned); + builder.addCapability(spv::CapabilityGroupNonUniformPartitionedNV); + break; +#endif + default: assert(0 && "Unhandled subgroup operation!"); + } + + const bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; + const bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; + const bool isBool = typeProxy == glslang::EbtBool; + + spv::Op opCode = spv::OpNop; + + // Figure out which opcode to use. + switch (op) { + case glslang::EOpSubgroupElect: opCode = spv::OpGroupNonUniformElect; break; + case glslang::EOpSubgroupAll: opCode = spv::OpGroupNonUniformAll; break; + case glslang::EOpSubgroupAny: opCode = spv::OpGroupNonUniformAny; break; + case glslang::EOpSubgroupAllEqual: opCode = spv::OpGroupNonUniformAllEqual; break; + case glslang::EOpSubgroupBroadcast: opCode = spv::OpGroupNonUniformBroadcast; break; + case glslang::EOpSubgroupBroadcastFirst: opCode = spv::OpGroupNonUniformBroadcastFirst; break; + case glslang::EOpSubgroupBallot: opCode = spv::OpGroupNonUniformBallot; break; + case glslang::EOpSubgroupInverseBallot: opCode = spv::OpGroupNonUniformInverseBallot; break; + case glslang::EOpSubgroupBallotBitExtract: opCode = spv::OpGroupNonUniformBallotBitExtract; break; + case glslang::EOpSubgroupBallotBitCount: + case glslang::EOpSubgroupBallotInclusiveBitCount: + case glslang::EOpSubgroupBallotExclusiveBitCount: opCode = spv::OpGroupNonUniformBallotBitCount; break; + case glslang::EOpSubgroupBallotFindLSB: opCode = spv::OpGroupNonUniformBallotFindLSB; break; + case glslang::EOpSubgroupBallotFindMSB: opCode = spv::OpGroupNonUniformBallotFindMSB; break; + case glslang::EOpSubgroupShuffle: opCode = spv::OpGroupNonUniformShuffle; break; + case glslang::EOpSubgroupShuffleXor: opCode = spv::OpGroupNonUniformShuffleXor; break; + case glslang::EOpSubgroupShuffleUp: opCode = spv::OpGroupNonUniformShuffleUp; break; + case glslang::EOpSubgroupShuffleDown: opCode = spv::OpGroupNonUniformShuffleDown; break; + case glslang::EOpSubgroupAdd: + case glslang::EOpSubgroupInclusiveAdd: + case glslang::EOpSubgroupExclusiveAdd: + case glslang::EOpSubgroupClusteredAdd: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedAdd: + case glslang::EOpSubgroupPartitionedInclusiveAdd: + case glslang::EOpSubgroupPartitionedExclusiveAdd: +#endif + if (isFloat) { + opCode = spv::OpGroupNonUniformFAdd; + } else { + opCode = spv::OpGroupNonUniformIAdd; + } + break; + case glslang::EOpSubgroupMul: + case glslang::EOpSubgroupInclusiveMul: + case glslang::EOpSubgroupExclusiveMul: + case glslang::EOpSubgroupClusteredMul: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedMul: + case glslang::EOpSubgroupPartitionedInclusiveMul: + case glslang::EOpSubgroupPartitionedExclusiveMul: +#endif + if (isFloat) { + opCode = spv::OpGroupNonUniformFMul; + } else { + opCode = spv::OpGroupNonUniformIMul; + } + break; + case glslang::EOpSubgroupMin: + case glslang::EOpSubgroupInclusiveMin: + case glslang::EOpSubgroupExclusiveMin: + case glslang::EOpSubgroupClusteredMin: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedMin: + case glslang::EOpSubgroupPartitionedInclusiveMin: + case glslang::EOpSubgroupPartitionedExclusiveMin: +#endif + if (isFloat) { + opCode = spv::OpGroupNonUniformFMin; + } else if (isUnsigned) { + opCode = spv::OpGroupNonUniformUMin; + } else { + opCode = spv::OpGroupNonUniformSMin; + } + break; + case glslang::EOpSubgroupMax: + case glslang::EOpSubgroupInclusiveMax: + case glslang::EOpSubgroupExclusiveMax: + case glslang::EOpSubgroupClusteredMax: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedMax: + case glslang::EOpSubgroupPartitionedInclusiveMax: + case glslang::EOpSubgroupPartitionedExclusiveMax: +#endif + if (isFloat) { + opCode = spv::OpGroupNonUniformFMax; + } else if (isUnsigned) { + opCode = spv::OpGroupNonUniformUMax; + } else { + opCode = spv::OpGroupNonUniformSMax; + } + break; + case glslang::EOpSubgroupAnd: + case glslang::EOpSubgroupInclusiveAnd: + case glslang::EOpSubgroupExclusiveAnd: + case glslang::EOpSubgroupClusteredAnd: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedAnd: + case glslang::EOpSubgroupPartitionedInclusiveAnd: + case glslang::EOpSubgroupPartitionedExclusiveAnd: +#endif + if (isBool) { + opCode = spv::OpGroupNonUniformLogicalAnd; + } else { + opCode = spv::OpGroupNonUniformBitwiseAnd; + } + break; + case glslang::EOpSubgroupOr: + case glslang::EOpSubgroupInclusiveOr: + case glslang::EOpSubgroupExclusiveOr: + case glslang::EOpSubgroupClusteredOr: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedOr: + case glslang::EOpSubgroupPartitionedInclusiveOr: + case glslang::EOpSubgroupPartitionedExclusiveOr: +#endif + if (isBool) { + opCode = spv::OpGroupNonUniformLogicalOr; + } else { + opCode = spv::OpGroupNonUniformBitwiseOr; + } + break; + case glslang::EOpSubgroupXor: + case glslang::EOpSubgroupInclusiveXor: + case glslang::EOpSubgroupExclusiveXor: + case glslang::EOpSubgroupClusteredXor: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedXor: + case glslang::EOpSubgroupPartitionedInclusiveXor: + case glslang::EOpSubgroupPartitionedExclusiveXor: +#endif + if (isBool) { + opCode = spv::OpGroupNonUniformLogicalXor; + } else { + opCode = spv::OpGroupNonUniformBitwiseXor; + } + break; + case glslang::EOpSubgroupQuadBroadcast: opCode = spv::OpGroupNonUniformQuadBroadcast; break; + case glslang::EOpSubgroupQuadSwapHorizontal: + case glslang::EOpSubgroupQuadSwapVertical: + case glslang::EOpSubgroupQuadSwapDiagonal: opCode = spv::OpGroupNonUniformQuadSwap; break; + default: assert(0 && "Unhandled subgroup operation!"); + } + + // get the right Group Operation + spv::GroupOperation groupOperation = spv::GroupOperationMax; + switch (op) { + default: + break; + case glslang::EOpSubgroupBallotBitCount: + case glslang::EOpSubgroupAdd: + case glslang::EOpSubgroupMul: + case glslang::EOpSubgroupMin: + case glslang::EOpSubgroupMax: + case glslang::EOpSubgroupAnd: + case glslang::EOpSubgroupOr: + case glslang::EOpSubgroupXor: + groupOperation = spv::GroupOperationReduce; + break; + case glslang::EOpSubgroupBallotInclusiveBitCount: + case glslang::EOpSubgroupInclusiveAdd: + case glslang::EOpSubgroupInclusiveMul: + case glslang::EOpSubgroupInclusiveMin: + case glslang::EOpSubgroupInclusiveMax: + case glslang::EOpSubgroupInclusiveAnd: + case glslang::EOpSubgroupInclusiveOr: + case glslang::EOpSubgroupInclusiveXor: + groupOperation = spv::GroupOperationInclusiveScan; + break; + case glslang::EOpSubgroupBallotExclusiveBitCount: + case glslang::EOpSubgroupExclusiveAdd: + case glslang::EOpSubgroupExclusiveMul: + case glslang::EOpSubgroupExclusiveMin: + case glslang::EOpSubgroupExclusiveMax: + case glslang::EOpSubgroupExclusiveAnd: + case glslang::EOpSubgroupExclusiveOr: + case glslang::EOpSubgroupExclusiveXor: + groupOperation = spv::GroupOperationExclusiveScan; + break; + case glslang::EOpSubgroupClusteredAdd: + case glslang::EOpSubgroupClusteredMul: + case glslang::EOpSubgroupClusteredMin: + case glslang::EOpSubgroupClusteredMax: + case glslang::EOpSubgroupClusteredAnd: + case glslang::EOpSubgroupClusteredOr: + case glslang::EOpSubgroupClusteredXor: + groupOperation = spv::GroupOperationClusteredReduce; + break; +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedAdd: + case glslang::EOpSubgroupPartitionedMul: + case glslang::EOpSubgroupPartitionedMin: + case glslang::EOpSubgroupPartitionedMax: + case glslang::EOpSubgroupPartitionedAnd: + case glslang::EOpSubgroupPartitionedOr: + case glslang::EOpSubgroupPartitionedXor: + groupOperation = spv::GroupOperationPartitionedReduceNV; + break; + case glslang::EOpSubgroupPartitionedInclusiveAdd: + case glslang::EOpSubgroupPartitionedInclusiveMul: + case glslang::EOpSubgroupPartitionedInclusiveMin: + case glslang::EOpSubgroupPartitionedInclusiveMax: + case glslang::EOpSubgroupPartitionedInclusiveAnd: + case glslang::EOpSubgroupPartitionedInclusiveOr: + case glslang::EOpSubgroupPartitionedInclusiveXor: + groupOperation = spv::GroupOperationPartitionedInclusiveScanNV; + break; + case glslang::EOpSubgroupPartitionedExclusiveAdd: + case glslang::EOpSubgroupPartitionedExclusiveMul: + case glslang::EOpSubgroupPartitionedExclusiveMin: + case glslang::EOpSubgroupPartitionedExclusiveMax: + case glslang::EOpSubgroupPartitionedExclusiveAnd: + case glslang::EOpSubgroupPartitionedExclusiveOr: + case glslang::EOpSubgroupPartitionedExclusiveXor: + groupOperation = spv::GroupOperationPartitionedExclusiveScanNV; + break; +#endif + } + + // build the instruction + std::vector spvGroupOperands; + + // Every operation begins with the Execution Scope operand. + spv::IdImmediate executionScope = { true, builder.makeUintConstant(spv::ScopeSubgroup) }; + spvGroupOperands.push_back(executionScope); + + // Next, for all operations that use a Group Operation, push that as an operand. + if (groupOperation != spv::GroupOperationMax) { + spv::IdImmediate groupOperand = { false, (unsigned)groupOperation }; + spvGroupOperands.push_back(groupOperand); + } + + // Push back the operands next. + for (auto opIt = operands.cbegin(); opIt != operands.cend(); ++opIt) { + spv::IdImmediate operand = { true, *opIt }; + spvGroupOperands.push_back(operand); + } + + // Some opcodes have additional operands. + spv::Id directionId = spv::NoResult; + switch (op) { + default: break; + case glslang::EOpSubgroupQuadSwapHorizontal: directionId = builder.makeUintConstant(0); break; + case glslang::EOpSubgroupQuadSwapVertical: directionId = builder.makeUintConstant(1); break; + case glslang::EOpSubgroupQuadSwapDiagonal: directionId = builder.makeUintConstant(2); break; + } + if (directionId != spv::NoResult) { + spv::IdImmediate direction = { true, directionId }; + spvGroupOperands.push_back(direction); + } + + return builder.createOp(opCode, typeId, spvGroupOperands); +} + spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, glslang::TBasicType typeProxy) { -#ifdef AMD_EXTENSIONS - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64 || typeProxy == glslang::EbtUint16; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble || typeProxy == glslang::EbtFloat16; -#else - bool isUnsigned = typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64; - bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; -#endif + bool isUnsigned = isTypeUnsignedInt(typeProxy); + bool isFloat = isTypeFloat(typeProxy); spv::Op opCode = spv::OpNop; int extBuiltins = -1; @@ -5228,11 +6695,17 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: libCall = spv::GLSLstd450Refract; break; case glslang::EOpInterpolateAtSample: - builder.addCapability(spv::CapabilityInterpolationFunction); +#ifdef AMD_EXTENSIONS + if (typeProxy == glslang::EbtFloat16) + builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); +#endif libCall = spv::GLSLstd450InterpolateAtSample; break; case glslang::EOpInterpolateAtOffset: - builder.addCapability(spv::CapabilityInterpolationFunction); +#ifdef AMD_EXTENSIONS + if (typeProxy == glslang::EbtFloat16) + builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); +#endif libCall = spv::GLSLstd450InterpolateAtOffset; break; case glslang::EOpAddCarry: @@ -5273,10 +6746,11 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: libCall = spv::GLSLstd450FrexpStruct; assert(builder.isPointerType(typeId1)); typeId1 = builder.getContainedTypeId(typeId1); -#ifdef AMD_EXTENSIONS int width = builder.getScalarTypeWidth(typeId1); -#else - int width = 32; +#ifdef AMD_EXTENSIONS + if (width == 16) + // Using 16-bit exp operand, enable extension SPV_AMD_gpu_shader_int16 + builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); #endif if (builder.getNumComponents(operands[0]) == 1) frexpIntType = builder.makeIntegerType(width, true); @@ -5293,6 +6767,45 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: case glslang::EOpReadInvocation: return createInvocationsOperation(op, typeId, operands, typeProxy); + case glslang::EOpSubgroupBroadcast: + case glslang::EOpSubgroupBallotBitExtract: + case glslang::EOpSubgroupShuffle: + case glslang::EOpSubgroupShuffleXor: + case glslang::EOpSubgroupShuffleUp: + case glslang::EOpSubgroupShuffleDown: + case glslang::EOpSubgroupClusteredAdd: + case glslang::EOpSubgroupClusteredMul: + case glslang::EOpSubgroupClusteredMin: + case glslang::EOpSubgroupClusteredMax: + case glslang::EOpSubgroupClusteredAnd: + case glslang::EOpSubgroupClusteredOr: + case glslang::EOpSubgroupClusteredXor: + case glslang::EOpSubgroupQuadBroadcast: +#ifdef NV_EXTENSIONS + case glslang::EOpSubgroupPartitionedAdd: + case glslang::EOpSubgroupPartitionedMul: + case glslang::EOpSubgroupPartitionedMin: + case glslang::EOpSubgroupPartitionedMax: + case glslang::EOpSubgroupPartitionedAnd: + case glslang::EOpSubgroupPartitionedOr: + case glslang::EOpSubgroupPartitionedXor: + case glslang::EOpSubgroupPartitionedInclusiveAdd: + case glslang::EOpSubgroupPartitionedInclusiveMul: + case glslang::EOpSubgroupPartitionedInclusiveMin: + case glslang::EOpSubgroupPartitionedInclusiveMax: + case glslang::EOpSubgroupPartitionedInclusiveAnd: + case glslang::EOpSubgroupPartitionedInclusiveOr: + case glslang::EOpSubgroupPartitionedInclusiveXor: + case glslang::EOpSubgroupPartitionedExclusiveAdd: + case glslang::EOpSubgroupPartitionedExclusiveMul: + case glslang::EOpSubgroupPartitionedExclusiveMin: + case glslang::EOpSubgroupPartitionedExclusiveMax: + case glslang::EOpSubgroupPartitionedExclusiveAnd: + case glslang::EOpSubgroupPartitionedExclusiveOr: + case glslang::EOpSubgroupPartitionedExclusiveXor: +#endif + return createSubgroupOperation(op, typeId, operands, typeProxy); + #ifdef AMD_EXTENSIONS case glslang::EOpSwizzleInvocations: extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_ballot); @@ -5342,11 +6855,71 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: break; case glslang::EOpInterpolateAtVertex: + if (typeProxy == glslang::EbtFloat16) + builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); extBuiltins = getExtBuiltins(spv::E_SPV_AMD_shader_explicit_vertex_parameter); libCall = spv::InterpolateAtVertexAMD; break; #endif + case glslang::EOpBarrier: + { + // This is for the extended controlBarrier function, with four operands. + // The unextended barrier() goes through createNoArgOperation. + assert(operands.size() == 4); + unsigned int executionScope = builder.getConstantScalar(operands[0]); + unsigned int memoryScope = builder.getConstantScalar(operands[1]); + unsigned int semantics = builder.getConstantScalar(operands[2]) | builder.getConstantScalar(operands[3]); + builder.createControlBarrier((spv::Scope)executionScope, (spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics); + if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask | spv::MemorySemanticsMakeVisibleKHRMask | spv::MemorySemanticsOutputMemoryKHRMask)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } + if (glslangIntermediate->usingVulkanMemoryModel() && (executionScope == spv::ScopeDevice || memoryScope == spv::ScopeDevice)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); + } + return 0; + } + break; + case glslang::EOpMemoryBarrier: + { + // This is for the extended memoryBarrier function, with three operands. + // The unextended memoryBarrier() goes through createNoArgOperation. + assert(operands.size() == 3); + unsigned int memoryScope = builder.getConstantScalar(operands[0]); + unsigned int semantics = builder.getConstantScalar(operands[1]) | builder.getConstantScalar(operands[2]); + builder.createMemoryBarrier((spv::Scope)memoryScope, (spv::MemorySemanticsMask)semantics); + if (semantics & (spv::MemorySemanticsMakeAvailableKHRMask | spv::MemorySemanticsMakeVisibleKHRMask | spv::MemorySemanticsOutputMemoryKHRMask)) { + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } + if (glslangIntermediate->usingVulkanMemoryModel() && memoryScope == spv::ScopeDevice) { + builder.addCapability(spv::CapabilityVulkanMemoryModelDeviceScopeKHR); + } + return 0; + } + break; +#ifdef NV_EXTENSIONS + case glslang::EOpReportIntersectionNV: + { + typeId = builder.makeBoolType(); + opCode = spv::OpReportIntersectionNV; + } + break; + case glslang::EOpTraceNV: + { + builder.createNoResultOp(spv::OpTraceNV, operands); + return 0; + } + break; + case glslang::EOpExecuteCallableNV: + { + builder.createNoResultOp(spv::OpExecuteCallableNV, operands); + return 0; + } + break; + case glslang::EOpWritePackedPrimitiveIndices4x8NV: + builder.createNoResultOp(spv::OpWritePackedPrimitiveIndices4x8NV, operands); + return 0; +#endif default: return 0; } @@ -5358,6 +6931,17 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: // We might need the remaining arguments, e.g. in the EOpFrexp case. std::vector callArguments(operands.begin(), operands.begin() + consumedOperands); id = builder.createBuiltinCall(typeId, extBuiltins >= 0 ? extBuiltins : stdBuiltins, libCall, callArguments); + } else if (opCode == spv::OpDot && !isFloat) { + // int dot(int, int) + // NOTE: never called for scalar/vector1, this is turned into simple mul before this can be reached + const int componentCount = builder.getNumComponents(operands[0]); + spv::Id mulOp = builder.createBinOp(spv::OpIMul, builder.getTypeId(operands[0]), operands[0], operands[1]); + builder.setPrecision(mulOp, precision); + id = builder.createCompositeExtract(mulOp, typeId, 0); + for (int i = 1; i < componentCount; ++i) { + builder.setPrecision(id, precision); + id = builder.createBinOp(spv::OpIAdd, typeId, id, builder.createCompositeExtract(operands[0], typeId, i)); + } } else { switch (consumedOperands) { case 0: @@ -5415,7 +6999,8 @@ spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv:: // Intrinsics with no arguments (or no return value, and no precision). spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId) { - // TODO: get the barrier operands correct + // GLSL memory barriers use queuefamily scope in new model, device scope in old model + spv::Scope memoryBarrierScope = glslangIntermediate->usingVulkanMemoryModel() ? spv::ScopeQueueFamilyKHR : spv::ScopeDevice; switch (op) { case glslang::EOpEmitVertex: @@ -5425,41 +7010,93 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: builder.createNoResultOp(spv::OpEndPrimitive); return 0; case glslang::EOpBarrier: - builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeDevice, spv::MemorySemanticsMaskNone); + if (glslangIntermediate->getStage() == EShLangTessControl) { + if (glslangIntermediate->usingVulkanMemoryModel()) { + builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeWorkgroup, + spv::MemorySemanticsOutputMemoryKHRMask | + spv::MemorySemanticsAcquireReleaseMask); + builder.addCapability(spv::CapabilityVulkanMemoryModelKHR); + } else { + builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeInvocation, spv::MemorySemanticsMaskNone); + } + } else { + builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeWorkgroup, + spv::MemorySemanticsWorkgroupMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + } return 0; case glslang::EOpMemoryBarrier: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsAllMemory); + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAllMemory | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpMemoryBarrierAtomicCounter: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsAtomicCounterMemoryMask); + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsAtomicCounterMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpMemoryBarrierBuffer: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsUniformMemoryMask); + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsUniformMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpMemoryBarrierImage: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsImageMemoryMask); + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsImageMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpMemoryBarrierShared: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsWorkgroupMemoryMask); + builder.createMemoryBarrier(memoryBarrierScope, spv::MemorySemanticsWorkgroupMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpGroupMemoryBarrier: - builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsCrossWorkgroupMemoryMask); + builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsAllMemory | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpAllMemoryBarrierWithGroupSync: - // Control barrier with non-"None" semantic is also a memory barrier. - builder.createControlBarrier(spv::ScopeDevice, spv::ScopeDevice, spv::MemorySemanticsAllMemory); + builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeDevice, + spv::MemorySemanticsAllMemory | + spv::MemorySemanticsAcquireReleaseMask); return 0; - case glslang::EOpGroupMemoryBarrierWithGroupSync: - // Control barrier with non-"None" semantic is also a memory barrier. - builder.createControlBarrier(spv::ScopeDevice, spv::ScopeDevice, spv::MemorySemanticsCrossWorkgroupMemoryMask); + case glslang::EOpDeviceMemoryBarrier: + builder.createMemoryBarrier(spv::ScopeDevice, spv::MemorySemanticsUniformMemoryMask | + spv::MemorySemanticsImageMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + return 0; + case glslang::EOpDeviceMemoryBarrierWithGroupSync: + builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeDevice, spv::MemorySemanticsUniformMemoryMask | + spv::MemorySemanticsImageMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpWorkgroupMemoryBarrier: - builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsWorkgroupMemoryMask); + builder.createMemoryBarrier(spv::ScopeWorkgroup, spv::MemorySemanticsWorkgroupMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; case glslang::EOpWorkgroupMemoryBarrierWithGroupSync: - // Control barrier with non-"None" semantic is also a memory barrier. - builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeWorkgroup, spv::MemorySemanticsWorkgroupMemoryMask); + builder.createControlBarrier(spv::ScopeWorkgroup, spv::ScopeWorkgroup, + spv::MemorySemanticsWorkgroupMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); return 0; + case glslang::EOpSubgroupBarrier: + builder.createControlBarrier(spv::ScopeSubgroup, spv::ScopeSubgroup, spv::MemorySemanticsAllMemory | + spv::MemorySemanticsAcquireReleaseMask); + return spv::NoResult; + case glslang::EOpSubgroupMemoryBarrier: + builder.createMemoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsAllMemory | + spv::MemorySemanticsAcquireReleaseMask); + return spv::NoResult; + case glslang::EOpSubgroupMemoryBarrierBuffer: + builder.createMemoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsUniformMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + return spv::NoResult; + case glslang::EOpSubgroupMemoryBarrierImage: + builder.createMemoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsImageMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + return spv::NoResult; + case glslang::EOpSubgroupMemoryBarrierShared: + builder.createMemoryBarrier(spv::ScopeSubgroup, spv::MemorySemanticsWorkgroupMemoryMask | + spv::MemorySemanticsAcquireReleaseMask); + return spv::NoResult; + case glslang::EOpSubgroupElect: { + std::vector operands; + return createSubgroupOperation(op, typeId, operands, glslang::EbtVoid); + } #ifdef AMD_EXTENSIONS case glslang::EOpTime: { @@ -5467,6 +7104,14 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: spv::Id id = builder.createBuiltinCall(typeId, getExtBuiltins(spv::E_SPV_AMD_gcn_shader), spv::TimeAMD, args); return builder.setPrecision(id, precision); } +#endif +#ifdef NV_EXTENSIONS + case glslang::EOpIgnoreIntersectionNV: + builder.createNoResultOp(spv::OpIgnoreIntersectionNV); + return 0; + case glslang::EOpTerminateRayNV: + builder.createNoResultOp(spv::OpTerminateRayNV); + return 0; #endif default: logger->missingFunctionality("unknown operation with no arguments"); @@ -5488,24 +7133,18 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol symbolValues[symbol->getId()] = id; if (symbol->getBasicType() != glslang::EbtBlock) { - addDecoration(id, TranslatePrecisionDecoration(symbol->getType())); - addDecoration(id, TranslateInterpolationDecoration(symbol->getType().getQualifier())); - addDecoration(id, TranslateAuxiliaryStorageDecoration(symbol->getType().getQualifier())); + builder.addDecoration(id, TranslatePrecisionDecoration(symbol->getType())); + builder.addDecoration(id, TranslateInterpolationDecoration(symbol->getType().getQualifier())); + builder.addDecoration(id, TranslateAuxiliaryStorageDecoration(symbol->getType().getQualifier())); +#ifdef NV_EXTENSIONS + addMeshNVDecoration(id, /*member*/ -1, symbol->getType().getQualifier()); +#endif if (symbol->getType().getQualifier().hasSpecConstantId()) - addDecoration(id, spv::DecorationSpecId, symbol->getType().getQualifier().layoutSpecConstantId); + builder.addDecoration(id, spv::DecorationSpecId, symbol->getType().getQualifier().layoutSpecConstantId); if (symbol->getQualifier().hasIndex()) builder.addDecoration(id, spv::DecorationIndex, symbol->getQualifier().layoutIndex); if (symbol->getQualifier().hasComponent()) builder.addDecoration(id, spv::DecorationComponent, symbol->getQualifier().layoutComponent); - if (glslangIntermediate->getXfbMode()) { - builder.addCapability(spv::CapabilityTransformFeedback); - if (symbol->getQualifier().hasXfbStride()) - builder.addDecoration(id, spv::DecorationXfbStride, symbol->getQualifier().layoutXfbStride); - if (symbol->getQualifier().hasXfbBuffer()) - builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer); - if (symbol->getQualifier().hasXfbOffset()) - builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutXfbOffset); - } // atomic counters use this: if (symbol->getQualifier().hasOffset()) builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutOffset); @@ -5513,7 +7152,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol if (symbol->getQualifier().hasLocation()) builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation); - addDecoration(id, TranslateInvariantDecoration(symbol->getType().getQualifier())); + builder.addDecoration(id, TranslateInvariantDecoration(symbol->getType().getQualifier())); if (symbol->getQualifier().hasStream() && glslangIntermediate->isMultiStream()) { builder.addCapability(spv::CapabilityGeometryStreams); builder.addDecoration(id, spv::DecorationStream, symbol->getQualifier().layoutStream); @@ -5530,23 +7169,30 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, spv::DecorationInputAttachmentIndex, symbol->getQualifier().layoutAttachment); if (glslangIntermediate->getXfbMode()) { builder.addCapability(spv::CapabilityTransformFeedback); - if (symbol->getQualifier().hasXfbStride()) - builder.addDecoration(id, spv::DecorationXfbStride, symbol->getQualifier().layoutXfbStride); - if (symbol->getQualifier().hasXfbBuffer()) + if (symbol->getQualifier().hasXfbBuffer()) { builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer); + unsigned stride = glslangIntermediate->getXfbStride(symbol->getQualifier().layoutXfbBuffer); + if (stride != glslang::TQualifier::layoutXfbStrideEnd) + builder.addDecoration(id, spv::DecorationXfbStride, stride); + } + if (symbol->getQualifier().hasXfbOffset()) + builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutXfbOffset); } if (symbol->getType().isImage()) { std::vector memory; - TranslateMemoryDecoration(symbol->getType().getQualifier(), memory); + TranslateMemoryDecoration(symbol->getType().getQualifier(), memory, glslangIntermediate->usingVulkanMemoryModel()); for (unsigned int i = 0; i < memory.size(); ++i) - addDecoration(id, memory[i]); + builder.addDecoration(id, memory[i]); } // built-in variable decorations spv::BuiltIn builtIn = TranslateBuiltInDecoration(symbol->getQualifier().builtIn, false); if (builtIn != spv::BuiltInMax) - addDecoration(id, spv::DecorationBuiltIn, (int)builtIn); + builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn); + + // nonuniform + builder.addDecoration(id, TranslateNonUniformDecoration(symbol->getType().getQualifier())); #ifdef NV_EXTENSIONS if (builtIn == spv::BuiltInSampleMask) { @@ -5556,7 +7202,7 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol decoration = (spv::Decoration)spv::DecorationOverrideCoverageNV; else decoration = (spv::Decoration)spv::DecorationMax; - addDecoration(id, decoration); + builder.addDecoration(id, decoration); if (decoration != spv::DecorationMax) { builder.addExtension(spv::E_SPV_NV_sample_mask_override_coverage); } @@ -5564,54 +7210,74 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol else if (builtIn == spv::BuiltInLayer) { // SPV_NV_viewport_array2 extension if (symbol->getQualifier().layoutViewportRelative) { - addDecoration(id, (spv::Decoration)spv::DecorationViewportRelativeNV); + builder.addDecoration(id, (spv::Decoration)spv::DecorationViewportRelativeNV); builder.addCapability(spv::CapabilityShaderViewportMaskNV); builder.addExtension(spv::E_SPV_NV_viewport_array2); } if (symbol->getQualifier().layoutSecondaryViewportRelativeOffset != -2048) { - addDecoration(id, (spv::Decoration)spv::DecorationSecondaryViewportRelativeNV, symbol->getQualifier().layoutSecondaryViewportRelativeOffset); + builder.addDecoration(id, (spv::Decoration)spv::DecorationSecondaryViewportRelativeNV, + symbol->getQualifier().layoutSecondaryViewportRelativeOffset); builder.addCapability(spv::CapabilityShaderStereoViewNV); builder.addExtension(spv::E_SPV_NV_stereo_view_rendering); } } if (symbol->getQualifier().layoutPassthrough) { - addDecoration(id, spv::DecorationPassthroughNV); + builder.addDecoration(id, spv::DecorationPassthroughNV); builder.addCapability(spv::CapabilityGeometryShaderPassthroughNV); builder.addExtension(spv::E_SPV_NV_geometry_shader_passthrough); } + if (symbol->getQualifier().pervertexNV) { + builder.addDecoration(id, spv::DecorationPerVertexNV); + builder.addCapability(spv::CapabilityFragmentBarycentricNV); + builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric); + } #endif + if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != nullptr) { + builder.addExtension("SPV_GOOGLE_hlsl_functionality1"); + builder.addDecoration(id, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE, + symbol->getType().getQualifier().semanticName); + } + return id; } -// If 'dec' is valid, add no-operand decoration to an object -void TGlslangToSpvTraverser::addDecoration(spv::Id id, spv::Decoration dec) +#ifdef NV_EXTENSIONS +// add per-primitive, per-view. per-task decorations to a struct member (member >= 0) or an object +void TGlslangToSpvTraverser::addMeshNVDecoration(spv::Id id, int member, const glslang::TQualifier& qualifier) { - if (dec != spv::DecorationMax) - builder.addDecoration(id, dec); -} - -// If 'dec' is valid, add a one-operand decoration to an object -void TGlslangToSpvTraverser::addDecoration(spv::Id id, spv::Decoration dec, unsigned value) -{ - if (dec != spv::DecorationMax) - builder.addDecoration(id, dec, value); -} - -// If 'dec' is valid, add a no-operand decoration to a struct member -void TGlslangToSpvTraverser::addMemberDecoration(spv::Id id, int member, spv::Decoration dec) -{ - if (dec != spv::DecorationMax) - builder.addMemberDecoration(id, (unsigned)member, dec); -} - -// If 'dec' is valid, add a one-operand decoration to a struct member -void TGlslangToSpvTraverser::addMemberDecoration(spv::Id id, int member, spv::Decoration dec, unsigned value) -{ - if (dec != spv::DecorationMax) - builder.addMemberDecoration(id, (unsigned)member, dec, value); + if (member >= 0) { + if (qualifier.perPrimitiveNV) { + // Need to add capability/extension for fragment shader. + // Mesh shader already adds this by default. + if (glslangIntermediate->getStage() == EShLangFragment) { + builder.addCapability(spv::CapabilityMeshShadingNV); + builder.addExtension(spv::E_SPV_NV_mesh_shader); + } + builder.addMemberDecoration(id, (unsigned)member, spv::DecorationPerPrimitiveNV); + } + if (qualifier.perViewNV) + builder.addMemberDecoration(id, (unsigned)member, spv::DecorationPerViewNV); + if (qualifier.perTaskNV) + builder.addMemberDecoration(id, (unsigned)member, spv::DecorationPerTaskNV); + } else { + if (qualifier.perPrimitiveNV) { + // Need to add capability/extension for fragment shader. + // Mesh shader already adds this by default. + if (glslangIntermediate->getStage() == EShLangFragment) { + builder.addCapability(spv::CapabilityMeshShadingNV); + builder.addExtension(spv::E_SPV_NV_mesh_shader); + } + builder.addDecoration(id, spv::DecorationPerPrimitiveNV); + } + if (qualifier.perViewNV) + builder.addDecoration(id, spv::DecorationPerViewNV); + if (qualifier.perTaskNV) + builder.addDecoration(id, spv::DecorationPerTaskNV); + } } +#endif // Make a full tree of instructions to build a SPIR-V specialization constant, // or regular constant if possible. @@ -5645,8 +7311,10 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n for (int dim = 0; dim < 3; ++dim) { bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet); dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst)); - if (specConst) - addDecoration(dimConstId.back(), spv::DecorationSpecId, glslangIntermediate->getLocalSizeSpecId(dim)); + if (specConst) { + builder.addDecoration(dimConstId.back(), spv::DecorationSpecId, + glslangIntermediate->getLocalSizeSpecId(dim)); + } } return builder.makeCompositeConstant(builder.makeVectorType(builder.makeUintType(32), 3), dimConstId, true); } @@ -5654,24 +7322,27 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n // An AST node labelled as specialization constant should be a symbol node. // Its initializer should either be a sub tree with constant nodes, or a constant union array. if (auto* sn = node.getAsSymbolNode()) { + spv::Id result; if (auto* sub_tree = sn->getConstSubtree()) { // Traverse the constant constructor sub tree like generating normal run-time instructions. // During the AST traversal, if the node is marked as 'specConstant', SpecConstantOpModeGuard // will set the builder into spec constant op instruction generating mode. sub_tree->traverse(this); - return accessChainLoad(sub_tree->getType()); - } else if (auto* const_union_array = &sn->getConstArray()){ + result = accessChainLoad(sub_tree->getType()); + } else if (auto* const_union_array = &sn->getConstArray()) { int nextConst = 0; - spv::Id id = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); - builder.addName(id, sn->getName().c_str()); - return id; + result = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); + } else { + logger->missingFunctionality("Invalid initializer for spec onstant."); + return spv::NoResult; } + builder.addName(result, sn->getName().c_str()); + return result; } // Neither a front-end constant node, nor a specialization constant node with constant union array or // constant sub tree as initializer. logger->missingFunctionality("Neither a front-end constant nor a spec constant."); - exit(1); return spv::NoResult; } @@ -5705,6 +7376,18 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla for (unsigned int i = 0; i < (unsigned int)glslangType.getVectorSize(); ++i) { bool zero = nextConst >= consts.size(); switch (glslangType.getBasicType()) { + case glslang::EbtInt8: + spvConsts.push_back(builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const())); + break; + case glslang::EbtUint8: + spvConsts.push_back(builder.makeUint8Constant(zero ? 0 : consts[nextConst].getU8Const())); + break; + case glslang::EbtInt16: + spvConsts.push_back(builder.makeInt16Constant(zero ? 0 : consts[nextConst].getI16Const())); + break; + case glslang::EbtUint16: + spvConsts.push_back(builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const())); + break; case glslang::EbtInt: spvConsts.push_back(builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst())); break; @@ -5717,25 +7400,15 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla case glslang::EbtUint64: spvConsts.push_back(builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const())); break; -#ifdef AMD_EXTENSIONS - case glslang::EbtInt16: - spvConsts.push_back(builder.makeInt16Constant(zero ? 0 : (short)consts[nextConst].getIConst())); - break; - case glslang::EbtUint16: - spvConsts.push_back(builder.makeUint16Constant(zero ? 0 : (unsigned short)consts[nextConst].getUConst())); - break; -#endif case glslang::EbtFloat: spvConsts.push_back(builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst())); break; case glslang::EbtDouble: spvConsts.push_back(builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst())); break; -#ifdef AMD_EXTENSIONS case glslang::EbtFloat16: spvConsts.push_back(builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst())); break; -#endif case glslang::EbtBool: spvConsts.push_back(builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst())); break; @@ -5750,6 +7423,18 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla bool zero = nextConst >= consts.size(); spv::Id scalar = 0; switch (glslangType.getBasicType()) { + case glslang::EbtInt8: + scalar = builder.makeInt8Constant(zero ? 0 : consts[nextConst].getI8Const(), specConstant); + break; + case glslang::EbtUint8: + scalar = builder.makeUint8Constant(zero ? 0 : consts[nextConst].getU8Const(), specConstant); + break; + case glslang::EbtInt16: + scalar = builder.makeInt16Constant(zero ? 0 : consts[nextConst].getI16Const(), specConstant); + break; + case glslang::EbtUint16: + scalar = builder.makeUint16Constant(zero ? 0 : consts[nextConst].getU16Const(), specConstant); + break; case glslang::EbtInt: scalar = builder.makeIntConstant(zero ? 0 : consts[nextConst].getIConst(), specConstant); break; @@ -5762,25 +7447,15 @@ spv::Id TGlslangToSpvTraverser::createSpvConstantFromConstUnionArray(const glsla case glslang::EbtUint64: scalar = builder.makeUint64Constant(zero ? 0 : consts[nextConst].getU64Const(), specConstant); break; -#ifdef AMD_EXTENSIONS - case glslang::EbtInt16: - scalar = builder.makeInt16Constant(zero ? 0 : (short)consts[nextConst].getIConst(), specConstant); - break; - case glslang::EbtUint16: - scalar = builder.makeUint16Constant(zero ? 0 : (unsigned short)consts[nextConst].getUConst(), specConstant); - break; -#endif case glslang::EbtFloat: scalar = builder.makeFloatConstant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); break; case glslang::EbtDouble: scalar = builder.makeDoubleConstant(zero ? 0.0 : consts[nextConst].getDConst(), specConstant); break; -#ifdef AMD_EXTENSIONS case glslang::EbtFloat16: scalar = builder.makeFloat16Constant(zero ? 0.0F : (float)consts[nextConst].getDConst(), specConstant); break; -#endif case glslang::EbtBool: scalar = builder.makeBoolConstant(zero ? false : consts[nextConst].getBConst(), specConstant); break; @@ -5927,6 +7602,7 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan return builder.createOp(spv::OpPhi, boolTypeId, phiOperands); } +#ifdef AMD_EXTENSIONS // Return type Id of the imported set of extended instructions corresponds to the name. // Import this set if it has not been imported yet. spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name) @@ -5940,6 +7616,7 @@ spv::Id TGlslangToSpvTraverser::getExtBuiltins(const char* name) return extBuiltins; } } +#endif }; // end anonymous namespace @@ -5958,7 +7635,14 @@ void GetSpirvVersion(std::string& version) // or a different instruction sequence to do something gets used). int GetSpirvGeneratorVersion() { - return 2; + // return 1; // start + // return 2; // EOpAtomicCounterDecrement gets a post decrement, to map between GLSL -> SPIR-V + // return 3; // change/correct barrier-instruction operands, to match memory model group decisions + // return 4; // some deeper access chains: for dynamic vector component, and local Boolean component + // return 5; // make OpArrayLength result type be an int with signedness of 0 + // return 6; // revert version 5 change, which makes a different (new) kind of incorrect code, + // versions 4 and 6 each generate OpArrayLength as it has long been done + return 7; // GLSL volatile keyword maps to both SPIR-V decorations Volatile and Coherent } // Write SPIR-V out to a binary file @@ -5982,7 +7666,9 @@ void OutputSpvHex(const std::vector& spirv, const char* baseName, out.open(baseName, std::ios::binary | std::ios::out); if (out.fail()) printf("ERROR: Failed to open file: %s\n", baseName); - out << "\t// " GLSLANG_REVISION " " GLSLANG_DATE << std::endl; + out << "\t// " << + GetSpirvGeneratorVersion() << "." << GLSLANG_MINOR_VERSION << "." << GLSLANG_PATCH_LEVEL << + std::endl; if (varName != nullptr) { out << "\t #pragma once" << std::endl; out << "const uint32_t " << varName << "[] = {" << std::endl; @@ -6005,22 +7691,16 @@ void OutputSpvHex(const std::vector& spirv, const char* baseName, out.close(); } -#ifdef ENABLE_OPT -void errHandler(const std::string& str) { - std::cerr << str << std::endl; -} -#endif - // // Set up the glslang traversal // -void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, SpvOptions* options) +void GlslangToSpv(const TIntermediate& intermediate, std::vector& spirv, SpvOptions* options) { spv::SpvBuildLogger logger; GlslangToSpv(intermediate, spirv, &logger, options); } -void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, +void GlslangToSpv(const TIntermediate& intermediate, std::vector& spirv, spv::SpvBuildLogger* logger, SpvOptions* options) { TIntermNode* root = intermediate.getTreeRoot(); @@ -6028,62 +7708,32 @@ void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vectortraverse(&it); it.finishSpv(); it.dumpSpv(spirv); -#ifdef ENABLE_OPT +#if ENABLE_OPT // If from HLSL, run spirv-opt to "legalize" the SPIR-V for Vulkan // eg. forward and remove memory writes of opaque types. - if ((intermediate.getSource() == EShSourceHlsl || - options->optimizeSize) && - !options->disableOptimizer) { - spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + if ((intermediate.getSource() == EShSourceHlsl || options->optimizeSize) && !options->disableOptimizer) + SpirvToolsLegalize(intermediate, spirv, logger, options); - spvtools::Optimizer optimizer(target_env); - optimizer.SetMessageConsumer([](spv_message_level_t level, - const char* source, - const spv_position_t& position, - const char* message) { - std::cerr << StringifyMessage(level, source, position, message) - << std::endl; - }); + if (options->validate) + SpirvToolsValidate(intermediate, spirv, logger); - optimizer.RegisterPass(CreateInlineExhaustivePass()); - optimizer.RegisterPass(CreateLocalAccessChainConvertPass()); - optimizer.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()); - optimizer.RegisterPass(CreateLocalSingleStoreElimPass()); - optimizer.RegisterPass(CreateInsertExtractElimPass()); - optimizer.RegisterPass(CreateAggressiveDCEPass()); - optimizer.RegisterPass(CreateDeadBranchElimPass()); - optimizer.RegisterPass(CreateCFGCleanupPass()); - optimizer.RegisterPass(CreateBlockMergePass()); - optimizer.RegisterPass(CreateLocalMultiStoreElimPass()); - optimizer.RegisterPass(CreateInsertExtractElimPass()); - optimizer.RegisterPass(CreateAggressiveDCEPass()); - // TODO(greg-lunarg): Add this when AMD driver issues are resolved - // if (options->optimizeSize) - // optimizer.RegisterPass(CreateCommonUniformElimPass()); + if (options->disassemble) + SpirvToolsDisassemble(std::cout, spirv); - if (!optimizer.Run(spirv.data(), spirv.size(), &spirv)) - return; - - // Remove dead module-level objects: functions, types, vars - // TODO(greg-lunarg): Switch to spirv-opt versions when available - spv::spirvbin_t Remapper(0); - Remapper.registerErrorHandler(errHandler); - Remapper.remap(spirv, spv::spirvbin_t::DCE_ALL); - } #endif - glslang::GetThreadPoolAllocator().pop(); + GetThreadPoolAllocator().pop(); } }; // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h index 3a437137509..4169c12e987 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/GlslangToSpv.h @@ -34,10 +34,11 @@ #pragma once -#if _MSC_VER >= 1900 +#if defined(_MSC_VER) && _MSC_VER >= 1900 #pragma warning(disable : 4464) // relative include path contains '..' #endif +#include "SpvTools.h" #include "../glslang/Include/intermediate.h" #include @@ -47,14 +48,6 @@ namespace glslang { -struct SpvOptions { - SpvOptions() : generateDebugInfo(false), disableOptimizer(true), - optimizeSize(false) { } - bool generateDebugInfo; - bool disableOptimizer; - bool optimizeSize; -}; - void GetSpirvVersion(std::string&); int GetSpirvGeneratorVersion(); void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv, diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp index 4e45cbb83ec..fd0bb8950c6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SPVRemapper.cpp @@ -220,11 +220,11 @@ namespace spv { bool spirvbin_t::isConstOp(spv::Op opCode) const { switch (opCode) { - case spv::OpConstantNull: case spv::OpConstantSampler: error("unimplemented constant type"); return true; + case spv::OpConstantNull: case spv::OpConstantTrue: case spv::OpConstantFalse: case spv::OpConstantComposite: @@ -256,7 +256,7 @@ namespace spv { spv::Id spirvbin_t::localId(spv::Id id, spv::Id newId) { - assert(id != spv::NoResult && newId != spv::NoResult); + //assert(id != spv::NoResult && newId != spv::NoResult); if (id > bound()) { error(std::string("ID out of range: ") + std::to_string(id)); @@ -1326,10 +1326,6 @@ namespace spv { case spv::OpTypeReserveId: return 300002; case spv::OpTypeQueue: return 300003; case spv::OpTypePipe: return 300004; - - case spv::OpConstantNull: return 300005; - case spv::OpConstantSampler: return 300006; - case spv::OpConstantTrue: return 300007; case spv::OpConstantFalse: return 300008; case spv::OpConstantComposite: @@ -1346,6 +1342,18 @@ namespace spv { hash += w * spv[typeStart+w]; return hash; } + case spv::OpConstantNull: + { + std::uint32_t hash = 500009 + hashType(idPos(spv[typeStart+1])); + return hash; + } + case spv::OpConstantSampler: + { + std::uint32_t hash = 600011 + hashType(idPos(spv[typeStart+1])); + for (unsigned w=3; w < wordCount; ++w) + hash += w * spv[typeStart+w]; + return hash; + } default: error("unknown type opcode"); diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp index c795ca8945c..951d104923e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.cpp @@ -46,9 +46,7 @@ #include "SpvBuilder.h" -#ifdef AMD_EXTENSIONS - #include "hex_float.h" -#endif +#include "hex_float.h" #ifndef _WIN32 #include @@ -56,7 +54,8 @@ namespace spv { -Builder::Builder(unsigned int magicNumber, SpvBuildLogger* buildLogger) : +Builder::Builder(unsigned int spvVersion, unsigned int magicNumber, SpvBuildLogger* buildLogger) : + spvVersion(spvVersion), source(SourceLanguageUnknown), sourceVersion(0), sourceFileStringId(NoResult), @@ -82,6 +81,7 @@ Id Builder::import(const char* name) { Instruction* import = new Instruction(getUniqueId(), NoType, OpExtInstImport); import->addStringOperand(name); + module.mapInstruction(import); imports.push_back(std::unique_ptr(import)); return import->getResultId(); @@ -193,8 +193,9 @@ Id Builder::makeIntegerType(int width, bool hasSign) // deal with capabilities switch (width) { + case 8: case 16: - addCapability(CapabilityInt16); + // these are currently handled by storage-type declarations and post processing break; case 64: addCapability(CapabilityInt64); @@ -226,7 +227,7 @@ Id Builder::makeFloatType(int width) // deal with capabilities switch (width) { case 16: - addCapability(CapabilityFloat16); + // currently handled by storage-type declarations and post processing break; case 64: addCapability(CapabilityFloat64); @@ -502,12 +503,27 @@ Id Builder::makeSampledImageType(Id imageType) return type->getResultId(); } +#ifdef NV_EXTENSIONS +Id Builder::makeAccelerationStructureNVType() +{ + Instruction *type; + if (groupedTypes[OpTypeAccelerationStructureNV].size() == 0) { + type = new Instruction(getUniqueId(), NoType, OpTypeAccelerationStructureNV); + constantsTypesGlobals.push_back(std::unique_ptr(type)); + module.mapInstruction(type); + } else { + type = groupedTypes[OpTypeAccelerationStructureNV].back(); + } + + return type->getResultId(); +} +#endif Id Builder::getDerefTypeId(Id resultId) const { Id typeId = getTypeId(resultId); assert(isPointerType(typeId)); - return module.getInstruction(typeId)->getImmediateOperand(1); + return module.getInstruction(typeId)->getIdOperand(1); } Op Builder::getMostBasicTypeClass(Id typeId) const @@ -517,12 +533,6 @@ Op Builder::getMostBasicTypeClass(Id typeId) const Op typeClass = instr->getOpCode(); switch (typeClass) { - case OpTypeVoid: - case OpTypeBool: - case OpTypeInt: - case OpTypeFloat: - case OpTypeStruct: - return typeClass; case OpTypeVector: case OpTypeMatrix: case OpTypeArray: @@ -531,8 +541,7 @@ Op Builder::getMostBasicTypeClass(Id typeId) const case OpTypePointer: return getMostBasicTypeClass(instr->getIdOperand(1)); default: - assert(0); - return OpTypeFloat; + return typeClass; } } @@ -551,7 +560,7 @@ int Builder::getNumTypeConstituents(Id typeId) const return instr->getImmediateOperand(1); case OpTypeArray: { - Id lengthId = instr->getImmediateOperand(1); + Id lengthId = instr->getIdOperand(1); return module.getInstruction(lengthId)->getImmediateOperand(0); } case OpTypeStruct: @@ -619,9 +628,39 @@ Id Builder::getContainedTypeId(Id typeId) const return getContainedTypeId(typeId, 0); } +// Returns true if 'typeId' is or contains a scalar type declared with 'typeOp' +// of width 'width'. The 'width' is only consumed for int and float types. +// Returns false otherwise. +bool Builder::containsType(Id typeId, spv::Op typeOp, unsigned int width) const +{ + const Instruction& instr = *module.getInstruction(typeId); + + Op typeClass = instr.getOpCode(); + switch (typeClass) + { + case OpTypeInt: + case OpTypeFloat: + return typeClass == typeOp && instr.getImmediateOperand(0) == width; + case OpTypeStruct: + for (int m = 0; m < instr.getNumOperands(); ++m) { + if (containsType(instr.getIdOperand(m), typeOp, width)) + return true; + } + return false; + case OpTypeVector: + case OpTypeMatrix: + case OpTypeArray: + case OpTypeRuntimeArray: + case OpTypePointer: + return containsType(getContainedTypeId(typeId), typeOp, width); + default: + return typeClass == typeOp; + } +} + // See if a scalar constant of this type has already been created, so it // can be reused rather than duplicated. (Required by the specification). -Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const +Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) { Instruction* constant; for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { @@ -636,7 +675,7 @@ Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned valu } // Version of findScalarConstant (see above) for scalars that take two operands (e.g. a 'double' or 'int64'). -Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const +Id Builder::findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) { Instruction* constant; for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { @@ -818,7 +857,6 @@ Id Builder::makeDoubleConstant(double d, bool specConstant) return c->getResultId(); } -#ifdef AMD_EXTENSIONS Id Builder::makeFloat16Constant(float f16, bool specConstant) { Op opcode = specConstant ? OpSpecConstant : OpConstant; @@ -846,9 +884,27 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant) return c->getResultId(); } -#endif -Id Builder::findCompositeConstant(Op typeClass, const std::vector& comps) const +Id Builder::makeFpConstant(Id type, double d, bool specConstant) +{ + assert(isFloatType(type)); + + switch (getScalarTypeWidth(type)) { + case 16: + return makeFloat16Constant((float)d, specConstant); + case 32: + return makeFloatConstant((float)d, specConstant); + case 64: + return makeDoubleConstant(d, specConstant); + default: + break; + } + + assert(false); + return NoResult; +} + +Id Builder::findCompositeConstant(Op typeClass, const std::vector& comps) { Instruction* constant = 0; bool found = false; @@ -876,6 +932,30 @@ Id Builder::findCompositeConstant(Op typeClass, const std::vector& comps) co return found ? constant->getResultId() : NoResult; } +Id Builder::findStructConstant(Id typeId, const std::vector& comps) +{ + Instruction* constant = 0; + bool found = false; + for (int i = 0; i < (int)groupedStructConstants[typeId].size(); ++i) { + constant = groupedStructConstants[typeId][i]; + + // same contents? + bool mismatch = false; + for (int op = 0; op < constant->getNumOperands(); ++op) { + if (constant->getIdOperand(op) != comps[op]) { + mismatch = true; + break; + } + } + if (! mismatch) { + found = true; + break; + } + } + + return found ? constant->getResultId() : NoResult; +} + // Comments in header Id Builder::makeCompositeConstant(Id typeId, const std::vector& members, bool specConstant) { @@ -886,25 +966,33 @@ Id Builder::makeCompositeConstant(Id typeId, const std::vector& members, boo switch (typeClass) { case OpTypeVector: case OpTypeArray: - case OpTypeStruct: case OpTypeMatrix: + if (! specConstant) { + Id existing = findCompositeConstant(typeClass, members); + if (existing) + return existing; + } + break; + case OpTypeStruct: + if (! specConstant) { + Id existing = findStructConstant(typeId, members); + if (existing) + return existing; + } break; default: assert(0); return makeFloatConstant(0.0); } - if (! specConstant) { - Id existing = findCompositeConstant(typeClass, members); - if (existing) - return existing; - } - Instruction* c = new Instruction(getUniqueId(), typeId, opcode); for (int op = 0; op < (int)members.size(); ++op) c->addIdOperand(members[op]); constantsTypesGlobals.push_back(std::unique_ptr(c)); - groupedConstants[typeClass].push_back(c); + if (typeClass == OpTypeStruct) + groupedStructConstants[typeId].push_back(c); + else + groupedConstants[typeClass].push_back(c); module.mapInstruction(c); return c->getResultId(); @@ -961,6 +1049,7 @@ void Builder::addDecoration(Id id, Decoration decoration, int num) { if (decoration == spv::DecorationMax) return; + Instruction* dec = new Instruction(OpDecorate); dec->addIdOperand(id); dec->addImmediateOperand(decoration); @@ -970,8 +1059,37 @@ void Builder::addDecoration(Id id, Decoration decoration, int num) decorations.push_back(std::unique_ptr(dec)); } +void Builder::addDecoration(Id id, Decoration decoration, const char* s) +{ + if (decoration == spv::DecorationMax) + return; + + Instruction* dec = new Instruction(OpDecorateStringGOOGLE); + dec->addIdOperand(id); + dec->addImmediateOperand(decoration); + dec->addStringOperand(s); + + decorations.push_back(std::unique_ptr(dec)); +} + +void Builder::addDecorationId(Id id, Decoration decoration, Id idDecoration) +{ + if (decoration == spv::DecorationMax) + return; + + Instruction* dec = new Instruction(OpDecorateId); + dec->addIdOperand(id); + dec->addImmediateOperand(decoration); + dec->addIdOperand(idDecoration); + + decorations.push_back(std::unique_ptr(dec)); +} + void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, int num) { + if (decoration == spv::DecorationMax) + return; + Instruction* dec = new Instruction(OpMemberDecorate); dec->addIdOperand(id); dec->addImmediateOperand(member); @@ -982,6 +1100,20 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat decorations.push_back(std::unique_ptr(dec)); } +void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const char *s) +{ + if (decoration == spv::DecorationMax) + return; + + Instruction* dec = new Instruction(OpMemberDecorateStringGOOGLE); + dec->addIdOperand(id); + dec->addImmediateOperand(member); + dec->addImmediateOperand(decoration); + dec->addStringOperand(s); + + decorations.push_back(std::unique_ptr(dec)); +} + // Comments in header Function* Builder::makeEntryPoint(const char* entryPoint) { @@ -1099,19 +1231,35 @@ Id Builder::createUndefined(Id type) } // Comments in header -void Builder::createStore(Id rValue, Id lValue) +void Builder::createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope) { Instruction* store = new Instruction(OpStore); store->addIdOperand(lValue); store->addIdOperand(rValue); + + if (memoryAccess != MemoryAccessMaskNone) { + store->addImmediateOperand(memoryAccess); + if (memoryAccess & spv::MemoryAccessMakePointerAvailableKHRMask) { + store->addIdOperand(makeUintConstant(scope)); + } + } + buildPoint->addInstruction(std::unique_ptr(store)); } // Comments in header -Id Builder::createLoad(Id lValue) +Id Builder::createLoad(Id lValue, spv::MemoryAccessMask memoryAccess, spv::Scope scope) { Instruction* load = new Instruction(getUniqueId(), getDerefTypeId(lValue), OpLoad); load->addIdOperand(lValue); + + if (memoryAccess != MemoryAccessMaskNone) { + load->addImmediateOperand(memoryAccess); + if (memoryAccess & spv::MemoryAccessMakePointerVisibleKHRMask) { + load->addIdOperand(makeUintConstant(scope)); + } + } + buildPoint->addInstruction(std::unique_ptr(load)); return load->getResultId(); @@ -1145,7 +1293,7 @@ Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vec Id Builder::createArrayLength(Id base, unsigned int member) { - spv::Id intType = makeIntType(32); + spv::Id intType = makeUintType(32); Instruction* length = new Instruction(getUniqueId(), intType, OpArrayLength); length->addIdOperand(base); length->addImmediateOperand(member); @@ -1236,7 +1384,7 @@ void Builder::createNoResultOp(Op opCode) buildPoint->addInstruction(std::unique_ptr(op)); } -// An opcode that has one operand, no result id, and no type +// An opcode that has one id operand, no result id, and no type void Builder::createNoResultOp(Op opCode, Id operand) { Instruction* op = new Instruction(opCode); @@ -1244,29 +1392,43 @@ void Builder::createNoResultOp(Op opCode, Id operand) buildPoint->addInstruction(std::unique_ptr(op)); } -// An opcode that has one operand, no result id, and no type +// An opcode that has one or more operands, no result id, and no type void Builder::createNoResultOp(Op opCode, const std::vector& operands) { Instruction* op = new Instruction(opCode); - for (auto it = operands.cbegin(); it != operands.cend(); ++it) + for (auto it = operands.cbegin(); it != operands.cend(); ++it) { op->addIdOperand(*it); + } + buildPoint->addInstruction(std::unique_ptr(op)); +} + +// An opcode that has multiple operands, no result id, and no type +void Builder::createNoResultOp(Op opCode, const std::vector& operands) +{ + Instruction* op = new Instruction(opCode); + for (auto it = operands.cbegin(); it != operands.cend(); ++it) { + if (it->isId) + op->addIdOperand(it->word); + else + op->addImmediateOperand(it->word); + } buildPoint->addInstruction(std::unique_ptr(op)); } void Builder::createControlBarrier(Scope execution, Scope memory, MemorySemanticsMask semantics) { Instruction* op = new Instruction(OpControlBarrier); - op->addImmediateOperand(makeUintConstant(execution)); - op->addImmediateOperand(makeUintConstant(memory)); - op->addImmediateOperand(makeUintConstant(semantics)); + op->addIdOperand(makeUintConstant(execution)); + op->addIdOperand(makeUintConstant(memory)); + op->addIdOperand(makeUintConstant(semantics)); buildPoint->addInstruction(std::unique_ptr(op)); } void Builder::createMemoryBarrier(unsigned executionScope, unsigned memorySemantics) { Instruction* op = new Instruction(OpMemoryBarrier); - op->addImmediateOperand(makeUintConstant(executionScope)); - op->addImmediateOperand(makeUintConstant(memorySemantics)); + op->addIdOperand(makeUintConstant(executionScope)); + op->addIdOperand(makeUintConstant(memorySemantics)); buildPoint->addInstruction(std::unique_ptr(op)); } @@ -1333,6 +1495,20 @@ Id Builder::createOp(Op opCode, Id typeId, const std::vector& operands) return op->getResultId(); } +Id Builder::createOp(Op opCode, Id typeId, const std::vector& operands) +{ + Instruction* op = new Instruction(getUniqueId(), typeId, opCode); + for (auto it = operands.cbegin(); it != operands.cend(); ++it) { + if (it->isId) + op->addIdOperand(it->word); + else + op->addImmediateOperand(it->word); + } + buildPoint->addInstruction(std::unique_ptr(op)); + + return op->getResultId(); +} + Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector& operands, const std::vector& literals) { Instruction* op = new Instruction(getUniqueId(), typeId, OpSpecConstantOp); @@ -1387,16 +1563,13 @@ Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, const std::vect return createCompositeInsert(source, target, typeId, channels.front()); Instruction* swizzle = new Instruction(getUniqueId(), typeId, OpVectorShuffle); + assert(isVector(target)); swizzle->addIdOperand(target); - if (accessChain.component != NoResult) - // For dynamic component selection, source does not involve in l-value swizzle - swizzle->addIdOperand(target); - else { - assert(getNumComponents(source) == (int)channels.size()); - assert(isVector(source)); - swizzle->addIdOperand(source); - } + + assert(getNumComponents(source) == (int)channels.size()); + assert(isVector(source)); + swizzle->addIdOperand(source); // Set up an identity shuffle from the base value to the result value unsigned int components[4]; @@ -1405,12 +1578,8 @@ Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, const std::vect components[i] = i; // Punch in the l-value swizzle - for (int i = 0; i < (int)channels.size(); ++i) { - if (accessChain.component != NoResult) - components[i] = channels[i]; // Only shuffle the base value - else - components[channels[i]] = numTargetComponents + i; - } + for (int i = 0; i < (int)channels.size(); ++i) + components[channels[i]] = numTargetComponents + i; // finish the instruction with these components selectors for (int i = 0; i < numTargetComponents; ++i) @@ -1482,7 +1651,8 @@ Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const // Accept all parameters needed to create a texture instruction. // Create the correct instruction based on the inputs, and make the call. -Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, bool noImplicitLod, const TextureParameters& parameters) +Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, bool fetch, bool proj, bool gather, + bool noImplicitLod, const TextureParameters& parameters) { static const int maxTextureArgs = 10; Id texArgs[maxTextureArgs] = {}; @@ -1499,6 +1669,13 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, if (parameters.component != NoResult) texArgs[numArgs++] = parameters.component; +#ifdef NV_EXTENSIONS + if (parameters.granularity != NoResult) + texArgs[numArgs++] = parameters.granularity; + if (parameters.coarse != NoResult) + texArgs[numArgs++] = parameters.coarse; +#endif + // // Set up the optional arguments // @@ -1535,6 +1712,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, texArgs[numArgs++] = parameters.offset; } if (parameters.offsets) { + addCapability(CapabilityImageGatherExtended); mask = (ImageOperandsMask)(mask | ImageOperandsConstOffsetsMask); texArgs[numArgs++] = parameters.offsets; } @@ -1549,6 +1727,12 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, mask = (ImageOperandsMask)(mask | ImageOperandsMinLodMask); texArgs[numArgs++] = parameters.lodClamp; } + if (parameters.nonprivate) { + mask = mask | ImageOperandsNonPrivateTexelKHRMask; + } + if (parameters.volatil) { + mask = mask | ImageOperandsVolatileTexelKHRMask; + } if (mask == ImageOperandsMaskNone) --numArgs; // undo speculative reservation for the mask argument else @@ -1563,6 +1747,10 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, opCode = OpImageSparseFetch; else opCode = OpImageFetch; +#ifdef NV_EXTENSIONS + } else if (parameters.granularity && parameters.coarse) { + opCode = OpImageSampleFootprintNV; +#endif } else if (gather) { if (parameters.Dref) if (sparse) @@ -1684,9 +1872,6 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool sparse, // Comments in header Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters, bool isUnsignedResult) { - // All these need a capability - addCapability(CapabilityImageQuery); - // Figure out the result type Id resultType = 0; switch (opCode) { @@ -1725,7 +1910,11 @@ Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameter break; } case OpImageQueryLod: +#ifdef AMD_EXTENSIONS + resultType = makeVectorType(getScalarTypeId(getTypeId(parameters.coords)), 2); +#else resultType = makeVectorType(makeFloatType(32), 2); +#endif break; case OpImageQueryLevels: case OpImageQuerySamples: @@ -1935,9 +2124,39 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& int numRows = getTypeNumRows(resultTypeId); Instruction* instr = module.getInstruction(componentTypeId); - Id bitCount = instr->getIdOperand(0); + unsigned bitCount = instr->getImmediateOperand(0); - // Will use a two step process + // Optimize matrix constructed from a bigger matrix + if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) { + // To truncate the matrix to a smaller number of rows/columns, we need to: + // 1. For each column, extract the column and truncate it to the required size using shuffle + // 2. Assemble the resulting matrix from all columns + Id matrix = sources[0]; + Id columnTypeId = getContainedTypeId(resultTypeId); + Id sourceColumnTypeId = getContainedTypeId(getTypeId(matrix)); + + std::vector channels; + for (int row = 0; row < numRows; ++row) + channels.push_back(row); + + std::vector matrixColumns; + for (int col = 0; col < numCols; ++col) { + std::vector indexes; + indexes.push_back(col); + Id colv = createCompositeExtract(matrix, sourceColumnTypeId, indexes); + setPrecision(colv, precision); + + if (numRows != getNumRows(matrix)) { + matrixColumns.push_back(createRvalueSwizzle(precision, columnTypeId, colv, channels)); + } else { + matrixColumns.push_back(colv); + } + } + + return setPrecision(createCompositeConstruct(resultTypeId, matrixColumns), precision); + } + + // Otherwise, will use a two step process // 1. make a compile-time 2D array of values // 2. construct a matrix from that array @@ -2191,6 +2410,7 @@ void Builder::clearAccessChain() accessChain.component = NoResult; accessChain.preSwizzleBaseType = NoType; accessChain.isRValue = false; + accessChain.coherentFlags.clear(); } // Comments in header @@ -2202,7 +2422,7 @@ void Builder::accessChainPushSwizzle(std::vector& swizzle, Id preSwizz accessChain.preSwizzleBaseType = preSwizzleBaseType; // if needed, propagate the swizzle for the current access chain - if (accessChain.swizzle.size()) { + if (accessChain.swizzle.size() > 0) { std::vector oldSwizzle = accessChain.swizzle; accessChain.swizzle.resize(0); for (unsigned int i = 0; i < swizzle.size(); ++i) { @@ -2217,40 +2437,34 @@ void Builder::accessChainPushSwizzle(std::vector& swizzle, Id preSwizz } // Comments in header -void Builder::accessChainStore(Id rvalue) +void Builder::accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess, spv::Scope scope) { assert(accessChain.isRValue == false); transferAccessChainSwizzle(true); Id base = collapseAccessChain(); + Id source = rvalue; + + // dynamic component should be gone + assert(accessChain.component == NoResult); // If swizzle still exists, it is out-of-order or not full, we must load the target vector, // extract and insert elements to perform writeMask and/or swizzle. - Id source = NoResult; - if (accessChain.swizzle.size()) { + if (accessChain.swizzle.size() > 0) { Id tempBaseId = createLoad(base); - source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, rvalue, accessChain.swizzle); + source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, source, accessChain.swizzle); } - // dynamic component selection - if (accessChain.component != NoResult) { - Id tempBaseId = (source == NoResult) ? createLoad(base) : source; - source = createVectorInsertDynamic(tempBaseId, getTypeId(tempBaseId), rvalue, accessChain.component); - } - - if (source == NoResult) - source = rvalue; - - createStore(source, base); + createStore(source, base, memoryAccess, scope); } // Comments in header -Id Builder::accessChainLoad(Decoration precision, Id resultType) +Id Builder::accessChainLoad(Decoration precision, Decoration nonUniform, Id resultType, spv::MemoryAccessMask memoryAccess, spv::Scope scope) { Id id; if (accessChain.isRValue) { - // transfer access chain, but keep it static, so we can stay in registers + // transfer access chain, but try to stay in registers transferAccessChainSwizzle(false); if (accessChain.indexChain.size() > 0) { Id swizzleBase = accessChain.preSwizzleBaseType != NoType ? accessChain.preSwizzleBaseType : resultType; @@ -2289,8 +2503,9 @@ Id Builder::accessChainLoad(Decoration precision, Id resultType) } else { transferAccessChainSwizzle(true); // load through the access chain - id = createLoad(collapseAccessChain()); + id = createLoad(collapseAccessChain(), memoryAccess, scope); setPrecision(id, precision); + addDecoration(id, nonUniform); } // Done, unless there are swizzles to do @@ -2298,19 +2513,20 @@ Id Builder::accessChainLoad(Decoration precision, Id resultType) return id; // Do remaining swizzling - // First, static swizzling - if (accessChain.swizzle.size()) { - // static swizzle + + // Do the basic swizzle + if (accessChain.swizzle.size() > 0) { Id swizzledType = getScalarTypeId(getTypeId(id)); if (accessChain.swizzle.size() > 1) swizzledType = makeVectorType(swizzledType, (int)accessChain.swizzle.size()); id = createRvalueSwizzle(precision, swizzledType, id, accessChain.swizzle); } - // dynamic single-component selection + // Do the dynamic component if (accessChain.component != NoResult) id = setPrecision(createVectorExtractDynamic(id, resultType, accessChain.component), precision); + addDecoration(id, nonUniform); return id; } @@ -2363,47 +2579,11 @@ Id Builder::accessChainGetInferredType() return type; } -// comment in header -void Builder::eliminateDeadDecorations() { - std::unordered_set reachable_blocks; - std::unordered_set unreachable_definitions; - // Collect IDs defined in unreachable blocks. For each function, label the - // reachable blocks first. Then for each unreachable block, collect the - // result IDs of the instructions in it. - for (std::vector::const_iterator fi = module.getFunctions().cbegin(); - fi != module.getFunctions().cend(); fi++) { - Function* f = *fi; - Block* entry = f->getEntryBlock(); - inReadableOrder(entry, [&reachable_blocks](const Block* b) { - reachable_blocks.insert(b); - }); - for (std::vector::const_iterator bi = f->getBlocks().cbegin(); - bi != f->getBlocks().cend(); bi++) { - Block* b = *bi; - if (!reachable_blocks.count(b)) { - for (std::vector >::const_iterator - ii = b->getInstructions().cbegin(); - ii != b->getInstructions().cend(); ii++) { - Instruction* i = ii->get(); - unreachable_definitions.insert(i->getResultId()); - } - } - } - } - decorations.erase(std::remove_if(decorations.begin(), decorations.end(), - [&unreachable_definitions](std::unique_ptr& I) -> bool { - Instruction* inst = I.get(); - Id decoration_id = inst->getIdOperand(0); - return unreachable_definitions.count(decoration_id) != 0; - }), - decorations.end()); -} - void Builder::dump(std::vector& out) const { // Header, before first instructions: out.push_back(MagicNumber); - out.push_back(Version); + out.push_back(spvVersion); out.push_back(builderNumber); out.push_back(uniqueId + 1); out.push_back(0); @@ -2433,7 +2613,6 @@ void Builder::dump(std::vector& out) const // Debug instructions dumpInstructions(out, strings); - dumpModuleProcesses(out); dumpSourceInstructions(out); for (int e = 0; e < (int)sourceExtensions.size(); ++e) { Instruction sourceExtInst(0, 0, OpSourceExtension); @@ -2441,7 +2620,7 @@ void Builder::dump(std::vector& out) const sourceExtInst.dump(out); } dumpInstructions(out, names); - dumpInstructions(out, lines); + dumpModuleProcesses(out); // Annotation instructions dumpInstructions(out, decorations); @@ -2457,26 +2636,66 @@ void Builder::dump(std::vector& out) const // Protected methods. // -// Turn the described access chain in 'accessChain' into an instruction +// Turn the described access chain in 'accessChain' into an instruction(s) // computing its address. This *cannot* include complex swizzles, which must -// be handled after this is called, but it does include swizzles that select -// an individual element, as a single address of a scalar type can be -// computed by an OpAccessChain instruction. +// be handled after this is called. +// +// Can generate code. Id Builder::collapseAccessChain() { assert(accessChain.isRValue == false); - if (accessChain.indexChain.size() > 0) { - if (accessChain.instr == 0) { - StorageClass storageClass = (StorageClass)module.getStorageClass(getTypeId(accessChain.base)); - accessChain.instr = createAccessChain(storageClass, accessChain.base, accessChain.indexChain); - } - + // did we already emit an access chain for this? + if (accessChain.instr != NoResult) return accessChain.instr; - } else + + // If we have a dynamic component, we can still transfer + // that into a final operand to the access chain. We need to remap the + // dynamic component through the swizzle to get a new dynamic component to + // update. + // + // This was not done in transferAccessChainSwizzle() because it might + // generate code. + remapDynamicSwizzle(); + if (accessChain.component != NoResult) { + // transfer the dynamic component to the access chain + accessChain.indexChain.push_back(accessChain.component); + accessChain.component = NoResult; + } + + // note that non-trivial swizzling is left pending + + // do we have an access chain? + if (accessChain.indexChain.size() == 0) return accessChain.base; - // note that non-trivial swizzling is left pending... + // emit the access chain + StorageClass storageClass = (StorageClass)module.getStorageClass(getTypeId(accessChain.base)); + accessChain.instr = createAccessChain(storageClass, accessChain.base, accessChain.indexChain); + + return accessChain.instr; +} + +// For a dynamic component selection of a swizzle. +// +// Turn the swizzle and dynamic component into just a dynamic component. +// +// Generates code. +void Builder::remapDynamicSwizzle() +{ + // do we have a swizzle to remap a dynamic component through? + if (accessChain.component != NoResult && accessChain.swizzle.size() > 1) { + // build a vector of the swizzle for the component to map into + std::vector components; + for (int c = 0; c < (int)accessChain.swizzle.size(); ++c) + components.push_back(makeUintConstant(accessChain.swizzle[c])); + Id mapType = makeVectorType(makeUintType(32), (int)accessChain.swizzle.size()); + Id map = makeCompositeConstant(mapType, components); + + // use it + accessChain.component = createVectorExtractDynamic(map, makeUintType(32), accessChain.component); + accessChain.swizzle.clear(); + } } // clear out swizzle if it is redundant, that is reselecting the same components @@ -2502,38 +2721,30 @@ void Builder::simplifyAccessChainSwizzle() // To the extent any swizzling can become part of the chain // of accesses instead of a post operation, make it so. -// If 'dynamic' is true, include transferring a non-static component index, -// otherwise, only transfer static indexes. +// If 'dynamic' is true, include transferring the dynamic component, +// otherwise, leave it pending. // -// Also, Boolean vectors are likely to be special. While -// for external storage, they should only be integer types, -// function-local bool vectors could use sub-word indexing, -// so keep that as a separate Insert/Extract on a loaded vector. +// Does not generate code. just updates the access chain. void Builder::transferAccessChainSwizzle(bool dynamic) { - // too complex? - if (accessChain.swizzle.size() > 1) - return; - // non existent? if (accessChain.swizzle.size() == 0 && accessChain.component == NoResult) return; - // single component... - - // skip doing it for Boolean vectors - if (isBoolType(getContainedTypeId(accessChain.preSwizzleBaseType))) + // too complex? + // (this requires either a swizzle, or generating code for a dynamic component) + if (accessChain.swizzle.size() > 1) return; + // single component, either in the swizzle and/or dynamic component if (accessChain.swizzle.size() == 1) { - // handle static component + assert(accessChain.component == NoResult); + // handle static component selection accessChain.indexChain.push_back(makeUintConstant(accessChain.swizzle.front())); accessChain.swizzle.clear(); - // note, the only valid remaining dynamic access would be to this one - // component, so don't bother even looking at accessChain.component accessChain.preSwizzleBaseType = NoType; - accessChain.component = NoResult; } else if (dynamic && accessChain.component != NoResult) { + assert(accessChain.swizzle.size() == 0); // handle dynamic component accessChain.indexChain.push_back(accessChain.component); accessChain.preSwizzleBaseType = NoType; @@ -2572,12 +2783,15 @@ void Builder::createSelectionMerge(Block* mergeBlock, unsigned int control) buildPoint->addInstruction(std::unique_ptr(merge)); } -void Builder::createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control) +void Builder::createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, + unsigned int dependencyLength) { Instruction* merge = new Instruction(OpLoopMerge); merge->addIdOperand(mergeBlock->getId()); merge->addIdOperand(continueBlock->getId()); merge->addImmediateOperand(control); + if ((control & LoopControlDependencyLengthMask) != 0) + merge->addImmediateOperand(dependencyLength); buildPoint->addInstruction(std::unique_ptr(merge)); } @@ -2644,8 +2858,6 @@ void Builder::dumpInstructions(std::vector& out, const std::vector void Builder::dumpModuleProcesses(std::vector& out) const { for (int i = 0; i < (int)moduleProcesses.size(); ++i) { - // TODO: switch this out for the 1.1 headers - const spv::Op OpModuleProcessed = (spv::Op)330; Instruction moduleProcessed(OpModuleProcessed); moduleProcessed.addStringOperand(moduleProcesses[i]); moduleProcessed.dump(out); diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h index 59b1da2eec3..7c1d421b378 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvBuilder.h @@ -1,6 +1,7 @@ // // Copyright (C) 2014-2015 LunarG, Inc. // Copyright (C) 2015-2016 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -55,16 +56,19 @@ #include #include #include +#include namespace spv { class Builder { public: - Builder(unsigned int userNumber, SpvBuildLogger* logger); + Builder(unsigned int spvVersion, unsigned int userNumber, SpvBuildLogger* logger); virtual ~Builder(); static const int maxMatrixSize = 4; + unsigned int getSpvVersion() const { return spvVersion; } + void setSource(spv::SourceLanguage lang, int version) { source = lang; @@ -127,6 +131,9 @@ public: Id makeSamplerType(); Id makeSampledImageType(Id imageType); + // accelerationStructureNV type + Id makeAccelerationStructureNVType(); + // For querying about types. Id getTypeId(Id resultId) const { return module.getTypeId(resultId); } Id getDerefTypeId(Id resultId) const; @@ -149,7 +156,7 @@ public: bool isAggregate(Id resultId) const { return isAggregateType(getTypeId(resultId)); } bool isSampledImage(Id resultId) const { return isSampledImageType(getTypeId(resultId)); } - bool isBoolType(Id typeId) const { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); } + bool isBoolType(Id typeId) { return groupedTypes[OpTypeBool].size() > 0 && typeId == groupedTypes[OpTypeBool].back()->getResultId(); } bool isIntType(Id typeId) const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) != 0; } bool isUintType(Id typeId) const { return getTypeClass(typeId) == OpTypeInt && module.getInstruction(typeId)->getImmediateOperand(1) == 0; } bool isFloatType(Id typeId) const { return getTypeClass(typeId) == OpTypeFloat; } @@ -163,6 +170,7 @@ public: bool isImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeImage; } bool isSamplerType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampler; } bool isSampledImageType(Id typeId) const { return getTypeClass(typeId) == OpTypeSampledImage; } + bool containsType(Id typeId, Op typeOp, unsigned int width) const; bool isConstantOpCode(Op opcode) const; bool isSpecConstantOpCode(Op opcode) const; @@ -211,19 +219,18 @@ public: // For making new constants (will return old constant if the requested one was already made). Id makeBoolConstant(bool b, bool specConstant = false); + Id makeInt8Constant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(8), (unsigned)i, specConstant); } + Id makeUint8Constant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(8), u, specConstant); } + Id makeInt16Constant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(16), (unsigned)i, specConstant); } + Id makeUint16Constant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(16), u, specConstant); } Id makeIntConstant(int i, bool specConstant = false) { return makeIntConstant(makeIntType(32), (unsigned)i, specConstant); } Id makeUintConstant(unsigned u, bool specConstant = false) { return makeIntConstant(makeUintType(32), u, specConstant); } Id makeInt64Constant(long long i, bool specConstant = false) { return makeInt64Constant(makeIntType(64), (unsigned long long)i, specConstant); } Id makeUint64Constant(unsigned long long u, bool specConstant = false) { return makeInt64Constant(makeUintType(64), u, specConstant); } -#ifdef AMD_EXTENSIONS - Id makeInt16Constant(short i, bool specConstant = false) { return makeIntConstant(makeIntType(16), (unsigned)((unsigned short)i), specConstant); } - Id makeUint16Constant(unsigned short u, bool specConstant = false) { return makeIntConstant(makeUintType(16), (unsigned)u, specConstant); } -#endif Id makeFloatConstant(float f, bool specConstant = false); Id makeDoubleConstant(double d, bool specConstant = false); -#ifdef AMD_EXTENSIONS Id makeFloat16Constant(float f16, bool specConstant = false); -#endif + Id makeFpConstant(Id type, double d, bool specConstant = false); // Turn the array of constants into a proper spv constant of the requested type. Id makeCompositeConstant(Id type, const std::vector& comps, bool specConst = false); @@ -234,7 +241,10 @@ public: void addName(Id, const char* name); void addMemberName(Id, int member, const char* name); void addDecoration(Id, Decoration, int num = -1); + void addDecoration(Id, Decoration, const char*); + void addDecorationId(Id id, Decoration, Id idDecoration); void addMemberDecoration(Id, unsigned int member, Decoration, int num = -1); + void addMemberDecoration(Id, unsigned int member, Decoration, const char*); // At the end of what block do the next create*() instructions go? void setBuildPoint(Block* bp) { buildPoint = bp; } @@ -267,10 +277,10 @@ public: Id createUndefined(Id type); // Store into an Id and return the l-value - void createStore(Id rValue, Id lValue); + void createStore(Id rValue, Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax); // Load from an Id and return it - Id createLoad(Id lValue); + Id createLoad(Id lValue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax); // Create an OpAccessChain instruction Id createAccessChain(StorageClass, Id base, const std::vector& offsets); @@ -290,12 +300,14 @@ public: void createNoResultOp(Op); void createNoResultOp(Op, Id operand); void createNoResultOp(Op, const std::vector& operands); + void createNoResultOp(Op, const std::vector& operands); void createControlBarrier(Scope execution, Scope memory, MemorySemanticsMask); void createMemoryBarrier(unsigned executionScope, unsigned memorySemantics); Id createUnaryOp(Op, Id typeId, Id operand); Id createBinOp(Op, Id typeId, Id operand1, Id operand2); Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); Id createOp(Op, Id typeId, const std::vector& operands); + Id createOp(Op, Id typeId, const std::vector& operands); Id createFunctionCall(spv::Function*, const std::vector&); Id createSpecConstantOp(Op, Id typeId, const std::vector& operands, const std::vector& literals); @@ -330,7 +342,7 @@ public: // Generally, the type of 'scalar' does not need to be the same type as the components in 'vector'. // The type of the created vector is a vector of components of the same type as the scalar. // - // Note: One of the arguments will change, with the result coming back that way rather than + // Note: One of the arguments will change, with the result coming back that way rather than // through the return value. void promoteScalar(Decoration precision, Id& left, Id& right); @@ -357,6 +369,10 @@ public: Id component; Id texelOut; Id lodClamp; + Id granularity; + Id coarse; + bool nonprivate; + bool volatil; }; // Select the correct texture operation based on all inputs, and emit the correct instruction @@ -496,6 +512,43 @@ public: Id component; // a dynamic component index, can coexist with a swizzle, done after the swizzle, NoResult if not present Id preSwizzleBaseType; // dereferenced type, before swizzle or component is applied; NoType unless a swizzle or component is present bool isRValue; // true if 'base' is an r-value, otherwise, base is an l-value + + // Accumulate whether anything in the chain of structures has coherent decorations. + struct CoherentFlags { + unsigned coherent : 1; + unsigned devicecoherent : 1; + unsigned queuefamilycoherent : 1; + unsigned workgroupcoherent : 1; + unsigned subgroupcoherent : 1; + unsigned nonprivate : 1; + unsigned volatil : 1; + unsigned isImage : 1; + + void clear() { + coherent = 0; + devicecoherent = 0; + queuefamilycoherent = 0; + workgroupcoherent = 0; + subgroupcoherent = 0; + nonprivate = 0; + volatil = 0; + isImage = 0; + } + + CoherentFlags() { clear(); } + CoherentFlags operator |=(const CoherentFlags &other) { + coherent |= other.coherent; + devicecoherent |= other.devicecoherent; + queuefamilycoherent |= other.queuefamilycoherent; + workgroupcoherent |= other.workgroupcoherent; + subgroupcoherent |= other.subgroupcoherent; + nonprivate |= other.nonprivate; + volatil |= other.volatil; + isImage |= other.isImage; + return *this; + } + }; + CoherentFlags coherentFlags; }; // @@ -525,27 +578,31 @@ public: } // push offset onto the end of the chain - void accessChainPush(Id offset) + void accessChainPush(Id offset, AccessChain::CoherentFlags coherentFlags) { accessChain.indexChain.push_back(offset); + accessChain.coherentFlags |= coherentFlags; } // push new swizzle onto the end of any existing swizzle, merging into a single swizzle void accessChainPushSwizzle(std::vector& swizzle, Id preSwizzleBaseType); - // push a variable component selection onto the access chain; supporting only one, so unsided + // push a dynamic component selection onto the access chain, only applicable with a + // non-trivial swizzle or no swizzle void accessChainPushComponent(Id component, Id preSwizzleBaseType) { - accessChain.component = component; - if (accessChain.preSwizzleBaseType == NoType) - accessChain.preSwizzleBaseType = preSwizzleBaseType; + if (accessChain.swizzle.size() != 1) { + accessChain.component = component; + if (accessChain.preSwizzleBaseType == NoType) + accessChain.preSwizzleBaseType = preSwizzleBaseType; + } } // use accessChain and swizzle to store value - void accessChainStore(Id rvalue); + void accessChainStore(Id rvalue, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax); // use accessChain and swizzle to load an r-value - Id accessChainLoad(Decoration precision, Id ResultType); + Id accessChainLoad(Decoration precision, Decoration nonUniform, Id ResultType, spv::MemoryAccessMask memoryAccess = spv::MemoryAccessMaskNone, spv::Scope scope = spv::ScopeMax); // get the direct pointer for an l-value Id accessChainGetLValue(); @@ -554,14 +611,22 @@ public: // based on the type of the base and the chain of dereferences. Id accessChainGetInferredType(); - // Remove OpDecorate instructions whose operands are defined in unreachable - // blocks. - void eliminateDeadDecorations(); + // Add capabilities, extensions, remove unneeded decorations, etc., + // based on the resulting SPIR-V. + void postProcess(); + + // Hook to visit each instruction in a block in a function + void postProcess(const Instruction&); + // Hook to visit each instruction in a reachable block in a function. + void postProcessReachable(const Instruction&); + // Hook to visit each non-32-bit sized float/int operation in a block. + void postProcessType(const Instruction&, spv::Id typeId); + void dump(std::vector&) const; void createBranch(Block* block); void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock); - void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control); + void createLoopMerge(Block* mergeBlock, Block* continueBlock, unsigned int control, unsigned int dependencyLength); // Sets to generate opcode for specialization constants. void setToSpecConstCodeGenMode() { generatingOpCodeForSpecConst = true; } @@ -573,10 +638,12 @@ public: protected: Id makeIntConstant(Id typeId, unsigned value, bool specConstant); Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant); - Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const; - Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const; - Id findCompositeConstant(Op typeClass, const std::vector& comps) const; + Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value); + Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2); + Id findCompositeConstant(Op typeClass, const std::vector& comps); + Id findStructConstant(Id typeId, const std::vector& comps); Id collapseAccessChain(); + void remapDynamicSwizzle(); void transferAccessChainSwizzle(bool dynamic); void simplifyAccessChainSwizzle(); void createAndSetNoPredecessorBlock(const char*); @@ -585,6 +652,7 @@ public: void dumpInstructions(std::vector&, const std::vector >&) const; void dumpModuleProcesses(std::vector&) const; + unsigned int spvVersion; // the version of SPIR-V to emit in the header SourceLanguage source; int sourceVersion; spv::Id sourceFileStringId; @@ -611,15 +679,15 @@ public: std::vector > entryPoints; std::vector > executionModes; std::vector > names; - std::vector > lines; std::vector > decorations; std::vector > constantsTypesGlobals; std::vector > externals; std::vector > functions; // not output, internally used for quick & dirty canonical (unique) creation - std::vector groupedConstants[OpConstant]; // all types appear before OpConstant - std::vector groupedTypes[OpConstant]; + std::unordered_map> groupedConstants; // map type opcodes to constant inst. + std::unordered_map> groupedStructConstants; // map struct-id to constant instructions + std::unordered_map> groupedTypes; // map type opcodes to type instructions // stack of switches std::stack switchMerges; diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp new file mode 100644 index 00000000000..5eaedaf6cb4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvPostProcess.cpp @@ -0,0 +1,265 @@ +// +// Copyright (C) 2016-2018 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// +// Post-processing for SPIR-V IR, in internal form, not standard binary form. +// + +#include +#include + +#include +#include + +#include "SpvBuilder.h" + +#include "spirv.hpp" +#include "GlslangToSpv.h" +#include "SpvBuilder.h" +namespace spv { + #include "GLSL.std.450.h" + #include "GLSL.ext.KHR.h" + #include "GLSL.ext.EXT.h" +#ifdef AMD_EXTENSIONS + #include "GLSL.ext.AMD.h" +#endif +#ifdef NV_EXTENSIONS + #include "GLSL.ext.NV.h" +#endif +} + +namespace spv { + +// Hook to visit each operand type and result type of an instruction. +// Will be called multiple times for one instruction, once for each typed +// operand and the result. +void Builder::postProcessType(const Instruction& inst, Id typeId) +{ + // Characterize the type being questioned + Id basicTypeOp = getMostBasicTypeClass(typeId); + int width = 0; + if (basicTypeOp == OpTypeFloat || basicTypeOp == OpTypeInt) + width = getScalarTypeWidth(typeId); + + // Do opcode-specific checks + switch (inst.getOpCode()) { + case OpLoad: + case OpStore: + if (basicTypeOp == OpTypeStruct) { + if (containsType(typeId, OpTypeInt, 8)) + addCapability(CapabilityInt8); + if (containsType(typeId, OpTypeInt, 16)) + addCapability(CapabilityInt16); + if (containsType(typeId, OpTypeFloat, 16)) + addCapability(CapabilityFloat16); + } else { + StorageClass storageClass = getStorageClass(inst.getIdOperand(0)); + if (width == 8) { + switch (storageClass) { + case StorageClassUniform: + case StorageClassStorageBuffer: + case StorageClassPushConstant: + break; + default: + addCapability(CapabilityInt8); + break; + } + } else if (width == 16) { + switch (storageClass) { + case StorageClassUniform: + case StorageClassStorageBuffer: + case StorageClassPushConstant: + case StorageClassInput: + case StorageClassOutput: + break; + default: + if (basicTypeOp == OpTypeInt) + addCapability(CapabilityInt16); + if (basicTypeOp == OpTypeFloat) + addCapability(CapabilityFloat16); + break; + } + } + } + break; + case OpAccessChain: + case OpPtrAccessChain: + case OpCopyObject: + case OpFConvert: + case OpSConvert: + case OpUConvert: + break; + case OpExtInst: +#if AMD_EXTENSIONS + switch (inst.getImmediateOperand(1)) { + case GLSLstd450Frexp: + case GLSLstd450FrexpStruct: + if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeInt, 16)) + addExtension(spv::E_SPV_AMD_gpu_shader_int16); + break; + case GLSLstd450InterpolateAtCentroid: + case GLSLstd450InterpolateAtSample: + case GLSLstd450InterpolateAtOffset: + if (getSpvVersion() < glslang::EShTargetSpv_1_3 && containsType(typeId, OpTypeFloat, 16)) + addExtension(spv::E_SPV_AMD_gpu_shader_half_float); + break; + default: + break; + } +#endif + break; + default: + if (basicTypeOp == OpTypeFloat && width == 16) + addCapability(CapabilityFloat16); + if (basicTypeOp == OpTypeInt && width == 16) + addCapability(CapabilityInt16); + if (basicTypeOp == OpTypeInt && width == 8) + addCapability(CapabilityInt8); + break; + } +} + +// Called for each instruction that resides in a block. +void Builder::postProcess(const Instruction& inst) +{ + // Add capabilities based simply on the opcode. + switch (inst.getOpCode()) { + case OpExtInst: + switch (inst.getImmediateOperand(1)) { + case GLSLstd450InterpolateAtCentroid: + case GLSLstd450InterpolateAtSample: + case GLSLstd450InterpolateAtOffset: + addCapability(CapabilityInterpolationFunction); + break; + default: + break; + } + break; + case OpDPdxFine: + case OpDPdyFine: + case OpFwidthFine: + case OpDPdxCoarse: + case OpDPdyCoarse: + case OpFwidthCoarse: + addCapability(CapabilityDerivativeControl); + break; + + case OpImageQueryLod: + case OpImageQuerySize: + case OpImageQuerySizeLod: + case OpImageQuerySamples: + case OpImageQueryLevels: + addCapability(CapabilityImageQuery); + break; + +#ifdef NV_EXTENSIONS + case OpGroupNonUniformPartitionNV: + addExtension(E_SPV_NV_shader_subgroup_partitioned); + addCapability(CapabilityGroupNonUniformPartitionedNV); + break; +#endif + + default: + break; + } + + // Checks based on type + if (inst.getTypeId() != NoType) + postProcessType(inst, inst.getTypeId()); + for (int op = 0; op < inst.getNumOperands(); ++op) { + if (inst.isIdOperand(op)) { + // In blocks, these are always result ids, but we are relying on + // getTypeId() to return NoType for things like OpLabel. + if (getTypeId(inst.getIdOperand(op)) != NoType) + postProcessType(inst, getTypeId(inst.getIdOperand(op))); + } + } +} + +// Called for each instruction in a reachable block. +void Builder::postProcessReachable(const Instruction&) +{ + // did have code here, but questionable to do so without deleting the instructions +} + +// comment in header +void Builder::postProcess() +{ + std::unordered_set reachableBlocks; + std::unordered_set unreachableDefinitions; + // Collect IDs defined in unreachable blocks. For each function, label the + // reachable blocks first. Then for each unreachable block, collect the + // result IDs of the instructions in it. + for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { + Function* f = *fi; + Block* entry = f->getEntryBlock(); + inReadableOrder(entry, [&reachableBlocks](const Block* b) { reachableBlocks.insert(b); }); + for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) { + Block* b = *bi; + if (reachableBlocks.count(b) == 0) { + for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++) + unreachableDefinitions.insert(ii->get()->getResultId()); + } + } + } + + // Remove unneeded decorations, for unreachable instructions + decorations.erase(std::remove_if(decorations.begin(), decorations.end(), + [&unreachableDefinitions](std::unique_ptr& I) -> bool { + Id decoration_id = I.get()->getIdOperand(0); + return unreachableDefinitions.count(decoration_id) != 0; + }), + decorations.end()); + + // Add per-instruction capabilities, extensions, etc., + + // process all reachable instructions... + for (auto bi = reachableBlocks.cbegin(); bi != reachableBlocks.cend(); ++bi) { + const Block* block = *bi; + const auto function = [this](const std::unique_ptr& inst) { postProcessReachable(*inst.get()); }; + std::for_each(block->getInstructions().begin(), block->getInstructions().end(), function); + } + + // process all block-contained instructions + for (auto fi = module.getFunctions().cbegin(); fi != module.getFunctions().cend(); fi++) { + Function* f = *fi; + for (auto bi = f->getBlocks().cbegin(); bi != f->getBlocks().cend(); bi++) { + Block* b = *bi; + for (auto ii = b->getInstructions().cbegin(); ii != b->getInstructions().cend(); ii++) + postProcess(*ii->get()); + } + } +} + +}; // end spv namespace diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp new file mode 100644 index 00000000000..a886b16e54b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvTools.cpp @@ -0,0 +1,189 @@ +// +// Copyright (C) 2014-2016 LunarG, Inc. +// Copyright (C) 2018 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// +// Call into SPIRV-Tools to disassemble, validate, and optimize. +// + +#if ENABLE_OPT + +#include +#include + +#include "SpvTools.h" +#include "spirv-tools/optimizer.hpp" +#include "spirv-tools/libspirv.h" + +namespace glslang { + +// Translate glslang's view of target versioning to what SPIRV-Tools uses. +spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger) +{ + switch (spvVersion.vulkan) { + case glslang::EShTargetVulkan_1_0: return spv_target_env::SPV_ENV_VULKAN_1_0; + case glslang::EShTargetVulkan_1_1: return spv_target_env::SPV_ENV_VULKAN_1_1; + default: + break; + } + + if (spvVersion.openGl > 0) + return spv_target_env::SPV_ENV_OPENGL_4_5; + + logger->missingFunctionality("Target version for SPIRV-Tools validator"); + return spv_target_env::SPV_ENV_UNIVERSAL_1_0; +} + + +// Use the SPIRV-Tools disassembler to print SPIR-V. +void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv) +{ + // disassemble + spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_3); + spv_text text; + spv_diagnostic diagnostic = nullptr; + spvBinaryToText(context, spirv.data(), spirv.size(), + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES | SPV_BINARY_TO_TEXT_OPTION_INDENT, + &text, &diagnostic); + + // dump + if (diagnostic == nullptr) + out << text->str; + else + spvDiagnosticPrint(diagnostic); + + // teardown + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(context); +} + +// Apply the SPIRV-Tools validator to generated SPIR-V. +void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector& spirv, + spv::SpvBuildLogger* logger) +{ + // validate + spv_context context = spvContextCreate(MapToSpirvToolsEnv(intermediate.getSpv(), logger)); + spv_const_binary_t binary = { spirv.data(), spirv.size() }; + spv_diagnostic diagnostic = nullptr; + spv_validator_options options = spvValidatorOptionsCreate(); + spvValidatorOptionsSetRelaxBlockLayout(options, intermediate.usingHlslOffsets()); + spvValidateWithOptions(context, options, &binary, &diagnostic); + + // report + if (diagnostic != nullptr) { + logger->error("SPIRV-Tools Validation Errors"); + logger->error(diagnostic->error); + } + + // tear down + spvValidatorOptionsDestroy(options); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(context); +} + +// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of +// legalizing HLSL SPIR-V. +void SpirvToolsLegalize(const glslang::TIntermediate&, std::vector& spirv, + spv::SpvBuildLogger*, const SpvOptions* options) +{ + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + + spvtools::Optimizer optimizer(target_env); + optimizer.SetMessageConsumer( + [](spv_message_level_t level, const char *source, const spv_position_t &position, const char *message) { + auto &out = std::cerr; + switch (level) + { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + out << "error: "; + break; + case SPV_MSG_WARNING: + out << "warning: "; + break; + case SPV_MSG_INFO: + case SPV_MSG_DEBUG: + out << "info: "; + break; + default: + break; + } + if (source) + { + out << source << ":"; + } + out << position.line << ":" << position.column << ":" << position.index << ":"; + if (message) + { + out << " " << message; + } + out << std::endl; + }); + + optimizer.RegisterPass(spvtools::CreateDeadBranchElimPass()); + optimizer.RegisterPass(spvtools::CreateMergeReturnPass()); + optimizer.RegisterPass(spvtools::CreateInlineExhaustivePass()); + optimizer.RegisterPass(spvtools::CreateEliminateDeadFunctionsPass()); + optimizer.RegisterPass(spvtools::CreateScalarReplacementPass()); + optimizer.RegisterPass(spvtools::CreateLocalAccessChainConvertPass()); + optimizer.RegisterPass(spvtools::CreateLocalSingleBlockLoadStoreElimPass()); + optimizer.RegisterPass(spvtools::CreateLocalSingleStoreElimPass()); + optimizer.RegisterPass(spvtools::CreateSimplificationPass()); + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); + optimizer.RegisterPass(spvtools::CreateVectorDCEPass()); + optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass()); + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); + optimizer.RegisterPass(spvtools::CreateDeadBranchElimPass()); + optimizer.RegisterPass(spvtools::CreateBlockMergePass()); + optimizer.RegisterPass(spvtools::CreateLocalMultiStoreElimPass()); + optimizer.RegisterPass(spvtools::CreateIfConversionPass()); + optimizer.RegisterPass(spvtools::CreateSimplificationPass()); + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); + optimizer.RegisterPass(spvtools::CreateVectorDCEPass()); + optimizer.RegisterPass(spvtools::CreateDeadInsertElimPass()); + if (options->optimizeSize) { + optimizer.RegisterPass(spvtools::CreateRedundancyEliminationPass()); + // TODO(greg-lunarg): Add this when AMD driver issues are resolved + // optimizer.RegisterPass(CreateCommonUniformElimPass()); + } + optimizer.RegisterPass(spvtools::CreateAggressiveDCEPass()); + optimizer.RegisterPass(spvtools::CreateCFGCleanupPass()); + + optimizer.Run(spirv.data(), spirv.size(), &spirv); +} + +}; // end namespace glslang + +#endif diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvTools.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvTools.h new file mode 100644 index 00000000000..08bcf3a2806 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/SpvTools.h @@ -0,0 +1,80 @@ +// +// Copyright (C) 2014-2016 LunarG, Inc. +// Copyright (C) 2018 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +// +// Call into SPIRV-Tools to disassemble, validate, and optimize. +// + +#pragma once +#ifndef GLSLANG_SPV_TOOLS_H +#define GLSLANG_SPV_TOOLS_H + +#include +#include + +#include "../glslang/MachineIndependent/localintermediate.h" +#include "Logger.h" + +namespace glslang { + +struct SpvOptions { + SpvOptions() : generateDebugInfo(false), disableOptimizer(true), + optimizeSize(false), disassemble(false), validate(false) { } + bool generateDebugInfo; + bool disableOptimizer; + bool optimizeSize; + bool disassemble; + bool validate; +}; + +#if ENABLE_OPT + +// Use the SPIRV-Tools disassembler to print SPIR-V. +void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv); + +// Apply the SPIRV-Tools validator to generated SPIR-V. +void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector& spirv, + spv::SpvBuildLogger*); + +// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of +// legalizing HLSL SPIR-V. +void SpirvToolsLegalize(const glslang::TIntermediate& intermediate, std::vector& spirv, + spv::SpvBuildLogger*, const SpvOptions*); + +#endif + +}; // end namespace glslang + +#endif // GLSLANG_SPV_TOOLS_H \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/bitutils.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/bitutils.h index 31288ab69d3..22e44cec26e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/bitutils.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/bitutils.h @@ -26,7 +26,7 @@ Dest BitwiseCast(Src source) { Dest dest; static_assert(sizeof(source) == sizeof(dest), "BitwiseCast: Source and destination must have the same size"); - std::memcpy(&dest, &source, sizeof(dest)); + std::memcpy(static_cast(&dest), &source, sizeof(dest)); return dest; } diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp index c950a66a0e2..22c83ea9d78 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.cpp @@ -46,6 +46,7 @@ #include "disassemble.h" #include "doc.h" +#include "SpvTools.h" namespace spv { extern "C" { @@ -54,6 +55,7 @@ namespace spv { #ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" #endif + #ifdef NV_EXTENSIONS #include "GLSL.ext.NV.h" #endif @@ -80,12 +82,15 @@ static void Kill(std::ostream& out, const char* message) // used to identify the extended instruction library imported when printing enum ExtInstSet { GLSL450Inst, + #ifdef AMD_EXTENSIONS GLSLextAMDInst, #endif + #ifdef NV_EXTENSIONS GLSLextNVInst, #endif + OpenCLExtInst, }; @@ -349,10 +354,21 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, if (resultId != 0 && idDescriptor[resultId].size() == 0) { switch (opCode) { case OpTypeInt: - idDescriptor[resultId] = "int"; + switch (stream[word]) { + case 8: idDescriptor[resultId] = "int8_t"; break; + case 16: idDescriptor[resultId] = "int16_t"; break; + default: assert(0); // fallthrough + case 32: idDescriptor[resultId] = "int"; break; + case 64: idDescriptor[resultId] = "int64_t"; break; + } break; case OpTypeFloat: - idDescriptor[resultId] = "float"; + switch (stream[word]) { + case 16: idDescriptor[resultId] = "float16_t"; break; + default: assert(0); // fallthrough + case 32: idDescriptor[resultId] = "float"; break; + case 64: idDescriptor[resultId] = "float64_t"; break; + } break; case OpTypeBool: idDescriptor[resultId] = "bool"; @@ -364,8 +380,18 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, idDescriptor[resultId] = "ptr"; break; case OpTypeVector: - if (idDescriptor[stream[word]].size() > 0) + if (idDescriptor[stream[word]].size() > 0) { idDescriptor[resultId].append(idDescriptor[stream[word]].begin(), idDescriptor[stream[word]].begin() + 1); + if (strstr(idDescriptor[stream[word]].c_str(), "8")) { + idDescriptor[resultId].append("8"); + } + if (strstr(idDescriptor[stream[word]].c_str(), "16")) { + idDescriptor[resultId].append("16"); + } + if (strstr(idDescriptor[stream[word]].c_str(), "64")) { + idDescriptor[resultId].append("64"); + } + } idDescriptor[resultId].append("vec"); switch (stream[word + 1]) { case 2: idDescriptor[resultId].append("2"); break; @@ -484,7 +510,9 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, }else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 || strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 || strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 || - strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0) { + strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || + strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 || + strcmp(spv::E_SPV_NV_mesh_shader, name) == 0) { extInstSet = GLSLextNVInst; #endif } @@ -509,6 +537,11 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, case OperandLiteralString: numOperands -= disassembleString(); break; + case OperandMemoryAccess: + outputMask(OperandMemoryAccess, stream[word++]); + --numOperands; + disassembleIds(numOperands); + return; default: assert(operandClass >= OperandSource && operandClass < OperandOpcode); @@ -653,7 +686,6 @@ static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint } #endif - #ifdef NV_EXTENSIONS static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) { @@ -661,21 +693,45 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint) strcmp(name, spv::E_SPV_NV_geometry_shader_passthrough) == 0 || strcmp(name, spv::E_ARB_shader_viewport_layer_array) == 0 || strcmp(name, spv::E_SPV_NV_viewport_array2) == 0 || - strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0) { + strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0 || + strcmp(spv::E_SPV_NV_fragment_shader_barycentric, name) == 0 || + strcmp(name, spv::E_SPV_NV_mesh_shader) == 0) { switch (entrypoint) { - case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; - case DecorationPassthroughNV: return "PassthroughNV"; - case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; - case DecorationViewportRelativeNV: return "ViewportRelativeNV"; + // NV builtins case BuiltInViewportMaskNV: return "ViewportMaskNV"; - case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV"; - case DecorationSecondaryViewportRelativeNV: return "SecondaryViewportRelativeNV"; case BuiltInSecondaryPositionNV: return "SecondaryPositionNV"; case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; - case CapabilityShaderStereoViewNV: return "ShaderStereoViewNV"; case BuiltInPositionPerViewNV: return "PositionPerViewNV"; case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV"; + case BuiltInBaryCoordNV: return "BaryCoordNV"; + case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV"; + case BuiltInTaskCountNV: return "TaskCountNV"; + case BuiltInPrimitiveCountNV: return "PrimitiveCountNV"; + case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV"; + case BuiltInClipDistancePerViewNV: return "ClipDistancePerViewNV"; + case BuiltInCullDistancePerViewNV: return "CullDistancePerViewNV"; + case BuiltInLayerPerViewNV: return "LayerPerViewNV"; + case BuiltInMeshViewCountNV: return "MeshViewCountNV"; + case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV"; + + // NV Capabilities + case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; + case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV"; + case CapabilityShaderStereoViewNV: return "ShaderStereoViewNV"; case CapabilityPerViewAttributesNV: return "PerViewAttributesNV"; + case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV"; + case CapabilityMeshShadingNV: return "MeshShadingNV"; + + // NV Decorations + case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; + case DecorationPassthroughNV: return "PassthroughNV"; + case DecorationViewportRelativeNV: return "ViewportRelativeNV"; + case DecorationSecondaryViewportRelativeNV: return "SecondaryViewportRelativeNV"; + case DecorationPerVertexNV: return "PerVertexNV"; + case DecorationPerPrimitiveNV: return "PerPrimitiveNV"; + case DecorationPerViewNV: return "PerViewNV"; + case DecorationPerTaskNV: return "PerTaskNV"; + default: return "Bad"; } } diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.h index 47cef65a573..2a9a89b53bf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/disassemble.h @@ -45,6 +45,7 @@ namespace spv { + // disassemble with glslang custom disassembler void Disassemble(std::ostream& out, const std::vector&); }; // end namespace spv diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.cpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.cpp index f9d5254c7ec..b0b01fbae98 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.cpp @@ -49,6 +49,7 @@ namespace spv { extern "C" { // Include C-based headers that don't have a namespace #include "GLSL.ext.KHR.h" + #include "GLSL.ext.EXT.h" #ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" #endif @@ -65,7 +66,7 @@ namespace spv { // the specification (or their sanitized versions for auto-generating the // spirv headers. // -// Also, the ceilings are declared next to these, to help keep them in sync. +// Also, for masks the ceilings are declared next to these, to help keep them in sync. // Ceilings should be // - one more than the maximum value an enumerant takes on, for non-mask enumerants // (for non-sparse enums, this is the number of enumerants) @@ -73,8 +74,6 @@ namespace spv { // (for non-sparse mask enums, this is the number of enumerants) // -const int SourceLanguageCeiling = 6; // HLSL todo: need official enumerant - const char* SourceString(int source) { switch (source) { @@ -85,13 +84,10 @@ const char* SourceString(int source) case 4: return "OpenCL_CPP"; case 5: return "HLSL"; - case SourceLanguageCeiling: default: return "Bad"; } } -const int ExecutionModelCeiling = 7; - const char* ExecutionModelString(int model) { switch (model) { @@ -102,14 +98,25 @@ const char* ExecutionModelString(int model) case 4: return "Fragment"; case 5: return "GLCompute"; case 6: return "Kernel"; +#ifdef NV_EXTENSIONS + case ExecutionModelTaskNV: return "TaskNV"; + case ExecutionModelMeshNV: return "MeshNV"; +#endif - case ExecutionModelCeiling: default: return "Bad"; + +#ifdef NV_EXTENSIONS + case ExecutionModelRayGenerationNV: return "RayGenerationNV"; + case ExecutionModelIntersectionNV: return "IntersectionNV"; + case ExecutionModelAnyHitNV: return "AnyHitNV"; + case ExecutionModelClosestHitNV: return "ClosestHitNV"; + case ExecutionModelMissNV: return "MissNV"; + case ExecutionModelCallableNV: return "CallableNV"; +#endif + } } -const int AddressingModelCeiling = 3; - const char* AddressingString(int addr) { switch (addr) { @@ -117,21 +124,18 @@ const char* AddressingString(int addr) case 1: return "Physical32"; case 2: return "Physical64"; - case AddressingModelCeiling: default: return "Bad"; } } -const int MemoryModelCeiling = 3; - const char* MemoryString(int mem) { switch (mem) { - case 0: return "Simple"; - case 1: return "GLSL450"; - case 2: return "OpenCL"; + case MemoryModelSimple: return "Simple"; + case MemoryModelGLSL450: return "GLSL450"; + case MemoryModelOpenCL: return "OpenCL"; + case MemoryModelVulkanKHR: return "VulkanKHR"; - case MemoryModelCeiling: default: return "Bad"; } } @@ -176,13 +180,20 @@ const char* ExecutionModeString(int mode) case 32: return "Bad"; case 4446: return "PostDepthCoverage"; + +#ifdef NV_EXTENSIONS + case ExecutionModeOutputLinesNV: return "OutputLinesNV"; + case ExecutionModeOutputPrimitivesNV: return "OutputPrimitivesNV"; + case ExecutionModeOutputTrianglesNV: return "OutputTrianglesNV"; + case ExecutionModeDerivativeGroupQuadsNV: return "DerivativeGroupQuadsNV"; + case ExecutionModeDerivativeGroupLinearNV: return "DerivativeGroupLinearNV"; +#endif + case ExecutionModeCeiling: default: return "Bad"; } } -const int StorageClassCeiling = 13; - const char* StorageClassString(int StorageClass) { switch (StorageClass) { @@ -200,7 +211,15 @@ const char* StorageClassString(int StorageClass) case 11: return "Image"; case 12: return "StorageBuffer"; - case StorageClassCeiling: +#ifdef NV_EXTENSIONS + case StorageClassRayPayloadNV: return "RayPayloadNV"; + case StorageClassHitAttributeNV: return "HitAttributeNV"; + case StorageClassIncomingRayPayloadNV: return "IncomingRayPayloadNV"; + case StorageClassShaderRecordBufferNV: return "ShaderRecordBufferNV"; + case StorageClassCallableDataNV: return "CallableDataNV"; + case StorageClassIncomingCallableDataNV: return "IncomingCallableDataNV"; +#endif + default: return "Bad"; } } @@ -260,19 +279,25 @@ const char* DecorationString(int decoration) default: return "Bad"; #ifdef AMD_EXTENSIONS - case 4999: return "ExplicitInterpAMD"; + case DecorationExplicitInterpAMD: return "ExplicitInterpAMD"; #endif #ifdef NV_EXTENSIONS - case 5248: return "OverrideCoverageNV"; - case 5250: return "PassthroughNV"; - case 5252: return "ViewportRelativeNV"; - case 5256: return "SecondaryViewportRelativeNV"; + case DecorationOverrideCoverageNV: return "OverrideCoverageNV"; + case DecorationPassthroughNV: return "PassthroughNV"; + case DecorationViewportRelativeNV: return "ViewportRelativeNV"; + case DecorationSecondaryViewportRelativeNV: return "SecondaryViewportRelativeNV"; + case DecorationPerPrimitiveNV: return "PerPrimitiveNV"; + case DecorationPerViewNV: return "PerViewNV"; + case DecorationPerTaskNV: return "PerTaskNV"; + case DecorationPerVertexNV: return "PerVertexNV"; #endif + + case DecorationNonUniformEXT: return "DecorationNonUniformEXT"; + case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE"; + case DecorationHlslSemanticGOOGLE: return "DecorationHlslSemanticGOOGLE"; } } -const int BuiltInCeiling = 44; - const char* BuiltInString(int builtIn) { switch (builtIn) { @@ -344,20 +369,52 @@ const char* BuiltInString(int builtIn) #endif #ifdef NV_EXTENSIONS - case 5253: return "ViewportMaskNV"; - case 5257: return "SecondaryPositionNV"; - case 5258: return "SecondaryViewportMaskNV"; - case 5261: return "PositionPerViewNV"; - case 5262: return "ViewportMaskPerViewNV"; + case BuiltInLaunchIdNV: return "LaunchIdNV"; + case BuiltInLaunchSizeNV: return "LaunchSizeNV"; + case BuiltInWorldRayOriginNV: return "WorldRayOriginNV"; + case BuiltInWorldRayDirectionNV: return "WorldRayDirectionNV"; + case BuiltInObjectRayOriginNV: return "ObjectRayOriginNV"; + case BuiltInObjectRayDirectionNV: return "ObjectRayDirectionNV"; + case BuiltInRayTminNV: return "RayTminNV"; + case BuiltInRayTmaxNV: return "RayTmaxNV"; + case BuiltInInstanceCustomIndexNV: return "InstanceCustomIndexNV"; + case BuiltInObjectToWorldNV: return "ObjectToWorldNV"; + case BuiltInWorldToObjectNV: return "WorldToObjectNV"; + case BuiltInHitTNV: return "HitTNV"; + case BuiltInHitKindNV: return "HitKindNV"; + case BuiltInIncomingRayFlagsNV: return "IncomingRayFlagsNV"; + case BuiltInViewportMaskNV: return "ViewportMaskNV"; + case BuiltInSecondaryPositionNV: return "SecondaryPositionNV"; + case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; + case BuiltInPositionPerViewNV: return "PositionPerViewNV"; + case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV"; +// case BuiltInFragmentSizeNV: return "FragmentSizeNV"; // superseded by BuiltInFragSizeEXT +// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT + case BuiltInBaryCoordNV: return "BaryCoordNV"; + case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV"; +#endif + + case BuiltInFragSizeEXT: return "FragSizeEXT"; + case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT"; + + case 5264: return "FullyCoveredEXT"; + + +#ifdef NV_EXTENSIONS + case BuiltInTaskCountNV: return "TaskCountNV"; + case BuiltInPrimitiveCountNV: return "PrimitiveCountNV"; + case BuiltInPrimitiveIndicesNV: return "PrimitiveIndicesNV"; + case BuiltInClipDistancePerViewNV: return "ClipDistancePerViewNV"; + case BuiltInCullDistancePerViewNV: return "CullDistancePerViewNV"; + case BuiltInLayerPerViewNV: return "LayerPerViewNV"; + case BuiltInMeshViewCountNV: return "MeshViewCountNV"; + case BuiltInMeshViewIndicesNV: return "MeshViewIndicesNV"; #endif - case BuiltInCeiling: default: return "Bad"; } } -const int DimensionCeiling = 7; - const char* DimensionString(int dim) { switch (dim) { @@ -369,13 +426,10 @@ const char* DimensionString(int dim) case 5: return "Buffer"; case 6: return "SubpassData"; - case DimensionCeiling: default: return "Bad"; } } -const int SamplerAddressingModeCeiling = 5; - const char* SamplerAddressingModeString(int mode) { switch (mode) { @@ -385,26 +439,20 @@ const char* SamplerAddressingModeString(int mode) case 3: return "Repeat"; case 4: return "RepeatMirrored"; - case SamplerAddressingModeCeiling: default: return "Bad"; } } -const int SamplerFilterModeCeiling = 2; - const char* SamplerFilterModeString(int mode) { switch (mode) { case 0: return "Nearest"; case 1: return "Linear"; - case SamplerFilterModeCeiling: default: return "Bad"; } } -const int ImageFormatCeiling = 40; - const char* ImageFormatString(int format) { switch (format) { @@ -461,14 +509,11 @@ const char* ImageFormatString(int format) case 38: return "R16ui"; case 39: return "R8ui"; - case ImageFormatCeiling: default: return "Bad"; } } -const int ImageChannelOrderCeiling = 19; - const char* ImageChannelOrderString(int format) { switch (format) { @@ -492,14 +537,11 @@ const char* ImageChannelOrderString(int format) case 17: return "sRGBA"; case 18: return "sBGRA"; - case ImageChannelOrderCeiling: default: return "Bad"; } } -const int ImageChannelDataTypeCeiling = 17; - const char* ImageChannelDataTypeString(int type) { switch (type) @@ -522,25 +564,28 @@ const char* ImageChannelDataTypeString(int type) case 15: return "UnormInt24"; case 16: return "UnormInt101010_2"; - case ImageChannelDataTypeCeiling: default: return "Bad"; } } -const int ImageOperandsCeiling = 8; +const int ImageOperandsCeiling = 12; const char* ImageOperandsString(int format) { switch (format) { - case 0: return "Bias"; - case 1: return "Lod"; - case 2: return "Grad"; - case 3: return "ConstOffset"; - case 4: return "Offset"; - case 5: return "ConstOffsets"; - case 6: return "Sample"; - case 7: return "MinLod"; + case ImageOperandsBiasShift: return "Bias"; + case ImageOperandsLodShift: return "Lod"; + case ImageOperandsGradShift: return "Grad"; + case ImageOperandsConstOffsetShift: return "ConstOffset"; + case ImageOperandsOffsetShift: return "Offset"; + case ImageOperandsConstOffsetsShift: return "ConstOffsets"; + case ImageOperandsSampleShift: return "Sample"; + case ImageOperandsMinLodShift: return "MinLod"; + case ImageOperandsMakeTexelAvailableKHRShift: return "MakeTexelAvailableKHR"; + case ImageOperandsMakeTexelVisibleKHRShift: return "MakeTexelVisibleKHR"; + case ImageOperandsNonPrivateTexelKHRShift: return "NonPrivateTexelKHR"; + case ImageOperandsVolatileTexelKHRShift: return "VolatileTexelKHR"; case ImageOperandsCeiling: default: @@ -548,8 +593,6 @@ const char* ImageOperandsString(int format) } } -const int FPFastMathCeiling = 5; - const char* FPFastMathString(int mode) { switch (mode) { @@ -559,13 +602,10 @@ const char* FPFastMathString(int mode) case 3: return "AllowRecip"; case 4: return "Fast"; - case FPFastMathCeiling: default: return "Bad"; } } -const int FPRoundingModeCeiling = 4; - const char* FPRoundingModeString(int mode) { switch (mode) { @@ -574,26 +614,20 @@ const char* FPRoundingModeString(int mode) case 2: return "RTP"; case 3: return "RTN"; - case FPRoundingModeCeiling: default: return "Bad"; } } -const int LinkageTypeCeiling = 2; - const char* LinkageTypeString(int type) { switch (type) { case 0: return "Export"; case 1: return "Import"; - case LinkageTypeCeiling: default: return "Bad"; } } -const int FuncParamAttrCeiling = 8; - const char* FuncParamAttrString(int attr) { switch (attr) { @@ -606,13 +640,10 @@ const char* FuncParamAttrString(int attr) case 6: return "NoWrite"; case 7: return "NoReadWrite"; - case FuncParamAttrCeiling: default: return "Bad"; } } -const int AccessQualifierCeiling = 3; - const char* AccessQualifierString(int attr) { switch (attr) { @@ -620,7 +651,6 @@ const char* AccessQualifierString(int attr) case 1: return "WriteOnly"; case 2: return "ReadWrite"; - case AccessQualifierCeiling: default: return "Bad"; } } @@ -668,8 +698,6 @@ const char* FunctionControlString(int cont) } } -const int MemorySemanticsCeiling = 12; - const char* MemorySemanticsString(int mem) { // Note: No bits set (None) means "Relaxed" @@ -687,27 +715,26 @@ const char* MemorySemanticsString(int mem) case 10: return "AtomicCounterMemory"; case 11: return "ImageMemory"; - case MemorySemanticsCeiling: default: return "Bad"; } } -const int MemoryAccessCeiling = 3; +const int MemoryAccessCeiling = 6; const char* MemoryAccessString(int mem) { switch (mem) { - case 0: return "Volatile"; - case 1: return "Aligned"; - case 2: return "Nontemporal"; + case MemoryAccessVolatileShift: return "Volatile"; + case MemoryAccessAlignedShift: return "Aligned"; + case MemoryAccessNontemporalShift: return "Nontemporal"; + case MemoryAccessMakePointerAvailableKHRShift: return "MakePointerAvailableKHR"; + case MemoryAccessMakePointerVisibleKHRShift: return "MakePointerVisibleKHR"; + case MemoryAccessNonPrivatePointerKHRShift: return "NonPrivatePointerKHR"; - case MemoryAccessCeiling: default: return "Bad"; } } -const int ScopeCeiling = 5; - const char* ScopeString(int mem) { switch (mem) { @@ -717,29 +744,29 @@ const char* ScopeString(int mem) case 3: return "Subgroup"; case 4: return "Invocation"; - case ScopeCeiling: default: return "Bad"; } } -const int GroupOperationCeiling = 3; - const char* GroupOperationString(int gop) { switch (gop) { - case 0: return "Reduce"; - case 1: return "InclusiveScan"; - case 2: return "ExclusiveScan"; + case GroupOperationReduce: return "Reduce"; + case GroupOperationInclusiveScan: return "InclusiveScan"; + case GroupOperationExclusiveScan: return "ExclusiveScan"; + case GroupOperationClusteredReduce: return "ClusteredReduce"; +#ifdef NV_EXTENSIONS + case GroupOperationPartitionedReduceNV: return "PartitionedReduceNV"; + case GroupOperationPartitionedInclusiveScanNV: return "PartitionedInclusiveScanNV"; + case GroupOperationPartitionedExclusiveScanNV: return "PartitionedExclusiveScanNV"; +#endif - case GroupOperationCeiling: default: return "Bad"; } } -const int KernelEnqueueFlagsCeiling = 3; - const char* KernelEnqueueFlagsString(int flag) { switch (flag) @@ -748,26 +775,20 @@ const char* KernelEnqueueFlagsString(int flag) case 1: return "WaitKernel"; case 2: return "WaitWorkGroup"; - case KernelEnqueueFlagsCeiling: default: return "Bad"; } } -const int KernelProfilingInfoCeiling = 1; - const char* KernelProfilingInfoString(int info) { switch (info) { case 0: return "CmdExecTime"; - case KernelProfilingInfoCeiling: default: return "Bad"; } } -const int CapabilityCeiling = 58; - const char* CapabilityString(int info) { switch (info) @@ -830,39 +851,77 @@ const char* CapabilityString(int info) case 55: return "StorageImageReadWithoutFormat"; case 56: return "StorageImageWriteWithoutFormat"; case 57: return "MultiViewport"; + case 61: return "GroupNonUniform"; + case 62: return "GroupNonUniformVote"; + case 63: return "GroupNonUniformArithmetic"; + case 64: return "GroupNonUniformBallot"; + case 65: return "GroupNonUniformShuffle"; + case 66: return "GroupNonUniformShuffleRelative"; + case 67: return "GroupNonUniformClustered"; + case 68: return "GroupNonUniformQuad"; - case 4423: return "SubgroupBallotKHR"; - case 4427: return "DrawParameters"; - case 4431: return "SubgroupVoteKHR"; + case CapabilitySubgroupBallotKHR: return "SubgroupBallotKHR"; + case CapabilityDrawParameters: return "DrawParameters"; + case CapabilitySubgroupVoteKHR: return "SubgroupVoteKHR"; - case 4433: return "StorageUniformBufferBlock16"; - case 4434: return "StorageUniform16"; - case 4435: return "StoragePushConstant16"; - case 4436: return "StorageInputOutput16"; + case CapabilityStorageUniformBufferBlock16: return "StorageUniformBufferBlock16"; + case CapabilityStorageUniform16: return "StorageUniform16"; + case CapabilityStoragePushConstant16: return "StoragePushConstant16"; + case CapabilityStorageInputOutput16: return "StorageInputOutput16"; - case 4437: return "DeviceGroup"; - case 4439: return "MultiView"; + case CapabilityStorageBuffer8BitAccess: return "CapabilityStorageBuffer8BitAccess"; + case CapabilityUniformAndStorageBuffer8BitAccess: return "CapabilityUniformAndStorageBuffer8BitAccess"; + case CapabilityStoragePushConstant8: return "CapabilityStoragePushConstant8"; - case 5013: return "StencilExportEXT"; + case CapabilityDeviceGroup: return "DeviceGroup"; + case CapabilityMultiView: return "MultiView"; + + case CapabilityStencilExportEXT: return "StencilExportEXT"; #ifdef AMD_EXTENSIONS - case 5009: return "ImageGatherBiasLodAMD"; - case 5010: return "FragmentMaskAMD"; - case 5015: return "ImageReadWriteLodAMD"; + case CapabilityFloat16ImageAMD: return "Float16ImageAMD"; + case CapabilityImageGatherBiasLodAMD: return "ImageGatherBiasLodAMD"; + case CapabilityFragmentMaskAMD: return "FragmentMaskAMD"; + case CapabilityImageReadWriteLodAMD: return "ImageReadWriteLodAMD"; #endif - case 4445: return "AtomicStorageOps"; + case CapabilityAtomicStorageOps: return "AtomicStorageOps"; - case 4447: return "SampleMaskPostDepthCoverage"; + case CapabilitySampleMaskPostDepthCoverage: return "SampleMaskPostDepthCoverage"; #ifdef NV_EXTENSIONS - case 5251: return "GeometryShaderPassthroughNV"; - case 5254: return "ShaderViewportIndexLayerNV"; - case 5255: return "ShaderViewportMaskNV"; - case 5259: return "ShaderStereoViewNV"; - case 5260: return "PerViewAttributesNV"; + case CapabilityGeometryShaderPassthroughNV: return "GeometryShaderPassthroughNV"; + case CapabilityShaderViewportIndexLayerNV: return "ShaderViewportIndexLayerNV"; + case CapabilityShaderViewportMaskNV: return "ShaderViewportMaskNV"; + case CapabilityShaderStereoViewNV: return "ShaderStereoViewNV"; + case CapabilityPerViewAttributesNV: return "PerViewAttributesNV"; + case CapabilityGroupNonUniformPartitionedNV: return "GroupNonUniformPartitionedNV"; + case CapabilityRayTracingNV: return "RayTracingNV"; + case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV"; + case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV"; + case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV"; + case CapabilityMeshShadingNV: return "MeshShadingNV"; +// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by CapabilityFragmentDensityEXT #endif + case CapabilityFragmentDensityEXT: return "FragmentDensityEXT"; + + case CapabilityFragmentFullyCoveredEXT: return "FragmentFullyCoveredEXT"; + + case CapabilityShaderNonUniformEXT: return "CapabilityShaderNonUniformEXT"; + case CapabilityRuntimeDescriptorArrayEXT: return "CapabilityRuntimeDescriptorArrayEXT"; + case CapabilityInputAttachmentArrayDynamicIndexingEXT: return "CapabilityInputAttachmentArrayDynamicIndexingEXT"; + case CapabilityUniformTexelBufferArrayDynamicIndexingEXT: return "CapabilityUniformTexelBufferArrayDynamicIndexingEXT"; + case CapabilityStorageTexelBufferArrayDynamicIndexingEXT: return "CapabilityStorageTexelBufferArrayDynamicIndexingEXT"; + case CapabilityUniformBufferArrayNonUniformIndexingEXT: return "CapabilityUniformBufferArrayNonUniformIndexingEXT"; + case CapabilitySampledImageArrayNonUniformIndexingEXT: return "CapabilitySampledImageArrayNonUniformIndexingEXT"; + case CapabilityStorageBufferArrayNonUniformIndexingEXT: return "CapabilityStorageBufferArrayNonUniformIndexingEXT"; + case CapabilityStorageImageArrayNonUniformIndexingEXT: return "CapabilityStorageImageArrayNonUniformIndexingEXT"; + case CapabilityInputAttachmentArrayNonUniformIndexingEXT: return "CapabilityInputAttachmentArrayNonUniformIndexingEXT"; + case CapabilityUniformTexelBufferArrayNonUniformIndexingEXT: return "CapabilityUniformTexelBufferArrayNonUniformIndexingEXT"; + case CapabilityStorageTexelBufferArrayNonUniformIndexingEXT: return "CapabilityStorageTexelBufferArrayNonUniformIndexingEXT"; + + case CapabilityVulkanMemoryModelKHR: return "CapabilityVulkanMemoryModelKHR"; + case CapabilityVulkanMemoryModelDeviceScopeKHR: return "CapabilityVulkanMemoryModelDeviceScopeKHR"; - case CapabilityCeiling: default: return "Bad"; } } @@ -1192,6 +1251,44 @@ const char* OpcodeString(int op) case 319: return "OpAtomicFlagClear"; case 320: return "OpImageSparseRead"; + case OpModuleProcessed: return "OpModuleProcessed"; + case OpDecorateId: return "OpDecorateId"; + + case 333: return "OpGroupNonUniformElect"; + case 334: return "OpGroupNonUniformAll"; + case 335: return "OpGroupNonUniformAny"; + case 336: return "OpGroupNonUniformAllEqual"; + case 337: return "OpGroupNonUniformBroadcast"; + case 338: return "OpGroupNonUniformBroadcastFirst"; + case 339: return "OpGroupNonUniformBallot"; + case 340: return "OpGroupNonUniformInverseBallot"; + case 341: return "OpGroupNonUniformBallotBitExtract"; + case 342: return "OpGroupNonUniformBallotBitCount"; + case 343: return "OpGroupNonUniformBallotFindLSB"; + case 344: return "OpGroupNonUniformBallotFindMSB"; + case 345: return "OpGroupNonUniformShuffle"; + case 346: return "OpGroupNonUniformShuffleXor"; + case 347: return "OpGroupNonUniformShuffleUp"; + case 348: return "OpGroupNonUniformShuffleDown"; + case 349: return "OpGroupNonUniformIAdd"; + case 350: return "OpGroupNonUniformFAdd"; + case 351: return "OpGroupNonUniformIMul"; + case 352: return "OpGroupNonUniformFMul"; + case 353: return "OpGroupNonUniformSMin"; + case 354: return "OpGroupNonUniformUMin"; + case 355: return "OpGroupNonUniformFMin"; + case 356: return "OpGroupNonUniformSMax"; + case 357: return "OpGroupNonUniformUMax"; + case 358: return "OpGroupNonUniformFMax"; + case 359: return "OpGroupNonUniformBitwiseAnd"; + case 360: return "OpGroupNonUniformBitwiseOr"; + case 361: return "OpGroupNonUniformBitwiseXor"; + case 362: return "OpGroupNonUniformLogicalAnd"; + case 363: return "OpGroupNonUniformLogicalOr"; + case 364: return "OpGroupNonUniformLogicalXor"; + case 365: return "OpGroupNonUniformQuadBroadcast"; + case 366: return "OpGroupNonUniformQuadSwap"; + case 4421: return "OpSubgroupBallotKHR"; case 4422: return "OpSubgroupFirstInvocationKHR"; case 4428: return "OpSubgroupAllKHR"; @@ -1213,7 +1310,21 @@ const char* OpcodeString(int op) case 5012: return "OpFragmentFetchAMD"; #endif - case OpcodeCeiling: + case OpDecorateStringGOOGLE: return "OpDecorateStringGOOGLE"; + case OpMemberDecorateStringGOOGLE: return "OpMemberDecorateStringGOOGLE"; + +#ifdef NV_EXTENSIONS + case OpGroupNonUniformPartitionNV: return "OpGroupNonUniformPartitionNV"; + case OpReportIntersectionNV: return "OpReportIntersectionNV"; + case OpIgnoreIntersectionNV: return "OpIgnoreIntersectionNV"; + case OpTerminateRayNV: return "OpTerminateRayNV"; + case OpTraceNV: return "OpTraceNV"; + case OpTypeAccelerationStructureNV: return "OpTypeAccelerationStructureNV"; + case OpExecuteCallableNV: return "OpExecuteCallableNV"; + case OpImageSampleFootprintNV: return "OpImageSampleFootprintNV"; + case OpWritePackedPrimitiveIndices4x8NV: return "OpWritePackedPrimitiveIndices4x8NV"; +#endif + default: return "Bad"; } @@ -1226,35 +1337,13 @@ OperandParameters ExecutionModeOperands[ExecutionModeCeiling]; OperandParameters DecorationOperands[DecorationCeiling]; EnumDefinition OperandClassParams[OperandCount]; -EnumParameters ExecutionModelParams[ExecutionModelCeiling]; -EnumParameters AddressingParams[AddressingModelCeiling]; -EnumParameters MemoryParams[MemoryModelCeiling]; EnumParameters ExecutionModeParams[ExecutionModeCeiling]; -EnumParameters StorageParams[StorageClassCeiling]; -EnumParameters SamplerAddressingModeParams[SamplerAddressingModeCeiling]; -EnumParameters SamplerFilterModeParams[SamplerFilterModeCeiling]; -EnumParameters ImageFormatParams[ImageFormatCeiling]; -EnumParameters ImageChannelOrderParams[ImageChannelOrderCeiling]; -EnumParameters ImageChannelDataTypeParams[ImageChannelDataTypeCeiling]; EnumParameters ImageOperandsParams[ImageOperandsCeiling]; -EnumParameters FPFastMathParams[FPFastMathCeiling]; -EnumParameters FPRoundingModeParams[FPRoundingModeCeiling]; -EnumParameters LinkageTypeParams[LinkageTypeCeiling]; EnumParameters DecorationParams[DecorationCeiling]; -EnumParameters BuiltInParams[BuiltInCeiling]; -EnumParameters DimensionalityParams[DimensionCeiling]; -EnumParameters FuncParamAttrParams[FuncParamAttrCeiling]; -EnumParameters AccessQualifierParams[AccessQualifierCeiling]; -EnumParameters GroupOperationParams[GroupOperationCeiling]; EnumParameters LoopControlParams[FunctionControlCeiling]; EnumParameters SelectionControlParams[SelectControlCeiling]; EnumParameters FunctionControlParams[FunctionControlCeiling]; -EnumParameters MemorySemanticsParams[MemorySemanticsCeiling]; EnumParameters MemoryAccessParams[MemoryAccessCeiling]; -EnumParameters ScopeParams[ScopeCeiling]; -EnumParameters KernelEnqueueFlagsParams[KernelEnqueueFlagsCeiling]; -EnumParameters KernelProfilingInfoParams[KernelProfilingInfoCeiling]; -EnumParameters CapabilityParams[CapabilityCeiling]; // Set up all the parameterizing descriptions of the opcodes, operands, etc. void Parameterize() @@ -1304,7 +1393,10 @@ void Parameterize() InstructionDesc[OpImageWrite].setResultAndType(false, false); InstructionDesc[OpDecorationGroup].setResultAndType(true, false); InstructionDesc[OpDecorate].setResultAndType(false, false); + InstructionDesc[OpDecorateId].setResultAndType(false, false); + InstructionDesc[OpDecorateStringGOOGLE].setResultAndType(false, false); InstructionDesc[OpMemberDecorate].setResultAndType(false, false); + InstructionDesc[OpMemberDecorateStringGOOGLE].setResultAndType(false, false); InstructionDesc[OpGroupDecorate].setResultAndType(false, false); InstructionDesc[OpGroupMemberDecorate].setResultAndType(false, false); InstructionDesc[OpName].setResultAndType(false, false); @@ -1343,6 +1435,7 @@ void Parameterize() InstructionDesc[OpReleaseEvent].setResultAndType(false, false); InstructionDesc[OpGroupWaitEvents].setResultAndType(false, false); InstructionDesc[OpAtomicFlagClear].setResultAndType(false, false); + InstructionDesc[OpModuleProcessed].setResultAndType(false, false); // Specific additional context-dependent operands @@ -1380,354 +1473,39 @@ void Parameterize() DecorationOperands[DecorationInputAttachmentIndex].push(OperandLiteralNumber, "'Attachment Index'"); DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "'Alignment'"); - OperandClassParams[OperandSource].set(SourceLanguageCeiling, SourceString, 0); - OperandClassParams[OperandExecutionModel].set(ExecutionModelCeiling, ExecutionModelString, ExecutionModelParams); - OperandClassParams[OperandAddressing].set(AddressingModelCeiling, AddressingString, AddressingParams); - OperandClassParams[OperandMemory].set(MemoryModelCeiling, MemoryString, MemoryParams); + OperandClassParams[OperandSource].set(0, SourceString, 0); + OperandClassParams[OperandExecutionModel].set(0, ExecutionModelString, nullptr); + OperandClassParams[OperandAddressing].set(0, AddressingString, nullptr); + OperandClassParams[OperandMemory].set(0, MemoryString, nullptr); OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams); OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands); - OperandClassParams[OperandStorage].set(StorageClassCeiling, StorageClassString, StorageParams); - OperandClassParams[OperandDimensionality].set(DimensionCeiling, DimensionString, DimensionalityParams); - OperandClassParams[OperandSamplerAddressingMode].set(SamplerAddressingModeCeiling, SamplerAddressingModeString, SamplerAddressingModeParams); - OperandClassParams[OperandSamplerFilterMode].set(SamplerFilterModeCeiling, SamplerFilterModeString, SamplerFilterModeParams); - OperandClassParams[OperandSamplerImageFormat].set(ImageFormatCeiling, ImageFormatString, ImageFormatParams); - OperandClassParams[OperandImageChannelOrder].set(ImageChannelOrderCeiling, ImageChannelOrderString, ImageChannelOrderParams); - OperandClassParams[OperandImageChannelDataType].set(ImageChannelDataTypeCeiling, ImageChannelDataTypeString, ImageChannelDataTypeParams); + OperandClassParams[OperandStorage].set(0, StorageClassString, nullptr); + OperandClassParams[OperandDimensionality].set(0, DimensionString, nullptr); + OperandClassParams[OperandSamplerAddressingMode].set(0, SamplerAddressingModeString, nullptr); + OperandClassParams[OperandSamplerFilterMode].set(0, SamplerFilterModeString, nullptr); + OperandClassParams[OperandSamplerImageFormat].set(0, ImageFormatString, nullptr); + OperandClassParams[OperandImageChannelOrder].set(0, ImageChannelOrderString, nullptr); + OperandClassParams[OperandImageChannelDataType].set(0, ImageChannelDataTypeString, nullptr); OperandClassParams[OperandImageOperands].set(ImageOperandsCeiling, ImageOperandsString, ImageOperandsParams, true); - OperandClassParams[OperandFPFastMath].set(FPFastMathCeiling, FPFastMathString, FPFastMathParams, true); - OperandClassParams[OperandFPRoundingMode].set(FPRoundingModeCeiling, FPRoundingModeString, FPRoundingModeParams); - OperandClassParams[OperandLinkageType].set(LinkageTypeCeiling, LinkageTypeString, LinkageTypeParams); - OperandClassParams[OperandFuncParamAttr].set(FuncParamAttrCeiling, FuncParamAttrString, FuncParamAttrParams); - OperandClassParams[OperandAccessQualifier].set(AccessQualifierCeiling, AccessQualifierString, AccessQualifierParams); + OperandClassParams[OperandFPFastMath].set(0, FPFastMathString, nullptr, true); + OperandClassParams[OperandFPRoundingMode].set(0, FPRoundingModeString, nullptr); + OperandClassParams[OperandLinkageType].set(0, LinkageTypeString, nullptr); + OperandClassParams[OperandFuncParamAttr].set(0, FuncParamAttrString, nullptr); + OperandClassParams[OperandAccessQualifier].set(0, AccessQualifierString, nullptr); OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams); OperandClassParams[OperandDecoration].setOperands(DecorationOperands); - OperandClassParams[OperandBuiltIn].set(BuiltInCeiling, BuiltInString, BuiltInParams); + OperandClassParams[OperandBuiltIn].set(0, BuiltInString, nullptr); OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true); OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true); OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true); - OperandClassParams[OperandMemorySemantics].set(MemorySemanticsCeiling, MemorySemanticsString, MemorySemanticsParams, true); + OperandClassParams[OperandMemorySemantics].set(0, MemorySemanticsString, nullptr, true); OperandClassParams[OperandMemoryAccess].set(MemoryAccessCeiling, MemoryAccessString, MemoryAccessParams, true); - OperandClassParams[OperandScope].set(ScopeCeiling, ScopeString, ScopeParams); - OperandClassParams[OperandGroupOperation].set(GroupOperationCeiling, GroupOperationString, GroupOperationParams); - OperandClassParams[OperandKernelEnqueueFlags].set(KernelEnqueueFlagsCeiling, KernelEnqueueFlagsString, KernelEnqueueFlagsParams); - OperandClassParams[OperandKernelProfilingInfo].set(KernelProfilingInfoCeiling, KernelProfilingInfoString, KernelProfilingInfoParams, true); - OperandClassParams[OperandCapability].set(CapabilityCeiling, CapabilityString, CapabilityParams); - OperandClassParams[OperandOpcode].set(OpcodeCeiling, OpcodeString, 0); - - CapabilityParams[CapabilityShader].caps.push_back(CapabilityMatrix); - CapabilityParams[CapabilityGeometry].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityTessellation].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityVector16].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityFloat16Buffer].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityInt64Atomics].caps.push_back(CapabilityInt64); - CapabilityParams[CapabilityImageBasic].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityImageReadWrite].caps.push_back(CapabilityImageBasic); - CapabilityParams[CapabilityImageMipmap].caps.push_back(CapabilityImageBasic); - CapabilityParams[CapabilityPipes].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityDeviceEnqueue].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityLiteralSampler].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityAtomicStorage].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySampleRateShading].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityTessellationPointSize].caps.push_back(CapabilityTessellation); - CapabilityParams[CapabilityGeometryPointSize].caps.push_back(CapabilityGeometry); - CapabilityParams[CapabilityImageGatherExtended].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityStorageImageExtendedFormats].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityStorageImageMultisample].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityUniformBufferArrayDynamicIndexing].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySampledImageArrayDynamicIndexing].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityStorageBufferArrayDynamicIndexing].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityStorageImageArrayDynamicIndexing].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityClipDistance].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityCullDistance].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityGenericPointer].caps.push_back(CapabilityAddresses); - CapabilityParams[CapabilityInt8].caps.push_back(CapabilityKernel); - CapabilityParams[CapabilityInputAttachment].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityMinLod].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySparseResidency].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySampled1D].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySampledRect].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySampledBuffer].caps.push_back(CapabilityShader); - CapabilityParams[CapabilitySampledCubeArray].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityImageMSArray].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityImage1D].caps.push_back(CapabilitySampled1D); - CapabilityParams[CapabilityImageRect].caps.push_back(CapabilitySampledRect); - CapabilityParams[CapabilityImageBuffer].caps.push_back(CapabilitySampledBuffer); - CapabilityParams[CapabilityImageCubeArray].caps.push_back(CapabilitySampledCubeArray); - CapabilityParams[CapabilityImageQuery].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityDerivativeControl].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityInterpolationFunction].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityTransformFeedback].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityGeometryStreams].caps.push_back(CapabilityGeometry); - CapabilityParams[CapabilityStorageImageReadWithoutFormat].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityStorageImageWriteWithoutFormat].caps.push_back(CapabilityShader); - CapabilityParams[CapabilityMultiViewport].caps.push_back(CapabilityGeometry); - - AddressingParams[AddressingModelPhysical32].caps.push_back(CapabilityAddresses); - AddressingParams[AddressingModelPhysical64].caps.push_back(CapabilityAddresses); - - MemoryParams[MemoryModelSimple].caps.push_back(CapabilityShader); - MemoryParams[MemoryModelGLSL450].caps.push_back(CapabilityShader); - MemoryParams[MemoryModelOpenCL].caps.push_back(CapabilityKernel); - - MemorySemanticsParams[MemorySemanticsUniformMemoryShift].caps.push_back(CapabilityShader); - MemorySemanticsParams[MemorySemanticsAtomicCounterMemoryShift].caps.push_back(CapabilityAtomicStorage); - - ExecutionModelParams[ExecutionModelVertex].caps.push_back(CapabilityShader); - ExecutionModelParams[ExecutionModelTessellationControl].caps.push_back(CapabilityTessellation); - ExecutionModelParams[ExecutionModelTessellationEvaluation].caps.push_back(CapabilityTessellation); - ExecutionModelParams[ExecutionModelGeometry].caps.push_back(CapabilityGeometry); - ExecutionModelParams[ExecutionModelFragment].caps.push_back(CapabilityShader); - ExecutionModelParams[ExecutionModelGLCompute].caps.push_back(CapabilityShader); - ExecutionModelParams[ExecutionModelKernel].caps.push_back(CapabilityKernel); - - // Storage capabilites - StorageParams[StorageClassInput].caps.push_back(CapabilityShader); - StorageParams[StorageClassUniform].caps.push_back(CapabilityShader); - StorageParams[StorageClassOutput].caps.push_back(CapabilityShader); - StorageParams[StorageClassPrivate].caps.push_back(CapabilityShader); - StorageParams[StorageClassGeneric].caps.push_back(CapabilityKernel); - StorageParams[StorageClassAtomicCounter].caps.push_back(CapabilityAtomicStorage); - StorageParams[StorageClassPushConstant].caps.push_back(CapabilityShader); - - // Sampler Filter & Addressing mode capabilities - SamplerAddressingModeParams[SamplerAddressingModeNone].caps.push_back(CapabilityKernel); - SamplerAddressingModeParams[SamplerAddressingModeClampToEdge].caps.push_back(CapabilityKernel); - SamplerAddressingModeParams[SamplerAddressingModeClamp].caps.push_back(CapabilityKernel); - SamplerAddressingModeParams[SamplerAddressingModeRepeat].caps.push_back(CapabilityKernel); - SamplerAddressingModeParams[SamplerAddressingModeRepeatMirrored].caps.push_back(CapabilityKernel); - - SamplerFilterModeParams[SamplerFilterModeNearest].caps.push_back(CapabilityKernel); - SamplerFilterModeParams[SamplerFilterModeLinear].caps.push_back(CapabilityKernel); - - // image format capabilities - - // ES/Desktop float - ImageFormatParams[ImageFormatRgba32f].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba16f].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatR32f].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba8].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba8Snorm].caps.push_back(CapabilityShader); - - // Desktop float - ImageFormatParams[ImageFormatRg32f].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg16f].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR11fG11fB10f].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR16f].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRgba16].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRgb10A2].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg16].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg8].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR16].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR8].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRgba16Snorm].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg16Snorm].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg8Snorm].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR16Snorm].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR8Snorm].caps.push_back(CapabilityStorageImageExtendedFormats); - - // ES/Desktop int - ImageFormatParams[ImageFormatRgba32i].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba16i].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba8i].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatR32i].caps.push_back(CapabilityShader); - - // Desktop int - ImageFormatParams[ImageFormatRg32i].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg16i].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg8i].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR16i].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR8i].caps.push_back(CapabilityStorageImageExtendedFormats); - - // ES/Desktop uint - ImageFormatParams[ImageFormatRgba32ui].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba16ui].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatRgba8ui].caps.push_back(CapabilityShader); - ImageFormatParams[ImageFormatR32ui].caps.push_back(CapabilityShader); - - // Desktop uint - ImageFormatParams[ImageFormatRgb10a2ui].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg32ui].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg16ui].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatRg8ui].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR16ui].caps.push_back(CapabilityStorageImageExtendedFormats); - ImageFormatParams[ImageFormatR8ui].caps.push_back(CapabilityStorageImageExtendedFormats); - - // image channel order capabilities - for (int i = 0; i < ImageChannelOrderCeiling; ++i) { - ImageChannelOrderParams[i].caps.push_back(CapabilityKernel); - } - - // image channel type capabilities - for (int i = 0; i < ImageChannelDataTypeCeiling; ++i) { - ImageChannelDataTypeParams[i].caps.push_back(CapabilityKernel); - } - - // image lookup operands - ImageOperandsParams[ImageOperandsBiasShift].caps.push_back(CapabilityShader); - ImageOperandsParams[ImageOperandsOffsetShift].caps.push_back(CapabilityImageGatherExtended); - ImageOperandsParams[ImageOperandsMinLodShift].caps.push_back(CapabilityMinLod); - - // fast math flags capabilities - for (int i = 0; i < FPFastMathCeiling; ++i) { - FPFastMathParams[i].caps.push_back(CapabilityKernel); - } - - // fp rounding mode capabilities - for (int i = 0; i < FPRoundingModeCeiling; ++i) { - FPRoundingModeParams[i].caps.push_back(CapabilityKernel); - } - - // linkage types - for (int i = 0; i < LinkageTypeCeiling; ++i) { - LinkageTypeParams[i].caps.push_back(CapabilityLinkage); - } - - // function argument types - for (int i = 0; i < FuncParamAttrCeiling; ++i) { - FuncParamAttrParams[i].caps.push_back(CapabilityKernel); - } - - // function argument types - for (int i = 0; i < AccessQualifierCeiling; ++i) { - AccessQualifierParams[i].caps.push_back(CapabilityKernel); - } - - ExecutionModeParams[ExecutionModeInvocations].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeSpacingEqual].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeSpacingFractionalEven].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeSpacingFractionalOdd].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeVertexOrderCw].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeVertexOrderCcw].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModePixelCenterInteger].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeOriginUpperLeft].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeOriginLowerLeft].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeEarlyFragmentTests].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModePointMode].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeXfb].caps.push_back(CapabilityTransformFeedback); - ExecutionModeParams[ExecutionModeDepthReplacing].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeDepthGreater].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeDepthLess].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeDepthUnchanged].caps.push_back(CapabilityShader); - ExecutionModeParams[ExecutionModeLocalSizeHint].caps.push_back(CapabilityKernel); - ExecutionModeParams[ExecutionModeInputPoints].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeInputLines].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeInputLinesAdjacency].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeTriangles].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeTriangles].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeInputTrianglesAdjacency].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeQuads].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeIsolines].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeOutputVertices].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeOutputVertices].caps.push_back(CapabilityTessellation); - ExecutionModeParams[ExecutionModeOutputPoints].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeOutputLineStrip].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeOutputTriangleStrip].caps.push_back(CapabilityGeometry); - ExecutionModeParams[ExecutionModeVecTypeHint].caps.push_back(CapabilityKernel); - ExecutionModeParams[ExecutionModeContractionOff].caps.push_back(CapabilityKernel); - - DecorationParams[DecorationRelaxedPrecision].caps.push_back(CapabilityShader); - DecorationParams[DecorationBlock].caps.push_back(CapabilityShader); - DecorationParams[DecorationBufferBlock].caps.push_back(CapabilityShader); - DecorationParams[DecorationRowMajor].caps.push_back(CapabilityMatrix); - DecorationParams[DecorationColMajor].caps.push_back(CapabilityMatrix); - DecorationParams[DecorationGLSLShared].caps.push_back(CapabilityShader); - DecorationParams[DecorationGLSLPacked].caps.push_back(CapabilityShader); - DecorationParams[DecorationNoPerspective].caps.push_back(CapabilityShader); - DecorationParams[DecorationFlat].caps.push_back(CapabilityShader); - DecorationParams[DecorationPatch].caps.push_back(CapabilityTessellation); - DecorationParams[DecorationCentroid].caps.push_back(CapabilityShader); - DecorationParams[DecorationSample].caps.push_back(CapabilitySampleRateShading); - DecorationParams[DecorationInvariant].caps.push_back(CapabilityShader); - DecorationParams[DecorationConstant].caps.push_back(CapabilityKernel); - DecorationParams[DecorationUniform].caps.push_back(CapabilityShader); - DecorationParams[DecorationCPacked].caps.push_back(CapabilityKernel); - DecorationParams[DecorationSaturatedConversion].caps.push_back(CapabilityKernel); - DecorationParams[DecorationStream].caps.push_back(CapabilityGeometryStreams); - DecorationParams[DecorationLocation].caps.push_back(CapabilityShader); - DecorationParams[DecorationComponent].caps.push_back(CapabilityShader); - DecorationParams[DecorationOffset].caps.push_back(CapabilityShader); - DecorationParams[DecorationIndex].caps.push_back(CapabilityShader); - DecorationParams[DecorationBinding].caps.push_back(CapabilityShader); - DecorationParams[DecorationDescriptorSet].caps.push_back(CapabilityShader); - DecorationParams[DecorationXfbBuffer].caps.push_back(CapabilityTransformFeedback); - DecorationParams[DecorationXfbStride].caps.push_back(CapabilityTransformFeedback); - DecorationParams[DecorationArrayStride].caps.push_back(CapabilityShader); - DecorationParams[DecorationMatrixStride].caps.push_back(CapabilityMatrix); - DecorationParams[DecorationFuncParamAttr].caps.push_back(CapabilityKernel); - DecorationParams[DecorationFPRoundingMode].caps.push_back(CapabilityKernel); - DecorationParams[DecorationFPFastMathMode].caps.push_back(CapabilityKernel); - DecorationParams[DecorationLinkageAttributes].caps.push_back(CapabilityLinkage); - DecorationParams[DecorationSpecId].caps.push_back(CapabilityShader); - DecorationParams[DecorationNoContraction].caps.push_back(CapabilityShader); - DecorationParams[DecorationInputAttachmentIndex].caps.push_back(CapabilityInputAttachment); - DecorationParams[DecorationAlignment].caps.push_back(CapabilityKernel); - - BuiltInParams[BuiltInPosition].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInPointSize].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInClipDistance].caps.push_back(CapabilityClipDistance); - BuiltInParams[BuiltInCullDistance].caps.push_back(CapabilityCullDistance); - - BuiltInParams[BuiltInVertexId].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInVertexId].desc = "Vertex ID, which takes on values 0, 1, 2, . . . ."; - - BuiltInParams[BuiltInInstanceId].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInInstanceId].desc = "Instance ID, which takes on values 0, 1, 2, . . . ."; - - BuiltInParams[BuiltInVertexIndex].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInVertexIndex].desc = "Vertex index, which takes on values base, base+1, base+2, . . . ."; - - BuiltInParams[BuiltInInstanceIndex].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInInstanceIndex].desc = "Instance index, which takes on values base, base+1, base+2, . . . ."; - - BuiltInParams[BuiltInPrimitiveId].caps.push_back(CapabilityGeometry); - BuiltInParams[BuiltInPrimitiveId].caps.push_back(CapabilityTessellation); - BuiltInParams[BuiltInInvocationId].caps.push_back(CapabilityGeometry); - BuiltInParams[BuiltInInvocationId].caps.push_back(CapabilityTessellation); - BuiltInParams[BuiltInLayer].caps.push_back(CapabilityGeometry); - BuiltInParams[BuiltInViewportIndex].caps.push_back(CapabilityMultiViewport); - BuiltInParams[BuiltInTessLevelOuter].caps.push_back(CapabilityTessellation); - BuiltInParams[BuiltInTessLevelInner].caps.push_back(CapabilityTessellation); - BuiltInParams[BuiltInTessCoord].caps.push_back(CapabilityTessellation); - BuiltInParams[BuiltInPatchVertices].caps.push_back(CapabilityTessellation); - BuiltInParams[BuiltInFragCoord].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInPointCoord].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInFrontFacing].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInSampleId].caps.push_back(CapabilitySampleRateShading); - BuiltInParams[BuiltInSamplePosition].caps.push_back(CapabilitySampleRateShading); - BuiltInParams[BuiltInSampleMask].caps.push_back(CapabilitySampleRateShading); - BuiltInParams[BuiltInFragDepth].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInHelperInvocation].caps.push_back(CapabilityShader); - BuiltInParams[BuiltInWorkDim].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInGlobalSize].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInEnqueuedWorkgroupSize].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInGlobalOffset].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInGlobalLinearId].caps.push_back(CapabilityKernel); - - BuiltInParams[BuiltInSubgroupSize].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInSubgroupMaxSize].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInNumSubgroups].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInNumEnqueuedSubgroups].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInSubgroupId].caps.push_back(CapabilityKernel); - BuiltInParams[BuiltInSubgroupLocalInvocationId].caps.push_back(CapabilityKernel); - - DimensionalityParams[Dim1D].caps.push_back(CapabilitySampled1D); - DimensionalityParams[DimCube].caps.push_back(CapabilityShader); - DimensionalityParams[DimRect].caps.push_back(CapabilitySampledRect); - DimensionalityParams[DimBuffer].caps.push_back(CapabilitySampledBuffer); - DimensionalityParams[DimSubpassData].caps.push_back(CapabilityInputAttachment); - - // Group Operations - for (int i = 0; i < GroupOperationCeiling; ++i) { - GroupOperationParams[i].caps.push_back(CapabilityKernel); - } - - // Enqueue flags - for (int i = 0; i < KernelEnqueueFlagsCeiling; ++i) { - KernelEnqueueFlagsParams[i].caps.push_back(CapabilityKernel); - } - - // Profiling info - KernelProfilingInfoParams[0].caps.push_back(CapabilityKernel); + OperandClassParams[OperandScope].set(0, ScopeString, nullptr); + OperandClassParams[OperandGroupOperation].set(0, GroupOperationString, nullptr); + OperandClassParams[OperandKernelEnqueueFlags].set(0, KernelEnqueueFlagsString, nullptr); + OperandClassParams[OperandKernelProfilingInfo].set(0, KernelProfilingInfoString, nullptr, true); + OperandClassParams[OperandCapability].set(0, CapabilityString, nullptr); + OperandClassParams[OperandOpcode].set(OpCodeMask + 1, OpcodeString, 0); // set name of operator, an initial set of style operands, and the description @@ -1779,7 +1557,6 @@ void Parameterize() InstructionDesc[OpTypeVector].operands.push(OperandId, "'Component Type'"); InstructionDesc[OpTypeVector].operands.push(OperandLiteralNumber, "'Component Count'"); - InstructionDesc[OpTypeMatrix].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpTypeMatrix].operands.push(OperandId, "'Column Type'"); InstructionDesc[OpTypeMatrix].operands.push(OperandLiteralNumber, "'Column Count'"); @@ -1797,31 +1574,19 @@ void Parameterize() InstructionDesc[OpTypeArray].operands.push(OperandId, "'Element Type'"); InstructionDesc[OpTypeArray].operands.push(OperandId, "'Length'"); - InstructionDesc[OpTypeRuntimeArray].capabilities.push_back(CapabilityShader); InstructionDesc[OpTypeRuntimeArray].operands.push(OperandId, "'Element Type'"); InstructionDesc[OpTypeStruct].operands.push(OperandVariableIds, "'Member 0 type', +\n'member 1 type', +\n..."); - InstructionDesc[OpTypeOpaque].capabilities.push_back(CapabilityKernel); InstructionDesc[OpTypeOpaque].operands.push(OperandLiteralString, "The name of the opaque type."); InstructionDesc[OpTypePointer].operands.push(OperandStorage, ""); InstructionDesc[OpTypePointer].operands.push(OperandId, "'Type'"); - InstructionDesc[OpTypeForwardPointer].capabilities.push_back(CapabilityAddresses); InstructionDesc[OpTypeForwardPointer].operands.push(OperandId, "'Pointer Type'"); InstructionDesc[OpTypeForwardPointer].operands.push(OperandStorage, ""); - InstructionDesc[OpTypeEvent].capabilities.push_back(CapabilityKernel); - - InstructionDesc[OpTypeDeviceEvent].capabilities.push_back(CapabilityDeviceEnqueue); - - InstructionDesc[OpTypeReserveId].capabilities.push_back(CapabilityPipes); - - InstructionDesc[OpTypeQueue].capabilities.push_back(CapabilityDeviceEnqueue); - InstructionDesc[OpTypePipe].operands.push(OperandAccessQualifier, "'Qualifier'"); - InstructionDesc[OpTypePipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpTypeFunction].operands.push(OperandId, "'Return Type'"); InstructionDesc[OpTypeFunction].operands.push(OperandVariableIds, "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..."); @@ -1830,7 +1595,6 @@ void Parameterize() InstructionDesc[OpConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); - InstructionDesc[OpConstantSampler].capabilities.push_back(CapabilityLiteralSampler); InstructionDesc[OpConstantSampler].operands.push(OperandSamplerAddressingMode, ""); InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber, "'Param'"); InstructionDesc[OpConstantSampler].operands.push(OperandSamplerFilterMode, ""); @@ -1857,10 +1621,14 @@ void Parameterize() InstructionDesc[OpLoad].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpLoad].operands.push(OperandMemoryAccess, "", true); + InstructionDesc[OpLoad].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpLoad].operands.push(OperandId, "", true); InstructionDesc[OpStore].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpStore].operands.push(OperandId, "'Object'"); InstructionDesc[OpStore].operands.push(OperandMemoryAccess, "", true); + InstructionDesc[OpStore].operands.push(OperandLiteralNumber, "", true); + InstructionDesc[OpStore].operands.push(OperandId, "", true); InstructionDesc[OpPhi].operands.push(OperandVariableIds, "'Variable, Parent, ...'"); @@ -1868,11 +1636,24 @@ void Parameterize() InstructionDesc[OpDecorate].operands.push(OperandDecoration, ""); InstructionDesc[OpDecorate].operands.push(OperandVariableLiterals, "See <>."); + InstructionDesc[OpDecorateId].operands.push(OperandId, "'Target'"); + InstructionDesc[OpDecorateId].operands.push(OperandDecoration, ""); + InstructionDesc[OpDecorateId].operands.push(OperandVariableIds, "See <>."); + + InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandId, "'Target'"); + InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandDecoration, ""); + InstructionDesc[OpDecorateStringGOOGLE].operands.push(OperandLiteralString, "'Literal String'"); + InstructionDesc[OpMemberDecorate].operands.push(OperandId, "'Structure Type'"); InstructionDesc[OpMemberDecorate].operands.push(OperandLiteralNumber, "'Member'"); InstructionDesc[OpMemberDecorate].operands.push(OperandDecoration, ""); InstructionDesc[OpMemberDecorate].operands.push(OperandVariableLiterals, "See <>."); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandId, "'Structure Type'"); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandDecoration, ""); + InstructionDesc[OpMemberDecorateStringGOOGLE].operands.push(OperandLiteralString, "'Literal String'"); + InstructionDesc[OpGroupDecorate].operands.push(OperandId, "'Decoration Group'"); InstructionDesc[OpGroupDecorate].operands.push(OperandVariableIds, "'Targets'"); @@ -1910,8 +1691,6 @@ void Parameterize() InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Size'"); InstructionDesc[OpCopyMemorySized].operands.push(OperandMemoryAccess, "", true); - InstructionDesc[OpCopyMemorySized].capabilities.push_back(CapabilityAddresses); - InstructionDesc[OpSampledImage].operands.push(OperandId, "'Image'"); InstructionDesc[OpSampledImage].operands.push(OperandId, "'Sampler'"); @@ -1932,7 +1711,6 @@ void Parameterize() InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleImplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleExplicitLod].operands.push(OperandId, "'Coordinate'"); @@ -1944,40 +1722,34 @@ void Parameterize() InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleDrefImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleDrefImplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleDrefExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleDrefExplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleProjImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleProjImplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleProjExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleProjExplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleProjDrefImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleProjDrefImplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSampleProjDrefExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSampleProjDrefExplicitLod].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageFetch].operands.push(OperandId, "'Image'"); InstructionDesc[OpImageFetch].operands.push(OperandId, "'Coordinate'"); @@ -1989,122 +1761,96 @@ void Parameterize() InstructionDesc[OpImageGather].operands.push(OperandId, "'Component'"); InstructionDesc[OpImageGather].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageGather].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageGather].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageDrefGather].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageDrefGather].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageDrefGather].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageDrefGather].capabilities.push_back(CapabilityShader); InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleImplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleExplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleDrefImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleDrefImplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleDrefExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleDrefExplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleProjImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleProjImplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleProjExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleProjExplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleProjDrefImplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseSampleProjDrefExplicitLod].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseFetch].operands.push(OperandId, "'Image'"); InstructionDesc[OpImageSparseFetch].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseFetch].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseFetch].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseFetch].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseGather].operands.push(OperandId, "'Component'"); InstructionDesc[OpImageSparseGather].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseGather].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseGather].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'Sampled Image'"); InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseDrefGather].operands.push(OperandId, "'D~ref~'"); InstructionDesc[OpImageSparseDrefGather].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseDrefGather].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseDrefGather].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseRead].operands.push(OperandId, "'Image'"); InstructionDesc[OpImageSparseRead].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpImageSparseRead].operands.push(OperandImageOperands, "", true); InstructionDesc[OpImageSparseRead].operands.push(OperandVariableIds, "", true); - InstructionDesc[OpImageSparseRead].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageSparseTexelsResident].operands.push(OperandId, "'Resident Code'"); - InstructionDesc[OpImageSparseTexelsResident].capabilities.push_back(CapabilitySparseResidency); InstructionDesc[OpImageQuerySizeLod].operands.push(OperandId, "'Image'"); InstructionDesc[OpImageQuerySizeLod].operands.push(OperandId, "'Level of Detail'"); - InstructionDesc[OpImageQuerySizeLod].capabilities.push_back(CapabilityKernel); - InstructionDesc[OpImageQuerySizeLod].capabilities.push_back(CapabilityImageQuery); InstructionDesc[OpImageQuerySize].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQuerySize].capabilities.push_back(CapabilityKernel); - InstructionDesc[OpImageQuerySize].capabilities.push_back(CapabilityImageQuery); InstructionDesc[OpImageQueryLod].operands.push(OperandId, "'Image'"); InstructionDesc[OpImageQueryLod].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpImageQueryLod].capabilities.push_back(CapabilityImageQuery); InstructionDesc[OpImageQueryLevels].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQueryLevels].capabilities.push_back(CapabilityKernel); - InstructionDesc[OpImageQueryLevels].capabilities.push_back(CapabilityImageQuery); InstructionDesc[OpImageQuerySamples].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQuerySamples].capabilities.push_back(CapabilityKernel); - InstructionDesc[OpImageQuerySamples].capabilities.push_back(CapabilityImageQuery); InstructionDesc[OpImageQueryFormat].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQueryFormat].capabilities.push_back(CapabilityKernel); InstructionDesc[OpImageQueryOrder].operands.push(OperandId, "'Image'"); - InstructionDesc[OpImageQueryOrder].capabilities.push_back(CapabilityKernel); InstructionDesc[OpAccessChain].operands.push(OperandId, "'Base'"); InstructionDesc[OpAccessChain].operands.push(OperandVariableIds, "'Indexes'"); @@ -2115,12 +1861,10 @@ void Parameterize() InstructionDesc[OpPtrAccessChain].operands.push(OperandId, "'Base'"); InstructionDesc[OpPtrAccessChain].operands.push(OperandId, "'Element'"); InstructionDesc[OpPtrAccessChain].operands.push(OperandVariableIds, "'Indexes'"); - InstructionDesc[OpPtrAccessChain].capabilities.push_back(CapabilityAddresses); InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandId, "'Base'"); InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandId, "'Element'"); InstructionDesc[OpInBoundsPtrAccessChain].operands.push(OperandVariableIds, "'Indexes'"); - InstructionDesc[OpInBoundsPtrAccessChain].capabilities.push_back(CapabilityAddresses); InstructionDesc[OpSNegate].operands.push(OperandId, "'Operand'"); @@ -2147,65 +1891,49 @@ void Parameterize() InstructionDesc[OpFConvert].operands.push(OperandId, "'Float Value'"); InstructionDesc[OpSatConvertSToU].operands.push(OperandId, "'Signed Value'"); - InstructionDesc[OpSatConvertSToU].capabilities.push_back(CapabilityKernel); InstructionDesc[OpSatConvertUToS].operands.push(OperandId, "'Unsigned Value'"); - InstructionDesc[OpSatConvertUToS].capabilities.push_back(CapabilityKernel); InstructionDesc[OpConvertPtrToU].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpConvertPtrToU].capabilities.push_back(CapabilityAddresses); InstructionDesc[OpConvertUToPtr].operands.push(OperandId, "'Integer Value'"); - InstructionDesc[OpConvertUToPtr].capabilities.push_back(CapabilityAddresses); InstructionDesc[OpPtrCastToGeneric].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpPtrCastToGeneric].capabilities.push_back(CapabilityKernel); InstructionDesc[OpGenericCastToPtr].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpGenericCastToPtr].capabilities.push_back(CapabilityKernel); InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandStorage, "'Storage'"); - InstructionDesc[OpGenericCastToPtrExplicit].capabilities.push_back(CapabilityKernel); InstructionDesc[OpGenericPtrMemSemantics].operands.push(OperandId, "'Pointer'"); - InstructionDesc[OpGenericPtrMemSemantics].capabilities.push_back(CapabilityKernel); InstructionDesc[OpBitcast].operands.push(OperandId, "'Operand'"); InstructionDesc[OpQuantizeToF16].operands.push(OperandId, "'Value'"); - InstructionDesc[OpTranspose].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'"); InstructionDesc[OpIsNan].operands.push(OperandId, "'x'"); InstructionDesc[OpIsInf].operands.push(OperandId, "'x'"); - InstructionDesc[OpIsFinite].capabilities.push_back(CapabilityKernel); InstructionDesc[OpIsFinite].operands.push(OperandId, "'x'"); - InstructionDesc[OpIsNormal].capabilities.push_back(CapabilityKernel); InstructionDesc[OpIsNormal].operands.push(OperandId, "'x'"); - InstructionDesc[OpSignBitSet].capabilities.push_back(CapabilityKernel); InstructionDesc[OpSignBitSet].operands.push(OperandId, "'x'"); - InstructionDesc[OpLessOrGreater].capabilities.push_back(CapabilityKernel); InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'x'"); InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'y'"); - InstructionDesc[OpOrdered].capabilities.push_back(CapabilityKernel); InstructionDesc[OpOrdered].operands.push(OperandId, "'x'"); InstructionDesc[OpOrdered].operands.push(OperandId, "'y'"); - InstructionDesc[OpUnordered].capabilities.push_back(CapabilityKernel); InstructionDesc[OpUnordered].operands.push(OperandId, "'x'"); InstructionDesc[OpUnordered].operands.push(OperandId, "'y'"); InstructionDesc[OpArrayLength].operands.push(OperandId, "'Structure'"); InstructionDesc[OpArrayLength].operands.push(OperandLiteralNumber, "'Array member'"); - InstructionDesc[OpArrayLength].capabilities.push_back(CapabilityShader); InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 1'"); InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 2'"); @@ -2252,23 +1980,18 @@ void Parameterize() InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Vector'"); InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Scalar'"); - InstructionDesc[OpMatrixTimesScalar].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Matrix'"); InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Scalar'"); - InstructionDesc[OpVectorTimesMatrix].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Vector'"); InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Matrix'"); - InstructionDesc[OpMatrixTimesVector].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Matrix'"); InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Vector'"); - InstructionDesc[OpMatrixTimesMatrix].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'LeftMatrix'"); InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'RightMatrix'"); - InstructionDesc[OpOuterProduct].capabilities.push_back(CapabilityMatrix); InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 1'"); InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 2'"); @@ -2319,23 +2042,19 @@ void Parameterize() InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 1'"); InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpBitFieldInsert].capabilities.push_back(CapabilityShader); InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Base'"); InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Insert'"); InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Offset'"); InstructionDesc[OpBitFieldInsert].operands.push(OperandId, "'Count'"); - - InstructionDesc[OpBitFieldSExtract].capabilities.push_back(CapabilityShader); + InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Base'"); InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Offset'"); InstructionDesc[OpBitFieldSExtract].operands.push(OperandId, "'Count'"); - InstructionDesc[OpBitFieldUExtract].capabilities.push_back(CapabilityShader); InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Base'"); InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Offset'"); InstructionDesc[OpBitFieldUExtract].operands.push(OperandId, "'Count'"); - InstructionDesc[OpBitReverse].capabilities.push_back(CapabilityShader); InstructionDesc[OpBitReverse].operands.push(OperandId, "'Base'"); InstructionDesc[OpBitCount].operands.push(OperandId, "'Base'"); @@ -2410,42 +2129,27 @@ void Parameterize() InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); - InstructionDesc[OpDPdx].capabilities.push_back(CapabilityShader); InstructionDesc[OpDPdx].operands.push(OperandId, "'P'"); - InstructionDesc[OpDPdy].capabilities.push_back(CapabilityShader); InstructionDesc[OpDPdy].operands.push(OperandId, "'P'"); - InstructionDesc[OpFwidth].capabilities.push_back(CapabilityShader); InstructionDesc[OpFwidth].operands.push(OperandId, "'P'"); - InstructionDesc[OpDPdxFine].capabilities.push_back(CapabilityDerivativeControl); InstructionDesc[OpDPdxFine].operands.push(OperandId, "'P'"); - InstructionDesc[OpDPdyFine].capabilities.push_back(CapabilityDerivativeControl); InstructionDesc[OpDPdyFine].operands.push(OperandId, "'P'"); - InstructionDesc[OpFwidthFine].capabilities.push_back(CapabilityDerivativeControl); InstructionDesc[OpFwidthFine].operands.push(OperandId, "'P'"); - InstructionDesc[OpDPdxCoarse].capabilities.push_back(CapabilityDerivativeControl); InstructionDesc[OpDPdxCoarse].operands.push(OperandId, "'P'"); - InstructionDesc[OpDPdyCoarse].capabilities.push_back(CapabilityDerivativeControl); InstructionDesc[OpDPdyCoarse].operands.push(OperandId, "'P'"); - InstructionDesc[OpFwidthCoarse].capabilities.push_back(CapabilityDerivativeControl); InstructionDesc[OpFwidthCoarse].operands.push(OperandId, "'P'"); - InstructionDesc[OpEmitVertex].capabilities.push_back(CapabilityGeometry); - - InstructionDesc[OpEndPrimitive].capabilities.push_back(CapabilityGeometry); - InstructionDesc[OpEmitStreamVertex].operands.push(OperandId, "'Stream'"); - InstructionDesc[OpEmitStreamVertex].capabilities.push_back(CapabilityGeometryStreams); InstructionDesc[OpEndStreamPrimitive].operands.push(OperandId, "'Stream'"); - InstructionDesc[OpEndStreamPrimitive].capabilities.push_back(CapabilityGeometryStreams); InstructionDesc[OpControlBarrier].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpControlBarrier].operands.push(OperandScope, "'Memory'"); @@ -2485,7 +2189,6 @@ void Parameterize() InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics, "'Unequal'"); InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Value'"); InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Comparator'"); - InstructionDesc[OpAtomicCompareExchangeWeak].capabilities.push_back(CapabilityKernel); InstructionDesc[OpAtomicIIncrement].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpAtomicIIncrement].operands.push(OperandScope, "'Scope'"); @@ -2543,16 +2246,15 @@ void Parameterize() InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandScope, "'Scope'"); InstructionDesc[OpAtomicFlagTestAndSet].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicFlagTestAndSet].capabilities.push_back(CapabilityKernel); InstructionDesc[OpAtomicFlagClear].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpAtomicFlagClear].operands.push(OperandScope, "'Scope'"); InstructionDesc[OpAtomicFlagClear].operands.push(OperandMemorySemantics, "'Semantics'"); - InstructionDesc[OpAtomicFlagClear].capabilities.push_back(CapabilityKernel); InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Merge Block'"); InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Continue Target'"); InstructionDesc[OpLoopMerge].operands.push(OperandLoop, ""); + InstructionDesc[OpLoopMerge].operands.push(OperandOptionalLiteral, ""); InstructionDesc[OpSelectionMerge].operands.push(OperandId, "'Merge Block'"); InstructionDesc[OpSelectionMerge].operands.push(OperandSelect, ""); @@ -2568,19 +2270,15 @@ void Parameterize() InstructionDesc[OpSwitch].operands.push(OperandId, "'Default'"); InstructionDesc[OpSwitch].operands.push(OperandVariableLiteralId, "'Target'"); - InstructionDesc[OpKill].capabilities.push_back(CapabilityShader); InstructionDesc[OpReturnValue].operands.push(OperandId, "'Value'"); InstructionDesc[OpLifetimeStart].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpLifetimeStart].operands.push(OperandLiteralNumber, "'Size'"); - InstructionDesc[OpLifetimeStart].capabilities.push_back(CapabilityKernel); InstructionDesc[OpLifetimeStop].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpLifetimeStop].operands.push(OperandLiteralNumber, "'Size'"); - InstructionDesc[OpLifetimeStop].capabilities.push_back(CapabilityKernel); - InstructionDesc[OpGroupAsyncCopy].capabilities.push_back(CapabilityKernel); InstructionDesc[OpGroupAsyncCopy].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Destination'"); InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Source'"); @@ -2588,77 +2286,62 @@ void Parameterize() InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Stride'"); InstructionDesc[OpGroupAsyncCopy].operands.push(OperandId, "'Event'"); - InstructionDesc[OpGroupWaitEvents].capabilities.push_back(CapabilityKernel); InstructionDesc[OpGroupWaitEvents].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupWaitEvents].operands.push(OperandId, "'Num Events'"); InstructionDesc[OpGroupWaitEvents].operands.push(OperandId, "'Events List'"); - InstructionDesc[OpGroupAll].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupAll].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupAll].operands.push(OperandId, "'Predicate'"); - InstructionDesc[OpGroupAny].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupAny].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupAny].operands.push(OperandId, "'Predicate'"); - InstructionDesc[OpGroupBroadcast].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupBroadcast].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'Value'"); InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'LocalId'"); - InstructionDesc[OpGroupIAdd].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupIAdd].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupIAdd].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupIAdd].operands.push(OperandId, "'X'"); - InstructionDesc[OpGroupFAdd].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupFAdd].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupFAdd].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupFAdd].operands.push(OperandId, "'X'"); - InstructionDesc[OpGroupUMin].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupUMin].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupUMin].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupUMin].operands.push(OperandId, "'X'"); - InstructionDesc[OpGroupSMin].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupSMin].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupSMin].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupSMin].operands.push(OperandId, "X"); - InstructionDesc[OpGroupFMin].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupFMin].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupFMin].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupFMin].operands.push(OperandId, "X"); - InstructionDesc[OpGroupUMax].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupUMax].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupUMax].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupUMax].operands.push(OperandId, "X"); - InstructionDesc[OpGroupSMax].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupSMax].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupSMax].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupSMax].operands.push(OperandId, "X"); - InstructionDesc[OpGroupFMax].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupFMax].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupFMax].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupFMax].operands.push(OperandId, "X"); - InstructionDesc[OpReadPipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpReadPipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpReadPipe].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpReadPipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpReadPipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpWritePipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpWritePipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpWritePipe].operands.push(OperandId, "'Pointer'"); InstructionDesc[OpWritePipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpWritePipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpReservedReadPipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Reserve Id'"); InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Index'"); @@ -2666,7 +2349,6 @@ void Parameterize() InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpReservedWritePipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Reserve Id'"); InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Index'"); @@ -2674,127 +2356,99 @@ void Parameterize() InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpReserveReadPipePackets].capabilities.push_back(CapabilityPipes); InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Num Packets'"); InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpReserveWritePipePackets].capabilities.push_back(CapabilityPipes); InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Num Packets'"); InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpCommitReadPipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Reserve Id'"); InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpCommitWritePipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Reserve Id'"); InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpIsValidReserveId].capabilities.push_back(CapabilityPipes); InstructionDesc[OpIsValidReserveId].operands.push(OperandId, "'Reserve Id'"); - InstructionDesc[OpGetNumPipePackets].capabilities.push_back(CapabilityPipes); InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpGetMaxPipePackets].capabilities.push_back(CapabilityPipes); InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpGroupReserveReadPipePackets].capabilities.push_back(CapabilityPipes); InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Num Packets'"); InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpGroupReserveWritePipePackets].capabilities.push_back(CapabilityPipes); InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Num Packets'"); InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpGroupCommitReadPipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Reserve Id'"); InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpGroupCommitWritePipe].capabilities.push_back(CapabilityPipes); InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Pipe'"); InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Reserve Id'"); InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Packet Size'"); InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'Packet Alignment'"); - InstructionDesc[OpBuildNDRange].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkSize'"); InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'LocalWorkSize'"); InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkOffset'"); - InstructionDesc[OpGetDefaultQueue].capabilities.push_back(CapabilityDeviceEnqueue); - - InstructionDesc[OpCaptureEventProfilingInfo].capabilities.push_back(CapabilityDeviceEnqueue); - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Event'"); InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Profiling Info'"); InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'Value'"); - InstructionDesc[OpSetUserEventStatus].capabilities.push_back(CapabilityDeviceEnqueue); - InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'Event'"); InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'Status'"); - InstructionDesc[OpIsValidEvent].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpIsValidEvent].operands.push(OperandId, "'Event'"); - InstructionDesc[OpCreateUserEvent].capabilities.push_back(CapabilityDeviceEnqueue); - - InstructionDesc[OpRetainEvent].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpRetainEvent].operands.push(OperandId, "'Event'"); - InstructionDesc[OpReleaseEvent].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpReleaseEvent].operands.push(OperandId, "'Event'"); - InstructionDesc[OpGetKernelWorkGroupSize].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Invoke'"); InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param'"); InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param Size'"); InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Param Align'"); - InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Invoke'"); InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param'"); InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param Size'"); InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Param Align'"); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'ND Range'"); InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Invoke'"); InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param'"); InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param Size'"); InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Param Align'"); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'ND Range'"); InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Invoke'"); InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param'"); InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param Size'"); InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Param Align'"); - InstructionDesc[OpEnqueueKernel].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Queue'"); InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Flags'"); InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'ND Range'"); @@ -2807,82 +2461,251 @@ void Parameterize() InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Align'"); InstructionDesc[OpEnqueueKernel].operands.push(OperandVariableIds, "'Local Size'"); - InstructionDesc[OpEnqueueMarker].capabilities.push_back(CapabilityDeviceEnqueue); InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Queue'"); InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Num Events'"); InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Wait Events'"); InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Ret Event'"); + InstructionDesc[OpGroupNonUniformElect].operands.push(OperandScope, "'Execution'"); + + InstructionDesc[OpGroupNonUniformAll].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformAll].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformAny].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformAny].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformAllEqual].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformAllEqual].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBroadcast].operands.push(OperandId, "ID"); + + InstructionDesc[OpGroupNonUniformBroadcastFirst].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBroadcastFirst].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallot].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallot].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformInverseBallot].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformInverseBallot].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBallotBitExtract].operands.push(OperandId, "Bit"); + + InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBallotBitCount].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallotFindLSB].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotFindLSB].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformBallotFindMSB].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBallotFindMSB].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffle].operands.push(OperandId, "'Id'"); + + InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffleXor].operands.push(OperandId, "Mask"); + + InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffleUp].operands.push(OperandId, "Offset"); + + InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformShuffleDown].operands.push(OperandId, "Offset"); + + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformIAdd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFAdd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformIMul].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFMul].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformSMin].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformUMin].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFMin].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformSMax].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformUMax].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformFMax].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBitwiseAnd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBitwiseOr].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformBitwiseXor].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformLogicalAnd].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformLogicalOr].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformLogicalXor].operands.push(OperandId, "'ClusterSize'", true); + + InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformQuadBroadcast].operands.push(OperandId, "'Id'"); + + InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandScope, "'Execution'"); + InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandId, "X"); + InstructionDesc[OpGroupNonUniformQuadSwap].operands.push(OperandLiteralNumber, "'Direction'"); + InstructionDesc[OpSubgroupBallotKHR].operands.push(OperandId, "'Predicate'"); InstructionDesc[OpSubgroupFirstInvocationKHR].operands.push(OperandId, "'Value'"); - InstructionDesc[OpSubgroupAnyKHR].capabilities.push_back(CapabilitySubgroupVoteKHR); InstructionDesc[OpSubgroupAnyKHR].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpSubgroupAnyKHR].operands.push(OperandId, "'Predicate'"); - InstructionDesc[OpSubgroupAllKHR].capabilities.push_back(CapabilitySubgroupVoteKHR); InstructionDesc[OpSubgroupAllKHR].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpSubgroupAllKHR].operands.push(OperandId, "'Predicate'"); - InstructionDesc[OpSubgroupAllEqualKHR].capabilities.push_back(CapabilitySubgroupVoteKHR); InstructionDesc[OpSubgroupAllEqualKHR].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpSubgroupAllEqualKHR].operands.push(OperandId, "'Predicate'"); - InstructionDesc[OpSubgroupReadInvocationKHR].capabilities.push_back(CapabilityGroups); InstructionDesc[OpSubgroupReadInvocationKHR].operands.push(OperandId, "'Value'"); InstructionDesc[OpSubgroupReadInvocationKHR].operands.push(OperandId, "'Index'"); + InstructionDesc[OpModuleProcessed].operands.push(OperandLiteralString, "'process'"); + #ifdef AMD_EXTENSIONS - InstructionDesc[OpGroupIAddNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandId, "'X'"); - InstructionDesc[OpGroupFAddNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupFAddNonUniformAMD].operands.push(OperandId, "'X'"); - InstructionDesc[OpGroupUMinNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupUMinNonUniformAMD].operands.push(OperandId, "'X'"); - InstructionDesc[OpGroupSMinNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupSMinNonUniformAMD].operands.push(OperandId, "X"); - InstructionDesc[OpGroupFMinNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupFMinNonUniformAMD].operands.push(OperandId, "X"); - InstructionDesc[OpGroupUMaxNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupUMaxNonUniformAMD].operands.push(OperandId, "X"); - InstructionDesc[OpGroupSMaxNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupSMaxNonUniformAMD].operands.push(OperandId, "X"); - InstructionDesc[OpGroupFMaxNonUniformAMD].capabilities.push_back(CapabilityGroups); InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandScope, "'Execution'"); InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandGroupOperation, "'Operation'"); InstructionDesc[OpGroupFMaxNonUniformAMD].operands.push(OperandId, "X"); - InstructionDesc[OpFragmentMaskFetchAMD].capabilities.push_back(CapabilityFragmentMaskAMD); InstructionDesc[OpFragmentMaskFetchAMD].operands.push(OperandId, "'Image'"); InstructionDesc[OpFragmentMaskFetchAMD].operands.push(OperandId, "'Coordinate'"); - InstructionDesc[OpFragmentFetchAMD].capabilities.push_back(CapabilityFragmentMaskAMD); InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Image'"); InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Coordinate'"); InstructionDesc[OpFragmentFetchAMD].operands.push(OperandId, "'Fragment Index'"); #endif + +#ifdef NV_EXTENSIONS + InstructionDesc[OpGroupNonUniformPartitionNV].operands.push(OperandId, "X"); + + InstructionDesc[OpTypeAccelerationStructureNV].setResultAndType(true, false); + + InstructionDesc[OpTraceNV].operands.push(OperandId, "'NV Acceleration Structure'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Flags'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Cull Mask'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Offset'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'SBT Record Stride'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Miss Index'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Origin'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMin'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Ray Direction'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'TMax'"); + InstructionDesc[OpTraceNV].operands.push(OperandId, "'Payload'"); + InstructionDesc[OpTraceNV].setResultAndType(false, false); + + InstructionDesc[OpReportIntersectionNV].operands.push(OperandId, "'Hit Parameter'"); + InstructionDesc[OpReportIntersectionNV].operands.push(OperandId, "'Hit Kind'"); + + InstructionDesc[OpIgnoreIntersectionNV].setResultAndType(false, false); + + InstructionDesc[OpTerminateRayNV].setResultAndType(false, false); + + InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "SBT Record Index"); + InstructionDesc[OpExecuteCallableNV].operands.push(OperandId, "CallableData ID"); + InstructionDesc[OpExecuteCallableNV].setResultAndType(false, false); + + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Sampled Image'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Granularity'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandId, "'Coarse'"); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandImageOperands, "", true); + InstructionDesc[OpImageSampleFootprintNV].operands.push(OperandVariableIds, "", true); + + InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Index Offset'"); + InstructionDesc[OpWritePackedPrimitiveIndices4x8NV].operands.push(OperandId, "'Packed Indices'"); +#endif } }; // end spv namespace diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.h index 710ca1a52be..7d0475d3ebb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/doc.h @@ -190,7 +190,6 @@ protected: class EnumParameters { public: EnumParameters() : desc(0) { } - EnumCaps caps; const char* desc; }; @@ -235,7 +234,6 @@ public: bool hasType() const { return typePresent != 0; } const char* opDesc; - EnumCaps capabilities; OpcodeClass opClass; OperandParameters operands; @@ -244,8 +242,6 @@ protected: int resultPresent : 1; }; -const int OpcodeCeiling = 321; - // The set of objects that hold all the instruction/operand // parameterization information. extern InstructionParameters InstructionDesc[]; diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/spirv.hpp b/3rdparty/bgfx/3rdparty/glslang/SPIRV/spirv.hpp index 8bddf7e503a..72e577a1468 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/spirv.hpp +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/spirv.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017 The Khronos Group Inc. +// Copyright (c) 2014-2018 The Khronos Group Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and/or associated documentation files (the "Materials"), @@ -26,13 +26,14 @@ // the Binary Section of the SPIR-V specification. // Enumeration tokens for SPIR-V, in various styles: -// C, C++, C++11, JSON, Lua, Python +// C, C++, C++11, JSON, Lua, Python, C# // // - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL // - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL // - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL // - Lua will use tables, e.g.: spv.SourceLanguage.GLSL // - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// - C# will use enum classes in the Specification class located in the "Spv" namespace, e.g.: Spv.Specification.SourceLanguage.GLSL // // Some tokens act like mask values, which can be OR'd together, // while others are mutually exclusive. The mask-like ones have @@ -46,12 +47,12 @@ namespace spv { typedef unsigned int Id; -#define SPV_VERSION 0x10000 -#define SPV_REVISION 12 +#define SPV_VERSION 0x10300 +#define SPV_REVISION 1 static const unsigned int MagicNumber = 0x07230203; -static const unsigned int Version = 0x00010000; -static const unsigned int Revision = 12; +static const unsigned int Version = 0x00010300; +static const unsigned int Revision = 1; static const unsigned int OpCodeMask = 0xffff; static const unsigned int WordCountShift = 16; @@ -73,6 +74,14 @@ enum ExecutionModel { ExecutionModelFragment = 4, ExecutionModelGLCompute = 5, ExecutionModelKernel = 6, + ExecutionModelTaskNV = 5267, + ExecutionModelMeshNV = 5268, + ExecutionModelRayGenerationNV = 5313, + ExecutionModelIntersectionNV = 5314, + ExecutionModelAnyHitNV = 5315, + ExecutionModelClosestHitNV = 5316, + ExecutionModelMissNV = 5317, + ExecutionModelCallableNV = 5318, ExecutionModelMax = 0x7fffffff, }; @@ -87,6 +96,7 @@ enum MemoryModel { MemoryModelSimple = 0, MemoryModelGLSL450 = 1, MemoryModelOpenCL = 2, + MemoryModelVulkanKHR = 3, MemoryModelMax = 0x7fffffff, }; @@ -122,7 +132,20 @@ enum ExecutionMode { ExecutionModeOutputTriangleStrip = 29, ExecutionModeVecTypeHint = 30, ExecutionModeContractionOff = 31, + ExecutionModeInitializer = 33, + ExecutionModeFinalizer = 34, + ExecutionModeSubgroupSize = 35, + ExecutionModeSubgroupsPerWorkgroup = 36, + ExecutionModeSubgroupsPerWorkgroupId = 37, + ExecutionModeLocalSizeId = 38, + ExecutionModeLocalSizeHintId = 39, ExecutionModePostDepthCoverage = 4446, + ExecutionModeStencilRefReplacingEXT = 5027, + ExecutionModeOutputLinesNV = 5269, + ExecutionModeOutputPrimitivesNV = 5270, + ExecutionModeDerivativeGroupQuadsNV = 5289, + ExecutionModeDerivativeGroupLinearNV = 5290, + ExecutionModeOutputTrianglesNV = 5298, ExecutionModeMax = 0x7fffffff, }; @@ -140,6 +163,12 @@ enum StorageClass { StorageClassAtomicCounter = 10, StorageClassImage = 11, StorageClassStorageBuffer = 12, + StorageClassCallableDataNV = 5328, + StorageClassIncomingCallableDataNV = 5329, + StorageClassRayPayloadNV = 5338, + StorageClassHitAttributeNV = 5339, + StorageClassIncomingRayPayloadNV = 5342, + StorageClassShaderRecordBufferNV = 5343, StorageClassMax = 0x7fffffff, }; @@ -267,6 +296,10 @@ enum ImageOperandsShift { ImageOperandsConstOffsetsShift = 5, ImageOperandsSampleShift = 6, ImageOperandsMinLodShift = 7, + ImageOperandsMakeTexelAvailableKHRShift = 8, + ImageOperandsMakeTexelVisibleKHRShift = 9, + ImageOperandsNonPrivateTexelKHRShift = 10, + ImageOperandsVolatileTexelKHRShift = 11, ImageOperandsMax = 0x7fffffff, }; @@ -280,6 +313,10 @@ enum ImageOperandsMask { ImageOperandsConstOffsetsMask = 0x00000020, ImageOperandsSampleMask = 0x00000040, ImageOperandsMinLodMask = 0x00000080, + ImageOperandsMakeTexelAvailableKHRMask = 0x00000100, + ImageOperandsMakeTexelVisibleKHRMask = 0x00000200, + ImageOperandsNonPrivateTexelKHRMask = 0x00000400, + ImageOperandsVolatileTexelKHRMask = 0x00000800, }; enum FPFastMathModeShift { @@ -377,11 +414,21 @@ enum Decoration { DecorationNoContraction = 42, DecorationInputAttachmentIndex = 43, DecorationAlignment = 44, + DecorationMaxByteOffset = 45, + DecorationAlignmentId = 46, + DecorationMaxByteOffsetId = 47, DecorationExplicitInterpAMD = 4999, DecorationOverrideCoverageNV = 5248, DecorationPassthroughNV = 5250, DecorationViewportRelativeNV = 5252, DecorationSecondaryViewportRelativeNV = 5256, + DecorationPerPrimitiveNV = 5271, + DecorationPerViewNV = 5272, + DecorationPerTaskNV = 5273, + DecorationPerVertexNV = 5285, + DecorationNonUniformEXT = 5300, + DecorationHlslCounterBufferGOOGLE = 5634, + DecorationHlslSemanticGOOGLE = 5635, DecorationMax = 0x7fffffff, }; @@ -427,10 +474,15 @@ enum BuiltIn { BuiltInSubgroupLocalInvocationId = 41, BuiltInVertexIndex = 42, BuiltInInstanceIndex = 43, + BuiltInSubgroupEqMask = 4416, BuiltInSubgroupEqMaskKHR = 4416, + BuiltInSubgroupGeMask = 4417, BuiltInSubgroupGeMaskKHR = 4417, + BuiltInSubgroupGtMask = 4418, BuiltInSubgroupGtMaskKHR = 4418, + BuiltInSubgroupLeMask = 4419, BuiltInSubgroupLeMaskKHR = 4419, + BuiltInSubgroupLtMask = 4420, BuiltInSubgroupLtMaskKHR = 4420, BuiltInBaseVertex = 4424, BuiltInBaseInstance = 4425, @@ -450,6 +502,35 @@ enum BuiltIn { BuiltInSecondaryViewportMaskNV = 5258, BuiltInPositionPerViewNV = 5261, BuiltInViewportMaskPerViewNV = 5262, + BuiltInFullyCoveredEXT = 5264, + BuiltInTaskCountNV = 5274, + BuiltInPrimitiveCountNV = 5275, + BuiltInPrimitiveIndicesNV = 5276, + BuiltInClipDistancePerViewNV = 5277, + BuiltInCullDistancePerViewNV = 5278, + BuiltInLayerPerViewNV = 5279, + BuiltInMeshViewCountNV = 5280, + BuiltInMeshViewIndicesNV = 5281, + BuiltInBaryCoordNV = 5286, + BuiltInBaryCoordNoPerspNV = 5287, + BuiltInFragSizeEXT = 5292, + BuiltInFragmentSizeNV = 5292, + BuiltInFragInvocationCountEXT = 5293, + BuiltInInvocationsPerPixelNV = 5293, + BuiltInLaunchIdNV = 5319, + BuiltInLaunchSizeNV = 5320, + BuiltInWorldRayOriginNV = 5321, + BuiltInWorldRayDirectionNV = 5322, + BuiltInObjectRayOriginNV = 5323, + BuiltInObjectRayDirectionNV = 5324, + BuiltInRayTminNV = 5325, + BuiltInRayTmaxNV = 5326, + BuiltInInstanceCustomIndexNV = 5327, + BuiltInObjectToWorldNV = 5330, + BuiltInWorldToObjectNV = 5331, + BuiltInHitTNV = 5332, + BuiltInHitKindNV = 5333, + BuiltInIncomingRayFlagsNV = 5351, BuiltInMax = 0x7fffffff, }; @@ -468,6 +549,8 @@ enum SelectionControlMask { enum LoopControlShift { LoopControlUnrollShift = 0, LoopControlDontUnrollShift = 1, + LoopControlDependencyInfiniteShift = 2, + LoopControlDependencyLengthShift = 3, LoopControlMax = 0x7fffffff, }; @@ -475,6 +558,8 @@ enum LoopControlMask { LoopControlMaskNone = 0, LoopControlUnrollMask = 0x00000001, LoopControlDontUnrollMask = 0x00000002, + LoopControlDependencyInfiniteMask = 0x00000004, + LoopControlDependencyLengthMask = 0x00000008, }; enum FunctionControlShift { @@ -504,6 +589,9 @@ enum MemorySemanticsShift { MemorySemanticsCrossWorkgroupMemoryShift = 9, MemorySemanticsAtomicCounterMemoryShift = 10, MemorySemanticsImageMemoryShift = 11, + MemorySemanticsOutputMemoryKHRShift = 12, + MemorySemanticsMakeAvailableKHRShift = 13, + MemorySemanticsMakeVisibleKHRShift = 14, MemorySemanticsMax = 0x7fffffff, }; @@ -519,12 +607,18 @@ enum MemorySemanticsMask { MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, MemorySemanticsAtomicCounterMemoryMask = 0x00000400, MemorySemanticsImageMemoryMask = 0x00000800, + MemorySemanticsOutputMemoryKHRMask = 0x00001000, + MemorySemanticsMakeAvailableKHRMask = 0x00002000, + MemorySemanticsMakeVisibleKHRMask = 0x00004000, }; enum MemoryAccessShift { MemoryAccessVolatileShift = 0, MemoryAccessAlignedShift = 1, MemoryAccessNontemporalShift = 2, + MemoryAccessMakePointerAvailableKHRShift = 3, + MemoryAccessMakePointerVisibleKHRShift = 4, + MemoryAccessNonPrivatePointerKHRShift = 5, MemoryAccessMax = 0x7fffffff, }; @@ -533,6 +627,9 @@ enum MemoryAccessMask { MemoryAccessVolatileMask = 0x00000001, MemoryAccessAlignedMask = 0x00000002, MemoryAccessNontemporalMask = 0x00000004, + MemoryAccessMakePointerAvailableKHRMask = 0x00000008, + MemoryAccessMakePointerVisibleKHRMask = 0x00000010, + MemoryAccessNonPrivatePointerKHRMask = 0x00000020, }; enum Scope { @@ -541,6 +638,7 @@ enum Scope { ScopeWorkgroup = 2, ScopeSubgroup = 3, ScopeInvocation = 4, + ScopeQueueFamilyKHR = 5, ScopeMax = 0x7fffffff, }; @@ -548,6 +646,10 @@ enum GroupOperation { GroupOperationReduce = 0, GroupOperationInclusiveScan = 1, GroupOperationExclusiveScan = 2, + GroupOperationClusteredReduce = 3, + GroupOperationPartitionedReduceNV = 6, + GroupOperationPartitionedInclusiveScanNV = 7, + GroupOperationPartitionedExclusiveScanNV = 8, GroupOperationMax = 0x7fffffff, }; @@ -625,6 +727,17 @@ enum Capability { CapabilityStorageImageReadWithoutFormat = 55, CapabilityStorageImageWriteWithoutFormat = 56, CapabilityMultiViewport = 57, + CapabilitySubgroupDispatch = 58, + CapabilityNamedBarrier = 59, + CapabilityPipeStorage = 60, + CapabilityGroupNonUniform = 61, + CapabilityGroupNonUniformVote = 62, + CapabilityGroupNonUniformArithmetic = 63, + CapabilityGroupNonUniformBallot = 64, + CapabilityGroupNonUniformShuffle = 65, + CapabilityGroupNonUniformShuffleRelative = 66, + CapabilityGroupNonUniformClustered = 67, + CapabilityGroupNonUniformQuad = 68, CapabilitySubgroupBallotKHR = 4423, CapabilityDrawParameters = 4427, CapabilitySubgroupVoteKHR = 4431, @@ -640,8 +753,14 @@ enum Capability { CapabilityVariablePointers = 4442, CapabilityAtomicStorageOps = 4445, CapabilitySampleMaskPostDepthCoverage = 4447, + CapabilityStorageBuffer8BitAccess = 4448, + CapabilityUniformAndStorageBuffer8BitAccess = 4449, + CapabilityStoragePushConstant8 = 4450, + CapabilityFloat16ImageAMD = 5008, CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, CapabilitySampleMaskOverrideCoverageNV = 5249, CapabilityGeometryShaderPassthroughNV = 5251, CapabilityShaderViewportIndexLayerEXT = 5254, @@ -649,6 +768,33 @@ enum Capability { CapabilityShaderViewportMaskNV = 5255, CapabilityShaderStereoViewNV = 5259, CapabilityPerViewAttributesNV = 5260, + CapabilityFragmentFullyCoveredEXT = 5265, + CapabilityMeshShadingNV = 5266, + CapabilityImageFootprintNV = 5282, + CapabilityFragmentBarycentricNV = 5284, + CapabilityComputeDerivativeGroupQuadsNV = 5288, + CapabilityFragmentDensityEXT = 5291, + CapabilityShadingRateNV = 5291, + CapabilityGroupNonUniformPartitionedNV = 5297, + CapabilityShaderNonUniformEXT = 5301, + CapabilityRuntimeDescriptorArrayEXT = 5302, + CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, + CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, + CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, + CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, + CapabilitySampledImageArrayNonUniformIndexingEXT = 5307, + CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, + CapabilityStorageImageArrayNonUniformIndexingEXT = 5309, + CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, + CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, + CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, + CapabilityRayTracingNV = 5340, + CapabilityVulkanMemoryModelKHR = 5345, + CapabilityVulkanMemoryModelDeviceScopeKHR = 5346, + CapabilityComputeDerivativeGroupLinearNV = 5350, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, CapabilityMax = 0x7fffffff, }; @@ -947,6 +1093,52 @@ enum Op { OpAtomicFlagTestAndSet = 318, OpAtomicFlagClear = 319, OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpGroupNonUniformElect = 333, + OpGroupNonUniformAll = 334, + OpGroupNonUniformAny = 335, + OpGroupNonUniformAllEqual = 336, + OpGroupNonUniformBroadcast = 337, + OpGroupNonUniformBroadcastFirst = 338, + OpGroupNonUniformBallot = 339, + OpGroupNonUniformInverseBallot = 340, + OpGroupNonUniformBallotBitExtract = 341, + OpGroupNonUniformBallotBitCount = 342, + OpGroupNonUniformBallotFindLSB = 343, + OpGroupNonUniformBallotFindMSB = 344, + OpGroupNonUniformShuffle = 345, + OpGroupNonUniformShuffleXor = 346, + OpGroupNonUniformShuffleUp = 347, + OpGroupNonUniformShuffleDown = 348, + OpGroupNonUniformIAdd = 349, + OpGroupNonUniformFAdd = 350, + OpGroupNonUniformIMul = 351, + OpGroupNonUniformFMul = 352, + OpGroupNonUniformSMin = 353, + OpGroupNonUniformUMin = 354, + OpGroupNonUniformFMin = 355, + OpGroupNonUniformSMax = 356, + OpGroupNonUniformUMax = 357, + OpGroupNonUniformFMax = 358, + OpGroupNonUniformBitwiseAnd = 359, + OpGroupNonUniformBitwiseOr = 360, + OpGroupNonUniformBitwiseXor = 361, + OpGroupNonUniformLogicalAnd = 362, + OpGroupNonUniformLogicalOr = 363, + OpGroupNonUniformLogicalXor = 364, + OpGroupNonUniformQuadBroadcast = 365, + OpGroupNonUniformQuadSwap = 366, OpSubgroupBallotKHR = 4421, OpSubgroupFirstInvocationKHR = 4422, OpSubgroupAllKHR = 4428, @@ -961,6 +1153,27 @@ enum Op { OpGroupFMaxNonUniformAMD = 5005, OpGroupUMaxNonUniformAMD = 5006, OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpImageSampleFootprintNV = 5283, + OpGroupNonUniformPartitionNV = 5296, + OpWritePackedPrimitiveIndices4x8NV = 5299, + OpReportIntersectionNV = 5334, + OpIgnoreIntersectionNV = 5335, + OpTerminateRayNV = 5336, + OpTraceNV = 5337, + OpTypeAccelerationStructureNV = 5341, + OpExecuteCallableNV = 5344, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, OpMax = 0x7fffffff, }; diff --git a/3rdparty/bgfx/3rdparty/glslang/SPIRV/spvIR.h b/3rdparty/bgfx/3rdparty/glslang/SPIRV/spvIR.h index 6880595e9f6..2532b178b96 100644 --- a/3rdparty/bgfx/3rdparty/glslang/SPIRV/spvIR.h +++ b/3rdparty/bgfx/3rdparty/glslang/SPIRV/spvIR.h @@ -74,14 +74,16 @@ const Decoration NoPrecision = DecorationMax; POTENTIALLY_UNUSED const MemorySemanticsMask MemorySemanticsAllMemory = - (MemorySemanticsMask)(MemorySemanticsSequentiallyConsistentMask | - MemorySemanticsUniformMemoryMask | - MemorySemanticsSubgroupMemoryMask | + (MemorySemanticsMask)(MemorySemanticsUniformMemoryMask | MemorySemanticsWorkgroupMemoryMask | - MemorySemanticsCrossWorkgroupMemoryMask | MemorySemanticsAtomicCounterMemoryMask | MemorySemanticsImageMemoryMask); +struct IdImmediate { + bool isId; // true if word is an Id, false if word is an immediate + unsigned word; +}; + // // SPIR-V IR instruction. // @@ -91,8 +93,14 @@ public: Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), block(nullptr) { } explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), block(nullptr) { } virtual ~Instruction() {} - void addIdOperand(Id id) { operands.push_back(id); } - void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); } + void addIdOperand(Id id) { + operands.push_back(id); + idOperand.push_back(true); + } + void addImmediateOperand(unsigned int immediate) { + operands.push_back(immediate); + idOperand.push_back(false); + } void addStringOperand(const char* str) { unsigned int word; @@ -119,14 +127,25 @@ public: addImmediateOperand(word); } } + bool isIdOperand(int op) const { return idOperand[op]; } void setBlock(Block* b) { block = b; } Block* getBlock() const { return block; } Op getOpCode() const { return opCode; } - int getNumOperands() const { return (int)operands.size(); } + int getNumOperands() const + { + assert(operands.size() == idOperand.size()); + return (int)operands.size(); + } Id getResultId() const { return resultId; } Id getTypeId() const { return typeId; } - Id getIdOperand(int op) const { return operands[op]; } - unsigned int getImmediateOperand(int op) const { return operands[op]; } + Id getIdOperand(int op) const { + assert(idOperand[op]); + return operands[op]; + } + unsigned int getImmediateOperand(int op) const { + assert(!idOperand[op]); + return operands[op]; + } // Write out the binary form. void dump(std::vector& out) const @@ -156,7 +175,8 @@ protected: Id resultId; Id typeId; Op opCode; - std::vector operands; + std::vector operands; // operands, both and immediates (both are unsigned int) + std::vector idOperand; // true for operands that are , false for immediates Block* block; }; @@ -261,7 +281,8 @@ public: delete blocks[i]; } Id getId() const { return functionInstruction.getResultId(); } - Id getParamId(int p) { return parameterInstructions[p]->getResultId(); } + Id getParamId(int p) const { return parameterInstructions[p]->getResultId(); } + Id getParamType(int p) const { return parameterInstructions[p]->getTypeId(); } void addBlock(Block* block) { blocks.push_back(block); } void removeBlock(Block* block) @@ -333,7 +354,9 @@ public: Instruction* getInstruction(Id id) const { return idToInstruction[id]; } const std::vector& getFunctions() const { return functions; } - spv::Id getTypeId(Id resultId) const { return idToInstruction[resultId]->getTypeId(); } + spv::Id getTypeId(Id resultId) const { + return idToInstruction[resultId] == nullptr ? NoType : idToInstruction[resultId]->getTypeId(); + } StorageClass getStorageClass(Id typeId) const { assert(idToInstruction[typeId]->getOpCode() == spv::OpTypePointer); diff --git a/3rdparty/bgfx/3rdparty/glslang/StandAlone/CMakeLists.txt b/3rdparty/bgfx/3rdparty/glslang/StandAlone/CMakeLists.txt index b0d863d358a..5cea53d9f64 100644 --- a/3rdparty/bgfx/3rdparty/glslang/StandAlone/CMakeLists.txt +++ b/3rdparty/bgfx/3rdparty/glslang/StandAlone/CMakeLists.txt @@ -33,6 +33,7 @@ endif(WIN32) target_link_libraries(glslangValidator ${LIBRARIES}) target_link_libraries(spirv-remap ${LIBRARIES}) +target_include_directories(glslangValidator PUBLIC ../External) if(WIN32) source_group("Source" FILES ${SOURCES}) @@ -44,4 +45,9 @@ if(ENABLE_GLSLANG_INSTALL) install(TARGETS spirv-remap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + if(BUILD_SHARED_LIBS) + install(TARGETS glslang-default-resource-limits + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() endif(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp b/3rdparty/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp index e22ec8015c6..66e79af9e3c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/StandAlone/ResourceLimits.cpp @@ -125,6 +125,16 @@ const TBuiltInResource DefaultTBuiltInResource = { /* .MaxCullDistances = */ 8, /* .MaxCombinedClipAndCullDistances = */ 8, /* .MaxSamples = */ 4, + /* .maxMeshOutputVerticesNV = */ 256, + /* .maxMeshOutputPrimitivesNV = */ 512, + /* .maxMeshWorkGroupSizeX_NV = */ 32, + /* .maxMeshWorkGroupSizeY_NV = */ 1, + /* .maxMeshWorkGroupSizeZ_NV = */ 1, + /* .maxTaskWorkGroupSizeX_NV = */ 32, + /* .maxTaskWorkGroupSizeY_NV = */ 1, + /* .maxTaskWorkGroupSizeZ_NV = */ 1, + /* .maxMeshViewCountNV = */ 4, + /* .limits = */ { /* .nonInductiveForLoops = */ 1, /* .whileLoops = */ 1, @@ -224,7 +234,17 @@ std::string GetDefaultTBuiltInResourceString() << "MaxCullDistances " << DefaultTBuiltInResource.maxCullDistances << "\n" << "MaxCombinedClipAndCullDistances " << DefaultTBuiltInResource.maxCombinedClipAndCullDistances << "\n" << "MaxSamples " << DefaultTBuiltInResource.maxSamples << "\n" - +#ifdef NV_EXTENSIONS + << "MaxMeshOutputVerticesNV " << DefaultTBuiltInResource.maxMeshOutputVerticesNV << "\n" + << "MaxMeshOutputPrimitivesNV " << DefaultTBuiltInResource.maxMeshOutputPrimitivesNV << "\n" + << "MaxMeshWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeX_NV << "\n" + << "MaxMeshWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeY_NV << "\n" + << "MaxMeshWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxMeshWorkGroupSizeZ_NV << "\n" + << "MaxTaskWorkGroupSizeX_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeX_NV << "\n" + << "MaxTaskWorkGroupSizeY_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeY_NV << "\n" + << "MaxTaskWorkGroupSizeZ_NV " << DefaultTBuiltInResource.maxTaskWorkGroupSizeZ_NV << "\n" + << "MaxMeshViewCountNV " << DefaultTBuiltInResource.maxMeshViewCountNV << "\n" +#endif << "nonInductiveForLoops " << DefaultTBuiltInResource.limits.nonInductiveForLoops << "\n" << "whileLoops " << DefaultTBuiltInResource.limits.whileLoops << "\n" << "doWhileLoops " << DefaultTBuiltInResource.limits.doWhileLoops << "\n" @@ -431,6 +451,26 @@ void DecodeResourceLimits(TBuiltInResource* resources, char* config) resources->maxCombinedClipAndCullDistances = value; else if (tokenStr == "MaxSamples") resources->maxSamples = value; +#ifdef NV_EXTENSIONS + else if (tokenStr == "MaxMeshOutputVerticesNV") + resources->maxMeshOutputVerticesNV = value; + else if (tokenStr == "MaxMeshOutputPrimitivesNV") + resources->maxMeshOutputPrimitivesNV = value; + else if (tokenStr == "MaxMeshWorkGroupSizeX_NV") + resources->maxMeshWorkGroupSizeX_NV = value; + else if (tokenStr == "MaxMeshWorkGroupSizeY_NV") + resources->maxMeshWorkGroupSizeY_NV = value; + else if (tokenStr == "MaxMeshWorkGroupSizeZ_NV") + resources->maxMeshWorkGroupSizeZ_NV = value; + else if (tokenStr == "MaxTaskWorkGroupSizeX_NV") + resources->maxTaskWorkGroupSizeX_NV = value; + else if (tokenStr == "MaxTaskWorkGroupSizeY_NV") + resources->maxTaskWorkGroupSizeY_NV = value; + else if (tokenStr == "MaxTaskWorkGroupSizeZ_NV") + resources->maxTaskWorkGroupSizeZ_NV = value; + else if (tokenStr == "MaxMeshViewCountNV") + resources->maxMeshViewCountNV = value; +#endif else if (tokenStr == "nonInductiveForLoops") resources->limits.nonInductiveForLoops = (value != 0); else if (tokenStr == "whileLoops") diff --git a/3rdparty/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp b/3rdparty/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp index e7844eb21f6..060428bf131 100644 --- a/3rdparty/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -98,7 +98,12 @@ enum TOptions { EOptionStdin = (1 << 27), EOptionOptimizeDisable = (1 << 28), EOptionOptimizeSize = (1 << 29), + EOptionInvertY = (1 << 30), + EOptionDumpBareVersion = (1 << 31), }; +bool targetHlslFunctionality1 = false; +bool SpvToolsDisassembler = false; +bool SpvToolsValidate = false; // // Return codes from main/exit(). @@ -154,16 +159,27 @@ const char* entryPointName = nullptr; const char* sourceEntryPointName = nullptr; const char* shaderStageName = nullptr; const char* variableName = nullptr; +bool HlslEnable16BitTypes = false; std::vector IncludeDirectoryList; -int ClientInputSemanticsVersion = 100; // maps to, say, #define VULKAN 100 -int VulkanClientVersion = 100; // would map to, say, Vulkan 1.0 -int OpenGLClientVersion = 450; // doesn't influence anything yet, but maps to OpenGL 4.50 -unsigned int TargetVersion = 0x00001000; // maps to, say, SPIR-V 1.0 -std::vector Processes; // what should be recorded by OpModuleProcessed, or equivalent + +// Source environment +// (source 'Client' is currently the same as target 'Client') +int ClientInputSemanticsVersion = 100; + +// Target environment +glslang::EShClient Client = glslang::EShClientNone; // will stay EShClientNone if only validating +glslang::EShTargetClientVersion ClientVersion; // not valid until Client is set +glslang::EShTargetLanguage TargetLanguage = glslang::EShTargetNone; +glslang::EShTargetLanguageVersion TargetVersion; // not valid until TargetLanguage is set + +std::vector Processes; // what should be recorded by OpModuleProcessed, or equivalent // Per descriptor-set binding base data typedef std::map TPerSetBaseBinding; +std::vector> uniformLocationOverrides; +int uniformBase = 0; + std::array, glslang::EResCount> baseBinding; std::array, glslang::EResCount> baseBindingForSet; std::array, EShLangCount> baseResourceSetBinding; @@ -235,6 +251,16 @@ const char* GetBinaryName(EShLanguage stage) case EShLangGeometry: name = "geom.spv"; break; case EShLangFragment: name = "frag.spv"; break; case EShLangCompute: name = "comp.spv"; break; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: name = "rgen.spv"; break; + case EShLangIntersectNV: name = "rint.spv"; break; + case EShLangAnyHitNV: name = "rahit.spv"; break; + case EShLangClosestHitNV: name = "rchit.spv"; break; + case EShLangMissNV: name = "rmiss.spv"; break; + case EShLangCallableNV: name = "rcall.spv"; break; + case EShLangMeshNV: name = "mesh.spv"; break; + case EShLangTaskNV: name = "task.spv"; break; +#endif default: name = "unknown"; break; } } else @@ -314,7 +340,7 @@ void ProcessBindingBase(int& argc, char**& argv, glslang::TResourceType res) for (int lang = langMin; lang < langMax; ++lang) { if (!perSetBase.empty()) - baseBindingForSet[res][lang] = perSetBase; + baseBindingForSet[res][lang].insert(perSetBase.begin(), perSetBase.end()); else baseBinding[res][lang] = singleBase; } @@ -399,6 +425,9 @@ void ProcessArguments(std::vector>& workItem // minimum needed (without overriding something else) to target Vulkan SPIR-V const auto setVulkanSpv = []() { + if (Client == glslang::EShClientNone) + ClientVersion = glslang::EShTargetVulkan_1_0; + Client = glslang::EShClientVulkan; Options |= EOptionSpv; Options |= EOptionVulkanRules; Options |= EOptionLinkProgram; @@ -406,12 +435,31 @@ void ProcessArguments(std::vector>& workItem // minimum needed (without overriding something else) to target OpenGL SPIR-V const auto setOpenGlSpv = []() { + if (Client == glslang::EShClientNone) + ClientVersion = glslang::EShTargetOpenGL_450; + Client = glslang::EShClientOpenGL; Options |= EOptionSpv; Options |= EOptionLinkProgram; // undo a -H default to Vulkan Options &= ~EOptionVulkanRules; }; + const auto getUniformOverride = [getStringOperand]() { + const char *arg = getStringOperand("-u:"); + const char *split = strchr(arg, ':'); + if (split == NULL) { + printf("%s: missing location\n", arg); + exit(EFailUsage); + } + errno = 0; + int location = ::strtol(split + 1, NULL, 10); + if (errno) { + printf("%s: invalid location\n", arg); + exit(EFailUsage); + } + return std::make_pair(std::string(arg, split - arg), location); + }; + for (bumpArg(); argc >= 1; bumpArg()) { if (argv[0][0] == '-') { switch (argv[0][1]) { @@ -428,6 +476,12 @@ void ProcessArguments(std::vector>& workItem } else if (lowerword == "auto-map-locations" || // synonyms lowerword == "aml") { Options |= EOptionAutoMapLocations; + } else if (lowerword == "uniform-base") { + if (argc <= 1) + Error("no provided for --uniform-base"); + uniformBase = ::strtol(argv[1], NULL, 10); + bumpArg(); + break; } else if (lowerword == "client") { if (argc > 1) { if (strcmp(argv[1], "vulkan100") == 0) @@ -438,6 +492,11 @@ void ProcessArguments(std::vector>& workItem Error("--client expects vulkan100 or opengl100"); } bumpArg(); + } else if (lowerword == "entry-point") { + entryPointName = argv[1]; + if (argc <= 1) + Error("no provided for --entry-point"); + bumpArg(); } else if (lowerword == "flatten-uniform-arrays" || // synonyms lowerword == "flatten-uniform-array" || lowerword == "fua") { @@ -448,6 +507,11 @@ void ProcessArguments(std::vector>& workItem lowerword == "hlsl-iomapper" || lowerword == "hlsl-iomapping") { Options |= EOptionHlslIoMapping; + } else if (lowerword == "hlsl-enable-16bit-types") { + HlslEnable16BitTypes = true; + } else if (lowerword == "invert-y" || // synonyms + lowerword == "iy") { + Options |= EOptionInvertY; } else if (lowerword == "keep-uncalled" || // synonyms lowerword == "ku") { Options |= EOptionKeepUncalled; @@ -465,8 +529,8 @@ void ProcessArguments(std::vector>& workItem lowerword == "sib") { ProcessBindingBase(argc, argv, glslang::EResImage); } else if (lowerword == "shift-sampler-bindings" || // synonyms - lowerword == "shift-sampler-binding" || - lowerword == "ssb") { + lowerword == "shift-sampler-binding" || + lowerword == "ssb") { ProcessBindingBase(argc, argv, glslang::EResSampler); } else if (lowerword == "shift-uav-bindings" || // synonyms lowerword == "shift-uav-binding" || @@ -494,6 +558,10 @@ void ProcessArguments(std::vector>& workItem sourceEntryPointName = argv[1]; bumpArg(); break; + } else if (lowerword == "spirv-dis") { + SpvToolsDisassembler = true; + } else if (lowerword == "spirv-val") { + SpvToolsValidate = true; } else if (lowerword == "stdin") { Options |= EOptionStdin; shaderStageName = argv[1]; @@ -503,22 +571,42 @@ void ProcessArguments(std::vector>& workItem if (argc > 1) { if (strcmp(argv[1], "vulkan1.0") == 0) { setVulkanSpv(); - VulkanClientVersion = 100; + ClientVersion = glslang::EShTargetVulkan_1_0; + } else if (strcmp(argv[1], "vulkan1.1") == 0) { + setVulkanSpv(); + ClientVersion = glslang::EShTargetVulkan_1_1; } else if (strcmp(argv[1], "opengl") == 0) { setOpenGlSpv(); - OpenGLClientVersion = 450; + ClientVersion = glslang::EShTargetOpenGL_450; + } else if (strcmp(argv[1], "spirv1.0") == 0) { + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_0; + } else if (strcmp(argv[1], "spirv1.1") == 0) { + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_1; + } else if (strcmp(argv[1], "spirv1.2") == 0) { + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_2; + } else if (strcmp(argv[1], "spirv1.3") == 0) { + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_3; + } else if (strcmp(argv[1], "spirv1.4") == 0) { + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_4; } else - Error("--target-env expected vulkan1.0 or opengl"); + Error("--target-env expected one of: vulkan1.0, vulkan1.1, opengl, spirv1.0, spirv1.1, spirv1.2, or spirv1.3"); } bumpArg(); } else if (lowerword == "variable-name" || // synonyms - lowerword == "vn") { + lowerword == "vn") { Options |= EOptionOutputHexadecimal; if (argc <= 1) Error("no provided for --variable-name"); variableName = argv[1]; bumpArg(); break; + } else if (lowerword == "version") { + Options |= EOptionDumpVersions; } else { usage(); } @@ -533,11 +621,14 @@ void ProcessArguments(std::vector>& workItem else UserPreamble.addDef(getStringOperand("-D macro name")); break; + case 'u': + uniformLocationOverrides.push_back(getUniformOverride()); + break; case 'E': Options |= EOptionOutputPreprocessed; break; case 'G': - // OpenGL Client + // OpenGL client setOpenGlSpv(); if (argv[0][2] != 0) ClientInputSemanticsVersion = getAttachedNumber("-G client input semantics"); @@ -556,7 +647,7 @@ void ProcessArguments(std::vector>& workItem if (argv[0][2] == 'd') Options |= EOptionOptimizeDisable; else if (argv[0][2] == 's') -#ifdef ENABLE_OPT +#if ENABLE_OPT Options |= EOptionOptimizeSize; #else Error("-Os not available; optimizer not linked"); @@ -576,22 +667,30 @@ void ProcessArguments(std::vector>& workItem case 'V': setVulkanSpv(); if (argv[0][2] != 0) - ClientInputSemanticsVersion = getAttachedNumber("-G client input semantics"); + ClientInputSemanticsVersion = getAttachedNumber("-V client input semantics"); break; case 'c': Options |= EOptionDumpConfig; break; case 'd': - Options |= EOptionDefaultDesktop; + if (strncmp(&argv[0][1], "dumpversion", strlen(&argv[0][1]) + 1) == 0 || + strncmp(&argv[0][1], "dumpfullversion", strlen(&argv[0][1]) + 1) == 0) + Options |= EOptionDumpBareVersion; + else + Options |= EOptionDefaultDesktop; break; case 'e': - // HLSL todo: entry point handle needs much more sophistication. - // This is okay for one compilation unit with one entry point. entryPointName = argv[1]; if (argc <= 1) Error("no provided for -e"); bumpArg(); break; + case 'f': + if (strcmp(&argv[0][2], "hlsl_functionality1") == 0) + targetHlslFunctionality1 = true; + else + Error("-f: expected hlsl_functionality1"); + break; case 'g': Options |= EOptionDebug; break; @@ -661,6 +760,28 @@ void ProcessArguments(std::vector>& workItem if ((Options & EOptionFlattenUniformArrays) != 0 && (Options & EOptionReadHlsl) == 0) Error("uniform array flattening only valid when compiling HLSL source."); + + // rationalize client and target language + if (TargetLanguage == glslang::EShTargetNone) { + switch (ClientVersion) { + case glslang::EShTargetVulkan_1_0: + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_0; + break; + case glslang::EShTargetVulkan_1_1: + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_3; + break; + case glslang::EShTargetOpenGL_450: + TargetLanguage = glslang::EShTargetSpv; + TargetVersion = glslang::EShTargetSpv_1_0; + break; + default: + break; + } + } + if (TargetLanguage != glslang::EShTargetNone && Client == glslang::EShClientNone) + Error("To generate SPIR-V, also specify client semantics. See -G and -V."); } // @@ -690,6 +811,10 @@ void SetMessageOptions(EShMessages& messages) messages = (EShMessages)(messages | EShMsgHlslOffsets); if (Options & EOptionDebug) messages = (EShMessages)(messages | EShMsgDebugInfo); + if (HlslEnable16BitTypes) + messages = (EShMessages)(messages | EShMsgHlslEnable16BitTypes); + if ((Options & EOptionOptimizeDisable) || !ENABLE_OPT) + messages = (EShMessages)(messages | EShMsgHlslLegalization); } // @@ -697,19 +822,23 @@ void SetMessageOptions(EShMessages& messages) // void CompileShaders(glslang::TWorklist& worklist) { + if (Options & EOptionDebug) + Error("cannot generate debug information unless linking to generate code"); + glslang::TWorkItem* workItem; if (Options & EOptionStdin) { - worklist.remove(workItem); - ShHandle compiler = ShConstructCompiler(FindLanguage("stdin"), Options); - if (compiler == 0) - return; + if (worklist.remove(workItem)) { + ShHandle compiler = ShConstructCompiler(FindLanguage("stdin"), Options); + if (compiler == nullptr) + return; - CompileFile("stdin", compiler); + CompileFile("stdin", compiler); if (! (Options & EOptionSuppressInfolog)) workItem->results = ShGetInfoLog(compiler); - ShDestruct(compiler); + ShDestruct(compiler); + } } else { while (worklist.remove(workItem)) { ShHandle compiler = ShConstructCompiler(FindLanguage(workItem->name), Options); @@ -801,7 +930,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) const auto &compUnit = *it; glslang::TShader* shader = new glslang::TShader(compUnit.stage); shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count); - if (entryPointName) // HLSL todo: this needs to be tracked per compUnits + if (entryPointName) shader->setEntryPoint(entryPointName); if (sourceEntryPointName) { if (entryPointName == nullptr) @@ -840,22 +969,26 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (Options & EOptionAutoMapLocations) shader->setAutoMapLocations(true); + if (Options & EOptionInvertY) + shader->setInvertY(true); + + for (auto& uniOverride : uniformLocationOverrides) { + shader->addUniformLocationOverride(uniOverride.first.c_str(), + uniOverride.second); + } + + shader->setUniformLocationBase(uniformBase); + // Set up the environment, some subsettings take precedence over earlier // ways of setting things. if (Options & EOptionSpv) { - if (Options & EOptionVulkanRules) { - shader->setEnvInput((Options & EOptionReadHlsl) ? glslang::EShSourceHlsl - : glslang::EShSourceGlsl, - compUnit.stage, glslang::EShClientVulkan, ClientInputSemanticsVersion); - shader->setEnvClient(glslang::EShClientVulkan, VulkanClientVersion); - shader->setEnvTarget(glslang::EshTargetSpv, TargetVersion); - } else { - shader->setEnvInput((Options & EOptionReadHlsl) ? glslang::EShSourceHlsl - : glslang::EShSourceGlsl, - compUnit.stage, glslang::EShClientOpenGL, ClientInputSemanticsVersion); - shader->setEnvClient(glslang::EShClientOpenGL, OpenGLClientVersion); - shader->setEnvTarget(glslang::EshTargetSpv, TargetVersion); - } + shader->setEnvInput((Options & EOptionReadHlsl) ? glslang::EShSourceHlsl + : glslang::EShSourceGlsl, + compUnit.stage, Client, ClientInputSemanticsVersion); + shader->setEnvClient(Client, ClientVersion); + shader->setEnvTarget(TargetLanguage, TargetVersion); + if (targetHlslFunctionality1) + shader->setEnvTargetHlslFunctionality1(); } shaders.push_back(shader); @@ -867,8 +1000,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) includer.pushExternalLocalDirectory(dir); }); if (Options & EOptionOutputPreprocessed) { std::string str; - if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, - messages, &str, includer)) { + if (shader->preprocess(&Resources, defaultVersion, ENoProfile, false, false, messages, &str, includer)) { PutsIfNonEmpty(str.c_str()); } else { CompileFailed = true; @@ -877,6 +1009,7 @@ void CompileAndLinkShaderUnits(std::vector compUnits) StderrIfNonEmpty(shader->getInfoDebugLog()); continue; } + if (! shader->parse(&Resources, defaultVersion, false, messages, includer)) CompileFailed = true; @@ -932,6 +1065,8 @@ void CompileAndLinkShaderUnits(std::vector compUnits) spvOptions.generateDebugInfo = true; spvOptions.disableOptimizer = (Options & EOptionOptimizeDisable) != 0; spvOptions.optimizeSize = (Options & EOptionOptimizeSize) != 0; + spvOptions.disassemble = SpvToolsDisassembler; + spvOptions.validate = SpvToolsValidate; glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger, &spvOptions); // Dump the spv to a file or stdout, etc., but only if not doing @@ -943,9 +1078,8 @@ void CompileAndLinkShaderUnits(std::vector compUnits) } else { glslang::OutputSpvBin(spirv, GetBinaryName((EShLanguage)stage)); } - if (Options & EOptionHumanReadableSpv) { + if (!SpvToolsDisassembler && (Options & EOptionHumanReadableSpv)) spv::Disassemble(std::cout, spirv); - } } } } @@ -1039,8 +1173,14 @@ int singleMain() return ESuccess; } - if (Options & EOptionDumpVersions) { - printf("Glslang Version: %s %s\n", GLSLANG_REVISION, GLSLANG_DATE); + if (Options & EOptionDumpBareVersion) { + printf("%d.%d.%d\n", + glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL); + if (workList.empty()) + return ESuccess; + } else if (Options & EOptionDumpVersions) { + printf("Glslang Version: %d.%d.%d\n", + glslang::GetSpirvGeneratorVersion(), GLSLANG_MINOR_VERSION, GLSLANG_PATCH_LEVEL); printf("ESSL Version: %s\n", glslang::GetEsslVersionString()); printf("GLSL Version: %s\n", glslang::GetGlslVersionString()); std::string spirvVersion; @@ -1066,13 +1206,15 @@ int singleMain() ProcessConfigFile(); + if ((Options & EOptionReadHlsl) && !((Options & EOptionOutputPreprocessed) || (Options & EOptionSpv))) + Error("ERROR: HLSL requires SPIR-V code generation (or preprocessing only)"); + // // Two modes: // 1) linking all arguments together, single-threaded, new C++ interface // 2) independent arguments, can be tackled by multiple asynchronous threads, for testing thread safety, using the old handle interface // - if (Options & EOptionLinkProgram || - Options & EOptionOutputPreprocessed) { + if (Options & (EOptionLinkProgram | EOptionOutputPreprocessed)) { glslang::InitializeProcess(); glslang::InitializeProcess(); // also test reference counting of users glslang::InitializeProcess(); // also test reference counting of users @@ -1150,40 +1292,75 @@ int C_DECL main(int argc, char* argv[]) // .geom = geometry // .frag = fragment // .comp = compute +// .rgen = ray generation +// .rint = ray intersection +// .rahit = ray any hit +// .rchit = ray closest hit +// .rmiss = ray miss +// .rcall = ray callable +// .mesh = mesh +// .task = task +// Additionally, the file names may end in ..glsl and ..hlsl +// where is one of the stages listed above. // -EShLanguage FindLanguage(const std::string& name, bool parseSuffix) +EShLanguage FindLanguage(const std::string& name, bool parseStageName) { - size_t ext = 0; - std::string suffix; - + std::string stageName; if (shaderStageName) - suffix = shaderStageName; - else { - // Search for a suffix on a filename: e.g, "myfile.frag". If given - // the suffix directly, we skip looking for the '.' - if (parseSuffix) { - ext = name.rfind('.'); - if (ext == std::string::npos) { - usage(); - return EShLangVertex; - } - ++ext; + stageName = shaderStageName; + else if (parseStageName) { + // Note: "first" extension means "first from the end", i.e. + // if the file is named foo.vert.glsl, then "glsl" is first, + // "vert" is second. + size_t firstExtStart = name.find_last_of("."); + bool hasFirstExt = firstExtStart != std::string::npos; + size_t secondExtStart = hasFirstExt ? name.find_last_of(".", firstExtStart - 1) : std::string::npos; + bool hasSecondExt = secondExtStart != std::string::npos; + std::string firstExt = name.substr(firstExtStart + 1, std::string::npos); + bool usesUnifiedExt = hasFirstExt && (firstExt == "glsl" || firstExt == "hlsl"); + if (usesUnifiedExt && firstExt == "hlsl") + Options |= EOptionReadHlsl; + if (hasFirstExt && !usesUnifiedExt) + stageName = firstExt; + else if (usesUnifiedExt && hasSecondExt) + stageName = name.substr(secondExtStart + 1, firstExtStart - secondExtStart - 1); + else { + usage(); + return EShLangVertex; } - suffix = name.substr(ext, std::string::npos); - } + } else + stageName = name; - if (suffix == "vert") + if (stageName == "vert") return EShLangVertex; - else if (suffix == "tesc") + else if (stageName == "tesc") return EShLangTessControl; - else if (suffix == "tese") + else if (stageName == "tese") return EShLangTessEvaluation; - else if (suffix == "geom") + else if (stageName == "geom") return EShLangGeometry; - else if (suffix == "frag") + else if (stageName == "frag") return EShLangFragment; - else if (suffix == "comp") + else if (stageName == "comp") return EShLangCompute; +#ifdef NV_EXTENSIONS + else if (stageName == "rgen") + return EShLangRayGenNV; + else if (stageName == "rint") + return EShLangIntersectNV; + else if (stageName == "rahit") + return EShLangAnyHitNV; + else if (stageName == "rchit") + return EShLangClosestHitNV; + else if (stageName == "rmiss") + return EShLangMissNV; + else if (stageName == "rcall") + return EShLangCallableNV; + else if (stageName == "mesh") + return EShLangMeshNV; + else if (stageName == "task") + return EShLangTaskNV; +#endif usage(); return EShLangVertex; @@ -1253,25 +1430,37 @@ void usage() " .geom for a geometry shader\n" " .frag for a fragment shader\n" " .comp for a compute shader\n" +#ifdef NV_EXTENSIONS + " .mesh for a mesh shader\n" + " .task for a task shader\n" + " .rgen for a ray generation shader\n" + " .rint for a ray intersection shader\n" + " .rahit for a ray any hit shader\n" + " .rchit for a ray closest hit shader\n" + " .rmiss for a ray miss shader\n" + " .rcall for a ray callable shader\n" +#endif + " .glsl for .vert.glsl, .tesc.glsl, ..., .comp.glsl compound suffixes\n" + " .hlsl for .vert.hlsl, .tesc.hlsl, ..., .comp.hlsl compound suffixes\n" "\n" "Options:\n" " -C cascading errors; risk crash from accumulation of error recoveries\n" - " -D input is HLSL\n" + " -D input is HLSL (this is the default when any suffix is .hlsl)\n" " -D\n" " -D define a pre-processor macro\n" " -E print pre-processed GLSL; cannot be used with -l;\n" - " errors will appear on stderr.\n" + " errors will appear on stderr\n" " -G[ver] create SPIR-V binary, under OpenGL semantics; turns on -l;\n" - " default file name is .spv (-o overrides this)\n" + " default file name is .spv (-o overrides this);\n" " 'ver', when present, is the version of the input semantics,\n" - " which will appear in #define GL_SPIRV ver\n" - " '--client opengl100' is the same as -G100\n" + " which will appear in #define GL_SPIRV ver;\n" + " '--client opengl100' is the same as -G100;\n" " a '--target-env' for OpenGL will also imply '-G'\n" " -H print human readable form of SPIR-V; turns on -V\n" " -I add dir to the include search path; includer's directory\n" " is searched first, followed by left-to-right order of -I\n" - " -Od disables optimization. May cause illegal SPIR-V for HLSL.\n" - " -Os optimizes SPIR-V to minimize size.\n" + " -Od disables optimization; may cause illegal SPIR-V for HLSL\n" + " -Os optimizes SPIR-V to minimize size\n" " -S uses specified stage rather than parsing the file extension\n" " choices for are vert, tesc, tese, geom, frag, or comp\n" " -U undefine a pre-processor macro\n" @@ -1285,7 +1474,11 @@ void usage() " creates the default configuration file (redirect to a .conf file)\n" " -d default to desktop (#version 110) when there is no shader #version\n" " (default is ES version 100)\n" - " -e specify as the entry-point name\n" + " -e | --entry-point \n" + " specify as the entry-point function name\n" + " -f{hlsl_functionality1}\n" + " 'hlsl_functionality1' enables use of the\n" + " SPV_GOOGLE_hlsl_functionality1 extension\n" " -g generate debug information\n" " -h print this usage message\n" " -i intermediate tree (glslang AST) is printed out\n" @@ -1293,72 +1486,88 @@ void usage() " -m memory leak mode\n" " -o save binary to , requires a binary option (e.g., -V)\n" " -q dump reflection query database\n" - " -r synonym for --relaxed-errors\n" + " -r | --relaxed-errors" + " relaxed GLSL semantic error-checking mode\n" " -s silence syntax and semantic error reporting\n" " -t multi-threaded mode\n" - " -v print version strings\n" - " -w synonym for --suppress-warnings\n" + " -v | --version\n" + " print version strings\n" + " -w | --suppress-warnings\n" + " suppress GLSL warnings, except as required by \"#extension : warn\"\n" " -x save binary output as text-based 32-bit hexadecimal numbers\n" - " --auto-map-bindings automatically bind uniform variables\n" - " without explicit bindings.\n" - " --amb synonym for --auto-map-bindings\n" - " --auto-map-locations automatically locate input/output lacking\n" - " 'location' (fragile, not cross stage)\n" - " --aml synonym for --auto-map-locations\n" - " --client {vulkan|opengl} see -V and -G\n" - " --flatten-uniform-arrays flatten uniform texture/sampler arrays to\n" - " scalars\n" - " --fua synonym for --flatten-uniform-arrays\n" - " --hlsl-offsets Allow block offsets to follow HLSL rules\n" - " Works independently of source language\n" - " --hlsl-iomap Perform IO mapping in HLSL register space\n" - " --keep-uncalled don't eliminate uncalled functions\n" - " --ku synonym for --keep-uncalled\n" - " --no-storage-format use Unknown image format\n" - " --nsf synonym for --no-storage-format\n" - " --relaxed-errors relaxed GLSL semantic error-checking mode\n" + " -u: specify a uniform location override for --aml\n" + " --uniform-base set a base to use for generated uniform locations\n" + " --auto-map-bindings | --amb automatically bind uniform variables\n" + " without explicit bindings\n" + " --auto-map-locations | --aml automatically locate input/output lacking\n" + " 'location' (fragile, not cross stage)\n" + " --client {vulkan|opengl} see -V and -G\n" + " -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n" + " --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n" + " scalars\n" + " --hlsl-offsets allow block offsets to follow HLSL rules\n" + " works independently of source language\n" + " --hlsl-iomap perform IO mapping in HLSL register space\n" + " --hlsl-enable-16bit-types allow 16-bit types in SPIR-V for HLSL\n" + " --invert-y | --iy invert position.Y output in vertex shader\n" + " --keep-uncalled | --ku don't eliminate uncalled functions\n" + " --no-storage-format | --nsf use Unknown image format\n" " --resource-set-binding [stage] name set binding\n" - " Set descriptor set and binding for individual resources\n" + " set descriptor set and binding for\n" + " individual resources\n" " --resource-set-binding [stage] set\n" - " Set descriptor set for all resources\n" - " --rsb [stage] type set binding synonym for --resource-set-binding\n" - " --shift-image-binding [stage] num base binding number for images (uav)\n" - " --shift-image-binding [stage] [num set]... per-descriptor-set shift values\n" - " --sib [stage] num synonym for --shift-image-binding\n" - " --shift-sampler-binding [stage] num base binding number for samplers\n" - " --shift-sampler-binding [stage] [num set]... per-descriptor-set shift values\n" - " --ssb [stage] num synonym for --shift-sampler-binding\n" - " --shift-ssbo-binding [stage] num base binding number for SSBOs\n" - " --shift-ssbo-binding [stage] [num set]... per-descriptor-set shift values\n" - " --sbb [stage] num synonym for --shift-ssbo-binding\n" - " --shift-texture-binding [stage] num base binding number for textures\n" - " --shift-texture-binding [stage] [num set]... per-descriptor-set shift values\n" - " --stb [stage] num synonym for --shift-texture-binding\n" - " --shift-uav-binding [stage] num base binding number for UAVs\n" - " --shift-uav-binding [stage] [num set]... per-descriptor-set shift values\n" - " --suavb [stage] num synonym for --shift-uav-binding\n" - " --shift-UBO-binding [stage] num base binding number for UBOs\n" - " --shift-UBO-binding [stage] [num set]... per-descriptor-set shift values\n" - " --shift-cbuffer-binding [stage] num synonym for --shift-UBO-binding\n" - " --shift-cbuffer-binding [stage] [num set]... per-descriptor-set shift values\n" - " --sub [stage] num synonym for --shift-UBO-binding\n" - " --source-entrypoint the given shader source function is\n" - " renamed to be the given in -e\n" - " --sep synonym for --source-entrypoint\n" - " --stdin Read from stdin instead of from a file.\n" - " You'll have to provide the shader stage\n" - " using -S.\n" - " --suppress-warnings suppress GLSL warnings\n" - " (except as required by #extension : warn)\n" - " --target-env {vulkan1.0|opengl} set the execution environment code will\n" - " execute in (as opposed to language\n" - " semantics selected by --client) defaults:\n" - " 'vulkan1.0' under '--client vulkan'\n" - " 'opengl' under '--client opengl'\n" - " --variable-name Creates a C header file that contains a\n" - " uint32_t array named \n" - " initialized with the shader binary code.\n" - " --vn synonym for --variable-name \n" + " set descriptor set for all resources\n" + " --rsb synonym for --resource-set-binding\n" + " --shift-image-binding [stage] num\n" + " base binding number for images (uav)\n" + " --shift-image-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --sib synonym for --shift-image-binding\n" + " --shift-sampler-binding [stage] num\n" + " base binding number for samplers\n" + " --shift-sampler-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --ssb synonym for --shift-sampler-binding\n" + " --shift-ssbo-binding [stage] num base binding number for SSBOs\n" + " --shift-ssbo-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --sbb synonym for --shift-ssbo-binding\n" + " --shift-texture-binding [stage] num\n" + " base binding number for textures\n" + " --shift-texture-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --stb synonym for --shift-texture-binding\n" + " --shift-uav-binding [stage] num base binding number for UAVs\n" + " --shift-uav-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --suavb synonym for --shift-uav-binding\n" + " --shift-UBO-binding [stage] num base binding number for UBOs\n" + " --shift-UBO-binding [stage] [num set]...\n" + " per-descriptor-set shift values\n" + " --sub synonym for --shift-UBO-binding\n" + " --shift-cbuffer-binding | --scb synonyms for --shift-UBO-binding\n" + " --spirv-dis output standard-form disassembly; works only\n" + " when a SPIR-V generation option is also used\n" + " --spirv-val execute the SPIRV-Tools validator\n" + " --source-entrypoint the given shader source function is\n" + " renamed to be the given in -e\n" + " --sep synonym for --source-entrypoint\n" + " --stdin read from stdin instead of from a file;\n" + " requires providing the shader stage using -S\n" + " --target-env {vulkan1.0 | vulkan1.1 | opengl | \n" + " spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3}\n" + " set execution environment that emitted code\n" + " will execute in (versus source language\n" + " semantics selected by --client) defaults:\n" + " * 'vulkan1.0' under '--client vulkan'\n" + " * 'opengl' under '--client opengl'\n" + " * 'spirv1.0' under --target-env vulkan1.0\n" + " * 'spirv1.3' under --target-env vulkan1.1\n" + " multiple --targen-env can be specified.\n" + " --variable-name \n" + " --vn creates a C header file that contains a\n" + " uint32_t array named \n" + " initialized with the shader binary code\n" ); exit(EFailUsage); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/110scope.vert b/3rdparty/bgfx/3rdparty/glslang/Test/110scope.vert index e28db0fdb32..86c27a584e4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/110scope.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/110scope.vert @@ -71,4 +71,17 @@ void main() int degrees; degrees(3.2); + + { + S s; + s.x = 3; + struct S { // okay, hides S + bool b; + }; + S t; + t.b = true; + struct S { // ERROR, redefinition of struct S + float f; + }; + } } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/310.tese b/3rdparty/bgfx/3rdparty/glslang/Test/310.tese index 63b1daa6973..bbeaa87fcf3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/310.tese +++ b/3rdparty/bgfx/3rdparty/glslang/Test/310.tese @@ -55,7 +55,7 @@ patch sample in vec3 badp4; // ERROR #extension GL_ARB_separate_shader_objects : enable -in gl_PerVertex // ERROR, no size +in gl_PerVertex { vec4 gl_Position; } gl_in[]; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/310AofA.vert b/3rdparty/bgfx/3rdparty/glslang/Test/310AofA.vert index a196388de16..fba29772577 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/310AofA.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/310AofA.vert @@ -113,3 +113,9 @@ out float outArray[2][3]; // ERROR uniform ubaa { int a; } ubaaname[2][3]; // ERROR + +vec3 func(in mat3[2] x[3]) +{ + mat3 a0 = x[2][1]; + return a0[2]; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/310implicitSizeArrayError.vert b/3rdparty/bgfx/3rdparty/glslang/Test/310implicitSizeArrayError.vert index 72c403e8344..7aa0ee1b729 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/310implicitSizeArrayError.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/310implicitSizeArrayError.vert @@ -1,5 +1,5 @@ #version 310 es -layout (location=0) uniform Block { +layout (binding=0) uniform Block { highp int a[]; } uni; layout (location=0) out highp int o; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/310runtimeArray.vert b/3rdparty/bgfx/3rdparty/glslang/Test/310runtimeArray.vert new file mode 100644 index 00000000000..3d7b018e656 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/310runtimeArray.vert @@ -0,0 +1,18 @@ +#version 310 es + +precision highp float; +layout(location=0) out float o; + +struct S { float f; }; +buffer b1 { S s[]; }; +buffer b2 { S s[]; } b2name; +buffer b3 { S s[]; } b3name[]; +buffer b4 { S s[]; } b4name[4]; + +void main() +{ + o = s[5].f; + o += b2name.s[6].f; + o += b3name[3].s[7].f; + o += b4name[2].s[8].f; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/320.tese b/3rdparty/bgfx/3rdparty/glslang/Test/320.tese index b1507d9f907..cce2637cb89 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/320.tese +++ b/3rdparty/bgfx/3rdparty/glslang/Test/320.tese @@ -51,7 +51,7 @@ patch sample in vec3 badp4; // ERROR #extension GL_ARB_separate_shader_objects : enable -in gl_PerVertex // ERROR, no size +in gl_PerVertex { vec4 gl_Position; } gl_in[]; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/400.geom b/3rdparty/bgfx/3rdparty/glslang/Test/400.geom index 0b77e121208..f8e89558c08 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/400.geom +++ b/3rdparty/bgfx/3rdparty/glslang/Test/400.geom @@ -300,9 +300,9 @@ void doubles() dmat3x4 dmat3x4v = outerProduct(dvec4v, dvec3v); dmat4x3 dmat4x3v = outerProduct(dvec3v, dvec4v); - dmat2v *= matrixCompMult(dmat2v, dmat2v); - dmat3v *= matrixCompMult(dmat3v, dmat3v); - dmat4v *= matrixCompMult(dmat4v, dmat4v); + dmat2v *= matrixCompMult(dmat2v, dmat2v); + dmat3v *= matrixCompMult(dmat3v, dmat3v); + dmat4v *= matrixCompMult(dmat4v, dmat4v); dmat2x3v = matrixCompMult(dmat2x3v, dmat2x3v); dmat2x4v = matrixCompMult(dmat2x4v, dmat2x4v); dmat3x2v = matrixCompMult(dmat3x2v, dmat3x2v); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/400.tese b/3rdparty/bgfx/3rdparty/glslang/Test/400.tese index aea454651de..c110a1c4ded 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/400.tese +++ b/3rdparty/bgfx/3rdparty/glslang/Test/400.tese @@ -51,7 +51,7 @@ patch sample in vec3 badp4; // ERROR #extension GL_ARB_separate_shader_objects : enable -in gl_PerVertex // ERROR, no size +in gl_PerVertex { float gl_ClipDistance[1]; } gl_in[]; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/440.vert b/3rdparty/bgfx/3rdparty/glslang/Test/440.vert index 2e61f797570..4ab6f2ee21e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/440.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/440.vert @@ -174,6 +174,12 @@ out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride float f; } bbinst10; +layout(xfb_buffer = 3) out; +layout(xfb_offset = 32) out gl_PerVertex { + layout(xfb_buffer = 2) float gl_PointSize; // ERROR, change in xfb_buffer + vec4 gl_Position; +}; + int drawParamsBad() { return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB; // ERROR, extension not requested diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/450.vert b/3rdparty/bgfx/3rdparty/glslang/Test/450.vert index 51e9b100430..e99a133c134 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/450.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/450.vert @@ -46,3 +46,11 @@ void foo() allInvocationsEqual(b1); // ERROR, need 4.6 } ; // ERROR: no extraneous semicolons + +layout(location = 0) uniform locBlock { // ERROR, no location uniform block + int a; +}; + +layout(location = 0) buffer locBuffBlock { // ERROR, no location on buffer block + int b; +}; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/460.frag b/3rdparty/bgfx/3rdparty/glslang/Test/460.frag index 43a7c3b3894..23f8eea6520 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/460.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/460.frag @@ -15,3 +15,18 @@ void main() b1 = allInvocations(b1); b1 = allInvocationsEqual(b1); } + +void attExtBad() +{ + // ERRORs, not enabled + [[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { } + [[flatten]] if (true) { } else { } +} + +#extension GL_EXT_control_flow_attributes : enable + +void attExt() +{ + [[dependency_length(-3)]] do { } while(true); // ERROR, not positive + [[dependency_length(0)]] do { } while(true); // ERROR, not positive +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/array.frag b/3rdparty/bgfx/3rdparty/glslang/Test/array.frag index 4ccb00cdb67..a7b96a44193 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/array.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/array.frag @@ -102,5 +102,12 @@ void foo3() } int[] i = int[](); // ERROR, need constructor arguments -float emptyA[]; -float b = vec4(emptyA); // ERROR, array can't be a constructor argument +float emptyA[]; +float b = vec4(emptyA); // ERROR, array can't be a constructor argument +uniform sampler2D s2d[]; + +void foo4() +{ + s2d[a]; // ERROR, can't variably index unsized array + float local[] = gUnusedUnsized; // ERROR, can initialize with runtime-sized array +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out index 779d5e1d25a..e65ee7ba7da 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out @@ -1,50 +1,46 @@ hlsl.aliasOpaque.frag -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 81 +// Generated by (magic number): 80007 +// Id's are bound by 87 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 57 + EntryPoint Fragment 4 "main" 62 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 37 "gss2" - Name 39 "gss" - Name 43 "gtex" - Name 57 "@entryPointOutput" - Decorate 37(gss2) DescriptorSet 0 - Decorate 39(gss) DescriptorSet 0 - Decorate 43(gtex) DescriptorSet 0 - Decorate 57(@entryPointOutput) Location 0 + Name 47 "gss" + Name 51 "gtex" + Name 62 "@entryPointOutput" + Decorate 47(gss) DescriptorSet 0 + Decorate 51(gtex) DescriptorSet 0 + Decorate 62(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 8: TypeFloat 32 - 10: TypeImage 8(float) 2D sampled format:Unknown - 12: TypeVector 8(float) 4 - 25: TypeSampledImage 10 - 27: TypeVector 8(float) 2 - 28: 8(float) Constant 1045220557 - 29: 8(float) Constant 1050253722 - 30: 27(fvec2) ConstantComposite 28 29 - 36: TypePointer UniformConstant 6 - 37(gss2): 36(ptr) Variable UniformConstant - 39(gss): 36(ptr) Variable UniformConstant - 42: TypePointer UniformConstant 10 - 43(gtex): 42(ptr) Variable UniformConstant - 46: 8(float) Constant 1077936128 - 56: TypePointer Output 12(fvec4) -57(@entryPointOutput): 56(ptr) Variable Output + 7: TypeFloat 32 + 8: TypeImage 7(float) 2D sampled format:Unknown + 11: TypeVector 7(float) 4 + 32: TypeSampledImage 8 + 34: TypeVector 7(float) 2 + 35: 7(float) Constant 1045220557 + 36: 7(float) Constant 1050253722 + 37: 34(fvec2) ConstantComposite 35 36 + 43: TypePointer UniformConstant 6 + 47(gss): 43(ptr) Variable UniformConstant + 50: TypePointer UniformConstant 8 + 51(gtex): 50(ptr) Variable UniformConstant + 54: 7(float) Constant 1077936128 + 61: TypePointer Output 11(fvec4) +62(@entryPointOutput): 61(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 68: 6 Load 39(gss) - 69: 10 Load 43(gtex) - 78: 25 SampledImage 69 68 - 79: 12(fvec4) ImageSampleImplicitLod 78 30 - 80: 12(fvec4) VectorTimesScalar 79 46 - Store 57(@entryPointOutput) 80 + 70: 6 Load 47(gss) + 72: 8 Load 51(gtex) + 84: 32 SampledImage 72 70 + 85: 11(fvec4) ImageSampleImplicitLod 84 37 + 86: 11(fvec4) VectorTimesScalar 85 54 + Store 62(@entryPointOutput) 86 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out index 3c7d19831b6..cf3fbabc112 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out @@ -1,65 +1,65 @@ hlsl.flattenOpaque.frag // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 144 +// Generated by (magic number): 80007 +// Id's are bound by 185 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 97 + EntryPoint Fragment 4 "main" 120 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" Name 38 "tex" - Name 70 "s.s2D" - Name 79 "s2.s2D" - Name 80 "s2.tex" - Name 97 "@entryPointOutput" + Name 82 "s.s2D" + Name 97 "s2.s2D" + Name 100 "s2.tex" + Name 120 "@entryPointOutput" Decorate 38(tex) DescriptorSet 0 - Decorate 70(s.s2D) DescriptorSet 0 - Decorate 79(s2.s2D) DescriptorSet 0 - Decorate 80(s2.tex) DescriptorSet 0 - Decorate 97(@entryPointOutput) Location 0 + Decorate 82(s.s2D) DescriptorSet 0 + Decorate 97(s2.s2D) DescriptorSet 0 + Decorate 100(s2.tex) DescriptorSet 0 + Decorate 120(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 8: TypeFloat 32 - 9: TypeVector 8(float) 4 - 14: TypeVector 8(float) 2 - 21: TypeImage 8(float) 2D sampled format:Unknown - 37: TypePointer UniformConstant 21 + 9: TypeFloat 32 + 10: TypeVector 9(float) 4 + 15: TypeVector 9(float) 2 + 22: TypeImage 9(float) 2D sampled format:Unknown + 37: TypePointer UniformConstant 22 38(tex): 37(ptr) Variable UniformConstant - 41: TypeSampledImage 21 - 43: 8(float) Constant 1045220557 - 44: 8(float) Constant 1050253722 - 45: 14(fvec2) ConstantComposite 43 44 - 69: TypePointer UniformConstant 6 - 70(s.s2D): 69(ptr) Variable UniformConstant - 79(s2.s2D): 69(ptr) Variable UniformConstant - 80(s2.tex): 37(ptr) Variable UniformConstant - 96: TypePointer Output 9(fvec4) -97(@entryPointOutput): 96(ptr) Variable Output + 45: TypeSampledImage 22 + 47: 9(float) Constant 1045220557 + 48: 9(float) Constant 1050253722 + 49: 15(fvec2) ConstantComposite 47 48 + 81: TypePointer UniformConstant 6 + 82(s.s2D): 81(ptr) Variable UniformConstant + 97(s2.s2D): 81(ptr) Variable UniformConstant + 100(s2.tex): 37(ptr) Variable UniformConstant + 119: TypePointer Output 10(fvec4) +120(@entryPointOutput): 119(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 109: 6 Load 70(s.s2D) - 123: 21 Load 38(tex) - 125: 41 SampledImage 123 109 - 126: 9(fvec4) ImageSampleImplicitLod 125 45 - 111: 6 Load 70(s.s2D) - 128: 21 Load 38(tex) - 130: 41 SampledImage 128 111 - 132: 9(fvec4) ImageSampleImplicitLod 130 45 - 113: 9(fvec4) FAdd 126 132 - 114: 6 Load 79(s2.s2D) - 115: 21 Load 80(s2.tex) - 136: 41 SampledImage 115 114 - 137: 9(fvec4) ImageSampleImplicitLod 136 45 - 117: 9(fvec4) FAdd 113 137 - 118: 6 Load 79(s2.s2D) - 119: 21 Load 80(s2.tex) - 141: 41 SampledImage 119 118 - 143: 9(fvec4) ImageSampleImplicitLod 141 45 - 121: 9(fvec4) FAdd 117 143 - Store 97(@entryPointOutput) 121 + 134: 6 Load 82(s.s2D) + 158: 22 Load 38(tex) + 161: 45 SampledImage 158 134 + 162: 10(fvec4) ImageSampleImplicitLod 161 49 + 138: 6 Load 82(s.s2D) + 164: 22 Load 38(tex) + 167: 45 SampledImage 164 138 + 169: 10(fvec4) ImageSampleImplicitLod 167 49 + 142: 10(fvec4) FAdd 162 169 + 143: 6 Load 97(s2.s2D) + 145: 22 Load 100(s2.tex) + 175: 45 SampledImage 145 143 + 176: 10(fvec4) ImageSampleImplicitLod 175 49 + 149: 10(fvec4) FAdd 142 176 + 150: 6 Load 97(s2.s2D) + 152: 22 Load 100(s2.tex) + 182: 45 SampledImage 152 150 + 184: 10(fvec4) ImageSampleImplicitLod 182 49 + 156: 10(fvec4) FAdd 149 184 + Store 120(@entryPointOutput) 156 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out index 4aef8741631..bec5aa22540 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out @@ -1,49 +1,52 @@ hlsl.flattenOpaqueInit.vert -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 125 +// Generated by (magic number): 80007 +// Id's are bound by 134 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 82 + EntryPoint Vertex 4 "main" 80 Source HLSL 500 Name 4 "main" - Name 17 "FxaaTex" - MemberName 17(FxaaTex) 0 "smpl" - MemberName 17(FxaaTex) 1 "tex" - Name 38 "g_tInputTexture_sampler" - Name 42 "g_tInputTexture" - Name 82 "@entryPointOutput" - Decorate 38(g_tInputTexture_sampler) DescriptorSet 0 - Decorate 42(g_tInputTexture) DescriptorSet 0 - Decorate 82(@entryPointOutput) Location 0 + Name 43 "g_tInputTexture_sampler" + Name 47 "g_tInputTexture" + Name 80 "@entryPointOutput" + Decorate 43(g_tInputTexture_sampler) DescriptorSet 0 + Decorate 47(g_tInputTexture) DescriptorSet 0 + Decorate 80(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 8: TypeFloat 32 - 9: TypeImage 8(float) 2D sampled format:Unknown - 11: TypeVector 8(float) 4 - 17(FxaaTex): TypeStruct 6 9 - 26: TypeSampledImage 9 - 28: TypeVector 8(float) 2 - 29: 8(float) Constant 1050253722 - 30: 8(float) Constant 1053609165 - 31: 28(fvec2) ConstantComposite 29 30 - 32: 8(float) Constant 0 - 37: TypePointer UniformConstant 6 -38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant - 41: TypePointer UniformConstant 9 -42(g_tInputTexture): 41(ptr) Variable UniformConstant - 81: TypePointer Output 11(fvec4) -82(@entryPointOutput): 81(ptr) Variable Output + 7: TypeFloat 32 + 8: TypeImage 7(float) 2D sampled format:Unknown + 11: TypeVector 7(float) 4 + 31: TypeSampledImage 8 + 33: TypeVector 7(float) 2 + 34: 7(float) Constant 1050253722 + 35: 7(float) Constant 1053609165 + 36: 33(fvec2) ConstantComposite 34 35 + 37: 7(float) Constant 0 + 42: TypePointer UniformConstant 6 +43(g_tInputTexture_sampler): 42(ptr) Variable UniformConstant + 46: TypePointer UniformConstant 8 +47(g_tInputTexture): 46(ptr) Variable UniformConstant + 79: TypePointer Output 11(fvec4) +80(@entryPointOutput): 79(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 96: 6 Load 38(g_tInputTexture_sampler) - 97: 9 Load 42(g_tInputTexture) - 123: 26 SampledImage 97 96 - 124: 11(fvec4) ImageSampleExplicitLod 123 31 Lod 32 - Store 82(@entryPointOutput) 124 + 90: 6 Load 43(g_tInputTexture_sampler) + 91: 8 Load 47(g_tInputTexture) + 111: 31 SampledImage 91 90 + 112: 11(fvec4) ImageSampleExplicitLod 111 36 Lod 37 + 115: 6 Load 43(g_tInputTexture_sampler) + 117: 8 Load 47(g_tInputTexture) + 125: 31 SampledImage 117 115 + 126: 11(fvec4) ImageSampleExplicitLod 125 36 Lod 37 + 99: 11(fvec4) FAdd 112 126 + 132: 31 SampledImage 91 90 + 133: 11(fvec4) ImageSampleExplicitLod 132 36 Lod 37 + 104: 11(fvec4) FAdd 99 133 + Store 80(@entryPointOutput) 104 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out index 0b056158271..14d0cd3f4a8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out @@ -1,49 +1,43 @@ hlsl.flattenOpaqueInitMix.vert -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 100 +// Generated by (magic number): 80007 +// Id's are bound by 97 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 68 + EntryPoint Vertex 4 "main" 57 Source HLSL 500 Name 4 "main" - Name 34 "FxaaTex" - MemberName 34(FxaaTex) 0 "smpl" - MemberName 34(FxaaTex) 1 "tex" - MemberName 34(FxaaTex) 2 "f" - Name 38 "g_tInputTexture_sampler" - Name 41 "g_tInputTexture" - Name 68 "@entryPointOutput" - Decorate 38(g_tInputTexture_sampler) DescriptorSet 0 - Decorate 41(g_tInputTexture) DescriptorSet 0 - Decorate 68(@entryPointOutput) Location 0 + Name 44 "g_tInputTexture_sampler" + Name 47 "g_tInputTexture" + Name 57 "@entryPointOutput" + Decorate 44(g_tInputTexture_sampler) DescriptorSet 0 + Decorate 47(g_tInputTexture) DescriptorSet 0 + Decorate 57(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 8: TypeFloat 32 - 9: TypeImage 8(float) 2D sampled format:Unknown - 12: TypeVector 8(float) 4 - 24: TypeSampledImage 9 - 28: TypeVector 8(float) 2 - 30: 8(float) Constant 0 - 34(FxaaTex): TypeStruct 6 9 8(float) - 37: TypePointer UniformConstant 6 -38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant - 40: TypePointer UniformConstant 9 -41(g_tInputTexture): 40(ptr) Variable UniformConstant - 43: 8(float) Constant 1056964608 - 67: TypePointer Output 12(fvec4) -68(@entryPointOutput): 67(ptr) Variable Output + 7: TypeFloat 32 + 8: TypeImage 7(float) 2D sampled format:Unknown + 11: TypeVector 7(float) 4 + 28: TypeSampledImage 8 + 36: TypeVector 7(float) 2 + 38: 7(float) Constant 0 + 43: TypePointer UniformConstant 6 +44(g_tInputTexture_sampler): 43(ptr) Variable UniformConstant + 46: TypePointer UniformConstant 8 +47(g_tInputTexture): 46(ptr) Variable UniformConstant + 49: 7(float) Constant 1056964608 + 56: TypePointer Output 11(fvec4) +57(@entryPointOutput): 56(ptr) Variable Output + 96: 36(fvec2) ConstantComposite 49 49 4(main): 2 Function None 3 5: Label - 79: 6 Load 38(g_tInputTexture_sampler) - 80: 9 Load 41(g_tInputTexture) - 95: 24 SampledImage 80 79 - 98: 28(fvec2) CompositeConstruct 43 43 - 99: 12(fvec4) ImageSampleExplicitLod 95 98 Lod 30 - Store 68(@entryPointOutput) 99 + 63: 6 Load 44(g_tInputTexture_sampler) + 64: 8 Load 47(g_tInputTexture) + 73: 28 SampledImage 64 63 + 79: 11(fvec4) ImageSampleExplicitLod 73 96 Lod 38 + Store 57(@entryPointOutput) 79 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out index 20aedec26f4..143c96c5ea4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out @@ -1,48 +1,47 @@ hlsl.flattenSubset.frag -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 85 +// Generated by (magic number): 80007 +// Id's are bound by 66 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 54 57 + EntryPoint Fragment 4 "main" 47 50 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 17 "samp" - Name 41 "tex" - Name 54 "vpos" - Name 57 "@entryPointOutput" - Decorate 17(samp) DescriptorSet 0 - Decorate 41(tex) DescriptorSet 0 - Decorate 54(vpos) Location 0 - Decorate 57(@entryPointOutput) Location 0 + Name 21 "samp" + Name 33 "tex" + Name 47 "vpos" + Name 50 "@entryPointOutput" + Decorate 21(samp) DescriptorSet 0 + Decorate 33(tex) DescriptorSet 0 + Decorate 47(vpos) Location 0 + Decorate 50(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 13: TypeSampler - 16: TypePointer UniformConstant 13 - 17(samp): 16(ptr) Variable UniformConstant - 39: TypeImage 6(float) 2D sampled format:Unknown - 40: TypePointer UniformConstant 39 - 41(tex): 40(ptr) Variable UniformConstant - 44: TypeSampledImage 39 - 46: TypeVector 6(float) 2 - 47: 6(float) Constant 1056964608 - 48: 46(fvec2) ConstantComposite 47 47 - 53: TypePointer Input 7(fvec4) - 54(vpos): 53(ptr) Variable Input - 56: TypePointer Output 7(fvec4) -57(@entryPointOutput): 56(ptr) Variable Output + 20: TypePointer UniformConstant 13 + 21(samp): 20(ptr) Variable UniformConstant + 31: TypeImage 6(float) 2D sampled format:Unknown + 32: TypePointer UniformConstant 31 + 33(tex): 32(ptr) Variable UniformConstant + 37: TypeSampledImage 31 + 39: TypeVector 6(float) 2 + 40: 6(float) Constant 1056964608 + 41: 39(fvec2) ConstantComposite 40 40 + 46: TypePointer Input 7(fvec4) + 47(vpos): 46(ptr) Variable Input + 49: TypePointer Output 7(fvec4) +50(@entryPointOutput): 49(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 74: 13 Load 17(samp) - 81: 39 Load 41(tex) - 83: 44 SampledImage 81 74 - 84: 7(fvec4) ImageSampleImplicitLod 83 48 - Store 57(@entryPointOutput) 84 + 57: 13 Load 21(samp) + 61: 31 Load 33(tex) + 64: 37 SampledImage 61 57 + 65: 7(fvec4) ImageSampleImplicitLod 64 41 + Store 50(@entryPointOutput) 65 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset2.frag.out index 724ae7bf9b5..0d7ab5603f5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset2.frag.out @@ -1,37 +1,31 @@ hlsl.flattenSubset2.frag -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 44 +// Generated by (magic number): 80007 +// Id's are bound by 53 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 40 43 + EntryPoint Fragment 4 "main" 49 52 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 31 "someTex" - Name 40 "vpos" - Name 43 "@entryPointOutput" - Decorate 31(someTex) DescriptorSet 0 - Decorate 40(vpos) Location 0 - Decorate 43(@entryPointOutput) Location 0 + Name 49 "vpos" + Name 52 "@entryPointOutput" + Decorate 49(vpos) Location 0 + Decorate 52(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 - 17: TypeImage 6(float) 2D sampled format:Unknown - 30: TypePointer UniformConstant 17 - 31(someTex): 30(ptr) Variable UniformConstant - 34: 6(float) Constant 0 - 35: 7(fvec4) ConstantComposite 34 34 34 34 - 39: TypePointer Input 7(fvec4) - 40(vpos): 39(ptr) Variable Input - 42: TypePointer Output 7(fvec4) -43(@entryPointOutput): 42(ptr) Variable Output + 43: 6(float) Constant 0 + 44: 7(fvec4) ConstantComposite 43 43 43 43 + 48: TypePointer Input 7(fvec4) + 49(vpos): 48(ptr) Variable Input + 51: TypePointer Output 7(fvec4) +52(@entryPointOutput): 51(ptr) Variable Output 4(main): 2 Function None 3 5: Label - Store 43(@entryPointOutput) 35 + Store 52(@entryPointOutput) 44 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out index ed3102e1810..27482b34d84 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out @@ -1,91 +1,81 @@ hlsl.partialFlattenLocal.vert -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 148 +// Generated by (magic number): 80007 +// Id's are bound by 158 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 90 93 + EntryPoint Vertex 4 "main" 83 86 Source HLSL 500 Name 4 "main" - Name 17 "tex" - Name 90 "pos" - Name 93 "@entryPointOutput" - Decorate 17(tex) DescriptorSet 0 - Decorate 90(pos) Location 0 - Decorate 93(@entryPointOutput) BuiltIn Position + Name 83 "pos" + Name 86 "@entryPointOutput" + Decorate 83(pos) Location 0 + Decorate 86(@entryPointOutput) BuiltIn Position 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 - 13: TypeImage 6(float) 2D sampled format:Unknown - 16: TypePointer UniformConstant 13 - 17(tex): 16(ptr) Variable UniformConstant - 19: TypeVector 6(float) 3 - 20: TypeInt 32 0 - 21: 20(int) Constant 3 - 22: TypeArray 19(fvec3) 21 - 23: TypePointer Function 22 - 25: TypeInt 32 1 - 26: 25(int) Constant 0 - 27: 6(float) Constant 0 - 28: 19(fvec3) ConstantComposite 27 27 27 - 29: TypePointer Function 19(fvec3) - 31: TypeVector 6(float) 2 - 32: 20(int) Constant 2 - 33: TypeArray 31(fvec2) 32 - 34: TypePointer Function 33 - 36: 6(float) Constant 1065353216 - 37: 31(fvec2) ConstantComposite 27 36 - 38: TypePointer Function 31(fvec2) - 52: 25(int) Constant 1 - 53: TypeBool - 89: TypePointer Input 7(fvec4) - 90(pos): 89(ptr) Variable Input - 92: TypePointer Output 7(fvec4) -93(@entryPointOutput): 92(ptr) Variable Output + 14: TypeVector 6(float) 3 + 15: TypeInt 32 0 + 16: 15(int) Constant 3 + 17: TypeArray 14(fvec3) 16 + 18: TypeVector 6(float) 2 + 19: 15(int) Constant 2 + 20: TypeArray 18(fvec2) 19 + 21: TypeInt 32 1 + 25: 21(int) Constant 0 + 31: 21(int) Constant 1 + 32: 6(float) Constant 0 + 33: 14(fvec3) ConstantComposite 32 32 32 + 34: TypePointer Function 14(fvec3) + 37: 6(float) Constant 1065353216 + 38: 18(fvec2) ConstantComposite 32 37 + 39: TypePointer Function 18(fvec2) + 54: TypeBool + 82: TypePointer Input 7(fvec4) + 83(pos): 82(ptr) Variable Input + 85: TypePointer Output 7(fvec4) +86(@entryPointOutput): 85(ptr) Variable Output + 130: TypePointer Function 17 + 132: TypePointer Function 20 4(main): 2 Function None 3 5: Label - 98: 23(ptr) Variable Function - 99: 34(ptr) Variable Function - 91: 7(fvec4) Load 90(pos) - 110: 29(ptr) AccessChain 98 26 - Store 110 28 - 111: 38(ptr) AccessChain 99 26 - Store 111 37 - Branch 112 - 112: Label - 147: 25(int) Phi 26 5 131 114 - LoopMerge 113 114 None - Branch 115 - 115: Label - 117: 53(bool) SLessThan 147 52 - BranchConditional 117 118 113 - 118: Label - 121: 38(ptr) AccessChain 99 147 - 122: 31(fvec2) Load 121 - 123: 29(ptr) AccessChain 98 147 - 124: 19(fvec3) Load 123 - 125: 31(fvec2) VectorShuffle 124 124 0 1 - 126: 31(fvec2) FAdd 125 122 - 127: 29(ptr) AccessChain 98 147 - 128: 19(fvec3) Load 127 - 129: 19(fvec3) VectorShuffle 128 126 3 4 2 - Store 127 129 - Branch 114 - 114: Label - 131: 25(int) IAdd 147 52 - Branch 112 - 113: Label - 133: 22 Load 98 - 146: 19(fvec3) CompositeExtract 133 0 - 140: 6(float) CompositeExtract 146 0 - 141: 6(float) CompositeExtract 146 1 - 142: 6(float) CompositeExtract 146 2 - 143: 7(fvec4) CompositeConstruct 140 141 142 27 - 144: 7(fvec4) FAdd 91 143 - Store 93(@entryPointOutput) 144 + 133: 132(ptr) Variable Function + 131: 130(ptr) Variable Function + 84: 7(fvec4) Load 83(pos) + 136: 34(ptr) AccessChain 131 25 + Store 136 33 + 137: 39(ptr) AccessChain 133 25 + Store 137 38 + Branch 100 + 100: Label + 157: 21(int) Phi 25 5 119 106 + 105: 54(bool) SLessThan 157 31 + LoopMerge 101 106 None + BranchConditional 105 106 101 + 106: Label + 138: 39(ptr) AccessChain 133 157 + 110: 18(fvec2) Load 138 + 139: 34(ptr) AccessChain 131 157 + 112: 14(fvec3) Load 139 + 113: 18(fvec2) VectorShuffle 112 112 0 1 + 114: 18(fvec2) FAdd 113 110 + 140: 34(ptr) AccessChain 131 157 + 116: 14(fvec3) Load 140 + 117: 14(fvec3) VectorShuffle 116 114 3 4 2 + Store 140 117 + 119: 21(int) IAdd 157 31 + Branch 100 + 101: Label + 142: 17 Load 131 + 156: 14(fvec3) CompositeExtract 142 0 + 124: 6(float) CompositeExtract 156 0 + 125: 6(float) CompositeExtract 156 1 + 126: 6(float) CompositeExtract 156 2 + 127: 7(fvec4) CompositeConstruct 124 125 126 32 + 128: 7(fvec4) FAdd 84 127 + Store 86(@entryPointOutput) 128 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out index d57566b349e..e54fb7efa35 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out @@ -1,38 +1,29 @@ hlsl.partialFlattenMixed.vert -WARNING: AST will form illegal SPIR-V; need to transform to legalize // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 31 +// Generated by (magic number): 80007 +// Id's are bound by 36 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 27 30 + EntryPoint Vertex 4 "main" 32 35 Source HLSL 500 Name 4 "main" - Name 20 "tex" - Name 27 "pos" - Name 30 "@entryPointOutput" - Decorate 20(tex) DescriptorSet 0 - Decorate 27(pos) Location 0 - Decorate 30(@entryPointOutput) BuiltIn Position + Name 32 "pos" + Name 35 "@entryPointOutput" + Decorate 32(pos) Location 0 + Decorate 35(@entryPointOutput) BuiltIn Position 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 - 13: TypeImage 6(float) 2D sampled format:Unknown - 14: TypeInt 32 0 - 15: 14(int) Constant 2 - 16: TypeArray 13 15 - 19: TypePointer UniformConstant 16 - 20(tex): 19(ptr) Variable UniformConstant - 26: TypePointer Input 7(fvec4) - 27(pos): 26(ptr) Variable Input - 29: TypePointer Output 7(fvec4) -30(@entryPointOutput): 29(ptr) Variable Output + 31: TypePointer Input 7(fvec4) + 32(pos): 31(ptr) Variable Input + 34: TypePointer Output 7(fvec4) +35(@entryPointOutput): 34(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 28: 7(fvec4) Load 27(pos) - Store 30(@entryPointOutput) 28 + 33: 7(fvec4) Load 32(pos) + Store 35(@entryPointOutput) 33 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/100.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/100.frag.out index 3464dcb5699..5e702e87cae 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/100.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/100.frag.out @@ -395,7 +395,7 @@ ERROR: node is still EOpNull! 0:? 'v' ( smooth in 3-element array of mediump 4-component vector of float) 0:? 'f' ( invariant global mediump float) 0:? 'anon@0' (layout( column_major shared) uniform block{layout( column_major shared) uniform mediump int x}) -0:? 'fa' ( global implicitly-sized array of mediump float) +0:? 'fa' ( global unsized 1-element array of mediump float) 0:? 'f13' ( invariant global mediump float) 0:? 'fi' ( invariant temp mediump float) 0:? 'av' ( invariant smooth in mediump 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/110scope.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/110scope.vert.out index a07de4fb3c8..e23d3c0f462 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/110scope.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/110scope.vert.out @@ -2,7 +2,8 @@ ERROR: 0:5: 'a' : redefinition ERROR: 0:57: 'z' : undeclared identifier ERROR: 0:57: 'z' : redefinition -ERROR: 3 compilation errors. No code generated. +ERROR: 0:83: 'S' : redefinition struct +ERROR: 4 compilation errors. No code generated. Shader version: 110 @@ -120,6 +121,21 @@ ERROR: node is still EOpNull! 0:69 0 (const int) 0:73 Constant: 0:73 183.346494 +0:? Sequence +0:77 move second child to first child ( temp int) +0:77 x: direct index for structure ( temp int) +0:77 's' ( temp structure{ temp int x}) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 3 (const int) +0:82 move second child to first child ( temp bool) +0:82 b: direct index for structure ( temp bool) +0:82 't' ( temp structure{ temp bool b}) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 true (const bool) 0:? Linker Objects 0:? 'b' ( global bool) 0:? 'c' ( global bool) @@ -236,6 +252,21 @@ ERROR: node is still EOpNull! 0:69 0 (const int) 0:73 Constant: 0:73 183.346494 +0:? Sequence +0:77 move second child to first child ( temp int) +0:77 x: direct index for structure ( temp int) +0:77 's' ( temp structure{ temp int x}) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 3 (const int) +0:82 move second child to first child ( temp bool) +0:82 b: direct index for structure ( temp bool) +0:82 't' ( temp structure{ temp bool b}) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 true (const bool) 0:? Linker Objects 0:? 'b' ( global bool) 0:? 'c' ( global bool) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.frag.out index b5167247527..8909f16f4ea 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.frag.out @@ -19,7 +19,7 @@ ERROR: 0:82: 'xr' : vector swizzle selectors not from the same set ERROR: 0:83: 'xyxyx' : vector swizzle too long ERROR: 0:84: 'z' : vector swizzle selection out of range ERROR: 0:85: 'assign' : l-value required -ERROR: 0:91: 'int' : overloaded functions must have the same return type +ERROR: 0:91: 'main' : overloaded functions must have the same return type ERROR: 0:91: 'main' : function already has a body ERROR: 0:91: 'int' : entry point cannot return a value ERROR: 0:92: 'main' : function cannot take any parameter(s) @@ -52,8 +52,12 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone ERROR: 0:212: 'sampler2DRect' : Reserved word. ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion) ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion) +ERROR: 0:248: 'half floating-point suffix' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 ERROR: 0:248: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON -ERROR: 54 compilation errors. No code generated. +ERROR: 55 compilation errors. No code generated. Shader version: 120 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.vert.out index c89be981ebd..5a91ed664e8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/120.vert.out @@ -19,6 +19,7 @@ ERROR: 0:34: 'a4' : redefinition ERROR: 0:35: 'arrays of arrays' : not supported with this profile: none ERROR: 0:36: 'arrays of arrays' : not supported with this profile: none ERROR: 0:37: 'arrays of arrays' : not supported with this profile: none +ERROR: 0:37: 'arrays of arrays' : not supported with this profile: none ERROR: 0:38: 'arrays of arrays' : not supported with this profile: none ERROR: 0:39: 'arrays of arrays' : not supported with this profile: none ERROR: 0:40: 'arrays of arrays' : not supported with this profile: none @@ -34,7 +35,7 @@ ERROR: 0:51: 'arrays of arrays' : not supported with this profile: none ERROR: 0:52: 'arrays of arrays' : not supported with this profile: none ERROR: 0:53: 'arrays of arrays' : not supported with this profile: none ERROR: 0:56: 'out' : overloaded functions must have the same parameter storage qualifiers for argument 1 -ERROR: 0:57: 'float' : overloaded functions must have the same return type +ERROR: 0:57: 'overloadA' : overloaded functions must have the same return type ERROR: 0:87: 'overloadC' : no matching overloaded function found ERROR: 0:90: 'overloadC' : no matching overloaded function found ERROR: 0:95: 'overloadD' : ambiguous function signature match: multiple signatures match under implicit type conversion @@ -78,7 +79,7 @@ ERROR: 0:192: 'assign' : l-value required (can't modify a const) ERROR: 0:195: 'gl_ModelViewMatrix' : identifiers starting with "gl_" are reserved ERROR: 0:200: 'token pasting (##)' : not supported for this version or the enabled extensions ERROR: 0:203: 'token pasting (##)' : not supported for this version or the enabled extensions -ERROR: 79 compilation errors. No code generated. +ERROR: 80 compilation errors. No code generated. Shader version: 120 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.frag.out index c1c479a0d7d..81d055befea 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.frag.out @@ -49,7 +49,7 @@ ERROR: node is still EOpNull! 0:18 move second child to first child ( temp float) 0:18 'clip' ( temp float) 0:18 direct index ( smooth temp float ClipDistance) -0:18 'gl_ClipDistance' ( smooth in implicitly-sized array of float ClipDistance) +0:18 'gl_ClipDistance' ( smooth in unsized 4-element array of float ClipDistance) 0:18 Constant: 0:18 3 (const int) 0:23 Function Definition: foo( ( global void) @@ -381,7 +381,7 @@ ERROR: node is still EOpNull! 0:? 'fflat' ( flat in float) 0:? 'fsmooth' ( smooth in float) 0:? 'fnop' ( noperspective in float) -0:? 'gl_ClipDistance' ( smooth in implicitly-sized array of float ClipDistance) +0:? 'gl_ClipDistance' ( smooth in unsized 4-element array of float ClipDistance) 0:? 'sampC' ( uniform samplerCube) 0:? 'gl_Color' ( in 4-component vector of float Color) 0:? 'samp2D' ( uniform sampler2D) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.vert.out index 7ec82ada7f7..e38043c60b6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/130.vert.out @@ -113,7 +113,7 @@ ERROR: node is still EOpNull! 0:45 'gl_VertexID' ( gl_VertexId int VertexId) 0:46 move second child to first child ( temp float) 0:46 direct index ( smooth temp float ClipDistance) -0:46 'gl_ClipDistance' ( smooth out implicitly-sized array of float ClipDistance) +0:46 'gl_ClipDistance' ( smooth out unsized 2-element array of float ClipDistance) 0:46 Constant: 0:46 1 (const int) 0:46 Constant: @@ -132,7 +132,7 @@ ERROR: node is still EOpNull! 0:66 'gl_DepthRange' ( uniform structure{ global float near, global float far, global float diff}) 0:66 Constant: 0:66 1 (const int) -0:67 'gl_TexCoord' ( smooth out implicitly-sized array of 4-component vector of float TexCoord) +0:67 'gl_TexCoord' ( smooth out unsized 1-element array of 4-component vector of float TexCoord) 0:68 'gl_FogFragCoord' ( smooth out float FogFragCoord) 0:69 'gl_FrontColor' ( smooth out 4-component vector of float FrontColor) 0:? Linker Objects @@ -145,8 +145,8 @@ ERROR: node is still EOpNull! 0:? 'c3D' ( in 3-component vector of float) 0:? 'c4D' ( smooth temp 4-component vector of float) 0:? 'v4' ( uniform 4-component vector of float) -0:? 'gl_ClipDistance' ( smooth out implicitly-sized array of float ClipDistance) -0:? 'gl_TexCoord' ( smooth out implicitly-sized array of 4-component vector of float TexCoord) +0:? 'gl_ClipDistance' ( smooth out unsized 2-element array of float ClipDistance) +0:? 'gl_TexCoord' ( smooth out unsized 1-element array of 4-component vector of float TexCoord) 0:? 'abcdef' ( global int) 0:? 'qrstuv' ( global int) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/140.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/140.vert.out index 975c93293ac..020afd08e62 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/140.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/140.vert.out @@ -52,7 +52,7 @@ ERROR: node is still EOpNull! 0:17 'gl_DepthRange' ( uniform structure{ global float near, global float far, global float diff}) 0:17 Constant: 0:17 1 (const int) -0:18 'gl_TexCoord' ( smooth out implicitly-sized array of 4-component vector of float TexCoord) +0:18 'gl_TexCoord' ( smooth out unsized 1-element array of 4-component vector of float TexCoord) 0:19 'gl_FogFragCoord' ( smooth out float FogFragCoord) 0:20 'gl_FrontColor' ( smooth out 4-component vector of float FrontColor) 0:48 Function Definition: foo( ( global void) @@ -133,7 +133,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'sbuf' ( uniform isamplerBuffer) 0:? 'anon@0' (layout( column_major std140) uniform block{layout( column_major std140 offset=0) uniform int anonMem}) -0:? 'gl_TexCoord' ( smooth out implicitly-sized array of 4-component vector of float TexCoord) +0:? 'gl_TexCoord' ( smooth out unsized 1-element array of 4-component vector of float TexCoord) 0:? 'gl_Position' ( smooth out 4-component vector of float) 0:? 'locBad' (layout( location=9) in 4-component vector of float) 0:? 'loc' (layout( location=9) in 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.geom.out index e3a78c9233d..92b8e1aa50b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.geom.out @@ -67,16 +67,16 @@ ERROR: node is still EOpNull! 0:32 0 (const int) 0:33 move second child to first child ( temp float) 0:33 direct index (layout( stream=0) temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure (layout( stream=0) out implicitly-sized array of float ClipDistance) -0:33 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure (layout( stream=0) out unsized 4-element array of float ClipDistance) +0:33 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out unsized 4-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 2 (const uint) 0:33 Constant: 0:33 3 (const int) 0:33 direct index ( temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:33 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:33 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:33 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: @@ -85,24 +85,24 @@ ERROR: node is still EOpNull! 0:33 2 (const int) 0:34 move second child to first child ( temp 4-component vector of float) 0:34 gl_Position: direct index for structure (layout( stream=0) gl_Position 4-component vector of float Position) -0:34 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:34 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out unsized 4-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 0 (const uint) 0:34 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:34 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:34 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:34 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:34 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 0 (const int) 0:34 Constant: 0:34 0 (const int) 0:35 move second child to first child ( temp float) 0:35 gl_PointSize: direct index for structure (layout( stream=0) gl_PointSize float PointSize) -0:35 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:35 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out unsized 4-element array of float ClipDistance gl_ClipDistance}) 0:35 Constant: 0:35 1 (const uint) 0:35 gl_PointSize: direct index for structure ( in float PointSize) -0:35 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:35 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:35 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:35 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:35 Constant: 0:35 3 (const int) 0:35 Constant: @@ -151,8 +151,8 @@ ERROR: node is still EOpNull! 0:? 'fromV' ( in 4-element array of block{ in 3-component vector of float color}) 0:? 'toF' (layout( stream=0) out block{layout( stream=0) out 3-component vector of float color}) 0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) out 3-component vector of float color}) -0:? 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:? 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'anon@1' (layout( stream=0) out block{layout( stream=0) gl_Position 4-component vector of float Position gl_Position, layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out unsized 4-element array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' ( in 4-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:? 'ov0' (layout( stream=0) out 4-component vector of float) 0:? 'ov4' (layout( stream=4) out 4-component vector of float) 0:? 'o1v0' (layout( stream=0) out 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.tesc.out index 25e44eddaf8..89220264fa7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.tesc.out @@ -16,8 +16,8 @@ vertices = 4 0:20 move second child to first child ( temp 4-component vector of float) 0:20 'p' ( temp 4-component vector of float) 0:20 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:20 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:20 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:20 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:20 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:20 Constant: 0:20 1 (const int) 0:20 Constant: @@ -26,8 +26,8 @@ vertices = 4 0:21 move second child to first child ( temp float) 0:21 'ps' ( temp float) 0:21 gl_PointSize: direct index for structure ( in float PointSize) -0:21 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:21 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:21 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:21 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:21 Constant: 0:21 1 (const int) 0:21 Constant: @@ -36,9 +36,9 @@ vertices = 4 0:22 move second child to first child ( temp float) 0:22 'cd' ( temp float) 0:22 direct index ( temp float ClipDistance) -0:22 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:22 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:22 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:22 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:22 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:22 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:22 Constant: 0:22 1 (const int) 0:22 Constant: @@ -59,25 +59,25 @@ vertices = 4 0:26 'gl_InvocationID' ( in int InvocationID) 0:28 move second child to first child ( temp 4-component vector of float) 0:28 gl_Position: direct index for structure ( out 4-component vector of float Position) -0:28 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:28 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:28 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:28 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:28 'gl_InvocationID' ( in int InvocationID) 0:28 Constant: 0:28 0 (const int) 0:28 'p' ( temp 4-component vector of float) 0:29 move second child to first child ( temp float) 0:29 gl_PointSize: direct index for structure ( out float PointSize) -0:29 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:29 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:29 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:29 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:29 'gl_InvocationID' ( in int InvocationID) 0:29 Constant: 0:29 1 (const int) 0:29 'ps' ( temp float) 0:30 move second child to first child ( temp float) 0:30 direct index ( temp float ClipDistance) -0:30 gl_ClipDistance: direct index for structure ( out implicitly-sized array of float ClipDistance) -0:30 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:30 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:30 gl_ClipDistance: direct index for structure ( out unsized 2-element array of float ClipDistance) +0:30 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:30 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:30 'gl_InvocationID' ( in int InvocationID) 0:30 Constant: 0:30 2 (const int) @@ -99,7 +99,7 @@ vertices = 4 0:33 Constant: 0:33 1.300000 0:? Linker Objects -0:? 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' ( global 4-element array of int) 0:? 'patchOut' ( patch out 4-component vector of float) @@ -129,8 +129,8 @@ ERROR: node is still EOpNull! 0:22 move second child to first child ( temp 4-component vector of float) 0:22 'p' ( temp 4-component vector of float) 0:22 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:22 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:22 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:22 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:22 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:22 Constant: 0:22 1 (const int) 0:22 Constant: @@ -139,8 +139,8 @@ ERROR: node is still EOpNull! 0:23 move second child to first child ( temp float) 0:23 'ps' ( temp float) 0:23 gl_PointSize: direct index for structure ( in float PointSize) -0:23 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:23 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -149,9 +149,9 @@ ERROR: node is still EOpNull! 0:24 move second child to first child ( temp float) 0:24 'cd' ( temp float) 0:24 direct index ( temp float ClipDistance) -0:24 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:24 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:24 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:24 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:24 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:24 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -186,20 +186,20 @@ ERROR: node is still EOpNull! 0:30 1 (const int) 0:32 move second child to first child ( temp 4-component vector of float) 0:32 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -0:32 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:32 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:32 Constant: 0:32 0 (const uint) 0:32 'p' ( temp 4-component vector of float) 0:33 move second child to first child ( temp float) 0:33 gl_PointSize: direct index for structure ( gl_PointSize float PointSize) -0:33 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const uint) 0:33 'ps' ( temp float) 0:34 move second child to first child ( temp float) 0:34 direct index ( temp float ClipDistance) -0:34 gl_ClipDistance: direct index for structure ( out implicitly-sized array of float ClipDistance) -0:34 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:34 gl_ClipDistance: direct index for structure ( out unsized 3-element array of float ClipDistance) +0:34 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 2 (const uint) 0:34 Constant: @@ -207,7 +207,7 @@ ERROR: node is still EOpNull! 0:34 'cd' ( temp float) 0:? Linker Objects 0:? 'patchIn' ( patch in 4-component vector of float) -0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 400.tesc ERROR: 0:6: 'quads' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) @@ -255,8 +255,8 @@ ERROR: node is still EOpNull! 0:23 move second child to first child ( temp 4-component vector of float) 0:23 'p' ( temp 4-component vector of float) 0:23 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:23 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:23 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -265,8 +265,8 @@ ERROR: node is still EOpNull! 0:24 move second child to first child ( temp float) 0:24 'ps' ( temp float) 0:24 gl_PointSize: direct index for structure ( in float PointSize) -0:24 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:24 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:24 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:24 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -275,9 +275,9 @@ ERROR: node is still EOpNull! 0:25 move second child to first child ( temp float) 0:25 'cd' ( temp float) 0:25 direct index ( temp float ClipDistance) -0:25 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:25 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:25 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:25 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:25 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:25 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:25 Constant: 0:25 1 (const int) 0:25 Constant: @@ -298,25 +298,25 @@ ERROR: node is still EOpNull! 0:29 'gl_InvocationID' ( in int InvocationID) 0:31 move second child to first child ( temp 4-component vector of float) 0:31 gl_Position: direct index for structure ( out 4-component vector of float Position) -0:31 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:31 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:31 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:31 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:31 'gl_InvocationID' ( in int InvocationID) 0:31 Constant: 0:31 0 (const int) 0:31 'p' ( temp 4-component vector of float) 0:32 move second child to first child ( temp float) 0:32 gl_PointSize: direct index for structure ( out float PointSize) -0:32 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:32 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:32 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:32 'gl_InvocationID' ( in int InvocationID) 0:32 Constant: 0:32 1 (const int) 0:32 'ps' ( temp float) 0:33 move second child to first child ( temp float) 0:33 direct index ( temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure ( out implicitly-sized array of float ClipDistance) -0:33 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:33 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure ( out unsized 2-element array of float ClipDistance) +0:33 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:33 'gl_InvocationID' ( in int InvocationID) 0:33 Constant: 0:33 2 (const int) @@ -386,8 +386,8 @@ ERROR: node is still EOpNull! 0:67 Function Parameters: 0:69 Sequence 0:69 gl_PointSize: direct index for structure ( out float PointSize) -0:69 direct index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:69 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:69 direct index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:69 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:69 Constant: 0:69 4 (const int) 0:69 Constant: @@ -422,7 +422,7 @@ ERROR: node is still EOpNull! 0:123 'gl_DeviceIndex' ( in int DeviceIndex) 0:124 'gl_ViewIndex' ( in int ViewIndex) 0:? Linker Objects -0:? 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' ( global 4-element array of int) 0:? 'patchIn' ( patch in 4-component vector of float) 0:? 'patchOut' ( patch out 4-component vector of float) @@ -453,7 +453,6 @@ ERROR: 0:47: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:48: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample) -ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as implicitly-sized ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use ERROR: 0:64: 'quads' : cannot apply to 'out' ERROR: 0:64: 'cw' : can only apply to 'in' @@ -473,7 +472,7 @@ ERROR: 0:99: 'location' : overlapping use of location 24 ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview -ERROR: 32 compilation errors. No code generated. +ERROR: 31 compilation errors. No code generated. Shader version: 400 @@ -499,8 +498,8 @@ ERROR: node is still EOpNull! 0:32 move second child to first child ( temp 4-component vector of float) 0:32 'p' ( temp 4-component vector of float) 0:32 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:32 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:32 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:32 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:32 Constant: 0:32 1 (const int) 0:32 Constant: @@ -509,8 +508,8 @@ ERROR: node is still EOpNull! 0:33 move second child to first child ( temp float) 0:33 'ps' ( temp float) 0:33 gl_PointSize: direct index for structure ( in float PointSize) -0:33 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:33 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: @@ -519,9 +518,9 @@ ERROR: node is still EOpNull! 0:34 move second child to first child ( temp float) 0:34 'cd' ( temp float) 0:34 direct index ( temp float ClipDistance) -0:34 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:34 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:34 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:34 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:34 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:34 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 1 (const int) 0:34 Constant: @@ -556,20 +555,20 @@ ERROR: node is still EOpNull! 0:40 1 (const int) 0:42 move second child to first child ( temp 4-component vector of float) 0:42 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -0:42 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:42 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:42 Constant: 0:42 0 (const uint) 0:42 'p' ( temp 4-component vector of float) 0:43 move second child to first child ( temp float) 0:43 gl_PointSize: direct index for structure ( gl_PointSize float PointSize) -0:43 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:43 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:43 Constant: 0:43 1 (const uint) 0:43 'ps' ( temp float) 0:44 move second child to first child ( temp float) 0:44 direct index ( temp float ClipDistance) -0:44 gl_ClipDistance: direct index for structure ( out implicitly-sized array of float ClipDistance) -0:44 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:44 gl_ClipDistance: direct index for structure ( out unsized 3-element array of float ClipDistance) +0:44 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:44 Constant: 0:44 2 (const uint) 0:44 Constant: @@ -588,7 +587,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'patchIn' ( patch in 4-component vector of float) 0:? 'patchOut' ( patch out 4-component vector of float) -0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:? 'badp1' ( smooth patch in 4-component vector of float) 0:? 'badp2' ( flat patch in 4-component vector of float) 0:? 'badp3' ( noperspective patch in 4-component vector of float) @@ -620,7 +619,7 @@ ERROR: node is still EOpNull! 0:8 Function Definition: main( ( global void) 0:8 Function Parameters: 0:? Linker Objects -0:? 'gl_out' ( out implicitly-sized array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' ( out unsized 1-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' ( global 1-element array of int) 0:? 'patchOut' ( patch out 4-component vector of float) @@ -646,8 +645,8 @@ ERROR: node is still EOpNull! 0:17 move second child to first child ( temp 4-component vector of float) 0:17 'p' ( temp 4-component vector of float) 0:17 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:17 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:17 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:17 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:17 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:17 Constant: 0:17 1 (const int) 0:17 Constant: @@ -656,8 +655,8 @@ ERROR: node is still EOpNull! 0:18 move second child to first child ( temp float) 0:18 'ps' ( temp float) 0:18 gl_PointSize: direct index for structure ( in float PointSize) -0:18 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:18 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:18 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:18 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:18 Constant: 0:18 1 (const int) 0:18 Constant: @@ -666,9 +665,9 @@ ERROR: node is still EOpNull! 0:19 move second child to first child ( temp float) 0:19 'cd' ( temp float) 0:19 direct index ( temp float ClipDistance) -0:19 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:19 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:19 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:19 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:19 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:19 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:19 Constant: 0:19 1 (const int) 0:19 Constant: @@ -883,7 +882,7 @@ ERROR: node is still EOpNull! 0:? 'b3' ( global 2-element array of 4-component vector of float) 0:? 'b4' ( global 2-element array of 4-component vector of float) 0:? 'c3' ( global 4X2 matrix of float) -0:? 'd2' ( global implicitly-sized array of structure{ global float s, global float t}) +0:? 'd2' ( global unsized 1-element array of structure{ global float s, global float t}) 0:? 'b5' ( global 5-element array of float) 0:? 'single1' ( global structure{ global int f}) 0:? 'single2' ( global structure{ global 2-component vector of uint v}) @@ -942,8 +941,6 @@ ERROR: Linking tessellation control stage: Multiple function bodies in multiple main( ERROR: Linking tessellation control stage: Multiple function bodies in multiple compilation units for the same signature in the same stage: main( -ERROR: Linking tessellation control stage: Types must match: - gl_out: " out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}" versus " out implicitly-sized array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}" ERROR: Linking tessellation control stage: Types must match: outa: " global 4-element array of int" versus " global 1-element array of int" ERROR: Linking tessellation control stage: can't handle multiple entry points per stage @@ -956,7 +953,7 @@ ERROR: Linking tessellation control stage: Multiple function bodies in multiple ERROR: Linking tessellation control stage: Multiple function bodies in multiple compilation units for the same signature in the same stage: main( ERROR: Linking tessellation control stage: Types must match: - gl_out: " out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}" versus " out 3-element array of block{ out 4-component vector of float Position gl_Position}" + gl_out: " out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}" versus " out 3-element array of block{ out 4-component vector of float Position gl_Position}" Linked tessellation evaluation stage: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.vert.out index 61a558a02c1..504160d5786 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/150.vert.out @@ -11,20 +11,20 @@ ERROR: node is still EOpNull! 0:15 Sequence 0:15 move second child to first child ( temp 4-component vector of float) 0:15 gl_Position: direct index for structure ( invariant gl_Position 4-component vector of float Position) -0:15 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:15 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:15 Constant: 0:15 0 (const uint) 0:15 'iv4' ( in 4-component vector of float) 0:16 move second child to first child ( temp float) 0:16 gl_PointSize: direct index for structure ( gl_PointSize float PointSize) -0:16 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:16 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:16 Constant: 0:16 1 (const uint) 0:16 'ps' ( uniform float) 0:17 move second child to first child ( temp float) 0:17 direct index ( temp float ClipDistance) 0:17 gl_ClipDistance: direct index for structure ( out 4-element array of float ClipDistance) -0:17 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:17 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:17 Constant: 0:17 2 (const uint) 0:17 Constant: @@ -35,14 +35,14 @@ ERROR: node is still EOpNull! 0:17 0 (const int) 0:18 move second child to first child ( temp 4-component vector of float) 0:18 gl_ClipVertex: direct index for structure ( gl_ClipVertex 4-component vector of float ClipVertex) -0:18 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:18 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 4-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:18 Constant: 0:18 3 (const uint) 0:18 'iv4' ( in 4-component vector of float) 0:? Linker Objects 0:? 'iv4' ( in 4-component vector of float) 0:? 'ps' ( uniform float) -0:? 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of int a}) +0:? 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform unsized 1-element array of int a}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.frag.out index 63abec1a562..ee1b8a55a90 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.frag.out @@ -1,7 +1,7 @@ 300.frag ERROR: 0:2: 'float' : type requires declaration of default precision qualifier ERROR: 0:30: 'noperspective' : Reserved word. -ERROR: 0:30: 'noperspective' : not supported with this profile: es +ERROR: 0:30: 'noperspective' : not supported for this version or the enabled extensions ERROR: 0:31: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: bads ERROR: 0:32: 'uint' : cannot apply precision statement to this type; use 'float', 'int' or a sampler type ERROR: 0:39: 'structure' : must be qualified as flat in @@ -26,6 +26,7 @@ ERROR: 0:101: 'arrays of arrays' : not supported for this version or the enabled ERROR: 0:102: 'arrays of arrays' : not supported for this version or the enabled extensions ERROR: 0:102: 'arrays of arrays' : not supported for this version or the enabled extensions ERROR: 0:103: 'arrays of arrays' : not supported for this version or the enabled extensions +ERROR: 0:103: 'arrays of arrays' : not supported for this version or the enabled extensions ERROR: 0:100: 'arrays of arrays' : not supported for this version or the enabled extensions ERROR: 0:100: 'array-of-array of block' : not supported with this profile: es ERROR: 0:111: 'variable indexing fragment shader output array' : not supported with this profile: es @@ -44,7 +45,7 @@ ERROR: 0:157: 'invariant' : can only apply to an output ERROR: 0:158: 'invariant' : can only apply to an output ERROR: 0:160: 'imageBuffer' : Reserved word. ERROR: 0:160: '' : syntax error, unexpected IMAGEBUFFER, expecting COMMA or SEMICOLON -ERROR: 45 compilation errors. No code generated. +ERROR: 46 compilation errors. No code generated. Shader version: 300 @@ -392,7 +393,7 @@ ERROR: node is still EOpNull! 0:? 'sc' ( out lowp 3-component vector of float) 0:? 'sf' ( out lowp float) 0:? 'arrayedSampler' ( uniform 5-element array of lowp sampler2D) -0:? 'multiInst' (layout( column_major shared) uniform 2-element array of 3-element array of block{layout( column_major shared) uniform 2-element array of mediump int a, layout( column_major shared) uniform 2-element array of 3-element array of mediump int b, layout( column_major shared) uniform 2-element array of 3-element array of mediump int c}) +0:? 'multiInst' (layout( column_major shared) uniform 2-element array of 3-element array of block{layout( column_major shared) uniform 3-element array of 2-element array of mediump int a, layout( column_major shared) uniform 2-element array of 3-element array of mediump int b, layout( column_major shared) uniform 2-element array of 3-element array of mediump int c}) 0:? 'colors' ( out 4-element array of lowp 4-component vector of float) 0:? 'st1' ( uniform structure{ global mediump int i, global lowp sampler2D s}) 0:? 'st2' ( uniform structure{ global mediump int i, global lowp sampler2D s}) @@ -623,7 +624,7 @@ ERROR: node is still EOpNull! 0:? 'sc' ( out lowp 3-component vector of float) 0:? 'sf' ( out lowp float) 0:? 'arrayedSampler' ( uniform 5-element array of lowp sampler2D) -0:? 'multiInst' (layout( column_major shared) uniform 2-element array of 3-element array of block{layout( column_major shared) uniform 2-element array of mediump int a, layout( column_major shared) uniform 2-element array of 3-element array of mediump int b, layout( column_major shared) uniform 2-element array of 3-element array of mediump int c}) +0:? 'multiInst' (layout( column_major shared) uniform 2-element array of 3-element array of block{layout( column_major shared) uniform 3-element array of 2-element array of mediump int a, layout( column_major shared) uniform 2-element array of 3-element array of mediump int b, layout( column_major shared) uniform 2-element array of 3-element array of mediump int c}) 0:? 'colors' ( out 4-element array of lowp 4-component vector of float) 0:? 'st1' ( uniform structure{ global mediump int i, global lowp sampler2D s}) 0:? 'st2' ( uniform structure{ global mediump int i, global lowp sampler2D s}) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.vert.out index 507ad73b1e9..d8c9e16b227 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/300.vert.out @@ -39,7 +39,7 @@ ERROR: 0:168: 'Binst' : cannot add storage, auxiliary, memory, interpolation, la ERROR: 0:169: 'Bblock' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable ERROR: 0:170: 'Bfoo' : cannot add storage, auxiliary, memory, interpolation, layout, or precision qualifier to an existing variable ERROR: 0:172: 'std430' : not supported for this version or the enabled extensions -ERROR: 0:172: 'std430' : requires the 'buffer' storage qualifier +ERROR: 0:172: 'std430 requires the buffer storage qualifier' : required extension not requested: GL_EXT_scalar_block_layout ERROR: 0:175: '' : array size required ERROR: 0:185: 'assign' : cannot convert from ' temp 4-element array of highp float' to ' temp 3-element array of highp float' ERROR: 0:186: 'assign' : cannot convert from ' temp 3-element array of highp float' to ' temp 4-element array of highp float' @@ -320,9 +320,9 @@ ERROR: node is still EOpNull! 0:? 'rep2' ( centroid smooth sample out highp 4-component vector of float) 0:? 'rep3' ( in highp 4-component vector of float) 0:? 's' ( smooth out structure{ global highp 3-component vector of float c, global highp float f}) -0:? 'badsize' ( global implicitly-sized array of highp float) -0:? 'badsize2' ( global implicitly-sized array of highp float) -0:? 'ubInst' (layout( column_major shared) uniform implicitly-sized array of block{layout( column_major shared) uniform implicitly-sized array of highp int a}) +0:? 'badsize' ( global unsized 1-element array of highp float) +0:? 'badsize2' ( global unsized 1-element array of highp float) +0:? 'ubInst' (layout( column_major shared) uniform unsized 1-element array of block{layout( column_major shared) uniform unsized 1-element array of highp int a}) 0:? 'okayA' ( global 2-element array of highp float) 0:? 'newV' ( invariant smooth out highp 3-component vector of float) 0:? 'invIn' ( invariant in highp 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.comp.out index f2d48efd817..5a926f67fe2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.comp.out @@ -40,7 +40,6 @@ ERROR: 0:119: 'r8ui' : does not apply to signed integer images ERROR: 0:128: 'atomic_uint' : samplers and atomic_uints cannot be output parameters ERROR: 0:130: 'return' : type does not match, or is not convertible to, the function's return type ERROR: 0:136: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter -ERROR: 0:136: 'atomic_uint' : layout(binding=X) is required ERROR: 0:141: 'atomic_uint' : atomic counters can only be highp ERROR: 0:141: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings ERROR: 0:143: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings @@ -84,7 +83,7 @@ WARNING: 0:238: '#define' : names containing consecutive underscores are reserve ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier -ERROR: 83 compilation errors. No code generated. +ERROR: 82 compilation errors. No code generated. Shader version: 310 @@ -103,13 +102,13 @@ ERROR: node is still EOpNull! 0:35 GroupMemoryBarrier ( global void) 0:36 move second child to first child ( temp highp int) 0:36 value: direct index for structure (layout( column_major shared) buffer highp int) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer runtime-sized array of highp float values}) 0:36 Constant: 0:36 0 (const uint) 0:36 Convert float to int ( temp highp int) 0:36 indirect index (layout( column_major shared) temp highp float) -0:36 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:36 values: direct index for structure (layout( column_major shared) buffer runtime-sized array of highp float) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer runtime-sized array of highp float values}) 0:36 Constant: 0:36 1 (const uint) 0:36 'gl_LocalInvocationIndex' ( in highp uint LocalInvocationIndex) @@ -118,8 +117,8 @@ ERROR: node is still EOpNull! 0:61 Sequence 0:61 move second child to first child ( temp highp float) 0:61 direct index (layout( column_major shared) temp highp float) -0:61 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:61 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:61 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:61 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:61 Constant: 0:61 1 (const int) 0:61 Constant: @@ -127,8 +126,8 @@ ERROR: node is still EOpNull! 0:61 Constant: 0:61 4.700000 0:62 array length ( temp int) -0:62 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:62 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:62 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:62 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:62 Constant: 0:62 1 (const int) 0:63 Pre-Increment ( temp highp 4-component vector of float) @@ -281,8 +280,8 @@ ERROR: node is still EOpNull! 0:194 move second child to first child ( temp highp float) 0:194 'g' ( temp highp float) 0:194 direct index (layout( column_major shared) temp highp float) -0:194 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:194 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:194 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:194 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:194 Constant: 0:194 1 (const int) 0:194 Constant: @@ -291,24 +290,24 @@ ERROR: node is still EOpNull! 0:195 move second child to first child ( temp highp float) 0:195 'f' ( temp highp float) 0:195 direct index (layout( column_major shared) temp highp float) -0:195 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:195 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:195 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:195 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:195 Constant: 0:195 1 (const int) 0:195 Constant: 0:195 2 (const int) 0:196 Pre-Increment ( temp highp float) 0:196 direct index (layout( column_major shared) temp highp float) -0:196 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:196 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:196 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:196 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:196 Constant: 0:196 1 (const int) 0:196 Constant: 0:196 2 (const int) 0:197 Post-Decrement ( temp highp float) 0:197 direct index (layout( column_major shared) temp highp float) -0:197 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:197 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:197 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:197 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:197 Constant: 0:197 1 (const int) 0:197 Constant: @@ -316,16 +315,16 @@ ERROR: node is still EOpNull! 0:198 add ( temp highp float) 0:198 'f' ( temp highp float) 0:198 direct index (layout( column_major shared) temp highp float) -0:198 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:198 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:198 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:198 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:198 Constant: 0:198 1 (const int) 0:198 Constant: 0:198 2 (const int) 0:199 subtract ( temp highp float) 0:199 direct index (layout( column_major shared) temp highp float) -0:199 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:199 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:199 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:199 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:199 Constant: 0:199 1 (const int) 0:199 Constant: @@ -338,8 +337,8 @@ ERROR: node is still EOpNull! 0:201 'f' ( temp highp float) 0:201 false case 0:201 direct index (layout( column_major shared) temp highp float) -0:201 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:201 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:201 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:201 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:201 Constant: 0:201 1 (const int) 0:201 Constant: @@ -349,8 +348,8 @@ ERROR: node is still EOpNull! 0:202 'b' ( temp bool) 0:202 true case 0:202 direct index (layout( column_major shared) temp highp float) -0:202 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:202 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:202 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:202 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:202 Constant: 0:202 1 (const int) 0:202 Constant: @@ -362,8 +361,8 @@ ERROR: node is still EOpNull! 0:203 Compare Equal ( temp bool) 0:203 'f' ( temp highp float) 0:203 direct index (layout( column_major shared) temp highp float) -0:203 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:203 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:203 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:203 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:203 Constant: 0:203 1 (const int) 0:203 Constant: @@ -376,8 +375,8 @@ ERROR: node is still EOpNull! 0:205 Compare Greater Than or Equal ( temp bool) 0:205 'f' ( temp highp float) 0:205 direct index (layout( column_major shared) temp highp float) -0:205 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:205 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:205 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:205 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:205 Constant: 0:205 1 (const int) 0:205 Constant: @@ -390,8 +389,8 @@ ERROR: node is still EOpNull! 0:207 direct index ( temp highp float) 0:207 Construct vec3 ( temp highp 3-component vector of float) 0:207 direct index (layout( column_major shared) temp highp float) -0:207 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:207 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:207 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:207 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:207 Constant: 0:207 1 (const int) 0:207 Constant: @@ -400,13 +399,13 @@ ERROR: node is still EOpNull! 0:207 0 (const int) 0:208 Bitwise not ( temp highp int) 0:208 value: direct index for structure (layout( column_major shared) buffer highp int) -0:208 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:208 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:208 Constant: 0:208 0 (const int) 0:209 move second child to first child ( temp highp float) 0:209 direct index (layout( column_major shared) temp highp float) -0:209 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:209 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:209 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:209 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:209 Constant: 0:209 1 (const int) 0:209 Constant: @@ -419,21 +418,21 @@ ERROR: node is still EOpNull! 0:221 move second child to first child ( temp highp float) 0:221 'g' ( temp highp float) 0:221 direct index (layout( column_major shared) temp highp float) -0:221 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:221 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:221 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:221 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:221 Constant: 0:221 1 (const int) 0:221 Constant: 0:221 2 (const int) 0:222 Bitwise not ( temp highp int) 0:222 value: direct index for structure (layout( column_major shared) buffer highp int) -0:222 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:222 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:222 Constant: 0:222 0 (const int) 0:223 move second child to first child ( temp highp float) 0:223 direct index (layout( column_major shared) temp highp float) -0:223 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:223 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:223 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of highp float) +0:223 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:223 Constant: 0:223 1 (const int) 0:223 Constant: @@ -442,7 +441,7 @@ ERROR: node is still EOpNull! 0:223 3.400000 0:224 move second child to first child ( temp highp int) 0:224 value: direct index for structure (layout( column_major shared) buffer highp int) -0:224 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:224 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:224 Constant: 0:224 0 (const int) 0:224 Constant: @@ -464,8 +463,8 @@ ERROR: node is still EOpNull! 0:? 4096 (const uint) 0:? 'total' ( const highp int) 0:? 66592 (const int) -0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) -0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer implicitly-sized array of highp float values, layout( column_major shared) buffer highp int value}) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer runtime-sized array of highp float values}) +0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 1-element array of highp float values, layout( column_major shared) buffer highp int value}) 0:? 'v3' (layout( location=2) in highp 3-component vector of float) 0:? 'f' ( in highp float) 0:? 'fo' ( out highp float) @@ -475,7 +474,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of highp int) 0:? 'arrY' ( global 1-element array of highp int) 0:? 'arrZ' ( global 4096-element array of highp int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:? 'v' ( buffer highp 4-component vector of float) 0:? 'us2dbad' ( uniform mediump usampler2D) 0:? 'us2d' ( uniform highp usampler2D) @@ -514,8 +513,8 @@ ERROR: node is still EOpNull! 0:? 'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D) 0:? 'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D) 0:? 'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D) -0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) -0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer implicitly-sized array of highp float values}) +0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values}) 0:? 'inbi' ( in block{ in highp int a}) 0:? 'outbi' ( out block{ out highp int a}) 0:? 't__' ( global highp float) @@ -541,13 +540,13 @@ ERROR: node is still EOpNull! 0:35 GroupMemoryBarrier ( global void) 0:36 move second child to first child ( temp highp int) 0:36 value: direct index for structure (layout( column_major shared) buffer highp int) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer runtime-sized array of highp float values}) 0:36 Constant: 0:36 0 (const uint) 0:36 Convert float to int ( temp highp int) 0:36 indirect index (layout( column_major shared) temp highp float) -0:36 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp float) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:36 values: direct index for structure (layout( column_major shared) buffer runtime-sized array of highp float) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer runtime-sized array of highp float values}) 0:36 Constant: 0:36 1 (const uint) 0:36 'gl_LocalInvocationIndex' ( in highp uint LocalInvocationIndex) @@ -558,8 +557,8 @@ ERROR: node is still EOpNull! 0:? 4096 (const uint) 0:? 'total' ( const highp int) 0:? 66592 (const int) -0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) -0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer implicitly-sized array of highp float values, layout( column_major shared) buffer highp int value}) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer runtime-sized array of highp float values}) +0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer 1-element array of highp float values, layout( column_major shared) buffer highp int value}) 0:? 'v3' (layout( location=2) in highp 3-component vector of float) 0:? 'f' ( in highp float) 0:? 'fo' ( out highp float) @@ -569,7 +568,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of highp int) 0:? 'arrY' ( global 1-element array of highp int) 0:? 'arrZ' ( global 4096-element array of highp int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) 0:? 'v' ( buffer highp 4-component vector of float) 0:? 'us2dbad' ( uniform mediump usampler2D) 0:? 'us2d' ( uniform highp usampler2D) @@ -608,8 +607,8 @@ ERROR: node is still EOpNull! 0:? 'badQ1' (layout( rgba32f) coherent volatile restrict uniform highp image2D) 0:? 'badQ2' (layout( rgba8i) coherent volatile restrict uniform highp iimage2D) 0:? 'badQ3' (layout( rgba16ui) coherent volatile restrict uniform highp uimage2D) -0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer implicitly-sized array of highp float values}) -0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer implicitly-sized array of highp float values}) +0:? 'wo' (layout( column_major shared) writeonly buffer block{layout( column_major shared) buffer highp int value, layout( column_major shared) buffer unsized 3-element array of highp float values}) +0:? 'multio' (layout( column_major shared) buffer block{layout( column_major shared) readonly buffer highp int value, layout( column_major shared) writeonly buffer unsized 1-element array of highp float values}) 0:? 'inbi' ( in block{ in highp int a}) 0:? 'outbi' ( out block{ out highp int a}) 0:? 't__' ( global highp float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.frag.out index 81075561323..6763c0a1e75 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.frag.out @@ -105,7 +105,7 @@ ERROR: 0:346: 'centroid/sample/patch' : can't use auxiliary qualifier on a fragm ERROR: 0:347: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output ERROR: 0:348: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output ERROR: 0:349: 'noperspective' : Reserved word. -ERROR: 0:349: 'noperspective' : not supported with this profile: es +ERROR: 0:349: 'noperspective' : not supported for this version or the enabled extensions ERROR: 0:349: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output ERROR: 0:355: 'interpolateAtCentroid' : required extension not requested: GL_OES_shader_multisample_interpolation ERROR: 0:356: 'interpolateAtSample' : required extension not requested: GL_OES_shader_multisample_interpolation @@ -569,12 +569,12 @@ ERROR: node is still EOpNull! 0:259 move second child to first child ( temp highp int) 0:259 'a3' ( temp highp int) 0:259 direct index ( flat temp highp int SampleMaskIn) -0:259 'gl_SampleMaskIn' ( flat in implicitly-sized array of highp int SampleMaskIn) +0:259 'gl_SampleMaskIn' ( flat in unsized 1-element array of highp int SampleMaskIn) 0:259 Constant: 0:259 0 (const int) 0:260 move second child to first child ( temp highp int) 0:260 direct index ( temp highp int SampleMaskIn) -0:260 'gl_SampleMask' ( out implicitly-sized array of highp int SampleMaskIn) +0:260 'gl_SampleMask' ( out unsized 1-element array of highp int SampleMaskIn) 0:260 Constant: 0:260 0 (const int) 0:260 'a3' ( temp highp int) @@ -597,12 +597,12 @@ ERROR: node is still EOpNull! 0:272 move second child to first child ( temp highp int) 0:272 'a3' ( temp highp int) 0:272 direct index ( flat temp highp int SampleMaskIn) -0:272 'gl_SampleMaskIn' ( flat in implicitly-sized array of highp int SampleMaskIn) +0:272 'gl_SampleMaskIn' ( flat in unsized 1-element array of highp int SampleMaskIn) 0:272 Constant: 0:272 0 (const int) 0:273 move second child to first child ( temp highp int) 0:273 direct index ( temp highp int SampleMaskIn) -0:273 'gl_SampleMask' ( out implicitly-sized array of highp int SampleMaskIn) +0:273 'gl_SampleMask' ( out unsized 1-element array of highp int SampleMaskIn) 0:273 Constant: 0:273 0 (const int) 0:273 'a3' ( temp highp int) @@ -1001,8 +1001,8 @@ ERROR: node is still EOpNull! 0:? 'CA5' ( uniform highp samplerCubeArrayShadow) 0:? 'CA6' ( uniform highp isamplerCubeArray) 0:? 'CA7' ( uniform highp usamplerCubeArray) -0:? 'gl_SampleMaskIn' ( flat in implicitly-sized array of highp int SampleMaskIn) -0:? 'gl_SampleMask' ( out implicitly-sized array of highp int SampleMaskIn) +0:? 'gl_SampleMaskIn' ( flat in unsized 1-element array of highp int SampleMaskIn) +0:? 'gl_SampleMask' ( out unsized 1-element array of highp int SampleMaskIn) 0:? 'im2Df' (layout( r32f) uniform highp image2D) 0:? 'im2Du' (layout( r32ui) uniform highp uimage2D) 0:? 'im2Di' (layout( r32i) uniform highp iimage2D) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tesc.out index 01d7ecfb49a..433a7dc15de 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tesc.out @@ -70,8 +70,8 @@ ERROR: node is still EOpNull! 0:25 move second child to first child ( temp highp 4-component vector of float) 0:25 'p' ( temp highp 4-component vector of float) 0:25 gl_Position: direct index for structure ( in highp 4-component vector of float Position) -0:25 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:25 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:25 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:25 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:25 Constant: 0:25 1 (const int) 0:25 Constant: @@ -80,8 +80,8 @@ ERROR: node is still EOpNull! 0:26 move second child to first child ( temp highp float) 0:26 'ps' ( temp highp float) 0:26 gl_PointSize: direct index for structure ( in highp float PointSize) -0:26 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:26 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:26 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:26 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:26 Constant: 0:26 1 (const int) 0:26 Constant: @@ -209,8 +209,8 @@ ERROR: node is still EOpNull! 0:114 move second child to first child ( temp highp float) 0:114 'ps' ( temp highp float) 0:114 gl_PointSize: direct index for structure ( in highp float PointSize) -0:114 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:114 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:114 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:114 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:114 Constant: 0:114 1 (const int) 0:114 Constant: @@ -357,7 +357,7 @@ ERROR: node is still EOpNull! 0:? 'inb' ( in 32-element array of highp 2-component vector of float) 0:? 'inc' ( in 32-element array of highp 2-component vector of float) 0:? 'ind' ( in 32-element array of highp 2-component vector of float) -0:? 'implA' ( patch out implicitly-sized array of highp float) +0:? 'implA' ( patch out unsized 1-element array of highp float) 0:? 'ivla' (layout( location=3) in 32-element array of highp 4-component vector of float) 0:? 'ivlb' (layout( location=4) in 32-element array of highp 4-component vector of float) 0:? 'ivlc' (layout( location=4) in 32-element array of highp 4-component vector of float) @@ -372,7 +372,7 @@ ERROR: node is still EOpNull! 0:? 'misSized' ( out 5-element array of highp float) 0:? 'okaySize' ( out 4-element array of highp float) 0:? 'pv3' ( noContraction temp highp 3-component vector of float) -0:? 'badpatchIName' ( patch out implicitly-sized array of block{ out highp float f}) +0:? 'badpatchIName' ( patch out unsized 1-element array of block{ out highp float f}) 0:? 'patchIName' ( patch out 4-element array of block{ out highp float f}) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tese.out index 52d19b4fdf6..9c7c679daf2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.tese.out @@ -21,11 +21,10 @@ ERROR: 0:48: 'assign' : l-value required (can't modify a const) ERROR: 0:51: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:52: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:53: 'noperspective' : Reserved word. -ERROR: 0:53: 'noperspective' : not supported with this profile: es +ERROR: 0:53: 'noperspective' : not supported for this version or the enabled extensions ERROR: 0:53: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:54: 'sample' : Reserved word. ERROR: 0:54: '' : can only have one auxiliary qualifier (centroid, patch, and sample) -ERROR: 0:58: 'gl_PerVertex' : block already declared with size, can't redeclare as implicitly-sized ERROR: 0:63: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use ERROR: 0:68: 'quads' : cannot apply to 'out' ERROR: 0:68: 'cw' : can only apply to 'in' @@ -47,7 +46,7 @@ ERROR: 0:113: 'sample' : Reserved word. ERROR: 0:119: 'gl_PointSize' : no such field in structure ERROR: 0:119: '=' : cannot convert from ' temp block{ in highp 4-component vector of float Position gl_Position}' to ' temp highp float' ERROR: 0:127: 'gl_BoundingBoxOES' : undeclared identifier -ERROR: 44 compilation errors. No code generated. +ERROR: 43 compilation errors. No code generated. Shader version: 310 @@ -77,8 +76,8 @@ ERROR: node is still EOpNull! 0:36 move second child to first child ( temp highp 4-component vector of float) 0:36 'p' ( temp highp 4-component vector of float) 0:36 gl_Position: direct index for structure ( in highp 4-component vector of float Position) -0:36 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:36 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:36 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:36 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:36 Constant: 0:36 1 (const int) 0:36 Constant: @@ -87,8 +86,8 @@ ERROR: node is still EOpNull! 0:37 move second child to first child ( temp highp float) 0:37 'ps' ( temp highp float) 0:37 gl_PointSize: direct index for structure ( in highp float PointSize) -0:37 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:37 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:37 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:37 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:37 Constant: 0:37 1 (const int) 0:37 Constant: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.vert.out index 21fa27b90fc..baf0987082c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310.vert.out @@ -15,7 +15,7 @@ ERROR: 0:78: 'vertex-shader array-of-struct output' : not supported with this pr ERROR: 0:79: 'vertex-shader array-of-struct output' : not supported with this profile: es ERROR: 0:81: 'vertex-shader struct output containing an array' : not supported with this profile: es ERROR: 0:83: 'vertex-shader struct output containing structure' : not supported with this profile: es -ERROR: 0:85: 'std430' : requires the 'buffer' storage qualifier +ERROR: 0:85: 'std430 requires the buffer storage qualifier' : required extension not requested: GL_EXT_scalar_block_layout ERROR: 0:97: 's' : member of block cannot be or contain a sampler, image, or atomic_uint type ERROR: 0:105: 'location' : overlapping use of location 12 ERROR: 0:107: 'input block' : not supported in this stage: vertex diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310AofA.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310AofA.vert.out index 70b5968c9d0..451cc0b4586 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310AofA.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310AofA.vert.out @@ -7,12 +7,12 @@ ERROR: 0:48: 'constructor' : constructing non-array constituent from array argum ERROR: 0:49: 'constructor' : array constructor argument not correct type to construct array element ERROR: 0:62: '[' : array index out of range '4' ERROR: 0:78: 'assign' : cannot convert from ' global 4-element array of 7-element array of highp float' to ' global 5-element array of 7-element array of highp float' -ERROR: 0:79: 'assign' : cannot convert from ' global 4-element array of 7-element array of highp float' to ' global implicitly-sized array of 7-element array of highp float' +ERROR: 0:79: 'assign' : cannot convert from ' global 4-element array of 7-element array of highp float' to ' global unsized 1-element array of 7-element array of highp float' ERROR: 0:81: 'foo' : no matching overloaded function found ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' global 4-element array of 7-element array of highp float' and a right operand of type ' global 5-element array of 7-element array of highp float' (or there is no acceptable conversion) ERROR: 0:90: '[' : array index out of range '5' ERROR: 0:94: '[' : index out of range '-1' -ERROR: 0:96: 'assign' : cannot convert from ' temp 3-element array of highp 4-component vector of float' to 'layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float' +ERROR: 0:96: 'assign' : cannot convert from ' temp 3-element array of highp 4-component vector of float' to 'layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float' ERROR: 0:103: '' : array size required ERROR: 0:104: '' : array size required ERROR: 0:105: '' : array size required @@ -245,7 +245,7 @@ ERROR: node is still EOpNull! 0:77 Function Call: foo(f1[5][7]; ( global 4-element array of 7-element array of highp float) 0:77 'g5' ( global 5-element array of 7-element array of highp float) 0:78 'g5' ( global 5-element array of 7-element array of highp float) -0:79 'gu' ( global implicitly-sized array of 7-element array of highp float) +0:79 'gu' ( global unsized 1-element array of 7-element array of highp float) 0:81 Constant: 0:81 0.000000 0:82 Function Call: bar(f1[5][7]; ( global void) @@ -275,9 +275,9 @@ ERROR: node is still EOpNull! 0:91 Function Call: foo(f1[5][7]; ( global 4-element array of 7-element array of highp float) 0:91 'u' ( temp 5-element array of 7-element array of highp float) 0:94 direct index (layout( column_major shared) temp highp 4-component vector of float) -0:94 v: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float) -0:94 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) -0:94 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) +0:94 v: direct index for structure (layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float) +0:94 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) +0:94 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) 0:94 Constant: 0:94 1 (const int) 0:94 Constant: @@ -286,9 +286,9 @@ ERROR: node is still EOpNull! 0:94 -1 (const int) 0:95 move second child to first child ( temp highp 4-component vector of float) 0:95 direct index (layout( column_major shared) temp highp 4-component vector of float) -0:95 v: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float) -0:95 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) -0:95 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) +0:95 v: direct index for structure (layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float) +0:95 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) +0:95 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) 0:95 Constant: 0:95 1 (const int) 0:95 Constant: @@ -300,9 +300,9 @@ ERROR: node is still EOpNull! 0:95 4.300000 0:95 4.300000 0:95 4.300000 -0:96 v: direct index for structure (layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float) -0:96 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) -0:96 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) +0:96 v: direct index for structure (layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float) +0:96 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) +0:96 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) 0:96 Constant: 0:96 1 (const int) 0:96 Constant: @@ -310,20 +310,39 @@ ERROR: node is still EOpNull! 0:98 Constant: 0:98 7 (const int) 0:99 array length ( temp int) -0:99 v: direct index for structure (layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float) -0:99 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float v}) -0:99 'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float v}) +0:99 v: direct index for structure (layout( column_major shared) buffer unsized 2-element array of 7-element array of highp 4-component vector of float) +0:99 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer unsized 2-element array of 7-element array of highp 4-component vector of float v}) +0:99 'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer unsized 2-element array of 7-element array of highp 4-component vector of float v}) 0:99 Constant: 0:99 0 (const int) 0:99 Constant: 0:99 1 (const int) +0:117 Function Definition: func(mf33[3][2]; ( global highp 3-component vector of float) +0:117 Function Parameters: +0:117 'x' ( in 3-element array of 2-element array of highp 3X3 matrix of float) +0:119 Sequence +0:119 Sequence +0:119 move second child to first child ( temp highp 3X3 matrix of float) +0:119 'a0' ( temp highp 3X3 matrix of float) +0:119 direct index ( temp highp 3X3 matrix of float) +0:119 direct index ( temp 2-element array of highp 3X3 matrix of float) +0:119 'x' ( in 3-element array of 2-element array of highp 3X3 matrix of float) +0:119 Constant: +0:119 2 (const int) +0:119 Constant: +0:119 1 (const int) +0:120 Branch: Return with expression +0:120 direct index ( temp highp 3-component vector of float) +0:120 'a0' ( temp highp 3X3 matrix of float) +0:120 Constant: +0:120 2 (const int) 0:? Linker Objects -0:? 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) -0:? 'uname' (layout( column_major shared) uniform 3-element array of block{layout( column_major shared) uniform highp float u, layout( column_major shared) uniform implicitly-sized array of highp 4-component vector of float v}) -0:? 'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 1-element array of highp 4-component vector of float v}) -0:? 'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float v}) +0:? 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer unsized 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) +0:? 'uname' (layout( column_major shared) uniform 3-element array of block{layout( column_major shared) uniform highp float u, layout( column_major shared) uniform unsized 1-element array of highp 4-component vector of float v}) +0:? 'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer unsized 1-element array of 1-element array of highp 4-component vector of float v}) +0:? 'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer unsized 2-element array of 7-element array of highp 4-component vector of float v}) 0:? 'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of highp float) -0:? 'gu' ( global implicitly-sized array of 7-element array of highp float) +0:? 'gu' ( global unsized 1-element array of 7-element array of highp float) 0:? 'g4' ( global 4-element array of 7-element array of highp float) 0:? 'g5' ( global 5-element array of 7-element array of highp float) 0:? 'inArray' ( in 2-element array of 3-element array of highp float) @@ -359,10 +378,10 @@ ERROR: node is still EOpNull! 0:13 2 (const uint) 0:13 'd' ( temp 3-element array of 2-element array of highp int) 0:? Linker Objects -0:? 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer implicitly-sized array of highp float u, layout( column_major shared) buffer implicitly-sized array of highp 4-component vector of float v}) +0:? 'name' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer 1-element array of highp float u, layout( column_major shared) buffer unsized 2-element array of highp 4-component vector of float v}) 0:? 'uname' (layout( column_major shared) uniform 3-element array of block{layout( column_major shared) uniform highp float u, layout( column_major shared) uniform 1-element array of highp 4-component vector of float v}) -0:? 'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 1-element array of highp 4-component vector of float v}) -0:? 'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer implicitly-sized array of 7-element array of highp 4-component vector of float v}) +0:? 'name2' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer unsized 1-element array of 1-element array of highp 4-component vector of float v}) +0:? 'name3' (layout( column_major shared) buffer 3-element array of block{layout( column_major shared) buffer highp float u, layout( column_major shared) buffer unsized 2-element array of 7-element array of highp 4-component vector of float v}) 0:? 'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of highp float) 0:? 'gu' ( global 1-element array of 7-element array of highp float) 0:? 'g4' ( global 4-element array of 7-element array of highp float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310implicitSizeArrayError.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310implicitSizeArrayError.vert.out index 1eed457dbae..6975cde2309 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310implicitSizeArrayError.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310implicitSizeArrayError.vert.out @@ -11,14 +11,14 @@ ERROR: node is still EOpNull! 0:7 move second child to first child ( temp highp int) 0:7 'o' (layout( location=0) smooth out highp int) 0:7 direct index (layout( column_major shared) temp highp int) -0:7 a: direct index for structure (layout( column_major shared) uniform implicitly-sized array of highp int) -0:7 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of highp int a}) +0:7 a: direct index for structure (layout( column_major shared) uniform unsized 3-element array of highp int) +0:7 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform unsized 3-element array of highp int a}) 0:7 Constant: 0:7 0 (const int) 0:7 Constant: 0:7 2 (const int) 0:? Linker Objects -0:? 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform implicitly-sized array of highp int a}) +0:? 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform unsized 3-element array of highp int a}) 0:? 'o' (layout( location=0) smooth out highp int) 0:? 'gl_VertexID' ( gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) @@ -35,14 +35,14 @@ ERROR: node is still EOpNull! 0:7 move second child to first child ( temp highp int) 0:7 'o' (layout( location=0) smooth out highp int) 0:7 direct index (layout( column_major shared) temp highp int) -0:7 a: direct index for structure (layout( column_major shared) uniform 1-element array of highp int) -0:7 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform 1-element array of highp int a}) +0:7 a: direct index for structure (layout( column_major shared) uniform 3-element array of highp int) +0:7 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform 3-element array of highp int a}) 0:7 Constant: 0:7 0 (const int) 0:7 Constant: 0:7 2 (const int) 0:? Linker Objects -0:? 'uni' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform 1-element array of highp int a}) +0:? 'uni' (layout( binding=0 column_major shared) uniform block{layout( column_major shared) uniform 3-element array of highp int a}) 0:? 'o' (layout( location=0) smooth out highp int) 0:? 'gl_VertexID' ( gl_VertexId highp int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310runtimeArray.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310runtimeArray.vert.out new file mode 100644 index 00000000000..84c731edbcc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/310runtimeArray.vert.out @@ -0,0 +1,145 @@ +310runtimeArray.vert +ERROR: 0:9: '' : array size required +ERROR: 1 compilation errors. No code generated. + + +Shader version: 310 +ERROR: node is still EOpNull! +0:12 Function Definition: main( ( global void) +0:12 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp highp float) +0:14 'o' (layout( location=0) smooth out highp float) +0:14 f: direct index for structure ( global highp float) +0:14 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:14 s: direct index for structure (layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f}) +0:14 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s}) +0:14 Constant: +0:14 0 (const uint) +0:14 Constant: +0:14 5 (const int) +0:14 Constant: +0:14 0 (const int) +0:15 add second child into first child ( temp highp float) +0:15 'o' (layout( location=0) smooth out highp float) +0:15 f: direct index for structure ( global highp float) +0:15 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:15 s: direct index for structure (layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f}) +0:15 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s}) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 6 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 add second child into first child ( temp highp float) +0:16 'o' (layout( location=0) smooth out highp float) +0:16 f: direct index for structure ( global highp float) +0:16 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:16 s: direct index for structure (layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f}) +0:16 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s}) +0:16 'b3name' (layout( column_major shared) buffer unsized 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s}) +0:16 Constant: +0:16 3 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 7 (const int) +0:16 Constant: +0:16 0 (const int) +0:17 add second child into first child ( temp highp float) +0:17 'o' (layout( location=0) smooth out highp float) +0:17 f: direct index for structure ( global highp float) +0:17 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:17 s: direct index for structure (layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f}) +0:17 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s}) +0:17 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s}) +0:17 Constant: +0:17 2 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 8 (const int) +0:17 Constant: +0:17 0 (const int) +0:? Linker Objects +0:? 'o' (layout( location=0) smooth out highp float) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s}) +0:? 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s}) +0:? 'b3name' (layout( column_major shared) buffer unsized 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s}) +0:? 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s}) +0:? 'gl_VertexID' ( gl_VertexId highp int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) + + +Linked vertex stage: + + +Shader version: 310 +ERROR: node is still EOpNull! +0:12 Function Definition: main( ( global void) +0:12 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp highp float) +0:14 'o' (layout( location=0) smooth out highp float) +0:14 f: direct index for structure ( global highp float) +0:14 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:14 s: direct index for structure (layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f}) +0:14 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s}) +0:14 Constant: +0:14 0 (const uint) +0:14 Constant: +0:14 5 (const int) +0:14 Constant: +0:14 0 (const int) +0:15 add second child into first child ( temp highp float) +0:15 'o' (layout( location=0) smooth out highp float) +0:15 f: direct index for structure ( global highp float) +0:15 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:15 s: direct index for structure (layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f}) +0:15 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s}) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 6 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 add second child into first child ( temp highp float) +0:16 'o' (layout( location=0) smooth out highp float) +0:16 f: direct index for structure ( global highp float) +0:16 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:16 s: direct index for structure (layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f}) +0:16 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s}) +0:16 'b3name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s}) +0:16 Constant: +0:16 3 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 7 (const int) +0:16 Constant: +0:16 0 (const int) +0:17 add second child into first child ( temp highp float) +0:17 'o' (layout( location=0) smooth out highp float) +0:17 f: direct index for structure ( global highp float) +0:17 direct index (layout( column_major shared) temp structure{ global highp float f}) +0:17 s: direct index for structure (layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f}) +0:17 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s}) +0:17 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s}) +0:17 Constant: +0:17 2 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 8 (const int) +0:17 Constant: +0:17 0 (const int) +0:? Linker Objects +0:? 'o' (layout( location=0) smooth out highp float) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 6-element array of structure{ global highp float f} s}) +0:? 'b2name' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 7-element array of structure{ global highp float f} s}) +0:? 'b3name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 8-element array of structure{ global highp float f} s}) +0:? 'b4name' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer unsized 9-element array of structure{ global highp float f} s}) +0:? 'gl_VertexID' ( gl_VertexId highp int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId highp int InstanceId) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.frag.out index 76dbeaf8dc5..002aa7f67be 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.frag.out @@ -23,7 +23,7 @@ ERROR: 0:157: 'centroid/sample/patch' : can't use auxiliary qualifier on a fragm ERROR: 0:158: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output ERROR: 0:159: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output ERROR: 0:160: 'noperspective' : Reserved word. -ERROR: 0:160: 'noperspective' : not supported with this profile: es +ERROR: 0:160: 'noperspective' : not supported for this version or the enabled extensions ERROR: 0:160: 'flat/smooth/noperspective' : can't use interpolation qualifier on a fragment output ERROR: 0:165: 'centroid/sample/patch' : can't use auxiliary qualifier on a fragment output ERROR: 0:180: 'interpolateAtCentroid' : no matching overloaded function found @@ -211,12 +211,12 @@ ERROR: node is still EOpNull! 0:113 move second child to first child ( temp highp int) 0:113 'a3' ( temp highp int) 0:113 direct index ( flat temp highp int SampleMaskIn) -0:113 'gl_SampleMaskIn' ( flat in implicitly-sized array of highp int SampleMaskIn) +0:113 'gl_SampleMaskIn' ( flat in unsized 1-element array of highp int SampleMaskIn) 0:113 Constant: 0:113 0 (const int) 0:114 move second child to first child ( temp highp int) 0:114 direct index ( temp highp int SampleMaskIn) -0:114 'gl_SampleMask' ( out implicitly-sized array of highp int SampleMaskIn) +0:114 'gl_SampleMask' ( out unsized 1-element array of highp int SampleMaskIn) 0:114 Constant: 0:114 0 (const int) 0:114 'a3' ( temp highp int) @@ -473,8 +473,8 @@ ERROR: node is still EOpNull! 0:? 'CA5' ( uniform highp samplerCubeArrayShadow) 0:? 'CA6' ( uniform highp isamplerCubeArray) 0:? 'CA7' ( uniform highp usamplerCubeArray) -0:? 'gl_SampleMaskIn' ( flat in implicitly-sized array of highp int SampleMaskIn) -0:? 'gl_SampleMask' ( out implicitly-sized array of highp int SampleMaskIn) +0:? 'gl_SampleMaskIn' ( flat in unsized 1-element array of highp int SampleMaskIn) +0:? 'gl_SampleMask' ( out unsized 1-element array of highp int SampleMaskIn) 0:? 'im2Df' (layout( r32f) uniform highp image2D) 0:? 'im2Du' (layout( r32ui) uniform highp uimage2D) 0:? 'im2Di' (layout( r32i) uniform highp iimage2D) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tesc.out index ff8012b1f1d..41ee29c3304 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tesc.out @@ -62,8 +62,8 @@ ERROR: node is still EOpNull! 0:23 move second child to first child ( temp highp 4-component vector of float) 0:23 'p' ( temp highp 4-component vector of float) 0:23 gl_Position: direct index for structure ( in highp 4-component vector of float Position) -0:23 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:23 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:23 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:23 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -72,8 +72,8 @@ ERROR: node is still EOpNull! 0:24 move second child to first child ( temp highp float) 0:24 'ps' ( temp highp float) 0:24 gl_PointSize: direct index for structure ( in highp float PointSize) -0:24 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:24 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:24 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:24 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -192,8 +192,8 @@ ERROR: node is still EOpNull! 0:104 move second child to first child ( temp highp float) 0:104 'ps' ( temp highp float) 0:104 gl_PointSize: direct index for structure ( in highp float PointSize) -0:104 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:104 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:104 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:104 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:104 Constant: 0:104 1 (const int) 0:104 Constant: @@ -336,7 +336,7 @@ ERROR: node is still EOpNull! 0:? 'inb' ( in 32-element array of highp 2-component vector of float) 0:? 'inc' ( in 32-element array of highp 2-component vector of float) 0:? 'ind' ( in 32-element array of highp 2-component vector of float) -0:? 'implA' ( patch out implicitly-sized array of highp float) +0:? 'implA' ( patch out unsized 1-element array of highp float) 0:? 'ivla' (layout( location=3) in 32-element array of highp 4-component vector of float) 0:? 'ivlb' (layout( location=4) in 32-element array of highp 4-component vector of float) 0:? 'ivlc' (layout( location=4) in 32-element array of highp 4-component vector of float) @@ -351,7 +351,7 @@ ERROR: node is still EOpNull! 0:? 'misSized' ( out 5-element array of highp float) 0:? 'okaySize' ( out 4-element array of highp float) 0:? 'pv3' ( noContraction temp highp 3-component vector of float) -0:? 'badpatchIName' ( patch out implicitly-sized array of block{ out highp float f}) +0:? 'badpatchIName' ( patch out unsized 1-element array of block{ out highp float f}) 0:? 'patchIName' ( patch out 4-element array of block{ out highp float f}) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tese.out index ad8fe72e3fe..93165ae10b0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/320.tese.out @@ -21,10 +21,9 @@ ERROR: 0:44: 'assign' : l-value required (can't modify a const) ERROR: 0:47: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:48: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:49: 'noperspective' : Reserved word. -ERROR: 0:49: 'noperspective' : not supported with this profile: es +ERROR: 0:49: 'noperspective' : not supported for this version or the enabled extensions ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample) -ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as implicitly-sized ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use ERROR: 0:64: 'quads' : cannot apply to 'out' ERROR: 0:64: 'cw' : can only apply to 'in' @@ -43,7 +42,7 @@ ERROR: 0:96: 'location' : overlapping use of location 24 ERROR: 0:99: 'location' : overlapping use of location 24 ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved ERROR: 0:113: 'gl_BoundingBoxOES' : undeclared identifier -ERROR: 40 compilation errors. No code generated. +ERROR: 39 compilation errors. No code generated. Shader version: 320 @@ -67,8 +66,8 @@ ERROR: node is still EOpNull! 0:32 move second child to first child ( temp highp 4-component vector of float) 0:32 'p' ( temp highp 4-component vector of float) 0:32 gl_Position: direct index for structure ( in highp 4-component vector of float Position) -0:32 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:32 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:32 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:32 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:32 Constant: 0:32 1 (const int) 0:32 Constant: @@ -77,8 +76,8 @@ ERROR: node is still EOpNull! 0:33 move second child to first child ( temp highp float) 0:33 'ps' ( temp highp float) 0:33 gl_PointSize: direct index for structure ( in highp float PointSize) -0:33 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) -0:33 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in implicitly-sized array of highp 4-component vector of float gl_PositionPerViewNV}) +0:33 direct index ( temp block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) +0:33 'gl_in' ( in 32-element array of block{ in highp 4-component vector of float Position gl_Position, in highp float PointSize gl_PointSize, in highp 4-component vector of float gl_SecondaryPositionNV, in unsized 1-element array of highp 4-component vector of float gl_PositionPerViewNV}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/330.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/330.frag.out index 5919c76afbe..774563125ce 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/330.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/330.frag.out @@ -16,6 +16,7 @@ ERROR: 0:57: 'location on block member' : not supported for this version or the ERROR: 0:62: 'location on block member' : can only use in an in/out block ERROR: 0:62: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions ERROR: 0:60: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions +ERROR: 0:60: 'location' : cannot apply to uniform or buffer block ERROR: 0:68: 'layout-id value' : cannot be negative ERROR: 0:69: 'layout-id value' : cannot be negative ERROR: 0:76: 'f2' : cannot use layout qualifiers on structure members @@ -23,6 +24,7 @@ ERROR: 0:91: 'location on block member' : can only use in an in/out block ERROR: 0:91: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions ERROR: 0:91: 'location' : overlapping use of location 3 ERROR: 0:89: 'location qualifier on uniform or buffer' : not supported for this version or the enabled extensions +ERROR: 0:89: 'location' : cannot apply to uniform or buffer block ERROR: 0:94: 'location' : either the block needs a location, or all members need a location, or no members have a location ERROR: 0:108: 'A' : cannot use layout qualifiers on structure members ERROR: 0:119: 'location' : overlapping use of location 44 @@ -38,7 +40,7 @@ ERROR: 0:140: 'assign' : cannot convert from ' const float' to ' temp 2-compone ERROR: 0:141: 'textureQueryLod' : no matching overloaded function found ERROR: 0:141: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float' ERROR: 0:152: 'index' : value must be 0 or 1 -ERROR: 39 compilation errors. No code generated. +ERROR: 41 compilation errors. No code generated. Shader version: 330 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.frag.out index 443b1024162..90f73dc7237 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.frag.out @@ -516,7 +516,7 @@ ERROR: node is still EOpNull! 0:? 'vl' (layout( location=4) smooth in 4-component vector of float) 0:? 'vl2' (layout( location=6) smooth in 4-component vector of float) 0:? 'uv3' (layout( location=3) uniform 3-component vector of float) -0:? 'anon@0' ( in block{ in float FogFragCoord gl_FogFragCoord, in implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, smooth in 4-component vector of float Color gl_Color, in 4-component vector of float SecondaryColor gl_SecondaryColor}) +0:? 'anon@0' ( in block{ in float FogFragCoord gl_FogFragCoord, in unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, smooth in 4-component vector of float Color gl_Color, in 4-component vector of float SecondaryColor gl_SecondaryColor}) 0:? 'gl_FragCoord' ( gl_FragCoord 4-component vector of float FragCoord) 0:? 'u2drs' ( uniform sampler2DRectShadow) 0:? 'patchIn' ( smooth patch in 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.geom.out index 1d009d9ca81..52ebebcedbe 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.geom.out @@ -1,7 +1,7 @@ 400.geom ERROR: 0:12: 'invocations' : can only apply to a standalone qualifier ERROR: 0:20: 'patch' : not supported in this stage: geometry -ERROR: 0:20: 'gl_PointSize' : cannot add layout to redeclared block member +ERROR: 0:20: 'gl_PointSize' : cannot add non-XFB layout to redeclared block member ERROR: 0:20: 'gl_PointSize' : cannot add patch to redeclared block member ERROR: 0:25: 'length' : array must first be sized by a redeclaration or layout qualifier ERROR: 0:36: 'length' : array must first be sized by a redeclaration or layout qualifier diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tesc.out index 762f0b8d466..0475741ffdc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tesc.out @@ -44,8 +44,8 @@ ERROR: node is still EOpNull! 0:23 move second child to first child ( temp 4-component vector of float) 0:23 'p' ( temp 4-component vector of float) 0:23 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:23 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:23 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:23 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:23 Constant: 0:23 1 (const int) 0:23 Constant: @@ -54,8 +54,8 @@ ERROR: node is still EOpNull! 0:24 move second child to first child ( temp float) 0:24 'ps' ( temp float) 0:24 gl_PointSize: direct index for structure ( in float PointSize) -0:24 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:24 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:24 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:24 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:24 Constant: 0:24 1 (const int) 0:24 Constant: @@ -64,9 +64,9 @@ ERROR: node is still EOpNull! 0:25 move second child to first child ( temp float) 0:25 'cd' ( temp float) 0:25 direct index ( temp float ClipDistance) -0:25 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:25 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:25 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:25 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:25 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:25 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:25 Constant: 0:25 1 (const int) 0:25 Constant: @@ -87,25 +87,25 @@ ERROR: node is still EOpNull! 0:29 'gl_InvocationID' ( in int InvocationID) 0:31 move second child to first child ( temp 4-component vector of float) 0:31 gl_Position: direct index for structure ( out 4-component vector of float Position) -0:31 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:31 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:31 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:31 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:31 'gl_InvocationID' ( in int InvocationID) 0:31 Constant: 0:31 0 (const int) 0:31 'p' ( temp 4-component vector of float) 0:32 move second child to first child ( temp float) 0:32 gl_PointSize: direct index for structure ( out float PointSize) -0:32 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:32 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:32 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:32 'gl_InvocationID' ( in int InvocationID) 0:32 Constant: 0:32 1 (const int) 0:32 'ps' ( temp float) 0:33 move second child to first child ( temp float) 0:33 direct index ( temp float ClipDistance) -0:33 gl_ClipDistance: direct index for structure ( out implicitly-sized array of float ClipDistance) -0:33 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:33 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 gl_ClipDistance: direct index for structure ( out unsized 2-element array of float ClipDistance) +0:33 indirect index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:33 'gl_InvocationID' ( in int InvocationID) 0:33 Constant: 0:33 2 (const int) @@ -175,8 +175,8 @@ ERROR: node is still EOpNull! 0:67 Function Parameters: 0:69 Sequence 0:69 gl_PointSize: direct index for structure ( out float PointSize) -0:69 direct index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:69 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:69 direct index ( temp block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) +0:69 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:69 Constant: 0:69 4 (const int) 0:69 Constant: @@ -211,7 +211,7 @@ ERROR: node is still EOpNull! 0:123 'gl_DeviceIndex' ( in int DeviceIndex) 0:124 'gl_ViewIndex' ( in int ViewIndex) 0:? Linker Objects -0:? 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' ( out 4-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 2-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' ( global 4-element array of int) 0:? 'patchIn' ( patch in 4-component vector of float) 0:? 'patchOut' ( patch out 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tese.out index e9ffcdf6d32..9580e857ca0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/400.tese.out @@ -11,7 +11,6 @@ ERROR: 0:47: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:48: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:49: 'patch' : cannot use interpolation qualifiers with patch ERROR: 0:50: '' : can only have one auxiliary qualifier (centroid, patch, and sample) -ERROR: 0:54: 'gl_PerVertex' : block already declared with size, can't redeclare as implicitly-sized ERROR: 0:59: 'gl_PerVertex' : can only redeclare a built-in block once, and before any use ERROR: 0:64: 'quads' : cannot apply to 'out' ERROR: 0:64: 'cw' : can only apply to 'in' @@ -31,7 +30,7 @@ ERROR: 0:99: 'location' : overlapping use of location 24 ERROR: 0:101: 'gl_TessLevelOuter' : identifiers starting with "gl_" are reserved ERROR: 0:109: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group ERROR: 0:110: 'gl_ViewIndex' : required extension not requested: GL_EXT_multiview -ERROR: 32 compilation errors. No code generated. +ERROR: 31 compilation errors. No code generated. Shader version: 400 @@ -57,8 +56,8 @@ ERROR: node is still EOpNull! 0:32 move second child to first child ( temp 4-component vector of float) 0:32 'p' ( temp 4-component vector of float) 0:32 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:32 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:32 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:32 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:32 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:32 Constant: 0:32 1 (const int) 0:32 Constant: @@ -67,8 +66,8 @@ ERROR: node is still EOpNull! 0:33 move second child to first child ( temp float) 0:33 'ps' ( temp float) 0:33 gl_PointSize: direct index for structure ( in float PointSize) -0:33 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:33 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:33 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:33 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:33 Constant: 0:33 1 (const int) 0:33 Constant: @@ -77,9 +76,9 @@ ERROR: node is still EOpNull! 0:34 move second child to first child ( temp float) 0:34 'cd' ( temp float) 0:34 direct index ( temp float ClipDistance) -0:34 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:34 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:34 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:34 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:34 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:34 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:34 Constant: 0:34 1 (const int) 0:34 Constant: @@ -114,20 +113,20 @@ ERROR: node is still EOpNull! 0:40 1 (const int) 0:42 move second child to first child ( temp 4-component vector of float) 0:42 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -0:42 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:42 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:42 Constant: 0:42 0 (const uint) 0:42 'p' ( temp 4-component vector of float) 0:43 move second child to first child ( temp float) 0:43 gl_PointSize: direct index for structure ( gl_PointSize float PointSize) -0:43 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:43 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:43 Constant: 0:43 1 (const uint) 0:43 'ps' ( temp float) 0:44 move second child to first child ( temp float) 0:44 direct index ( temp float ClipDistance) -0:44 gl_ClipDistance: direct index for structure ( out implicitly-sized array of float ClipDistance) -0:44 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:44 gl_ClipDistance: direct index for structure ( out unsized 3-element array of float ClipDistance) +0:44 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:44 Constant: 0:44 2 (const uint) 0:44 Constant: @@ -146,7 +145,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'patchIn' ( patch in 4-component vector of float) 0:? 'patchOut' ( patch out 4-component vector of float) -0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:? 'badp1' ( smooth patch in 4-component vector of float) 0:? 'badp2' ( flat patch in 4-component vector of float) 0:? 'badp3' ( noperspective patch in 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.geom.out index 4d35d520683..ab5ad472854 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.geom.out @@ -31,7 +31,7 @@ ERROR: node is still EOpNull! 0:30 'p' ( temp float) 0:30 gl_PointSize: direct index for structure ( in float PointSize) 0:30 direct index ( temp block{ in float PointSize gl_PointSize}) -0:30 'gl_in' ( in implicitly-sized array of block{ in float PointSize gl_PointSize}) +0:30 'gl_in' ( in unsized 2-element array of block{ in float PointSize gl_PointSize}) 0:30 Constant: 0:30 1 (const int) 0:30 Constant: @@ -53,7 +53,7 @@ ERROR: node is still EOpNull! 0:38 Constant: 0:38 4.000000 0:? Linker Objects -0:? 'gl_in' ( in implicitly-sized array of block{ in float PointSize gl_PointSize}) +0:? 'gl_in' ( in unsized 2-element array of block{ in float PointSize gl_PointSize}) 0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, }) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.tesc.out index 68593d0db23..0a397fdd4b1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/410.tesc.out @@ -9,7 +9,7 @@ ERROR: node is still EOpNull! 0:8 Function Definition: main( ( global void) 0:8 Function Parameters: 0:? Linker Objects -0:? 'gl_out' ( out implicitly-sized array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_out' ( out unsized 1-element array of block{ out 4-component vector of float Position gl_Position, out float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'outa' ( global 1-element array of int) 0:? 'patchOut' ( patch out 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.frag.out index 5f2b0f7b0a0..ffb8f6d2835 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.frag.out @@ -19,7 +19,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) 0:? 'depth' ( smooth in float) -0:? 'a' (layout( binding=0 offset=0) uniform implicitly-sized array of atomic_uint) +0:? 'a' (layout( binding=0 offset=0) uniform unsized 1-element array of atomic_uint) Linked fragment stage: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.geom.out index fe9e12f4201..6bf6eb3792b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.geom.out @@ -20,15 +20,15 @@ ERROR: node is still EOpNull! 0:9 Constant: 0:9 1 (const int) 0:10 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:10 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:10 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:10 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:10 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:10 Constant: 0:10 1 (const int) 0:10 Constant: 0:10 0 (const int) 0:11 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:11 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:11 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:11 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:11 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:11 'i' ( global int) 0:11 Constant: 0:11 0 (const int) @@ -38,8 +38,8 @@ ERROR: node is still EOpNull! 0:20 Constant: 0:20 3 (const int) 0:21 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:21 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:21 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:21 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:21 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:21 'i' ( global int) 0:21 Constant: 0:21 0 (const int) @@ -121,12 +121,12 @@ ERROR: node is still EOpNull! 0:54 'i' ( global int) 0:? Linker Objects 0:? 'i' ( global int) -0:? 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:? 'color3' ( in 3-element array of 4-component vector of float) 0:? 's2D' ( uniform sampler2D) 0:? 'coord' ( in 3-element array of 2-component vector of float) 0:? 'v4' ( uniform 4-component vector of float) -0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'anon@0' (layout( stream=0) out block{layout( stream=0) gl_PointSize float PointSize gl_PointSize, layout( stream=0) out unsized 1-element array of float ClipDistance gl_ClipDistance}) Linked geometry stage: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tesc.out index 7876bd63a39..a1f881cb191 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tesc.out @@ -20,8 +20,8 @@ ERROR: node is still EOpNull! 0:17 move second child to first child ( temp 4-component vector of float) 0:17 'p' ( temp 4-component vector of float) 0:17 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:17 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:17 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:17 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:17 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:17 Constant: 0:17 1 (const int) 0:17 Constant: @@ -30,8 +30,8 @@ ERROR: node is still EOpNull! 0:18 move second child to first child ( temp float) 0:18 'ps' ( temp float) 0:18 gl_PointSize: direct index for structure ( in float PointSize) -0:18 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:18 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:18 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:18 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:18 Constant: 0:18 1 (const int) 0:18 Constant: @@ -40,9 +40,9 @@ ERROR: node is still EOpNull! 0:19 move second child to first child ( temp float) 0:19 'cd' ( temp float) 0:19 direct index ( temp float ClipDistance) -0:19 gl_ClipDistance: direct index for structure ( in implicitly-sized array of float ClipDistance) -0:19 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:19 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:19 gl_ClipDistance: direct index for structure ( in unsized 3-element array of float ClipDistance) +0:19 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) +0:19 'gl_in' ( in 32-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 3-element array of float ClipDistance gl_ClipDistance}) 0:19 Constant: 0:19 1 (const int) 0:19 Constant: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tese.out index f14e1c0d3d8..71fca85e7c3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.tese.out @@ -139,7 +139,7 @@ ERROR: node is still EOpNull! 0:? 'b3' ( global 2-element array of 4-component vector of float) 0:? 'b4' ( global 2-element array of 4-component vector of float) 0:? 'c3' ( global 4X2 matrix of float) -0:? 'd2' ( global implicitly-sized array of structure{ global float s, global float t}) +0:? 'd2' ( global unsized 1-element array of structure{ global float s, global float t}) 0:? 'b5' ( global 5-element array of float) 0:? 'single1' ( global structure{ global int f}) 0:? 'single2' ( global structure{ global 2-component vector of uint v}) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.vert.out index b912dc078d0..22577ab05e2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420.vert.out @@ -46,12 +46,12 @@ ERROR: 0:142: 'r8_snorm' : does not apply to signed integer images ERROR: 0:143: 'rgba32ui' : does not apply to signed integer images ERROR: 0:144: 'r8ui' : does not apply to signed integer images ERROR: 0:147: 'offset on block member' : not supported for this version or the enabled extensions -ERROR: 0:147: 'offset/align' : can only be used with std140 or std430 layout packing +ERROR: 0:147: 'offset/align' : can only be used with std140, std430, or scalar layout packing ERROR: 0:157: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int' ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:158: 'assign' : cannot convert from ' const float' to ' temp int' -WARNING: 0:161: '[]' : assuming array size of one for compile-time checking of binding numbers for implicitly-sized array +WARNING: 0:161: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array ERROR: 51 compilation errors. No code generated. @@ -302,7 +302,7 @@ ERROR: node is still EOpNull! 0:? 'offcheckI' (layout( column_major shared) uniform block{layout( column_major shared offset=16) uniform int foo}) 0:? 'samp1D' ( uniform sampler1D) 0:? 'samp1Ds' ( uniform sampler1DShadow) -0:? 'badArray' (layout( binding=0) writeonly uniform implicitly-sized array of image1D) +0:? 'badArray' (layout( binding=0) writeonly uniform unsized 1-element array of image1D) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420_size_gl_in.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420_size_gl_in.geom.out index d058013d89b..9d95495b47a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420_size_gl_in.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/420_size_gl_in.geom.out @@ -15,8 +15,8 @@ ERROR: node is still EOpNull! 0:13 Constant: 0:13 3 (const int) 0:14 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:14 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:14 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:14 direct index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:14 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:14 Constant: 0:14 1 (const int) 0:14 Constant: @@ -24,8 +24,8 @@ ERROR: node is still EOpNull! 0:15 Constant: 0:15 3 (const int) 0:16 gl_Position: direct index for structure ( in 4-component vector of float Position) -0:16 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) -0:16 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:16 indirect index ( temp block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) +0:16 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) 0:16 'i' ( global int) 0:16 Constant: 0:16 0 (const int) @@ -33,7 +33,7 @@ ERROR: node is still EOpNull! 0:? 'i' ( global int) 0:? 'colorun' ( in 3-element array of 4-component vector of float) 0:? 'color3' ( in 3-element array of 4-component vector of float) -0:? 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in implicitly-sized array of float ClipDistance gl_ClipDistance}) +0:? 'gl_in' ( in 3-element array of block{ in 4-component vector of float Position gl_Position, in float PointSize gl_PointSize, in unsized 1-element array of float ClipDistance gl_ClipDistance}) Linked geometry stage: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.comp.out index c4ad19ed008..599cd8e3e01 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.comp.out @@ -33,13 +33,13 @@ ERROR: node is still EOpNull! 0:35 GroupMemoryBarrier ( global void) 0:36 move second child to first child ( temp int) 0:36 value: direct index for structure (layout( column_major shared) buffer int) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer runtime-sized array of float values}) 0:36 Constant: 0:36 0 (const uint) 0:36 Convert float to int ( temp int) 0:36 indirect index (layout( column_major shared) temp float) -0:36 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of float) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:36 values: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer runtime-sized array of float values}) 0:36 Constant: 0:36 1 (const uint) 0:36 'gl_LocalInvocationIndex' ( in uint LocalInvocationIndex) @@ -56,8 +56,8 @@ ERROR: node is still EOpNull! 0:65 Sequence 0:65 move second child to first child ( temp float) 0:65 direct index (layout( column_major shared) temp float) -0:65 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of float) -0:65 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:65 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float) +0:65 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) 0:65 Constant: 0:65 1 (const int) 0:65 Constant: @@ -65,8 +65,8 @@ ERROR: node is still EOpNull! 0:65 Constant: 0:65 4.700000 0:66 array length ( temp int) -0:66 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of float) -0:66 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:66 values: direct index for structure (layout( column_major shared) buffer unsized 3-element array of float) +0:66 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) 0:66 Constant: 0:66 1 (const int) 0:67 Barrier ( global void) @@ -129,8 +129,8 @@ ERROR: node is still EOpNull! 0:? 4096 (const uint) 0:? 'total' ( const int) 0:? 66592 (const int) -0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) -0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer implicitly-sized array of float values, layout( column_major shared) buffer int value}) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer runtime-sized array of float values}) +0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer unsized 1-element array of float values, layout( column_major shared) buffer int value}) 0:? 'v3' (layout( location=2) in 3-component vector of float) 0:? 'f' ( in float) 0:? 'fo' ( out float) @@ -140,7 +140,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of int) 0:? 'arrY' ( global 1-element array of int) 0:? 'arrZ' ( global 4096-element array of int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) 0:? 'roll' ( uniform double) 0:? 'destTex' ( writeonly uniform image2D) 0:? 'inbi' ( in block{ in int a}) @@ -165,13 +165,13 @@ ERROR: node is still EOpNull! 0:35 GroupMemoryBarrier ( global void) 0:36 move second child to first child ( temp int) 0:36 value: direct index for structure (layout( column_major shared) buffer int) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer runtime-sized array of float values}) 0:36 Constant: 0:36 0 (const uint) 0:36 Convert float to int ( temp int) 0:36 indirect index (layout( column_major shared) temp float) -0:36 values: direct index for structure (layout( column_major shared) buffer implicitly-sized array of float) -0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:36 values: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:36 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer runtime-sized array of float values}) 0:36 Constant: 0:36 1 (const uint) 0:36 'gl_LocalInvocationIndex' ( in uint LocalInvocationIndex) @@ -190,8 +190,8 @@ ERROR: node is still EOpNull! 0:? 4096 (const uint) 0:? 'total' ( const int) 0:? 66592 (const int) -0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) -0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer implicitly-sized array of float values, layout( column_major shared) buffer int value}) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer runtime-sized array of float values}) +0:? 'invalid' (layout( column_major shared) buffer block{layout( column_major shared) buffer 1-element array of float values, layout( column_major shared) buffer int value}) 0:? 'v3' (layout( location=2) in 3-component vector of float) 0:? 'f' ( in float) 0:? 'fo' ( out float) @@ -201,7 +201,7 @@ ERROR: node is still EOpNull! 0:? 'arrX' ( global 2-element array of int) 0:? 'arrY' ( global 1-element array of int) 0:? 'arrZ' ( global 4096-element array of int) -0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer implicitly-sized array of float values}) +0:? 'ro' (layout( column_major shared) readonly buffer block{layout( column_major shared) buffer int value, layout( column_major shared) buffer unsized 3-element array of float values}) 0:? 'roll' ( uniform double) 0:? 'destTex' ( writeonly uniform image2D) 0:? 'inbi' ( in block{ in int a}) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.vert.out index 29ffb01aa8b..f57a39c1fb8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430.vert.out @@ -27,9 +27,9 @@ ERROR: 0:64: 'uniform buffer-member align' : not supported for this version or t ERROR: 0:65: 'uniform buffer-member align' : not supported for this version or the enabled extensions ERROR: 0:65: 'offset on block member' : not supported for this version or the enabled extensions ERROR: 0:66: 'offset on block member' : not supported for this version or the enabled extensions -ERROR: 0:64: 'align' : can only be used with std140 or std430 layout packing -ERROR: 0:65: 'offset/align' : can only be used with std140 or std430 layout packing -ERROR: 0:66: 'offset/align' : can only be used with std140 or std430 layout packing +ERROR: 0:64: 'align' : can only be used with std140, std430, or scalar layout packing +ERROR: 0:65: 'offset/align' : can only be used with std140, std430, or scalar layout packing +ERROR: 0:66: 'offset/align' : can only be used with std140, std430, or scalar layout packing ERROR: 0:71: 'offset on block member' : not supported for this version or the enabled extensions ERROR: 0:74: 'gl_MaxTransformFeedbackBuffers' : required extension not requested: GL_ARB_enhanced_layouts ERROR: 0:75: 'gl_MaxTransformFeedbackInterleavedComponents' : required extension not requested: GL_ARB_enhanced_layouts diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430AofA.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430AofA.frag.out index 22dc4d3f578..ac23dacb19c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430AofA.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430AofA.frag.out @@ -7,7 +7,7 @@ ERROR: 0:56: 'constructor' : cannot convert parameter 2 from ' const 3-element ERROR: 0:60: 'constructor' : cannot convert parameter 2 from ' const 2-element array of 4-component vector of float' to ' temp 3-element array of 4-component vector of float' ERROR: 0:64: '=' : cannot convert from ' const 3-element array of 2-element array of 4-component vector of float' to ' temp 4-element array of 2-element array of 4-component vector of float' ERROR: 0:70: 'assign' : cannot convert from ' global 4-element array of 7-element array of float' to ' global 5-element array of 7-element array of float' -ERROR: 0:71: 'assign' : cannot convert from ' global 4-element array of 7-element array of float' to ' global implicitly-sized array of 7-element array of float' +ERROR: 0:71: 'assign' : cannot convert from ' global 4-element array of 7-element array of float' to ' global unsized 1-element array of 7-element array of float' ERROR: 0:73: 'foo' : no matching overloaded function found ERROR: 0:78: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type ' global 4-element array of 7-element array of float' and a right operand of type ' global 5-element array of 7-element array of float' (or there is no acceptable conversion) ERROR: 0:84: '[' : array index out of range '5' @@ -335,7 +335,7 @@ ERROR: node is still EOpNull! 0:69 Function Call: foo(f1[5][7]; ( global 4-element array of 7-element array of float) 0:69 'g5' ( global 5-element array of 7-element array of float) 0:70 'g5' ( global 5-element array of 7-element array of float) -0:71 'gu' ( global implicitly-sized array of 7-element array of float) +0:71 'gu' ( global unsized 1-element array of 7-element array of float) 0:73 Constant: 0:73 0.000000 0:74 Function Call: bar(f1[5][7]; ( global void) @@ -404,8 +404,8 @@ ERROR: node is still EOpNull! 0:98 0.000000 0:? Linker Objects 0:? 'many' ( global 1-element array of 2-element array of 3-element array of 4-element array of 5-element array of 6-element array of float) -0:? 'gu' ( global implicitly-sized array of 7-element array of float) -0:? 'gimp' ( global implicitly-sized array of 1-element array of float) +0:? 'gu' ( global unsized 1-element array of 7-element array of float) +0:? 'gimp' ( global unsized 1-element array of 1-element array of float) 0:? 'g4' ( global 4-element array of 7-element array of float) 0:? 'g5' ( global 5-element array of 7-element array of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430scope.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430scope.vert.out index 0d9138922e7..973c21aa14b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430scope.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/430scope.vert.out @@ -63,7 +63,7 @@ ERROR: node is still EOpNull! 0:47 3.000000 0:49 move second child to first child ( temp 4-component vector of float) 0:49 gl_Position: direct index for structure ( invariant gl_Position 4-component vector of float Position) -0:49 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:49 'anon@0' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:49 Constant: 0:49 0 (const uint) 0:49 Construct vec4 ( temp 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.frag.out index 18e014f9219..1ac6e7c68b7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.frag.out @@ -21,11 +21,11 @@ ERROR: 0:38: 'offset' : only applies to block members, not blocks ERROR: 0:39: 'output block' : not supported in this stage: fragment ERROR: 0:39: 'layout' : offset/align can only be used on a uniform or buffer ERROR: 0:39: 'offset' : only applies to block members, not blocks -ERROR: 0:42: 'align' : can only be used with std140 or std430 layout packing -ERROR: 0:43: 'align' : can only be used with std140 or std430 layout packing +ERROR: 0:42: 'align' : can only be used with std140, std430, or scalar layout packing +ERROR: 0:43: 'align' : can only be used with std140, std430, or scalar layout packing ERROR: 0:43: 'layout' : offset/align can only be used on a uniform or buffer ERROR: 0:44: 'output block' : not supported in this stage: fragment -ERROR: 0:44: 'align' : can only be used with std140 or std430 layout packing +ERROR: 0:44: 'align' : can only be used with std140, std430, or scalar layout packing ERROR: 0:44: 'layout' : offset/align can only be used on a uniform or buffer ERROR: 0:46: 'offset' : cannot specify on a variable declaration ERROR: 0:47: 'layout' : offset/align can only be used on a uniform or buffer @@ -36,9 +36,9 @@ ERROR: 0:52: 'layout' : offset/align can only be used on a uniform or buffer ERROR: 0:54: 'layout' : matrix or packing qualifiers can only be used on a uniform or buffer ERROR: 0:55: 'layout' : cannot specify packing on a variable declaration ERROR: 0:57: 'align' : must be a power of 2 -ERROR: 0:58: 'offset/align' : can only be used with std140 or std430 layout packing -ERROR: 0:62: 'offset/align' : can only be used with std140 or std430 layout packing -ERROR: 0:63: 'offset/align' : can only be used with std140 or std430 layout packing +ERROR: 0:58: 'offset/align' : can only be used with std140, std430, or scalar layout packing +ERROR: 0:62: 'offset/align' : can only be used with std140, std430, or scalar layout packing +ERROR: 0:63: 'offset/align' : can only be used with std140, std430, or scalar layout packing ERROR: 0:62: 'layout' : offset/align can only be used on a uniform or buffer ERROR: 0:63: 'layout' : offset/align can only be used on a uniform or buffer ERROR: 0:84: 'align' : must be a power of 2 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.vert.out index 8eafb0aea1d..5a10e261ae6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/440.vert.out @@ -46,51 +46,54 @@ ERROR: 0:166: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers ERROR: 0:169: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 ERROR: 0:169: 'xfb_stride' : 1/4 stride is too large: gl_MaxTransformFeedbackInterleavedComponents is 64 ERROR: 0:171: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 -ERROR: 0:179: 'gl_BaseVertexARB' : required extension not requested: GL_ARB_shader_draw_parameters -ERROR: 0:179: 'gl_BaseInstanceARB' : required extension not requested: GL_ARB_shader_draw_parameters -ERROR: 0:179: 'gl_DrawIDARB' : required extension not requested: GL_ARB_shader_draw_parameters -ERROR: 0:187: 'assign' : l-value required "gl_BaseVertexARB" (can't modify shader input) -ERROR: 0:188: 'assign' : l-value required "gl_BaseInstanceARB" (can't modify shader input) -ERROR: 0:189: 'assign' : l-value required "gl_DrawIDARB" (can't modify shader input) -ERROR: 0:190: 'glBaseInstanceARB' : undeclared identifier -ERROR: 54 compilation errors. No code generated. +ERROR: 0:178: 'xfb_offset' : overlapping offsets at offset 36 in buffer 3 +ERROR: 0:179: 'xfb_buffer' : member cannot contradict block (or what block inherited from global) +ERROR: 0:178: 'xfb_offset' : overlapping offsets at offset 32 in buffer 3 +ERROR: 0:185: 'gl_BaseVertexARB' : required extension not requested: GL_ARB_shader_draw_parameters +ERROR: 0:185: 'gl_BaseInstanceARB' : required extension not requested: GL_ARB_shader_draw_parameters +ERROR: 0:185: 'gl_DrawIDARB' : required extension not requested: GL_ARB_shader_draw_parameters +ERROR: 0:193: 'assign' : l-value required "gl_BaseVertexARB" (can't modify shader input) +ERROR: 0:194: 'assign' : l-value required "gl_BaseInstanceARB" (can't modify shader input) +ERROR: 0:195: 'assign' : l-value required "gl_DrawIDARB" (can't modify shader input) +ERROR: 0:196: 'glBaseInstanceARB' : undeclared identifier +ERROR: 57 compilation errors. No code generated. Shader version: 440 Requested GL_ARB_shader_draw_parameters in xfb mode ERROR: node is still EOpNull! -0:177 Function Definition: drawParamsBad( ( global int) -0:177 Function Parameters: -0:179 Sequence -0:179 Branch: Return with expression -0:179 add ( temp int) -0:179 add ( temp int) -0:179 'gl_BaseVertexARB' ( in int BaseVertex) -0:179 'gl_BaseInstanceARB' ( in int BaseInstance) -0:179 'gl_DrawIDARB' ( in int DrawId) -0:184 Function Definition: drawParams( ( global int) -0:184 Function Parameters: -0:186 Sequence -0:186 Branch: Return with expression -0:186 add ( temp int) -0:186 add ( temp int) -0:186 'gl_BaseVertexARB' ( in int BaseVertex) -0:186 'gl_BaseInstanceARB' ( in int BaseInstance) -0:186 'gl_DrawIDARB' ( in int DrawId) -0:187 move second child to first child ( temp int) -0:187 'gl_BaseVertexARB' ( in int BaseVertex) -0:187 Constant: -0:187 3 (const int) -0:188 move second child to first child ( temp int) -0:188 'gl_BaseInstanceARB' ( in int BaseInstance) -0:188 Constant: -0:188 3 (const int) -0:189 move second child to first child ( temp int) -0:189 'gl_DrawIDARB' ( in int DrawId) -0:189 Constant: -0:189 3 (const int) -0:190 'glBaseInstanceARB' ( temp float) +0:183 Function Definition: drawParamsBad( ( global int) +0:183 Function Parameters: +0:185 Sequence +0:185 Branch: Return with expression +0:185 add ( temp int) +0:185 add ( temp int) +0:185 'gl_BaseVertexARB' ( in int BaseVertex) +0:185 'gl_BaseInstanceARB' ( in int BaseInstance) +0:185 'gl_DrawIDARB' ( in int DrawId) +0:190 Function Definition: drawParams( ( global int) +0:190 Function Parameters: +0:192 Sequence +0:192 Branch: Return with expression +0:192 add ( temp int) +0:192 add ( temp int) +0:192 'gl_BaseVertexARB' ( in int BaseVertex) +0:192 'gl_BaseInstanceARB' ( in int BaseInstance) +0:192 'gl_DrawIDARB' ( in int DrawId) +0:193 move second child to first child ( temp int) +0:193 'gl_BaseVertexARB' ( in int BaseVertex) +0:193 Constant: +0:193 3 (const int) +0:194 move second child to first child ( temp int) +0:194 'gl_BaseInstanceARB' ( in int BaseInstance) +0:194 Constant: +0:194 3 (const int) +0:195 move second child to first child ( temp int) +0:195 'gl_DrawIDARB' ( in int DrawId) +0:195 Constant: +0:195 3 (const int) +0:196 'glBaseInstanceARB' ( temp float) 0:? Linker Objects 0:? 'a' (layout( location=2 component=2) in 2-component vector of float) 0:? 'b' (layout( location=2 component=1) in float) @@ -153,6 +156,7 @@ ERROR: node is still EOpNull! 0:? 'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b, global structure{ global int i, global double d, global float f} s, global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s}) 0:? 'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float) 0:? 'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f}) +0:? 'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize, }) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) @@ -167,6 +171,8 @@ ERROR: xfb_buffer 0, xfb_stride 92 ERROR: Linking vertex stage: xfb_stride must be multiple of 4: ERROR: xfb_buffer 5, xfb_stride 6 ERROR: Linking vertex stage: xfb_stride is too large: +ERROR: xfb_buffer 6, components (1/4 stride) needed are 500, gl_MaxTransformFeedbackInterleavedComponents is 64 +ERROR: Linking vertex stage: xfb_stride is too large: ERROR: xfb_buffer 7, components (1/4 stride) needed are 66, gl_MaxTransformFeedbackInterleavedComponents is 64 Shader version: 440 @@ -235,6 +241,7 @@ ERROR: node is still EOpNull! 0:? 'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b, global structure{ global int i, global double d, global float f} s, global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s}) 0:? 'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float) 0:? 'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f}) +0:? 'anon@0' ( out block{layout( xfb_buffer=3 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=3 xfb_offset=32) gl_PointSize float PointSize gl_PointSize, }) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/450.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/450.vert.out index 64143de5660..0f5f23136e7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/450.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/450.vert.out @@ -19,7 +19,9 @@ ERROR: 0:44: 'anyInvocation' : no matching overloaded function found ERROR: 0:45: 'allInvocations' : no matching overloaded function found ERROR: 0:46: 'allInvocationsEqual' : no matching overloaded function found ERROR: 0:48: 'extraneous semicolon' : not supported for this version or the enabled extensions -ERROR: 20 compilation errors. No code generated. +ERROR: 0:50: 'location' : cannot apply to uniform or buffer block +ERROR: 0:54: 'location' : cannot apply to uniform or buffer block +ERROR: 22 compilation errors. No code generated. Shader version: 450 @@ -77,6 +79,8 @@ ERROR: node is still EOpNull! 0:? 'outSS' ( smooth out structure{ global float f, global structure{ global float f} s}) 0:? 'aui' (layout( binding=0 offset=0) uniform atomic_uint) 0:? 'ui' ( global uint) +0:? 'anon@1' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform int a}) +0:? 'anon@2' (layout( location=0 column_major shared) buffer block{layout( column_major shared) buffer int b}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) @@ -112,6 +116,8 @@ ERROR: node is still EOpNull! 0:? 'outSS' ( smooth out structure{ global float f, global structure{ global float f} s}) 0:? 'aui' (layout( binding=0 offset=0) uniform atomic_uint) 0:? 'ui' ( global uint) +0:? 'anon@1' (layout( location=0 column_major shared) uniform block{layout( column_major shared) uniform int a}) +0:? 'anon@2' (layout( location=0 column_major shared) buffer block{layout( column_major shared) buffer int b}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/460.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/460.frag.out index 883d949b23c..90c4837e2af 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/460.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/460.frag.out @@ -1,6 +1,14 @@ 460.frag +ERROR: 0:22: 'attribute' : required extension not requested: GL_EXT_control_flow_attributes +ERROR: 0:23: 'attribute' : required extension not requested: GL_EXT_control_flow_attributes +ERROR: 0:30: 'dependency_length' : must be positive +ERROR: 0:31: 'dependency_length' : must be positive +ERROR: 4 compilation errors. No code generated. + + Shader version: 460 -0:? Sequence +Requested GL_EXT_control_flow_attributes +ERROR: node is still EOpNull! 0:10 Function Definition: main( ( global void) 0:10 Function Parameters: 0:12 Sequence @@ -21,6 +29,43 @@ Shader version: 460 0:16 'b1' ( temp bool) 0:16 allInvocationsEqual ( global bool) 0:16 'b1' ( temp bool) +0:19 Function Definition: attExtBad( ( global void) +0:19 Function Parameters: +0:22 Sequence +0:22 Sequence +0:22 Sequence +0:22 move second child to first child ( temp int) +0:22 'i' ( temp int) +0:22 Constant: +0:22 0 (const int) +0:22 Loop with condition tested first: Dependency 4 +0:22 Loop Condition +0:22 Compare Less Than ( temp bool) +0:22 'i' ( temp int) +0:22 Constant: +0:22 8 (const int) +0:22 No loop body +0:22 Loop Terminal Expression +0:22 Pre-Increment ( temp int) +0:22 'i' ( temp int) +0:23 Test condition and select ( temp void): Flatten +0:23 Condition +0:23 Constant: +0:23 true (const bool) +0:23 true case is null +0:28 Function Definition: attExt( ( global void) +0:28 Function Parameters: +0:30 Sequence +0:30 Loop with condition not tested first: Dependency -3 +0:30 Loop Condition +0:30 Constant: +0:30 true (const bool) +0:30 No loop body +0:31 Loop with condition not tested first +0:31 Loop Condition +0:31 Constant: +0:31 true (const bool) +0:31 No loop body 0:? Linker Objects 0:? 's' ( smooth in structure{ global float f, global 4-component vector of float v}) @@ -29,7 +74,8 @@ Linked fragment stage: Shader version: 460 -0:? Sequence +Requested GL_EXT_control_flow_attributes +ERROR: node is still EOpNull! 0:10 Function Definition: main( ( global void) 0:10 Function Parameters: 0:12 Sequence diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array.frag.out index f41f0afedbb..2af9f27f710 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array.frag.out @@ -2,7 +2,7 @@ array.frag ERROR: 0:21: '[' : array index out of range '2' ERROR: 0:27: '[' : array must be redeclared with a size before being indexed with a variable ERROR: 0:30: 'assign' : cannot convert from ' global 4-element array of float' to ' global 5-element array of float' -ERROR: 0:31: 'assign' : cannot convert from ' global 4-element array of float' to ' global implicitly-sized array of float' +ERROR: 0:31: 'assign' : cannot convert from ' global 4-element array of float' to ' global runtime-sized array of float' ERROR: 0:33: 'foo' : no matching overloaded function found ERROR: 0:42: '[' : array index out of range '5' ERROR: 0:45: '[' : array index out of range '1000' @@ -23,9 +23,12 @@ ERROR: 0:84: 'return' : type does not match, or is not convertible to, the funct ERROR: 0:93: 'length' : array must be declared with a size before using this method ERROR: 0:101: '[' : array index out of range '5' ERROR: 0:104: 'constructor' : array constructor must have at least one argument -ERROR: 0:104: '=' : cannot convert from ' const float' to ' global implicitly-sized array of int' +ERROR: 0:104: '=' : cannot convert from ' const float' to ' global unsized 1-element array of int' ERROR: 0:106: 'constructor' : array argument must be sized -ERROR: 26 compilation errors. No code generated. +ERROR: 0:111: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:111: 'variable indexing sampler array' : not supported with this profile: none +ERROR: 0:112: '[]' : array initializer must be sized +ERROR: 29 compilation errors. No code generated. Shader version: 130 @@ -68,21 +71,21 @@ ERROR: node is still EOpNull! 0:21 4.000000 0:24 move second child to first child ( temp float) 0:24 direct index ( temp float) -0:24 'gu' ( global implicitly-sized array of float) +0:24 'gu' ( global runtime-sized array of float) 0:24 Constant: 0:24 2 (const int) 0:24 Constant: 0:24 4.000000 0:26 move second child to first child ( temp float) 0:26 direct index ( temp float) -0:26 'gu' ( global implicitly-sized array of float) +0:26 'gu' ( global runtime-sized array of float) 0:26 Constant: 0:26 3 (const int) 0:26 Constant: 0:26 3.000000 0:27 move second child to first child ( temp float) 0:27 indirect index ( temp float) -0:27 'gu' ( global implicitly-sized array of float) +0:27 'gu' ( global runtime-sized array of float) 0:27 'a' ( uniform int) 0:27 Constant: 0:27 5.000000 @@ -91,7 +94,7 @@ ERROR: node is still EOpNull! 0:29 Function Call: foo(f1[5]; ( global 4-element array of float) 0:29 'g5' ( global 5-element array of float) 0:30 'g5' ( global 5-element array of float) -0:31 'gu' ( global implicitly-sized array of float) +0:31 'gu' ( global runtime-sized array of float) 0:33 Constant: 0:33 0.000000 0:34 Function Call: bar(f1[5]; ( global void) @@ -108,7 +111,7 @@ ERROR: node is still EOpNull! 0:36 true case 0:37 move second child to first child ( temp float) 0:37 direct index ( temp float) -0:37 'gu' ( global implicitly-sized array of float) +0:37 'gu' ( global runtime-sized array of float) 0:37 Constant: 0:37 0 (const int) 0:37 Constant: @@ -199,21 +202,21 @@ ERROR: node is still EOpNull! 0:? Sequence 0:71 move second child to first child ( temp int) 0:71 direct index ( temp int) -0:71 'uns' ( temp implicitly-sized array of int) +0:71 'uns' ( temp unsized 4-element array of int) 0:71 Constant: 0:71 3 (const int) 0:71 Constant: 0:71 40 (const int) 0:72 move second child to first child ( temp int) 0:72 direct index ( temp int) -0:72 'uns' ( temp implicitly-sized array of int) +0:72 'uns' ( temp unsized 4-element array of int) 0:72 Constant: 0:72 1 (const int) 0:72 Constant: 0:72 30 (const int) 0:73 move second child to first child ( temp 3-component vector of float) 0:73 direct index ( temp 3-component vector of float) -0:73 'guns' ( global implicitly-sized array of 3-component vector of float) +0:73 'guns' ( global unsized 8-element array of 3-component vector of float) 0:73 Constant: 0:73 2 (const int) 0:73 Constant: @@ -222,11 +225,11 @@ ERROR: node is still EOpNull! 0:73 2.400000 0:76 Constant: 0:76 0.000000 -0:79 Function Definition: foo2( ( global implicitly-sized array of float) +0:79 Function Definition: foo2( ( global unsized 1-element array of float) 0:79 Function Parameters: 0:? Sequence 0:82 Branch: Return with expression -0:82 'f' ( temp implicitly-sized array of float) +0:82 'f' ( temp unsized 1-element array of float) 0:84 Branch: Return with expression 0:84 'g' ( temp 9-element array of float) 0:89 Function Definition: foo3( ( global void) @@ -264,17 +267,28 @@ ERROR: node is still EOpNull! 0:106 'b' ( global float) 0:106 Constant: 0:106 0.000000 +0:109 Function Definition: foo4( ( global void) +0:109 Function Parameters: +0:111 Sequence +0:111 indirect index ( temp sampler2D) +0:111 's2d' ( uniform runtime-sized array of sampler2D) +0:111 'a' ( uniform int) +0:112 Sequence +0:112 move second child to first child ( temp unsized 1-element array of float) +0:112 'local' ( temp unsized 1-element array of float) +0:112 'gUnusedUnsized' ( global unsized 1-element array of float) 0:? Linker Objects -0:? 'gu' ( global implicitly-sized array of float) +0:? 'gu' ( global runtime-sized array of float) 0:? 'g4' ( global 4-element array of float) 0:? 'g5' ( global 5-element array of float) 0:? 'a' ( uniform int) -0:? 'guns' ( global implicitly-sized array of 3-component vector of float) +0:? 'guns' ( global unsized 8-element array of 3-component vector of float) 0:? 'f' ( global float) -0:? 'gUnusedUnsized' ( global implicitly-sized array of float) -0:? 'i' ( global implicitly-sized array of int) -0:? 'emptyA' ( global implicitly-sized array of float) +0:? 'gUnusedUnsized' ( global unsized 1-element array of float) +0:? 'i' ( global unsized 1-element array of int) +0:? 'emptyA' ( global unsized 1-element array of float) 0:? 'b' ( global float) +0:? 's2d' ( uniform runtime-sized array of sampler2D) Linked fragment stage: @@ -320,21 +334,21 @@ ERROR: node is still EOpNull! 0:21 4.000000 0:24 move second child to first child ( temp float) 0:24 direct index ( temp float) -0:24 'gu' ( global 4-element array of float) +0:24 'gu' ( global runtime-sized array of float) 0:24 Constant: 0:24 2 (const int) 0:24 Constant: 0:24 4.000000 0:26 move second child to first child ( temp float) 0:26 direct index ( temp float) -0:26 'gu' ( global 4-element array of float) +0:26 'gu' ( global runtime-sized array of float) 0:26 Constant: 0:26 3 (const int) 0:26 Constant: 0:26 3.000000 0:27 move second child to first child ( temp float) 0:27 indirect index ( temp float) -0:27 'gu' ( global 4-element array of float) +0:27 'gu' ( global runtime-sized array of float) 0:27 'a' ( uniform int) 0:27 Constant: 0:27 5.000000 @@ -343,7 +357,7 @@ ERROR: node is still EOpNull! 0:29 Function Call: foo(f1[5]; ( global 4-element array of float) 0:29 'g5' ( global 5-element array of float) 0:30 'g5' ( global 5-element array of float) -0:31 'gu' ( global 4-element array of float) +0:31 'gu' ( global runtime-sized array of float) 0:33 Constant: 0:33 0.000000 0:34 Function Call: bar(f1[5]; ( global void) @@ -360,7 +374,7 @@ ERROR: node is still EOpNull! 0:36 true case 0:37 move second child to first child ( temp float) 0:37 direct index ( temp float) -0:37 'gu' ( global 4-element array of float) +0:37 'gu' ( global runtime-sized array of float) 0:37 Constant: 0:37 0 (const int) 0:37 Constant: @@ -452,7 +466,7 @@ ERROR: node is still EOpNull! 0:106 Constant: 0:106 0.000000 0:? Linker Objects -0:? 'gu' ( global 4-element array of float) +0:? 'gu' ( global runtime-sized array of float) 0:? 'g4' ( global 4-element array of float) 0:? 'g5' ( global 5-element array of float) 0:? 'a' ( uniform int) @@ -462,4 +476,5 @@ ERROR: node is still EOpNull! 0:? 'i' ( global 1-element array of int) 0:? 'emptyA' ( global 1-element array of float) 0:? 'b' ( global float) +0:? 's2d' ( uniform runtime-sized array of sampler2D) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array100.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array100.frag.out index b99d8174392..e6f9f8dc194 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array100.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/array100.frag.out @@ -10,7 +10,7 @@ ERROR: 0:24: 'array assignment' : not supported for this version or the enabled ERROR: 0:25: 'array assignment' : not supported for this version or the enabled extensions ERROR: 0:25: 'assign' : cannot convert from ' global 4-element array of mediump float' to ' global 5-element array of mediump float' ERROR: 0:26: 'array assignment' : not supported for this version or the enabled extensions -ERROR: 0:26: 'assign' : cannot convert from ' global 4-element array of mediump float' to ' global implicitly-sized array of mediump float' +ERROR: 0:26: 'assign' : cannot convert from ' global 4-element array of mediump float' to ' global unsized 1-element array of mediump float' ERROR: 0:28: 'foo' : no matching overloaded function found ERROR: 0:31: 'arrayed constructor' : not supported for this version or the enabled extensions ERROR: 0:31: 'array comparison' : not supported for this version or the enabled extensions @@ -67,7 +67,7 @@ ERROR: node is still EOpNull! 0:24 Function Call: foo(f1[5]; ( global 4-element array of mediump float) 0:24 'g5' ( global 5-element array of mediump float) 0:25 'g5' ( global 5-element array of mediump float) -0:26 'gu' ( global implicitly-sized array of mediump float) +0:26 'gu' ( global unsized 1-element array of mediump float) 0:28 Constant: 0:28 0.000000 0:29 Function Call: bar(f1[5]; ( global void) @@ -84,7 +84,7 @@ ERROR: node is still EOpNull! 0:31 true case 0:32 move second child to first child ( temp mediump float) 0:32 direct index ( temp mediump float) -0:32 'gu' ( global implicitly-sized array of mediump float) +0:32 'gu' ( global unsized 1-element array of mediump float) 0:32 Constant: 0:32 0 (const int) 0:32 Constant: @@ -152,7 +152,7 @@ ERROR: node is still EOpNull! 0:69 'initSb' ( temp structure{ global mediump 4-component vector of float v4, global structure{ global mediump 3-component vector of float v3, global 4-element array of mediump 2-component vector of float v2} sa}) 0:69 's1' ( temp structure{ global mediump 4-component vector of float v4, global structure{ global mediump 3-component vector of float v3, global 4-element array of mediump 2-component vector of float v2} sa}) 0:? Linker Objects -0:? 'gu' ( global implicitly-sized array of mediump float) +0:? 'gu' ( global unsized 1-element array of mediump float) 0:? 'g4' ( global 4-element array of mediump float) 0:? 'g5' ( global 5-element array of mediump float) 0:? 'a' ( uniform mediump int) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/atomic_uint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/atomic_uint.frag.out index e2773f9eb9e..c705a063e86 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/atomic_uint.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/atomic_uint.frag.out @@ -2,7 +2,6 @@ atomic_uint.frag ERROR: 0:10: 'atomic_uint' : samplers and atomic_uints cannot be output parameters ERROR: 0:12: 'return' : type does not match, or is not convertible to, the function's return type ERROR: 0:18: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: non_uniform_counter -ERROR: 0:18: 'atomic_uint' : layout(binding=X) is required ERROR: 0:23: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings ERROR: 0:28: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( binding=0 offset=0) uniform atomic_uint' and a right operand of type 'layout( binding=0 offset=0) uniform atomic_uint' (or there is no acceptable conversion) ERROR: 0:29: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( binding=0 offset=0) uniform atomic_uint (or there is no acceptable conversion) @@ -10,14 +9,10 @@ ERROR: 0:31: '[]' : scalar integer expression required ERROR: 0:34: 'assign' : l-value required "counter" (can't modify a uniform) ERROR: 0:34: 'assign' : cannot convert from ' const int' to 'layout( binding=0 offset=0) uniform atomic_uint' ERROR: 0:37: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acin -ERROR: 0:37: 'atomic_uint' : layout(binding=X) is required ERROR: 0:38: 'atomic_uint' : atomic_uints can only be used in uniform variables or function parameters: acg -ERROR: 0:38: 'atomic_uint' : layout(binding=X) is required -ERROR: 0:40: 'atomic_uint' : layout(binding=X) is required -ERROR: 0:46: 'atomic_uint' : layout(binding=X) is required ERROR: 0:47: 'offset' : atomic counters sharing the same offset: 12 ERROR: 0:48: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings -ERROR: 18 compilation errors. No code generated. +ERROR: 13 compilation errors. No code generated. Shader version: 420 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/compoundsuffix.frag.hlsl b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/compoundsuffix.frag.hlsl new file mode 100644 index 00000000000..f47c97dc8e6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/compoundsuffix.frag.hlsl @@ -0,0 +1,45 @@ +compoundsuffix.frag.hlsl +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 22 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 20 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 11 "@main(vf4;" + Name 10 "fragColor" + Name 15 "fragColor" + Name 16 "param" + Name 20 "fragColor" + Decorate 20(fragColor) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeFunction 2 8(ptr) + 13: 6(float) Constant 1065353216 + 14: 7(fvec4) ConstantComposite 13 13 13 13 + 19: TypePointer Output 7(fvec4) + 20(fragColor): 19(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 15(fragColor): 8(ptr) Variable Function + 16(param): 8(ptr) Variable Function + 17: 2 FunctionCall 11(@main(vf4;) 16(param) + 18: 7(fvec4) Load 16(param) + Store 15(fragColor) 18 + 21: 7(fvec4) Load 15(fragColor) + Store 20(fragColor) 21 + Return + FunctionEnd + 11(@main(vf4;): 2 Function None 9 + 10(fragColor): 8(ptr) FunctionParameter + 12: Label + Store 10(fragColor) 14 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/compoundsuffix.vert.glsl b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/compoundsuffix.vert.glsl new file mode 100644 index 00000000000..58354a409d0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/compoundsuffix.vert.glsl @@ -0,0 +1,15 @@ +compoundsuffix.vert.glsl +Shader version: 100 +0:? Sequence +0:1 Function Definition: main( ( global void) +0:1 Function Parameters: +0:3 Sequence +0:3 move second child to first child ( temp highp 4-component vector of float) +0:3 'gl_Position' ( gl_Position highp 4-component vector of float Position) +0:3 Constant: +0:3 1.000000 +0:3 1.000000 +0:3 1.000000 +0:3 1.000000 +0:? Linker Objects + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFold.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFold.frag.out index 33cfcbafedb..2a48c421e82 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFold.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFold.frag.out @@ -179,6 +179,10 @@ ERROR: node is still EOpNull! 0:83 2147483647 (const int) 0:84 Constant: 0:84 +1.#INF +0:84 Constant: +0:84 -1.#INF +0:84 Constant: +0:84 1.#IND 0:88 Constant: 0:88 2 (const uint) 0:88 3 (const uint) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFoldIntMin.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFoldIntMin.frag.out index da5bc26b870..2c45ca8018e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFoldIntMin.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constFoldIntMin.frag.out @@ -10,7 +10,7 @@ Requested GL_ARB_gpu_shader_int64 0:6 move second child to first child ( temp int16_t) 0:6 'u' ( temp int16_t) 0:6 Constant: -0:6 32768 (const int) +0:6 -32768 (const int16_t) 0:7 Sequence 0:7 move second child to first child ( temp int) 0:7 'v' ( temp int) @@ -25,7 +25,7 @@ Requested GL_ARB_gpu_shader_int64 0:9 move second child to first child ( temp int16_t) 0:9 'x' ( temp int16_t) 0:9 Constant: -0:9 0 (const int) +0:9 0 (const int8_t) 0:10 Sequence 0:10 move second child to first child ( temp int) 0:10 'y' ( temp int) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constantUnaryConversion.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constantUnaryConversion.comp.out new file mode 100644 index 00000000000..de705e4426d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/constantUnaryConversion.comp.out @@ -0,0 +1,645 @@ +constantUnaryConversion.comp +Shader version: 450 +Requested GL_KHX_shader_explicit_arithmetic_types +local_size = (1, 1, 1) +0:? Sequence +0:48 Function Definition: main( ( global void) +0:48 Function Parameters: +0:? Linker Objects +0:? 'bool_init' ( const bool) +0:? true (const bool) +0:? 'int8_t_init' ( const int8_t) +0:? -1 (const int) +0:? 'int16_t_init' ( const int16_t) +0:? -2 (const int) +0:? 'int32_t_init' ( const int) +0:? -3 (const int) +0:? 'int64_t_init' ( const int64_t) +0:? -4 (const int64_t) +0:? 'uint8_t_init' ( const uint8_t) +0:? 1 (const int) +0:? 'uint16_t_init' ( const uint16_t) +0:? 2 (const int) +0:? 'uint32_t_init' ( const uint) +0:? 3 (const uint) +0:? 'uint64_t_init' ( const uint64_t) +0:? 4 (const uint64_t) +0:? 'float16_t_init' ( const float16_t) +0:? 42.000000 +0:? 'float32_t_init' ( const float) +0:? 13.000000 +0:? 'float64_t_init' ( const double) +0:? -4.000000 +0:? 'bool_to_bool' ( const bool) +0:? true (const bool) +0:? 'int8_t_to_bool' ( const bool) +0:? -1 (const int) +0:? 'int16_t_to_bool' ( const bool) +0:? -2 (const int) +0:? 'int32_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'int64_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'uint8_t_to_bool' ( const bool) +0:? 1 (const int) +0:? 'uint16_t_to_bool' ( const bool) +0:? 2 (const int) +0:? 'uint32_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'uint64_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'float16_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'float32_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'float64_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'bool_to_int8_t' ( const int8_t) +0:? true (const bool) +0:? 'int8_t_to_int8_t' ( const int8_t) +0:? -1 (const int) +0:? 'int16_t_to_int8_t' ( const int8_t) +0:? -2 (const int) +0:? 'int32_t_to_int8_t' ( const int8_t) +0:? -3 (const int) +0:? 'int64_t_to_int8_t' ( const int8_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_int8_t' ( const int8_t) +0:? 1 (const int) +0:? 'uint16_t_to_int8_t' ( const int8_t) +0:? 2 (const int) +0:? 'uint32_t_to_int8_t' ( const int8_t) +0:? 3 (const uint) +0:? 'uint64_t_to_int8_t' ( const int8_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_int8_t' ( const int8_t) +0:? 42.000000 +0:? 'float32_t_to_int8_t' ( const int8_t) +0:? 13.000000 +0:? 'float64_t_to_int8_t' ( const int8_t) +0:? -4.000000 +0:? 'bool_to_int16_t' ( const int16_t) +0:? true (const bool) +0:? 'int8_t_to_int16_t' ( const int16_t) +0:? -1 (const int) +0:? 'int16_t_to_int16_t' ( const int16_t) +0:? -2 (const int) +0:? 'int32_t_to_int16_t' ( const int16_t) +0:? -3 (const int) +0:? 'int64_t_to_int16_t' ( const int16_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_int16_t' ( const int16_t) +0:? 1 (const int) +0:? 'uint16_t_to_int16_t' ( const int16_t) +0:? 2 (const int) +0:? 'uint32_t_to_int16_t' ( const int16_t) +0:? 3 (const uint) +0:? 'uint64_t_to_int16_t' ( const int16_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_int16_t' ( const int16_t) +0:? 42.000000 +0:? 'float32_t_to_int16_t' ( const int16_t) +0:? 13.000000 +0:? 'float64_t_to_int16_t' ( const int16_t) +0:? -4.000000 +0:? 'bool_to_int32_t' ( const int) +0:? 1 (const int) +0:? 'int8_t_to_int32_t' ( const int) +0:? -1 (const int) +0:? 'int16_t_to_int32_t' ( const int) +0:? -2 (const int) +0:? 'int32_t_to_int32_t' ( const int) +0:? -3 (const int) +0:? 'int64_t_to_int32_t' ( const int) +0:? -4 (const int) +0:? 'uint8_t_to_int32_t' ( const int) +0:? 1 (const int) +0:? 'uint16_t_to_int32_t' ( const int) +0:? 2 (const int) +0:? 'uint32_t_to_int32_t' ( const int) +0:? 3 (const int) +0:? 'uint64_t_to_int32_t' ( const int) +0:? 4 (const int) +0:? 'float16_t_to_int32_t' ( const int) +0:? 42 (const int) +0:? 'float32_t_to_int32_t' ( const int) +0:? 13 (const int) +0:? 'float64_t_to_int32_t' ( const int) +0:? -4 (const int) +0:? 'bool_to_int64_t' ( const int64_t) +0:? 1 (const int64_t) +0:? 'int8_t_to_int64_t' ( const int64_t) +0:? -1 (const int) +0:? 'int16_t_to_int64_t' ( const int64_t) +0:? -2 (const int) +0:? 'int32_t_to_int64_t' ( const int64_t) +0:? -3 (const int64_t) +0:? 'int64_t_to_int64_t' ( const int64_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_int64_t' ( const int64_t) +0:? 1 (const int) +0:? 'uint16_t_to_int64_t' ( const int64_t) +0:? 2 (const int) +0:? 'uint32_t_to_int64_t' ( const int64_t) +0:? 3 (const int64_t) +0:? 'uint64_t_to_int64_t' ( const int64_t) +0:? 4 (const int64_t) +0:? 'float16_t_to_int64_t' ( const int64_t) +0:? 42 (const int64_t) +0:? 'float32_t_to_int64_t' ( const int64_t) +0:? 13 (const int64_t) +0:? 'float64_t_to_int64_t' ( const int64_t) +0:? -4 (const int64_t) +0:? 'bool_to_uint8_t' ( const uint8_t) +0:? true (const bool) +0:? 'int8_t_to_uint8_t' ( const uint8_t) +0:? -1 (const int) +0:? 'int16_t_to_uint8_t' ( const uint8_t) +0:? -2 (const int) +0:? 'int32_t_to_uint8_t' ( const uint8_t) +0:? -3 (const int) +0:? 'int64_t_to_uint8_t' ( const uint8_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_uint8_t' ( const uint8_t) +0:? 1 (const int) +0:? 'uint16_t_to_uint8_t' ( const uint8_t) +0:? 2 (const int) +0:? 'uint32_t_to_uint8_t' ( const uint8_t) +0:? 3 (const uint) +0:? 'uint64_t_to_uint8_t' ( const uint8_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_uint8_t' ( const uint8_t) +0:? 42.000000 +0:? 'float32_t_to_uint8_t' ( const uint8_t) +0:? 13.000000 +0:? 'float64_t_to_uint8_t' ( const uint8_t) +0:? -4.000000 +0:? 'bool_to_uint16_t' ( const uint16_t) +0:? true (const bool) +0:? 'int8_t_to_uint16_t' ( const uint16_t) +0:? -1 (const int) +0:? 'int16_t_to_uint16_t' ( const uint16_t) +0:? -2 (const int) +0:? 'int32_t_to_uint16_t' ( const uint16_t) +0:? -3 (const int) +0:? 'int64_t_to_uint16_t' ( const uint16_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_uint16_t' ( const uint16_t) +0:? 1 (const int) +0:? 'uint16_t_to_uint16_t' ( const uint16_t) +0:? 2 (const int) +0:? 'uint32_t_to_uint16_t' ( const uint16_t) +0:? 3 (const uint) +0:? 'uint64_t_to_uint16_t' ( const uint16_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_uint16_t' ( const uint16_t) +0:? 42.000000 +0:? 'float32_t_to_uint16_t' ( const uint16_t) +0:? 13.000000 +0:? 'float64_t_to_uint16_t' ( const uint16_t) +0:? -4.000000 +0:? 'bool_to_uint32_t' ( const uint) +0:? 1 (const uint) +0:? 'int8_t_to_uint32_t' ( const uint) +0:? -1 (const int) +0:? 'int16_t_to_uint32_t' ( const uint) +0:? -2 (const int) +0:? 'int32_t_to_uint32_t' ( const uint) +0:? 4294967293 (const uint) +0:? 'int64_t_to_uint32_t' ( const uint) +0:? 4294967292 (const uint) +0:? 'uint8_t_to_uint32_t' ( const uint) +0:? 1 (const int) +0:? 'uint16_t_to_uint32_t' ( const uint) +0:? 2 (const int) +0:? 'uint32_t_to_uint32_t' ( const uint) +0:? 3 (const uint) +0:? 'uint64_t_to_uint32_t' ( const uint) +0:? 4 (const uint) +0:? 'float16_t_to_uint32_t' ( const uint) +0:? 42 (const uint) +0:? 'float32_t_to_uint32_t' ( const uint) +0:? 13 (const uint) +0:? 'float64_t_to_uint32_t' ( const uint) +0:? 4294967292 (const uint) +0:? 'bool_to_uint64_t' ( const uint64_t) +0:? 1 (const uint64_t) +0:? 'int8_t_to_uint64_t' ( const uint64_t) +0:? -1 (const int) +0:? 'int16_t_to_uint64_t' ( const uint64_t) +0:? -2 (const int) +0:? 'int32_t_to_uint64_t' ( const uint64_t) +0:? 18446744073709551613 (const uint64_t) +0:? 'int64_t_to_uint64_t' ( const uint64_t) +0:? 18446744073709551612 (const uint64_t) +0:? 'uint8_t_to_uint64_t' ( const uint64_t) +0:? 1 (const int) +0:? 'uint16_t_to_uint64_t' ( const uint64_t) +0:? 2 (const int) +0:? 'uint32_t_to_uint64_t' ( const uint64_t) +0:? 3 (const uint64_t) +0:? 'uint64_t_to_uint64_t' ( const uint64_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_uint64_t' ( const uint64_t) +0:? 42 (const uint64_t) +0:? 'float32_t_to_uint64_t' ( const uint64_t) +0:? 13 (const uint64_t) +0:? 'float64_t_to_uint64_t' ( const uint64_t) +0:? 18446744073709551612 (const uint64_t) +0:? 'bool_to_float16_t' ( const float16_t) +0:? 1.000000 +0:? 'int8_t_to_float16_t' ( const float16_t) +0:? -1 (const int) +0:? 'int16_t_to_float16_t' ( const float16_t) +0:? -2 (const int) +0:? 'int32_t_to_float16_t' ( const float16_t) +0:? -3.000000 +0:? 'int64_t_to_float16_t' ( const float16_t) +0:? -4.000000 +0:? 'uint8_t_to_float16_t' ( const float16_t) +0:? 1 (const int) +0:? 'uint16_t_to_float16_t' ( const float16_t) +0:? 2 (const int) +0:? 'uint32_t_to_float16_t' ( const float16_t) +0:? 3.000000 +0:? 'uint64_t_to_float16_t' ( const float16_t) +0:? 4.000000 +0:? 'float16_t_to_float16_t' ( const float16_t) +0:? 42.000000 +0:? 'float32_t_to_float16_t' ( const float16_t) +0:? 13.000000 +0:? 'float64_t_to_float16_t' ( const float16_t) +0:? -4.000000 +0:? 'bool_to_float32_t' ( const float) +0:? 1.000000 +0:? 'int8_t_to_float32_t' ( const float) +0:? -1 (const int) +0:? 'int16_t_to_float32_t' ( const float) +0:? -2 (const int) +0:? 'int32_t_to_float32_t' ( const float) +0:? -3.000000 +0:? 'int64_t_to_float32_t' ( const float) +0:? -4.000000 +0:? 'uint8_t_to_float32_t' ( const float) +0:? 1 (const int) +0:? 'uint16_t_to_float32_t' ( const float) +0:? 2 (const int) +0:? 'uint32_t_to_float32_t' ( const float) +0:? 3.000000 +0:? 'uint64_t_to_float32_t' ( const float) +0:? 4.000000 +0:? 'float16_t_to_float32_t' ( const float) +0:? 42.000000 +0:? 'float32_t_to_float32_t' ( const float) +0:? 13.000000 +0:? 'float64_t_to_float32_t' ( const float) +0:? -4.000000 +0:? 'bool_to_float64_t' ( const double) +0:? 1.000000 +0:? 'int8_t_to_float64_t' ( const double) +0:? -1 (const int) +0:? 'int16_t_to_float64_t' ( const double) +0:? -2 (const int) +0:? 'int32_t_to_float64_t' ( const double) +0:? -3.000000 +0:? 'int64_t_to_float64_t' ( const double) +0:? -4.000000 +0:? 'uint8_t_to_float64_t' ( const double) +0:? 1 (const int) +0:? 'uint16_t_to_float64_t' ( const double) +0:? 2 (const int) +0:? 'uint32_t_to_float64_t' ( const double) +0:? 3.000000 +0:? 'uint64_t_to_float64_t' ( const double) +0:? 4.000000 +0:? 'float16_t_to_float64_t' ( const double) +0:? 42.000000 +0:? 'float32_t_to_float64_t' ( const double) +0:? 13.000000 +0:? 'float64_t_to_float64_t' ( const double) +0:? -4.000000 + + +Linked compute stage: + + +Shader version: 450 +Requested GL_KHX_shader_explicit_arithmetic_types +local_size = (1, 1, 1) +0:? Sequence +0:48 Function Definition: main( ( global void) +0:48 Function Parameters: +0:? Linker Objects +0:? 'bool_init' ( const bool) +0:? true (const bool) +0:? 'int8_t_init' ( const int8_t) +0:? -1 (const int) +0:? 'int16_t_init' ( const int16_t) +0:? -2 (const int) +0:? 'int32_t_init' ( const int) +0:? -3 (const int) +0:? 'int64_t_init' ( const int64_t) +0:? -4 (const int64_t) +0:? 'uint8_t_init' ( const uint8_t) +0:? 1 (const int) +0:? 'uint16_t_init' ( const uint16_t) +0:? 2 (const int) +0:? 'uint32_t_init' ( const uint) +0:? 3 (const uint) +0:? 'uint64_t_init' ( const uint64_t) +0:? 4 (const uint64_t) +0:? 'float16_t_init' ( const float16_t) +0:? 42.000000 +0:? 'float32_t_init' ( const float) +0:? 13.000000 +0:? 'float64_t_init' ( const double) +0:? -4.000000 +0:? 'bool_to_bool' ( const bool) +0:? true (const bool) +0:? 'int8_t_to_bool' ( const bool) +0:? -1 (const int) +0:? 'int16_t_to_bool' ( const bool) +0:? -2 (const int) +0:? 'int32_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'int64_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'uint8_t_to_bool' ( const bool) +0:? 1 (const int) +0:? 'uint16_t_to_bool' ( const bool) +0:? 2 (const int) +0:? 'uint32_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'uint64_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'float16_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'float32_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'float64_t_to_bool' ( const bool) +0:? true (const bool) +0:? 'bool_to_int8_t' ( const int8_t) +0:? true (const bool) +0:? 'int8_t_to_int8_t' ( const int8_t) +0:? -1 (const int) +0:? 'int16_t_to_int8_t' ( const int8_t) +0:? -2 (const int) +0:? 'int32_t_to_int8_t' ( const int8_t) +0:? -3 (const int) +0:? 'int64_t_to_int8_t' ( const int8_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_int8_t' ( const int8_t) +0:? 1 (const int) +0:? 'uint16_t_to_int8_t' ( const int8_t) +0:? 2 (const int) +0:? 'uint32_t_to_int8_t' ( const int8_t) +0:? 3 (const uint) +0:? 'uint64_t_to_int8_t' ( const int8_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_int8_t' ( const int8_t) +0:? 42.000000 +0:? 'float32_t_to_int8_t' ( const int8_t) +0:? 13.000000 +0:? 'float64_t_to_int8_t' ( const int8_t) +0:? -4.000000 +0:? 'bool_to_int16_t' ( const int16_t) +0:? true (const bool) +0:? 'int8_t_to_int16_t' ( const int16_t) +0:? -1 (const int) +0:? 'int16_t_to_int16_t' ( const int16_t) +0:? -2 (const int) +0:? 'int32_t_to_int16_t' ( const int16_t) +0:? -3 (const int) +0:? 'int64_t_to_int16_t' ( const int16_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_int16_t' ( const int16_t) +0:? 1 (const int) +0:? 'uint16_t_to_int16_t' ( const int16_t) +0:? 2 (const int) +0:? 'uint32_t_to_int16_t' ( const int16_t) +0:? 3 (const uint) +0:? 'uint64_t_to_int16_t' ( const int16_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_int16_t' ( const int16_t) +0:? 42.000000 +0:? 'float32_t_to_int16_t' ( const int16_t) +0:? 13.000000 +0:? 'float64_t_to_int16_t' ( const int16_t) +0:? -4.000000 +0:? 'bool_to_int32_t' ( const int) +0:? 1 (const int) +0:? 'int8_t_to_int32_t' ( const int) +0:? -1 (const int) +0:? 'int16_t_to_int32_t' ( const int) +0:? -2 (const int) +0:? 'int32_t_to_int32_t' ( const int) +0:? -3 (const int) +0:? 'int64_t_to_int32_t' ( const int) +0:? -4 (const int) +0:? 'uint8_t_to_int32_t' ( const int) +0:? 1 (const int) +0:? 'uint16_t_to_int32_t' ( const int) +0:? 2 (const int) +0:? 'uint32_t_to_int32_t' ( const int) +0:? 3 (const int) +0:? 'uint64_t_to_int32_t' ( const int) +0:? 4 (const int) +0:? 'float16_t_to_int32_t' ( const int) +0:? 42 (const int) +0:? 'float32_t_to_int32_t' ( const int) +0:? 13 (const int) +0:? 'float64_t_to_int32_t' ( const int) +0:? -4 (const int) +0:? 'bool_to_int64_t' ( const int64_t) +0:? 1 (const int64_t) +0:? 'int8_t_to_int64_t' ( const int64_t) +0:? -1 (const int) +0:? 'int16_t_to_int64_t' ( const int64_t) +0:? -2 (const int) +0:? 'int32_t_to_int64_t' ( const int64_t) +0:? -3 (const int64_t) +0:? 'int64_t_to_int64_t' ( const int64_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_int64_t' ( const int64_t) +0:? 1 (const int) +0:? 'uint16_t_to_int64_t' ( const int64_t) +0:? 2 (const int) +0:? 'uint32_t_to_int64_t' ( const int64_t) +0:? 3 (const int64_t) +0:? 'uint64_t_to_int64_t' ( const int64_t) +0:? 4 (const int64_t) +0:? 'float16_t_to_int64_t' ( const int64_t) +0:? 42 (const int64_t) +0:? 'float32_t_to_int64_t' ( const int64_t) +0:? 13 (const int64_t) +0:? 'float64_t_to_int64_t' ( const int64_t) +0:? -4 (const int64_t) +0:? 'bool_to_uint8_t' ( const uint8_t) +0:? true (const bool) +0:? 'int8_t_to_uint8_t' ( const uint8_t) +0:? -1 (const int) +0:? 'int16_t_to_uint8_t' ( const uint8_t) +0:? -2 (const int) +0:? 'int32_t_to_uint8_t' ( const uint8_t) +0:? -3 (const int) +0:? 'int64_t_to_uint8_t' ( const uint8_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_uint8_t' ( const uint8_t) +0:? 1 (const int) +0:? 'uint16_t_to_uint8_t' ( const uint8_t) +0:? 2 (const int) +0:? 'uint32_t_to_uint8_t' ( const uint8_t) +0:? 3 (const uint) +0:? 'uint64_t_to_uint8_t' ( const uint8_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_uint8_t' ( const uint8_t) +0:? 42.000000 +0:? 'float32_t_to_uint8_t' ( const uint8_t) +0:? 13.000000 +0:? 'float64_t_to_uint8_t' ( const uint8_t) +0:? -4.000000 +0:? 'bool_to_uint16_t' ( const uint16_t) +0:? true (const bool) +0:? 'int8_t_to_uint16_t' ( const uint16_t) +0:? -1 (const int) +0:? 'int16_t_to_uint16_t' ( const uint16_t) +0:? -2 (const int) +0:? 'int32_t_to_uint16_t' ( const uint16_t) +0:? -3 (const int) +0:? 'int64_t_to_uint16_t' ( const uint16_t) +0:? -4 (const int64_t) +0:? 'uint8_t_to_uint16_t' ( const uint16_t) +0:? 1 (const int) +0:? 'uint16_t_to_uint16_t' ( const uint16_t) +0:? 2 (const int) +0:? 'uint32_t_to_uint16_t' ( const uint16_t) +0:? 3 (const uint) +0:? 'uint64_t_to_uint16_t' ( const uint16_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_uint16_t' ( const uint16_t) +0:? 42.000000 +0:? 'float32_t_to_uint16_t' ( const uint16_t) +0:? 13.000000 +0:? 'float64_t_to_uint16_t' ( const uint16_t) +0:? -4.000000 +0:? 'bool_to_uint32_t' ( const uint) +0:? 1 (const uint) +0:? 'int8_t_to_uint32_t' ( const uint) +0:? -1 (const int) +0:? 'int16_t_to_uint32_t' ( const uint) +0:? -2 (const int) +0:? 'int32_t_to_uint32_t' ( const uint) +0:? 4294967293 (const uint) +0:? 'int64_t_to_uint32_t' ( const uint) +0:? 4294967292 (const uint) +0:? 'uint8_t_to_uint32_t' ( const uint) +0:? 1 (const int) +0:? 'uint16_t_to_uint32_t' ( const uint) +0:? 2 (const int) +0:? 'uint32_t_to_uint32_t' ( const uint) +0:? 3 (const uint) +0:? 'uint64_t_to_uint32_t' ( const uint) +0:? 4 (const uint) +0:? 'float16_t_to_uint32_t' ( const uint) +0:? 42 (const uint) +0:? 'float32_t_to_uint32_t' ( const uint) +0:? 13 (const uint) +0:? 'float64_t_to_uint32_t' ( const uint) +0:? 4294967292 (const uint) +0:? 'bool_to_uint64_t' ( const uint64_t) +0:? 1 (const uint64_t) +0:? 'int8_t_to_uint64_t' ( const uint64_t) +0:? -1 (const int) +0:? 'int16_t_to_uint64_t' ( const uint64_t) +0:? -2 (const int) +0:? 'int32_t_to_uint64_t' ( const uint64_t) +0:? 18446744073709551613 (const uint64_t) +0:? 'int64_t_to_uint64_t' ( const uint64_t) +0:? 18446744073709551612 (const uint64_t) +0:? 'uint8_t_to_uint64_t' ( const uint64_t) +0:? 1 (const int) +0:? 'uint16_t_to_uint64_t' ( const uint64_t) +0:? 2 (const int) +0:? 'uint32_t_to_uint64_t' ( const uint64_t) +0:? 3 (const uint64_t) +0:? 'uint64_t_to_uint64_t' ( const uint64_t) +0:? 4 (const uint64_t) +0:? 'float16_t_to_uint64_t' ( const uint64_t) +0:? 42 (const uint64_t) +0:? 'float32_t_to_uint64_t' ( const uint64_t) +0:? 13 (const uint64_t) +0:? 'float64_t_to_uint64_t' ( const uint64_t) +0:? 18446744073709551612 (const uint64_t) +0:? 'bool_to_float16_t' ( const float16_t) +0:? 1.000000 +0:? 'int8_t_to_float16_t' ( const float16_t) +0:? -1 (const int) +0:? 'int16_t_to_float16_t' ( const float16_t) +0:? -2 (const int) +0:? 'int32_t_to_float16_t' ( const float16_t) +0:? -3.000000 +0:? 'int64_t_to_float16_t' ( const float16_t) +0:? -4.000000 +0:? 'uint8_t_to_float16_t' ( const float16_t) +0:? 1 (const int) +0:? 'uint16_t_to_float16_t' ( const float16_t) +0:? 2 (const int) +0:? 'uint32_t_to_float16_t' ( const float16_t) +0:? 3.000000 +0:? 'uint64_t_to_float16_t' ( const float16_t) +0:? 4.000000 +0:? 'float16_t_to_float16_t' ( const float16_t) +0:? 42.000000 +0:? 'float32_t_to_float16_t' ( const float16_t) +0:? 13.000000 +0:? 'float64_t_to_float16_t' ( const float16_t) +0:? -4.000000 +0:? 'bool_to_float32_t' ( const float) +0:? 1.000000 +0:? 'int8_t_to_float32_t' ( const float) +0:? -1 (const int) +0:? 'int16_t_to_float32_t' ( const float) +0:? -2 (const int) +0:? 'int32_t_to_float32_t' ( const float) +0:? -3.000000 +0:? 'int64_t_to_float32_t' ( const float) +0:? -4.000000 +0:? 'uint8_t_to_float32_t' ( const float) +0:? 1 (const int) +0:? 'uint16_t_to_float32_t' ( const float) +0:? 2 (const int) +0:? 'uint32_t_to_float32_t' ( const float) +0:? 3.000000 +0:? 'uint64_t_to_float32_t' ( const float) +0:? 4.000000 +0:? 'float16_t_to_float32_t' ( const float) +0:? 42.000000 +0:? 'float32_t_to_float32_t' ( const float) +0:? 13.000000 +0:? 'float64_t_to_float32_t' ( const float) +0:? -4.000000 +0:? 'bool_to_float64_t' ( const double) +0:? 1.000000 +0:? 'int8_t_to_float64_t' ( const double) +0:? -1 (const int) +0:? 'int16_t_to_float64_t' ( const double) +0:? -2 (const int) +0:? 'int32_t_to_float64_t' ( const double) +0:? -3.000000 +0:? 'int64_t_to_float64_t' ( const double) +0:? -4.000000 +0:? 'uint8_t_to_float64_t' ( const double) +0:? 1 (const int) +0:? 'uint16_t_to_float64_t' ( const double) +0:? 2 (const int) +0:? 'uint32_t_to_float64_t' ( const double) +0:? 3.000000 +0:? 'uint64_t_to_float64_t' ( const double) +0:? 4.000000 +0:? 'float16_t_to_float64_t' ( const double) +0:? 42.000000 +0:? 'float32_t_to_float64_t' ( const double) +0:? 13.000000 +0:? 'float64_t_to_float64_t' ( const double) +0:? -4.000000 + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad.vert.out index 1a2286aa917..a5267ff64a0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad.vert.out @@ -10,6 +10,7 @@ ERROR: 5 compilation errors. No code generated. Shader version: 100 ERROR: node is still EOpNull! 0:? Linker Objects +0:? 'n' ( global highp int) Linked vertex stage: @@ -19,4 +20,5 @@ ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry Shader version: 100 ERROR: node is still EOpNull! 0:? Linker Objects +0:? 'n' ( global highp int) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad2.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad2.vert.out index 0398e5e484c..af9ff386b15 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad2.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppBad2.vert.out @@ -1,7 +1,6 @@ cppBad2.vert ERROR: 0:3: 'macro expansion' : End of input in macro b -ERROR: 0:3: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. +ERROR: 1 compilation errors. No code generated. Shader version: 100 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppPassMacroName.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppPassMacroName.frag.out index d8459b3bc03..e09b00d7e21 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppPassMacroName.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppPassMacroName.frag.out @@ -1,33 +1,38 @@ cppPassMacroName.frag Shader version: 100 0:? Sequence -0:5 Function Definition: main( ( global void) -0:5 Function Parameters: -0:7 Sequence -0:7 Sequence -0:7 move second child to first child ( temp mediump int) -0:7 'f1' ( temp mediump int) -0:7 Constant: -0:7 4 (const int) -0:8 Sequence -0:8 move second child to first child ( temp mediump int) -0:8 'f2' ( temp mediump int) -0:8 'f1' ( temp mediump int) -0:9 Sequence -0:9 move second child to first child ( temp mediump int) -0:9 'f3' ( temp mediump int) -0:9 Constant: -0:9 9 (const int) -0:10 Sequence -0:10 move second child to first child ( temp mediump int) -0:10 'f4' ( temp mediump int) -0:10 Constant: -0:10 1 (const int) +0:9 Function Definition: main( ( global void) +0:9 Function Parameters: +0:11 Sequence 0:11 Sequence 0:11 move second child to first child ( temp mediump int) -0:11 'f5' ( temp mediump int) +0:11 'f1' ( temp mediump int) 0:11 Constant: -0:11 5 (const int) +0:11 4 (const int) +0:12 Sequence +0:12 move second child to first child ( temp mediump int) +0:12 'f2' ( temp mediump int) +0:12 'f1' ( temp mediump int) +0:13 Sequence +0:13 move second child to first child ( temp mediump int) +0:13 'f3' ( temp mediump int) +0:13 Constant: +0:13 9 (const int) +0:14 Sequence +0:14 move second child to first child ( temp mediump int) +0:14 'f4' ( temp mediump int) +0:14 Constant: +0:14 1 (const int) +0:15 Sequence +0:15 move second child to first child ( temp mediump int) +0:15 'f5' ( temp mediump int) +0:15 Constant: +0:15 5 (const int) +0:17 Sequence +0:17 move second child to first child ( temp highp float) +0:17 'fl_f5' ( temp highp float) +0:17 Constant: +0:17 0.460000 0:? Linker Objects @@ -36,32 +41,37 @@ Linked fragment stage: Shader version: 100 0:? Sequence -0:5 Function Definition: main( ( global void) -0:5 Function Parameters: -0:7 Sequence -0:7 Sequence -0:7 move second child to first child ( temp mediump int) -0:7 'f1' ( temp mediump int) -0:7 Constant: -0:7 4 (const int) -0:8 Sequence -0:8 move second child to first child ( temp mediump int) -0:8 'f2' ( temp mediump int) -0:8 'f1' ( temp mediump int) -0:9 Sequence -0:9 move second child to first child ( temp mediump int) -0:9 'f3' ( temp mediump int) -0:9 Constant: -0:9 9 (const int) -0:10 Sequence -0:10 move second child to first child ( temp mediump int) -0:10 'f4' ( temp mediump int) -0:10 Constant: -0:10 1 (const int) +0:9 Function Definition: main( ( global void) +0:9 Function Parameters: +0:11 Sequence 0:11 Sequence 0:11 move second child to first child ( temp mediump int) -0:11 'f5' ( temp mediump int) +0:11 'f1' ( temp mediump int) 0:11 Constant: -0:11 5 (const int) +0:11 4 (const int) +0:12 Sequence +0:12 move second child to first child ( temp mediump int) +0:12 'f2' ( temp mediump int) +0:12 'f1' ( temp mediump int) +0:13 Sequence +0:13 move second child to first child ( temp mediump int) +0:13 'f3' ( temp mediump int) +0:13 Constant: +0:13 9 (const int) +0:14 Sequence +0:14 move second child to first child ( temp mediump int) +0:14 'f4' ( temp mediump int) +0:14 Constant: +0:14 1 (const int) +0:15 Sequence +0:15 move second child to first child ( temp mediump int) +0:15 'f5' ( temp mediump int) +0:15 Constant: +0:15 5 (const int) +0:17 Sequence +0:17 move second child to first child ( temp highp float) +0:17 'fl_f5' ( temp highp float) +0:17 Constant: +0:17 0.460000 0:? Linker Objects diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppRelaxSkipTokensErrors.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppRelaxSkipTokensErrors.vert.out new file mode 100644 index 00000000000..e9b4b1b7a7c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppRelaxSkipTokensErrors.vert.out @@ -0,0 +1,14 @@ +cppRelaxSkipTokensErrors.vert +Shader version: 110 +0:? Sequence +0:? Linker Objects + + +Linked vertex stage: + +ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point + +Shader version: 110 +0:? Sequence +0:? Linker Objects + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppSimple.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppSimple.vert.out index edb0c3378a0..85beb4eb5de 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppSimple.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/cppSimple.vert.out @@ -35,9 +35,9 @@ ERROR: 0:155: '#else' : unexpected tokens following directive ERROR: 0:158: '#else' : #else after #else ERROR: 0:160: '#endif' : unexpected tokens following directive ERROR: 0:164: '#define' : duplicate macro parameter -ERROR: 0:173: '#define' : Macro redefined; different number of arguments: m4 -ERROR: 0:178: '#define' : Macro redefined; different number of arguments: m5 -ERROR: 0:182: '#define' : Macro redefined; different number of arguments: m6 +ERROR: 0:173: '#define' : Macro redefined; function-like versus object-like: m4 +ERROR: 0:177: '#define' : Macro redefined; function-like versus object-like: m5 +ERROR: 0:181: '#define' : Macro redefined; different number of arguments: m6 ERROR: 0:185: '#define' : Macro redefined; different substitutions: m7 ERROR: 0:192: '#define' : Macro redefined; different substitutions: m8 ERROR: 0:196: '#define' : Macro redefined; different argument names: m9 @@ -77,7 +77,7 @@ ERROR: 12:9000: 'preprocessor evaluation' : expected ')' ERROR: 12:9002: '#if' : unexpected tokens following directive ERROR: 12:9014: 'FOOOM' : undeclared identifier ERROR: 12:9014: '=' : cannot convert from ' temp float' to ' global int' -ERROR: 12:9016: 'preprocessor evaluation' : can't evaluate expression +ERROR: 12:9015: 'preprocessor evaluation' : can't evaluate expression ERROR: 12:9016: 'preprocessor evaluation' : bad expression ERROR: 12:9500: 'preprocessor evaluation' : bad expression ERROR: 12:9500: '#if' : unexpected tokens following directive @@ -134,7 +134,7 @@ ERROR: node is still EOpNull! 0:65 0.050000 0:69 move second child to first child ( temp 4-component vector of float) 0:69 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -0:69 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:69 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:69 Constant: 0:69 0 (const uint) 0:69 Construct vec4 ( temp 4-component vector of float) @@ -174,7 +174,7 @@ ERROR: node is still EOpNull! 12:20033 Sequence 12:20033 move second child to first child ( temp 4-component vector of float) 12:20033 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -12:20033 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +12:20033 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 12:20033 Constant: 12:20033 0 (const uint) 12:20033 Constant: @@ -188,7 +188,7 @@ ERROR: node is still EOpNull! 12:9011 'RECURSE' ( global int) 0:? Linker Objects 0:? 'sum' ( global float) -0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:? 'linenumber' ( global int) 0:? 'filenumber' ( global int) 0:? 'version' ( global int) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/findFunction.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/findFunction.frag.out new file mode 100644 index 00000000000..ec4f3e46d78 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/findFunction.frag.out @@ -0,0 +1,233 @@ +findFunction.frag +ERROR: 0:39: 'func' : ambiguous best function under implicit type conversion +ERROR: 0:40: 'func' : no matching overloaded function found +ERROR: 0:40: '=' : cannot convert from ' const float' to ' temp int64_t' +ERROR: 0:41: 'func' : no matching overloaded function found +ERROR: 0:41: '=' : cannot convert from ' const float' to ' temp int64_t' +ERROR: 0:44: 'func' : no matching overloaded function found +ERROR: 0:44: '=' : cannot convert from ' const float' to ' temp int64_t' +ERROR: 0:45: 'func' : ambiguous best function under implicit type conversion +ERROR: 8 compilation errors. No code generated. + + +Shader version: 450 +Requested GL_KHX_shader_explicit_arithmetic_types +ERROR: node is still EOpNull! +0:5 Function Definition: func(i81;i161;i161; ( global int64_t) +0:5 Function Parameters: +0:5 'a' ( in int8_t) +0:5 'b' ( in int16_t) +0:5 'c' ( in int16_t) +0:7 Sequence +0:7 Branch: Return with expression +0:7 Convert int16_t to int64 ( temp int64_t) +0:7 inclusive-or ( temp int16_t) +0:7 Convert int8_t to int16_t ( temp int16_t) +0:7 'a' ( in int8_t) +0:7 add ( temp int16_t) +0:7 'b' ( in int16_t) +0:7 'c' ( in int16_t) +0:10 Function Definition: func(i81;i161;i1; ( global int64_t) +0:10 Function Parameters: +0:10 'a' ( in int8_t) +0:10 'b' ( in int16_t) +0:10 'c' ( in int) +0:12 Sequence +0:12 Branch: Return with expression +0:12 Convert int to int64 ( temp int64_t) +0:12 inclusive-or ( temp int) +0:12 Convert int8_t to int ( temp int) +0:12 'a' ( in int8_t) +0:12 subtract ( temp int) +0:12 Convert int16_t to int ( temp int) +0:12 'b' ( in int16_t) +0:12 'c' ( in int) +0:15 Function Definition: func(i1;i1;i1; ( global int64_t) +0:15 Function Parameters: +0:15 'a' ( in int) +0:15 'b' ( in int) +0:15 'c' ( in int) +0:17 Sequence +0:17 Branch: Return with expression +0:17 Convert int to int64 ( temp int64_t) +0:17 add ( temp int) +0:17 divide ( temp int) +0:17 'a' ( in int) +0:17 'b' ( in int) +0:17 'c' ( in int) +0:20 Function Definition: func(f161;f161;f1; ( global int64_t) +0:20 Function Parameters: +0:20 'a' ( in float16_t) +0:20 'b' ( in float16_t) +0:20 'c' ( in float) +0:22 Sequence +0:22 Branch: Return with expression +0:22 Convert float to int64 ( temp int64_t) +0:22 subtract ( temp float) +0:22 Convert float16_t to float ( temp float) +0:22 'a' ( in float16_t) +0:22 component-wise multiply ( temp float) +0:22 Convert float16_t to float ( temp float) +0:22 'b' ( in float16_t) +0:22 'c' ( in float) +0:25 Function Definition: func(f161;i161;f1; ( global int64_t) +0:25 Function Parameters: +0:25 'a' ( in float16_t) +0:25 'b' ( in int16_t) +0:25 'c' ( in float) +0:27 Sequence +0:27 Branch: Return with expression +0:27 Convert float to int64 ( temp int64_t) +0:27 subtract ( temp float) +0:27 Convert float16_t to float ( temp float) +0:27 'a' ( in float16_t) +0:27 component-wise multiply ( temp float) +0:27 Convert int16_t to float ( temp float) +0:27 'b' ( in int16_t) +0:27 'c' ( in float) +0:30 Function Definition: main( ( global void) +0:30 Function Parameters: +0:? Sequence +0:38 Sequence +0:38 move second child to first child ( temp int64_t) +0:38 'b1' ( temp int64_t) +0:38 Function Call: func(i81;i161;i1; ( global int64_t) +0:38 'x' ( temp int8_t) +0:38 'y' ( temp int16_t) +0:38 'z' ( temp int) +0:39 Sequence +0:39 move second child to first child ( temp int64_t) +0:39 'b2' ( temp int64_t) +0:39 Function Call: func(f161;i161;f1; ( global int64_t) +0:39 Convert int16_t to float16_t ( temp float16_t) +0:39 'y' ( temp int16_t) +0:39 'y' ( temp int16_t) +0:39 Convert int to float ( temp float) +0:39 'z' ( temp int) +0:42 Sequence +0:42 move second child to first child ( temp int64_t) +0:42 'b5' ( temp int64_t) +0:42 Function Call: func(f161;i161;f1; ( global int64_t) +0:42 Convert int16_t to float16_t ( temp float16_t) +0:42 'y' ( temp int16_t) +0:42 'y' ( temp int16_t) +0:42 Convert float16_t to float ( temp float) +0:42 'f16' ( temp float16_t) +0:43 Sequence +0:43 move second child to first child ( temp int64_t) +0:43 'b7' ( temp int64_t) +0:43 Function Call: func(f161;f161;f1; ( global int64_t) +0:43 'f16' ( temp float16_t) +0:43 'f16' ( temp float16_t) +0:43 Convert int16_t to float ( temp float) +0:43 'y' ( temp int16_t) +0:45 Sequence +0:45 move second child to first child ( temp int64_t) +0:45 'b9' ( temp int64_t) +0:45 Function Call: func(f161;f161;f1; ( global int64_t) +0:45 'f16' ( temp float16_t) +0:45 Convert int8_t to float16_t ( temp float16_t) +0:45 'x' ( temp int8_t) +0:45 Convert float16_t to float ( temp float) +0:45 'f16' ( temp float16_t) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 450 +Requested GL_KHX_shader_explicit_arithmetic_types +ERROR: node is still EOpNull! +0:10 Function Definition: func(i81;i161;i1; ( global int64_t) +0:10 Function Parameters: +0:10 'a' ( in int8_t) +0:10 'b' ( in int16_t) +0:10 'c' ( in int) +0:12 Sequence +0:12 Branch: Return with expression +0:12 Convert int to int64 ( temp int64_t) +0:12 inclusive-or ( temp int) +0:12 Convert int8_t to int ( temp int) +0:12 'a' ( in int8_t) +0:12 subtract ( temp int) +0:12 Convert int16_t to int ( temp int) +0:12 'b' ( in int16_t) +0:12 'c' ( in int) +0:20 Function Definition: func(f161;f161;f1; ( global int64_t) +0:20 Function Parameters: +0:20 'a' ( in float16_t) +0:20 'b' ( in float16_t) +0:20 'c' ( in float) +0:22 Sequence +0:22 Branch: Return with expression +0:22 Convert float to int64 ( temp int64_t) +0:22 subtract ( temp float) +0:22 Convert float16_t to float ( temp float) +0:22 'a' ( in float16_t) +0:22 component-wise multiply ( temp float) +0:22 Convert float16_t to float ( temp float) +0:22 'b' ( in float16_t) +0:22 'c' ( in float) +0:25 Function Definition: func(f161;i161;f1; ( global int64_t) +0:25 Function Parameters: +0:25 'a' ( in float16_t) +0:25 'b' ( in int16_t) +0:25 'c' ( in float) +0:27 Sequence +0:27 Branch: Return with expression +0:27 Convert float to int64 ( temp int64_t) +0:27 subtract ( temp float) +0:27 Convert float16_t to float ( temp float) +0:27 'a' ( in float16_t) +0:27 component-wise multiply ( temp float) +0:27 Convert int16_t to float ( temp float) +0:27 'b' ( in int16_t) +0:27 'c' ( in float) +0:30 Function Definition: main( ( global void) +0:30 Function Parameters: +0:? Sequence +0:38 Sequence +0:38 move second child to first child ( temp int64_t) +0:38 'b1' ( temp int64_t) +0:38 Function Call: func(i81;i161;i1; ( global int64_t) +0:38 'x' ( temp int8_t) +0:38 'y' ( temp int16_t) +0:38 'z' ( temp int) +0:39 Sequence +0:39 move second child to first child ( temp int64_t) +0:39 'b2' ( temp int64_t) +0:39 Function Call: func(f161;i161;f1; ( global int64_t) +0:39 Convert int16_t to float16_t ( temp float16_t) +0:39 'y' ( temp int16_t) +0:39 'y' ( temp int16_t) +0:39 Convert int to float ( temp float) +0:39 'z' ( temp int) +0:42 Sequence +0:42 move second child to first child ( temp int64_t) +0:42 'b5' ( temp int64_t) +0:42 Function Call: func(f161;i161;f1; ( global int64_t) +0:42 Convert int16_t to float16_t ( temp float16_t) +0:42 'y' ( temp int16_t) +0:42 'y' ( temp int16_t) +0:42 Convert float16_t to float ( temp float) +0:42 'f16' ( temp float16_t) +0:43 Sequence +0:43 move second child to first child ( temp int64_t) +0:43 'b7' ( temp int64_t) +0:43 Function Call: func(f161;f161;f1; ( global int64_t) +0:43 'f16' ( temp float16_t) +0:43 'f16' ( temp float16_t) +0:43 Convert int16_t to float ( temp float) +0:43 'y' ( temp int16_t) +0:45 Sequence +0:45 move second child to first child ( temp int64_t) +0:45 'b9' ( temp int64_t) +0:45 Function Call: func(f161;f161;f1; ( global int64_t) +0:45 'f16' ( temp float16_t) +0:45 Convert int8_t to float16_t ( temp float16_t) +0:45 'x' ( temp int8_t) +0:45 Convert float16_t to float ( temp float) +0:45 'f16' ( temp float16_t) +0:? Linker Objects + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out index 6f4c9aebec8..c7ea97e043a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.bad.out @@ -2,7 +2,7 @@ glsl.entryPointRename.vert ERROR: Source entry point must be "main" // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.out index 7cc825bca58..3dbe13bae9d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glsl.entryPointRename.vert.out @@ -1,6 +1,6 @@ glsl.entryPointRename.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.frag.out index 49398073bf2..db752133c16 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.frag.out @@ -1,13 +1,15 @@ glspv.frag ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error ) ERROR: 0:6: '#error' : GL_SPIR is 100 +ERROR: 0:14: 'f' : non-opaque uniform variables need a layout(location=L) ERROR: 0:21: 'noise1' : no matching overloaded function found ERROR: 0:22: 'noise2' : no matching overloaded function found ERROR: 0:23: 'noise3' : no matching overloaded function found ERROR: 0:24: 'noise4' : no matching overloaded function found -ERROR: 0:27: 'input_attachment_index' : only allowed when using GLSL for Vulkan -ERROR: 0:27: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON -ERROR: 8 compilation errors. No code generated. +ERROR: 0:27: 'atomic_uint' : layout(binding=X) is required +ERROR: 0:28: 'input_attachment_index' : only allowed when using GLSL for Vulkan +ERROR: 0:28: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 10 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.version.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.version.frag.out index 30eb445201b..4a45b5bfd1f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.version.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/glspv.version.frag.out @@ -2,7 +2,7 @@ glspv.version.frag ERROR: #version: compilation for SPIR-V does not support the compatibility profile // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 6 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.PointSize.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.PointSize.geom.out new file mode 100644 index 00000000000..c21008d2850 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.PointSize.geom.out @@ -0,0 +1,147 @@ +hlsl.PointSize.geom +Shader version: 500 +invocations = -1 +max_vertices = 4 +input primitive = triangles +output primitive = line_strip +0:? Sequence +0:8 Function Definition: @main(u1[3];struct-S-f11; ( temp void) +0:8 Function Parameters: +0:8 'ps' ( in 3-element array of uint) +0:8 'OutputStream' ( out structure{ temp float ps}) +0:? Sequence +0:10 Sequence +0:10 Sequence +0:10 move second child to first child ( temp float) +0:? 'OutputStream.ps' ( out float PointSize) +0:10 ps: direct index for structure ( temp float) +0:10 's' ( temp structure{ temp float ps}) +0:10 Constant: +0:10 0 (const int) +0:10 EmitVertex ( temp void) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 move second child to first child ( temp 3-element array of uint) +0:? 'ps' ( temp 3-element array of uint) +0:? 'ps' ( in 3-element array of uint PointSize) +0:8 Function Call: @main(u1[3];struct-S-f11; ( temp void) +0:? 'ps' ( temp 3-element array of uint) +0:? 'OutputStream' ( temp structure{ temp float ps}) +0:? Linker Objects +0:? 'ps' ( in 3-element array of uint PointSize) +0:? 'OutputStream.ps' ( out float PointSize) + + +Linked geometry stage: + + +Shader version: 500 +invocations = 1 +max_vertices = 4 +input primitive = triangles +output primitive = line_strip +0:? Sequence +0:8 Function Definition: @main(u1[3];struct-S-f11; ( temp void) +0:8 Function Parameters: +0:8 'ps' ( in 3-element array of uint) +0:8 'OutputStream' ( out structure{ temp float ps}) +0:? Sequence +0:10 Sequence +0:10 Sequence +0:10 move second child to first child ( temp float) +0:? 'OutputStream.ps' ( out float PointSize) +0:10 ps: direct index for structure ( temp float) +0:10 's' ( temp structure{ temp float ps}) +0:10 Constant: +0:10 0 (const int) +0:10 EmitVertex ( temp void) +0:8 Function Definition: main( ( temp void) +0:8 Function Parameters: +0:? Sequence +0:8 move second child to first child ( temp 3-element array of uint) +0:? 'ps' ( temp 3-element array of uint) +0:? 'ps' ( in 3-element array of uint PointSize) +0:8 Function Call: @main(u1[3];struct-S-f11; ( temp void) +0:? 'ps' ( temp 3-element array of uint) +0:? 'OutputStream' ( temp structure{ temp float ps}) +0:? Linker Objects +0:? 'ps' ( in 3-element array of uint PointSize) +0:? 'OutputStream.ps' ( out float PointSize) + +error: SPIRV-Tools Validation Errors +error: According to the Vulkan spec BuiltIn PointSize variable needs to be a 32-bit float scalar. ID <28> (OpVariable) is not a float scalar. + %29 = OpLoad %_arr_uint_uint_3 %ps_1 + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 36 + + Capability Geometry + Capability GeometryPointSize + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Geometry 4 "main" 19 28 + ExecutionMode 4 Triangles + ExecutionMode 4 Invocations 1 + ExecutionMode 4 OutputLineStrip + ExecutionMode 4 OutputVertices 4 + Source HLSL 500 + Name 4 "main" + Name 11 "S" + MemberName 11(S) 0 "ps" + Name 16 "@main(u1[3];struct-S-f11;" + Name 14 "ps" + Name 15 "OutputStream" + Name 19 "OutputStream.ps" + Name 20 "s" + Name 26 "ps" + Name 28 "ps" + Name 30 "OutputStream" + Name 31 "param" + Name 33 "param" + Decorate 19(OutputStream.ps) BuiltIn PointSize + Decorate 28(ps) BuiltIn PointSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: 6(int) Constant 3 + 8: TypeArray 6(int) 7 + 9: TypePointer Function 8 + 10: TypeFloat 32 + 11(S): TypeStruct 10(float) + 12: TypePointer Function 11(S) + 13: TypeFunction 2 9(ptr) 12(ptr) + 18: TypePointer Output 10(float) +19(OutputStream.ps): 18(ptr) Variable Output + 21: TypeInt 32 1 + 22: 21(int) Constant 0 + 23: TypePointer Function 10(float) + 27: TypePointer Input 8 + 28(ps): 27(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 26(ps): 9(ptr) Variable Function +30(OutputStream): 12(ptr) Variable Function + 31(param): 9(ptr) Variable Function + 33(param): 12(ptr) Variable Function + 29: 8 Load 28(ps) + Store 26(ps) 29 + 32: 8 Load 26(ps) + Store 31(param) 32 + 34: 2 FunctionCall 16(@main(u1[3];struct-S-f11;) 31(param) 33(param) + 35: 11(S) Load 33(param) + Store 30(OutputStream) 35 + Return + FunctionEnd +16(@main(u1[3];struct-S-f11;): 2 Function None 13 + 14(ps): 9(ptr) FunctionParameter +15(OutputStream): 12(ptr) FunctionParameter + 17: Label + 20(s): 12(ptr) Variable Function + 24: 23(ptr) AccessChain 20(s) 22 + 25: 10(float) Load 24 + Store 19(OutputStream.ps) 25 + EmitVertex + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.PointSize.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.PointSize.vert.out new file mode 100644 index 00000000000..bda0030e1c4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.PointSize.vert.out @@ -0,0 +1,69 @@ +hlsl.PointSize.vert +Shader version: 500 +0:? Sequence +0:2 Function Definition: @main( ( temp float) +0:2 Function Parameters: +0:? Sequence +0:3 Branch: Return with expression +0:3 Constant: +0:3 2.300000 +0:2 Function Definition: main( ( temp void) +0:2 Function Parameters: +0:? Sequence +0:2 move second child to first child ( temp float) +0:? '@entryPointOutput' ( out float PointSize) +0:2 Function Call: @main( ( temp float) +0:? Linker Objects +0:? '@entryPointOutput' ( out float PointSize) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:2 Function Definition: @main( ( temp float) +0:2 Function Parameters: +0:? Sequence +0:3 Branch: Return with expression +0:3 Constant: +0:3 2.300000 +0:2 Function Definition: main( ( temp void) +0:2 Function Parameters: +0:? Sequence +0:2 move second child to first child ( temp float) +0:? '@entryPointOutput' ( out float PointSize) +0:2 Function Call: @main( ( temp float) +0:? Linker Objects +0:? '@entryPointOutput' ( out float PointSize) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 16 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 14 + Source HLSL 500 + Name 4 "main" + Name 8 "@main(" + Name 14 "@entryPointOutput" + Decorate 14(@entryPointOutput) BuiltIn PointSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeFunction 6(float) + 10: 6(float) Constant 1075000115 + 13: TypePointer Output 6(float) +14(@entryPointOutput): 13(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 15: 6(float) FunctionCall 8(@main() + Store 14(@entryPointOutput) 15 + Return + FunctionEnd + 8(@main(): 6(float) Function None 7 + 9: Label + ReturnValue 10 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.aliasOpaque.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.aliasOpaque.frag.out index 694d4044fb6..9928278da14 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.aliasOpaque.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.aliasOpaque.frag.out @@ -5,17 +5,24 @@ gl_FragCoord origin is upper left 0:? Sequence 0:12 Function Definition: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float) 0:12 Function Parameters: -0:? 's.ss' ( in sampler) -0:? 's.a' ( in float) -0:? 's.tex' ( in texture2D) +0:12 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) 0:? Sequence 0:13 Branch: Return with expression 0:13 vector-scale ( temp 4-component vector of float) -0:? 's.a' ( in float) +0:13 a: direct index for structure ( temp float) +0:13 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:13 Constant: +0:13 1 (const int) 0:13 texture ( temp 4-component vector of float) 0:13 Construct combined texture-sampler ( temp sampler2D) -0:? 's.tex' ( in texture2D) -0:? 's.ss' ( in sampler) +0:13 tex: direct index for structure ( temp texture2D) +0:13 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:13 Constant: +0:13 2 (const int) +0:13 ss: direct index for structure ( temp sampler) +0:13 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:13 Constant: +0:13 0 (const int) 0:? Constant: 0:? 0.200000 0:? 0.300000 @@ -23,23 +30,33 @@ gl_FragCoord origin is upper left 0:17 Function Parameters: 0:? Sequence 0:19 move second child to first child ( temp sampler) -0:? 'os.ss' ( temp sampler) +0:19 ss: direct index for structure ( temp sampler) +0:19 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:19 Constant: +0:19 0 (const int) 0:19 'gss2' ( uniform sampler) 0:20 move second child to first child ( temp sampler) -0:? 'os.ss' ( temp sampler) +0:20 ss: direct index for structure ( temp sampler) +0:20 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:20 Constant: +0:20 0 (const int) 0:20 'gss' ( uniform sampler) 0:21 move second child to first child ( temp texture2D) -0:? 'os.tex' ( temp texture2D) +0:21 tex: direct index for structure ( temp texture2D) +0:21 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:21 Constant: +0:21 2 (const int) 0:21 'gtex' ( uniform texture2D) 0:22 move second child to first child ( temp float) -0:? 'os.a' ( temp float) +0:22 a: direct index for structure ( temp float) +0:22 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:22 Constant: +0:22 1 (const int) 0:22 Constant: 0:22 3.000000 0:28 Branch: Return with expression 0:28 Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float) -0:? 'os.ss' ( temp sampler) -0:? 'os.a' ( temp float) -0:? 'os.tex' ( temp texture2D) +0:28 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) 0:17 Function Definition: main( ( temp void) 0:17 Function Parameters: 0:? Sequence @@ -61,17 +78,24 @@ gl_FragCoord origin is upper left 0:? Sequence 0:12 Function Definition: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float) 0:12 Function Parameters: -0:? 's.ss' ( in sampler) -0:? 's.a' ( in float) -0:? 's.tex' ( in texture2D) +0:12 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) 0:? Sequence 0:13 Branch: Return with expression 0:13 vector-scale ( temp 4-component vector of float) -0:? 's.a' ( in float) +0:13 a: direct index for structure ( temp float) +0:13 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:13 Constant: +0:13 1 (const int) 0:13 texture ( temp 4-component vector of float) 0:13 Construct combined texture-sampler ( temp sampler2D) -0:? 's.tex' ( in texture2D) -0:? 's.ss' ( in sampler) +0:13 tex: direct index for structure ( temp texture2D) +0:13 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:13 Constant: +0:13 2 (const int) +0:13 ss: direct index for structure ( temp sampler) +0:13 's' ( in structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:13 Constant: +0:13 0 (const int) 0:? Constant: 0:? 0.200000 0:? 0.300000 @@ -79,23 +103,33 @@ gl_FragCoord origin is upper left 0:17 Function Parameters: 0:? Sequence 0:19 move second child to first child ( temp sampler) -0:? 'os.ss' ( temp sampler) +0:19 ss: direct index for structure ( temp sampler) +0:19 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:19 Constant: +0:19 0 (const int) 0:19 'gss2' ( uniform sampler) 0:20 move second child to first child ( temp sampler) -0:? 'os.ss' ( temp sampler) +0:20 ss: direct index for structure ( temp sampler) +0:20 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:20 Constant: +0:20 0 (const int) 0:20 'gss' ( uniform sampler) 0:21 move second child to first child ( temp texture2D) -0:? 'os.tex' ( temp texture2D) +0:21 tex: direct index for structure ( temp texture2D) +0:21 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:21 Constant: +0:21 2 (const int) 0:21 'gtex' ( uniform texture2D) 0:22 move second child to first child ( temp float) -0:? 'os.a' ( temp float) +0:22 a: direct index for structure ( temp float) +0:22 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) +0:22 Constant: +0:22 1 (const int) 0:22 Constant: 0:22 3.000000 0:28 Branch: Return with expression 0:28 Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float) -0:? 'os.ss' ( temp sampler) -0:? 'os.a' ( temp float) -0:? 'os.tex' ( temp texture2D) +0:28 'os' ( temp structure{ temp sampler ss, temp float a, temp texture2D tex}) 0:17 Function Definition: main( ( temp void) 0:17 Function Parameters: 0:? Sequence @@ -109,99 +143,100 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 59 +// Generated by (magic number): 80007 +// Id's are bound by 64 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 57 + EntryPoint Fragment 4 "main" 62 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 17 "osCall(struct-OS-p1-f1-t211;" - Name 14 "s.ss" - Name 15 "s.a" - Name 16 "s.tex" - Name 20 "@main(" - Name 35 "os.ss" - Name 37 "gss2" - Name 39 "gss" - Name 41 "os.tex" - Name 43 "gtex" - Name 45 "os.a" - Name 47 "param" - Name 49 "param" - Name 51 "param" - Name 57 "@entryPointOutput" - Decorate 37(gss2) DescriptorSet 0 - Decorate 39(gss) DescriptorSet 0 - Decorate 43(gtex) DescriptorSet 0 - Decorate 57(@entryPointOutput) Location 0 + Name 9 "OS" + MemberName 9(OS) 0 "ss" + MemberName 9(OS) 1 "a" + MemberName 9(OS) 2 "tex" + Name 14 "osCall(struct-OS-p1-f1-t211;" + Name 13 "s" + Name 17 "@main(" + Name 42 "os" + Name 44 "gss2" + Name 47 "gss" + Name 51 "gtex" + Name 56 "param" + Name 62 "@entryPointOutput" + Decorate 44(gss2) DescriptorSet 0 + Decorate 47(gss) DescriptorSet 0 + Decorate 51(gtex) DescriptorSet 0 + Decorate 62(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 7: TypePointer Function 6 - 8: TypeFloat 32 - 9: TypePointer Function 8(float) - 10: TypeImage 8(float) 2D sampled format:Unknown - 11: TypePointer Function 10 - 12: TypeVector 8(float) 4 - 13: TypeFunction 12(fvec4) 7(ptr) 9(ptr) 11(ptr) - 19: TypeFunction 12(fvec4) - 25: TypeSampledImage 10 - 27: TypeVector 8(float) 2 - 28: 8(float) Constant 1045220557 - 29: 8(float) Constant 1050253722 - 30: 27(fvec2) ConstantComposite 28 29 - 36: TypePointer UniformConstant 6 - 37(gss2): 36(ptr) Variable UniformConstant - 39(gss): 36(ptr) Variable UniformConstant - 42: TypePointer UniformConstant 10 - 43(gtex): 42(ptr) Variable UniformConstant - 46: 8(float) Constant 1077936128 - 56: TypePointer Output 12(fvec4) -57(@entryPointOutput): 56(ptr) Variable Output + 7: TypeFloat 32 + 8: TypeImage 7(float) 2D sampled format:Unknown + 9(OS): TypeStruct 6 7(float) 8 + 10: TypePointer Function 9(OS) + 11: TypeVector 7(float) 4 + 12: TypeFunction 11(fvec4) 10(ptr) + 16: TypeFunction 11(fvec4) + 19: TypeInt 32 1 + 20: 19(int) Constant 1 + 21: TypePointer Function 7(float) + 24: 19(int) Constant 2 + 25: TypePointer Function 8 + 28: 19(int) Constant 0 + 29: TypePointer Function 6 + 32: TypeSampledImage 8 + 34: TypeVector 7(float) 2 + 35: 7(float) Constant 1045220557 + 36: 7(float) Constant 1050253722 + 37: 34(fvec2) ConstantComposite 35 36 + 43: TypePointer UniformConstant 6 + 44(gss2): 43(ptr) Variable UniformConstant + 47(gss): 43(ptr) Variable UniformConstant + 50: TypePointer UniformConstant 8 + 51(gtex): 50(ptr) Variable UniformConstant + 54: 7(float) Constant 1077936128 + 61: TypePointer Output 11(fvec4) +62(@entryPointOutput): 61(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 58: 12(fvec4) FunctionCall 20(@main() - Store 57(@entryPointOutput) 58 + 63: 11(fvec4) FunctionCall 17(@main() + Store 62(@entryPointOutput) 63 Return FunctionEnd -17(osCall(struct-OS-p1-f1-t211;): 12(fvec4) Function None 13 - 14(s.ss): 7(ptr) FunctionParameter - 15(s.a): 9(ptr) FunctionParameter - 16(s.tex): 11(ptr) FunctionParameter +14(osCall(struct-OS-p1-f1-t211;): 11(fvec4) Function None 12 + 13(s): 10(ptr) FunctionParameter + 15: Label + 22: 21(ptr) AccessChain 13(s) 20 + 23: 7(float) Load 22 + 26: 25(ptr) AccessChain 13(s) 24 + 27: 8 Load 26 + 30: 29(ptr) AccessChain 13(s) 28 + 31: 6 Load 30 + 33: 32 SampledImage 27 31 + 38: 11(fvec4) ImageSampleImplicitLod 33 37 + 39: 11(fvec4) VectorTimesScalar 38 23 + ReturnValue 39 + FunctionEnd + 17(@main(): 11(fvec4) Function None 16 18: Label - 22: 8(float) Load 15(s.a) - 23: 10 Load 16(s.tex) - 24: 6 Load 14(s.ss) - 26: 25 SampledImage 23 24 - 31: 12(fvec4) ImageSampleImplicitLod 26 30 - 32: 12(fvec4) VectorTimesScalar 31 22 - ReturnValue 32 - FunctionEnd - 20(@main(): 12(fvec4) Function None 19 - 21: Label - 35(os.ss): 7(ptr) Variable Function - 41(os.tex): 11(ptr) Variable Function - 45(os.a): 9(ptr) Variable Function - 47(param): 7(ptr) Variable Function - 49(param): 9(ptr) Variable Function - 51(param): 11(ptr) Variable Function - 38: 6 Load 37(gss2) - Store 35(os.ss) 38 - 40: 6 Load 39(gss) - Store 35(os.ss) 40 - 44: 10 Load 43(gtex) - Store 41(os.tex) 44 - Store 45(os.a) 46 - 48: 6 Load 35(os.ss) - Store 47(param) 48 - 50: 8(float) Load 45(os.a) - Store 49(param) 50 - 52: 10 Load 41(os.tex) - Store 51(param) 52 - 53: 12(fvec4) FunctionCall 17(osCall(struct-OS-p1-f1-t211;) 47(param) 49(param) 51(param) - ReturnValue 53 + 42(os): 10(ptr) Variable Function + 56(param): 10(ptr) Variable Function + 45: 6 Load 44(gss2) + 46: 29(ptr) AccessChain 42(os) 28 + Store 46 45 + 48: 6 Load 47(gss) + 49: 29(ptr) AccessChain 42(os) 28 + Store 49 48 + 52: 8 Load 51(gtex) + 53: 25(ptr) AccessChain 42(os) 24 + Store 53 52 + 55: 21(ptr) AccessChain 42(os) 20 + Store 55 54 + 57: 9(OS) Load 42(os) + Store 56(param) 57 + 58: 11(fvec4) FunctionCall 14(osCall(struct-OS-p1-f1-t211;) 56(param) + ReturnValue 58 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.amend.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.amend.frag.out index 98303858ed1..fa4ad035d75 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.amend.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.amend.frag.out @@ -160,7 +160,7 @@ gl_FragCoord origin is upper left 0:? 'm' ( global 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 57 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.flatten.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.flatten.frag.out index e32eb1590d0..4c8609c2577 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.flatten.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.flatten.frag.out @@ -345,7 +345,7 @@ gl_FragCoord origin is upper left 0:? 'ps_output.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 143 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.frag.out index dc48f6fab39..0f68e7cd553 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.frag.out @@ -290,7 +290,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=1) in 3-element array of 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 126 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out index cfd65627946..9af6fed287d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.implicit-size.frag.out @@ -163,7 +163,7 @@ gl_FragCoord origin is upper left 0:? 'g_mystruct' ( global 2-element array of structure{ temp int i, temp float f}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 72 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.multidim.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.multidim.frag.out index 133c71f9855..59f64c0e49b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.multidim.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.array.multidim.frag.out @@ -134,7 +134,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 57 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.assoc.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.assoc.frag.out index 7f071e403e0..562a8633432 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.assoc.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.assoc.frag.out @@ -132,7 +132,7 @@ gl_FragCoord origin is upper left 0:? 'a5' (layout( location=4) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 58 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.expression.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.expression.comp.out index 5fcf10d51b2..4bef5e764da 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.expression.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.expression.comp.out @@ -10,7 +10,7 @@ local_size = (4, 6, 8) 0:11 'x' ( temp int) 0:11 Constant: 0:11 0 (const int) -0:11 Loop with condition tested first +0:11 Loop with condition tested first: Unroll 0:11 Loop Condition 0:11 Compare Less Than ( temp bool) 0:11 'x' ( temp int) @@ -53,7 +53,7 @@ local_size = (4, 6, 8) 0:11 'x' ( temp int) 0:11 Constant: 0:11 0 (const int) -0:11 Loop with condition tested first +0:11 Loop with condition tested first: Unroll 0:11 Loop Condition 0:11 Compare Less Than ( temp bool) 0:11 'x' ( temp int) @@ -82,7 +82,7 @@ local_size = (4, 6, 8) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.frag.out index 99471c47d0f..44e963e0fd6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attribute.frag.out @@ -6,7 +6,7 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in 4-component vector of float) 0:? Sequence -0:11 Test condition and select ( temp void) +0:11 Test condition and select ( temp void): DontFlatten 0:11 Condition 0:11 Constant: 0:11 false (const bool) @@ -33,7 +33,7 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in 4-component vector of float) 0:? Sequence -0:11 Test condition and select ( temp void) +0:11 Test condition and select ( temp void): DontFlatten 0:11 Condition 0:11 Constant: 0:11 false (const bool) @@ -50,7 +50,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeC11.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeC11.frag.out index 02b0edeec93..afc746699db 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeC11.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeC11.frag.out @@ -2,42 +2,45 @@ hlsl.attributeC11.frag Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:16 Function Definition: @main(vf4; ( temp 4-component vector of float) -0:16 Function Parameters: -0:16 'input' ( in 4-component vector of float) +0:20 Function Definition: @main(vf4; ( temp 4-component vector of float) +0:20 Function Parameters: +0:20 'input' ( in 4-component vector of float) 0:? Sequence -0:17 Branch: Return with expression -0:17 add ( temp 4-component vector of float) -0:17 'input' ( in 4-component vector of float) -0:17 textureFetch ( temp 4-component vector of float) -0:17 'attach' ( uniform texture2D) -0:17 vector swizzle ( temp int) -0:17 Constant: -0:17 0 (const int) -0:17 0 (const int) -0:17 Sequence -0:17 Constant: -0:17 0 (const int) -0:17 direct index ( temp int) -0:17 Constant: -0:17 0 (const int) -0:17 0 (const int) -0:17 Constant: -0:17 1 (const int) -0:16 Function Definition: main( ( temp void) -0:16 Function Parameters: +0:21 Branch: Return with expression +0:21 add ( temp 4-component vector of float) +0:21 'input' ( in 4-component vector of float) +0:21 textureFetch ( temp 4-component vector of float) +0:21 'attach' ( uniform texture2D) +0:21 vector swizzle ( temp int) +0:21 Constant: +0:21 0 (const int) +0:21 0 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 direct index ( temp int) +0:21 Constant: +0:21 0 (const int) +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:20 Function Definition: main( ( temp void) +0:20 Function Parameters: 0:? Sequence -0:16 move second child to first child ( temp 4-component vector of float) +0:20 move second child to first child ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? 'input' (layout( location=8) in 4-component vector of float) -0:16 move second child to first child ( temp 4-component vector of float) +0:20 move second child to first child ( temp 4-component vector of float) 0:? '@entryPointOutput' (layout( location=7) out 4-component vector of float) -0:16 Function Call: @main(vf4; ( temp 4-component vector of float) +0:20 Function Call: @main(vf4; ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? Linker Objects -0:? 'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data}) -0:? 'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data}) +0:? 'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 2-component vector of float f} @data}) +0:? 'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 2-component vector of float f} @data}) 0:? 'attach' ( uniform texture2D) +0:? 'ci' ( specialization-constant const int) +0:? 11 (const int) +0:? 'anon@0' (layout( row_major std430 push_constant) uniform block{layout( row_major std430 offset=0) uniform int a}) 0:? '@entryPointOutput' (layout( location=7) out 4-component vector of float) 0:? 'input' (layout( location=8) in 4-component vector of float) @@ -48,48 +51,55 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:16 Function Definition: @main(vf4; ( temp 4-component vector of float) -0:16 Function Parameters: -0:16 'input' ( in 4-component vector of float) +0:20 Function Definition: @main(vf4; ( temp 4-component vector of float) +0:20 Function Parameters: +0:20 'input' ( in 4-component vector of float) 0:? Sequence -0:17 Branch: Return with expression -0:17 add ( temp 4-component vector of float) -0:17 'input' ( in 4-component vector of float) -0:17 textureFetch ( temp 4-component vector of float) -0:17 'attach' ( uniform texture2D) -0:17 vector swizzle ( temp int) -0:17 Constant: -0:17 0 (const int) -0:17 0 (const int) -0:17 Sequence -0:17 Constant: -0:17 0 (const int) -0:17 direct index ( temp int) -0:17 Constant: -0:17 0 (const int) -0:17 0 (const int) -0:17 Constant: -0:17 1 (const int) -0:16 Function Definition: main( ( temp void) -0:16 Function Parameters: +0:21 Branch: Return with expression +0:21 add ( temp 4-component vector of float) +0:21 'input' ( in 4-component vector of float) +0:21 textureFetch ( temp 4-component vector of float) +0:21 'attach' ( uniform texture2D) +0:21 vector swizzle ( temp int) +0:21 Constant: +0:21 0 (const int) +0:21 0 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 direct index ( temp int) +0:21 Constant: +0:21 0 (const int) +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:20 Function Definition: main( ( temp void) +0:20 Function Parameters: 0:? Sequence -0:16 move second child to first child ( temp 4-component vector of float) +0:20 move second child to first child ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? 'input' (layout( location=8) in 4-component vector of float) -0:16 move second child to first child ( temp 4-component vector of float) +0:20 move second child to first child ( temp 4-component vector of float) 0:? '@entryPointOutput' (layout( location=7) out 4-component vector of float) -0:16 Function Call: @main(vf4; ( temp 4-component vector of float) +0:20 Function Call: @main(vf4; ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? Linker Objects -0:? 'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data}) -0:? 'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data}) +0:? 'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 2-component vector of float f} @data}) +0:? 'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 2-component vector of float f} @data}) 0:? 'attach' ( uniform texture2D) +0:? 'ci' ( specialization-constant const int) +0:? 11 (const int) +0:? 'anon@0' (layout( row_major std430 push_constant) uniform block{layout( row_major std430 offset=0) uniform int a}) 0:? '@entryPointOutput' (layout( location=7) out 4-component vector of float) 0:? 'input' (layout( location=8) in 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Operand 2 of Decorate requires one of these capabilities: InputAttachment + OpDecorate %attach InputAttachmentIndex 4 + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 47 +// Generated by (magic number): 80007 +// Id's are bound by 51 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -111,6 +121,10 @@ gl_FragCoord origin is upper left MemberName 43(buffer1) 0 "@data" Name 45 "buffer1" Name 46 "buffer3" + Name 47 "ci" + Name 48 "pcBuf" + MemberName 48(pcBuf) 0 "a" + Name 50 "" Decorate 16(attach) DescriptorSet 0 Decorate 16(attach) InputAttachmentIndex 4 Decorate 33(input) Location 8 @@ -124,6 +138,9 @@ gl_FragCoord origin is upper left Decorate 45(buffer1) Binding 1 Decorate 46(buffer3) DescriptorSet 2 Decorate 46(buffer3) Binding 3 + Decorate 47(ci) SpecId 13 + MemberDecorate 48(pcBuf) 0 Offset 0 + Decorate 48(pcBuf) Block 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -151,6 +168,10 @@ gl_FragCoord origin is upper left 44: TypePointer Uniform 43(buffer1) 45(buffer1): 44(ptr) Variable Uniform 46(buffer3): 44(ptr) Variable Uniform + 47(ci): 18(int) SpecConstant 11 + 48(pcBuf): TypeStruct 18(int) + 49: TypePointer PushConstant 48(pcBuf) + 50: 49(ptr) Variable PushConstant 4(main): 2 Function None 3 5: Label 31(input): 8(ptr) Variable Function diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeGlobalBuffer.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeGlobalBuffer.frag.out index e00ae5282e2..e3784473f86 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeGlobalBuffer.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.attributeGlobalBuffer.frag.out @@ -56,7 +56,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 28 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.automap.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.automap.frag.out index 7664bf64923..b9ab49cd1b0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.automap.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.automap.frag.out @@ -1,29 +1,29 @@ hlsl.automap.frag Uniform reflection: -t1: offset -1, type 8b5d, size 1, index -1, binding 11 -t2: offset -1, type 8b5e, size 1, index -1, binding 12 -t3: offset -1, type 8b5f, size 1, index -1, binding 13 -t4.@data: offset 0, type 8b52, size 1, index 0, binding -1 -t5.@data: offset 0, type 1405, size 0, index 1, binding -1 -t6: offset -1, type 8dc2, size 1, index -1, binding 16 -s1: offset -1, type 0, size 1, index -1, binding 31 -s2: offset -1, type 0, size 1, index -1, binding 32 -u1: offset -1, type 904c, size 1, index -1, binding 41 -u2: offset -1, type 904d, size 1, index -1, binding 42 -u3: offset -1, type 904e, size 1, index -1, binding 43 -u4: offset -1, type 9051, size 1, index -1, binding 44 -u5.@data: offset 0, type 1405, size 0, index 2, binding -1 -u6.@data: offset 0, type 1406, size 1, index 3, binding -1 -cb1: offset 0, type 1404, size 1, index 4, binding -1 -tb1: offset 0, type 1404, size 1, index 5, binding -1 +t1: offset -1, type 8b5d, size 1, index -1, binding 11, stages 16 +t2: offset -1, type 8b5e, size 1, index -1, binding 12, stages 16 +t3: offset -1, type 8b5f, size 1, index -1, binding 13, stages 16 +t4.@data: offset 0, type 8b52, size 1, index 0, binding -1, stages 16 +t5.@data: offset 0, type 1405, size 0, index 1, binding -1, stages 16 +t6: offset -1, type 8dc2, size 1, index -1, binding 16, stages 16 +s1: offset -1, type 0, size 1, index -1, binding 31, stages 16 +s2: offset -1, type 0, size 1, index -1, binding 32, stages 16 +u1: offset -1, type 904c, size 1, index -1, binding 41, stages 16 +u2: offset -1, type 904d, size 1, index -1, binding 42, stages 16 +u3: offset -1, type 904e, size 1, index -1, binding 43, stages 16 +u4: offset -1, type 9051, size 1, index -1, binding 44, stages 16 +u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16 +u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16 +cb1: offset 0, type 1404, size 1, index 4, binding -1, stages 16 +tb1: offset 0, type 1404, size 1, index 5, binding -1, stages 16 Uniform block reflection: -t4: offset -1, type ffffffff, size 0, index -1, binding 14 -t5: offset -1, type ffffffff, size 0, index -1, binding 15 -u5: offset -1, type ffffffff, size 0, index -1, binding 45 -u6: offset -1, type ffffffff, size 0, index -1, binding 46 -cb: offset -1, type ffffffff, size 4, index -1, binding 51 -tb: offset -1, type ffffffff, size 4, index -1, binding 17 +t4: offset -1, type ffffffff, size 0, index -1, binding 14, stages 0 +t5: offset -1, type ffffffff, size 0, index -1, binding 15, stages 0 +u5: offset -1, type ffffffff, size 0, index -1, binding 45, stages 0 +u6: offset -1, type ffffffff, size 0, index -1, binding 46, stages 0 +cb: offset -1, type ffffffff, size 4, index -1, binding 51, stages 0 +tb: offset -1, type ffffffff, size 4, index -1, binding 17, stages 0 Vertex attribute reflection: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.comp.out index b72c848f8a9..d84642e9a4e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.comp.out @@ -15,17 +15,19 @@ local_size = (1, 1, 1) 0:? Sequence 0:4 move second child to first child ( temp int) 0:? 'dti' ( temp int) -0:? 'dti' ( in int GlobalInvocationID) +0:? Construct int ( temp int) +0:? 'dti' ( in 3-component vector of int GlobalInvocationID) 0:4 move second child to first child ( temp int) 0:? 'gti' ( temp int) -0:? 'gti' ( in int LocalInvocationID) +0:? Construct int ( temp int) +0:? 'gti' ( in 3-component vector of int LocalInvocationID) 0:4 Function Call: @main(i1;i1; ( temp void) 0:? 'dti' ( temp int) 0:? 'gti' ( temp int) 0:? Linker Objects 0:? 'a' ( shared 100-element array of 4-component vector of float) -0:? 'dti' ( in int GlobalInvocationID) -0:? 'gti' ( in int LocalInvocationID) +0:? 'dti' ( in 3-component vector of int GlobalInvocationID) +0:? 'gti' ( in 3-component vector of int LocalInvocationID) Linked compute stage: @@ -47,26 +49,28 @@ local_size = (1, 1, 1) 0:? Sequence 0:4 move second child to first child ( temp int) 0:? 'dti' ( temp int) -0:? 'dti' ( in int GlobalInvocationID) +0:? Construct int ( temp int) +0:? 'dti' ( in 3-component vector of int GlobalInvocationID) 0:4 move second child to first child ( temp int) 0:? 'gti' ( temp int) -0:? 'gti' ( in int LocalInvocationID) +0:? Construct int ( temp int) +0:? 'gti' ( in 3-component vector of int LocalInvocationID) 0:4 Function Call: @main(i1;i1; ( temp void) 0:? 'dti' ( temp int) 0:? 'gti' ( temp int) 0:? Linker Objects 0:? 'a' ( shared 100-element array of 4-component vector of float) -0:? 'dti' ( in int GlobalInvocationID) -0:? 'gti' ( in int LocalInvocationID) +0:? 'dti' ( in 3-component vector of int GlobalInvocationID) +0:? 'gti' ( in 3-component vector of int LocalInvocationID) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 35 +// Generated by (magic number): 80007 +// Id's are bound by 38 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 4 "main" 18 21 + EntryPoint GLCompute 4 "main" 19 23 ExecutionMode 4 LocalSize 1 1 1 Source HLSL 500 Name 4 "main" @@ -74,44 +78,47 @@ local_size = (1, 1, 1) Name 9 "dti" Name 10 "gti" Name 16 "dti" - Name 18 "dti" - Name 20 "gti" - Name 21 "gti" - Name 23 "param" - Name 25 "param" - Name 34 "a" - Decorate 18(dti) BuiltIn GlobalInvocationId - Decorate 21(gti) BuiltIn LocalInvocationId + Name 19 "dti" + Name 22 "gti" + Name 23 "gti" + Name 26 "param" + Name 28 "param" + Name 37 "a" + Decorate 19(dti) BuiltIn GlobalInvocationId + Decorate 23(gti) BuiltIn LocalInvocationId 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 7: TypePointer Function 6(int) 8: TypeFunction 2 7(ptr) 7(ptr) - 17: TypePointer Input 6(int) - 18(dti): 17(ptr) Variable Input - 21(gti): 17(ptr) Variable Input - 28: TypeFloat 32 - 29: TypeVector 28(float) 4 - 30: TypeInt 32 0 - 31: 30(int) Constant 100 - 32: TypeArray 29(fvec4) 31 - 33: TypePointer Workgroup 32 - 34(a): 33(ptr) Variable Workgroup + 17: TypeVector 6(int) 3 + 18: TypePointer Input 17(ivec3) + 19(dti): 18(ptr) Variable Input + 23(gti): 18(ptr) Variable Input + 31: TypeFloat 32 + 32: TypeVector 31(float) 4 + 33: TypeInt 32 0 + 34: 33(int) Constant 100 + 35: TypeArray 32(fvec4) 34 + 36: TypePointer Workgroup 35 + 37(a): 36(ptr) Variable Workgroup 4(main): 2 Function None 3 5: Label 16(dti): 7(ptr) Variable Function - 20(gti): 7(ptr) Variable Function - 23(param): 7(ptr) Variable Function - 25(param): 7(ptr) Variable Function - 19: 6(int) Load 18(dti) - Store 16(dti) 19 - 22: 6(int) Load 21(gti) - Store 20(gti) 22 - 24: 6(int) Load 16(dti) - Store 23(param) 24 - 26: 6(int) Load 20(gti) - Store 25(param) 26 - 27: 2 FunctionCall 11(@main(i1;i1;) 23(param) 25(param) + 22(gti): 7(ptr) Variable Function + 26(param): 7(ptr) Variable Function + 28(param): 7(ptr) Variable Function + 20: 17(ivec3) Load 19(dti) + 21: 6(int) CompositeExtract 20 0 + Store 16(dti) 21 + 24: 17(ivec3) Load 23(gti) + 25: 6(int) CompositeExtract 24 0 + Store 22(gti) 25 + 27: 6(int) Load 16(dti) + Store 26(param) 27 + 29: 6(int) Load 22(gti) + Store 28(param) 29 + 30: 2 FunctionCall 11(@main(i1;i1;) 26(param) 28(param) Return FunctionEnd 11(@main(i1;i1;): 2 Function None 8 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.geom.out index 9d9aaa7e6e7..f4116d4e81f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.basic.geom.out @@ -188,7 +188,7 @@ output primitive = line_strip 0:? 'OutputStream.something' (layout( location=1) out int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 68 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out index 5d94fe95844..d88955fae23 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out @@ -16,84 +16,74 @@ Shader version: 500 0:4 0 (const int) 0:6 add second child into first child ( temp int) 0:6 'r' ( temp int) -0:6 Convert bool to int ( temp int) -0:6 add ( temp bool) -0:6 Convert bool to int ( temp int) -0:6 'a' ( global bool) -0:6 Convert bool to int ( temp int) -0:6 'b' ( global bool) +0:6 add ( temp int) +0:6 Convert bool to int ( temp int) +0:6 'a' ( global bool) +0:6 Convert bool to int ( temp int) +0:6 'b' ( global bool) 0:7 add second child into first child ( temp int) 0:7 'r' ( temp int) -0:7 Convert bool to int ( temp int) -0:7 subtract ( temp bool) -0:7 Convert bool to int ( temp int) -0:7 'a' ( global bool) -0:7 Convert bool to int ( temp int) -0:7 'b' ( global bool) +0:7 subtract ( temp int) +0:7 Convert bool to int ( temp int) +0:7 'a' ( global bool) +0:7 Convert bool to int ( temp int) +0:7 'b' ( global bool) 0:8 add second child into first child ( temp int) 0:8 'r' ( temp int) -0:8 Convert bool to int ( temp int) -0:8 component-wise multiply ( temp bool) -0:8 Convert bool to int ( temp int) -0:8 'a' ( global bool) -0:8 Convert bool to int ( temp int) -0:8 'b' ( global bool) +0:8 component-wise multiply ( temp int) +0:8 Convert bool to int ( temp int) +0:8 'a' ( global bool) +0:8 Convert bool to int ( temp int) +0:8 'b' ( global bool) 0:9 add second child into first child ( temp int) 0:9 'r' ( temp int) -0:9 Convert bool to int ( temp int) -0:9 divide ( temp bool) -0:9 Convert bool to int ( temp int) -0:9 'a' ( global bool) -0:9 Convert bool to int ( temp int) -0:9 'b' ( global bool) +0:9 divide ( temp int) +0:9 Convert bool to int ( temp int) +0:9 'a' ( global bool) +0:9 Convert bool to int ( temp int) +0:9 'b' ( global bool) 0:10 add second child into first child ( temp int) 0:10 'r' ( temp int) -0:10 Convert bool to int ( temp int) -0:10 mod ( temp bool) -0:10 Convert bool to int ( temp int) -0:10 'a' ( global bool) -0:10 Convert bool to int ( temp int) -0:10 'b' ( global bool) +0:10 mod ( temp int) +0:10 Convert bool to int ( temp int) +0:10 'a' ( global bool) +0:10 Convert bool to int ( temp int) +0:10 'b' ( global bool) 0:12 add second child into first child ( temp int) 0:12 'r' ( temp int) -0:12 Convert bool to int ( temp int) -0:12 bitwise and ( temp bool) -0:12 Convert bool to int ( temp int) -0:12 'a' ( global bool) -0:12 Convert bool to int ( temp int) -0:12 'b' ( global bool) +0:12 bitwise and ( temp int) +0:12 Convert bool to int ( temp int) +0:12 'a' ( global bool) +0:12 Convert bool to int ( temp int) +0:12 'b' ( global bool) 0:13 add second child into first child ( temp int) 0:13 'r' ( temp int) -0:13 Convert bool to int ( temp int) -0:13 inclusive-or ( temp bool) -0:13 Convert bool to int ( temp int) -0:13 'a' ( global bool) -0:13 Convert bool to int ( temp int) -0:13 'b' ( global bool) +0:13 inclusive-or ( temp int) +0:13 Convert bool to int ( temp int) +0:13 'a' ( global bool) +0:13 Convert bool to int ( temp int) +0:13 'b' ( global bool) 0:14 add second child into first child ( temp int) 0:14 'r' ( temp int) -0:14 Convert bool to int ( temp int) -0:14 exclusive-or ( temp bool) -0:14 Convert bool to int ( temp int) -0:14 'a' ( global bool) -0:14 Convert bool to int ( temp int) -0:14 'b' ( global bool) +0:14 exclusive-or ( temp int) +0:14 Convert bool to int ( temp int) +0:14 'a' ( global bool) +0:14 Convert bool to int ( temp int) +0:14 'b' ( global bool) 0:16 add second child into first child ( temp int) 0:16 'r' ( temp int) -0:16 Convert bool to int ( temp int) -0:16 left-shift ( temp bool) -0:16 Convert bool to int ( temp int) -0:16 'a' ( global bool) -0:16 Convert bool to int ( temp int) -0:16 'b' ( global bool) +0:16 left-shift ( temp int) +0:16 Convert bool to int ( temp int) +0:16 'a' ( global bool) +0:16 Convert bool to int ( temp int) +0:16 'b' ( global bool) 0:17 add second child into first child ( temp int) 0:17 'r' ( temp int) -0:17 Convert bool to int ( temp int) -0:17 right-shift ( temp bool) -0:17 Convert bool to int ( temp int) -0:17 'a' ( global bool) -0:17 Convert bool to int ( temp int) -0:17 'b' ( global bool) +0:17 right-shift ( temp int) +0:17 Convert bool to int ( temp int) +0:17 'a' ( global bool) +0:17 Convert bool to int ( temp int) +0:17 'b' ( global bool) 0:19 Branch: Return with expression 0:19 Construct vec4 ( temp 4-component vector of float) 0:19 Convert int to float ( temp float) @@ -130,84 +120,74 @@ Shader version: 500 0:4 0 (const int) 0:6 add second child into first child ( temp int) 0:6 'r' ( temp int) -0:6 Convert bool to int ( temp int) -0:6 add ( temp bool) -0:6 Convert bool to int ( temp int) -0:6 'a' ( global bool) -0:6 Convert bool to int ( temp int) -0:6 'b' ( global bool) +0:6 add ( temp int) +0:6 Convert bool to int ( temp int) +0:6 'a' ( global bool) +0:6 Convert bool to int ( temp int) +0:6 'b' ( global bool) 0:7 add second child into first child ( temp int) 0:7 'r' ( temp int) -0:7 Convert bool to int ( temp int) -0:7 subtract ( temp bool) -0:7 Convert bool to int ( temp int) -0:7 'a' ( global bool) -0:7 Convert bool to int ( temp int) -0:7 'b' ( global bool) +0:7 subtract ( temp int) +0:7 Convert bool to int ( temp int) +0:7 'a' ( global bool) +0:7 Convert bool to int ( temp int) +0:7 'b' ( global bool) 0:8 add second child into first child ( temp int) 0:8 'r' ( temp int) -0:8 Convert bool to int ( temp int) -0:8 component-wise multiply ( temp bool) -0:8 Convert bool to int ( temp int) -0:8 'a' ( global bool) -0:8 Convert bool to int ( temp int) -0:8 'b' ( global bool) +0:8 component-wise multiply ( temp int) +0:8 Convert bool to int ( temp int) +0:8 'a' ( global bool) +0:8 Convert bool to int ( temp int) +0:8 'b' ( global bool) 0:9 add second child into first child ( temp int) 0:9 'r' ( temp int) -0:9 Convert bool to int ( temp int) -0:9 divide ( temp bool) -0:9 Convert bool to int ( temp int) -0:9 'a' ( global bool) -0:9 Convert bool to int ( temp int) -0:9 'b' ( global bool) +0:9 divide ( temp int) +0:9 Convert bool to int ( temp int) +0:9 'a' ( global bool) +0:9 Convert bool to int ( temp int) +0:9 'b' ( global bool) 0:10 add second child into first child ( temp int) 0:10 'r' ( temp int) -0:10 Convert bool to int ( temp int) -0:10 mod ( temp bool) -0:10 Convert bool to int ( temp int) -0:10 'a' ( global bool) -0:10 Convert bool to int ( temp int) -0:10 'b' ( global bool) +0:10 mod ( temp int) +0:10 Convert bool to int ( temp int) +0:10 'a' ( global bool) +0:10 Convert bool to int ( temp int) +0:10 'b' ( global bool) 0:12 add second child into first child ( temp int) 0:12 'r' ( temp int) -0:12 Convert bool to int ( temp int) -0:12 bitwise and ( temp bool) -0:12 Convert bool to int ( temp int) -0:12 'a' ( global bool) -0:12 Convert bool to int ( temp int) -0:12 'b' ( global bool) +0:12 bitwise and ( temp int) +0:12 Convert bool to int ( temp int) +0:12 'a' ( global bool) +0:12 Convert bool to int ( temp int) +0:12 'b' ( global bool) 0:13 add second child into first child ( temp int) 0:13 'r' ( temp int) -0:13 Convert bool to int ( temp int) -0:13 inclusive-or ( temp bool) -0:13 Convert bool to int ( temp int) -0:13 'a' ( global bool) -0:13 Convert bool to int ( temp int) -0:13 'b' ( global bool) +0:13 inclusive-or ( temp int) +0:13 Convert bool to int ( temp int) +0:13 'a' ( global bool) +0:13 Convert bool to int ( temp int) +0:13 'b' ( global bool) 0:14 add second child into first child ( temp int) 0:14 'r' ( temp int) -0:14 Convert bool to int ( temp int) -0:14 exclusive-or ( temp bool) -0:14 Convert bool to int ( temp int) -0:14 'a' ( global bool) -0:14 Convert bool to int ( temp int) -0:14 'b' ( global bool) +0:14 exclusive-or ( temp int) +0:14 Convert bool to int ( temp int) +0:14 'a' ( global bool) +0:14 Convert bool to int ( temp int) +0:14 'b' ( global bool) 0:16 add second child into first child ( temp int) 0:16 'r' ( temp int) -0:16 Convert bool to int ( temp int) -0:16 left-shift ( temp bool) -0:16 Convert bool to int ( temp int) -0:16 'a' ( global bool) -0:16 Convert bool to int ( temp int) -0:16 'b' ( global bool) +0:16 left-shift ( temp int) +0:16 Convert bool to int ( temp int) +0:16 'a' ( global bool) +0:16 Convert bool to int ( temp int) +0:16 'b' ( global bool) 0:17 add second child into first child ( temp int) 0:17 'r' ( temp int) -0:17 Convert bool to int ( temp int) -0:17 right-shift ( temp bool) -0:17 Convert bool to int ( temp int) -0:17 'a' ( global bool) -0:17 Convert bool to int ( temp int) -0:17 'b' ( global bool) +0:17 right-shift ( temp int) +0:17 Convert bool to int ( temp int) +0:17 'a' ( global bool) +0:17 Convert bool to int ( temp int) +0:17 'b' ( global bool) 0:19 Branch: Return with expression 0:19 Construct vec4 ( temp 4-component vector of float) 0:19 Convert int to float ( temp float) @@ -224,21 +204,21 @@ Shader version: 500 0:? '@entryPointOutput' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 109 +// Generated by (magic number): 80007 +// Id's are bound by 99 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 107 + EntryPoint Vertex 4 "main" 97 Source HLSL 500 Name 4 "main" Name 9 "@main(" Name 13 "b" Name 17 "r" Name 19 "a" - Name 107 "@entryPointOutput" - Decorate 107(@entryPointOutput) BuiltIn Position + Name 97 "@entryPointOutput" + Decorate 97(@entryPointOutput) BuiltIn Position 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -253,13 +233,13 @@ Shader version: 500 18: 15(int) Constant 0 19(a): 12(ptr) Variable Private 21: 15(int) Constant 1 - 106: TypePointer Output 7(fvec4) -107(@entryPointOutput): 106(ptr) Variable Output + 96: TypePointer Output 7(fvec4) +97(@entryPointOutput): 96(ptr) Variable Output 4(main): 2 Function None 3 5: Label Store 13(b) 14 - 108: 7(fvec4) FunctionCall 9(@main() - Store 107(@entryPointOutput) 108 + 98: 7(fvec4) FunctionCall 9(@main() + Store 97(@entryPointOutput) 98 Return FunctionEnd 9(@main(): 7(fvec4) Function None 8 @@ -270,62 +250,63 @@ Shader version: 500 22: 15(int) Select 20 21 18 23: 11(bool) Load 13(b) 24: 15(int) Select 23 21 18 - 25: 11(bool) IAdd 22 24 - 26: 15(int) Select 25 21 18 - 27: 15(int) Load 17(r) - 28: 15(int) IAdd 27 26 - Store 17(r) 28 - 29: 11(bool) Load 19(a) - 30: 15(int) Select 29 21 18 - 31: 11(bool) Load 13(b) - 32: 15(int) Select 31 21 18 - 33: 11(bool) ISub 30 32 - 34: 15(int) Select 33 21 18 - 35: 15(int) Load 17(r) - 36: 15(int) IAdd 35 34 - Store 17(r) 36 - 37: 11(bool) Load 19(a) + 25: 15(int) IAdd 22 24 + 26: 15(int) Load 17(r) + 27: 15(int) IAdd 26 25 + Store 17(r) 27 + 28: 11(bool) Load 19(a) + 29: 15(int) Select 28 21 18 + 30: 11(bool) Load 13(b) + 31: 15(int) Select 30 21 18 + 32: 15(int) ISub 29 31 + 33: 15(int) Load 17(r) + 34: 15(int) IAdd 33 32 + Store 17(r) 34 + 35: 11(bool) Load 19(a) + 36: 15(int) Select 35 21 18 + 37: 11(bool) Load 13(b) 38: 15(int) Select 37 21 18 - 39: 11(bool) Load 13(b) - 40: 15(int) Select 39 21 18 - 41: 11(bool) IMul 38 40 - 42: 15(int) Select 41 21 18 - 43: 15(int) Load 17(r) - 44: 15(int) IAdd 43 42 - Store 17(r) 44 - 45: 11(bool) Load 19(a) - 46: 15(int) Select 45 21 18 - 47: 11(bool) Load 13(b) - 48: 15(int) Select 47 21 18 - 49: 11(bool) SDiv 46 48 + 39: 15(int) IMul 36 38 + 40: 15(int) Load 17(r) + 41: 15(int) IAdd 40 39 + Store 17(r) 41 + 42: 11(bool) Load 19(a) + 43: 15(int) Select 42 21 18 + 44: 11(bool) Load 13(b) + 45: 15(int) Select 44 21 18 + 46: 15(int) SDiv 43 45 + 47: 15(int) Load 17(r) + 48: 15(int) IAdd 47 46 + Store 17(r) 48 + 49: 11(bool) Load 19(a) 50: 15(int) Select 49 21 18 - 51: 15(int) Load 17(r) - 52: 15(int) IAdd 51 50 - Store 17(r) 52 - 53: 11(bool) Load 19(a) - 54: 15(int) Select 53 21 18 - 55: 11(bool) Load 13(b) - 56: 15(int) Select 55 21 18 - 57: 11(bool) SMod 54 56 - 58: 15(int) Select 57 21 18 - 59: 15(int) Load 17(r) - 60: 15(int) IAdd 59 58 - Store 17(r) 60 - 61: 11(bool) Load 19(a) - 62: 15(int) Select 61 21 18 - 63: 11(bool) Load 13(b) + 51: 11(bool) Load 13(b) + 52: 15(int) Select 51 21 18 + 53: 15(int) SMod 50 52 + 54: 15(int) Load 17(r) + 55: 15(int) IAdd 54 53 + Store 17(r) 55 + 56: 11(bool) Load 19(a) + 57: 15(int) Select 56 21 18 + 58: 11(bool) Load 13(b) + 59: 15(int) Select 58 21 18 + 60: 15(int) BitwiseAnd 57 59 + 61: 15(int) Load 17(r) + 62: 15(int) IAdd 61 60 + Store 17(r) 62 + 63: 11(bool) Load 19(a) 64: 15(int) Select 63 21 18 - 65: 11(bool) BitwiseAnd 62 64 + 65: 11(bool) Load 13(b) 66: 15(int) Select 65 21 18 - 67: 15(int) Load 17(r) - 68: 15(int) IAdd 67 66 - Store 17(r) 68 - 69: 11(bool) Load 19(a) - 70: 15(int) Select 69 21 18 - 71: 11(bool) Load 13(b) - 72: 15(int) Select 71 21 18 - 73: 11(bool) BitwiseOr 70 72 - 74: 15(int) Select 73 21 18 + 67: 15(int) BitwiseOr 64 66 + 68: 15(int) Load 17(r) + 69: 15(int) IAdd 68 67 + Store 17(r) 69 + 70: 11(bool) Load 19(a) + 71: 15(int) Select 70 21 18 + 72: 11(bool) Load 13(b) + 73: 15(int) Select 72 21 18 + 74: 15(int) BitwiseXor 71 73 75: 15(int) Load 17(r) 76: 15(int) IAdd 75 74 Store 17(r) 76 @@ -333,31 +314,20 @@ Shader version: 500 78: 15(int) Select 77 21 18 79: 11(bool) Load 13(b) 80: 15(int) Select 79 21 18 - 81: 11(bool) BitwiseXor 78 80 - 82: 15(int) Select 81 21 18 - 83: 15(int) Load 17(r) - 84: 15(int) IAdd 83 82 - Store 17(r) 84 - 85: 11(bool) Load 19(a) - 86: 15(int) Select 85 21 18 - 87: 11(bool) Load 13(b) - 88: 15(int) Select 87 21 18 - 89: 11(bool) ShiftLeftLogical 86 88 - 90: 15(int) Select 89 21 18 + 81: 15(int) ShiftLeftLogical 78 80 + 82: 15(int) Load 17(r) + 83: 15(int) IAdd 82 81 + Store 17(r) 83 + 84: 11(bool) Load 19(a) + 85: 15(int) Select 84 21 18 + 86: 11(bool) Load 13(b) + 87: 15(int) Select 86 21 18 + 88: 15(int) ShiftRightArithmetic 85 87 + 89: 15(int) Load 17(r) + 90: 15(int) IAdd 89 88 + Store 17(r) 90 91: 15(int) Load 17(r) - 92: 15(int) IAdd 91 90 - Store 17(r) 92 - 93: 11(bool) Load 19(a) - 94: 15(int) Select 93 21 18 - 95: 11(bool) Load 13(b) - 96: 15(int) Select 95 21 18 - 97: 11(bool) ShiftRightArithmetic 94 96 - 98: 15(int) Select 97 21 18 - 99: 15(int) Load 17(r) - 100: 15(int) IAdd 99 98 - Store 17(r) 100 - 101: 15(int) Load 17(r) - 102: 6(float) ConvertSToF 101 - 103: 7(fvec4) CompositeConstruct 102 102 102 102 - ReturnValue 103 + 92: 6(float) ConvertSToF 91 + 93: 7(fvec4) CompositeConstruct 92 92 92 92 + ReturnValue 93 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.buffer.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.buffer.frag.out index 0b73f8da76f..71393f08378 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.buffer.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.buffer.frag.out @@ -8,50 +8,66 @@ gl_FragCoord origin is upper left 0:31 Branch: Return with expression 0:31 Constant: 0:31 1.000000 -0:35 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) -0:35 Function Parameters: -0:35 'input' ( in 4-component vector of float) +0:43 Function Definition: @PixelShaderFunction(vf4; ( temp structure{ temp 4-component vector of float a}) +0:43 Function Parameters: +0:43 'input' ( in 4-component vector of float) 0:? Sequence -0:36 Branch: Return with expression -0:36 vector-scale ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 'input' ( in 4-component vector of float) -0:36 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float) -0:36 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1}) -0:36 Constant: -0:36 0 (const uint) -0:36 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float) -0:36 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2}) -0:36 Constant: -0:36 0 (const uint) -0:36 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float) -0:36 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3}) -0:36 Constant: -0:36 0 (const uint) -0:36 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) -0:36 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4}) -0:36 Constant: -0:36 0 (const uint) -0:36 Function Call: foo( ( temp float) -0:35 Function Definition: PixelShaderFunction( ( temp void) -0:35 Function Parameters: +0:45 move second child to first child ( temp 4-component vector of float) +0:45 a: direct index for structure ( temp 4-component vector of float) +0:45 'ret' ( temp structure{ temp 4-component vector of float a}) +0:45 Constant: +0:45 0 (const int) +0:45 add ( temp 4-component vector of float) +0:45 v24: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:45 'anon@4' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v24}) +0:45 Constant: +0:45 0 (const uint) +0:45 vector-scale ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 'input' ( in 4-component vector of float) +0:45 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:45 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1}) +0:45 Constant: +0:45 0 (const uint) +0:45 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float) +0:45 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2}) +0:45 Constant: +0:45 0 (const uint) +0:45 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float) +0:45 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3}) +0:45 Constant: +0:45 0 (const uint) +0:45 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) +0:45 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4}) +0:45 Constant: +0:45 0 (const uint) +0:45 Function Call: foo( ( temp float) +0:46 Branch: Return with expression +0:46 'ret' ( temp structure{ temp 4-component vector of float a}) +0:43 Function Definition: PixelShaderFunction( ( temp void) +0:43 Function Parameters: 0:? Sequence -0:35 move second child to first child ( temp 4-component vector of float) +0:43 move second child to first child ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( in 4-component vector of float FragCoord) -0:35 move second child to first child ( temp 4-component vector of float) -0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) -0:35 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) -0:? 'input' ( temp 4-component vector of float) +0:43 Sequence +0:43 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.a' (layout( location=0) out 4-component vector of float) +0:43 a: direct index for structure ( temp 4-component vector of float) +0:43 Function Call: @PixelShaderFunction(vf4; ( temp structure{ temp 4-component vector of float a}) +0:? 'input' ( temp 4-component vector of float) +0:43 Constant: +0:43 0 (const int) 0:? Linker Objects 0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1}) 0:? 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2}) 0:? 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3}) 0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4}) -0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'anon@4' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v24}) +0:? '@entryPointOutput.a' (layout( location=0) out 4-component vector of float) 0:? 'input' ( in 4-component vector of float FragCoord) @@ -67,203 +83,245 @@ gl_FragCoord origin is upper left 0:31 Branch: Return with expression 0:31 Constant: 0:31 1.000000 -0:35 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) -0:35 Function Parameters: -0:35 'input' ( in 4-component vector of float) +0:43 Function Definition: @PixelShaderFunction(vf4; ( temp structure{ temp 4-component vector of float a}) +0:43 Function Parameters: +0:43 'input' ( in 4-component vector of float) 0:? Sequence -0:36 Branch: Return with expression -0:36 vector-scale ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 add ( temp 4-component vector of float) -0:36 'input' ( in 4-component vector of float) -0:36 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float) -0:36 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1}) -0:36 Constant: -0:36 0 (const uint) -0:36 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float) -0:36 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2}) -0:36 Constant: -0:36 0 (const uint) -0:36 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float) -0:36 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3}) -0:36 Constant: -0:36 0 (const uint) -0:36 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) -0:36 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4}) -0:36 Constant: -0:36 0 (const uint) -0:36 Function Call: foo( ( temp float) -0:35 Function Definition: PixelShaderFunction( ( temp void) -0:35 Function Parameters: +0:45 move second child to first child ( temp 4-component vector of float) +0:45 a: direct index for structure ( temp 4-component vector of float) +0:45 'ret' ( temp structure{ temp 4-component vector of float a}) +0:45 Constant: +0:45 0 (const int) +0:45 add ( temp 4-component vector of float) +0:45 v24: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:45 'anon@4' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v24}) +0:45 Constant: +0:45 0 (const uint) +0:45 vector-scale ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 add ( temp 4-component vector of float) +0:45 'input' ( in 4-component vector of float) +0:45 v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:45 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1}) +0:45 Constant: +0:45 0 (const uint) +0:45 v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float) +0:45 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2}) +0:45 Constant: +0:45 0 (const uint) +0:45 v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float) +0:45 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3}) +0:45 Constant: +0:45 0 (const uint) +0:45 v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) +0:45 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4}) +0:45 Constant: +0:45 0 (const uint) +0:45 Function Call: foo( ( temp float) +0:46 Branch: Return with expression +0:46 'ret' ( temp structure{ temp 4-component vector of float a}) +0:43 Function Definition: PixelShaderFunction( ( temp void) +0:43 Function Parameters: 0:? Sequence -0:35 move second child to first child ( temp 4-component vector of float) +0:43 move second child to first child ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? 'input' ( in 4-component vector of float FragCoord) -0:35 move second child to first child ( temp 4-component vector of float) -0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) -0:35 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) -0:? 'input' ( temp 4-component vector of float) +0:43 Sequence +0:43 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.a' (layout( location=0) out 4-component vector of float) +0:43 a: direct index for structure ( temp 4-component vector of float) +0:43 Function Call: @PixelShaderFunction(vf4; ( temp structure{ temp 4-component vector of float a}) +0:? 'input' ( temp 4-component vector of float) +0:43 Constant: +0:43 0 (const int) 0:? Linker Objects 0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1}) 0:? 'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2}) 0:? 'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3}) 0:? 'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4}) -0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:? 'anon@4' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v24}) +0:? '@entryPointOutput.a' (layout( location=0) out 4-component vector of float) 0:? 'input' ( in 4-component vector of float FragCoord) +error: SPIRV-Tools Validation Errors +error: Structure id 50 decorated as BufferBlock for variable in Uniform storage class must follow relaxed storage buffer layout rules: member 7 at offset 128 overlaps previous member ending at offset 171 + %tbufName = OpTypeStruct %v4float %int %float %float %float %float %float %float %mat3v4float %mat3v4float %mat3v4float %mat3v4float + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 61 +// Generated by (magic number): 80007 +// Id's are bound by 73 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "PixelShaderFunction" 54 57 + EntryPoint Fragment 4 "PixelShaderFunction" 65 68 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "PixelShaderFunction" Name 8 "foo(" - Name 14 "@PixelShaderFunction(vf4;" - Name 13 "input" - Name 20 "buf1" - MemberName 20(buf1) 0 "v1" - Name 22 "" - Name 29 "buf2" - MemberName 29(buf2) 0 "v2" - Name 31 "" - Name 35 "cbufName" - MemberName 35(cbufName) 0 "v3" - MemberName 35(cbufName) 1 "i3" - Name 37 "" - Name 42 "tbufName" - MemberName 42(tbufName) 0 "v4" - MemberName 42(tbufName) 1 "i4" - MemberName 42(tbufName) 2 "f1" - MemberName 42(tbufName) 3 "f3" - MemberName 42(tbufName) 4 "f4" - MemberName 42(tbufName) 5 "f5" - MemberName 42(tbufName) 6 "f6" - MemberName 42(tbufName) 7 "f7" - MemberName 42(tbufName) 8 "m1" - MemberName 42(tbufName) 9 "m2" - MemberName 42(tbufName) 10 "m3" - MemberName 42(tbufName) 11 "m4" - Name 44 "" - Name 52 "input" - Name 54 "input" - Name 57 "@entryPointOutput" - Name 58 "param" - MemberDecorate 20(buf1) 0 Offset 0 - Decorate 20(buf1) Block - Decorate 22 DescriptorSet 0 - MemberDecorate 29(buf2) 0 NonWritable - MemberDecorate 29(buf2) 0 Offset 0 - Decorate 29(buf2) BufferBlock - Decorate 31 DescriptorSet 0 - MemberDecorate 35(cbufName) 0 Offset 0 - MemberDecorate 35(cbufName) 1 Offset 20 - Decorate 35(cbufName) Block - Decorate 37 DescriptorSet 0 - MemberDecorate 42(tbufName) 0 NonWritable - MemberDecorate 42(tbufName) 0 Offset 16 - MemberDecorate 42(tbufName) 1 NonWritable - MemberDecorate 42(tbufName) 1 Offset 48 - MemberDecorate 42(tbufName) 2 NonWritable - MemberDecorate 42(tbufName) 2 Offset 60 - MemberDecorate 42(tbufName) 3 NonWritable - MemberDecorate 42(tbufName) 3 Offset 64 - MemberDecorate 42(tbufName) 4 NonWritable - MemberDecorate 42(tbufName) 4 Offset 68 - MemberDecorate 42(tbufName) 5 NonWritable - MemberDecorate 42(tbufName) 5 Offset 72 - MemberDecorate 42(tbufName) 6 NonWritable - MemberDecorate 42(tbufName) 6 Offset 76 - MemberDecorate 42(tbufName) 7 NonWritable - MemberDecorate 42(tbufName) 7 Offset 128 - MemberDecorate 42(tbufName) 8 RowMajor - MemberDecorate 42(tbufName) 8 NonWritable - MemberDecorate 42(tbufName) 8 Offset 112 - MemberDecorate 42(tbufName) 8 MatrixStride 16 - MemberDecorate 42(tbufName) 9 ColMajor - MemberDecorate 42(tbufName) 9 NonWritable - MemberDecorate 42(tbufName) 9 Offset 176 - MemberDecorate 42(tbufName) 9 MatrixStride 16 - MemberDecorate 42(tbufName) 10 RowMajor - MemberDecorate 42(tbufName) 10 NonWritable - MemberDecorate 42(tbufName) 10 Offset 240 - MemberDecorate 42(tbufName) 10 MatrixStride 16 - MemberDecorate 42(tbufName) 11 RowMajor - MemberDecorate 42(tbufName) 11 NonWritable - MemberDecorate 42(tbufName) 11 Offset 304 - MemberDecorate 42(tbufName) 11 MatrixStride 16 - Decorate 42(tbufName) BufferBlock - Decorate 44 DescriptorSet 0 - Decorate 44 Binding 8 - Decorate 54(input) BuiltIn FragCoord - Decorate 57(@entryPointOutput) Location 0 + Name 12 "id" + MemberName 12(id) 0 "a" + Name 15 "@PixelShaderFunction(vf4;" + Name 14 "input" + Name 21 "ret" + Name 24 "cbufName2" + MemberName 24(cbufName2) 0 "v24" + Name 26 "" + Name 31 "buf1" + MemberName 31(buf1) 0 "v1" + Name 33 "" + Name 37 "buf2" + MemberName 37(buf2) 0 "v2" + Name 39 "" + Name 43 "cbufName" + MemberName 43(cbufName) 0 "v3" + MemberName 43(cbufName) 1 "i3" + Name 45 "" + Name 50 "tbufName" + MemberName 50(tbufName) 0 "v4" + MemberName 50(tbufName) 1 "i4" + MemberName 50(tbufName) 2 "f1" + MemberName 50(tbufName) 3 "f3" + MemberName 50(tbufName) 4 "f4" + MemberName 50(tbufName) 5 "f5" + MemberName 50(tbufName) 6 "f6" + MemberName 50(tbufName) 7 "f7" + MemberName 50(tbufName) 8 "m1" + MemberName 50(tbufName) 9 "m2" + MemberName 50(tbufName) 10 "m3" + MemberName 50(tbufName) 11 "m4" + Name 52 "" + Name 63 "input" + Name 65 "input" + Name 68 "@entryPointOutput.a" + Name 69 "param" + MemberDecorate 24(cbufName2) 0 Offset 0 + Decorate 24(cbufName2) Block + Decorate 26 DescriptorSet 0 + MemberDecorate 31(buf1) 0 Offset 0 + Decorate 31(buf1) Block + Decorate 33 DescriptorSet 0 + MemberDecorate 37(buf2) 0 NonWritable + MemberDecorate 37(buf2) 0 Offset 0 + Decorate 37(buf2) BufferBlock + Decorate 39 DescriptorSet 0 + MemberDecorate 43(cbufName) 0 Offset 0 + MemberDecorate 43(cbufName) 1 Offset 20 + Decorate 43(cbufName) Block + Decorate 45 DescriptorSet 0 + MemberDecorate 50(tbufName) 0 NonWritable + MemberDecorate 50(tbufName) 0 Offset 16 + MemberDecorate 50(tbufName) 1 NonWritable + MemberDecorate 50(tbufName) 1 Offset 48 + MemberDecorate 50(tbufName) 2 NonWritable + MemberDecorate 50(tbufName) 2 Offset 60 + MemberDecorate 50(tbufName) 3 NonWritable + MemberDecorate 50(tbufName) 3 Offset 64 + MemberDecorate 50(tbufName) 4 NonWritable + MemberDecorate 50(tbufName) 4 Offset 68 + MemberDecorate 50(tbufName) 5 NonWritable + MemberDecorate 50(tbufName) 5 Offset 72 + MemberDecorate 50(tbufName) 6 NonWritable + MemberDecorate 50(tbufName) 6 Offset 76 + MemberDecorate 50(tbufName) 7 NonWritable + MemberDecorate 50(tbufName) 7 Offset 128 + MemberDecorate 50(tbufName) 8 RowMajor + MemberDecorate 50(tbufName) 8 NonWritable + MemberDecorate 50(tbufName) 8 Offset 112 + MemberDecorate 50(tbufName) 8 MatrixStride 16 + MemberDecorate 50(tbufName) 9 ColMajor + MemberDecorate 50(tbufName) 9 NonWritable + MemberDecorate 50(tbufName) 9 Offset 176 + MemberDecorate 50(tbufName) 9 MatrixStride 16 + MemberDecorate 50(tbufName) 10 RowMajor + MemberDecorate 50(tbufName) 10 NonWritable + MemberDecorate 50(tbufName) 10 Offset 240 + MemberDecorate 50(tbufName) 10 MatrixStride 16 + MemberDecorate 50(tbufName) 11 RowMajor + MemberDecorate 50(tbufName) 11 NonWritable + MemberDecorate 50(tbufName) 11 Offset 304 + MemberDecorate 50(tbufName) 11 MatrixStride 16 + Decorate 50(tbufName) BufferBlock + Decorate 52 DescriptorSet 0 + Decorate 52 Binding 8 + Decorate 65(input) BuiltIn FragCoord + Decorate 68(@entryPointOutput.a) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeFunction 6(float) 10: TypeVector 6(float) 4 11: TypePointer Function 10(fvec4) - 12: TypeFunction 10(fvec4) 11(ptr) - 16: 6(float) Constant 1065353216 - 20(buf1): TypeStruct 10(fvec4) - 21: TypePointer Uniform 20(buf1) - 22: 21(ptr) Variable Uniform - 23: TypeInt 32 1 - 24: 23(int) Constant 0 - 25: TypePointer Uniform 10(fvec4) - 29(buf2): TypeStruct 10(fvec4) - 30: TypePointer Uniform 29(buf2) - 31: 30(ptr) Variable Uniform - 35(cbufName): TypeStruct 10(fvec4) 23(int) - 36: TypePointer Uniform 35(cbufName) - 37: 36(ptr) Variable Uniform - 41: TypeMatrix 10(fvec4) 3 - 42(tbufName): TypeStruct 10(fvec4) 23(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 41 41 41 41 - 43: TypePointer Uniform 42(tbufName) - 44: 43(ptr) Variable Uniform - 53: TypePointer Input 10(fvec4) - 54(input): 53(ptr) Variable Input - 56: TypePointer Output 10(fvec4) -57(@entryPointOutput): 56(ptr) Variable Output + 12(id): TypeStruct 10(fvec4) + 13: TypeFunction 12(id) 11(ptr) + 17: 6(float) Constant 1065353216 + 20: TypePointer Function 12(id) + 22: TypeInt 32 1 + 23: 22(int) Constant 0 + 24(cbufName2): TypeStruct 10(fvec4) + 25: TypePointer Uniform 24(cbufName2) + 26: 25(ptr) Variable Uniform + 27: TypePointer Uniform 10(fvec4) + 31(buf1): TypeStruct 10(fvec4) + 32: TypePointer Uniform 31(buf1) + 33: 32(ptr) Variable Uniform + 37(buf2): TypeStruct 10(fvec4) + 38: TypePointer Uniform 37(buf2) + 39: 38(ptr) Variable Uniform + 43(cbufName): TypeStruct 10(fvec4) 22(int) + 44: TypePointer Uniform 43(cbufName) + 45: 44(ptr) Variable Uniform + 49: TypeMatrix 10(fvec4) 3 + 50(tbufName): TypeStruct 10(fvec4) 22(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 49 49 49 49 + 51: TypePointer Uniform 50(tbufName) + 52: 51(ptr) Variable Uniform + 64: TypePointer Input 10(fvec4) + 65(input): 64(ptr) Variable Input + 67: TypePointer Output 10(fvec4) +68(@entryPointOutput.a): 67(ptr) Variable Output 4(PixelShaderFunction): 2 Function None 3 5: Label - 52(input): 11(ptr) Variable Function - 58(param): 11(ptr) Variable Function - 55: 10(fvec4) Load 54(input) - Store 52(input) 55 - 59: 10(fvec4) Load 52(input) - Store 58(param) 59 - 60: 10(fvec4) FunctionCall 14(@PixelShaderFunction(vf4;) 58(param) - Store 57(@entryPointOutput) 60 + 63(input): 11(ptr) Variable Function + 69(param): 11(ptr) Variable Function + 66: 10(fvec4) Load 65(input) + Store 63(input) 66 + 70: 10(fvec4) Load 63(input) + Store 69(param) 70 + 71: 12(id) FunctionCall 15(@PixelShaderFunction(vf4;) 69(param) + 72: 10(fvec4) CompositeExtract 71 0 + Store 68(@entryPointOutput.a) 72 Return FunctionEnd 8(foo(): 6(float) Function None 7 9: Label - ReturnValue 16 + ReturnValue 17 FunctionEnd -14(@PixelShaderFunction(vf4;): 10(fvec4) Function None 12 - 13(input): 11(ptr) FunctionParameter - 15: Label - 19: 10(fvec4) Load 13(input) - 26: 25(ptr) AccessChain 22 24 - 27: 10(fvec4) Load 26 - 28: 10(fvec4) FAdd 19 27 - 32: 25(ptr) AccessChain 31 24 - 33: 10(fvec4) Load 32 - 34: 10(fvec4) FAdd 28 33 - 38: 25(ptr) AccessChain 37 24 - 39: 10(fvec4) Load 38 - 40: 10(fvec4) FAdd 34 39 - 45: 25(ptr) AccessChain 44 24 - 46: 10(fvec4) Load 45 - 47: 10(fvec4) FAdd 40 46 - 48: 6(float) FunctionCall 8(foo() - 49: 10(fvec4) VectorTimesScalar 47 48 - ReturnValue 49 +15(@PixelShaderFunction(vf4;): 12(id) Function None 13 + 14(input): 11(ptr) FunctionParameter + 16: Label + 21(ret): 20(ptr) Variable Function + 28: 27(ptr) AccessChain 26 23 + 29: 10(fvec4) Load 28 + 30: 10(fvec4) Load 14(input) + 34: 27(ptr) AccessChain 33 23 + 35: 10(fvec4) Load 34 + 36: 10(fvec4) FAdd 30 35 + 40: 27(ptr) AccessChain 39 23 + 41: 10(fvec4) Load 40 + 42: 10(fvec4) FAdd 36 41 + 46: 27(ptr) AccessChain 45 23 + 47: 10(fvec4) Load 46 + 48: 10(fvec4) FAdd 42 47 + 53: 27(ptr) AccessChain 52 23 + 54: 10(fvec4) Load 53 + 55: 10(fvec4) FAdd 48 54 + 56: 6(float) FunctionCall 8(foo() + 57: 10(fvec4) VectorTimesScalar 55 56 + 58: 10(fvec4) FAdd 29 57 + 59: 11(ptr) AccessChain 21(ret) 23 + Store 59 58 + 60: 12(id) Load 21(ret) + ReturnValue 60 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out index bbdd2161f0a..46b4eea5c6c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelod.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.calculatelod.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -181,6 +182,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -356,7 +358,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 148 Capability Shader @@ -367,6 +369,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 140 144 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out index f85d9b51f36..ef5aabe545d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.calculatelodunclamped.dx10.frag.out @@ -1,19 +1,8 @@ hlsl.calculatelodunclamped.dx10.frag -ERROR: 0:28: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:29: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:30: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:32: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:33: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:34: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:36: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:37: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 0:38: '' : unimplemented: CalculateLevelOfDetailUnclamped -ERROR: 9 compilation errors. No code generated. - - Shader version: 500 gl_FragCoord origin is upper left -ERROR: node is still EOpNull! +using depth_any +0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: 0:? Sequence @@ -28,7 +17,7 @@ ERROR: node is still EOpNull! 0:28 Constant: 0:28 0.100000 0:28 Constant: -0:28 0 (const int) +0:28 1 (const int) 0:29 Sequence 0:29 move second child to first child ( temp float) 0:29 'txval11' ( temp float) @@ -40,7 +29,7 @@ ERROR: node is still EOpNull! 0:29 Constant: 0:29 0.200000 0:29 Constant: -0:29 0 (const int) +0:29 1 (const int) 0:30 Sequence 0:30 move second child to first child ( temp float) 0:30 'txval12' ( temp float) @@ -52,7 +41,7 @@ ERROR: node is still EOpNull! 0:30 Constant: 0:30 0.300000 0:30 Constant: -0:30 0 (const int) +0:30 1 (const int) 0:32 Sequence 0:32 move second child to first child ( temp float) 0:32 'txval20' ( temp float) @@ -65,7 +54,7 @@ ERROR: node is still EOpNull! 0:? 0.100000 0:? 0.200000 0:32 Constant: -0:32 0 (const int) +0:32 1 (const int) 0:33 Sequence 0:33 move second child to first child ( temp float) 0:33 'txval21' ( temp float) @@ -78,7 +67,7 @@ ERROR: node is still EOpNull! 0:? 0.300000 0:? 0.400000 0:33 Constant: -0:33 0 (const int) +0:33 1 (const int) 0:34 Sequence 0:34 move second child to first child ( temp float) 0:34 'txval22' ( temp float) @@ -91,7 +80,7 @@ ERROR: node is still EOpNull! 0:? 0.500000 0:? 0.600000 0:34 Constant: -0:34 0 (const int) +0:34 1 (const int) 0:36 Sequence 0:36 move second child to first child ( temp float) 0:36 'txval40' ( temp float) @@ -105,7 +94,7 @@ ERROR: node is still EOpNull! 0:? 0.200000 0:? 0.300000 0:36 Constant: -0:36 0 (const int) +0:36 1 (const int) 0:37 Sequence 0:37 move second child to first child ( temp float) 0:37 'txval41' ( temp float) @@ -119,7 +108,7 @@ ERROR: node is still EOpNull! 0:? 0.500000 0:? 0.600000 0:37 Constant: -0:37 0 (const int) +0:37 1 (const int) 0:38 Sequence 0:38 move second child to first child ( temp float) 0:38 'txval42' ( temp float) @@ -133,7 +122,7 @@ ERROR: node is still EOpNull! 0:? 0.800000 0:? 0.900000 0:38 Constant: -0:38 0 (const int) +0:38 1 (const int) 0:40 move second child to first child ( temp 4-component vector of float) 0:40 Color: direct index for structure ( temp 4-component vector of float) 0:40 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) @@ -193,7 +182,8 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left -ERROR: node is still EOpNull! +using depth_any +0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: 0:? Sequence @@ -208,7 +198,7 @@ ERROR: node is still EOpNull! 0:28 Constant: 0:28 0.100000 0:28 Constant: -0:28 0 (const int) +0:28 1 (const int) 0:29 Sequence 0:29 move second child to first child ( temp float) 0:29 'txval11' ( temp float) @@ -220,7 +210,7 @@ ERROR: node is still EOpNull! 0:29 Constant: 0:29 0.200000 0:29 Constant: -0:29 0 (const int) +0:29 1 (const int) 0:30 Sequence 0:30 move second child to first child ( temp float) 0:30 'txval12' ( temp float) @@ -232,7 +222,7 @@ ERROR: node is still EOpNull! 0:30 Constant: 0:30 0.300000 0:30 Constant: -0:30 0 (const int) +0:30 1 (const int) 0:32 Sequence 0:32 move second child to first child ( temp float) 0:32 'txval20' ( temp float) @@ -245,7 +235,7 @@ ERROR: node is still EOpNull! 0:? 0.100000 0:? 0.200000 0:32 Constant: -0:32 0 (const int) +0:32 1 (const int) 0:33 Sequence 0:33 move second child to first child ( temp float) 0:33 'txval21' ( temp float) @@ -258,7 +248,7 @@ ERROR: node is still EOpNull! 0:? 0.300000 0:? 0.400000 0:33 Constant: -0:33 0 (const int) +0:33 1 (const int) 0:34 Sequence 0:34 move second child to first child ( temp float) 0:34 'txval22' ( temp float) @@ -271,7 +261,7 @@ ERROR: node is still EOpNull! 0:? 0.500000 0:? 0.600000 0:34 Constant: -0:34 0 (const int) +0:34 1 (const int) 0:36 Sequence 0:36 move second child to first child ( temp float) 0:36 'txval40' ( temp float) @@ -285,7 +275,7 @@ ERROR: node is still EOpNull! 0:? 0.200000 0:? 0.300000 0:36 Constant: -0:36 0 (const int) +0:36 1 (const int) 0:37 Sequence 0:37 move second child to first child ( temp float) 0:37 'txval41' ( temp float) @@ -299,7 +289,7 @@ ERROR: node is still EOpNull! 0:? 0.500000 0:? 0.600000 0:37 Constant: -0:37 0 (const int) +0:37 1 (const int) 0:38 Sequence 0:38 move second child to first child ( temp float) 0:38 'txval42' ( temp float) @@ -313,7 +303,7 @@ ERROR: node is still EOpNull! 0:? 0.800000 0:? 0.900000 0:38 Constant: -0:38 0 (const int) +0:38 1 (const int) 0:40 move second child to first child ( temp 4-component vector of float) 0:40 Color: direct index for structure ( temp 4-component vector of float) 0:40 'psout' ( temp structure{ temp 4-component vector of float Color, temp float Depth}) @@ -367,4 +357,224 @@ ERROR: node is still EOpNull! 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) -SPIR-V is not generated for failed compile or link +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 148 + + Capability Shader + Capability Sampled1D + Capability SampledCubeArray + Capability ImageQuery + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 140 144 + ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing + Source HLSL 500 + Name 4 "main" + Name 8 "PS_OUTPUT" + MemberName 8(PS_OUTPUT) 0 "Color" + MemberName 8(PS_OUTPUT) 1 "Depth" + Name 10 "@main(" + Name 13 "txval10" + Name 16 "g_tTex1df4a" + Name 20 "g_sSamp" + Name 30 "txval11" + Name 33 "g_tTex1di4a" + Name 41 "txval12" + Name 45 "g_tTex1du4a" + Name 53 "txval20" + Name 56 "g_tTex2df4a" + Name 64 "txval21" + Name 67 "g_tTex2di4a" + Name 76 "txval22" + Name 79 "g_tTex2du4a" + Name 89 "txval40" + Name 92 "g_tTexcdf4a" + Name 101 "txval41" + Name 104 "g_tTexcdi4a" + Name 112 "txval42" + Name 115 "g_tTexcdu4a" + Name 127 "psout" + Name 137 "flattenTemp" + Name 140 "@entryPointOutput.Color" + Name 144 "@entryPointOutput.Depth" + Name 147 "g_tTex1df4" + Decorate 16(g_tTex1df4a) DescriptorSet 0 + Decorate 16(g_tTex1df4a) Binding 1 + Decorate 20(g_sSamp) DescriptorSet 0 + Decorate 20(g_sSamp) Binding 0 + Decorate 33(g_tTex1di4a) DescriptorSet 0 + Decorate 45(g_tTex1du4a) DescriptorSet 0 + Decorate 56(g_tTex2df4a) DescriptorSet 0 + Decorate 67(g_tTex2di4a) DescriptorSet 0 + Decorate 79(g_tTex2du4a) DescriptorSet 0 + Decorate 92(g_tTexcdf4a) DescriptorSet 0 + Decorate 104(g_tTexcdi4a) DescriptorSet 0 + Decorate 115(g_tTexcdu4a) DescriptorSet 0 + Decorate 140(@entryPointOutput.Color) Location 0 + Decorate 144(@entryPointOutput.Depth) BuiltIn FragDepth + Decorate 147(g_tTex1df4) DescriptorSet 0 + Decorate 147(g_tTex1df4) Binding 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(PS_OUTPUT): TypeStruct 7(fvec4) 6(float) + 9: TypeFunction 8(PS_OUTPUT) + 12: TypePointer Function 6(float) + 14: TypeImage 6(float) 1D array sampled format:Unknown + 15: TypePointer UniformConstant 14 + 16(g_tTex1df4a): 15(ptr) Variable UniformConstant + 18: TypeSampler + 19: TypePointer UniformConstant 18 + 20(g_sSamp): 19(ptr) Variable UniformConstant + 22: TypeSampledImage 14 + 24: 6(float) Constant 1036831949 + 25: TypeVector 6(float) 2 + 27: TypeInt 32 1 + 28: 27(int) Constant 1 + 31: TypeImage 27(int) 1D array sampled format:Unknown + 32: TypePointer UniformConstant 31 + 33(g_tTex1di4a): 32(ptr) Variable UniformConstant + 36: TypeSampledImage 31 + 38: 6(float) Constant 1045220557 + 42: TypeInt 32 0 + 43: TypeImage 42(int) 1D array sampled format:Unknown + 44: TypePointer UniformConstant 43 + 45(g_tTex1du4a): 44(ptr) Variable UniformConstant + 48: TypeSampledImage 43 + 50: 6(float) Constant 1050253722 + 54: TypeImage 6(float) 2D array sampled format:Unknown + 55: TypePointer UniformConstant 54 + 56(g_tTex2df4a): 55(ptr) Variable UniformConstant + 59: TypeSampledImage 54 + 61: 25(fvec2) ConstantComposite 24 38 + 65: TypeImage 27(int) 2D array sampled format:Unknown + 66: TypePointer UniformConstant 65 + 67(g_tTex2di4a): 66(ptr) Variable UniformConstant + 70: TypeSampledImage 65 + 72: 6(float) Constant 1053609165 + 73: 25(fvec2) ConstantComposite 50 72 + 77: TypeImage 42(int) 2D array sampled format:Unknown + 78: TypePointer UniformConstant 77 + 79(g_tTex2du4a): 78(ptr) Variable UniformConstant + 82: TypeSampledImage 77 + 84: 6(float) Constant 1056964608 + 85: 6(float) Constant 1058642330 + 86: 25(fvec2) ConstantComposite 84 85 + 90: TypeImage 6(float) Cube array sampled format:Unknown + 91: TypePointer UniformConstant 90 + 92(g_tTexcdf4a): 91(ptr) Variable UniformConstant + 95: TypeSampledImage 90 + 97: TypeVector 6(float) 3 + 98: 97(fvec3) ConstantComposite 24 38 50 + 102: TypeImage 27(int) Cube array sampled format:Unknown + 103: TypePointer UniformConstant 102 +104(g_tTexcdi4a): 103(ptr) Variable UniformConstant + 107: TypeSampledImage 102 + 109: 97(fvec3) ConstantComposite 72 84 85 + 113: TypeImage 42(int) Cube array sampled format:Unknown + 114: TypePointer UniformConstant 113 +115(g_tTexcdu4a): 114(ptr) Variable UniformConstant + 118: TypeSampledImage 113 + 120: 6(float) Constant 1060320051 + 121: 6(float) Constant 1061997773 + 122: 6(float) Constant 1063675494 + 123: 97(fvec3) ConstantComposite 120 121 122 + 126: TypePointer Function 8(PS_OUTPUT) + 128: 27(int) Constant 0 + 129: 6(float) Constant 1065353216 + 130: 7(fvec4) ConstantComposite 129 129 129 129 + 131: TypePointer Function 7(fvec4) + 139: TypePointer Output 7(fvec4) +140(@entryPointOutput.Color): 139(ptr) Variable Output + 143: TypePointer Output 6(float) +144(@entryPointOutput.Depth): 143(ptr) Variable Output + 147(g_tTex1df4): 15(ptr) Variable UniformConstant + 4(main): 2 Function None 3 + 5: Label +137(flattenTemp): 126(ptr) Variable Function + 138:8(PS_OUTPUT) FunctionCall 10(@main() + Store 137(flattenTemp) 138 + 141: 131(ptr) AccessChain 137(flattenTemp) 128 + 142: 7(fvec4) Load 141 + Store 140(@entryPointOutput.Color) 142 + 145: 12(ptr) AccessChain 137(flattenTemp) 28 + 146: 6(float) Load 145 + Store 144(@entryPointOutput.Depth) 146 + Return + FunctionEnd + 10(@main():8(PS_OUTPUT) Function None 9 + 11: Label + 13(txval10): 12(ptr) Variable Function + 30(txval11): 12(ptr) Variable Function + 41(txval12): 12(ptr) Variable Function + 53(txval20): 12(ptr) Variable Function + 64(txval21): 12(ptr) Variable Function + 76(txval22): 12(ptr) Variable Function + 89(txval40): 12(ptr) Variable Function + 101(txval41): 12(ptr) Variable Function + 112(txval42): 12(ptr) Variable Function + 127(psout): 126(ptr) Variable Function + 17: 14 Load 16(g_tTex1df4a) + 21: 18 Load 20(g_sSamp) + 23: 22 SampledImage 17 21 + 26: 25(fvec2) ImageQueryLod 23 24 + 29: 6(float) CompositeExtract 26 1 + Store 13(txval10) 29 + 34: 31 Load 33(g_tTex1di4a) + 35: 18 Load 20(g_sSamp) + 37: 36 SampledImage 34 35 + 39: 25(fvec2) ImageQueryLod 37 38 + 40: 6(float) CompositeExtract 39 1 + Store 30(txval11) 40 + 46: 43 Load 45(g_tTex1du4a) + 47: 18 Load 20(g_sSamp) + 49: 48 SampledImage 46 47 + 51: 25(fvec2) ImageQueryLod 49 50 + 52: 6(float) CompositeExtract 51 1 + Store 41(txval12) 52 + 57: 54 Load 56(g_tTex2df4a) + 58: 18 Load 20(g_sSamp) + 60: 59 SampledImage 57 58 + 62: 25(fvec2) ImageQueryLod 60 61 + 63: 6(float) CompositeExtract 62 1 + Store 53(txval20) 63 + 68: 65 Load 67(g_tTex2di4a) + 69: 18 Load 20(g_sSamp) + 71: 70 SampledImage 68 69 + 74: 25(fvec2) ImageQueryLod 71 73 + 75: 6(float) CompositeExtract 74 1 + Store 64(txval21) 75 + 80: 77 Load 79(g_tTex2du4a) + 81: 18 Load 20(g_sSamp) + 83: 82 SampledImage 80 81 + 87: 25(fvec2) ImageQueryLod 83 86 + 88: 6(float) CompositeExtract 87 1 + Store 76(txval22) 88 + 93: 90 Load 92(g_tTexcdf4a) + 94: 18 Load 20(g_sSamp) + 96: 95 SampledImage 93 94 + 99: 25(fvec2) ImageQueryLod 96 98 + 100: 6(float) CompositeExtract 99 1 + Store 89(txval40) 100 + 105: 102 Load 104(g_tTexcdi4a) + 106: 18 Load 20(g_sSamp) + 108: 107 SampledImage 105 106 + 110: 25(fvec2) ImageQueryLod 108 109 + 111: 6(float) CompositeExtract 110 1 + Store 101(txval41) 111 + 116: 113 Load 115(g_tTexcdu4a) + 117: 18 Load 20(g_sSamp) + 119: 118 SampledImage 116 117 + 124: 25(fvec2) ImageQueryLod 119 123 + 125: 6(float) CompositeExtract 124 1 + Store 112(txval42) 125 + 132: 131(ptr) AccessChain 127(psout) 128 + Store 132 130 + 133: 12(ptr) AccessChain 127(psout) 28 + Store 133 129 + 134:8(PS_OUTPUT) Load 127(psout) + ReturnValue 134 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cast.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cast.frag.out index 5d7cd71122a..0aa11bead63 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cast.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cast.frag.out @@ -9,8 +9,7 @@ gl_FragCoord origin is upper left 0:3 Branch: Return with expression 0:3 add ( temp 4-component vector of float) 0:3 add ( temp 4-component vector of float) -0:3 Construct vec4 ( temp 4-component vector of float) -0:3 'input' ( in 4-component vector of float) +0:3 'input' ( in 4-component vector of float) 0:3 Convert int to float ( temp 4-component vector of float) 0:3 Convert float to int ( temp 4-component vector of int) 0:3 'input' ( in 4-component vector of float) @@ -47,8 +46,7 @@ gl_FragCoord origin is upper left 0:3 Branch: Return with expression 0:3 add ( temp 4-component vector of float) 0:3 add ( temp 4-component vector of float) -0:3 Construct vec4 ( temp 4-component vector of float) -0:3 'input' ( in 4-component vector of float) +0:3 'input' ( in 4-component vector of float) 0:3 Convert int to float ( temp 4-component vector of float) 0:3 Convert float to int ( temp 4-component vector of int) 0:3 'input' ( in 4-component vector of float) @@ -72,63 +70,58 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 39 +// Generated by (magic number): 80007 +// Id's are bound by 34 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "PixelShaderFunction" 32 35 + EntryPoint Fragment 4 "PixelShaderFunction" 27 30 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "PixelShaderFunction" Name 11 "@PixelShaderFunction(vf4;" Name 10 "input" - Name 30 "input" - Name 32 "input" - Name 35 "@entryPointOutput" - Name 36 "param" - Decorate 32(input) Location 0 - Decorate 35(@entryPointOutput) Location 0 + Name 25 "input" + Name 27 "input" + Name 30 "@entryPointOutput" + Name 31 "param" + Decorate 27(input) Location 0 + Decorate 30(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypePointer Function 7(fvec4) 9: TypeFunction 7(fvec4) 8(ptr) - 20: TypeInt 32 1 - 21: TypeVector 20(int) 4 - 25: 6(float) Constant 1067014160 - 26: 7(fvec4) ConstantComposite 25 25 25 25 - 31: TypePointer Input 7(fvec4) - 32(input): 31(ptr) Variable Input - 34: TypePointer Output 7(fvec4) -35(@entryPointOutput): 34(ptr) Variable Output + 15: TypeInt 32 1 + 16: TypeVector 15(int) 4 + 20: 6(float) Constant 1067014160 + 21: 7(fvec4) ConstantComposite 20 20 20 20 + 26: TypePointer Input 7(fvec4) + 27(input): 26(ptr) Variable Input + 29: TypePointer Output 7(fvec4) +30(@entryPointOutput): 29(ptr) Variable Output 4(PixelShaderFunction): 2 Function None 3 5: Label - 30(input): 8(ptr) Variable Function - 36(param): 8(ptr) Variable Function - 33: 7(fvec4) Load 32(input) - Store 30(input) 33 - 37: 7(fvec4) Load 30(input) - Store 36(param) 37 - 38: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 36(param) - Store 35(@entryPointOutput) 38 + 25(input): 8(ptr) Variable Function + 31(param): 8(ptr) Variable Function + 28: 7(fvec4) Load 27(input) + Store 25(input) 28 + 32: 7(fvec4) Load 25(input) + Store 31(param) 32 + 33: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 31(param) + Store 30(@entryPointOutput) 33 Return FunctionEnd 11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9 10(input): 8(ptr) FunctionParameter 12: Label 13: 7(fvec4) Load 10(input) - 14: 6(float) CompositeExtract 13 0 - 15: 6(float) CompositeExtract 13 1 - 16: 6(float) CompositeExtract 13 2 - 17: 6(float) CompositeExtract 13 3 - 18: 7(fvec4) CompositeConstruct 14 15 16 17 - 19: 7(fvec4) Load 10(input) - 22: 21(ivec4) ConvertFToS 19 - 23: 7(fvec4) ConvertSToF 22 - 24: 7(fvec4) FAdd 18 23 - 27: 7(fvec4) FAdd 24 26 - ReturnValue 27 + 14: 7(fvec4) Load 10(input) + 17: 16(ivec4) ConvertFToS 14 + 18: 7(fvec4) ConvertSToF 17 + 19: 7(fvec4) FAdd 13 18 + 22: 7(fvec4) FAdd 19 21 + ReturnValue 22 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out new file mode 100644 index 00000000000..f7225f844b1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.cbuffer-identifier.vert.out @@ -0,0 +1,404 @@ +hlsl.cbuffer-identifier.vert +WARNING: 0:29: '' : mul() matrix size mismatch + +Shader version: 500 +0:? Sequence +0:22 Function Definition: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Function Parameters: +0:22 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:? Sequence +0:23 Sequence +0:23 move second child to first child ( temp int) +0:23 'ConstantBuffer' ( temp int) +0:23 Constant: +0:23 42 (const int) +0:25 Sequence +0:25 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:25 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:25 Constant: +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:26 move second child to first child ( temp 4-component vector of float) +0:26 Pos: direct index for structure ( temp 4-component vector of float) +0:26 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:26 Constant: +0:26 0 (const int) +0:26 matrix-times-vector ( temp 4-component vector of float) +0:26 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:26 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:26 Constant: +0:26 0 (const uint) +0:26 Pos: direct index for structure ( temp 4-component vector of float) +0:26 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:26 Constant: +0:26 0 (const int) +0:27 move second child to first child ( temp 4-component vector of float) +0:27 Pos: direct index for structure ( temp 4-component vector of float) +0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:27 Constant: +0:27 0 (const int) +0:27 matrix-times-vector ( temp 4-component vector of float) +0:27 View: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:27 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:27 Constant: +0:27 1 (const uint) +0:27 Pos: direct index for structure ( temp 4-component vector of float) +0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:27 Constant: +0:27 0 (const int) +0:28 move second child to first child ( temp 4-component vector of float) +0:28 Pos: direct index for structure ( temp 4-component vector of float) +0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:28 Constant: +0:28 0 (const int) +0:28 matrix-times-vector ( temp 4-component vector of float) +0:28 Projection: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:28 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:28 Constant: +0:28 2 (const uint) +0:28 Pos: direct index for structure ( temp 4-component vector of float) +0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:28 Constant: +0:28 0 (const int) +0:29 move second child to first child ( temp 3-component vector of float) +0:29 Norm: direct index for structure ( temp 3-component vector of float) +0:29 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:29 Constant: +0:29 1 (const int) +0:29 Construct vec3 ( temp 3-component vector of float) +0:29 matrix-times-vector ( temp 4-component vector of float) +0:29 Construct mat3x4 ( uniform 3X4 matrix of float) +0:29 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:29 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:29 Constant: +0:29 0 (const uint) +0:29 Norm: direct index for structure ( temp 3-component vector of float) +0:29 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:29 Constant: +0:29 1 (const int) +0:31 Branch: Return with expression +0:31 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Function Definition: main( ( temp void) +0:22 Function Parameters: +0:? Sequence +0:22 Sequence +0:22 move second child to first child ( temp 4-component vector of float) +0:22 Pos: direct index for structure ( temp 4-component vector of float) +0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 0 (const int) +0:? 'input.Pos' (layout( location=0) in 4-component vector of float) +0:22 move second child to first child ( temp 3-component vector of float) +0:22 Norm: direct index for structure ( temp 3-component vector of float) +0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 1 (const int) +0:? 'input.Norm' (layout( location=1) in 3-component vector of float) +0:22 Sequence +0:22 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Function Call: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) +0:22 Pos: direct index for structure ( temp 4-component vector of float) +0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 0 (const int) +0:22 move second child to first child ( temp 3-component vector of float) +0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float) +0:22 Norm: direct index for structure ( temp 3-component vector of float) +0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) +0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float) +0:? 'input.Pos' (layout( location=0) in 4-component vector of float) +0:? 'input.Norm' (layout( location=1) in 3-component vector of float) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:22 Function Definition: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Function Parameters: +0:22 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:? Sequence +0:23 Sequence +0:23 move second child to first child ( temp int) +0:23 'ConstantBuffer' ( temp int) +0:23 Constant: +0:23 42 (const int) +0:25 Sequence +0:25 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:25 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:25 Constant: +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:25 0.000000 +0:26 move second child to first child ( temp 4-component vector of float) +0:26 Pos: direct index for structure ( temp 4-component vector of float) +0:26 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:26 Constant: +0:26 0 (const int) +0:26 matrix-times-vector ( temp 4-component vector of float) +0:26 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:26 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:26 Constant: +0:26 0 (const uint) +0:26 Pos: direct index for structure ( temp 4-component vector of float) +0:26 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:26 Constant: +0:26 0 (const int) +0:27 move second child to first child ( temp 4-component vector of float) +0:27 Pos: direct index for structure ( temp 4-component vector of float) +0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:27 Constant: +0:27 0 (const int) +0:27 matrix-times-vector ( temp 4-component vector of float) +0:27 View: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:27 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:27 Constant: +0:27 1 (const uint) +0:27 Pos: direct index for structure ( temp 4-component vector of float) +0:27 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:27 Constant: +0:27 0 (const int) +0:28 move second child to first child ( temp 4-component vector of float) +0:28 Pos: direct index for structure ( temp 4-component vector of float) +0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:28 Constant: +0:28 0 (const int) +0:28 matrix-times-vector ( temp 4-component vector of float) +0:28 Projection: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:28 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:28 Constant: +0:28 2 (const uint) +0:28 Pos: direct index for structure ( temp 4-component vector of float) +0:28 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:28 Constant: +0:28 0 (const int) +0:29 move second child to first child ( temp 3-component vector of float) +0:29 Norm: direct index for structure ( temp 3-component vector of float) +0:29 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:29 Constant: +0:29 1 (const int) +0:29 Construct vec3 ( temp 3-component vector of float) +0:29 matrix-times-vector ( temp 4-component vector of float) +0:29 Construct mat3x4 ( uniform 3X4 matrix of float) +0:29 World: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:29 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:29 Constant: +0:29 0 (const uint) +0:29 Norm: direct index for structure ( temp 3-component vector of float) +0:29 'input' ( in structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:29 Constant: +0:29 1 (const int) +0:31 Branch: Return with expression +0:31 'output' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Function Definition: main( ( temp void) +0:22 Function Parameters: +0:? Sequence +0:22 Sequence +0:22 move second child to first child ( temp 4-component vector of float) +0:22 Pos: direct index for structure ( temp 4-component vector of float) +0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 0 (const int) +0:? 'input.Pos' (layout( location=0) in 4-component vector of float) +0:22 move second child to first child ( temp 3-component vector of float) +0:22 Norm: direct index for structure ( temp 3-component vector of float) +0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 1 (const int) +0:? 'input.Norm' (layout( location=1) in 3-component vector of float) +0:22 Sequence +0:22 move second child to first child ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Function Call: @main(struct-VS_INPUT-vf4-vf31; ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:? 'input' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) +0:22 Pos: direct index for structure ( temp 4-component vector of float) +0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 0 (const int) +0:22 move second child to first child ( temp 3-component vector of float) +0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float) +0:22 Norm: direct index for structure ( temp 3-component vector of float) +0:22 'flattenTemp' ( temp structure{ temp 4-component vector of float Pos, temp 3-component vector of float Norm}) +0:22 Constant: +0:22 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float World, layout( row_major std140) uniform 4X4 matrix of float View, layout( row_major std140) uniform 4X4 matrix of float Projection}) +0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) +0:? '@entryPointOutput.Norm' (layout( location=0) out 3-component vector of float) +0:? 'input.Pos' (layout( location=0) in 4-component vector of float) +0:? 'input.Norm' (layout( location=1) in 3-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 93 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 74 78 86 90 + Source HLSL 500 + Name 4 "main" + Name 9 "VS_INPUT" + MemberName 9(VS_INPUT) 0 "Pos" + MemberName 9(VS_INPUT) 1 "Norm" + Name 11 "PS_INPUT" + MemberName 11(PS_INPUT) 0 "Pos" + MemberName 11(PS_INPUT) 1 "Norm" + Name 14 "@main(struct-VS_INPUT-vf4-vf31;" + Name 13 "input" + Name 18 "ConstantBuffer" + Name 21 "output" + Name 28 "C" + MemberName 28(C) 0 "World" + MemberName 28(C) 1 "View" + MemberName 28(C) 2 "Projection" + Name 30 "" + Name 72 "input" + Name 74 "input.Pos" + Name 78 "input.Norm" + Name 81 "flattenTemp" + Name 82 "param" + Name 86 "@entryPointOutput.Pos" + Name 90 "@entryPointOutput.Norm" + MemberDecorate 28(C) 0 RowMajor + MemberDecorate 28(C) 0 Offset 0 + MemberDecorate 28(C) 0 MatrixStride 16 + MemberDecorate 28(C) 1 RowMajor + MemberDecorate 28(C) 1 Offset 64 + MemberDecorate 28(C) 1 MatrixStride 16 + MemberDecorate 28(C) 2 RowMajor + MemberDecorate 28(C) 2 Offset 128 + MemberDecorate 28(C) 2 MatrixStride 16 + Decorate 28(C) Block + Decorate 30 DescriptorSet 0 + Decorate 30 Binding 0 + Decorate 74(input.Pos) Location 0 + Decorate 78(input.Norm) Location 1 + Decorate 86(@entryPointOutput.Pos) BuiltIn Position + Decorate 90(@entryPointOutput.Norm) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeVector 6(float) 3 + 9(VS_INPUT): TypeStruct 7(fvec4) 8(fvec3) + 10: TypePointer Function 9(VS_INPUT) + 11(PS_INPUT): TypeStruct 7(fvec4) 8(fvec3) + 12: TypeFunction 11(PS_INPUT) 10(ptr) + 16: TypeInt 32 1 + 17: TypePointer Function 16(int) + 19: 16(int) Constant 42 + 20: TypePointer Function 11(PS_INPUT) + 22: 6(float) Constant 0 + 23: 7(fvec4) ConstantComposite 22 22 22 22 + 24: 8(fvec3) ConstantComposite 22 22 22 + 25:11(PS_INPUT) ConstantComposite 23 24 + 26: 16(int) Constant 0 + 27: TypeMatrix 7(fvec4) 4 + 28(C): TypeStruct 27 27 27 + 29: TypePointer Uniform 28(C) + 30: 29(ptr) Variable Uniform + 31: TypePointer Uniform 27 + 34: TypePointer Function 7(fvec4) + 39: 16(int) Constant 1 + 46: 16(int) Constant 2 + 55: TypeMatrix 7(fvec4) 3 + 60: TypePointer Function 8(fvec3) + 73: TypePointer Input 7(fvec4) + 74(input.Pos): 73(ptr) Variable Input + 77: TypePointer Input 8(fvec3) + 78(input.Norm): 77(ptr) Variable Input + 85: TypePointer Output 7(fvec4) +86(@entryPointOutput.Pos): 85(ptr) Variable Output + 89: TypePointer Output 8(fvec3) +90(@entryPointOutput.Norm): 89(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 72(input): 10(ptr) Variable Function + 81(flattenTemp): 20(ptr) Variable Function + 82(param): 10(ptr) Variable Function + 75: 7(fvec4) Load 74(input.Pos) + 76: 34(ptr) AccessChain 72(input) 26 + Store 76 75 + 79: 8(fvec3) Load 78(input.Norm) + 80: 60(ptr) AccessChain 72(input) 39 + Store 80 79 + 83: 9(VS_INPUT) Load 72(input) + Store 82(param) 83 + 84:11(PS_INPUT) FunctionCall 14(@main(struct-VS_INPUT-vf4-vf31;) 82(param) + Store 81(flattenTemp) 84 + 87: 34(ptr) AccessChain 81(flattenTemp) 26 + 88: 7(fvec4) Load 87 + Store 86(@entryPointOutput.Pos) 88 + 91: 60(ptr) AccessChain 81(flattenTemp) 39 + 92: 8(fvec3) Load 91 + Store 90(@entryPointOutput.Norm) 92 + Return + FunctionEnd +14(@main(struct-VS_INPUT-vf4-vf31;):11(PS_INPUT) Function None 12 + 13(input): 10(ptr) FunctionParameter + 15: Label +18(ConstantBuffer): 17(ptr) Variable Function + 21(output): 20(ptr) Variable Function + Store 18(ConstantBuffer) 19 + Store 21(output) 25 + 32: 31(ptr) AccessChain 30 26 + 33: 27 Load 32 + 35: 34(ptr) AccessChain 13(input) 26 + 36: 7(fvec4) Load 35 + 37: 7(fvec4) MatrixTimesVector 33 36 + 38: 34(ptr) AccessChain 21(output) 26 + Store 38 37 + 40: 31(ptr) AccessChain 30 39 + 41: 27 Load 40 + 42: 34(ptr) AccessChain 21(output) 26 + 43: 7(fvec4) Load 42 + 44: 7(fvec4) MatrixTimesVector 41 43 + 45: 34(ptr) AccessChain 21(output) 26 + Store 45 44 + 47: 31(ptr) AccessChain 30 46 + 48: 27 Load 47 + 49: 34(ptr) AccessChain 21(output) 26 + 50: 7(fvec4) Load 49 + 51: 7(fvec4) MatrixTimesVector 48 50 + 52: 34(ptr) AccessChain 21(output) 26 + Store 52 51 + 53: 31(ptr) AccessChain 30 26 + 54: 27 Load 53 + 56: 7(fvec4) CompositeExtract 54 0 + 57: 7(fvec4) CompositeExtract 54 1 + 58: 7(fvec4) CompositeExtract 54 2 + 59: 55 CompositeConstruct 56 57 58 + 61: 60(ptr) AccessChain 13(input) 39 + 62: 8(fvec3) Load 61 + 63: 7(fvec4) MatrixTimesVector 59 62 + 64: 6(float) CompositeExtract 63 0 + 65: 6(float) CompositeExtract 63 1 + 66: 6(float) CompositeExtract 63 2 + 67: 8(fvec3) CompositeConstruct 64 65 66 + 68: 60(ptr) AccessChain 21(output) 39 + Store 68 67 + 69:11(PS_INPUT) Load 21(output) + ReturnValue 69 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out index 4555ba6a2da..b09fc81f405 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out @@ -146,7 +146,7 @@ Shader version: 500 0:? '@entryPointOutput' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 58 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clip.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clip.frag.out index e2e1a0adc9d..dbf99bf5a01 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clip.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clip.frag.out @@ -74,7 +74,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 30 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out index 83278982b2e..f223ddc4f75 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.frag.out @@ -98,7 +98,7 @@ gl_FragCoord origin is upper left 0:? 'cull' ( in 1-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 53 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out index 5fd9aecb457..144b8775e25 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.geom.out @@ -550,7 +550,7 @@ output primitive = line_strip 0:? 'OutputStream.clip' ( out 2-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 118 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out index 94b1c7f92eb..d1d1370a9f4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out @@ -108,7 +108,7 @@ Shader version: 500 0:? 'cull' ( out 1-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 46 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out index cbda87cb29a..64604ebb99c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.frag.out @@ -290,7 +290,7 @@ gl_FragCoord origin is upper left 0:? 'cull' ( in 4-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 84 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out index 1b9f020ca41..a8abd02f215 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.geom.out @@ -724,7 +724,7 @@ output primitive = line_strip 0:? 'OutputStream.clip' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 128 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out index 9afe2eda4cc..397a25d7cf8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out @@ -420,7 +420,7 @@ Shader version: 500 0:? 'cull' ( out 4-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 89 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out index 1faa87e8a21..3b5082e8705 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.frag.out @@ -98,7 +98,7 @@ gl_FragCoord origin is upper left 0:? 'cull' ( in 2-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 53 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out index c99a9576596..f8ba5c6d503 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.geom.out @@ -630,7 +630,7 @@ output primitive = line_strip 0:? 'OutputStream.clip1' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 127 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out index 25ca231507d..01afd1797ea 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out @@ -136,7 +136,7 @@ Shader version: 500 0:? 'cull' ( out 2-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 51 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out index b52d917d657..95f81c9560b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.frag.out @@ -174,7 +174,7 @@ gl_FragCoord origin is upper left 0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 57 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out index 9518823959e..1096e02c25e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.geom.out @@ -612,7 +612,7 @@ output primitive = line_strip 0:? 'OutputStream.clip1' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 130 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out index 575f7d176be..d05fae41d73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out @@ -270,7 +270,7 @@ Shader version: 500 0:? '@entryPointOutput.ClipRect' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 72 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out index 7a7f9854902..afdd4c4d7d5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.frag.out @@ -232,7 +232,7 @@ gl_FragCoord origin is upper left 0:? 'v.ClipRect' ( in 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 62 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out index 5e40f8865d8..3e8f1fe771c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out @@ -318,7 +318,7 @@ Shader version: 500 0:? '@entryPointOutput.ClipRect' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 73 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out index 907122d4096..3ee8065aad3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.frag.out @@ -282,7 +282,7 @@ gl_FragCoord origin is upper left 0:? 'v.clip1' ( in 8-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 79 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out index 15c987cb3de..a386d0ac584 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-6.vert.out @@ -428,7 +428,7 @@ Shader version: 500 0:? '@entryPointOutput.clip1' ( out 8-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 86 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out index 03c329f08b3..94b6a791fc3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.frag.out @@ -270,7 +270,7 @@ gl_FragCoord origin is upper left 0:? 'v.clip1' ( in 8-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 78 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out index 468ea66388f..87e34bd8ac3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-7.vert.out @@ -384,7 +384,7 @@ Shader version: 500 0:? '@entryPointOutput.clip1' ( out 8-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 81 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out index 6abc4b13136..98c9505c86f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.frag.out @@ -186,7 +186,7 @@ gl_FragCoord origin is upper left 0:? 'v.clip1' ( in 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 65 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out index 6188f6e8f13..88800e3c4e4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-8.vert.out @@ -240,7 +240,7 @@ Shader version: 500 0:? '@entryPointOutput.clip1' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 62 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out index 57a722bccb6..ff7f261902f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.frag.out @@ -144,7 +144,7 @@ gl_FragCoord origin is upper left 0:? 'clip0' ( in 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 68 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out index 1dc83551713..2d0c9b02e22 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.clipdistance-9.vert.out @@ -194,7 +194,7 @@ Shader version: 500 0:? 'clip0' ( out 4-element array of float ClipDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 67 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.color.hull.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.color.hull.tesc.out new file mode 100644 index 00000000000..72e0b7e7633 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.color.hull.tesc.out @@ -0,0 +1,572 @@ +hlsl.color.hull.tesc +Shader version: 500 +vertices = 3 +vertex spacing = equal_spacing +triangle order = cw +0:? Sequence +0:37 Function Definition: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:37 Function Parameters: +0:37 'inputPatch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:37 'patchId' ( in uint) +0:? Sequence +0:42 move second child to first child ( temp float) +0:42 direct index ( temp float) +0:42 edges: direct index for structure ( temp 3-element array of float) +0:42 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 0 (const int) +0:42 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:42 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:42 Constant: +0:42 0 (const uint) +0:43 move second child to first child ( temp float) +0:43 direct index ( temp float) +0:43 edges: direct index for structure ( temp 3-element array of float) +0:43 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:43 Constant: +0:43 0 (const int) +0:43 Constant: +0:43 1 (const int) +0:43 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:43 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:43 Constant: +0:43 0 (const uint) +0:44 move second child to first child ( temp float) +0:44 direct index ( temp float) +0:44 edges: direct index for structure ( temp 3-element array of float) +0:44 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:44 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:44 Constant: +0:44 0 (const uint) +0:47 move second child to first child ( temp float) +0:47 inside: direct index for structure ( temp float) +0:47 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:47 Constant: +0:47 1 (const int) +0:47 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:47 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:47 Constant: +0:47 0 (const uint) +0:49 Branch: Return with expression +0:49 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:63 Function Definition: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 Function Parameters: +0:63 'patch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 'pointId' ( in uint) +0:63 'patchId' ( in uint) +0:? Sequence +0:67 move second child to first child ( temp 3-component vector of float) +0:67 position: direct index for structure ( temp 3-component vector of float) +0:67 'output' ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:67 Constant: +0:67 0 (const int) +0:67 position: direct index for structure ( temp 3-component vector of float) +0:67 indirect index ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:67 'patch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:67 'pointId' ( in uint) +0:67 Constant: +0:67 0 (const int) +0:70 move second child to first child ( temp 4-component vector of float) +0:70 color: direct index for structure ( temp 4-component vector of float) +0:70 'output' ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:70 Constant: +0:70 1 (const int) +0:70 color: direct index for structure ( temp 4-component vector of float) +0:70 indirect index ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:70 'patch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:70 'pointId' ( in uint) +0:70 Constant: +0:70 1 (const int) +0:72 Branch: Return with expression +0:72 'output' ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 Function Definition: main( ( temp void) +0:63 Function Parameters: +0:? Sequence +0:63 move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 move second child to first child ( temp uint) +0:? 'pointId' ( temp uint) +0:? 'pointId' ( in uint InvocationID) +0:63 move second child to first child ( temp uint) +0:? 'patchId' ( temp uint) +0:? 'patchId' ( in uint PrimitiveID) +0:63 move second child to first child ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 indirect index (layout( location=0) out structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'pointId' ( in uint InvocationID) +0:63 Function Call: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'pointId' ( temp uint) +0:? 'patchId' ( temp uint) +0:? Barrier ( temp void) +0:? Test condition and select ( temp void) +0:? Condition +0:? Compare Equal ( temp bool) +0:? 'pointId' ( in uint InvocationID) +0:? Constant: +0:? 0 (const int) +0:? true case +0:? Sequence +0:? move second child to first child ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Function Call: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? 'patch' ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patchId' ( in uint PrimitiveID) +0:? Sequence +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelOuter) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? Constant: +0:? 0 (const int) +0:? direct index ( temp float) +0:? edges: direct index for structure ( temp 3-element array of float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 0 (const int) +0:? Constant: +0:? 0 (const int) +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelOuter) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? Constant: +0:? 1 (const int) +0:? direct index ( temp float) +0:? edges: direct index for structure ( temp 3-element array of float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 0 (const int) +0:? Constant: +0:? 1 (const int) +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelOuter) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? Constant: +0:? 2 (const int) +0:? direct index ( temp float) +0:? edges: direct index for structure ( temp 3-element array of float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 0 (const int) +0:? Constant: +0:? 2 (const int) +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelInner) +0:? '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner) +0:? Constant: +0:? 0 (const int) +0:? inside: direct index for structure ( temp float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'pointId' ( in uint InvocationID) +0:? 'patchId' ( in uint PrimitiveID) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner) + + +Linked tessellation control stage: + + +Shader version: 500 +vertices = 3 +vertex spacing = equal_spacing +triangle order = cw +0:? Sequence +0:37 Function Definition: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:37 Function Parameters: +0:37 'inputPatch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:37 'patchId' ( in uint) +0:? Sequence +0:42 move second child to first child ( temp float) +0:42 direct index ( temp float) +0:42 edges: direct index for structure ( temp 3-element array of float) +0:42 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 0 (const int) +0:42 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:42 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:42 Constant: +0:42 0 (const uint) +0:43 move second child to first child ( temp float) +0:43 direct index ( temp float) +0:43 edges: direct index for structure ( temp 3-element array of float) +0:43 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:43 Constant: +0:43 0 (const int) +0:43 Constant: +0:43 1 (const int) +0:43 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:43 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:43 Constant: +0:43 0 (const uint) +0:44 move second child to first child ( temp float) +0:44 direct index ( temp float) +0:44 edges: direct index for structure ( temp 3-element array of float) +0:44 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:44 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:44 Constant: +0:44 0 (const uint) +0:47 move second child to first child ( temp float) +0:47 inside: direct index for structure ( temp float) +0:47 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:47 Constant: +0:47 1 (const int) +0:47 tessellationAmount: direct index for structure (layout( row_major std140) uniform float) +0:47 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:47 Constant: +0:47 0 (const uint) +0:49 Branch: Return with expression +0:49 'output' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:63 Function Definition: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 Function Parameters: +0:63 'patch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 'pointId' ( in uint) +0:63 'patchId' ( in uint) +0:? Sequence +0:67 move second child to first child ( temp 3-component vector of float) +0:67 position: direct index for structure ( temp 3-component vector of float) +0:67 'output' ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:67 Constant: +0:67 0 (const int) +0:67 position: direct index for structure ( temp 3-component vector of float) +0:67 indirect index ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:67 'patch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:67 'pointId' ( in uint) +0:67 Constant: +0:67 0 (const int) +0:70 move second child to first child ( temp 4-component vector of float) +0:70 color: direct index for structure ( temp 4-component vector of float) +0:70 'output' ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:70 Constant: +0:70 1 (const int) +0:70 color: direct index for structure ( temp 4-component vector of float) +0:70 indirect index ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:70 'patch' ( in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:70 'pointId' ( in uint) +0:70 Constant: +0:70 1 (const int) +0:72 Branch: Return with expression +0:72 'output' ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 Function Definition: main( ( temp void) +0:63 Function Parameters: +0:? Sequence +0:63 move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 move second child to first child ( temp uint) +0:? 'pointId' ( temp uint) +0:? 'pointId' ( in uint InvocationID) +0:63 move second child to first child ( temp uint) +0:? 'patchId' ( temp uint) +0:? 'patchId' ( in uint PrimitiveID) +0:63 move second child to first child ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:63 indirect index (layout( location=0) out structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'pointId' ( in uint InvocationID) +0:63 Function Call: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'pointId' ( temp uint) +0:? 'patchId' ( temp uint) +0:? Barrier ( temp void) +0:? Test condition and select ( temp void) +0:? Condition +0:? Compare Equal ( temp bool) +0:? 'pointId' ( in uint InvocationID) +0:? Constant: +0:? 0 (const int) +0:? true case +0:? Sequence +0:? move second child to first child ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Function Call: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? 'patch' ( temp 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patchId' ( in uint PrimitiveID) +0:? Sequence +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelOuter) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? Constant: +0:? 0 (const int) +0:? direct index ( temp float) +0:? edges: direct index for structure ( temp 3-element array of float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 0 (const int) +0:? Constant: +0:? 0 (const int) +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelOuter) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? Constant: +0:? 1 (const int) +0:? direct index ( temp float) +0:? edges: direct index for structure ( temp 3-element array of float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 0 (const int) +0:? Constant: +0:? 1 (const int) +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelOuter) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? Constant: +0:? 2 (const int) +0:? direct index ( temp float) +0:? edges: direct index for structure ( temp 3-element array of float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 0 (const int) +0:? Constant: +0:? 2 (const int) +0:? move second child to first child ( temp float) +0:? direct index ( patch out float TessLevelInner) +0:? '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner) +0:? Constant: +0:? 0 (const int) +0:? inside: direct index for structure ( temp float) +0:? '@patchConstantResult' ( temp structure{ temp 3-element array of float edges, temp float inside}) +0:? Constant: +0:? 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding}) +0:? '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position, temp 4-component vector of float color}) +0:? 'pointId' ( in uint InvocationID) +0:? 'patchId' ( in uint PrimitiveID) +0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) +0:? '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 127 + + Capability Tessellation + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint TessellationControl 4 "main" 72 76 79 83 110 123 + ExecutionMode 4 OutputVertices 3 + ExecutionMode 4 Triangles + ExecutionMode 4 SpacingEqual + ExecutionMode 4 VertexOrderCw + Source HLSL 500 + Name 4 "main" + Name 9 "HullInputType" + MemberName 9(HullInputType) 0 "position" + MemberName 9(HullInputType) 1 "color" + Name 16 "ConstantOutputType" + MemberName 16(ConstantOutputType) 0 "edges" + MemberName 16(ConstantOutputType) 1 "inside" + Name 20 "ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1;" + Name 18 "inputPatch" + Name 19 "patchId" + Name 22 "HullOutputType" + MemberName 22(HullOutputType) 0 "position" + MemberName 22(HullOutputType) 1 "color" + Name 27 "@main(struct-HullInputType-vf3-vf41[3];u1;u1;" + Name 24 "patch" + Name 25 "pointId" + Name 26 "patchId" + Name 30 "output" + Name 33 "TessellationBuffer" + MemberName 33(TessellationBuffer) 0 "tessellationAmount" + MemberName 33(TessellationBuffer) 1 "padding" + Name 35 "" + Name 56 "output" + Name 70 "patch" + Name 72 "patch" + Name 74 "pointId" + Name 76 "pointId" + Name 78 "patchId" + Name 79 "patchId" + Name 83 "@entryPointOutput" + Name 85 "param" + Name 87 "param" + Name 89 "param" + Name 102 "@patchConstantResult" + Name 103 "param" + Name 105 "param" + Name 110 "@patchConstantOutput.edges" + Name 123 "@patchConstantOutput.inside" + MemberDecorate 33(TessellationBuffer) 0 Offset 0 + MemberDecorate 33(TessellationBuffer) 1 Offset 4 + Decorate 33(TessellationBuffer) Block + Decorate 35 DescriptorSet 0 + Decorate 35 Binding 0 + Decorate 72(patch) Location 0 + Decorate 76(pointId) BuiltIn InvocationId + Decorate 79(patchId) BuiltIn PrimitiveId + Decorate 83(@entryPointOutput) Location 0 + Decorate 110(@patchConstantOutput.edges) Patch + Decorate 110(@patchConstantOutput.edges) BuiltIn TessLevelOuter + Decorate 123(@patchConstantOutput.inside) Patch + Decorate 123(@patchConstantOutput.inside) BuiltIn TessLevelInner + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 3 + 8: TypeVector 6(float) 4 +9(HullInputType): TypeStruct 7(fvec3) 8(fvec4) + 10: TypeInt 32 0 + 11: 10(int) Constant 3 + 12: TypeArray 9(HullInputType) 11 + 13: TypePointer Function 12 + 14: TypePointer Function 10(int) + 15: TypeArray 6(float) 11 +16(ConstantOutputType): TypeStruct 15 6(float) + 17: TypeFunction 16(ConstantOutputType) 13(ptr) 14(ptr) +22(HullOutputType): TypeStruct 7(fvec3) 8(fvec4) + 23: TypeFunction 22(HullOutputType) 13(ptr) 14(ptr) 14(ptr) + 29: TypePointer Function 16(ConstantOutputType) + 31: TypeInt 32 1 + 32: 31(int) Constant 0 +33(TessellationBuffer): TypeStruct 6(float) 7(fvec3) + 34: TypePointer Uniform 33(TessellationBuffer) + 35: 34(ptr) Variable Uniform + 36: TypePointer Uniform 6(float) + 39: TypePointer Function 6(float) + 41: 31(int) Constant 1 + 45: 31(int) Constant 2 + 55: TypePointer Function 22(HullOutputType) + 58: TypePointer Function 7(fvec3) + 63: TypePointer Function 8(fvec4) + 71: TypePointer Input 12 + 72(patch): 71(ptr) Variable Input + 75: TypePointer Input 10(int) + 76(pointId): 75(ptr) Variable Input + 79(patchId): 75(ptr) Variable Input + 81: TypeArray 22(HullOutputType) 11 + 82: TypePointer Output 81 +83(@entryPointOutput): 82(ptr) Variable Output + 92: TypePointer Output 22(HullOutputType) + 94: 10(int) Constant 2 + 95: 10(int) Constant 4 + 96: 10(int) Constant 0 + 98: TypeBool + 108: TypeArray 6(float) 95 + 109: TypePointer Output 108 +110(@patchConstantOutput.edges): 109(ptr) Variable Output + 113: TypePointer Output 6(float) + 121: TypeArray 6(float) 94 + 122: TypePointer Output 121 +123(@patchConstantOutput.inside): 122(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 70(patch): 13(ptr) Variable Function + 74(pointId): 14(ptr) Variable Function + 78(patchId): 14(ptr) Variable Function + 85(param): 13(ptr) Variable Function + 87(param): 14(ptr) Variable Function + 89(param): 14(ptr) Variable Function +102(@patchConstantResult): 29(ptr) Variable Function + 103(param): 13(ptr) Variable Function + 105(param): 14(ptr) Variable Function + 73: 12 Load 72(patch) + Store 70(patch) 73 + 77: 10(int) Load 76(pointId) + Store 74(pointId) 77 + 80: 10(int) Load 79(patchId) + Store 78(patchId) 80 + 84: 10(int) Load 76(pointId) + 86: 12 Load 70(patch) + Store 85(param) 86 + 88: 10(int) Load 74(pointId) + Store 87(param) 88 + 90: 10(int) Load 78(patchId) + Store 89(param) 90 + 91:22(HullOutputType) FunctionCall 27(@main(struct-HullInputType-vf3-vf41[3];u1;u1;) 85(param) 87(param) 89(param) + 93: 92(ptr) AccessChain 83(@entryPointOutput) 84 + Store 93 91 + ControlBarrier 94 95 96 + 97: 10(int) Load 76(pointId) + 99: 98(bool) IEqual 97 32 + SelectionMerge 101 None + BranchConditional 99 100 101 + 100: Label + 104: 12 Load 70(patch) + Store 103(param) 104 + 106: 10(int) Load 79(patchId) + Store 105(param) 106 + 107:16(ConstantOutputType) FunctionCall 20(ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1;) 103(param) 105(param) + Store 102(@patchConstantResult) 107 + 111: 39(ptr) AccessChain 102(@patchConstantResult) 32 32 + 112: 6(float) Load 111 + 114: 113(ptr) AccessChain 110(@patchConstantOutput.edges) 32 + Store 114 112 + 115: 39(ptr) AccessChain 102(@patchConstantResult) 32 41 + 116: 6(float) Load 115 + 117: 113(ptr) AccessChain 110(@patchConstantOutput.edges) 41 + Store 117 116 + 118: 39(ptr) AccessChain 102(@patchConstantResult) 32 45 + 119: 6(float) Load 118 + 120: 113(ptr) AccessChain 110(@patchConstantOutput.edges) 45 + Store 120 119 + 124: 39(ptr) AccessChain 102(@patchConstantResult) 41 + 125: 6(float) Load 124 + 126: 113(ptr) AccessChain 123(@patchConstantOutput.inside) 32 + Store 126 125 + Branch 101 + 101: Label + Return + FunctionEnd +20(ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1;):16(ConstantOutputType) Function None 17 + 18(inputPatch): 13(ptr) FunctionParameter + 19(patchId): 14(ptr) FunctionParameter + 21: Label + 30(output): 29(ptr) Variable Function + 37: 36(ptr) AccessChain 35 32 + 38: 6(float) Load 37 + 40: 39(ptr) AccessChain 30(output) 32 32 + Store 40 38 + 42: 36(ptr) AccessChain 35 32 + 43: 6(float) Load 42 + 44: 39(ptr) AccessChain 30(output) 32 41 + Store 44 43 + 46: 36(ptr) AccessChain 35 32 + 47: 6(float) Load 46 + 48: 39(ptr) AccessChain 30(output) 32 45 + Store 48 47 + 49: 36(ptr) AccessChain 35 32 + 50: 6(float) Load 49 + 51: 39(ptr) AccessChain 30(output) 41 + Store 51 50 + 52:16(ConstantOutputType) Load 30(output) + ReturnValue 52 + FunctionEnd +27(@main(struct-HullInputType-vf3-vf41[3];u1;u1;):22(HullOutputType) Function None 23 + 24(patch): 13(ptr) FunctionParameter + 25(pointId): 14(ptr) FunctionParameter + 26(patchId): 14(ptr) FunctionParameter + 28: Label + 56(output): 55(ptr) Variable Function + 57: 10(int) Load 25(pointId) + 59: 58(ptr) AccessChain 24(patch) 57 32 + 60: 7(fvec3) Load 59 + 61: 58(ptr) AccessChain 56(output) 32 + Store 61 60 + 62: 10(int) Load 25(pointId) + 64: 63(ptr) AccessChain 24(patch) 62 41 + 65: 8(fvec4) Load 64 + 66: 63(ptr) AccessChain 56(output) 41 + Store 66 65 + 67:22(HullOutputType) Load 56(output) + ReturnValue 67 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.comparison.vec.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.comparison.vec.frag.out index e2d4637b0c0..c7e4ed52b8f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.comparison.vec.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.comparison.vec.frag.out @@ -262,7 +262,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 96 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out index bbcfd5584f8..90d9f79b342 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out @@ -78,7 +78,7 @@ gl_FragCoord origin is upper left 0:17 Sequence 0:17 move second child to first child ( temp 4-component vector of float) 0:17 'ret' ( temp 4-component vector of float) -0:17 Test condition and select ( temp 4-component vector of float) +0:17 Test condition and select ( temp 4-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Not Equal ( temp bool) 0:17 t: direct index for structure ( uniform float) @@ -169,7 +169,7 @@ gl_FragCoord origin is upper left 0:37 'e' ( temp int) 0:37 move second child to first child ( temp int) 0:37 'a' ( temp int) -0:37 Test condition and select ( temp int) +0:37 Test condition and select ( temp int): no shortcircuit 0:37 Condition 0:37 Convert int to bool ( temp bool) 0:37 'b' ( temp int) @@ -182,7 +182,7 @@ gl_FragCoord origin is upper left 0:37 10 (const int) 0:37 move second child to first child ( temp int) 0:37 'b' ( temp int) -0:37 Test condition and select ( temp int) +0:37 Test condition and select ( temp int): no shortcircuit 0:37 Condition 0:37 Convert int to bool ( temp bool) 0:37 'a' ( temp int) @@ -195,7 +195,7 @@ gl_FragCoord origin is upper left 0:37 11 (const int) 0:39 move second child to first child ( temp 4-component vector of float) 0:39 'f' ( temp 4-component vector of float) -0:39 Test condition and select ( temp 4-component vector of float) +0:39 Test condition and select ( temp 4-component vector of float): no shortcircuit 0:39 Condition 0:39 Compare Less Than ( temp bool) 0:39 direct index ( temp float) @@ -341,7 +341,7 @@ gl_FragCoord origin is upper left 0:17 Sequence 0:17 move second child to first child ( temp 4-component vector of float) 0:17 'ret' ( temp 4-component vector of float) -0:17 Test condition and select ( temp 4-component vector of float) +0:17 Test condition and select ( temp 4-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Not Equal ( temp bool) 0:17 t: direct index for structure ( uniform float) @@ -432,7 +432,7 @@ gl_FragCoord origin is upper left 0:37 'e' ( temp int) 0:37 move second child to first child ( temp int) 0:37 'a' ( temp int) -0:37 Test condition and select ( temp int) +0:37 Test condition and select ( temp int): no shortcircuit 0:37 Condition 0:37 Convert int to bool ( temp bool) 0:37 'b' ( temp int) @@ -445,7 +445,7 @@ gl_FragCoord origin is upper left 0:37 10 (const int) 0:37 move second child to first child ( temp int) 0:37 'b' ( temp int) -0:37 Test condition and select ( temp int) +0:37 Test condition and select ( temp int): no shortcircuit 0:37 Condition 0:37 Convert int to bool ( temp bool) 0:37 'a' ( temp int) @@ -458,7 +458,7 @@ gl_FragCoord origin is upper left 0:37 11 (const int) 0:39 move second child to first child ( temp 4-component vector of float) 0:39 'f' ( temp 4-component vector of float) -0:39 Test condition and select ( temp 4-component vector of float) +0:39 Test condition and select ( temp 4-component vector of float): no shortcircuit 0:39 Condition 0:39 Compare Less Than ( temp bool) 0:39 direct index ( temp float) @@ -522,13 +522,13 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 220 +// Generated by (magic number): 80007 +// Id's are bound by 206 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "PixelShaderFunction" 213 216 + EntryPoint Fragment 4 "PixelShaderFunction" 199 202 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "PixelShaderFunction" @@ -548,20 +548,20 @@ gl_FragCoord origin is upper left MemberName 29($Global) 4 "f" Name 31 "" Name 85 "ret" - Name 113 "a" - Name 115 "b" - Name 117 "c" - Name 119 "d" - Name 120 "ret" - Name 140 "e" - Name 161 "f" - Name 200 "param" - Name 201 "param" - Name 202 "param" - Name 211 "input" - Name 213 "input" - Name 216 "@entryPointOutput" - Name 217 "param" + Name 110 "a" + Name 112 "b" + Name 114 "c" + Name 116 "d" + Name 117 "ret" + Name 137 "e" + Name 150 "f" + Name 186 "param" + Name 187 "param" + Name 188 "param" + Name 197 "input" + Name 199 "input" + Name 202 "@entryPointOutput" + Name 203 "param" MemberDecorate 29($Global) 0 Offset 0 MemberDecorate 29($Global) 1 Offset 16 MemberDecorate 29($Global) 2 Offset 32 @@ -569,8 +569,8 @@ gl_FragCoord origin is upper left MemberDecorate 29($Global) 4 Offset 52 Decorate 29($Global) Block Decorate 31 DescriptorSet 0 - Decorate 213(input) Location 0 - Decorate 216(@entryPointOutput) Location 0 + Decorate 199(input) Location 0 + Decorate 202(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -598,41 +598,41 @@ gl_FragCoord origin is upper left 48: 32(int) Constant 4 49: TypePointer Uniform 6(float) 53: 32(int) Constant 3 - 100: 6(float) Constant 1065353216 - 101: 7(fvec4) ConstantComposite 100 100 100 100 - 112: TypePointer Function 32(int) - 114: 32(int) Constant 5 - 116: 32(int) Constant 6 - 118: 32(int) Constant 7 - 143: TypeInt 32 0 - 144: 143(int) Constant 0 - 150: 32(int) Constant 10 - 159: 32(int) Constant 11 - 163: TypePointer Function 6(float) - 166: 143(int) Constant 1 - 192: 13(bool) ConstantTrue - 193: 13(bool) ConstantFalse - 194: 14(bvec2) ConstantComposite 192 193 - 195: 6(float) Constant 1073741824 - 196: 16(fvec2) ConstantComposite 100 195 - 197: 6(float) Constant 1077936128 - 198: 6(float) Constant 1082130432 - 199: 16(fvec2) ConstantComposite 197 198 - 204: 6(float) Constant 1092616192 - 212: TypePointer Input 7(fvec4) - 213(input): 212(ptr) Variable Input - 215: TypePointer Output 7(fvec4) -216(@entryPointOutput): 215(ptr) Variable Output + 96: 6(float) Constant 1065353216 + 97: 7(fvec4) ConstantComposite 96 96 96 96 + 109: TypePointer Function 32(int) + 111: 32(int) Constant 5 + 113: 32(int) Constant 6 + 115: 32(int) Constant 7 + 139: TypeInt 32 0 + 140: 139(int) Constant 0 + 143: 32(int) Constant 10 + 148: 32(int) Constant 11 + 151: TypePointer Function 6(float) + 154: 139(int) Constant 1 + 178: 13(bool) ConstantTrue + 179: 13(bool) ConstantFalse + 180: 14(bvec2) ConstantComposite 178 179 + 181: 6(float) Constant 1073741824 + 182: 16(fvec2) ConstantComposite 96 181 + 183: 6(float) Constant 1077936128 + 184: 6(float) Constant 1082130432 + 185: 16(fvec2) ConstantComposite 183 184 + 190: 6(float) Constant 1092616192 + 198: TypePointer Input 7(fvec4) + 199(input): 198(ptr) Variable Input + 201: TypePointer Output 7(fvec4) +202(@entryPointOutput): 201(ptr) Variable Output 4(PixelShaderFunction): 2 Function None 3 5: Label - 211(input): 24(ptr) Variable Function - 217(param): 24(ptr) Variable Function - 214: 7(fvec4) Load 213(input) - Store 211(input) 214 - 218: 7(fvec4) Load 211(input) - Store 217(param) 218 - 219: 7(fvec4) FunctionCall 27(@PixelShaderFunction(vf4;) 217(param) - Store 216(@entryPointOutput) 219 + 197(input): 24(ptr) Variable Function + 203(param): 24(ptr) Variable Function + 200: 7(fvec4) Load 199(input) + Store 197(input) 200 + 204: 7(fvec4) Load 197(input) + Store 203(param) 204 + 205: 7(fvec4) FunctionCall 27(@PixelShaderFunction(vf4;) 203(param) + Store 202(@entryPointOutput) 205 Return FunctionEnd 9(vectorCond(): 7(fvec4) Function None 8 @@ -682,154 +682,116 @@ gl_FragCoord origin is upper left 11(scalarCond(): 7(fvec4) Function None 8 12: Label 85(ret): 24(ptr) Variable Function - 86: 24(ptr) Variable Function - 87: 49(ptr) AccessChain 31 53 - 88: 6(float) Load 87 - 89: 49(ptr) AccessChain 31 48 - 90: 6(float) Load 89 - 91: 13(bool) FOrdNotEqual 88 90 - SelectionMerge 93 None - BranchConditional 91 92 99 - 92: Label - 94: 49(ptr) AccessChain 31 53 - 95: 6(float) Load 94 - 96: 34(ptr) AccessChain 31 33 - 97: 7(fvec4) Load 96 - 98: 7(fvec4) VectorTimesScalar 97 95 - Store 86 98 - Branch 93 - 99: Label - Store 86 101 - Branch 93 - 93: Label - 102: 7(fvec4) Load 86 - Store 85(ret) 102 - 103: 7(fvec4) Load 85(ret) - ReturnValue 103 + 86: 49(ptr) AccessChain 31 53 + 87: 6(float) Load 86 + 88: 49(ptr) AccessChain 31 48 + 89: 6(float) Load 88 + 90: 13(bool) FOrdNotEqual 87 89 + 91: 49(ptr) AccessChain 31 53 + 92: 6(float) Load 91 + 93: 34(ptr) AccessChain 31 33 + 94: 7(fvec4) Load 93 + 95: 7(fvec4) VectorTimesScalar 94 92 + 98: 43(bvec4) CompositeConstruct 90 90 90 90 + 99: 7(fvec4) Select 98 95 97 + Store 85(ret) 99 + 100: 7(fvec4) Load 85(ret) + ReturnValue 100 FunctionEnd 22(fbSelect(vb2;vf2;vf2;): 16(fvec2) Function None 18 19(cnd): 15(ptr) FunctionParameter 20(src0): 17(ptr) FunctionParameter 21(src1): 17(ptr) FunctionParameter 23: Label - 106: 16(fvec2) Load 21(src1) - 107: 16(fvec2) Load 20(src0) - 108: 14(bvec2) Load 19(cnd) - 109: 16(fvec2) Select 108 107 106 - ReturnValue 109 + 103: 16(fvec2) Load 21(src1) + 104: 16(fvec2) Load 20(src0) + 105: 14(bvec2) Load 19(cnd) + 106: 16(fvec2) Select 105 104 103 + ReturnValue 106 FunctionEnd 27(@PixelShaderFunction(vf4;): 7(fvec4) Function None 25 26(input): 24(ptr) FunctionParameter 28: Label - 113(a): 112(ptr) Variable Function - 115(b): 112(ptr) Variable Function - 117(c): 112(ptr) Variable Function - 119(d): 112(ptr) Variable Function - 120(ret): 24(ptr) Variable Function - 140(e): 112(ptr) Variable Function - 141: 112(ptr) Variable Function - 152: 112(ptr) Variable Function - 161(f): 24(ptr) Variable Function - 162: 24(ptr) Variable Function - 200(param): 15(ptr) Variable Function - 201(param): 17(ptr) Variable Function - 202(param): 17(ptr) Variable Function - Store 113(a) 114 - Store 115(b) 116 - Store 117(c) 118 - Store 119(d) 118 - 121: 32(int) Load 113(a) - 122: 6(float) ConvertSToF 121 - 123: 7(fvec4) Load 26(input) - 124: 7(fvec4) VectorTimesScalar 123 122 - 125: 32(int) Load 115(b) - 126: 6(float) ConvertSToF 125 - 127: 7(fvec4) Load 26(input) - 128: 7(fvec4) VectorTimesScalar 127 126 - 129: 7(fvec4) FAdd 124 128 - 130: 32(int) Load 117(c) - 131: 6(float) ConvertSToF 130 - 132: 7(fvec4) Load 26(input) - 133: 7(fvec4) VectorTimesScalar 132 131 - 134: 7(fvec4) FAdd 129 133 - 135: 32(int) Load 119(d) - 136: 6(float) ConvertSToF 135 - 137: 7(fvec4) Load 26(input) - 138: 7(fvec4) VectorTimesScalar 137 136 - 139: 7(fvec4) FAdd 134 138 - Store 120(ret) 139 - 142: 32(int) Load 115(b) - 145: 13(bool) INotEqual 142 144 - SelectionMerge 147 None - BranchConditional 145 146 149 - 146: Label - 148: 32(int) Load 119(d) - Store 117(c) 148 - Store 141 148 - Branch 147 - 149: Label - Store 141 150 - Branch 147 - 147: Label - 151: 32(int) Load 141 - Store 113(a) 151 - Store 140(e) 151 - 153: 32(int) Load 113(a) - 154: 13(bool) INotEqual 153 144 - SelectionMerge 156 None - BranchConditional 154 155 158 - 155: Label - 157: 32(int) Load 117(c) - Store 119(d) 157 - Store 152 157 - Branch 156 - 158: Label - Store 152 159 - Branch 156 - 156: Label - 160: 32(int) Load 152 - Store 115(b) 160 - 164: 163(ptr) AccessChain 120(ret) 144 - 165: 6(float) Load 164 - 167: 163(ptr) AccessChain 26(input) 166 - 168: 6(float) Load 167 - 169: 13(bool) FOrdLessThan 165 168 - SelectionMerge 171 None - BranchConditional 169 170 176 - 170: Label - 172: 32(int) Load 117(c) - 173: 6(float) ConvertSToF 172 - 174: 7(fvec4) Load 26(input) - 175: 7(fvec4) VectorTimesScalar 174 173 - Store 162 175 - Branch 171 - 176: Label - 177: 32(int) Load 119(d) - 178: 6(float) ConvertSToF 177 - 179: 7(fvec4) Load 26(input) - 180: 7(fvec4) VectorTimesScalar 179 178 - Store 162 180 - Branch 171 - 171: Label - 181: 7(fvec4) Load 162 - Store 161(f) 181 - 182: 32(int) Load 140(e) - 183: 6(float) ConvertSToF 182 - 184: 7(fvec4) Load 120(ret) - 185: 7(fvec4) VectorTimesScalar 184 183 - 186: 7(fvec4) Load 161(f) - 187: 7(fvec4) FAdd 185 186 - 188: 7(fvec4) FunctionCall 9(vectorCond() - 189: 7(fvec4) FAdd 187 188 - 190: 7(fvec4) FunctionCall 11(scalarCond() - 191: 7(fvec4) FAdd 189 190 - Store 200(param) 194 - Store 201(param) 196 - Store 202(param) 199 - 203: 16(fvec2) FunctionCall 22(fbSelect(vb2;vf2;vf2;) 200(param) 201(param) 202(param) - 205: 6(float) CompositeExtract 203 0 - 206: 6(float) CompositeExtract 203 1 - 207: 7(fvec4) CompositeConstruct 205 206 204 204 - 208: 7(fvec4) FAdd 191 207 - ReturnValue 208 + 110(a): 109(ptr) Variable Function + 112(b): 109(ptr) Variable Function + 114(c): 109(ptr) Variable Function + 116(d): 109(ptr) Variable Function + 117(ret): 24(ptr) Variable Function + 137(e): 109(ptr) Variable Function + 150(f): 24(ptr) Variable Function + 186(param): 15(ptr) Variable Function + 187(param): 17(ptr) Variable Function + 188(param): 17(ptr) Variable Function + Store 110(a) 111 + Store 112(b) 113 + Store 114(c) 115 + Store 116(d) 115 + 118: 32(int) Load 110(a) + 119: 6(float) ConvertSToF 118 + 120: 7(fvec4) Load 26(input) + 121: 7(fvec4) VectorTimesScalar 120 119 + 122: 32(int) Load 112(b) + 123: 6(float) ConvertSToF 122 + 124: 7(fvec4) Load 26(input) + 125: 7(fvec4) VectorTimesScalar 124 123 + 126: 7(fvec4) FAdd 121 125 + 127: 32(int) Load 114(c) + 128: 6(float) ConvertSToF 127 + 129: 7(fvec4) Load 26(input) + 130: 7(fvec4) VectorTimesScalar 129 128 + 131: 7(fvec4) FAdd 126 130 + 132: 32(int) Load 116(d) + 133: 6(float) ConvertSToF 132 + 134: 7(fvec4) Load 26(input) + 135: 7(fvec4) VectorTimesScalar 134 133 + 136: 7(fvec4) FAdd 131 135 + Store 117(ret) 136 + 138: 32(int) Load 112(b) + 141: 13(bool) INotEqual 138 140 + 142: 32(int) Load 116(d) + Store 114(c) 142 + 144: 32(int) Select 141 142 143 + Store 110(a) 144 + Store 137(e) 144 + 145: 32(int) Load 110(a) + 146: 13(bool) INotEqual 145 140 + 147: 32(int) Load 114(c) + Store 116(d) 147 + 149: 32(int) Select 146 147 148 + Store 112(b) 149 + 152: 151(ptr) AccessChain 117(ret) 140 + 153: 6(float) Load 152 + 155: 151(ptr) AccessChain 26(input) 154 + 156: 6(float) Load 155 + 157: 13(bool) FOrdLessThan 153 156 + 158: 32(int) Load 114(c) + 159: 6(float) ConvertSToF 158 + 160: 7(fvec4) Load 26(input) + 161: 7(fvec4) VectorTimesScalar 160 159 + 162: 32(int) Load 116(d) + 163: 6(float) ConvertSToF 162 + 164: 7(fvec4) Load 26(input) + 165: 7(fvec4) VectorTimesScalar 164 163 + 166: 43(bvec4) CompositeConstruct 157 157 157 157 + 167: 7(fvec4) Select 166 161 165 + Store 150(f) 167 + 168: 32(int) Load 137(e) + 169: 6(float) ConvertSToF 168 + 170: 7(fvec4) Load 117(ret) + 171: 7(fvec4) VectorTimesScalar 170 169 + 172: 7(fvec4) Load 150(f) + 173: 7(fvec4) FAdd 171 172 + 174: 7(fvec4) FunctionCall 9(vectorCond() + 175: 7(fvec4) FAdd 173 174 + 176: 7(fvec4) FunctionCall 11(scalarCond() + 177: 7(fvec4) FAdd 175 176 + Store 186(param) 180 + Store 187(param) 182 + Store 188(param) 185 + 189: 16(fvec2) FunctionCall 22(fbSelect(vb2;vf2;vf2;) 186(param) 187(param) 188(param) + 191: 6(float) CompositeExtract 189 0 + 192: 6(float) CompositeExtract 189 1 + 193: 7(fvec4) CompositeConstruct 191 192 190 190 + 194: 7(fvec4) FAdd 177 193 + ReturnValue 194 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constantbuffer.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constantbuffer.frag.out index 58e9ed86765..052d84e487c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constantbuffer.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constantbuffer.frag.out @@ -131,8 +131,14 @@ gl_FragCoord origin is upper left 0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform int c1}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Uniform OpVariable '18[cb3] 'has illegal type. +From Vulkan spec, section 14.5.2: +Variables identified with the Uniform storage class are used to access transparent buffer backed resources. Such variables must be typed as OpTypeStruct, or an array of this type + %cb3_0 = OpVariable %_ptr_Uniform__arr__arr_cb3_uint_4_uint_2 Uniform + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 66 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructArray.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructArray.vert.out index 7140bea6c41..6e18ad9713b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructArray.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructArray.vert.out @@ -268,7 +268,7 @@ Shader version: 500 0:? '@entryPointOutput' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 89 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructexpr.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructexpr.frag.out index 1321bfebbc9..227c7e17389 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructexpr.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructexpr.frag.out @@ -104,7 +104,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 40 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructimat.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructimat.frag.out index f54945ae812..e88c3d8f3d0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructimat.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.constructimat.frag.out @@ -543,8 +543,12 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? '@entryPointOutput' (layout( location=0) out int) +error: SPIRV-Tools Validation Errors +error: Matrix types can only be parameterized with floating-point types. + %mat4v4int = OpTypeMatrix %v4int 4 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 98 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.coverage.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.coverage.frag.out new file mode 100644 index 00000000000..bea2fc0e5fd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.coverage.frag.out @@ -0,0 +1,208 @@ +hlsl.coverage.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:15 Function Definition: @main(struct-PS_INPUT1; ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Function Parameters: +0:15 'i' ( in structure{}) +0:? Sequence +0:17 move second child to first child ( temp 4-component vector of float) +0:17 vColor: direct index for structure ( temp 4-component vector of float) +0:17 'o' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:17 Constant: +0:17 0 (const int) +0:? Constant: +0:? 1.000000 +0:? 0.000000 +0:? 0.000000 +0:? 1.000000 +0:18 move second child to first child ( temp uint) +0:18 nCoverageMask: direct index for structure ( temp uint) +0:18 'o' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:18 Constant: +0:18 1 (const int) +0:18 Constant: +0:18 0 (const uint) +0:19 Branch: Return with expression +0:19 'o' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Function Definition: main( ( temp void) +0:15 Function Parameters: +0:? Sequence +0:15 Sequence +0:15 move second child to first child ( temp structure{}) +0:? 'i' ( temp structure{}) +0:? 'i' ( in structure{}) +0:15 Sequence +0:15 move second child to first child ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Function Call: @main(struct-PS_INPUT1; ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:? 'i' ( temp structure{}) +0:15 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.vColor' (layout( location=0) out 4-component vector of float) +0:15 vColor: direct index for structure ( temp 4-component vector of float) +0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Constant: +0:15 0 (const int) +0:15 move second child to first child ( temp uint) +0:15 direct index ( out uint SampleMaskIn) +0:? '@entryPointOutput.nCoverageMask' ( out 1-element array of uint SampleMaskIn) +0:15 Constant: +0:15 0 (const int) +0:15 nCoverageMask: direct index for structure ( temp uint) +0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Constant: +0:15 1 (const int) +0:? Linker Objects +0:? '@entryPointOutput.nCoverageMask' ( out 1-element array of uint SampleMaskIn) +0:? '@entryPointOutput.vColor' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:15 Function Definition: @main(struct-PS_INPUT1; ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Function Parameters: +0:15 'i' ( in structure{}) +0:? Sequence +0:17 move second child to first child ( temp 4-component vector of float) +0:17 vColor: direct index for structure ( temp 4-component vector of float) +0:17 'o' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:17 Constant: +0:17 0 (const int) +0:? Constant: +0:? 1.000000 +0:? 0.000000 +0:? 0.000000 +0:? 1.000000 +0:18 move second child to first child ( temp uint) +0:18 nCoverageMask: direct index for structure ( temp uint) +0:18 'o' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:18 Constant: +0:18 1 (const int) +0:18 Constant: +0:18 0 (const uint) +0:19 Branch: Return with expression +0:19 'o' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Function Definition: main( ( temp void) +0:15 Function Parameters: +0:? Sequence +0:15 Sequence +0:15 move second child to first child ( temp structure{}) +0:? 'i' ( temp structure{}) +0:? 'i' ( in structure{}) +0:15 Sequence +0:15 move second child to first child ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Function Call: @main(struct-PS_INPUT1; ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:? 'i' ( temp structure{}) +0:15 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.vColor' (layout( location=0) out 4-component vector of float) +0:15 vColor: direct index for structure ( temp 4-component vector of float) +0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Constant: +0:15 0 (const int) +0:15 move second child to first child ( temp uint) +0:15 direct index ( out uint SampleMaskIn) +0:? '@entryPointOutput.nCoverageMask' ( out 1-element array of uint SampleMaskIn) +0:15 Constant: +0:15 0 (const int) +0:15 nCoverageMask: direct index for structure ( temp uint) +0:15 'flattenTemp' ( temp structure{ temp 4-component vector of float vColor, temp uint nCoverageMask}) +0:15 Constant: +0:15 1 (const int) +0:? Linker Objects +0:? '@entryPointOutput.nCoverageMask' ( out 1-element array of uint SampleMaskIn) +0:? '@entryPointOutput.vColor' (layout( location=0) out 4-component vector of float) + +error: SPIRV-Tools Validation Errors +error: Input variable id <34> is used by entry point 'main' id <4>, but is not listed as an interface + %i_1 = OpVariable %_ptr_Input_PS_INPUT Input + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 52 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 41 47 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 6 "PS_INPUT" + Name 11 "PS_OUTPUT" + MemberName 11(PS_OUTPUT) 0 "vColor" + MemberName 11(PS_OUTPUT) 1 "nCoverageMask" + Name 14 "@main(struct-PS_INPUT1;" + Name 13 "i" + Name 17 "o" + Name 32 "i" + Name 34 "i" + Name 36 "flattenTemp" + Name 37 "param" + Name 41 "@entryPointOutput.vColor" + Name 47 "@entryPointOutput.nCoverageMask" + Decorate 41(@entryPointOutput.vColor) Location 0 + Decorate 47(@entryPointOutput.nCoverageMask) BuiltIn SampleMask + 2: TypeVoid + 3: TypeFunction 2 + 6(PS_INPUT): TypeStruct + 7: TypePointer Function 6(PS_INPUT) + 8: TypeFloat 32 + 9: TypeVector 8(float) 4 + 10: TypeInt 32 0 + 11(PS_OUTPUT): TypeStruct 9(fvec4) 10(int) + 12: TypeFunction 11(PS_OUTPUT) 7(ptr) + 16: TypePointer Function 11(PS_OUTPUT) + 18: TypeInt 32 1 + 19: 18(int) Constant 0 + 20: 8(float) Constant 1065353216 + 21: 8(float) Constant 0 + 22: 9(fvec4) ConstantComposite 20 21 21 20 + 23: TypePointer Function 9(fvec4) + 25: 18(int) Constant 1 + 26: 10(int) Constant 0 + 27: TypePointer Function 10(int) + 33: TypePointer Input 6(PS_INPUT) + 34(i): 33(ptr) Variable Input + 40: TypePointer Output 9(fvec4) +41(@entryPointOutput.vColor): 40(ptr) Variable Output + 44: 10(int) Constant 1 + 45: TypeArray 10(int) 44 + 46: TypePointer Output 45 +47(@entryPointOutput.nCoverageMask): 46(ptr) Variable Output + 50: TypePointer Output 10(int) + 4(main): 2 Function None 3 + 5: Label + 32(i): 7(ptr) Variable Function + 36(flattenTemp): 16(ptr) Variable Function + 37(param): 7(ptr) Variable Function + 35: 6(PS_INPUT) Load 34(i) + Store 32(i) 35 + 38: 6(PS_INPUT) Load 32(i) + Store 37(param) 38 + 39:11(PS_OUTPUT) FunctionCall 14(@main(struct-PS_INPUT1;) 37(param) + Store 36(flattenTemp) 39 + 42: 23(ptr) AccessChain 36(flattenTemp) 19 + 43: 9(fvec4) Load 42 + Store 41(@entryPointOutput.vColor) 43 + 48: 27(ptr) AccessChain 36(flattenTemp) 25 + 49: 10(int) Load 48 + 51: 50(ptr) AccessChain 47(@entryPointOutput.nCoverageMask) 19 + Store 51 49 + Return + FunctionEnd +14(@main(struct-PS_INPUT1;):11(PS_OUTPUT) Function None 12 + 13(i): 7(ptr) FunctionParameter + 15: Label + 17(o): 16(ptr) Variable Function + 24: 23(ptr) AccessChain 17(o) 19 + Store 24 22 + 28: 27(ptr) AccessChain 17(o) 25 + Store 28 26 + 29:11(PS_OUTPUT) Load 17(o) + ReturnValue 29 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.dashI.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.dashI.vert.out index e8c1dc66240..400502be506 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.dashI.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.dashI.vert.out @@ -1,6 +1,6 @@ hlsl.dashI.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 40 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out index a54c98d267a..2bc08dabb89 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.deadFunctionMissingBody.vert.out @@ -1,6 +1,6 @@ hlsl.deadFunctionMissingBody.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 18 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthGreater.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthGreater.frag.out index 44c414cacca..9749371a50d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthGreater.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthGreater.frag.out @@ -50,7 +50,7 @@ using depth_greater 0:? 'depth' ( out float FragDepth) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader @@ -59,6 +59,7 @@ using depth_greater EntryPoint Fragment 4 "PixelShaderFunction" 18 ExecutionMode 4 OriginUpperLeft ExecutionMode 4 DepthGreater + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "PixelShaderFunction" Name 10 "@PixelShaderFunction(f1;" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthLess.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthLess.frag.out index f97f1be1995..c3af8eeaeee 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthLess.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.depthLess.frag.out @@ -42,7 +42,7 @@ using depth_less 0:? '@entryPointOutput' ( out float FragDepth) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 16 Capability Shader @@ -51,6 +51,7 @@ using depth_less EntryPoint Fragment 4 "PixelShaderFunction" 14 ExecutionMode 4 OriginUpperLeft ExecutionMode 4 DepthLess + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "PixelShaderFunction" Name 8 "@PixelShaderFunction(" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.discard.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.discard.frag.out index 7a6ed45f1a1..cc7c8666092 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.discard.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.discard.frag.out @@ -108,7 +108,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.doLoop.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.doLoop.frag.out index bee6c29d5fa..bb564658a28 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.doLoop.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.doLoop.frag.out @@ -6,12 +6,12 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in float) 0:? Sequence -0:3 Loop with condition not tested first +0:3 Loop with condition not tested first: Unroll 0:3 Loop Condition 0:3 Constant: 0:3 false (const bool) 0:3 No loop body -0:4 Loop with condition not tested first +0:4 Loop with condition not tested first: Unroll 0:4 Loop Condition 0:4 Constant: 0:4 false (const bool) @@ -80,12 +80,12 @@ gl_FragCoord origin is upper left 0:2 Function Parameters: 0:2 'input' ( in float) 0:? Sequence -0:3 Loop with condition not tested first +0:3 Loop with condition not tested first: Unroll 0:3 Loop Condition 0:3 Constant: 0:3 false (const bool) 0:3 No loop body -0:4 Loop with condition not tested first +0:4 Loop with condition not tested first: Unroll 0:4 Loop Condition 0:4 Constant: 0:4 false (const bool) @@ -144,7 +144,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 71 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.1.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.1.tese.out index e0fa528f811..4bc8bac5e93 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.1.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.1.tese.out @@ -286,7 +286,7 @@ triangle order = none 0:? 'pcf_data.flInsideTessFactor' ( patch in 2-element array of float TessLevelInner) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 103 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.2.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.2.tese.out index 02c86aea8d9..827f80f7337 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.2.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.2.tese.out @@ -284,7 +284,7 @@ triangle order = none 0:? 'pcf_data.foo' (layout( location=2) patch in float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 98 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.3.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.3.tese.out index 6330d088b64..dd3d502af89 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.3.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.domain.3.tese.out @@ -264,7 +264,7 @@ triangle order = none 0:? 'pcf_data.flInsideTessFactor' ( patch in 2-element array of float TessLevelInner) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 100 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out index 295fb0400cc..410915cfe80 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystruct.init.vert.out @@ -60,7 +60,7 @@ Shader version: 500 0:? 'vertexIndex' (layout( location=0) in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 29 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out index ee20b7da84c..34a635c70ad 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.frag.out @@ -49,8 +49,12 @@ gl_FragCoord origin is upper left 0:? 'i' ( temp structure{}) 0:? Linker Objects +error: SPIRV-Tools Validation Errors +error: Input variable id <20> is used by entry point 'main' id <4>, but is not listed as an interface + %i_1 = OpVariable %_ptr_Input_ps_in Input + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out index 7ff09dd99a4..61704586f47 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.emptystructreturn.vert.out @@ -47,8 +47,12 @@ Shader version: 500 0:? 'i' ( temp structure{}) 0:? Linker Objects +error: SPIRV-Tools Validation Errors +error: Input variable id <20> is used by entry point 'main' id <4>, but is not listed as an interface + %i_1 = OpVariable %_ptr_Input_vs_in Input + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-in.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-in.frag.out index 10d8544140e..dc9eea4af90 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-in.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-in.frag.out @@ -166,7 +166,7 @@ gl_FragCoord origin is upper left 0:? 'i.i2' (layout( location=1) flat in 2-component vector of int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 74 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-out.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-out.frag.out index 40fc164045a..6ca3011bba5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-out.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry-out.frag.out @@ -244,7 +244,7 @@ gl_FragCoord origin is upper left 0:? 'out3.i' (layout( location=5) out 2-component vector of int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 89 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry.rename.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry.rename.frag.out index 9972ec09242..898eb4bd874 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry.rename.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.entry.rename.frag.out @@ -72,7 +72,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 32 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out index 6b05ef21983..b5f34405c1b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet-2.frag.out @@ -1,6 +1,6 @@ hlsl.explicitDescriptorSet.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out index 2f092801d52..8ab296fe019 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.explicitDescriptorSet.frag.out @@ -1,6 +1,6 @@ hlsl.explicitDescriptorSet.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flatten.return.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flatten.return.frag.out index 730a989a7b7..e47fe3ebf0e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flatten.return.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flatten.return.frag.out @@ -118,7 +118,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.other_struct_member3' (layout( location=3) out float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 49 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaque.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaque.frag.out index 8eafba8e252..eb47c3f899b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaque.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaque.frag.out @@ -1,54 +1,71 @@ hlsl.flattenOpaque.frag +WARNING: AST will form illegal SPIR-V; need to transform to legalize Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence 0:15 Function Definition: osCall1(struct-os-p11; ( temp 4-component vector of float) 0:15 Function Parameters: -0:? 's.s2D' ( in sampler) +0:15 's' ( in structure{ temp sampler s2D}) 0:? Sequence 0:16 Branch: Return with expression 0:16 texture ( temp 4-component vector of float) 0:16 Construct combined texture-sampler ( temp sampler2D) 0:16 'tex' ( uniform texture2D) -0:? 's.s2D' ( in sampler) +0:16 s2D: direct index for structure ( temp sampler) +0:16 's' ( in structure{ temp sampler s2D}) +0:16 Constant: +0:16 0 (const int) 0:? Constant: 0:? 0.200000 0:? 0.300000 0:20 Function Definition: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float) 0:20 Function Parameters: -0:? 's.s2D' ( in sampler) +0:20 's' ( in structure{ temp sampler s2D}) 0:20 'f2' ( in 2-component vector of float) 0:? Sequence 0:21 Branch: Return with expression 0:21 texture ( temp 4-component vector of float) 0:21 Construct combined texture-sampler ( temp sampler2D) 0:21 'tex' ( uniform texture2D) -0:? 's.s2D' ( in sampler) +0:21 s2D: direct index for structure ( temp sampler) +0:21 's' ( in structure{ temp sampler s2D}) +0:21 Constant: +0:21 0 (const int) 0:21 'f2' ( in 2-component vector of float) 0:25 Function Definition: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float) 0:25 Function Parameters: -0:? 's.s2D' ( in sampler) -0:? 's.tex' ( in texture2D) +0:25 's' ( in structure{ temp sampler s2D, temp texture2D tex}) 0:? Sequence 0:26 Branch: Return with expression 0:26 texture ( temp 4-component vector of float) 0:26 Construct combined texture-sampler ( temp sampler2D) -0:? 's.tex' ( in texture2D) -0:? 's.s2D' ( in sampler) +0:26 tex: direct index for structure ( temp texture2D) +0:26 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:26 Constant: +0:26 1 (const int) +0:26 s2D: direct index for structure ( temp sampler) +0:26 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:26 Constant: +0:26 0 (const int) 0:? Constant: 0:? 0.200000 0:? 0.300000 0:30 Function Definition: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float) 0:30 Function Parameters: -0:? 's.s2D' ( in sampler) -0:? 's.tex' ( in texture2D) +0:30 's' ( in structure{ temp sampler s2D, temp texture2D tex}) 0:30 'f2' ( in 2-component vector of float) 0:? Sequence 0:31 Branch: Return with expression 0:31 texture ( temp 4-component vector of float) 0:31 Construct combined texture-sampler ( temp sampler2D) -0:? 's.tex' ( in texture2D) -0:? 's.s2D' ( in sampler) +0:31 tex: direct index for structure ( temp texture2D) +0:31 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:31 Constant: +0:31 1 (const int) +0:31 s2D: direct index for structure ( temp sampler) +0:31 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:31 Constant: +0:31 0 (const int) 0:31 'f2' ( in 2-component vector of float) 0:35 Function Definition: @main( ( temp 4-component vector of float) 0:35 Function Parameters: @@ -58,18 +75,60 @@ gl_FragCoord origin is upper left 0:37 add ( temp 4-component vector of float) 0:36 add ( temp 4-component vector of float) 0:36 Function Call: osCall1(struct-os-p11; ( temp 4-component vector of float) -0:? 's.s2D' ( uniform sampler) +0:36 Comma ( temp structure{ temp sampler s2D}) +0:36 Sequence +0:36 move second child to first child ( temp sampler) +0:36 s2D: direct index for structure ( temp sampler) +0:36 'aggShadow' ( temp structure{ temp sampler s2D}) +0:36 Constant: +0:36 0 (const int) +0:? 's.s2D' ( uniform sampler) +0:36 'aggShadow' ( temp structure{ temp sampler s2D}) 0:37 Function Call: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float) -0:? 's.s2D' ( uniform sampler) +0:37 Comma ( temp structure{ temp sampler s2D}) +0:37 Sequence +0:37 move second child to first child ( temp sampler) +0:37 s2D: direct index for structure ( temp sampler) +0:37 'aggShadow' ( temp structure{ temp sampler s2D}) +0:37 Constant: +0:37 0 (const int) +0:? 's.s2D' ( uniform sampler) +0:37 'aggShadow' ( temp structure{ temp sampler s2D}) 0:? Constant: 0:? 0.200000 0:? 0.300000 0:38 Function Call: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float) -0:? 's2.s2D' ( uniform sampler) -0:? 's2.tex' ( uniform texture2D) +0:38 Comma ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:38 Sequence +0:38 move second child to first child ( temp sampler) +0:38 s2D: direct index for structure ( temp sampler) +0:38 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:38 Constant: +0:38 0 (const int) +0:? 's2.s2D' ( uniform sampler) +0:38 move second child to first child ( temp texture2D) +0:38 tex: direct index for structure ( temp texture2D) +0:38 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:38 Constant: +0:38 1 (const int) +0:? 's2.tex' ( uniform texture2D) +0:38 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) 0:39 Function Call: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float) -0:? 's2.s2D' ( uniform sampler) -0:? 's2.tex' ( uniform texture2D) +0:39 Comma ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:39 Sequence +0:39 move second child to first child ( temp sampler) +0:39 s2D: direct index for structure ( temp sampler) +0:39 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:39 Constant: +0:39 0 (const int) +0:? 's2.s2D' ( uniform sampler) +0:39 move second child to first child ( temp texture2D) +0:39 tex: direct index for structure ( temp texture2D) +0:39 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:39 Constant: +0:39 1 (const int) +0:? 's2.tex' ( uniform texture2D) +0:39 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) 0:? Constant: 0:? 0.200000 0:? 0.300000 @@ -95,51 +154,67 @@ gl_FragCoord origin is upper left 0:? Sequence 0:15 Function Definition: osCall1(struct-os-p11; ( temp 4-component vector of float) 0:15 Function Parameters: -0:? 's.s2D' ( in sampler) +0:15 's' ( in structure{ temp sampler s2D}) 0:? Sequence 0:16 Branch: Return with expression 0:16 texture ( temp 4-component vector of float) 0:16 Construct combined texture-sampler ( temp sampler2D) 0:16 'tex' ( uniform texture2D) -0:? 's.s2D' ( in sampler) +0:16 s2D: direct index for structure ( temp sampler) +0:16 's' ( in structure{ temp sampler s2D}) +0:16 Constant: +0:16 0 (const int) 0:? Constant: 0:? 0.200000 0:? 0.300000 0:20 Function Definition: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float) 0:20 Function Parameters: -0:? 's.s2D' ( in sampler) +0:20 's' ( in structure{ temp sampler s2D}) 0:20 'f2' ( in 2-component vector of float) 0:? Sequence 0:21 Branch: Return with expression 0:21 texture ( temp 4-component vector of float) 0:21 Construct combined texture-sampler ( temp sampler2D) 0:21 'tex' ( uniform texture2D) -0:? 's.s2D' ( in sampler) +0:21 s2D: direct index for structure ( temp sampler) +0:21 's' ( in structure{ temp sampler s2D}) +0:21 Constant: +0:21 0 (const int) 0:21 'f2' ( in 2-component vector of float) 0:25 Function Definition: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float) 0:25 Function Parameters: -0:? 's.s2D' ( in sampler) -0:? 's.tex' ( in texture2D) +0:25 's' ( in structure{ temp sampler s2D, temp texture2D tex}) 0:? Sequence 0:26 Branch: Return with expression 0:26 texture ( temp 4-component vector of float) 0:26 Construct combined texture-sampler ( temp sampler2D) -0:? 's.tex' ( in texture2D) -0:? 's.s2D' ( in sampler) +0:26 tex: direct index for structure ( temp texture2D) +0:26 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:26 Constant: +0:26 1 (const int) +0:26 s2D: direct index for structure ( temp sampler) +0:26 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:26 Constant: +0:26 0 (const int) 0:? Constant: 0:? 0.200000 0:? 0.300000 0:30 Function Definition: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float) 0:30 Function Parameters: -0:? 's.s2D' ( in sampler) -0:? 's.tex' ( in texture2D) +0:30 's' ( in structure{ temp sampler s2D, temp texture2D tex}) 0:30 'f2' ( in 2-component vector of float) 0:? Sequence 0:31 Branch: Return with expression 0:31 texture ( temp 4-component vector of float) 0:31 Construct combined texture-sampler ( temp sampler2D) -0:? 's.tex' ( in texture2D) -0:? 's.s2D' ( in sampler) +0:31 tex: direct index for structure ( temp texture2D) +0:31 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:31 Constant: +0:31 1 (const int) +0:31 s2D: direct index for structure ( temp sampler) +0:31 's' ( in structure{ temp sampler s2D, temp texture2D tex}) +0:31 Constant: +0:31 0 (const int) 0:31 'f2' ( in 2-component vector of float) 0:35 Function Definition: @main( ( temp 4-component vector of float) 0:35 Function Parameters: @@ -149,18 +224,60 @@ gl_FragCoord origin is upper left 0:37 add ( temp 4-component vector of float) 0:36 add ( temp 4-component vector of float) 0:36 Function Call: osCall1(struct-os-p11; ( temp 4-component vector of float) -0:? 's.s2D' ( uniform sampler) +0:36 Comma ( temp structure{ temp sampler s2D}) +0:36 Sequence +0:36 move second child to first child ( temp sampler) +0:36 s2D: direct index for structure ( temp sampler) +0:36 'aggShadow' ( temp structure{ temp sampler s2D}) +0:36 Constant: +0:36 0 (const int) +0:? 's.s2D' ( uniform sampler) +0:36 'aggShadow' ( temp structure{ temp sampler s2D}) 0:37 Function Call: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float) -0:? 's.s2D' ( uniform sampler) +0:37 Comma ( temp structure{ temp sampler s2D}) +0:37 Sequence +0:37 move second child to first child ( temp sampler) +0:37 s2D: direct index for structure ( temp sampler) +0:37 'aggShadow' ( temp structure{ temp sampler s2D}) +0:37 Constant: +0:37 0 (const int) +0:? 's.s2D' ( uniform sampler) +0:37 'aggShadow' ( temp structure{ temp sampler s2D}) 0:? Constant: 0:? 0.200000 0:? 0.300000 0:38 Function Call: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float) -0:? 's2.s2D' ( uniform sampler) -0:? 's2.tex' ( uniform texture2D) +0:38 Comma ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:38 Sequence +0:38 move second child to first child ( temp sampler) +0:38 s2D: direct index for structure ( temp sampler) +0:38 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:38 Constant: +0:38 0 (const int) +0:? 's2.s2D' ( uniform sampler) +0:38 move second child to first child ( temp texture2D) +0:38 tex: direct index for structure ( temp texture2D) +0:38 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:38 Constant: +0:38 1 (const int) +0:? 's2.tex' ( uniform texture2D) +0:38 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) 0:39 Function Call: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float) -0:? 's2.s2D' ( uniform sampler) -0:? 's2.tex' ( uniform texture2D) +0:39 Comma ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:39 Sequence +0:39 move second child to first child ( temp sampler) +0:39 s2D: direct index for structure ( temp sampler) +0:39 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:39 Constant: +0:39 0 (const int) +0:? 's2.s2D' ( uniform sampler) +0:39 move second child to first child ( temp texture2D) +0:39 tex: direct index for structure ( temp texture2D) +0:39 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) +0:39 Constant: +0:39 1 (const int) +0:? 's2.tex' ( uniform texture2D) +0:39 'aggShadow' ( temp structure{ temp sampler s2D, temp texture2D tex}) 0:? Constant: 0:? 0.200000 0:? 0.300000 @@ -178,152 +295,184 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 99 +// Generated by (magic number): 80007 +// Id's are bound by 122 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 97 + EntryPoint Fragment 4 "main" 120 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 12 "osCall1(struct-os-p11;" - Name 11 "s.s2D" - Name 19 "osCall2(struct-os-p11;vf2;" - Name 17 "s.s2D" - Name 18 "f2" - Name 26 "os2Call1(struct-os2-p1-t211;" - Name 24 "s.s2D" - Name 25 "s.tex" + Name 7 "os" + MemberName 7(os) 0 "s2D" + Name 13 "osCall1(struct-os-p11;" + Name 12 "s" + Name 20 "osCall2(struct-os-p11;vf2;" + Name 18 "s" + Name 19 "f2" + Name 23 "os2" + MemberName 23(os2) 0 "s2D" + MemberName 23(os2) 1 "tex" + Name 27 "os2Call1(struct-os2-p1-t211;" + Name 26 "s" Name 32 "os2Call2(struct-os2-p1-t211;vf2;" - Name 29 "s.s2D" - Name 30 "s.tex" + Name 30 "s" Name 31 "f2" Name 35 "@main(" Name 38 "tex" - Name 70 "s.s2D" - Name 71 "param" - Name 74 "param" - Name 76 "param" - Name 79 "s2.s2D" - Name 80 "s2.tex" - Name 81 "param" - Name 83 "param" - Name 87 "param" - Name 89 "param" + Name 80 "aggShadow" + Name 82 "s.s2D" + Name 85 "param" + Name 88 "aggShadow" Name 91 "param" - Name 97 "@entryPointOutput" + Name 93 "param" + Name 96 "aggShadow" + Name 97 "s2.s2D" + Name 100 "s2.tex" + Name 103 "param" + Name 107 "aggShadow" + Name 112 "param" + Name 114 "param" + Name 120 "@entryPointOutput" Decorate 38(tex) DescriptorSet 0 - Decorate 70(s.s2D) DescriptorSet 0 - Decorate 79(s2.s2D) DescriptorSet 0 - Decorate 80(s2.tex) DescriptorSet 0 - Decorate 97(@entryPointOutput) Location 0 + Decorate 82(s.s2D) DescriptorSet 0 + Decorate 97(s2.s2D) DescriptorSet 0 + Decorate 100(s2.tex) DescriptorSet 0 + Decorate 120(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 7: TypePointer Function 6 - 8: TypeFloat 32 - 9: TypeVector 8(float) 4 - 10: TypeFunction 9(fvec4) 7(ptr) - 14: TypeVector 8(float) 2 - 15: TypePointer Function 14(fvec2) - 16: TypeFunction 9(fvec4) 7(ptr) 15(ptr) - 21: TypeImage 8(float) 2D sampled format:Unknown - 22: TypePointer Function 21 - 23: TypeFunction 9(fvec4) 7(ptr) 22(ptr) - 28: TypeFunction 9(fvec4) 7(ptr) 22(ptr) 15(ptr) - 34: TypeFunction 9(fvec4) - 37: TypePointer UniformConstant 21 + 7(os): TypeStruct 6 + 8: TypePointer Function 7(os) + 9: TypeFloat 32 + 10: TypeVector 9(float) 4 + 11: TypeFunction 10(fvec4) 8(ptr) + 15: TypeVector 9(float) 2 + 16: TypePointer Function 15(fvec2) + 17: TypeFunction 10(fvec4) 8(ptr) 16(ptr) + 22: TypeImage 9(float) 2D sampled format:Unknown + 23(os2): TypeStruct 6 22 + 24: TypePointer Function 23(os2) + 25: TypeFunction 10(fvec4) 24(ptr) + 29: TypeFunction 10(fvec4) 24(ptr) 16(ptr) + 34: TypeFunction 10(fvec4) + 37: TypePointer UniformConstant 22 38(tex): 37(ptr) Variable UniformConstant - 41: TypeSampledImage 21 - 43: 8(float) Constant 1045220557 - 44: 8(float) Constant 1050253722 - 45: 14(fvec2) ConstantComposite 43 44 - 69: TypePointer UniformConstant 6 - 70(s.s2D): 69(ptr) Variable UniformConstant - 79(s2.s2D): 69(ptr) Variable UniformConstant - 80(s2.tex): 37(ptr) Variable UniformConstant - 96: TypePointer Output 9(fvec4) -97(@entryPointOutput): 96(ptr) Variable Output + 40: TypeInt 32 1 + 41: 40(int) Constant 0 + 42: TypePointer Function 6 + 45: TypeSampledImage 22 + 47: 9(float) Constant 1045220557 + 48: 9(float) Constant 1050253722 + 49: 15(fvec2) ConstantComposite 47 48 + 61: 40(int) Constant 1 + 62: TypePointer Function 22 + 81: TypePointer UniformConstant 6 + 82(s.s2D): 81(ptr) Variable UniformConstant + 97(s2.s2D): 81(ptr) Variable UniformConstant + 100(s2.tex): 37(ptr) Variable UniformConstant + 119: TypePointer Output 10(fvec4) +120(@entryPointOutput): 119(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 98: 9(fvec4) FunctionCall 35(@main() - Store 97(@entryPointOutput) 98 + 121: 10(fvec4) FunctionCall 35(@main() + Store 120(@entryPointOutput) 121 Return FunctionEnd -12(osCall1(struct-os-p11;): 9(fvec4) Function None 10 - 11(s.s2D): 7(ptr) FunctionParameter - 13: Label - 39: 21 Load 38(tex) - 40: 6 Load 11(s.s2D) - 42: 41 SampledImage 39 40 - 46: 9(fvec4) ImageSampleImplicitLod 42 45 - ReturnValue 46 +13(osCall1(struct-os-p11;): 10(fvec4) Function None 11 + 12(s): 8(ptr) FunctionParameter + 14: Label + 39: 22 Load 38(tex) + 43: 42(ptr) AccessChain 12(s) 41 + 44: 6 Load 43 + 46: 45 SampledImage 39 44 + 50: 10(fvec4) ImageSampleImplicitLod 46 49 + ReturnValue 50 FunctionEnd -19(osCall2(struct-os-p11;vf2;): 9(fvec4) Function None 16 - 17(s.s2D): 7(ptr) FunctionParameter - 18(f2): 15(ptr) FunctionParameter - 20: Label - 49: 21 Load 38(tex) - 50: 6 Load 17(s.s2D) - 51: 41 SampledImage 49 50 - 52: 14(fvec2) Load 18(f2) - 53: 9(fvec4) ImageSampleImplicitLod 51 52 - ReturnValue 53 +20(osCall2(struct-os-p11;vf2;): 10(fvec4) Function None 17 + 18(s): 8(ptr) FunctionParameter + 19(f2): 16(ptr) FunctionParameter + 21: Label + 53: 22 Load 38(tex) + 54: 42(ptr) AccessChain 18(s) 41 + 55: 6 Load 54 + 56: 45 SampledImage 53 55 + 57: 15(fvec2) Load 19(f2) + 58: 10(fvec4) ImageSampleImplicitLod 56 57 + ReturnValue 58 FunctionEnd -26(os2Call1(struct-os2-p1-t211;): 9(fvec4) Function None 23 - 24(s.s2D): 7(ptr) FunctionParameter - 25(s.tex): 22(ptr) FunctionParameter - 27: Label - 56: 21 Load 25(s.tex) - 57: 6 Load 24(s.s2D) - 58: 41 SampledImage 56 57 - 59: 9(fvec4) ImageSampleImplicitLod 58 45 - ReturnValue 59 +27(os2Call1(struct-os2-p1-t211;): 10(fvec4) Function None 25 + 26(s): 24(ptr) FunctionParameter + 28: Label + 63: 62(ptr) AccessChain 26(s) 61 + 64: 22 Load 63 + 65: 42(ptr) AccessChain 26(s) 41 + 66: 6 Load 65 + 67: 45 SampledImage 64 66 + 68: 10(fvec4) ImageSampleImplicitLod 67 49 + ReturnValue 68 FunctionEnd -32(os2Call2(struct-os2-p1-t211;vf2;): 9(fvec4) Function None 28 - 29(s.s2D): 7(ptr) FunctionParameter - 30(s.tex): 22(ptr) FunctionParameter - 31(f2): 15(ptr) FunctionParameter +32(os2Call2(struct-os2-p1-t211;vf2;): 10(fvec4) Function None 29 + 30(s): 24(ptr) FunctionParameter + 31(f2): 16(ptr) FunctionParameter 33: Label - 62: 21 Load 30(s.tex) - 63: 6 Load 29(s.s2D) - 64: 41 SampledImage 62 63 - 65: 14(fvec2) Load 31(f2) - 66: 9(fvec4) ImageSampleImplicitLod 64 65 - ReturnValue 66 + 71: 62(ptr) AccessChain 30(s) 61 + 72: 22 Load 71 + 73: 42(ptr) AccessChain 30(s) 41 + 74: 6 Load 73 + 75: 45 SampledImage 72 74 + 76: 15(fvec2) Load 31(f2) + 77: 10(fvec4) ImageSampleImplicitLod 75 76 + ReturnValue 77 FunctionEnd - 35(@main(): 9(fvec4) Function None 34 + 35(@main(): 10(fvec4) Function None 34 36: Label - 71(param): 7(ptr) Variable Function - 74(param): 7(ptr) Variable Function - 76(param): 15(ptr) Variable Function - 81(param): 7(ptr) Variable Function - 83(param): 22(ptr) Variable Function - 87(param): 7(ptr) Variable Function - 89(param): 22(ptr) Variable Function - 91(param): 15(ptr) Variable Function - 72: 6 Load 70(s.s2D) - Store 71(param) 72 - 73: 9(fvec4) FunctionCall 12(osCall1(struct-os-p11;) 71(param) - 75: 6 Load 70(s.s2D) - Store 74(param) 75 - Store 76(param) 45 - 77: 9(fvec4) FunctionCall 19(osCall2(struct-os-p11;vf2;) 74(param) 76(param) - 78: 9(fvec4) FAdd 73 77 - 82: 6 Load 79(s2.s2D) - Store 81(param) 82 - 84: 21 Load 80(s2.tex) - Store 83(param) 84 - 85: 9(fvec4) FunctionCall 26(os2Call1(struct-os2-p1-t211;) 81(param) 83(param) - 86: 9(fvec4) FAdd 78 85 - 88: 6 Load 79(s2.s2D) - Store 87(param) 88 - 90: 21 Load 80(s2.tex) - Store 89(param) 90 - Store 91(param) 45 - 92: 9(fvec4) FunctionCall 32(os2Call2(struct-os2-p1-t211;vf2;) 87(param) 89(param) 91(param) - 93: 9(fvec4) FAdd 86 92 - ReturnValue 93 + 80(aggShadow): 8(ptr) Variable Function + 85(param): 8(ptr) Variable Function + 88(aggShadow): 8(ptr) Variable Function + 91(param): 8(ptr) Variable Function + 93(param): 16(ptr) Variable Function + 96(aggShadow): 24(ptr) Variable Function + 103(param): 24(ptr) Variable Function + 107(aggShadow): 24(ptr) Variable Function + 112(param): 24(ptr) Variable Function + 114(param): 16(ptr) Variable Function + 83: 6 Load 82(s.s2D) + 84: 42(ptr) AccessChain 80(aggShadow) 41 + Store 84 83 + 86: 7(os) Load 80(aggShadow) + Store 85(param) 86 + 87: 10(fvec4) FunctionCall 13(osCall1(struct-os-p11;) 85(param) + 89: 6 Load 82(s.s2D) + 90: 42(ptr) AccessChain 88(aggShadow) 41 + Store 90 89 + 92: 7(os) Load 88(aggShadow) + Store 91(param) 92 + Store 93(param) 49 + 94: 10(fvec4) FunctionCall 20(osCall2(struct-os-p11;vf2;) 91(param) 93(param) + 95: 10(fvec4) FAdd 87 94 + 98: 6 Load 97(s2.s2D) + 99: 42(ptr) AccessChain 96(aggShadow) 41 + Store 99 98 + 101: 22 Load 100(s2.tex) + 102: 62(ptr) AccessChain 96(aggShadow) 61 + Store 102 101 + 104: 23(os2) Load 96(aggShadow) + Store 103(param) 104 + 105: 10(fvec4) FunctionCall 27(os2Call1(struct-os2-p1-t211;) 103(param) + 106: 10(fvec4) FAdd 95 105 + 108: 6 Load 97(s2.s2D) + 109: 42(ptr) AccessChain 107(aggShadow) 41 + Store 109 108 + 110: 22 Load 100(s2.tex) + 111: 62(ptr) AccessChain 107(aggShadow) 61 + Store 111 110 + 113: 23(os2) Load 107(aggShadow) + Store 112(param) 113 + Store 114(param) 49 + 115: 10(fvec4) FunctionCall 32(os2Call2(struct-os2-p1-t211;vf2;) 112(param) 114(param) + 116: 10(fvec4) FAdd 106 115 + ReturnValue 116 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out index b82cfffee79..29da8446545 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out @@ -4,14 +4,19 @@ Shader version: 500 0:? Sequence 0:5 Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) 0:5 Function Parameters: -0:? 'tex.smpl' ( in sampler) -0:? 'tex.tex' ( in texture2D) +0:5 'tex' ( in structure{ temp sampler smpl, temp texture2D tex}) 0:? Sequence 0:6 Branch: Return with expression 0:6 texture ( temp 4-component vector of float) 0:6 Construct combined texture-sampler ( temp sampler2D) -0:? 'tex.tex' ( in texture2D) -0:? 'tex.smpl' ( in sampler) +0:6 tex: direct index for structure ( temp texture2D) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex}) +0:6 Constant: +0:6 1 (const int) +0:6 smpl: direct index for structure ( temp sampler) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex}) +0:6 Constant: +0:6 0 (const int) 0:? Constant: 0:? 0.300000 0:? 0.400000 @@ -19,10 +24,16 @@ Shader version: 500 0:10 Function Parameters: 0:? Sequence 0:12 move second child to first child ( temp sampler) -0:? 't.smpl' ( temp sampler) +0:12 smpl: direct index for structure ( temp sampler) +0:12 't' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:12 Constant: +0:12 0 (const int) 0:12 'g_tInputTexture_sampler' ( uniform sampler) 0:13 move second child to first child ( temp texture2D) -0:? 't.tex' ( temp texture2D) +0:13 tex: direct index for structure ( temp texture2D) +0:13 't' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:13 Constant: +0:13 1 (const int) 0:13 'g_tInputTexture' ( uniform texture2D) 0:14 Branch: Return with expression 0:14 't' ( temp structure{ temp sampler smpl, temp texture2D tex}) @@ -30,53 +41,34 @@ Shader version: 500 0:18 Function Parameters: 0:? Sequence 0:19 Sequence -0:19 Sequence -0:19 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 'g_tInputTexture_sampler' ( uniform sampler) -0:19 'g_tInputTexture' ( uniform texture2D) -0:19 move second child to first child ( temp sampler) -0:? 'tex1.smpl' ( temp sampler) -0:19 smpl: direct index for structure ( temp sampler) -0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 Constant: -0:19 0 (const int) -0:19 move second child to first child ( temp texture2D) -0:? 'tex1.tex' ( temp texture2D) -0:19 tex: direct index for structure ( temp texture2D) -0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 Constant: -0:19 1 (const int) +0:19 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:19 'tex1' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:19 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:19 'g_tInputTexture_sampler' ( uniform sampler) +0:19 'g_tInputTexture' ( uniform texture2D) 0:20 Sequence -0:20 Sequence -0:20 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 Function Call: fillOpaque( ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 move second child to first child ( temp sampler) -0:? 'tex2.smpl' ( temp sampler) -0:20 smpl: direct index for structure ( temp sampler) -0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 Constant: -0:20 0 (const int) -0:20 move second child to first child ( temp texture2D) -0:? 'tex2.tex' ( temp texture2D) -0:20 tex: direct index for structure ( temp texture2D) -0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 Constant: -0:20 1 (const int) +0:20 move second child to first child ( temp 4-component vector of float) +0:20 'res' ( temp 4-component vector of float) +0:20 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) +0:20 'tex1' ( temp structure{ temp sampler smpl, temp texture2D tex}) 0:21 Sequence -0:21 Sequence -0:21 move second child to first child ( temp sampler) -0:? 'tex3.smpl' ( temp sampler) -0:? 'tex1.smpl' ( temp sampler) -0:21 move second child to first child ( temp texture2D) -0:? 'tex3.tex' ( temp texture2D) -0:? 'tex1.tex' ( temp texture2D) -0:22 Branch: Return with expression +0:21 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:21 'tex2' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:21 Function Call: fillOpaque( ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:22 add second child into first child ( temp 4-component vector of float) +0:22 'res' ( temp 4-component vector of float) 0:22 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) -0:? 'tex3.smpl' ( temp sampler) -0:? 'tex3.tex' ( temp texture2D) +0:22 'tex2' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:23 Sequence +0:23 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:23 'tex3' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:23 'tex1' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:24 add second child into first child ( temp 4-component vector of float) +0:24 'res' ( temp 4-component vector of float) +0:24 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) +0:24 'tex3' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:26 Branch: Return with expression +0:26 'res' ( temp 4-component vector of float) 0:18 Function Definition: main( ( temp void) 0:18 Function Parameters: 0:? Sequence @@ -96,14 +88,19 @@ Shader version: 500 0:? Sequence 0:5 Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) 0:5 Function Parameters: -0:? 'tex.smpl' ( in sampler) -0:? 'tex.tex' ( in texture2D) +0:5 'tex' ( in structure{ temp sampler smpl, temp texture2D tex}) 0:? Sequence 0:6 Branch: Return with expression 0:6 texture ( temp 4-component vector of float) 0:6 Construct combined texture-sampler ( temp sampler2D) -0:? 'tex.tex' ( in texture2D) -0:? 'tex.smpl' ( in sampler) +0:6 tex: direct index for structure ( temp texture2D) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex}) +0:6 Constant: +0:6 1 (const int) +0:6 smpl: direct index for structure ( temp sampler) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex}) +0:6 Constant: +0:6 0 (const int) 0:? Constant: 0:? 0.300000 0:? 0.400000 @@ -111,10 +108,16 @@ Shader version: 500 0:10 Function Parameters: 0:? Sequence 0:12 move second child to first child ( temp sampler) -0:? 't.smpl' ( temp sampler) +0:12 smpl: direct index for structure ( temp sampler) +0:12 't' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:12 Constant: +0:12 0 (const int) 0:12 'g_tInputTexture_sampler' ( uniform sampler) 0:13 move second child to first child ( temp texture2D) -0:? 't.tex' ( temp texture2D) +0:13 tex: direct index for structure ( temp texture2D) +0:13 't' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:13 Constant: +0:13 1 (const int) 0:13 'g_tInputTexture' ( uniform texture2D) 0:14 Branch: Return with expression 0:14 't' ( temp structure{ temp sampler smpl, temp texture2D tex}) @@ -122,53 +125,34 @@ Shader version: 500 0:18 Function Parameters: 0:? Sequence 0:19 Sequence -0:19 Sequence -0:19 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 'g_tInputTexture_sampler' ( uniform sampler) -0:19 'g_tInputTexture' ( uniform texture2D) -0:19 move second child to first child ( temp sampler) -0:? 'tex1.smpl' ( temp sampler) -0:19 smpl: direct index for structure ( temp sampler) -0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 Constant: -0:19 0 (const int) -0:19 move second child to first child ( temp texture2D) -0:? 'tex1.tex' ( temp texture2D) -0:19 tex: direct index for structure ( temp texture2D) -0:19 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:19 Constant: -0:19 1 (const int) +0:19 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:19 'tex1' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:19 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:19 'g_tInputTexture_sampler' ( uniform sampler) +0:19 'g_tInputTexture' ( uniform texture2D) 0:20 Sequence -0:20 Sequence -0:20 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 Function Call: fillOpaque( ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 move second child to first child ( temp sampler) -0:? 'tex2.smpl' ( temp sampler) -0:20 smpl: direct index for structure ( temp sampler) -0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 Constant: -0:20 0 (const int) -0:20 move second child to first child ( temp texture2D) -0:? 'tex2.tex' ( temp texture2D) -0:20 tex: direct index for structure ( temp texture2D) -0:20 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex}) -0:20 Constant: -0:20 1 (const int) +0:20 move second child to first child ( temp 4-component vector of float) +0:20 'res' ( temp 4-component vector of float) +0:20 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) +0:20 'tex1' ( temp structure{ temp sampler smpl, temp texture2D tex}) 0:21 Sequence -0:21 Sequence -0:21 move second child to first child ( temp sampler) -0:? 'tex3.smpl' ( temp sampler) -0:? 'tex1.smpl' ( temp sampler) -0:21 move second child to first child ( temp texture2D) -0:? 'tex3.tex' ( temp texture2D) -0:? 'tex1.tex' ( temp texture2D) -0:22 Branch: Return with expression +0:21 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:21 'tex2' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:21 Function Call: fillOpaque( ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:22 add second child into first child ( temp 4-component vector of float) +0:22 'res' ( temp 4-component vector of float) 0:22 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) -0:? 'tex3.smpl' ( temp sampler) -0:? 'tex3.tex' ( temp texture2D) +0:22 'tex2' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:23 Sequence +0:23 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:23 'tex3' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:23 'tex1' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:24 add second child into first child ( temp 4-component vector of float) +0:24 'res' ( temp 4-component vector of float) +0:24 Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float) +0:24 'tex3' ( temp structure{ temp sampler smpl, temp texture2D tex}) +0:26 Branch: Return with expression +0:26 'res' ( temp 4-component vector of float) 0:18 Function Definition: main( ( temp void) 0:18 Function Parameters: 0:? Sequence @@ -181,136 +165,127 @@ Shader version: 500 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 84 +// Generated by (magic number): 80007 +// Id's are bound by 82 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 82 + EntryPoint Vertex 4 "main" 80 Source HLSL 500 Name 4 "main" - Name 15 "lookUp(struct-FxaaTex-p1-t211;" - Name 13 "tex.smpl" - Name 14 "tex.tex" - Name 17 "FxaaTex" - MemberName 17(FxaaTex) 0 "smpl" - MemberName 17(FxaaTex) 1 "tex" - Name 19 "fillOpaque(" - Name 22 "@main(" - Name 36 "t.smpl" - Name 38 "g_tInputTexture_sampler" - Name 40 "t.tex" - Name 42 "g_tInputTexture" - Name 45 "t" - Name 49 "flattenTemp" - Name 53 "tex1.smpl" - Name 58 "tex1.tex" - Name 62 "flattenTemp" - Name 64 "tex2.smpl" - Name 67 "tex2.tex" - Name 70 "tex3.smpl" - Name 72 "tex3.tex" - Name 74 "param" - Name 76 "param" - Name 82 "@entryPointOutput" - Decorate 38(g_tInputTexture_sampler) DescriptorSet 0 - Decorate 42(g_tInputTexture) DescriptorSet 0 - Decorate 82(@entryPointOutput) Location 0 + Name 9 "FxaaTex" + MemberName 9(FxaaTex) 0 "smpl" + MemberName 9(FxaaTex) 1 "tex" + Name 14 "lookUp(struct-FxaaTex-p1-t211;" + Name 13 "tex" + Name 17 "fillOpaque(" + Name 20 "@main(" + Name 41 "t" + Name 43 "g_tInputTexture_sampler" + Name 47 "g_tInputTexture" + Name 53 "tex1" + Name 58 "res" + Name 59 "param" + Name 62 "tex2" + Name 64 "param" + Name 69 "tex3" + Name 71 "param" + Name 80 "@entryPointOutput" + Decorate 43(g_tInputTexture_sampler) DescriptorSet 0 + Decorate 47(g_tInputTexture) DescriptorSet 0 + Decorate 80(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 7: TypePointer Function 6 - 8: TypeFloat 32 - 9: TypeImage 8(float) 2D sampled format:Unknown - 10: TypePointer Function 9 - 11: TypeVector 8(float) 4 - 12: TypeFunction 11(fvec4) 7(ptr) 10(ptr) - 17(FxaaTex): TypeStruct 6 9 - 18: TypeFunction 17(FxaaTex) - 21: TypeFunction 11(fvec4) - 26: TypeSampledImage 9 - 28: TypeVector 8(float) 2 - 29: 8(float) Constant 1050253722 - 30: 8(float) Constant 1053609165 - 31: 28(fvec2) ConstantComposite 29 30 - 32: 8(float) Constant 0 - 37: TypePointer UniformConstant 6 -38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant - 41: TypePointer UniformConstant 9 -42(g_tInputTexture): 41(ptr) Variable UniformConstant - 44: TypePointer Function 17(FxaaTex) - 54: TypeInt 32 1 - 55: 54(int) Constant 0 - 59: 54(int) Constant 1 - 81: TypePointer Output 11(fvec4) -82(@entryPointOutput): 81(ptr) Variable Output + 7: TypeFloat 32 + 8: TypeImage 7(float) 2D sampled format:Unknown + 9(FxaaTex): TypeStruct 6 8 + 10: TypePointer Function 9(FxaaTex) + 11: TypeVector 7(float) 4 + 12: TypeFunction 11(fvec4) 10(ptr) + 16: TypeFunction 9(FxaaTex) + 19: TypeFunction 11(fvec4) + 22: TypeInt 32 1 + 23: 22(int) Constant 1 + 24: TypePointer Function 8 + 27: 22(int) Constant 0 + 28: TypePointer Function 6 + 31: TypeSampledImage 8 + 33: TypeVector 7(float) 2 + 34: 7(float) Constant 1050253722 + 35: 7(float) Constant 1053609165 + 36: 33(fvec2) ConstantComposite 34 35 + 37: 7(float) Constant 0 + 42: TypePointer UniformConstant 6 +43(g_tInputTexture_sampler): 42(ptr) Variable UniformConstant + 46: TypePointer UniformConstant 8 +47(g_tInputTexture): 46(ptr) Variable UniformConstant + 57: TypePointer Function 11(fvec4) + 79: TypePointer Output 11(fvec4) +80(@entryPointOutput): 79(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 83: 11(fvec4) FunctionCall 22(@main() - Store 82(@entryPointOutput) 83 + 81: 11(fvec4) FunctionCall 20(@main() + Store 80(@entryPointOutput) 81 Return FunctionEnd -15(lookUp(struct-FxaaTex-p1-t211;): 11(fvec4) Function None 12 - 13(tex.smpl): 7(ptr) FunctionParameter - 14(tex.tex): 10(ptr) FunctionParameter - 16: Label - 24: 9 Load 14(tex.tex) - 25: 6 Load 13(tex.smpl) - 27: 26 SampledImage 24 25 - 33: 11(fvec4) ImageSampleExplicitLod 27 31 Lod 32 - ReturnValue 33 +14(lookUp(struct-FxaaTex-p1-t211;): 11(fvec4) Function None 12 + 13(tex): 10(ptr) FunctionParameter + 15: Label + 25: 24(ptr) AccessChain 13(tex) 23 + 26: 8 Load 25 + 29: 28(ptr) AccessChain 13(tex) 27 + 30: 6 Load 29 + 32: 31 SampledImage 26 30 + 38: 11(fvec4) ImageSampleExplicitLod 32 36 Lod 37 + ReturnValue 38 FunctionEnd - 19(fillOpaque(): 17(FxaaTex) Function None 18 - 20: Label - 36(t.smpl): 7(ptr) Variable Function - 40(t.tex): 10(ptr) Variable Function - 45(t): 44(ptr) Variable Function - 39: 6 Load 38(g_tInputTexture_sampler) - Store 36(t.smpl) 39 - 43: 9 Load 42(g_tInputTexture) - Store 40(t.tex) 43 - 46: 17(FxaaTex) Load 45(t) - ReturnValue 46 + 17(fillOpaque(): 9(FxaaTex) Function None 16 + 18: Label + 41(t): 10(ptr) Variable Function + 44: 6 Load 43(g_tInputTexture_sampler) + 45: 28(ptr) AccessChain 41(t) 27 + Store 45 44 + 48: 8 Load 47(g_tInputTexture) + 49: 24(ptr) AccessChain 41(t) 23 + Store 49 48 + 50: 9(FxaaTex) Load 41(t) + ReturnValue 50 FunctionEnd - 22(@main(): 11(fvec4) Function None 21 - 23: Label - 49(flattenTemp): 44(ptr) Variable Function - 53(tex1.smpl): 7(ptr) Variable Function - 58(tex1.tex): 10(ptr) Variable Function - 62(flattenTemp): 44(ptr) Variable Function - 64(tex2.smpl): 7(ptr) Variable Function - 67(tex2.tex): 10(ptr) Variable Function - 70(tex3.smpl): 7(ptr) Variable Function - 72(tex3.tex): 10(ptr) Variable Function - 74(param): 7(ptr) Variable Function - 76(param): 10(ptr) Variable Function - 50: 6 Load 38(g_tInputTexture_sampler) - 51: 9 Load 42(g_tInputTexture) - 52: 17(FxaaTex) CompositeConstruct 50 51 - Store 49(flattenTemp) 52 - 56: 7(ptr) AccessChain 49(flattenTemp) 55 - 57: 6 Load 56 - Store 53(tex1.smpl) 57 - 60: 10(ptr) AccessChain 49(flattenTemp) 59 - 61: 9 Load 60 - Store 58(tex1.tex) 61 - 63: 17(FxaaTex) FunctionCall 19(fillOpaque() - Store 62(flattenTemp) 63 - 65: 7(ptr) AccessChain 62(flattenTemp) 55 - 66: 6 Load 65 - Store 64(tex2.smpl) 66 - 68: 10(ptr) AccessChain 62(flattenTemp) 59 - 69: 9 Load 68 - Store 67(tex2.tex) 69 - 71: 6 Load 53(tex1.smpl) - Store 70(tex3.smpl) 71 - 73: 9 Load 58(tex1.tex) - Store 72(tex3.tex) 73 - 75: 6 Load 70(tex3.smpl) - Store 74(param) 75 - 77: 9 Load 72(tex3.tex) - Store 76(param) 77 - 78: 11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 74(param) 76(param) - ReturnValue 78 + 20(@main(): 11(fvec4) Function None 19 + 21: Label + 53(tex1): 10(ptr) Variable Function + 58(res): 57(ptr) Variable Function + 59(param): 10(ptr) Variable Function + 62(tex2): 10(ptr) Variable Function + 64(param): 10(ptr) Variable Function + 69(tex3): 10(ptr) Variable Function + 71(param): 10(ptr) Variable Function + 54: 6 Load 43(g_tInputTexture_sampler) + 55: 8 Load 47(g_tInputTexture) + 56: 9(FxaaTex) CompositeConstruct 54 55 + Store 53(tex1) 56 + 60: 9(FxaaTex) Load 53(tex1) + Store 59(param) 60 + 61: 11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t211;) 59(param) + Store 58(res) 61 + 63: 9(FxaaTex) FunctionCall 17(fillOpaque() + Store 62(tex2) 63 + 65: 9(FxaaTex) Load 62(tex2) + Store 64(param) 65 + 66: 11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t211;) 64(param) + 67: 11(fvec4) Load 58(res) + 68: 11(fvec4) FAdd 67 66 + Store 58(res) 68 + 70: 9(FxaaTex) Load 53(tex1) + Store 69(tex3) 70 + 72: 9(FxaaTex) Load 69(tex3) + Store 71(param) 72 + 73: 11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t211;) 71(param) + 74: 11(fvec4) Load 58(res) + 75: 11(fvec4) FAdd 74 73 + Store 58(res) 75 + 76: 11(fvec4) Load 58(res) + ReturnValue 76 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out index 2de34838fd4..bf95980434a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out @@ -4,53 +4,42 @@ Shader version: 500 0:? Sequence 0:5 Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float) 0:5 Function Parameters: -0:? 'tex.smpl' ( in sampler) -0:? 'tex.tex' ( in texture2D) -0:? 'tex.f' ( in float) +0:5 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) 0:? Sequence 0:6 Branch: Return with expression 0:6 texture ( temp 4-component vector of float) 0:6 Construct combined texture-sampler ( temp sampler2D) -0:? 'tex.tex' ( in texture2D) -0:? 'tex.smpl' ( in sampler) +0:6 tex: direct index for structure ( temp texture2D) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 1 (const int) +0:6 smpl: direct index for structure ( temp sampler) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 0 (const int) 0:? Construct vec2 ( temp 2-component vector of float) -0:? 'tex.f' ( in float) -0:? 'tex.f' ( in float) +0:6 f: direct index for structure ( temp float) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 2 (const int) +0:6 f: direct index for structure ( temp float) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 2 (const int) 0:10 Function Definition: @main( ( temp 4-component vector of float) 0:10 Function Parameters: 0:? Sequence 0:11 Sequence -0:11 Sequence -0:11 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 'g_tInputTexture_sampler' ( uniform sampler) -0:11 'g_tInputTexture' ( uniform texture2D) -0:11 Constant: -0:11 0.500000 -0:11 move second child to first child ( temp sampler) -0:? 'tex.smpl' ( temp sampler) -0:11 smpl: direct index for structure ( temp sampler) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Constant: -0:11 0 (const int) -0:11 move second child to first child ( temp texture2D) -0:? 'tex.tex' ( temp texture2D) -0:11 tex: direct index for structure ( temp texture2D) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Constant: -0:11 1 (const int) -0:11 move second child to first child ( temp float) -0:? 'tex.f' ( temp float) -0:11 f: direct index for structure ( temp float) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Constant: -0:11 2 (const int) +0:11 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:11 'tex' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:11 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:11 'g_tInputTexture_sampler' ( uniform sampler) +0:11 'g_tInputTexture' ( uniform texture2D) +0:11 Constant: +0:11 0.500000 0:12 Branch: Return with expression 0:12 Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float) -0:? 'tex.smpl' ( temp sampler) -0:? 'tex.tex' ( temp texture2D) -0:? 'tex.f' ( temp float) +0:12 'tex' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) 0:10 Function Definition: main( ( temp void) 0:10 Function Parameters: 0:? Sequence @@ -70,53 +59,42 @@ Shader version: 500 0:? Sequence 0:5 Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float) 0:5 Function Parameters: -0:? 'tex.smpl' ( in sampler) -0:? 'tex.tex' ( in texture2D) -0:? 'tex.f' ( in float) +0:5 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) 0:? Sequence 0:6 Branch: Return with expression 0:6 texture ( temp 4-component vector of float) 0:6 Construct combined texture-sampler ( temp sampler2D) -0:? 'tex.tex' ( in texture2D) -0:? 'tex.smpl' ( in sampler) +0:6 tex: direct index for structure ( temp texture2D) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 1 (const int) +0:6 smpl: direct index for structure ( temp sampler) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 0 (const int) 0:? Construct vec2 ( temp 2-component vector of float) -0:? 'tex.f' ( in float) -0:? 'tex.f' ( in float) +0:6 f: direct index for structure ( temp float) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 2 (const int) +0:6 f: direct index for structure ( temp float) +0:6 'tex' ( in structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:6 Constant: +0:6 2 (const int) 0:10 Function Definition: @main( ( temp 4-component vector of float) 0:10 Function Parameters: 0:? Sequence 0:11 Sequence -0:11 Sequence -0:11 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 'g_tInputTexture_sampler' ( uniform sampler) -0:11 'g_tInputTexture' ( uniform texture2D) -0:11 Constant: -0:11 0.500000 -0:11 move second child to first child ( temp sampler) -0:? 'tex.smpl' ( temp sampler) -0:11 smpl: direct index for structure ( temp sampler) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Constant: -0:11 0 (const int) -0:11 move second child to first child ( temp texture2D) -0:? 'tex.tex' ( temp texture2D) -0:11 tex: direct index for structure ( temp texture2D) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Constant: -0:11 1 (const int) -0:11 move second child to first child ( temp float) -0:? 'tex.f' ( temp float) -0:11 f: direct index for structure ( temp float) -0:11 'flattenTemp' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) -0:11 Constant: -0:11 2 (const int) +0:11 move second child to first child ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:11 'tex' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:11 Construct structure ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) +0:11 'g_tInputTexture_sampler' ( uniform sampler) +0:11 'g_tInputTexture' ( uniform texture2D) +0:11 Constant: +0:11 0.500000 0:12 Branch: Return with expression 0:12 Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float) -0:? 'tex.smpl' ( temp sampler) -0:? 'tex.tex' ( temp texture2D) -0:? 'tex.f' ( temp float) +0:12 'tex' ( temp structure{ temp sampler smpl, temp texture2D tex, temp float f}) 0:10 Function Definition: main( ( temp void) 0:10 Function Parameters: 0:? Sequence @@ -129,112 +107,89 @@ Shader version: 500 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 70 +// Generated by (magic number): 80007 +// Id's are bound by 59 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 68 + EntryPoint Vertex 4 "main" 57 Source HLSL 500 Name 4 "main" - Name 17 "lookUp(struct-FxaaTex-p1-t21-f11;" - Name 14 "tex.smpl" - Name 15 "tex.tex" - Name 16 "tex.f" - Name 20 "@main(" - Name 34 "FxaaTex" - MemberName 34(FxaaTex) 0 "smpl" - MemberName 34(FxaaTex) 1 "tex" - MemberName 34(FxaaTex) 2 "f" - Name 36 "flattenTemp" - Name 38 "g_tInputTexture_sampler" - Name 41 "g_tInputTexture" - Name 45 "tex.smpl" - Name 50 "tex.tex" - Name 54 "tex.f" - Name 58 "param" - Name 60 "param" - Name 62 "param" - Name 68 "@entryPointOutput" - Decorate 38(g_tInputTexture_sampler) DescriptorSet 0 - Decorate 41(g_tInputTexture) DescriptorSet 0 - Decorate 68(@entryPointOutput) Location 0 + Name 9 "FxaaTex" + MemberName 9(FxaaTex) 0 "smpl" + MemberName 9(FxaaTex) 1 "tex" + MemberName 9(FxaaTex) 2 "f" + Name 14 "lookUp(struct-FxaaTex-p1-t21-f11;" + Name 13 "tex" + Name 17 "@main(" + Name 42 "tex" + Name 44 "g_tInputTexture_sampler" + Name 47 "g_tInputTexture" + Name 51 "param" + Name 57 "@entryPointOutput" + Decorate 44(g_tInputTexture_sampler) DescriptorSet 0 + Decorate 47(g_tInputTexture) DescriptorSet 0 + Decorate 57(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeSampler - 7: TypePointer Function 6 - 8: TypeFloat 32 - 9: TypeImage 8(float) 2D sampled format:Unknown - 10: TypePointer Function 9 - 11: TypePointer Function 8(float) - 12: TypeVector 8(float) 4 - 13: TypeFunction 12(fvec4) 7(ptr) 10(ptr) 11(ptr) - 19: TypeFunction 12(fvec4) - 24: TypeSampledImage 9 - 28: TypeVector 8(float) 2 - 30: 8(float) Constant 0 - 34(FxaaTex): TypeStruct 6 9 8(float) - 35: TypePointer Function 34(FxaaTex) - 37: TypePointer UniformConstant 6 -38(g_tInputTexture_sampler): 37(ptr) Variable UniformConstant - 40: TypePointer UniformConstant 9 -41(g_tInputTexture): 40(ptr) Variable UniformConstant - 43: 8(float) Constant 1056964608 - 46: TypeInt 32 1 - 47: 46(int) Constant 0 - 51: 46(int) Constant 1 - 55: 46(int) Constant 2 - 67: TypePointer Output 12(fvec4) -68(@entryPointOutput): 67(ptr) Variable Output + 7: TypeFloat 32 + 8: TypeImage 7(float) 2D sampled format:Unknown + 9(FxaaTex): TypeStruct 6 8 7(float) + 10: TypePointer Function 9(FxaaTex) + 11: TypeVector 7(float) 4 + 12: TypeFunction 11(fvec4) 10(ptr) + 16: TypeFunction 11(fvec4) + 19: TypeInt 32 1 + 20: 19(int) Constant 1 + 21: TypePointer Function 8 + 24: 19(int) Constant 0 + 25: TypePointer Function 6 + 28: TypeSampledImage 8 + 30: 19(int) Constant 2 + 31: TypePointer Function 7(float) + 36: TypeVector 7(float) 2 + 38: 7(float) Constant 0 + 43: TypePointer UniformConstant 6 +44(g_tInputTexture_sampler): 43(ptr) Variable UniformConstant + 46: TypePointer UniformConstant 8 +47(g_tInputTexture): 46(ptr) Variable UniformConstant + 49: 7(float) Constant 1056964608 + 56: TypePointer Output 11(fvec4) +57(@entryPointOutput): 56(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 69: 12(fvec4) FunctionCall 20(@main() - Store 68(@entryPointOutput) 69 + 58: 11(fvec4) FunctionCall 17(@main() + Store 57(@entryPointOutput) 58 Return FunctionEnd -17(lookUp(struct-FxaaTex-p1-t21-f11;): 12(fvec4) Function None 13 - 14(tex.smpl): 7(ptr) FunctionParameter - 15(tex.tex): 10(ptr) FunctionParameter - 16(tex.f): 11(ptr) FunctionParameter +14(lookUp(struct-FxaaTex-p1-t21-f11;): 11(fvec4) Function None 12 + 13(tex): 10(ptr) FunctionParameter + 15: Label + 22: 21(ptr) AccessChain 13(tex) 20 + 23: 8 Load 22 + 26: 25(ptr) AccessChain 13(tex) 24 + 27: 6 Load 26 + 29: 28 SampledImage 23 27 + 32: 31(ptr) AccessChain 13(tex) 30 + 33: 7(float) Load 32 + 34: 31(ptr) AccessChain 13(tex) 30 + 35: 7(float) Load 34 + 37: 36(fvec2) CompositeConstruct 33 35 + 39: 11(fvec4) ImageSampleExplicitLod 29 37 Lod 38 + ReturnValue 39 + FunctionEnd + 17(@main(): 11(fvec4) Function None 16 18: Label - 22: 9 Load 15(tex.tex) - 23: 6 Load 14(tex.smpl) - 25: 24 SampledImage 22 23 - 26: 8(float) Load 16(tex.f) - 27: 8(float) Load 16(tex.f) - 29: 28(fvec2) CompositeConstruct 26 27 - 31: 12(fvec4) ImageSampleExplicitLod 25 29 Lod 30 - ReturnValue 31 - FunctionEnd - 20(@main(): 12(fvec4) Function None 19 - 21: Label - 36(flattenTemp): 35(ptr) Variable Function - 45(tex.smpl): 7(ptr) Variable Function - 50(tex.tex): 10(ptr) Variable Function - 54(tex.f): 11(ptr) Variable Function - 58(param): 7(ptr) Variable Function - 60(param): 10(ptr) Variable Function - 62(param): 11(ptr) Variable Function - 39: 6 Load 38(g_tInputTexture_sampler) - 42: 9 Load 41(g_tInputTexture) - 44: 34(FxaaTex) CompositeConstruct 39 42 43 - Store 36(flattenTemp) 44 - 48: 7(ptr) AccessChain 36(flattenTemp) 47 - 49: 6 Load 48 - Store 45(tex.smpl) 49 - 52: 10(ptr) AccessChain 36(flattenTemp) 51 - 53: 9 Load 52 - Store 50(tex.tex) 53 - 56: 11(ptr) AccessChain 36(flattenTemp) 55 - 57: 8(float) Load 56 - Store 54(tex.f) 57 - 59: 6 Load 45(tex.smpl) - Store 58(param) 59 - 61: 9 Load 50(tex.tex) - Store 60(param) 61 - 63: 8(float) Load 54(tex.f) - Store 62(param) 63 - 64: 12(fvec4) FunctionCall 17(lookUp(struct-FxaaTex-p1-t21-f11;) 58(param) 60(param) 62(param) - ReturnValue 64 + 42(tex): 10(ptr) Variable Function + 51(param): 10(ptr) Variable Function + 45: 6 Load 44(g_tInputTexture_sampler) + 48: 8 Load 47(g_tInputTexture) + 50: 9(FxaaTex) CompositeConstruct 45 48 49 + Store 42(tex) 50 + 52: 9(FxaaTex) Load 42(tex) + Store 51(param) 52 + 53: 11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t21-f11;) 51(param) + ReturnValue 53 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out index f6d867fc34a..92e2a9690eb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out @@ -8,32 +8,34 @@ gl_FragCoord origin is upper left 0:30 'vpos' ( in 4-component vector of float) 0:? Sequence 0:33 move second child to first child ( temp sampler) -0:? 's1.s0.ss' ( temp sampler) +0:33 ss: direct index for structure ( temp sampler) +0:33 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss}) +0:33 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:33 Constant: +0:33 2 (const int) +0:33 Constant: +0:33 2 (const int) 0:33 'samp' ( uniform sampler) -0:34 Sequence -0:34 move second child to first child ( temp float) -0:? 's2.resources.b' ( temp float) -0:? 's1.b' ( temp float) -0:34 move second child to first child ( temp sampler) -0:? 's2.resources.samplerState' ( temp sampler) -0:? 's1.samplerState' ( temp sampler) -0:34 move second child to first child ( temp int) -0:? 's2.resources.s0.x' ( temp int) -0:? 's1.s0.x' ( temp int) -0:34 move second child to first child ( temp int) -0:? 's2.resources.s0.y' ( temp int) -0:? 's1.s0.y' ( temp int) -0:34 move second child to first child ( temp sampler) -0:? 's2.resources.s0.ss' ( temp sampler) -0:? 's1.s0.ss' ( temp sampler) -0:34 move second child to first child ( temp int) -0:? 's2.resources.a' ( temp int) -0:? 's1.a' ( temp int) +0:34 move second child to first child ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:34 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:34 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources}) +0:34 Constant: +0:34 5 (const int) +0:34 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) 0:35 Branch: Return with expression 0:35 texture ( temp 4-component vector of float) 0:35 Construct combined texture-sampler ( temp sampler2D) 0:35 'tex' ( uniform texture2D) -0:? 's2.resources.s0.ss' ( temp sampler) +0:35 ss: direct index for structure ( temp sampler) +0:35 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss}) +0:35 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:35 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources}) +0:35 Constant: +0:35 5 (const int) +0:35 Constant: +0:35 2 (const int) +0:35 Constant: +0:35 2 (const int) 0:35 Constant: 0:35 0.500000 0:35 0.500000 @@ -65,32 +67,34 @@ gl_FragCoord origin is upper left 0:30 'vpos' ( in 4-component vector of float) 0:? Sequence 0:33 move second child to first child ( temp sampler) -0:? 's1.s0.ss' ( temp sampler) +0:33 ss: direct index for structure ( temp sampler) +0:33 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss}) +0:33 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:33 Constant: +0:33 2 (const int) +0:33 Constant: +0:33 2 (const int) 0:33 'samp' ( uniform sampler) -0:34 Sequence -0:34 move second child to first child ( temp float) -0:? 's2.resources.b' ( temp float) -0:? 's1.b' ( temp float) -0:34 move second child to first child ( temp sampler) -0:? 's2.resources.samplerState' ( temp sampler) -0:? 's1.samplerState' ( temp sampler) -0:34 move second child to first child ( temp int) -0:? 's2.resources.s0.x' ( temp int) -0:? 's1.s0.x' ( temp int) -0:34 move second child to first child ( temp int) -0:? 's2.resources.s0.y' ( temp int) -0:? 's1.s0.y' ( temp int) -0:34 move second child to first child ( temp sampler) -0:? 's2.resources.s0.ss' ( temp sampler) -0:? 's1.s0.ss' ( temp sampler) -0:34 move second child to first child ( temp int) -0:? 's2.resources.a' ( temp int) -0:? 's1.a' ( temp int) +0:34 move second child to first child ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:34 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:34 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources}) +0:34 Constant: +0:34 5 (const int) +0:34 's1' ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) 0:35 Branch: Return with expression 0:35 texture ( temp 4-component vector of float) 0:35 Construct combined texture-sampler ( temp sampler2D) 0:35 'tex' ( uniform texture2D) -0:? 's2.resources.s0.ss' ( temp sampler) +0:35 ss: direct index for structure ( temp sampler) +0:35 s0: direct index for structure ( temp structure{ temp int x, temp int y, temp sampler ss}) +0:35 resources: direct index for structure ( temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a}) +0:35 's2' ( temp structure{ temp int a1, temp int a2, temp int a3, temp int a4, temp int a5, temp structure{ temp float b, temp sampler samplerState, temp structure{ temp int x, temp int y, temp sampler ss} s0, temp int a} resources}) +0:35 Constant: +0:35 5 (const int) +0:35 Constant: +0:35 2 (const int) +0:35 Constant: +0:35 2 (const int) 0:35 Constant: 0:35 0.500000 0:35 0.500000 @@ -111,40 +115,46 @@ gl_FragCoord origin is upper left 0:? 'vpos' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 61 +// Generated by (magic number): 80007 +// Id's are bound by 54 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 54 57 + EntryPoint Fragment 4 "main" 47 50 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" Name 11 "@main(vf4;" Name 10 "vpos" - Name 15 "s1.s0.ss" - Name 17 "samp" - Name 20 "s2.resources.b" - Name 21 "s1.b" - Name 23 "s2.resources.samplerState" - Name 24 "s1.samplerState" - Name 28 "s2.resources.s0.x" - Name 29 "s1.s0.x" - Name 31 "s2.resources.s0.y" - Name 32 "s1.s0.y" - Name 34 "s2.resources.s0.ss" - Name 36 "s2.resources.a" - Name 37 "s1.a" - Name 41 "tex" - Name 52 "vpos" - Name 54 "vpos" - Name 57 "@entryPointOutput" - Name 58 "param" - Decorate 17(samp) DescriptorSet 0 - Decorate 41(tex) DescriptorSet 0 - Decorate 54(vpos) Location 0 - Decorate 57(@entryPointOutput) Location 0 + Name 15 "S0" + MemberName 15(S0) 0 "x" + MemberName 15(S0) 1 "y" + MemberName 15(S0) 2 "ss" + Name 16 "S1" + MemberName 16(S1) 0 "b" + MemberName 16(S1) 1 "samplerState" + MemberName 16(S1) 2 "s0" + MemberName 16(S1) 3 "a" + Name 18 "s1" + Name 21 "samp" + Name 25 "S2" + MemberName 25(S2) 0 "a1" + MemberName 25(S2) 1 "a2" + MemberName 25(S2) 2 "a3" + MemberName 25(S2) 3 "a4" + MemberName 25(S2) 4 "a5" + MemberName 25(S2) 5 "resources" + Name 27 "s2" + Name 33 "tex" + Name 45 "vpos" + Name 47 "vpos" + Name 50 "@entryPointOutput" + Name 51 "param" + Decorate 21(samp) DescriptorSet 0 + Decorate 33(tex) DescriptorSet 0 + Decorate 47(vpos) Location 0 + Decorate 50(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -152,67 +162,55 @@ gl_FragCoord origin is upper left 8: TypePointer Function 7(fvec4) 9: TypeFunction 7(fvec4) 8(ptr) 13: TypeSampler - 14: TypePointer Function 13 - 16: TypePointer UniformConstant 13 - 17(samp): 16(ptr) Variable UniformConstant - 19: TypePointer Function 6(float) - 26: TypeInt 32 1 - 27: TypePointer Function 26(int) - 39: TypeImage 6(float) 2D sampled format:Unknown - 40: TypePointer UniformConstant 39 - 41(tex): 40(ptr) Variable UniformConstant - 44: TypeSampledImage 39 - 46: TypeVector 6(float) 2 - 47: 6(float) Constant 1056964608 - 48: 46(fvec2) ConstantComposite 47 47 - 53: TypePointer Input 7(fvec4) - 54(vpos): 53(ptr) Variable Input - 56: TypePointer Output 7(fvec4) -57(@entryPointOutput): 56(ptr) Variable Output + 14: TypeInt 32 1 + 15(S0): TypeStruct 14(int) 14(int) 13 + 16(S1): TypeStruct 6(float) 13 15(S0) 14(int) + 17: TypePointer Function 16(S1) + 19: 14(int) Constant 2 + 20: TypePointer UniformConstant 13 + 21(samp): 20(ptr) Variable UniformConstant + 23: TypePointer Function 13 + 25(S2): TypeStruct 14(int) 14(int) 14(int) 14(int) 14(int) 16(S1) + 26: TypePointer Function 25(S2) + 28: 14(int) Constant 5 + 31: TypeImage 6(float) 2D sampled format:Unknown + 32: TypePointer UniformConstant 31 + 33(tex): 32(ptr) Variable UniformConstant + 37: TypeSampledImage 31 + 39: TypeVector 6(float) 2 + 40: 6(float) Constant 1056964608 + 41: 39(fvec2) ConstantComposite 40 40 + 46: TypePointer Input 7(fvec4) + 47(vpos): 46(ptr) Variable Input + 49: TypePointer Output 7(fvec4) +50(@entryPointOutput): 49(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 52(vpos): 8(ptr) Variable Function - 58(param): 8(ptr) Variable Function - 55: 7(fvec4) Load 54(vpos) - Store 52(vpos) 55 - 59: 7(fvec4) Load 52(vpos) - Store 58(param) 59 - 60: 7(fvec4) FunctionCall 11(@main(vf4;) 58(param) - Store 57(@entryPointOutput) 60 + 45(vpos): 8(ptr) Variable Function + 51(param): 8(ptr) Variable Function + 48: 7(fvec4) Load 47(vpos) + Store 45(vpos) 48 + 52: 7(fvec4) Load 45(vpos) + Store 51(param) 52 + 53: 7(fvec4) FunctionCall 11(@main(vf4;) 51(param) + Store 50(@entryPointOutput) 53 Return FunctionEnd 11(@main(vf4;): 7(fvec4) Function None 9 10(vpos): 8(ptr) FunctionParameter 12: Label - 15(s1.s0.ss): 14(ptr) Variable Function -20(s2.resources.b): 19(ptr) Variable Function - 21(s1.b): 19(ptr) Variable Function -23(s2.resources.samplerState): 14(ptr) Variable Function -24(s1.samplerState): 14(ptr) Variable Function -28(s2.resources.s0.x): 27(ptr) Variable Function - 29(s1.s0.x): 27(ptr) Variable Function -31(s2.resources.s0.y): 27(ptr) Variable Function - 32(s1.s0.y): 27(ptr) Variable Function -34(s2.resources.s0.ss): 14(ptr) Variable Function -36(s2.resources.a): 27(ptr) Variable Function - 37(s1.a): 27(ptr) Variable Function - 18: 13 Load 17(samp) - Store 15(s1.s0.ss) 18 - 22: 6(float) Load 21(s1.b) - Store 20(s2.resources.b) 22 - 25: 13 Load 24(s1.samplerState) - Store 23(s2.resources.samplerState) 25 - 30: 26(int) Load 29(s1.s0.x) - Store 28(s2.resources.s0.x) 30 - 33: 26(int) Load 32(s1.s0.y) - Store 31(s2.resources.s0.y) 33 - 35: 13 Load 15(s1.s0.ss) - Store 34(s2.resources.s0.ss) 35 - 38: 26(int) Load 37(s1.a) - Store 36(s2.resources.a) 38 - 42: 39 Load 41(tex) - 43: 13 Load 34(s2.resources.s0.ss) - 45: 44 SampledImage 42 43 - 49: 7(fvec4) ImageSampleImplicitLod 45 48 - ReturnValue 49 + 18(s1): 17(ptr) Variable Function + 27(s2): 26(ptr) Variable Function + 22: 13 Load 21(samp) + 24: 23(ptr) AccessChain 18(s1) 19 19 + Store 24 22 + 29: 16(S1) Load 18(s1) + 30: 17(ptr) AccessChain 27(s2) 28 + Store 30 29 + 34: 31 Load 33(tex) + 35: 23(ptr) AccessChain 27(s2) 28 19 19 + 36: 13 Load 35 + 38: 37 SampledImage 34 36 + 42: 7(fvec4) ImageSampleImplicitLod 38 41 + ReturnValue 42 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out index 4983834d6e4..b22734a8cdb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out @@ -7,33 +7,48 @@ gl_FragCoord origin is upper left 0:8 Function Parameters: 0:8 'vpos' ( in 4-component vector of float) 0:? Sequence -0:13 Sequence -0:13 move second child to first child ( temp float) -0:? 'a1.n.y' ( temp float) -0:? 'a2.n.y' ( temp float) -0:13 move second child to first child ( temp texture2D) -0:? 'a1.n.texNested' ( temp texture2D) -0:? 'a2.n.texNested' ( temp texture2D) -0:14 Sequence -0:14 move second child to first child ( temp float) -0:? 'b.n.y' ( temp float) -0:? 'a1.n.y' ( temp float) -0:14 move second child to first child ( temp texture2D) -0:? 'b.n.texNested' ( temp texture2D) -0:? 'a1.n.texNested' ( temp texture2D) +0:13 move second child to first child ( temp structure{ temp float y, temp texture2D texNested}) +0:13 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:13 'a1' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:13 Constant: +0:13 0 (const int) +0:13 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:13 'a2' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:13 Constant: +0:13 0 (const int) +0:14 move second child to first child ( temp structure{ temp float y, temp texture2D texNested}) +0:14 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:14 'b' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp texture2D tex}) +0:14 Constant: +0:14 0 (const int) +0:14 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:14 'a1' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:14 Constant: +0:14 0 (const int) 0:17 Sequence -0:17 Sequence -0:17 move second child to first child ( temp float) -0:? 'n.y' ( temp float) -0:? 'b.n.y' ( temp float) -0:17 move second child to first child ( temp texture2D) -0:? 'n.texNested' ( temp texture2D) -0:? 'b.n.texNested' ( temp texture2D) +0:17 move second child to first child ( temp structure{ temp float y, temp texture2D texNested}) +0:17 'n' ( temp structure{ temp float y, temp texture2D texNested}) +0:17 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:17 'b' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp texture2D tex}) +0:17 Constant: +0:17 0 (const int) 0:20 move second child to first child ( temp texture2D) -0:? 'a2.n.texNested' ( temp texture2D) +0:20 texNested: direct index for structure ( temp texture2D) +0:20 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:20 'a2' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) 0:20 'someTex' ( uniform texture2D) 0:21 move second child to first child ( temp float) -0:? 'a1.n.y' ( temp float) +0:21 y: direct index for structure ( temp float) +0:21 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:21 'a1' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 0 (const int) 0:21 Constant: 0:21 1.000000 0:23 Branch: Return with expression @@ -68,33 +83,48 @@ gl_FragCoord origin is upper left 0:8 Function Parameters: 0:8 'vpos' ( in 4-component vector of float) 0:? Sequence -0:13 Sequence -0:13 move second child to first child ( temp float) -0:? 'a1.n.y' ( temp float) -0:? 'a2.n.y' ( temp float) -0:13 move second child to first child ( temp texture2D) -0:? 'a1.n.texNested' ( temp texture2D) -0:? 'a2.n.texNested' ( temp texture2D) -0:14 Sequence -0:14 move second child to first child ( temp float) -0:? 'b.n.y' ( temp float) -0:? 'a1.n.y' ( temp float) -0:14 move second child to first child ( temp texture2D) -0:? 'b.n.texNested' ( temp texture2D) -0:? 'a1.n.texNested' ( temp texture2D) +0:13 move second child to first child ( temp structure{ temp float y, temp texture2D texNested}) +0:13 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:13 'a1' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:13 Constant: +0:13 0 (const int) +0:13 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:13 'a2' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:13 Constant: +0:13 0 (const int) +0:14 move second child to first child ( temp structure{ temp float y, temp texture2D texNested}) +0:14 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:14 'b' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp texture2D tex}) +0:14 Constant: +0:14 0 (const int) +0:14 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:14 'a1' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:14 Constant: +0:14 0 (const int) 0:17 Sequence -0:17 Sequence -0:17 move second child to first child ( temp float) -0:? 'n.y' ( temp float) -0:? 'b.n.y' ( temp float) -0:17 move second child to first child ( temp texture2D) -0:? 'n.texNested' ( temp texture2D) -0:? 'b.n.texNested' ( temp texture2D) +0:17 move second child to first child ( temp structure{ temp float y, temp texture2D texNested}) +0:17 'n' ( temp structure{ temp float y, temp texture2D texNested}) +0:17 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:17 'b' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp texture2D tex}) +0:17 Constant: +0:17 0 (const int) 0:20 move second child to first child ( temp texture2D) -0:? 'a2.n.texNested' ( temp texture2D) +0:20 texNested: direct index for structure ( temp texture2D) +0:20 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:20 'a2' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) 0:20 'someTex' ( uniform texture2D) 0:21 move second child to first child ( temp float) -0:? 'a1.n.y' ( temp float) +0:21 y: direct index for structure ( temp float) +0:21 n: direct index for structure ( temp structure{ temp float y, temp texture2D texNested}) +0:21 'a1' ( temp structure{ temp structure{ temp float y, temp texture2D texNested} n, temp float x}) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 0 (const int) 0:21 Constant: 0:21 1.000000 0:23 Branch: Return with expression @@ -119,89 +149,100 @@ gl_FragCoord origin is upper left 0:? 'vpos' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 47 +// Generated by (magic number): 80007 +// Id's are bound by 56 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 40 43 + EntryPoint Fragment 4 "main" 49 52 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" Name 11 "@main(vf4;" Name 10 "vpos" - Name 14 "a1.n.y" - Name 15 "a2.n.y" - Name 19 "a1.n.texNested" - Name 20 "a2.n.texNested" - Name 22 "b.n.y" - Name 24 "b.n.texNested" - Name 26 "n.y" - Name 28 "n.texNested" - Name 31 "someTex" - Name 38 "vpos" - Name 40 "vpos" - Name 43 "@entryPointOutput" - Name 44 "param" - Decorate 31(someTex) DescriptorSet 0 - Decorate 40(vpos) Location 0 - Decorate 43(@entryPointOutput) Location 0 + Name 14 "Nested" + MemberName 14(Nested) 0 "y" + MemberName 14(Nested) 1 "texNested" + Name 15 "A" + MemberName 15(A) 0 "n" + MemberName 15(A) 1 "x" + Name 17 "a1" + Name 20 "a2" + Name 25 "B" + MemberName 25(B) 0 "n" + MemberName 25(B) 1 "tex" + Name 27 "b" + Name 31 "n" + Name 36 "someTex" + Name 47 "vpos" + Name 49 "vpos" + Name 52 "@entryPointOutput" + Name 53 "param" + Decorate 36(someTex) DescriptorSet 0 + Decorate 49(vpos) Location 0 + Decorate 52(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypePointer Function 7(fvec4) 9: TypeFunction 7(fvec4) 8(ptr) - 13: TypePointer Function 6(float) - 17: TypeImage 6(float) 2D sampled format:Unknown - 18: TypePointer Function 17 - 30: TypePointer UniformConstant 17 - 31(someTex): 30(ptr) Variable UniformConstant - 33: 6(float) Constant 1065353216 - 34: 6(float) Constant 0 - 35: 7(fvec4) ConstantComposite 34 34 34 34 - 39: TypePointer Input 7(fvec4) - 40(vpos): 39(ptr) Variable Input - 42: TypePointer Output 7(fvec4) -43(@entryPointOutput): 42(ptr) Variable Output + 13: TypeImage 6(float) 2D sampled format:Unknown + 14(Nested): TypeStruct 6(float) 13 + 15(A): TypeStruct 14(Nested) 6(float) + 16: TypePointer Function 15(A) + 18: TypeInt 32 1 + 19: 18(int) Constant 0 + 21: TypePointer Function 14(Nested) + 25(B): TypeStruct 14(Nested) 13 + 26: TypePointer Function 25(B) + 34: 18(int) Constant 1 + 35: TypePointer UniformConstant 13 + 36(someTex): 35(ptr) Variable UniformConstant + 38: TypePointer Function 13 + 40: 6(float) Constant 1065353216 + 41: TypePointer Function 6(float) + 43: 6(float) Constant 0 + 44: 7(fvec4) ConstantComposite 43 43 43 43 + 48: TypePointer Input 7(fvec4) + 49(vpos): 48(ptr) Variable Input + 51: TypePointer Output 7(fvec4) +52(@entryPointOutput): 51(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 38(vpos): 8(ptr) Variable Function - 44(param): 8(ptr) Variable Function - 41: 7(fvec4) Load 40(vpos) - Store 38(vpos) 41 - 45: 7(fvec4) Load 38(vpos) - Store 44(param) 45 - 46: 7(fvec4) FunctionCall 11(@main(vf4;) 44(param) - Store 43(@entryPointOutput) 46 + 47(vpos): 8(ptr) Variable Function + 53(param): 8(ptr) Variable Function + 50: 7(fvec4) Load 49(vpos) + Store 47(vpos) 50 + 54: 7(fvec4) Load 47(vpos) + Store 53(param) 54 + 55: 7(fvec4) FunctionCall 11(@main(vf4;) 53(param) + Store 52(@entryPointOutput) 55 Return FunctionEnd 11(@main(vf4;): 7(fvec4) Function None 9 10(vpos): 8(ptr) FunctionParameter 12: Label - 14(a1.n.y): 13(ptr) Variable Function - 15(a2.n.y): 13(ptr) Variable Function -19(a1.n.texNested): 18(ptr) Variable Function -20(a2.n.texNested): 18(ptr) Variable Function - 22(b.n.y): 13(ptr) Variable Function -24(b.n.texNested): 18(ptr) Variable Function - 26(n.y): 13(ptr) Variable Function - 28(n.texNested): 18(ptr) Variable Function - 16: 6(float) Load 15(a2.n.y) - Store 14(a1.n.y) 16 - 21: 17 Load 20(a2.n.texNested) - Store 19(a1.n.texNested) 21 - 23: 6(float) Load 14(a1.n.y) - Store 22(b.n.y) 23 - 25: 17 Load 19(a1.n.texNested) - Store 24(b.n.texNested) 25 - 27: 6(float) Load 22(b.n.y) - Store 26(n.y) 27 - 29: 17 Load 24(b.n.texNested) - Store 28(n.texNested) 29 - 32: 17 Load 31(someTex) - Store 20(a2.n.texNested) 32 - Store 14(a1.n.y) 33 - ReturnValue 35 + 17(a1): 16(ptr) Variable Function + 20(a2): 16(ptr) Variable Function + 27(b): 26(ptr) Variable Function + 31(n): 21(ptr) Variable Function + 22: 21(ptr) AccessChain 20(a2) 19 + 23: 14(Nested) Load 22 + 24: 21(ptr) AccessChain 17(a1) 19 + Store 24 23 + 28: 21(ptr) AccessChain 17(a1) 19 + 29: 14(Nested) Load 28 + 30: 21(ptr) AccessChain 27(b) 19 + Store 30 29 + 32: 21(ptr) AccessChain 27(b) 19 + 33: 14(Nested) Load 32 + Store 31(n) 33 + 37: 13 Load 36(someTex) + 39: 38(ptr) AccessChain 20(a2) 19 34 + Store 39 37 + 42: 41(ptr) AccessChain 17(a1) 19 19 + Store 42 40 + ReturnValue 44 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float1.frag.out index ed2b6c99e9c..49827dcf8d9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float1.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float1.frag.out @@ -65,7 +65,7 @@ gl_FragCoord origin is upper left 0:? 'scalar' ( global float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader @@ -102,10 +102,10 @@ gl_FragCoord origin is upper left 12: Label 18: 6(float) Load 14(f1) 19: 6(float) Load 16(scalar) - 20: 6(float) IMul 18 19 + 20: 6(float) FMul 18 19 21: 6(float) Load 9(inFloat1) 22: 6(float) Load 10(inScalar) - 23: 6(float) IMul 21 22 + 23: 6(float) FMul 21 22 24: 6(float) FAdd 20 23 ReturnValue 24 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float4.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float4.frag.out index 84213ce2c7c..cd741ed0c28 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float4.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.float4.frag.out @@ -42,7 +42,7 @@ gl_FragCoord origin is upper left 0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float AmbientColor, uniform bool ff1, layout( offset=20) uniform float ff2, layout( binding=0 offset=32) uniform 4-component vector of float ff3, layout( binding=1 offset=48) uniform 4-component vector of float ff4}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 26 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.forLoop.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.forLoop.frag.out index c9efc338466..3e835f80d4d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.forLoop.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.forLoop.frag.out @@ -17,7 +17,7 @@ gl_FragCoord origin is upper left 0:4 No loop condition 0:4 No loop body 0:? Sequence -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 any ( temp bool) 0:5 NotEqual ( temp 4-component vector of bool) @@ -220,7 +220,7 @@ gl_FragCoord origin is upper left 0:4 No loop condition 0:4 No loop body 0:? Sequence -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 any ( temp bool) 0:5 NotEqual ( temp 4-component vector of bool) @@ -402,7 +402,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 183 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.fraggeom.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.fraggeom.frag.out index a010b6eb036..af3564d1964 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.fraggeom.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.fraggeom.frag.out @@ -64,7 +64,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 25 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out index c2e25ceab0f..be4606a2b25 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gather.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -133,6 +134,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -260,7 +262,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 124 Capability Shader @@ -270,6 +272,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 107 111 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out index a41c03a8b9e..8182ddebbf7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gather.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:29 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:29 Function Parameters: @@ -131,6 +132,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:29 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:29 Function Parameters: @@ -256,7 +258,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 135 Capability Shader @@ -265,6 +267,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 108 112 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out index 432da7b41a7..fe5611495b2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.basic.dx10.vert.out @@ -220,7 +220,7 @@ Shader version: 500 0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 126 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out index 77410b03412..ae816ddd82f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gather.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -106,6 +107,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -206,7 +208,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 114 Capability Shader @@ -215,6 +217,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 79 83 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out index a6e50ff9c18..88052321376 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gather.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gather.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -103,6 +104,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -200,7 +202,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 97 Capability Shader @@ -209,6 +211,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 80 84 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out index 2191553283c..35b0a003c8c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gatherRGBA.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -377,6 +378,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -748,7 +750,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 255 Capability Shader @@ -758,6 +760,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 238 242 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out index 6dbdfaa4109..d0be6d5a2b8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gatherRGBA.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:34 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:34 Function Parameters: @@ -381,6 +382,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:34 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:34 Function Parameters: @@ -756,7 +758,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 265 Capability Shader @@ -765,6 +767,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 238 242 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out index ddbe283179b..33c9af43e44 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gatherRGBA.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:39 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:39 Function Parameters: @@ -633,6 +634,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:39 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:39 Function Parameters: @@ -1259,8 +1261,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image Operand ConstOffsets to be a const object + %90 = OpImageGather %v4float %76 %78 %int_0 ConstOffsets %89 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 399 Capability Shader @@ -1270,6 +1276,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 363 367 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out index 360f75c1ba4..22b02e7f4a7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gatherRGBA.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gatherRGBA.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:33 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:33 Function Parameters: @@ -629,6 +630,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:33 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:33 Function Parameters: @@ -1251,8 +1253,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image Operand ConstOffsets to be a const object + %90 = OpImageGather %v4float %76 %78 %int_0 ConstOffsets %89 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 389 Capability Shader @@ -1263,6 +1269,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 363 367 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out index 7bfed636c36..fe99df52073 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.gathercmpRGBA.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -230,6 +231,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -454,15 +456,17 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 164 Capability Shader + Capability ImageGatherExtended Capability Sampled1D 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 129 133 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out index 2fdf4f17b56..599c65912d0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.getdimensions.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:46 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:46 Function Parameters: @@ -1161,6 +1162,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:46 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:46 Function Parameters: @@ -2316,7 +2318,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 550 Capability Shader @@ -2327,6 +2329,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 540 544 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out index 8c940fe7cc7..cccdfeb247a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.dx10.vert.out @@ -116,7 +116,7 @@ Shader version: 500 0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 48 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out index b3d3ce0ddb5..0b9a674099f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getdimensions.rw.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.getdimensions.rw.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:44 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:44 Function Parameters: @@ -361,6 +362,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:44 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:44 Function Parameters: @@ -716,7 +718,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 232 Capability Shader @@ -727,6 +729,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 216 220 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out index 22d601d382a..51bd0769377 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.getsampleposition.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:13 Function Definition: @main(i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:13 Function Parameters: @@ -14,7 +15,7 @@ gl_FragCoord origin is upper left 0:16 '@sampleCount' ( temp uint) 0:16 imageQuerySamples ( temp uint) 0:16 'g_tTex2dmsf4' ( uniform texture2DMS) -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -29,7 +30,7 @@ gl_FragCoord origin is upper left 0:? -0.250000 0:16 'sample' ( in int) 0:16 false case -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -48,7 +49,7 @@ gl_FragCoord origin is upper left 0:? 0.375000 0:16 'sample' ( in int) 0:16 false case -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -75,7 +76,7 @@ gl_FragCoord origin is upper left 0:? -0.437500 0:16 'sample' ( in int) 0:16 false case -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -129,7 +130,7 @@ gl_FragCoord origin is upper left 0:17 '@sampleCount' ( temp uint) 0:17 imageQuerySamples ( temp uint) 0:17 'g_tTex2dmsf4a' ( uniform texture2DMSArray) -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -144,7 +145,7 @@ gl_FragCoord origin is upper left 0:? -0.250000 0:17 'sample' ( in int) 0:17 false case -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -163,7 +164,7 @@ gl_FragCoord origin is upper left 0:? 0.375000 0:17 'sample' ( in int) 0:17 false case -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -190,7 +191,7 @@ gl_FragCoord origin is upper left 0:? -0.437500 0:17 'sample' ( in int) 0:17 false case -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -292,6 +293,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:13 Function Definition: @main(i1; ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:13 Function Parameters: @@ -305,7 +307,7 @@ gl_FragCoord origin is upper left 0:16 '@sampleCount' ( temp uint) 0:16 imageQuerySamples ( temp uint) 0:16 'g_tTex2dmsf4' ( uniform texture2DMS) -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -320,7 +322,7 @@ gl_FragCoord origin is upper left 0:? -0.250000 0:16 'sample' ( in int) 0:16 false case -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -339,7 +341,7 @@ gl_FragCoord origin is upper left 0:? 0.375000 0:16 'sample' ( in int) 0:16 false case -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -366,7 +368,7 @@ gl_FragCoord origin is upper left 0:? -0.437500 0:16 'sample' ( in int) 0:16 false case -0:16 Test condition and select ( temp 2-component vector of float) +0:16 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:16 Condition 0:16 Compare Equal ( temp bool) 0:16 '@sampleCount' ( temp uint) @@ -420,7 +422,7 @@ gl_FragCoord origin is upper left 0:17 '@sampleCount' ( temp uint) 0:17 imageQuerySamples ( temp uint) 0:17 'g_tTex2dmsf4a' ( uniform texture2DMSArray) -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -435,7 +437,7 @@ gl_FragCoord origin is upper left 0:? -0.250000 0:17 'sample' ( in int) 0:17 false case -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -454,7 +456,7 @@ gl_FragCoord origin is upper left 0:? 0.375000 0:17 'sample' ( in int) 0:17 false case -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -481,7 +483,7 @@ gl_FragCoord origin is upper left 0:? -0.437500 0:17 'sample' ( in int) 0:17 false case -0:17 Test condition and select ( temp 2-component vector of float) +0:17 Test condition and select ( temp 2-component vector of float): no shortcircuit 0:17 Condition 0:17 Compare Equal ( temp bool) 0:17 '@sampleCount' ( temp uint) @@ -578,15 +580,16 @@ gl_FragCoord origin is upper left 0:? 'sample' (layout( location=0) flat in int) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 221 +// Generated by (magic number): 80007 +// Id's are bound by 198 Capability Shader Capability ImageQuery 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 204 211 215 + EntryPoint Fragment 4 "main" 181 188 192 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 10 "PS_OUTPUT" @@ -597,33 +600,33 @@ gl_FragCoord origin is upper left Name 17 "r00" Name 20 "@sampleCount" Name 23 "g_tTex2dmsf4" - Name 42 "indexable" - Name 65 "indexable" - Name 96 "indexable" - Name 129 "indexable" - Name 138 "r01" - Name 139 "@sampleCount" - Name 142 "g_tTex2dmsf4a" - Name 151 "indexable" - Name 161 "indexable" - Name 171 "indexable" - Name 181 "indexable" - Name 190 "psout" - Name 202 "sample" - Name 204 "sample" - Name 206 "flattenTemp" - Name 207 "param" - Name 211 "@entryPointOutput.Color" - Name 215 "@entryPointOutput.Depth" - Name 220 "g_sSamp" + Name 39 "indexable" + Name 58 "indexable" + Name 85 "indexable" + Name 114 "indexable" + Name 127 "r01" + Name 128 "@sampleCount" + Name 131 "g_tTex2dmsf4a" + Name 137 "indexable" + Name 143 "indexable" + Name 149 "indexable" + Name 155 "indexable" + Name 167 "psout" + Name 179 "sample" + Name 181 "sample" + Name 183 "flattenTemp" + Name 184 "param" + Name 188 "@entryPointOutput.Color" + Name 192 "@entryPointOutput.Depth" + Name 197 "g_sSamp" Decorate 23(g_tTex2dmsf4) DescriptorSet 0 - Decorate 142(g_tTex2dmsf4a) DescriptorSet 0 - Decorate 204(sample) Flat - Decorate 204(sample) Location 0 - Decorate 211(@entryPointOutput.Color) Location 0 - Decorate 215(@entryPointOutput.Depth) BuiltIn FragDepth - Decorate 220(g_sSamp) DescriptorSet 0 - Decorate 220(g_sSamp) Binding 0 + Decorate 131(g_tTex2dmsf4a) DescriptorSet 0 + Decorate 181(sample) Flat + Decorate 181(sample) Location 0 + Decorate 188(@entryPointOutput.Color) Location 0 + Decorate 192(@entryPointOutput.Depth) BuiltIn FragDepth + Decorate 197(g_sSamp) DescriptorSet 0 + Decorate 197(g_sSamp) Binding 0 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -639,110 +642,111 @@ gl_FragCoord origin is upper left 21: TypeImage 8(float) 2D multi-sampled sampled format:Unknown 22: TypePointer UniformConstant 21 23(g_tTex2dmsf4): 22(ptr) Variable UniformConstant - 28: 6(int) Constant 2 - 29: TypeBool - 33: 18(int) Constant 2 - 34: TypeArray 15(fvec2) 33 - 35: 8(float) Constant 1048576000 - 36: 15(fvec2) ConstantComposite 35 35 - 37: 8(float) Constant 3196059648 - 38: 15(fvec2) ConstantComposite 37 37 - 39: 34 ConstantComposite 36 38 - 41: TypePointer Function 34 - 48: 6(int) Constant 4 - 52: 18(int) Constant 4 - 53: TypeArray 15(fvec2) 52 - 54: 8(float) Constant 3187671040 - 55: 8(float) Constant 3200253952 - 56: 15(fvec2) ConstantComposite 54 55 - 57: 8(float) Constant 1052770304 - 58: 15(fvec2) ConstantComposite 57 54 - 59: 8(float) Constant 1040187392 - 60: 15(fvec2) ConstantComposite 55 59 - 61: 15(fvec2) ConstantComposite 59 57 - 62: 53 ConstantComposite 56 58 60 61 - 64: TypePointer Function 53 - 71: 6(int) Constant 8 - 75: 18(int) Constant 8 - 76: TypeArray 15(fvec2) 75 - 77: 8(float) Constant 1031798784 - 78: 8(float) Constant 3191865344 - 79: 15(fvec2) ConstantComposite 77 78 - 80: 8(float) Constant 3179282432 - 81: 8(float) Constant 1044381696 - 82: 15(fvec2) ConstantComposite 80 81 - 83: 8(float) Constant 1050673152 - 84: 15(fvec2) ConstantComposite 83 77 - 85: 8(float) Constant 3198156800 - 86: 15(fvec2) ConstantComposite 78 85 - 87: 15(fvec2) ConstantComposite 85 83 - 88: 8(float) Constant 3202351104 - 89: 15(fvec2) ConstantComposite 88 80 - 90: 8(float) Constant 1054867456 - 91: 15(fvec2) ConstantComposite 81 90 - 92: 15(fvec2) ConstantComposite 90 88 - 93: 76 ConstantComposite 79 82 84 86 87 89 91 92 - 95: TypePointer Function 76 - 102: 6(int) Constant 16 - 106: 18(int) Constant 16 - 107: TypeArray 15(fvec2) 106 - 108: 15(fvec2) ConstantComposite 77 77 - 109: 15(fvec2) ConstantComposite 80 78 - 110: 15(fvec2) ConstantComposite 78 59 - 111: 15(fvec2) ConstantComposite 35 80 - 112: 15(fvec2) ConstantComposite 85 54 - 113: 15(fvec2) ConstantComposite 59 83 - 114: 15(fvec2) ConstantComposite 83 81 - 115: 15(fvec2) ConstantComposite 81 85 - 116: 15(fvec2) ConstantComposite 54 57 - 117: 8(float) Constant 0 - 118: 15(fvec2) ConstantComposite 117 88 - 119: 15(fvec2) ConstantComposite 37 55 - 120: 15(fvec2) ConstantComposite 55 35 - 121: 8(float) Constant 3204448256 - 122: 15(fvec2) ConstantComposite 121 117 - 123: 15(fvec2) ConstantComposite 90 37 - 124: 15(fvec2) ConstantComposite 57 90 - 125: 15(fvec2) ConstantComposite 88 121 - 126: 107 ConstantComposite 108 109 110 111 112 113 114 115 116 118 119 120 122 123 124 125 - 128: TypePointer Function 107 - 133: 15(fvec2) ConstantComposite 117 117 - 140: TypeImage 8(float) 2D array multi-sampled sampled format:Unknown - 141: TypePointer UniformConstant 140 -142(g_tTex2dmsf4a): 141(ptr) Variable UniformConstant - 189: TypePointer Function 10(PS_OUTPUT) - 191: 6(int) Constant 0 - 192: 8(float) Constant 1065353216 - 193: 9(fvec4) ConstantComposite 192 192 192 192 - 194: TypePointer Function 9(fvec4) - 196: 6(int) Constant 1 - 197: TypePointer Function 8(float) - 203: TypePointer Input 6(int) - 204(sample): 203(ptr) Variable Input - 210: TypePointer Output 9(fvec4) -211(@entryPointOutput.Color): 210(ptr) Variable Output - 214: TypePointer Output 8(float) -215(@entryPointOutput.Depth): 214(ptr) Variable Output - 218: TypeSampler - 219: TypePointer UniformConstant 218 - 220(g_sSamp): 219(ptr) Variable UniformConstant + 27: 6(int) Constant 2 + 28: TypeBool + 30: 18(int) Constant 2 + 31: TypeArray 15(fvec2) 30 + 32: 8(float) Constant 1048576000 + 33: 15(fvec2) ConstantComposite 32 32 + 34: 8(float) Constant 3196059648 + 35: 15(fvec2) ConstantComposite 34 34 + 36: 31 ConstantComposite 33 35 + 38: TypePointer Function 31 + 43: 6(int) Constant 4 + 45: 18(int) Constant 4 + 46: TypeArray 15(fvec2) 45 + 47: 8(float) Constant 3187671040 + 48: 8(float) Constant 3200253952 + 49: 15(fvec2) ConstantComposite 47 48 + 50: 8(float) Constant 1052770304 + 51: 15(fvec2) ConstantComposite 50 47 + 52: 8(float) Constant 1040187392 + 53: 15(fvec2) ConstantComposite 48 52 + 54: 15(fvec2) ConstantComposite 52 50 + 55: 46 ConstantComposite 49 51 53 54 + 57: TypePointer Function 46 + 62: 6(int) Constant 8 + 64: 18(int) Constant 8 + 65: TypeArray 15(fvec2) 64 + 66: 8(float) Constant 1031798784 + 67: 8(float) Constant 3191865344 + 68: 15(fvec2) ConstantComposite 66 67 + 69: 8(float) Constant 3179282432 + 70: 8(float) Constant 1044381696 + 71: 15(fvec2) ConstantComposite 69 70 + 72: 8(float) Constant 1050673152 + 73: 15(fvec2) ConstantComposite 72 66 + 74: 8(float) Constant 3198156800 + 75: 15(fvec2) ConstantComposite 67 74 + 76: 15(fvec2) ConstantComposite 74 72 + 77: 8(float) Constant 3202351104 + 78: 15(fvec2) ConstantComposite 77 69 + 79: 8(float) Constant 1054867456 + 80: 15(fvec2) ConstantComposite 70 79 + 81: 15(fvec2) ConstantComposite 79 77 + 82: 65 ConstantComposite 68 71 73 75 76 78 80 81 + 84: TypePointer Function 65 + 89: 6(int) Constant 16 + 91: 18(int) Constant 16 + 92: TypeArray 15(fvec2) 91 + 93: 15(fvec2) ConstantComposite 66 66 + 94: 15(fvec2) ConstantComposite 69 67 + 95: 15(fvec2) ConstantComposite 67 52 + 96: 15(fvec2) ConstantComposite 32 69 + 97: 15(fvec2) ConstantComposite 74 47 + 98: 15(fvec2) ConstantComposite 52 72 + 99: 15(fvec2) ConstantComposite 72 70 + 100: 15(fvec2) ConstantComposite 70 74 + 101: 15(fvec2) ConstantComposite 47 50 + 102: 8(float) Constant 0 + 103: 15(fvec2) ConstantComposite 102 77 + 104: 15(fvec2) ConstantComposite 34 48 + 105: 15(fvec2) ConstantComposite 48 32 + 106: 8(float) Constant 3204448256 + 107: 15(fvec2) ConstantComposite 106 102 + 108: 15(fvec2) ConstantComposite 79 34 + 109: 15(fvec2) ConstantComposite 50 79 + 110: 15(fvec2) ConstantComposite 77 106 + 111: 92 ConstantComposite 93 94 95 96 97 98 99 100 101 103 104 105 107 108 109 110 + 113: TypePointer Function 92 + 117: 15(fvec2) ConstantComposite 102 102 + 118: TypeVector 28(bool) 2 + 129: TypeImage 8(float) 2D array multi-sampled sampled format:Unknown + 130: TypePointer UniformConstant 129 +131(g_tTex2dmsf4a): 130(ptr) Variable UniformConstant + 166: TypePointer Function 10(PS_OUTPUT) + 168: 6(int) Constant 0 + 169: 8(float) Constant 1065353216 + 170: 9(fvec4) ConstantComposite 169 169 169 169 + 171: TypePointer Function 9(fvec4) + 173: 6(int) Constant 1 + 174: TypePointer Function 8(float) + 180: TypePointer Input 6(int) + 181(sample): 180(ptr) Variable Input + 187: TypePointer Output 9(fvec4) +188(@entryPointOutput.Color): 187(ptr) Variable Output + 191: TypePointer Output 8(float) +192(@entryPointOutput.Depth): 191(ptr) Variable Output + 195: TypeSampler + 196: TypePointer UniformConstant 195 + 197(g_sSamp): 196(ptr) Variable UniformConstant 4(main): 2 Function None 3 5: Label - 202(sample): 7(ptr) Variable Function -206(flattenTemp): 189(ptr) Variable Function - 207(param): 7(ptr) Variable Function - 205: 6(int) Load 204(sample) - Store 202(sample) 205 - 208: 6(int) Load 202(sample) - Store 207(param) 208 - 209:10(PS_OUTPUT) FunctionCall 13(@main(i1;) 207(param) - Store 206(flattenTemp) 209 - 212: 194(ptr) AccessChain 206(flattenTemp) 191 - 213: 9(fvec4) Load 212 - Store 211(@entryPointOutput.Color) 213 - 216: 197(ptr) AccessChain 206(flattenTemp) 196 - 217: 8(float) Load 216 - Store 215(@entryPointOutput.Depth) 217 + 179(sample): 7(ptr) Variable Function +183(flattenTemp): 166(ptr) Variable Function + 184(param): 7(ptr) Variable Function + 182: 6(int) Load 181(sample) + Store 179(sample) 182 + 185: 6(int) Load 179(sample) + Store 184(param) 185 + 186:10(PS_OUTPUT) FunctionCall 13(@main(i1;) 184(param) + Store 183(flattenTemp) 186 + 189: 171(ptr) AccessChain 183(flattenTemp) 168 + 190: 9(fvec4) Load 189 + Store 188(@entryPointOutput.Color) 190 + 193: 174(ptr) AccessChain 183(flattenTemp) 173 + 194: 8(float) Load 193 + Store 192(@entryPointOutput.Depth) 194 Return FunctionEnd 13(@main(i1;):10(PS_OUTPUT) Function None 11 @@ -750,165 +754,93 @@ gl_FragCoord origin is upper left 14: Label 17(r00): 16(ptr) Variable Function 20(@sampleCount): 19(ptr) Variable Function - 26: 16(ptr) Variable Function - 42(indexable): 41(ptr) Variable Function - 46: 16(ptr) Variable Function - 65(indexable): 64(ptr) Variable Function - 69: 16(ptr) Variable Function - 96(indexable): 95(ptr) Variable Function - 100: 16(ptr) Variable Function - 129(indexable): 128(ptr) Variable Function - 138(r01): 16(ptr) Variable Function -139(@sampleCount): 19(ptr) Variable Function - 145: 16(ptr) Variable Function - 151(indexable): 41(ptr) Variable Function - 155: 16(ptr) Variable Function - 161(indexable): 64(ptr) Variable Function - 165: 16(ptr) Variable Function - 171(indexable): 95(ptr) Variable Function - 175: 16(ptr) Variable Function - 181(indexable): 128(ptr) Variable Function - 190(psout): 189(ptr) Variable Function + 39(indexable): 38(ptr) Variable Function + 58(indexable): 57(ptr) Variable Function + 85(indexable): 84(ptr) Variable Function + 114(indexable): 113(ptr) Variable Function + 127(r01): 16(ptr) Variable Function +128(@sampleCount): 19(ptr) Variable Function + 137(indexable): 38(ptr) Variable Function + 143(indexable): 57(ptr) Variable Function + 149(indexable): 84(ptr) Variable Function + 155(indexable): 113(ptr) Variable Function + 167(psout): 166(ptr) Variable Function 24: 21 Load 23(g_tTex2dmsf4) 25: 18(int) ImageQuerySamples 24 Store 20(@sampleCount) 25 - 27: 18(int) Load 20(@sampleCount) - 30: 29(bool) IEqual 27 28 - SelectionMerge 32 None - BranchConditional 30 31 45 - 31: Label - 40: 6(int) Load 12(sample) - Store 42(indexable) 39 - 43: 16(ptr) AccessChain 42(indexable) 40 - 44: 15(fvec2) Load 43 - Store 26 44 - Branch 32 - 45: Label - 47: 18(int) Load 20(@sampleCount) - 49: 29(bool) IEqual 47 48 - SelectionMerge 51 None - BranchConditional 49 50 68 - 50: Label - 63: 6(int) Load 12(sample) - Store 65(indexable) 62 - 66: 16(ptr) AccessChain 65(indexable) 63 - 67: 15(fvec2) Load 66 - Store 46 67 - Branch 51 - 68: Label - 70: 18(int) Load 20(@sampleCount) - 72: 29(bool) IEqual 70 71 - SelectionMerge 74 None - BranchConditional 72 73 99 - 73: Label - 94: 6(int) Load 12(sample) - Store 96(indexable) 93 - 97: 16(ptr) AccessChain 96(indexable) 94 - 98: 15(fvec2) Load 97 - Store 69 98 - Branch 74 - 99: Label - 101: 18(int) Load 20(@sampleCount) - 103: 29(bool) IEqual 101 102 - SelectionMerge 105 None - BranchConditional 103 104 132 - 104: Label - 127: 6(int) Load 12(sample) - Store 129(indexable) 126 - 130: 16(ptr) AccessChain 129(indexable) 127 - 131: 15(fvec2) Load 130 - Store 100 131 - Branch 105 - 132: Label - Store 100 133 - Branch 105 - 105: Label - 134: 15(fvec2) Load 100 - Store 69 134 - Branch 74 - 74: Label - 135: 15(fvec2) Load 69 - Store 46 135 - Branch 51 - 51: Label - 136: 15(fvec2) Load 46 - Store 26 136 - Branch 32 - 32: Label - 137: 15(fvec2) Load 26 - Store 17(r00) 137 - 143: 140 Load 142(g_tTex2dmsf4a) - 144: 18(int) ImageQuerySamples 143 - Store 139(@sampleCount) 144 - 146: 18(int) Load 139(@sampleCount) - 147: 29(bool) IEqual 146 28 - SelectionMerge 149 None - BranchConditional 147 148 154 - 148: Label - 150: 6(int) Load 12(sample) - Store 151(indexable) 39 - 152: 16(ptr) AccessChain 151(indexable) 150 - 153: 15(fvec2) Load 152 - Store 145 153 - Branch 149 - 154: Label - 156: 18(int) Load 139(@sampleCount) - 157: 29(bool) IEqual 156 48 - SelectionMerge 159 None - BranchConditional 157 158 164 - 158: Label - 160: 6(int) Load 12(sample) - Store 161(indexable) 62 - 162: 16(ptr) AccessChain 161(indexable) 160 - 163: 15(fvec2) Load 162 - Store 155 163 - Branch 159 - 164: Label - 166: 18(int) Load 139(@sampleCount) - 167: 29(bool) IEqual 166 71 - SelectionMerge 169 None - BranchConditional 167 168 174 - 168: Label - 170: 6(int) Load 12(sample) - Store 171(indexable) 93 - 172: 16(ptr) AccessChain 171(indexable) 170 - 173: 15(fvec2) Load 172 - Store 165 173 - Branch 169 - 174: Label - 176: 18(int) Load 139(@sampleCount) - 177: 29(bool) IEqual 176 102 - SelectionMerge 179 None - BranchConditional 177 178 184 - 178: Label - 180: 6(int) Load 12(sample) - Store 181(indexable) 126 - 182: 16(ptr) AccessChain 181(indexable) 180 - 183: 15(fvec2) Load 182 - Store 175 183 - Branch 179 - 184: Label - Store 175 133 - Branch 179 - 179: Label - 185: 15(fvec2) Load 175 - Store 165 185 - Branch 169 - 169: Label - 186: 15(fvec2) Load 165 - Store 155 186 - Branch 159 - 159: Label - 187: 15(fvec2) Load 155 - Store 145 187 - Branch 149 - 149: Label - 188: 15(fvec2) Load 145 - Store 138(r01) 188 - 195: 194(ptr) AccessChain 190(psout) 191 - Store 195 193 - 198: 197(ptr) AccessChain 190(psout) 196 - Store 198 192 - 199:10(PS_OUTPUT) Load 190(psout) - ReturnValue 199 + 26: 18(int) Load 20(@sampleCount) + 29: 28(bool) IEqual 26 27 + 37: 6(int) Load 12(sample) + Store 39(indexable) 36 + 40: 16(ptr) AccessChain 39(indexable) 37 + 41: 15(fvec2) Load 40 + 42: 18(int) Load 20(@sampleCount) + 44: 28(bool) IEqual 42 43 + 56: 6(int) Load 12(sample) + Store 58(indexable) 55 + 59: 16(ptr) AccessChain 58(indexable) 56 + 60: 15(fvec2) Load 59 + 61: 18(int) Load 20(@sampleCount) + 63: 28(bool) IEqual 61 62 + 83: 6(int) Load 12(sample) + Store 85(indexable) 82 + 86: 16(ptr) AccessChain 85(indexable) 83 + 87: 15(fvec2) Load 86 + 88: 18(int) Load 20(@sampleCount) + 90: 28(bool) IEqual 88 89 + 112: 6(int) Load 12(sample) + Store 114(indexable) 111 + 115: 16(ptr) AccessChain 114(indexable) 112 + 116: 15(fvec2) Load 115 + 119: 118(bvec2) CompositeConstruct 90 90 + 120: 15(fvec2) Select 119 116 117 + 121: 118(bvec2) CompositeConstruct 63 63 + 122: 15(fvec2) Select 121 87 120 + 123: 118(bvec2) CompositeConstruct 44 44 + 124: 15(fvec2) Select 123 60 122 + 125: 118(bvec2) CompositeConstruct 29 29 + 126: 15(fvec2) Select 125 41 124 + Store 17(r00) 126 + 132: 129 Load 131(g_tTex2dmsf4a) + 133: 18(int) ImageQuerySamples 132 + Store 128(@sampleCount) 133 + 134: 18(int) Load 128(@sampleCount) + 135: 28(bool) IEqual 134 27 + 136: 6(int) Load 12(sample) + Store 137(indexable) 36 + 138: 16(ptr) AccessChain 137(indexable) 136 + 139: 15(fvec2) Load 138 + 140: 18(int) Load 128(@sampleCount) + 141: 28(bool) IEqual 140 43 + 142: 6(int) Load 12(sample) + Store 143(indexable) 55 + 144: 16(ptr) AccessChain 143(indexable) 142 + 145: 15(fvec2) Load 144 + 146: 18(int) Load 128(@sampleCount) + 147: 28(bool) IEqual 146 62 + 148: 6(int) Load 12(sample) + Store 149(indexable) 82 + 150: 16(ptr) AccessChain 149(indexable) 148 + 151: 15(fvec2) Load 150 + 152: 18(int) Load 128(@sampleCount) + 153: 28(bool) IEqual 152 89 + 154: 6(int) Load 12(sample) + Store 155(indexable) 111 + 156: 16(ptr) AccessChain 155(indexable) 154 + 157: 15(fvec2) Load 156 + 158: 118(bvec2) CompositeConstruct 153 153 + 159: 15(fvec2) Select 158 157 117 + 160: 118(bvec2) CompositeConstruct 147 147 + 161: 15(fvec2) Select 160 151 159 + 162: 118(bvec2) CompositeConstruct 141 141 + 163: 15(fvec2) Select 162 145 161 + 164: 118(bvec2) CompositeConstruct 135 135 + 165: 15(fvec2) Select 164 139 163 + Store 127(r01) 165 + 172: 171(ptr) AccessChain 167(psout) 168 + Store 172 170 + 175: 174(ptr) AccessChain 167(psout) 173 + Store 175 169 + 176:10(PS_OUTPUT) Load 167(psout) + ReturnValue 176 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.global-const-init.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.global-const-init.frag.out index c76f54aaa5a..940f3be8519 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.global-const-init.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.global-const-init.frag.out @@ -102,7 +102,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.groupid.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.groupid.comp.out new file mode 100644 index 00000000000..386a3e970d3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.groupid.comp.out @@ -0,0 +1,146 @@ +hlsl.groupid.comp +Shader version: 500 +local_size = (8, 8, 1) +0:? Sequence +0:7 Function Definition: @main(vu2; ( temp void) +0:7 Function Parameters: +0:7 'vGroupId' ( in 2-component vector of uint) +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 'storeTemp' ( temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.000000 +0:? 0.000000 +0:? 1.000000 +0:8 imageStore ( temp void) +0:8 'OutputTexture' (layout( rgba32f) uniform image2D) +0:8 vector swizzle ( temp 2-component vector of uint) +0:8 'vGroupId' ( in 2-component vector of uint) +0:8 Sequence +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 'storeTemp' ( temp 4-component vector of float) +0:8 'storeTemp' ( temp 4-component vector of float) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 move second child to first child ( temp 2-component vector of uint) +0:? 'vGroupId' ( temp 2-component vector of uint) +0:? Construct uvec2 ( temp 2-component vector of uint) +0:? 'vGroupId' ( in 3-component vector of uint WorkGroupID) +0:7 Function Call: @main(vu2; ( temp void) +0:? 'vGroupId' ( temp 2-component vector of uint) +0:? Linker Objects +0:? 'OutputTexture' (layout( rgba32f) uniform image2D) +0:? 'vGroupId' ( in 3-component vector of uint WorkGroupID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (8, 8, 1) +0:? Sequence +0:7 Function Definition: @main(vu2; ( temp void) +0:7 Function Parameters: +0:7 'vGroupId' ( in 2-component vector of uint) +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp 4-component vector of float) +0:8 'storeTemp' ( temp 4-component vector of float) +0:? Constant: +0:? 1.000000 +0:? 0.000000 +0:? 0.000000 +0:? 1.000000 +0:8 imageStore ( temp void) +0:8 'OutputTexture' (layout( rgba32f) uniform image2D) +0:8 vector swizzle ( temp 2-component vector of uint) +0:8 'vGroupId' ( in 2-component vector of uint) +0:8 Sequence +0:8 Constant: +0:8 0 (const int) +0:8 Constant: +0:8 1 (const int) +0:8 'storeTemp' ( temp 4-component vector of float) +0:8 'storeTemp' ( temp 4-component vector of float) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 move second child to first child ( temp 2-component vector of uint) +0:? 'vGroupId' ( temp 2-component vector of uint) +0:? Construct uvec2 ( temp 2-component vector of uint) +0:? 'vGroupId' ( in 3-component vector of uint WorkGroupID) +0:7 Function Call: @main(vu2; ( temp void) +0:? 'vGroupId' ( temp 2-component vector of uint) +0:? Linker Objects +0:? 'OutputTexture' (layout( rgba32f) uniform image2D) +0:? 'vGroupId' ( in 3-component vector of uint WorkGroupID) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 37 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 29 + ExecutionMode 4 LocalSize 8 8 1 + Source HLSL 500 + Name 4 "main" + Name 11 "@main(vu2;" + Name 10 "vGroupId" + Name 16 "storeTemp" + Name 22 "OutputTexture" + Name 26 "vGroupId" + Name 29 "vGroupId" + Name 34 "param" + Decorate 22(OutputTexture) DescriptorSet 0 + Decorate 29(vGroupId) BuiltIn WorkgroupId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8: TypePointer Function 7(ivec2) + 9: TypeFunction 2 8(ptr) + 13: TypeFloat 32 + 14: TypeVector 13(float) 4 + 15: TypePointer Function 14(fvec4) + 17: 13(float) Constant 1065353216 + 18: 13(float) Constant 0 + 19: 14(fvec4) ConstantComposite 17 18 18 17 + 20: TypeImage 13(float) 2D nonsampled format:Rgba32f + 21: TypePointer UniformConstant 20 +22(OutputTexture): 21(ptr) Variable UniformConstant + 27: TypeVector 6(int) 3 + 28: TypePointer Input 27(ivec3) + 29(vGroupId): 28(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 26(vGroupId): 8(ptr) Variable Function + 34(param): 8(ptr) Variable Function + 30: 27(ivec3) Load 29(vGroupId) + 31: 6(int) CompositeExtract 30 0 + 32: 6(int) CompositeExtract 30 1 + 33: 7(ivec2) CompositeConstruct 31 32 + Store 26(vGroupId) 33 + 35: 7(ivec2) Load 26(vGroupId) + Store 34(param) 35 + 36: 2 FunctionCall 11(@main(vu2;) 34(param) + Return + FunctionEnd + 11(@main(vu2;): 2 Function None 9 + 10(vGroupId): 8(ptr) FunctionParameter + 12: Label + 16(storeTemp): 15(ptr) Variable Function + Store 16(storeTemp) 19 + 23: 20 Load 22(OutputTexture) + 24: 7(ivec2) Load 10(vGroupId) + 25: 14(fvec4) Load 16(storeTemp) + ImageWrite 23 24 25 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out index 92153c53ab2..4971371a39f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.gs-hs-mix.tesc.out @@ -798,7 +798,7 @@ triangle order = ccw 0:? '@patchConstantOutput' (layout( location=1) patch out structure{ temp 3-element array of 3-component vector of float NormalWS}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 216 Capability Tessellation @@ -854,8 +854,8 @@ triangle order = ccw Name 105 "@entryPointOutput" Name 107 "param" Name 109 "param" - Name 119 "@patchConstantResult" - Name 120 "param" + Name 120 "@patchConstantResult" + Name 121 "param" Name 126 "@patchConstantOutput.EdgeTessFactor" Name 139 "@patchConstantOutput.InsideTessFactor" Name 143 "HSTrianglePatchConstant" @@ -947,9 +947,9 @@ triangle order = ccw 104: TypePointer Output 103 105(@entryPointOutput): 104(ptr) Variable Output 112: TypePointer Output 21(HSOutput) - 115: TypeBool - 123: 9(int) Constant 4 - 124: TypeArray 6(float) 123 + 114: 9(int) Constant 4 + 116: TypeBool + 124: TypeArray 6(float) 114 125: TypePointer Output 124 126(@patchConstantOutput.EdgeTessFactor): 125(ptr) Variable Output 129: TypePointer Output 6(float) @@ -971,8 +971,8 @@ triangle order = ccw 99(id): 20(ptr) Variable Function 107(param): 12(ptr) Variable Function 109(param): 20(ptr) Variable Function -119(@patchConstantResult): 55(ptr) Variable Function - 120(param): 12(ptr) Variable Function +120(@patchConstantResult): 55(ptr) Variable Function + 121(param): 12(ptr) Variable Function 98: 11 Load 97(patch) Store 95(patch) 98 102: 9(int) Load 101(id) @@ -985,38 +985,38 @@ triangle order = ccw 111:21(HSOutput) FunctionCall 25(@HSMain(struct-HSInput-vf3-vf31[3];u1;) 107(param) 109(param) 113: 112(ptr) AccessChain 105(@entryPointOutput) 106 Store 113 111 - ControlBarrier 68 63 58 - 114: 9(int) Load 101(id) - 116: 115(bool) IEqual 114 57 - SelectionMerge 118 None - BranchConditional 116 117 118 - 117: Label - 121: 11 Load 95(patch) - Store 120(param) 121 - 122:15(HSTrianglePatchConstant) FunctionCall 18(HSPatchConstant(struct-HSInput-vf3-vf31[3];) 120(param) - Store 119(@patchConstantResult) 122 - 127: 50(ptr) AccessChain 119(@patchConstantResult) 57 57 + ControlBarrier 68 114 58 + 115: 9(int) Load 101(id) + 117: 116(bool) IEqual 115 57 + SelectionMerge 119 None + BranchConditional 117 118 119 + 118: Label + 122: 11 Load 95(patch) + Store 121(param) 122 + 123:15(HSTrianglePatchConstant) FunctionCall 18(HSPatchConstant(struct-HSInput-vf3-vf31[3];) 121(param) + Store 120(@patchConstantResult) 123 + 127: 50(ptr) AccessChain 120(@patchConstantResult) 57 57 128: 6(float) Load 127 130: 129(ptr) AccessChain 126(@patchConstantOutput.EdgeTessFactor) 57 Store 130 128 - 131: 50(ptr) AccessChain 119(@patchConstantResult) 57 62 + 131: 50(ptr) AccessChain 120(@patchConstantResult) 57 62 132: 6(float) Load 131 133: 129(ptr) AccessChain 126(@patchConstantOutput.EdgeTessFactor) 62 Store 133 132 - 134: 50(ptr) AccessChain 119(@patchConstantResult) 57 67 + 134: 50(ptr) AccessChain 120(@patchConstantResult) 57 67 135: 6(float) Load 134 136: 129(ptr) AccessChain 126(@patchConstantOutput.EdgeTessFactor) 67 Store 136 135 - 140: 50(ptr) AccessChain 119(@patchConstantResult) 62 + 140: 50(ptr) AccessChain 120(@patchConstantResult) 62 141: 6(float) Load 140 142: 129(ptr) AccessChain 139(@patchConstantOutput.InsideTessFactor) 57 Store 142 141 - 147: 146(ptr) AccessChain 119(@patchConstantResult) 67 + 147: 146(ptr) AccessChain 120(@patchConstantResult) 67 148: 14 Load 147 150: 149(ptr) AccessChain 145(@patchConstantOutput) 57 Store 150 148 - Branch 118 - 118: Label + Branch 119 + 119: Label Return FunctionEnd 18(HSPatchConstant(struct-HSInput-vf3-vf31[3];):15(HSTrianglePatchConstant) Function None 16 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hlslOffset.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hlslOffset.vert.out index 4840e61e603..8393d837b00 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hlslOffset.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hlslOffset.vert.out @@ -26,7 +26,7 @@ Shader version: 500 0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform float m0, layout( row_major std140) uniform 3-component vector of float m4, layout( row_major std140) uniform float m16, layout( row_major std140 offset=20) uniform 3-component vector of float m20, layout( row_major std140 offset=36) uniform 3-component vector of float m36, layout( row_major std140 offset=56) uniform 2-component vector of float m56, layout( row_major std140) uniform float m64, layout( row_major std140) uniform 2-component vector of float m68, layout( row_major std140) uniform float m76, layout( row_major std140) uniform float m80, layout( row_major std140) uniform 1-element array of 2-component vector of float m96}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 18 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.1.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.1.tesc.out index 57020ee1921..1be149872fc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.1.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.1.tesc.out @@ -224,13 +224,13 @@ vertex spacing = equal_spacing 0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 90 +// Generated by (magic number): 80007 +// Id's are bound by 89 Capability Tessellation 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 4 "main" 40 44 48 66 72 + EntryPoint TessellationControl 4 "main" 40 44 48 65 71 ExecutionMode 4 OutputVertices 4 ExecutionMode 4 Isolines ExecutionMode 4 SpacingEqual @@ -255,17 +255,17 @@ vertex spacing = equal_spacing Name 48 "@entryPointOutput" Name 50 "param" Name 52 "param" - Name 65 "@patchConstantResult" - Name 66 "pid" - Name 67 "param" - Name 72 "@patchConstantOutput.edges" - Name 82 "output" + Name 64 "@patchConstantResult" + Name 65 "pid" + Name 66 "param" + Name 71 "@patchConstantOutput.edges" + Name 81 "output" Decorate 40(ip) Location 0 Decorate 44(m_cpid) BuiltIn InvocationId Decorate 48(@entryPointOutput) Location 0 - Decorate 66(pid) BuiltIn PrimitiveId - Decorate 72(@patchConstantOutput.edges) Patch - Decorate 72(@patchConstantOutput.edges) BuiltIn TessLevelOuter + Decorate 65(pid) BuiltIn PrimitiveId + Decorate 71(@patchConstantOutput.edges) Patch + Decorate 71(@patchConstantOutput.edges) BuiltIn TessLevelOuter 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -294,27 +294,26 @@ vertex spacing = equal_spacing 47: TypePointer Output 46 48(@entryPointOutput): 47(ptr) Variable Output 55: TypePointer Output 14(HS_OUT) - 57: 9(int) Constant 1 - 58: 9(int) Constant 0 - 60: TypeBool - 64: TypePointer Function 22(HS_CONSTANT_OUT) - 66(pid): 43(ptr) Variable Input - 70: TypeArray 6(float) 10 - 71: TypePointer Output 70 -72(@patchConstantOutput.edges): 71(ptr) Variable Output - 73: TypePointer Function 6(float) - 76: TypePointer Output 6(float) - 78: 29(int) Constant 1 - 83: 6(float) Constant 1073741824 - 85: 6(float) Constant 1090519040 + 57: 9(int) Constant 0 + 59: TypeBool + 63: TypePointer Function 22(HS_CONSTANT_OUT) + 65(pid): 43(ptr) Variable Input + 69: TypeArray 6(float) 10 + 70: TypePointer Output 69 +71(@patchConstantOutput.edges): 70(ptr) Variable Output + 72: TypePointer Function 6(float) + 75: TypePointer Output 6(float) + 77: 29(int) Constant 1 + 82: 6(float) Constant 1073741824 + 84: 6(float) Constant 1090519040 4(main): 2 Function None 3 5: Label 38(ip): 12(ptr) Variable Function 42(m_cpid): 13(ptr) Variable Function 50(param): 12(ptr) Variable Function 52(param): 13(ptr) Variable Function -65(@patchConstantResult): 64(ptr) Variable Function - 67(param): 13(ptr) Variable Function +64(@patchConstantResult): 63(ptr) Variable Function + 66(param): 13(ptr) Variable Function 41: 11 Load 40(ip) Store 38(ip) 41 45: 9(int) Load 44(m_cpid) @@ -327,26 +326,26 @@ vertex spacing = equal_spacing 54: 14(HS_OUT) FunctionCall 18(@main(struct-VS_OUT-vf31[4];u1;) 50(param) 52(param) 56: 55(ptr) AccessChain 48(@entryPointOutput) 49 Store 56 54 - ControlBarrier 20 57 58 - 59: 9(int) Load 44(m_cpid) - 61: 60(bool) IEqual 59 30 - SelectionMerge 63 None - BranchConditional 61 62 63 - 62: Label - 68: 9(int) Load 66(pid) - Store 67(param) 68 - 69:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 67(param) - Store 65(@patchConstantResult) 69 - 74: 73(ptr) AccessChain 65(@patchConstantResult) 30 30 - 75: 6(float) Load 74 - 77: 76(ptr) AccessChain 72(@patchConstantOutput.edges) 30 - Store 77 75 - 79: 73(ptr) AccessChain 65(@patchConstantResult) 30 78 - 80: 6(float) Load 79 - 81: 76(ptr) AccessChain 72(@patchConstantOutput.edges) 78 - Store 81 80 - Branch 63 - 63: Label + ControlBarrier 20 10 57 + 58: 9(int) Load 44(m_cpid) + 60: 59(bool) IEqual 58 30 + SelectionMerge 62 None + BranchConditional 60 61 62 + 61: Label + 67: 9(int) Load 65(pid) + Store 66(param) 67 + 68:22(HS_CONSTANT_OUT) FunctionCall 25(PCF(u1;) 66(param) + Store 64(@patchConstantResult) 68 + 73: 72(ptr) AccessChain 64(@patchConstantResult) 30 30 + 74: 6(float) Load 73 + 76: 75(ptr) AccessChain 71(@patchConstantOutput.edges) 30 + Store 76 74 + 78: 72(ptr) AccessChain 64(@patchConstantResult) 30 77 + 79: 6(float) Load 78 + 80: 75(ptr) AccessChain 71(@patchConstantOutput.edges) 77 + Store 80 79 + Branch 62 + 62: Label Return FunctionEnd 18(@main(struct-VS_OUT-vf31[4];u1;): 14(HS_OUT) Function None 15 @@ -364,11 +363,11 @@ vertex spacing = equal_spacing 25(PCF(u1;):22(HS_CONSTANT_OUT) Function None 23 24(pid): 13(ptr) FunctionParameter 26: Label - 82(output): 64(ptr) Variable Function - 84: 73(ptr) AccessChain 82(output) 30 30 - Store 84 83 - 86: 73(ptr) AccessChain 82(output) 30 78 - Store 86 85 - 87:22(HS_CONSTANT_OUT) Load 82(output) - ReturnValue 87 + 81(output): 63(ptr) Variable Function + 83: 72(ptr) AccessChain 81(output) 30 30 + Store 83 82 + 85: 72(ptr) AccessChain 81(output) 30 77 + Store 85 84 + 86:22(HS_CONSTANT_OUT) Load 81(output) + ReturnValue 86 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.2.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.2.tesc.out index 8d0708ddcd1..c8218d23725 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.2.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.2.tesc.out @@ -220,13 +220,13 @@ vertex spacing = equal_spacing 0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 92 +// Generated by (magic number): 80007 +// Id's are bound by 91 Capability Tessellation 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 4 "main" 42 46 48 64 66 74 + EntryPoint TessellationControl 4 "main" 42 46 48 63 65 73 ExecutionMode 4 OutputVertices 4 ExecutionMode 4 Isolines ExecutionMode 4 SpacingEqual @@ -249,20 +249,20 @@ vertex spacing = equal_spacing Name 46 "@entryPointOutput" Name 48 "InvocationId" Name 50 "param" - Name 63 "@patchConstantResult" - Name 64 "pid" - Name 66 "pos" - Name 67 "param" - Name 69 "param" - Name 74 "@patchConstantOutput.edges" - Name 84 "output" + Name 62 "@patchConstantResult" + Name 63 "pid" + Name 65 "pos" + Name 66 "param" + Name 68 "param" + Name 73 "@patchConstantOutput.edges" + Name 83 "output" Decorate 42(ip) Location 0 Decorate 46(@entryPointOutput) Location 0 Decorate 48(InvocationId) BuiltIn InvocationId - Decorate 64(pid) BuiltIn PrimitiveId - Decorate 66(pos) BuiltIn Position - Decorate 74(@patchConstantOutput.edges) Patch - Decorate 74(@patchConstantOutput.edges) BuiltIn TessLevelOuter + Decorate 63(pid) BuiltIn PrimitiveId + Decorate 65(pos) BuiltIn Position + Decorate 73(@patchConstantOutput.edges) Patch + Decorate 73(@patchConstantOutput.edges) BuiltIn TessLevelOuter 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -293,28 +293,27 @@ vertex spacing = equal_spacing 47: TypePointer Input 9(int) 48(InvocationId): 47(ptr) Variable Input 53: TypePointer Output 13(HS_OUT) - 55: 9(int) Constant 1 - 56: 9(int) Constant 0 - 58: TypeBool - 62: TypePointer Function 23(HS_CONSTANT_OUT) - 64(pid): 47(ptr) Variable Input - 65: TypePointer Input 19(fvec4) - 66(pos): 65(ptr) Variable Input - 72: TypeArray 6(float) 10 - 73: TypePointer Output 72 -74(@patchConstantOutput.edges): 73(ptr) Variable Output - 75: TypePointer Function 6(float) - 78: TypePointer Output 6(float) - 80: 31(int) Constant 1 - 85: 6(float) Constant 1073741824 - 87: 6(float) Constant 1090519040 + 55: 9(int) Constant 0 + 57: TypeBool + 61: TypePointer Function 23(HS_CONSTANT_OUT) + 63(pid): 47(ptr) Variable Input + 64: TypePointer Input 19(fvec4) + 65(pos): 64(ptr) Variable Input + 71: TypeArray 6(float) 10 + 72: TypePointer Output 71 +73(@patchConstantOutput.edges): 72(ptr) Variable Output + 74: TypePointer Function 6(float) + 77: TypePointer Output 6(float) + 79: 31(int) Constant 1 + 84: 6(float) Constant 1073741824 + 86: 6(float) Constant 1090519040 4(main): 2 Function None 3 5: Label 40(ip): 12(ptr) Variable Function 50(param): 12(ptr) Variable Function -63(@patchConstantResult): 62(ptr) Variable Function - 67(param): 18(ptr) Variable Function - 69(param): 20(ptr) Variable Function +62(@patchConstantResult): 61(ptr) Variable Function + 66(param): 18(ptr) Variable Function + 68(param): 20(ptr) Variable Function 43: 11 Load 42(ip) Store 40(ip) 43 49: 9(int) Load 48(InvocationId) @@ -323,28 +322,28 @@ vertex spacing = equal_spacing 52: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 50(param) 54: 53(ptr) AccessChain 46(@entryPointOutput) 49 Store 54 52 - ControlBarrier 21 55 56 - 57: 9(int) Load 48(InvocationId) - 59: 58(bool) IEqual 57 32 - SelectionMerge 61 None - BranchConditional 59 60 61 - 60: Label - 68: 9(int) Load 64(pid) - Store 67(param) 68 - 70: 19(fvec4) Load 66(pos) - Store 69(param) 70 - 71:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 67(param) 69(param) - Store 63(@patchConstantResult) 71 - 76: 75(ptr) AccessChain 63(@patchConstantResult) 32 32 - 77: 6(float) Load 76 - 79: 78(ptr) AccessChain 74(@patchConstantOutput.edges) 32 - Store 79 77 - 81: 75(ptr) AccessChain 63(@patchConstantResult) 32 80 - 82: 6(float) Load 81 - 83: 78(ptr) AccessChain 74(@patchConstantOutput.edges) 80 - Store 83 82 - Branch 61 - 61: Label + ControlBarrier 21 10 55 + 56: 9(int) Load 48(InvocationId) + 58: 57(bool) IEqual 56 32 + SelectionMerge 60 None + BranchConditional 58 59 60 + 59: Label + 67: 9(int) Load 63(pid) + Store 66(param) 67 + 69: 19(fvec4) Load 65(pos) + Store 68(param) 69 + 70:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 66(param) 68(param) + Store 62(@patchConstantResult) 70 + 75: 74(ptr) AccessChain 62(@patchConstantResult) 32 32 + 76: 6(float) Load 75 + 78: 77(ptr) AccessChain 73(@patchConstantOutput.edges) 32 + Store 78 76 + 80: 74(ptr) AccessChain 62(@patchConstantResult) 32 79 + 81: 6(float) Load 80 + 82: 77(ptr) AccessChain 73(@patchConstantOutput.edges) 79 + Store 82 81 + Branch 60 + 60: Label Return FunctionEnd 16(@main(struct-VS_OUT-vf31[4];): 13(HS_OUT) Function None 14 @@ -362,11 +361,11 @@ vertex spacing = equal_spacing 25(pid): 18(ptr) FunctionParameter 26(pos): 20(ptr) FunctionParameter 28: Label - 84(output): 62(ptr) Variable Function - 86: 75(ptr) AccessChain 84(output) 32 32 - Store 86 85 - 88: 75(ptr) AccessChain 84(output) 32 80 - Store 88 87 - 89:23(HS_CONSTANT_OUT) Load 84(output) - ReturnValue 89 + 83(output): 61(ptr) Variable Function + 85: 74(ptr) AccessChain 83(output) 32 32 + Store 85 84 + 87: 74(ptr) AccessChain 83(output) 32 79 + Store 87 86 + 88:23(HS_CONSTANT_OUT) Load 83(output) + ReturnValue 88 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.3.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.3.tesc.out index 59eed0d06d2..4ff01985dcf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.3.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.3.tesc.out @@ -220,13 +220,13 @@ vertex spacing = equal_spacing 0:? '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 92 +// Generated by (magic number): 80007 +// Id's are bound by 91 Capability Tessellation 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 4 "main" 42 46 48 64 66 74 + EntryPoint TessellationControl 4 "main" 42 46 48 63 65 73 ExecutionMode 4 OutputVertices 4 ExecutionMode 4 Triangles ExecutionMode 4 SpacingEqual @@ -250,20 +250,20 @@ vertex spacing = equal_spacing Name 46 "@entryPointOutput" Name 48 "InvocationId" Name 50 "param" - Name 63 "@patchConstantResult" - Name 64 "pid" - Name 66 "pos" - Name 67 "param" - Name 69 "param" - Name 74 "@patchConstantOutput.edges" - Name 84 "output" + Name 62 "@patchConstantResult" + Name 63 "pid" + Name 65 "pos" + Name 66 "param" + Name 68 "param" + Name 73 "@patchConstantOutput.edges" + Name 83 "output" Decorate 42(ip) Location 0 Decorate 46(@entryPointOutput) Location 0 Decorate 48(InvocationId) BuiltIn InvocationId - Decorate 64(pid) BuiltIn PrimitiveId - Decorate 66(pos) BuiltIn Position - Decorate 74(@patchConstantOutput.edges) Patch - Decorate 74(@patchConstantOutput.edges) BuiltIn TessLevelOuter + Decorate 63(pid) BuiltIn PrimitiveId + Decorate 65(pos) BuiltIn Position + Decorate 73(@patchConstantOutput.edges) Patch + Decorate 73(@patchConstantOutput.edges) BuiltIn TessLevelOuter 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -294,28 +294,27 @@ vertex spacing = equal_spacing 47: TypePointer Input 9(int) 48(InvocationId): 47(ptr) Variable Input 53: TypePointer Output 13(HS_OUT) - 55: 9(int) Constant 1 - 56: 9(int) Constant 0 - 58: TypeBool - 62: TypePointer Function 23(HS_CONSTANT_OUT) - 64(pid): 47(ptr) Variable Input - 65: TypePointer Input 19(fvec4) - 66(pos): 65(ptr) Variable Input - 72: TypeArray 6(float) 10 - 73: TypePointer Output 72 -74(@patchConstantOutput.edges): 73(ptr) Variable Output - 75: TypePointer Function 6(float) - 78: TypePointer Output 6(float) - 80: 31(int) Constant 1 - 85: 6(float) Constant 1073741824 - 87: 6(float) Constant 1090519040 + 55: 9(int) Constant 0 + 57: TypeBool + 61: TypePointer Function 23(HS_CONSTANT_OUT) + 63(pid): 47(ptr) Variable Input + 64: TypePointer Input 19(fvec4) + 65(pos): 64(ptr) Variable Input + 71: TypeArray 6(float) 10 + 72: TypePointer Output 71 +73(@patchConstantOutput.edges): 72(ptr) Variable Output + 74: TypePointer Function 6(float) + 77: TypePointer Output 6(float) + 79: 31(int) Constant 1 + 84: 6(float) Constant 1073741824 + 86: 6(float) Constant 1090519040 4(main): 2 Function None 3 5: Label 40(ip): 12(ptr) Variable Function 50(param): 12(ptr) Variable Function -63(@patchConstantResult): 62(ptr) Variable Function - 67(param): 18(ptr) Variable Function - 69(param): 20(ptr) Variable Function +62(@patchConstantResult): 61(ptr) Variable Function + 66(param): 18(ptr) Variable Function + 68(param): 20(ptr) Variable Function 43: 11 Load 42(ip) Store 40(ip) 43 49: 9(int) Load 48(InvocationId) @@ -324,28 +323,28 @@ vertex spacing = equal_spacing 52: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[4];) 50(param) 54: 53(ptr) AccessChain 46(@entryPointOutput) 49 Store 54 52 - ControlBarrier 21 55 56 - 57: 9(int) Load 48(InvocationId) - 59: 58(bool) IEqual 57 32 - SelectionMerge 61 None - BranchConditional 59 60 61 - 60: Label - 68: 9(int) Load 64(pid) - Store 67(param) 68 - 70: 19(fvec4) Load 66(pos) - Store 69(param) 70 - 71:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 67(param) 69(param) - Store 63(@patchConstantResult) 71 - 76: 75(ptr) AccessChain 63(@patchConstantResult) 32 32 - 77: 6(float) Load 76 - 79: 78(ptr) AccessChain 74(@patchConstantOutput.edges) 32 - Store 79 77 - 81: 75(ptr) AccessChain 63(@patchConstantResult) 32 80 - 82: 6(float) Load 81 - 83: 78(ptr) AccessChain 74(@patchConstantOutput.edges) 80 - Store 83 82 - Branch 61 - 61: Label + ControlBarrier 21 10 55 + 56: 9(int) Load 48(InvocationId) + 58: 57(bool) IEqual 56 32 + SelectionMerge 60 None + BranchConditional 58 59 60 + 59: Label + 67: 9(int) Load 63(pid) + Store 66(param) 67 + 69: 19(fvec4) Load 65(pos) + Store 68(param) 69 + 70:23(HS_CONSTANT_OUT) FunctionCall 27(PCF(u1;vf4;) 66(param) 68(param) + Store 62(@patchConstantResult) 70 + 75: 74(ptr) AccessChain 62(@patchConstantResult) 32 32 + 76: 6(float) Load 75 + 78: 77(ptr) AccessChain 73(@patchConstantOutput.edges) 32 + Store 78 76 + 80: 74(ptr) AccessChain 62(@patchConstantResult) 32 79 + 81: 6(float) Load 80 + 82: 77(ptr) AccessChain 73(@patchConstantOutput.edges) 79 + Store 82 81 + Branch 60 + 60: Label Return FunctionEnd 16(@main(struct-VS_OUT-vf31[4];): 13(HS_OUT) Function None 14 @@ -363,11 +362,11 @@ vertex spacing = equal_spacing 25(pid): 18(ptr) FunctionParameter 26(pos): 20(ptr) FunctionParameter 28: Label - 84(output): 62(ptr) Variable Function - 86: 75(ptr) AccessChain 84(output) 32 32 - Store 86 85 - 88: 75(ptr) AccessChain 84(output) 32 80 - Store 88 87 - 89:23(HS_CONSTANT_OUT) Load 84(output) - ReturnValue 89 + 83(output): 61(ptr) Variable Function + 85: 74(ptr) AccessChain 83(output) 32 32 + Store 85 84 + 87: 74(ptr) AccessChain 83(output) 32 79 + Store 87 86 + 88:23(HS_CONSTANT_OUT) Load 83(output) + ReturnValue 88 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out index 139d7d41058..a99730d0938 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out @@ -159,10 +159,9 @@ triangle order = cw 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal}) @@ -400,10 +399,9 @@ triangle order = cw 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal}) @@ -478,7 +476,7 @@ triangle order = cw 0:? '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 127 Capability Tessellation @@ -514,10 +512,10 @@ triangle order = cw Name 81 "cpid" Name 83 "cpid" Name 86 "@entryPointOutput.m_Position" - Name 87 "param" - Name 89 "param" - Name 103 "@patchConstantResult" - Name 104 "param" + Name 88 "param" + Name 90 "param" + Name 104 "@patchConstantResult" + Name 105 "param" Name 110 "@patchConstantOutput.fTessFactor" Name 123 "@patchConstantOutput.fInsideTessFactor" Decorate 56(I.m_Position) BuiltIn Position @@ -568,27 +566,26 @@ triangle order = cw 83(cpid): 82(ptr) Variable Input 85: TypePointer Output 54 86(@entryPointOutput.m_Position): 85(ptr) Variable Output - 93: TypePointer Output 7(fvec4) - 95: 9(int) Constant 2 - 96: 9(int) Constant 1 - 97: 9(int) Constant 0 - 99: TypeBool - 107: 9(int) Constant 4 - 108: TypeArray 6(float) 107 + 94: TypePointer Output 7(fvec4) + 96: 9(int) Constant 2 + 97: 9(int) Constant 4 + 98: 9(int) Constant 0 + 100: TypeBool + 108: TypeArray 6(float) 97 109: TypePointer Output 108 110(@patchConstantOutput.fTessFactor): 109(ptr) Variable Output 113: TypePointer Output 6(float) - 121: TypeArray 6(float) 95 + 121: TypeArray 6(float) 96 122: TypePointer Output 121 123(@patchConstantOutput.fInsideTessFactor): 122(ptr) Variable Output 4(main): 2 Function None 3 5: Label 53(I): 12(ptr) Variable Function 81(cpid): 19(ptr) Variable Function - 87(param): 12(ptr) Variable Function - 89(param): 19(ptr) Variable Function -103(@patchConstantResult): 26(ptr) Variable Function - 104(param): 12(ptr) Variable Function + 88(param): 12(ptr) Variable Function + 90(param): 19(ptr) Variable Function +104(@patchConstantResult): 26(ptr) Variable Function + 105(param): 12(ptr) Variable Function 58: 57(ptr) AccessChain 56(I.m_Position) 33 59: 7(fvec4) Load 58 60: 48(ptr) AccessChain 53(I) 33 33 @@ -615,42 +612,43 @@ triangle order = cw Store 80 79 84: 9(int) Load 83(cpid) Store 81(cpid) 84 - 88: 11 Load 53(I) - Store 87(param) 88 - 90: 9(int) Load 81(cpid) - Store 89(param) 90 - 91:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 87(param) 89(param) - 92: 7(fvec4) CompositeExtract 91 0 - 94: 93(ptr) AccessChain 86(@entryPointOutput.m_Position) 33 - Store 94 92 - ControlBarrier 95 96 97 - 98: 9(int) Load 83(cpid) - 100: 99(bool) IEqual 98 33 - SelectionMerge 102 None - BranchConditional 100 101 102 - 101: Label - 105: 11 Load 53(I) - Store 104(param) 105 - 106:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 104(param) - Store 103(@patchConstantResult) 106 - 111: 34(ptr) AccessChain 103(@patchConstantResult) 33 33 + 87: 9(int) Load 83(cpid) + 89: 11 Load 53(I) + Store 88(param) 89 + 91: 9(int) Load 81(cpid) + Store 90(param) 91 + 92:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 88(param) 90(param) + 93: 7(fvec4) CompositeExtract 92 0 + 95: 94(ptr) AccessChain 86(@entryPointOutput.m_Position) 87 + Store 95 93 + ControlBarrier 96 97 98 + 99: 9(int) Load 83(cpid) + 101: 100(bool) IEqual 99 33 + SelectionMerge 103 None + BranchConditional 101 102 103 + 102: Label + 106: 11 Load 53(I) + Store 105(param) 106 + 107:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 105(param) + Store 104(@patchConstantResult) 107 + 111: 34(ptr) AccessChain 104(@patchConstantResult) 33 33 112: 6(float) Load 111 114: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 33 Store 114 112 - 115: 34(ptr) AccessChain 103(@patchConstantResult) 33 32 + 115: 34(ptr) AccessChain 104(@patchConstantResult) 33 32 116: 6(float) Load 115 117: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 32 Store 117 116 - 118: 34(ptr) AccessChain 103(@patchConstantResult) 33 74 + 118: 34(ptr) AccessChain 104(@patchConstantResult) 33 74 119: 6(float) Load 118 120: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 74 Store 120 119 - 124: 34(ptr) AccessChain 103(@patchConstantResult) 32 + 124: 34(ptr) AccessChain 104(@patchConstantResult) 32 125: 6(float) Load 124 126: 113(ptr) AccessChain 123(@patchConstantOutput.fInsideTessFactor) 33 Store 126 125 - Branch 102 - 102: Label + Branch 103 + 103: Label Return FunctionEnd 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];):14(HS_Output) Function None 15 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out index 3a42b52e6b7..656427b6de3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out @@ -80,10 +80,9 @@ ERROR: node is still EOpNull! 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'cpid' ( temp uint) @@ -174,10 +173,9 @@ ERROR: node is still EOpNull! 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'cpid' ( temp uint) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out index 24e4aa7c33b..41f3c0a44de 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out @@ -396,7 +396,7 @@ triangle order = cw 0:? '@patchConstantOutput.flInFactor' ( patch out 2-element array of float TessLevelInner) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 124 Capability Tessellation @@ -434,12 +434,12 @@ triangle order = cw Name 68 "param" Name 70 "param" Name 74 "i" - Name 75 "param" - Name 77 "param" - Name 81 "i" - Name 82 "param" - Name 84 "param" - Name 88 "@patchConstantResult" + Name 76 "param" + Name 78 "param" + Name 82 "i" + Name 83 "param" + Name 85 "param" + Name 89 "@patchConstantResult" Name 94 "@patchConstantOutput.tfactor" Name 108 "@patchConstantOutput.flInFactor" Name 112 "o" @@ -478,15 +478,15 @@ triangle order = cw 48(@entryPointOutput): 47(ptr) Variable Output 55: TypePointer Output 14(hs_out_t) 57: 9(int) Constant 2 - 58: 9(int) Constant 1 + 58: 9(int) Constant 4 59: 9(int) Constant 0 61: TypeBool 65: TypePointer Function 20 73: 29(int) Constant 1 - 80: 29(int) Constant 2 - 87: TypePointer Function 22(hs_pcf_t) - 91: 9(int) Constant 4 - 92: TypeArray 6(float) 91 + 75: 9(int) Constant 1 + 81: 29(int) Constant 2 + 88: TypePointer Function 22(hs_pcf_t) + 92: TypeArray 6(float) 58 93: TypePointer Output 92 94(@patchConstantOutput.tfactor): 93(ptr) Variable Output 95: TypePointer Function 6(float) @@ -506,12 +506,12 @@ triangle order = cw 68(param): 12(ptr) Variable Function 70(param): 13(ptr) Variable Function 74(i): 12(ptr) Variable Function - 75(param): 12(ptr) Variable Function - 77(param): 13(ptr) Variable Function - 81(i): 12(ptr) Variable Function - 82(param): 12(ptr) Variable Function - 84(param): 13(ptr) Variable Function -88(@patchConstantResult): 87(ptr) Variable Function + 76(param): 12(ptr) Variable Function + 78(param): 13(ptr) Variable Function + 82(i): 12(ptr) Variable Function + 83(param): 12(ptr) Variable Function + 85(param): 13(ptr) Variable Function +89(@patchConstantResult): 88(ptr) Variable Function 42: 11 Load 41(i) Store 39(i) 42 46: 9(int) Load 45(cpid) @@ -536,34 +536,34 @@ triangle order = cw 71:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 68(param) 70(param) 72: 27(ptr) AccessChain 66(pcf_out) 30 Store 72 71 - 76: 11 Load 74(i) - Store 75(param) 76 - Store 77(param) 58 - 78:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 75(param) 77(param) - 79: 27(ptr) AccessChain 66(pcf_out) 73 - Store 79 78 - 83: 11 Load 81(i) - Store 82(param) 83 - Store 84(param) 57 - 85:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 82(param) 84(param) - 86: 27(ptr) AccessChain 66(pcf_out) 80 - Store 86 85 - 89: 20 Load 66(pcf_out) - 90:22(hs_pcf_t) FunctionCall 25(PCF(struct-hs_out_t-vf31[3];) 89 - Store 88(@patchConstantResult) 90 - 96: 95(ptr) AccessChain 88(@patchConstantResult) 30 30 + 77: 11 Load 74(i) + Store 76(param) 77 + Store 78(param) 75 + 79:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 76(param) 78(param) + 80: 27(ptr) AccessChain 66(pcf_out) 73 + Store 80 79 + 84: 11 Load 82(i) + Store 83(param) 84 + Store 85(param) 57 + 86:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 83(param) 85(param) + 87: 27(ptr) AccessChain 66(pcf_out) 81 + Store 87 86 + 90: 20 Load 66(pcf_out) + 91:22(hs_pcf_t) FunctionCall 25(PCF(struct-hs_out_t-vf31[3];) 90 + Store 89(@patchConstantResult) 91 + 96: 95(ptr) AccessChain 89(@patchConstantResult) 30 30 97: 6(float) Load 96 99: 98(ptr) AccessChain 94(@patchConstantOutput.tfactor) 30 Store 99 97 - 100: 95(ptr) AccessChain 88(@patchConstantResult) 30 73 + 100: 95(ptr) AccessChain 89(@patchConstantResult) 30 73 101: 6(float) Load 100 102: 98(ptr) AccessChain 94(@patchConstantOutput.tfactor) 73 Store 102 101 - 103: 95(ptr) AccessChain 88(@patchConstantResult) 30 80 + 103: 95(ptr) AccessChain 89(@patchConstantResult) 30 81 104: 6(float) Load 103 - 105: 98(ptr) AccessChain 94(@patchConstantOutput.tfactor) 80 + 105: 98(ptr) AccessChain 94(@patchConstantOutput.tfactor) 81 Store 105 104 - 109: 95(ptr) AccessChain 88(@patchConstantResult) 73 + 109: 95(ptr) AccessChain 89(@patchConstantResult) 73 110: 6(float) Load 109 111: 98(ptr) AccessChain 108(@patchConstantOutput.flInFactor) 30 Store 111 110 @@ -587,7 +587,7 @@ triangle order = cw 25(PCF(struct-hs_out_t-vf31[3];):22(hs_pcf_t) Function None 23 24(pcf_out): 20 FunctionParameter 26: Label - 112(o): 87(ptr) Variable Function + 112(o): 88(ptr) Variable Function 113: 6(float) CompositeExtract 24(pcf_out) 0 0 0 114: 95(ptr) AccessChain 112(o) 30 30 Store 114 113 @@ -595,7 +595,7 @@ triangle order = cw 116: 95(ptr) AccessChain 112(o) 30 73 Store 116 115 117: 6(float) CompositeExtract 24(pcf_out) 2 0 0 - 118: 95(ptr) AccessChain 112(o) 30 80 + 118: 95(ptr) AccessChain 112(o) 30 81 Store 118 117 120: 95(ptr) AccessChain 112(o) 73 Store 120 119 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out index 89582b73daf..986e1102111 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out @@ -414,7 +414,7 @@ triangle order = cw 0:? '@patchConstantOutput.flInFactor' ( patch out 2-element array of float TessLevelInner) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 126 Capability Tessellation @@ -453,12 +453,12 @@ triangle order = cw Name 69 "param" Name 71 "param" Name 75 "i" - Name 76 "param" - Name 78 "param" - Name 82 "i" - Name 83 "param" - Name 85 "param" - Name 89 "@patchConstantResult" + Name 77 "param" + Name 79 "param" + Name 83 "i" + Name 84 "param" + Name 86 "param" + Name 90 "@patchConstantResult" Name 96 "@patchConstantOutput.tfactor" Name 110 "@patchConstantOutput.flInFactor" Name 114 "o" @@ -497,15 +497,15 @@ triangle order = cw 49(@entryPointOutput): 48(ptr) Variable Output 56: TypePointer Output 14(hs_out_t) 58: 9(int) Constant 2 - 59: 9(int) Constant 1 + 59: 9(int) Constant 4 60: 9(int) Constant 0 62: TypeBool 66: TypePointer Function 20 74: 28(int) Constant 1 - 81: 28(int) Constant 2 - 88: TypePointer Function 22(hs_pcf_t) - 93: 9(int) Constant 4 - 94: TypeArray 6(float) 93 + 76: 9(int) Constant 1 + 82: 28(int) Constant 2 + 89: TypePointer Function 22(hs_pcf_t) + 94: TypeArray 6(float) 59 95: TypePointer Output 94 96(@patchConstantOutput.tfactor): 95(ptr) Variable Output 97: TypePointer Function 6(float) @@ -525,12 +525,12 @@ triangle order = cw 69(param): 12(ptr) Variable Function 71(param): 13(ptr) Variable Function 75(i): 12(ptr) Variable Function - 76(param): 12(ptr) Variable Function - 78(param): 13(ptr) Variable Function - 82(i): 12(ptr) Variable Function - 83(param): 12(ptr) Variable Function - 85(param): 13(ptr) Variable Function -89(@patchConstantResult): 88(ptr) Variable Function + 77(param): 12(ptr) Variable Function + 79(param): 13(ptr) Variable Function + 83(i): 12(ptr) Variable Function + 84(param): 12(ptr) Variable Function + 86(param): 13(ptr) Variable Function +90(@patchConstantResult): 89(ptr) Variable Function 43: 11 Load 42(i) Store 40(i) 43 47: 9(int) Load 46(cpid) @@ -555,35 +555,35 @@ triangle order = cw 72:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 69(param) 71(param) 73: 30(ptr) AccessChain 67(pcf_out) 29 Store 73 72 - 77: 11 Load 75(i) - Store 76(param) 77 - Store 78(param) 59 - 79:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 76(param) 78(param) - 80: 30(ptr) AccessChain 67(pcf_out) 74 - Store 80 79 - 84: 11 Load 82(i) - Store 83(param) 84 - Store 85(param) 58 - 86:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 83(param) 85(param) - 87: 30(ptr) AccessChain 67(pcf_out) 81 - Store 87 86 - 90: 20 Load 67(pcf_out) - 91: 11 Load 40(i) - 92:22(hs_pcf_t) FunctionCall 26(PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3];) 90 91 - Store 89(@patchConstantResult) 92 - 98: 97(ptr) AccessChain 89(@patchConstantResult) 29 29 + 78: 11 Load 75(i) + Store 77(param) 78 + Store 79(param) 76 + 80:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 77(param) 79(param) + 81: 30(ptr) AccessChain 67(pcf_out) 74 + Store 81 80 + 85: 11 Load 83(i) + Store 84(param) 85 + Store 86(param) 58 + 87:14(hs_out_t) FunctionCall 18(@main(struct-hs_in_t-vf31[3];u1;) 84(param) 86(param) + 88: 30(ptr) AccessChain 67(pcf_out) 82 + Store 88 87 + 91: 20 Load 67(pcf_out) + 92: 11 Load 40(i) + 93:22(hs_pcf_t) FunctionCall 26(PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3];) 91 92 + Store 90(@patchConstantResult) 93 + 98: 97(ptr) AccessChain 90(@patchConstantResult) 29 29 99: 6(float) Load 98 101: 100(ptr) AccessChain 96(@patchConstantOutput.tfactor) 29 Store 101 99 - 102: 97(ptr) AccessChain 89(@patchConstantResult) 29 74 + 102: 97(ptr) AccessChain 90(@patchConstantResult) 29 74 103: 6(float) Load 102 104: 100(ptr) AccessChain 96(@patchConstantOutput.tfactor) 74 Store 104 103 - 105: 97(ptr) AccessChain 89(@patchConstantResult) 29 81 + 105: 97(ptr) AccessChain 90(@patchConstantResult) 29 82 106: 6(float) Load 105 - 107: 100(ptr) AccessChain 96(@patchConstantOutput.tfactor) 81 + 107: 100(ptr) AccessChain 96(@patchConstantOutput.tfactor) 82 Store 107 106 - 111: 97(ptr) AccessChain 89(@patchConstantResult) 74 + 111: 97(ptr) AccessChain 90(@patchConstantResult) 74 112: 6(float) Load 111 113: 100(ptr) AccessChain 110(@patchConstantOutput.flInFactor) 29 Store 113 112 @@ -608,7 +608,7 @@ triangle order = cw 24(pcf_out): 20 FunctionParameter 25(pcf_in): 11 FunctionParameter 27: Label - 114(o): 88(ptr) Variable Function + 114(o): 89(ptr) Variable Function 115: 6(float) CompositeExtract 24(pcf_out) 0 0 0 116: 97(ptr) AccessChain 114(o) 29 29 Store 116 115 @@ -616,7 +616,7 @@ triangle order = cw 118: 97(ptr) AccessChain 114(o) 29 74 Store 118 117 119: 6(float) CompositeExtract 24(pcf_out) 2 0 0 - 120: 97(ptr) AccessChain 114(o) 29 81 + 120: 97(ptr) AccessChain 114(o) 29 82 Store 120 119 122: 97(ptr) AccessChain 114(o) 74 Store 122 121 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.void.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.void.tesc.out index 68524d9d2ee..c44c7e4dd73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.void.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.hull.void.tesc.out @@ -108,7 +108,7 @@ triangle order = ccw 0:? 'InvocationId' ( in uint InvocationID) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 55 Capability Tessellation @@ -161,7 +161,7 @@ triangle order = ccw 39(InvocationId): 38(ptr) Variable Input 44: TypePointer Output 13(HS_OUT) 46: 9(int) Constant 2 - 47: 9(int) Constant 1 + 47: 9(int) Constant 4 48: 9(int) Constant 0 50: TypeBool 4(main): 2 Function None 3 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.identifier.sample.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.identifier.sample.frag.out index 356a212536f..a23451ec196 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.identifier.sample.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.identifier.sample.frag.out @@ -86,7 +86,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 33 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.if.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.if.frag.out index 8490324080e..056b672e308 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.if.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.if.frag.out @@ -42,7 +42,7 @@ gl_FragCoord origin is upper left 0:14 'input' ( in 4-component vector of float) 0:14 'input' ( in 4-component vector of float) 0:14 true case is null -0:19 Test condition and select ( temp void) +0:19 Test condition and select ( temp void): Flatten 0:19 Condition 0:19 all ( temp bool) 0:19 Equal ( temp 4-component vector of bool) @@ -152,7 +152,7 @@ gl_FragCoord origin is upper left 0:14 'input' ( in 4-component vector of float) 0:14 'input' ( in 4-component vector of float) 0:14 true case is null -0:19 Test condition and select ( temp void) +0:19 Test condition and select ( temp void): Flatten 0:19 Condition 0:19 all ( temp bool) 0:19 Equal ( temp 4-component vector of bool) @@ -216,7 +216,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 103 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.imagefetch-subvec4.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.imagefetch-subvec4.comp.out new file mode 100644 index 00000000000..721aeead005 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.imagefetch-subvec4.comp.out @@ -0,0 +1,142 @@ +hlsl.imagefetch-subvec4.comp +Shader version: 500 +local_size = (8, 8, 8) +0:? Sequence +0:6 Function Definition: @main(vu3; ( temp void) +0:6 Function Parameters: +0:6 'tid' ( in 3-component vector of uint) +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp uint) +0:7 'storeTemp' ( temp uint) +0:7 Convert int to uint ( temp uint) +0:7 textureFetch ( temp int) +0:7 'IN' (layout( binding=0) uniform itexture3D) +0:7 'tid' ( in 3-component vector of uint) +0:7 Constant: +0:7 0 (const int) +0:7 imageStore ( temp void) +0:7 'OUT' (layout( binding=1 r32ui) uniform uimage3D) +0:7 'tid' ( in 3-component vector of uint) +0:7 'storeTemp' ( temp uint) +0:7 'storeTemp' ( temp uint) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp 3-component vector of uint) +0:? 'tid' ( temp 3-component vector of uint) +0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) +0:6 Function Call: @main(vu3; ( temp void) +0:? 'tid' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'IN' (layout( binding=0) uniform itexture3D) +0:? 'OUT' (layout( binding=1 r32ui) uniform uimage3D) +0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (8, 8, 8) +0:? Sequence +0:6 Function Definition: @main(vu3; ( temp void) +0:6 Function Parameters: +0:6 'tid' ( in 3-component vector of uint) +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp uint) +0:7 'storeTemp' ( temp uint) +0:7 Convert int to uint ( temp uint) +0:7 textureFetch ( temp int) +0:7 'IN' (layout( binding=0) uniform itexture3D) +0:7 'tid' ( in 3-component vector of uint) +0:7 Constant: +0:7 0 (const int) +0:7 imageStore ( temp void) +0:7 'OUT' (layout( binding=1 r32ui) uniform uimage3D) +0:7 'tid' ( in 3-component vector of uint) +0:7 'storeTemp' ( temp uint) +0:7 'storeTemp' ( temp uint) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp 3-component vector of uint) +0:? 'tid' ( temp 3-component vector of uint) +0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) +0:6 Function Call: @main(vu3; ( temp void) +0:? 'tid' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'IN' (layout( binding=0) uniform itexture3D) +0:? 'OUT' (layout( binding=1 r32ui) uniform uimage3D) +0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 39 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 34 + ExecutionMode 4 LocalSize 8 8 8 + Source HLSL 500 + Name 4 "main" + Name 11 "@main(vu3;" + Name 10 "tid" + Name 14 "storeTemp" + Name 18 "IN" + Name 28 "OUT" + Name 32 "tid" + Name 34 "tid" + Name 36 "param" + Decorate 18(IN) DescriptorSet 0 + Decorate 18(IN) Binding 0 + Decorate 28(OUT) DescriptorSet 0 + Decorate 28(OUT) Binding 1 + Decorate 34(tid) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: TypePointer Function 6(int) + 15: TypeInt 32 1 + 16: TypeImage 15(int) 3D sampled format:Unknown + 17: TypePointer UniformConstant 16 + 18(IN): 17(ptr) Variable UniformConstant + 21: 15(int) Constant 0 + 22: TypeVector 15(int) 4 + 26: TypeImage 6(int) 3D nonsampled format:R32ui + 27: TypePointer UniformConstant 26 + 28(OUT): 27(ptr) Variable UniformConstant + 33: TypePointer Input 7(ivec3) + 34(tid): 33(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 32(tid): 8(ptr) Variable Function + 36(param): 8(ptr) Variable Function + 35: 7(ivec3) Load 34(tid) + Store 32(tid) 35 + 37: 7(ivec3) Load 32(tid) + Store 36(param) 37 + 38: 2 FunctionCall 11(@main(vu3;) 36(param) + Return + FunctionEnd + 11(@main(vu3;): 2 Function None 9 + 10(tid): 8(ptr) FunctionParameter + 12: Label + 14(storeTemp): 13(ptr) Variable Function + 19: 16 Load 18(IN) + 20: 7(ivec3) Load 10(tid) + 23: 22(ivec4) ImageFetch 19 20 Lod 21 + 24: 15(int) CompositeExtract 23 0 + 25: 6(int) Bitcast 24 + Store 14(storeTemp) 25 + 29: 26 Load 28(OUT) + 30: 7(ivec3) Load 10(tid) + 31: 6(int) Load 14(storeTemp) + ImageWrite 29 30 31 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out index 2da4fae3393..72894f23e1c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.implicitBool.frag.out @@ -74,12 +74,11 @@ gl_FragCoord origin is upper left 0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) 0:17 Constant: 0:17 1 (const uint) -0:17 Convert int to bool ( temp bool) -0:17 Convert float to int ( temp int) -0:17 condf: direct index for structure ( uniform float) -0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) -0:17 Constant: -0:17 0 (const uint) +0:17 Convert float to bool ( temp bool) +0:17 condf: direct index for structure ( uniform float) +0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) +0:17 Constant: +0:17 0 (const uint) 0:17 Convert float to bool ( temp bool) 0:17 condf1: direct index for structure ( uniform 1-component vector of float) 0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) @@ -133,7 +132,7 @@ gl_FragCoord origin is upper left 0:28 Sequence 0:28 move second child to first child ( temp float) 0:28 'g' ( temp float) -0:28 Test condition and select ( temp float) +0:28 Test condition and select ( temp float): no shortcircuit 0:28 Condition 0:28 Convert float to bool ( temp bool) 0:28 condf: direct index for structure ( uniform float) @@ -243,12 +242,11 @@ gl_FragCoord origin is upper left 0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) 0:17 Constant: 0:17 1 (const uint) -0:17 Convert int to bool ( temp bool) -0:17 Convert float to int ( temp int) -0:17 condf: direct index for structure ( uniform float) -0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) -0:17 Constant: -0:17 0 (const uint) +0:17 Convert float to bool ( temp bool) +0:17 condf: direct index for structure ( uniform float) +0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) +0:17 Constant: +0:17 0 (const uint) 0:17 Convert float to bool ( temp bool) 0:17 condf1: direct index for structure ( uniform 1-component vector of float) 0:17 'anon@0' (layout( row_major std140) uniform block{ uniform float condf, uniform int condi, uniform 1-component vector of float condf1, uniform 1-component vector of int condi1}) @@ -302,7 +300,7 @@ gl_FragCoord origin is upper left 0:28 Sequence 0:28 move second child to first child ( temp float) 0:28 'g' ( temp float) -0:28 Test condition and select ( temp float) +0:28 Test condition and select ( temp float): no shortcircuit 0:28 Condition 0:28 Convert float to bool ( temp bool) 0:28 condf: direct index for structure ( uniform float) @@ -334,13 +332,13 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 140 +// Generated by (magic number): 80007 +// Id's are bound by 139 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 138 + EntryPoint Fragment 4 "main" 137 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -352,17 +350,17 @@ gl_FragCoord origin is upper left MemberName 16($Global) 2 "condf1" MemberName 16($Global) 3 "condi1" Name 18 "" - Name 88 "f" - Name 101 "i" - Name 121 "g" - Name 138 "@entryPointOutput" + Name 87 "f" + Name 100 "i" + Name 120 "g" + Name 137 "@entryPointOutput" MemberDecorate 16($Global) 0 Offset 0 MemberDecorate 16($Global) 1 Offset 4 - MemberDecorate 16($Global) 2 Offset 16 - MemberDecorate 16($Global) 3 Offset 32 + MemberDecorate 16($Global) 2 Offset 8 + MemberDecorate 16($Global) 3 Offset 12 Decorate 16($Global) Block Decorate 18 DescriptorSet 0 - Decorate 138(@entryPointOutput) Location 0 + Decorate 137(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -388,25 +386,25 @@ gl_FragCoord origin is upper left 53: 6(float) Constant 1077936128 57: 15(int) Constant 3 64: 6(float) Constant 1082130432 - 83: 6(float) Constant 1084227584 - 87: TypePointer Function 6(float) - 100: TypePointer Function 15(int) - 125: 6(float) Constant 1088421888 - 126: 6(float) Constant 1090519040 - 137: TypePointer Output 7(fvec4) -138(@entryPointOutput): 137(ptr) Variable Output + 82: 6(float) Constant 1084227584 + 86: TypePointer Function 6(float) + 99: TypePointer Function 15(int) + 124: 6(float) Constant 1088421888 + 125: 6(float) Constant 1090519040 + 136: TypePointer Output 7(fvec4) +137(@entryPointOutput): 136(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 139: 7(fvec4) FunctionCall 9(@main() - Store 138(@entryPointOutput) 139 + 138: 7(fvec4) FunctionCall 9(@main() + Store 137(@entryPointOutput) 138 Return FunctionEnd 9(@main(): 7(fvec4) Function None 8 10: Label 12(a): 11(ptr) Variable Function - 88(f): 87(ptr) Variable Function - 101(i): 100(ptr) Variable Function - 121(g): 87(ptr) Variable Function + 87(f): 86(ptr) Variable Function + 100(i): 99(ptr) Variable Function + 120(g): 86(ptr) Variable Function Store 12(a) 14 21: 20(ptr) AccessChain 18 19 22: 15(int) Load 21 @@ -457,85 +455,84 @@ gl_FragCoord origin is upper left 70: 23(bool) INotEqual 69 25 71: 35(ptr) AccessChain 18 34 72: 6(float) Load 71 - 73: 15(int) ConvertFToS 72 - 74: 23(bool) INotEqual 73 25 - 75: 23(bool) LogicalAnd 70 74 - 76: 35(ptr) AccessChain 18 46 - 77: 6(float) Load 76 - 78: 23(bool) FOrdNotEqual 77 38 - 79: 23(bool) LogicalOr 75 78 - SelectionMerge 81 None - BranchConditional 79 80 81 - 80: Label - 82: 7(fvec4) Load 12(a) - 84: 7(fvec4) CompositeConstruct 83 83 83 83 - 85: 7(fvec4) FAdd 82 84 - ReturnValue 85 - 81: Label - 89: 35(ptr) AccessChain 18 34 - 90: 6(float) Load 89 - Store 88(f) 90 - Branch 91 - 91: Label - LoopMerge 93 94 None - Branch 95 - 95: Label - 96: 6(float) Load 88(f) - 97: 23(bool) FOrdNotEqual 96 38 - BranchConditional 97 92 93 - 92: Label - 98: 6(float) Load 88(f) - 99: 6(float) FSub 98 30 - Store 88(f) 99 - Branch 94 - 94: Label - Branch 91 - 93: Label - 102: 20(ptr) AccessChain 18 19 - 103: 15(int) Load 102 - Store 101(i) 103 + 73: 23(bool) FOrdNotEqual 72 38 + 74: 23(bool) LogicalAnd 70 73 + 75: 35(ptr) AccessChain 18 46 + 76: 6(float) Load 75 + 77: 23(bool) FOrdNotEqual 76 38 + 78: 23(bool) LogicalOr 74 77 + SelectionMerge 80 None + BranchConditional 78 79 80 + 79: Label + 81: 7(fvec4) Load 12(a) + 83: 7(fvec4) CompositeConstruct 82 82 82 82 + 84: 7(fvec4) FAdd 81 83 + ReturnValue 84 + 80: Label + 88: 35(ptr) AccessChain 18 34 + 89: 6(float) Load 88 + Store 87(f) 89 + Branch 90 + 90: Label + LoopMerge 92 93 None + Branch 94 + 94: Label + 95: 6(float) Load 87(f) + 96: 23(bool) FOrdNotEqual 95 38 + BranchConditional 96 91 92 + 91: Label + 97: 6(float) Load 87(f) + 98: 6(float) FSub 97 30 + Store 87(f) 98 + Branch 93 + 93: Label + Branch 90 + 92: Label + 101: 20(ptr) AccessChain 18 19 + 102: 15(int) Load 101 + Store 100(i) 102 + Branch 103 + 103: Label + LoopMerge 105 106 None Branch 104 104: Label - LoopMerge 106 107 None - Branch 105 - 105: Label - 108: 15(int) Load 101(i) - 109: 15(int) ISub 108 19 - Store 101(i) 109 - Branch 107 - 107: Label - 110: 15(int) Load 101(i) - 111: 23(bool) INotEqual 110 25 - BranchConditional 111 104 106 + 107: 15(int) Load 100(i) + 108: 15(int) ISub 107 19 + Store 100(i) 108 + Branch 106 106: Label - Branch 112 - 112: Label - LoopMerge 114 115 None - Branch 116 - 116: Label - 117: 15(int) Load 101(i) - 118: 23(bool) INotEqual 117 25 - BranchConditional 118 113 114 - 113: Label - 119: 15(int) Load 101(i) - 120: 15(int) ISub 119 19 - Store 101(i) 120 - Branch 115 - 115: Label - Branch 112 - 114: Label - 122: 35(ptr) AccessChain 18 34 - 123: 6(float) Load 122 - 124: 23(bool) FOrdNotEqual 123 38 - 127: 6(float) Select 124 125 126 - Store 121(g) 127 - 128: 6(float) Load 121(g) - 129: 7(fvec4) Load 12(a) - 130: 7(fvec4) CompositeConstruct 128 128 128 128 - 131: 7(fvec4) FAdd 129 130 - Store 12(a) 131 - 132: 7(fvec4) Load 12(a) - 133: 7(fvec4) CompositeConstruct 30 30 30 30 - 134: 7(fvec4) FSub 132 133 - ReturnValue 134 + 109: 15(int) Load 100(i) + 110: 23(bool) INotEqual 109 25 + BranchConditional 110 103 105 + 105: Label + Branch 111 + 111: Label + LoopMerge 113 114 None + Branch 115 + 115: Label + 116: 15(int) Load 100(i) + 117: 23(bool) INotEqual 116 25 + BranchConditional 117 112 113 + 112: Label + 118: 15(int) Load 100(i) + 119: 15(int) ISub 118 19 + Store 100(i) 119 + Branch 114 + 114: Label + Branch 111 + 113: Label + 121: 35(ptr) AccessChain 18 34 + 122: 6(float) Load 121 + 123: 23(bool) FOrdNotEqual 122 38 + 126: 6(float) Select 123 124 125 + Store 120(g) 126 + 127: 6(float) Load 120(g) + 128: 7(fvec4) Load 12(a) + 129: 7(fvec4) CompositeConstruct 127 127 127 127 + 130: 7(fvec4) FAdd 128 129 + Store 12(a) 130 + 131: 7(fvec4) Load 12(a) + 132: 7(fvec4) CompositeConstruct 30 30 30 30 + 133: 7(fvec4) FSub 131 132 + ReturnValue 133 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.include.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.include.vert.out index 2a0532e026e..020879d15f3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.include.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.include.vert.out @@ -1,6 +1,6 @@ ../Test/hlsl.include.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 44 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out index afb0a4fe2c6..1cedc55f511 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out @@ -112,7 +112,7 @@ Shader version: 500 0:? '@entryPointOutput' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 37 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out index 9b5238840ad..9fc816ce293 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out @@ -331,7 +331,7 @@ gl_FragCoord origin is upper left 0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform float a, layout( row_major std140) uniform float b, layout( row_major std140) uniform float c}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 110 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init2.frag.out index 2aff3740e57..9e03de3a9c9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.init2.frag.out @@ -358,7 +358,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 112 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inoutquals.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inoutquals.frag.out index f02ba6deea2..42adb1a81a5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inoutquals.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.inoutquals.frag.out @@ -1,6 +1,7 @@ hlsl.inoutquals.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:8 Function Definition: MyFunc(f1;f1;f1;f1; ( temp void) 0:8 Function Parameters: @@ -92,13 +93,16 @@ gl_FragCoord origin is upper left 0:16 Constant: 0:16 1 (const int) 0:16 move second child to first child ( temp int) -0:? 'sampleMask' ( out int SampleMaskIn) +0:16 direct index ( out int SampleMaskIn) +0:? 'sampleMask' ( out 1-element array of int SampleMaskIn) +0:16 Constant: +0:16 0 (const int) 0:? 'sampleMask' ( temp int) 0:? Linker Objects 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) 0:? 'inpos' ( noperspective in 4-component vector of float FragCoord) -0:? 'sampleMask' ( out int SampleMaskIn) +0:? 'sampleMask' ( out 1-element array of int SampleMaskIn) Linked fragment stage: @@ -106,6 +110,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:8 Function Definition: MyFunc(f1;f1;f1;f1; ( temp void) 0:8 Function Parameters: @@ -197,23 +202,27 @@ gl_FragCoord origin is upper left 0:16 Constant: 0:16 1 (const int) 0:16 move second child to first child ( temp int) -0:? 'sampleMask' ( out int SampleMaskIn) +0:16 direct index ( out int SampleMaskIn) +0:? 'sampleMask' ( out 1-element array of int SampleMaskIn) +0:16 Constant: +0:16 0 (const int) 0:? 'sampleMask' ( temp int) 0:? Linker Objects 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) 0:? 'inpos' ( noperspective in 4-component vector of float FragCoord) -0:? 'sampleMask' ( out int SampleMaskIn) +0:? 'sampleMask' ( out 1-element array of int SampleMaskIn) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 88 +// Generated by (magic number): 80007 +// Id's are bound by 92 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 68 78 82 86 + EntryPoint Fragment 4 "main" 68 78 82 88 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 13 "MyFunc(f1;f1;f1;f1;" @@ -243,12 +252,12 @@ gl_FragCoord origin is upper left Name 74 "param" Name 78 "@entryPointOutput.Color" Name 82 "@entryPointOutput.Depth" - Name 86 "sampleMask" + Name 88 "sampleMask" Decorate 68(inpos) NoPerspective Decorate 68(inpos) BuiltIn FragCoord Decorate 78(@entryPointOutput.Color) Location 0 Decorate 82(@entryPointOutput.Depth) BuiltIn FragDepth - Decorate 86(sampleMask) BuiltIn SampleMask + Decorate 88(sampleMask) BuiltIn SampleMask 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -275,8 +284,11 @@ gl_FragCoord origin is upper left 78(@entryPointOutput.Color): 77(ptr) Variable Output 81: TypePointer Output 6(float) 82(@entryPointOutput.Depth): 81(ptr) Variable Output - 85: TypePointer Output 17(int) - 86(sampleMask): 85(ptr) Variable Output + 85: 42(int) Constant 1 + 86: TypeArray 17(int) 85 + 87: TypePointer Output 86 + 88(sampleMask): 87(ptr) Variable Output + 90: TypePointer Output 17(int) 4(main): 2 Function None 3 5: Label 66(inpos): 16(ptr) Variable Function @@ -298,8 +310,9 @@ gl_FragCoord origin is upper left 83: 7(ptr) AccessChain 70(flattenTemp) 59 84: 6(float) Load 83 Store 82(@entryPointOutput.Depth) 84 - 87: 17(int) Load 71(sampleMask) - Store 86(sampleMask) 87 + 89: 17(int) Load 71(sampleMask) + 91: 90(ptr) AccessChain 88(sampleMask) 53 + Store 91 89 Return FunctionEnd 13(MyFunc(f1;f1;f1;f1;): 2 Function None 8 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.int.dot.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.int.dot.frag.out new file mode 100644 index 00000000000..afe44c85edb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.int.dot.frag.out @@ -0,0 +1,339 @@ +hlsl.int.dot.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:1 Function Definition: @main( ( temp 4-component vector of float) +0:1 Function Parameters: +0:? Sequence +0:2 Sequence +0:2 move second child to first child ( temp int) +0:2 'i' ( temp int) +0:2 Constant: +0:2 1 (const int) +0:3 Sequence +0:3 move second child to first child ( temp 1-component vector of int) +0:3 'i2' ( temp 1-component vector of int) +0:3 Constant: +0:3 2 (const int) +0:4 Sequence +0:4 move second child to first child ( temp 2-component vector of int) +0:4 'i3' ( temp 2-component vector of int) +0:4 Constant: +0:4 3 (const int) +0:4 3 (const int) +0:5 Sequence +0:5 move second child to first child ( temp 3-component vector of int) +0:5 'i4' ( temp 3-component vector of int) +0:5 Constant: +0:5 4 (const int) +0:5 4 (const int) +0:5 4 (const int) +0:6 Sequence +0:6 move second child to first child ( temp 4-component vector of int) +0:6 'i5' ( temp 4-component vector of int) +0:6 Constant: +0:6 5 (const int) +0:6 5 (const int) +0:6 5 (const int) +0:6 5 (const int) +0:8 move second child to first child ( temp int) +0:8 'i' ( temp int) +0:8 dot-product ( temp int) +0:8 'i' ( temp int) +0:8 'i' ( temp int) +0:9 move second child to first child ( temp 1-component vector of int) +0:9 'i2' ( temp 1-component vector of int) +0:9 Construct int ( temp 1-component vector of int) +0:9 dot-product ( temp int) +0:9 Construct int ( in int) +0:9 'i2' ( temp 1-component vector of int) +0:9 Construct int ( in int) +0:9 'i2' ( temp 1-component vector of int) +0:10 move second child to first child ( temp 2-component vector of int) +0:10 'i3' ( temp 2-component vector of int) +0:10 Construct ivec2 ( temp 2-component vector of int) +0:10 dot-product ( temp int) +0:10 'i3' ( temp 2-component vector of int) +0:10 'i3' ( temp 2-component vector of int) +0:11 move second child to first child ( temp 3-component vector of int) +0:11 'i4' ( temp 3-component vector of int) +0:11 Construct ivec3 ( temp 3-component vector of int) +0:11 dot-product ( temp int) +0:11 'i4' ( temp 3-component vector of int) +0:11 'i4' ( temp 3-component vector of int) +0:12 move second child to first child ( temp 4-component vector of int) +0:12 'i5' ( temp 4-component vector of int) +0:12 Construct ivec4 ( temp 4-component vector of int) +0:12 dot-product ( temp int) +0:12 'i5' ( temp 4-component vector of int) +0:12 'i5' ( temp 4-component vector of int) +0:13 Branch: Return with expression +0:13 Convert int to float ( temp 4-component vector of float) +0:13 add ( temp 4-component vector of int) +0:13 add ( temp 4-component vector of int) +0:13 add ( temp 4-component vector of int) +0:13 add ( temp 4-component vector of int) +0:13 'i' ( temp int) +0:13 Construct ivec4 ( temp 4-component vector of int) +0:13 Construct int ( temp int) +0:13 'i2' ( temp 1-component vector of int) +0:13 vector swizzle ( temp 4-component vector of int) +0:13 'i3' ( temp 2-component vector of int) +0:13 Sequence +0:13 Constant: +0:13 0 (const int) +0:13 Constant: +0:13 1 (const int) +0:13 Constant: +0:13 0 (const int) +0:13 Constant: +0:13 1 (const int) +0:13 vector swizzle ( temp 4-component vector of int) +0:13 'i4' ( temp 3-component vector of int) +0:13 Sequence +0:13 Constant: +0:13 0 (const int) +0:13 Constant: +0:13 1 (const int) +0:13 Constant: +0:13 2 (const int) +0:13 Constant: +0:13 0 (const int) +0:13 'i5' ( temp 4-component vector of int) +0:1 Function Definition: main( ( temp void) +0:1 Function Parameters: +0:? Sequence +0:1 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:1 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:1 Function Definition: @main( ( temp 4-component vector of float) +0:1 Function Parameters: +0:? Sequence +0:2 Sequence +0:2 move second child to first child ( temp int) +0:2 'i' ( temp int) +0:2 Constant: +0:2 1 (const int) +0:3 Sequence +0:3 move second child to first child ( temp 1-component vector of int) +0:3 'i2' ( temp 1-component vector of int) +0:3 Constant: +0:3 2 (const int) +0:4 Sequence +0:4 move second child to first child ( temp 2-component vector of int) +0:4 'i3' ( temp 2-component vector of int) +0:4 Constant: +0:4 3 (const int) +0:4 3 (const int) +0:5 Sequence +0:5 move second child to first child ( temp 3-component vector of int) +0:5 'i4' ( temp 3-component vector of int) +0:5 Constant: +0:5 4 (const int) +0:5 4 (const int) +0:5 4 (const int) +0:6 Sequence +0:6 move second child to first child ( temp 4-component vector of int) +0:6 'i5' ( temp 4-component vector of int) +0:6 Constant: +0:6 5 (const int) +0:6 5 (const int) +0:6 5 (const int) +0:6 5 (const int) +0:8 move second child to first child ( temp int) +0:8 'i' ( temp int) +0:8 dot-product ( temp int) +0:8 'i' ( temp int) +0:8 'i' ( temp int) +0:9 move second child to first child ( temp 1-component vector of int) +0:9 'i2' ( temp 1-component vector of int) +0:9 Construct int ( temp 1-component vector of int) +0:9 dot-product ( temp int) +0:9 Construct int ( in int) +0:9 'i2' ( temp 1-component vector of int) +0:9 Construct int ( in int) +0:9 'i2' ( temp 1-component vector of int) +0:10 move second child to first child ( temp 2-component vector of int) +0:10 'i3' ( temp 2-component vector of int) +0:10 Construct ivec2 ( temp 2-component vector of int) +0:10 dot-product ( temp int) +0:10 'i3' ( temp 2-component vector of int) +0:10 'i3' ( temp 2-component vector of int) +0:11 move second child to first child ( temp 3-component vector of int) +0:11 'i4' ( temp 3-component vector of int) +0:11 Construct ivec3 ( temp 3-component vector of int) +0:11 dot-product ( temp int) +0:11 'i4' ( temp 3-component vector of int) +0:11 'i4' ( temp 3-component vector of int) +0:12 move second child to first child ( temp 4-component vector of int) +0:12 'i5' ( temp 4-component vector of int) +0:12 Construct ivec4 ( temp 4-component vector of int) +0:12 dot-product ( temp int) +0:12 'i5' ( temp 4-component vector of int) +0:12 'i5' ( temp 4-component vector of int) +0:13 Branch: Return with expression +0:13 Convert int to float ( temp 4-component vector of float) +0:13 add ( temp 4-component vector of int) +0:13 add ( temp 4-component vector of int) +0:13 add ( temp 4-component vector of int) +0:13 add ( temp 4-component vector of int) +0:13 'i' ( temp int) +0:13 Construct ivec4 ( temp 4-component vector of int) +0:13 Construct int ( temp int) +0:13 'i2' ( temp 1-component vector of int) +0:13 vector swizzle ( temp 4-component vector of int) +0:13 'i3' ( temp 2-component vector of int) +0:13 Sequence +0:13 Constant: +0:13 0 (const int) +0:13 Constant: +0:13 1 (const int) +0:13 Constant: +0:13 0 (const int) +0:13 Constant: +0:13 1 (const int) +0:13 vector swizzle ( temp 4-component vector of int) +0:13 'i4' ( temp 3-component vector of int) +0:13 Sequence +0:13 Constant: +0:13 0 (const int) +0:13 Constant: +0:13 1 (const int) +0:13 Constant: +0:13 2 (const int) +0:13 Constant: +0:13 0 (const int) +0:13 'i5' ( temp 4-component vector of int) +0:1 Function Definition: main( ( temp void) +0:1 Function Parameters: +0:? Sequence +0:1 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:1 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 84 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 82 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 9 "@main(" + Name 13 "i" + Name 15 "i2" + Name 19 "i3" + Name 24 "i4" + Name 29 "i5" + Name 82 "@entryPointOutput" + Decorate 82(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypeInt 32 1 + 12: TypePointer Function 11(int) + 14: 11(int) Constant 1 + 16: 11(int) Constant 2 + 17: TypeVector 11(int) 2 + 18: TypePointer Function 17(ivec2) + 20: 11(int) Constant 3 + 21: 17(ivec2) ConstantComposite 20 20 + 22: TypeVector 11(int) 3 + 23: TypePointer Function 22(ivec3) + 25: 11(int) Constant 4 + 26: 22(ivec3) ConstantComposite 25 25 25 + 27: TypeVector 11(int) 4 + 28: TypePointer Function 27(ivec4) + 30: 11(int) Constant 5 + 31: 27(ivec4) ConstantComposite 30 30 30 30 + 81: TypePointer Output 7(fvec4) +82(@entryPointOutput): 81(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 83: 7(fvec4) FunctionCall 9(@main() + Store 82(@entryPointOutput) 83 + Return + FunctionEnd + 9(@main(): 7(fvec4) Function None 8 + 10: Label + 13(i): 12(ptr) Variable Function + 15(i2): 12(ptr) Variable Function + 19(i3): 18(ptr) Variable Function + 24(i4): 23(ptr) Variable Function + 29(i5): 28(ptr) Variable Function + Store 13(i) 14 + Store 15(i2) 16 + Store 19(i3) 21 + Store 24(i4) 26 + Store 29(i5) 31 + 32: 11(int) Load 13(i) + 33: 11(int) Load 13(i) + 34: 11(int) IMul 32 33 + Store 13(i) 34 + 35: 11(int) Load 15(i2) + 36: 11(int) Load 15(i2) + 37: 11(int) IMul 35 36 + Store 15(i2) 37 + 38: 17(ivec2) Load 19(i3) + 39: 17(ivec2) Load 19(i3) + 40: 17(ivec2) IMul 38 39 + 41: 11(int) CompositeExtract 40 0 + 42: 11(int) CompositeExtract 38 1 + 43: 11(int) IAdd 41 42 + 44: 17(ivec2) CompositeConstruct 43 43 + Store 19(i3) 44 + 45: 22(ivec3) Load 24(i4) + 46: 22(ivec3) Load 24(i4) + 47: 22(ivec3) IMul 45 46 + 48: 11(int) CompositeExtract 47 0 + 49: 11(int) CompositeExtract 45 1 + 50: 11(int) IAdd 48 49 + 51: 11(int) CompositeExtract 45 2 + 52: 11(int) IAdd 50 51 + 53: 22(ivec3) CompositeConstruct 52 52 52 + Store 24(i4) 53 + 54: 27(ivec4) Load 29(i5) + 55: 27(ivec4) Load 29(i5) + 56: 27(ivec4) IMul 54 55 + 57: 11(int) CompositeExtract 56 0 + 58: 11(int) CompositeExtract 54 1 + 59: 11(int) IAdd 57 58 + 60: 11(int) CompositeExtract 54 2 + 61: 11(int) IAdd 59 60 + 62: 11(int) CompositeExtract 54 3 + 63: 11(int) IAdd 61 62 + 64: 27(ivec4) CompositeConstruct 63 63 63 63 + Store 29(i5) 64 + 65: 11(int) Load 13(i) + 66: 11(int) Load 15(i2) + 67: 27(ivec4) CompositeConstruct 66 66 66 66 + 68: 27(ivec4) CompositeConstruct 65 65 65 65 + 69: 27(ivec4) IAdd 68 67 + 70: 17(ivec2) Load 19(i3) + 71: 27(ivec4) VectorShuffle 70 70 0 1 0 1 + 72: 27(ivec4) IAdd 69 71 + 73: 22(ivec3) Load 24(i4) + 74: 27(ivec4) VectorShuffle 73 73 0 1 2 0 + 75: 27(ivec4) IAdd 72 74 + 76: 27(ivec4) Load 29(i5) + 77: 27(ivec4) IAdd 75 76 + 78: 7(fvec4) ConvertSToF 77 + ReturnValue 78 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out index b04909ec713..3a9d6fd51f8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.frag.out @@ -190,7 +190,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 98 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out index 01fc5b2b761..92bd7ef0aa9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsic.frexp.vert.out @@ -113,7 +113,7 @@ Shader version: 500 0:? Linker Objects // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 78 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out index bc8a07352b3..13fe578073f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.barriers.comp.out @@ -7,8 +7,8 @@ local_size = (1, 1, 1) 0:? Sequence 0:4 MemoryBarrier ( temp void) 0:5 AllMemoryBarrierWithGroupSync ( temp void) -0:6 GroupMemoryBarrier ( temp void) -0:7 GroupMemoryBarrierWithGroupSync ( temp void) +0:6 DeviceMemoryBarrier ( temp void) +0:7 DeviceMemoryBarrierWithGroupSync ( temp void) 0:8 WorkgroupMemoryBarrier ( temp void) 0:9 WorkgroupMemoryBarrierWithGroupSync ( temp void) 0:11 Branch: Return with expression @@ -35,8 +35,8 @@ local_size = (1, 1, 1) 0:? Sequence 0:4 MemoryBarrier ( temp void) 0:5 AllMemoryBarrierWithGroupSync ( temp void) -0:6 GroupMemoryBarrier ( temp void) -0:7 GroupMemoryBarrierWithGroupSync ( temp void) +0:6 DeviceMemoryBarrier ( temp void) +0:7 DeviceMemoryBarrierWithGroupSync ( temp void) 0:8 WorkgroupMemoryBarrier ( temp void) 0:9 WorkgroupMemoryBarrierWithGroupSync ( temp void) 0:11 Branch: Return with expression @@ -52,7 +52,7 @@ local_size = (1, 1, 1) 0:? '@entryPointOutput' (layout( location=0) out float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader @@ -71,10 +71,10 @@ local_size = (1, 1, 1) 7: TypeFunction 6(float) 10: TypeInt 32 0 11: 10(int) Constant 1 - 12: 10(int) Constant 4048 - 13: 10(int) Constant 512 - 14: 10(int) Constant 2 - 15: 10(int) Constant 256 + 12: 10(int) Constant 3400 + 13: 10(int) Constant 2 + 14: 10(int) Constant 2120 + 15: 10(int) Constant 264 16: 6(float) Constant 0 19: TypePointer Output 6(float) 20(@entryPointOutput): 19(ptr) Variable Output @@ -87,10 +87,10 @@ local_size = (1, 1, 1) 8(@ComputeShaderFunction(): 6(float) Function None 7 9: Label MemoryBarrier 11 12 - ControlBarrier 11 11 12 - MemoryBarrier 11 13 - ControlBarrier 11 11 13 - MemoryBarrier 14 15 - ControlBarrier 14 14 15 + ControlBarrier 13 11 12 + MemoryBarrier 11 14 + ControlBarrier 13 11 14 + MemoryBarrier 13 15 + ControlBarrier 13 13 15 ReturnValue 16 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.comp.out index 01b6f69c11f..5058f236563 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.comp.out @@ -13,7 +13,7 @@ local_size = (1, 1, 1) 0:21 all ( temp bool) 0:21 Convert float to bool ( temp bool) 0:21 'inF0' ( in float) -0:24 AtomicAdd ( temp void) +0:24 AtomicAdd ( temp uint) 0:24 'gs_ua' ( shared uint) 0:24 'gs_ub' ( shared uint) 0:25 move second child to first child ( temp uint) @@ -21,7 +21,7 @@ local_size = (1, 1, 1) 0:25 AtomicAdd ( temp uint) 0:25 'gs_ua' ( shared uint) 0:25 'gs_ub' ( shared uint) -0:26 AtomicAnd ( temp void) +0:26 AtomicAnd ( temp uint) 0:26 'gs_ua' ( shared uint) 0:26 'gs_ub' ( shared uint) 0:27 move second child to first child ( temp uint) @@ -40,7 +40,7 @@ local_size = (1, 1, 1) 0:29 AtomicExchange ( temp uint) 0:29 'gs_ua' ( shared uint) 0:29 'gs_ub' ( shared uint) -0:30 AtomicMax ( temp void) +0:30 AtomicMax ( temp uint) 0:30 'gs_ua' ( shared uint) 0:30 'gs_ub' ( shared uint) 0:31 move second child to first child ( temp uint) @@ -48,7 +48,7 @@ local_size = (1, 1, 1) 0:31 AtomicMax ( temp uint) 0:31 'gs_ua' ( shared uint) 0:31 'gs_ub' ( shared uint) -0:32 AtomicMin ( temp void) +0:32 AtomicMin ( temp uint) 0:32 'gs_ua' ( shared uint) 0:32 'gs_ub' ( shared uint) 0:33 move second child to first child ( temp uint) @@ -56,7 +56,7 @@ local_size = (1, 1, 1) 0:33 AtomicMin ( temp uint) 0:33 'gs_ua' ( shared uint) 0:33 'gs_ub' ( shared uint) -0:34 AtomicOr ( temp void) +0:34 AtomicOr ( temp uint) 0:34 'gs_ua' ( shared uint) 0:34 'gs_ub' ( shared uint) 0:35 move second child to first child ( temp uint) @@ -64,7 +64,7 @@ local_size = (1, 1, 1) 0:35 AtomicOr ( temp uint) 0:35 'gs_ua' ( shared uint) 0:35 'gs_ub' ( shared uint) -0:36 AtomicXor ( temp void) +0:36 AtomicXor ( temp uint) 0:36 'gs_ua' ( shared uint) 0:36 'gs_ub' ( shared uint) 0:37 move second child to first child ( temp uint) @@ -95,7 +95,7 @@ local_size = (1, 1, 1) 0:55 all ( temp bool) 0:55 Convert float to bool ( temp 2-component vector of bool) 0:55 'inF0' ( in 2-component vector of float) -0:58 AtomicAdd ( temp void) +0:58 AtomicAdd ( temp 2-component vector of uint) 0:58 'gs_ua2' ( shared 2-component vector of uint) 0:58 'gs_ub2' ( shared 2-component vector of uint) 0:59 move second child to first child ( temp 2-component vector of uint) @@ -103,7 +103,7 @@ local_size = (1, 1, 1) 0:59 AtomicAdd ( temp 2-component vector of uint) 0:59 'gs_ua2' ( shared 2-component vector of uint) 0:59 'gs_ub2' ( shared 2-component vector of uint) -0:60 AtomicAnd ( temp void) +0:60 AtomicAnd ( temp 2-component vector of uint) 0:60 'gs_ua2' ( shared 2-component vector of uint) 0:60 'gs_ub2' ( shared 2-component vector of uint) 0:61 move second child to first child ( temp 2-component vector of uint) @@ -122,7 +122,7 @@ local_size = (1, 1, 1) 0:63 AtomicExchange ( temp 2-component vector of uint) 0:63 'gs_ua2' ( shared 2-component vector of uint) 0:63 'gs_ub2' ( shared 2-component vector of uint) -0:64 AtomicMax ( temp void) +0:64 AtomicMax ( temp 2-component vector of uint) 0:64 'gs_ua2' ( shared 2-component vector of uint) 0:64 'gs_ub2' ( shared 2-component vector of uint) 0:65 move second child to first child ( temp 2-component vector of uint) @@ -130,7 +130,7 @@ local_size = (1, 1, 1) 0:65 AtomicMax ( temp 2-component vector of uint) 0:65 'gs_ua2' ( shared 2-component vector of uint) 0:65 'gs_ub2' ( shared 2-component vector of uint) -0:66 AtomicMin ( temp void) +0:66 AtomicMin ( temp 2-component vector of uint) 0:66 'gs_ua2' ( shared 2-component vector of uint) 0:66 'gs_ub2' ( shared 2-component vector of uint) 0:67 move second child to first child ( temp 2-component vector of uint) @@ -138,7 +138,7 @@ local_size = (1, 1, 1) 0:67 AtomicMin ( temp 2-component vector of uint) 0:67 'gs_ua2' ( shared 2-component vector of uint) 0:67 'gs_ub2' ( shared 2-component vector of uint) -0:68 AtomicOr ( temp void) +0:68 AtomicOr ( temp 2-component vector of uint) 0:68 'gs_ua2' ( shared 2-component vector of uint) 0:68 'gs_ub2' ( shared 2-component vector of uint) 0:69 move second child to first child ( temp 2-component vector of uint) @@ -146,7 +146,7 @@ local_size = (1, 1, 1) 0:69 AtomicOr ( temp 2-component vector of uint) 0:69 'gs_ua2' ( shared 2-component vector of uint) 0:69 'gs_ub2' ( shared 2-component vector of uint) -0:70 AtomicXor ( temp void) +0:70 AtomicXor ( temp 2-component vector of uint) 0:70 'gs_ua2' ( shared 2-component vector of uint) 0:70 'gs_ub2' ( shared 2-component vector of uint) 0:71 move second child to first child ( temp 2-component vector of uint) @@ -169,7 +169,7 @@ local_size = (1, 1, 1) 0:82 all ( temp bool) 0:82 Convert float to bool ( temp 3-component vector of bool) 0:82 'inF0' ( in 3-component vector of float) -0:85 AtomicAdd ( temp void) +0:85 AtomicAdd ( temp 3-component vector of uint) 0:85 'gs_ua3' ( shared 3-component vector of uint) 0:85 'gs_ub3' ( shared 3-component vector of uint) 0:86 move second child to first child ( temp 3-component vector of uint) @@ -177,7 +177,7 @@ local_size = (1, 1, 1) 0:86 AtomicAdd ( temp 3-component vector of uint) 0:86 'gs_ua3' ( shared 3-component vector of uint) 0:86 'gs_ub3' ( shared 3-component vector of uint) -0:87 AtomicAnd ( temp void) +0:87 AtomicAnd ( temp 3-component vector of uint) 0:87 'gs_ua3' ( shared 3-component vector of uint) 0:87 'gs_ub3' ( shared 3-component vector of uint) 0:88 move second child to first child ( temp 3-component vector of uint) @@ -196,7 +196,7 @@ local_size = (1, 1, 1) 0:90 AtomicExchange ( temp 3-component vector of uint) 0:90 'gs_ua3' ( shared 3-component vector of uint) 0:90 'gs_ub3' ( shared 3-component vector of uint) -0:91 AtomicMax ( temp void) +0:91 AtomicMax ( temp 3-component vector of uint) 0:91 'gs_ua3' ( shared 3-component vector of uint) 0:91 'gs_ub3' ( shared 3-component vector of uint) 0:92 move second child to first child ( temp 3-component vector of uint) @@ -204,7 +204,7 @@ local_size = (1, 1, 1) 0:92 AtomicMax ( temp 3-component vector of uint) 0:92 'gs_ua3' ( shared 3-component vector of uint) 0:92 'gs_ub3' ( shared 3-component vector of uint) -0:93 AtomicMin ( temp void) +0:93 AtomicMin ( temp 3-component vector of uint) 0:93 'gs_ua3' ( shared 3-component vector of uint) 0:93 'gs_ub3' ( shared 3-component vector of uint) 0:94 move second child to first child ( temp 3-component vector of uint) @@ -212,7 +212,7 @@ local_size = (1, 1, 1) 0:94 AtomicMin ( temp 3-component vector of uint) 0:94 'gs_ua3' ( shared 3-component vector of uint) 0:94 'gs_ub3' ( shared 3-component vector of uint) -0:95 AtomicOr ( temp void) +0:95 AtomicOr ( temp 3-component vector of uint) 0:95 'gs_ua3' ( shared 3-component vector of uint) 0:95 'gs_ub3' ( shared 3-component vector of uint) 0:96 move second child to first child ( temp 3-component vector of uint) @@ -220,7 +220,7 @@ local_size = (1, 1, 1) 0:96 AtomicOr ( temp 3-component vector of uint) 0:96 'gs_ua3' ( shared 3-component vector of uint) 0:96 'gs_ub3' ( shared 3-component vector of uint) -0:97 AtomicXor ( temp void) +0:97 AtomicXor ( temp 3-component vector of uint) 0:97 'gs_ua3' ( shared 3-component vector of uint) 0:97 'gs_ub3' ( shared 3-component vector of uint) 0:98 move second child to first child ( temp 3-component vector of uint) @@ -244,7 +244,7 @@ local_size = (1, 1, 1) 0:109 all ( temp bool) 0:109 Convert float to bool ( temp 4-component vector of bool) 0:109 'inF0' ( in 4-component vector of float) -0:112 AtomicAdd ( temp void) +0:112 AtomicAdd ( temp 4-component vector of uint) 0:112 'gs_ua4' ( shared 4-component vector of uint) 0:112 'gs_ub4' ( shared 4-component vector of uint) 0:113 move second child to first child ( temp 4-component vector of uint) @@ -252,7 +252,7 @@ local_size = (1, 1, 1) 0:113 AtomicAdd ( temp 4-component vector of uint) 0:113 'gs_ua4' ( shared 4-component vector of uint) 0:113 'gs_ub4' ( shared 4-component vector of uint) -0:114 AtomicAnd ( temp void) +0:114 AtomicAnd ( temp 4-component vector of uint) 0:114 'gs_ua4' ( shared 4-component vector of uint) 0:114 'gs_ub4' ( shared 4-component vector of uint) 0:115 move second child to first child ( temp 4-component vector of uint) @@ -271,7 +271,7 @@ local_size = (1, 1, 1) 0:117 AtomicExchange ( temp 4-component vector of uint) 0:117 'gs_ua4' ( shared 4-component vector of uint) 0:117 'gs_ub4' ( shared 4-component vector of uint) -0:118 AtomicMax ( temp void) +0:118 AtomicMax ( temp 4-component vector of uint) 0:118 'gs_ua4' ( shared 4-component vector of uint) 0:118 'gs_ub4' ( shared 4-component vector of uint) 0:119 move second child to first child ( temp 4-component vector of uint) @@ -279,7 +279,7 @@ local_size = (1, 1, 1) 0:119 AtomicMax ( temp 4-component vector of uint) 0:119 'gs_ua4' ( shared 4-component vector of uint) 0:119 'gs_ub4' ( shared 4-component vector of uint) -0:120 AtomicMin ( temp void) +0:120 AtomicMin ( temp 4-component vector of uint) 0:120 'gs_ua4' ( shared 4-component vector of uint) 0:120 'gs_ub4' ( shared 4-component vector of uint) 0:121 move second child to first child ( temp 4-component vector of uint) @@ -287,7 +287,7 @@ local_size = (1, 1, 1) 0:121 AtomicMin ( temp 4-component vector of uint) 0:121 'gs_ua4' ( shared 4-component vector of uint) 0:121 'gs_ub4' ( shared 4-component vector of uint) -0:122 AtomicOr ( temp void) +0:122 AtomicOr ( temp 4-component vector of uint) 0:122 'gs_ua4' ( shared 4-component vector of uint) 0:122 'gs_ub4' ( shared 4-component vector of uint) 0:123 move second child to first child ( temp 4-component vector of uint) @@ -295,7 +295,7 @@ local_size = (1, 1, 1) 0:123 AtomicOr ( temp 4-component vector of uint) 0:123 'gs_ua4' ( shared 4-component vector of uint) 0:123 'gs_ub4' ( shared 4-component vector of uint) -0:124 AtomicXor ( temp void) +0:124 AtomicXor ( temp 4-component vector of uint) 0:124 'gs_ua4' ( shared 4-component vector of uint) 0:124 'gs_ub4' ( shared 4-component vector of uint) 0:125 move second child to first child ( temp 4-component vector of uint) @@ -373,7 +373,7 @@ local_size = (1, 1, 1) 0:21 all ( temp bool) 0:21 Convert float to bool ( temp bool) 0:21 'inF0' ( in float) -0:24 AtomicAdd ( temp void) +0:24 AtomicAdd ( temp uint) 0:24 'gs_ua' ( shared uint) 0:24 'gs_ub' ( shared uint) 0:25 move second child to first child ( temp uint) @@ -381,7 +381,7 @@ local_size = (1, 1, 1) 0:25 AtomicAdd ( temp uint) 0:25 'gs_ua' ( shared uint) 0:25 'gs_ub' ( shared uint) -0:26 AtomicAnd ( temp void) +0:26 AtomicAnd ( temp uint) 0:26 'gs_ua' ( shared uint) 0:26 'gs_ub' ( shared uint) 0:27 move second child to first child ( temp uint) @@ -400,7 +400,7 @@ local_size = (1, 1, 1) 0:29 AtomicExchange ( temp uint) 0:29 'gs_ua' ( shared uint) 0:29 'gs_ub' ( shared uint) -0:30 AtomicMax ( temp void) +0:30 AtomicMax ( temp uint) 0:30 'gs_ua' ( shared uint) 0:30 'gs_ub' ( shared uint) 0:31 move second child to first child ( temp uint) @@ -408,7 +408,7 @@ local_size = (1, 1, 1) 0:31 AtomicMax ( temp uint) 0:31 'gs_ua' ( shared uint) 0:31 'gs_ub' ( shared uint) -0:32 AtomicMin ( temp void) +0:32 AtomicMin ( temp uint) 0:32 'gs_ua' ( shared uint) 0:32 'gs_ub' ( shared uint) 0:33 move second child to first child ( temp uint) @@ -416,7 +416,7 @@ local_size = (1, 1, 1) 0:33 AtomicMin ( temp uint) 0:33 'gs_ua' ( shared uint) 0:33 'gs_ub' ( shared uint) -0:34 AtomicOr ( temp void) +0:34 AtomicOr ( temp uint) 0:34 'gs_ua' ( shared uint) 0:34 'gs_ub' ( shared uint) 0:35 move second child to first child ( temp uint) @@ -424,7 +424,7 @@ local_size = (1, 1, 1) 0:35 AtomicOr ( temp uint) 0:35 'gs_ua' ( shared uint) 0:35 'gs_ub' ( shared uint) -0:36 AtomicXor ( temp void) +0:36 AtomicXor ( temp uint) 0:36 'gs_ua' ( shared uint) 0:36 'gs_ub' ( shared uint) 0:37 move second child to first child ( temp uint) @@ -455,7 +455,7 @@ local_size = (1, 1, 1) 0:55 all ( temp bool) 0:55 Convert float to bool ( temp 2-component vector of bool) 0:55 'inF0' ( in 2-component vector of float) -0:58 AtomicAdd ( temp void) +0:58 AtomicAdd ( temp 2-component vector of uint) 0:58 'gs_ua2' ( shared 2-component vector of uint) 0:58 'gs_ub2' ( shared 2-component vector of uint) 0:59 move second child to first child ( temp 2-component vector of uint) @@ -463,7 +463,7 @@ local_size = (1, 1, 1) 0:59 AtomicAdd ( temp 2-component vector of uint) 0:59 'gs_ua2' ( shared 2-component vector of uint) 0:59 'gs_ub2' ( shared 2-component vector of uint) -0:60 AtomicAnd ( temp void) +0:60 AtomicAnd ( temp 2-component vector of uint) 0:60 'gs_ua2' ( shared 2-component vector of uint) 0:60 'gs_ub2' ( shared 2-component vector of uint) 0:61 move second child to first child ( temp 2-component vector of uint) @@ -482,7 +482,7 @@ local_size = (1, 1, 1) 0:63 AtomicExchange ( temp 2-component vector of uint) 0:63 'gs_ua2' ( shared 2-component vector of uint) 0:63 'gs_ub2' ( shared 2-component vector of uint) -0:64 AtomicMax ( temp void) +0:64 AtomicMax ( temp 2-component vector of uint) 0:64 'gs_ua2' ( shared 2-component vector of uint) 0:64 'gs_ub2' ( shared 2-component vector of uint) 0:65 move second child to first child ( temp 2-component vector of uint) @@ -490,7 +490,7 @@ local_size = (1, 1, 1) 0:65 AtomicMax ( temp 2-component vector of uint) 0:65 'gs_ua2' ( shared 2-component vector of uint) 0:65 'gs_ub2' ( shared 2-component vector of uint) -0:66 AtomicMin ( temp void) +0:66 AtomicMin ( temp 2-component vector of uint) 0:66 'gs_ua2' ( shared 2-component vector of uint) 0:66 'gs_ub2' ( shared 2-component vector of uint) 0:67 move second child to first child ( temp 2-component vector of uint) @@ -498,7 +498,7 @@ local_size = (1, 1, 1) 0:67 AtomicMin ( temp 2-component vector of uint) 0:67 'gs_ua2' ( shared 2-component vector of uint) 0:67 'gs_ub2' ( shared 2-component vector of uint) -0:68 AtomicOr ( temp void) +0:68 AtomicOr ( temp 2-component vector of uint) 0:68 'gs_ua2' ( shared 2-component vector of uint) 0:68 'gs_ub2' ( shared 2-component vector of uint) 0:69 move second child to first child ( temp 2-component vector of uint) @@ -506,7 +506,7 @@ local_size = (1, 1, 1) 0:69 AtomicOr ( temp 2-component vector of uint) 0:69 'gs_ua2' ( shared 2-component vector of uint) 0:69 'gs_ub2' ( shared 2-component vector of uint) -0:70 AtomicXor ( temp void) +0:70 AtomicXor ( temp 2-component vector of uint) 0:70 'gs_ua2' ( shared 2-component vector of uint) 0:70 'gs_ub2' ( shared 2-component vector of uint) 0:71 move second child to first child ( temp 2-component vector of uint) @@ -529,7 +529,7 @@ local_size = (1, 1, 1) 0:82 all ( temp bool) 0:82 Convert float to bool ( temp 3-component vector of bool) 0:82 'inF0' ( in 3-component vector of float) -0:85 AtomicAdd ( temp void) +0:85 AtomicAdd ( temp 3-component vector of uint) 0:85 'gs_ua3' ( shared 3-component vector of uint) 0:85 'gs_ub3' ( shared 3-component vector of uint) 0:86 move second child to first child ( temp 3-component vector of uint) @@ -537,7 +537,7 @@ local_size = (1, 1, 1) 0:86 AtomicAdd ( temp 3-component vector of uint) 0:86 'gs_ua3' ( shared 3-component vector of uint) 0:86 'gs_ub3' ( shared 3-component vector of uint) -0:87 AtomicAnd ( temp void) +0:87 AtomicAnd ( temp 3-component vector of uint) 0:87 'gs_ua3' ( shared 3-component vector of uint) 0:87 'gs_ub3' ( shared 3-component vector of uint) 0:88 move second child to first child ( temp 3-component vector of uint) @@ -556,7 +556,7 @@ local_size = (1, 1, 1) 0:90 AtomicExchange ( temp 3-component vector of uint) 0:90 'gs_ua3' ( shared 3-component vector of uint) 0:90 'gs_ub3' ( shared 3-component vector of uint) -0:91 AtomicMax ( temp void) +0:91 AtomicMax ( temp 3-component vector of uint) 0:91 'gs_ua3' ( shared 3-component vector of uint) 0:91 'gs_ub3' ( shared 3-component vector of uint) 0:92 move second child to first child ( temp 3-component vector of uint) @@ -564,7 +564,7 @@ local_size = (1, 1, 1) 0:92 AtomicMax ( temp 3-component vector of uint) 0:92 'gs_ua3' ( shared 3-component vector of uint) 0:92 'gs_ub3' ( shared 3-component vector of uint) -0:93 AtomicMin ( temp void) +0:93 AtomicMin ( temp 3-component vector of uint) 0:93 'gs_ua3' ( shared 3-component vector of uint) 0:93 'gs_ub3' ( shared 3-component vector of uint) 0:94 move second child to first child ( temp 3-component vector of uint) @@ -572,7 +572,7 @@ local_size = (1, 1, 1) 0:94 AtomicMin ( temp 3-component vector of uint) 0:94 'gs_ua3' ( shared 3-component vector of uint) 0:94 'gs_ub3' ( shared 3-component vector of uint) -0:95 AtomicOr ( temp void) +0:95 AtomicOr ( temp 3-component vector of uint) 0:95 'gs_ua3' ( shared 3-component vector of uint) 0:95 'gs_ub3' ( shared 3-component vector of uint) 0:96 move second child to first child ( temp 3-component vector of uint) @@ -580,7 +580,7 @@ local_size = (1, 1, 1) 0:96 AtomicOr ( temp 3-component vector of uint) 0:96 'gs_ua3' ( shared 3-component vector of uint) 0:96 'gs_ub3' ( shared 3-component vector of uint) -0:97 AtomicXor ( temp void) +0:97 AtomicXor ( temp 3-component vector of uint) 0:97 'gs_ua3' ( shared 3-component vector of uint) 0:97 'gs_ub3' ( shared 3-component vector of uint) 0:98 move second child to first child ( temp 3-component vector of uint) @@ -604,7 +604,7 @@ local_size = (1, 1, 1) 0:109 all ( temp bool) 0:109 Convert float to bool ( temp 4-component vector of bool) 0:109 'inF0' ( in 4-component vector of float) -0:112 AtomicAdd ( temp void) +0:112 AtomicAdd ( temp 4-component vector of uint) 0:112 'gs_ua4' ( shared 4-component vector of uint) 0:112 'gs_ub4' ( shared 4-component vector of uint) 0:113 move second child to first child ( temp 4-component vector of uint) @@ -612,7 +612,7 @@ local_size = (1, 1, 1) 0:113 AtomicAdd ( temp 4-component vector of uint) 0:113 'gs_ua4' ( shared 4-component vector of uint) 0:113 'gs_ub4' ( shared 4-component vector of uint) -0:114 AtomicAnd ( temp void) +0:114 AtomicAnd ( temp 4-component vector of uint) 0:114 'gs_ua4' ( shared 4-component vector of uint) 0:114 'gs_ub4' ( shared 4-component vector of uint) 0:115 move second child to first child ( temp 4-component vector of uint) @@ -631,7 +631,7 @@ local_size = (1, 1, 1) 0:117 AtomicExchange ( temp 4-component vector of uint) 0:117 'gs_ua4' ( shared 4-component vector of uint) 0:117 'gs_ub4' ( shared 4-component vector of uint) -0:118 AtomicMax ( temp void) +0:118 AtomicMax ( temp 4-component vector of uint) 0:118 'gs_ua4' ( shared 4-component vector of uint) 0:118 'gs_ub4' ( shared 4-component vector of uint) 0:119 move second child to first child ( temp 4-component vector of uint) @@ -639,7 +639,7 @@ local_size = (1, 1, 1) 0:119 AtomicMax ( temp 4-component vector of uint) 0:119 'gs_ua4' ( shared 4-component vector of uint) 0:119 'gs_ub4' ( shared 4-component vector of uint) -0:120 AtomicMin ( temp void) +0:120 AtomicMin ( temp 4-component vector of uint) 0:120 'gs_ua4' ( shared 4-component vector of uint) 0:120 'gs_ub4' ( shared 4-component vector of uint) 0:121 move second child to first child ( temp 4-component vector of uint) @@ -647,7 +647,7 @@ local_size = (1, 1, 1) 0:121 AtomicMin ( temp 4-component vector of uint) 0:121 'gs_ua4' ( shared 4-component vector of uint) 0:121 'gs_ub4' ( shared 4-component vector of uint) -0:122 AtomicOr ( temp void) +0:122 AtomicOr ( temp 4-component vector of uint) 0:122 'gs_ua4' ( shared 4-component vector of uint) 0:122 'gs_ub4' ( shared 4-component vector of uint) 0:123 move second child to first child ( temp 4-component vector of uint) @@ -655,7 +655,7 @@ local_size = (1, 1, 1) 0:123 AtomicOr ( temp 4-component vector of uint) 0:123 'gs_ua4' ( shared 4-component vector of uint) 0:123 'gs_ub4' ( shared 4-component vector of uint) -0:124 AtomicXor ( temp void) +0:124 AtomicXor ( temp 4-component vector of uint) 0:124 'gs_ua4' ( shared 4-component vector of uint) 0:124 'gs_ub4' ( shared 4-component vector of uint) 0:125 move second child to first child ( temp 4-component vector of uint) @@ -715,8 +715,12 @@ local_size = (1, 1, 1) 0:? 'inU0' (layout( location=3) in 4-component vector of uint) 0:? 'inU1' (layout( location=4) in 4-component vector of uint) +error: SPIRV-Tools Validation Errors +error: Expected operand to be vector bool: All + %64 = OpAll %bool %63 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 265 Capability Shader @@ -905,12 +909,12 @@ local_size = (1, 1, 1) 63: 61(bool) FOrdNotEqual 60 62 64: 61(bool) All 63 68: 8(int) Load 67(gs_ub) - 71: 2 AtomicIAdd 66(gs_ua) 69 70 68 + 71: 8(int) AtomicIAdd 66(gs_ua) 69 70 68 73: 8(int) Load 67(gs_ub) 74: 8(int) AtomicIAdd 66(gs_ua) 69 70 73 Store 72(out_u1) 74 75: 8(int) Load 67(gs_ub) - 76: 2 AtomicAnd 66(gs_ua) 69 70 75 + 76: 8(int) AtomicAnd 66(gs_ua) 69 70 75 77: 8(int) Load 67(gs_ub) 78: 8(int) AtomicAnd 66(gs_ua) 69 70 77 Store 72(out_u1) 78 @@ -922,22 +926,22 @@ local_size = (1, 1, 1) 84: 8(int) AtomicExchange 66(gs_ua) 69 70 83 Store 72(out_u1) 84 85: 8(int) Load 67(gs_ub) - 86: 2 AtomicSMax 66(gs_ua) 69 70 85 + 86: 8(int) AtomicUMax 66(gs_ua) 69 70 85 87: 8(int) Load 67(gs_ub) 88: 8(int) AtomicUMax 66(gs_ua) 69 70 87 Store 72(out_u1) 88 89: 8(int) Load 67(gs_ub) - 90: 2 AtomicSMin 66(gs_ua) 69 70 89 + 90: 8(int) AtomicUMin 66(gs_ua) 69 70 89 91: 8(int) Load 67(gs_ub) 92: 8(int) AtomicUMin 66(gs_ua) 69 70 91 Store 72(out_u1) 92 93: 8(int) Load 67(gs_ub) - 94: 2 AtomicOr 66(gs_ua) 69 70 93 + 94: 8(int) AtomicOr 66(gs_ua) 69 70 93 95: 8(int) Load 67(gs_ub) 96: 8(int) AtomicOr 66(gs_ua) 69 70 95 Store 72(out_u1) 96 97: 8(int) Load 67(gs_ub) - 98: 2 AtomicXor 66(gs_ua) 69 70 97 + 98: 8(int) AtomicXor 66(gs_ua) 69 70 97 99: 8(int) Load 67(gs_ub) 100: 8(int) AtomicXor 66(gs_ua) 69 70 99 Store 72(out_u1) 100 @@ -962,12 +966,12 @@ local_size = (1, 1, 1) 108: 106(bvec2) FOrdNotEqual 105 107 109: 61(bool) All 108 113: 26(ivec2) Load 112(gs_ub2) - 114: 2 AtomicIAdd 111(gs_ua2) 69 70 113 + 114: 26(ivec2) AtomicIAdd 111(gs_ua2) 69 70 113 116: 26(ivec2) Load 112(gs_ub2) 117: 26(ivec2) AtomicIAdd 111(gs_ua2) 69 70 116 Store 115(out_u2) 117 118: 26(ivec2) Load 112(gs_ub2) - 119: 2 AtomicAnd 111(gs_ua2) 69 70 118 + 119: 26(ivec2) AtomicAnd 111(gs_ua2) 69 70 118 120: 26(ivec2) Load 112(gs_ub2) 121: 26(ivec2) AtomicAnd 111(gs_ua2) 69 70 120 Store 115(out_u2) 121 @@ -979,22 +983,22 @@ local_size = (1, 1, 1) 127: 26(ivec2) AtomicExchange 111(gs_ua2) 69 70 126 Store 115(out_u2) 127 128: 26(ivec2) Load 112(gs_ub2) - 129: 2 AtomicSMax 111(gs_ua2) 69 70 128 + 129: 26(ivec2) AtomicUMax 111(gs_ua2) 69 70 128 130: 26(ivec2) Load 112(gs_ub2) 131: 26(ivec2) AtomicUMax 111(gs_ua2) 69 70 130 Store 115(out_u2) 131 132: 26(ivec2) Load 112(gs_ub2) - 133: 2 AtomicSMin 111(gs_ua2) 69 70 132 + 133: 26(ivec2) AtomicUMin 111(gs_ua2) 69 70 132 134: 26(ivec2) Load 112(gs_ub2) 135: 26(ivec2) AtomicUMin 111(gs_ua2) 69 70 134 Store 115(out_u2) 135 136: 26(ivec2) Load 112(gs_ub2) - 137: 2 AtomicOr 111(gs_ua2) 69 70 136 + 137: 26(ivec2) AtomicOr 111(gs_ua2) 69 70 136 138: 26(ivec2) Load 112(gs_ub2) 139: 26(ivec2) AtomicOr 111(gs_ua2) 69 70 138 Store 115(out_u2) 139 140: 26(ivec2) Load 112(gs_ub2) - 141: 2 AtomicXor 111(gs_ua2) 69 70 140 + 141: 26(ivec2) AtomicXor 111(gs_ua2) 69 70 140 142: 26(ivec2) Load 112(gs_ub2) 143: 26(ivec2) AtomicXor 111(gs_ua2) 69 70 142 Store 115(out_u2) 143 @@ -1012,12 +1016,12 @@ local_size = (1, 1, 1) 152: 150(bvec3) FOrdNotEqual 149 151 153: 61(bool) All 152 157: 38(ivec3) Load 156(gs_ub3) - 158: 2 AtomicIAdd 155(gs_ua3) 69 70 157 + 158: 38(ivec3) AtomicIAdd 155(gs_ua3) 69 70 157 160: 38(ivec3) Load 156(gs_ub3) 161: 38(ivec3) AtomicIAdd 155(gs_ua3) 69 70 160 Store 159(out_u3) 161 162: 38(ivec3) Load 156(gs_ub3) - 163: 2 AtomicAnd 155(gs_ua3) 69 70 162 + 163: 38(ivec3) AtomicAnd 155(gs_ua3) 69 70 162 164: 38(ivec3) Load 156(gs_ub3) 165: 38(ivec3) AtomicAnd 155(gs_ua3) 69 70 164 Store 159(out_u3) 165 @@ -1029,22 +1033,22 @@ local_size = (1, 1, 1) 171: 38(ivec3) AtomicExchange 155(gs_ua3) 69 70 170 Store 159(out_u3) 171 172: 38(ivec3) Load 156(gs_ub3) - 173: 2 AtomicSMax 155(gs_ua3) 69 70 172 + 173: 38(ivec3) AtomicUMax 155(gs_ua3) 69 70 172 174: 38(ivec3) Load 156(gs_ub3) 175: 38(ivec3) AtomicUMax 155(gs_ua3) 69 70 174 Store 159(out_u3) 175 176: 38(ivec3) Load 156(gs_ub3) - 177: 2 AtomicSMin 155(gs_ua3) 69 70 176 + 177: 38(ivec3) AtomicUMin 155(gs_ua3) 69 70 176 178: 38(ivec3) Load 156(gs_ub3) 179: 38(ivec3) AtomicUMin 155(gs_ua3) 69 70 178 Store 159(out_u3) 179 180: 38(ivec3) Load 156(gs_ub3) - 181: 2 AtomicOr 155(gs_ua3) 69 70 180 + 181: 38(ivec3) AtomicOr 155(gs_ua3) 69 70 180 182: 38(ivec3) Load 156(gs_ub3) 183: 38(ivec3) AtomicOr 155(gs_ua3) 69 70 182 Store 159(out_u3) 183 184: 38(ivec3) Load 156(gs_ub3) - 185: 2 AtomicXor 155(gs_ua3) 69 70 184 + 185: 38(ivec3) AtomicXor 155(gs_ua3) 69 70 184 186: 38(ivec3) Load 156(gs_ub3) 187: 38(ivec3) AtomicXor 155(gs_ua3) 69 70 186 Store 159(out_u3) 187 @@ -1062,12 +1066,12 @@ local_size = (1, 1, 1) 195: 193(bvec4) FOrdNotEqual 192 194 196: 61(bool) All 195 200: 50(ivec4) Load 199(gs_ub4) - 201: 2 AtomicIAdd 198(gs_ua4) 69 70 200 + 201: 50(ivec4) AtomicIAdd 198(gs_ua4) 69 70 200 203: 50(ivec4) Load 199(gs_ub4) 204: 50(ivec4) AtomicIAdd 198(gs_ua4) 69 70 203 Store 202(out_u4) 204 205: 50(ivec4) Load 199(gs_ub4) - 206: 2 AtomicAnd 198(gs_ua4) 69 70 205 + 206: 50(ivec4) AtomicAnd 198(gs_ua4) 69 70 205 207: 50(ivec4) Load 199(gs_ub4) 208: 50(ivec4) AtomicAnd 198(gs_ua4) 69 70 207 Store 202(out_u4) 208 @@ -1079,22 +1083,22 @@ local_size = (1, 1, 1) 214: 50(ivec4) AtomicExchange 198(gs_ua4) 69 70 213 Store 202(out_u4) 214 215: 50(ivec4) Load 199(gs_ub4) - 216: 2 AtomicSMax 198(gs_ua4) 69 70 215 + 216: 50(ivec4) AtomicUMax 198(gs_ua4) 69 70 215 217: 50(ivec4) Load 199(gs_ub4) 218: 50(ivec4) AtomicUMax 198(gs_ua4) 69 70 217 Store 202(out_u4) 218 219: 50(ivec4) Load 199(gs_ub4) - 220: 2 AtomicSMin 198(gs_ua4) 69 70 219 + 220: 50(ivec4) AtomicUMin 198(gs_ua4) 69 70 219 221: 50(ivec4) Load 199(gs_ub4) 222: 50(ivec4) AtomicUMin 198(gs_ua4) 69 70 221 Store 202(out_u4) 222 223: 50(ivec4) Load 199(gs_ub4) - 224: 2 AtomicOr 198(gs_ua4) 69 70 223 + 224: 50(ivec4) AtomicOr 198(gs_ua4) 69 70 223 225: 50(ivec4) Load 199(gs_ub4) 226: 50(ivec4) AtomicOr 198(gs_ua4) 69 70 225 Store 202(out_u4) 226 227: 50(ivec4) Load 199(gs_ub4) - 228: 2 AtomicXor 198(gs_ua4) 69 70 227 + 228: 50(ivec4) AtomicXor 198(gs_ua4) 69 70 227 229: 50(ivec4) Load 199(gs_ub4) 230: 50(ivec4) AtomicXor 198(gs_ua4) 69 70 229 Store 202(out_u4) 230 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out index e365b981dfe..970691c5c9e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.d3dcolortoubyte4.frag.out @@ -74,7 +74,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 29 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out index a2e7c5f2fe3..55a102f551b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out @@ -164,7 +164,7 @@ gl_FragCoord origin is upper left 0:? 'inU1b' (layout( location=9) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 90 Capability Shader @@ -231,28 +231,28 @@ gl_FragCoord origin is upper left 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 64 - 7: TypePointer Function 6(float) - 8: TypeVector 6(float) 2 - 9: TypePointer Function 8(fvec2) - 10: TypeVector 6(float) 3 - 11: TypePointer Function 10(fvec3) - 12: TypeVector 6(float) 4 - 13: TypePointer Function 12(fvec4) + 7: TypePointer Function 6(float64_t) + 8: TypeVector 6(float64_t) 2 + 9: TypePointer Function 8(f64vec2) + 10: TypeVector 6(float64_t) 3 + 11: TypePointer Function 10(f64vec3) + 12: TypeVector 6(float64_t) 4 + 13: TypePointer Function 12(f64vec4) 14: TypeInt 32 0 15: TypePointer Function 14(int) 16: TypeFloat 32 17: TypeFunction 16(float) 7(ptr) 7(ptr) 7(ptr) 9(ptr) 11(ptr) 13(ptr) 15(ptr) 15(ptr) 36: TypeVector 14(int) 2 39: 16(float) Constant 0 - 43: TypePointer Input 6(float) + 43: TypePointer Input 6(float64_t) 44(inDV1a): 43(ptr) Variable Input 47(inDV1b): 43(ptr) Variable Input 50(inDV1c): 43(ptr) Variable Input - 53: TypePointer Input 8(fvec2) + 53: TypePointer Input 8(f64vec2) 54(inDV2): 53(ptr) Variable Input - 57: TypePointer Input 10(fvec3) + 57: TypePointer Input 10(f64vec3) 58(inDV3): 57(ptr) Variable Input - 61: TypePointer Input 12(fvec4) + 61: TypePointer Input 12(f64vec4) 62(inDV4): 61(ptr) Variable Input 65: TypePointer Input 14(int) 66(inU1a): 65(ptr) Variable Input @@ -277,33 +277,33 @@ gl_FragCoord origin is upper left 83(param): 13(ptr) Variable Function 85(param): 15(ptr) Variable Function 87(param): 15(ptr) Variable Function - 45: 6(float) Load 44(inDV1a) + 45:6(float64_t) Load 44(inDV1a) Store 42(inDV1a) 45 - 48: 6(float) Load 47(inDV1b) + 48:6(float64_t) Load 47(inDV1b) Store 46(inDV1b) 48 - 51: 6(float) Load 50(inDV1c) + 51:6(float64_t) Load 50(inDV1c) Store 49(inDV1c) 51 - 55: 8(fvec2) Load 54(inDV2) + 55: 8(f64vec2) Load 54(inDV2) Store 52(inDV2) 55 - 59: 10(fvec3) Load 58(inDV3) + 59: 10(f64vec3) Load 58(inDV3) Store 56(inDV3) 59 - 63: 12(fvec4) Load 62(inDV4) + 63: 12(f64vec4) Load 62(inDV4) Store 60(inDV4) 63 67: 14(int) Load 66(inU1a) Store 64(inU1a) 67 70: 14(int) Load 69(inU1b) Store 68(inU1b) 70 - 74: 6(float) Load 42(inDV1a) + 74:6(float64_t) Load 42(inDV1a) Store 73(param) 74 - 76: 6(float) Load 46(inDV1b) + 76:6(float64_t) Load 46(inDV1b) Store 75(param) 76 - 78: 6(float) Load 49(inDV1c) + 78:6(float64_t) Load 49(inDV1c) Store 77(param) 78 - 80: 8(fvec2) Load 52(inDV2) + 80: 8(f64vec2) Load 52(inDV2) Store 79(param) 80 - 82: 10(fvec3) Load 56(inDV3) + 82: 10(f64vec3) Load 56(inDV3) Store 81(param) 82 - 84: 12(fvec4) Load 60(inDV4) + 84: 12(f64vec4) Load 60(inDV4) Store 83(param) 84 86: 14(int) Load 64(inU1a) Store 85(param) 86 @@ -325,15 +325,15 @@ gl_FragCoord origin is upper left 27: Label 28(r00): 7(ptr) Variable Function 33(r01): 7(ptr) Variable Function - 29: 6(float) Load 18(inDV1a) - 30: 6(float) Load 19(inDV1b) - 31: 6(float) Load 20(inDV1c) - 32: 6(float) ExtInst 1(GLSL.std.450) 50(Fma) 29 30 31 + 29:6(float64_t) Load 18(inDV1a) + 30:6(float64_t) Load 19(inDV1b) + 31:6(float64_t) Load 20(inDV1c) + 32:6(float64_t) ExtInst 1(GLSL.std.450) 50(Fma) 29 30 31 Store 28(r00) 32 34: 14(int) Load 24(inU1a) 35: 14(int) Load 25(inU1b) 37: 36(ivec2) CompositeConstruct 34 35 - 38: 6(float) Bitcast 37 + 38:6(float64_t) Bitcast 37 Store 33(r01) 38 ReturnValue 39 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out index 6612451cd5e..4fd1e7b381f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out @@ -153,8 +153,12 @@ gl_FragCoord origin is upper left 0:? 'inF4' (layout( location=3) in 4-component vector of float) 0:? 'inI2' (layout( location=4) flat in 2-component vector of int) +error: SPIRV-Tools Validation Errors +error: GLSL.std.450 InterpolateAtOffset: expected Interpolant storage class to be Input + %28 = OpExtInst %float %1 InterpolateAtOffset %inF1 %27 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 80 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out index 5c6f6ba45d5..c5619efa559 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f1632.frag.out @@ -260,7 +260,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 103 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out index 01c08d23bdd..c447efc4205 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.f3216.frag.out @@ -270,7 +270,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 106 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.frag.out index 105800b2315..20d2bb047a2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.frag.out @@ -2,13 +2,13 @@ hlsl.intrinsics.frag Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:17 Function Definition: PixelShaderFunctionS(f1;f1;f1;u1;u1; ( temp float) +0:17 Function Definition: PixelShaderFunctionS(f1;f1;f1;u1;i1; ( temp float) 0:17 Function Parameters: 0:17 'inF0' ( in float) 0:17 'inF1' ( in float) 0:17 'inF2' ( in float) 0:17 'inU0' ( in uint) -0:17 'inU1' ( in uint) +0:17 'inU1' ( in int) 0:? Sequence 0:20 Sequence 0:20 move second child to first child ( temp bool) @@ -46,7 +46,7 @@ gl_FragCoord origin is upper left 0:26 move second child to first child ( temp uint) 0:26 'r006' ( temp uint) 0:26 floatBitsToUint ( temp uint) -0:26 'inF0' ( in float) +0:26 'inU1' ( in int) 0:27 Sequence 0:27 move second child to first child ( temp float) 0:27 'r007' ( temp float) @@ -142,1110 +142,1104 @@ gl_FragCoord origin is upper left 0:44 'r023' ( temp float) 0:44 degrees ( temp float) 0:44 'inF0' ( in float) -0:48 Sequence -0:48 move second child to first child ( temp float) -0:48 'r027' ( temp float) -0:48 exp ( temp float) -0:48 'inF0' ( in float) +0:45 Sequence +0:45 move second child to first child ( temp float) +0:45 'r024' ( temp float) +0:45 distance ( temp float) +0:45 'inF0' ( in float) +0:45 'inF1' ( in float) 0:49 Sequence 0:49 move second child to first child ( temp float) -0:49 'r028' ( temp float) -0:49 exp2 ( temp float) +0:49 'r027' ( temp float) +0:49 exp ( temp float) 0:49 'inF0' ( in float) 0:50 Sequence -0:50 move second child to first child ( temp uint) -0:50 'r029' ( temp uint) -0:50 Convert int to uint ( temp uint) -0:50 findMSB ( temp int) -0:50 Constant: -0:50 7 (const int) +0:50 move second child to first child ( temp float) +0:50 'r028' ( temp float) +0:50 exp2 ( temp float) +0:50 'inF0' ( in float) 0:51 Sequence 0:51 move second child to first child ( temp uint) -0:51 'r030' ( temp uint) +0:51 'r029' ( temp uint) 0:51 Convert int to uint ( temp uint) -0:51 findLSB ( temp int) +0:51 findMSB ( temp int) 0:51 Constant: 0:51 7 (const int) 0:52 Sequence -0:52 move second child to first child ( temp float) -0:52 'r031' ( temp float) -0:52 Floor ( temp float) -0:52 'inF0' ( in float) -0:54 Sequence -0:54 move second child to first child ( temp float) -0:54 'r033' ( temp float) -0:54 mod ( temp float) -0:54 'inF0' ( in float) -0:54 'inF1' ( in float) +0:52 move second child to first child ( temp uint) +0:52 'r030' ( temp uint) +0:52 Convert int to uint ( temp uint) +0:52 findLSB ( temp int) +0:52 Constant: +0:52 7 (const int) +0:53 Sequence +0:53 move second child to first child ( temp float) +0:53 'r031' ( temp float) +0:53 Floor ( temp float) +0:53 'inF0' ( in float) 0:55 Sequence 0:55 move second child to first child ( temp float) -0:55 'r034' ( temp float) -0:55 Fraction ( temp float) +0:55 'r033' ( temp float) +0:55 mod ( temp float) 0:55 'inF0' ( in float) +0:55 'inF1' ( in float) 0:56 Sequence 0:56 move second child to first child ( temp float) -0:56 'r036' ( temp float) -0:56 fwidth ( temp float) +0:56 'r034' ( temp float) +0:56 Fraction ( temp float) 0:56 'inF0' ( in float) 0:57 Sequence -0:57 move second child to first child ( temp bool) -0:57 'r037' ( temp bool) -0:57 isinf ( temp bool) +0:57 move second child to first child ( temp float) +0:57 'r036' ( temp float) +0:57 fwidth ( temp float) 0:57 'inF0' ( in float) 0:58 Sequence 0:58 move second child to first child ( temp bool) -0:58 'r038' ( temp bool) -0:58 isnan ( temp bool) +0:58 'r037' ( temp bool) +0:58 isinf ( temp bool) 0:58 'inF0' ( in float) 0:59 Sequence -0:59 move second child to first child ( temp float) -0:59 'r039' ( temp float) -0:59 ldexp ( temp float) +0:59 move second child to first child ( temp bool) +0:59 'r038' ( temp bool) +0:59 isnan ( temp bool) 0:59 'inF0' ( in float) -0:59 'inF1' ( in float) 0:60 Sequence 0:60 move second child to first child ( temp float) -0:60 'r039a' ( temp float) -0:60 mix ( temp float) +0:60 'r039' ( temp float) +0:60 ldexp ( temp float) 0:60 'inF0' ( in float) 0:60 'inF1' ( in float) -0:60 'inF2' ( in float) 0:61 Sequence 0:61 move second child to first child ( temp float) -0:61 'r040' ( temp float) -0:61 log ( temp float) +0:61 'r039a' ( temp float) +0:61 mix ( temp float) 0:61 'inF0' ( in float) +0:61 'inF1' ( in float) +0:61 'inF2' ( in float) 0:62 Sequence 0:62 move second child to first child ( temp float) -0:62 'r041' ( temp float) -0:62 component-wise multiply ( temp float) -0:62 log2 ( temp float) -0:62 'inF0' ( in float) -0:62 Constant: -0:62 0.301030 +0:62 'r040' ( temp float) +0:62 log ( temp float) +0:62 'inF0' ( in float) 0:63 Sequence 0:63 move second child to first child ( temp float) -0:63 'r042' ( temp float) -0:63 log2 ( temp float) -0:63 'inF0' ( in float) +0:63 'r041' ( temp float) +0:63 component-wise multiply ( temp float) +0:63 log2 ( temp float) +0:63 'inF0' ( in float) +0:63 Constant: +0:63 0.301030 0:64 Sequence 0:64 move second child to first child ( temp float) -0:64 'r043' ( temp float) -0:64 max ( temp float) +0:64 'r042' ( temp float) +0:64 log2 ( temp float) 0:64 'inF0' ( in float) -0:64 'inF1' ( in float) 0:65 Sequence 0:65 move second child to first child ( temp float) -0:65 'r044' ( temp float) -0:65 min ( temp float) +0:65 'r043' ( temp float) +0:65 max ( temp float) 0:65 'inF0' ( in float) 0:65 'inF1' ( in float) 0:66 Sequence 0:66 move second child to first child ( temp float) -0:66 'r045' ( temp float) -0:66 pow ( temp float) +0:66 'r044' ( temp float) +0:66 min ( temp float) 0:66 'inF0' ( in float) 0:66 'inF1' ( in float) 0:67 Sequence 0:67 move second child to first child ( temp float) -0:67 'r046' ( temp float) -0:67 radians ( temp float) +0:67 'r045' ( temp float) +0:67 pow ( temp float) 0:67 'inF0' ( in float) +0:67 'inF1' ( in float) 0:68 Sequence 0:68 move second child to first child ( temp float) -0:68 'r047' ( temp float) -0:68 divide ( temp float) -0:68 Constant: -0:68 1.000000 +0:68 'r046' ( temp float) +0:68 radians ( temp float) 0:68 'inF0' ( in float) 0:69 Sequence -0:69 move second child to first child ( temp uint) -0:69 'r048' ( temp uint) -0:69 Convert int to uint ( temp uint) -0:69 bitFieldReverse ( temp int) -0:69 Constant: -0:69 2 (const int) +0:69 move second child to first child ( temp float) +0:69 'r047' ( temp float) +0:69 divide ( temp float) +0:69 Constant: +0:69 1.000000 +0:69 'inF0' ( in float) 0:70 Sequence -0:70 move second child to first child ( temp float) -0:70 'r049' ( temp float) -0:70 roundEven ( temp float) -0:70 'inF0' ( in float) +0:70 move second child to first child ( temp uint) +0:70 'r048' ( temp uint) +0:70 Convert int to uint ( temp uint) +0:70 bitFieldReverse ( temp int) +0:70 Constant: +0:70 2 (const int) 0:71 Sequence 0:71 move second child to first child ( temp float) -0:71 'r050' ( temp float) -0:71 inverse sqrt ( temp float) +0:71 'r049' ( temp float) +0:71 roundEven ( temp float) 0:71 'inF0' ( in float) 0:72 Sequence 0:72 move second child to first child ( temp float) -0:72 'r051' ( temp float) -0:72 clamp ( temp float) +0:72 'r050' ( temp float) +0:72 inverse sqrt ( temp float) 0:72 'inF0' ( in float) -0:72 Constant: -0:72 0.000000 -0:72 Constant: -0:72 1.000000 0:73 Sequence 0:73 move second child to first child ( temp float) -0:73 'r052' ( temp float) -0:73 Sign ( temp float) +0:73 'r051' ( temp float) +0:73 clamp ( temp float) 0:73 'inF0' ( in float) +0:73 Constant: +0:73 0.000000 +0:73 Constant: +0:73 1.000000 0:74 Sequence 0:74 move second child to first child ( temp float) -0:74 'r053' ( temp float) -0:74 sine ( temp float) +0:74 'r052' ( temp float) +0:74 Sign ( temp float) 0:74 'inF0' ( in float) 0:75 Sequence 0:75 move second child to first child ( temp float) -0:75 'inF1' ( in float) +0:75 'r053' ( temp float) 0:75 sine ( temp float) 0:75 'inF0' ( in float) -0:75 move second child to first child ( temp float) -0:75 'inF2' ( in float) -0:75 cosine ( temp float) -0:75 'inF0' ( in float) 0:76 Sequence 0:76 move second child to first child ( temp float) -0:76 'r055' ( temp float) -0:76 hyp. sine ( temp float) +0:76 'inF1' ( in float) +0:76 sine ( temp float) +0:76 'inF0' ( in float) +0:76 move second child to first child ( temp float) +0:76 'inF2' ( in float) +0:76 cosine ( temp float) 0:76 'inF0' ( in float) 0:77 Sequence 0:77 move second child to first child ( temp float) -0:77 'r056' ( temp float) -0:77 smoothstep ( temp float) +0:77 'r055' ( temp float) +0:77 hyp. sine ( temp float) 0:77 'inF0' ( in float) -0:77 'inF1' ( in float) -0:77 'inF2' ( in float) 0:78 Sequence 0:78 move second child to first child ( temp float) -0:78 'r057' ( temp float) -0:78 sqrt ( temp float) +0:78 'r056' ( temp float) +0:78 smoothstep ( temp float) 0:78 'inF0' ( in float) +0:78 'inF1' ( in float) +0:78 'inF2' ( in float) 0:79 Sequence 0:79 move second child to first child ( temp float) -0:79 'r058' ( temp float) -0:79 step ( temp float) +0:79 'r057' ( temp float) +0:79 sqrt ( temp float) 0:79 'inF0' ( in float) -0:79 'inF1' ( in float) 0:80 Sequence 0:80 move second child to first child ( temp float) -0:80 'r059' ( temp float) -0:80 tangent ( temp float) +0:80 'r058' ( temp float) +0:80 step ( temp float) 0:80 'inF0' ( in float) +0:80 'inF1' ( in float) 0:81 Sequence 0:81 move second child to first child ( temp float) -0:81 'r060' ( temp float) -0:81 hyp. tangent ( temp float) +0:81 'r059' ( temp float) +0:81 tangent ( temp float) 0:81 'inF0' ( in float) -0:83 Sequence -0:83 move second child to first child ( temp float) -0:83 'r061' ( temp float) -0:83 trunc ( temp float) -0:83 'inF0' ( in float) -0:85 Branch: Return with expression -0:85 Constant: -0:85 0.000000 -0:89 Function Definition: PixelShaderFunction1(vf1;vf1;vf1; ( temp 1-component vector of float) -0:89 Function Parameters: -0:89 'inF0' ( in 1-component vector of float) -0:89 'inF1' ( in 1-component vector of float) -0:89 'inF2' ( in 1-component vector of float) +0:82 Sequence +0:82 move second child to first child ( temp float) +0:82 'r060' ( temp float) +0:82 hyp. tangent ( temp float) +0:82 'inF0' ( in float) +0:84 Sequence +0:84 move second child to first child ( temp float) +0:84 'r061' ( temp float) +0:84 trunc ( temp float) +0:84 'inF0' ( in float) +0:86 Branch: Return with expression +0:86 Constant: +0:86 0.000000 +0:90 Function Definition: PixelShaderFunction1(vf1;vf1;vf1; ( temp 1-component vector of float) +0:90 Function Parameters: +0:90 'inF0' ( in 1-component vector of float) +0:90 'inF1' ( in 1-component vector of float) +0:90 'inF2' ( in 1-component vector of float) 0:? Sequence -0:91 Branch: Return with expression -0:91 Constant: -0:91 0.000000 -0:95 Function Definition: PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2; ( temp 2-component vector of float) -0:95 Function Parameters: -0:95 'inF0' ( in 2-component vector of float) -0:95 'inF1' ( in 2-component vector of float) -0:95 'inF2' ( in 2-component vector of float) -0:95 'inU0' ( in 2-component vector of uint) -0:95 'inU1' ( in 2-component vector of uint) +0:92 Branch: Return with expression +0:92 Constant: +0:92 0.000000 +0:96 Function Definition: PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2; ( temp 2-component vector of float) +0:96 Function Parameters: +0:96 'inF0' ( in 2-component vector of float) +0:96 'inF1' ( in 2-component vector of float) +0:96 'inF2' ( in 2-component vector of float) +0:96 'inU0' ( in 2-component vector of uint) +0:96 'inU1' ( in 2-component vector of uint) 0:? Sequence -0:98 Sequence -0:98 move second child to first child ( temp bool) -0:98 'r000' ( temp bool) -0:98 all ( temp bool) -0:98 Convert float to bool ( temp 2-component vector of bool) -0:98 'inF0' ( in 2-component vector of float) 0:99 Sequence -0:99 move second child to first child ( temp 2-component vector of float) -0:99 'r001' ( temp 2-component vector of float) -0:99 Absolute value ( temp 2-component vector of float) -0:99 'inF0' ( in 2-component vector of float) +0:99 move second child to first child ( temp bool) +0:99 'r000' ( temp bool) +0:99 all ( temp bool) +0:99 Convert float to bool ( temp 2-component vector of bool) +0:99 'inF0' ( in 2-component vector of float) 0:100 Sequence 0:100 move second child to first child ( temp 2-component vector of float) -0:100 'r002' ( temp 2-component vector of float) -0:100 arc cosine ( temp 2-component vector of float) +0:100 'r001' ( temp 2-component vector of float) +0:100 Absolute value ( temp 2-component vector of float) 0:100 'inF0' ( in 2-component vector of float) 0:101 Sequence -0:101 move second child to first child ( temp bool) -0:101 'r003' ( temp bool) -0:101 any ( temp bool) -0:101 Convert float to bool ( temp 2-component vector of bool) -0:101 'inF0' ( in 2-component vector of float) +0:101 move second child to first child ( temp 2-component vector of float) +0:101 'r002' ( temp 2-component vector of float) +0:101 arc cosine ( temp 2-component vector of float) +0:101 'inF0' ( in 2-component vector of float) 0:102 Sequence -0:102 move second child to first child ( temp 2-component vector of float) -0:102 'r004' ( temp 2-component vector of float) -0:102 arc sine ( temp 2-component vector of float) -0:102 'inF0' ( in 2-component vector of float) +0:102 move second child to first child ( temp bool) +0:102 'r003' ( temp bool) +0:102 any ( temp bool) +0:102 Convert float to bool ( temp 2-component vector of bool) +0:102 'inF0' ( in 2-component vector of float) 0:103 Sequence -0:103 move second child to first child ( temp 2-component vector of int) -0:103 'r005' ( temp 2-component vector of int) -0:103 floatBitsToInt ( temp 2-component vector of int) +0:103 move second child to first child ( temp 2-component vector of float) +0:103 'r004' ( temp 2-component vector of float) +0:103 arc sine ( temp 2-component vector of float) 0:103 'inF0' ( in 2-component vector of float) 0:104 Sequence -0:104 move second child to first child ( temp 2-component vector of uint) -0:104 'r006' ( temp 2-component vector of uint) -0:104 floatBitsToUint ( temp 2-component vector of uint) +0:104 move second child to first child ( temp 2-component vector of int) +0:104 'r005' ( temp 2-component vector of int) +0:104 floatBitsToInt ( temp 2-component vector of int) 0:104 'inF0' ( in 2-component vector of float) 0:105 Sequence -0:105 move second child to first child ( temp 2-component vector of float) -0:105 'r007' ( temp 2-component vector of float) -0:105 intBitsToFloat ( temp 2-component vector of float) -0:105 'inU0' ( in 2-component vector of uint) -0:107 Sequence -0:107 move second child to first child ( temp 2-component vector of float) -0:107 'r009' ( temp 2-component vector of float) -0:107 arc tangent ( temp 2-component vector of float) -0:107 'inF0' ( in 2-component vector of float) +0:105 move second child to first child ( temp 2-component vector of uint) +0:105 'r006' ( temp 2-component vector of uint) +0:105 floatBitsToUint ( temp 2-component vector of uint) +0:105 'inF0' ( in 2-component vector of float) +0:106 Sequence +0:106 move second child to first child ( temp 2-component vector of float) +0:106 'r007' ( temp 2-component vector of float) +0:106 intBitsToFloat ( temp 2-component vector of float) +0:106 'inU0' ( in 2-component vector of uint) 0:108 Sequence 0:108 move second child to first child ( temp 2-component vector of float) -0:108 'r010' ( temp 2-component vector of float) +0:108 'r009' ( temp 2-component vector of float) 0:108 arc tangent ( temp 2-component vector of float) 0:108 'inF0' ( in 2-component vector of float) -0:108 'inF1' ( in 2-component vector of float) 0:109 Sequence 0:109 move second child to first child ( temp 2-component vector of float) -0:109 'r011' ( temp 2-component vector of float) -0:109 Ceiling ( temp 2-component vector of float) +0:109 'r010' ( temp 2-component vector of float) +0:109 arc tangent ( temp 2-component vector of float) 0:109 'inF0' ( in 2-component vector of float) +0:109 'inF1' ( in 2-component vector of float) 0:110 Sequence 0:110 move second child to first child ( temp 2-component vector of float) -0:110 'r012' ( temp 2-component vector of float) -0:110 clamp ( temp 2-component vector of float) +0:110 'r011' ( temp 2-component vector of float) +0:110 Ceiling ( temp 2-component vector of float) 0:110 'inF0' ( in 2-component vector of float) -0:110 'inF1' ( in 2-component vector of float) -0:110 'inF2' ( in 2-component vector of float) -0:111 Test condition and select ( temp void) -0:111 Condition -0:111 any ( temp bool) -0:111 Compare Less Than ( temp 2-component vector of bool) +0:111 Sequence +0:111 move second child to first child ( temp 2-component vector of float) +0:111 'r012' ( temp 2-component vector of float) +0:111 clamp ( temp 2-component vector of float) 0:111 'inF0' ( in 2-component vector of float) -0:111 Constant: -0:111 0.000000 -0:111 0.000000 -0:111 true case -0:111 Branch: Kill +0:111 'inF1' ( in 2-component vector of float) +0:111 'inF2' ( in 2-component vector of float) 0:112 Test condition and select ( temp void) 0:112 Condition 0:112 any ( temp bool) 0:112 Compare Less Than ( temp 2-component vector of bool) -0:112 'inU0' ( in 2-component vector of uint) +0:112 'inF0' ( in 2-component vector of float) 0:112 Constant: 0:112 0.000000 0:112 0.000000 0:112 true case 0:112 Branch: Kill -0:113 Sequence -0:113 move second child to first child ( temp 2-component vector of float) -0:113 'r013' ( temp 2-component vector of float) -0:113 cosine ( temp 2-component vector of float) -0:113 'inF0' ( in 2-component vector of float) +0:113 Test condition and select ( temp void) +0:113 Condition +0:113 any ( temp bool) +0:113 Compare Less Than ( temp 2-component vector of bool) +0:113 'inU0' ( in 2-component vector of uint) +0:113 Constant: +0:113 0.000000 +0:113 0.000000 +0:113 true case +0:113 Branch: Kill 0:114 Sequence 0:114 move second child to first child ( temp 2-component vector of float) -0:114 'r015' ( temp 2-component vector of float) -0:114 hyp. cosine ( temp 2-component vector of float) +0:114 'r013' ( temp 2-component vector of float) +0:114 cosine ( temp 2-component vector of float) 0:114 'inF0' ( in 2-component vector of float) 0:115 Sequence -0:115 move second child to first child ( temp 2-component vector of int) -0:115 'r016' ( temp 2-component vector of int) +0:115 move second child to first child ( temp 2-component vector of float) +0:115 'r015' ( temp 2-component vector of float) +0:115 hyp. cosine ( temp 2-component vector of float) +0:115 'inF0' ( in 2-component vector of float) +0:116 Sequence +0:116 move second child to first child ( temp 2-component vector of int) +0:116 'r016' ( temp 2-component vector of int) 0:? bitCount ( temp 2-component vector of int) 0:? Constant: 0:? 7 (const int) 0:? 3 (const int) -0:116 Sequence -0:116 move second child to first child ( temp 2-component vector of float) -0:116 'r017' ( temp 2-component vector of float) -0:116 dPdx ( temp 2-component vector of float) -0:116 'inF0' ( in 2-component vector of float) 0:117 Sequence 0:117 move second child to first child ( temp 2-component vector of float) -0:117 'r018' ( temp 2-component vector of float) -0:117 dPdxCoarse ( temp 2-component vector of float) +0:117 'r017' ( temp 2-component vector of float) +0:117 dPdx ( temp 2-component vector of float) 0:117 'inF0' ( in 2-component vector of float) 0:118 Sequence 0:118 move second child to first child ( temp 2-component vector of float) -0:118 'r019' ( temp 2-component vector of float) -0:118 dPdxFine ( temp 2-component vector of float) +0:118 'r018' ( temp 2-component vector of float) +0:118 dPdxCoarse ( temp 2-component vector of float) 0:118 'inF0' ( in 2-component vector of float) 0:119 Sequence 0:119 move second child to first child ( temp 2-component vector of float) -0:119 'r020' ( temp 2-component vector of float) -0:119 dPdy ( temp 2-component vector of float) +0:119 'r019' ( temp 2-component vector of float) +0:119 dPdxFine ( temp 2-component vector of float) 0:119 'inF0' ( in 2-component vector of float) 0:120 Sequence 0:120 move second child to first child ( temp 2-component vector of float) -0:120 'r021' ( temp 2-component vector of float) -0:120 dPdyCoarse ( temp 2-component vector of float) +0:120 'r020' ( temp 2-component vector of float) +0:120 dPdy ( temp 2-component vector of float) 0:120 'inF0' ( in 2-component vector of float) 0:121 Sequence 0:121 move second child to first child ( temp 2-component vector of float) -0:121 'r022' ( temp 2-component vector of float) -0:121 dPdyFine ( temp 2-component vector of float) +0:121 'r021' ( temp 2-component vector of float) +0:121 dPdyCoarse ( temp 2-component vector of float) 0:121 'inF0' ( in 2-component vector of float) 0:122 Sequence 0:122 move second child to first child ( temp 2-component vector of float) -0:122 'r023' ( temp 2-component vector of float) -0:122 degrees ( temp 2-component vector of float) +0:122 'r022' ( temp 2-component vector of float) +0:122 dPdyFine ( temp 2-component vector of float) 0:122 'inF0' ( in 2-component vector of float) -0:126 Sequence -0:126 move second child to first child ( temp float) -0:126 'r026' ( temp float) -0:126 distance ( temp float) -0:126 'inF0' ( in 2-component vector of float) -0:126 'inF1' ( in 2-component vector of float) +0:123 Sequence +0:123 move second child to first child ( temp 2-component vector of float) +0:123 'r023' ( temp 2-component vector of float) +0:123 degrees ( temp 2-component vector of float) +0:123 'inF0' ( in 2-component vector of float) 0:127 Sequence 0:127 move second child to first child ( temp float) -0:127 'r027' ( temp float) -0:127 dot-product ( temp float) +0:127 'r026' ( temp float) +0:127 distance ( temp float) 0:127 'inF0' ( in 2-component vector of float) 0:127 'inF1' ( in 2-component vector of float) -0:131 Sequence -0:131 move second child to first child ( temp 2-component vector of float) -0:131 'r028' ( temp 2-component vector of float) -0:131 exp ( temp 2-component vector of float) -0:131 'inF0' ( in 2-component vector of float) +0:128 Sequence +0:128 move second child to first child ( temp float) +0:128 'r027' ( temp float) +0:128 dot-product ( temp float) +0:128 'inF0' ( in 2-component vector of float) +0:128 'inF1' ( in 2-component vector of float) 0:132 Sequence 0:132 move second child to first child ( temp 2-component vector of float) -0:132 'r029' ( temp 2-component vector of float) -0:132 exp2 ( temp 2-component vector of float) +0:132 'r028' ( temp 2-component vector of float) +0:132 exp ( temp 2-component vector of float) 0:132 'inF0' ( in 2-component vector of float) 0:133 Sequence 0:133 move second child to first child ( temp 2-component vector of float) -0:133 'r030' ( temp 2-component vector of float) -0:133 face-forward ( temp 2-component vector of float) +0:133 'r029' ( temp 2-component vector of float) +0:133 exp2 ( temp 2-component vector of float) 0:133 'inF0' ( in 2-component vector of float) -0:133 'inF1' ( in 2-component vector of float) -0:133 'inF2' ( in 2-component vector of float) 0:134 Sequence -0:134 move second child to first child ( temp 2-component vector of uint) -0:134 'r031' ( temp 2-component vector of uint) +0:134 move second child to first child ( temp 2-component vector of float) +0:134 'r030' ( temp 2-component vector of float) +0:134 face-forward ( temp 2-component vector of float) +0:134 'inF0' ( in 2-component vector of float) +0:134 'inF1' ( in 2-component vector of float) +0:134 'inF2' ( in 2-component vector of float) +0:135 Sequence +0:135 move second child to first child ( temp 2-component vector of uint) +0:135 'r031' ( temp 2-component vector of uint) 0:? findMSB ( temp 2-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) -0:135 Sequence -0:135 move second child to first child ( temp 2-component vector of uint) -0:135 'r032' ( temp 2-component vector of uint) +0:136 Sequence +0:136 move second child to first child ( temp 2-component vector of uint) +0:136 'r032' ( temp 2-component vector of uint) 0:? findLSB ( temp 2-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) -0:136 Sequence -0:136 move second child to first child ( temp 2-component vector of float) -0:136 'r033' ( temp 2-component vector of float) -0:136 Floor ( temp 2-component vector of float) -0:136 'inF0' ( in 2-component vector of float) -0:138 Sequence -0:138 move second child to first child ( temp 2-component vector of float) -0:138 'r035' ( temp 2-component vector of float) -0:138 mod ( temp 2-component vector of float) -0:138 'inF0' ( in 2-component vector of float) -0:138 'inF1' ( in 2-component vector of float) +0:137 Sequence +0:137 move second child to first child ( temp 2-component vector of float) +0:137 'r033' ( temp 2-component vector of float) +0:137 Floor ( temp 2-component vector of float) +0:137 'inF0' ( in 2-component vector of float) 0:139 Sequence 0:139 move second child to first child ( temp 2-component vector of float) -0:139 'r036' ( temp 2-component vector of float) -0:139 Fraction ( temp 2-component vector of float) +0:139 'r035' ( temp 2-component vector of float) +0:139 mod ( temp 2-component vector of float) 0:139 'inF0' ( in 2-component vector of float) +0:139 'inF1' ( in 2-component vector of float) 0:140 Sequence 0:140 move second child to first child ( temp 2-component vector of float) -0:140 'r038' ( temp 2-component vector of float) -0:140 fwidth ( temp 2-component vector of float) +0:140 'r036' ( temp 2-component vector of float) +0:140 Fraction ( temp 2-component vector of float) 0:140 'inF0' ( in 2-component vector of float) 0:141 Sequence -0:141 move second child to first child ( temp 2-component vector of bool) -0:141 'r039' ( temp 2-component vector of bool) -0:141 isinf ( temp 2-component vector of bool) +0:141 move second child to first child ( temp 2-component vector of float) +0:141 'r038' ( temp 2-component vector of float) +0:141 fwidth ( temp 2-component vector of float) 0:141 'inF0' ( in 2-component vector of float) 0:142 Sequence 0:142 move second child to first child ( temp 2-component vector of bool) -0:142 'r040' ( temp 2-component vector of bool) -0:142 isnan ( temp 2-component vector of bool) +0:142 'r039' ( temp 2-component vector of bool) +0:142 isinf ( temp 2-component vector of bool) 0:142 'inF0' ( in 2-component vector of float) 0:143 Sequence -0:143 move second child to first child ( temp 2-component vector of float) -0:143 'r041' ( temp 2-component vector of float) -0:143 ldexp ( temp 2-component vector of float) +0:143 move second child to first child ( temp 2-component vector of bool) +0:143 'r040' ( temp 2-component vector of bool) +0:143 isnan ( temp 2-component vector of bool) 0:143 'inF0' ( in 2-component vector of float) -0:143 'inF1' ( in 2-component vector of float) 0:144 Sequence 0:144 move second child to first child ( temp 2-component vector of float) -0:144 'r039a' ( temp 2-component vector of float) -0:144 mix ( temp 2-component vector of float) +0:144 'r041' ( temp 2-component vector of float) +0:144 ldexp ( temp 2-component vector of float) 0:144 'inF0' ( in 2-component vector of float) 0:144 'inF1' ( in 2-component vector of float) -0:144 'inF2' ( in 2-component vector of float) 0:145 Sequence -0:145 move second child to first child ( temp float) -0:145 'r042' ( temp float) -0:145 length ( temp float) +0:145 move second child to first child ( temp 2-component vector of float) +0:145 'r039a' ( temp 2-component vector of float) +0:145 mix ( temp 2-component vector of float) 0:145 'inF0' ( in 2-component vector of float) +0:145 'inF1' ( in 2-component vector of float) +0:145 'inF2' ( in 2-component vector of float) 0:146 Sequence -0:146 move second child to first child ( temp 2-component vector of float) -0:146 'r043' ( temp 2-component vector of float) -0:146 log ( temp 2-component vector of float) +0:146 move second child to first child ( temp float) +0:146 'r042' ( temp float) +0:146 length ( temp float) 0:146 'inF0' ( in 2-component vector of float) 0:147 Sequence 0:147 move second child to first child ( temp 2-component vector of float) -0:147 'r044' ( temp 2-component vector of float) -0:147 vector-scale ( temp 2-component vector of float) -0:147 log2 ( temp 2-component vector of float) -0:147 'inF0' ( in 2-component vector of float) -0:147 Constant: -0:147 0.301030 +0:147 'r043' ( temp 2-component vector of float) +0:147 log ( temp 2-component vector of float) +0:147 'inF0' ( in 2-component vector of float) 0:148 Sequence 0:148 move second child to first child ( temp 2-component vector of float) -0:148 'r045' ( temp 2-component vector of float) -0:148 log2 ( temp 2-component vector of float) -0:148 'inF0' ( in 2-component vector of float) +0:148 'r044' ( temp 2-component vector of float) +0:148 vector-scale ( temp 2-component vector of float) +0:148 log2 ( temp 2-component vector of float) +0:148 'inF0' ( in 2-component vector of float) +0:148 Constant: +0:148 0.301030 0:149 Sequence 0:149 move second child to first child ( temp 2-component vector of float) -0:149 'r046' ( temp 2-component vector of float) -0:149 max ( temp 2-component vector of float) +0:149 'r045' ( temp 2-component vector of float) +0:149 log2 ( temp 2-component vector of float) 0:149 'inF0' ( in 2-component vector of float) -0:149 'inF1' ( in 2-component vector of float) 0:150 Sequence 0:150 move second child to first child ( temp 2-component vector of float) -0:150 'r047' ( temp 2-component vector of float) -0:150 min ( temp 2-component vector of float) +0:150 'r046' ( temp 2-component vector of float) +0:150 max ( temp 2-component vector of float) 0:150 'inF0' ( in 2-component vector of float) 0:150 'inF1' ( in 2-component vector of float) 0:151 Sequence 0:151 move second child to first child ( temp 2-component vector of float) -0:151 'r048' ( temp 2-component vector of float) -0:151 normalize ( temp 2-component vector of float) +0:151 'r047' ( temp 2-component vector of float) +0:151 min ( temp 2-component vector of float) 0:151 'inF0' ( in 2-component vector of float) +0:151 'inF1' ( in 2-component vector of float) 0:152 Sequence 0:152 move second child to first child ( temp 2-component vector of float) -0:152 'r049' ( temp 2-component vector of float) -0:152 pow ( temp 2-component vector of float) +0:152 'r048' ( temp 2-component vector of float) +0:152 normalize ( temp 2-component vector of float) 0:152 'inF0' ( in 2-component vector of float) -0:152 'inF1' ( in 2-component vector of float) 0:153 Sequence 0:153 move second child to first child ( temp 2-component vector of float) -0:153 'r050' ( temp 2-component vector of float) -0:153 radians ( temp 2-component vector of float) +0:153 'r049' ( temp 2-component vector of float) +0:153 pow ( temp 2-component vector of float) 0:153 'inF0' ( in 2-component vector of float) +0:153 'inF1' ( in 2-component vector of float) 0:154 Sequence 0:154 move second child to first child ( temp 2-component vector of float) -0:154 'r051' ( temp 2-component vector of float) -0:154 divide ( temp 2-component vector of float) -0:154 Constant: -0:154 1.000000 +0:154 'r050' ( temp 2-component vector of float) +0:154 radians ( temp 2-component vector of float) 0:154 'inF0' ( in 2-component vector of float) 0:155 Sequence 0:155 move second child to first child ( temp 2-component vector of float) -0:155 'r052' ( temp 2-component vector of float) -0:155 reflect ( temp 2-component vector of float) +0:155 'r051' ( temp 2-component vector of float) +0:155 divide ( temp 2-component vector of float) +0:155 Constant: +0:155 1.000000 0:155 'inF0' ( in 2-component vector of float) -0:155 'inF1' ( in 2-component vector of float) 0:156 Sequence 0:156 move second child to first child ( temp 2-component vector of float) -0:156 'r053' ( temp 2-component vector of float) -0:156 refract ( temp 2-component vector of float) +0:156 'r052' ( temp 2-component vector of float) +0:156 reflect ( temp 2-component vector of float) 0:156 'inF0' ( in 2-component vector of float) 0:156 'inF1' ( in 2-component vector of float) -0:156 Constant: -0:156 2.000000 0:157 Sequence -0:157 move second child to first child ( temp 2-component vector of uint) -0:157 'r054' ( temp 2-component vector of uint) +0:157 move second child to first child ( temp 2-component vector of float) +0:157 'r053' ( temp 2-component vector of float) +0:157 refract ( temp 2-component vector of float) +0:157 'inF0' ( in 2-component vector of float) +0:157 'inF1' ( in 2-component vector of float) +0:157 Constant: +0:157 2.000000 +0:158 Sequence +0:158 move second child to first child ( temp 2-component vector of uint) +0:158 'r054' ( temp 2-component vector of uint) 0:? bitFieldReverse ( temp 2-component vector of uint) 0:? Constant: 0:? 1 (const uint) 0:? 2 (const uint) -0:158 Sequence -0:158 move second child to first child ( temp 2-component vector of float) -0:158 'r055' ( temp 2-component vector of float) -0:158 roundEven ( temp 2-component vector of float) -0:158 'inF0' ( in 2-component vector of float) 0:159 Sequence 0:159 move second child to first child ( temp 2-component vector of float) -0:159 'r056' ( temp 2-component vector of float) -0:159 inverse sqrt ( temp 2-component vector of float) +0:159 'r055' ( temp 2-component vector of float) +0:159 roundEven ( temp 2-component vector of float) 0:159 'inF0' ( in 2-component vector of float) 0:160 Sequence 0:160 move second child to first child ( temp 2-component vector of float) -0:160 'r057' ( temp 2-component vector of float) -0:160 clamp ( temp 2-component vector of float) +0:160 'r056' ( temp 2-component vector of float) +0:160 inverse sqrt ( temp 2-component vector of float) 0:160 'inF0' ( in 2-component vector of float) -0:160 Constant: -0:160 0.000000 -0:160 Constant: -0:160 1.000000 0:161 Sequence 0:161 move second child to first child ( temp 2-component vector of float) -0:161 'r058' ( temp 2-component vector of float) -0:161 Sign ( temp 2-component vector of float) +0:161 'r057' ( temp 2-component vector of float) +0:161 clamp ( temp 2-component vector of float) 0:161 'inF0' ( in 2-component vector of float) +0:161 Constant: +0:161 0.000000 +0:161 Constant: +0:161 1.000000 0:162 Sequence 0:162 move second child to first child ( temp 2-component vector of float) -0:162 'r059' ( temp 2-component vector of float) -0:162 sine ( temp 2-component vector of float) +0:162 'r058' ( temp 2-component vector of float) +0:162 Sign ( temp 2-component vector of float) 0:162 'inF0' ( in 2-component vector of float) 0:163 Sequence 0:163 move second child to first child ( temp 2-component vector of float) -0:163 'inF1' ( in 2-component vector of float) +0:163 'r059' ( temp 2-component vector of float) 0:163 sine ( temp 2-component vector of float) 0:163 'inF0' ( in 2-component vector of float) -0:163 move second child to first child ( temp 2-component vector of float) -0:163 'inF2' ( in 2-component vector of float) -0:163 cosine ( temp 2-component vector of float) -0:163 'inF0' ( in 2-component vector of float) 0:164 Sequence 0:164 move second child to first child ( temp 2-component vector of float) -0:164 'r060' ( temp 2-component vector of float) -0:164 hyp. sine ( temp 2-component vector of float) +0:164 'inF1' ( in 2-component vector of float) +0:164 sine ( temp 2-component vector of float) +0:164 'inF0' ( in 2-component vector of float) +0:164 move second child to first child ( temp 2-component vector of float) +0:164 'inF2' ( in 2-component vector of float) +0:164 cosine ( temp 2-component vector of float) 0:164 'inF0' ( in 2-component vector of float) 0:165 Sequence 0:165 move second child to first child ( temp 2-component vector of float) -0:165 'r061' ( temp 2-component vector of float) -0:165 smoothstep ( temp 2-component vector of float) +0:165 'r060' ( temp 2-component vector of float) +0:165 hyp. sine ( temp 2-component vector of float) 0:165 'inF0' ( in 2-component vector of float) -0:165 'inF1' ( in 2-component vector of float) -0:165 'inF2' ( in 2-component vector of float) 0:166 Sequence 0:166 move second child to first child ( temp 2-component vector of float) -0:166 'r062' ( temp 2-component vector of float) -0:166 sqrt ( temp 2-component vector of float) +0:166 'r061' ( temp 2-component vector of float) +0:166 smoothstep ( temp 2-component vector of float) 0:166 'inF0' ( in 2-component vector of float) +0:166 'inF1' ( in 2-component vector of float) +0:166 'inF2' ( in 2-component vector of float) 0:167 Sequence 0:167 move second child to first child ( temp 2-component vector of float) -0:167 'r063' ( temp 2-component vector of float) -0:167 step ( temp 2-component vector of float) +0:167 'r062' ( temp 2-component vector of float) +0:167 sqrt ( temp 2-component vector of float) 0:167 'inF0' ( in 2-component vector of float) -0:167 'inF1' ( in 2-component vector of float) 0:168 Sequence 0:168 move second child to first child ( temp 2-component vector of float) -0:168 'r064' ( temp 2-component vector of float) -0:168 tangent ( temp 2-component vector of float) +0:168 'r063' ( temp 2-component vector of float) +0:168 step ( temp 2-component vector of float) 0:168 'inF0' ( in 2-component vector of float) +0:168 'inF1' ( in 2-component vector of float) 0:169 Sequence 0:169 move second child to first child ( temp 2-component vector of float) -0:169 'r065' ( temp 2-component vector of float) -0:169 hyp. tangent ( temp 2-component vector of float) +0:169 'r064' ( temp 2-component vector of float) +0:169 tangent ( temp 2-component vector of float) 0:169 'inF0' ( in 2-component vector of float) -0:171 Sequence -0:171 move second child to first child ( temp 2-component vector of float) -0:171 'r066' ( temp 2-component vector of float) -0:171 trunc ( temp 2-component vector of float) -0:171 'inF0' ( in 2-component vector of float) -0:174 Branch: Return with expression +0:170 Sequence +0:170 move second child to first child ( temp 2-component vector of float) +0:170 'r065' ( temp 2-component vector of float) +0:170 hyp. tangent ( temp 2-component vector of float) +0:170 'inF0' ( in 2-component vector of float) +0:172 Sequence +0:172 move second child to first child ( temp 2-component vector of float) +0:172 'r066' ( temp 2-component vector of float) +0:172 trunc ( temp 2-component vector of float) +0:172 'inF0' ( in 2-component vector of float) +0:175 Branch: Return with expression 0:? Constant: 0:? 1.000000 0:? 2.000000 -0:178 Function Definition: PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3; ( temp 3-component vector of float) -0:178 Function Parameters: -0:178 'inF0' ( in 3-component vector of float) -0:178 'inF1' ( in 3-component vector of float) -0:178 'inF2' ( in 3-component vector of float) -0:178 'inU0' ( in 3-component vector of uint) -0:178 'inU1' ( in 3-component vector of uint) +0:179 Function Definition: PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3; ( temp 3-component vector of float) +0:179 Function Parameters: +0:179 'inF0' ( in 3-component vector of float) +0:179 'inF1' ( in 3-component vector of float) +0:179 'inF2' ( in 3-component vector of float) +0:179 'inU0' ( in 3-component vector of uint) +0:179 'inU1' ( in 3-component vector of uint) 0:? Sequence -0:181 Sequence -0:181 move second child to first child ( temp bool) -0:181 'r000' ( temp bool) -0:181 all ( temp bool) -0:181 Convert float to bool ( temp 3-component vector of bool) -0:181 'inF0' ( in 3-component vector of float) 0:182 Sequence -0:182 move second child to first child ( temp 3-component vector of float) -0:182 'r001' ( temp 3-component vector of float) -0:182 Absolute value ( temp 3-component vector of float) -0:182 'inF0' ( in 3-component vector of float) +0:182 move second child to first child ( temp bool) +0:182 'r000' ( temp bool) +0:182 all ( temp bool) +0:182 Convert float to bool ( temp 3-component vector of bool) +0:182 'inF0' ( in 3-component vector of float) 0:183 Sequence 0:183 move second child to first child ( temp 3-component vector of float) -0:183 'r002' ( temp 3-component vector of float) -0:183 arc cosine ( temp 3-component vector of float) +0:183 'r001' ( temp 3-component vector of float) +0:183 Absolute value ( temp 3-component vector of float) 0:183 'inF0' ( in 3-component vector of float) 0:184 Sequence -0:184 move second child to first child ( temp bool) -0:184 'r003' ( temp bool) -0:184 any ( temp bool) -0:184 Convert float to bool ( temp 3-component vector of bool) -0:184 'inF0' ( in 3-component vector of float) +0:184 move second child to first child ( temp 3-component vector of float) +0:184 'r002' ( temp 3-component vector of float) +0:184 arc cosine ( temp 3-component vector of float) +0:184 'inF0' ( in 3-component vector of float) 0:185 Sequence -0:185 move second child to first child ( temp 3-component vector of float) -0:185 'r004' ( temp 3-component vector of float) -0:185 arc sine ( temp 3-component vector of float) -0:185 'inF0' ( in 3-component vector of float) +0:185 move second child to first child ( temp bool) +0:185 'r003' ( temp bool) +0:185 any ( temp bool) +0:185 Convert float to bool ( temp 3-component vector of bool) +0:185 'inF0' ( in 3-component vector of float) 0:186 Sequence -0:186 move second child to first child ( temp 3-component vector of int) -0:186 'r005' ( temp 3-component vector of int) -0:186 floatBitsToInt ( temp 3-component vector of int) +0:186 move second child to first child ( temp 3-component vector of float) +0:186 'r004' ( temp 3-component vector of float) +0:186 arc sine ( temp 3-component vector of float) 0:186 'inF0' ( in 3-component vector of float) 0:187 Sequence -0:187 move second child to first child ( temp 3-component vector of uint) -0:187 'r006' ( temp 3-component vector of uint) -0:187 floatBitsToUint ( temp 3-component vector of uint) +0:187 move second child to first child ( temp 3-component vector of int) +0:187 'r005' ( temp 3-component vector of int) +0:187 floatBitsToInt ( temp 3-component vector of int) 0:187 'inF0' ( in 3-component vector of float) 0:188 Sequence -0:188 move second child to first child ( temp 3-component vector of float) -0:188 'r007' ( temp 3-component vector of float) -0:188 intBitsToFloat ( temp 3-component vector of float) -0:188 'inU0' ( in 3-component vector of uint) -0:190 Sequence -0:190 move second child to first child ( temp 3-component vector of float) -0:190 'r009' ( temp 3-component vector of float) -0:190 arc tangent ( temp 3-component vector of float) -0:190 'inF0' ( in 3-component vector of float) +0:188 move second child to first child ( temp 3-component vector of uint) +0:188 'r006' ( temp 3-component vector of uint) +0:188 floatBitsToUint ( temp 3-component vector of uint) +0:188 'inF0' ( in 3-component vector of float) +0:189 Sequence +0:189 move second child to first child ( temp 3-component vector of float) +0:189 'r007' ( temp 3-component vector of float) +0:189 intBitsToFloat ( temp 3-component vector of float) +0:189 'inU0' ( in 3-component vector of uint) 0:191 Sequence 0:191 move second child to first child ( temp 3-component vector of float) -0:191 'r010' ( temp 3-component vector of float) +0:191 'r009' ( temp 3-component vector of float) 0:191 arc tangent ( temp 3-component vector of float) 0:191 'inF0' ( in 3-component vector of float) -0:191 'inF1' ( in 3-component vector of float) 0:192 Sequence 0:192 move second child to first child ( temp 3-component vector of float) -0:192 'r011' ( temp 3-component vector of float) -0:192 Ceiling ( temp 3-component vector of float) +0:192 'r010' ( temp 3-component vector of float) +0:192 arc tangent ( temp 3-component vector of float) 0:192 'inF0' ( in 3-component vector of float) +0:192 'inF1' ( in 3-component vector of float) 0:193 Sequence 0:193 move second child to first child ( temp 3-component vector of float) -0:193 'r012' ( temp 3-component vector of float) -0:193 clamp ( temp 3-component vector of float) +0:193 'r011' ( temp 3-component vector of float) +0:193 Ceiling ( temp 3-component vector of float) 0:193 'inF0' ( in 3-component vector of float) -0:193 'inF1' ( in 3-component vector of float) -0:193 'inF2' ( in 3-component vector of float) -0:194 Test condition and select ( temp void) -0:194 Condition -0:194 any ( temp bool) -0:194 Compare Less Than ( temp 3-component vector of bool) +0:194 Sequence +0:194 move second child to first child ( temp 3-component vector of float) +0:194 'r012' ( temp 3-component vector of float) +0:194 clamp ( temp 3-component vector of float) 0:194 'inF0' ( in 3-component vector of float) -0:194 Constant: -0:194 0.000000 -0:194 0.000000 -0:194 0.000000 -0:194 true case -0:194 Branch: Kill +0:194 'inF1' ( in 3-component vector of float) +0:194 'inF2' ( in 3-component vector of float) 0:195 Test condition and select ( temp void) 0:195 Condition 0:195 any ( temp bool) 0:195 Compare Less Than ( temp 3-component vector of bool) -0:195 'inU0' ( in 3-component vector of uint) +0:195 'inF0' ( in 3-component vector of float) 0:195 Constant: 0:195 0.000000 0:195 0.000000 0:195 0.000000 0:195 true case 0:195 Branch: Kill -0:196 Sequence -0:196 move second child to first child ( temp 3-component vector of float) -0:196 'r013' ( temp 3-component vector of float) -0:196 cosine ( temp 3-component vector of float) -0:196 'inF0' ( in 3-component vector of float) +0:196 Test condition and select ( temp void) +0:196 Condition +0:196 any ( temp bool) +0:196 Compare Less Than ( temp 3-component vector of bool) +0:196 'inU0' ( in 3-component vector of uint) +0:196 Constant: +0:196 0.000000 +0:196 0.000000 +0:196 0.000000 +0:196 true case +0:196 Branch: Kill 0:197 Sequence 0:197 move second child to first child ( temp 3-component vector of float) -0:197 'r014' ( temp 3-component vector of float) -0:197 hyp. cosine ( temp 3-component vector of float) +0:197 'r013' ( temp 3-component vector of float) +0:197 cosine ( temp 3-component vector of float) 0:197 'inF0' ( in 3-component vector of float) 0:198 Sequence -0:198 move second child to first child ( temp 3-component vector of uint) -0:198 'r015' ( temp 3-component vector of uint) +0:198 move second child to first child ( temp 3-component vector of float) +0:198 'r014' ( temp 3-component vector of float) +0:198 hyp. cosine ( temp 3-component vector of float) +0:198 'inF0' ( in 3-component vector of float) +0:199 Sequence +0:199 move second child to first child ( temp 3-component vector of uint) +0:199 'r015' ( temp 3-component vector of uint) 0:? bitCount ( temp 3-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 3 (const uint) 0:? 5 (const uint) -0:199 Sequence -0:199 move second child to first child ( temp 3-component vector of float) -0:199 'r016' ( temp 3-component vector of float) -0:199 cross-product ( temp 3-component vector of float) -0:199 'inF0' ( in 3-component vector of float) -0:199 'inF1' ( in 3-component vector of float) 0:200 Sequence 0:200 move second child to first child ( temp 3-component vector of float) -0:200 'r017' ( temp 3-component vector of float) -0:200 dPdx ( temp 3-component vector of float) +0:200 'r016' ( temp 3-component vector of float) +0:200 cross-product ( temp 3-component vector of float) 0:200 'inF0' ( in 3-component vector of float) +0:200 'inF1' ( in 3-component vector of float) 0:201 Sequence 0:201 move second child to first child ( temp 3-component vector of float) -0:201 'r018' ( temp 3-component vector of float) -0:201 dPdxCoarse ( temp 3-component vector of float) +0:201 'r017' ( temp 3-component vector of float) +0:201 dPdx ( temp 3-component vector of float) 0:201 'inF0' ( in 3-component vector of float) 0:202 Sequence 0:202 move second child to first child ( temp 3-component vector of float) -0:202 'r019' ( temp 3-component vector of float) -0:202 dPdxFine ( temp 3-component vector of float) +0:202 'r018' ( temp 3-component vector of float) +0:202 dPdxCoarse ( temp 3-component vector of float) 0:202 'inF0' ( in 3-component vector of float) 0:203 Sequence 0:203 move second child to first child ( temp 3-component vector of float) -0:203 'r020' ( temp 3-component vector of float) -0:203 dPdy ( temp 3-component vector of float) +0:203 'r019' ( temp 3-component vector of float) +0:203 dPdxFine ( temp 3-component vector of float) 0:203 'inF0' ( in 3-component vector of float) 0:204 Sequence 0:204 move second child to first child ( temp 3-component vector of float) -0:204 'r021' ( temp 3-component vector of float) -0:204 dPdyCoarse ( temp 3-component vector of float) +0:204 'r020' ( temp 3-component vector of float) +0:204 dPdy ( temp 3-component vector of float) 0:204 'inF0' ( in 3-component vector of float) 0:205 Sequence 0:205 move second child to first child ( temp 3-component vector of float) -0:205 'r022' ( temp 3-component vector of float) -0:205 dPdyFine ( temp 3-component vector of float) +0:205 'r021' ( temp 3-component vector of float) +0:205 dPdyCoarse ( temp 3-component vector of float) 0:205 'inF0' ( in 3-component vector of float) 0:206 Sequence 0:206 move second child to first child ( temp 3-component vector of float) -0:206 'r023' ( temp 3-component vector of float) -0:206 degrees ( temp 3-component vector of float) +0:206 'r022' ( temp 3-component vector of float) +0:206 dPdyFine ( temp 3-component vector of float) 0:206 'inF0' ( in 3-component vector of float) 0:207 Sequence -0:207 move second child to first child ( temp float) -0:207 'r024' ( temp float) -0:207 distance ( temp float) +0:207 move second child to first child ( temp 3-component vector of float) +0:207 'r023' ( temp 3-component vector of float) +0:207 degrees ( temp 3-component vector of float) 0:207 'inF0' ( in 3-component vector of float) -0:207 'inF1' ( in 3-component vector of float) 0:208 Sequence 0:208 move second child to first child ( temp float) -0:208 'r025' ( temp float) -0:208 dot-product ( temp float) +0:208 'r024' ( temp float) +0:208 distance ( temp float) 0:208 'inF0' ( in 3-component vector of float) 0:208 'inF1' ( in 3-component vector of float) -0:212 Sequence -0:212 move second child to first child ( temp 3-component vector of float) -0:212 'r029' ( temp 3-component vector of float) -0:212 exp ( temp 3-component vector of float) -0:212 'inF0' ( in 3-component vector of float) +0:209 Sequence +0:209 move second child to first child ( temp float) +0:209 'r025' ( temp float) +0:209 dot-product ( temp float) +0:209 'inF0' ( in 3-component vector of float) +0:209 'inF1' ( in 3-component vector of float) 0:213 Sequence 0:213 move second child to first child ( temp 3-component vector of float) -0:213 'r030' ( temp 3-component vector of float) -0:213 exp2 ( temp 3-component vector of float) +0:213 'r029' ( temp 3-component vector of float) +0:213 exp ( temp 3-component vector of float) 0:213 'inF0' ( in 3-component vector of float) 0:214 Sequence 0:214 move second child to first child ( temp 3-component vector of float) -0:214 'r031' ( temp 3-component vector of float) -0:214 face-forward ( temp 3-component vector of float) +0:214 'r030' ( temp 3-component vector of float) +0:214 exp2 ( temp 3-component vector of float) 0:214 'inF0' ( in 3-component vector of float) -0:214 'inF1' ( in 3-component vector of float) -0:214 'inF2' ( in 3-component vector of float) 0:215 Sequence -0:215 move second child to first child ( temp 3-component vector of uint) -0:215 'r032' ( temp 3-component vector of uint) +0:215 move second child to first child ( temp 3-component vector of float) +0:215 'r031' ( temp 3-component vector of float) +0:215 face-forward ( temp 3-component vector of float) +0:215 'inF0' ( in 3-component vector of float) +0:215 'inF1' ( in 3-component vector of float) +0:215 'inF2' ( in 3-component vector of float) +0:216 Sequence +0:216 move second child to first child ( temp 3-component vector of uint) +0:216 'r032' ( temp 3-component vector of uint) 0:? findMSB ( temp 3-component vector of uint) 0:? Constant: 0:? 2 (const uint) 0:? 3 (const uint) 0:? 4 (const uint) -0:216 Sequence -0:216 move second child to first child ( temp 3-component vector of uint) -0:216 'r033' ( temp 3-component vector of uint) +0:217 Sequence +0:217 move second child to first child ( temp 3-component vector of uint) +0:217 'r033' ( temp 3-component vector of uint) 0:? findLSB ( temp 3-component vector of uint) 0:? Constant: 0:? 2 (const uint) 0:? 3 (const uint) 0:? 4 (const uint) -0:217 Sequence -0:217 move second child to first child ( temp 3-component vector of float) -0:217 'r034' ( temp 3-component vector of float) -0:217 Floor ( temp 3-component vector of float) -0:217 'inF0' ( in 3-component vector of float) -0:219 Sequence -0:219 move second child to first child ( temp 3-component vector of float) -0:219 'r036' ( temp 3-component vector of float) -0:219 mod ( temp 3-component vector of float) -0:219 'inF0' ( in 3-component vector of float) -0:219 'inF1' ( in 3-component vector of float) +0:218 Sequence +0:218 move second child to first child ( temp 3-component vector of float) +0:218 'r034' ( temp 3-component vector of float) +0:218 Floor ( temp 3-component vector of float) +0:218 'inF0' ( in 3-component vector of float) 0:220 Sequence 0:220 move second child to first child ( temp 3-component vector of float) -0:220 'r037' ( temp 3-component vector of float) -0:220 Fraction ( temp 3-component vector of float) +0:220 'r036' ( temp 3-component vector of float) +0:220 mod ( temp 3-component vector of float) 0:220 'inF0' ( in 3-component vector of float) +0:220 'inF1' ( in 3-component vector of float) 0:221 Sequence 0:221 move second child to first child ( temp 3-component vector of float) -0:221 'r039' ( temp 3-component vector of float) -0:221 fwidth ( temp 3-component vector of float) +0:221 'r037' ( temp 3-component vector of float) +0:221 Fraction ( temp 3-component vector of float) 0:221 'inF0' ( in 3-component vector of float) 0:222 Sequence -0:222 move second child to first child ( temp 3-component vector of bool) -0:222 'r040' ( temp 3-component vector of bool) -0:222 isinf ( temp 3-component vector of bool) +0:222 move second child to first child ( temp 3-component vector of float) +0:222 'r039' ( temp 3-component vector of float) +0:222 fwidth ( temp 3-component vector of float) 0:222 'inF0' ( in 3-component vector of float) 0:223 Sequence 0:223 move second child to first child ( temp 3-component vector of bool) -0:223 'r041' ( temp 3-component vector of bool) -0:223 isnan ( temp 3-component vector of bool) +0:223 'r040' ( temp 3-component vector of bool) +0:223 isinf ( temp 3-component vector of bool) 0:223 'inF0' ( in 3-component vector of float) 0:224 Sequence -0:224 move second child to first child ( temp 3-component vector of float) -0:224 'r042' ( temp 3-component vector of float) -0:224 ldexp ( temp 3-component vector of float) +0:224 move second child to first child ( temp 3-component vector of bool) +0:224 'r041' ( temp 3-component vector of bool) +0:224 isnan ( temp 3-component vector of bool) 0:224 'inF0' ( in 3-component vector of float) -0:224 'inF1' ( in 3-component vector of float) 0:225 Sequence 0:225 move second child to first child ( temp 3-component vector of float) -0:225 'r039a' ( temp 3-component vector of float) -0:225 mix ( temp 3-component vector of float) +0:225 'r042' ( temp 3-component vector of float) +0:225 ldexp ( temp 3-component vector of float) 0:225 'inF0' ( in 3-component vector of float) 0:225 'inF1' ( in 3-component vector of float) -0:225 'inF2' ( in 3-component vector of float) 0:226 Sequence 0:226 move second child to first child ( temp 3-component vector of float) -0:226 'r039b' ( temp 3-component vector of float) +0:226 'r039a' ( temp 3-component vector of float) 0:226 mix ( temp 3-component vector of float) 0:226 'inF0' ( in 3-component vector of float) 0:226 'inF1' ( in 3-component vector of float) -0:226 Constant: -0:226 0.300000 +0:226 'inF2' ( in 3-component vector of float) 0:227 Sequence -0:227 move second child to first child ( temp float) -0:227 'r043' ( temp float) -0:227 length ( temp float) +0:227 move second child to first child ( temp 3-component vector of float) +0:227 'r039b' ( temp 3-component vector of float) +0:227 mix ( temp 3-component vector of float) 0:227 'inF0' ( in 3-component vector of float) +0:227 'inF1' ( in 3-component vector of float) +0:227 Constant: +0:227 0.300000 0:228 Sequence -0:228 move second child to first child ( temp 3-component vector of float) -0:228 'r044' ( temp 3-component vector of float) -0:228 log ( temp 3-component vector of float) +0:228 move second child to first child ( temp float) +0:228 'r043' ( temp float) +0:228 length ( temp float) 0:228 'inF0' ( in 3-component vector of float) 0:229 Sequence 0:229 move second child to first child ( temp 3-component vector of float) -0:229 'r045' ( temp 3-component vector of float) -0:229 vector-scale ( temp 3-component vector of float) -0:229 log2 ( temp 3-component vector of float) -0:229 'inF0' ( in 3-component vector of float) -0:229 Constant: -0:229 0.301030 +0:229 'r044' ( temp 3-component vector of float) +0:229 log ( temp 3-component vector of float) +0:229 'inF0' ( in 3-component vector of float) 0:230 Sequence 0:230 move second child to first child ( temp 3-component vector of float) -0:230 'r046' ( temp 3-component vector of float) -0:230 log2 ( temp 3-component vector of float) -0:230 'inF0' ( in 3-component vector of float) +0:230 'r045' ( temp 3-component vector of float) +0:230 vector-scale ( temp 3-component vector of float) +0:230 log2 ( temp 3-component vector of float) +0:230 'inF0' ( in 3-component vector of float) +0:230 Constant: +0:230 0.301030 0:231 Sequence 0:231 move second child to first child ( temp 3-component vector of float) -0:231 'r047' ( temp 3-component vector of float) -0:231 max ( temp 3-component vector of float) +0:231 'r046' ( temp 3-component vector of float) +0:231 log2 ( temp 3-component vector of float) 0:231 'inF0' ( in 3-component vector of float) -0:231 'inF1' ( in 3-component vector of float) 0:232 Sequence 0:232 move second child to first child ( temp 3-component vector of float) -0:232 'r048' ( temp 3-component vector of float) -0:232 min ( temp 3-component vector of float) +0:232 'r047' ( temp 3-component vector of float) +0:232 max ( temp 3-component vector of float) 0:232 'inF0' ( in 3-component vector of float) 0:232 'inF1' ( in 3-component vector of float) 0:233 Sequence 0:233 move second child to first child ( temp 3-component vector of float) -0:233 'r049' ( temp 3-component vector of float) -0:233 normalize ( temp 3-component vector of float) +0:233 'r048' ( temp 3-component vector of float) +0:233 min ( temp 3-component vector of float) 0:233 'inF0' ( in 3-component vector of float) +0:233 'inF1' ( in 3-component vector of float) 0:234 Sequence 0:234 move second child to first child ( temp 3-component vector of float) -0:234 'r050' ( temp 3-component vector of float) -0:234 pow ( temp 3-component vector of float) +0:234 'r049' ( temp 3-component vector of float) +0:234 normalize ( temp 3-component vector of float) 0:234 'inF0' ( in 3-component vector of float) -0:234 'inF1' ( in 3-component vector of float) 0:235 Sequence 0:235 move second child to first child ( temp 3-component vector of float) -0:235 'r051' ( temp 3-component vector of float) -0:235 radians ( temp 3-component vector of float) +0:235 'r050' ( temp 3-component vector of float) +0:235 pow ( temp 3-component vector of float) 0:235 'inF0' ( in 3-component vector of float) +0:235 'inF1' ( in 3-component vector of float) 0:236 Sequence 0:236 move second child to first child ( temp 3-component vector of float) -0:236 'r052' ( temp 3-component vector of float) -0:236 divide ( temp 3-component vector of float) -0:236 Constant: -0:236 1.000000 +0:236 'r051' ( temp 3-component vector of float) +0:236 radians ( temp 3-component vector of float) 0:236 'inF0' ( in 3-component vector of float) 0:237 Sequence 0:237 move second child to first child ( temp 3-component vector of float) -0:237 'r053' ( temp 3-component vector of float) -0:237 reflect ( temp 3-component vector of float) +0:237 'r052' ( temp 3-component vector of float) +0:237 divide ( temp 3-component vector of float) +0:237 Constant: +0:237 1.000000 0:237 'inF0' ( in 3-component vector of float) -0:237 'inF1' ( in 3-component vector of float) 0:238 Sequence 0:238 move second child to first child ( temp 3-component vector of float) -0:238 'r054' ( temp 3-component vector of float) -0:238 refract ( temp 3-component vector of float) +0:238 'r053' ( temp 3-component vector of float) +0:238 reflect ( temp 3-component vector of float) 0:238 'inF0' ( in 3-component vector of float) 0:238 'inF1' ( in 3-component vector of float) -0:238 Constant: -0:238 2.000000 0:239 Sequence -0:239 move second child to first child ( temp 3-component vector of uint) -0:239 'r055' ( temp 3-component vector of uint) +0:239 move second child to first child ( temp 3-component vector of float) +0:239 'r054' ( temp 3-component vector of float) +0:239 refract ( temp 3-component vector of float) +0:239 'inF0' ( in 3-component vector of float) +0:239 'inF1' ( in 3-component vector of float) +0:239 Constant: +0:239 2.000000 +0:240 Sequence +0:240 move second child to first child ( temp 3-component vector of uint) +0:240 'r055' ( temp 3-component vector of uint) 0:? bitFieldReverse ( temp 3-component vector of uint) 0:? Constant: 0:? 1 (const uint) 0:? 2 (const uint) 0:? 3 (const uint) -0:240 Sequence -0:240 move second child to first child ( temp 3-component vector of float) -0:240 'r056' ( temp 3-component vector of float) -0:240 roundEven ( temp 3-component vector of float) -0:240 'inF0' ( in 3-component vector of float) 0:241 Sequence 0:241 move second child to first child ( temp 3-component vector of float) -0:241 'r057' ( temp 3-component vector of float) -0:241 inverse sqrt ( temp 3-component vector of float) +0:241 'r056' ( temp 3-component vector of float) +0:241 roundEven ( temp 3-component vector of float) 0:241 'inF0' ( in 3-component vector of float) 0:242 Sequence 0:242 move second child to first child ( temp 3-component vector of float) -0:242 'r058' ( temp 3-component vector of float) -0:242 clamp ( temp 3-component vector of float) +0:242 'r057' ( temp 3-component vector of float) +0:242 inverse sqrt ( temp 3-component vector of float) 0:242 'inF0' ( in 3-component vector of float) -0:242 Constant: -0:242 0.000000 -0:242 Constant: -0:242 1.000000 0:243 Sequence 0:243 move second child to first child ( temp 3-component vector of float) -0:243 'r059' ( temp 3-component vector of float) -0:243 Sign ( temp 3-component vector of float) +0:243 'r058' ( temp 3-component vector of float) +0:243 clamp ( temp 3-component vector of float) 0:243 'inF0' ( in 3-component vector of float) +0:243 Constant: +0:243 0.000000 +0:243 Constant: +0:243 1.000000 0:244 Sequence 0:244 move second child to first child ( temp 3-component vector of float) -0:244 'r060' ( temp 3-component vector of float) -0:244 sine ( temp 3-component vector of float) +0:244 'r059' ( temp 3-component vector of float) +0:244 Sign ( temp 3-component vector of float) 0:244 'inF0' ( in 3-component vector of float) 0:245 Sequence 0:245 move second child to first child ( temp 3-component vector of float) -0:245 'inF1' ( in 3-component vector of float) +0:245 'r060' ( temp 3-component vector of float) 0:245 sine ( temp 3-component vector of float) 0:245 'inF0' ( in 3-component vector of float) -0:245 move second child to first child ( temp 3-component vector of float) -0:245 'inF2' ( in 3-component vector of float) -0:245 cosine ( temp 3-component vector of float) -0:245 'inF0' ( in 3-component vector of float) 0:246 Sequence 0:246 move second child to first child ( temp 3-component vector of float) -0:246 'r061' ( temp 3-component vector of float) -0:246 hyp. sine ( temp 3-component vector of float) +0:246 'inF1' ( in 3-component vector of float) +0:246 sine ( temp 3-component vector of float) +0:246 'inF0' ( in 3-component vector of float) +0:246 move second child to first child ( temp 3-component vector of float) +0:246 'inF2' ( in 3-component vector of float) +0:246 cosine ( temp 3-component vector of float) 0:246 'inF0' ( in 3-component vector of float) 0:247 Sequence 0:247 move second child to first child ( temp 3-component vector of float) -0:247 'r062' ( temp 3-component vector of float) -0:247 smoothstep ( temp 3-component vector of float) +0:247 'r061' ( temp 3-component vector of float) +0:247 hyp. sine ( temp 3-component vector of float) 0:247 'inF0' ( in 3-component vector of float) -0:247 'inF1' ( in 3-component vector of float) -0:247 'inF2' ( in 3-component vector of float) 0:248 Sequence 0:248 move second child to first child ( temp 3-component vector of float) -0:248 'r063' ( temp 3-component vector of float) -0:248 sqrt ( temp 3-component vector of float) +0:248 'r062' ( temp 3-component vector of float) +0:248 smoothstep ( temp 3-component vector of float) 0:248 'inF0' ( in 3-component vector of float) +0:248 'inF1' ( in 3-component vector of float) +0:248 'inF2' ( in 3-component vector of float) 0:249 Sequence 0:249 move second child to first child ( temp 3-component vector of float) -0:249 'r064' ( temp 3-component vector of float) -0:249 step ( temp 3-component vector of float) +0:249 'r063' ( temp 3-component vector of float) +0:249 sqrt ( temp 3-component vector of float) 0:249 'inF0' ( in 3-component vector of float) -0:249 'inF1' ( in 3-component vector of float) 0:250 Sequence 0:250 move second child to first child ( temp 3-component vector of float) -0:250 'r065' ( temp 3-component vector of float) -0:250 tangent ( temp 3-component vector of float) +0:250 'r064' ( temp 3-component vector of float) +0:250 step ( temp 3-component vector of float) 0:250 'inF0' ( in 3-component vector of float) +0:250 'inF1' ( in 3-component vector of float) 0:251 Sequence 0:251 move second child to first child ( temp 3-component vector of float) -0:251 'r066' ( temp 3-component vector of float) -0:251 hyp. tangent ( temp 3-component vector of float) +0:251 'r065' ( temp 3-component vector of float) +0:251 tangent ( temp 3-component vector of float) 0:251 'inF0' ( in 3-component vector of float) -0:253 Sequence -0:253 move second child to first child ( temp 3-component vector of float) -0:253 'r067' ( temp 3-component vector of float) -0:253 trunc ( temp 3-component vector of float) -0:253 'inF0' ( in 3-component vector of float) -0:256 Branch: Return with expression +0:252 Sequence +0:252 move second child to first child ( temp 3-component vector of float) +0:252 'r066' ( temp 3-component vector of float) +0:252 hyp. tangent ( temp 3-component vector of float) +0:252 'inF0' ( in 3-component vector of float) +0:254 Sequence +0:254 move second child to first child ( temp 3-component vector of float) +0:254 'r067' ( temp 3-component vector of float) +0:254 trunc ( temp 3-component vector of float) +0:254 'inF0' ( in 3-component vector of float) +0:257 Branch: Return with expression 0:? Constant: 0:? 1.000000 0:? 2.000000 0:? 3.000000 -0:260 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vu4;vu4; ( temp 4-component vector of float) -0:260 Function Parameters: -0:260 'inF0' ( in 4-component vector of float) -0:260 'inF1' ( in 4-component vector of float) -0:260 'inF2' ( in 4-component vector of float) -0:260 'inU0' ( in 4-component vector of uint) -0:260 'inU1' ( in 4-component vector of uint) +0:261 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vu4;vu4; ( temp 4-component vector of float) +0:261 Function Parameters: +0:261 'inF0' ( in 4-component vector of float) +0:261 'inF1' ( in 4-component vector of float) +0:261 'inF2' ( in 4-component vector of float) +0:261 'inU0' ( in 4-component vector of uint) +0:261 'inU1' ( in 4-component vector of uint) 0:? Sequence -0:263 Sequence -0:263 move second child to first child ( temp bool) -0:263 'r000' ( temp bool) -0:263 all ( temp bool) -0:263 Convert float to bool ( temp 4-component vector of bool) -0:263 'inF0' ( in 4-component vector of float) 0:264 Sequence -0:264 move second child to first child ( temp 4-component vector of float) -0:264 'r001' ( temp 4-component vector of float) -0:264 Absolute value ( temp 4-component vector of float) -0:264 'inF0' ( in 4-component vector of float) +0:264 move second child to first child ( temp bool) +0:264 'r000' ( temp bool) +0:264 all ( temp bool) +0:264 Convert float to bool ( temp 4-component vector of bool) +0:264 'inF0' ( in 4-component vector of float) 0:265 Sequence 0:265 move second child to first child ( temp 4-component vector of float) -0:265 'r002' ( temp 4-component vector of float) -0:265 arc cosine ( temp 4-component vector of float) +0:265 'r001' ( temp 4-component vector of float) +0:265 Absolute value ( temp 4-component vector of float) 0:265 'inF0' ( in 4-component vector of float) 0:266 Sequence -0:266 move second child to first child ( temp bool) -0:266 'r003' ( temp bool) -0:266 any ( temp bool) -0:266 Convert float to bool ( temp 4-component vector of bool) -0:266 'inF0' ( in 4-component vector of float) +0:266 move second child to first child ( temp 4-component vector of float) +0:266 'r002' ( temp 4-component vector of float) +0:266 arc cosine ( temp 4-component vector of float) +0:266 'inF0' ( in 4-component vector of float) 0:267 Sequence -0:267 move second child to first child ( temp 4-component vector of float) -0:267 'r004' ( temp 4-component vector of float) -0:267 arc sine ( temp 4-component vector of float) -0:267 'inF0' ( in 4-component vector of float) +0:267 move second child to first child ( temp bool) +0:267 'r003' ( temp bool) +0:267 any ( temp bool) +0:267 Convert float to bool ( temp 4-component vector of bool) +0:267 'inF0' ( in 4-component vector of float) 0:268 Sequence -0:268 move second child to first child ( temp 4-component vector of int) -0:268 'r005' ( temp 4-component vector of int) -0:268 floatBitsToInt ( temp 4-component vector of int) +0:268 move second child to first child ( temp 4-component vector of float) +0:268 'r004' ( temp 4-component vector of float) +0:268 arc sine ( temp 4-component vector of float) 0:268 'inF0' ( in 4-component vector of float) 0:269 Sequence -0:269 move second child to first child ( temp 4-component vector of uint) -0:269 'r006' ( temp 4-component vector of uint) -0:269 floatBitsToUint ( temp 4-component vector of uint) +0:269 move second child to first child ( temp 4-component vector of int) +0:269 'r005' ( temp 4-component vector of int) +0:269 floatBitsToInt ( temp 4-component vector of int) 0:269 'inF0' ( in 4-component vector of float) 0:270 Sequence -0:270 move second child to first child ( temp 4-component vector of float) -0:270 'r007' ( temp 4-component vector of float) -0:270 intBitsToFloat ( temp 4-component vector of float) -0:270 'inU0' ( in 4-component vector of uint) -0:272 Sequence -0:272 move second child to first child ( temp 4-component vector of float) -0:272 'r009' ( temp 4-component vector of float) -0:272 arc tangent ( temp 4-component vector of float) -0:272 'inF0' ( in 4-component vector of float) +0:270 move second child to first child ( temp 4-component vector of uint) +0:270 'r006' ( temp 4-component vector of uint) +0:270 floatBitsToUint ( temp 4-component vector of uint) +0:270 'inF0' ( in 4-component vector of float) +0:271 Sequence +0:271 move second child to first child ( temp 4-component vector of float) +0:271 'r007' ( temp 4-component vector of float) +0:271 intBitsToFloat ( temp 4-component vector of float) +0:271 'inU0' ( in 4-component vector of uint) 0:273 Sequence 0:273 move second child to first child ( temp 4-component vector of float) -0:273 'r010' ( temp 4-component vector of float) +0:273 'r009' ( temp 4-component vector of float) 0:273 arc tangent ( temp 4-component vector of float) 0:273 'inF0' ( in 4-component vector of float) -0:273 'inF1' ( in 4-component vector of float) 0:274 Sequence 0:274 move second child to first child ( temp 4-component vector of float) -0:274 'r011' ( temp 4-component vector of float) -0:274 Ceiling ( temp 4-component vector of float) +0:274 'r010' ( temp 4-component vector of float) +0:274 arc tangent ( temp 4-component vector of float) 0:274 'inF0' ( in 4-component vector of float) +0:274 'inF1' ( in 4-component vector of float) 0:275 Sequence 0:275 move second child to first child ( temp 4-component vector of float) -0:275 'r012' ( temp 4-component vector of float) -0:275 clamp ( temp 4-component vector of float) +0:275 'r011' ( temp 4-component vector of float) +0:275 Ceiling ( temp 4-component vector of float) 0:275 'inF0' ( in 4-component vector of float) -0:275 'inF1' ( in 4-component vector of float) -0:275 'inF2' ( in 4-component vector of float) -0:276 Test condition and select ( temp void) -0:276 Condition -0:276 any ( temp bool) -0:276 Compare Less Than ( temp 4-component vector of bool) +0:276 Sequence +0:276 move second child to first child ( temp 4-component vector of float) +0:276 'r012' ( temp 4-component vector of float) +0:276 clamp ( temp 4-component vector of float) 0:276 'inF0' ( in 4-component vector of float) -0:276 Constant: -0:276 0.000000 -0:276 0.000000 -0:276 0.000000 -0:276 0.000000 -0:276 true case -0:276 Branch: Kill +0:276 'inF1' ( in 4-component vector of float) +0:276 'inF2' ( in 4-component vector of float) 0:277 Test condition and select ( temp void) 0:277 Condition 0:277 any ( temp bool) 0:277 Compare Less Than ( temp 4-component vector of bool) -0:277 'inU0' ( in 4-component vector of uint) +0:277 'inF0' ( in 4-component vector of float) 0:277 Constant: 0:277 0.000000 0:277 0.000000 @@ -1253,905 +1247,917 @@ gl_FragCoord origin is upper left 0:277 0.000000 0:277 true case 0:277 Branch: Kill -0:278 Sequence -0:278 move second child to first child ( temp 4-component vector of float) -0:278 'r013' ( temp 4-component vector of float) -0:278 cosine ( temp 4-component vector of float) -0:278 'inF0' ( in 4-component vector of float) +0:278 Test condition and select ( temp void) +0:278 Condition +0:278 any ( temp bool) +0:278 Compare Less Than ( temp 4-component vector of bool) +0:278 'inU0' ( in 4-component vector of uint) +0:278 Constant: +0:278 0.000000 +0:278 0.000000 +0:278 0.000000 +0:278 0.000000 +0:278 true case +0:278 Branch: Kill 0:279 Sequence 0:279 move second child to first child ( temp 4-component vector of float) -0:279 'r014' ( temp 4-component vector of float) -0:279 hyp. cosine ( temp 4-component vector of float) +0:279 'r013' ( temp 4-component vector of float) +0:279 cosine ( temp 4-component vector of float) 0:279 'inF0' ( in 4-component vector of float) 0:280 Sequence -0:280 move second child to first child ( temp 4-component vector of uint) -0:280 'r015' ( temp 4-component vector of uint) +0:280 move second child to first child ( temp 4-component vector of float) +0:280 'r014' ( temp 4-component vector of float) +0:280 hyp. cosine ( temp 4-component vector of float) +0:280 'inF0' ( in 4-component vector of float) +0:281 Sequence +0:281 move second child to first child ( temp 4-component vector of uint) +0:281 'r015' ( temp 4-component vector of uint) 0:? bitCount ( temp 4-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 3 (const uint) 0:? 5 (const uint) 0:? 2 (const uint) -0:281 Sequence -0:281 move second child to first child ( temp 4-component vector of float) -0:281 'r016' ( temp 4-component vector of float) -0:281 dPdx ( temp 4-component vector of float) -0:281 'inF0' ( in 4-component vector of float) 0:282 Sequence 0:282 move second child to first child ( temp 4-component vector of float) -0:282 'r017' ( temp 4-component vector of float) -0:282 dPdxCoarse ( temp 4-component vector of float) +0:282 'r016' ( temp 4-component vector of float) +0:282 dPdx ( temp 4-component vector of float) 0:282 'inF0' ( in 4-component vector of float) 0:283 Sequence 0:283 move second child to first child ( temp 4-component vector of float) -0:283 'r018' ( temp 4-component vector of float) -0:283 dPdxFine ( temp 4-component vector of float) +0:283 'r017' ( temp 4-component vector of float) +0:283 dPdxCoarse ( temp 4-component vector of float) 0:283 'inF0' ( in 4-component vector of float) 0:284 Sequence 0:284 move second child to first child ( temp 4-component vector of float) -0:284 'r019' ( temp 4-component vector of float) -0:284 dPdy ( temp 4-component vector of float) +0:284 'r018' ( temp 4-component vector of float) +0:284 dPdxFine ( temp 4-component vector of float) 0:284 'inF0' ( in 4-component vector of float) 0:285 Sequence 0:285 move second child to first child ( temp 4-component vector of float) -0:285 'r020' ( temp 4-component vector of float) -0:285 dPdyCoarse ( temp 4-component vector of float) +0:285 'r019' ( temp 4-component vector of float) +0:285 dPdy ( temp 4-component vector of float) 0:285 'inF0' ( in 4-component vector of float) 0:286 Sequence 0:286 move second child to first child ( temp 4-component vector of float) -0:286 'r021' ( temp 4-component vector of float) -0:286 dPdyFine ( temp 4-component vector of float) +0:286 'r020' ( temp 4-component vector of float) +0:286 dPdyCoarse ( temp 4-component vector of float) 0:286 'inF0' ( in 4-component vector of float) 0:287 Sequence 0:287 move second child to first child ( temp 4-component vector of float) -0:287 'r022' ( temp 4-component vector of float) -0:287 degrees ( temp 4-component vector of float) +0:287 'r021' ( temp 4-component vector of float) +0:287 dPdyFine ( temp 4-component vector of float) 0:287 'inF0' ( in 4-component vector of float) 0:288 Sequence -0:288 move second child to first child ( temp float) -0:288 'r023' ( temp float) -0:288 distance ( temp float) +0:288 move second child to first child ( temp 4-component vector of float) +0:288 'r022' ( temp 4-component vector of float) +0:288 degrees ( temp 4-component vector of float) 0:288 'inF0' ( in 4-component vector of float) -0:288 'inF1' ( in 4-component vector of float) 0:289 Sequence 0:289 move second child to first child ( temp float) -0:289 'r024' ( temp float) -0:289 dot-product ( temp float) +0:289 'r023' ( temp float) +0:289 distance ( temp float) 0:289 'inF0' ( in 4-component vector of float) 0:289 'inF1' ( in 4-component vector of float) 0:290 Sequence -0:290 move second child to first child ( temp 4-component vector of float) -0:290 'r025' ( temp 4-component vector of float) -0:290 Construct vec4 ( temp 4-component vector of float) -0:290 Constant: -0:290 1.000000 -0:290 component-wise multiply ( temp float) -0:290 direct index ( temp float) -0:290 'inF0' ( in 4-component vector of float) -0:290 Constant: -0:290 1 (const int) -0:290 direct index ( temp float) -0:290 'inF1' ( in 4-component vector of float) -0:290 Constant: -0:290 1 (const int) -0:290 direct index ( temp float) -0:290 'inF0' ( in 4-component vector of float) -0:290 Constant: -0:290 2 (const int) -0:290 direct index ( temp float) -0:290 'inF1' ( in 4-component vector of float) -0:290 Constant: -0:290 3 (const int) -0:294 Sequence -0:294 move second child to first child ( temp 4-component vector of float) -0:294 'r029' ( temp 4-component vector of float) -0:294 exp ( temp 4-component vector of float) -0:294 'inF0' ( in 4-component vector of float) +0:290 move second child to first child ( temp float) +0:290 'r024' ( temp float) +0:290 dot-product ( temp float) +0:290 'inF0' ( in 4-component vector of float) +0:290 'inF1' ( in 4-component vector of float) +0:291 Sequence +0:291 move second child to first child ( temp 4-component vector of float) +0:291 'r025' ( temp 4-component vector of float) +0:291 Construct vec4 ( temp 4-component vector of float) +0:291 Constant: +0:291 1.000000 +0:291 component-wise multiply ( temp float) +0:291 direct index ( temp float) +0:291 'inF0' ( in 4-component vector of float) +0:291 Constant: +0:291 1 (const int) +0:291 direct index ( temp float) +0:291 'inF1' ( in 4-component vector of float) +0:291 Constant: +0:291 1 (const int) +0:291 direct index ( temp float) +0:291 'inF0' ( in 4-component vector of float) +0:291 Constant: +0:291 2 (const int) +0:291 direct index ( temp float) +0:291 'inF1' ( in 4-component vector of float) +0:291 Constant: +0:291 3 (const int) 0:295 Sequence 0:295 move second child to first child ( temp 4-component vector of float) -0:295 'r030' ( temp 4-component vector of float) -0:295 exp2 ( temp 4-component vector of float) +0:295 'r029' ( temp 4-component vector of float) +0:295 exp ( temp 4-component vector of float) 0:295 'inF0' ( in 4-component vector of float) 0:296 Sequence 0:296 move second child to first child ( temp 4-component vector of float) -0:296 'r031' ( temp 4-component vector of float) -0:296 face-forward ( temp 4-component vector of float) +0:296 'r030' ( temp 4-component vector of float) +0:296 exp2 ( temp 4-component vector of float) 0:296 'inF0' ( in 4-component vector of float) -0:296 'inF1' ( in 4-component vector of float) -0:296 'inF2' ( in 4-component vector of float) 0:297 Sequence -0:297 move second child to first child ( temp 4-component vector of uint) -0:297 'r032' ( temp 4-component vector of uint) +0:297 move second child to first child ( temp 4-component vector of float) +0:297 'r031' ( temp 4-component vector of float) +0:297 face-forward ( temp 4-component vector of float) +0:297 'inF0' ( in 4-component vector of float) +0:297 'inF1' ( in 4-component vector of float) +0:297 'inF2' ( in 4-component vector of float) +0:298 Sequence +0:298 move second child to first child ( temp 4-component vector of uint) +0:298 'r032' ( temp 4-component vector of uint) 0:? findMSB ( temp 4-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) 0:? 9 (const uint) 0:? 10 (const uint) -0:298 Sequence -0:298 move second child to first child ( temp 4-component vector of uint) -0:298 'r033' ( temp 4-component vector of uint) +0:299 Sequence +0:299 move second child to first child ( temp 4-component vector of uint) +0:299 'r033' ( temp 4-component vector of uint) 0:? findLSB ( temp 4-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) 0:? 9 (const uint) 0:? 10 (const uint) -0:299 Sequence -0:299 move second child to first child ( temp 4-component vector of float) -0:299 'r034' ( temp 4-component vector of float) -0:299 Floor ( temp 4-component vector of float) -0:299 'inF0' ( in 4-component vector of float) -0:301 Sequence -0:301 move second child to first child ( temp 4-component vector of float) -0:301 'r036' ( temp 4-component vector of float) -0:301 mod ( temp 4-component vector of float) -0:301 'inF0' ( in 4-component vector of float) -0:301 'inF1' ( in 4-component vector of float) +0:300 Sequence +0:300 move second child to first child ( temp 4-component vector of float) +0:300 'r034' ( temp 4-component vector of float) +0:300 Floor ( temp 4-component vector of float) +0:300 'inF0' ( in 4-component vector of float) 0:302 Sequence 0:302 move second child to first child ( temp 4-component vector of float) -0:302 'r037' ( temp 4-component vector of float) -0:302 Fraction ( temp 4-component vector of float) +0:302 'r036' ( temp 4-component vector of float) +0:302 mod ( temp 4-component vector of float) 0:302 'inF0' ( in 4-component vector of float) +0:302 'inF1' ( in 4-component vector of float) 0:303 Sequence 0:303 move second child to first child ( temp 4-component vector of float) -0:303 'r039' ( temp 4-component vector of float) -0:303 fwidth ( temp 4-component vector of float) +0:303 'r037' ( temp 4-component vector of float) +0:303 Fraction ( temp 4-component vector of float) 0:303 'inF0' ( in 4-component vector of float) 0:304 Sequence -0:304 move second child to first child ( temp 4-component vector of bool) -0:304 'r040' ( temp 4-component vector of bool) -0:304 isinf ( temp 4-component vector of bool) +0:304 move second child to first child ( temp 4-component vector of float) +0:304 'r039' ( temp 4-component vector of float) +0:304 fwidth ( temp 4-component vector of float) 0:304 'inF0' ( in 4-component vector of float) 0:305 Sequence 0:305 move second child to first child ( temp 4-component vector of bool) -0:305 'r041' ( temp 4-component vector of bool) -0:305 isnan ( temp 4-component vector of bool) +0:305 'r040' ( temp 4-component vector of bool) +0:305 isinf ( temp 4-component vector of bool) 0:305 'inF0' ( in 4-component vector of float) 0:306 Sequence -0:306 move second child to first child ( temp 4-component vector of float) -0:306 'r042' ( temp 4-component vector of float) -0:306 ldexp ( temp 4-component vector of float) +0:306 move second child to first child ( temp 4-component vector of bool) +0:306 'r041' ( temp 4-component vector of bool) +0:306 isnan ( temp 4-component vector of bool) 0:306 'inF0' ( in 4-component vector of float) -0:306 'inF1' ( in 4-component vector of float) 0:307 Sequence 0:307 move second child to first child ( temp 4-component vector of float) -0:307 'r039a' ( temp 4-component vector of float) -0:307 mix ( temp 4-component vector of float) +0:307 'r042' ( temp 4-component vector of float) +0:307 ldexp ( temp 4-component vector of float) 0:307 'inF0' ( in 4-component vector of float) 0:307 'inF1' ( in 4-component vector of float) -0:307 'inF2' ( in 4-component vector of float) 0:308 Sequence -0:308 move second child to first child ( temp float) -0:308 'r043' ( temp float) -0:308 length ( temp float) +0:308 move second child to first child ( temp 4-component vector of float) +0:308 'r039a' ( temp 4-component vector of float) +0:308 mix ( temp 4-component vector of float) 0:308 'inF0' ( in 4-component vector of float) +0:308 'inF1' ( in 4-component vector of float) +0:308 'inF2' ( in 4-component vector of float) 0:309 Sequence -0:309 move second child to first child ( temp 4-component vector of float) -0:309 'r044' ( temp 4-component vector of float) -0:309 log ( temp 4-component vector of float) +0:309 move second child to first child ( temp float) +0:309 'r043' ( temp float) +0:309 length ( temp float) 0:309 'inF0' ( in 4-component vector of float) 0:310 Sequence 0:310 move second child to first child ( temp 4-component vector of float) -0:310 'r045' ( temp 4-component vector of float) -0:310 vector-scale ( temp 4-component vector of float) -0:310 log2 ( temp 4-component vector of float) -0:310 'inF0' ( in 4-component vector of float) -0:310 Constant: -0:310 0.301030 +0:310 'r044' ( temp 4-component vector of float) +0:310 log ( temp 4-component vector of float) +0:310 'inF0' ( in 4-component vector of float) 0:311 Sequence 0:311 move second child to first child ( temp 4-component vector of float) -0:311 'r046' ( temp 4-component vector of float) -0:311 log2 ( temp 4-component vector of float) -0:311 'inF0' ( in 4-component vector of float) +0:311 'r045' ( temp 4-component vector of float) +0:311 vector-scale ( temp 4-component vector of float) +0:311 log2 ( temp 4-component vector of float) +0:311 'inF0' ( in 4-component vector of float) +0:311 Constant: +0:311 0.301030 0:312 Sequence 0:312 move second child to first child ( temp 4-component vector of float) -0:312 'r047' ( temp 4-component vector of float) -0:312 max ( temp 4-component vector of float) +0:312 'r046' ( temp 4-component vector of float) +0:312 log2 ( temp 4-component vector of float) 0:312 'inF0' ( in 4-component vector of float) -0:312 'inF1' ( in 4-component vector of float) 0:313 Sequence 0:313 move second child to first child ( temp 4-component vector of float) -0:313 'r048' ( temp 4-component vector of float) -0:313 min ( temp 4-component vector of float) +0:313 'r047' ( temp 4-component vector of float) +0:313 max ( temp 4-component vector of float) 0:313 'inF0' ( in 4-component vector of float) 0:313 'inF1' ( in 4-component vector of float) 0:314 Sequence 0:314 move second child to first child ( temp 4-component vector of float) -0:314 'r049' ( temp 4-component vector of float) -0:314 normalize ( temp 4-component vector of float) +0:314 'r048' ( temp 4-component vector of float) +0:314 min ( temp 4-component vector of float) 0:314 'inF0' ( in 4-component vector of float) +0:314 'inF1' ( in 4-component vector of float) 0:315 Sequence 0:315 move second child to first child ( temp 4-component vector of float) -0:315 'r050' ( temp 4-component vector of float) -0:315 pow ( temp 4-component vector of float) +0:315 'r049' ( temp 4-component vector of float) +0:315 normalize ( temp 4-component vector of float) 0:315 'inF0' ( in 4-component vector of float) -0:315 'inF1' ( in 4-component vector of float) 0:316 Sequence 0:316 move second child to first child ( temp 4-component vector of float) -0:316 'r051' ( temp 4-component vector of float) -0:316 radians ( temp 4-component vector of float) +0:316 'r050' ( temp 4-component vector of float) +0:316 pow ( temp 4-component vector of float) 0:316 'inF0' ( in 4-component vector of float) +0:316 'inF1' ( in 4-component vector of float) 0:317 Sequence 0:317 move second child to first child ( temp 4-component vector of float) -0:317 'r052' ( temp 4-component vector of float) -0:317 divide ( temp 4-component vector of float) -0:317 Constant: -0:317 1.000000 +0:317 'r051' ( temp 4-component vector of float) +0:317 radians ( temp 4-component vector of float) 0:317 'inF0' ( in 4-component vector of float) 0:318 Sequence 0:318 move second child to first child ( temp 4-component vector of float) -0:318 'r053' ( temp 4-component vector of float) -0:318 reflect ( temp 4-component vector of float) +0:318 'r052' ( temp 4-component vector of float) +0:318 divide ( temp 4-component vector of float) +0:318 Constant: +0:318 1.000000 0:318 'inF0' ( in 4-component vector of float) -0:318 'inF1' ( in 4-component vector of float) 0:319 Sequence 0:319 move second child to first child ( temp 4-component vector of float) -0:319 'r054' ( temp 4-component vector of float) -0:319 refract ( temp 4-component vector of float) +0:319 'r053' ( temp 4-component vector of float) +0:319 reflect ( temp 4-component vector of float) 0:319 'inF0' ( in 4-component vector of float) 0:319 'inF1' ( in 4-component vector of float) -0:319 Constant: -0:319 2.000000 0:320 Sequence -0:320 move second child to first child ( temp 4-component vector of uint) -0:320 'r055' ( temp 4-component vector of uint) +0:320 move second child to first child ( temp 4-component vector of float) +0:320 'r054' ( temp 4-component vector of float) +0:320 refract ( temp 4-component vector of float) +0:320 'inF0' ( in 4-component vector of float) +0:320 'inF1' ( in 4-component vector of float) +0:320 Constant: +0:320 2.000000 +0:321 Sequence +0:321 move second child to first child ( temp 4-component vector of uint) +0:321 'r055' ( temp 4-component vector of uint) 0:? bitFieldReverse ( temp 4-component vector of uint) 0:? Constant: 0:? 1 (const uint) 0:? 2 (const uint) 0:? 3 (const uint) 0:? 4 (const uint) -0:321 Sequence -0:321 move second child to first child ( temp 4-component vector of float) -0:321 'r056' ( temp 4-component vector of float) -0:321 roundEven ( temp 4-component vector of float) -0:321 'inF0' ( in 4-component vector of float) 0:322 Sequence 0:322 move second child to first child ( temp 4-component vector of float) -0:322 'r057' ( temp 4-component vector of float) -0:322 inverse sqrt ( temp 4-component vector of float) +0:322 'r056' ( temp 4-component vector of float) +0:322 roundEven ( temp 4-component vector of float) 0:322 'inF0' ( in 4-component vector of float) 0:323 Sequence 0:323 move second child to first child ( temp 4-component vector of float) -0:323 'r058' ( temp 4-component vector of float) -0:323 clamp ( temp 4-component vector of float) +0:323 'r057' ( temp 4-component vector of float) +0:323 inverse sqrt ( temp 4-component vector of float) 0:323 'inF0' ( in 4-component vector of float) -0:323 Constant: -0:323 0.000000 -0:323 Constant: -0:323 1.000000 0:324 Sequence 0:324 move second child to first child ( temp 4-component vector of float) -0:324 'r059' ( temp 4-component vector of float) -0:324 Sign ( temp 4-component vector of float) +0:324 'r058' ( temp 4-component vector of float) +0:324 clamp ( temp 4-component vector of float) 0:324 'inF0' ( in 4-component vector of float) +0:324 Constant: +0:324 0.000000 +0:324 Constant: +0:324 1.000000 0:325 Sequence 0:325 move second child to first child ( temp 4-component vector of float) -0:325 'r060' ( temp 4-component vector of float) -0:325 sine ( temp 4-component vector of float) +0:325 'r059' ( temp 4-component vector of float) +0:325 Sign ( temp 4-component vector of float) 0:325 'inF0' ( in 4-component vector of float) 0:326 Sequence 0:326 move second child to first child ( temp 4-component vector of float) -0:326 'inF1' ( in 4-component vector of float) +0:326 'r060' ( temp 4-component vector of float) 0:326 sine ( temp 4-component vector of float) 0:326 'inF0' ( in 4-component vector of float) -0:326 move second child to first child ( temp 4-component vector of float) -0:326 'inF2' ( in 4-component vector of float) -0:326 cosine ( temp 4-component vector of float) -0:326 'inF0' ( in 4-component vector of float) 0:327 Sequence 0:327 move second child to first child ( temp 4-component vector of float) -0:327 'r061' ( temp 4-component vector of float) -0:327 hyp. sine ( temp 4-component vector of float) +0:327 'inF1' ( in 4-component vector of float) +0:327 sine ( temp 4-component vector of float) +0:327 'inF0' ( in 4-component vector of float) +0:327 move second child to first child ( temp 4-component vector of float) +0:327 'inF2' ( in 4-component vector of float) +0:327 cosine ( temp 4-component vector of float) 0:327 'inF0' ( in 4-component vector of float) 0:328 Sequence 0:328 move second child to first child ( temp 4-component vector of float) -0:328 'r062' ( temp 4-component vector of float) -0:328 smoothstep ( temp 4-component vector of float) +0:328 'r061' ( temp 4-component vector of float) +0:328 hyp. sine ( temp 4-component vector of float) 0:328 'inF0' ( in 4-component vector of float) -0:328 'inF1' ( in 4-component vector of float) -0:328 'inF2' ( in 4-component vector of float) 0:329 Sequence 0:329 move second child to first child ( temp 4-component vector of float) -0:329 'r063' ( temp 4-component vector of float) -0:329 sqrt ( temp 4-component vector of float) +0:329 'r062' ( temp 4-component vector of float) +0:329 smoothstep ( temp 4-component vector of float) 0:329 'inF0' ( in 4-component vector of float) +0:329 'inF1' ( in 4-component vector of float) +0:329 'inF2' ( in 4-component vector of float) 0:330 Sequence 0:330 move second child to first child ( temp 4-component vector of float) -0:330 'r064' ( temp 4-component vector of float) -0:330 step ( temp 4-component vector of float) +0:330 'r063' ( temp 4-component vector of float) +0:330 sqrt ( temp 4-component vector of float) 0:330 'inF0' ( in 4-component vector of float) -0:330 'inF1' ( in 4-component vector of float) 0:331 Sequence 0:331 move second child to first child ( temp 4-component vector of float) -0:331 'r065' ( temp 4-component vector of float) -0:331 tangent ( temp 4-component vector of float) +0:331 'r064' ( temp 4-component vector of float) +0:331 step ( temp 4-component vector of float) 0:331 'inF0' ( in 4-component vector of float) +0:331 'inF1' ( in 4-component vector of float) 0:332 Sequence 0:332 move second child to first child ( temp 4-component vector of float) -0:332 'r066' ( temp 4-component vector of float) -0:332 hyp. tangent ( temp 4-component vector of float) +0:332 'r065' ( temp 4-component vector of float) +0:332 tangent ( temp 4-component vector of float) 0:332 'inF0' ( in 4-component vector of float) -0:334 Sequence -0:334 move second child to first child ( temp 4-component vector of float) -0:334 'r067' ( temp 4-component vector of float) -0:334 trunc ( temp 4-component vector of float) -0:334 'inF0' ( in 4-component vector of float) -0:337 Branch: Return with expression +0:333 Sequence +0:333 move second child to first child ( temp 4-component vector of float) +0:333 'r066' ( temp 4-component vector of float) +0:333 hyp. tangent ( temp 4-component vector of float) +0:333 'inF0' ( in 4-component vector of float) +0:335 Sequence +0:335 move second child to first child ( temp 4-component vector of float) +0:335 'r067' ( temp 4-component vector of float) +0:335 trunc ( temp 4-component vector of float) +0:335 'inF0' ( in 4-component vector of float) +0:338 Branch: Return with expression 0:? Constant: 0:? 1.000000 0:? 2.000000 0:? 3.000000 0:? 4.000000 -0:400 Function Definition: PixelShaderFunction2x2(mf22;mf22;mf22; ( temp 2X2 matrix of float) -0:400 Function Parameters: -0:400 'inF0' ( in 2X2 matrix of float) -0:400 'inF1' ( in 2X2 matrix of float) -0:400 'inF2' ( in 2X2 matrix of float) +0:401 Function Definition: PixelShaderFunction2x2(mf22;mf22;mf22; ( temp 2X2 matrix of float) +0:401 Function Parameters: +0:401 'inF0' ( in 2X2 matrix of float) +0:401 'inF1' ( in 2X2 matrix of float) +0:401 'inF2' ( in 2X2 matrix of float) 0:? Sequence -0:402 Sequence -0:402 move second child to first child ( temp bool) -0:402 'r000' ( temp bool) -0:402 all ( temp bool) -0:402 Convert float to bool ( temp 2X2 matrix of bool) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r001' ( temp 2X2 matrix of float) -0:402 Absolute value ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 arc cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp bool) -0:402 'r003' ( temp bool) -0:402 any ( temp bool) -0:402 Convert float to bool ( temp 2X2 matrix of bool) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r004' ( temp 2X2 matrix of float) -0:402 arc sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r005' ( temp 2X2 matrix of float) -0:402 arc tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r006' ( temp 2X2 matrix of float) -0:402 arc tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r007' ( temp 2X2 matrix of float) -0:402 Ceiling ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Test condition and select ( temp void) -0:402 Condition -0:402 any ( temp bool) -0:402 Compare Less Than ( temp 2X2 matrix of bool) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Constant: -0:402 0.000000 -0:402 0.000000 -0:402 0.000000 -0:402 0.000000 -0:402 true case -0:402 Branch: Kill -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r008' ( temp 2X2 matrix of float) -0:402 clamp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r009' ( temp 2X2 matrix of float) -0:402 cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r010' ( temp 2X2 matrix of float) -0:402 hyp. cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r011' ( temp 2X2 matrix of float) -0:402 dPdx ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r012' ( temp 2X2 matrix of float) -0:402 dPdxCoarse ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r013' ( temp 2X2 matrix of float) -0:402 dPdxFine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r014' ( temp 2X2 matrix of float) -0:402 dPdy ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r015' ( temp 2X2 matrix of float) -0:402 dPdyCoarse ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r016' ( temp 2X2 matrix of float) -0:402 dPdyFine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r017' ( temp 2X2 matrix of float) -0:402 degrees ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp float) -0:402 'r018' ( temp float) -0:402 determinant ( temp float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r019' ( temp 2X2 matrix of float) -0:402 exp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'R020' ( temp 2X2 matrix of float) -0:402 exp2 ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r021' ( temp 2X2 matrix of float) -0:402 Floor ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r022' ( temp 2X2 matrix of float) -0:402 mod ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r023' ( temp 2X2 matrix of float) -0:402 Fraction ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r025' ( temp 2X2 matrix of float) -0:402 fwidth ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r026' ( temp 2X2 matrix of float) -0:402 ldexp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r026a' ( temp 2X2 matrix of float) -0:402 mix ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r027' ( temp 2X2 matrix of float) -0:402 log ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r028' ( temp 2X2 matrix of float) -0:402 matrix-scale ( temp 2X2 matrix of float) -0:402 log2 ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Constant: -0:402 0.301030 -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r029' ( temp 2X2 matrix of float) -0:402 log2 ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r030' ( temp 2X2 matrix of float) -0:402 max ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r031' ( temp 2X2 matrix of float) -0:402 min ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r032' ( temp 2X2 matrix of float) -0:402 pow ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r033' ( temp 2X2 matrix of float) -0:402 radians ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r034' ( temp 2X2 matrix of float) -0:402 roundEven ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r035' ( temp 2X2 matrix of float) -0:402 inverse sqrt ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r036' ( temp 2X2 matrix of float) -0:402 clamp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Constant: -0:402 0.000000 -0:402 Constant: -0:402 1.000000 -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r037' ( temp 2X2 matrix of float) -0:402 Sign ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r038' ( temp 2X2 matrix of float) -0:402 sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r039' ( temp 2X2 matrix of float) -0:402 hyp. sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r049' ( temp 2X2 matrix of float) -0:402 smoothstep ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r041' ( temp 2X2 matrix of float) -0:402 sqrt ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r042' ( temp 2X2 matrix of float) -0:402 step ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r043' ( temp 2X2 matrix of float) -0:402 tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r044' ( temp 2X2 matrix of float) -0:402 hyp. tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 transpose ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r046' ( temp 2X2 matrix of float) -0:402 trunc ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:405 Branch: Return with expression +0:403 Sequence +0:403 move second child to first child ( temp bool) +0:403 'r000' ( temp bool) +0:403 all ( temp bool) +0:403 Convert float to bool ( temp 2X2 matrix of bool) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r001' ( temp 2X2 matrix of float) +0:403 Absolute value ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 arc cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp bool) +0:403 'r003' ( temp bool) +0:403 any ( temp bool) +0:403 Convert float to bool ( temp 2X2 matrix of bool) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r004' ( temp 2X2 matrix of float) +0:403 arc sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r005' ( temp 2X2 matrix of float) +0:403 arc tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r006' ( temp 2X2 matrix of float) +0:403 arc tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r007' ( temp 2X2 matrix of float) +0:403 Ceiling ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Test condition and select ( temp void) +0:403 Condition +0:403 any ( temp bool) +0:403 Compare Less Than ( temp 2X2 matrix of bool) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Constant: +0:403 0.000000 +0:403 0.000000 +0:403 0.000000 +0:403 0.000000 +0:403 true case +0:403 Branch: Kill +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r008' ( temp 2X2 matrix of float) +0:403 clamp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r009' ( temp 2X2 matrix of float) +0:403 cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r010' ( temp 2X2 matrix of float) +0:403 hyp. cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r011' ( temp 2X2 matrix of float) +0:403 dPdx ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r012' ( temp 2X2 matrix of float) +0:403 dPdxCoarse ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r013' ( temp 2X2 matrix of float) +0:403 dPdxFine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r014' ( temp 2X2 matrix of float) +0:403 dPdy ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r015' ( temp 2X2 matrix of float) +0:403 dPdyCoarse ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r016' ( temp 2X2 matrix of float) +0:403 dPdyFine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r017' ( temp 2X2 matrix of float) +0:403 degrees ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp float) +0:403 'r018' ( temp float) +0:403 determinant ( temp float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r019' ( temp 2X2 matrix of float) +0:403 exp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'R020' ( temp 2X2 matrix of float) +0:403 exp2 ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r021' ( temp 2X2 matrix of float) +0:403 Floor ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r022' ( temp 2X2 matrix of float) +0:403 mod ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r023' ( temp 2X2 matrix of float) +0:403 Fraction ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r025' ( temp 2X2 matrix of float) +0:403 fwidth ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r026' ( temp 2X2 matrix of float) +0:403 ldexp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r026a' ( temp 2X2 matrix of float) +0:403 mix ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r027' ( temp 2X2 matrix of float) +0:403 log ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r028' ( temp 2X2 matrix of float) +0:403 matrix-scale ( temp 2X2 matrix of float) +0:403 log2 ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Constant: +0:403 0.301030 +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r029' ( temp 2X2 matrix of float) +0:403 log2 ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r030' ( temp 2X2 matrix of float) +0:403 max ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r031' ( temp 2X2 matrix of float) +0:403 min ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r032' ( temp 2X2 matrix of float) +0:403 pow ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r033' ( temp 2X2 matrix of float) +0:403 radians ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r034' ( temp 2X2 matrix of float) +0:403 roundEven ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r035' ( temp 2X2 matrix of float) +0:403 inverse sqrt ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r036' ( temp 2X2 matrix of float) +0:403 clamp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Constant: +0:403 0.000000 +0:403 Constant: +0:403 1.000000 +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r037' ( temp 2X2 matrix of float) +0:403 Sign ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r038' ( temp 2X2 matrix of float) +0:403 sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r039' ( temp 2X2 matrix of float) +0:403 hyp. sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r049' ( temp 2X2 matrix of float) +0:403 smoothstep ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r041' ( temp 2X2 matrix of float) +0:403 sqrt ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r042' ( temp 2X2 matrix of float) +0:403 step ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r043' ( temp 2X2 matrix of float) +0:403 tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r044' ( temp 2X2 matrix of float) +0:403 hyp. tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 transpose ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r046' ( temp 2X2 matrix of float) +0:403 trunc ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:406 Branch: Return with expression 0:? Constant: 0:? 2.000000 0:? 2.000000 0:? 2.000000 0:? 2.000000 -0:409 Function Definition: PixelShaderFunction3x3(mf33;mf33;mf33; ( temp 3X3 matrix of float) -0:409 Function Parameters: -0:409 'inF0' ( in 3X3 matrix of float) -0:409 'inF1' ( in 3X3 matrix of float) -0:409 'inF2' ( in 3X3 matrix of float) +0:410 Function Definition: PixelShaderFunction3x3(mf33;mf33;mf33; ( temp 3X3 matrix of float) +0:410 Function Parameters: +0:410 'inF0' ( in 3X3 matrix of float) +0:410 'inF1' ( in 3X3 matrix of float) +0:410 'inF2' ( in 3X3 matrix of float) 0:? Sequence -0:411 Sequence -0:411 move second child to first child ( temp bool) -0:411 'r000' ( temp bool) -0:411 all ( temp bool) -0:411 Convert float to bool ( temp 3X3 matrix of bool) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r001' ( temp 3X3 matrix of float) -0:411 Absolute value ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 arc cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp bool) -0:411 'r003' ( temp bool) -0:411 any ( temp bool) -0:411 Convert float to bool ( temp 3X3 matrix of bool) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r004' ( temp 3X3 matrix of float) -0:411 arc sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r005' ( temp 3X3 matrix of float) -0:411 arc tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r006' ( temp 3X3 matrix of float) -0:411 arc tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r007' ( temp 3X3 matrix of float) -0:411 Ceiling ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Test condition and select ( temp void) -0:411 Condition -0:411 any ( temp bool) -0:411 Compare Less Than ( temp 3X3 matrix of bool) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Constant: -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 true case -0:411 Branch: Kill -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r008' ( temp 3X3 matrix of float) -0:411 clamp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r009' ( temp 3X3 matrix of float) -0:411 cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r010' ( temp 3X3 matrix of float) -0:411 hyp. cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r011' ( temp 3X3 matrix of float) -0:411 dPdx ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r012' ( temp 3X3 matrix of float) -0:411 dPdxCoarse ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r013' ( temp 3X3 matrix of float) -0:411 dPdxFine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r014' ( temp 3X3 matrix of float) -0:411 dPdy ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r015' ( temp 3X3 matrix of float) -0:411 dPdyCoarse ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r016' ( temp 3X3 matrix of float) -0:411 dPdyFine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r017' ( temp 3X3 matrix of float) -0:411 degrees ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp float) -0:411 'r018' ( temp float) -0:411 determinant ( temp float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r019' ( temp 3X3 matrix of float) -0:411 exp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'R020' ( temp 3X3 matrix of float) -0:411 exp2 ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r021' ( temp 3X3 matrix of float) -0:411 Floor ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r022' ( temp 3X3 matrix of float) -0:411 mod ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r023' ( temp 3X3 matrix of float) -0:411 Fraction ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r025' ( temp 3X3 matrix of float) -0:411 fwidth ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r026' ( temp 3X3 matrix of float) -0:411 ldexp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r026a' ( temp 3X3 matrix of float) -0:411 mix ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r027' ( temp 3X3 matrix of float) -0:411 log ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r028' ( temp 3X3 matrix of float) -0:411 matrix-scale ( temp 3X3 matrix of float) -0:411 log2 ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Constant: -0:411 0.301030 -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r029' ( temp 3X3 matrix of float) -0:411 log2 ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r030' ( temp 3X3 matrix of float) -0:411 max ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r031' ( temp 3X3 matrix of float) -0:411 min ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r032' ( temp 3X3 matrix of float) -0:411 pow ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r033' ( temp 3X3 matrix of float) -0:411 radians ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r034' ( temp 3X3 matrix of float) -0:411 roundEven ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r035' ( temp 3X3 matrix of float) -0:411 inverse sqrt ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r036' ( temp 3X3 matrix of float) -0:411 clamp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Constant: -0:411 0.000000 -0:411 Constant: -0:411 1.000000 -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r037' ( temp 3X3 matrix of float) -0:411 Sign ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r038' ( temp 3X3 matrix of float) -0:411 sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r039' ( temp 3X3 matrix of float) -0:411 hyp. sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r049' ( temp 3X3 matrix of float) -0:411 smoothstep ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r041' ( temp 3X3 matrix of float) -0:411 sqrt ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r042' ( temp 3X3 matrix of float) -0:411 step ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r043' ( temp 3X3 matrix of float) -0:411 tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r044' ( temp 3X3 matrix of float) -0:411 hyp. tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 transpose ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r046' ( temp 3X3 matrix of float) -0:411 trunc ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:414 Branch: Return with expression +0:412 Sequence +0:412 move second child to first child ( temp bool) +0:412 'r000' ( temp bool) +0:412 all ( temp bool) +0:412 Convert float to bool ( temp 3X3 matrix of bool) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r001' ( temp 3X3 matrix of float) +0:412 Absolute value ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 arc cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp bool) +0:412 'r003' ( temp bool) +0:412 any ( temp bool) +0:412 Convert float to bool ( temp 3X3 matrix of bool) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r004' ( temp 3X3 matrix of float) +0:412 arc sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r005' ( temp 3X3 matrix of float) +0:412 arc tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r006' ( temp 3X3 matrix of float) +0:412 arc tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r007' ( temp 3X3 matrix of float) +0:412 Ceiling ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Test condition and select ( temp void) +0:412 Condition +0:412 any ( temp bool) +0:412 Compare Less Than ( temp 3X3 matrix of bool) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Constant: +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 true case +0:412 Branch: Kill +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r008' ( temp 3X3 matrix of float) +0:412 clamp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r009' ( temp 3X3 matrix of float) +0:412 cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r010' ( temp 3X3 matrix of float) +0:412 hyp. cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r011' ( temp 3X3 matrix of float) +0:412 dPdx ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r012' ( temp 3X3 matrix of float) +0:412 dPdxCoarse ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r013' ( temp 3X3 matrix of float) +0:412 dPdxFine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r014' ( temp 3X3 matrix of float) +0:412 dPdy ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r015' ( temp 3X3 matrix of float) +0:412 dPdyCoarse ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r016' ( temp 3X3 matrix of float) +0:412 dPdyFine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r017' ( temp 3X3 matrix of float) +0:412 degrees ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp float) +0:412 'r018' ( temp float) +0:412 determinant ( temp float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r019' ( temp 3X3 matrix of float) +0:412 exp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'R020' ( temp 3X3 matrix of float) +0:412 exp2 ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r021' ( temp 3X3 matrix of float) +0:412 Floor ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r022' ( temp 3X3 matrix of float) +0:412 mod ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r023' ( temp 3X3 matrix of float) +0:412 Fraction ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r025' ( temp 3X3 matrix of float) +0:412 fwidth ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r026' ( temp 3X3 matrix of float) +0:412 ldexp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r026a' ( temp 3X3 matrix of float) +0:412 mix ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r027' ( temp 3X3 matrix of float) +0:412 log ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r028' ( temp 3X3 matrix of float) +0:412 matrix-scale ( temp 3X3 matrix of float) +0:412 log2 ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Constant: +0:412 0.301030 +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r029' ( temp 3X3 matrix of float) +0:412 log2 ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r030' ( temp 3X3 matrix of float) +0:412 max ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r031' ( temp 3X3 matrix of float) +0:412 min ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r032' ( temp 3X3 matrix of float) +0:412 pow ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r033' ( temp 3X3 matrix of float) +0:412 radians ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r034' ( temp 3X3 matrix of float) +0:412 roundEven ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r035' ( temp 3X3 matrix of float) +0:412 inverse sqrt ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r036' ( temp 3X3 matrix of float) +0:412 clamp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Constant: +0:412 0.000000 +0:412 Constant: +0:412 1.000000 +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r037' ( temp 3X3 matrix of float) +0:412 Sign ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r038' ( temp 3X3 matrix of float) +0:412 sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r039' ( temp 3X3 matrix of float) +0:412 hyp. sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r049' ( temp 3X3 matrix of float) +0:412 smoothstep ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r041' ( temp 3X3 matrix of float) +0:412 sqrt ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r042' ( temp 3X3 matrix of float) +0:412 step ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r043' ( temp 3X3 matrix of float) +0:412 tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r044' ( temp 3X3 matrix of float) +0:412 hyp. tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 transpose ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r046' ( temp 3X3 matrix of float) +0:412 trunc ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:415 Branch: Return with expression 0:? Constant: 0:? 3.000000 0:? 3.000000 @@ -2162,297 +2168,297 @@ gl_FragCoord origin is upper left 0:? 3.000000 0:? 3.000000 0:? 3.000000 -0:418 Function Definition: PixelShaderFunction4x4(mf44;mf44;mf44; ( temp 4X4 matrix of float) -0:418 Function Parameters: -0:418 'inF0' ( in 4X4 matrix of float) -0:418 'inF1' ( in 4X4 matrix of float) -0:418 'inF2' ( in 4X4 matrix of float) +0:419 Function Definition: PixelShaderFunction4x4(mf44;mf44;mf44; ( temp 4X4 matrix of float) +0:419 Function Parameters: +0:419 'inF0' ( in 4X4 matrix of float) +0:419 'inF1' ( in 4X4 matrix of float) +0:419 'inF2' ( in 4X4 matrix of float) 0:? Sequence -0:420 Sequence -0:420 move second child to first child ( temp bool) -0:420 'r000' ( temp bool) -0:420 all ( temp bool) -0:420 Convert float to bool ( temp 4X4 matrix of bool) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r001' ( temp 4X4 matrix of float) -0:420 Absolute value ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 arc cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp bool) -0:420 'r003' ( temp bool) -0:420 any ( temp bool) -0:420 Convert float to bool ( temp 4X4 matrix of bool) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r004' ( temp 4X4 matrix of float) -0:420 arc sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r005' ( temp 4X4 matrix of float) -0:420 arc tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r006' ( temp 4X4 matrix of float) -0:420 arc tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r007' ( temp 4X4 matrix of float) -0:420 Ceiling ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Test condition and select ( temp void) -0:420 Condition -0:420 any ( temp bool) -0:420 Compare Less Than ( temp 4X4 matrix of bool) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Constant: -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 true case -0:420 Branch: Kill -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r008' ( temp 4X4 matrix of float) -0:420 clamp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r009' ( temp 4X4 matrix of float) -0:420 cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r010' ( temp 4X4 matrix of float) -0:420 hyp. cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r011' ( temp 4X4 matrix of float) -0:420 dPdx ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r012' ( temp 4X4 matrix of float) -0:420 dPdxCoarse ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r013' ( temp 4X4 matrix of float) -0:420 dPdxFine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r014' ( temp 4X4 matrix of float) -0:420 dPdy ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r015' ( temp 4X4 matrix of float) -0:420 dPdyCoarse ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r016' ( temp 4X4 matrix of float) -0:420 dPdyFine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r017' ( temp 4X4 matrix of float) -0:420 degrees ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp float) -0:420 'r018' ( temp float) -0:420 determinant ( temp float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r019' ( temp 4X4 matrix of float) -0:420 exp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'R020' ( temp 4X4 matrix of float) -0:420 exp2 ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r021' ( temp 4X4 matrix of float) -0:420 Floor ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r022' ( temp 4X4 matrix of float) -0:420 mod ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r023' ( temp 4X4 matrix of float) -0:420 Fraction ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r025' ( temp 4X4 matrix of float) -0:420 fwidth ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r026' ( temp 4X4 matrix of float) -0:420 ldexp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r026a' ( temp 4X4 matrix of float) -0:420 mix ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r027' ( temp 4X4 matrix of float) -0:420 log ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r028' ( temp 4X4 matrix of float) -0:420 matrix-scale ( temp 4X4 matrix of float) -0:420 log2 ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Constant: -0:420 0.301030 -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r029' ( temp 4X4 matrix of float) -0:420 log2 ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r030' ( temp 4X4 matrix of float) -0:420 max ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r031' ( temp 4X4 matrix of float) -0:420 min ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r032' ( temp 4X4 matrix of float) -0:420 pow ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r033' ( temp 4X4 matrix of float) -0:420 radians ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r034' ( temp 4X4 matrix of float) -0:420 roundEven ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r035' ( temp 4X4 matrix of float) -0:420 inverse sqrt ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r036' ( temp 4X4 matrix of float) -0:420 clamp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Constant: -0:420 0.000000 -0:420 Constant: -0:420 1.000000 -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r037' ( temp 4X4 matrix of float) -0:420 Sign ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r038' ( temp 4X4 matrix of float) -0:420 sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r039' ( temp 4X4 matrix of float) -0:420 hyp. sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r049' ( temp 4X4 matrix of float) -0:420 smoothstep ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r041' ( temp 4X4 matrix of float) -0:420 sqrt ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r042' ( temp 4X4 matrix of float) -0:420 step ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r043' ( temp 4X4 matrix of float) -0:420 tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r044' ( temp 4X4 matrix of float) -0:420 hyp. tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 transpose ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r046' ( temp 4X4 matrix of float) -0:420 trunc ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:423 Branch: Return with expression +0:421 Sequence +0:421 move second child to first child ( temp bool) +0:421 'r000' ( temp bool) +0:421 all ( temp bool) +0:421 Convert float to bool ( temp 4X4 matrix of bool) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r001' ( temp 4X4 matrix of float) +0:421 Absolute value ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 arc cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp bool) +0:421 'r003' ( temp bool) +0:421 any ( temp bool) +0:421 Convert float to bool ( temp 4X4 matrix of bool) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r004' ( temp 4X4 matrix of float) +0:421 arc sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r005' ( temp 4X4 matrix of float) +0:421 arc tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r006' ( temp 4X4 matrix of float) +0:421 arc tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r007' ( temp 4X4 matrix of float) +0:421 Ceiling ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Test condition and select ( temp void) +0:421 Condition +0:421 any ( temp bool) +0:421 Compare Less Than ( temp 4X4 matrix of bool) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Constant: +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 true case +0:421 Branch: Kill +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r008' ( temp 4X4 matrix of float) +0:421 clamp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r009' ( temp 4X4 matrix of float) +0:421 cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r010' ( temp 4X4 matrix of float) +0:421 hyp. cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r011' ( temp 4X4 matrix of float) +0:421 dPdx ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r012' ( temp 4X4 matrix of float) +0:421 dPdxCoarse ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r013' ( temp 4X4 matrix of float) +0:421 dPdxFine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r014' ( temp 4X4 matrix of float) +0:421 dPdy ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r015' ( temp 4X4 matrix of float) +0:421 dPdyCoarse ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r016' ( temp 4X4 matrix of float) +0:421 dPdyFine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r017' ( temp 4X4 matrix of float) +0:421 degrees ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp float) +0:421 'r018' ( temp float) +0:421 determinant ( temp float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r019' ( temp 4X4 matrix of float) +0:421 exp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'R020' ( temp 4X4 matrix of float) +0:421 exp2 ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r021' ( temp 4X4 matrix of float) +0:421 Floor ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r022' ( temp 4X4 matrix of float) +0:421 mod ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r023' ( temp 4X4 matrix of float) +0:421 Fraction ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r025' ( temp 4X4 matrix of float) +0:421 fwidth ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r026' ( temp 4X4 matrix of float) +0:421 ldexp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r026a' ( temp 4X4 matrix of float) +0:421 mix ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r027' ( temp 4X4 matrix of float) +0:421 log ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r028' ( temp 4X4 matrix of float) +0:421 matrix-scale ( temp 4X4 matrix of float) +0:421 log2 ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Constant: +0:421 0.301030 +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r029' ( temp 4X4 matrix of float) +0:421 log2 ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r030' ( temp 4X4 matrix of float) +0:421 max ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r031' ( temp 4X4 matrix of float) +0:421 min ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r032' ( temp 4X4 matrix of float) +0:421 pow ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r033' ( temp 4X4 matrix of float) +0:421 radians ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r034' ( temp 4X4 matrix of float) +0:421 roundEven ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r035' ( temp 4X4 matrix of float) +0:421 inverse sqrt ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r036' ( temp 4X4 matrix of float) +0:421 clamp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Constant: +0:421 0.000000 +0:421 Constant: +0:421 1.000000 +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r037' ( temp 4X4 matrix of float) +0:421 Sign ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r038' ( temp 4X4 matrix of float) +0:421 sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r039' ( temp 4X4 matrix of float) +0:421 hyp. sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r049' ( temp 4X4 matrix of float) +0:421 smoothstep ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r041' ( temp 4X4 matrix of float) +0:421 sqrt ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r042' ( temp 4X4 matrix of float) +0:421 step ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r043' ( temp 4X4 matrix of float) +0:421 tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r044' ( temp 4X4 matrix of float) +0:421 hyp. tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 transpose ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r046' ( temp 4X4 matrix of float) +0:421 trunc ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:424 Branch: Return with expression 0:? Constant: 0:? 4.000000 0:? 4.000000 @@ -2470,334 +2476,334 @@ gl_FragCoord origin is upper left 0:? 4.000000 0:? 4.000000 0:? 4.000000 -0:441 Function Definition: TestGenMul2(f1;f1;vf2;vf2;mf22;mf22; ( temp void) -0:441 Function Parameters: -0:441 'inF0' ( in float) -0:441 'inF1' ( in float) -0:441 'inFV0' ( in 2-component vector of float) -0:441 'inFV1' ( in 2-component vector of float) -0:441 'inFM0' ( in 2X2 matrix of float) -0:441 'inFM1' ( in 2X2 matrix of float) +0:442 Function Definition: TestGenMul2(f1;f1;vf2;vf2;mf22;mf22; ( temp void) +0:442 Function Parameters: +0:442 'inF0' ( in float) +0:442 'inF1' ( in float) +0:442 'inFV0' ( in 2-component vector of float) +0:442 'inFV1' ( in 2-component vector of float) +0:442 'inFM0' ( in 2X2 matrix of float) +0:442 'inFM1' ( in 2X2 matrix of float) 0:? Sequence -0:442 Sequence -0:442 move second child to first child ( temp float) -0:442 'r0' ( temp float) -0:442 component-wise multiply ( temp float) -0:442 'inF1' ( in float) -0:442 'inF0' ( in float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r1' ( temp 2-component vector of float) -0:442 vector-scale ( temp 2-component vector of float) -0:442 'inF0' ( in float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r2' ( temp 2-component vector of float) -0:442 vector-scale ( temp 2-component vector of float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 'inF0' ( in float) -0:442 Sequence -0:442 move second child to first child ( temp float) -0:442 'r3' ( temp float) -0:442 dot-product ( temp float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 'inFV1' ( in 2-component vector of float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r4' ( temp 2-component vector of float) -0:442 vector-times-matrix ( temp 2-component vector of float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r5' ( temp 2-component vector of float) -0:442 matrix-times-vector ( temp 2-component vector of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 Sequence -0:442 move second child to first child ( temp 2X2 matrix of float) -0:442 'r6' ( temp 2X2 matrix of float) -0:442 matrix-scale ( temp 2X2 matrix of float) -0:442 'inF0' ( in float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 Sequence -0:442 move second child to first child ( temp 2X2 matrix of float) -0:442 'r7' ( temp 2X2 matrix of float) -0:442 matrix-scale ( temp 2X2 matrix of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 'inF0' ( in float) -0:442 Sequence -0:442 move second child to first child ( temp 2X2 matrix of float) -0:442 'r8' ( temp 2X2 matrix of float) -0:442 matrix-multiply ( temp 2X2 matrix of float) -0:442 'inFM1' ( in 2X2 matrix of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:448 Function Definition: TestGenMul3(f1;f1;vf3;vf3;mf33;mf33; ( temp void) -0:448 Function Parameters: -0:448 'inF0' ( in float) -0:448 'inF1' ( in float) -0:448 'inFV0' ( in 3-component vector of float) -0:448 'inFV1' ( in 3-component vector of float) -0:448 'inFM0' ( in 3X3 matrix of float) -0:448 'inFM1' ( in 3X3 matrix of float) +0:443 Sequence +0:443 move second child to first child ( temp float) +0:443 'r0' ( temp float) +0:443 component-wise multiply ( temp float) +0:443 'inF1' ( in float) +0:443 'inF0' ( in float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r1' ( temp 2-component vector of float) +0:443 vector-scale ( temp 2-component vector of float) +0:443 'inF0' ( in float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r2' ( temp 2-component vector of float) +0:443 vector-scale ( temp 2-component vector of float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 'inF0' ( in float) +0:443 Sequence +0:443 move second child to first child ( temp float) +0:443 'r3' ( temp float) +0:443 dot-product ( temp float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 'inFV1' ( in 2-component vector of float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r4' ( temp 2-component vector of float) +0:443 vector-times-matrix ( temp 2-component vector of float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r5' ( temp 2-component vector of float) +0:443 matrix-times-vector ( temp 2-component vector of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 Sequence +0:443 move second child to first child ( temp 2X2 matrix of float) +0:443 'r6' ( temp 2X2 matrix of float) +0:443 matrix-scale ( temp 2X2 matrix of float) +0:443 'inF0' ( in float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 Sequence +0:443 move second child to first child ( temp 2X2 matrix of float) +0:443 'r7' ( temp 2X2 matrix of float) +0:443 matrix-scale ( temp 2X2 matrix of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 'inF0' ( in float) +0:443 Sequence +0:443 move second child to first child ( temp 2X2 matrix of float) +0:443 'r8' ( temp 2X2 matrix of float) +0:443 matrix-multiply ( temp 2X2 matrix of float) +0:443 'inFM1' ( in 2X2 matrix of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:449 Function Definition: TestGenMul3(f1;f1;vf3;vf3;mf33;mf33; ( temp void) +0:449 Function Parameters: +0:449 'inF0' ( in float) +0:449 'inF1' ( in float) +0:449 'inFV0' ( in 3-component vector of float) +0:449 'inFV1' ( in 3-component vector of float) +0:449 'inFM0' ( in 3X3 matrix of float) +0:449 'inFM1' ( in 3X3 matrix of float) 0:? Sequence -0:449 Sequence -0:449 move second child to first child ( temp float) -0:449 'r0' ( temp float) -0:449 component-wise multiply ( temp float) -0:449 'inF1' ( in float) -0:449 'inF0' ( in float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r1' ( temp 3-component vector of float) -0:449 vector-scale ( temp 3-component vector of float) -0:449 'inF0' ( in float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r2' ( temp 3-component vector of float) -0:449 vector-scale ( temp 3-component vector of float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 'inF0' ( in float) -0:449 Sequence -0:449 move second child to first child ( temp float) -0:449 'r3' ( temp float) -0:449 dot-product ( temp float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 'inFV1' ( in 3-component vector of float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r4' ( temp 3-component vector of float) -0:449 vector-times-matrix ( temp 3-component vector of float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r5' ( temp 3-component vector of float) -0:449 matrix-times-vector ( temp 3-component vector of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 Sequence -0:449 move second child to first child ( temp 3X3 matrix of float) -0:449 'r6' ( temp 3X3 matrix of float) -0:449 matrix-scale ( temp 3X3 matrix of float) -0:449 'inF0' ( in float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 Sequence -0:449 move second child to first child ( temp 3X3 matrix of float) -0:449 'r7' ( temp 3X3 matrix of float) -0:449 matrix-scale ( temp 3X3 matrix of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 'inF0' ( in float) -0:449 Sequence -0:449 move second child to first child ( temp 3X3 matrix of float) -0:449 'r8' ( temp 3X3 matrix of float) -0:449 matrix-multiply ( temp 3X3 matrix of float) -0:449 'inFM1' ( in 3X3 matrix of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:455 Function Definition: TestGenMul4(f1;f1;vf4;vf4;mf44;mf44; ( temp void) -0:455 Function Parameters: -0:455 'inF0' ( in float) -0:455 'inF1' ( in float) -0:455 'inFV0' ( in 4-component vector of float) -0:455 'inFV1' ( in 4-component vector of float) -0:455 'inFM0' ( in 4X4 matrix of float) -0:455 'inFM1' ( in 4X4 matrix of float) +0:450 Sequence +0:450 move second child to first child ( temp float) +0:450 'r0' ( temp float) +0:450 component-wise multiply ( temp float) +0:450 'inF1' ( in float) +0:450 'inF0' ( in float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r1' ( temp 3-component vector of float) +0:450 vector-scale ( temp 3-component vector of float) +0:450 'inF0' ( in float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r2' ( temp 3-component vector of float) +0:450 vector-scale ( temp 3-component vector of float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 'inF0' ( in float) +0:450 Sequence +0:450 move second child to first child ( temp float) +0:450 'r3' ( temp float) +0:450 dot-product ( temp float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 'inFV1' ( in 3-component vector of float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r4' ( temp 3-component vector of float) +0:450 vector-times-matrix ( temp 3-component vector of float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r5' ( temp 3-component vector of float) +0:450 matrix-times-vector ( temp 3-component vector of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 Sequence +0:450 move second child to first child ( temp 3X3 matrix of float) +0:450 'r6' ( temp 3X3 matrix of float) +0:450 matrix-scale ( temp 3X3 matrix of float) +0:450 'inF0' ( in float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 Sequence +0:450 move second child to first child ( temp 3X3 matrix of float) +0:450 'r7' ( temp 3X3 matrix of float) +0:450 matrix-scale ( temp 3X3 matrix of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 'inF0' ( in float) +0:450 Sequence +0:450 move second child to first child ( temp 3X3 matrix of float) +0:450 'r8' ( temp 3X3 matrix of float) +0:450 matrix-multiply ( temp 3X3 matrix of float) +0:450 'inFM1' ( in 3X3 matrix of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:456 Function Definition: TestGenMul4(f1;f1;vf4;vf4;mf44;mf44; ( temp void) +0:456 Function Parameters: +0:456 'inF0' ( in float) +0:456 'inF1' ( in float) +0:456 'inFV0' ( in 4-component vector of float) +0:456 'inFV1' ( in 4-component vector of float) +0:456 'inFM0' ( in 4X4 matrix of float) +0:456 'inFM1' ( in 4X4 matrix of float) 0:? Sequence -0:456 Sequence -0:456 move second child to first child ( temp float) -0:456 'r0' ( temp float) -0:456 component-wise multiply ( temp float) -0:456 'inF1' ( in float) -0:456 'inF0' ( in float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r1' ( temp 4-component vector of float) -0:456 vector-scale ( temp 4-component vector of float) -0:456 'inF0' ( in float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r2' ( temp 4-component vector of float) -0:456 vector-scale ( temp 4-component vector of float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 'inF0' ( in float) -0:456 Sequence -0:456 move second child to first child ( temp float) -0:456 'r3' ( temp float) -0:456 dot-product ( temp float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 'inFV1' ( in 4-component vector of float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r4' ( temp 4-component vector of float) -0:456 vector-times-matrix ( temp 4-component vector of float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r5' ( temp 4-component vector of float) -0:456 matrix-times-vector ( temp 4-component vector of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 Sequence -0:456 move second child to first child ( temp 4X4 matrix of float) -0:456 'r6' ( temp 4X4 matrix of float) -0:456 matrix-scale ( temp 4X4 matrix of float) -0:456 'inF0' ( in float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 Sequence -0:456 move second child to first child ( temp 4X4 matrix of float) -0:456 'r7' ( temp 4X4 matrix of float) -0:456 matrix-scale ( temp 4X4 matrix of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 'inF0' ( in float) -0:456 Sequence -0:456 move second child to first child ( temp 4X4 matrix of float) -0:456 'r8' ( temp 4X4 matrix of float) -0:456 matrix-multiply ( temp 4X4 matrix of float) -0:456 'inFM1' ( in 4X4 matrix of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:465 Function Definition: TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24; ( temp void) -0:465 Function Parameters: -0:465 'inF0' ( in float) -0:465 'inF1' ( in float) -0:465 'inFV2' ( in 2-component vector of float) -0:465 'inFV3' ( in 3-component vector of float) -0:465 'inFM2x3' ( in 2X3 matrix of float) -0:465 'inFM3x2' ( in 3X2 matrix of float) -0:465 'inFM3x3' ( in 3X3 matrix of float) -0:465 'inFM3x4' ( in 3X4 matrix of float) -0:465 'inFM2x4' ( in 2X4 matrix of float) +0:457 Sequence +0:457 move second child to first child ( temp float) +0:457 'r0' ( temp float) +0:457 component-wise multiply ( temp float) +0:457 'inF1' ( in float) +0:457 'inF0' ( in float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r1' ( temp 4-component vector of float) +0:457 vector-scale ( temp 4-component vector of float) +0:457 'inF0' ( in float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r2' ( temp 4-component vector of float) +0:457 vector-scale ( temp 4-component vector of float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 'inF0' ( in float) +0:457 Sequence +0:457 move second child to first child ( temp float) +0:457 'r3' ( temp float) +0:457 dot-product ( temp float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 'inFV1' ( in 4-component vector of float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r4' ( temp 4-component vector of float) +0:457 vector-times-matrix ( temp 4-component vector of float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r5' ( temp 4-component vector of float) +0:457 matrix-times-vector ( temp 4-component vector of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 Sequence +0:457 move second child to first child ( temp 4X4 matrix of float) +0:457 'r6' ( temp 4X4 matrix of float) +0:457 matrix-scale ( temp 4X4 matrix of float) +0:457 'inF0' ( in float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 Sequence +0:457 move second child to first child ( temp 4X4 matrix of float) +0:457 'r7' ( temp 4X4 matrix of float) +0:457 matrix-scale ( temp 4X4 matrix of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 'inF0' ( in float) +0:457 Sequence +0:457 move second child to first child ( temp 4X4 matrix of float) +0:457 'r8' ( temp 4X4 matrix of float) +0:457 matrix-multiply ( temp 4X4 matrix of float) +0:457 'inFM1' ( in 4X4 matrix of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:466 Function Definition: TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24; ( temp void) +0:466 Function Parameters: +0:466 'inF0' ( in float) +0:466 'inF1' ( in float) +0:466 'inFV2' ( in 2-component vector of float) +0:466 'inFV3' ( in 3-component vector of float) +0:466 'inFM2x3' ( in 2X3 matrix of float) +0:466 'inFM3x2' ( in 3X2 matrix of float) +0:466 'inFM3x3' ( in 3X3 matrix of float) +0:466 'inFM3x4' ( in 3X4 matrix of float) +0:466 'inFM2x4' ( in 2X4 matrix of float) 0:? Sequence -0:466 Sequence -0:466 move second child to first child ( temp float) -0:466 'r00' ( temp float) -0:466 component-wise multiply ( temp float) -0:466 'inF1' ( in float) -0:466 'inF0' ( in float) 0:467 Sequence -0:467 move second child to first child ( temp 2-component vector of float) -0:467 'r01' ( temp 2-component vector of float) -0:467 vector-scale ( temp 2-component vector of float) +0:467 move second child to first child ( temp float) +0:467 'r00' ( temp float) +0:467 component-wise multiply ( temp float) +0:467 'inF1' ( in float) 0:467 'inF0' ( in float) -0:467 'inFV2' ( in 2-component vector of float) 0:468 Sequence -0:468 move second child to first child ( temp 3-component vector of float) -0:468 'r02' ( temp 3-component vector of float) -0:468 vector-scale ( temp 3-component vector of float) +0:468 move second child to first child ( temp 2-component vector of float) +0:468 'r01' ( temp 2-component vector of float) +0:468 vector-scale ( temp 2-component vector of float) 0:468 'inF0' ( in float) -0:468 'inFV3' ( in 3-component vector of float) +0:468 'inFV2' ( in 2-component vector of float) 0:469 Sequence -0:469 move second child to first child ( temp 2-component vector of float) -0:469 'r03' ( temp 2-component vector of float) -0:469 vector-scale ( temp 2-component vector of float) -0:469 'inFV2' ( in 2-component vector of float) +0:469 move second child to first child ( temp 3-component vector of float) +0:469 'r02' ( temp 3-component vector of float) +0:469 vector-scale ( temp 3-component vector of float) 0:469 'inF0' ( in float) +0:469 'inFV3' ( in 3-component vector of float) 0:470 Sequence -0:470 move second child to first child ( temp 3-component vector of float) -0:470 'r04' ( temp 3-component vector of float) -0:470 vector-scale ( temp 3-component vector of float) -0:470 'inFV3' ( in 3-component vector of float) +0:470 move second child to first child ( temp 2-component vector of float) +0:470 'r03' ( temp 2-component vector of float) +0:470 vector-scale ( temp 2-component vector of float) +0:470 'inFV2' ( in 2-component vector of float) 0:470 'inF0' ( in float) 0:471 Sequence -0:471 move second child to first child ( temp float) -0:471 'r05' ( temp float) -0:471 dot-product ( temp float) -0:471 'inFV2' ( in 2-component vector of float) -0:471 'inFV2' ( in 2-component vector of float) +0:471 move second child to first child ( temp 3-component vector of float) +0:471 'r04' ( temp 3-component vector of float) +0:471 vector-scale ( temp 3-component vector of float) +0:471 'inFV3' ( in 3-component vector of float) +0:471 'inF0' ( in float) 0:472 Sequence 0:472 move second child to first child ( temp float) -0:472 'r06' ( temp float) +0:472 'r05' ( temp float) 0:472 dot-product ( temp float) -0:472 'inFV3' ( in 3-component vector of float) -0:472 'inFV3' ( in 3-component vector of float) +0:472 'inFV2' ( in 2-component vector of float) +0:472 'inFV2' ( in 2-component vector of float) 0:473 Sequence -0:473 move second child to first child ( temp 3-component vector of float) -0:473 'r07' ( temp 3-component vector of float) -0:473 matrix-times-vector ( temp 3-component vector of float) -0:473 'inFM2x3' ( in 2X3 matrix of float) -0:473 'inFV2' ( in 2-component vector of float) +0:473 move second child to first child ( temp float) +0:473 'r06' ( temp float) +0:473 dot-product ( temp float) +0:473 'inFV3' ( in 3-component vector of float) +0:473 'inFV3' ( in 3-component vector of float) 0:474 Sequence -0:474 move second child to first child ( temp 2-component vector of float) -0:474 'r08' ( temp 2-component vector of float) -0:474 matrix-times-vector ( temp 2-component vector of float) -0:474 'inFM3x2' ( in 3X2 matrix of float) -0:474 'inFV3' ( in 3-component vector of float) +0:474 move second child to first child ( temp 3-component vector of float) +0:474 'r07' ( temp 3-component vector of float) +0:474 matrix-times-vector ( temp 3-component vector of float) +0:474 'inFM2x3' ( in 2X3 matrix of float) +0:474 'inFV2' ( in 2-component vector of float) 0:475 Sequence 0:475 move second child to first child ( temp 2-component vector of float) -0:475 'r09' ( temp 2-component vector of float) -0:475 vector-times-matrix ( temp 2-component vector of float) +0:475 'r08' ( temp 2-component vector of float) +0:475 matrix-times-vector ( temp 2-component vector of float) +0:475 'inFM3x2' ( in 3X2 matrix of float) 0:475 'inFV3' ( in 3-component vector of float) -0:475 'inFM2x3' ( in 2X3 matrix of float) 0:476 Sequence -0:476 move second child to first child ( temp 3-component vector of float) -0:476 'r10' ( temp 3-component vector of float) -0:476 vector-times-matrix ( temp 3-component vector of float) -0:476 'inFV2' ( in 2-component vector of float) -0:476 'inFM3x2' ( in 3X2 matrix of float) +0:476 move second child to first child ( temp 2-component vector of float) +0:476 'r09' ( temp 2-component vector of float) +0:476 vector-times-matrix ( temp 2-component vector of float) +0:476 'inFV3' ( in 3-component vector of float) +0:476 'inFM2x3' ( in 2X3 matrix of float) 0:477 Sequence -0:477 move second child to first child ( temp 2X3 matrix of float) -0:477 'r11' ( temp 2X3 matrix of float) -0:477 matrix-scale ( temp 2X3 matrix of float) -0:477 'inF0' ( in float) -0:477 'inFM2x3' ( in 2X3 matrix of float) +0:477 move second child to first child ( temp 3-component vector of float) +0:477 'r10' ( temp 3-component vector of float) +0:477 vector-times-matrix ( temp 3-component vector of float) +0:477 'inFV2' ( in 2-component vector of float) +0:477 'inFM3x2' ( in 3X2 matrix of float) 0:478 Sequence -0:478 move second child to first child ( temp 3X2 matrix of float) -0:478 'r12' ( temp 3X2 matrix of float) -0:478 matrix-scale ( temp 3X2 matrix of float) +0:478 move second child to first child ( temp 2X3 matrix of float) +0:478 'r11' ( temp 2X3 matrix of float) +0:478 matrix-scale ( temp 2X3 matrix of float) 0:478 'inF0' ( in float) -0:478 'inFM3x2' ( in 3X2 matrix of float) +0:478 'inFM2x3' ( in 2X3 matrix of float) 0:479 Sequence -0:479 move second child to first child ( temp 2X2 matrix of float) -0:479 'r13' ( temp 2X2 matrix of float) -0:479 matrix-multiply ( temp 2X2 matrix of float) +0:479 move second child to first child ( temp 3X2 matrix of float) +0:479 'r12' ( temp 3X2 matrix of float) +0:479 matrix-scale ( temp 3X2 matrix of float) +0:479 'inF0' ( in float) 0:479 'inFM3x2' ( in 3X2 matrix of float) -0:479 'inFM2x3' ( in 2X3 matrix of float) 0:480 Sequence -0:480 move second child to first child ( temp 2X3 matrix of float) -0:480 'r14' ( temp 2X3 matrix of float) -0:480 matrix-multiply ( temp 2X3 matrix of float) -0:480 'inFM3x3' ( in 3X3 matrix of float) +0:480 move second child to first child ( temp 2X2 matrix of float) +0:480 'r13' ( temp 2X2 matrix of float) +0:480 matrix-multiply ( temp 2X2 matrix of float) +0:480 'inFM3x2' ( in 3X2 matrix of float) 0:480 'inFM2x3' ( in 2X3 matrix of float) 0:481 Sequence -0:481 move second child to first child ( temp 2X4 matrix of float) -0:481 'r15' ( temp 2X4 matrix of float) -0:481 matrix-multiply ( temp 2X4 matrix of float) -0:481 'inFM3x4' ( in 3X4 matrix of float) +0:481 move second child to first child ( temp 2X3 matrix of float) +0:481 'r14' ( temp 2X3 matrix of float) +0:481 matrix-multiply ( temp 2X3 matrix of float) +0:481 'inFM3x3' ( in 3X3 matrix of float) 0:481 'inFM2x3' ( in 2X3 matrix of float) 0:482 Sequence -0:482 move second child to first child ( temp 3X4 matrix of float) -0:482 'r16' ( temp 3X4 matrix of float) -0:482 matrix-multiply ( temp 3X4 matrix of float) -0:482 'inFM2x4' ( in 2X4 matrix of float) -0:482 'inFM3x2' ( in 3X2 matrix of float) -0:488 Function Definition: @main( ( temp structure{ temp 4-component vector of float color}) -0:488 Function Parameters: +0:482 move second child to first child ( temp 2X4 matrix of float) +0:482 'r15' ( temp 2X4 matrix of float) +0:482 matrix-multiply ( temp 2X4 matrix of float) +0:482 'inFM3x4' ( in 3X4 matrix of float) +0:482 'inFM2x3' ( in 2X3 matrix of float) +0:483 Sequence +0:483 move second child to first child ( temp 3X4 matrix of float) +0:483 'r16' ( temp 3X4 matrix of float) +0:483 matrix-multiply ( temp 3X4 matrix of float) +0:483 'inFM2x4' ( in 2X4 matrix of float) +0:483 'inFM3x2' ( in 3X2 matrix of float) +0:489 Function Definition: @main( ( temp structure{ temp 4-component vector of float color}) +0:489 Function Parameters: 0:? Sequence -0:490 move second child to first child ( temp 4-component vector of float) -0:490 color: direct index for structure ( temp 4-component vector of float) -0:490 'ps_output' ( temp structure{ temp 4-component vector of float color}) -0:490 Constant: -0:490 0 (const int) -0:490 Constant: -0:490 1.000000 -0:490 1.000000 -0:490 1.000000 -0:490 1.000000 -0:491 Branch: Return with expression -0:491 'ps_output' ( temp structure{ temp 4-component vector of float color}) -0:488 Function Definition: main( ( temp void) -0:488 Function Parameters: +0:491 move second child to first child ( temp 4-component vector of float) +0:491 color: direct index for structure ( temp 4-component vector of float) +0:491 'ps_output' ( temp structure{ temp 4-component vector of float color}) +0:491 Constant: +0:491 0 (const int) +0:491 Constant: +0:491 1.000000 +0:491 1.000000 +0:491 1.000000 +0:491 1.000000 +0:492 Branch: Return with expression +0:492 'ps_output' ( temp structure{ temp 4-component vector of float color}) +0:489 Function Definition: main( ( temp void) +0:489 Function Parameters: 0:? Sequence -0:488 Sequence -0:488 move second child to first child ( temp 4-component vector of float) +0:489 Sequence +0:489 move second child to first child ( temp 4-component vector of float) 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) -0:488 color: direct index for structure ( temp 4-component vector of float) -0:488 Function Call: @main( ( temp structure{ temp 4-component vector of float color}) -0:488 Constant: -0:488 0 (const int) +0:489 color: direct index for structure ( temp 4-component vector of float) +0:489 Function Call: @main( ( temp structure{ temp 4-component vector of float color}) +0:489 Constant: +0:489 0 (const int) 0:? Linker Objects 0:? 'gs_ua' ( shared uint) 0:? 'gs_ub' ( shared uint) @@ -2820,13 +2826,13 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:17 Function Definition: PixelShaderFunctionS(f1;f1;f1;u1;u1; ( temp float) +0:17 Function Definition: PixelShaderFunctionS(f1;f1;f1;u1;i1; ( temp float) 0:17 Function Parameters: 0:17 'inF0' ( in float) 0:17 'inF1' ( in float) 0:17 'inF2' ( in float) 0:17 'inU0' ( in uint) -0:17 'inU1' ( in uint) +0:17 'inU1' ( in int) 0:? Sequence 0:20 Sequence 0:20 move second child to first child ( temp bool) @@ -2864,7 +2870,7 @@ gl_FragCoord origin is upper left 0:26 move second child to first child ( temp uint) 0:26 'r006' ( temp uint) 0:26 floatBitsToUint ( temp uint) -0:26 'inF0' ( in float) +0:26 'inU1' ( in int) 0:27 Sequence 0:27 move second child to first child ( temp float) 0:27 'r007' ( temp float) @@ -2960,1110 +2966,1104 @@ gl_FragCoord origin is upper left 0:44 'r023' ( temp float) 0:44 degrees ( temp float) 0:44 'inF0' ( in float) -0:48 Sequence -0:48 move second child to first child ( temp float) -0:48 'r027' ( temp float) -0:48 exp ( temp float) -0:48 'inF0' ( in float) +0:45 Sequence +0:45 move second child to first child ( temp float) +0:45 'r024' ( temp float) +0:45 distance ( temp float) +0:45 'inF0' ( in float) +0:45 'inF1' ( in float) 0:49 Sequence 0:49 move second child to first child ( temp float) -0:49 'r028' ( temp float) -0:49 exp2 ( temp float) +0:49 'r027' ( temp float) +0:49 exp ( temp float) 0:49 'inF0' ( in float) 0:50 Sequence -0:50 move second child to first child ( temp uint) -0:50 'r029' ( temp uint) -0:50 Convert int to uint ( temp uint) -0:50 findMSB ( temp int) -0:50 Constant: -0:50 7 (const int) +0:50 move second child to first child ( temp float) +0:50 'r028' ( temp float) +0:50 exp2 ( temp float) +0:50 'inF0' ( in float) 0:51 Sequence 0:51 move second child to first child ( temp uint) -0:51 'r030' ( temp uint) +0:51 'r029' ( temp uint) 0:51 Convert int to uint ( temp uint) -0:51 findLSB ( temp int) +0:51 findMSB ( temp int) 0:51 Constant: 0:51 7 (const int) 0:52 Sequence -0:52 move second child to first child ( temp float) -0:52 'r031' ( temp float) -0:52 Floor ( temp float) -0:52 'inF0' ( in float) -0:54 Sequence -0:54 move second child to first child ( temp float) -0:54 'r033' ( temp float) -0:54 mod ( temp float) -0:54 'inF0' ( in float) -0:54 'inF1' ( in float) +0:52 move second child to first child ( temp uint) +0:52 'r030' ( temp uint) +0:52 Convert int to uint ( temp uint) +0:52 findLSB ( temp int) +0:52 Constant: +0:52 7 (const int) +0:53 Sequence +0:53 move second child to first child ( temp float) +0:53 'r031' ( temp float) +0:53 Floor ( temp float) +0:53 'inF0' ( in float) 0:55 Sequence 0:55 move second child to first child ( temp float) -0:55 'r034' ( temp float) -0:55 Fraction ( temp float) +0:55 'r033' ( temp float) +0:55 mod ( temp float) 0:55 'inF0' ( in float) +0:55 'inF1' ( in float) 0:56 Sequence 0:56 move second child to first child ( temp float) -0:56 'r036' ( temp float) -0:56 fwidth ( temp float) +0:56 'r034' ( temp float) +0:56 Fraction ( temp float) 0:56 'inF0' ( in float) 0:57 Sequence -0:57 move second child to first child ( temp bool) -0:57 'r037' ( temp bool) -0:57 isinf ( temp bool) +0:57 move second child to first child ( temp float) +0:57 'r036' ( temp float) +0:57 fwidth ( temp float) 0:57 'inF0' ( in float) 0:58 Sequence 0:58 move second child to first child ( temp bool) -0:58 'r038' ( temp bool) -0:58 isnan ( temp bool) +0:58 'r037' ( temp bool) +0:58 isinf ( temp bool) 0:58 'inF0' ( in float) 0:59 Sequence -0:59 move second child to first child ( temp float) -0:59 'r039' ( temp float) -0:59 ldexp ( temp float) +0:59 move second child to first child ( temp bool) +0:59 'r038' ( temp bool) +0:59 isnan ( temp bool) 0:59 'inF0' ( in float) -0:59 'inF1' ( in float) 0:60 Sequence 0:60 move second child to first child ( temp float) -0:60 'r039a' ( temp float) -0:60 mix ( temp float) +0:60 'r039' ( temp float) +0:60 ldexp ( temp float) 0:60 'inF0' ( in float) 0:60 'inF1' ( in float) -0:60 'inF2' ( in float) 0:61 Sequence 0:61 move second child to first child ( temp float) -0:61 'r040' ( temp float) -0:61 log ( temp float) +0:61 'r039a' ( temp float) +0:61 mix ( temp float) 0:61 'inF0' ( in float) +0:61 'inF1' ( in float) +0:61 'inF2' ( in float) 0:62 Sequence 0:62 move second child to first child ( temp float) -0:62 'r041' ( temp float) -0:62 component-wise multiply ( temp float) -0:62 log2 ( temp float) -0:62 'inF0' ( in float) -0:62 Constant: -0:62 0.301030 +0:62 'r040' ( temp float) +0:62 log ( temp float) +0:62 'inF0' ( in float) 0:63 Sequence 0:63 move second child to first child ( temp float) -0:63 'r042' ( temp float) -0:63 log2 ( temp float) -0:63 'inF0' ( in float) +0:63 'r041' ( temp float) +0:63 component-wise multiply ( temp float) +0:63 log2 ( temp float) +0:63 'inF0' ( in float) +0:63 Constant: +0:63 0.301030 0:64 Sequence 0:64 move second child to first child ( temp float) -0:64 'r043' ( temp float) -0:64 max ( temp float) +0:64 'r042' ( temp float) +0:64 log2 ( temp float) 0:64 'inF0' ( in float) -0:64 'inF1' ( in float) 0:65 Sequence 0:65 move second child to first child ( temp float) -0:65 'r044' ( temp float) -0:65 min ( temp float) +0:65 'r043' ( temp float) +0:65 max ( temp float) 0:65 'inF0' ( in float) 0:65 'inF1' ( in float) 0:66 Sequence 0:66 move second child to first child ( temp float) -0:66 'r045' ( temp float) -0:66 pow ( temp float) +0:66 'r044' ( temp float) +0:66 min ( temp float) 0:66 'inF0' ( in float) 0:66 'inF1' ( in float) 0:67 Sequence 0:67 move second child to first child ( temp float) -0:67 'r046' ( temp float) -0:67 radians ( temp float) +0:67 'r045' ( temp float) +0:67 pow ( temp float) 0:67 'inF0' ( in float) +0:67 'inF1' ( in float) 0:68 Sequence 0:68 move second child to first child ( temp float) -0:68 'r047' ( temp float) -0:68 divide ( temp float) -0:68 Constant: -0:68 1.000000 +0:68 'r046' ( temp float) +0:68 radians ( temp float) 0:68 'inF0' ( in float) 0:69 Sequence -0:69 move second child to first child ( temp uint) -0:69 'r048' ( temp uint) -0:69 Convert int to uint ( temp uint) -0:69 bitFieldReverse ( temp int) -0:69 Constant: -0:69 2 (const int) +0:69 move second child to first child ( temp float) +0:69 'r047' ( temp float) +0:69 divide ( temp float) +0:69 Constant: +0:69 1.000000 +0:69 'inF0' ( in float) 0:70 Sequence -0:70 move second child to first child ( temp float) -0:70 'r049' ( temp float) -0:70 roundEven ( temp float) -0:70 'inF0' ( in float) +0:70 move second child to first child ( temp uint) +0:70 'r048' ( temp uint) +0:70 Convert int to uint ( temp uint) +0:70 bitFieldReverse ( temp int) +0:70 Constant: +0:70 2 (const int) 0:71 Sequence 0:71 move second child to first child ( temp float) -0:71 'r050' ( temp float) -0:71 inverse sqrt ( temp float) +0:71 'r049' ( temp float) +0:71 roundEven ( temp float) 0:71 'inF0' ( in float) 0:72 Sequence 0:72 move second child to first child ( temp float) -0:72 'r051' ( temp float) -0:72 clamp ( temp float) +0:72 'r050' ( temp float) +0:72 inverse sqrt ( temp float) 0:72 'inF0' ( in float) -0:72 Constant: -0:72 0.000000 -0:72 Constant: -0:72 1.000000 0:73 Sequence 0:73 move second child to first child ( temp float) -0:73 'r052' ( temp float) -0:73 Sign ( temp float) +0:73 'r051' ( temp float) +0:73 clamp ( temp float) 0:73 'inF0' ( in float) +0:73 Constant: +0:73 0.000000 +0:73 Constant: +0:73 1.000000 0:74 Sequence 0:74 move second child to first child ( temp float) -0:74 'r053' ( temp float) -0:74 sine ( temp float) +0:74 'r052' ( temp float) +0:74 Sign ( temp float) 0:74 'inF0' ( in float) 0:75 Sequence 0:75 move second child to first child ( temp float) -0:75 'inF1' ( in float) +0:75 'r053' ( temp float) 0:75 sine ( temp float) 0:75 'inF0' ( in float) -0:75 move second child to first child ( temp float) -0:75 'inF2' ( in float) -0:75 cosine ( temp float) -0:75 'inF0' ( in float) 0:76 Sequence 0:76 move second child to first child ( temp float) -0:76 'r055' ( temp float) -0:76 hyp. sine ( temp float) +0:76 'inF1' ( in float) +0:76 sine ( temp float) +0:76 'inF0' ( in float) +0:76 move second child to first child ( temp float) +0:76 'inF2' ( in float) +0:76 cosine ( temp float) 0:76 'inF0' ( in float) 0:77 Sequence 0:77 move second child to first child ( temp float) -0:77 'r056' ( temp float) -0:77 smoothstep ( temp float) +0:77 'r055' ( temp float) +0:77 hyp. sine ( temp float) 0:77 'inF0' ( in float) -0:77 'inF1' ( in float) -0:77 'inF2' ( in float) 0:78 Sequence 0:78 move second child to first child ( temp float) -0:78 'r057' ( temp float) -0:78 sqrt ( temp float) +0:78 'r056' ( temp float) +0:78 smoothstep ( temp float) 0:78 'inF0' ( in float) +0:78 'inF1' ( in float) +0:78 'inF2' ( in float) 0:79 Sequence 0:79 move second child to first child ( temp float) -0:79 'r058' ( temp float) -0:79 step ( temp float) +0:79 'r057' ( temp float) +0:79 sqrt ( temp float) 0:79 'inF0' ( in float) -0:79 'inF1' ( in float) 0:80 Sequence 0:80 move second child to first child ( temp float) -0:80 'r059' ( temp float) -0:80 tangent ( temp float) +0:80 'r058' ( temp float) +0:80 step ( temp float) 0:80 'inF0' ( in float) +0:80 'inF1' ( in float) 0:81 Sequence 0:81 move second child to first child ( temp float) -0:81 'r060' ( temp float) -0:81 hyp. tangent ( temp float) +0:81 'r059' ( temp float) +0:81 tangent ( temp float) 0:81 'inF0' ( in float) -0:83 Sequence -0:83 move second child to first child ( temp float) -0:83 'r061' ( temp float) -0:83 trunc ( temp float) -0:83 'inF0' ( in float) -0:85 Branch: Return with expression -0:85 Constant: -0:85 0.000000 -0:89 Function Definition: PixelShaderFunction1(vf1;vf1;vf1; ( temp 1-component vector of float) -0:89 Function Parameters: -0:89 'inF0' ( in 1-component vector of float) -0:89 'inF1' ( in 1-component vector of float) -0:89 'inF2' ( in 1-component vector of float) +0:82 Sequence +0:82 move second child to first child ( temp float) +0:82 'r060' ( temp float) +0:82 hyp. tangent ( temp float) +0:82 'inF0' ( in float) +0:84 Sequence +0:84 move second child to first child ( temp float) +0:84 'r061' ( temp float) +0:84 trunc ( temp float) +0:84 'inF0' ( in float) +0:86 Branch: Return with expression +0:86 Constant: +0:86 0.000000 +0:90 Function Definition: PixelShaderFunction1(vf1;vf1;vf1; ( temp 1-component vector of float) +0:90 Function Parameters: +0:90 'inF0' ( in 1-component vector of float) +0:90 'inF1' ( in 1-component vector of float) +0:90 'inF2' ( in 1-component vector of float) 0:? Sequence -0:91 Branch: Return with expression -0:91 Constant: -0:91 0.000000 -0:95 Function Definition: PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2; ( temp 2-component vector of float) -0:95 Function Parameters: -0:95 'inF0' ( in 2-component vector of float) -0:95 'inF1' ( in 2-component vector of float) -0:95 'inF2' ( in 2-component vector of float) -0:95 'inU0' ( in 2-component vector of uint) -0:95 'inU1' ( in 2-component vector of uint) +0:92 Branch: Return with expression +0:92 Constant: +0:92 0.000000 +0:96 Function Definition: PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2; ( temp 2-component vector of float) +0:96 Function Parameters: +0:96 'inF0' ( in 2-component vector of float) +0:96 'inF1' ( in 2-component vector of float) +0:96 'inF2' ( in 2-component vector of float) +0:96 'inU0' ( in 2-component vector of uint) +0:96 'inU1' ( in 2-component vector of uint) 0:? Sequence -0:98 Sequence -0:98 move second child to first child ( temp bool) -0:98 'r000' ( temp bool) -0:98 all ( temp bool) -0:98 Convert float to bool ( temp 2-component vector of bool) -0:98 'inF0' ( in 2-component vector of float) 0:99 Sequence -0:99 move second child to first child ( temp 2-component vector of float) -0:99 'r001' ( temp 2-component vector of float) -0:99 Absolute value ( temp 2-component vector of float) -0:99 'inF0' ( in 2-component vector of float) +0:99 move second child to first child ( temp bool) +0:99 'r000' ( temp bool) +0:99 all ( temp bool) +0:99 Convert float to bool ( temp 2-component vector of bool) +0:99 'inF0' ( in 2-component vector of float) 0:100 Sequence 0:100 move second child to first child ( temp 2-component vector of float) -0:100 'r002' ( temp 2-component vector of float) -0:100 arc cosine ( temp 2-component vector of float) +0:100 'r001' ( temp 2-component vector of float) +0:100 Absolute value ( temp 2-component vector of float) 0:100 'inF0' ( in 2-component vector of float) 0:101 Sequence -0:101 move second child to first child ( temp bool) -0:101 'r003' ( temp bool) -0:101 any ( temp bool) -0:101 Convert float to bool ( temp 2-component vector of bool) -0:101 'inF0' ( in 2-component vector of float) +0:101 move second child to first child ( temp 2-component vector of float) +0:101 'r002' ( temp 2-component vector of float) +0:101 arc cosine ( temp 2-component vector of float) +0:101 'inF0' ( in 2-component vector of float) 0:102 Sequence -0:102 move second child to first child ( temp 2-component vector of float) -0:102 'r004' ( temp 2-component vector of float) -0:102 arc sine ( temp 2-component vector of float) -0:102 'inF0' ( in 2-component vector of float) +0:102 move second child to first child ( temp bool) +0:102 'r003' ( temp bool) +0:102 any ( temp bool) +0:102 Convert float to bool ( temp 2-component vector of bool) +0:102 'inF0' ( in 2-component vector of float) 0:103 Sequence -0:103 move second child to first child ( temp 2-component vector of int) -0:103 'r005' ( temp 2-component vector of int) -0:103 floatBitsToInt ( temp 2-component vector of int) +0:103 move second child to first child ( temp 2-component vector of float) +0:103 'r004' ( temp 2-component vector of float) +0:103 arc sine ( temp 2-component vector of float) 0:103 'inF0' ( in 2-component vector of float) 0:104 Sequence -0:104 move second child to first child ( temp 2-component vector of uint) -0:104 'r006' ( temp 2-component vector of uint) -0:104 floatBitsToUint ( temp 2-component vector of uint) +0:104 move second child to first child ( temp 2-component vector of int) +0:104 'r005' ( temp 2-component vector of int) +0:104 floatBitsToInt ( temp 2-component vector of int) 0:104 'inF0' ( in 2-component vector of float) 0:105 Sequence -0:105 move second child to first child ( temp 2-component vector of float) -0:105 'r007' ( temp 2-component vector of float) -0:105 intBitsToFloat ( temp 2-component vector of float) -0:105 'inU0' ( in 2-component vector of uint) -0:107 Sequence -0:107 move second child to first child ( temp 2-component vector of float) -0:107 'r009' ( temp 2-component vector of float) -0:107 arc tangent ( temp 2-component vector of float) -0:107 'inF0' ( in 2-component vector of float) +0:105 move second child to first child ( temp 2-component vector of uint) +0:105 'r006' ( temp 2-component vector of uint) +0:105 floatBitsToUint ( temp 2-component vector of uint) +0:105 'inF0' ( in 2-component vector of float) +0:106 Sequence +0:106 move second child to first child ( temp 2-component vector of float) +0:106 'r007' ( temp 2-component vector of float) +0:106 intBitsToFloat ( temp 2-component vector of float) +0:106 'inU0' ( in 2-component vector of uint) 0:108 Sequence 0:108 move second child to first child ( temp 2-component vector of float) -0:108 'r010' ( temp 2-component vector of float) +0:108 'r009' ( temp 2-component vector of float) 0:108 arc tangent ( temp 2-component vector of float) 0:108 'inF0' ( in 2-component vector of float) -0:108 'inF1' ( in 2-component vector of float) 0:109 Sequence 0:109 move second child to first child ( temp 2-component vector of float) -0:109 'r011' ( temp 2-component vector of float) -0:109 Ceiling ( temp 2-component vector of float) +0:109 'r010' ( temp 2-component vector of float) +0:109 arc tangent ( temp 2-component vector of float) 0:109 'inF0' ( in 2-component vector of float) +0:109 'inF1' ( in 2-component vector of float) 0:110 Sequence 0:110 move second child to first child ( temp 2-component vector of float) -0:110 'r012' ( temp 2-component vector of float) -0:110 clamp ( temp 2-component vector of float) +0:110 'r011' ( temp 2-component vector of float) +0:110 Ceiling ( temp 2-component vector of float) 0:110 'inF0' ( in 2-component vector of float) -0:110 'inF1' ( in 2-component vector of float) -0:110 'inF2' ( in 2-component vector of float) -0:111 Test condition and select ( temp void) -0:111 Condition -0:111 any ( temp bool) -0:111 Compare Less Than ( temp 2-component vector of bool) +0:111 Sequence +0:111 move second child to first child ( temp 2-component vector of float) +0:111 'r012' ( temp 2-component vector of float) +0:111 clamp ( temp 2-component vector of float) 0:111 'inF0' ( in 2-component vector of float) -0:111 Constant: -0:111 0.000000 -0:111 0.000000 -0:111 true case -0:111 Branch: Kill +0:111 'inF1' ( in 2-component vector of float) +0:111 'inF2' ( in 2-component vector of float) 0:112 Test condition and select ( temp void) 0:112 Condition 0:112 any ( temp bool) 0:112 Compare Less Than ( temp 2-component vector of bool) -0:112 'inU0' ( in 2-component vector of uint) +0:112 'inF0' ( in 2-component vector of float) 0:112 Constant: 0:112 0.000000 0:112 0.000000 0:112 true case 0:112 Branch: Kill -0:113 Sequence -0:113 move second child to first child ( temp 2-component vector of float) -0:113 'r013' ( temp 2-component vector of float) -0:113 cosine ( temp 2-component vector of float) -0:113 'inF0' ( in 2-component vector of float) +0:113 Test condition and select ( temp void) +0:113 Condition +0:113 any ( temp bool) +0:113 Compare Less Than ( temp 2-component vector of bool) +0:113 'inU0' ( in 2-component vector of uint) +0:113 Constant: +0:113 0.000000 +0:113 0.000000 +0:113 true case +0:113 Branch: Kill 0:114 Sequence 0:114 move second child to first child ( temp 2-component vector of float) -0:114 'r015' ( temp 2-component vector of float) -0:114 hyp. cosine ( temp 2-component vector of float) +0:114 'r013' ( temp 2-component vector of float) +0:114 cosine ( temp 2-component vector of float) 0:114 'inF0' ( in 2-component vector of float) 0:115 Sequence -0:115 move second child to first child ( temp 2-component vector of int) -0:115 'r016' ( temp 2-component vector of int) +0:115 move second child to first child ( temp 2-component vector of float) +0:115 'r015' ( temp 2-component vector of float) +0:115 hyp. cosine ( temp 2-component vector of float) +0:115 'inF0' ( in 2-component vector of float) +0:116 Sequence +0:116 move second child to first child ( temp 2-component vector of int) +0:116 'r016' ( temp 2-component vector of int) 0:? bitCount ( temp 2-component vector of int) 0:? Constant: 0:? 7 (const int) 0:? 3 (const int) -0:116 Sequence -0:116 move second child to first child ( temp 2-component vector of float) -0:116 'r017' ( temp 2-component vector of float) -0:116 dPdx ( temp 2-component vector of float) -0:116 'inF0' ( in 2-component vector of float) 0:117 Sequence 0:117 move second child to first child ( temp 2-component vector of float) -0:117 'r018' ( temp 2-component vector of float) -0:117 dPdxCoarse ( temp 2-component vector of float) +0:117 'r017' ( temp 2-component vector of float) +0:117 dPdx ( temp 2-component vector of float) 0:117 'inF0' ( in 2-component vector of float) 0:118 Sequence 0:118 move second child to first child ( temp 2-component vector of float) -0:118 'r019' ( temp 2-component vector of float) -0:118 dPdxFine ( temp 2-component vector of float) +0:118 'r018' ( temp 2-component vector of float) +0:118 dPdxCoarse ( temp 2-component vector of float) 0:118 'inF0' ( in 2-component vector of float) 0:119 Sequence 0:119 move second child to first child ( temp 2-component vector of float) -0:119 'r020' ( temp 2-component vector of float) -0:119 dPdy ( temp 2-component vector of float) +0:119 'r019' ( temp 2-component vector of float) +0:119 dPdxFine ( temp 2-component vector of float) 0:119 'inF0' ( in 2-component vector of float) 0:120 Sequence 0:120 move second child to first child ( temp 2-component vector of float) -0:120 'r021' ( temp 2-component vector of float) -0:120 dPdyCoarse ( temp 2-component vector of float) +0:120 'r020' ( temp 2-component vector of float) +0:120 dPdy ( temp 2-component vector of float) 0:120 'inF0' ( in 2-component vector of float) 0:121 Sequence 0:121 move second child to first child ( temp 2-component vector of float) -0:121 'r022' ( temp 2-component vector of float) -0:121 dPdyFine ( temp 2-component vector of float) +0:121 'r021' ( temp 2-component vector of float) +0:121 dPdyCoarse ( temp 2-component vector of float) 0:121 'inF0' ( in 2-component vector of float) 0:122 Sequence 0:122 move second child to first child ( temp 2-component vector of float) -0:122 'r023' ( temp 2-component vector of float) -0:122 degrees ( temp 2-component vector of float) +0:122 'r022' ( temp 2-component vector of float) +0:122 dPdyFine ( temp 2-component vector of float) 0:122 'inF0' ( in 2-component vector of float) -0:126 Sequence -0:126 move second child to first child ( temp float) -0:126 'r026' ( temp float) -0:126 distance ( temp float) -0:126 'inF0' ( in 2-component vector of float) -0:126 'inF1' ( in 2-component vector of float) +0:123 Sequence +0:123 move second child to first child ( temp 2-component vector of float) +0:123 'r023' ( temp 2-component vector of float) +0:123 degrees ( temp 2-component vector of float) +0:123 'inF0' ( in 2-component vector of float) 0:127 Sequence 0:127 move second child to first child ( temp float) -0:127 'r027' ( temp float) -0:127 dot-product ( temp float) +0:127 'r026' ( temp float) +0:127 distance ( temp float) 0:127 'inF0' ( in 2-component vector of float) 0:127 'inF1' ( in 2-component vector of float) -0:131 Sequence -0:131 move second child to first child ( temp 2-component vector of float) -0:131 'r028' ( temp 2-component vector of float) -0:131 exp ( temp 2-component vector of float) -0:131 'inF0' ( in 2-component vector of float) +0:128 Sequence +0:128 move second child to first child ( temp float) +0:128 'r027' ( temp float) +0:128 dot-product ( temp float) +0:128 'inF0' ( in 2-component vector of float) +0:128 'inF1' ( in 2-component vector of float) 0:132 Sequence 0:132 move second child to first child ( temp 2-component vector of float) -0:132 'r029' ( temp 2-component vector of float) -0:132 exp2 ( temp 2-component vector of float) +0:132 'r028' ( temp 2-component vector of float) +0:132 exp ( temp 2-component vector of float) 0:132 'inF0' ( in 2-component vector of float) 0:133 Sequence 0:133 move second child to first child ( temp 2-component vector of float) -0:133 'r030' ( temp 2-component vector of float) -0:133 face-forward ( temp 2-component vector of float) +0:133 'r029' ( temp 2-component vector of float) +0:133 exp2 ( temp 2-component vector of float) 0:133 'inF0' ( in 2-component vector of float) -0:133 'inF1' ( in 2-component vector of float) -0:133 'inF2' ( in 2-component vector of float) 0:134 Sequence -0:134 move second child to first child ( temp 2-component vector of uint) -0:134 'r031' ( temp 2-component vector of uint) +0:134 move second child to first child ( temp 2-component vector of float) +0:134 'r030' ( temp 2-component vector of float) +0:134 face-forward ( temp 2-component vector of float) +0:134 'inF0' ( in 2-component vector of float) +0:134 'inF1' ( in 2-component vector of float) +0:134 'inF2' ( in 2-component vector of float) +0:135 Sequence +0:135 move second child to first child ( temp 2-component vector of uint) +0:135 'r031' ( temp 2-component vector of uint) 0:? findMSB ( temp 2-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) -0:135 Sequence -0:135 move second child to first child ( temp 2-component vector of uint) -0:135 'r032' ( temp 2-component vector of uint) +0:136 Sequence +0:136 move second child to first child ( temp 2-component vector of uint) +0:136 'r032' ( temp 2-component vector of uint) 0:? findLSB ( temp 2-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) -0:136 Sequence -0:136 move second child to first child ( temp 2-component vector of float) -0:136 'r033' ( temp 2-component vector of float) -0:136 Floor ( temp 2-component vector of float) -0:136 'inF0' ( in 2-component vector of float) -0:138 Sequence -0:138 move second child to first child ( temp 2-component vector of float) -0:138 'r035' ( temp 2-component vector of float) -0:138 mod ( temp 2-component vector of float) -0:138 'inF0' ( in 2-component vector of float) -0:138 'inF1' ( in 2-component vector of float) +0:137 Sequence +0:137 move second child to first child ( temp 2-component vector of float) +0:137 'r033' ( temp 2-component vector of float) +0:137 Floor ( temp 2-component vector of float) +0:137 'inF0' ( in 2-component vector of float) 0:139 Sequence 0:139 move second child to first child ( temp 2-component vector of float) -0:139 'r036' ( temp 2-component vector of float) -0:139 Fraction ( temp 2-component vector of float) +0:139 'r035' ( temp 2-component vector of float) +0:139 mod ( temp 2-component vector of float) 0:139 'inF0' ( in 2-component vector of float) +0:139 'inF1' ( in 2-component vector of float) 0:140 Sequence 0:140 move second child to first child ( temp 2-component vector of float) -0:140 'r038' ( temp 2-component vector of float) -0:140 fwidth ( temp 2-component vector of float) +0:140 'r036' ( temp 2-component vector of float) +0:140 Fraction ( temp 2-component vector of float) 0:140 'inF0' ( in 2-component vector of float) 0:141 Sequence -0:141 move second child to first child ( temp 2-component vector of bool) -0:141 'r039' ( temp 2-component vector of bool) -0:141 isinf ( temp 2-component vector of bool) +0:141 move second child to first child ( temp 2-component vector of float) +0:141 'r038' ( temp 2-component vector of float) +0:141 fwidth ( temp 2-component vector of float) 0:141 'inF0' ( in 2-component vector of float) 0:142 Sequence 0:142 move second child to first child ( temp 2-component vector of bool) -0:142 'r040' ( temp 2-component vector of bool) -0:142 isnan ( temp 2-component vector of bool) +0:142 'r039' ( temp 2-component vector of bool) +0:142 isinf ( temp 2-component vector of bool) 0:142 'inF0' ( in 2-component vector of float) 0:143 Sequence -0:143 move second child to first child ( temp 2-component vector of float) -0:143 'r041' ( temp 2-component vector of float) -0:143 ldexp ( temp 2-component vector of float) +0:143 move second child to first child ( temp 2-component vector of bool) +0:143 'r040' ( temp 2-component vector of bool) +0:143 isnan ( temp 2-component vector of bool) 0:143 'inF0' ( in 2-component vector of float) -0:143 'inF1' ( in 2-component vector of float) 0:144 Sequence 0:144 move second child to first child ( temp 2-component vector of float) -0:144 'r039a' ( temp 2-component vector of float) -0:144 mix ( temp 2-component vector of float) +0:144 'r041' ( temp 2-component vector of float) +0:144 ldexp ( temp 2-component vector of float) 0:144 'inF0' ( in 2-component vector of float) 0:144 'inF1' ( in 2-component vector of float) -0:144 'inF2' ( in 2-component vector of float) 0:145 Sequence -0:145 move second child to first child ( temp float) -0:145 'r042' ( temp float) -0:145 length ( temp float) +0:145 move second child to first child ( temp 2-component vector of float) +0:145 'r039a' ( temp 2-component vector of float) +0:145 mix ( temp 2-component vector of float) 0:145 'inF0' ( in 2-component vector of float) +0:145 'inF1' ( in 2-component vector of float) +0:145 'inF2' ( in 2-component vector of float) 0:146 Sequence -0:146 move second child to first child ( temp 2-component vector of float) -0:146 'r043' ( temp 2-component vector of float) -0:146 log ( temp 2-component vector of float) +0:146 move second child to first child ( temp float) +0:146 'r042' ( temp float) +0:146 length ( temp float) 0:146 'inF0' ( in 2-component vector of float) 0:147 Sequence 0:147 move second child to first child ( temp 2-component vector of float) -0:147 'r044' ( temp 2-component vector of float) -0:147 vector-scale ( temp 2-component vector of float) -0:147 log2 ( temp 2-component vector of float) -0:147 'inF0' ( in 2-component vector of float) -0:147 Constant: -0:147 0.301030 +0:147 'r043' ( temp 2-component vector of float) +0:147 log ( temp 2-component vector of float) +0:147 'inF0' ( in 2-component vector of float) 0:148 Sequence 0:148 move second child to first child ( temp 2-component vector of float) -0:148 'r045' ( temp 2-component vector of float) -0:148 log2 ( temp 2-component vector of float) -0:148 'inF0' ( in 2-component vector of float) +0:148 'r044' ( temp 2-component vector of float) +0:148 vector-scale ( temp 2-component vector of float) +0:148 log2 ( temp 2-component vector of float) +0:148 'inF0' ( in 2-component vector of float) +0:148 Constant: +0:148 0.301030 0:149 Sequence 0:149 move second child to first child ( temp 2-component vector of float) -0:149 'r046' ( temp 2-component vector of float) -0:149 max ( temp 2-component vector of float) +0:149 'r045' ( temp 2-component vector of float) +0:149 log2 ( temp 2-component vector of float) 0:149 'inF0' ( in 2-component vector of float) -0:149 'inF1' ( in 2-component vector of float) 0:150 Sequence 0:150 move second child to first child ( temp 2-component vector of float) -0:150 'r047' ( temp 2-component vector of float) -0:150 min ( temp 2-component vector of float) +0:150 'r046' ( temp 2-component vector of float) +0:150 max ( temp 2-component vector of float) 0:150 'inF0' ( in 2-component vector of float) 0:150 'inF1' ( in 2-component vector of float) 0:151 Sequence 0:151 move second child to first child ( temp 2-component vector of float) -0:151 'r048' ( temp 2-component vector of float) -0:151 normalize ( temp 2-component vector of float) +0:151 'r047' ( temp 2-component vector of float) +0:151 min ( temp 2-component vector of float) 0:151 'inF0' ( in 2-component vector of float) +0:151 'inF1' ( in 2-component vector of float) 0:152 Sequence 0:152 move second child to first child ( temp 2-component vector of float) -0:152 'r049' ( temp 2-component vector of float) -0:152 pow ( temp 2-component vector of float) +0:152 'r048' ( temp 2-component vector of float) +0:152 normalize ( temp 2-component vector of float) 0:152 'inF0' ( in 2-component vector of float) -0:152 'inF1' ( in 2-component vector of float) 0:153 Sequence 0:153 move second child to first child ( temp 2-component vector of float) -0:153 'r050' ( temp 2-component vector of float) -0:153 radians ( temp 2-component vector of float) +0:153 'r049' ( temp 2-component vector of float) +0:153 pow ( temp 2-component vector of float) 0:153 'inF0' ( in 2-component vector of float) +0:153 'inF1' ( in 2-component vector of float) 0:154 Sequence 0:154 move second child to first child ( temp 2-component vector of float) -0:154 'r051' ( temp 2-component vector of float) -0:154 divide ( temp 2-component vector of float) -0:154 Constant: -0:154 1.000000 +0:154 'r050' ( temp 2-component vector of float) +0:154 radians ( temp 2-component vector of float) 0:154 'inF0' ( in 2-component vector of float) 0:155 Sequence 0:155 move second child to first child ( temp 2-component vector of float) -0:155 'r052' ( temp 2-component vector of float) -0:155 reflect ( temp 2-component vector of float) +0:155 'r051' ( temp 2-component vector of float) +0:155 divide ( temp 2-component vector of float) +0:155 Constant: +0:155 1.000000 0:155 'inF0' ( in 2-component vector of float) -0:155 'inF1' ( in 2-component vector of float) 0:156 Sequence 0:156 move second child to first child ( temp 2-component vector of float) -0:156 'r053' ( temp 2-component vector of float) -0:156 refract ( temp 2-component vector of float) +0:156 'r052' ( temp 2-component vector of float) +0:156 reflect ( temp 2-component vector of float) 0:156 'inF0' ( in 2-component vector of float) 0:156 'inF1' ( in 2-component vector of float) -0:156 Constant: -0:156 2.000000 0:157 Sequence -0:157 move second child to first child ( temp 2-component vector of uint) -0:157 'r054' ( temp 2-component vector of uint) +0:157 move second child to first child ( temp 2-component vector of float) +0:157 'r053' ( temp 2-component vector of float) +0:157 refract ( temp 2-component vector of float) +0:157 'inF0' ( in 2-component vector of float) +0:157 'inF1' ( in 2-component vector of float) +0:157 Constant: +0:157 2.000000 +0:158 Sequence +0:158 move second child to first child ( temp 2-component vector of uint) +0:158 'r054' ( temp 2-component vector of uint) 0:? bitFieldReverse ( temp 2-component vector of uint) 0:? Constant: 0:? 1 (const uint) 0:? 2 (const uint) -0:158 Sequence -0:158 move second child to first child ( temp 2-component vector of float) -0:158 'r055' ( temp 2-component vector of float) -0:158 roundEven ( temp 2-component vector of float) -0:158 'inF0' ( in 2-component vector of float) 0:159 Sequence 0:159 move second child to first child ( temp 2-component vector of float) -0:159 'r056' ( temp 2-component vector of float) -0:159 inverse sqrt ( temp 2-component vector of float) +0:159 'r055' ( temp 2-component vector of float) +0:159 roundEven ( temp 2-component vector of float) 0:159 'inF0' ( in 2-component vector of float) 0:160 Sequence 0:160 move second child to first child ( temp 2-component vector of float) -0:160 'r057' ( temp 2-component vector of float) -0:160 clamp ( temp 2-component vector of float) +0:160 'r056' ( temp 2-component vector of float) +0:160 inverse sqrt ( temp 2-component vector of float) 0:160 'inF0' ( in 2-component vector of float) -0:160 Constant: -0:160 0.000000 -0:160 Constant: -0:160 1.000000 0:161 Sequence 0:161 move second child to first child ( temp 2-component vector of float) -0:161 'r058' ( temp 2-component vector of float) -0:161 Sign ( temp 2-component vector of float) +0:161 'r057' ( temp 2-component vector of float) +0:161 clamp ( temp 2-component vector of float) 0:161 'inF0' ( in 2-component vector of float) +0:161 Constant: +0:161 0.000000 +0:161 Constant: +0:161 1.000000 0:162 Sequence 0:162 move second child to first child ( temp 2-component vector of float) -0:162 'r059' ( temp 2-component vector of float) -0:162 sine ( temp 2-component vector of float) +0:162 'r058' ( temp 2-component vector of float) +0:162 Sign ( temp 2-component vector of float) 0:162 'inF0' ( in 2-component vector of float) 0:163 Sequence 0:163 move second child to first child ( temp 2-component vector of float) -0:163 'inF1' ( in 2-component vector of float) +0:163 'r059' ( temp 2-component vector of float) 0:163 sine ( temp 2-component vector of float) 0:163 'inF0' ( in 2-component vector of float) -0:163 move second child to first child ( temp 2-component vector of float) -0:163 'inF2' ( in 2-component vector of float) -0:163 cosine ( temp 2-component vector of float) -0:163 'inF0' ( in 2-component vector of float) 0:164 Sequence 0:164 move second child to first child ( temp 2-component vector of float) -0:164 'r060' ( temp 2-component vector of float) -0:164 hyp. sine ( temp 2-component vector of float) +0:164 'inF1' ( in 2-component vector of float) +0:164 sine ( temp 2-component vector of float) +0:164 'inF0' ( in 2-component vector of float) +0:164 move second child to first child ( temp 2-component vector of float) +0:164 'inF2' ( in 2-component vector of float) +0:164 cosine ( temp 2-component vector of float) 0:164 'inF0' ( in 2-component vector of float) 0:165 Sequence 0:165 move second child to first child ( temp 2-component vector of float) -0:165 'r061' ( temp 2-component vector of float) -0:165 smoothstep ( temp 2-component vector of float) +0:165 'r060' ( temp 2-component vector of float) +0:165 hyp. sine ( temp 2-component vector of float) 0:165 'inF0' ( in 2-component vector of float) -0:165 'inF1' ( in 2-component vector of float) -0:165 'inF2' ( in 2-component vector of float) 0:166 Sequence 0:166 move second child to first child ( temp 2-component vector of float) -0:166 'r062' ( temp 2-component vector of float) -0:166 sqrt ( temp 2-component vector of float) +0:166 'r061' ( temp 2-component vector of float) +0:166 smoothstep ( temp 2-component vector of float) 0:166 'inF0' ( in 2-component vector of float) +0:166 'inF1' ( in 2-component vector of float) +0:166 'inF2' ( in 2-component vector of float) 0:167 Sequence 0:167 move second child to first child ( temp 2-component vector of float) -0:167 'r063' ( temp 2-component vector of float) -0:167 step ( temp 2-component vector of float) +0:167 'r062' ( temp 2-component vector of float) +0:167 sqrt ( temp 2-component vector of float) 0:167 'inF0' ( in 2-component vector of float) -0:167 'inF1' ( in 2-component vector of float) 0:168 Sequence 0:168 move second child to first child ( temp 2-component vector of float) -0:168 'r064' ( temp 2-component vector of float) -0:168 tangent ( temp 2-component vector of float) +0:168 'r063' ( temp 2-component vector of float) +0:168 step ( temp 2-component vector of float) 0:168 'inF0' ( in 2-component vector of float) +0:168 'inF1' ( in 2-component vector of float) 0:169 Sequence 0:169 move second child to first child ( temp 2-component vector of float) -0:169 'r065' ( temp 2-component vector of float) -0:169 hyp. tangent ( temp 2-component vector of float) +0:169 'r064' ( temp 2-component vector of float) +0:169 tangent ( temp 2-component vector of float) 0:169 'inF0' ( in 2-component vector of float) -0:171 Sequence -0:171 move second child to first child ( temp 2-component vector of float) -0:171 'r066' ( temp 2-component vector of float) -0:171 trunc ( temp 2-component vector of float) -0:171 'inF0' ( in 2-component vector of float) -0:174 Branch: Return with expression +0:170 Sequence +0:170 move second child to first child ( temp 2-component vector of float) +0:170 'r065' ( temp 2-component vector of float) +0:170 hyp. tangent ( temp 2-component vector of float) +0:170 'inF0' ( in 2-component vector of float) +0:172 Sequence +0:172 move second child to first child ( temp 2-component vector of float) +0:172 'r066' ( temp 2-component vector of float) +0:172 trunc ( temp 2-component vector of float) +0:172 'inF0' ( in 2-component vector of float) +0:175 Branch: Return with expression 0:? Constant: 0:? 1.000000 0:? 2.000000 -0:178 Function Definition: PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3; ( temp 3-component vector of float) -0:178 Function Parameters: -0:178 'inF0' ( in 3-component vector of float) -0:178 'inF1' ( in 3-component vector of float) -0:178 'inF2' ( in 3-component vector of float) -0:178 'inU0' ( in 3-component vector of uint) -0:178 'inU1' ( in 3-component vector of uint) +0:179 Function Definition: PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3; ( temp 3-component vector of float) +0:179 Function Parameters: +0:179 'inF0' ( in 3-component vector of float) +0:179 'inF1' ( in 3-component vector of float) +0:179 'inF2' ( in 3-component vector of float) +0:179 'inU0' ( in 3-component vector of uint) +0:179 'inU1' ( in 3-component vector of uint) 0:? Sequence -0:181 Sequence -0:181 move second child to first child ( temp bool) -0:181 'r000' ( temp bool) -0:181 all ( temp bool) -0:181 Convert float to bool ( temp 3-component vector of bool) -0:181 'inF0' ( in 3-component vector of float) 0:182 Sequence -0:182 move second child to first child ( temp 3-component vector of float) -0:182 'r001' ( temp 3-component vector of float) -0:182 Absolute value ( temp 3-component vector of float) -0:182 'inF0' ( in 3-component vector of float) +0:182 move second child to first child ( temp bool) +0:182 'r000' ( temp bool) +0:182 all ( temp bool) +0:182 Convert float to bool ( temp 3-component vector of bool) +0:182 'inF0' ( in 3-component vector of float) 0:183 Sequence 0:183 move second child to first child ( temp 3-component vector of float) -0:183 'r002' ( temp 3-component vector of float) -0:183 arc cosine ( temp 3-component vector of float) +0:183 'r001' ( temp 3-component vector of float) +0:183 Absolute value ( temp 3-component vector of float) 0:183 'inF0' ( in 3-component vector of float) 0:184 Sequence -0:184 move second child to first child ( temp bool) -0:184 'r003' ( temp bool) -0:184 any ( temp bool) -0:184 Convert float to bool ( temp 3-component vector of bool) -0:184 'inF0' ( in 3-component vector of float) +0:184 move second child to first child ( temp 3-component vector of float) +0:184 'r002' ( temp 3-component vector of float) +0:184 arc cosine ( temp 3-component vector of float) +0:184 'inF0' ( in 3-component vector of float) 0:185 Sequence -0:185 move second child to first child ( temp 3-component vector of float) -0:185 'r004' ( temp 3-component vector of float) -0:185 arc sine ( temp 3-component vector of float) -0:185 'inF0' ( in 3-component vector of float) +0:185 move second child to first child ( temp bool) +0:185 'r003' ( temp bool) +0:185 any ( temp bool) +0:185 Convert float to bool ( temp 3-component vector of bool) +0:185 'inF0' ( in 3-component vector of float) 0:186 Sequence -0:186 move second child to first child ( temp 3-component vector of int) -0:186 'r005' ( temp 3-component vector of int) -0:186 floatBitsToInt ( temp 3-component vector of int) +0:186 move second child to first child ( temp 3-component vector of float) +0:186 'r004' ( temp 3-component vector of float) +0:186 arc sine ( temp 3-component vector of float) 0:186 'inF0' ( in 3-component vector of float) 0:187 Sequence -0:187 move second child to first child ( temp 3-component vector of uint) -0:187 'r006' ( temp 3-component vector of uint) -0:187 floatBitsToUint ( temp 3-component vector of uint) +0:187 move second child to first child ( temp 3-component vector of int) +0:187 'r005' ( temp 3-component vector of int) +0:187 floatBitsToInt ( temp 3-component vector of int) 0:187 'inF0' ( in 3-component vector of float) 0:188 Sequence -0:188 move second child to first child ( temp 3-component vector of float) -0:188 'r007' ( temp 3-component vector of float) -0:188 intBitsToFloat ( temp 3-component vector of float) -0:188 'inU0' ( in 3-component vector of uint) -0:190 Sequence -0:190 move second child to first child ( temp 3-component vector of float) -0:190 'r009' ( temp 3-component vector of float) -0:190 arc tangent ( temp 3-component vector of float) -0:190 'inF0' ( in 3-component vector of float) +0:188 move second child to first child ( temp 3-component vector of uint) +0:188 'r006' ( temp 3-component vector of uint) +0:188 floatBitsToUint ( temp 3-component vector of uint) +0:188 'inF0' ( in 3-component vector of float) +0:189 Sequence +0:189 move second child to first child ( temp 3-component vector of float) +0:189 'r007' ( temp 3-component vector of float) +0:189 intBitsToFloat ( temp 3-component vector of float) +0:189 'inU0' ( in 3-component vector of uint) 0:191 Sequence 0:191 move second child to first child ( temp 3-component vector of float) -0:191 'r010' ( temp 3-component vector of float) +0:191 'r009' ( temp 3-component vector of float) 0:191 arc tangent ( temp 3-component vector of float) 0:191 'inF0' ( in 3-component vector of float) -0:191 'inF1' ( in 3-component vector of float) 0:192 Sequence 0:192 move second child to first child ( temp 3-component vector of float) -0:192 'r011' ( temp 3-component vector of float) -0:192 Ceiling ( temp 3-component vector of float) +0:192 'r010' ( temp 3-component vector of float) +0:192 arc tangent ( temp 3-component vector of float) 0:192 'inF0' ( in 3-component vector of float) +0:192 'inF1' ( in 3-component vector of float) 0:193 Sequence 0:193 move second child to first child ( temp 3-component vector of float) -0:193 'r012' ( temp 3-component vector of float) -0:193 clamp ( temp 3-component vector of float) +0:193 'r011' ( temp 3-component vector of float) +0:193 Ceiling ( temp 3-component vector of float) 0:193 'inF0' ( in 3-component vector of float) -0:193 'inF1' ( in 3-component vector of float) -0:193 'inF2' ( in 3-component vector of float) -0:194 Test condition and select ( temp void) -0:194 Condition -0:194 any ( temp bool) -0:194 Compare Less Than ( temp 3-component vector of bool) +0:194 Sequence +0:194 move second child to first child ( temp 3-component vector of float) +0:194 'r012' ( temp 3-component vector of float) +0:194 clamp ( temp 3-component vector of float) 0:194 'inF0' ( in 3-component vector of float) -0:194 Constant: -0:194 0.000000 -0:194 0.000000 -0:194 0.000000 -0:194 true case -0:194 Branch: Kill +0:194 'inF1' ( in 3-component vector of float) +0:194 'inF2' ( in 3-component vector of float) 0:195 Test condition and select ( temp void) 0:195 Condition 0:195 any ( temp bool) 0:195 Compare Less Than ( temp 3-component vector of bool) -0:195 'inU0' ( in 3-component vector of uint) +0:195 'inF0' ( in 3-component vector of float) 0:195 Constant: 0:195 0.000000 0:195 0.000000 0:195 0.000000 0:195 true case 0:195 Branch: Kill -0:196 Sequence -0:196 move second child to first child ( temp 3-component vector of float) -0:196 'r013' ( temp 3-component vector of float) -0:196 cosine ( temp 3-component vector of float) -0:196 'inF0' ( in 3-component vector of float) +0:196 Test condition and select ( temp void) +0:196 Condition +0:196 any ( temp bool) +0:196 Compare Less Than ( temp 3-component vector of bool) +0:196 'inU0' ( in 3-component vector of uint) +0:196 Constant: +0:196 0.000000 +0:196 0.000000 +0:196 0.000000 +0:196 true case +0:196 Branch: Kill 0:197 Sequence 0:197 move second child to first child ( temp 3-component vector of float) -0:197 'r014' ( temp 3-component vector of float) -0:197 hyp. cosine ( temp 3-component vector of float) +0:197 'r013' ( temp 3-component vector of float) +0:197 cosine ( temp 3-component vector of float) 0:197 'inF0' ( in 3-component vector of float) 0:198 Sequence -0:198 move second child to first child ( temp 3-component vector of uint) -0:198 'r015' ( temp 3-component vector of uint) +0:198 move second child to first child ( temp 3-component vector of float) +0:198 'r014' ( temp 3-component vector of float) +0:198 hyp. cosine ( temp 3-component vector of float) +0:198 'inF0' ( in 3-component vector of float) +0:199 Sequence +0:199 move second child to first child ( temp 3-component vector of uint) +0:199 'r015' ( temp 3-component vector of uint) 0:? bitCount ( temp 3-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 3 (const uint) 0:? 5 (const uint) -0:199 Sequence -0:199 move second child to first child ( temp 3-component vector of float) -0:199 'r016' ( temp 3-component vector of float) -0:199 cross-product ( temp 3-component vector of float) -0:199 'inF0' ( in 3-component vector of float) -0:199 'inF1' ( in 3-component vector of float) 0:200 Sequence 0:200 move second child to first child ( temp 3-component vector of float) -0:200 'r017' ( temp 3-component vector of float) -0:200 dPdx ( temp 3-component vector of float) +0:200 'r016' ( temp 3-component vector of float) +0:200 cross-product ( temp 3-component vector of float) 0:200 'inF0' ( in 3-component vector of float) +0:200 'inF1' ( in 3-component vector of float) 0:201 Sequence 0:201 move second child to first child ( temp 3-component vector of float) -0:201 'r018' ( temp 3-component vector of float) -0:201 dPdxCoarse ( temp 3-component vector of float) +0:201 'r017' ( temp 3-component vector of float) +0:201 dPdx ( temp 3-component vector of float) 0:201 'inF0' ( in 3-component vector of float) 0:202 Sequence 0:202 move second child to first child ( temp 3-component vector of float) -0:202 'r019' ( temp 3-component vector of float) -0:202 dPdxFine ( temp 3-component vector of float) +0:202 'r018' ( temp 3-component vector of float) +0:202 dPdxCoarse ( temp 3-component vector of float) 0:202 'inF0' ( in 3-component vector of float) 0:203 Sequence 0:203 move second child to first child ( temp 3-component vector of float) -0:203 'r020' ( temp 3-component vector of float) -0:203 dPdy ( temp 3-component vector of float) +0:203 'r019' ( temp 3-component vector of float) +0:203 dPdxFine ( temp 3-component vector of float) 0:203 'inF0' ( in 3-component vector of float) 0:204 Sequence 0:204 move second child to first child ( temp 3-component vector of float) -0:204 'r021' ( temp 3-component vector of float) -0:204 dPdyCoarse ( temp 3-component vector of float) +0:204 'r020' ( temp 3-component vector of float) +0:204 dPdy ( temp 3-component vector of float) 0:204 'inF0' ( in 3-component vector of float) 0:205 Sequence 0:205 move second child to first child ( temp 3-component vector of float) -0:205 'r022' ( temp 3-component vector of float) -0:205 dPdyFine ( temp 3-component vector of float) +0:205 'r021' ( temp 3-component vector of float) +0:205 dPdyCoarse ( temp 3-component vector of float) 0:205 'inF0' ( in 3-component vector of float) 0:206 Sequence 0:206 move second child to first child ( temp 3-component vector of float) -0:206 'r023' ( temp 3-component vector of float) -0:206 degrees ( temp 3-component vector of float) +0:206 'r022' ( temp 3-component vector of float) +0:206 dPdyFine ( temp 3-component vector of float) 0:206 'inF0' ( in 3-component vector of float) 0:207 Sequence -0:207 move second child to first child ( temp float) -0:207 'r024' ( temp float) -0:207 distance ( temp float) +0:207 move second child to first child ( temp 3-component vector of float) +0:207 'r023' ( temp 3-component vector of float) +0:207 degrees ( temp 3-component vector of float) 0:207 'inF0' ( in 3-component vector of float) -0:207 'inF1' ( in 3-component vector of float) 0:208 Sequence 0:208 move second child to first child ( temp float) -0:208 'r025' ( temp float) -0:208 dot-product ( temp float) +0:208 'r024' ( temp float) +0:208 distance ( temp float) 0:208 'inF0' ( in 3-component vector of float) 0:208 'inF1' ( in 3-component vector of float) -0:212 Sequence -0:212 move second child to first child ( temp 3-component vector of float) -0:212 'r029' ( temp 3-component vector of float) -0:212 exp ( temp 3-component vector of float) -0:212 'inF0' ( in 3-component vector of float) +0:209 Sequence +0:209 move second child to first child ( temp float) +0:209 'r025' ( temp float) +0:209 dot-product ( temp float) +0:209 'inF0' ( in 3-component vector of float) +0:209 'inF1' ( in 3-component vector of float) 0:213 Sequence 0:213 move second child to first child ( temp 3-component vector of float) -0:213 'r030' ( temp 3-component vector of float) -0:213 exp2 ( temp 3-component vector of float) +0:213 'r029' ( temp 3-component vector of float) +0:213 exp ( temp 3-component vector of float) 0:213 'inF0' ( in 3-component vector of float) 0:214 Sequence 0:214 move second child to first child ( temp 3-component vector of float) -0:214 'r031' ( temp 3-component vector of float) -0:214 face-forward ( temp 3-component vector of float) +0:214 'r030' ( temp 3-component vector of float) +0:214 exp2 ( temp 3-component vector of float) 0:214 'inF0' ( in 3-component vector of float) -0:214 'inF1' ( in 3-component vector of float) -0:214 'inF2' ( in 3-component vector of float) 0:215 Sequence -0:215 move second child to first child ( temp 3-component vector of uint) -0:215 'r032' ( temp 3-component vector of uint) +0:215 move second child to first child ( temp 3-component vector of float) +0:215 'r031' ( temp 3-component vector of float) +0:215 face-forward ( temp 3-component vector of float) +0:215 'inF0' ( in 3-component vector of float) +0:215 'inF1' ( in 3-component vector of float) +0:215 'inF2' ( in 3-component vector of float) +0:216 Sequence +0:216 move second child to first child ( temp 3-component vector of uint) +0:216 'r032' ( temp 3-component vector of uint) 0:? findMSB ( temp 3-component vector of uint) 0:? Constant: 0:? 2 (const uint) 0:? 3 (const uint) 0:? 4 (const uint) -0:216 Sequence -0:216 move second child to first child ( temp 3-component vector of uint) -0:216 'r033' ( temp 3-component vector of uint) +0:217 Sequence +0:217 move second child to first child ( temp 3-component vector of uint) +0:217 'r033' ( temp 3-component vector of uint) 0:? findLSB ( temp 3-component vector of uint) 0:? Constant: 0:? 2 (const uint) 0:? 3 (const uint) 0:? 4 (const uint) -0:217 Sequence -0:217 move second child to first child ( temp 3-component vector of float) -0:217 'r034' ( temp 3-component vector of float) -0:217 Floor ( temp 3-component vector of float) -0:217 'inF0' ( in 3-component vector of float) -0:219 Sequence -0:219 move second child to first child ( temp 3-component vector of float) -0:219 'r036' ( temp 3-component vector of float) -0:219 mod ( temp 3-component vector of float) -0:219 'inF0' ( in 3-component vector of float) -0:219 'inF1' ( in 3-component vector of float) +0:218 Sequence +0:218 move second child to first child ( temp 3-component vector of float) +0:218 'r034' ( temp 3-component vector of float) +0:218 Floor ( temp 3-component vector of float) +0:218 'inF0' ( in 3-component vector of float) 0:220 Sequence 0:220 move second child to first child ( temp 3-component vector of float) -0:220 'r037' ( temp 3-component vector of float) -0:220 Fraction ( temp 3-component vector of float) +0:220 'r036' ( temp 3-component vector of float) +0:220 mod ( temp 3-component vector of float) 0:220 'inF0' ( in 3-component vector of float) +0:220 'inF1' ( in 3-component vector of float) 0:221 Sequence 0:221 move second child to first child ( temp 3-component vector of float) -0:221 'r039' ( temp 3-component vector of float) -0:221 fwidth ( temp 3-component vector of float) +0:221 'r037' ( temp 3-component vector of float) +0:221 Fraction ( temp 3-component vector of float) 0:221 'inF0' ( in 3-component vector of float) 0:222 Sequence -0:222 move second child to first child ( temp 3-component vector of bool) -0:222 'r040' ( temp 3-component vector of bool) -0:222 isinf ( temp 3-component vector of bool) +0:222 move second child to first child ( temp 3-component vector of float) +0:222 'r039' ( temp 3-component vector of float) +0:222 fwidth ( temp 3-component vector of float) 0:222 'inF0' ( in 3-component vector of float) 0:223 Sequence 0:223 move second child to first child ( temp 3-component vector of bool) -0:223 'r041' ( temp 3-component vector of bool) -0:223 isnan ( temp 3-component vector of bool) +0:223 'r040' ( temp 3-component vector of bool) +0:223 isinf ( temp 3-component vector of bool) 0:223 'inF0' ( in 3-component vector of float) 0:224 Sequence -0:224 move second child to first child ( temp 3-component vector of float) -0:224 'r042' ( temp 3-component vector of float) -0:224 ldexp ( temp 3-component vector of float) +0:224 move second child to first child ( temp 3-component vector of bool) +0:224 'r041' ( temp 3-component vector of bool) +0:224 isnan ( temp 3-component vector of bool) 0:224 'inF0' ( in 3-component vector of float) -0:224 'inF1' ( in 3-component vector of float) 0:225 Sequence 0:225 move second child to first child ( temp 3-component vector of float) -0:225 'r039a' ( temp 3-component vector of float) -0:225 mix ( temp 3-component vector of float) +0:225 'r042' ( temp 3-component vector of float) +0:225 ldexp ( temp 3-component vector of float) 0:225 'inF0' ( in 3-component vector of float) 0:225 'inF1' ( in 3-component vector of float) -0:225 'inF2' ( in 3-component vector of float) 0:226 Sequence 0:226 move second child to first child ( temp 3-component vector of float) -0:226 'r039b' ( temp 3-component vector of float) +0:226 'r039a' ( temp 3-component vector of float) 0:226 mix ( temp 3-component vector of float) 0:226 'inF0' ( in 3-component vector of float) 0:226 'inF1' ( in 3-component vector of float) -0:226 Constant: -0:226 0.300000 +0:226 'inF2' ( in 3-component vector of float) 0:227 Sequence -0:227 move second child to first child ( temp float) -0:227 'r043' ( temp float) -0:227 length ( temp float) +0:227 move second child to first child ( temp 3-component vector of float) +0:227 'r039b' ( temp 3-component vector of float) +0:227 mix ( temp 3-component vector of float) 0:227 'inF0' ( in 3-component vector of float) +0:227 'inF1' ( in 3-component vector of float) +0:227 Constant: +0:227 0.300000 0:228 Sequence -0:228 move second child to first child ( temp 3-component vector of float) -0:228 'r044' ( temp 3-component vector of float) -0:228 log ( temp 3-component vector of float) +0:228 move second child to first child ( temp float) +0:228 'r043' ( temp float) +0:228 length ( temp float) 0:228 'inF0' ( in 3-component vector of float) 0:229 Sequence 0:229 move second child to first child ( temp 3-component vector of float) -0:229 'r045' ( temp 3-component vector of float) -0:229 vector-scale ( temp 3-component vector of float) -0:229 log2 ( temp 3-component vector of float) -0:229 'inF0' ( in 3-component vector of float) -0:229 Constant: -0:229 0.301030 +0:229 'r044' ( temp 3-component vector of float) +0:229 log ( temp 3-component vector of float) +0:229 'inF0' ( in 3-component vector of float) 0:230 Sequence 0:230 move second child to first child ( temp 3-component vector of float) -0:230 'r046' ( temp 3-component vector of float) -0:230 log2 ( temp 3-component vector of float) -0:230 'inF0' ( in 3-component vector of float) +0:230 'r045' ( temp 3-component vector of float) +0:230 vector-scale ( temp 3-component vector of float) +0:230 log2 ( temp 3-component vector of float) +0:230 'inF0' ( in 3-component vector of float) +0:230 Constant: +0:230 0.301030 0:231 Sequence 0:231 move second child to first child ( temp 3-component vector of float) -0:231 'r047' ( temp 3-component vector of float) -0:231 max ( temp 3-component vector of float) +0:231 'r046' ( temp 3-component vector of float) +0:231 log2 ( temp 3-component vector of float) 0:231 'inF0' ( in 3-component vector of float) -0:231 'inF1' ( in 3-component vector of float) 0:232 Sequence 0:232 move second child to first child ( temp 3-component vector of float) -0:232 'r048' ( temp 3-component vector of float) -0:232 min ( temp 3-component vector of float) +0:232 'r047' ( temp 3-component vector of float) +0:232 max ( temp 3-component vector of float) 0:232 'inF0' ( in 3-component vector of float) 0:232 'inF1' ( in 3-component vector of float) 0:233 Sequence 0:233 move second child to first child ( temp 3-component vector of float) -0:233 'r049' ( temp 3-component vector of float) -0:233 normalize ( temp 3-component vector of float) +0:233 'r048' ( temp 3-component vector of float) +0:233 min ( temp 3-component vector of float) 0:233 'inF0' ( in 3-component vector of float) +0:233 'inF1' ( in 3-component vector of float) 0:234 Sequence 0:234 move second child to first child ( temp 3-component vector of float) -0:234 'r050' ( temp 3-component vector of float) -0:234 pow ( temp 3-component vector of float) +0:234 'r049' ( temp 3-component vector of float) +0:234 normalize ( temp 3-component vector of float) 0:234 'inF0' ( in 3-component vector of float) -0:234 'inF1' ( in 3-component vector of float) 0:235 Sequence 0:235 move second child to first child ( temp 3-component vector of float) -0:235 'r051' ( temp 3-component vector of float) -0:235 radians ( temp 3-component vector of float) +0:235 'r050' ( temp 3-component vector of float) +0:235 pow ( temp 3-component vector of float) 0:235 'inF0' ( in 3-component vector of float) +0:235 'inF1' ( in 3-component vector of float) 0:236 Sequence 0:236 move second child to first child ( temp 3-component vector of float) -0:236 'r052' ( temp 3-component vector of float) -0:236 divide ( temp 3-component vector of float) -0:236 Constant: -0:236 1.000000 +0:236 'r051' ( temp 3-component vector of float) +0:236 radians ( temp 3-component vector of float) 0:236 'inF0' ( in 3-component vector of float) 0:237 Sequence 0:237 move second child to first child ( temp 3-component vector of float) -0:237 'r053' ( temp 3-component vector of float) -0:237 reflect ( temp 3-component vector of float) +0:237 'r052' ( temp 3-component vector of float) +0:237 divide ( temp 3-component vector of float) +0:237 Constant: +0:237 1.000000 0:237 'inF0' ( in 3-component vector of float) -0:237 'inF1' ( in 3-component vector of float) 0:238 Sequence 0:238 move second child to first child ( temp 3-component vector of float) -0:238 'r054' ( temp 3-component vector of float) -0:238 refract ( temp 3-component vector of float) +0:238 'r053' ( temp 3-component vector of float) +0:238 reflect ( temp 3-component vector of float) 0:238 'inF0' ( in 3-component vector of float) 0:238 'inF1' ( in 3-component vector of float) -0:238 Constant: -0:238 2.000000 0:239 Sequence -0:239 move second child to first child ( temp 3-component vector of uint) -0:239 'r055' ( temp 3-component vector of uint) +0:239 move second child to first child ( temp 3-component vector of float) +0:239 'r054' ( temp 3-component vector of float) +0:239 refract ( temp 3-component vector of float) +0:239 'inF0' ( in 3-component vector of float) +0:239 'inF1' ( in 3-component vector of float) +0:239 Constant: +0:239 2.000000 +0:240 Sequence +0:240 move second child to first child ( temp 3-component vector of uint) +0:240 'r055' ( temp 3-component vector of uint) 0:? bitFieldReverse ( temp 3-component vector of uint) 0:? Constant: 0:? 1 (const uint) 0:? 2 (const uint) 0:? 3 (const uint) -0:240 Sequence -0:240 move second child to first child ( temp 3-component vector of float) -0:240 'r056' ( temp 3-component vector of float) -0:240 roundEven ( temp 3-component vector of float) -0:240 'inF0' ( in 3-component vector of float) 0:241 Sequence 0:241 move second child to first child ( temp 3-component vector of float) -0:241 'r057' ( temp 3-component vector of float) -0:241 inverse sqrt ( temp 3-component vector of float) +0:241 'r056' ( temp 3-component vector of float) +0:241 roundEven ( temp 3-component vector of float) 0:241 'inF0' ( in 3-component vector of float) 0:242 Sequence 0:242 move second child to first child ( temp 3-component vector of float) -0:242 'r058' ( temp 3-component vector of float) -0:242 clamp ( temp 3-component vector of float) +0:242 'r057' ( temp 3-component vector of float) +0:242 inverse sqrt ( temp 3-component vector of float) 0:242 'inF0' ( in 3-component vector of float) -0:242 Constant: -0:242 0.000000 -0:242 Constant: -0:242 1.000000 0:243 Sequence 0:243 move second child to first child ( temp 3-component vector of float) -0:243 'r059' ( temp 3-component vector of float) -0:243 Sign ( temp 3-component vector of float) +0:243 'r058' ( temp 3-component vector of float) +0:243 clamp ( temp 3-component vector of float) 0:243 'inF0' ( in 3-component vector of float) +0:243 Constant: +0:243 0.000000 +0:243 Constant: +0:243 1.000000 0:244 Sequence 0:244 move second child to first child ( temp 3-component vector of float) -0:244 'r060' ( temp 3-component vector of float) -0:244 sine ( temp 3-component vector of float) +0:244 'r059' ( temp 3-component vector of float) +0:244 Sign ( temp 3-component vector of float) 0:244 'inF0' ( in 3-component vector of float) 0:245 Sequence 0:245 move second child to first child ( temp 3-component vector of float) -0:245 'inF1' ( in 3-component vector of float) +0:245 'r060' ( temp 3-component vector of float) 0:245 sine ( temp 3-component vector of float) 0:245 'inF0' ( in 3-component vector of float) -0:245 move second child to first child ( temp 3-component vector of float) -0:245 'inF2' ( in 3-component vector of float) -0:245 cosine ( temp 3-component vector of float) -0:245 'inF0' ( in 3-component vector of float) 0:246 Sequence 0:246 move second child to first child ( temp 3-component vector of float) -0:246 'r061' ( temp 3-component vector of float) -0:246 hyp. sine ( temp 3-component vector of float) +0:246 'inF1' ( in 3-component vector of float) +0:246 sine ( temp 3-component vector of float) +0:246 'inF0' ( in 3-component vector of float) +0:246 move second child to first child ( temp 3-component vector of float) +0:246 'inF2' ( in 3-component vector of float) +0:246 cosine ( temp 3-component vector of float) 0:246 'inF0' ( in 3-component vector of float) 0:247 Sequence 0:247 move second child to first child ( temp 3-component vector of float) -0:247 'r062' ( temp 3-component vector of float) -0:247 smoothstep ( temp 3-component vector of float) +0:247 'r061' ( temp 3-component vector of float) +0:247 hyp. sine ( temp 3-component vector of float) 0:247 'inF0' ( in 3-component vector of float) -0:247 'inF1' ( in 3-component vector of float) -0:247 'inF2' ( in 3-component vector of float) 0:248 Sequence 0:248 move second child to first child ( temp 3-component vector of float) -0:248 'r063' ( temp 3-component vector of float) -0:248 sqrt ( temp 3-component vector of float) +0:248 'r062' ( temp 3-component vector of float) +0:248 smoothstep ( temp 3-component vector of float) 0:248 'inF0' ( in 3-component vector of float) +0:248 'inF1' ( in 3-component vector of float) +0:248 'inF2' ( in 3-component vector of float) 0:249 Sequence 0:249 move second child to first child ( temp 3-component vector of float) -0:249 'r064' ( temp 3-component vector of float) -0:249 step ( temp 3-component vector of float) +0:249 'r063' ( temp 3-component vector of float) +0:249 sqrt ( temp 3-component vector of float) 0:249 'inF0' ( in 3-component vector of float) -0:249 'inF1' ( in 3-component vector of float) 0:250 Sequence 0:250 move second child to first child ( temp 3-component vector of float) -0:250 'r065' ( temp 3-component vector of float) -0:250 tangent ( temp 3-component vector of float) +0:250 'r064' ( temp 3-component vector of float) +0:250 step ( temp 3-component vector of float) 0:250 'inF0' ( in 3-component vector of float) +0:250 'inF1' ( in 3-component vector of float) 0:251 Sequence 0:251 move second child to first child ( temp 3-component vector of float) -0:251 'r066' ( temp 3-component vector of float) -0:251 hyp. tangent ( temp 3-component vector of float) +0:251 'r065' ( temp 3-component vector of float) +0:251 tangent ( temp 3-component vector of float) 0:251 'inF0' ( in 3-component vector of float) -0:253 Sequence -0:253 move second child to first child ( temp 3-component vector of float) -0:253 'r067' ( temp 3-component vector of float) -0:253 trunc ( temp 3-component vector of float) -0:253 'inF0' ( in 3-component vector of float) -0:256 Branch: Return with expression +0:252 Sequence +0:252 move second child to first child ( temp 3-component vector of float) +0:252 'r066' ( temp 3-component vector of float) +0:252 hyp. tangent ( temp 3-component vector of float) +0:252 'inF0' ( in 3-component vector of float) +0:254 Sequence +0:254 move second child to first child ( temp 3-component vector of float) +0:254 'r067' ( temp 3-component vector of float) +0:254 trunc ( temp 3-component vector of float) +0:254 'inF0' ( in 3-component vector of float) +0:257 Branch: Return with expression 0:? Constant: 0:? 1.000000 0:? 2.000000 0:? 3.000000 -0:260 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vu4;vu4; ( temp 4-component vector of float) -0:260 Function Parameters: -0:260 'inF0' ( in 4-component vector of float) -0:260 'inF1' ( in 4-component vector of float) -0:260 'inF2' ( in 4-component vector of float) -0:260 'inU0' ( in 4-component vector of uint) -0:260 'inU1' ( in 4-component vector of uint) +0:261 Function Definition: PixelShaderFunction(vf4;vf4;vf4;vu4;vu4; ( temp 4-component vector of float) +0:261 Function Parameters: +0:261 'inF0' ( in 4-component vector of float) +0:261 'inF1' ( in 4-component vector of float) +0:261 'inF2' ( in 4-component vector of float) +0:261 'inU0' ( in 4-component vector of uint) +0:261 'inU1' ( in 4-component vector of uint) 0:? Sequence -0:263 Sequence -0:263 move second child to first child ( temp bool) -0:263 'r000' ( temp bool) -0:263 all ( temp bool) -0:263 Convert float to bool ( temp 4-component vector of bool) -0:263 'inF0' ( in 4-component vector of float) 0:264 Sequence -0:264 move second child to first child ( temp 4-component vector of float) -0:264 'r001' ( temp 4-component vector of float) -0:264 Absolute value ( temp 4-component vector of float) -0:264 'inF0' ( in 4-component vector of float) +0:264 move second child to first child ( temp bool) +0:264 'r000' ( temp bool) +0:264 all ( temp bool) +0:264 Convert float to bool ( temp 4-component vector of bool) +0:264 'inF0' ( in 4-component vector of float) 0:265 Sequence 0:265 move second child to first child ( temp 4-component vector of float) -0:265 'r002' ( temp 4-component vector of float) -0:265 arc cosine ( temp 4-component vector of float) +0:265 'r001' ( temp 4-component vector of float) +0:265 Absolute value ( temp 4-component vector of float) 0:265 'inF0' ( in 4-component vector of float) 0:266 Sequence -0:266 move second child to first child ( temp bool) -0:266 'r003' ( temp bool) -0:266 any ( temp bool) -0:266 Convert float to bool ( temp 4-component vector of bool) -0:266 'inF0' ( in 4-component vector of float) +0:266 move second child to first child ( temp 4-component vector of float) +0:266 'r002' ( temp 4-component vector of float) +0:266 arc cosine ( temp 4-component vector of float) +0:266 'inF0' ( in 4-component vector of float) 0:267 Sequence -0:267 move second child to first child ( temp 4-component vector of float) -0:267 'r004' ( temp 4-component vector of float) -0:267 arc sine ( temp 4-component vector of float) -0:267 'inF0' ( in 4-component vector of float) +0:267 move second child to first child ( temp bool) +0:267 'r003' ( temp bool) +0:267 any ( temp bool) +0:267 Convert float to bool ( temp 4-component vector of bool) +0:267 'inF0' ( in 4-component vector of float) 0:268 Sequence -0:268 move second child to first child ( temp 4-component vector of int) -0:268 'r005' ( temp 4-component vector of int) -0:268 floatBitsToInt ( temp 4-component vector of int) +0:268 move second child to first child ( temp 4-component vector of float) +0:268 'r004' ( temp 4-component vector of float) +0:268 arc sine ( temp 4-component vector of float) 0:268 'inF0' ( in 4-component vector of float) 0:269 Sequence -0:269 move second child to first child ( temp 4-component vector of uint) -0:269 'r006' ( temp 4-component vector of uint) -0:269 floatBitsToUint ( temp 4-component vector of uint) +0:269 move second child to first child ( temp 4-component vector of int) +0:269 'r005' ( temp 4-component vector of int) +0:269 floatBitsToInt ( temp 4-component vector of int) 0:269 'inF0' ( in 4-component vector of float) 0:270 Sequence -0:270 move second child to first child ( temp 4-component vector of float) -0:270 'r007' ( temp 4-component vector of float) -0:270 intBitsToFloat ( temp 4-component vector of float) -0:270 'inU0' ( in 4-component vector of uint) -0:272 Sequence -0:272 move second child to first child ( temp 4-component vector of float) -0:272 'r009' ( temp 4-component vector of float) -0:272 arc tangent ( temp 4-component vector of float) -0:272 'inF0' ( in 4-component vector of float) +0:270 move second child to first child ( temp 4-component vector of uint) +0:270 'r006' ( temp 4-component vector of uint) +0:270 floatBitsToUint ( temp 4-component vector of uint) +0:270 'inF0' ( in 4-component vector of float) +0:271 Sequence +0:271 move second child to first child ( temp 4-component vector of float) +0:271 'r007' ( temp 4-component vector of float) +0:271 intBitsToFloat ( temp 4-component vector of float) +0:271 'inU0' ( in 4-component vector of uint) 0:273 Sequence 0:273 move second child to first child ( temp 4-component vector of float) -0:273 'r010' ( temp 4-component vector of float) +0:273 'r009' ( temp 4-component vector of float) 0:273 arc tangent ( temp 4-component vector of float) 0:273 'inF0' ( in 4-component vector of float) -0:273 'inF1' ( in 4-component vector of float) 0:274 Sequence 0:274 move second child to first child ( temp 4-component vector of float) -0:274 'r011' ( temp 4-component vector of float) -0:274 Ceiling ( temp 4-component vector of float) +0:274 'r010' ( temp 4-component vector of float) +0:274 arc tangent ( temp 4-component vector of float) 0:274 'inF0' ( in 4-component vector of float) +0:274 'inF1' ( in 4-component vector of float) 0:275 Sequence 0:275 move second child to first child ( temp 4-component vector of float) -0:275 'r012' ( temp 4-component vector of float) -0:275 clamp ( temp 4-component vector of float) +0:275 'r011' ( temp 4-component vector of float) +0:275 Ceiling ( temp 4-component vector of float) 0:275 'inF0' ( in 4-component vector of float) -0:275 'inF1' ( in 4-component vector of float) -0:275 'inF2' ( in 4-component vector of float) -0:276 Test condition and select ( temp void) -0:276 Condition -0:276 any ( temp bool) -0:276 Compare Less Than ( temp 4-component vector of bool) +0:276 Sequence +0:276 move second child to first child ( temp 4-component vector of float) +0:276 'r012' ( temp 4-component vector of float) +0:276 clamp ( temp 4-component vector of float) 0:276 'inF0' ( in 4-component vector of float) -0:276 Constant: -0:276 0.000000 -0:276 0.000000 -0:276 0.000000 -0:276 0.000000 -0:276 true case -0:276 Branch: Kill +0:276 'inF1' ( in 4-component vector of float) +0:276 'inF2' ( in 4-component vector of float) 0:277 Test condition and select ( temp void) 0:277 Condition 0:277 any ( temp bool) 0:277 Compare Less Than ( temp 4-component vector of bool) -0:277 'inU0' ( in 4-component vector of uint) +0:277 'inF0' ( in 4-component vector of float) 0:277 Constant: 0:277 0.000000 0:277 0.000000 @@ -4071,905 +4071,917 @@ gl_FragCoord origin is upper left 0:277 0.000000 0:277 true case 0:277 Branch: Kill -0:278 Sequence -0:278 move second child to first child ( temp 4-component vector of float) -0:278 'r013' ( temp 4-component vector of float) -0:278 cosine ( temp 4-component vector of float) -0:278 'inF0' ( in 4-component vector of float) +0:278 Test condition and select ( temp void) +0:278 Condition +0:278 any ( temp bool) +0:278 Compare Less Than ( temp 4-component vector of bool) +0:278 'inU0' ( in 4-component vector of uint) +0:278 Constant: +0:278 0.000000 +0:278 0.000000 +0:278 0.000000 +0:278 0.000000 +0:278 true case +0:278 Branch: Kill 0:279 Sequence 0:279 move second child to first child ( temp 4-component vector of float) -0:279 'r014' ( temp 4-component vector of float) -0:279 hyp. cosine ( temp 4-component vector of float) +0:279 'r013' ( temp 4-component vector of float) +0:279 cosine ( temp 4-component vector of float) 0:279 'inF0' ( in 4-component vector of float) 0:280 Sequence -0:280 move second child to first child ( temp 4-component vector of uint) -0:280 'r015' ( temp 4-component vector of uint) +0:280 move second child to first child ( temp 4-component vector of float) +0:280 'r014' ( temp 4-component vector of float) +0:280 hyp. cosine ( temp 4-component vector of float) +0:280 'inF0' ( in 4-component vector of float) +0:281 Sequence +0:281 move second child to first child ( temp 4-component vector of uint) +0:281 'r015' ( temp 4-component vector of uint) 0:? bitCount ( temp 4-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 3 (const uint) 0:? 5 (const uint) 0:? 2 (const uint) -0:281 Sequence -0:281 move second child to first child ( temp 4-component vector of float) -0:281 'r016' ( temp 4-component vector of float) -0:281 dPdx ( temp 4-component vector of float) -0:281 'inF0' ( in 4-component vector of float) 0:282 Sequence 0:282 move second child to first child ( temp 4-component vector of float) -0:282 'r017' ( temp 4-component vector of float) -0:282 dPdxCoarse ( temp 4-component vector of float) +0:282 'r016' ( temp 4-component vector of float) +0:282 dPdx ( temp 4-component vector of float) 0:282 'inF0' ( in 4-component vector of float) 0:283 Sequence 0:283 move second child to first child ( temp 4-component vector of float) -0:283 'r018' ( temp 4-component vector of float) -0:283 dPdxFine ( temp 4-component vector of float) +0:283 'r017' ( temp 4-component vector of float) +0:283 dPdxCoarse ( temp 4-component vector of float) 0:283 'inF0' ( in 4-component vector of float) 0:284 Sequence 0:284 move second child to first child ( temp 4-component vector of float) -0:284 'r019' ( temp 4-component vector of float) -0:284 dPdy ( temp 4-component vector of float) +0:284 'r018' ( temp 4-component vector of float) +0:284 dPdxFine ( temp 4-component vector of float) 0:284 'inF0' ( in 4-component vector of float) 0:285 Sequence 0:285 move second child to first child ( temp 4-component vector of float) -0:285 'r020' ( temp 4-component vector of float) -0:285 dPdyCoarse ( temp 4-component vector of float) +0:285 'r019' ( temp 4-component vector of float) +0:285 dPdy ( temp 4-component vector of float) 0:285 'inF0' ( in 4-component vector of float) 0:286 Sequence 0:286 move second child to first child ( temp 4-component vector of float) -0:286 'r021' ( temp 4-component vector of float) -0:286 dPdyFine ( temp 4-component vector of float) +0:286 'r020' ( temp 4-component vector of float) +0:286 dPdyCoarse ( temp 4-component vector of float) 0:286 'inF0' ( in 4-component vector of float) 0:287 Sequence 0:287 move second child to first child ( temp 4-component vector of float) -0:287 'r022' ( temp 4-component vector of float) -0:287 degrees ( temp 4-component vector of float) +0:287 'r021' ( temp 4-component vector of float) +0:287 dPdyFine ( temp 4-component vector of float) 0:287 'inF0' ( in 4-component vector of float) 0:288 Sequence -0:288 move second child to first child ( temp float) -0:288 'r023' ( temp float) -0:288 distance ( temp float) +0:288 move second child to first child ( temp 4-component vector of float) +0:288 'r022' ( temp 4-component vector of float) +0:288 degrees ( temp 4-component vector of float) 0:288 'inF0' ( in 4-component vector of float) -0:288 'inF1' ( in 4-component vector of float) 0:289 Sequence 0:289 move second child to first child ( temp float) -0:289 'r024' ( temp float) -0:289 dot-product ( temp float) +0:289 'r023' ( temp float) +0:289 distance ( temp float) 0:289 'inF0' ( in 4-component vector of float) 0:289 'inF1' ( in 4-component vector of float) 0:290 Sequence -0:290 move second child to first child ( temp 4-component vector of float) -0:290 'r025' ( temp 4-component vector of float) -0:290 Construct vec4 ( temp 4-component vector of float) -0:290 Constant: -0:290 1.000000 -0:290 component-wise multiply ( temp float) -0:290 direct index ( temp float) -0:290 'inF0' ( in 4-component vector of float) -0:290 Constant: -0:290 1 (const int) -0:290 direct index ( temp float) -0:290 'inF1' ( in 4-component vector of float) -0:290 Constant: -0:290 1 (const int) -0:290 direct index ( temp float) -0:290 'inF0' ( in 4-component vector of float) -0:290 Constant: -0:290 2 (const int) -0:290 direct index ( temp float) -0:290 'inF1' ( in 4-component vector of float) -0:290 Constant: -0:290 3 (const int) -0:294 Sequence -0:294 move second child to first child ( temp 4-component vector of float) -0:294 'r029' ( temp 4-component vector of float) -0:294 exp ( temp 4-component vector of float) -0:294 'inF0' ( in 4-component vector of float) +0:290 move second child to first child ( temp float) +0:290 'r024' ( temp float) +0:290 dot-product ( temp float) +0:290 'inF0' ( in 4-component vector of float) +0:290 'inF1' ( in 4-component vector of float) +0:291 Sequence +0:291 move second child to first child ( temp 4-component vector of float) +0:291 'r025' ( temp 4-component vector of float) +0:291 Construct vec4 ( temp 4-component vector of float) +0:291 Constant: +0:291 1.000000 +0:291 component-wise multiply ( temp float) +0:291 direct index ( temp float) +0:291 'inF0' ( in 4-component vector of float) +0:291 Constant: +0:291 1 (const int) +0:291 direct index ( temp float) +0:291 'inF1' ( in 4-component vector of float) +0:291 Constant: +0:291 1 (const int) +0:291 direct index ( temp float) +0:291 'inF0' ( in 4-component vector of float) +0:291 Constant: +0:291 2 (const int) +0:291 direct index ( temp float) +0:291 'inF1' ( in 4-component vector of float) +0:291 Constant: +0:291 3 (const int) 0:295 Sequence 0:295 move second child to first child ( temp 4-component vector of float) -0:295 'r030' ( temp 4-component vector of float) -0:295 exp2 ( temp 4-component vector of float) +0:295 'r029' ( temp 4-component vector of float) +0:295 exp ( temp 4-component vector of float) 0:295 'inF0' ( in 4-component vector of float) 0:296 Sequence 0:296 move second child to first child ( temp 4-component vector of float) -0:296 'r031' ( temp 4-component vector of float) -0:296 face-forward ( temp 4-component vector of float) +0:296 'r030' ( temp 4-component vector of float) +0:296 exp2 ( temp 4-component vector of float) 0:296 'inF0' ( in 4-component vector of float) -0:296 'inF1' ( in 4-component vector of float) -0:296 'inF2' ( in 4-component vector of float) 0:297 Sequence -0:297 move second child to first child ( temp 4-component vector of uint) -0:297 'r032' ( temp 4-component vector of uint) +0:297 move second child to first child ( temp 4-component vector of float) +0:297 'r031' ( temp 4-component vector of float) +0:297 face-forward ( temp 4-component vector of float) +0:297 'inF0' ( in 4-component vector of float) +0:297 'inF1' ( in 4-component vector of float) +0:297 'inF2' ( in 4-component vector of float) +0:298 Sequence +0:298 move second child to first child ( temp 4-component vector of uint) +0:298 'r032' ( temp 4-component vector of uint) 0:? findMSB ( temp 4-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) 0:? 9 (const uint) 0:? 10 (const uint) -0:298 Sequence -0:298 move second child to first child ( temp 4-component vector of uint) -0:298 'r033' ( temp 4-component vector of uint) +0:299 Sequence +0:299 move second child to first child ( temp 4-component vector of uint) +0:299 'r033' ( temp 4-component vector of uint) 0:? findLSB ( temp 4-component vector of uint) 0:? Constant: 0:? 7 (const uint) 0:? 8 (const uint) 0:? 9 (const uint) 0:? 10 (const uint) -0:299 Sequence -0:299 move second child to first child ( temp 4-component vector of float) -0:299 'r034' ( temp 4-component vector of float) -0:299 Floor ( temp 4-component vector of float) -0:299 'inF0' ( in 4-component vector of float) -0:301 Sequence -0:301 move second child to first child ( temp 4-component vector of float) -0:301 'r036' ( temp 4-component vector of float) -0:301 mod ( temp 4-component vector of float) -0:301 'inF0' ( in 4-component vector of float) -0:301 'inF1' ( in 4-component vector of float) +0:300 Sequence +0:300 move second child to first child ( temp 4-component vector of float) +0:300 'r034' ( temp 4-component vector of float) +0:300 Floor ( temp 4-component vector of float) +0:300 'inF0' ( in 4-component vector of float) 0:302 Sequence 0:302 move second child to first child ( temp 4-component vector of float) -0:302 'r037' ( temp 4-component vector of float) -0:302 Fraction ( temp 4-component vector of float) +0:302 'r036' ( temp 4-component vector of float) +0:302 mod ( temp 4-component vector of float) 0:302 'inF0' ( in 4-component vector of float) +0:302 'inF1' ( in 4-component vector of float) 0:303 Sequence 0:303 move second child to first child ( temp 4-component vector of float) -0:303 'r039' ( temp 4-component vector of float) -0:303 fwidth ( temp 4-component vector of float) +0:303 'r037' ( temp 4-component vector of float) +0:303 Fraction ( temp 4-component vector of float) 0:303 'inF0' ( in 4-component vector of float) 0:304 Sequence -0:304 move second child to first child ( temp 4-component vector of bool) -0:304 'r040' ( temp 4-component vector of bool) -0:304 isinf ( temp 4-component vector of bool) +0:304 move second child to first child ( temp 4-component vector of float) +0:304 'r039' ( temp 4-component vector of float) +0:304 fwidth ( temp 4-component vector of float) 0:304 'inF0' ( in 4-component vector of float) 0:305 Sequence 0:305 move second child to first child ( temp 4-component vector of bool) -0:305 'r041' ( temp 4-component vector of bool) -0:305 isnan ( temp 4-component vector of bool) +0:305 'r040' ( temp 4-component vector of bool) +0:305 isinf ( temp 4-component vector of bool) 0:305 'inF0' ( in 4-component vector of float) 0:306 Sequence -0:306 move second child to first child ( temp 4-component vector of float) -0:306 'r042' ( temp 4-component vector of float) -0:306 ldexp ( temp 4-component vector of float) +0:306 move second child to first child ( temp 4-component vector of bool) +0:306 'r041' ( temp 4-component vector of bool) +0:306 isnan ( temp 4-component vector of bool) 0:306 'inF0' ( in 4-component vector of float) -0:306 'inF1' ( in 4-component vector of float) 0:307 Sequence 0:307 move second child to first child ( temp 4-component vector of float) -0:307 'r039a' ( temp 4-component vector of float) -0:307 mix ( temp 4-component vector of float) +0:307 'r042' ( temp 4-component vector of float) +0:307 ldexp ( temp 4-component vector of float) 0:307 'inF0' ( in 4-component vector of float) 0:307 'inF1' ( in 4-component vector of float) -0:307 'inF2' ( in 4-component vector of float) 0:308 Sequence -0:308 move second child to first child ( temp float) -0:308 'r043' ( temp float) -0:308 length ( temp float) +0:308 move second child to first child ( temp 4-component vector of float) +0:308 'r039a' ( temp 4-component vector of float) +0:308 mix ( temp 4-component vector of float) 0:308 'inF0' ( in 4-component vector of float) +0:308 'inF1' ( in 4-component vector of float) +0:308 'inF2' ( in 4-component vector of float) 0:309 Sequence -0:309 move second child to first child ( temp 4-component vector of float) -0:309 'r044' ( temp 4-component vector of float) -0:309 log ( temp 4-component vector of float) +0:309 move second child to first child ( temp float) +0:309 'r043' ( temp float) +0:309 length ( temp float) 0:309 'inF0' ( in 4-component vector of float) 0:310 Sequence 0:310 move second child to first child ( temp 4-component vector of float) -0:310 'r045' ( temp 4-component vector of float) -0:310 vector-scale ( temp 4-component vector of float) -0:310 log2 ( temp 4-component vector of float) -0:310 'inF0' ( in 4-component vector of float) -0:310 Constant: -0:310 0.301030 +0:310 'r044' ( temp 4-component vector of float) +0:310 log ( temp 4-component vector of float) +0:310 'inF0' ( in 4-component vector of float) 0:311 Sequence 0:311 move second child to first child ( temp 4-component vector of float) -0:311 'r046' ( temp 4-component vector of float) -0:311 log2 ( temp 4-component vector of float) -0:311 'inF0' ( in 4-component vector of float) +0:311 'r045' ( temp 4-component vector of float) +0:311 vector-scale ( temp 4-component vector of float) +0:311 log2 ( temp 4-component vector of float) +0:311 'inF0' ( in 4-component vector of float) +0:311 Constant: +0:311 0.301030 0:312 Sequence 0:312 move second child to first child ( temp 4-component vector of float) -0:312 'r047' ( temp 4-component vector of float) -0:312 max ( temp 4-component vector of float) +0:312 'r046' ( temp 4-component vector of float) +0:312 log2 ( temp 4-component vector of float) 0:312 'inF0' ( in 4-component vector of float) -0:312 'inF1' ( in 4-component vector of float) 0:313 Sequence 0:313 move second child to first child ( temp 4-component vector of float) -0:313 'r048' ( temp 4-component vector of float) -0:313 min ( temp 4-component vector of float) +0:313 'r047' ( temp 4-component vector of float) +0:313 max ( temp 4-component vector of float) 0:313 'inF0' ( in 4-component vector of float) 0:313 'inF1' ( in 4-component vector of float) 0:314 Sequence 0:314 move second child to first child ( temp 4-component vector of float) -0:314 'r049' ( temp 4-component vector of float) -0:314 normalize ( temp 4-component vector of float) +0:314 'r048' ( temp 4-component vector of float) +0:314 min ( temp 4-component vector of float) 0:314 'inF0' ( in 4-component vector of float) +0:314 'inF1' ( in 4-component vector of float) 0:315 Sequence 0:315 move second child to first child ( temp 4-component vector of float) -0:315 'r050' ( temp 4-component vector of float) -0:315 pow ( temp 4-component vector of float) +0:315 'r049' ( temp 4-component vector of float) +0:315 normalize ( temp 4-component vector of float) 0:315 'inF0' ( in 4-component vector of float) -0:315 'inF1' ( in 4-component vector of float) 0:316 Sequence 0:316 move second child to first child ( temp 4-component vector of float) -0:316 'r051' ( temp 4-component vector of float) -0:316 radians ( temp 4-component vector of float) +0:316 'r050' ( temp 4-component vector of float) +0:316 pow ( temp 4-component vector of float) 0:316 'inF0' ( in 4-component vector of float) +0:316 'inF1' ( in 4-component vector of float) 0:317 Sequence 0:317 move second child to first child ( temp 4-component vector of float) -0:317 'r052' ( temp 4-component vector of float) -0:317 divide ( temp 4-component vector of float) -0:317 Constant: -0:317 1.000000 +0:317 'r051' ( temp 4-component vector of float) +0:317 radians ( temp 4-component vector of float) 0:317 'inF0' ( in 4-component vector of float) 0:318 Sequence 0:318 move second child to first child ( temp 4-component vector of float) -0:318 'r053' ( temp 4-component vector of float) -0:318 reflect ( temp 4-component vector of float) +0:318 'r052' ( temp 4-component vector of float) +0:318 divide ( temp 4-component vector of float) +0:318 Constant: +0:318 1.000000 0:318 'inF0' ( in 4-component vector of float) -0:318 'inF1' ( in 4-component vector of float) 0:319 Sequence 0:319 move second child to first child ( temp 4-component vector of float) -0:319 'r054' ( temp 4-component vector of float) -0:319 refract ( temp 4-component vector of float) +0:319 'r053' ( temp 4-component vector of float) +0:319 reflect ( temp 4-component vector of float) 0:319 'inF0' ( in 4-component vector of float) 0:319 'inF1' ( in 4-component vector of float) -0:319 Constant: -0:319 2.000000 0:320 Sequence -0:320 move second child to first child ( temp 4-component vector of uint) -0:320 'r055' ( temp 4-component vector of uint) +0:320 move second child to first child ( temp 4-component vector of float) +0:320 'r054' ( temp 4-component vector of float) +0:320 refract ( temp 4-component vector of float) +0:320 'inF0' ( in 4-component vector of float) +0:320 'inF1' ( in 4-component vector of float) +0:320 Constant: +0:320 2.000000 +0:321 Sequence +0:321 move second child to first child ( temp 4-component vector of uint) +0:321 'r055' ( temp 4-component vector of uint) 0:? bitFieldReverse ( temp 4-component vector of uint) 0:? Constant: 0:? 1 (const uint) 0:? 2 (const uint) 0:? 3 (const uint) 0:? 4 (const uint) -0:321 Sequence -0:321 move second child to first child ( temp 4-component vector of float) -0:321 'r056' ( temp 4-component vector of float) -0:321 roundEven ( temp 4-component vector of float) -0:321 'inF0' ( in 4-component vector of float) 0:322 Sequence 0:322 move second child to first child ( temp 4-component vector of float) -0:322 'r057' ( temp 4-component vector of float) -0:322 inverse sqrt ( temp 4-component vector of float) +0:322 'r056' ( temp 4-component vector of float) +0:322 roundEven ( temp 4-component vector of float) 0:322 'inF0' ( in 4-component vector of float) 0:323 Sequence 0:323 move second child to first child ( temp 4-component vector of float) -0:323 'r058' ( temp 4-component vector of float) -0:323 clamp ( temp 4-component vector of float) +0:323 'r057' ( temp 4-component vector of float) +0:323 inverse sqrt ( temp 4-component vector of float) 0:323 'inF0' ( in 4-component vector of float) -0:323 Constant: -0:323 0.000000 -0:323 Constant: -0:323 1.000000 0:324 Sequence 0:324 move second child to first child ( temp 4-component vector of float) -0:324 'r059' ( temp 4-component vector of float) -0:324 Sign ( temp 4-component vector of float) +0:324 'r058' ( temp 4-component vector of float) +0:324 clamp ( temp 4-component vector of float) 0:324 'inF0' ( in 4-component vector of float) +0:324 Constant: +0:324 0.000000 +0:324 Constant: +0:324 1.000000 0:325 Sequence 0:325 move second child to first child ( temp 4-component vector of float) -0:325 'r060' ( temp 4-component vector of float) -0:325 sine ( temp 4-component vector of float) +0:325 'r059' ( temp 4-component vector of float) +0:325 Sign ( temp 4-component vector of float) 0:325 'inF0' ( in 4-component vector of float) 0:326 Sequence 0:326 move second child to first child ( temp 4-component vector of float) -0:326 'inF1' ( in 4-component vector of float) +0:326 'r060' ( temp 4-component vector of float) 0:326 sine ( temp 4-component vector of float) 0:326 'inF0' ( in 4-component vector of float) -0:326 move second child to first child ( temp 4-component vector of float) -0:326 'inF2' ( in 4-component vector of float) -0:326 cosine ( temp 4-component vector of float) -0:326 'inF0' ( in 4-component vector of float) 0:327 Sequence 0:327 move second child to first child ( temp 4-component vector of float) -0:327 'r061' ( temp 4-component vector of float) -0:327 hyp. sine ( temp 4-component vector of float) +0:327 'inF1' ( in 4-component vector of float) +0:327 sine ( temp 4-component vector of float) +0:327 'inF0' ( in 4-component vector of float) +0:327 move second child to first child ( temp 4-component vector of float) +0:327 'inF2' ( in 4-component vector of float) +0:327 cosine ( temp 4-component vector of float) 0:327 'inF0' ( in 4-component vector of float) 0:328 Sequence 0:328 move second child to first child ( temp 4-component vector of float) -0:328 'r062' ( temp 4-component vector of float) -0:328 smoothstep ( temp 4-component vector of float) +0:328 'r061' ( temp 4-component vector of float) +0:328 hyp. sine ( temp 4-component vector of float) 0:328 'inF0' ( in 4-component vector of float) -0:328 'inF1' ( in 4-component vector of float) -0:328 'inF2' ( in 4-component vector of float) 0:329 Sequence 0:329 move second child to first child ( temp 4-component vector of float) -0:329 'r063' ( temp 4-component vector of float) -0:329 sqrt ( temp 4-component vector of float) +0:329 'r062' ( temp 4-component vector of float) +0:329 smoothstep ( temp 4-component vector of float) 0:329 'inF0' ( in 4-component vector of float) +0:329 'inF1' ( in 4-component vector of float) +0:329 'inF2' ( in 4-component vector of float) 0:330 Sequence 0:330 move second child to first child ( temp 4-component vector of float) -0:330 'r064' ( temp 4-component vector of float) -0:330 step ( temp 4-component vector of float) +0:330 'r063' ( temp 4-component vector of float) +0:330 sqrt ( temp 4-component vector of float) 0:330 'inF0' ( in 4-component vector of float) -0:330 'inF1' ( in 4-component vector of float) 0:331 Sequence 0:331 move second child to first child ( temp 4-component vector of float) -0:331 'r065' ( temp 4-component vector of float) -0:331 tangent ( temp 4-component vector of float) +0:331 'r064' ( temp 4-component vector of float) +0:331 step ( temp 4-component vector of float) 0:331 'inF0' ( in 4-component vector of float) +0:331 'inF1' ( in 4-component vector of float) 0:332 Sequence 0:332 move second child to first child ( temp 4-component vector of float) -0:332 'r066' ( temp 4-component vector of float) -0:332 hyp. tangent ( temp 4-component vector of float) +0:332 'r065' ( temp 4-component vector of float) +0:332 tangent ( temp 4-component vector of float) 0:332 'inF0' ( in 4-component vector of float) -0:334 Sequence -0:334 move second child to first child ( temp 4-component vector of float) -0:334 'r067' ( temp 4-component vector of float) -0:334 trunc ( temp 4-component vector of float) -0:334 'inF0' ( in 4-component vector of float) -0:337 Branch: Return with expression +0:333 Sequence +0:333 move second child to first child ( temp 4-component vector of float) +0:333 'r066' ( temp 4-component vector of float) +0:333 hyp. tangent ( temp 4-component vector of float) +0:333 'inF0' ( in 4-component vector of float) +0:335 Sequence +0:335 move second child to first child ( temp 4-component vector of float) +0:335 'r067' ( temp 4-component vector of float) +0:335 trunc ( temp 4-component vector of float) +0:335 'inF0' ( in 4-component vector of float) +0:338 Branch: Return with expression 0:? Constant: 0:? 1.000000 0:? 2.000000 0:? 3.000000 0:? 4.000000 -0:400 Function Definition: PixelShaderFunction2x2(mf22;mf22;mf22; ( temp 2X2 matrix of float) -0:400 Function Parameters: -0:400 'inF0' ( in 2X2 matrix of float) -0:400 'inF1' ( in 2X2 matrix of float) -0:400 'inF2' ( in 2X2 matrix of float) +0:401 Function Definition: PixelShaderFunction2x2(mf22;mf22;mf22; ( temp 2X2 matrix of float) +0:401 Function Parameters: +0:401 'inF0' ( in 2X2 matrix of float) +0:401 'inF1' ( in 2X2 matrix of float) +0:401 'inF2' ( in 2X2 matrix of float) 0:? Sequence -0:402 Sequence -0:402 move second child to first child ( temp bool) -0:402 'r000' ( temp bool) -0:402 all ( temp bool) -0:402 Convert float to bool ( temp 2X2 matrix of bool) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r001' ( temp 2X2 matrix of float) -0:402 Absolute value ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 arc cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp bool) -0:402 'r003' ( temp bool) -0:402 any ( temp bool) -0:402 Convert float to bool ( temp 2X2 matrix of bool) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r004' ( temp 2X2 matrix of float) -0:402 arc sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r005' ( temp 2X2 matrix of float) -0:402 arc tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r006' ( temp 2X2 matrix of float) -0:402 arc tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r007' ( temp 2X2 matrix of float) -0:402 Ceiling ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Test condition and select ( temp void) -0:402 Condition -0:402 any ( temp bool) -0:402 Compare Less Than ( temp 2X2 matrix of bool) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Constant: -0:402 0.000000 -0:402 0.000000 -0:402 0.000000 -0:402 0.000000 -0:402 true case -0:402 Branch: Kill -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r008' ( temp 2X2 matrix of float) -0:402 clamp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r009' ( temp 2X2 matrix of float) -0:402 cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r010' ( temp 2X2 matrix of float) -0:402 hyp. cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r011' ( temp 2X2 matrix of float) -0:402 dPdx ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r012' ( temp 2X2 matrix of float) -0:402 dPdxCoarse ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r013' ( temp 2X2 matrix of float) -0:402 dPdxFine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r014' ( temp 2X2 matrix of float) -0:402 dPdy ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r015' ( temp 2X2 matrix of float) -0:402 dPdyCoarse ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r016' ( temp 2X2 matrix of float) -0:402 dPdyFine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r017' ( temp 2X2 matrix of float) -0:402 degrees ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp float) -0:402 'r018' ( temp float) -0:402 determinant ( temp float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r019' ( temp 2X2 matrix of float) -0:402 exp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'R020' ( temp 2X2 matrix of float) -0:402 exp2 ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r021' ( temp 2X2 matrix of float) -0:402 Floor ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r022' ( temp 2X2 matrix of float) -0:402 mod ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r023' ( temp 2X2 matrix of float) -0:402 Fraction ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r025' ( temp 2X2 matrix of float) -0:402 fwidth ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r026' ( temp 2X2 matrix of float) -0:402 ldexp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r026a' ( temp 2X2 matrix of float) -0:402 mix ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r027' ( temp 2X2 matrix of float) -0:402 log ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r028' ( temp 2X2 matrix of float) -0:402 matrix-scale ( temp 2X2 matrix of float) -0:402 log2 ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Constant: -0:402 0.301030 -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r029' ( temp 2X2 matrix of float) -0:402 log2 ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r030' ( temp 2X2 matrix of float) -0:402 max ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r031' ( temp 2X2 matrix of float) -0:402 min ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r032' ( temp 2X2 matrix of float) -0:402 pow ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r033' ( temp 2X2 matrix of float) -0:402 radians ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r034' ( temp 2X2 matrix of float) -0:402 roundEven ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r035' ( temp 2X2 matrix of float) -0:402 inverse sqrt ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r036' ( temp 2X2 matrix of float) -0:402 clamp ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Constant: -0:402 0.000000 -0:402 Constant: -0:402 1.000000 -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r037' ( temp 2X2 matrix of float) -0:402 Sign ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r038' ( temp 2X2 matrix of float) -0:402 sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 cosine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r039' ( temp 2X2 matrix of float) -0:402 hyp. sine ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r049' ( temp 2X2 matrix of float) -0:402 smoothstep ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 'inF2' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r041' ( temp 2X2 matrix of float) -0:402 sqrt ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r042' ( temp 2X2 matrix of float) -0:402 step ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 'inF1' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r043' ( temp 2X2 matrix of float) -0:402 tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r044' ( temp 2X2 matrix of float) -0:402 hyp. tangent ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 transpose ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:402 Sequence -0:402 move second child to first child ( temp 2X2 matrix of float) -0:402 'r046' ( temp 2X2 matrix of float) -0:402 trunc ( temp 2X2 matrix of float) -0:402 'inF0' ( in 2X2 matrix of float) -0:405 Branch: Return with expression +0:403 Sequence +0:403 move second child to first child ( temp bool) +0:403 'r000' ( temp bool) +0:403 all ( temp bool) +0:403 Convert float to bool ( temp 2X2 matrix of bool) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r001' ( temp 2X2 matrix of float) +0:403 Absolute value ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 arc cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp bool) +0:403 'r003' ( temp bool) +0:403 any ( temp bool) +0:403 Convert float to bool ( temp 2X2 matrix of bool) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r004' ( temp 2X2 matrix of float) +0:403 arc sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r005' ( temp 2X2 matrix of float) +0:403 arc tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r006' ( temp 2X2 matrix of float) +0:403 arc tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r007' ( temp 2X2 matrix of float) +0:403 Ceiling ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Test condition and select ( temp void) +0:403 Condition +0:403 any ( temp bool) +0:403 Compare Less Than ( temp 2X2 matrix of bool) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Constant: +0:403 0.000000 +0:403 0.000000 +0:403 0.000000 +0:403 0.000000 +0:403 true case +0:403 Branch: Kill +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r008' ( temp 2X2 matrix of float) +0:403 clamp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r009' ( temp 2X2 matrix of float) +0:403 cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r010' ( temp 2X2 matrix of float) +0:403 hyp. cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r011' ( temp 2X2 matrix of float) +0:403 dPdx ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r012' ( temp 2X2 matrix of float) +0:403 dPdxCoarse ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r013' ( temp 2X2 matrix of float) +0:403 dPdxFine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r014' ( temp 2X2 matrix of float) +0:403 dPdy ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r015' ( temp 2X2 matrix of float) +0:403 dPdyCoarse ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r016' ( temp 2X2 matrix of float) +0:403 dPdyFine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r017' ( temp 2X2 matrix of float) +0:403 degrees ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp float) +0:403 'r018' ( temp float) +0:403 determinant ( temp float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r019' ( temp 2X2 matrix of float) +0:403 exp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'R020' ( temp 2X2 matrix of float) +0:403 exp2 ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r021' ( temp 2X2 matrix of float) +0:403 Floor ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r022' ( temp 2X2 matrix of float) +0:403 mod ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r023' ( temp 2X2 matrix of float) +0:403 Fraction ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r025' ( temp 2X2 matrix of float) +0:403 fwidth ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r026' ( temp 2X2 matrix of float) +0:403 ldexp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r026a' ( temp 2X2 matrix of float) +0:403 mix ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r027' ( temp 2X2 matrix of float) +0:403 log ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r028' ( temp 2X2 matrix of float) +0:403 matrix-scale ( temp 2X2 matrix of float) +0:403 log2 ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Constant: +0:403 0.301030 +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r029' ( temp 2X2 matrix of float) +0:403 log2 ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r030' ( temp 2X2 matrix of float) +0:403 max ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r031' ( temp 2X2 matrix of float) +0:403 min ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r032' ( temp 2X2 matrix of float) +0:403 pow ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r033' ( temp 2X2 matrix of float) +0:403 radians ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r034' ( temp 2X2 matrix of float) +0:403 roundEven ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r035' ( temp 2X2 matrix of float) +0:403 inverse sqrt ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r036' ( temp 2X2 matrix of float) +0:403 clamp ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Constant: +0:403 0.000000 +0:403 Constant: +0:403 1.000000 +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r037' ( temp 2X2 matrix of float) +0:403 Sign ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r038' ( temp 2X2 matrix of float) +0:403 sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 cosine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r039' ( temp 2X2 matrix of float) +0:403 hyp. sine ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r049' ( temp 2X2 matrix of float) +0:403 smoothstep ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 'inF2' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r041' ( temp 2X2 matrix of float) +0:403 sqrt ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r042' ( temp 2X2 matrix of float) +0:403 step ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 'inF1' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r043' ( temp 2X2 matrix of float) +0:403 tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r044' ( temp 2X2 matrix of float) +0:403 hyp. tangent ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 transpose ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:403 Sequence +0:403 move second child to first child ( temp 2X2 matrix of float) +0:403 'r046' ( temp 2X2 matrix of float) +0:403 trunc ( temp 2X2 matrix of float) +0:403 'inF0' ( in 2X2 matrix of float) +0:406 Branch: Return with expression 0:? Constant: 0:? 2.000000 0:? 2.000000 0:? 2.000000 0:? 2.000000 -0:409 Function Definition: PixelShaderFunction3x3(mf33;mf33;mf33; ( temp 3X3 matrix of float) -0:409 Function Parameters: -0:409 'inF0' ( in 3X3 matrix of float) -0:409 'inF1' ( in 3X3 matrix of float) -0:409 'inF2' ( in 3X3 matrix of float) +0:410 Function Definition: PixelShaderFunction3x3(mf33;mf33;mf33; ( temp 3X3 matrix of float) +0:410 Function Parameters: +0:410 'inF0' ( in 3X3 matrix of float) +0:410 'inF1' ( in 3X3 matrix of float) +0:410 'inF2' ( in 3X3 matrix of float) 0:? Sequence -0:411 Sequence -0:411 move second child to first child ( temp bool) -0:411 'r000' ( temp bool) -0:411 all ( temp bool) -0:411 Convert float to bool ( temp 3X3 matrix of bool) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r001' ( temp 3X3 matrix of float) -0:411 Absolute value ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 arc cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp bool) -0:411 'r003' ( temp bool) -0:411 any ( temp bool) -0:411 Convert float to bool ( temp 3X3 matrix of bool) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r004' ( temp 3X3 matrix of float) -0:411 arc sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r005' ( temp 3X3 matrix of float) -0:411 arc tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r006' ( temp 3X3 matrix of float) -0:411 arc tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r007' ( temp 3X3 matrix of float) -0:411 Ceiling ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Test condition and select ( temp void) -0:411 Condition -0:411 any ( temp bool) -0:411 Compare Less Than ( temp 3X3 matrix of bool) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Constant: -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 0.000000 -0:411 true case -0:411 Branch: Kill -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r008' ( temp 3X3 matrix of float) -0:411 clamp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r009' ( temp 3X3 matrix of float) -0:411 cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r010' ( temp 3X3 matrix of float) -0:411 hyp. cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r011' ( temp 3X3 matrix of float) -0:411 dPdx ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r012' ( temp 3X3 matrix of float) -0:411 dPdxCoarse ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r013' ( temp 3X3 matrix of float) -0:411 dPdxFine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r014' ( temp 3X3 matrix of float) -0:411 dPdy ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r015' ( temp 3X3 matrix of float) -0:411 dPdyCoarse ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r016' ( temp 3X3 matrix of float) -0:411 dPdyFine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r017' ( temp 3X3 matrix of float) -0:411 degrees ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp float) -0:411 'r018' ( temp float) -0:411 determinant ( temp float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r019' ( temp 3X3 matrix of float) -0:411 exp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'R020' ( temp 3X3 matrix of float) -0:411 exp2 ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r021' ( temp 3X3 matrix of float) -0:411 Floor ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r022' ( temp 3X3 matrix of float) -0:411 mod ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r023' ( temp 3X3 matrix of float) -0:411 Fraction ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r025' ( temp 3X3 matrix of float) -0:411 fwidth ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r026' ( temp 3X3 matrix of float) -0:411 ldexp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r026a' ( temp 3X3 matrix of float) -0:411 mix ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r027' ( temp 3X3 matrix of float) -0:411 log ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r028' ( temp 3X3 matrix of float) -0:411 matrix-scale ( temp 3X3 matrix of float) -0:411 log2 ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Constant: -0:411 0.301030 -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r029' ( temp 3X3 matrix of float) -0:411 log2 ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r030' ( temp 3X3 matrix of float) -0:411 max ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r031' ( temp 3X3 matrix of float) -0:411 min ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r032' ( temp 3X3 matrix of float) -0:411 pow ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r033' ( temp 3X3 matrix of float) -0:411 radians ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r034' ( temp 3X3 matrix of float) -0:411 roundEven ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r035' ( temp 3X3 matrix of float) -0:411 inverse sqrt ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r036' ( temp 3X3 matrix of float) -0:411 clamp ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Constant: -0:411 0.000000 -0:411 Constant: -0:411 1.000000 -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r037' ( temp 3X3 matrix of float) -0:411 Sign ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r038' ( temp 3X3 matrix of float) -0:411 sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 cosine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r039' ( temp 3X3 matrix of float) -0:411 hyp. sine ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r049' ( temp 3X3 matrix of float) -0:411 smoothstep ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 'inF2' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r041' ( temp 3X3 matrix of float) -0:411 sqrt ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r042' ( temp 3X3 matrix of float) -0:411 step ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 'inF1' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r043' ( temp 3X3 matrix of float) -0:411 tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r044' ( temp 3X3 matrix of float) -0:411 hyp. tangent ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 transpose ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:411 Sequence -0:411 move second child to first child ( temp 3X3 matrix of float) -0:411 'r046' ( temp 3X3 matrix of float) -0:411 trunc ( temp 3X3 matrix of float) -0:411 'inF0' ( in 3X3 matrix of float) -0:414 Branch: Return with expression +0:412 Sequence +0:412 move second child to first child ( temp bool) +0:412 'r000' ( temp bool) +0:412 all ( temp bool) +0:412 Convert float to bool ( temp 3X3 matrix of bool) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r001' ( temp 3X3 matrix of float) +0:412 Absolute value ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 arc cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp bool) +0:412 'r003' ( temp bool) +0:412 any ( temp bool) +0:412 Convert float to bool ( temp 3X3 matrix of bool) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r004' ( temp 3X3 matrix of float) +0:412 arc sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r005' ( temp 3X3 matrix of float) +0:412 arc tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r006' ( temp 3X3 matrix of float) +0:412 arc tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r007' ( temp 3X3 matrix of float) +0:412 Ceiling ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Test condition and select ( temp void) +0:412 Condition +0:412 any ( temp bool) +0:412 Compare Less Than ( temp 3X3 matrix of bool) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Constant: +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 0.000000 +0:412 true case +0:412 Branch: Kill +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r008' ( temp 3X3 matrix of float) +0:412 clamp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r009' ( temp 3X3 matrix of float) +0:412 cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r010' ( temp 3X3 matrix of float) +0:412 hyp. cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r011' ( temp 3X3 matrix of float) +0:412 dPdx ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r012' ( temp 3X3 matrix of float) +0:412 dPdxCoarse ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r013' ( temp 3X3 matrix of float) +0:412 dPdxFine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r014' ( temp 3X3 matrix of float) +0:412 dPdy ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r015' ( temp 3X3 matrix of float) +0:412 dPdyCoarse ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r016' ( temp 3X3 matrix of float) +0:412 dPdyFine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r017' ( temp 3X3 matrix of float) +0:412 degrees ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp float) +0:412 'r018' ( temp float) +0:412 determinant ( temp float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r019' ( temp 3X3 matrix of float) +0:412 exp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'R020' ( temp 3X3 matrix of float) +0:412 exp2 ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r021' ( temp 3X3 matrix of float) +0:412 Floor ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r022' ( temp 3X3 matrix of float) +0:412 mod ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r023' ( temp 3X3 matrix of float) +0:412 Fraction ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r025' ( temp 3X3 matrix of float) +0:412 fwidth ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r026' ( temp 3X3 matrix of float) +0:412 ldexp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r026a' ( temp 3X3 matrix of float) +0:412 mix ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r027' ( temp 3X3 matrix of float) +0:412 log ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r028' ( temp 3X3 matrix of float) +0:412 matrix-scale ( temp 3X3 matrix of float) +0:412 log2 ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Constant: +0:412 0.301030 +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r029' ( temp 3X3 matrix of float) +0:412 log2 ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r030' ( temp 3X3 matrix of float) +0:412 max ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r031' ( temp 3X3 matrix of float) +0:412 min ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r032' ( temp 3X3 matrix of float) +0:412 pow ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r033' ( temp 3X3 matrix of float) +0:412 radians ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r034' ( temp 3X3 matrix of float) +0:412 roundEven ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r035' ( temp 3X3 matrix of float) +0:412 inverse sqrt ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r036' ( temp 3X3 matrix of float) +0:412 clamp ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Constant: +0:412 0.000000 +0:412 Constant: +0:412 1.000000 +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r037' ( temp 3X3 matrix of float) +0:412 Sign ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r038' ( temp 3X3 matrix of float) +0:412 sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 cosine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r039' ( temp 3X3 matrix of float) +0:412 hyp. sine ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r049' ( temp 3X3 matrix of float) +0:412 smoothstep ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 'inF2' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r041' ( temp 3X3 matrix of float) +0:412 sqrt ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r042' ( temp 3X3 matrix of float) +0:412 step ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 'inF1' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r043' ( temp 3X3 matrix of float) +0:412 tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r044' ( temp 3X3 matrix of float) +0:412 hyp. tangent ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 transpose ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:412 Sequence +0:412 move second child to first child ( temp 3X3 matrix of float) +0:412 'r046' ( temp 3X3 matrix of float) +0:412 trunc ( temp 3X3 matrix of float) +0:412 'inF0' ( in 3X3 matrix of float) +0:415 Branch: Return with expression 0:? Constant: 0:? 3.000000 0:? 3.000000 @@ -4980,297 +4992,297 @@ gl_FragCoord origin is upper left 0:? 3.000000 0:? 3.000000 0:? 3.000000 -0:418 Function Definition: PixelShaderFunction4x4(mf44;mf44;mf44; ( temp 4X4 matrix of float) -0:418 Function Parameters: -0:418 'inF0' ( in 4X4 matrix of float) -0:418 'inF1' ( in 4X4 matrix of float) -0:418 'inF2' ( in 4X4 matrix of float) +0:419 Function Definition: PixelShaderFunction4x4(mf44;mf44;mf44; ( temp 4X4 matrix of float) +0:419 Function Parameters: +0:419 'inF0' ( in 4X4 matrix of float) +0:419 'inF1' ( in 4X4 matrix of float) +0:419 'inF2' ( in 4X4 matrix of float) 0:? Sequence -0:420 Sequence -0:420 move second child to first child ( temp bool) -0:420 'r000' ( temp bool) -0:420 all ( temp bool) -0:420 Convert float to bool ( temp 4X4 matrix of bool) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r001' ( temp 4X4 matrix of float) -0:420 Absolute value ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 arc cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp bool) -0:420 'r003' ( temp bool) -0:420 any ( temp bool) -0:420 Convert float to bool ( temp 4X4 matrix of bool) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r004' ( temp 4X4 matrix of float) -0:420 arc sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r005' ( temp 4X4 matrix of float) -0:420 arc tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r006' ( temp 4X4 matrix of float) -0:420 arc tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r007' ( temp 4X4 matrix of float) -0:420 Ceiling ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Test condition and select ( temp void) -0:420 Condition -0:420 any ( temp bool) -0:420 Compare Less Than ( temp 4X4 matrix of bool) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Constant: -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 0.000000 -0:420 true case -0:420 Branch: Kill -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r008' ( temp 4X4 matrix of float) -0:420 clamp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r009' ( temp 4X4 matrix of float) -0:420 cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r010' ( temp 4X4 matrix of float) -0:420 hyp. cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r011' ( temp 4X4 matrix of float) -0:420 dPdx ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r012' ( temp 4X4 matrix of float) -0:420 dPdxCoarse ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r013' ( temp 4X4 matrix of float) -0:420 dPdxFine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r014' ( temp 4X4 matrix of float) -0:420 dPdy ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r015' ( temp 4X4 matrix of float) -0:420 dPdyCoarse ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r016' ( temp 4X4 matrix of float) -0:420 dPdyFine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r017' ( temp 4X4 matrix of float) -0:420 degrees ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp float) -0:420 'r018' ( temp float) -0:420 determinant ( temp float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r019' ( temp 4X4 matrix of float) -0:420 exp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'R020' ( temp 4X4 matrix of float) -0:420 exp2 ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r021' ( temp 4X4 matrix of float) -0:420 Floor ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r022' ( temp 4X4 matrix of float) -0:420 mod ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r023' ( temp 4X4 matrix of float) -0:420 Fraction ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r025' ( temp 4X4 matrix of float) -0:420 fwidth ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r026' ( temp 4X4 matrix of float) -0:420 ldexp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r026a' ( temp 4X4 matrix of float) -0:420 mix ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r027' ( temp 4X4 matrix of float) -0:420 log ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r028' ( temp 4X4 matrix of float) -0:420 matrix-scale ( temp 4X4 matrix of float) -0:420 log2 ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Constant: -0:420 0.301030 -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r029' ( temp 4X4 matrix of float) -0:420 log2 ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r030' ( temp 4X4 matrix of float) -0:420 max ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r031' ( temp 4X4 matrix of float) -0:420 min ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r032' ( temp 4X4 matrix of float) -0:420 pow ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r033' ( temp 4X4 matrix of float) -0:420 radians ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r034' ( temp 4X4 matrix of float) -0:420 roundEven ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r035' ( temp 4X4 matrix of float) -0:420 inverse sqrt ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r036' ( temp 4X4 matrix of float) -0:420 clamp ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Constant: -0:420 0.000000 -0:420 Constant: -0:420 1.000000 -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r037' ( temp 4X4 matrix of float) -0:420 Sign ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r038' ( temp 4X4 matrix of float) -0:420 sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 cosine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r039' ( temp 4X4 matrix of float) -0:420 hyp. sine ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r049' ( temp 4X4 matrix of float) -0:420 smoothstep ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 'inF2' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r041' ( temp 4X4 matrix of float) -0:420 sqrt ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r042' ( temp 4X4 matrix of float) -0:420 step ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 'inF1' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r043' ( temp 4X4 matrix of float) -0:420 tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r044' ( temp 4X4 matrix of float) -0:420 hyp. tangent ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 transpose ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:420 Sequence -0:420 move second child to first child ( temp 4X4 matrix of float) -0:420 'r046' ( temp 4X4 matrix of float) -0:420 trunc ( temp 4X4 matrix of float) -0:420 'inF0' ( in 4X4 matrix of float) -0:423 Branch: Return with expression +0:421 Sequence +0:421 move second child to first child ( temp bool) +0:421 'r000' ( temp bool) +0:421 all ( temp bool) +0:421 Convert float to bool ( temp 4X4 matrix of bool) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r001' ( temp 4X4 matrix of float) +0:421 Absolute value ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 arc cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp bool) +0:421 'r003' ( temp bool) +0:421 any ( temp bool) +0:421 Convert float to bool ( temp 4X4 matrix of bool) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r004' ( temp 4X4 matrix of float) +0:421 arc sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r005' ( temp 4X4 matrix of float) +0:421 arc tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r006' ( temp 4X4 matrix of float) +0:421 arc tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r007' ( temp 4X4 matrix of float) +0:421 Ceiling ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Test condition and select ( temp void) +0:421 Condition +0:421 any ( temp bool) +0:421 Compare Less Than ( temp 4X4 matrix of bool) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Constant: +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 0.000000 +0:421 true case +0:421 Branch: Kill +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r008' ( temp 4X4 matrix of float) +0:421 clamp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r009' ( temp 4X4 matrix of float) +0:421 cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r010' ( temp 4X4 matrix of float) +0:421 hyp. cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r011' ( temp 4X4 matrix of float) +0:421 dPdx ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r012' ( temp 4X4 matrix of float) +0:421 dPdxCoarse ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r013' ( temp 4X4 matrix of float) +0:421 dPdxFine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r014' ( temp 4X4 matrix of float) +0:421 dPdy ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r015' ( temp 4X4 matrix of float) +0:421 dPdyCoarse ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r016' ( temp 4X4 matrix of float) +0:421 dPdyFine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r017' ( temp 4X4 matrix of float) +0:421 degrees ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp float) +0:421 'r018' ( temp float) +0:421 determinant ( temp float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r019' ( temp 4X4 matrix of float) +0:421 exp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'R020' ( temp 4X4 matrix of float) +0:421 exp2 ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r021' ( temp 4X4 matrix of float) +0:421 Floor ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r022' ( temp 4X4 matrix of float) +0:421 mod ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r023' ( temp 4X4 matrix of float) +0:421 Fraction ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r025' ( temp 4X4 matrix of float) +0:421 fwidth ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r026' ( temp 4X4 matrix of float) +0:421 ldexp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r026a' ( temp 4X4 matrix of float) +0:421 mix ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r027' ( temp 4X4 matrix of float) +0:421 log ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r028' ( temp 4X4 matrix of float) +0:421 matrix-scale ( temp 4X4 matrix of float) +0:421 log2 ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Constant: +0:421 0.301030 +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r029' ( temp 4X4 matrix of float) +0:421 log2 ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r030' ( temp 4X4 matrix of float) +0:421 max ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r031' ( temp 4X4 matrix of float) +0:421 min ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r032' ( temp 4X4 matrix of float) +0:421 pow ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r033' ( temp 4X4 matrix of float) +0:421 radians ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r034' ( temp 4X4 matrix of float) +0:421 roundEven ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r035' ( temp 4X4 matrix of float) +0:421 inverse sqrt ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r036' ( temp 4X4 matrix of float) +0:421 clamp ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Constant: +0:421 0.000000 +0:421 Constant: +0:421 1.000000 +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r037' ( temp 4X4 matrix of float) +0:421 Sign ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r038' ( temp 4X4 matrix of float) +0:421 sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 cosine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r039' ( temp 4X4 matrix of float) +0:421 hyp. sine ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r049' ( temp 4X4 matrix of float) +0:421 smoothstep ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 'inF2' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r041' ( temp 4X4 matrix of float) +0:421 sqrt ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r042' ( temp 4X4 matrix of float) +0:421 step ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 'inF1' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r043' ( temp 4X4 matrix of float) +0:421 tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r044' ( temp 4X4 matrix of float) +0:421 hyp. tangent ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 transpose ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:421 Sequence +0:421 move second child to first child ( temp 4X4 matrix of float) +0:421 'r046' ( temp 4X4 matrix of float) +0:421 trunc ( temp 4X4 matrix of float) +0:421 'inF0' ( in 4X4 matrix of float) +0:424 Branch: Return with expression 0:? Constant: 0:? 4.000000 0:? 4.000000 @@ -5288,334 +5300,334 @@ gl_FragCoord origin is upper left 0:? 4.000000 0:? 4.000000 0:? 4.000000 -0:441 Function Definition: TestGenMul2(f1;f1;vf2;vf2;mf22;mf22; ( temp void) -0:441 Function Parameters: -0:441 'inF0' ( in float) -0:441 'inF1' ( in float) -0:441 'inFV0' ( in 2-component vector of float) -0:441 'inFV1' ( in 2-component vector of float) -0:441 'inFM0' ( in 2X2 matrix of float) -0:441 'inFM1' ( in 2X2 matrix of float) +0:442 Function Definition: TestGenMul2(f1;f1;vf2;vf2;mf22;mf22; ( temp void) +0:442 Function Parameters: +0:442 'inF0' ( in float) +0:442 'inF1' ( in float) +0:442 'inFV0' ( in 2-component vector of float) +0:442 'inFV1' ( in 2-component vector of float) +0:442 'inFM0' ( in 2X2 matrix of float) +0:442 'inFM1' ( in 2X2 matrix of float) 0:? Sequence -0:442 Sequence -0:442 move second child to first child ( temp float) -0:442 'r0' ( temp float) -0:442 component-wise multiply ( temp float) -0:442 'inF1' ( in float) -0:442 'inF0' ( in float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r1' ( temp 2-component vector of float) -0:442 vector-scale ( temp 2-component vector of float) -0:442 'inF0' ( in float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r2' ( temp 2-component vector of float) -0:442 vector-scale ( temp 2-component vector of float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 'inF0' ( in float) -0:442 Sequence -0:442 move second child to first child ( temp float) -0:442 'r3' ( temp float) -0:442 dot-product ( temp float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 'inFV1' ( in 2-component vector of float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r4' ( temp 2-component vector of float) -0:442 vector-times-matrix ( temp 2-component vector of float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 Sequence -0:442 move second child to first child ( temp 2-component vector of float) -0:442 'r5' ( temp 2-component vector of float) -0:442 matrix-times-vector ( temp 2-component vector of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 'inFV0' ( in 2-component vector of float) -0:442 Sequence -0:442 move second child to first child ( temp 2X2 matrix of float) -0:442 'r6' ( temp 2X2 matrix of float) -0:442 matrix-scale ( temp 2X2 matrix of float) -0:442 'inF0' ( in float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 Sequence -0:442 move second child to first child ( temp 2X2 matrix of float) -0:442 'r7' ( temp 2X2 matrix of float) -0:442 matrix-scale ( temp 2X2 matrix of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:442 'inF0' ( in float) -0:442 Sequence -0:442 move second child to first child ( temp 2X2 matrix of float) -0:442 'r8' ( temp 2X2 matrix of float) -0:442 matrix-multiply ( temp 2X2 matrix of float) -0:442 'inFM1' ( in 2X2 matrix of float) -0:442 'inFM0' ( in 2X2 matrix of float) -0:448 Function Definition: TestGenMul3(f1;f1;vf3;vf3;mf33;mf33; ( temp void) -0:448 Function Parameters: -0:448 'inF0' ( in float) -0:448 'inF1' ( in float) -0:448 'inFV0' ( in 3-component vector of float) -0:448 'inFV1' ( in 3-component vector of float) -0:448 'inFM0' ( in 3X3 matrix of float) -0:448 'inFM1' ( in 3X3 matrix of float) +0:443 Sequence +0:443 move second child to first child ( temp float) +0:443 'r0' ( temp float) +0:443 component-wise multiply ( temp float) +0:443 'inF1' ( in float) +0:443 'inF0' ( in float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r1' ( temp 2-component vector of float) +0:443 vector-scale ( temp 2-component vector of float) +0:443 'inF0' ( in float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r2' ( temp 2-component vector of float) +0:443 vector-scale ( temp 2-component vector of float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 'inF0' ( in float) +0:443 Sequence +0:443 move second child to first child ( temp float) +0:443 'r3' ( temp float) +0:443 dot-product ( temp float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 'inFV1' ( in 2-component vector of float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r4' ( temp 2-component vector of float) +0:443 vector-times-matrix ( temp 2-component vector of float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 Sequence +0:443 move second child to first child ( temp 2-component vector of float) +0:443 'r5' ( temp 2-component vector of float) +0:443 matrix-times-vector ( temp 2-component vector of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 'inFV0' ( in 2-component vector of float) +0:443 Sequence +0:443 move second child to first child ( temp 2X2 matrix of float) +0:443 'r6' ( temp 2X2 matrix of float) +0:443 matrix-scale ( temp 2X2 matrix of float) +0:443 'inF0' ( in float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 Sequence +0:443 move second child to first child ( temp 2X2 matrix of float) +0:443 'r7' ( temp 2X2 matrix of float) +0:443 matrix-scale ( temp 2X2 matrix of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:443 'inF0' ( in float) +0:443 Sequence +0:443 move second child to first child ( temp 2X2 matrix of float) +0:443 'r8' ( temp 2X2 matrix of float) +0:443 matrix-multiply ( temp 2X2 matrix of float) +0:443 'inFM1' ( in 2X2 matrix of float) +0:443 'inFM0' ( in 2X2 matrix of float) +0:449 Function Definition: TestGenMul3(f1;f1;vf3;vf3;mf33;mf33; ( temp void) +0:449 Function Parameters: +0:449 'inF0' ( in float) +0:449 'inF1' ( in float) +0:449 'inFV0' ( in 3-component vector of float) +0:449 'inFV1' ( in 3-component vector of float) +0:449 'inFM0' ( in 3X3 matrix of float) +0:449 'inFM1' ( in 3X3 matrix of float) 0:? Sequence -0:449 Sequence -0:449 move second child to first child ( temp float) -0:449 'r0' ( temp float) -0:449 component-wise multiply ( temp float) -0:449 'inF1' ( in float) -0:449 'inF0' ( in float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r1' ( temp 3-component vector of float) -0:449 vector-scale ( temp 3-component vector of float) -0:449 'inF0' ( in float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r2' ( temp 3-component vector of float) -0:449 vector-scale ( temp 3-component vector of float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 'inF0' ( in float) -0:449 Sequence -0:449 move second child to first child ( temp float) -0:449 'r3' ( temp float) -0:449 dot-product ( temp float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 'inFV1' ( in 3-component vector of float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r4' ( temp 3-component vector of float) -0:449 vector-times-matrix ( temp 3-component vector of float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 Sequence -0:449 move second child to first child ( temp 3-component vector of float) -0:449 'r5' ( temp 3-component vector of float) -0:449 matrix-times-vector ( temp 3-component vector of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 'inFV0' ( in 3-component vector of float) -0:449 Sequence -0:449 move second child to first child ( temp 3X3 matrix of float) -0:449 'r6' ( temp 3X3 matrix of float) -0:449 matrix-scale ( temp 3X3 matrix of float) -0:449 'inF0' ( in float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 Sequence -0:449 move second child to first child ( temp 3X3 matrix of float) -0:449 'r7' ( temp 3X3 matrix of float) -0:449 matrix-scale ( temp 3X3 matrix of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:449 'inF0' ( in float) -0:449 Sequence -0:449 move second child to first child ( temp 3X3 matrix of float) -0:449 'r8' ( temp 3X3 matrix of float) -0:449 matrix-multiply ( temp 3X3 matrix of float) -0:449 'inFM1' ( in 3X3 matrix of float) -0:449 'inFM0' ( in 3X3 matrix of float) -0:455 Function Definition: TestGenMul4(f1;f1;vf4;vf4;mf44;mf44; ( temp void) -0:455 Function Parameters: -0:455 'inF0' ( in float) -0:455 'inF1' ( in float) -0:455 'inFV0' ( in 4-component vector of float) -0:455 'inFV1' ( in 4-component vector of float) -0:455 'inFM0' ( in 4X4 matrix of float) -0:455 'inFM1' ( in 4X4 matrix of float) +0:450 Sequence +0:450 move second child to first child ( temp float) +0:450 'r0' ( temp float) +0:450 component-wise multiply ( temp float) +0:450 'inF1' ( in float) +0:450 'inF0' ( in float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r1' ( temp 3-component vector of float) +0:450 vector-scale ( temp 3-component vector of float) +0:450 'inF0' ( in float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r2' ( temp 3-component vector of float) +0:450 vector-scale ( temp 3-component vector of float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 'inF0' ( in float) +0:450 Sequence +0:450 move second child to first child ( temp float) +0:450 'r3' ( temp float) +0:450 dot-product ( temp float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 'inFV1' ( in 3-component vector of float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r4' ( temp 3-component vector of float) +0:450 vector-times-matrix ( temp 3-component vector of float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 Sequence +0:450 move second child to first child ( temp 3-component vector of float) +0:450 'r5' ( temp 3-component vector of float) +0:450 matrix-times-vector ( temp 3-component vector of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 'inFV0' ( in 3-component vector of float) +0:450 Sequence +0:450 move second child to first child ( temp 3X3 matrix of float) +0:450 'r6' ( temp 3X3 matrix of float) +0:450 matrix-scale ( temp 3X3 matrix of float) +0:450 'inF0' ( in float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 Sequence +0:450 move second child to first child ( temp 3X3 matrix of float) +0:450 'r7' ( temp 3X3 matrix of float) +0:450 matrix-scale ( temp 3X3 matrix of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:450 'inF0' ( in float) +0:450 Sequence +0:450 move second child to first child ( temp 3X3 matrix of float) +0:450 'r8' ( temp 3X3 matrix of float) +0:450 matrix-multiply ( temp 3X3 matrix of float) +0:450 'inFM1' ( in 3X3 matrix of float) +0:450 'inFM0' ( in 3X3 matrix of float) +0:456 Function Definition: TestGenMul4(f1;f1;vf4;vf4;mf44;mf44; ( temp void) +0:456 Function Parameters: +0:456 'inF0' ( in float) +0:456 'inF1' ( in float) +0:456 'inFV0' ( in 4-component vector of float) +0:456 'inFV1' ( in 4-component vector of float) +0:456 'inFM0' ( in 4X4 matrix of float) +0:456 'inFM1' ( in 4X4 matrix of float) 0:? Sequence -0:456 Sequence -0:456 move second child to first child ( temp float) -0:456 'r0' ( temp float) -0:456 component-wise multiply ( temp float) -0:456 'inF1' ( in float) -0:456 'inF0' ( in float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r1' ( temp 4-component vector of float) -0:456 vector-scale ( temp 4-component vector of float) -0:456 'inF0' ( in float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r2' ( temp 4-component vector of float) -0:456 vector-scale ( temp 4-component vector of float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 'inF0' ( in float) -0:456 Sequence -0:456 move second child to first child ( temp float) -0:456 'r3' ( temp float) -0:456 dot-product ( temp float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 'inFV1' ( in 4-component vector of float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r4' ( temp 4-component vector of float) -0:456 vector-times-matrix ( temp 4-component vector of float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 Sequence -0:456 move second child to first child ( temp 4-component vector of float) -0:456 'r5' ( temp 4-component vector of float) -0:456 matrix-times-vector ( temp 4-component vector of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 'inFV0' ( in 4-component vector of float) -0:456 Sequence -0:456 move second child to first child ( temp 4X4 matrix of float) -0:456 'r6' ( temp 4X4 matrix of float) -0:456 matrix-scale ( temp 4X4 matrix of float) -0:456 'inF0' ( in float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 Sequence -0:456 move second child to first child ( temp 4X4 matrix of float) -0:456 'r7' ( temp 4X4 matrix of float) -0:456 matrix-scale ( temp 4X4 matrix of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:456 'inF0' ( in float) -0:456 Sequence -0:456 move second child to first child ( temp 4X4 matrix of float) -0:456 'r8' ( temp 4X4 matrix of float) -0:456 matrix-multiply ( temp 4X4 matrix of float) -0:456 'inFM1' ( in 4X4 matrix of float) -0:456 'inFM0' ( in 4X4 matrix of float) -0:465 Function Definition: TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24; ( temp void) -0:465 Function Parameters: -0:465 'inF0' ( in float) -0:465 'inF1' ( in float) -0:465 'inFV2' ( in 2-component vector of float) -0:465 'inFV3' ( in 3-component vector of float) -0:465 'inFM2x3' ( in 2X3 matrix of float) -0:465 'inFM3x2' ( in 3X2 matrix of float) -0:465 'inFM3x3' ( in 3X3 matrix of float) -0:465 'inFM3x4' ( in 3X4 matrix of float) -0:465 'inFM2x4' ( in 2X4 matrix of float) +0:457 Sequence +0:457 move second child to first child ( temp float) +0:457 'r0' ( temp float) +0:457 component-wise multiply ( temp float) +0:457 'inF1' ( in float) +0:457 'inF0' ( in float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r1' ( temp 4-component vector of float) +0:457 vector-scale ( temp 4-component vector of float) +0:457 'inF0' ( in float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r2' ( temp 4-component vector of float) +0:457 vector-scale ( temp 4-component vector of float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 'inF0' ( in float) +0:457 Sequence +0:457 move second child to first child ( temp float) +0:457 'r3' ( temp float) +0:457 dot-product ( temp float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 'inFV1' ( in 4-component vector of float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r4' ( temp 4-component vector of float) +0:457 vector-times-matrix ( temp 4-component vector of float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 Sequence +0:457 move second child to first child ( temp 4-component vector of float) +0:457 'r5' ( temp 4-component vector of float) +0:457 matrix-times-vector ( temp 4-component vector of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 'inFV0' ( in 4-component vector of float) +0:457 Sequence +0:457 move second child to first child ( temp 4X4 matrix of float) +0:457 'r6' ( temp 4X4 matrix of float) +0:457 matrix-scale ( temp 4X4 matrix of float) +0:457 'inF0' ( in float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 Sequence +0:457 move second child to first child ( temp 4X4 matrix of float) +0:457 'r7' ( temp 4X4 matrix of float) +0:457 matrix-scale ( temp 4X4 matrix of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:457 'inF0' ( in float) +0:457 Sequence +0:457 move second child to first child ( temp 4X4 matrix of float) +0:457 'r8' ( temp 4X4 matrix of float) +0:457 matrix-multiply ( temp 4X4 matrix of float) +0:457 'inFM1' ( in 4X4 matrix of float) +0:457 'inFM0' ( in 4X4 matrix of float) +0:466 Function Definition: TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24; ( temp void) +0:466 Function Parameters: +0:466 'inF0' ( in float) +0:466 'inF1' ( in float) +0:466 'inFV2' ( in 2-component vector of float) +0:466 'inFV3' ( in 3-component vector of float) +0:466 'inFM2x3' ( in 2X3 matrix of float) +0:466 'inFM3x2' ( in 3X2 matrix of float) +0:466 'inFM3x3' ( in 3X3 matrix of float) +0:466 'inFM3x4' ( in 3X4 matrix of float) +0:466 'inFM2x4' ( in 2X4 matrix of float) 0:? Sequence -0:466 Sequence -0:466 move second child to first child ( temp float) -0:466 'r00' ( temp float) -0:466 component-wise multiply ( temp float) -0:466 'inF1' ( in float) -0:466 'inF0' ( in float) 0:467 Sequence -0:467 move second child to first child ( temp 2-component vector of float) -0:467 'r01' ( temp 2-component vector of float) -0:467 vector-scale ( temp 2-component vector of float) +0:467 move second child to first child ( temp float) +0:467 'r00' ( temp float) +0:467 component-wise multiply ( temp float) +0:467 'inF1' ( in float) 0:467 'inF0' ( in float) -0:467 'inFV2' ( in 2-component vector of float) 0:468 Sequence -0:468 move second child to first child ( temp 3-component vector of float) -0:468 'r02' ( temp 3-component vector of float) -0:468 vector-scale ( temp 3-component vector of float) +0:468 move second child to first child ( temp 2-component vector of float) +0:468 'r01' ( temp 2-component vector of float) +0:468 vector-scale ( temp 2-component vector of float) 0:468 'inF0' ( in float) -0:468 'inFV3' ( in 3-component vector of float) +0:468 'inFV2' ( in 2-component vector of float) 0:469 Sequence -0:469 move second child to first child ( temp 2-component vector of float) -0:469 'r03' ( temp 2-component vector of float) -0:469 vector-scale ( temp 2-component vector of float) -0:469 'inFV2' ( in 2-component vector of float) +0:469 move second child to first child ( temp 3-component vector of float) +0:469 'r02' ( temp 3-component vector of float) +0:469 vector-scale ( temp 3-component vector of float) 0:469 'inF0' ( in float) +0:469 'inFV3' ( in 3-component vector of float) 0:470 Sequence -0:470 move second child to first child ( temp 3-component vector of float) -0:470 'r04' ( temp 3-component vector of float) -0:470 vector-scale ( temp 3-component vector of float) -0:470 'inFV3' ( in 3-component vector of float) +0:470 move second child to first child ( temp 2-component vector of float) +0:470 'r03' ( temp 2-component vector of float) +0:470 vector-scale ( temp 2-component vector of float) +0:470 'inFV2' ( in 2-component vector of float) 0:470 'inF0' ( in float) 0:471 Sequence -0:471 move second child to first child ( temp float) -0:471 'r05' ( temp float) -0:471 dot-product ( temp float) -0:471 'inFV2' ( in 2-component vector of float) -0:471 'inFV2' ( in 2-component vector of float) +0:471 move second child to first child ( temp 3-component vector of float) +0:471 'r04' ( temp 3-component vector of float) +0:471 vector-scale ( temp 3-component vector of float) +0:471 'inFV3' ( in 3-component vector of float) +0:471 'inF0' ( in float) 0:472 Sequence 0:472 move second child to first child ( temp float) -0:472 'r06' ( temp float) +0:472 'r05' ( temp float) 0:472 dot-product ( temp float) -0:472 'inFV3' ( in 3-component vector of float) -0:472 'inFV3' ( in 3-component vector of float) +0:472 'inFV2' ( in 2-component vector of float) +0:472 'inFV2' ( in 2-component vector of float) 0:473 Sequence -0:473 move second child to first child ( temp 3-component vector of float) -0:473 'r07' ( temp 3-component vector of float) -0:473 matrix-times-vector ( temp 3-component vector of float) -0:473 'inFM2x3' ( in 2X3 matrix of float) -0:473 'inFV2' ( in 2-component vector of float) +0:473 move second child to first child ( temp float) +0:473 'r06' ( temp float) +0:473 dot-product ( temp float) +0:473 'inFV3' ( in 3-component vector of float) +0:473 'inFV3' ( in 3-component vector of float) 0:474 Sequence -0:474 move second child to first child ( temp 2-component vector of float) -0:474 'r08' ( temp 2-component vector of float) -0:474 matrix-times-vector ( temp 2-component vector of float) -0:474 'inFM3x2' ( in 3X2 matrix of float) -0:474 'inFV3' ( in 3-component vector of float) +0:474 move second child to first child ( temp 3-component vector of float) +0:474 'r07' ( temp 3-component vector of float) +0:474 matrix-times-vector ( temp 3-component vector of float) +0:474 'inFM2x3' ( in 2X3 matrix of float) +0:474 'inFV2' ( in 2-component vector of float) 0:475 Sequence 0:475 move second child to first child ( temp 2-component vector of float) -0:475 'r09' ( temp 2-component vector of float) -0:475 vector-times-matrix ( temp 2-component vector of float) +0:475 'r08' ( temp 2-component vector of float) +0:475 matrix-times-vector ( temp 2-component vector of float) +0:475 'inFM3x2' ( in 3X2 matrix of float) 0:475 'inFV3' ( in 3-component vector of float) -0:475 'inFM2x3' ( in 2X3 matrix of float) 0:476 Sequence -0:476 move second child to first child ( temp 3-component vector of float) -0:476 'r10' ( temp 3-component vector of float) -0:476 vector-times-matrix ( temp 3-component vector of float) -0:476 'inFV2' ( in 2-component vector of float) -0:476 'inFM3x2' ( in 3X2 matrix of float) +0:476 move second child to first child ( temp 2-component vector of float) +0:476 'r09' ( temp 2-component vector of float) +0:476 vector-times-matrix ( temp 2-component vector of float) +0:476 'inFV3' ( in 3-component vector of float) +0:476 'inFM2x3' ( in 2X3 matrix of float) 0:477 Sequence -0:477 move second child to first child ( temp 2X3 matrix of float) -0:477 'r11' ( temp 2X3 matrix of float) -0:477 matrix-scale ( temp 2X3 matrix of float) -0:477 'inF0' ( in float) -0:477 'inFM2x3' ( in 2X3 matrix of float) +0:477 move second child to first child ( temp 3-component vector of float) +0:477 'r10' ( temp 3-component vector of float) +0:477 vector-times-matrix ( temp 3-component vector of float) +0:477 'inFV2' ( in 2-component vector of float) +0:477 'inFM3x2' ( in 3X2 matrix of float) 0:478 Sequence -0:478 move second child to first child ( temp 3X2 matrix of float) -0:478 'r12' ( temp 3X2 matrix of float) -0:478 matrix-scale ( temp 3X2 matrix of float) +0:478 move second child to first child ( temp 2X3 matrix of float) +0:478 'r11' ( temp 2X3 matrix of float) +0:478 matrix-scale ( temp 2X3 matrix of float) 0:478 'inF0' ( in float) -0:478 'inFM3x2' ( in 3X2 matrix of float) +0:478 'inFM2x3' ( in 2X3 matrix of float) 0:479 Sequence -0:479 move second child to first child ( temp 2X2 matrix of float) -0:479 'r13' ( temp 2X2 matrix of float) -0:479 matrix-multiply ( temp 2X2 matrix of float) +0:479 move second child to first child ( temp 3X2 matrix of float) +0:479 'r12' ( temp 3X2 matrix of float) +0:479 matrix-scale ( temp 3X2 matrix of float) +0:479 'inF0' ( in float) 0:479 'inFM3x2' ( in 3X2 matrix of float) -0:479 'inFM2x3' ( in 2X3 matrix of float) 0:480 Sequence -0:480 move second child to first child ( temp 2X3 matrix of float) -0:480 'r14' ( temp 2X3 matrix of float) -0:480 matrix-multiply ( temp 2X3 matrix of float) -0:480 'inFM3x3' ( in 3X3 matrix of float) +0:480 move second child to first child ( temp 2X2 matrix of float) +0:480 'r13' ( temp 2X2 matrix of float) +0:480 matrix-multiply ( temp 2X2 matrix of float) +0:480 'inFM3x2' ( in 3X2 matrix of float) 0:480 'inFM2x3' ( in 2X3 matrix of float) 0:481 Sequence -0:481 move second child to first child ( temp 2X4 matrix of float) -0:481 'r15' ( temp 2X4 matrix of float) -0:481 matrix-multiply ( temp 2X4 matrix of float) -0:481 'inFM3x4' ( in 3X4 matrix of float) +0:481 move second child to first child ( temp 2X3 matrix of float) +0:481 'r14' ( temp 2X3 matrix of float) +0:481 matrix-multiply ( temp 2X3 matrix of float) +0:481 'inFM3x3' ( in 3X3 matrix of float) 0:481 'inFM2x3' ( in 2X3 matrix of float) 0:482 Sequence -0:482 move second child to first child ( temp 3X4 matrix of float) -0:482 'r16' ( temp 3X4 matrix of float) -0:482 matrix-multiply ( temp 3X4 matrix of float) -0:482 'inFM2x4' ( in 2X4 matrix of float) -0:482 'inFM3x2' ( in 3X2 matrix of float) -0:488 Function Definition: @main( ( temp structure{ temp 4-component vector of float color}) -0:488 Function Parameters: +0:482 move second child to first child ( temp 2X4 matrix of float) +0:482 'r15' ( temp 2X4 matrix of float) +0:482 matrix-multiply ( temp 2X4 matrix of float) +0:482 'inFM3x4' ( in 3X4 matrix of float) +0:482 'inFM2x3' ( in 2X3 matrix of float) +0:483 Sequence +0:483 move second child to first child ( temp 3X4 matrix of float) +0:483 'r16' ( temp 3X4 matrix of float) +0:483 matrix-multiply ( temp 3X4 matrix of float) +0:483 'inFM2x4' ( in 2X4 matrix of float) +0:483 'inFM3x2' ( in 3X2 matrix of float) +0:489 Function Definition: @main( ( temp structure{ temp 4-component vector of float color}) +0:489 Function Parameters: 0:? Sequence -0:490 move second child to first child ( temp 4-component vector of float) -0:490 color: direct index for structure ( temp 4-component vector of float) -0:490 'ps_output' ( temp structure{ temp 4-component vector of float color}) -0:490 Constant: -0:490 0 (const int) -0:490 Constant: -0:490 1.000000 -0:490 1.000000 -0:490 1.000000 -0:490 1.000000 -0:491 Branch: Return with expression -0:491 'ps_output' ( temp structure{ temp 4-component vector of float color}) -0:488 Function Definition: main( ( temp void) -0:488 Function Parameters: +0:491 move second child to first child ( temp 4-component vector of float) +0:491 color: direct index for structure ( temp 4-component vector of float) +0:491 'ps_output' ( temp structure{ temp 4-component vector of float color}) +0:491 Constant: +0:491 0 (const int) +0:491 Constant: +0:491 1.000000 +0:491 1.000000 +0:491 1.000000 +0:491 1.000000 +0:492 Branch: Return with expression +0:492 'ps_output' ( temp structure{ temp 4-component vector of float color}) +0:489 Function Definition: main( ( temp void) +0:489 Function Parameters: 0:? Sequence -0:488 Sequence -0:488 move second child to first child ( temp 4-component vector of float) +0:489 Sequence +0:489 move second child to first child ( temp 4-component vector of float) 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) -0:488 color: direct index for structure ( temp 4-component vector of float) -0:488 Function Call: @main( ( temp structure{ temp 4-component vector of float color}) -0:488 Constant: -0:488 0 (const int) +0:489 color: direct index for structure ( temp 4-component vector of float) +0:489 Function Call: @main( ( temp structure{ temp 4-component vector of float color}) +0:489 Constant: +0:489 0 (const int) 0:? Linker Objects 0:? 'gs_ua' ( shared uint) 0:? 'gs_ub' ( shared uint) @@ -5631,97 +5643,101 @@ gl_FragCoord origin is upper left 0:? 'gs_uc4' ( shared 4-component vector of uint) 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Matrix types can only be parameterized with floating-point types. + %mat2v2bool = OpTypeMatrix %v2bool 2 + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 1832 +// Generated by (magic number): 80007 +// Id's are bound by 1836 Capability Shader Capability DerivativeControl 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 1813 + EntryPoint Fragment 4 "main" 1817 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" - Name 16 "PixelShaderFunctionS(f1;f1;f1;u1;u1;" - Name 11 "inF0" - Name 12 "inF1" - Name 13 "inF2" - Name 14 "inU0" - Name 15 "inU1" - Name 22 "PixelShaderFunction1(vf1;vf1;vf1;" - Name 19 "inF0" - Name 20 "inF1" - Name 21 "inF2" - Name 34 "PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2;" - Name 29 "inF0" - Name 30 "inF1" - Name 31 "inF2" - Name 32 "inU0" - Name 33 "inU1" - Name 46 "PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3;" - Name 41 "inF0" - Name 42 "inF1" - Name 43 "inF2" - Name 44 "inU0" - Name 45 "inU1" - Name 58 "PixelShaderFunction(vf4;vf4;vf4;vu4;vu4;" - Name 53 "inF0" - Name 54 "inF1" - Name 55 "inF2" - Name 56 "inU0" - Name 57 "inU1" - Name 66 "PixelShaderFunction2x2(mf22;mf22;mf22;" - Name 63 "inF0" - Name 64 "inF1" - Name 65 "inF2" - Name 74 "PixelShaderFunction3x3(mf33;mf33;mf33;" - Name 71 "inF0" - Name 72 "inF1" - Name 73 "inF2" - Name 82 "PixelShaderFunction4x4(mf44;mf44;mf44;" - Name 79 "inF0" - Name 80 "inF1" - Name 81 "inF2" - Name 91 "TestGenMul2(f1;f1;vf2;vf2;mf22;mf22;" - Name 85 "inF0" - Name 86 "inF1" - Name 87 "inFV0" - Name 88 "inFV1" - Name 89 "inFM0" - Name 90 "inFM1" - Name 100 "TestGenMul3(f1;f1;vf3;vf3;mf33;mf33;" - Name 94 "inF0" - Name 95 "inF1" - Name 96 "inFV0" - Name 97 "inFV1" - Name 98 "inFM0" - Name 99 "inFM1" - Name 109 "TestGenMul4(f1;f1;vf4;vf4;mf44;mf44;" - Name 103 "inF0" - Name 104 "inF1" - Name 105 "inFV0" - Name 106 "inFV1" - Name 107 "inFM0" - Name 108 "inFM1" - Name 129 "TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24;" - Name 120 "inF0" - Name 121 "inF1" - Name 122 "inFV2" - Name 123 "inFV3" - Name 124 "inFM2x3" - Name 125 "inFM3x2" - Name 126 "inFM3x3" - Name 127 "inFM3x4" - Name 128 "inFM2x4" - Name 131 "PS_OUTPUT" - MemberName 131(PS_OUTPUT) 0 "color" - Name 133 "@main(" - Name 137 "r000" - Name 142 "r001" - Name 145 "r002" - Name 148 "r003" - Name 152 "r004" + Name 18 "PixelShaderFunctionS(f1;f1;f1;u1;i1;" + Name 13 "inF0" + Name 14 "inF1" + Name 15 "inF2" + Name 16 "inU0" + Name 17 "inU1" + Name 24 "PixelShaderFunction1(vf1;vf1;vf1;" + Name 21 "inF0" + Name 22 "inF1" + Name 23 "inF2" + Name 36 "PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2;" + Name 31 "inF0" + Name 32 "inF1" + Name 33 "inF2" + Name 34 "inU0" + Name 35 "inU1" + Name 48 "PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3;" + Name 43 "inF0" + Name 44 "inF1" + Name 45 "inF2" + Name 46 "inU0" + Name 47 "inU1" + Name 60 "PixelShaderFunction(vf4;vf4;vf4;vu4;vu4;" + Name 55 "inF0" + Name 56 "inF1" + Name 57 "inF2" + Name 58 "inU0" + Name 59 "inU1" + Name 68 "PixelShaderFunction2x2(mf22;mf22;mf22;" + Name 65 "inF0" + Name 66 "inF1" + Name 67 "inF2" + Name 76 "PixelShaderFunction3x3(mf33;mf33;mf33;" + Name 73 "inF0" + Name 74 "inF1" + Name 75 "inF2" + Name 84 "PixelShaderFunction4x4(mf44;mf44;mf44;" + Name 81 "inF0" + Name 82 "inF1" + Name 83 "inF2" + Name 93 "TestGenMul2(f1;f1;vf2;vf2;mf22;mf22;" + Name 87 "inF0" + Name 88 "inF1" + Name 89 "inFV0" + Name 90 "inFV1" + Name 91 "inFM0" + Name 92 "inFM1" + Name 102 "TestGenMul3(f1;f1;vf3;vf3;mf33;mf33;" + Name 96 "inF0" + Name 97 "inF1" + Name 98 "inFV0" + Name 99 "inFV1" + Name 100 "inFM0" + Name 101 "inFM1" + Name 111 "TestGenMul4(f1;f1;vf4;vf4;mf44;mf44;" + Name 105 "inF0" + Name 106 "inF1" + Name 107 "inFV0" + Name 108 "inFV1" + Name 109 "inFM0" + Name 110 "inFM1" + Name 131 "TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24;" + Name 122 "inF0" + Name 123 "inF1" + Name 124 "inFV2" + Name 125 "inFV3" + Name 126 "inFM2x3" + Name 127 "inFM3x2" + Name 128 "inFM3x3" + Name 129 "inFM3x4" + Name 130 "inFM2x4" + Name 133 "PS_OUTPUT" + MemberName 133(PS_OUTPUT) 0 "color" + Name 135 "@main(" + Name 139 "r000" + Name 144 "r001" + Name 147 "r002" + Name 150 "r003" + Name 154 "r004" Name 157 "r005" Name 160 "r006" Name 163 "r007" @@ -5739,575 +5755,576 @@ gl_FragCoord origin is upper left Name 213 "r021" Name 216 "r022" Name 219 "r023" - Name 222 "r027" - Name 225 "r028" - Name 228 "r029" - Name 231 "r030" - Name 234 "r031" - Name 237 "r033" - Name 241 "r034" - Name 244 "r036" - Name 247 "r037" - Name 250 "r038" - Name 253 "r039" - Name 257 "r039a" - Name 262 "r040" - Name 265 "r041" - Name 270 "r042" - Name 273 "r043" - Name 277 "r044" - Name 281 "r045" - Name 285 "r046" - Name 288 "r047" - Name 292 "r048" - Name 296 "r049" - Name 299 "r050" - Name 302 "r051" - Name 305 "r052" - Name 308 "r053" - Name 315 "r055" - Name 318 "r056" - Name 323 "r057" - Name 326 "r058" - Name 330 "r059" - Name 333 "r060" - Name 336 "r061" - Name 343 "r000" - Name 349 "r001" - Name 352 "r002" - Name 355 "r003" - Name 359 "r004" - Name 364 "r005" - Name 367 "r006" - Name 370 "r007" - Name 373 "r009" - Name 376 "r010" - Name 380 "r011" - Name 383 "r012" - Name 402 "r013" - Name 405 "r015" - Name 408 "r016" - Name 412 "r017" - Name 415 "r018" - Name 418 "r019" - Name 421 "r020" - Name 424 "r021" - Name 427 "r022" - Name 430 "r023" - Name 433 "r026" - Name 437 "r027" - Name 441 "r028" - Name 444 "r029" - Name 447 "r030" - Name 452 "r031" - Name 457 "r032" - Name 459 "r033" - Name 462 "r035" - Name 466 "r036" - Name 469 "r038" - Name 473 "r039" - Name 476 "r040" - Name 479 "r041" - Name 483 "r039a" - Name 488 "r042" - Name 491 "r043" - Name 494 "r044" - Name 498 "r045" - Name 501 "r046" - Name 505 "r047" - Name 509 "r048" - Name 512 "r049" - Name 516 "r050" - Name 519 "r051" - Name 523 "r052" - Name 527 "r053" - Name 532 "r054" - Name 537 "r055" - Name 540 "r056" - Name 543 "r057" - Name 548 "r058" - Name 551 "r059" - Name 558 "r060" - Name 561 "r061" - Name 566 "r062" - Name 569 "r063" - Name 573 "r064" - Name 576 "r065" - Name 579 "r066" - Name 585 "r000" - Name 591 "r001" - Name 594 "r002" - Name 597 "r003" - Name 601 "r004" - Name 606 "r005" - Name 609 "r006" - Name 612 "r007" - Name 615 "r009" - Name 618 "r010" - Name 622 "r011" - Name 625 "r012" - Name 643 "r013" - Name 646 "r014" - Name 649 "r015" - Name 654 "r016" - Name 658 "r017" - Name 661 "r018" - Name 664 "r019" - Name 667 "r020" - Name 670 "r021" - Name 673 "r022" - Name 676 "r023" - Name 679 "r024" - Name 683 "r025" - Name 687 "r029" - Name 690 "r030" - Name 693 "r031" - Name 698 "r032" - Name 702 "r033" - Name 704 "r034" - Name 707 "r036" - Name 711 "r037" - Name 714 "r039" - Name 718 "r040" - Name 721 "r041" - Name 724 "r042" - Name 728 "r039a" - Name 733 "r039b" - Name 739 "r043" - Name 742 "r044" - Name 745 "r045" - Name 749 "r046" - Name 752 "r047" - Name 756 "r048" - Name 760 "r049" - Name 763 "r050" - Name 767 "r051" - Name 770 "r052" - Name 774 "r053" - Name 778 "r054" - Name 782 "r055" - Name 785 "r056" - Name 788 "r057" - Name 791 "r058" - Name 796 "r059" - Name 799 "r060" - Name 806 "r061" - Name 809 "r062" - Name 814 "r063" - Name 817 "r064" - Name 821 "r065" - Name 824 "r066" - Name 827 "r067" - Name 834 "r000" - Name 840 "r001" - Name 843 "r002" - Name 846 "r003" - Name 850 "r004" - Name 855 "r005" - Name 858 "r006" - Name 861 "r007" - Name 864 "r009" - Name 867 "r010" - Name 871 "r011" - Name 874 "r012" - Name 892 "r013" - Name 895 "r014" - Name 898 "r015" - Name 901 "r016" - Name 904 "r017" - Name 907 "r018" - Name 910 "r019" - Name 913 "r020" - Name 916 "r021" - Name 919 "r022" - Name 922 "r023" - Name 926 "r024" - Name 930 "r025" - Name 941 "r029" - Name 944 "r030" - Name 947 "r031" - Name 952 "r032" - Name 957 "r033" - Name 959 "r034" - Name 962 "r036" - Name 966 "r037" - Name 969 "r039" - Name 973 "r040" - Name 976 "r041" - Name 979 "r042" - Name 983 "r039a" - Name 988 "r043" - Name 991 "r044" - Name 994 "r045" - Name 998 "r046" - Name 1001 "r047" - Name 1005 "r048" - Name 1009 "r049" - Name 1012 "r050" - Name 1016 "r051" - Name 1019 "r052" - Name 1023 "r053" - Name 1027 "r054" - Name 1031 "r055" - Name 1034 "r056" - Name 1037 "r057" - Name 1040 "r058" - Name 1045 "r059" - Name 1048 "r060" - Name 1055 "r061" - Name 1058 "r062" - Name 1063 "r063" - Name 1066 "r064" - Name 1070 "r065" - Name 1073 "r066" - Name 1076 "r067" - Name 1083 "r000" - Name 1088 "r001" - Name 1093 "r003" - Name 1097 "r004" - Name 1100 "r005" - Name 1103 "r006" - Name 1107 "r007" - Name 1117 "r008" - Name 1122 "r009" - Name 1125 "r010" - Name 1128 "r011" - Name 1131 "r012" - Name 1134 "r013" - Name 1137 "r014" - Name 1140 "r015" - Name 1143 "r016" - Name 1146 "r017" - Name 1149 "r018" - Name 1152 "r019" - Name 1155 "R020" - Name 1158 "r021" - Name 1161 "r022" - Name 1171 "r023" - Name 1174 "r025" - Name 1177 "r026" - Name 1181 "r026a" - Name 1186 "r027" - Name 1189 "r028" - Name 1193 "r029" - Name 1196 "r030" - Name 1200 "r031" - Name 1204 "r032" - Name 1208 "r033" - Name 1211 "r034" - Name 1214 "r035" - Name 1217 "r036" - Name 1222 "r037" - Name 1225 "r038" - Name 1232 "r039" - Name 1235 "r049" - Name 1240 "r041" - Name 1243 "r042" - Name 1247 "r043" - Name 1250 "r044" - Name 1255 "r046" - Name 1262 "r000" - Name 1267 "r001" - Name 1272 "r003" - Name 1276 "r004" - Name 1279 "r005" - Name 1282 "r006" - Name 1286 "r007" - Name 1296 "r008" - Name 1301 "r009" - Name 1304 "r010" - Name 1307 "r011" - Name 1310 "r012" - Name 1313 "r013" - Name 1316 "r014" - Name 1319 "r015" - Name 1322 "r016" - Name 1325 "r017" - Name 1328 "r018" - Name 1331 "r019" - Name 1334 "R020" - Name 1337 "r021" - Name 1340 "r022" - Name 1353 "r023" - Name 1356 "r025" - Name 1359 "r026" - Name 1363 "r026a" - Name 1368 "r027" - Name 1371 "r028" - Name 1375 "r029" - Name 1378 "r030" - Name 1382 "r031" - Name 1386 "r032" - Name 1390 "r033" - Name 1393 "r034" - Name 1396 "r035" - Name 1399 "r036" - Name 1404 "r037" - Name 1407 "r038" - Name 1414 "r039" - Name 1417 "r049" - Name 1422 "r041" - Name 1425 "r042" - Name 1429 "r043" - Name 1432 "r044" - Name 1437 "r046" - Name 1444 "r000" - Name 1449 "r001" - Name 1454 "r003" - Name 1458 "r004" - Name 1461 "r005" - Name 1464 "r006" - Name 1468 "r007" - Name 1478 "r008" - Name 1483 "r009" - Name 1486 "r010" - Name 1489 "r011" - Name 1492 "r012" - Name 1495 "r013" - Name 1498 "r014" - Name 1501 "r015" - Name 1504 "r016" - Name 1507 "r017" - Name 1510 "r018" - Name 1513 "r019" - Name 1516 "R020" - Name 1519 "r021" - Name 1522 "r022" - Name 1538 "r023" - Name 1541 "r025" - Name 1544 "r026" - Name 1548 "r026a" - Name 1553 "r027" - Name 1556 "r028" - Name 1560 "r029" - Name 1563 "r030" - Name 1567 "r031" - Name 1571 "r032" - Name 1575 "r033" - Name 1578 "r034" - Name 1581 "r035" - Name 1584 "r036" - Name 1589 "r037" - Name 1592 "r038" - Name 1599 "r039" - Name 1602 "r049" - Name 1607 "r041" - Name 1610 "r042" - Name 1614 "r043" - Name 1617 "r044" - Name 1622 "r046" - Name 1629 "r0" - Name 1633 "r1" - Name 1637 "r2" - Name 1641 "r3" - Name 1645 "r4" - Name 1649 "r5" - Name 1653 "r6" - Name 1657 "r7" - Name 1661 "r8" - Name 1665 "r0" - Name 1669 "r1" - Name 1673 "r2" - Name 1677 "r3" - Name 1681 "r4" - Name 1685 "r5" - Name 1689 "r6" - Name 1693 "r7" - Name 1697 "r8" - Name 1701 "r0" - Name 1705 "r1" - Name 1709 "r2" - Name 1713 "r3" - Name 1717 "r4" - Name 1721 "r5" - Name 1725 "r6" - Name 1729 "r7" - Name 1733 "r8" - Name 1737 "r00" - Name 1741 "r01" - Name 1745 "r02" - Name 1749 "r03" - Name 1753 "r04" - Name 1757 "r05" - Name 1761 "r06" - Name 1765 "r07" - Name 1769 "r08" - Name 1773 "r09" - Name 1777 "r10" - Name 1781 "r11" - Name 1785 "r12" - Name 1789 "r13" - Name 1793 "r14" - Name 1797 "r15" - Name 1801 "r16" - Name 1806 "ps_output" - Name 1813 "@entryPointOutput.color" - Name 1817 "gs_ua" - Name 1818 "gs_ub" - Name 1819 "gs_uc" - Name 1821 "gs_ua2" - Name 1822 "gs_ub2" - Name 1823 "gs_uc2" - Name 1825 "gs_ua3" - Name 1826 "gs_ub3" - Name 1827 "gs_uc3" - Name 1829 "gs_ua4" - Name 1830 "gs_ub4" - Name 1831 "gs_uc4" - Decorate 1813(@entryPointOutput.color) Location 0 + Name 222 "r024" + Name 226 "r027" + Name 229 "r028" + Name 232 "r029" + Name 235 "r030" + Name 238 "r031" + Name 241 "r033" + Name 245 "r034" + Name 248 "r036" + Name 251 "r037" + Name 254 "r038" + Name 257 "r039" + Name 261 "r039a" + Name 266 "r040" + Name 269 "r041" + Name 274 "r042" + Name 277 "r043" + Name 281 "r044" + Name 285 "r045" + Name 289 "r046" + Name 292 "r047" + Name 296 "r048" + Name 300 "r049" + Name 303 "r050" + Name 306 "r051" + Name 309 "r052" + Name 312 "r053" + Name 319 "r055" + Name 322 "r056" + Name 327 "r057" + Name 330 "r058" + Name 334 "r059" + Name 337 "r060" + Name 340 "r061" + Name 347 "r000" + Name 353 "r001" + Name 356 "r002" + Name 359 "r003" + Name 363 "r004" + Name 368 "r005" + Name 371 "r006" + Name 374 "r007" + Name 377 "r009" + Name 380 "r010" + Name 384 "r011" + Name 387 "r012" + Name 406 "r013" + Name 409 "r015" + Name 412 "r016" + Name 416 "r017" + Name 419 "r018" + Name 422 "r019" + Name 425 "r020" + Name 428 "r021" + Name 431 "r022" + Name 434 "r023" + Name 437 "r026" + Name 441 "r027" + Name 445 "r028" + Name 448 "r029" + Name 451 "r030" + Name 456 "r031" + Name 461 "r032" + Name 463 "r033" + Name 466 "r035" + Name 470 "r036" + Name 473 "r038" + Name 477 "r039" + Name 480 "r040" + Name 483 "r041" + Name 487 "r039a" + Name 492 "r042" + Name 495 "r043" + Name 498 "r044" + Name 502 "r045" + Name 505 "r046" + Name 509 "r047" + Name 513 "r048" + Name 516 "r049" + Name 520 "r050" + Name 523 "r051" + Name 527 "r052" + Name 531 "r053" + Name 536 "r054" + Name 541 "r055" + Name 544 "r056" + Name 547 "r057" + Name 552 "r058" + Name 555 "r059" + Name 562 "r060" + Name 565 "r061" + Name 570 "r062" + Name 573 "r063" + Name 577 "r064" + Name 580 "r065" + Name 583 "r066" + Name 589 "r000" + Name 595 "r001" + Name 598 "r002" + Name 601 "r003" + Name 605 "r004" + Name 610 "r005" + Name 613 "r006" + Name 616 "r007" + Name 619 "r009" + Name 622 "r010" + Name 626 "r011" + Name 629 "r012" + Name 647 "r013" + Name 650 "r014" + Name 653 "r015" + Name 658 "r016" + Name 662 "r017" + Name 665 "r018" + Name 668 "r019" + Name 671 "r020" + Name 674 "r021" + Name 677 "r022" + Name 680 "r023" + Name 683 "r024" + Name 687 "r025" + Name 691 "r029" + Name 694 "r030" + Name 697 "r031" + Name 702 "r032" + Name 706 "r033" + Name 708 "r034" + Name 711 "r036" + Name 715 "r037" + Name 718 "r039" + Name 722 "r040" + Name 725 "r041" + Name 728 "r042" + Name 732 "r039a" + Name 737 "r039b" + Name 743 "r043" + Name 746 "r044" + Name 749 "r045" + Name 753 "r046" + Name 756 "r047" + Name 760 "r048" + Name 764 "r049" + Name 767 "r050" + Name 771 "r051" + Name 774 "r052" + Name 778 "r053" + Name 782 "r054" + Name 786 "r055" + Name 789 "r056" + Name 792 "r057" + Name 795 "r058" + Name 800 "r059" + Name 803 "r060" + Name 810 "r061" + Name 813 "r062" + Name 818 "r063" + Name 821 "r064" + Name 825 "r065" + Name 828 "r066" + Name 831 "r067" + Name 838 "r000" + Name 844 "r001" + Name 847 "r002" + Name 850 "r003" + Name 854 "r004" + Name 859 "r005" + Name 862 "r006" + Name 865 "r007" + Name 868 "r009" + Name 871 "r010" + Name 875 "r011" + Name 878 "r012" + Name 896 "r013" + Name 899 "r014" + Name 902 "r015" + Name 905 "r016" + Name 908 "r017" + Name 911 "r018" + Name 914 "r019" + Name 917 "r020" + Name 920 "r021" + Name 923 "r022" + Name 926 "r023" + Name 930 "r024" + Name 934 "r025" + Name 945 "r029" + Name 948 "r030" + Name 951 "r031" + Name 956 "r032" + Name 961 "r033" + Name 963 "r034" + Name 966 "r036" + Name 970 "r037" + Name 973 "r039" + Name 977 "r040" + Name 980 "r041" + Name 983 "r042" + Name 987 "r039a" + Name 992 "r043" + Name 995 "r044" + Name 998 "r045" + Name 1002 "r046" + Name 1005 "r047" + Name 1009 "r048" + Name 1013 "r049" + Name 1016 "r050" + Name 1020 "r051" + Name 1023 "r052" + Name 1027 "r053" + Name 1031 "r054" + Name 1035 "r055" + Name 1038 "r056" + Name 1041 "r057" + Name 1044 "r058" + Name 1049 "r059" + Name 1052 "r060" + Name 1059 "r061" + Name 1062 "r062" + Name 1067 "r063" + Name 1070 "r064" + Name 1074 "r065" + Name 1077 "r066" + Name 1080 "r067" + Name 1087 "r000" + Name 1092 "r001" + Name 1097 "r003" + Name 1101 "r004" + Name 1104 "r005" + Name 1107 "r006" + Name 1111 "r007" + Name 1121 "r008" + Name 1126 "r009" + Name 1129 "r010" + Name 1132 "r011" + Name 1135 "r012" + Name 1138 "r013" + Name 1141 "r014" + Name 1144 "r015" + Name 1147 "r016" + Name 1150 "r017" + Name 1153 "r018" + Name 1156 "r019" + Name 1159 "R020" + Name 1162 "r021" + Name 1165 "r022" + Name 1175 "r023" + Name 1178 "r025" + Name 1181 "r026" + Name 1185 "r026a" + Name 1190 "r027" + Name 1193 "r028" + Name 1197 "r029" + Name 1200 "r030" + Name 1204 "r031" + Name 1208 "r032" + Name 1212 "r033" + Name 1215 "r034" + Name 1218 "r035" + Name 1221 "r036" + Name 1226 "r037" + Name 1229 "r038" + Name 1236 "r039" + Name 1239 "r049" + Name 1244 "r041" + Name 1247 "r042" + Name 1251 "r043" + Name 1254 "r044" + Name 1259 "r046" + Name 1266 "r000" + Name 1271 "r001" + Name 1276 "r003" + Name 1280 "r004" + Name 1283 "r005" + Name 1286 "r006" + Name 1290 "r007" + Name 1300 "r008" + Name 1305 "r009" + Name 1308 "r010" + Name 1311 "r011" + Name 1314 "r012" + Name 1317 "r013" + Name 1320 "r014" + Name 1323 "r015" + Name 1326 "r016" + Name 1329 "r017" + Name 1332 "r018" + Name 1335 "r019" + Name 1338 "R020" + Name 1341 "r021" + Name 1344 "r022" + Name 1357 "r023" + Name 1360 "r025" + Name 1363 "r026" + Name 1367 "r026a" + Name 1372 "r027" + Name 1375 "r028" + Name 1379 "r029" + Name 1382 "r030" + Name 1386 "r031" + Name 1390 "r032" + Name 1394 "r033" + Name 1397 "r034" + Name 1400 "r035" + Name 1403 "r036" + Name 1408 "r037" + Name 1411 "r038" + Name 1418 "r039" + Name 1421 "r049" + Name 1426 "r041" + Name 1429 "r042" + Name 1433 "r043" + Name 1436 "r044" + Name 1441 "r046" + Name 1448 "r000" + Name 1453 "r001" + Name 1458 "r003" + Name 1462 "r004" + Name 1465 "r005" + Name 1468 "r006" + Name 1472 "r007" + Name 1482 "r008" + Name 1487 "r009" + Name 1490 "r010" + Name 1493 "r011" + Name 1496 "r012" + Name 1499 "r013" + Name 1502 "r014" + Name 1505 "r015" + Name 1508 "r016" + Name 1511 "r017" + Name 1514 "r018" + Name 1517 "r019" + Name 1520 "R020" + Name 1523 "r021" + Name 1526 "r022" + Name 1542 "r023" + Name 1545 "r025" + Name 1548 "r026" + Name 1552 "r026a" + Name 1557 "r027" + Name 1560 "r028" + Name 1564 "r029" + Name 1567 "r030" + Name 1571 "r031" + Name 1575 "r032" + Name 1579 "r033" + Name 1582 "r034" + Name 1585 "r035" + Name 1588 "r036" + Name 1593 "r037" + Name 1596 "r038" + Name 1603 "r039" + Name 1606 "r049" + Name 1611 "r041" + Name 1614 "r042" + Name 1618 "r043" + Name 1621 "r044" + Name 1626 "r046" + Name 1633 "r0" + Name 1637 "r1" + Name 1641 "r2" + Name 1645 "r3" + Name 1649 "r4" + Name 1653 "r5" + Name 1657 "r6" + Name 1661 "r7" + Name 1665 "r8" + Name 1669 "r0" + Name 1673 "r1" + Name 1677 "r2" + Name 1681 "r3" + Name 1685 "r4" + Name 1689 "r5" + Name 1693 "r6" + Name 1697 "r7" + Name 1701 "r8" + Name 1705 "r0" + Name 1709 "r1" + Name 1713 "r2" + Name 1717 "r3" + Name 1721 "r4" + Name 1725 "r5" + Name 1729 "r6" + Name 1733 "r7" + Name 1737 "r8" + Name 1741 "r00" + Name 1745 "r01" + Name 1749 "r02" + Name 1753 "r03" + Name 1757 "r04" + Name 1761 "r05" + Name 1765 "r06" + Name 1769 "r07" + Name 1773 "r08" + Name 1777 "r09" + Name 1781 "r10" + Name 1785 "r11" + Name 1789 "r12" + Name 1793 "r13" + Name 1797 "r14" + Name 1801 "r15" + Name 1805 "r16" + Name 1810 "ps_output" + Name 1817 "@entryPointOutput.color" + Name 1821 "gs_ua" + Name 1822 "gs_ub" + Name 1823 "gs_uc" + Name 1825 "gs_ua2" + Name 1826 "gs_ub2" + Name 1827 "gs_uc2" + Name 1829 "gs_ua3" + Name 1830 "gs_ub3" + Name 1831 "gs_uc3" + Name 1833 "gs_ua4" + Name 1834 "gs_ub4" + Name 1835 "gs_uc4" + Decorate 1817(@entryPointOutput.color) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypePointer Function 6(float) 8: TypeInt 32 0 9: TypePointer Function 8(int) - 10: TypeFunction 6(float) 7(ptr) 7(ptr) 7(ptr) 9(ptr) 9(ptr) - 18: TypeFunction 6(float) 7(ptr) 7(ptr) 7(ptr) - 24: TypeVector 6(float) 2 - 25: TypePointer Function 24(fvec2) - 26: TypeVector 8(int) 2 - 27: TypePointer Function 26(ivec2) - 28: TypeFunction 24(fvec2) 25(ptr) 25(ptr) 25(ptr) 27(ptr) 27(ptr) - 36: TypeVector 6(float) 3 - 37: TypePointer Function 36(fvec3) - 38: TypeVector 8(int) 3 - 39: TypePointer Function 38(ivec3) - 40: TypeFunction 36(fvec3) 37(ptr) 37(ptr) 37(ptr) 39(ptr) 39(ptr) - 48: TypeVector 6(float) 4 - 49: TypePointer Function 48(fvec4) - 50: TypeVector 8(int) 4 - 51: TypePointer Function 50(ivec4) - 52: TypeFunction 48(fvec4) 49(ptr) 49(ptr) 49(ptr) 51(ptr) 51(ptr) - 60: TypeMatrix 24(fvec2) 2 - 61: TypePointer Function 60 - 62: TypeFunction 60 61(ptr) 61(ptr) 61(ptr) - 68: TypeMatrix 36(fvec3) 3 - 69: TypePointer Function 68 - 70: TypeFunction 68 69(ptr) 69(ptr) 69(ptr) - 76: TypeMatrix 48(fvec4) 4 - 77: TypePointer Function 76 - 78: TypeFunction 76 77(ptr) 77(ptr) 77(ptr) - 84: TypeFunction 2 7(ptr) 7(ptr) 25(ptr) 25(ptr) 61(ptr) 61(ptr) - 93: TypeFunction 2 7(ptr) 7(ptr) 37(ptr) 37(ptr) 69(ptr) 69(ptr) - 102: TypeFunction 2 7(ptr) 7(ptr) 49(ptr) 49(ptr) 77(ptr) 77(ptr) - 111: TypeMatrix 36(fvec3) 2 - 112: TypePointer Function 111 - 113: TypeMatrix 24(fvec2) 3 + 10: TypeInt 32 1 + 11: TypePointer Function 10(int) + 12: TypeFunction 6(float) 7(ptr) 7(ptr) 7(ptr) 9(ptr) 11(ptr) + 20: TypeFunction 6(float) 7(ptr) 7(ptr) 7(ptr) + 26: TypeVector 6(float) 2 + 27: TypePointer Function 26(fvec2) + 28: TypeVector 8(int) 2 + 29: TypePointer Function 28(ivec2) + 30: TypeFunction 26(fvec2) 27(ptr) 27(ptr) 27(ptr) 29(ptr) 29(ptr) + 38: TypeVector 6(float) 3 + 39: TypePointer Function 38(fvec3) + 40: TypeVector 8(int) 3 + 41: TypePointer Function 40(ivec3) + 42: TypeFunction 38(fvec3) 39(ptr) 39(ptr) 39(ptr) 41(ptr) 41(ptr) + 50: TypeVector 6(float) 4 + 51: TypePointer Function 50(fvec4) + 52: TypeVector 8(int) 4 + 53: TypePointer Function 52(ivec4) + 54: TypeFunction 50(fvec4) 51(ptr) 51(ptr) 51(ptr) 53(ptr) 53(ptr) + 62: TypeMatrix 26(fvec2) 2 + 63: TypePointer Function 62 + 64: TypeFunction 62 63(ptr) 63(ptr) 63(ptr) + 70: TypeMatrix 38(fvec3) 3 + 71: TypePointer Function 70 + 72: TypeFunction 70 71(ptr) 71(ptr) 71(ptr) + 78: TypeMatrix 50(fvec4) 4 + 79: TypePointer Function 78 + 80: TypeFunction 78 79(ptr) 79(ptr) 79(ptr) + 86: TypeFunction 2 7(ptr) 7(ptr) 27(ptr) 27(ptr) 63(ptr) 63(ptr) + 95: TypeFunction 2 7(ptr) 7(ptr) 39(ptr) 39(ptr) 71(ptr) 71(ptr) + 104: TypeFunction 2 7(ptr) 7(ptr) 51(ptr) 51(ptr) 79(ptr) 79(ptr) + 113: TypeMatrix 38(fvec3) 2 114: TypePointer Function 113 - 115: TypeMatrix 48(fvec4) 3 + 115: TypeMatrix 26(fvec2) 3 116: TypePointer Function 115 - 117: TypeMatrix 48(fvec4) 2 + 117: TypeMatrix 50(fvec4) 3 118: TypePointer Function 117 - 119: TypeFunction 2 7(ptr) 7(ptr) 25(ptr) 37(ptr) 112(ptr) 114(ptr) 69(ptr) 116(ptr) 118(ptr) - 131(PS_OUTPUT): TypeStruct 48(fvec4) - 132: TypeFunction 131(PS_OUTPUT) - 135: TypeBool - 136: TypePointer Function 135(bool) - 139: 6(float) Constant 0 - 155: TypeInt 32 1 - 156: TypePointer Function 155(int) - 187: 155(int) Constant 0 - 199: 155(int) Constant 7 - 268: 6(float) Constant 1050288283 - 289: 6(float) Constant 1065353216 - 293: 155(int) Constant 2 - 345: TypeVector 135(bool) 2 - 346: 24(fvec2) ConstantComposite 139 139 - 362: TypeVector 155(int) 2 - 363: TypePointer Function 362(ivec2) - 395: 8(int) Constant 0 - 396: 26(ivec2) ConstantComposite 395 395 - 409: 155(int) Constant 3 - 410: 362(ivec2) ConstantComposite 199 409 - 453: 8(int) Constant 7 - 454: 8(int) Constant 8 - 455: 26(ivec2) ConstantComposite 453 454 - 472: TypePointer Function 345(bvec2) - 530: 6(float) Constant 1073741824 - 533: 8(int) Constant 1 - 534: 8(int) Constant 2 - 535: 26(ivec2) ConstantComposite 533 534 - 582: 24(fvec2) ConstantComposite 289 530 - 587: TypeVector 135(bool) 3 - 588: 36(fvec3) ConstantComposite 139 139 139 - 604: TypeVector 155(int) 3 - 605: TypePointer Function 604(ivec3) - 637: 38(ivec3) ConstantComposite 395 395 395 - 650: 8(int) Constant 3 - 651: 8(int) Constant 5 - 652: 38(ivec3) ConstantComposite 453 650 651 - 699: 8(int) Constant 4 - 700: 38(ivec3) ConstantComposite 534 650 699 - 717: TypePointer Function 587(bvec3) - 736: 6(float) Constant 1050253722 - 783: 38(ivec3) ConstantComposite 533 534 650 - 830: 6(float) Constant 1077936128 - 831: 36(fvec3) ConstantComposite 289 530 830 - 836: TypeVector 135(bool) 4 - 837: 48(fvec4) ConstantComposite 139 139 139 139 - 853: TypeVector 155(int) 4 - 854: TypePointer Function 853(ivec4) - 886: 50(ivec4) ConstantComposite 395 395 395 395 - 899: 50(ivec4) ConstantComposite 453 650 651 534 - 953: 8(int) Constant 9 - 954: 8(int) Constant 10 - 955: 50(ivec4) ConstantComposite 453 454 953 954 - 972: TypePointer Function 836(bvec4) - 1032: 50(ivec4) ConstantComposite 533 534 650 699 - 1079: 6(float) Constant 1082130432 - 1080: 48(fvec4) ConstantComposite 289 530 830 1079 - 1085: TypeMatrix 345(bvec2) 2 - 1111: 60 ConstantComposite 346 346 - 1258: 24(fvec2) ConstantComposite 530 530 - 1259: 60 ConstantComposite 1258 1258 - 1264: TypeMatrix 587(bvec3) 3 - 1290: 68 ConstantComposite 588 588 588 - 1440: 36(fvec3) ConstantComposite 830 830 830 - 1441: 68 ConstantComposite 1440 1440 1440 - 1446: TypeMatrix 836(bvec4) 4 - 1472: 76 ConstantComposite 837 837 837 837 - 1625: 48(fvec4) ConstantComposite 1079 1079 1079 1079 - 1626: 76 ConstantComposite 1625 1625 1625 1625 - 1805: TypePointer Function 131(PS_OUTPUT) - 1807: 48(fvec4) ConstantComposite 289 289 289 289 - 1812: TypePointer Output 48(fvec4) -1813(@entryPointOutput.color): 1812(ptr) Variable Output - 1816: TypePointer Workgroup 8(int) - 1817(gs_ua): 1816(ptr) Variable Workgroup - 1818(gs_ub): 1816(ptr) Variable Workgroup - 1819(gs_uc): 1816(ptr) Variable Workgroup - 1820: TypePointer Workgroup 26(ivec2) - 1821(gs_ua2): 1820(ptr) Variable Workgroup - 1822(gs_ub2): 1820(ptr) Variable Workgroup - 1823(gs_uc2): 1820(ptr) Variable Workgroup - 1824: TypePointer Workgroup 38(ivec3) - 1825(gs_ua3): 1824(ptr) Variable Workgroup - 1826(gs_ub3): 1824(ptr) Variable Workgroup - 1827(gs_uc3): 1824(ptr) Variable Workgroup - 1828: TypePointer Workgroup 50(ivec4) - 1829(gs_ua4): 1828(ptr) Variable Workgroup - 1830(gs_ub4): 1828(ptr) Variable Workgroup - 1831(gs_uc4): 1828(ptr) Variable Workgroup + 119: TypeMatrix 50(fvec4) 2 + 120: TypePointer Function 119 + 121: TypeFunction 2 7(ptr) 7(ptr) 27(ptr) 39(ptr) 114(ptr) 116(ptr) 71(ptr) 118(ptr) 120(ptr) + 133(PS_OUTPUT): TypeStruct 50(fvec4) + 134: TypeFunction 133(PS_OUTPUT) + 137: TypeBool + 138: TypePointer Function 137(bool) + 141: 6(float) Constant 0 + 187: 10(int) Constant 0 + 199: 10(int) Constant 7 + 272: 6(float) Constant 1050288283 + 293: 6(float) Constant 1065353216 + 297: 10(int) Constant 2 + 349: TypeVector 137(bool) 2 + 350: 26(fvec2) ConstantComposite 141 141 + 366: TypeVector 10(int) 2 + 367: TypePointer Function 366(ivec2) + 399: 8(int) Constant 0 + 400: 28(ivec2) ConstantComposite 399 399 + 413: 10(int) Constant 3 + 414: 366(ivec2) ConstantComposite 199 413 + 457: 8(int) Constant 7 + 458: 8(int) Constant 8 + 459: 28(ivec2) ConstantComposite 457 458 + 476: TypePointer Function 349(bvec2) + 534: 6(float) Constant 1073741824 + 537: 8(int) Constant 1 + 538: 8(int) Constant 2 + 539: 28(ivec2) ConstantComposite 537 538 + 586: 26(fvec2) ConstantComposite 293 534 + 591: TypeVector 137(bool) 3 + 592: 38(fvec3) ConstantComposite 141 141 141 + 608: TypeVector 10(int) 3 + 609: TypePointer Function 608(ivec3) + 641: 40(ivec3) ConstantComposite 399 399 399 + 654: 8(int) Constant 3 + 655: 8(int) Constant 5 + 656: 40(ivec3) ConstantComposite 457 654 655 + 703: 8(int) Constant 4 + 704: 40(ivec3) ConstantComposite 538 654 703 + 721: TypePointer Function 591(bvec3) + 740: 6(float) Constant 1050253722 + 787: 40(ivec3) ConstantComposite 537 538 654 + 834: 6(float) Constant 1077936128 + 835: 38(fvec3) ConstantComposite 293 534 834 + 840: TypeVector 137(bool) 4 + 841: 50(fvec4) ConstantComposite 141 141 141 141 + 857: TypeVector 10(int) 4 + 858: TypePointer Function 857(ivec4) + 890: 52(ivec4) ConstantComposite 399 399 399 399 + 903: 52(ivec4) ConstantComposite 457 654 655 538 + 957: 8(int) Constant 9 + 958: 8(int) Constant 10 + 959: 52(ivec4) ConstantComposite 457 458 957 958 + 976: TypePointer Function 840(bvec4) + 1036: 52(ivec4) ConstantComposite 537 538 654 703 + 1083: 6(float) Constant 1082130432 + 1084: 50(fvec4) ConstantComposite 293 534 834 1083 + 1089: TypeMatrix 349(bvec2) 2 + 1115: 62 ConstantComposite 350 350 + 1262: 26(fvec2) ConstantComposite 534 534 + 1263: 62 ConstantComposite 1262 1262 + 1268: TypeMatrix 591(bvec3) 3 + 1294: 70 ConstantComposite 592 592 592 + 1444: 38(fvec3) ConstantComposite 834 834 834 + 1445: 70 ConstantComposite 1444 1444 1444 + 1450: TypeMatrix 840(bvec4) 4 + 1476: 78 ConstantComposite 841 841 841 841 + 1629: 50(fvec4) ConstantComposite 1083 1083 1083 1083 + 1630: 78 ConstantComposite 1629 1629 1629 1629 + 1809: TypePointer Function 133(PS_OUTPUT) + 1811: 50(fvec4) ConstantComposite 293 293 293 293 + 1816: TypePointer Output 50(fvec4) +1817(@entryPointOutput.color): 1816(ptr) Variable Output + 1820: TypePointer Workgroup 8(int) + 1821(gs_ua): 1820(ptr) Variable Workgroup + 1822(gs_ub): 1820(ptr) Variable Workgroup + 1823(gs_uc): 1820(ptr) Variable Workgroup + 1824: TypePointer Workgroup 28(ivec2) + 1825(gs_ua2): 1824(ptr) Variable Workgroup + 1826(gs_ub2): 1824(ptr) Variable Workgroup + 1827(gs_uc2): 1824(ptr) Variable Workgroup + 1828: TypePointer Workgroup 40(ivec3) + 1829(gs_ua3): 1828(ptr) Variable Workgroup + 1830(gs_ub3): 1828(ptr) Variable Workgroup + 1831(gs_uc3): 1828(ptr) Variable Workgroup + 1832: TypePointer Workgroup 52(ivec4) + 1833(gs_ua4): 1832(ptr) Variable Workgroup + 1834(gs_ub4): 1832(ptr) Variable Workgroup + 1835(gs_uc4): 1832(ptr) Variable Workgroup 4(main): 2 Function None 3 5: Label - 1814:131(PS_OUTPUT) FunctionCall 133(@main() - 1815: 48(fvec4) CompositeExtract 1814 0 - Store 1813(@entryPointOutput.color) 1815 + 1818:133(PS_OUTPUT) FunctionCall 135(@main() + 1819: 50(fvec4) CompositeExtract 1818 0 + Store 1817(@entryPointOutput.color) 1819 Return FunctionEnd -16(PixelShaderFunctionS(f1;f1;f1;u1;u1;): 6(float) Function None 10 - 11(inF0): 7(ptr) FunctionParameter - 12(inF1): 7(ptr) FunctionParameter - 13(inF2): 7(ptr) FunctionParameter - 14(inU0): 9(ptr) FunctionParameter - 15(inU1): 9(ptr) FunctionParameter - 17: Label - 137(r000): 136(ptr) Variable Function - 142(r001): 7(ptr) Variable Function - 145(r002): 7(ptr) Variable Function - 148(r003): 136(ptr) Variable Function - 152(r004): 7(ptr) Variable Function - 157(r005): 156(ptr) Variable Function +18(PixelShaderFunctionS(f1;f1;f1;u1;i1;): 6(float) Function None 12 + 13(inF0): 7(ptr) FunctionParameter + 14(inF1): 7(ptr) FunctionParameter + 15(inF2): 7(ptr) FunctionParameter + 16(inU0): 9(ptr) FunctionParameter + 17(inU1): 11(ptr) FunctionParameter + 19: Label + 139(r000): 138(ptr) Variable Function + 144(r001): 7(ptr) Variable Function + 147(r002): 7(ptr) Variable Function + 150(r003): 138(ptr) Variable Function + 154(r004): 7(ptr) Variable Function + 157(r005): 11(ptr) Variable Function 160(r006): 9(ptr) Variable Function 163(r007): 7(ptr) Variable Function 166(r009): 7(ptr) Variable Function @@ -6316,7 +6333,7 @@ gl_FragCoord origin is upper left 176(r012): 7(ptr) Variable Function 192(r014): 7(ptr) Variable Function 195(r015): 7(ptr) Variable Function - 198(r016): 156(ptr) Variable Function + 198(r016): 11(ptr) Variable Function 201(r017): 7(ptr) Variable Function 204(r018): 7(ptr) Variable Function 207(r019): 7(ptr) Variable Function @@ -6324,2135 +6341,2140 @@ gl_FragCoord origin is upper left 213(r021): 7(ptr) Variable Function 216(r022): 7(ptr) Variable Function 219(r023): 7(ptr) Variable Function - 222(r027): 7(ptr) Variable Function - 225(r028): 7(ptr) Variable Function - 228(r029): 9(ptr) Variable Function - 231(r030): 9(ptr) Variable Function - 234(r031): 7(ptr) Variable Function - 237(r033): 7(ptr) Variable Function - 241(r034): 7(ptr) Variable Function - 244(r036): 7(ptr) Variable Function - 247(r037): 136(ptr) Variable Function - 250(r038): 136(ptr) Variable Function - 253(r039): 7(ptr) Variable Function - 257(r039a): 7(ptr) Variable Function - 262(r040): 7(ptr) Variable Function - 265(r041): 7(ptr) Variable Function - 270(r042): 7(ptr) Variable Function - 273(r043): 7(ptr) Variable Function - 277(r044): 7(ptr) Variable Function - 281(r045): 7(ptr) Variable Function - 285(r046): 7(ptr) Variable Function - 288(r047): 7(ptr) Variable Function - 292(r048): 9(ptr) Variable Function - 296(r049): 7(ptr) Variable Function - 299(r050): 7(ptr) Variable Function - 302(r051): 7(ptr) Variable Function - 305(r052): 7(ptr) Variable Function - 308(r053): 7(ptr) Variable Function - 315(r055): 7(ptr) Variable Function - 318(r056): 7(ptr) Variable Function - 323(r057): 7(ptr) Variable Function - 326(r058): 7(ptr) Variable Function - 330(r059): 7(ptr) Variable Function - 333(r060): 7(ptr) Variable Function - 336(r061): 7(ptr) Variable Function - 138: 6(float) Load 11(inF0) - 140: 135(bool) FOrdNotEqual 138 139 - 141: 135(bool) All 140 - Store 137(r000) 141 - 143: 6(float) Load 11(inF0) - 144: 6(float) ExtInst 1(GLSL.std.450) 4(FAbs) 143 - Store 142(r001) 144 - 146: 6(float) Load 11(inF0) - 147: 6(float) ExtInst 1(GLSL.std.450) 17(Acos) 146 - Store 145(r002) 147 - 149: 6(float) Load 11(inF0) - 150: 135(bool) FOrdNotEqual 149 139 - 151: 135(bool) Any 150 - Store 148(r003) 151 - 153: 6(float) Load 11(inF0) - 154: 6(float) ExtInst 1(GLSL.std.450) 16(Asin) 153 - Store 152(r004) 154 - 158: 6(float) Load 11(inF0) - 159: 155(int) Bitcast 158 + 222(r024): 7(ptr) Variable Function + 226(r027): 7(ptr) Variable Function + 229(r028): 7(ptr) Variable Function + 232(r029): 9(ptr) Variable Function + 235(r030): 9(ptr) Variable Function + 238(r031): 7(ptr) Variable Function + 241(r033): 7(ptr) Variable Function + 245(r034): 7(ptr) Variable Function + 248(r036): 7(ptr) Variable Function + 251(r037): 138(ptr) Variable Function + 254(r038): 138(ptr) Variable Function + 257(r039): 7(ptr) Variable Function + 261(r039a): 7(ptr) Variable Function + 266(r040): 7(ptr) Variable Function + 269(r041): 7(ptr) Variable Function + 274(r042): 7(ptr) Variable Function + 277(r043): 7(ptr) Variable Function + 281(r044): 7(ptr) Variable Function + 285(r045): 7(ptr) Variable Function + 289(r046): 7(ptr) Variable Function + 292(r047): 7(ptr) Variable Function + 296(r048): 9(ptr) Variable Function + 300(r049): 7(ptr) Variable Function + 303(r050): 7(ptr) Variable Function + 306(r051): 7(ptr) Variable Function + 309(r052): 7(ptr) Variable Function + 312(r053): 7(ptr) Variable Function + 319(r055): 7(ptr) Variable Function + 322(r056): 7(ptr) Variable Function + 327(r057): 7(ptr) Variable Function + 330(r058): 7(ptr) Variable Function + 334(r059): 7(ptr) Variable Function + 337(r060): 7(ptr) Variable Function + 340(r061): 7(ptr) Variable Function + 140: 6(float) Load 13(inF0) + 142: 137(bool) FOrdNotEqual 140 141 + 143: 137(bool) All 142 + Store 139(r000) 143 + 145: 6(float) Load 13(inF0) + 146: 6(float) ExtInst 1(GLSL.std.450) 4(FAbs) 145 + Store 144(r001) 146 + 148: 6(float) Load 13(inF0) + 149: 6(float) ExtInst 1(GLSL.std.450) 17(Acos) 148 + Store 147(r002) 149 + 151: 6(float) Load 13(inF0) + 152: 137(bool) FOrdNotEqual 151 141 + 153: 137(bool) Any 152 + Store 150(r003) 153 + 155: 6(float) Load 13(inF0) + 156: 6(float) ExtInst 1(GLSL.std.450) 16(Asin) 155 + Store 154(r004) 156 + 158: 6(float) Load 13(inF0) + 159: 10(int) Bitcast 158 Store 157(r005) 159 - 161: 6(float) Load 11(inF0) + 161: 10(int) Load 17(inU1) 162: 8(int) Bitcast 161 Store 160(r006) 162 - 164: 8(int) Load 14(inU0) + 164: 8(int) Load 16(inU0) 165: 6(float) Bitcast 164 Store 163(r007) 165 - 167: 6(float) Load 11(inF0) + 167: 6(float) Load 13(inF0) 168: 6(float) ExtInst 1(GLSL.std.450) 18(Atan) 167 Store 166(r009) 168 - 170: 6(float) Load 11(inF0) - 171: 6(float) Load 12(inF1) + 170: 6(float) Load 13(inF0) + 171: 6(float) Load 14(inF1) 172: 6(float) ExtInst 1(GLSL.std.450) 25(Atan2) 170 171 Store 169(r010) 172 - 174: 6(float) Load 11(inF0) + 174: 6(float) Load 13(inF0) 175: 6(float) ExtInst 1(GLSL.std.450) 9(Ceil) 174 Store 173(r011) 175 - 177: 6(float) Load 11(inF0) - 178: 6(float) Load 12(inF1) - 179: 6(float) Load 13(inF2) + 177: 6(float) Load 13(inF0) + 178: 6(float) Load 14(inF1) + 179: 6(float) Load 15(inF2) 180: 6(float) ExtInst 1(GLSL.std.450) 43(FClamp) 177 178 179 Store 176(r012) 180 - 181: 6(float) Load 11(inF0) - 182: 135(bool) FOrdLessThan 181 139 + 181: 6(float) Load 13(inF0) + 182: 137(bool) FOrdLessThan 181 141 SelectionMerge 184 None BranchConditional 182 183 184 183: Label Kill 184: Label - 186: 155(int) Load 157(r005) - 188: 135(bool) SLessThan 186 187 + 186: 10(int) Load 157(r005) + 188: 137(bool) SLessThan 186 187 SelectionMerge 190 None BranchConditional 188 189 190 189: Label Kill 190: Label - 193: 6(float) Load 11(inF0) + 193: 6(float) Load 13(inF0) 194: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 193 Store 192(r014) 194 - 196: 6(float) Load 11(inF0) + 196: 6(float) Load 13(inF0) 197: 6(float) ExtInst 1(GLSL.std.450) 20(Cosh) 196 Store 195(r015) 197 - 200: 155(int) BitCount 199 + 200: 10(int) BitCount 199 Store 198(r016) 200 - 202: 6(float) Load 11(inF0) + 202: 6(float) Load 13(inF0) 203: 6(float) DPdx 202 Store 201(r017) 203 - 205: 6(float) Load 11(inF0) + 205: 6(float) Load 13(inF0) 206: 6(float) DPdxCoarse 205 Store 204(r018) 206 - 208: 6(float) Load 11(inF0) + 208: 6(float) Load 13(inF0) 209: 6(float) DPdxFine 208 Store 207(r019) 209 - 211: 6(float) Load 11(inF0) + 211: 6(float) Load 13(inF0) 212: 6(float) DPdy 211 Store 210(r020) 212 - 214: 6(float) Load 11(inF0) + 214: 6(float) Load 13(inF0) 215: 6(float) DPdyCoarse 214 Store 213(r021) 215 - 217: 6(float) Load 11(inF0) + 217: 6(float) Load 13(inF0) 218: 6(float) DPdyFine 217 Store 216(r022) 218 - 220: 6(float) Load 11(inF0) + 220: 6(float) Load 13(inF0) 221: 6(float) ExtInst 1(GLSL.std.450) 12(Degrees) 220 Store 219(r023) 221 - 223: 6(float) Load 11(inF0) - 224: 6(float) ExtInst 1(GLSL.std.450) 27(Exp) 223 - Store 222(r027) 224 - 226: 6(float) Load 11(inF0) - 227: 6(float) ExtInst 1(GLSL.std.450) 29(Exp2) 226 - Store 225(r028) 227 - 229: 155(int) ExtInst 1(GLSL.std.450) 74(FindSMsb) 199 - 230: 8(int) Bitcast 229 - Store 228(r029) 230 - 232: 155(int) ExtInst 1(GLSL.std.450) 73(FindILsb) 199 - 233: 8(int) Bitcast 232 - Store 231(r030) 233 - 235: 6(float) Load 11(inF0) - 236: 6(float) ExtInst 1(GLSL.std.450) 8(Floor) 235 - Store 234(r031) 236 - 238: 6(float) Load 11(inF0) - 239: 6(float) Load 12(inF1) - 240: 6(float) FMod 238 239 - Store 237(r033) 240 - 242: 6(float) Load 11(inF0) - 243: 6(float) ExtInst 1(GLSL.std.450) 10(Fract) 242 - Store 241(r034) 243 - 245: 6(float) Load 11(inF0) - 246: 6(float) Fwidth 245 - Store 244(r036) 246 - 248: 6(float) Load 11(inF0) - 249: 135(bool) IsInf 248 - Store 247(r037) 249 - 251: 6(float) Load 11(inF0) - 252: 135(bool) IsNan 251 - Store 250(r038) 252 - 254: 6(float) Load 11(inF0) - 255: 6(float) Load 12(inF1) - 256: 6(float) ExtInst 1(GLSL.std.450) 53(Ldexp) 254 255 - Store 253(r039) 256 - 258: 6(float) Load 11(inF0) - 259: 6(float) Load 12(inF1) - 260: 6(float) Load 13(inF2) - 261: 6(float) ExtInst 1(GLSL.std.450) 46(FMix) 258 259 260 - Store 257(r039a) 261 - 263: 6(float) Load 11(inF0) - 264: 6(float) ExtInst 1(GLSL.std.450) 28(Log) 263 - Store 262(r040) 264 - 266: 6(float) Load 11(inF0) - 267: 6(float) ExtInst 1(GLSL.std.450) 30(Log2) 266 - 269: 6(float) FMul 267 268 - Store 265(r041) 269 - 271: 6(float) Load 11(inF0) - 272: 6(float) ExtInst 1(GLSL.std.450) 30(Log2) 271 - Store 270(r042) 272 - 274: 6(float) Load 11(inF0) - 275: 6(float) Load 12(inF1) - 276: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 274 275 - Store 273(r043) 276 - 278: 6(float) Load 11(inF0) - 279: 6(float) Load 12(inF1) - 280: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 278 279 - Store 277(r044) 280 - 282: 6(float) Load 11(inF0) - 283: 6(float) Load 12(inF1) - 284: 6(float) ExtInst 1(GLSL.std.450) 26(Pow) 282 283 - Store 281(r045) 284 - 286: 6(float) Load 11(inF0) - 287: 6(float) ExtInst 1(GLSL.std.450) 11(Radians) 286 - Store 285(r046) 287 - 290: 6(float) Load 11(inF0) - 291: 6(float) FDiv 289 290 - Store 288(r047) 291 - 294: 155(int) BitReverse 293 - 295: 8(int) Bitcast 294 - Store 292(r048) 295 - 297: 6(float) Load 11(inF0) - 298: 6(float) ExtInst 1(GLSL.std.450) 2(RoundEven) 297 - Store 296(r049) 298 - 300: 6(float) Load 11(inF0) - 301: 6(float) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 300 - Store 299(r050) 301 - 303: 6(float) Load 11(inF0) - 304: 6(float) ExtInst 1(GLSL.std.450) 43(FClamp) 303 139 289 - Store 302(r051) 304 - 306: 6(float) Load 11(inF0) - 307: 6(float) ExtInst 1(GLSL.std.450) 6(FSign) 306 - Store 305(r052) 307 - 309: 6(float) Load 11(inF0) - 310: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 309 - Store 308(r053) 310 - 311: 6(float) Load 11(inF0) - 312: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 311 - Store 12(inF1) 312 - 313: 6(float) Load 11(inF0) - 314: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 313 - Store 13(inF2) 314 - 316: 6(float) Load 11(inF0) - 317: 6(float) ExtInst 1(GLSL.std.450) 19(Sinh) 316 - Store 315(r055) 317 - 319: 6(float) Load 11(inF0) - 320: 6(float) Load 12(inF1) - 321: 6(float) Load 13(inF2) - 322: 6(float) ExtInst 1(GLSL.std.450) 49(SmoothStep) 319 320 321 - Store 318(r056) 322 - 324: 6(float) Load 11(inF0) - 325: 6(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 324 - Store 323(r057) 325 - 327: 6(float) Load 11(inF0) - 328: 6(float) Load 12(inF1) - 329: 6(float) ExtInst 1(GLSL.std.450) 48(Step) 327 328 - Store 326(r058) 329 - 331: 6(float) Load 11(inF0) - 332: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 331 - Store 330(r059) 332 - 334: 6(float) Load 11(inF0) - 335: 6(float) ExtInst 1(GLSL.std.450) 21(Tanh) 334 - Store 333(r060) 335 - 337: 6(float) Load 11(inF0) - 338: 6(float) ExtInst 1(GLSL.std.450) 3(Trunc) 337 - Store 336(r061) 338 - ReturnValue 139 + 223: 6(float) Load 13(inF0) + 224: 6(float) Load 14(inF1) + 225: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 223 224 + Store 222(r024) 225 + 227: 6(float) Load 13(inF0) + 228: 6(float) ExtInst 1(GLSL.std.450) 27(Exp) 227 + Store 226(r027) 228 + 230: 6(float) Load 13(inF0) + 231: 6(float) ExtInst 1(GLSL.std.450) 29(Exp2) 230 + Store 229(r028) 231 + 233: 10(int) ExtInst 1(GLSL.std.450) 74(FindSMsb) 199 + 234: 8(int) Bitcast 233 + Store 232(r029) 234 + 236: 10(int) ExtInst 1(GLSL.std.450) 73(FindILsb) 199 + 237: 8(int) Bitcast 236 + Store 235(r030) 237 + 239: 6(float) Load 13(inF0) + 240: 6(float) ExtInst 1(GLSL.std.450) 8(Floor) 239 + Store 238(r031) 240 + 242: 6(float) Load 13(inF0) + 243: 6(float) Load 14(inF1) + 244: 6(float) FMod 242 243 + Store 241(r033) 244 + 246: 6(float) Load 13(inF0) + 247: 6(float) ExtInst 1(GLSL.std.450) 10(Fract) 246 + Store 245(r034) 247 + 249: 6(float) Load 13(inF0) + 250: 6(float) Fwidth 249 + Store 248(r036) 250 + 252: 6(float) Load 13(inF0) + 253: 137(bool) IsInf 252 + Store 251(r037) 253 + 255: 6(float) Load 13(inF0) + 256: 137(bool) IsNan 255 + Store 254(r038) 256 + 258: 6(float) Load 13(inF0) + 259: 6(float) Load 14(inF1) + 260: 6(float) ExtInst 1(GLSL.std.450) 53(Ldexp) 258 259 + Store 257(r039) 260 + 262: 6(float) Load 13(inF0) + 263: 6(float) Load 14(inF1) + 264: 6(float) Load 15(inF2) + 265: 6(float) ExtInst 1(GLSL.std.450) 46(FMix) 262 263 264 + Store 261(r039a) 265 + 267: 6(float) Load 13(inF0) + 268: 6(float) ExtInst 1(GLSL.std.450) 28(Log) 267 + Store 266(r040) 268 + 270: 6(float) Load 13(inF0) + 271: 6(float) ExtInst 1(GLSL.std.450) 30(Log2) 270 + 273: 6(float) FMul 271 272 + Store 269(r041) 273 + 275: 6(float) Load 13(inF0) + 276: 6(float) ExtInst 1(GLSL.std.450) 30(Log2) 275 + Store 274(r042) 276 + 278: 6(float) Load 13(inF0) + 279: 6(float) Load 14(inF1) + 280: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 278 279 + Store 277(r043) 280 + 282: 6(float) Load 13(inF0) + 283: 6(float) Load 14(inF1) + 284: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 282 283 + Store 281(r044) 284 + 286: 6(float) Load 13(inF0) + 287: 6(float) Load 14(inF1) + 288: 6(float) ExtInst 1(GLSL.std.450) 26(Pow) 286 287 + Store 285(r045) 288 + 290: 6(float) Load 13(inF0) + 291: 6(float) ExtInst 1(GLSL.std.450) 11(Radians) 290 + Store 289(r046) 291 + 294: 6(float) Load 13(inF0) + 295: 6(float) FDiv 293 294 + Store 292(r047) 295 + 298: 10(int) BitReverse 297 + 299: 8(int) Bitcast 298 + Store 296(r048) 299 + 301: 6(float) Load 13(inF0) + 302: 6(float) ExtInst 1(GLSL.std.450) 2(RoundEven) 301 + Store 300(r049) 302 + 304: 6(float) Load 13(inF0) + 305: 6(float) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 304 + Store 303(r050) 305 + 307: 6(float) Load 13(inF0) + 308: 6(float) ExtInst 1(GLSL.std.450) 43(FClamp) 307 141 293 + Store 306(r051) 308 + 310: 6(float) Load 13(inF0) + 311: 6(float) ExtInst 1(GLSL.std.450) 6(FSign) 310 + Store 309(r052) 311 + 313: 6(float) Load 13(inF0) + 314: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 313 + Store 312(r053) 314 + 315: 6(float) Load 13(inF0) + 316: 6(float) ExtInst 1(GLSL.std.450) 13(Sin) 315 + Store 14(inF1) 316 + 317: 6(float) Load 13(inF0) + 318: 6(float) ExtInst 1(GLSL.std.450) 14(Cos) 317 + Store 15(inF2) 318 + 320: 6(float) Load 13(inF0) + 321: 6(float) ExtInst 1(GLSL.std.450) 19(Sinh) 320 + Store 319(r055) 321 + 323: 6(float) Load 13(inF0) + 324: 6(float) Load 14(inF1) + 325: 6(float) Load 15(inF2) + 326: 6(float) ExtInst 1(GLSL.std.450) 49(SmoothStep) 323 324 325 + Store 322(r056) 326 + 328: 6(float) Load 13(inF0) + 329: 6(float) ExtInst 1(GLSL.std.450) 31(Sqrt) 328 + Store 327(r057) 329 + 331: 6(float) Load 13(inF0) + 332: 6(float) Load 14(inF1) + 333: 6(float) ExtInst 1(GLSL.std.450) 48(Step) 331 332 + Store 330(r058) 333 + 335: 6(float) Load 13(inF0) + 336: 6(float) ExtInst 1(GLSL.std.450) 15(Tan) 335 + Store 334(r059) 336 + 338: 6(float) Load 13(inF0) + 339: 6(float) ExtInst 1(GLSL.std.450) 21(Tanh) 338 + Store 337(r060) 339 + 341: 6(float) Load 13(inF0) + 342: 6(float) ExtInst 1(GLSL.std.450) 3(Trunc) 341 + Store 340(r061) 342 + ReturnValue 141 FunctionEnd -22(PixelShaderFunction1(vf1;vf1;vf1;): 6(float) Function None 18 - 19(inF0): 7(ptr) FunctionParameter - 20(inF1): 7(ptr) FunctionParameter - 21(inF2): 7(ptr) FunctionParameter - 23: Label - ReturnValue 139 +24(PixelShaderFunction1(vf1;vf1;vf1;): 6(float) Function None 20 + 21(inF0): 7(ptr) FunctionParameter + 22(inF1): 7(ptr) FunctionParameter + 23(inF2): 7(ptr) FunctionParameter + 25: Label + ReturnValue 141 FunctionEnd -34(PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2;): 24(fvec2) Function None 28 - 29(inF0): 25(ptr) FunctionParameter - 30(inF1): 25(ptr) FunctionParameter - 31(inF2): 25(ptr) FunctionParameter - 32(inU0): 27(ptr) FunctionParameter - 33(inU1): 27(ptr) FunctionParameter - 35: Label - 343(r000): 136(ptr) Variable Function - 349(r001): 25(ptr) Variable Function - 352(r002): 25(ptr) Variable Function - 355(r003): 136(ptr) Variable Function - 359(r004): 25(ptr) Variable Function - 364(r005): 363(ptr) Variable Function - 367(r006): 27(ptr) Variable Function - 370(r007): 25(ptr) Variable Function - 373(r009): 25(ptr) Variable Function - 376(r010): 25(ptr) Variable Function - 380(r011): 25(ptr) Variable Function - 383(r012): 25(ptr) Variable Function - 402(r013): 25(ptr) Variable Function - 405(r015): 25(ptr) Variable Function - 408(r016): 363(ptr) Variable Function - 412(r017): 25(ptr) Variable Function - 415(r018): 25(ptr) Variable Function - 418(r019): 25(ptr) Variable Function - 421(r020): 25(ptr) Variable Function - 424(r021): 25(ptr) Variable Function - 427(r022): 25(ptr) Variable Function - 430(r023): 25(ptr) Variable Function - 433(r026): 7(ptr) Variable Function - 437(r027): 7(ptr) Variable Function - 441(r028): 25(ptr) Variable Function - 444(r029): 25(ptr) Variable Function - 447(r030): 25(ptr) Variable Function - 452(r031): 27(ptr) Variable Function - 457(r032): 27(ptr) Variable Function - 459(r033): 25(ptr) Variable Function - 462(r035): 25(ptr) Variable Function - 466(r036): 25(ptr) Variable Function - 469(r038): 25(ptr) Variable Function - 473(r039): 472(ptr) Variable Function - 476(r040): 472(ptr) Variable Function - 479(r041): 25(ptr) Variable Function - 483(r039a): 25(ptr) Variable Function - 488(r042): 7(ptr) Variable Function - 491(r043): 25(ptr) Variable Function - 494(r044): 25(ptr) Variable Function - 498(r045): 25(ptr) Variable Function - 501(r046): 25(ptr) Variable Function - 505(r047): 25(ptr) Variable Function - 509(r048): 25(ptr) Variable Function - 512(r049): 25(ptr) Variable Function - 516(r050): 25(ptr) Variable Function - 519(r051): 25(ptr) Variable Function - 523(r052): 25(ptr) Variable Function - 527(r053): 25(ptr) Variable Function - 532(r054): 27(ptr) Variable Function - 537(r055): 25(ptr) Variable Function - 540(r056): 25(ptr) Variable Function - 543(r057): 25(ptr) Variable Function - 548(r058): 25(ptr) Variable Function - 551(r059): 25(ptr) Variable Function - 558(r060): 25(ptr) Variable Function - 561(r061): 25(ptr) Variable Function - 566(r062): 25(ptr) Variable Function - 569(r063): 25(ptr) Variable Function - 573(r064): 25(ptr) Variable Function - 576(r065): 25(ptr) Variable Function - 579(r066): 25(ptr) Variable Function - 344: 24(fvec2) Load 29(inF0) - 347: 345(bvec2) FOrdNotEqual 344 346 - 348: 135(bool) All 347 - Store 343(r000) 348 - 350: 24(fvec2) Load 29(inF0) - 351: 24(fvec2) ExtInst 1(GLSL.std.450) 4(FAbs) 350 - Store 349(r001) 351 - 353: 24(fvec2) Load 29(inF0) - 354: 24(fvec2) ExtInst 1(GLSL.std.450) 17(Acos) 353 - Store 352(r002) 354 - 356: 24(fvec2) Load 29(inF0) - 357: 345(bvec2) FOrdNotEqual 356 346 - 358: 135(bool) Any 357 - Store 355(r003) 358 - 360: 24(fvec2) Load 29(inF0) - 361: 24(fvec2) ExtInst 1(GLSL.std.450) 16(Asin) 360 - Store 359(r004) 361 - 365: 24(fvec2) Load 29(inF0) - 366: 362(ivec2) Bitcast 365 - Store 364(r005) 366 - 368: 24(fvec2) Load 29(inF0) - 369: 26(ivec2) Bitcast 368 - Store 367(r006) 369 - 371: 26(ivec2) Load 32(inU0) - 372: 24(fvec2) Bitcast 371 - Store 370(r007) 372 - 374: 24(fvec2) Load 29(inF0) - 375: 24(fvec2) ExtInst 1(GLSL.std.450) 18(Atan) 374 - Store 373(r009) 375 - 377: 24(fvec2) Load 29(inF0) - 378: 24(fvec2) Load 30(inF1) - 379: 24(fvec2) ExtInst 1(GLSL.std.450) 25(Atan2) 377 378 - Store 376(r010) 379 - 381: 24(fvec2) Load 29(inF0) - 382: 24(fvec2) ExtInst 1(GLSL.std.450) 9(Ceil) 381 - Store 380(r011) 382 - 384: 24(fvec2) Load 29(inF0) - 385: 24(fvec2) Load 30(inF1) - 386: 24(fvec2) Load 31(inF2) - 387: 24(fvec2) ExtInst 1(GLSL.std.450) 43(FClamp) 384 385 386 - Store 383(r012) 387 - 388: 24(fvec2) Load 29(inF0) - 389: 345(bvec2) FOrdLessThan 388 346 - 390: 135(bool) Any 389 - SelectionMerge 392 None - BranchConditional 390 391 392 - 391: Label +36(PixelShaderFunction2(vf2;vf2;vf2;vu2;vu2;): 26(fvec2) Function None 30 + 31(inF0): 27(ptr) FunctionParameter + 32(inF1): 27(ptr) FunctionParameter + 33(inF2): 27(ptr) FunctionParameter + 34(inU0): 29(ptr) FunctionParameter + 35(inU1): 29(ptr) FunctionParameter + 37: Label + 347(r000): 138(ptr) Variable Function + 353(r001): 27(ptr) Variable Function + 356(r002): 27(ptr) Variable Function + 359(r003): 138(ptr) Variable Function + 363(r004): 27(ptr) Variable Function + 368(r005): 367(ptr) Variable Function + 371(r006): 29(ptr) Variable Function + 374(r007): 27(ptr) Variable Function + 377(r009): 27(ptr) Variable Function + 380(r010): 27(ptr) Variable Function + 384(r011): 27(ptr) Variable Function + 387(r012): 27(ptr) Variable Function + 406(r013): 27(ptr) Variable Function + 409(r015): 27(ptr) Variable Function + 412(r016): 367(ptr) Variable Function + 416(r017): 27(ptr) Variable Function + 419(r018): 27(ptr) Variable Function + 422(r019): 27(ptr) Variable Function + 425(r020): 27(ptr) Variable Function + 428(r021): 27(ptr) Variable Function + 431(r022): 27(ptr) Variable Function + 434(r023): 27(ptr) Variable Function + 437(r026): 7(ptr) Variable Function + 441(r027): 7(ptr) Variable Function + 445(r028): 27(ptr) Variable Function + 448(r029): 27(ptr) Variable Function + 451(r030): 27(ptr) Variable Function + 456(r031): 29(ptr) Variable Function + 461(r032): 29(ptr) Variable Function + 463(r033): 27(ptr) Variable Function + 466(r035): 27(ptr) Variable Function + 470(r036): 27(ptr) Variable Function + 473(r038): 27(ptr) Variable Function + 477(r039): 476(ptr) Variable Function + 480(r040): 476(ptr) Variable Function + 483(r041): 27(ptr) Variable Function + 487(r039a): 27(ptr) Variable Function + 492(r042): 7(ptr) Variable Function + 495(r043): 27(ptr) Variable Function + 498(r044): 27(ptr) Variable Function + 502(r045): 27(ptr) Variable Function + 505(r046): 27(ptr) Variable Function + 509(r047): 27(ptr) Variable Function + 513(r048): 27(ptr) Variable Function + 516(r049): 27(ptr) Variable Function + 520(r050): 27(ptr) Variable Function + 523(r051): 27(ptr) Variable Function + 527(r052): 27(ptr) Variable Function + 531(r053): 27(ptr) Variable Function + 536(r054): 29(ptr) Variable Function + 541(r055): 27(ptr) Variable Function + 544(r056): 27(ptr) Variable Function + 547(r057): 27(ptr) Variable Function + 552(r058): 27(ptr) Variable Function + 555(r059): 27(ptr) Variable Function + 562(r060): 27(ptr) Variable Function + 565(r061): 27(ptr) Variable Function + 570(r062): 27(ptr) Variable Function + 573(r063): 27(ptr) Variable Function + 577(r064): 27(ptr) Variable Function + 580(r065): 27(ptr) Variable Function + 583(r066): 27(ptr) Variable Function + 348: 26(fvec2) Load 31(inF0) + 351: 349(bvec2) FOrdNotEqual 348 350 + 352: 137(bool) All 351 + Store 347(r000) 352 + 354: 26(fvec2) Load 31(inF0) + 355: 26(fvec2) ExtInst 1(GLSL.std.450) 4(FAbs) 354 + Store 353(r001) 355 + 357: 26(fvec2) Load 31(inF0) + 358: 26(fvec2) ExtInst 1(GLSL.std.450) 17(Acos) 357 + Store 356(r002) 358 + 360: 26(fvec2) Load 31(inF0) + 361: 349(bvec2) FOrdNotEqual 360 350 + 362: 137(bool) Any 361 + Store 359(r003) 362 + 364: 26(fvec2) Load 31(inF0) + 365: 26(fvec2) ExtInst 1(GLSL.std.450) 16(Asin) 364 + Store 363(r004) 365 + 369: 26(fvec2) Load 31(inF0) + 370: 366(ivec2) Bitcast 369 + Store 368(r005) 370 + 372: 26(fvec2) Load 31(inF0) + 373: 28(ivec2) Bitcast 372 + Store 371(r006) 373 + 375: 28(ivec2) Load 34(inU0) + 376: 26(fvec2) Bitcast 375 + Store 374(r007) 376 + 378: 26(fvec2) Load 31(inF0) + 379: 26(fvec2) ExtInst 1(GLSL.std.450) 18(Atan) 378 + Store 377(r009) 379 + 381: 26(fvec2) Load 31(inF0) + 382: 26(fvec2) Load 32(inF1) + 383: 26(fvec2) ExtInst 1(GLSL.std.450) 25(Atan2) 381 382 + Store 380(r010) 383 + 385: 26(fvec2) Load 31(inF0) + 386: 26(fvec2) ExtInst 1(GLSL.std.450) 9(Ceil) 385 + Store 384(r011) 386 + 388: 26(fvec2) Load 31(inF0) + 389: 26(fvec2) Load 32(inF1) + 390: 26(fvec2) Load 33(inF2) + 391: 26(fvec2) ExtInst 1(GLSL.std.450) 43(FClamp) 388 389 390 + Store 387(r012) 391 + 392: 26(fvec2) Load 31(inF0) + 393: 349(bvec2) FOrdLessThan 392 350 + 394: 137(bool) Any 393 + SelectionMerge 396 None + BranchConditional 394 395 396 + 395: Label Kill - 392: Label - 394: 26(ivec2) Load 32(inU0) - 397: 345(bvec2) ULessThan 394 396 - 398: 135(bool) Any 397 - SelectionMerge 400 None - BranchConditional 398 399 400 - 399: Label + 396: Label + 398: 28(ivec2) Load 34(inU0) + 401: 349(bvec2) ULessThan 398 400 + 402: 137(bool) Any 401 + SelectionMerge 404 None + BranchConditional 402 403 404 + 403: Label Kill - 400: Label - 403: 24(fvec2) Load 29(inF0) - 404: 24(fvec2) ExtInst 1(GLSL.std.450) 14(Cos) 403 - Store 402(r013) 404 - 406: 24(fvec2) Load 29(inF0) - 407: 24(fvec2) ExtInst 1(GLSL.std.450) 20(Cosh) 406 - Store 405(r015) 407 - 411: 362(ivec2) BitCount 410 - Store 408(r016) 411 - 413: 24(fvec2) Load 29(inF0) - 414: 24(fvec2) DPdx 413 - Store 412(r017) 414 - 416: 24(fvec2) Load 29(inF0) - 417: 24(fvec2) DPdxCoarse 416 - Store 415(r018) 417 - 419: 24(fvec2) Load 29(inF0) - 420: 24(fvec2) DPdxFine 419 - Store 418(r019) 420 - 422: 24(fvec2) Load 29(inF0) - 423: 24(fvec2) DPdy 422 - Store 421(r020) 423 - 425: 24(fvec2) Load 29(inF0) - 426: 24(fvec2) DPdyCoarse 425 - Store 424(r021) 426 - 428: 24(fvec2) Load 29(inF0) - 429: 24(fvec2) DPdyFine 428 - Store 427(r022) 429 - 431: 24(fvec2) Load 29(inF0) - 432: 24(fvec2) ExtInst 1(GLSL.std.450) 12(Degrees) 431 - Store 430(r023) 432 - 434: 24(fvec2) Load 29(inF0) - 435: 24(fvec2) Load 30(inF1) - 436: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 434 435 - Store 433(r026) 436 - 438: 24(fvec2) Load 29(inF0) - 439: 24(fvec2) Load 30(inF1) - 440: 6(float) Dot 438 439 - Store 437(r027) 440 - 442: 24(fvec2) Load 29(inF0) - 443: 24(fvec2) ExtInst 1(GLSL.std.450) 27(Exp) 442 - Store 441(r028) 443 - 445: 24(fvec2) Load 29(inF0) - 446: 24(fvec2) ExtInst 1(GLSL.std.450) 29(Exp2) 445 - Store 444(r029) 446 - 448: 24(fvec2) Load 29(inF0) - 449: 24(fvec2) Load 30(inF1) - 450: 24(fvec2) Load 31(inF2) - 451: 24(fvec2) ExtInst 1(GLSL.std.450) 70(FaceForward) 448 449 450 - Store 447(r030) 451 - 456: 26(ivec2) ExtInst 1(GLSL.std.450) 75(FindUMsb) 455 - Store 452(r031) 456 - 458: 26(ivec2) ExtInst 1(GLSL.std.450) 73(FindILsb) 455 - Store 457(r032) 458 - 460: 24(fvec2) Load 29(inF0) - 461: 24(fvec2) ExtInst 1(GLSL.std.450) 8(Floor) 460 - Store 459(r033) 461 - 463: 24(fvec2) Load 29(inF0) - 464: 24(fvec2) Load 30(inF1) - 465: 24(fvec2) FMod 463 464 - Store 462(r035) 465 - 467: 24(fvec2) Load 29(inF0) - 468: 24(fvec2) ExtInst 1(GLSL.std.450) 10(Fract) 467 - Store 466(r036) 468 - 470: 24(fvec2) Load 29(inF0) - 471: 24(fvec2) Fwidth 470 - Store 469(r038) 471 - 474: 24(fvec2) Load 29(inF0) - 475: 345(bvec2) IsInf 474 - Store 473(r039) 475 - 477: 24(fvec2) Load 29(inF0) - 478: 345(bvec2) IsNan 477 - Store 476(r040) 478 - 480: 24(fvec2) Load 29(inF0) - 481: 24(fvec2) Load 30(inF1) - 482: 24(fvec2) ExtInst 1(GLSL.std.450) 53(Ldexp) 480 481 - Store 479(r041) 482 - 484: 24(fvec2) Load 29(inF0) - 485: 24(fvec2) Load 30(inF1) - 486: 24(fvec2) Load 31(inF2) - 487: 24(fvec2) ExtInst 1(GLSL.std.450) 46(FMix) 484 485 486 - Store 483(r039a) 487 - 489: 24(fvec2) Load 29(inF0) - 490: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 489 - Store 488(r042) 490 - 492: 24(fvec2) Load 29(inF0) - 493: 24(fvec2) ExtInst 1(GLSL.std.450) 28(Log) 492 - Store 491(r043) 493 - 495: 24(fvec2) Load 29(inF0) - 496: 24(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 495 - 497: 24(fvec2) VectorTimesScalar 496 268 - Store 494(r044) 497 - 499: 24(fvec2) Load 29(inF0) - 500: 24(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 499 - Store 498(r045) 500 - 502: 24(fvec2) Load 29(inF0) - 503: 24(fvec2) Load 30(inF1) - 504: 24(fvec2) ExtInst 1(GLSL.std.450) 40(FMax) 502 503 - Store 501(r046) 504 - 506: 24(fvec2) Load 29(inF0) - 507: 24(fvec2) Load 30(inF1) - 508: 24(fvec2) ExtInst 1(GLSL.std.450) 37(FMin) 506 507 - Store 505(r047) 508 - 510: 24(fvec2) Load 29(inF0) - 511: 24(fvec2) ExtInst 1(GLSL.std.450) 69(Normalize) 510 - Store 509(r048) 511 - 513: 24(fvec2) Load 29(inF0) - 514: 24(fvec2) Load 30(inF1) - 515: 24(fvec2) ExtInst 1(GLSL.std.450) 26(Pow) 513 514 - Store 512(r049) 515 - 517: 24(fvec2) Load 29(inF0) - 518: 24(fvec2) ExtInst 1(GLSL.std.450) 11(Radians) 517 - Store 516(r050) 518 - 520: 24(fvec2) Load 29(inF0) - 521: 24(fvec2) CompositeConstruct 289 289 - 522: 24(fvec2) FDiv 521 520 - Store 519(r051) 522 - 524: 24(fvec2) Load 29(inF0) - 525: 24(fvec2) Load 30(inF1) - 526: 24(fvec2) ExtInst 1(GLSL.std.450) 71(Reflect) 524 525 - Store 523(r052) 526 - 528: 24(fvec2) Load 29(inF0) - 529: 24(fvec2) Load 30(inF1) - 531: 24(fvec2) ExtInst 1(GLSL.std.450) 72(Refract) 528 529 530 - Store 527(r053) 531 - 536: 26(ivec2) BitReverse 535 - Store 532(r054) 536 - 538: 24(fvec2) Load 29(inF0) - 539: 24(fvec2) ExtInst 1(GLSL.std.450) 2(RoundEven) 538 - Store 537(r055) 539 - 541: 24(fvec2) Load 29(inF0) - 542: 24(fvec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 541 - Store 540(r056) 542 - 544: 24(fvec2) Load 29(inF0) - 545: 24(fvec2) CompositeConstruct 139 139 - 546: 24(fvec2) CompositeConstruct 289 289 - 547: 24(fvec2) ExtInst 1(GLSL.std.450) 43(FClamp) 544 545 546 - Store 543(r057) 547 - 549: 24(fvec2) Load 29(inF0) - 550: 24(fvec2) ExtInst 1(GLSL.std.450) 6(FSign) 549 - Store 548(r058) 550 - 552: 24(fvec2) Load 29(inF0) - 553: 24(fvec2) ExtInst 1(GLSL.std.450) 13(Sin) 552 - Store 551(r059) 553 - 554: 24(fvec2) Load 29(inF0) - 555: 24(fvec2) ExtInst 1(GLSL.std.450) 13(Sin) 554 - Store 30(inF1) 555 - 556: 24(fvec2) Load 29(inF0) - 557: 24(fvec2) ExtInst 1(GLSL.std.450) 14(Cos) 556 - Store 31(inF2) 557 - 559: 24(fvec2) Load 29(inF0) - 560: 24(fvec2) ExtInst 1(GLSL.std.450) 19(Sinh) 559 - Store 558(r060) 560 - 562: 24(fvec2) Load 29(inF0) - 563: 24(fvec2) Load 30(inF1) - 564: 24(fvec2) Load 31(inF2) - 565: 24(fvec2) ExtInst 1(GLSL.std.450) 49(SmoothStep) 562 563 564 - Store 561(r061) 565 - 567: 24(fvec2) Load 29(inF0) - 568: 24(fvec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 567 - Store 566(r062) 568 - 570: 24(fvec2) Load 29(inF0) - 571: 24(fvec2) Load 30(inF1) - 572: 24(fvec2) ExtInst 1(GLSL.std.450) 48(Step) 570 571 - Store 569(r063) 572 - 574: 24(fvec2) Load 29(inF0) - 575: 24(fvec2) ExtInst 1(GLSL.std.450) 15(Tan) 574 - Store 573(r064) 575 - 577: 24(fvec2) Load 29(inF0) - 578: 24(fvec2) ExtInst 1(GLSL.std.450) 21(Tanh) 577 - Store 576(r065) 578 - 580: 24(fvec2) Load 29(inF0) - 581: 24(fvec2) ExtInst 1(GLSL.std.450) 3(Trunc) 580 - Store 579(r066) 581 - ReturnValue 582 + 404: Label + 407: 26(fvec2) Load 31(inF0) + 408: 26(fvec2) ExtInst 1(GLSL.std.450) 14(Cos) 407 + Store 406(r013) 408 + 410: 26(fvec2) Load 31(inF0) + 411: 26(fvec2) ExtInst 1(GLSL.std.450) 20(Cosh) 410 + Store 409(r015) 411 + 415: 366(ivec2) BitCount 414 + Store 412(r016) 415 + 417: 26(fvec2) Load 31(inF0) + 418: 26(fvec2) DPdx 417 + Store 416(r017) 418 + 420: 26(fvec2) Load 31(inF0) + 421: 26(fvec2) DPdxCoarse 420 + Store 419(r018) 421 + 423: 26(fvec2) Load 31(inF0) + 424: 26(fvec2) DPdxFine 423 + Store 422(r019) 424 + 426: 26(fvec2) Load 31(inF0) + 427: 26(fvec2) DPdy 426 + Store 425(r020) 427 + 429: 26(fvec2) Load 31(inF0) + 430: 26(fvec2) DPdyCoarse 429 + Store 428(r021) 430 + 432: 26(fvec2) Load 31(inF0) + 433: 26(fvec2) DPdyFine 432 + Store 431(r022) 433 + 435: 26(fvec2) Load 31(inF0) + 436: 26(fvec2) ExtInst 1(GLSL.std.450) 12(Degrees) 435 + Store 434(r023) 436 + 438: 26(fvec2) Load 31(inF0) + 439: 26(fvec2) Load 32(inF1) + 440: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 438 439 + Store 437(r026) 440 + 442: 26(fvec2) Load 31(inF0) + 443: 26(fvec2) Load 32(inF1) + 444: 6(float) Dot 442 443 + Store 441(r027) 444 + 446: 26(fvec2) Load 31(inF0) + 447: 26(fvec2) ExtInst 1(GLSL.std.450) 27(Exp) 446 + Store 445(r028) 447 + 449: 26(fvec2) Load 31(inF0) + 450: 26(fvec2) ExtInst 1(GLSL.std.450) 29(Exp2) 449 + Store 448(r029) 450 + 452: 26(fvec2) Load 31(inF0) + 453: 26(fvec2) Load 32(inF1) + 454: 26(fvec2) Load 33(inF2) + 455: 26(fvec2) ExtInst 1(GLSL.std.450) 70(FaceForward) 452 453 454 + Store 451(r030) 455 + 460: 28(ivec2) ExtInst 1(GLSL.std.450) 75(FindUMsb) 459 + Store 456(r031) 460 + 462: 28(ivec2) ExtInst 1(GLSL.std.450) 73(FindILsb) 459 + Store 461(r032) 462 + 464: 26(fvec2) Load 31(inF0) + 465: 26(fvec2) ExtInst 1(GLSL.std.450) 8(Floor) 464 + Store 463(r033) 465 + 467: 26(fvec2) Load 31(inF0) + 468: 26(fvec2) Load 32(inF1) + 469: 26(fvec2) FMod 467 468 + Store 466(r035) 469 + 471: 26(fvec2) Load 31(inF0) + 472: 26(fvec2) ExtInst 1(GLSL.std.450) 10(Fract) 471 + Store 470(r036) 472 + 474: 26(fvec2) Load 31(inF0) + 475: 26(fvec2) Fwidth 474 + Store 473(r038) 475 + 478: 26(fvec2) Load 31(inF0) + 479: 349(bvec2) IsInf 478 + Store 477(r039) 479 + 481: 26(fvec2) Load 31(inF0) + 482: 349(bvec2) IsNan 481 + Store 480(r040) 482 + 484: 26(fvec2) Load 31(inF0) + 485: 26(fvec2) Load 32(inF1) + 486: 26(fvec2) ExtInst 1(GLSL.std.450) 53(Ldexp) 484 485 + Store 483(r041) 486 + 488: 26(fvec2) Load 31(inF0) + 489: 26(fvec2) Load 32(inF1) + 490: 26(fvec2) Load 33(inF2) + 491: 26(fvec2) ExtInst 1(GLSL.std.450) 46(FMix) 488 489 490 + Store 487(r039a) 491 + 493: 26(fvec2) Load 31(inF0) + 494: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 493 + Store 492(r042) 494 + 496: 26(fvec2) Load 31(inF0) + 497: 26(fvec2) ExtInst 1(GLSL.std.450) 28(Log) 496 + Store 495(r043) 497 + 499: 26(fvec2) Load 31(inF0) + 500: 26(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 499 + 501: 26(fvec2) VectorTimesScalar 500 272 + Store 498(r044) 501 + 503: 26(fvec2) Load 31(inF0) + 504: 26(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 503 + Store 502(r045) 504 + 506: 26(fvec2) Load 31(inF0) + 507: 26(fvec2) Load 32(inF1) + 508: 26(fvec2) ExtInst 1(GLSL.std.450) 40(FMax) 506 507 + Store 505(r046) 508 + 510: 26(fvec2) Load 31(inF0) + 511: 26(fvec2) Load 32(inF1) + 512: 26(fvec2) ExtInst 1(GLSL.std.450) 37(FMin) 510 511 + Store 509(r047) 512 + 514: 26(fvec2) Load 31(inF0) + 515: 26(fvec2) ExtInst 1(GLSL.std.450) 69(Normalize) 514 + Store 513(r048) 515 + 517: 26(fvec2) Load 31(inF0) + 518: 26(fvec2) Load 32(inF1) + 519: 26(fvec2) ExtInst 1(GLSL.std.450) 26(Pow) 517 518 + Store 516(r049) 519 + 521: 26(fvec2) Load 31(inF0) + 522: 26(fvec2) ExtInst 1(GLSL.std.450) 11(Radians) 521 + Store 520(r050) 522 + 524: 26(fvec2) Load 31(inF0) + 525: 26(fvec2) CompositeConstruct 293 293 + 526: 26(fvec2) FDiv 525 524 + Store 523(r051) 526 + 528: 26(fvec2) Load 31(inF0) + 529: 26(fvec2) Load 32(inF1) + 530: 26(fvec2) ExtInst 1(GLSL.std.450) 71(Reflect) 528 529 + Store 527(r052) 530 + 532: 26(fvec2) Load 31(inF0) + 533: 26(fvec2) Load 32(inF1) + 535: 26(fvec2) ExtInst 1(GLSL.std.450) 72(Refract) 532 533 534 + Store 531(r053) 535 + 540: 28(ivec2) BitReverse 539 + Store 536(r054) 540 + 542: 26(fvec2) Load 31(inF0) + 543: 26(fvec2) ExtInst 1(GLSL.std.450) 2(RoundEven) 542 + Store 541(r055) 543 + 545: 26(fvec2) Load 31(inF0) + 546: 26(fvec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 545 + Store 544(r056) 546 + 548: 26(fvec2) Load 31(inF0) + 549: 26(fvec2) CompositeConstruct 141 141 + 550: 26(fvec2) CompositeConstruct 293 293 + 551: 26(fvec2) ExtInst 1(GLSL.std.450) 43(FClamp) 548 549 550 + Store 547(r057) 551 + 553: 26(fvec2) Load 31(inF0) + 554: 26(fvec2) ExtInst 1(GLSL.std.450) 6(FSign) 553 + Store 552(r058) 554 + 556: 26(fvec2) Load 31(inF0) + 557: 26(fvec2) ExtInst 1(GLSL.std.450) 13(Sin) 556 + Store 555(r059) 557 + 558: 26(fvec2) Load 31(inF0) + 559: 26(fvec2) ExtInst 1(GLSL.std.450) 13(Sin) 558 + Store 32(inF1) 559 + 560: 26(fvec2) Load 31(inF0) + 561: 26(fvec2) ExtInst 1(GLSL.std.450) 14(Cos) 560 + Store 33(inF2) 561 + 563: 26(fvec2) Load 31(inF0) + 564: 26(fvec2) ExtInst 1(GLSL.std.450) 19(Sinh) 563 + Store 562(r060) 564 + 566: 26(fvec2) Load 31(inF0) + 567: 26(fvec2) Load 32(inF1) + 568: 26(fvec2) Load 33(inF2) + 569: 26(fvec2) ExtInst 1(GLSL.std.450) 49(SmoothStep) 566 567 568 + Store 565(r061) 569 + 571: 26(fvec2) Load 31(inF0) + 572: 26(fvec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 571 + Store 570(r062) 572 + 574: 26(fvec2) Load 31(inF0) + 575: 26(fvec2) Load 32(inF1) + 576: 26(fvec2) ExtInst 1(GLSL.std.450) 48(Step) 574 575 + Store 573(r063) 576 + 578: 26(fvec2) Load 31(inF0) + 579: 26(fvec2) ExtInst 1(GLSL.std.450) 15(Tan) 578 + Store 577(r064) 579 + 581: 26(fvec2) Load 31(inF0) + 582: 26(fvec2) ExtInst 1(GLSL.std.450) 21(Tanh) 581 + Store 580(r065) 582 + 584: 26(fvec2) Load 31(inF0) + 585: 26(fvec2) ExtInst 1(GLSL.std.450) 3(Trunc) 584 + Store 583(r066) 585 + ReturnValue 586 FunctionEnd -46(PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3;): 36(fvec3) Function None 40 - 41(inF0): 37(ptr) FunctionParameter - 42(inF1): 37(ptr) FunctionParameter - 43(inF2): 37(ptr) FunctionParameter - 44(inU0): 39(ptr) FunctionParameter - 45(inU1): 39(ptr) FunctionParameter - 47: Label - 585(r000): 136(ptr) Variable Function - 591(r001): 37(ptr) Variable Function - 594(r002): 37(ptr) Variable Function - 597(r003): 136(ptr) Variable Function - 601(r004): 37(ptr) Variable Function - 606(r005): 605(ptr) Variable Function - 609(r006): 39(ptr) Variable Function - 612(r007): 37(ptr) Variable Function - 615(r009): 37(ptr) Variable Function - 618(r010): 37(ptr) Variable Function - 622(r011): 37(ptr) Variable Function - 625(r012): 37(ptr) Variable Function - 643(r013): 37(ptr) Variable Function - 646(r014): 37(ptr) Variable Function - 649(r015): 39(ptr) Variable Function - 654(r016): 37(ptr) Variable Function - 658(r017): 37(ptr) Variable Function - 661(r018): 37(ptr) Variable Function - 664(r019): 37(ptr) Variable Function - 667(r020): 37(ptr) Variable Function - 670(r021): 37(ptr) Variable Function - 673(r022): 37(ptr) Variable Function - 676(r023): 37(ptr) Variable Function - 679(r024): 7(ptr) Variable Function - 683(r025): 7(ptr) Variable Function - 687(r029): 37(ptr) Variable Function - 690(r030): 37(ptr) Variable Function - 693(r031): 37(ptr) Variable Function - 698(r032): 39(ptr) Variable Function - 702(r033): 39(ptr) Variable Function - 704(r034): 37(ptr) Variable Function - 707(r036): 37(ptr) Variable Function - 711(r037): 37(ptr) Variable Function - 714(r039): 37(ptr) Variable Function - 718(r040): 717(ptr) Variable Function - 721(r041): 717(ptr) Variable Function - 724(r042): 37(ptr) Variable Function - 728(r039a): 37(ptr) Variable Function - 733(r039b): 37(ptr) Variable Function - 739(r043): 7(ptr) Variable Function - 742(r044): 37(ptr) Variable Function - 745(r045): 37(ptr) Variable Function - 749(r046): 37(ptr) Variable Function - 752(r047): 37(ptr) Variable Function - 756(r048): 37(ptr) Variable Function - 760(r049): 37(ptr) Variable Function - 763(r050): 37(ptr) Variable Function - 767(r051): 37(ptr) Variable Function - 770(r052): 37(ptr) Variable Function - 774(r053): 37(ptr) Variable Function - 778(r054): 37(ptr) Variable Function - 782(r055): 39(ptr) Variable Function - 785(r056): 37(ptr) Variable Function - 788(r057): 37(ptr) Variable Function - 791(r058): 37(ptr) Variable Function - 796(r059): 37(ptr) Variable Function - 799(r060): 37(ptr) Variable Function - 806(r061): 37(ptr) Variable Function - 809(r062): 37(ptr) Variable Function - 814(r063): 37(ptr) Variable Function - 817(r064): 37(ptr) Variable Function - 821(r065): 37(ptr) Variable Function - 824(r066): 37(ptr) Variable Function - 827(r067): 37(ptr) Variable Function - 586: 36(fvec3) Load 41(inF0) - 589: 587(bvec3) FOrdNotEqual 586 588 - 590: 135(bool) All 589 - Store 585(r000) 590 - 592: 36(fvec3) Load 41(inF0) - 593: 36(fvec3) ExtInst 1(GLSL.std.450) 4(FAbs) 592 - Store 591(r001) 593 - 595: 36(fvec3) Load 41(inF0) - 596: 36(fvec3) ExtInst 1(GLSL.std.450) 17(Acos) 595 - Store 594(r002) 596 - 598: 36(fvec3) Load 41(inF0) - 599: 587(bvec3) FOrdNotEqual 598 588 - 600: 135(bool) Any 599 - Store 597(r003) 600 - 602: 36(fvec3) Load 41(inF0) - 603: 36(fvec3) ExtInst 1(GLSL.std.450) 16(Asin) 602 - Store 601(r004) 603 - 607: 36(fvec3) Load 41(inF0) - 608: 604(ivec3) Bitcast 607 - Store 606(r005) 608 - 610: 36(fvec3) Load 41(inF0) - 611: 38(ivec3) Bitcast 610 - Store 609(r006) 611 - 613: 38(ivec3) Load 44(inU0) - 614: 36(fvec3) Bitcast 613 - Store 612(r007) 614 - 616: 36(fvec3) Load 41(inF0) - 617: 36(fvec3) ExtInst 1(GLSL.std.450) 18(Atan) 616 - Store 615(r009) 617 - 619: 36(fvec3) Load 41(inF0) - 620: 36(fvec3) Load 42(inF1) - 621: 36(fvec3) ExtInst 1(GLSL.std.450) 25(Atan2) 619 620 - Store 618(r010) 621 - 623: 36(fvec3) Load 41(inF0) - 624: 36(fvec3) ExtInst 1(GLSL.std.450) 9(Ceil) 623 - Store 622(r011) 624 - 626: 36(fvec3) Load 41(inF0) - 627: 36(fvec3) Load 42(inF1) - 628: 36(fvec3) Load 43(inF2) - 629: 36(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 626 627 628 - Store 625(r012) 629 - 630: 36(fvec3) Load 41(inF0) - 631: 587(bvec3) FOrdLessThan 630 588 - 632: 135(bool) Any 631 - SelectionMerge 634 None - BranchConditional 632 633 634 - 633: Label +48(PixelShaderFunction3(vf3;vf3;vf3;vu3;vu3;): 38(fvec3) Function None 42 + 43(inF0): 39(ptr) FunctionParameter + 44(inF1): 39(ptr) FunctionParameter + 45(inF2): 39(ptr) FunctionParameter + 46(inU0): 41(ptr) FunctionParameter + 47(inU1): 41(ptr) FunctionParameter + 49: Label + 589(r000): 138(ptr) Variable Function + 595(r001): 39(ptr) Variable Function + 598(r002): 39(ptr) Variable Function + 601(r003): 138(ptr) Variable Function + 605(r004): 39(ptr) Variable Function + 610(r005): 609(ptr) Variable Function + 613(r006): 41(ptr) Variable Function + 616(r007): 39(ptr) Variable Function + 619(r009): 39(ptr) Variable Function + 622(r010): 39(ptr) Variable Function + 626(r011): 39(ptr) Variable Function + 629(r012): 39(ptr) Variable Function + 647(r013): 39(ptr) Variable Function + 650(r014): 39(ptr) Variable Function + 653(r015): 41(ptr) Variable Function + 658(r016): 39(ptr) Variable Function + 662(r017): 39(ptr) Variable Function + 665(r018): 39(ptr) Variable Function + 668(r019): 39(ptr) Variable Function + 671(r020): 39(ptr) Variable Function + 674(r021): 39(ptr) Variable Function + 677(r022): 39(ptr) Variable Function + 680(r023): 39(ptr) Variable Function + 683(r024): 7(ptr) Variable Function + 687(r025): 7(ptr) Variable Function + 691(r029): 39(ptr) Variable Function + 694(r030): 39(ptr) Variable Function + 697(r031): 39(ptr) Variable Function + 702(r032): 41(ptr) Variable Function + 706(r033): 41(ptr) Variable Function + 708(r034): 39(ptr) Variable Function + 711(r036): 39(ptr) Variable Function + 715(r037): 39(ptr) Variable Function + 718(r039): 39(ptr) Variable Function + 722(r040): 721(ptr) Variable Function + 725(r041): 721(ptr) Variable Function + 728(r042): 39(ptr) Variable Function + 732(r039a): 39(ptr) Variable Function + 737(r039b): 39(ptr) Variable Function + 743(r043): 7(ptr) Variable Function + 746(r044): 39(ptr) Variable Function + 749(r045): 39(ptr) Variable Function + 753(r046): 39(ptr) Variable Function + 756(r047): 39(ptr) Variable Function + 760(r048): 39(ptr) Variable Function + 764(r049): 39(ptr) Variable Function + 767(r050): 39(ptr) Variable Function + 771(r051): 39(ptr) Variable Function + 774(r052): 39(ptr) Variable Function + 778(r053): 39(ptr) Variable Function + 782(r054): 39(ptr) Variable Function + 786(r055): 41(ptr) Variable Function + 789(r056): 39(ptr) Variable Function + 792(r057): 39(ptr) Variable Function + 795(r058): 39(ptr) Variable Function + 800(r059): 39(ptr) Variable Function + 803(r060): 39(ptr) Variable Function + 810(r061): 39(ptr) Variable Function + 813(r062): 39(ptr) Variable Function + 818(r063): 39(ptr) Variable Function + 821(r064): 39(ptr) Variable Function + 825(r065): 39(ptr) Variable Function + 828(r066): 39(ptr) Variable Function + 831(r067): 39(ptr) Variable Function + 590: 38(fvec3) Load 43(inF0) + 593: 591(bvec3) FOrdNotEqual 590 592 + 594: 137(bool) All 593 + Store 589(r000) 594 + 596: 38(fvec3) Load 43(inF0) + 597: 38(fvec3) ExtInst 1(GLSL.std.450) 4(FAbs) 596 + Store 595(r001) 597 + 599: 38(fvec3) Load 43(inF0) + 600: 38(fvec3) ExtInst 1(GLSL.std.450) 17(Acos) 599 + Store 598(r002) 600 + 602: 38(fvec3) Load 43(inF0) + 603: 591(bvec3) FOrdNotEqual 602 592 + 604: 137(bool) Any 603 + Store 601(r003) 604 + 606: 38(fvec3) Load 43(inF0) + 607: 38(fvec3) ExtInst 1(GLSL.std.450) 16(Asin) 606 + Store 605(r004) 607 + 611: 38(fvec3) Load 43(inF0) + 612: 608(ivec3) Bitcast 611 + Store 610(r005) 612 + 614: 38(fvec3) Load 43(inF0) + 615: 40(ivec3) Bitcast 614 + Store 613(r006) 615 + 617: 40(ivec3) Load 46(inU0) + 618: 38(fvec3) Bitcast 617 + Store 616(r007) 618 + 620: 38(fvec3) Load 43(inF0) + 621: 38(fvec3) ExtInst 1(GLSL.std.450) 18(Atan) 620 + Store 619(r009) 621 + 623: 38(fvec3) Load 43(inF0) + 624: 38(fvec3) Load 44(inF1) + 625: 38(fvec3) ExtInst 1(GLSL.std.450) 25(Atan2) 623 624 + Store 622(r010) 625 + 627: 38(fvec3) Load 43(inF0) + 628: 38(fvec3) ExtInst 1(GLSL.std.450) 9(Ceil) 627 + Store 626(r011) 628 + 630: 38(fvec3) Load 43(inF0) + 631: 38(fvec3) Load 44(inF1) + 632: 38(fvec3) Load 45(inF2) + 633: 38(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 630 631 632 + Store 629(r012) 633 + 634: 38(fvec3) Load 43(inF0) + 635: 591(bvec3) FOrdLessThan 634 592 + 636: 137(bool) Any 635 + SelectionMerge 638 None + BranchConditional 636 637 638 + 637: Label Kill - 634: Label - 636: 38(ivec3) Load 44(inU0) - 638: 587(bvec3) ULessThan 636 637 - 639: 135(bool) Any 638 - SelectionMerge 641 None - BranchConditional 639 640 641 - 640: Label + 638: Label + 640: 40(ivec3) Load 46(inU0) + 642: 591(bvec3) ULessThan 640 641 + 643: 137(bool) Any 642 + SelectionMerge 645 None + BranchConditional 643 644 645 + 644: Label Kill - 641: Label - 644: 36(fvec3) Load 41(inF0) - 645: 36(fvec3) ExtInst 1(GLSL.std.450) 14(Cos) 644 - Store 643(r013) 645 - 647: 36(fvec3) Load 41(inF0) - 648: 36(fvec3) ExtInst 1(GLSL.std.450) 20(Cosh) 647 - Store 646(r014) 648 - 653: 38(ivec3) BitCount 652 - Store 649(r015) 653 - 655: 36(fvec3) Load 41(inF0) - 656: 36(fvec3) Load 42(inF1) - 657: 36(fvec3) ExtInst 1(GLSL.std.450) 68(Cross) 655 656 - Store 654(r016) 657 - 659: 36(fvec3) Load 41(inF0) - 660: 36(fvec3) DPdx 659 - Store 658(r017) 660 - 662: 36(fvec3) Load 41(inF0) - 663: 36(fvec3) DPdxCoarse 662 - Store 661(r018) 663 - 665: 36(fvec3) Load 41(inF0) - 666: 36(fvec3) DPdxFine 665 - Store 664(r019) 666 - 668: 36(fvec3) Load 41(inF0) - 669: 36(fvec3) DPdy 668 - Store 667(r020) 669 - 671: 36(fvec3) Load 41(inF0) - 672: 36(fvec3) DPdyCoarse 671 - Store 670(r021) 672 - 674: 36(fvec3) Load 41(inF0) - 675: 36(fvec3) DPdyFine 674 - Store 673(r022) 675 - 677: 36(fvec3) Load 41(inF0) - 678: 36(fvec3) ExtInst 1(GLSL.std.450) 12(Degrees) 677 - Store 676(r023) 678 - 680: 36(fvec3) Load 41(inF0) - 681: 36(fvec3) Load 42(inF1) - 682: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 680 681 - Store 679(r024) 682 - 684: 36(fvec3) Load 41(inF0) - 685: 36(fvec3) Load 42(inF1) - 686: 6(float) Dot 684 685 - Store 683(r025) 686 - 688: 36(fvec3) Load 41(inF0) - 689: 36(fvec3) ExtInst 1(GLSL.std.450) 27(Exp) 688 - Store 687(r029) 689 - 691: 36(fvec3) Load 41(inF0) - 692: 36(fvec3) ExtInst 1(GLSL.std.450) 29(Exp2) 691 - Store 690(r030) 692 - 694: 36(fvec3) Load 41(inF0) - 695: 36(fvec3) Load 42(inF1) - 696: 36(fvec3) Load 43(inF2) - 697: 36(fvec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 694 695 696 - Store 693(r031) 697 - 701: 38(ivec3) ExtInst 1(GLSL.std.450) 75(FindUMsb) 700 - Store 698(r032) 701 - 703: 38(ivec3) ExtInst 1(GLSL.std.450) 73(FindILsb) 700 - Store 702(r033) 703 - 705: 36(fvec3) Load 41(inF0) - 706: 36(fvec3) ExtInst 1(GLSL.std.450) 8(Floor) 705 - Store 704(r034) 706 - 708: 36(fvec3) Load 41(inF0) - 709: 36(fvec3) Load 42(inF1) - 710: 36(fvec3) FMod 708 709 - Store 707(r036) 710 - 712: 36(fvec3) Load 41(inF0) - 713: 36(fvec3) ExtInst 1(GLSL.std.450) 10(Fract) 712 - Store 711(r037) 713 - 715: 36(fvec3) Load 41(inF0) - 716: 36(fvec3) Fwidth 715 - Store 714(r039) 716 - 719: 36(fvec3) Load 41(inF0) - 720: 587(bvec3) IsInf 719 - Store 718(r040) 720 - 722: 36(fvec3) Load 41(inF0) - 723: 587(bvec3) IsNan 722 - Store 721(r041) 723 - 725: 36(fvec3) Load 41(inF0) - 726: 36(fvec3) Load 42(inF1) - 727: 36(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 725 726 - Store 724(r042) 727 - 729: 36(fvec3) Load 41(inF0) - 730: 36(fvec3) Load 42(inF1) - 731: 36(fvec3) Load 43(inF2) - 732: 36(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 729 730 731 - Store 728(r039a) 732 - 734: 36(fvec3) Load 41(inF0) - 735: 36(fvec3) Load 42(inF1) - 737: 36(fvec3) CompositeConstruct 736 736 736 - 738: 36(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 734 735 737 - Store 733(r039b) 738 - 740: 36(fvec3) Load 41(inF0) - 741: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 740 - Store 739(r043) 741 - 743: 36(fvec3) Load 41(inF0) - 744: 36(fvec3) ExtInst 1(GLSL.std.450) 28(Log) 743 - Store 742(r044) 744 - 746: 36(fvec3) Load 41(inF0) - 747: 36(fvec3) ExtInst 1(GLSL.std.450) 30(Log2) 746 - 748: 36(fvec3) VectorTimesScalar 747 268 - Store 745(r045) 748 - 750: 36(fvec3) Load 41(inF0) - 751: 36(fvec3) ExtInst 1(GLSL.std.450) 30(Log2) 750 - Store 749(r046) 751 - 753: 36(fvec3) Load 41(inF0) - 754: 36(fvec3) Load 42(inF1) - 755: 36(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 753 754 - Store 752(r047) 755 - 757: 36(fvec3) Load 41(inF0) - 758: 36(fvec3) Load 42(inF1) - 759: 36(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 757 758 - Store 756(r048) 759 - 761: 36(fvec3) Load 41(inF0) - 762: 36(fvec3) ExtInst 1(GLSL.std.450) 69(Normalize) 761 - Store 760(r049) 762 - 764: 36(fvec3) Load 41(inF0) - 765: 36(fvec3) Load 42(inF1) - 766: 36(fvec3) ExtInst 1(GLSL.std.450) 26(Pow) 764 765 - Store 763(r050) 766 - 768: 36(fvec3) Load 41(inF0) - 769: 36(fvec3) ExtInst 1(GLSL.std.450) 11(Radians) 768 - Store 767(r051) 769 - 771: 36(fvec3) Load 41(inF0) - 772: 36(fvec3) CompositeConstruct 289 289 289 - 773: 36(fvec3) FDiv 772 771 - Store 770(r052) 773 - 775: 36(fvec3) Load 41(inF0) - 776: 36(fvec3) Load 42(inF1) - 777: 36(fvec3) ExtInst 1(GLSL.std.450) 71(Reflect) 775 776 - Store 774(r053) 777 - 779: 36(fvec3) Load 41(inF0) - 780: 36(fvec3) Load 42(inF1) - 781: 36(fvec3) ExtInst 1(GLSL.std.450) 72(Refract) 779 780 530 - Store 778(r054) 781 - 784: 38(ivec3) BitReverse 783 - Store 782(r055) 784 - 786: 36(fvec3) Load 41(inF0) - 787: 36(fvec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 786 - Store 785(r056) 787 - 789: 36(fvec3) Load 41(inF0) - 790: 36(fvec3) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 789 - Store 788(r057) 790 - 792: 36(fvec3) Load 41(inF0) - 793: 36(fvec3) CompositeConstruct 139 139 139 - 794: 36(fvec3) CompositeConstruct 289 289 289 - 795: 36(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 792 793 794 - Store 791(r058) 795 - 797: 36(fvec3) Load 41(inF0) - 798: 36(fvec3) ExtInst 1(GLSL.std.450) 6(FSign) 797 - Store 796(r059) 798 - 800: 36(fvec3) Load 41(inF0) - 801: 36(fvec3) ExtInst 1(GLSL.std.450) 13(Sin) 800 - Store 799(r060) 801 - 802: 36(fvec3) Load 41(inF0) - 803: 36(fvec3) ExtInst 1(GLSL.std.450) 13(Sin) 802 - Store 42(inF1) 803 - 804: 36(fvec3) Load 41(inF0) - 805: 36(fvec3) ExtInst 1(GLSL.std.450) 14(Cos) 804 - Store 43(inF2) 805 - 807: 36(fvec3) Load 41(inF0) - 808: 36(fvec3) ExtInst 1(GLSL.std.450) 19(Sinh) 807 - Store 806(r061) 808 - 810: 36(fvec3) Load 41(inF0) - 811: 36(fvec3) Load 42(inF1) - 812: 36(fvec3) Load 43(inF2) - 813: 36(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 810 811 812 - Store 809(r062) 813 - 815: 36(fvec3) Load 41(inF0) - 816: 36(fvec3) ExtInst 1(GLSL.std.450) 31(Sqrt) 815 - Store 814(r063) 816 - 818: 36(fvec3) Load 41(inF0) - 819: 36(fvec3) Load 42(inF1) - 820: 36(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 818 819 - Store 817(r064) 820 - 822: 36(fvec3) Load 41(inF0) - 823: 36(fvec3) ExtInst 1(GLSL.std.450) 15(Tan) 822 - Store 821(r065) 823 - 825: 36(fvec3) Load 41(inF0) - 826: 36(fvec3) ExtInst 1(GLSL.std.450) 21(Tanh) 825 - Store 824(r066) 826 - 828: 36(fvec3) Load 41(inF0) - 829: 36(fvec3) ExtInst 1(GLSL.std.450) 3(Trunc) 828 - Store 827(r067) 829 - ReturnValue 831 + 645: Label + 648: 38(fvec3) Load 43(inF0) + 649: 38(fvec3) ExtInst 1(GLSL.std.450) 14(Cos) 648 + Store 647(r013) 649 + 651: 38(fvec3) Load 43(inF0) + 652: 38(fvec3) ExtInst 1(GLSL.std.450) 20(Cosh) 651 + Store 650(r014) 652 + 657: 40(ivec3) BitCount 656 + Store 653(r015) 657 + 659: 38(fvec3) Load 43(inF0) + 660: 38(fvec3) Load 44(inF1) + 661: 38(fvec3) ExtInst 1(GLSL.std.450) 68(Cross) 659 660 + Store 658(r016) 661 + 663: 38(fvec3) Load 43(inF0) + 664: 38(fvec3) DPdx 663 + Store 662(r017) 664 + 666: 38(fvec3) Load 43(inF0) + 667: 38(fvec3) DPdxCoarse 666 + Store 665(r018) 667 + 669: 38(fvec3) Load 43(inF0) + 670: 38(fvec3) DPdxFine 669 + Store 668(r019) 670 + 672: 38(fvec3) Load 43(inF0) + 673: 38(fvec3) DPdy 672 + Store 671(r020) 673 + 675: 38(fvec3) Load 43(inF0) + 676: 38(fvec3) DPdyCoarse 675 + Store 674(r021) 676 + 678: 38(fvec3) Load 43(inF0) + 679: 38(fvec3) DPdyFine 678 + Store 677(r022) 679 + 681: 38(fvec3) Load 43(inF0) + 682: 38(fvec3) ExtInst 1(GLSL.std.450) 12(Degrees) 681 + Store 680(r023) 682 + 684: 38(fvec3) Load 43(inF0) + 685: 38(fvec3) Load 44(inF1) + 686: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 684 685 + Store 683(r024) 686 + 688: 38(fvec3) Load 43(inF0) + 689: 38(fvec3) Load 44(inF1) + 690: 6(float) Dot 688 689 + Store 687(r025) 690 + 692: 38(fvec3) Load 43(inF0) + 693: 38(fvec3) ExtInst 1(GLSL.std.450) 27(Exp) 692 + Store 691(r029) 693 + 695: 38(fvec3) Load 43(inF0) + 696: 38(fvec3) ExtInst 1(GLSL.std.450) 29(Exp2) 695 + Store 694(r030) 696 + 698: 38(fvec3) Load 43(inF0) + 699: 38(fvec3) Load 44(inF1) + 700: 38(fvec3) Load 45(inF2) + 701: 38(fvec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 698 699 700 + Store 697(r031) 701 + 705: 40(ivec3) ExtInst 1(GLSL.std.450) 75(FindUMsb) 704 + Store 702(r032) 705 + 707: 40(ivec3) ExtInst 1(GLSL.std.450) 73(FindILsb) 704 + Store 706(r033) 707 + 709: 38(fvec3) Load 43(inF0) + 710: 38(fvec3) ExtInst 1(GLSL.std.450) 8(Floor) 709 + Store 708(r034) 710 + 712: 38(fvec3) Load 43(inF0) + 713: 38(fvec3) Load 44(inF1) + 714: 38(fvec3) FMod 712 713 + Store 711(r036) 714 + 716: 38(fvec3) Load 43(inF0) + 717: 38(fvec3) ExtInst 1(GLSL.std.450) 10(Fract) 716 + Store 715(r037) 717 + 719: 38(fvec3) Load 43(inF0) + 720: 38(fvec3) Fwidth 719 + Store 718(r039) 720 + 723: 38(fvec3) Load 43(inF0) + 724: 591(bvec3) IsInf 723 + Store 722(r040) 724 + 726: 38(fvec3) Load 43(inF0) + 727: 591(bvec3) IsNan 726 + Store 725(r041) 727 + 729: 38(fvec3) Load 43(inF0) + 730: 38(fvec3) Load 44(inF1) + 731: 38(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 729 730 + Store 728(r042) 731 + 733: 38(fvec3) Load 43(inF0) + 734: 38(fvec3) Load 44(inF1) + 735: 38(fvec3) Load 45(inF2) + 736: 38(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 733 734 735 + Store 732(r039a) 736 + 738: 38(fvec3) Load 43(inF0) + 739: 38(fvec3) Load 44(inF1) + 741: 38(fvec3) CompositeConstruct 740 740 740 + 742: 38(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 738 739 741 + Store 737(r039b) 742 + 744: 38(fvec3) Load 43(inF0) + 745: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 744 + Store 743(r043) 745 + 747: 38(fvec3) Load 43(inF0) + 748: 38(fvec3) ExtInst 1(GLSL.std.450) 28(Log) 747 + Store 746(r044) 748 + 750: 38(fvec3) Load 43(inF0) + 751: 38(fvec3) ExtInst 1(GLSL.std.450) 30(Log2) 750 + 752: 38(fvec3) VectorTimesScalar 751 272 + Store 749(r045) 752 + 754: 38(fvec3) Load 43(inF0) + 755: 38(fvec3) ExtInst 1(GLSL.std.450) 30(Log2) 754 + Store 753(r046) 755 + 757: 38(fvec3) Load 43(inF0) + 758: 38(fvec3) Load 44(inF1) + 759: 38(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 757 758 + Store 756(r047) 759 + 761: 38(fvec3) Load 43(inF0) + 762: 38(fvec3) Load 44(inF1) + 763: 38(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 761 762 + Store 760(r048) 763 + 765: 38(fvec3) Load 43(inF0) + 766: 38(fvec3) ExtInst 1(GLSL.std.450) 69(Normalize) 765 + Store 764(r049) 766 + 768: 38(fvec3) Load 43(inF0) + 769: 38(fvec3) Load 44(inF1) + 770: 38(fvec3) ExtInst 1(GLSL.std.450) 26(Pow) 768 769 + Store 767(r050) 770 + 772: 38(fvec3) Load 43(inF0) + 773: 38(fvec3) ExtInst 1(GLSL.std.450) 11(Radians) 772 + Store 771(r051) 773 + 775: 38(fvec3) Load 43(inF0) + 776: 38(fvec3) CompositeConstruct 293 293 293 + 777: 38(fvec3) FDiv 776 775 + Store 774(r052) 777 + 779: 38(fvec3) Load 43(inF0) + 780: 38(fvec3) Load 44(inF1) + 781: 38(fvec3) ExtInst 1(GLSL.std.450) 71(Reflect) 779 780 + Store 778(r053) 781 + 783: 38(fvec3) Load 43(inF0) + 784: 38(fvec3) Load 44(inF1) + 785: 38(fvec3) ExtInst 1(GLSL.std.450) 72(Refract) 783 784 534 + Store 782(r054) 785 + 788: 40(ivec3) BitReverse 787 + Store 786(r055) 788 + 790: 38(fvec3) Load 43(inF0) + 791: 38(fvec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 790 + Store 789(r056) 791 + 793: 38(fvec3) Load 43(inF0) + 794: 38(fvec3) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 793 + Store 792(r057) 794 + 796: 38(fvec3) Load 43(inF0) + 797: 38(fvec3) CompositeConstruct 141 141 141 + 798: 38(fvec3) CompositeConstruct 293 293 293 + 799: 38(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 796 797 798 + Store 795(r058) 799 + 801: 38(fvec3) Load 43(inF0) + 802: 38(fvec3) ExtInst 1(GLSL.std.450) 6(FSign) 801 + Store 800(r059) 802 + 804: 38(fvec3) Load 43(inF0) + 805: 38(fvec3) ExtInst 1(GLSL.std.450) 13(Sin) 804 + Store 803(r060) 805 + 806: 38(fvec3) Load 43(inF0) + 807: 38(fvec3) ExtInst 1(GLSL.std.450) 13(Sin) 806 + Store 44(inF1) 807 + 808: 38(fvec3) Load 43(inF0) + 809: 38(fvec3) ExtInst 1(GLSL.std.450) 14(Cos) 808 + Store 45(inF2) 809 + 811: 38(fvec3) Load 43(inF0) + 812: 38(fvec3) ExtInst 1(GLSL.std.450) 19(Sinh) 811 + Store 810(r061) 812 + 814: 38(fvec3) Load 43(inF0) + 815: 38(fvec3) Load 44(inF1) + 816: 38(fvec3) Load 45(inF2) + 817: 38(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 814 815 816 + Store 813(r062) 817 + 819: 38(fvec3) Load 43(inF0) + 820: 38(fvec3) ExtInst 1(GLSL.std.450) 31(Sqrt) 819 + Store 818(r063) 820 + 822: 38(fvec3) Load 43(inF0) + 823: 38(fvec3) Load 44(inF1) + 824: 38(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 822 823 + Store 821(r064) 824 + 826: 38(fvec3) Load 43(inF0) + 827: 38(fvec3) ExtInst 1(GLSL.std.450) 15(Tan) 826 + Store 825(r065) 827 + 829: 38(fvec3) Load 43(inF0) + 830: 38(fvec3) ExtInst 1(GLSL.std.450) 21(Tanh) 829 + Store 828(r066) 830 + 832: 38(fvec3) Load 43(inF0) + 833: 38(fvec3) ExtInst 1(GLSL.std.450) 3(Trunc) 832 + Store 831(r067) 833 + ReturnValue 835 FunctionEnd -58(PixelShaderFunction(vf4;vf4;vf4;vu4;vu4;): 48(fvec4) Function None 52 - 53(inF0): 49(ptr) FunctionParameter - 54(inF1): 49(ptr) FunctionParameter - 55(inF2): 49(ptr) FunctionParameter - 56(inU0): 51(ptr) FunctionParameter - 57(inU1): 51(ptr) FunctionParameter - 59: Label - 834(r000): 136(ptr) Variable Function - 840(r001): 49(ptr) Variable Function - 843(r002): 49(ptr) Variable Function - 846(r003): 136(ptr) Variable Function - 850(r004): 49(ptr) Variable Function - 855(r005): 854(ptr) Variable Function - 858(r006): 51(ptr) Variable Function - 861(r007): 49(ptr) Variable Function - 864(r009): 49(ptr) Variable Function - 867(r010): 49(ptr) Variable Function - 871(r011): 49(ptr) Variable Function - 874(r012): 49(ptr) Variable Function - 892(r013): 49(ptr) Variable Function - 895(r014): 49(ptr) Variable Function - 898(r015): 51(ptr) Variable Function - 901(r016): 49(ptr) Variable Function - 904(r017): 49(ptr) Variable Function - 907(r018): 49(ptr) Variable Function - 910(r019): 49(ptr) Variable Function - 913(r020): 49(ptr) Variable Function - 916(r021): 49(ptr) Variable Function - 919(r022): 49(ptr) Variable Function - 922(r023): 7(ptr) Variable Function - 926(r024): 7(ptr) Variable Function - 930(r025): 49(ptr) Variable Function - 941(r029): 49(ptr) Variable Function - 944(r030): 49(ptr) Variable Function - 947(r031): 49(ptr) Variable Function - 952(r032): 51(ptr) Variable Function - 957(r033): 51(ptr) Variable Function - 959(r034): 49(ptr) Variable Function - 962(r036): 49(ptr) Variable Function - 966(r037): 49(ptr) Variable Function - 969(r039): 49(ptr) Variable Function - 973(r040): 972(ptr) Variable Function - 976(r041): 972(ptr) Variable Function - 979(r042): 49(ptr) Variable Function - 983(r039a): 49(ptr) Variable Function - 988(r043): 7(ptr) Variable Function - 991(r044): 49(ptr) Variable Function - 994(r045): 49(ptr) Variable Function - 998(r046): 49(ptr) Variable Function - 1001(r047): 49(ptr) Variable Function - 1005(r048): 49(ptr) Variable Function - 1009(r049): 49(ptr) Variable Function - 1012(r050): 49(ptr) Variable Function - 1016(r051): 49(ptr) Variable Function - 1019(r052): 49(ptr) Variable Function - 1023(r053): 49(ptr) Variable Function - 1027(r054): 49(ptr) Variable Function - 1031(r055): 51(ptr) Variable Function - 1034(r056): 49(ptr) Variable Function - 1037(r057): 49(ptr) Variable Function - 1040(r058): 49(ptr) Variable Function - 1045(r059): 49(ptr) Variable Function - 1048(r060): 49(ptr) Variable Function - 1055(r061): 49(ptr) Variable Function - 1058(r062): 49(ptr) Variable Function - 1063(r063): 49(ptr) Variable Function - 1066(r064): 49(ptr) Variable Function - 1070(r065): 49(ptr) Variable Function - 1073(r066): 49(ptr) Variable Function - 1076(r067): 49(ptr) Variable Function - 835: 48(fvec4) Load 53(inF0) - 838: 836(bvec4) FOrdNotEqual 835 837 - 839: 135(bool) All 838 - Store 834(r000) 839 - 841: 48(fvec4) Load 53(inF0) - 842: 48(fvec4) ExtInst 1(GLSL.std.450) 4(FAbs) 841 - Store 840(r001) 842 - 844: 48(fvec4) Load 53(inF0) - 845: 48(fvec4) ExtInst 1(GLSL.std.450) 17(Acos) 844 - Store 843(r002) 845 - 847: 48(fvec4) Load 53(inF0) - 848: 836(bvec4) FOrdNotEqual 847 837 - 849: 135(bool) Any 848 - Store 846(r003) 849 - 851: 48(fvec4) Load 53(inF0) - 852: 48(fvec4) ExtInst 1(GLSL.std.450) 16(Asin) 851 - Store 850(r004) 852 - 856: 48(fvec4) Load 53(inF0) - 857: 853(ivec4) Bitcast 856 - Store 855(r005) 857 - 859: 48(fvec4) Load 53(inF0) - 860: 50(ivec4) Bitcast 859 - Store 858(r006) 860 - 862: 50(ivec4) Load 56(inU0) - 863: 48(fvec4) Bitcast 862 - Store 861(r007) 863 - 865: 48(fvec4) Load 53(inF0) - 866: 48(fvec4) ExtInst 1(GLSL.std.450) 18(Atan) 865 - Store 864(r009) 866 - 868: 48(fvec4) Load 53(inF0) - 869: 48(fvec4) Load 54(inF1) - 870: 48(fvec4) ExtInst 1(GLSL.std.450) 25(Atan2) 868 869 - Store 867(r010) 870 - 872: 48(fvec4) Load 53(inF0) - 873: 48(fvec4) ExtInst 1(GLSL.std.450) 9(Ceil) 872 - Store 871(r011) 873 - 875: 48(fvec4) Load 53(inF0) - 876: 48(fvec4) Load 54(inF1) - 877: 48(fvec4) Load 55(inF2) - 878: 48(fvec4) ExtInst 1(GLSL.std.450) 43(FClamp) 875 876 877 - Store 874(r012) 878 - 879: 48(fvec4) Load 53(inF0) - 880: 836(bvec4) FOrdLessThan 879 837 - 881: 135(bool) Any 880 - SelectionMerge 883 None - BranchConditional 881 882 883 - 882: Label +60(PixelShaderFunction(vf4;vf4;vf4;vu4;vu4;): 50(fvec4) Function None 54 + 55(inF0): 51(ptr) FunctionParameter + 56(inF1): 51(ptr) FunctionParameter + 57(inF2): 51(ptr) FunctionParameter + 58(inU0): 53(ptr) FunctionParameter + 59(inU1): 53(ptr) FunctionParameter + 61: Label + 838(r000): 138(ptr) Variable Function + 844(r001): 51(ptr) Variable Function + 847(r002): 51(ptr) Variable Function + 850(r003): 138(ptr) Variable Function + 854(r004): 51(ptr) Variable Function + 859(r005): 858(ptr) Variable Function + 862(r006): 53(ptr) Variable Function + 865(r007): 51(ptr) Variable Function + 868(r009): 51(ptr) Variable Function + 871(r010): 51(ptr) Variable Function + 875(r011): 51(ptr) Variable Function + 878(r012): 51(ptr) Variable Function + 896(r013): 51(ptr) Variable Function + 899(r014): 51(ptr) Variable Function + 902(r015): 53(ptr) Variable Function + 905(r016): 51(ptr) Variable Function + 908(r017): 51(ptr) Variable Function + 911(r018): 51(ptr) Variable Function + 914(r019): 51(ptr) Variable Function + 917(r020): 51(ptr) Variable Function + 920(r021): 51(ptr) Variable Function + 923(r022): 51(ptr) Variable Function + 926(r023): 7(ptr) Variable Function + 930(r024): 7(ptr) Variable Function + 934(r025): 51(ptr) Variable Function + 945(r029): 51(ptr) Variable Function + 948(r030): 51(ptr) Variable Function + 951(r031): 51(ptr) Variable Function + 956(r032): 53(ptr) Variable Function + 961(r033): 53(ptr) Variable Function + 963(r034): 51(ptr) Variable Function + 966(r036): 51(ptr) Variable Function + 970(r037): 51(ptr) Variable Function + 973(r039): 51(ptr) Variable Function + 977(r040): 976(ptr) Variable Function + 980(r041): 976(ptr) Variable Function + 983(r042): 51(ptr) Variable Function + 987(r039a): 51(ptr) Variable Function + 992(r043): 7(ptr) Variable Function + 995(r044): 51(ptr) Variable Function + 998(r045): 51(ptr) Variable Function + 1002(r046): 51(ptr) Variable Function + 1005(r047): 51(ptr) Variable Function + 1009(r048): 51(ptr) Variable Function + 1013(r049): 51(ptr) Variable Function + 1016(r050): 51(ptr) Variable Function + 1020(r051): 51(ptr) Variable Function + 1023(r052): 51(ptr) Variable Function + 1027(r053): 51(ptr) Variable Function + 1031(r054): 51(ptr) Variable Function + 1035(r055): 53(ptr) Variable Function + 1038(r056): 51(ptr) Variable Function + 1041(r057): 51(ptr) Variable Function + 1044(r058): 51(ptr) Variable Function + 1049(r059): 51(ptr) Variable Function + 1052(r060): 51(ptr) Variable Function + 1059(r061): 51(ptr) Variable Function + 1062(r062): 51(ptr) Variable Function + 1067(r063): 51(ptr) Variable Function + 1070(r064): 51(ptr) Variable Function + 1074(r065): 51(ptr) Variable Function + 1077(r066): 51(ptr) Variable Function + 1080(r067): 51(ptr) Variable Function + 839: 50(fvec4) Load 55(inF0) + 842: 840(bvec4) FOrdNotEqual 839 841 + 843: 137(bool) All 842 + Store 838(r000) 843 + 845: 50(fvec4) Load 55(inF0) + 846: 50(fvec4) ExtInst 1(GLSL.std.450) 4(FAbs) 845 + Store 844(r001) 846 + 848: 50(fvec4) Load 55(inF0) + 849: 50(fvec4) ExtInst 1(GLSL.std.450) 17(Acos) 848 + Store 847(r002) 849 + 851: 50(fvec4) Load 55(inF0) + 852: 840(bvec4) FOrdNotEqual 851 841 + 853: 137(bool) Any 852 + Store 850(r003) 853 + 855: 50(fvec4) Load 55(inF0) + 856: 50(fvec4) ExtInst 1(GLSL.std.450) 16(Asin) 855 + Store 854(r004) 856 + 860: 50(fvec4) Load 55(inF0) + 861: 857(ivec4) Bitcast 860 + Store 859(r005) 861 + 863: 50(fvec4) Load 55(inF0) + 864: 52(ivec4) Bitcast 863 + Store 862(r006) 864 + 866: 52(ivec4) Load 58(inU0) + 867: 50(fvec4) Bitcast 866 + Store 865(r007) 867 + 869: 50(fvec4) Load 55(inF0) + 870: 50(fvec4) ExtInst 1(GLSL.std.450) 18(Atan) 869 + Store 868(r009) 870 + 872: 50(fvec4) Load 55(inF0) + 873: 50(fvec4) Load 56(inF1) + 874: 50(fvec4) ExtInst 1(GLSL.std.450) 25(Atan2) 872 873 + Store 871(r010) 874 + 876: 50(fvec4) Load 55(inF0) + 877: 50(fvec4) ExtInst 1(GLSL.std.450) 9(Ceil) 876 + Store 875(r011) 877 + 879: 50(fvec4) Load 55(inF0) + 880: 50(fvec4) Load 56(inF1) + 881: 50(fvec4) Load 57(inF2) + 882: 50(fvec4) ExtInst 1(GLSL.std.450) 43(FClamp) 879 880 881 + Store 878(r012) 882 + 883: 50(fvec4) Load 55(inF0) + 884: 840(bvec4) FOrdLessThan 883 841 + 885: 137(bool) Any 884 + SelectionMerge 887 None + BranchConditional 885 886 887 + 886: Label Kill - 883: Label - 885: 50(ivec4) Load 56(inU0) - 887: 836(bvec4) ULessThan 885 886 - 888: 135(bool) Any 887 - SelectionMerge 890 None - BranchConditional 888 889 890 - 889: Label + 887: Label + 889: 52(ivec4) Load 58(inU0) + 891: 840(bvec4) ULessThan 889 890 + 892: 137(bool) Any 891 + SelectionMerge 894 None + BranchConditional 892 893 894 + 893: Label Kill - 890: Label - 893: 48(fvec4) Load 53(inF0) - 894: 48(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 893 - Store 892(r013) 894 - 896: 48(fvec4) Load 53(inF0) - 897: 48(fvec4) ExtInst 1(GLSL.std.450) 20(Cosh) 896 - Store 895(r014) 897 - 900: 50(ivec4) BitCount 899 - Store 898(r015) 900 - 902: 48(fvec4) Load 53(inF0) - 903: 48(fvec4) DPdx 902 - Store 901(r016) 903 - 905: 48(fvec4) Load 53(inF0) - 906: 48(fvec4) DPdxCoarse 905 - Store 904(r017) 906 - 908: 48(fvec4) Load 53(inF0) - 909: 48(fvec4) DPdxFine 908 - Store 907(r018) 909 - 911: 48(fvec4) Load 53(inF0) - 912: 48(fvec4) DPdy 911 - Store 910(r019) 912 - 914: 48(fvec4) Load 53(inF0) - 915: 48(fvec4) DPdyCoarse 914 - Store 913(r020) 915 - 917: 48(fvec4) Load 53(inF0) - 918: 48(fvec4) DPdyFine 917 - Store 916(r021) 918 - 920: 48(fvec4) Load 53(inF0) - 921: 48(fvec4) ExtInst 1(GLSL.std.450) 12(Degrees) 920 - Store 919(r022) 921 - 923: 48(fvec4) Load 53(inF0) - 924: 48(fvec4) Load 54(inF1) - 925: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 923 924 - Store 922(r023) 925 - 927: 48(fvec4) Load 53(inF0) - 928: 48(fvec4) Load 54(inF1) - 929: 6(float) Dot 927 928 - Store 926(r024) 929 - 931: 7(ptr) AccessChain 53(inF0) 533 - 932: 6(float) Load 931 - 933: 7(ptr) AccessChain 54(inF1) 533 - 934: 6(float) Load 933 - 935: 6(float) FMul 932 934 - 936: 7(ptr) AccessChain 53(inF0) 534 - 937: 6(float) Load 936 - 938: 7(ptr) AccessChain 54(inF1) 650 - 939: 6(float) Load 938 - 940: 48(fvec4) CompositeConstruct 289 935 937 939 - Store 930(r025) 940 - 942: 48(fvec4) Load 53(inF0) - 943: 48(fvec4) ExtInst 1(GLSL.std.450) 27(Exp) 942 - Store 941(r029) 943 - 945: 48(fvec4) Load 53(inF0) - 946: 48(fvec4) ExtInst 1(GLSL.std.450) 29(Exp2) 945 - Store 944(r030) 946 - 948: 48(fvec4) Load 53(inF0) - 949: 48(fvec4) Load 54(inF1) - 950: 48(fvec4) Load 55(inF2) - 951: 48(fvec4) ExtInst 1(GLSL.std.450) 70(FaceForward) 948 949 950 - Store 947(r031) 951 - 956: 50(ivec4) ExtInst 1(GLSL.std.450) 75(FindUMsb) 955 - Store 952(r032) 956 - 958: 50(ivec4) ExtInst 1(GLSL.std.450) 73(FindILsb) 955 - Store 957(r033) 958 - 960: 48(fvec4) Load 53(inF0) - 961: 48(fvec4) ExtInst 1(GLSL.std.450) 8(Floor) 960 - Store 959(r034) 961 - 963: 48(fvec4) Load 53(inF0) - 964: 48(fvec4) Load 54(inF1) - 965: 48(fvec4) FMod 963 964 - Store 962(r036) 965 - 967: 48(fvec4) Load 53(inF0) - 968: 48(fvec4) ExtInst 1(GLSL.std.450) 10(Fract) 967 - Store 966(r037) 968 - 970: 48(fvec4) Load 53(inF0) - 971: 48(fvec4) Fwidth 970 - Store 969(r039) 971 - 974: 48(fvec4) Load 53(inF0) - 975: 836(bvec4) IsInf 974 - Store 973(r040) 975 - 977: 48(fvec4) Load 53(inF0) - 978: 836(bvec4) IsNan 977 - Store 976(r041) 978 - 980: 48(fvec4) Load 53(inF0) - 981: 48(fvec4) Load 54(inF1) - 982: 48(fvec4) ExtInst 1(GLSL.std.450) 53(Ldexp) 980 981 - Store 979(r042) 982 - 984: 48(fvec4) Load 53(inF0) - 985: 48(fvec4) Load 54(inF1) - 986: 48(fvec4) Load 55(inF2) - 987: 48(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 984 985 986 - Store 983(r039a) 987 - 989: 48(fvec4) Load 53(inF0) - 990: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 989 - Store 988(r043) 990 - 992: 48(fvec4) Load 53(inF0) - 993: 48(fvec4) ExtInst 1(GLSL.std.450) 28(Log) 992 - Store 991(r044) 993 - 995: 48(fvec4) Load 53(inF0) - 996: 48(fvec4) ExtInst 1(GLSL.std.450) 30(Log2) 995 - 997: 48(fvec4) VectorTimesScalar 996 268 - Store 994(r045) 997 - 999: 48(fvec4) Load 53(inF0) - 1000: 48(fvec4) ExtInst 1(GLSL.std.450) 30(Log2) 999 - Store 998(r046) 1000 - 1002: 48(fvec4) Load 53(inF0) - 1003: 48(fvec4) Load 54(inF1) - 1004: 48(fvec4) ExtInst 1(GLSL.std.450) 40(FMax) 1002 1003 - Store 1001(r047) 1004 - 1006: 48(fvec4) Load 53(inF0) - 1007: 48(fvec4) Load 54(inF1) - 1008: 48(fvec4) ExtInst 1(GLSL.std.450) 37(FMin) 1006 1007 - Store 1005(r048) 1008 - 1010: 48(fvec4) Load 53(inF0) - 1011: 48(fvec4) ExtInst 1(GLSL.std.450) 69(Normalize) 1010 - Store 1009(r049) 1011 - 1013: 48(fvec4) Load 53(inF0) - 1014: 48(fvec4) Load 54(inF1) - 1015: 48(fvec4) ExtInst 1(GLSL.std.450) 26(Pow) 1013 1014 - Store 1012(r050) 1015 - 1017: 48(fvec4) Load 53(inF0) - 1018: 48(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 1017 - Store 1016(r051) 1018 - 1020: 48(fvec4) Load 53(inF0) - 1021: 48(fvec4) CompositeConstruct 289 289 289 289 - 1022: 48(fvec4) FDiv 1021 1020 - Store 1019(r052) 1022 - 1024: 48(fvec4) Load 53(inF0) - 1025: 48(fvec4) Load 54(inF1) - 1026: 48(fvec4) ExtInst 1(GLSL.std.450) 71(Reflect) 1024 1025 - Store 1023(r053) 1026 - 1028: 48(fvec4) Load 53(inF0) - 1029: 48(fvec4) Load 54(inF1) - 1030: 48(fvec4) ExtInst 1(GLSL.std.450) 72(Refract) 1028 1029 530 - Store 1027(r054) 1030 - 1033: 50(ivec4) BitReverse 1032 - Store 1031(r055) 1033 - 1035: 48(fvec4) Load 53(inF0) - 1036: 48(fvec4) ExtInst 1(GLSL.std.450) 2(RoundEven) 1035 - Store 1034(r056) 1036 - 1038: 48(fvec4) Load 53(inF0) - 1039: 48(fvec4) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1038 - Store 1037(r057) 1039 - 1041: 48(fvec4) Load 53(inF0) - 1042: 48(fvec4) CompositeConstruct 139 139 139 139 - 1043: 48(fvec4) CompositeConstruct 289 289 289 289 - 1044: 48(fvec4) ExtInst 1(GLSL.std.450) 43(FClamp) 1041 1042 1043 - Store 1040(r058) 1044 - 1046: 48(fvec4) Load 53(inF0) - 1047: 48(fvec4) ExtInst 1(GLSL.std.450) 6(FSign) 1046 - Store 1045(r059) 1047 - 1049: 48(fvec4) Load 53(inF0) - 1050: 48(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 1049 - Store 1048(r060) 1050 - 1051: 48(fvec4) Load 53(inF0) - 1052: 48(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 1051 - Store 54(inF1) 1052 - 1053: 48(fvec4) Load 53(inF0) - 1054: 48(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 1053 - Store 55(inF2) 1054 - 1056: 48(fvec4) Load 53(inF0) - 1057: 48(fvec4) ExtInst 1(GLSL.std.450) 19(Sinh) 1056 - Store 1055(r061) 1057 - 1059: 48(fvec4) Load 53(inF0) - 1060: 48(fvec4) Load 54(inF1) - 1061: 48(fvec4) Load 55(inF2) - 1062: 48(fvec4) ExtInst 1(GLSL.std.450) 49(SmoothStep) 1059 1060 1061 - Store 1058(r062) 1062 - 1064: 48(fvec4) Load 53(inF0) - 1065: 48(fvec4) ExtInst 1(GLSL.std.450) 31(Sqrt) 1064 - Store 1063(r063) 1065 - 1067: 48(fvec4) Load 53(inF0) - 1068: 48(fvec4) Load 54(inF1) - 1069: 48(fvec4) ExtInst 1(GLSL.std.450) 48(Step) 1067 1068 - Store 1066(r064) 1069 - 1071: 48(fvec4) Load 53(inF0) - 1072: 48(fvec4) ExtInst 1(GLSL.std.450) 15(Tan) 1071 - Store 1070(r065) 1072 - 1074: 48(fvec4) Load 53(inF0) - 1075: 48(fvec4) ExtInst 1(GLSL.std.450) 21(Tanh) 1074 - Store 1073(r066) 1075 - 1077: 48(fvec4) Load 53(inF0) - 1078: 48(fvec4) ExtInst 1(GLSL.std.450) 3(Trunc) 1077 - Store 1076(r067) 1078 - ReturnValue 1080 + 894: Label + 897: 50(fvec4) Load 55(inF0) + 898: 50(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 897 + Store 896(r013) 898 + 900: 50(fvec4) Load 55(inF0) + 901: 50(fvec4) ExtInst 1(GLSL.std.450) 20(Cosh) 900 + Store 899(r014) 901 + 904: 52(ivec4) BitCount 903 + Store 902(r015) 904 + 906: 50(fvec4) Load 55(inF0) + 907: 50(fvec4) DPdx 906 + Store 905(r016) 907 + 909: 50(fvec4) Load 55(inF0) + 910: 50(fvec4) DPdxCoarse 909 + Store 908(r017) 910 + 912: 50(fvec4) Load 55(inF0) + 913: 50(fvec4) DPdxFine 912 + Store 911(r018) 913 + 915: 50(fvec4) Load 55(inF0) + 916: 50(fvec4) DPdy 915 + Store 914(r019) 916 + 918: 50(fvec4) Load 55(inF0) + 919: 50(fvec4) DPdyCoarse 918 + Store 917(r020) 919 + 921: 50(fvec4) Load 55(inF0) + 922: 50(fvec4) DPdyFine 921 + Store 920(r021) 922 + 924: 50(fvec4) Load 55(inF0) + 925: 50(fvec4) ExtInst 1(GLSL.std.450) 12(Degrees) 924 + Store 923(r022) 925 + 927: 50(fvec4) Load 55(inF0) + 928: 50(fvec4) Load 56(inF1) + 929: 6(float) ExtInst 1(GLSL.std.450) 67(Distance) 927 928 + Store 926(r023) 929 + 931: 50(fvec4) Load 55(inF0) + 932: 50(fvec4) Load 56(inF1) + 933: 6(float) Dot 931 932 + Store 930(r024) 933 + 935: 7(ptr) AccessChain 55(inF0) 537 + 936: 6(float) Load 935 + 937: 7(ptr) AccessChain 56(inF1) 537 + 938: 6(float) Load 937 + 939: 6(float) FMul 936 938 + 940: 7(ptr) AccessChain 55(inF0) 538 + 941: 6(float) Load 940 + 942: 7(ptr) AccessChain 56(inF1) 654 + 943: 6(float) Load 942 + 944: 50(fvec4) CompositeConstruct 293 939 941 943 + Store 934(r025) 944 + 946: 50(fvec4) Load 55(inF0) + 947: 50(fvec4) ExtInst 1(GLSL.std.450) 27(Exp) 946 + Store 945(r029) 947 + 949: 50(fvec4) Load 55(inF0) + 950: 50(fvec4) ExtInst 1(GLSL.std.450) 29(Exp2) 949 + Store 948(r030) 950 + 952: 50(fvec4) Load 55(inF0) + 953: 50(fvec4) Load 56(inF1) + 954: 50(fvec4) Load 57(inF2) + 955: 50(fvec4) ExtInst 1(GLSL.std.450) 70(FaceForward) 952 953 954 + Store 951(r031) 955 + 960: 52(ivec4) ExtInst 1(GLSL.std.450) 75(FindUMsb) 959 + Store 956(r032) 960 + 962: 52(ivec4) ExtInst 1(GLSL.std.450) 73(FindILsb) 959 + Store 961(r033) 962 + 964: 50(fvec4) Load 55(inF0) + 965: 50(fvec4) ExtInst 1(GLSL.std.450) 8(Floor) 964 + Store 963(r034) 965 + 967: 50(fvec4) Load 55(inF0) + 968: 50(fvec4) Load 56(inF1) + 969: 50(fvec4) FMod 967 968 + Store 966(r036) 969 + 971: 50(fvec4) Load 55(inF0) + 972: 50(fvec4) ExtInst 1(GLSL.std.450) 10(Fract) 971 + Store 970(r037) 972 + 974: 50(fvec4) Load 55(inF0) + 975: 50(fvec4) Fwidth 974 + Store 973(r039) 975 + 978: 50(fvec4) Load 55(inF0) + 979: 840(bvec4) IsInf 978 + Store 977(r040) 979 + 981: 50(fvec4) Load 55(inF0) + 982: 840(bvec4) IsNan 981 + Store 980(r041) 982 + 984: 50(fvec4) Load 55(inF0) + 985: 50(fvec4) Load 56(inF1) + 986: 50(fvec4) ExtInst 1(GLSL.std.450) 53(Ldexp) 984 985 + Store 983(r042) 986 + 988: 50(fvec4) Load 55(inF0) + 989: 50(fvec4) Load 56(inF1) + 990: 50(fvec4) Load 57(inF2) + 991: 50(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 988 989 990 + Store 987(r039a) 991 + 993: 50(fvec4) Load 55(inF0) + 994: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 993 + Store 992(r043) 994 + 996: 50(fvec4) Load 55(inF0) + 997: 50(fvec4) ExtInst 1(GLSL.std.450) 28(Log) 996 + Store 995(r044) 997 + 999: 50(fvec4) Load 55(inF0) + 1000: 50(fvec4) ExtInst 1(GLSL.std.450) 30(Log2) 999 + 1001: 50(fvec4) VectorTimesScalar 1000 272 + Store 998(r045) 1001 + 1003: 50(fvec4) Load 55(inF0) + 1004: 50(fvec4) ExtInst 1(GLSL.std.450) 30(Log2) 1003 + Store 1002(r046) 1004 + 1006: 50(fvec4) Load 55(inF0) + 1007: 50(fvec4) Load 56(inF1) + 1008: 50(fvec4) ExtInst 1(GLSL.std.450) 40(FMax) 1006 1007 + Store 1005(r047) 1008 + 1010: 50(fvec4) Load 55(inF0) + 1011: 50(fvec4) Load 56(inF1) + 1012: 50(fvec4) ExtInst 1(GLSL.std.450) 37(FMin) 1010 1011 + Store 1009(r048) 1012 + 1014: 50(fvec4) Load 55(inF0) + 1015: 50(fvec4) ExtInst 1(GLSL.std.450) 69(Normalize) 1014 + Store 1013(r049) 1015 + 1017: 50(fvec4) Load 55(inF0) + 1018: 50(fvec4) Load 56(inF1) + 1019: 50(fvec4) ExtInst 1(GLSL.std.450) 26(Pow) 1017 1018 + Store 1016(r050) 1019 + 1021: 50(fvec4) Load 55(inF0) + 1022: 50(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 1021 + Store 1020(r051) 1022 + 1024: 50(fvec4) Load 55(inF0) + 1025: 50(fvec4) CompositeConstruct 293 293 293 293 + 1026: 50(fvec4) FDiv 1025 1024 + Store 1023(r052) 1026 + 1028: 50(fvec4) Load 55(inF0) + 1029: 50(fvec4) Load 56(inF1) + 1030: 50(fvec4) ExtInst 1(GLSL.std.450) 71(Reflect) 1028 1029 + Store 1027(r053) 1030 + 1032: 50(fvec4) Load 55(inF0) + 1033: 50(fvec4) Load 56(inF1) + 1034: 50(fvec4) ExtInst 1(GLSL.std.450) 72(Refract) 1032 1033 534 + Store 1031(r054) 1034 + 1037: 52(ivec4) BitReverse 1036 + Store 1035(r055) 1037 + 1039: 50(fvec4) Load 55(inF0) + 1040: 50(fvec4) ExtInst 1(GLSL.std.450) 2(RoundEven) 1039 + Store 1038(r056) 1040 + 1042: 50(fvec4) Load 55(inF0) + 1043: 50(fvec4) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1042 + Store 1041(r057) 1043 + 1045: 50(fvec4) Load 55(inF0) + 1046: 50(fvec4) CompositeConstruct 141 141 141 141 + 1047: 50(fvec4) CompositeConstruct 293 293 293 293 + 1048: 50(fvec4) ExtInst 1(GLSL.std.450) 43(FClamp) 1045 1046 1047 + Store 1044(r058) 1048 + 1050: 50(fvec4) Load 55(inF0) + 1051: 50(fvec4) ExtInst 1(GLSL.std.450) 6(FSign) 1050 + Store 1049(r059) 1051 + 1053: 50(fvec4) Load 55(inF0) + 1054: 50(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 1053 + Store 1052(r060) 1054 + 1055: 50(fvec4) Load 55(inF0) + 1056: 50(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 1055 + Store 56(inF1) 1056 + 1057: 50(fvec4) Load 55(inF0) + 1058: 50(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 1057 + Store 57(inF2) 1058 + 1060: 50(fvec4) Load 55(inF0) + 1061: 50(fvec4) ExtInst 1(GLSL.std.450) 19(Sinh) 1060 + Store 1059(r061) 1061 + 1063: 50(fvec4) Load 55(inF0) + 1064: 50(fvec4) Load 56(inF1) + 1065: 50(fvec4) Load 57(inF2) + 1066: 50(fvec4) ExtInst 1(GLSL.std.450) 49(SmoothStep) 1063 1064 1065 + Store 1062(r062) 1066 + 1068: 50(fvec4) Load 55(inF0) + 1069: 50(fvec4) ExtInst 1(GLSL.std.450) 31(Sqrt) 1068 + Store 1067(r063) 1069 + 1071: 50(fvec4) Load 55(inF0) + 1072: 50(fvec4) Load 56(inF1) + 1073: 50(fvec4) ExtInst 1(GLSL.std.450) 48(Step) 1071 1072 + Store 1070(r064) 1073 + 1075: 50(fvec4) Load 55(inF0) + 1076: 50(fvec4) ExtInst 1(GLSL.std.450) 15(Tan) 1075 + Store 1074(r065) 1076 + 1078: 50(fvec4) Load 55(inF0) + 1079: 50(fvec4) ExtInst 1(GLSL.std.450) 21(Tanh) 1078 + Store 1077(r066) 1079 + 1081: 50(fvec4) Load 55(inF0) + 1082: 50(fvec4) ExtInst 1(GLSL.std.450) 3(Trunc) 1081 + Store 1080(r067) 1082 + ReturnValue 1084 FunctionEnd -66(PixelShaderFunction2x2(mf22;mf22;mf22;): 60 Function None 62 - 63(inF0): 61(ptr) FunctionParameter - 64(inF1): 61(ptr) FunctionParameter - 65(inF2): 61(ptr) FunctionParameter - 67: Label - 1083(r000): 136(ptr) Variable Function - 1088(r001): 61(ptr) Variable Function - 1093(r003): 136(ptr) Variable Function - 1097(r004): 61(ptr) Variable Function - 1100(r005): 61(ptr) Variable Function - 1103(r006): 61(ptr) Variable Function - 1107(r007): 61(ptr) Variable Function - 1117(r008): 61(ptr) Variable Function - 1122(r009): 61(ptr) Variable Function - 1125(r010): 61(ptr) Variable Function - 1128(r011): 61(ptr) Variable Function - 1131(r012): 61(ptr) Variable Function - 1134(r013): 61(ptr) Variable Function - 1137(r014): 61(ptr) Variable Function - 1140(r015): 61(ptr) Variable Function - 1143(r016): 61(ptr) Variable Function - 1146(r017): 61(ptr) Variable Function - 1149(r018): 7(ptr) Variable Function - 1152(r019): 61(ptr) Variable Function - 1155(R020): 61(ptr) Variable Function - 1158(r021): 61(ptr) Variable Function - 1161(r022): 61(ptr) Variable Function - 1171(r023): 61(ptr) Variable Function - 1174(r025): 61(ptr) Variable Function - 1177(r026): 61(ptr) Variable Function - 1181(r026a): 61(ptr) Variable Function - 1186(r027): 61(ptr) Variable Function - 1189(r028): 61(ptr) Variable Function - 1193(r029): 61(ptr) Variable Function - 1196(r030): 61(ptr) Variable Function - 1200(r031): 61(ptr) Variable Function - 1204(r032): 61(ptr) Variable Function - 1208(r033): 61(ptr) Variable Function - 1211(r034): 61(ptr) Variable Function - 1214(r035): 61(ptr) Variable Function - 1217(r036): 61(ptr) Variable Function - 1222(r037): 61(ptr) Variable Function - 1225(r038): 61(ptr) Variable Function - 1232(r039): 61(ptr) Variable Function - 1235(r049): 61(ptr) Variable Function - 1240(r041): 61(ptr) Variable Function - 1243(r042): 61(ptr) Variable Function - 1247(r043): 61(ptr) Variable Function - 1250(r044): 61(ptr) Variable Function - 1255(r046): 61(ptr) Variable Function - 1084: 60 Load 63(inF0) - 1086: 1085 FOrdNotEqual 1084 139 - 1087: 135(bool) All 1086 - Store 1083(r000) 1087 - 1089: 60 Load 63(inF0) - 1090: 60 ExtInst 1(GLSL.std.450) 4(FAbs) 1089 - Store 1088(r001) 1090 - 1091: 60 Load 63(inF0) - 1092: 60 ExtInst 1(GLSL.std.450) 17(Acos) 1091 - 1094: 60 Load 63(inF0) - 1095: 1085 FOrdNotEqual 1094 139 - 1096: 135(bool) Any 1095 - Store 1093(r003) 1096 - 1098: 60 Load 63(inF0) - 1099: 60 ExtInst 1(GLSL.std.450) 16(Asin) 1098 - Store 1097(r004) 1099 - 1101: 60 Load 63(inF0) - 1102: 60 ExtInst 1(GLSL.std.450) 18(Atan) 1101 - Store 1100(r005) 1102 - 1104: 60 Load 63(inF0) - 1105: 60 Load 64(inF1) - 1106: 60 ExtInst 1(GLSL.std.450) 25(Atan2) 1104 1105 - Store 1103(r006) 1106 - 1108: 60 Load 63(inF0) - 1109: 60 ExtInst 1(GLSL.std.450) 9(Ceil) 1108 - Store 1107(r007) 1109 - 1110: 60 Load 63(inF0) - 1112: 1085 FOrdLessThan 1110 1111 - 1113: 135(bool) Any 1112 - SelectionMerge 1115 None - BranchConditional 1113 1114 1115 - 1114: Label +68(PixelShaderFunction2x2(mf22;mf22;mf22;): 62 Function None 64 + 65(inF0): 63(ptr) FunctionParameter + 66(inF1): 63(ptr) FunctionParameter + 67(inF2): 63(ptr) FunctionParameter + 69: Label + 1087(r000): 138(ptr) Variable Function + 1092(r001): 63(ptr) Variable Function + 1097(r003): 138(ptr) Variable Function + 1101(r004): 63(ptr) Variable Function + 1104(r005): 63(ptr) Variable Function + 1107(r006): 63(ptr) Variable Function + 1111(r007): 63(ptr) Variable Function + 1121(r008): 63(ptr) Variable Function + 1126(r009): 63(ptr) Variable Function + 1129(r010): 63(ptr) Variable Function + 1132(r011): 63(ptr) Variable Function + 1135(r012): 63(ptr) Variable Function + 1138(r013): 63(ptr) Variable Function + 1141(r014): 63(ptr) Variable Function + 1144(r015): 63(ptr) Variable Function + 1147(r016): 63(ptr) Variable Function + 1150(r017): 63(ptr) Variable Function + 1153(r018): 7(ptr) Variable Function + 1156(r019): 63(ptr) Variable Function + 1159(R020): 63(ptr) Variable Function + 1162(r021): 63(ptr) Variable Function + 1165(r022): 63(ptr) Variable Function + 1175(r023): 63(ptr) Variable Function + 1178(r025): 63(ptr) Variable Function + 1181(r026): 63(ptr) Variable Function + 1185(r026a): 63(ptr) Variable Function + 1190(r027): 63(ptr) Variable Function + 1193(r028): 63(ptr) Variable Function + 1197(r029): 63(ptr) Variable Function + 1200(r030): 63(ptr) Variable Function + 1204(r031): 63(ptr) Variable Function + 1208(r032): 63(ptr) Variable Function + 1212(r033): 63(ptr) Variable Function + 1215(r034): 63(ptr) Variable Function + 1218(r035): 63(ptr) Variable Function + 1221(r036): 63(ptr) Variable Function + 1226(r037): 63(ptr) Variable Function + 1229(r038): 63(ptr) Variable Function + 1236(r039): 63(ptr) Variable Function + 1239(r049): 63(ptr) Variable Function + 1244(r041): 63(ptr) Variable Function + 1247(r042): 63(ptr) Variable Function + 1251(r043): 63(ptr) Variable Function + 1254(r044): 63(ptr) Variable Function + 1259(r046): 63(ptr) Variable Function + 1088: 62 Load 65(inF0) + 1090: 1089 FOrdNotEqual 1088 141 + 1091: 137(bool) All 1090 + Store 1087(r000) 1091 + 1093: 62 Load 65(inF0) + 1094: 62 ExtInst 1(GLSL.std.450) 4(FAbs) 1093 + Store 1092(r001) 1094 + 1095: 62 Load 65(inF0) + 1096: 62 ExtInst 1(GLSL.std.450) 17(Acos) 1095 + 1098: 62 Load 65(inF0) + 1099: 1089 FOrdNotEqual 1098 141 + 1100: 137(bool) Any 1099 + Store 1097(r003) 1100 + 1102: 62 Load 65(inF0) + 1103: 62 ExtInst 1(GLSL.std.450) 16(Asin) 1102 + Store 1101(r004) 1103 + 1105: 62 Load 65(inF0) + 1106: 62 ExtInst 1(GLSL.std.450) 18(Atan) 1105 + Store 1104(r005) 1106 + 1108: 62 Load 65(inF0) + 1109: 62 Load 66(inF1) + 1110: 62 ExtInst 1(GLSL.std.450) 25(Atan2) 1108 1109 + Store 1107(r006) 1110 + 1112: 62 Load 65(inF0) + 1113: 62 ExtInst 1(GLSL.std.450) 9(Ceil) 1112 + Store 1111(r007) 1113 + 1114: 62 Load 65(inF0) + 1116: 1089 FOrdLessThan 1114 1115 + 1117: 137(bool) Any 1116 + SelectionMerge 1119 None + BranchConditional 1117 1118 1119 + 1118: Label Kill - 1115: Label - 1118: 60 Load 63(inF0) - 1119: 60 Load 64(inF1) - 1120: 60 Load 65(inF2) - 1121: 60 ExtInst 1(GLSL.std.450) 43(FClamp) 1118 1119 1120 - Store 1117(r008) 1121 - 1123: 60 Load 63(inF0) - 1124: 60 ExtInst 1(GLSL.std.450) 14(Cos) 1123 - Store 1122(r009) 1124 - 1126: 60 Load 63(inF0) - 1127: 60 ExtInst 1(GLSL.std.450) 20(Cosh) 1126 - Store 1125(r010) 1127 - 1129: 60 Load 63(inF0) - 1130: 60 DPdx 1129 - Store 1128(r011) 1130 - 1132: 60 Load 63(inF0) - 1133: 60 DPdxCoarse 1132 - Store 1131(r012) 1133 - 1135: 60 Load 63(inF0) - 1136: 60 DPdxFine 1135 - Store 1134(r013) 1136 - 1138: 60 Load 63(inF0) - 1139: 60 DPdy 1138 - Store 1137(r014) 1139 - 1141: 60 Load 63(inF0) - 1142: 60 DPdyCoarse 1141 - Store 1140(r015) 1142 - 1144: 60 Load 63(inF0) - 1145: 60 DPdyFine 1144 - Store 1143(r016) 1145 - 1147: 60 Load 63(inF0) - 1148: 60 ExtInst 1(GLSL.std.450) 12(Degrees) 1147 - Store 1146(r017) 1148 - 1150: 60 Load 63(inF0) - 1151: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 1150 - Store 1149(r018) 1151 - 1153: 60 Load 63(inF0) - 1154: 60 ExtInst 1(GLSL.std.450) 27(Exp) 1153 - Store 1152(r019) 1154 - 1156: 60 Load 63(inF0) - 1157: 60 ExtInst 1(GLSL.std.450) 29(Exp2) 1156 - Store 1155(R020) 1157 - 1159: 60 Load 63(inF0) - 1160: 60 ExtInst 1(GLSL.std.450) 8(Floor) 1159 - Store 1158(r021) 1160 - 1162: 60 Load 63(inF0) - 1163: 60 Load 64(inF1) - 1164: 24(fvec2) CompositeExtract 1162 0 - 1165: 24(fvec2) CompositeExtract 1163 0 - 1166: 24(fvec2) FMod 1164 1165 - 1167: 24(fvec2) CompositeExtract 1162 1 - 1168: 24(fvec2) CompositeExtract 1163 1 - 1169: 24(fvec2) FMod 1167 1168 - 1170: 60 CompositeConstruct 1166 1169 - Store 1161(r022) 1170 - 1172: 60 Load 63(inF0) - 1173: 60 ExtInst 1(GLSL.std.450) 10(Fract) 1172 - Store 1171(r023) 1173 - 1175: 60 Load 63(inF0) - 1176: 60 Fwidth 1175 - Store 1174(r025) 1176 - 1178: 60 Load 63(inF0) - 1179: 60 Load 64(inF1) - 1180: 60 ExtInst 1(GLSL.std.450) 53(Ldexp) 1178 1179 - Store 1177(r026) 1180 - 1182: 60 Load 63(inF0) - 1183: 60 Load 64(inF1) - 1184: 60 Load 65(inF2) - 1185: 60 ExtInst 1(GLSL.std.450) 46(FMix) 1182 1183 1184 - Store 1181(r026a) 1185 - 1187: 60 Load 63(inF0) - 1188: 60 ExtInst 1(GLSL.std.450) 28(Log) 1187 - Store 1186(r027) 1188 - 1190: 60 Load 63(inF0) - 1191: 60 ExtInst 1(GLSL.std.450) 30(Log2) 1190 - 1192: 60 MatrixTimesScalar 1191 268 - Store 1189(r028) 1192 - 1194: 60 Load 63(inF0) - 1195: 60 ExtInst 1(GLSL.std.450) 30(Log2) 1194 - Store 1193(r029) 1195 - 1197: 60 Load 63(inF0) - 1198: 60 Load 64(inF1) - 1199: 60 ExtInst 1(GLSL.std.450) 40(FMax) 1197 1198 - Store 1196(r030) 1199 - 1201: 60 Load 63(inF0) - 1202: 60 Load 64(inF1) - 1203: 60 ExtInst 1(GLSL.std.450) 37(FMin) 1201 1202 - Store 1200(r031) 1203 - 1205: 60 Load 63(inF0) - 1206: 60 Load 64(inF1) - 1207: 60 ExtInst 1(GLSL.std.450) 26(Pow) 1205 1206 - Store 1204(r032) 1207 - 1209: 60 Load 63(inF0) - 1210: 60 ExtInst 1(GLSL.std.450) 11(Radians) 1209 - Store 1208(r033) 1210 - 1212: 60 Load 63(inF0) - 1213: 60 ExtInst 1(GLSL.std.450) 2(RoundEven) 1212 - Store 1211(r034) 1213 - 1215: 60 Load 63(inF0) - 1216: 60 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1215 - Store 1214(r035) 1216 - 1218: 60 Load 63(inF0) - 1219: 24(fvec2) CompositeConstruct 139 139 - 1220: 24(fvec2) CompositeConstruct 289 289 - 1221: 60 ExtInst 1(GLSL.std.450) 43(FClamp) 1218 1219 1220 - Store 1217(r036) 1221 - 1223: 60 Load 63(inF0) - 1224: 60 ExtInst 1(GLSL.std.450) 6(FSign) 1223 - Store 1222(r037) 1224 - 1226: 60 Load 63(inF0) - 1227: 60 ExtInst 1(GLSL.std.450) 13(Sin) 1226 - Store 1225(r038) 1227 - 1228: 60 Load 63(inF0) - 1229: 60 ExtInst 1(GLSL.std.450) 13(Sin) 1228 - Store 64(inF1) 1229 - 1230: 60 Load 63(inF0) - 1231: 60 ExtInst 1(GLSL.std.450) 14(Cos) 1230 - Store 65(inF2) 1231 - 1233: 60 Load 63(inF0) - 1234: 60 ExtInst 1(GLSL.std.450) 19(Sinh) 1233 - Store 1232(r039) 1234 - 1236: 60 Load 63(inF0) - 1237: 60 Load 64(inF1) - 1238: 60 Load 65(inF2) - 1239: 60 ExtInst 1(GLSL.std.450) 49(SmoothStep) 1236 1237 1238 - Store 1235(r049) 1239 - 1241: 60 Load 63(inF0) - 1242: 60 ExtInst 1(GLSL.std.450) 31(Sqrt) 1241 - Store 1240(r041) 1242 - 1244: 60 Load 63(inF0) - 1245: 60 Load 64(inF1) - 1246: 60 ExtInst 1(GLSL.std.450) 48(Step) 1244 1245 - Store 1243(r042) 1246 - 1248: 60 Load 63(inF0) - 1249: 60 ExtInst 1(GLSL.std.450) 15(Tan) 1248 - Store 1247(r043) 1249 - 1251: 60 Load 63(inF0) - 1252: 60 ExtInst 1(GLSL.std.450) 21(Tanh) 1251 - Store 1250(r044) 1252 - 1253: 60 Load 63(inF0) - 1254: 60 Transpose 1253 - 1256: 60 Load 63(inF0) - 1257: 60 ExtInst 1(GLSL.std.450) 3(Trunc) 1256 - Store 1255(r046) 1257 - ReturnValue 1259 + 1119: Label + 1122: 62 Load 65(inF0) + 1123: 62 Load 66(inF1) + 1124: 62 Load 67(inF2) + 1125: 62 ExtInst 1(GLSL.std.450) 43(FClamp) 1122 1123 1124 + Store 1121(r008) 1125 + 1127: 62 Load 65(inF0) + 1128: 62 ExtInst 1(GLSL.std.450) 14(Cos) 1127 + Store 1126(r009) 1128 + 1130: 62 Load 65(inF0) + 1131: 62 ExtInst 1(GLSL.std.450) 20(Cosh) 1130 + Store 1129(r010) 1131 + 1133: 62 Load 65(inF0) + 1134: 62 DPdx 1133 + Store 1132(r011) 1134 + 1136: 62 Load 65(inF0) + 1137: 62 DPdxCoarse 1136 + Store 1135(r012) 1137 + 1139: 62 Load 65(inF0) + 1140: 62 DPdxFine 1139 + Store 1138(r013) 1140 + 1142: 62 Load 65(inF0) + 1143: 62 DPdy 1142 + Store 1141(r014) 1143 + 1145: 62 Load 65(inF0) + 1146: 62 DPdyCoarse 1145 + Store 1144(r015) 1146 + 1148: 62 Load 65(inF0) + 1149: 62 DPdyFine 1148 + Store 1147(r016) 1149 + 1151: 62 Load 65(inF0) + 1152: 62 ExtInst 1(GLSL.std.450) 12(Degrees) 1151 + Store 1150(r017) 1152 + 1154: 62 Load 65(inF0) + 1155: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 1154 + Store 1153(r018) 1155 + 1157: 62 Load 65(inF0) + 1158: 62 ExtInst 1(GLSL.std.450) 27(Exp) 1157 + Store 1156(r019) 1158 + 1160: 62 Load 65(inF0) + 1161: 62 ExtInst 1(GLSL.std.450) 29(Exp2) 1160 + Store 1159(R020) 1161 + 1163: 62 Load 65(inF0) + 1164: 62 ExtInst 1(GLSL.std.450) 8(Floor) 1163 + Store 1162(r021) 1164 + 1166: 62 Load 65(inF0) + 1167: 62 Load 66(inF1) + 1168: 26(fvec2) CompositeExtract 1166 0 + 1169: 26(fvec2) CompositeExtract 1167 0 + 1170: 26(fvec2) FMod 1168 1169 + 1171: 26(fvec2) CompositeExtract 1166 1 + 1172: 26(fvec2) CompositeExtract 1167 1 + 1173: 26(fvec2) FMod 1171 1172 + 1174: 62 CompositeConstruct 1170 1173 + Store 1165(r022) 1174 + 1176: 62 Load 65(inF0) + 1177: 62 ExtInst 1(GLSL.std.450) 10(Fract) 1176 + Store 1175(r023) 1177 + 1179: 62 Load 65(inF0) + 1180: 62 Fwidth 1179 + Store 1178(r025) 1180 + 1182: 62 Load 65(inF0) + 1183: 62 Load 66(inF1) + 1184: 62 ExtInst 1(GLSL.std.450) 53(Ldexp) 1182 1183 + Store 1181(r026) 1184 + 1186: 62 Load 65(inF0) + 1187: 62 Load 66(inF1) + 1188: 62 Load 67(inF2) + 1189: 62 ExtInst 1(GLSL.std.450) 46(FMix) 1186 1187 1188 + Store 1185(r026a) 1189 + 1191: 62 Load 65(inF0) + 1192: 62 ExtInst 1(GLSL.std.450) 28(Log) 1191 + Store 1190(r027) 1192 + 1194: 62 Load 65(inF0) + 1195: 62 ExtInst 1(GLSL.std.450) 30(Log2) 1194 + 1196: 62 MatrixTimesScalar 1195 272 + Store 1193(r028) 1196 + 1198: 62 Load 65(inF0) + 1199: 62 ExtInst 1(GLSL.std.450) 30(Log2) 1198 + Store 1197(r029) 1199 + 1201: 62 Load 65(inF0) + 1202: 62 Load 66(inF1) + 1203: 62 ExtInst 1(GLSL.std.450) 40(FMax) 1201 1202 + Store 1200(r030) 1203 + 1205: 62 Load 65(inF0) + 1206: 62 Load 66(inF1) + 1207: 62 ExtInst 1(GLSL.std.450) 37(FMin) 1205 1206 + Store 1204(r031) 1207 + 1209: 62 Load 65(inF0) + 1210: 62 Load 66(inF1) + 1211: 62 ExtInst 1(GLSL.std.450) 26(Pow) 1209 1210 + Store 1208(r032) 1211 + 1213: 62 Load 65(inF0) + 1214: 62 ExtInst 1(GLSL.std.450) 11(Radians) 1213 + Store 1212(r033) 1214 + 1216: 62 Load 65(inF0) + 1217: 62 ExtInst 1(GLSL.std.450) 2(RoundEven) 1216 + Store 1215(r034) 1217 + 1219: 62 Load 65(inF0) + 1220: 62 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1219 + Store 1218(r035) 1220 + 1222: 62 Load 65(inF0) + 1223: 26(fvec2) CompositeConstruct 141 141 + 1224: 26(fvec2) CompositeConstruct 293 293 + 1225: 62 ExtInst 1(GLSL.std.450) 43(FClamp) 1222 1223 1224 + Store 1221(r036) 1225 + 1227: 62 Load 65(inF0) + 1228: 62 ExtInst 1(GLSL.std.450) 6(FSign) 1227 + Store 1226(r037) 1228 + 1230: 62 Load 65(inF0) + 1231: 62 ExtInst 1(GLSL.std.450) 13(Sin) 1230 + Store 1229(r038) 1231 + 1232: 62 Load 65(inF0) + 1233: 62 ExtInst 1(GLSL.std.450) 13(Sin) 1232 + Store 66(inF1) 1233 + 1234: 62 Load 65(inF0) + 1235: 62 ExtInst 1(GLSL.std.450) 14(Cos) 1234 + Store 67(inF2) 1235 + 1237: 62 Load 65(inF0) + 1238: 62 ExtInst 1(GLSL.std.450) 19(Sinh) 1237 + Store 1236(r039) 1238 + 1240: 62 Load 65(inF0) + 1241: 62 Load 66(inF1) + 1242: 62 Load 67(inF2) + 1243: 62 ExtInst 1(GLSL.std.450) 49(SmoothStep) 1240 1241 1242 + Store 1239(r049) 1243 + 1245: 62 Load 65(inF0) + 1246: 62 ExtInst 1(GLSL.std.450) 31(Sqrt) 1245 + Store 1244(r041) 1246 + 1248: 62 Load 65(inF0) + 1249: 62 Load 66(inF1) + 1250: 62 ExtInst 1(GLSL.std.450) 48(Step) 1248 1249 + Store 1247(r042) 1250 + 1252: 62 Load 65(inF0) + 1253: 62 ExtInst 1(GLSL.std.450) 15(Tan) 1252 + Store 1251(r043) 1253 + 1255: 62 Load 65(inF0) + 1256: 62 ExtInst 1(GLSL.std.450) 21(Tanh) 1255 + Store 1254(r044) 1256 + 1257: 62 Load 65(inF0) + 1258: 62 Transpose 1257 + 1260: 62 Load 65(inF0) + 1261: 62 ExtInst 1(GLSL.std.450) 3(Trunc) 1260 + Store 1259(r046) 1261 + ReturnValue 1263 FunctionEnd -74(PixelShaderFunction3x3(mf33;mf33;mf33;): 68 Function None 70 - 71(inF0): 69(ptr) FunctionParameter - 72(inF1): 69(ptr) FunctionParameter - 73(inF2): 69(ptr) FunctionParameter - 75: Label - 1262(r000): 136(ptr) Variable Function - 1267(r001): 69(ptr) Variable Function - 1272(r003): 136(ptr) Variable Function - 1276(r004): 69(ptr) Variable Function - 1279(r005): 69(ptr) Variable Function - 1282(r006): 69(ptr) Variable Function - 1286(r007): 69(ptr) Variable Function - 1296(r008): 69(ptr) Variable Function - 1301(r009): 69(ptr) Variable Function - 1304(r010): 69(ptr) Variable Function - 1307(r011): 69(ptr) Variable Function - 1310(r012): 69(ptr) Variable Function - 1313(r013): 69(ptr) Variable Function - 1316(r014): 69(ptr) Variable Function - 1319(r015): 69(ptr) Variable Function - 1322(r016): 69(ptr) Variable Function - 1325(r017): 69(ptr) Variable Function - 1328(r018): 7(ptr) Variable Function - 1331(r019): 69(ptr) Variable Function - 1334(R020): 69(ptr) Variable Function - 1337(r021): 69(ptr) Variable Function - 1340(r022): 69(ptr) Variable Function - 1353(r023): 69(ptr) Variable Function - 1356(r025): 69(ptr) Variable Function - 1359(r026): 69(ptr) Variable Function - 1363(r026a): 69(ptr) Variable Function - 1368(r027): 69(ptr) Variable Function - 1371(r028): 69(ptr) Variable Function - 1375(r029): 69(ptr) Variable Function - 1378(r030): 69(ptr) Variable Function - 1382(r031): 69(ptr) Variable Function - 1386(r032): 69(ptr) Variable Function - 1390(r033): 69(ptr) Variable Function - 1393(r034): 69(ptr) Variable Function - 1396(r035): 69(ptr) Variable Function - 1399(r036): 69(ptr) Variable Function - 1404(r037): 69(ptr) Variable Function - 1407(r038): 69(ptr) Variable Function - 1414(r039): 69(ptr) Variable Function - 1417(r049): 69(ptr) Variable Function - 1422(r041): 69(ptr) Variable Function - 1425(r042): 69(ptr) Variable Function - 1429(r043): 69(ptr) Variable Function - 1432(r044): 69(ptr) Variable Function - 1437(r046): 69(ptr) Variable Function - 1263: 68 Load 71(inF0) - 1265: 1264 FOrdNotEqual 1263 139 - 1266: 135(bool) All 1265 - Store 1262(r000) 1266 - 1268: 68 Load 71(inF0) - 1269: 68 ExtInst 1(GLSL.std.450) 4(FAbs) 1268 - Store 1267(r001) 1269 - 1270: 68 Load 71(inF0) - 1271: 68 ExtInst 1(GLSL.std.450) 17(Acos) 1270 - 1273: 68 Load 71(inF0) - 1274: 1264 FOrdNotEqual 1273 139 - 1275: 135(bool) Any 1274 - Store 1272(r003) 1275 - 1277: 68 Load 71(inF0) - 1278: 68 ExtInst 1(GLSL.std.450) 16(Asin) 1277 - Store 1276(r004) 1278 - 1280: 68 Load 71(inF0) - 1281: 68 ExtInst 1(GLSL.std.450) 18(Atan) 1280 - Store 1279(r005) 1281 - 1283: 68 Load 71(inF0) - 1284: 68 Load 72(inF1) - 1285: 68 ExtInst 1(GLSL.std.450) 25(Atan2) 1283 1284 - Store 1282(r006) 1285 - 1287: 68 Load 71(inF0) - 1288: 68 ExtInst 1(GLSL.std.450) 9(Ceil) 1287 - Store 1286(r007) 1288 - 1289: 68 Load 71(inF0) - 1291: 1264 FOrdLessThan 1289 1290 - 1292: 135(bool) Any 1291 - SelectionMerge 1294 None - BranchConditional 1292 1293 1294 - 1293: Label +76(PixelShaderFunction3x3(mf33;mf33;mf33;): 70 Function None 72 + 73(inF0): 71(ptr) FunctionParameter + 74(inF1): 71(ptr) FunctionParameter + 75(inF2): 71(ptr) FunctionParameter + 77: Label + 1266(r000): 138(ptr) Variable Function + 1271(r001): 71(ptr) Variable Function + 1276(r003): 138(ptr) Variable Function + 1280(r004): 71(ptr) Variable Function + 1283(r005): 71(ptr) Variable Function + 1286(r006): 71(ptr) Variable Function + 1290(r007): 71(ptr) Variable Function + 1300(r008): 71(ptr) Variable Function + 1305(r009): 71(ptr) Variable Function + 1308(r010): 71(ptr) Variable Function + 1311(r011): 71(ptr) Variable Function + 1314(r012): 71(ptr) Variable Function + 1317(r013): 71(ptr) Variable Function + 1320(r014): 71(ptr) Variable Function + 1323(r015): 71(ptr) Variable Function + 1326(r016): 71(ptr) Variable Function + 1329(r017): 71(ptr) Variable Function + 1332(r018): 7(ptr) Variable Function + 1335(r019): 71(ptr) Variable Function + 1338(R020): 71(ptr) Variable Function + 1341(r021): 71(ptr) Variable Function + 1344(r022): 71(ptr) Variable Function + 1357(r023): 71(ptr) Variable Function + 1360(r025): 71(ptr) Variable Function + 1363(r026): 71(ptr) Variable Function + 1367(r026a): 71(ptr) Variable Function + 1372(r027): 71(ptr) Variable Function + 1375(r028): 71(ptr) Variable Function + 1379(r029): 71(ptr) Variable Function + 1382(r030): 71(ptr) Variable Function + 1386(r031): 71(ptr) Variable Function + 1390(r032): 71(ptr) Variable Function + 1394(r033): 71(ptr) Variable Function + 1397(r034): 71(ptr) Variable Function + 1400(r035): 71(ptr) Variable Function + 1403(r036): 71(ptr) Variable Function + 1408(r037): 71(ptr) Variable Function + 1411(r038): 71(ptr) Variable Function + 1418(r039): 71(ptr) Variable Function + 1421(r049): 71(ptr) Variable Function + 1426(r041): 71(ptr) Variable Function + 1429(r042): 71(ptr) Variable Function + 1433(r043): 71(ptr) Variable Function + 1436(r044): 71(ptr) Variable Function + 1441(r046): 71(ptr) Variable Function + 1267: 70 Load 73(inF0) + 1269: 1268 FOrdNotEqual 1267 141 + 1270: 137(bool) All 1269 + Store 1266(r000) 1270 + 1272: 70 Load 73(inF0) + 1273: 70 ExtInst 1(GLSL.std.450) 4(FAbs) 1272 + Store 1271(r001) 1273 + 1274: 70 Load 73(inF0) + 1275: 70 ExtInst 1(GLSL.std.450) 17(Acos) 1274 + 1277: 70 Load 73(inF0) + 1278: 1268 FOrdNotEqual 1277 141 + 1279: 137(bool) Any 1278 + Store 1276(r003) 1279 + 1281: 70 Load 73(inF0) + 1282: 70 ExtInst 1(GLSL.std.450) 16(Asin) 1281 + Store 1280(r004) 1282 + 1284: 70 Load 73(inF0) + 1285: 70 ExtInst 1(GLSL.std.450) 18(Atan) 1284 + Store 1283(r005) 1285 + 1287: 70 Load 73(inF0) + 1288: 70 Load 74(inF1) + 1289: 70 ExtInst 1(GLSL.std.450) 25(Atan2) 1287 1288 + Store 1286(r006) 1289 + 1291: 70 Load 73(inF0) + 1292: 70 ExtInst 1(GLSL.std.450) 9(Ceil) 1291 + Store 1290(r007) 1292 + 1293: 70 Load 73(inF0) + 1295: 1268 FOrdLessThan 1293 1294 + 1296: 137(bool) Any 1295 + SelectionMerge 1298 None + BranchConditional 1296 1297 1298 + 1297: Label Kill - 1294: Label - 1297: 68 Load 71(inF0) - 1298: 68 Load 72(inF1) - 1299: 68 Load 73(inF2) - 1300: 68 ExtInst 1(GLSL.std.450) 43(FClamp) 1297 1298 1299 - Store 1296(r008) 1300 - 1302: 68 Load 71(inF0) - 1303: 68 ExtInst 1(GLSL.std.450) 14(Cos) 1302 - Store 1301(r009) 1303 - 1305: 68 Load 71(inF0) - 1306: 68 ExtInst 1(GLSL.std.450) 20(Cosh) 1305 - Store 1304(r010) 1306 - 1308: 68 Load 71(inF0) - 1309: 68 DPdx 1308 - Store 1307(r011) 1309 - 1311: 68 Load 71(inF0) - 1312: 68 DPdxCoarse 1311 - Store 1310(r012) 1312 - 1314: 68 Load 71(inF0) - 1315: 68 DPdxFine 1314 - Store 1313(r013) 1315 - 1317: 68 Load 71(inF0) - 1318: 68 DPdy 1317 - Store 1316(r014) 1318 - 1320: 68 Load 71(inF0) - 1321: 68 DPdyCoarse 1320 - Store 1319(r015) 1321 - 1323: 68 Load 71(inF0) - 1324: 68 DPdyFine 1323 - Store 1322(r016) 1324 - 1326: 68 Load 71(inF0) - 1327: 68 ExtInst 1(GLSL.std.450) 12(Degrees) 1326 - Store 1325(r017) 1327 - 1329: 68 Load 71(inF0) - 1330: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 1329 - Store 1328(r018) 1330 - 1332: 68 Load 71(inF0) - 1333: 68 ExtInst 1(GLSL.std.450) 27(Exp) 1332 - Store 1331(r019) 1333 - 1335: 68 Load 71(inF0) - 1336: 68 ExtInst 1(GLSL.std.450) 29(Exp2) 1335 - Store 1334(R020) 1336 - 1338: 68 Load 71(inF0) - 1339: 68 ExtInst 1(GLSL.std.450) 8(Floor) 1338 - Store 1337(r021) 1339 - 1341: 68 Load 71(inF0) - 1342: 68 Load 72(inF1) - 1343: 36(fvec3) CompositeExtract 1341 0 - 1344: 36(fvec3) CompositeExtract 1342 0 - 1345: 36(fvec3) FMod 1343 1344 - 1346: 36(fvec3) CompositeExtract 1341 1 - 1347: 36(fvec3) CompositeExtract 1342 1 - 1348: 36(fvec3) FMod 1346 1347 - 1349: 36(fvec3) CompositeExtract 1341 2 - 1350: 36(fvec3) CompositeExtract 1342 2 - 1351: 36(fvec3) FMod 1349 1350 - 1352: 68 CompositeConstruct 1345 1348 1351 - Store 1340(r022) 1352 - 1354: 68 Load 71(inF0) - 1355: 68 ExtInst 1(GLSL.std.450) 10(Fract) 1354 - Store 1353(r023) 1355 - 1357: 68 Load 71(inF0) - 1358: 68 Fwidth 1357 - Store 1356(r025) 1358 - 1360: 68 Load 71(inF0) - 1361: 68 Load 72(inF1) - 1362: 68 ExtInst 1(GLSL.std.450) 53(Ldexp) 1360 1361 - Store 1359(r026) 1362 - 1364: 68 Load 71(inF0) - 1365: 68 Load 72(inF1) - 1366: 68 Load 73(inF2) - 1367: 68 ExtInst 1(GLSL.std.450) 46(FMix) 1364 1365 1366 - Store 1363(r026a) 1367 - 1369: 68 Load 71(inF0) - 1370: 68 ExtInst 1(GLSL.std.450) 28(Log) 1369 - Store 1368(r027) 1370 - 1372: 68 Load 71(inF0) - 1373: 68 ExtInst 1(GLSL.std.450) 30(Log2) 1372 - 1374: 68 MatrixTimesScalar 1373 268 - Store 1371(r028) 1374 - 1376: 68 Load 71(inF0) - 1377: 68 ExtInst 1(GLSL.std.450) 30(Log2) 1376 - Store 1375(r029) 1377 - 1379: 68 Load 71(inF0) - 1380: 68 Load 72(inF1) - 1381: 68 ExtInst 1(GLSL.std.450) 40(FMax) 1379 1380 - Store 1378(r030) 1381 - 1383: 68 Load 71(inF0) - 1384: 68 Load 72(inF1) - 1385: 68 ExtInst 1(GLSL.std.450) 37(FMin) 1383 1384 - Store 1382(r031) 1385 - 1387: 68 Load 71(inF0) - 1388: 68 Load 72(inF1) - 1389: 68 ExtInst 1(GLSL.std.450) 26(Pow) 1387 1388 - Store 1386(r032) 1389 - 1391: 68 Load 71(inF0) - 1392: 68 ExtInst 1(GLSL.std.450) 11(Radians) 1391 - Store 1390(r033) 1392 - 1394: 68 Load 71(inF0) - 1395: 68 ExtInst 1(GLSL.std.450) 2(RoundEven) 1394 - Store 1393(r034) 1395 - 1397: 68 Load 71(inF0) - 1398: 68 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1397 - Store 1396(r035) 1398 - 1400: 68 Load 71(inF0) - 1401: 36(fvec3) CompositeConstruct 139 139 139 - 1402: 36(fvec3) CompositeConstruct 289 289 289 - 1403: 68 ExtInst 1(GLSL.std.450) 43(FClamp) 1400 1401 1402 - Store 1399(r036) 1403 - 1405: 68 Load 71(inF0) - 1406: 68 ExtInst 1(GLSL.std.450) 6(FSign) 1405 - Store 1404(r037) 1406 - 1408: 68 Load 71(inF0) - 1409: 68 ExtInst 1(GLSL.std.450) 13(Sin) 1408 - Store 1407(r038) 1409 - 1410: 68 Load 71(inF0) - 1411: 68 ExtInst 1(GLSL.std.450) 13(Sin) 1410 - Store 72(inF1) 1411 - 1412: 68 Load 71(inF0) - 1413: 68 ExtInst 1(GLSL.std.450) 14(Cos) 1412 - Store 73(inF2) 1413 - 1415: 68 Load 71(inF0) - 1416: 68 ExtInst 1(GLSL.std.450) 19(Sinh) 1415 - Store 1414(r039) 1416 - 1418: 68 Load 71(inF0) - 1419: 68 Load 72(inF1) - 1420: 68 Load 73(inF2) - 1421: 68 ExtInst 1(GLSL.std.450) 49(SmoothStep) 1418 1419 1420 - Store 1417(r049) 1421 - 1423: 68 Load 71(inF0) - 1424: 68 ExtInst 1(GLSL.std.450) 31(Sqrt) 1423 - Store 1422(r041) 1424 - 1426: 68 Load 71(inF0) - 1427: 68 Load 72(inF1) - 1428: 68 ExtInst 1(GLSL.std.450) 48(Step) 1426 1427 - Store 1425(r042) 1428 - 1430: 68 Load 71(inF0) - 1431: 68 ExtInst 1(GLSL.std.450) 15(Tan) 1430 - Store 1429(r043) 1431 - 1433: 68 Load 71(inF0) - 1434: 68 ExtInst 1(GLSL.std.450) 21(Tanh) 1433 - Store 1432(r044) 1434 - 1435: 68 Load 71(inF0) - 1436: 68 Transpose 1435 - 1438: 68 Load 71(inF0) - 1439: 68 ExtInst 1(GLSL.std.450) 3(Trunc) 1438 - Store 1437(r046) 1439 - ReturnValue 1441 + 1298: Label + 1301: 70 Load 73(inF0) + 1302: 70 Load 74(inF1) + 1303: 70 Load 75(inF2) + 1304: 70 ExtInst 1(GLSL.std.450) 43(FClamp) 1301 1302 1303 + Store 1300(r008) 1304 + 1306: 70 Load 73(inF0) + 1307: 70 ExtInst 1(GLSL.std.450) 14(Cos) 1306 + Store 1305(r009) 1307 + 1309: 70 Load 73(inF0) + 1310: 70 ExtInst 1(GLSL.std.450) 20(Cosh) 1309 + Store 1308(r010) 1310 + 1312: 70 Load 73(inF0) + 1313: 70 DPdx 1312 + Store 1311(r011) 1313 + 1315: 70 Load 73(inF0) + 1316: 70 DPdxCoarse 1315 + Store 1314(r012) 1316 + 1318: 70 Load 73(inF0) + 1319: 70 DPdxFine 1318 + Store 1317(r013) 1319 + 1321: 70 Load 73(inF0) + 1322: 70 DPdy 1321 + Store 1320(r014) 1322 + 1324: 70 Load 73(inF0) + 1325: 70 DPdyCoarse 1324 + Store 1323(r015) 1325 + 1327: 70 Load 73(inF0) + 1328: 70 DPdyFine 1327 + Store 1326(r016) 1328 + 1330: 70 Load 73(inF0) + 1331: 70 ExtInst 1(GLSL.std.450) 12(Degrees) 1330 + Store 1329(r017) 1331 + 1333: 70 Load 73(inF0) + 1334: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 1333 + Store 1332(r018) 1334 + 1336: 70 Load 73(inF0) + 1337: 70 ExtInst 1(GLSL.std.450) 27(Exp) 1336 + Store 1335(r019) 1337 + 1339: 70 Load 73(inF0) + 1340: 70 ExtInst 1(GLSL.std.450) 29(Exp2) 1339 + Store 1338(R020) 1340 + 1342: 70 Load 73(inF0) + 1343: 70 ExtInst 1(GLSL.std.450) 8(Floor) 1342 + Store 1341(r021) 1343 + 1345: 70 Load 73(inF0) + 1346: 70 Load 74(inF1) + 1347: 38(fvec3) CompositeExtract 1345 0 + 1348: 38(fvec3) CompositeExtract 1346 0 + 1349: 38(fvec3) FMod 1347 1348 + 1350: 38(fvec3) CompositeExtract 1345 1 + 1351: 38(fvec3) CompositeExtract 1346 1 + 1352: 38(fvec3) FMod 1350 1351 + 1353: 38(fvec3) CompositeExtract 1345 2 + 1354: 38(fvec3) CompositeExtract 1346 2 + 1355: 38(fvec3) FMod 1353 1354 + 1356: 70 CompositeConstruct 1349 1352 1355 + Store 1344(r022) 1356 + 1358: 70 Load 73(inF0) + 1359: 70 ExtInst 1(GLSL.std.450) 10(Fract) 1358 + Store 1357(r023) 1359 + 1361: 70 Load 73(inF0) + 1362: 70 Fwidth 1361 + Store 1360(r025) 1362 + 1364: 70 Load 73(inF0) + 1365: 70 Load 74(inF1) + 1366: 70 ExtInst 1(GLSL.std.450) 53(Ldexp) 1364 1365 + Store 1363(r026) 1366 + 1368: 70 Load 73(inF0) + 1369: 70 Load 74(inF1) + 1370: 70 Load 75(inF2) + 1371: 70 ExtInst 1(GLSL.std.450) 46(FMix) 1368 1369 1370 + Store 1367(r026a) 1371 + 1373: 70 Load 73(inF0) + 1374: 70 ExtInst 1(GLSL.std.450) 28(Log) 1373 + Store 1372(r027) 1374 + 1376: 70 Load 73(inF0) + 1377: 70 ExtInst 1(GLSL.std.450) 30(Log2) 1376 + 1378: 70 MatrixTimesScalar 1377 272 + Store 1375(r028) 1378 + 1380: 70 Load 73(inF0) + 1381: 70 ExtInst 1(GLSL.std.450) 30(Log2) 1380 + Store 1379(r029) 1381 + 1383: 70 Load 73(inF0) + 1384: 70 Load 74(inF1) + 1385: 70 ExtInst 1(GLSL.std.450) 40(FMax) 1383 1384 + Store 1382(r030) 1385 + 1387: 70 Load 73(inF0) + 1388: 70 Load 74(inF1) + 1389: 70 ExtInst 1(GLSL.std.450) 37(FMin) 1387 1388 + Store 1386(r031) 1389 + 1391: 70 Load 73(inF0) + 1392: 70 Load 74(inF1) + 1393: 70 ExtInst 1(GLSL.std.450) 26(Pow) 1391 1392 + Store 1390(r032) 1393 + 1395: 70 Load 73(inF0) + 1396: 70 ExtInst 1(GLSL.std.450) 11(Radians) 1395 + Store 1394(r033) 1396 + 1398: 70 Load 73(inF0) + 1399: 70 ExtInst 1(GLSL.std.450) 2(RoundEven) 1398 + Store 1397(r034) 1399 + 1401: 70 Load 73(inF0) + 1402: 70 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1401 + Store 1400(r035) 1402 + 1404: 70 Load 73(inF0) + 1405: 38(fvec3) CompositeConstruct 141 141 141 + 1406: 38(fvec3) CompositeConstruct 293 293 293 + 1407: 70 ExtInst 1(GLSL.std.450) 43(FClamp) 1404 1405 1406 + Store 1403(r036) 1407 + 1409: 70 Load 73(inF0) + 1410: 70 ExtInst 1(GLSL.std.450) 6(FSign) 1409 + Store 1408(r037) 1410 + 1412: 70 Load 73(inF0) + 1413: 70 ExtInst 1(GLSL.std.450) 13(Sin) 1412 + Store 1411(r038) 1413 + 1414: 70 Load 73(inF0) + 1415: 70 ExtInst 1(GLSL.std.450) 13(Sin) 1414 + Store 74(inF1) 1415 + 1416: 70 Load 73(inF0) + 1417: 70 ExtInst 1(GLSL.std.450) 14(Cos) 1416 + Store 75(inF2) 1417 + 1419: 70 Load 73(inF0) + 1420: 70 ExtInst 1(GLSL.std.450) 19(Sinh) 1419 + Store 1418(r039) 1420 + 1422: 70 Load 73(inF0) + 1423: 70 Load 74(inF1) + 1424: 70 Load 75(inF2) + 1425: 70 ExtInst 1(GLSL.std.450) 49(SmoothStep) 1422 1423 1424 + Store 1421(r049) 1425 + 1427: 70 Load 73(inF0) + 1428: 70 ExtInst 1(GLSL.std.450) 31(Sqrt) 1427 + Store 1426(r041) 1428 + 1430: 70 Load 73(inF0) + 1431: 70 Load 74(inF1) + 1432: 70 ExtInst 1(GLSL.std.450) 48(Step) 1430 1431 + Store 1429(r042) 1432 + 1434: 70 Load 73(inF0) + 1435: 70 ExtInst 1(GLSL.std.450) 15(Tan) 1434 + Store 1433(r043) 1435 + 1437: 70 Load 73(inF0) + 1438: 70 ExtInst 1(GLSL.std.450) 21(Tanh) 1437 + Store 1436(r044) 1438 + 1439: 70 Load 73(inF0) + 1440: 70 Transpose 1439 + 1442: 70 Load 73(inF0) + 1443: 70 ExtInst 1(GLSL.std.450) 3(Trunc) 1442 + Store 1441(r046) 1443 + ReturnValue 1445 FunctionEnd -82(PixelShaderFunction4x4(mf44;mf44;mf44;): 76 Function None 78 - 79(inF0): 77(ptr) FunctionParameter - 80(inF1): 77(ptr) FunctionParameter - 81(inF2): 77(ptr) FunctionParameter - 83: Label - 1444(r000): 136(ptr) Variable Function - 1449(r001): 77(ptr) Variable Function - 1454(r003): 136(ptr) Variable Function - 1458(r004): 77(ptr) Variable Function - 1461(r005): 77(ptr) Variable Function - 1464(r006): 77(ptr) Variable Function - 1468(r007): 77(ptr) Variable Function - 1478(r008): 77(ptr) Variable Function - 1483(r009): 77(ptr) Variable Function - 1486(r010): 77(ptr) Variable Function - 1489(r011): 77(ptr) Variable Function - 1492(r012): 77(ptr) Variable Function - 1495(r013): 77(ptr) Variable Function - 1498(r014): 77(ptr) Variable Function - 1501(r015): 77(ptr) Variable Function - 1504(r016): 77(ptr) Variable Function - 1507(r017): 77(ptr) Variable Function - 1510(r018): 7(ptr) Variable Function - 1513(r019): 77(ptr) Variable Function - 1516(R020): 77(ptr) Variable Function - 1519(r021): 77(ptr) Variable Function - 1522(r022): 77(ptr) Variable Function - 1538(r023): 77(ptr) Variable Function - 1541(r025): 77(ptr) Variable Function - 1544(r026): 77(ptr) Variable Function - 1548(r026a): 77(ptr) Variable Function - 1553(r027): 77(ptr) Variable Function - 1556(r028): 77(ptr) Variable Function - 1560(r029): 77(ptr) Variable Function - 1563(r030): 77(ptr) Variable Function - 1567(r031): 77(ptr) Variable Function - 1571(r032): 77(ptr) Variable Function - 1575(r033): 77(ptr) Variable Function - 1578(r034): 77(ptr) Variable Function - 1581(r035): 77(ptr) Variable Function - 1584(r036): 77(ptr) Variable Function - 1589(r037): 77(ptr) Variable Function - 1592(r038): 77(ptr) Variable Function - 1599(r039): 77(ptr) Variable Function - 1602(r049): 77(ptr) Variable Function - 1607(r041): 77(ptr) Variable Function - 1610(r042): 77(ptr) Variable Function - 1614(r043): 77(ptr) Variable Function - 1617(r044): 77(ptr) Variable Function - 1622(r046): 77(ptr) Variable Function - 1445: 76 Load 79(inF0) - 1447: 1446 FOrdNotEqual 1445 139 - 1448: 135(bool) All 1447 - Store 1444(r000) 1448 - 1450: 76 Load 79(inF0) - 1451: 76 ExtInst 1(GLSL.std.450) 4(FAbs) 1450 - Store 1449(r001) 1451 - 1452: 76 Load 79(inF0) - 1453: 76 ExtInst 1(GLSL.std.450) 17(Acos) 1452 - 1455: 76 Load 79(inF0) - 1456: 1446 FOrdNotEqual 1455 139 - 1457: 135(bool) Any 1456 - Store 1454(r003) 1457 - 1459: 76 Load 79(inF0) - 1460: 76 ExtInst 1(GLSL.std.450) 16(Asin) 1459 - Store 1458(r004) 1460 - 1462: 76 Load 79(inF0) - 1463: 76 ExtInst 1(GLSL.std.450) 18(Atan) 1462 - Store 1461(r005) 1463 - 1465: 76 Load 79(inF0) - 1466: 76 Load 80(inF1) - 1467: 76 ExtInst 1(GLSL.std.450) 25(Atan2) 1465 1466 - Store 1464(r006) 1467 - 1469: 76 Load 79(inF0) - 1470: 76 ExtInst 1(GLSL.std.450) 9(Ceil) 1469 - Store 1468(r007) 1470 - 1471: 76 Load 79(inF0) - 1473: 1446 FOrdLessThan 1471 1472 - 1474: 135(bool) Any 1473 - SelectionMerge 1476 None - BranchConditional 1474 1475 1476 - 1475: Label +84(PixelShaderFunction4x4(mf44;mf44;mf44;): 78 Function None 80 + 81(inF0): 79(ptr) FunctionParameter + 82(inF1): 79(ptr) FunctionParameter + 83(inF2): 79(ptr) FunctionParameter + 85: Label + 1448(r000): 138(ptr) Variable Function + 1453(r001): 79(ptr) Variable Function + 1458(r003): 138(ptr) Variable Function + 1462(r004): 79(ptr) Variable Function + 1465(r005): 79(ptr) Variable Function + 1468(r006): 79(ptr) Variable Function + 1472(r007): 79(ptr) Variable Function + 1482(r008): 79(ptr) Variable Function + 1487(r009): 79(ptr) Variable Function + 1490(r010): 79(ptr) Variable Function + 1493(r011): 79(ptr) Variable Function + 1496(r012): 79(ptr) Variable Function + 1499(r013): 79(ptr) Variable Function + 1502(r014): 79(ptr) Variable Function + 1505(r015): 79(ptr) Variable Function + 1508(r016): 79(ptr) Variable Function + 1511(r017): 79(ptr) Variable Function + 1514(r018): 7(ptr) Variable Function + 1517(r019): 79(ptr) Variable Function + 1520(R020): 79(ptr) Variable Function + 1523(r021): 79(ptr) Variable Function + 1526(r022): 79(ptr) Variable Function + 1542(r023): 79(ptr) Variable Function + 1545(r025): 79(ptr) Variable Function + 1548(r026): 79(ptr) Variable Function + 1552(r026a): 79(ptr) Variable Function + 1557(r027): 79(ptr) Variable Function + 1560(r028): 79(ptr) Variable Function + 1564(r029): 79(ptr) Variable Function + 1567(r030): 79(ptr) Variable Function + 1571(r031): 79(ptr) Variable Function + 1575(r032): 79(ptr) Variable Function + 1579(r033): 79(ptr) Variable Function + 1582(r034): 79(ptr) Variable Function + 1585(r035): 79(ptr) Variable Function + 1588(r036): 79(ptr) Variable Function + 1593(r037): 79(ptr) Variable Function + 1596(r038): 79(ptr) Variable Function + 1603(r039): 79(ptr) Variable Function + 1606(r049): 79(ptr) Variable Function + 1611(r041): 79(ptr) Variable Function + 1614(r042): 79(ptr) Variable Function + 1618(r043): 79(ptr) Variable Function + 1621(r044): 79(ptr) Variable Function + 1626(r046): 79(ptr) Variable Function + 1449: 78 Load 81(inF0) + 1451: 1450 FOrdNotEqual 1449 141 + 1452: 137(bool) All 1451 + Store 1448(r000) 1452 + 1454: 78 Load 81(inF0) + 1455: 78 ExtInst 1(GLSL.std.450) 4(FAbs) 1454 + Store 1453(r001) 1455 + 1456: 78 Load 81(inF0) + 1457: 78 ExtInst 1(GLSL.std.450) 17(Acos) 1456 + 1459: 78 Load 81(inF0) + 1460: 1450 FOrdNotEqual 1459 141 + 1461: 137(bool) Any 1460 + Store 1458(r003) 1461 + 1463: 78 Load 81(inF0) + 1464: 78 ExtInst 1(GLSL.std.450) 16(Asin) 1463 + Store 1462(r004) 1464 + 1466: 78 Load 81(inF0) + 1467: 78 ExtInst 1(GLSL.std.450) 18(Atan) 1466 + Store 1465(r005) 1467 + 1469: 78 Load 81(inF0) + 1470: 78 Load 82(inF1) + 1471: 78 ExtInst 1(GLSL.std.450) 25(Atan2) 1469 1470 + Store 1468(r006) 1471 + 1473: 78 Load 81(inF0) + 1474: 78 ExtInst 1(GLSL.std.450) 9(Ceil) 1473 + Store 1472(r007) 1474 + 1475: 78 Load 81(inF0) + 1477: 1450 FOrdLessThan 1475 1476 + 1478: 137(bool) Any 1477 + SelectionMerge 1480 None + BranchConditional 1478 1479 1480 + 1479: Label Kill - 1476: Label - 1479: 76 Load 79(inF0) - 1480: 76 Load 80(inF1) - 1481: 76 Load 81(inF2) - 1482: 76 ExtInst 1(GLSL.std.450) 43(FClamp) 1479 1480 1481 - Store 1478(r008) 1482 - 1484: 76 Load 79(inF0) - 1485: 76 ExtInst 1(GLSL.std.450) 14(Cos) 1484 - Store 1483(r009) 1485 - 1487: 76 Load 79(inF0) - 1488: 76 ExtInst 1(GLSL.std.450) 20(Cosh) 1487 - Store 1486(r010) 1488 - 1490: 76 Load 79(inF0) - 1491: 76 DPdx 1490 - Store 1489(r011) 1491 - 1493: 76 Load 79(inF0) - 1494: 76 DPdxCoarse 1493 - Store 1492(r012) 1494 - 1496: 76 Load 79(inF0) - 1497: 76 DPdxFine 1496 - Store 1495(r013) 1497 - 1499: 76 Load 79(inF0) - 1500: 76 DPdy 1499 - Store 1498(r014) 1500 - 1502: 76 Load 79(inF0) - 1503: 76 DPdyCoarse 1502 - Store 1501(r015) 1503 - 1505: 76 Load 79(inF0) - 1506: 76 DPdyFine 1505 - Store 1504(r016) 1506 - 1508: 76 Load 79(inF0) - 1509: 76 ExtInst 1(GLSL.std.450) 12(Degrees) 1508 - Store 1507(r017) 1509 - 1511: 76 Load 79(inF0) - 1512: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 1511 - Store 1510(r018) 1512 - 1514: 76 Load 79(inF0) - 1515: 76 ExtInst 1(GLSL.std.450) 27(Exp) 1514 - Store 1513(r019) 1515 - 1517: 76 Load 79(inF0) - 1518: 76 ExtInst 1(GLSL.std.450) 29(Exp2) 1517 - Store 1516(R020) 1518 - 1520: 76 Load 79(inF0) - 1521: 76 ExtInst 1(GLSL.std.450) 8(Floor) 1520 - Store 1519(r021) 1521 - 1523: 76 Load 79(inF0) - 1524: 76 Load 80(inF1) - 1525: 48(fvec4) CompositeExtract 1523 0 - 1526: 48(fvec4) CompositeExtract 1524 0 - 1527: 48(fvec4) FMod 1525 1526 - 1528: 48(fvec4) CompositeExtract 1523 1 - 1529: 48(fvec4) CompositeExtract 1524 1 - 1530: 48(fvec4) FMod 1528 1529 - 1531: 48(fvec4) CompositeExtract 1523 2 - 1532: 48(fvec4) CompositeExtract 1524 2 - 1533: 48(fvec4) FMod 1531 1532 - 1534: 48(fvec4) CompositeExtract 1523 3 - 1535: 48(fvec4) CompositeExtract 1524 3 - 1536: 48(fvec4) FMod 1534 1535 - 1537: 76 CompositeConstruct 1527 1530 1533 1536 - Store 1522(r022) 1537 - 1539: 76 Load 79(inF0) - 1540: 76 ExtInst 1(GLSL.std.450) 10(Fract) 1539 - Store 1538(r023) 1540 - 1542: 76 Load 79(inF0) - 1543: 76 Fwidth 1542 - Store 1541(r025) 1543 - 1545: 76 Load 79(inF0) - 1546: 76 Load 80(inF1) - 1547: 76 ExtInst 1(GLSL.std.450) 53(Ldexp) 1545 1546 - Store 1544(r026) 1547 - 1549: 76 Load 79(inF0) - 1550: 76 Load 80(inF1) - 1551: 76 Load 81(inF2) - 1552: 76 ExtInst 1(GLSL.std.450) 46(FMix) 1549 1550 1551 - Store 1548(r026a) 1552 - 1554: 76 Load 79(inF0) - 1555: 76 ExtInst 1(GLSL.std.450) 28(Log) 1554 - Store 1553(r027) 1555 - 1557: 76 Load 79(inF0) - 1558: 76 ExtInst 1(GLSL.std.450) 30(Log2) 1557 - 1559: 76 MatrixTimesScalar 1558 268 - Store 1556(r028) 1559 - 1561: 76 Load 79(inF0) - 1562: 76 ExtInst 1(GLSL.std.450) 30(Log2) 1561 - Store 1560(r029) 1562 - 1564: 76 Load 79(inF0) - 1565: 76 Load 80(inF1) - 1566: 76 ExtInst 1(GLSL.std.450) 40(FMax) 1564 1565 - Store 1563(r030) 1566 - 1568: 76 Load 79(inF0) - 1569: 76 Load 80(inF1) - 1570: 76 ExtInst 1(GLSL.std.450) 37(FMin) 1568 1569 - Store 1567(r031) 1570 - 1572: 76 Load 79(inF0) - 1573: 76 Load 80(inF1) - 1574: 76 ExtInst 1(GLSL.std.450) 26(Pow) 1572 1573 - Store 1571(r032) 1574 - 1576: 76 Load 79(inF0) - 1577: 76 ExtInst 1(GLSL.std.450) 11(Radians) 1576 - Store 1575(r033) 1577 - 1579: 76 Load 79(inF0) - 1580: 76 ExtInst 1(GLSL.std.450) 2(RoundEven) 1579 - Store 1578(r034) 1580 - 1582: 76 Load 79(inF0) - 1583: 76 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1582 - Store 1581(r035) 1583 - 1585: 76 Load 79(inF0) - 1586: 48(fvec4) CompositeConstruct 139 139 139 139 - 1587: 48(fvec4) CompositeConstruct 289 289 289 289 - 1588: 76 ExtInst 1(GLSL.std.450) 43(FClamp) 1585 1586 1587 - Store 1584(r036) 1588 - 1590: 76 Load 79(inF0) - 1591: 76 ExtInst 1(GLSL.std.450) 6(FSign) 1590 - Store 1589(r037) 1591 - 1593: 76 Load 79(inF0) - 1594: 76 ExtInst 1(GLSL.std.450) 13(Sin) 1593 - Store 1592(r038) 1594 - 1595: 76 Load 79(inF0) - 1596: 76 ExtInst 1(GLSL.std.450) 13(Sin) 1595 - Store 80(inF1) 1596 - 1597: 76 Load 79(inF0) - 1598: 76 ExtInst 1(GLSL.std.450) 14(Cos) 1597 - Store 81(inF2) 1598 - 1600: 76 Load 79(inF0) - 1601: 76 ExtInst 1(GLSL.std.450) 19(Sinh) 1600 - Store 1599(r039) 1601 - 1603: 76 Load 79(inF0) - 1604: 76 Load 80(inF1) - 1605: 76 Load 81(inF2) - 1606: 76 ExtInst 1(GLSL.std.450) 49(SmoothStep) 1603 1604 1605 - Store 1602(r049) 1606 - 1608: 76 Load 79(inF0) - 1609: 76 ExtInst 1(GLSL.std.450) 31(Sqrt) 1608 - Store 1607(r041) 1609 - 1611: 76 Load 79(inF0) - 1612: 76 Load 80(inF1) - 1613: 76 ExtInst 1(GLSL.std.450) 48(Step) 1611 1612 - Store 1610(r042) 1613 - 1615: 76 Load 79(inF0) - 1616: 76 ExtInst 1(GLSL.std.450) 15(Tan) 1615 - Store 1614(r043) 1616 - 1618: 76 Load 79(inF0) - 1619: 76 ExtInst 1(GLSL.std.450) 21(Tanh) 1618 - Store 1617(r044) 1619 - 1620: 76 Load 79(inF0) - 1621: 76 Transpose 1620 - 1623: 76 Load 79(inF0) - 1624: 76 ExtInst 1(GLSL.std.450) 3(Trunc) 1623 - Store 1622(r046) 1624 - ReturnValue 1626 + 1480: Label + 1483: 78 Load 81(inF0) + 1484: 78 Load 82(inF1) + 1485: 78 Load 83(inF2) + 1486: 78 ExtInst 1(GLSL.std.450) 43(FClamp) 1483 1484 1485 + Store 1482(r008) 1486 + 1488: 78 Load 81(inF0) + 1489: 78 ExtInst 1(GLSL.std.450) 14(Cos) 1488 + Store 1487(r009) 1489 + 1491: 78 Load 81(inF0) + 1492: 78 ExtInst 1(GLSL.std.450) 20(Cosh) 1491 + Store 1490(r010) 1492 + 1494: 78 Load 81(inF0) + 1495: 78 DPdx 1494 + Store 1493(r011) 1495 + 1497: 78 Load 81(inF0) + 1498: 78 DPdxCoarse 1497 + Store 1496(r012) 1498 + 1500: 78 Load 81(inF0) + 1501: 78 DPdxFine 1500 + Store 1499(r013) 1501 + 1503: 78 Load 81(inF0) + 1504: 78 DPdy 1503 + Store 1502(r014) 1504 + 1506: 78 Load 81(inF0) + 1507: 78 DPdyCoarse 1506 + Store 1505(r015) 1507 + 1509: 78 Load 81(inF0) + 1510: 78 DPdyFine 1509 + Store 1508(r016) 1510 + 1512: 78 Load 81(inF0) + 1513: 78 ExtInst 1(GLSL.std.450) 12(Degrees) 1512 + Store 1511(r017) 1513 + 1515: 78 Load 81(inF0) + 1516: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 1515 + Store 1514(r018) 1516 + 1518: 78 Load 81(inF0) + 1519: 78 ExtInst 1(GLSL.std.450) 27(Exp) 1518 + Store 1517(r019) 1519 + 1521: 78 Load 81(inF0) + 1522: 78 ExtInst 1(GLSL.std.450) 29(Exp2) 1521 + Store 1520(R020) 1522 + 1524: 78 Load 81(inF0) + 1525: 78 ExtInst 1(GLSL.std.450) 8(Floor) 1524 + Store 1523(r021) 1525 + 1527: 78 Load 81(inF0) + 1528: 78 Load 82(inF1) + 1529: 50(fvec4) CompositeExtract 1527 0 + 1530: 50(fvec4) CompositeExtract 1528 0 + 1531: 50(fvec4) FMod 1529 1530 + 1532: 50(fvec4) CompositeExtract 1527 1 + 1533: 50(fvec4) CompositeExtract 1528 1 + 1534: 50(fvec4) FMod 1532 1533 + 1535: 50(fvec4) CompositeExtract 1527 2 + 1536: 50(fvec4) CompositeExtract 1528 2 + 1537: 50(fvec4) FMod 1535 1536 + 1538: 50(fvec4) CompositeExtract 1527 3 + 1539: 50(fvec4) CompositeExtract 1528 3 + 1540: 50(fvec4) FMod 1538 1539 + 1541: 78 CompositeConstruct 1531 1534 1537 1540 + Store 1526(r022) 1541 + 1543: 78 Load 81(inF0) + 1544: 78 ExtInst 1(GLSL.std.450) 10(Fract) 1543 + Store 1542(r023) 1544 + 1546: 78 Load 81(inF0) + 1547: 78 Fwidth 1546 + Store 1545(r025) 1547 + 1549: 78 Load 81(inF0) + 1550: 78 Load 82(inF1) + 1551: 78 ExtInst 1(GLSL.std.450) 53(Ldexp) 1549 1550 + Store 1548(r026) 1551 + 1553: 78 Load 81(inF0) + 1554: 78 Load 82(inF1) + 1555: 78 Load 83(inF2) + 1556: 78 ExtInst 1(GLSL.std.450) 46(FMix) 1553 1554 1555 + Store 1552(r026a) 1556 + 1558: 78 Load 81(inF0) + 1559: 78 ExtInst 1(GLSL.std.450) 28(Log) 1558 + Store 1557(r027) 1559 + 1561: 78 Load 81(inF0) + 1562: 78 ExtInst 1(GLSL.std.450) 30(Log2) 1561 + 1563: 78 MatrixTimesScalar 1562 272 + Store 1560(r028) 1563 + 1565: 78 Load 81(inF0) + 1566: 78 ExtInst 1(GLSL.std.450) 30(Log2) 1565 + Store 1564(r029) 1566 + 1568: 78 Load 81(inF0) + 1569: 78 Load 82(inF1) + 1570: 78 ExtInst 1(GLSL.std.450) 40(FMax) 1568 1569 + Store 1567(r030) 1570 + 1572: 78 Load 81(inF0) + 1573: 78 Load 82(inF1) + 1574: 78 ExtInst 1(GLSL.std.450) 37(FMin) 1572 1573 + Store 1571(r031) 1574 + 1576: 78 Load 81(inF0) + 1577: 78 Load 82(inF1) + 1578: 78 ExtInst 1(GLSL.std.450) 26(Pow) 1576 1577 + Store 1575(r032) 1578 + 1580: 78 Load 81(inF0) + 1581: 78 ExtInst 1(GLSL.std.450) 11(Radians) 1580 + Store 1579(r033) 1581 + 1583: 78 Load 81(inF0) + 1584: 78 ExtInst 1(GLSL.std.450) 2(RoundEven) 1583 + Store 1582(r034) 1584 + 1586: 78 Load 81(inF0) + 1587: 78 ExtInst 1(GLSL.std.450) 32(InverseSqrt) 1586 + Store 1585(r035) 1587 + 1589: 78 Load 81(inF0) + 1590: 50(fvec4) CompositeConstruct 141 141 141 141 + 1591: 50(fvec4) CompositeConstruct 293 293 293 293 + 1592: 78 ExtInst 1(GLSL.std.450) 43(FClamp) 1589 1590 1591 + Store 1588(r036) 1592 + 1594: 78 Load 81(inF0) + 1595: 78 ExtInst 1(GLSL.std.450) 6(FSign) 1594 + Store 1593(r037) 1595 + 1597: 78 Load 81(inF0) + 1598: 78 ExtInst 1(GLSL.std.450) 13(Sin) 1597 + Store 1596(r038) 1598 + 1599: 78 Load 81(inF0) + 1600: 78 ExtInst 1(GLSL.std.450) 13(Sin) 1599 + Store 82(inF1) 1600 + 1601: 78 Load 81(inF0) + 1602: 78 ExtInst 1(GLSL.std.450) 14(Cos) 1601 + Store 83(inF2) 1602 + 1604: 78 Load 81(inF0) + 1605: 78 ExtInst 1(GLSL.std.450) 19(Sinh) 1604 + Store 1603(r039) 1605 + 1607: 78 Load 81(inF0) + 1608: 78 Load 82(inF1) + 1609: 78 Load 83(inF2) + 1610: 78 ExtInst 1(GLSL.std.450) 49(SmoothStep) 1607 1608 1609 + Store 1606(r049) 1610 + 1612: 78 Load 81(inF0) + 1613: 78 ExtInst 1(GLSL.std.450) 31(Sqrt) 1612 + Store 1611(r041) 1613 + 1615: 78 Load 81(inF0) + 1616: 78 Load 82(inF1) + 1617: 78 ExtInst 1(GLSL.std.450) 48(Step) 1615 1616 + Store 1614(r042) 1617 + 1619: 78 Load 81(inF0) + 1620: 78 ExtInst 1(GLSL.std.450) 15(Tan) 1619 + Store 1618(r043) 1620 + 1622: 78 Load 81(inF0) + 1623: 78 ExtInst 1(GLSL.std.450) 21(Tanh) 1622 + Store 1621(r044) 1623 + 1624: 78 Load 81(inF0) + 1625: 78 Transpose 1624 + 1627: 78 Load 81(inF0) + 1628: 78 ExtInst 1(GLSL.std.450) 3(Trunc) 1627 + Store 1626(r046) 1628 + ReturnValue 1630 FunctionEnd -91(TestGenMul2(f1;f1;vf2;vf2;mf22;mf22;): 2 Function None 84 - 85(inF0): 7(ptr) FunctionParameter - 86(inF1): 7(ptr) FunctionParameter - 87(inFV0): 25(ptr) FunctionParameter - 88(inFV1): 25(ptr) FunctionParameter - 89(inFM0): 61(ptr) FunctionParameter - 90(inFM1): 61(ptr) FunctionParameter - 92: Label - 1629(r0): 7(ptr) Variable Function - 1633(r1): 25(ptr) Variable Function - 1637(r2): 25(ptr) Variable Function - 1641(r3): 7(ptr) Variable Function - 1645(r4): 25(ptr) Variable Function - 1649(r5): 25(ptr) Variable Function - 1653(r6): 61(ptr) Variable Function - 1657(r7): 61(ptr) Variable Function - 1661(r8): 61(ptr) Variable Function - 1630: 6(float) Load 86(inF1) - 1631: 6(float) Load 85(inF0) - 1632: 6(float) FMul 1630 1631 - Store 1629(r0) 1632 - 1634: 6(float) Load 85(inF0) - 1635: 24(fvec2) Load 87(inFV0) - 1636: 24(fvec2) VectorTimesScalar 1635 1634 - Store 1633(r1) 1636 - 1638: 24(fvec2) Load 87(inFV0) - 1639: 6(float) Load 85(inF0) - 1640: 24(fvec2) VectorTimesScalar 1638 1639 - Store 1637(r2) 1640 - 1642: 24(fvec2) Load 87(inFV0) - 1643: 24(fvec2) Load 88(inFV1) - 1644: 6(float) Dot 1642 1643 - Store 1641(r3) 1644 - 1646: 24(fvec2) Load 87(inFV0) - 1647: 60 Load 89(inFM0) - 1648: 24(fvec2) VectorTimesMatrix 1646 1647 - Store 1645(r4) 1648 - 1650: 60 Load 89(inFM0) - 1651: 24(fvec2) Load 87(inFV0) - 1652: 24(fvec2) MatrixTimesVector 1650 1651 - Store 1649(r5) 1652 - 1654: 6(float) Load 85(inF0) - 1655: 60 Load 89(inFM0) - 1656: 60 MatrixTimesScalar 1655 1654 - Store 1653(r6) 1656 - 1658: 60 Load 89(inFM0) - 1659: 6(float) Load 85(inF0) - 1660: 60 MatrixTimesScalar 1658 1659 - Store 1657(r7) 1660 - 1662: 60 Load 90(inFM1) - 1663: 60 Load 89(inFM0) - 1664: 60 MatrixTimesMatrix 1662 1663 - Store 1661(r8) 1664 +93(TestGenMul2(f1;f1;vf2;vf2;mf22;mf22;): 2 Function None 86 + 87(inF0): 7(ptr) FunctionParameter + 88(inF1): 7(ptr) FunctionParameter + 89(inFV0): 27(ptr) FunctionParameter + 90(inFV1): 27(ptr) FunctionParameter + 91(inFM0): 63(ptr) FunctionParameter + 92(inFM1): 63(ptr) FunctionParameter + 94: Label + 1633(r0): 7(ptr) Variable Function + 1637(r1): 27(ptr) Variable Function + 1641(r2): 27(ptr) Variable Function + 1645(r3): 7(ptr) Variable Function + 1649(r4): 27(ptr) Variable Function + 1653(r5): 27(ptr) Variable Function + 1657(r6): 63(ptr) Variable Function + 1661(r7): 63(ptr) Variable Function + 1665(r8): 63(ptr) Variable Function + 1634: 6(float) Load 88(inF1) + 1635: 6(float) Load 87(inF0) + 1636: 6(float) FMul 1634 1635 + Store 1633(r0) 1636 + 1638: 6(float) Load 87(inF0) + 1639: 26(fvec2) Load 89(inFV0) + 1640: 26(fvec2) VectorTimesScalar 1639 1638 + Store 1637(r1) 1640 + 1642: 26(fvec2) Load 89(inFV0) + 1643: 6(float) Load 87(inF0) + 1644: 26(fvec2) VectorTimesScalar 1642 1643 + Store 1641(r2) 1644 + 1646: 26(fvec2) Load 89(inFV0) + 1647: 26(fvec2) Load 90(inFV1) + 1648: 6(float) Dot 1646 1647 + Store 1645(r3) 1648 + 1650: 26(fvec2) Load 89(inFV0) + 1651: 62 Load 91(inFM0) + 1652: 26(fvec2) VectorTimesMatrix 1650 1651 + Store 1649(r4) 1652 + 1654: 62 Load 91(inFM0) + 1655: 26(fvec2) Load 89(inFV0) + 1656: 26(fvec2) MatrixTimesVector 1654 1655 + Store 1653(r5) 1656 + 1658: 6(float) Load 87(inF0) + 1659: 62 Load 91(inFM0) + 1660: 62 MatrixTimesScalar 1659 1658 + Store 1657(r6) 1660 + 1662: 62 Load 91(inFM0) + 1663: 6(float) Load 87(inF0) + 1664: 62 MatrixTimesScalar 1662 1663 + Store 1661(r7) 1664 + 1666: 62 Load 92(inFM1) + 1667: 62 Load 91(inFM0) + 1668: 62 MatrixTimesMatrix 1666 1667 + Store 1665(r8) 1668 Return FunctionEnd -100(TestGenMul3(f1;f1;vf3;vf3;mf33;mf33;): 2 Function None 93 - 94(inF0): 7(ptr) FunctionParameter - 95(inF1): 7(ptr) FunctionParameter - 96(inFV0): 37(ptr) FunctionParameter - 97(inFV1): 37(ptr) FunctionParameter - 98(inFM0): 69(ptr) FunctionParameter - 99(inFM1): 69(ptr) FunctionParameter - 101: Label - 1665(r0): 7(ptr) Variable Function - 1669(r1): 37(ptr) Variable Function - 1673(r2): 37(ptr) Variable Function - 1677(r3): 7(ptr) Variable Function - 1681(r4): 37(ptr) Variable Function - 1685(r5): 37(ptr) Variable Function - 1689(r6): 69(ptr) Variable Function - 1693(r7): 69(ptr) Variable Function - 1697(r8): 69(ptr) Variable Function - 1666: 6(float) Load 95(inF1) - 1667: 6(float) Load 94(inF0) - 1668: 6(float) FMul 1666 1667 - Store 1665(r0) 1668 - 1670: 6(float) Load 94(inF0) - 1671: 36(fvec3) Load 96(inFV0) - 1672: 36(fvec3) VectorTimesScalar 1671 1670 - Store 1669(r1) 1672 - 1674: 36(fvec3) Load 96(inFV0) - 1675: 6(float) Load 94(inF0) - 1676: 36(fvec3) VectorTimesScalar 1674 1675 - Store 1673(r2) 1676 - 1678: 36(fvec3) Load 96(inFV0) - 1679: 36(fvec3) Load 97(inFV1) - 1680: 6(float) Dot 1678 1679 - Store 1677(r3) 1680 - 1682: 36(fvec3) Load 96(inFV0) - 1683: 68 Load 98(inFM0) - 1684: 36(fvec3) VectorTimesMatrix 1682 1683 - Store 1681(r4) 1684 - 1686: 68 Load 98(inFM0) - 1687: 36(fvec3) Load 96(inFV0) - 1688: 36(fvec3) MatrixTimesVector 1686 1687 - Store 1685(r5) 1688 - 1690: 6(float) Load 94(inF0) - 1691: 68 Load 98(inFM0) - 1692: 68 MatrixTimesScalar 1691 1690 - Store 1689(r6) 1692 - 1694: 68 Load 98(inFM0) - 1695: 6(float) Load 94(inF0) - 1696: 68 MatrixTimesScalar 1694 1695 - Store 1693(r7) 1696 - 1698: 68 Load 99(inFM1) - 1699: 68 Load 98(inFM0) - 1700: 68 MatrixTimesMatrix 1698 1699 - Store 1697(r8) 1700 +102(TestGenMul3(f1;f1;vf3;vf3;mf33;mf33;): 2 Function None 95 + 96(inF0): 7(ptr) FunctionParameter + 97(inF1): 7(ptr) FunctionParameter + 98(inFV0): 39(ptr) FunctionParameter + 99(inFV1): 39(ptr) FunctionParameter + 100(inFM0): 71(ptr) FunctionParameter + 101(inFM1): 71(ptr) FunctionParameter + 103: Label + 1669(r0): 7(ptr) Variable Function + 1673(r1): 39(ptr) Variable Function + 1677(r2): 39(ptr) Variable Function + 1681(r3): 7(ptr) Variable Function + 1685(r4): 39(ptr) Variable Function + 1689(r5): 39(ptr) Variable Function + 1693(r6): 71(ptr) Variable Function + 1697(r7): 71(ptr) Variable Function + 1701(r8): 71(ptr) Variable Function + 1670: 6(float) Load 97(inF1) + 1671: 6(float) Load 96(inF0) + 1672: 6(float) FMul 1670 1671 + Store 1669(r0) 1672 + 1674: 6(float) Load 96(inF0) + 1675: 38(fvec3) Load 98(inFV0) + 1676: 38(fvec3) VectorTimesScalar 1675 1674 + Store 1673(r1) 1676 + 1678: 38(fvec3) Load 98(inFV0) + 1679: 6(float) Load 96(inF0) + 1680: 38(fvec3) VectorTimesScalar 1678 1679 + Store 1677(r2) 1680 + 1682: 38(fvec3) Load 98(inFV0) + 1683: 38(fvec3) Load 99(inFV1) + 1684: 6(float) Dot 1682 1683 + Store 1681(r3) 1684 + 1686: 38(fvec3) Load 98(inFV0) + 1687: 70 Load 100(inFM0) + 1688: 38(fvec3) VectorTimesMatrix 1686 1687 + Store 1685(r4) 1688 + 1690: 70 Load 100(inFM0) + 1691: 38(fvec3) Load 98(inFV0) + 1692: 38(fvec3) MatrixTimesVector 1690 1691 + Store 1689(r5) 1692 + 1694: 6(float) Load 96(inF0) + 1695: 70 Load 100(inFM0) + 1696: 70 MatrixTimesScalar 1695 1694 + Store 1693(r6) 1696 + 1698: 70 Load 100(inFM0) + 1699: 6(float) Load 96(inF0) + 1700: 70 MatrixTimesScalar 1698 1699 + Store 1697(r7) 1700 + 1702: 70 Load 101(inFM1) + 1703: 70 Load 100(inFM0) + 1704: 70 MatrixTimesMatrix 1702 1703 + Store 1701(r8) 1704 Return FunctionEnd -109(TestGenMul4(f1;f1;vf4;vf4;mf44;mf44;): 2 Function None 102 - 103(inF0): 7(ptr) FunctionParameter - 104(inF1): 7(ptr) FunctionParameter - 105(inFV0): 49(ptr) FunctionParameter - 106(inFV1): 49(ptr) FunctionParameter - 107(inFM0): 77(ptr) FunctionParameter - 108(inFM1): 77(ptr) FunctionParameter - 110: Label - 1701(r0): 7(ptr) Variable Function - 1705(r1): 49(ptr) Variable Function - 1709(r2): 49(ptr) Variable Function - 1713(r3): 7(ptr) Variable Function - 1717(r4): 49(ptr) Variable Function - 1721(r5): 49(ptr) Variable Function - 1725(r6): 77(ptr) Variable Function - 1729(r7): 77(ptr) Variable Function - 1733(r8): 77(ptr) Variable Function - 1702: 6(float) Load 104(inF1) - 1703: 6(float) Load 103(inF0) - 1704: 6(float) FMul 1702 1703 - Store 1701(r0) 1704 - 1706: 6(float) Load 103(inF0) - 1707: 48(fvec4) Load 105(inFV0) - 1708: 48(fvec4) VectorTimesScalar 1707 1706 - Store 1705(r1) 1708 - 1710: 48(fvec4) Load 105(inFV0) - 1711: 6(float) Load 103(inF0) - 1712: 48(fvec4) VectorTimesScalar 1710 1711 - Store 1709(r2) 1712 - 1714: 48(fvec4) Load 105(inFV0) - 1715: 48(fvec4) Load 106(inFV1) - 1716: 6(float) Dot 1714 1715 - Store 1713(r3) 1716 - 1718: 48(fvec4) Load 105(inFV0) - 1719: 76 Load 107(inFM0) - 1720: 48(fvec4) VectorTimesMatrix 1718 1719 - Store 1717(r4) 1720 - 1722: 76 Load 107(inFM0) - 1723: 48(fvec4) Load 105(inFV0) - 1724: 48(fvec4) MatrixTimesVector 1722 1723 - Store 1721(r5) 1724 - 1726: 6(float) Load 103(inF0) - 1727: 76 Load 107(inFM0) - 1728: 76 MatrixTimesScalar 1727 1726 - Store 1725(r6) 1728 - 1730: 76 Load 107(inFM0) - 1731: 6(float) Load 103(inF0) - 1732: 76 MatrixTimesScalar 1730 1731 - Store 1729(r7) 1732 - 1734: 76 Load 108(inFM1) - 1735: 76 Load 107(inFM0) - 1736: 76 MatrixTimesMatrix 1734 1735 - Store 1733(r8) 1736 +111(TestGenMul4(f1;f1;vf4;vf4;mf44;mf44;): 2 Function None 104 + 105(inF0): 7(ptr) FunctionParameter + 106(inF1): 7(ptr) FunctionParameter + 107(inFV0): 51(ptr) FunctionParameter + 108(inFV1): 51(ptr) FunctionParameter + 109(inFM0): 79(ptr) FunctionParameter + 110(inFM1): 79(ptr) FunctionParameter + 112: Label + 1705(r0): 7(ptr) Variable Function + 1709(r1): 51(ptr) Variable Function + 1713(r2): 51(ptr) Variable Function + 1717(r3): 7(ptr) Variable Function + 1721(r4): 51(ptr) Variable Function + 1725(r5): 51(ptr) Variable Function + 1729(r6): 79(ptr) Variable Function + 1733(r7): 79(ptr) Variable Function + 1737(r8): 79(ptr) Variable Function + 1706: 6(float) Load 106(inF1) + 1707: 6(float) Load 105(inF0) + 1708: 6(float) FMul 1706 1707 + Store 1705(r0) 1708 + 1710: 6(float) Load 105(inF0) + 1711: 50(fvec4) Load 107(inFV0) + 1712: 50(fvec4) VectorTimesScalar 1711 1710 + Store 1709(r1) 1712 + 1714: 50(fvec4) Load 107(inFV0) + 1715: 6(float) Load 105(inF0) + 1716: 50(fvec4) VectorTimesScalar 1714 1715 + Store 1713(r2) 1716 + 1718: 50(fvec4) Load 107(inFV0) + 1719: 50(fvec4) Load 108(inFV1) + 1720: 6(float) Dot 1718 1719 + Store 1717(r3) 1720 + 1722: 50(fvec4) Load 107(inFV0) + 1723: 78 Load 109(inFM0) + 1724: 50(fvec4) VectorTimesMatrix 1722 1723 + Store 1721(r4) 1724 + 1726: 78 Load 109(inFM0) + 1727: 50(fvec4) Load 107(inFV0) + 1728: 50(fvec4) MatrixTimesVector 1726 1727 + Store 1725(r5) 1728 + 1730: 6(float) Load 105(inF0) + 1731: 78 Load 109(inFM0) + 1732: 78 MatrixTimesScalar 1731 1730 + Store 1729(r6) 1732 + 1734: 78 Load 109(inFM0) + 1735: 6(float) Load 105(inF0) + 1736: 78 MatrixTimesScalar 1734 1735 + Store 1733(r7) 1736 + 1738: 78 Load 110(inFM1) + 1739: 78 Load 109(inFM0) + 1740: 78 MatrixTimesMatrix 1738 1739 + Store 1737(r8) 1740 Return FunctionEnd -129(TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24;): 2 Function None 119 - 120(inF0): 7(ptr) FunctionParameter - 121(inF1): 7(ptr) FunctionParameter - 122(inFV2): 25(ptr) FunctionParameter - 123(inFV3): 37(ptr) FunctionParameter - 124(inFM2x3): 112(ptr) FunctionParameter - 125(inFM3x2): 114(ptr) FunctionParameter - 126(inFM3x3): 69(ptr) FunctionParameter - 127(inFM3x4): 116(ptr) FunctionParameter - 128(inFM2x4): 118(ptr) FunctionParameter - 130: Label - 1737(r00): 7(ptr) Variable Function - 1741(r01): 25(ptr) Variable Function - 1745(r02): 37(ptr) Variable Function - 1749(r03): 25(ptr) Variable Function - 1753(r04): 37(ptr) Variable Function - 1757(r05): 7(ptr) Variable Function - 1761(r06): 7(ptr) Variable Function - 1765(r07): 37(ptr) Variable Function - 1769(r08): 25(ptr) Variable Function - 1773(r09): 25(ptr) Variable Function - 1777(r10): 37(ptr) Variable Function - 1781(r11): 112(ptr) Variable Function - 1785(r12): 114(ptr) Variable Function - 1789(r13): 61(ptr) Variable Function - 1793(r14): 112(ptr) Variable Function - 1797(r15): 118(ptr) Variable Function - 1801(r16): 116(ptr) Variable Function - 1738: 6(float) Load 121(inF1) - 1739: 6(float) Load 120(inF0) - 1740: 6(float) FMul 1738 1739 - Store 1737(r00) 1740 - 1742: 6(float) Load 120(inF0) - 1743: 24(fvec2) Load 122(inFV2) - 1744: 24(fvec2) VectorTimesScalar 1743 1742 - Store 1741(r01) 1744 - 1746: 6(float) Load 120(inF0) - 1747: 36(fvec3) Load 123(inFV3) - 1748: 36(fvec3) VectorTimesScalar 1747 1746 - Store 1745(r02) 1748 - 1750: 24(fvec2) Load 122(inFV2) - 1751: 6(float) Load 120(inF0) - 1752: 24(fvec2) VectorTimesScalar 1750 1751 - Store 1749(r03) 1752 - 1754: 36(fvec3) Load 123(inFV3) - 1755: 6(float) Load 120(inF0) - 1756: 36(fvec3) VectorTimesScalar 1754 1755 - Store 1753(r04) 1756 - 1758: 24(fvec2) Load 122(inFV2) - 1759: 24(fvec2) Load 122(inFV2) - 1760: 6(float) Dot 1758 1759 - Store 1757(r05) 1760 - 1762: 36(fvec3) Load 123(inFV3) - 1763: 36(fvec3) Load 123(inFV3) +131(TestGenMulNxM(f1;f1;vf2;vf3;mf23;mf32;mf33;mf34;mf24;): 2 Function None 121 + 122(inF0): 7(ptr) FunctionParameter + 123(inF1): 7(ptr) FunctionParameter + 124(inFV2): 27(ptr) FunctionParameter + 125(inFV3): 39(ptr) FunctionParameter + 126(inFM2x3): 114(ptr) FunctionParameter + 127(inFM3x2): 116(ptr) FunctionParameter + 128(inFM3x3): 71(ptr) FunctionParameter + 129(inFM3x4): 118(ptr) FunctionParameter + 130(inFM2x4): 120(ptr) FunctionParameter + 132: Label + 1741(r00): 7(ptr) Variable Function + 1745(r01): 27(ptr) Variable Function + 1749(r02): 39(ptr) Variable Function + 1753(r03): 27(ptr) Variable Function + 1757(r04): 39(ptr) Variable Function + 1761(r05): 7(ptr) Variable Function + 1765(r06): 7(ptr) Variable Function + 1769(r07): 39(ptr) Variable Function + 1773(r08): 27(ptr) Variable Function + 1777(r09): 27(ptr) Variable Function + 1781(r10): 39(ptr) Variable Function + 1785(r11): 114(ptr) Variable Function + 1789(r12): 116(ptr) Variable Function + 1793(r13): 63(ptr) Variable Function + 1797(r14): 114(ptr) Variable Function + 1801(r15): 120(ptr) Variable Function + 1805(r16): 118(ptr) Variable Function + 1742: 6(float) Load 123(inF1) + 1743: 6(float) Load 122(inF0) + 1744: 6(float) FMul 1742 1743 + Store 1741(r00) 1744 + 1746: 6(float) Load 122(inF0) + 1747: 26(fvec2) Load 124(inFV2) + 1748: 26(fvec2) VectorTimesScalar 1747 1746 + Store 1745(r01) 1748 + 1750: 6(float) Load 122(inF0) + 1751: 38(fvec3) Load 125(inFV3) + 1752: 38(fvec3) VectorTimesScalar 1751 1750 + Store 1749(r02) 1752 + 1754: 26(fvec2) Load 124(inFV2) + 1755: 6(float) Load 122(inF0) + 1756: 26(fvec2) VectorTimesScalar 1754 1755 + Store 1753(r03) 1756 + 1758: 38(fvec3) Load 125(inFV3) + 1759: 6(float) Load 122(inF0) + 1760: 38(fvec3) VectorTimesScalar 1758 1759 + Store 1757(r04) 1760 + 1762: 26(fvec2) Load 124(inFV2) + 1763: 26(fvec2) Load 124(inFV2) 1764: 6(float) Dot 1762 1763 - Store 1761(r06) 1764 - 1766: 111 Load 124(inFM2x3) - 1767: 24(fvec2) Load 122(inFV2) - 1768: 36(fvec3) MatrixTimesVector 1766 1767 - Store 1765(r07) 1768 - 1770: 113 Load 125(inFM3x2) - 1771: 36(fvec3) Load 123(inFV3) - 1772: 24(fvec2) MatrixTimesVector 1770 1771 - Store 1769(r08) 1772 - 1774: 36(fvec3) Load 123(inFV3) - 1775: 111 Load 124(inFM2x3) - 1776: 24(fvec2) VectorTimesMatrix 1774 1775 - Store 1773(r09) 1776 - 1778: 24(fvec2) Load 122(inFV2) - 1779: 113 Load 125(inFM3x2) - 1780: 36(fvec3) VectorTimesMatrix 1778 1779 - Store 1777(r10) 1780 - 1782: 6(float) Load 120(inF0) - 1783: 111 Load 124(inFM2x3) - 1784: 111 MatrixTimesScalar 1783 1782 - Store 1781(r11) 1784 - 1786: 6(float) Load 120(inF0) - 1787: 113 Load 125(inFM3x2) + Store 1761(r05) 1764 + 1766: 38(fvec3) Load 125(inFV3) + 1767: 38(fvec3) Load 125(inFV3) + 1768: 6(float) Dot 1766 1767 + Store 1765(r06) 1768 + 1770: 113 Load 126(inFM2x3) + 1771: 26(fvec2) Load 124(inFV2) + 1772: 38(fvec3) MatrixTimesVector 1770 1771 + Store 1769(r07) 1772 + 1774: 115 Load 127(inFM3x2) + 1775: 38(fvec3) Load 125(inFV3) + 1776: 26(fvec2) MatrixTimesVector 1774 1775 + Store 1773(r08) 1776 + 1778: 38(fvec3) Load 125(inFV3) + 1779: 113 Load 126(inFM2x3) + 1780: 26(fvec2) VectorTimesMatrix 1778 1779 + Store 1777(r09) 1780 + 1782: 26(fvec2) Load 124(inFV2) + 1783: 115 Load 127(inFM3x2) + 1784: 38(fvec3) VectorTimesMatrix 1782 1783 + Store 1781(r10) 1784 + 1786: 6(float) Load 122(inF0) + 1787: 113 Load 126(inFM2x3) 1788: 113 MatrixTimesScalar 1787 1786 - Store 1785(r12) 1788 - 1790: 113 Load 125(inFM3x2) - 1791: 111 Load 124(inFM2x3) - 1792: 60 MatrixTimesMatrix 1790 1791 - Store 1789(r13) 1792 - 1794: 68 Load 126(inFM3x3) - 1795: 111 Load 124(inFM2x3) - 1796: 111 MatrixTimesMatrix 1794 1795 - Store 1793(r14) 1796 - 1798: 115 Load 127(inFM3x4) - 1799: 111 Load 124(inFM2x3) - 1800: 117 MatrixTimesMatrix 1798 1799 - Store 1797(r15) 1800 - 1802: 117 Load 128(inFM2x4) - 1803: 113 Load 125(inFM3x2) - 1804: 115 MatrixTimesMatrix 1802 1803 - Store 1801(r16) 1804 + Store 1785(r11) 1788 + 1790: 6(float) Load 122(inF0) + 1791: 115 Load 127(inFM3x2) + 1792: 115 MatrixTimesScalar 1791 1790 + Store 1789(r12) 1792 + 1794: 115 Load 127(inFM3x2) + 1795: 113 Load 126(inFM2x3) + 1796: 62 MatrixTimesMatrix 1794 1795 + Store 1793(r13) 1796 + 1798: 70 Load 128(inFM3x3) + 1799: 113 Load 126(inFM2x3) + 1800: 113 MatrixTimesMatrix 1798 1799 + Store 1797(r14) 1800 + 1802: 117 Load 129(inFM3x4) + 1803: 113 Load 126(inFM2x3) + 1804: 119 MatrixTimesMatrix 1802 1803 + Store 1801(r15) 1804 + 1806: 119 Load 130(inFM2x4) + 1807: 115 Load 127(inFM3x2) + 1808: 117 MatrixTimesMatrix 1806 1807 + Store 1805(r16) 1808 Return FunctionEnd - 133(@main():131(PS_OUTPUT) Function None 132 - 134: Label - 1806(ps_output): 1805(ptr) Variable Function - 1808: 49(ptr) AccessChain 1806(ps_output) 187 - Store 1808 1807 - 1809:131(PS_OUTPUT) Load 1806(ps_output) - ReturnValue 1809 + 135(@main():133(PS_OUTPUT) Function None 134 + 136: Label + 1810(ps_output): 1809(ptr) Variable Function + 1812: 51(ptr) AccessChain 1810(ps_output) 187 + Store 1812 1811 + 1813:133(PS_OUTPUT) Load 1810(ps_output) + ReturnValue 1813 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out index a280db13da8..8b1454b872d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.lit.frag.out @@ -18,7 +18,7 @@ gl_FragCoord origin is upper left 0:3 'n_dot_l' ( in float) 0:3 Constant: 0:3 0.000000 -0:3 Test condition and select ( temp float) +0:3 Test condition and select ( temp float): no shortcircuit 0:3 Condition 0:3 Compare Less Than ( temp bool) 0:3 min ( temp float) @@ -79,7 +79,7 @@ gl_FragCoord origin is upper left 0:3 'n_dot_l' ( in float) 0:3 Constant: 0:3 0.000000 -0:3 Test condition and select ( temp float) +0:3 Test condition and select ( temp float): no shortcircuit 0:3 Condition 0:3 Compare Less Than ( temp bool) 0:3 min ( temp float) @@ -118,13 +118,13 @@ gl_FragCoord origin is upper left 0:? 'm' (layout( location=2) in float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 52 +// Generated by (magic number): 80007 +// Id's are bound by 48 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "PixelShaderFunction" 37 40 43 + EntryPoint Fragment 4 "PixelShaderFunction" 33 36 39 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "PixelShaderFunction" @@ -133,18 +133,18 @@ gl_FragCoord origin is upper left Name 10 "n_dot_h" Name 11 "m" Name 16 "r0" - Name 35 "n_dot_l" - Name 37 "n_dot_l" - Name 39 "n_dot_h" - Name 40 "n_dot_h" - Name 42 "m" - Name 43 "m" + Name 31 "n_dot_l" + Name 33 "n_dot_l" + Name 35 "n_dot_h" + Name 36 "n_dot_h" + Name 38 "m" + Name 39 "m" + Name 41 "param" + Name 43 "param" Name 45 "param" - Name 47 "param" - Name 49 "param" - Decorate 37(n_dot_l) Location 0 - Decorate 40(n_dot_h) Location 1 - Decorate 43(m) Location 2 + Decorate 33(n_dot_l) Location 0 + Decorate 36(n_dot_h) Location 1 + Decorate 39(m) Location 2 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -154,32 +154,32 @@ gl_FragCoord origin is upper left 15: TypePointer Function 14(fvec4) 17: 6(float) Constant 1065353216 19: 6(float) Constant 0 - 25: TypeBool - 36: TypePointer Input 6(float) - 37(n_dot_l): 36(ptr) Variable Input - 40(n_dot_h): 36(ptr) Variable Input - 43(m): 36(ptr) Variable Input + 24: TypeBool + 32: TypePointer Input 6(float) + 33(n_dot_l): 32(ptr) Variable Input + 36(n_dot_h): 32(ptr) Variable Input + 39(m): 32(ptr) Variable Input 4(PixelShaderFunction): 2 Function None 3 5: Label - 35(n_dot_l): 7(ptr) Variable Function - 39(n_dot_h): 7(ptr) Variable Function - 42(m): 7(ptr) Variable Function + 31(n_dot_l): 7(ptr) Variable Function + 35(n_dot_h): 7(ptr) Variable Function + 38(m): 7(ptr) Variable Function + 41(param): 7(ptr) Variable Function + 43(param): 7(ptr) Variable Function 45(param): 7(ptr) Variable Function - 47(param): 7(ptr) Variable Function - 49(param): 7(ptr) Variable Function - 38: 6(float) Load 37(n_dot_l) - Store 35(n_dot_l) 38 - 41: 6(float) Load 40(n_dot_h) - Store 39(n_dot_h) 41 - 44: 6(float) Load 43(m) - Store 42(m) 44 - 46: 6(float) Load 35(n_dot_l) + 34: 6(float) Load 33(n_dot_l) + Store 31(n_dot_l) 34 + 37: 6(float) Load 36(n_dot_h) + Store 35(n_dot_h) 37 + 40: 6(float) Load 39(m) + Store 38(m) 40 + 42: 6(float) Load 31(n_dot_l) + Store 41(param) 42 + 44: 6(float) Load 35(n_dot_h) + Store 43(param) 44 + 46: 6(float) Load 38(m) Store 45(param) 46 - 48: 6(float) Load 39(n_dot_h) - Store 47(param) 48 - 50: 6(float) Load 42(m) - Store 49(param) 50 - 51: 2 FunctionCall 12(@PixelShaderFunction(f1;f1;f1;) 45(param) 47(param) 49(param) + 47: 2 FunctionCall 12(@PixelShaderFunction(f1;f1;f1;) 41(param) 43(param) 45(param) Return FunctionEnd 12(@PixelShaderFunction(f1;f1;f1;): 2 Function None 8 @@ -188,27 +188,17 @@ gl_FragCoord origin is upper left 11(m): 7(ptr) FunctionParameter 13: Label 16(r0): 15(ptr) Variable Function - 21: 7(ptr) Variable Function 18: 6(float) Load 9(n_dot_l) 20: 6(float) ExtInst 1(GLSL.std.450) 40(FMax) 18 19 - 22: 6(float) Load 9(n_dot_l) - 23: 6(float) Load 10(n_dot_h) - 24: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 22 23 - 26: 25(bool) FOrdLessThan 24 19 - SelectionMerge 28 None - BranchConditional 26 27 29 - 27: Label - Store 21 19 - Branch 28 - 29: Label - 30: 6(float) Load 10(n_dot_h) - 31: 6(float) Load 11(m) - 32: 6(float) FMul 30 31 - Store 21 32 - Branch 28 - 28: Label - 33: 6(float) Load 21 - 34: 14(fvec4) CompositeConstruct 17 20 33 17 - Store 16(r0) 34 + 21: 6(float) Load 9(n_dot_l) + 22: 6(float) Load 10(n_dot_h) + 23: 6(float) ExtInst 1(GLSL.std.450) 37(FMin) 21 22 + 25: 24(bool) FOrdLessThan 23 19 + 26: 6(float) Load 10(n_dot_h) + 27: 6(float) Load 11(m) + 28: 6(float) FMul 26 27 + 29: 6(float) Select 25 19 28 + 30: 14(fvec4) CompositeConstruct 17 20 29 17 + Store 16(r0) 30 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out index ce8947df0f1..97d67198ea0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.comp.out @@ -180,7 +180,7 @@ local_size = (1, 1, 1) 0:? 'inI0' (layout( location=3) in 4-component vector of int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 99 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out index 31e3ec46c9b..c2711c657e7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.vert.out @@ -308,7 +308,7 @@ Shader version: 500 0:? 'inI0' (layout( location=3) in 4-component vector of int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 155 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out index 8df57aa0c10..a561dfe9a06 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.down.frag.out @@ -104,7 +104,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out index 6df1915b7bb..b064295a4e9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.frag.out @@ -888,7 +888,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 322 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out index 703d9f6d18a..57dfafc47fb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.promote.outputs.frag.out @@ -204,7 +204,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 80 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.vert.out index e92a8a72e9e..195e11d6e32 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.intrinsics.vert.out @@ -2778,8 +2778,12 @@ Shader version: 500 0:413 'inFM3x2' ( in 3X2 matrix of float) 0:? Linker Objects +error: SPIRV-Tools Validation Errors +error: Matrix types can only be parameterized with floating-point types. + %mat2v2bool = OpTypeMatrix %v2bool 2 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 1225 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out index 9968e6b64ea..6fee951299f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out @@ -172,7 +172,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 85 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out index de614d2815b..010c2ecd408 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out @@ -6,23 +6,33 @@ gl_FragCoord origin is upper left 0:16 Function Parameters: 0:16 'input' ( in 4-component vector of float) 0:? Sequence -0:17 Branch: Return with expression -0:17 add ( temp 4-component vector of float) -0:17 add ( temp 4-component vector of float) -0:17 add ( temp 4-component vector of float) -0:17 'input' ( in 4-component vector of float) -0:17 v1: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) -0:17 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1}) -0:17 Constant: -0:17 0 (const uint) -0:17 v5: direct index for structure (layout( row_major std430 offset=0) buffer 4-component vector of float) -0:17 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5}) -0:17 Constant: -0:17 0 (const uint) -0:17 v1PostLayout: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) -0:17 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout}) -0:17 Constant: -0:17 0 (const uint) +0:17 Sequence +0:17 move second child to first child ( temp 4-component vector of float) +0:17 'layout' ( temp 4-component vector of float) +0:17 Constant: +0:17 2.000000 +0:17 2.000000 +0:17 2.000000 +0:17 2.000000 +0:18 Branch: Return with expression +0:18 add ( temp 4-component vector of float) +0:18 add ( temp 4-component vector of float) +0:18 add ( temp 4-component vector of float) +0:18 'input' ( in 4-component vector of float) +0:18 v1: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) +0:18 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1}) +0:18 Constant: +0:18 0 (const uint) +0:18 v5: direct index for structure (layout( row_major std430 offset=0) buffer 4-component vector of float) +0:18 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5}) +0:18 Constant: +0:18 0 (const uint) +0:18 component-wise multiply ( temp 4-component vector of float) +0:18 v1PostLayout: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) +0:18 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout}) +0:18 Constant: +0:18 0 (const uint) +0:18 'layout' ( temp 4-component vector of float) 0:? Linker Objects 0:? 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1}) 0:? 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5}) @@ -42,23 +52,33 @@ gl_FragCoord origin is upper left 0:16 Function Parameters: 0:16 'input' ( in 4-component vector of float) 0:? Sequence -0:17 Branch: Return with expression -0:17 add ( temp 4-component vector of float) -0:17 add ( temp 4-component vector of float) -0:17 add ( temp 4-component vector of float) -0:17 'input' ( in 4-component vector of float) -0:17 v1: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) -0:17 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1}) -0:17 Constant: -0:17 0 (const uint) -0:17 v5: direct index for structure (layout( row_major std430 offset=0) buffer 4-component vector of float) -0:17 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5}) -0:17 Constant: -0:17 0 (const uint) -0:17 v1PostLayout: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) -0:17 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout}) -0:17 Constant: -0:17 0 (const uint) +0:17 Sequence +0:17 move second child to first child ( temp 4-component vector of float) +0:17 'layout' ( temp 4-component vector of float) +0:17 Constant: +0:17 2.000000 +0:17 2.000000 +0:17 2.000000 +0:17 2.000000 +0:18 Branch: Return with expression +0:18 add ( temp 4-component vector of float) +0:18 add ( temp 4-component vector of float) +0:18 add ( temp 4-component vector of float) +0:18 'input' ( in 4-component vector of float) +0:18 v1: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) +0:18 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1}) +0:18 Constant: +0:18 0 (const uint) +0:18 v5: direct index for structure (layout( row_major std430 offset=0) buffer 4-component vector of float) +0:18 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5}) +0:18 Constant: +0:18 0 (const uint) +0:18 component-wise multiply ( temp 4-component vector of float) +0:18 v1PostLayout: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float) +0:18 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout}) +0:18 Constant: +0:18 0 (const uint) +0:18 'layout' ( temp 4-component vector of float) 0:? Linker Objects 0:? 'anon@0' (layout( set=3 binding=5 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1}) 0:? 'anon@1' (layout( row_major std430 push_constant) readonly buffer block{layout( row_major std430 offset=0) buffer 4-component vector of float v5}) @@ -67,8 +87,8 @@ gl_FragCoord origin is upper left 0:? 'anon@2' (layout( set=4 binding=7 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v1PostLayout}) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 39 +// Generated by (magic number): 80007 +// Id's are bound by 44 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -79,50 +99,53 @@ gl_FragCoord origin is upper left Name 4 "main" Name 11 "PixelShaderFunction(vf4;" Name 10 "input" - Name 14 "tbufName" - MemberName 14(tbufName) 0 "v1" - Name 16 "" - Name 23 "tbufName2" - MemberName 23(tbufName2) 0 "v5" - Name 25 "" - Name 30 "tbufName2" - MemberName 30(tbufName2) 0 "v1PostLayout" - Name 32 "" - Name 38 "specConst" - MemberDecorate 14(tbufName) 0 NonWritable - MemberDecorate 14(tbufName) 0 Offset 16 - Decorate 14(tbufName) BufferBlock - Decorate 16 DescriptorSet 3 - Decorate 16 Binding 5 - MemberDecorate 23(tbufName2) 0 NonWritable - MemberDecorate 23(tbufName2) 0 Offset 0 - Decorate 23(tbufName2) BufferBlock - MemberDecorate 30(tbufName2) 0 NonWritable - MemberDecorate 30(tbufName2) 0 Offset 16 - Decorate 30(tbufName2) BufferBlock - Decorate 32 DescriptorSet 4 - Decorate 32 Binding 7 - Decorate 38(specConst) SpecId 17 + Name 13 "layout" + Name 17 "tbufName" + MemberName 17(tbufName) 0 "v1" + Name 19 "" + Name 26 "tbufName2" + MemberName 26(tbufName2) 0 "v5" + Name 28 "" + Name 33 "tbufName2" + MemberName 33(tbufName2) 0 "v1PostLayout" + Name 35 "" + Name 43 "specConst" + MemberDecorate 17(tbufName) 0 NonWritable + MemberDecorate 17(tbufName) 0 Offset 16 + Decorate 17(tbufName) BufferBlock + Decorate 19 DescriptorSet 3 + Decorate 19 Binding 5 + MemberDecorate 26(tbufName2) 0 NonWritable + MemberDecorate 26(tbufName2) 0 Offset 0 + Decorate 26(tbufName2) BufferBlock + MemberDecorate 33(tbufName2) 0 NonWritable + MemberDecorate 33(tbufName2) 0 Offset 16 + Decorate 33(tbufName2) BufferBlock + Decorate 35 DescriptorSet 4 + Decorate 35 Binding 7 + Decorate 43(specConst) SpecId 17 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypePointer Function 7(fvec4) 9: TypeFunction 7(fvec4) 8(ptr) - 14(tbufName): TypeStruct 7(fvec4) - 15: TypePointer Uniform 14(tbufName) - 16: 15(ptr) Variable Uniform - 17: TypeInt 32 1 - 18: 17(int) Constant 0 - 19: TypePointer Uniform 7(fvec4) - 23(tbufName2): TypeStruct 7(fvec4) - 24: TypePointer PushConstant 23(tbufName2) - 25: 24(ptr) Variable PushConstant - 26: TypePointer PushConstant 7(fvec4) - 30(tbufName2): TypeStruct 7(fvec4) - 31: TypePointer Uniform 30(tbufName2) - 32: 31(ptr) Variable Uniform - 38(specConst): 17(int) SpecConstant 10 + 14: 6(float) Constant 1073741824 + 15: 7(fvec4) ConstantComposite 14 14 14 14 + 17(tbufName): TypeStruct 7(fvec4) + 18: TypePointer Uniform 17(tbufName) + 19: 18(ptr) Variable Uniform + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypePointer Uniform 7(fvec4) + 26(tbufName2): TypeStruct 7(fvec4) + 27: TypePointer PushConstant 26(tbufName2) + 28: 27(ptr) Variable PushConstant + 29: TypePointer PushConstant 7(fvec4) + 33(tbufName2): TypeStruct 7(fvec4) + 34: TypePointer Uniform 33(tbufName2) + 35: 34(ptr) Variable Uniform + 43(specConst): 20(int) SpecConstant 10 4(main): 2 Function None 3 5: Label Return @@ -130,15 +153,19 @@ gl_FragCoord origin is upper left 11(PixelShaderFunction(vf4;): 7(fvec4) Function None 9 10(input): 8(ptr) FunctionParameter 12: Label - 13: 7(fvec4) Load 10(input) - 20: 19(ptr) AccessChain 16 18 - 21: 7(fvec4) Load 20 - 22: 7(fvec4) FAdd 13 21 - 27: 26(ptr) AccessChain 25 18 - 28: 7(fvec4) Load 27 - 29: 7(fvec4) FAdd 22 28 - 33: 19(ptr) AccessChain 32 18 - 34: 7(fvec4) Load 33 - 35: 7(fvec4) FAdd 29 34 - ReturnValue 35 + 13(layout): 8(ptr) Variable Function + Store 13(layout) 15 + 16: 7(fvec4) Load 10(input) + 23: 22(ptr) AccessChain 19 21 + 24: 7(fvec4) Load 23 + 25: 7(fvec4) FAdd 16 24 + 30: 29(ptr) AccessChain 28 21 + 31: 7(fvec4) Load 30 + 32: 7(fvec4) FAdd 25 31 + 36: 22(ptr) AccessChain 35 21 + 37: 7(fvec4) Load 36 + 38: 7(fvec4) Load 13(layout) + 39: 7(fvec4) FMul 37 38 + 40: 7(fvec4) FAdd 32 39 + ReturnValue 40 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layoutOverride.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layoutOverride.vert.out new file mode 100644 index 00000000000..0db201120ae --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.layoutOverride.vert.out @@ -0,0 +1,104 @@ +hlsl.layoutOverride.vert +Shader version: 500 +0:? Sequence +0:5 Function Definition: @main( ( temp 4-component vector of float) +0:5 Function Parameters: +0:? Sequence +0:6 Branch: Return with expression +0:6 texture ( temp 4-component vector of float) +0:6 Construct combined texture-sampler ( temp sampler2D) +0:6 'tex' (layout( set=2 binding=0) uniform texture2D) +0:6 'samp' ( uniform sampler) +0:? Constant: +0:? 0.200000 +0:? 0.300000 +0:5 Function Definition: main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' ( out 4-component vector of float Position) +0:5 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'tex' (layout( set=2 binding=0) uniform texture2D) +0:? 'samp' ( uniform sampler) +0:? '@entryPointOutput' ( out 4-component vector of float Position) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:5 Function Definition: @main( ( temp 4-component vector of float) +0:5 Function Parameters: +0:? Sequence +0:6 Branch: Return with expression +0:6 texture ( temp 4-component vector of float) +0:6 Construct combined texture-sampler ( temp sampler2D) +0:6 'tex' (layout( set=2 binding=0) uniform texture2D) +0:6 'samp' ( uniform sampler) +0:? Constant: +0:? 0.200000 +0:? 0.300000 +0:5 Function Definition: main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' ( out 4-component vector of float Position) +0:5 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'tex' (layout( set=2 binding=0) uniform texture2D) +0:? 'samp' ( uniform sampler) +0:? '@entryPointOutput' ( out 4-component vector of float Position) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 32 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 30 + Source HLSL 500 + Name 4 "main" + Name 9 "@main(" + Name 13 "tex" + Name 17 "samp" + Name 30 "@entryPointOutput" + Decorate 13(tex) DescriptorSet 2 + Decorate 13(tex) Binding 0 + Decorate 17(samp) DescriptorSet 0 + Decorate 30(@entryPointOutput) BuiltIn Position + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypeImage 6(float) 2D sampled format:Unknown + 12: TypePointer UniformConstant 11 + 13(tex): 12(ptr) Variable UniformConstant + 15: TypeSampler + 16: TypePointer UniformConstant 15 + 17(samp): 16(ptr) Variable UniformConstant + 19: TypeSampledImage 11 + 21: TypeVector 6(float) 2 + 22: 6(float) Constant 1045220557 + 23: 6(float) Constant 1050253722 + 24: 21(fvec2) ConstantComposite 22 23 + 25: 6(float) Constant 0 + 29: TypePointer Output 7(fvec4) +30(@entryPointOutput): 29(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 31: 7(fvec4) FunctionCall 9(@main() + Store 30(@entryPointOutput) 31 + Return + FunctionEnd + 9(@main(): 7(fvec4) Function None 8 + 10: Label + 14: 11 Load 13(tex) + 18: 15 Load 17(samp) + 20: 19 SampledImage 14 18 + 26: 7(fvec4) ImageSampleExplicitLod 20 24 Lod 25 + ReturnValue 26 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out index 634b6e87fdc..2acf3d473d1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.2dms.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.2dms.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -181,6 +182,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -356,7 +358,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 130 Capability Shader @@ -365,6 +367,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 120 124 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out index 09c05d80df5..dd665edfa9d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -196,6 +197,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -386,7 +388,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 159 Capability Shader @@ -396,6 +398,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 104 108 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out index 144d1a87588..bcfb977b19f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -247,6 +248,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -488,7 +490,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 179 Capability Shader @@ -498,6 +500,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 133 137 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out index e8bcd66b2ba..163899168e1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.basic.dx10.vert.out @@ -452,7 +452,7 @@ Shader version: 500 0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 171 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out index 9f873af6e4e..21e5d30402d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.buffer.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -85,6 +86,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -164,7 +166,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 72 Capability Shader @@ -173,6 +175,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 64 68 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out index 085778dea64..d951d093b0b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.buffer.float.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -88,6 +89,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -170,7 +172,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 75 Capability Shader @@ -179,6 +181,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 67 71 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out index 7cd6b01f62a..d59ff6ff45f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -283,6 +284,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -560,7 +562,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 201 Capability Shader @@ -571,6 +573,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 155 159 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out index df03bfcf533..b472462aa54 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -220,6 +221,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:48 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:48 Function Parameters: @@ -434,7 +436,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 174 Capability Shader @@ -445,6 +447,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 119 123 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out index 4bfc56aa685..f1349012711 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwbuffer.dx10.frag.out @@ -110,7 +110,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 57 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out index d4960adfd22..de31ee02464 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.rwtexture.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:40 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:40 Function Parameters: @@ -106,6 +107,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:40 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:40 Function Parameters: @@ -206,7 +208,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 119 Capability Shader @@ -215,6 +217,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 82 86 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out index e86fc35bb24..68044aa587b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.load.rwtexture.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.load.rwtexture.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:40 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:40 Function Parameters: @@ -124,6 +125,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:40 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:40 Function Parameters: @@ -242,7 +244,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 132 Capability Shader @@ -251,6 +253,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 104 108 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out index 98257f4fe7c..a2b4db0e841 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out @@ -1,7 +1,11 @@ hlsl.localStructuredBuffer.comp +ERROR: 0:3: 'block initializer' : buffer aliasing not yet supported +ERROR: 1 compilation errors. No code generated. + + Shader version: 500 local_size = (1, 1, 1) -0:? Sequence +ERROR: node is still EOpNull! 0:2 Function Definition: @main( ( temp void) 0:2 Function Parameters: 0:2 Function Definition: main( ( temp void) @@ -9,7 +13,7 @@ local_size = (1, 1, 1) 0:? Sequence 0:2 Function Call: @main( ( temp void) 0:? Linker Objects -0:? 'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) Linked compute stage: @@ -17,7 +21,7 @@ Linked compute stage: Shader version: 500 local_size = (1, 1, 1) -0:? Sequence +ERROR: node is still EOpNull! 0:2 Function Definition: @main( ( temp void) 0:2 Function Parameters: 0:2 Function Definition: main( ( temp void) @@ -25,40 +29,6 @@ local_size = (1, 1, 1) 0:? Sequence 0:2 Function Call: @main( ( temp void) 0:? Linker Objects -0:? 'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) -// Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 14 - - Capability Shader - 1: ExtInstImport "GLSL.std.450" - MemoryModel Logical GLSL450 - EntryPoint GLCompute 4 "main" - ExecutionMode 4 LocalSize 1 1 1 - Source HLSL 500 - Name 4 "main" - Name 6 "@main(" - Name 11 "srt0" - MemberName 11(srt0) 0 "@data" - Name 13 "srt0" - Decorate 10 ArrayStride 4 - MemberDecorate 11(srt0) 0 Offset 0 - Decorate 11(srt0) BufferBlock - Decorate 13(srt0) DescriptorSet 0 - 2: TypeVoid - 3: TypeFunction 2 - 9: TypeInt 32 0 - 10: TypeRuntimeArray 9(int) - 11(srt0): TypeStruct 10 - 12: TypePointer Uniform 11(srt0) - 13(srt0): 12(ptr) Variable Uniform - 4(main): 2 Function None 3 - 5: Label - 8: 2 FunctionCall 6(@main() - Return - FunctionEnd - 6(@main(): 2 Function None 3 - 7: Label - Return - FunctionEnd +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.frag.out index de1b3f3359a..b90811bd6ae 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.frag.out @@ -13,12 +13,11 @@ gl_FragCoord origin is upper left 0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:13 Constant: 0:13 0 (const uint) -0:13 Convert int to bool ( temp bool) -0:13 Convert float to int ( temp int) -0:13 fval: direct index for structure ( uniform float) -0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) -0:13 Constant: -0:13 2 (const uint) +0:13 Convert float to bool ( temp bool) +0:13 fval: direct index for structure ( uniform float) +0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) +0:13 Constant: +0:13 2 (const uint) 0:13 true case is null 0:14 Test condition and select ( temp void) 0:14 Condition @@ -28,12 +27,11 @@ gl_FragCoord origin is upper left 0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:14 Constant: 0:14 0 (const uint) -0:14 Convert int to bool ( temp bool) -0:14 Convert float to int ( temp int) -0:14 fval: direct index for structure ( uniform float) -0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) -0:14 Constant: -0:14 2 (const uint) +0:14 Convert float to bool ( temp bool) +0:14 fval: direct index for structure ( uniform float) +0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) +0:14 Constant: +0:14 2 (const uint) 0:14 true case is null 0:17 move second child to first child ( temp 4-component vector of float) 0:17 Color: direct index for structure ( temp 4-component vector of float) @@ -79,12 +77,11 @@ gl_FragCoord origin is upper left 0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:13 Constant: 0:13 0 (const uint) -0:13 Convert int to bool ( temp bool) -0:13 Convert float to int ( temp int) -0:13 fval: direct index for structure ( uniform float) -0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) -0:13 Constant: -0:13 2 (const uint) +0:13 Convert float to bool ( temp bool) +0:13 fval: direct index for structure ( uniform float) +0:13 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) +0:13 Constant: +0:13 2 (const uint) 0:13 true case is null 0:14 Test condition and select ( temp void) 0:14 Condition @@ -94,12 +91,11 @@ gl_FragCoord origin is upper left 0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) 0:14 Constant: 0:14 0 (const uint) -0:14 Convert int to bool ( temp bool) -0:14 Convert float to int ( temp int) -0:14 fval: direct index for structure ( uniform float) -0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) -0:14 Constant: -0:14 2 (const uint) +0:14 Convert float to bool ( temp bool) +0:14 fval: direct index for structure ( uniform float) +0:14 'anon@0' (layout( row_major std140) uniform block{ uniform int ival, uniform 4-component vector of int ival4, uniform float fval, uniform 4-component vector of float fval4}) +0:14 Constant: +0:14 2 (const uint) 0:14 true case is null 0:17 move second child to first child ( temp 4-component vector of float) 0:17 Color: direct index for structure ( temp 4-component vector of float) @@ -128,13 +124,13 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 57 +// Generated by (magic number): 80007 +// Id's are bound by 56 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 54 + EntryPoint Fragment 4 "main" 53 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -147,15 +143,15 @@ gl_FragCoord origin is upper left MemberName 14($Global) 2 "fval" MemberName 14($Global) 3 "fval4" Name 16 "" - Name 45 "psout" - Name 54 "@entryPointOutput.Color" + Name 44 "psout" + Name 53 "@entryPointOutput.Color" MemberDecorate 14($Global) 0 Offset 0 MemberDecorate 14($Global) 1 Offset 16 MemberDecorate 14($Global) 2 Offset 32 MemberDecorate 14($Global) 3 Offset 48 Decorate 14($Global) Block Decorate 16 DescriptorSet 0 - Decorate 54(@entryPointOutput.Color) Location 0 + Decorate 53(@entryPointOutput.Color) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -174,29 +170,29 @@ gl_FragCoord origin is upper left 23: 22(int) Constant 0 25: 12(int) Constant 2 26: TypePointer Uniform 6(float) - 44: TypePointer Function 8(PS_OUTPUT) - 46: 6(float) Constant 1065353216 - 47: 7(fvec4) ConstantComposite 46 46 46 46 - 48: TypePointer Function 7(fvec4) - 53: TypePointer Output 7(fvec4) -54(@entryPointOutput.Color): 53(ptr) Variable Output + 29: 6(float) Constant 0 + 43: TypePointer Function 8(PS_OUTPUT) + 45: 6(float) Constant 1065353216 + 46: 7(fvec4) ConstantComposite 45 45 45 45 + 47: TypePointer Function 7(fvec4) + 52: TypePointer Output 7(fvec4) +53(@entryPointOutput.Color): 52(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 55:8(PS_OUTPUT) FunctionCall 10(@main() - 56: 7(fvec4) CompositeExtract 55 0 - Store 54(@entryPointOutput.Color) 56 + 54:8(PS_OUTPUT) FunctionCall 10(@main() + 55: 7(fvec4) CompositeExtract 54 0 + Store 53(@entryPointOutput.Color) 55 Return FunctionEnd 10(@main():8(PS_OUTPUT) Function None 9 11: Label - 45(psout): 44(ptr) Variable Function + 44(psout): 43(ptr) Variable Function 19: 18(ptr) AccessChain 16 17 20: 12(int) Load 19 24: 21(bool) INotEqual 20 23 27: 26(ptr) AccessChain 16 25 28: 6(float) Load 27 - 29: 12(int) ConvertFToS 28 - 30: 21(bool) INotEqual 29 23 + 30: 21(bool) FOrdNotEqual 28 29 31: 21(bool) LogicalAnd 24 30 SelectionMerge 33 None BranchConditional 31 32 33 @@ -208,16 +204,15 @@ gl_FragCoord origin is upper left 36: 21(bool) INotEqual 35 23 37: 26(ptr) AccessChain 16 25 38: 6(float) Load 37 - 39: 12(int) ConvertFToS 38 - 40: 21(bool) INotEqual 39 23 - 41: 21(bool) LogicalOr 36 40 - SelectionMerge 43 None - BranchConditional 41 42 43 - 42: Label - Branch 43 - 43: Label - 49: 48(ptr) AccessChain 45(psout) 17 - Store 49 47 - 50:8(PS_OUTPUT) Load 45(psout) - ReturnValue 50 + 39: 21(bool) FOrdNotEqual 38 29 + 40: 21(bool) LogicalOr 36 39 + SelectionMerge 42 None + BranchConditional 40 41 42 + 41: Label + Branch 42 + 42: Label + 48: 47(ptr) AccessChain 44(psout) 17 + Store 48 46 + 49:8(PS_OUTPUT) Load 44(psout) + ReturnValue 49 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out index 2409b0e1113..32753e5c2f3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.binary.vec.frag.out @@ -254,7 +254,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 115 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.unary.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.unary.frag.out index 7d7cbf764a3..25dbc2ad530 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.unary.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logical.unary.frag.out @@ -184,7 +184,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 84 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logicalConvert.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logicalConvert.frag.out index 733ca26311a..6c595f8ef12 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logicalConvert.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.logicalConvert.frag.out @@ -254,7 +254,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.loopattr.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.loopattr.frag.out index 38282a5140c..cc0073ac43d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.loopattr.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.loopattr.frag.out @@ -10,7 +10,7 @@ gl_FragCoord origin is upper left 0:5 'x' ( temp int) 0:5 Constant: 0:5 0 (const int) -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Compare Less Than ( temp bool) 0:5 'x' ( temp int) @@ -25,7 +25,7 @@ gl_FragCoord origin is upper left 0:8 'y' ( temp int) 0:8 Constant: 0:8 0 (const int) -0:8 Loop with condition tested first +0:8 Loop with condition tested first: DontUnroll 0:8 Loop Condition 0:8 Compare Less Than ( temp bool) 0:8 'y' ( temp int) @@ -80,7 +80,7 @@ gl_FragCoord origin is upper left 0:5 'x' ( temp int) 0:5 Constant: 0:5 0 (const int) -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Compare Less Than ( temp bool) 0:5 'x' ( temp int) @@ -95,7 +95,7 @@ gl_FragCoord origin is upper left 0:8 'y' ( temp int) 0:8 Constant: 0:8 0 (const int) -0:8 Loop with condition tested first +0:8 Loop with condition tested first: DontUnroll 0:8 Loop Condition 0:8 Compare Less Than ( temp bool) 0:8 'y' ( temp int) @@ -136,7 +136,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 54 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matNx1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matNx1.frag.out index 74c4fb6899f..276d4c2491a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matNx1.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matNx1.frag.out @@ -151,8 +151,12 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Illegal number of components (1) for TypeVector + %v1float = OpTypeVector %float 1 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 77 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.bool.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.bool.frag.out index aff329bc5ba..900c60fcda5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.bool.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.bool.frag.out @@ -231,8 +231,12 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Illegal number of components (1) for TypeVector + %v1bool = OpTypeVector %bool 1 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 130 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.frag.out index 1d892b55b9f..c0d2e4b3fa7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.frag.out @@ -30,8 +30,12 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 1-component vector of float f1, uniform 1X1 matrix of float fmat11, uniform 4X1 matrix of float fmat41, uniform 1X2 matrix of float fmat12, uniform 2X3 matrix of double dmat23, uniform 4X4 matrix of int int44}) +error: SPIRV-Tools Validation Errors +error: Illegal number of components (1) for TypeVector + %v1float = OpTypeVector %float 1 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 30 Capability Shader @@ -82,8 +86,8 @@ gl_FragCoord origin is upper left 19: TypeVector 6(float) 2 20: TypeMatrix 19(fvec2) 1 21: TypeFloat 64 - 22: TypeVector 21(float) 3 - 23: TypeMatrix 22(fvec3) 2 + 22: TypeVector 21(float64_t) 3 + 23: TypeMatrix 22(f64vec3) 2 24: TypeInt 32 1 25: TypeVector 24(int) 4 26: TypeMatrix 25(ivec4) 4 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.int.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.int.frag.out index 807b8b9fe08..2039dfd57e9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.int.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matType.int.frag.out @@ -397,8 +397,12 @@ gl_FragCoord origin is upper left 0:? Linker Objects 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Illegal number of components (1) for TypeVector + %v1int = OpTypeVector %int 1 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 232 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-1.frag.out index 1370c19cfd6..b92f79d268e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-1.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-1.frag.out @@ -100,7 +100,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out index 187f5d03c25..2750d76acdb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matpack-pragma.frag.out @@ -170,7 +170,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 44 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixSwizzle.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixSwizzle.vert.out index 64c21cd1cdb..abb3e495a11 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixSwizzle.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixSwizzle.vert.out @@ -676,8 +676,12 @@ Shader version: 500 0:? 'inf' (layout( location=0) in float) Missing functionality: matrix swizzle +error: SPIRV-Tools Validation Errors +error: OpStore Pointer '42[f3]'s type does not match Object '34's type. + OpStore %f3 %int_0 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 118 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixindex.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixindex.frag.out index 8d3910cd99d..63e5614ef5a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixindex.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.matrixindex.frag.out @@ -272,7 +272,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 83 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.max.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.max.frag.out index 4200373a8d2..db215a2c006 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.max.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.max.frag.out @@ -66,7 +66,7 @@ gl_FragCoord origin is upper left 0:? 'input2' (layout( location=1) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 33 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.memberFunCall.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.memberFunCall.frag.out index 0a0219b3e12..01cb99adb8e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.memberFunCall.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.memberFunCall.frag.out @@ -152,7 +152,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 73 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mintypes.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mintypes.frag.out index 3c058eaa362..8722cf275bf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mintypes.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mintypes.frag.out @@ -98,7 +98,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 70 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mip.operator.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mip.operator.frag.out index 804f3b2005e..eb884da932c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mip.operator.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mip.operator.frag.out @@ -128,7 +128,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 61 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mul-truncate.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mul-truncate.frag.out new file mode 100644 index 00000000000..1973fad12c7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.mul-truncate.frag.out @@ -0,0 +1,643 @@ +hlsl.mul-truncate.frag +WARNING: 0:24: '' : mul() matrix size mismatch +WARNING: 0:25: '' : mul() matrix size mismatch +WARNING: 0:28: '' : mul() matrix size mismatch +WARNING: 0:29: '' : mul() matrix size mismatch +WARNING: 0:32: '' : mul() matrix size mismatch +WARNING: 0:33: '' : mul() matrix size mismatch +WARNING: 0:34: '' : mul() matrix size mismatch +WARNING: 0:35: '' : mul() matrix size mismatch + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:20 Sequence +0:20 move second child to first child ( temp float) +0:20 'r00' ( temp float) +0:20 dot-product ( temp float) +0:20 v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float) +0:20 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:20 Constant: +0:20 8 (const uint) +0:20 Construct vec2 ( in 2-component vector of float) +0:20 v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float) +0:20 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:20 Constant: +0:20 7 (const uint) +0:21 Sequence +0:21 move second child to first child ( temp float) +0:21 'r01' ( temp float) +0:21 dot-product ( temp float) +0:21 Construct vec2 ( in 2-component vector of float) +0:21 v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:21 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:21 Constant: +0:21 6 (const uint) +0:21 v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float) +0:21 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:21 Constant: +0:21 8 (const uint) +0:24 Sequence +0:24 move second child to first child ( temp 4-component vector of float) +0:24 'r10' ( temp 4-component vector of float) +0:24 matrix-times-vector ( temp 4-component vector of float) +0:24 Construct mat3x4 ( uniform 3X4 matrix of float) +0:24 m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:24 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:24 Constant: +0:24 0 (const uint) +0:24 v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float) +0:24 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:24 Constant: +0:24 7 (const uint) +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'r11' ( temp 4-component vector of float) +0:25 matrix-times-vector ( temp 4-component vector of float) +0:25 m34: direct index for structure (layout( row_major std140) uniform 3X4 matrix of float) +0:25 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:25 Constant: +0:25 2 (const uint) +0:25 Construct vec3 ( uniform 3-component vector of float) +0:25 v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:25 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:25 Constant: +0:25 6 (const uint) +0:28 Sequence +0:28 move second child to first child ( temp 4-component vector of float) +0:28 'r20' ( temp 4-component vector of float) +0:28 vector-times-matrix ( temp 4-component vector of float) +0:28 v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float) +0:28 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:28 Constant: +0:28 7 (const uint) +0:28 Construct mat4x3 ( uniform 4X3 matrix of float) +0:28 m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:28 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:28 Constant: +0:28 0 (const uint) +0:29 Sequence +0:29 move second child to first child ( temp 4-component vector of float) +0:29 'r21' ( temp 4-component vector of float) +0:29 vector-times-matrix ( temp 4-component vector of float) +0:29 Construct vec3 ( uniform 3-component vector of float) +0:29 v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:29 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:29 Constant: +0:29 6 (const uint) +0:29 m43: direct index for structure (layout( row_major std140) uniform 4X3 matrix of float) +0:29 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:29 Constant: +0:29 1 (const uint) +0:32 Sequence +0:32 move second child to first child ( temp 2X3 matrix of float) +0:32 'r30' ( temp 2X3 matrix of float) +0:32 matrix-multiply ( temp 2X3 matrix of float) +0:32 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:32 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:32 Constant: +0:32 3 (const uint) +0:32 Construct mat2x3 ( uniform 2X3 matrix of float) +0:32 m24: direct index for structure (layout( row_major std140) uniform 2X4 matrix of float) +0:32 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:32 Constant: +0:32 4 (const uint) +0:33 Sequence +0:33 move second child to first child ( temp 3X4 matrix of float) +0:33 'r31' ( temp 3X4 matrix of float) +0:33 matrix-multiply ( temp 3X4 matrix of float) +0:33 m24: direct index for structure (layout( row_major std140) uniform 2X4 matrix of float) +0:33 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:33 Constant: +0:33 4 (const uint) +0:33 Construct mat3x2 ( uniform 3X2 matrix of float) +0:33 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:33 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:33 Constant: +0:33 3 (const uint) +0:34 Sequence +0:34 move second child to first child ( temp 3X2 matrix of float) +0:34 'r32' ( temp 3X2 matrix of float) +0:34 matrix-multiply ( temp 3X2 matrix of float) +0:34 Construct mat3x2 ( uniform 3X2 matrix of float) +0:34 m42: direct index for structure (layout( row_major std140) uniform 4X2 matrix of float) +0:34 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:34 Constant: +0:34 5 (const uint) +0:34 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:34 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:34 Constant: +0:34 3 (const uint) +0:35 Sequence +0:35 move second child to first child ( temp 4X3 matrix of float) +0:35 'r33' ( temp 4X3 matrix of float) +0:35 matrix-multiply ( temp 4X3 matrix of float) +0:35 Construct mat2x3 ( uniform 2X3 matrix of float) +0:35 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:35 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:35 Constant: +0:35 3 (const uint) +0:35 m42: direct index for structure (layout( row_major std140) uniform 4X2 matrix of float) +0:35 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:35 Constant: +0:35 5 (const uint) +0:37 Branch: Return with expression +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 'r10' ( temp 4-component vector of float) +0:37 'r11' ( temp 4-component vector of float) +0:37 'r20' ( temp 4-component vector of float) +0:37 'r21' ( temp 4-component vector of float) +0:37 'r00' ( temp float) +0:37 'r01' ( temp float) +0:37 direct index ( temp float) +0:37 direct index ( temp 3-component vector of float) +0:37 'r30' ( temp 2X3 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 direct index ( temp 4-component vector of float) +0:37 'r31' ( temp 3X4 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:37 direct index ( temp float) +0:37 direct index ( temp 2-component vector of float) +0:37 'r32' ( temp 3X2 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 direct index ( temp 4-component vector of float) +0:37 transpose ( temp 3X4 matrix of float) +0:37 'r33' ( temp 4X3 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:20 Sequence +0:20 move second child to first child ( temp float) +0:20 'r00' ( temp float) +0:20 dot-product ( temp float) +0:20 v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float) +0:20 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:20 Constant: +0:20 8 (const uint) +0:20 Construct vec2 ( in 2-component vector of float) +0:20 v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float) +0:20 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:20 Constant: +0:20 7 (const uint) +0:21 Sequence +0:21 move second child to first child ( temp float) +0:21 'r01' ( temp float) +0:21 dot-product ( temp float) +0:21 Construct vec2 ( in 2-component vector of float) +0:21 v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:21 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:21 Constant: +0:21 6 (const uint) +0:21 v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float) +0:21 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:21 Constant: +0:21 8 (const uint) +0:24 Sequence +0:24 move second child to first child ( temp 4-component vector of float) +0:24 'r10' ( temp 4-component vector of float) +0:24 matrix-times-vector ( temp 4-component vector of float) +0:24 Construct mat3x4 ( uniform 3X4 matrix of float) +0:24 m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:24 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:24 Constant: +0:24 0 (const uint) +0:24 v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float) +0:24 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:24 Constant: +0:24 7 (const uint) +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'r11' ( temp 4-component vector of float) +0:25 matrix-times-vector ( temp 4-component vector of float) +0:25 m34: direct index for structure (layout( row_major std140) uniform 3X4 matrix of float) +0:25 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:25 Constant: +0:25 2 (const uint) +0:25 Construct vec3 ( uniform 3-component vector of float) +0:25 v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:25 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:25 Constant: +0:25 6 (const uint) +0:28 Sequence +0:28 move second child to first child ( temp 4-component vector of float) +0:28 'r20' ( temp 4-component vector of float) +0:28 vector-times-matrix ( temp 4-component vector of float) +0:28 v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float) +0:28 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:28 Constant: +0:28 7 (const uint) +0:28 Construct mat4x3 ( uniform 4X3 matrix of float) +0:28 m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float) +0:28 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:28 Constant: +0:28 0 (const uint) +0:29 Sequence +0:29 move second child to first child ( temp 4-component vector of float) +0:29 'r21' ( temp 4-component vector of float) +0:29 vector-times-matrix ( temp 4-component vector of float) +0:29 Construct vec3 ( uniform 3-component vector of float) +0:29 v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float) +0:29 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:29 Constant: +0:29 6 (const uint) +0:29 m43: direct index for structure (layout( row_major std140) uniform 4X3 matrix of float) +0:29 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:29 Constant: +0:29 1 (const uint) +0:32 Sequence +0:32 move second child to first child ( temp 2X3 matrix of float) +0:32 'r30' ( temp 2X3 matrix of float) +0:32 matrix-multiply ( temp 2X3 matrix of float) +0:32 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:32 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:32 Constant: +0:32 3 (const uint) +0:32 Construct mat2x3 ( uniform 2X3 matrix of float) +0:32 m24: direct index for structure (layout( row_major std140) uniform 2X4 matrix of float) +0:32 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:32 Constant: +0:32 4 (const uint) +0:33 Sequence +0:33 move second child to first child ( temp 3X4 matrix of float) +0:33 'r31' ( temp 3X4 matrix of float) +0:33 matrix-multiply ( temp 3X4 matrix of float) +0:33 m24: direct index for structure (layout( row_major std140) uniform 2X4 matrix of float) +0:33 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:33 Constant: +0:33 4 (const uint) +0:33 Construct mat3x2 ( uniform 3X2 matrix of float) +0:33 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:33 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:33 Constant: +0:33 3 (const uint) +0:34 Sequence +0:34 move second child to first child ( temp 3X2 matrix of float) +0:34 'r32' ( temp 3X2 matrix of float) +0:34 matrix-multiply ( temp 3X2 matrix of float) +0:34 Construct mat3x2 ( uniform 3X2 matrix of float) +0:34 m42: direct index for structure (layout( row_major std140) uniform 4X2 matrix of float) +0:34 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:34 Constant: +0:34 5 (const uint) +0:34 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:34 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:34 Constant: +0:34 3 (const uint) +0:35 Sequence +0:35 move second child to first child ( temp 4X3 matrix of float) +0:35 'r33' ( temp 4X3 matrix of float) +0:35 matrix-multiply ( temp 4X3 matrix of float) +0:35 Construct mat2x3 ( uniform 2X3 matrix of float) +0:35 m33: direct index for structure (layout( row_major std140) uniform 3X3 matrix of float) +0:35 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:35 Constant: +0:35 3 (const uint) +0:35 m42: direct index for structure (layout( row_major std140) uniform 4X2 matrix of float) +0:35 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:35 Constant: +0:35 5 (const uint) +0:37 Branch: Return with expression +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 add ( temp 4-component vector of float) +0:37 'r10' ( temp 4-component vector of float) +0:37 'r11' ( temp 4-component vector of float) +0:37 'r20' ( temp 4-component vector of float) +0:37 'r21' ( temp 4-component vector of float) +0:37 'r00' ( temp float) +0:37 'r01' ( temp float) +0:37 direct index ( temp float) +0:37 direct index ( temp 3-component vector of float) +0:37 'r30' ( temp 2X3 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 direct index ( temp 4-component vector of float) +0:37 'r31' ( temp 3X4 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:37 direct index ( temp float) +0:37 direct index ( temp 2-component vector of float) +0:37 'r32' ( temp 3X2 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 direct index ( temp 4-component vector of float) +0:37 transpose ( temp 3X4 matrix of float) +0:37 'r33' ( temp 4X3 matrix of float) +0:37 Constant: +0:37 0 (const int) +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 3X3 matrix of float m33, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2}) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 190 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 188 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 9 "@main(" + Name 12 "r00" + Name 21 "Matrix" + MemberName 21(Matrix) 0 "m44" + MemberName 21(Matrix) 1 "m43" + MemberName 21(Matrix) 2 "m34" + MemberName 21(Matrix) 3 "m33" + MemberName 21(Matrix) 4 "m24" + MemberName 21(Matrix) 5 "m42" + MemberName 21(Matrix) 6 "v4" + MemberName 21(Matrix) 7 "v3" + MemberName 21(Matrix) 8 "v2" + Name 23 "" + Name 37 "r01" + Name 49 "r10" + Name 61 "r11" + Name 73 "r20" + Name 88 "r21" + Name 102 "r30" + Name 118 "r31" + Name 133 "r32" + Name 146 "r33" + Name 188 "@entryPointOutput" + MemberDecorate 21(Matrix) 0 RowMajor + MemberDecorate 21(Matrix) 0 Offset 0 + MemberDecorate 21(Matrix) 0 MatrixStride 16 + MemberDecorate 21(Matrix) 1 RowMajor + MemberDecorate 21(Matrix) 1 Offset 64 + MemberDecorate 21(Matrix) 1 MatrixStride 16 + MemberDecorate 21(Matrix) 2 RowMajor + MemberDecorate 21(Matrix) 2 Offset 112 + MemberDecorate 21(Matrix) 2 MatrixStride 16 + MemberDecorate 21(Matrix) 3 RowMajor + MemberDecorate 21(Matrix) 3 Offset 176 + MemberDecorate 21(Matrix) 3 MatrixStride 16 + MemberDecorate 21(Matrix) 4 RowMajor + MemberDecorate 21(Matrix) 4 Offset 224 + MemberDecorate 21(Matrix) 4 MatrixStride 16 + MemberDecorate 21(Matrix) 5 RowMajor + MemberDecorate 21(Matrix) 5 Offset 288 + MemberDecorate 21(Matrix) 5 MatrixStride 16 + MemberDecorate 21(Matrix) 6 Offset 320 + MemberDecorate 21(Matrix) 7 Offset 336 + MemberDecorate 21(Matrix) 8 Offset 352 + Decorate 21(Matrix) Block + Decorate 23 DescriptorSet 0 + Decorate 188(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypePointer Function 6(float) + 13: TypeMatrix 7(fvec4) 4 + 14: TypeVector 6(float) 3 + 15: TypeMatrix 14(fvec3) 4 + 16: TypeMatrix 7(fvec4) 3 + 17: TypeMatrix 14(fvec3) 3 + 18: TypeMatrix 7(fvec4) 2 + 19: TypeVector 6(float) 2 + 20: TypeMatrix 19(fvec2) 4 + 21(Matrix): TypeStruct 13 15 16 17 18 20 7(fvec4) 14(fvec3) 19(fvec2) + 22: TypePointer Uniform 21(Matrix) + 23: 22(ptr) Variable Uniform + 24: TypeInt 32 1 + 25: 24(int) Constant 8 + 26: TypePointer Uniform 19(fvec2) + 29: 24(int) Constant 7 + 30: TypePointer Uniform 14(fvec3) + 38: 24(int) Constant 6 + 39: TypePointer Uniform 7(fvec4) + 48: TypePointer Function 7(fvec4) + 50: 24(int) Constant 0 + 51: TypePointer Uniform 13 + 62: 24(int) Constant 2 + 63: TypePointer Uniform 16 + 95: 24(int) Constant 1 + 96: TypePointer Uniform 15 + 100: TypeMatrix 14(fvec3) 2 + 101: TypePointer Function 100 + 103: 24(int) Constant 3 + 104: TypePointer Uniform 17 + 107: 24(int) Constant 4 + 108: TypePointer Uniform 18 + 117: TypePointer Function 16 + 123: TypeMatrix 19(fvec2) 3 + 132: TypePointer Function 123 + 134: 24(int) Constant 5 + 135: TypePointer Uniform 20 + 145: TypePointer Function 15 + 168: TypeInt 32 0 + 169: 168(int) Constant 0 + 187: TypePointer Output 7(fvec4) +188(@entryPointOutput): 187(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 189: 7(fvec4) FunctionCall 9(@main() + Store 188(@entryPointOutput) 189 + Return + FunctionEnd + 9(@main(): 7(fvec4) Function None 8 + 10: Label + 12(r00): 11(ptr) Variable Function + 37(r01): 11(ptr) Variable Function + 49(r10): 48(ptr) Variable Function + 61(r11): 48(ptr) Variable Function + 73(r20): 48(ptr) Variable Function + 88(r21): 48(ptr) Variable Function + 102(r30): 101(ptr) Variable Function + 118(r31): 117(ptr) Variable Function + 133(r32): 132(ptr) Variable Function + 146(r33): 145(ptr) Variable Function + 27: 26(ptr) AccessChain 23 25 + 28: 19(fvec2) Load 27 + 31: 30(ptr) AccessChain 23 29 + 32: 14(fvec3) Load 31 + 33: 6(float) CompositeExtract 32 0 + 34: 6(float) CompositeExtract 32 1 + 35: 19(fvec2) CompositeConstruct 33 34 + 36: 6(float) Dot 28 35 + Store 12(r00) 36 + 40: 39(ptr) AccessChain 23 38 + 41: 7(fvec4) Load 40 + 42: 6(float) CompositeExtract 41 0 + 43: 6(float) CompositeExtract 41 1 + 44: 19(fvec2) CompositeConstruct 42 43 + 45: 26(ptr) AccessChain 23 25 + 46: 19(fvec2) Load 45 + 47: 6(float) Dot 44 46 + Store 37(r01) 47 + 52: 51(ptr) AccessChain 23 50 + 53: 13 Load 52 + 54: 7(fvec4) CompositeExtract 53 0 + 55: 7(fvec4) CompositeExtract 53 1 + 56: 7(fvec4) CompositeExtract 53 2 + 57: 16 CompositeConstruct 54 55 56 + 58: 30(ptr) AccessChain 23 29 + 59: 14(fvec3) Load 58 + 60: 7(fvec4) MatrixTimesVector 57 59 + Store 49(r10) 60 + 64: 63(ptr) AccessChain 23 62 + 65: 16 Load 64 + 66: 39(ptr) AccessChain 23 38 + 67: 7(fvec4) Load 66 + 68: 6(float) CompositeExtract 67 0 + 69: 6(float) CompositeExtract 67 1 + 70: 6(float) CompositeExtract 67 2 + 71: 14(fvec3) CompositeConstruct 68 69 70 + 72: 7(fvec4) MatrixTimesVector 65 71 + Store 61(r11) 72 + 74: 30(ptr) AccessChain 23 29 + 75: 14(fvec3) Load 74 + 76: 51(ptr) AccessChain 23 50 + 77: 13 Load 76 + 78: 7(fvec4) CompositeExtract 77 0 + 79: 14(fvec3) VectorShuffle 78 78 0 1 2 + 80: 7(fvec4) CompositeExtract 77 1 + 81: 14(fvec3) VectorShuffle 80 80 0 1 2 + 82: 7(fvec4) CompositeExtract 77 2 + 83: 14(fvec3) VectorShuffle 82 82 0 1 2 + 84: 7(fvec4) CompositeExtract 77 3 + 85: 14(fvec3) VectorShuffle 84 84 0 1 2 + 86: 15 CompositeConstruct 79 81 83 85 + 87: 7(fvec4) VectorTimesMatrix 75 86 + Store 73(r20) 87 + 89: 39(ptr) AccessChain 23 38 + 90: 7(fvec4) Load 89 + 91: 6(float) CompositeExtract 90 0 + 92: 6(float) CompositeExtract 90 1 + 93: 6(float) CompositeExtract 90 2 + 94: 14(fvec3) CompositeConstruct 91 92 93 + 97: 96(ptr) AccessChain 23 95 + 98: 15 Load 97 + 99: 7(fvec4) VectorTimesMatrix 94 98 + Store 88(r21) 99 + 105: 104(ptr) AccessChain 23 103 + 106: 17 Load 105 + 109: 108(ptr) AccessChain 23 107 + 110: 18 Load 109 + 111: 7(fvec4) CompositeExtract 110 0 + 112: 14(fvec3) VectorShuffle 111 111 0 1 2 + 113: 7(fvec4) CompositeExtract 110 1 + 114: 14(fvec3) VectorShuffle 113 113 0 1 2 + 115: 100 CompositeConstruct 112 114 + 116: 100 MatrixTimesMatrix 106 115 + Store 102(r30) 116 + 119: 108(ptr) AccessChain 23 107 + 120: 18 Load 119 + 121: 104(ptr) AccessChain 23 103 + 122: 17 Load 121 + 124: 14(fvec3) CompositeExtract 122 0 + 125: 19(fvec2) VectorShuffle 124 124 0 1 + 126: 14(fvec3) CompositeExtract 122 1 + 127: 19(fvec2) VectorShuffle 126 126 0 1 + 128: 14(fvec3) CompositeExtract 122 2 + 129: 19(fvec2) VectorShuffle 128 128 0 1 + 130: 123 CompositeConstruct 125 127 129 + 131: 16 MatrixTimesMatrix 120 130 + Store 118(r31) 131 + 136: 135(ptr) AccessChain 23 134 + 137: 20 Load 136 + 138: 19(fvec2) CompositeExtract 137 0 + 139: 19(fvec2) CompositeExtract 137 1 + 140: 19(fvec2) CompositeExtract 137 2 + 141: 123 CompositeConstruct 138 139 140 + 142: 104(ptr) AccessChain 23 103 + 143: 17 Load 142 + 144: 123 MatrixTimesMatrix 141 143 + Store 133(r32) 144 + 147: 104(ptr) AccessChain 23 103 + 148: 17 Load 147 + 149: 14(fvec3) CompositeExtract 148 0 + 150: 14(fvec3) CompositeExtract 148 1 + 151: 100 CompositeConstruct 149 150 + 152: 135(ptr) AccessChain 23 134 + 153: 20 Load 152 + 154: 15 MatrixTimesMatrix 151 153 + Store 146(r33) 154 + 155: 7(fvec4) Load 49(r10) + 156: 7(fvec4) Load 61(r11) + 157: 7(fvec4) FAdd 155 156 + 158: 7(fvec4) Load 73(r20) + 159: 7(fvec4) FAdd 157 158 + 160: 7(fvec4) Load 88(r21) + 161: 7(fvec4) FAdd 159 160 + 162: 6(float) Load 12(r00) + 163: 7(fvec4) CompositeConstruct 162 162 162 162 + 164: 7(fvec4) FAdd 161 163 + 165: 6(float) Load 37(r01) + 166: 7(fvec4) CompositeConstruct 165 165 165 165 + 167: 7(fvec4) FAdd 164 166 + 170: 11(ptr) AccessChain 102(r30) 50 169 + 171: 6(float) Load 170 + 172: 7(fvec4) CompositeConstruct 171 171 171 171 + 173: 7(fvec4) FAdd 167 172 + 174: 48(ptr) AccessChain 118(r31) 50 + 175: 7(fvec4) Load 174 + 176: 7(fvec4) FAdd 173 175 + 177: 11(ptr) AccessChain 133(r32) 50 169 + 178: 6(float) Load 177 + 179: 7(fvec4) CompositeConstruct 178 178 178 178 + 180: 7(fvec4) FAdd 176 179 + 181: 15 Load 146(r33) + 182: 16 Transpose 181 + 183: 7(fvec4) CompositeExtract 182 0 + 184: 7(fvec4) FAdd 180 183 + ReturnValue 184 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out index 83113386274..8bd1ad855ea 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiDescriptorSet.frag.out @@ -1,6 +1,6 @@ hlsl.multiDescriptorSet.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 92 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiEntry.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiEntry.vert.out index 5ee84b34106..1c7711882e0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiEntry.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiEntry.vert.out @@ -70,7 +70,7 @@ Shader version: 500 0:? 'Index' ( in uint VertexIndex) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 41 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiReturn.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiReturn.frag.out index d00c35e33e2..695a52c6966 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiReturn.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.multiReturn.frag.out @@ -48,7 +48,7 @@ gl_FragCoord origin is upper left 0:? 'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform structure{ temp float f, temp 3-component vector of float v, temp 3X3 matrix of float m} s}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 42 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.namespace.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.namespace.frag.out index f86a0a0f386..08d959b3ea9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.namespace.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.namespace.frag.out @@ -101,8 +101,12 @@ gl_FragCoord origin is upper left 0:? 'N2::gf' ( global float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: OpFunctionCall Function 's parameter count does not match the argument count. + %43 = OpFunctionCall %v4float %N2__N3__C1__getVec_ + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 54 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.noSemantic.functionality1.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.noSemantic.functionality1.comp.out new file mode 100644 index 00000000000..f00fe744bd4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.noSemantic.functionality1.comp.out @@ -0,0 +1,62 @@ +hlsl.noSemantic.functionality1.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 30 + + Capability Shader + Extension "SPV_GOOGLE_hlsl_functionality1" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 1 1 1 + Source HLSL 500 + Name 4 "main" + Name 6 "@main(" + Name 11 "Buf" + MemberName 11(Buf) 0 "@data" + Name 13 "Buf" + Name 17 "Buf@count" + MemberName 17(Buf@count) 0 "@count" + Name 19 "Buf@count" + Decorate 10 ArrayStride 16 + MemberDecorate 11(Buf) 0 Offset 0 + Decorate 11(Buf) BufferBlock + Decorate 13(Buf) DescriptorSet 0 + Decorate 13(Buf) Binding 0 + MemberDecorate 17(Buf@count) 0 Offset 0 + Decorate 17(Buf@count) BufferBlock + Decorate 19(Buf@count) DescriptorSet 0 + DecorateId 13(Buf) DecorationHlslCounterBufferGOOGLE 19(Buf@count) + 2: TypeVoid + 3: TypeFunction 2 + 8: TypeFloat 32 + 9: TypeVector 8(float) 4 + 10: TypeRuntimeArray 9(fvec4) + 11(Buf): TypeStruct 10 + 12: TypePointer Uniform 11(Buf) + 13(Buf): 12(ptr) Variable Uniform + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: TypeInt 32 0 + 17(Buf@count): TypeStruct 16(int) + 18: TypePointer Uniform 17(Buf@count) + 19(Buf@count): 18(ptr) Variable Uniform + 20: TypePointer Uniform 16(int) + 22: 16(int) Constant 1 + 23: 16(int) Constant 0 + 25: 8(float) Constant 1065353216 + 26: 9(fvec4) ConstantComposite 25 25 25 25 + 27: TypePointer Uniform 9(fvec4) + 4(main): 2 Function None 3 + 5: Label + 29: 2 FunctionCall 6(@main() + Return + FunctionEnd + 6(@main(): 2 Function None 3 + 7: Label + 21: 20(ptr) AccessChain 19(Buf@count) 15 + 24: 16(int) AtomicIAdd 21 22 23 22 + 28: 27(ptr) AccessChain 13(Buf) 15 24 + Store 28 26 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonint-index.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonint-index.frag.out index f512dbecb17..131c1ec03cc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonint-index.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonint-index.frag.out @@ -88,7 +88,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonstaticMemberFunction.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonstaticMemberFunction.frag.out index d1d99cac02d..1927a4cf26d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonstaticMemberFunction.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.nonstaticMemberFunction.frag.out @@ -268,7 +268,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 111 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out index 9fcceac672e..b1fa856faa3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numericsuffixes.frag.out @@ -192,7 +192,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 54 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numthreads.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numthreads.comp.out index 3d69af40de2..fd7de34b172 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numthreads.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.numthreads.comp.out @@ -1,20 +1,20 @@ hlsl.numthreads.comp Shader version: 500 -local_size = (4, 4, 2) +local_size = (1, 4, 8) 0:? Sequence 0:4 Function Definition: main(vu3; ( temp void) 0:4 Function Parameters: 0:4 'tid' ( in 3-component vector of uint) -0:9 Function Definition: @main_aux1(vu3; ( temp void) +0:9 Function Definition: @main_aux2(vu3; ( temp void) 0:9 Function Parameters: 0:9 'tid' ( in 3-component vector of uint) -0:9 Function Definition: main_aux1( ( temp void) +0:9 Function Definition: main_aux2( ( temp void) 0:9 Function Parameters: 0:? Sequence 0:9 move second child to first child ( temp 3-component vector of uint) 0:? 'tid' ( temp 3-component vector of uint) 0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) -0:9 Function Call: @main_aux1(vu3; ( temp void) +0:9 Function Call: @main_aux2(vu3; ( temp void) 0:? 'tid' ( temp 3-component vector of uint) 0:? Linker Objects 0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) @@ -24,39 +24,39 @@ Linked compute stage: Shader version: 500 -local_size = (4, 4, 2) +local_size = (1, 4, 8) 0:? Sequence 0:4 Function Definition: main(vu3; ( temp void) 0:4 Function Parameters: 0:4 'tid' ( in 3-component vector of uint) -0:9 Function Definition: @main_aux1(vu3; ( temp void) +0:9 Function Definition: @main_aux2(vu3; ( temp void) 0:9 Function Parameters: 0:9 'tid' ( in 3-component vector of uint) -0:9 Function Definition: main_aux1( ( temp void) +0:9 Function Definition: main_aux2( ( temp void) 0:9 Function Parameters: 0:? Sequence 0:9 move second child to first child ( temp 3-component vector of uint) 0:? 'tid' ( temp 3-component vector of uint) 0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) -0:9 Function Call: @main_aux1(vu3; ( temp void) +0:9 Function Call: @main_aux2(vu3; ( temp void) 0:? 'tid' ( temp 3-component vector of uint) 0:? Linker Objects 0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 23 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 4 "main_aux1" 18 - ExecutionMode 4 LocalSize 4 4 2 + EntryPoint GLCompute 4 "main_aux2" 18 + ExecutionMode 4 LocalSize 1 4 8 Source HLSL 500 - Name 4 "main_aux1" + Name 4 "main_aux2" Name 11 "main(vu3;" Name 10 "tid" - Name 14 "@main_aux1(vu3;" + Name 14 "@main_aux2(vu3;" Name 13 "tid" Name 16 "tid" Name 18 "tid" @@ -70,7 +70,7 @@ local_size = (4, 4, 2) 9: TypeFunction 2 8(ptr) 17: TypePointer Input 7(ivec3) 18(tid): 17(ptr) Variable Input - 4(main_aux1): 2 Function None 3 + 4(main_aux2): 2 Function None 3 5: Label 16(tid): 8(ptr) Variable Function 20(param): 8(ptr) Variable Function @@ -78,7 +78,7 @@ local_size = (4, 4, 2) Store 16(tid) 19 21: 7(ivec3) Load 16(tid) Store 20(param) 21 - 22: 2 FunctionCall 14(@main_aux1(vu3;) 20(param) + 22: 2 FunctionCall 14(@main_aux2(vu3;) 20(param) Return FunctionEnd 11(main(vu3;): 2 Function None 9 @@ -86,7 +86,7 @@ local_size = (4, 4, 2) 12: Label Return FunctionEnd -14(@main_aux1(vu3;): 2 Function None 9 +14(@main_aux2(vu3;): 2 Function None 9 13(tid): 8(ptr) FunctionParameter 15: Label Return diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out index 95b39b3c5cd..918b462fb94 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.opaque-type-bug.frag.out @@ -58,7 +58,7 @@ gl_FragCoord origin is upper left 0:? 'MyTexture' (layout( binding=0) uniform texture2D) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.overload.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.overload.frag.out index e2f67733e71..5960d3d5892 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.overload.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.overload.frag.out @@ -734,7 +734,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 520 Capability Shader @@ -937,7 +937,7 @@ gl_FragCoord origin is upper left 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 64 - 7: TypePointer Function 6(float) + 7: TypePointer Function 6(float64_t) 8: TypeBool 9: TypePointer Function 8(bool) 10: TypeFunction 2 7(ptr) 9(ptr) @@ -967,8 +967,8 @@ gl_FragCoord origin is upper left 113: TypeVector 22(int) 3 114: TypePointer Function 113(ivec3) 115: TypeFunction 2 114(ptr) - 125: TypeVector 6(float) 3 - 126: TypePointer Function 125(fvec3) + 125: TypeVector 6(float64_t) 3 + 126: TypePointer Function 125(f64vec3) 127: TypeFunction 2 126(ptr) 134: TypeVector 15(int) 2 135: TypePointer Function 134(ivec2) @@ -976,14 +976,14 @@ gl_FragCoord origin is upper left 149: TypeVector 29(float) 4 150: TypePointer Function 149(fvec4) 151: TypeFunction 149(fvec4) 150(ptr) - 334: 6(float) Constant 0 0 + 334:6(float64_t) Constant 0 0 339: 15(int) Constant 0 348: 29(float) Constant 0 353: 15(int) Constant 1 373: 22(int) Constant 0 374: 22(int) Constant 1 394: 29(float) Constant 1065353216 - 414: 6(float) Constant 0 1072693248 + 414:6(float64_t) Constant 0 1072693248 484: TypeVector 22(int) 2 494: TypeVector 22(int) 4 503: TypeVector 8(bool) 3 @@ -1283,117 +1283,117 @@ gl_FragCoord origin is upper left 497(param): 23(ptr) Variable Function 500(param): 9(ptr) Variable Function 506(param): 9(ptr) Variable Function - 158: 6(float) Load 155(d) + 158:6(float64_t) Load 155(d) Store 157(param) 158 160: 8(bool) Load 156(b) Store 159(param) 160 161: 2 FunctionCall 13(foo1(d1;b1;) 157(param) 159(param) - 163: 6(float) Load 155(d) + 163:6(float64_t) Load 155(d) Store 162(param) 163 - 165: 6(float) Load 155(d) + 165:6(float64_t) Load 155(d) Store 164(param) 165 166: 2 FunctionCall 39(foo1(d1;d1;) 162(param) 164(param) - 169: 6(float) Load 155(d) + 169:6(float64_t) Load 155(d) Store 168(param) 169 171: 15(int) Load 167(u) Store 170(param) 171 172: 2 FunctionCall 20(foo1(d1;u1;) 168(param) 170(param) - 175: 6(float) Load 155(d) + 175:6(float64_t) Load 155(d) Store 174(param) 175 177: 22(int) Load 173(i) Store 176(param) 177 178: 2 FunctionCall 27(foo1(d1;i1;) 174(param) 176(param) - 181: 6(float) Load 155(d) + 181:6(float64_t) Load 155(d) Store 180(param) 181 183: 29(float) Load 179(f) Store 182(param) 183 184: 2 FunctionCall 34(foo1(d1;f1;) 180(param) 182(param) 185: 29(float) Load 179(f) - 186: 6(float) FConvert 185 + 186:6(float64_t) FConvert 185 Store 187(param) 186 189: 8(bool) Load 156(b) Store 188(param) 189 190: 2 FunctionCall 13(foo1(d1;b1;) 187(param) 188(param) 191: 29(float) Load 179(f) - 192: 6(float) FConvert 191 + 192:6(float64_t) FConvert 191 Store 193(param) 192 - 195: 6(float) Load 155(d) + 195:6(float64_t) Load 155(d) Store 194(param) 195 196: 2 FunctionCall 39(foo1(d1;d1;) 193(param) 194(param) 197: 29(float) Load 179(f) - 198: 6(float) FConvert 197 + 198:6(float64_t) FConvert 197 Store 199(param) 198 201: 15(int) Load 167(u) Store 200(param) 201 202: 2 FunctionCall 20(foo1(d1;u1;) 199(param) 200(param) 203: 29(float) Load 179(f) - 204: 6(float) FConvert 203 + 204:6(float64_t) FConvert 203 Store 205(param) 204 207: 22(int) Load 173(i) Store 206(param) 207 208: 2 FunctionCall 27(foo1(d1;i1;) 205(param) 206(param) 209: 29(float) Load 179(f) - 210: 6(float) FConvert 209 + 210:6(float64_t) FConvert 209 Store 211(param) 210 213: 29(float) Load 179(f) Store 212(param) 213 214: 2 FunctionCall 34(foo1(d1;f1;) 211(param) 212(param) 215: 15(int) Load 167(u) - 216: 6(float) ConvertUToF 215 + 216:6(float64_t) ConvertUToF 215 Store 217(param) 216 219: 8(bool) Load 156(b) Store 218(param) 219 220: 2 FunctionCall 13(foo1(d1;b1;) 217(param) 218(param) 221: 15(int) Load 167(u) - 222: 6(float) ConvertUToF 221 + 222:6(float64_t) ConvertUToF 221 Store 223(param) 222 - 225: 6(float) Load 155(d) + 225:6(float64_t) Load 155(d) Store 224(param) 225 226: 2 FunctionCall 39(foo1(d1;d1;) 223(param) 224(param) 227: 15(int) Load 167(u) - 228: 6(float) ConvertUToF 227 + 228:6(float64_t) ConvertUToF 227 Store 229(param) 228 231: 15(int) Load 167(u) Store 230(param) 231 232: 2 FunctionCall 20(foo1(d1;u1;) 229(param) 230(param) 233: 15(int) Load 167(u) - 234: 6(float) ConvertUToF 233 + 234:6(float64_t) ConvertUToF 233 Store 235(param) 234 237: 22(int) Load 173(i) Store 236(param) 237 238: 2 FunctionCall 27(foo1(d1;i1;) 235(param) 236(param) 239: 15(int) Load 167(u) - 240: 6(float) ConvertUToF 239 + 240:6(float64_t) ConvertUToF 239 Store 241(param) 240 243: 29(float) Load 179(f) Store 242(param) 243 244: 2 FunctionCall 34(foo1(d1;f1;) 241(param) 242(param) 245: 22(int) Load 173(i) - 246: 6(float) ConvertSToF 245 + 246:6(float64_t) ConvertSToF 245 Store 247(param) 246 249: 8(bool) Load 156(b) Store 248(param) 249 250: 2 FunctionCall 13(foo1(d1;b1;) 247(param) 248(param) 251: 22(int) Load 173(i) - 252: 6(float) ConvertSToF 251 + 252:6(float64_t) ConvertSToF 251 Store 253(param) 252 - 255: 6(float) Load 155(d) + 255:6(float64_t) Load 155(d) Store 254(param) 255 256: 2 FunctionCall 39(foo1(d1;d1;) 253(param) 254(param) 257: 22(int) Load 173(i) - 258: 6(float) ConvertSToF 257 + 258:6(float64_t) ConvertSToF 257 Store 259(param) 258 261: 15(int) Load 167(u) Store 260(param) 261 262: 2 FunctionCall 20(foo1(d1;u1;) 259(param) 260(param) 263: 22(int) Load 173(i) - 264: 6(float) ConvertSToF 263 + 264:6(float64_t) ConvertSToF 263 Store 265(param) 264 267: 22(int) Load 173(i) Store 266(param) 267 268: 2 FunctionCall 27(foo1(d1;i1;) 265(param) 266(param) 269: 22(int) Load 173(i) - 270: 6(float) ConvertSToF 269 + 270:6(float64_t) ConvertSToF 269 Store 271(param) 270 273: 29(float) Load 179(f) Store 272(param) 273 @@ -1407,7 +1407,7 @@ gl_FragCoord origin is upper left 281: 15(int) Load 167(u) 282: 22(int) Bitcast 281 Store 283(param) 282 - 285: 6(float) Load 155(d) + 285:6(float64_t) Load 155(d) Store 284(param) 285 286: 2 FunctionCall 64(foo2(i1;d1;) 283(param) 284(param) 287: 15(int) Load 167(u) @@ -1435,7 +1435,7 @@ gl_FragCoord origin is upper left 309: 2 FunctionCall 44(foo2(i1;b1;) 305(param) 307(param) 311: 22(int) Load 173(i) Store 310(param) 311 - 313: 6(float) Load 155(d) + 313:6(float64_t) Load 155(d) Store 312(param) 313 314: 2 FunctionCall 64(foo2(i1;d1;) 310(param) 312(param) 316: 22(int) Load 173(i) @@ -1456,7 +1456,7 @@ gl_FragCoord origin is upper left 331: 8(bool) Load 156(b) Store 330(param) 331 332: 2 FunctionCall 68(foo3(b1;) 330(param) - 333: 6(float) Load 155(d) + 333:6(float64_t) Load 155(d) 335: 8(bool) FOrdNotEqual 333 334 Store 336(param) 335 337: 2 FunctionCall 68(foo3(b1;) 336(param) @@ -1476,7 +1476,7 @@ gl_FragCoord origin is upper left 354: 15(int) Select 352 353 339 Store 355(param) 354 356: 2 FunctionCall 72(foo4(u1;) 355(param) - 357: 6(float) Load 155(d) + 357:6(float64_t) Load 155(d) 358: 15(int) ConvertFToU 357 Store 359(param) 358 360: 2 FunctionCall 72(foo4(u1;) 359(param) @@ -1495,7 +1495,7 @@ gl_FragCoord origin is upper left 375: 22(int) Select 372 374 373 Store 376(param) 375 377: 2 FunctionCall 76(foo5(i1;) 376(param) - 378: 6(float) Load 155(d) + 378:6(float64_t) Load 155(d) 379: 22(int) ConvertFToS 378 Store 380(param) 379 381: 2 FunctionCall 76(foo5(i1;) 380(param) @@ -1514,7 +1514,7 @@ gl_FragCoord origin is upper left 395: 29(float) Select 393 394 348 Store 396(param) 395 397: 2 FunctionCall 80(foo6(f1;) 396(param) - 398: 6(float) Load 155(d) + 398:6(float64_t) Load 155(d) 399: 29(float) FConvert 398 Store 400(param) 399 401: 2 FunctionCall 80(foo6(f1;) 400(param) @@ -1530,22 +1530,22 @@ gl_FragCoord origin is upper left Store 410(param) 411 412: 2 FunctionCall 80(foo6(f1;) 410(param) 413: 8(bool) Load 156(b) - 415: 6(float) Select 413 414 334 + 415:6(float64_t) Select 413 414 334 Store 416(param) 415 417: 2 FunctionCall 84(foo7(d1;) 416(param) - 419: 6(float) Load 155(d) + 419:6(float64_t) Load 155(d) Store 418(param) 419 420: 2 FunctionCall 84(foo7(d1;) 418(param) 421: 15(int) Load 167(u) - 422: 6(float) ConvertUToF 421 + 422:6(float64_t) ConvertUToF 421 Store 423(param) 422 424: 2 FunctionCall 84(foo7(d1;) 423(param) 425: 22(int) Load 173(i) - 426: 6(float) ConvertSToF 425 + 426:6(float64_t) ConvertSToF 425 Store 427(param) 426 428: 2 FunctionCall 84(foo7(d1;) 427(param) 429: 29(float) Load 179(f) - 430: 6(float) FConvert 429 + 430:6(float64_t) FConvert 429 Store 431(param) 430 432: 2 FunctionCall 84(foo7(d1;) 431(param) 433: 8(bool) Load 156(b) @@ -1568,7 +1568,7 @@ gl_FragCoord origin is upper left 450: 15(int) ConvertFToU 449 Store 451(param) 450 452: 2 FunctionCall 96(foo9(u1;) 451(param) - 453: 6(float) Load 155(d) + 453:6(float64_t) Load 155(d) 454: 15(int) ConvertFToU 453 Store 455(param) 454 456: 2 FunctionCall 96(foo9(u1;) 455(param) @@ -1580,7 +1580,7 @@ gl_FragCoord origin is upper left 462: 22(int) ConvertFToS 461 Store 463(param) 462 464: 2 FunctionCall 102(foo10(i1;) 463(param) - 465: 6(float) Load 155(d) + 465:6(float64_t) Load 155(d) 466: 22(int) ConvertFToS 465 Store 467(param) 466 468: 2 FunctionCall 102(foo10(i1;) 467(param) @@ -1589,12 +1589,12 @@ gl_FragCoord origin is upper left Store 471(param) 470 472: 2 FunctionCall 120(foo11(u1;) 471(param) 473: 29(float) Load 179(f) - 474: 6(float) FConvert 473 + 474:6(float64_t) FConvert 473 Store 475(param) 474 476: 2 FunctionCall 111(foo11(d1;) 475(param) 477: 29(float) Load 179(f) 478: 104(fvec3) CompositeConstruct 477 477 477 - 479: 125(fvec3) FConvert 478 + 479:125(f64vec3) FConvert 478 Store 480(param) 479 481: 2 FunctionCall 129(foo12(vd3;) 480(param) 482: 22(int) Load 173(i) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.params.default.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.params.default.frag.out index ae67f1ef5d7..c98e0c64cdf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.params.default.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.params.default.frag.out @@ -376,7 +376,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 178 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenLocal.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenLocal.vert.out index 7847c088c54..95241189f7b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenLocal.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenLocal.vert.out @@ -7,11 +7,17 @@ Shader version: 500 0:12 'pos' ( in 4-component vector of float) 0:? Sequence 0:14 move second child to first child ( temp texture2D) -0:? 'packed.tex' ( temp texture2D) +0:14 tex: direct index for structure ( temp texture2D) +0:14 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:14 Constant: +0:14 0 (const int) 0:14 'tex' ( uniform texture2D) 0:15 move second child to first child ( temp 3-component vector of float) 0:15 direct index ( temp 3-component vector of float) -0:? 'packed.pos' ( temp 3-element array of 3-component vector of float) +0:15 pos: direct index for structure ( temp 3-element array of 3-component vector of float) +0:15 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:15 Constant: +0:15 1 (const int) 0:15 Constant: 0:15 0 (const int) 0:? Constant: @@ -20,18 +26,27 @@ Shader version: 500 0:? 0.000000 0:16 move second child to first child ( temp 2-component vector of float) 0:16 direct index ( temp 2-component vector of float) -0:? 'packed.uv' ( temp 2-element array of 2-component vector of float) +0:16 uv: direct index for structure ( temp 2-element array of 2-component vector of float) +0:16 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:16 Constant: +0:16 2 (const int) 0:16 Constant: 0:16 0 (const int) 0:? Constant: 0:? 0.000000 0:? 1.000000 0:17 move second child to first child ( temp float) -0:? 'packed.x' ( temp float) +0:17 x: direct index for structure ( temp float) +0:17 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:17 Constant: +0:17 3 (const int) 0:17 Constant: 0:17 1.000000 0:18 move second child to first child ( temp int) -0:? 'packed.n' ( temp int) +0:18 n: direct index for structure ( temp int) +0:18 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:18 Constant: +0:18 4 (const int) 0:18 Constant: 0:18 3 (const int) 0:20 Sequence @@ -50,7 +65,10 @@ Shader version: 500 0:21 add second child into first child ( temp 2-component vector of float) 0:21 vector swizzle ( temp 2-component vector of float) 0:21 indirect index ( temp 3-component vector of float) -0:? 'packed.pos' ( temp 3-element array of 3-component vector of float) +0:21 pos: direct index for structure ( temp 3-element array of 3-component vector of float) +0:21 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:21 Constant: +0:21 1 (const int) 0:21 'i' ( temp int) 0:21 Sequence 0:21 Constant: @@ -58,34 +76,27 @@ Shader version: 500 0:21 Constant: 0:21 1 (const int) 0:21 indirect index ( temp 2-component vector of float) -0:? 'packed.uv' ( temp 2-element array of 2-component vector of float) +0:21 uv: direct index for structure ( temp 2-element array of 2-component vector of float) +0:21 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:21 Constant: +0:21 2 (const int) 0:21 'i' ( temp int) 0:20 Loop Terminal Expression 0:20 Pre-Increment ( temp int) 0:20 'i' ( temp int) 0:24 Sequence -0:24 Sequence -0:24 move second child to first child ( temp texture2D) -0:? 'packed2.tex' ( temp texture2D) -0:? 'packed.tex' ( temp texture2D) -0:24 move second child to first child ( temp 3-element array of 3-component vector of float) -0:? 'packed2.pos' ( temp 3-element array of 3-component vector of float) -0:? 'packed.pos' ( temp 3-element array of 3-component vector of float) -0:24 move second child to first child ( temp 2-element array of 2-component vector of float) -0:? 'packed2.uv' ( temp 2-element array of 2-component vector of float) -0:? 'packed.uv' ( temp 2-element array of 2-component vector of float) -0:24 move second child to first child ( temp float) -0:? 'packed2.x' ( temp float) -0:? 'packed.x' ( temp float) -0:24 move second child to first child ( temp int) -0:? 'packed2.n' ( temp int) -0:? 'packed.n' ( temp int) +0:24 move second child to first child ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:24 'packed2' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:24 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) 0:26 Branch: Return with expression 0:26 add ( temp 4-component vector of float) 0:26 'pos' ( in 4-component vector of float) 0:? Construct vec4 ( temp 4-component vector of float) 0:26 direct index ( temp 3-component vector of float) -0:? 'packed2.pos' ( temp 3-element array of 3-component vector of float) +0:26 pos: direct index for structure ( temp 3-element array of 3-component vector of float) +0:26 'packed2' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:26 Constant: +0:26 1 (const int) 0:26 Constant: 0:26 0 (const int) 0:26 Constant: @@ -116,11 +127,17 @@ Shader version: 500 0:12 'pos' ( in 4-component vector of float) 0:? Sequence 0:14 move second child to first child ( temp texture2D) -0:? 'packed.tex' ( temp texture2D) +0:14 tex: direct index for structure ( temp texture2D) +0:14 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:14 Constant: +0:14 0 (const int) 0:14 'tex' ( uniform texture2D) 0:15 move second child to first child ( temp 3-component vector of float) 0:15 direct index ( temp 3-component vector of float) -0:? 'packed.pos' ( temp 3-element array of 3-component vector of float) +0:15 pos: direct index for structure ( temp 3-element array of 3-component vector of float) +0:15 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:15 Constant: +0:15 1 (const int) 0:15 Constant: 0:15 0 (const int) 0:? Constant: @@ -129,18 +146,27 @@ Shader version: 500 0:? 0.000000 0:16 move second child to first child ( temp 2-component vector of float) 0:16 direct index ( temp 2-component vector of float) -0:? 'packed.uv' ( temp 2-element array of 2-component vector of float) +0:16 uv: direct index for structure ( temp 2-element array of 2-component vector of float) +0:16 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:16 Constant: +0:16 2 (const int) 0:16 Constant: 0:16 0 (const int) 0:? Constant: 0:? 0.000000 0:? 1.000000 0:17 move second child to first child ( temp float) -0:? 'packed.x' ( temp float) +0:17 x: direct index for structure ( temp float) +0:17 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:17 Constant: +0:17 3 (const int) 0:17 Constant: 0:17 1.000000 0:18 move second child to first child ( temp int) -0:? 'packed.n' ( temp int) +0:18 n: direct index for structure ( temp int) +0:18 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:18 Constant: +0:18 4 (const int) 0:18 Constant: 0:18 3 (const int) 0:20 Sequence @@ -159,7 +185,10 @@ Shader version: 500 0:21 add second child into first child ( temp 2-component vector of float) 0:21 vector swizzle ( temp 2-component vector of float) 0:21 indirect index ( temp 3-component vector of float) -0:? 'packed.pos' ( temp 3-element array of 3-component vector of float) +0:21 pos: direct index for structure ( temp 3-element array of 3-component vector of float) +0:21 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:21 Constant: +0:21 1 (const int) 0:21 'i' ( temp int) 0:21 Sequence 0:21 Constant: @@ -167,34 +196,27 @@ Shader version: 500 0:21 Constant: 0:21 1 (const int) 0:21 indirect index ( temp 2-component vector of float) -0:? 'packed.uv' ( temp 2-element array of 2-component vector of float) +0:21 uv: direct index for structure ( temp 2-element array of 2-component vector of float) +0:21 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:21 Constant: +0:21 2 (const int) 0:21 'i' ( temp int) 0:20 Loop Terminal Expression 0:20 Pre-Increment ( temp int) 0:20 'i' ( temp int) 0:24 Sequence -0:24 Sequence -0:24 move second child to first child ( temp texture2D) -0:? 'packed2.tex' ( temp texture2D) -0:? 'packed.tex' ( temp texture2D) -0:24 move second child to first child ( temp 3-element array of 3-component vector of float) -0:? 'packed2.pos' ( temp 3-element array of 3-component vector of float) -0:? 'packed.pos' ( temp 3-element array of 3-component vector of float) -0:24 move second child to first child ( temp 2-element array of 2-component vector of float) -0:? 'packed2.uv' ( temp 2-element array of 2-component vector of float) -0:? 'packed.uv' ( temp 2-element array of 2-component vector of float) -0:24 move second child to first child ( temp float) -0:? 'packed2.x' ( temp float) -0:? 'packed.x' ( temp float) -0:24 move second child to first child ( temp int) -0:? 'packed2.n' ( temp int) -0:? 'packed.n' ( temp int) +0:24 move second child to first child ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:24 'packed2' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:24 'packed' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) 0:26 Branch: Return with expression 0:26 add ( temp 4-component vector of float) 0:26 'pos' ( in 4-component vector of float) 0:? Construct vec4 ( temp 4-component vector of float) 0:26 direct index ( temp 3-component vector of float) -0:? 'packed2.pos' ( temp 3-element array of 3-component vector of float) +0:26 pos: direct index for structure ( temp 3-element array of 3-component vector of float) +0:26 'packed2' ( temp structure{ temp texture2D tex, temp 3-element array of 3-component vector of float pos, temp 2-element array of 2-component vector of float uv, temp float x, temp int n}) +0:26 Constant: +0:26 1 (const int) 0:26 Constant: 0:26 0 (const int) 0:26 Constant: @@ -215,36 +237,34 @@ Shader version: 500 0:? 'pos' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 97 +// Generated by (magic number): 80007 +// Id's are bound by 90 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 90 93 + EntryPoint Vertex 4 "main" 83 86 Source HLSL 500 Name 4 "main" Name 11 "@main(vf4;" Name 10 "pos" - Name 15 "packed.tex" - Name 17 "tex" - Name 24 "packed.pos" - Name 35 "packed.uv" - Name 41 "packed.x" - Name 43 "packed.n" - Name 45 "i" - Name 68 "packed2.tex" - Name 70 "packed2.pos" - Name 72 "packed2.uv" - Name 74 "packed2.x" - Name 76 "packed2.n" - Name 88 "pos" - Name 90 "pos" - Name 93 "@entryPointOutput" - Name 94 "param" - Decorate 17(tex) DescriptorSet 0 - Decorate 90(pos) Location 0 - Decorate 93(@entryPointOutput) BuiltIn Position + Name 22 "Packed" + MemberName 22(Packed) 0 "tex" + MemberName 22(Packed) 1 "pos" + MemberName 22(Packed) 2 "uv" + MemberName 22(Packed) 3 "x" + MemberName 22(Packed) 4 "n" + Name 24 "packed" + Name 27 "tex" + Name 47 "i" + Name 69 "packed2" + Name 81 "pos" + Name 83 "pos" + Name 86 "@entryPointOutput" + Name 87 "param" + Decorate 27(tex) DescriptorSet 0 + Decorate 83(pos) Location 0 + Decorate 86(@entryPointOutput) BuiltIn Position 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -252,115 +272,104 @@ Shader version: 500 8: TypePointer Function 7(fvec4) 9: TypeFunction 7(fvec4) 8(ptr) 13: TypeImage 6(float) 2D sampled format:Unknown - 14: TypePointer Function 13 - 16: TypePointer UniformConstant 13 - 17(tex): 16(ptr) Variable UniformConstant - 19: TypeVector 6(float) 3 - 20: TypeInt 32 0 - 21: 20(int) Constant 3 - 22: TypeArray 19(fvec3) 21 - 23: TypePointer Function 22 - 25: TypeInt 32 1 - 26: 25(int) Constant 0 - 27: 6(float) Constant 0 - 28: 19(fvec3) ConstantComposite 27 27 27 - 29: TypePointer Function 19(fvec3) - 31: TypeVector 6(float) 2 - 32: 20(int) Constant 2 - 33: TypeArray 31(fvec2) 32 - 34: TypePointer Function 33 - 36: 6(float) Constant 1065353216 - 37: 31(fvec2) ConstantComposite 27 36 - 38: TypePointer Function 31(fvec2) - 40: TypePointer Function 6(float) - 42: TypePointer Function 25(int) - 44: 25(int) Constant 3 - 52: 25(int) Constant 1 - 53: TypeBool - 89: TypePointer Input 7(fvec4) - 90(pos): 89(ptr) Variable Input - 92: TypePointer Output 7(fvec4) -93(@entryPointOutput): 92(ptr) Variable Output + 14: TypeVector 6(float) 3 + 15: TypeInt 32 0 + 16: 15(int) Constant 3 + 17: TypeArray 14(fvec3) 16 + 18: TypeVector 6(float) 2 + 19: 15(int) Constant 2 + 20: TypeArray 18(fvec2) 19 + 21: TypeInt 32 1 + 22(Packed): TypeStruct 13 17 20 6(float) 21(int) + 23: TypePointer Function 22(Packed) + 25: 21(int) Constant 0 + 26: TypePointer UniformConstant 13 + 27(tex): 26(ptr) Variable UniformConstant + 29: TypePointer Function 13 + 31: 21(int) Constant 1 + 32: 6(float) Constant 0 + 33: 14(fvec3) ConstantComposite 32 32 32 + 34: TypePointer Function 14(fvec3) + 36: 21(int) Constant 2 + 37: 6(float) Constant 1065353216 + 38: 18(fvec2) ConstantComposite 32 37 + 39: TypePointer Function 18(fvec2) + 41: 21(int) Constant 3 + 42: TypePointer Function 6(float) + 44: 21(int) Constant 4 + 45: TypePointer Function 21(int) + 54: TypeBool + 82: TypePointer Input 7(fvec4) + 83(pos): 82(ptr) Variable Input + 85: TypePointer Output 7(fvec4) +86(@entryPointOutput): 85(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 88(pos): 8(ptr) Variable Function - 94(param): 8(ptr) Variable Function - 91: 7(fvec4) Load 90(pos) - Store 88(pos) 91 - 95: 7(fvec4) Load 88(pos) - Store 94(param) 95 - 96: 7(fvec4) FunctionCall 11(@main(vf4;) 94(param) - Store 93(@entryPointOutput) 96 + 81(pos): 8(ptr) Variable Function + 87(param): 8(ptr) Variable Function + 84: 7(fvec4) Load 83(pos) + Store 81(pos) 84 + 88: 7(fvec4) Load 81(pos) + Store 87(param) 88 + 89: 7(fvec4) FunctionCall 11(@main(vf4;) 87(param) + Store 86(@entryPointOutput) 89 Return FunctionEnd 11(@main(vf4;): 7(fvec4) Function None 9 10(pos): 8(ptr) FunctionParameter 12: Label - 15(packed.tex): 14(ptr) Variable Function - 24(packed.pos): 23(ptr) Variable Function - 35(packed.uv): 34(ptr) Variable Function - 41(packed.x): 40(ptr) Variable Function - 43(packed.n): 42(ptr) Variable Function - 45(i): 42(ptr) Variable Function - 68(packed2.tex): 14(ptr) Variable Function - 70(packed2.pos): 23(ptr) Variable Function - 72(packed2.uv): 34(ptr) Variable Function - 74(packed2.x): 40(ptr) Variable Function - 76(packed2.n): 42(ptr) Variable Function - 18: 13 Load 17(tex) - Store 15(packed.tex) 18 - 30: 29(ptr) AccessChain 24(packed.pos) 26 + 24(packed): 23(ptr) Variable Function + 47(i): 45(ptr) Variable Function + 69(packed2): 23(ptr) Variable Function + 28: 13 Load 27(tex) + 30: 29(ptr) AccessChain 24(packed) 25 Store 30 28 - 39: 38(ptr) AccessChain 35(packed.uv) 26 - Store 39 37 - Store 41(packed.x) 36 - Store 43(packed.n) 44 - Store 45(i) 26 - Branch 46 - 46: Label - LoopMerge 48 49 None - Branch 50 - 50: Label - 51: 25(int) Load 45(i) - 54: 53(bool) SLessThan 51 52 - BranchConditional 54 47 48 - 47: Label - 55: 25(int) Load 45(i) - 56: 25(int) Load 45(i) - 57: 38(ptr) AccessChain 35(packed.uv) 56 - 58: 31(fvec2) Load 57 - 59: 29(ptr) AccessChain 24(packed.pos) 55 - 60: 19(fvec3) Load 59 - 61: 31(fvec2) VectorShuffle 60 60 0 1 - 62: 31(fvec2) FAdd 61 58 - 63: 29(ptr) AccessChain 24(packed.pos) 55 - 64: 19(fvec3) Load 63 - 65: 19(fvec3) VectorShuffle 64 62 3 4 2 - Store 63 65 - Branch 49 - 49: Label - 66: 25(int) Load 45(i) - 67: 25(int) IAdd 66 52 - Store 45(i) 67 - Branch 46 + 35: 34(ptr) AccessChain 24(packed) 31 25 + Store 35 33 + 40: 39(ptr) AccessChain 24(packed) 36 25 + Store 40 38 + 43: 42(ptr) AccessChain 24(packed) 41 + Store 43 37 + 46: 45(ptr) AccessChain 24(packed) 44 + Store 46 41 + Store 47(i) 25 + Branch 48 48: Label - 69: 13 Load 15(packed.tex) - Store 68(packed2.tex) 69 - 71: 22 Load 24(packed.pos) - Store 70(packed2.pos) 71 - 73: 33 Load 35(packed.uv) - Store 72(packed2.uv) 73 - 75: 6(float) Load 41(packed.x) - Store 74(packed2.x) 75 - 77: 25(int) Load 43(packed.n) - Store 76(packed2.n) 77 - 78: 7(fvec4) Load 10(pos) - 79: 29(ptr) AccessChain 70(packed2.pos) 26 - 80: 19(fvec3) Load 79 - 81: 6(float) CompositeExtract 80 0 - 82: 6(float) CompositeExtract 80 1 - 83: 6(float) CompositeExtract 80 2 - 84: 7(fvec4) CompositeConstruct 81 82 83 27 - 85: 7(fvec4) FAdd 78 84 - ReturnValue 85 + LoopMerge 50 51 None + Branch 52 + 52: Label + 53: 21(int) Load 47(i) + 55: 54(bool) SLessThan 53 31 + BranchConditional 55 49 50 + 49: Label + 56: 21(int) Load 47(i) + 57: 21(int) Load 47(i) + 58: 39(ptr) AccessChain 24(packed) 36 57 + 59: 18(fvec2) Load 58 + 60: 34(ptr) AccessChain 24(packed) 31 56 + 61: 14(fvec3) Load 60 + 62: 18(fvec2) VectorShuffle 61 61 0 1 + 63: 18(fvec2) FAdd 62 59 + 64: 34(ptr) AccessChain 24(packed) 31 56 + 65: 14(fvec3) Load 64 + 66: 14(fvec3) VectorShuffle 65 63 3 4 2 + Store 64 66 + Branch 51 + 51: Label + 67: 21(int) Load 47(i) + 68: 21(int) IAdd 67 31 + Store 47(i) 68 + Branch 48 + 50: Label + 70: 22(Packed) Load 24(packed) + Store 69(packed2) 70 + 71: 7(fvec4) Load 10(pos) + 72: 34(ptr) AccessChain 69(packed2) 31 25 + 73: 14(fvec3) Load 72 + 74: 6(float) CompositeExtract 73 0 + 75: 6(float) CompositeExtract 73 1 + 76: 6(float) CompositeExtract 73 2 + 77: 7(fvec4) CompositeConstruct 74 75 76 32 + 78: 7(fvec4) FAdd 71 77 + ReturnValue 78 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenMixed.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenMixed.vert.out index 50c8cb9bd0c..51e4c934a04 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenMixed.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialFlattenMixed.vert.out @@ -9,13 +9,19 @@ Shader version: 500 0:13 Sequence 0:13 move second child to first child ( temp texture2D) 0:13 direct index ( temp texture2D) -0:? 'packed.membTex' ( temp 2-element array of texture2D) +0:13 membTex: direct index for structure ( temp 2-element array of texture2D) +0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b}) +0:13 Constant: +0:13 1 (const int) 0:13 Constant: 0:13 0 (const int) 0:? 'tex[0]' ( uniform texture2D) 0:13 move second child to first child ( temp texture2D) 0:13 direct index ( temp texture2D) -0:? 'packed.membTex' ( temp 2-element array of texture2D) +0:13 membTex: direct index for structure ( temp 2-element array of texture2D) +0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b}) +0:13 Constant: +0:13 1 (const int) 0:13 Constant: 0:13 1 (const int) 0:? 'tex[1]' ( uniform texture2D) @@ -50,13 +56,19 @@ Shader version: 500 0:13 Sequence 0:13 move second child to first child ( temp texture2D) 0:13 direct index ( temp texture2D) -0:? 'packed.membTex' ( temp 2-element array of texture2D) +0:13 membTex: direct index for structure ( temp 2-element array of texture2D) +0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b}) +0:13 Constant: +0:13 1 (const int) 0:13 Constant: 0:13 0 (const int) 0:? 'tex[0]' ( uniform texture2D) 0:13 move second child to first child ( temp texture2D) 0:13 direct index ( temp texture2D) -0:? 'packed.membTex' ( temp 2-element array of texture2D) +0:13 membTex: direct index for structure ( temp 2-element array of texture2D) +0:13 'packed' ( temp structure{ temp int a, temp 2-element array of texture2D membTex, temp int b}) +0:13 Constant: +0:13 1 (const int) 0:13 Constant: 0:13 1 (const int) 0:? 'tex[1]' ( uniform texture2D) @@ -79,72 +91,77 @@ Shader version: 500 0:? 'pos' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 42 +// Generated by (magic number): 80007 +// Id's are bound by 43 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 35 38 + EntryPoint Vertex 4 "main" 36 39 Source HLSL 500 Name 4 "main" Name 11 "@main(vf4;" Name 10 "pos" - Name 18 "packed.membTex" - Name 22 "tex[0]" - Name 27 "tex[1]" - Name 33 "pos" - Name 35 "pos" - Name 38 "@entryPointOutput" - Name 39 "param" - Decorate 22(tex[0]) DescriptorSet 0 - Decorate 27(tex[1]) DescriptorSet 0 - Decorate 35(pos) Location 0 - Decorate 38(@entryPointOutput) BuiltIn Position + Name 18 "Packed" + MemberName 18(Packed) 0 "a" + MemberName 18(Packed) 1 "membTex" + MemberName 18(Packed) 2 "b" + Name 20 "packed" + Name 24 "tex[0]" + Name 28 "tex[1]" + Name 34 "pos" + Name 36 "pos" + Name 39 "@entryPointOutput" + Name 40 "param" + Decorate 24(tex[0]) DescriptorSet 0 + Decorate 28(tex[1]) DescriptorSet 0 + Decorate 36(pos) Location 0 + Decorate 39(@entryPointOutput) BuiltIn Position 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypePointer Function 7(fvec4) 9: TypeFunction 7(fvec4) 8(ptr) - 13: TypeImage 6(float) 2D sampled format:Unknown - 14: TypeInt 32 0 - 15: 14(int) Constant 2 - 16: TypeArray 13 15 - 17: TypePointer Function 16 - 19: TypeInt 32 1 - 20: 19(int) Constant 0 - 21: TypePointer UniformConstant 13 - 22(tex[0]): 21(ptr) Variable UniformConstant - 24: TypePointer Function 13 - 26: 19(int) Constant 1 - 27(tex[1]): 21(ptr) Variable UniformConstant - 34: TypePointer Input 7(fvec4) - 35(pos): 34(ptr) Variable Input - 37: TypePointer Output 7(fvec4) -38(@entryPointOutput): 37(ptr) Variable Output + 13: TypeInt 32 1 + 14: TypeImage 6(float) 2D sampled format:Unknown + 15: TypeInt 32 0 + 16: 15(int) Constant 2 + 17: TypeArray 14 16 + 18(Packed): TypeStruct 13(int) 17 13(int) + 19: TypePointer Function 18(Packed) + 21: 13(int) Constant 1 + 22: 13(int) Constant 0 + 23: TypePointer UniformConstant 14 + 24(tex[0]): 23(ptr) Variable UniformConstant + 26: TypePointer Function 14 + 28(tex[1]): 23(ptr) Variable UniformConstant + 35: TypePointer Input 7(fvec4) + 36(pos): 35(ptr) Variable Input + 38: TypePointer Output 7(fvec4) +39(@entryPointOutput): 38(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 33(pos): 8(ptr) Variable Function - 39(param): 8(ptr) Variable Function - 36: 7(fvec4) Load 35(pos) - Store 33(pos) 36 - 40: 7(fvec4) Load 33(pos) - Store 39(param) 40 - 41: 7(fvec4) FunctionCall 11(@main(vf4;) 39(param) - Store 38(@entryPointOutput) 41 + 34(pos): 8(ptr) Variable Function + 40(param): 8(ptr) Variable Function + 37: 7(fvec4) Load 36(pos) + Store 34(pos) 37 + 41: 7(fvec4) Load 34(pos) + Store 40(param) 41 + 42: 7(fvec4) FunctionCall 11(@main(vf4;) 40(param) + Store 39(@entryPointOutput) 42 Return FunctionEnd 11(@main(vf4;): 7(fvec4) Function None 9 10(pos): 8(ptr) FunctionParameter 12: Label -18(packed.membTex): 17(ptr) Variable Function - 23: 13 Load 22(tex[0]) - 25: 24(ptr) AccessChain 18(packed.membTex) 20 - Store 25 23 - 28: 13 Load 27(tex[1]) - 29: 24(ptr) AccessChain 18(packed.membTex) 26 - Store 29 28 - 30: 7(fvec4) Load 10(pos) - ReturnValue 30 + 20(packed): 19(ptr) Variable Function + 25: 14 Load 24(tex[0]) + 27: 26(ptr) AccessChain 20(packed) 21 22 + Store 27 25 + 29: 14 Load 28(tex[1]) + 30: 26(ptr) AccessChain 20(packed) 21 21 + Store 30 29 + 31: 7(fvec4) Load 10(pos) + ReturnValue 31 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialInit.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialInit.frag.out index c0882fdb28a..2cdbb0fff6a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialInit.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.partialInit.frag.out @@ -398,8 +398,12 @@ gl_FragCoord origin is upper left 0:? 'ci' ( const int) 0:? 0 (const int) +error: SPIRV-Tools Validation Errors +error: If OpTypeBool is stored in conjunction with OpVariable, it can only be used with non-externally visible shader Storage Classes: Workgroup, CrossWorkgroup, Private, and Function + %_entryPointOutput_c = OpVariable %_ptr_Output_bool Output + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 104 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.expand.frag.err b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.expand.frag.err new file mode 100644 index 00000000000..e69de29bb2d diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.expand.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.expand.frag.out new file mode 100644 index 00000000000..adfe02c12ea --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.expand.frag.out @@ -0,0 +1,19 @@ + + + + + + +struct A +{ + float4 a; + float4 b; + float4 c = { 1, 2, 3, 4 }; + float4 d = {({ {(({ 1, 2, 3, 4 }))} })}, { { 1, 2, 3, 4 } }; +}; + +void main() +{ + "a string" +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.line.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.line.frag.out index 864df8768b9..2c06fe91f87 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.line.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.line.frag.out @@ -1,6 +1,7 @@ hlsl.pp.line.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:4 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:4 Function Parameters: @@ -62,6 +63,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:4 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:4 Function Parameters: @@ -118,7 +120,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 42 Capability Shader @@ -126,6 +128,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 35 39 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.vert.out index 42821848a39..817b6471075 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.pp.vert.out @@ -26,7 +26,7 @@ Shader version: 500 0:? 'anon@0' (layout( row_major std140) uniform block{ uniform int goodGlobal1, uniform int goodGlobal2}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 13 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence.frag.out index 0c898cc0005..f4c53389d79 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence.frag.out @@ -148,7 +148,7 @@ gl_FragCoord origin is upper left 0:? 'a4' (layout( location=3) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 65 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence2.frag.out index 343240fc4cb..9ce674d6b94 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precedence2.frag.out @@ -114,7 +114,7 @@ gl_FragCoord origin is upper left 0:? 'a4' (layout( location=3) flat in int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 56 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precise.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precise.frag.out index 66da1d653a0..dd450690a0a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precise.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.precise.frag.out @@ -76,7 +76,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) noContraction out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 37 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.preprocessor.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.preprocessor.frag.out index cbcd66fe646..c78de3dd06b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.preprocessor.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.preprocessor.frag.out @@ -94,7 +94,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 40 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.atomic.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.atomic.frag.out index 2d4bd6eaa49..ecc188b1c3b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.atomic.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.atomic.frag.out @@ -64,7 +64,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 36 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.binary.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.binary.frag.out index bc91ad9d116..e1931af1ac4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.binary.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.binary.frag.out @@ -172,7 +172,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 83 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.vec1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.vec1.frag.out index ac0e44ef348..b92d7409048 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.vec1.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promote.vec1.frag.out @@ -80,7 +80,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promotions.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promotions.frag.out index 5383959ab18..9c08948421d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promotions.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.promotions.frag.out @@ -1582,7 +1582,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 596 Capability Shader @@ -1715,18 +1715,18 @@ gl_FragCoord origin is upper left 29: TypePointer Function 28(bvec3) 30: TypeFunction 2 29(ptr) 34: TypeFloat 64 - 35: TypeVector 34(float) 3 - 36: TypePointer Function 35(fvec3) + 35: TypeVector 34(float64_t) 3 + 36: TypePointer Function 35(f64vec3) 37: TypeFunction 2 36(ptr) 41: TypeFunction 7(fvec3) 8(ptr) 54: TypeFunction 14(ivec3) 15(ptr) 67: TypeFunction 21(ivec3) 22(ptr) 80: TypeFunction 28(bvec3) 29(ptr) - 93: TypeFunction 35(fvec3) 36(ptr) + 93: TypeFunction 35(f64vec3) 36(ptr) 106: TypeVector 6(float) 4 107(PS_OUTPUT): TypeStruct 106(fvec4) 108: TypeFunction 107(PS_OUTPUT) - 111($Global): TypeStruct 14(ivec3) 21(ivec3) 7(fvec3) 21(ivec3) 35(fvec3) 13(int) 20(int) 6(float) 20(int) 34(float) + 111($Global): TypeStruct 14(ivec3) 21(ivec3) 7(fvec3) 21(ivec3) 35(f64vec3) 13(int) 20(int) 6(float) 20(int) 34(float64_t) 112: TypePointer Uniform 111($Global) 113: 112(ptr) Variable Uniform 114: 13(int) Constant 0 @@ -1741,24 +1741,24 @@ gl_FragCoord origin is upper left 142: 7(fvec3) ConstantComposite 140 140 140 143: 7(fvec3) ConstantComposite 141 141 141 151: 13(int) Constant 4 - 152: TypePointer Uniform 35(fvec3) + 152: TypePointer Uniform 35(f64vec3) 172: 14(ivec3) ConstantComposite 114 114 114 173: 14(ivec3) ConstantComposite 134 134 134 181: 13(int) Constant 2 182: TypePointer Uniform 7(fvec3) 218: 20(int) Constant 1 219: 21(ivec3) ConstantComposite 218 218 218 - 261: 34(float) Constant 0 0 - 262: 35(fvec3) ConstantComposite 261 261 261 - 288: 34(float) Constant 0 1072693248 - 289: 35(fvec3) ConstantComposite 288 288 288 + 261:34(float64_t) Constant 0 0 + 262: 35(f64vec3) ConstantComposite 261 261 261 + 288:34(float64_t) Constant 0 1072693248 + 289: 35(f64vec3) ConstantComposite 288 288 288 473: 13(int) Constant 5 474: TypePointer Uniform 13(int) 480: 13(int) Constant 6 481: TypePointer Uniform 20(int) 488: 13(int) Constant 8 494: 13(int) Constant 9 - 495: TypePointer Uniform 34(float) + 495: TypePointer Uniform 34(float64_t) 514: 13(int) Constant 7 515: TypePointer Uniform 6(float) 574: TypePointer Function 13(int) @@ -1841,11 +1841,11 @@ gl_FragCoord origin is upper left 51(p): 8(ptr) FunctionParameter 53: Label 153: 152(ptr) AccessChain 113 151 - 154: 35(fvec3) Load 153 + 154: 35(f64vec3) Load 153 155: 7(fvec3) FConvert 154 Store 51(p) 155 156: 152(ptr) AccessChain 113 151 - 157: 35(fvec3) Load 156 + 157: 35(f64vec3) Load 156 158: 7(fvec3) FConvert 157 ReturnValue 158 FunctionEnd @@ -1891,11 +1891,11 @@ gl_FragCoord origin is upper left 64(p): 15(ptr) FunctionParameter 66: Label 191: 152(ptr) AccessChain 113 151 - 192: 35(fvec3) Load 191 + 192: 35(f64vec3) Load 191 193: 14(ivec3) ConvertFToS 192 Store 64(p) 193 194: 152(ptr) AccessChain 113 151 - 195: 35(fvec3) Load 194 + 195: 35(f64vec3) Load 194 196: 14(ivec3) ConvertFToS 195 ReturnValue 196 FunctionEnd @@ -1941,11 +1941,11 @@ gl_FragCoord origin is upper left 77(p): 22(ptr) FunctionParameter 79: Label 227: 152(ptr) AccessChain 113 151 - 228: 35(fvec3) Load 227 + 228: 35(f64vec3) Load 227 229: 21(ivec3) ConvertFToU 228 Store 77(p) 229 230: 152(ptr) AccessChain 113 151 - 231: 35(fvec3) Load 230 + 231: 35(f64vec3) Load 230 232: 21(ivec3) ConvertFToU 231 ReturnValue 232 FunctionEnd @@ -1989,62 +1989,62 @@ gl_FragCoord origin is upper left 90(p): 29(ptr) FunctionParameter 92: Label 259: 152(ptr) AccessChain 113 151 - 260: 35(fvec3) Load 259 + 260: 35(f64vec3) Load 259 263: 28(bvec3) FOrdNotEqual 260 262 Store 90(p) 263 264: 152(ptr) AccessChain 113 151 - 265: 35(fvec3) Load 264 + 265: 35(f64vec3) Load 264 266: 28(bvec3) FOrdNotEqual 265 262 ReturnValue 266 FunctionEnd -95(Fn_R_D3I(vd3;): 35(fvec3) Function None 93 +95(Fn_R_D3I(vd3;): 35(f64vec3) Function None 93 94(p): 36(ptr) FunctionParameter 96: Label 269: 115(ptr) AccessChain 113 114 270: 14(ivec3) Load 269 - 271: 35(fvec3) ConvertSToF 270 + 271: 35(f64vec3) ConvertSToF 270 Store 94(p) 271 272: 115(ptr) AccessChain 113 114 273: 14(ivec3) Load 272 - 274: 35(fvec3) ConvertSToF 273 + 274: 35(f64vec3) ConvertSToF 273 ReturnValue 274 FunctionEnd -98(Fn_R_D3U(vd3;): 35(fvec3) Function None 93 +98(Fn_R_D3U(vd3;): 35(f64vec3) Function None 93 97(p): 36(ptr) FunctionParameter 99: Label 277: 125(ptr) AccessChain 113 124 278: 21(ivec3) Load 277 - 279: 35(fvec3) ConvertUToF 278 + 279: 35(f64vec3) ConvertUToF 278 Store 97(p) 279 280: 125(ptr) AccessChain 113 124 281: 21(ivec3) Load 280 - 282: 35(fvec3) ConvertUToF 281 + 282: 35(f64vec3) ConvertUToF 281 ReturnValue 282 FunctionEnd -101(Fn_R_D3B(vd3;): 35(fvec3) Function None 93 +101(Fn_R_D3B(vd3;): 35(f64vec3) Function None 93 100(p): 36(ptr) FunctionParameter 102: Label 285: 125(ptr) AccessChain 113 134 286: 21(ivec3) Load 285 287: 28(bvec3) INotEqual 286 138 - 290: 35(fvec3) Select 287 289 262 + 290: 35(f64vec3) Select 287 289 262 Store 100(p) 290 291: 125(ptr) AccessChain 113 134 292: 21(ivec3) Load 291 293: 28(bvec3) INotEqual 292 138 - 294: 35(fvec3) Select 293 289 262 + 294: 35(f64vec3) Select 293 289 262 ReturnValue 294 FunctionEnd -104(Fn_R_D3F(vd3;): 35(fvec3) Function None 93 +104(Fn_R_D3F(vd3;): 35(f64vec3) Function None 93 103(p): 36(ptr) FunctionParameter 105: Label 297: 182(ptr) AccessChain 113 181 298: 7(fvec3) Load 297 - 299: 35(fvec3) FConvert 298 + 299: 35(f64vec3) FConvert 298 Store 103(p) 299 300: 182(ptr) AccessChain 113 181 301: 7(fvec3) Load 300 - 302: 35(fvec3) FConvert 301 + 302: 35(f64vec3) FConvert 301 ReturnValue 302 FunctionEnd 109(@main():107(PS_OUTPUT) Function None 108 @@ -2087,7 +2087,7 @@ gl_FragCoord origin is upper left 317: 7(fvec3) ConvertUToF 316 Store 314(r02) 317 319: 152(ptr) AccessChain 113 151 - 320: 35(fvec3) Load 319 + 320: 35(f64vec3) Load 319 321: 7(fvec3) FConvert 320 Store 318(r03) 321 323: 125(ptr) AccessChain 113 134 @@ -2104,7 +2104,7 @@ gl_FragCoord origin is upper left 334: 14(ivec3) ConvertFToS 333 Store 331(r12) 334 336: 152(ptr) AccessChain 113 151 - 337: 35(fvec3) Load 336 + 337: 35(f64vec3) Load 336 338: 14(ivec3) ConvertFToS 337 Store 335(r13) 338 340: 125(ptr) AccessChain 113 134 @@ -2121,7 +2121,7 @@ gl_FragCoord origin is upper left 351: 21(ivec3) ConvertFToU 350 Store 348(r22) 351 353: 152(ptr) AccessChain 113 151 - 354: 35(fvec3) Load 353 + 354: 35(f64vec3) Load 353 355: 21(ivec3) ConvertFToU 354 Store 352(r23) 355 357: 115(ptr) AccessChain 113 114 @@ -2137,25 +2137,25 @@ gl_FragCoord origin is upper left 367: 28(bvec3) FOrdNotEqual 366 142 Store 364(r32) 367 369: 152(ptr) AccessChain 113 151 - 370: 35(fvec3) Load 369 + 370: 35(f64vec3) Load 369 371: 28(bvec3) FOrdNotEqual 370 262 Store 368(r33) 371 373: 115(ptr) AccessChain 113 114 374: 14(ivec3) Load 373 - 375: 35(fvec3) ConvertSToF 374 + 375: 35(f64vec3) ConvertSToF 374 Store 372(r40) 375 377: 125(ptr) AccessChain 113 124 378: 21(ivec3) Load 377 - 379: 35(fvec3) ConvertUToF 378 + 379: 35(f64vec3) ConvertUToF 378 Store 376(r41) 379 381: 182(ptr) AccessChain 113 181 382: 7(fvec3) Load 381 - 383: 35(fvec3) FConvert 382 + 383: 35(f64vec3) FConvert 382 Store 380(r42) 383 385: 125(ptr) AccessChain 113 134 386: 21(ivec3) Load 385 387: 28(bvec3) INotEqual 386 138 - 388: 35(fvec3) Select 387 289 262 + 388: 35(f64vec3) Select 387 289 262 Store 384(r43) 388 389: 115(ptr) AccessChain 113 114 390: 14(ivec3) Load 389 @@ -2177,7 +2177,7 @@ gl_FragCoord origin is upper left 404: 7(fvec3) FMul 403 402 Store 314(r02) 404 405: 152(ptr) AccessChain 113 151 - 406: 35(fvec3) Load 405 + 406: 35(f64vec3) Load 405 407: 7(fvec3) FConvert 406 408: 7(fvec3) Load 318(r03) 409: 7(fvec3) FMul 408 407 @@ -2202,7 +2202,7 @@ gl_FragCoord origin is upper left 425: 14(ivec3) IMul 424 423 Store 331(r12) 425 426: 152(ptr) AccessChain 113 151 - 427: 35(fvec3) Load 426 + 427: 35(f64vec3) Load 426 428: 14(ivec3) ConvertFToS 427 429: 14(ivec3) Load 335(r13) 430: 14(ivec3) IMul 429 428 @@ -2227,35 +2227,35 @@ gl_FragCoord origin is upper left 446: 21(ivec3) IMul 445 444 Store 348(r22) 446 447: 152(ptr) AccessChain 113 151 - 448: 35(fvec3) Load 447 + 448: 35(f64vec3) Load 447 449: 21(ivec3) ConvertFToU 448 450: 21(ivec3) Load 352(r23) 451: 21(ivec3) IMul 450 449 Store 352(r23) 451 452: 115(ptr) AccessChain 113 114 453: 14(ivec3) Load 452 - 454: 35(fvec3) ConvertSToF 453 - 455: 35(fvec3) Load 372(r40) - 456: 35(fvec3) FMul 455 454 + 454: 35(f64vec3) ConvertSToF 453 + 455: 35(f64vec3) Load 372(r40) + 456: 35(f64vec3) FMul 455 454 Store 372(r40) 456 457: 125(ptr) AccessChain 113 124 458: 21(ivec3) Load 457 - 459: 35(fvec3) ConvertUToF 458 - 460: 35(fvec3) Load 376(r41) - 461: 35(fvec3) FMul 460 459 + 459: 35(f64vec3) ConvertUToF 458 + 460: 35(f64vec3) Load 376(r41) + 461: 35(f64vec3) FMul 460 459 Store 376(r41) 461 462: 182(ptr) AccessChain 113 181 463: 7(fvec3) Load 462 - 464: 35(fvec3) FConvert 463 - 465: 35(fvec3) Load 380(r42) - 466: 35(fvec3) FMul 465 464 + 464: 35(f64vec3) FConvert 463 + 465: 35(f64vec3) Load 380(r42) + 466: 35(f64vec3) FMul 465 464 Store 380(r42) 466 467: 125(ptr) AccessChain 113 134 468: 21(ivec3) Load 467 469: 28(bvec3) INotEqual 468 138 - 470: 35(fvec3) Select 469 289 262 - 471: 35(fvec3) Load 384(r43) - 472: 35(fvec3) FMul 471 470 + 470: 35(f64vec3) Select 469 289 262 + 471: 35(f64vec3) Load 384(r43) + 472: 35(f64vec3) FMul 471 470 Store 384(r43) 472 475: 474(ptr) AccessChain 113 473 476: 13(int) Load 475 @@ -2277,7 +2277,7 @@ gl_FragCoord origin is upper left 493: 7(fvec3) VectorTimesScalar 492 491 Store 314(r02) 493 496: 495(ptr) AccessChain 113 494 - 497: 34(float) Load 496 + 497:34(float64_t) Load 496 498: 6(float) FConvert 497 499: 7(fvec3) Load 318(r03) 500: 7(fvec3) VectorTimesScalar 499 498 @@ -2305,7 +2305,7 @@ gl_FragCoord origin is upper left 521: 14(ivec3) IMul 519 520 Store 331(r12) 521 522: 495(ptr) AccessChain 113 494 - 523: 34(float) Load 522 + 523:34(float64_t) Load 522 524: 13(int) ConvertFToS 523 525: 14(ivec3) Load 335(r13) 526: 14(ivec3) CompositeConstruct 524 524 524 @@ -2334,7 +2334,7 @@ gl_FragCoord origin is upper left 546: 21(ivec3) IMul 544 545 Store 348(r22) 546 547: 495(ptr) AccessChain 113 494 - 548: 34(float) Load 547 + 548:34(float64_t) Load 547 549: 20(int) ConvertFToU 548 550: 21(ivec3) Load 352(r23) 551: 21(ivec3) CompositeConstruct 549 549 549 @@ -2342,28 +2342,28 @@ gl_FragCoord origin is upper left Store 352(r23) 552 553: 474(ptr) AccessChain 113 473 554: 13(int) Load 553 - 555: 34(float) ConvertSToF 554 - 556: 35(fvec3) Load 372(r40) - 557: 35(fvec3) VectorTimesScalar 556 555 + 555:34(float64_t) ConvertSToF 554 + 556: 35(f64vec3) Load 372(r40) + 557: 35(f64vec3) VectorTimesScalar 556 555 Store 372(r40) 557 558: 481(ptr) AccessChain 113 488 559: 20(int) Load 558 - 560: 34(float) ConvertUToF 559 - 561: 35(fvec3) Load 376(r41) - 562: 35(fvec3) VectorTimesScalar 561 560 + 560:34(float64_t) ConvertUToF 559 + 561: 35(f64vec3) Load 376(r41) + 562: 35(f64vec3) VectorTimesScalar 561 560 Store 376(r41) 562 563: 515(ptr) AccessChain 113 514 564: 6(float) Load 563 - 565: 34(float) FConvert 564 - 566: 35(fvec3) Load 380(r42) - 567: 35(fvec3) VectorTimesScalar 566 565 + 565:34(float64_t) FConvert 564 + 566: 35(f64vec3) Load 380(r42) + 567: 35(f64vec3) VectorTimesScalar 566 565 Store 380(r42) 567 568: 481(ptr) AccessChain 113 480 569: 20(int) Load 568 570: 27(bool) INotEqual 569 137 - 571: 34(float) Select 570 288 261 - 572: 35(fvec3) Load 384(r43) - 573: 35(fvec3) VectorTimesScalar 572 571 + 571:34(float64_t) Select 570 288 261 + 572: 35(f64vec3) Load 384(r43) + 573: 35(f64vec3) VectorTimesScalar 572 571 Store 384(r43) 573 Store 575(c1) 124 Store 576(c2) 124 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.binding.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.binding.frag.out index dd19621c3e8..464ce0f7419 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.binding.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.binding.frag.out @@ -1,19 +1,19 @@ hlsl.reflection.binding.frag Uniform reflection: -t1: offset -1, type 8b5d, size 1, index -1, binding 15 -s1: offset -1, type 0, size 1, index -1, binding 5 -t1a: offset -1, type 8b5d, size 1, index -1, binding 16 -s1a: offset -1, type 0, size 1, index -1, binding 6 -c1_a: offset 0, type 8b52, size 1, index 0, binding -1 -c1_b: offset 16, type 1404, size 1, index 0, binding -1 -c1_c: offset 20, type 1406, size 1, index 0, binding -1 -c2_a: offset 0, type 8b52, size 1, index 1, binding -1 -c2_b: offset 16, type 1404, size 1, index 1, binding -1 -c2_c: offset 20, type 1406, size 1, index 1, binding -1 +t1: offset -1, type 8b5d, size 1, index -1, binding 15, stages 16 +s1: offset -1, type 0, size 1, index -1, binding 5, stages 16 +t1a: offset -1, type 8b5d, size 1, index -1, binding 16, stages 16 +s1a: offset -1, type 0, size 1, index -1, binding 6, stages 16 +c1_a: offset 0, type 8b52, size 1, index 0, binding -1, stages 16 +c1_b: offset 16, type 1404, size 1, index 0, binding -1, stages 16 +c1_c: offset 20, type 1406, size 1, index 0, binding -1, stages 16 +c2_a: offset 0, type 8b52, size 1, index 1, binding -1, stages 16 +c2_b: offset 16, type 1404, size 1, index 1, binding -1, stages 16 +c2_c: offset 20, type 1406, size 1, index 1, binding -1, stages 16 Uniform block reflection: -cbuff1: offset -1, type ffffffff, size 24, index -1, binding 2 -cbuff2: offset -1, type ffffffff, size 24, index -1, binding 3 +cbuff1: offset -1, type ffffffff, size 24, index -1, binding 2, stages 0 +cbuff2: offset -1, type ffffffff, size 24, index -1, binding 3, stages 0 Vertex attribute reflection: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.vert.out index 5f7a033961b..ea8d8690125 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.reflection.vert.out @@ -1,76 +1,76 @@ hlsl.reflection.vert Uniform reflection: -anonMember3: offset 80, type 8b52, size 1, index 0, binding -1 -s.a: offset 0, type 1404, size 1, index 1, binding -1 -m23: offset 16, type 8b67, size 1, index 0, binding -1 -scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1 -c_m23: offset 16, type 8b67, size 1, index 2, binding -1 -c_scalarAfterm23: offset 48, type 1404, size 1, index 2, binding -1 -scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1 -floatArray: offset 112, type 1406, size 5, index 0, binding -1 -scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1 -m22: offset 208, type 8b5a, size 9, index 0, binding -1 -dm22: offset 32, type 8b5a, size 4, index 1, binding -1 -foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1 -foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1 -foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1 -foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1 -deepA.d2.d1[2].va: offset 376, type 8b50, size 2, index 1, binding -1 -deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1 -deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1 -deepB.d2.d1[1].va: offset 984, type 8b50, size 2, index 1, binding -1 -deepB.d2.d1[2].va: offset 984, type 8b50, size 2, index 1, binding -1 -deepB.d2.d1[3].va: offset 984, type 8b50, size 2, index 1, binding -1 -deepC.iv4: offset 1568, type 8b52, size 1, index 1, binding -1 -deepC.d2.i: offset 1568, type 1404, size 1, index 1, binding -1 -deepC.d2.d1[0].va: offset 1568, type 8b50, size 3, index 1, binding -1 -deepC.d2.d1[0].b: offset 1568, type 8b56, size 1, index 1, binding -1 -deepC.d2.d1[1].va: offset 1568, type 8b50, size 3, index 1, binding -1 -deepC.d2.d1[1].b: offset 1568, type 8b56, size 1, index 1, binding -1 -deepC.d2.d1[2].va: offset 1568, type 8b50, size 3, index 1, binding -1 -deepC.d2.d1[2].b: offset 1568, type 8b56, size 1, index 1, binding -1 -deepC.d2.d1[3].va: offset 1568, type 8b50, size 3, index 1, binding -1 -deepC.d2.d1[3].b: offset 1568, type 8b56, size 1, index 1, binding -1 -deepC.v3: offset 1568, type 8b54, size 1, index 1, binding -1 -deepD[0].iv4: offset 2480, type 8b52, size 1, index 1, binding -1 -deepD[0].d2.i: offset 2480, type 1404, size 1, index 1, binding -1 -deepD[0].d2.d1[0].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[0].d2.d1[0].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[0].d2.d1[1].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[0].d2.d1[1].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[0].d2.d1[2].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[0].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[0].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[0].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[0].v3: offset 2480, type 8b54, size 1, index 1, binding -1 -deepD[1].iv4: offset 2480, type 8b52, size 1, index 1, binding -1 -deepD[1].d2.i: offset 2480, type 1404, size 1, index 1, binding -1 -deepD[1].d2.d1[0].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[1].d2.d1[0].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[1].d2.d1[1].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[1].d2.d1[1].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[1].d2.d1[2].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[1].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[1].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1 -deepD[1].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1 -deepD[1].v3: offset 2480, type 8b54, size 1, index 1, binding -1 -foo1: offset 0, type 1406, size 1, index 4, binding -1 -foo2: offset 0, type 1406, size 1, index 5, binding -1 -anonMember1: offset 0, type 8b51, size 1, index 0, binding -1 -uf1: offset 16, type 1406, size 1, index 1, binding -1 +anonMember3: offset 80, type 8b52, size 1, index 0, binding -1, stages 1 +s.a: offset 0, type 1404, size 1, index 1, binding -1, stages 1 +m23: offset 16, type 8b67, size 1, index 0, binding -1, stages 1 +scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1, stages 1 +c_m23: offset 16, type 8b67, size 1, index 2, binding -1, stages 1 +c_scalarAfterm23: offset 48, type 1404, size 1, index 2, binding -1, stages 1 +scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1, stages 1 +floatArray: offset 112, type 1406, size 5, index 0, binding -1, stages 1 +scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1, stages 1 +m22: offset 208, type 8b5a, size 9, index 0, binding -1, stages 1 +dm22: offset 32, type 8b5a, size 4, index 1, binding -1, stages 1 +foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1, stages 1 +foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1, stages 1 +foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1, stages 1 +foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1, stages 1 +deepA.d2.d1[2].va: offset 376, type 8b50, size 2, index 1, binding -1, stages 1 +deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1 +deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1 +deepB.d2.d1[1].va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1 +deepB.d2.d1[2].va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1 +deepB.d2.d1[3].va: offset 984, type 8b50, size 2, index 1, binding -1, stages 1 +deepC.iv4: offset 1568, type 8b52, size 1, index 1, binding -1, stages 1 +deepC.d2.i: offset 1568, type 1404, size 1, index 1, binding -1, stages 1 +deepC.d2.d1[0].va: offset 1568, type 8b50, size 3, index 1, binding -1, stages 1 +deepC.d2.d1[0].b: offset 1568, type 8b56, size 1, index 1, binding -1, stages 1 +deepC.d2.d1[1].va: offset 1568, type 8b50, size 3, index 1, binding -1, stages 1 +deepC.d2.d1[1].b: offset 1568, type 8b56, size 1, index 1, binding -1, stages 1 +deepC.d2.d1[2].va: offset 1568, type 8b50, size 3, index 1, binding -1, stages 1 +deepC.d2.d1[2].b: offset 1568, type 8b56, size 1, index 1, binding -1, stages 1 +deepC.d2.d1[3].va: offset 1568, type 8b50, size 3, index 1, binding -1, stages 1 +deepC.d2.d1[3].b: offset 1568, type 8b56, size 1, index 1, binding -1, stages 1 +deepC.v3: offset 1568, type 8b54, size 1, index 1, binding -1, stages 1 +deepD[0].iv4: offset 2480, type 8b52, size 1, index 1, binding -1, stages 1 +deepD[0].d2.i: offset 2480, type 1404, size 1, index 1, binding -1, stages 1 +deepD[0].d2.d1[0].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[0].d2.d1[0].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[0].d2.d1[1].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[0].d2.d1[1].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[0].d2.d1[2].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[0].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[0].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[0].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[0].v3: offset 2480, type 8b54, size 1, index 1, binding -1, stages 1 +deepD[1].iv4: offset 2480, type 8b52, size 1, index 1, binding -1, stages 1 +deepD[1].d2.i: offset 2480, type 1404, size 1, index 1, binding -1, stages 1 +deepD[1].d2.d1[0].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[1].d2.d1[0].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[1].d2.d1[1].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[1].d2.d1[1].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[1].d2.d1[2].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[1].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[1].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1, stages 1 +deepD[1].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1, stages 1 +deepD[1].v3: offset 2480, type 8b54, size 1, index 1, binding -1, stages 1 +foo1: offset 0, type 1406, size 1, index 4, binding -1, stages 1 +foo2: offset 0, type 1406, size 1, index 5, binding -1, stages 1 +anonMember1: offset 0, type 8b51, size 1, index 0, binding -1, stages 1 +uf1: offset 16, type 1406, size 1, index 1, binding -1, stages 1 Uniform block reflection: -nameless: offset -1, type ffffffff, size 496, index -1, binding -1 -$Global: offset -1, type ffffffff, size 3088, index -1, binding -1 -c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1 -nested: offset -1, type ffffffff, size 32, index -1, binding -1 -abl: offset -1, type ffffffff, size 4, index -1, binding -1 -abl2: offset -1, type ffffffff, size 4, index -1, binding -1 +nameless: offset -1, type ffffffff, size 496, index -1, binding -1, stages 0 +$Global: offset -1, type ffffffff, size 3088, index -1, binding -1, stages 0 +c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1, stages 0 +nested: offset -1, type ffffffff, size 32, index -1, binding -1, stages 0 +abl: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl2: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 Vertex attribute reflection: -attributeFloat: offset 0, type 1406, size 0, index 0, binding -1 -attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1 -attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1 -attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1 -attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1 +attributeFloat: offset 0, type 1406, size 0, index 0, binding -1, stages 0 +attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1, stages 0 +attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1, stages 0 +attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1, stages 0 +attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1, stages 0 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.atomics.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.atomics.frag.out index ae84db0f9d1..c874cd23ce9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.atomics.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.atomics.frag.out @@ -3946,7 +3946,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 1147 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.bracket.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.bracket.frag.out index c92eedc3c81..d829a7bcd70 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.bracket.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.bracket.frag.out @@ -1744,7 +1744,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 607 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.register.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.register.frag.out index f8409f7f4cc..01f6c89c45a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.register.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.register.frag.out @@ -98,7 +98,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 42 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out index 484fd90510a..7fc26cc7cb2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.scalar.bracket.frag.out @@ -1690,7 +1690,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 571 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out index f8098a5d98b..8fcbb4ba4c4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.swizzle.frag.out @@ -202,7 +202,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 63 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out index 42e45fc0d44..bf1fe0889ba 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.rw.vec2.bracket.frag.out @@ -1708,7 +1708,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 605 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out index 57f2e5f5b17..92e3dd84e7c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.sample.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -163,6 +164,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -320,7 +322,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 146 Capability Shader @@ -330,6 +332,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 138 142 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out index 56bb39a7c0d..b6915b6aa38 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.basic.dx10.frag.out @@ -3,6 +3,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:53 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:53 Function Parameters: @@ -278,6 +279,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:53 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:53 Function Parameters: @@ -548,7 +550,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 198 Capability Shader @@ -557,6 +559,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 188 192 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out index e57f839f87d..bd199a39570 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.sample.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -184,6 +185,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -362,7 +364,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 161 Capability Shader @@ -371,6 +373,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 144 148 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out index ad07c1549a5..065cef0585f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.sample.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -139,6 +140,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -272,7 +274,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 118 Capability Shader @@ -281,6 +283,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 110 114 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out index 5213a03102c..f24415a982f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out @@ -154,7 +154,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 72 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out index 8535c2ce2de..a6fc0a5a2b1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplebias.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -181,6 +182,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -356,7 +358,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 146 Capability Shader @@ -366,6 +368,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 138 142 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out index 919fb8025c4..21794f9ff6a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplebias.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -214,6 +215,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -422,7 +424,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 170 Capability Shader @@ -431,6 +433,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 162 166 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out index 7972bffeab5..ae492e4d423 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplebias.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -202,6 +203,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -397,8 +399,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image Operand Bias to be float scalar + %28 = OpImageSampleImplicitLod %v4float %23 %float_0_100000001 Bias|ConstOffset %int_1 %float_0_5 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 161 Capability Shader @@ -407,6 +413,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 144 148 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out index 6e2bc7db065..0cea7670614 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplebias.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -151,6 +152,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -295,8 +297,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image Operand Bias to be float scalar + %31 = OpImageSampleImplicitLod %v4float %23 %27 Bias|ConstOffset %int_0 %float_0_5 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 118 Capability Shader @@ -305,6 +311,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 110 114 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out index 5a61639f9d1..a41481da5d9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmp.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -201,6 +202,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -395,8 +397,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %48 = OpImageSampleDrefImplicitLod %float %43 %46 %47 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 209 Capability Shader @@ -406,6 +412,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 166 170 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out index 729dc36f751..e8252d38181 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmp.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -192,6 +193,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -377,8 +379,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %41 = OpImageSampleDrefImplicitLod %float %38 %39 %40 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 198 Capability Shader @@ -388,6 +394,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 155 159 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out index 4ac0d77aba6..7bcf0852993 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out @@ -85,7 +85,7 @@ gl_FragCoord origin is upper left 0:? 'g_tTex' (layout( binding=3) uniform texture1D) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 43 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out index 5b59ab876cc..cb4ce3909b5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmp.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -165,6 +166,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -323,8 +325,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %42 = OpImageSampleDrefImplicitLod %float %39 %40 %41 ConstOffset %int_2 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 167 Capability Shader @@ -334,6 +340,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 115 119 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out index a2a99045c97..af2af3f2972 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmp.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -171,6 +172,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -335,8 +337,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %49 = OpImageSampleDrefImplicitLod %float %44 %47 %48 ConstOffset %int_2 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 178 Capability Shader @@ -346,6 +352,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 126 130 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out index ea7cc5e027a..a0e5a487f17 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmplevelzero.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -219,6 +220,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -431,8 +433,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %49 = OpImageSampleDrefExplicitLod %float %44 %47 %48 Lod %float_0 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 210 Capability Shader @@ -442,6 +448,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 167 171 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out index 278aad5952a..ffe22988ebe 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmplevelzero.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -210,6 +211,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -413,8 +415,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %42 = OpImageSampleDrefExplicitLod %float %39 %40 %41 Lod %float_0 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 199 Capability Shader @@ -424,6 +430,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 156 160 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out index 141f1f4b208..08e8749f9ec 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmplevelzero.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -177,6 +178,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -347,8 +349,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %43 = OpImageSampleDrefExplicitLod %float %40 %41 %42 Lod|ConstOffset %float_0 %int_2 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 168 Capability Shader @@ -358,6 +364,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 116 120 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out index 84b830c454b..b5c0fc0d7be 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplecmplevelzero.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -183,6 +184,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:38 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:38 Function Parameters: @@ -359,8 +361,12 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Depth' ( out float FragDepth) 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: Expected Image 'Sampled Type' to be the same as Result Type + %50 = OpImageSampleDrefExplicitLod %float %45 %48 %49 Lod|ConstOffset %float_0 %int_2 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 179 Capability Shader @@ -370,6 +376,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 127 131 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out index f9fabcca254..81a92a230ae 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplegrad.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -217,6 +218,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -428,7 +430,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 140 Capability Shader @@ -438,6 +440,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 132 136 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out index cb40bcea307..3acd9afe10a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplegrad.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -268,6 +269,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -530,7 +532,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 175 Capability Shader @@ -539,6 +541,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 167 171 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out index e5605a1a09e..d787939b754 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out @@ -494,7 +494,7 @@ Shader version: 500 0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 166 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out index 2cc4742f956..b5a85493346 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplegrad.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -238,6 +239,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -470,7 +472,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 166 Capability Shader @@ -479,6 +481,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 149 153 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out index 5d3c065c5ba..39a28389ed4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplegrad.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -172,6 +173,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -338,7 +340,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 120 Capability Shader @@ -348,6 +350,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 103 107 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out index bf435df8679..0151cdd3780 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplelevel.array.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -181,6 +182,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:24 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:24 Function Parameters: @@ -356,7 +358,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 147 Capability Shader @@ -366,6 +368,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 139 143 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out index 82c8b59b08c..9327b844af2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplelevel.basic.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:29 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:29 Function Parameters: @@ -215,6 +216,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:29 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:29 Function Parameters: @@ -424,7 +426,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 172 Capability Shader @@ -433,6 +435,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 163 167 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out index b7e3d577553..d2bd1b8754b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out @@ -386,7 +386,7 @@ Shader version: 500 0:? '@entryPointOutput.Pos' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 162 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out index 2080066ff44..36c932c8384 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplelevel.offset.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -202,6 +203,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:28 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:28 Function Parameters: @@ -398,7 +400,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 162 Capability Shader @@ -407,6 +409,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 145 149 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out index 7905b7575af..bc6fd6b410a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out @@ -1,6 +1,7 @@ hlsl.samplelevel.offsetarray.dx10.frag Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -151,6 +152,7 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left +using depth_any 0:? Sequence 0:20 Function Definition: @main( ( temp structure{ temp 4-component vector of float Color, temp float Depth}) 0:20 Function Parameters: @@ -296,7 +298,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 119 Capability Shader @@ -305,6 +307,7 @@ gl_FragCoord origin is upper left MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 111 115 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar-length.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar-length.frag.out index 9a51962cb90..aa11af554a5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar-length.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar-length.frag.out @@ -64,7 +64,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 30 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out index 6b799f468d7..57d250eba2a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalar2matrix.frag.out @@ -374,7 +374,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 96 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalarCast.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalarCast.vert.out index a0b0aa2e715..0e07c9f6621 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalarCast.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scalarCast.vert.out @@ -322,7 +322,7 @@ Shader version: 500 0:? '@entryPointOutput.texCoord' (layout( location=0) out 2-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 120 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scope.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scope.frag.out index b7cc2a2276b..b563380e176 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scope.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.scope.frag.out @@ -102,7 +102,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 49 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.self_cast.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.self_cast.frag.out new file mode 100644 index 00000000000..9d398ed9c10 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.self_cast.frag.out @@ -0,0 +1,130 @@ +hlsl.self_cast.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: @main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp structure{}) +0:8 'b' ( temp structure{}) +0:8 'a' ( temp structure{}) +0:? Sequence +0:13 Sequence +0:13 move second child to first child ( temp structure{ temp float f}) +0:13 'b' ( temp structure{ temp float f}) +0:13 'a' ( temp structure{ temp float f}) +0:? Sequence +0:18 Sequence +0:18 move second child to first child ( temp 2-element array of structure{}) +0:18 'b' ( temp 2-element array of structure{}) +0:18 'a' ( temp 2-element array of structure{}) +0:? Sequence +0:23 Sequence +0:23 move second child to first child ( temp 2-element array of structure{ temp float f}) +0:23 'b' ( temp 2-element array of structure{ temp float f}) +0:23 'a' ( temp 2-element array of structure{ temp float f}) +0:5 Function Definition: main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 Function Call: @main( ( temp void) +0:? Linker Objects + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: @main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:? Sequence +0:8 Sequence +0:8 move second child to first child ( temp structure{}) +0:8 'b' ( temp structure{}) +0:8 'a' ( temp structure{}) +0:? Sequence +0:13 Sequence +0:13 move second child to first child ( temp structure{ temp float f}) +0:13 'b' ( temp structure{ temp float f}) +0:13 'a' ( temp structure{ temp float f}) +0:? Sequence +0:18 Sequence +0:18 move second child to first child ( temp 2-element array of structure{}) +0:18 'b' ( temp 2-element array of structure{}) +0:18 'a' ( temp 2-element array of structure{}) +0:? Sequence +0:23 Sequence +0:23 move second child to first child ( temp 2-element array of structure{ temp float f}) +0:23 'b' ( temp 2-element array of structure{ temp float f}) +0:23 'a' ( temp 2-element array of structure{ temp float f}) +0:5 Function Definition: main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 Function Call: @main( ( temp void) +0:? Linker Objects + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 32 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 6 "@main(" + Name 8 "Test0" + Name 10 "b" + Name 11 "a" + Name 14 "Test1" + MemberName 14(Test1) 0 "f" + Name 16 "b" + Name 17 "a" + Name 23 "b" + Name 24 "a" + Name 28 "b" + Name 29 "a" + 2: TypeVoid + 3: TypeFunction 2 + 8(Test0): TypeStruct + 9: TypePointer Function 8(Test0) + 13: TypeFloat 32 + 14(Test1): TypeStruct 13(float) + 15: TypePointer Function 14(Test1) + 19: TypeInt 32 0 + 20: 19(int) Constant 2 + 21: TypeArray 8(Test0) 20 + 22: TypePointer Function 21 + 26: TypeArray 14(Test1) 20 + 27: TypePointer Function 26 + 4(main): 2 Function None 3 + 5: Label + 31: 2 FunctionCall 6(@main() + Return + FunctionEnd + 6(@main(): 2 Function None 3 + 7: Label + 10(b): 9(ptr) Variable Function + 11(a): 9(ptr) Variable Function + 16(b): 15(ptr) Variable Function + 17(a): 15(ptr) Variable Function + 23(b): 22(ptr) Variable Function + 24(a): 22(ptr) Variable Function + 28(b): 27(ptr) Variable Function + 29(a): 27(ptr) Variable Function + 12: 8(Test0) Load 11(a) + Store 10(b) 12 + 18: 14(Test1) Load 17(a) + Store 16(b) 18 + 25: 21 Load 24(a) + Store 23(b) 25 + 30: 26 Load 29(a) + Store 28(b) 30 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic-1.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic-1.vert.out index 7e4885c4e5d..b5e40913867 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic-1.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic-1.vert.out @@ -242,7 +242,7 @@ Shader version: 500 0:? 'v' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 84 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.geom.out index 5e2214a6adc..e73940bce01 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.geom.out @@ -155,8 +155,12 @@ output primitive = line_strip 0:? 'OutputStream.clip0' ( out 1-element array of float ClipDistance) 0:? 'OutputStream.cull0' ( out 1-element array of float CullDistance) +error: SPIRV-Tools Validation Errors +error: According to the Vulkan spec BuiltIn Position variable needs to be a 4-component 32-bit float vector. ID <20> (OpVariable) is not a float vector. + OpStore %OutputStream_clip0 %25 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 65 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.vert.out index 3b4ac559f03..2dbcd57ff14 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semantic.vert.out @@ -210,7 +210,7 @@ Shader version: 500 0:? '@entryPointOutput.cull1' ( out 2-element array of float CullDistance) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 70 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semicolons.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semicolons.frag.out index 40bd1282b09..94307a6a614 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semicolons.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.semicolons.frag.out @@ -74,7 +74,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out index 1fee20cf3a8..d2838099257 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out @@ -40,8 +40,7 @@ gl_FragCoord origin is upper left 0:10 move second child to first child ( temp 3-component vector of float) 0:10 'u' ( temp 3-component vector of float) 0:10 Construct vec3 ( temp 3-component vector of float) -0:10 Construct float ( temp float) -0:10 'f' ( in float) +0:10 'f' ( in float) 0:11 Sequence 0:11 move second child to first child ( temp 2-component vector of float) 0:11 'w' ( temp 2-component vector of float) @@ -203,8 +202,7 @@ gl_FragCoord origin is upper left 0:10 move second child to first child ( temp 3-component vector of float) 0:10 'u' ( temp 3-component vector of float) 0:10 Construct vec3 ( temp 3-component vector of float) -0:10 Construct float ( temp float) -0:10 'f' ( in float) +0:10 'f' ( in float) 0:11 Sequence 0:11 move second child to first child ( temp 2-component vector of float) 0:11 'w' ( temp 2-component vector of float) @@ -321,7 +319,7 @@ gl_FragCoord origin is upper left 0:? Linker Objects // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 127 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConvRet.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConvRet.frag.out index 432cd6f0be0..fc12f7f0763 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConvRet.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shapeConvRet.frag.out @@ -68,7 +68,7 @@ gl_FragCoord origin is upper left 0:? 'f' (layout( location=0) in float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 35 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shift.per-set.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shift.per-set.frag.out index 57b32e55e1e..7c7d38304c7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shift.per-set.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.shift.per-set.frag.out @@ -9,15 +9,15 @@ gl_FragCoord origin is upper left 0:36 't2' (layout( set=1 binding=2) uniform texture2D) 0:37 't3' (layout( set=2 binding=1) uniform texture3D) 0:38 direct index (layout( row_major std430) buffer 4-component vector of float) -0:38 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:38 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:38 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:38 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:38 Constant: 0:38 0 (const uint) 0:38 Constant: 0:38 0 (const int) 0:39 indirect index (layout( row_major std430) buffer uint) -0:39 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:39 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:39 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:39 Constant: 0:39 0 (const uint) 0:39 right-shift ( temp int) @@ -36,8 +36,8 @@ gl_FragCoord origin is upper left 0:49 Constant: 0:49 0 (const int) 0:50 indirect index (layout( row_major std430) buffer uint) -0:50 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:50 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:50 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:50 Constant: 0:50 0 (const uint) 0:50 right-shift ( temp int) @@ -46,14 +46,14 @@ gl_FragCoord origin is upper left 0:50 Constant: 0:50 2 (const int) 0:51 direct index (layout( row_major std430) buffer float) -0:51 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:51 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:51 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:51 Constant: 0:51 0 (const uint) 0:51 Constant: 0:51 0 (const int) -0:52 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) -0:53 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:52 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) +0:53 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:55 cb1: direct index for structure (layout( row_major std140) uniform int) 0:55 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1}) 0:55 Constant: @@ -62,12 +62,13 @@ gl_FragCoord origin is upper left 0:56 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1}) 0:56 Constant: 0:56 0 (const uint) -0:58 Branch: Return with expression -0:58 Constant: -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 +0:57 'ts6' (layout( set=6 binding=1) uniform texture3D) +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 0:34 Function Definition: main( ( temp void) 0:34 Function Parameters: 0:? Sequence @@ -80,17 +81,18 @@ gl_FragCoord origin is upper left 0:? 't1' (layout( set=1 binding=1) uniform texture1D) 0:? 't2' (layout( set=1 binding=2) uniform texture2D) 0:? 't3' (layout( set=2 binding=1) uniform texture3D) -0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'ts6' (layout( set=6 binding=1) uniform texture3D) +0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer) 0:? 'u1' (layout( set=1 binding=1 rgba32f) uniform image1D) 0:? 'u2' (layout( set=2 binding=2 rgba32f) uniform image2D) 0:? 'u3' (layout( set=2 binding=3 rgba32f) uniform image3D) 0:? 'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer) -0:? 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) -0:? 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) -0:? 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) -0:? 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:? 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) +0:? 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) +0:? 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1}) 0:? 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) @@ -109,15 +111,15 @@ gl_FragCoord origin is upper left 0:36 't2' (layout( set=1 binding=2) uniform texture2D) 0:37 't3' (layout( set=2 binding=1) uniform texture3D) 0:38 direct index (layout( row_major std430) buffer 4-component vector of float) -0:38 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:38 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:38 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:38 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:38 Constant: 0:38 0 (const uint) 0:38 Constant: 0:38 0 (const int) 0:39 indirect index (layout( row_major std430) buffer uint) -0:39 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:39 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:39 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:39 Constant: 0:39 0 (const uint) 0:39 right-shift ( temp int) @@ -136,8 +138,8 @@ gl_FragCoord origin is upper left 0:49 Constant: 0:49 0 (const int) 0:50 indirect index (layout( row_major std430) buffer uint) -0:50 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:50 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:50 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:50 Constant: 0:50 0 (const uint) 0:50 right-shift ( temp int) @@ -146,14 +148,14 @@ gl_FragCoord origin is upper left 0:50 Constant: 0:50 2 (const int) 0:51 direct index (layout( row_major std430) buffer float) -0:51 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:51 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:51 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:51 Constant: 0:51 0 (const uint) 0:51 Constant: 0:51 0 (const int) -0:52 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) -0:53 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:52 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) +0:53 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:55 cb1: direct index for structure (layout( row_major std140) uniform int) 0:55 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1}) 0:55 Constant: @@ -162,12 +164,13 @@ gl_FragCoord origin is upper left 0:56 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1}) 0:56 Constant: 0:56 0 (const uint) -0:58 Branch: Return with expression -0:58 Constant: -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 -0:58 0.000000 +0:57 'ts6' (layout( set=6 binding=1) uniform texture3D) +0:59 Branch: Return with expression +0:59 Constant: +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 +0:59 0.000000 0:34 Function Definition: main( ( temp void) 0:34 Function Parameters: 0:? Sequence @@ -180,46 +183,48 @@ gl_FragCoord origin is upper left 0:? 't1' (layout( set=1 binding=1) uniform texture1D) 0:? 't2' (layout( set=1 binding=2) uniform texture2D) 0:? 't3' (layout( set=2 binding=1) uniform texture3D) -0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'ts6' (layout( set=6 binding=1) uniform texture3D) +0:? 't4' (layout( set=3 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 't5' (layout( set=3 binding=2 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? 't6' (layout( set=3 binding=3 rgba32f) uniform textureBuffer) 0:? 'u1' (layout( set=1 binding=1 rgba32f) uniform image1D) 0:? 'u2' (layout( set=2 binding=2 rgba32f) uniform image2D) 0:? 'u3' (layout( set=2 binding=3 rgba32f) uniform image3D) 0:? 'u4' (layout( set=1 binding=4 r32f) uniform imageBuffer) -0:? 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) -0:? 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) -0:? 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) -0:? 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'u5' (layout( set=2 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:? 'u6' (layout( set=3 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) +0:? 'u7' (layout( set=4 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) +0:? 'u8' (layout( set=5 binding=4 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? 'anon@0' (layout( set=6 binding=1 row_major std140) uniform block{layout( row_major std140) uniform int cb1}) 0:? 'anon@1' (layout( binding=7 row_major std430) readonly buffer block{layout( row_major std430) buffer int tb1}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) Uniform reflection: -t1: offset -1, type 8b5d, size 1, index -1, binding 21 -t2: offset -1, type 8b5e, size 1, index -1, binding 22 -t3: offset -1, type 8b5f, size 1, index -1, binding 26 -t4.@data: offset 0, type 8b52, size 1, index 0, binding -1 -t5.@data: offset 0, type 1405, size 0, index 1, binding -1 -t6: offset -1, type 8dc2, size 1, index -1, binding 23 -s1: offset -1, type 0, size 1, index -1, binding 11 -s2: offset -1, type 0, size 1, index -1, binding 17 -u1: offset -1, type 904c, size 1, index -1, binding 31 -u2: offset -1, type 904d, size 1, index -1, binding 42 -u3: offset -1, type 904e, size 1, index -1, binding 43 -u4: offset -1, type 9051, size 1, index -1, binding 34 -u5.@data: offset 0, type 1405, size 0, index 2, binding -1 -u6.@data: offset 0, type 1406, size 1, index 3, binding -1 -cb1: offset 0, type 1404, size 1, index 4, binding -1 -tb1: offset 0, type 1404, size 1, index 5, binding -1 +t1: offset -1, type 8b5d, size 1, index -1, binding 21, stages 16 +t2: offset -1, type 8b5e, size 1, index -1, binding 22, stages 16 +t3: offset -1, type 8b5f, size 1, index -1, binding 26, stages 16 +t4.@data: offset 0, type 8b52, size 1, index 0, binding -1, stages 16 +t5.@data: offset 0, type 1405, size 0, index 1, binding -1, stages 16 +t6: offset -1, type 8dc2, size 1, index -1, binding 23, stages 16 +s1: offset -1, type 0, size 1, index -1, binding 11, stages 16 +s2: offset -1, type 0, size 1, index -1, binding 17, stages 16 +u1: offset -1, type 904c, size 1, index -1, binding 31, stages 16 +u2: offset -1, type 904d, size 1, index -1, binding 42, stages 16 +u3: offset -1, type 904e, size 1, index -1, binding 43, stages 16 +u4: offset -1, type 9051, size 1, index -1, binding 34, stages 16 +u5.@data: offset 0, type 1405, size 0, index 2, binding -1, stages 16 +u6.@data: offset 0, type 1406, size 1, index 3, binding -1, stages 16 +cb1: offset 0, type 1404, size 1, index 4, binding -1, stages 16 +tb1: offset 0, type 1404, size 1, index 5, binding -1, stages 16 +ts6: offset -1, type 8b5f, size 1, index -1, binding 71, stages 16 Uniform block reflection: -t4: offset -1, type ffffffff, size 0, index -1, binding 21 -t5: offset -1, type ffffffff, size 0, index -1, binding 22 -u5: offset -1, type ffffffff, size 0, index -1, binding 44 -u6: offset -1, type ffffffff, size 0, index -1, binding 34 -cb: offset -1, type ffffffff, size 4, index -1, binding 51 -tb: offset -1, type ffffffff, size 4, index -1, binding 27 +t4: offset -1, type ffffffff, size 0, index -1, binding 21, stages 0 +t5: offset -1, type ffffffff, size 0, index -1, binding 22, stages 0 +u5: offset -1, type ffffffff, size 0, index -1, binding 44, stages 0 +u6: offset -1, type ffffffff, size 0, index -1, binding 34, stages 0 +cb: offset -1, type ffffffff, size 4, index -1, binding 51, stages 0 +tb: offset -1, type ffffffff, size 4, index -1, binding 27, stages 0 Vertex attribute reflection: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sin.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sin.frag.out index 51ee0a75a6c..b92085e41db 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sin.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.sin.frag.out @@ -52,7 +52,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 26 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.snorm.uav.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.snorm.uav.comp.out index 1db3da5eef1..2d6dae7c9fc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.snorm.uav.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.snorm.uav.comp.out @@ -112,7 +112,7 @@ local_size = (16, 16, 1) 0:? 'tid' ( in 3-component vector of uint GlobalInvocationID) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 54 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticFuncInit.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticFuncInit.frag.out new file mode 100644 index 00000000000..d468cec39f9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticFuncInit.frag.out @@ -0,0 +1,218 @@ +hlsl.staticFuncInit.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:12Sequence +0:1 Sequence +0:1 move second child to first child ( temp float) +0:1 'x' ( global float) +0:1 Constant: +0:1 1.000000 +0:5 Sequence +0:5 move second child to first child ( temp float) +0:5 'x' ( global float) +0:5 Constant: +0:5 2.000000 +0:4 Function Definition: f1( ( temp float) +0:4 Function Parameters: +0:? Sequence +0:6 add second child into first child ( temp float) +0:6 'x' ( global float) +0:6 Constant: +0:6 10.000000 +0:7 Branch: Return with expression +0:7 'x' ( global float) +0:12 Sequence +0:12 move second child to first child ( temp float) +0:12 'x' ( global float) +0:12 Constant: +0:12 7.000000 +0:11 Function Definition: f2(f1; ( temp float) +0:11 Function Parameters: +0:11 'p' ( in float) +0:? Sequence +0:13 add second child into first child ( temp float) +0:13 'x' ( global float) +0:13 'p' ( in float) +0:14 Branch: Return with expression +0:14 'x' ( global float) +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:19 Branch: Return with expression +0:19 Construct vec4 ( temp 4-component vector of float) +0:19 add ( temp float) +0:19 add ( temp float) +0:19 add ( temp float) +0:19 add ( temp float) +0:19 'x' ( global float) +0:19 Function Call: f1( ( temp float) +0:19 Function Call: f1( ( temp float) +0:19 Function Call: f2(f1; ( temp float) +0:19 Constant: +0:19 5.000000 +0:19 Function Call: f2(f1; ( temp float) +0:19 'x' ( global float) +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'x' ( global float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:12Sequence +0:1 Sequence +0:1 move second child to first child ( temp float) +0:1 'x' ( global float) +0:1 Constant: +0:1 1.000000 +0:5 Sequence +0:5 move second child to first child ( temp float) +0:5 'x' ( global float) +0:5 Constant: +0:5 2.000000 +0:4 Function Definition: f1( ( temp float) +0:4 Function Parameters: +0:? Sequence +0:6 add second child into first child ( temp float) +0:6 'x' ( global float) +0:6 Constant: +0:6 10.000000 +0:7 Branch: Return with expression +0:7 'x' ( global float) +0:12 Sequence +0:12 move second child to first child ( temp float) +0:12 'x' ( global float) +0:12 Constant: +0:12 7.000000 +0:11 Function Definition: f2(f1; ( temp float) +0:11 Function Parameters: +0:11 'p' ( in float) +0:? Sequence +0:13 add second child into first child ( temp float) +0:13 'x' ( global float) +0:13 'p' ( in float) +0:14 Branch: Return with expression +0:14 'x' ( global float) +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:19 Branch: Return with expression +0:19 Construct vec4 ( temp 4-component vector of float) +0:19 add ( temp float) +0:19 add ( temp float) +0:19 add ( temp float) +0:19 add ( temp float) +0:19 'x' ( global float) +0:19 Function Call: f1( ( temp float) +0:19 Function Call: f1( ( temp float) +0:19 Function Call: f2(f1; ( temp float) +0:19 Constant: +0:19 5.000000 +0:19 Function Call: f2(f1; ( temp float) +0:19 'x' ( global float) +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? 'x' ( global float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 57 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 55 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 8 "f1(" + Name 13 "f2(f1;" + Name 12 "p" + Name 17 "@main(" + Name 20 "x" + Name 22 "x" + Name 24 "x" + Name 44 "param" + Name 47 "param" + Name 55 "@entryPointOutput" + Decorate 55(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeFunction 6(float) + 10: TypePointer Function 6(float) + 11: TypeFunction 6(float) 10(ptr) + 15: TypeVector 6(float) 4 + 16: TypeFunction 15(fvec4) + 19: TypePointer Private 6(float) + 20(x): 19(ptr) Variable Private + 21: 6(float) Constant 1065353216 + 22(x): 19(ptr) Variable Private + 23: 6(float) Constant 1073741824 + 24(x): 19(ptr) Variable Private + 25: 6(float) Constant 1088421888 + 26: 6(float) Constant 1092616192 + 43: 6(float) Constant 1084227584 + 54: TypePointer Output 15(fvec4) +55(@entryPointOutput): 54(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + Store 20(x) 21 + Store 22(x) 23 + Store 24(x) 25 + 56: 15(fvec4) FunctionCall 17(@main() + Store 55(@entryPointOutput) 56 + Return + FunctionEnd + 8(f1(): 6(float) Function None 7 + 9: Label + 27: 6(float) Load 22(x) + 28: 6(float) FAdd 27 26 + Store 22(x) 28 + 29: 6(float) Load 22(x) + ReturnValue 29 + FunctionEnd + 13(f2(f1;): 6(float) Function None 11 + 12(p): 10(ptr) FunctionParameter + 14: Label + 32: 6(float) Load 12(p) + 33: 6(float) Load 24(x) + 34: 6(float) FAdd 33 32 + Store 24(x) 34 + 35: 6(float) Load 24(x) + ReturnValue 35 + FunctionEnd + 17(@main(): 15(fvec4) Function None 16 + 18: Label + 44(param): 10(ptr) Variable Function + 47(param): 10(ptr) Variable Function + 38: 6(float) Load 20(x) + 39: 6(float) FunctionCall 8(f1() + 40: 6(float) FAdd 38 39 + 41: 6(float) FunctionCall 8(f1() + 42: 6(float) FAdd 40 41 + Store 44(param) 43 + 45: 6(float) FunctionCall 13(f2(f1;) 44(param) + 46: 6(float) FAdd 42 45 + 48: 6(float) Load 20(x) + Store 47(param) 48 + 49: 6(float) FunctionCall 13(f2(f1;) 47(param) + 50: 6(float) FAdd 46 49 + 51: 15(fvec4) CompositeConstruct 50 50 50 50 + ReturnValue 51 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticMemberFunction.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticMemberFunction.frag.out index 08d0d20b2f6..2c7e4180054 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticMemberFunction.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.staticMemberFunction.frag.out @@ -118,7 +118,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 54 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.store.rwbyteaddressbuffer.type.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.store.rwbyteaddressbuffer.type.comp.out new file mode 100644 index 00000000000..6436db7c85d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.store.rwbyteaddressbuffer.type.comp.out @@ -0,0 +1,173 @@ +hlsl.store.rwbyteaddressbuffer.type.comp +Shader version: 500 +local_size = (64, 1, 1) +0:? Sequence +0:5 Function Definition: @main(vu3; ( temp void) +0:5 Function Parameters: +0:5 'dispatchThreadID' ( in 3-component vector of uint) +0:? Sequence +0:6 Test condition and select ( temp void) +0:6 Condition +0:6 Compare Equal ( temp bool) +0:6 direct index ( temp uint) +0:6 'dispatchThreadID' ( in 3-component vector of uint) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const uint) +0:6 true case +0:? Sequence +0:7 move second child to first child ( temp int) +0:7 'byteAddrTemp' ( temp int) +0:7 right-shift ( temp int) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 2 (const int) +0:7 move second child to first child ( temp uint) +0:7 indirect index (layout( row_major std430) buffer uint) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:7 'buffer' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:7 Constant: +0:7 0 (const uint) +0:7 'byteAddrTemp' ( temp int) +0:7 Constant: +0:7 2 (const uint) +0:5 Function Definition: main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 move second child to first child ( temp 3-component vector of uint) +0:? 'dispatchThreadID' ( temp 3-component vector of uint) +0:? 'dispatchThreadID' ( in 3-component vector of uint GlobalInvocationID) +0:5 Function Call: @main(vu3; ( temp void) +0:? 'dispatchThreadID' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'buffer' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:? 'dispatchThreadID' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (64, 1, 1) +0:? Sequence +0:5 Function Definition: @main(vu3; ( temp void) +0:5 Function Parameters: +0:5 'dispatchThreadID' ( in 3-component vector of uint) +0:? Sequence +0:6 Test condition and select ( temp void) +0:6 Condition +0:6 Compare Equal ( temp bool) +0:6 direct index ( temp uint) +0:6 'dispatchThreadID' ( in 3-component vector of uint) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const uint) +0:6 true case +0:? Sequence +0:7 move second child to first child ( temp int) +0:7 'byteAddrTemp' ( temp int) +0:7 right-shift ( temp int) +0:7 Constant: +0:7 0 (const int) +0:7 Constant: +0:7 2 (const int) +0:7 move second child to first child ( temp uint) +0:7 indirect index (layout( row_major std430) buffer uint) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:7 'buffer' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:7 Constant: +0:7 0 (const uint) +0:7 'byteAddrTemp' ( temp int) +0:7 Constant: +0:7 2 (const uint) +0:5 Function Definition: main( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 move second child to first child ( temp 3-component vector of uint) +0:? 'dispatchThreadID' ( temp 3-component vector of uint) +0:? 'dispatchThreadID' ( in 3-component vector of uint GlobalInvocationID) +0:5 Function Call: @main(vu3; ( temp void) +0:? 'dispatchThreadID' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'buffer' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:? 'dispatchThreadID' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 42 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 37 + ExecutionMode 4 LocalSize 64 1 1 + Source HLSL 500 + Name 4 "main" + Name 11 "@main(vu3;" + Name 10 "dispatchThreadID" + Name 23 "byteAddrTemp" + Name 28 "buffer" + MemberName 28(buffer) 0 "@data" + Name 30 "buffer" + Name 35 "dispatchThreadID" + Name 37 "dispatchThreadID" + Name 39 "param" + Decorate 27 ArrayStride 4 + MemberDecorate 28(buffer) 0 Offset 0 + Decorate 28(buffer) BufferBlock + Decorate 30(buffer) DescriptorSet 0 + Decorate 37(dispatchThreadID) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: 6(int) Constant 0 + 14: TypePointer Function 6(int) + 17: TypeBool + 21: TypeInt 32 1 + 22: TypePointer Function 21(int) + 24: 21(int) Constant 0 + 25: 21(int) Constant 2 + 27: TypeRuntimeArray 6(int) + 28(buffer): TypeStruct 27 + 29: TypePointer Uniform 28(buffer) + 30(buffer): 29(ptr) Variable Uniform + 32: 6(int) Constant 2 + 33: TypePointer Uniform 6(int) + 36: TypePointer Input 7(ivec3) +37(dispatchThreadID): 36(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label +35(dispatchThreadID): 8(ptr) Variable Function + 39(param): 8(ptr) Variable Function + 38: 7(ivec3) Load 37(dispatchThreadID) + Store 35(dispatchThreadID) 38 + 40: 7(ivec3) Load 35(dispatchThreadID) + Store 39(param) 40 + 41: 2 FunctionCall 11(@main(vu3;) 39(param) + Return + FunctionEnd + 11(@main(vu3;): 2 Function None 9 +10(dispatchThreadID): 8(ptr) FunctionParameter + 12: Label +23(byteAddrTemp): 22(ptr) Variable Function + 15: 14(ptr) AccessChain 10(dispatchThreadID) 13 + 16: 6(int) Load 15 + 18: 17(bool) IEqual 16 13 + SelectionMerge 20 None + BranchConditional 18 19 20 + 19: Label + 26: 21(int) ShiftRightArithmetic 24 25 + Store 23(byteAddrTemp) 26 + 31: 21(int) Load 23(byteAddrTemp) + 34: 33(ptr) AccessChain 30(buffer) 24 31 + Store 34 32 + Branch 20 + 20: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.string.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.string.frag.out index 893e49d1659..9181b933aa9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.string.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.string.frag.out @@ -50,7 +50,7 @@ gl_FragCoord origin is upper left 0:? 'f' (layout( location=0) in float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.stringtoken.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.stringtoken.frag.out index dcc493d7d3b..82033cf3658 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.stringtoken.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.stringtoken.frag.out @@ -70,7 +70,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 34 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.frag.out index c540c16203e..4ea7bbbd13a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.frag.out @@ -211,8 +211,12 @@ gl_FragCoord origin is upper left 0:? 's.ff3' (layout( location=6) flat in bool) 0:? 's.ff4' (layout( location=7) in 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: If OpTypeBool is stored in conjunction with OpVariable, it can only be used with non-externally visible shader Storage Classes: Workgroup, CrossWorkgroup, Private, and Function + %s_b = OpVariable %_ptr_Input_bool Input + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 102 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split-1.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split-1.vert.out index 6086e320099..d7d6e92b120 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split-1.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split-1.vert.out @@ -196,7 +196,7 @@ Shader version: 500 0:? 'Pos_loose' (layout( location=3) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 70 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.array.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.array.geom.out index 42f45a8a795..081b05cbb6e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.array.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.array.geom.out @@ -160,7 +160,7 @@ output primitive = triangle_strip 0:? 'OutputStream.VertexID' (layout( location=2) out uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 82 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out index b42663951f9..0598ac9c459 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out @@ -207,8 +207,12 @@ gl_FragCoord origin is upper left 0:? 'input[1].f' (layout( location=2) in float) 0:? 'input[2].f' (layout( location=3) in float) +error: SPIRV-Tools Validation Errors +error: According to the Vulkan spec BuiltIn FragCoord variable needs to be a 4-component 32-bit float vector. ID <41> (OpVariable) is not a float vector. + %input_pos = OpVariable %_ptr_Input__arr_v4float_uint_3 Input + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 66 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.call.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.call.vert.out index dd6e38e6c76..50d1d2b13fc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.call.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.call.vert.out @@ -214,7 +214,7 @@ Shader version: 500 0:? 'vsin.x1_in' (layout( location=2) in int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 77 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out index 0d83cdf2aab..7a72a3f880d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.nested.geom.out @@ -448,7 +448,7 @@ output primitive = triangle_strip 0:? 'ts.contains_no_builtin_io.m1' (layout( location=3) out int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 100 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out index 31b2cda7d0a..477fbd20049 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.geom.out @@ -192,7 +192,7 @@ output primitive = triangle_strip 0:? 'ts.pos' ( out 4-component vector of float Position) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 67 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out index f3c10c46e74..8bf477e691b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.struct.split.trivial.vert.out @@ -98,7 +98,7 @@ Shader version: 500 0:? 'Pos_loose' (layout( location=1) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 45 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structIoFourWay.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structIoFourWay.frag.out index 24c902fae7d..f60c80b4b2a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structIoFourWay.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structIoFourWay.frag.out @@ -162,7 +162,7 @@ using depth_greater 0:? 't.normal' (layout( location=3) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 65 Capability Shader @@ -171,6 +171,7 @@ using depth_greater EntryPoint Fragment 4 "main" 22 27 31 36 45 48 51 55 ExecutionMode 4 OriginUpperLeft ExecutionMode 4 DepthGreater + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "T" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structStructName.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structStructName.frag.out index dded13f9fa6..183dcf63976 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structStructName.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structStructName.frag.out @@ -44,7 +44,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out index 534ea7ce23d..fc66a7ceeba 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.frag.out @@ -155,8 +155,14 @@ gl_FragCoord origin is upper left 0:? 'g_texdata_array2[2].nonopaque_thing' ( uniform int) 0:? 'ps_output.color' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: UniformConstant OpVariable '65[g_texdata.nonopaque_thing] 'has illegal type. +From Vulkan spec, section 14.5.2: +Variables identified with the UniformConstant storage class are used only as handles to refer to opaque resources. Such variables must be typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, OpTypeAccelerationStructureNV, or an array of one of these types. + %g_texdata_nonopaque_thing = OpVariable %_ptr_UniformConstant_int UniformConstant + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 80 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out index eac315c08e0..f88118d6246 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structarray.flatten.geom.out @@ -170,7 +170,7 @@ output primitive = triangle_strip 0:? 'outStream.uv' (layout( location=1) out 2-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 58 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out index 1f79b9b5f61..df0865565ef 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out @@ -4,24 +4,24 @@ gl_FragCoord origin is upper left 0:? Sequence 0:8 Function Definition: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float) 0:8 Function Parameters: -0:8 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:8 'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count}) -0:8 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:8 'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:8 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:8 'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count}) +0:8 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:8 'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:? Sequence 0:9 move second child to first child ( temp 4-component vector of float) 0:9 indirect index ( buffer 4-component vector of float) -0:9 @data: direct index for structure ( buffer implicitly-sized array of 4-component vector of float) -0:9 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:9 @data: direct index for structure ( buffer unsized 1-element array of 4-component vector of float) +0:9 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 AtomicAdd ( temp uint) -0:9 @count: direct index for structure ( temp int) -0:9 'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:9 @count: direct index for structure ( temp uint) +0:9 'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:9 Constant: 0:9 0 (const int) 0:9 Constant: -0:9 1 (const int) +0:9 1 (const uint) 0:? Constant: 0:? 1.000000 0:? 2.000000 @@ -29,18 +29,18 @@ gl_FragCoord origin is upper left 0:? 4.000000 0:10 Branch: Return with expression 0:10 indirect index ( buffer 4-component vector of float) -0:10 @data: direct index for structure ( buffer implicitly-sized array of 4-component vector of float) -0:10 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:10 @data: direct index for structure ( buffer unsized 1-element array of 4-component vector of float) +0:10 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp uint) 0:10 AtomicAdd ( temp uint) -0:10 @count: direct index for structure ( temp int) -0:10 'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:10 @count: direct index for structure ( temp uint) +0:10 'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:10 Constant: 0:10 0 (const int) 0:10 Constant: -0:10 -1 (const int) +0:10 4294967295 (const uint) 0:10 Constant: 0:10 -1 (const int) 0:19 Function Definition: @main(u1; ( temp 4-component vector of float) @@ -49,10 +49,10 @@ gl_FragCoord origin is upper left 0:? Sequence 0:22 Branch: Return with expression 0:22 Function Call: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float) -0:22 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:22 'sbuf_a@count' ( buffer block{layout( row_major std430) buffer int @count}) -0:22 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:22 'sbuf_c@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:22 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:22 'sbuf_a@count' ( buffer block{layout( row_major std430) buffer uint @count}) +0:22 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:22 'sbuf_c@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:19 Function Definition: main( ( temp void) 0:19 Function Parameters: 0:? Sequence @@ -64,11 +64,11 @@ gl_FragCoord origin is upper left 0:19 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -81,24 +81,24 @@ gl_FragCoord origin is upper left 0:? Sequence 0:8 Function Definition: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float) 0:8 Function Parameters: -0:8 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:8 'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count}) -0:8 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:8 'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:8 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:8 'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count}) +0:8 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:8 'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:? Sequence 0:9 move second child to first child ( temp 4-component vector of float) 0:9 indirect index ( buffer 4-component vector of float) -0:9 @data: direct index for structure ( buffer implicitly-sized array of 4-component vector of float) -0:9 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:9 @data: direct index for structure ( buffer unsized 1-element array of 4-component vector of float) +0:9 'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 AtomicAdd ( temp uint) -0:9 @count: direct index for structure ( temp int) -0:9 'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:9 @count: direct index for structure ( temp uint) +0:9 'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:9 Constant: 0:9 0 (const int) 0:9 Constant: -0:9 1 (const int) +0:9 1 (const uint) 0:? Constant: 0:? 1.000000 0:? 2.000000 @@ -106,18 +106,18 @@ gl_FragCoord origin is upper left 0:? 4.000000 0:10 Branch: Return with expression 0:10 indirect index ( buffer 4-component vector of float) -0:10 @data: direct index for structure ( buffer implicitly-sized array of 4-component vector of float) -0:10 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:10 @data: direct index for structure ( buffer unsized 1-element array of 4-component vector of float) +0:10 'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp uint) 0:10 AtomicAdd ( temp uint) -0:10 @count: direct index for structure ( temp int) -0:10 'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:10 @count: direct index for structure ( temp uint) +0:10 'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:10 Constant: 0:10 0 (const int) 0:10 Constant: -0:10 -1 (const int) +0:10 4294967295 (const uint) 0:10 Constant: 0:10 -1 (const int) 0:19 Function Definition: @main(u1; ( temp 4-component vector of float) @@ -126,10 +126,10 @@ gl_FragCoord origin is upper left 0:? Sequence 0:22 Branch: Return with expression 0:22 Function Call: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float) -0:22 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:22 'sbuf_a@count' ( buffer block{layout( row_major std430) buffer int @count}) -0:22 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:22 'sbuf_c@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:22 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:22 'sbuf_a@count' ( buffer block{layout( row_major std430) buffer uint @count}) +0:22 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:22 'sbuf_c@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:19 Function Definition: main( ( temp void) 0:19 Function Parameters: 0:? Sequence @@ -141,22 +141,26 @@ gl_FragCoord origin is upper left 0:19 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) +error: SPIRV-Tools Validation Errors +error: Structure id 12 decorated as BufferBlock must be explicitly laid out with Offset decorations. + %__0 = OpTypeStruct %uint + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 76 +// Generated by (magic number): 80007 +// Id's are bound by 70 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 64 67 + EntryPoint Fragment 4 "main" 58 61 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -169,92 +173,86 @@ gl_FragCoord origin is upper left Name 16 "arg_a@count" Name 17 "arg_c" Name 18 "arg_c@count" - Name 25 "@main(u1;" - Name 24 "pos" - Name 50 "sbuf_a" - Name 52 "sbuf_a@count" - Name 53 "sbuf_c" - Name 54 "sbuf_c@count" - Name 55 "param" - Name 56 "param" - Name 57 "param" - Name 58 "param" - Name 62 "pos" - Name 64 "pos" - Name 67 "@entryPointOutput" - Name 68 "param" - Name 71 "sbuf_a@count" - MemberName 71(sbuf_a@count) 0 "@count" - Name 73 "sbuf_a@count" - Name 74 "sbuf_c@count" - Name 75 "sbuf_unused" + Name 24 "@main(u1;" + Name 23 "pos" + Name 49 "sbuf_a" + Name 50 "sbuf_a@count" + Name 51 "sbuf_c" + Name 52 "sbuf_c@count" + Name 56 "pos" + Name 58 "pos" + Name 61 "@entryPointOutput" + Name 62 "param" + Name 65 "sbuf_a@count" + MemberName 65(sbuf_a@count) 0 "@count" + Name 67 "sbuf_a@count" + Name 68 "sbuf_c@count" + Name 69 "sbuf_unused" Decorate 8 ArrayStride 16 MemberDecorate 9 0 Offset 0 Decorate 9 BufferBlock Decorate 12 BufferBlock - Decorate 50(sbuf_a) DescriptorSet 0 - Decorate 52(sbuf_a@count) DescriptorSet 0 - Decorate 53(sbuf_c) DescriptorSet 0 - Decorate 54(sbuf_c@count) DescriptorSet 0 - Decorate 64(pos) Flat - Decorate 64(pos) Location 0 - Decorate 67(@entryPointOutput) Location 0 - MemberDecorate 71(sbuf_a@count) 0 Offset 0 - Decorate 71(sbuf_a@count) BufferBlock - Decorate 73(sbuf_a@count) DescriptorSet 0 - Decorate 74(sbuf_c@count) DescriptorSet 0 - Decorate 75(sbuf_unused) DescriptorSet 0 + Decorate 49(sbuf_a) DescriptorSet 0 + Decorate 50(sbuf_a@count) DescriptorSet 0 + Decorate 51(sbuf_c) DescriptorSet 0 + Decorate 52(sbuf_c@count) DescriptorSet 0 + Decorate 58(pos) Flat + Decorate 58(pos) Location 0 + Decorate 61(@entryPointOutput) Location 0 + MemberDecorate 65(sbuf_a@count) 0 Offset 0 + Decorate 65(sbuf_a@count) BufferBlock + Decorate 67(sbuf_a@count) DescriptorSet 0 + Decorate 68(sbuf_c@count) DescriptorSet 0 + Decorate 69(sbuf_unused) DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypeRuntimeArray 7(fvec4) 9: TypeStruct 8 - 10: TypePointer Function 9(struct) - 11: TypeInt 32 1 + 10: TypePointer Uniform 9(struct) + 11: TypeInt 32 0 12: TypeStruct 11(int) - 13: TypePointer Function 12(struct) + 13: TypePointer Uniform 12(struct) 14: TypeFunction 7(fvec4) 10(ptr) 13(ptr) 10(ptr) 13(ptr) - 21: TypeInt 32 0 - 22: TypePointer Function 21(int) - 23: TypeFunction 7(fvec4) 22(ptr) - 27: 11(int) Constant 0 - 28: TypePointer Function 11(int) + 21: TypePointer Function 11(int) + 22: TypeFunction 7(fvec4) 21(ptr) + 26: TypeInt 32 1 + 27: 26(int) Constant 0 + 28: TypePointer Uniform 11(int) 30: 11(int) Constant 1 - 31: 21(int) Constant 1 - 32: 21(int) Constant 0 - 34: 6(float) Constant 1065353216 - 35: 6(float) Constant 1073741824 - 36: 6(float) Constant 1077936128 - 37: 6(float) Constant 1082130432 - 38: 7(fvec4) ConstantComposite 34 35 36 37 - 39: TypePointer Function 7(fvec4) - 42: 11(int) Constant 4294967295 - 49: TypePointer Uniform 9(struct) - 50(sbuf_a): 49(ptr) Variable Uniform - 51: TypePointer Uniform 12(struct) -52(sbuf_a@count): 51(ptr) Variable Uniform - 53(sbuf_c): 49(ptr) Variable Uniform -54(sbuf_c@count): 51(ptr) Variable Uniform - 63: TypePointer Input 21(int) - 64(pos): 63(ptr) Variable Input - 66: TypePointer Output 7(fvec4) -67(@entryPointOutput): 66(ptr) Variable Output -71(sbuf_a@count): TypeStruct 11(int) - 72: TypePointer Uniform 71(sbuf_a@count) -73(sbuf_a@count): 72(ptr) Variable Uniform -74(sbuf_c@count): 72(ptr) Variable Uniform - 75(sbuf_unused): 49(ptr) Variable Uniform + 31: 11(int) Constant 0 + 33: 6(float) Constant 1065353216 + 34: 6(float) Constant 1073741824 + 35: 6(float) Constant 1077936128 + 36: 6(float) Constant 1082130432 + 37: 7(fvec4) ConstantComposite 33 34 35 36 + 38: TypePointer Uniform 7(fvec4) + 41: 11(int) Constant 4294967295 + 43: 26(int) Constant 4294967295 + 49(sbuf_a): 10(ptr) Variable Uniform +50(sbuf_a@count): 13(ptr) Variable Uniform + 51(sbuf_c): 10(ptr) Variable Uniform +52(sbuf_c@count): 13(ptr) Variable Uniform + 57: TypePointer Input 11(int) + 58(pos): 57(ptr) Variable Input + 60: TypePointer Output 7(fvec4) +61(@entryPointOutput): 60(ptr) Variable Output +65(sbuf_a@count): TypeStruct 11(int) + 66: TypePointer Uniform 65(sbuf_a@count) +67(sbuf_a@count): 66(ptr) Variable Uniform +68(sbuf_c@count): 66(ptr) Variable Uniform + 69(sbuf_unused): 10(ptr) Variable Uniform 4(main): 2 Function None 3 5: Label - 62(pos): 22(ptr) Variable Function - 68(param): 22(ptr) Variable Function - 65: 21(int) Load 64(pos) - Store 62(pos) 65 - 69: 21(int) Load 62(pos) - Store 68(param) 69 - 70: 7(fvec4) FunctionCall 25(@main(u1;) 68(param) - Store 67(@entryPointOutput) 70 + 56(pos): 21(ptr) Variable Function + 62(param): 21(ptr) Variable Function + 59: 11(int) Load 58(pos) + Store 56(pos) 59 + 63: 11(int) Load 56(pos) + Store 62(param) 63 + 64: 7(fvec4) FunctionCall 24(@main(u1;) 62(param) + Store 61(@entryPointOutput) 64 Return FunctionEnd 19(Fn2(block--vf4[0]1;block--vf4[0]1;): 7(fvec4) Function None 14 @@ -264,23 +262,19 @@ gl_FragCoord origin is upper left 18(arg_c@count): 13(ptr) FunctionParameter 20: Label 29: 28(ptr) AccessChain 16(arg_a@count) 27 - 33: 21(int) AtomicIAdd 29 31 32 30 - 40: 39(ptr) AccessChain 15(arg_a) 27 33 - Store 40 38 - 41: 28(ptr) AccessChain 18(arg_c@count) 27 - 43: 21(int) AtomicIAdd 41 31 32 42 - 44: 21(int) IAdd 43 42 - 45: 39(ptr) AccessChain 17(arg_c) 27 44 + 32: 11(int) AtomicIAdd 29 30 31 30 + 39: 38(ptr) AccessChain 15(arg_a) 27 32 + Store 39 37 + 40: 28(ptr) AccessChain 18(arg_c@count) 27 + 42: 11(int) AtomicIAdd 40 30 31 41 + 44: 11(int) IAdd 42 43 + 45: 38(ptr) AccessChain 17(arg_c) 27 44 46: 7(fvec4) Load 45 ReturnValue 46 FunctionEnd - 25(@main(u1;): 7(fvec4) Function None 23 - 24(pos): 22(ptr) FunctionParameter - 26: Label - 55(param): 10(ptr) Variable Function - 56(param): 13(ptr) Variable Function - 57(param): 10(ptr) Variable Function - 58(param): 13(ptr) Variable Function - 59: 7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 55(param) 56(param) 57(param) 58(param) - ReturnValue 59 + 24(@main(u1;): 7(fvec4) Function None 22 + 23(pos): 21(ptr) FunctionParameter + 25: Label + 53: 7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 49(sbuf_a) 50(sbuf_a@count) 51(sbuf_c) 52(sbuf_c@count) + ReturnValue 53 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out index 9ff5bee37ab..dff47f88b60 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out @@ -8,17 +8,17 @@ gl_FragCoord origin is upper left 0:? Sequence 0:8 move second child to first child ( temp 4-component vector of float) 0:8 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:8 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:8 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:8 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:8 Constant: 0:8 0 (const uint) 0:8 AtomicAdd ( temp uint) -0:8 @count: direct index for structure ( temp int) -0:8 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:8 @count: direct index for structure ( temp uint) +0:8 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:8 Constant: 0:8 0 (const int) 0:8 Constant: -0:8 1 (const int) +0:8 1 (const uint) 0:? Constant: 0:? 1.000000 0:? 2.000000 @@ -26,18 +26,18 @@ gl_FragCoord origin is upper left 0:? 4.000000 0:10 Branch: Return with expression 0:10 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:10 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:10 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp uint) 0:10 AtomicAdd ( temp uint) -0:10 @count: direct index for structure ( temp int) -0:10 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:10 @count: direct index for structure ( temp uint) +0:10 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:10 Constant: 0:10 0 (const int) 0:10 Constant: -0:10 -1 (const int) +0:10 4294967295 (const uint) 0:10 Constant: 0:10 -1 (const int) 0:7 Function Definition: main( ( temp void) @@ -51,11 +51,11 @@ gl_FragCoord origin is upper left 0:7 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -72,17 +72,17 @@ gl_FragCoord origin is upper left 0:? Sequence 0:8 move second child to first child ( temp 4-component vector of float) 0:8 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:8 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:8 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:8 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:8 Constant: 0:8 0 (const uint) 0:8 AtomicAdd ( temp uint) -0:8 @count: direct index for structure ( temp int) -0:8 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:8 @count: direct index for structure ( temp uint) +0:8 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:8 Constant: 0:8 0 (const int) 0:8 Constant: -0:8 1 (const int) +0:8 1 (const uint) 0:? Constant: 0:? 1.000000 0:? 2.000000 @@ -90,18 +90,18 @@ gl_FragCoord origin is upper left 0:? 4.000000 0:10 Branch: Return with expression 0:10 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:10 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:10 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp uint) 0:10 AtomicAdd ( temp uint) -0:10 @count: direct index for structure ( temp int) -0:10 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:10 @count: direct index for structure ( temp uint) +0:10 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:10 Constant: 0:10 0 (const int) 0:10 Constant: -0:10 -1 (const int) +0:10 4294967295 (const uint) 0:10 Constant: 0:10 -1 (const int) 0:7 Function Definition: main( ( temp void) @@ -115,16 +115,16 @@ gl_FragCoord origin is upper left 0:7 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) -0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:? 'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) +0:? 'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 56 Capability Shader @@ -142,8 +142,8 @@ gl_FragCoord origin is upper left Name 20 "sbuf_a@count" MemberName 20(sbuf_a@count) 0 "@count" Name 22 "sbuf_a@count" - Name 36 "sbuf_c" - Name 37 "sbuf_c@count" + Name 35 "sbuf_c" + Name 36 "sbuf_c@count" Name 46 "pos" Name 48 "pos" Name 51 "@entryPointOutput" @@ -156,8 +156,8 @@ gl_FragCoord origin is upper left MemberDecorate 20(sbuf_a@count) 0 Offset 0 Decorate 20(sbuf_a@count) BufferBlock Decorate 22(sbuf_a@count) DescriptorSet 0 - Decorate 36(sbuf_c) DescriptorSet 0 - Decorate 37(sbuf_c@count) DescriptorSet 0 + Decorate 35(sbuf_c) DescriptorSet 0 + Decorate 36(sbuf_c@count) DescriptorSet 0 Decorate 48(pos) Flat Decorate 48(pos) Location 0 Decorate 51(@entryPointOutput) Location 0 @@ -175,22 +175,22 @@ gl_FragCoord origin is upper left 17(sbuf_a): 16(ptr) Variable Uniform 18: TypeInt 32 1 19: 18(int) Constant 0 -20(sbuf_a@count): TypeStruct 18(int) +20(sbuf_a@count): TypeStruct 6(int) 21: TypePointer Uniform 20(sbuf_a@count) 22(sbuf_a@count): 21(ptr) Variable Uniform - 23: TypePointer Uniform 18(int) - 25: 18(int) Constant 1 - 26: 6(int) Constant 1 - 27: 6(int) Constant 0 - 29: 8(float) Constant 1065353216 - 30: 8(float) Constant 1073741824 - 31: 8(float) Constant 1077936128 - 32: 8(float) Constant 1082130432 - 33: 9(fvec4) ConstantComposite 29 30 31 32 - 34: TypePointer Uniform 9(fvec4) - 36(sbuf_c): 16(ptr) Variable Uniform -37(sbuf_c@count): 21(ptr) Variable Uniform - 39: 18(int) Constant 4294967295 + 23: TypePointer Uniform 6(int) + 25: 6(int) Constant 1 + 26: 6(int) Constant 0 + 28: 8(float) Constant 1065353216 + 29: 8(float) Constant 1073741824 + 30: 8(float) Constant 1077936128 + 31: 8(float) Constant 1082130432 + 32: 9(fvec4) ConstantComposite 28 29 30 31 + 33: TypePointer Uniform 9(fvec4) + 35(sbuf_c): 16(ptr) Variable Uniform +36(sbuf_c@count): 21(ptr) Variable Uniform + 38: 6(int) Constant 4294967295 + 40: 18(int) Constant 4294967295 47: TypePointer Input 6(int) 48(pos): 47(ptr) Variable Input 50: TypePointer Output 9(fvec4) @@ -212,13 +212,13 @@ gl_FragCoord origin is upper left 11(pos): 7(ptr) FunctionParameter 13: Label 24: 23(ptr) AccessChain 22(sbuf_a@count) 19 - 28: 6(int) AtomicIAdd 24 26 27 25 - 35: 34(ptr) AccessChain 17(sbuf_a) 19 28 - Store 35 33 - 38: 23(ptr) AccessChain 37(sbuf_c@count) 19 - 40: 6(int) AtomicIAdd 38 26 27 39 - 41: 6(int) IAdd 40 39 - 42: 34(ptr) AccessChain 36(sbuf_c) 19 41 + 27: 6(int) AtomicIAdd 24 25 26 25 + 34: 33(ptr) AccessChain 17(sbuf_a) 19 27 + Store 34 32 + 37: 23(ptr) AccessChain 36(sbuf_c@count) 19 + 39: 6(int) AtomicIAdd 37 25 26 38 + 41: 6(int) IAdd 39 40 + 42: 33(ptr) AccessChain 35(sbuf_c) 19 41 43: 9(fvec4) Load 42 ReturnValue 43 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out index 2e85173fca3..68d93c187c2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out @@ -6,10 +6,10 @@ gl_FragCoord origin is upper left 0:5 Function Parameters: 0:5 'pos' ( in uint) 0:? Sequence -0:8 AtomicAdd ( temp void) +0:8 AtomicAdd ( temp uint) 0:8 indirect index (layout( row_major std430) buffer uint) -0:8 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:8 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:8 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:8 Constant: 0:8 0 (const uint) 0:8 right-shift ( temp int) @@ -23,8 +23,8 @@ gl_FragCoord origin is upper left 0:9 'u' ( temp uint) 0:9 AtomicAdd ( temp uint) 0:9 indirect index (layout( row_major std430) buffer uint) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 right-shift ( temp int) @@ -34,10 +34,10 @@ gl_FragCoord origin is upper left 0:9 2 (const int) 0:9 Constant: 0:9 1 (const int) -0:10 AtomicAnd ( temp void) +0:10 AtomicAnd ( temp uint) 0:10 indirect index (layout( row_major std430) buffer uint) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 right-shift ( temp int) @@ -51,8 +51,8 @@ gl_FragCoord origin is upper left 0:11 'u' ( temp uint) 0:11 AtomicAnd ( temp uint) 0:11 indirect index (layout( row_major std430) buffer uint) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 right-shift ( temp int) @@ -67,8 +67,8 @@ gl_FragCoord origin is upper left 0:12 Convert int to uint ( temp uint) 0:12 AtomicCompSwap ( temp int) 0:12 indirect index (layout( row_major std430) buffer uint) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 right-shift ( temp int) @@ -84,8 +84,8 @@ gl_FragCoord origin is upper left 0:14 'u' ( temp uint) 0:14 AtomicExchange ( temp uint) 0:14 indirect index (layout( row_major std430) buffer uint) -0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:14 Constant: 0:14 0 (const uint) 0:14 right-shift ( temp int) @@ -95,10 +95,10 @@ gl_FragCoord origin is upper left 0:14 2 (const int) 0:14 Constant: 0:14 1 (const int) -0:15 AtomicMax ( temp void) +0:15 AtomicMax ( temp uint) 0:15 indirect index (layout( row_major std430) buffer uint) -0:15 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:15 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:15 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:15 Constant: 0:15 0 (const uint) 0:15 right-shift ( temp int) @@ -112,8 +112,8 @@ gl_FragCoord origin is upper left 0:16 'u' ( temp uint) 0:16 AtomicMax ( temp uint) 0:16 indirect index (layout( row_major std430) buffer uint) -0:16 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:16 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:16 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:16 Constant: 0:16 0 (const uint) 0:16 right-shift ( temp int) @@ -123,10 +123,10 @@ gl_FragCoord origin is upper left 0:16 2 (const int) 0:16 Constant: 0:16 1 (const int) -0:17 AtomicMin ( temp void) +0:17 AtomicMin ( temp uint) 0:17 indirect index (layout( row_major std430) buffer uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 right-shift ( temp int) @@ -140,8 +140,8 @@ gl_FragCoord origin is upper left 0:18 'u' ( temp uint) 0:18 AtomicMin ( temp uint) 0:18 indirect index (layout( row_major std430) buffer uint) -0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:18 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:18 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:18 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:18 Constant: 0:18 0 (const uint) 0:18 right-shift ( temp int) @@ -151,10 +151,10 @@ gl_FragCoord origin is upper left 0:18 2 (const int) 0:18 Constant: 0:18 1 (const int) -0:19 AtomicOr ( temp void) +0:19 AtomicOr ( temp uint) 0:19 indirect index (layout( row_major std430) buffer uint) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 right-shift ( temp int) @@ -168,8 +168,8 @@ gl_FragCoord origin is upper left 0:20 'u' ( temp uint) 0:20 AtomicOr ( temp uint) 0:20 indirect index (layout( row_major std430) buffer uint) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 right-shift ( temp int) @@ -179,10 +179,10 @@ gl_FragCoord origin is upper left 0:20 2 (const int) 0:20 Constant: 0:20 1 (const int) -0:21 AtomicXor ( temp void) +0:21 AtomicXor ( temp uint) 0:21 indirect index (layout( row_major std430) buffer uint) -0:21 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:21 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:21 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:21 Constant: 0:21 0 (const uint) 0:21 right-shift ( temp int) @@ -196,8 +196,8 @@ gl_FragCoord origin is upper left 0:22 'u' ( temp uint) 0:22 AtomicXor ( temp uint) 0:22 indirect index (layout( row_major std430) buffer uint) -0:22 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:22 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:22 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:22 Constant: 0:22 0 (const uint) 0:22 right-shift ( temp int) @@ -211,8 +211,8 @@ gl_FragCoord origin is upper left 0:24 Construct vec4 ( temp 4-component vector of float) 0:24 Convert uint to float ( temp float) 0:24 indirect index (layout( row_major std430) buffer uint) -0:24 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:24 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:24 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:24 Constant: 0:24 0 (const uint) 0:24 right-shift ( temp int) @@ -230,7 +230,7 @@ gl_FragCoord origin is upper left 0:5 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -245,10 +245,10 @@ gl_FragCoord origin is upper left 0:5 Function Parameters: 0:5 'pos' ( in uint) 0:? Sequence -0:8 AtomicAdd ( temp void) +0:8 AtomicAdd ( temp uint) 0:8 indirect index (layout( row_major std430) buffer uint) -0:8 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:8 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:8 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:8 Constant: 0:8 0 (const uint) 0:8 right-shift ( temp int) @@ -262,8 +262,8 @@ gl_FragCoord origin is upper left 0:9 'u' ( temp uint) 0:9 AtomicAdd ( temp uint) 0:9 indirect index (layout( row_major std430) buffer uint) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 right-shift ( temp int) @@ -273,10 +273,10 @@ gl_FragCoord origin is upper left 0:9 2 (const int) 0:9 Constant: 0:9 1 (const int) -0:10 AtomicAnd ( temp void) +0:10 AtomicAnd ( temp uint) 0:10 indirect index (layout( row_major std430) buffer uint) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 right-shift ( temp int) @@ -290,8 +290,8 @@ gl_FragCoord origin is upper left 0:11 'u' ( temp uint) 0:11 AtomicAnd ( temp uint) 0:11 indirect index (layout( row_major std430) buffer uint) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 right-shift ( temp int) @@ -306,8 +306,8 @@ gl_FragCoord origin is upper left 0:12 Convert int to uint ( temp uint) 0:12 AtomicCompSwap ( temp int) 0:12 indirect index (layout( row_major std430) buffer uint) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 right-shift ( temp int) @@ -323,8 +323,8 @@ gl_FragCoord origin is upper left 0:14 'u' ( temp uint) 0:14 AtomicExchange ( temp uint) 0:14 indirect index (layout( row_major std430) buffer uint) -0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:14 Constant: 0:14 0 (const uint) 0:14 right-shift ( temp int) @@ -334,10 +334,10 @@ gl_FragCoord origin is upper left 0:14 2 (const int) 0:14 Constant: 0:14 1 (const int) -0:15 AtomicMax ( temp void) +0:15 AtomicMax ( temp uint) 0:15 indirect index (layout( row_major std430) buffer uint) -0:15 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:15 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:15 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:15 Constant: 0:15 0 (const uint) 0:15 right-shift ( temp int) @@ -351,8 +351,8 @@ gl_FragCoord origin is upper left 0:16 'u' ( temp uint) 0:16 AtomicMax ( temp uint) 0:16 indirect index (layout( row_major std430) buffer uint) -0:16 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:16 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:16 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:16 Constant: 0:16 0 (const uint) 0:16 right-shift ( temp int) @@ -362,10 +362,10 @@ gl_FragCoord origin is upper left 0:16 2 (const int) 0:16 Constant: 0:16 1 (const int) -0:17 AtomicMin ( temp void) +0:17 AtomicMin ( temp uint) 0:17 indirect index (layout( row_major std430) buffer uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 right-shift ( temp int) @@ -379,8 +379,8 @@ gl_FragCoord origin is upper left 0:18 'u' ( temp uint) 0:18 AtomicMin ( temp uint) 0:18 indirect index (layout( row_major std430) buffer uint) -0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:18 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:18 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:18 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:18 Constant: 0:18 0 (const uint) 0:18 right-shift ( temp int) @@ -390,10 +390,10 @@ gl_FragCoord origin is upper left 0:18 2 (const int) 0:18 Constant: 0:18 1 (const int) -0:19 AtomicOr ( temp void) +0:19 AtomicOr ( temp uint) 0:19 indirect index (layout( row_major std430) buffer uint) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 right-shift ( temp int) @@ -407,8 +407,8 @@ gl_FragCoord origin is upper left 0:20 'u' ( temp uint) 0:20 AtomicOr ( temp uint) 0:20 indirect index (layout( row_major std430) buffer uint) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 right-shift ( temp int) @@ -418,10 +418,10 @@ gl_FragCoord origin is upper left 0:20 2 (const int) 0:20 Constant: 0:20 1 (const int) -0:21 AtomicXor ( temp void) +0:21 AtomicXor ( temp uint) 0:21 indirect index (layout( row_major std430) buffer uint) -0:21 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:21 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:21 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:21 Constant: 0:21 0 (const uint) 0:21 right-shift ( temp int) @@ -435,8 +435,8 @@ gl_FragCoord origin is upper left 0:22 'u' ( temp uint) 0:22 AtomicXor ( temp uint) 0:22 indirect index (layout( row_major std430) buffer uint) -0:22 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:22 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:22 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:22 Constant: 0:22 0 (const uint) 0:22 right-shift ( temp int) @@ -450,8 +450,8 @@ gl_FragCoord origin is upper left 0:24 Construct vec4 ( temp 4-component vector of float) 0:24 Convert uint to float ( temp float) 0:24 indirect index (layout( row_major std430) buffer uint) -0:24 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:24 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:24 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:24 Constant: 0:24 0 (const uint) 0:24 right-shift ( temp int) @@ -469,12 +469,16 @@ gl_FragCoord origin is upper left 0:5 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) +error: SPIRV-Tools Validation Errors +error: AtomicIAdd: expected Value to be of type Result Type + %28 = OpAtomicIAdd %uint %24 %uint_1 %uint_0 %int_1 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 87 Capability Shader @@ -542,14 +546,14 @@ gl_FragCoord origin is upper left 29(u): 7(ptr) Variable Function 22: 18(int) ShiftRightArithmetic 20 21 24: 23(ptr) AccessChain 17(sbuf) 19 22 - 28: 2 AtomicIAdd 24 26 27 25 + 28: 6(int) AtomicIAdd 24 26 27 25 30: 18(int) ShiftRightArithmetic 20 21 31: 23(ptr) AccessChain 17(sbuf) 19 30 32: 6(int) AtomicIAdd 31 26 27 25 Store 29(u) 32 33: 18(int) ShiftRightArithmetic 20 21 34: 23(ptr) AccessChain 17(sbuf) 19 33 - 35: 2 AtomicAnd 34 26 27 25 + 35: 6(int) AtomicAnd 34 26 27 25 36: 18(int) ShiftRightArithmetic 20 21 37: 23(ptr) AccessChain 17(sbuf) 19 36 38: 6(int) AtomicAnd 37 26 27 25 @@ -565,28 +569,28 @@ gl_FragCoord origin is upper left Store 29(u) 45 46: 18(int) ShiftRightArithmetic 20 21 47: 23(ptr) AccessChain 17(sbuf) 19 46 - 48: 2 AtomicSMax 47 26 27 25 + 48: 6(int) AtomicUMax 47 26 27 25 49: 18(int) ShiftRightArithmetic 20 21 50: 23(ptr) AccessChain 17(sbuf) 19 49 51: 6(int) AtomicUMax 50 26 27 25 Store 29(u) 51 52: 18(int) ShiftRightArithmetic 20 21 53: 23(ptr) AccessChain 17(sbuf) 19 52 - 54: 2 AtomicSMin 53 26 27 25 + 54: 6(int) AtomicUMin 53 26 27 25 55: 18(int) ShiftRightArithmetic 20 21 56: 23(ptr) AccessChain 17(sbuf) 19 55 57: 6(int) AtomicUMin 56 26 27 25 Store 29(u) 57 58: 18(int) ShiftRightArithmetic 20 21 59: 23(ptr) AccessChain 17(sbuf) 19 58 - 60: 2 AtomicOr 59 26 27 25 + 60: 6(int) AtomicOr 59 26 27 25 61: 18(int) ShiftRightArithmetic 20 21 62: 23(ptr) AccessChain 17(sbuf) 19 61 63: 6(int) AtomicOr 62 26 27 25 Store 29(u) 63 64: 18(int) ShiftRightArithmetic 20 21 65: 23(ptr) AccessChain 17(sbuf) 19 64 - 66: 2 AtomicXor 65 26 27 25 + 66: 6(int) AtomicXor 65 26 27 25 67: 18(int) ShiftRightArithmetic 20 21 68: 23(ptr) AccessChain 17(sbuf) 19 67 69: 6(int) AtomicXor 68 26 27 25 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out index a4084aee4d5..a23ccd24465 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out @@ -10,8 +10,8 @@ gl_FragCoord origin is upper left 0:7 move second child to first child ( temp uint) 0:7 'size' ( temp uint) 0:7 array length ( temp uint) -0:7 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:7 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:7 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:7 Constant: 0:7 0 (const uint) 0:12 Branch: Return with expression @@ -20,8 +20,8 @@ gl_FragCoord origin is upper left 0:9 add ( temp 4-component vector of float) 0:9 Convert uint to float ( temp float) 0:9 indirect index (layout( row_major std430) buffer uint) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 right-shift ( temp int) @@ -41,15 +41,15 @@ gl_FragCoord origin is upper left 0:10 Constant: 0:10 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) @@ -73,24 +73,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -111,33 +111,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -155,7 +155,7 @@ gl_FragCoord origin is upper left 0:5 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -174,8 +174,8 @@ gl_FragCoord origin is upper left 0:7 move second child to first child ( temp uint) 0:7 'size' ( temp uint) 0:7 array length ( temp uint) -0:7 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:7 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:7 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:7 Constant: 0:7 0 (const uint) 0:12 Branch: Return with expression @@ -184,8 +184,8 @@ gl_FragCoord origin is upper left 0:9 add ( temp 4-component vector of float) 0:9 Convert uint to float ( temp float) 0:9 indirect index (layout( row_major std430) buffer uint) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 right-shift ( temp int) @@ -205,15 +205,15 @@ gl_FragCoord origin is upper left 0:10 Constant: 0:10 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) @@ -237,24 +237,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -275,33 +275,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -319,12 +319,12 @@ gl_FragCoord origin is upper left 0:5 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 114 Capability Shader @@ -366,13 +366,13 @@ gl_FragCoord origin is upper left 16(sbuf): TypeStruct 15 17: TypePointer Uniform 16(sbuf) 18(sbuf): 17(ptr) Variable Uniform - 19: TypeInt 32 1 - 21: 19(int) Constant 0 - 23: 19(int) Constant 2 + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 23: 20(int) Constant 2 25: TypePointer Uniform 6(int) - 29: TypePointer Function 19(int) + 29: TypePointer Function 20(int) 32: 6(int) Constant 4 - 39: 19(int) Constant 1 + 39: 20(int) Constant 1 43: TypeVector 6(int) 2 45: TypeVector 8(float) 2 47: 8(float) Constant 0 @@ -380,7 +380,7 @@ gl_FragCoord origin is upper left 69: TypeVector 6(int) 3 71: TypeVector 8(float) 3 80: 6(int) Constant 12 - 95: 19(int) Constant 3 + 95: 20(int) Constant 3 99: TypeVector 6(int) 4 106: TypePointer Input 6(int) 107(pos): 106(ptr) Variable Input @@ -405,22 +405,22 @@ gl_FragCoord origin is upper left 30(byteAddrTemp): 29(ptr) Variable Function 53(byteAddrTemp): 29(ptr) Variable Function 78(byteAddrTemp): 29(ptr) Variable Function - 20: 19(int) ArrayLength 18(sbuf) 0 - Store 14(size) 20 + 19: 6(int) ArrayLength 18(sbuf) 0 + Store 14(size) 19 22: 6(int) Load 11(pos) - 24: 19(int) ShiftRightLogical 22 23 + 24: 20(int) ShiftRightLogical 22 23 26: 25(ptr) AccessChain 18(sbuf) 21 24 27: 6(int) Load 26 28: 8(float) ConvertUToF 27 31: 6(int) Load 11(pos) 33: 6(int) IAdd 31 32 - 34: 19(int) ShiftRightLogical 33 23 + 34: 20(int) ShiftRightLogical 33 23 Store 30(byteAddrTemp) 34 - 35: 19(int) Load 30(byteAddrTemp) + 35: 20(int) Load 30(byteAddrTemp) 36: 25(ptr) AccessChain 18(sbuf) 21 35 37: 6(int) Load 36 - 38: 19(int) Load 30(byteAddrTemp) - 40: 19(int) IAdd 38 39 + 38: 20(int) Load 30(byteAddrTemp) + 40: 20(int) IAdd 38 39 41: 25(ptr) AccessChain 18(sbuf) 21 40 42: 6(int) Load 41 44: 43(ivec2) CompositeConstruct 37 42 @@ -432,17 +432,17 @@ gl_FragCoord origin is upper left 52: 9(fvec4) FAdd 51 50 54: 6(int) Load 11(pos) 56: 6(int) IAdd 54 55 - 57: 19(int) ShiftRightLogical 56 23 + 57: 20(int) ShiftRightLogical 56 23 Store 53(byteAddrTemp) 57 - 58: 19(int) Load 53(byteAddrTemp) + 58: 20(int) Load 53(byteAddrTemp) 59: 25(ptr) AccessChain 18(sbuf) 21 58 60: 6(int) Load 59 - 61: 19(int) Load 53(byteAddrTemp) - 62: 19(int) IAdd 61 39 + 61: 20(int) Load 53(byteAddrTemp) + 62: 20(int) IAdd 61 39 63: 25(ptr) AccessChain 18(sbuf) 21 62 64: 6(int) Load 63 - 65: 19(int) Load 53(byteAddrTemp) - 66: 19(int) IAdd 65 23 + 65: 20(int) Load 53(byteAddrTemp) + 66: 20(int) IAdd 65 23 67: 25(ptr) AccessChain 18(sbuf) 21 66 68: 6(int) Load 67 70: 69(ivec3) CompositeConstruct 60 64 68 @@ -454,21 +454,21 @@ gl_FragCoord origin is upper left 77: 9(fvec4) FAdd 52 76 79: 6(int) Load 11(pos) 81: 6(int) IAdd 79 80 - 82: 19(int) ShiftRightLogical 81 23 + 82: 20(int) ShiftRightLogical 81 23 Store 78(byteAddrTemp) 82 - 83: 19(int) Load 78(byteAddrTemp) + 83: 20(int) Load 78(byteAddrTemp) 84: 25(ptr) AccessChain 18(sbuf) 21 83 85: 6(int) Load 84 - 86: 19(int) Load 78(byteAddrTemp) - 87: 19(int) IAdd 86 39 + 86: 20(int) Load 78(byteAddrTemp) + 87: 20(int) IAdd 86 39 88: 25(ptr) AccessChain 18(sbuf) 21 87 89: 6(int) Load 88 - 90: 19(int) Load 78(byteAddrTemp) - 91: 19(int) IAdd 90 23 + 90: 20(int) Load 78(byteAddrTemp) + 91: 20(int) IAdd 90 23 92: 25(ptr) AccessChain 18(sbuf) 21 91 93: 6(int) Load 92 - 94: 19(int) Load 78(byteAddrTemp) - 96: 19(int) IAdd 94 95 + 94: 20(int) Load 78(byteAddrTemp) + 96: 20(int) IAdd 94 95 97: 25(ptr) AccessChain 18(sbuf) 21 96 98: 6(int) Load 97 100: 99(ivec4) CompositeConstruct 85 89 93 98 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out index baed6ffbd7f..738e13dd013 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out @@ -8,8 +8,8 @@ gl_FragCoord origin is upper left 0:? Sequence 0:13 move second child to first child ( temp float) 0:13 indirect index (layout( row_major std430) buffer float) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:13 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:13 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 add ( temp uint) @@ -22,8 +22,8 @@ gl_FragCoord origin is upper left 0:17 move second child to first child ( temp uint) 0:17 'size' ( temp uint) 0:17 array length ( temp uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:17 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:17 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 move second child to first child ( temp uint) @@ -34,8 +34,8 @@ gl_FragCoord origin is upper left 0:19 Condition 0:19 test: direct index for structure ( temp bool) 0:19 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:19 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:19 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 'pos' ( in uint) @@ -47,16 +47,16 @@ gl_FragCoord origin is upper left 0:20 add ( temp 3-component vector of float) 0:20 color: direct index for structure ( temp 3-component vector of float) 0:20 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:20 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:20 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) 0:20 Constant: 0:20 0 (const int) 0:20 indirect index (layout( row_major std430) buffer float) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:20 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:20 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) @@ -80,8 +80,8 @@ gl_FragCoord origin is upper left 0:12 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) -0:? 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:? 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -98,8 +98,8 @@ gl_FragCoord origin is upper left 0:? Sequence 0:13 move second child to first child ( temp float) 0:13 indirect index (layout( row_major std430) buffer float) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:13 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:13 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 add ( temp uint) @@ -112,8 +112,8 @@ gl_FragCoord origin is upper left 0:17 move second child to first child ( temp uint) 0:17 'size' ( temp uint) 0:17 array length ( temp uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:17 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:17 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 move second child to first child ( temp uint) @@ -124,8 +124,8 @@ gl_FragCoord origin is upper left 0:19 Condition 0:19 test: direct index for structure ( temp bool) 0:19 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:19 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:19 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 'pos' ( in uint) @@ -137,16 +137,16 @@ gl_FragCoord origin is upper left 0:20 add ( temp 3-component vector of float) 0:20 color: direct index for structure ( temp 3-component vector of float) 0:20 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:20 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:20 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) 0:20 Constant: 0:20 0 (const int) 0:20 indirect index (layout( row_major std430) buffer float) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:20 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:20 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) @@ -170,13 +170,13 @@ gl_FragCoord origin is upper left 0:12 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) -0:? 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:? 'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 78 Capability Shader @@ -272,7 +272,7 @@ gl_FragCoord origin is upper left 22: 6(int) IAdd 20 21 25: 24(ptr) AccessChain 17(sbuf2) 19 22 Store 25 23 - 33: 18(int) ArrayLength 32(sbuf) 0 + 33: 6(int) ArrayLength 32(sbuf) 0 Store 26(size) 33 Store 34(stride) 35 36: 6(int) Load 11(pos) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out index 9b49bc78633..82e307beabb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.floatidx.comp.out @@ -10,18 +10,18 @@ local_size = (1, 1, 1) 0:14 move second child to first child ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) 0:14 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) 0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) -0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) -0:14 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) +0:14 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) 0:14 Constant: 0:14 0 (const uint) 0:14 add ( temp uint) 0:14 AtomicAdd ( temp uint) -0:14 @count: direct index for structure ( temp int) -0:14 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:14 @count: direct index for structure ( temp uint) +0:14 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:14 Constant: 0:14 0 (const int) 0:14 Constant: -0:14 -1 (const int) +0:14 4294967295 (const uint) 0:14 Constant: 0:14 -1 (const int) 0:15 Sequence @@ -53,8 +53,8 @@ local_size = (1, 1, 1) 0:16 'storeTemp' ( temp 4-component vector of float) 0:18 move second child to first child ( temp 4-component vector of float) 0:18 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:18 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:18 Constant: 0:18 0 (const uint) 0:18 Convert float to uint ( temp uint) @@ -63,8 +63,8 @@ local_size = (1, 1, 1) 0:18 Constant: 0:18 0 (const int) 0:18 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:18 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:18 Constant: 0:18 0 (const uint) 0:18 Convert float to uint ( temp uint) @@ -82,9 +82,9 @@ local_size = (1, 1, 1) 0:? 'nThreadId' ( temp 3-component vector of uint) 0:? Linker Objects 0:? 'outtx' (layout( rgba32f) uniform image2D) -0:? 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) -0:? 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:? 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) +0:? 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? 'nThreadId' ( in 3-component vector of uint GlobalInvocationID) @@ -102,18 +102,18 @@ local_size = (1, 1, 1) 0:14 move second child to first child ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) 0:14 'data' ( temp structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) 0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) -0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) -0:14 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId}) +0:14 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) 0:14 Constant: 0:14 0 (const uint) 0:14 add ( temp uint) 0:14 AtomicAdd ( temp uint) -0:14 @count: direct index for structure ( temp int) -0:14 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:14 @count: direct index for structure ( temp uint) +0:14 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:14 Constant: 0:14 0 (const int) 0:14 Constant: -0:14 -1 (const int) +0:14 4294967295 (const uint) 0:14 Constant: 0:14 -1 (const int) 0:15 Sequence @@ -145,8 +145,8 @@ local_size = (1, 1, 1) 0:16 'storeTemp' ( temp 4-component vector of float) 0:18 move second child to first child ( temp 4-component vector of float) 0:18 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:18 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:18 Constant: 0:18 0 (const uint) 0:18 Convert float to uint ( temp uint) @@ -155,8 +155,8 @@ local_size = (1, 1, 1) 0:18 Constant: 0:18 0 (const int) 0:18 indirect index (layout( row_major std430) buffer 4-component vector of float) -0:18 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of float) -0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:18 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of float) +0:18 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:18 Constant: 0:18 0 (const uint) 0:18 Convert float to uint ( temp uint) @@ -174,19 +174,19 @@ local_size = (1, 1, 1) 0:? 'nThreadId' ( temp 3-component vector of uint) 0:? Linker Objects 0:? 'outtx' (layout( rgba32f) uniform image2D) -0:? 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) -0:? 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data}) +0:? 'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color, temp 2-component vector of uint threadId} @data}) +0:? 'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data}) 0:? 'nThreadId' ( in 3-component vector of uint GlobalInvocationID) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 84 +// Generated by (magic number): 80007 +// Id's are bound by 85 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 4 "main" 79 + EntryPoint GLCompute 4 "main" 80 ExecutionMode 4 LocalSize 1 1 1 Source HLSL 500 Name 4 "main" @@ -205,15 +205,15 @@ local_size = (1, 1, 1) Name 26 "csb@count" MemberName 26(csb@count) 0 "@count" Name 28 "csb@count" - Name 48 "coord" - Name 52 "storeTemp" - Name 57 "outtx" - Name 63 "rwsb" - MemberName 63(rwsb) 0 "@data" - Name 65 "rwsb" - Name 77 "nThreadId" - Name 79 "nThreadId" - Name 81 "param" + Name 49 "coord" + Name 53 "storeTemp" + Name 58 "outtx" + Name 64 "rwsb" + MemberName 64(rwsb) 0 "@data" + Name 66 "rwsb" + Name 78 "nThreadId" + Name 80 "nThreadId" + Name 82 "param" MemberDecorate 19(sb_t) 0 Offset 0 MemberDecorate 19(sb_t) 1 Offset 16 Decorate 20 ArrayStride 32 @@ -224,12 +224,12 @@ local_size = (1, 1, 1) MemberDecorate 26(csb@count) 0 Offset 0 Decorate 26(csb@count) BufferBlock Decorate 28(csb@count) DescriptorSet 0 - Decorate 57(outtx) DescriptorSet 0 - Decorate 62 ArrayStride 16 - MemberDecorate 63(rwsb) 0 Offset 0 - Decorate 63(rwsb) BufferBlock - Decorate 65(rwsb) DescriptorSet 0 - Decorate 79(nThreadId) BuiltIn GlobalInvocationId + Decorate 58(outtx) DescriptorSet 0 + Decorate 63 ArrayStride 16 + MemberDecorate 64(rwsb) 0 Offset 0 + Decorate 64(rwsb) BufferBlock + Decorate 66(rwsb) DescriptorSet 0 + Decorate 80(nThreadId) BuiltIn GlobalInvocationId 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -248,79 +248,80 @@ local_size = (1, 1, 1) 23(csb): 22(ptr) Variable Uniform 24: TypeInt 32 1 25: 24(int) Constant 0 - 26(csb@count): TypeStruct 24(int) + 26(csb@count): TypeStruct 6(int) 27: TypePointer Uniform 26(csb@count) 28(csb@count): 27(ptr) Variable Uniform - 29: TypePointer Uniform 24(int) - 31: 24(int) Constant 4294967295 + 29: TypePointer Uniform 6(int) + 31: 6(int) Constant 4294967295 32: 6(int) Constant 1 33: 6(int) Constant 0 - 36: TypePointer Uniform 19(sb_t) - 40: TypePointer Function 14(fvec4) - 43: 24(int) Constant 1 - 44: TypePointer Function 15(ivec2) - 46: TypeVector 13(float) 2 - 47: TypePointer Function 46(fvec2) - 55: TypeImage 13(float) 2D nonsampled format:Rgba32f - 56: TypePointer UniformConstant 55 - 57(outtx): 56(ptr) Variable UniformConstant - 62: TypeRuntimeArray 14(fvec4) - 63(rwsb): TypeStruct 62 - 64: TypePointer Uniform 63(rwsb) - 65(rwsb): 64(ptr) Variable Uniform - 66: TypePointer Function 13(float) - 73: TypePointer Uniform 14(fvec4) - 78: TypePointer Input 7(ivec3) - 79(nThreadId): 78(ptr) Variable Input + 35: 24(int) Constant 4294967295 + 37: TypePointer Uniform 19(sb_t) + 41: TypePointer Function 14(fvec4) + 44: 24(int) Constant 1 + 45: TypePointer Function 15(ivec2) + 47: TypeVector 13(float) 2 + 48: TypePointer Function 47(fvec2) + 56: TypeImage 13(float) 2D nonsampled format:Rgba32f + 57: TypePointer UniformConstant 56 + 58(outtx): 57(ptr) Variable UniformConstant + 63: TypeRuntimeArray 14(fvec4) + 64(rwsb): TypeStruct 63 + 65: TypePointer Uniform 64(rwsb) + 66(rwsb): 65(ptr) Variable Uniform + 67: TypePointer Function 13(float) + 74: TypePointer Uniform 14(fvec4) + 79: TypePointer Input 7(ivec3) + 80(nThreadId): 79(ptr) Variable Input 4(main): 2 Function None 3 5: Label - 77(nThreadId): 8(ptr) Variable Function - 81(param): 8(ptr) Variable Function - 80: 7(ivec3) Load 79(nThreadId) - Store 77(nThreadId) 80 - 82: 7(ivec3) Load 77(nThreadId) - Store 81(param) 82 - 83: 2 FunctionCall 11(@main(vu3;) 81(param) + 78(nThreadId): 8(ptr) Variable Function + 82(param): 8(ptr) Variable Function + 81: 7(ivec3) Load 80(nThreadId) + Store 78(nThreadId) 81 + 83: 7(ivec3) Load 78(nThreadId) + Store 82(param) 83 + 84: 2 FunctionCall 11(@main(vu3;) 82(param) Return FunctionEnd 11(@main(vu3;): 2 Function None 9 10(nThreadId): 8(ptr) FunctionParameter 12: Label 18(data): 17(ptr) Variable Function - 48(coord): 47(ptr) Variable Function - 52(storeTemp): 40(ptr) Variable Function + 49(coord): 48(ptr) Variable Function + 53(storeTemp): 41(ptr) Variable Function 30: 29(ptr) AccessChain 28(csb@count) 25 34: 6(int) AtomicIAdd 30 32 33 31 - 35: 6(int) IAdd 34 31 - 37: 36(ptr) AccessChain 23(csb) 25 35 - 38: 19(sb_t) Load 37 - 39: 14(fvec4) CompositeExtract 38 0 - 41: 40(ptr) AccessChain 18(data) 25 - Store 41 39 - 42: 15(ivec2) CompositeExtract 38 1 - 45: 44(ptr) AccessChain 18(data) 43 - Store 45 42 - 49: 44(ptr) AccessChain 18(data) 43 - 50: 15(ivec2) Load 49 - 51: 46(fvec2) ConvertUToF 50 - Store 48(coord) 51 - 53: 40(ptr) AccessChain 18(data) 25 - 54: 14(fvec4) Load 53 - Store 52(storeTemp) 54 - 58: 55 Load 57(outtx) - 59: 46(fvec2) Load 48(coord) - 60: 15(ivec2) ConvertFToU 59 - 61: 14(fvec4) Load 52(storeTemp) - ImageWrite 58 60 61 - 67: 66(ptr) AccessChain 48(coord) 33 - 68: 13(float) Load 67 - 69: 6(int) ConvertFToU 68 - 70: 66(ptr) AccessChain 48(coord) 32 - 71: 13(float) Load 70 - 72: 6(int) ConvertFToU 71 - 74: 73(ptr) AccessChain 65(rwsb) 25 72 - 75: 14(fvec4) Load 74 - 76: 73(ptr) AccessChain 65(rwsb) 25 69 - Store 76 75 + 36: 6(int) IAdd 34 35 + 38: 37(ptr) AccessChain 23(csb) 25 36 + 39: 19(sb_t) Load 38 + 40: 14(fvec4) CompositeExtract 39 0 + 42: 41(ptr) AccessChain 18(data) 25 + Store 42 40 + 43: 15(ivec2) CompositeExtract 39 1 + 46: 45(ptr) AccessChain 18(data) 44 + Store 46 43 + 50: 45(ptr) AccessChain 18(data) 44 + 51: 15(ivec2) Load 50 + 52: 47(fvec2) ConvertUToF 51 + Store 49(coord) 52 + 54: 41(ptr) AccessChain 18(data) 25 + 55: 14(fvec4) Load 54 + Store 53(storeTemp) 55 + 59: 56 Load 58(outtx) + 60: 47(fvec2) Load 49(coord) + 61: 15(ivec2) ConvertFToU 60 + 62: 14(fvec4) Load 53(storeTemp) + ImageWrite 59 61 62 + 68: 67(ptr) AccessChain 49(coord) 33 + 69: 13(float) Load 68 + 70: 6(int) ConvertFToU 69 + 71: 67(ptr) AccessChain 49(coord) 32 + 72: 13(float) Load 71 + 73: 6(int) ConvertFToU 72 + 75: 74(ptr) AccessChain 66(rwsb) 25 73 + 76: 14(fvec4) Load 75 + 77: 74(ptr) AccessChain 66(rwsb) 25 70 + Store 77 76 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out index e5e68f11c53..4b8ee635eef 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out @@ -4,27 +4,27 @@ gl_FragCoord origin is upper left 0:? Sequence 0:5 Function Definition: get(block--vu4[0]1;u1; ( temp 4-component vector of uint) 0:5 Function Parameters: -0:5 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:5 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:5 'bufferOffset' ( in uint) 0:? Sequence 0:6 Branch: Return with expression 0:6 indirect index (layout( row_major std430) buffer 4-component vector of uint) -0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:6 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:6 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:6 Constant: 0:6 0 (const uint) 0:6 'bufferOffset' ( in uint) 0:10 Function Definition: set(block--vu4[0]1;u1;vu4; ( temp void) 0:10 Function Parameters: -0:10 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:10 'sb@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:10 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:10 'sb@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:10 'bufferOffset' ( in uint) 0:10 'data' ( in 4-component vector of uint) 0:? Sequence 0:11 move second child to first child ( temp 4-component vector of uint) 0:11 indirect index ( buffer 4-component vector of uint) -0:11 @data: direct index for structure ( buffer implicitly-sized array of 4-component vector of uint) -0:11 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:11 @data: direct index for structure ( buffer unsized 1-element array of 4-component vector of uint) +0:11 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'bufferOffset' ( in uint) @@ -34,12 +34,12 @@ gl_FragCoord origin is upper left 0:20 'pos' ( in uint) 0:? Sequence 0:21 Function Call: set(block--vu4[0]1;u1;vu4; ( temp void) -0:21 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:21 'sbuf2@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:21 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:21 'sbuf2@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:21 Constant: 0:21 2 (const uint) 0:21 Function Call: get(block--vu4[0]1;u1; ( temp 4-component vector of uint) -0:21 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:21 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:21 Constant: 0:21 3 (const uint) 0:23 Branch: Return with expression @@ -59,10 +59,10 @@ gl_FragCoord origin is upper left 0:20 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 3-component vector of uint @data}) +0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 3-component vector of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -75,27 +75,27 @@ gl_FragCoord origin is upper left 0:? Sequence 0:5 Function Definition: get(block--vu4[0]1;u1; ( temp 4-component vector of uint) 0:5 Function Parameters: -0:5 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:5 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:5 'bufferOffset' ( in uint) 0:? Sequence 0:6 Branch: Return with expression 0:6 indirect index (layout( row_major std430) buffer 4-component vector of uint) -0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:6 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:6 'sb' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:6 Constant: 0:6 0 (const uint) 0:6 'bufferOffset' ( in uint) 0:10 Function Definition: set(block--vu4[0]1;u1;vu4; ( temp void) 0:10 Function Parameters: -0:10 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:10 'sb@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:10 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:10 'sb@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:10 'bufferOffset' ( in uint) 0:10 'data' ( in 4-component vector of uint) 0:? Sequence 0:11 move second child to first child ( temp 4-component vector of uint) 0:11 indirect index ( buffer 4-component vector of uint) -0:11 @data: direct index for structure ( buffer implicitly-sized array of 4-component vector of uint) -0:11 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:11 @data: direct index for structure ( buffer unsized 1-element array of 4-component vector of uint) +0:11 'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'bufferOffset' ( in uint) @@ -105,12 +105,12 @@ gl_FragCoord origin is upper left 0:20 'pos' ( in uint) 0:? Sequence 0:21 Function Call: set(block--vu4[0]1;u1;vu4; ( temp void) -0:21 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:21 'sbuf2@count' ( buffer block{layout( row_major std430) buffer int @count}) +0:21 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:21 'sbuf2@count' ( buffer block{layout( row_major std430) buffer uint @count}) 0:21 Constant: 0:21 2 (const uint) 0:21 Function Call: get(block--vu4[0]1;u1; ( temp 4-component vector of uint) -0:21 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:21 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:21 Constant: 0:21 3 (const uint) 0:23 Branch: Return with expression @@ -130,21 +130,25 @@ gl_FragCoord origin is upper left 0:20 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 3-component vector of uint @data}) +0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 3-component vector of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) +error: SPIRV-Tools Validation Errors +error: Structure id 20 decorated as BufferBlock must be explicitly laid out with Offset decorations. + %__1 = OpTypeStruct %uint + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 83 +// Generated by (magic number): 80007 +// Id's are bound by 78 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 68 71 + EntryPoint Fragment 4 "main" 63 66 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -155,34 +159,31 @@ gl_FragCoord origin is upper left Name 14 "bufferOffset" Name 18 "" MemberName 18 0 "@data" - Name 21 "" - MemberName 21 0 "@count" - Name 29 "set(block--vu4[0]1;u1;vu4;" - Name 25 "sb" - Name 26 "sb@count" - Name 27 "bufferOffset" - Name 28 "data" - Name 35 "@main(u1;" - Name 34 "pos" + Name 20 "" + MemberName 20 0 "@count" + Name 28 "set(block--vu4[0]1;u1;vu4;" + Name 24 "sb" + Name 25 "sb@count" + Name 26 "bufferOffset" + Name 27 "data" + Name 34 "@main(u1;" + Name 33 "pos" Name 47 "sbuf2" - Name 49 "sbuf2@count" - Name 52 "sbuf" + Name 48 "sbuf2@count" + Name 50 "sbuf" + Name 52 "param" Name 54 "param" Name 55 "param" - Name 57 "param" - Name 58 "param" - Name 59 "param" - Name 60 "param" - Name 66 "pos" - Name 68 "pos" - Name 71 "@entryPointOutput" - Name 72 "param" - Name 75 "sbuf2@count" - MemberName 75(sbuf2@count) 0 "@count" - Name 77 "sbuf2@count" - Name 80 "sbuf3" - MemberName 80(sbuf3) 0 "@data" - Name 82 "sbuf3" + Name 61 "pos" + Name 63 "pos" + Name 66 "@entryPointOutput" + Name 67 "param" + Name 70 "sbuf2@count" + MemberName 70(sbuf2@count) 0 "@count" + Name 72 "sbuf2@count" + Name 75 "sbuf3" + MemberName 75(sbuf3) 0 "@data" + Name 77 "sbuf3" Decorate 8 ArrayStride 16 MemberDecorate 9 0 NonWritable MemberDecorate 9 0 Offset 0 @@ -191,76 +192,74 @@ gl_FragCoord origin is upper left Decorate 17 ArrayStride 16 MemberDecorate 18 0 Offset 0 Decorate 18 BufferBlock - Decorate 21 BufferBlock + Decorate 20 BufferBlock Decorate 47(sbuf2) DescriptorSet 0 - Decorate 49(sbuf2@count) DescriptorSet 0 - Decorate 52(sbuf) DescriptorSet 0 - Decorate 52(sbuf) Binding 10 - Decorate 68(pos) Flat - Decorate 68(pos) Location 0 - Decorate 71(@entryPointOutput) Location 0 - MemberDecorate 75(sbuf2@count) 0 Offset 0 - Decorate 75(sbuf2@count) BufferBlock - Decorate 77(sbuf2@count) DescriptorSet 0 - Decorate 79 ArrayStride 16 - MemberDecorate 80(sbuf3) 0 NonWritable - MemberDecorate 80(sbuf3) 0 Offset 0 - Decorate 80(sbuf3) BufferBlock - Decorate 82(sbuf3) DescriptorSet 0 - Decorate 82(sbuf3) Binding 12 + Decorate 48(sbuf2@count) DescriptorSet 0 + Decorate 50(sbuf) DescriptorSet 0 + Decorate 50(sbuf) Binding 10 + Decorate 63(pos) Flat + Decorate 63(pos) Location 0 + Decorate 66(@entryPointOutput) Location 0 + MemberDecorate 70(sbuf2@count) 0 Offset 0 + Decorate 70(sbuf2@count) BufferBlock + Decorate 72(sbuf2@count) DescriptorSet 0 + Decorate 74 ArrayStride 16 + MemberDecorate 75(sbuf3) 0 NonWritable + MemberDecorate 75(sbuf3) 0 Offset 0 + Decorate 75(sbuf3) BufferBlock + Decorate 77(sbuf3) DescriptorSet 0 + Decorate 77(sbuf3) Binding 12 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 7: TypeVector 6(int) 4 8: TypeRuntimeArray 7(ivec4) 9: TypeStruct 8 - 10: TypePointer Function 9(struct) + 10: TypePointer Uniform 9(struct) 11: TypePointer Function 6(int) 12: TypeFunction 7(ivec4) 10(ptr) 11(ptr) 17: TypeRuntimeArray 7(ivec4) 18: TypeStruct 17 - 19: TypePointer Function 18(struct) - 20: TypeInt 32 1 - 21: TypeStruct 20(int) - 22: TypePointer Function 21(struct) - 23: TypePointer Function 7(ivec4) - 24: TypeFunction 2 19(ptr) 22(ptr) 11(ptr) 23(ptr) - 31: TypeFloat 32 - 32: TypeVector 31(float) 4 - 33: TypeFunction 32(fvec4) 11(ptr) - 37: 20(int) Constant 0 - 46: TypePointer Uniform 18(struct) - 47(sbuf2): 46(ptr) Variable Uniform - 48: TypePointer Uniform 21(struct) - 49(sbuf2@count): 48(ptr) Variable Uniform - 50: 6(int) Constant 2 - 51: TypePointer Uniform 9(struct) - 52(sbuf): 51(ptr) Variable Uniform - 53: 6(int) Constant 3 - 62: 31(float) Constant 0 - 63: 32(fvec4) ConstantComposite 62 62 62 62 - 67: TypePointer Input 6(int) - 68(pos): 67(ptr) Variable Input - 70: TypePointer Output 32(fvec4) -71(@entryPointOutput): 70(ptr) Variable Output - 75(sbuf2@count): TypeStruct 20(int) - 76: TypePointer Uniform 75(sbuf2@count) - 77(sbuf2@count): 76(ptr) Variable Uniform - 78: TypeVector 6(int) 3 - 79: TypeRuntimeArray 78(ivec3) - 80(sbuf3): TypeStruct 79 - 81: TypePointer Uniform 80(sbuf3) - 82(sbuf3): 81(ptr) Variable Uniform + 19: TypePointer Uniform 18(struct) + 20: TypeStruct 6(int) + 21: TypePointer Uniform 20(struct) + 22: TypePointer Function 7(ivec4) + 23: TypeFunction 2 19(ptr) 21(ptr) 11(ptr) 22(ptr) + 30: TypeFloat 32 + 31: TypeVector 30(float) 4 + 32: TypeFunction 31(fvec4) 11(ptr) + 36: TypeInt 32 1 + 37: 36(int) Constant 0 + 39: TypePointer Uniform 7(ivec4) + 47(sbuf2): 19(ptr) Variable Uniform + 48(sbuf2@count): 21(ptr) Variable Uniform + 49: 6(int) Constant 2 + 50(sbuf): 10(ptr) Variable Uniform + 51: 6(int) Constant 3 + 57: 30(float) Constant 0 + 58: 31(fvec4) ConstantComposite 57 57 57 57 + 62: TypePointer Input 6(int) + 63(pos): 62(ptr) Variable Input + 65: TypePointer Output 31(fvec4) +66(@entryPointOutput): 65(ptr) Variable Output + 70(sbuf2@count): TypeStruct 6(int) + 71: TypePointer Uniform 70(sbuf2@count) + 72(sbuf2@count): 71(ptr) Variable Uniform + 73: TypeVector 6(int) 3 + 74: TypeRuntimeArray 73(ivec3) + 75(sbuf3): TypeStruct 74 + 76: TypePointer Uniform 75(sbuf3) + 77(sbuf3): 76(ptr) Variable Uniform 4(main): 2 Function None 3 5: Label - 66(pos): 11(ptr) Variable Function - 72(param): 11(ptr) Variable Function - 69: 6(int) Load 68(pos) - Store 66(pos) 69 - 73: 6(int) Load 66(pos) - Store 72(param) 73 - 74: 32(fvec4) FunctionCall 35(@main(u1;) 72(param) - Store 71(@entryPointOutput) 74 + 61(pos): 11(ptr) Variable Function + 67(param): 11(ptr) Variable Function + 64: 6(int) Load 63(pos) + Store 61(pos) 64 + 68: 6(int) Load 61(pos) + Store 67(param) 68 + 69: 31(fvec4) FunctionCall 34(@main(u1;) 67(param) + Store 66(@entryPointOutput) 69 Return FunctionEnd 15(get(block--vu4[0]1;u1;): 7(ivec4) Function None 12 @@ -268,35 +267,32 @@ gl_FragCoord origin is upper left 14(bufferOffset): 11(ptr) FunctionParameter 16: Label 38: 6(int) Load 14(bufferOffset) - 39: 23(ptr) AccessChain 13(sb) 37 38 - 40: 7(ivec4) Load 39 - ReturnValue 40 + 40: 39(ptr) AccessChain 13(sb) 37 38 + 41: 7(ivec4) Load 40 + ReturnValue 41 FunctionEnd -29(set(block--vu4[0]1;u1;vu4;): 2 Function None 24 - 25(sb): 19(ptr) FunctionParameter - 26(sb@count): 22(ptr) FunctionParameter -27(bufferOffset): 11(ptr) FunctionParameter - 28(data): 23(ptr) FunctionParameter - 30: Label - 43: 6(int) Load 27(bufferOffset) - 44: 7(ivec4) Load 28(data) - 45: 23(ptr) AccessChain 25(sb) 37 43 - Store 45 44 +28(set(block--vu4[0]1;u1;vu4;): 2 Function None 23 + 24(sb): 19(ptr) FunctionParameter + 25(sb@count): 21(ptr) FunctionParameter +26(bufferOffset): 11(ptr) FunctionParameter + 27(data): 22(ptr) FunctionParameter + 29: Label + 44: 6(int) Load 26(bufferOffset) + 45: 7(ivec4) Load 27(data) + 46: 39(ptr) AccessChain 24(sb) 37 44 + Store 46 45 Return FunctionEnd - 35(@main(u1;): 32(fvec4) Function None 33 - 34(pos): 11(ptr) FunctionParameter - 36: Label - 54(param): 10(ptr) Variable Function - 55(param): 11(ptr) Variable Function - 57(param): 19(ptr) Variable Function - 58(param): 22(ptr) Variable Function - 59(param): 11(ptr) Variable Function - 60(param): 23(ptr) Variable Function + 34(@main(u1;): 31(fvec4) Function None 32 + 33(pos): 11(ptr) FunctionParameter + 35: Label + 52(param): 11(ptr) Variable Function + 54(param): 11(ptr) Variable Function + 55(param): 22(ptr) Variable Function + Store 52(param) 51 + 53: 7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 50(sbuf) 52(param) + Store 54(param) 49 Store 55(param) 53 - 56: 7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 54(param) 55(param) - Store 59(param) 50 - Store 60(param) 56 - 61: 2 FunctionCall 29(set(block--vu4[0]1;u1;vu4;) 57(param) 58(param) 59(param) 60(param) - ReturnValue 63 + 56: 2 FunctionCall 28(set(block--vu4[0]1;u1;vu4;) 47(sbuf2) 48(sbuf2@count) 54(param) 55(param) + ReturnValue 58 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out index bb84b99c059..517b48c8db4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out @@ -5,7 +5,7 @@ local_size = (256, 1, 1) 0:5 Function Definition: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint) 0:5 Function Parameters: 0:5 'loc' ( in uint) -0:5 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:5 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? Sequence 0:6 Sequence 0:6 move second child to first child ( temp 2-component vector of uint) @@ -18,15 +18,15 @@ local_size = (256, 1, 1) 0:6 Constant: 0:6 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:6 indirect index ( temp float) -0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:6 indirect index ( temp uint) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:6 Constant: 0:6 0 (const uint) 0:6 'byteAddrTemp' ( temp int) -0:6 indirect index ( temp float) -0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:6 indirect index ( temp uint) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:6 Constant: 0:6 0 (const uint) 0:6 add ( temp int) @@ -44,7 +44,7 @@ local_size = (256, 1, 1) 0:13 'result' ( temp 2-component vector of uint) 0:13 Function Call: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint) 0:13 'dispatchId' ( in uint) -0:13 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:13 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:14 Sequence 0:14 imageStore ( temp void) 0:14 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer) @@ -56,13 +56,14 @@ local_size = (256, 1, 1) 0:? Sequence 0:12 move second child to first child ( temp uint) 0:? 'dispatchId' ( temp uint) -0:? 'dispatchId' ( in uint GlobalInvocationID) +0:? Construct uint ( temp uint) +0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID) 0:12 Function Call: @main(u1; ( temp void) 0:? 'dispatchId' ( temp uint) 0:? Linker Objects -0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer) -0:? 'dispatchId' ( in uint GlobalInvocationID) +0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID) Linked compute stage: @@ -74,7 +75,7 @@ local_size = (256, 1, 1) 0:5 Function Definition: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint) 0:5 Function Parameters: 0:5 'loc' ( in uint) -0:5 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:5 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? Sequence 0:6 Sequence 0:6 move second child to first child ( temp 2-component vector of uint) @@ -87,15 +88,15 @@ local_size = (256, 1, 1) 0:6 Constant: 0:6 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:6 indirect index ( temp float) -0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:6 indirect index ( temp uint) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:6 Constant: 0:6 0 (const uint) 0:6 'byteAddrTemp' ( temp int) -0:6 indirect index ( temp float) -0:6 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:6 indirect index ( temp uint) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:6 'buffer' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:6 Constant: 0:6 0 (const uint) 0:6 add ( temp int) @@ -113,7 +114,7 @@ local_size = (256, 1, 1) 0:13 'result' ( temp 2-component vector of uint) 0:13 Function Call: testLoad(u1;block--u1[0]1; ( temp 2-component vector of uint) 0:13 'dispatchId' ( in uint) -0:13 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:13 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:14 Sequence 0:14 imageStore ( temp void) 0:14 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer) @@ -125,17 +126,18 @@ local_size = (256, 1, 1) 0:? Sequence 0:12 move second child to first child ( temp uint) 0:? 'dispatchId' ( temp uint) -0:? 'dispatchId' ( in uint GlobalInvocationID) +0:? Construct uint ( temp uint) +0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID) 0:12 Function Call: @main(u1; ( temp void) 0:? 'dispatchId' ( temp uint) 0:? Linker Objects -0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'g_input' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer) -0:? 'dispatchId' ( in uint GlobalInvocationID) +0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 62 +// Generated by (magic number): 80007 +// Id's are bound by 63 Capability Shader Capability ImageBuffer @@ -155,14 +157,13 @@ local_size = (256, 1, 1) Name 18 "dispatchId" Name 22 "result" Name 25 "byteAddrTemp" - Name 42 "result" + Name 43 "result" Name 44 "g_input" Name 45 "param" - Name 47 "param" - Name 51 "g_output" - Name 55 "dispatchId" + Name 50 "g_output" + Name 54 "dispatchId" Name 57 "dispatchId" - Name 59 "param" + Name 60 "param" Decorate 8 ArrayStride 4 MemberDecorate 9 0 NonWritable MemberDecorate 9 0 Offset 0 @@ -170,8 +171,8 @@ local_size = (256, 1, 1) Decorate 14(buffer) NonWritable Decorate 44(g_input) DescriptorSet 0 Decorate 44(g_input) Binding 0 - Decorate 51(g_output) DescriptorSet 0 - Decorate 51(g_output) Binding 1 + Decorate 50(g_output) DescriptorSet 0 + Decorate 50(g_output) Binding 1 Decorate 57(dispatchId) BuiltIn GlobalInvocationId 2: TypeVoid 3: TypeFunction 2 @@ -179,7 +180,7 @@ local_size = (256, 1, 1) 7: TypePointer Function 6(int) 8: TypeRuntimeArray 6(int) 9: TypeStruct 8 - 10: TypePointer Function 9(struct) + 10: TypePointer Uniform 9(struct) 11: TypeVector 6(int) 2 12: TypeFunction 11(ivec2) 7(ptr) 10(ptr) 17: TypeFunction 2 7(ptr) @@ -188,23 +189,25 @@ local_size = (256, 1, 1) 24: TypePointer Function 23(int) 27: 23(int) Constant 2 29: 23(int) Constant 0 - 34: 23(int) Constant 1 - 43: TypePointer Uniform 9(struct) - 44(g_input): 43(ptr) Variable Uniform - 49: TypeImage 6(int) Buffer nonsampled format:Rg32ui - 50: TypePointer UniformConstant 49 - 51(g_output): 50(ptr) Variable UniformConstant - 56: TypePointer Input 6(int) + 31: TypePointer Uniform 6(int) + 35: 23(int) Constant 1 + 44(g_input): 10(ptr) Variable Uniform + 48: TypeImage 6(int) Buffer nonsampled format:Rg32ui + 49: TypePointer UniformConstant 48 + 50(g_output): 49(ptr) Variable UniformConstant + 55: TypeVector 6(int) 3 + 56: TypePointer Input 55(ivec3) 57(dispatchId): 56(ptr) Variable Input 4(main): 2 Function None 3 5: Label - 55(dispatchId): 7(ptr) Variable Function - 59(param): 7(ptr) Variable Function - 58: 6(int) Load 57(dispatchId) - Store 55(dispatchId) 58 - 60: 6(int) Load 55(dispatchId) - Store 59(param) 60 - 61: 2 FunctionCall 19(@main(u1;) 59(param) + 54(dispatchId): 7(ptr) Variable Function + 60(param): 7(ptr) Variable Function + 58: 55(ivec3) Load 57(dispatchId) + 59: 6(int) CompositeExtract 58 0 + Store 54(dispatchId) 59 + 61: 6(int) Load 54(dispatchId) + Store 60(param) 61 + 62: 2 FunctionCall 19(@main(u1;) 60(param) Return FunctionEnd 15(testLoad(u1;block--u1[0]1;): 11(ivec2) Function None 12 @@ -217,30 +220,29 @@ local_size = (256, 1, 1) 28: 23(int) ShiftRightLogical 26 27 Store 25(byteAddrTemp) 28 30: 23(int) Load 25(byteAddrTemp) - 31: 7(ptr) AccessChain 14(buffer) 29 30 - 32: 6(int) Load 31 - 33: 23(int) Load 25(byteAddrTemp) - 35: 23(int) IAdd 33 34 - 36: 7(ptr) AccessChain 14(buffer) 29 35 - 37: 6(int) Load 36 - 38: 11(ivec2) CompositeConstruct 32 37 - Store 22(result) 38 - 39: 11(ivec2) Load 22(result) - ReturnValue 39 + 32: 31(ptr) AccessChain 14(buffer) 29 30 + 33: 6(int) Load 32 + 34: 23(int) Load 25(byteAddrTemp) + 36: 23(int) IAdd 34 35 + 37: 31(ptr) AccessChain 14(buffer) 29 36 + 38: 6(int) Load 37 + 39: 11(ivec2) CompositeConstruct 33 38 + Store 22(result) 39 + 40: 11(ivec2) Load 22(result) + ReturnValue 40 FunctionEnd 19(@main(u1;): 2 Function None 17 18(dispatchId): 7(ptr) FunctionParameter 20: Label - 42(result): 21(ptr) Variable Function + 43(result): 21(ptr) Variable Function 45(param): 7(ptr) Variable Function - 47(param): 10(ptr) Variable Function 46: 6(int) Load 18(dispatchId) Store 45(param) 46 - 48: 11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 47(param) - Store 42(result) 48 - 52: 49 Load 51(g_output) - 53: 6(int) Load 18(dispatchId) - 54: 11(ivec2) Load 42(result) - ImageWrite 52 53 54 + 47: 11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 44(g_input) + Store 43(result) 47 + 51: 48 Load 50(g_output) + 52: 6(int) Load 18(dispatchId) + 53: 11(ivec2) Load 43(result) + ImageWrite 51 52 53 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out index 187a41bbefc..af76bfb4643 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out @@ -10,8 +10,8 @@ gl_FragCoord origin is upper left 0:13 move second child to first child ( temp structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) 0:13 'mydata' ( temp structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) 0:13 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:13 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:13 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 'pos' ( in uint) @@ -19,8 +19,8 @@ gl_FragCoord origin is upper left 0:17 move second child to first child ( temp uint) 0:17 'size' ( temp uint) 0:17 array length ( temp uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:17 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:17 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 move second child to first child ( temp uint) @@ -31,8 +31,8 @@ gl_FragCoord origin is upper left 0:19 Condition 0:19 test: direct index for structure ( temp bool) 0:19 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:19 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:19 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 'pos' ( in uint) @@ -44,16 +44,16 @@ gl_FragCoord origin is upper left 0:20 add ( temp 3-component vector of float) 0:20 color: direct index for structure ( temp 3-component vector of float) 0:20 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:20 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:20 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) 0:20 Constant: 0:20 0 (const int) 0:20 indirect index (layout( row_major std430) buffer float) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:20 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:20 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) @@ -86,8 +86,8 @@ gl_FragCoord origin is upper left 0:12 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) -0:? 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:? 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -106,8 +106,8 @@ gl_FragCoord origin is upper left 0:13 move second child to first child ( temp structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) 0:13 'mydata' ( temp structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) 0:13 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:13 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:13 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 'pos' ( in uint) @@ -115,8 +115,8 @@ gl_FragCoord origin is upper left 0:17 move second child to first child ( temp uint) 0:17 'size' ( temp uint) 0:17 array length ( temp uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:17 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:17 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 move second child to first child ( temp uint) @@ -127,8 +127,8 @@ gl_FragCoord origin is upper left 0:19 Condition 0:19 test: direct index for structure ( temp bool) 0:19 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:19 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:19 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 'pos' ( in uint) @@ -140,16 +140,16 @@ gl_FragCoord origin is upper left 0:20 add ( temp 3-component vector of float) 0:20 color: direct index for structure ( temp 3-component vector of float) 0:20 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) -0:20 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2}) +0:20 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) 0:20 Constant: 0:20 0 (const int) 0:20 indirect index (layout( row_major std430) buffer float) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:20 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:20 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) @@ -182,13 +182,13 @@ gl_FragCoord origin is upper left 0:12 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) -0:? 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test, temp bool test2} @data}) +0:? 'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 96 Capability Shader @@ -308,7 +308,7 @@ gl_FragCoord origin is upper left 41: 15(bool) INotEqual 39 35 42: 37(ptr) AccessChain 18(mydata) 40 Store 42 41 - 44: 24(int) ArrayLength 23(sbuf) 0 + 44: 6(int) ArrayLength 23(sbuf) 0 Store 43(size) 44 Store 45(stride) 46 47: 6(int) Load 11(pos) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out new file mode 100644 index 00000000000..8b84a731612 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out @@ -0,0 +1,125 @@ +hlsl.structbuffer.incdec.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 70 + + Capability Shader + Extension "SPV_GOOGLE_hlsl_functionality1" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 63 66 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 12 "@main(u1;" + Name 11 "pos" + Name 16 "result" + Name 20 "sbuf_rw_i" + MemberName 20(sbuf_rw_i) 0 "@data" + Name 22 "sbuf_rw_i" + Name 26 "sbuf_rw_d" + Name 27 "sbuf_rw_nocounter" + Name 33 "c1" + Name 34 "sbuf_rw_i@count" + MemberName 34(sbuf_rw_i@count) 0 "@count" + Name 36 "sbuf_rw_i@count" + Name 41 "c2" + Name 42 "sbuf_rw_d@count" + Name 61 "pos" + Name 63 "pos" + Name 66 "@entryPointOutput" + Name 67 "param" + Decorate 19 ArrayStride 16 + MemberDecorate 20(sbuf_rw_i) 0 Offset 0 + Decorate 20(sbuf_rw_i) BufferBlock + Decorate 22(sbuf_rw_i) DescriptorSet 0 + Decorate 26(sbuf_rw_d) DescriptorSet 0 + Decorate 27(sbuf_rw_nocounter) DescriptorSet 0 + MemberDecorate 34(sbuf_rw_i@count) 0 Offset 0 + Decorate 34(sbuf_rw_i@count) BufferBlock + Decorate 36(sbuf_rw_i@count) DescriptorSet 0 + Decorate 42(sbuf_rw_d@count) DescriptorSet 0 + Decorate 63(pos) Flat + Decorate 63(pos) Location 0 + DecorateStringGOOGLE 63(pos) DecorationHlslSemanticGOOGLE "FOO" + Decorate 66(@entryPointOutput) Location 0 + DecorateStringGOOGLE 66(@entryPointOutput) DecorationHlslSemanticGOOGLE "SV_TARGET0" + DecorateId 22(sbuf_rw_i) DecorationHlslCounterBufferGOOGLE 36(sbuf_rw_i@count) + DecorateId 26(sbuf_rw_d) DecorationHlslCounterBufferGOOGLE 42(sbuf_rw_d@count) + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 8: TypeFloat 32 + 9: TypeVector 8(float) 4 + 10: TypeFunction 9(fvec4) 7(ptr) + 14: TypeVector 6(int) 4 + 15: TypePointer Function 14(ivec4) + 17: 6(int) Constant 0 + 18: 14(ivec4) ConstantComposite 17 17 17 17 + 19: TypeRuntimeArray 14(ivec4) + 20(sbuf_rw_i): TypeStruct 19 + 21: TypePointer Uniform 20(sbuf_rw_i) + 22(sbuf_rw_i): 21(ptr) Variable Uniform + 23: TypeInt 32 1 + 24: 23(int) Constant 0 + 25: 23(int) Constant 7 + 26(sbuf_rw_d): 21(ptr) Variable Uniform +27(sbuf_rw_nocounter): 21(ptr) Variable Uniform + 28: 23(int) Constant 5 + 29: 6(int) Constant 2 + 30: 14(ivec4) ConstantComposite 29 29 29 29 + 31: TypePointer Uniform 14(ivec4) +34(sbuf_rw_i@count): TypeStruct 6(int) + 35: TypePointer Uniform 34(sbuf_rw_i@count) +36(sbuf_rw_i@count): 35(ptr) Variable Uniform + 37: TypePointer Uniform 6(int) + 39: 6(int) Constant 1 +42(sbuf_rw_d@count): 35(ptr) Variable Uniform + 44: 6(int) Constant 4294967295 + 46: 23(int) Constant 4294967295 + 62: TypePointer Input 6(int) + 63(pos): 62(ptr) Variable Input + 65: TypePointer Output 9(fvec4) +66(@entryPointOutput): 65(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 61(pos): 7(ptr) Variable Function + 67(param): 7(ptr) Variable Function + 64: 6(int) Load 63(pos) + Store 61(pos) 64 + 68: 6(int) Load 61(pos) + Store 67(param) 68 + 69: 9(fvec4) FunctionCall 12(@main(u1;) 67(param) + Store 66(@entryPointOutput) 69 + Return + FunctionEnd + 12(@main(u1;): 9(fvec4) Function None 10 + 11(pos): 7(ptr) FunctionParameter + 13: Label + 16(result): 15(ptr) Variable Function + 33(c1): 7(ptr) Variable Function + 41(c2): 7(ptr) Variable Function + Store 16(result) 18 + 32: 31(ptr) AccessChain 27(sbuf_rw_nocounter) 24 28 + Store 32 30 + 38: 37(ptr) AccessChain 36(sbuf_rw_i@count) 24 + 40: 6(int) AtomicIAdd 38 39 17 39 + Store 33(c1) 40 + 43: 37(ptr) AccessChain 42(sbuf_rw_d@count) 24 + 45: 6(int) AtomicIAdd 43 39 17 44 + 47: 6(int) IAdd 45 46 + Store 41(c2) 47 + 48: 7(ptr) AccessChain 16(result) 17 + 49: 6(int) Load 48 + 50: 8(float) ConvertUToF 49 + 51: 7(ptr) AccessChain 16(result) 39 + 52: 6(int) Load 51 + 53: 8(float) ConvertUToF 52 + 54: 6(int) Load 33(c1) + 55: 8(float) ConvertUToF 54 + 56: 6(int) Load 41(c2) + 57: 8(float) ConvertUToF 56 + 58: 9(fvec4) CompositeConstruct 50 53 55 57 + ReturnValue 58 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out index a63fcbe5806..5c8afd9dff8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out @@ -15,23 +15,23 @@ gl_FragCoord origin is upper left 0:8 0 (const uint) 0:8 0 (const uint) 0:10 direct index (layout( row_major std430) buffer 4-component vector of uint) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:10 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:10 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 Constant: 0:10 7 (const int) 0:11 direct index (layout( row_major std430) buffer 4-component vector of uint) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:11 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:11 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 Constant: 0:11 7 (const int) 0:13 move second child to first child ( temp 4-component vector of uint) 0:13 direct index (layout( row_major std430) buffer 4-component vector of uint) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:13 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:13 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 Constant: @@ -45,23 +45,23 @@ gl_FragCoord origin is upper left 0:15 move second child to first child ( temp uint) 0:15 'c1' ( temp uint) 0:15 AtomicAdd ( temp uint) -0:15 @count: direct index for structure ( temp int) -0:15 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:15 @count: direct index for structure ( temp uint) +0:15 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:15 Constant: 0:15 0 (const int) 0:15 Constant: -0:15 1 (const int) +0:15 1 (const uint) 0:16 Sequence 0:16 move second child to first child ( temp uint) 0:16 'c2' ( temp uint) 0:16 add ( temp uint) 0:16 AtomicAdd ( temp uint) -0:16 @count: direct index for structure ( temp int) -0:16 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:16 @count: direct index for structure ( temp uint) +0:16 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:16 Constant: 0:16 0 (const int) 0:16 Constant: -0:16 -1 (const int) +0:16 4294967295 (const uint) 0:16 Constant: 0:16 -1 (const int) 0:18 Branch: Return with expression @@ -91,11 +91,11 @@ gl_FragCoord origin is upper left 0:7 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:? 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -119,23 +119,23 @@ gl_FragCoord origin is upper left 0:8 0 (const uint) 0:8 0 (const uint) 0:10 direct index (layout( row_major std430) buffer 4-component vector of uint) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:10 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:10 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 Constant: 0:10 7 (const int) 0:11 direct index (layout( row_major std430) buffer 4-component vector of uint) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:11 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:11 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 Constant: 0:11 7 (const int) 0:13 move second child to first child ( temp 4-component vector of uint) 0:13 direct index (layout( row_major std430) buffer 4-component vector of uint) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint) -0:13 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint) +0:13 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 Constant: @@ -149,23 +149,23 @@ gl_FragCoord origin is upper left 0:15 move second child to first child ( temp uint) 0:15 'c1' ( temp uint) 0:15 AtomicAdd ( temp uint) -0:15 @count: direct index for structure ( temp int) -0:15 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:15 @count: direct index for structure ( temp uint) +0:15 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:15 Constant: 0:15 0 (const int) 0:15 Constant: -0:15 1 (const int) +0:15 1 (const uint) 0:16 Sequence 0:16 move second child to first child ( temp uint) 0:16 'c2' ( temp uint) 0:16 add ( temp uint) 0:16 AtomicAdd ( temp uint) -0:16 @count: direct index for structure ( temp int) -0:16 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) +0:16 @count: direct index for structure ( temp uint) +0:16 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) 0:16 Constant: 0:16 0 (const int) 0:16 Constant: -0:16 -1 (const int) +0:16 4294967295 (const uint) 0:16 Constant: 0:16 -1 (const int) 0:18 Branch: Return with expression @@ -195,16 +195,16 @@ gl_FragCoord origin is upper left 0:7 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) -0:? 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count}) -0:? 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data}) +0:? 'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) +0:? 'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count}) +0:? 'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 70 Capability Shader @@ -226,8 +226,8 @@ gl_FragCoord origin is upper left Name 34 "sbuf_rw_i@count" MemberName 34(sbuf_rw_i@count) 0 "@count" Name 36 "sbuf_rw_i@count" - Name 42 "c2" - Name 43 "sbuf_rw_d@count" + Name 41 "c2" + Name 42 "sbuf_rw_d@count" Name 61 "pos" Name 63 "pos" Name 66 "@entryPointOutput" @@ -241,7 +241,7 @@ gl_FragCoord origin is upper left MemberDecorate 34(sbuf_rw_i@count) 0 Offset 0 Decorate 34(sbuf_rw_i@count) BufferBlock Decorate 36(sbuf_rw_i@count) DescriptorSet 0 - Decorate 43(sbuf_rw_d@count) DescriptorSet 0 + Decorate 42(sbuf_rw_d@count) DescriptorSet 0 Decorate 63(pos) Flat Decorate 63(pos) Location 0 Decorate 66(@entryPointOutput) Location 0 @@ -269,14 +269,14 @@ gl_FragCoord origin is upper left 29: 6(int) Constant 2 30: 14(ivec4) ConstantComposite 29 29 29 29 31: TypePointer Uniform 14(ivec4) -34(sbuf_rw_i@count): TypeStruct 23(int) +34(sbuf_rw_i@count): TypeStruct 6(int) 35: TypePointer Uniform 34(sbuf_rw_i@count) 36(sbuf_rw_i@count): 35(ptr) Variable Uniform - 37: TypePointer Uniform 23(int) - 39: 23(int) Constant 1 - 40: 6(int) Constant 1 -43(sbuf_rw_d@count): 35(ptr) Variable Uniform - 45: 23(int) Constant 4294967295 + 37: TypePointer Uniform 6(int) + 39: 6(int) Constant 1 +42(sbuf_rw_d@count): 35(ptr) Variable Uniform + 44: 6(int) Constant 4294967295 + 46: 23(int) Constant 4294967295 62: TypePointer Input 6(int) 63(pos): 62(ptr) Variable Input 65: TypePointer Output 9(fvec4) @@ -298,26 +298,26 @@ gl_FragCoord origin is upper left 13: Label 16(result): 15(ptr) Variable Function 33(c1): 7(ptr) Variable Function - 42(c2): 7(ptr) Variable Function + 41(c2): 7(ptr) Variable Function Store 16(result) 18 32: 31(ptr) AccessChain 27(sbuf_rw_nocounter) 24 28 Store 32 30 38: 37(ptr) AccessChain 36(sbuf_rw_i@count) 24 - 41: 6(int) AtomicIAdd 38 40 17 39 - Store 33(c1) 41 - 44: 37(ptr) AccessChain 43(sbuf_rw_d@count) 24 - 46: 6(int) AtomicIAdd 44 40 17 45 - 47: 6(int) IAdd 46 45 - Store 42(c2) 47 + 40: 6(int) AtomicIAdd 38 39 17 39 + Store 33(c1) 40 + 43: 37(ptr) AccessChain 42(sbuf_rw_d@count) 24 + 45: 6(int) AtomicIAdd 43 39 17 44 + 47: 6(int) IAdd 45 46 + Store 41(c2) 47 48: 7(ptr) AccessChain 16(result) 17 49: 6(int) Load 48 50: 8(float) ConvertUToF 49 - 51: 7(ptr) AccessChain 16(result) 40 + 51: 7(ptr) AccessChain 16(result) 39 52: 6(int) Load 51 53: 8(float) ConvertUToF 52 54: 6(int) Load 33(c1) 55: 8(float) ConvertUToF 54 - 56: 6(int) Load 42(c2) + 56: 6(int) Load 41(c2) 57: 8(float) ConvertUToF 56 58: 9(fvec4) CompositeConstruct 50 53 55 57 ReturnValue 58 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out index 87d50f052ff..13a59567da5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out @@ -8,8 +8,8 @@ gl_FragCoord origin is upper left 0:? Sequence 0:13 move second child to first child ( temp float) 0:13 indirect index (layout( row_major std430) buffer float) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:13 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:13 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 add ( temp uint) @@ -22,8 +22,8 @@ gl_FragCoord origin is upper left 0:17 move second child to first child ( temp uint) 0:17 'size' ( temp uint) 0:17 array length ( temp uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 move second child to first child ( temp uint) @@ -34,8 +34,8 @@ gl_FragCoord origin is upper left 0:19 Condition 0:19 test: direct index for structure ( temp bool) 0:19 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 'pos' ( in uint) @@ -47,16 +47,16 @@ gl_FragCoord origin is upper left 0:20 add ( temp 3-component vector of float) 0:20 color: direct index for structure ( temp 3-component vector of float) 0:20 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) 0:20 Constant: 0:20 0 (const int) 0:20 indirect index (layout( row_major std430) buffer float) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:20 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:20 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) @@ -80,8 +80,8 @@ gl_FragCoord origin is upper left 0:12 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) -0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -98,8 +98,8 @@ gl_FragCoord origin is upper left 0:? Sequence 0:13 move second child to first child ( temp float) 0:13 indirect index (layout( row_major std430) buffer float) -0:13 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:13 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:13 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:13 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:13 Constant: 0:13 0 (const uint) 0:13 add ( temp uint) @@ -112,8 +112,8 @@ gl_FragCoord origin is upper left 0:17 move second child to first child ( temp uint) 0:17 'size' ( temp uint) 0:17 array length ( temp uint) -0:17 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:17 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:17 Constant: 0:17 0 (const uint) 0:17 move second child to first child ( temp uint) @@ -124,8 +124,8 @@ gl_FragCoord origin is upper left 0:19 Condition 0:19 test: direct index for structure ( temp bool) 0:19 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:19 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:19 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:19 Constant: 0:19 0 (const uint) 0:19 'pos' ( in uint) @@ -137,16 +137,16 @@ gl_FragCoord origin is upper left 0:20 add ( temp 3-component vector of float) 0:20 color: direct index for structure ( temp 3-component vector of float) 0:20 indirect index (layout( row_major std430) buffer structure{ temp 3-component vector of float color, temp bool test}) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test}) -0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test}) +0:20 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) 0:20 Constant: 0:20 0 (const int) 0:20 indirect index (layout( row_major std430) buffer float) -0:20 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of float) -0:20 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of float) +0:20 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:20 Constant: 0:20 0 (const uint) 0:20 'pos' ( in uint) @@ -170,13 +170,13 @@ gl_FragCoord origin is upper left 0:12 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color, temp bool test} @data}) -0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data}) +0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 3-component vector of float color, temp bool test} @data}) +0:? 'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of float @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 78 Capability Shader @@ -270,7 +270,7 @@ gl_FragCoord origin is upper left 22: 6(int) IAdd 20 21 25: 24(ptr) AccessChain 17(sbuf2) 19 22 Store 25 23 - 33: 18(int) ArrayLength 32(sbuf) 0 + 33: 6(int) ArrayLength 32(sbuf) 0 Store 26(size) 33 Store 34(stride) 35 36: 6(int) Load 11(pos) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out index 77c27443a24..690a0da85f6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out @@ -10,8 +10,8 @@ gl_FragCoord origin is upper left 0:7 move second child to first child ( temp uint) 0:7 'size' ( temp uint) 0:7 array length ( temp uint) -0:7 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:7 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:7 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:7 Constant: 0:7 0 (const uint) 0:? Sequence @@ -21,23 +21,22 @@ gl_FragCoord origin is upper left 0:9 'pos' ( in uint) 0:9 Constant: 0:9 2 (const int) -0:9 move second child to first child ( temp float) -0:9 indirect index ( temp float) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:9 move second child to first child ( temp uint) +0:9 indirect index (layout( row_major std430) buffer uint) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 'byteAddrTemp' ( temp int) -0:9 Convert uint to float ( temp float) -0:9 indirect index (layout( row_major std430) buffer uint) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) -0:9 Constant: -0:9 0 (const uint) -0:9 right-shift ( temp int) -0:9 'pos' ( in uint) -0:9 Constant: -0:9 2 (const int) +0:9 indirect index (layout( row_major std430) buffer uint) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:9 Constant: +0:9 0 (const uint) +0:9 right-shift ( temp int) +0:9 'pos' ( in uint) +0:9 Constant: +0:9 2 (const int) 0:? Sequence 0:10 move second child to first child ( temp int) 0:10 'byteAddrTemp' ( temp int) @@ -45,14 +44,14 @@ gl_FragCoord origin is upper left 0:10 'pos' ( in uint) 0:10 Constant: 0:10 2 (const int) -0:10 move second child to first child ( temp float) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 move second child to first child ( temp uint) +0:10 indirect index (layout( row_major std430) buffer uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 direct index ( temp float) +0:10 direct index ( temp uint) 0:? Sequence 0:10 move second child to first child ( temp int) 0:10 'byteAddrTemp' ( temp int) @@ -61,15 +60,15 @@ gl_FragCoord origin is upper left 0:10 Constant: 0:10 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) @@ -78,17 +77,17 @@ gl_FragCoord origin is upper left 0:10 1 (const int) 0:10 Constant: 0:10 0 (const int) -0:10 move second child to first child ( temp float) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 move second child to first child ( temp uint) +0:10 indirect index (layout( row_major std430) buffer uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) 0:10 'byteAddrTemp' ( temp int) 0:10 Constant: 0:10 1 (const int) -0:10 direct index ( temp float) +0:10 direct index ( temp uint) 0:? Sequence 0:10 move second child to first child ( temp int) 0:10 'byteAddrTemp' ( temp int) @@ -97,15 +96,15 @@ gl_FragCoord origin is upper left 0:10 Constant: 0:10 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) @@ -121,14 +120,14 @@ gl_FragCoord origin is upper left 0:11 'pos' ( in uint) 0:11 Constant: 0:11 2 (const int) -0:11 move second child to first child ( temp float) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( row_major std430) buffer uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 direct index ( temp float) +0:11 direct index ( temp uint) 0:? Sequence 0:11 move second child to first child ( temp int) 0:11 'byteAddrTemp' ( temp int) @@ -137,24 +136,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -163,17 +162,17 @@ gl_FragCoord origin is upper left 0:11 2 (const int) 0:11 Constant: 0:11 0 (const int) -0:11 move second child to first child ( temp float) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( row_major std430) buffer uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 direct index ( temp float) +0:11 direct index ( temp uint) 0:? Sequence 0:11 move second child to first child ( temp int) 0:11 'byteAddrTemp' ( temp int) @@ -182,24 +181,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -208,17 +207,17 @@ gl_FragCoord origin is upper left 0:11 2 (const int) 0:11 Constant: 0:11 1 (const int) -0:11 move second child to first child ( temp float) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( row_major std430) buffer uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 2 (const int) -0:11 direct index ( temp float) +0:11 direct index ( temp uint) 0:? Sequence 0:11 move second child to first child ( temp int) 0:11 'byteAddrTemp' ( temp int) @@ -227,24 +226,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -260,14 +259,14 @@ gl_FragCoord origin is upper left 0:12 'pos' ( in uint) 0:12 Constant: 0:12 2 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -276,33 +275,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -311,17 +310,17 @@ gl_FragCoord origin is upper left 0:12 3 (const int) 0:12 Constant: 0:12 0 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -330,33 +329,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -365,17 +364,17 @@ gl_FragCoord origin is upper left 0:12 3 (const int) 0:12 Constant: 0:12 1 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -384,33 +383,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -419,17 +418,17 @@ gl_FragCoord origin is upper left 0:12 3 (const int) 0:12 Constant: 0:12 2 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 3 (const int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -438,33 +437,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -477,8 +476,8 @@ gl_FragCoord origin is upper left 0:14 Construct vec4 ( temp 4-component vector of float) 0:14 Convert uint to float ( temp float) 0:14 indirect index (layout( row_major std430) buffer uint) -0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:14 Constant: 0:14 0 (const uint) 0:14 right-shift ( temp int) @@ -496,7 +495,7 @@ gl_FragCoord origin is upper left 0:5 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) @@ -515,8 +514,8 @@ gl_FragCoord origin is upper left 0:7 move second child to first child ( temp uint) 0:7 'size' ( temp uint) 0:7 array length ( temp uint) -0:7 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:7 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:7 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:7 Constant: 0:7 0 (const uint) 0:? Sequence @@ -526,23 +525,22 @@ gl_FragCoord origin is upper left 0:9 'pos' ( in uint) 0:9 Constant: 0:9 2 (const int) -0:9 move second child to first child ( temp float) -0:9 indirect index ( temp float) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:9 move second child to first child ( temp uint) +0:9 indirect index (layout( row_major std430) buffer uint) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:9 Constant: 0:9 0 (const uint) 0:9 'byteAddrTemp' ( temp int) -0:9 Convert uint to float ( temp float) -0:9 indirect index (layout( row_major std430) buffer uint) -0:9 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) -0:9 Constant: -0:9 0 (const uint) -0:9 right-shift ( temp int) -0:9 'pos' ( in uint) -0:9 Constant: -0:9 2 (const int) +0:9 indirect index (layout( row_major std430) buffer uint) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:9 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:9 Constant: +0:9 0 (const uint) +0:9 right-shift ( temp int) +0:9 'pos' ( in uint) +0:9 Constant: +0:9 2 (const int) 0:? Sequence 0:10 move second child to first child ( temp int) 0:10 'byteAddrTemp' ( temp int) @@ -550,14 +548,14 @@ gl_FragCoord origin is upper left 0:10 'pos' ( in uint) 0:10 Constant: 0:10 2 (const int) -0:10 move second child to first child ( temp float) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 move second child to first child ( temp uint) +0:10 indirect index (layout( row_major std430) buffer uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 direct index ( temp float) +0:10 direct index ( temp uint) 0:? Sequence 0:10 move second child to first child ( temp int) 0:10 'byteAddrTemp' ( temp int) @@ -566,15 +564,15 @@ gl_FragCoord origin is upper left 0:10 Constant: 0:10 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) @@ -583,17 +581,17 @@ gl_FragCoord origin is upper left 0:10 1 (const int) 0:10 Constant: 0:10 0 (const int) -0:10 move second child to first child ( temp float) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 move second child to first child ( temp uint) +0:10 indirect index (layout( row_major std430) buffer uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) 0:10 'byteAddrTemp' ( temp int) 0:10 Constant: 0:10 1 (const int) -0:10 direct index ( temp float) +0:10 direct index ( temp uint) 0:? Sequence 0:10 move second child to first child ( temp int) 0:10 'byteAddrTemp' ( temp int) @@ -602,15 +600,15 @@ gl_FragCoord origin is upper left 0:10 Constant: 0:10 2 (const int) 0:? Construct vec2 ( temp 2-component vector of uint) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 'byteAddrTemp' ( temp int) -0:10 indirect index ( temp float) -0:10 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:10 indirect index ( temp uint) +0:10 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:10 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:10 Constant: 0:10 0 (const uint) 0:10 add ( temp int) @@ -626,14 +624,14 @@ gl_FragCoord origin is upper left 0:11 'pos' ( in uint) 0:11 Constant: 0:11 2 (const int) -0:11 move second child to first child ( temp float) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( row_major std430) buffer uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 direct index ( temp float) +0:11 direct index ( temp uint) 0:? Sequence 0:11 move second child to first child ( temp int) 0:11 'byteAddrTemp' ( temp int) @@ -642,24 +640,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -668,17 +666,17 @@ gl_FragCoord origin is upper left 0:11 2 (const int) 0:11 Constant: 0:11 0 (const int) -0:11 move second child to first child ( temp float) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( row_major std430) buffer uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 direct index ( temp float) +0:11 direct index ( temp uint) 0:? Sequence 0:11 move second child to first child ( temp int) 0:11 'byteAddrTemp' ( temp int) @@ -687,24 +685,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -713,17 +711,17 @@ gl_FragCoord origin is upper left 0:11 2 (const int) 0:11 Constant: 0:11 1 (const int) -0:11 move second child to first child ( temp float) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 move second child to first child ( temp uint) +0:11 indirect index (layout( row_major std430) buffer uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 2 (const int) -0:11 direct index ( temp float) +0:11 direct index ( temp uint) 0:? Sequence 0:11 move second child to first child ( temp int) 0:11 'byteAddrTemp' ( temp int) @@ -732,24 +730,24 @@ gl_FragCoord origin is upper left 0:11 Constant: 0:11 2 (const int) 0:? Construct vec3 ( temp 3-component vector of uint) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 'byteAddrTemp' ( temp int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) 0:11 'byteAddrTemp' ( temp int) 0:11 Constant: 0:11 1 (const int) -0:11 indirect index ( temp float) -0:11 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:11 indirect index ( temp uint) +0:11 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:11 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:11 Constant: 0:11 0 (const uint) 0:11 add ( temp int) @@ -765,14 +763,14 @@ gl_FragCoord origin is upper left 0:12 'pos' ( in uint) 0:12 Constant: 0:12 2 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -781,33 +779,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -816,17 +814,17 @@ gl_FragCoord origin is upper left 0:12 3 (const int) 0:12 Constant: 0:12 0 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -835,33 +833,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -870,17 +868,17 @@ gl_FragCoord origin is upper left 0:12 3 (const int) 0:12 Constant: 0:12 1 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -889,33 +887,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -924,17 +922,17 @@ gl_FragCoord origin is upper left 0:12 3 (const int) 0:12 Constant: 0:12 2 (const int) -0:12 move second child to first child ( temp float) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 move second child to first child ( temp uint) +0:12 indirect index (layout( row_major std430) buffer uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 3 (const int) -0:12 direct index ( temp float) +0:12 direct index ( temp uint) 0:? Sequence 0:12 move second child to first child ( temp int) 0:12 'byteAddrTemp' ( temp int) @@ -943,33 +941,33 @@ gl_FragCoord origin is upper left 0:12 Constant: 0:12 2 (const int) 0:? Construct vec4 ( temp 4-component vector of uint) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 'byteAddrTemp' ( temp int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 1 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) 0:12 'byteAddrTemp' ( temp int) 0:12 Constant: 0:12 2 (const int) -0:12 indirect index ( temp float) -0:12 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:12 indirect index ( temp uint) +0:12 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:12 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:12 Constant: 0:12 0 (const uint) 0:12 add ( temp int) @@ -982,8 +980,8 @@ gl_FragCoord origin is upper left 0:14 Construct vec4 ( temp 4-component vector of float) 0:14 Convert uint to float ( temp float) 0:14 indirect index (layout( row_major std430) buffer uint) -0:14 @data: direct index for structure (layout( row_major std430) buffer implicitly-sized array of uint) -0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:14 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:14 Constant: 0:14 0 (const uint) 0:14 right-shift ( temp int) @@ -1001,18 +999,18 @@ gl_FragCoord origin is upper left 0:5 Function Call: @main(u1; ( temp 4-component vector of float) 0:? 'pos' ( temp uint) 0:? Linker Objects -0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data}) +0:? 'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'pos' (layout( location=0) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 240 +// Generated by (magic number): 80007 +// Id's are bound by 239 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 233 236 + EntryPoint Fragment 4 "main" 232 235 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -1023,23 +1021,23 @@ gl_FragCoord origin is upper left MemberName 16(sbuf) 0 "@data" Name 18 "sbuf" Name 22 "byteAddrTemp" - Name 35 "byteAddrTemp" - Name 39 "byteAddrTemp" - Name 70 "byteAddrTemp" - Name 74 "byteAddrTemp" - Name 129 "byteAddrTemp" - Name 133 "byteAddrTemp" - Name 231 "pos" - Name 233 "pos" - Name 236 "@entryPointOutput" - Name 237 "param" + Name 34 "byteAddrTemp" + Name 38 "byteAddrTemp" + Name 69 "byteAddrTemp" + Name 73 "byteAddrTemp" + Name 128 "byteAddrTemp" + Name 132 "byteAddrTemp" + Name 230 "pos" + Name 232 "pos" + Name 235 "@entryPointOutput" + Name 236 "param" Decorate 15 ArrayStride 4 MemberDecorate 16(sbuf) 0 Offset 0 Decorate 16(sbuf) BufferBlock Decorate 18(sbuf) DescriptorSet 0 - Decorate 233(pos) Flat - Decorate 233(pos) Location 0 - Decorate 236(@entryPointOutput) Location 0 + Decorate 232(pos) Flat + Decorate 232(pos) Location 0 + Decorate 235(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -1051,34 +1049,34 @@ gl_FragCoord origin is upper left 16(sbuf): TypeStruct 15 17: TypePointer Uniform 16(sbuf) 18(sbuf): 17(ptr) Variable Uniform - 19: TypeInt 32 1 - 21: TypePointer Function 19(int) - 24: 19(int) Constant 2 - 26: 19(int) Constant 0 + 20: TypeInt 32 1 + 21: TypePointer Function 20(int) + 24: 20(int) Constant 2 + 26: 20(int) Constant 0 30: TypePointer Uniform 6(int) - 46: 19(int) Constant 1 - 50: TypeVector 6(int) 2 - 52: 6(int) Constant 0 - 67: 6(int) Constant 1 - 88: TypeVector 6(int) 3 - 126: 6(int) Constant 2 - 148: 19(int) Constant 3 - 152: TypeVector 6(int) 4 - 220: 6(int) Constant 3 - 232: TypePointer Input 6(int) - 233(pos): 232(ptr) Variable Input - 235: TypePointer Output 9(fvec4) -236(@entryPointOutput): 235(ptr) Variable Output + 45: 20(int) Constant 1 + 49: TypeVector 6(int) 2 + 51: 6(int) Constant 0 + 66: 6(int) Constant 1 + 87: TypeVector 6(int) 3 + 125: 6(int) Constant 2 + 147: 20(int) Constant 3 + 151: TypeVector 6(int) 4 + 219: 6(int) Constant 3 + 231: TypePointer Input 6(int) + 232(pos): 231(ptr) Variable Input + 234: TypePointer Output 9(fvec4) +235(@entryPointOutput): 234(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 231(pos): 7(ptr) Variable Function - 237(param): 7(ptr) Variable Function - 234: 6(int) Load 233(pos) - Store 231(pos) 234 - 238: 6(int) Load 231(pos) - Store 237(param) 238 - 239: 9(fvec4) FunctionCall 12(@main(u1;) 237(param) - Store 236(@entryPointOutput) 239 + 230(pos): 7(ptr) Variable Function + 236(param): 7(ptr) Variable Function + 233: 6(int) Load 232(pos) + Store 230(pos) 233 + 237: 6(int) Load 230(pos) + Store 236(param) 237 + 238: 9(fvec4) FunctionCall 12(@main(u1;) 236(param) + Store 235(@entryPointOutput) 238 Return FunctionEnd 12(@main(u1;): 9(fvec4) Function None 10 @@ -1086,224 +1084,223 @@ gl_FragCoord origin is upper left 13: Label 14(size): 7(ptr) Variable Function 22(byteAddrTemp): 21(ptr) Variable Function -35(byteAddrTemp): 21(ptr) Variable Function -39(byteAddrTemp): 21(ptr) Variable Function -70(byteAddrTemp): 21(ptr) Variable Function -74(byteAddrTemp): 21(ptr) Variable Function -129(byteAddrTemp): 21(ptr) Variable Function -133(byteAddrTemp): 21(ptr) Variable Function - 20: 19(int) ArrayLength 18(sbuf) 0 - Store 14(size) 20 +34(byteAddrTemp): 21(ptr) Variable Function +38(byteAddrTemp): 21(ptr) Variable Function +69(byteAddrTemp): 21(ptr) Variable Function +73(byteAddrTemp): 21(ptr) Variable Function +128(byteAddrTemp): 21(ptr) Variable Function +132(byteAddrTemp): 21(ptr) Variable Function + 19: 6(int) ArrayLength 18(sbuf) 0 + Store 14(size) 19 23: 6(int) Load 11(pos) - 25: 19(int) ShiftRightLogical 23 24 + 25: 20(int) ShiftRightLogical 23 24 Store 22(byteAddrTemp) 25 - 27: 19(int) Load 22(byteAddrTemp) + 27: 20(int) Load 22(byteAddrTemp) 28: 6(int) Load 11(pos) - 29: 19(int) ShiftRightLogical 28 24 + 29: 20(int) ShiftRightLogical 28 24 31: 30(ptr) AccessChain 18(sbuf) 26 29 32: 6(int) Load 31 - 33: 8(float) ConvertUToF 32 - 34: 30(ptr) AccessChain 18(sbuf) 26 27 - Store 34 33 - 36: 6(int) Load 11(pos) - 37: 19(int) ShiftRightLogical 36 24 - Store 35(byteAddrTemp) 37 - 38: 19(int) Load 35(byteAddrTemp) - 40: 6(int) Load 11(pos) - 41: 19(int) ShiftRightLogical 40 24 - Store 39(byteAddrTemp) 41 - 42: 19(int) Load 39(byteAddrTemp) - 43: 30(ptr) AccessChain 18(sbuf) 26 42 - 44: 6(int) Load 43 - 45: 19(int) Load 39(byteAddrTemp) - 47: 19(int) IAdd 45 46 - 48: 30(ptr) AccessChain 18(sbuf) 26 47 - 49: 6(int) Load 48 - 51: 50(ivec2) CompositeConstruct 44 49 - 53: 6(int) CompositeExtract 51 0 - 54: 30(ptr) AccessChain 18(sbuf) 26 38 - Store 54 53 - 55: 19(int) Load 35(byteAddrTemp) - 56: 19(int) IAdd 55 46 - 57: 6(int) Load 11(pos) - 58: 19(int) ShiftRightLogical 57 24 - Store 39(byteAddrTemp) 58 - 59: 19(int) Load 39(byteAddrTemp) - 60: 30(ptr) AccessChain 18(sbuf) 26 59 - 61: 6(int) Load 60 - 62: 19(int) Load 39(byteAddrTemp) - 63: 19(int) IAdd 62 46 - 64: 30(ptr) AccessChain 18(sbuf) 26 63 - 65: 6(int) Load 64 - 66: 50(ivec2) CompositeConstruct 61 65 - 68: 6(int) CompositeExtract 66 1 - 69: 30(ptr) AccessChain 18(sbuf) 26 56 - Store 69 68 - 71: 6(int) Load 11(pos) - 72: 19(int) ShiftRightLogical 71 24 - Store 70(byteAddrTemp) 72 - 73: 19(int) Load 70(byteAddrTemp) - 75: 6(int) Load 11(pos) - 76: 19(int) ShiftRightLogical 75 24 - Store 74(byteAddrTemp) 76 - 77: 19(int) Load 74(byteAddrTemp) - 78: 30(ptr) AccessChain 18(sbuf) 26 77 - 79: 6(int) Load 78 - 80: 19(int) Load 74(byteAddrTemp) - 81: 19(int) IAdd 80 46 - 82: 30(ptr) AccessChain 18(sbuf) 26 81 - 83: 6(int) Load 82 - 84: 19(int) Load 74(byteAddrTemp) - 85: 19(int) IAdd 84 24 - 86: 30(ptr) AccessChain 18(sbuf) 26 85 - 87: 6(int) Load 86 - 89: 88(ivec3) CompositeConstruct 79 83 87 - 90: 6(int) CompositeExtract 89 0 - 91: 30(ptr) AccessChain 18(sbuf) 26 73 - Store 91 90 - 92: 19(int) Load 70(byteAddrTemp) - 93: 19(int) IAdd 92 46 - 94: 6(int) Load 11(pos) - 95: 19(int) ShiftRightLogical 94 24 - Store 74(byteAddrTemp) 95 - 96: 19(int) Load 74(byteAddrTemp) - 97: 30(ptr) AccessChain 18(sbuf) 26 96 - 98: 6(int) Load 97 - 99: 19(int) Load 74(byteAddrTemp) - 100: 19(int) IAdd 99 46 - 101: 30(ptr) AccessChain 18(sbuf) 26 100 - 102: 6(int) Load 101 - 103: 19(int) Load 74(byteAddrTemp) - 104: 19(int) IAdd 103 24 - 105: 30(ptr) AccessChain 18(sbuf) 26 104 - 106: 6(int) Load 105 - 107: 88(ivec3) CompositeConstruct 98 102 106 - 108: 6(int) CompositeExtract 107 1 - 109: 30(ptr) AccessChain 18(sbuf) 26 93 - Store 109 108 - 110: 19(int) Load 70(byteAddrTemp) - 111: 19(int) IAdd 110 24 - 112: 6(int) Load 11(pos) - 113: 19(int) ShiftRightLogical 112 24 - Store 74(byteAddrTemp) 113 - 114: 19(int) Load 74(byteAddrTemp) - 115: 30(ptr) AccessChain 18(sbuf) 26 114 - 116: 6(int) Load 115 - 117: 19(int) Load 74(byteAddrTemp) - 118: 19(int) IAdd 117 46 - 119: 30(ptr) AccessChain 18(sbuf) 26 118 - 120: 6(int) Load 119 - 121: 19(int) Load 74(byteAddrTemp) - 122: 19(int) IAdd 121 24 - 123: 30(ptr) AccessChain 18(sbuf) 26 122 - 124: 6(int) Load 123 - 125: 88(ivec3) CompositeConstruct 116 120 124 - 127: 6(int) CompositeExtract 125 2 - 128: 30(ptr) AccessChain 18(sbuf) 26 111 - Store 128 127 - 130: 6(int) Load 11(pos) - 131: 19(int) ShiftRightLogical 130 24 - Store 129(byteAddrTemp) 131 - 132: 19(int) Load 129(byteAddrTemp) - 134: 6(int) Load 11(pos) - 135: 19(int) ShiftRightLogical 134 24 - Store 133(byteAddrTemp) 135 - 136: 19(int) Load 133(byteAddrTemp) - 137: 30(ptr) AccessChain 18(sbuf) 26 136 - 138: 6(int) Load 137 - 139: 19(int) Load 133(byteAddrTemp) - 140: 19(int) IAdd 139 46 - 141: 30(ptr) AccessChain 18(sbuf) 26 140 - 142: 6(int) Load 141 - 143: 19(int) Load 133(byteAddrTemp) - 144: 19(int) IAdd 143 24 - 145: 30(ptr) AccessChain 18(sbuf) 26 144 - 146: 6(int) Load 145 - 147: 19(int) Load 133(byteAddrTemp) - 149: 19(int) IAdd 147 148 - 150: 30(ptr) AccessChain 18(sbuf) 26 149 - 151: 6(int) Load 150 - 153: 152(ivec4) CompositeConstruct 138 142 146 151 - 154: 6(int) CompositeExtract 153 0 - 155: 30(ptr) AccessChain 18(sbuf) 26 132 - Store 155 154 - 156: 19(int) Load 129(byteAddrTemp) - 157: 19(int) IAdd 156 46 - 158: 6(int) Load 11(pos) - 159: 19(int) ShiftRightLogical 158 24 - Store 133(byteAddrTemp) 159 - 160: 19(int) Load 133(byteAddrTemp) - 161: 30(ptr) AccessChain 18(sbuf) 26 160 - 162: 6(int) Load 161 - 163: 19(int) Load 133(byteAddrTemp) - 164: 19(int) IAdd 163 46 - 165: 30(ptr) AccessChain 18(sbuf) 26 164 - 166: 6(int) Load 165 - 167: 19(int) Load 133(byteAddrTemp) - 168: 19(int) IAdd 167 24 - 169: 30(ptr) AccessChain 18(sbuf) 26 168 - 170: 6(int) Load 169 - 171: 19(int) Load 133(byteAddrTemp) - 172: 19(int) IAdd 171 148 - 173: 30(ptr) AccessChain 18(sbuf) 26 172 - 174: 6(int) Load 173 - 175: 152(ivec4) CompositeConstruct 162 166 170 174 - 176: 6(int) CompositeExtract 175 1 - 177: 30(ptr) AccessChain 18(sbuf) 26 157 - Store 177 176 - 178: 19(int) Load 129(byteAddrTemp) - 179: 19(int) IAdd 178 24 - 180: 6(int) Load 11(pos) - 181: 19(int) ShiftRightLogical 180 24 - Store 133(byteAddrTemp) 181 - 182: 19(int) Load 133(byteAddrTemp) - 183: 30(ptr) AccessChain 18(sbuf) 26 182 - 184: 6(int) Load 183 - 185: 19(int) Load 133(byteAddrTemp) - 186: 19(int) IAdd 185 46 - 187: 30(ptr) AccessChain 18(sbuf) 26 186 - 188: 6(int) Load 187 - 189: 19(int) Load 133(byteAddrTemp) - 190: 19(int) IAdd 189 24 - 191: 30(ptr) AccessChain 18(sbuf) 26 190 - 192: 6(int) Load 191 - 193: 19(int) Load 133(byteAddrTemp) - 194: 19(int) IAdd 193 148 - 195: 30(ptr) AccessChain 18(sbuf) 26 194 - 196: 6(int) Load 195 - 197: 152(ivec4) CompositeConstruct 184 188 192 196 - 198: 6(int) CompositeExtract 197 2 - 199: 30(ptr) AccessChain 18(sbuf) 26 179 - Store 199 198 - 200: 19(int) Load 129(byteAddrTemp) - 201: 19(int) IAdd 200 148 - 202: 6(int) Load 11(pos) - 203: 19(int) ShiftRightLogical 202 24 - Store 133(byteAddrTemp) 203 - 204: 19(int) Load 133(byteAddrTemp) - 205: 30(ptr) AccessChain 18(sbuf) 26 204 - 206: 6(int) Load 205 - 207: 19(int) Load 133(byteAddrTemp) - 208: 19(int) IAdd 207 46 - 209: 30(ptr) AccessChain 18(sbuf) 26 208 - 210: 6(int) Load 209 - 211: 19(int) Load 133(byteAddrTemp) - 212: 19(int) IAdd 211 24 - 213: 30(ptr) AccessChain 18(sbuf) 26 212 - 214: 6(int) Load 213 - 215: 19(int) Load 133(byteAddrTemp) - 216: 19(int) IAdd 215 148 - 217: 30(ptr) AccessChain 18(sbuf) 26 216 - 218: 6(int) Load 217 - 219: 152(ivec4) CompositeConstruct 206 210 214 218 - 221: 6(int) CompositeExtract 219 3 - 222: 30(ptr) AccessChain 18(sbuf) 26 201 - Store 222 221 - 223: 6(int) Load 11(pos) - 224: 19(int) ShiftRightLogical 223 24 - 225: 30(ptr) AccessChain 18(sbuf) 26 224 - 226: 6(int) Load 225 - 227: 8(float) ConvertUToF 226 - 228: 9(fvec4) CompositeConstruct 227 227 227 227 - ReturnValue 228 + 33: 30(ptr) AccessChain 18(sbuf) 26 27 + Store 33 32 + 35: 6(int) Load 11(pos) + 36: 20(int) ShiftRightLogical 35 24 + Store 34(byteAddrTemp) 36 + 37: 20(int) Load 34(byteAddrTemp) + 39: 6(int) Load 11(pos) + 40: 20(int) ShiftRightLogical 39 24 + Store 38(byteAddrTemp) 40 + 41: 20(int) Load 38(byteAddrTemp) + 42: 30(ptr) AccessChain 18(sbuf) 26 41 + 43: 6(int) Load 42 + 44: 20(int) Load 38(byteAddrTemp) + 46: 20(int) IAdd 44 45 + 47: 30(ptr) AccessChain 18(sbuf) 26 46 + 48: 6(int) Load 47 + 50: 49(ivec2) CompositeConstruct 43 48 + 52: 6(int) CompositeExtract 50 0 + 53: 30(ptr) AccessChain 18(sbuf) 26 37 + Store 53 52 + 54: 20(int) Load 34(byteAddrTemp) + 55: 20(int) IAdd 54 45 + 56: 6(int) Load 11(pos) + 57: 20(int) ShiftRightLogical 56 24 + Store 38(byteAddrTemp) 57 + 58: 20(int) Load 38(byteAddrTemp) + 59: 30(ptr) AccessChain 18(sbuf) 26 58 + 60: 6(int) Load 59 + 61: 20(int) Load 38(byteAddrTemp) + 62: 20(int) IAdd 61 45 + 63: 30(ptr) AccessChain 18(sbuf) 26 62 + 64: 6(int) Load 63 + 65: 49(ivec2) CompositeConstruct 60 64 + 67: 6(int) CompositeExtract 65 1 + 68: 30(ptr) AccessChain 18(sbuf) 26 55 + Store 68 67 + 70: 6(int) Load 11(pos) + 71: 20(int) ShiftRightLogical 70 24 + Store 69(byteAddrTemp) 71 + 72: 20(int) Load 69(byteAddrTemp) + 74: 6(int) Load 11(pos) + 75: 20(int) ShiftRightLogical 74 24 + Store 73(byteAddrTemp) 75 + 76: 20(int) Load 73(byteAddrTemp) + 77: 30(ptr) AccessChain 18(sbuf) 26 76 + 78: 6(int) Load 77 + 79: 20(int) Load 73(byteAddrTemp) + 80: 20(int) IAdd 79 45 + 81: 30(ptr) AccessChain 18(sbuf) 26 80 + 82: 6(int) Load 81 + 83: 20(int) Load 73(byteAddrTemp) + 84: 20(int) IAdd 83 24 + 85: 30(ptr) AccessChain 18(sbuf) 26 84 + 86: 6(int) Load 85 + 88: 87(ivec3) CompositeConstruct 78 82 86 + 89: 6(int) CompositeExtract 88 0 + 90: 30(ptr) AccessChain 18(sbuf) 26 72 + Store 90 89 + 91: 20(int) Load 69(byteAddrTemp) + 92: 20(int) IAdd 91 45 + 93: 6(int) Load 11(pos) + 94: 20(int) ShiftRightLogical 93 24 + Store 73(byteAddrTemp) 94 + 95: 20(int) Load 73(byteAddrTemp) + 96: 30(ptr) AccessChain 18(sbuf) 26 95 + 97: 6(int) Load 96 + 98: 20(int) Load 73(byteAddrTemp) + 99: 20(int) IAdd 98 45 + 100: 30(ptr) AccessChain 18(sbuf) 26 99 + 101: 6(int) Load 100 + 102: 20(int) Load 73(byteAddrTemp) + 103: 20(int) IAdd 102 24 + 104: 30(ptr) AccessChain 18(sbuf) 26 103 + 105: 6(int) Load 104 + 106: 87(ivec3) CompositeConstruct 97 101 105 + 107: 6(int) CompositeExtract 106 1 + 108: 30(ptr) AccessChain 18(sbuf) 26 92 + Store 108 107 + 109: 20(int) Load 69(byteAddrTemp) + 110: 20(int) IAdd 109 24 + 111: 6(int) Load 11(pos) + 112: 20(int) ShiftRightLogical 111 24 + Store 73(byteAddrTemp) 112 + 113: 20(int) Load 73(byteAddrTemp) + 114: 30(ptr) AccessChain 18(sbuf) 26 113 + 115: 6(int) Load 114 + 116: 20(int) Load 73(byteAddrTemp) + 117: 20(int) IAdd 116 45 + 118: 30(ptr) AccessChain 18(sbuf) 26 117 + 119: 6(int) Load 118 + 120: 20(int) Load 73(byteAddrTemp) + 121: 20(int) IAdd 120 24 + 122: 30(ptr) AccessChain 18(sbuf) 26 121 + 123: 6(int) Load 122 + 124: 87(ivec3) CompositeConstruct 115 119 123 + 126: 6(int) CompositeExtract 124 2 + 127: 30(ptr) AccessChain 18(sbuf) 26 110 + Store 127 126 + 129: 6(int) Load 11(pos) + 130: 20(int) ShiftRightLogical 129 24 + Store 128(byteAddrTemp) 130 + 131: 20(int) Load 128(byteAddrTemp) + 133: 6(int) Load 11(pos) + 134: 20(int) ShiftRightLogical 133 24 + Store 132(byteAddrTemp) 134 + 135: 20(int) Load 132(byteAddrTemp) + 136: 30(ptr) AccessChain 18(sbuf) 26 135 + 137: 6(int) Load 136 + 138: 20(int) Load 132(byteAddrTemp) + 139: 20(int) IAdd 138 45 + 140: 30(ptr) AccessChain 18(sbuf) 26 139 + 141: 6(int) Load 140 + 142: 20(int) Load 132(byteAddrTemp) + 143: 20(int) IAdd 142 24 + 144: 30(ptr) AccessChain 18(sbuf) 26 143 + 145: 6(int) Load 144 + 146: 20(int) Load 132(byteAddrTemp) + 148: 20(int) IAdd 146 147 + 149: 30(ptr) AccessChain 18(sbuf) 26 148 + 150: 6(int) Load 149 + 152: 151(ivec4) CompositeConstruct 137 141 145 150 + 153: 6(int) CompositeExtract 152 0 + 154: 30(ptr) AccessChain 18(sbuf) 26 131 + Store 154 153 + 155: 20(int) Load 128(byteAddrTemp) + 156: 20(int) IAdd 155 45 + 157: 6(int) Load 11(pos) + 158: 20(int) ShiftRightLogical 157 24 + Store 132(byteAddrTemp) 158 + 159: 20(int) Load 132(byteAddrTemp) + 160: 30(ptr) AccessChain 18(sbuf) 26 159 + 161: 6(int) Load 160 + 162: 20(int) Load 132(byteAddrTemp) + 163: 20(int) IAdd 162 45 + 164: 30(ptr) AccessChain 18(sbuf) 26 163 + 165: 6(int) Load 164 + 166: 20(int) Load 132(byteAddrTemp) + 167: 20(int) IAdd 166 24 + 168: 30(ptr) AccessChain 18(sbuf) 26 167 + 169: 6(int) Load 168 + 170: 20(int) Load 132(byteAddrTemp) + 171: 20(int) IAdd 170 147 + 172: 30(ptr) AccessChain 18(sbuf) 26 171 + 173: 6(int) Load 172 + 174: 151(ivec4) CompositeConstruct 161 165 169 173 + 175: 6(int) CompositeExtract 174 1 + 176: 30(ptr) AccessChain 18(sbuf) 26 156 + Store 176 175 + 177: 20(int) Load 128(byteAddrTemp) + 178: 20(int) IAdd 177 24 + 179: 6(int) Load 11(pos) + 180: 20(int) ShiftRightLogical 179 24 + Store 132(byteAddrTemp) 180 + 181: 20(int) Load 132(byteAddrTemp) + 182: 30(ptr) AccessChain 18(sbuf) 26 181 + 183: 6(int) Load 182 + 184: 20(int) Load 132(byteAddrTemp) + 185: 20(int) IAdd 184 45 + 186: 30(ptr) AccessChain 18(sbuf) 26 185 + 187: 6(int) Load 186 + 188: 20(int) Load 132(byteAddrTemp) + 189: 20(int) IAdd 188 24 + 190: 30(ptr) AccessChain 18(sbuf) 26 189 + 191: 6(int) Load 190 + 192: 20(int) Load 132(byteAddrTemp) + 193: 20(int) IAdd 192 147 + 194: 30(ptr) AccessChain 18(sbuf) 26 193 + 195: 6(int) Load 194 + 196: 151(ivec4) CompositeConstruct 183 187 191 195 + 197: 6(int) CompositeExtract 196 2 + 198: 30(ptr) AccessChain 18(sbuf) 26 178 + Store 198 197 + 199: 20(int) Load 128(byteAddrTemp) + 200: 20(int) IAdd 199 147 + 201: 6(int) Load 11(pos) + 202: 20(int) ShiftRightLogical 201 24 + Store 132(byteAddrTemp) 202 + 203: 20(int) Load 132(byteAddrTemp) + 204: 30(ptr) AccessChain 18(sbuf) 26 203 + 205: 6(int) Load 204 + 206: 20(int) Load 132(byteAddrTemp) + 207: 20(int) IAdd 206 45 + 208: 30(ptr) AccessChain 18(sbuf) 26 207 + 209: 6(int) Load 208 + 210: 20(int) Load 132(byteAddrTemp) + 211: 20(int) IAdd 210 24 + 212: 30(ptr) AccessChain 18(sbuf) 26 211 + 213: 6(int) Load 212 + 214: 20(int) Load 132(byteAddrTemp) + 215: 20(int) IAdd 214 147 + 216: 30(ptr) AccessChain 18(sbuf) 26 215 + 217: 6(int) Load 216 + 218: 151(ivec4) CompositeConstruct 205 209 213 217 + 220: 6(int) CompositeExtract 218 3 + 221: 30(ptr) AccessChain 18(sbuf) 26 200 + Store 221 220 + 222: 6(int) Load 11(pos) + 223: 20(int) ShiftRightLogical 222 24 + 224: 30(ptr) AccessChain 18(sbuf) 26 223 + 225: 6(int) Load 224 + 226: 8(float) ConvertUToF 225 + 227: 9(fvec4) CompositeConstruct 226 226 226 226 + ReturnValue 227 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structin.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structin.vert.out index 45304f52d53..d7f539d0c43 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structin.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.structin.vert.out @@ -340,7 +340,7 @@ Shader version: 500 0:? 'e' (layout( location=5) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 94 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out index 470699a7374..99aeb96b92a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out @@ -430,7 +430,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 204 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.switch.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.switch.frag.out index f1e3a4eb7eb..b72891ea5ad 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.switch.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.switch.frag.out @@ -36,7 +36,7 @@ gl_FragCoord origin is upper left 0:17 Pre-Decrement ( temp 4-component vector of float) 0:17 'input' ( in 4-component vector of float) 0:18 Branch: Break -0:21 switch +0:21 switch: DontFlatten 0:21 condition 0:21 'c' ( in int) 0:21 body @@ -186,7 +186,7 @@ gl_FragCoord origin is upper left 0:17 Pre-Decrement ( temp 4-component vector of float) 0:17 'input' ( in 4-component vector of float) 0:18 Branch: Break -0:21 switch +0:21 switch: DontFlatten 0:21 condition 0:21 'c' ( in int) 0:21 body @@ -296,7 +296,7 @@ gl_FragCoord origin is upper left 0:? 'd' (layout( location=2) flat in int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 106 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.swizzle.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.swizzle.frag.out index 380a8bf759e..c734d509835 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.swizzle.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.swizzle.frag.out @@ -77,7 +77,7 @@ gl_FragCoord origin is upper left 0:? 'AmbientColor' ( global 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 30 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.synthesizeInput.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.synthesizeInput.frag.out index 521ff7473fa..bbe97434eee 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.synthesizeInput.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.synthesizeInput.frag.out @@ -98,7 +98,7 @@ gl_FragCoord origin is upper left 0:? 'input.no_interp' (layout( location=1) flat in uint) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 44 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.target.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.target.frag.out index 2a62e8540a5..00017968160 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.target.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.target.frag.out @@ -114,7 +114,7 @@ gl_FragCoord origin is upper left 0:? 'out2' (layout( location=3) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct1.frag.out index f1edfbd3bc5..371ce2a10be 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct1.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct1.frag.out @@ -184,7 +184,7 @@ gl_FragCoord origin is upper left 0:? 'po' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 65 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct2.frag.out index 3800604b346..e6099c9eba3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.targetStruct2.frag.out @@ -184,7 +184,7 @@ gl_FragCoord origin is upper left 0:? 'po' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 65 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.templatetypes.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.templatetypes.frag.out index 88783f69608..3fc5846aeb8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.templatetypes.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.templatetypes.frag.out @@ -508,7 +508,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 153 Capability Shader @@ -571,8 +571,8 @@ gl_FragCoord origin is upper left 28: 25(int) Constant 1 29: TypePointer Function 6(float) 31: TypeFloat 64 - 32: TypePointer Function 31(float) - 34: 31(float) Constant 0 1072693248 + 32: TypePointer Function 31(float64_t) + 34:31(float64_t) Constant 0 1072693248 35: TypeInt 32 0 36: TypePointer Function 35(int) 38: 35(int) Constant 1 @@ -587,10 +587,10 @@ gl_FragCoord origin is upper left 49: TypeVector 6(float) 2 50: TypePointer Function 49(fvec2) 52: 49(fvec2) ConstantComposite 13 14 - 53: TypeVector 31(float) 2 - 54: TypePointer Function 53(fvec2) - 56: 31(float) Constant 0 1073741824 - 57: 53(fvec2) ConstantComposite 34 56 + 53: TypeVector 31(float64_t) 2 + 54: TypePointer Function 53(f64vec2) + 56:31(float64_t) Constant 0 1073741824 + 57: 53(f64vec2) ConstantComposite 34 56 58: TypeVector 35(int) 2 59: TypePointer Function 58(ivec2) 61: 35(int) Constant 2 @@ -605,10 +605,10 @@ gl_FragCoord origin is upper left 72: TypeVector 6(float) 3 73: TypePointer Function 72(fvec3) 75: 72(fvec3) ConstantComposite 13 14 15 - 76: TypeVector 31(float) 3 - 77: TypePointer Function 76(fvec3) - 79: 31(float) Constant 0 1074266112 - 80: 76(fvec3) ConstantComposite 34 56 79 + 76: TypeVector 31(float64_t) 3 + 77: TypePointer Function 76(f64vec3) + 79:31(float64_t) Constant 0 1074266112 + 80: 76(f64vec3) ConstantComposite 34 56 79 81: TypeVector 35(int) 3 82: TypePointer Function 81(ivec3) 84: 35(int) Constant 3 @@ -620,10 +620,10 @@ gl_FragCoord origin is upper left 91: TypePointer Function 90(ivec4) 93: 25(int) Constant 4 94: 90(ivec4) ConstantComposite 28 47 70 93 - 96: TypeVector 31(float) 4 - 97: TypePointer Function 96(fvec4) - 99: 31(float) Constant 0 1074790400 - 100: 96(fvec4) ConstantComposite 34 56 79 99 + 96: TypeVector 31(float64_t) 4 + 97: TypePointer Function 96(f64vec4) + 99:31(float64_t) Constant 0 1074790400 + 100: 96(f64vec4) ConstantComposite 34 56 79 99 101: TypeVector 35(int) 4 102: TypePointer Function 101(ivec4) 104: 35(int) Constant 4 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.struct.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.struct.frag.out index 2aa7bd2c04f..62cb57497cd 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.struct.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.struct.frag.out @@ -837,8 +837,12 @@ gl_FragCoord origin is upper left 0:? 'g_tTex2s1a' ( uniform texture2D) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +error: SPIRV-Tools Validation Errors +error: OpStore Pointer '185's type does not match Object '184's type. + OpStore %185 %184 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 240 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out index deaa82b5c98..bf0f146ef34 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texture.subvec4.frag.out @@ -356,7 +356,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 130 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texturebuffer.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texturebuffer.frag.out index e1e36b00f25..89b5c542fe5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texturebuffer.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.texturebuffer.frag.out @@ -70,7 +70,7 @@ gl_FragCoord origin is upper left 0:? 'pos' ( in 4-component vector of float FragCoord) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.this.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.this.frag.out index f538abc32bb..ac5fde8b95b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.this.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.this.frag.out @@ -240,7 +240,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 98 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tristream-append.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tristream-append.geom.out new file mode 100644 index 00000000000..c11672495d2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tristream-append.geom.out @@ -0,0 +1,216 @@ +hlsl.tristream-append.geom +Shader version: 500 +invocations = -1 +max_vertices = 3 +input primitive = triangles +output primitive = triangle_strip +0:? Sequence +0:8 Function Definition: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:8 Function Parameters: +0:8 'output' ( in structure{}) +0:8 'TriStream' ( out structure{}) +0:? Sequence +0:9 Sequence +0:9 Sequence +0:9 move second child to first child ( temp structure{}) +0:9 'TriStream' ( out structure{}) +0:9 'output' ( in structure{}) +0:9 EmitVertex ( temp void) +0:14 Function Definition: @main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1; ( temp void) +0:14 Function Parameters: +0:14 'input' ( in 3-element array of structure{}) +0:14 'TriStream' ( out structure{}) +0:? Sequence +0:15 Function Call: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:15 direct index ( temp structure{}) +0:15 'input' ( in 3-element array of structure{}) +0:15 Constant: +0:15 0 (const int) +0:15 'TriStream' ( out structure{}) +0:16 Function Call: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:16 direct index ( temp structure{}) +0:16 'input' ( in 3-element array of structure{}) +0:16 Constant: +0:16 1 (const int) +0:16 'TriStream' ( out structure{}) +0:17 Function Call: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:17 direct index ( temp structure{}) +0:17 'input' ( in 3-element array of structure{}) +0:17 Constant: +0:17 2 (const int) +0:17 'TriStream' ( out structure{}) +0:14 Function Definition: main( ( temp void) +0:14 Function Parameters: +0:? Sequence +0:14 move second child to first child ( temp 3-element array of structure{}) +0:? 'input' ( temp 3-element array of structure{}) +0:? 'input' ( in 3-element array of structure{}) +0:14 Function Call: @main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1; ( temp void) +0:? 'input' ( temp 3-element array of structure{}) +0:? 'TriStream' ( temp structure{}) +0:? Linker Objects + + +Linked geometry stage: + + +Shader version: 500 +invocations = 1 +max_vertices = 3 +input primitive = triangles +output primitive = triangle_strip +0:? Sequence +0:8 Function Definition: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:8 Function Parameters: +0:8 'output' ( in structure{}) +0:8 'TriStream' ( out structure{}) +0:? Sequence +0:9 Sequence +0:9 Sequence +0:9 move second child to first child ( temp structure{}) +0:9 'TriStream' ( out structure{}) +0:9 'output' ( in structure{}) +0:9 EmitVertex ( temp void) +0:14 Function Definition: @main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1; ( temp void) +0:14 Function Parameters: +0:14 'input' ( in 3-element array of structure{}) +0:14 'TriStream' ( out structure{}) +0:? Sequence +0:15 Function Call: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:15 direct index ( temp structure{}) +0:15 'input' ( in 3-element array of structure{}) +0:15 Constant: +0:15 0 (const int) +0:15 'TriStream' ( out structure{}) +0:16 Function Call: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:16 direct index ( temp structure{}) +0:16 'input' ( in 3-element array of structure{}) +0:16 Constant: +0:16 1 (const int) +0:16 'TriStream' ( out structure{}) +0:17 Function Call: EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1; ( temp void) +0:17 direct index ( temp structure{}) +0:17 'input' ( in 3-element array of structure{}) +0:17 Constant: +0:17 2 (const int) +0:17 'TriStream' ( out structure{}) +0:14 Function Definition: main( ( temp void) +0:14 Function Parameters: +0:? Sequence +0:14 move second child to first child ( temp 3-element array of structure{}) +0:? 'input' ( temp 3-element array of structure{}) +0:? 'input' ( in 3-element array of structure{}) +0:14 Function Call: @main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1; ( temp void) +0:? 'input' ( temp 3-element array of structure{}) +0:? 'TriStream' ( temp structure{}) +0:? Linker Objects + +error: SPIRV-Tools Validation Errors +error: Output variable id <23> is used by entry point 'main' id <4>, but is not listed as an interface + %TriStream_1 = OpVariable %_ptr_Output_GSPS_INPUT Output + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 57 + + Capability Geometry + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Geometry 4 "main" + ExecutionMode 4 Triangles + ExecutionMode 4 Invocations 1 + ExecutionMode 4 OutputTriangleStrip + ExecutionMode 4 OutputVertices 3 + Source HLSL 500 + Name 4 "main" + Name 6 "GSPS_INPUT" + Name 11 "EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1;" + Name 9 "output" + Name 10 "TriStream" + Name 20 "@main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1;" + Name 18 "input" + Name 19 "TriStream" + Name 23 "TriStream" + Name 27 "param" + Name 30 "param" + Name 34 "param" + Name 37 "param" + Name 41 "param" + Name 44 "param" + Name 47 "input" + Name 49 "input" + Name 51 "TriStream" + Name 52 "param" + Name 54 "param" + 2: TypeVoid + 3: TypeFunction 2 + 6(GSPS_INPUT): TypeStruct + 7: TypePointer Function 6(GSPS_INPUT) + 8: TypeFunction 2 7(ptr) 7(ptr) + 13: TypeInt 32 0 + 14: 13(int) Constant 3 + 15: TypeArray 6(GSPS_INPUT) 14 + 16: TypePointer Function 15 + 17: TypeFunction 2 16(ptr) 7(ptr) + 22: TypePointer Output 6(GSPS_INPUT) + 23(TriStream): 22(ptr) Variable Output + 25: TypeInt 32 1 + 26: 25(int) Constant 0 + 33: 25(int) Constant 1 + 40: 25(int) Constant 2 + 48: TypePointer Input 15 + 49(input): 48(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 47(input): 16(ptr) Variable Function + 51(TriStream): 7(ptr) Variable Function + 52(param): 16(ptr) Variable Function + 54(param): 7(ptr) Variable Function + 50: 15 Load 49(input) + Store 47(input) 50 + 53: 15 Load 47(input) + Store 52(param) 53 + 55: 2 FunctionCall 20(@main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1;) 52(param) 54(param) + 56:6(GSPS_INPUT) Load 54(param) + Store 51(TriStream) 56 + Return + FunctionEnd +11(EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1;): 2 Function None 8 + 9(output): 7(ptr) FunctionParameter + 10(TriStream): 7(ptr) FunctionParameter + 12: Label + 24:6(GSPS_INPUT) Load 9(output) + Store 23(TriStream) 24 + EmitVertex + Return + FunctionEnd +20(@main(struct-GSPS_INPUT1[3];struct-GSPS_INPUT1;): 2 Function None 17 + 18(input): 16(ptr) FunctionParameter + 19(TriStream): 7(ptr) FunctionParameter + 21: Label + 27(param): 7(ptr) Variable Function + 30(param): 7(ptr) Variable Function + 34(param): 7(ptr) Variable Function + 37(param): 7(ptr) Variable Function + 41(param): 7(ptr) Variable Function + 44(param): 7(ptr) Variable Function + 28: 7(ptr) AccessChain 18(input) 26 + 29:6(GSPS_INPUT) Load 28 + Store 27(param) 29 + 31: 2 FunctionCall 11(EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1;) 27(param) 30(param) + 32:6(GSPS_INPUT) Load 30(param) + Store 19(TriStream) 32 + 35: 7(ptr) AccessChain 18(input) 33 + 36:6(GSPS_INPUT) Load 35 + Store 34(param) 36 + 38: 2 FunctionCall 11(EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1;) 34(param) 37(param) + 39:6(GSPS_INPUT) Load 37(param) + Store 19(TriStream) 39 + 42: 7(ptr) AccessChain 18(input) 40 + 43:6(GSPS_INPUT) Load 42 + Store 41(param) 43 + 45: 2 FunctionCall 11(EmitVertex(struct-GSPS_INPUT1;struct-GSPS_INPUT1;) 41(param) 44(param) + 46:6(GSPS_INPUT) Load 44(param) + Store 19(TriStream) 46 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.bracket.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.bracket.frag.out index 94bea4cd3b5..400beb611cc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.bracket.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.bracket.frag.out @@ -422,7 +422,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 188 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.overload.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.overload.frag.out index 6e6bef07f07..c8d064a33af 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.overload.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.tx.overload.frag.out @@ -134,7 +134,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 73 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.half.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.half.frag.out index 75750f92efc..6b5a945b9d9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.half.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.half.frag.out @@ -164,7 +164,7 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 60 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.identifier.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.identifier.frag.out index fe6ac01d49c..2eaa2ae461d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.identifier.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.identifier.frag.out @@ -86,7 +86,7 @@ gl_FragCoord origin is upper left 0:25 'uint' ( temp mediump uint) 0:25 'min16float' ( temp mediump float) 0:25 'min10float' ( temp mediump float) -0:25 Test condition and select ( temp mediump float) +0:25 Test condition and select ( temp mediump float): no shortcircuit 0:25 Condition 0:25 direct index ( temp bool) 0:25 'bool' ( temp 2-element array of bool) @@ -221,7 +221,7 @@ gl_FragCoord origin is upper left 0:25 'uint' ( temp mediump uint) 0:25 'min16float' ( temp mediump float) 0:25 'min10float' ( temp mediump float) -0:25 Test condition and select ( temp mediump float) +0:25 Test condition and select ( temp mediump float): no shortcircuit 0:25 Condition 0:25 direct index ( temp bool) 0:25 'bool' ( temp 2-element array of bool) @@ -266,13 +266,13 @@ gl_FragCoord origin is upper left 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 109 +// Generated by (magic number): 80007 +// Id's are bound by 105 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 107 + EntryPoint Fragment 4 "main" 103 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -289,9 +289,9 @@ gl_FragCoord origin is upper left Name 56 "foo_t" MemberName 56(foo_t) 0 "float" Name 58 "float" - Name 86 "param" - Name 93 "half2x3" - Name 107 "@entryPointOutput" + Name 82 "param" + Name 89 "half2x3" + Name 103 "@entryPointOutput" Decorate 49(min16float) RelaxedPrecision Decorate 50 RelaxedPrecision Decorate 51 RelaxedPrecision @@ -308,15 +308,14 @@ gl_FragCoord origin is upper left Decorate 72 RelaxedPrecision Decorate 73 RelaxedPrecision Decorate 74 RelaxedPrecision - Decorate 80 RelaxedPrecision + Decorate 77 RelaxedPrecision + Decorate 78 RelaxedPrecision + Decorate 79 RelaxedPrecision Decorate 81 RelaxedPrecision Decorate 83 RelaxedPrecision Decorate 84 RelaxedPrecision Decorate 85 RelaxedPrecision - Decorate 87 RelaxedPrecision - Decorate 88 RelaxedPrecision - Decorate 89 RelaxedPrecision - Decorate 107(@entryPointOutput) Location 0 + Decorate 103(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -341,16 +340,16 @@ gl_FragCoord origin is upper left 56(foo_t): TypeStruct 6(float) 57: TypePointer Function 56(foo_t) 59: 6(float) Constant 1109917696 - 90: TypeVector 6(float) 3 - 91: TypeMatrix 90(fvec3) 2 - 92: TypePointer Function 91 - 97: 22(int) Constant 0 - 106: TypePointer Output 12(fvec4) -107(@entryPointOutput): 106(ptr) Variable Output + 86: TypeVector 6(float) 3 + 87: TypeMatrix 86(fvec3) 2 + 88: TypePointer Function 87 + 93: 22(int) Constant 0 + 102: TypePointer Output 12(fvec4) +103(@entryPointOutput): 102(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 108: 12(fvec4) FunctionCall 14(@main() - Store 107(@entryPointOutput) 108 + 104: 12(fvec4) FunctionCall 14(@main() + Store 103(@entryPointOutput) 104 Return FunctionEnd 10(fn(f1;): 6(float) Function None 8 @@ -369,9 +368,8 @@ gl_FragCoord origin is upper left 52(min10float): 7(ptr) Variable Function 54(half): 7(ptr) Variable Function 58(float): 57(ptr) Variable Function - 75: 7(ptr) Variable Function - 86(param): 7(ptr) Variable Function - 93(half2x3): 92(ptr) Variable Function + 82(param): 7(ptr) Variable Function + 89(half2x3): 88(ptr) Variable Function Store 19(float) 20 27: 6(float) Load 19(float) 29: 21(bool) FOrdNotEqual 27 28 @@ -412,36 +410,27 @@ gl_FragCoord origin is upper left 72: 6(float) FAdd 70 71 73: 6(float) Load 52(min10float) 74: 6(float) FAdd 72 73 - 76: 37(ptr) AccessChain 26(bool) 40 - 77: 21(bool) Load 76 - SelectionMerge 79 None - BranchConditional 77 78 82 - 78: Label - 80: 33(int) Load 35(int) - 81: 6(float) ConvertSToF 80 - Store 75 81 - Branch 79 - 82: Label - 83: 6(float) Load 19(float) - Store 75 83 - Branch 79 - 79: Label - 84: 6(float) Load 75 - 85: 6(float) FAdd 74 84 - 87: 6(float) Load 19(float) - Store 86(param) 87 - 88: 6(float) FunctionCall 10(fn(f1;) 86(param) - 89: 6(float) FAdd 85 88 - Store 19(float) 89 - 94: 6(float) Load 19(float) + 75: 37(ptr) AccessChain 26(bool) 40 + 76: 21(bool) Load 75 + 77: 33(int) Load 35(int) + 78: 6(float) ConvertSToF 77 + 79: 6(float) Load 19(float) + 80: 6(float) Select 76 78 79 + 81: 6(float) FAdd 74 80 + 83: 6(float) Load 19(float) + Store 82(param) 83 + 84: 6(float) FunctionCall 10(fn(f1;) 82(param) + 85: 6(float) FAdd 81 84 + Store 19(float) 85 + 90: 6(float) Load 19(float) + 91: 6(float) Load 19(float) + 92: 6(float) FMul 90 91 + 94: 7(ptr) AccessChain 89(half2x3) 40 93 + Store 94 92 95: 6(float) Load 19(float) - 96: 6(float) FMul 94 95 - 98: 7(ptr) AccessChain 93(half2x3) 40 97 - Store 98 96 - 99: 6(float) Load 19(float) - 100: 7(ptr) AccessChain 93(half2x3) 40 97 - 101: 6(float) Load 100 - 102: 6(float) FAdd 99 101 - 103: 12(fvec4) CompositeConstruct 102 102 102 102 - ReturnValue 103 + 96: 7(ptr) AccessChain 89(half2x3) 40 93 + 97: 6(float) Load 96 + 98: 6(float) FAdd 95 97 + 99: 12(fvec4) CompositeConstruct 98 98 98 98 + ReturnValue 99 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.type.conversion.all.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.type.conversion.all.frag.out new file mode 100644 index 00000000000..083c92969da --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.type.conversion.all.frag.out @@ -0,0 +1,1469 @@ +hlsl.type.type.conversion.all.frag +ERROR: 0:88: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:89: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:90: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:91: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:92: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:93: '=' : cannot convert from ' const 3X4 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:94: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:95: '=' : cannot convert from ' const 4X3 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:96: '=' : cannot convert from ' const 4X4 matrix of float' to ' temp 2-component vector of float' +ERROR: 0:97: '=' : cannot convert from ' const 2-component vector of float' to ' temp 3-component vector of float' +ERROR: 0:98: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:99: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:100: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:101: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:102: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:103: '=' : cannot convert from ' const 3X4 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:104: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:105: '=' : cannot convert from ' const 4X3 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:106: '=' : cannot convert from ' const 4X4 matrix of float' to ' temp 3-component vector of float' +ERROR: 0:107: '=' : cannot convert from ' const 2-component vector of float' to ' temp 4-component vector of float' +ERROR: 0:108: '=' : cannot convert from ' const 3-component vector of float' to ' temp 4-component vector of float' +ERROR: 0:109: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:110: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:111: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:112: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:113: '=' : cannot convert from ' const 3X4 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:114: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:115: '=' : cannot convert from ' const 4X3 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:116: '=' : cannot convert from ' const 4X4 matrix of float' to ' temp 4-component vector of float' +ERROR: 0:117: '=' : cannot convert from ' const 2-component vector of float' to ' temp 2X2 matrix of float' +ERROR: 0:118: '=' : cannot convert from ' const 3-component vector of float' to ' temp 2X2 matrix of float' +ERROR: 0:119: '=' : cannot convert from ' const 2-component vector of float' to ' temp 2X3 matrix of float' +ERROR: 0:120: '=' : cannot convert from ' const 3-component vector of float' to ' temp 2X3 matrix of float' +ERROR: 0:121: '=' : cannot convert from ' const 4-component vector of float' to ' temp 2X3 matrix of float' +ERROR: 0:122: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 0:123: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 0:124: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 0:125: '=' : cannot convert from ' const 2-component vector of float' to ' temp 2X4 matrix of float' +ERROR: 0:126: '=' : cannot convert from ' const 3-component vector of float' to ' temp 2X4 matrix of float' +ERROR: 0:127: '=' : cannot convert from ' const 4-component vector of float' to ' temp 2X4 matrix of float' +ERROR: 0:128: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 2X4 matrix of float' +ERROR: 0:129: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 2X4 matrix of float' +ERROR: 0:130: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 2X4 matrix of float' +ERROR: 0:131: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 2X4 matrix of float' +ERROR: 0:132: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 2X4 matrix of float' +ERROR: 0:133: '=' : cannot convert from ' const 4X3 matrix of float' to ' temp 2X4 matrix of float' +ERROR: 0:134: '=' : cannot convert from ' const 2-component vector of float' to ' temp 3X2 matrix of float' +ERROR: 0:135: '=' : cannot convert from ' const 3-component vector of float' to ' temp 3X2 matrix of float' +ERROR: 0:136: '=' : cannot convert from ' const 4-component vector of float' to ' temp 3X2 matrix of float' +ERROR: 0:137: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 3X2 matrix of float' +ERROR: 0:138: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 3X2 matrix of float' +ERROR: 0:139: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 3X2 matrix of float' +ERROR: 0:140: '=' : cannot convert from ' const 2-component vector of float' to ' temp 3X3 matrix of float' +ERROR: 0:141: '=' : cannot convert from ' const 3-component vector of float' to ' temp 3X3 matrix of float' +ERROR: 0:142: '=' : cannot convert from ' const 4-component vector of float' to ' temp 3X3 matrix of float' +ERROR: 0:143: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 3X3 matrix of float' +ERROR: 0:144: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 3X3 matrix of float' +ERROR: 0:145: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 3X3 matrix of float' +ERROR: 0:146: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 3X3 matrix of float' +ERROR: 0:147: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 3X3 matrix of float' +ERROR: 0:148: '=' : cannot convert from ' const 2-component vector of float' to ' temp 3X4 matrix of float' +ERROR: 0:149: '=' : cannot convert from ' const 3-component vector of float' to ' temp 3X4 matrix of float' +ERROR: 0:150: '=' : cannot convert from ' const 4-component vector of float' to ' temp 3X4 matrix of float' +ERROR: 0:151: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:152: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:153: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:154: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:155: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:156: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:157: '=' : cannot convert from ' const 4X3 matrix of float' to ' temp 3X4 matrix of float' +ERROR: 0:158: '=' : cannot convert from ' const 2-component vector of float' to ' temp 4X2 matrix of float' +ERROR: 0:159: '=' : cannot convert from ' const 3-component vector of float' to ' temp 4X2 matrix of float' +ERROR: 0:160: '=' : cannot convert from ' const 4-component vector of float' to ' temp 4X2 matrix of float' +ERROR: 0:161: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 4X2 matrix of float' +ERROR: 0:162: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 4X2 matrix of float' +ERROR: 0:163: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 4X2 matrix of float' +ERROR: 0:164: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 4X2 matrix of float' +ERROR: 0:165: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 4X2 matrix of float' +ERROR: 0:166: '=' : cannot convert from ' const 3X4 matrix of float' to ' temp 4X2 matrix of float' +ERROR: 0:167: '=' : cannot convert from ' const 2-component vector of float' to ' temp 4X3 matrix of float' +ERROR: 0:168: '=' : cannot convert from ' const 3-component vector of float' to ' temp 4X3 matrix of float' +ERROR: 0:169: '=' : cannot convert from ' const 4-component vector of float' to ' temp 4X3 matrix of float' +ERROR: 0:170: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:171: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:172: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:173: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:174: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:175: '=' : cannot convert from ' const 3X4 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:176: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 4X3 matrix of float' +ERROR: 0:177: '=' : cannot convert from ' const 2-component vector of float' to ' temp 4X4 matrix of float' +ERROR: 0:178: '=' : cannot convert from ' const 3-component vector of float' to ' temp 4X4 matrix of float' +ERROR: 0:179: '=' : cannot convert from ' const 4-component vector of float' to ' temp 4X4 matrix of float' +ERROR: 0:180: '=' : cannot convert from ' const 2X2 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:181: '=' : cannot convert from ' const 2X3 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:182: '=' : cannot convert from ' const 2X4 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:183: '=' : cannot convert from ' const 3X2 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:184: '=' : cannot convert from ' const 3X3 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:185: '=' : cannot convert from ' const 3X4 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:186: '=' : cannot convert from ' const 4X2 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 0:187: '=' : cannot convert from ' const 4X3 matrix of float' to ' temp 4X4 matrix of float' +ERROR: 100 compilation errors. No code generated. + + +Shader version: 500 +gl_FragCoord origin is upper left +ERROR: node is still EOpNull! +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'var0' ( temp float) +0:19 Constant: +0:19 0.000000 +0:20 Sequence +0:20 move second child to first child ( temp 2-component vector of float) +0:20 'var13' ( temp 2-component vector of float) +0:20 Constant: +0:20 0.000000 +0:20 0.000000 +0:21 Sequence +0:21 move second child to first child ( temp 2-component vector of float) +0:21 'var14' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:22 Sequence +0:22 move second child to first child ( temp 3-component vector of float) +0:22 'var26' ( temp 3-component vector of float) +0:22 Constant: +0:22 0.000000 +0:22 0.000000 +0:22 0.000000 +0:23 Sequence +0:23 move second child to first child ( temp 3-component vector of float) +0:23 'var28' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:24 Sequence +0:24 move second child to first child ( temp 4-component vector of float) +0:24 'var39' ( temp 4-component vector of float) +0:24 Constant: +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'var42' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:26 Sequence +0:26 move second child to first child ( temp 4-component vector of float) +0:26 'var43' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:27 Sequence +0:27 move second child to first child ( temp 2X2 matrix of float) +0:27 'var52' ( temp 2X2 matrix of float) +0:27 Constant: +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:28 Sequence +0:28 move second child to first child ( temp 2X2 matrix of float) +0:28 'var55' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:29 Sequence +0:29 move second child to first child ( temp 2X2 matrix of float) +0:29 'var56' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:30 Sequence +0:30 move second child to first child ( temp 2X3 matrix of float) +0:30 'var65' ( temp 2X3 matrix of float) +0:30 Constant: +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:31 Sequence +0:31 move second child to first child ( temp 2X3 matrix of float) +0:31 'var70' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:32 Sequence +0:32 move second child to first child ( temp 2X4 matrix of float) +0:32 'var78' ( temp 2X4 matrix of float) +0:32 Constant: +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:33 Sequence +0:33 move second child to first child ( temp 2X4 matrix of float) +0:33 'var84' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:34 Sequence +0:34 move second child to first child ( temp 3X2 matrix of float) +0:34 'var91' ( temp 3X2 matrix of float) +0:34 Constant: +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:35 Sequence +0:35 move second child to first child ( temp 3X2 matrix of float) +0:35 'var98' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:36 Sequence +0:36 move second child to first child ( temp 3X3 matrix of float) +0:36 'var104' ( temp 3X3 matrix of float) +0:36 Constant: +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:37 Sequence +0:37 move second child to first child ( temp 3X3 matrix of float) +0:37 'var112' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:38 Sequence +0:38 move second child to first child ( temp 3X4 matrix of float) +0:38 'var117' ( temp 3X4 matrix of float) +0:38 Constant: +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:39 Sequence +0:39 move second child to first child ( temp 3X4 matrix of float) +0:39 'var126' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:40 Sequence +0:40 move second child to first child ( temp 4X2 matrix of float) +0:40 'var130' ( temp 4X2 matrix of float) +0:40 Constant: +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:41 Sequence +0:41 move second child to first child ( temp 4X2 matrix of float) +0:41 'var140' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:42 Sequence +0:42 move second child to first child ( temp 4X3 matrix of float) +0:42 'var143' ( temp 4X3 matrix of float) +0:42 Constant: +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:43 Sequence +0:43 move second child to first child ( temp 4X3 matrix of float) +0:43 'var154' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:44 Sequence +0:44 move second child to first child ( temp 4X4 matrix of float) +0:44 'var156' ( temp 4X4 matrix of float) +0:44 Constant: +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:45 Sequence +0:45 move second child to first child ( temp 4X4 matrix of float) +0:45 'var168' ( temp 4X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:46 Sequence +0:46 move second child to first child ( temp float) +0:46 'var1' ( temp float) +0:? Constant: +0:? 0.000000 +0:47 Sequence +0:47 move second child to first child ( temp float) +0:47 'var2' ( temp float) +0:? Constant: +0:? 0.000000 +0:48 Sequence +0:48 move second child to first child ( temp float) +0:48 'var3' ( temp float) +0:? Constant: +0:? 0.000000 +0:49 Sequence +0:49 move second child to first child ( temp float) +0:49 'var4' ( temp float) +0:? Constant: +0:? 0.000000 +0:50 Sequence +0:50 move second child to first child ( temp float) +0:50 'var5' ( temp float) +0:? Constant: +0:? 0.000000 +0:51 Sequence +0:51 move second child to first child ( temp float) +0:51 'var6' ( temp float) +0:? Constant: +0:? 0.000000 +0:52 Sequence +0:52 move second child to first child ( temp float) +0:52 'var7' ( temp float) +0:? Constant: +0:? 0.000000 +0:53 Sequence +0:53 move second child to first child ( temp float) +0:53 'var8' ( temp float) +0:? Constant: +0:? 0.000000 +0:54 Sequence +0:54 move second child to first child ( temp float) +0:54 'var9' ( temp float) +0:? Constant: +0:? 0.000000 +0:55 Sequence +0:55 move second child to first child ( temp float) +0:55 'var10' ( temp float) +0:? Constant: +0:? 0.000000 +0:56 Sequence +0:56 move second child to first child ( temp float) +0:56 'var11' ( temp float) +0:? Constant: +0:? 0.000000 +0:57 Sequence +0:57 move second child to first child ( temp float) +0:57 'var12' ( temp float) +0:? Constant: +0:? 0.000000 +0:58 Sequence +0:58 move second child to first child ( temp 2-component vector of float) +0:58 'var15' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:59 Sequence +0:59 move second child to first child ( temp 2-component vector of float) +0:59 'var16' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:60 Sequence +0:60 move second child to first child ( temp 3-component vector of float) +0:60 'var29' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:61 Sequence +0:61 move second child to first child ( temp 2X2 matrix of float) +0:61 'var57' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:62 Sequence +0:62 move second child to first child ( temp 2X2 matrix of float) +0:62 'var58' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:63 Sequence +0:63 move second child to first child ( temp 2X2 matrix of float) +0:63 'var59' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:64 Sequence +0:64 move second child to first child ( temp 2X2 matrix of float) +0:64 'var60' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:65 Sequence +0:65 move second child to first child ( temp 2X2 matrix of float) +0:65 'var61' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:66 Sequence +0:66 move second child to first child ( temp 2X2 matrix of float) +0:66 'var62' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:67 Sequence +0:67 move second child to first child ( temp 2X2 matrix of float) +0:67 'var63' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:68 Sequence +0:68 move second child to first child ( temp 2X2 matrix of float) +0:68 'var64' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:69 Sequence +0:69 move second child to first child ( temp 2X3 matrix of float) +0:69 'var71' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:70 Sequence +0:70 move second child to first child ( temp 2X3 matrix of float) +0:70 'var73' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:71 Sequence +0:71 move second child to first child ( temp 2X3 matrix of float) +0:71 'var74' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:72 Sequence +0:72 move second child to first child ( temp 2X3 matrix of float) +0:72 'var76' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:73 Sequence +0:73 move second child to first child ( temp 2X3 matrix of float) +0:73 'var77' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:74 Sequence +0:74 move second child to first child ( temp 2X4 matrix of float) +0:74 'var87' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:75 Sequence +0:75 move second child to first child ( temp 2X4 matrix of float) +0:75 'var90' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:76 Sequence +0:76 move second child to first child ( temp 3X2 matrix of float) +0:76 'var99' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:77 Sequence +0:77 move second child to first child ( temp 3X2 matrix of float) +0:77 'var100' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:78 Sequence +0:78 move second child to first child ( temp 3X2 matrix of float) +0:78 'var101' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:79 Sequence +0:79 move second child to first child ( temp 3X2 matrix of float) +0:79 'var102' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:80 Sequence +0:80 move second child to first child ( temp 3X2 matrix of float) +0:80 'var103' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:81 Sequence +0:81 move second child to first child ( temp 3X3 matrix of float) +0:81 'var113' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:82 Sequence +0:82 move second child to first child ( temp 3X3 matrix of float) +0:82 'var115' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:83 Sequence +0:83 move second child to first child ( temp 3X3 matrix of float) +0:83 'var116' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:84 Sequence +0:84 move second child to first child ( temp 3X4 matrix of float) +0:84 'var129' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:85 Sequence +0:85 move second child to first child ( temp 4X2 matrix of float) +0:85 'var141' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:86 Sequence +0:86 move second child to first child ( temp 4X2 matrix of float) +0:86 'var142' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:87 Sequence +0:87 move second child to first child ( temp 4X3 matrix of float) +0:87 'var155' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:188 Branch: Return with expression +0:188 Constant: +0:188 0.000000 +0:188 0.000000 +0:188 0.000000 +0:188 0.000000 +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +ERROR: node is still EOpNull! +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'var0' ( temp float) +0:19 Constant: +0:19 0.000000 +0:20 Sequence +0:20 move second child to first child ( temp 2-component vector of float) +0:20 'var13' ( temp 2-component vector of float) +0:20 Constant: +0:20 0.000000 +0:20 0.000000 +0:21 Sequence +0:21 move second child to first child ( temp 2-component vector of float) +0:21 'var14' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:22 Sequence +0:22 move second child to first child ( temp 3-component vector of float) +0:22 'var26' ( temp 3-component vector of float) +0:22 Constant: +0:22 0.000000 +0:22 0.000000 +0:22 0.000000 +0:23 Sequence +0:23 move second child to first child ( temp 3-component vector of float) +0:23 'var28' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:24 Sequence +0:24 move second child to first child ( temp 4-component vector of float) +0:24 'var39' ( temp 4-component vector of float) +0:24 Constant: +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'var42' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:26 Sequence +0:26 move second child to first child ( temp 4-component vector of float) +0:26 'var43' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:27 Sequence +0:27 move second child to first child ( temp 2X2 matrix of float) +0:27 'var52' ( temp 2X2 matrix of float) +0:27 Constant: +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:28 Sequence +0:28 move second child to first child ( temp 2X2 matrix of float) +0:28 'var55' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:29 Sequence +0:29 move second child to first child ( temp 2X2 matrix of float) +0:29 'var56' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:30 Sequence +0:30 move second child to first child ( temp 2X3 matrix of float) +0:30 'var65' ( temp 2X3 matrix of float) +0:30 Constant: +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:31 Sequence +0:31 move second child to first child ( temp 2X3 matrix of float) +0:31 'var70' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:32 Sequence +0:32 move second child to first child ( temp 2X4 matrix of float) +0:32 'var78' ( temp 2X4 matrix of float) +0:32 Constant: +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:33 Sequence +0:33 move second child to first child ( temp 2X4 matrix of float) +0:33 'var84' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:34 Sequence +0:34 move second child to first child ( temp 3X2 matrix of float) +0:34 'var91' ( temp 3X2 matrix of float) +0:34 Constant: +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:35 Sequence +0:35 move second child to first child ( temp 3X2 matrix of float) +0:35 'var98' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:36 Sequence +0:36 move second child to first child ( temp 3X3 matrix of float) +0:36 'var104' ( temp 3X3 matrix of float) +0:36 Constant: +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:37 Sequence +0:37 move second child to first child ( temp 3X3 matrix of float) +0:37 'var112' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:38 Sequence +0:38 move second child to first child ( temp 3X4 matrix of float) +0:38 'var117' ( temp 3X4 matrix of float) +0:38 Constant: +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:39 Sequence +0:39 move second child to first child ( temp 3X4 matrix of float) +0:39 'var126' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:40 Sequence +0:40 move second child to first child ( temp 4X2 matrix of float) +0:40 'var130' ( temp 4X2 matrix of float) +0:40 Constant: +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:41 Sequence +0:41 move second child to first child ( temp 4X2 matrix of float) +0:41 'var140' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:42 Sequence +0:42 move second child to first child ( temp 4X3 matrix of float) +0:42 'var143' ( temp 4X3 matrix of float) +0:42 Constant: +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:43 Sequence +0:43 move second child to first child ( temp 4X3 matrix of float) +0:43 'var154' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:44 Sequence +0:44 move second child to first child ( temp 4X4 matrix of float) +0:44 'var156' ( temp 4X4 matrix of float) +0:44 Constant: +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:45 Sequence +0:45 move second child to first child ( temp 4X4 matrix of float) +0:45 'var168' ( temp 4X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:46 Sequence +0:46 move second child to first child ( temp float) +0:46 'var1' ( temp float) +0:? Constant: +0:? 0.000000 +0:47 Sequence +0:47 move second child to first child ( temp float) +0:47 'var2' ( temp float) +0:? Constant: +0:? 0.000000 +0:48 Sequence +0:48 move second child to first child ( temp float) +0:48 'var3' ( temp float) +0:? Constant: +0:? 0.000000 +0:49 Sequence +0:49 move second child to first child ( temp float) +0:49 'var4' ( temp float) +0:? Constant: +0:? 0.000000 +0:50 Sequence +0:50 move second child to first child ( temp float) +0:50 'var5' ( temp float) +0:? Constant: +0:? 0.000000 +0:51 Sequence +0:51 move second child to first child ( temp float) +0:51 'var6' ( temp float) +0:? Constant: +0:? 0.000000 +0:52 Sequence +0:52 move second child to first child ( temp float) +0:52 'var7' ( temp float) +0:? Constant: +0:? 0.000000 +0:53 Sequence +0:53 move second child to first child ( temp float) +0:53 'var8' ( temp float) +0:? Constant: +0:? 0.000000 +0:54 Sequence +0:54 move second child to first child ( temp float) +0:54 'var9' ( temp float) +0:? Constant: +0:? 0.000000 +0:55 Sequence +0:55 move second child to first child ( temp float) +0:55 'var10' ( temp float) +0:? Constant: +0:? 0.000000 +0:56 Sequence +0:56 move second child to first child ( temp float) +0:56 'var11' ( temp float) +0:? Constant: +0:? 0.000000 +0:57 Sequence +0:57 move second child to first child ( temp float) +0:57 'var12' ( temp float) +0:? Constant: +0:? 0.000000 +0:58 Sequence +0:58 move second child to first child ( temp 2-component vector of float) +0:58 'var15' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:59 Sequence +0:59 move second child to first child ( temp 2-component vector of float) +0:59 'var16' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:60 Sequence +0:60 move second child to first child ( temp 3-component vector of float) +0:60 'var29' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:61 Sequence +0:61 move second child to first child ( temp 2X2 matrix of float) +0:61 'var57' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:62 Sequence +0:62 move second child to first child ( temp 2X2 matrix of float) +0:62 'var58' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:63 Sequence +0:63 move second child to first child ( temp 2X2 matrix of float) +0:63 'var59' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:64 Sequence +0:64 move second child to first child ( temp 2X2 matrix of float) +0:64 'var60' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:65 Sequence +0:65 move second child to first child ( temp 2X2 matrix of float) +0:65 'var61' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:66 Sequence +0:66 move second child to first child ( temp 2X2 matrix of float) +0:66 'var62' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:67 Sequence +0:67 move second child to first child ( temp 2X2 matrix of float) +0:67 'var63' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:68 Sequence +0:68 move second child to first child ( temp 2X2 matrix of float) +0:68 'var64' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:69 Sequence +0:69 move second child to first child ( temp 2X3 matrix of float) +0:69 'var71' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:70 Sequence +0:70 move second child to first child ( temp 2X3 matrix of float) +0:70 'var73' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:71 Sequence +0:71 move second child to first child ( temp 2X3 matrix of float) +0:71 'var74' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:72 Sequence +0:72 move second child to first child ( temp 2X3 matrix of float) +0:72 'var76' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:73 Sequence +0:73 move second child to first child ( temp 2X3 matrix of float) +0:73 'var77' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:74 Sequence +0:74 move second child to first child ( temp 2X4 matrix of float) +0:74 'var87' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:75 Sequence +0:75 move second child to first child ( temp 2X4 matrix of float) +0:75 'var90' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:76 Sequence +0:76 move second child to first child ( temp 3X2 matrix of float) +0:76 'var99' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:77 Sequence +0:77 move second child to first child ( temp 3X2 matrix of float) +0:77 'var100' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:78 Sequence +0:78 move second child to first child ( temp 3X2 matrix of float) +0:78 'var101' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:79 Sequence +0:79 move second child to first child ( temp 3X2 matrix of float) +0:79 'var102' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:80 Sequence +0:80 move second child to first child ( temp 3X2 matrix of float) +0:80 'var103' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:81 Sequence +0:81 move second child to first child ( temp 3X3 matrix of float) +0:81 'var113' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:82 Sequence +0:82 move second child to first child ( temp 3X3 matrix of float) +0:82 'var115' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:83 Sequence +0:83 move second child to first child ( temp 3X3 matrix of float) +0:83 'var116' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:84 Sequence +0:84 move second child to first child ( temp 3X4 matrix of float) +0:84 'var129' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:85 Sequence +0:85 move second child to first child ( temp 4X2 matrix of float) +0:85 'var141' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:86 Sequence +0:86 move second child to first child ( temp 4X2 matrix of float) +0:86 'var142' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:87 Sequence +0:87 move second child to first child ( temp 4X3 matrix of float) +0:87 'var155' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:188 Branch: Return with expression +0:188 Constant: +0:188 0.000000 +0:188 0.000000 +0:188 0.000000 +0:188 0.000000 +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.type.conversion.valid.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.type.conversion.valid.frag.out new file mode 100644 index 00000000000..fc67200146d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.type.type.conversion.valid.frag.out @@ -0,0 +1,1640 @@ +hlsl.type.type.conversion.valid.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'var0' ( temp float) +0:19 Constant: +0:19 0.000000 +0:20 Sequence +0:20 move second child to first child ( temp 2-component vector of float) +0:20 'var13' ( temp 2-component vector of float) +0:20 Constant: +0:20 0.000000 +0:20 0.000000 +0:21 Sequence +0:21 move second child to first child ( temp 2-component vector of float) +0:21 'var14' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:22 Sequence +0:22 move second child to first child ( temp 3-component vector of float) +0:22 'var26' ( temp 3-component vector of float) +0:22 Constant: +0:22 0.000000 +0:22 0.000000 +0:22 0.000000 +0:23 Sequence +0:23 move second child to first child ( temp 3-component vector of float) +0:23 'var28' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:24 Sequence +0:24 move second child to first child ( temp 4-component vector of float) +0:24 'var39' ( temp 4-component vector of float) +0:24 Constant: +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'var42' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:26 Sequence +0:26 move second child to first child ( temp 4-component vector of float) +0:26 'var43' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:27 Sequence +0:27 move second child to first child ( temp 2X2 matrix of float) +0:27 'var52' ( temp 2X2 matrix of float) +0:27 Constant: +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:28 Sequence +0:28 move second child to first child ( temp 2X2 matrix of float) +0:28 'var55' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:29 Sequence +0:29 move second child to first child ( temp 2X2 matrix of float) +0:29 'var56' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:30 Sequence +0:30 move second child to first child ( temp 2X3 matrix of float) +0:30 'var65' ( temp 2X3 matrix of float) +0:30 Constant: +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:31 Sequence +0:31 move second child to first child ( temp 2X3 matrix of float) +0:31 'var70' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:32 Sequence +0:32 move second child to first child ( temp 2X4 matrix of float) +0:32 'var78' ( temp 2X4 matrix of float) +0:32 Constant: +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:33 Sequence +0:33 move second child to first child ( temp 2X4 matrix of float) +0:33 'var84' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:34 Sequence +0:34 move second child to first child ( temp 3X2 matrix of float) +0:34 'var91' ( temp 3X2 matrix of float) +0:34 Constant: +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:35 Sequence +0:35 move second child to first child ( temp 3X2 matrix of float) +0:35 'var98' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:36 Sequence +0:36 move second child to first child ( temp 3X3 matrix of float) +0:36 'var104' ( temp 3X3 matrix of float) +0:36 Constant: +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:37 Sequence +0:37 move second child to first child ( temp 3X3 matrix of float) +0:37 'var112' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:38 Sequence +0:38 move second child to first child ( temp 3X4 matrix of float) +0:38 'var117' ( temp 3X4 matrix of float) +0:38 Constant: +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:39 Sequence +0:39 move second child to first child ( temp 3X4 matrix of float) +0:39 'var126' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:40 Sequence +0:40 move second child to first child ( temp 4X2 matrix of float) +0:40 'var130' ( temp 4X2 matrix of float) +0:40 Constant: +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:41 Sequence +0:41 move second child to first child ( temp 4X2 matrix of float) +0:41 'var140' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:42 Sequence +0:42 move second child to first child ( temp 4X3 matrix of float) +0:42 'var143' ( temp 4X3 matrix of float) +0:42 Constant: +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:43 Sequence +0:43 move second child to first child ( temp 4X3 matrix of float) +0:43 'var154' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:44 Sequence +0:44 move second child to first child ( temp 4X4 matrix of float) +0:44 'var156' ( temp 4X4 matrix of float) +0:44 Constant: +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:45 Sequence +0:45 move second child to first child ( temp 4X4 matrix of float) +0:45 'var168' ( temp 4X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:46 Sequence +0:46 move second child to first child ( temp float) +0:46 'var1' ( temp float) +0:? Constant: +0:? 0.000000 +0:47 Sequence +0:47 move second child to first child ( temp float) +0:47 'var2' ( temp float) +0:? Constant: +0:? 0.000000 +0:48 Sequence +0:48 move second child to first child ( temp float) +0:48 'var3' ( temp float) +0:? Constant: +0:? 0.000000 +0:49 Sequence +0:49 move second child to first child ( temp float) +0:49 'var4' ( temp float) +0:? Constant: +0:? 0.000000 +0:50 Sequence +0:50 move second child to first child ( temp float) +0:50 'var5' ( temp float) +0:? Constant: +0:? 0.000000 +0:51 Sequence +0:51 move second child to first child ( temp float) +0:51 'var6' ( temp float) +0:? Constant: +0:? 0.000000 +0:52 Sequence +0:52 move second child to first child ( temp float) +0:52 'var7' ( temp float) +0:? Constant: +0:? 0.000000 +0:53 Sequence +0:53 move second child to first child ( temp float) +0:53 'var8' ( temp float) +0:? Constant: +0:? 0.000000 +0:54 Sequence +0:54 move second child to first child ( temp float) +0:54 'var9' ( temp float) +0:? Constant: +0:? 0.000000 +0:55 Sequence +0:55 move second child to first child ( temp float) +0:55 'var10' ( temp float) +0:? Constant: +0:? 0.000000 +0:56 Sequence +0:56 move second child to first child ( temp float) +0:56 'var11' ( temp float) +0:? Constant: +0:? 0.000000 +0:57 Sequence +0:57 move second child to first child ( temp float) +0:57 'var12' ( temp float) +0:? Constant: +0:? 0.000000 +0:58 Sequence +0:58 move second child to first child ( temp 2-component vector of float) +0:58 'var15' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:59 Sequence +0:59 move second child to first child ( temp 2-component vector of float) +0:59 'var16' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:60 Sequence +0:60 move second child to first child ( temp 3-component vector of float) +0:60 'var29' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:61 Sequence +0:61 move second child to first child ( temp 2X2 matrix of float) +0:61 'var57' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:62 Sequence +0:62 move second child to first child ( temp 2X2 matrix of float) +0:62 'var58' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:63 Sequence +0:63 move second child to first child ( temp 2X2 matrix of float) +0:63 'var59' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:64 Sequence +0:64 move second child to first child ( temp 2X2 matrix of float) +0:64 'var60' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:65 Sequence +0:65 move second child to first child ( temp 2X2 matrix of float) +0:65 'var61' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:66 Sequence +0:66 move second child to first child ( temp 2X2 matrix of float) +0:66 'var62' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:67 Sequence +0:67 move second child to first child ( temp 2X2 matrix of float) +0:67 'var63' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:68 Sequence +0:68 move second child to first child ( temp 2X2 matrix of float) +0:68 'var64' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:69 Sequence +0:69 move second child to first child ( temp 2X3 matrix of float) +0:69 'var71' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:70 Sequence +0:70 move second child to first child ( temp 2X3 matrix of float) +0:70 'var73' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:71 Sequence +0:71 move second child to first child ( temp 2X3 matrix of float) +0:71 'var74' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:72 Sequence +0:72 move second child to first child ( temp 2X3 matrix of float) +0:72 'var76' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:73 Sequence +0:73 move second child to first child ( temp 2X3 matrix of float) +0:73 'var77' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:74 Sequence +0:74 move second child to first child ( temp 2X4 matrix of float) +0:74 'var87' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:75 Sequence +0:75 move second child to first child ( temp 2X4 matrix of float) +0:75 'var90' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:76 Sequence +0:76 move second child to first child ( temp 3X2 matrix of float) +0:76 'var99' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:77 Sequence +0:77 move second child to first child ( temp 3X2 matrix of float) +0:77 'var100' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:78 Sequence +0:78 move second child to first child ( temp 3X2 matrix of float) +0:78 'var101' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:79 Sequence +0:79 move second child to first child ( temp 3X2 matrix of float) +0:79 'var102' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:80 Sequence +0:80 move second child to first child ( temp 3X2 matrix of float) +0:80 'var103' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:81 Sequence +0:81 move second child to first child ( temp 3X3 matrix of float) +0:81 'var113' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:82 Sequence +0:82 move second child to first child ( temp 3X3 matrix of float) +0:82 'var115' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:83 Sequence +0:83 move second child to first child ( temp 3X3 matrix of float) +0:83 'var116' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:84 Sequence +0:84 move second child to first child ( temp 3X4 matrix of float) +0:84 'var129' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:85 Sequence +0:85 move second child to first child ( temp 4X2 matrix of float) +0:85 'var141' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:86 Sequence +0:86 move second child to first child ( temp 4X2 matrix of float) +0:86 'var142' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:87 Sequence +0:87 move second child to first child ( temp 4X3 matrix of float) +0:87 'var155' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:88 Branch: Return with expression +0:88 Constant: +0:88 0.000000 +0:88 0.000000 +0:88 0.000000 +0:88 0.000000 +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:18 Function Definition: @main( ( temp 4-component vector of float) +0:18 Function Parameters: +0:? Sequence +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'var0' ( temp float) +0:19 Constant: +0:19 0.000000 +0:20 Sequence +0:20 move second child to first child ( temp 2-component vector of float) +0:20 'var13' ( temp 2-component vector of float) +0:20 Constant: +0:20 0.000000 +0:20 0.000000 +0:21 Sequence +0:21 move second child to first child ( temp 2-component vector of float) +0:21 'var14' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:22 Sequence +0:22 move second child to first child ( temp 3-component vector of float) +0:22 'var26' ( temp 3-component vector of float) +0:22 Constant: +0:22 0.000000 +0:22 0.000000 +0:22 0.000000 +0:23 Sequence +0:23 move second child to first child ( temp 3-component vector of float) +0:23 'var28' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:24 Sequence +0:24 move second child to first child ( temp 4-component vector of float) +0:24 'var39' ( temp 4-component vector of float) +0:24 Constant: +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:24 0.000000 +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'var42' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:26 Sequence +0:26 move second child to first child ( temp 4-component vector of float) +0:26 'var43' ( temp 4-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:27 Sequence +0:27 move second child to first child ( temp 2X2 matrix of float) +0:27 'var52' ( temp 2X2 matrix of float) +0:27 Constant: +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:27 0.000000 +0:28 Sequence +0:28 move second child to first child ( temp 2X2 matrix of float) +0:28 'var55' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:29 Sequence +0:29 move second child to first child ( temp 2X2 matrix of float) +0:29 'var56' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:30 Sequence +0:30 move second child to first child ( temp 2X3 matrix of float) +0:30 'var65' ( temp 2X3 matrix of float) +0:30 Constant: +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:30 0.000000 +0:31 Sequence +0:31 move second child to first child ( temp 2X3 matrix of float) +0:31 'var70' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:32 Sequence +0:32 move second child to first child ( temp 2X4 matrix of float) +0:32 'var78' ( temp 2X4 matrix of float) +0:32 Constant: +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:32 0.000000 +0:33 Sequence +0:33 move second child to first child ( temp 2X4 matrix of float) +0:33 'var84' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:34 Sequence +0:34 move second child to first child ( temp 3X2 matrix of float) +0:34 'var91' ( temp 3X2 matrix of float) +0:34 Constant: +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:34 0.000000 +0:35 Sequence +0:35 move second child to first child ( temp 3X2 matrix of float) +0:35 'var98' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:36 Sequence +0:36 move second child to first child ( temp 3X3 matrix of float) +0:36 'var104' ( temp 3X3 matrix of float) +0:36 Constant: +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:36 0.000000 +0:37 Sequence +0:37 move second child to first child ( temp 3X3 matrix of float) +0:37 'var112' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:38 Sequence +0:38 move second child to first child ( temp 3X4 matrix of float) +0:38 'var117' ( temp 3X4 matrix of float) +0:38 Constant: +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:38 0.000000 +0:39 Sequence +0:39 move second child to first child ( temp 3X4 matrix of float) +0:39 'var126' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:40 Sequence +0:40 move second child to first child ( temp 4X2 matrix of float) +0:40 'var130' ( temp 4X2 matrix of float) +0:40 Constant: +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:40 0.000000 +0:41 Sequence +0:41 move second child to first child ( temp 4X2 matrix of float) +0:41 'var140' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:42 Sequence +0:42 move second child to first child ( temp 4X3 matrix of float) +0:42 'var143' ( temp 4X3 matrix of float) +0:42 Constant: +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:42 0.000000 +0:43 Sequence +0:43 move second child to first child ( temp 4X3 matrix of float) +0:43 'var154' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:44 Sequence +0:44 move second child to first child ( temp 4X4 matrix of float) +0:44 'var156' ( temp 4X4 matrix of float) +0:44 Constant: +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:44 0.000000 +0:45 Sequence +0:45 move second child to first child ( temp 4X4 matrix of float) +0:45 'var168' ( temp 4X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:46 Sequence +0:46 move second child to first child ( temp float) +0:46 'var1' ( temp float) +0:? Constant: +0:? 0.000000 +0:47 Sequence +0:47 move second child to first child ( temp float) +0:47 'var2' ( temp float) +0:? Constant: +0:? 0.000000 +0:48 Sequence +0:48 move second child to first child ( temp float) +0:48 'var3' ( temp float) +0:? Constant: +0:? 0.000000 +0:49 Sequence +0:49 move second child to first child ( temp float) +0:49 'var4' ( temp float) +0:? Constant: +0:? 0.000000 +0:50 Sequence +0:50 move second child to first child ( temp float) +0:50 'var5' ( temp float) +0:? Constant: +0:? 0.000000 +0:51 Sequence +0:51 move second child to first child ( temp float) +0:51 'var6' ( temp float) +0:? Constant: +0:? 0.000000 +0:52 Sequence +0:52 move second child to first child ( temp float) +0:52 'var7' ( temp float) +0:? Constant: +0:? 0.000000 +0:53 Sequence +0:53 move second child to first child ( temp float) +0:53 'var8' ( temp float) +0:? Constant: +0:? 0.000000 +0:54 Sequence +0:54 move second child to first child ( temp float) +0:54 'var9' ( temp float) +0:? Constant: +0:? 0.000000 +0:55 Sequence +0:55 move second child to first child ( temp float) +0:55 'var10' ( temp float) +0:? Constant: +0:? 0.000000 +0:56 Sequence +0:56 move second child to first child ( temp float) +0:56 'var11' ( temp float) +0:? Constant: +0:? 0.000000 +0:57 Sequence +0:57 move second child to first child ( temp float) +0:57 'var12' ( temp float) +0:? Constant: +0:? 0.000000 +0:58 Sequence +0:58 move second child to first child ( temp 2-component vector of float) +0:58 'var15' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:59 Sequence +0:59 move second child to first child ( temp 2-component vector of float) +0:59 'var16' ( temp 2-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:60 Sequence +0:60 move second child to first child ( temp 3-component vector of float) +0:60 'var29' ( temp 3-component vector of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:61 Sequence +0:61 move second child to first child ( temp 2X2 matrix of float) +0:61 'var57' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:62 Sequence +0:62 move second child to first child ( temp 2X2 matrix of float) +0:62 'var58' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:63 Sequence +0:63 move second child to first child ( temp 2X2 matrix of float) +0:63 'var59' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:64 Sequence +0:64 move second child to first child ( temp 2X2 matrix of float) +0:64 'var60' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:65 Sequence +0:65 move second child to first child ( temp 2X2 matrix of float) +0:65 'var61' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:66 Sequence +0:66 move second child to first child ( temp 2X2 matrix of float) +0:66 'var62' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:67 Sequence +0:67 move second child to first child ( temp 2X2 matrix of float) +0:67 'var63' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:68 Sequence +0:68 move second child to first child ( temp 2X2 matrix of float) +0:68 'var64' ( temp 2X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:69 Sequence +0:69 move second child to first child ( temp 2X3 matrix of float) +0:69 'var71' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:70 Sequence +0:70 move second child to first child ( temp 2X3 matrix of float) +0:70 'var73' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:71 Sequence +0:71 move second child to first child ( temp 2X3 matrix of float) +0:71 'var74' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:72 Sequence +0:72 move second child to first child ( temp 2X3 matrix of float) +0:72 'var76' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:73 Sequence +0:73 move second child to first child ( temp 2X3 matrix of float) +0:73 'var77' ( temp 2X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:74 Sequence +0:74 move second child to first child ( temp 2X4 matrix of float) +0:74 'var87' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:75 Sequence +0:75 move second child to first child ( temp 2X4 matrix of float) +0:75 'var90' ( temp 2X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:76 Sequence +0:76 move second child to first child ( temp 3X2 matrix of float) +0:76 'var99' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:77 Sequence +0:77 move second child to first child ( temp 3X2 matrix of float) +0:77 'var100' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:78 Sequence +0:78 move second child to first child ( temp 3X2 matrix of float) +0:78 'var101' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:79 Sequence +0:79 move second child to first child ( temp 3X2 matrix of float) +0:79 'var102' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:80 Sequence +0:80 move second child to first child ( temp 3X2 matrix of float) +0:80 'var103' ( temp 3X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:81 Sequence +0:81 move second child to first child ( temp 3X3 matrix of float) +0:81 'var113' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:82 Sequence +0:82 move second child to first child ( temp 3X3 matrix of float) +0:82 'var115' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:83 Sequence +0:83 move second child to first child ( temp 3X3 matrix of float) +0:83 'var116' ( temp 3X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:84 Sequence +0:84 move second child to first child ( temp 3X4 matrix of float) +0:84 'var129' ( temp 3X4 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:85 Sequence +0:85 move second child to first child ( temp 4X2 matrix of float) +0:85 'var141' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:86 Sequence +0:86 move second child to first child ( temp 4X2 matrix of float) +0:86 'var142' ( temp 4X2 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:87 Sequence +0:87 move second child to first child ( temp 4X3 matrix of float) +0:87 'var155' ( temp 4X3 matrix of float) +0:? Constant: +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:? 0.000000 +0:88 Branch: Return with expression +0:88 Constant: +0:88 0.000000 +0:88 0.000000 +0:88 0.000000 +0:88 0.000000 +0:18 Function Definition: main( ( temp void) +0:18 Function Parameters: +0:? Sequence +0:18 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:18 Function Call: @main( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 122 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 120 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "main" + Name 9 "@main(" + Name 12 "var0" + Name 16 "var13" + Name 18 "var14" + Name 21 "var26" + Name 23 "var28" + Name 25 "var39" + Name 27 "var42" + Name 28 "var43" + Name 31 "var52" + Name 33 "var55" + Name 34 "var56" + Name 37 "var65" + Name 39 "var70" + Name 42 "var78" + Name 44 "var84" + Name 47 "var91" + Name 49 "var98" + Name 52 "var104" + Name 54 "var112" + Name 57 "var117" + Name 59 "var126" + Name 62 "var130" + Name 64 "var140" + Name 67 "var143" + Name 69 "var154" + Name 72 "var156" + Name 74 "var168" + Name 75 "var1" + Name 76 "var2" + Name 77 "var3" + Name 78 "var4" + Name 79 "var5" + Name 80 "var6" + Name 81 "var7" + Name 82 "var8" + Name 83 "var9" + Name 84 "var10" + Name 85 "var11" + Name 86 "var12" + Name 87 "var15" + Name 88 "var16" + Name 89 "var29" + Name 90 "var57" + Name 91 "var58" + Name 92 "var59" + Name 93 "var60" + Name 94 "var61" + Name 95 "var62" + Name 96 "var63" + Name 97 "var64" + Name 98 "var71" + Name 99 "var73" + Name 100 "var74" + Name 101 "var76" + Name 102 "var77" + Name 103 "var87" + Name 104 "var90" + Name 105 "var99" + Name 106 "var100" + Name 107 "var101" + Name 108 "var102" + Name 109 "var103" + Name 110 "var113" + Name 111 "var115" + Name 112 "var116" + Name 113 "var129" + Name 114 "var141" + Name 115 "var142" + Name 116 "var155" + Name 120 "@entryPointOutput" + Decorate 120(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypePointer Function 6(float) + 13: 6(float) Constant 0 + 14: TypeVector 6(float) 2 + 15: TypePointer Function 14(fvec2) + 17: 14(fvec2) ConstantComposite 13 13 + 19: TypeVector 6(float) 3 + 20: TypePointer Function 19(fvec3) + 22: 19(fvec3) ConstantComposite 13 13 13 + 24: TypePointer Function 7(fvec4) + 26: 7(fvec4) ConstantComposite 13 13 13 13 + 29: TypeMatrix 14(fvec2) 2 + 30: TypePointer Function 29 + 32: 29 ConstantComposite 17 17 + 35: TypeMatrix 19(fvec3) 2 + 36: TypePointer Function 35 + 38: 35 ConstantComposite 22 22 + 40: TypeMatrix 7(fvec4) 2 + 41: TypePointer Function 40 + 43: 40 ConstantComposite 26 26 + 45: TypeMatrix 14(fvec2) 3 + 46: TypePointer Function 45 + 48: 45 ConstantComposite 17 17 17 + 50: TypeMatrix 19(fvec3) 3 + 51: TypePointer Function 50 + 53: 50 ConstantComposite 22 22 22 + 55: TypeMatrix 7(fvec4) 3 + 56: TypePointer Function 55 + 58: 55 ConstantComposite 26 26 26 + 60: TypeMatrix 14(fvec2) 4 + 61: TypePointer Function 60 + 63: 60 ConstantComposite 17 17 17 17 + 65: TypeMatrix 19(fvec3) 4 + 66: TypePointer Function 65 + 68: 65 ConstantComposite 22 22 22 22 + 70: TypeMatrix 7(fvec4) 4 + 71: TypePointer Function 70 + 73: 70 ConstantComposite 26 26 26 26 + 119: TypePointer Output 7(fvec4) +120(@entryPointOutput): 119(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 121: 7(fvec4) FunctionCall 9(@main() + Store 120(@entryPointOutput) 121 + Return + FunctionEnd + 9(@main(): 7(fvec4) Function None 8 + 10: Label + 12(var0): 11(ptr) Variable Function + 16(var13): 15(ptr) Variable Function + 18(var14): 15(ptr) Variable Function + 21(var26): 20(ptr) Variable Function + 23(var28): 20(ptr) Variable Function + 25(var39): 24(ptr) Variable Function + 27(var42): 24(ptr) Variable Function + 28(var43): 24(ptr) Variable Function + 31(var52): 30(ptr) Variable Function + 33(var55): 30(ptr) Variable Function + 34(var56): 30(ptr) Variable Function + 37(var65): 36(ptr) Variable Function + 39(var70): 36(ptr) Variable Function + 42(var78): 41(ptr) Variable Function + 44(var84): 41(ptr) Variable Function + 47(var91): 46(ptr) Variable Function + 49(var98): 46(ptr) Variable Function + 52(var104): 51(ptr) Variable Function + 54(var112): 51(ptr) Variable Function + 57(var117): 56(ptr) Variable Function + 59(var126): 56(ptr) Variable Function + 62(var130): 61(ptr) Variable Function + 64(var140): 61(ptr) Variable Function + 67(var143): 66(ptr) Variable Function + 69(var154): 66(ptr) Variable Function + 72(var156): 71(ptr) Variable Function + 74(var168): 71(ptr) Variable Function + 75(var1): 11(ptr) Variable Function + 76(var2): 11(ptr) Variable Function + 77(var3): 11(ptr) Variable Function + 78(var4): 11(ptr) Variable Function + 79(var5): 11(ptr) Variable Function + 80(var6): 11(ptr) Variable Function + 81(var7): 11(ptr) Variable Function + 82(var8): 11(ptr) Variable Function + 83(var9): 11(ptr) Variable Function + 84(var10): 11(ptr) Variable Function + 85(var11): 11(ptr) Variable Function + 86(var12): 11(ptr) Variable Function + 87(var15): 15(ptr) Variable Function + 88(var16): 15(ptr) Variable Function + 89(var29): 20(ptr) Variable Function + 90(var57): 30(ptr) Variable Function + 91(var58): 30(ptr) Variable Function + 92(var59): 30(ptr) Variable Function + 93(var60): 30(ptr) Variable Function + 94(var61): 30(ptr) Variable Function + 95(var62): 30(ptr) Variable Function + 96(var63): 30(ptr) Variable Function + 97(var64): 30(ptr) Variable Function + 98(var71): 36(ptr) Variable Function + 99(var73): 36(ptr) Variable Function + 100(var74): 36(ptr) Variable Function + 101(var76): 36(ptr) Variable Function + 102(var77): 36(ptr) Variable Function + 103(var87): 41(ptr) Variable Function + 104(var90): 41(ptr) Variable Function + 105(var99): 46(ptr) Variable Function + 106(var100): 46(ptr) Variable Function + 107(var101): 46(ptr) Variable Function + 108(var102): 46(ptr) Variable Function + 109(var103): 46(ptr) Variable Function + 110(var113): 51(ptr) Variable Function + 111(var115): 51(ptr) Variable Function + 112(var116): 51(ptr) Variable Function + 113(var129): 56(ptr) Variable Function + 114(var141): 61(ptr) Variable Function + 115(var142): 61(ptr) Variable Function + 116(var155): 66(ptr) Variable Function + Store 12(var0) 13 + Store 16(var13) 17 + Store 18(var14) 17 + Store 21(var26) 22 + Store 23(var28) 22 + Store 25(var39) 26 + Store 27(var42) 26 + Store 28(var43) 26 + Store 31(var52) 32 + Store 33(var55) 32 + Store 34(var56) 32 + Store 37(var65) 38 + Store 39(var70) 38 + Store 42(var78) 43 + Store 44(var84) 43 + Store 47(var91) 48 + Store 49(var98) 48 + Store 52(var104) 53 + Store 54(var112) 53 + Store 57(var117) 58 + Store 59(var126) 58 + Store 62(var130) 63 + Store 64(var140) 63 + Store 67(var143) 68 + Store 69(var154) 68 + Store 72(var156) 73 + Store 74(var168) 73 + Store 75(var1) 13 + Store 76(var2) 13 + Store 77(var3) 13 + Store 78(var4) 13 + Store 79(var5) 13 + Store 80(var6) 13 + Store 81(var7) 13 + Store 82(var8) 13 + Store 83(var9) 13 + Store 84(var10) 13 + Store 85(var11) 13 + Store 86(var12) 13 + Store 87(var15) 17 + Store 88(var16) 17 + Store 89(var29) 22 + Store 90(var57) 32 + Store 91(var58) 32 + Store 92(var59) 32 + Store 93(var60) 32 + Store 94(var61) 32 + Store 95(var62) 32 + Store 96(var63) 32 + Store 97(var64) 32 + Store 98(var71) 38 + Store 99(var73) 38 + Store 100(var74) 38 + Store 101(var76) 38 + Store 102(var77) 38 + Store 103(var87) 43 + Store 104(var90) 43 + Store 105(var99) 48 + Store 106(var100) 48 + Store 107(var101) 48 + Store 108(var102) 48 + Store 109(var103) 48 + Store 110(var113) 53 + Store 111(var115) 53 + Store 112(var116) 53 + Store 113(var129) 58 + Store 114(var141) 63 + Store 115(var142) 63 + Store 116(var155) 68 + ReturnValue 26 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typeGraphCopy.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typeGraphCopy.vert.out index 4ae33e20cfa..c0c7227b4f1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typeGraphCopy.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typeGraphCopy.vert.out @@ -62,7 +62,7 @@ Shader version: 500 0:? '@entryPointOutput' (layout( location=0) out float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 28 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typedef.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typedef.frag.out index 3f3e34cc009..11fd10741a8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typedef.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.typedef.frag.out @@ -79,7 +79,7 @@ gl_FragCoord origin is upper left 0:? Linker Objects // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 34 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.void.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.void.frag.out index e685c2c51e9..30edd633c8f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.void.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.void.frag.out @@ -54,7 +54,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavebroadcast.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavebroadcast.comp.out new file mode 100644 index 00000000000..0dfd9ef6be6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavebroadcast.comp.out @@ -0,0 +1,2731 @@ +hlsl.wavebroadcast.comp +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupShuffle ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 13 (const uint) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupShuffle ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 13 (const uint) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupShuffle ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 Constant: +0:16 13 (const uint) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupShuffle ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 Constant: +0:17 13 (const uint) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupShuffle ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 Constant: +0:19 13 (const uint) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupShuffle ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 13 (const uint) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupShuffle ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 13 (const uint) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupShuffle ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 Constant: +0:22 13 (const uint) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupShuffle ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 Constant: +0:24 13 (const uint) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupShuffle ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 13 (const uint) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupShuffle ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 Constant: +0:26 13 (const uint) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupShuffle ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Constant: +0:27 13 (const uint) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupBroadcastFirst ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupBroadcastFirst ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupBroadcastFirst ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupBroadcastFirst ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupBroadcastFirst ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupBroadcastFirst ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupBroadcastFirst ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupBroadcastFirst ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupBroadcastFirst ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupBroadcastFirst ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupBroadcastFirst ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupBroadcastFirst ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupBroadcastFirst ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupBroadcastFirst ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupBroadcastFirst ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupBroadcastFirst ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupBroadcastFirst ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupBroadcastFirst ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupBroadcastFirst ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupBroadcastFirst ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupShuffle ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 13 (const uint) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupShuffle ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 13 (const uint) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupShuffle ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 Constant: +0:16 13 (const uint) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupShuffle ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 Constant: +0:17 13 (const uint) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupShuffle ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 Constant: +0:19 13 (const uint) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupShuffle ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 13 (const uint) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupShuffle ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 13 (const uint) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupShuffle ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 Constant: +0:22 13 (const uint) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupShuffle ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 Constant: +0:24 13 (const uint) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupShuffle ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 13 (const uint) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupShuffle ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 Constant: +0:26 13 (const uint) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupShuffle ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Constant: +0:27 13 (const uint) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupBroadcastFirst ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupBroadcastFirst ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupBroadcastFirst ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupBroadcastFirst ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupBroadcastFirst ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupBroadcastFirst ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupBroadcastFirst ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupBroadcastFirst ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupBroadcastFirst ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupBroadcastFirst ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupBroadcastFirst ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupBroadcastFirst ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupBroadcastFirst ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupBroadcastFirst ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupBroadcastFirst ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupBroadcastFirst ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupBroadcastFirst ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupBroadcastFirst ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupBroadcastFirst ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupBroadcastFirst ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 359 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformBallot + Capability GroupNonUniformShuffle + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "CSMain" 354 + ExecutionMode 4 LocalSize 32 16 1 + Source HLSL 500 + Name 4 "CSMain" + Name 11 "@CSMain(vu3;" + Name 10 "dti" + Name 20 "Types" + MemberName 20(Types) 0 "u" + MemberName 20(Types) 1 "i" + MemberName 20(Types) 2 "f" + MemberName 20(Types) 3 "d" + Name 22 "data" + MemberName 22(data) 0 "@data" + Name 24 "data" + Name 352 "dti" + Name 354 "dti" + Name 356 "param" + MemberDecorate 20(Types) 0 Offset 0 + MemberDecorate 20(Types) 1 Offset 16 + MemberDecorate 20(Types) 2 Offset 32 + MemberDecorate 20(Types) 3 Offset 64 + Decorate 21 ArrayStride 96 + MemberDecorate 22(data) 0 Offset 0 + Decorate 22(data) BufferBlock + Decorate 24(data) DescriptorSet 0 + Decorate 354(dti) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: TypeVector 6(int) 4 + 14: TypeInt 32 1 + 15: TypeVector 14(int) 4 + 16: TypeFloat 32 + 17: TypeVector 16(float) 4 + 18: TypeFloat 64 + 19: TypeVector 18(float64_t) 4 + 20(Types): TypeStruct 13(ivec4) 15(ivec4) 17(fvec4) 19(f64vec4) + 21: TypeRuntimeArray 20(Types) + 22(data): TypeStruct 21 + 23: TypePointer Uniform 22(data) + 24(data): 23(ptr) Variable Uniform + 25: 14(int) Constant 0 + 26: 6(int) Constant 0 + 27: TypePointer Function 6(int) + 32: TypePointer Uniform 13(ivec4) + 35: 6(int) Constant 13 + 36: 6(int) Constant 3 + 43: TypePointer Uniform 6(int) + 52: TypeVector 6(int) 2 + 73: 14(int) Constant 1 + 76: TypePointer Uniform 15(ivec4) + 85: TypePointer Uniform 14(int) + 94: TypeVector 14(int) 2 + 106: TypeVector 14(int) 3 + 116: 14(int) Constant 2 + 119: TypePointer Uniform 17(fvec4) + 128: TypePointer Uniform 16(float) + 137: TypeVector 16(float) 2 + 149: TypeVector 16(float) 3 + 159: 14(int) Constant 3 + 162: TypePointer Uniform 19(f64vec4) + 171: TypePointer Uniform 18(float64_t) + 180: TypeVector 18(float64_t) 2 + 192: TypeVector 18(float64_t) 3 + 353: TypePointer Input 7(ivec3) + 354(dti): 353(ptr) Variable Input + 4(CSMain): 2 Function None 3 + 5: Label + 352(dti): 8(ptr) Variable Function + 356(param): 8(ptr) Variable Function + 355: 7(ivec3) Load 354(dti) + Store 352(dti) 355 + 357: 7(ivec3) Load 352(dti) + Store 356(param) 357 + 358: 2 FunctionCall 11(@CSMain(vu3;) 356(param) + Return + FunctionEnd +11(@CSMain(vu3;): 2 Function None 9 + 10(dti): 8(ptr) FunctionParameter + 12: Label + 28: 27(ptr) AccessChain 10(dti) 26 + 29: 6(int) Load 28 + 30: 27(ptr) AccessChain 10(dti) 26 + 31: 6(int) Load 30 + 33: 32(ptr) AccessChain 24(data) 25 31 25 + 34: 13(ivec4) Load 33 + 37: 13(ivec4) GroupNonUniformShuffle 36 34 35 + 38: 32(ptr) AccessChain 24(data) 25 29 25 + Store 38 37 + 39: 27(ptr) AccessChain 10(dti) 26 + 40: 6(int) Load 39 + 41: 27(ptr) AccessChain 10(dti) 26 + 42: 6(int) Load 41 + 44: 43(ptr) AccessChain 24(data) 25 42 25 26 + 45: 6(int) Load 44 + 46: 6(int) GroupNonUniformShuffle 36 45 35 + 47: 43(ptr) AccessChain 24(data) 25 40 25 26 + Store 47 46 + 48: 27(ptr) AccessChain 10(dti) 26 + 49: 6(int) Load 48 + 50: 27(ptr) AccessChain 10(dti) 26 + 51: 6(int) Load 50 + 53: 32(ptr) AccessChain 24(data) 25 51 25 + 54: 13(ivec4) Load 53 + 55: 52(ivec2) VectorShuffle 54 54 0 1 + 56: 52(ivec2) GroupNonUniformShuffle 36 55 35 + 57: 32(ptr) AccessChain 24(data) 25 49 25 + 58: 13(ivec4) Load 57 + 59: 13(ivec4) VectorShuffle 58 56 4 5 2 3 + Store 57 59 + 60: 27(ptr) AccessChain 10(dti) 26 + 61: 6(int) Load 60 + 62: 27(ptr) AccessChain 10(dti) 26 + 63: 6(int) Load 62 + 64: 32(ptr) AccessChain 24(data) 25 63 25 + 65: 13(ivec4) Load 64 + 66: 7(ivec3) VectorShuffle 65 65 0 1 2 + 67: 7(ivec3) GroupNonUniformShuffle 36 66 35 + 68: 32(ptr) AccessChain 24(data) 25 61 25 + 69: 13(ivec4) Load 68 + 70: 13(ivec4) VectorShuffle 69 67 4 5 6 3 + Store 68 70 + 71: 27(ptr) AccessChain 10(dti) 26 + 72: 6(int) Load 71 + 74: 27(ptr) AccessChain 10(dti) 26 + 75: 6(int) Load 74 + 77: 76(ptr) AccessChain 24(data) 25 75 73 + 78: 15(ivec4) Load 77 + 79: 15(ivec4) GroupNonUniformShuffle 36 78 35 + 80: 76(ptr) AccessChain 24(data) 25 72 73 + Store 80 79 + 81: 27(ptr) AccessChain 10(dti) 26 + 82: 6(int) Load 81 + 83: 27(ptr) AccessChain 10(dti) 26 + 84: 6(int) Load 83 + 86: 85(ptr) AccessChain 24(data) 25 84 73 26 + 87: 14(int) Load 86 + 88: 14(int) GroupNonUniformShuffle 36 87 35 + 89: 85(ptr) AccessChain 24(data) 25 82 73 26 + Store 89 88 + 90: 27(ptr) AccessChain 10(dti) 26 + 91: 6(int) Load 90 + 92: 27(ptr) AccessChain 10(dti) 26 + 93: 6(int) Load 92 + 95: 76(ptr) AccessChain 24(data) 25 93 73 + 96: 15(ivec4) Load 95 + 97: 94(ivec2) VectorShuffle 96 96 0 1 + 98: 94(ivec2) GroupNonUniformShuffle 36 97 35 + 99: 76(ptr) AccessChain 24(data) 25 91 73 + 100: 15(ivec4) Load 99 + 101: 15(ivec4) VectorShuffle 100 98 4 5 2 3 + Store 99 101 + 102: 27(ptr) AccessChain 10(dti) 26 + 103: 6(int) Load 102 + 104: 27(ptr) AccessChain 10(dti) 26 + 105: 6(int) Load 104 + 107: 76(ptr) AccessChain 24(data) 25 105 73 + 108: 15(ivec4) Load 107 + 109: 106(ivec3) VectorShuffle 108 108 0 1 2 + 110: 106(ivec3) GroupNonUniformShuffle 36 109 35 + 111: 76(ptr) AccessChain 24(data) 25 103 73 + 112: 15(ivec4) Load 111 + 113: 15(ivec4) VectorShuffle 112 110 4 5 6 3 + Store 111 113 + 114: 27(ptr) AccessChain 10(dti) 26 + 115: 6(int) Load 114 + 117: 27(ptr) AccessChain 10(dti) 26 + 118: 6(int) Load 117 + 120: 119(ptr) AccessChain 24(data) 25 118 116 + 121: 17(fvec4) Load 120 + 122: 17(fvec4) GroupNonUniformShuffle 36 121 35 + 123: 119(ptr) AccessChain 24(data) 25 115 116 + Store 123 122 + 124: 27(ptr) AccessChain 10(dti) 26 + 125: 6(int) Load 124 + 126: 27(ptr) AccessChain 10(dti) 26 + 127: 6(int) Load 126 + 129: 128(ptr) AccessChain 24(data) 25 127 116 26 + 130: 16(float) Load 129 + 131: 16(float) GroupNonUniformShuffle 36 130 35 + 132: 128(ptr) AccessChain 24(data) 25 125 116 26 + Store 132 131 + 133: 27(ptr) AccessChain 10(dti) 26 + 134: 6(int) Load 133 + 135: 27(ptr) AccessChain 10(dti) 26 + 136: 6(int) Load 135 + 138: 119(ptr) AccessChain 24(data) 25 136 116 + 139: 17(fvec4) Load 138 + 140: 137(fvec2) VectorShuffle 139 139 0 1 + 141: 137(fvec2) GroupNonUniformShuffle 36 140 35 + 142: 119(ptr) AccessChain 24(data) 25 134 116 + 143: 17(fvec4) Load 142 + 144: 17(fvec4) VectorShuffle 143 141 4 5 2 3 + Store 142 144 + 145: 27(ptr) AccessChain 10(dti) 26 + 146: 6(int) Load 145 + 147: 27(ptr) AccessChain 10(dti) 26 + 148: 6(int) Load 147 + 150: 119(ptr) AccessChain 24(data) 25 148 116 + 151: 17(fvec4) Load 150 + 152: 149(fvec3) VectorShuffle 151 151 0 1 2 + 153: 149(fvec3) GroupNonUniformShuffle 36 152 35 + 154: 119(ptr) AccessChain 24(data) 25 146 116 + 155: 17(fvec4) Load 154 + 156: 17(fvec4) VectorShuffle 155 153 4 5 6 3 + Store 154 156 + 157: 27(ptr) AccessChain 10(dti) 26 + 158: 6(int) Load 157 + 160: 27(ptr) AccessChain 10(dti) 26 + 161: 6(int) Load 160 + 163: 162(ptr) AccessChain 24(data) 25 161 159 + 164: 19(f64vec4) Load 163 + 165: 19(f64vec4) GroupNonUniformBroadcastFirst 36 164 + 166: 162(ptr) AccessChain 24(data) 25 158 159 + Store 166 165 + 167: 27(ptr) AccessChain 10(dti) 26 + 168: 6(int) Load 167 + 169: 27(ptr) AccessChain 10(dti) 26 + 170: 6(int) Load 169 + 172: 171(ptr) AccessChain 24(data) 25 170 159 26 + 173:18(float64_t) Load 172 + 174:18(float64_t) GroupNonUniformBroadcastFirst 36 173 + 175: 171(ptr) AccessChain 24(data) 25 168 159 26 + Store 175 174 + 176: 27(ptr) AccessChain 10(dti) 26 + 177: 6(int) Load 176 + 178: 27(ptr) AccessChain 10(dti) 26 + 179: 6(int) Load 178 + 181: 162(ptr) AccessChain 24(data) 25 179 159 + 182: 19(f64vec4) Load 181 + 183:180(f64vec2) VectorShuffle 182 182 0 1 + 184:180(f64vec2) GroupNonUniformBroadcastFirst 36 183 + 185: 162(ptr) AccessChain 24(data) 25 177 159 + 186: 19(f64vec4) Load 185 + 187: 19(f64vec4) VectorShuffle 186 184 4 5 2 3 + Store 185 187 + 188: 27(ptr) AccessChain 10(dti) 26 + 189: 6(int) Load 188 + 190: 27(ptr) AccessChain 10(dti) 26 + 191: 6(int) Load 190 + 193: 162(ptr) AccessChain 24(data) 25 191 159 + 194: 19(f64vec4) Load 193 + 195:192(f64vec3) VectorShuffle 194 194 0 1 2 + 196:192(f64vec3) GroupNonUniformBroadcastFirst 36 195 + 197: 162(ptr) AccessChain 24(data) 25 189 159 + 198: 19(f64vec4) Load 197 + 199: 19(f64vec4) VectorShuffle 198 196 4 5 6 3 + Store 197 199 + 200: 27(ptr) AccessChain 10(dti) 26 + 201: 6(int) Load 200 + 202: 27(ptr) AccessChain 10(dti) 26 + 203: 6(int) Load 202 + 204: 32(ptr) AccessChain 24(data) 25 203 25 + 205: 13(ivec4) Load 204 + 206: 13(ivec4) GroupNonUniformBroadcastFirst 36 205 + 207: 32(ptr) AccessChain 24(data) 25 201 25 + Store 207 206 + 208: 27(ptr) AccessChain 10(dti) 26 + 209: 6(int) Load 208 + 210: 27(ptr) AccessChain 10(dti) 26 + 211: 6(int) Load 210 + 212: 43(ptr) AccessChain 24(data) 25 211 25 26 + 213: 6(int) Load 212 + 214: 6(int) GroupNonUniformBroadcastFirst 36 213 + 215: 43(ptr) AccessChain 24(data) 25 209 25 26 + Store 215 214 + 216: 27(ptr) AccessChain 10(dti) 26 + 217: 6(int) Load 216 + 218: 27(ptr) AccessChain 10(dti) 26 + 219: 6(int) Load 218 + 220: 32(ptr) AccessChain 24(data) 25 219 25 + 221: 13(ivec4) Load 220 + 222: 52(ivec2) VectorShuffle 221 221 0 1 + 223: 52(ivec2) GroupNonUniformBroadcastFirst 36 222 + 224: 32(ptr) AccessChain 24(data) 25 217 25 + 225: 13(ivec4) Load 224 + 226: 13(ivec4) VectorShuffle 225 223 4 5 2 3 + Store 224 226 + 227: 27(ptr) AccessChain 10(dti) 26 + 228: 6(int) Load 227 + 229: 27(ptr) AccessChain 10(dti) 26 + 230: 6(int) Load 229 + 231: 32(ptr) AccessChain 24(data) 25 230 25 + 232: 13(ivec4) Load 231 + 233: 7(ivec3) VectorShuffle 232 232 0 1 2 + 234: 7(ivec3) GroupNonUniformBroadcastFirst 36 233 + 235: 32(ptr) AccessChain 24(data) 25 228 25 + 236: 13(ivec4) Load 235 + 237: 13(ivec4) VectorShuffle 236 234 4 5 6 3 + Store 235 237 + 238: 27(ptr) AccessChain 10(dti) 26 + 239: 6(int) Load 238 + 240: 27(ptr) AccessChain 10(dti) 26 + 241: 6(int) Load 240 + 242: 76(ptr) AccessChain 24(data) 25 241 73 + 243: 15(ivec4) Load 242 + 244: 15(ivec4) GroupNonUniformBroadcastFirst 36 243 + 245: 76(ptr) AccessChain 24(data) 25 239 73 + Store 245 244 + 246: 27(ptr) AccessChain 10(dti) 26 + 247: 6(int) Load 246 + 248: 27(ptr) AccessChain 10(dti) 26 + 249: 6(int) Load 248 + 250: 85(ptr) AccessChain 24(data) 25 249 73 26 + 251: 14(int) Load 250 + 252: 14(int) GroupNonUniformBroadcastFirst 36 251 + 253: 85(ptr) AccessChain 24(data) 25 247 73 26 + Store 253 252 + 254: 27(ptr) AccessChain 10(dti) 26 + 255: 6(int) Load 254 + 256: 27(ptr) AccessChain 10(dti) 26 + 257: 6(int) Load 256 + 258: 76(ptr) AccessChain 24(data) 25 257 73 + 259: 15(ivec4) Load 258 + 260: 94(ivec2) VectorShuffle 259 259 0 1 + 261: 94(ivec2) GroupNonUniformBroadcastFirst 36 260 + 262: 76(ptr) AccessChain 24(data) 25 255 73 + 263: 15(ivec4) Load 262 + 264: 15(ivec4) VectorShuffle 263 261 4 5 2 3 + Store 262 264 + 265: 27(ptr) AccessChain 10(dti) 26 + 266: 6(int) Load 265 + 267: 27(ptr) AccessChain 10(dti) 26 + 268: 6(int) Load 267 + 269: 76(ptr) AccessChain 24(data) 25 268 73 + 270: 15(ivec4) Load 269 + 271: 106(ivec3) VectorShuffle 270 270 0 1 2 + 272: 106(ivec3) GroupNonUniformBroadcastFirst 36 271 + 273: 76(ptr) AccessChain 24(data) 25 266 73 + 274: 15(ivec4) Load 273 + 275: 15(ivec4) VectorShuffle 274 272 4 5 6 3 + Store 273 275 + 276: 27(ptr) AccessChain 10(dti) 26 + 277: 6(int) Load 276 + 278: 27(ptr) AccessChain 10(dti) 26 + 279: 6(int) Load 278 + 280: 119(ptr) AccessChain 24(data) 25 279 116 + 281: 17(fvec4) Load 280 + 282: 17(fvec4) GroupNonUniformBroadcastFirst 36 281 + 283: 119(ptr) AccessChain 24(data) 25 277 116 + Store 283 282 + 284: 27(ptr) AccessChain 10(dti) 26 + 285: 6(int) Load 284 + 286: 27(ptr) AccessChain 10(dti) 26 + 287: 6(int) Load 286 + 288: 128(ptr) AccessChain 24(data) 25 287 116 26 + 289: 16(float) Load 288 + 290: 16(float) GroupNonUniformBroadcastFirst 36 289 + 291: 128(ptr) AccessChain 24(data) 25 285 116 26 + Store 291 290 + 292: 27(ptr) AccessChain 10(dti) 26 + 293: 6(int) Load 292 + 294: 27(ptr) AccessChain 10(dti) 26 + 295: 6(int) Load 294 + 296: 119(ptr) AccessChain 24(data) 25 295 116 + 297: 17(fvec4) Load 296 + 298: 137(fvec2) VectorShuffle 297 297 0 1 + 299: 137(fvec2) GroupNonUniformBroadcastFirst 36 298 + 300: 119(ptr) AccessChain 24(data) 25 293 116 + 301: 17(fvec4) Load 300 + 302: 17(fvec4) VectorShuffle 301 299 4 5 2 3 + Store 300 302 + 303: 27(ptr) AccessChain 10(dti) 26 + 304: 6(int) Load 303 + 305: 27(ptr) AccessChain 10(dti) 26 + 306: 6(int) Load 305 + 307: 119(ptr) AccessChain 24(data) 25 306 116 + 308: 17(fvec4) Load 307 + 309: 149(fvec3) VectorShuffle 308 308 0 1 2 + 310: 149(fvec3) GroupNonUniformBroadcastFirst 36 309 + 311: 119(ptr) AccessChain 24(data) 25 304 116 + 312: 17(fvec4) Load 311 + 313: 17(fvec4) VectorShuffle 312 310 4 5 6 3 + Store 311 313 + 314: 27(ptr) AccessChain 10(dti) 26 + 315: 6(int) Load 314 + 316: 27(ptr) AccessChain 10(dti) 26 + 317: 6(int) Load 316 + 318: 162(ptr) AccessChain 24(data) 25 317 159 + 319: 19(f64vec4) Load 318 + 320: 19(f64vec4) GroupNonUniformBroadcastFirst 36 319 + 321: 162(ptr) AccessChain 24(data) 25 315 159 + Store 321 320 + 322: 27(ptr) AccessChain 10(dti) 26 + 323: 6(int) Load 322 + 324: 27(ptr) AccessChain 10(dti) 26 + 325: 6(int) Load 324 + 326: 171(ptr) AccessChain 24(data) 25 325 159 26 + 327:18(float64_t) Load 326 + 328:18(float64_t) GroupNonUniformBroadcastFirst 36 327 + 329: 171(ptr) AccessChain 24(data) 25 323 159 26 + Store 329 328 + 330: 27(ptr) AccessChain 10(dti) 26 + 331: 6(int) Load 330 + 332: 27(ptr) AccessChain 10(dti) 26 + 333: 6(int) Load 332 + 334: 162(ptr) AccessChain 24(data) 25 333 159 + 335: 19(f64vec4) Load 334 + 336:180(f64vec2) VectorShuffle 335 335 0 1 + 337:180(f64vec2) GroupNonUniformBroadcastFirst 36 336 + 338: 162(ptr) AccessChain 24(data) 25 331 159 + 339: 19(f64vec4) Load 338 + 340: 19(f64vec4) VectorShuffle 339 337 4 5 2 3 + Store 338 340 + 341: 27(ptr) AccessChain 10(dti) 26 + 342: 6(int) Load 341 + 343: 27(ptr) AccessChain 10(dti) 26 + 344: 6(int) Load 343 + 345: 162(ptr) AccessChain 24(data) 25 344 159 + 346: 19(f64vec4) Load 345 + 347:192(f64vec3) VectorShuffle 346 346 0 1 2 + 348:192(f64vec3) GroupNonUniformBroadcastFirst 36 347 + 349: 162(ptr) AccessChain 24(data) 25 342 159 + 350: 19(f64vec4) Load 349 + 351: 19(f64vec4) VectorShuffle 350 348 4 5 6 3 + Store 349 351 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.waveprefix.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.waveprefix.comp.out new file mode 100644 index 00000000000..9736b4e0e8d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.waveprefix.comp.out @@ -0,0 +1,2766 @@ +hlsl.waveprefix.comp +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupInclusiveAdd ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupInclusiveAdd ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupInclusiveAdd ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupInclusiveAdd ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupInclusiveAdd ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupInclusiveAdd ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupInclusiveAdd ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupInclusiveAdd ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupInclusiveAdd ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupInclusiveAdd ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupInclusiveAdd ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupInclusiveAdd ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupInclusiveAdd ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupInclusiveAdd ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupInclusiveAdd ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupInclusiveAdd ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupInclusiveMul ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupInclusiveMul ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupInclusiveMul ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupInclusiveMul ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupInclusiveMul ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupInclusiveMul ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupInclusiveMul ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupInclusiveMul ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupInclusiveMul ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupInclusiveMul ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupInclusiveMul ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupInclusiveMul ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupInclusiveMul ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupInclusiveMul ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupInclusiveMul ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupInclusiveMul ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:54 move second child to first child ( temp uint) +0:54 direct index ( temp uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 subgroupBallotInclusiveBitCount ( temp uint) +0:54 subgroupBallot ( temp 4-component vector of uint) +0:54 Compare Equal ( temp bool) +0:54 direct index ( temp uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const uint) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupInclusiveAdd ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupInclusiveAdd ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupInclusiveAdd ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupInclusiveAdd ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupInclusiveAdd ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupInclusiveAdd ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupInclusiveAdd ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupInclusiveAdd ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupInclusiveAdd ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupInclusiveAdd ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupInclusiveAdd ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupInclusiveAdd ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupInclusiveAdd ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupInclusiveAdd ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupInclusiveAdd ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupInclusiveAdd ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupInclusiveMul ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupInclusiveMul ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupInclusiveMul ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupInclusiveMul ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupInclusiveMul ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupInclusiveMul ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupInclusiveMul ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupInclusiveMul ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupInclusiveMul ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupInclusiveMul ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupInclusiveMul ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupInclusiveMul ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupInclusiveMul ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupInclusiveMul ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupInclusiveMul ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupInclusiveMul ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:54 move second child to first child ( temp uint) +0:54 direct index ( temp uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 subgroupBallotInclusiveBitCount ( temp uint) +0:54 subgroupBallot ( temp 4-component vector of uint) +0:54 Compare Equal ( temp bool) +0:54 direct index ( temp uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const uint) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 369 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformArithmetic + Capability GroupNonUniformBallot + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "CSMain" 364 + ExecutionMode 4 LocalSize 32 16 1 + Source HLSL 500 + Name 4 "CSMain" + Name 11 "@CSMain(vu3;" + Name 10 "dti" + Name 20 "Types" + MemberName 20(Types) 0 "u" + MemberName 20(Types) 1 "i" + MemberName 20(Types) 2 "f" + MemberName 20(Types) 3 "d" + Name 22 "data" + MemberName 22(data) 0 "@data" + Name 24 "data" + Name 362 "dti" + Name 364 "dti" + Name 366 "param" + MemberDecorate 20(Types) 0 Offset 0 + MemberDecorate 20(Types) 1 Offset 16 + MemberDecorate 20(Types) 2 Offset 32 + MemberDecorate 20(Types) 3 Offset 64 + Decorate 21 ArrayStride 96 + MemberDecorate 22(data) 0 Offset 0 + Decorate 22(data) BufferBlock + Decorate 24(data) DescriptorSet 0 + Decorate 364(dti) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: TypeVector 6(int) 4 + 14: TypeInt 32 1 + 15: TypeVector 14(int) 4 + 16: TypeFloat 32 + 17: TypeVector 16(float) 4 + 18: TypeFloat 64 + 19: TypeVector 18(float64_t) 4 + 20(Types): TypeStruct 13(ivec4) 15(ivec4) 17(fvec4) 19(f64vec4) + 21: TypeRuntimeArray 20(Types) + 22(data): TypeStruct 21 + 23: TypePointer Uniform 22(data) + 24(data): 23(ptr) Variable Uniform + 25: 14(int) Constant 0 + 26: 6(int) Constant 0 + 27: TypePointer Function 6(int) + 32: TypePointer Uniform 13(ivec4) + 35: 6(int) Constant 3 + 42: TypePointer Uniform 6(int) + 51: TypeVector 6(int) 2 + 72: 14(int) Constant 1 + 75: TypePointer Uniform 15(ivec4) + 84: TypePointer Uniform 14(int) + 93: TypeVector 14(int) 2 + 105: TypeVector 14(int) 3 + 115: 14(int) Constant 2 + 118: TypePointer Uniform 17(fvec4) + 127: TypePointer Uniform 16(float) + 136: TypeVector 16(float) 2 + 148: TypeVector 16(float) 3 + 158: 14(int) Constant 3 + 161: TypePointer Uniform 19(f64vec4) + 170: TypePointer Uniform 18(float64_t) + 179: TypeVector 18(float64_t) 2 + 191: TypeVector 18(float64_t) 3 + 357: TypeBool + 363: TypePointer Input 7(ivec3) + 364(dti): 363(ptr) Variable Input + 4(CSMain): 2 Function None 3 + 5: Label + 362(dti): 8(ptr) Variable Function + 366(param): 8(ptr) Variable Function + 365: 7(ivec3) Load 364(dti) + Store 362(dti) 365 + 367: 7(ivec3) Load 362(dti) + Store 366(param) 367 + 368: 2 FunctionCall 11(@CSMain(vu3;) 366(param) + Return + FunctionEnd +11(@CSMain(vu3;): 2 Function None 9 + 10(dti): 8(ptr) FunctionParameter + 12: Label + 28: 27(ptr) AccessChain 10(dti) 26 + 29: 6(int) Load 28 + 30: 27(ptr) AccessChain 10(dti) 26 + 31: 6(int) Load 30 + 33: 32(ptr) AccessChain 24(data) 25 31 25 + 34: 13(ivec4) Load 33 + 36: 13(ivec4) GroupNonUniformIAdd 35 InclusiveScan 34 + 37: 32(ptr) AccessChain 24(data) 25 29 25 + Store 37 36 + 38: 27(ptr) AccessChain 10(dti) 26 + 39: 6(int) Load 38 + 40: 27(ptr) AccessChain 10(dti) 26 + 41: 6(int) Load 40 + 43: 42(ptr) AccessChain 24(data) 25 41 25 26 + 44: 6(int) Load 43 + 45: 6(int) GroupNonUniformIAdd 35 InclusiveScan 44 + 46: 42(ptr) AccessChain 24(data) 25 39 25 26 + Store 46 45 + 47: 27(ptr) AccessChain 10(dti) 26 + 48: 6(int) Load 47 + 49: 27(ptr) AccessChain 10(dti) 26 + 50: 6(int) Load 49 + 52: 32(ptr) AccessChain 24(data) 25 50 25 + 53: 13(ivec4) Load 52 + 54: 51(ivec2) VectorShuffle 53 53 0 1 + 55: 51(ivec2) GroupNonUniformIAdd 35 InclusiveScan 54 + 56: 32(ptr) AccessChain 24(data) 25 48 25 + 57: 13(ivec4) Load 56 + 58: 13(ivec4) VectorShuffle 57 55 4 5 2 3 + Store 56 58 + 59: 27(ptr) AccessChain 10(dti) 26 + 60: 6(int) Load 59 + 61: 27(ptr) AccessChain 10(dti) 26 + 62: 6(int) Load 61 + 63: 32(ptr) AccessChain 24(data) 25 62 25 + 64: 13(ivec4) Load 63 + 65: 7(ivec3) VectorShuffle 64 64 0 1 2 + 66: 7(ivec3) GroupNonUniformIAdd 35 InclusiveScan 65 + 67: 32(ptr) AccessChain 24(data) 25 60 25 + 68: 13(ivec4) Load 67 + 69: 13(ivec4) VectorShuffle 68 66 4 5 6 3 + Store 67 69 + 70: 27(ptr) AccessChain 10(dti) 26 + 71: 6(int) Load 70 + 73: 27(ptr) AccessChain 10(dti) 26 + 74: 6(int) Load 73 + 76: 75(ptr) AccessChain 24(data) 25 74 72 + 77: 15(ivec4) Load 76 + 78: 15(ivec4) GroupNonUniformIAdd 35 InclusiveScan 77 + 79: 75(ptr) AccessChain 24(data) 25 71 72 + Store 79 78 + 80: 27(ptr) AccessChain 10(dti) 26 + 81: 6(int) Load 80 + 82: 27(ptr) AccessChain 10(dti) 26 + 83: 6(int) Load 82 + 85: 84(ptr) AccessChain 24(data) 25 83 72 26 + 86: 14(int) Load 85 + 87: 14(int) GroupNonUniformIAdd 35 InclusiveScan 86 + 88: 84(ptr) AccessChain 24(data) 25 81 72 26 + Store 88 87 + 89: 27(ptr) AccessChain 10(dti) 26 + 90: 6(int) Load 89 + 91: 27(ptr) AccessChain 10(dti) 26 + 92: 6(int) Load 91 + 94: 75(ptr) AccessChain 24(data) 25 92 72 + 95: 15(ivec4) Load 94 + 96: 93(ivec2) VectorShuffle 95 95 0 1 + 97: 93(ivec2) GroupNonUniformIAdd 35 InclusiveScan 96 + 98: 75(ptr) AccessChain 24(data) 25 90 72 + 99: 15(ivec4) Load 98 + 100: 15(ivec4) VectorShuffle 99 97 4 5 2 3 + Store 98 100 + 101: 27(ptr) AccessChain 10(dti) 26 + 102: 6(int) Load 101 + 103: 27(ptr) AccessChain 10(dti) 26 + 104: 6(int) Load 103 + 106: 75(ptr) AccessChain 24(data) 25 104 72 + 107: 15(ivec4) Load 106 + 108: 105(ivec3) VectorShuffle 107 107 0 1 2 + 109: 105(ivec3) GroupNonUniformIAdd 35 InclusiveScan 108 + 110: 75(ptr) AccessChain 24(data) 25 102 72 + 111: 15(ivec4) Load 110 + 112: 15(ivec4) VectorShuffle 111 109 4 5 6 3 + Store 110 112 + 113: 27(ptr) AccessChain 10(dti) 26 + 114: 6(int) Load 113 + 116: 27(ptr) AccessChain 10(dti) 26 + 117: 6(int) Load 116 + 119: 118(ptr) AccessChain 24(data) 25 117 115 + 120: 17(fvec4) Load 119 + 121: 17(fvec4) GroupNonUniformFAdd 35 InclusiveScan 120 + 122: 118(ptr) AccessChain 24(data) 25 114 115 + Store 122 121 + 123: 27(ptr) AccessChain 10(dti) 26 + 124: 6(int) Load 123 + 125: 27(ptr) AccessChain 10(dti) 26 + 126: 6(int) Load 125 + 128: 127(ptr) AccessChain 24(data) 25 126 115 26 + 129: 16(float) Load 128 + 130: 16(float) GroupNonUniformFAdd 35 InclusiveScan 129 + 131: 127(ptr) AccessChain 24(data) 25 124 115 26 + Store 131 130 + 132: 27(ptr) AccessChain 10(dti) 26 + 133: 6(int) Load 132 + 134: 27(ptr) AccessChain 10(dti) 26 + 135: 6(int) Load 134 + 137: 118(ptr) AccessChain 24(data) 25 135 115 + 138: 17(fvec4) Load 137 + 139: 136(fvec2) VectorShuffle 138 138 0 1 + 140: 136(fvec2) GroupNonUniformFAdd 35 InclusiveScan 139 + 141: 118(ptr) AccessChain 24(data) 25 133 115 + 142: 17(fvec4) Load 141 + 143: 17(fvec4) VectorShuffle 142 140 4 5 2 3 + Store 141 143 + 144: 27(ptr) AccessChain 10(dti) 26 + 145: 6(int) Load 144 + 146: 27(ptr) AccessChain 10(dti) 26 + 147: 6(int) Load 146 + 149: 118(ptr) AccessChain 24(data) 25 147 115 + 150: 17(fvec4) Load 149 + 151: 148(fvec3) VectorShuffle 150 150 0 1 2 + 152: 148(fvec3) GroupNonUniformFAdd 35 InclusiveScan 151 + 153: 118(ptr) AccessChain 24(data) 25 145 115 + 154: 17(fvec4) Load 153 + 155: 17(fvec4) VectorShuffle 154 152 4 5 6 3 + Store 153 155 + 156: 27(ptr) AccessChain 10(dti) 26 + 157: 6(int) Load 156 + 159: 27(ptr) AccessChain 10(dti) 26 + 160: 6(int) Load 159 + 162: 161(ptr) AccessChain 24(data) 25 160 158 + 163: 19(f64vec4) Load 162 + 164: 19(f64vec4) GroupNonUniformFAdd 35 InclusiveScan 163 + 165: 161(ptr) AccessChain 24(data) 25 157 158 + Store 165 164 + 166: 27(ptr) AccessChain 10(dti) 26 + 167: 6(int) Load 166 + 168: 27(ptr) AccessChain 10(dti) 26 + 169: 6(int) Load 168 + 171: 170(ptr) AccessChain 24(data) 25 169 158 26 + 172:18(float64_t) Load 171 + 173:18(float64_t) GroupNonUniformFAdd 35 InclusiveScan 172 + 174: 170(ptr) AccessChain 24(data) 25 167 158 26 + Store 174 173 + 175: 27(ptr) AccessChain 10(dti) 26 + 176: 6(int) Load 175 + 177: 27(ptr) AccessChain 10(dti) 26 + 178: 6(int) Load 177 + 180: 161(ptr) AccessChain 24(data) 25 178 158 + 181: 19(f64vec4) Load 180 + 182:179(f64vec2) VectorShuffle 181 181 0 1 + 183:179(f64vec2) GroupNonUniformFAdd 35 InclusiveScan 182 + 184: 161(ptr) AccessChain 24(data) 25 176 158 + 185: 19(f64vec4) Load 184 + 186: 19(f64vec4) VectorShuffle 185 183 4 5 2 3 + Store 184 186 + 187: 27(ptr) AccessChain 10(dti) 26 + 188: 6(int) Load 187 + 189: 27(ptr) AccessChain 10(dti) 26 + 190: 6(int) Load 189 + 192: 161(ptr) AccessChain 24(data) 25 190 158 + 193: 19(f64vec4) Load 192 + 194:191(f64vec3) VectorShuffle 193 193 0 1 2 + 195:191(f64vec3) GroupNonUniformFAdd 35 InclusiveScan 194 + 196: 161(ptr) AccessChain 24(data) 25 188 158 + 197: 19(f64vec4) Load 196 + 198: 19(f64vec4) VectorShuffle 197 195 4 5 6 3 + Store 196 198 + 199: 27(ptr) AccessChain 10(dti) 26 + 200: 6(int) Load 199 + 201: 27(ptr) AccessChain 10(dti) 26 + 202: 6(int) Load 201 + 203: 32(ptr) AccessChain 24(data) 25 202 25 + 204: 13(ivec4) Load 203 + 205: 13(ivec4) GroupNonUniformIMul 35 InclusiveScan 204 + 206: 32(ptr) AccessChain 24(data) 25 200 25 + Store 206 205 + 207: 27(ptr) AccessChain 10(dti) 26 + 208: 6(int) Load 207 + 209: 27(ptr) AccessChain 10(dti) 26 + 210: 6(int) Load 209 + 211: 42(ptr) AccessChain 24(data) 25 210 25 26 + 212: 6(int) Load 211 + 213: 6(int) GroupNonUniformIMul 35 InclusiveScan 212 + 214: 42(ptr) AccessChain 24(data) 25 208 25 26 + Store 214 213 + 215: 27(ptr) AccessChain 10(dti) 26 + 216: 6(int) Load 215 + 217: 27(ptr) AccessChain 10(dti) 26 + 218: 6(int) Load 217 + 219: 32(ptr) AccessChain 24(data) 25 218 25 + 220: 13(ivec4) Load 219 + 221: 51(ivec2) VectorShuffle 220 220 0 1 + 222: 51(ivec2) GroupNonUniformIMul 35 InclusiveScan 221 + 223: 32(ptr) AccessChain 24(data) 25 216 25 + 224: 13(ivec4) Load 223 + 225: 13(ivec4) VectorShuffle 224 222 4 5 2 3 + Store 223 225 + 226: 27(ptr) AccessChain 10(dti) 26 + 227: 6(int) Load 226 + 228: 27(ptr) AccessChain 10(dti) 26 + 229: 6(int) Load 228 + 230: 32(ptr) AccessChain 24(data) 25 229 25 + 231: 13(ivec4) Load 230 + 232: 7(ivec3) VectorShuffle 231 231 0 1 2 + 233: 7(ivec3) GroupNonUniformIMul 35 InclusiveScan 232 + 234: 32(ptr) AccessChain 24(data) 25 227 25 + 235: 13(ivec4) Load 234 + 236: 13(ivec4) VectorShuffle 235 233 4 5 6 3 + Store 234 236 + 237: 27(ptr) AccessChain 10(dti) 26 + 238: 6(int) Load 237 + 239: 27(ptr) AccessChain 10(dti) 26 + 240: 6(int) Load 239 + 241: 75(ptr) AccessChain 24(data) 25 240 72 + 242: 15(ivec4) Load 241 + 243: 15(ivec4) GroupNonUniformIMul 35 InclusiveScan 242 + 244: 75(ptr) AccessChain 24(data) 25 238 72 + Store 244 243 + 245: 27(ptr) AccessChain 10(dti) 26 + 246: 6(int) Load 245 + 247: 27(ptr) AccessChain 10(dti) 26 + 248: 6(int) Load 247 + 249: 84(ptr) AccessChain 24(data) 25 248 72 26 + 250: 14(int) Load 249 + 251: 14(int) GroupNonUniformIMul 35 InclusiveScan 250 + 252: 84(ptr) AccessChain 24(data) 25 246 72 26 + Store 252 251 + 253: 27(ptr) AccessChain 10(dti) 26 + 254: 6(int) Load 253 + 255: 27(ptr) AccessChain 10(dti) 26 + 256: 6(int) Load 255 + 257: 75(ptr) AccessChain 24(data) 25 256 72 + 258: 15(ivec4) Load 257 + 259: 93(ivec2) VectorShuffle 258 258 0 1 + 260: 93(ivec2) GroupNonUniformIMul 35 InclusiveScan 259 + 261: 75(ptr) AccessChain 24(data) 25 254 72 + 262: 15(ivec4) Load 261 + 263: 15(ivec4) VectorShuffle 262 260 4 5 2 3 + Store 261 263 + 264: 27(ptr) AccessChain 10(dti) 26 + 265: 6(int) Load 264 + 266: 27(ptr) AccessChain 10(dti) 26 + 267: 6(int) Load 266 + 268: 75(ptr) AccessChain 24(data) 25 267 72 + 269: 15(ivec4) Load 268 + 270: 105(ivec3) VectorShuffle 269 269 0 1 2 + 271: 105(ivec3) GroupNonUniformIMul 35 InclusiveScan 270 + 272: 75(ptr) AccessChain 24(data) 25 265 72 + 273: 15(ivec4) Load 272 + 274: 15(ivec4) VectorShuffle 273 271 4 5 6 3 + Store 272 274 + 275: 27(ptr) AccessChain 10(dti) 26 + 276: 6(int) Load 275 + 277: 27(ptr) AccessChain 10(dti) 26 + 278: 6(int) Load 277 + 279: 118(ptr) AccessChain 24(data) 25 278 115 + 280: 17(fvec4) Load 279 + 281: 17(fvec4) GroupNonUniformFMul 35 InclusiveScan 280 + 282: 118(ptr) AccessChain 24(data) 25 276 115 + Store 282 281 + 283: 27(ptr) AccessChain 10(dti) 26 + 284: 6(int) Load 283 + 285: 27(ptr) AccessChain 10(dti) 26 + 286: 6(int) Load 285 + 287: 127(ptr) AccessChain 24(data) 25 286 115 26 + 288: 16(float) Load 287 + 289: 16(float) GroupNonUniformFMul 35 InclusiveScan 288 + 290: 127(ptr) AccessChain 24(data) 25 284 115 26 + Store 290 289 + 291: 27(ptr) AccessChain 10(dti) 26 + 292: 6(int) Load 291 + 293: 27(ptr) AccessChain 10(dti) 26 + 294: 6(int) Load 293 + 295: 118(ptr) AccessChain 24(data) 25 294 115 + 296: 17(fvec4) Load 295 + 297: 136(fvec2) VectorShuffle 296 296 0 1 + 298: 136(fvec2) GroupNonUniformFMul 35 InclusiveScan 297 + 299: 118(ptr) AccessChain 24(data) 25 292 115 + 300: 17(fvec4) Load 299 + 301: 17(fvec4) VectorShuffle 300 298 4 5 2 3 + Store 299 301 + 302: 27(ptr) AccessChain 10(dti) 26 + 303: 6(int) Load 302 + 304: 27(ptr) AccessChain 10(dti) 26 + 305: 6(int) Load 304 + 306: 118(ptr) AccessChain 24(data) 25 305 115 + 307: 17(fvec4) Load 306 + 308: 148(fvec3) VectorShuffle 307 307 0 1 2 + 309: 148(fvec3) GroupNonUniformFMul 35 InclusiveScan 308 + 310: 118(ptr) AccessChain 24(data) 25 303 115 + 311: 17(fvec4) Load 310 + 312: 17(fvec4) VectorShuffle 311 309 4 5 6 3 + Store 310 312 + 313: 27(ptr) AccessChain 10(dti) 26 + 314: 6(int) Load 313 + 315: 27(ptr) AccessChain 10(dti) 26 + 316: 6(int) Load 315 + 317: 161(ptr) AccessChain 24(data) 25 316 158 + 318: 19(f64vec4) Load 317 + 319: 19(f64vec4) GroupNonUniformFMul 35 InclusiveScan 318 + 320: 161(ptr) AccessChain 24(data) 25 314 158 + Store 320 319 + 321: 27(ptr) AccessChain 10(dti) 26 + 322: 6(int) Load 321 + 323: 27(ptr) AccessChain 10(dti) 26 + 324: 6(int) Load 323 + 325: 170(ptr) AccessChain 24(data) 25 324 158 26 + 326:18(float64_t) Load 325 + 327:18(float64_t) GroupNonUniformFMul 35 InclusiveScan 326 + 328: 170(ptr) AccessChain 24(data) 25 322 158 26 + Store 328 327 + 329: 27(ptr) AccessChain 10(dti) 26 + 330: 6(int) Load 329 + 331: 27(ptr) AccessChain 10(dti) 26 + 332: 6(int) Load 331 + 333: 161(ptr) AccessChain 24(data) 25 332 158 + 334: 19(f64vec4) Load 333 + 335:179(f64vec2) VectorShuffle 334 334 0 1 + 336:179(f64vec2) GroupNonUniformFMul 35 InclusiveScan 335 + 337: 161(ptr) AccessChain 24(data) 25 330 158 + 338: 19(f64vec4) Load 337 + 339: 19(f64vec4) VectorShuffle 338 336 4 5 2 3 + Store 337 339 + 340: 27(ptr) AccessChain 10(dti) 26 + 341: 6(int) Load 340 + 342: 27(ptr) AccessChain 10(dti) 26 + 343: 6(int) Load 342 + 344: 161(ptr) AccessChain 24(data) 25 343 158 + 345: 19(f64vec4) Load 344 + 346:191(f64vec3) VectorShuffle 345 345 0 1 2 + 347:191(f64vec3) GroupNonUniformFMul 35 InclusiveScan 346 + 348: 161(ptr) AccessChain 24(data) 25 341 158 + 349: 19(f64vec4) Load 348 + 350: 19(f64vec4) VectorShuffle 349 347 4 5 6 3 + Store 348 350 + 351: 27(ptr) AccessChain 10(dti) 26 + 352: 6(int) Load 351 + 353: 27(ptr) AccessChain 10(dti) 26 + 354: 6(int) Load 353 + 355: 42(ptr) AccessChain 24(data) 25 354 25 26 + 356: 6(int) Load 355 + 358: 357(bool) IEqual 356 26 + 359: 13(ivec4) GroupNonUniformBallot 35 358 + 360: 6(int) GroupNonUniformBallotBitCount 35 InclusiveScan 359 + 361: 42(ptr) AccessChain 24(data) 25 352 25 26 + Store 361 360 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequad.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequad.comp.out new file mode 100644 index 00000000000..56ef6d740f2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequad.comp.out @@ -0,0 +1,9299 @@ +hlsl.wavequad.comp +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const uint) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupQuadBroadcast ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const uint) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 Constant: +0:16 0 (const uint) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 Constant: +0:17 0 (const uint) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupQuadBroadcast ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 Constant: +0:19 0 (const uint) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupQuadBroadcast ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 0 (const uint) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupQuadBroadcast ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 0 (const uint) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupQuadBroadcast ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 Constant: +0:22 0 (const uint) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupQuadBroadcast ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 Constant: +0:24 0 (const uint) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupQuadBroadcast ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 0 (const uint) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupQuadBroadcast ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 Constant: +0:26 0 (const uint) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupQuadBroadcast ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Constant: +0:27 0 (const uint) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupQuadBroadcast ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 Constant: +0:29 0 (const uint) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupQuadBroadcast ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 0 (const uint) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupQuadBroadcast ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 Constant: +0:31 0 (const uint) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupQuadBroadcast ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 Constant: +0:32 0 (const uint) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 1 (const uint) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupQuadBroadcast ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 1 (const uint) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 Constant: +0:36 1 (const uint) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 Constant: +0:37 1 (const uint) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupQuadBroadcast ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 Constant: +0:39 1 (const uint) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupQuadBroadcast ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const uint) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupQuadBroadcast ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Constant: +0:41 1 (const uint) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupQuadBroadcast ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 Constant: +0:42 1 (const uint) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupQuadBroadcast ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 Constant: +0:44 1 (const uint) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupQuadBroadcast ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 1 (const uint) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupQuadBroadcast ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 Constant: +0:46 1 (const uint) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupQuadBroadcast ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Constant: +0:47 1 (const uint) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupQuadBroadcast ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 Constant: +0:49 1 (const uint) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupQuadBroadcast ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 1 (const uint) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupQuadBroadcast ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 Constant: +0:51 1 (const uint) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupQuadBroadcast ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 Constant: +0:52 1 (const uint) +0:54 move second child to first child ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 2 (const uint) +0:55 move second child to first child ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 subgroupQuadBroadcast ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 2 (const uint) +0:56 move second child to first child ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 Constant: +0:56 2 (const uint) +0:57 move second child to first child ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:57 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:57 Constant: +0:57 2 (const uint) +0:59 move second child to first child ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:59 subgroupQuadBroadcast ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:59 Constant: +0:59 2 (const uint) +0:60 move second child to first child ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:60 subgroupQuadBroadcast ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 2 (const uint) +0:61 move second child to first child ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 subgroupQuadBroadcast ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Constant: +0:61 2 (const uint) +0:62 move second child to first child ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:62 subgroupQuadBroadcast ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:62 Constant: +0:62 2 (const uint) +0:64 move second child to first child ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:64 subgroupQuadBroadcast ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:64 Constant: +0:64 2 (const uint) +0:65 move second child to first child ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:65 subgroupQuadBroadcast ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const uint) +0:66 move second child to first child ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:66 subgroupQuadBroadcast ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:66 Constant: +0:66 2 (const uint) +0:67 move second child to first child ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 subgroupQuadBroadcast ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Constant: +0:67 2 (const uint) +0:69 move second child to first child ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:69 subgroupQuadBroadcast ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:69 Constant: +0:69 2 (const uint) +0:70 move second child to first child ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:70 subgroupQuadBroadcast ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 2 (const uint) +0:71 move second child to first child ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 subgroupQuadBroadcast ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 2 (const uint) +0:72 move second child to first child ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:72 subgroupQuadBroadcast ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:72 Constant: +0:72 2 (const uint) +0:74 move second child to first child ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:74 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 3 (const uint) +0:75 move second child to first child ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 subgroupQuadBroadcast ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 3 (const uint) +0:76 move second child to first child ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:76 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:76 Constant: +0:76 3 (const uint) +0:77 move second child to first child ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:77 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:77 Constant: +0:77 3 (const uint) +0:79 move second child to first child ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 subgroupQuadBroadcast ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 Constant: +0:79 3 (const uint) +0:80 move second child to first child ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:80 subgroupQuadBroadcast ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 3 (const uint) +0:81 move second child to first child ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 subgroupQuadBroadcast ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Constant: +0:81 3 (const uint) +0:82 move second child to first child ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:82 subgroupQuadBroadcast ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:82 Constant: +0:82 3 (const uint) +0:84 move second child to first child ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:84 subgroupQuadBroadcast ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:84 Constant: +0:84 3 (const uint) +0:85 move second child to first child ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:85 subgroupQuadBroadcast ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 3 (const uint) +0:86 move second child to first child ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:86 subgroupQuadBroadcast ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:86 Constant: +0:86 3 (const uint) +0:87 move second child to first child ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 subgroupQuadBroadcast ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Constant: +0:87 3 (const uint) +0:89 move second child to first child ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:89 subgroupQuadBroadcast ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:89 Constant: +0:89 3 (const uint) +0:90 move second child to first child ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:90 subgroupQuadBroadcast ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const uint) +0:91 move second child to first child ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:91 subgroupQuadBroadcast ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:91 Constant: +0:91 3 (const uint) +0:92 move second child to first child ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:92 subgroupQuadBroadcast ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:92 Constant: +0:92 3 (const uint) +0:94 move second child to first child ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:94 subgroupQuadSwapHorizontal ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:95 move second child to first child ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 subgroupQuadSwapHorizontal ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:96 move second child to first child ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:96 subgroupQuadSwapHorizontal ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:97 move second child to first child ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:97 subgroupQuadSwapHorizontal ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:99 move second child to first child ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:99 subgroupQuadSwapHorizontal ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:100 move second child to first child ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:100 subgroupQuadSwapHorizontal ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:101 move second child to first child ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 subgroupQuadSwapHorizontal ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:102 move second child to first child ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:102 subgroupQuadSwapHorizontal ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:104 move second child to first child ( temp 4-component vector of float) +0:104 f: direct index for structure ( temp 4-component vector of float) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 2 (const int) +0:104 subgroupQuadSwapHorizontal ( temp 4-component vector of float) +0:104 f: direct index for structure ( temp 4-component vector of float) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 2 (const int) +0:105 move second child to first child ( temp float) +0:105 direct index ( temp float) +0:105 f: direct index for structure ( temp 4-component vector of float) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 2 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 subgroupQuadSwapHorizontal ( temp float) +0:105 direct index ( temp float) +0:105 f: direct index for structure ( temp 4-component vector of float) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 2 (const int) +0:105 Constant: +0:105 0 (const int) +0:106 move second child to first child ( temp 2-component vector of float) +0:106 vector swizzle ( temp 2-component vector of float) +0:106 f: direct index for structure ( temp 4-component vector of float) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 2 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:106 subgroupQuadSwapHorizontal ( temp 2-component vector of float) +0:106 vector swizzle ( temp 2-component vector of float) +0:106 f: direct index for structure ( temp 4-component vector of float) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 2 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:107 move second child to first child ( temp 3-component vector of float) +0:107 vector swizzle ( temp 3-component vector of float) +0:107 f: direct index for structure ( temp 4-component vector of float) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 subgroupQuadSwapHorizontal ( temp 3-component vector of float) +0:107 vector swizzle ( temp 3-component vector of float) +0:107 f: direct index for structure ( temp 4-component vector of float) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:109 move second child to first child ( temp 4-component vector of double) +0:109 d: direct index for structure ( temp 4-component vector of double) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 3 (const int) +0:109 subgroupQuadSwapHorizontal ( temp 4-component vector of double) +0:109 d: direct index for structure ( temp 4-component vector of double) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 3 (const int) +0:110 move second child to first child ( temp double) +0:110 direct index ( temp double) +0:110 d: direct index for structure ( temp 4-component vector of double) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 3 (const int) +0:110 Constant: +0:110 0 (const int) +0:110 subgroupQuadSwapHorizontal ( temp double) +0:110 direct index ( temp double) +0:110 d: direct index for structure ( temp 4-component vector of double) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 3 (const int) +0:110 Constant: +0:110 0 (const int) +0:111 move second child to first child ( temp 2-component vector of double) +0:111 vector swizzle ( temp 2-component vector of double) +0:111 d: direct index for structure ( temp 4-component vector of double) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 3 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 subgroupQuadSwapHorizontal ( temp 2-component vector of double) +0:111 vector swizzle ( temp 2-component vector of double) +0:111 d: direct index for structure ( temp 4-component vector of double) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 3 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:112 move second child to first child ( temp 3-component vector of double) +0:112 vector swizzle ( temp 3-component vector of double) +0:112 d: direct index for structure ( temp 4-component vector of double) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 3 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:112 subgroupQuadSwapHorizontal ( temp 3-component vector of double) +0:112 vector swizzle ( temp 3-component vector of double) +0:112 d: direct index for structure ( temp 4-component vector of double) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 3 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:114 move second child to first child ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:114 subgroupQuadSwapVertical ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:115 move second child to first child ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 subgroupQuadSwapVertical ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:116 move second child to first child ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:116 subgroupQuadSwapVertical ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:117 move second child to first child ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:117 subgroupQuadSwapVertical ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:119 move second child to first child ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:119 subgroupQuadSwapVertical ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:120 move second child to first child ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:120 subgroupQuadSwapVertical ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:121 move second child to first child ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 subgroupQuadSwapVertical ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:122 move second child to first child ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:122 subgroupQuadSwapVertical ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:124 move second child to first child ( temp 4-component vector of float) +0:124 f: direct index for structure ( temp 4-component vector of float) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 2 (const int) +0:124 subgroupQuadSwapVertical ( temp 4-component vector of float) +0:124 f: direct index for structure ( temp 4-component vector of float) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 2 (const int) +0:125 move second child to first child ( temp float) +0:125 direct index ( temp float) +0:125 f: direct index for structure ( temp 4-component vector of float) +0:125 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:125 Constant: +0:125 0 (const uint) +0:125 direct index ( temp uint) +0:125 'dti' ( in 3-component vector of uint) +0:125 Constant: +0:125 0 (const int) +0:125 Constant: +0:125 2 (const int) +0:125 Constant: +0:125 0 (const int) +0:125 subgroupQuadSwapVertical ( temp float) +0:125 direct index ( temp float) +0:125 f: direct index for structure ( temp 4-component vector of float) +0:125 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:125 Constant: +0:125 0 (const uint) +0:125 direct index ( temp uint) +0:125 'dti' ( in 3-component vector of uint) +0:125 Constant: +0:125 0 (const int) +0:125 Constant: +0:125 2 (const int) +0:125 Constant: +0:125 0 (const int) +0:126 move second child to first child ( temp 2-component vector of float) +0:126 vector swizzle ( temp 2-component vector of float) +0:126 f: direct index for structure ( temp 4-component vector of float) +0:126 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:126 Constant: +0:126 0 (const uint) +0:126 direct index ( temp uint) +0:126 'dti' ( in 3-component vector of uint) +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 2 (const int) +0:126 Sequence +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 1 (const int) +0:126 subgroupQuadSwapVertical ( temp 2-component vector of float) +0:126 vector swizzle ( temp 2-component vector of float) +0:126 f: direct index for structure ( temp 4-component vector of float) +0:126 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:126 Constant: +0:126 0 (const uint) +0:126 direct index ( temp uint) +0:126 'dti' ( in 3-component vector of uint) +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 2 (const int) +0:126 Sequence +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 1 (const int) +0:127 move second child to first child ( temp 3-component vector of float) +0:127 vector swizzle ( temp 3-component vector of float) +0:127 f: direct index for structure ( temp 4-component vector of float) +0:127 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:127 Constant: +0:127 0 (const uint) +0:127 direct index ( temp uint) +0:127 'dti' ( in 3-component vector of uint) +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 2 (const int) +0:127 Sequence +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 1 (const int) +0:127 Constant: +0:127 2 (const int) +0:127 subgroupQuadSwapVertical ( temp 3-component vector of float) +0:127 vector swizzle ( temp 3-component vector of float) +0:127 f: direct index for structure ( temp 4-component vector of float) +0:127 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:127 Constant: +0:127 0 (const uint) +0:127 direct index ( temp uint) +0:127 'dti' ( in 3-component vector of uint) +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 2 (const int) +0:127 Sequence +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 1 (const int) +0:127 Constant: +0:127 2 (const int) +0:129 move second child to first child ( temp 4-component vector of double) +0:129 d: direct index for structure ( temp 4-component vector of double) +0:129 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:129 Constant: +0:129 0 (const uint) +0:129 direct index ( temp uint) +0:129 'dti' ( in 3-component vector of uint) +0:129 Constant: +0:129 0 (const int) +0:129 Constant: +0:129 3 (const int) +0:129 subgroupQuadSwapVertical ( temp 4-component vector of double) +0:129 d: direct index for structure ( temp 4-component vector of double) +0:129 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:129 Constant: +0:129 0 (const uint) +0:129 direct index ( temp uint) +0:129 'dti' ( in 3-component vector of uint) +0:129 Constant: +0:129 0 (const int) +0:129 Constant: +0:129 3 (const int) +0:130 move second child to first child ( temp double) +0:130 direct index ( temp double) +0:130 d: direct index for structure ( temp 4-component vector of double) +0:130 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:130 Constant: +0:130 0 (const uint) +0:130 direct index ( temp uint) +0:130 'dti' ( in 3-component vector of uint) +0:130 Constant: +0:130 0 (const int) +0:130 Constant: +0:130 3 (const int) +0:130 Constant: +0:130 0 (const int) +0:130 subgroupQuadSwapVertical ( temp double) +0:130 direct index ( temp double) +0:130 d: direct index for structure ( temp 4-component vector of double) +0:130 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:130 Constant: +0:130 0 (const uint) +0:130 direct index ( temp uint) +0:130 'dti' ( in 3-component vector of uint) +0:130 Constant: +0:130 0 (const int) +0:130 Constant: +0:130 3 (const int) +0:130 Constant: +0:130 0 (const int) +0:131 move second child to first child ( temp 2-component vector of double) +0:131 vector swizzle ( temp 2-component vector of double) +0:131 d: direct index for structure ( temp 4-component vector of double) +0:131 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:131 Constant: +0:131 0 (const uint) +0:131 direct index ( temp uint) +0:131 'dti' ( in 3-component vector of uint) +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 3 (const int) +0:131 Sequence +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 1 (const int) +0:131 subgroupQuadSwapVertical ( temp 2-component vector of double) +0:131 vector swizzle ( temp 2-component vector of double) +0:131 d: direct index for structure ( temp 4-component vector of double) +0:131 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:131 Constant: +0:131 0 (const uint) +0:131 direct index ( temp uint) +0:131 'dti' ( in 3-component vector of uint) +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 3 (const int) +0:131 Sequence +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 1 (const int) +0:132 move second child to first child ( temp 3-component vector of double) +0:132 vector swizzle ( temp 3-component vector of double) +0:132 d: direct index for structure ( temp 4-component vector of double) +0:132 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:132 Constant: +0:132 0 (const uint) +0:132 direct index ( temp uint) +0:132 'dti' ( in 3-component vector of uint) +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 3 (const int) +0:132 Sequence +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 1 (const int) +0:132 Constant: +0:132 2 (const int) +0:132 subgroupQuadSwapVertical ( temp 3-component vector of double) +0:132 vector swizzle ( temp 3-component vector of double) +0:132 d: direct index for structure ( temp 4-component vector of double) +0:132 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:132 Constant: +0:132 0 (const uint) +0:132 direct index ( temp uint) +0:132 'dti' ( in 3-component vector of uint) +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 3 (const int) +0:132 Sequence +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 1 (const int) +0:132 Constant: +0:132 2 (const int) +0:134 move second child to first child ( temp 4-component vector of uint) +0:134 u: direct index for structure ( temp 4-component vector of uint) +0:134 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:134 Constant: +0:134 0 (const uint) +0:134 direct index ( temp uint) +0:134 'dti' ( in 3-component vector of uint) +0:134 Constant: +0:134 0 (const int) +0:134 Constant: +0:134 0 (const int) +0:134 subgroupQuadSwapDiagonal ( temp 4-component vector of uint) +0:134 u: direct index for structure ( temp 4-component vector of uint) +0:134 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:134 Constant: +0:134 0 (const uint) +0:134 direct index ( temp uint) +0:134 'dti' ( in 3-component vector of uint) +0:134 Constant: +0:134 0 (const int) +0:134 Constant: +0:134 0 (const int) +0:135 move second child to first child ( temp uint) +0:135 direct index ( temp uint) +0:135 u: direct index for structure ( temp 4-component vector of uint) +0:135 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:135 Constant: +0:135 0 (const uint) +0:135 direct index ( temp uint) +0:135 'dti' ( in 3-component vector of uint) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:135 subgroupQuadSwapDiagonal ( temp uint) +0:135 direct index ( temp uint) +0:135 u: direct index for structure ( temp 4-component vector of uint) +0:135 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:135 Constant: +0:135 0 (const uint) +0:135 direct index ( temp uint) +0:135 'dti' ( in 3-component vector of uint) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:136 move second child to first child ( temp 2-component vector of uint) +0:136 vector swizzle ( temp 2-component vector of uint) +0:136 u: direct index for structure ( temp 4-component vector of uint) +0:136 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:136 Constant: +0:136 0 (const uint) +0:136 direct index ( temp uint) +0:136 'dti' ( in 3-component vector of uint) +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 0 (const int) +0:136 Sequence +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 1 (const int) +0:136 subgroupQuadSwapDiagonal ( temp 2-component vector of uint) +0:136 vector swizzle ( temp 2-component vector of uint) +0:136 u: direct index for structure ( temp 4-component vector of uint) +0:136 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:136 Constant: +0:136 0 (const uint) +0:136 direct index ( temp uint) +0:136 'dti' ( in 3-component vector of uint) +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 0 (const int) +0:136 Sequence +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 1 (const int) +0:137 move second child to first child ( temp 3-component vector of uint) +0:137 vector swizzle ( temp 3-component vector of uint) +0:137 u: direct index for structure ( temp 4-component vector of uint) +0:137 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:137 Constant: +0:137 0 (const uint) +0:137 direct index ( temp uint) +0:137 'dti' ( in 3-component vector of uint) +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 0 (const int) +0:137 Sequence +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 1 (const int) +0:137 Constant: +0:137 2 (const int) +0:137 subgroupQuadSwapDiagonal ( temp 3-component vector of uint) +0:137 vector swizzle ( temp 3-component vector of uint) +0:137 u: direct index for structure ( temp 4-component vector of uint) +0:137 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:137 Constant: +0:137 0 (const uint) +0:137 direct index ( temp uint) +0:137 'dti' ( in 3-component vector of uint) +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 0 (const int) +0:137 Sequence +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 1 (const int) +0:137 Constant: +0:137 2 (const int) +0:139 move second child to first child ( temp 4-component vector of int) +0:139 i: direct index for structure ( temp 4-component vector of int) +0:139 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:139 Constant: +0:139 0 (const uint) +0:139 direct index ( temp uint) +0:139 'dti' ( in 3-component vector of uint) +0:139 Constant: +0:139 0 (const int) +0:139 Constant: +0:139 1 (const int) +0:139 subgroupQuadSwapDiagonal ( temp 4-component vector of int) +0:139 i: direct index for structure ( temp 4-component vector of int) +0:139 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:139 Constant: +0:139 0 (const uint) +0:139 direct index ( temp uint) +0:139 'dti' ( in 3-component vector of uint) +0:139 Constant: +0:139 0 (const int) +0:139 Constant: +0:139 1 (const int) +0:140 move second child to first child ( temp int) +0:140 direct index ( temp int) +0:140 i: direct index for structure ( temp 4-component vector of int) +0:140 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:140 Constant: +0:140 0 (const uint) +0:140 direct index ( temp uint) +0:140 'dti' ( in 3-component vector of uint) +0:140 Constant: +0:140 0 (const int) +0:140 Constant: +0:140 1 (const int) +0:140 Constant: +0:140 0 (const int) +0:140 subgroupQuadSwapDiagonal ( temp int) +0:140 direct index ( temp int) +0:140 i: direct index for structure ( temp 4-component vector of int) +0:140 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:140 Constant: +0:140 0 (const uint) +0:140 direct index ( temp uint) +0:140 'dti' ( in 3-component vector of uint) +0:140 Constant: +0:140 0 (const int) +0:140 Constant: +0:140 1 (const int) +0:140 Constant: +0:140 0 (const int) +0:141 move second child to first child ( temp 2-component vector of int) +0:141 vector swizzle ( temp 2-component vector of int) +0:141 i: direct index for structure ( temp 4-component vector of int) +0:141 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:141 Constant: +0:141 0 (const uint) +0:141 direct index ( temp uint) +0:141 'dti' ( in 3-component vector of uint) +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:141 Sequence +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:141 subgroupQuadSwapDiagonal ( temp 2-component vector of int) +0:141 vector swizzle ( temp 2-component vector of int) +0:141 i: direct index for structure ( temp 4-component vector of int) +0:141 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:141 Constant: +0:141 0 (const uint) +0:141 direct index ( temp uint) +0:141 'dti' ( in 3-component vector of uint) +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:141 Sequence +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:142 move second child to first child ( temp 3-component vector of int) +0:142 vector swizzle ( temp 3-component vector of int) +0:142 i: direct index for structure ( temp 4-component vector of int) +0:142 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:142 Constant: +0:142 0 (const uint) +0:142 direct index ( temp uint) +0:142 'dti' ( in 3-component vector of uint) +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Sequence +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Constant: +0:142 2 (const int) +0:142 subgroupQuadSwapDiagonal ( temp 3-component vector of int) +0:142 vector swizzle ( temp 3-component vector of int) +0:142 i: direct index for structure ( temp 4-component vector of int) +0:142 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:142 Constant: +0:142 0 (const uint) +0:142 direct index ( temp uint) +0:142 'dti' ( in 3-component vector of uint) +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Sequence +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Constant: +0:142 2 (const int) +0:144 move second child to first child ( temp 4-component vector of float) +0:144 f: direct index for structure ( temp 4-component vector of float) +0:144 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:144 Constant: +0:144 0 (const uint) +0:144 direct index ( temp uint) +0:144 'dti' ( in 3-component vector of uint) +0:144 Constant: +0:144 0 (const int) +0:144 Constant: +0:144 2 (const int) +0:144 subgroupQuadSwapDiagonal ( temp 4-component vector of float) +0:144 f: direct index for structure ( temp 4-component vector of float) +0:144 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:144 Constant: +0:144 0 (const uint) +0:144 direct index ( temp uint) +0:144 'dti' ( in 3-component vector of uint) +0:144 Constant: +0:144 0 (const int) +0:144 Constant: +0:144 2 (const int) +0:145 move second child to first child ( temp float) +0:145 direct index ( temp float) +0:145 f: direct index for structure ( temp 4-component vector of float) +0:145 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:145 Constant: +0:145 0 (const uint) +0:145 direct index ( temp uint) +0:145 'dti' ( in 3-component vector of uint) +0:145 Constant: +0:145 0 (const int) +0:145 Constant: +0:145 2 (const int) +0:145 Constant: +0:145 0 (const int) +0:145 subgroupQuadSwapDiagonal ( temp float) +0:145 direct index ( temp float) +0:145 f: direct index for structure ( temp 4-component vector of float) +0:145 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:145 Constant: +0:145 0 (const uint) +0:145 direct index ( temp uint) +0:145 'dti' ( in 3-component vector of uint) +0:145 Constant: +0:145 0 (const int) +0:145 Constant: +0:145 2 (const int) +0:145 Constant: +0:145 0 (const int) +0:146 move second child to first child ( temp 2-component vector of float) +0:146 vector swizzle ( temp 2-component vector of float) +0:146 f: direct index for structure ( temp 4-component vector of float) +0:146 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:146 Constant: +0:146 0 (const uint) +0:146 direct index ( temp uint) +0:146 'dti' ( in 3-component vector of uint) +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 2 (const int) +0:146 Sequence +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 1 (const int) +0:146 subgroupQuadSwapDiagonal ( temp 2-component vector of float) +0:146 vector swizzle ( temp 2-component vector of float) +0:146 f: direct index for structure ( temp 4-component vector of float) +0:146 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:146 Constant: +0:146 0 (const uint) +0:146 direct index ( temp uint) +0:146 'dti' ( in 3-component vector of uint) +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 2 (const int) +0:146 Sequence +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 1 (const int) +0:147 move second child to first child ( temp 3-component vector of float) +0:147 vector swizzle ( temp 3-component vector of float) +0:147 f: direct index for structure ( temp 4-component vector of float) +0:147 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:147 Constant: +0:147 0 (const uint) +0:147 direct index ( temp uint) +0:147 'dti' ( in 3-component vector of uint) +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 2 (const int) +0:147 Sequence +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 1 (const int) +0:147 Constant: +0:147 2 (const int) +0:147 subgroupQuadSwapDiagonal ( temp 3-component vector of float) +0:147 vector swizzle ( temp 3-component vector of float) +0:147 f: direct index for structure ( temp 4-component vector of float) +0:147 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:147 Constant: +0:147 0 (const uint) +0:147 direct index ( temp uint) +0:147 'dti' ( in 3-component vector of uint) +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 2 (const int) +0:147 Sequence +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 1 (const int) +0:147 Constant: +0:147 2 (const int) +0:149 move second child to first child ( temp 4-component vector of double) +0:149 d: direct index for structure ( temp 4-component vector of double) +0:149 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:149 Constant: +0:149 0 (const uint) +0:149 direct index ( temp uint) +0:149 'dti' ( in 3-component vector of uint) +0:149 Constant: +0:149 0 (const int) +0:149 Constant: +0:149 3 (const int) +0:149 subgroupQuadSwapDiagonal ( temp 4-component vector of double) +0:149 d: direct index for structure ( temp 4-component vector of double) +0:149 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:149 Constant: +0:149 0 (const uint) +0:149 direct index ( temp uint) +0:149 'dti' ( in 3-component vector of uint) +0:149 Constant: +0:149 0 (const int) +0:149 Constant: +0:149 3 (const int) +0:150 move second child to first child ( temp double) +0:150 direct index ( temp double) +0:150 d: direct index for structure ( temp 4-component vector of double) +0:150 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:150 Constant: +0:150 0 (const uint) +0:150 direct index ( temp uint) +0:150 'dti' ( in 3-component vector of uint) +0:150 Constant: +0:150 0 (const int) +0:150 Constant: +0:150 3 (const int) +0:150 Constant: +0:150 0 (const int) +0:150 subgroupQuadSwapDiagonal ( temp double) +0:150 direct index ( temp double) +0:150 d: direct index for structure ( temp 4-component vector of double) +0:150 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:150 Constant: +0:150 0 (const uint) +0:150 direct index ( temp uint) +0:150 'dti' ( in 3-component vector of uint) +0:150 Constant: +0:150 0 (const int) +0:150 Constant: +0:150 3 (const int) +0:150 Constant: +0:150 0 (const int) +0:151 move second child to first child ( temp 2-component vector of double) +0:151 vector swizzle ( temp 2-component vector of double) +0:151 d: direct index for structure ( temp 4-component vector of double) +0:151 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:151 Constant: +0:151 0 (const uint) +0:151 direct index ( temp uint) +0:151 'dti' ( in 3-component vector of uint) +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 3 (const int) +0:151 Sequence +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 1 (const int) +0:151 subgroupQuadSwapDiagonal ( temp 2-component vector of double) +0:151 vector swizzle ( temp 2-component vector of double) +0:151 d: direct index for structure ( temp 4-component vector of double) +0:151 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:151 Constant: +0:151 0 (const uint) +0:151 direct index ( temp uint) +0:151 'dti' ( in 3-component vector of uint) +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 3 (const int) +0:151 Sequence +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 1 (const int) +0:152 move second child to first child ( temp 3-component vector of double) +0:152 vector swizzle ( temp 3-component vector of double) +0:152 d: direct index for structure ( temp 4-component vector of double) +0:152 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:152 Constant: +0:152 0 (const uint) +0:152 direct index ( temp uint) +0:152 'dti' ( in 3-component vector of uint) +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 3 (const int) +0:152 Sequence +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 1 (const int) +0:152 Constant: +0:152 2 (const int) +0:152 subgroupQuadSwapDiagonal ( temp 3-component vector of double) +0:152 vector swizzle ( temp 3-component vector of double) +0:152 d: direct index for structure ( temp 4-component vector of double) +0:152 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:152 Constant: +0:152 0 (const uint) +0:152 direct index ( temp uint) +0:152 'dti' ( in 3-component vector of uint) +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 3 (const int) +0:152 Sequence +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 1 (const int) +0:152 Constant: +0:152 2 (const int) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const uint) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupQuadBroadcast ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const uint) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 Constant: +0:16 0 (const uint) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 Constant: +0:17 0 (const uint) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupQuadBroadcast ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 Constant: +0:19 0 (const uint) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupQuadBroadcast ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 0 (const uint) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupQuadBroadcast ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 0 (const uint) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupQuadBroadcast ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 Constant: +0:22 0 (const uint) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupQuadBroadcast ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 Constant: +0:24 0 (const uint) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupQuadBroadcast ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 0 (const uint) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupQuadBroadcast ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 Constant: +0:26 0 (const uint) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupQuadBroadcast ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Constant: +0:27 0 (const uint) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupQuadBroadcast ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 Constant: +0:29 0 (const uint) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupQuadBroadcast ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 0 (const uint) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupQuadBroadcast ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 Constant: +0:31 0 (const uint) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupQuadBroadcast ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 Constant: +0:32 0 (const uint) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 1 (const uint) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupQuadBroadcast ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 1 (const uint) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 Constant: +0:36 1 (const uint) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 Constant: +0:37 1 (const uint) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupQuadBroadcast ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 Constant: +0:39 1 (const uint) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupQuadBroadcast ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const uint) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupQuadBroadcast ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Constant: +0:41 1 (const uint) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupQuadBroadcast ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 Constant: +0:42 1 (const uint) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupQuadBroadcast ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 Constant: +0:44 1 (const uint) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupQuadBroadcast ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 1 (const uint) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupQuadBroadcast ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 Constant: +0:46 1 (const uint) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupQuadBroadcast ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Constant: +0:47 1 (const uint) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupQuadBroadcast ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 Constant: +0:49 1 (const uint) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupQuadBroadcast ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 1 (const uint) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupQuadBroadcast ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 Constant: +0:51 1 (const uint) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupQuadBroadcast ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 Constant: +0:52 1 (const uint) +0:54 move second child to first child ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 2 (const uint) +0:55 move second child to first child ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 subgroupQuadBroadcast ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 2 (const uint) +0:56 move second child to first child ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 Constant: +0:56 2 (const uint) +0:57 move second child to first child ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:57 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:57 Constant: +0:57 2 (const uint) +0:59 move second child to first child ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:59 subgroupQuadBroadcast ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:59 Constant: +0:59 2 (const uint) +0:60 move second child to first child ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:60 subgroupQuadBroadcast ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 2 (const uint) +0:61 move second child to first child ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 subgroupQuadBroadcast ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Constant: +0:61 2 (const uint) +0:62 move second child to first child ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:62 subgroupQuadBroadcast ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:62 Constant: +0:62 2 (const uint) +0:64 move second child to first child ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:64 subgroupQuadBroadcast ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:64 Constant: +0:64 2 (const uint) +0:65 move second child to first child ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:65 subgroupQuadBroadcast ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const uint) +0:66 move second child to first child ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:66 subgroupQuadBroadcast ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:66 Constant: +0:66 2 (const uint) +0:67 move second child to first child ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 subgroupQuadBroadcast ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Constant: +0:67 2 (const uint) +0:69 move second child to first child ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:69 subgroupQuadBroadcast ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:69 Constant: +0:69 2 (const uint) +0:70 move second child to first child ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:70 subgroupQuadBroadcast ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 2 (const uint) +0:71 move second child to first child ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 subgroupQuadBroadcast ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 2 (const uint) +0:72 move second child to first child ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:72 subgroupQuadBroadcast ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:72 Constant: +0:72 2 (const uint) +0:74 move second child to first child ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:74 subgroupQuadBroadcast ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 3 (const uint) +0:75 move second child to first child ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 subgroupQuadBroadcast ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 3 (const uint) +0:76 move second child to first child ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:76 subgroupQuadBroadcast ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:76 Constant: +0:76 3 (const uint) +0:77 move second child to first child ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:77 subgroupQuadBroadcast ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:77 Constant: +0:77 3 (const uint) +0:79 move second child to first child ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 subgroupQuadBroadcast ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 Constant: +0:79 3 (const uint) +0:80 move second child to first child ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:80 subgroupQuadBroadcast ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 3 (const uint) +0:81 move second child to first child ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 subgroupQuadBroadcast ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Constant: +0:81 3 (const uint) +0:82 move second child to first child ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:82 subgroupQuadBroadcast ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:82 Constant: +0:82 3 (const uint) +0:84 move second child to first child ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:84 subgroupQuadBroadcast ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:84 Constant: +0:84 3 (const uint) +0:85 move second child to first child ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:85 subgroupQuadBroadcast ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 3 (const uint) +0:86 move second child to first child ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:86 subgroupQuadBroadcast ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:86 Constant: +0:86 3 (const uint) +0:87 move second child to first child ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 subgroupQuadBroadcast ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Constant: +0:87 3 (const uint) +0:89 move second child to first child ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:89 subgroupQuadBroadcast ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:89 Constant: +0:89 3 (const uint) +0:90 move second child to first child ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:90 subgroupQuadBroadcast ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const uint) +0:91 move second child to first child ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:91 subgroupQuadBroadcast ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:91 Constant: +0:91 3 (const uint) +0:92 move second child to first child ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:92 subgroupQuadBroadcast ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:92 Constant: +0:92 3 (const uint) +0:94 move second child to first child ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:94 subgroupQuadSwapHorizontal ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:95 move second child to first child ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 subgroupQuadSwapHorizontal ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:96 move second child to first child ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:96 subgroupQuadSwapHorizontal ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:97 move second child to first child ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:97 subgroupQuadSwapHorizontal ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:99 move second child to first child ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:99 subgroupQuadSwapHorizontal ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:100 move second child to first child ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:100 subgroupQuadSwapHorizontal ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:101 move second child to first child ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 subgroupQuadSwapHorizontal ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:102 move second child to first child ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:102 subgroupQuadSwapHorizontal ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:104 move second child to first child ( temp 4-component vector of float) +0:104 f: direct index for structure ( temp 4-component vector of float) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 2 (const int) +0:104 subgroupQuadSwapHorizontal ( temp 4-component vector of float) +0:104 f: direct index for structure ( temp 4-component vector of float) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 2 (const int) +0:105 move second child to first child ( temp float) +0:105 direct index ( temp float) +0:105 f: direct index for structure ( temp 4-component vector of float) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 2 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 subgroupQuadSwapHorizontal ( temp float) +0:105 direct index ( temp float) +0:105 f: direct index for structure ( temp 4-component vector of float) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 2 (const int) +0:105 Constant: +0:105 0 (const int) +0:106 move second child to first child ( temp 2-component vector of float) +0:106 vector swizzle ( temp 2-component vector of float) +0:106 f: direct index for structure ( temp 4-component vector of float) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 2 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:106 subgroupQuadSwapHorizontal ( temp 2-component vector of float) +0:106 vector swizzle ( temp 2-component vector of float) +0:106 f: direct index for structure ( temp 4-component vector of float) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 2 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:107 move second child to first child ( temp 3-component vector of float) +0:107 vector swizzle ( temp 3-component vector of float) +0:107 f: direct index for structure ( temp 4-component vector of float) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 subgroupQuadSwapHorizontal ( temp 3-component vector of float) +0:107 vector swizzle ( temp 3-component vector of float) +0:107 f: direct index for structure ( temp 4-component vector of float) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:109 move second child to first child ( temp 4-component vector of double) +0:109 d: direct index for structure ( temp 4-component vector of double) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 3 (const int) +0:109 subgroupQuadSwapHorizontal ( temp 4-component vector of double) +0:109 d: direct index for structure ( temp 4-component vector of double) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 3 (const int) +0:110 move second child to first child ( temp double) +0:110 direct index ( temp double) +0:110 d: direct index for structure ( temp 4-component vector of double) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 3 (const int) +0:110 Constant: +0:110 0 (const int) +0:110 subgroupQuadSwapHorizontal ( temp double) +0:110 direct index ( temp double) +0:110 d: direct index for structure ( temp 4-component vector of double) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 3 (const int) +0:110 Constant: +0:110 0 (const int) +0:111 move second child to first child ( temp 2-component vector of double) +0:111 vector swizzle ( temp 2-component vector of double) +0:111 d: direct index for structure ( temp 4-component vector of double) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 3 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 subgroupQuadSwapHorizontal ( temp 2-component vector of double) +0:111 vector swizzle ( temp 2-component vector of double) +0:111 d: direct index for structure ( temp 4-component vector of double) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 3 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:112 move second child to first child ( temp 3-component vector of double) +0:112 vector swizzle ( temp 3-component vector of double) +0:112 d: direct index for structure ( temp 4-component vector of double) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 3 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:112 subgroupQuadSwapHorizontal ( temp 3-component vector of double) +0:112 vector swizzle ( temp 3-component vector of double) +0:112 d: direct index for structure ( temp 4-component vector of double) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 3 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:114 move second child to first child ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:114 subgroupQuadSwapVertical ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:115 move second child to first child ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 subgroupQuadSwapVertical ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:116 move second child to first child ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:116 subgroupQuadSwapVertical ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:117 move second child to first child ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:117 subgroupQuadSwapVertical ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:119 move second child to first child ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:119 subgroupQuadSwapVertical ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:120 move second child to first child ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:120 subgroupQuadSwapVertical ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:121 move second child to first child ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 subgroupQuadSwapVertical ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:122 move second child to first child ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:122 subgroupQuadSwapVertical ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:124 move second child to first child ( temp 4-component vector of float) +0:124 f: direct index for structure ( temp 4-component vector of float) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 2 (const int) +0:124 subgroupQuadSwapVertical ( temp 4-component vector of float) +0:124 f: direct index for structure ( temp 4-component vector of float) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 2 (const int) +0:125 move second child to first child ( temp float) +0:125 direct index ( temp float) +0:125 f: direct index for structure ( temp 4-component vector of float) +0:125 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:125 Constant: +0:125 0 (const uint) +0:125 direct index ( temp uint) +0:125 'dti' ( in 3-component vector of uint) +0:125 Constant: +0:125 0 (const int) +0:125 Constant: +0:125 2 (const int) +0:125 Constant: +0:125 0 (const int) +0:125 subgroupQuadSwapVertical ( temp float) +0:125 direct index ( temp float) +0:125 f: direct index for structure ( temp 4-component vector of float) +0:125 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:125 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:125 Constant: +0:125 0 (const uint) +0:125 direct index ( temp uint) +0:125 'dti' ( in 3-component vector of uint) +0:125 Constant: +0:125 0 (const int) +0:125 Constant: +0:125 2 (const int) +0:125 Constant: +0:125 0 (const int) +0:126 move second child to first child ( temp 2-component vector of float) +0:126 vector swizzle ( temp 2-component vector of float) +0:126 f: direct index for structure ( temp 4-component vector of float) +0:126 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:126 Constant: +0:126 0 (const uint) +0:126 direct index ( temp uint) +0:126 'dti' ( in 3-component vector of uint) +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 2 (const int) +0:126 Sequence +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 1 (const int) +0:126 subgroupQuadSwapVertical ( temp 2-component vector of float) +0:126 vector swizzle ( temp 2-component vector of float) +0:126 f: direct index for structure ( temp 4-component vector of float) +0:126 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:126 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:126 Constant: +0:126 0 (const uint) +0:126 direct index ( temp uint) +0:126 'dti' ( in 3-component vector of uint) +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 2 (const int) +0:126 Sequence +0:126 Constant: +0:126 0 (const int) +0:126 Constant: +0:126 1 (const int) +0:127 move second child to first child ( temp 3-component vector of float) +0:127 vector swizzle ( temp 3-component vector of float) +0:127 f: direct index for structure ( temp 4-component vector of float) +0:127 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:127 Constant: +0:127 0 (const uint) +0:127 direct index ( temp uint) +0:127 'dti' ( in 3-component vector of uint) +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 2 (const int) +0:127 Sequence +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 1 (const int) +0:127 Constant: +0:127 2 (const int) +0:127 subgroupQuadSwapVertical ( temp 3-component vector of float) +0:127 vector swizzle ( temp 3-component vector of float) +0:127 f: direct index for structure ( temp 4-component vector of float) +0:127 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:127 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:127 Constant: +0:127 0 (const uint) +0:127 direct index ( temp uint) +0:127 'dti' ( in 3-component vector of uint) +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 2 (const int) +0:127 Sequence +0:127 Constant: +0:127 0 (const int) +0:127 Constant: +0:127 1 (const int) +0:127 Constant: +0:127 2 (const int) +0:129 move second child to first child ( temp 4-component vector of double) +0:129 d: direct index for structure ( temp 4-component vector of double) +0:129 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:129 Constant: +0:129 0 (const uint) +0:129 direct index ( temp uint) +0:129 'dti' ( in 3-component vector of uint) +0:129 Constant: +0:129 0 (const int) +0:129 Constant: +0:129 3 (const int) +0:129 subgroupQuadSwapVertical ( temp 4-component vector of double) +0:129 d: direct index for structure ( temp 4-component vector of double) +0:129 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:129 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:129 Constant: +0:129 0 (const uint) +0:129 direct index ( temp uint) +0:129 'dti' ( in 3-component vector of uint) +0:129 Constant: +0:129 0 (const int) +0:129 Constant: +0:129 3 (const int) +0:130 move second child to first child ( temp double) +0:130 direct index ( temp double) +0:130 d: direct index for structure ( temp 4-component vector of double) +0:130 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:130 Constant: +0:130 0 (const uint) +0:130 direct index ( temp uint) +0:130 'dti' ( in 3-component vector of uint) +0:130 Constant: +0:130 0 (const int) +0:130 Constant: +0:130 3 (const int) +0:130 Constant: +0:130 0 (const int) +0:130 subgroupQuadSwapVertical ( temp double) +0:130 direct index ( temp double) +0:130 d: direct index for structure ( temp 4-component vector of double) +0:130 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:130 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:130 Constant: +0:130 0 (const uint) +0:130 direct index ( temp uint) +0:130 'dti' ( in 3-component vector of uint) +0:130 Constant: +0:130 0 (const int) +0:130 Constant: +0:130 3 (const int) +0:130 Constant: +0:130 0 (const int) +0:131 move second child to first child ( temp 2-component vector of double) +0:131 vector swizzle ( temp 2-component vector of double) +0:131 d: direct index for structure ( temp 4-component vector of double) +0:131 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:131 Constant: +0:131 0 (const uint) +0:131 direct index ( temp uint) +0:131 'dti' ( in 3-component vector of uint) +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 3 (const int) +0:131 Sequence +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 1 (const int) +0:131 subgroupQuadSwapVertical ( temp 2-component vector of double) +0:131 vector swizzle ( temp 2-component vector of double) +0:131 d: direct index for structure ( temp 4-component vector of double) +0:131 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:131 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:131 Constant: +0:131 0 (const uint) +0:131 direct index ( temp uint) +0:131 'dti' ( in 3-component vector of uint) +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 3 (const int) +0:131 Sequence +0:131 Constant: +0:131 0 (const int) +0:131 Constant: +0:131 1 (const int) +0:132 move second child to first child ( temp 3-component vector of double) +0:132 vector swizzle ( temp 3-component vector of double) +0:132 d: direct index for structure ( temp 4-component vector of double) +0:132 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:132 Constant: +0:132 0 (const uint) +0:132 direct index ( temp uint) +0:132 'dti' ( in 3-component vector of uint) +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 3 (const int) +0:132 Sequence +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 1 (const int) +0:132 Constant: +0:132 2 (const int) +0:132 subgroupQuadSwapVertical ( temp 3-component vector of double) +0:132 vector swizzle ( temp 3-component vector of double) +0:132 d: direct index for structure ( temp 4-component vector of double) +0:132 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:132 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:132 Constant: +0:132 0 (const uint) +0:132 direct index ( temp uint) +0:132 'dti' ( in 3-component vector of uint) +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 3 (const int) +0:132 Sequence +0:132 Constant: +0:132 0 (const int) +0:132 Constant: +0:132 1 (const int) +0:132 Constant: +0:132 2 (const int) +0:134 move second child to first child ( temp 4-component vector of uint) +0:134 u: direct index for structure ( temp 4-component vector of uint) +0:134 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:134 Constant: +0:134 0 (const uint) +0:134 direct index ( temp uint) +0:134 'dti' ( in 3-component vector of uint) +0:134 Constant: +0:134 0 (const int) +0:134 Constant: +0:134 0 (const int) +0:134 subgroupQuadSwapDiagonal ( temp 4-component vector of uint) +0:134 u: direct index for structure ( temp 4-component vector of uint) +0:134 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:134 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:134 Constant: +0:134 0 (const uint) +0:134 direct index ( temp uint) +0:134 'dti' ( in 3-component vector of uint) +0:134 Constant: +0:134 0 (const int) +0:134 Constant: +0:134 0 (const int) +0:135 move second child to first child ( temp uint) +0:135 direct index ( temp uint) +0:135 u: direct index for structure ( temp 4-component vector of uint) +0:135 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:135 Constant: +0:135 0 (const uint) +0:135 direct index ( temp uint) +0:135 'dti' ( in 3-component vector of uint) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:135 subgroupQuadSwapDiagonal ( temp uint) +0:135 direct index ( temp uint) +0:135 u: direct index for structure ( temp 4-component vector of uint) +0:135 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:135 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:135 Constant: +0:135 0 (const uint) +0:135 direct index ( temp uint) +0:135 'dti' ( in 3-component vector of uint) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:135 Constant: +0:135 0 (const int) +0:136 move second child to first child ( temp 2-component vector of uint) +0:136 vector swizzle ( temp 2-component vector of uint) +0:136 u: direct index for structure ( temp 4-component vector of uint) +0:136 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:136 Constant: +0:136 0 (const uint) +0:136 direct index ( temp uint) +0:136 'dti' ( in 3-component vector of uint) +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 0 (const int) +0:136 Sequence +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 1 (const int) +0:136 subgroupQuadSwapDiagonal ( temp 2-component vector of uint) +0:136 vector swizzle ( temp 2-component vector of uint) +0:136 u: direct index for structure ( temp 4-component vector of uint) +0:136 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:136 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:136 Constant: +0:136 0 (const uint) +0:136 direct index ( temp uint) +0:136 'dti' ( in 3-component vector of uint) +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 0 (const int) +0:136 Sequence +0:136 Constant: +0:136 0 (const int) +0:136 Constant: +0:136 1 (const int) +0:137 move second child to first child ( temp 3-component vector of uint) +0:137 vector swizzle ( temp 3-component vector of uint) +0:137 u: direct index for structure ( temp 4-component vector of uint) +0:137 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:137 Constant: +0:137 0 (const uint) +0:137 direct index ( temp uint) +0:137 'dti' ( in 3-component vector of uint) +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 0 (const int) +0:137 Sequence +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 1 (const int) +0:137 Constant: +0:137 2 (const int) +0:137 subgroupQuadSwapDiagonal ( temp 3-component vector of uint) +0:137 vector swizzle ( temp 3-component vector of uint) +0:137 u: direct index for structure ( temp 4-component vector of uint) +0:137 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:137 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:137 Constant: +0:137 0 (const uint) +0:137 direct index ( temp uint) +0:137 'dti' ( in 3-component vector of uint) +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 0 (const int) +0:137 Sequence +0:137 Constant: +0:137 0 (const int) +0:137 Constant: +0:137 1 (const int) +0:137 Constant: +0:137 2 (const int) +0:139 move second child to first child ( temp 4-component vector of int) +0:139 i: direct index for structure ( temp 4-component vector of int) +0:139 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:139 Constant: +0:139 0 (const uint) +0:139 direct index ( temp uint) +0:139 'dti' ( in 3-component vector of uint) +0:139 Constant: +0:139 0 (const int) +0:139 Constant: +0:139 1 (const int) +0:139 subgroupQuadSwapDiagonal ( temp 4-component vector of int) +0:139 i: direct index for structure ( temp 4-component vector of int) +0:139 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:139 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:139 Constant: +0:139 0 (const uint) +0:139 direct index ( temp uint) +0:139 'dti' ( in 3-component vector of uint) +0:139 Constant: +0:139 0 (const int) +0:139 Constant: +0:139 1 (const int) +0:140 move second child to first child ( temp int) +0:140 direct index ( temp int) +0:140 i: direct index for structure ( temp 4-component vector of int) +0:140 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:140 Constant: +0:140 0 (const uint) +0:140 direct index ( temp uint) +0:140 'dti' ( in 3-component vector of uint) +0:140 Constant: +0:140 0 (const int) +0:140 Constant: +0:140 1 (const int) +0:140 Constant: +0:140 0 (const int) +0:140 subgroupQuadSwapDiagonal ( temp int) +0:140 direct index ( temp int) +0:140 i: direct index for structure ( temp 4-component vector of int) +0:140 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:140 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:140 Constant: +0:140 0 (const uint) +0:140 direct index ( temp uint) +0:140 'dti' ( in 3-component vector of uint) +0:140 Constant: +0:140 0 (const int) +0:140 Constant: +0:140 1 (const int) +0:140 Constant: +0:140 0 (const int) +0:141 move second child to first child ( temp 2-component vector of int) +0:141 vector swizzle ( temp 2-component vector of int) +0:141 i: direct index for structure ( temp 4-component vector of int) +0:141 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:141 Constant: +0:141 0 (const uint) +0:141 direct index ( temp uint) +0:141 'dti' ( in 3-component vector of uint) +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:141 Sequence +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:141 subgroupQuadSwapDiagonal ( temp 2-component vector of int) +0:141 vector swizzle ( temp 2-component vector of int) +0:141 i: direct index for structure ( temp 4-component vector of int) +0:141 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:141 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:141 Constant: +0:141 0 (const uint) +0:141 direct index ( temp uint) +0:141 'dti' ( in 3-component vector of uint) +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:141 Sequence +0:141 Constant: +0:141 0 (const int) +0:141 Constant: +0:141 1 (const int) +0:142 move second child to first child ( temp 3-component vector of int) +0:142 vector swizzle ( temp 3-component vector of int) +0:142 i: direct index for structure ( temp 4-component vector of int) +0:142 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:142 Constant: +0:142 0 (const uint) +0:142 direct index ( temp uint) +0:142 'dti' ( in 3-component vector of uint) +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Sequence +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Constant: +0:142 2 (const int) +0:142 subgroupQuadSwapDiagonal ( temp 3-component vector of int) +0:142 vector swizzle ( temp 3-component vector of int) +0:142 i: direct index for structure ( temp 4-component vector of int) +0:142 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:142 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:142 Constant: +0:142 0 (const uint) +0:142 direct index ( temp uint) +0:142 'dti' ( in 3-component vector of uint) +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Sequence +0:142 Constant: +0:142 0 (const int) +0:142 Constant: +0:142 1 (const int) +0:142 Constant: +0:142 2 (const int) +0:144 move second child to first child ( temp 4-component vector of float) +0:144 f: direct index for structure ( temp 4-component vector of float) +0:144 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:144 Constant: +0:144 0 (const uint) +0:144 direct index ( temp uint) +0:144 'dti' ( in 3-component vector of uint) +0:144 Constant: +0:144 0 (const int) +0:144 Constant: +0:144 2 (const int) +0:144 subgroupQuadSwapDiagonal ( temp 4-component vector of float) +0:144 f: direct index for structure ( temp 4-component vector of float) +0:144 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:144 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:144 Constant: +0:144 0 (const uint) +0:144 direct index ( temp uint) +0:144 'dti' ( in 3-component vector of uint) +0:144 Constant: +0:144 0 (const int) +0:144 Constant: +0:144 2 (const int) +0:145 move second child to first child ( temp float) +0:145 direct index ( temp float) +0:145 f: direct index for structure ( temp 4-component vector of float) +0:145 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:145 Constant: +0:145 0 (const uint) +0:145 direct index ( temp uint) +0:145 'dti' ( in 3-component vector of uint) +0:145 Constant: +0:145 0 (const int) +0:145 Constant: +0:145 2 (const int) +0:145 Constant: +0:145 0 (const int) +0:145 subgroupQuadSwapDiagonal ( temp float) +0:145 direct index ( temp float) +0:145 f: direct index for structure ( temp 4-component vector of float) +0:145 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:145 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:145 Constant: +0:145 0 (const uint) +0:145 direct index ( temp uint) +0:145 'dti' ( in 3-component vector of uint) +0:145 Constant: +0:145 0 (const int) +0:145 Constant: +0:145 2 (const int) +0:145 Constant: +0:145 0 (const int) +0:146 move second child to first child ( temp 2-component vector of float) +0:146 vector swizzle ( temp 2-component vector of float) +0:146 f: direct index for structure ( temp 4-component vector of float) +0:146 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:146 Constant: +0:146 0 (const uint) +0:146 direct index ( temp uint) +0:146 'dti' ( in 3-component vector of uint) +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 2 (const int) +0:146 Sequence +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 1 (const int) +0:146 subgroupQuadSwapDiagonal ( temp 2-component vector of float) +0:146 vector swizzle ( temp 2-component vector of float) +0:146 f: direct index for structure ( temp 4-component vector of float) +0:146 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:146 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:146 Constant: +0:146 0 (const uint) +0:146 direct index ( temp uint) +0:146 'dti' ( in 3-component vector of uint) +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 2 (const int) +0:146 Sequence +0:146 Constant: +0:146 0 (const int) +0:146 Constant: +0:146 1 (const int) +0:147 move second child to first child ( temp 3-component vector of float) +0:147 vector swizzle ( temp 3-component vector of float) +0:147 f: direct index for structure ( temp 4-component vector of float) +0:147 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:147 Constant: +0:147 0 (const uint) +0:147 direct index ( temp uint) +0:147 'dti' ( in 3-component vector of uint) +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 2 (const int) +0:147 Sequence +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 1 (const int) +0:147 Constant: +0:147 2 (const int) +0:147 subgroupQuadSwapDiagonal ( temp 3-component vector of float) +0:147 vector swizzle ( temp 3-component vector of float) +0:147 f: direct index for structure ( temp 4-component vector of float) +0:147 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:147 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:147 Constant: +0:147 0 (const uint) +0:147 direct index ( temp uint) +0:147 'dti' ( in 3-component vector of uint) +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 2 (const int) +0:147 Sequence +0:147 Constant: +0:147 0 (const int) +0:147 Constant: +0:147 1 (const int) +0:147 Constant: +0:147 2 (const int) +0:149 move second child to first child ( temp 4-component vector of double) +0:149 d: direct index for structure ( temp 4-component vector of double) +0:149 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:149 Constant: +0:149 0 (const uint) +0:149 direct index ( temp uint) +0:149 'dti' ( in 3-component vector of uint) +0:149 Constant: +0:149 0 (const int) +0:149 Constant: +0:149 3 (const int) +0:149 subgroupQuadSwapDiagonal ( temp 4-component vector of double) +0:149 d: direct index for structure ( temp 4-component vector of double) +0:149 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:149 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:149 Constant: +0:149 0 (const uint) +0:149 direct index ( temp uint) +0:149 'dti' ( in 3-component vector of uint) +0:149 Constant: +0:149 0 (const int) +0:149 Constant: +0:149 3 (const int) +0:150 move second child to first child ( temp double) +0:150 direct index ( temp double) +0:150 d: direct index for structure ( temp 4-component vector of double) +0:150 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:150 Constant: +0:150 0 (const uint) +0:150 direct index ( temp uint) +0:150 'dti' ( in 3-component vector of uint) +0:150 Constant: +0:150 0 (const int) +0:150 Constant: +0:150 3 (const int) +0:150 Constant: +0:150 0 (const int) +0:150 subgroupQuadSwapDiagonal ( temp double) +0:150 direct index ( temp double) +0:150 d: direct index for structure ( temp 4-component vector of double) +0:150 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:150 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:150 Constant: +0:150 0 (const uint) +0:150 direct index ( temp uint) +0:150 'dti' ( in 3-component vector of uint) +0:150 Constant: +0:150 0 (const int) +0:150 Constant: +0:150 3 (const int) +0:150 Constant: +0:150 0 (const int) +0:151 move second child to first child ( temp 2-component vector of double) +0:151 vector swizzle ( temp 2-component vector of double) +0:151 d: direct index for structure ( temp 4-component vector of double) +0:151 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:151 Constant: +0:151 0 (const uint) +0:151 direct index ( temp uint) +0:151 'dti' ( in 3-component vector of uint) +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 3 (const int) +0:151 Sequence +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 1 (const int) +0:151 subgroupQuadSwapDiagonal ( temp 2-component vector of double) +0:151 vector swizzle ( temp 2-component vector of double) +0:151 d: direct index for structure ( temp 4-component vector of double) +0:151 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:151 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:151 Constant: +0:151 0 (const uint) +0:151 direct index ( temp uint) +0:151 'dti' ( in 3-component vector of uint) +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 3 (const int) +0:151 Sequence +0:151 Constant: +0:151 0 (const int) +0:151 Constant: +0:151 1 (const int) +0:152 move second child to first child ( temp 3-component vector of double) +0:152 vector swizzle ( temp 3-component vector of double) +0:152 d: direct index for structure ( temp 4-component vector of double) +0:152 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:152 Constant: +0:152 0 (const uint) +0:152 direct index ( temp uint) +0:152 'dti' ( in 3-component vector of uint) +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 3 (const int) +0:152 Sequence +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 1 (const int) +0:152 Constant: +0:152 2 (const int) +0:152 subgroupQuadSwapDiagonal ( temp 3-component vector of double) +0:152 vector swizzle ( temp 3-component vector of double) +0:152 d: direct index for structure ( temp 4-component vector of double) +0:152 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:152 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:152 Constant: +0:152 0 (const uint) +0:152 direct index ( temp uint) +0:152 'dti' ( in 3-component vector of uint) +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 3 (const int) +0:152 Sequence +0:152 Constant: +0:152 0 (const int) +0:152 Constant: +0:152 1 (const int) +0:152 Constant: +0:152 2 (const int) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 1120 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformQuad + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "CSMain" 1115 + ExecutionMode 4 LocalSize 32 16 1 + Source HLSL 500 + Name 4 "CSMain" + Name 11 "@CSMain(vu3;" + Name 10 "dti" + Name 20 "Types" + MemberName 20(Types) 0 "u" + MemberName 20(Types) 1 "i" + MemberName 20(Types) 2 "f" + MemberName 20(Types) 3 "d" + Name 22 "data" + MemberName 22(data) 0 "@data" + Name 24 "data" + Name 1113 "dti" + Name 1115 "dti" + Name 1117 "param" + MemberDecorate 20(Types) 0 Offset 0 + MemberDecorate 20(Types) 1 Offset 16 + MemberDecorate 20(Types) 2 Offset 32 + MemberDecorate 20(Types) 3 Offset 64 + Decorate 21 ArrayStride 96 + MemberDecorate 22(data) 0 Offset 0 + Decorate 22(data) BufferBlock + Decorate 24(data) DescriptorSet 0 + Decorate 1115(dti) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: TypeVector 6(int) 4 + 14: TypeInt 32 1 + 15: TypeVector 14(int) 4 + 16: TypeFloat 32 + 17: TypeVector 16(float) 4 + 18: TypeFloat 64 + 19: TypeVector 18(float64_t) 4 + 20(Types): TypeStruct 13(ivec4) 15(ivec4) 17(fvec4) 19(f64vec4) + 21: TypeRuntimeArray 20(Types) + 22(data): TypeStruct 21 + 23: TypePointer Uniform 22(data) + 24(data): 23(ptr) Variable Uniform + 25: 14(int) Constant 0 + 26: 6(int) Constant 0 + 27: TypePointer Function 6(int) + 32: TypePointer Uniform 13(ivec4) + 35: 6(int) Constant 3 + 42: TypePointer Uniform 6(int) + 51: TypeVector 6(int) 2 + 72: 14(int) Constant 1 + 75: TypePointer Uniform 15(ivec4) + 84: TypePointer Uniform 14(int) + 93: TypeVector 14(int) 2 + 105: TypeVector 14(int) 3 + 115: 14(int) Constant 2 + 118: TypePointer Uniform 17(fvec4) + 127: TypePointer Uniform 16(float) + 136: TypeVector 16(float) 2 + 148: TypeVector 16(float) 3 + 158: 14(int) Constant 3 + 161: TypePointer Uniform 19(f64vec4) + 170: TypePointer Uniform 18(float64_t) + 179: TypeVector 18(float64_t) 2 + 191: TypeVector 18(float64_t) 3 + 205: 6(int) Constant 1 + 358: 6(int) Constant 2 + 1114: TypePointer Input 7(ivec3) + 1115(dti): 1114(ptr) Variable Input + 4(CSMain): 2 Function None 3 + 5: Label + 1113(dti): 8(ptr) Variable Function + 1117(param): 8(ptr) Variable Function + 1116: 7(ivec3) Load 1115(dti) + Store 1113(dti) 1116 + 1118: 7(ivec3) Load 1113(dti) + Store 1117(param) 1118 + 1119: 2 FunctionCall 11(@CSMain(vu3;) 1117(param) + Return + FunctionEnd +11(@CSMain(vu3;): 2 Function None 9 + 10(dti): 8(ptr) FunctionParameter + 12: Label + 28: 27(ptr) AccessChain 10(dti) 26 + 29: 6(int) Load 28 + 30: 27(ptr) AccessChain 10(dti) 26 + 31: 6(int) Load 30 + 33: 32(ptr) AccessChain 24(data) 25 31 25 + 34: 13(ivec4) Load 33 + 36: 13(ivec4) GroupNonUniformQuadBroadcast 35 34 26 + 37: 32(ptr) AccessChain 24(data) 25 29 25 + Store 37 36 + 38: 27(ptr) AccessChain 10(dti) 26 + 39: 6(int) Load 38 + 40: 27(ptr) AccessChain 10(dti) 26 + 41: 6(int) Load 40 + 43: 42(ptr) AccessChain 24(data) 25 41 25 26 + 44: 6(int) Load 43 + 45: 6(int) GroupNonUniformQuadBroadcast 35 44 26 + 46: 42(ptr) AccessChain 24(data) 25 39 25 26 + Store 46 45 + 47: 27(ptr) AccessChain 10(dti) 26 + 48: 6(int) Load 47 + 49: 27(ptr) AccessChain 10(dti) 26 + 50: 6(int) Load 49 + 52: 32(ptr) AccessChain 24(data) 25 50 25 + 53: 13(ivec4) Load 52 + 54: 51(ivec2) VectorShuffle 53 53 0 1 + 55: 51(ivec2) GroupNonUniformQuadBroadcast 35 54 26 + 56: 32(ptr) AccessChain 24(data) 25 48 25 + 57: 13(ivec4) Load 56 + 58: 13(ivec4) VectorShuffle 57 55 4 5 2 3 + Store 56 58 + 59: 27(ptr) AccessChain 10(dti) 26 + 60: 6(int) Load 59 + 61: 27(ptr) AccessChain 10(dti) 26 + 62: 6(int) Load 61 + 63: 32(ptr) AccessChain 24(data) 25 62 25 + 64: 13(ivec4) Load 63 + 65: 7(ivec3) VectorShuffle 64 64 0 1 2 + 66: 7(ivec3) GroupNonUniformQuadBroadcast 35 65 26 + 67: 32(ptr) AccessChain 24(data) 25 60 25 + 68: 13(ivec4) Load 67 + 69: 13(ivec4) VectorShuffle 68 66 4 5 6 3 + Store 67 69 + 70: 27(ptr) AccessChain 10(dti) 26 + 71: 6(int) Load 70 + 73: 27(ptr) AccessChain 10(dti) 26 + 74: 6(int) Load 73 + 76: 75(ptr) AccessChain 24(data) 25 74 72 + 77: 15(ivec4) Load 76 + 78: 15(ivec4) GroupNonUniformQuadBroadcast 35 77 26 + 79: 75(ptr) AccessChain 24(data) 25 71 72 + Store 79 78 + 80: 27(ptr) AccessChain 10(dti) 26 + 81: 6(int) Load 80 + 82: 27(ptr) AccessChain 10(dti) 26 + 83: 6(int) Load 82 + 85: 84(ptr) AccessChain 24(data) 25 83 72 26 + 86: 14(int) Load 85 + 87: 14(int) GroupNonUniformQuadBroadcast 35 86 26 + 88: 84(ptr) AccessChain 24(data) 25 81 72 26 + Store 88 87 + 89: 27(ptr) AccessChain 10(dti) 26 + 90: 6(int) Load 89 + 91: 27(ptr) AccessChain 10(dti) 26 + 92: 6(int) Load 91 + 94: 75(ptr) AccessChain 24(data) 25 92 72 + 95: 15(ivec4) Load 94 + 96: 93(ivec2) VectorShuffle 95 95 0 1 + 97: 93(ivec2) GroupNonUniformQuadBroadcast 35 96 26 + 98: 75(ptr) AccessChain 24(data) 25 90 72 + 99: 15(ivec4) Load 98 + 100: 15(ivec4) VectorShuffle 99 97 4 5 2 3 + Store 98 100 + 101: 27(ptr) AccessChain 10(dti) 26 + 102: 6(int) Load 101 + 103: 27(ptr) AccessChain 10(dti) 26 + 104: 6(int) Load 103 + 106: 75(ptr) AccessChain 24(data) 25 104 72 + 107: 15(ivec4) Load 106 + 108: 105(ivec3) VectorShuffle 107 107 0 1 2 + 109: 105(ivec3) GroupNonUniformQuadBroadcast 35 108 26 + 110: 75(ptr) AccessChain 24(data) 25 102 72 + 111: 15(ivec4) Load 110 + 112: 15(ivec4) VectorShuffle 111 109 4 5 6 3 + Store 110 112 + 113: 27(ptr) AccessChain 10(dti) 26 + 114: 6(int) Load 113 + 116: 27(ptr) AccessChain 10(dti) 26 + 117: 6(int) Load 116 + 119: 118(ptr) AccessChain 24(data) 25 117 115 + 120: 17(fvec4) Load 119 + 121: 17(fvec4) GroupNonUniformQuadBroadcast 35 120 26 + 122: 118(ptr) AccessChain 24(data) 25 114 115 + Store 122 121 + 123: 27(ptr) AccessChain 10(dti) 26 + 124: 6(int) Load 123 + 125: 27(ptr) AccessChain 10(dti) 26 + 126: 6(int) Load 125 + 128: 127(ptr) AccessChain 24(data) 25 126 115 26 + 129: 16(float) Load 128 + 130: 16(float) GroupNonUniformQuadBroadcast 35 129 26 + 131: 127(ptr) AccessChain 24(data) 25 124 115 26 + Store 131 130 + 132: 27(ptr) AccessChain 10(dti) 26 + 133: 6(int) Load 132 + 134: 27(ptr) AccessChain 10(dti) 26 + 135: 6(int) Load 134 + 137: 118(ptr) AccessChain 24(data) 25 135 115 + 138: 17(fvec4) Load 137 + 139: 136(fvec2) VectorShuffle 138 138 0 1 + 140: 136(fvec2) GroupNonUniformQuadBroadcast 35 139 26 + 141: 118(ptr) AccessChain 24(data) 25 133 115 + 142: 17(fvec4) Load 141 + 143: 17(fvec4) VectorShuffle 142 140 4 5 2 3 + Store 141 143 + 144: 27(ptr) AccessChain 10(dti) 26 + 145: 6(int) Load 144 + 146: 27(ptr) AccessChain 10(dti) 26 + 147: 6(int) Load 146 + 149: 118(ptr) AccessChain 24(data) 25 147 115 + 150: 17(fvec4) Load 149 + 151: 148(fvec3) VectorShuffle 150 150 0 1 2 + 152: 148(fvec3) GroupNonUniformQuadBroadcast 35 151 26 + 153: 118(ptr) AccessChain 24(data) 25 145 115 + 154: 17(fvec4) Load 153 + 155: 17(fvec4) VectorShuffle 154 152 4 5 6 3 + Store 153 155 + 156: 27(ptr) AccessChain 10(dti) 26 + 157: 6(int) Load 156 + 159: 27(ptr) AccessChain 10(dti) 26 + 160: 6(int) Load 159 + 162: 161(ptr) AccessChain 24(data) 25 160 158 + 163: 19(f64vec4) Load 162 + 164: 19(f64vec4) GroupNonUniformQuadBroadcast 35 163 26 + 165: 161(ptr) AccessChain 24(data) 25 157 158 + Store 165 164 + 166: 27(ptr) AccessChain 10(dti) 26 + 167: 6(int) Load 166 + 168: 27(ptr) AccessChain 10(dti) 26 + 169: 6(int) Load 168 + 171: 170(ptr) AccessChain 24(data) 25 169 158 26 + 172:18(float64_t) Load 171 + 173:18(float64_t) GroupNonUniformQuadBroadcast 35 172 26 + 174: 170(ptr) AccessChain 24(data) 25 167 158 26 + Store 174 173 + 175: 27(ptr) AccessChain 10(dti) 26 + 176: 6(int) Load 175 + 177: 27(ptr) AccessChain 10(dti) 26 + 178: 6(int) Load 177 + 180: 161(ptr) AccessChain 24(data) 25 178 158 + 181: 19(f64vec4) Load 180 + 182:179(f64vec2) VectorShuffle 181 181 0 1 + 183:179(f64vec2) GroupNonUniformQuadBroadcast 35 182 26 + 184: 161(ptr) AccessChain 24(data) 25 176 158 + 185: 19(f64vec4) Load 184 + 186: 19(f64vec4) VectorShuffle 185 183 4 5 2 3 + Store 184 186 + 187: 27(ptr) AccessChain 10(dti) 26 + 188: 6(int) Load 187 + 189: 27(ptr) AccessChain 10(dti) 26 + 190: 6(int) Load 189 + 192: 161(ptr) AccessChain 24(data) 25 190 158 + 193: 19(f64vec4) Load 192 + 194:191(f64vec3) VectorShuffle 193 193 0 1 2 + 195:191(f64vec3) GroupNonUniformQuadBroadcast 35 194 26 + 196: 161(ptr) AccessChain 24(data) 25 188 158 + 197: 19(f64vec4) Load 196 + 198: 19(f64vec4) VectorShuffle 197 195 4 5 6 3 + Store 196 198 + 199: 27(ptr) AccessChain 10(dti) 26 + 200: 6(int) Load 199 + 201: 27(ptr) AccessChain 10(dti) 26 + 202: 6(int) Load 201 + 203: 32(ptr) AccessChain 24(data) 25 202 25 + 204: 13(ivec4) Load 203 + 206: 13(ivec4) GroupNonUniformQuadBroadcast 35 204 205 + 207: 32(ptr) AccessChain 24(data) 25 200 25 + Store 207 206 + 208: 27(ptr) AccessChain 10(dti) 26 + 209: 6(int) Load 208 + 210: 27(ptr) AccessChain 10(dti) 26 + 211: 6(int) Load 210 + 212: 42(ptr) AccessChain 24(data) 25 211 25 26 + 213: 6(int) Load 212 + 214: 6(int) GroupNonUniformQuadBroadcast 35 213 205 + 215: 42(ptr) AccessChain 24(data) 25 209 25 26 + Store 215 214 + 216: 27(ptr) AccessChain 10(dti) 26 + 217: 6(int) Load 216 + 218: 27(ptr) AccessChain 10(dti) 26 + 219: 6(int) Load 218 + 220: 32(ptr) AccessChain 24(data) 25 219 25 + 221: 13(ivec4) Load 220 + 222: 51(ivec2) VectorShuffle 221 221 0 1 + 223: 51(ivec2) GroupNonUniformQuadBroadcast 35 222 205 + 224: 32(ptr) AccessChain 24(data) 25 217 25 + 225: 13(ivec4) Load 224 + 226: 13(ivec4) VectorShuffle 225 223 4 5 2 3 + Store 224 226 + 227: 27(ptr) AccessChain 10(dti) 26 + 228: 6(int) Load 227 + 229: 27(ptr) AccessChain 10(dti) 26 + 230: 6(int) Load 229 + 231: 32(ptr) AccessChain 24(data) 25 230 25 + 232: 13(ivec4) Load 231 + 233: 7(ivec3) VectorShuffle 232 232 0 1 2 + 234: 7(ivec3) GroupNonUniformQuadBroadcast 35 233 205 + 235: 32(ptr) AccessChain 24(data) 25 228 25 + 236: 13(ivec4) Load 235 + 237: 13(ivec4) VectorShuffle 236 234 4 5 6 3 + Store 235 237 + 238: 27(ptr) AccessChain 10(dti) 26 + 239: 6(int) Load 238 + 240: 27(ptr) AccessChain 10(dti) 26 + 241: 6(int) Load 240 + 242: 75(ptr) AccessChain 24(data) 25 241 72 + 243: 15(ivec4) Load 242 + 244: 15(ivec4) GroupNonUniformQuadBroadcast 35 243 205 + 245: 75(ptr) AccessChain 24(data) 25 239 72 + Store 245 244 + 246: 27(ptr) AccessChain 10(dti) 26 + 247: 6(int) Load 246 + 248: 27(ptr) AccessChain 10(dti) 26 + 249: 6(int) Load 248 + 250: 84(ptr) AccessChain 24(data) 25 249 72 26 + 251: 14(int) Load 250 + 252: 14(int) GroupNonUniformQuadBroadcast 35 251 205 + 253: 84(ptr) AccessChain 24(data) 25 247 72 26 + Store 253 252 + 254: 27(ptr) AccessChain 10(dti) 26 + 255: 6(int) Load 254 + 256: 27(ptr) AccessChain 10(dti) 26 + 257: 6(int) Load 256 + 258: 75(ptr) AccessChain 24(data) 25 257 72 + 259: 15(ivec4) Load 258 + 260: 93(ivec2) VectorShuffle 259 259 0 1 + 261: 93(ivec2) GroupNonUniformQuadBroadcast 35 260 205 + 262: 75(ptr) AccessChain 24(data) 25 255 72 + 263: 15(ivec4) Load 262 + 264: 15(ivec4) VectorShuffle 263 261 4 5 2 3 + Store 262 264 + 265: 27(ptr) AccessChain 10(dti) 26 + 266: 6(int) Load 265 + 267: 27(ptr) AccessChain 10(dti) 26 + 268: 6(int) Load 267 + 269: 75(ptr) AccessChain 24(data) 25 268 72 + 270: 15(ivec4) Load 269 + 271: 105(ivec3) VectorShuffle 270 270 0 1 2 + 272: 105(ivec3) GroupNonUniformQuadBroadcast 35 271 205 + 273: 75(ptr) AccessChain 24(data) 25 266 72 + 274: 15(ivec4) Load 273 + 275: 15(ivec4) VectorShuffle 274 272 4 5 6 3 + Store 273 275 + 276: 27(ptr) AccessChain 10(dti) 26 + 277: 6(int) Load 276 + 278: 27(ptr) AccessChain 10(dti) 26 + 279: 6(int) Load 278 + 280: 118(ptr) AccessChain 24(data) 25 279 115 + 281: 17(fvec4) Load 280 + 282: 17(fvec4) GroupNonUniformQuadBroadcast 35 281 205 + 283: 118(ptr) AccessChain 24(data) 25 277 115 + Store 283 282 + 284: 27(ptr) AccessChain 10(dti) 26 + 285: 6(int) Load 284 + 286: 27(ptr) AccessChain 10(dti) 26 + 287: 6(int) Load 286 + 288: 127(ptr) AccessChain 24(data) 25 287 115 26 + 289: 16(float) Load 288 + 290: 16(float) GroupNonUniformQuadBroadcast 35 289 205 + 291: 127(ptr) AccessChain 24(data) 25 285 115 26 + Store 291 290 + 292: 27(ptr) AccessChain 10(dti) 26 + 293: 6(int) Load 292 + 294: 27(ptr) AccessChain 10(dti) 26 + 295: 6(int) Load 294 + 296: 118(ptr) AccessChain 24(data) 25 295 115 + 297: 17(fvec4) Load 296 + 298: 136(fvec2) VectorShuffle 297 297 0 1 + 299: 136(fvec2) GroupNonUniformQuadBroadcast 35 298 205 + 300: 118(ptr) AccessChain 24(data) 25 293 115 + 301: 17(fvec4) Load 300 + 302: 17(fvec4) VectorShuffle 301 299 4 5 2 3 + Store 300 302 + 303: 27(ptr) AccessChain 10(dti) 26 + 304: 6(int) Load 303 + 305: 27(ptr) AccessChain 10(dti) 26 + 306: 6(int) Load 305 + 307: 118(ptr) AccessChain 24(data) 25 306 115 + 308: 17(fvec4) Load 307 + 309: 148(fvec3) VectorShuffle 308 308 0 1 2 + 310: 148(fvec3) GroupNonUniformQuadBroadcast 35 309 205 + 311: 118(ptr) AccessChain 24(data) 25 304 115 + 312: 17(fvec4) Load 311 + 313: 17(fvec4) VectorShuffle 312 310 4 5 6 3 + Store 311 313 + 314: 27(ptr) AccessChain 10(dti) 26 + 315: 6(int) Load 314 + 316: 27(ptr) AccessChain 10(dti) 26 + 317: 6(int) Load 316 + 318: 161(ptr) AccessChain 24(data) 25 317 158 + 319: 19(f64vec4) Load 318 + 320: 19(f64vec4) GroupNonUniformQuadBroadcast 35 319 205 + 321: 161(ptr) AccessChain 24(data) 25 315 158 + Store 321 320 + 322: 27(ptr) AccessChain 10(dti) 26 + 323: 6(int) Load 322 + 324: 27(ptr) AccessChain 10(dti) 26 + 325: 6(int) Load 324 + 326: 170(ptr) AccessChain 24(data) 25 325 158 26 + 327:18(float64_t) Load 326 + 328:18(float64_t) GroupNonUniformQuadBroadcast 35 327 205 + 329: 170(ptr) AccessChain 24(data) 25 323 158 26 + Store 329 328 + 330: 27(ptr) AccessChain 10(dti) 26 + 331: 6(int) Load 330 + 332: 27(ptr) AccessChain 10(dti) 26 + 333: 6(int) Load 332 + 334: 161(ptr) AccessChain 24(data) 25 333 158 + 335: 19(f64vec4) Load 334 + 336:179(f64vec2) VectorShuffle 335 335 0 1 + 337:179(f64vec2) GroupNonUniformQuadBroadcast 35 336 205 + 338: 161(ptr) AccessChain 24(data) 25 331 158 + 339: 19(f64vec4) Load 338 + 340: 19(f64vec4) VectorShuffle 339 337 4 5 2 3 + Store 338 340 + 341: 27(ptr) AccessChain 10(dti) 26 + 342: 6(int) Load 341 + 343: 27(ptr) AccessChain 10(dti) 26 + 344: 6(int) Load 343 + 345: 161(ptr) AccessChain 24(data) 25 344 158 + 346: 19(f64vec4) Load 345 + 347:191(f64vec3) VectorShuffle 346 346 0 1 2 + 348:191(f64vec3) GroupNonUniformQuadBroadcast 35 347 205 + 349: 161(ptr) AccessChain 24(data) 25 342 158 + 350: 19(f64vec4) Load 349 + 351: 19(f64vec4) VectorShuffle 350 348 4 5 6 3 + Store 349 351 + 352: 27(ptr) AccessChain 10(dti) 26 + 353: 6(int) Load 352 + 354: 27(ptr) AccessChain 10(dti) 26 + 355: 6(int) Load 354 + 356: 32(ptr) AccessChain 24(data) 25 355 25 + 357: 13(ivec4) Load 356 + 359: 13(ivec4) GroupNonUniformQuadBroadcast 35 357 358 + 360: 32(ptr) AccessChain 24(data) 25 353 25 + Store 360 359 + 361: 27(ptr) AccessChain 10(dti) 26 + 362: 6(int) Load 361 + 363: 27(ptr) AccessChain 10(dti) 26 + 364: 6(int) Load 363 + 365: 42(ptr) AccessChain 24(data) 25 364 25 26 + 366: 6(int) Load 365 + 367: 6(int) GroupNonUniformQuadBroadcast 35 366 358 + 368: 42(ptr) AccessChain 24(data) 25 362 25 26 + Store 368 367 + 369: 27(ptr) AccessChain 10(dti) 26 + 370: 6(int) Load 369 + 371: 27(ptr) AccessChain 10(dti) 26 + 372: 6(int) Load 371 + 373: 32(ptr) AccessChain 24(data) 25 372 25 + 374: 13(ivec4) Load 373 + 375: 51(ivec2) VectorShuffle 374 374 0 1 + 376: 51(ivec2) GroupNonUniformQuadBroadcast 35 375 358 + 377: 32(ptr) AccessChain 24(data) 25 370 25 + 378: 13(ivec4) Load 377 + 379: 13(ivec4) VectorShuffle 378 376 4 5 2 3 + Store 377 379 + 380: 27(ptr) AccessChain 10(dti) 26 + 381: 6(int) Load 380 + 382: 27(ptr) AccessChain 10(dti) 26 + 383: 6(int) Load 382 + 384: 32(ptr) AccessChain 24(data) 25 383 25 + 385: 13(ivec4) Load 384 + 386: 7(ivec3) VectorShuffle 385 385 0 1 2 + 387: 7(ivec3) GroupNonUniformQuadBroadcast 35 386 358 + 388: 32(ptr) AccessChain 24(data) 25 381 25 + 389: 13(ivec4) Load 388 + 390: 13(ivec4) VectorShuffle 389 387 4 5 6 3 + Store 388 390 + 391: 27(ptr) AccessChain 10(dti) 26 + 392: 6(int) Load 391 + 393: 27(ptr) AccessChain 10(dti) 26 + 394: 6(int) Load 393 + 395: 75(ptr) AccessChain 24(data) 25 394 72 + 396: 15(ivec4) Load 395 + 397: 15(ivec4) GroupNonUniformQuadBroadcast 35 396 358 + 398: 75(ptr) AccessChain 24(data) 25 392 72 + Store 398 397 + 399: 27(ptr) AccessChain 10(dti) 26 + 400: 6(int) Load 399 + 401: 27(ptr) AccessChain 10(dti) 26 + 402: 6(int) Load 401 + 403: 84(ptr) AccessChain 24(data) 25 402 72 26 + 404: 14(int) Load 403 + 405: 14(int) GroupNonUniformQuadBroadcast 35 404 358 + 406: 84(ptr) AccessChain 24(data) 25 400 72 26 + Store 406 405 + 407: 27(ptr) AccessChain 10(dti) 26 + 408: 6(int) Load 407 + 409: 27(ptr) AccessChain 10(dti) 26 + 410: 6(int) Load 409 + 411: 75(ptr) AccessChain 24(data) 25 410 72 + 412: 15(ivec4) Load 411 + 413: 93(ivec2) VectorShuffle 412 412 0 1 + 414: 93(ivec2) GroupNonUniformQuadBroadcast 35 413 358 + 415: 75(ptr) AccessChain 24(data) 25 408 72 + 416: 15(ivec4) Load 415 + 417: 15(ivec4) VectorShuffle 416 414 4 5 2 3 + Store 415 417 + 418: 27(ptr) AccessChain 10(dti) 26 + 419: 6(int) Load 418 + 420: 27(ptr) AccessChain 10(dti) 26 + 421: 6(int) Load 420 + 422: 75(ptr) AccessChain 24(data) 25 421 72 + 423: 15(ivec4) Load 422 + 424: 105(ivec3) VectorShuffle 423 423 0 1 2 + 425: 105(ivec3) GroupNonUniformQuadBroadcast 35 424 358 + 426: 75(ptr) AccessChain 24(data) 25 419 72 + 427: 15(ivec4) Load 426 + 428: 15(ivec4) VectorShuffle 427 425 4 5 6 3 + Store 426 428 + 429: 27(ptr) AccessChain 10(dti) 26 + 430: 6(int) Load 429 + 431: 27(ptr) AccessChain 10(dti) 26 + 432: 6(int) Load 431 + 433: 118(ptr) AccessChain 24(data) 25 432 115 + 434: 17(fvec4) Load 433 + 435: 17(fvec4) GroupNonUniformQuadBroadcast 35 434 358 + 436: 118(ptr) AccessChain 24(data) 25 430 115 + Store 436 435 + 437: 27(ptr) AccessChain 10(dti) 26 + 438: 6(int) Load 437 + 439: 27(ptr) AccessChain 10(dti) 26 + 440: 6(int) Load 439 + 441: 127(ptr) AccessChain 24(data) 25 440 115 26 + 442: 16(float) Load 441 + 443: 16(float) GroupNonUniformQuadBroadcast 35 442 358 + 444: 127(ptr) AccessChain 24(data) 25 438 115 26 + Store 444 443 + 445: 27(ptr) AccessChain 10(dti) 26 + 446: 6(int) Load 445 + 447: 27(ptr) AccessChain 10(dti) 26 + 448: 6(int) Load 447 + 449: 118(ptr) AccessChain 24(data) 25 448 115 + 450: 17(fvec4) Load 449 + 451: 136(fvec2) VectorShuffle 450 450 0 1 + 452: 136(fvec2) GroupNonUniformQuadBroadcast 35 451 358 + 453: 118(ptr) AccessChain 24(data) 25 446 115 + 454: 17(fvec4) Load 453 + 455: 17(fvec4) VectorShuffle 454 452 4 5 2 3 + Store 453 455 + 456: 27(ptr) AccessChain 10(dti) 26 + 457: 6(int) Load 456 + 458: 27(ptr) AccessChain 10(dti) 26 + 459: 6(int) Load 458 + 460: 118(ptr) AccessChain 24(data) 25 459 115 + 461: 17(fvec4) Load 460 + 462: 148(fvec3) VectorShuffle 461 461 0 1 2 + 463: 148(fvec3) GroupNonUniformQuadBroadcast 35 462 358 + 464: 118(ptr) AccessChain 24(data) 25 457 115 + 465: 17(fvec4) Load 464 + 466: 17(fvec4) VectorShuffle 465 463 4 5 6 3 + Store 464 466 + 467: 27(ptr) AccessChain 10(dti) 26 + 468: 6(int) Load 467 + 469: 27(ptr) AccessChain 10(dti) 26 + 470: 6(int) Load 469 + 471: 161(ptr) AccessChain 24(data) 25 470 158 + 472: 19(f64vec4) Load 471 + 473: 19(f64vec4) GroupNonUniformQuadBroadcast 35 472 358 + 474: 161(ptr) AccessChain 24(data) 25 468 158 + Store 474 473 + 475: 27(ptr) AccessChain 10(dti) 26 + 476: 6(int) Load 475 + 477: 27(ptr) AccessChain 10(dti) 26 + 478: 6(int) Load 477 + 479: 170(ptr) AccessChain 24(data) 25 478 158 26 + 480:18(float64_t) Load 479 + 481:18(float64_t) GroupNonUniformQuadBroadcast 35 480 358 + 482: 170(ptr) AccessChain 24(data) 25 476 158 26 + Store 482 481 + 483: 27(ptr) AccessChain 10(dti) 26 + 484: 6(int) Load 483 + 485: 27(ptr) AccessChain 10(dti) 26 + 486: 6(int) Load 485 + 487: 161(ptr) AccessChain 24(data) 25 486 158 + 488: 19(f64vec4) Load 487 + 489:179(f64vec2) VectorShuffle 488 488 0 1 + 490:179(f64vec2) GroupNonUniformQuadBroadcast 35 489 358 + 491: 161(ptr) AccessChain 24(data) 25 484 158 + 492: 19(f64vec4) Load 491 + 493: 19(f64vec4) VectorShuffle 492 490 4 5 2 3 + Store 491 493 + 494: 27(ptr) AccessChain 10(dti) 26 + 495: 6(int) Load 494 + 496: 27(ptr) AccessChain 10(dti) 26 + 497: 6(int) Load 496 + 498: 161(ptr) AccessChain 24(data) 25 497 158 + 499: 19(f64vec4) Load 498 + 500:191(f64vec3) VectorShuffle 499 499 0 1 2 + 501:191(f64vec3) GroupNonUniformQuadBroadcast 35 500 358 + 502: 161(ptr) AccessChain 24(data) 25 495 158 + 503: 19(f64vec4) Load 502 + 504: 19(f64vec4) VectorShuffle 503 501 4 5 6 3 + Store 502 504 + 505: 27(ptr) AccessChain 10(dti) 26 + 506: 6(int) Load 505 + 507: 27(ptr) AccessChain 10(dti) 26 + 508: 6(int) Load 507 + 509: 32(ptr) AccessChain 24(data) 25 508 25 + 510: 13(ivec4) Load 509 + 511: 13(ivec4) GroupNonUniformQuadBroadcast 35 510 35 + 512: 32(ptr) AccessChain 24(data) 25 506 25 + Store 512 511 + 513: 27(ptr) AccessChain 10(dti) 26 + 514: 6(int) Load 513 + 515: 27(ptr) AccessChain 10(dti) 26 + 516: 6(int) Load 515 + 517: 42(ptr) AccessChain 24(data) 25 516 25 26 + 518: 6(int) Load 517 + 519: 6(int) GroupNonUniformQuadBroadcast 35 518 35 + 520: 42(ptr) AccessChain 24(data) 25 514 25 26 + Store 520 519 + 521: 27(ptr) AccessChain 10(dti) 26 + 522: 6(int) Load 521 + 523: 27(ptr) AccessChain 10(dti) 26 + 524: 6(int) Load 523 + 525: 32(ptr) AccessChain 24(data) 25 524 25 + 526: 13(ivec4) Load 525 + 527: 51(ivec2) VectorShuffle 526 526 0 1 + 528: 51(ivec2) GroupNonUniformQuadBroadcast 35 527 35 + 529: 32(ptr) AccessChain 24(data) 25 522 25 + 530: 13(ivec4) Load 529 + 531: 13(ivec4) VectorShuffle 530 528 4 5 2 3 + Store 529 531 + 532: 27(ptr) AccessChain 10(dti) 26 + 533: 6(int) Load 532 + 534: 27(ptr) AccessChain 10(dti) 26 + 535: 6(int) Load 534 + 536: 32(ptr) AccessChain 24(data) 25 535 25 + 537: 13(ivec4) Load 536 + 538: 7(ivec3) VectorShuffle 537 537 0 1 2 + 539: 7(ivec3) GroupNonUniformQuadBroadcast 35 538 35 + 540: 32(ptr) AccessChain 24(data) 25 533 25 + 541: 13(ivec4) Load 540 + 542: 13(ivec4) VectorShuffle 541 539 4 5 6 3 + Store 540 542 + 543: 27(ptr) AccessChain 10(dti) 26 + 544: 6(int) Load 543 + 545: 27(ptr) AccessChain 10(dti) 26 + 546: 6(int) Load 545 + 547: 75(ptr) AccessChain 24(data) 25 546 72 + 548: 15(ivec4) Load 547 + 549: 15(ivec4) GroupNonUniformQuadBroadcast 35 548 35 + 550: 75(ptr) AccessChain 24(data) 25 544 72 + Store 550 549 + 551: 27(ptr) AccessChain 10(dti) 26 + 552: 6(int) Load 551 + 553: 27(ptr) AccessChain 10(dti) 26 + 554: 6(int) Load 553 + 555: 84(ptr) AccessChain 24(data) 25 554 72 26 + 556: 14(int) Load 555 + 557: 14(int) GroupNonUniformQuadBroadcast 35 556 35 + 558: 84(ptr) AccessChain 24(data) 25 552 72 26 + Store 558 557 + 559: 27(ptr) AccessChain 10(dti) 26 + 560: 6(int) Load 559 + 561: 27(ptr) AccessChain 10(dti) 26 + 562: 6(int) Load 561 + 563: 75(ptr) AccessChain 24(data) 25 562 72 + 564: 15(ivec4) Load 563 + 565: 93(ivec2) VectorShuffle 564 564 0 1 + 566: 93(ivec2) GroupNonUniformQuadBroadcast 35 565 35 + 567: 75(ptr) AccessChain 24(data) 25 560 72 + 568: 15(ivec4) Load 567 + 569: 15(ivec4) VectorShuffle 568 566 4 5 2 3 + Store 567 569 + 570: 27(ptr) AccessChain 10(dti) 26 + 571: 6(int) Load 570 + 572: 27(ptr) AccessChain 10(dti) 26 + 573: 6(int) Load 572 + 574: 75(ptr) AccessChain 24(data) 25 573 72 + 575: 15(ivec4) Load 574 + 576: 105(ivec3) VectorShuffle 575 575 0 1 2 + 577: 105(ivec3) GroupNonUniformQuadBroadcast 35 576 35 + 578: 75(ptr) AccessChain 24(data) 25 571 72 + 579: 15(ivec4) Load 578 + 580: 15(ivec4) VectorShuffle 579 577 4 5 6 3 + Store 578 580 + 581: 27(ptr) AccessChain 10(dti) 26 + 582: 6(int) Load 581 + 583: 27(ptr) AccessChain 10(dti) 26 + 584: 6(int) Load 583 + 585: 118(ptr) AccessChain 24(data) 25 584 115 + 586: 17(fvec4) Load 585 + 587: 17(fvec4) GroupNonUniformQuadBroadcast 35 586 35 + 588: 118(ptr) AccessChain 24(data) 25 582 115 + Store 588 587 + 589: 27(ptr) AccessChain 10(dti) 26 + 590: 6(int) Load 589 + 591: 27(ptr) AccessChain 10(dti) 26 + 592: 6(int) Load 591 + 593: 127(ptr) AccessChain 24(data) 25 592 115 26 + 594: 16(float) Load 593 + 595: 16(float) GroupNonUniformQuadBroadcast 35 594 35 + 596: 127(ptr) AccessChain 24(data) 25 590 115 26 + Store 596 595 + 597: 27(ptr) AccessChain 10(dti) 26 + 598: 6(int) Load 597 + 599: 27(ptr) AccessChain 10(dti) 26 + 600: 6(int) Load 599 + 601: 118(ptr) AccessChain 24(data) 25 600 115 + 602: 17(fvec4) Load 601 + 603: 136(fvec2) VectorShuffle 602 602 0 1 + 604: 136(fvec2) GroupNonUniformQuadBroadcast 35 603 35 + 605: 118(ptr) AccessChain 24(data) 25 598 115 + 606: 17(fvec4) Load 605 + 607: 17(fvec4) VectorShuffle 606 604 4 5 2 3 + Store 605 607 + 608: 27(ptr) AccessChain 10(dti) 26 + 609: 6(int) Load 608 + 610: 27(ptr) AccessChain 10(dti) 26 + 611: 6(int) Load 610 + 612: 118(ptr) AccessChain 24(data) 25 611 115 + 613: 17(fvec4) Load 612 + 614: 148(fvec3) VectorShuffle 613 613 0 1 2 + 615: 148(fvec3) GroupNonUniformQuadBroadcast 35 614 35 + 616: 118(ptr) AccessChain 24(data) 25 609 115 + 617: 17(fvec4) Load 616 + 618: 17(fvec4) VectorShuffle 617 615 4 5 6 3 + Store 616 618 + 619: 27(ptr) AccessChain 10(dti) 26 + 620: 6(int) Load 619 + 621: 27(ptr) AccessChain 10(dti) 26 + 622: 6(int) Load 621 + 623: 161(ptr) AccessChain 24(data) 25 622 158 + 624: 19(f64vec4) Load 623 + 625: 19(f64vec4) GroupNonUniformQuadBroadcast 35 624 35 + 626: 161(ptr) AccessChain 24(data) 25 620 158 + Store 626 625 + 627: 27(ptr) AccessChain 10(dti) 26 + 628: 6(int) Load 627 + 629: 27(ptr) AccessChain 10(dti) 26 + 630: 6(int) Load 629 + 631: 170(ptr) AccessChain 24(data) 25 630 158 26 + 632:18(float64_t) Load 631 + 633:18(float64_t) GroupNonUniformQuadBroadcast 35 632 35 + 634: 170(ptr) AccessChain 24(data) 25 628 158 26 + Store 634 633 + 635: 27(ptr) AccessChain 10(dti) 26 + 636: 6(int) Load 635 + 637: 27(ptr) AccessChain 10(dti) 26 + 638: 6(int) Load 637 + 639: 161(ptr) AccessChain 24(data) 25 638 158 + 640: 19(f64vec4) Load 639 + 641:179(f64vec2) VectorShuffle 640 640 0 1 + 642:179(f64vec2) GroupNonUniformQuadBroadcast 35 641 35 + 643: 161(ptr) AccessChain 24(data) 25 636 158 + 644: 19(f64vec4) Load 643 + 645: 19(f64vec4) VectorShuffle 644 642 4 5 2 3 + Store 643 645 + 646: 27(ptr) AccessChain 10(dti) 26 + 647: 6(int) Load 646 + 648: 27(ptr) AccessChain 10(dti) 26 + 649: 6(int) Load 648 + 650: 161(ptr) AccessChain 24(data) 25 649 158 + 651: 19(f64vec4) Load 650 + 652:191(f64vec3) VectorShuffle 651 651 0 1 2 + 653:191(f64vec3) GroupNonUniformQuadBroadcast 35 652 35 + 654: 161(ptr) AccessChain 24(data) 25 647 158 + 655: 19(f64vec4) Load 654 + 656: 19(f64vec4) VectorShuffle 655 653 4 5 6 3 + Store 654 656 + 657: 27(ptr) AccessChain 10(dti) 26 + 658: 6(int) Load 657 + 659: 27(ptr) AccessChain 10(dti) 26 + 660: 6(int) Load 659 + 661: 32(ptr) AccessChain 24(data) 25 660 25 + 662: 13(ivec4) Load 661 + 663: 13(ivec4) GroupNonUniformQuadSwap 35 662 26 + 664: 32(ptr) AccessChain 24(data) 25 658 25 + Store 664 663 + 665: 27(ptr) AccessChain 10(dti) 26 + 666: 6(int) Load 665 + 667: 27(ptr) AccessChain 10(dti) 26 + 668: 6(int) Load 667 + 669: 42(ptr) AccessChain 24(data) 25 668 25 26 + 670: 6(int) Load 669 + 671: 6(int) GroupNonUniformQuadSwap 35 670 26 + 672: 42(ptr) AccessChain 24(data) 25 666 25 26 + Store 672 671 + 673: 27(ptr) AccessChain 10(dti) 26 + 674: 6(int) Load 673 + 675: 27(ptr) AccessChain 10(dti) 26 + 676: 6(int) Load 675 + 677: 32(ptr) AccessChain 24(data) 25 676 25 + 678: 13(ivec4) Load 677 + 679: 51(ivec2) VectorShuffle 678 678 0 1 + 680: 51(ivec2) GroupNonUniformQuadSwap 35 679 26 + 681: 32(ptr) AccessChain 24(data) 25 674 25 + 682: 13(ivec4) Load 681 + 683: 13(ivec4) VectorShuffle 682 680 4 5 2 3 + Store 681 683 + 684: 27(ptr) AccessChain 10(dti) 26 + 685: 6(int) Load 684 + 686: 27(ptr) AccessChain 10(dti) 26 + 687: 6(int) Load 686 + 688: 32(ptr) AccessChain 24(data) 25 687 25 + 689: 13(ivec4) Load 688 + 690: 7(ivec3) VectorShuffle 689 689 0 1 2 + 691: 7(ivec3) GroupNonUniformQuadSwap 35 690 26 + 692: 32(ptr) AccessChain 24(data) 25 685 25 + 693: 13(ivec4) Load 692 + 694: 13(ivec4) VectorShuffle 693 691 4 5 6 3 + Store 692 694 + 695: 27(ptr) AccessChain 10(dti) 26 + 696: 6(int) Load 695 + 697: 27(ptr) AccessChain 10(dti) 26 + 698: 6(int) Load 697 + 699: 75(ptr) AccessChain 24(data) 25 698 72 + 700: 15(ivec4) Load 699 + 701: 15(ivec4) GroupNonUniformQuadSwap 35 700 26 + 702: 75(ptr) AccessChain 24(data) 25 696 72 + Store 702 701 + 703: 27(ptr) AccessChain 10(dti) 26 + 704: 6(int) Load 703 + 705: 27(ptr) AccessChain 10(dti) 26 + 706: 6(int) Load 705 + 707: 84(ptr) AccessChain 24(data) 25 706 72 26 + 708: 14(int) Load 707 + 709: 14(int) GroupNonUniformQuadSwap 35 708 26 + 710: 84(ptr) AccessChain 24(data) 25 704 72 26 + Store 710 709 + 711: 27(ptr) AccessChain 10(dti) 26 + 712: 6(int) Load 711 + 713: 27(ptr) AccessChain 10(dti) 26 + 714: 6(int) Load 713 + 715: 75(ptr) AccessChain 24(data) 25 714 72 + 716: 15(ivec4) Load 715 + 717: 93(ivec2) VectorShuffle 716 716 0 1 + 718: 93(ivec2) GroupNonUniformQuadSwap 35 717 26 + 719: 75(ptr) AccessChain 24(data) 25 712 72 + 720: 15(ivec4) Load 719 + 721: 15(ivec4) VectorShuffle 720 718 4 5 2 3 + Store 719 721 + 722: 27(ptr) AccessChain 10(dti) 26 + 723: 6(int) Load 722 + 724: 27(ptr) AccessChain 10(dti) 26 + 725: 6(int) Load 724 + 726: 75(ptr) AccessChain 24(data) 25 725 72 + 727: 15(ivec4) Load 726 + 728: 105(ivec3) VectorShuffle 727 727 0 1 2 + 729: 105(ivec3) GroupNonUniformQuadSwap 35 728 26 + 730: 75(ptr) AccessChain 24(data) 25 723 72 + 731: 15(ivec4) Load 730 + 732: 15(ivec4) VectorShuffle 731 729 4 5 6 3 + Store 730 732 + 733: 27(ptr) AccessChain 10(dti) 26 + 734: 6(int) Load 733 + 735: 27(ptr) AccessChain 10(dti) 26 + 736: 6(int) Load 735 + 737: 118(ptr) AccessChain 24(data) 25 736 115 + 738: 17(fvec4) Load 737 + 739: 17(fvec4) GroupNonUniformQuadSwap 35 738 26 + 740: 118(ptr) AccessChain 24(data) 25 734 115 + Store 740 739 + 741: 27(ptr) AccessChain 10(dti) 26 + 742: 6(int) Load 741 + 743: 27(ptr) AccessChain 10(dti) 26 + 744: 6(int) Load 743 + 745: 127(ptr) AccessChain 24(data) 25 744 115 26 + 746: 16(float) Load 745 + 747: 16(float) GroupNonUniformQuadSwap 35 746 26 + 748: 127(ptr) AccessChain 24(data) 25 742 115 26 + Store 748 747 + 749: 27(ptr) AccessChain 10(dti) 26 + 750: 6(int) Load 749 + 751: 27(ptr) AccessChain 10(dti) 26 + 752: 6(int) Load 751 + 753: 118(ptr) AccessChain 24(data) 25 752 115 + 754: 17(fvec4) Load 753 + 755: 136(fvec2) VectorShuffle 754 754 0 1 + 756: 136(fvec2) GroupNonUniformQuadSwap 35 755 26 + 757: 118(ptr) AccessChain 24(data) 25 750 115 + 758: 17(fvec4) Load 757 + 759: 17(fvec4) VectorShuffle 758 756 4 5 2 3 + Store 757 759 + 760: 27(ptr) AccessChain 10(dti) 26 + 761: 6(int) Load 760 + 762: 27(ptr) AccessChain 10(dti) 26 + 763: 6(int) Load 762 + 764: 118(ptr) AccessChain 24(data) 25 763 115 + 765: 17(fvec4) Load 764 + 766: 148(fvec3) VectorShuffle 765 765 0 1 2 + 767: 148(fvec3) GroupNonUniformQuadSwap 35 766 26 + 768: 118(ptr) AccessChain 24(data) 25 761 115 + 769: 17(fvec4) Load 768 + 770: 17(fvec4) VectorShuffle 769 767 4 5 6 3 + Store 768 770 + 771: 27(ptr) AccessChain 10(dti) 26 + 772: 6(int) Load 771 + 773: 27(ptr) AccessChain 10(dti) 26 + 774: 6(int) Load 773 + 775: 161(ptr) AccessChain 24(data) 25 774 158 + 776: 19(f64vec4) Load 775 + 777: 19(f64vec4) GroupNonUniformQuadSwap 35 776 26 + 778: 161(ptr) AccessChain 24(data) 25 772 158 + Store 778 777 + 779: 27(ptr) AccessChain 10(dti) 26 + 780: 6(int) Load 779 + 781: 27(ptr) AccessChain 10(dti) 26 + 782: 6(int) Load 781 + 783: 170(ptr) AccessChain 24(data) 25 782 158 26 + 784:18(float64_t) Load 783 + 785:18(float64_t) GroupNonUniformQuadSwap 35 784 26 + 786: 170(ptr) AccessChain 24(data) 25 780 158 26 + Store 786 785 + 787: 27(ptr) AccessChain 10(dti) 26 + 788: 6(int) Load 787 + 789: 27(ptr) AccessChain 10(dti) 26 + 790: 6(int) Load 789 + 791: 161(ptr) AccessChain 24(data) 25 790 158 + 792: 19(f64vec4) Load 791 + 793:179(f64vec2) VectorShuffle 792 792 0 1 + 794:179(f64vec2) GroupNonUniformQuadSwap 35 793 26 + 795: 161(ptr) AccessChain 24(data) 25 788 158 + 796: 19(f64vec4) Load 795 + 797: 19(f64vec4) VectorShuffle 796 794 4 5 2 3 + Store 795 797 + 798: 27(ptr) AccessChain 10(dti) 26 + 799: 6(int) Load 798 + 800: 27(ptr) AccessChain 10(dti) 26 + 801: 6(int) Load 800 + 802: 161(ptr) AccessChain 24(data) 25 801 158 + 803: 19(f64vec4) Load 802 + 804:191(f64vec3) VectorShuffle 803 803 0 1 2 + 805:191(f64vec3) GroupNonUniformQuadSwap 35 804 26 + 806: 161(ptr) AccessChain 24(data) 25 799 158 + 807: 19(f64vec4) Load 806 + 808: 19(f64vec4) VectorShuffle 807 805 4 5 6 3 + Store 806 808 + 809: 27(ptr) AccessChain 10(dti) 26 + 810: 6(int) Load 809 + 811: 27(ptr) AccessChain 10(dti) 26 + 812: 6(int) Load 811 + 813: 32(ptr) AccessChain 24(data) 25 812 25 + 814: 13(ivec4) Load 813 + 815: 13(ivec4) GroupNonUniformQuadSwap 35 814 205 + 816: 32(ptr) AccessChain 24(data) 25 810 25 + Store 816 815 + 817: 27(ptr) AccessChain 10(dti) 26 + 818: 6(int) Load 817 + 819: 27(ptr) AccessChain 10(dti) 26 + 820: 6(int) Load 819 + 821: 42(ptr) AccessChain 24(data) 25 820 25 26 + 822: 6(int) Load 821 + 823: 6(int) GroupNonUniformQuadSwap 35 822 205 + 824: 42(ptr) AccessChain 24(data) 25 818 25 26 + Store 824 823 + 825: 27(ptr) AccessChain 10(dti) 26 + 826: 6(int) Load 825 + 827: 27(ptr) AccessChain 10(dti) 26 + 828: 6(int) Load 827 + 829: 32(ptr) AccessChain 24(data) 25 828 25 + 830: 13(ivec4) Load 829 + 831: 51(ivec2) VectorShuffle 830 830 0 1 + 832: 51(ivec2) GroupNonUniformQuadSwap 35 831 205 + 833: 32(ptr) AccessChain 24(data) 25 826 25 + 834: 13(ivec4) Load 833 + 835: 13(ivec4) VectorShuffle 834 832 4 5 2 3 + Store 833 835 + 836: 27(ptr) AccessChain 10(dti) 26 + 837: 6(int) Load 836 + 838: 27(ptr) AccessChain 10(dti) 26 + 839: 6(int) Load 838 + 840: 32(ptr) AccessChain 24(data) 25 839 25 + 841: 13(ivec4) Load 840 + 842: 7(ivec3) VectorShuffle 841 841 0 1 2 + 843: 7(ivec3) GroupNonUniformQuadSwap 35 842 205 + 844: 32(ptr) AccessChain 24(data) 25 837 25 + 845: 13(ivec4) Load 844 + 846: 13(ivec4) VectorShuffle 845 843 4 5 6 3 + Store 844 846 + 847: 27(ptr) AccessChain 10(dti) 26 + 848: 6(int) Load 847 + 849: 27(ptr) AccessChain 10(dti) 26 + 850: 6(int) Load 849 + 851: 75(ptr) AccessChain 24(data) 25 850 72 + 852: 15(ivec4) Load 851 + 853: 15(ivec4) GroupNonUniformQuadSwap 35 852 205 + 854: 75(ptr) AccessChain 24(data) 25 848 72 + Store 854 853 + 855: 27(ptr) AccessChain 10(dti) 26 + 856: 6(int) Load 855 + 857: 27(ptr) AccessChain 10(dti) 26 + 858: 6(int) Load 857 + 859: 84(ptr) AccessChain 24(data) 25 858 72 26 + 860: 14(int) Load 859 + 861: 14(int) GroupNonUniformQuadSwap 35 860 205 + 862: 84(ptr) AccessChain 24(data) 25 856 72 26 + Store 862 861 + 863: 27(ptr) AccessChain 10(dti) 26 + 864: 6(int) Load 863 + 865: 27(ptr) AccessChain 10(dti) 26 + 866: 6(int) Load 865 + 867: 75(ptr) AccessChain 24(data) 25 866 72 + 868: 15(ivec4) Load 867 + 869: 93(ivec2) VectorShuffle 868 868 0 1 + 870: 93(ivec2) GroupNonUniformQuadSwap 35 869 205 + 871: 75(ptr) AccessChain 24(data) 25 864 72 + 872: 15(ivec4) Load 871 + 873: 15(ivec4) VectorShuffle 872 870 4 5 2 3 + Store 871 873 + 874: 27(ptr) AccessChain 10(dti) 26 + 875: 6(int) Load 874 + 876: 27(ptr) AccessChain 10(dti) 26 + 877: 6(int) Load 876 + 878: 75(ptr) AccessChain 24(data) 25 877 72 + 879: 15(ivec4) Load 878 + 880: 105(ivec3) VectorShuffle 879 879 0 1 2 + 881: 105(ivec3) GroupNonUniformQuadSwap 35 880 205 + 882: 75(ptr) AccessChain 24(data) 25 875 72 + 883: 15(ivec4) Load 882 + 884: 15(ivec4) VectorShuffle 883 881 4 5 6 3 + Store 882 884 + 885: 27(ptr) AccessChain 10(dti) 26 + 886: 6(int) Load 885 + 887: 27(ptr) AccessChain 10(dti) 26 + 888: 6(int) Load 887 + 889: 118(ptr) AccessChain 24(data) 25 888 115 + 890: 17(fvec4) Load 889 + 891: 17(fvec4) GroupNonUniformQuadSwap 35 890 205 + 892: 118(ptr) AccessChain 24(data) 25 886 115 + Store 892 891 + 893: 27(ptr) AccessChain 10(dti) 26 + 894: 6(int) Load 893 + 895: 27(ptr) AccessChain 10(dti) 26 + 896: 6(int) Load 895 + 897: 127(ptr) AccessChain 24(data) 25 896 115 26 + 898: 16(float) Load 897 + 899: 16(float) GroupNonUniformQuadSwap 35 898 205 + 900: 127(ptr) AccessChain 24(data) 25 894 115 26 + Store 900 899 + 901: 27(ptr) AccessChain 10(dti) 26 + 902: 6(int) Load 901 + 903: 27(ptr) AccessChain 10(dti) 26 + 904: 6(int) Load 903 + 905: 118(ptr) AccessChain 24(data) 25 904 115 + 906: 17(fvec4) Load 905 + 907: 136(fvec2) VectorShuffle 906 906 0 1 + 908: 136(fvec2) GroupNonUniformQuadSwap 35 907 205 + 909: 118(ptr) AccessChain 24(data) 25 902 115 + 910: 17(fvec4) Load 909 + 911: 17(fvec4) VectorShuffle 910 908 4 5 2 3 + Store 909 911 + 912: 27(ptr) AccessChain 10(dti) 26 + 913: 6(int) Load 912 + 914: 27(ptr) AccessChain 10(dti) 26 + 915: 6(int) Load 914 + 916: 118(ptr) AccessChain 24(data) 25 915 115 + 917: 17(fvec4) Load 916 + 918: 148(fvec3) VectorShuffle 917 917 0 1 2 + 919: 148(fvec3) GroupNonUniformQuadSwap 35 918 205 + 920: 118(ptr) AccessChain 24(data) 25 913 115 + 921: 17(fvec4) Load 920 + 922: 17(fvec4) VectorShuffle 921 919 4 5 6 3 + Store 920 922 + 923: 27(ptr) AccessChain 10(dti) 26 + 924: 6(int) Load 923 + 925: 27(ptr) AccessChain 10(dti) 26 + 926: 6(int) Load 925 + 927: 161(ptr) AccessChain 24(data) 25 926 158 + 928: 19(f64vec4) Load 927 + 929: 19(f64vec4) GroupNonUniformQuadSwap 35 928 205 + 930: 161(ptr) AccessChain 24(data) 25 924 158 + Store 930 929 + 931: 27(ptr) AccessChain 10(dti) 26 + 932: 6(int) Load 931 + 933: 27(ptr) AccessChain 10(dti) 26 + 934: 6(int) Load 933 + 935: 170(ptr) AccessChain 24(data) 25 934 158 26 + 936:18(float64_t) Load 935 + 937:18(float64_t) GroupNonUniformQuadSwap 35 936 205 + 938: 170(ptr) AccessChain 24(data) 25 932 158 26 + Store 938 937 + 939: 27(ptr) AccessChain 10(dti) 26 + 940: 6(int) Load 939 + 941: 27(ptr) AccessChain 10(dti) 26 + 942: 6(int) Load 941 + 943: 161(ptr) AccessChain 24(data) 25 942 158 + 944: 19(f64vec4) Load 943 + 945:179(f64vec2) VectorShuffle 944 944 0 1 + 946:179(f64vec2) GroupNonUniformQuadSwap 35 945 205 + 947: 161(ptr) AccessChain 24(data) 25 940 158 + 948: 19(f64vec4) Load 947 + 949: 19(f64vec4) VectorShuffle 948 946 4 5 2 3 + Store 947 949 + 950: 27(ptr) AccessChain 10(dti) 26 + 951: 6(int) Load 950 + 952: 27(ptr) AccessChain 10(dti) 26 + 953: 6(int) Load 952 + 954: 161(ptr) AccessChain 24(data) 25 953 158 + 955: 19(f64vec4) Load 954 + 956:191(f64vec3) VectorShuffle 955 955 0 1 2 + 957:191(f64vec3) GroupNonUniformQuadSwap 35 956 205 + 958: 161(ptr) AccessChain 24(data) 25 951 158 + 959: 19(f64vec4) Load 958 + 960: 19(f64vec4) VectorShuffle 959 957 4 5 6 3 + Store 958 960 + 961: 27(ptr) AccessChain 10(dti) 26 + 962: 6(int) Load 961 + 963: 27(ptr) AccessChain 10(dti) 26 + 964: 6(int) Load 963 + 965: 32(ptr) AccessChain 24(data) 25 964 25 + 966: 13(ivec4) Load 965 + 967: 13(ivec4) GroupNonUniformQuadSwap 35 966 358 + 968: 32(ptr) AccessChain 24(data) 25 962 25 + Store 968 967 + 969: 27(ptr) AccessChain 10(dti) 26 + 970: 6(int) Load 969 + 971: 27(ptr) AccessChain 10(dti) 26 + 972: 6(int) Load 971 + 973: 42(ptr) AccessChain 24(data) 25 972 25 26 + 974: 6(int) Load 973 + 975: 6(int) GroupNonUniformQuadSwap 35 974 358 + 976: 42(ptr) AccessChain 24(data) 25 970 25 26 + Store 976 975 + 977: 27(ptr) AccessChain 10(dti) 26 + 978: 6(int) Load 977 + 979: 27(ptr) AccessChain 10(dti) 26 + 980: 6(int) Load 979 + 981: 32(ptr) AccessChain 24(data) 25 980 25 + 982: 13(ivec4) Load 981 + 983: 51(ivec2) VectorShuffle 982 982 0 1 + 984: 51(ivec2) GroupNonUniformQuadSwap 35 983 358 + 985: 32(ptr) AccessChain 24(data) 25 978 25 + 986: 13(ivec4) Load 985 + 987: 13(ivec4) VectorShuffle 986 984 4 5 2 3 + Store 985 987 + 988: 27(ptr) AccessChain 10(dti) 26 + 989: 6(int) Load 988 + 990: 27(ptr) AccessChain 10(dti) 26 + 991: 6(int) Load 990 + 992: 32(ptr) AccessChain 24(data) 25 991 25 + 993: 13(ivec4) Load 992 + 994: 7(ivec3) VectorShuffle 993 993 0 1 2 + 995: 7(ivec3) GroupNonUniformQuadSwap 35 994 358 + 996: 32(ptr) AccessChain 24(data) 25 989 25 + 997: 13(ivec4) Load 996 + 998: 13(ivec4) VectorShuffle 997 995 4 5 6 3 + Store 996 998 + 999: 27(ptr) AccessChain 10(dti) 26 + 1000: 6(int) Load 999 + 1001: 27(ptr) AccessChain 10(dti) 26 + 1002: 6(int) Load 1001 + 1003: 75(ptr) AccessChain 24(data) 25 1002 72 + 1004: 15(ivec4) Load 1003 + 1005: 15(ivec4) GroupNonUniformQuadSwap 35 1004 358 + 1006: 75(ptr) AccessChain 24(data) 25 1000 72 + Store 1006 1005 + 1007: 27(ptr) AccessChain 10(dti) 26 + 1008: 6(int) Load 1007 + 1009: 27(ptr) AccessChain 10(dti) 26 + 1010: 6(int) Load 1009 + 1011: 84(ptr) AccessChain 24(data) 25 1010 72 26 + 1012: 14(int) Load 1011 + 1013: 14(int) GroupNonUniformQuadSwap 35 1012 358 + 1014: 84(ptr) AccessChain 24(data) 25 1008 72 26 + Store 1014 1013 + 1015: 27(ptr) AccessChain 10(dti) 26 + 1016: 6(int) Load 1015 + 1017: 27(ptr) AccessChain 10(dti) 26 + 1018: 6(int) Load 1017 + 1019: 75(ptr) AccessChain 24(data) 25 1018 72 + 1020: 15(ivec4) Load 1019 + 1021: 93(ivec2) VectorShuffle 1020 1020 0 1 + 1022: 93(ivec2) GroupNonUniformQuadSwap 35 1021 358 + 1023: 75(ptr) AccessChain 24(data) 25 1016 72 + 1024: 15(ivec4) Load 1023 + 1025: 15(ivec4) VectorShuffle 1024 1022 4 5 2 3 + Store 1023 1025 + 1026: 27(ptr) AccessChain 10(dti) 26 + 1027: 6(int) Load 1026 + 1028: 27(ptr) AccessChain 10(dti) 26 + 1029: 6(int) Load 1028 + 1030: 75(ptr) AccessChain 24(data) 25 1029 72 + 1031: 15(ivec4) Load 1030 + 1032: 105(ivec3) VectorShuffle 1031 1031 0 1 2 + 1033: 105(ivec3) GroupNonUniformQuadSwap 35 1032 358 + 1034: 75(ptr) AccessChain 24(data) 25 1027 72 + 1035: 15(ivec4) Load 1034 + 1036: 15(ivec4) VectorShuffle 1035 1033 4 5 6 3 + Store 1034 1036 + 1037: 27(ptr) AccessChain 10(dti) 26 + 1038: 6(int) Load 1037 + 1039: 27(ptr) AccessChain 10(dti) 26 + 1040: 6(int) Load 1039 + 1041: 118(ptr) AccessChain 24(data) 25 1040 115 + 1042: 17(fvec4) Load 1041 + 1043: 17(fvec4) GroupNonUniformQuadSwap 35 1042 358 + 1044: 118(ptr) AccessChain 24(data) 25 1038 115 + Store 1044 1043 + 1045: 27(ptr) AccessChain 10(dti) 26 + 1046: 6(int) Load 1045 + 1047: 27(ptr) AccessChain 10(dti) 26 + 1048: 6(int) Load 1047 + 1049: 127(ptr) AccessChain 24(data) 25 1048 115 26 + 1050: 16(float) Load 1049 + 1051: 16(float) GroupNonUniformQuadSwap 35 1050 358 + 1052: 127(ptr) AccessChain 24(data) 25 1046 115 26 + Store 1052 1051 + 1053: 27(ptr) AccessChain 10(dti) 26 + 1054: 6(int) Load 1053 + 1055: 27(ptr) AccessChain 10(dti) 26 + 1056: 6(int) Load 1055 + 1057: 118(ptr) AccessChain 24(data) 25 1056 115 + 1058: 17(fvec4) Load 1057 + 1059: 136(fvec2) VectorShuffle 1058 1058 0 1 + 1060: 136(fvec2) GroupNonUniformQuadSwap 35 1059 358 + 1061: 118(ptr) AccessChain 24(data) 25 1054 115 + 1062: 17(fvec4) Load 1061 + 1063: 17(fvec4) VectorShuffle 1062 1060 4 5 2 3 + Store 1061 1063 + 1064: 27(ptr) AccessChain 10(dti) 26 + 1065: 6(int) Load 1064 + 1066: 27(ptr) AccessChain 10(dti) 26 + 1067: 6(int) Load 1066 + 1068: 118(ptr) AccessChain 24(data) 25 1067 115 + 1069: 17(fvec4) Load 1068 + 1070: 148(fvec3) VectorShuffle 1069 1069 0 1 2 + 1071: 148(fvec3) GroupNonUniformQuadSwap 35 1070 358 + 1072: 118(ptr) AccessChain 24(data) 25 1065 115 + 1073: 17(fvec4) Load 1072 + 1074: 17(fvec4) VectorShuffle 1073 1071 4 5 6 3 + Store 1072 1074 + 1075: 27(ptr) AccessChain 10(dti) 26 + 1076: 6(int) Load 1075 + 1077: 27(ptr) AccessChain 10(dti) 26 + 1078: 6(int) Load 1077 + 1079: 161(ptr) AccessChain 24(data) 25 1078 158 + 1080: 19(f64vec4) Load 1079 + 1081: 19(f64vec4) GroupNonUniformQuadSwap 35 1080 358 + 1082: 161(ptr) AccessChain 24(data) 25 1076 158 + Store 1082 1081 + 1083: 27(ptr) AccessChain 10(dti) 26 + 1084: 6(int) Load 1083 + 1085: 27(ptr) AccessChain 10(dti) 26 + 1086: 6(int) Load 1085 + 1087: 170(ptr) AccessChain 24(data) 25 1086 158 26 + 1088:18(float64_t) Load 1087 + 1089:18(float64_t) GroupNonUniformQuadSwap 35 1088 358 + 1090: 170(ptr) AccessChain 24(data) 25 1084 158 26 + Store 1090 1089 + 1091: 27(ptr) AccessChain 10(dti) 26 + 1092: 6(int) Load 1091 + 1093: 27(ptr) AccessChain 10(dti) 26 + 1094: 6(int) Load 1093 + 1095: 161(ptr) AccessChain 24(data) 25 1094 158 + 1096: 19(f64vec4) Load 1095 + 1097:179(f64vec2) VectorShuffle 1096 1096 0 1 + 1098:179(f64vec2) GroupNonUniformQuadSwap 35 1097 358 + 1099: 161(ptr) AccessChain 24(data) 25 1092 158 + 1100: 19(f64vec4) Load 1099 + 1101: 19(f64vec4) VectorShuffle 1100 1098 4 5 2 3 + Store 1099 1101 + 1102: 27(ptr) AccessChain 10(dti) 26 + 1103: 6(int) Load 1102 + 1104: 27(ptr) AccessChain 10(dti) 26 + 1105: 6(int) Load 1104 + 1106: 161(ptr) AccessChain 24(data) 25 1105 158 + 1107: 19(f64vec4) Load 1106 + 1108:191(f64vec3) VectorShuffle 1107 1107 0 1 2 + 1109:191(f64vec3) GroupNonUniformQuadSwap 35 1108 358 + 1110: 161(ptr) AccessChain 24(data) 25 1103 158 + 1111: 19(f64vec4) Load 1110 + 1112: 19(f64vec4) VectorShuffle 1111 1109 4 5 6 3 + Store 1110 1112 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequery.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequery.comp.out new file mode 100644 index 00000000000..5f70124e4f2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequery.comp.out @@ -0,0 +1,116 @@ +hlsl.wavequery.comp +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:5 Function Definition: @CSMain( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp uint) +0:6 indirect index (layout( row_major std430) buffer uint) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:6 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:6 Constant: +0:6 0 (const uint) +0:6 '@gl_SubgroupInvocationID' ( in uint unknown built-in variable) +0:6 Test condition and select ( temp uint): no shortcircuit +0:6 Condition +0:6 subgroupElect ( temp bool) +0:6 true case +0:6 '@gl_SubgroupSize' ( in uint unknown built-in variable) +0:6 false case +0:6 Constant: +0:6 0 (const uint) +0:5 Function Definition: CSMain( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 Function Call: @CSMain( ( temp void) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) + + +Linked compute stage: + + +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:5 Function Definition: @CSMain( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:6 move second child to first child ( temp uint) +0:6 indirect index (layout( row_major std430) buffer uint) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint) +0:6 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) +0:6 Constant: +0:6 0 (const uint) +0:6 '@gl_SubgroupInvocationID' ( in uint unknown built-in variable) +0:6 Test condition and select ( temp uint): no shortcircuit +0:6 Condition +0:6 subgroupElect ( temp bool) +0:6 true case +0:6 '@gl_SubgroupSize' ( in uint unknown built-in variable) +0:6 false case +0:6 Constant: +0:6 0 (const uint) +0:5 Function Definition: CSMain( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 Function Call: @CSMain( ( temp void) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint @data}) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 28 + + Capability Shader + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "CSMain" 16 21 + ExecutionMode 4 LocalSize 32 16 1 + Source HLSL 500 + Name 4 "CSMain" + Name 6 "@CSMain(" + Name 10 "data" + MemberName 10(data) 0 "@data" + Name 12 "data" + Name 16 "@gl_SubgroupInvocationID" + Name 21 "@gl_SubgroupSize" + Decorate 9 ArrayStride 4 + MemberDecorate 10(data) 0 Offset 0 + Decorate 10(data) BufferBlock + Decorate 12(data) DescriptorSet 0 + Decorate 16(@gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 21(@gl_SubgroupSize) BuiltIn SubgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 8: TypeInt 32 0 + 9: TypeRuntimeArray 8(int) + 10(data): TypeStruct 9 + 11: TypePointer Uniform 10(data) + 12(data): 11(ptr) Variable Uniform + 13: TypeInt 32 1 + 14: 13(int) Constant 0 + 15: TypePointer Input 8(int) +16(@gl_SubgroupInvocationID): 15(ptr) Variable Input + 18: TypeBool + 19: 8(int) Constant 3 +21(@gl_SubgroupSize): 15(ptr) Variable Input + 23: 8(int) Constant 0 + 25: TypePointer Uniform 8(int) + 4(CSMain): 2 Function None 3 + 5: Label + 27: 2 FunctionCall 6(@CSMain() + Return + FunctionEnd + 6(@CSMain(): 2 Function None 3 + 7: Label + 17: 8(int) Load 16(@gl_SubgroupInvocationID) + 20: 18(bool) GroupNonUniformElect 19 + 22: 8(int) Load 21(@gl_SubgroupSize) + 24: 8(int) Select 20 22 23 + 26: 25(ptr) AccessChain 12(data) 14 17 + Store 26 24 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequery.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequery.frag.out new file mode 100644 index 00000000000..52304a6c637 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavequery.frag.out @@ -0,0 +1,123 @@ +hlsl.wavequery.frag +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:2 Function Definition: @PixelShaderFunction( ( temp 4-component vector of float) +0:2 Function Parameters: +0:? Sequence +0:3 Test condition and select ( temp void) +0:3 Condition +0:3 subgroupElect ( temp bool) +0:3 true case +0:? Sequence +0:5 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:3 false case +0:? Sequence +0:9 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 3.000000 +0:? 2.000000 +0:? 1.000000 +0:2 Function Definition: PixelShaderFunction( ( temp void) +0:2 Function Parameters: +0:? Sequence +0:2 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:2 Function Call: @PixelShaderFunction( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 500 +gl_FragCoord origin is upper left +0:? Sequence +0:2 Function Definition: @PixelShaderFunction( ( temp 4-component vector of float) +0:2 Function Parameters: +0:? Sequence +0:3 Test condition and select ( temp void) +0:3 Condition +0:3 subgroupElect ( temp bool) +0:3 true case +0:? Sequence +0:5 Branch: Return with expression +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? 3.000000 +0:? 4.000000 +0:3 false case +0:? Sequence +0:9 Branch: Return with expression +0:? Constant: +0:? 4.000000 +0:? 3.000000 +0:? 2.000000 +0:? 1.000000 +0:2 Function Definition: PixelShaderFunction( ( temp void) +0:2 Function Parameters: +0:? Sequence +0:2 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) +0:2 Function Call: @PixelShaderFunction( ( temp 4-component vector of float) +0:? Linker Objects +0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 30 + + Capability Shader + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "PixelShaderFunction" 28 + ExecutionMode 4 OriginUpperLeft + Source HLSL 500 + Name 4 "PixelShaderFunction" + Name 9 "@PixelShaderFunction(" + Name 28 "@entryPointOutput" + Decorate 28(@entryPointOutput) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypeBool + 12: TypeInt 32 0 + 13: 12(int) Constant 3 + 17: 6(float) Constant 1065353216 + 18: 6(float) Constant 1073741824 + 19: 6(float) Constant 1077936128 + 20: 6(float) Constant 1082130432 + 21: 7(fvec4) ConstantComposite 17 18 19 20 + 24: 7(fvec4) ConstantComposite 20 19 18 17 + 27: TypePointer Output 7(fvec4) +28(@entryPointOutput): 27(ptr) Variable Output +4(PixelShaderFunction): 2 Function None 3 + 5: Label + 29: 7(fvec4) FunctionCall 9(@PixelShaderFunction() + Store 28(@entryPointOutput) 29 + Return + FunctionEnd +9(@PixelShaderFunction(): 7(fvec4) Function None 8 + 10: Label + 14: 11(bool) GroupNonUniformElect 13 + SelectionMerge 16 None + BranchConditional 14 15 23 + 15: Label + ReturnValue 21 + 23: Label + ReturnValue 24 + 16: Label + 26: 7(fvec4) Undef + ReturnValue 26 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavereduction.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavereduction.comp.out new file mode 100644 index 00000000000..f922f3dc6d7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavereduction.comp.out @@ -0,0 +1,7218 @@ +hlsl.wavereduction.comp +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupAdd ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupAdd ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupAdd ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupAdd ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupAdd ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupAdd ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupAdd ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupAdd ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupAdd ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupAdd ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupAdd ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupAdd ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupAdd ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupAdd ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupAdd ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupAdd ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupMul ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupMul ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupMul ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupMul ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupMul ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupMul ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupMul ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupMul ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupMul ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupMul ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupMul ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupMul ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupMul ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupMul ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupMul ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupMul ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:54 move second child to first child ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 subgroupMin ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:55 move second child to first child ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 subgroupMin ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:56 move second child to first child ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 subgroupMin ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:57 move second child to first child ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:57 subgroupMin ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:59 move second child to first child ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:59 subgroupMin ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:60 move second child to first child ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:60 subgroupMin ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:61 move second child to first child ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 subgroupMin ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:62 move second child to first child ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:62 subgroupMin ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:64 move second child to first child ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:64 subgroupMin ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:65 move second child to first child ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:65 subgroupMin ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:66 move second child to first child ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:66 subgroupMin ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:67 move second child to first child ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 subgroupMin ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:69 move second child to first child ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:69 subgroupMin ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:70 move second child to first child ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:70 subgroupMin ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:71 move second child to first child ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 subgroupMin ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:72 move second child to first child ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:72 subgroupMin ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:74 move second child to first child ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:74 subgroupMax ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:75 move second child to first child ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 subgroupMax ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:76 move second child to first child ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:76 subgroupMax ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:77 move second child to first child ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:77 subgroupMax ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:79 move second child to first child ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 subgroupMax ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:80 move second child to first child ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:80 subgroupMax ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:81 move second child to first child ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 subgroupMax ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:82 move second child to first child ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:82 subgroupMax ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:84 move second child to first child ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:84 subgroupMax ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:85 move second child to first child ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:85 subgroupMax ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:86 move second child to first child ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:86 subgroupMax ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:87 move second child to first child ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 subgroupMax ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:89 move second child to first child ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:89 subgroupMax ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:90 move second child to first child ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:90 subgroupMax ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:91 move second child to first child ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:91 subgroupMax ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:92 move second child to first child ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:92 subgroupMax ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:94 move second child to first child ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:94 subgroupAnd ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:95 move second child to first child ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 subgroupAnd ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:96 move second child to first child ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:96 subgroupAnd ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:97 move second child to first child ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:97 subgroupAnd ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:99 move second child to first child ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:99 subgroupAnd ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:100 move second child to first child ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:100 subgroupAnd ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:101 move second child to first child ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 subgroupAnd ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:102 move second child to first child ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:102 subgroupAnd ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:104 move second child to first child ( temp 4-component vector of uint) +0:104 u: direct index for structure ( temp 4-component vector of uint) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 0 (const int) +0:104 subgroupOr ( temp 4-component vector of uint) +0:104 u: direct index for structure ( temp 4-component vector of uint) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 0 (const int) +0:105 move second child to first child ( temp uint) +0:105 direct index ( temp uint) +0:105 u: direct index for structure ( temp 4-component vector of uint) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 subgroupOr ( temp uint) +0:105 direct index ( temp uint) +0:105 u: direct index for structure ( temp 4-component vector of uint) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:106 move second child to first child ( temp 2-component vector of uint) +0:106 vector swizzle ( temp 2-component vector of uint) +0:106 u: direct index for structure ( temp 4-component vector of uint) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 0 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:106 subgroupOr ( temp 2-component vector of uint) +0:106 vector swizzle ( temp 2-component vector of uint) +0:106 u: direct index for structure ( temp 4-component vector of uint) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 0 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:107 move second child to first child ( temp 3-component vector of uint) +0:107 vector swizzle ( temp 3-component vector of uint) +0:107 u: direct index for structure ( temp 4-component vector of uint) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 0 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 subgroupOr ( temp 3-component vector of uint) +0:107 vector swizzle ( temp 3-component vector of uint) +0:107 u: direct index for structure ( temp 4-component vector of uint) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 0 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:109 move second child to first child ( temp 4-component vector of int) +0:109 i: direct index for structure ( temp 4-component vector of int) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 1 (const int) +0:109 subgroupOr ( temp 4-component vector of int) +0:109 i: direct index for structure ( temp 4-component vector of int) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 1 (const int) +0:110 move second child to first child ( temp int) +0:110 direct index ( temp int) +0:110 i: direct index for structure ( temp 4-component vector of int) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 1 (const int) +0:110 Constant: +0:110 0 (const int) +0:110 subgroupOr ( temp int) +0:110 direct index ( temp int) +0:110 i: direct index for structure ( temp 4-component vector of int) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 1 (const int) +0:110 Constant: +0:110 0 (const int) +0:111 move second child to first child ( temp 2-component vector of int) +0:111 vector swizzle ( temp 2-component vector of int) +0:111 i: direct index for structure ( temp 4-component vector of int) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 subgroupOr ( temp 2-component vector of int) +0:111 vector swizzle ( temp 2-component vector of int) +0:111 i: direct index for structure ( temp 4-component vector of int) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:112 move second child to first child ( temp 3-component vector of int) +0:112 vector swizzle ( temp 3-component vector of int) +0:112 i: direct index for structure ( temp 4-component vector of int) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:112 subgroupOr ( temp 3-component vector of int) +0:112 vector swizzle ( temp 3-component vector of int) +0:112 i: direct index for structure ( temp 4-component vector of int) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:114 move second child to first child ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:114 subgroupXor ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:115 move second child to first child ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 subgroupXor ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:116 move second child to first child ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:116 subgroupXor ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:117 move second child to first child ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:117 subgroupXor ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:119 move second child to first child ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:119 subgroupXor ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:120 move second child to first child ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:120 subgroupXor ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:121 move second child to first child ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 subgroupXor ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:122 move second child to first child ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:122 subgroupXor ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:124 move second child to first child ( temp uint) +0:124 direct index ( temp uint) +0:124 u: direct index for structure ( temp 4-component vector of uint) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 subgroupBallotBitCount ( temp uint) +0:124 subgroupBallot ( temp 4-component vector of uint) +0:124 Compare Equal ( temp bool) +0:124 direct index ( temp uint) +0:124 u: direct index for structure ( temp 4-component vector of uint) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const uint) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:13 Function Definition: @CSMain(vu3; ( temp void) +0:13 Function Parameters: +0:13 'dti' ( in 3-component vector of uint) +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:14 subgroupAdd ( temp 4-component vector of uint) +0:14 u: direct index for structure ( temp 4-component vector of uint) +0:14 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:14 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:14 Constant: +0:14 0 (const uint) +0:14 direct index ( temp uint) +0:14 'dti' ( in 3-component vector of uint) +0:14 Constant: +0:14 0 (const int) +0:14 Constant: +0:14 0 (const int) +0:15 move second child to first child ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 subgroupAdd ( temp uint) +0:15 direct index ( temp uint) +0:15 u: direct index for structure ( temp 4-component vector of uint) +0:15 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:15 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:15 Constant: +0:15 0 (const uint) +0:15 direct index ( temp uint) +0:15 'dti' ( in 3-component vector of uint) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:15 Constant: +0:15 0 (const int) +0:16 move second child to first child ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:16 subgroupAdd ( temp 2-component vector of uint) +0:16 vector swizzle ( temp 2-component vector of uint) +0:16 u: direct index for structure ( temp 4-component vector of uint) +0:16 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:16 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:16 Constant: +0:16 0 (const uint) +0:16 direct index ( temp uint) +0:16 'dti' ( in 3-component vector of uint) +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 0 (const int) +0:16 Sequence +0:16 Constant: +0:16 0 (const int) +0:16 Constant: +0:16 1 (const int) +0:17 move second child to first child ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:17 subgroupAdd ( temp 3-component vector of uint) +0:17 vector swizzle ( temp 3-component vector of uint) +0:17 u: direct index for structure ( temp 4-component vector of uint) +0:17 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:17 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:17 Constant: +0:17 0 (const uint) +0:17 direct index ( temp uint) +0:17 'dti' ( in 3-component vector of uint) +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 0 (const int) +0:17 Sequence +0:17 Constant: +0:17 0 (const int) +0:17 Constant: +0:17 1 (const int) +0:17 Constant: +0:17 2 (const int) +0:19 move second child to first child ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:19 subgroupAdd ( temp 4-component vector of int) +0:19 i: direct index for structure ( temp 4-component vector of int) +0:19 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:19 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:19 Constant: +0:19 0 (const uint) +0:19 direct index ( temp uint) +0:19 'dti' ( in 3-component vector of uint) +0:19 Constant: +0:19 0 (const int) +0:19 Constant: +0:19 1 (const int) +0:20 move second child to first child ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:20 subgroupAdd ( temp int) +0:20 direct index ( temp int) +0:20 i: direct index for structure ( temp 4-component vector of int) +0:20 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:20 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:20 Constant: +0:20 0 (const uint) +0:20 direct index ( temp uint) +0:20 'dti' ( in 3-component vector of uint) +0:20 Constant: +0:20 0 (const int) +0:20 Constant: +0:20 1 (const int) +0:20 Constant: +0:20 0 (const int) +0:21 move second child to first child ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 subgroupAdd ( temp 2-component vector of int) +0:21 vector swizzle ( temp 2-component vector of int) +0:21 i: direct index for structure ( temp 4-component vector of int) +0:21 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:21 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:21 Constant: +0:21 0 (const uint) +0:21 direct index ( temp uint) +0:21 'dti' ( in 3-component vector of uint) +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:21 Sequence +0:21 Constant: +0:21 0 (const int) +0:21 Constant: +0:21 1 (const int) +0:22 move second child to first child ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:22 subgroupAdd ( temp 3-component vector of int) +0:22 vector swizzle ( temp 3-component vector of int) +0:22 i: direct index for structure ( temp 4-component vector of int) +0:22 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:22 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:22 Constant: +0:22 0 (const uint) +0:22 direct index ( temp uint) +0:22 'dti' ( in 3-component vector of uint) +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Sequence +0:22 Constant: +0:22 0 (const int) +0:22 Constant: +0:22 1 (const int) +0:22 Constant: +0:22 2 (const int) +0:24 move second child to first child ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:24 subgroupAdd ( temp 4-component vector of float) +0:24 f: direct index for structure ( temp 4-component vector of float) +0:24 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:24 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:24 Constant: +0:24 0 (const uint) +0:24 direct index ( temp uint) +0:24 'dti' ( in 3-component vector of uint) +0:24 Constant: +0:24 0 (const int) +0:24 Constant: +0:24 2 (const int) +0:25 move second child to first child ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:25 subgroupAdd ( temp float) +0:25 direct index ( temp float) +0:25 f: direct index for structure ( temp 4-component vector of float) +0:25 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:25 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:25 Constant: +0:25 0 (const uint) +0:25 direct index ( temp uint) +0:25 'dti' ( in 3-component vector of uint) +0:25 Constant: +0:25 0 (const int) +0:25 Constant: +0:25 2 (const int) +0:25 Constant: +0:25 0 (const int) +0:26 move second child to first child ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:26 subgroupAdd ( temp 2-component vector of float) +0:26 vector swizzle ( temp 2-component vector of float) +0:26 f: direct index for structure ( temp 4-component vector of float) +0:26 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:26 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:26 Constant: +0:26 0 (const uint) +0:26 direct index ( temp uint) +0:26 'dti' ( in 3-component vector of uint) +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 2 (const int) +0:26 Sequence +0:26 Constant: +0:26 0 (const int) +0:26 Constant: +0:26 1 (const int) +0:27 move second child to first child ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 subgroupAdd ( temp 3-component vector of float) +0:27 vector swizzle ( temp 3-component vector of float) +0:27 f: direct index for structure ( temp 4-component vector of float) +0:27 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:27 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:27 Constant: +0:27 0 (const uint) +0:27 direct index ( temp uint) +0:27 'dti' ( in 3-component vector of uint) +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 2 (const int) +0:27 Sequence +0:27 Constant: +0:27 0 (const int) +0:27 Constant: +0:27 1 (const int) +0:27 Constant: +0:27 2 (const int) +0:29 move second child to first child ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:29 subgroupAdd ( temp 4-component vector of double) +0:29 d: direct index for structure ( temp 4-component vector of double) +0:29 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:29 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:29 Constant: +0:29 0 (const uint) +0:29 direct index ( temp uint) +0:29 'dti' ( in 3-component vector of uint) +0:29 Constant: +0:29 0 (const int) +0:29 Constant: +0:29 3 (const int) +0:30 move second child to first child ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:30 subgroupAdd ( temp double) +0:30 direct index ( temp double) +0:30 d: direct index for structure ( temp 4-component vector of double) +0:30 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:30 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:30 Constant: +0:30 0 (const uint) +0:30 direct index ( temp uint) +0:30 'dti' ( in 3-component vector of uint) +0:30 Constant: +0:30 0 (const int) +0:30 Constant: +0:30 3 (const int) +0:30 Constant: +0:30 0 (const int) +0:31 move second child to first child ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:31 subgroupAdd ( temp 2-component vector of double) +0:31 vector swizzle ( temp 2-component vector of double) +0:31 d: direct index for structure ( temp 4-component vector of double) +0:31 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:31 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:31 Constant: +0:31 0 (const uint) +0:31 direct index ( temp uint) +0:31 'dti' ( in 3-component vector of uint) +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 3 (const int) +0:31 Sequence +0:31 Constant: +0:31 0 (const int) +0:31 Constant: +0:31 1 (const int) +0:32 move second child to first child ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:32 subgroupAdd ( temp 3-component vector of double) +0:32 vector swizzle ( temp 3-component vector of double) +0:32 d: direct index for structure ( temp 4-component vector of double) +0:32 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:32 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:32 Constant: +0:32 0 (const uint) +0:32 direct index ( temp uint) +0:32 'dti' ( in 3-component vector of uint) +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 3 (const int) +0:32 Sequence +0:32 Constant: +0:32 0 (const int) +0:32 Constant: +0:32 1 (const int) +0:32 Constant: +0:32 2 (const int) +0:34 move second child to first child ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:34 subgroupMul ( temp 4-component vector of uint) +0:34 u: direct index for structure ( temp 4-component vector of uint) +0:34 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:34 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:34 Constant: +0:34 0 (const uint) +0:34 direct index ( temp uint) +0:34 'dti' ( in 3-component vector of uint) +0:34 Constant: +0:34 0 (const int) +0:34 Constant: +0:34 0 (const int) +0:35 move second child to first child ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 subgroupMul ( temp uint) +0:35 direct index ( temp uint) +0:35 u: direct index for structure ( temp 4-component vector of uint) +0:35 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:35 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:35 Constant: +0:35 0 (const uint) +0:35 direct index ( temp uint) +0:35 'dti' ( in 3-component vector of uint) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:35 Constant: +0:35 0 (const int) +0:36 move second child to first child ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:36 subgroupMul ( temp 2-component vector of uint) +0:36 vector swizzle ( temp 2-component vector of uint) +0:36 u: direct index for structure ( temp 4-component vector of uint) +0:36 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:36 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:36 Constant: +0:36 0 (const uint) +0:36 direct index ( temp uint) +0:36 'dti' ( in 3-component vector of uint) +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 0 (const int) +0:36 Sequence +0:36 Constant: +0:36 0 (const int) +0:36 Constant: +0:36 1 (const int) +0:37 move second child to first child ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:37 subgroupMul ( temp 3-component vector of uint) +0:37 vector swizzle ( temp 3-component vector of uint) +0:37 u: direct index for structure ( temp 4-component vector of uint) +0:37 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:37 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:37 Constant: +0:37 0 (const uint) +0:37 direct index ( temp uint) +0:37 'dti' ( in 3-component vector of uint) +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 0 (const int) +0:37 Sequence +0:37 Constant: +0:37 0 (const int) +0:37 Constant: +0:37 1 (const int) +0:37 Constant: +0:37 2 (const int) +0:39 move second child to first child ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:39 subgroupMul ( temp 4-component vector of int) +0:39 i: direct index for structure ( temp 4-component vector of int) +0:39 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:39 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:39 Constant: +0:39 0 (const uint) +0:39 direct index ( temp uint) +0:39 'dti' ( in 3-component vector of uint) +0:39 Constant: +0:39 0 (const int) +0:39 Constant: +0:39 1 (const int) +0:40 move second child to first child ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:40 subgroupMul ( temp int) +0:40 direct index ( temp int) +0:40 i: direct index for structure ( temp 4-component vector of int) +0:40 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:40 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:40 Constant: +0:40 0 (const uint) +0:40 direct index ( temp uint) +0:40 'dti' ( in 3-component vector of uint) +0:40 Constant: +0:40 0 (const int) +0:40 Constant: +0:40 1 (const int) +0:40 Constant: +0:40 0 (const int) +0:41 move second child to first child ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 subgroupMul ( temp 2-component vector of int) +0:41 vector swizzle ( temp 2-component vector of int) +0:41 i: direct index for structure ( temp 4-component vector of int) +0:41 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:41 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:41 Constant: +0:41 0 (const uint) +0:41 direct index ( temp uint) +0:41 'dti' ( in 3-component vector of uint) +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:41 Sequence +0:41 Constant: +0:41 0 (const int) +0:41 Constant: +0:41 1 (const int) +0:42 move second child to first child ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:42 subgroupMul ( temp 3-component vector of int) +0:42 vector swizzle ( temp 3-component vector of int) +0:42 i: direct index for structure ( temp 4-component vector of int) +0:42 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:42 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:42 Constant: +0:42 0 (const uint) +0:42 direct index ( temp uint) +0:42 'dti' ( in 3-component vector of uint) +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Sequence +0:42 Constant: +0:42 0 (const int) +0:42 Constant: +0:42 1 (const int) +0:42 Constant: +0:42 2 (const int) +0:44 move second child to first child ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:44 subgroupMul ( temp 4-component vector of float) +0:44 f: direct index for structure ( temp 4-component vector of float) +0:44 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:44 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:44 Constant: +0:44 0 (const uint) +0:44 direct index ( temp uint) +0:44 'dti' ( in 3-component vector of uint) +0:44 Constant: +0:44 0 (const int) +0:44 Constant: +0:44 2 (const int) +0:45 move second child to first child ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:45 subgroupMul ( temp float) +0:45 direct index ( temp float) +0:45 f: direct index for structure ( temp 4-component vector of float) +0:45 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:45 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:45 Constant: +0:45 0 (const uint) +0:45 direct index ( temp uint) +0:45 'dti' ( in 3-component vector of uint) +0:45 Constant: +0:45 0 (const int) +0:45 Constant: +0:45 2 (const int) +0:45 Constant: +0:45 0 (const int) +0:46 move second child to first child ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:46 subgroupMul ( temp 2-component vector of float) +0:46 vector swizzle ( temp 2-component vector of float) +0:46 f: direct index for structure ( temp 4-component vector of float) +0:46 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:46 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:46 Constant: +0:46 0 (const uint) +0:46 direct index ( temp uint) +0:46 'dti' ( in 3-component vector of uint) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 2 (const int) +0:46 Sequence +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 1 (const int) +0:47 move second child to first child ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 subgroupMul ( temp 3-component vector of float) +0:47 vector swizzle ( temp 3-component vector of float) +0:47 f: direct index for structure ( temp 4-component vector of float) +0:47 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:47 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:47 Constant: +0:47 0 (const uint) +0:47 direct index ( temp uint) +0:47 'dti' ( in 3-component vector of uint) +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 2 (const int) +0:47 Sequence +0:47 Constant: +0:47 0 (const int) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 2 (const int) +0:49 move second child to first child ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:49 subgroupMul ( temp 4-component vector of double) +0:49 d: direct index for structure ( temp 4-component vector of double) +0:49 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:49 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:49 Constant: +0:49 0 (const uint) +0:49 direct index ( temp uint) +0:49 'dti' ( in 3-component vector of uint) +0:49 Constant: +0:49 0 (const int) +0:49 Constant: +0:49 3 (const int) +0:50 move second child to first child ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:50 subgroupMul ( temp double) +0:50 direct index ( temp double) +0:50 d: direct index for structure ( temp 4-component vector of double) +0:50 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:50 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:50 Constant: +0:50 0 (const uint) +0:50 direct index ( temp uint) +0:50 'dti' ( in 3-component vector of uint) +0:50 Constant: +0:50 0 (const int) +0:50 Constant: +0:50 3 (const int) +0:50 Constant: +0:50 0 (const int) +0:51 move second child to first child ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:51 subgroupMul ( temp 2-component vector of double) +0:51 vector swizzle ( temp 2-component vector of double) +0:51 d: direct index for structure ( temp 4-component vector of double) +0:51 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:51 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:51 Constant: +0:51 0 (const uint) +0:51 direct index ( temp uint) +0:51 'dti' ( in 3-component vector of uint) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:51 Sequence +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 1 (const int) +0:52 move second child to first child ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:52 subgroupMul ( temp 3-component vector of double) +0:52 vector swizzle ( temp 3-component vector of double) +0:52 d: direct index for structure ( temp 4-component vector of double) +0:52 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:52 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:52 Constant: +0:52 0 (const uint) +0:52 direct index ( temp uint) +0:52 'dti' ( in 3-component vector of uint) +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 3 (const int) +0:52 Sequence +0:52 Constant: +0:52 0 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 2 (const int) +0:54 move second child to first child ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:54 subgroupMin ( temp 4-component vector of uint) +0:54 u: direct index for structure ( temp 4-component vector of uint) +0:54 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:54 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:54 Constant: +0:54 0 (const uint) +0:54 direct index ( temp uint) +0:54 'dti' ( in 3-component vector of uint) +0:54 Constant: +0:54 0 (const int) +0:54 Constant: +0:54 0 (const int) +0:55 move second child to first child ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 subgroupMin ( temp uint) +0:55 direct index ( temp uint) +0:55 u: direct index for structure ( temp 4-component vector of uint) +0:55 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:55 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:55 Constant: +0:55 0 (const uint) +0:55 direct index ( temp uint) +0:55 'dti' ( in 3-component vector of uint) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:55 Constant: +0:55 0 (const int) +0:56 move second child to first child ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:56 subgroupMin ( temp 2-component vector of uint) +0:56 vector swizzle ( temp 2-component vector of uint) +0:56 u: direct index for structure ( temp 4-component vector of uint) +0:56 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:56 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:56 Constant: +0:56 0 (const uint) +0:56 direct index ( temp uint) +0:56 'dti' ( in 3-component vector of uint) +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 0 (const int) +0:56 Sequence +0:56 Constant: +0:56 0 (const int) +0:56 Constant: +0:56 1 (const int) +0:57 move second child to first child ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:57 subgroupMin ( temp 3-component vector of uint) +0:57 vector swizzle ( temp 3-component vector of uint) +0:57 u: direct index for structure ( temp 4-component vector of uint) +0:57 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:57 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:57 Constant: +0:57 0 (const uint) +0:57 direct index ( temp uint) +0:57 'dti' ( in 3-component vector of uint) +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 0 (const int) +0:57 Sequence +0:57 Constant: +0:57 0 (const int) +0:57 Constant: +0:57 1 (const int) +0:57 Constant: +0:57 2 (const int) +0:59 move second child to first child ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:59 subgroupMin ( temp 4-component vector of int) +0:59 i: direct index for structure ( temp 4-component vector of int) +0:59 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:59 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:59 Constant: +0:59 0 (const uint) +0:59 direct index ( temp uint) +0:59 'dti' ( in 3-component vector of uint) +0:59 Constant: +0:59 0 (const int) +0:59 Constant: +0:59 1 (const int) +0:60 move second child to first child ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:60 subgroupMin ( temp int) +0:60 direct index ( temp int) +0:60 i: direct index for structure ( temp 4-component vector of int) +0:60 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:60 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:60 Constant: +0:60 0 (const uint) +0:60 direct index ( temp uint) +0:60 'dti' ( in 3-component vector of uint) +0:60 Constant: +0:60 0 (const int) +0:60 Constant: +0:60 1 (const int) +0:60 Constant: +0:60 0 (const int) +0:61 move second child to first child ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 subgroupMin ( temp 2-component vector of int) +0:61 vector swizzle ( temp 2-component vector of int) +0:61 i: direct index for structure ( temp 4-component vector of int) +0:61 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:61 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:61 Constant: +0:61 0 (const uint) +0:61 direct index ( temp uint) +0:61 'dti' ( in 3-component vector of uint) +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:61 Sequence +0:61 Constant: +0:61 0 (const int) +0:61 Constant: +0:61 1 (const int) +0:62 move second child to first child ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:62 subgroupMin ( temp 3-component vector of int) +0:62 vector swizzle ( temp 3-component vector of int) +0:62 i: direct index for structure ( temp 4-component vector of int) +0:62 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:62 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:62 Constant: +0:62 0 (const uint) +0:62 direct index ( temp uint) +0:62 'dti' ( in 3-component vector of uint) +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Sequence +0:62 Constant: +0:62 0 (const int) +0:62 Constant: +0:62 1 (const int) +0:62 Constant: +0:62 2 (const int) +0:64 move second child to first child ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:64 subgroupMin ( temp 4-component vector of float) +0:64 f: direct index for structure ( temp 4-component vector of float) +0:64 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:64 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:64 Constant: +0:64 0 (const uint) +0:64 direct index ( temp uint) +0:64 'dti' ( in 3-component vector of uint) +0:64 Constant: +0:64 0 (const int) +0:64 Constant: +0:64 2 (const int) +0:65 move second child to first child ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:65 subgroupMin ( temp float) +0:65 direct index ( temp float) +0:65 f: direct index for structure ( temp 4-component vector of float) +0:65 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:65 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:65 Constant: +0:65 0 (const uint) +0:65 direct index ( temp uint) +0:65 'dti' ( in 3-component vector of uint) +0:65 Constant: +0:65 0 (const int) +0:65 Constant: +0:65 2 (const int) +0:65 Constant: +0:65 0 (const int) +0:66 move second child to first child ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:66 subgroupMin ( temp 2-component vector of float) +0:66 vector swizzle ( temp 2-component vector of float) +0:66 f: direct index for structure ( temp 4-component vector of float) +0:66 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:66 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:66 Constant: +0:66 0 (const uint) +0:66 direct index ( temp uint) +0:66 'dti' ( in 3-component vector of uint) +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 2 (const int) +0:66 Sequence +0:66 Constant: +0:66 0 (const int) +0:66 Constant: +0:66 1 (const int) +0:67 move second child to first child ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 subgroupMin ( temp 3-component vector of float) +0:67 vector swizzle ( temp 3-component vector of float) +0:67 f: direct index for structure ( temp 4-component vector of float) +0:67 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:67 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:67 Constant: +0:67 0 (const uint) +0:67 direct index ( temp uint) +0:67 'dti' ( in 3-component vector of uint) +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 2 (const int) +0:67 Sequence +0:67 Constant: +0:67 0 (const int) +0:67 Constant: +0:67 1 (const int) +0:67 Constant: +0:67 2 (const int) +0:69 move second child to first child ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:69 subgroupMin ( temp 4-component vector of double) +0:69 d: direct index for structure ( temp 4-component vector of double) +0:69 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:69 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:69 Constant: +0:69 0 (const uint) +0:69 direct index ( temp uint) +0:69 'dti' ( in 3-component vector of uint) +0:69 Constant: +0:69 0 (const int) +0:69 Constant: +0:69 3 (const int) +0:70 move second child to first child ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:70 subgroupMin ( temp double) +0:70 direct index ( temp double) +0:70 d: direct index for structure ( temp 4-component vector of double) +0:70 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:70 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:70 Constant: +0:70 0 (const uint) +0:70 direct index ( temp uint) +0:70 'dti' ( in 3-component vector of uint) +0:70 Constant: +0:70 0 (const int) +0:70 Constant: +0:70 3 (const int) +0:70 Constant: +0:70 0 (const int) +0:71 move second child to first child ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:71 subgroupMin ( temp 2-component vector of double) +0:71 vector swizzle ( temp 2-component vector of double) +0:71 d: direct index for structure ( temp 4-component vector of double) +0:71 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:71 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:71 Constant: +0:71 0 (const uint) +0:71 direct index ( temp uint) +0:71 'dti' ( in 3-component vector of uint) +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 3 (const int) +0:71 Sequence +0:71 Constant: +0:71 0 (const int) +0:71 Constant: +0:71 1 (const int) +0:72 move second child to first child ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:72 subgroupMin ( temp 3-component vector of double) +0:72 vector swizzle ( temp 3-component vector of double) +0:72 d: direct index for structure ( temp 4-component vector of double) +0:72 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:72 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:72 Constant: +0:72 0 (const uint) +0:72 direct index ( temp uint) +0:72 'dti' ( in 3-component vector of uint) +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 3 (const int) +0:72 Sequence +0:72 Constant: +0:72 0 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 2 (const int) +0:74 move second child to first child ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:74 subgroupMax ( temp 4-component vector of uint) +0:74 u: direct index for structure ( temp 4-component vector of uint) +0:74 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:74 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:74 Constant: +0:74 0 (const uint) +0:74 direct index ( temp uint) +0:74 'dti' ( in 3-component vector of uint) +0:74 Constant: +0:74 0 (const int) +0:74 Constant: +0:74 0 (const int) +0:75 move second child to first child ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 subgroupMax ( temp uint) +0:75 direct index ( temp uint) +0:75 u: direct index for structure ( temp 4-component vector of uint) +0:75 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:75 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:75 Constant: +0:75 0 (const uint) +0:75 direct index ( temp uint) +0:75 'dti' ( in 3-component vector of uint) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:75 Constant: +0:75 0 (const int) +0:76 move second child to first child ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:76 subgroupMax ( temp 2-component vector of uint) +0:76 vector swizzle ( temp 2-component vector of uint) +0:76 u: direct index for structure ( temp 4-component vector of uint) +0:76 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:76 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:76 Constant: +0:76 0 (const uint) +0:76 direct index ( temp uint) +0:76 'dti' ( in 3-component vector of uint) +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 0 (const int) +0:76 Sequence +0:76 Constant: +0:76 0 (const int) +0:76 Constant: +0:76 1 (const int) +0:77 move second child to first child ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:77 subgroupMax ( temp 3-component vector of uint) +0:77 vector swizzle ( temp 3-component vector of uint) +0:77 u: direct index for structure ( temp 4-component vector of uint) +0:77 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:77 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:77 Constant: +0:77 0 (const uint) +0:77 direct index ( temp uint) +0:77 'dti' ( in 3-component vector of uint) +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 0 (const int) +0:77 Sequence +0:77 Constant: +0:77 0 (const int) +0:77 Constant: +0:77 1 (const int) +0:77 Constant: +0:77 2 (const int) +0:79 move second child to first child ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:79 subgroupMax ( temp 4-component vector of int) +0:79 i: direct index for structure ( temp 4-component vector of int) +0:79 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:79 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:79 Constant: +0:79 0 (const uint) +0:79 direct index ( temp uint) +0:79 'dti' ( in 3-component vector of uint) +0:79 Constant: +0:79 0 (const int) +0:79 Constant: +0:79 1 (const int) +0:80 move second child to first child ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:80 subgroupMax ( temp int) +0:80 direct index ( temp int) +0:80 i: direct index for structure ( temp 4-component vector of int) +0:80 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:80 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:80 Constant: +0:80 0 (const uint) +0:80 direct index ( temp uint) +0:80 'dti' ( in 3-component vector of uint) +0:80 Constant: +0:80 0 (const int) +0:80 Constant: +0:80 1 (const int) +0:80 Constant: +0:80 0 (const int) +0:81 move second child to first child ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 subgroupMax ( temp 2-component vector of int) +0:81 vector swizzle ( temp 2-component vector of int) +0:81 i: direct index for structure ( temp 4-component vector of int) +0:81 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:81 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:81 Constant: +0:81 0 (const uint) +0:81 direct index ( temp uint) +0:81 'dti' ( in 3-component vector of uint) +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:81 Sequence +0:81 Constant: +0:81 0 (const int) +0:81 Constant: +0:81 1 (const int) +0:82 move second child to first child ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:82 subgroupMax ( temp 3-component vector of int) +0:82 vector swizzle ( temp 3-component vector of int) +0:82 i: direct index for structure ( temp 4-component vector of int) +0:82 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:82 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:82 Constant: +0:82 0 (const uint) +0:82 direct index ( temp uint) +0:82 'dti' ( in 3-component vector of uint) +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Sequence +0:82 Constant: +0:82 0 (const int) +0:82 Constant: +0:82 1 (const int) +0:82 Constant: +0:82 2 (const int) +0:84 move second child to first child ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:84 subgroupMax ( temp 4-component vector of float) +0:84 f: direct index for structure ( temp 4-component vector of float) +0:84 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:84 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:84 Constant: +0:84 0 (const uint) +0:84 direct index ( temp uint) +0:84 'dti' ( in 3-component vector of uint) +0:84 Constant: +0:84 0 (const int) +0:84 Constant: +0:84 2 (const int) +0:85 move second child to first child ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:85 subgroupMax ( temp float) +0:85 direct index ( temp float) +0:85 f: direct index for structure ( temp 4-component vector of float) +0:85 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:85 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:85 Constant: +0:85 0 (const uint) +0:85 direct index ( temp uint) +0:85 'dti' ( in 3-component vector of uint) +0:85 Constant: +0:85 0 (const int) +0:85 Constant: +0:85 2 (const int) +0:85 Constant: +0:85 0 (const int) +0:86 move second child to first child ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:86 subgroupMax ( temp 2-component vector of float) +0:86 vector swizzle ( temp 2-component vector of float) +0:86 f: direct index for structure ( temp 4-component vector of float) +0:86 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:86 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:86 Constant: +0:86 0 (const uint) +0:86 direct index ( temp uint) +0:86 'dti' ( in 3-component vector of uint) +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 2 (const int) +0:86 Sequence +0:86 Constant: +0:86 0 (const int) +0:86 Constant: +0:86 1 (const int) +0:87 move second child to first child ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 subgroupMax ( temp 3-component vector of float) +0:87 vector swizzle ( temp 3-component vector of float) +0:87 f: direct index for structure ( temp 4-component vector of float) +0:87 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:87 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:87 Constant: +0:87 0 (const uint) +0:87 direct index ( temp uint) +0:87 'dti' ( in 3-component vector of uint) +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 2 (const int) +0:87 Sequence +0:87 Constant: +0:87 0 (const int) +0:87 Constant: +0:87 1 (const int) +0:87 Constant: +0:87 2 (const int) +0:89 move second child to first child ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:89 subgroupMax ( temp 4-component vector of double) +0:89 d: direct index for structure ( temp 4-component vector of double) +0:89 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:89 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:89 Constant: +0:89 0 (const uint) +0:89 direct index ( temp uint) +0:89 'dti' ( in 3-component vector of uint) +0:89 Constant: +0:89 0 (const int) +0:89 Constant: +0:89 3 (const int) +0:90 move second child to first child ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:90 subgroupMax ( temp double) +0:90 direct index ( temp double) +0:90 d: direct index for structure ( temp 4-component vector of double) +0:90 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:90 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:90 Constant: +0:90 0 (const uint) +0:90 direct index ( temp uint) +0:90 'dti' ( in 3-component vector of uint) +0:90 Constant: +0:90 0 (const int) +0:90 Constant: +0:90 3 (const int) +0:90 Constant: +0:90 0 (const int) +0:91 move second child to first child ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:91 subgroupMax ( temp 2-component vector of double) +0:91 vector swizzle ( temp 2-component vector of double) +0:91 d: direct index for structure ( temp 4-component vector of double) +0:91 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:91 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:91 Constant: +0:91 0 (const uint) +0:91 direct index ( temp uint) +0:91 'dti' ( in 3-component vector of uint) +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 3 (const int) +0:91 Sequence +0:91 Constant: +0:91 0 (const int) +0:91 Constant: +0:91 1 (const int) +0:92 move second child to first child ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:92 subgroupMax ( temp 3-component vector of double) +0:92 vector swizzle ( temp 3-component vector of double) +0:92 d: direct index for structure ( temp 4-component vector of double) +0:92 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:92 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:92 Constant: +0:92 0 (const uint) +0:92 direct index ( temp uint) +0:92 'dti' ( in 3-component vector of uint) +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 3 (const int) +0:92 Sequence +0:92 Constant: +0:92 0 (const int) +0:92 Constant: +0:92 1 (const int) +0:92 Constant: +0:92 2 (const int) +0:94 move second child to first child ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:94 subgroupAnd ( temp 4-component vector of uint) +0:94 u: direct index for structure ( temp 4-component vector of uint) +0:94 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:94 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:94 Constant: +0:94 0 (const uint) +0:94 direct index ( temp uint) +0:94 'dti' ( in 3-component vector of uint) +0:94 Constant: +0:94 0 (const int) +0:94 Constant: +0:94 0 (const int) +0:95 move second child to first child ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 subgroupAnd ( temp uint) +0:95 direct index ( temp uint) +0:95 u: direct index for structure ( temp 4-component vector of uint) +0:95 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:95 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:95 Constant: +0:95 0 (const uint) +0:95 direct index ( temp uint) +0:95 'dti' ( in 3-component vector of uint) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:95 Constant: +0:95 0 (const int) +0:96 move second child to first child ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:96 subgroupAnd ( temp 2-component vector of uint) +0:96 vector swizzle ( temp 2-component vector of uint) +0:96 u: direct index for structure ( temp 4-component vector of uint) +0:96 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:96 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:96 Constant: +0:96 0 (const uint) +0:96 direct index ( temp uint) +0:96 'dti' ( in 3-component vector of uint) +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 0 (const int) +0:96 Sequence +0:96 Constant: +0:96 0 (const int) +0:96 Constant: +0:96 1 (const int) +0:97 move second child to first child ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:97 subgroupAnd ( temp 3-component vector of uint) +0:97 vector swizzle ( temp 3-component vector of uint) +0:97 u: direct index for structure ( temp 4-component vector of uint) +0:97 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:97 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:97 Constant: +0:97 0 (const uint) +0:97 direct index ( temp uint) +0:97 'dti' ( in 3-component vector of uint) +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 0 (const int) +0:97 Sequence +0:97 Constant: +0:97 0 (const int) +0:97 Constant: +0:97 1 (const int) +0:97 Constant: +0:97 2 (const int) +0:99 move second child to first child ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:99 subgroupAnd ( temp 4-component vector of int) +0:99 i: direct index for structure ( temp 4-component vector of int) +0:99 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:99 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:99 Constant: +0:99 0 (const uint) +0:99 direct index ( temp uint) +0:99 'dti' ( in 3-component vector of uint) +0:99 Constant: +0:99 0 (const int) +0:99 Constant: +0:99 1 (const int) +0:100 move second child to first child ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:100 subgroupAnd ( temp int) +0:100 direct index ( temp int) +0:100 i: direct index for structure ( temp 4-component vector of int) +0:100 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:100 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:100 Constant: +0:100 0 (const uint) +0:100 direct index ( temp uint) +0:100 'dti' ( in 3-component vector of uint) +0:100 Constant: +0:100 0 (const int) +0:100 Constant: +0:100 1 (const int) +0:100 Constant: +0:100 0 (const int) +0:101 move second child to first child ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 subgroupAnd ( temp 2-component vector of int) +0:101 vector swizzle ( temp 2-component vector of int) +0:101 i: direct index for structure ( temp 4-component vector of int) +0:101 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:101 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:101 Constant: +0:101 0 (const uint) +0:101 direct index ( temp uint) +0:101 'dti' ( in 3-component vector of uint) +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:101 Sequence +0:101 Constant: +0:101 0 (const int) +0:101 Constant: +0:101 1 (const int) +0:102 move second child to first child ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:102 subgroupAnd ( temp 3-component vector of int) +0:102 vector swizzle ( temp 3-component vector of int) +0:102 i: direct index for structure ( temp 4-component vector of int) +0:102 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:102 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:102 Constant: +0:102 0 (const uint) +0:102 direct index ( temp uint) +0:102 'dti' ( in 3-component vector of uint) +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Sequence +0:102 Constant: +0:102 0 (const int) +0:102 Constant: +0:102 1 (const int) +0:102 Constant: +0:102 2 (const int) +0:104 move second child to first child ( temp 4-component vector of uint) +0:104 u: direct index for structure ( temp 4-component vector of uint) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 0 (const int) +0:104 subgroupOr ( temp 4-component vector of uint) +0:104 u: direct index for structure ( temp 4-component vector of uint) +0:104 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:104 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:104 Constant: +0:104 0 (const uint) +0:104 direct index ( temp uint) +0:104 'dti' ( in 3-component vector of uint) +0:104 Constant: +0:104 0 (const int) +0:104 Constant: +0:104 0 (const int) +0:105 move second child to first child ( temp uint) +0:105 direct index ( temp uint) +0:105 u: direct index for structure ( temp 4-component vector of uint) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 subgroupOr ( temp uint) +0:105 direct index ( temp uint) +0:105 u: direct index for structure ( temp 4-component vector of uint) +0:105 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:105 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:105 Constant: +0:105 0 (const uint) +0:105 direct index ( temp uint) +0:105 'dti' ( in 3-component vector of uint) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:105 Constant: +0:105 0 (const int) +0:106 move second child to first child ( temp 2-component vector of uint) +0:106 vector swizzle ( temp 2-component vector of uint) +0:106 u: direct index for structure ( temp 4-component vector of uint) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 0 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:106 subgroupOr ( temp 2-component vector of uint) +0:106 vector swizzle ( temp 2-component vector of uint) +0:106 u: direct index for structure ( temp 4-component vector of uint) +0:106 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:106 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:106 Constant: +0:106 0 (const uint) +0:106 direct index ( temp uint) +0:106 'dti' ( in 3-component vector of uint) +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 0 (const int) +0:106 Sequence +0:106 Constant: +0:106 0 (const int) +0:106 Constant: +0:106 1 (const int) +0:107 move second child to first child ( temp 3-component vector of uint) +0:107 vector swizzle ( temp 3-component vector of uint) +0:107 u: direct index for structure ( temp 4-component vector of uint) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 0 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:107 subgroupOr ( temp 3-component vector of uint) +0:107 vector swizzle ( temp 3-component vector of uint) +0:107 u: direct index for structure ( temp 4-component vector of uint) +0:107 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:107 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:107 Constant: +0:107 0 (const uint) +0:107 direct index ( temp uint) +0:107 'dti' ( in 3-component vector of uint) +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 0 (const int) +0:107 Sequence +0:107 Constant: +0:107 0 (const int) +0:107 Constant: +0:107 1 (const int) +0:107 Constant: +0:107 2 (const int) +0:109 move second child to first child ( temp 4-component vector of int) +0:109 i: direct index for structure ( temp 4-component vector of int) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 1 (const int) +0:109 subgroupOr ( temp 4-component vector of int) +0:109 i: direct index for structure ( temp 4-component vector of int) +0:109 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:109 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:109 Constant: +0:109 0 (const uint) +0:109 direct index ( temp uint) +0:109 'dti' ( in 3-component vector of uint) +0:109 Constant: +0:109 0 (const int) +0:109 Constant: +0:109 1 (const int) +0:110 move second child to first child ( temp int) +0:110 direct index ( temp int) +0:110 i: direct index for structure ( temp 4-component vector of int) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 1 (const int) +0:110 Constant: +0:110 0 (const int) +0:110 subgroupOr ( temp int) +0:110 direct index ( temp int) +0:110 i: direct index for structure ( temp 4-component vector of int) +0:110 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:110 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:110 Constant: +0:110 0 (const uint) +0:110 direct index ( temp uint) +0:110 'dti' ( in 3-component vector of uint) +0:110 Constant: +0:110 0 (const int) +0:110 Constant: +0:110 1 (const int) +0:110 Constant: +0:110 0 (const int) +0:111 move second child to first child ( temp 2-component vector of int) +0:111 vector swizzle ( temp 2-component vector of int) +0:111 i: direct index for structure ( temp 4-component vector of int) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 subgroupOr ( temp 2-component vector of int) +0:111 vector swizzle ( temp 2-component vector of int) +0:111 i: direct index for structure ( temp 4-component vector of int) +0:111 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:111 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:111 Constant: +0:111 0 (const uint) +0:111 direct index ( temp uint) +0:111 'dti' ( in 3-component vector of uint) +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:111 Sequence +0:111 Constant: +0:111 0 (const int) +0:111 Constant: +0:111 1 (const int) +0:112 move second child to first child ( temp 3-component vector of int) +0:112 vector swizzle ( temp 3-component vector of int) +0:112 i: direct index for structure ( temp 4-component vector of int) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:112 subgroupOr ( temp 3-component vector of int) +0:112 vector swizzle ( temp 3-component vector of int) +0:112 i: direct index for structure ( temp 4-component vector of int) +0:112 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:112 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:112 Constant: +0:112 0 (const uint) +0:112 direct index ( temp uint) +0:112 'dti' ( in 3-component vector of uint) +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Sequence +0:112 Constant: +0:112 0 (const int) +0:112 Constant: +0:112 1 (const int) +0:112 Constant: +0:112 2 (const int) +0:114 move second child to first child ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:114 subgroupXor ( temp 4-component vector of uint) +0:114 u: direct index for structure ( temp 4-component vector of uint) +0:114 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:114 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:114 Constant: +0:114 0 (const uint) +0:114 direct index ( temp uint) +0:114 'dti' ( in 3-component vector of uint) +0:114 Constant: +0:114 0 (const int) +0:114 Constant: +0:114 0 (const int) +0:115 move second child to first child ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 subgroupXor ( temp uint) +0:115 direct index ( temp uint) +0:115 u: direct index for structure ( temp 4-component vector of uint) +0:115 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:115 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:115 Constant: +0:115 0 (const uint) +0:115 direct index ( temp uint) +0:115 'dti' ( in 3-component vector of uint) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:115 Constant: +0:115 0 (const int) +0:116 move second child to first child ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:116 subgroupXor ( temp 2-component vector of uint) +0:116 vector swizzle ( temp 2-component vector of uint) +0:116 u: direct index for structure ( temp 4-component vector of uint) +0:116 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:116 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:116 Constant: +0:116 0 (const uint) +0:116 direct index ( temp uint) +0:116 'dti' ( in 3-component vector of uint) +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 0 (const int) +0:116 Sequence +0:116 Constant: +0:116 0 (const int) +0:116 Constant: +0:116 1 (const int) +0:117 move second child to first child ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:117 subgroupXor ( temp 3-component vector of uint) +0:117 vector swizzle ( temp 3-component vector of uint) +0:117 u: direct index for structure ( temp 4-component vector of uint) +0:117 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:117 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:117 Constant: +0:117 0 (const uint) +0:117 direct index ( temp uint) +0:117 'dti' ( in 3-component vector of uint) +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 0 (const int) +0:117 Sequence +0:117 Constant: +0:117 0 (const int) +0:117 Constant: +0:117 1 (const int) +0:117 Constant: +0:117 2 (const int) +0:119 move second child to first child ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:119 subgroupXor ( temp 4-component vector of int) +0:119 i: direct index for structure ( temp 4-component vector of int) +0:119 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:119 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:119 Constant: +0:119 0 (const uint) +0:119 direct index ( temp uint) +0:119 'dti' ( in 3-component vector of uint) +0:119 Constant: +0:119 0 (const int) +0:119 Constant: +0:119 1 (const int) +0:120 move second child to first child ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:120 subgroupXor ( temp int) +0:120 direct index ( temp int) +0:120 i: direct index for structure ( temp 4-component vector of int) +0:120 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:120 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:120 Constant: +0:120 0 (const uint) +0:120 direct index ( temp uint) +0:120 'dti' ( in 3-component vector of uint) +0:120 Constant: +0:120 0 (const int) +0:120 Constant: +0:120 1 (const int) +0:120 Constant: +0:120 0 (const int) +0:121 move second child to first child ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 subgroupXor ( temp 2-component vector of int) +0:121 vector swizzle ( temp 2-component vector of int) +0:121 i: direct index for structure ( temp 4-component vector of int) +0:121 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:121 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:121 Constant: +0:121 0 (const uint) +0:121 direct index ( temp uint) +0:121 'dti' ( in 3-component vector of uint) +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:121 Sequence +0:121 Constant: +0:121 0 (const int) +0:121 Constant: +0:121 1 (const int) +0:122 move second child to first child ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:122 subgroupXor ( temp 3-component vector of int) +0:122 vector swizzle ( temp 3-component vector of int) +0:122 i: direct index for structure ( temp 4-component vector of int) +0:122 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:122 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:122 Constant: +0:122 0 (const uint) +0:122 direct index ( temp uint) +0:122 'dti' ( in 3-component vector of uint) +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Sequence +0:122 Constant: +0:122 0 (const int) +0:122 Constant: +0:122 1 (const int) +0:122 Constant: +0:122 2 (const int) +0:124 move second child to first child ( temp uint) +0:124 direct index ( temp uint) +0:124 u: direct index for structure ( temp 4-component vector of uint) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 subgroupBallotBitCount ( temp uint) +0:124 subgroupBallot ( temp 4-component vector of uint) +0:124 Compare Equal ( temp bool) +0:124 direct index ( temp uint) +0:124 u: direct index for structure ( temp 4-component vector of uint) +0:124 indirect index (layout( row_major std430) buffer structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d}) +0:124 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:124 Constant: +0:124 0 (const uint) +0:124 direct index ( temp uint) +0:124 'dti' ( in 3-component vector of uint) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const int) +0:124 Constant: +0:124 0 (const uint) +0:13 Function Definition: CSMain( ( temp void) +0:13 Function Parameters: +0:? Sequence +0:13 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:13 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of uint u, temp 4-component vector of int i, temp 4-component vector of float f, temp 4-component vector of double d} @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 901 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformArithmetic + Capability GroupNonUniformBallot + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "CSMain" 896 + ExecutionMode 4 LocalSize 32 16 1 + Source HLSL 500 + Name 4 "CSMain" + Name 11 "@CSMain(vu3;" + Name 10 "dti" + Name 20 "Types" + MemberName 20(Types) 0 "u" + MemberName 20(Types) 1 "i" + MemberName 20(Types) 2 "f" + MemberName 20(Types) 3 "d" + Name 22 "data" + MemberName 22(data) 0 "@data" + Name 24 "data" + Name 894 "dti" + Name 896 "dti" + Name 898 "param" + MemberDecorate 20(Types) 0 Offset 0 + MemberDecorate 20(Types) 1 Offset 16 + MemberDecorate 20(Types) 2 Offset 32 + MemberDecorate 20(Types) 3 Offset 64 + Decorate 21 ArrayStride 96 + MemberDecorate 22(data) 0 Offset 0 + Decorate 22(data) BufferBlock + Decorate 24(data) DescriptorSet 0 + Decorate 896(dti) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: TypeVector 6(int) 4 + 14: TypeInt 32 1 + 15: TypeVector 14(int) 4 + 16: TypeFloat 32 + 17: TypeVector 16(float) 4 + 18: TypeFloat 64 + 19: TypeVector 18(float64_t) 4 + 20(Types): TypeStruct 13(ivec4) 15(ivec4) 17(fvec4) 19(f64vec4) + 21: TypeRuntimeArray 20(Types) + 22(data): TypeStruct 21 + 23: TypePointer Uniform 22(data) + 24(data): 23(ptr) Variable Uniform + 25: 14(int) Constant 0 + 26: 6(int) Constant 0 + 27: TypePointer Function 6(int) + 32: TypePointer Uniform 13(ivec4) + 35: 6(int) Constant 3 + 42: TypePointer Uniform 6(int) + 51: TypeVector 6(int) 2 + 72: 14(int) Constant 1 + 75: TypePointer Uniform 15(ivec4) + 84: TypePointer Uniform 14(int) + 93: TypeVector 14(int) 2 + 105: TypeVector 14(int) 3 + 115: 14(int) Constant 2 + 118: TypePointer Uniform 17(fvec4) + 127: TypePointer Uniform 16(float) + 136: TypeVector 16(float) 2 + 148: TypeVector 16(float) 3 + 158: 14(int) Constant 3 + 161: TypePointer Uniform 19(f64vec4) + 170: TypePointer Uniform 18(float64_t) + 179: TypeVector 18(float64_t) 2 + 191: TypeVector 18(float64_t) 3 + 889: TypeBool + 895: TypePointer Input 7(ivec3) + 896(dti): 895(ptr) Variable Input + 4(CSMain): 2 Function None 3 + 5: Label + 894(dti): 8(ptr) Variable Function + 898(param): 8(ptr) Variable Function + 897: 7(ivec3) Load 896(dti) + Store 894(dti) 897 + 899: 7(ivec3) Load 894(dti) + Store 898(param) 899 + 900: 2 FunctionCall 11(@CSMain(vu3;) 898(param) + Return + FunctionEnd +11(@CSMain(vu3;): 2 Function None 9 + 10(dti): 8(ptr) FunctionParameter + 12: Label + 28: 27(ptr) AccessChain 10(dti) 26 + 29: 6(int) Load 28 + 30: 27(ptr) AccessChain 10(dti) 26 + 31: 6(int) Load 30 + 33: 32(ptr) AccessChain 24(data) 25 31 25 + 34: 13(ivec4) Load 33 + 36: 13(ivec4) GroupNonUniformIAdd 35 Reduce 34 + 37: 32(ptr) AccessChain 24(data) 25 29 25 + Store 37 36 + 38: 27(ptr) AccessChain 10(dti) 26 + 39: 6(int) Load 38 + 40: 27(ptr) AccessChain 10(dti) 26 + 41: 6(int) Load 40 + 43: 42(ptr) AccessChain 24(data) 25 41 25 26 + 44: 6(int) Load 43 + 45: 6(int) GroupNonUniformIAdd 35 Reduce 44 + 46: 42(ptr) AccessChain 24(data) 25 39 25 26 + Store 46 45 + 47: 27(ptr) AccessChain 10(dti) 26 + 48: 6(int) Load 47 + 49: 27(ptr) AccessChain 10(dti) 26 + 50: 6(int) Load 49 + 52: 32(ptr) AccessChain 24(data) 25 50 25 + 53: 13(ivec4) Load 52 + 54: 51(ivec2) VectorShuffle 53 53 0 1 + 55: 51(ivec2) GroupNonUniformIAdd 35 Reduce 54 + 56: 32(ptr) AccessChain 24(data) 25 48 25 + 57: 13(ivec4) Load 56 + 58: 13(ivec4) VectorShuffle 57 55 4 5 2 3 + Store 56 58 + 59: 27(ptr) AccessChain 10(dti) 26 + 60: 6(int) Load 59 + 61: 27(ptr) AccessChain 10(dti) 26 + 62: 6(int) Load 61 + 63: 32(ptr) AccessChain 24(data) 25 62 25 + 64: 13(ivec4) Load 63 + 65: 7(ivec3) VectorShuffle 64 64 0 1 2 + 66: 7(ivec3) GroupNonUniformIAdd 35 Reduce 65 + 67: 32(ptr) AccessChain 24(data) 25 60 25 + 68: 13(ivec4) Load 67 + 69: 13(ivec4) VectorShuffle 68 66 4 5 6 3 + Store 67 69 + 70: 27(ptr) AccessChain 10(dti) 26 + 71: 6(int) Load 70 + 73: 27(ptr) AccessChain 10(dti) 26 + 74: 6(int) Load 73 + 76: 75(ptr) AccessChain 24(data) 25 74 72 + 77: 15(ivec4) Load 76 + 78: 15(ivec4) GroupNonUniformIAdd 35 Reduce 77 + 79: 75(ptr) AccessChain 24(data) 25 71 72 + Store 79 78 + 80: 27(ptr) AccessChain 10(dti) 26 + 81: 6(int) Load 80 + 82: 27(ptr) AccessChain 10(dti) 26 + 83: 6(int) Load 82 + 85: 84(ptr) AccessChain 24(data) 25 83 72 26 + 86: 14(int) Load 85 + 87: 14(int) GroupNonUniformIAdd 35 Reduce 86 + 88: 84(ptr) AccessChain 24(data) 25 81 72 26 + Store 88 87 + 89: 27(ptr) AccessChain 10(dti) 26 + 90: 6(int) Load 89 + 91: 27(ptr) AccessChain 10(dti) 26 + 92: 6(int) Load 91 + 94: 75(ptr) AccessChain 24(data) 25 92 72 + 95: 15(ivec4) Load 94 + 96: 93(ivec2) VectorShuffle 95 95 0 1 + 97: 93(ivec2) GroupNonUniformIAdd 35 Reduce 96 + 98: 75(ptr) AccessChain 24(data) 25 90 72 + 99: 15(ivec4) Load 98 + 100: 15(ivec4) VectorShuffle 99 97 4 5 2 3 + Store 98 100 + 101: 27(ptr) AccessChain 10(dti) 26 + 102: 6(int) Load 101 + 103: 27(ptr) AccessChain 10(dti) 26 + 104: 6(int) Load 103 + 106: 75(ptr) AccessChain 24(data) 25 104 72 + 107: 15(ivec4) Load 106 + 108: 105(ivec3) VectorShuffle 107 107 0 1 2 + 109: 105(ivec3) GroupNonUniformIAdd 35 Reduce 108 + 110: 75(ptr) AccessChain 24(data) 25 102 72 + 111: 15(ivec4) Load 110 + 112: 15(ivec4) VectorShuffle 111 109 4 5 6 3 + Store 110 112 + 113: 27(ptr) AccessChain 10(dti) 26 + 114: 6(int) Load 113 + 116: 27(ptr) AccessChain 10(dti) 26 + 117: 6(int) Load 116 + 119: 118(ptr) AccessChain 24(data) 25 117 115 + 120: 17(fvec4) Load 119 + 121: 17(fvec4) GroupNonUniformFAdd 35 Reduce 120 + 122: 118(ptr) AccessChain 24(data) 25 114 115 + Store 122 121 + 123: 27(ptr) AccessChain 10(dti) 26 + 124: 6(int) Load 123 + 125: 27(ptr) AccessChain 10(dti) 26 + 126: 6(int) Load 125 + 128: 127(ptr) AccessChain 24(data) 25 126 115 26 + 129: 16(float) Load 128 + 130: 16(float) GroupNonUniformFAdd 35 Reduce 129 + 131: 127(ptr) AccessChain 24(data) 25 124 115 26 + Store 131 130 + 132: 27(ptr) AccessChain 10(dti) 26 + 133: 6(int) Load 132 + 134: 27(ptr) AccessChain 10(dti) 26 + 135: 6(int) Load 134 + 137: 118(ptr) AccessChain 24(data) 25 135 115 + 138: 17(fvec4) Load 137 + 139: 136(fvec2) VectorShuffle 138 138 0 1 + 140: 136(fvec2) GroupNonUniformFAdd 35 Reduce 139 + 141: 118(ptr) AccessChain 24(data) 25 133 115 + 142: 17(fvec4) Load 141 + 143: 17(fvec4) VectorShuffle 142 140 4 5 2 3 + Store 141 143 + 144: 27(ptr) AccessChain 10(dti) 26 + 145: 6(int) Load 144 + 146: 27(ptr) AccessChain 10(dti) 26 + 147: 6(int) Load 146 + 149: 118(ptr) AccessChain 24(data) 25 147 115 + 150: 17(fvec4) Load 149 + 151: 148(fvec3) VectorShuffle 150 150 0 1 2 + 152: 148(fvec3) GroupNonUniformFAdd 35 Reduce 151 + 153: 118(ptr) AccessChain 24(data) 25 145 115 + 154: 17(fvec4) Load 153 + 155: 17(fvec4) VectorShuffle 154 152 4 5 6 3 + Store 153 155 + 156: 27(ptr) AccessChain 10(dti) 26 + 157: 6(int) Load 156 + 159: 27(ptr) AccessChain 10(dti) 26 + 160: 6(int) Load 159 + 162: 161(ptr) AccessChain 24(data) 25 160 158 + 163: 19(f64vec4) Load 162 + 164: 19(f64vec4) GroupNonUniformFAdd 35 Reduce 163 + 165: 161(ptr) AccessChain 24(data) 25 157 158 + Store 165 164 + 166: 27(ptr) AccessChain 10(dti) 26 + 167: 6(int) Load 166 + 168: 27(ptr) AccessChain 10(dti) 26 + 169: 6(int) Load 168 + 171: 170(ptr) AccessChain 24(data) 25 169 158 26 + 172:18(float64_t) Load 171 + 173:18(float64_t) GroupNonUniformFAdd 35 Reduce 172 + 174: 170(ptr) AccessChain 24(data) 25 167 158 26 + Store 174 173 + 175: 27(ptr) AccessChain 10(dti) 26 + 176: 6(int) Load 175 + 177: 27(ptr) AccessChain 10(dti) 26 + 178: 6(int) Load 177 + 180: 161(ptr) AccessChain 24(data) 25 178 158 + 181: 19(f64vec4) Load 180 + 182:179(f64vec2) VectorShuffle 181 181 0 1 + 183:179(f64vec2) GroupNonUniformFAdd 35 Reduce 182 + 184: 161(ptr) AccessChain 24(data) 25 176 158 + 185: 19(f64vec4) Load 184 + 186: 19(f64vec4) VectorShuffle 185 183 4 5 2 3 + Store 184 186 + 187: 27(ptr) AccessChain 10(dti) 26 + 188: 6(int) Load 187 + 189: 27(ptr) AccessChain 10(dti) 26 + 190: 6(int) Load 189 + 192: 161(ptr) AccessChain 24(data) 25 190 158 + 193: 19(f64vec4) Load 192 + 194:191(f64vec3) VectorShuffle 193 193 0 1 2 + 195:191(f64vec3) GroupNonUniformFAdd 35 Reduce 194 + 196: 161(ptr) AccessChain 24(data) 25 188 158 + 197: 19(f64vec4) Load 196 + 198: 19(f64vec4) VectorShuffle 197 195 4 5 6 3 + Store 196 198 + 199: 27(ptr) AccessChain 10(dti) 26 + 200: 6(int) Load 199 + 201: 27(ptr) AccessChain 10(dti) 26 + 202: 6(int) Load 201 + 203: 32(ptr) AccessChain 24(data) 25 202 25 + 204: 13(ivec4) Load 203 + 205: 13(ivec4) GroupNonUniformIMul 35 Reduce 204 + 206: 32(ptr) AccessChain 24(data) 25 200 25 + Store 206 205 + 207: 27(ptr) AccessChain 10(dti) 26 + 208: 6(int) Load 207 + 209: 27(ptr) AccessChain 10(dti) 26 + 210: 6(int) Load 209 + 211: 42(ptr) AccessChain 24(data) 25 210 25 26 + 212: 6(int) Load 211 + 213: 6(int) GroupNonUniformIMul 35 Reduce 212 + 214: 42(ptr) AccessChain 24(data) 25 208 25 26 + Store 214 213 + 215: 27(ptr) AccessChain 10(dti) 26 + 216: 6(int) Load 215 + 217: 27(ptr) AccessChain 10(dti) 26 + 218: 6(int) Load 217 + 219: 32(ptr) AccessChain 24(data) 25 218 25 + 220: 13(ivec4) Load 219 + 221: 51(ivec2) VectorShuffle 220 220 0 1 + 222: 51(ivec2) GroupNonUniformIMul 35 Reduce 221 + 223: 32(ptr) AccessChain 24(data) 25 216 25 + 224: 13(ivec4) Load 223 + 225: 13(ivec4) VectorShuffle 224 222 4 5 2 3 + Store 223 225 + 226: 27(ptr) AccessChain 10(dti) 26 + 227: 6(int) Load 226 + 228: 27(ptr) AccessChain 10(dti) 26 + 229: 6(int) Load 228 + 230: 32(ptr) AccessChain 24(data) 25 229 25 + 231: 13(ivec4) Load 230 + 232: 7(ivec3) VectorShuffle 231 231 0 1 2 + 233: 7(ivec3) GroupNonUniformIMul 35 Reduce 232 + 234: 32(ptr) AccessChain 24(data) 25 227 25 + 235: 13(ivec4) Load 234 + 236: 13(ivec4) VectorShuffle 235 233 4 5 6 3 + Store 234 236 + 237: 27(ptr) AccessChain 10(dti) 26 + 238: 6(int) Load 237 + 239: 27(ptr) AccessChain 10(dti) 26 + 240: 6(int) Load 239 + 241: 75(ptr) AccessChain 24(data) 25 240 72 + 242: 15(ivec4) Load 241 + 243: 15(ivec4) GroupNonUniformIMul 35 Reduce 242 + 244: 75(ptr) AccessChain 24(data) 25 238 72 + Store 244 243 + 245: 27(ptr) AccessChain 10(dti) 26 + 246: 6(int) Load 245 + 247: 27(ptr) AccessChain 10(dti) 26 + 248: 6(int) Load 247 + 249: 84(ptr) AccessChain 24(data) 25 248 72 26 + 250: 14(int) Load 249 + 251: 14(int) GroupNonUniformIMul 35 Reduce 250 + 252: 84(ptr) AccessChain 24(data) 25 246 72 26 + Store 252 251 + 253: 27(ptr) AccessChain 10(dti) 26 + 254: 6(int) Load 253 + 255: 27(ptr) AccessChain 10(dti) 26 + 256: 6(int) Load 255 + 257: 75(ptr) AccessChain 24(data) 25 256 72 + 258: 15(ivec4) Load 257 + 259: 93(ivec2) VectorShuffle 258 258 0 1 + 260: 93(ivec2) GroupNonUniformIMul 35 Reduce 259 + 261: 75(ptr) AccessChain 24(data) 25 254 72 + 262: 15(ivec4) Load 261 + 263: 15(ivec4) VectorShuffle 262 260 4 5 2 3 + Store 261 263 + 264: 27(ptr) AccessChain 10(dti) 26 + 265: 6(int) Load 264 + 266: 27(ptr) AccessChain 10(dti) 26 + 267: 6(int) Load 266 + 268: 75(ptr) AccessChain 24(data) 25 267 72 + 269: 15(ivec4) Load 268 + 270: 105(ivec3) VectorShuffle 269 269 0 1 2 + 271: 105(ivec3) GroupNonUniformIMul 35 Reduce 270 + 272: 75(ptr) AccessChain 24(data) 25 265 72 + 273: 15(ivec4) Load 272 + 274: 15(ivec4) VectorShuffle 273 271 4 5 6 3 + Store 272 274 + 275: 27(ptr) AccessChain 10(dti) 26 + 276: 6(int) Load 275 + 277: 27(ptr) AccessChain 10(dti) 26 + 278: 6(int) Load 277 + 279: 118(ptr) AccessChain 24(data) 25 278 115 + 280: 17(fvec4) Load 279 + 281: 17(fvec4) GroupNonUniformFMul 35 Reduce 280 + 282: 118(ptr) AccessChain 24(data) 25 276 115 + Store 282 281 + 283: 27(ptr) AccessChain 10(dti) 26 + 284: 6(int) Load 283 + 285: 27(ptr) AccessChain 10(dti) 26 + 286: 6(int) Load 285 + 287: 127(ptr) AccessChain 24(data) 25 286 115 26 + 288: 16(float) Load 287 + 289: 16(float) GroupNonUniformFMul 35 Reduce 288 + 290: 127(ptr) AccessChain 24(data) 25 284 115 26 + Store 290 289 + 291: 27(ptr) AccessChain 10(dti) 26 + 292: 6(int) Load 291 + 293: 27(ptr) AccessChain 10(dti) 26 + 294: 6(int) Load 293 + 295: 118(ptr) AccessChain 24(data) 25 294 115 + 296: 17(fvec4) Load 295 + 297: 136(fvec2) VectorShuffle 296 296 0 1 + 298: 136(fvec2) GroupNonUniformFMul 35 Reduce 297 + 299: 118(ptr) AccessChain 24(data) 25 292 115 + 300: 17(fvec4) Load 299 + 301: 17(fvec4) VectorShuffle 300 298 4 5 2 3 + Store 299 301 + 302: 27(ptr) AccessChain 10(dti) 26 + 303: 6(int) Load 302 + 304: 27(ptr) AccessChain 10(dti) 26 + 305: 6(int) Load 304 + 306: 118(ptr) AccessChain 24(data) 25 305 115 + 307: 17(fvec4) Load 306 + 308: 148(fvec3) VectorShuffle 307 307 0 1 2 + 309: 148(fvec3) GroupNonUniformFMul 35 Reduce 308 + 310: 118(ptr) AccessChain 24(data) 25 303 115 + 311: 17(fvec4) Load 310 + 312: 17(fvec4) VectorShuffle 311 309 4 5 6 3 + Store 310 312 + 313: 27(ptr) AccessChain 10(dti) 26 + 314: 6(int) Load 313 + 315: 27(ptr) AccessChain 10(dti) 26 + 316: 6(int) Load 315 + 317: 161(ptr) AccessChain 24(data) 25 316 158 + 318: 19(f64vec4) Load 317 + 319: 19(f64vec4) GroupNonUniformFMul 35 Reduce 318 + 320: 161(ptr) AccessChain 24(data) 25 314 158 + Store 320 319 + 321: 27(ptr) AccessChain 10(dti) 26 + 322: 6(int) Load 321 + 323: 27(ptr) AccessChain 10(dti) 26 + 324: 6(int) Load 323 + 325: 170(ptr) AccessChain 24(data) 25 324 158 26 + 326:18(float64_t) Load 325 + 327:18(float64_t) GroupNonUniformFMul 35 Reduce 326 + 328: 170(ptr) AccessChain 24(data) 25 322 158 26 + Store 328 327 + 329: 27(ptr) AccessChain 10(dti) 26 + 330: 6(int) Load 329 + 331: 27(ptr) AccessChain 10(dti) 26 + 332: 6(int) Load 331 + 333: 161(ptr) AccessChain 24(data) 25 332 158 + 334: 19(f64vec4) Load 333 + 335:179(f64vec2) VectorShuffle 334 334 0 1 + 336:179(f64vec2) GroupNonUniformFMul 35 Reduce 335 + 337: 161(ptr) AccessChain 24(data) 25 330 158 + 338: 19(f64vec4) Load 337 + 339: 19(f64vec4) VectorShuffle 338 336 4 5 2 3 + Store 337 339 + 340: 27(ptr) AccessChain 10(dti) 26 + 341: 6(int) Load 340 + 342: 27(ptr) AccessChain 10(dti) 26 + 343: 6(int) Load 342 + 344: 161(ptr) AccessChain 24(data) 25 343 158 + 345: 19(f64vec4) Load 344 + 346:191(f64vec3) VectorShuffle 345 345 0 1 2 + 347:191(f64vec3) GroupNonUniformFMul 35 Reduce 346 + 348: 161(ptr) AccessChain 24(data) 25 341 158 + 349: 19(f64vec4) Load 348 + 350: 19(f64vec4) VectorShuffle 349 347 4 5 6 3 + Store 348 350 + 351: 27(ptr) AccessChain 10(dti) 26 + 352: 6(int) Load 351 + 353: 27(ptr) AccessChain 10(dti) 26 + 354: 6(int) Load 353 + 355: 32(ptr) AccessChain 24(data) 25 354 25 + 356: 13(ivec4) Load 355 + 357: 13(ivec4) GroupNonUniformUMin 35 Reduce 356 + 358: 32(ptr) AccessChain 24(data) 25 352 25 + Store 358 357 + 359: 27(ptr) AccessChain 10(dti) 26 + 360: 6(int) Load 359 + 361: 27(ptr) AccessChain 10(dti) 26 + 362: 6(int) Load 361 + 363: 42(ptr) AccessChain 24(data) 25 362 25 26 + 364: 6(int) Load 363 + 365: 6(int) GroupNonUniformUMin 35 Reduce 364 + 366: 42(ptr) AccessChain 24(data) 25 360 25 26 + Store 366 365 + 367: 27(ptr) AccessChain 10(dti) 26 + 368: 6(int) Load 367 + 369: 27(ptr) AccessChain 10(dti) 26 + 370: 6(int) Load 369 + 371: 32(ptr) AccessChain 24(data) 25 370 25 + 372: 13(ivec4) Load 371 + 373: 51(ivec2) VectorShuffle 372 372 0 1 + 374: 51(ivec2) GroupNonUniformUMin 35 Reduce 373 + 375: 32(ptr) AccessChain 24(data) 25 368 25 + 376: 13(ivec4) Load 375 + 377: 13(ivec4) VectorShuffle 376 374 4 5 2 3 + Store 375 377 + 378: 27(ptr) AccessChain 10(dti) 26 + 379: 6(int) Load 378 + 380: 27(ptr) AccessChain 10(dti) 26 + 381: 6(int) Load 380 + 382: 32(ptr) AccessChain 24(data) 25 381 25 + 383: 13(ivec4) Load 382 + 384: 7(ivec3) VectorShuffle 383 383 0 1 2 + 385: 7(ivec3) GroupNonUniformUMin 35 Reduce 384 + 386: 32(ptr) AccessChain 24(data) 25 379 25 + 387: 13(ivec4) Load 386 + 388: 13(ivec4) VectorShuffle 387 385 4 5 6 3 + Store 386 388 + 389: 27(ptr) AccessChain 10(dti) 26 + 390: 6(int) Load 389 + 391: 27(ptr) AccessChain 10(dti) 26 + 392: 6(int) Load 391 + 393: 75(ptr) AccessChain 24(data) 25 392 72 + 394: 15(ivec4) Load 393 + 395: 15(ivec4) GroupNonUniformSMin 35 Reduce 394 + 396: 75(ptr) AccessChain 24(data) 25 390 72 + Store 396 395 + 397: 27(ptr) AccessChain 10(dti) 26 + 398: 6(int) Load 397 + 399: 27(ptr) AccessChain 10(dti) 26 + 400: 6(int) Load 399 + 401: 84(ptr) AccessChain 24(data) 25 400 72 26 + 402: 14(int) Load 401 + 403: 14(int) GroupNonUniformSMin 35 Reduce 402 + 404: 84(ptr) AccessChain 24(data) 25 398 72 26 + Store 404 403 + 405: 27(ptr) AccessChain 10(dti) 26 + 406: 6(int) Load 405 + 407: 27(ptr) AccessChain 10(dti) 26 + 408: 6(int) Load 407 + 409: 75(ptr) AccessChain 24(data) 25 408 72 + 410: 15(ivec4) Load 409 + 411: 93(ivec2) VectorShuffle 410 410 0 1 + 412: 93(ivec2) GroupNonUniformSMin 35 Reduce 411 + 413: 75(ptr) AccessChain 24(data) 25 406 72 + 414: 15(ivec4) Load 413 + 415: 15(ivec4) VectorShuffle 414 412 4 5 2 3 + Store 413 415 + 416: 27(ptr) AccessChain 10(dti) 26 + 417: 6(int) Load 416 + 418: 27(ptr) AccessChain 10(dti) 26 + 419: 6(int) Load 418 + 420: 75(ptr) AccessChain 24(data) 25 419 72 + 421: 15(ivec4) Load 420 + 422: 105(ivec3) VectorShuffle 421 421 0 1 2 + 423: 105(ivec3) GroupNonUniformSMin 35 Reduce 422 + 424: 75(ptr) AccessChain 24(data) 25 417 72 + 425: 15(ivec4) Load 424 + 426: 15(ivec4) VectorShuffle 425 423 4 5 6 3 + Store 424 426 + 427: 27(ptr) AccessChain 10(dti) 26 + 428: 6(int) Load 427 + 429: 27(ptr) AccessChain 10(dti) 26 + 430: 6(int) Load 429 + 431: 118(ptr) AccessChain 24(data) 25 430 115 + 432: 17(fvec4) Load 431 + 433: 17(fvec4) GroupNonUniformFMin 35 Reduce 432 + 434: 118(ptr) AccessChain 24(data) 25 428 115 + Store 434 433 + 435: 27(ptr) AccessChain 10(dti) 26 + 436: 6(int) Load 435 + 437: 27(ptr) AccessChain 10(dti) 26 + 438: 6(int) Load 437 + 439: 127(ptr) AccessChain 24(data) 25 438 115 26 + 440: 16(float) Load 439 + 441: 16(float) GroupNonUniformFMin 35 Reduce 440 + 442: 127(ptr) AccessChain 24(data) 25 436 115 26 + Store 442 441 + 443: 27(ptr) AccessChain 10(dti) 26 + 444: 6(int) Load 443 + 445: 27(ptr) AccessChain 10(dti) 26 + 446: 6(int) Load 445 + 447: 118(ptr) AccessChain 24(data) 25 446 115 + 448: 17(fvec4) Load 447 + 449: 136(fvec2) VectorShuffle 448 448 0 1 + 450: 136(fvec2) GroupNonUniformFMin 35 Reduce 449 + 451: 118(ptr) AccessChain 24(data) 25 444 115 + 452: 17(fvec4) Load 451 + 453: 17(fvec4) VectorShuffle 452 450 4 5 2 3 + Store 451 453 + 454: 27(ptr) AccessChain 10(dti) 26 + 455: 6(int) Load 454 + 456: 27(ptr) AccessChain 10(dti) 26 + 457: 6(int) Load 456 + 458: 118(ptr) AccessChain 24(data) 25 457 115 + 459: 17(fvec4) Load 458 + 460: 148(fvec3) VectorShuffle 459 459 0 1 2 + 461: 148(fvec3) GroupNonUniformFMin 35 Reduce 460 + 462: 118(ptr) AccessChain 24(data) 25 455 115 + 463: 17(fvec4) Load 462 + 464: 17(fvec4) VectorShuffle 463 461 4 5 6 3 + Store 462 464 + 465: 27(ptr) AccessChain 10(dti) 26 + 466: 6(int) Load 465 + 467: 27(ptr) AccessChain 10(dti) 26 + 468: 6(int) Load 467 + 469: 161(ptr) AccessChain 24(data) 25 468 158 + 470: 19(f64vec4) Load 469 + 471: 19(f64vec4) GroupNonUniformFMin 35 Reduce 470 + 472: 161(ptr) AccessChain 24(data) 25 466 158 + Store 472 471 + 473: 27(ptr) AccessChain 10(dti) 26 + 474: 6(int) Load 473 + 475: 27(ptr) AccessChain 10(dti) 26 + 476: 6(int) Load 475 + 477: 170(ptr) AccessChain 24(data) 25 476 158 26 + 478:18(float64_t) Load 477 + 479:18(float64_t) GroupNonUniformFMin 35 Reduce 478 + 480: 170(ptr) AccessChain 24(data) 25 474 158 26 + Store 480 479 + 481: 27(ptr) AccessChain 10(dti) 26 + 482: 6(int) Load 481 + 483: 27(ptr) AccessChain 10(dti) 26 + 484: 6(int) Load 483 + 485: 161(ptr) AccessChain 24(data) 25 484 158 + 486: 19(f64vec4) Load 485 + 487:179(f64vec2) VectorShuffle 486 486 0 1 + 488:179(f64vec2) GroupNonUniformFMin 35 Reduce 487 + 489: 161(ptr) AccessChain 24(data) 25 482 158 + 490: 19(f64vec4) Load 489 + 491: 19(f64vec4) VectorShuffle 490 488 4 5 2 3 + Store 489 491 + 492: 27(ptr) AccessChain 10(dti) 26 + 493: 6(int) Load 492 + 494: 27(ptr) AccessChain 10(dti) 26 + 495: 6(int) Load 494 + 496: 161(ptr) AccessChain 24(data) 25 495 158 + 497: 19(f64vec4) Load 496 + 498:191(f64vec3) VectorShuffle 497 497 0 1 2 + 499:191(f64vec3) GroupNonUniformFMin 35 Reduce 498 + 500: 161(ptr) AccessChain 24(data) 25 493 158 + 501: 19(f64vec4) Load 500 + 502: 19(f64vec4) VectorShuffle 501 499 4 5 6 3 + Store 500 502 + 503: 27(ptr) AccessChain 10(dti) 26 + 504: 6(int) Load 503 + 505: 27(ptr) AccessChain 10(dti) 26 + 506: 6(int) Load 505 + 507: 32(ptr) AccessChain 24(data) 25 506 25 + 508: 13(ivec4) Load 507 + 509: 13(ivec4) GroupNonUniformUMax 35 Reduce 508 + 510: 32(ptr) AccessChain 24(data) 25 504 25 + Store 510 509 + 511: 27(ptr) AccessChain 10(dti) 26 + 512: 6(int) Load 511 + 513: 27(ptr) AccessChain 10(dti) 26 + 514: 6(int) Load 513 + 515: 42(ptr) AccessChain 24(data) 25 514 25 26 + 516: 6(int) Load 515 + 517: 6(int) GroupNonUniformUMax 35 Reduce 516 + 518: 42(ptr) AccessChain 24(data) 25 512 25 26 + Store 518 517 + 519: 27(ptr) AccessChain 10(dti) 26 + 520: 6(int) Load 519 + 521: 27(ptr) AccessChain 10(dti) 26 + 522: 6(int) Load 521 + 523: 32(ptr) AccessChain 24(data) 25 522 25 + 524: 13(ivec4) Load 523 + 525: 51(ivec2) VectorShuffle 524 524 0 1 + 526: 51(ivec2) GroupNonUniformUMax 35 Reduce 525 + 527: 32(ptr) AccessChain 24(data) 25 520 25 + 528: 13(ivec4) Load 527 + 529: 13(ivec4) VectorShuffle 528 526 4 5 2 3 + Store 527 529 + 530: 27(ptr) AccessChain 10(dti) 26 + 531: 6(int) Load 530 + 532: 27(ptr) AccessChain 10(dti) 26 + 533: 6(int) Load 532 + 534: 32(ptr) AccessChain 24(data) 25 533 25 + 535: 13(ivec4) Load 534 + 536: 7(ivec3) VectorShuffle 535 535 0 1 2 + 537: 7(ivec3) GroupNonUniformUMax 35 Reduce 536 + 538: 32(ptr) AccessChain 24(data) 25 531 25 + 539: 13(ivec4) Load 538 + 540: 13(ivec4) VectorShuffle 539 537 4 5 6 3 + Store 538 540 + 541: 27(ptr) AccessChain 10(dti) 26 + 542: 6(int) Load 541 + 543: 27(ptr) AccessChain 10(dti) 26 + 544: 6(int) Load 543 + 545: 75(ptr) AccessChain 24(data) 25 544 72 + 546: 15(ivec4) Load 545 + 547: 15(ivec4) GroupNonUniformSMax 35 Reduce 546 + 548: 75(ptr) AccessChain 24(data) 25 542 72 + Store 548 547 + 549: 27(ptr) AccessChain 10(dti) 26 + 550: 6(int) Load 549 + 551: 27(ptr) AccessChain 10(dti) 26 + 552: 6(int) Load 551 + 553: 84(ptr) AccessChain 24(data) 25 552 72 26 + 554: 14(int) Load 553 + 555: 14(int) GroupNonUniformSMax 35 Reduce 554 + 556: 84(ptr) AccessChain 24(data) 25 550 72 26 + Store 556 555 + 557: 27(ptr) AccessChain 10(dti) 26 + 558: 6(int) Load 557 + 559: 27(ptr) AccessChain 10(dti) 26 + 560: 6(int) Load 559 + 561: 75(ptr) AccessChain 24(data) 25 560 72 + 562: 15(ivec4) Load 561 + 563: 93(ivec2) VectorShuffle 562 562 0 1 + 564: 93(ivec2) GroupNonUniformSMax 35 Reduce 563 + 565: 75(ptr) AccessChain 24(data) 25 558 72 + 566: 15(ivec4) Load 565 + 567: 15(ivec4) VectorShuffle 566 564 4 5 2 3 + Store 565 567 + 568: 27(ptr) AccessChain 10(dti) 26 + 569: 6(int) Load 568 + 570: 27(ptr) AccessChain 10(dti) 26 + 571: 6(int) Load 570 + 572: 75(ptr) AccessChain 24(data) 25 571 72 + 573: 15(ivec4) Load 572 + 574: 105(ivec3) VectorShuffle 573 573 0 1 2 + 575: 105(ivec3) GroupNonUniformSMax 35 Reduce 574 + 576: 75(ptr) AccessChain 24(data) 25 569 72 + 577: 15(ivec4) Load 576 + 578: 15(ivec4) VectorShuffle 577 575 4 5 6 3 + Store 576 578 + 579: 27(ptr) AccessChain 10(dti) 26 + 580: 6(int) Load 579 + 581: 27(ptr) AccessChain 10(dti) 26 + 582: 6(int) Load 581 + 583: 118(ptr) AccessChain 24(data) 25 582 115 + 584: 17(fvec4) Load 583 + 585: 17(fvec4) GroupNonUniformFMax 35 Reduce 584 + 586: 118(ptr) AccessChain 24(data) 25 580 115 + Store 586 585 + 587: 27(ptr) AccessChain 10(dti) 26 + 588: 6(int) Load 587 + 589: 27(ptr) AccessChain 10(dti) 26 + 590: 6(int) Load 589 + 591: 127(ptr) AccessChain 24(data) 25 590 115 26 + 592: 16(float) Load 591 + 593: 16(float) GroupNonUniformFMax 35 Reduce 592 + 594: 127(ptr) AccessChain 24(data) 25 588 115 26 + Store 594 593 + 595: 27(ptr) AccessChain 10(dti) 26 + 596: 6(int) Load 595 + 597: 27(ptr) AccessChain 10(dti) 26 + 598: 6(int) Load 597 + 599: 118(ptr) AccessChain 24(data) 25 598 115 + 600: 17(fvec4) Load 599 + 601: 136(fvec2) VectorShuffle 600 600 0 1 + 602: 136(fvec2) GroupNonUniformFMax 35 Reduce 601 + 603: 118(ptr) AccessChain 24(data) 25 596 115 + 604: 17(fvec4) Load 603 + 605: 17(fvec4) VectorShuffle 604 602 4 5 2 3 + Store 603 605 + 606: 27(ptr) AccessChain 10(dti) 26 + 607: 6(int) Load 606 + 608: 27(ptr) AccessChain 10(dti) 26 + 609: 6(int) Load 608 + 610: 118(ptr) AccessChain 24(data) 25 609 115 + 611: 17(fvec4) Load 610 + 612: 148(fvec3) VectorShuffle 611 611 0 1 2 + 613: 148(fvec3) GroupNonUniformFMax 35 Reduce 612 + 614: 118(ptr) AccessChain 24(data) 25 607 115 + 615: 17(fvec4) Load 614 + 616: 17(fvec4) VectorShuffle 615 613 4 5 6 3 + Store 614 616 + 617: 27(ptr) AccessChain 10(dti) 26 + 618: 6(int) Load 617 + 619: 27(ptr) AccessChain 10(dti) 26 + 620: 6(int) Load 619 + 621: 161(ptr) AccessChain 24(data) 25 620 158 + 622: 19(f64vec4) Load 621 + 623: 19(f64vec4) GroupNonUniformFMax 35 Reduce 622 + 624: 161(ptr) AccessChain 24(data) 25 618 158 + Store 624 623 + 625: 27(ptr) AccessChain 10(dti) 26 + 626: 6(int) Load 625 + 627: 27(ptr) AccessChain 10(dti) 26 + 628: 6(int) Load 627 + 629: 170(ptr) AccessChain 24(data) 25 628 158 26 + 630:18(float64_t) Load 629 + 631:18(float64_t) GroupNonUniformFMax 35 Reduce 630 + 632: 170(ptr) AccessChain 24(data) 25 626 158 26 + Store 632 631 + 633: 27(ptr) AccessChain 10(dti) 26 + 634: 6(int) Load 633 + 635: 27(ptr) AccessChain 10(dti) 26 + 636: 6(int) Load 635 + 637: 161(ptr) AccessChain 24(data) 25 636 158 + 638: 19(f64vec4) Load 637 + 639:179(f64vec2) VectorShuffle 638 638 0 1 + 640:179(f64vec2) GroupNonUniformFMax 35 Reduce 639 + 641: 161(ptr) AccessChain 24(data) 25 634 158 + 642: 19(f64vec4) Load 641 + 643: 19(f64vec4) VectorShuffle 642 640 4 5 2 3 + Store 641 643 + 644: 27(ptr) AccessChain 10(dti) 26 + 645: 6(int) Load 644 + 646: 27(ptr) AccessChain 10(dti) 26 + 647: 6(int) Load 646 + 648: 161(ptr) AccessChain 24(data) 25 647 158 + 649: 19(f64vec4) Load 648 + 650:191(f64vec3) VectorShuffle 649 649 0 1 2 + 651:191(f64vec3) GroupNonUniformFMax 35 Reduce 650 + 652: 161(ptr) AccessChain 24(data) 25 645 158 + 653: 19(f64vec4) Load 652 + 654: 19(f64vec4) VectorShuffle 653 651 4 5 6 3 + Store 652 654 + 655: 27(ptr) AccessChain 10(dti) 26 + 656: 6(int) Load 655 + 657: 27(ptr) AccessChain 10(dti) 26 + 658: 6(int) Load 657 + 659: 32(ptr) AccessChain 24(data) 25 658 25 + 660: 13(ivec4) Load 659 + 661: 13(ivec4) GroupNonUniformBitwiseAnd 35 Reduce 660 + 662: 32(ptr) AccessChain 24(data) 25 656 25 + Store 662 661 + 663: 27(ptr) AccessChain 10(dti) 26 + 664: 6(int) Load 663 + 665: 27(ptr) AccessChain 10(dti) 26 + 666: 6(int) Load 665 + 667: 42(ptr) AccessChain 24(data) 25 666 25 26 + 668: 6(int) Load 667 + 669: 6(int) GroupNonUniformBitwiseAnd 35 Reduce 668 + 670: 42(ptr) AccessChain 24(data) 25 664 25 26 + Store 670 669 + 671: 27(ptr) AccessChain 10(dti) 26 + 672: 6(int) Load 671 + 673: 27(ptr) AccessChain 10(dti) 26 + 674: 6(int) Load 673 + 675: 32(ptr) AccessChain 24(data) 25 674 25 + 676: 13(ivec4) Load 675 + 677: 51(ivec2) VectorShuffle 676 676 0 1 + 678: 51(ivec2) GroupNonUniformBitwiseAnd 35 Reduce 677 + 679: 32(ptr) AccessChain 24(data) 25 672 25 + 680: 13(ivec4) Load 679 + 681: 13(ivec4) VectorShuffle 680 678 4 5 2 3 + Store 679 681 + 682: 27(ptr) AccessChain 10(dti) 26 + 683: 6(int) Load 682 + 684: 27(ptr) AccessChain 10(dti) 26 + 685: 6(int) Load 684 + 686: 32(ptr) AccessChain 24(data) 25 685 25 + 687: 13(ivec4) Load 686 + 688: 7(ivec3) VectorShuffle 687 687 0 1 2 + 689: 7(ivec3) GroupNonUniformBitwiseAnd 35 Reduce 688 + 690: 32(ptr) AccessChain 24(data) 25 683 25 + 691: 13(ivec4) Load 690 + 692: 13(ivec4) VectorShuffle 691 689 4 5 6 3 + Store 690 692 + 693: 27(ptr) AccessChain 10(dti) 26 + 694: 6(int) Load 693 + 695: 27(ptr) AccessChain 10(dti) 26 + 696: 6(int) Load 695 + 697: 75(ptr) AccessChain 24(data) 25 696 72 + 698: 15(ivec4) Load 697 + 699: 15(ivec4) GroupNonUniformBitwiseAnd 35 Reduce 698 + 700: 75(ptr) AccessChain 24(data) 25 694 72 + Store 700 699 + 701: 27(ptr) AccessChain 10(dti) 26 + 702: 6(int) Load 701 + 703: 27(ptr) AccessChain 10(dti) 26 + 704: 6(int) Load 703 + 705: 84(ptr) AccessChain 24(data) 25 704 72 26 + 706: 14(int) Load 705 + 707: 14(int) GroupNonUniformBitwiseAnd 35 Reduce 706 + 708: 84(ptr) AccessChain 24(data) 25 702 72 26 + Store 708 707 + 709: 27(ptr) AccessChain 10(dti) 26 + 710: 6(int) Load 709 + 711: 27(ptr) AccessChain 10(dti) 26 + 712: 6(int) Load 711 + 713: 75(ptr) AccessChain 24(data) 25 712 72 + 714: 15(ivec4) Load 713 + 715: 93(ivec2) VectorShuffle 714 714 0 1 + 716: 93(ivec2) GroupNonUniformBitwiseAnd 35 Reduce 715 + 717: 75(ptr) AccessChain 24(data) 25 710 72 + 718: 15(ivec4) Load 717 + 719: 15(ivec4) VectorShuffle 718 716 4 5 2 3 + Store 717 719 + 720: 27(ptr) AccessChain 10(dti) 26 + 721: 6(int) Load 720 + 722: 27(ptr) AccessChain 10(dti) 26 + 723: 6(int) Load 722 + 724: 75(ptr) AccessChain 24(data) 25 723 72 + 725: 15(ivec4) Load 724 + 726: 105(ivec3) VectorShuffle 725 725 0 1 2 + 727: 105(ivec3) GroupNonUniformBitwiseAnd 35 Reduce 726 + 728: 75(ptr) AccessChain 24(data) 25 721 72 + 729: 15(ivec4) Load 728 + 730: 15(ivec4) VectorShuffle 729 727 4 5 6 3 + Store 728 730 + 731: 27(ptr) AccessChain 10(dti) 26 + 732: 6(int) Load 731 + 733: 27(ptr) AccessChain 10(dti) 26 + 734: 6(int) Load 733 + 735: 32(ptr) AccessChain 24(data) 25 734 25 + 736: 13(ivec4) Load 735 + 737: 13(ivec4) GroupNonUniformBitwiseOr 35 Reduce 736 + 738: 32(ptr) AccessChain 24(data) 25 732 25 + Store 738 737 + 739: 27(ptr) AccessChain 10(dti) 26 + 740: 6(int) Load 739 + 741: 27(ptr) AccessChain 10(dti) 26 + 742: 6(int) Load 741 + 743: 42(ptr) AccessChain 24(data) 25 742 25 26 + 744: 6(int) Load 743 + 745: 6(int) GroupNonUniformBitwiseOr 35 Reduce 744 + 746: 42(ptr) AccessChain 24(data) 25 740 25 26 + Store 746 745 + 747: 27(ptr) AccessChain 10(dti) 26 + 748: 6(int) Load 747 + 749: 27(ptr) AccessChain 10(dti) 26 + 750: 6(int) Load 749 + 751: 32(ptr) AccessChain 24(data) 25 750 25 + 752: 13(ivec4) Load 751 + 753: 51(ivec2) VectorShuffle 752 752 0 1 + 754: 51(ivec2) GroupNonUniformBitwiseOr 35 Reduce 753 + 755: 32(ptr) AccessChain 24(data) 25 748 25 + 756: 13(ivec4) Load 755 + 757: 13(ivec4) VectorShuffle 756 754 4 5 2 3 + Store 755 757 + 758: 27(ptr) AccessChain 10(dti) 26 + 759: 6(int) Load 758 + 760: 27(ptr) AccessChain 10(dti) 26 + 761: 6(int) Load 760 + 762: 32(ptr) AccessChain 24(data) 25 761 25 + 763: 13(ivec4) Load 762 + 764: 7(ivec3) VectorShuffle 763 763 0 1 2 + 765: 7(ivec3) GroupNonUniformBitwiseOr 35 Reduce 764 + 766: 32(ptr) AccessChain 24(data) 25 759 25 + 767: 13(ivec4) Load 766 + 768: 13(ivec4) VectorShuffle 767 765 4 5 6 3 + Store 766 768 + 769: 27(ptr) AccessChain 10(dti) 26 + 770: 6(int) Load 769 + 771: 27(ptr) AccessChain 10(dti) 26 + 772: 6(int) Load 771 + 773: 75(ptr) AccessChain 24(data) 25 772 72 + 774: 15(ivec4) Load 773 + 775: 15(ivec4) GroupNonUniformBitwiseOr 35 Reduce 774 + 776: 75(ptr) AccessChain 24(data) 25 770 72 + Store 776 775 + 777: 27(ptr) AccessChain 10(dti) 26 + 778: 6(int) Load 777 + 779: 27(ptr) AccessChain 10(dti) 26 + 780: 6(int) Load 779 + 781: 84(ptr) AccessChain 24(data) 25 780 72 26 + 782: 14(int) Load 781 + 783: 14(int) GroupNonUniformBitwiseOr 35 Reduce 782 + 784: 84(ptr) AccessChain 24(data) 25 778 72 26 + Store 784 783 + 785: 27(ptr) AccessChain 10(dti) 26 + 786: 6(int) Load 785 + 787: 27(ptr) AccessChain 10(dti) 26 + 788: 6(int) Load 787 + 789: 75(ptr) AccessChain 24(data) 25 788 72 + 790: 15(ivec4) Load 789 + 791: 93(ivec2) VectorShuffle 790 790 0 1 + 792: 93(ivec2) GroupNonUniformBitwiseOr 35 Reduce 791 + 793: 75(ptr) AccessChain 24(data) 25 786 72 + 794: 15(ivec4) Load 793 + 795: 15(ivec4) VectorShuffle 794 792 4 5 2 3 + Store 793 795 + 796: 27(ptr) AccessChain 10(dti) 26 + 797: 6(int) Load 796 + 798: 27(ptr) AccessChain 10(dti) 26 + 799: 6(int) Load 798 + 800: 75(ptr) AccessChain 24(data) 25 799 72 + 801: 15(ivec4) Load 800 + 802: 105(ivec3) VectorShuffle 801 801 0 1 2 + 803: 105(ivec3) GroupNonUniformBitwiseOr 35 Reduce 802 + 804: 75(ptr) AccessChain 24(data) 25 797 72 + 805: 15(ivec4) Load 804 + 806: 15(ivec4) VectorShuffle 805 803 4 5 6 3 + Store 804 806 + 807: 27(ptr) AccessChain 10(dti) 26 + 808: 6(int) Load 807 + 809: 27(ptr) AccessChain 10(dti) 26 + 810: 6(int) Load 809 + 811: 32(ptr) AccessChain 24(data) 25 810 25 + 812: 13(ivec4) Load 811 + 813: 13(ivec4) GroupNonUniformBitwiseXor 35 Reduce 812 + 814: 32(ptr) AccessChain 24(data) 25 808 25 + Store 814 813 + 815: 27(ptr) AccessChain 10(dti) 26 + 816: 6(int) Load 815 + 817: 27(ptr) AccessChain 10(dti) 26 + 818: 6(int) Load 817 + 819: 42(ptr) AccessChain 24(data) 25 818 25 26 + 820: 6(int) Load 819 + 821: 6(int) GroupNonUniformBitwiseXor 35 Reduce 820 + 822: 42(ptr) AccessChain 24(data) 25 816 25 26 + Store 822 821 + 823: 27(ptr) AccessChain 10(dti) 26 + 824: 6(int) Load 823 + 825: 27(ptr) AccessChain 10(dti) 26 + 826: 6(int) Load 825 + 827: 32(ptr) AccessChain 24(data) 25 826 25 + 828: 13(ivec4) Load 827 + 829: 51(ivec2) VectorShuffle 828 828 0 1 + 830: 51(ivec2) GroupNonUniformBitwiseXor 35 Reduce 829 + 831: 32(ptr) AccessChain 24(data) 25 824 25 + 832: 13(ivec4) Load 831 + 833: 13(ivec4) VectorShuffle 832 830 4 5 2 3 + Store 831 833 + 834: 27(ptr) AccessChain 10(dti) 26 + 835: 6(int) Load 834 + 836: 27(ptr) AccessChain 10(dti) 26 + 837: 6(int) Load 836 + 838: 32(ptr) AccessChain 24(data) 25 837 25 + 839: 13(ivec4) Load 838 + 840: 7(ivec3) VectorShuffle 839 839 0 1 2 + 841: 7(ivec3) GroupNonUniformBitwiseXor 35 Reduce 840 + 842: 32(ptr) AccessChain 24(data) 25 835 25 + 843: 13(ivec4) Load 842 + 844: 13(ivec4) VectorShuffle 843 841 4 5 6 3 + Store 842 844 + 845: 27(ptr) AccessChain 10(dti) 26 + 846: 6(int) Load 845 + 847: 27(ptr) AccessChain 10(dti) 26 + 848: 6(int) Load 847 + 849: 75(ptr) AccessChain 24(data) 25 848 72 + 850: 15(ivec4) Load 849 + 851: 15(ivec4) GroupNonUniformBitwiseXor 35 Reduce 850 + 852: 75(ptr) AccessChain 24(data) 25 846 72 + Store 852 851 + 853: 27(ptr) AccessChain 10(dti) 26 + 854: 6(int) Load 853 + 855: 27(ptr) AccessChain 10(dti) 26 + 856: 6(int) Load 855 + 857: 84(ptr) AccessChain 24(data) 25 856 72 26 + 858: 14(int) Load 857 + 859: 14(int) GroupNonUniformBitwiseXor 35 Reduce 858 + 860: 84(ptr) AccessChain 24(data) 25 854 72 26 + Store 860 859 + 861: 27(ptr) AccessChain 10(dti) 26 + 862: 6(int) Load 861 + 863: 27(ptr) AccessChain 10(dti) 26 + 864: 6(int) Load 863 + 865: 75(ptr) AccessChain 24(data) 25 864 72 + 866: 15(ivec4) Load 865 + 867: 93(ivec2) VectorShuffle 866 866 0 1 + 868: 93(ivec2) GroupNonUniformBitwiseXor 35 Reduce 867 + 869: 75(ptr) AccessChain 24(data) 25 862 72 + 870: 15(ivec4) Load 869 + 871: 15(ivec4) VectorShuffle 870 868 4 5 2 3 + Store 869 871 + 872: 27(ptr) AccessChain 10(dti) 26 + 873: 6(int) Load 872 + 874: 27(ptr) AccessChain 10(dti) 26 + 875: 6(int) Load 874 + 876: 75(ptr) AccessChain 24(data) 25 875 72 + 877: 15(ivec4) Load 876 + 878: 105(ivec3) VectorShuffle 877 877 0 1 2 + 879: 105(ivec3) GroupNonUniformBitwiseXor 35 Reduce 878 + 880: 75(ptr) AccessChain 24(data) 25 873 72 + 881: 15(ivec4) Load 880 + 882: 15(ivec4) VectorShuffle 881 879 4 5 6 3 + Store 880 882 + 883: 27(ptr) AccessChain 10(dti) 26 + 884: 6(int) Load 883 + 885: 27(ptr) AccessChain 10(dti) 26 + 886: 6(int) Load 885 + 887: 42(ptr) AccessChain 24(data) 25 886 25 26 + 888: 6(int) Load 887 + 890: 889(bool) IEqual 888 26 + 891: 13(ivec4) GroupNonUniformBallot 35 890 + 892: 6(int) GroupNonUniformBallotBitCount 35 Reduce 891 + 893: 42(ptr) AccessChain 24(data) 25 884 25 26 + Store 893 892 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavevote.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavevote.comp.out new file mode 100644 index 00000000000..04f2f984379 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.wavevote.comp.out @@ -0,0 +1,316 @@ +hlsl.wavevote.comp +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:5 Function Definition: @CSMain(vu3; ( temp void) +0:5 Function Parameters: +0:5 'dti' ( in 3-component vector of uint) +0:? Sequence +0:6 move second child to first child ( temp uint64_t) +0:6 indirect index (layout( row_major std430) buffer uint64_t) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:6 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:6 Constant: +0:6 0 (const uint) +0:6 direct index ( temp uint) +0:6 'dti' ( in 3-component vector of uint) +0:6 Constant: +0:6 0 (const int) +0:6 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:6 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:6 subgroupBallot ( temp 4-component vector of uint) +0:6 subgroupAny ( temp bool) +0:6 Compare Equal ( temp bool) +0:6 direct index ( temp uint) +0:6 'dti' ( in 3-component vector of uint) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const uint) +0:7 move second child to first child ( temp uint64_t) +0:7 indirect index (layout( row_major std430) buffer uint64_t) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:7 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:7 Constant: +0:7 0 (const uint) +0:7 direct index ( temp uint) +0:7 'dti' ( in 3-component vector of uint) +0:7 Constant: +0:7 1 (const int) +0:7 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:7 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:7 subgroupBallot ( temp 4-component vector of uint) +0:7 subgroupAll ( temp bool) +0:7 Compare Equal ( temp bool) +0:7 direct index ( temp uint) +0:7 'dti' ( in 3-component vector of uint) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const uint) +0:8 move second child to first child ( temp uint64_t) +0:8 indirect index (layout( row_major std430) buffer uint64_t) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:8 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:8 Constant: +0:8 0 (const uint) +0:8 direct index ( temp uint) +0:8 'dti' ( in 3-component vector of uint) +0:8 Constant: +0:8 2 (const int) +0:8 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:8 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:8 subgroupBallot ( temp 4-component vector of uint) +0:8 subgroupAllEqual ( temp bool) +0:8 Compare Equal ( temp bool) +0:8 direct index ( temp uint) +0:8 'dti' ( in 3-component vector of uint) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 0 (const uint) +0:9 move second child to first child ( temp uint64_t) +0:9 indirect index (layout( row_major std430) buffer uint64_t) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:9 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:9 Constant: +0:9 0 (const uint) +0:9 direct index ( temp uint) +0:9 'dti' ( in 3-component vector of uint) +0:9 Constant: +0:9 2 (const int) +0:9 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:9 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:9 subgroupBallot ( temp 4-component vector of uint) +0:9 subgroupAllEqual ( temp bool) +0:9 direct index ( temp uint) +0:9 'dti' ( in 3-component vector of uint) +0:9 Constant: +0:9 2 (const int) +0:5 Function Definition: CSMain( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:5 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + + +Linked compute stage: + + +Shader version: 500 +local_size = (32, 16, 1) +0:? Sequence +0:5 Function Definition: @CSMain(vu3; ( temp void) +0:5 Function Parameters: +0:5 'dti' ( in 3-component vector of uint) +0:? Sequence +0:6 move second child to first child ( temp uint64_t) +0:6 indirect index (layout( row_major std430) buffer uint64_t) +0:6 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:6 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:6 Constant: +0:6 0 (const uint) +0:6 direct index ( temp uint) +0:6 'dti' ( in 3-component vector of uint) +0:6 Constant: +0:6 0 (const int) +0:6 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:6 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:6 subgroupBallot ( temp 4-component vector of uint) +0:6 subgroupAny ( temp bool) +0:6 Compare Equal ( temp bool) +0:6 direct index ( temp uint) +0:6 'dti' ( in 3-component vector of uint) +0:6 Constant: +0:6 0 (const int) +0:6 Constant: +0:6 0 (const uint) +0:7 move second child to first child ( temp uint64_t) +0:7 indirect index (layout( row_major std430) buffer uint64_t) +0:7 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:7 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:7 Constant: +0:7 0 (const uint) +0:7 direct index ( temp uint) +0:7 'dti' ( in 3-component vector of uint) +0:7 Constant: +0:7 1 (const int) +0:7 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:7 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:7 subgroupBallot ( temp 4-component vector of uint) +0:7 subgroupAll ( temp bool) +0:7 Compare Equal ( temp bool) +0:7 direct index ( temp uint) +0:7 'dti' ( in 3-component vector of uint) +0:7 Constant: +0:7 1 (const int) +0:7 Constant: +0:7 0 (const uint) +0:8 move second child to first child ( temp uint64_t) +0:8 indirect index (layout( row_major std430) buffer uint64_t) +0:8 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:8 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:8 Constant: +0:8 0 (const uint) +0:8 direct index ( temp uint) +0:8 'dti' ( in 3-component vector of uint) +0:8 Constant: +0:8 2 (const int) +0:8 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:8 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:8 subgroupBallot ( temp 4-component vector of uint) +0:8 subgroupAllEqual ( temp bool) +0:8 Compare Equal ( temp bool) +0:8 direct index ( temp uint) +0:8 'dti' ( in 3-component vector of uint) +0:8 Constant: +0:8 2 (const int) +0:8 Constant: +0:8 0 (const uint) +0:9 move second child to first child ( temp uint64_t) +0:9 indirect index (layout( row_major std430) buffer uint64_t) +0:9 @data: direct index for structure (layout( row_major std430) buffer unsized 1-element array of uint64_t) +0:9 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:9 Constant: +0:9 0 (const uint) +0:9 direct index ( temp uint) +0:9 'dti' ( in 3-component vector of uint) +0:9 Constant: +0:9 2 (const int) +0:9 Construct uint64 (layout( row_major std430) buffer uint64_t) +0:9 Convert uint to uint64 ( temp 4-component vector of uint64_t) +0:9 subgroupBallot ( temp 4-component vector of uint) +0:9 subgroupAllEqual ( temp bool) +0:9 direct index ( temp uint) +0:9 'dti' ( in 3-component vector of uint) +0:9 Constant: +0:9 2 (const int) +0:5 Function Definition: CSMain( ( temp void) +0:5 Function Parameters: +0:? Sequence +0:5 move second child to first child ( temp 3-component vector of uint) +0:? 'dti' ( temp 3-component vector of uint) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) +0:5 Function Call: @CSMain(vu3; ( temp void) +0:? 'dti' ( temp 3-component vector of uint) +0:? Linker Objects +0:? 'data' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of uint64_t @data}) +0:? 'dti' ( in 3-component vector of uint GlobalInvocationID) + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 75 + + Capability Shader + Capability Int64 + Capability GroupNonUniform + Capability GroupNonUniformVote + Capability GroupNonUniformBallot + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "CSMain" 70 + ExecutionMode 4 LocalSize 32 16 1 + Source HLSL 500 + Name 4 "CSMain" + Name 11 "@CSMain(vu3;" + Name 10 "dti" + Name 15 "data" + MemberName 15(data) 0 "@data" + Name 17 "data" + Name 68 "dti" + Name 70 "dti" + Name 72 "param" + Decorate 14 ArrayStride 8 + MemberDecorate 15(data) 0 Offset 0 + Decorate 15(data) BufferBlock + Decorate 17(data) DescriptorSet 0 + Decorate 70(dti) BuiltIn GlobalInvocationId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 9: TypeFunction 2 8(ptr) + 13: TypeInt 64 0 + 14: TypeRuntimeArray 13(int64_t) + 15(data): TypeStruct 14 + 16: TypePointer Uniform 15(data) + 17(data): 16(ptr) Variable Uniform + 18: TypeInt 32 1 + 19: 18(int) Constant 0 + 20: 6(int) Constant 0 + 21: TypePointer Function 6(int) + 26: TypeBool + 28: 6(int) Constant 3 + 30: TypeVector 6(int) 4 + 32: TypeVector 13(int64_t) 4 + 35: TypePointer Uniform 13(int64_t) + 37: 6(int) Constant 1 + 48: 6(int) Constant 2 + 69: TypePointer Input 7(ivec3) + 70(dti): 69(ptr) Variable Input + 4(CSMain): 2 Function None 3 + 5: Label + 68(dti): 8(ptr) Variable Function + 72(param): 8(ptr) Variable Function + 71: 7(ivec3) Load 70(dti) + Store 68(dti) 71 + 73: 7(ivec3) Load 68(dti) + Store 72(param) 73 + 74: 2 FunctionCall 11(@CSMain(vu3;) 72(param) + Return + FunctionEnd +11(@CSMain(vu3;): 2 Function None 9 + 10(dti): 8(ptr) FunctionParameter + 12: Label + 22: 21(ptr) AccessChain 10(dti) 20 + 23: 6(int) Load 22 + 24: 21(ptr) AccessChain 10(dti) 20 + 25: 6(int) Load 24 + 27: 26(bool) IEqual 25 20 + 29: 26(bool) GroupNonUniformAny 28 27 + 31: 30(ivec4) GroupNonUniformBallot 28 29 + 33: 32(i64vec4) UConvert 31 + 34: 13(int64_t) CompositeExtract 33 0 + 36: 35(ptr) AccessChain 17(data) 19 23 + Store 36 34 + 38: 21(ptr) AccessChain 10(dti) 37 + 39: 6(int) Load 38 + 40: 21(ptr) AccessChain 10(dti) 37 + 41: 6(int) Load 40 + 42: 26(bool) IEqual 41 20 + 43: 26(bool) GroupNonUniformAll 28 42 + 44: 30(ivec4) GroupNonUniformBallot 28 43 + 45: 32(i64vec4) UConvert 44 + 46: 13(int64_t) CompositeExtract 45 0 + 47: 35(ptr) AccessChain 17(data) 19 39 + Store 47 46 + 49: 21(ptr) AccessChain 10(dti) 48 + 50: 6(int) Load 49 + 51: 21(ptr) AccessChain 10(dti) 48 + 52: 6(int) Load 51 + 53: 26(bool) IEqual 52 20 + 54: 26(bool) GroupNonUniformAllEqual 28 53 + 55: 30(ivec4) GroupNonUniformBallot 28 54 + 56: 32(i64vec4) UConvert 55 + 57: 13(int64_t) CompositeExtract 56 0 + 58: 35(ptr) AccessChain 17(data) 19 50 + Store 58 57 + 59: 21(ptr) AccessChain 10(dti) 48 + 60: 6(int) Load 59 + 61: 21(ptr) AccessChain 10(dti) 48 + 62: 6(int) Load 61 + 63: 26(bool) GroupNonUniformAllEqual 28 62 + 64: 30(ivec4) GroupNonUniformBallot 28 63 + 65: 32(i64vec4) UConvert 64 + 66: 13(int64_t) CompositeExtract 65 0 + 67: 35(ptr) AccessChain 17(data) 19 60 + Store 67 66 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.whileLoop.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.whileLoop.frag.out index cffef62660f..babc77dfd77 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.whileLoop.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.whileLoop.frag.out @@ -21,7 +21,7 @@ gl_FragCoord origin is upper left 0:4 Constant: 0:4 false (const bool) 0:4 No loop body -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Constant: 0:5 false (const bool) @@ -71,7 +71,7 @@ gl_FragCoord origin is upper left 0:4 Constant: 0:4 false (const bool) 0:4 No loop body -0:5 Loop with condition tested first +0:5 Loop with condition tested first: Unroll 0:5 Loop Condition 0:5 Constant: 0:5 false (const bool) @@ -96,7 +96,7 @@ gl_FragCoord origin is upper left 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 52 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out new file mode 100644 index 00000000000..257d56c708c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out @@ -0,0 +1,130 @@ +hlsl.y-negate-1.vert +Shader version: 500 +0:? Sequence +0:7 Function Definition: @main( ( temp 4-component vector of float) +0:7 Function Parameters: +0:? Sequence +0:8 Branch: Return with expression +0:8 pos: direct index for structure ( uniform 4-component vector of float) +0:8 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:8 Constant: +0:8 0 (const uint) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Function Call: @main( ( temp 4-component vector of float) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 Negate value ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' ( out 4-component vector of float Position) +0:7 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? '@entryPointOutput' ( out 4-component vector of float Position) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:7 Function Definition: @main( ( temp 4-component vector of float) +0:7 Function Parameters: +0:? Sequence +0:8 Branch: Return with expression +0:8 pos: direct index for structure ( uniform 4-component vector of float) +0:8 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:8 Constant: +0:8 0 (const uint) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Function Call: @main( ( temp 4-component vector of float) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 Negate value ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' ( out 4-component vector of float Position) +0:7 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? '@entryPointOutput' ( out 4-component vector of float Position) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 34 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 32 + Source HLSL 500 + Name 4 "main" + Name 9 "@main(" + Name 11 "$Global" + MemberName 11($Global) 0 "pos" + Name 13 "" + Name 22 "@position" + Name 32 "@entryPointOutput" + MemberDecorate 11($Global) 0 Offset 0 + Decorate 11($Global) Block + Decorate 13 DescriptorSet 0 + Decorate 32(@entryPointOutput) BuiltIn Position + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11($Global): TypeStruct 7(fvec4) + 12: TypePointer Uniform 11($Global) + 13: 12(ptr) Variable Uniform + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: TypePointer Uniform 7(fvec4) + 21: TypePointer Function 7(fvec4) + 24: TypeInt 32 0 + 25: 24(int) Constant 1 + 26: TypePointer Function 6(float) + 31: TypePointer Output 7(fvec4) +32(@entryPointOutput): 31(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 22(@position): 21(ptr) Variable Function + 23: 7(fvec4) FunctionCall 9(@main() + Store 22(@position) 23 + 27: 26(ptr) AccessChain 22(@position) 25 + 28: 6(float) Load 27 + 29: 6(float) FNegate 28 + 30: 26(ptr) AccessChain 22(@position) 25 + Store 30 29 + 33: 7(fvec4) Load 22(@position) + Store 32(@entryPointOutput) 33 + Return + FunctionEnd + 9(@main(): 7(fvec4) Function None 8 + 10: Label + 17: 16(ptr) AccessChain 13 15 + 18: 7(fvec4) Load 17 + ReturnValue 18 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out new file mode 100644 index 00000000000..a234a2e99c7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out @@ -0,0 +1,148 @@ +hlsl.y-negate-2.vert +Shader version: 500 +0:? Sequence +0:6 Function Definition: @main(vf4; ( temp void) +0:6 Function Parameters: +0:6 'position' ( out 4-component vector of float) +0:? Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 'position' ( out 4-component vector of float) +0:7 pos: direct index for structure ( uniform 4-component vector of float) +0:7 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:7 Constant: +0:7 0 (const uint) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 Function Call: @main(vf4; ( temp void) +0:? 'position' ( temp 4-component vector of float) +0:6 Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:6 '@position' ( temp 4-component vector of float) +0:? 'position' ( temp 4-component vector of float) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 Negate value ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 move second child to first child ( temp 4-component vector of float) +0:? 'position' ( out 4-component vector of float Position) +0:6 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? 'position' ( out 4-component vector of float Position) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:6 Function Definition: @main(vf4; ( temp void) +0:6 Function Parameters: +0:6 'position' ( out 4-component vector of float) +0:? Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 'position' ( out 4-component vector of float) +0:7 pos: direct index for structure ( uniform 4-component vector of float) +0:7 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:7 Constant: +0:7 0 (const uint) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 Function Call: @main(vf4; ( temp void) +0:? 'position' ( temp 4-component vector of float) +0:6 Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:6 '@position' ( temp 4-component vector of float) +0:? 'position' ( temp 4-component vector of float) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 Negate value ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 move second child to first child ( temp 4-component vector of float) +0:? 'position' ( out 4-component vector of float Position) +0:6 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? 'position' ( out 4-component vector of float Position) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 37 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 35 + Source HLSL 500 + Name 4 "main" + Name 11 "@main(vf4;" + Name 10 "position" + Name 13 "$Global" + MemberName 13($Global) 0 "pos" + Name 15 "" + Name 21 "position" + Name 22 "param" + Name 25 "@position" + Name 35 "position" + MemberDecorate 13($Global) 0 Offset 0 + Decorate 13($Global) Block + Decorate 15 DescriptorSet 0 + Decorate 35(position) BuiltIn Position + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 9: TypeFunction 2 8(ptr) + 13($Global): TypeStruct 7(fvec4) + 14: TypePointer Uniform 13($Global) + 15: 14(ptr) Variable Uniform + 16: TypeInt 32 1 + 17: 16(int) Constant 0 + 18: TypePointer Uniform 7(fvec4) + 27: TypeInt 32 0 + 28: 27(int) Constant 1 + 29: TypePointer Function 6(float) + 34: TypePointer Output 7(fvec4) + 35(position): 34(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 21(position): 8(ptr) Variable Function + 22(param): 8(ptr) Variable Function + 25(@position): 8(ptr) Variable Function + 23: 2 FunctionCall 11(@main(vf4;) 22(param) + 24: 7(fvec4) Load 22(param) + Store 21(position) 24 + 26: 7(fvec4) Load 21(position) + Store 25(@position) 26 + 30: 29(ptr) AccessChain 25(@position) 28 + 31: 6(float) Load 30 + 32: 6(float) FNegate 31 + 33: 29(ptr) AccessChain 25(@position) 28 + Store 33 32 + 36: 7(fvec4) Load 25(@position) + Store 35(position) 36 + Return + FunctionEnd + 11(@main(vf4;): 2 Function None 9 + 10(position): 8(ptr) FunctionParameter + 12: Label + 19: 18(ptr) AccessChain 15 17 + 20: 7(fvec4) Load 19 + Store 10(position) 20 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out new file mode 100644 index 00000000000..34bf8f9b407 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out @@ -0,0 +1,211 @@ +hlsl.y-negate-3.vert +Shader version: 500 +0:? Sequence +0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Parameters: +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 pos: direct index for structure ( temp 4-component vector of float) +0:14 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:14 Constant: +0:14 0 (const int) +0:14 position: direct index for structure ( uniform 4-component vector of float) +0:14 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:14 Constant: +0:14 0 (const uint) +0:15 move second child to first child ( temp int) +0:15 somethingelse: direct index for structure ( temp int) +0:15 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:15 Constant: +0:15 1 (const int) +0:15 Constant: +0:15 42 (const int) +0:17 Branch: Return with expression +0:17 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Definition: main( ( temp void) +0:11 Function Parameters: +0:? Sequence +0:11 Sequence +0:11 move second child to first child ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Call: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 '@position' ( temp 4-component vector of float) +0:11 pos: direct index for structure ( temp 4-component vector of float) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 0 (const int) +0:11 move second child to first child ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 Negate value ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:11 '@position' ( temp 4-component vector of float) +0:11 move second child to first child ( temp int) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) +0:11 somethingelse: direct index for structure ( temp int) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Parameters: +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 pos: direct index for structure ( temp 4-component vector of float) +0:14 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:14 Constant: +0:14 0 (const int) +0:14 position: direct index for structure ( uniform 4-component vector of float) +0:14 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:14 Constant: +0:14 0 (const uint) +0:15 move second child to first child ( temp int) +0:15 somethingelse: direct index for structure ( temp int) +0:15 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:15 Constant: +0:15 1 (const int) +0:15 Constant: +0:15 42 (const int) +0:17 Branch: Return with expression +0:17 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Definition: main( ( temp void) +0:11 Function Parameters: +0:? Sequence +0:11 Sequence +0:11 move second child to first child ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Call: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 '@position' ( temp 4-component vector of float) +0:11 pos: direct index for structure ( temp 4-component vector of float) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 0 (const int) +0:11 move second child to first child ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 Negate value ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:11 '@position' ( temp 4-component vector of float) +0:11 move second child to first child ( temp int) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) +0:11 somethingelse: direct index for structure ( temp int) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 50 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 44 47 + Source HLSL 500 + Name 4 "main" + Name 9 "VS_OUT" + MemberName 9(VS_OUT) 0 "pos" + MemberName 9(VS_OUT) 1 "somethingelse" + Name 11 "@main(" + Name 14 "vsout" + Name 16 "$Global" + MemberName 16($Global) 0 "position" + Name 18 "" + Name 31 "flattenTemp" + Name 33 "@position" + Name 44 "@entryPointOutput.pos" + Name 47 "@entryPointOutput.somethingelse" + MemberDecorate 16($Global) 0 Offset 0 + Decorate 16($Global) Block + Decorate 18 DescriptorSet 0 + Decorate 44(@entryPointOutput.pos) BuiltIn Position + Decorate 47(@entryPointOutput.somethingelse) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeInt 32 1 + 9(VS_OUT): TypeStruct 7(fvec4) 8(int) + 10: TypeFunction 9(VS_OUT) + 13: TypePointer Function 9(VS_OUT) + 15: 8(int) Constant 0 + 16($Global): TypeStruct 7(fvec4) + 17: TypePointer Uniform 16($Global) + 18: 17(ptr) Variable Uniform + 19: TypePointer Uniform 7(fvec4) + 22: TypePointer Function 7(fvec4) + 24: 8(int) Constant 1 + 25: 8(int) Constant 42 + 26: TypePointer Function 8(int) + 36: TypeInt 32 0 + 37: 36(int) Constant 1 + 38: TypePointer Function 6(float) + 43: TypePointer Output 7(fvec4) +44(@entryPointOutput.pos): 43(ptr) Variable Output + 46: TypePointer Output 8(int) +47(@entryPointOutput.somethingelse): 46(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 31(flattenTemp): 13(ptr) Variable Function + 33(@position): 22(ptr) Variable Function + 32: 9(VS_OUT) FunctionCall 11(@main() + Store 31(flattenTemp) 32 + 34: 22(ptr) AccessChain 31(flattenTemp) 15 + 35: 7(fvec4) Load 34 + Store 33(@position) 35 + 39: 38(ptr) AccessChain 33(@position) 37 + 40: 6(float) Load 39 + 41: 6(float) FNegate 40 + 42: 38(ptr) AccessChain 33(@position) 37 + Store 42 41 + 45: 7(fvec4) Load 33(@position) + Store 44(@entryPointOutput.pos) 45 + 48: 26(ptr) AccessChain 31(flattenTemp) 24 + 49: 8(int) Load 48 + Store 47(@entryPointOutput.somethingelse) 49 + Return + FunctionEnd + 11(@main(): 9(VS_OUT) Function None 10 + 12: Label + 14(vsout): 13(ptr) Variable Function + 20: 19(ptr) AccessChain 18 15 + 21: 7(fvec4) Load 20 + 23: 22(ptr) AccessChain 14(vsout) 15 + Store 23 21 + 27: 26(ptr) AccessChain 14(vsout) 24 + Store 27 25 + 28: 9(VS_OUT) Load 14(vsout) + ReturnValue 28 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/lineContinuation.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/lineContinuation.vert.out index 3dd8206106e..9faa420b364 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/lineContinuation.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/lineContinuation.vert.out @@ -66,7 +66,7 @@ ERROR: node is still EOpNull! 0:74 move second child to first child ( temp highp float) 0:74 'funkyf' ( global highp float) 0:75 Constant: -0:75 12300000000000000.000000 +0:75 1.2300000000000e+16 0:85 Sequence 0:84 move second child to first child ( temp highp int) 0:84 'funkyh' ( global highp int) @@ -200,7 +200,7 @@ ERROR: node is still EOpNull! 0:74 move second child to first child ( temp highp float) 0:74 'funkyf' ( global highp float) 0:75 Constant: -0:75 12300000000000000.000000 +0:75 1.2300000000000e+16 0:85 Sequence 0:84 move second child to first child ( temp highp int) 0:84 'funkyh' ( global highp int) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/link1.vk.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/link1.vk.frag.out index 26a26af875f..333594e3985 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/link1.vk.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/link1.vk.frag.out @@ -2,30 +2,105 @@ link1.vk.frag Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence -0:7 Function Definition: main( ( global void) -0:7 Function Parameters: -0:9 Sequence -0:9 move second child to first child ( temp highp 4-component vector of float) -0:9 'color' ( out highp 4-component vector of float) -0:9 Function Call: getColor( ( global highp 4-component vector of float) +0:16 Function Definition: main( ( global void) +0:16 Function Parameters: +0:18 Sequence +0:18 move second child to first child ( temp highp 4-component vector of float) +0:18 'color' (layout( location=0) out highp 4-component vector of float) +0:18 Function Call: getColor( ( global highp 4-component vector of float) +0:20 move second child to first child ( temp highp int) +0:20 direct index ( temp highp int) +0:20 'a1' ( global unsized 9-element array of highp int) +0:20 Constant: +0:20 8 (const int) +0:20 Constant: +0:20 1 (const int) +0:21 move second child to first child ( temp highp int) +0:21 direct index ( temp highp int) +0:21 'a2' ( global unsized 2-element array of highp int) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 1 (const int) +0:22 move second child to first child ( temp highp int) +0:22 indirect index ( temp highp int) +0:22 'b' ( global 5-element array of highp int) +0:22 'i' ( global highp int) +0:22 Constant: +0:22 1 (const int) +0:23 move second child to first child ( temp highp int) +0:23 direct index ( temp highp int) +0:23 'c' ( global unsized 4-element array of highp int) +0:23 Constant: +0:23 3 (const int) +0:23 Constant: +0:23 1 (const int) 0:? Linker Objects -0:? 'color' ( out highp 4-component vector of float) +0:? 'color' (layout( location=0) out highp 4-component vector of float) +0:? 'a1' ( global unsized 9-element array of highp int) +0:? 'a2' ( global unsized 2-element array of highp int) +0:? 'b' ( global 5-element array of highp int) +0:? 'c' ( global unsized 4-element array of highp int) +0:? 'i' ( global highp int) +0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float m}) link2.vk.frag Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence -0:5 Function Definition: getColor( ( global highp 4-component vector of float) -0:5 Function Parameters: -0:7 Sequence -0:7 Branch: Return with expression -0:7 texture ( global highp 4-component vector of float) -0:7 's2D' ( uniform highp sampler2D) -0:7 Constant: -0:7 0.500000 -0:7 0.500000 +0:14 Function Definition: getColor( ( global highp 4-component vector of float) +0:14 Function Parameters: +0:16 Sequence +0:16 move second child to first child ( temp highp int) +0:16 direct index ( temp highp int) +0:16 'a1' ( global unsized 3-element array of highp int) +0:16 Constant: +0:16 2 (const int) +0:16 Constant: +0:16 1 (const int) +0:17 move second child to first child ( temp highp int) +0:17 direct index ( temp highp int) +0:17 'a2' ( global unsized 10-element array of highp int) +0:17 Constant: +0:17 9 (const int) +0:17 Constant: +0:17 1 (const int) +0:18 move second child to first child ( temp highp int) +0:18 direct index ( temp highp int) +0:18 'b' ( global unsized 3-element array of highp int) +0:18 Constant: +0:18 2 (const int) +0:18 Constant: +0:18 1 (const int) +0:19 move second child to first child ( temp highp int) +0:19 direct index ( temp highp int) +0:19 'c' ( global 7-element array of highp int) +0:19 Constant: +0:19 3 (const int) +0:19 Constant: +0:19 1 (const int) +0:20 move second child to first child ( temp highp int) +0:20 indirect index ( temp highp int) +0:20 'c' ( global 7-element array of highp int) +0:20 'i' ( global highp int) +0:20 Constant: +0:20 1 (const int) +0:22 Branch: Return with expression +0:22 texture ( global highp 4-component vector of float) +0:22 's2D' (layout( binding=1) uniform highp sampler2D) +0:22 Constant: +0:22 0.500000 +0:22 0.500000 0:? Linker Objects -0:? 's2D' ( uniform highp sampler2D) +0:? 's2D' (layout( binding=1) uniform highp sampler2D) +0:? 'a1' ( global unsized 3-element array of highp int) +0:? 'a2' ( global unsized 10-element array of highp int) +0:? 'b' ( global unsized 3-element array of highp int) +0:? 'c' ( global 7-element array of highp int) +0:? 'i' ( global highp int) +0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m}) Linked fragment stage: @@ -34,23 +109,206 @@ Linked fragment stage: Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence -0:7 Function Definition: main( ( global void) -0:7 Function Parameters: -0:9 Sequence -0:9 move second child to first child ( temp highp 4-component vector of float) -0:9 'color' ( out highp 4-component vector of float) -0:9 Function Call: getColor( ( global highp 4-component vector of float) -0:5 Function Definition: getColor( ( global highp 4-component vector of float) -0:5 Function Parameters: -0:7 Sequence -0:7 Branch: Return with expression -0:7 texture ( global highp 4-component vector of float) -0:7 's2D' ( uniform highp sampler2D) -0:7 Constant: -0:7 0.500000 -0:7 0.500000 +0:16 Function Definition: main( ( global void) +0:16 Function Parameters: +0:18 Sequence +0:18 move second child to first child ( temp highp 4-component vector of float) +0:18 'color' (layout( location=0) out highp 4-component vector of float) +0:18 Function Call: getColor( ( global highp 4-component vector of float) +0:20 move second child to first child ( temp highp int) +0:20 direct index ( temp highp int) +0:20 'a1' ( global 9-element array of highp int) +0:20 Constant: +0:20 8 (const int) +0:20 Constant: +0:20 1 (const int) +0:21 move second child to first child ( temp highp int) +0:21 direct index ( temp highp int) +0:21 'a2' ( global 10-element array of highp int) +0:21 Constant: +0:21 1 (const int) +0:21 Constant: +0:21 1 (const int) +0:22 move second child to first child ( temp highp int) +0:22 indirect index ( temp highp int) +0:22 'b' ( global 5-element array of highp int) +0:22 'i' ( global highp int) +0:22 Constant: +0:22 1 (const int) +0:23 move second child to first child ( temp highp int) +0:23 direct index ( temp highp int) +0:23 'c' ( global 7-element array of highp int) +0:23 Constant: +0:23 3 (const int) +0:23 Constant: +0:23 1 (const int) +0:14 Function Definition: getColor( ( global highp 4-component vector of float) +0:14 Function Parameters: +0:16 Sequence +0:16 move second child to first child ( temp highp int) +0:16 direct index ( temp highp int) +0:16 'a1' ( global 3-element array of highp int) +0:16 Constant: +0:16 2 (const int) +0:16 Constant: +0:16 1 (const int) +0:17 move second child to first child ( temp highp int) +0:17 direct index ( temp highp int) +0:17 'a2' ( global 10-element array of highp int) +0:17 Constant: +0:17 9 (const int) +0:17 Constant: +0:17 1 (const int) +0:18 move second child to first child ( temp highp int) +0:18 direct index ( temp highp int) +0:18 'b' ( global 3-element array of highp int) +0:18 Constant: +0:18 2 (const int) +0:18 Constant: +0:18 1 (const int) +0:19 move second child to first child ( temp highp int) +0:19 direct index ( temp highp int) +0:19 'c' ( global 7-element array of highp int) +0:19 Constant: +0:19 3 (const int) +0:19 Constant: +0:19 1 (const int) +0:20 move second child to first child ( temp highp int) +0:20 indirect index ( temp highp int) +0:20 'c' ( global 7-element array of highp int) +0:20 'i' ( global highp int) +0:20 Constant: +0:20 1 (const int) +0:22 Branch: Return with expression +0:22 texture ( global highp 4-component vector of float) +0:22 's2D' (layout( binding=1) uniform highp sampler2D) +0:22 Constant: +0:22 0.500000 +0:22 0.500000 0:? Linker Objects -0:? 'color' ( out highp 4-component vector of float) -0:? 's2D' ( uniform highp sampler2D) +0:? 'color' (layout( location=0) out highp 4-component vector of float) +0:? 'a1' ( global 9-element array of highp int) +0:? 'a2' ( global 10-element array of highp int) +0:? 'b' ( global 5-element array of highp int) +0:? 'c' ( global 7-element array of highp int) +0:? 'i' ( global highp int) +0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer unsized 1-element array of highp float r}) +0:? 'anon@1' (layout( column_major std430) buffer block{layout( column_major std430) buffer 4-element array of highp float m}) +0:? 's2D' (layout( binding=1) uniform highp sampler2D) -SPIR-V is not generated for failed compile or link +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 70 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 12 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + Name 4 "main" + Name 9 "getColor(" + Name 12 "color" + Name 19 "a1" + Name 27 "a2" + Name 32 "b" + Name 33 "i" + Name 39 "c" + Name 53 "s2D" + Name 62 "bnameRuntime" + MemberName 62(bnameRuntime) 0 "r" + Name 64 "" + Name 67 "bnameImplicit" + MemberName 67(bnameImplicit) 0 "m" + Name 69 "" + Decorate 12(color) Location 0 + Decorate 53(s2D) DescriptorSet 0 + Decorate 53(s2D) Binding 1 + Decorate 61 ArrayStride 4 + MemberDecorate 62(bnameRuntime) 0 Offset 0 + Decorate 62(bnameRuntime) BufferBlock + Decorate 64 DescriptorSet 0 + Decorate 66 ArrayStride 4 + MemberDecorate 67(bnameImplicit) 0 Offset 0 + Decorate 67(bnameImplicit) BufferBlock + Decorate 69 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeFunction 7(fvec4) + 11: TypePointer Output 7(fvec4) + 12(color): 11(ptr) Variable Output + 14: TypeInt 32 1 + 15: TypeInt 32 0 + 16: 15(int) Constant 9 + 17: TypeArray 14(int) 16 + 18: TypePointer Private 17 + 19(a1): 18(ptr) Variable Private + 20: 14(int) Constant 8 + 21: 14(int) Constant 1 + 22: TypePointer Private 14(int) + 24: 15(int) Constant 10 + 25: TypeArray 14(int) 24 + 26: TypePointer Private 25 + 27(a2): 26(ptr) Variable Private + 29: 15(int) Constant 5 + 30: TypeArray 14(int) 29 + 31: TypePointer Private 30 + 32(b): 31(ptr) Variable Private + 33(i): 22(ptr) Variable Private + 36: 15(int) Constant 7 + 37: TypeArray 14(int) 36 + 38: TypePointer Private 37 + 39(c): 38(ptr) Variable Private + 40: 14(int) Constant 3 + 42: 14(int) Constant 2 + 44: 14(int) Constant 9 + 50: TypeImage 6(float) 2D sampled format:Unknown + 51: TypeSampledImage 50 + 52: TypePointer UniformConstant 51 + 53(s2D): 52(ptr) Variable UniformConstant + 55: TypeVector 6(float) 2 + 56: 6(float) Constant 1056964608 + 57: 55(fvec2) ConstantComposite 56 56 + 61: TypeRuntimeArray 6(float) +62(bnameRuntime): TypeStruct 61 + 63: TypePointer Uniform 62(bnameRuntime) + 64: 63(ptr) Variable Uniform + 65: 15(int) Constant 4 + 66: TypeArray 6(float) 65 +67(bnameImplicit): TypeStruct 66 + 68: TypePointer Uniform 67(bnameImplicit) + 69: 68(ptr) Variable Uniform + 4(main): 2 Function None 3 + 5: Label + 13: 7(fvec4) FunctionCall 9(getColor() + Store 12(color) 13 + 23: 22(ptr) AccessChain 19(a1) 20 + Store 23 21 + 28: 22(ptr) AccessChain 27(a2) 21 + Store 28 21 + 34: 14(int) Load 33(i) + 35: 22(ptr) AccessChain 32(b) 34 + Store 35 21 + 41: 22(ptr) AccessChain 39(c) 40 + Store 41 21 + Return + FunctionEnd + 9(getColor(): 7(fvec4) Function None 8 + 10: Label + 43: 22(ptr) AccessChain 19(a1) 42 + Store 43 21 + 45: 22(ptr) AccessChain 27(a2) 44 + Store 45 21 + 46: 22(ptr) AccessChain 32(b) 42 + Store 46 21 + 47: 22(ptr) AccessChain 39(c) 40 + Store 47 21 + 48: 14(int) Load 33(i) + 49: 22(ptr) AccessChain 39(c) 48 + Store 49 21 + 54: 51 Load 53(s2D) + 58: 7(fvec4) ImageSampleImplicitLod 54 57 + ReturnValue 58 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrix2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrix2.frag.out index 880f75adcdb..3e3b3f06a30 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrix2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrix2.frag.out @@ -158,6 +158,9 @@ Shader version: 150 0:49 'FragColor' ( out 4-component vector of float) 0:49 Constant: 0:49 3 (const int) +0:50 matrix mult second child into first child ( temp 3X4 matrix of float) +0:50 'm34' ( temp 3X4 matrix of float) +0:50 'colorTransform' ( uniform 3X3 matrix of float) 0:? Linker Objects 0:? 'colorTransform' ( uniform 3X3 matrix of float) 0:? 'Color' ( smooth in 3-component vector of float) @@ -331,6 +334,9 @@ Shader version: 150 0:49 'FragColor' ( out 4-component vector of float) 0:49 Constant: 0:49 3 (const int) +0:50 matrix mult second child into first child ( temp 3X4 matrix of float) +0:50 'm34' ( temp 3X4 matrix of float) +0:50 'colorTransform' ( uniform 3X3 matrix of float) 0:? Linker Objects 0:? 'colorTransform' ( uniform 3X3 matrix of float) 0:? 'Color' ( smooth in 3-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrixError.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrixError.vert.out index f818892a957..0a0d1e40226 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrixError.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/matrixError.vert.out @@ -6,7 +6,9 @@ ERROR: 0:18: 'assign' : cannot convert from ' temp 2-component vector of float' ERROR: 0:19: 'xy' : does not apply to this type: temp 2X3 matrix of float ERROR: 0:21: '[' : matrix index out of range '2' ERROR: 0:21: '[' : vector index out of range '4' -ERROR: 7 compilation errors. No code generated. +ERROR: 0:22: 'assign' : cannot convert from ' temp 2X3 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 0:23: 'assign' : cannot convert from ' uniform 3X2 matrix of float' to ' temp 2X3 matrix of float' +ERROR: 9 compilation errors. No code generated. Shader version: 120 @@ -32,6 +34,8 @@ ERROR: node is still EOpNull! 0:21 2 (const int) 0:21 Constant: 0:21 4 (const int) +0:22 'm23' ( temp 2X3 matrix of float) +0:23 'm23' ( temp 2X3 matrix of float) 0:? Linker Objects 0:? 'v3' ( in 3-component vector of float) 0:? 'm32' ( uniform 3X2 matrix of float) @@ -64,6 +68,8 @@ ERROR: node is still EOpNull! 0:21 2 (const int) 0:21 Constant: 0:21 4 (const int) +0:22 'm23' ( temp 2X3 matrix of float) +0:23 'm23' ( temp 2X3 matrix of float) 0:? Linker Objects 0:? 'v3' ( in 3-component vector of float) 0:? 'm32' ( uniform 3X2 matrix of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/mixedArrayDecls.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/mixedArrayDecls.frag.out new file mode 100644 index 00000000000..598b828120b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/mixedArrayDecls.frag.out @@ -0,0 +1,68 @@ +mixedArrayDecls.frag +ERROR: 0:30: '' : syntax error, unexpected LEFT_PAREN, expecting COMMA or SEMICOLON +ERROR: 1 compilation errors. No code generated. + + +Shader version: 450 +ERROR: node is still EOpNull! +0:16 Function Definition: foo(i1[14][15][6]; ( global 14-element array of 15-element array of 6-element array of int) +0:16 Function Parameters: +0:16 'p' ( in 14-element array of 15-element array of 6-element array of int) +0:16 Sequence +0:16 Branch: Return with expression +0:16 'p' ( in 14-element array of 15-element array of 6-element array of int) +0:18 Function Definition: main( ( global void) +0:18 Function Parameters: +0:20 Sequence +0:20 direct index ( temp 14-element array of int) +0:20 'g' ( global unsized 4-element array of 14-element array of int) +0:20 Constant: +0:20 3 (const int) +0:21 direct index ( temp 14-element array of int) +0:21 'h' ( global unsized 3-element array of 14-element array of int) +0:21 Constant: +0:21 2 (const int) +0:24 Function Definition: bar( ( global 4-element array of 3-element array of 2-element array of float) +0:24 Function Parameters: +0:? Sequence +0:24 Branch: Return with expression +0:24 'a' ( temp 4-element array of 3-element array of 2-element array of float) +0:? Linker Objects +0:? 's' ( global structure{ global 2-element array of 3-element array of int a, global 5-element array of 3-element array of int b}) +0:? 'c' ( global 4-element array of 5-element array of int) +0:? 'd' ( global 8-element array of 5-element array of int) +0:? 'e' ( global 11-element array of 9-element array of int) +0:? 'f' ( global 13-element array of 9-element array of int) +0:? 'g' ( global unsized 4-element array of 14-element array of int) +0:? 'h' ( global unsized 3-element array of 14-element array of int) +0:? 'inbinst' ( in 4-element array of 5-element array of 6-element array of block{ in 8-element array of 9-element array of 7-element array of float f}) +0:? 'barm' ( global 4-element array of 3-element array of 2-element array of float) + + +Linked fragment stage: + + +Shader version: 450 +ERROR: node is still EOpNull! +0:18 Function Definition: main( ( global void) +0:18 Function Parameters: +0:20 Sequence +0:20 direct index ( temp 14-element array of int) +0:20 'g' ( global 4-element array of 14-element array of int) +0:20 Constant: +0:20 3 (const int) +0:21 direct index ( temp 14-element array of int) +0:21 'h' ( global 3-element array of 14-element array of int) +0:21 Constant: +0:21 2 (const int) +0:? Linker Objects +0:? 's' ( global structure{ global 2-element array of 3-element array of int a, global 5-element array of 3-element array of int b}) +0:? 'c' ( global 4-element array of 5-element array of int) +0:? 'd' ( global 8-element array of 5-element array of int) +0:? 'e' ( global 11-element array of 9-element array of int) +0:? 'f' ( global 13-element array of 9-element array of int) +0:? 'g' ( global 4-element array of 14-element array of int) +0:? 'h' ( global 3-element array of 14-element array of int) +0:? 'inbinst' ( in 4-element array of 5-element array of 6-element array of block{ in 8-element array of 9-element array of 7-element array of float f}) +0:? 'barm' ( global 4-element array of 3-element array of 2-element array of float) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/nonuniform.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/nonuniform.frag.out new file mode 100644 index 00000000000..2d4e9b011a5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/nonuniform.frag.out @@ -0,0 +1,92 @@ +nonuniform.frag +ERROR: 0:10: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier +ERROR: 0:11: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier +ERROR: 0:12: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier +ERROR: 0:22: 'nonuniformEXT' : for non-parameter, can only apply to 'in' or no storage qualifier +ERROR: 0:28: 'constructor' : too many arguments +ERROR: 0:28: 'assign' : cannot convert from ' const float' to ' nonuniform temp int' +ERROR: 0:29: 'constructor' : not enough data provided for construction +ERROR: 0:29: 'assign' : cannot convert from ' const float' to ' nonuniform temp int' +ERROR: 0:32: 'nonuniformEXT' : not allowed on block or structure members +ERROR: 0:33: 'nonuniformEXT' : not allowed on block or structure members +ERROR: 10 compilation errors. No code generated. + + +Shader version: 450 +Requested GL_EXT_nonuniform_qualifier +ERROR: node is still EOpNull! +0:14 Function Definition: foo(i1;i1; ( nonuniform temp int) +0:14 Function Parameters: +0:14 'nupi' ( nonuniform in int) +0:14 'f' ( nonuniform out int) +0:16 Sequence +0:16 Branch: Return with expression +0:16 'nupi' ( nonuniform in int) +0:19 Function Definition: main( ( global void) +0:19 Function Parameters: +0:? Sequence +0:24 Function Call: foo(i1;i1; ( nonuniform temp int) +0:24 'nu_li' ( nonuniform temp int) +0:24 'nu_li' ( nonuniform temp int) +0:27 move second child to first child ( temp int) +0:27 'nu_li' ( nonuniform temp int) +0:27 add ( nonuniform temp int) +0:27 'a' ( nonuniform temp int) +0:27 component-wise multiply ( nonuniform temp int) +0:27 'a' ( temp int) +0:27 Constant: +0:27 2 (const int) +0:28 'nu_li' ( nonuniform temp int) +0:29 'nu_li' ( nonuniform temp int) +0:? Linker Objects +0:? 'nonuniformEXT' ( global int) +0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float) +0:? 'nu_gf' ( nonuniform temp float) +0:? 'nu_outv4' ( nonuniform out 4-component vector of float) +0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float) +0:? 'nu_constf' ( nonuniform const float) +0:? 1.000000 +0:? 'ins' (layout( location=1) smooth in structure{ global float a, temp float b}) +0:? 'inb' (layout( location=3) in block{ in float a, in float b}) + + +Linked fragment stage: + + +Shader version: 450 +Requested GL_EXT_nonuniform_qualifier +ERROR: node is still EOpNull! +0:14 Function Definition: foo(i1;i1; ( nonuniform temp int) +0:14 Function Parameters: +0:14 'nupi' ( nonuniform in int) +0:14 'f' ( nonuniform out int) +0:16 Sequence +0:16 Branch: Return with expression +0:16 'nupi' ( nonuniform in int) +0:19 Function Definition: main( ( global void) +0:19 Function Parameters: +0:? Sequence +0:24 Function Call: foo(i1;i1; ( nonuniform temp int) +0:24 'nu_li' ( nonuniform temp int) +0:24 'nu_li' ( nonuniform temp int) +0:27 move second child to first child ( temp int) +0:27 'nu_li' ( nonuniform temp int) +0:27 add ( nonuniform temp int) +0:27 'a' ( nonuniform temp int) +0:27 component-wise multiply ( nonuniform temp int) +0:27 'a' ( temp int) +0:27 Constant: +0:27 2 (const int) +0:28 'nu_li' ( nonuniform temp int) +0:29 'nu_li' ( nonuniform temp int) +0:? Linker Objects +0:? 'nonuniformEXT' ( global int) +0:? 'nu_inv4' ( smooth nonuniform in 4-component vector of float) +0:? 'nu_gf' ( nonuniform temp float) +0:? 'nu_outv4' ( nonuniform out 4-component vector of float) +0:? 'nu_uv4' ( nonuniform uniform 4-component vector of float) +0:? 'nu_constf' ( nonuniform const float) +0:? 1.000000 +0:? 'ins' (layout( location=1) smooth in structure{ global float a, temp float b}) +0:? 'inb' (layout( location=3) in block{ in float a, in float b}) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/numeral.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/numeral.frag.out index c1e313478b5..b7c0a78b729 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/numeral.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/numeral.frag.out @@ -85,12 +85,12 @@ ERROR: node is still EOpNull! 0:17 move second child to first child ( temp int) 0:17 'obig' ( temp int) 0:17 Constant: -0:17 995208915 (const int) +0:17 -1662398820 (const int) 0:18 Sequence 0:18 move second child to first child ( temp int) 0:18 'omax1' ( temp int) 0:18 Constant: -0:18 536870912 (const int) +0:18 0 (const int) 0:20 Sequence 0:20 move second child to first child ( temp uint) 0:20 'uo5' ( temp uint) @@ -225,7 +225,7 @@ ERROR: node is still EOpNull! 0:50 move second child to first child ( temp int) 0:50 'hbig' ( temp int) 0:50 Constant: -0:50 -1 (const int) +0:50 -15 (const int) 0:52 Sequence 0:52 move second child to first child ( temp float) 0:52 'f1' ( temp float) @@ -330,7 +330,7 @@ ERROR: node is still EOpNull! 0:73 move second child to first child ( temp float) 0:73 'g6' ( temp float) 0:73 Constant: -0:73 0.000005 +0:73 5.0000000000000e-06 0:74 Sequence 0:74 move second child to first child ( temp float) 0:74 'g7' ( temp float) @@ -494,12 +494,12 @@ ERROR: node is still EOpNull! 0:17 move second child to first child ( temp int) 0:17 'obig' ( temp int) 0:17 Constant: -0:17 995208915 (const int) +0:17 -1662398820 (const int) 0:18 Sequence 0:18 move second child to first child ( temp int) 0:18 'omax1' ( temp int) 0:18 Constant: -0:18 536870912 (const int) +0:18 0 (const int) 0:20 Sequence 0:20 move second child to first child ( temp uint) 0:20 'uo5' ( temp uint) @@ -634,7 +634,7 @@ ERROR: node is still EOpNull! 0:50 move second child to first child ( temp int) 0:50 'hbig' ( temp int) 0:50 Constant: -0:50 -1 (const int) +0:50 -15 (const int) 0:52 Sequence 0:52 move second child to first child ( temp float) 0:52 'f1' ( temp float) @@ -739,7 +739,7 @@ ERROR: node is still EOpNull! 0:73 move second child to first child ( temp float) 0:73 'g6' ( temp float) 0:73 Constant: -0:73 0.000005 +0:73 5.0000000000000e-06 0:74 Sequence 0:74 move second child to first child ( temp float) 0:74 'g7' ( temp float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out new file mode 100644 index 00000000000..ae004c64d42 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out @@ -0,0 +1,38 @@ +nvShaderNoperspectiveInterpolation.frag +ERROR: 0:5: 'noperspective' : Reserved word. +ERROR: 0:5: 'noperspective' : not supported for this version or the enabled extensions +ERROR: 2 compilation errors. No code generated. + + +Shader version: 300 +Requested GL_NV_shader_noperspective_interpolation +ERROR: node is still EOpNull! +0:13 Function Definition: main( ( global void) +0:13 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp mediump 4-component vector of float) +0:14 'fragColor' ( out mediump 4-component vector of float) +0:14 'color' ( noperspective in mediump 4-component vector of float) +0:? Linker Objects +0:? 'bad' ( noperspective in mediump 4-component vector of float) +0:? 'color' ( noperspective in mediump 4-component vector of float) +0:? 'fragColor' ( out mediump 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 300 +Requested GL_NV_shader_noperspective_interpolation +ERROR: node is still EOpNull! +0:13 Function Definition: main( ( global void) +0:13 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp mediump 4-component vector of float) +0:14 'fragColor' ( out mediump 4-component vector of float) +0:14 'color' ( noperspective in mediump 4-component vector of float) +0:? Linker Objects +0:? 'bad' ( noperspective in mediump 4-component vector of float) +0:? 'color' ( noperspective in mediump 4-component vector of float) +0:? 'fragColor' ( out mediump 4-component vector of float) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.bad_arg.vert.err b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.bad_arg.vert.err new file mode 100644 index 00000000000..ae970a0e3da --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.bad_arg.vert.err @@ -0,0 +1,4 @@ +ERROR: 0:8: 'macro expansion' : End of input in macro EXP2 +ERROR: 1 compilation errors. No code generated. + + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.bad_arg.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.bad_arg.vert.out new file mode 100644 index 00000000000..e69de29bb2d diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.err b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.err index e69de29bb2d..da435dbd9a8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.err +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.err @@ -0,0 +1,2 @@ +WARNING: 0:10: '#pragma once' : not implemented + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.out index 8c52814468c..ebe1e4a7491 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.pragma.vert.out @@ -7,6 +7,8 @@ #pragma undefined_pragma(x,4) +#pragma once + int main(){ } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.simple.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.simple.vert.out index 8cbabdad89c..57b020c6767 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.simple.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/preprocessor.simple.vert.out @@ -25,6 +25,42 @@ int main(){ == != & ^ | && ^^ || ? : += -= *= /= %= <<= >>= &= |= ^= - 1.2 2E10 5u - 5 lf + 1.2 2E10 5u - 5l f +} + +struct S { + int member1; + float member2; + vec4 member3; +}; + + + + + + + + + + + + + +void foo() +{ + S s; + s . member2 + s . member1; + s . member3 . zyx; + s . member2 . xxyz; + s . member2 . yyz; + s . member2 . xxyz(); + s . member2 . yzy; + vec3 a = vec3(0);vec3 b = a . zxyz;vec3 b = a . xxyz;vec3 b = a . yyz;vec3 b = a . xxyz();vec3 b = a . yzy;vec3 b = a . z; + + + yyz; + yzy + + } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/reflection.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/reflection.vert.out index 422c049be68..52e16e6083c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/reflection.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/reflection.vert.out @@ -1,107 +1,107 @@ reflection.vert Uniform reflection: -image_ui2D: offset -1, type 9063, size 1, index -1, binding -1 -sampler_2D: offset -1, type 8b5e, size 1, index -1, binding -1 -sampler_2DMSArray: offset -1, type 910b, size 1, index -1, binding -1 -anonMember3: offset 80, type 8b52, size 1, index 0, binding -1 -s.a: offset -1, type 1404, size 1, index -1, binding -1 -named.scalar: offset 12, type 1404, size 1, index 1, binding -1 -m23: offset 16, type 8b67, size 1, index 0, binding -1 -scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1 -c_m23: offset 16, type 8b67, size 1, index 2, binding -1 -c_scalarAfterm23: offset 64, type 1404, size 1, index 2, binding -1 -scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1 -floatArray: offset 112, type 1406, size 5, index 0, binding -1 -scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1 -named.memvec2: offset 48, type 8b50, size 1, index 1, binding -1 -named.memf1: offset 56, type 1406, size 1, index 1, binding -1 -named.memf2: offset 60, type 8b56, size 1, index 1, binding -1 -named.memf3: offset 64, type 1404, size 1, index 1, binding -1 -named.memvec2a: offset 72, type 8b50, size 1, index 1, binding -1 -named.m22: offset 80, type 8b5a, size 7, index 1, binding -1 -dm22: offset -1, type 8b5a, size 4, index -1, binding -1 -m22: offset 208, type 8b5a, size 3, index 0, binding -1 -nested.foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1 -nested.foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1 -nested.foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1 -nested.foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1 -deepA[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepA[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[1].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[1].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[1].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[0].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[0].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepB[0].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1 -deepC[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1 -deepC[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1 -deepC[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepC[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepC[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepC[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepC[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepC[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepC[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepC[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepC[1].v3: offset -1, type 8b54, size 1, index -1, binding -1 -deepD[0].iv4: offset -1, type 8b52, size 1, index -1, binding -1 -deepD[0].d2.i: offset -1, type 1404, size 1, index -1, binding -1 -deepD[0].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[0].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[0].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[0].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[0].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[0].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[0].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[0].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[0].v3: offset -1, type 8b54, size 1, index -1, binding -1 -deepD[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1 -deepD[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1 -deepD[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1 -deepD[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1 -deepD[1].v3: offset -1, type 8b54, size 1, index -1, binding -1 -abl.foo: offset 0, type 1406, size 1, index 7, binding -1 -abl2.foo: offset 0, type 1406, size 1, index 11, binding -1 -buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1 -buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1 -buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1 -buf4.runtimeArray.c: offset 8, type 1406, size 1, index 15, binding -1 -anonMember1: offset 0, type 8b51, size 1, index 0, binding -1 -uf1: offset -1, type 1406, size 1, index -1, binding -1 -uf2: offset -1, type 1406, size 1, index -1, binding -1 -named.member3: offset 32, type 8b52, size 1, index 1, binding -1 +image_ui2D: offset -1, type 9063, size 1, index -1, binding -1, stages 1 +sampler_2D: offset -1, type 8b5e, size 1, index -1, binding -1, stages 1 +sampler_2DMSArray: offset -1, type 910b, size 1, index -1, binding -1, stages 1 +anonMember3: offset 80, type 8b52, size 1, index 0, binding -1, stages 1 +s.a: offset -1, type 1404, size 1, index -1, binding -1, stages 1 +named.scalar: offset 12, type 1404, size 1, index 1, binding -1, stages 1 +m23: offset 16, type 8b67, size 1, index 0, binding -1, stages 1 +scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1, stages 1 +c_m23: offset 16, type 8b67, size 1, index 2, binding -1, stages 1 +c_scalarAfterm23: offset 64, type 1404, size 1, index 2, binding -1, stages 1 +scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1, stages 1 +floatArray: offset 112, type 1406, size 5, index 0, binding -1, stages 1 +scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1, stages 1 +named.memvec2: offset 48, type 8b50, size 1, index 1, binding -1, stages 1 +named.memf1: offset 56, type 1406, size 1, index 1, binding -1, stages 1 +named.memf2: offset 60, type 8b56, size 1, index 1, binding -1, stages 1 +named.memf3: offset 64, type 1404, size 1, index 1, binding -1, stages 1 +named.memvec2a: offset 72, type 8b50, size 1, index 1, binding -1, stages 1 +named.m22: offset 80, type 8b5a, size 7, index 1, binding -1, stages 1 +dm22: offset -1, type 8b5a, size 4, index -1, binding -1, stages 1 +m22: offset 208, type 8b5a, size 3, index 0, binding -1, stages 1 +nested.foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1, stages 1 +nested.foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1, stages 1 +nested.foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1, stages 1 +nested.foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1, stages 1 +deepA[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepA[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[1].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[1].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[1].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[1].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[0].d2.d1[0].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[0].d2.d1[1].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[0].d2.d1[2].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepB[0].d2.d1[3].va: offset -1, type 8b50, size 2, index -1, binding -1, stages 1 +deepC[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1 +deepC[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1 +deepC[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepC[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepC[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepC[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepC[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepC[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepC[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepC[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepC[1].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1 +deepD[0].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1 +deepD[0].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1 +deepD[0].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[0].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[0].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[0].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[0].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[0].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[0].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[0].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[0].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1 +deepD[1].iv4: offset -1, type 8b52, size 1, index -1, binding -1, stages 1 +deepD[1].d2.i: offset -1, type 1404, size 1, index -1, binding -1, stages 1 +deepD[1].d2.d1[0].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[1].d2.d1[0].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[1].d2.d1[1].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[1].d2.d1[1].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[1].d2.d1[2].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[1].d2.d1[2].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[1].d2.d1[3].va: offset -1, type 8b50, size 3, index -1, binding -1, stages 1 +deepD[1].d2.d1[3].b: offset -1, type 8b56, size 1, index -1, binding -1, stages 1 +deepD[1].v3: offset -1, type 8b54, size 1, index -1, binding -1, stages 1 +abl.foo: offset 0, type 1406, size 1, index 7, binding -1, stages 1 +abl2.foo: offset 0, type 1406, size 1, index 11, binding -1, stages 1 +buf1.runtimeArray: offset 4, type 1406, size 4, index 12, binding -1, stages 1 +buf2.runtimeArray.c: offset 8, type 1406, size 1, index 13, binding -1, stages 1 +buf3.runtimeArray: offset 4, type 1406, size 0, index 14, binding -1, stages 1 +buf4.runtimeArray.c: offset 8, type 1406, size 1, index 15, binding -1, stages 1 +anonMember1: offset 0, type 8b51, size 1, index 0, binding -1, stages 1 +uf1: offset -1, type 1406, size 1, index -1, binding -1, stages 1 +uf2: offset -1, type 1406, size 1, index -1, binding -1, stages 1 +named.member3: offset 32, type 8b52, size 1, index 1, binding -1, stages 1 Uniform block reflection: -nameless: offset -1, type ffffffff, size 496, index -1, binding -1 -named: offset -1, type ffffffff, size 304, index -1, binding -1 -c_nameless: offset -1, type ffffffff, size 112, index -1, binding -1 -nested: offset -1, type ffffffff, size 32, index -1, binding -1 -abl[0]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl[1]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl[2]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl[3]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1 -abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1 -buf1: offset -1, type ffffffff, size 4, index -1, binding -1 -buf2: offset -1, type ffffffff, size 4, index -1, binding -1 -buf3: offset -1, type ffffffff, size 4, index -1, binding -1 -buf4: offset -1, type ffffffff, size 4, index -1, binding -1 +nameless: offset -1, type ffffffff, size 496, index -1, binding -1, stages 0 +named: offset -1, type ffffffff, size 304, index -1, binding -1, stages 0 +c_nameless: offset -1, type ffffffff, size 112, index -1, binding -1, stages 0 +nested: offset -1, type ffffffff, size 32, index -1, binding -1, stages 0 +abl[0]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl[1]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl[2]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl[3]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl2[0]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl2[1]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl2[2]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +abl2[3]: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +buf1: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +buf2: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +buf3: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 +buf4: offset -1, type ffffffff, size 4, index -1, binding -1, stages 0 Vertex attribute reflection: -attributeFloat: offset 0, type 1406, size 0, index 0, binding -1 -attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1 -attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1 -attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1 -attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1 -gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1 +attributeFloat: offset 0, type 1406, size 0, index 0, binding -1, stages 0 +attributeFloat2: offset 0, type 8b50, size 0, index 0, binding -1, stages 0 +attributeFloat3: offset 0, type 8b51, size 0, index 0, binding -1, stages 0 +attributeFloat4: offset 0, type 8b52, size 0, index 0, binding -1, stages 0 +attributeMat4: offset 0, type 8b5c, size 0, index 0, binding -1, stages 0 +gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1, stages 0 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.dcefunc.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.dcefunc.frag.out index da8f78a2396..33ec069dbe9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.dcefunc.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.dcefunc.frag.out @@ -1,6 +1,6 @@ remap.basic.dcefunc.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.everything.frag.out index bf17c59fd0f..858d629e466 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.everything.frag.out @@ -1,6 +1,6 @@ remap.basic.everything.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24969 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.none.frag.out index 054a6b45d47..1ad1d74c785 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.none.frag.out @@ -1,6 +1,6 @@ remap.basic.none.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.strip.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.strip.frag.out index ee9d93cfe2b..3d876d0d68b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.strip.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.basic.strip.frag.out @@ -1,6 +1,6 @@ remap.basic.strip.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out index b986a7d9d20..211daba25b4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.everything.frag.out @@ -2,7 +2,7 @@ remap.hlsl.sample.basic.everything.frag WARNING: 0:4: 'immediate sampler state' : unimplemented // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24878 Capability Shader @@ -11,6 +11,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented MemoryModel Logical GLSL450 EntryPoint Fragment 5663 "main" 4253 3709 ExecutionMode 5663 OriginUpperLeft + ExecutionMode 5663 DepthReplacing Decorate 4727 DescriptorSet 0 Decorate 4727 Binding 0 Decorate 3305 DescriptorSet 0 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out index 699fb8d8528..24a1adec136 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.none.frag.out @@ -2,7 +2,7 @@ remap.hlsl.sample.basic.none.frag WARNING: 0:4: 'immediate sampler state' : unimplemented // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 198 Capability Shader @@ -11,6 +11,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 188 192 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out index f46f93f0740..2108108d4ec 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out @@ -2,7 +2,7 @@ remap.hlsl.sample.basic.strip.frag WARNING: 0:4: 'immediate sampler state' : unimplemented // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 198 Capability Shader @@ -11,6 +11,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 188 192 ExecutionMode 4 OriginUpperLeft + ExecutionMode 4 DepthReplacing Decorate 45 DescriptorSet 0 Decorate 45 Binding 0 Decorate 49 DescriptorSet 0 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out index fe2df78d8a7..aff0998cd05 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.everything.frag.out @@ -1,6 +1,6 @@ remap.hlsl.templatetypes.everything.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24954 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out index bc5916e1d5e..282fd2a24a0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.hlsl.templatetypes.none.frag.out @@ -1,6 +1,6 @@ remap.hlsl.templatetypes.none.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 160 Capability Shader @@ -68,8 +68,8 @@ remap.hlsl.templatetypes.none.frag 29: 26(int) Constant 1 30: TypePointer Function 6(float) 32: TypeFloat 64 - 33: TypePointer Function 32(float) - 35: 32(float) Constant 0 1072693248 + 33: TypePointer Function 32(float64_t) + 35:32(float64_t) Constant 0 1072693248 36: TypeInt 32 0 37: TypePointer Function 36(int) 39: 36(int) Constant 1 @@ -84,10 +84,10 @@ remap.hlsl.templatetypes.none.frag 50: TypeVector 6(float) 2 51: TypePointer Function 50(fvec2) 53: 50(fvec2) ConstantComposite 14 15 - 54: TypeVector 32(float) 2 - 55: TypePointer Function 54(fvec2) - 57: 32(float) Constant 0 1073741824 - 58: 54(fvec2) ConstantComposite 35 57 + 54: TypeVector 32(float64_t) 2 + 55: TypePointer Function 54(f64vec2) + 57:32(float64_t) Constant 0 1073741824 + 58: 54(f64vec2) ConstantComposite 35 57 59: TypeVector 36(int) 2 60: TypePointer Function 59(ivec2) 62: 36(int) Constant 2 @@ -102,10 +102,10 @@ remap.hlsl.templatetypes.none.frag 73: TypeVector 6(float) 3 74: TypePointer Function 73(fvec3) 76: 73(fvec3) ConstantComposite 14 15 16 - 77: TypeVector 32(float) 3 - 78: TypePointer Function 77(fvec3) - 80: 32(float) Constant 0 1074266112 - 81: 77(fvec3) ConstantComposite 35 57 80 + 77: TypeVector 32(float64_t) 3 + 78: TypePointer Function 77(f64vec3) + 80:32(float64_t) Constant 0 1074266112 + 81: 77(f64vec3) ConstantComposite 35 57 80 82: TypeVector 36(int) 3 83: TypePointer Function 82(ivec3) 85: 36(int) Constant 3 @@ -117,10 +117,10 @@ remap.hlsl.templatetypes.none.frag 92: TypePointer Function 91(ivec4) 94: 26(int) Constant 4 95: 91(ivec4) ConstantComposite 29 48 71 94 - 97: TypeVector 32(float) 4 - 98: TypePointer Function 97(fvec4) - 100: 32(float) Constant 0 1074790400 - 101: 97(fvec4) ConstantComposite 35 57 80 100 + 97: TypeVector 32(float64_t) 4 + 98: TypePointer Function 97(f64vec4) + 100:32(float64_t) Constant 0 1074790400 + 101: 97(f64vec4) ConstantComposite 35 57 80 100 102: TypeVector 36(int) 4 103: TypePointer Function 102(ivec4) 105: 36(int) Constant 4 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.everything.frag.out index 7a1733e4167..cdb007b317b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.everything.frag.out @@ -1,6 +1,6 @@ remap.if.everything.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22855 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.none.frag.out index 1601a6cc56e..0c8d27836d2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.if.none.frag.out @@ -1,6 +1,6 @@ remap.if.none.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 25 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.literal64.none.spv.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.literal64.none.spv.out index 792b13a6124..d88992fc117 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.literal64.none.spv.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.literal64.none.spv.out @@ -8,7 +8,7 @@ remap.literal64.none.spv 1: TypeVoid 2: TypeInt 64 1 3: TypeFunction 1 - 4: 2(int) Constant 0 0 + 4: 2(int64_t) Constant 0 0 5: 1 Function None 3 6: Label SelectionMerge 7 None diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.everything.frag.out index f67acfbaf83..2f8f1c737dd 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.everything.frag.out @@ -1,6 +1,6 @@ remap.similar_1a.everything.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24916 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.none.frag.out index 2bbf53a6cc8..80d35c3fa1e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1a.none.frag.out @@ -1,6 +1,6 @@ remap.similar_1a.none.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 86 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.everything.frag.out index 67ff7df7f48..c76c4bfa06a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.everything.frag.out @@ -1,6 +1,6 @@ remap.similar_1b.everything.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24916 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.none.frag.out index 089ea5c3374..0a854d6ea25 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.similar_1b.none.frag.out @@ -1,6 +1,6 @@ remap.similar_1b.none.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 91 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.specconst.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.specconst.comp.out index cc439f12aa6..ee049f43099 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.specconst.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.specconst.comp.out @@ -1,6 +1,6 @@ remap.specconst.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 16104 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.everything.frag.out index c1fddd9ab9f..ffd64d4f6ae 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.everything.frag.out @@ -3,7 +3,7 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to "precision mediump int; precision highp float;" // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 23990 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.none.frag.out index fa78e77f19b..4dd78977a47 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.switch.none.frag.out @@ -3,7 +3,7 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to "precision mediump int; precision highp float;" // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 48 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.everything.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.everything.frag.out index aa9014c5839..c1f306e1090 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.everything.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.everything.frag.out @@ -1,6 +1,6 @@ remap.uniformarray.everything.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 25030 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.none.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.none.frag.out index cba724ea91f..6ed2d45e093 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.none.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/remap.uniformarray.none.frag.out @@ -1,6 +1,6 @@ remap.uniformarray.none.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 53 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/runtimeArray.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/runtimeArray.vert.out new file mode 100644 index 00000000000..5ba399291b9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/runtimeArray.vert.out @@ -0,0 +1,647 @@ +runtimeArray.vert +WARNING: 0:33: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array +WARNING: 0:34: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array +WARNING: 0:37: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array +WARNING: 0:38: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array +WARNING: 0:39: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array +WARNING: 0:40: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array +ERROR: 0:61: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:62: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:63: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:66: 'length' : array must be declared with a size before using this method +ERROR: 0:67: 'length' : array must be declared with a size before using this method +ERROR: 0:68: 'length' : array must be declared with a size before using this method +ERROR: 0:71: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:72: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:73: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:76: 'length' : array must be declared with a size before using this method +ERROR: 0:77: 'length' : array must be declared with a size before using this method +ERROR: 0:78: 'length' : array must be declared with a size before using this method +ERROR: 0:81: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:82: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:83: '[' : array must be redeclared with a size before being indexed with a variable +ERROR: 0:86: 'length' : array must be declared with a size before using this method +ERROR: 0:87: 'length' : array must be declared with a size before using this method +ERROR: 0:88: 'length' : array must be declared with a size before using this method +ERROR: 0:100: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:101: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:102: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:103: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:104: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:105: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:106: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:107: 'variable index' : required extension not requested: GL_EXT_nonuniform_qualifier +ERROR: 0:109: '[]' : array initializer must be sized +ERROR: 27 compilation errors. No code generated. + + +Shader version: 450 +ERROR: node is still EOpNull! +0:44 Function Definition: main( ( global void) +0:44 Function Parameters: +0:46 Sequence +0:46 direct index (layout( column_major shared) temp int) +0:46 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:46 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 3 (const int) +0:47 direct index (layout( column_major shared) temp float) +0:47 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:47 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 3 (const int) +0:48 direct index (layout( column_major shared) temp int) +0:48 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:48 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:48 Constant: +0:48 0 (const int) +0:48 Constant: +0:48 3 (const int) +0:49 direct index (layout( column_major shared) temp float) +0:49 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:49 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:49 Constant: +0:49 1 (const int) +0:49 Constant: +0:49 3 (const int) +0:51 direct index (layout( column_major shared) temp int) +0:51 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:51 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:51 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:51 Constant: +0:51 3 (const int) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:52 direct index (layout( column_major shared) temp float) +0:52 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:52 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:52 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:52 Constant: +0:52 3 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 3 (const int) +0:53 direct index (layout( column_major shared) temp int) +0:53 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:53 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:53 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:53 Constant: +0:53 3 (const int) +0:53 Constant: +0:53 0 (const int) +0:53 Constant: +0:53 3 (const int) +0:54 direct index (layout( column_major shared) temp float) +0:54 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:54 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:54 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:54 Constant: +0:54 3 (const int) +0:54 Constant: +0:54 1 (const int) +0:54 Constant: +0:54 3 (const int) +0:56 direct index (layout( column_major shared) temp int) +0:56 aua: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:56 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:56 Constant: +0:56 0 (const uint) +0:56 Constant: +0:56 3 (const int) +0:57 direct index (layout( column_major shared) temp float) +0:57 aub: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:57 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:57 Constant: +0:57 1 (const uint) +0:57 Constant: +0:57 3 (const int) +0:58 direct index (layout( column_major shared) temp int) +0:58 aba: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:58 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:58 Constant: +0:58 0 (const uint) +0:58 Constant: +0:58 3 (const int) +0:59 direct index (layout( column_major shared) temp float) +0:59 abb: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:59 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:59 Constant: +0:59 1 (const uint) +0:59 Constant: +0:59 3 (const int) +0:61 indirect index (layout( column_major shared) temp int) +0:61 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:61 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:61 Constant: +0:61 0 (const int) +0:61 'i' ( global int) +0:62 indirect index (layout( column_major shared) temp float) +0:62 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:62 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:62 Constant: +0:62 1 (const int) +0:62 'i' ( global int) +0:63 indirect index (layout( column_major shared) temp int) +0:63 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:63 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:63 Constant: +0:63 0 (const int) +0:63 'i' ( global int) +0:64 indirect index (layout( column_major shared) temp float) +0:64 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:64 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:64 Constant: +0:64 1 (const int) +0:64 'i' ( global int) +0:66 Constant: +0:66 1 (const int) +0:67 Constant: +0:67 1 (const int) +0:68 Constant: +0:68 1 (const int) +0:69 array length ( temp int) +0:69 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:69 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:69 Constant: +0:69 1 (const int) +0:71 indirect index (layout( column_major shared) temp int) +0:71 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:71 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:71 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 0 (const int) +0:71 'i' ( global int) +0:72 indirect index (layout( column_major shared) temp float) +0:72 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:72 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:72 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 'i' ( global int) +0:73 indirect index (layout( column_major shared) temp int) +0:73 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:73 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:73 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:73 Constant: +0:73 1 (const int) +0:73 Constant: +0:73 0 (const int) +0:73 'i' ( global int) +0:74 indirect index (layout( column_major shared) temp float) +0:74 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:74 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:74 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:74 Constant: +0:74 1 (const int) +0:74 Constant: +0:74 1 (const int) +0:74 'i' ( global int) +0:76 Constant: +0:76 1 (const int) +0:77 Constant: +0:77 1 (const int) +0:78 Constant: +0:78 1 (const int) +0:79 array length ( temp int) +0:79 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:79 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:79 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:79 Constant: +0:79 1 (const int) +0:79 Constant: +0:79 1 (const int) +0:81 indirect index (layout( column_major shared) temp int) +0:81 aua: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:81 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:81 Constant: +0:81 0 (const uint) +0:81 'i' ( global int) +0:82 indirect index (layout( column_major shared) temp float) +0:82 aub: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:82 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:82 Constant: +0:82 1 (const uint) +0:82 'i' ( global int) +0:83 indirect index (layout( column_major shared) temp int) +0:83 aba: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:83 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:83 Constant: +0:83 0 (const uint) +0:83 'i' ( global int) +0:84 indirect index (layout( column_major shared) temp float) +0:84 abb: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:84 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:84 Constant: +0:84 1 (const uint) +0:84 'i' ( global int) +0:86 Constant: +0:86 1 (const int) +0:87 Constant: +0:87 1 (const int) +0:88 Constant: +0:88 1 (const int) +0:89 array length ( temp int) +0:89 abb: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:89 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:89 Constant: +0:89 1 (const uint) +0:91 direct index (layout( binding=1) temp samplerBuffer) +0:91 'uniformTexelBufferDyn' (layout( binding=1) uniform runtime-sized array of samplerBuffer) +0:91 Constant: +0:91 1 (const int) +0:92 direct index (layout( binding=2 r32f) temp imageBuffer) +0:92 'storageTexelBufferDyn' (layout( binding=2 r32f) uniform runtime-sized array of imageBuffer) +0:92 Constant: +0:92 1 (const int) +0:93 direct index (layout( binding=3 column_major shared) temp block{layout( column_major shared) uniform float a}) +0:93 'uniformBuffer' (layout( binding=3 column_major shared) uniform runtime-sized array of block{layout( column_major shared) uniform float a}) +0:93 Constant: +0:93 1 (const int) +0:94 direct index (layout( binding=4 column_major shared) temp block{layout( column_major shared) buffer float b}) +0:94 'storageBuffer' (layout( binding=4 column_major shared) buffer runtime-sized array of block{layout( column_major shared) buffer float b}) +0:94 Constant: +0:94 1 (const int) +0:95 direct index (layout( binding=5) temp sampler2D) +0:95 'sampledImage' (layout( binding=5) uniform runtime-sized array of sampler2D) +0:95 Constant: +0:95 1 (const int) +0:96 direct index (layout( binding=6 r32f) temp image2D) +0:96 'storageImage' (layout( binding=6 r32f) uniform runtime-sized array of image2D) +0:96 Constant: +0:96 1 (const int) +0:97 direct index (layout( binding=8) temp samplerBuffer) +0:97 'uniformTexelBuffer' (layout( binding=8) uniform runtime-sized array of samplerBuffer) +0:97 Constant: +0:97 1 (const int) +0:98 direct index (layout( binding=9 r32f) temp imageBuffer) +0:98 'storageTexelBuffer' (layout( binding=9 r32f) uniform runtime-sized array of imageBuffer) +0:98 Constant: +0:98 1 (const int) +0:100 indirect index (layout( binding=1) temp samplerBuffer) +0:100 'uniformTexelBufferDyn' (layout( binding=1) uniform runtime-sized array of samplerBuffer) +0:100 'i' ( global int) +0:101 indirect index (layout( binding=2 r32f) temp imageBuffer) +0:101 'storageTexelBufferDyn' (layout( binding=2 r32f) uniform runtime-sized array of imageBuffer) +0:101 'i' ( global int) +0:102 indirect index (layout( binding=3 column_major shared) temp block{layout( column_major shared) uniform float a}) +0:102 'uniformBuffer' (layout( binding=3 column_major shared) uniform runtime-sized array of block{layout( column_major shared) uniform float a}) +0:102 'i' ( global int) +0:103 indirect index (layout( binding=4 column_major shared) temp block{layout( column_major shared) buffer float b}) +0:103 'storageBuffer' (layout( binding=4 column_major shared) buffer runtime-sized array of block{layout( column_major shared) buffer float b}) +0:103 'i' ( global int) +0:104 indirect index (layout( binding=5) temp sampler2D) +0:104 'sampledImage' (layout( binding=5) uniform runtime-sized array of sampler2D) +0:104 'i' ( global int) +0:105 indirect index (layout( binding=6 r32f) temp image2D) +0:105 'storageImage' (layout( binding=6 r32f) uniform runtime-sized array of image2D) +0:105 'i' ( global int) +0:106 indirect index (layout( binding=8) temp samplerBuffer) +0:106 'uniformTexelBuffer' (layout( binding=8) uniform runtime-sized array of samplerBuffer) +0:106 'i' ( global int) +0:107 indirect index (layout( binding=9 r32f) temp imageBuffer) +0:107 'storageTexelBuffer' (layout( binding=9 r32f) uniform runtime-sized array of imageBuffer) +0:107 'i' ( global int) +0:109 Sequence +0:109 move second child to first child ( temp unsized 1-element array of float) +0:109 'local' ( temp unsized 1-element array of float) +0:109 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:109 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:109 Constant: +0:109 1 (const int) +0:? Linker Objects +0:? 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:? 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:? 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:? 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:? 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:? 'uniformTexelBufferDyn' (layout( binding=1) uniform runtime-sized array of samplerBuffer) +0:? 'storageTexelBufferDyn' (layout( binding=2 r32f) uniform runtime-sized array of imageBuffer) +0:? 'uniformBuffer' (layout( binding=3 column_major shared) uniform runtime-sized array of block{layout( column_major shared) uniform float a}) +0:? 'storageBuffer' (layout( binding=4 column_major shared) buffer runtime-sized array of block{layout( column_major shared) buffer float b}) +0:? 'sampledImage' (layout( binding=5) uniform runtime-sized array of sampler2D) +0:? 'storageImage' (layout( binding=6 r32f) uniform runtime-sized array of image2D) +0:? 'uniformTexelBuffer' (layout( binding=8) uniform runtime-sized array of samplerBuffer) +0:? 'storageTexelBuffer' (layout( binding=9 r32f) uniform runtime-sized array of imageBuffer) +0:? 'i' ( global int) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 450 +ERROR: node is still EOpNull! +0:44 Function Definition: main( ( global void) +0:44 Function Parameters: +0:46 Sequence +0:46 direct index (layout( column_major shared) temp int) +0:46 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:46 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:46 Constant: +0:46 0 (const int) +0:46 Constant: +0:46 3 (const int) +0:47 direct index (layout( column_major shared) temp float) +0:47 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:47 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:47 Constant: +0:47 1 (const int) +0:47 Constant: +0:47 3 (const int) +0:48 direct index (layout( column_major shared) temp int) +0:48 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:48 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:48 Constant: +0:48 0 (const int) +0:48 Constant: +0:48 3 (const int) +0:49 direct index (layout( column_major shared) temp float) +0:49 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:49 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:49 Constant: +0:49 1 (const int) +0:49 Constant: +0:49 3 (const int) +0:51 direct index (layout( column_major shared) temp int) +0:51 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:51 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:51 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:51 Constant: +0:51 3 (const int) +0:51 Constant: +0:51 0 (const int) +0:51 Constant: +0:51 3 (const int) +0:52 direct index (layout( column_major shared) temp float) +0:52 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:52 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:52 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:52 Constant: +0:52 3 (const int) +0:52 Constant: +0:52 1 (const int) +0:52 Constant: +0:52 3 (const int) +0:53 direct index (layout( column_major shared) temp int) +0:53 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:53 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:53 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:53 Constant: +0:53 3 (const int) +0:53 Constant: +0:53 0 (const int) +0:53 Constant: +0:53 3 (const int) +0:54 direct index (layout( column_major shared) temp float) +0:54 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:54 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:54 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:54 Constant: +0:54 3 (const int) +0:54 Constant: +0:54 1 (const int) +0:54 Constant: +0:54 3 (const int) +0:56 direct index (layout( column_major shared) temp int) +0:56 aua: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:56 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:56 Constant: +0:56 0 (const uint) +0:56 Constant: +0:56 3 (const int) +0:57 direct index (layout( column_major shared) temp float) +0:57 aub: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:57 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:57 Constant: +0:57 1 (const uint) +0:57 Constant: +0:57 3 (const int) +0:58 direct index (layout( column_major shared) temp int) +0:58 aba: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:58 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:58 Constant: +0:58 0 (const uint) +0:58 Constant: +0:58 3 (const int) +0:59 direct index (layout( column_major shared) temp float) +0:59 abb: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:59 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:59 Constant: +0:59 1 (const uint) +0:59 Constant: +0:59 3 (const int) +0:61 indirect index (layout( column_major shared) temp int) +0:61 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:61 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:61 Constant: +0:61 0 (const int) +0:61 'i' ( global int) +0:62 indirect index (layout( column_major shared) temp float) +0:62 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:62 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:62 Constant: +0:62 1 (const int) +0:62 'i' ( global int) +0:63 indirect index (layout( column_major shared) temp int) +0:63 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:63 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:63 Constant: +0:63 0 (const int) +0:63 'i' ( global int) +0:64 indirect index (layout( column_major shared) temp float) +0:64 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:64 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:64 Constant: +0:64 1 (const int) +0:64 'i' ( global int) +0:66 Constant: +0:66 1 (const int) +0:67 Constant: +0:67 1 (const int) +0:68 Constant: +0:68 1 (const int) +0:69 array length ( temp int) +0:69 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:69 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:69 Constant: +0:69 1 (const int) +0:71 indirect index (layout( column_major shared) temp int) +0:71 a: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:71 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:71 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:71 Constant: +0:71 1 (const int) +0:71 Constant: +0:71 0 (const int) +0:71 'i' ( global int) +0:72 indirect index (layout( column_major shared) temp float) +0:72 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:72 direct index (layout( column_major shared) temp block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:72 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:72 Constant: +0:72 1 (const int) +0:72 Constant: +0:72 1 (const int) +0:72 'i' ( global int) +0:73 indirect index (layout( column_major shared) temp int) +0:73 a: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:73 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:73 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:73 Constant: +0:73 1 (const int) +0:73 Constant: +0:73 0 (const int) +0:73 'i' ( global int) +0:74 indirect index (layout( column_major shared) temp float) +0:74 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:74 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:74 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:74 Constant: +0:74 1 (const int) +0:74 Constant: +0:74 1 (const int) +0:74 'i' ( global int) +0:76 Constant: +0:76 1 (const int) +0:77 Constant: +0:77 1 (const int) +0:78 Constant: +0:78 1 (const int) +0:79 array length ( temp int) +0:79 b: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:79 direct index (layout( column_major shared) temp block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:79 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:79 Constant: +0:79 1 (const int) +0:79 Constant: +0:79 1 (const int) +0:81 indirect index (layout( column_major shared) temp int) +0:81 aua: direct index for structure (layout( column_major shared) uniform runtime-sized array of int) +0:81 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:81 Constant: +0:81 0 (const uint) +0:81 'i' ( global int) +0:82 indirect index (layout( column_major shared) temp float) +0:82 aub: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:82 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:82 Constant: +0:82 1 (const uint) +0:82 'i' ( global int) +0:83 indirect index (layout( column_major shared) temp int) +0:83 aba: direct index for structure (layout( column_major shared) buffer runtime-sized array of int) +0:83 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:83 Constant: +0:83 0 (const uint) +0:83 'i' ( global int) +0:84 indirect index (layout( column_major shared) temp float) +0:84 abb: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:84 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:84 Constant: +0:84 1 (const uint) +0:84 'i' ( global int) +0:86 Constant: +0:86 1 (const int) +0:87 Constant: +0:87 1 (const int) +0:88 Constant: +0:88 1 (const int) +0:89 array length ( temp int) +0:89 abb: direct index for structure (layout( column_major shared) buffer runtime-sized array of float) +0:89 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:89 Constant: +0:89 1 (const uint) +0:91 direct index (layout( binding=1) temp samplerBuffer) +0:91 'uniformTexelBufferDyn' (layout( binding=1) uniform runtime-sized array of samplerBuffer) +0:91 Constant: +0:91 1 (const int) +0:92 direct index (layout( binding=2 r32f) temp imageBuffer) +0:92 'storageTexelBufferDyn' (layout( binding=2 r32f) uniform runtime-sized array of imageBuffer) +0:92 Constant: +0:92 1 (const int) +0:93 direct index (layout( binding=3 column_major shared) temp block{layout( column_major shared) uniform float a}) +0:93 'uniformBuffer' (layout( binding=3 column_major shared) uniform runtime-sized array of block{layout( column_major shared) uniform float a}) +0:93 Constant: +0:93 1 (const int) +0:94 direct index (layout( binding=4 column_major shared) temp block{layout( column_major shared) buffer float b}) +0:94 'storageBuffer' (layout( binding=4 column_major shared) buffer runtime-sized array of block{layout( column_major shared) buffer float b}) +0:94 Constant: +0:94 1 (const int) +0:95 direct index (layout( binding=5) temp sampler2D) +0:95 'sampledImage' (layout( binding=5) uniform runtime-sized array of sampler2D) +0:95 Constant: +0:95 1 (const int) +0:96 direct index (layout( binding=6 r32f) temp image2D) +0:96 'storageImage' (layout( binding=6 r32f) uniform runtime-sized array of image2D) +0:96 Constant: +0:96 1 (const int) +0:97 direct index (layout( binding=8) temp samplerBuffer) +0:97 'uniformTexelBuffer' (layout( binding=8) uniform runtime-sized array of samplerBuffer) +0:97 Constant: +0:97 1 (const int) +0:98 direct index (layout( binding=9 r32f) temp imageBuffer) +0:98 'storageTexelBuffer' (layout( binding=9 r32f) uniform runtime-sized array of imageBuffer) +0:98 Constant: +0:98 1 (const int) +0:100 indirect index (layout( binding=1) temp samplerBuffer) +0:100 'uniformTexelBufferDyn' (layout( binding=1) uniform runtime-sized array of samplerBuffer) +0:100 'i' ( global int) +0:101 indirect index (layout( binding=2 r32f) temp imageBuffer) +0:101 'storageTexelBufferDyn' (layout( binding=2 r32f) uniform runtime-sized array of imageBuffer) +0:101 'i' ( global int) +0:102 indirect index (layout( binding=3 column_major shared) temp block{layout( column_major shared) uniform float a}) +0:102 'uniformBuffer' (layout( binding=3 column_major shared) uniform runtime-sized array of block{layout( column_major shared) uniform float a}) +0:102 'i' ( global int) +0:103 indirect index (layout( binding=4 column_major shared) temp block{layout( column_major shared) buffer float b}) +0:103 'storageBuffer' (layout( binding=4 column_major shared) buffer runtime-sized array of block{layout( column_major shared) buffer float b}) +0:103 'i' ( global int) +0:104 indirect index (layout( binding=5) temp sampler2D) +0:104 'sampledImage' (layout( binding=5) uniform runtime-sized array of sampler2D) +0:104 'i' ( global int) +0:105 indirect index (layout( binding=6 r32f) temp image2D) +0:105 'storageImage' (layout( binding=6 r32f) uniform runtime-sized array of image2D) +0:105 'i' ( global int) +0:106 indirect index (layout( binding=8) temp samplerBuffer) +0:106 'uniformTexelBuffer' (layout( binding=8) uniform runtime-sized array of samplerBuffer) +0:106 'i' ( global int) +0:107 indirect index (layout( binding=9 r32f) temp imageBuffer) +0:107 'storageTexelBuffer' (layout( binding=9 r32f) uniform runtime-sized array of imageBuffer) +0:107 'i' ( global int) +0:109 Sequence +0:109 move second child to first child ( temp 1-element array of float) +0:109 'local' ( temp 1-element array of float) +0:109 b: direct index for structure (layout( column_major shared) uniform runtime-sized array of float) +0:109 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:109 Constant: +0:109 1 (const int) +0:? Linker Objects +0:? 'buf' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:? 'ubuf' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:? 'bufa' (layout( column_major shared) buffer 4-element array of block{layout( column_major shared) buffer runtime-sized array of int a, layout( column_major shared) buffer runtime-sized array of float b}) +0:? 'ubufa' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform runtime-sized array of int a, layout( column_major shared) uniform runtime-sized array of float b}) +0:? 'anon@0' (layout( column_major shared) buffer block{layout( column_major shared) buffer runtime-sized array of int aba, layout( column_major shared) buffer runtime-sized array of float abb}) +0:? 'anon@1' (layout( column_major shared) uniform block{layout( column_major shared) uniform runtime-sized array of int aua, layout( column_major shared) uniform runtime-sized array of float aub}) +0:? 'uniformTexelBufferDyn' (layout( binding=1) uniform runtime-sized array of samplerBuffer) +0:? 'storageTexelBufferDyn' (layout( binding=2 r32f) uniform runtime-sized array of imageBuffer) +0:? 'uniformBuffer' (layout( binding=3 column_major shared) uniform runtime-sized array of block{layout( column_major shared) uniform float a}) +0:? 'storageBuffer' (layout( binding=4 column_major shared) buffer runtime-sized array of block{layout( column_major shared) buffer float b}) +0:? 'sampledImage' (layout( binding=5) uniform runtime-sized array of sampler2D) +0:? 'storageImage' (layout( binding=6 r32f) uniform runtime-sized array of image2D) +0:? 'uniformTexelBuffer' (layout( binding=8) uniform runtime-sized array of samplerBuffer) +0:? 'storageTexelBuffer' (layout( binding=9 r32f) uniform runtime-sized array of imageBuffer) +0:? 'i' ( global int) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/samplerlessTextureFunctions.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/samplerlessTextureFunctions.frag.out new file mode 100644 index 00000000000..8ac8d4deb07 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/samplerlessTextureFunctions.frag.out @@ -0,0 +1,13 @@ +samplerlessTextureFunctions.frag +ERROR: 0:9: 'texelFetch' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:10: 'texelFetch' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:16: 'texelFetchOffset' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:18: 'textureSize' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:19: 'textureSize' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:20: 'textureSize' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:22: 'textureQueryLevels' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 0:24: 'textureSamples' : required extension not requested: GL_EXT_samplerless_texture_functions +ERROR: 8 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.frag.out index ba47b6c753f..5eec3cbf449 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.frag.out @@ -320,7 +320,7 @@ ERROR: node is still EOpNull! 0:? 'factor' (layout( location=3 index=1) out 4-component vector of float) 0:? 'colors' (layout( location=2) out 3-element array of 4-component vector of float) 0:? 'gl_FragDepth' ( gl_FragDepth float FragDepth) -0:? 'anon@2' ( in block{ in float FogFragCoord gl_FogFragCoord, in implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, flat in 4-component vector of float Color gl_Color, in 4-component vector of float SecondaryColor gl_SecondaryColor}) +0:? 'anon@2' ( in block{ in float FogFragCoord gl_FogFragCoord, in unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, flat in 4-component vector of float Color gl_Color, in 4-component vector of float SecondaryColor gl_SecondaryColor}) Linked fragment stage: diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.vert.out index 71ce868987d..5c8ca391b55 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamples.vert.out @@ -19,7 +19,6 @@ ERROR: 0:85: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCount ERROR: 0:87: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings ERROR: 0:89: 'binding' : atomic_uint binding is too large ERROR: 0:91: 'bar' : redefinition -ERROR: 0:92: 'atomic_uint' : layout(binding=X) is required ERROR: 0:94: 'a2' : redefinition ERROR: 0:95: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings ERROR: 0:96: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings @@ -32,7 +31,7 @@ ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:153: '' : function does not return a value: func3 ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter -ERROR: 33 compilation errors. No code generated. +ERROR: 32 compilation errors. No code generated. Shader version: 430 @@ -277,7 +276,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'Coords' ( out block{ out 4-component vector of float Position, out 2-component vector of float Texture}) 0:? 'anon@0' ( out block{ out 4-component vector of float Color}) -0:? 'transforms' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform 4X4 matrix of float ModelViewMatrix, layout( column_major shared) uniform 4X4 matrix of float ModelViewProjectionMatrix, layout( column_major shared) uniform implicitly-sized array of 4-component vector of float a, layout( column_major shared) uniform float Deformation}) +0:? 'transforms' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform 4X4 matrix of float ModelViewMatrix, layout( column_major shared) uniform 4X4 matrix of float ModelViewProjectionMatrix, layout( column_major shared) uniform unsized 1-element array of 4-component vector of float a, layout( column_major shared) uniform float Deformation}) 0:? 'normal' (layout( location=3) in 4-component vector of float) 0:? 'colors' (layout( location=6) in 3-element array of 4-component vector of float) 0:? 'transforms2' (layout( location=9) in 2-element array of 4X4 matrix of float) @@ -296,7 +295,7 @@ ERROR: node is still EOpNull! 0:? 'b2' (layout( binding=2) uniform atomic_uint) 0:? 'c2' (layout( binding=3) uniform atomic_uint) 0:? 'd2' (layout( binding=2) uniform atomic_uint) -0:? 'anon@5' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, flat out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:? 'anon@5' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, flat out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:? 'ColorInv' ( smooth out 3-component vector of float) 0:? 'Color4' ( invariant centroid smooth out 3-component vector of float) 0:? 'position' ( noContraction smooth out 4-component vector of float) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out new file mode 100644 index 00000000000..e7217817ddf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out @@ -0,0 +1,599 @@ +specExamples.vert +ERROR: 0:29: 'location' : can only apply to uniform, buffer, in, or out storage qualifiers +ERROR: 0:31: 'triangles' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) +ERROR: 0:31: 'invocations' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:33: 'lines' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) +ERROR: 0:35: 'triangle_strip' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) +ERROR: 0:35: 'max_vertices' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:36: 'max_vertices' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:37: 'triangle_strip' : unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4) +ERROR: 0:41: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:43: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:45: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:46: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:47: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:50: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:55: 'stream' : there is no such layout identifier for this stage taking an assigned value +ERROR: 0:80: 's17' : redefinition +ERROR: 0:85: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 0:87: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 0:89: 'binding' : atomic_uint binding is too large +ERROR: 0:91: 'bar' : redefinition +ERROR: 0:92: 'atomic_uint' : layout(binding=X) is required +ERROR: 0:94: 'a2' : redefinition +ERROR: 0:95: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 0:96: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 0:97: 'binding' : atomic_uint binding is too large; see gl_MaxAtomicCounterBindings +ERROR: 0:106: '' : vertex input cannot be further qualified +ERROR: 0:106: 'redeclaration' : cannot change storage, memory, or auxiliary qualification of gl_FrontColor +ERROR: 0:112: 'ColorIvn' : identifier not previously declared +ERROR: 0:132: 'shared' : not supported in this stage: vertex +ERROR: 0:134: '' : function does not return a value: funcA +ERROR: 0:136: '' : function does not return a value: funcB +ERROR: 0:153: '' : function does not return a value: func3 +ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 33 compilation errors. No code generated. + + +Shader version: 430 +Requested GL_3DL_array_objects +ERROR: node is still EOpNull! +0:134 Function Definition: funcA(I21; ( global 4-component vector of float) +0:134 Function Parameters: +0:134 'a' ( restrict in image2D) +0:136 Function Definition: funcB(I21; ( global 4-component vector of float) +0:136 Function Parameters: +0:136 'a' ( in image2D) +0:140 Function Definition: func(f1;f1;f1;f1; ( global float) +0:140 Function Parameters: +0:140 'e' ( in float) +0:140 'f' ( in float) +0:140 'g' ( in float) +0:140 'h' ( in float) +0:142 Sequence +0:142 Branch: Return with expression +0:142 add ( temp float) +0:142 component-wise multiply ( temp float) +0:142 'e' ( in float) +0:142 'f' ( in float) +0:142 component-wise multiply ( temp float) +0:142 'g' ( in float) +0:142 'h' ( in float) +0:146 Function Definition: func2(f1;f1;f1;f1; ( global float) +0:146 Function Parameters: +0:146 'e' ( in float) +0:146 'f' ( in float) +0:146 'g' ( in float) +0:146 'h' ( in float) +0:148 Sequence +0:148 Sequence +0:148 move second child to first child ( temp float) +0:148 'result' ( noContraction temp float) +0:148 add ( temp float) +0:148 component-wise multiply ( temp float) +0:148 'e' ( in float) +0:148 'f' ( in float) +0:148 component-wise multiply ( temp float) +0:148 'g' ( in float) +0:148 'h' ( in float) +0:150 Branch: Return with expression +0:150 'result' ( noContraction temp float) +0:153 Function Definition: func3(f1;f1;f1; ( global float) +0:153 Function Parameters: +0:153 'i' ( in float) +0:153 'j' ( in float) +0:153 'k' ( noContraction out float) +0:155 Sequence +0:155 move second child to first child ( temp float) +0:155 'k' ( noContraction out float) +0:155 add ( temp float) +0:155 component-wise multiply ( temp float) +0:155 'i' ( in float) +0:155 'i' ( in float) +0:155 'j' ( in float) +0:158 Function Definition: main( ( global void) +0:158 Function Parameters: +0:160 Sequence +0:160 Sequence +0:160 move second child to first child ( temp 3-component vector of float) +0:160 'r' ( temp 3-component vector of float) +0:160 Construct vec3 ( temp 3-component vector of float) +0:160 component-wise multiply ( temp 4-component vector of float) +0:160 'a' ( in 4-component vector of float) +0:160 'b' ( in 4-component vector of float) +0:161 Sequence +0:161 move second child to first child ( temp 3-component vector of float) +0:161 's' ( temp 3-component vector of float) +0:161 Construct vec3 ( temp 3-component vector of float) +0:161 component-wise multiply ( temp 4-component vector of float) +0:161 'c' ( in 4-component vector of float) +0:161 'd' ( in 4-component vector of float) +0:162 move second child to first child ( temp 3-component vector of float) +0:162 vector swizzle ( noContraction temp 3-component vector of float) +0:162 'v' ( noContraction smooth out 4-component vector of float) +0:162 Sequence +0:162 Constant: +0:162 0 (const int) +0:162 Constant: +0:162 1 (const int) +0:162 Constant: +0:162 2 (const int) +0:162 add ( temp 3-component vector of float) +0:162 'r' ( temp 3-component vector of float) +0:162 's' ( temp 3-component vector of float) +0:163 move second child to first child ( temp float) +0:163 direct index ( noContraction temp float) +0:163 'v' ( noContraction smooth out 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 add ( temp float) +0:163 component-wise multiply ( temp float) +0:163 direct index ( temp float) +0:163 'a' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 direct index ( temp float) +0:163 'b' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 component-wise multiply ( temp float) +0:163 direct index ( temp float) +0:163 'c' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 direct index ( temp float) +0:163 'd' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:164 move second child to first child ( temp float) +0:164 direct index ( noContraction temp float) +0:164 'v' ( noContraction smooth out 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 Function Call: func(f1;f1;f1;f1; ( global float) +0:164 direct index ( temp float) +0:164 'a' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 direct index ( temp float) +0:164 'b' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 direct index ( temp float) +0:164 'c' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 direct index ( temp float) +0:164 'd' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:166 move second child to first child ( temp float) +0:166 direct index ( noContraction temp float) +0:166 'v' ( noContraction smooth out 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 Function Call: func2(f1;f1;f1;f1; ( global float) +0:166 direct index ( temp float) +0:166 'a' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 direct index ( temp float) +0:166 'b' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 direct index ( temp float) +0:166 'c' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 direct index ( temp float) +0:166 'd' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:167 Function Call: func3(f1;f1;f1; ( global float) +0:167 component-wise multiply ( temp float) +0:167 direct index ( temp float) +0:167 'a' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 direct index ( temp float) +0:167 'b' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 component-wise multiply ( temp float) +0:167 direct index ( temp float) +0:167 'c' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 direct index ( temp float) +0:167 'd' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 direct index ( noContraction temp float) +0:167 'v' ( noContraction smooth out 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:169 Function Call: funcA(I21; ( global 4-component vector of float) +0:169 'img1' (layout( rgba32f) uniform image2D) +0:170 Function Call: funcB(I21; ( global 4-component vector of float) +0:170 'img2' (layout( rgba32f) coherent uniform image2D) +0:? Sequence +0:178 Sequence +0:178 move second child to first child ( temp structure{ temp float intensity, temp 3-component vector of float position}) +0:178 'lightVar' ( temp structure{ temp float intensity, temp 3-component vector of float position}) +0:178 Constant: +0:178 3.000000 +0:178 1.000000 +0:178 2.000000 +0:178 3.000000 +0:? Sequence +0:185 Sequence +0:185 move second child to first child ( temp 5-element array of float) +0:185 'a' ( temp 5-element array of float) +0:185 Construct float ( temp 5-element array of float) +0:185 'g' ( temp float) +0:185 Constant: +0:185 1.000000 +0:185 'g' ( temp float) +0:185 Constant: +0:185 2.300000 +0:185 'g' ( temp float) +0:188 move second child to first child ( temp 3-element array of float) +0:188 'b' ( temp 3-element array of float) +0:188 Construct float ( temp 3-element array of float) +0:188 'g' ( temp float) +0:188 add ( temp float) +0:188 'g' ( temp float) +0:188 Constant: +0:188 1.000000 +0:188 add ( temp float) +0:188 'g' ( temp float) +0:188 Constant: +0:188 2.000000 +0:191 Sequence +0:191 Sequence +0:191 move second child to first child ( temp 2-element array of 4-component vector of float) +0:191 'b' ( temp 2-element array of 4-component vector of float) +0:191 Constant: +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:192 Construct vec4 ( temp 3-element array of 2-element array of 4-component vector of float) +0:192 'b' ( temp 2-element array of 4-component vector of float) +0:192 'b' ( temp 2-element array of 4-component vector of float) +0:192 'b' ( temp 2-element array of 4-component vector of float) +0:193 Construct vec4 ( temp 3-element array of 2-element array of 4-component vector of float) +0:193 'b' ( temp 2-element array of 4-component vector of float) +0:193 'b' ( temp 2-element array of 4-component vector of float) +0:193 'b' ( temp 2-element array of 4-component vector of float) +0:194 Construct vec4 ( temp 3-element array of 2-element array of 4-component vector of float) +0:194 'b' ( temp 2-element array of 4-component vector of float) +0:194 'b' ( temp 2-element array of 4-component vector of float) +0:194 'b' ( temp 2-element array of 4-component vector of float) +0:? Linker Objects +0:? 'Coords' ( out block{ out 4-component vector of float Position, out 2-component vector of float Texture}) +0:? 'anon@0' ( out block{ out 4-component vector of float Color}) +0:? 'transforms' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform 4X4 matrix of float ModelViewMatrix, layout( column_major shared) uniform 4X4 matrix of float ModelViewProjectionMatrix, layout( column_major shared) uniform unsized 1-element array of 4-component vector of float a, layout( column_major shared) uniform float Deformation}) +0:? 'normal' (layout( location=3) in 4-component vector of float) +0:? 'colors' (layout( location=6) in 3-element array of 4-component vector of float) +0:? 'transforms2' (layout( location=9) in 2-element array of 4X4 matrix of float) +0:? 's' (layout( location=3) temp structure{ global 3-component vector of float a1, global 2X2 matrix of float b, global 2-element array of 4-component vector of float c}) +0:? 'var1' ( smooth out 4-component vector of float) +0:? 'anon@1' ( out block{ out 4-component vector of float var2, out 2-component vector of float var3, out 3-component vector of float var4}) +0:? 'var5' ( smooth out 4-component vector of float) +0:? 'anon@2' ( out block{ out 4-component vector of float var6}) +0:? 'var7' ( smooth out 4-component vector of float) +0:? 'anon@3' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4X4 matrix of float M1, layout( column_major std140 offset=64) uniform 4X4 matrix of float M2, layout( row_major std140 offset=128) uniform 3X3 matrix of float N1}) +0:? 'anon@4' (layout( column_major shared) uniform block{layout( column_major shared) uniform 4X4 matrix of float M13, layout( row_major shared) uniform 4X4 matrix of float m14, layout( column_major shared) uniform 3X3 matrix of float N12}) +0:? 's17' (layout( binding=3) uniform sampler2D) +0:? 'a2' (layout( binding=2 offset=4) uniform atomic_uint) +0:? 'bar' (layout( binding=2) uniform atomic_uint) +0:? 'bar23' (layout( offset=8) uniform atomic_uint) +0:? 'b2' (layout( binding=2) uniform atomic_uint) +0:? 'c2' (layout( binding=3) uniform atomic_uint) +0:? 'd2' (layout( binding=2) uniform atomic_uint) +0:? 'anon@5' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, flat out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:? 'ColorInv' ( smooth out 3-component vector of float) +0:? 'Color4' ( invariant centroid smooth out 3-component vector of float) +0:? 'position' ( noContraction smooth out 4-component vector of float) +0:? 'Color5' ( noContraction smooth out 3-component vector of float) +0:? 'a' ( in 4-component vector of float) +0:? 'b' ( in 4-component vector of float) +0:? 'c' ( in 4-component vector of float) +0:? 'd' ( in 4-component vector of float) +0:? 'v' ( noContraction smooth out 4-component vector of float) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) +0:? 'shv' ( shared 4-component vector of float) +0:? 'img1' (layout( rgba32f) uniform image2D) +0:? 'img2' (layout( rgba32f) coherent uniform image2D) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 430 +Requested GL_3DL_array_objects +ERROR: node is still EOpNull! +0:134 Function Definition: funcA(I21; ( global 4-component vector of float) +0:134 Function Parameters: +0:134 'a' ( restrict in image2D) +0:136 Function Definition: funcB(I21; ( global 4-component vector of float) +0:136 Function Parameters: +0:136 'a' ( in image2D) +0:140 Function Definition: func(f1;f1;f1;f1; ( global float) +0:140 Function Parameters: +0:140 'e' ( in float) +0:140 'f' ( in float) +0:140 'g' ( in float) +0:140 'h' ( in float) +0:142 Sequence +0:142 Branch: Return with expression +0:142 add ( temp float) +0:142 component-wise multiply ( temp float) +0:142 'e' ( in float) +0:142 'f' ( in float) +0:142 component-wise multiply ( temp float) +0:142 'g' ( in float) +0:142 'h' ( in float) +0:146 Function Definition: func2(f1;f1;f1;f1; ( global float) +0:146 Function Parameters: +0:146 'e' ( in float) +0:146 'f' ( in float) +0:146 'g' ( in float) +0:146 'h' ( in float) +0:148 Sequence +0:148 Sequence +0:148 move second child to first child ( temp float) +0:148 'result' ( noContraction temp float) +0:148 add ( temp float) +0:148 component-wise multiply ( temp float) +0:148 'e' ( in float) +0:148 'f' ( in float) +0:148 component-wise multiply ( temp float) +0:148 'g' ( in float) +0:148 'h' ( in float) +0:150 Branch: Return with expression +0:150 'result' ( noContraction temp float) +0:153 Function Definition: func3(f1;f1;f1; ( global float) +0:153 Function Parameters: +0:153 'i' ( in float) +0:153 'j' ( in float) +0:153 'k' ( noContraction out float) +0:155 Sequence +0:155 move second child to first child ( temp float) +0:155 'k' ( noContraction out float) +0:155 add ( temp float) +0:155 component-wise multiply ( temp float) +0:155 'i' ( in float) +0:155 'i' ( in float) +0:155 'j' ( in float) +0:158 Function Definition: main( ( global void) +0:158 Function Parameters: +0:160 Sequence +0:160 Sequence +0:160 move second child to first child ( temp 3-component vector of float) +0:160 'r' ( temp 3-component vector of float) +0:160 Construct vec3 ( temp 3-component vector of float) +0:160 component-wise multiply ( temp 4-component vector of float) +0:160 'a' ( in 4-component vector of float) +0:160 'b' ( in 4-component vector of float) +0:161 Sequence +0:161 move second child to first child ( temp 3-component vector of float) +0:161 's' ( temp 3-component vector of float) +0:161 Construct vec3 ( temp 3-component vector of float) +0:161 component-wise multiply ( temp 4-component vector of float) +0:161 'c' ( in 4-component vector of float) +0:161 'd' ( in 4-component vector of float) +0:162 move second child to first child ( temp 3-component vector of float) +0:162 vector swizzle ( noContraction temp 3-component vector of float) +0:162 'v' ( noContraction smooth out 4-component vector of float) +0:162 Sequence +0:162 Constant: +0:162 0 (const int) +0:162 Constant: +0:162 1 (const int) +0:162 Constant: +0:162 2 (const int) +0:162 add ( temp 3-component vector of float) +0:162 'r' ( temp 3-component vector of float) +0:162 's' ( temp 3-component vector of float) +0:163 move second child to first child ( temp float) +0:163 direct index ( noContraction temp float) +0:163 'v' ( noContraction smooth out 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 add ( temp float) +0:163 component-wise multiply ( temp float) +0:163 direct index ( temp float) +0:163 'a' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 direct index ( temp float) +0:163 'b' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 component-wise multiply ( temp float) +0:163 direct index ( temp float) +0:163 'c' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:163 direct index ( temp float) +0:163 'd' ( in 4-component vector of float) +0:163 Constant: +0:163 3 (const int) +0:164 move second child to first child ( temp float) +0:164 direct index ( noContraction temp float) +0:164 'v' ( noContraction smooth out 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 Function Call: func(f1;f1;f1;f1; ( global float) +0:164 direct index ( temp float) +0:164 'a' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 direct index ( temp float) +0:164 'b' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 direct index ( temp float) +0:164 'c' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:164 direct index ( temp float) +0:164 'd' ( in 4-component vector of float) +0:164 Constant: +0:164 0 (const int) +0:166 move second child to first child ( temp float) +0:166 direct index ( noContraction temp float) +0:166 'v' ( noContraction smooth out 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 Function Call: func2(f1;f1;f1;f1; ( global float) +0:166 direct index ( temp float) +0:166 'a' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 direct index ( temp float) +0:166 'b' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 direct index ( temp float) +0:166 'c' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:166 direct index ( temp float) +0:166 'd' ( in 4-component vector of float) +0:166 Constant: +0:166 0 (const int) +0:167 Function Call: func3(f1;f1;f1; ( global float) +0:167 component-wise multiply ( temp float) +0:167 direct index ( temp float) +0:167 'a' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 direct index ( temp float) +0:167 'b' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 component-wise multiply ( temp float) +0:167 direct index ( temp float) +0:167 'c' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 direct index ( temp float) +0:167 'd' ( in 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:167 direct index ( noContraction temp float) +0:167 'v' ( noContraction smooth out 4-component vector of float) +0:167 Constant: +0:167 0 (const int) +0:169 Function Call: funcA(I21; ( global 4-component vector of float) +0:169 'img1' (layout( rgba32f) uniform image2D) +0:170 Function Call: funcB(I21; ( global 4-component vector of float) +0:170 'img2' (layout( rgba32f) coherent uniform image2D) +0:? Sequence +0:178 Sequence +0:178 move second child to first child ( temp structure{ temp float intensity, temp 3-component vector of float position}) +0:178 'lightVar' ( temp structure{ temp float intensity, temp 3-component vector of float position}) +0:178 Constant: +0:178 3.000000 +0:178 1.000000 +0:178 2.000000 +0:178 3.000000 +0:? Sequence +0:185 Sequence +0:185 move second child to first child ( temp 5-element array of float) +0:185 'a' ( temp 5-element array of float) +0:185 Construct float ( temp 5-element array of float) +0:185 'g' ( temp float) +0:185 Constant: +0:185 1.000000 +0:185 'g' ( temp float) +0:185 Constant: +0:185 2.300000 +0:185 'g' ( temp float) +0:188 move second child to first child ( temp 3-element array of float) +0:188 'b' ( temp 3-element array of float) +0:188 Construct float ( temp 3-element array of float) +0:188 'g' ( temp float) +0:188 add ( temp float) +0:188 'g' ( temp float) +0:188 Constant: +0:188 1.000000 +0:188 add ( temp float) +0:188 'g' ( temp float) +0:188 Constant: +0:188 2.000000 +0:191 Sequence +0:191 Sequence +0:191 move second child to first child ( temp 2-element array of 4-component vector of float) +0:191 'b' ( temp 2-element array of 4-component vector of float) +0:191 Constant: +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:191 1.000000 +0:192 Construct vec4 ( temp 3-element array of 2-element array of 4-component vector of float) +0:192 'b' ( temp 2-element array of 4-component vector of float) +0:192 'b' ( temp 2-element array of 4-component vector of float) +0:192 'b' ( temp 2-element array of 4-component vector of float) +0:193 Construct vec4 ( temp 3-element array of 2-element array of 4-component vector of float) +0:193 'b' ( temp 2-element array of 4-component vector of float) +0:193 'b' ( temp 2-element array of 4-component vector of float) +0:193 'b' ( temp 2-element array of 4-component vector of float) +0:194 Construct vec4 ( temp 3-element array of 2-element array of 4-component vector of float) +0:194 'b' ( temp 2-element array of 4-component vector of float) +0:194 'b' ( temp 2-element array of 4-component vector of float) +0:194 'b' ( temp 2-element array of 4-component vector of float) +0:? Linker Objects +0:? 'Coords' ( out block{ out 4-component vector of float Position, out 2-component vector of float Texture}) +0:? 'anon@0' ( out block{ out 4-component vector of float Color}) +0:? 'transforms' (layout( column_major shared) uniform 4-element array of block{layout( column_major shared) uniform 4X4 matrix of float ModelViewMatrix, layout( column_major shared) uniform 4X4 matrix of float ModelViewProjectionMatrix, layout( column_major shared) uniform 1-element array of 4-component vector of float a, layout( column_major shared) uniform float Deformation}) +0:? 'normal' (layout( location=3) in 4-component vector of float) +0:? 'colors' (layout( location=6) in 3-element array of 4-component vector of float) +0:? 'transforms2' (layout( location=9) in 2-element array of 4X4 matrix of float) +0:? 's' (layout( location=3) temp structure{ global 3-component vector of float a1, global 2X2 matrix of float b, global 2-element array of 4-component vector of float c}) +0:? 'var1' ( smooth out 4-component vector of float) +0:? 'anon@1' ( out block{ out 4-component vector of float var2, out 2-component vector of float var3, out 3-component vector of float var4}) +0:? 'var5' ( smooth out 4-component vector of float) +0:? 'anon@2' ( out block{ out 4-component vector of float var6}) +0:? 'var7' ( smooth out 4-component vector of float) +0:? 'anon@3' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4X4 matrix of float M1, layout( column_major std140 offset=64) uniform 4X4 matrix of float M2, layout( row_major std140 offset=128) uniform 3X3 matrix of float N1}) +0:? 'anon@4' (layout( column_major shared) uniform block{layout( column_major shared) uniform 4X4 matrix of float M13, layout( row_major shared) uniform 4X4 matrix of float m14, layout( column_major shared) uniform 3X3 matrix of float N12}) +0:? 's17' (layout( binding=3) uniform sampler2D) +0:? 'a2' (layout( binding=2 offset=4) uniform atomic_uint) +0:? 'bar' (layout( binding=2) uniform atomic_uint) +0:? 'bar23' (layout( offset=8) uniform atomic_uint) +0:? 'b2' (layout( binding=2) uniform atomic_uint) +0:? 'c2' (layout( binding=3) uniform atomic_uint) +0:? 'd2' (layout( binding=2) uniform atomic_uint) +0:? 'anon@5' ( out block{ invariant gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, flat out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:? 'ColorInv' ( smooth out 3-component vector of float) +0:? 'Color4' ( invariant centroid smooth out 3-component vector of float) +0:? 'position' ( noContraction smooth out 4-component vector of float) +0:? 'Color5' ( noContraction smooth out 3-component vector of float) +0:? 'a' ( in 4-component vector of float) +0:? 'b' ( in 4-component vector of float) +0:? 'c' ( in 4-component vector of float) +0:? 'd' ( in 4-component vector of float) +0:? 'v' ( noContraction smooth out 4-component vector of float) +0:? 'anon@6' (layout( column_major shared) coherent buffer block{layout( column_major shared) readonly buffer 4-component vector of float member1, layout( column_major shared) buffer 4-component vector of float member2}) +0:? 'anon@7' (layout( column_major shared) buffer block{layout( column_major shared) coherent readonly buffer 4-component vector of float member1A, layout( column_major shared) coherent buffer 4-component vector of float member2A}) +0:? 'shv' ( shared 4-component vector of float) +0:? 'img1' (layout( rgba32f) uniform image2D) +0:? 'img2' (layout( rgba32f) coherent uniform image2D) +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.1.3.8bitstorage-ssbo.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.1.3.8bitstorage-ssbo.vert.out new file mode 100644 index 00000000000..878aa1a2e9b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.1.3.8bitstorage-ssbo.vert.out @@ -0,0 +1,56 @@ +spv.1.3.8bitstorage-ssbo.vert +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 28 + + Capability Shader + Capability CapabilityStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 9 18 + Source GLSL 450 + SourceExtension "GL_EXT_shader_8bit_storage" + Name 4 "main" + Name 9 "color" + Name 12 "Vertices" + MemberName 12(Vertices) 0 "vertices" + Name 14 "" + Name 18 "gl_VertexIndex" + Decorate 9(color) Location 0 + Decorate 11 ArrayStride 1 + MemberDecorate 12(Vertices) 0 NonWritable + MemberDecorate 12(Vertices) 0 Offset 0 + Decorate 12(Vertices) Block + Decorate 14 DescriptorSet 0 + Decorate 14 Binding 0 + Decorate 18(gl_VertexIndex) BuiltIn VertexIndex + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(color): 8(ptr) Variable Output + 10: TypeInt 8 0 + 11: TypeRuntimeArray 10(int8_t) + 12(Vertices): TypeStruct 11 + 13: TypePointer StorageBuffer 12(Vertices) + 14: 13(ptr) Variable StorageBuffer + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Input 15(int) +18(gl_VertexIndex): 17(ptr) Variable Input + 20: TypePointer StorageBuffer 10(int8_t) + 23: TypeInt 32 0 + 4(main): 2 Function None 3 + 5: Label + 19: 15(int) Load 18(gl_VertexIndex) + 21: 20(ptr) AccessChain 14 16 19 + 22: 10(int8_t) Load 21 + 24: 23(int) UConvert 22 + 25: 15(int) Bitcast 24 + 26: 6(float) ConvertSToF 25 + 27: 7(fvec4) CompositeConstruct 26 26 26 26 + Store 9(color) 27 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.1.3.8bitstorage-ubo.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.1.3.8bitstorage-ubo.vert.out new file mode 100644 index 00000000000..54b497ff326 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.1.3.8bitstorage-ubo.vert.out @@ -0,0 +1,56 @@ +spv.1.3.8bitstorage-ubo.vert +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 29 + + Capability Shader + Capability CapabilityUniformAndStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 9 20 + Source GLSL 450 + SourceExtension "GL_EXT_shader_8bit_storage" + Name 4 "main" + Name 9 "color" + Name 14 "Vertices" + MemberName 14(Vertices) 0 "vertices" + Name 16 "" + Name 20 "gl_VertexIndex" + Decorate 9(color) Location 0 + Decorate 13 ArrayStride 16 + MemberDecorate 14(Vertices) 0 Offset 0 + Decorate 14(Vertices) Block + Decorate 16 DescriptorSet 0 + Decorate 16 Binding 0 + Decorate 20(gl_VertexIndex) BuiltIn VertexIndex + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(color): 8(ptr) Variable Output + 10: TypeInt 8 0 + 11: TypeInt 32 0 + 12: 11(int) Constant 512 + 13: TypeArray 10(int8_t) 12 + 14(Vertices): TypeStruct 13 + 15: TypePointer Uniform 14(Vertices) + 16: 15(ptr) Variable Uniform + 17: TypeInt 32 1 + 18: 17(int) Constant 0 + 19: TypePointer Input 17(int) +20(gl_VertexIndex): 19(ptr) Variable Input + 22: TypePointer Uniform 10(int8_t) + 4(main): 2 Function None 3 + 5: Label + 21: 17(int) Load 20(gl_VertexIndex) + 23: 22(ptr) AccessChain 16 18 21 + 24: 10(int8_t) Load 23 + 25: 11(int) UConvert 24 + 26: 17(int) Bitcast 25 + 27: 6(float) ConvertSToF 26 + 28: 7(fvec4) CompositeConstruct 27 27 27 27 + Store 9(color) 28 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.100ops.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.100ops.frag.out index 5cf2100f2d3..8f656ebb5c9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.100ops.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.100ops.frag.out @@ -1,6 +1,6 @@ spv.100ops.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 49 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.130.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.130.frag.out index 51e8b093cf1..eb02bade5df 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.130.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.130.frag.out @@ -1,8 +1,12 @@ spv.130.frag WARNING: 0:31: '#extension' : extension is only partially supported: GL_ARB_gpu_shader5 +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 205 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.140.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.140.frag.out index c63fb934062..8a59c2f9b15 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.140.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.140.frag.out @@ -1,6 +1,10 @@ spv.140.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 96 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.geom.out index 50267685506..f7597938394 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.geom.out @@ -1,6 +1,6 @@ spv.150.geom // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 71 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.vert.out index 2ad94617cad..282f5f9c0f9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.150.vert.out @@ -1,6 +1,6 @@ spv.150.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 63 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage-int.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage-int.frag.out new file mode 100644 index 00000000000..3f0fffd8e44 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage-int.frag.out @@ -0,0 +1,335 @@ +spv.16bitstorage-int.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 172 + + Capability Shader + Capability StorageUniformBufferBlock16 + Capability StorageUniform16 + Extension "SPV_KHR_16bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_shader_16bit_storage" + Name 4 "main" + Name 12 "S" + MemberName 12(S) 0 "x" + MemberName 12(S) 1 "y" + MemberName 12(S) 2 "z" + Name 17 "B2" + MemberName 17(B2) 0 "o" + MemberName 17(B2) 1 "p" + MemberName 17(B2) 2 "q" + MemberName 17(B2) 3 "r" + MemberName 17(B2) 4 "u" + MemberName 17(B2) 5 "v" + MemberName 17(B2) 6 "x" + MemberName 17(B2) 7 "w" + Name 19 "b2" + Name 23 "S" + MemberName 23(S) 0 "x" + MemberName 23(S) 1 "y" + MemberName 23(S) 2 "z" + Name 25 "B1" + MemberName 25(B1) 0 "a" + MemberName 25(B1) 1 "b" + MemberName 25(B1) 2 "c" + MemberName 25(B1) 3 "d" + MemberName 25(B1) 4 "g" + MemberName 25(B1) 5 "h" + MemberName 25(B1) 6 "j" + Name 27 "b1" + Name 45 "S" + MemberName 45(S) 0 "x" + MemberName 45(S) 1 "y" + MemberName 45(S) 2 "z" + Name 49 "B5" + MemberName 49(B5) 0 "o" + MemberName 49(B5) 1 "p" + MemberName 49(B5) 2 "q" + MemberName 49(B5) 3 "r" + MemberName 49(B5) 4 "u" + MemberName 49(B5) 5 "v" + MemberName 49(B5) 6 "x" + MemberName 49(B5) 7 "w" + Name 51 "b5" + Name 69 "x0" + Name 75 "x1" + Name 88 "S2" + MemberName 88(S2) 0 "x" + MemberName 88(S2) 1 "y" + MemberName 88(S2) 2 "z" + Name 89 "S3" + MemberName 89(S3) 0 "x" + Name 90 "B4" + MemberName 90(B4) 0 "x" + MemberName 90(B4) 1 "y" + Name 92 "b4" + Name 93 "S2" + MemberName 93(S2) 0 "x" + MemberName 93(S2) 1 "y" + MemberName 93(S2) 2 "z" + Name 94 "B3" + MemberName 94(B3) 0 "x" + Name 96 "b3" + Name 113 "v3" + Name 135 "u3" + Decorate 11 ArrayStride 2 + MemberDecorate 12(S) 0 Offset 0 + MemberDecorate 12(S) 1 Offset 4 + MemberDecorate 12(S) 2 Offset 8 + Decorate 13 ArrayStride 16 + Decorate 15 ArrayStride 4 + Decorate 16 ArrayStride 2 + MemberDecorate 17(B2) 0 Offset 0 + MemberDecorate 17(B2) 1 Offset 4 + MemberDecorate 17(B2) 2 Offset 8 + MemberDecorate 17(B2) 3 Offset 14 + MemberDecorate 17(B2) 4 Offset 24 + MemberDecorate 17(B2) 5 Offset 40 + MemberDecorate 17(B2) 6 Offset 72 + MemberDecorate 17(B2) 7 Offset 472 + Decorate 17(B2) BufferBlock + Decorate 19(b2) DescriptorSet 0 + Decorate 22 ArrayStride 16 + MemberDecorate 23(S) 0 Offset 0 + MemberDecorate 23(S) 1 Offset 4 + MemberDecorate 23(S) 2 Offset 8 + Decorate 24 ArrayStride 16 + MemberDecorate 25(B1) 0 Offset 0 + MemberDecorate 25(B1) 1 Offset 4 + MemberDecorate 25(B1) 2 Offset 8 + MemberDecorate 25(B1) 3 Offset 16 + MemberDecorate 25(B1) 4 Offset 48 + MemberDecorate 25(B1) 5 Offset 64 + MemberDecorate 25(B1) 6 Offset 96 + Decorate 25(B1) Block + Decorate 27(b1) DescriptorSet 0 + Decorate 44 ArrayStride 16 + MemberDecorate 45(S) 0 Offset 0 + MemberDecorate 45(S) 1 Offset 4 + MemberDecorate 45(S) 2 Offset 8 + Decorate 46 ArrayStride 16 + Decorate 47 ArrayStride 16 + Decorate 48 ArrayStride 16 + MemberDecorate 49(B5) 0 Offset 0 + MemberDecorate 49(B5) 1 Offset 4 + MemberDecorate 49(B5) 2 Offset 8 + MemberDecorate 49(B5) 3 Offset 16 + MemberDecorate 49(B5) 4 Offset 48 + MemberDecorate 49(B5) 5 Offset 64 + MemberDecorate 49(B5) 6 Offset 96 + MemberDecorate 49(B5) 7 Offset 1696 + Decorate 49(B5) Block + Decorate 51(b5) DescriptorSet 0 + MemberDecorate 88(S2) 0 ColMajor + MemberDecorate 88(S2) 0 Offset 0 + MemberDecorate 88(S2) 0 MatrixStride 16 + MemberDecorate 88(S2) 1 Offset 64 + MemberDecorate 88(S2) 2 Offset 68 + MemberDecorate 89(S3) 0 Offset 0 + MemberDecorate 90(B4) 0 Offset 0 + MemberDecorate 90(B4) 1 Offset 80 + Decorate 90(B4) BufferBlock + Decorate 92(b4) DescriptorSet 0 + MemberDecorate 93(S2) 0 RowMajor + MemberDecorate 93(S2) 0 Offset 0 + MemberDecorate 93(S2) 0 MatrixStride 16 + MemberDecorate 93(S2) 1 Offset 64 + MemberDecorate 93(S2) 2 Offset 68 + MemberDecorate 94(B3) 0 Offset 0 + Decorate 94(B3) BufferBlock + Decorate 96(b3) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 16 1 + 7: TypeVector 6(int16_t) 2 + 8: TypeVector 6(int16_t) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(int16_t) 10 + 12(S): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) + 13: TypeArray 12(S) 10 + 14: 9(int) Constant 100 + 15: TypeArray 7(i16vec2) 14 + 16: TypeRuntimeArray 6(int16_t) + 17(B2): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) 11 12(S) 13 15 16 + 18: TypePointer Uniform 17(B2) + 19(b2): 18(ptr) Variable Uniform + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypeArray 6(int16_t) 10 + 23(S): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) + 24: TypeArray 23(S) 10 + 25(B1): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) 22 23(S) 24 20(int) + 26: TypePointer Uniform 25(B1) + 27(b1): 26(ptr) Variable Uniform + 28: TypePointer Uniform 6(int16_t) + 32: 20(int) Constant 1 + 33: 20(int) Constant 2 + 34: TypePointer Uniform 8(i16vec3) + 37: TypeVector 20(int) 3 + 39: TypeVector 20(int) 2 + 42: TypePointer Uniform 7(i16vec2) + 44: TypeArray 6(int16_t) 10 + 45(S): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) + 46: TypeArray 45(S) 10 + 47: TypeArray 7(i16vec2) 14 + 48: TypeArray 6(int16_t) 14 + 49(B5): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) 44 45(S) 46 47 48 + 50: TypePointer Uniform 49(B5) + 51(b5): 50(ptr) Variable Uniform + 58: 20(int) Constant 3 + 68: TypePointer Function 20(int) + 73: TypeVector 20(int) 4 + 74: TypePointer Function 73(ivec4) + 85: TypeFloat 32 + 86: TypeVector 85(float) 4 + 87: TypeMatrix 86(fvec4) 4 + 88(S2): TypeStruct 87 6(int16_t) 20(int) + 89(S3): TypeStruct 88(S2) + 90(B4): TypeStruct 88(S2) 89(S3) + 91: TypePointer Uniform 90(B4) + 92(b4): 91(ptr) Variable Uniform + 93(S2): TypeStruct 87 6(int16_t) 20(int) + 94(B3): TypeStruct 93(S2) + 95: TypePointer Uniform 94(B3) + 96(b3): 95(ptr) Variable Uniform + 97: TypePointer Uniform 87 + 104: 9(int) Constant 0 + 108: 20(int) Constant 5 + 112: TypePointer Function 37(ivec3) + 114: 20(int) Constant 7 + 115: 20(int) Constant 6 + 116: TypePointer Uniform 20(int) + 166: 6(int16_t) Constant 1 + 167: 6(int16_t) Constant 2 + 168: 7(i16vec2) ConstantComposite 166 167 + 170: 6(int16_t) Constant 3 + 4(main): 2 Function None 3 + 5: Label + 69(x0): 68(ptr) Variable Function + 75(x1): 74(ptr) Variable Function + 113(v3): 112(ptr) Variable Function + 135(u3): 112(ptr) Variable Function + 29: 28(ptr) AccessChain 27(b1) 21 + 30: 6(int16_t) Load 29 + 31: 28(ptr) AccessChain 19(b2) 21 + Store 31 30 + 35: 34(ptr) AccessChain 19(b2) 33 + 36: 8(i16vec3) Load 35 + 38: 37(ivec3) SConvert 36 + 40: 39(ivec2) VectorShuffle 38 38 0 1 + 41: 7(i16vec2) SConvert 40 + 43: 42(ptr) AccessChain 19(b2) 32 + Store 43 41 + 52: 34(ptr) AccessChain 51(b5) 33 + 53: 8(i16vec3) Load 52 + 54: 37(ivec3) SConvert 53 + 55: 39(ivec2) VectorShuffle 54 54 0 1 + 56: 7(i16vec2) SConvert 55 + 57: 42(ptr) AccessChain 19(b2) 32 + Store 57 56 + 59: 28(ptr) AccessChain 19(b2) 58 21 + 60: 6(int16_t) Load 59 + 61: 28(ptr) AccessChain 19(b2) 58 21 + Store 61 60 + 62: 28(ptr) AccessChain 51(b5) 58 32 + 63: 6(int16_t) Load 62 + 64: 28(ptr) AccessChain 19(b2) 58 32 + Store 64 63 + 65: 42(ptr) AccessChain 19(b2) 32 + 66: 7(i16vec2) Load 65 + 67: 42(ptr) AccessChain 19(b2) 32 + Store 67 66 + 70: 28(ptr) AccessChain 27(b1) 21 + 71: 6(int16_t) Load 70 + 72: 20(int) SConvert 71 + Store 69(x0) 72 + 76: 28(ptr) AccessChain 27(b1) 21 + 77: 6(int16_t) Load 76 + 78: 20(int) SConvert 77 + 79: 42(ptr) AccessChain 19(b2) 32 + 80: 7(i16vec2) Load 79 + 81: 39(ivec2) SConvert 80 + 82: 20(int) CompositeExtract 81 0 + 83: 20(int) CompositeExtract 81 1 + 84: 73(ivec4) CompositeConstruct 78 82 83 32 + Store 75(x1) 84 + 98: 97(ptr) AccessChain 96(b3) 21 21 + 99: 87 Load 98 + 100: 97(ptr) AccessChain 92(b4) 21 21 + Store 100 99 + 101: 42(ptr) AccessChain 19(b2) 32 + 102: 7(i16vec2) Load 101 + 103: 39(ivec2) SConvert 102 + 105: 20(int) CompositeExtract 103 0 + 106: 6(int16_t) SConvert 105 + 107: 28(ptr) AccessChain 19(b2) 21 + Store 107 106 + 109: 42(ptr) AccessChain 19(b2) 108 32 32 + 110: 7(i16vec2) Load 109 + 111: 42(ptr) AccessChain 19(b2) 32 + Store 111 110 + 117: 116(ptr) AccessChain 27(b1) 115 + 118: 20(int) Load 117 + 119: 28(ptr) AccessChain 19(b2) 114 118 + 120: 6(int16_t) Load 119 + 121: 20(int) SConvert 120 + 122: 116(ptr) AccessChain 27(b1) 115 + 123: 20(int) Load 122 + 124: 20(int) IAdd 123 32 + 125: 28(ptr) AccessChain 19(b2) 114 124 + 126: 6(int16_t) Load 125 + 127: 20(int) SConvert 126 + 128: 116(ptr) AccessChain 27(b1) 115 + 129: 20(int) Load 128 + 130: 20(int) IAdd 129 33 + 131: 28(ptr) AccessChain 19(b2) 114 130 + 132: 6(int16_t) Load 131 + 133: 20(int) SConvert 132 + 134: 37(ivec3) CompositeConstruct 121 127 133 + Store 113(v3) 134 + 136: 116(ptr) AccessChain 27(b1) 115 + 137: 20(int) Load 136 + 138: 28(ptr) AccessChain 51(b5) 114 137 + 139: 6(int16_t) Load 138 + 140: 20(int) SConvert 139 + 141: 116(ptr) AccessChain 27(b1) 115 + 142: 20(int) Load 141 + 143: 20(int) IAdd 142 32 + 144: 28(ptr) AccessChain 51(b5) 114 143 + 145: 6(int16_t) Load 144 + 146: 20(int) SConvert 145 + 147: 116(ptr) AccessChain 27(b1) 115 + 148: 20(int) Load 147 + 149: 20(int) IAdd 148 33 + 150: 28(ptr) AccessChain 51(b5) 114 149 + 151: 6(int16_t) Load 150 + 152: 20(int) SConvert 151 + 153: 37(ivec3) CompositeConstruct 140 146 152 + Store 135(u3) 153 + 154: 42(ptr) AccessChain 19(b2) 115 21 + 155: 7(i16vec2) Load 154 + 156: 42(ptr) AccessChain 19(b2) 115 21 + Store 156 155 + 157: 42(ptr) AccessChain 51(b5) 115 32 + 158: 7(i16vec2) Load 157 + 159: 42(ptr) AccessChain 19(b2) 115 32 + Store 159 158 + 160: 28(ptr) AccessChain 27(b1) 21 + 161: 6(int16_t) Load 160 + 162: 28(ptr) AccessChain 19(b2) 32 104 + Store 162 161 + 163: 28(ptr) AccessChain 19(b2) 32 104 + 164: 6(int16_t) Load 163 + 165: 28(ptr) AccessChain 19(b2) 21 + Store 165 164 + 169: 42(ptr) AccessChain 19(b2) 32 + Store 169 168 + 171: 28(ptr) AccessChain 19(b2) 21 + Store 171 170 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage-uint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage-uint.frag.out new file mode 100644 index 00000000000..c07edaadf49 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage-uint.frag.out @@ -0,0 +1,336 @@ +spv.16bitstorage-uint.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 173 + + Capability Shader + Capability StorageUniformBufferBlock16 + Capability StorageUniform16 + Extension "SPV_KHR_16bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_shader_16bit_storage" + Name 4 "main" + Name 12 "S" + MemberName 12(S) 0 "x" + MemberName 12(S) 1 "y" + MemberName 12(S) 2 "z" + Name 17 "B2" + MemberName 17(B2) 0 "o" + MemberName 17(B2) 1 "p" + MemberName 17(B2) 2 "q" + MemberName 17(B2) 3 "r" + MemberName 17(B2) 4 "u" + MemberName 17(B2) 5 "v" + MemberName 17(B2) 6 "x" + MemberName 17(B2) 7 "w" + Name 19 "b2" + Name 23 "S" + MemberName 23(S) 0 "x" + MemberName 23(S) 1 "y" + MemberName 23(S) 2 "z" + Name 25 "B1" + MemberName 25(B1) 0 "a" + MemberName 25(B1) 1 "b" + MemberName 25(B1) 2 "c" + MemberName 25(B1) 3 "d" + MemberName 25(B1) 4 "g" + MemberName 25(B1) 5 "h" + MemberName 25(B1) 6 "j" + Name 27 "b1" + Name 45 "S" + MemberName 45(S) 0 "x" + MemberName 45(S) 1 "y" + MemberName 45(S) 2 "z" + Name 49 "B5" + MemberName 49(B5) 0 "o" + MemberName 49(B5) 1 "p" + MemberName 49(B5) 2 "q" + MemberName 49(B5) 3 "r" + MemberName 49(B5) 4 "u" + MemberName 49(B5) 5 "v" + MemberName 49(B5) 6 "x" + MemberName 49(B5) 7 "w" + Name 51 "b5" + Name 69 "x0" + Name 75 "x1" + Name 89 "S2" + MemberName 89(S2) 0 "x" + MemberName 89(S2) 1 "y" + MemberName 89(S2) 2 "z" + Name 90 "S3" + MemberName 90(S3) 0 "x" + Name 91 "B4" + MemberName 91(B4) 0 "x" + MemberName 91(B4) 1 "y" + Name 93 "b4" + Name 94 "S2" + MemberName 94(S2) 0 "x" + MemberName 94(S2) 1 "y" + MemberName 94(S2) 2 "z" + Name 95 "B3" + MemberName 95(B3) 0 "x" + Name 97 "b3" + Name 114 "v3" + Name 136 "u3" + Decorate 11 ArrayStride 2 + MemberDecorate 12(S) 0 Offset 0 + MemberDecorate 12(S) 1 Offset 4 + MemberDecorate 12(S) 2 Offset 8 + Decorate 13 ArrayStride 16 + Decorate 15 ArrayStride 4 + Decorate 16 ArrayStride 2 + MemberDecorate 17(B2) 0 Offset 0 + MemberDecorate 17(B2) 1 Offset 4 + MemberDecorate 17(B2) 2 Offset 8 + MemberDecorate 17(B2) 3 Offset 14 + MemberDecorate 17(B2) 4 Offset 24 + MemberDecorate 17(B2) 5 Offset 40 + MemberDecorate 17(B2) 6 Offset 72 + MemberDecorate 17(B2) 7 Offset 472 + Decorate 17(B2) BufferBlock + Decorate 19(b2) DescriptorSet 0 + Decorate 22 ArrayStride 16 + MemberDecorate 23(S) 0 Offset 0 + MemberDecorate 23(S) 1 Offset 4 + MemberDecorate 23(S) 2 Offset 8 + Decorate 24 ArrayStride 16 + MemberDecorate 25(B1) 0 Offset 0 + MemberDecorate 25(B1) 1 Offset 4 + MemberDecorate 25(B1) 2 Offset 8 + MemberDecorate 25(B1) 3 Offset 16 + MemberDecorate 25(B1) 4 Offset 48 + MemberDecorate 25(B1) 5 Offset 64 + MemberDecorate 25(B1) 6 Offset 96 + Decorate 25(B1) Block + Decorate 27(b1) DescriptorSet 0 + Decorate 44 ArrayStride 16 + MemberDecorate 45(S) 0 Offset 0 + MemberDecorate 45(S) 1 Offset 4 + MemberDecorate 45(S) 2 Offset 8 + Decorate 46 ArrayStride 16 + Decorate 47 ArrayStride 16 + Decorate 48 ArrayStride 16 + MemberDecorate 49(B5) 0 Offset 0 + MemberDecorate 49(B5) 1 Offset 4 + MemberDecorate 49(B5) 2 Offset 8 + MemberDecorate 49(B5) 3 Offset 16 + MemberDecorate 49(B5) 4 Offset 48 + MemberDecorate 49(B5) 5 Offset 64 + MemberDecorate 49(B5) 6 Offset 96 + MemberDecorate 49(B5) 7 Offset 1696 + Decorate 49(B5) Block + Decorate 51(b5) DescriptorSet 0 + MemberDecorate 89(S2) 0 ColMajor + MemberDecorate 89(S2) 0 Offset 0 + MemberDecorate 89(S2) 0 MatrixStride 16 + MemberDecorate 89(S2) 1 Offset 64 + MemberDecorate 89(S2) 2 Offset 68 + MemberDecorate 90(S3) 0 Offset 0 + MemberDecorate 91(B4) 0 Offset 0 + MemberDecorate 91(B4) 1 Offset 80 + Decorate 91(B4) BufferBlock + Decorate 93(b4) DescriptorSet 0 + MemberDecorate 94(S2) 0 RowMajor + MemberDecorate 94(S2) 0 Offset 0 + MemberDecorate 94(S2) 0 MatrixStride 16 + MemberDecorate 94(S2) 1 Offset 64 + MemberDecorate 94(S2) 2 Offset 68 + MemberDecorate 95(B3) 0 Offset 0 + Decorate 95(B3) BufferBlock + Decorate 97(b3) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 16 0 + 7: TypeVector 6(int16_t) 2 + 8: TypeVector 6(int16_t) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(int16_t) 10 + 12(S): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) + 13: TypeArray 12(S) 10 + 14: 9(int) Constant 100 + 15: TypeArray 7(i16vec2) 14 + 16: TypeRuntimeArray 6(int16_t) + 17(B2): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) 11 12(S) 13 15 16 + 18: TypePointer Uniform 17(B2) + 19(b2): 18(ptr) Variable Uniform + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypeArray 6(int16_t) 10 + 23(S): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) + 24: TypeArray 23(S) 10 + 25(B1): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) 22 23(S) 24 9(int) + 26: TypePointer Uniform 25(B1) + 27(b1): 26(ptr) Variable Uniform + 28: TypePointer Uniform 6(int16_t) + 32: 20(int) Constant 1 + 33: 20(int) Constant 2 + 34: TypePointer Uniform 8(i16vec3) + 37: TypeVector 9(int) 3 + 39: TypeVector 9(int) 2 + 42: TypePointer Uniform 7(i16vec2) + 44: TypeArray 6(int16_t) 10 + 45(S): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) + 46: TypeArray 45(S) 10 + 47: TypeArray 7(i16vec2) 14 + 48: TypeArray 6(int16_t) 14 + 49(B5): TypeStruct 6(int16_t) 7(i16vec2) 8(i16vec3) 44 45(S) 46 47 48 + 50: TypePointer Uniform 49(B5) + 51(b5): 50(ptr) Variable Uniform + 58: 20(int) Constant 3 + 68: TypePointer Function 9(int) + 73: TypeVector 9(int) 4 + 74: TypePointer Function 73(ivec4) + 82: 9(int) Constant 1 + 86: TypeFloat 32 + 87: TypeVector 86(float) 4 + 88: TypeMatrix 87(fvec4) 4 + 89(S2): TypeStruct 88 6(int16_t) 9(int) + 90(S3): TypeStruct 89(S2) + 91(B4): TypeStruct 89(S2) 90(S3) + 92: TypePointer Uniform 91(B4) + 93(b4): 92(ptr) Variable Uniform + 94(S2): TypeStruct 88 6(int16_t) 9(int) + 95(B3): TypeStruct 94(S2) + 96: TypePointer Uniform 95(B3) + 97(b3): 96(ptr) Variable Uniform + 98: TypePointer Uniform 88 + 105: 9(int) Constant 0 + 109: 20(int) Constant 5 + 113: TypePointer Function 37(ivec3) + 115: 20(int) Constant 7 + 116: 20(int) Constant 6 + 117: TypePointer Uniform 9(int) + 167: 6(int16_t) Constant 1 + 168: 6(int16_t) Constant 2 + 169: 7(i16vec2) ConstantComposite 167 168 + 171: 6(int16_t) Constant 3 + 4(main): 2 Function None 3 + 5: Label + 69(x0): 68(ptr) Variable Function + 75(x1): 74(ptr) Variable Function + 114(v3): 113(ptr) Variable Function + 136(u3): 113(ptr) Variable Function + 29: 28(ptr) AccessChain 27(b1) 21 + 30: 6(int16_t) Load 29 + 31: 28(ptr) AccessChain 19(b2) 21 + Store 31 30 + 35: 34(ptr) AccessChain 19(b2) 33 + 36: 8(i16vec3) Load 35 + 38: 37(ivec3) UConvert 36 + 40: 39(ivec2) VectorShuffle 38 38 0 1 + 41: 7(i16vec2) UConvert 40 + 43: 42(ptr) AccessChain 19(b2) 32 + Store 43 41 + 52: 34(ptr) AccessChain 51(b5) 33 + 53: 8(i16vec3) Load 52 + 54: 37(ivec3) UConvert 53 + 55: 39(ivec2) VectorShuffle 54 54 0 1 + 56: 7(i16vec2) UConvert 55 + 57: 42(ptr) AccessChain 19(b2) 32 + Store 57 56 + 59: 28(ptr) AccessChain 19(b2) 58 21 + 60: 6(int16_t) Load 59 + 61: 28(ptr) AccessChain 19(b2) 58 21 + Store 61 60 + 62: 28(ptr) AccessChain 51(b5) 58 32 + 63: 6(int16_t) Load 62 + 64: 28(ptr) AccessChain 19(b2) 58 32 + Store 64 63 + 65: 42(ptr) AccessChain 19(b2) 32 + 66: 7(i16vec2) Load 65 + 67: 42(ptr) AccessChain 19(b2) 32 + Store 67 66 + 70: 28(ptr) AccessChain 27(b1) 21 + 71: 6(int16_t) Load 70 + 72: 9(int) UConvert 71 + Store 69(x0) 72 + 76: 28(ptr) AccessChain 27(b1) 21 + 77: 6(int16_t) Load 76 + 78: 9(int) UConvert 77 + 79: 42(ptr) AccessChain 19(b2) 32 + 80: 7(i16vec2) Load 79 + 81: 39(ivec2) UConvert 80 + 83: 9(int) CompositeExtract 81 0 + 84: 9(int) CompositeExtract 81 1 + 85: 73(ivec4) CompositeConstruct 78 83 84 82 + Store 75(x1) 85 + 99: 98(ptr) AccessChain 97(b3) 21 21 + 100: 88 Load 99 + 101: 98(ptr) AccessChain 93(b4) 21 21 + Store 101 100 + 102: 42(ptr) AccessChain 19(b2) 32 + 103: 7(i16vec2) Load 102 + 104: 39(ivec2) UConvert 103 + 106: 9(int) CompositeExtract 104 0 + 107: 6(int16_t) UConvert 106 + 108: 28(ptr) AccessChain 19(b2) 21 + Store 108 107 + 110: 42(ptr) AccessChain 19(b2) 109 32 32 + 111: 7(i16vec2) Load 110 + 112: 42(ptr) AccessChain 19(b2) 32 + Store 112 111 + 118: 117(ptr) AccessChain 27(b1) 116 + 119: 9(int) Load 118 + 120: 28(ptr) AccessChain 19(b2) 115 119 + 121: 6(int16_t) Load 120 + 122: 9(int) UConvert 121 + 123: 117(ptr) AccessChain 27(b1) 116 + 124: 9(int) Load 123 + 125: 9(int) IAdd 124 82 + 126: 28(ptr) AccessChain 19(b2) 115 125 + 127: 6(int16_t) Load 126 + 128: 9(int) UConvert 127 + 129: 117(ptr) AccessChain 27(b1) 116 + 130: 9(int) Load 129 + 131: 9(int) IAdd 130 10 + 132: 28(ptr) AccessChain 19(b2) 115 131 + 133: 6(int16_t) Load 132 + 134: 9(int) UConvert 133 + 135: 37(ivec3) CompositeConstruct 122 128 134 + Store 114(v3) 135 + 137: 117(ptr) AccessChain 27(b1) 116 + 138: 9(int) Load 137 + 139: 28(ptr) AccessChain 51(b5) 115 138 + 140: 6(int16_t) Load 139 + 141: 9(int) UConvert 140 + 142: 117(ptr) AccessChain 27(b1) 116 + 143: 9(int) Load 142 + 144: 9(int) IAdd 143 82 + 145: 28(ptr) AccessChain 51(b5) 115 144 + 146: 6(int16_t) Load 145 + 147: 9(int) UConvert 146 + 148: 117(ptr) AccessChain 27(b1) 116 + 149: 9(int) Load 148 + 150: 9(int) IAdd 149 10 + 151: 28(ptr) AccessChain 51(b5) 115 150 + 152: 6(int16_t) Load 151 + 153: 9(int) UConvert 152 + 154: 37(ivec3) CompositeConstruct 141 147 153 + Store 136(u3) 154 + 155: 42(ptr) AccessChain 19(b2) 116 21 + 156: 7(i16vec2) Load 155 + 157: 42(ptr) AccessChain 19(b2) 116 21 + Store 157 156 + 158: 42(ptr) AccessChain 51(b5) 116 32 + 159: 7(i16vec2) Load 158 + 160: 42(ptr) AccessChain 19(b2) 116 32 + Store 160 159 + 161: 28(ptr) AccessChain 27(b1) 21 + 162: 6(int16_t) Load 161 + 163: 28(ptr) AccessChain 19(b2) 32 105 + Store 163 162 + 164: 28(ptr) AccessChain 19(b2) 32 105 + 165: 6(int16_t) Load 164 + 166: 28(ptr) AccessChain 19(b2) 21 + Store 166 165 + 170: 42(ptr) AccessChain 19(b2) 32 + Store 170 169 + 172: 28(ptr) AccessChain 19(b2) 21 + Store 172 171 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage.frag.out new file mode 100644 index 00000000000..2d5487fd5de --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage.frag.out @@ -0,0 +1,335 @@ +spv.16bitstorage.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 172 + + Capability Shader + Capability StorageUniformBufferBlock16 + Capability StorageUniform16 + Extension "SPV_KHR_16bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_shader_16bit_storage" + Name 4 "main" + Name 12 "S" + MemberName 12(S) 0 "x" + MemberName 12(S) 1 "y" + MemberName 12(S) 2 "z" + Name 17 "B2" + MemberName 17(B2) 0 "o" + MemberName 17(B2) 1 "p" + MemberName 17(B2) 2 "q" + MemberName 17(B2) 3 "r" + MemberName 17(B2) 4 "u" + MemberName 17(B2) 5 "v" + MemberName 17(B2) 6 "x" + MemberName 17(B2) 7 "w" + Name 19 "b2" + Name 23 "S" + MemberName 23(S) 0 "x" + MemberName 23(S) 1 "y" + MemberName 23(S) 2 "z" + Name 25 "B1" + MemberName 25(B1) 0 "a" + MemberName 25(B1) 1 "b" + MemberName 25(B1) 2 "c" + MemberName 25(B1) 3 "d" + MemberName 25(B1) 4 "g" + MemberName 25(B1) 5 "h" + MemberName 25(B1) 6 "j" + Name 27 "b1" + Name 46 "S" + MemberName 46(S) 0 "x" + MemberName 46(S) 1 "y" + MemberName 46(S) 2 "z" + Name 50 "B5" + MemberName 50(B5) 0 "o" + MemberName 50(B5) 1 "p" + MemberName 50(B5) 2 "q" + MemberName 50(B5) 3 "r" + MemberName 50(B5) 4 "u" + MemberName 50(B5) 5 "v" + MemberName 50(B5) 6 "x" + MemberName 50(B5) 7 "w" + Name 52 "b5" + Name 70 "x0" + Name 76 "x1" + Name 88 "S2" + MemberName 88(S2) 0 "x" + MemberName 88(S2) 1 "y" + MemberName 88(S2) 2 "z" + Name 89 "S3" + MemberName 89(S3) 0 "x" + Name 90 "B4" + MemberName 90(B4) 0 "x" + MemberName 90(B4) 1 "y" + Name 92 "b4" + Name 93 "S2" + MemberName 93(S2) 0 "x" + MemberName 93(S2) 1 "y" + MemberName 93(S2) 2 "z" + Name 94 "B3" + MemberName 94(B3) 0 "x" + Name 96 "b3" + Name 113 "v3" + Name 135 "u3" + Decorate 11 ArrayStride 2 + MemberDecorate 12(S) 0 Offset 0 + MemberDecorate 12(S) 1 Offset 4 + MemberDecorate 12(S) 2 Offset 8 + Decorate 13 ArrayStride 16 + Decorate 15 ArrayStride 4 + Decorate 16 ArrayStride 2 + MemberDecorate 17(B2) 0 Offset 0 + MemberDecorate 17(B2) 1 Offset 4 + MemberDecorate 17(B2) 2 Offset 8 + MemberDecorate 17(B2) 3 Offset 14 + MemberDecorate 17(B2) 4 Offset 24 + MemberDecorate 17(B2) 5 Offset 40 + MemberDecorate 17(B2) 6 Offset 72 + MemberDecorate 17(B2) 7 Offset 472 + Decorate 17(B2) BufferBlock + Decorate 19(b2) DescriptorSet 0 + Decorate 22 ArrayStride 16 + MemberDecorate 23(S) 0 Offset 0 + MemberDecorate 23(S) 1 Offset 4 + MemberDecorate 23(S) 2 Offset 8 + Decorate 24 ArrayStride 16 + MemberDecorate 25(B1) 0 Offset 0 + MemberDecorate 25(B1) 1 Offset 4 + MemberDecorate 25(B1) 2 Offset 8 + MemberDecorate 25(B1) 3 Offset 16 + MemberDecorate 25(B1) 4 Offset 48 + MemberDecorate 25(B1) 5 Offset 64 + MemberDecorate 25(B1) 6 Offset 96 + Decorate 25(B1) Block + Decorate 27(b1) DescriptorSet 0 + Decorate 45 ArrayStride 16 + MemberDecorate 46(S) 0 Offset 0 + MemberDecorate 46(S) 1 Offset 4 + MemberDecorate 46(S) 2 Offset 8 + Decorate 47 ArrayStride 16 + Decorate 48 ArrayStride 16 + Decorate 49 ArrayStride 16 + MemberDecorate 50(B5) 0 Offset 0 + MemberDecorate 50(B5) 1 Offset 4 + MemberDecorate 50(B5) 2 Offset 8 + MemberDecorate 50(B5) 3 Offset 16 + MemberDecorate 50(B5) 4 Offset 48 + MemberDecorate 50(B5) 5 Offset 64 + MemberDecorate 50(B5) 6 Offset 96 + MemberDecorate 50(B5) 7 Offset 1696 + Decorate 50(B5) Block + Decorate 52(b5) DescriptorSet 0 + MemberDecorate 88(S2) 0 ColMajor + MemberDecorate 88(S2) 0 Offset 0 + MemberDecorate 88(S2) 0 MatrixStride 16 + MemberDecorate 88(S2) 1 Offset 64 + MemberDecorate 88(S2) 2 Offset 68 + MemberDecorate 89(S3) 0 Offset 0 + MemberDecorate 90(B4) 0 Offset 0 + MemberDecorate 90(B4) 1 Offset 80 + Decorate 90(B4) BufferBlock + Decorate 92(b4) DescriptorSet 0 + MemberDecorate 93(S2) 0 RowMajor + MemberDecorate 93(S2) 0 Offset 0 + MemberDecorate 93(S2) 0 MatrixStride 16 + MemberDecorate 93(S2) 1 Offset 64 + MemberDecorate 93(S2) 2 Offset 68 + MemberDecorate 94(B3) 0 Offset 0 + Decorate 94(B3) BufferBlock + Decorate 96(b3) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 16 + 7: TypeVector 6(float16_t) 2 + 8: TypeVector 6(float16_t) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(float16_t) 10 + 12(S): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) + 13: TypeArray 12(S) 10 + 14: 9(int) Constant 100 + 15: TypeArray 7(f16vec2) 14 + 16: TypeRuntimeArray 6(float16_t) + 17(B2): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) 11 12(S) 13 15 16 + 18: TypePointer Uniform 17(B2) + 19(b2): 18(ptr) Variable Uniform + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypeArray 6(float16_t) 10 + 23(S): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) + 24: TypeArray 23(S) 10 + 25(B1): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) 22 23(S) 24 20(int) + 26: TypePointer Uniform 25(B1) + 27(b1): 26(ptr) Variable Uniform + 28: TypePointer Uniform 6(float16_t) + 32: 20(int) Constant 1 + 33: 20(int) Constant 2 + 34: TypePointer Uniform 8(f16vec3) + 37: TypeFloat 32 + 38: TypeVector 37(float) 3 + 40: TypeVector 37(float) 2 + 43: TypePointer Uniform 7(f16vec2) + 45: TypeArray 6(float16_t) 10 + 46(S): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) + 47: TypeArray 46(S) 10 + 48: TypeArray 7(f16vec2) 14 + 49: TypeArray 6(float16_t) 14 + 50(B5): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) 45 46(S) 47 48 49 + 51: TypePointer Uniform 50(B5) + 52(b5): 51(ptr) Variable Uniform + 59: 20(int) Constant 3 + 69: TypePointer Function 37(float) + 74: TypeVector 37(float) 4 + 75: TypePointer Function 74(fvec4) + 83: 37(float) Constant 1065353216 + 87: TypeMatrix 74(fvec4) 4 + 88(S2): TypeStruct 87 6(float16_t) 37(float) + 89(S3): TypeStruct 88(S2) + 90(B4): TypeStruct 88(S2) 89(S3) + 91: TypePointer Uniform 90(B4) + 92(b4): 91(ptr) Variable Uniform + 93(S2): TypeStruct 87 6(float16_t) 37(float) + 94(B3): TypeStruct 93(S2) + 95: TypePointer Uniform 94(B3) + 96(b3): 95(ptr) Variable Uniform + 97: TypePointer Uniform 87 + 104: 9(int) Constant 0 + 108: 20(int) Constant 5 + 112: TypePointer Function 38(fvec3) + 114: 20(int) Constant 7 + 115: 20(int) Constant 6 + 116: TypePointer Uniform 20(int) + 166:6(float16_t) Constant 15360 + 167:6(float16_t) Constant 16384 + 168: 7(f16vec2) ConstantComposite 166 167 + 170:6(float16_t) Constant 16896 + 4(main): 2 Function None 3 + 5: Label + 70(x0): 69(ptr) Variable Function + 76(x1): 75(ptr) Variable Function + 113(v3): 112(ptr) Variable Function + 135(u3): 112(ptr) Variable Function + 29: 28(ptr) AccessChain 27(b1) 21 + 30:6(float16_t) Load 29 + 31: 28(ptr) AccessChain 19(b2) 21 + Store 31 30 + 35: 34(ptr) AccessChain 19(b2) 33 + 36: 8(f16vec3) Load 35 + 39: 38(fvec3) FConvert 36 + 41: 40(fvec2) VectorShuffle 39 39 0 1 + 42: 7(f16vec2) FConvert 41 + 44: 43(ptr) AccessChain 19(b2) 32 + Store 44 42 + 53: 34(ptr) AccessChain 52(b5) 33 + 54: 8(f16vec3) Load 53 + 55: 38(fvec3) FConvert 54 + 56: 40(fvec2) VectorShuffle 55 55 0 1 + 57: 7(f16vec2) FConvert 56 + 58: 43(ptr) AccessChain 19(b2) 32 + Store 58 57 + 60: 28(ptr) AccessChain 19(b2) 59 21 + 61:6(float16_t) Load 60 + 62: 28(ptr) AccessChain 19(b2) 59 21 + Store 62 61 + 63: 28(ptr) AccessChain 52(b5) 59 32 + 64:6(float16_t) Load 63 + 65: 28(ptr) AccessChain 19(b2) 59 32 + Store 65 64 + 66: 43(ptr) AccessChain 19(b2) 32 + 67: 7(f16vec2) Load 66 + 68: 43(ptr) AccessChain 19(b2) 32 + Store 68 67 + 71: 28(ptr) AccessChain 27(b1) 21 + 72:6(float16_t) Load 71 + 73: 37(float) FConvert 72 + Store 70(x0) 73 + 77: 28(ptr) AccessChain 27(b1) 21 + 78:6(float16_t) Load 77 + 79: 37(float) FConvert 78 + 80: 43(ptr) AccessChain 19(b2) 32 + 81: 7(f16vec2) Load 80 + 82: 40(fvec2) FConvert 81 + 84: 37(float) CompositeExtract 82 0 + 85: 37(float) CompositeExtract 82 1 + 86: 74(fvec4) CompositeConstruct 79 84 85 83 + Store 76(x1) 86 + 98: 97(ptr) AccessChain 96(b3) 21 21 + 99: 87 Load 98 + 100: 97(ptr) AccessChain 92(b4) 21 21 + Store 100 99 + 101: 43(ptr) AccessChain 19(b2) 32 + 102: 7(f16vec2) Load 101 + 103: 40(fvec2) FConvert 102 + 105: 37(float) CompositeExtract 103 0 + 106:6(float16_t) FConvert 105 + 107: 28(ptr) AccessChain 19(b2) 21 + Store 107 106 + 109: 43(ptr) AccessChain 19(b2) 108 32 32 + 110: 7(f16vec2) Load 109 + 111: 43(ptr) AccessChain 19(b2) 32 + Store 111 110 + 117: 116(ptr) AccessChain 27(b1) 115 + 118: 20(int) Load 117 + 119: 28(ptr) AccessChain 19(b2) 114 118 + 120:6(float16_t) Load 119 + 121: 37(float) FConvert 120 + 122: 116(ptr) AccessChain 27(b1) 115 + 123: 20(int) Load 122 + 124: 20(int) IAdd 123 32 + 125: 28(ptr) AccessChain 19(b2) 114 124 + 126:6(float16_t) Load 125 + 127: 37(float) FConvert 126 + 128: 116(ptr) AccessChain 27(b1) 115 + 129: 20(int) Load 128 + 130: 20(int) IAdd 129 33 + 131: 28(ptr) AccessChain 19(b2) 114 130 + 132:6(float16_t) Load 131 + 133: 37(float) FConvert 132 + 134: 38(fvec3) CompositeConstruct 121 127 133 + Store 113(v3) 134 + 136: 116(ptr) AccessChain 27(b1) 115 + 137: 20(int) Load 136 + 138: 28(ptr) AccessChain 52(b5) 114 137 + 139:6(float16_t) Load 138 + 140: 37(float) FConvert 139 + 141: 116(ptr) AccessChain 27(b1) 115 + 142: 20(int) Load 141 + 143: 20(int) IAdd 142 32 + 144: 28(ptr) AccessChain 52(b5) 114 143 + 145:6(float16_t) Load 144 + 146: 37(float) FConvert 145 + 147: 116(ptr) AccessChain 27(b1) 115 + 148: 20(int) Load 147 + 149: 20(int) IAdd 148 33 + 150: 28(ptr) AccessChain 52(b5) 114 149 + 151:6(float16_t) Load 150 + 152: 37(float) FConvert 151 + 153: 38(fvec3) CompositeConstruct 140 146 152 + Store 135(u3) 153 + 154: 43(ptr) AccessChain 19(b2) 115 21 + 155: 7(f16vec2) Load 154 + 156: 43(ptr) AccessChain 19(b2) 115 21 + Store 156 155 + 157: 43(ptr) AccessChain 52(b5) 115 32 + 158: 7(f16vec2) Load 157 + 159: 43(ptr) AccessChain 19(b2) 115 32 + Store 159 158 + 160: 28(ptr) AccessChain 27(b1) 21 + 161:6(float16_t) Load 160 + 162: 28(ptr) AccessChain 19(b2) 32 104 + Store 162 161 + 163: 28(ptr) AccessChain 19(b2) 32 104 + 164:6(float16_t) Load 163 + 165: 28(ptr) AccessChain 19(b2) 21 + Store 165 164 + 169: 43(ptr) AccessChain 19(b2) 32 + Store 169 168 + 171: 28(ptr) AccessChain 19(b2) 21 + Store 171 170 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error-int.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error-int.frag.out new file mode 100644 index 00000000000..40552583f64 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error-int.frag.out @@ -0,0 +1,91 @@ +spv.16bitstorage_Error-int.frag +ERROR: 0:54: 'structure: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:58: 'return: can't use with structs containing int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:61: 'int16_t: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:74: '[: does not operate on types containing (u)int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:75: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int16_t' (or there is no acceptable conversion) +ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform int16_t (or there is no acceptable conversion) +ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int16_t' and a right operand of type ' const int' (or there is no acceptable conversion) +ERROR: 0:81: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:82: '=: can't use with structs containing int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:83: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:84: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:85: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int16_t' (or there is no acceptable conversion) +ERROR: 0:87: '=: can't use with arrays containing int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:88: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:89: 'constructor: 16-bit arrays not supported' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:89: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:92: 'constructor: can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:93: 'func2' : no matching overloaded function found +ERROR: 0:99: '' : syntax error, unexpected IDENTIFIER +ERROR: 26 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error-uint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error-uint.frag.out new file mode 100644 index 00000000000..bff46d444ee --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error-uint.frag.out @@ -0,0 +1,91 @@ +spv.16bitstorage_Error-uint.frag +ERROR: 0:54: 'structure: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:58: 'return: can't use with structs containing uint16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:61: 'uint16_t: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:74: '[: does not operate on types containing (u)int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:75: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:76: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:77: 'built-in function: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint16_t' (or there is no acceptable conversion) +ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform uint16_t (or there is no acceptable conversion) +ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint16_t' and a right operand of type ' const int' (or there is no acceptable conversion) +ERROR: 0:81: '.: can't swizzle types containing (u)int16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:82: '=: can't use with structs containing uint16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:83: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:84: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:85: 'qualifier: (u)int16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint16_t' (or there is no acceptable conversion) +ERROR: 0:87: '=: can't use with arrays containing uint16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:88: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:89: 'constructor: 16-bit arrays not supported' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:89: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:92: 'constructor: can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_int16 +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int16 +ERROR: 0:93: 'func2' : no matching overloaded function found +ERROR: 0:99: '' : syntax error, unexpected IDENTIFIER +ERROR: 26 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error.frag.out new file mode 100644 index 00000000000..08c75e73b66 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.16bitstorage_Error.frag.out @@ -0,0 +1,99 @@ +spv.16bitstorage_Error.frag +ERROR: 0:54: 'structure: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:58: 'return: can't use with structs containing float16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:61: 'float16_t: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:74: '[: does not operate on types containing float16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:75: '.: can't swizzle types containing float16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:76: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:76: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:76: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:77: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:77: 'built-in function: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform float16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform float16_t' (or there is no acceptable conversion) +ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform float16_t (or there is no acceptable conversion) +ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform float16_t' and a right operand of type ' const float' (or there is no acceptable conversion) +ERROR: 0:81: '.: can't swizzle types containing float16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:82: '=: can't use with structs containing float16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:83: 'qualifier: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:84: 'qualifier: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:85: 'qualifier: float16 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform float16_t' and a right operand of type 'layout( column_major std140 offset=0) uniform float16_t' (or there is no acceptable conversion) +ERROR: 0:87: '=: can't use with arrays containing float16' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:88: 'half floating-point suffix' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:88: 'half float literal' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:89: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:90: 'constructor: 16-bit arrays not supported' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:90: 'constructor: 16-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:93: 'constructor: can't construct structure containing 16-bit type' : required extension not requested: Possible extensions include: +GL_AMD_gpu_shader_half_float +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_float16 +ERROR: 0:94: 'func2' : no matching overloaded function found +ERROR: 0:100: '' : syntax error, unexpected IDENTIFIER +ERROR: 28 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300BuiltIns.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300BuiltIns.vert.out index a2c5075f929..ee2c236e783 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300BuiltIns.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300BuiltIns.vert.out @@ -1,6 +1,6 @@ spv.300BuiltIns.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 42 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.frag.out index 8200bb828d3..10a6d00eb1d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.frag.out @@ -1,6 +1,6 @@ spv.300layout.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 37 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.vert.out index a820796107d..0c0663e8172 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layout.vert.out @@ -1,6 +1,6 @@ spv.300layout.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 163 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layoutp.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layoutp.vert.out index 78098eb2f0c..9c4201de508 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layoutp.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.300layoutp.vert.out @@ -1,6 +1,6 @@ spv.300layoutp.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 115 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.bitcast.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.bitcast.frag.out index bcbe8e69f33..d7a244f8628 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.bitcast.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.bitcast.frag.out @@ -1,6 +1,6 @@ spv.310.bitcast.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 153 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.comp.out index fec52c59c6e..f4eaa203324 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.310.comp.out @@ -1,129 +1,134 @@ spv.310.comp // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 69 +// Generated by (magic number): 80007 +// Id's are bound by 72 Capability Shader Capability DeviceGroup Extension "SPV_KHR_device_group" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint GLCompute 4 "main" 53 64 + EntryPoint GLCompute 4 "main" 53 65 ExecutionMode 4 LocalSize 16 32 4 Source ESSL 310 SourceExtension "GL_EXT_device_group" Name 4 "main" - Name 13 "outb" - MemberName 13(outb) 0 "f" - MemberName 13(outb) 1 "g" - MemberName 13(outb) 2 "h" - MemberName 13(outb) 3 "uns" - Name 15 "outbname" - Name 19 "s" - Name 24 "outbna" - MemberName 24(outbna) 0 "k" - MemberName 24(outbna) 1 "na" - Name 26 "outbnamena" + Name 12 "outb" + MemberName 12(outb) 0 "f" + MemberName 12(outb) 1 "g" + MemberName 12(outb) 2 "h" + MemberName 12(outb) 3 "uns" + Name 14 "outbname" + Name 18 "s" + Name 23 "outbna" + MemberName 23(outbna) 0 "k" + MemberName 23(outbna) 1 "na" + Name 25 "outbnamena" Name 42 "i" Name 48 "outs" MemberName 48(outs) 0 "s" MemberName 48(outs) 1 "va" Name 50 "outnames" Name 53 "gl_LocalInvocationID" - Name 64 "gl_DeviceIndex" - Decorate 12 ArrayStride 16 - MemberDecorate 13(outb) 0 Offset 0 - MemberDecorate 13(outb) 1 Offset 4 - MemberDecorate 13(outb) 2 Offset 8 - MemberDecorate 13(outb) 3 Offset 16 - Decorate 13(outb) BufferBlock - Decorate 15(outbname) DescriptorSet 0 - MemberDecorate 24(outbna) 0 Offset 0 - MemberDecorate 24(outbna) 1 Offset 16 - Decorate 24(outbna) BufferBlock - Decorate 26(outbnamena) DescriptorSet 0 + Name 65 "gl_DeviceIndex" + Decorate 11 ArrayStride 16 + MemberDecorate 12(outb) 0 Offset 0 + MemberDecorate 12(outb) 1 Offset 4 + MemberDecorate 12(outb) 2 Offset 8 + MemberDecorate 12(outb) 3 Offset 16 + Decorate 12(outb) BufferBlock + Decorate 14(outbname) DescriptorSet 0 + MemberDecorate 23(outbna) 0 Offset 0 + MemberDecorate 23(outbna) 1 Offset 16 + Decorate 23(outbna) BufferBlock + Decorate 25(outbnamena) DescriptorSet 0 Decorate 47 ArrayStride 16 MemberDecorate 48(outs) 0 Offset 0 MemberDecorate 48(outs) 1 Offset 16 Decorate 48(outs) BufferBlock Decorate 50(outnames) DescriptorSet 0 Decorate 53(gl_LocalInvocationID) BuiltIn LocalInvocationId - Decorate 64(gl_DeviceIndex) BuiltIn DeviceIndex - Decorate 68 BuiltIn WorkgroupSize + Decorate 65(gl_DeviceIndex) BuiltIn DeviceIndex + Decorate 71 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 7: 6(int) Constant 2 - 8: 6(int) Constant 1 - 9: 6(int) Constant 0 - 10: TypeFloat 32 - 11: TypeVector 10(float) 3 - 12: TypeRuntimeArray 11(fvec3) - 13(outb): TypeStruct 10(float) 10(float) 10(float) 12 - 14: TypePointer Uniform 13(outb) - 15(outbname): 14(ptr) Variable Uniform - 16: TypeInt 32 1 - 17: 16(int) Constant 0 - 18: TypePointer Workgroup 10(float) - 19(s): 18(ptr) Variable Workgroup - 21: TypePointer Uniform 10(float) - 23: TypeVector 10(float) 4 - 24(outbna): TypeStruct 16(int) 23(fvec4) - 25: TypePointer Uniform 24(outbna) - 26(outbnamena): 25(ptr) Variable Uniform - 27: 16(int) Constant 1 - 30: TypePointer Uniform 23(fvec4) - 32: 16(int) Constant 3 - 33: 16(int) Constant 18 - 36: 16(int) Constant 17 - 37: 10(float) Constant 1077936128 - 38: 11(fvec3) ConstantComposite 37 37 37 - 39: TypePointer Uniform 11(fvec3) - 41: TypePointer Workgroup 16(int) + 8: 6(int) Constant 264 + 9: TypeFloat 32 + 10: TypeVector 9(float) 3 + 11: TypeRuntimeArray 10(fvec3) + 12(outb): TypeStruct 9(float) 9(float) 9(float) 11 + 13: TypePointer Uniform 12(outb) + 14(outbname): 13(ptr) Variable Uniform + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Workgroup 9(float) + 18(s): 17(ptr) Variable Workgroup + 20: TypePointer Uniform 9(float) + 22: TypeVector 9(float) 4 + 23(outbna): TypeStruct 15(int) 22(fvec4) + 24: TypePointer Uniform 23(outbna) + 25(outbnamena): 24(ptr) Variable Uniform + 26: 15(int) Constant 1 + 29: TypePointer Uniform 22(fvec4) + 31: 15(int) Constant 3 + 32: 15(int) Constant 18 + 33: 6(int) Constant 0 + 36: 15(int) Constant 17 + 37: 9(float) Constant 1077936128 + 38: 10(fvec3) ConstantComposite 37 37 37 + 39: TypePointer Uniform 10(fvec3) + 41: TypePointer Workgroup 15(int) 42(i): 41(ptr) Variable Workgroup - 47: TypeRuntimeArray 23(fvec4) - 48(outs): TypeStruct 16(int) 47 + 47: TypeRuntimeArray 22(fvec4) + 48(outs): TypeStruct 15(int) 47 49: TypePointer Uniform 48(outs) 50(outnames): 49(ptr) Variable Uniform 51: TypeVector 6(int) 3 52: TypePointer Input 51(ivec3) 53(gl_LocalInvocationID): 52(ptr) Variable Input 54: TypePointer Input 6(int) - 61: TypePointer Uniform 16(int) - 63: TypePointer Input 16(int) -64(gl_DeviceIndex): 63(ptr) Variable Input - 65: 6(int) Constant 16 - 66: 6(int) Constant 32 - 67: 6(int) Constant 4 - 68: 51(ivec3) ConstantComposite 65 66 67 + 62: TypePointer Uniform 15(int) + 64: TypePointer Input 15(int) +65(gl_DeviceIndex): 64(ptr) Variable Input + 66: 6(int) Constant 1 + 67: 6(int) Constant 3400 + 68: 6(int) Constant 16 + 69: 6(int) Constant 32 + 70: 6(int) Constant 4 + 71: 51(ivec3) ConstantComposite 68 69 70 4(main): 2 Function None 3 5: Label - ControlBarrier 7 8 9 - 20: 10(float) Load 19(s) - 22: 21(ptr) AccessChain 15(outbname) 17 - Store 22 20 - 28: 10(float) Load 19(s) - 29: 23(fvec4) CompositeConstruct 28 28 28 28 - 31: 30(ptr) AccessChain 26(outbnamena) 27 - Store 31 29 - 34: 21(ptr) AccessChain 15(outbname) 32 33 9 - 35: 10(float) Load 34 - Store 19(s) 35 - 40: 39(ptr) AccessChain 15(outbname) 32 36 + ControlBarrier 7 7 8 + 19: 9(float) Load 18(s) + 21: 20(ptr) AccessChain 14(outbname) 16 + Store 21 19 + 27: 9(float) Load 18(s) + 28: 22(fvec4) CompositeConstruct 27 27 27 27 + 30: 29(ptr) AccessChain 25(outbnamena) 26 + Store 30 28 + 34: 20(ptr) AccessChain 14(outbname) 31 32 33 + 35: 9(float) Load 34 + Store 18(s) 35 + 40: 39(ptr) AccessChain 14(outbname) 31 36 Store 40 38 - 43: 16(int) Load 42(i) - 44: 10(float) Load 19(s) - 45: 11(fvec3) CompositeConstruct 44 44 44 - 46: 39(ptr) AccessChain 15(outbname) 32 43 + 43: 15(int) Load 42(i) + 44: 9(float) Load 18(s) + 45: 10(fvec3) CompositeConstruct 44 44 44 + 46: 39(ptr) AccessChain 14(outbname) 31 43 Store 46 45 - 55: 54(ptr) AccessChain 53(gl_LocalInvocationID) 9 + 55: 54(ptr) AccessChain 53(gl_LocalInvocationID) 33 56: 6(int) Load 55 - 57: 10(float) Load 19(s) - 58: 23(fvec4) CompositeConstruct 57 57 57 57 - 59: 30(ptr) AccessChain 50(outnames) 27 56 + 57: 9(float) Load 18(s) + 58: 22(fvec4) CompositeConstruct 57 57 57 57 + 59: 29(ptr) AccessChain 50(outnames) 26 56 Store 59 58 - 60: 16(int) ArrayLength 15(outbname) 3 - 62: 61(ptr) AccessChain 50(outnames) 17 - Store 62 60 + 60: 6(int) ArrayLength 14(outbname) 3 + 61: 15(int) Bitcast 60 + 63: 62(ptr) AccessChain 50(outnames) 16 + Store 63 61 + MemoryBarrier 66 8 + MemoryBarrier 7 67 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out new file mode 100644 index 00000000000..20b6fa24226 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.320.meshShaderUserDefined.mesh.out @@ -0,0 +1,205 @@ +spv.320.meshShaderUserDefined.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 140 + + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 12 19 37 103 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source ESSL 320 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 12 "gl_LocalInvocationID" + Name 18 "gid" + Name 19 "gl_WorkGroupID" + Name 33 "myblock" + MemberName 33(myblock) 0 "f" + MemberName 33(myblock) 1 "fArr" + MemberName 33(myblock) 2 "pos" + MemberName 33(myblock) 3 "posArr" + MemberName 33(myblock) 4 "m" + MemberName 33(myblock) 5 "mArr" + Name 37 "blk" + Name 99 "myblock2" + MemberName 99(myblock2) 0 "f" + MemberName 99(myblock2) 1 "pos" + MemberName 99(myblock2) 2 "m" + Name 103 "blk2" + Decorate 12(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 19(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 33(myblock) 0 PerPrimitiveNV + MemberDecorate 33(myblock) 1 PerPrimitiveNV + MemberDecorate 33(myblock) 2 PerPrimitiveNV + MemberDecorate 33(myblock) 3 PerPrimitiveNV + MemberDecorate 33(myblock) 4 PerPrimitiveNV + MemberDecorate 33(myblock) 5 PerPrimitiveNV + Decorate 33(myblock) Block + Decorate 37(blk) Location 0 + Decorate 99(myblock2) Block + Decorate 103(blk2) Location 20 + Decorate 139 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 9: TypeInt 32 0 + 10: TypeVector 9(int) 3 + 11: TypePointer Input 10(ivec3) +12(gl_LocalInvocationID): 11(ptr) Variable Input + 13: 9(int) Constant 0 + 14: TypePointer Input 9(int) +19(gl_WorkGroupID): 11(ptr) Variable Input + 23: TypeFloat 32 + 24: 9(int) Constant 4 + 25: TypeArray 23(float) 24 + 26: TypeVector 23(float) 3 + 27: TypeVector 23(float) 4 + 28: TypeArray 27(fvec4) 24 + 29: TypeMatrix 27(fvec4) 4 + 30: TypeMatrix 26(fvec3) 3 + 31: 9(int) Constant 2 + 32: TypeArray 30 31 + 33(myblock): TypeStruct 23(float) 25 26(fvec3) 28 29 32 + 34: 9(int) Constant 32 + 35: TypeArray 33(myblock) 34 + 36: TypePointer Output 35 + 37(blk): 36(ptr) Variable Output + 39: 6(int) Constant 0 + 40: 23(float) Constant 1093664768 + 41: TypePointer Output 23(float) + 44: 6(int) Constant 1 + 52: 6(int) Constant 2 + 54: 23(float) Constant 1096810496 + 55: 23(float) Constant 1097859072 + 56: 23(float) Constant 1095761920 + 57: 26(fvec3) ConstantComposite 54 55 56 + 58: TypePointer Output 26(fvec3) + 64: 6(int) Constant 3 + 69: TypePointer Output 27(fvec4) + 74: 6(int) Constant 4 + 76: 23(float) Constant 1098907648 + 77: 27(fvec4) ConstantComposite 56 54 55 76 + 82: 6(int) Constant 5 + 85: 9(int) Constant 3 + 88: 9(int) Constant 1 + 93: 23(float) Constant 1099431936 + 94: 23(float) Constant 1099956224 + 95: 23(float) Constant 1100480512 + 96: 26(fvec3) ConstantComposite 93 94 95 + 98: 9(int) Constant 264 + 99(myblock2): TypeStruct 23(float) 27(fvec4) 29 + 100: 9(int) Constant 81 + 101: TypeArray 99(myblock2) 100 + 102: TypePointer Output 101 + 103(blk2): 102(ptr) Variable Output + 109: 23(float) Constant 1101004800 + 113: 23(float) Constant 1101529088 + 114: 23(float) Constant 1102053376 + 115: 23(float) Constant 1102577664 + 116: 23(float) Constant 1103101952 + 117: 27(fvec4) ConstantComposite 113 114 115 116 + 129: 23(float) Constant 1105723392 + 139: 10(ivec3) ConstantComposite 34 88 88 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 18(gid): 7(ptr) Variable Function + 15: 14(ptr) AccessChain 12(gl_LocalInvocationID) 13 + 16: 9(int) Load 15 + 17: 6(int) Bitcast 16 + Store 8(iid) 17 + 20: 14(ptr) AccessChain 19(gl_WorkGroupID) 13 + 21: 9(int) Load 20 + 22: 6(int) Bitcast 21 + Store 18(gid) 22 + 38: 6(int) Load 8(iid) + 42: 41(ptr) AccessChain 37(blk) 38 39 + Store 42 40 + 43: 6(int) Load 8(iid) + 45: 6(int) IAdd 43 44 + 46: 6(int) Load 18(gid) + 47: 6(int) Load 8(iid) + 48: 41(ptr) AccessChain 37(blk) 47 39 + 49: 23(float) Load 48 + 50: 41(ptr) AccessChain 37(blk) 45 44 46 + Store 50 49 + 51: 6(int) Load 8(iid) + 53: 6(int) SDiv 51 52 + 59: 58(ptr) AccessChain 37(blk) 53 52 + 60: 26(fvec3) Load 59 + 61: 26(fvec3) VectorShuffle 60 57 5 3 4 + Store 59 61 + 62: 6(int) Load 8(iid) + 63: 6(int) IMul 62 52 + 65: 6(int) Load 8(iid) + 66: 6(int) SDiv 65 52 + 67: 58(ptr) AccessChain 37(blk) 66 52 + 68: 26(fvec3) Load 67 + 70: 69(ptr) AccessChain 37(blk) 63 64 44 + 71: 27(fvec4) Load 70 + 72: 27(fvec4) VectorShuffle 71 68 0 4 5 6 + Store 70 72 + 73: 6(int) Load 8(iid) + 75: 6(int) SDiv 73 74 + 78: 69(ptr) AccessChain 37(blk) 75 74 52 + 79: 27(fvec4) Load 78 + 80: 27(fvec4) VectorShuffle 79 77 7 6 5 4 + Store 78 80 + 81: 6(int) Load 8(iid) + 83: 6(int) Load 8(iid) + 84: 6(int) SDiv 83 74 + 86: 41(ptr) AccessChain 37(blk) 84 74 52 85 + 87: 23(float) Load 86 + 89: 41(ptr) AccessChain 37(blk) 81 82 39 44 88 + Store 89 87 + 90: 6(int) Load 8(iid) + 91: 6(int) IMul 90 74 + 92: 6(int) Load 18(gid) + 97: 58(ptr) AccessChain 37(blk) 91 82 44 92 + Store 97 96 + MemoryBarrier 88 98 + ControlBarrier 31 31 98 + 104: 6(int) Load 8(iid) + 105: 6(int) Load 8(iid) + 106: 6(int) ISub 105 44 + 107: 41(ptr) AccessChain 103(blk2) 106 39 + 108: 23(float) Load 107 + 110: 23(float) FAdd 108 109 + 111: 41(ptr) AccessChain 103(blk2) 104 39 + Store 111 110 + 112: 6(int) Load 8(iid) + 118: 69(ptr) AccessChain 103(blk2) 112 44 + Store 118 117 + 119: 6(int) Load 8(iid) + 120: 6(int) IAdd 119 44 + 121: 6(int) Load 18(gid) + 122: 6(int) Load 8(iid) + 123: 69(ptr) AccessChain 103(blk2) 122 44 + 124: 27(fvec4) Load 123 + 125: 69(ptr) AccessChain 103(blk2) 120 52 121 + Store 125 124 + 126: 6(int) Load 8(iid) + 127: 6(int) IAdd 126 44 + 128: 6(int) Load 18(gid) + 130: 41(ptr) AccessChain 103(blk2) 127 52 128 31 + Store 130 129 + 131: 6(int) Load 8(iid) + 132: 6(int) IAdd 131 52 + 133: 6(int) Load 8(iid) + 134: 6(int) IAdd 133 44 + 135: 6(int) Load 18(gid) + 136: 69(ptr) AccessChain 103(blk2) 134 52 135 + 137: 27(fvec4) Load 136 + 138: 69(ptr) AccessChain 103(blk2) 132 52 64 + Store 138 137 + MemoryBarrier 88 98 + ControlBarrier 31 31 98 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.330.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.330.geom.out index eccaccd218a..1ccbfb6c4c6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.330.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.330.geom.out @@ -1,6 +1,6 @@ spv.330.geom // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 32 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.frag.out index 2b574ab62a1..a0583cff8b9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.frag.out @@ -1,6 +1,10 @@ spv.400.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 1118 Capability Shader @@ -85,18 +89,18 @@ spv.400.frag 33: 32(int) Constant 0 34: TypePointer Output 10(float) 39: TypeFloat 64 - 40: TypePointer Function 39(float) - 42: 39(float) Constant 2507418074 1073430332 - 43: TypeVector 39(float) 2 - 44: TypePointer Function 43(fvec2) - 46: 39(float) Constant 796182188 1073367658 - 47: 43(fvec2) ConstantComposite 46 46 - 48: TypeVector 39(float) 3 - 49: TypePointer Function 48(fvec3) - 51: 39(float) Constant 1719614413 1073127582 - 52: 48(fvec3) ConstantComposite 51 51 51 - 53: TypeVector 39(float) 4 - 54: TypePointer Function 53(fvec4) + 40: TypePointer Function 39(float64_t) + 42:39(float64_t) Constant 2507418074 1073430332 + 43: TypeVector 39(float64_t) 2 + 44: TypePointer Function 43(f64vec2) + 46:39(float64_t) Constant 796182188 1073367658 + 47: 43(f64vec2) ConstantComposite 46 46 + 48: TypeVector 39(float64_t) 3 + 49: TypePointer Function 48(f64vec3) + 51:39(float64_t) Constant 1719614413 1073127582 + 52: 48(f64vec3) ConstantComposite 51 51 51 + 53: TypeVector 39(float64_t) 4 + 54: TypePointer Function 53(f64vec4) 428: TypeBool 429: TypePointer Function 428(bool) 437: TypeVector 428(bool) 2 @@ -109,23 +113,23 @@ spv.400.frag 572: 437(bvec2) ConstantComposite 563 563 581: 446(bvec3) ConstantComposite 563 563 563 590: 455(bvec4) ConstantComposite 563 563 563 563 - 737: TypeMatrix 43(fvec2) 2 + 737: TypeMatrix 43(f64vec2) 2 738: TypePointer Function 737 - 743: TypeMatrix 48(fvec3) 3 + 743: TypeMatrix 48(f64vec3) 3 744: TypePointer Function 743 - 749: TypeMatrix 53(fvec4) 4 + 749: TypeMatrix 53(f64vec4) 4 750: TypePointer Function 749 - 755: TypeMatrix 48(fvec3) 2 + 755: TypeMatrix 48(f64vec3) 2 756: TypePointer Function 755 - 761: TypeMatrix 43(fvec2) 3 + 761: TypeMatrix 43(f64vec2) 3 762: TypePointer Function 761 - 767: TypeMatrix 53(fvec4) 2 + 767: TypeMatrix 53(f64vec4) 2 768: TypePointer Function 767 - 773: TypeMatrix 43(fvec2) 4 + 773: TypeMatrix 43(f64vec2) 4 774: TypePointer Function 773 - 779: TypeMatrix 53(fvec4) 3 + 779: TypeMatrix 53(f64vec4) 3 780: TypePointer Function 779 - 785: TypeMatrix 48(fvec3) 4 + 785: TypeMatrix 48(f64vec3) 4 786: TypePointer Function 785 954: 32(int) Constant 1 958: 32(int) Constant 2 @@ -273,10 +277,10 @@ spv.400.frag 439(bvec2v): 438(ptr) Variable Function 448(bvec3v): 447(ptr) Variable Function 457(bvec4v): 456(ptr) Variable Function - 556: 429(ptr) Variable Function - 565: 438(ptr) Variable Function - 574: 447(ptr) Variable Function - 583: 456(ptr) Variable Function + 557: 429(ptr) Variable Function + 566: 438(ptr) Variable Function + 575: 447(ptr) Variable Function + 584: 456(ptr) Variable Function 739(dmat2v): 738(ptr) Variable Function 745(dmat3v): 744(ptr) Variable Function 751(dmat4v): 750(ptr) Variable Function @@ -289,979 +293,979 @@ spv.400.frag Store 41(doublev) 42 Store 45(dvec2v) 47 Store 50(dvec3v) 52 - 56: 39(float) Load 41(doublev) - 57: 53(fvec4) CompositeConstruct 56 56 56 56 - 58: 53(fvec4) ExtInst 1(GLSL.std.450) 31(Sqrt) 57 + 56:39(float64_t) Load 41(doublev) + 57: 53(f64vec4) CompositeConstruct 56 56 56 56 + 58: 53(f64vec4) ExtInst 1(GLSL.std.450) 31(Sqrt) 57 Store 55(dvec4v) 58 - 59: 39(float) Load 41(doublev) - 60: 39(float) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 59 - 61: 39(float) Load 41(doublev) - 62: 39(float) FAdd 61 60 + 59:39(float64_t) Load 41(doublev) + 60:39(float64_t) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 59 + 61:39(float64_t) Load 41(doublev) + 62:39(float64_t) FAdd 61 60 Store 41(doublev) 62 - 63: 43(fvec2) Load 45(dvec2v) - 64: 43(fvec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 63 - 65: 43(fvec2) Load 45(dvec2v) - 66: 43(fvec2) FAdd 65 64 + 63: 43(f64vec2) Load 45(dvec2v) + 64: 43(f64vec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 63 + 65: 43(f64vec2) Load 45(dvec2v) + 66: 43(f64vec2) FAdd 65 64 Store 45(dvec2v) 66 - 67: 48(fvec3) Load 50(dvec3v) - 68: 48(fvec3) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 67 - 69: 48(fvec3) Load 50(dvec3v) - 70: 48(fvec3) FAdd 69 68 + 67: 48(f64vec3) Load 50(dvec3v) + 68: 48(f64vec3) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 67 + 69: 48(f64vec3) Load 50(dvec3v) + 70: 48(f64vec3) FAdd 69 68 Store 50(dvec3v) 70 - 71: 53(fvec4) Load 55(dvec4v) - 72: 53(fvec4) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 71 - 73: 53(fvec4) Load 55(dvec4v) - 74: 53(fvec4) FAdd 73 72 + 71: 53(f64vec4) Load 55(dvec4v) + 72: 53(f64vec4) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 71 + 73: 53(f64vec4) Load 55(dvec4v) + 74: 53(f64vec4) FAdd 73 72 Store 55(dvec4v) 74 - 75: 39(float) Load 41(doublev) - 76: 39(float) ExtInst 1(GLSL.std.450) 4(FAbs) 75 - 77: 39(float) Load 41(doublev) - 78: 39(float) FAdd 77 76 + 75:39(float64_t) Load 41(doublev) + 76:39(float64_t) ExtInst 1(GLSL.std.450) 4(FAbs) 75 + 77:39(float64_t) Load 41(doublev) + 78:39(float64_t) FAdd 77 76 Store 41(doublev) 78 - 79: 43(fvec2) Load 45(dvec2v) - 80: 43(fvec2) ExtInst 1(GLSL.std.450) 4(FAbs) 79 - 81: 43(fvec2) Load 45(dvec2v) - 82: 43(fvec2) FAdd 81 80 + 79: 43(f64vec2) Load 45(dvec2v) + 80: 43(f64vec2) ExtInst 1(GLSL.std.450) 4(FAbs) 79 + 81: 43(f64vec2) Load 45(dvec2v) + 82: 43(f64vec2) FAdd 81 80 Store 45(dvec2v) 82 - 83: 48(fvec3) Load 50(dvec3v) - 84: 48(fvec3) ExtInst 1(GLSL.std.450) 4(FAbs) 83 - 85: 48(fvec3) Load 50(dvec3v) - 86: 48(fvec3) FAdd 85 84 + 83: 48(f64vec3) Load 50(dvec3v) + 84: 48(f64vec3) ExtInst 1(GLSL.std.450) 4(FAbs) 83 + 85: 48(f64vec3) Load 50(dvec3v) + 86: 48(f64vec3) FAdd 85 84 Store 50(dvec3v) 86 - 87: 53(fvec4) Load 55(dvec4v) - 88: 53(fvec4) ExtInst 1(GLSL.std.450) 4(FAbs) 87 - 89: 53(fvec4) Load 55(dvec4v) - 90: 53(fvec4) FAdd 89 88 + 87: 53(f64vec4) Load 55(dvec4v) + 88: 53(f64vec4) ExtInst 1(GLSL.std.450) 4(FAbs) 87 + 89: 53(f64vec4) Load 55(dvec4v) + 90: 53(f64vec4) FAdd 89 88 Store 55(dvec4v) 90 - 91: 39(float) Load 41(doublev) - 92: 39(float) ExtInst 1(GLSL.std.450) 6(FSign) 91 - 93: 39(float) Load 41(doublev) - 94: 39(float) FAdd 93 92 + 91:39(float64_t) Load 41(doublev) + 92:39(float64_t) ExtInst 1(GLSL.std.450) 6(FSign) 91 + 93:39(float64_t) Load 41(doublev) + 94:39(float64_t) FAdd 93 92 Store 41(doublev) 94 - 95: 43(fvec2) Load 45(dvec2v) - 96: 43(fvec2) ExtInst 1(GLSL.std.450) 6(FSign) 95 - 97: 43(fvec2) Load 45(dvec2v) - 98: 43(fvec2) FAdd 97 96 + 95: 43(f64vec2) Load 45(dvec2v) + 96: 43(f64vec2) ExtInst 1(GLSL.std.450) 6(FSign) 95 + 97: 43(f64vec2) Load 45(dvec2v) + 98: 43(f64vec2) FAdd 97 96 Store 45(dvec2v) 98 - 99: 48(fvec3) Load 50(dvec3v) - 100: 48(fvec3) ExtInst 1(GLSL.std.450) 6(FSign) 99 - 101: 48(fvec3) Load 50(dvec3v) - 102: 48(fvec3) FAdd 101 100 + 99: 48(f64vec3) Load 50(dvec3v) + 100: 48(f64vec3) ExtInst 1(GLSL.std.450) 6(FSign) 99 + 101: 48(f64vec3) Load 50(dvec3v) + 102: 48(f64vec3) FAdd 101 100 Store 50(dvec3v) 102 - 103: 53(fvec4) Load 55(dvec4v) - 104: 53(fvec4) ExtInst 1(GLSL.std.450) 6(FSign) 103 - 105: 53(fvec4) Load 55(dvec4v) - 106: 53(fvec4) FAdd 105 104 + 103: 53(f64vec4) Load 55(dvec4v) + 104: 53(f64vec4) ExtInst 1(GLSL.std.450) 6(FSign) 103 + 105: 53(f64vec4) Load 55(dvec4v) + 106: 53(f64vec4) FAdd 105 104 Store 55(dvec4v) 106 - 107: 39(float) Load 41(doublev) - 108: 39(float) ExtInst 1(GLSL.std.450) 8(Floor) 107 - 109: 39(float) Load 41(doublev) - 110: 39(float) FAdd 109 108 + 107:39(float64_t) Load 41(doublev) + 108:39(float64_t) ExtInst 1(GLSL.std.450) 8(Floor) 107 + 109:39(float64_t) Load 41(doublev) + 110:39(float64_t) FAdd 109 108 Store 41(doublev) 110 - 111: 43(fvec2) Load 45(dvec2v) - 112: 43(fvec2) ExtInst 1(GLSL.std.450) 8(Floor) 111 - 113: 43(fvec2) Load 45(dvec2v) - 114: 43(fvec2) FAdd 113 112 + 111: 43(f64vec2) Load 45(dvec2v) + 112: 43(f64vec2) ExtInst 1(GLSL.std.450) 8(Floor) 111 + 113: 43(f64vec2) Load 45(dvec2v) + 114: 43(f64vec2) FAdd 113 112 Store 45(dvec2v) 114 - 115: 48(fvec3) Load 50(dvec3v) - 116: 48(fvec3) ExtInst 1(GLSL.std.450) 8(Floor) 115 - 117: 48(fvec3) Load 50(dvec3v) - 118: 48(fvec3) FAdd 117 116 + 115: 48(f64vec3) Load 50(dvec3v) + 116: 48(f64vec3) ExtInst 1(GLSL.std.450) 8(Floor) 115 + 117: 48(f64vec3) Load 50(dvec3v) + 118: 48(f64vec3) FAdd 117 116 Store 50(dvec3v) 118 - 119: 53(fvec4) Load 55(dvec4v) - 120: 53(fvec4) ExtInst 1(GLSL.std.450) 8(Floor) 119 - 121: 53(fvec4) Load 55(dvec4v) - 122: 53(fvec4) FAdd 121 120 + 119: 53(f64vec4) Load 55(dvec4v) + 120: 53(f64vec4) ExtInst 1(GLSL.std.450) 8(Floor) 119 + 121: 53(f64vec4) Load 55(dvec4v) + 122: 53(f64vec4) FAdd 121 120 Store 55(dvec4v) 122 - 123: 39(float) Load 41(doublev) - 124: 39(float) ExtInst 1(GLSL.std.450) 3(Trunc) 123 - 125: 39(float) Load 41(doublev) - 126: 39(float) FAdd 125 124 + 123:39(float64_t) Load 41(doublev) + 124:39(float64_t) ExtInst 1(GLSL.std.450) 3(Trunc) 123 + 125:39(float64_t) Load 41(doublev) + 126:39(float64_t) FAdd 125 124 Store 41(doublev) 126 - 127: 43(fvec2) Load 45(dvec2v) - 128: 43(fvec2) ExtInst 1(GLSL.std.450) 3(Trunc) 127 - 129: 43(fvec2) Load 45(dvec2v) - 130: 43(fvec2) FAdd 129 128 + 127: 43(f64vec2) Load 45(dvec2v) + 128: 43(f64vec2) ExtInst 1(GLSL.std.450) 3(Trunc) 127 + 129: 43(f64vec2) Load 45(dvec2v) + 130: 43(f64vec2) FAdd 129 128 Store 45(dvec2v) 130 - 131: 48(fvec3) Load 50(dvec3v) - 132: 48(fvec3) ExtInst 1(GLSL.std.450) 3(Trunc) 131 - 133: 48(fvec3) Load 50(dvec3v) - 134: 48(fvec3) FAdd 133 132 + 131: 48(f64vec3) Load 50(dvec3v) + 132: 48(f64vec3) ExtInst 1(GLSL.std.450) 3(Trunc) 131 + 133: 48(f64vec3) Load 50(dvec3v) + 134: 48(f64vec3) FAdd 133 132 Store 50(dvec3v) 134 - 135: 53(fvec4) Load 55(dvec4v) - 136: 53(fvec4) ExtInst 1(GLSL.std.450) 3(Trunc) 135 - 137: 53(fvec4) Load 55(dvec4v) - 138: 53(fvec4) FAdd 137 136 + 135: 53(f64vec4) Load 55(dvec4v) + 136: 53(f64vec4) ExtInst 1(GLSL.std.450) 3(Trunc) 135 + 137: 53(f64vec4) Load 55(dvec4v) + 138: 53(f64vec4) FAdd 137 136 Store 55(dvec4v) 138 - 139: 39(float) Load 41(doublev) - 140: 39(float) ExtInst 1(GLSL.std.450) 1(Round) 139 - 141: 39(float) Load 41(doublev) - 142: 39(float) FAdd 141 140 + 139:39(float64_t) Load 41(doublev) + 140:39(float64_t) ExtInst 1(GLSL.std.450) 1(Round) 139 + 141:39(float64_t) Load 41(doublev) + 142:39(float64_t) FAdd 141 140 Store 41(doublev) 142 - 143: 43(fvec2) Load 45(dvec2v) - 144: 43(fvec2) ExtInst 1(GLSL.std.450) 1(Round) 143 - 145: 43(fvec2) Load 45(dvec2v) - 146: 43(fvec2) FAdd 145 144 + 143: 43(f64vec2) Load 45(dvec2v) + 144: 43(f64vec2) ExtInst 1(GLSL.std.450) 1(Round) 143 + 145: 43(f64vec2) Load 45(dvec2v) + 146: 43(f64vec2) FAdd 145 144 Store 45(dvec2v) 146 - 147: 48(fvec3) Load 50(dvec3v) - 148: 48(fvec3) ExtInst 1(GLSL.std.450) 1(Round) 147 - 149: 48(fvec3) Load 50(dvec3v) - 150: 48(fvec3) FAdd 149 148 + 147: 48(f64vec3) Load 50(dvec3v) + 148: 48(f64vec3) ExtInst 1(GLSL.std.450) 1(Round) 147 + 149: 48(f64vec3) Load 50(dvec3v) + 150: 48(f64vec3) FAdd 149 148 Store 50(dvec3v) 150 - 151: 53(fvec4) Load 55(dvec4v) - 152: 53(fvec4) ExtInst 1(GLSL.std.450) 1(Round) 151 - 153: 53(fvec4) Load 55(dvec4v) - 154: 53(fvec4) FAdd 153 152 + 151: 53(f64vec4) Load 55(dvec4v) + 152: 53(f64vec4) ExtInst 1(GLSL.std.450) 1(Round) 151 + 153: 53(f64vec4) Load 55(dvec4v) + 154: 53(f64vec4) FAdd 153 152 Store 55(dvec4v) 154 - 155: 39(float) Load 41(doublev) - 156: 39(float) ExtInst 1(GLSL.std.450) 2(RoundEven) 155 - 157: 39(float) Load 41(doublev) - 158: 39(float) FAdd 157 156 + 155:39(float64_t) Load 41(doublev) + 156:39(float64_t) ExtInst 1(GLSL.std.450) 2(RoundEven) 155 + 157:39(float64_t) Load 41(doublev) + 158:39(float64_t) FAdd 157 156 Store 41(doublev) 158 - 159: 43(fvec2) Load 45(dvec2v) - 160: 43(fvec2) ExtInst 1(GLSL.std.450) 2(RoundEven) 159 - 161: 43(fvec2) Load 45(dvec2v) - 162: 43(fvec2) FAdd 161 160 + 159: 43(f64vec2) Load 45(dvec2v) + 160: 43(f64vec2) ExtInst 1(GLSL.std.450) 2(RoundEven) 159 + 161: 43(f64vec2) Load 45(dvec2v) + 162: 43(f64vec2) FAdd 161 160 Store 45(dvec2v) 162 - 163: 48(fvec3) Load 50(dvec3v) - 164: 48(fvec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 163 - 165: 48(fvec3) Load 50(dvec3v) - 166: 48(fvec3) FAdd 165 164 + 163: 48(f64vec3) Load 50(dvec3v) + 164: 48(f64vec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 163 + 165: 48(f64vec3) Load 50(dvec3v) + 166: 48(f64vec3) FAdd 165 164 Store 50(dvec3v) 166 - 167: 53(fvec4) Load 55(dvec4v) - 168: 53(fvec4) ExtInst 1(GLSL.std.450) 2(RoundEven) 167 - 169: 53(fvec4) Load 55(dvec4v) - 170: 53(fvec4) FAdd 169 168 + 167: 53(f64vec4) Load 55(dvec4v) + 168: 53(f64vec4) ExtInst 1(GLSL.std.450) 2(RoundEven) 167 + 169: 53(f64vec4) Load 55(dvec4v) + 170: 53(f64vec4) FAdd 169 168 Store 55(dvec4v) 170 - 171: 39(float) Load 41(doublev) - 172: 39(float) ExtInst 1(GLSL.std.450) 9(Ceil) 171 - 173: 39(float) Load 41(doublev) - 174: 39(float) FAdd 173 172 + 171:39(float64_t) Load 41(doublev) + 172:39(float64_t) ExtInst 1(GLSL.std.450) 9(Ceil) 171 + 173:39(float64_t) Load 41(doublev) + 174:39(float64_t) FAdd 173 172 Store 41(doublev) 174 - 175: 43(fvec2) Load 45(dvec2v) - 176: 43(fvec2) ExtInst 1(GLSL.std.450) 9(Ceil) 175 - 177: 43(fvec2) Load 45(dvec2v) - 178: 43(fvec2) FAdd 177 176 + 175: 43(f64vec2) Load 45(dvec2v) + 176: 43(f64vec2) ExtInst 1(GLSL.std.450) 9(Ceil) 175 + 177: 43(f64vec2) Load 45(dvec2v) + 178: 43(f64vec2) FAdd 177 176 Store 45(dvec2v) 178 - 179: 48(fvec3) Load 50(dvec3v) - 180: 48(fvec3) ExtInst 1(GLSL.std.450) 9(Ceil) 179 - 181: 48(fvec3) Load 50(dvec3v) - 182: 48(fvec3) FAdd 181 180 + 179: 48(f64vec3) Load 50(dvec3v) + 180: 48(f64vec3) ExtInst 1(GLSL.std.450) 9(Ceil) 179 + 181: 48(f64vec3) Load 50(dvec3v) + 182: 48(f64vec3) FAdd 181 180 Store 50(dvec3v) 182 - 183: 53(fvec4) Load 55(dvec4v) - 184: 53(fvec4) ExtInst 1(GLSL.std.450) 9(Ceil) 183 - 185: 53(fvec4) Load 55(dvec4v) - 186: 53(fvec4) FAdd 185 184 + 183: 53(f64vec4) Load 55(dvec4v) + 184: 53(f64vec4) ExtInst 1(GLSL.std.450) 9(Ceil) 183 + 185: 53(f64vec4) Load 55(dvec4v) + 186: 53(f64vec4) FAdd 185 184 Store 55(dvec4v) 186 - 187: 39(float) Load 41(doublev) - 188: 39(float) ExtInst 1(GLSL.std.450) 10(Fract) 187 - 189: 39(float) Load 41(doublev) - 190: 39(float) FAdd 189 188 + 187:39(float64_t) Load 41(doublev) + 188:39(float64_t) ExtInst 1(GLSL.std.450) 10(Fract) 187 + 189:39(float64_t) Load 41(doublev) + 190:39(float64_t) FAdd 189 188 Store 41(doublev) 190 - 191: 43(fvec2) Load 45(dvec2v) - 192: 43(fvec2) ExtInst 1(GLSL.std.450) 10(Fract) 191 - 193: 43(fvec2) Load 45(dvec2v) - 194: 43(fvec2) FAdd 193 192 + 191: 43(f64vec2) Load 45(dvec2v) + 192: 43(f64vec2) ExtInst 1(GLSL.std.450) 10(Fract) 191 + 193: 43(f64vec2) Load 45(dvec2v) + 194: 43(f64vec2) FAdd 193 192 Store 45(dvec2v) 194 - 195: 48(fvec3) Load 50(dvec3v) - 196: 48(fvec3) ExtInst 1(GLSL.std.450) 10(Fract) 195 - 197: 48(fvec3) Load 50(dvec3v) - 198: 48(fvec3) FAdd 197 196 + 195: 48(f64vec3) Load 50(dvec3v) + 196: 48(f64vec3) ExtInst 1(GLSL.std.450) 10(Fract) 195 + 197: 48(f64vec3) Load 50(dvec3v) + 198: 48(f64vec3) FAdd 197 196 Store 50(dvec3v) 198 - 199: 53(fvec4) Load 55(dvec4v) - 200: 53(fvec4) ExtInst 1(GLSL.std.450) 10(Fract) 199 - 201: 53(fvec4) Load 55(dvec4v) - 202: 53(fvec4) FAdd 201 200 + 199: 53(f64vec4) Load 55(dvec4v) + 200: 53(f64vec4) ExtInst 1(GLSL.std.450) 10(Fract) 199 + 201: 53(f64vec4) Load 55(dvec4v) + 202: 53(f64vec4) FAdd 201 200 Store 55(dvec4v) 202 - 203: 39(float) Load 41(doublev) - 204: 39(float) Load 41(doublev) - 205: 39(float) FMod 203 204 - 206: 39(float) Load 41(doublev) - 207: 39(float) FAdd 206 205 + 203:39(float64_t) Load 41(doublev) + 204:39(float64_t) Load 41(doublev) + 205:39(float64_t) FMod 203 204 + 206:39(float64_t) Load 41(doublev) + 207:39(float64_t) FAdd 206 205 Store 41(doublev) 207 - 208: 43(fvec2) Load 45(dvec2v) - 209: 39(float) Load 41(doublev) - 210: 43(fvec2) CompositeConstruct 209 209 - 211: 43(fvec2) FMod 208 210 - 212: 43(fvec2) Load 45(dvec2v) - 213: 43(fvec2) FAdd 212 211 + 208: 43(f64vec2) Load 45(dvec2v) + 209:39(float64_t) Load 41(doublev) + 210: 43(f64vec2) CompositeConstruct 209 209 + 211: 43(f64vec2) FMod 208 210 + 212: 43(f64vec2) Load 45(dvec2v) + 213: 43(f64vec2) FAdd 212 211 Store 45(dvec2v) 213 - 214: 48(fvec3) Load 50(dvec3v) - 215: 39(float) Load 41(doublev) - 216: 48(fvec3) CompositeConstruct 215 215 215 - 217: 48(fvec3) FMod 214 216 - 218: 48(fvec3) Load 50(dvec3v) - 219: 48(fvec3) FAdd 218 217 + 214: 48(f64vec3) Load 50(dvec3v) + 215:39(float64_t) Load 41(doublev) + 216: 48(f64vec3) CompositeConstruct 215 215 215 + 217: 48(f64vec3) FMod 214 216 + 218: 48(f64vec3) Load 50(dvec3v) + 219: 48(f64vec3) FAdd 218 217 Store 50(dvec3v) 219 - 220: 53(fvec4) Load 55(dvec4v) - 221: 39(float) Load 41(doublev) - 222: 53(fvec4) CompositeConstruct 221 221 221 221 - 223: 53(fvec4) FMod 220 222 - 224: 53(fvec4) Load 55(dvec4v) - 225: 53(fvec4) FAdd 224 223 + 220: 53(f64vec4) Load 55(dvec4v) + 221:39(float64_t) Load 41(doublev) + 222: 53(f64vec4) CompositeConstruct 221 221 221 221 + 223: 53(f64vec4) FMod 220 222 + 224: 53(f64vec4) Load 55(dvec4v) + 225: 53(f64vec4) FAdd 224 223 Store 55(dvec4v) 225 - 226: 43(fvec2) Load 45(dvec2v) - 227: 43(fvec2) Load 45(dvec2v) - 228: 43(fvec2) FMod 226 227 - 229: 43(fvec2) Load 45(dvec2v) - 230: 43(fvec2) FAdd 229 228 + 226: 43(f64vec2) Load 45(dvec2v) + 227: 43(f64vec2) Load 45(dvec2v) + 228: 43(f64vec2) FMod 226 227 + 229: 43(f64vec2) Load 45(dvec2v) + 230: 43(f64vec2) FAdd 229 228 Store 45(dvec2v) 230 - 231: 48(fvec3) Load 50(dvec3v) - 232: 48(fvec3) Load 50(dvec3v) - 233: 48(fvec3) FMod 231 232 - 234: 48(fvec3) Load 50(dvec3v) - 235: 48(fvec3) FAdd 234 233 + 231: 48(f64vec3) Load 50(dvec3v) + 232: 48(f64vec3) Load 50(dvec3v) + 233: 48(f64vec3) FMod 231 232 + 234: 48(f64vec3) Load 50(dvec3v) + 235: 48(f64vec3) FAdd 234 233 Store 50(dvec3v) 235 - 236: 53(fvec4) Load 55(dvec4v) - 237: 53(fvec4) Load 55(dvec4v) - 238: 53(fvec4) FMod 236 237 - 239: 53(fvec4) Load 55(dvec4v) - 240: 53(fvec4) FAdd 239 238 + 236: 53(f64vec4) Load 55(dvec4v) + 237: 53(f64vec4) Load 55(dvec4v) + 238: 53(f64vec4) FMod 236 237 + 239: 53(f64vec4) Load 55(dvec4v) + 240: 53(f64vec4) FAdd 239 238 Store 55(dvec4v) 240 - 241: 39(float) Load 41(doublev) - 242: 39(float) ExtInst 1(GLSL.std.450) 35(Modf) 241 41(doublev) - 243: 39(float) Load 41(doublev) - 244: 39(float) FAdd 243 242 + 241:39(float64_t) Load 41(doublev) + 242:39(float64_t) ExtInst 1(GLSL.std.450) 35(Modf) 241 41(doublev) + 243:39(float64_t) Load 41(doublev) + 244:39(float64_t) FAdd 243 242 Store 41(doublev) 244 - 245: 43(fvec2) Load 45(dvec2v) - 246: 43(fvec2) ExtInst 1(GLSL.std.450) 35(Modf) 245 45(dvec2v) - 247: 43(fvec2) Load 45(dvec2v) - 248: 43(fvec2) FAdd 247 246 + 245: 43(f64vec2) Load 45(dvec2v) + 246: 43(f64vec2) ExtInst 1(GLSL.std.450) 35(Modf) 245 45(dvec2v) + 247: 43(f64vec2) Load 45(dvec2v) + 248: 43(f64vec2) FAdd 247 246 Store 45(dvec2v) 248 - 249: 48(fvec3) Load 50(dvec3v) - 250: 48(fvec3) ExtInst 1(GLSL.std.450) 35(Modf) 249 50(dvec3v) - 251: 48(fvec3) Load 50(dvec3v) - 252: 48(fvec3) FAdd 251 250 + 249: 48(f64vec3) Load 50(dvec3v) + 250: 48(f64vec3) ExtInst 1(GLSL.std.450) 35(Modf) 249 50(dvec3v) + 251: 48(f64vec3) Load 50(dvec3v) + 252: 48(f64vec3) FAdd 251 250 Store 50(dvec3v) 252 - 253: 53(fvec4) Load 55(dvec4v) - 254: 53(fvec4) ExtInst 1(GLSL.std.450) 35(Modf) 253 55(dvec4v) - 255: 53(fvec4) Load 55(dvec4v) - 256: 53(fvec4) FAdd 255 254 + 253: 53(f64vec4) Load 55(dvec4v) + 254: 53(f64vec4) ExtInst 1(GLSL.std.450) 35(Modf) 253 55(dvec4v) + 255: 53(f64vec4) Load 55(dvec4v) + 256: 53(f64vec4) FAdd 255 254 Store 55(dvec4v) 256 - 257: 39(float) Load 41(doublev) - 258: 39(float) Load 41(doublev) - 259: 39(float) ExtInst 1(GLSL.std.450) 37(FMin) 257 258 - 260: 39(float) Load 41(doublev) - 261: 39(float) FAdd 260 259 + 257:39(float64_t) Load 41(doublev) + 258:39(float64_t) Load 41(doublev) + 259:39(float64_t) ExtInst 1(GLSL.std.450) 37(FMin) 257 258 + 260:39(float64_t) Load 41(doublev) + 261:39(float64_t) FAdd 260 259 Store 41(doublev) 261 - 262: 43(fvec2) Load 45(dvec2v) - 263: 39(float) Load 41(doublev) - 264: 43(fvec2) CompositeConstruct 263 263 - 265: 43(fvec2) ExtInst 1(GLSL.std.450) 37(FMin) 262 264 - 266: 43(fvec2) Load 45(dvec2v) - 267: 43(fvec2) FAdd 266 265 + 262: 43(f64vec2) Load 45(dvec2v) + 263:39(float64_t) Load 41(doublev) + 264: 43(f64vec2) CompositeConstruct 263 263 + 265: 43(f64vec2) ExtInst 1(GLSL.std.450) 37(FMin) 262 264 + 266: 43(f64vec2) Load 45(dvec2v) + 267: 43(f64vec2) FAdd 266 265 Store 45(dvec2v) 267 - 268: 48(fvec3) Load 50(dvec3v) - 269: 39(float) Load 41(doublev) - 270: 48(fvec3) CompositeConstruct 269 269 269 - 271: 48(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 268 270 - 272: 48(fvec3) Load 50(dvec3v) - 273: 48(fvec3) FAdd 272 271 + 268: 48(f64vec3) Load 50(dvec3v) + 269:39(float64_t) Load 41(doublev) + 270: 48(f64vec3) CompositeConstruct 269 269 269 + 271: 48(f64vec3) ExtInst 1(GLSL.std.450) 37(FMin) 268 270 + 272: 48(f64vec3) Load 50(dvec3v) + 273: 48(f64vec3) FAdd 272 271 Store 50(dvec3v) 273 - 274: 53(fvec4) Load 55(dvec4v) - 275: 39(float) Load 41(doublev) - 276: 53(fvec4) CompositeConstruct 275 275 275 275 - 277: 53(fvec4) ExtInst 1(GLSL.std.450) 37(FMin) 274 276 - 278: 53(fvec4) Load 55(dvec4v) - 279: 53(fvec4) FAdd 278 277 + 274: 53(f64vec4) Load 55(dvec4v) + 275:39(float64_t) Load 41(doublev) + 276: 53(f64vec4) CompositeConstruct 275 275 275 275 + 277: 53(f64vec4) ExtInst 1(GLSL.std.450) 37(FMin) 274 276 + 278: 53(f64vec4) Load 55(dvec4v) + 279: 53(f64vec4) FAdd 278 277 Store 55(dvec4v) 279 - 280: 43(fvec2) Load 45(dvec2v) - 281: 43(fvec2) Load 45(dvec2v) - 282: 43(fvec2) ExtInst 1(GLSL.std.450) 37(FMin) 280 281 - 283: 43(fvec2) Load 45(dvec2v) - 284: 43(fvec2) FAdd 283 282 + 280: 43(f64vec2) Load 45(dvec2v) + 281: 43(f64vec2) Load 45(dvec2v) + 282: 43(f64vec2) ExtInst 1(GLSL.std.450) 37(FMin) 280 281 + 283: 43(f64vec2) Load 45(dvec2v) + 284: 43(f64vec2) FAdd 283 282 Store 45(dvec2v) 284 - 285: 48(fvec3) Load 50(dvec3v) - 286: 48(fvec3) Load 50(dvec3v) - 287: 48(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 285 286 - 288: 48(fvec3) Load 50(dvec3v) - 289: 48(fvec3) FAdd 288 287 + 285: 48(f64vec3) Load 50(dvec3v) + 286: 48(f64vec3) Load 50(dvec3v) + 287: 48(f64vec3) ExtInst 1(GLSL.std.450) 37(FMin) 285 286 + 288: 48(f64vec3) Load 50(dvec3v) + 289: 48(f64vec3) FAdd 288 287 Store 50(dvec3v) 289 - 290: 53(fvec4) Load 55(dvec4v) - 291: 53(fvec4) Load 55(dvec4v) - 292: 53(fvec4) ExtInst 1(GLSL.std.450) 37(FMin) 290 291 - 293: 53(fvec4) Load 55(dvec4v) - 294: 53(fvec4) FAdd 293 292 + 290: 53(f64vec4) Load 55(dvec4v) + 291: 53(f64vec4) Load 55(dvec4v) + 292: 53(f64vec4) ExtInst 1(GLSL.std.450) 37(FMin) 290 291 + 293: 53(f64vec4) Load 55(dvec4v) + 294: 53(f64vec4) FAdd 293 292 Store 55(dvec4v) 294 - 295: 39(float) Load 41(doublev) - 296: 39(float) Load 41(doublev) - 297: 39(float) ExtInst 1(GLSL.std.450) 40(FMax) 295 296 - 298: 39(float) Load 41(doublev) - 299: 39(float) FAdd 298 297 + 295:39(float64_t) Load 41(doublev) + 296:39(float64_t) Load 41(doublev) + 297:39(float64_t) ExtInst 1(GLSL.std.450) 40(FMax) 295 296 + 298:39(float64_t) Load 41(doublev) + 299:39(float64_t) FAdd 298 297 Store 41(doublev) 299 - 300: 43(fvec2) Load 45(dvec2v) - 301: 39(float) Load 41(doublev) - 302: 43(fvec2) CompositeConstruct 301 301 - 303: 43(fvec2) ExtInst 1(GLSL.std.450) 40(FMax) 300 302 - 304: 43(fvec2) Load 45(dvec2v) - 305: 43(fvec2) FAdd 304 303 + 300: 43(f64vec2) Load 45(dvec2v) + 301:39(float64_t) Load 41(doublev) + 302: 43(f64vec2) CompositeConstruct 301 301 + 303: 43(f64vec2) ExtInst 1(GLSL.std.450) 40(FMax) 300 302 + 304: 43(f64vec2) Load 45(dvec2v) + 305: 43(f64vec2) FAdd 304 303 Store 45(dvec2v) 305 - 306: 48(fvec3) Load 50(dvec3v) - 307: 39(float) Load 41(doublev) - 308: 48(fvec3) CompositeConstruct 307 307 307 - 309: 48(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 306 308 - 310: 48(fvec3) Load 50(dvec3v) - 311: 48(fvec3) FAdd 310 309 + 306: 48(f64vec3) Load 50(dvec3v) + 307:39(float64_t) Load 41(doublev) + 308: 48(f64vec3) CompositeConstruct 307 307 307 + 309: 48(f64vec3) ExtInst 1(GLSL.std.450) 40(FMax) 306 308 + 310: 48(f64vec3) Load 50(dvec3v) + 311: 48(f64vec3) FAdd 310 309 Store 50(dvec3v) 311 - 312: 53(fvec4) Load 55(dvec4v) - 313: 39(float) Load 41(doublev) - 314: 53(fvec4) CompositeConstruct 313 313 313 313 - 315: 53(fvec4) ExtInst 1(GLSL.std.450) 40(FMax) 312 314 - 316: 53(fvec4) Load 55(dvec4v) - 317: 53(fvec4) FAdd 316 315 + 312: 53(f64vec4) Load 55(dvec4v) + 313:39(float64_t) Load 41(doublev) + 314: 53(f64vec4) CompositeConstruct 313 313 313 313 + 315: 53(f64vec4) ExtInst 1(GLSL.std.450) 40(FMax) 312 314 + 316: 53(f64vec4) Load 55(dvec4v) + 317: 53(f64vec4) FAdd 316 315 Store 55(dvec4v) 317 - 318: 43(fvec2) Load 45(dvec2v) - 319: 43(fvec2) Load 45(dvec2v) - 320: 43(fvec2) ExtInst 1(GLSL.std.450) 40(FMax) 318 319 - 321: 43(fvec2) Load 45(dvec2v) - 322: 43(fvec2) FAdd 321 320 + 318: 43(f64vec2) Load 45(dvec2v) + 319: 43(f64vec2) Load 45(dvec2v) + 320: 43(f64vec2) ExtInst 1(GLSL.std.450) 40(FMax) 318 319 + 321: 43(f64vec2) Load 45(dvec2v) + 322: 43(f64vec2) FAdd 321 320 Store 45(dvec2v) 322 - 323: 48(fvec3) Load 50(dvec3v) - 324: 48(fvec3) Load 50(dvec3v) - 325: 48(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 323 324 - 326: 48(fvec3) Load 50(dvec3v) - 327: 48(fvec3) FAdd 326 325 + 323: 48(f64vec3) Load 50(dvec3v) + 324: 48(f64vec3) Load 50(dvec3v) + 325: 48(f64vec3) ExtInst 1(GLSL.std.450) 40(FMax) 323 324 + 326: 48(f64vec3) Load 50(dvec3v) + 327: 48(f64vec3) FAdd 326 325 Store 50(dvec3v) 327 - 328: 53(fvec4) Load 55(dvec4v) - 329: 53(fvec4) Load 55(dvec4v) - 330: 53(fvec4) ExtInst 1(GLSL.std.450) 40(FMax) 328 329 - 331: 53(fvec4) Load 55(dvec4v) - 332: 53(fvec4) FAdd 331 330 + 328: 53(f64vec4) Load 55(dvec4v) + 329: 53(f64vec4) Load 55(dvec4v) + 330: 53(f64vec4) ExtInst 1(GLSL.std.450) 40(FMax) 328 329 + 331: 53(f64vec4) Load 55(dvec4v) + 332: 53(f64vec4) FAdd 331 330 Store 55(dvec4v) 332 - 333: 39(float) Load 41(doublev) - 334: 39(float) Load 41(doublev) - 335: 39(float) Load 41(doublev) - 336: 39(float) ExtInst 1(GLSL.std.450) 43(FClamp) 333 334 335 - 337: 39(float) Load 41(doublev) - 338: 39(float) FAdd 337 336 + 333:39(float64_t) Load 41(doublev) + 334:39(float64_t) Load 41(doublev) + 335:39(float64_t) Load 41(doublev) + 336:39(float64_t) ExtInst 1(GLSL.std.450) 43(FClamp) 333 334 335 + 337:39(float64_t) Load 41(doublev) + 338:39(float64_t) FAdd 337 336 Store 41(doublev) 338 - 339: 43(fvec2) Load 45(dvec2v) - 340: 39(float) Load 41(doublev) - 341: 39(float) Load 41(doublev) - 342: 43(fvec2) CompositeConstruct 340 340 - 343: 43(fvec2) CompositeConstruct 341 341 - 344: 43(fvec2) ExtInst 1(GLSL.std.450) 43(FClamp) 339 342 343 - 345: 43(fvec2) Load 45(dvec2v) - 346: 43(fvec2) FAdd 345 344 + 339: 43(f64vec2) Load 45(dvec2v) + 340:39(float64_t) Load 41(doublev) + 341:39(float64_t) Load 41(doublev) + 342: 43(f64vec2) CompositeConstruct 340 340 + 343: 43(f64vec2) CompositeConstruct 341 341 + 344: 43(f64vec2) ExtInst 1(GLSL.std.450) 43(FClamp) 339 342 343 + 345: 43(f64vec2) Load 45(dvec2v) + 346: 43(f64vec2) FAdd 345 344 Store 45(dvec2v) 346 - 347: 48(fvec3) Load 50(dvec3v) - 348: 39(float) Load 41(doublev) - 349: 39(float) Load 41(doublev) - 350: 48(fvec3) CompositeConstruct 348 348 348 - 351: 48(fvec3) CompositeConstruct 349 349 349 - 352: 48(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 347 350 351 - 353: 48(fvec3) Load 50(dvec3v) - 354: 48(fvec3) FAdd 353 352 + 347: 48(f64vec3) Load 50(dvec3v) + 348:39(float64_t) Load 41(doublev) + 349:39(float64_t) Load 41(doublev) + 350: 48(f64vec3) CompositeConstruct 348 348 348 + 351: 48(f64vec3) CompositeConstruct 349 349 349 + 352: 48(f64vec3) ExtInst 1(GLSL.std.450) 43(FClamp) 347 350 351 + 353: 48(f64vec3) Load 50(dvec3v) + 354: 48(f64vec3) FAdd 353 352 Store 50(dvec3v) 354 - 355: 53(fvec4) Load 55(dvec4v) - 356: 39(float) Load 41(doublev) - 357: 39(float) Load 41(doublev) - 358: 53(fvec4) CompositeConstruct 356 356 356 356 - 359: 53(fvec4) CompositeConstruct 357 357 357 357 - 360: 53(fvec4) ExtInst 1(GLSL.std.450) 43(FClamp) 355 358 359 - 361: 53(fvec4) Load 55(dvec4v) - 362: 53(fvec4) FAdd 361 360 + 355: 53(f64vec4) Load 55(dvec4v) + 356:39(float64_t) Load 41(doublev) + 357:39(float64_t) Load 41(doublev) + 358: 53(f64vec4) CompositeConstruct 356 356 356 356 + 359: 53(f64vec4) CompositeConstruct 357 357 357 357 + 360: 53(f64vec4) ExtInst 1(GLSL.std.450) 43(FClamp) 355 358 359 + 361: 53(f64vec4) Load 55(dvec4v) + 362: 53(f64vec4) FAdd 361 360 Store 55(dvec4v) 362 - 363: 43(fvec2) Load 45(dvec2v) - 364: 43(fvec2) Load 45(dvec2v) - 365: 43(fvec2) Load 45(dvec2v) - 366: 43(fvec2) ExtInst 1(GLSL.std.450) 43(FClamp) 363 364 365 - 367: 43(fvec2) Load 45(dvec2v) - 368: 43(fvec2) FAdd 367 366 + 363: 43(f64vec2) Load 45(dvec2v) + 364: 43(f64vec2) Load 45(dvec2v) + 365: 43(f64vec2) Load 45(dvec2v) + 366: 43(f64vec2) ExtInst 1(GLSL.std.450) 43(FClamp) 363 364 365 + 367: 43(f64vec2) Load 45(dvec2v) + 368: 43(f64vec2) FAdd 367 366 Store 45(dvec2v) 368 - 369: 48(fvec3) Load 50(dvec3v) - 370: 48(fvec3) Load 50(dvec3v) - 371: 48(fvec3) Load 50(dvec3v) - 372: 48(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 369 370 371 - 373: 48(fvec3) Load 50(dvec3v) - 374: 48(fvec3) FAdd 373 372 + 369: 48(f64vec3) Load 50(dvec3v) + 370: 48(f64vec3) Load 50(dvec3v) + 371: 48(f64vec3) Load 50(dvec3v) + 372: 48(f64vec3) ExtInst 1(GLSL.std.450) 43(FClamp) 369 370 371 + 373: 48(f64vec3) Load 50(dvec3v) + 374: 48(f64vec3) FAdd 373 372 Store 50(dvec3v) 374 - 375: 53(fvec4) Load 55(dvec4v) - 376: 53(fvec4) Load 55(dvec4v) - 377: 53(fvec4) Load 55(dvec4v) - 378: 53(fvec4) ExtInst 1(GLSL.std.450) 43(FClamp) 375 376 377 - 379: 53(fvec4) Load 55(dvec4v) - 380: 53(fvec4) FAdd 379 378 + 375: 53(f64vec4) Load 55(dvec4v) + 376: 53(f64vec4) Load 55(dvec4v) + 377: 53(f64vec4) Load 55(dvec4v) + 378: 53(f64vec4) ExtInst 1(GLSL.std.450) 43(FClamp) 375 376 377 + 379: 53(f64vec4) Load 55(dvec4v) + 380: 53(f64vec4) FAdd 379 378 Store 55(dvec4v) 380 - 381: 39(float) Load 41(doublev) - 382: 39(float) Load 41(doublev) - 383: 39(float) Load 41(doublev) - 384: 39(float) ExtInst 1(GLSL.std.450) 46(FMix) 381 382 383 - 385: 39(float) Load 41(doublev) - 386: 39(float) FAdd 385 384 + 381:39(float64_t) Load 41(doublev) + 382:39(float64_t) Load 41(doublev) + 383:39(float64_t) Load 41(doublev) + 384:39(float64_t) ExtInst 1(GLSL.std.450) 46(FMix) 381 382 383 + 385:39(float64_t) Load 41(doublev) + 386:39(float64_t) FAdd 385 384 Store 41(doublev) 386 - 387: 43(fvec2) Load 45(dvec2v) - 388: 43(fvec2) Load 45(dvec2v) - 389: 39(float) Load 41(doublev) - 390: 43(fvec2) CompositeConstruct 389 389 - 391: 43(fvec2) ExtInst 1(GLSL.std.450) 46(FMix) 387 388 390 - 392: 43(fvec2) Load 45(dvec2v) - 393: 43(fvec2) FAdd 392 391 + 387: 43(f64vec2) Load 45(dvec2v) + 388: 43(f64vec2) Load 45(dvec2v) + 389:39(float64_t) Load 41(doublev) + 390: 43(f64vec2) CompositeConstruct 389 389 + 391: 43(f64vec2) ExtInst 1(GLSL.std.450) 46(FMix) 387 388 390 + 392: 43(f64vec2) Load 45(dvec2v) + 393: 43(f64vec2) FAdd 392 391 Store 45(dvec2v) 393 - 394: 48(fvec3) Load 50(dvec3v) - 395: 48(fvec3) Load 50(dvec3v) - 396: 39(float) Load 41(doublev) - 397: 48(fvec3) CompositeConstruct 396 396 396 - 398: 48(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 394 395 397 - 399: 48(fvec3) Load 50(dvec3v) - 400: 48(fvec3) FAdd 399 398 + 394: 48(f64vec3) Load 50(dvec3v) + 395: 48(f64vec3) Load 50(dvec3v) + 396:39(float64_t) Load 41(doublev) + 397: 48(f64vec3) CompositeConstruct 396 396 396 + 398: 48(f64vec3) ExtInst 1(GLSL.std.450) 46(FMix) 394 395 397 + 399: 48(f64vec3) Load 50(dvec3v) + 400: 48(f64vec3) FAdd 399 398 Store 50(dvec3v) 400 - 401: 53(fvec4) Load 55(dvec4v) - 402: 53(fvec4) Load 55(dvec4v) - 403: 39(float) Load 41(doublev) - 404: 53(fvec4) CompositeConstruct 403 403 403 403 - 405: 53(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 401 402 404 - 406: 53(fvec4) Load 55(dvec4v) - 407: 53(fvec4) FAdd 406 405 + 401: 53(f64vec4) Load 55(dvec4v) + 402: 53(f64vec4) Load 55(dvec4v) + 403:39(float64_t) Load 41(doublev) + 404: 53(f64vec4) CompositeConstruct 403 403 403 403 + 405: 53(f64vec4) ExtInst 1(GLSL.std.450) 46(FMix) 401 402 404 + 406: 53(f64vec4) Load 55(dvec4v) + 407: 53(f64vec4) FAdd 406 405 Store 55(dvec4v) 407 - 408: 43(fvec2) Load 45(dvec2v) - 409: 43(fvec2) Load 45(dvec2v) - 410: 43(fvec2) Load 45(dvec2v) - 411: 43(fvec2) ExtInst 1(GLSL.std.450) 46(FMix) 408 409 410 - 412: 43(fvec2) Load 45(dvec2v) - 413: 43(fvec2) FAdd 412 411 + 408: 43(f64vec2) Load 45(dvec2v) + 409: 43(f64vec2) Load 45(dvec2v) + 410: 43(f64vec2) Load 45(dvec2v) + 411: 43(f64vec2) ExtInst 1(GLSL.std.450) 46(FMix) 408 409 410 + 412: 43(f64vec2) Load 45(dvec2v) + 413: 43(f64vec2) FAdd 412 411 Store 45(dvec2v) 413 - 414: 48(fvec3) Load 50(dvec3v) - 415: 48(fvec3) Load 50(dvec3v) - 416: 48(fvec3) Load 50(dvec3v) - 417: 48(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 414 415 416 - 418: 48(fvec3) Load 50(dvec3v) - 419: 48(fvec3) FAdd 418 417 + 414: 48(f64vec3) Load 50(dvec3v) + 415: 48(f64vec3) Load 50(dvec3v) + 416: 48(f64vec3) Load 50(dvec3v) + 417: 48(f64vec3) ExtInst 1(GLSL.std.450) 46(FMix) 414 415 416 + 418: 48(f64vec3) Load 50(dvec3v) + 419: 48(f64vec3) FAdd 418 417 Store 50(dvec3v) 419 - 420: 53(fvec4) Load 55(dvec4v) - 421: 53(fvec4) Load 55(dvec4v) - 422: 53(fvec4) Load 55(dvec4v) - 423: 53(fvec4) ExtInst 1(GLSL.std.450) 46(FMix) 420 421 422 - 424: 53(fvec4) Load 55(dvec4v) - 425: 53(fvec4) FAdd 424 423 + 420: 53(f64vec4) Load 55(dvec4v) + 421: 53(f64vec4) Load 55(dvec4v) + 422: 53(f64vec4) Load 55(dvec4v) + 423: 53(f64vec4) ExtInst 1(GLSL.std.450) 46(FMix) 420 421 422 + 424: 53(f64vec4) Load 55(dvec4v) + 425: 53(f64vec4) FAdd 424 423 Store 55(dvec4v) 425 - 426: 39(float) Load 41(doublev) - 427: 39(float) Load 41(doublev) + 426:39(float64_t) Load 41(doublev) + 427:39(float64_t) Load 41(doublev) 431: 428(bool) Load 430(boolv) - 432: 39(float) Select 431 427 426 - 433: 39(float) Load 41(doublev) - 434: 39(float) FAdd 433 432 + 432:39(float64_t) Select 431 427 426 + 433:39(float64_t) Load 41(doublev) + 434:39(float64_t) FAdd 433 432 Store 41(doublev) 434 - 435: 43(fvec2) Load 45(dvec2v) - 436: 43(fvec2) Load 45(dvec2v) + 435: 43(f64vec2) Load 45(dvec2v) + 436: 43(f64vec2) Load 45(dvec2v) 440: 437(bvec2) Load 439(bvec2v) - 441: 43(fvec2) Select 440 436 435 - 442: 43(fvec2) Load 45(dvec2v) - 443: 43(fvec2) FAdd 442 441 + 441: 43(f64vec2) Select 440 436 435 + 442: 43(f64vec2) Load 45(dvec2v) + 443: 43(f64vec2) FAdd 442 441 Store 45(dvec2v) 443 - 444: 48(fvec3) Load 50(dvec3v) - 445: 48(fvec3) Load 50(dvec3v) + 444: 48(f64vec3) Load 50(dvec3v) + 445: 48(f64vec3) Load 50(dvec3v) 449: 446(bvec3) Load 448(bvec3v) - 450: 48(fvec3) Select 449 445 444 - 451: 48(fvec3) Load 50(dvec3v) - 452: 48(fvec3) FAdd 451 450 + 450: 48(f64vec3) Select 449 445 444 + 451: 48(f64vec3) Load 50(dvec3v) + 452: 48(f64vec3) FAdd 451 450 Store 50(dvec3v) 452 - 453: 53(fvec4) Load 55(dvec4v) - 454: 53(fvec4) Load 55(dvec4v) + 453: 53(f64vec4) Load 55(dvec4v) + 454: 53(f64vec4) Load 55(dvec4v) 458: 455(bvec4) Load 457(bvec4v) - 459: 53(fvec4) Select 458 454 453 - 460: 53(fvec4) Load 55(dvec4v) - 461: 53(fvec4) FAdd 460 459 + 459: 53(f64vec4) Select 458 454 453 + 460: 53(f64vec4) Load 55(dvec4v) + 461: 53(f64vec4) FAdd 460 459 Store 55(dvec4v) 461 - 462: 39(float) Load 41(doublev) - 463: 39(float) Load 41(doublev) - 464: 39(float) ExtInst 1(GLSL.std.450) 48(Step) 462 463 - 465: 39(float) Load 41(doublev) - 466: 39(float) FAdd 465 464 + 462:39(float64_t) Load 41(doublev) + 463:39(float64_t) Load 41(doublev) + 464:39(float64_t) ExtInst 1(GLSL.std.450) 48(Step) 462 463 + 465:39(float64_t) Load 41(doublev) + 466:39(float64_t) FAdd 465 464 Store 41(doublev) 466 - 467: 43(fvec2) Load 45(dvec2v) - 468: 43(fvec2) Load 45(dvec2v) - 469: 43(fvec2) ExtInst 1(GLSL.std.450) 48(Step) 467 468 - 470: 43(fvec2) Load 45(dvec2v) - 471: 43(fvec2) FAdd 470 469 + 467: 43(f64vec2) Load 45(dvec2v) + 468: 43(f64vec2) Load 45(dvec2v) + 469: 43(f64vec2) ExtInst 1(GLSL.std.450) 48(Step) 467 468 + 470: 43(f64vec2) Load 45(dvec2v) + 471: 43(f64vec2) FAdd 470 469 Store 45(dvec2v) 471 - 472: 48(fvec3) Load 50(dvec3v) - 473: 48(fvec3) Load 50(dvec3v) - 474: 48(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 472 473 - 475: 48(fvec3) Load 50(dvec3v) - 476: 48(fvec3) FAdd 475 474 + 472: 48(f64vec3) Load 50(dvec3v) + 473: 48(f64vec3) Load 50(dvec3v) + 474: 48(f64vec3) ExtInst 1(GLSL.std.450) 48(Step) 472 473 + 475: 48(f64vec3) Load 50(dvec3v) + 476: 48(f64vec3) FAdd 475 474 Store 50(dvec3v) 476 - 477: 53(fvec4) Load 55(dvec4v) - 478: 53(fvec4) Load 55(dvec4v) - 479: 53(fvec4) ExtInst 1(GLSL.std.450) 48(Step) 477 478 - 480: 53(fvec4) Load 55(dvec4v) - 481: 53(fvec4) FAdd 480 479 + 477: 53(f64vec4) Load 55(dvec4v) + 478: 53(f64vec4) Load 55(dvec4v) + 479: 53(f64vec4) ExtInst 1(GLSL.std.450) 48(Step) 477 478 + 480: 53(f64vec4) Load 55(dvec4v) + 481: 53(f64vec4) FAdd 480 479 Store 55(dvec4v) 481 - 482: 39(float) Load 41(doublev) - 483: 43(fvec2) Load 45(dvec2v) - 484: 43(fvec2) CompositeConstruct 482 482 - 485: 43(fvec2) ExtInst 1(GLSL.std.450) 48(Step) 484 483 - 486: 43(fvec2) Load 45(dvec2v) - 487: 43(fvec2) FAdd 486 485 + 482:39(float64_t) Load 41(doublev) + 483: 43(f64vec2) Load 45(dvec2v) + 484: 43(f64vec2) CompositeConstruct 482 482 + 485: 43(f64vec2) ExtInst 1(GLSL.std.450) 48(Step) 484 483 + 486: 43(f64vec2) Load 45(dvec2v) + 487: 43(f64vec2) FAdd 486 485 Store 45(dvec2v) 487 - 488: 39(float) Load 41(doublev) - 489: 48(fvec3) Load 50(dvec3v) - 490: 48(fvec3) CompositeConstruct 488 488 488 - 491: 48(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 490 489 - 492: 48(fvec3) Load 50(dvec3v) - 493: 48(fvec3) FAdd 492 491 + 488:39(float64_t) Load 41(doublev) + 489: 48(f64vec3) Load 50(dvec3v) + 490: 48(f64vec3) CompositeConstruct 488 488 488 + 491: 48(f64vec3) ExtInst 1(GLSL.std.450) 48(Step) 490 489 + 492: 48(f64vec3) Load 50(dvec3v) + 493: 48(f64vec3) FAdd 492 491 Store 50(dvec3v) 493 - 494: 39(float) Load 41(doublev) - 495: 53(fvec4) Load 55(dvec4v) - 496: 53(fvec4) CompositeConstruct 494 494 494 494 - 497: 53(fvec4) ExtInst 1(GLSL.std.450) 48(Step) 496 495 - 498: 53(fvec4) Load 55(dvec4v) - 499: 53(fvec4) FAdd 498 497 + 494:39(float64_t) Load 41(doublev) + 495: 53(f64vec4) Load 55(dvec4v) + 496: 53(f64vec4) CompositeConstruct 494 494 494 494 + 497: 53(f64vec4) ExtInst 1(GLSL.std.450) 48(Step) 496 495 + 498: 53(f64vec4) Load 55(dvec4v) + 499: 53(f64vec4) FAdd 498 497 Store 55(dvec4v) 499 - 500: 39(float) Load 41(doublev) - 501: 39(float) Load 41(doublev) - 502: 39(float) Load 41(doublev) - 503: 39(float) ExtInst 1(GLSL.std.450) 49(SmoothStep) 500 501 502 - 504: 39(float) Load 41(doublev) - 505: 39(float) FAdd 504 503 + 500:39(float64_t) Load 41(doublev) + 501:39(float64_t) Load 41(doublev) + 502:39(float64_t) Load 41(doublev) + 503:39(float64_t) ExtInst 1(GLSL.std.450) 49(SmoothStep) 500 501 502 + 504:39(float64_t) Load 41(doublev) + 505:39(float64_t) FAdd 504 503 Store 41(doublev) 505 - 506: 43(fvec2) Load 45(dvec2v) - 507: 43(fvec2) Load 45(dvec2v) - 508: 43(fvec2) Load 45(dvec2v) - 509: 43(fvec2) ExtInst 1(GLSL.std.450) 49(SmoothStep) 506 507 508 - 510: 43(fvec2) Load 45(dvec2v) - 511: 43(fvec2) FAdd 510 509 + 506: 43(f64vec2) Load 45(dvec2v) + 507: 43(f64vec2) Load 45(dvec2v) + 508: 43(f64vec2) Load 45(dvec2v) + 509: 43(f64vec2) ExtInst 1(GLSL.std.450) 49(SmoothStep) 506 507 508 + 510: 43(f64vec2) Load 45(dvec2v) + 511: 43(f64vec2) FAdd 510 509 Store 45(dvec2v) 511 - 512: 48(fvec3) Load 50(dvec3v) - 513: 48(fvec3) Load 50(dvec3v) - 514: 48(fvec3) Load 50(dvec3v) - 515: 48(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 512 513 514 - 516: 48(fvec3) Load 50(dvec3v) - 517: 48(fvec3) FAdd 516 515 + 512: 48(f64vec3) Load 50(dvec3v) + 513: 48(f64vec3) Load 50(dvec3v) + 514: 48(f64vec3) Load 50(dvec3v) + 515: 48(f64vec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 512 513 514 + 516: 48(f64vec3) Load 50(dvec3v) + 517: 48(f64vec3) FAdd 516 515 Store 50(dvec3v) 517 - 518: 53(fvec4) Load 55(dvec4v) - 519: 53(fvec4) Load 55(dvec4v) - 520: 53(fvec4) Load 55(dvec4v) - 521: 53(fvec4) ExtInst 1(GLSL.std.450) 49(SmoothStep) 518 519 520 - 522: 53(fvec4) Load 55(dvec4v) - 523: 53(fvec4) FAdd 522 521 + 518: 53(f64vec4) Load 55(dvec4v) + 519: 53(f64vec4) Load 55(dvec4v) + 520: 53(f64vec4) Load 55(dvec4v) + 521: 53(f64vec4) ExtInst 1(GLSL.std.450) 49(SmoothStep) 518 519 520 + 522: 53(f64vec4) Load 55(dvec4v) + 523: 53(f64vec4) FAdd 522 521 Store 55(dvec4v) 523 - 524: 39(float) Load 41(doublev) - 525: 39(float) Load 41(doublev) - 526: 43(fvec2) Load 45(dvec2v) - 527: 43(fvec2) CompositeConstruct 524 524 - 528: 43(fvec2) CompositeConstruct 525 525 - 529: 43(fvec2) ExtInst 1(GLSL.std.450) 49(SmoothStep) 527 528 526 - 530: 43(fvec2) Load 45(dvec2v) - 531: 43(fvec2) FAdd 530 529 + 524:39(float64_t) Load 41(doublev) + 525:39(float64_t) Load 41(doublev) + 526: 43(f64vec2) Load 45(dvec2v) + 527: 43(f64vec2) CompositeConstruct 524 524 + 528: 43(f64vec2) CompositeConstruct 525 525 + 529: 43(f64vec2) ExtInst 1(GLSL.std.450) 49(SmoothStep) 527 528 526 + 530: 43(f64vec2) Load 45(dvec2v) + 531: 43(f64vec2) FAdd 530 529 Store 45(dvec2v) 531 - 532: 39(float) Load 41(doublev) - 533: 39(float) Load 41(doublev) - 534: 48(fvec3) Load 50(dvec3v) - 535: 48(fvec3) CompositeConstruct 532 532 532 - 536: 48(fvec3) CompositeConstruct 533 533 533 - 537: 48(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 535 536 534 - 538: 48(fvec3) Load 50(dvec3v) - 539: 48(fvec3) FAdd 538 537 + 532:39(float64_t) Load 41(doublev) + 533:39(float64_t) Load 41(doublev) + 534: 48(f64vec3) Load 50(dvec3v) + 535: 48(f64vec3) CompositeConstruct 532 532 532 + 536: 48(f64vec3) CompositeConstruct 533 533 533 + 537: 48(f64vec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 535 536 534 + 538: 48(f64vec3) Load 50(dvec3v) + 539: 48(f64vec3) FAdd 538 537 Store 50(dvec3v) 539 - 540: 39(float) Load 41(doublev) - 541: 39(float) Load 41(doublev) - 542: 53(fvec4) Load 55(dvec4v) - 543: 53(fvec4) CompositeConstruct 540 540 540 540 - 544: 53(fvec4) CompositeConstruct 541 541 541 541 - 545: 53(fvec4) ExtInst 1(GLSL.std.450) 49(SmoothStep) 543 544 542 - 546: 53(fvec4) Load 55(dvec4v) - 547: 53(fvec4) FAdd 546 545 + 540:39(float64_t) Load 41(doublev) + 541:39(float64_t) Load 41(doublev) + 542: 53(f64vec4) Load 55(dvec4v) + 543: 53(f64vec4) CompositeConstruct 540 540 540 540 + 544: 53(f64vec4) CompositeConstruct 541 541 541 541 + 545: 53(f64vec4) ExtInst 1(GLSL.std.450) 49(SmoothStep) 543 544 542 + 546: 53(f64vec4) Load 55(dvec4v) + 547: 53(f64vec4) FAdd 546 545 Store 55(dvec4v) 547 - 548: 39(float) Load 41(doublev) + 548:39(float64_t) Load 41(doublev) 549: 428(bool) IsNan 548 Store 430(boolv) 549 - 550: 43(fvec2) Load 45(dvec2v) + 550: 43(f64vec2) Load 45(dvec2v) 551: 437(bvec2) IsNan 550 Store 439(bvec2v) 551 - 552: 48(fvec3) Load 50(dvec3v) + 552: 48(f64vec3) Load 50(dvec3v) 553: 446(bvec3) IsNan 552 Store 448(bvec3v) 553 - 554: 53(fvec4) Load 55(dvec4v) + 554: 53(f64vec4) Load 55(dvec4v) 555: 455(bvec4) IsNan 554 Store 457(bvec4v) 555 - 557: 428(bool) Load 430(boolv) + 556: 428(bool) Load 430(boolv) SelectionMerge 559 None - BranchConditional 557 558 562 + BranchConditional 556 558 562 558: Label - 560: 39(float) Load 41(doublev) + 560:39(float64_t) Load 41(doublev) 561: 428(bool) IsInf 560 - Store 556 561 + Store 557 561 Branch 559 562: Label - Store 556 563 + Store 557 563 Branch 559 559: Label - 564: 428(bool) Load 556 + 564: 428(bool) Load 557 Store 430(boolv) 564 - 566: 428(bool) Load 430(boolv) + 565: 428(bool) Load 430(boolv) SelectionMerge 568 None - BranchConditional 566 567 571 + BranchConditional 565 567 571 567: Label - 569: 43(fvec2) Load 45(dvec2v) + 569: 43(f64vec2) Load 45(dvec2v) 570: 437(bvec2) IsInf 569 - Store 565 570 + Store 566 570 Branch 568 571: Label - Store 565 572 + Store 566 572 Branch 568 568: Label - 573: 437(bvec2) Load 565 + 573: 437(bvec2) Load 566 Store 439(bvec2v) 573 - 575: 428(bool) Load 430(boolv) + 574: 428(bool) Load 430(boolv) SelectionMerge 577 None - BranchConditional 575 576 580 + BranchConditional 574 576 580 576: Label - 578: 48(fvec3) Load 50(dvec3v) + 578: 48(f64vec3) Load 50(dvec3v) 579: 446(bvec3) IsInf 578 - Store 574 579 + Store 575 579 Branch 577 580: Label - Store 574 581 + Store 575 581 Branch 577 577: Label - 582: 446(bvec3) Load 574 + 582: 446(bvec3) Load 575 Store 448(bvec3v) 582 - 584: 428(bool) Load 430(boolv) + 583: 428(bool) Load 430(boolv) SelectionMerge 586 None - BranchConditional 584 585 589 + BranchConditional 583 585 589 585: Label - 587: 53(fvec4) Load 55(dvec4v) + 587: 53(f64vec4) Load 55(dvec4v) 588: 455(bvec4) IsInf 587 - Store 583 588 + Store 584 588 Branch 586 589: Label - Store 583 590 + Store 584 590 Branch 586 586: Label - 591: 455(bvec4) Load 583 + 591: 455(bvec4) Load 584 Store 457(bvec4v) 591 - 592: 39(float) Load 41(doublev) - 593: 39(float) ExtInst 1(GLSL.std.450) 66(Length) 592 - 594: 39(float) Load 41(doublev) - 595: 39(float) FAdd 594 593 + 592:39(float64_t) Load 41(doublev) + 593:39(float64_t) ExtInst 1(GLSL.std.450) 66(Length) 592 + 594:39(float64_t) Load 41(doublev) + 595:39(float64_t) FAdd 594 593 Store 41(doublev) 595 - 596: 43(fvec2) Load 45(dvec2v) - 597: 39(float) ExtInst 1(GLSL.std.450) 66(Length) 596 - 598: 39(float) Load 41(doublev) - 599: 39(float) FAdd 598 597 + 596: 43(f64vec2) Load 45(dvec2v) + 597:39(float64_t) ExtInst 1(GLSL.std.450) 66(Length) 596 + 598:39(float64_t) Load 41(doublev) + 599:39(float64_t) FAdd 598 597 Store 41(doublev) 599 - 600: 48(fvec3) Load 50(dvec3v) - 601: 39(float) ExtInst 1(GLSL.std.450) 66(Length) 600 - 602: 39(float) Load 41(doublev) - 603: 39(float) FAdd 602 601 + 600: 48(f64vec3) Load 50(dvec3v) + 601:39(float64_t) ExtInst 1(GLSL.std.450) 66(Length) 600 + 602:39(float64_t) Load 41(doublev) + 603:39(float64_t) FAdd 602 601 Store 41(doublev) 603 - 604: 53(fvec4) Load 55(dvec4v) - 605: 39(float) ExtInst 1(GLSL.std.450) 66(Length) 604 - 606: 39(float) Load 41(doublev) - 607: 39(float) FAdd 606 605 + 604: 53(f64vec4) Load 55(dvec4v) + 605:39(float64_t) ExtInst 1(GLSL.std.450) 66(Length) 604 + 606:39(float64_t) Load 41(doublev) + 607:39(float64_t) FAdd 606 605 Store 41(doublev) 607 - 608: 39(float) Load 41(doublev) - 609: 39(float) Load 41(doublev) - 610: 39(float) ExtInst 1(GLSL.std.450) 67(Distance) 608 609 - 611: 39(float) Load 41(doublev) - 612: 39(float) FAdd 611 610 + 608:39(float64_t) Load 41(doublev) + 609:39(float64_t) Load 41(doublev) + 610:39(float64_t) ExtInst 1(GLSL.std.450) 67(Distance) 608 609 + 611:39(float64_t) Load 41(doublev) + 612:39(float64_t) FAdd 611 610 Store 41(doublev) 612 - 613: 43(fvec2) Load 45(dvec2v) - 614: 43(fvec2) Load 45(dvec2v) - 615: 39(float) ExtInst 1(GLSL.std.450) 67(Distance) 613 614 - 616: 39(float) Load 41(doublev) - 617: 39(float) FAdd 616 615 + 613: 43(f64vec2) Load 45(dvec2v) + 614: 43(f64vec2) Load 45(dvec2v) + 615:39(float64_t) ExtInst 1(GLSL.std.450) 67(Distance) 613 614 + 616:39(float64_t) Load 41(doublev) + 617:39(float64_t) FAdd 616 615 Store 41(doublev) 617 - 618: 48(fvec3) Load 50(dvec3v) - 619: 48(fvec3) Load 50(dvec3v) - 620: 39(float) ExtInst 1(GLSL.std.450) 67(Distance) 618 619 - 621: 39(float) Load 41(doublev) - 622: 39(float) FAdd 621 620 + 618: 48(f64vec3) Load 50(dvec3v) + 619: 48(f64vec3) Load 50(dvec3v) + 620:39(float64_t) ExtInst 1(GLSL.std.450) 67(Distance) 618 619 + 621:39(float64_t) Load 41(doublev) + 622:39(float64_t) FAdd 621 620 Store 41(doublev) 622 - 623: 53(fvec4) Load 55(dvec4v) - 624: 53(fvec4) Load 55(dvec4v) - 625: 39(float) ExtInst 1(GLSL.std.450) 67(Distance) 623 624 - 626: 39(float) Load 41(doublev) - 627: 39(float) FAdd 626 625 + 623: 53(f64vec4) Load 55(dvec4v) + 624: 53(f64vec4) Load 55(dvec4v) + 625:39(float64_t) ExtInst 1(GLSL.std.450) 67(Distance) 623 624 + 626:39(float64_t) Load 41(doublev) + 627:39(float64_t) FAdd 626 625 Store 41(doublev) 627 - 628: 39(float) Load 41(doublev) - 629: 39(float) Load 41(doublev) - 630: 39(float) FMul 628 629 - 631: 39(float) Load 41(doublev) - 632: 39(float) FAdd 631 630 + 628:39(float64_t) Load 41(doublev) + 629:39(float64_t) Load 41(doublev) + 630:39(float64_t) FMul 628 629 + 631:39(float64_t) Load 41(doublev) + 632:39(float64_t) FAdd 631 630 Store 41(doublev) 632 - 633: 43(fvec2) Load 45(dvec2v) - 634: 43(fvec2) Load 45(dvec2v) - 635: 39(float) Dot 633 634 - 636: 39(float) Load 41(doublev) - 637: 39(float) FAdd 636 635 + 633: 43(f64vec2) Load 45(dvec2v) + 634: 43(f64vec2) Load 45(dvec2v) + 635:39(float64_t) Dot 633 634 + 636:39(float64_t) Load 41(doublev) + 637:39(float64_t) FAdd 636 635 Store 41(doublev) 637 - 638: 48(fvec3) Load 50(dvec3v) - 639: 48(fvec3) Load 50(dvec3v) - 640: 39(float) Dot 638 639 - 641: 39(float) Load 41(doublev) - 642: 39(float) FAdd 641 640 + 638: 48(f64vec3) Load 50(dvec3v) + 639: 48(f64vec3) Load 50(dvec3v) + 640:39(float64_t) Dot 638 639 + 641:39(float64_t) Load 41(doublev) + 642:39(float64_t) FAdd 641 640 Store 41(doublev) 642 - 643: 53(fvec4) Load 55(dvec4v) - 644: 53(fvec4) Load 55(dvec4v) - 645: 39(float) Dot 643 644 - 646: 39(float) Load 41(doublev) - 647: 39(float) FAdd 646 645 + 643: 53(f64vec4) Load 55(dvec4v) + 644: 53(f64vec4) Load 55(dvec4v) + 645:39(float64_t) Dot 643 644 + 646:39(float64_t) Load 41(doublev) + 647:39(float64_t) FAdd 646 645 Store 41(doublev) 647 - 648: 48(fvec3) Load 50(dvec3v) - 649: 48(fvec3) Load 50(dvec3v) - 650: 48(fvec3) ExtInst 1(GLSL.std.450) 68(Cross) 648 649 - 651: 48(fvec3) Load 50(dvec3v) - 652: 48(fvec3) FAdd 651 650 + 648: 48(f64vec3) Load 50(dvec3v) + 649: 48(f64vec3) Load 50(dvec3v) + 650: 48(f64vec3) ExtInst 1(GLSL.std.450) 68(Cross) 648 649 + 651: 48(f64vec3) Load 50(dvec3v) + 652: 48(f64vec3) FAdd 651 650 Store 50(dvec3v) 652 - 653: 39(float) Load 41(doublev) - 654: 39(float) ExtInst 1(GLSL.std.450) 69(Normalize) 653 - 655: 39(float) Load 41(doublev) - 656: 39(float) FAdd 655 654 + 653:39(float64_t) Load 41(doublev) + 654:39(float64_t) ExtInst 1(GLSL.std.450) 69(Normalize) 653 + 655:39(float64_t) Load 41(doublev) + 656:39(float64_t) FAdd 655 654 Store 41(doublev) 656 - 657: 43(fvec2) Load 45(dvec2v) - 658: 43(fvec2) ExtInst 1(GLSL.std.450) 69(Normalize) 657 - 659: 43(fvec2) Load 45(dvec2v) - 660: 43(fvec2) FAdd 659 658 + 657: 43(f64vec2) Load 45(dvec2v) + 658: 43(f64vec2) ExtInst 1(GLSL.std.450) 69(Normalize) 657 + 659: 43(f64vec2) Load 45(dvec2v) + 660: 43(f64vec2) FAdd 659 658 Store 45(dvec2v) 660 - 661: 48(fvec3) Load 50(dvec3v) - 662: 48(fvec3) ExtInst 1(GLSL.std.450) 69(Normalize) 661 - 663: 48(fvec3) Load 50(dvec3v) - 664: 48(fvec3) FAdd 663 662 + 661: 48(f64vec3) Load 50(dvec3v) + 662: 48(f64vec3) ExtInst 1(GLSL.std.450) 69(Normalize) 661 + 663: 48(f64vec3) Load 50(dvec3v) + 664: 48(f64vec3) FAdd 663 662 Store 50(dvec3v) 664 - 665: 53(fvec4) Load 55(dvec4v) - 666: 53(fvec4) ExtInst 1(GLSL.std.450) 69(Normalize) 665 - 667: 53(fvec4) Load 55(dvec4v) - 668: 53(fvec4) FAdd 667 666 + 665: 53(f64vec4) Load 55(dvec4v) + 666: 53(f64vec4) ExtInst 1(GLSL.std.450) 69(Normalize) 665 + 667: 53(f64vec4) Load 55(dvec4v) + 668: 53(f64vec4) FAdd 667 666 Store 55(dvec4v) 668 - 669: 39(float) Load 41(doublev) - 670: 39(float) Load 41(doublev) - 671: 39(float) Load 41(doublev) - 672: 39(float) ExtInst 1(GLSL.std.450) 70(FaceForward) 669 670 671 - 673: 39(float) Load 41(doublev) - 674: 39(float) FAdd 673 672 + 669:39(float64_t) Load 41(doublev) + 670:39(float64_t) Load 41(doublev) + 671:39(float64_t) Load 41(doublev) + 672:39(float64_t) ExtInst 1(GLSL.std.450) 70(FaceForward) 669 670 671 + 673:39(float64_t) Load 41(doublev) + 674:39(float64_t) FAdd 673 672 Store 41(doublev) 674 - 675: 43(fvec2) Load 45(dvec2v) - 676: 43(fvec2) Load 45(dvec2v) - 677: 43(fvec2) Load 45(dvec2v) - 678: 43(fvec2) ExtInst 1(GLSL.std.450) 70(FaceForward) 675 676 677 - 679: 43(fvec2) Load 45(dvec2v) - 680: 43(fvec2) FAdd 679 678 + 675: 43(f64vec2) Load 45(dvec2v) + 676: 43(f64vec2) Load 45(dvec2v) + 677: 43(f64vec2) Load 45(dvec2v) + 678: 43(f64vec2) ExtInst 1(GLSL.std.450) 70(FaceForward) 675 676 677 + 679: 43(f64vec2) Load 45(dvec2v) + 680: 43(f64vec2) FAdd 679 678 Store 45(dvec2v) 680 - 681: 48(fvec3) Load 50(dvec3v) - 682: 48(fvec3) Load 50(dvec3v) - 683: 48(fvec3) Load 50(dvec3v) - 684: 48(fvec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 681 682 683 - 685: 48(fvec3) Load 50(dvec3v) - 686: 48(fvec3) FAdd 685 684 + 681: 48(f64vec3) Load 50(dvec3v) + 682: 48(f64vec3) Load 50(dvec3v) + 683: 48(f64vec3) Load 50(dvec3v) + 684: 48(f64vec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 681 682 683 + 685: 48(f64vec3) Load 50(dvec3v) + 686: 48(f64vec3) FAdd 685 684 Store 50(dvec3v) 686 - 687: 53(fvec4) Load 55(dvec4v) - 688: 53(fvec4) Load 55(dvec4v) - 689: 53(fvec4) Load 55(dvec4v) - 690: 53(fvec4) ExtInst 1(GLSL.std.450) 70(FaceForward) 687 688 689 - 691: 53(fvec4) Load 55(dvec4v) - 692: 53(fvec4) FAdd 691 690 + 687: 53(f64vec4) Load 55(dvec4v) + 688: 53(f64vec4) Load 55(dvec4v) + 689: 53(f64vec4) Load 55(dvec4v) + 690: 53(f64vec4) ExtInst 1(GLSL.std.450) 70(FaceForward) 687 688 689 + 691: 53(f64vec4) Load 55(dvec4v) + 692: 53(f64vec4) FAdd 691 690 Store 55(dvec4v) 692 - 693: 39(float) Load 41(doublev) - 694: 39(float) Load 41(doublev) - 695: 39(float) ExtInst 1(GLSL.std.450) 71(Reflect) 693 694 - 696: 39(float) Load 41(doublev) - 697: 39(float) FAdd 696 695 + 693:39(float64_t) Load 41(doublev) + 694:39(float64_t) Load 41(doublev) + 695:39(float64_t) ExtInst 1(GLSL.std.450) 71(Reflect) 693 694 + 696:39(float64_t) Load 41(doublev) + 697:39(float64_t) FAdd 696 695 Store 41(doublev) 697 - 698: 43(fvec2) Load 45(dvec2v) - 699: 43(fvec2) Load 45(dvec2v) - 700: 43(fvec2) ExtInst 1(GLSL.std.450) 71(Reflect) 698 699 - 701: 43(fvec2) Load 45(dvec2v) - 702: 43(fvec2) FAdd 701 700 + 698: 43(f64vec2) Load 45(dvec2v) + 699: 43(f64vec2) Load 45(dvec2v) + 700: 43(f64vec2) ExtInst 1(GLSL.std.450) 71(Reflect) 698 699 + 701: 43(f64vec2) Load 45(dvec2v) + 702: 43(f64vec2) FAdd 701 700 Store 45(dvec2v) 702 - 703: 48(fvec3) Load 50(dvec3v) - 704: 48(fvec3) Load 50(dvec3v) - 705: 48(fvec3) ExtInst 1(GLSL.std.450) 71(Reflect) 703 704 - 706: 48(fvec3) Load 50(dvec3v) - 707: 48(fvec3) FAdd 706 705 + 703: 48(f64vec3) Load 50(dvec3v) + 704: 48(f64vec3) Load 50(dvec3v) + 705: 48(f64vec3) ExtInst 1(GLSL.std.450) 71(Reflect) 703 704 + 706: 48(f64vec3) Load 50(dvec3v) + 707: 48(f64vec3) FAdd 706 705 Store 50(dvec3v) 707 - 708: 53(fvec4) Load 55(dvec4v) - 709: 53(fvec4) Load 55(dvec4v) - 710: 53(fvec4) ExtInst 1(GLSL.std.450) 71(Reflect) 708 709 - 711: 53(fvec4) Load 55(dvec4v) - 712: 53(fvec4) FAdd 711 710 + 708: 53(f64vec4) Load 55(dvec4v) + 709: 53(f64vec4) Load 55(dvec4v) + 710: 53(f64vec4) ExtInst 1(GLSL.std.450) 71(Reflect) 708 709 + 711: 53(f64vec4) Load 55(dvec4v) + 712: 53(f64vec4) FAdd 711 710 Store 55(dvec4v) 712 - 713: 39(float) Load 41(doublev) - 714: 39(float) Load 41(doublev) - 715: 39(float) Load 41(doublev) - 716: 39(float) ExtInst 1(GLSL.std.450) 72(Refract) 713 714 715 - 717: 39(float) Load 41(doublev) - 718: 39(float) FAdd 717 716 + 713:39(float64_t) Load 41(doublev) + 714:39(float64_t) Load 41(doublev) + 715:39(float64_t) Load 41(doublev) + 716:39(float64_t) ExtInst 1(GLSL.std.450) 72(Refract) 713 714 715 + 717:39(float64_t) Load 41(doublev) + 718:39(float64_t) FAdd 717 716 Store 41(doublev) 718 - 719: 43(fvec2) Load 45(dvec2v) - 720: 43(fvec2) Load 45(dvec2v) - 721: 39(float) Load 41(doublev) - 722: 43(fvec2) ExtInst 1(GLSL.std.450) 72(Refract) 719 720 721 - 723: 43(fvec2) Load 45(dvec2v) - 724: 43(fvec2) FAdd 723 722 + 719: 43(f64vec2) Load 45(dvec2v) + 720: 43(f64vec2) Load 45(dvec2v) + 721:39(float64_t) Load 41(doublev) + 722: 43(f64vec2) ExtInst 1(GLSL.std.450) 72(Refract) 719 720 721 + 723: 43(f64vec2) Load 45(dvec2v) + 724: 43(f64vec2) FAdd 723 722 Store 45(dvec2v) 724 - 725: 48(fvec3) Load 50(dvec3v) - 726: 48(fvec3) Load 50(dvec3v) - 727: 39(float) Load 41(doublev) - 728: 48(fvec3) ExtInst 1(GLSL.std.450) 72(Refract) 725 726 727 - 729: 48(fvec3) Load 50(dvec3v) - 730: 48(fvec3) FAdd 729 728 + 725: 48(f64vec3) Load 50(dvec3v) + 726: 48(f64vec3) Load 50(dvec3v) + 727:39(float64_t) Load 41(doublev) + 728: 48(f64vec3) ExtInst 1(GLSL.std.450) 72(Refract) 725 726 727 + 729: 48(f64vec3) Load 50(dvec3v) + 730: 48(f64vec3) FAdd 729 728 Store 50(dvec3v) 730 - 731: 53(fvec4) Load 55(dvec4v) - 732: 53(fvec4) Load 55(dvec4v) - 733: 39(float) Load 41(doublev) - 734: 53(fvec4) ExtInst 1(GLSL.std.450) 72(Refract) 731 732 733 - 735: 53(fvec4) Load 55(dvec4v) - 736: 53(fvec4) FAdd 735 734 + 731: 53(f64vec4) Load 55(dvec4v) + 732: 53(f64vec4) Load 55(dvec4v) + 733:39(float64_t) Load 41(doublev) + 734: 53(f64vec4) ExtInst 1(GLSL.std.450) 72(Refract) 731 732 733 + 735: 53(f64vec4) Load 55(dvec4v) + 736: 53(f64vec4) FAdd 735 734 Store 55(dvec4v) 736 - 740: 43(fvec2) Load 45(dvec2v) - 741: 43(fvec2) Load 45(dvec2v) + 740: 43(f64vec2) Load 45(dvec2v) + 741: 43(f64vec2) Load 45(dvec2v) 742: 737 OuterProduct 740 741 Store 739(dmat2v) 742 - 746: 48(fvec3) Load 50(dvec3v) - 747: 48(fvec3) Load 50(dvec3v) + 746: 48(f64vec3) Load 50(dvec3v) + 747: 48(f64vec3) Load 50(dvec3v) 748: 743 OuterProduct 746 747 Store 745(dmat3v) 748 - 752: 53(fvec4) Load 55(dvec4v) - 753: 53(fvec4) Load 55(dvec4v) + 752: 53(f64vec4) Load 55(dvec4v) + 753: 53(f64vec4) Load 55(dvec4v) 754: 749 OuterProduct 752 753 Store 751(dmat4v) 754 - 758: 48(fvec3) Load 50(dvec3v) - 759: 43(fvec2) Load 45(dvec2v) + 758: 48(f64vec3) Load 50(dvec3v) + 759: 43(f64vec2) Load 45(dvec2v) 760: 755 OuterProduct 758 759 Store 757(dmat2x3v) 760 - 764: 43(fvec2) Load 45(dvec2v) - 765: 48(fvec3) Load 50(dvec3v) + 764: 43(f64vec2) Load 45(dvec2v) + 765: 48(f64vec3) Load 50(dvec3v) 766: 761 OuterProduct 764 765 Store 763(dmat3x2v) 766 - 770: 53(fvec4) Load 55(dvec4v) - 771: 43(fvec2) Load 45(dvec2v) + 770: 53(f64vec4) Load 55(dvec4v) + 771: 43(f64vec2) Load 45(dvec2v) 772: 767 OuterProduct 770 771 Store 769(dmat2x4v) 772 - 776: 43(fvec2) Load 45(dvec2v) - 777: 53(fvec4) Load 55(dvec4v) + 776: 43(f64vec2) Load 45(dvec2v) + 777: 53(f64vec4) Load 55(dvec4v) 778: 773 OuterProduct 776 777 Store 775(dmat4x2v) 778 - 782: 53(fvec4) Load 55(dvec4v) - 783: 48(fvec3) Load 50(dvec3v) + 782: 53(f64vec4) Load 55(dvec4v) + 783: 48(f64vec3) Load 50(dvec3v) 784: 779 OuterProduct 782 783 Store 781(dmat3x4v) 784 - 788: 48(fvec3) Load 50(dvec3v) - 789: 53(fvec4) Load 55(dvec4v) + 788: 48(f64vec3) Load 50(dvec3v) + 789: 53(f64vec4) Load 55(dvec4v) 790: 785 OuterProduct 788 789 Store 787(dmat4x3v) 790 791: 737 Load 739(dmat2v) 792: 737 Load 739(dmat2v) - 793: 43(fvec2) CompositeExtract 791 0 - 794: 43(fvec2) CompositeExtract 792 0 - 795: 43(fvec2) FMul 793 794 - 796: 43(fvec2) CompositeExtract 791 1 - 797: 43(fvec2) CompositeExtract 792 1 - 798: 43(fvec2) FMul 796 797 + 793: 43(f64vec2) CompositeExtract 791 0 + 794: 43(f64vec2) CompositeExtract 792 0 + 795: 43(f64vec2) FMul 793 794 + 796: 43(f64vec2) CompositeExtract 791 1 + 797: 43(f64vec2) CompositeExtract 792 1 + 798: 43(f64vec2) FMul 796 797 799: 737 CompositeConstruct 795 798 800: 737 Load 739(dmat2v) 801: 737 MatrixTimesMatrix 800 799 Store 739(dmat2v) 801 802: 743 Load 745(dmat3v) 803: 743 Load 745(dmat3v) - 804: 48(fvec3) CompositeExtract 802 0 - 805: 48(fvec3) CompositeExtract 803 0 - 806: 48(fvec3) FMul 804 805 - 807: 48(fvec3) CompositeExtract 802 1 - 808: 48(fvec3) CompositeExtract 803 1 - 809: 48(fvec3) FMul 807 808 - 810: 48(fvec3) CompositeExtract 802 2 - 811: 48(fvec3) CompositeExtract 803 2 - 812: 48(fvec3) FMul 810 811 + 804: 48(f64vec3) CompositeExtract 802 0 + 805: 48(f64vec3) CompositeExtract 803 0 + 806: 48(f64vec3) FMul 804 805 + 807: 48(f64vec3) CompositeExtract 802 1 + 808: 48(f64vec3) CompositeExtract 803 1 + 809: 48(f64vec3) FMul 807 808 + 810: 48(f64vec3) CompositeExtract 802 2 + 811: 48(f64vec3) CompositeExtract 803 2 + 812: 48(f64vec3) FMul 810 811 813: 743 CompositeConstruct 806 809 812 814: 743 Load 745(dmat3v) 815: 743 MatrixTimesMatrix 814 813 Store 745(dmat3v) 815 816: 749 Load 751(dmat4v) 817: 749 Load 751(dmat4v) - 818: 53(fvec4) CompositeExtract 816 0 - 819: 53(fvec4) CompositeExtract 817 0 - 820: 53(fvec4) FMul 818 819 - 821: 53(fvec4) CompositeExtract 816 1 - 822: 53(fvec4) CompositeExtract 817 1 - 823: 53(fvec4) FMul 821 822 - 824: 53(fvec4) CompositeExtract 816 2 - 825: 53(fvec4) CompositeExtract 817 2 - 826: 53(fvec4) FMul 824 825 - 827: 53(fvec4) CompositeExtract 816 3 - 828: 53(fvec4) CompositeExtract 817 3 - 829: 53(fvec4) FMul 827 828 + 818: 53(f64vec4) CompositeExtract 816 0 + 819: 53(f64vec4) CompositeExtract 817 0 + 820: 53(f64vec4) FMul 818 819 + 821: 53(f64vec4) CompositeExtract 816 1 + 822: 53(f64vec4) CompositeExtract 817 1 + 823: 53(f64vec4) FMul 821 822 + 824: 53(f64vec4) CompositeExtract 816 2 + 825: 53(f64vec4) CompositeExtract 817 2 + 826: 53(f64vec4) FMul 824 825 + 827: 53(f64vec4) CompositeExtract 816 3 + 828: 53(f64vec4) CompositeExtract 817 3 + 829: 53(f64vec4) FMul 827 828 830: 749 CompositeConstruct 820 823 826 829 831: 749 Load 751(dmat4v) 832: 749 MatrixTimesMatrix 831 830 Store 751(dmat4v) 832 833: 755 Load 757(dmat2x3v) 834: 755 Load 757(dmat2x3v) - 835: 48(fvec3) CompositeExtract 833 0 - 836: 48(fvec3) CompositeExtract 834 0 - 837: 48(fvec3) FMul 835 836 - 838: 48(fvec3) CompositeExtract 833 1 - 839: 48(fvec3) CompositeExtract 834 1 - 840: 48(fvec3) FMul 838 839 + 835: 48(f64vec3) CompositeExtract 833 0 + 836: 48(f64vec3) CompositeExtract 834 0 + 837: 48(f64vec3) FMul 835 836 + 838: 48(f64vec3) CompositeExtract 833 1 + 839: 48(f64vec3) CompositeExtract 834 1 + 840: 48(f64vec3) FMul 838 839 841: 755 CompositeConstruct 837 840 Store 757(dmat2x3v) 841 842: 767 Load 769(dmat2x4v) 843: 767 Load 769(dmat2x4v) - 844: 53(fvec4) CompositeExtract 842 0 - 845: 53(fvec4) CompositeExtract 843 0 - 846: 53(fvec4) FMul 844 845 - 847: 53(fvec4) CompositeExtract 842 1 - 848: 53(fvec4) CompositeExtract 843 1 - 849: 53(fvec4) FMul 847 848 + 844: 53(f64vec4) CompositeExtract 842 0 + 845: 53(f64vec4) CompositeExtract 843 0 + 846: 53(f64vec4) FMul 844 845 + 847: 53(f64vec4) CompositeExtract 842 1 + 848: 53(f64vec4) CompositeExtract 843 1 + 849: 53(f64vec4) FMul 847 848 850: 767 CompositeConstruct 846 849 Store 769(dmat2x4v) 850 851: 761 Load 763(dmat3x2v) 852: 761 Load 763(dmat3x2v) - 853: 43(fvec2) CompositeExtract 851 0 - 854: 43(fvec2) CompositeExtract 852 0 - 855: 43(fvec2) FMul 853 854 - 856: 43(fvec2) CompositeExtract 851 1 - 857: 43(fvec2) CompositeExtract 852 1 - 858: 43(fvec2) FMul 856 857 - 859: 43(fvec2) CompositeExtract 851 2 - 860: 43(fvec2) CompositeExtract 852 2 - 861: 43(fvec2) FMul 859 860 + 853: 43(f64vec2) CompositeExtract 851 0 + 854: 43(f64vec2) CompositeExtract 852 0 + 855: 43(f64vec2) FMul 853 854 + 856: 43(f64vec2) CompositeExtract 851 1 + 857: 43(f64vec2) CompositeExtract 852 1 + 858: 43(f64vec2) FMul 856 857 + 859: 43(f64vec2) CompositeExtract 851 2 + 860: 43(f64vec2) CompositeExtract 852 2 + 861: 43(f64vec2) FMul 859 860 862: 761 CompositeConstruct 855 858 861 Store 763(dmat3x2v) 862 863: 779 Load 781(dmat3x4v) 864: 779 Load 781(dmat3x4v) - 865: 53(fvec4) CompositeExtract 863 0 - 866: 53(fvec4) CompositeExtract 864 0 - 867: 53(fvec4) FMul 865 866 - 868: 53(fvec4) CompositeExtract 863 1 - 869: 53(fvec4) CompositeExtract 864 1 - 870: 53(fvec4) FMul 868 869 - 871: 53(fvec4) CompositeExtract 863 2 - 872: 53(fvec4) CompositeExtract 864 2 - 873: 53(fvec4) FMul 871 872 + 865: 53(f64vec4) CompositeExtract 863 0 + 866: 53(f64vec4) CompositeExtract 864 0 + 867: 53(f64vec4) FMul 865 866 + 868: 53(f64vec4) CompositeExtract 863 1 + 869: 53(f64vec4) CompositeExtract 864 1 + 870: 53(f64vec4) FMul 868 869 + 871: 53(f64vec4) CompositeExtract 863 2 + 872: 53(f64vec4) CompositeExtract 864 2 + 873: 53(f64vec4) FMul 871 872 874: 779 CompositeConstruct 867 870 873 Store 781(dmat3x4v) 874 875: 773 Load 775(dmat4x2v) 876: 773 Load 775(dmat4x2v) - 877: 43(fvec2) CompositeExtract 875 0 - 878: 43(fvec2) CompositeExtract 876 0 - 879: 43(fvec2) FMul 877 878 - 880: 43(fvec2) CompositeExtract 875 1 - 881: 43(fvec2) CompositeExtract 876 1 - 882: 43(fvec2) FMul 880 881 - 883: 43(fvec2) CompositeExtract 875 2 - 884: 43(fvec2) CompositeExtract 876 2 - 885: 43(fvec2) FMul 883 884 - 886: 43(fvec2) CompositeExtract 875 3 - 887: 43(fvec2) CompositeExtract 876 3 - 888: 43(fvec2) FMul 886 887 + 877: 43(f64vec2) CompositeExtract 875 0 + 878: 43(f64vec2) CompositeExtract 876 0 + 879: 43(f64vec2) FMul 877 878 + 880: 43(f64vec2) CompositeExtract 875 1 + 881: 43(f64vec2) CompositeExtract 876 1 + 882: 43(f64vec2) FMul 880 881 + 883: 43(f64vec2) CompositeExtract 875 2 + 884: 43(f64vec2) CompositeExtract 876 2 + 885: 43(f64vec2) FMul 883 884 + 886: 43(f64vec2) CompositeExtract 875 3 + 887: 43(f64vec2) CompositeExtract 876 3 + 888: 43(f64vec2) FMul 886 887 889: 773 CompositeConstruct 879 882 885 888 Store 775(dmat4x2v) 889 890: 785 Load 787(dmat4x3v) 891: 785 Load 787(dmat4x3v) - 892: 48(fvec3) CompositeExtract 890 0 - 893: 48(fvec3) CompositeExtract 891 0 - 894: 48(fvec3) FMul 892 893 - 895: 48(fvec3) CompositeExtract 890 1 - 896: 48(fvec3) CompositeExtract 891 1 - 897: 48(fvec3) FMul 895 896 - 898: 48(fvec3) CompositeExtract 890 2 - 899: 48(fvec3) CompositeExtract 891 2 - 900: 48(fvec3) FMul 898 899 - 901: 48(fvec3) CompositeExtract 890 3 - 902: 48(fvec3) CompositeExtract 891 3 - 903: 48(fvec3) FMul 901 902 + 892: 48(f64vec3) CompositeExtract 890 0 + 893: 48(f64vec3) CompositeExtract 891 0 + 894: 48(f64vec3) FMul 892 893 + 895: 48(f64vec3) CompositeExtract 890 1 + 896: 48(f64vec3) CompositeExtract 891 1 + 897: 48(f64vec3) FMul 895 896 + 898: 48(f64vec3) CompositeExtract 890 2 + 899: 48(f64vec3) CompositeExtract 891 2 + 900: 48(f64vec3) FMul 898 899 + 901: 48(f64vec3) CompositeExtract 890 3 + 902: 48(f64vec3) CompositeExtract 891 3 + 903: 48(f64vec3) FMul 901 902 904: 785 CompositeConstruct 894 897 900 903 Store 787(dmat4x3v) 904 905: 737 Load 739(dmat2v) @@ -1298,19 +1302,19 @@ spv.400.frag 928: 785 Transpose 927 Store 787(dmat4x3v) 928 929: 737 Load 739(dmat2v) - 930: 39(float) ExtInst 1(GLSL.std.450) 33(Determinant) 929 - 931: 39(float) Load 41(doublev) - 932: 39(float) FAdd 931 930 + 930:39(float64_t) ExtInst 1(GLSL.std.450) 33(Determinant) 929 + 931:39(float64_t) Load 41(doublev) + 932:39(float64_t) FAdd 931 930 Store 41(doublev) 932 933: 743 Load 745(dmat3v) - 934: 39(float) ExtInst 1(GLSL.std.450) 33(Determinant) 933 - 935: 39(float) Load 41(doublev) - 936: 39(float) FAdd 935 934 + 934:39(float64_t) ExtInst 1(GLSL.std.450) 33(Determinant) 933 + 935:39(float64_t) Load 41(doublev) + 936:39(float64_t) FAdd 935 934 Store 41(doublev) 936 937: 749 Load 751(dmat4v) - 938: 39(float) ExtInst 1(GLSL.std.450) 33(Determinant) 937 - 939: 39(float) Load 41(doublev) - 940: 39(float) FAdd 939 938 + 938:39(float64_t) ExtInst 1(GLSL.std.450) 33(Determinant) 937 + 939:39(float64_t) Load 41(doublev) + 940:39(float64_t) FAdd 939 938 Store 41(doublev) 940 941: 737 Load 739(dmat2v) 942: 737 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 941 @@ -1327,62 +1331,62 @@ spv.400.frag 951: 749 Load 751(dmat4v) 952: 749 MatrixTimesMatrix 951 950 Store 751(dmat4v) 952 - 953: 39(float) Load 41(doublev) + 953:39(float64_t) Load 41(doublev) 955: 40(ptr) AccessChain 45(dvec2v) 954 - 956: 39(float) Load 955 - 957: 39(float) FAdd 953 956 + 956:39(float64_t) Load 955 + 957:39(float64_t) FAdd 953 956 959: 40(ptr) AccessChain 50(dvec3v) 958 - 960: 39(float) Load 959 - 961: 39(float) FAdd 957 960 + 960:39(float64_t) Load 959 + 961:39(float64_t) FAdd 957 960 963: 40(ptr) AccessChain 55(dvec4v) 962 - 964: 39(float) Load 963 - 965: 39(float) FAdd 961 964 + 964:39(float64_t) Load 963 + 965:39(float64_t) FAdd 961 964 967: 40(ptr) AccessChain 739(dmat2v) 966 954 - 968: 39(float) Load 967 - 969: 39(float) FAdd 965 968 + 968:39(float64_t) Load 967 + 969:39(float64_t) FAdd 965 968 971: 40(ptr) AccessChain 745(dmat3v) 970 958 - 972: 39(float) Load 971 - 973: 39(float) FAdd 969 972 + 972:39(float64_t) Load 971 + 973:39(float64_t) FAdd 969 972 974: 40(ptr) AccessChain 751(dmat4v) 25 962 - 975: 39(float) Load 974 - 976: 39(float) FAdd 973 975 + 975:39(float64_t) Load 974 + 976:39(float64_t) FAdd 973 975 977: 40(ptr) AccessChain 757(dmat2x3v) 966 954 - 978: 39(float) Load 977 - 979: 39(float) FAdd 976 978 + 978:39(float64_t) Load 977 + 979:39(float64_t) FAdd 976 978 980: 40(ptr) AccessChain 763(dmat3x2v) 966 954 - 981: 39(float) Load 980 - 982: 39(float) FAdd 979 981 + 981:39(float64_t) Load 980 + 982:39(float64_t) FAdd 979 981 983: 40(ptr) AccessChain 781(dmat3x4v) 970 958 - 984: 39(float) Load 983 - 985: 39(float) FAdd 982 984 + 984:39(float64_t) Load 983 + 985:39(float64_t) FAdd 982 984 986: 40(ptr) AccessChain 787(dmat4x3v) 970 958 - 987: 39(float) Load 986 - 988: 39(float) FAdd 985 987 + 987:39(float64_t) Load 986 + 988:39(float64_t) FAdd 985 987 989: 40(ptr) AccessChain 769(dmat2x4v) 966 954 - 990: 39(float) Load 989 - 991: 39(float) FAdd 988 990 + 990:39(float64_t) Load 989 + 991:39(float64_t) FAdd 988 990 992: 40(ptr) AccessChain 775(dmat4x2v) 966 954 - 993: 39(float) Load 992 - 994: 39(float) FAdd 991 993 + 993:39(float64_t) Load 992 + 994:39(float64_t) FAdd 991 993 995: 428(bool) Load 430(boolv) 997: 10(float) Select 995 996 21 - 998: 39(float) FConvert 997 - 999: 39(float) FAdd 994 998 - 1000: 437(bvec2) Load 439(bvec2v) - 1001: 428(bool) CompositeExtract 1000 0 + 998:39(float64_t) FConvert 997 + 999:39(float64_t) FAdd 994 998 + 1000: 429(ptr) AccessChain 439(bvec2v) 33 + 1001: 428(bool) Load 1000 1002: 10(float) Select 1001 996 21 - 1003: 39(float) FConvert 1002 - 1004: 39(float) FAdd 999 1003 - 1005: 446(bvec3) Load 448(bvec3v) - 1006: 428(bool) CompositeExtract 1005 0 + 1003:39(float64_t) FConvert 1002 + 1004:39(float64_t) FAdd 999 1003 + 1005: 429(ptr) AccessChain 448(bvec3v) 33 + 1006: 428(bool) Load 1005 1007: 10(float) Select 1006 996 21 - 1008: 39(float) FConvert 1007 - 1009: 39(float) FAdd 1004 1008 - 1010: 455(bvec4) Load 457(bvec4v) - 1011: 428(bool) CompositeExtract 1010 0 + 1008:39(float64_t) FConvert 1007 + 1009:39(float64_t) FAdd 1004 1008 + 1010: 429(ptr) AccessChain 457(bvec4v) 33 + 1011: 428(bool) Load 1010 1012: 10(float) Select 1011 996 21 - 1013: 39(float) FConvert 1012 - 1014: 39(float) FAdd 1009 1013 + 1013:39(float64_t) FConvert 1012 + 1014:39(float64_t) FAdd 1009 1013 1015: 10(float) FConvert 1014 1016: 11(fvec4) Load 13(outp) 1017: 11(fvec4) VectorTimesScalar 1016 1015 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tesc.out index 5b6a6b1ad06..ce7c3afa4b8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tesc.out @@ -1,14 +1,14 @@ spv.400.tesc // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 93 +// Generated by (magic number): 80007 +// Id's are bound by 92 Capability Tessellation Capability TessellationPointSize Capability ClipDistance 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 4 "main" 24 41 44 47 54 68 73 79 83 84 87 88 91 92 + EntryPoint TessellationControl 4 "main" 24 41 44 47 53 67 72 78 82 83 86 87 90 91 ExecutionMode 4 OutputVertices 4 Source GLSL 400 SourceExtension "GL_ARB_separate_shader_objects" @@ -32,17 +32,17 @@ spv.400.tesc MemberName 50(gl_PerVertex) 0 "gl_Position" MemberName 50(gl_PerVertex) 1 "gl_PointSize" MemberName 50(gl_PerVertex) 2 "gl_ClipDistance" - Name 54 "gl_out" - Name 68 "gl_TessLevelOuter" - Name 73 "gl_TessLevelInner" - Name 78 "outa" - Name 79 "patchOut" - Name 83 "inb" - Name 84 "ind" - Name 87 "ivla" - Name 88 "ivlb" - Name 91 "ovla" - Name 92 "ovlb" + Name 53 "gl_out" + Name 67 "gl_TessLevelOuter" + Name 72 "gl_TessLevelInner" + Name 77 "outa" + Name 78 "patchOut" + Name 82 "inb" + Name 83 "ind" + Name 86 "ivla" + Name 87 "ivlb" + Name 90 "ovla" + Name 91 "ovlb" MemberDecorate 20(gl_PerVertex) 0 BuiltIn Position MemberDecorate 20(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 20(gl_PerVertex) 2 BuiltIn ClipDistance @@ -54,20 +54,20 @@ spv.400.tesc MemberDecorate 50(gl_PerVertex) 1 BuiltIn PointSize MemberDecorate 50(gl_PerVertex) 2 BuiltIn ClipDistance Decorate 50(gl_PerVertex) Block - Decorate 68(gl_TessLevelOuter) Patch - Decorate 68(gl_TessLevelOuter) BuiltIn TessLevelOuter - Decorate 73(gl_TessLevelInner) Patch - Decorate 73(gl_TessLevelInner) BuiltIn TessLevelInner - Decorate 79(patchOut) Patch - Decorate 87(ivla) Location 3 - Decorate 88(ivlb) Location 4 - Decorate 91(ovla) Location 3 - Decorate 92(ovlb) Location 4 + Decorate 67(gl_TessLevelOuter) Patch + Decorate 67(gl_TessLevelOuter) BuiltIn TessLevelOuter + Decorate 72(gl_TessLevelInner) Patch + Decorate 72(gl_TessLevelInner) BuiltIn TessLevelInner + Decorate 78(patchOut) Patch + Decorate 86(ivla) Location 3 + Decorate 87(ivlb) Location 4 + Decorate 90(ovla) Location 3 + Decorate 91(ovlb) Location 4 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 7: 6(int) Constant 2 - 8: 6(int) Constant 1 + 8: 6(int) Constant 4 9: 6(int) Constant 0 10: TypeInt 32 1 11: TypePointer Function 10(int) @@ -94,37 +94,36 @@ spv.400.tesc 47(gl_InvocationID): 40(ptr) Variable Input 49: TypeArray 14(float) 7 50(gl_PerVertex): TypeStruct 15(fvec4) 14(float) 49 - 51: 6(int) Constant 4 - 52: TypeArray 50(gl_PerVertex) 51 - 53: TypePointer Output 52 - 54(gl_out): 53(ptr) Variable Output - 57: TypePointer Output 15(fvec4) - 61: TypePointer Output 14(float) - 66: TypeArray 14(float) 51 - 67: TypePointer Output 66 -68(gl_TessLevelOuter): 67(ptr) Variable Output - 69: 10(int) Constant 3 - 70: 14(float) Constant 1078774989 - 72: TypePointer Output 49 -73(gl_TessLevelInner): 72(ptr) Variable Output - 74: 14(float) Constant 1067869798 - 76: TypeArray 10(int) 51 - 77: TypePointer Private 76 - 78(outa): 77(ptr) Variable Private - 79(patchOut): 57(ptr) Variable Output - 80: TypeVector 14(float) 2 - 81: TypeArray 80(fvec2) 21 - 82: TypePointer Input 81 - 83(inb): 82(ptr) Variable Input - 84(ind): 82(ptr) Variable Input - 85: TypeArray 15(fvec4) 21 - 86: TypePointer Input 85 - 87(ivla): 86(ptr) Variable Input - 88(ivlb): 86(ptr) Variable Input - 89: TypeArray 15(fvec4) 51 - 90: TypePointer Output 89 - 91(ovla): 90(ptr) Variable Output - 92(ovlb): 90(ptr) Variable Output + 51: TypeArray 50(gl_PerVertex) 8 + 52: TypePointer Output 51 + 53(gl_out): 52(ptr) Variable Output + 56: TypePointer Output 15(fvec4) + 60: TypePointer Output 14(float) + 65: TypeArray 14(float) 8 + 66: TypePointer Output 65 +67(gl_TessLevelOuter): 66(ptr) Variable Output + 68: 10(int) Constant 3 + 69: 14(float) Constant 1078774989 + 71: TypePointer Output 49 +72(gl_TessLevelInner): 71(ptr) Variable Output + 73: 14(float) Constant 1067869798 + 75: TypeArray 10(int) 8 + 76: TypePointer Private 75 + 77(outa): 76(ptr) Variable Private + 78(patchOut): 56(ptr) Variable Output + 79: TypeVector 14(float) 2 + 80: TypeArray 79(fvec2) 21 + 81: TypePointer Input 80 + 82(inb): 81(ptr) Variable Input + 83(ind): 81(ptr) Variable Input + 84: TypeArray 15(fvec4) 21 + 85: TypePointer Input 84 + 86(ivla): 85(ptr) Variable Input + 87(ivlb): 85(ptr) Variable Input + 88: TypeArray 15(fvec4) 8 + 89: TypePointer Output 88 + 90(ovla): 89(ptr) Variable Output + 91(ovlb): 89(ptr) Variable Output 4(main): 2 Function None 3 5: Label 12(a): 11(ptr) Variable Function @@ -151,21 +150,21 @@ spv.400.tesc Store 43(pid) 45 48: 10(int) Load 47(gl_InvocationID) Store 46(iid) 48 - 55: 10(int) Load 47(gl_InvocationID) - 56: 15(fvec4) Load 17(p) - 58: 57(ptr) AccessChain 54(gl_out) 55 26 - Store 58 56 - 59: 10(int) Load 47(gl_InvocationID) - 60: 14(float) Load 31(ps) - 62: 61(ptr) AccessChain 54(gl_out) 59 25 - Store 62 60 - 63: 10(int) Load 47(gl_InvocationID) - 64: 14(float) Load 35(cd) - 65: 61(ptr) AccessChain 54(gl_out) 63 36 25 - Store 65 64 - 71: 61(ptr) AccessChain 68(gl_TessLevelOuter) 69 - Store 71 70 - 75: 61(ptr) AccessChain 73(gl_TessLevelInner) 25 - Store 75 74 + 54: 10(int) Load 47(gl_InvocationID) + 55: 15(fvec4) Load 17(p) + 57: 56(ptr) AccessChain 53(gl_out) 54 26 + Store 57 55 + 58: 10(int) Load 47(gl_InvocationID) + 59: 14(float) Load 31(ps) + 61: 60(ptr) AccessChain 53(gl_out) 58 25 + Store 61 59 + 62: 10(int) Load 47(gl_InvocationID) + 63: 14(float) Load 35(cd) + 64: 60(ptr) AccessChain 53(gl_out) 62 36 25 + Store 64 63 + 70: 60(ptr) AccessChain 67(gl_TessLevelOuter) 68 + Store 70 69 + 74: 60(ptr) AccessChain 72(gl_TessLevelInner) 25 + Store 74 73 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tese.out index 37cdb4b0d71..43b6a9159a4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.400.tese.out @@ -1,6 +1,6 @@ spv.400.tese // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 96 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.420.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.420.geom.out index 28665bc71a1..74a4f0b31f3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.420.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.420.geom.out @@ -1,6 +1,6 @@ spv.420.geom // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 72 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.frag.out index 4aedf77eef7..330489f2df6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.frag.out @@ -1,6 +1,6 @@ spv.430.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.vert.out index c63d5e97cfe..1cd9e619e73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.430.vert.out @@ -1,6 +1,6 @@ spv.430.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 66 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.geom.out index f745068445e..7713e54e0fc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.geom.out @@ -1,6 +1,6 @@ spv.450.geom // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.noRedecl.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.noRedecl.tesc.out index 4d6a25a2848..b23061da4d4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.noRedecl.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.noRedecl.tesc.out @@ -1,6 +1,6 @@ spv.450.noRedecl.tesc // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 21 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.tesc.out index 5cbaca92a9e..35653fdef77 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.450.tesc.out @@ -1,6 +1,6 @@ spv.450.tesc // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 45 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.comp.out index d8e68be372e..6ebf49fa931 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.comp.out @@ -1,6 +1,6 @@ spv.460.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 15 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.frag.out index 6cdcc85084a..04393fbef2c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.frag.out @@ -1,6 +1,6 @@ spv.460.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 32 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.vert.out index 7b8d953e2b8..c2ef3024155 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.460.vert.out @@ -1,6 +1,6 @@ spv.460.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-int.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-int.frag.out new file mode 100644 index 00000000000..a0af75ab384 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-int.frag.out @@ -0,0 +1,334 @@ +spv.8bitstorage-int.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 172 + + Capability Shader + Capability CapabilityUniformAndStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_shader_8bit_storage" + Name 4 "main" + Name 12 "S" + MemberName 12(S) 0 "x" + MemberName 12(S) 1 "y" + MemberName 12(S) 2 "z" + Name 17 "B2" + MemberName 17(B2) 0 "o" + MemberName 17(B2) 1 "p" + MemberName 17(B2) 2 "q" + MemberName 17(B2) 3 "r" + MemberName 17(B2) 4 "u" + MemberName 17(B2) 5 "v" + MemberName 17(B2) 6 "x" + MemberName 17(B2) 7 "w" + Name 19 "b2" + Name 23 "S" + MemberName 23(S) 0 "x" + MemberName 23(S) 1 "y" + MemberName 23(S) 2 "z" + Name 25 "B1" + MemberName 25(B1) 0 "a" + MemberName 25(B1) 1 "b" + MemberName 25(B1) 2 "c" + MemberName 25(B1) 3 "d" + MemberName 25(B1) 4 "g" + MemberName 25(B1) 5 "h" + MemberName 25(B1) 6 "j" + Name 27 "b1" + Name 45 "S" + MemberName 45(S) 0 "x" + MemberName 45(S) 1 "y" + MemberName 45(S) 2 "z" + Name 49 "B5" + MemberName 49(B5) 0 "o" + MemberName 49(B5) 1 "p" + MemberName 49(B5) 2 "q" + MemberName 49(B5) 3 "r" + MemberName 49(B5) 4 "u" + MemberName 49(B5) 5 "v" + MemberName 49(B5) 6 "x" + MemberName 49(B5) 7 "w" + Name 51 "b5" + Name 69 "x0" + Name 75 "x1" + Name 88 "S2" + MemberName 88(S2) 0 "x" + MemberName 88(S2) 1 "y" + MemberName 88(S2) 2 "z" + Name 89 "S3" + MemberName 89(S3) 0 "x" + Name 90 "B4" + MemberName 90(B4) 0 "x" + MemberName 90(B4) 1 "y" + Name 92 "b4" + Name 93 "S2" + MemberName 93(S2) 0 "x" + MemberName 93(S2) 1 "y" + MemberName 93(S2) 2 "z" + Name 94 "B3" + MemberName 94(B3) 0 "x" + Name 96 "b3" + Name 113 "v3" + Name 135 "u3" + Decorate 11 ArrayStride 1 + MemberDecorate 12(S) 0 Offset 0 + MemberDecorate 12(S) 1 Offset 2 + MemberDecorate 12(S) 2 Offset 4 + Decorate 13 ArrayStride 8 + Decorate 15 ArrayStride 2 + Decorate 16 ArrayStride 1 + MemberDecorate 17(B2) 0 Offset 0 + MemberDecorate 17(B2) 1 Offset 2 + MemberDecorate 17(B2) 2 Offset 4 + MemberDecorate 17(B2) 3 Offset 7 + MemberDecorate 17(B2) 4 Offset 12 + MemberDecorate 17(B2) 5 Offset 20 + MemberDecorate 17(B2) 6 Offset 36 + MemberDecorate 17(B2) 7 Offset 236 + Decorate 17(B2) BufferBlock + Decorate 19(b2) DescriptorSet 0 + Decorate 22 ArrayStride 16 + MemberDecorate 23(S) 0 Offset 0 + MemberDecorate 23(S) 1 Offset 2 + MemberDecorate 23(S) 2 Offset 4 + Decorate 24 ArrayStride 16 + MemberDecorate 25(B1) 0 Offset 0 + MemberDecorate 25(B1) 1 Offset 2 + MemberDecorate 25(B1) 2 Offset 4 + MemberDecorate 25(B1) 3 Offset 16 + MemberDecorate 25(B1) 4 Offset 48 + MemberDecorate 25(B1) 5 Offset 64 + MemberDecorate 25(B1) 6 Offset 96 + Decorate 25(B1) Block + Decorate 27(b1) DescriptorSet 0 + Decorate 44 ArrayStride 16 + MemberDecorate 45(S) 0 Offset 0 + MemberDecorate 45(S) 1 Offset 2 + MemberDecorate 45(S) 2 Offset 4 + Decorate 46 ArrayStride 16 + Decorate 47 ArrayStride 16 + Decorate 48 ArrayStride 16 + MemberDecorate 49(B5) 0 Offset 0 + MemberDecorate 49(B5) 1 Offset 2 + MemberDecorate 49(B5) 2 Offset 4 + MemberDecorate 49(B5) 3 Offset 16 + MemberDecorate 49(B5) 4 Offset 48 + MemberDecorate 49(B5) 5 Offset 64 + MemberDecorate 49(B5) 6 Offset 96 + MemberDecorate 49(B5) 7 Offset 1696 + Decorate 49(B5) Block + Decorate 51(b5) DescriptorSet 0 + MemberDecorate 88(S2) 0 ColMajor + MemberDecorate 88(S2) 0 Offset 0 + MemberDecorate 88(S2) 0 MatrixStride 16 + MemberDecorate 88(S2) 1 Offset 64 + MemberDecorate 88(S2) 2 Offset 68 + MemberDecorate 89(S3) 0 Offset 0 + MemberDecorate 90(B4) 0 Offset 0 + MemberDecorate 90(B4) 1 Offset 80 + Decorate 90(B4) BufferBlock + Decorate 92(b4) DescriptorSet 0 + MemberDecorate 93(S2) 0 RowMajor + MemberDecorate 93(S2) 0 Offset 0 + MemberDecorate 93(S2) 0 MatrixStride 16 + MemberDecorate 93(S2) 1 Offset 64 + MemberDecorate 93(S2) 2 Offset 68 + MemberDecorate 94(B3) 0 Offset 0 + Decorate 94(B3) BufferBlock + Decorate 96(b3) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 8 1 + 7: TypeVector 6(int8_t) 2 + 8: TypeVector 6(int8_t) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(int8_t) 10 + 12(S): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) + 13: TypeArray 12(S) 10 + 14: 9(int) Constant 100 + 15: TypeArray 7(i8vec2) 14 + 16: TypeRuntimeArray 6(int8_t) + 17(B2): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) 11 12(S) 13 15 16 + 18: TypePointer Uniform 17(B2) + 19(b2): 18(ptr) Variable Uniform + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypeArray 6(int8_t) 10 + 23(S): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) + 24: TypeArray 23(S) 10 + 25(B1): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) 22 23(S) 24 20(int) + 26: TypePointer Uniform 25(B1) + 27(b1): 26(ptr) Variable Uniform + 28: TypePointer Uniform 6(int8_t) + 32: 20(int) Constant 1 + 33: 20(int) Constant 2 + 34: TypePointer Uniform 8(i8vec3) + 37: TypeVector 20(int) 3 + 39: TypeVector 20(int) 2 + 42: TypePointer Uniform 7(i8vec2) + 44: TypeArray 6(int8_t) 10 + 45(S): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) + 46: TypeArray 45(S) 10 + 47: TypeArray 7(i8vec2) 14 + 48: TypeArray 6(int8_t) 14 + 49(B5): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) 44 45(S) 46 47 48 + 50: TypePointer Uniform 49(B5) + 51(b5): 50(ptr) Variable Uniform + 58: 20(int) Constant 3 + 68: TypePointer Function 20(int) + 73: TypeVector 20(int) 4 + 74: TypePointer Function 73(ivec4) + 85: TypeFloat 32 + 86: TypeVector 85(float) 4 + 87: TypeMatrix 86(fvec4) 4 + 88(S2): TypeStruct 87 6(int8_t) 20(int) + 89(S3): TypeStruct 88(S2) + 90(B4): TypeStruct 88(S2) 89(S3) + 91: TypePointer Uniform 90(B4) + 92(b4): 91(ptr) Variable Uniform + 93(S2): TypeStruct 87 6(int8_t) 20(int) + 94(B3): TypeStruct 93(S2) + 95: TypePointer Uniform 94(B3) + 96(b3): 95(ptr) Variable Uniform + 97: TypePointer Uniform 87 + 104: 9(int) Constant 0 + 108: 20(int) Constant 5 + 112: TypePointer Function 37(ivec3) + 114: 20(int) Constant 7 + 115: 20(int) Constant 6 + 116: TypePointer Uniform 20(int) + 166: 6(int8_t) Constant 1 + 167: 6(int8_t) Constant 2 + 168: 7(i8vec2) ConstantComposite 166 167 + 170: 6(int8_t) Constant 3 + 4(main): 2 Function None 3 + 5: Label + 69(x0): 68(ptr) Variable Function + 75(x1): 74(ptr) Variable Function + 113(v3): 112(ptr) Variable Function + 135(u3): 112(ptr) Variable Function + 29: 28(ptr) AccessChain 27(b1) 21 + 30: 6(int8_t) Load 29 + 31: 28(ptr) AccessChain 19(b2) 21 + Store 31 30 + 35: 34(ptr) AccessChain 19(b2) 33 + 36: 8(i8vec3) Load 35 + 38: 37(ivec3) SConvert 36 + 40: 39(ivec2) VectorShuffle 38 38 0 1 + 41: 7(i8vec2) SConvert 40 + 43: 42(ptr) AccessChain 19(b2) 32 + Store 43 41 + 52: 34(ptr) AccessChain 51(b5) 33 + 53: 8(i8vec3) Load 52 + 54: 37(ivec3) SConvert 53 + 55: 39(ivec2) VectorShuffle 54 54 0 1 + 56: 7(i8vec2) SConvert 55 + 57: 42(ptr) AccessChain 19(b2) 32 + Store 57 56 + 59: 28(ptr) AccessChain 19(b2) 58 21 + 60: 6(int8_t) Load 59 + 61: 28(ptr) AccessChain 19(b2) 58 21 + Store 61 60 + 62: 28(ptr) AccessChain 51(b5) 58 32 + 63: 6(int8_t) Load 62 + 64: 28(ptr) AccessChain 19(b2) 58 32 + Store 64 63 + 65: 42(ptr) AccessChain 19(b2) 32 + 66: 7(i8vec2) Load 65 + 67: 42(ptr) AccessChain 19(b2) 32 + Store 67 66 + 70: 28(ptr) AccessChain 27(b1) 21 + 71: 6(int8_t) Load 70 + 72: 20(int) SConvert 71 + Store 69(x0) 72 + 76: 28(ptr) AccessChain 27(b1) 21 + 77: 6(int8_t) Load 76 + 78: 20(int) SConvert 77 + 79: 42(ptr) AccessChain 19(b2) 32 + 80: 7(i8vec2) Load 79 + 81: 39(ivec2) SConvert 80 + 82: 20(int) CompositeExtract 81 0 + 83: 20(int) CompositeExtract 81 1 + 84: 73(ivec4) CompositeConstruct 78 82 83 32 + Store 75(x1) 84 + 98: 97(ptr) AccessChain 96(b3) 21 21 + 99: 87 Load 98 + 100: 97(ptr) AccessChain 92(b4) 21 21 + Store 100 99 + 101: 42(ptr) AccessChain 19(b2) 32 + 102: 7(i8vec2) Load 101 + 103: 39(ivec2) SConvert 102 + 105: 20(int) CompositeExtract 103 0 + 106: 6(int8_t) SConvert 105 + 107: 28(ptr) AccessChain 19(b2) 21 + Store 107 106 + 109: 42(ptr) AccessChain 19(b2) 108 32 32 + 110: 7(i8vec2) Load 109 + 111: 42(ptr) AccessChain 19(b2) 32 + Store 111 110 + 117: 116(ptr) AccessChain 27(b1) 115 + 118: 20(int) Load 117 + 119: 28(ptr) AccessChain 19(b2) 114 118 + 120: 6(int8_t) Load 119 + 121: 20(int) SConvert 120 + 122: 116(ptr) AccessChain 27(b1) 115 + 123: 20(int) Load 122 + 124: 20(int) IAdd 123 32 + 125: 28(ptr) AccessChain 19(b2) 114 124 + 126: 6(int8_t) Load 125 + 127: 20(int) SConvert 126 + 128: 116(ptr) AccessChain 27(b1) 115 + 129: 20(int) Load 128 + 130: 20(int) IAdd 129 33 + 131: 28(ptr) AccessChain 19(b2) 114 130 + 132: 6(int8_t) Load 131 + 133: 20(int) SConvert 132 + 134: 37(ivec3) CompositeConstruct 121 127 133 + Store 113(v3) 134 + 136: 116(ptr) AccessChain 27(b1) 115 + 137: 20(int) Load 136 + 138: 28(ptr) AccessChain 51(b5) 114 137 + 139: 6(int8_t) Load 138 + 140: 20(int) SConvert 139 + 141: 116(ptr) AccessChain 27(b1) 115 + 142: 20(int) Load 141 + 143: 20(int) IAdd 142 32 + 144: 28(ptr) AccessChain 51(b5) 114 143 + 145: 6(int8_t) Load 144 + 146: 20(int) SConvert 145 + 147: 116(ptr) AccessChain 27(b1) 115 + 148: 20(int) Load 147 + 149: 20(int) IAdd 148 33 + 150: 28(ptr) AccessChain 51(b5) 114 149 + 151: 6(int8_t) Load 150 + 152: 20(int) SConvert 151 + 153: 37(ivec3) CompositeConstruct 140 146 152 + Store 135(u3) 153 + 154: 42(ptr) AccessChain 19(b2) 115 21 + 155: 7(i8vec2) Load 154 + 156: 42(ptr) AccessChain 19(b2) 115 21 + Store 156 155 + 157: 42(ptr) AccessChain 51(b5) 115 32 + 158: 7(i8vec2) Load 157 + 159: 42(ptr) AccessChain 19(b2) 115 32 + Store 159 158 + 160: 28(ptr) AccessChain 27(b1) 21 + 161: 6(int8_t) Load 160 + 162: 28(ptr) AccessChain 19(b2) 32 104 + Store 162 161 + 163: 28(ptr) AccessChain 19(b2) 32 104 + 164: 6(int8_t) Load 163 + 165: 28(ptr) AccessChain 19(b2) 21 + Store 165 164 + 169: 42(ptr) AccessChain 19(b2) 32 + Store 169 168 + 171: 28(ptr) AccessChain 19(b2) 21 + Store 171 170 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-ssbo.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-ssbo.vert.out new file mode 100644 index 00000000000..1e233783697 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-ssbo.vert.out @@ -0,0 +1,56 @@ +spv.8bitstorage-ssbo.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 28 + + Capability Shader + Capability CapabilityUniformAndStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 9 18 + Source GLSL 450 + SourceExtension "GL_EXT_shader_8bit_storage" + Name 4 "main" + Name 9 "color" + Name 12 "Vertices" + MemberName 12(Vertices) 0 "vertices" + Name 14 "" + Name 18 "gl_VertexIndex" + Decorate 9(color) Location 0 + Decorate 11 ArrayStride 1 + MemberDecorate 12(Vertices) 0 NonWritable + MemberDecorate 12(Vertices) 0 Offset 0 + Decorate 12(Vertices) BufferBlock + Decorate 14 DescriptorSet 0 + Decorate 14 Binding 0 + Decorate 18(gl_VertexIndex) BuiltIn VertexIndex + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(color): 8(ptr) Variable Output + 10: TypeInt 8 0 + 11: TypeRuntimeArray 10(int8_t) + 12(Vertices): TypeStruct 11 + 13: TypePointer Uniform 12(Vertices) + 14: 13(ptr) Variable Uniform + 15: TypeInt 32 1 + 16: 15(int) Constant 0 + 17: TypePointer Input 15(int) +18(gl_VertexIndex): 17(ptr) Variable Input + 20: TypePointer Uniform 10(int8_t) + 23: TypeInt 32 0 + 4(main): 2 Function None 3 + 5: Label + 19: 15(int) Load 18(gl_VertexIndex) + 21: 20(ptr) AccessChain 14 16 19 + 22: 10(int8_t) Load 21 + 24: 23(int) UConvert 22 + 25: 15(int) Bitcast 24 + 26: 6(float) ConvertSToF 25 + 27: 7(fvec4) CompositeConstruct 26 26 26 26 + Store 9(color) 27 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-ubo.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-ubo.vert.out new file mode 100644 index 00000000000..a6a05cfb5a9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-ubo.vert.out @@ -0,0 +1,56 @@ +spv.8bitstorage-ubo.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 29 + + Capability Shader + Capability CapabilityUniformAndStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 9 20 + Source GLSL 450 + SourceExtension "GL_EXT_shader_8bit_storage" + Name 4 "main" + Name 9 "color" + Name 14 "Vertices" + MemberName 14(Vertices) 0 "vertices" + Name 16 "" + Name 20 "gl_VertexIndex" + Decorate 9(color) Location 0 + Decorate 13 ArrayStride 16 + MemberDecorate 14(Vertices) 0 Offset 0 + Decorate 14(Vertices) Block + Decorate 16 DescriptorSet 0 + Decorate 16 Binding 0 + Decorate 20(gl_VertexIndex) BuiltIn VertexIndex + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(color): 8(ptr) Variable Output + 10: TypeInt 8 0 + 11: TypeInt 32 0 + 12: 11(int) Constant 512 + 13: TypeArray 10(int8_t) 12 + 14(Vertices): TypeStruct 13 + 15: TypePointer Uniform 14(Vertices) + 16: 15(ptr) Variable Uniform + 17: TypeInt 32 1 + 18: 17(int) Constant 0 + 19: TypePointer Input 17(int) +20(gl_VertexIndex): 19(ptr) Variable Input + 22: TypePointer Uniform 10(int8_t) + 4(main): 2 Function None 3 + 5: Label + 21: 17(int) Load 20(gl_VertexIndex) + 23: 22(ptr) AccessChain 16 18 21 + 24: 10(int8_t) Load 23 + 25: 11(int) UConvert 24 + 26: 17(int) Bitcast 25 + 27: 6(float) ConvertSToF 26 + 28: 7(fvec4) CompositeConstruct 27 27 27 27 + Store 9(color) 28 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-uint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-uint.frag.out new file mode 100644 index 00000000000..12c390ac411 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage-uint.frag.out @@ -0,0 +1,335 @@ +spv.8bitstorage-uint.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 173 + + Capability Shader + Capability CapabilityUniformAndStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_shader_8bit_storage" + Name 4 "main" + Name 12 "S" + MemberName 12(S) 0 "x" + MemberName 12(S) 1 "y" + MemberName 12(S) 2 "z" + Name 17 "B2" + MemberName 17(B2) 0 "o" + MemberName 17(B2) 1 "p" + MemberName 17(B2) 2 "q" + MemberName 17(B2) 3 "r" + MemberName 17(B2) 4 "u" + MemberName 17(B2) 5 "v" + MemberName 17(B2) 6 "x" + MemberName 17(B2) 7 "w" + Name 19 "b2" + Name 23 "S" + MemberName 23(S) 0 "x" + MemberName 23(S) 1 "y" + MemberName 23(S) 2 "z" + Name 25 "B1" + MemberName 25(B1) 0 "a" + MemberName 25(B1) 1 "b" + MemberName 25(B1) 2 "c" + MemberName 25(B1) 3 "d" + MemberName 25(B1) 4 "g" + MemberName 25(B1) 5 "h" + MemberName 25(B1) 6 "j" + Name 27 "b1" + Name 45 "S" + MemberName 45(S) 0 "x" + MemberName 45(S) 1 "y" + MemberName 45(S) 2 "z" + Name 49 "B5" + MemberName 49(B5) 0 "o" + MemberName 49(B5) 1 "p" + MemberName 49(B5) 2 "q" + MemberName 49(B5) 3 "r" + MemberName 49(B5) 4 "u" + MemberName 49(B5) 5 "v" + MemberName 49(B5) 6 "x" + MemberName 49(B5) 7 "w" + Name 51 "b5" + Name 69 "x0" + Name 75 "x1" + Name 89 "S2" + MemberName 89(S2) 0 "x" + MemberName 89(S2) 1 "y" + MemberName 89(S2) 2 "z" + Name 90 "S3" + MemberName 90(S3) 0 "x" + Name 91 "B4" + MemberName 91(B4) 0 "x" + MemberName 91(B4) 1 "y" + Name 93 "b4" + Name 94 "S2" + MemberName 94(S2) 0 "x" + MemberName 94(S2) 1 "y" + MemberName 94(S2) 2 "z" + Name 95 "B3" + MemberName 95(B3) 0 "x" + Name 97 "b3" + Name 114 "v3" + Name 136 "u3" + Decorate 11 ArrayStride 1 + MemberDecorate 12(S) 0 Offset 0 + MemberDecorate 12(S) 1 Offset 2 + MemberDecorate 12(S) 2 Offset 4 + Decorate 13 ArrayStride 8 + Decorate 15 ArrayStride 2 + Decorate 16 ArrayStride 1 + MemberDecorate 17(B2) 0 Offset 0 + MemberDecorate 17(B2) 1 Offset 2 + MemberDecorate 17(B2) 2 Offset 4 + MemberDecorate 17(B2) 3 Offset 7 + MemberDecorate 17(B2) 4 Offset 12 + MemberDecorate 17(B2) 5 Offset 20 + MemberDecorate 17(B2) 6 Offset 36 + MemberDecorate 17(B2) 7 Offset 236 + Decorate 17(B2) BufferBlock + Decorate 19(b2) DescriptorSet 0 + Decorate 22 ArrayStride 16 + MemberDecorate 23(S) 0 Offset 0 + MemberDecorate 23(S) 1 Offset 2 + MemberDecorate 23(S) 2 Offset 4 + Decorate 24 ArrayStride 16 + MemberDecorate 25(B1) 0 Offset 0 + MemberDecorate 25(B1) 1 Offset 2 + MemberDecorate 25(B1) 2 Offset 4 + MemberDecorate 25(B1) 3 Offset 16 + MemberDecorate 25(B1) 4 Offset 48 + MemberDecorate 25(B1) 5 Offset 64 + MemberDecorate 25(B1) 6 Offset 96 + Decorate 25(B1) Block + Decorate 27(b1) DescriptorSet 0 + Decorate 44 ArrayStride 16 + MemberDecorate 45(S) 0 Offset 0 + MemberDecorate 45(S) 1 Offset 2 + MemberDecorate 45(S) 2 Offset 4 + Decorate 46 ArrayStride 16 + Decorate 47 ArrayStride 16 + Decorate 48 ArrayStride 16 + MemberDecorate 49(B5) 0 Offset 0 + MemberDecorate 49(B5) 1 Offset 2 + MemberDecorate 49(B5) 2 Offset 4 + MemberDecorate 49(B5) 3 Offset 16 + MemberDecorate 49(B5) 4 Offset 48 + MemberDecorate 49(B5) 5 Offset 64 + MemberDecorate 49(B5) 6 Offset 96 + MemberDecorate 49(B5) 7 Offset 1696 + Decorate 49(B5) Block + Decorate 51(b5) DescriptorSet 0 + MemberDecorate 89(S2) 0 ColMajor + MemberDecorate 89(S2) 0 Offset 0 + MemberDecorate 89(S2) 0 MatrixStride 16 + MemberDecorate 89(S2) 1 Offset 64 + MemberDecorate 89(S2) 2 Offset 68 + MemberDecorate 90(S3) 0 Offset 0 + MemberDecorate 91(B4) 0 Offset 0 + MemberDecorate 91(B4) 1 Offset 80 + Decorate 91(B4) BufferBlock + Decorate 93(b4) DescriptorSet 0 + MemberDecorate 94(S2) 0 RowMajor + MemberDecorate 94(S2) 0 Offset 0 + MemberDecorate 94(S2) 0 MatrixStride 16 + MemberDecorate 94(S2) 1 Offset 64 + MemberDecorate 94(S2) 2 Offset 68 + MemberDecorate 95(B3) 0 Offset 0 + Decorate 95(B3) BufferBlock + Decorate 97(b3) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 8 0 + 7: TypeVector 6(int8_t) 2 + 8: TypeVector 6(int8_t) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(int8_t) 10 + 12(S): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) + 13: TypeArray 12(S) 10 + 14: 9(int) Constant 100 + 15: TypeArray 7(i8vec2) 14 + 16: TypeRuntimeArray 6(int8_t) + 17(B2): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) 11 12(S) 13 15 16 + 18: TypePointer Uniform 17(B2) + 19(b2): 18(ptr) Variable Uniform + 20: TypeInt 32 1 + 21: 20(int) Constant 0 + 22: TypeArray 6(int8_t) 10 + 23(S): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) + 24: TypeArray 23(S) 10 + 25(B1): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) 22 23(S) 24 9(int) + 26: TypePointer Uniform 25(B1) + 27(b1): 26(ptr) Variable Uniform + 28: TypePointer Uniform 6(int8_t) + 32: 20(int) Constant 1 + 33: 20(int) Constant 2 + 34: TypePointer Uniform 8(i8vec3) + 37: TypeVector 9(int) 3 + 39: TypeVector 9(int) 2 + 42: TypePointer Uniform 7(i8vec2) + 44: TypeArray 6(int8_t) 10 + 45(S): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) + 46: TypeArray 45(S) 10 + 47: TypeArray 7(i8vec2) 14 + 48: TypeArray 6(int8_t) 14 + 49(B5): TypeStruct 6(int8_t) 7(i8vec2) 8(i8vec3) 44 45(S) 46 47 48 + 50: TypePointer Uniform 49(B5) + 51(b5): 50(ptr) Variable Uniform + 58: 20(int) Constant 3 + 68: TypePointer Function 9(int) + 73: TypeVector 9(int) 4 + 74: TypePointer Function 73(ivec4) + 82: 9(int) Constant 1 + 86: TypeFloat 32 + 87: TypeVector 86(float) 4 + 88: TypeMatrix 87(fvec4) 4 + 89(S2): TypeStruct 88 6(int8_t) 9(int) + 90(S3): TypeStruct 89(S2) + 91(B4): TypeStruct 89(S2) 90(S3) + 92: TypePointer Uniform 91(B4) + 93(b4): 92(ptr) Variable Uniform + 94(S2): TypeStruct 88 6(int8_t) 9(int) + 95(B3): TypeStruct 94(S2) + 96: TypePointer Uniform 95(B3) + 97(b3): 96(ptr) Variable Uniform + 98: TypePointer Uniform 88 + 105: 9(int) Constant 0 + 109: 20(int) Constant 5 + 113: TypePointer Function 37(ivec3) + 115: 20(int) Constant 7 + 116: 20(int) Constant 6 + 117: TypePointer Uniform 9(int) + 167: 6(int8_t) Constant 1 + 168: 6(int8_t) Constant 2 + 169: 7(i8vec2) ConstantComposite 167 168 + 171: 6(int8_t) Constant 3 + 4(main): 2 Function None 3 + 5: Label + 69(x0): 68(ptr) Variable Function + 75(x1): 74(ptr) Variable Function + 114(v3): 113(ptr) Variable Function + 136(u3): 113(ptr) Variable Function + 29: 28(ptr) AccessChain 27(b1) 21 + 30: 6(int8_t) Load 29 + 31: 28(ptr) AccessChain 19(b2) 21 + Store 31 30 + 35: 34(ptr) AccessChain 19(b2) 33 + 36: 8(i8vec3) Load 35 + 38: 37(ivec3) UConvert 36 + 40: 39(ivec2) VectorShuffle 38 38 0 1 + 41: 7(i8vec2) UConvert 40 + 43: 42(ptr) AccessChain 19(b2) 32 + Store 43 41 + 52: 34(ptr) AccessChain 51(b5) 33 + 53: 8(i8vec3) Load 52 + 54: 37(ivec3) UConvert 53 + 55: 39(ivec2) VectorShuffle 54 54 0 1 + 56: 7(i8vec2) UConvert 55 + 57: 42(ptr) AccessChain 19(b2) 32 + Store 57 56 + 59: 28(ptr) AccessChain 19(b2) 58 21 + 60: 6(int8_t) Load 59 + 61: 28(ptr) AccessChain 19(b2) 58 21 + Store 61 60 + 62: 28(ptr) AccessChain 51(b5) 58 32 + 63: 6(int8_t) Load 62 + 64: 28(ptr) AccessChain 19(b2) 58 32 + Store 64 63 + 65: 42(ptr) AccessChain 19(b2) 32 + 66: 7(i8vec2) Load 65 + 67: 42(ptr) AccessChain 19(b2) 32 + Store 67 66 + 70: 28(ptr) AccessChain 27(b1) 21 + 71: 6(int8_t) Load 70 + 72: 9(int) UConvert 71 + Store 69(x0) 72 + 76: 28(ptr) AccessChain 27(b1) 21 + 77: 6(int8_t) Load 76 + 78: 9(int) UConvert 77 + 79: 42(ptr) AccessChain 19(b2) 32 + 80: 7(i8vec2) Load 79 + 81: 39(ivec2) UConvert 80 + 83: 9(int) CompositeExtract 81 0 + 84: 9(int) CompositeExtract 81 1 + 85: 73(ivec4) CompositeConstruct 78 83 84 82 + Store 75(x1) 85 + 99: 98(ptr) AccessChain 97(b3) 21 21 + 100: 88 Load 99 + 101: 98(ptr) AccessChain 93(b4) 21 21 + Store 101 100 + 102: 42(ptr) AccessChain 19(b2) 32 + 103: 7(i8vec2) Load 102 + 104: 39(ivec2) UConvert 103 + 106: 9(int) CompositeExtract 104 0 + 107: 6(int8_t) UConvert 106 + 108: 28(ptr) AccessChain 19(b2) 21 + Store 108 107 + 110: 42(ptr) AccessChain 19(b2) 109 32 32 + 111: 7(i8vec2) Load 110 + 112: 42(ptr) AccessChain 19(b2) 32 + Store 112 111 + 118: 117(ptr) AccessChain 27(b1) 116 + 119: 9(int) Load 118 + 120: 28(ptr) AccessChain 19(b2) 115 119 + 121: 6(int8_t) Load 120 + 122: 9(int) UConvert 121 + 123: 117(ptr) AccessChain 27(b1) 116 + 124: 9(int) Load 123 + 125: 9(int) IAdd 124 82 + 126: 28(ptr) AccessChain 19(b2) 115 125 + 127: 6(int8_t) Load 126 + 128: 9(int) UConvert 127 + 129: 117(ptr) AccessChain 27(b1) 116 + 130: 9(int) Load 129 + 131: 9(int) IAdd 130 10 + 132: 28(ptr) AccessChain 19(b2) 115 131 + 133: 6(int8_t) Load 132 + 134: 9(int) UConvert 133 + 135: 37(ivec3) CompositeConstruct 122 128 134 + Store 114(v3) 135 + 137: 117(ptr) AccessChain 27(b1) 116 + 138: 9(int) Load 137 + 139: 28(ptr) AccessChain 51(b5) 115 138 + 140: 6(int8_t) Load 139 + 141: 9(int) UConvert 140 + 142: 117(ptr) AccessChain 27(b1) 116 + 143: 9(int) Load 142 + 144: 9(int) IAdd 143 82 + 145: 28(ptr) AccessChain 51(b5) 115 144 + 146: 6(int8_t) Load 145 + 147: 9(int) UConvert 146 + 148: 117(ptr) AccessChain 27(b1) 116 + 149: 9(int) Load 148 + 150: 9(int) IAdd 149 10 + 151: 28(ptr) AccessChain 51(b5) 115 150 + 152: 6(int8_t) Load 151 + 153: 9(int) UConvert 152 + 154: 37(ivec3) CompositeConstruct 141 147 153 + Store 136(u3) 154 + 155: 42(ptr) AccessChain 19(b2) 116 21 + 156: 7(i8vec2) Load 155 + 157: 42(ptr) AccessChain 19(b2) 116 21 + Store 157 156 + 158: 42(ptr) AccessChain 51(b5) 116 32 + 159: 7(i8vec2) Load 158 + 160: 42(ptr) AccessChain 19(b2) 116 32 + Store 160 159 + 161: 28(ptr) AccessChain 27(b1) 21 + 162: 6(int8_t) Load 161 + 163: 28(ptr) AccessChain 19(b2) 32 105 + Store 163 162 + 164: 28(ptr) AccessChain 19(b2) 32 105 + 165: 6(int8_t) Load 164 + 166: 28(ptr) AccessChain 19(b2) 21 + Store 166 165 + 170: 42(ptr) AccessChain 19(b2) 32 + Store 170 169 + 172: 28(ptr) AccessChain 19(b2) 21 + Store 172 171 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage_Error-int.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage_Error-int.frag.out new file mode 100644 index 00000000000..0562111baad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage_Error-int.frag.out @@ -0,0 +1,71 @@ +spv.8bitstorage_Error-int.frag +ERROR: 0:54: 'structure: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:58: 'return: can't use with structs containing int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:61: 'int8_t: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:74: '[: does not operate on types containing (u)int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:75: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int8_t' (or there is no acceptable conversion) +ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform int8_t (or there is no acceptable conversion) +ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int8_t' and a right operand of type ' const int' (or there is no acceptable conversion) +ERROR: 0:81: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:82: '=: can't use with structs containing int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:83: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:84: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:85: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform int8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform int8_t' (or there is no acceptable conversion) +ERROR: 0:87: '=: can't use with arrays containing int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:88: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:89: 'constructor: 8-bit arrays not supported' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:89: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:92: 'constructor: can't construct structure containing 8-bit type' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:93: 'func2' : no matching overloaded function found +ERROR: 0:99: '' : syntax error, unexpected IDENTIFIER +ERROR: 26 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage_Error-uint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage_Error-uint.frag.out new file mode 100644 index 00000000000..93070f2aef1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.8bitstorage_Error-uint.frag.out @@ -0,0 +1,71 @@ +spv.8bitstorage_Error-uint.frag +ERROR: 0:54: 'structure: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:58: 'return: can't use with structs containing uint8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:61: 'uint8_t: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:74: '[: does not operate on types containing (u)int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:75: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:76: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:77: 'built-in function: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:78: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint8_t' (or there is no acceptable conversion) +ERROR: 0:79: '-' : wrong operand type no operation '-' exists that takes an operand of type layout( column_major std140 offset=0) uniform uint8_t (or there is no acceptable conversion) +ERROR: 0:80: '+' : wrong operand types: no operation '+' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint8_t' and a right operand of type ' const int' (or there is no acceptable conversion) +ERROR: 0:81: '.: can't swizzle types containing (u)int8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:82: '=: can't use with structs containing uint8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:83: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:84: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:85: 'qualifier: (u)int8 types can only be in uniform block or buffer storage' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:86: '==' : wrong operand types: no operation '==' exists that takes a left-hand operand of type 'layout( column_major std140 offset=0) uniform uint8_t' and a right operand of type 'layout( column_major std140 offset=0) uniform uint8_t' (or there is no acceptable conversion) +ERROR: 0:87: '=: can't use with arrays containing uint8' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:88: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:89: 'constructor: 8-bit arrays not supported' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:89: 'constructor: 8-bit vectors only take vector types' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:92: 'constructor: can't construct structure containing 8-bit type' : required extension not requested: Possible extensions include: +GL_KHX_shader_explicit_arithmetic_types +GL_KHX_shader_explicit_arithmetic_types_int8 +ERROR: 0:93: 'func2' : no matching overloaded function found +ERROR: 0:99: '' : syntax error, unexpected IDENTIFIER +ERROR: 26 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AnyHitShader.rahit.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AnyHitShader.rahit.out new file mode 100644 index 00000000000..92b31d08496 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AnyHitShader.rahit.out @@ -0,0 +1,163 @@ +spv.AnyHitShader.rahit +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 81 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint AnyHitNV 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 9 "v0" + Name 11 "gl_LaunchIDNV" + Name 13 "v1" + Name 14 "gl_LaunchSizeNV" + Name 18 "v2" + Name 20 "gl_PrimitiveID" + Name 22 "v3" + Name 23 "gl_InstanceID" + Name 25 "v4" + Name 26 "gl_InstanceCustomIndexNV" + Name 31 "v5" + Name 33 "gl_WorldRayOriginNV" + Name 35 "v6" + Name 36 "gl_WorldRayDirectionNV" + Name 38 "v7" + Name 39 "gl_ObjectRayOriginNV" + Name 41 "v8" + Name 42 "gl_ObjectRayDirectionNV" + Name 45 "v9" + Name 47 "gl_RayTminNV" + Name 49 "v10" + Name 50 "gl_RayTmaxNV" + Name 52 "v11" + Name 53 "gl_HitTNV" + Name 56 "v12" + Name 58 "gl_HitKindNV" + Name 62 "v13" + Name 64 "gl_ObjectToWorldNV" + Name 66 "v14" + Name 67 "gl_WorldToObjectNV" + Name 71 "incomingPayload" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 20(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 23(gl_InstanceID) BuiltIn InstanceId + Decorate 26(gl_InstanceCustomIndexNV) BuiltIn InstanceCustomIndexNV + Decorate 33(gl_WorldRayOriginNV) BuiltIn WorldRayOriginNV + Decorate 36(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionNV + Decorate 39(gl_ObjectRayOriginNV) BuiltIn ObjectRayOriginNV + Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionNV + Decorate 47(gl_RayTminNV) BuiltIn RayTminNV + Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxNV + Decorate 53(gl_HitTNV) BuiltIn HitTNV + Decorate 58(gl_HitKindNV) BuiltIn HitKindNV + Decorate 64(gl_ObjectToWorldNV) BuiltIn ObjectToWorldNV + Decorate 67(gl_WorldToObjectNV) BuiltIn WorldToObjectNV + Decorate 71(incomingPayload) Location 1 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 10: TypePointer Input 7(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input +14(gl_LaunchSizeNV): 10(ptr) Variable Input + 16: TypeInt 32 1 + 17: TypePointer Function 16(int) + 19: TypePointer Input 16(int) +20(gl_PrimitiveID): 19(ptr) Variable Input +23(gl_InstanceID): 19(ptr) Variable Input +26(gl_InstanceCustomIndexNV): 19(ptr) Variable Input + 28: TypeFloat 32 + 29: TypeVector 28(float) 3 + 30: TypePointer Function 29(fvec3) + 32: TypePointer Input 29(fvec3) +33(gl_WorldRayOriginNV): 32(ptr) Variable Input +36(gl_WorldRayDirectionNV): 32(ptr) Variable Input +39(gl_ObjectRayOriginNV): 32(ptr) Variable Input +42(gl_ObjectRayDirectionNV): 32(ptr) Variable Input + 44: TypePointer Function 28(float) + 46: TypePointer Input 28(float) +47(gl_RayTminNV): 46(ptr) Variable Input +50(gl_RayTmaxNV): 46(ptr) Variable Input + 53(gl_HitTNV): 46(ptr) Variable Input + 55: TypePointer Function 6(int) + 57: TypePointer Input 6(int) +58(gl_HitKindNV): 57(ptr) Variable Input + 60: TypeMatrix 29(fvec3) 4 + 61: TypePointer Function 60 + 63: TypePointer Input 60 +64(gl_ObjectToWorldNV): 63(ptr) Variable Input +67(gl_WorldToObjectNV): 63(ptr) Variable Input + 69: TypeVector 28(float) 4 + 70: TypePointer IncomingRayPayloadNV 69(fvec4) +71(incomingPayload): 70(ptr) Variable IncomingRayPayloadNV + 72: 28(float) Constant 1056964608 + 73: 69(fvec4) ConstantComposite 72 72 72 72 + 75: 16(int) Constant 1 + 76: TypeBool + 4(main): 2 Function None 3 + 5: Label + 9(v0): 8(ptr) Variable Function + 13(v1): 8(ptr) Variable Function + 18(v2): 17(ptr) Variable Function + 22(v3): 17(ptr) Variable Function + 25(v4): 17(ptr) Variable Function + 31(v5): 30(ptr) Variable Function + 35(v6): 30(ptr) Variable Function + 38(v7): 30(ptr) Variable Function + 41(v8): 30(ptr) Variable Function + 45(v9): 44(ptr) Variable Function + 49(v10): 44(ptr) Variable Function + 52(v11): 44(ptr) Variable Function + 56(v12): 55(ptr) Variable Function + 62(v13): 61(ptr) Variable Function + 66(v14): 61(ptr) Variable Function + 12: 7(ivec3) Load 11(gl_LaunchIDNV) + Store 9(v0) 12 + 15: 7(ivec3) Load 14(gl_LaunchSizeNV) + Store 13(v1) 15 + 21: 16(int) Load 20(gl_PrimitiveID) + Store 18(v2) 21 + 24: 16(int) Load 23(gl_InstanceID) + Store 22(v3) 24 + 27: 16(int) Load 26(gl_InstanceCustomIndexNV) + Store 25(v4) 27 + 34: 29(fvec3) Load 33(gl_WorldRayOriginNV) + Store 31(v5) 34 + 37: 29(fvec3) Load 36(gl_WorldRayDirectionNV) + Store 35(v6) 37 + 40: 29(fvec3) Load 39(gl_ObjectRayOriginNV) + Store 38(v7) 40 + 43: 29(fvec3) Load 42(gl_ObjectRayDirectionNV) + Store 41(v8) 43 + 48: 28(float) Load 47(gl_RayTminNV) + Store 45(v9) 48 + 51: 28(float) Load 50(gl_RayTmaxNV) + Store 49(v10) 51 + 54: 28(float) Load 53(gl_HitTNV) + Store 52(v11) 54 + 59: 6(int) Load 58(gl_HitKindNV) + Store 56(v12) 59 + 65: 60 Load 64(gl_ObjectToWorldNV) + Store 62(v13) 65 + 68: 60 Load 67(gl_WorldToObjectNV) + Store 66(v14) 68 + Store 71(incomingPayload) 73 + 74: 16(int) Load 18(v2) + 77: 76(bool) IEqual 74 75 + SelectionMerge 79 None + BranchConditional 77 78 80 + 78: Label + IgnoreIntersectionNV + Branch 79 + 80: Label + TerminateRayNV + Branch 79 + 79: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AnyHitShader_Errors.rahit.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AnyHitShader_Errors.rahit.out new file mode 100644 index 00000000000..e9bab08257a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AnyHitShader_Errors.rahit.out @@ -0,0 +1,8 @@ +spv.AnyHitShader_Errors.rahit +ERROR: 0:8: 'assign' : l-value required "payload" (cannot modify hitAttributeNV in this stage) +ERROR: 0:9: 'reportIntersectionNV' : no matching overloaded function found +ERROR: 0:10: 'traceNV' : no matching overloaded function found +ERROR: 3 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AofA.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AofA.frag.out index 8c0d6c09392..e8572ba9855 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AofA.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.AofA.frag.out @@ -1,6 +1,14 @@ spv.AofA.frag +WARNING: 0:6: '[][]' : Generating SPIR-V array-of-arrays, but Vulkan only supports single array level for this resource + +error: SPIRV-Tools Validation Errors +error: Uniform OpVariable '98[nameAofA] 'has illegal type. +From Vulkan spec, section 14.5.2: +Variables identified with the Uniform storage class are used to access transparent buffer backed resources. Such variables must be typed as OpTypeStruct, or an array of this type + %nameAofA = OpVariable %_ptr_Uniform__arr__arr_uAofA_uint_5_uint_3 Uniform + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 104 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ClosestHitShader.rchit.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ClosestHitShader.rchit.out new file mode 100644 index 00000000000..b461462ee49 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ClosestHitShader.rchit.out @@ -0,0 +1,169 @@ +spv.ClosestHitShader.rchit +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 88 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint ClosestHitNV 4 "main" 11 14 20 23 26 33 36 39 42 47 50 53 58 64 67 + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 9 "v0" + Name 11 "gl_LaunchIDNV" + Name 13 "v1" + Name 14 "gl_LaunchSizeNV" + Name 18 "v2" + Name 20 "gl_PrimitiveID" + Name 22 "v3" + Name 23 "gl_InstanceID" + Name 25 "v4" + Name 26 "gl_InstanceCustomIndexNV" + Name 31 "v5" + Name 33 "gl_WorldRayOriginNV" + Name 35 "v6" + Name 36 "gl_WorldRayDirectionNV" + Name 38 "v7" + Name 39 "gl_ObjectRayOriginNV" + Name 41 "v8" + Name 42 "gl_ObjectRayDirectionNV" + Name 45 "v9" + Name 47 "gl_RayTminNV" + Name 49 "v10" + Name 50 "gl_RayTmaxNV" + Name 52 "v11" + Name 53 "gl_HitTNV" + Name 56 "v12" + Name 58 "gl_HitKindNV" + Name 62 "v13" + Name 64 "gl_ObjectToWorldNV" + Name 66 "v14" + Name 67 "gl_WorldToObjectNV" + Name 71 "accNV" + Name 85 "localPayload" + Name 87 "incomingPayload" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 20(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 23(gl_InstanceID) BuiltIn InstanceId + Decorate 26(gl_InstanceCustomIndexNV) BuiltIn InstanceCustomIndexNV + Decorate 33(gl_WorldRayOriginNV) BuiltIn WorldRayOriginNV + Decorate 36(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionNV + Decorate 39(gl_ObjectRayOriginNV) BuiltIn ObjectRayOriginNV + Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionNV + Decorate 47(gl_RayTminNV) BuiltIn RayTminNV + Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxNV + Decorate 53(gl_HitTNV) BuiltIn HitTNV + Decorate 58(gl_HitKindNV) BuiltIn HitKindNV + Decorate 64(gl_ObjectToWorldNV) BuiltIn ObjectToWorldNV + Decorate 67(gl_WorldToObjectNV) BuiltIn WorldToObjectNV + Decorate 71(accNV) DescriptorSet 0 + Decorate 71(accNV) Binding 0 + Decorate 85(localPayload) Location 0 + Decorate 87(incomingPayload) Location 1 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 10: TypePointer Input 7(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input +14(gl_LaunchSizeNV): 10(ptr) Variable Input + 16: TypeInt 32 1 + 17: TypePointer Function 16(int) + 19: TypePointer Input 16(int) +20(gl_PrimitiveID): 19(ptr) Variable Input +23(gl_InstanceID): 19(ptr) Variable Input +26(gl_InstanceCustomIndexNV): 19(ptr) Variable Input + 28: TypeFloat 32 + 29: TypeVector 28(float) 3 + 30: TypePointer Function 29(fvec3) + 32: TypePointer Input 29(fvec3) +33(gl_WorldRayOriginNV): 32(ptr) Variable Input +36(gl_WorldRayDirectionNV): 32(ptr) Variable Input +39(gl_ObjectRayOriginNV): 32(ptr) Variable Input +42(gl_ObjectRayDirectionNV): 32(ptr) Variable Input + 44: TypePointer Function 28(float) + 46: TypePointer Input 28(float) +47(gl_RayTminNV): 46(ptr) Variable Input +50(gl_RayTmaxNV): 46(ptr) Variable Input + 53(gl_HitTNV): 46(ptr) Variable Input + 55: TypePointer Function 6(int) + 57: TypePointer Input 6(int) +58(gl_HitKindNV): 57(ptr) Variable Input + 60: TypeMatrix 29(fvec3) 4 + 61: TypePointer Function 60 + 63: TypePointer Input 60 +64(gl_ObjectToWorldNV): 63(ptr) Variable Input +67(gl_WorldToObjectNV): 63(ptr) Variable Input + 69: TypeAccelerationStructureNV + 70: TypePointer UniformConstant 69 + 71(accNV): 70(ptr) Variable UniformConstant + 73: 6(int) Constant 0 + 74: 6(int) Constant 1 + 75: 6(int) Constant 2 + 76: 6(int) Constant 3 + 77: 28(float) Constant 1056964608 + 78: 29(fvec3) ConstantComposite 77 77 77 + 79: 28(float) Constant 1065353216 + 80: 29(fvec3) ConstantComposite 79 79 79 + 81: 28(float) Constant 1061158912 + 82: 16(int) Constant 1 + 83: TypeVector 28(float) 4 + 84: TypePointer RayPayloadNV 83(fvec4) +85(localPayload): 84(ptr) Variable RayPayloadNV + 86: TypePointer IncomingRayPayloadNV 83(fvec4) +87(incomingPayload): 86(ptr) Variable IncomingRayPayloadNV + 4(main): 2 Function None 3 + 5: Label + 9(v0): 8(ptr) Variable Function + 13(v1): 8(ptr) Variable Function + 18(v2): 17(ptr) Variable Function + 22(v3): 17(ptr) Variable Function + 25(v4): 17(ptr) Variable Function + 31(v5): 30(ptr) Variable Function + 35(v6): 30(ptr) Variable Function + 38(v7): 30(ptr) Variable Function + 41(v8): 30(ptr) Variable Function + 45(v9): 44(ptr) Variable Function + 49(v10): 44(ptr) Variable Function + 52(v11): 44(ptr) Variable Function + 56(v12): 55(ptr) Variable Function + 62(v13): 61(ptr) Variable Function + 66(v14): 61(ptr) Variable Function + 12: 7(ivec3) Load 11(gl_LaunchIDNV) + Store 9(v0) 12 + 15: 7(ivec3) Load 14(gl_LaunchSizeNV) + Store 13(v1) 15 + 21: 16(int) Load 20(gl_PrimitiveID) + Store 18(v2) 21 + 24: 16(int) Load 23(gl_InstanceID) + Store 22(v3) 24 + 27: 16(int) Load 26(gl_InstanceCustomIndexNV) + Store 25(v4) 27 + 34: 29(fvec3) Load 33(gl_WorldRayOriginNV) + Store 31(v5) 34 + 37: 29(fvec3) Load 36(gl_WorldRayDirectionNV) + Store 35(v6) 37 + 40: 29(fvec3) Load 39(gl_ObjectRayOriginNV) + Store 38(v7) 40 + 43: 29(fvec3) Load 42(gl_ObjectRayDirectionNV) + Store 41(v8) 43 + 48: 28(float) Load 47(gl_RayTminNV) + Store 45(v9) 48 + 51: 28(float) Load 50(gl_RayTmaxNV) + Store 49(v10) 51 + 54: 28(float) Load 53(gl_HitTNV) + Store 52(v11) 54 + 59: 6(int) Load 58(gl_HitKindNV) + Store 56(v12) 59 + 65: 60 Load 64(gl_ObjectToWorldNV) + Store 62(v13) 65 + 68: 60 Load 67(gl_WorldToObjectNV) + Store 66(v14) 68 + 72: 69 Load 71(accNV) + TraceNV 72 73 74 75 76 73 78 77 80 81 82 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ClosestHitShader_Errors.rchit.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ClosestHitShader_Errors.rchit.out new file mode 100644 index 00000000000..e6f841086d1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ClosestHitShader_Errors.rchit.out @@ -0,0 +1,9 @@ +spv.ClosestHitShader_Errors.rchit +ERROR: 0:8: 'assign' : l-value required "payload" (cannot modify hitAttributeNV in this stage) +ERROR: 0:9: 'reportIntersectionNV' : no matching overloaded function found +ERROR: 0:10: 'terminateRayNV' : no matching overloaded function found +ERROR: 0:11: 'ignoreIntersectionNV' : no matching overloaded function found +ERROR: 4 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out index 2b85ddf6bb0..5db845e591e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.GeometryShaderPassthrough.geom.out @@ -1,6 +1,6 @@ spv.GeometryShaderPassthrough.geom // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 15 Capability Geometry @@ -11,7 +11,8 @@ spv.GeometryShaderPassthrough.geom EntryPoint Geometry 4 "main" 10 14 ExecutionMode 4 Triangles ExecutionMode 4 Invocations 1 - ExecutionMode 4 OutputVertices + ExecutionMode 4 OutputTriangleStrip + ExecutionMode 4 OutputVertices 3 Source GLSL 450 SourceExtension "GL_NV_geometry_shader_passthrough" Name 4 "main" diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.IntersectShader.rint.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.IntersectShader.rint.out new file mode 100644 index 00000000000..cbb70cd68d5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.IntersectShader.rint.out @@ -0,0 +1,138 @@ +spv.IntersectShader.rint +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 71 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint IntersectionNV 4 "main" 11 14 20 23 26 33 36 39 42 47 50 56 59 + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 9 "v0" + Name 11 "gl_LaunchIDNV" + Name 13 "v1" + Name 14 "gl_LaunchSizeNV" + Name 18 "v2" + Name 20 "gl_PrimitiveID" + Name 22 "v3" + Name 23 "gl_InstanceID" + Name 25 "v4" + Name 26 "gl_InstanceCustomIndexNV" + Name 31 "v5" + Name 33 "gl_WorldRayOriginNV" + Name 35 "v6" + Name 36 "gl_WorldRayDirectionNV" + Name 38 "v7" + Name 39 "gl_ObjectRayOriginNV" + Name 41 "v8" + Name 42 "gl_ObjectRayDirectionNV" + Name 45 "v9" + Name 47 "gl_RayTminNV" + Name 49 "v10" + Name 50 "gl_RayTmaxNV" + Name 54 "v11" + Name 56 "gl_ObjectToWorldNV" + Name 58 "v12" + Name 59 "gl_WorldToObjectNV" + Name 63 "iAttr" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 20(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 23(gl_InstanceID) BuiltIn InstanceId + Decorate 26(gl_InstanceCustomIndexNV) BuiltIn InstanceCustomIndexNV + Decorate 33(gl_WorldRayOriginNV) BuiltIn WorldRayOriginNV + Decorate 36(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionNV + Decorate 39(gl_ObjectRayOriginNV) BuiltIn ObjectRayOriginNV + Decorate 42(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionNV + Decorate 47(gl_RayTminNV) BuiltIn RayTminNV + Decorate 50(gl_RayTmaxNV) BuiltIn RayTmaxNV + Decorate 56(gl_ObjectToWorldNV) BuiltIn ObjectToWorldNV + Decorate 59(gl_WorldToObjectNV) BuiltIn WorldToObjectNV + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 10: TypePointer Input 7(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input +14(gl_LaunchSizeNV): 10(ptr) Variable Input + 16: TypeInt 32 1 + 17: TypePointer Function 16(int) + 19: TypePointer Input 16(int) +20(gl_PrimitiveID): 19(ptr) Variable Input +23(gl_InstanceID): 19(ptr) Variable Input +26(gl_InstanceCustomIndexNV): 19(ptr) Variable Input + 28: TypeFloat 32 + 29: TypeVector 28(float) 3 + 30: TypePointer Function 29(fvec3) + 32: TypePointer Input 29(fvec3) +33(gl_WorldRayOriginNV): 32(ptr) Variable Input +36(gl_WorldRayDirectionNV): 32(ptr) Variable Input +39(gl_ObjectRayOriginNV): 32(ptr) Variable Input +42(gl_ObjectRayDirectionNV): 32(ptr) Variable Input + 44: TypePointer Function 28(float) + 46: TypePointer Input 28(float) +47(gl_RayTminNV): 46(ptr) Variable Input +50(gl_RayTmaxNV): 46(ptr) Variable Input + 52: TypeMatrix 29(fvec3) 4 + 53: TypePointer Function 52 + 55: TypePointer Input 52 +56(gl_ObjectToWorldNV): 55(ptr) Variable Input +59(gl_WorldToObjectNV): 55(ptr) Variable Input + 61: TypeVector 28(float) 4 + 62: TypePointer HitAttributeNV 61(fvec4) + 63(iAttr): 62(ptr) Variable HitAttributeNV + 64: 28(float) Constant 1056964608 + 65: 28(float) Constant 0 + 66: 28(float) Constant 1065353216 + 67: 61(fvec4) ConstantComposite 64 64 65 66 + 68: 6(int) Constant 1 + 69: TypeBool + 4(main): 2 Function None 3 + 5: Label + 9(v0): 8(ptr) Variable Function + 13(v1): 8(ptr) Variable Function + 18(v2): 17(ptr) Variable Function + 22(v3): 17(ptr) Variable Function + 25(v4): 17(ptr) Variable Function + 31(v5): 30(ptr) Variable Function + 35(v6): 30(ptr) Variable Function + 38(v7): 30(ptr) Variable Function + 41(v8): 30(ptr) Variable Function + 45(v9): 44(ptr) Variable Function + 49(v10): 44(ptr) Variable Function + 54(v11): 53(ptr) Variable Function + 58(v12): 53(ptr) Variable Function + 12: 7(ivec3) Load 11(gl_LaunchIDNV) + Store 9(v0) 12 + 15: 7(ivec3) Load 14(gl_LaunchSizeNV) + Store 13(v1) 15 + 21: 16(int) Load 20(gl_PrimitiveID) + Store 18(v2) 21 + 24: 16(int) Load 23(gl_InstanceID) + Store 22(v3) 24 + 27: 16(int) Load 26(gl_InstanceCustomIndexNV) + Store 25(v4) 27 + 34: 29(fvec3) Load 33(gl_WorldRayOriginNV) + Store 31(v5) 34 + 37: 29(fvec3) Load 36(gl_WorldRayDirectionNV) + Store 35(v6) 37 + 40: 29(fvec3) Load 39(gl_ObjectRayOriginNV) + Store 38(v7) 40 + 43: 29(fvec3) Load 42(gl_ObjectRayDirectionNV) + Store 41(v8) 43 + 48: 28(float) Load 47(gl_RayTminNV) + Store 45(v9) 48 + 51: 28(float) Load 50(gl_RayTmaxNV) + Store 49(v10) 51 + 57: 52 Load 56(gl_ObjectToWorldNV) + Store 54(v11) 57 + 60: 52 Load 59(gl_WorldToObjectNV) + Store 58(v12) 60 + Store 63(iAttr) 67 + 70: 69(bool) ReportIntersectionNV 64 68 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.IntersectShader_Errors.rint.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.IntersectShader_Errors.rint.out new file mode 100644 index 00000000000..f267026565b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.IntersectShader_Errors.rint.out @@ -0,0 +1,10 @@ +spv.IntersectShader_Errors.rint +ERROR: 0:3: 'rayPayloadInNV' : not supported in this stage: intersection +ERROR: 0:4: 'rayPayloadNV' : not supported in this stage: intersection +ERROR: 0:8: 'gl_HitTNV' : undeclared identifier +ERROR: 0:9: 'gl_HitKindNV' : undeclared identifier +ERROR: 0:10: 'traceNV' : no matching overloaded function found +ERROR: 5 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.MissShader.rmiss.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.MissShader.rmiss.out new file mode 100644 index 00000000000..0ad3341a418 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.MissShader.rmiss.out @@ -0,0 +1,113 @@ +spv.MissShader.rmiss +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 60 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MissNV 4 "main" 11 14 21 24 27 30 35 38 + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 9 "v0" + Name 11 "gl_LaunchIDNV" + Name 13 "v1" + Name 14 "gl_LaunchSizeNV" + Name 19 "v2" + Name 21 "gl_WorldRayOriginNV" + Name 23 "v3" + Name 24 "gl_WorldRayDirectionNV" + Name 26 "v4" + Name 27 "gl_ObjectRayOriginNV" + Name 29 "v5" + Name 30 "gl_ObjectRayDirectionNV" + Name 33 "v6" + Name 35 "gl_RayTminNV" + Name 37 "v7" + Name 38 "gl_RayTmaxNV" + Name 42 "accNV" + Name 57 "localPayload" + Name 59 "incomingPayload" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 21(gl_WorldRayOriginNV) BuiltIn WorldRayOriginNV + Decorate 24(gl_WorldRayDirectionNV) BuiltIn WorldRayDirectionNV + Decorate 27(gl_ObjectRayOriginNV) BuiltIn ObjectRayOriginNV + Decorate 30(gl_ObjectRayDirectionNV) BuiltIn ObjectRayDirectionNV + Decorate 35(gl_RayTminNV) BuiltIn RayTminNV + Decorate 38(gl_RayTmaxNV) BuiltIn RayTmaxNV + Decorate 42(accNV) DescriptorSet 0 + Decorate 42(accNV) Binding 0 + Decorate 57(localPayload) Location 0 + Decorate 59(incomingPayload) Location 1 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 10: TypePointer Input 7(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input +14(gl_LaunchSizeNV): 10(ptr) Variable Input + 16: TypeFloat 32 + 17: TypeVector 16(float) 3 + 18: TypePointer Function 17(fvec3) + 20: TypePointer Input 17(fvec3) +21(gl_WorldRayOriginNV): 20(ptr) Variable Input +24(gl_WorldRayDirectionNV): 20(ptr) Variable Input +27(gl_ObjectRayOriginNV): 20(ptr) Variable Input +30(gl_ObjectRayDirectionNV): 20(ptr) Variable Input + 32: TypePointer Function 16(float) + 34: TypePointer Input 16(float) +35(gl_RayTminNV): 34(ptr) Variable Input +38(gl_RayTmaxNV): 34(ptr) Variable Input + 40: TypeAccelerationStructureNV + 41: TypePointer UniformConstant 40 + 42(accNV): 41(ptr) Variable UniformConstant + 44: 6(int) Constant 0 + 45: 6(int) Constant 1 + 46: 6(int) Constant 2 + 47: 6(int) Constant 3 + 48: 16(float) Constant 1056964608 + 49: 17(fvec3) ConstantComposite 48 48 48 + 50: 16(float) Constant 1065353216 + 51: 17(fvec3) ConstantComposite 50 50 50 + 52: 16(float) Constant 1061158912 + 53: TypeInt 32 1 + 54: 53(int) Constant 1 + 55: TypeVector 16(float) 4 + 56: TypePointer RayPayloadNV 55(fvec4) +57(localPayload): 56(ptr) Variable RayPayloadNV + 58: TypePointer IncomingRayPayloadNV 55(fvec4) +59(incomingPayload): 58(ptr) Variable IncomingRayPayloadNV + 4(main): 2 Function None 3 + 5: Label + 9(v0): 8(ptr) Variable Function + 13(v1): 8(ptr) Variable Function + 19(v2): 18(ptr) Variable Function + 23(v3): 18(ptr) Variable Function + 26(v4): 18(ptr) Variable Function + 29(v5): 18(ptr) Variable Function + 33(v6): 32(ptr) Variable Function + 37(v7): 32(ptr) Variable Function + 12: 7(ivec3) Load 11(gl_LaunchIDNV) + Store 9(v0) 12 + 15: 7(ivec3) Load 14(gl_LaunchSizeNV) + Store 13(v1) 15 + 22: 17(fvec3) Load 21(gl_WorldRayOriginNV) + Store 19(v2) 22 + 25: 17(fvec3) Load 24(gl_WorldRayDirectionNV) + Store 23(v3) 25 + 28: 17(fvec3) Load 27(gl_ObjectRayOriginNV) + Store 26(v4) 28 + 31: 17(fvec3) Load 30(gl_ObjectRayDirectionNV) + Store 29(v5) 31 + 36: 16(float) Load 35(gl_RayTminNV) + Store 33(v6) 36 + 39: 16(float) Load 38(gl_RayTmaxNV) + Store 37(v7) 39 + 43: 40 Load 42(accNV) + TraceNV 43 44 45 46 47 44 49 48 51 52 54 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.MissShader_Errors.rmiss.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.MissShader_Errors.rmiss.out new file mode 100644 index 00000000000..52b412b4866 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.MissShader_Errors.rmiss.out @@ -0,0 +1,21 @@ +spv.MissShader_Errors.rmiss +ERROR: 0:3: 'hitAttributeNV' : not supported in this stage: miss +ERROR: 0:6: 'gl_PrimitiveID' : undeclared identifier +ERROR: 0:6: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:7: 'gl_InstanceID' : undeclared identifier (Did you mean gl_InstanceIndex?) +ERROR: 0:7: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:8: 'gl_InstanceCustomIndexNV' : undeclared identifier +ERROR: 0:8: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:9: 'gl_ObjectToWorldNV' : undeclared identifier +ERROR: 0:9: '=' : cannot convert from ' temp float' to ' temp highp 4X3 matrix of float' +ERROR: 0:10: 'gl_WorldToObjectNV' : undeclared identifier +ERROR: 0:10: '=' : cannot convert from ' temp float' to ' temp highp 4X3 matrix of float' +ERROR: 0:11: 'gl_HitTNV' : undeclared identifier +ERROR: 0:12: 'gl_HitKindNV' : undeclared identifier +ERROR: 0:13: 'reportIntersectionNV' : no matching overloaded function found +ERROR: 0:14: 'ignoreIntersectionNV' : no matching overloaded function found +ERROR: 0:15: 'terminateRayNV' : no matching overloaded function found +ERROR: 16 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.OVR_multiview.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.OVR_multiview.vert.out index 49901a5cd68..7013cedd75b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.OVR_multiview.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.OVR_multiview.vert.out @@ -1,6 +1,6 @@ spv.OVR_multiview.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.Operations.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.Operations.frag.out index 8f61e02119b..4113ddf1199 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.Operations.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.Operations.frag.out @@ -1,6 +1,6 @@ spv.Operations.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 532 Capability Shader @@ -90,10 +90,10 @@ spv.Operations.frag 188(f): 143(ptr) Variable Function 285(u): 284(ptr) Variable Function 305(b): 304(ptr) Variable Function - 486: 8(ptr) Variable Function + 487: 8(ptr) Variable Function 503(m1): 502(ptr) Variable Function 510(m2): 502(ptr) Variable Function - 513: 502(ptr) Variable Function + 514: 502(ptr) Variable Function 12: 7(fvec4) Load 11(uv4) 13: 7(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 12 Store 9(v) 13 @@ -658,9 +658,9 @@ spv.Operations.frag 482: 178(bool) Load 305(b) 483: 178(bool) LogicalNot 482 Store 305(b) 483 - 487: 178(bool) Load 305(b) + 486: 178(bool) Load 305(b) SelectionMerge 489 None - BranchConditional 487 488 498 + BranchConditional 486 488 498 488: Label 490: 18(int) Load 20(i) 491: 6(float) ConvertSToF 490 @@ -670,30 +670,30 @@ spv.Operations.frag 495: 7(fvec4) FAdd 492 494 496: 7(fvec4) Load 9(v) 497: 7(fvec4) FAdd 495 496 - Store 486 497 + Store 487 497 Branch 489 498: Label 499: 7(fvec4) Load 9(v) - Store 486 499 + Store 487 499 Branch 489 489: Label - 500: 7(fvec4) Load 486 + 500: 7(fvec4) Load 487 Store 485(FragColor) 500 Store 503(m1) 509 Store 510(m2) 512 - 514: 178(bool) Load 305(b) + 513: 178(bool) Load 305(b) SelectionMerge 516 None - BranchConditional 514 515 518 + BranchConditional 513 515 518 515: Label 517: 501 Load 503(m1) - Store 513 517 + Store 514 517 Branch 516 518: Label 519: 501 Load 510(m2) - Store 513 519 + Store 514 519 Branch 516 516: Label - 520: 8(ptr) AccessChain 513 405 + 520: 8(ptr) AccessChain 514 405 521: 7(fvec4) Load 520 522: 7(fvec4) Load 485(FragColor) 523: 7(fvec4) FAdd 522 521 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayCallable.rcall.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayCallable.rcall.out new file mode 100644 index 00000000000..198d6860d08 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayCallable.rcall.out @@ -0,0 +1,73 @@ +spv.RayCallable.rcall +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 38 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint CallableNV 4 "main" 11 14 19 + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 9 "id" + Name 11 "gl_LaunchIDNV" + Name 13 "size" + Name 14 "gl_LaunchSizeNV" + Name 17 "curFlags" + Name 19 "gl_IncomingRayFlagsNV" + Name 24 "dataBlock" + MemberName 24(dataBlock) 0 "data1" + Name 26 "" + Name 37 "data0" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 14(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 19(gl_IncomingRayFlagsNV) BuiltIn IncomingRayFlagsNV + Decorate 24(dataBlock) Block + Decorate 26 Location 1 + Decorate 37(data0) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 3 + 8: TypePointer Function 7(ivec3) + 10: TypePointer Input 7(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input +14(gl_LaunchSizeNV): 10(ptr) Variable Input + 16: TypePointer Function 6(int) + 18: TypePointer Input 6(int) +19(gl_IncomingRayFlagsNV): 18(ptr) Variable Input + 22: 6(int) Constant 1 + 24(dataBlock): TypeStruct 6(int) + 25: TypePointer IncomingCallableDataNV 24(dataBlock) + 26: 25(ptr) Variable IncomingCallableDataNV + 27: TypeInt 32 1 + 28: 27(int) Constant 0 + 29: 6(int) Constant 256 + 30: TypePointer IncomingCallableDataNV 6(int) + 32: 6(int) Constant 2 + 33: 27(int) Constant 1 + 34: TypeFloat 32 + 35: TypeVector 34(float) 4 + 36: TypePointer CallableDataNV 35(fvec4) + 37(data0): 36(ptr) Variable CallableDataNV + 4(main): 2 Function None 3 + 5: Label + 9(id): 8(ptr) Variable Function + 13(size): 8(ptr) Variable Function + 17(curFlags): 16(ptr) Variable Function + 12: 7(ivec3) Load 11(gl_LaunchIDNV) + Store 9(id) 12 + 15: 7(ivec3) Load 14(gl_LaunchSizeNV) + Store 13(size) 15 + 20: 6(int) Load 19(gl_IncomingRayFlagsNV) + Store 17(curFlags) 20 + 21: 6(int) Load 17(curFlags) + 23: 6(int) BitwiseAnd 21 22 + Store 17(curFlags) 23 + 31: 30(ptr) AccessChain 26 28 + Store 31 29 + ExecuteCallableNV 32 33 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayCallable_Errors.rcall.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayCallable_Errors.rcall.out new file mode 100644 index 00000000000..a807a5774ff --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayCallable_Errors.rcall.out @@ -0,0 +1,33 @@ +spv.RayCallable_Errors.rcall +ERROR: 0:3: 'hitAttributeNV' : not supported in this stage: callable +ERROR: 0:4: 'rayPayloadNV' : not supported in this stage: callable +ERROR: 0:5: 'rayPayloadInNV' : not supported in this stage: callable +ERROR: 0:9: 'gl_PrimitiveID' : undeclared identifier +ERROR: 0:9: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:10: 'gl_InstanceID' : undeclared identifier (Did you mean gl_InstanceIndex?) +ERROR: 0:10: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:11: 'gl_InstanceCustomIndexNV' : undeclared identifier +ERROR: 0:11: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:12: 'gl_WorldRayOriginNV' : undeclared identifier +ERROR: 0:12: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:13: 'gl_WorldRayDirectionNV' : undeclared identifier +ERROR: 0:13: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:14: 'gl_ObjectRayOriginNV' : undeclared identifier +ERROR: 0:14: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:15: 'gl_ObjectRayDirectionNV' : undeclared identifier +ERROR: 0:15: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:16: 'gl_RayTminNV' : undeclared identifier +ERROR: 0:17: 'gl_RayTmaxNV' : undeclared identifier +ERROR: 0:18: 'gl_ObjectToWorldNV' : undeclared identifier +ERROR: 0:18: '=' : cannot convert from ' temp float' to ' temp highp 4X3 matrix of float' +ERROR: 0:19: 'gl_WorldToObjectNV' : undeclared identifier +ERROR: 0:19: '=' : cannot convert from ' temp float' to ' temp highp 4X3 matrix of float' +ERROR: 0:20: 'gl_HitTNV' : undeclared identifier +ERROR: 0:21: 'gl_HitKindNV' : undeclared identifier +ERROR: 0:22: 'reportIntersectionNV' : no matching overloaded function found +ERROR: 0:23: 'ignoreIntersectionNV' : no matching overloaded function found +ERROR: 0:24: 'terminateRayNV' : no matching overloaded function found +ERROR: 28 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayConstants.rgen.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayConstants.rgen.out new file mode 100644 index 00000000000..d939acfbc61 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayConstants.rgen.out @@ -0,0 +1,46 @@ +spv.RayConstants.rgen +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 27 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint RayGenerationNV 4 "main" + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 8 "accNV" + Name 26 "payload" + Decorate 8(accNV) DescriptorSet 0 + Decorate 8(accNV) Binding 0 + Decorate 26(payload) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeAccelerationStructureNV + 7: TypePointer UniformConstant 6 + 8(accNV): 7(ptr) Variable UniformConstant + 10: TypeInt 32 0 + 11: 10(int) Constant 255 + 12: 10(int) Constant 0 + 13: 10(int) Constant 1 + 14: TypeFloat 32 + 15: TypeVector 14(float) 3 + 16: 14(float) Constant 0 + 17: 15(fvec3) ConstantComposite 16 16 16 + 18: 14(float) Constant 1056964608 + 19: 14(float) Constant 1065353216 + 20: 15(fvec3) ConstantComposite 19 19 19 + 21: 14(float) Constant 1061158912 + 22: TypeInt 32 1 + 23: 22(int) Constant 1 + 24: TypeVector 14(float) 4 + 25: TypePointer RayPayloadNV 24(fvec4) + 26(payload): 25(ptr) Variable RayPayloadNV + 4(main): 2 Function None 3 + 5: Label + 9: 6 Load 8(accNV) + TraceNV 9 11 12 13 13 12 17 18 20 21 23 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayGenShader.rgen.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayGenShader.rgen.out new file mode 100644 index 00000000000..db6ecfc9521 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayGenShader.rgen.out @@ -0,0 +1,101 @@ +spv.RayGenShader.rgen +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 60 + + Capability RayTracingNV + Extension "SPV_NV_ray_tracing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint RayGenerationNV 4 "main" 11 21 + Source GLSL 460 + SourceExtension "GL_NV_ray_tracing" + Name 4 "main" + Name 8 "lx" + Name 11 "gl_LaunchIDNV" + Name 16 "ly" + Name 20 "sx" + Name 21 "gl_LaunchSizeNV" + Name 24 "sy" + Name 29 "accNV" + Name 48 "block" + MemberName 48(block) 0 "arr" + MemberName 48(block) 1 "pad" + Name 50 "" + Name 56 "payload" + Decorate 11(gl_LaunchIDNV) BuiltIn LaunchIdNV + Decorate 21(gl_LaunchSizeNV) BuiltIn LaunchSizeNV + Decorate 29(accNV) DescriptorSet 0 + Decorate 29(accNV) Binding 0 + Decorate 46 ArrayStride 4 + MemberDecorate 48(block) 0 Offset 0 + MemberDecorate 48(block) 1 Offset 16 + Decorate 48(block) BufferBlock + Decorate 56(payload) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LaunchIDNV): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 17: 6(int) Constant 1 +21(gl_LaunchSizeNV): 10(ptr) Variable Input + 27: TypeAccelerationStructureNV + 28: TypePointer UniformConstant 27 + 29(accNV): 28(ptr) Variable UniformConstant + 35: TypeFloat 32 + 36: TypeVector 35(float) 3 + 37: 35(float) Constant 0 + 38: 36(fvec3) ConstantComposite 37 37 37 + 39: 35(float) Constant 1056964608 + 40: 35(float) Constant 1065353216 + 41: 36(fvec3) ConstantComposite 40 40 40 + 42: 35(float) Constant 1061158912 + 43: TypeInt 32 1 + 44: 43(int) Constant 1 + 45: 6(int) Constant 4 + 46: TypeArray 35(float) 45 + 47: TypeVector 35(float) 4 + 48(block): TypeStruct 46 47(fvec4) + 49: TypePointer ShaderRecordBufferNV 48(block) + 50: 49(ptr) Variable ShaderRecordBufferNV + 51: 43(int) Constant 0 + 52: 43(int) Constant 3 + 53: TypePointer ShaderRecordBufferNV 35(float) + 55: TypePointer RayPayloadNV 47(fvec4) + 56(payload): 55(ptr) Variable RayPayloadNV + 58: TypePointer ShaderRecordBufferNV 47(fvec4) + 4(main): 2 Function None 3 + 5: Label + 8(lx): 7(ptr) Variable Function + 16(ly): 7(ptr) Variable Function + 20(sx): 7(ptr) Variable Function + 24(sy): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LaunchIDNV) 12 + 15: 6(int) Load 14 + Store 8(lx) 15 + 18: 13(ptr) AccessChain 11(gl_LaunchIDNV) 17 + 19: 6(int) Load 18 + Store 16(ly) 19 + 22: 13(ptr) AccessChain 21(gl_LaunchSizeNV) 12 + 23: 6(int) Load 22 + Store 20(sx) 23 + 25: 13(ptr) AccessChain 21(gl_LaunchSizeNV) 17 + 26: 6(int) Load 25 + Store 24(sy) 26 + 30: 27 Load 29(accNV) + 31: 6(int) Load 8(lx) + 32: 6(int) Load 16(ly) + 33: 6(int) Load 20(sx) + 34: 6(int) Load 24(sy) + TraceNV 30 31 32 33 34 12 38 39 41 42 44 + 54: 53(ptr) AccessChain 50 51 52 + Store 54 40 + 57: 47(fvec4) Load 56(payload) + 59: 58(ptr) AccessChain 50 44 + Store 59 57 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayGenShader_Errors.rgen.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayGenShader_Errors.rgen.out new file mode 100644 index 00000000000..27d51c22274 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.RayGenShader_Errors.rgen.out @@ -0,0 +1,39 @@ +spv.RayGenShader_Errors.rgen +ERROR: 0:3: 'hitAttributeNV' : not supported in this stage: ray-generation +ERROR: 0:4: 'rayPayloadInNV' : not supported in this stage: ray-generation +ERROR: 0:5: 'shaderRecordNV' : can only be used with a buffer +ERROR: 0:9: 'binding' : cannot be used with shaderRecordNV +ERROR: 0:12: 'set' : cannot be used with shaderRecordNV +ERROR: 0:23: 'accelerationStructureNV' : accelerationStructureNV can only be used in uniform variables or function parameters: a +ERROR: 0:23: '=' : cannot convert from ' const int' to ' temp accelerationStructureNV' +ERROR: 0:24: 'gl_PrimitiveID' : undeclared identifier +ERROR: 0:24: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:25: 'gl_InstanceID' : undeclared identifier (Did you mean gl_InstanceIndex?) +ERROR: 0:25: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:26: 'gl_InstanceCustomIndexNV' : undeclared identifier +ERROR: 0:26: '=' : cannot convert from ' temp float' to ' temp highp int' +ERROR: 0:27: 'gl_WorldRayOriginNV' : undeclared identifier +ERROR: 0:27: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:28: 'gl_WorldRayDirectionNV' : undeclared identifier +ERROR: 0:28: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:29: 'gl_ObjectRayOriginNV' : undeclared identifier +ERROR: 0:29: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:30: 'gl_ObjectRayDirectionNV' : undeclared identifier +ERROR: 0:30: '=' : cannot convert from ' temp float' to ' temp highp 3-component vector of float' +ERROR: 0:31: 'gl_RayTminNV' : undeclared identifier +ERROR: 0:32: 'gl_RayTmaxNV' : undeclared identifier +ERROR: 0:33: 'gl_ObjectToWorldNV' : undeclared identifier +ERROR: 0:33: '=' : cannot convert from ' temp float' to ' temp highp 4X3 matrix of float' +ERROR: 0:34: 'gl_WorldToObjectNV' : undeclared identifier +ERROR: 0:34: '=' : cannot convert from ' temp float' to ' temp highp 4X3 matrix of float' +ERROR: 0:35: 'gl_HitTNV' : undeclared identifier +ERROR: 0:36: 'gl_HitKindNV' : undeclared identifier +ERROR: 0:37: 'reportIntersectionNV' : no matching overloaded function found +ERROR: 0:38: 'ignoreIntersectionNV' : no matching overloaded function found +ERROR: 0:39: 'terminateRayNV' : no matching overloaded function found +ERROR: 32 compilation errors. No code generated. + + +ERROR: Linking ray-generation stage: Only one shaderRecordNV buffer block is allowed per stage + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.accessChain.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.accessChain.frag.out index 89a39a0371a..bf878292fa7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.accessChain.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.accessChain.frag.out @@ -1,12 +1,12 @@ spv.accessChain.frag // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 206 +// Generated by (magic number): 80007 +// Id's are bound by 222 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 65 158 + EntryPoint Fragment 4 "main" 69 170 ExecutionMode 4 OriginUpperLeft Source GLSL 420 Name 4 "main" @@ -50,12 +50,12 @@ spv.accessChain.frag Name 62 "GetColor13(struct-S-vf31;i1;" Name 60 "i" Name 61 "comp" - Name 65 "OutColor" - Name 153 "s" - Name 158 "u" - Name 159 "param" - Name 163 "param" - Name 167 "param" + Name 66 "GetColor14(struct-S-vf31;i1;" + Name 64 "i" + Name 65 "comp" + Name 69 "OutColor" + Name 165 "s" + Name 170 "u" Name 171 "param" Name 175 "param" Name 179 "param" @@ -65,8 +65,12 @@ spv.accessChain.frag Name 195 "param" Name 199 "param" Name 203 "param" - Decorate 65(OutColor) Location 0 - Decorate 158(u) Flat + Name 207 "param" + Name 211 "param" + Name 215 "param" + Name 219 "param" + Decorate 69(OutColor) Location 0 + Decorate 170(u) Flat 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -76,25 +80,27 @@ spv.accessChain.frag 13: TypeInt 32 1 14: TypePointer Function 13(int) 15: TypeFunction 2 8(S) 14(ptr) - 64: TypePointer Output 7(fvec3) - 65(OutColor): 64(ptr) Variable Output - 66: 13(int) Constant 0 - 67: TypeInt 32 0 - 68: 67(int) Constant 0 - 95: TypeVector 6(float) 2 - 109: 67(int) Constant 2 - 136: TypePointer Output 6(float) - 150: 6(float) Constant 0 - 151: 7(fvec3) ConstantComposite 150 150 150 - 152: TypePointer Function 8(S) - 157: TypePointer Input 13(int) - 158(u): 157(ptr) Variable Input + 68: TypePointer Output 7(fvec3) + 69(OutColor): 68(ptr) Variable Output + 70: 13(int) Constant 0 + 71: TypeInt 32 0 + 72: 71(int) Constant 0 + 99: TypeVector 6(float) 2 + 113: 71(int) Constant 2 + 140: TypePointer Output 6(float) + 147: 71(int) Constant 1 + 148: TypeVector 71(int) 2 + 149: 148(ivec2) ConstantComposite 113 147 + 158: TypeVector 71(int) 3 + 159: 158(ivec3) ConstantComposite 113 147 72 + 162: 6(float) Constant 0 + 163: 7(fvec3) ConstantComposite 162 162 162 + 164: TypePointer Function 8(S) + 169: TypePointer Input 13(int) + 170(u): 169(ptr) Variable Input 4(main): 2 Function None 3 5: Label - 153(s): 152(ptr) Variable Function - 159(param): 14(ptr) Variable Function - 163(param): 14(ptr) Variable Function - 167(param): 14(ptr) Variable Function + 165(s): 164(ptr) Variable Function 171(param): 14(ptr) Variable Function 175(param): 14(ptr) Variable Function 179(param): 14(ptr) Variable Function @@ -104,224 +110,242 @@ spv.accessChain.frag 195(param): 14(ptr) Variable Function 199(param): 14(ptr) Variable Function 203(param): 14(ptr) Variable Function - Store 65(OutColor) 151 - 154: 8(S) Load 153(s) - 155: 2 FunctionCall 11(GetColor1(struct-S-vf31;) 154 - 156: 8(S) Load 153(s) - 160: 13(int) Load 158(u) - Store 159(param) 160 - 161: 2 FunctionCall 18(GetColor2(struct-S-vf31;i1;) 156 159(param) - 162: 8(S) Load 153(s) - 164: 13(int) Load 158(u) - Store 163(param) 164 - 165: 2 FunctionCall 22(GetColor3(struct-S-vf31;i1;) 162 163(param) - 166: 8(S) Load 153(s) - 168: 13(int) Load 158(u) - Store 167(param) 168 - 169: 2 FunctionCall 26(GetColor4(struct-S-vf31;i1;) 166 167(param) - 170: 8(S) Load 153(s) - 172: 13(int) Load 158(u) + 207(param): 14(ptr) Variable Function + 211(param): 14(ptr) Variable Function + 215(param): 14(ptr) Variable Function + 219(param): 14(ptr) Variable Function + Store 69(OutColor) 163 + 166: 8(S) Load 165(s) + 167: 2 FunctionCall 11(GetColor1(struct-S-vf31;) 166 + 168: 8(S) Load 165(s) + 172: 13(int) Load 170(u) Store 171(param) 172 - 173: 2 FunctionCall 30(GetColor5(struct-S-vf31;i1;) 170 171(param) - 174: 8(S) Load 153(s) - 176: 13(int) Load 158(u) + 173: 2 FunctionCall 18(GetColor2(struct-S-vf31;i1;) 168 171(param) + 174: 8(S) Load 165(s) + 176: 13(int) Load 170(u) Store 175(param) 176 - 177: 2 FunctionCall 34(GetColor6(struct-S-vf31;i1;) 174 175(param) - 178: 8(S) Load 153(s) - 180: 13(int) Load 158(u) + 177: 2 FunctionCall 22(GetColor3(struct-S-vf31;i1;) 174 175(param) + 178: 8(S) Load 165(s) + 180: 13(int) Load 170(u) Store 179(param) 180 - 181: 2 FunctionCall 38(GetColor7(struct-S-vf31;i1;) 178 179(param) - 182: 8(S) Load 153(s) - 184: 13(int) Load 158(u) + 181: 2 FunctionCall 26(GetColor4(struct-S-vf31;i1;) 178 179(param) + 182: 8(S) Load 165(s) + 184: 13(int) Load 170(u) Store 183(param) 184 - 185: 2 FunctionCall 42(GetColor8(struct-S-vf31;i1;) 182 183(param) - 186: 8(S) Load 153(s) - 188: 13(int) Load 158(u) + 185: 2 FunctionCall 30(GetColor5(struct-S-vf31;i1;) 182 183(param) + 186: 8(S) Load 165(s) + 188: 13(int) Load 170(u) Store 187(param) 188 - 189: 2 FunctionCall 46(GetColor9(struct-S-vf31;i1;) 186 187(param) - 190: 8(S) Load 153(s) - 192: 13(int) Load 158(u) + 189: 2 FunctionCall 34(GetColor6(struct-S-vf31;i1;) 186 187(param) + 190: 8(S) Load 165(s) + 192: 13(int) Load 170(u) Store 191(param) 192 - 193: 2 FunctionCall 50(GetColor10(struct-S-vf31;i1;) 190 191(param) - 194: 8(S) Load 153(s) - 196: 13(int) Load 158(u) + 193: 2 FunctionCall 38(GetColor7(struct-S-vf31;i1;) 190 191(param) + 194: 8(S) Load 165(s) + 196: 13(int) Load 170(u) Store 195(param) 196 - 197: 2 FunctionCall 54(GetColor11(struct-S-vf31;i1;) 194 195(param) - 198: 8(S) Load 153(s) - 200: 13(int) Load 158(u) + 197: 2 FunctionCall 42(GetColor8(struct-S-vf31;i1;) 194 195(param) + 198: 8(S) Load 165(s) + 200: 13(int) Load 170(u) Store 199(param) 200 - 201: 2 FunctionCall 58(GetColor12(struct-S-vf31;i1;) 198 199(param) - 202: 8(S) Load 153(s) - 204: 13(int) Load 158(u) + 201: 2 FunctionCall 46(GetColor9(struct-S-vf31;i1;) 198 199(param) + 202: 8(S) Load 165(s) + 204: 13(int) Load 170(u) Store 203(param) 204 - 205: 2 FunctionCall 62(GetColor13(struct-S-vf31;i1;) 202 203(param) + 205: 2 FunctionCall 50(GetColor10(struct-S-vf31;i1;) 202 203(param) + 206: 8(S) Load 165(s) + 208: 13(int) Load 170(u) + Store 207(param) 208 + 209: 2 FunctionCall 54(GetColor11(struct-S-vf31;i1;) 206 207(param) + 210: 8(S) Load 165(s) + 212: 13(int) Load 170(u) + Store 211(param) 212 + 213: 2 FunctionCall 58(GetColor12(struct-S-vf31;i1;) 210 211(param) + 214: 8(S) Load 165(s) + 216: 13(int) Load 170(u) + Store 215(param) 216 + 217: 2 FunctionCall 62(GetColor13(struct-S-vf31;i1;) 214 215(param) + 218: 8(S) Load 165(s) + 220: 13(int) Load 170(u) + Store 219(param) 220 + 221: 2 FunctionCall 66(GetColor14(struct-S-vf31;i1;) 218 219(param) Return FunctionEnd 11(GetColor1(struct-S-vf31;): 2 Function None 9 10(i): 8(S) FunctionParameter 12: Label - 69: 6(float) CompositeExtract 10(i) 0 0 - 70: 7(fvec3) Load 65(OutColor) - 71: 7(fvec3) CompositeConstruct 69 69 69 - 72: 7(fvec3) FAdd 70 71 - Store 65(OutColor) 72 + 73: 6(float) CompositeExtract 10(i) 0 0 + 74: 7(fvec3) Load 69(OutColor) + 75: 7(fvec3) CompositeConstruct 73 73 73 + 76: 7(fvec3) FAdd 74 75 + Store 69(OutColor) 76 Return FunctionEnd 18(GetColor2(struct-S-vf31;i1;): 2 Function None 15 16(i): 8(S) FunctionParameter 17(comp): 14(ptr) FunctionParameter 19: Label - 73: 13(int) Load 17(comp) - 74: 7(fvec3) CompositeExtract 16(i) 0 - 75: 6(float) VectorExtractDynamic 74 73 - 76: 7(fvec3) Load 65(OutColor) - 77: 7(fvec3) CompositeConstruct 75 75 75 - 78: 7(fvec3) FAdd 76 77 - Store 65(OutColor) 78 + 77: 13(int) Load 17(comp) + 78: 7(fvec3) CompositeExtract 16(i) 0 + 79: 6(float) VectorExtractDynamic 78 77 + 80: 7(fvec3) Load 69(OutColor) + 81: 7(fvec3) CompositeConstruct 79 79 79 + 82: 7(fvec3) FAdd 80 81 + Store 69(OutColor) 82 Return FunctionEnd 22(GetColor3(struct-S-vf31;i1;): 2 Function None 15 20(i): 8(S) FunctionParameter 21(comp): 14(ptr) FunctionParameter 23: Label - 79: 13(int) Load 21(comp) - 80: 7(fvec3) CompositeExtract 20(i) 0 - 81: 6(float) VectorExtractDynamic 80 79 - 82: 7(fvec3) Load 65(OutColor) - 83: 7(fvec3) CompositeConstruct 81 81 81 - 84: 7(fvec3) FAdd 82 83 - Store 65(OutColor) 84 + 83: 13(int) Load 21(comp) + 84: 7(fvec3) CompositeExtract 20(i) 0 + 85: 6(float) VectorExtractDynamic 84 83 + 86: 7(fvec3) Load 69(OutColor) + 87: 7(fvec3) CompositeConstruct 85 85 85 + 88: 7(fvec3) FAdd 86 87 + Store 69(OutColor) 88 Return FunctionEnd 26(GetColor4(struct-S-vf31;i1;): 2 Function None 15 24(i): 8(S) FunctionParameter 25(comp): 14(ptr) FunctionParameter 27: Label - 85: 13(int) Load 25(comp) - 86: 7(fvec3) CompositeExtract 24(i) 0 - 87: 6(float) VectorExtractDynamic 86 85 - 88: 7(fvec3) Load 65(OutColor) - 89: 7(fvec3) CompositeConstruct 87 87 87 - 90: 7(fvec3) FAdd 88 89 - Store 65(OutColor) 90 + 89: 13(int) Load 25(comp) + 90: 7(fvec3) CompositeExtract 24(i) 0 + 91: 6(float) VectorExtractDynamic 90 89 + 92: 7(fvec3) Load 69(OutColor) + 93: 7(fvec3) CompositeConstruct 91 91 91 + 94: 7(fvec3) FAdd 92 93 + Store 69(OutColor) 94 Return FunctionEnd 30(GetColor5(struct-S-vf31;i1;): 2 Function None 15 28(i): 8(S) FunctionParameter 29(comp): 14(ptr) FunctionParameter 31: Label - 91: 7(fvec3) CompositeExtract 28(i) 0 - 92: 7(fvec3) Load 65(OutColor) - 93: 7(fvec3) FAdd 92 91 - Store 65(OutColor) 93 + 95: 7(fvec3) CompositeExtract 28(i) 0 + 96: 7(fvec3) Load 69(OutColor) + 97: 7(fvec3) FAdd 96 95 + Store 69(OutColor) 97 Return FunctionEnd 34(GetColor6(struct-S-vf31;i1;): 2 Function None 15 32(i): 8(S) FunctionParameter 33(comp): 14(ptr) FunctionParameter 35: Label - 94: 13(int) Load 33(comp) - 96: 7(fvec3) CompositeExtract 32(i) 0 - 97: 95(fvec2) VectorShuffle 96 96 1 0 - 98: 6(float) VectorExtractDynamic 97 94 - 99: 7(fvec3) Load 65(OutColor) - 100: 7(fvec3) CompositeConstruct 98 98 98 - 101: 7(fvec3) FAdd 99 100 - Store 65(OutColor) 101 + 98: 13(int) Load 33(comp) + 100: 7(fvec3) CompositeExtract 32(i) 0 + 101: 99(fvec2) VectorShuffle 100 100 1 0 + 102: 6(float) VectorExtractDynamic 101 98 + 103: 7(fvec3) Load 69(OutColor) + 104: 7(fvec3) CompositeConstruct 102 102 102 + 105: 7(fvec3) FAdd 103 104 + Store 69(OutColor) 105 Return FunctionEnd 38(GetColor7(struct-S-vf31;i1;): 2 Function None 15 36(i): 8(S) FunctionParameter 37(comp): 14(ptr) FunctionParameter 39: Label - 102: 7(fvec3) CompositeExtract 36(i) 0 - 103: 95(fvec2) VectorShuffle 102 102 0 1 - 104: 7(fvec3) Load 65(OutColor) - 105: 95(fvec2) VectorShuffle 104 104 0 1 - 106: 95(fvec2) FAdd 105 103 - 107: 7(fvec3) Load 65(OutColor) - 108: 7(fvec3) VectorShuffle 107 106 3 4 2 - Store 65(OutColor) 108 + 106: 7(fvec3) CompositeExtract 36(i) 0 + 107: 99(fvec2) VectorShuffle 106 106 0 1 + 108: 7(fvec3) Load 69(OutColor) + 109: 99(fvec2) VectorShuffle 108 108 0 1 + 110: 99(fvec2) FAdd 109 107 + 111: 7(fvec3) Load 69(OutColor) + 112: 7(fvec3) VectorShuffle 111 110 3 4 2 + Store 69(OutColor) 112 Return FunctionEnd 42(GetColor8(struct-S-vf31;i1;): 2 Function None 15 40(i): 8(S) FunctionParameter 41(comp): 14(ptr) FunctionParameter 43: Label - 110: 6(float) CompositeExtract 40(i) 0 2 - 111: 7(fvec3) Load 65(OutColor) - 112: 7(fvec3) CompositeConstruct 110 110 110 - 113: 7(fvec3) FAdd 111 112 - Store 65(OutColor) 113 + 114: 6(float) CompositeExtract 40(i) 0 2 + 115: 7(fvec3) Load 69(OutColor) + 116: 7(fvec3) CompositeConstruct 114 114 114 + 117: 7(fvec3) FAdd 115 116 + Store 69(OutColor) 117 Return FunctionEnd 46(GetColor9(struct-S-vf31;i1;): 2 Function None 15 44(i): 8(S) FunctionParameter 45(comp): 14(ptr) FunctionParameter 47: Label - 114: 7(fvec3) CompositeExtract 44(i) 0 - 115: 7(fvec3) Load 65(OutColor) - 116: 7(fvec3) VectorShuffle 115 115 2 0 1 - 117: 7(fvec3) FAdd 116 114 - 118: 7(fvec3) Load 65(OutColor) - 119: 7(fvec3) VectorShuffle 118 117 4 5 3 - Store 65(OutColor) 119 + 118: 7(fvec3) CompositeExtract 44(i) 0 + 119: 7(fvec3) Load 69(OutColor) + 120: 7(fvec3) VectorShuffle 119 119 2 0 1 + 121: 7(fvec3) FAdd 120 118 + 122: 7(fvec3) Load 69(OutColor) + 123: 7(fvec3) VectorShuffle 122 121 4 5 3 + Store 69(OutColor) 123 Return FunctionEnd 50(GetColor10(struct-S-vf31;i1;): 2 Function None 15 48(i): 8(S) FunctionParameter 49(comp): 14(ptr) FunctionParameter 51: Label - 120: 7(fvec3) CompositeExtract 48(i) 0 - 121: 95(fvec2) VectorShuffle 120 120 0 1 - 122: 7(fvec3) Load 65(OutColor) - 123: 95(fvec2) VectorShuffle 122 122 2 1 - 124: 95(fvec2) FAdd 123 121 - 125: 7(fvec3) Load 65(OutColor) - 126: 7(fvec3) VectorShuffle 125 124 0 4 3 - Store 65(OutColor) 126 + 124: 7(fvec3) CompositeExtract 48(i) 0 + 125: 99(fvec2) VectorShuffle 124 124 0 1 + 126: 7(fvec3) Load 69(OutColor) + 127: 99(fvec2) VectorShuffle 126 126 2 1 + 128: 99(fvec2) FAdd 127 125 + 129: 7(fvec3) Load 69(OutColor) + 130: 7(fvec3) VectorShuffle 129 128 0 4 3 + Store 69(OutColor) 130 Return FunctionEnd 54(GetColor11(struct-S-vf31;i1;): 2 Function None 15 52(i): 8(S) FunctionParameter 53(comp): 14(ptr) FunctionParameter 55: Label - 127: 7(fvec3) CompositeExtract 52(i) 0 - 128: 95(fvec2) VectorShuffle 127 127 0 1 - 129: 7(fvec3) Load 65(OutColor) - 130: 95(fvec2) VectorShuffle 129 129 0 2 - 131: 95(fvec2) FAdd 130 128 - 132: 7(fvec3) Load 65(OutColor) - 133: 7(fvec3) VectorShuffle 132 131 3 1 4 - Store 65(OutColor) 133 + 131: 7(fvec3) CompositeExtract 52(i) 0 + 132: 99(fvec2) VectorShuffle 131 131 0 1 + 133: 7(fvec3) Load 69(OutColor) + 134: 99(fvec2) VectorShuffle 133 133 0 2 + 135: 99(fvec2) FAdd 134 132 + 136: 7(fvec3) Load 69(OutColor) + 137: 7(fvec3) VectorShuffle 136 135 3 1 4 + Store 69(OutColor) 137 Return FunctionEnd 58(GetColor12(struct-S-vf31;i1;): 2 Function None 15 56(i): 8(S) FunctionParameter 57(comp): 14(ptr) FunctionParameter 59: Label - 134: 13(int) Load 57(comp) - 135: 6(float) CompositeExtract 56(i) 0 0 - 137: 136(ptr) AccessChain 65(OutColor) 134 - 138: 6(float) Load 137 - 139: 6(float) FAdd 138 135 - 140: 136(ptr) AccessChain 65(OutColor) 134 - Store 140 139 + 138: 13(int) Load 57(comp) + 139: 6(float) CompositeExtract 56(i) 0 0 + 141: 140(ptr) AccessChain 69(OutColor) 138 + 142: 6(float) Load 141 + 143: 6(float) FAdd 142 139 + 144: 140(ptr) AccessChain 69(OutColor) 138 + Store 144 143 Return FunctionEnd 62(GetColor13(struct-S-vf31;i1;): 2 Function None 15 60(i): 8(S) FunctionParameter 61(comp): 14(ptr) FunctionParameter 63: Label - 141: 13(int) Load 61(comp) - 142: 6(float) CompositeExtract 60(i) 0 0 - 143: 7(fvec3) Load 65(OutColor) - 144: 95(fvec2) VectorShuffle 143 143 2 1 - 145: 6(float) VectorExtractDynamic 144 141 - 146: 6(float) FAdd 145 142 - 147: 7(fvec3) Load 65(OutColor) - 148: 7(fvec3) VectorShuffle 147 147 2 1 2 - 149: 7(fvec3) VectorInsertDynamic 148 146 141 - Store 65(OutColor) 149 + 145: 13(int) Load 61(comp) + 146: 6(float) CompositeExtract 60(i) 0 0 + 150: 71(int) VectorExtractDynamic 149 145 + 151: 140(ptr) AccessChain 69(OutColor) 150 + 152: 6(float) Load 151 + 153: 6(float) FAdd 152 146 + 154: 71(int) VectorExtractDynamic 149 145 + 155: 140(ptr) AccessChain 69(OutColor) 154 + Store 155 153 + Return + FunctionEnd +66(GetColor14(struct-S-vf31;i1;): 2 Function None 15 + 64(i): 8(S) FunctionParameter + 65(comp): 14(ptr) FunctionParameter + 67: Label + 156: 13(int) Load 65(comp) + 157: 6(float) CompositeExtract 64(i) 0 0 + 160: 71(int) VectorExtractDynamic 159 156 + 161: 140(ptr) AccessChain 69(OutColor) 160 + Store 161 157 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.aggOps.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.aggOps.frag.out index ca495c1884b..1c0c7e91c4a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.aggOps.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.aggOps.frag.out @@ -3,7 +3,7 @@ WARNING: 0:4: '' : all default precisions are highp; use precision statements to "precision mediump int; precision highp float;" // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 215 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard.frag.out index ac4c9f39286..8074cf82643 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard.frag.out @@ -1,6 +1,6 @@ spv.always-discard.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 84 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard2.frag.out index 5aed2e07772..e3fa43a394d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.always-discard2.frag.out @@ -1,6 +1,6 @@ spv.always-discard2.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 40 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out index b7ac2b669a4..f41c0121233 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.arbPostDepthCoverage.frag.out @@ -1,6 +1,6 @@ spv.arbPostDepthCoverage.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 18 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomic.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomic.comp.out index b64dc90b793..3dd88f398a4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomic.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomic.comp.out @@ -1,6 +1,6 @@ spv.atomic.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 74 Capability Shader @@ -47,7 +47,7 @@ spv.atomic.comp 8: TypeFunction 6(int) 7(ptr) 14: 6(int) Constant 1 15: 6(int) Constant 0 - 19: 6(int) Constant 1024 + 19: 6(int) Constant 1032 20(counter): 7(ptr) Variable AtomicCounter 22: TypePointer Function 6(int) 24: 6(int) Constant 4 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomicInt64.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomicInt64.comp.out index cbd7c1cbc6c..9c66aecc85f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomicInt64.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.atomicInt64.comp.out @@ -1,6 +1,6 @@ spv.atomicInt64.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 149 Capability Shader @@ -33,29 +33,29 @@ spv.atomicInt64.comp 2: TypeVoid 3: TypeFunction 2 6: TypeInt 64 1 - 7: TypePointer Function 6(int) - 9: 6(int) Constant 0 0 + 7: TypePointer Function 6(int64_t) + 9: 6(int64_t) Constant 0 0 10: TypeInt 64 0 - 11: TypePointer Function 10(int) - 13: 10(int) Constant 0 0 - 14(Buffer): TypeStruct 6(int) 10(int) + 11: TypePointer Function 10(int64_t) + 13: 10(int64_t) Constant 0 0 + 14(Buffer): TypeStruct 6(int64_t) 10(int64_t) 15: TypePointer Uniform 14(Buffer) 16(buf): 15(ptr) Variable Uniform 17: TypeInt 32 1 18: 17(int) Constant 0 - 19: TypePointer Uniform 6(int) - 21: 6(int) Constant 4294967272 4294967295 + 19: TypePointer Uniform 6(int64_t) + 21: 6(int64_t) Constant 4294967272 4294967295 22: TypeInt 32 0 23: 22(int) Constant 1 24: 22(int) Constant 0 28: 17(int) Constant 1 - 29: TypePointer Uniform 10(int) - 31: 10(int) Constant 15 0 - 84(Struct): TypeStruct 6(int) 10(int) + 29: TypePointer Uniform 10(int64_t) + 31: 10(int64_t) Constant 15 240 + 84(Struct): TypeStruct 6(int64_t) 10(int64_t) 85: TypePointer Workgroup 84(Struct) 86(s): 85(ptr) Variable Workgroup - 87: TypePointer Workgroup 6(int) - 92: TypePointer Workgroup 10(int) + 87: TypePointer Workgroup 6(int64_t) + 92: TypePointer Workgroup 10(int64_t) 146: TypeVector 22(int) 3 147: 22(int) Constant 16 148: 146(ivec3) ConstantComposite 147 147 23 @@ -66,149 +66,149 @@ spv.atomicInt64.comp Store 8(i64) 9 Store 12(u64) 13 20: 19(ptr) AccessChain 16(buf) 18 - 25: 6(int) AtomicSMin 20 23 24 21 - 26: 6(int) Load 8(i64) - 27: 6(int) IAdd 26 25 + 25: 6(int64_t) AtomicSMin 20 23 24 21 + 26: 6(int64_t) Load 8(i64) + 27: 6(int64_t) IAdd 26 25 Store 8(i64) 27 30: 29(ptr) AccessChain 16(buf) 28 - 32: 10(int) AtomicUMin 30 23 24 31 - 33: 10(int) Load 12(u64) - 34: 10(int) IAdd 33 32 + 32: 10(int64_t) AtomicUMin 30 23 24 31 + 33: 10(int64_t) Load 12(u64) + 34: 10(int64_t) IAdd 33 32 Store 12(u64) 34 35: 19(ptr) AccessChain 16(buf) 18 - 36: 6(int) AtomicSMax 35 23 24 21 - 37: 6(int) Load 8(i64) - 38: 6(int) IAdd 37 36 + 36: 6(int64_t) AtomicSMax 35 23 24 21 + 37: 6(int64_t) Load 8(i64) + 38: 6(int64_t) IAdd 37 36 Store 8(i64) 38 39: 29(ptr) AccessChain 16(buf) 28 - 40: 10(int) AtomicUMax 39 23 24 31 - 41: 10(int) Load 12(u64) - 42: 10(int) IAdd 41 40 + 40: 10(int64_t) AtomicUMax 39 23 24 31 + 41: 10(int64_t) Load 12(u64) + 42: 10(int64_t) IAdd 41 40 Store 12(u64) 42 43: 19(ptr) AccessChain 16(buf) 18 - 44: 6(int) AtomicAnd 43 23 24 21 - 45: 6(int) Load 8(i64) - 46: 6(int) IAdd 45 44 + 44: 6(int64_t) AtomicAnd 43 23 24 21 + 45: 6(int64_t) Load 8(i64) + 46: 6(int64_t) IAdd 45 44 Store 8(i64) 46 47: 29(ptr) AccessChain 16(buf) 28 - 48: 10(int) AtomicAnd 47 23 24 31 - 49: 10(int) Load 12(u64) - 50: 10(int) IAdd 49 48 + 48: 10(int64_t) AtomicAnd 47 23 24 31 + 49: 10(int64_t) Load 12(u64) + 50: 10(int64_t) IAdd 49 48 Store 12(u64) 50 51: 19(ptr) AccessChain 16(buf) 18 - 52: 6(int) AtomicOr 51 23 24 21 - 53: 6(int) Load 8(i64) - 54: 6(int) IAdd 53 52 + 52: 6(int64_t) AtomicOr 51 23 24 21 + 53: 6(int64_t) Load 8(i64) + 54: 6(int64_t) IAdd 53 52 Store 8(i64) 54 55: 29(ptr) AccessChain 16(buf) 28 - 56: 10(int) AtomicOr 55 23 24 31 - 57: 10(int) Load 12(u64) - 58: 10(int) IAdd 57 56 + 56: 10(int64_t) AtomicOr 55 23 24 31 + 57: 10(int64_t) Load 12(u64) + 58: 10(int64_t) IAdd 57 56 Store 12(u64) 58 59: 19(ptr) AccessChain 16(buf) 18 - 60: 6(int) AtomicXor 59 23 24 21 - 61: 6(int) Load 8(i64) - 62: 6(int) IAdd 61 60 + 60: 6(int64_t) AtomicXor 59 23 24 21 + 61: 6(int64_t) Load 8(i64) + 62: 6(int64_t) IAdd 61 60 Store 8(i64) 62 63: 29(ptr) AccessChain 16(buf) 28 - 64: 10(int) AtomicXor 63 23 24 31 - 65: 10(int) Load 12(u64) - 66: 10(int) IAdd 65 64 + 64: 10(int64_t) AtomicXor 63 23 24 31 + 65: 10(int64_t) Load 12(u64) + 66: 10(int64_t) IAdd 65 64 Store 12(u64) 66 67: 19(ptr) AccessChain 16(buf) 18 - 68: 6(int) AtomicIAdd 67 23 24 21 - 69: 6(int) Load 8(i64) - 70: 6(int) IAdd 69 68 + 68: 6(int64_t) AtomicIAdd 67 23 24 21 + 69: 6(int64_t) Load 8(i64) + 70: 6(int64_t) IAdd 69 68 Store 8(i64) 70 71: 19(ptr) AccessChain 16(buf) 18 - 72: 6(int) AtomicExchange 71 23 24 21 - 73: 6(int) Load 8(i64) - 74: 6(int) IAdd 73 72 + 72: 6(int64_t) AtomicExchange 71 23 24 21 + 73: 6(int64_t) Load 8(i64) + 74: 6(int64_t) IAdd 73 72 Store 8(i64) 74 75: 19(ptr) AccessChain 16(buf) 18 - 76: 6(int) Load 8(i64) - 77: 6(int) AtomicCompareExchange 75 23 24 24 76 21 - 78: 6(int) Load 8(i64) - 79: 6(int) IAdd 78 77 + 76: 6(int64_t) Load 8(i64) + 77: 6(int64_t) AtomicCompareExchange 75 23 24 24 76 21 + 78: 6(int64_t) Load 8(i64) + 79: 6(int64_t) IAdd 78 77 Store 8(i64) 79 - 80: 6(int) Load 8(i64) + 80: 6(int64_t) Load 8(i64) 81: 19(ptr) AccessChain 16(buf) 18 Store 81 80 - 82: 10(int) Load 12(u64) + 82: 10(int64_t) Load 12(u64) 83: 29(ptr) AccessChain 16(buf) 28 Store 83 82 Store 8(i64) 9 Store 12(u64) 13 88: 87(ptr) AccessChain 86(s) 18 - 89: 6(int) AtomicSMin 88 23 24 21 - 90: 6(int) Load 8(i64) - 91: 6(int) IAdd 90 89 + 89: 6(int64_t) AtomicSMin 88 23 24 21 + 90: 6(int64_t) Load 8(i64) + 91: 6(int64_t) IAdd 90 89 Store 8(i64) 91 93: 92(ptr) AccessChain 86(s) 28 - 94: 10(int) AtomicUMin 93 23 24 31 - 95: 10(int) Load 12(u64) - 96: 10(int) IAdd 95 94 + 94: 10(int64_t) AtomicUMin 93 23 24 31 + 95: 10(int64_t) Load 12(u64) + 96: 10(int64_t) IAdd 95 94 Store 12(u64) 96 97: 87(ptr) AccessChain 86(s) 18 - 98: 6(int) AtomicSMax 97 23 24 21 - 99: 6(int) Load 8(i64) - 100: 6(int) IAdd 99 98 + 98: 6(int64_t) AtomicSMax 97 23 24 21 + 99: 6(int64_t) Load 8(i64) + 100: 6(int64_t) IAdd 99 98 Store 8(i64) 100 101: 92(ptr) AccessChain 86(s) 28 - 102: 10(int) AtomicUMax 101 23 24 31 - 103: 10(int) Load 12(u64) - 104: 10(int) IAdd 103 102 + 102: 10(int64_t) AtomicUMax 101 23 24 31 + 103: 10(int64_t) Load 12(u64) + 104: 10(int64_t) IAdd 103 102 Store 12(u64) 104 105: 87(ptr) AccessChain 86(s) 18 - 106: 6(int) AtomicAnd 105 23 24 21 - 107: 6(int) Load 8(i64) - 108: 6(int) IAdd 107 106 + 106: 6(int64_t) AtomicAnd 105 23 24 21 + 107: 6(int64_t) Load 8(i64) + 108: 6(int64_t) IAdd 107 106 Store 8(i64) 108 109: 92(ptr) AccessChain 86(s) 28 - 110: 10(int) AtomicAnd 109 23 24 31 - 111: 10(int) Load 12(u64) - 112: 10(int) IAdd 111 110 + 110: 10(int64_t) AtomicAnd 109 23 24 31 + 111: 10(int64_t) Load 12(u64) + 112: 10(int64_t) IAdd 111 110 Store 12(u64) 112 113: 87(ptr) AccessChain 86(s) 18 - 114: 6(int) AtomicOr 113 23 24 21 - 115: 6(int) Load 8(i64) - 116: 6(int) IAdd 115 114 + 114: 6(int64_t) AtomicOr 113 23 24 21 + 115: 6(int64_t) Load 8(i64) + 116: 6(int64_t) IAdd 115 114 Store 8(i64) 116 117: 92(ptr) AccessChain 86(s) 28 - 118: 10(int) AtomicOr 117 23 24 31 - 119: 10(int) Load 12(u64) - 120: 10(int) IAdd 119 118 + 118: 10(int64_t) AtomicOr 117 23 24 31 + 119: 10(int64_t) Load 12(u64) + 120: 10(int64_t) IAdd 119 118 Store 12(u64) 120 121: 87(ptr) AccessChain 86(s) 18 - 122: 6(int) AtomicXor 121 23 24 21 - 123: 6(int) Load 8(i64) - 124: 6(int) IAdd 123 122 + 122: 6(int64_t) AtomicXor 121 23 24 21 + 123: 6(int64_t) Load 8(i64) + 124: 6(int64_t) IAdd 123 122 Store 8(i64) 124 125: 92(ptr) AccessChain 86(s) 28 - 126: 10(int) AtomicXor 125 23 24 31 - 127: 10(int) Load 12(u64) - 128: 10(int) IAdd 127 126 + 126: 10(int64_t) AtomicXor 125 23 24 31 + 127: 10(int64_t) Load 12(u64) + 128: 10(int64_t) IAdd 127 126 Store 12(u64) 128 129: 87(ptr) AccessChain 86(s) 18 - 130: 6(int) AtomicIAdd 129 23 24 21 - 131: 6(int) Load 8(i64) - 132: 6(int) IAdd 131 130 + 130: 6(int64_t) AtomicIAdd 129 23 24 21 + 131: 6(int64_t) Load 8(i64) + 132: 6(int64_t) IAdd 131 130 Store 8(i64) 132 133: 87(ptr) AccessChain 86(s) 18 - 134: 6(int) AtomicExchange 133 23 24 21 - 135: 6(int) Load 8(i64) - 136: 6(int) IAdd 135 134 + 134: 6(int64_t) AtomicExchange 133 23 24 21 + 135: 6(int64_t) Load 8(i64) + 136: 6(int64_t) IAdd 135 134 Store 8(i64) 136 137: 87(ptr) AccessChain 86(s) 18 - 138: 6(int) Load 8(i64) - 139: 6(int) AtomicCompareExchange 137 23 24 24 138 21 - 140: 6(int) Load 8(i64) - 141: 6(int) IAdd 140 139 + 138: 6(int64_t) Load 8(i64) + 139: 6(int64_t) AtomicCompareExchange 137 23 24 24 138 21 + 140: 6(int64_t) Load 8(i64) + 141: 6(int64_t) IAdd 140 139 Store 8(i64) 141 - 142: 6(int) Load 8(i64) + 142: 6(int64_t) Load 8(i64) 143: 87(ptr) AccessChain 86(s) 18 Store 143 142 - 144: 10(int) Load 12(u64) + 144: 10(int64_t) Load 12(u64) 145: 92(ptr) AccessChain 86(s) 28 Store 145 144 Return diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.barrier.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.barrier.vert.out new file mode 100644 index 00000000000..b9369f27913 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.barrier.vert.out @@ -0,0 +1,46 @@ +spv.barrier.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 24 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 9 15 + Source GLSL 450 + Name 4 "main" + Name 9 "c0" + Name 15 "c1" + Decorate 9(c0) Location 0 + Decorate 15(c1) Location 1 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(c0): 8(ptr) Variable Output + 10: 6(float) Constant 1065353216 + 11: 7(fvec4) ConstantComposite 10 10 10 10 + 12: TypeInt 32 0 + 13: 12(int) Constant 1 + 14: 12(int) Constant 3400 + 15(c1): 8(ptr) Variable Output + 16: 12(int) Constant 72 + 20: 12(int) Constant 2056 + 4(main): 2 Function None 3 + 5: Label + Store 9(c0) 11 + MemoryBarrier 13 14 + Store 15(c1) 11 + MemoryBarrier 13 16 + 17: 7(fvec4) Load 9(c0) + 18: 7(fvec4) CompositeConstruct 10 10 10 10 + 19: 7(fvec4) FAdd 17 18 + Store 9(c0) 19 + MemoryBarrier 13 20 + 21: 7(fvec4) Load 9(c0) + 22: 7(fvec4) CompositeConstruct 10 10 10 10 + 23: 7(fvec4) FAdd 21 22 + Store 9(c0) 23 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bitCast.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bitCast.frag.out index 75662132be4..a687b8da2e4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bitCast.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bitCast.frag.out @@ -1,6 +1,6 @@ spv.bitCast.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 172 Capability Shader @@ -86,8 +86,8 @@ spv.bitCast.frag 148(u4): 147(ptr) Variable Input 153: TypePointer Output 46(fvec4) 154(fragColor): 153(ptr) Variable Output - 159: TypeBool - 160: TypeVector 159(bool) 4 + 158: TypeBool + 159: TypeVector 158(bool) 4 168: 12(float) Constant 1045220557 169: 46(fvec4) ConstantComposite 168 168 168 168 4(main): 2 Function None 3 @@ -95,7 +95,7 @@ spv.bitCast.frag 9(idata): 8(ptr) Variable Function 55(udata): 54(ptr) Variable Function 85(fdata): 84(ptr) Variable Function - 155: 84(ptr) Variable Function + 162: 84(ptr) Variable Function Store 9(idata) 11 15: 12(float) Load 14(f1) 16: 6(int) Bitcast 15 @@ -211,24 +211,24 @@ spv.bitCast.frag 151: 46(fvec4) Load 85(fdata) 152: 46(fvec4) FAdd 151 150 Store 85(fdata) 152 - 156: 7(ivec4) Load 9(idata) - 157: 53(ivec4) Bitcast 156 - 158: 53(ivec4) Load 55(udata) - 161: 160(bvec4) IEqual 157 158 - 162: 159(bool) All 161 + 155: 7(ivec4) Load 9(idata) + 156: 53(ivec4) Bitcast 155 + 157: 53(ivec4) Load 55(udata) + 160: 159(bvec4) IEqual 156 157 + 161: 158(bool) All 160 SelectionMerge 164 None - BranchConditional 162 163 166 + BranchConditional 161 163 166 163: Label 165: 46(fvec4) Load 85(fdata) - Store 155 165 + Store 162 165 Branch 164 166: Label 167: 46(fvec4) Load 85(fdata) 170: 46(fvec4) FAdd 167 169 - Store 155 170 + Store 162 170 Branch 164 164: Label - 171: 46(fvec4) Load 155 + 171: 46(fvec4) Load 162 Store 154(fragColor) 171 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bool.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bool.vert.out index 5f02671a34a..becd707a0c1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bool.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.bool.vert.out @@ -1,6 +1,6 @@ spv.bool.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 46 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.boolInBlock.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.boolInBlock.frag.out index 6102c4a184f..e86ca6b3f78 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.boolInBlock.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.boolInBlock.frag.out @@ -1,12 +1,12 @@ spv.boolInBlock.frag // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 107 +// Generated by (magic number): 80007 +// Id's are bound by 102 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 75 + EntryPoint Fragment 4 "main" 74 ExecutionMode 4 OriginUpperLeft Source GLSL 450 Name 4 "main" @@ -14,24 +14,24 @@ spv.boolInBlock.frag Name 12 "paramb4" Name 13 "paramb2" Name 17 "b1" - Name 24 "Buffer" - MemberName 24(Buffer) 0 "b2" - Name 26 "" - Name 39 "Uniform" - MemberName 39(Uniform) 0 "b4" - Name 41 "" - Name 62 "param" - Name 67 "param" - Name 75 "fragColor" - MemberDecorate 24(Buffer) 0 Offset 0 - Decorate 24(Buffer) BufferBlock - Decorate 26 DescriptorSet 0 - Decorate 26 Binding 1 - MemberDecorate 39(Uniform) 0 Offset 0 - Decorate 39(Uniform) Block - Decorate 41 DescriptorSet 0 - Decorate 41 Binding 0 - Decorate 75(fragColor) Location 0 + Name 25 "Buffer" + MemberName 25(Buffer) 0 "b2" + Name 27 "" + Name 40 "Uniform" + MemberName 40(Uniform) 0 "b4" + Name 42 "" + Name 60 "param" + Name 66 "param" + Name 74 "fragColor" + MemberDecorate 25(Buffer) 0 Offset 0 + Decorate 25(Buffer) BufferBlock + Decorate 27 DescriptorSet 0 + Decorate 27 Binding 1 + MemberDecorate 40(Uniform) 0 Offset 0 + Decorate 40(Uniform) Block + Decorate 42 DescriptorSet 0 + Decorate 42 Binding 0 + Decorate 74(fragColor) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeBool @@ -41,111 +41,106 @@ spv.boolInBlock.frag 10: TypePointer Function 9(bvec2) 11: TypeFunction 2 8(ptr) 10(ptr) 16: TypePointer Function 6(bool) - 22: TypeInt 32 0 - 23: TypeVector 22(int) 2 - 24(Buffer): TypeStruct 23(ivec2) - 25: TypePointer Uniform 24(Buffer) - 26: 25(ptr) Variable Uniform - 27: TypeInt 32 1 - 28: 27(int) Constant 0 - 29: 6(bool) ConstantFalse - 30: 9(bvec2) ConstantComposite 29 29 - 31: 22(int) Constant 1 - 32: 23(ivec2) ConstantComposite 31 31 - 33: 22(int) Constant 0 - 34: 23(ivec2) ConstantComposite 33 33 - 36: TypePointer Uniform 23(ivec2) - 38: TypeVector 22(int) 4 - 39(Uniform): TypeStruct 38(ivec4) - 40: TypePointer Uniform 39(Uniform) - 41: 40(ptr) Variable Uniform - 42: TypePointer Uniform 38(ivec4) - 65: 38(ivec4) ConstantComposite 33 33 33 33 - 72: TypeFloat 32 - 73: TypeVector 72(float) 4 - 74: TypePointer Output 73(fvec4) - 75(fragColor): 74(ptr) Variable Output - 87: 72(float) Constant 0 - 88: 72(float) Constant 1065353216 + 18: TypeInt 32 0 + 19: 18(int) Constant 2 + 24: TypeVector 18(int) 2 + 25(Buffer): TypeStruct 24(ivec2) + 26: TypePointer Uniform 25(Buffer) + 27: 26(ptr) Variable Uniform + 28: TypeInt 32 1 + 29: 28(int) Constant 0 + 30: 6(bool) ConstantFalse + 31: 9(bvec2) ConstantComposite 30 30 + 32: 18(int) Constant 1 + 33: 24(ivec2) ConstantComposite 32 32 + 34: 18(int) Constant 0 + 35: 24(ivec2) ConstantComposite 34 34 + 37: TypePointer Uniform 24(ivec2) + 39: TypeVector 18(int) 4 + 40(Uniform): TypeStruct 39(ivec4) + 41: TypePointer Uniform 40(Uniform) + 42: 41(ptr) Variable Uniform + 43: TypePointer Uniform 18(int) + 61: TypePointer Uniform 39(ivec4) + 64: 39(ivec4) ConstantComposite 34 34 34 34 + 71: TypeFloat 32 + 72: TypeVector 71(float) 4 + 73: TypePointer Output 72(fvec4) + 74(fragColor): 73(ptr) Variable Output + 84: 71(float) Constant 0 + 85: 71(float) Constant 1065353216 4(main): 2 Function None 3 5: Label - 62(param): 8(ptr) Variable Function - 67(param): 10(ptr) Variable Function - 35: 23(ivec2) Select 30 32 34 - 37: 36(ptr) AccessChain 26 28 - Store 37 35 - 43: 42(ptr) AccessChain 41 28 - 44: 38(ivec4) Load 43 - 45: 22(int) CompositeExtract 44 2 - 46: 6(bool) INotEqual 45 33 + 60(param): 8(ptr) Variable Function + 66(param): 10(ptr) Variable Function + 36: 24(ivec2) Select 31 33 35 + 38: 37(ptr) AccessChain 27 29 + Store 38 36 + 44: 43(ptr) AccessChain 42 29 19 + 45: 18(int) Load 44 + 46: 6(bool) INotEqual 45 34 SelectionMerge 48 None BranchConditional 46 47 48 47: Label - 49: 42(ptr) AccessChain 41 28 - 50: 38(ivec4) Load 49 - 51: 22(int) CompositeExtract 50 0 - 52: 6(bool) INotEqual 51 33 - 53: 9(bvec2) CompositeConstruct 52 52 - 54: 23(ivec2) Select 53 32 34 - 55: 36(ptr) AccessChain 26 28 - Store 55 54 + 49: 43(ptr) AccessChain 42 29 34 + 50: 18(int) Load 49 + 51: 6(bool) INotEqual 50 34 + 52: 9(bvec2) CompositeConstruct 51 51 + 53: 24(ivec2) Select 52 33 35 + 54: 37(ptr) AccessChain 27 29 + Store 54 53 Branch 48 48: Label - 56: 36(ptr) AccessChain 26 28 - 57: 23(ivec2) Load 56 - 58: 22(int) CompositeExtract 57 0 - 59: 6(bool) INotEqual 58 33 - SelectionMerge 61 None - BranchConditional 59 60 61 - 60: Label - 63: 42(ptr) AccessChain 41 28 - 64: 38(ivec4) Load 63 - 66: 7(bvec4) INotEqual 64 65 - Store 62(param) 66 - 68: 2 FunctionCall 14(foo(vb4;vb2;) 62(param) 67(param) - 69: 9(bvec2) Load 67(param) - 70: 23(ivec2) Select 69 32 34 - 71: 36(ptr) AccessChain 26 28 - Store 71 70 - Branch 61 - 61: Label - 76: 42(ptr) AccessChain 41 28 - 77: 38(ivec4) Load 76 - 78: 22(int) CompositeExtract 77 0 - 79: 6(bool) INotEqual 78 33 - SelectionMerge 81 None - BranchConditional 79 80 81 - 80: Label - 82: 42(ptr) AccessChain 41 28 - 83: 38(ivec4) Load 82 - 84: 22(int) CompositeExtract 83 1 - 85: 6(bool) INotEqual 84 33 - Branch 81 - 81: Label - 86: 6(bool) Phi 79 61 85 80 - 89: 72(float) Select 86 88 87 - 90: 73(fvec4) CompositeConstruct 89 89 89 89 - Store 75(fragColor) 90 - 91: 42(ptr) AccessChain 41 28 - 92: 38(ivec4) Load 91 - 93: 22(int) CompositeExtract 92 0 - 94: 6(bool) INotEqual 93 33 - 95: 6(bool) LogicalNot 94 - SelectionMerge 97 None - BranchConditional 95 96 97 - 96: Label - 98: 42(ptr) AccessChain 41 28 - 99: 38(ivec4) Load 98 - 100: 22(int) CompositeExtract 99 1 - 101: 6(bool) INotEqual 100 33 - Branch 97 - 97: Label - 102: 6(bool) Phi 94 81 101 96 - 103: 72(float) Select 102 88 87 - 104: 73(fvec4) CompositeConstruct 103 103 103 103 - 105: 73(fvec4) Load 75(fragColor) - 106: 73(fvec4) FSub 105 104 - Store 75(fragColor) 106 + 55: 43(ptr) AccessChain 27 29 34 + 56: 18(int) Load 55 + 57: 6(bool) INotEqual 56 34 + SelectionMerge 59 None + BranchConditional 57 58 59 + 58: Label + 62: 61(ptr) AccessChain 42 29 + 63: 39(ivec4) Load 62 + 65: 7(bvec4) INotEqual 63 64 + Store 60(param) 65 + 67: 2 FunctionCall 14(foo(vb4;vb2;) 60(param) 66(param) + 68: 9(bvec2) Load 66(param) + 69: 24(ivec2) Select 68 33 35 + 70: 37(ptr) AccessChain 27 29 + Store 70 69 + Branch 59 + 59: Label + 75: 43(ptr) AccessChain 42 29 34 + 76: 18(int) Load 75 + 77: 6(bool) INotEqual 76 34 + SelectionMerge 79 None + BranchConditional 77 78 79 + 78: Label + 80: 43(ptr) AccessChain 42 29 32 + 81: 18(int) Load 80 + 82: 6(bool) INotEqual 81 34 + Branch 79 + 79: Label + 83: 6(bool) Phi 77 59 82 78 + 86: 71(float) Select 83 85 84 + 87: 72(fvec4) CompositeConstruct 86 86 86 86 + Store 74(fragColor) 87 + 88: 43(ptr) AccessChain 42 29 34 + 89: 18(int) Load 88 + 90: 6(bool) INotEqual 89 34 + 91: 6(bool) LogicalNot 90 + SelectionMerge 93 None + BranchConditional 91 92 93 + 92: Label + 94: 43(ptr) AccessChain 42 29 32 + 95: 18(int) Load 94 + 96: 6(bool) INotEqual 95 34 + Branch 93 + 93: Label + 97: 6(bool) Phi 90 79 96 92 + 98: 71(float) Select 97 85 84 + 99: 72(fvec4) CompositeConstruct 98 98 98 98 + 100: 72(fvec4) Load 74(fragColor) + 101: 72(fvec4) FSub 100 99 + Store 74(fragColor) 101 Return FunctionEnd 14(foo(vb4;vb2;): 2 Function None 11 @@ -153,11 +148,11 @@ spv.boolInBlock.frag 13(paramb2): 10(ptr) FunctionParameter 15: Label 17(b1): 16(ptr) Variable Function - 18: 7(bvec4) Load 12(paramb4) - 19: 6(bool) CompositeExtract 18 2 - Store 17(b1) 19 - 20: 6(bool) Load 17(b1) - 21: 9(bvec2) CompositeConstruct 20 20 - Store 13(paramb2) 21 + 20: 16(ptr) AccessChain 12(paramb4) 19 + 21: 6(bool) Load 20 + Store 17(b1) 21 + 22: 6(bool) Load 17(b1) + 23: 9(bvec2) CompositeConstruct 22 22 + Store 13(paramb2) 23 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.branch-return.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.branch-return.vert.out index 6633d660da2..ca44724587b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.branch-return.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.branch-return.vert.out @@ -1,6 +1,6 @@ spv.branch-return.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 38 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.buffer.autoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.buffer.autoassign.frag.out index 549a5a28303..507318f7a6b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.buffer.autoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.buffer.autoassign.frag.out @@ -1,6 +1,6 @@ spv.buffer.autoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out new file mode 100644 index 00000000000..556a698ca15 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out @@ -0,0 +1,47 @@ +spv.builtInXFB.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 21 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "gl_PerVertex" + MemberName 8(gl_PerVertex) 0 "gl_Position" + MemberName 8(gl_PerVertex) 1 "gl_PointSize" + Name 10 "" + MemberDecorate 8(gl_PerVertex) 0 Offset 20 + MemberDecorate 8(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 8(gl_PerVertex) 1 Offset 16 + MemberDecorate 8(gl_PerVertex) 1 BuiltIn PointSize + Decorate 8(gl_PerVertex) Block + Decorate 10 XfbBuffer 1 + Decorate 10 XfbStride 64 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(gl_PerVertex): TypeStruct 7(fvec4) 6(float) + 9: TypePointer Output 8(gl_PerVertex) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: 6(float) Constant 1065353216 + 14: 7(fvec4) ConstantComposite 13 13 13 13 + 15: TypePointer Output 7(fvec4) + 17: 11(int) Constant 1 + 18: 6(float) Constant 1073741824 + 19: TypePointer Output 6(float) + 4(main): 2 Function None 3 + 5: Label + 16: 15(ptr) AccessChain 10 12 + Store 16 14 + 20: 19(ptr) AccessChain 10 17 + Store 20 18 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.computeShaderDerivatives.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.computeShaderDerivatives.comp.out new file mode 100644 index 00000000000..f05dbc00a03 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.computeShaderDerivatives.comp.out @@ -0,0 +1,358 @@ +spv.computeShaderDerivatives.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 212 + + Capability Shader + Capability DerivativeControl + Capability ComputeDerivativeGroupQuadsNV + Extension "SPV_NV_compute_shader_derivatives" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 2 4 1 + ExecutionMode 4 DerivativeGroupQuadsNV + Source GLSL 450 + SourceExtension "GL_NV_compute_shader_derivatives" + Name 4 "main" + Name 10 "block" + MemberName 10(block) 0 "fDerivativeX" + MemberName 10(block) 1 "fDerivativeY" + MemberName 10(block) 2 "fDerivativeWidth" + MemberName 10(block) 3 "fCoarseDerivativeX" + MemberName 10(block) 4 "fCoarseDerivativeY" + MemberName 10(block) 5 "fCoarseDerivativeWidth" + MemberName 10(block) 6 "fFineDerivativeX" + MemberName 10(block) 7 "fFineDerivativeY" + MemberName 10(block) 8 "fFineDerivativeWidth" + MemberName 10(block) 9 "fX" + MemberName 10(block) 10 "fY" + MemberName 10(block) 11 "v2DerivativeX" + MemberName 10(block) 12 "v2DerivativeY" + MemberName 10(block) 13 "v2DerivativeWidth" + MemberName 10(block) 14 "v2CoarseDerivativeX" + MemberName 10(block) 15 "v2CoarseDerivativeY" + MemberName 10(block) 16 "v2CoarseDerivativeWidth" + MemberName 10(block) 17 "v2FineDerivativeX" + MemberName 10(block) 18 "v2FineDerivativeY" + MemberName 10(block) 19 "v2FineDerivativeWidth" + MemberName 10(block) 20 "v2X" + MemberName 10(block) 21 "v2Y" + MemberName 10(block) 22 "v3DerivativeX" + MemberName 10(block) 23 "v3DerivativeY" + MemberName 10(block) 24 "v3DerivativeWidth" + MemberName 10(block) 25 "v3CoarseDerivativeX" + MemberName 10(block) 26 "v3CoarseDerivativeY" + MemberName 10(block) 27 "v3CoarseDerivativeWidth" + MemberName 10(block) 28 "v3FineDerivativeX" + MemberName 10(block) 29 "v3FineDerivativeY" + MemberName 10(block) 30 "v3FineDerivativeWidth" + MemberName 10(block) 31 "v3X" + MemberName 10(block) 32 "v3Y" + MemberName 10(block) 33 "v4DerivativeX" + MemberName 10(block) 34 "v4DerivativeY" + MemberName 10(block) 35 "v4DerivativeWidth" + MemberName 10(block) 36 "v4CoarseDerivativeX" + MemberName 10(block) 37 "v4CoarseDerivativeY" + MemberName 10(block) 38 "v4CoarseDerivativeWidth" + MemberName 10(block) 39 "v4FineDerivativeX" + MemberName 10(block) 40 "v4FineDerivativeY" + MemberName 10(block) 41 "v4FineDerivativeWidth" + MemberName 10(block) 42 "v4X" + MemberName 10(block) 43 "v4Y" + Name 12 "" + MemberDecorate 10(block) 0 Offset 0 + MemberDecorate 10(block) 1 Offset 4 + MemberDecorate 10(block) 2 Offset 8 + MemberDecorate 10(block) 3 Offset 12 + MemberDecorate 10(block) 4 Offset 16 + MemberDecorate 10(block) 5 Offset 20 + MemberDecorate 10(block) 6 Offset 24 + MemberDecorate 10(block) 7 Offset 28 + MemberDecorate 10(block) 8 Offset 32 + MemberDecorate 10(block) 9 Offset 36 + MemberDecorate 10(block) 10 Offset 40 + MemberDecorate 10(block) 11 Offset 48 + MemberDecorate 10(block) 12 Offset 56 + MemberDecorate 10(block) 13 Offset 64 + MemberDecorate 10(block) 14 Offset 72 + MemberDecorate 10(block) 15 Offset 80 + MemberDecorate 10(block) 16 Offset 88 + MemberDecorate 10(block) 17 Offset 96 + MemberDecorate 10(block) 18 Offset 104 + MemberDecorate 10(block) 19 Offset 112 + MemberDecorate 10(block) 20 Offset 120 + MemberDecorate 10(block) 21 Offset 128 + MemberDecorate 10(block) 22 Offset 144 + MemberDecorate 10(block) 23 Offset 160 + MemberDecorate 10(block) 24 Offset 176 + MemberDecorate 10(block) 25 Offset 192 + MemberDecorate 10(block) 26 Offset 208 + MemberDecorate 10(block) 27 Offset 224 + MemberDecorate 10(block) 28 Offset 240 + MemberDecorate 10(block) 29 Offset 256 + MemberDecorate 10(block) 30 Offset 272 + MemberDecorate 10(block) 31 Offset 288 + MemberDecorate 10(block) 32 Offset 304 + MemberDecorate 10(block) 33 Offset 320 + MemberDecorate 10(block) 34 Offset 336 + MemberDecorate 10(block) 35 Offset 352 + MemberDecorate 10(block) 36 Offset 368 + MemberDecorate 10(block) 37 Offset 384 + MemberDecorate 10(block) 38 Offset 400 + MemberDecorate 10(block) 39 Offset 416 + MemberDecorate 10(block) 40 Offset 432 + MemberDecorate 10(block) 41 Offset 448 + MemberDecorate 10(block) 42 Offset 464 + MemberDecorate 10(block) 43 Offset 480 + Decorate 10(block) BufferBlock + Decorate 12 DescriptorSet 0 + Decorate 211 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypeVector 6(float) 3 + 9: TypeVector 6(float) 4 + 10(block): TypeStruct 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) + 11: TypePointer Uniform 10(block) + 12: 11(ptr) Variable Uniform + 13: TypeInt 32 1 + 14: 13(int) Constant 0 + 15: 13(int) Constant 9 + 16: TypePointer Uniform 6(float) + 21: 13(int) Constant 1 + 22: 13(int) Constant 10 + 27: 13(int) Constant 2 + 32: 13(int) Constant 3 + 37: 13(int) Constant 4 + 42: 13(int) Constant 5 + 47: 13(int) Constant 6 + 52: 13(int) Constant 7 + 57: 13(int) Constant 8 + 62: 13(int) Constant 11 + 63: 13(int) Constant 20 + 64: TypePointer Uniform 7(fvec2) + 69: 13(int) Constant 12 + 70: 13(int) Constant 21 + 75: 13(int) Constant 13 + 80: 13(int) Constant 14 + 85: 13(int) Constant 15 + 90: 13(int) Constant 16 + 95: 13(int) Constant 17 + 100: 13(int) Constant 18 + 105: 13(int) Constant 19 + 110: 13(int) Constant 22 + 111: 13(int) Constant 31 + 112: TypePointer Uniform 8(fvec3) + 117: 13(int) Constant 23 + 118: 13(int) Constant 32 + 123: 13(int) Constant 24 + 128: 13(int) Constant 25 + 133: 13(int) Constant 26 + 138: 13(int) Constant 27 + 143: 13(int) Constant 28 + 148: 13(int) Constant 29 + 153: 13(int) Constant 30 + 158: 13(int) Constant 33 + 159: 13(int) Constant 42 + 160: TypePointer Uniform 9(fvec4) + 165: 13(int) Constant 34 + 166: 13(int) Constant 43 + 171: 13(int) Constant 35 + 176: 13(int) Constant 36 + 181: 13(int) Constant 37 + 186: 13(int) Constant 38 + 191: 13(int) Constant 39 + 196: 13(int) Constant 40 + 201: 13(int) Constant 41 + 206: TypeInt 32 0 + 207: TypeVector 206(int) 3 + 208: 206(int) Constant 2 + 209: 206(int) Constant 4 + 210: 206(int) Constant 1 + 211: 207(ivec3) ConstantComposite 208 209 210 + 4(main): 2 Function None 3 + 5: Label + 17: 16(ptr) AccessChain 12 15 + 18: 6(float) Load 17 + 19: 6(float) DPdx 18 + 20: 16(ptr) AccessChain 12 14 + Store 20 19 + 23: 16(ptr) AccessChain 12 22 + 24: 6(float) Load 23 + 25: 6(float) DPdy 24 + 26: 16(ptr) AccessChain 12 21 + Store 26 25 + 28: 16(ptr) AccessChain 12 15 + 29: 6(float) Load 28 + 30: 6(float) Fwidth 29 + 31: 16(ptr) AccessChain 12 27 + Store 31 30 + 33: 16(ptr) AccessChain 12 15 + 34: 6(float) Load 33 + 35: 6(float) DPdxCoarse 34 + 36: 16(ptr) AccessChain 12 32 + Store 36 35 + 38: 16(ptr) AccessChain 12 22 + 39: 6(float) Load 38 + 40: 6(float) DPdyCoarse 39 + 41: 16(ptr) AccessChain 12 37 + Store 41 40 + 43: 16(ptr) AccessChain 12 15 + 44: 6(float) Load 43 + 45: 6(float) FwidthCoarse 44 + 46: 16(ptr) AccessChain 12 42 + Store 46 45 + 48: 16(ptr) AccessChain 12 15 + 49: 6(float) Load 48 + 50: 6(float) DPdxFine 49 + 51: 16(ptr) AccessChain 12 47 + Store 51 50 + 53: 16(ptr) AccessChain 12 22 + 54: 6(float) Load 53 + 55: 6(float) DPdyFine 54 + 56: 16(ptr) AccessChain 12 52 + Store 56 55 + 58: 16(ptr) AccessChain 12 15 + 59: 6(float) Load 58 + 60: 6(float) FwidthFine 59 + 61: 16(ptr) AccessChain 12 57 + Store 61 60 + 65: 64(ptr) AccessChain 12 63 + 66: 7(fvec2) Load 65 + 67: 7(fvec2) DPdx 66 + 68: 64(ptr) AccessChain 12 62 + Store 68 67 + 71: 64(ptr) AccessChain 12 70 + 72: 7(fvec2) Load 71 + 73: 7(fvec2) DPdy 72 + 74: 64(ptr) AccessChain 12 69 + Store 74 73 + 76: 64(ptr) AccessChain 12 63 + 77: 7(fvec2) Load 76 + 78: 7(fvec2) Fwidth 77 + 79: 64(ptr) AccessChain 12 75 + Store 79 78 + 81: 64(ptr) AccessChain 12 63 + 82: 7(fvec2) Load 81 + 83: 7(fvec2) DPdxCoarse 82 + 84: 64(ptr) AccessChain 12 80 + Store 84 83 + 86: 64(ptr) AccessChain 12 70 + 87: 7(fvec2) Load 86 + 88: 7(fvec2) DPdyCoarse 87 + 89: 64(ptr) AccessChain 12 85 + Store 89 88 + 91: 64(ptr) AccessChain 12 63 + 92: 7(fvec2) Load 91 + 93: 7(fvec2) FwidthCoarse 92 + 94: 64(ptr) AccessChain 12 90 + Store 94 93 + 96: 64(ptr) AccessChain 12 63 + 97: 7(fvec2) Load 96 + 98: 7(fvec2) DPdxFine 97 + 99: 64(ptr) AccessChain 12 95 + Store 99 98 + 101: 64(ptr) AccessChain 12 70 + 102: 7(fvec2) Load 101 + 103: 7(fvec2) DPdyFine 102 + 104: 64(ptr) AccessChain 12 100 + Store 104 103 + 106: 64(ptr) AccessChain 12 63 + 107: 7(fvec2) Load 106 + 108: 7(fvec2) FwidthFine 107 + 109: 64(ptr) AccessChain 12 105 + Store 109 108 + 113: 112(ptr) AccessChain 12 111 + 114: 8(fvec3) Load 113 + 115: 8(fvec3) DPdx 114 + 116: 112(ptr) AccessChain 12 110 + Store 116 115 + 119: 112(ptr) AccessChain 12 118 + 120: 8(fvec3) Load 119 + 121: 8(fvec3) DPdy 120 + 122: 112(ptr) AccessChain 12 117 + Store 122 121 + 124: 112(ptr) AccessChain 12 111 + 125: 8(fvec3) Load 124 + 126: 8(fvec3) Fwidth 125 + 127: 112(ptr) AccessChain 12 123 + Store 127 126 + 129: 112(ptr) AccessChain 12 111 + 130: 8(fvec3) Load 129 + 131: 8(fvec3) DPdxCoarse 130 + 132: 112(ptr) AccessChain 12 128 + Store 132 131 + 134: 112(ptr) AccessChain 12 118 + 135: 8(fvec3) Load 134 + 136: 8(fvec3) DPdyCoarse 135 + 137: 112(ptr) AccessChain 12 133 + Store 137 136 + 139: 112(ptr) AccessChain 12 111 + 140: 8(fvec3) Load 139 + 141: 8(fvec3) FwidthCoarse 140 + 142: 112(ptr) AccessChain 12 138 + Store 142 141 + 144: 112(ptr) AccessChain 12 111 + 145: 8(fvec3) Load 144 + 146: 8(fvec3) DPdxFine 145 + 147: 112(ptr) AccessChain 12 143 + Store 147 146 + 149: 112(ptr) AccessChain 12 118 + 150: 8(fvec3) Load 149 + 151: 8(fvec3) DPdyFine 150 + 152: 112(ptr) AccessChain 12 148 + Store 152 151 + 154: 112(ptr) AccessChain 12 111 + 155: 8(fvec3) Load 154 + 156: 8(fvec3) FwidthFine 155 + 157: 112(ptr) AccessChain 12 153 + Store 157 156 + 161: 160(ptr) AccessChain 12 159 + 162: 9(fvec4) Load 161 + 163: 9(fvec4) DPdx 162 + 164: 160(ptr) AccessChain 12 158 + Store 164 163 + 167: 160(ptr) AccessChain 12 166 + 168: 9(fvec4) Load 167 + 169: 9(fvec4) DPdy 168 + 170: 160(ptr) AccessChain 12 165 + Store 170 169 + 172: 160(ptr) AccessChain 12 159 + 173: 9(fvec4) Load 172 + 174: 9(fvec4) Fwidth 173 + 175: 160(ptr) AccessChain 12 171 + Store 175 174 + 177: 160(ptr) AccessChain 12 159 + 178: 9(fvec4) Load 177 + 179: 9(fvec4) DPdxCoarse 178 + 180: 160(ptr) AccessChain 12 176 + Store 180 179 + 182: 160(ptr) AccessChain 12 166 + 183: 9(fvec4) Load 182 + 184: 9(fvec4) DPdyCoarse 183 + 185: 160(ptr) AccessChain 12 181 + Store 185 184 + 187: 160(ptr) AccessChain 12 159 + 188: 9(fvec4) Load 187 + 189: 9(fvec4) FwidthCoarse 188 + 190: 160(ptr) AccessChain 12 186 + Store 190 189 + 192: 160(ptr) AccessChain 12 159 + 193: 9(fvec4) Load 192 + 194: 9(fvec4) DPdxFine 193 + 195: 160(ptr) AccessChain 12 191 + Store 195 194 + 197: 160(ptr) AccessChain 12 166 + 198: 9(fvec4) Load 197 + 199: 9(fvec4) DPdyFine 198 + 200: 160(ptr) AccessChain 12 196 + Store 200 199 + 202: 160(ptr) AccessChain 12 159 + 203: 9(fvec4) Load 202 + 204: 9(fvec4) FwidthFine 203 + 205: 160(ptr) AccessChain 12 201 + Store 205 204 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.computeShaderDerivatives2.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.computeShaderDerivatives2.comp.out new file mode 100644 index 00000000000..94a3dfc2b94 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.computeShaderDerivatives2.comp.out @@ -0,0 +1,358 @@ +spv.computeShaderDerivatives2.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 212 + + Capability Shader + Capability DerivativeControl + Capability ComputeDerivativeGroupLinearNV + Extension "SPV_NV_compute_shader_derivatives" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 2 4 1 + ExecutionMode 4 DerivativeGroupLinearNV + Source ESSL 320 + SourceExtension "GL_NV_compute_shader_derivatives" + Name 4 "main" + Name 10 "block" + MemberName 10(block) 0 "fDerivativeX" + MemberName 10(block) 1 "fDerivativeY" + MemberName 10(block) 2 "fDerivativeWidth" + MemberName 10(block) 3 "fCoarseDerivativeX" + MemberName 10(block) 4 "fCoarseDerivativeY" + MemberName 10(block) 5 "fCoarseDerivativeWidth" + MemberName 10(block) 6 "fFineDerivativeX" + MemberName 10(block) 7 "fFineDerivativeY" + MemberName 10(block) 8 "fFineDerivativeWidth" + MemberName 10(block) 9 "fX" + MemberName 10(block) 10 "fY" + MemberName 10(block) 11 "v2DerivativeX" + MemberName 10(block) 12 "v2DerivativeY" + MemberName 10(block) 13 "v2DerivativeWidth" + MemberName 10(block) 14 "v2CoarseDerivativeX" + MemberName 10(block) 15 "v2CoarseDerivativeY" + MemberName 10(block) 16 "v2CoarseDerivativeWidth" + MemberName 10(block) 17 "v2FineDerivativeX" + MemberName 10(block) 18 "v2FineDerivativeY" + MemberName 10(block) 19 "v2FineDerivativeWidth" + MemberName 10(block) 20 "v2X" + MemberName 10(block) 21 "v2Y" + MemberName 10(block) 22 "v3DerivativeX" + MemberName 10(block) 23 "v3DerivativeY" + MemberName 10(block) 24 "v3DerivativeWidth" + MemberName 10(block) 25 "v3CoarseDerivativeX" + MemberName 10(block) 26 "v3CoarseDerivativeY" + MemberName 10(block) 27 "v3CoarseDerivativeWidth" + MemberName 10(block) 28 "v3FineDerivativeX" + MemberName 10(block) 29 "v3FineDerivativeY" + MemberName 10(block) 30 "v3FineDerivativeWidth" + MemberName 10(block) 31 "v3X" + MemberName 10(block) 32 "v3Y" + MemberName 10(block) 33 "v4DerivativeX" + MemberName 10(block) 34 "v4DerivativeY" + MemberName 10(block) 35 "v4DerivativeWidth" + MemberName 10(block) 36 "v4CoarseDerivativeX" + MemberName 10(block) 37 "v4CoarseDerivativeY" + MemberName 10(block) 38 "v4CoarseDerivativeWidth" + MemberName 10(block) 39 "v4FineDerivativeX" + MemberName 10(block) 40 "v4FineDerivativeY" + MemberName 10(block) 41 "v4FineDerivativeWidth" + MemberName 10(block) 42 "v4X" + MemberName 10(block) 43 "v4Y" + Name 12 "" + MemberDecorate 10(block) 0 Offset 0 + MemberDecorate 10(block) 1 Offset 4 + MemberDecorate 10(block) 2 Offset 8 + MemberDecorate 10(block) 3 Offset 12 + MemberDecorate 10(block) 4 Offset 16 + MemberDecorate 10(block) 5 Offset 20 + MemberDecorate 10(block) 6 Offset 24 + MemberDecorate 10(block) 7 Offset 28 + MemberDecorate 10(block) 8 Offset 32 + MemberDecorate 10(block) 9 Offset 36 + MemberDecorate 10(block) 10 Offset 40 + MemberDecorate 10(block) 11 Offset 48 + MemberDecorate 10(block) 12 Offset 56 + MemberDecorate 10(block) 13 Offset 64 + MemberDecorate 10(block) 14 Offset 72 + MemberDecorate 10(block) 15 Offset 80 + MemberDecorate 10(block) 16 Offset 88 + MemberDecorate 10(block) 17 Offset 96 + MemberDecorate 10(block) 18 Offset 104 + MemberDecorate 10(block) 19 Offset 112 + MemberDecorate 10(block) 20 Offset 120 + MemberDecorate 10(block) 21 Offset 128 + MemberDecorate 10(block) 22 Offset 144 + MemberDecorate 10(block) 23 Offset 160 + MemberDecorate 10(block) 24 Offset 176 + MemberDecorate 10(block) 25 Offset 192 + MemberDecorate 10(block) 26 Offset 208 + MemberDecorate 10(block) 27 Offset 224 + MemberDecorate 10(block) 28 Offset 240 + MemberDecorate 10(block) 29 Offset 256 + MemberDecorate 10(block) 30 Offset 272 + MemberDecorate 10(block) 31 Offset 288 + MemberDecorate 10(block) 32 Offset 304 + MemberDecorate 10(block) 33 Offset 320 + MemberDecorate 10(block) 34 Offset 336 + MemberDecorate 10(block) 35 Offset 352 + MemberDecorate 10(block) 36 Offset 368 + MemberDecorate 10(block) 37 Offset 384 + MemberDecorate 10(block) 38 Offset 400 + MemberDecorate 10(block) 39 Offset 416 + MemberDecorate 10(block) 40 Offset 432 + MemberDecorate 10(block) 41 Offset 448 + MemberDecorate 10(block) 42 Offset 464 + MemberDecorate 10(block) 43 Offset 480 + Decorate 10(block) BufferBlock + Decorate 12 DescriptorSet 0 + Decorate 211 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypeVector 6(float) 3 + 9: TypeVector 6(float) 4 + 10(block): TypeStruct 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 7(fvec2) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 8(fvec3) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) 9(fvec4) + 11: TypePointer Uniform 10(block) + 12: 11(ptr) Variable Uniform + 13: TypeInt 32 1 + 14: 13(int) Constant 0 + 15: 13(int) Constant 9 + 16: TypePointer Uniform 6(float) + 21: 13(int) Constant 1 + 22: 13(int) Constant 10 + 27: 13(int) Constant 2 + 32: 13(int) Constant 3 + 37: 13(int) Constant 4 + 42: 13(int) Constant 5 + 47: 13(int) Constant 6 + 52: 13(int) Constant 7 + 57: 13(int) Constant 8 + 62: 13(int) Constant 11 + 63: 13(int) Constant 20 + 64: TypePointer Uniform 7(fvec2) + 69: 13(int) Constant 12 + 70: 13(int) Constant 21 + 75: 13(int) Constant 13 + 80: 13(int) Constant 14 + 85: 13(int) Constant 15 + 90: 13(int) Constant 16 + 95: 13(int) Constant 17 + 100: 13(int) Constant 18 + 105: 13(int) Constant 19 + 110: 13(int) Constant 22 + 111: 13(int) Constant 31 + 112: TypePointer Uniform 8(fvec3) + 117: 13(int) Constant 23 + 118: 13(int) Constant 32 + 123: 13(int) Constant 24 + 128: 13(int) Constant 25 + 133: 13(int) Constant 26 + 138: 13(int) Constant 27 + 143: 13(int) Constant 28 + 148: 13(int) Constant 29 + 153: 13(int) Constant 30 + 158: 13(int) Constant 33 + 159: 13(int) Constant 42 + 160: TypePointer Uniform 9(fvec4) + 165: 13(int) Constant 34 + 166: 13(int) Constant 43 + 171: 13(int) Constant 35 + 176: 13(int) Constant 36 + 181: 13(int) Constant 37 + 186: 13(int) Constant 38 + 191: 13(int) Constant 39 + 196: 13(int) Constant 40 + 201: 13(int) Constant 41 + 206: TypeInt 32 0 + 207: TypeVector 206(int) 3 + 208: 206(int) Constant 2 + 209: 206(int) Constant 4 + 210: 206(int) Constant 1 + 211: 207(ivec3) ConstantComposite 208 209 210 + 4(main): 2 Function None 3 + 5: Label + 17: 16(ptr) AccessChain 12 15 + 18: 6(float) Load 17 + 19: 6(float) DPdx 18 + 20: 16(ptr) AccessChain 12 14 + Store 20 19 + 23: 16(ptr) AccessChain 12 22 + 24: 6(float) Load 23 + 25: 6(float) DPdy 24 + 26: 16(ptr) AccessChain 12 21 + Store 26 25 + 28: 16(ptr) AccessChain 12 15 + 29: 6(float) Load 28 + 30: 6(float) Fwidth 29 + 31: 16(ptr) AccessChain 12 27 + Store 31 30 + 33: 16(ptr) AccessChain 12 15 + 34: 6(float) Load 33 + 35: 6(float) DPdxCoarse 34 + 36: 16(ptr) AccessChain 12 32 + Store 36 35 + 38: 16(ptr) AccessChain 12 22 + 39: 6(float) Load 38 + 40: 6(float) DPdyCoarse 39 + 41: 16(ptr) AccessChain 12 37 + Store 41 40 + 43: 16(ptr) AccessChain 12 15 + 44: 6(float) Load 43 + 45: 6(float) FwidthCoarse 44 + 46: 16(ptr) AccessChain 12 42 + Store 46 45 + 48: 16(ptr) AccessChain 12 15 + 49: 6(float) Load 48 + 50: 6(float) DPdxFine 49 + 51: 16(ptr) AccessChain 12 47 + Store 51 50 + 53: 16(ptr) AccessChain 12 22 + 54: 6(float) Load 53 + 55: 6(float) DPdyFine 54 + 56: 16(ptr) AccessChain 12 52 + Store 56 55 + 58: 16(ptr) AccessChain 12 15 + 59: 6(float) Load 58 + 60: 6(float) FwidthFine 59 + 61: 16(ptr) AccessChain 12 57 + Store 61 60 + 65: 64(ptr) AccessChain 12 63 + 66: 7(fvec2) Load 65 + 67: 7(fvec2) DPdx 66 + 68: 64(ptr) AccessChain 12 62 + Store 68 67 + 71: 64(ptr) AccessChain 12 70 + 72: 7(fvec2) Load 71 + 73: 7(fvec2) DPdy 72 + 74: 64(ptr) AccessChain 12 69 + Store 74 73 + 76: 64(ptr) AccessChain 12 63 + 77: 7(fvec2) Load 76 + 78: 7(fvec2) Fwidth 77 + 79: 64(ptr) AccessChain 12 75 + Store 79 78 + 81: 64(ptr) AccessChain 12 63 + 82: 7(fvec2) Load 81 + 83: 7(fvec2) DPdxCoarse 82 + 84: 64(ptr) AccessChain 12 80 + Store 84 83 + 86: 64(ptr) AccessChain 12 70 + 87: 7(fvec2) Load 86 + 88: 7(fvec2) DPdyCoarse 87 + 89: 64(ptr) AccessChain 12 85 + Store 89 88 + 91: 64(ptr) AccessChain 12 63 + 92: 7(fvec2) Load 91 + 93: 7(fvec2) FwidthCoarse 92 + 94: 64(ptr) AccessChain 12 90 + Store 94 93 + 96: 64(ptr) AccessChain 12 63 + 97: 7(fvec2) Load 96 + 98: 7(fvec2) DPdxFine 97 + 99: 64(ptr) AccessChain 12 95 + Store 99 98 + 101: 64(ptr) AccessChain 12 70 + 102: 7(fvec2) Load 101 + 103: 7(fvec2) DPdyFine 102 + 104: 64(ptr) AccessChain 12 100 + Store 104 103 + 106: 64(ptr) AccessChain 12 63 + 107: 7(fvec2) Load 106 + 108: 7(fvec2) FwidthFine 107 + 109: 64(ptr) AccessChain 12 105 + Store 109 108 + 113: 112(ptr) AccessChain 12 111 + 114: 8(fvec3) Load 113 + 115: 8(fvec3) DPdx 114 + 116: 112(ptr) AccessChain 12 110 + Store 116 115 + 119: 112(ptr) AccessChain 12 118 + 120: 8(fvec3) Load 119 + 121: 8(fvec3) DPdy 120 + 122: 112(ptr) AccessChain 12 117 + Store 122 121 + 124: 112(ptr) AccessChain 12 111 + 125: 8(fvec3) Load 124 + 126: 8(fvec3) Fwidth 125 + 127: 112(ptr) AccessChain 12 123 + Store 127 126 + 129: 112(ptr) AccessChain 12 111 + 130: 8(fvec3) Load 129 + 131: 8(fvec3) DPdxCoarse 130 + 132: 112(ptr) AccessChain 12 128 + Store 132 131 + 134: 112(ptr) AccessChain 12 118 + 135: 8(fvec3) Load 134 + 136: 8(fvec3) DPdyCoarse 135 + 137: 112(ptr) AccessChain 12 133 + Store 137 136 + 139: 112(ptr) AccessChain 12 111 + 140: 8(fvec3) Load 139 + 141: 8(fvec3) FwidthCoarse 140 + 142: 112(ptr) AccessChain 12 138 + Store 142 141 + 144: 112(ptr) AccessChain 12 111 + 145: 8(fvec3) Load 144 + 146: 8(fvec3) DPdxFine 145 + 147: 112(ptr) AccessChain 12 143 + Store 147 146 + 149: 112(ptr) AccessChain 12 118 + 150: 8(fvec3) Load 149 + 151: 8(fvec3) DPdyFine 150 + 152: 112(ptr) AccessChain 12 148 + Store 152 151 + 154: 112(ptr) AccessChain 12 111 + 155: 8(fvec3) Load 154 + 156: 8(fvec3) FwidthFine 155 + 157: 112(ptr) AccessChain 12 153 + Store 157 156 + 161: 160(ptr) AccessChain 12 159 + 162: 9(fvec4) Load 161 + 163: 9(fvec4) DPdx 162 + 164: 160(ptr) AccessChain 12 158 + Store 164 163 + 167: 160(ptr) AccessChain 12 166 + 168: 9(fvec4) Load 167 + 169: 9(fvec4) DPdy 168 + 170: 160(ptr) AccessChain 12 165 + Store 170 169 + 172: 160(ptr) AccessChain 12 159 + 173: 9(fvec4) Load 172 + 174: 9(fvec4) Fwidth 173 + 175: 160(ptr) AccessChain 12 171 + Store 175 174 + 177: 160(ptr) AccessChain 12 159 + 178: 9(fvec4) Load 177 + 179: 9(fvec4) DPdxCoarse 178 + 180: 160(ptr) AccessChain 12 176 + Store 180 179 + 182: 160(ptr) AccessChain 12 166 + 183: 9(fvec4) Load 182 + 184: 9(fvec4) DPdyCoarse 183 + 185: 160(ptr) AccessChain 12 181 + Store 185 184 + 187: 160(ptr) AccessChain 12 159 + 188: 9(fvec4) Load 187 + 189: 9(fvec4) FwidthCoarse 188 + 190: 160(ptr) AccessChain 12 186 + Store 190 189 + 192: 160(ptr) AccessChain 12 159 + 193: 9(fvec4) Load 192 + 194: 9(fvec4) DPdxFine 193 + 195: 160(ptr) AccessChain 12 191 + Store 195 194 + 197: 160(ptr) AccessChain 12 166 + 198: 9(fvec4) Load 197 + 199: 9(fvec4) DPdyFine 198 + 200: 160(ptr) AccessChain 12 196 + Store 200 199 + 202: 160(ptr) AccessChain 12 159 + 203: 9(fvec4) Load 202 + 204: 9(fvec4) FwidthFine 203 + 205: 160(ptr) AccessChain 12 201 + Store 205 204 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conditionalDiscard.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conditionalDiscard.frag.out index b62e3b3e49e..f5e9e6fa00a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conditionalDiscard.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conditionalDiscard.frag.out @@ -1,6 +1,6 @@ spv.conditionalDiscard.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 36 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.constStruct.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.constStruct.vert.out new file mode 100644 index 00000000000..d04f33d1b29 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.constStruct.vert.out @@ -0,0 +1,45 @@ +spv.constStruct.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 23 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" + Source GLSL 450 + Name 4 "main" + Name 9 "T" + MemberName 9(T) 0 "m" + Name 10 "U" + MemberName 10(U) 0 "m" + Name 11 "S" + MemberName 11(S) 0 "t" + MemberName 11(S) 1 "u" + Name 13 "s1" + Name 22 "s2" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypeMatrix 7(fvec2) 2 + 9(T): TypeStruct 8 + 10(U): TypeStruct 8 + 11(S): TypeStruct 9(T) 10(U) + 12: TypePointer Function 11(S) + 14: 6(float) Constant 1065353216 + 15: 6(float) Constant 0 + 16: 7(fvec2) ConstantComposite 14 15 + 17: 7(fvec2) ConstantComposite 15 14 + 18: 8 ConstantComposite 16 17 + 19: 9(T) ConstantComposite 18 + 20: 10(U) ConstantComposite 18 + 21: 11(S) ConstantComposite 19 20 + 4(main): 2 Function None 3 + 5: Label + 13(s1): 12(ptr) Variable Function + 22(s2): 12(ptr) Variable Function + Store 13(s1) 21 + Store 22(s2) 21 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.controlFlowAttributes.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.controlFlowAttributes.frag.out new file mode 100644 index 00000000000..2f074def239 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.controlFlowAttributes.frag.out @@ -0,0 +1,240 @@ +spv.controlFlowAttributes.frag +WARNING: 0:20: '' : attribute with arguments not recognized, skipping +WARNING: 0:21: '' : attribute with arguments not recognized, skipping +WARNING: 0:22: '' : attribute with arguments not recognized, skipping +WARNING: 0:23: 'dependency_length' : expected a single integer argument +WARNING: 0:24: '' : attribute with arguments not recognized, skipping +WARNING: 0:25: '' : attribute with arguments not recognized, skipping +WARNING: 0:26: '' : attribute with arguments not recognized, skipping + +error: SPIRV-Tools Validation Errors +error: Invalid loop control operand: 4 has invalid mask component 4 +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 118 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_control_flow_attributes" + Name 4 "main" + Name 8 "i" + Name 36 "i" + Name 47 "cond" + Name 60 "i" + Name 79 "i" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 9: 6(int) Constant 0 + 16: 6(int) Constant 8 + 17: TypeBool + 20: 6(int) Constant 1 + 31: 17(bool) ConstantTrue + 46: TypePointer Private 17(bool) + 47(cond): 46(ptr) Variable Private + 54: 17(bool) ConstantFalse + 55: 6(int) Constant 3 + 4(main): 2 Function None 3 + 5: Label + 8(i): 7(ptr) Variable Function + 36(i): 7(ptr) Variable Function + 60(i): 7(ptr) Variable Function + 79(i): 7(ptr) Variable Function + Store 8(i) 9 + Branch 10 + 10: Label + LoopMerge 12 13 Unroll + Branch 14 + 14: Label + 15: 6(int) Load 8(i) + 18: 17(bool) SLessThan 15 16 + BranchConditional 18 11 12 + 11: Label + Branch 13 + 13: Label + 19: 6(int) Load 8(i) + 21: 6(int) IAdd 19 20 + Store 8(i) 21 + Branch 10 + 12: Label + Branch 22 + 22: Label + LoopMerge 24 25 DontUnroll + Branch 23 + 23: Label + Branch 25 + 25: Label + Branch 22 + 24: Label + Branch 26 + 26: Label + LoopMerge 28 29 DontUnroll + Branch 30 + 30: Label + BranchConditional 31 27 28 + 27: Label + Branch 29 + 29: Label + Branch 26 + 28: Label + Branch 32 + 32: Label + LoopMerge 34 35 DependencyInfinite + Branch 33 + 33: Label + Branch 35 + 35: Label + BranchConditional 31 32 34 + 34: Label + Store 36(i) 9 + Branch 37 + 37: Label + LoopMerge 39 40 DependencyLength 4 + Branch 41 + 41: Label + 42: 6(int) Load 36(i) + 43: 17(bool) SLessThan 42 16 + BranchConditional 43 38 39 + 38: Label + Branch 40 + 40: Label + 44: 6(int) Load 36(i) + 45: 6(int) IAdd 44 20 + Store 36(i) 45 + Branch 37 + 39: Label + 48: 17(bool) Load 47(cond) + SelectionMerge 50 Flatten + BranchConditional 48 49 50 + 49: Label + Branch 50 + 50: Label + 51: 17(bool) Load 47(cond) + SelectionMerge 53 DontFlatten + BranchConditional 51 52 53 + 52: Label + Store 47(cond) 54 + Branch 53 + 53: Label + SelectionMerge 57 DontFlatten + Switch 55 57 + case 3: 56 + 56: Label + Branch 57 + 57: Label + Store 60(i) 9 + Branch 61 + 61: Label + LoopMerge 63 64 None + Branch 65 + 65: Label + 66: 6(int) Load 60(i) + 67: 17(bool) SLessThan 66 16 + BranchConditional 67 62 63 + 62: Label + Branch 64 + 64: Label + 68: 6(int) Load 60(i) + 69: 6(int) IAdd 68 20 + Store 60(i) 69 + Branch 61 + 63: Label + Branch 70 + 70: Label + LoopMerge 72 73 None + Branch 74 + 74: Label + BranchConditional 31 71 72 + 71: Label + Branch 73 + 73: Label + Branch 70 + 72: Label + Branch 75 + 75: Label + LoopMerge 77 78 None + Branch 76 + 76: Label + Branch 78 + 78: Label + BranchConditional 31 75 77 + 77: Label + Store 79(i) 9 + Branch 80 + 80: Label + LoopMerge 82 83 None + Branch 84 + 84: Label + 85: 6(int) Load 79(i) + 86: 17(bool) SLessThan 85 16 + BranchConditional 86 81 82 + 81: Label + Branch 83 + 83: Label + 87: 6(int) Load 79(i) + 88: 6(int) IAdd 87 20 + Store 79(i) 88 + Branch 80 + 82: Label + 89: 17(bool) Load 47(cond) + SelectionMerge 91 None + BranchConditional 89 90 91 + 90: Label + Branch 91 + 91: Label + 92: 17(bool) Load 47(cond) + SelectionMerge 94 None + BranchConditional 92 93 94 + 93: Label + Store 47(cond) 54 + Branch 94 + 94: Label + SelectionMerge 96 None + Switch 55 96 + case 3: 95 + 95: Label + Branch 96 + 96: Label + Branch 99 + 99: Label + LoopMerge 101 102 Unroll DontUnroll DependencyLength 2 + Branch 103 + 103: Label + 104: 17(bool) Load 47(cond) + BranchConditional 104 100 101 + 100: Label + Branch 102 + 102: Label + Branch 99 + 101: Label + SelectionMerge 106 DontFlatten + Switch 55 106 + case 3: 105 + 105: Label + Branch 106 + 106: Label + 109: 17(bool) Load 47(cond) + SelectionMerge 111 Flatten + BranchConditional 109 110 111 + 110: Label + Branch 111 + 111: Label + Branch 112 + 112: Label + LoopMerge 114 115 DependencyInfinite + Branch 116 + 116: Label + 117: 17(bool) Load 47(cond) + BranchConditional 117 113 114 + 113: Label + Branch 115 + 115: Label + Branch 112 + 114: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conversion.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conversion.frag.out index bdc1972f610..a3215324bac 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conversion.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.conversion.frag.out @@ -1,6 +1,6 @@ spv.conversion.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 455 Capability Shader @@ -119,8 +119,8 @@ spv.conversion.frag 315: 13(int) Constant 1 321: TypePointer Output 95(fvec4) 322(gl_FragColor): 321(ptr) Variable Output - 367: 13(int) Constant 2 - 380: 13(int) Constant 3 + 336: 13(int) Constant 2 + 349: 13(int) Constant 3 427: TypePointer Private 6(bool) 428(u_b): 427(ptr) Variable Private 429: TypePointer Private 23(bvec2) @@ -163,9 +163,9 @@ spv.conversion.frag 110(f2): 109(ptr) Variable Function 114(f3): 113(ptr) Variable Function 118(f4): 117(ptr) Variable Function - 297: 105(ptr) Variable Function - 307: 105(ptr) Variable Function - 323: 117(ptr) Variable Function + 298: 105(ptr) Variable Function + 309: 105(ptr) Variable Function + 353: 117(ptr) Variable Function 417(cv2): 93(ptr) Variable Function 418(cv5): 44(ptr) Variable Function 12: 9(int) Load 11(u_i) @@ -425,101 +425,101 @@ spv.conversion.frag SelectionMerge 296 None BranchConditional 294 295 296 295: Label - 298: 6(bool) Load 8(b) + 297: 6(bool) Load 8(b) SelectionMerge 300 None - BranchConditional 298 299 303 + BranchConditional 297 299 303 299: Label 301: 9(int) Load 58(i) 302: 16(float) ConvertSToF 301 - Store 297 302 + Store 298 302 Branch 300 303: Label 304: 105(ptr) AccessChain 110(f2) 14 305: 16(float) Load 304 - Store 297 305 + Store 298 305 Branch 300 300: Label - 306: 16(float) Load 297 - 308: 23(bvec2) Load 25(b2) - 309: 6(bool) CompositeExtract 308 0 + 306: 16(float) Load 298 + 307: 7(ptr) AccessChain 25(b2) 14 + 308: 6(bool) Load 307 SelectionMerge 311 None - BranchConditional 309 310 314 + BranchConditional 308 310 314 310: Label 312: 105(ptr) AccessChain 114(f3) 14 313: 16(float) Load 312 - Store 307 313 + Store 309 313 Branch 311 314: Label 316: 57(ptr) AccessChain 68(i2) 315 317: 9(int) Load 316 318: 16(float) ConvertSToF 317 - Store 307 318 + Store 309 318 Branch 311 311: Label - 319: 16(float) Load 307 + 319: 16(float) Load 309 320: 16(float) FAdd 306 319 Store 106(f) 320 Branch 296 296: Label - 324: 6(bool) Load 8(b) - 325: 23(bvec2) Load 25(b2) - 326: 6(bool) CompositeExtract 325 0 - 327: 6(bool) LogicalOr 324 326 - 328: 23(bvec2) Load 25(b2) - 329: 6(bool) CompositeExtract 328 1 - 330: 6(bool) LogicalOr 327 329 - 331: 31(bvec3) Load 33(b3) - 332: 6(bool) CompositeExtract 331 0 - 333: 6(bool) LogicalOr 330 332 - 334: 31(bvec3) Load 33(b3) - 335: 6(bool) CompositeExtract 334 1 - 336: 6(bool) LogicalOr 333 335 - 337: 31(bvec3) Load 33(b3) - 338: 6(bool) CompositeExtract 337 2 - 339: 6(bool) LogicalOr 336 338 - 340: 43(bvec4) Load 45(b4) - 341: 6(bool) CompositeExtract 340 0 + 323: 6(bool) Load 8(b) + 324: 7(ptr) AccessChain 25(b2) 14 + 325: 6(bool) Load 324 + 326: 6(bool) LogicalOr 323 325 + 327: 7(ptr) AccessChain 25(b2) 315 + 328: 6(bool) Load 327 + 329: 6(bool) LogicalOr 326 328 + 330: 7(ptr) AccessChain 33(b3) 14 + 331: 6(bool) Load 330 + 332: 6(bool) LogicalOr 329 331 + 333: 7(ptr) AccessChain 33(b3) 315 + 334: 6(bool) Load 333 + 335: 6(bool) LogicalOr 332 334 + 337: 7(ptr) AccessChain 33(b3) 336 + 338: 6(bool) Load 337 + 339: 6(bool) LogicalOr 335 338 + 340: 7(ptr) AccessChain 45(b4) 14 + 341: 6(bool) Load 340 342: 6(bool) LogicalOr 339 341 - 343: 43(bvec4) Load 45(b4) - 344: 6(bool) CompositeExtract 343 1 + 343: 7(ptr) AccessChain 45(b4) 315 + 344: 6(bool) Load 343 345: 6(bool) LogicalOr 342 344 - 346: 43(bvec4) Load 45(b4) - 347: 6(bool) CompositeExtract 346 2 + 346: 7(ptr) AccessChain 45(b4) 336 + 347: 6(bool) Load 346 348: 6(bool) LogicalOr 345 347 - 349: 43(bvec4) Load 45(b4) - 350: 6(bool) CompositeExtract 349 3 - 351: 6(bool) LogicalOr 348 350 - SelectionMerge 353 None - BranchConditional 351 352 415 - 352: Label - 354: 9(int) Load 58(i) - 355: 57(ptr) AccessChain 68(i2) 14 - 356: 9(int) Load 355 - 357: 9(int) IAdd 354 356 - 358: 57(ptr) AccessChain 68(i2) 315 - 359: 9(int) Load 358 - 360: 9(int) IAdd 357 359 - 361: 57(ptr) AccessChain 81(i3) 14 - 362: 9(int) Load 361 - 363: 9(int) IAdd 360 362 - 364: 57(ptr) AccessChain 81(i3) 315 - 365: 9(int) Load 364 - 366: 9(int) IAdd 363 365 - 368: 57(ptr) AccessChain 81(i3) 367 - 369: 9(int) Load 368 - 370: 9(int) IAdd 366 369 - 371: 57(ptr) AccessChain 94(i4) 14 - 372: 9(int) Load 371 - 373: 9(int) IAdd 370 372 - 374: 57(ptr) AccessChain 94(i4) 315 - 375: 9(int) Load 374 - 376: 9(int) IAdd 373 375 - 377: 57(ptr) AccessChain 94(i4) 367 - 378: 9(int) Load 377 - 379: 9(int) IAdd 376 378 - 381: 57(ptr) AccessChain 94(i4) 380 + 350: 7(ptr) AccessChain 45(b4) 349 + 351: 6(bool) Load 350 + 352: 6(bool) LogicalOr 348 351 + SelectionMerge 355 None + BranchConditional 352 354 415 + 354: Label + 356: 9(int) Load 58(i) + 357: 57(ptr) AccessChain 68(i2) 14 + 358: 9(int) Load 357 + 359: 9(int) IAdd 356 358 + 360: 57(ptr) AccessChain 68(i2) 315 + 361: 9(int) Load 360 + 362: 9(int) IAdd 359 361 + 363: 57(ptr) AccessChain 81(i3) 14 + 364: 9(int) Load 363 + 365: 9(int) IAdd 362 364 + 366: 57(ptr) AccessChain 81(i3) 315 + 367: 9(int) Load 366 + 368: 9(int) IAdd 365 367 + 369: 57(ptr) AccessChain 81(i3) 336 + 370: 9(int) Load 369 + 371: 9(int) IAdd 368 370 + 372: 57(ptr) AccessChain 94(i4) 14 + 373: 9(int) Load 372 + 374: 9(int) IAdd 371 373 + 375: 57(ptr) AccessChain 94(i4) 315 + 376: 9(int) Load 375 + 377: 9(int) IAdd 374 376 + 378: 57(ptr) AccessChain 94(i4) 336 + 379: 9(int) Load 378 + 380: 9(int) IAdd 377 379 + 381: 57(ptr) AccessChain 94(i4) 349 382: 9(int) Load 381 - 383: 9(int) IAdd 379 382 + 383: 9(int) IAdd 380 382 384: 16(float) ConvertSToF 383 385: 16(float) Load 106(f) 386: 16(float) FAdd 384 385 @@ -535,7 +535,7 @@ spv.conversion.frag 396: 105(ptr) AccessChain 114(f3) 315 397: 16(float) Load 396 398: 16(float) FAdd 395 397 - 399: 105(ptr) AccessChain 114(f3) 367 + 399: 105(ptr) AccessChain 114(f3) 336 400: 16(float) Load 399 401: 16(float) FAdd 398 400 402: 105(ptr) AccessChain 118(f4) 14 @@ -544,20 +544,20 @@ spv.conversion.frag 405: 105(ptr) AccessChain 118(f4) 315 406: 16(float) Load 405 407: 16(float) FAdd 404 406 - 408: 105(ptr) AccessChain 118(f4) 367 + 408: 105(ptr) AccessChain 118(f4) 336 409: 16(float) Load 408 410: 16(float) FAdd 407 409 - 411: 105(ptr) AccessChain 118(f4) 380 + 411: 105(ptr) AccessChain 118(f4) 349 412: 16(float) Load 411 413: 16(float) FAdd 410 412 414: 95(fvec4) CompositeConstruct 413 413 413 413 - Store 323 414 - Branch 353 + Store 353 414 + Branch 355 415: Label - Store 323 151 - Branch 353 - 353: Label - 416: 95(fvec4) Load 323 + Store 353 151 + Branch 355 + 355: Label + 416: 95(fvec4) Load 353 Store 322(gl_FragColor) 416 Store 417(cv2) 102 419: 92(ivec4) Load 417(cv2) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOut.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOut.frag.out index 6b990647c53..f3847213f2a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOut.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOut.frag.out @@ -1,6 +1,6 @@ spv.dataOut.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.frag.out index 520d9a84868..c0b52ae3c6a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.frag.out @@ -1,6 +1,6 @@ spv.dataOutIndirect.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 26 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.vert.out index 764cec12ce7..9ba988c653a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.dataOutIndirect.vert.out @@ -2,7 +2,7 @@ spv.dataOutIndirect.vert WARNING: 0:3: attribute deprecated in version 130; may be removed in future release // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 38 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out new file mode 100644 index 00000000000..f9c8578ca76 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.1.1.frag.out @@ -0,0 +1,279 @@ +spv.debugInfo.frag +error: SPIRV-Tools Validation Errors +error: Invalid SPIR-V binary version 1.3 for target environment SPIR-V 1.0 (under OpenGL 4.5 semantics). +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 124 + + Capability Shader + 2: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 5 "main" 24 52 + ExecutionMode 5 OriginLowerLeft + 1: String "spv.debugInfo.frag" + Source GLSL 450 1 "#version 450 + +struct S { + int a; +}; + +uniform ubuf { + S s; +}; + +uniform sampler2D s2d; + +layout(location = 0) in vec4 inv; +layout(location = 0) out vec4 outv; + +vec4 foo(S s) +{ + vec4 r = s.a * inv; + ++r; + if (r.x > 3.0) + --r; + else + r *= 2; + + return r; +} + +void main() +{ + outv = foo(s); + outv += texture(s2d, vec2(0.5)); + + switch (s.a) { + case 10: + ++outv; + break; + case 20: + outv = 2 * outv; + ++outv; + break; + default: + --outv; + break; + } + + for (int i = 0; i < 10; ++i) + outv *= 3.0; + + outv.x < 10.0 ? + outv = sin(outv) : + outv = cos(outv); +}" + Name 5 "main" + Name 8 "S" + MemberName 8(S) 0 "a" + Name 14 "foo(struct-S-i11;" + Name 13 "s" + Name 17 "r" + Name 24 "inv" + Name 52 "outv" + Name 53 "S" + MemberName 53(S) 0 "a" + Name 54 "ubuf" + MemberName 54(ubuf) 0 "s" + Name 56 "" + Name 57 "param" + Name 67 "s2d" + Name 97 "i" + ModuleProcessed "no-storage-format" + ModuleProcessed "resource-set-binding 3" + ModuleProcessed "auto-map-locations" + ModuleProcessed "client opengl100" + ModuleProcessed "target-env opengl" + ModuleProcessed "relaxed-errors" + ModuleProcessed "suppress-warnings" + ModuleProcessed "hlsl-offsets" + ModuleProcessed "entry-point main" + ModuleProcessed "use-storage-buffer" + Decorate 24(inv) Location 0 + Decorate 52(outv) Location 0 + MemberDecorate 53(S) 0 Offset 0 + MemberDecorate 54(ubuf) 0 Offset 0 + Decorate 54(ubuf) Block + Decorate 56 DescriptorSet 3 + Decorate 67(s2d) Location 0 + Decorate 67(s2d) DescriptorSet 3 + 3: TypeVoid + 4: TypeFunction 3 + 7: TypeInt 32 1 + 8(S): TypeStruct 7(int) + 9: TypePointer Function 8(S) + 10: TypeFloat 32 + 11: TypeVector 10(float) 4 + 12: TypeFunction 11(fvec4) 9(ptr) + 16: TypePointer Function 11(fvec4) + 18: 7(int) Constant 0 + 19: TypePointer Function 7(int) + 23: TypePointer Input 11(fvec4) + 24(inv): 23(ptr) Variable Input + 28: 10(float) Constant 1065353216 + 31: TypeInt 32 0 + 32: 31(int) Constant 0 + 33: TypePointer Function 10(float) + 36: 10(float) Constant 1077936128 + 37: TypeBool + 45: 10(float) Constant 1073741824 + 51: TypePointer Output 11(fvec4) + 52(outv): 51(ptr) Variable Output + 53(S): TypeStruct 7(int) + 54(ubuf): TypeStruct 53(S) + 55: TypePointer Uniform 54(ubuf) + 56: 55(ptr) Variable Uniform + 58: TypePointer Uniform 53(S) + 64: TypeImage 10(float) 2D sampled format:Unknown + 65: TypeSampledImage 64 + 66: TypePointer UniformConstant 65 + 67(s2d): 66(ptr) Variable UniformConstant + 69: TypeVector 10(float) 2 + 70: 10(float) Constant 1056964608 + 71: 69(fvec2) ConstantComposite 70 70 + 75: TypePointer Uniform 7(int) + 104: 7(int) Constant 10 + 109: 7(int) Constant 1 + 111: TypePointer Output 10(float) + 114: 10(float) Constant 1092616192 + 5(main): 3 Function None 4 + 6: Label + 57(param): 9(ptr) Variable Function + 97(i): 19(ptr) Variable Function + 116: 16(ptr) Variable Function + Line 1 30 0 + 59: 58(ptr) AccessChain 56 18 + 60: 53(S) Load 59 + 61: 7(int) CompositeExtract 60 0 + 62: 19(ptr) AccessChain 57(param) 18 + Store 62 61 + 63: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 57(param) + Store 52(outv) 63 + Line 1 31 0 + 68: 65 Load 67(s2d) + 72: 11(fvec4) ImageSampleImplicitLod 68 71 + 73: 11(fvec4) Load 52(outv) + 74: 11(fvec4) FAdd 73 72 + Store 52(outv) 74 + Line 1 33 0 + 76: 75(ptr) AccessChain 56 18 18 + 77: 7(int) Load 76 + SelectionMerge 81 None + Switch 77 80 + case 10: 78 + case 20: 79 + 80: Label + Line 1 42 0 + 92: 11(fvec4) Load 52(outv) + 93: 11(fvec4) CompositeConstruct 28 28 28 28 + 94: 11(fvec4) FSub 92 93 + Store 52(outv) 94 + Line 1 43 0 + Branch 81 + 78: Label + Line 1 35 0 + 82: 11(fvec4) Load 52(outv) + 83: 11(fvec4) CompositeConstruct 28 28 28 28 + 84: 11(fvec4) FAdd 82 83 + Store 52(outv) 84 + Line 1 36 0 + Branch 81 + 79: Label + Line 1 38 0 + 86: 11(fvec4) Load 52(outv) + 87: 11(fvec4) VectorTimesScalar 86 45 + Store 52(outv) 87 + Line 1 39 0 + 88: 11(fvec4) Load 52(outv) + 89: 11(fvec4) CompositeConstruct 28 28 28 28 + 90: 11(fvec4) FAdd 88 89 + Store 52(outv) 90 + Line 1 40 0 + Branch 81 + 81: Label + Line 1 46 0 + Store 97(i) 18 + Branch 98 + 98: Label + LoopMerge 100 101 None + Branch 102 + 102: Label + 103: 7(int) Load 97(i) + 105: 37(bool) SLessThan 103 104 + BranchConditional 105 99 100 + 99: Label + Line 1 47 0 + 106: 11(fvec4) Load 52(outv) + 107: 11(fvec4) VectorTimesScalar 106 36 + Store 52(outv) 107 + Branch 101 + 101: Label + Line 1 46 0 + 108: 7(int) Load 97(i) + 110: 7(int) IAdd 108 109 + Store 97(i) 110 + Branch 98 + 100: Label + Line 1 49 0 + 112: 111(ptr) AccessChain 52(outv) 32 + 113: 10(float) Load 112 + 115: 37(bool) FOrdLessThan 113 114 + SelectionMerge 118 None + BranchConditional 115 117 121 + 117: Label + Line 1 50 0 + 119: 11(fvec4) Load 52(outv) + 120: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 119 + Store 52(outv) 120 + Store 116 120 + Branch 118 + 121: Label + Line 1 51 0 + 122: 11(fvec4) Load 52(outv) + 123: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 122 + Store 52(outv) 123 + Store 116 123 + Branch 118 + 118: Label + Return + FunctionEnd +14(foo(struct-S-i11;): 11(fvec4) Function None 12 + 13(s): 9(ptr) FunctionParameter + 15: Label + 17(r): 16(ptr) Variable Function + Line 1 18 0 + 20: 19(ptr) AccessChain 13(s) 18 + 21: 7(int) Load 20 + 22: 10(float) ConvertSToF 21 + 25: 11(fvec4) Load 24(inv) + 26: 11(fvec4) VectorTimesScalar 25 22 + Store 17(r) 26 + Line 1 19 0 + 27: 11(fvec4) Load 17(r) + 29: 11(fvec4) CompositeConstruct 28 28 28 28 + 30: 11(fvec4) FAdd 27 29 + Store 17(r) 30 + Line 1 20 0 + 34: 33(ptr) AccessChain 17(r) 32 + 35: 10(float) Load 34 + 38: 37(bool) FOrdGreaterThan 35 36 + SelectionMerge 40 None + BranchConditional 38 39 44 + 39: Label + Line 1 21 0 + 41: 11(fvec4) Load 17(r) + 42: 11(fvec4) CompositeConstruct 28 28 28 28 + 43: 11(fvec4) FSub 41 42 + Store 17(r) 43 + Branch 40 + 44: Label + Line 1 23 0 + 46: 11(fvec4) Load 17(r) + 47: 11(fvec4) VectorTimesScalar 46 45 + Store 17(r) 47 + Branch 40 + 40: Label + Line 1 25 0 + 48: 11(fvec4) Load 17(r) + ReturnValue 48 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.frag.out index 706f068e40d..aaa988d4a73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.debugInfo.frag.out @@ -1,7 +1,7 @@ spv.debugInfo.frag // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 126 +// Generated by (magic number): 80007 +// Id's are bound by 124 Capability Shader 2: ExtInstImport "GLSL.std.450" @@ -11,6 +11,7 @@ spv.debugInfo.frag 1: String "spv.debugInfo.frag" Source GLSL 450 1 "// OpModuleProcessed no-storage-format // OpModuleProcessed resource-set-binding 3 +// OpModuleProcessed auto-map-bindings // OpModuleProcessed auto-map-locations // OpModuleProcessed client opengl100 // OpModuleProcessed target-env opengl @@ -84,18 +85,19 @@ void main() Name 54 "ubuf" MemberName 54(ubuf) 0 "s" Name 56 "" - Name 57 "S" - MemberName 57(S) 0 "a" - Name 59 "param" - Name 69 "s2d" - Name 99 "i" + Name 57 "param" + Name 67 "s2d" + Name 97 "i" Decorate 24(inv) Location 0 Decorate 52(outv) Location 0 MemberDecorate 53(S) 0 Offset 0 MemberDecorate 54(ubuf) 0 Offset 0 Decorate 54(ubuf) Block Decorate 56 DescriptorSet 3 - Decorate 69(s2d) DescriptorSet 3 + Decorate 56 Binding 0 + Decorate 67(s2d) Location 0 + Decorate 67(s2d) DescriptorSet 3 + Decorate 67(s2d) Binding 1 3: TypeVoid 4: TypeFunction 3 7: TypeInt 32 1 @@ -122,120 +124,118 @@ void main() 54(ubuf): TypeStruct 53(S) 55: TypePointer Uniform 54(ubuf) 56: 55(ptr) Variable Uniform - 57(S): TypeStruct 7(int) - 58: TypePointer Function 57(S) - 60: TypePointer Uniform 53(S) - 66: TypeImage 10(float) 2D sampled format:Unknown - 67: TypeSampledImage 66 - 68: TypePointer UniformConstant 67 - 69(s2d): 68(ptr) Variable UniformConstant - 71: TypeVector 10(float) 2 - 72: 10(float) Constant 1056964608 - 73: 71(fvec2) ConstantComposite 72 72 - 77: TypePointer Uniform 7(int) - 106: 7(int) Constant 10 - 111: 7(int) Constant 1 - 114: TypePointer Output 10(float) - 117: 10(float) Constant 1092616192 + 58: TypePointer Uniform 53(S) + 64: TypeImage 10(float) 2D sampled format:Unknown + 65: TypeSampledImage 64 + 66: TypePointer UniformConstant 65 + 67(s2d): 66(ptr) Variable UniformConstant + 69: TypeVector 10(float) 2 + 70: 10(float) Constant 1056964608 + 71: 69(fvec2) ConstantComposite 70 70 + 75: TypePointer Uniform 7(int) + 104: 7(int) Constant 10 + 109: 7(int) Constant 1 + 111: TypePointer Output 10(float) + 114: 10(float) Constant 1092616192 5(main): 3 Function None 4 6: Label - 59(param): 58(ptr) Variable Function - 99(i): 19(ptr) Variable Function - 113: 16(ptr) Variable Function + 57(param): 9(ptr) Variable Function + 97(i): 19(ptr) Variable Function + 116: 16(ptr) Variable Function Line 1 30 0 - 61: 60(ptr) AccessChain 56 18 - 62: 53(S) Load 61 - 63: 7(int) CompositeExtract 62 0 - 64: 19(ptr) AccessChain 59(param) 18 - Store 64 63 - 65: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 59(param) - Store 52(outv) 65 + 59: 58(ptr) AccessChain 56 18 + 60: 53(S) Load 59 + 61: 7(int) CompositeExtract 60 0 + 62: 19(ptr) AccessChain 57(param) 18 + Store 62 61 + 63: 11(fvec4) FunctionCall 14(foo(struct-S-i11;) 57(param) + Store 52(outv) 63 Line 1 31 0 - 70: 67 Load 69(s2d) - 74: 11(fvec4) ImageSampleImplicitLod 70 73 - 75: 11(fvec4) Load 52(outv) - 76: 11(fvec4) FAdd 75 74 - Store 52(outv) 76 + 68: 65 Load 67(s2d) + 72: 11(fvec4) ImageSampleImplicitLod 68 71 + 73: 11(fvec4) Load 52(outv) + 74: 11(fvec4) FAdd 73 72 + Store 52(outv) 74 Line 1 33 0 - 78: 77(ptr) AccessChain 56 18 18 - 79: 7(int) Load 78 - SelectionMerge 83 None - Switch 79 82 - case 10: 80 - case 20: 81 - 82: Label - Line 1 42 0 - 94: 11(fvec4) Load 52(outv) - 95: 11(fvec4) CompositeConstruct 28 28 28 28 - 96: 11(fvec4) FSub 94 95 - Store 52(outv) 96 - Line 1 43 0 - Branch 83 + 76: 75(ptr) AccessChain 56 18 18 + 77: 7(int) Load 76 + SelectionMerge 81 None + Switch 77 80 + case 10: 78 + case 20: 79 80: Label + Line 1 42 0 + 92: 11(fvec4) Load 52(outv) + 93: 11(fvec4) CompositeConstruct 28 28 28 28 + 94: 11(fvec4) FSub 92 93 + Store 52(outv) 94 + Line 1 43 0 + Branch 81 + 78: Label Line 1 35 0 - 84: 11(fvec4) Load 52(outv) - 85: 11(fvec4) CompositeConstruct 28 28 28 28 - 86: 11(fvec4) FAdd 84 85 - Store 52(outv) 86 + 82: 11(fvec4) Load 52(outv) + 83: 11(fvec4) CompositeConstruct 28 28 28 28 + 84: 11(fvec4) FAdd 82 83 + Store 52(outv) 84 Line 1 36 0 - Branch 83 - 81: Label + Branch 81 + 79: Label Line 1 38 0 - 88: 11(fvec4) Load 52(outv) - 89: 11(fvec4) VectorTimesScalar 88 45 - Store 52(outv) 89 + 86: 11(fvec4) Load 52(outv) + 87: 11(fvec4) VectorTimesScalar 86 45 + Store 52(outv) 87 Line 1 39 0 - 90: 11(fvec4) Load 52(outv) - 91: 11(fvec4) CompositeConstruct 28 28 28 28 - 92: 11(fvec4) FAdd 90 91 - Store 52(outv) 92 + 88: 11(fvec4) Load 52(outv) + 89: 11(fvec4) CompositeConstruct 28 28 28 28 + 90: 11(fvec4) FAdd 88 89 + Store 52(outv) 90 Line 1 40 0 - Branch 83 - 83: Label + Branch 81 + 81: Label Line 1 46 0 - Store 99(i) 18 - Branch 100 - 100: Label - LoopMerge 102 103 None - Branch 104 - 104: Label - 105: 7(int) Load 99(i) - 107: 37(bool) SLessThan 105 106 - BranchConditional 107 101 102 - 101: Label - Line 1 47 0 - 108: 11(fvec4) Load 52(outv) - 109: 11(fvec4) VectorTimesScalar 108 36 - Store 52(outv) 109 - Branch 103 - 103: Label - Line 1 46 0 - 110: 7(int) Load 99(i) - 112: 7(int) IAdd 110 111 - Store 99(i) 112 - Branch 100 + Store 97(i) 18 + Branch 98 + 98: Label + LoopMerge 100 101 None + Branch 102 102: Label + 103: 7(int) Load 97(i) + 105: 37(bool) SLessThan 103 104 + BranchConditional 105 99 100 + 99: Label + Line 1 47 0 + 106: 11(fvec4) Load 52(outv) + 107: 11(fvec4) VectorTimesScalar 106 36 + Store 52(outv) 107 + Branch 101 + 101: Label + Line 1 46 0 + 108: 7(int) Load 97(i) + 110: 7(int) IAdd 108 109 + Store 97(i) 110 + Branch 98 + 100: Label Line 1 49 0 - 115: 114(ptr) AccessChain 52(outv) 32 - 116: 10(float) Load 115 - 118: 37(bool) FOrdLessThan 116 117 - SelectionMerge 120 None - BranchConditional 118 119 123 - 119: Label + 112: 111(ptr) AccessChain 52(outv) 32 + 113: 10(float) Load 112 + 115: 37(bool) FOrdLessThan 113 114 + SelectionMerge 118 None + BranchConditional 115 117 121 + 117: Label Line 1 50 0 - 121: 11(fvec4) Load 52(outv) - 122: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 121 - Store 52(outv) 122 - Store 113 122 - Branch 120 - 123: Label + 119: 11(fvec4) Load 52(outv) + 120: 11(fvec4) ExtInst 2(GLSL.std.450) 13(Sin) 119 + Store 52(outv) 120 + Store 116 120 + Branch 118 + 121: Label Line 1 51 0 - 124: 11(fvec4) Load 52(outv) - 125: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 124 - Store 52(outv) 125 - Store 113 125 - Branch 120 - 120: Label + 122: 11(fvec4) Load 52(outv) + 123: 11(fvec4) ExtInst 2(GLSL.std.450) 14(Cos) 122 + Store 52(outv) 123 + Store 116 123 + Branch 118 + 118: Label Return FunctionEnd 14(foo(struct-S-i11;): 11(fvec4) Function None 12 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out index 4561f02173e..a0e4eabc344 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deepRvalue.frag.out @@ -1,6 +1,6 @@ spv.deepRvalue.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 152 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.depthOut.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.depthOut.frag.out index 12ac32cd0b7..5da0df07da5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.depthOut.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.depthOut.frag.out @@ -1,6 +1,6 @@ spv.depthOut.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 15 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deviceGroup.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deviceGroup.frag.out index 1761c92c680..6710b77f79d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deviceGroup.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.deviceGroup.frag.out @@ -1,11 +1,10 @@ spv.deviceGroup.frag -// Module Version 10000 -// Generated by (magic number): 80002 +// Module Version 10300 +// Generated by (magic number): 80007 // Id's are bound by 17 Capability Shader Capability DeviceGroup - Extension "SPV_KHR_device_group" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 9 12 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.discard-dce.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.discard-dce.frag.out index 770199b848e..9d138f294bc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.discard-dce.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.discard-dce.frag.out @@ -1,6 +1,6 @@ spv.discard-dce.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 84 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-simple.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-simple.vert.out index f503be062d5..6014dfec80c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-simple.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-simple.vert.out @@ -1,6 +1,6 @@ spv.do-simple.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 21 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-while-continue-break.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-while-continue-break.vert.out index c6a8b8680ca..28388800157 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-while-continue-break.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.do-while-continue-break.vert.out @@ -1,6 +1,6 @@ spv.do-while-continue-break.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 43 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.doWhileLoop.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.doWhileLoop.frag.out index 4cf8f09e5f4..808466eb008 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.doWhileLoop.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.doWhileLoop.frag.out @@ -1,6 +1,6 @@ spv.doWhileLoop.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 34 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.double.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.double.comp.out index 52410d8a38e..eb8e1226d07 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.double.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.double.comp.out @@ -1,6 +1,6 @@ spv.double.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 60 Capability Shader @@ -34,13 +34,13 @@ spv.double.comp 3: TypeFunction 2 6: TypeFloat 32 7: TypeFloat 64 - 8(bufName): TypeStruct 6(float) 7(float) + 8(bufName): TypeStruct 6(float) 7(float64_t) 9: TypePointer Uniform 8(bufName) 10(bufInst): 9(ptr) Variable Uniform 11: TypeInt 32 1 12: 11(int) Constant 1 - 13: 7(float) Constant 1413754136 1074340347 - 14: TypePointer Uniform 7(float) + 13:7(float64_t) Constant 1413754136 1074340347 + 14: TypePointer Uniform 7(float64_t) 16: 11(int) Constant 0 17: 6(float) Constant 1095307129 18: TypePointer Uniform 6(float) @@ -51,19 +51,19 @@ spv.double.comp 25: TypePointer Input 24(ivec3) 26(gl_GlobalInvocationID): 25(ptr) Variable Input 27: TypeVector 23(int) 2 - 31: TypePointer Function 7(float) + 31: TypePointer Function 7(float64_t) 33(gl_LocalInvocationID): 25(ptr) Variable Input 37: 11(int) Constant 8 40: TypeVector 6(float) 2 42: 6(float) Constant 1090519040 - 47: TypeVector 7(float) 4 - 48: TypePointer Function 47(fvec4) - 50: 7(float) Constant 2576980378 1071225241 - 51: 7(float) Constant 2576980378 1070176665 - 52: 7(float) Constant 858993459 1070805811 - 53: 47(fvec4) ConstantComposite 50 51 52 50 - 55: 7(float) Constant 0 1072693248 - 56: 7(float) Constant 3229815407 1074340298 + 47: TypeVector 7(float64_t) 4 + 48: TypePointer Function 47(f64vec4) + 50:7(float64_t) Constant 2576980378 1071225241 + 51:7(float64_t) Constant 2576980378 1070176665 + 52:7(float64_t) Constant 858993459 1070805811 + 53: 47(f64vec4) ConstantComposite 50 51 52 50 + 55:7(float64_t) Constant 0 1072693248 + 56:7(float64_t) Constant 3229815407 1074340298 57: TypeImage 6(float) 2D nonsampled format:Unknown 58: TypePointer UniformConstant 57 59(destTex): 58(ptr) Variable UniformConstant @@ -90,7 +90,7 @@ spv.double.comp 43: 40(fvec2) CompositeConstruct 42 42 44: 40(fvec2) FDiv 41 43 45: 6(float) ExtInst 1(GLSL.std.450) 66(Length) 44 - 46: 7(float) FConvert 45 + 46:7(float64_t) FConvert 45 Store 32(localCoef) 46 Store 49(aa) 53 Store 54(globalCoef) 55 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.drawParams.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.drawParams.vert.out index c5b29a3ee0b..8f3e2c0aa4d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.drawParams.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.drawParams.vert.out @@ -1,11 +1,10 @@ spv.drawParams.vert -// Module Version 10000 -// Generated by (magic number): 80002 +// Module Version 10300 +// Generated by (magic number): 80007 // Id's are bound by 29 Capability Shader Capability DrawParameters - Extension "SPV_KHR_shader_draw_parameters" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 "main" 10 13 16 21 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.earlyReturnDiscard.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.earlyReturnDiscard.frag.out index 61788aa0dd7..c44b722f0f6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.earlyReturnDiscard.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.earlyReturnDiscard.frag.out @@ -1,6 +1,6 @@ spv.earlyReturnDiscard.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 110 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.explicittypes.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.explicittypes.frag.out new file mode 100644 index 00000000000..44f5ddd3b36 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.explicittypes.frag.out @@ -0,0 +1,886 @@ +spv.explicittypes.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.1 specification (or requires extension) + OpCapability Float16 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 576 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + Capability StorageUniform16 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" + Name 4 "main" + Name 6 "literal(" + Name 8 "typeCast8(" + Name 10 "typeCast16(" + Name 12 "typeCast32(" + Name 14 "typeCast64(" + Name 18 "i64" + Name 26 "Uniforms" + MemberName 26(Uniforms) 0 "index" + Name 28 "" + Name 35 "indexable" + Name 40 "u64" + Name 49 "indexable" + Name 53 "i32" + Name 62 "indexable" + Name 66 "u32" + Name 74 "indexable" + Name 79 "i16" + Name 88 "indexable" + Name 93 "u16" + Name 101 "indexable" + Name 106 "i8" + Name 115 "indexable" + Name 120 "u8" + Name 128 "indexable" + Name 133 "u8v" + Name 136 "i8v" + Name 141 "i16v" + Name 150 "i32v" + Name 158 "u32v" + Name 164 "i64v" + Name 169 "u64v" + Name 183 "f16v" + Name 189 "f32v" + Name 195 "f64v" + Name 222 "u16v" + Name 252 "bv" + Name 268 "i32v" + Name 269 "i16v" + Name 272 "u16v" + Name 278 "u32v" + Name 282 "i64v" + Name 285 "u64v" + Name 296 "f16v" + Name 299 "f32v" + Name 302 "f64v" + Name 347 "i8v" + Name 353 "u8v" + Name 363 "bv" + Name 380 "u32v" + Name 381 "i32v" + Name 384 "i64v" + Name 387 "u64v" + Name 396 "f32v" + Name 399 "f64v" + Name 406 "i8v" + Name 412 "i16v" + Name 429 "u8v" + Name 435 "u16v" + Name 452 "f16v" + Name 465 "bv" + Name 481 "u64v" + Name 482 "i64v" + Name 485 "f64v" + Name 490 "i8v" + Name 496 "i16v" + Name 502 "i32v" + Name 510 "u8v" + Name 516 "u16v" + Name 522 "u32v" + Name 534 "f16v" + Name 537 "f32v" + Name 548 "bv" + Name 573 "Block" + MemberName 573(Block) 0 "i16" + MemberName 573(Block) 1 "i16v2" + MemberName 573(Block) 2 "i16v3" + MemberName 573(Block) 3 "i16v4" + MemberName 573(Block) 4 "u16" + MemberName 573(Block) 5 "u16v2" + MemberName 573(Block) 6 "u16v3" + MemberName 573(Block) 7 "u16v4" + MemberName 573(Block) 8 "i32" + MemberName 573(Block) 9 "i32v2" + MemberName 573(Block) 10 "i32v3" + MemberName 573(Block) 11 "i32v4" + MemberName 573(Block) 12 "u32" + MemberName 573(Block) 13 "u32v2" + MemberName 573(Block) 14 "u32v3" + MemberName 573(Block) 15 "u32v4" + Name 575 "block" + MemberDecorate 26(Uniforms) 0 Offset 0 + Decorate 26(Uniforms) Block + Decorate 28 DescriptorSet 0 + Decorate 28 Binding 0 + MemberDecorate 573(Block) 0 Offset 0 + MemberDecorate 573(Block) 1 Offset 4 + MemberDecorate 573(Block) 2 Offset 8 + MemberDecorate 573(Block) 3 Offset 16 + MemberDecorate 573(Block) 4 Offset 24 + MemberDecorate 573(Block) 5 Offset 28 + MemberDecorate 573(Block) 6 Offset 32 + MemberDecorate 573(Block) 7 Offset 40 + MemberDecorate 573(Block) 8 Offset 48 + MemberDecorate 573(Block) 9 Offset 56 + MemberDecorate 573(Block) 10 Offset 64 + MemberDecorate 573(Block) 11 Offset 80 + MemberDecorate 573(Block) 12 Offset 96 + MemberDecorate 573(Block) 13 Offset 104 + MemberDecorate 573(Block) 14 Offset 112 + MemberDecorate 573(Block) 15 Offset 128 + Decorate 573(Block) Block + Decorate 575(block) DescriptorSet 0 + Decorate 575(block) Binding 1 + 2: TypeVoid + 3: TypeFunction 2 + 16: TypeInt 64 1 + 17: TypePointer Function 16(int64_t) + 19: TypeInt 32 0 + 20: 19(int) Constant 3 + 21: TypeArray 16(int64_t) 20 + 22: 16(int64_t) Constant 4008636143 4008636142 + 23: 16(int64_t) Constant 4294967295 4294967295 + 24: 16(int64_t) Constant 0 1 + 25: 21 ConstantComposite 22 23 24 + 26(Uniforms): TypeStruct 19(int) + 27: TypePointer Uniform 26(Uniforms) + 28: 27(ptr) Variable Uniform + 29: TypeInt 32 1 + 30: 29(int) Constant 0 + 31: TypePointer Uniform 19(int) + 34: TypePointer Function 21 + 38: TypeInt 64 0 + 39: TypePointer Function 38(int64_t) + 41: TypeArray 38(int64_t) 20 + 42: 38(int64_t) Constant 4294967295 4294967295 + 43: 38(int64_t) Constant 0 1 + 44: 38(int64_t) Constant 4294967295 1 + 45: 41 ConstantComposite 42 43 44 + 48: TypePointer Function 41 + 52: TypePointer Function 29(int) + 54: TypeArray 29(int) 20 + 55: 29(int) Constant 4008636143 + 56: 29(int) Constant 4294967295 + 57: 29(int) Constant 536870912 + 58: 54 ConstantComposite 55 56 57 + 61: TypePointer Function 54 + 65: TypePointer Function 19(int) + 67: TypeArray 19(int) 20 + 68: 19(int) Constant 4294967295 + 69: 19(int) Constant 2147483647 + 70: 67 ConstantComposite 68 68 69 + 73: TypePointer Function 67 + 77: TypeInt 16 1 + 78: TypePointer Function 77(int16_t) + 80: TypeArray 77(int16_t) 20 + 81: 77(int16_t) Constant 4294962927 + 82: 77(int16_t) Constant 4294967295 + 83: 77(int16_t) Constant 16384 + 84: 80 ConstantComposite 81 82 83 + 87: TypePointer Function 80 + 91: TypeInt 16 0 + 92: TypePointer Function 91(int16_t) + 94: TypeArray 91(int16_t) 20 + 95: 91(int16_t) Constant 65535 + 96: 91(int16_t) Constant 32767 + 97: 94 ConstantComposite 95 95 96 + 100: TypePointer Function 94 + 104: TypeInt 8 1 + 105: TypePointer Function 104(int8_t) + 107: TypeArray 104(int8_t) 20 + 108: 104(int8_t) Constant 4294967279 + 109: 104(int8_t) Constant 4294967295 + 110: 104(int8_t) Constant 0 + 111: 107 ConstantComposite 108 109 110 + 114: TypePointer Function 107 + 118: TypeInt 8 0 + 119: TypePointer Function 118(int8_t) + 121: TypeArray 118(int8_t) 20 + 122: 118(int8_t) Constant 255 + 123: 118(int8_t) Constant 127 + 124: 121 ConstantComposite 122 122 123 + 127: TypePointer Function 121 + 131: TypeVector 118(int8_t) 2 + 132: TypePointer Function 131(i8vec2) + 134: TypeVector 104(int8_t) 2 + 135: TypePointer Function 134(i8vec2) + 139: TypeVector 77(int16_t) 2 + 140: TypePointer Function 139(i16vec2) + 145: TypeVector 91(int16_t) 2 + 148: TypeVector 29(int) 2 + 149: TypePointer Function 148(ivec2) + 154: TypeVector 19(int) 2 + 157: TypePointer Function 154(ivec2) + 162: TypeVector 16(int64_t) 2 + 163: TypePointer Function 162(i64vec2) + 167: TypeVector 38(int64_t) 2 + 168: TypePointer Function 167(i64vec2) + 180: TypeFloat 16 + 181: TypeVector 180(float16_t) 2 + 182: TypePointer Function 181(f16vec2) + 186: TypeFloat 32 + 187: TypeVector 186(float) 2 + 188: TypePointer Function 187(fvec2) + 192: TypeFloat 64 + 193: TypeVector 192(float64_t) 2 + 194: TypePointer Function 193(f64vec2) + 221: TypePointer Function 145(i16vec2) + 249: TypeBool + 250: TypeVector 249(bool) 2 + 251: TypePointer Function 250(bvec2) + 254: 104(int8_t) Constant 1 + 255: 134(i8vec2) ConstantComposite 110 110 + 256: 134(i8vec2) ConstantComposite 254 254 + 259: 118(int8_t) Constant 0 + 260: 118(int8_t) Constant 1 + 261: 131(i8vec2) ConstantComposite 259 259 + 262: 131(i8vec2) ConstantComposite 260 260 + 365: 77(int16_t) Constant 0 + 366: 77(int16_t) Constant 1 + 367:139(i16vec2) ConstantComposite 365 365 + 368:139(i16vec2) ConstantComposite 366 366 + 371: 91(int16_t) Constant 0 + 372: 91(int16_t) Constant 1 + 373:145(i16vec2) ConstantComposite 371 371 + 374:145(i16vec2) ConstantComposite 372 372 + 467: 29(int) Constant 1 + 468: 148(ivec2) ConstantComposite 30 30 + 469: 148(ivec2) ConstantComposite 467 467 + 472: 19(int) Constant 0 + 473: 19(int) Constant 1 + 474: 154(ivec2) ConstantComposite 472 472 + 475: 154(ivec2) ConstantComposite 473 473 + 550: 16(int64_t) Constant 0 0 + 551: 16(int64_t) Constant 1 0 + 552:162(i64vec2) ConstantComposite 550 550 + 553:162(i64vec2) ConstantComposite 551 551 + 556: 38(int64_t) Constant 0 0 + 557: 38(int64_t) Constant 1 0 + 558:167(i64vec2) ConstantComposite 556 556 + 559:167(i64vec2) ConstantComposite 557 557 + 565: TypeVector 77(int16_t) 3 + 566: TypeVector 77(int16_t) 4 + 567: TypeVector 91(int16_t) 3 + 568: TypeVector 91(int16_t) 4 + 569: TypeVector 29(int) 3 + 570: TypeVector 29(int) 4 + 571: TypeVector 19(int) 3 + 572: TypeVector 19(int) 4 + 573(Block): TypeStruct 77(int16_t) 139(i16vec2) 565(i16vec3) 566(i16vec4) 91(int16_t) 145(i16vec2) 567(i16vec3) 568(i16vec4) 29(int) 148(ivec2) 569(ivec3) 570(ivec4) 19(int) 154(ivec2) 571(ivec3) 572(ivec4) + 574: TypePointer Uniform 573(Block) + 575(block): 574(ptr) Variable Uniform + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 18(i64): 17(ptr) Variable Function + 35(indexable): 34(ptr) Variable Function + 40(u64): 39(ptr) Variable Function + 49(indexable): 48(ptr) Variable Function + 53(i32): 52(ptr) Variable Function + 62(indexable): 61(ptr) Variable Function + 66(u32): 65(ptr) Variable Function + 74(indexable): 73(ptr) Variable Function + 79(i16): 78(ptr) Variable Function + 88(indexable): 87(ptr) Variable Function + 93(u16): 92(ptr) Variable Function + 101(indexable): 100(ptr) Variable Function + 106(i8): 105(ptr) Variable Function + 115(indexable): 114(ptr) Variable Function + 120(u8): 119(ptr) Variable Function + 128(indexable): 127(ptr) Variable Function + 32: 31(ptr) AccessChain 28 30 + 33: 19(int) Load 32 + Store 35(indexable) 25 + 36: 17(ptr) AccessChain 35(indexable) 33 + 37: 16(int64_t) Load 36 + Store 18(i64) 37 + 46: 31(ptr) AccessChain 28 30 + 47: 19(int) Load 46 + Store 49(indexable) 45 + 50: 39(ptr) AccessChain 49(indexable) 47 + 51: 38(int64_t) Load 50 + Store 40(u64) 51 + 59: 31(ptr) AccessChain 28 30 + 60: 19(int) Load 59 + Store 62(indexable) 58 + 63: 52(ptr) AccessChain 62(indexable) 60 + 64: 29(int) Load 63 + Store 53(i32) 64 + 71: 31(ptr) AccessChain 28 30 + 72: 19(int) Load 71 + Store 74(indexable) 70 + 75: 65(ptr) AccessChain 74(indexable) 72 + 76: 19(int) Load 75 + Store 66(u32) 76 + 85: 31(ptr) AccessChain 28 30 + 86: 19(int) Load 85 + Store 88(indexable) 84 + 89: 78(ptr) AccessChain 88(indexable) 86 + 90: 77(int16_t) Load 89 + Store 79(i16) 90 + 98: 31(ptr) AccessChain 28 30 + 99: 19(int) Load 98 + Store 101(indexable) 97 + 102: 92(ptr) AccessChain 101(indexable) 99 + 103: 91(int16_t) Load 102 + Store 93(u16) 103 + 112: 31(ptr) AccessChain 28 30 + 113: 19(int) Load 112 + Store 115(indexable) 111 + 116: 105(ptr) AccessChain 115(indexable) 113 + 117: 104(int8_t) Load 116 + Store 106(i8) 117 + 125: 31(ptr) AccessChain 28 30 + 126: 19(int) Load 125 + Store 128(indexable) 124 + 129: 119(ptr) AccessChain 128(indexable) 126 + 130: 118(int8_t) Load 129 + Store 120(u8) 130 + Return + FunctionEnd + 8(typeCast8(): 2 Function None 3 + 9: Label + 133(u8v): 132(ptr) Variable Function + 136(i8v): 135(ptr) Variable Function + 141(i16v): 140(ptr) Variable Function + 150(i32v): 149(ptr) Variable Function + 158(u32v): 157(ptr) Variable Function + 164(i64v): 163(ptr) Variable Function + 169(u64v): 168(ptr) Variable Function + 183(f16v): 182(ptr) Variable Function + 189(f32v): 188(ptr) Variable Function + 195(f64v): 194(ptr) Variable Function + 222(u16v): 221(ptr) Variable Function + 252(bv): 251(ptr) Variable Function + 137: 134(i8vec2) Load 136(i8v) + 138: 131(i8vec2) Bitcast 137 + Store 133(u8v) 138 + 142: 134(i8vec2) Load 136(i8v) + 143:139(i16vec2) SConvert 142 + Store 141(i16v) 143 + 144: 131(i8vec2) Load 133(u8v) + 146:145(i16vec2) UConvert 144 + 147:139(i16vec2) Bitcast 146 + Store 141(i16v) 147 + 151: 134(i8vec2) Load 136(i8v) + 152: 148(ivec2) SConvert 151 + Store 150(i32v) 152 + 153: 131(i8vec2) Load 133(u8v) + 155: 154(ivec2) UConvert 153 + 156: 148(ivec2) Bitcast 155 + Store 150(i32v) 156 + 159: 134(i8vec2) Load 136(i8v) + 160: 148(ivec2) SConvert 159 + 161: 154(ivec2) Bitcast 160 + Store 158(u32v) 161 + 165: 134(i8vec2) Load 136(i8v) + 166:162(i64vec2) SConvert 165 + Store 164(i64v) 166 + 170: 134(i8vec2) Load 136(i8v) + 171:162(i64vec2) SConvert 170 + 172:167(i64vec2) Bitcast 171 + Store 169(u64v) 172 + 173: 131(i8vec2) Load 133(u8v) + 174: 154(ivec2) UConvert 173 + Store 158(u32v) 174 + 175: 131(i8vec2) Load 133(u8v) + 176:167(i64vec2) UConvert 175 + 177:162(i64vec2) Bitcast 176 + Store 164(i64v) 177 + 178: 131(i8vec2) Load 133(u8v) + 179:167(i64vec2) UConvert 178 + Store 169(u64v) 179 + 184: 134(i8vec2) Load 136(i8v) + 185:181(f16vec2) ConvertSToF 184 + Store 183(f16v) 185 + 190: 134(i8vec2) Load 136(i8v) + 191: 187(fvec2) ConvertSToF 190 + Store 189(f32v) 191 + 196: 134(i8vec2) Load 136(i8v) + 197:193(f64vec2) ConvertSToF 196 + Store 195(f64v) 197 + 198: 131(i8vec2) Load 133(u8v) + 199:181(f16vec2) ConvertUToF 198 + Store 183(f16v) 199 + 200: 131(i8vec2) Load 133(u8v) + 201: 187(fvec2) ConvertUToF 200 + Store 189(f32v) 201 + 202: 131(i8vec2) Load 133(u8v) + 203:193(f64vec2) ConvertUToF 202 + Store 195(f64v) 203 + 204: 131(i8vec2) Load 133(u8v) + 205: 134(i8vec2) Bitcast 204 + Store 136(i8v) 205 + 206: 134(i8vec2) Load 136(i8v) + 207:139(i16vec2) SConvert 206 + Store 141(i16v) 207 + 208: 131(i8vec2) Load 133(u8v) + 209:145(i16vec2) UConvert 208 + 210:139(i16vec2) Bitcast 209 + Store 141(i16v) 210 + 211: 134(i8vec2) Load 136(i8v) + 212: 148(ivec2) SConvert 211 + Store 150(i32v) 212 + 213: 131(i8vec2) Load 133(u8v) + 214: 154(ivec2) UConvert 213 + 215: 148(ivec2) Bitcast 214 + Store 150(i32v) 215 + 216: 134(i8vec2) Load 136(i8v) + 217:162(i64vec2) SConvert 216 + Store 164(i64v) 217 + 218: 134(i8vec2) Load 136(i8v) + 219:162(i64vec2) SConvert 218 + 220:167(i64vec2) Bitcast 219 + Store 169(u64v) 220 + 223: 134(i8vec2) Load 136(i8v) + 224:139(i16vec2) SConvert 223 + 225:145(i16vec2) Bitcast 224 + Store 222(u16v) 225 + 226: 131(i8vec2) Load 133(u8v) + 227:145(i16vec2) UConvert 226 + Store 222(u16v) 227 + 228: 131(i8vec2) Load 133(u8v) + 229: 154(ivec2) UConvert 228 + Store 158(u32v) 229 + 230: 131(i8vec2) Load 133(u8v) + 231:167(i64vec2) UConvert 230 + 232:162(i64vec2) Bitcast 231 + Store 164(i64v) 232 + 233: 131(i8vec2) Load 133(u8v) + 234:167(i64vec2) UConvert 233 + 235:162(i64vec2) Bitcast 234 + 236:167(i64vec2) Bitcast 235 + Store 169(u64v) 236 + 237: 134(i8vec2) Load 136(i8v) + 238:181(f16vec2) ConvertSToF 237 + Store 183(f16v) 238 + 239: 134(i8vec2) Load 136(i8v) + 240: 187(fvec2) ConvertSToF 239 + Store 189(f32v) 240 + 241: 134(i8vec2) Load 136(i8v) + 242:193(f64vec2) ConvertSToF 241 + Store 195(f64v) 242 + 243: 131(i8vec2) Load 133(u8v) + 244:181(f16vec2) ConvertUToF 243 + Store 183(f16v) 244 + 245: 131(i8vec2) Load 133(u8v) + 246: 187(fvec2) ConvertUToF 245 + Store 189(f32v) 246 + 247: 131(i8vec2) Load 133(u8v) + 248:193(f64vec2) ConvertUToF 247 + Store 195(f64v) 248 + 253: 250(bvec2) Load 252(bv) + 257: 134(i8vec2) Select 253 256 255 + Store 136(i8v) 257 + 258: 250(bvec2) Load 252(bv) + 263: 131(i8vec2) Select 258 262 261 + Store 133(u8v) 263 + 264: 134(i8vec2) Load 136(i8v) + 265: 250(bvec2) INotEqual 264 261 + Store 252(bv) 265 + 266: 131(i8vec2) Load 133(u8v) + 267: 250(bvec2) INotEqual 266 261 + Store 252(bv) 267 + Return + FunctionEnd + 10(typeCast16(): 2 Function None 3 + 11: Label + 268(i32v): 149(ptr) Variable Function + 269(i16v): 140(ptr) Variable Function + 272(u16v): 221(ptr) Variable Function + 278(u32v): 157(ptr) Variable Function + 282(i64v): 163(ptr) Variable Function + 285(u64v): 168(ptr) Variable Function + 296(f16v): 182(ptr) Variable Function + 299(f32v): 188(ptr) Variable Function + 302(f64v): 194(ptr) Variable Function + 347(i8v): 135(ptr) Variable Function + 353(u8v): 132(ptr) Variable Function + 363(bv): 251(ptr) Variable Function + 270:139(i16vec2) Load 269(i16v) + 271: 148(ivec2) SConvert 270 + Store 268(i32v) 271 + 273:145(i16vec2) Load 272(u16v) + 274: 154(ivec2) UConvert 273 + 275: 148(ivec2) Bitcast 274 + Store 268(i32v) 275 + 276:139(i16vec2) Load 269(i16v) + 277:145(i16vec2) Bitcast 276 + Store 272(u16v) 277 + 279:139(i16vec2) Load 269(i16v) + 280: 148(ivec2) SConvert 279 + 281: 154(ivec2) Bitcast 280 + Store 278(u32v) 281 + 283:139(i16vec2) Load 269(i16v) + 284:162(i64vec2) SConvert 283 + Store 282(i64v) 284 + 286:139(i16vec2) Load 269(i16v) + 287:162(i64vec2) SConvert 286 + 288:167(i64vec2) Bitcast 287 + Store 285(u64v) 288 + 289:145(i16vec2) Load 272(u16v) + 290: 154(ivec2) UConvert 289 + Store 278(u32v) 290 + 291:145(i16vec2) Load 272(u16v) + 292:167(i64vec2) UConvert 291 + 293:162(i64vec2) Bitcast 292 + Store 282(i64v) 293 + 294:145(i16vec2) Load 272(u16v) + 295:167(i64vec2) UConvert 294 + Store 285(u64v) 295 + 297:139(i16vec2) Load 269(i16v) + 298:181(f16vec2) ConvertSToF 297 + Store 296(f16v) 298 + 300:139(i16vec2) Load 269(i16v) + 301: 187(fvec2) ConvertSToF 300 + Store 299(f32v) 301 + 303:139(i16vec2) Load 269(i16v) + 304:193(f64vec2) ConvertSToF 303 + Store 302(f64v) 304 + 305:145(i16vec2) Load 272(u16v) + 306:181(f16vec2) ConvertUToF 305 + Store 296(f16v) 306 + 307:145(i16vec2) Load 272(u16v) + 308: 187(fvec2) ConvertUToF 307 + Store 299(f32v) 308 + 309:145(i16vec2) Load 272(u16v) + 310:193(f64vec2) ConvertUToF 309 + Store 302(f64v) 310 + 311:139(i16vec2) Load 269(i16v) + 312: 148(ivec2) SConvert 311 + Store 268(i32v) 312 + 313:145(i16vec2) Load 272(u16v) + 314: 154(ivec2) UConvert 313 + 315: 148(ivec2) Bitcast 314 + Store 268(i32v) 315 + 316:139(i16vec2) Load 269(i16v) + 317:145(i16vec2) Bitcast 316 + Store 272(u16v) 317 + 318:139(i16vec2) Load 269(i16v) + 319: 148(ivec2) SConvert 318 + 320: 154(ivec2) Bitcast 319 + Store 278(u32v) 320 + 321:139(i16vec2) Load 269(i16v) + 322:162(i64vec2) SConvert 321 + Store 282(i64v) 322 + 323:139(i16vec2) Load 269(i16v) + 324:162(i64vec2) SConvert 323 + 325:167(i64vec2) Bitcast 324 + Store 285(u64v) 325 + 326:145(i16vec2) Load 272(u16v) + 327: 154(ivec2) UConvert 326 + Store 278(u32v) 327 + 328:145(i16vec2) Load 272(u16v) + 329:167(i64vec2) UConvert 328 + 330:162(i64vec2) Bitcast 329 + Store 282(i64v) 330 + 331:145(i16vec2) Load 272(u16v) + 332:167(i64vec2) UConvert 331 + 333:162(i64vec2) Bitcast 332 + 334:167(i64vec2) Bitcast 333 + Store 285(u64v) 334 + 335:139(i16vec2) Load 269(i16v) + 336:181(f16vec2) ConvertSToF 335 + Store 296(f16v) 336 + 337:139(i16vec2) Load 269(i16v) + 338: 187(fvec2) ConvertSToF 337 + Store 299(f32v) 338 + 339:139(i16vec2) Load 269(i16v) + 340:193(f64vec2) ConvertSToF 339 + Store 302(f64v) 340 + 341:145(i16vec2) Load 272(u16v) + 342:181(f16vec2) ConvertUToF 341 + Store 296(f16v) 342 + 343:145(i16vec2) Load 272(u16v) + 344: 187(fvec2) ConvertUToF 343 + Store 299(f32v) 344 + 345:145(i16vec2) Load 272(u16v) + 346:193(f64vec2) ConvertUToF 345 + Store 302(f64v) 346 + 348:139(i16vec2) Load 269(i16v) + 349: 134(i8vec2) SConvert 348 + Store 347(i8v) 349 + 350:145(i16vec2) Load 272(u16v) + 351: 131(i8vec2) UConvert 350 + 352: 134(i8vec2) Bitcast 351 + Store 347(i8v) 352 + 354:139(i16vec2) Load 269(i16v) + 355: 134(i8vec2) SConvert 354 + 356: 131(i8vec2) Bitcast 355 + Store 353(u8v) 356 + 357:145(i16vec2) Load 272(u16v) + 358: 131(i8vec2) UConvert 357 + Store 353(u8v) 358 + 359:145(i16vec2) Load 272(u16v) + 360: 131(i8vec2) UConvert 359 + 361:145(i16vec2) UConvert 360 + 362:139(i16vec2) Bitcast 361 + Store 269(i16v) 362 + 364: 250(bvec2) Load 363(bv) + 369:139(i16vec2) Select 364 368 367 + Store 269(i16v) 369 + 370: 250(bvec2) Load 363(bv) + 375:145(i16vec2) Select 370 374 373 + Store 272(u16v) 375 + 376:139(i16vec2) Load 269(i16v) + 377: 250(bvec2) INotEqual 376 373 + Store 363(bv) 377 + 378:145(i16vec2) Load 272(u16v) + 379: 250(bvec2) INotEqual 378 373 + Store 363(bv) 379 + Return + FunctionEnd + 12(typeCast32(): 2 Function None 3 + 13: Label + 380(u32v): 157(ptr) Variable Function + 381(i32v): 149(ptr) Variable Function + 384(i64v): 163(ptr) Variable Function + 387(u64v): 168(ptr) Variable Function + 396(f32v): 188(ptr) Variable Function + 399(f64v): 194(ptr) Variable Function + 406(i8v): 135(ptr) Variable Function + 412(i16v): 140(ptr) Variable Function + 429(u8v): 132(ptr) Variable Function + 435(u16v): 221(ptr) Variable Function + 452(f16v): 182(ptr) Variable Function + 465(bv): 251(ptr) Variable Function + 382: 148(ivec2) Load 381(i32v) + 383: 154(ivec2) Bitcast 382 + Store 380(u32v) 383 + 385: 148(ivec2) Load 381(i32v) + 386:162(i64vec2) SConvert 385 + Store 384(i64v) 386 + 388: 148(ivec2) Load 381(i32v) + 389:162(i64vec2) SConvert 388 + 390:167(i64vec2) Bitcast 389 + Store 387(u64v) 390 + 391: 154(ivec2) Load 380(u32v) + 392:167(i64vec2) UConvert 391 + 393:162(i64vec2) Bitcast 392 + Store 384(i64v) 393 + 394: 154(ivec2) Load 380(u32v) + 395:167(i64vec2) UConvert 394 + Store 387(u64v) 395 + 397: 148(ivec2) Load 381(i32v) + 398: 187(fvec2) ConvertSToF 397 + Store 396(f32v) 398 + 400: 148(ivec2) Load 381(i32v) + 401:193(f64vec2) ConvertSToF 400 + Store 399(f64v) 401 + 402: 154(ivec2) Load 380(u32v) + 403: 187(fvec2) ConvertUToF 402 + Store 396(f32v) 403 + 404: 154(ivec2) Load 380(u32v) + 405:193(f64vec2) ConvertUToF 404 + Store 399(f64v) 405 + 407: 148(ivec2) Load 381(i32v) + 408: 134(i8vec2) SConvert 407 + Store 406(i8v) 408 + 409: 154(ivec2) Load 380(u32v) + 410: 131(i8vec2) UConvert 409 + 411: 134(i8vec2) Bitcast 410 + Store 406(i8v) 411 + 413: 148(ivec2) Load 381(i32v) + 414:139(i16vec2) SConvert 413 + Store 412(i16v) 414 + 415: 154(ivec2) Load 380(u32v) + 416:145(i16vec2) UConvert 415 + 417:139(i16vec2) Bitcast 416 + Store 412(i16v) 417 + 418: 148(ivec2) Load 381(i32v) + 419: 29(int) CompositeExtract 418 0 + 420: 29(int) CompositeExtract 418 1 + 421: 148(ivec2) CompositeConstruct 419 420 + Store 381(i32v) 421 + 422: 154(ivec2) Load 380(u32v) + 423: 148(ivec2) Bitcast 422 + Store 381(i32v) 423 + 424: 148(ivec2) Load 381(i32v) + 425:162(i64vec2) SConvert 424 + Store 384(i64v) 425 + 426: 154(ivec2) Load 380(u32v) + 427:167(i64vec2) UConvert 426 + 428:162(i64vec2) Bitcast 427 + Store 384(i64v) 428 + 430: 148(ivec2) Load 381(i32v) + 431: 134(i8vec2) SConvert 430 + 432: 131(i8vec2) Bitcast 431 + Store 429(u8v) 432 + 433: 154(ivec2) Load 380(u32v) + 434: 131(i8vec2) UConvert 433 + Store 429(u8v) 434 + 436: 148(ivec2) Load 381(i32v) + 437:139(i16vec2) SConvert 436 + 438:145(i16vec2) Bitcast 437 + Store 435(u16v) 438 + 439: 154(ivec2) Load 380(u32v) + 440:145(i16vec2) UConvert 439 + Store 435(u16v) 440 + 441: 148(ivec2) Load 381(i32v) + 442: 154(ivec2) Bitcast 441 + Store 380(u32v) 442 + 443: 154(ivec2) Load 380(u32v) + 444: 19(int) CompositeExtract 443 0 + 445: 19(int) CompositeExtract 443 1 + 446: 154(ivec2) CompositeConstruct 444 445 + Store 380(u32v) 446 + 447: 148(ivec2) Load 381(i32v) + 448:162(i64vec2) SConvert 447 + 449:167(i64vec2) Bitcast 448 + Store 387(u64v) 449 + 450: 154(ivec2) Load 380(u32v) + 451:167(i64vec2) UConvert 450 + Store 387(u64v) 451 + 453: 148(ivec2) Load 381(i32v) + 454:181(f16vec2) ConvertSToF 453 + Store 452(f16v) 454 + 455: 148(ivec2) Load 381(i32v) + 456: 187(fvec2) ConvertSToF 455 + Store 396(f32v) 456 + 457: 148(ivec2) Load 381(i32v) + 458:193(f64vec2) ConvertSToF 457 + Store 399(f64v) 458 + 459: 154(ivec2) Load 380(u32v) + 460:181(f16vec2) ConvertUToF 459 + Store 452(f16v) 460 + 461: 154(ivec2) Load 380(u32v) + 462: 187(fvec2) ConvertUToF 461 + Store 396(f32v) 462 + 463: 154(ivec2) Load 380(u32v) + 464:193(f64vec2) ConvertUToF 463 + Store 399(f64v) 464 + 466: 250(bvec2) Load 465(bv) + 470: 148(ivec2) Select 466 469 468 + Store 381(i32v) 470 + 471: 250(bvec2) Load 465(bv) + 476: 154(ivec2) Select 471 475 474 + Store 380(u32v) 476 + 477: 148(ivec2) Load 381(i32v) + 478: 250(bvec2) INotEqual 477 474 + Store 465(bv) 478 + 479: 154(ivec2) Load 380(u32v) + 480: 250(bvec2) INotEqual 479 474 + Store 465(bv) 480 + Return + FunctionEnd + 14(typeCast64(): 2 Function None 3 + 15: Label + 481(u64v): 168(ptr) Variable Function + 482(i64v): 163(ptr) Variable Function + 485(f64v): 194(ptr) Variable Function + 490(i8v): 135(ptr) Variable Function + 496(i16v): 140(ptr) Variable Function + 502(i32v): 149(ptr) Variable Function + 510(u8v): 132(ptr) Variable Function + 516(u16v): 221(ptr) Variable Function + 522(u32v): 157(ptr) Variable Function + 534(f16v): 182(ptr) Variable Function + 537(f32v): 188(ptr) Variable Function + 548(bv): 251(ptr) Variable Function + 483:162(i64vec2) Load 482(i64v) + 484:167(i64vec2) Bitcast 483 + Store 481(u64v) 484 + 486:162(i64vec2) Load 482(i64v) + 487:193(f64vec2) ConvertSToF 486 + Store 485(f64v) 487 + 488:167(i64vec2) Load 481(u64v) + 489:193(f64vec2) ConvertUToF 488 + Store 485(f64v) 489 + 491:162(i64vec2) Load 482(i64v) + 492: 134(i8vec2) SConvert 491 + Store 490(i8v) 492 + 493:167(i64vec2) Load 481(u64v) + 494: 131(i8vec2) UConvert 493 + 495: 134(i8vec2) Bitcast 494 + Store 490(i8v) 495 + 497:162(i64vec2) Load 482(i64v) + 498:139(i16vec2) SConvert 497 + Store 496(i16v) 498 + 499:167(i64vec2) Load 481(u64v) + 500:145(i16vec2) UConvert 499 + 501:139(i16vec2) Bitcast 500 + Store 496(i16v) 501 + 503:162(i64vec2) Load 482(i64v) + 504: 148(ivec2) SConvert 503 + Store 502(i32v) 504 + 505:167(i64vec2) Load 481(u64v) + 506: 154(ivec2) UConvert 505 + 507: 148(ivec2) Bitcast 506 + Store 502(i32v) 507 + 508:167(i64vec2) Load 481(u64v) + 509:162(i64vec2) Bitcast 508 + Store 482(i64v) 509 + 511:162(i64vec2) Load 482(i64v) + 512: 134(i8vec2) SConvert 511 + 513: 131(i8vec2) Bitcast 512 + Store 510(u8v) 513 + 514:167(i64vec2) Load 481(u64v) + 515: 131(i8vec2) UConvert 514 + Store 510(u8v) 515 + 517:162(i64vec2) Load 482(i64v) + 518:139(i16vec2) SConvert 517 + 519:145(i16vec2) Bitcast 518 + Store 516(u16v) 519 + 520:167(i64vec2) Load 481(u64v) + 521:145(i16vec2) UConvert 520 + Store 516(u16v) 521 + 523:162(i64vec2) Load 482(i64v) + 524: 148(ivec2) SConvert 523 + 525: 154(ivec2) Bitcast 524 + Store 522(u32v) 525 + 526:167(i64vec2) Load 481(u64v) + 527: 154(ivec2) UConvert 526 + Store 522(u32v) 527 + 528:162(i64vec2) Load 482(i64v) + 529:167(i64vec2) Bitcast 528 + Store 481(u64v) 529 + 530:167(i64vec2) Load 481(u64v) + 531: 38(int64_t) CompositeExtract 530 0 + 532: 38(int64_t) CompositeExtract 530 1 + 533:167(i64vec2) CompositeConstruct 531 532 + Store 481(u64v) 533 + 535:162(i64vec2) Load 482(i64v) + 536:181(f16vec2) ConvertSToF 535 + Store 534(f16v) 536 + 538:162(i64vec2) Load 482(i64v) + 539: 187(fvec2) ConvertSToF 538 + Store 537(f32v) 539 + 540:162(i64vec2) Load 482(i64v) + 541:193(f64vec2) ConvertSToF 540 + Store 485(f64v) 541 + 542:167(i64vec2) Load 481(u64v) + 543:181(f16vec2) ConvertUToF 542 + Store 534(f16v) 543 + 544:167(i64vec2) Load 481(u64v) + 545: 187(fvec2) ConvertUToF 544 + Store 537(f32v) 545 + 546:167(i64vec2) Load 481(u64v) + 547:193(f64vec2) ConvertUToF 546 + Store 485(f64v) 547 + 549: 250(bvec2) Load 548(bv) + 554:162(i64vec2) Select 549 553 552 + Store 482(i64v) 554 + 555: 250(bvec2) Load 548(bv) + 560:167(i64vec2) Select 555 559 558 + Store 481(u64v) 560 + 561:162(i64vec2) Load 482(i64v) + 562: 250(bvec2) INotEqual 561 558 + Store 548(bv) 562 + 563:167(i64vec2) Load 481(u64v) + 564: 250(bvec2) INotEqual 563 558 + Store 548(bv) 564 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out index ca777e0fc71..85a23593684 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.extPostDepthCoverage.frag.out @@ -1,6 +1,6 @@ spv.extPostDepthCoverage.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 6 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16.frag.out index 004ba52bdd6..37c66390eb7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16.frag.out @@ -1,6 +1,10 @@ spv.float16.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability Float16 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 534 Capability Shader @@ -110,6 +114,10 @@ spv.float16.frag Name 526 "sf16" Name 527 "sf" Name 528 "sd" + Name 529 "f16_to_f" + Name 531 "f16_to_d" + Name 532 "f_to_f16" + Name 533 "d_to_f16" Decorate 512 ArrayStride 16 Decorate 513 ArrayStride 32 MemberDecorate 514(S) 0 Offset 0 @@ -156,86 +164,86 @@ spv.float16.frag 2: TypeVoid 3: TypeFunction 2 28: TypeFloat 16 - 29: TypeVector 28(float) 2 - 30: TypePointer Function 29(fvec2) - 32: 28(float) Constant 16 + 29: TypeVector 28(float16_t) 2 + 30: TypePointer Function 29(f16vec2) + 32:28(float16_t) Constant 16 33: TypeInt 32 0 34: 33(int) Constant 0 - 35: TypePointer Function 28(float) - 37: 28(float) Constant 46080 - 38: 28(float) Constant 10158 - 39: 29(fvec2) ConstantComposite 37 38 - 56: 28(float) Constant 15360 - 62: TypeMatrix 29(fvec2) 2 + 35: TypePointer Function 28(float16_t) + 37:28(float16_t) Constant 46080 + 38:28(float16_t) Constant 10158 + 39: 29(f16vec2) ConstantComposite 37 38 + 56:28(float16_t) Constant 15360 + 62: TypeMatrix 29(f16vec2) 2 63: TypePointer Function 62 90: 33(int) Constant 1 109: TypeBool 110: TypePointer Function 109(bool) - 151: TypeVector 28(float) 3 - 152: TypePointer Function 151(fvec3) + 151: TypeVector 28(float16_t) 3 + 152: TypePointer Function 151(f16vec3) 154: TypeVector 109(bool) 3 155: TypePointer Function 154(bvec3) - 158: 28(float) Constant 0 - 159: 151(fvec3) ConstantComposite 158 158 158 - 160: 151(fvec3) ConstantComposite 56 56 56 + 158:28(float16_t) Constant 0 + 159:151(f16vec3) ConstantComposite 158 158 158 + 160:151(f16vec3) ConstantComposite 56 56 56 164: TypeFloat 32 165: TypeVector 164(float) 3 166: TypePointer Function 165(fvec3) 172: TypeFloat 64 - 173: TypeVector 172(float) 3 - 174: TypePointer Function 173(fvec3) + 173: TypeVector 172(float64_t) 3 + 174: TypePointer Function 173(f64vec3) 183: TypeInt 32 1 184: TypeVector 183(int) 3 185: TypePointer Function 184(ivec3) 191: TypeVector 33(int) 3 192: TypePointer Function 191(ivec3) 198: TypeInt 64 1 - 199: TypeVector 198(int) 3 - 200: TypePointer Function 199(ivec3) + 199: TypeVector 198(int64_t) 3 + 200: TypePointer Function 199(i64vec3) 206: TypeInt 64 0 - 207: TypeVector 206(int) 3 - 208: TypePointer Function 207(ivec3) - 214: TypeVector 28(float) 4 - 215: TypePointer Function 214(fvec4) - 364(ResType): TypeStruct 151(fvec3) 184(ivec3) + 207: TypeVector 206(int64_t) 3 + 208: TypePointer Function 207(i64vec3) + 214: TypeVector 28(float16_t) 4 + 215: TypePointer Function 214(f16vec4) + 364(ResType): TypeStruct 151(f16vec3) 184(ivec3) 371: TypePointer Function 33(int) - 406: TypeMatrix 151(fvec3) 2 + 406: TypeMatrix 151(f16vec3) 2 407: TypePointer Function 406 - 425: TypeMatrix 29(fvec2) 3 + 425: TypeMatrix 29(f16vec2) 3 426: TypePointer Function 425 - 431: TypeMatrix 151(fvec3) 3 + 431: TypeMatrix 151(f16vec3) 3 432: TypePointer Function 431 - 436: TypeMatrix 214(fvec4) 4 + 436: TypeMatrix 214(f16vec4) 4 437: TypePointer Function 436 - 464: TypePointer Input 151(fvec3) + 464: TypePointer Input 151(f16vec3) 465(if16v): 464(ptr) Variable Input - 466: TypePointer Input 28(float) + 466: TypePointer Input 28(float16_t) 503: 183(int) Constant 1 - 508: 28(float) Constant 14336 - 509: 29(fvec2) ConstantComposite 508 508 + 508:28(float16_t) Constant 14336 + 509: 29(f16vec2) ConstantComposite 508 508 511: 33(int) Constant 2 - 512: TypeArray 28(float) 511 + 512: TypeArray 28(float16_t) 511 513: TypeArray 406 511 - 514(S): TypeStruct 28(float) 29(fvec2) 151(fvec3) + 514(S): TypeStruct 28(float16_t) 29(f16vec2) 151(f16vec3) 515: TypeArray 514(S) 511 - 516(B1): TypeStruct 28(float) 29(fvec2) 151(fvec3) 512 406 513 514(S) 515 + 516(B1): TypeStruct 28(float16_t) 29(f16vec2) 151(f16vec3) 512 406 513 514(S) 515 517: TypePointer Uniform 516(B1) 518: 517(ptr) Variable Uniform - 519: TypeArray 28(float) 511 + 519: TypeArray 28(float16_t) 511 520: TypeArray 406 511 - 521(S): TypeStruct 28(float) 29(fvec2) 151(fvec3) + 521(S): TypeStruct 28(float16_t) 29(f16vec2) 151(f16vec3) 522: TypeArray 521(S) 511 - 523(B2): TypeStruct 28(float) 29(fvec2) 151(fvec3) 519 406 520 521(S) 522 + 523(B2): TypeStruct 28(float16_t) 29(f16vec2) 151(f16vec3) 519 406 520 521(S) 522 524: TypePointer Uniform 523(B2) 525: 524(ptr) Variable Uniform - 526(sf16): 28(float) SpecConstant 12288 + 526(sf16):28(float16_t) SpecConstant 12288 527(sf): 164(float) SpecConstant 1048576000 - 528(sd): 172(float) SpecConstant 0 1071644672 - 529: 164(float) SpecConstantOp 115 526(sf16) + 528(sd):172(float64_t) SpecConstant 0 1071644672 + 529(f16_to_f): 164(float) SpecConstantOp 115 526(sf16) 530: 164(float) SpecConstantOp 115 526(sf16) - 531: 172(float) SpecConstantOp 115 530 - 532: 28(float) SpecConstantOp 115 527(sf) - 533: 28(float) SpecConstantOp 115 528(sd) + 531(f16_to_d):172(float64_t) SpecConstantOp 115 530 + 532(f_to_f16):28(float16_t) SpecConstantOp 115 527(sf) + 533(d_to_f16):28(float16_t) SpecConstantOp 115 528(sd) 4(main): 2 Function None 3 5: Label Return @@ -245,8 +253,8 @@ spv.float16.frag 31(f16v): 30(ptr) Variable Function 36: 35(ptr) AccessChain 31(f16v) 34 Store 36 32 - 40: 29(fvec2) Load 31(f16v) - 41: 29(fvec2) FAdd 40 39 + 40: 29(f16vec2) Load 31(f16v) + 41: 29(f16vec2) FAdd 40 39 Store 31(f16v) 41 Return FunctionEnd @@ -256,125 +264,125 @@ spv.float16.frag 64(f16m): 63(ptr) Variable Function 87(f16): 35(ptr) Variable Function 111(b): 110(ptr) Variable Function - 43: 29(fvec2) Load 42(f16v) - 44: 29(fvec2) Load 42(f16v) - 45: 29(fvec2) FAdd 44 43 + 43: 29(f16vec2) Load 42(f16v) + 44: 29(f16vec2) Load 42(f16v) + 45: 29(f16vec2) FAdd 44 43 Store 42(f16v) 45 - 46: 29(fvec2) Load 42(f16v) - 47: 29(fvec2) Load 42(f16v) - 48: 29(fvec2) FSub 47 46 + 46: 29(f16vec2) Load 42(f16v) + 47: 29(f16vec2) Load 42(f16v) + 48: 29(f16vec2) FSub 47 46 Store 42(f16v) 48 - 49: 29(fvec2) Load 42(f16v) - 50: 29(fvec2) Load 42(f16v) - 51: 29(fvec2) FMul 50 49 + 49: 29(f16vec2) Load 42(f16v) + 50: 29(f16vec2) Load 42(f16v) + 51: 29(f16vec2) FMul 50 49 Store 42(f16v) 51 - 52: 29(fvec2) Load 42(f16v) - 53: 29(fvec2) Load 42(f16v) - 54: 29(fvec2) FDiv 53 52 + 52: 29(f16vec2) Load 42(f16v) + 53: 29(f16vec2) Load 42(f16v) + 54: 29(f16vec2) FDiv 53 52 Store 42(f16v) 54 - 55: 29(fvec2) Load 42(f16v) - 57: 29(fvec2) CompositeConstruct 56 56 - 58: 29(fvec2) FAdd 55 57 + 55: 29(f16vec2) Load 42(f16v) + 57: 29(f16vec2) CompositeConstruct 56 56 + 58: 29(f16vec2) FAdd 55 57 Store 42(f16v) 58 - 59: 29(fvec2) Load 42(f16v) - 60: 29(fvec2) CompositeConstruct 56 56 - 61: 29(fvec2) FSub 59 60 + 59: 29(f16vec2) Load 42(f16v) + 60: 29(f16vec2) CompositeConstruct 56 56 + 61: 29(f16vec2) FSub 59 60 Store 42(f16v) 61 65: 62 Load 64(f16m) - 66: 29(fvec2) CompositeConstruct 56 56 - 67: 29(fvec2) CompositeExtract 65 0 - 68: 29(fvec2) FAdd 67 66 - 69: 29(fvec2) CompositeExtract 65 1 - 70: 29(fvec2) FAdd 69 66 + 66: 29(f16vec2) CompositeConstruct 56 56 + 67: 29(f16vec2) CompositeExtract 65 0 + 68: 29(f16vec2) FAdd 67 66 + 69: 29(f16vec2) CompositeExtract 65 1 + 70: 29(f16vec2) FAdd 69 66 71: 62 CompositeConstruct 68 70 Store 64(f16m) 71 72: 62 Load 64(f16m) - 73: 29(fvec2) CompositeConstruct 56 56 - 74: 29(fvec2) CompositeExtract 72 0 - 75: 29(fvec2) FSub 74 73 - 76: 29(fvec2) CompositeExtract 72 1 - 77: 29(fvec2) FSub 76 73 + 73: 29(f16vec2) CompositeConstruct 56 56 + 74: 29(f16vec2) CompositeExtract 72 0 + 75: 29(f16vec2) FSub 74 73 + 76: 29(f16vec2) CompositeExtract 72 1 + 77: 29(f16vec2) FSub 76 73 78: 62 CompositeConstruct 75 77 Store 64(f16m) 78 - 79: 29(fvec2) Load 42(f16v) - 80: 29(fvec2) FNegate 79 + 79: 29(f16vec2) Load 42(f16v) + 80: 29(f16vec2) FNegate 79 Store 42(f16v) 80 81: 62 Load 64(f16m) - 82: 29(fvec2) CompositeExtract 81 0 - 83: 29(fvec2) FNegate 82 - 84: 29(fvec2) CompositeExtract 81 1 - 85: 29(fvec2) FNegate 84 + 82: 29(f16vec2) CompositeExtract 81 0 + 83: 29(f16vec2) FNegate 82 + 84: 29(f16vec2) CompositeExtract 81 1 + 85: 29(f16vec2) FNegate 84 86: 62 CompositeConstruct 83 85 Store 64(f16m) 86 88: 35(ptr) AccessChain 42(f16v) 34 - 89: 28(float) Load 88 + 89:28(float16_t) Load 88 91: 35(ptr) AccessChain 42(f16v) 90 - 92: 28(float) Load 91 - 93: 28(float) FAdd 89 92 + 92:28(float16_t) Load 91 + 93:28(float16_t) FAdd 89 92 Store 87(f16) 93 94: 35(ptr) AccessChain 42(f16v) 34 - 95: 28(float) Load 94 + 95:28(float16_t) Load 94 96: 35(ptr) AccessChain 42(f16v) 90 - 97: 28(float) Load 96 - 98: 28(float) FSub 95 97 + 97:28(float16_t) Load 96 + 98:28(float16_t) FSub 95 97 Store 87(f16) 98 99: 35(ptr) AccessChain 42(f16v) 34 - 100: 28(float) Load 99 + 100:28(float16_t) Load 99 101: 35(ptr) AccessChain 42(f16v) 90 - 102: 28(float) Load 101 - 103: 28(float) FMul 100 102 + 102:28(float16_t) Load 101 + 103:28(float16_t) FMul 100 102 Store 87(f16) 103 104: 35(ptr) AccessChain 42(f16v) 34 - 105: 28(float) Load 104 + 105:28(float16_t) Load 104 106: 35(ptr) AccessChain 42(f16v) 90 - 107: 28(float) Load 106 - 108: 28(float) FDiv 105 107 + 107:28(float16_t) Load 106 + 108:28(float16_t) FDiv 105 107 Store 87(f16) 108 112: 35(ptr) AccessChain 42(f16v) 34 - 113: 28(float) Load 112 - 114: 28(float) Load 87(f16) + 113:28(float16_t) Load 112 + 114:28(float16_t) Load 87(f16) 115: 109(bool) FOrdNotEqual 113 114 Store 111(b) 115 116: 35(ptr) AccessChain 42(f16v) 90 - 117: 28(float) Load 116 - 118: 28(float) Load 87(f16) + 117:28(float16_t) Load 116 + 118:28(float16_t) Load 87(f16) 119: 109(bool) FOrdEqual 117 118 Store 111(b) 119 120: 35(ptr) AccessChain 42(f16v) 34 - 121: 28(float) Load 120 - 122: 28(float) Load 87(f16) + 121:28(float16_t) Load 120 + 122:28(float16_t) Load 87(f16) 123: 109(bool) FOrdGreaterThan 121 122 Store 111(b) 123 124: 35(ptr) AccessChain 42(f16v) 90 - 125: 28(float) Load 124 - 126: 28(float) Load 87(f16) + 125:28(float16_t) Load 124 + 126:28(float16_t) Load 87(f16) 127: 109(bool) FOrdLessThan 125 126 Store 111(b) 127 128: 35(ptr) AccessChain 42(f16v) 34 - 129: 28(float) Load 128 - 130: 28(float) Load 87(f16) + 129:28(float16_t) Load 128 + 130:28(float16_t) Load 87(f16) 131: 109(bool) FOrdGreaterThanEqual 129 130 Store 111(b) 131 132: 35(ptr) AccessChain 42(f16v) 90 - 133: 28(float) Load 132 - 134: 28(float) Load 87(f16) + 133:28(float16_t) Load 132 + 134:28(float16_t) Load 87(f16) 135: 109(bool) FOrdLessThanEqual 133 134 Store 111(b) 135 - 136: 29(fvec2) Load 42(f16v) - 137: 28(float) Load 87(f16) - 138: 29(fvec2) VectorTimesScalar 136 137 + 136: 29(f16vec2) Load 42(f16v) + 137:28(float16_t) Load 87(f16) + 138: 29(f16vec2) VectorTimesScalar 136 137 Store 42(f16v) 138 139: 62 Load 64(f16m) - 140: 28(float) Load 87(f16) + 140:28(float16_t) Load 87(f16) 141: 62 MatrixTimesScalar 139 140 Store 64(f16m) 141 142: 62 Load 64(f16m) - 143: 29(fvec2) Load 42(f16v) - 144: 29(fvec2) MatrixTimesVector 142 143 + 143: 29(f16vec2) Load 42(f16v) + 144: 29(f16vec2) MatrixTimesVector 142 143 Store 42(f16v) 144 - 145: 29(fvec2) Load 42(f16v) + 145: 29(f16vec2) Load 42(f16v) 146: 62 Load 64(f16m) - 147: 29(fvec2) VectorTimesMatrix 145 146 + 147: 29(f16vec2) VectorTimesMatrix 145 146 Store 42(f16v) 147 148: 62 Load 64(f16m) 149: 62 Load 64(f16m) @@ -393,49 +401,49 @@ spv.float16.frag 201(i64v): 200(ptr) Variable Function 209(u64v): 208(ptr) Variable Function 157: 154(bvec3) Load 156(bv) - 161: 151(fvec3) Select 157 160 159 + 161:151(f16vec3) Select 157 160 159 Store 153(f16v) 161 - 162: 151(fvec3) Load 153(f16v) + 162:151(f16vec3) Load 153(f16v) 163: 154(bvec3) FOrdNotEqual 162 159 Store 156(bv) 163 168: 165(fvec3) Load 167(fv) - 169: 151(fvec3) FConvert 168 + 169:151(f16vec3) FConvert 168 Store 153(f16v) 169 - 170: 151(fvec3) Load 153(f16v) + 170:151(f16vec3) Load 153(f16v) 171: 165(fvec3) FConvert 170 Store 167(fv) 171 - 176: 173(fvec3) Load 175(dv) - 177: 151(fvec3) FConvert 176 + 176:173(f64vec3) Load 175(dv) + 177:151(f16vec3) FConvert 176 Store 153(f16v) 177 - 178: 173(fvec3) Load 175(dv) - 179: 172(float) CompositeExtract 178 0 - 180: 172(float) CompositeExtract 178 1 - 181: 172(float) CompositeExtract 178 2 - 182: 173(fvec3) CompositeConstruct 179 180 181 + 178:173(f64vec3) Load 175(dv) + 179:172(float64_t) CompositeExtract 178 0 + 180:172(float64_t) CompositeExtract 178 1 + 181:172(float64_t) CompositeExtract 178 2 + 182:173(f64vec3) CompositeConstruct 179 180 181 Store 175(dv) 182 187: 184(ivec3) Load 186(iv) - 188: 151(fvec3) ConvertSToF 187 + 188:151(f16vec3) ConvertSToF 187 Store 153(f16v) 188 - 189: 151(fvec3) Load 153(f16v) + 189:151(f16vec3) Load 153(f16v) 190: 184(ivec3) ConvertFToS 189 Store 186(iv) 190 194: 191(ivec3) Load 193(uv) - 195: 151(fvec3) ConvertUToF 194 + 195:151(f16vec3) ConvertUToF 194 Store 153(f16v) 195 - 196: 151(fvec3) Load 153(f16v) + 196:151(f16vec3) Load 153(f16v) 197: 191(ivec3) ConvertFToU 196 Store 193(uv) 197 - 202: 199(ivec3) Load 201(i64v) - 203: 151(fvec3) ConvertSToF 202 + 202:199(i64vec3) Load 201(i64v) + 203:151(f16vec3) ConvertSToF 202 Store 153(f16v) 203 - 204: 151(fvec3) Load 153(f16v) - 205: 199(ivec3) ConvertFToS 204 + 204:151(f16vec3) Load 153(f16v) + 205:199(i64vec3) ConvertFToS 204 Store 201(i64v) 205 - 210: 207(ivec3) Load 209(u64v) - 211: 151(fvec3) ConvertUToF 210 + 210:207(i64vec3) Load 209(u64v) + 211:151(f16vec3) ConvertUToF 210 Store 153(f16v) 211 - 212: 151(fvec3) Load 153(f16v) - 213: 207(ivec3) ConvertFToU 212 + 212:151(f16vec3) Load 153(f16v) + 213:207(i64vec3) ConvertFToU 212 Store 209(u64v) 213 Return FunctionEnd @@ -443,51 +451,51 @@ spv.float16.frag 13: Label 216(f16v2): 215(ptr) Variable Function 217(f16v1): 215(ptr) Variable Function - 218: 214(fvec4) Load 217(f16v1) - 219: 214(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 218 + 218:214(f16vec4) Load 217(f16v1) + 219:214(f16vec4) ExtInst 1(GLSL.std.450) 11(Radians) 218 Store 216(f16v2) 219 - 220: 214(fvec4) Load 217(f16v1) - 221: 214(fvec4) ExtInst 1(GLSL.std.450) 12(Degrees) 220 + 220:214(f16vec4) Load 217(f16v1) + 221:214(f16vec4) ExtInst 1(GLSL.std.450) 12(Degrees) 220 Store 216(f16v2) 221 - 222: 214(fvec4) Load 217(f16v1) - 223: 214(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 222 + 222:214(f16vec4) Load 217(f16v1) + 223:214(f16vec4) ExtInst 1(GLSL.std.450) 13(Sin) 222 Store 216(f16v2) 223 - 224: 214(fvec4) Load 217(f16v1) - 225: 214(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 224 + 224:214(f16vec4) Load 217(f16v1) + 225:214(f16vec4) ExtInst 1(GLSL.std.450) 14(Cos) 224 Store 216(f16v2) 225 - 226: 214(fvec4) Load 217(f16v1) - 227: 214(fvec4) ExtInst 1(GLSL.std.450) 15(Tan) 226 + 226:214(f16vec4) Load 217(f16v1) + 227:214(f16vec4) ExtInst 1(GLSL.std.450) 15(Tan) 226 Store 216(f16v2) 227 - 228: 214(fvec4) Load 217(f16v1) - 229: 214(fvec4) ExtInst 1(GLSL.std.450) 16(Asin) 228 + 228:214(f16vec4) Load 217(f16v1) + 229:214(f16vec4) ExtInst 1(GLSL.std.450) 16(Asin) 228 Store 216(f16v2) 229 - 230: 214(fvec4) Load 217(f16v1) - 231: 214(fvec4) ExtInst 1(GLSL.std.450) 17(Acos) 230 + 230:214(f16vec4) Load 217(f16v1) + 231:214(f16vec4) ExtInst 1(GLSL.std.450) 17(Acos) 230 Store 216(f16v2) 231 - 232: 214(fvec4) Load 217(f16v1) - 233: 214(fvec4) Load 216(f16v2) - 234: 214(fvec4) ExtInst 1(GLSL.std.450) 25(Atan2) 232 233 + 232:214(f16vec4) Load 217(f16v1) + 233:214(f16vec4) Load 216(f16v2) + 234:214(f16vec4) ExtInst 1(GLSL.std.450) 25(Atan2) 232 233 Store 216(f16v2) 234 - 235: 214(fvec4) Load 217(f16v1) - 236: 214(fvec4) ExtInst 1(GLSL.std.450) 18(Atan) 235 + 235:214(f16vec4) Load 217(f16v1) + 236:214(f16vec4) ExtInst 1(GLSL.std.450) 18(Atan) 235 Store 216(f16v2) 236 - 237: 214(fvec4) Load 217(f16v1) - 238: 214(fvec4) ExtInst 1(GLSL.std.450) 19(Sinh) 237 + 237:214(f16vec4) Load 217(f16v1) + 238:214(f16vec4) ExtInst 1(GLSL.std.450) 19(Sinh) 237 Store 216(f16v2) 238 - 239: 214(fvec4) Load 217(f16v1) - 240: 214(fvec4) ExtInst 1(GLSL.std.450) 20(Cosh) 239 + 239:214(f16vec4) Load 217(f16v1) + 240:214(f16vec4) ExtInst 1(GLSL.std.450) 20(Cosh) 239 Store 216(f16v2) 240 - 241: 214(fvec4) Load 217(f16v1) - 242: 214(fvec4) ExtInst 1(GLSL.std.450) 21(Tanh) 241 + 241:214(f16vec4) Load 217(f16v1) + 242:214(f16vec4) ExtInst 1(GLSL.std.450) 21(Tanh) 241 Store 216(f16v2) 242 - 243: 214(fvec4) Load 217(f16v1) - 244: 214(fvec4) ExtInst 1(GLSL.std.450) 22(Asinh) 243 + 243:214(f16vec4) Load 217(f16v1) + 244:214(f16vec4) ExtInst 1(GLSL.std.450) 22(Asinh) 243 Store 216(f16v2) 244 - 245: 214(fvec4) Load 217(f16v1) - 246: 214(fvec4) ExtInst 1(GLSL.std.450) 23(Acosh) 245 + 245:214(f16vec4) Load 217(f16v1) + 246:214(f16vec4) ExtInst 1(GLSL.std.450) 23(Acosh) 245 Store 216(f16v2) 246 - 247: 214(fvec4) Load 217(f16v1) - 248: 214(fvec4) ExtInst 1(GLSL.std.450) 24(Atanh) 247 + 247:214(f16vec4) Load 217(f16v1) + 248:214(f16vec4) ExtInst 1(GLSL.std.450) 24(Atanh) 247 Store 216(f16v2) 248 Return FunctionEnd @@ -495,27 +503,27 @@ spv.float16.frag 15: Label 249(f16v2): 30(ptr) Variable Function 250(f16v1): 30(ptr) Variable Function - 251: 29(fvec2) Load 250(f16v1) - 252: 29(fvec2) Load 249(f16v2) - 253: 29(fvec2) ExtInst 1(GLSL.std.450) 26(Pow) 251 252 + 251: 29(f16vec2) Load 250(f16v1) + 252: 29(f16vec2) Load 249(f16v2) + 253: 29(f16vec2) ExtInst 1(GLSL.std.450) 26(Pow) 251 252 Store 249(f16v2) 253 - 254: 29(fvec2) Load 250(f16v1) - 255: 29(fvec2) ExtInst 1(GLSL.std.450) 27(Exp) 254 + 254: 29(f16vec2) Load 250(f16v1) + 255: 29(f16vec2) ExtInst 1(GLSL.std.450) 27(Exp) 254 Store 249(f16v2) 255 - 256: 29(fvec2) Load 250(f16v1) - 257: 29(fvec2) ExtInst 1(GLSL.std.450) 28(Log) 256 + 256: 29(f16vec2) Load 250(f16v1) + 257: 29(f16vec2) ExtInst 1(GLSL.std.450) 28(Log) 256 Store 249(f16v2) 257 - 258: 29(fvec2) Load 250(f16v1) - 259: 29(fvec2) ExtInst 1(GLSL.std.450) 29(Exp2) 258 + 258: 29(f16vec2) Load 250(f16v1) + 259: 29(f16vec2) ExtInst 1(GLSL.std.450) 29(Exp2) 258 Store 249(f16v2) 259 - 260: 29(fvec2) Load 250(f16v1) - 261: 29(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 260 + 260: 29(f16vec2) Load 250(f16v1) + 261: 29(f16vec2) ExtInst 1(GLSL.std.450) 30(Log2) 260 Store 249(f16v2) 261 - 262: 29(fvec2) Load 250(f16v1) - 263: 29(fvec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 262 + 262: 29(f16vec2) Load 250(f16v1) + 263: 29(f16vec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 262 Store 249(f16v2) 263 - 264: 29(fvec2) Load 250(f16v1) - 265: 29(fvec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 264 + 264: 29(f16vec2) Load 250(f16v1) + 265: 29(f16vec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 264 Store 249(f16v2) 265 Return FunctionEnd @@ -528,132 +536,132 @@ spv.float16.frag 332(bv): 155(ptr) Variable Function 353(b): 110(ptr) Variable Function 363(iv): 185(ptr) Variable Function - 268: 151(fvec3) Load 267(f16v1) - 269: 151(fvec3) ExtInst 1(GLSL.std.450) 4(FAbs) 268 + 268:151(f16vec3) Load 267(f16v1) + 269:151(f16vec3) ExtInst 1(GLSL.std.450) 4(FAbs) 268 Store 266(f16v2) 269 - 270: 151(fvec3) Load 267(f16v1) - 271: 151(fvec3) ExtInst 1(GLSL.std.450) 6(FSign) 270 + 270:151(f16vec3) Load 267(f16v1) + 271:151(f16vec3) ExtInst 1(GLSL.std.450) 6(FSign) 270 Store 266(f16v2) 271 - 272: 151(fvec3) Load 267(f16v1) - 273: 151(fvec3) ExtInst 1(GLSL.std.450) 8(Floor) 272 + 272:151(f16vec3) Load 267(f16v1) + 273:151(f16vec3) ExtInst 1(GLSL.std.450) 8(Floor) 272 Store 266(f16v2) 273 - 274: 151(fvec3) Load 267(f16v1) - 275: 151(fvec3) ExtInst 1(GLSL.std.450) 3(Trunc) 274 + 274:151(f16vec3) Load 267(f16v1) + 275:151(f16vec3) ExtInst 1(GLSL.std.450) 3(Trunc) 274 Store 266(f16v2) 275 - 276: 151(fvec3) Load 267(f16v1) - 277: 151(fvec3) ExtInst 1(GLSL.std.450) 1(Round) 276 + 276:151(f16vec3) Load 267(f16v1) + 277:151(f16vec3) ExtInst 1(GLSL.std.450) 1(Round) 276 Store 266(f16v2) 277 - 278: 151(fvec3) Load 267(f16v1) - 279: 151(fvec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 278 + 278:151(f16vec3) Load 267(f16v1) + 279:151(f16vec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 278 Store 266(f16v2) 279 - 280: 151(fvec3) Load 267(f16v1) - 281: 151(fvec3) ExtInst 1(GLSL.std.450) 9(Ceil) 280 + 280:151(f16vec3) Load 267(f16v1) + 281:151(f16vec3) ExtInst 1(GLSL.std.450) 9(Ceil) 280 Store 266(f16v2) 281 - 282: 151(fvec3) Load 267(f16v1) - 283: 151(fvec3) ExtInst 1(GLSL.std.450) 10(Fract) 282 + 282:151(f16vec3) Load 267(f16v1) + 283:151(f16vec3) ExtInst 1(GLSL.std.450) 10(Fract) 282 Store 266(f16v2) 283 - 284: 151(fvec3) Load 267(f16v1) - 285: 151(fvec3) Load 266(f16v2) - 286: 151(fvec3) FMod 284 285 + 284:151(f16vec3) Load 267(f16v1) + 285:151(f16vec3) Load 266(f16v2) + 286:151(f16vec3) FMod 284 285 Store 266(f16v2) 286 - 287: 151(fvec3) Load 267(f16v1) - 289: 28(float) Load 288(f16) - 290: 151(fvec3) CompositeConstruct 289 289 289 - 291: 151(fvec3) FMod 287 290 + 287:151(f16vec3) Load 267(f16v1) + 289:28(float16_t) Load 288(f16) + 290:151(f16vec3) CompositeConstruct 289 289 289 + 291:151(f16vec3) FMod 287 290 Store 266(f16v2) 291 - 293: 151(fvec3) Load 267(f16v1) - 294: 151(fvec3) ExtInst 1(GLSL.std.450) 35(Modf) 293 266(f16v2) + 293:151(f16vec3) Load 267(f16v1) + 294:151(f16vec3) ExtInst 1(GLSL.std.450) 35(Modf) 293 266(f16v2) Store 292(f16v3) 294 - 295: 151(fvec3) Load 267(f16v1) - 296: 151(fvec3) Load 266(f16v2) - 297: 151(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 295 296 + 295:151(f16vec3) Load 267(f16v1) + 296:151(f16vec3) Load 266(f16v2) + 297:151(f16vec3) ExtInst 1(GLSL.std.450) 37(FMin) 295 296 Store 292(f16v3) 297 - 298: 151(fvec3) Load 267(f16v1) - 299: 28(float) Load 288(f16) - 300: 151(fvec3) CompositeConstruct 299 299 299 - 301: 151(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 298 300 + 298:151(f16vec3) Load 267(f16v1) + 299:28(float16_t) Load 288(f16) + 300:151(f16vec3) CompositeConstruct 299 299 299 + 301:151(f16vec3) ExtInst 1(GLSL.std.450) 37(FMin) 298 300 Store 292(f16v3) 301 - 302: 151(fvec3) Load 267(f16v1) - 303: 151(fvec3) Load 266(f16v2) - 304: 151(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 302 303 + 302:151(f16vec3) Load 267(f16v1) + 303:151(f16vec3) Load 266(f16v2) + 304:151(f16vec3) ExtInst 1(GLSL.std.450) 40(FMax) 302 303 Store 292(f16v3) 304 - 305: 151(fvec3) Load 267(f16v1) - 306: 28(float) Load 288(f16) - 307: 151(fvec3) CompositeConstruct 306 306 306 - 308: 151(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 305 307 + 305:151(f16vec3) Load 267(f16v1) + 306:28(float16_t) Load 288(f16) + 307:151(f16vec3) CompositeConstruct 306 306 306 + 308:151(f16vec3) ExtInst 1(GLSL.std.450) 40(FMax) 305 307 Store 292(f16v3) 308 - 309: 151(fvec3) Load 267(f16v1) - 310: 28(float) Load 288(f16) + 309:151(f16vec3) Load 267(f16v1) + 310:28(float16_t) Load 288(f16) 311: 35(ptr) AccessChain 266(f16v2) 34 - 312: 28(float) Load 311 - 313: 151(fvec3) CompositeConstruct 310 310 310 - 314: 151(fvec3) CompositeConstruct 312 312 312 - 315: 151(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 309 313 314 + 312:28(float16_t) Load 311 + 313:151(f16vec3) CompositeConstruct 310 310 310 + 314:151(f16vec3) CompositeConstruct 312 312 312 + 315:151(f16vec3) ExtInst 1(GLSL.std.450) 43(FClamp) 309 313 314 Store 292(f16v3) 315 - 316: 151(fvec3) Load 267(f16v1) - 317: 151(fvec3) Load 266(f16v2) - 318: 28(float) Load 288(f16) - 319: 151(fvec3) CompositeConstruct 318 318 318 - 320: 151(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 316 317 319 + 316:151(f16vec3) Load 267(f16v1) + 317:151(f16vec3) Load 266(f16v2) + 318:28(float16_t) Load 288(f16) + 319:151(f16vec3) CompositeConstruct 318 318 318 + 320:151(f16vec3) ExtInst 1(GLSL.std.450) 43(FClamp) 316 317 319 Store 292(f16v3) 320 - 321: 151(fvec3) Load 267(f16v1) - 322: 151(fvec3) Load 266(f16v2) - 323: 28(float) Load 288(f16) - 324: 151(fvec3) CompositeConstruct 323 323 323 - 325: 151(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 321 322 324 + 321:151(f16vec3) Load 267(f16v1) + 322:151(f16vec3) Load 266(f16v2) + 323:28(float16_t) Load 288(f16) + 324:151(f16vec3) CompositeConstruct 323 323 323 + 325:151(f16vec3) ExtInst 1(GLSL.std.450) 46(FMix) 321 322 324 Store 292(f16v3) 325 - 326: 151(fvec3) Load 267(f16v1) - 327: 151(fvec3) Load 266(f16v2) - 328: 151(fvec3) Load 292(f16v3) - 329: 151(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 326 327 328 + 326:151(f16vec3) Load 267(f16v1) + 327:151(f16vec3) Load 266(f16v2) + 328:151(f16vec3) Load 292(f16v3) + 329:151(f16vec3) ExtInst 1(GLSL.std.450) 46(FMix) 326 327 328 Store 292(f16v3) 329 - 330: 151(fvec3) Load 267(f16v1) - 331: 151(fvec3) Load 266(f16v2) + 330:151(f16vec3) Load 267(f16v1) + 331:151(f16vec3) Load 266(f16v2) 333: 154(bvec3) Load 332(bv) - 334: 151(fvec3) Select 333 331 330 + 334:151(f16vec3) Select 333 331 330 Store 292(f16v3) 334 - 335: 151(fvec3) Load 267(f16v1) - 336: 151(fvec3) Load 266(f16v2) - 337: 151(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 335 336 + 335:151(f16vec3) Load 267(f16v1) + 336:151(f16vec3) Load 266(f16v2) + 337:151(f16vec3) ExtInst 1(GLSL.std.450) 48(Step) 335 336 Store 292(f16v3) 337 - 338: 28(float) Load 288(f16) - 339: 151(fvec3) Load 292(f16v3) - 340: 151(fvec3) CompositeConstruct 338 338 338 - 341: 151(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 340 339 + 338:28(float16_t) Load 288(f16) + 339:151(f16vec3) Load 292(f16v3) + 340:151(f16vec3) CompositeConstruct 338 338 338 + 341:151(f16vec3) ExtInst 1(GLSL.std.450) 48(Step) 340 339 Store 292(f16v3) 341 - 342: 151(fvec3) Load 267(f16v1) - 343: 151(fvec3) Load 266(f16v2) - 344: 151(fvec3) Load 292(f16v3) - 345: 151(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 342 343 344 + 342:151(f16vec3) Load 267(f16v1) + 343:151(f16vec3) Load 266(f16v2) + 344:151(f16vec3) Load 292(f16v3) + 345:151(f16vec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 342 343 344 Store 292(f16v3) 345 - 346: 28(float) Load 288(f16) + 346:28(float16_t) Load 288(f16) 347: 35(ptr) AccessChain 267(f16v1) 34 - 348: 28(float) Load 347 - 349: 151(fvec3) Load 266(f16v2) - 350: 151(fvec3) CompositeConstruct 346 346 346 - 351: 151(fvec3) CompositeConstruct 348 348 348 - 352: 151(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 350 351 349 + 348:28(float16_t) Load 347 + 349:151(f16vec3) Load 266(f16v2) + 350:151(f16vec3) CompositeConstruct 346 346 346 + 351:151(f16vec3) CompositeConstruct 348 348 348 + 352:151(f16vec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 350 351 349 Store 292(f16v3) 352 - 354: 28(float) Load 288(f16) + 354:28(float16_t) Load 288(f16) 355: 109(bool) IsNan 354 Store 353(b) 355 - 356: 151(fvec3) Load 267(f16v1) + 356:151(f16vec3) Load 267(f16v1) 357: 154(bvec3) IsInf 356 Store 332(bv) 357 - 358: 151(fvec3) Load 267(f16v1) - 359: 151(fvec3) Load 266(f16v2) - 360: 151(fvec3) Load 292(f16v3) - 361: 151(fvec3) ExtInst 1(GLSL.std.450) 50(Fma) 358 359 360 + 358:151(f16vec3) Load 267(f16v1) + 359:151(f16vec3) Load 266(f16v2) + 360:151(f16vec3) Load 292(f16v3) + 361:151(f16vec3) ExtInst 1(GLSL.std.450) 50(Fma) 358 359 360 Store 292(f16v3) 361 - 362: 151(fvec3) Load 267(f16v1) + 362:151(f16vec3) Load 267(f16v1) 365:364(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 362 366: 184(ivec3) CompositeExtract 365 1 Store 363(iv) 366 - 367: 151(fvec3) CompositeExtract 365 0 + 367:151(f16vec3) CompositeExtract 365 0 Store 266(f16v2) 367 - 368: 151(fvec3) Load 267(f16v1) + 368:151(f16vec3) Load 267(f16v1) 369: 184(ivec3) Load 363(iv) - 370: 151(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 368 369 + 370:151(f16vec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 368 369 Store 266(f16v2) 370 Return FunctionEnd @@ -661,11 +669,11 @@ spv.float16.frag 19: Label 372(u): 371(ptr) Variable Function 373(f16v): 30(ptr) Variable Function - 374: 29(fvec2) Load 373(f16v) + 374: 29(f16vec2) Load 373(f16v) 375: 33(int) Bitcast 374 Store 372(u) 375 376: 33(int) Load 372(u) - 377: 29(fvec2) Bitcast 376 + 377: 29(f16vec2) Bitcast 376 Store 373(f16v) 377 Return FunctionEnd @@ -675,37 +683,37 @@ spv.float16.frag 379(f16v1): 152(ptr) Variable Function 383(f16v2): 152(ptr) Variable Function 389(f16v3): 152(ptr) Variable Function - 380: 151(fvec3) Load 379(f16v1) - 381: 28(float) ExtInst 1(GLSL.std.450) 66(Length) 380 + 380:151(f16vec3) Load 379(f16v1) + 381:28(float16_t) ExtInst 1(GLSL.std.450) 66(Length) 380 Store 378(f16) 381 - 382: 151(fvec3) Load 379(f16v1) - 384: 151(fvec3) Load 383(f16v2) - 385: 28(float) ExtInst 1(GLSL.std.450) 67(Distance) 382 384 + 382:151(f16vec3) Load 379(f16v1) + 384:151(f16vec3) Load 383(f16v2) + 385:28(float16_t) ExtInst 1(GLSL.std.450) 67(Distance) 382 384 Store 378(f16) 385 - 386: 151(fvec3) Load 379(f16v1) - 387: 151(fvec3) Load 383(f16v2) - 388: 28(float) Dot 386 387 + 386:151(f16vec3) Load 379(f16v1) + 387:151(f16vec3) Load 383(f16v2) + 388:28(float16_t) Dot 386 387 Store 378(f16) 388 - 390: 151(fvec3) Load 379(f16v1) - 391: 151(fvec3) Load 383(f16v2) - 392: 151(fvec3) ExtInst 1(GLSL.std.450) 68(Cross) 390 391 + 390:151(f16vec3) Load 379(f16v1) + 391:151(f16vec3) Load 383(f16v2) + 392:151(f16vec3) ExtInst 1(GLSL.std.450) 68(Cross) 390 391 Store 389(f16v3) 392 - 393: 151(fvec3) Load 379(f16v1) - 394: 151(fvec3) ExtInst 1(GLSL.std.450) 69(Normalize) 393 + 393:151(f16vec3) Load 379(f16v1) + 394:151(f16vec3) ExtInst 1(GLSL.std.450) 69(Normalize) 393 Store 383(f16v2) 394 - 395: 151(fvec3) Load 379(f16v1) - 396: 151(fvec3) Load 383(f16v2) - 397: 151(fvec3) Load 389(f16v3) - 398: 151(fvec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 395 396 397 + 395:151(f16vec3) Load 379(f16v1) + 396:151(f16vec3) Load 383(f16v2) + 397:151(f16vec3) Load 389(f16v3) + 398:151(f16vec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 395 396 397 Store 389(f16v3) 398 - 399: 151(fvec3) Load 379(f16v1) - 400: 151(fvec3) Load 383(f16v2) - 401: 151(fvec3) ExtInst 1(GLSL.std.450) 71(Reflect) 399 400 + 399:151(f16vec3) Load 379(f16v1) + 400:151(f16vec3) Load 383(f16v2) + 401:151(f16vec3) ExtInst 1(GLSL.std.450) 71(Reflect) 399 400 Store 389(f16v3) 401 - 402: 151(fvec3) Load 379(f16v1) - 403: 151(fvec3) Load 383(f16v2) - 404: 28(float) Load 378(f16) - 405: 151(fvec3) ExtInst 1(GLSL.std.450) 72(Refract) 402 403 404 + 402:151(f16vec3) Load 379(f16v1) + 403:151(f16vec3) Load 383(f16v2) + 404:28(float16_t) Load 378(f16) + 405:151(f16vec3) ExtInst 1(GLSL.std.450) 72(Refract) 402 403 404 Store 389(f16v3) 405 Return FunctionEnd @@ -723,23 +731,23 @@ spv.float16.frag 439(f16m7): 437(ptr) Variable Function 410: 406 Load 409(f16m1) 412: 406 Load 411(f16m2) - 413: 151(fvec3) CompositeExtract 410 0 - 414: 151(fvec3) CompositeExtract 412 0 - 415: 151(fvec3) FMul 413 414 - 416: 151(fvec3) CompositeExtract 410 1 - 417: 151(fvec3) CompositeExtract 412 1 - 418: 151(fvec3) FMul 416 417 + 413:151(f16vec3) CompositeExtract 410 0 + 414:151(f16vec3) CompositeExtract 412 0 + 415:151(f16vec3) FMul 413 414 + 416:151(f16vec3) CompositeExtract 410 1 + 417:151(f16vec3) CompositeExtract 412 1 + 418:151(f16vec3) FMul 416 417 419: 406 CompositeConstruct 415 418 Store 408(f16m3) 419 - 421: 151(fvec3) Load 420(f16v1) - 423: 29(fvec2) Load 422(f16v2) + 421:151(f16vec3) Load 420(f16v1) + 423: 29(f16vec2) Load 422(f16v2) 424: 406 OuterProduct 421 423 Store 409(f16m1) 424 428: 406 Load 409(f16m1) 429: 425 Transpose 428 Store 427(f16m4) 429 434: 431 Load 433(f16m5) - 435: 28(float) ExtInst 1(GLSL.std.450) 33(Determinant) 434 + 435:28(float16_t) ExtInst 1(GLSL.std.450) 33(Determinant) 434 Store 430(f16) 435 440: 436 Load 439(f16m7) 441: 436 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 440 @@ -751,28 +759,28 @@ spv.float16.frag 442(bv): 155(ptr) Variable Function 443(f16v1): 152(ptr) Variable Function 445(f16v2): 152(ptr) Variable Function - 444: 151(fvec3) Load 443(f16v1) - 446: 151(fvec3) Load 445(f16v2) + 444:151(f16vec3) Load 443(f16v1) + 446:151(f16vec3) Load 445(f16v2) 447: 154(bvec3) FOrdLessThan 444 446 Store 442(bv) 447 - 448: 151(fvec3) Load 443(f16v1) - 449: 151(fvec3) Load 445(f16v2) + 448:151(f16vec3) Load 443(f16v1) + 449:151(f16vec3) Load 445(f16v2) 450: 154(bvec3) FOrdLessThanEqual 448 449 Store 442(bv) 450 - 451: 151(fvec3) Load 443(f16v1) - 452: 151(fvec3) Load 445(f16v2) + 451:151(f16vec3) Load 443(f16v1) + 452:151(f16vec3) Load 445(f16v2) 453: 154(bvec3) FOrdGreaterThan 451 452 Store 442(bv) 453 - 454: 151(fvec3) Load 443(f16v1) - 455: 151(fvec3) Load 445(f16v2) + 454:151(f16vec3) Load 443(f16v1) + 455:151(f16vec3) Load 445(f16v2) 456: 154(bvec3) FOrdGreaterThanEqual 454 455 Store 442(bv) 456 - 457: 151(fvec3) Load 443(f16v1) - 458: 151(fvec3) Load 445(f16v2) + 457:151(f16vec3) Load 443(f16v1) + 458:151(f16vec3) Load 445(f16v2) 459: 154(bvec3) FOrdEqual 457 458 Store 442(bv) 459 - 460: 151(fvec3) Load 443(f16v1) - 461: 151(fvec3) Load 445(f16v2) + 460:151(f16vec3) Load 443(f16v1) + 461:151(f16vec3) Load 445(f16v2) 462: 154(bvec3) FOrdNotEqual 460 461 Store 442(bv) 462 Return @@ -781,57 +789,57 @@ spv.float16.frag 27: Label 463(f16v): 152(ptr) Variable Function 467: 466(ptr) AccessChain 465(if16v) 34 - 468: 28(float) Load 467 - 469: 28(float) DPdx 468 + 468:28(float16_t) Load 467 + 469:28(float16_t) DPdx 468 470: 35(ptr) AccessChain 463(f16v) 34 Store 470 469 471: 466(ptr) AccessChain 465(if16v) 90 - 472: 28(float) Load 471 - 473: 28(float) DPdy 472 + 472:28(float16_t) Load 471 + 473:28(float16_t) DPdy 472 474: 35(ptr) AccessChain 463(f16v) 90 Store 474 473 - 475: 151(fvec3) Load 465(if16v) - 476: 29(fvec2) VectorShuffle 475 475 0 1 - 477: 29(fvec2) DPdxFine 476 - 478: 151(fvec3) Load 463(f16v) - 479: 151(fvec3) VectorShuffle 478 477 3 4 2 + 475:151(f16vec3) Load 465(if16v) + 476: 29(f16vec2) VectorShuffle 475 475 0 1 + 477: 29(f16vec2) DPdxFine 476 + 478:151(f16vec3) Load 463(f16v) + 479:151(f16vec3) VectorShuffle 478 477 3 4 2 Store 463(f16v) 479 - 480: 151(fvec3) Load 465(if16v) - 481: 29(fvec2) VectorShuffle 480 480 0 1 - 482: 29(fvec2) DPdyFine 481 - 483: 151(fvec3) Load 463(f16v) - 484: 151(fvec3) VectorShuffle 483 482 3 4 2 + 480:151(f16vec3) Load 465(if16v) + 481: 29(f16vec2) VectorShuffle 480 480 0 1 + 482: 29(f16vec2) DPdyFine 481 + 483:151(f16vec3) Load 463(f16v) + 484:151(f16vec3) VectorShuffle 483 482 3 4 2 Store 463(f16v) 484 - 485: 151(fvec3) Load 465(if16v) - 486: 151(fvec3) DPdxCoarse 485 + 485:151(f16vec3) Load 465(if16v) + 486:151(f16vec3) DPdxCoarse 485 Store 463(f16v) 486 - 487: 151(fvec3) Load 465(if16v) - 488: 151(fvec3) DPdxCoarse 487 + 487:151(f16vec3) Load 465(if16v) + 488:151(f16vec3) DPdxCoarse 487 Store 463(f16v) 488 489: 466(ptr) AccessChain 465(if16v) 34 - 490: 28(float) Load 489 - 491: 28(float) Fwidth 490 + 490:28(float16_t) Load 489 + 491:28(float16_t) Fwidth 490 492: 35(ptr) AccessChain 463(f16v) 34 Store 492 491 - 493: 151(fvec3) Load 465(if16v) - 494: 29(fvec2) VectorShuffle 493 493 0 1 - 495: 29(fvec2) FwidthFine 494 - 496: 151(fvec3) Load 463(f16v) - 497: 151(fvec3) VectorShuffle 496 495 3 4 2 + 493:151(f16vec3) Load 465(if16v) + 494: 29(f16vec2) VectorShuffle 493 493 0 1 + 495: 29(f16vec2) FwidthFine 494 + 496:151(f16vec3) Load 463(f16v) + 497:151(f16vec3) VectorShuffle 496 495 3 4 2 Store 463(f16v) 497 - 498: 151(fvec3) Load 465(if16v) - 499: 151(fvec3) FwidthCoarse 498 + 498:151(f16vec3) Load 465(if16v) + 499:151(f16vec3) FwidthCoarse 498 Store 463(f16v) 499 500: 466(ptr) AccessChain 465(if16v) 34 - 501: 28(float) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 500 + 501:28(float16_t) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 500 502: 35(ptr) AccessChain 463(f16v) 34 Store 502 501 - 504: 151(fvec3) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 465(if16v) 503 - 505: 29(fvec2) VectorShuffle 504 504 0 1 - 506: 151(fvec3) Load 463(f16v) - 507: 151(fvec3) VectorShuffle 506 505 3 4 2 + 504:151(f16vec3) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 465(if16v) 503 + 505: 29(f16vec2) VectorShuffle 504 504 0 1 + 506:151(f16vec3) Load 463(f16v) + 507:151(f16vec3) VectorShuffle 506 505 3 4 2 Store 463(f16v) 507 - 510: 151(fvec3) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 465(if16v) 509 + 510:151(f16vec3) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 465(if16v) 509 Store 463(f16v) 510 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16Fetch.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16Fetch.frag.out new file mode 100644 index 00000000000..7632737acfa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float16Fetch.frag.out @@ -0,0 +1,7074 @@ +spv.float16Fetch.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability Float16 + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 5923 + + Capability Shader + Capability Float16 + Capability ImageGatherExtended + Capability StorageImageMultisample + Capability ImageCubeArray + Capability ImageRect + Capability SampledRect + Capability InputAttachment + Capability SparseResidency + Capability MinLod + Capability Sampled1D + Capability Image1D + Capability SampledCubeArray + Capability SampledBuffer + Capability ImageBuffer + Capability ImageMSArray + Capability ImageQuery + Capability StorageInputOutput16 + Capability Float16ImageAMD + Capability ImageGatherBiasLodAMD + Extension "SPV_AMD_gpu_shader_half_float_fetch" + Extension "SPV_AMD_texture_gather_bias_lod" + Extension "SPV_KHR_16bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 128 135 137 148 156 169 177 215 251 309 565 572 1393 1401 1409 1417 1425 1433 4257 4264 5913 5922 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_AMD_gpu_shader_half_float" + SourceExtension "GL_AMD_gpu_shader_half_float_fetch" + SourceExtension "GL_AMD_texture_gather_bias_lod" + SourceExtension "GL_ARB_sparse_texture2" + SourceExtension "GL_ARB_sparse_texture_clamp" + Name 4 "main" + Name 9 "testTexture(" + Name 11 "testTextureProj(" + Name 13 "testTextureLod(" + Name 15 "testTextureOffset(" + Name 17 "testTextureProjOffset(" + Name 19 "testTextureLodOffset(" + Name 21 "testTextureProjLodOffset(" + Name 23 "testTexelFetch(" + Name 25 "testTexelFetchOffset(" + Name 27 "testTextureGrad(" + Name 29 "testTextureGradOffset(" + Name 31 "testTextureProjGrad(" + Name 33 "testTextureProjGradoffset(" + Name 35 "testTextureGather(" + Name 37 "testTextureGatherOffset(" + Name 39 "testTextureGatherOffsets(" + Name 41 "testTextureGatherLod(" + Name 43 "testTextureGatherLodOffset(" + Name 45 "testTextureGatherLodOffsets(" + Name 50 "testTextureSize(" + Name 55 "testTextureQueryLod(" + Name 58 "testTextureQueryLevels(" + Name 60 "testTextureSamples(" + Name 62 "testImageLoad(" + Name 67 "testImageStore(vf164;" + Name 66 "data" + Name 69 "testSparseTexture(" + Name 71 "testSparseTextureLod(" + Name 73 "testSparseTextureOffset(" + Name 75 "testSparseTextureLodOffset(" + Name 77 "testSparseTextureGrad(" + Name 79 "testSparseTextureGradOffset(" + Name 81 "testSparseTexelFetch(" + Name 83 "testSparseTexelFetchOffset(" + Name 85 "testSparseTextureGather(" + Name 87 "testSparseTextureGatherOffset(" + Name 89 "testSparseTextureGatherOffsets(" + Name 91 "testSparseTextureGatherLod(" + Name 93 "testSparseTextureGatherLodOffset(" + Name 95 "testSparseTextureGatherLodOffsets(" + Name 97 "testSparseImageLoad(" + Name 99 "testSparseTextureClamp(" + Name 101 "testTextureClamp(" + Name 103 "testSparseTextureOffsetClamp(" + Name 105 "testTextureOffsetClamp(" + Name 107 "testSparseTextureGradClamp(" + Name 109 "testTextureGradClamp(" + Name 111 "testSparseTextureGradOffsetClamp(" + Name 113 "testTextureGradOffsetClamp(" + Name 115 "testCombinedTextureSampler(" + Name 117 "testSubpassLoad(" + Name 119 "texel" + Name 125 "s1D" + Name 128 "c1" + Name 135 "f16c1" + Name 137 "f16bias" + Name 145 "s2D" + Name 148 "c2" + Name 156 "f16c2" + Name 165 "s3D" + Name 169 "c3" + Name 177 "f16c3" + Name 186 "sCube" + Name 201 "s1DShadow" + Name 215 "compare" + Name 226 "s2DShadow" + Name 247 "sCubeShadow" + Name 251 "c4" + Name 271 "s1DArray" + Name 286 "s2DArray" + Name 301 "sCubeArray" + Name 309 "f16c4" + Name 318 "s1DArrayShadow" + Name 339 "s2DArrayShadow" + Name 359 "s2DRect" + Name 373 "s2DRectShadow" + Name 393 "sCubeArrayShadow" + Name 413 "texel" + Name 562 "texel" + Name 565 "lod" + Name 572 "f16lod" + Name 706 "texel" + Name 863 "texel" + Name 1012 "texel" + Name 1130 "texel" + Name 1244 "texel" + Name 1300 "sBuffer" + Name 1311 "s2DMS" + Name 1322 "s2DMSArray" + Name 1334 "texel" + Name 1390 "texel" + Name 1393 "dPdxy1" + Name 1401 "f16dPdxy1" + Name 1409 "dPdxy2" + Name 1417 "f16dPdxy2" + Name 1425 "dPdxy3" + Name 1433 "f16dPdxy3" + Name 1632 "texel" + Name 1820 "texel" + Name 2002 "texel" + Name 2184 "texel" + Name 2303 "texel" + Name 2375 "texel" + Name 2450 "texel" + Name 2502 "texel" + Name 2530 "texel" + Name 2559 "size" + Name 2733 "lod" + Name 2869 "levels" + Name 2938 "samples" + Name 2952 "texel" + Name 2955 "i1D" + Name 2964 "i2D" + Name 2973 "i3D" + Name 2982 "i2DRect" + Name 2991 "iCube" + Name 3000 "iBuffer" + Name 3009 "i1DArray" + Name 3018 "i2DArray" + Name 3027 "iCubeArray" + Name 3036 "i2DMS" + Name 3045 "i2DMSArray" + Name 3099 "texel" + Name 3102 "ResType" + Name 3138 "ResType" + Name 3242 "texel" + Name 3322 "texel" + Name 3412 "texel" + Name 3468 "texel" + Name 3628 "texel" + Name 3742 "texel" + Name 3794 "texel" + Name 3832 "texel" + Name 3950 "texel" + Name 4022 "texel" + Name 4094 "texel" + Name 4146 "texel" + Name 4174 "texel" + Name 4202 "texel" + Name 4254 "texel" + Name 4257 "lodClamp" + Name 4264 "f16lodClamp" + Name 4391 "texel" + Name 4598 "texel" + Name 4674 "texel" + Name 4818 "texel" + Name 4962 "texel" + Name 5188 "texel" + Name 5280 "texel" + Name 5452 "texel" + Name 5454 "t1D" + Name 5458 "s" + Name 5474 "t2D" + Name 5491 "t3D" + Name 5508 "tCube" + Name 5525 "sShadow" + Name 5589 "t1DArray" + Name 5606 "t2DArray" + Name 5623 "tCubeArray" + Name 5681 "t2DRect" + Name 5741 "subpass" + Name 5747 "subpassMS" + Name 5753 "result" + Name 5834 "param" + Name 5913 "fragColor" + Name 5917 "tBuffer" + Name 5919 "t2DMS" + Name 5921 "t2DMSArray" + Name 5922 "bias" + Decorate 125(s1D) DescriptorSet 0 + Decorate 125(s1D) Binding 0 + Decorate 128(c1) Location 0 + Decorate 135(f16c1) Location 11 + Decorate 137(f16bias) Location 16 + Decorate 145(s2D) DescriptorSet 0 + Decorate 145(s2D) Binding 1 + Decorate 148(c2) Location 1 + Decorate 156(f16c2) Location 12 + Decorate 165(s3D) DescriptorSet 0 + Decorate 165(s3D) Binding 2 + Decorate 169(c3) Location 2 + Decorate 177(f16c3) Location 13 + Decorate 186(sCube) DescriptorSet 0 + Decorate 186(sCube) Binding 4 + Decorate 201(s1DShadow) DescriptorSet 0 + Decorate 201(s1DShadow) Binding 11 + Decorate 215(compare) Location 4 + Decorate 226(s2DShadow) DescriptorSet 0 + Decorate 226(s2DShadow) Binding 12 + Decorate 247(sCubeShadow) DescriptorSet 0 + Decorate 247(sCubeShadow) Binding 14 + Decorate 251(c4) Location 3 + Decorate 271(s1DArray) DescriptorSet 0 + Decorate 271(s1DArray) Binding 7 + Decorate 286(s2DArray) DescriptorSet 0 + Decorate 286(s2DArray) Binding 8 + Decorate 301(sCubeArray) DescriptorSet 0 + Decorate 301(sCubeArray) Binding 9 + Decorate 309(f16c4) Location 14 + Decorate 318(s1DArrayShadow) DescriptorSet 0 + Decorate 318(s1DArrayShadow) Binding 15 + Decorate 339(s2DArrayShadow) DescriptorSet 0 + Decorate 339(s2DArrayShadow) Binding 16 + Decorate 359(s2DRect) DescriptorSet 0 + Decorate 359(s2DRect) Binding 3 + Decorate 373(s2DRectShadow) DescriptorSet 0 + Decorate 373(s2DRectShadow) Binding 13 + Decorate 393(sCubeArrayShadow) DescriptorSet 0 + Decorate 393(sCubeArrayShadow) Binding 17 + Decorate 565(lod) Location 5 + Decorate 572(f16lod) Location 15 + Decorate 1300(sBuffer) DescriptorSet 0 + Decorate 1300(sBuffer) Binding 5 + Decorate 1311(s2DMS) DescriptorSet 0 + Decorate 1311(s2DMS) Binding 6 + Decorate 1322(s2DMSArray) DescriptorSet 0 + Decorate 1322(s2DMSArray) Binding 10 + Decorate 1393(dPdxy1) Location 8 + Decorate 1401(f16dPdxy1) Location 18 + Decorate 1409(dPdxy2) Location 9 + Decorate 1417(f16dPdxy2) Location 19 + Decorate 1425(dPdxy3) Location 10 + Decorate 1433(f16dPdxy3) Location 20 + Decorate 2955(i1D) DescriptorSet 1 + Decorate 2955(i1D) Binding 0 + Decorate 2964(i2D) DescriptorSet 1 + Decorate 2964(i2D) Binding 1 + Decorate 2973(i3D) DescriptorSet 1 + Decorate 2973(i3D) Binding 2 + Decorate 2982(i2DRect) DescriptorSet 1 + Decorate 2982(i2DRect) Binding 3 + Decorate 2991(iCube) DescriptorSet 1 + Decorate 2991(iCube) Binding 4 + Decorate 3000(iBuffer) DescriptorSet 1 + Decorate 3000(iBuffer) Binding 8 + Decorate 3009(i1DArray) DescriptorSet 1 + Decorate 3009(i1DArray) Binding 5 + Decorate 3018(i2DArray) DescriptorSet 1 + Decorate 3018(i2DArray) Binding 6 + Decorate 3027(iCubeArray) DescriptorSet 1 + Decorate 3027(iCubeArray) Binding 7 + Decorate 3036(i2DMS) DescriptorSet 1 + Decorate 3036(i2DMS) Binding 9 + Decorate 3045(i2DMSArray) DescriptorSet 1 + Decorate 3045(i2DMSArray) Binding 10 + Decorate 4257(lodClamp) Location 7 + Decorate 4264(f16lodClamp) Location 17 + Decorate 5454(t1D) DescriptorSet 2 + Decorate 5454(t1D) Binding 0 + Decorate 5458(s) DescriptorSet 2 + Decorate 5458(s) Binding 11 + Decorate 5474(t2D) DescriptorSet 2 + Decorate 5474(t2D) Binding 1 + Decorate 5491(t3D) DescriptorSet 2 + Decorate 5491(t3D) Binding 2 + Decorate 5508(tCube) DescriptorSet 2 + Decorate 5508(tCube) Binding 4 + Decorate 5525(sShadow) DescriptorSet 2 + Decorate 5525(sShadow) Binding 12 + Decorate 5589(t1DArray) DescriptorSet 2 + Decorate 5589(t1DArray) Binding 5 + Decorate 5606(t2DArray) DescriptorSet 2 + Decorate 5606(t2DArray) Binding 6 + Decorate 5623(tCubeArray) DescriptorSet 2 + Decorate 5623(tCubeArray) Binding 7 + Decorate 5681(t2DRect) DescriptorSet 2 + Decorate 5681(t2DRect) Binding 3 + Decorate 5741(subpass) DescriptorSet 3 + Decorate 5741(subpass) Binding 0 + Decorate 5741(subpass) InputAttachmentIndex 0 + Decorate 5747(subpassMS) DescriptorSet 3 + Decorate 5747(subpassMS) Binding 1 + Decorate 5747(subpassMS) InputAttachmentIndex 0 + Decorate 5913(fragColor) Location 0 + Decorate 5917(tBuffer) DescriptorSet 2 + Decorate 5917(tBuffer) Binding 8 + Decorate 5919(t2DMS) DescriptorSet 2 + Decorate 5919(t2DMS) Binding 9 + Decorate 5921(t2DMSArray) DescriptorSet 2 + Decorate 5921(t2DMSArray) Binding 10 + Decorate 5922(bias) Location 6 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 16 + 7: TypeVector 6(float16_t) 4 + 8: TypeFunction 7(f16vec4) + 47: TypeInt 32 1 + 48: TypeVector 47(int) 4 + 49: TypeFunction 48(ivec4) + 52: TypeFloat 32 + 53: TypeVector 52(float) 2 + 54: TypeFunction 53(fvec2) + 57: TypeFunction 47(int) + 64: TypePointer Function 7(f16vec4) + 65: TypeFunction 2 64(ptr) + 120:6(float16_t) Constant 0 + 121: 7(f16vec4) ConstantComposite 120 120 120 120 + 122: TypeImage 6(float16_t) 1D sampled format:Unknown + 123: TypeSampledImage 122 + 124: TypePointer UniformConstant 123 + 125(s1D): 124(ptr) Variable UniformConstant + 127: TypePointer Input 52(float) + 128(c1): 127(ptr) Variable Input + 134: TypePointer Input 6(float16_t) + 135(f16c1): 134(ptr) Variable Input + 137(f16bias): 134(ptr) Variable Input + 142: TypeImage 6(float16_t) 2D sampled format:Unknown + 143: TypeSampledImage 142 + 144: TypePointer UniformConstant 143 + 145(s2D): 144(ptr) Variable UniformConstant + 147: TypePointer Input 53(fvec2) + 148(c2): 147(ptr) Variable Input + 154: TypeVector 6(float16_t) 2 + 155: TypePointer Input 154(f16vec2) + 156(f16c2): 155(ptr) Variable Input + 162: TypeImage 6(float16_t) 3D sampled format:Unknown + 163: TypeSampledImage 162 + 164: TypePointer UniformConstant 163 + 165(s3D): 164(ptr) Variable UniformConstant + 167: TypeVector 52(float) 3 + 168: TypePointer Input 167(fvec3) + 169(c3): 168(ptr) Variable Input + 175: TypeVector 6(float16_t) 3 + 176: TypePointer Input 175(f16vec3) + 177(f16c3): 176(ptr) Variable Input + 183: TypeImage 6(float16_t) Cube sampled format:Unknown + 184: TypeSampledImage 183 + 185: TypePointer UniformConstant 184 + 186(sCube): 185(ptr) Variable UniformConstant + 198: TypeImage 6(float16_t) 1D depth sampled format:Unknown + 199: TypeSampledImage 198 + 200: TypePointer UniformConstant 199 + 201(s1DShadow): 200(ptr) Variable UniformConstant + 206: TypeInt 32 0 + 207: 206(int) Constant 0 + 208: TypePointer Function 6(float16_t) + 215(compare): 127(ptr) Variable Input + 223: TypeImage 6(float16_t) 2D depth sampled format:Unknown + 224: TypeSampledImage 223 + 225: TypePointer UniformConstant 224 + 226(s2DShadow): 225(ptr) Variable UniformConstant + 244: TypeImage 6(float16_t) Cube depth sampled format:Unknown + 245: TypeSampledImage 244 + 246: TypePointer UniformConstant 245 +247(sCubeShadow): 246(ptr) Variable UniformConstant + 249: TypeVector 52(float) 4 + 250: TypePointer Input 249(fvec4) + 251(c4): 250(ptr) Variable Input + 268: TypeImage 6(float16_t) 1D array sampled format:Unknown + 269: TypeSampledImage 268 + 270: TypePointer UniformConstant 269 + 271(s1DArray): 270(ptr) Variable UniformConstant + 283: TypeImage 6(float16_t) 2D array sampled format:Unknown + 284: TypeSampledImage 283 + 285: TypePointer UniformConstant 284 + 286(s2DArray): 285(ptr) Variable UniformConstant + 298: TypeImage 6(float16_t) Cube array sampled format:Unknown + 299: TypeSampledImage 298 + 300: TypePointer UniformConstant 299 + 301(sCubeArray): 300(ptr) Variable UniformConstant + 308: TypePointer Input 7(f16vec4) + 309(f16c4): 308(ptr) Variable Input + 315: TypeImage 6(float16_t) 1D depth array sampled format:Unknown + 316: TypeSampledImage 315 + 317: TypePointer UniformConstant 316 +318(s1DArrayShadow): 317(ptr) Variable UniformConstant + 336: TypeImage 6(float16_t) 2D depth array sampled format:Unknown + 337: TypeSampledImage 336 + 338: TypePointer UniformConstant 337 +339(s2DArrayShadow): 338(ptr) Variable UniformConstant + 356: TypeImage 6(float16_t) Rect sampled format:Unknown + 357: TypeSampledImage 356 + 358: TypePointer UniformConstant 357 + 359(s2DRect): 358(ptr) Variable UniformConstant + 370: TypeImage 6(float16_t) Rect depth sampled format:Unknown + 371: TypeSampledImage 370 + 372: TypePointer UniformConstant 371 +373(s2DRectShadow): 372(ptr) Variable UniformConstant + 390: TypeImage 6(float16_t) Cube depth array sampled format:Unknown + 391: TypeSampledImage 390 + 392: TypePointer UniformConstant 391 +393(sCubeArrayShadow): 392(ptr) Variable UniformConstant + 565(lod): 127(ptr) Variable Input + 572(f16lod): 134(ptr) Variable Input + 709: 47(int) Constant 1 + 721: TypeVector 47(int) 2 + 722: 721(ivec2) ConstantComposite 709 709 + 734: TypeVector 47(int) 3 + 735: 734(ivec3) ConstantComposite 709 709 709 + 1297: TypeImage 6(float16_t) Buffer sampled format:Unknown + 1298: TypeSampledImage 1297 + 1299: TypePointer UniformConstant 1298 + 1300(sBuffer): 1299(ptr) Variable UniformConstant + 1308: TypeImage 6(float16_t) 2D multi-sampled sampled format:Unknown + 1309: TypeSampledImage 1308 + 1310: TypePointer UniformConstant 1309 + 1311(s2DMS): 1310(ptr) Variable UniformConstant + 1319: TypeImage 6(float16_t) 2D array multi-sampled sampled format:Unknown + 1320: TypeSampledImage 1319 + 1321: TypePointer UniformConstant 1320 +1322(s2DMSArray): 1321(ptr) Variable UniformConstant + 1326: 47(int) Constant 2 + 1393(dPdxy1): 127(ptr) Variable Input + 1401(f16dPdxy1): 134(ptr) Variable Input + 1409(dPdxy2): 147(ptr) Variable Input + 1417(f16dPdxy2): 155(ptr) Variable Input + 1425(dPdxy3): 168(ptr) Variable Input + 1433(f16dPdxy3): 176(ptr) Variable Input + 2187: 47(int) Constant 0 + 2378: 206(int) Constant 4 + 2379: TypeArray 721(ivec2) 2378 + 2380: 2379 ConstantComposite 722 722 722 722 + 2558: TypePointer Function 48(ivec4) + 2560: 48(ivec4) ConstantComposite 2187 2187 2187 2187 + 2566: TypePointer Function 47(int) + 2732: TypePointer Function 53(fvec2) + 2734: 52(float) Constant 0 + 2735: 53(fvec2) ConstantComposite 2734 2734 + 2953: TypeImage 6(float16_t) 1D nonsampled format:Rgba16f + 2954: TypePointer UniformConstant 2953 + 2955(i1D): 2954(ptr) Variable UniformConstant + 2962: TypeImage 6(float16_t) 2D nonsampled format:Rgba16f + 2963: TypePointer UniformConstant 2962 + 2964(i2D): 2963(ptr) Variable UniformConstant + 2971: TypeImage 6(float16_t) 3D nonsampled format:Rgba16f + 2972: TypePointer UniformConstant 2971 + 2973(i3D): 2972(ptr) Variable UniformConstant + 2980: TypeImage 6(float16_t) Rect nonsampled format:Rgba16f + 2981: TypePointer UniformConstant 2980 + 2982(i2DRect): 2981(ptr) Variable UniformConstant + 2989: TypeImage 6(float16_t) Cube nonsampled format:Rgba16f + 2990: TypePointer UniformConstant 2989 + 2991(iCube): 2990(ptr) Variable UniformConstant + 2998: TypeImage 6(float16_t) Buffer nonsampled format:Rgba16f + 2999: TypePointer UniformConstant 2998 + 3000(iBuffer): 2999(ptr) Variable UniformConstant + 3007: TypeImage 6(float16_t) 1D array nonsampled format:Rgba16f + 3008: TypePointer UniformConstant 3007 + 3009(i1DArray): 3008(ptr) Variable UniformConstant + 3016: TypeImage 6(float16_t) 2D array nonsampled format:Rgba16f + 3017: TypePointer UniformConstant 3016 + 3018(i2DArray): 3017(ptr) Variable UniformConstant + 3025: TypeImage 6(float16_t) Cube array nonsampled format:Rgba16f + 3026: TypePointer UniformConstant 3025 +3027(iCubeArray): 3026(ptr) Variable UniformConstant + 3034: TypeImage 6(float16_t) 2D multi-sampled nonsampled format:Rgba16f + 3035: TypePointer UniformConstant 3034 + 3036(i2DMS): 3035(ptr) Variable UniformConstant + 3043: TypeImage 6(float16_t) 2D array multi-sampled nonsampled format:Rgba16f + 3044: TypePointer UniformConstant 3043 +3045(i2DMSArray): 3044(ptr) Variable UniformConstant + 3102(ResType): TypeStruct 47(int) 7(f16vec4) + 3138(ResType): TypeStruct 47(int) 6(float16_t) + 4257(lodClamp): 127(ptr) Variable Input +4264(f16lodClamp): 134(ptr) Variable Input + 5453: TypePointer UniformConstant 122 + 5454(t1D): 5453(ptr) Variable UniformConstant + 5456: TypeSampler + 5457: TypePointer UniformConstant 5456 + 5458(s): 5457(ptr) Variable UniformConstant + 5473: TypePointer UniformConstant 142 + 5474(t2D): 5473(ptr) Variable UniformConstant + 5490: TypePointer UniformConstant 162 + 5491(t3D): 5490(ptr) Variable UniformConstant + 5507: TypePointer UniformConstant 183 + 5508(tCube): 5507(ptr) Variable UniformConstant + 5525(sShadow): 5457(ptr) Variable UniformConstant + 5588: TypePointer UniformConstant 268 + 5589(t1DArray): 5588(ptr) Variable UniformConstant + 5605: TypePointer UniformConstant 283 + 5606(t2DArray): 5605(ptr) Variable UniformConstant + 5622: TypePointer UniformConstant 298 +5623(tCubeArray): 5622(ptr) Variable UniformConstant + 5680: TypePointer UniformConstant 356 + 5681(t2DRect): 5680(ptr) Variable UniformConstant + 5739: TypeImage 6(float16_t) SubpassData nonsampled format:Unknown + 5740: TypePointer UniformConstant 5739 + 5741(subpass): 5740(ptr) Variable UniformConstant + 5743: 721(ivec2) ConstantComposite 2187 2187 + 5745: TypeImage 6(float16_t) SubpassData multi-sampled nonsampled format:Unknown + 5746: TypePointer UniformConstant 5745 + 5747(subpassMS): 5746(ptr) Variable UniformConstant + 5912: TypePointer Output 249(fvec4) + 5913(fragColor): 5912(ptr) Variable Output + 5916: TypePointer UniformConstant 1297 + 5917(tBuffer): 5916(ptr) Variable UniformConstant + 5918: TypePointer UniformConstant 1308 + 5919(t2DMS): 5918(ptr) Variable UniformConstant + 5920: TypePointer UniformConstant 1319 +5921(t2DMSArray): 5920(ptr) Variable UniformConstant + 5922(bias): 127(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 5753(result): 64(ptr) Variable Function + 5834(param): 64(ptr) Variable Function + Store 5753(result) 121 + 5754: 7(f16vec4) FunctionCall 9(testTexture() + 5755: 7(f16vec4) Load 5753(result) + 5756: 7(f16vec4) FAdd 5755 5754 + Store 5753(result) 5756 + 5757: 7(f16vec4) FunctionCall 11(testTextureProj() + 5758: 7(f16vec4) Load 5753(result) + 5759: 7(f16vec4) FAdd 5758 5757 + Store 5753(result) 5759 + 5760: 7(f16vec4) FunctionCall 13(testTextureLod() + 5761: 7(f16vec4) Load 5753(result) + 5762: 7(f16vec4) FAdd 5761 5760 + Store 5753(result) 5762 + 5763: 7(f16vec4) FunctionCall 15(testTextureOffset() + 5764: 7(f16vec4) Load 5753(result) + 5765: 7(f16vec4) FAdd 5764 5763 + Store 5753(result) 5765 + 5766: 7(f16vec4) FunctionCall 19(testTextureLodOffset() + 5767: 7(f16vec4) Load 5753(result) + 5768: 7(f16vec4) FAdd 5767 5766 + Store 5753(result) 5768 + 5769: 7(f16vec4) FunctionCall 21(testTextureProjLodOffset() + 5770: 7(f16vec4) Load 5753(result) + 5771: 7(f16vec4) FAdd 5770 5769 + Store 5753(result) 5771 + 5772: 7(f16vec4) FunctionCall 23(testTexelFetch() + 5773: 7(f16vec4) Load 5753(result) + 5774: 7(f16vec4) FAdd 5773 5772 + Store 5753(result) 5774 + 5775: 7(f16vec4) FunctionCall 25(testTexelFetchOffset() + 5776: 7(f16vec4) Load 5753(result) + 5777: 7(f16vec4) FAdd 5776 5775 + Store 5753(result) 5777 + 5778: 7(f16vec4) FunctionCall 27(testTextureGrad() + 5779: 7(f16vec4) Load 5753(result) + 5780: 7(f16vec4) FAdd 5779 5778 + Store 5753(result) 5780 + 5781: 7(f16vec4) FunctionCall 29(testTextureGradOffset() + 5782: 7(f16vec4) Load 5753(result) + 5783: 7(f16vec4) FAdd 5782 5781 + Store 5753(result) 5783 + 5784: 7(f16vec4) FunctionCall 31(testTextureProjGrad() + 5785: 7(f16vec4) Load 5753(result) + 5786: 7(f16vec4) FAdd 5785 5784 + Store 5753(result) 5786 + 5787: 7(f16vec4) FunctionCall 33(testTextureProjGradoffset() + 5788: 7(f16vec4) Load 5753(result) + 5789: 7(f16vec4) FAdd 5788 5787 + Store 5753(result) 5789 + 5790: 7(f16vec4) FunctionCall 35(testTextureGather() + 5791: 7(f16vec4) Load 5753(result) + 5792: 7(f16vec4) FAdd 5791 5790 + Store 5753(result) 5792 + 5793: 7(f16vec4) FunctionCall 37(testTextureGatherOffset() + 5794: 7(f16vec4) Load 5753(result) + 5795: 7(f16vec4) FAdd 5794 5793 + Store 5753(result) 5795 + 5796: 7(f16vec4) FunctionCall 39(testTextureGatherOffsets() + 5797: 7(f16vec4) Load 5753(result) + 5798: 7(f16vec4) FAdd 5797 5796 + Store 5753(result) 5798 + 5799: 7(f16vec4) FunctionCall 41(testTextureGatherLod() + 5800: 7(f16vec4) Load 5753(result) + 5801: 7(f16vec4) FAdd 5800 5799 + Store 5753(result) 5801 + 5802: 7(f16vec4) FunctionCall 43(testTextureGatherLodOffset() + 5803: 7(f16vec4) Load 5753(result) + 5804: 7(f16vec4) FAdd 5803 5802 + Store 5753(result) 5804 + 5805: 7(f16vec4) FunctionCall 45(testTextureGatherLodOffsets() + 5806: 7(f16vec4) Load 5753(result) + 5807: 7(f16vec4) FAdd 5806 5805 + Store 5753(result) 5807 + 5808: 48(ivec4) FunctionCall 50(testTextureSize() + 5809: 7(f16vec4) ConvertSToF 5808 + 5810: 7(f16vec4) Load 5753(result) + 5811: 7(f16vec4) FAdd 5810 5809 + Store 5753(result) 5811 + 5812: 53(fvec2) FunctionCall 55(testTextureQueryLod() + 5813:154(f16vec2) FConvert 5812 + 5814: 7(f16vec4) Load 5753(result) + 5815:154(f16vec2) VectorShuffle 5814 5814 0 1 + 5816:154(f16vec2) FAdd 5815 5813 + 5817: 7(f16vec4) Load 5753(result) + 5818: 7(f16vec4) VectorShuffle 5817 5816 4 5 2 3 + Store 5753(result) 5818 + 5819: 47(int) FunctionCall 58(testTextureQueryLevels() + 5820:6(float16_t) ConvertSToF 5819 + 5821: 208(ptr) AccessChain 5753(result) 207 + 5822:6(float16_t) Load 5821 + 5823:6(float16_t) FAdd 5822 5820 + 5824: 208(ptr) AccessChain 5753(result) 207 + Store 5824 5823 + 5825: 47(int) FunctionCall 60(testTextureSamples() + 5826:6(float16_t) ConvertSToF 5825 + 5827: 208(ptr) AccessChain 5753(result) 207 + 5828:6(float16_t) Load 5827 + 5829:6(float16_t) FAdd 5828 5826 + 5830: 208(ptr) AccessChain 5753(result) 207 + Store 5830 5829 + 5831: 7(f16vec4) FunctionCall 62(testImageLoad() + 5832: 7(f16vec4) Load 5753(result) + 5833: 7(f16vec4) FAdd 5832 5831 + Store 5753(result) 5833 + 5835: 7(f16vec4) Load 5753(result) + Store 5834(param) 5835 + 5836: 2 FunctionCall 67(testImageStore(vf164;) 5834(param) + 5837: 7(f16vec4) FunctionCall 69(testSparseTexture() + 5838: 7(f16vec4) Load 5753(result) + 5839: 7(f16vec4) FAdd 5838 5837 + Store 5753(result) 5839 + 5840: 7(f16vec4) FunctionCall 71(testSparseTextureLod() + 5841: 7(f16vec4) Load 5753(result) + 5842: 7(f16vec4) FAdd 5841 5840 + Store 5753(result) 5842 + 5843: 7(f16vec4) FunctionCall 73(testSparseTextureOffset() + 5844: 7(f16vec4) Load 5753(result) + 5845: 7(f16vec4) FAdd 5844 5843 + Store 5753(result) 5845 + 5846: 7(f16vec4) FunctionCall 75(testSparseTextureLodOffset() + 5847: 7(f16vec4) Load 5753(result) + 5848: 7(f16vec4) FAdd 5847 5846 + Store 5753(result) 5848 + 5849: 7(f16vec4) FunctionCall 77(testSparseTextureGrad() + 5850: 7(f16vec4) Load 5753(result) + 5851: 7(f16vec4) FAdd 5850 5849 + Store 5753(result) 5851 + 5852: 7(f16vec4) FunctionCall 79(testSparseTextureGradOffset() + 5853: 7(f16vec4) Load 5753(result) + 5854: 7(f16vec4) FAdd 5853 5852 + Store 5753(result) 5854 + 5855: 7(f16vec4) FunctionCall 81(testSparseTexelFetch() + 5856: 7(f16vec4) Load 5753(result) + 5857: 7(f16vec4) FAdd 5856 5855 + Store 5753(result) 5857 + 5858: 7(f16vec4) FunctionCall 83(testSparseTexelFetchOffset() + 5859: 7(f16vec4) Load 5753(result) + 5860: 7(f16vec4) FAdd 5859 5858 + Store 5753(result) 5860 + 5861: 7(f16vec4) FunctionCall 85(testSparseTextureGather() + 5862: 7(f16vec4) Load 5753(result) + 5863: 7(f16vec4) FAdd 5862 5861 + Store 5753(result) 5863 + 5864: 7(f16vec4) FunctionCall 87(testSparseTextureGatherOffset() + 5865: 7(f16vec4) Load 5753(result) + 5866: 7(f16vec4) FAdd 5865 5864 + Store 5753(result) 5866 + 5867: 7(f16vec4) FunctionCall 89(testSparseTextureGatherOffsets() + 5868: 7(f16vec4) Load 5753(result) + 5869: 7(f16vec4) FAdd 5868 5867 + Store 5753(result) 5869 + 5870: 7(f16vec4) FunctionCall 91(testSparseTextureGatherLod() + 5871: 7(f16vec4) Load 5753(result) + 5872: 7(f16vec4) FAdd 5871 5870 + Store 5753(result) 5872 + 5873: 7(f16vec4) FunctionCall 93(testSparseTextureGatherLodOffset() + 5874: 7(f16vec4) Load 5753(result) + 5875: 7(f16vec4) FAdd 5874 5873 + Store 5753(result) 5875 + 5876: 7(f16vec4) FunctionCall 95(testSparseTextureGatherLodOffsets() + 5877: 7(f16vec4) Load 5753(result) + 5878: 7(f16vec4) FAdd 5877 5876 + Store 5753(result) 5878 + 5879: 7(f16vec4) FunctionCall 97(testSparseImageLoad() + 5880: 7(f16vec4) Load 5753(result) + 5881: 7(f16vec4) FAdd 5880 5879 + Store 5753(result) 5881 + 5882: 7(f16vec4) FunctionCall 99(testSparseTextureClamp() + 5883: 7(f16vec4) Load 5753(result) + 5884: 7(f16vec4) FAdd 5883 5882 + Store 5753(result) 5884 + 5885: 7(f16vec4) FunctionCall 101(testTextureClamp() + 5886: 7(f16vec4) Load 5753(result) + 5887: 7(f16vec4) FAdd 5886 5885 + Store 5753(result) 5887 + 5888: 7(f16vec4) FunctionCall 103(testSparseTextureOffsetClamp() + 5889: 7(f16vec4) Load 5753(result) + 5890: 7(f16vec4) FAdd 5889 5888 + Store 5753(result) 5890 + 5891: 7(f16vec4) FunctionCall 105(testTextureOffsetClamp() + 5892: 7(f16vec4) Load 5753(result) + 5893: 7(f16vec4) FAdd 5892 5891 + Store 5753(result) 5893 + 5894: 7(f16vec4) FunctionCall 77(testSparseTextureGrad() + 5895: 7(f16vec4) Load 5753(result) + 5896: 7(f16vec4) FAdd 5895 5894 + Store 5753(result) 5896 + 5897: 7(f16vec4) FunctionCall 27(testTextureGrad() + 5898: 7(f16vec4) Load 5753(result) + 5899: 7(f16vec4) FAdd 5898 5897 + Store 5753(result) 5899 + 5900: 7(f16vec4) FunctionCall 111(testSparseTextureGradOffsetClamp() + 5901: 7(f16vec4) Load 5753(result) + 5902: 7(f16vec4) FAdd 5901 5900 + Store 5753(result) 5902 + 5903: 7(f16vec4) FunctionCall 113(testTextureGradOffsetClamp() + 5904: 7(f16vec4) Load 5753(result) + 5905: 7(f16vec4) FAdd 5904 5903 + Store 5753(result) 5905 + 5906: 7(f16vec4) FunctionCall 115(testCombinedTextureSampler() + 5907: 7(f16vec4) Load 5753(result) + 5908: 7(f16vec4) FAdd 5907 5906 + Store 5753(result) 5908 + 5909: 7(f16vec4) FunctionCall 117(testSubpassLoad() + 5910: 7(f16vec4) Load 5753(result) + 5911: 7(f16vec4) FAdd 5910 5909 + Store 5753(result) 5911 + 5914: 7(f16vec4) Load 5753(result) + 5915: 249(fvec4) FConvert 5914 + Store 5913(fragColor) 5915 + Return + FunctionEnd + 9(testTexture(): 7(f16vec4) Function None 8 + 10: Label + 119(texel): 64(ptr) Variable Function + Store 119(texel) 121 + 126: 123 Load 125(s1D) + 129: 52(float) Load 128(c1) + 130: 7(f16vec4) ImageSampleImplicitLod 126 129 + 131: 7(f16vec4) Load 119(texel) + 132: 7(f16vec4) FAdd 131 130 + Store 119(texel) 132 + 133: 123 Load 125(s1D) + 136:6(float16_t) Load 135(f16c1) + 138:6(float16_t) Load 137(f16bias) + 139: 7(f16vec4) ImageSampleImplicitLod 133 136 Bias 138 + 140: 7(f16vec4) Load 119(texel) + 141: 7(f16vec4) FAdd 140 139 + Store 119(texel) 141 + 146: 143 Load 145(s2D) + 149: 53(fvec2) Load 148(c2) + 150: 7(f16vec4) ImageSampleImplicitLod 146 149 + 151: 7(f16vec4) Load 119(texel) + 152: 7(f16vec4) FAdd 151 150 + Store 119(texel) 152 + 153: 143 Load 145(s2D) + 157:154(f16vec2) Load 156(f16c2) + 158:6(float16_t) Load 137(f16bias) + 159: 7(f16vec4) ImageSampleImplicitLod 153 157 Bias 158 + 160: 7(f16vec4) Load 119(texel) + 161: 7(f16vec4) FAdd 160 159 + Store 119(texel) 161 + 166: 163 Load 165(s3D) + 170: 167(fvec3) Load 169(c3) + 171: 7(f16vec4) ImageSampleImplicitLod 166 170 + 172: 7(f16vec4) Load 119(texel) + 173: 7(f16vec4) FAdd 172 171 + Store 119(texel) 173 + 174: 163 Load 165(s3D) + 178:175(f16vec3) Load 177(f16c3) + 179:6(float16_t) Load 137(f16bias) + 180: 7(f16vec4) ImageSampleImplicitLod 174 178 Bias 179 + 181: 7(f16vec4) Load 119(texel) + 182: 7(f16vec4) FAdd 181 180 + Store 119(texel) 182 + 187: 184 Load 186(sCube) + 188: 167(fvec3) Load 169(c3) + 189: 7(f16vec4) ImageSampleImplicitLod 187 188 + 190: 7(f16vec4) Load 119(texel) + 191: 7(f16vec4) FAdd 190 189 + Store 119(texel) 191 + 192: 184 Load 186(sCube) + 193:175(f16vec3) Load 177(f16c3) + 194:6(float16_t) Load 137(f16bias) + 195: 7(f16vec4) ImageSampleImplicitLod 192 193 Bias 194 + 196: 7(f16vec4) Load 119(texel) + 197: 7(f16vec4) FAdd 196 195 + Store 119(texel) 197 + 202: 199 Load 201(s1DShadow) + 203: 167(fvec3) Load 169(c3) + 204: 52(float) CompositeExtract 203 2 + 205:6(float16_t) ImageSampleDrefImplicitLod 202 203 204 + 209: 208(ptr) AccessChain 119(texel) 207 + 210:6(float16_t) Load 209 + 211:6(float16_t) FAdd 210 205 + 212: 208(ptr) AccessChain 119(texel) 207 + Store 212 211 + 213: 199 Load 201(s1DShadow) + 214:154(f16vec2) Load 156(f16c2) + 216: 52(float) Load 215(compare) + 217:6(float16_t) Load 137(f16bias) + 218:6(float16_t) ImageSampleDrefImplicitLod 213 214 216 Bias 217 + 219: 208(ptr) AccessChain 119(texel) 207 + 220:6(float16_t) Load 219 + 221:6(float16_t) FAdd 220 218 + 222: 208(ptr) AccessChain 119(texel) 207 + Store 222 221 + 227: 224 Load 226(s2DShadow) + 228: 167(fvec3) Load 169(c3) + 229: 52(float) CompositeExtract 228 2 + 230:6(float16_t) ImageSampleDrefImplicitLod 227 228 229 + 231: 208(ptr) AccessChain 119(texel) 207 + 232:6(float16_t) Load 231 + 233:6(float16_t) FAdd 232 230 + 234: 208(ptr) AccessChain 119(texel) 207 + Store 234 233 + 235: 224 Load 226(s2DShadow) + 236:154(f16vec2) Load 156(f16c2) + 237: 52(float) Load 215(compare) + 238:6(float16_t) Load 137(f16bias) + 239:6(float16_t) ImageSampleDrefImplicitLod 235 236 237 Bias 238 + 240: 208(ptr) AccessChain 119(texel) 207 + 241:6(float16_t) Load 240 + 242:6(float16_t) FAdd 241 239 + 243: 208(ptr) AccessChain 119(texel) 207 + Store 243 242 + 248: 245 Load 247(sCubeShadow) + 252: 249(fvec4) Load 251(c4) + 253: 52(float) CompositeExtract 252 3 + 254:6(float16_t) ImageSampleDrefImplicitLod 248 252 253 + 255: 208(ptr) AccessChain 119(texel) 207 + 256:6(float16_t) Load 255 + 257:6(float16_t) FAdd 256 254 + 258: 208(ptr) AccessChain 119(texel) 207 + Store 258 257 + 259: 245 Load 247(sCubeShadow) + 260:175(f16vec3) Load 177(f16c3) + 261: 52(float) Load 215(compare) + 262:6(float16_t) Load 137(f16bias) + 263:6(float16_t) ImageSampleDrefImplicitLod 259 260 261 Bias 262 + 264: 208(ptr) AccessChain 119(texel) 207 + 265:6(float16_t) Load 264 + 266:6(float16_t) FAdd 265 263 + 267: 208(ptr) AccessChain 119(texel) 207 + Store 267 266 + 272: 269 Load 271(s1DArray) + 273: 53(fvec2) Load 148(c2) + 274: 7(f16vec4) ImageSampleImplicitLod 272 273 + 275: 7(f16vec4) Load 119(texel) + 276: 7(f16vec4) FAdd 275 274 + Store 119(texel) 276 + 277: 269 Load 271(s1DArray) + 278:154(f16vec2) Load 156(f16c2) + 279:6(float16_t) Load 137(f16bias) + 280: 7(f16vec4) ImageSampleImplicitLod 277 278 Bias 279 + 281: 7(f16vec4) Load 119(texel) + 282: 7(f16vec4) FAdd 281 280 + Store 119(texel) 282 + 287: 284 Load 286(s2DArray) + 288: 167(fvec3) Load 169(c3) + 289: 7(f16vec4) ImageSampleImplicitLod 287 288 + 290: 7(f16vec4) Load 119(texel) + 291: 7(f16vec4) FAdd 290 289 + Store 119(texel) 291 + 292: 284 Load 286(s2DArray) + 293:175(f16vec3) Load 177(f16c3) + 294:6(float16_t) Load 137(f16bias) + 295: 7(f16vec4) ImageSampleImplicitLod 292 293 Bias 294 + 296: 7(f16vec4) Load 119(texel) + 297: 7(f16vec4) FAdd 296 295 + Store 119(texel) 297 + 302: 299 Load 301(sCubeArray) + 303: 249(fvec4) Load 251(c4) + 304: 7(f16vec4) ImageSampleImplicitLod 302 303 + 305: 7(f16vec4) Load 119(texel) + 306: 7(f16vec4) FAdd 305 304 + Store 119(texel) 306 + 307: 299 Load 301(sCubeArray) + 310: 7(f16vec4) Load 309(f16c4) + 311:6(float16_t) Load 137(f16bias) + 312: 7(f16vec4) ImageSampleImplicitLod 307 310 Bias 311 + 313: 7(f16vec4) Load 119(texel) + 314: 7(f16vec4) FAdd 313 312 + Store 119(texel) 314 + 319: 316 Load 318(s1DArrayShadow) + 320: 167(fvec3) Load 169(c3) + 321: 52(float) CompositeExtract 320 2 + 322:6(float16_t) ImageSampleDrefImplicitLod 319 320 321 + 323: 208(ptr) AccessChain 119(texel) 207 + 324:6(float16_t) Load 323 + 325:6(float16_t) FAdd 324 322 + 326: 208(ptr) AccessChain 119(texel) 207 + Store 326 325 + 327: 316 Load 318(s1DArrayShadow) + 328:154(f16vec2) Load 156(f16c2) + 329: 52(float) Load 215(compare) + 330:6(float16_t) Load 137(f16bias) + 331:6(float16_t) ImageSampleDrefImplicitLod 327 328 329 Bias 330 + 332: 208(ptr) AccessChain 119(texel) 207 + 333:6(float16_t) Load 332 + 334:6(float16_t) FAdd 333 331 + 335: 208(ptr) AccessChain 119(texel) 207 + Store 335 334 + 340: 337 Load 339(s2DArrayShadow) + 341: 249(fvec4) Load 251(c4) + 342: 52(float) CompositeExtract 341 3 + 343:6(float16_t) ImageSampleDrefImplicitLod 340 341 342 + 344: 208(ptr) AccessChain 119(texel) 207 + 345:6(float16_t) Load 344 + 346:6(float16_t) FAdd 345 343 + 347: 208(ptr) AccessChain 119(texel) 207 + Store 347 346 + 348: 337 Load 339(s2DArrayShadow) + 349:175(f16vec3) Load 177(f16c3) + 350: 52(float) Load 215(compare) + 351:6(float16_t) ImageSampleDrefImplicitLod 348 349 350 + 352: 208(ptr) AccessChain 119(texel) 207 + 353:6(float16_t) Load 352 + 354:6(float16_t) FAdd 353 351 + 355: 208(ptr) AccessChain 119(texel) 207 + Store 355 354 + 360: 357 Load 359(s2DRect) + 361: 53(fvec2) Load 148(c2) + 362: 7(f16vec4) ImageSampleImplicitLod 360 361 + 363: 7(f16vec4) Load 119(texel) + 364: 7(f16vec4) FAdd 363 362 + Store 119(texel) 364 + 365: 357 Load 359(s2DRect) + 366:154(f16vec2) Load 156(f16c2) + 367: 7(f16vec4) ImageSampleImplicitLod 365 366 + 368: 7(f16vec4) Load 119(texel) + 369: 7(f16vec4) FAdd 368 367 + Store 119(texel) 369 + 374: 371 Load 373(s2DRectShadow) + 375: 167(fvec3) Load 169(c3) + 376: 52(float) CompositeExtract 375 2 + 377:6(float16_t) ImageSampleDrefImplicitLod 374 375 376 + 378: 208(ptr) AccessChain 119(texel) 207 + 379:6(float16_t) Load 378 + 380:6(float16_t) FAdd 379 377 + 381: 208(ptr) AccessChain 119(texel) 207 + Store 381 380 + 382: 371 Load 373(s2DRectShadow) + 383:154(f16vec2) Load 156(f16c2) + 384: 52(float) Load 215(compare) + 385:6(float16_t) ImageSampleDrefImplicitLod 382 383 384 + 386: 208(ptr) AccessChain 119(texel) 207 + 387:6(float16_t) Load 386 + 388:6(float16_t) FAdd 387 385 + 389: 208(ptr) AccessChain 119(texel) 207 + Store 389 388 + 394: 391 Load 393(sCubeArrayShadow) + 395: 249(fvec4) Load 251(c4) + 396: 52(float) Load 215(compare) + 397:6(float16_t) ImageSampleDrefImplicitLod 394 395 396 + 398: 208(ptr) AccessChain 119(texel) 207 + 399:6(float16_t) Load 398 + 400:6(float16_t) FAdd 399 397 + 401: 208(ptr) AccessChain 119(texel) 207 + Store 401 400 + 402: 391 Load 393(sCubeArrayShadow) + 403: 7(f16vec4) Load 309(f16c4) + 404: 52(float) Load 215(compare) + 405:6(float16_t) ImageSampleDrefImplicitLod 402 403 404 + 406: 208(ptr) AccessChain 119(texel) 207 + 407:6(float16_t) Load 406 + 408:6(float16_t) FAdd 407 405 + 409: 208(ptr) AccessChain 119(texel) 207 + Store 409 408 + 410: 7(f16vec4) Load 119(texel) + ReturnValue 410 + FunctionEnd +11(testTextureProj(): 7(f16vec4) Function None 8 + 12: Label + 413(texel): 64(ptr) Variable Function + Store 413(texel) 121 + 414: 123 Load 125(s1D) + 415: 53(fvec2) Load 148(c2) + 416: 7(f16vec4) ImageSampleProjImplicitLod 414 415 + 417: 7(f16vec4) Load 413(texel) + 418: 7(f16vec4) FAdd 417 416 + Store 413(texel) 418 + 419: 123 Load 125(s1D) + 420:154(f16vec2) Load 156(f16c2) + 421:6(float16_t) Load 137(f16bias) + 422: 7(f16vec4) ImageSampleProjImplicitLod 419 420 Bias 421 + 423: 7(f16vec4) Load 413(texel) + 424: 7(f16vec4) FAdd 423 422 + Store 413(texel) 424 + 425: 123 Load 125(s1D) + 426: 249(fvec4) Load 251(c4) + 427: 52(float) CompositeExtract 426 3 + 428: 249(fvec4) CompositeInsert 427 426 1 + 429: 7(f16vec4) ImageSampleProjImplicitLod 425 428 + 430: 7(f16vec4) Load 413(texel) + 431: 7(f16vec4) FAdd 430 429 + Store 413(texel) 431 + 432: 123 Load 125(s1D) + 433: 7(f16vec4) Load 309(f16c4) + 434:6(float16_t) Load 137(f16bias) + 435:6(float16_t) CompositeExtract 433 3 + 436: 7(f16vec4) CompositeInsert 435 433 1 + 437: 7(f16vec4) ImageSampleProjImplicitLod 432 436 Bias 434 + 438: 7(f16vec4) Load 413(texel) + 439: 7(f16vec4) FAdd 438 437 + Store 413(texel) 439 + 440: 143 Load 145(s2D) + 441: 167(fvec3) Load 169(c3) + 442: 7(f16vec4) ImageSampleProjImplicitLod 440 441 + 443: 7(f16vec4) Load 413(texel) + 444: 7(f16vec4) FAdd 443 442 + Store 413(texel) 444 + 445: 143 Load 145(s2D) + 446:175(f16vec3) Load 177(f16c3) + 447:6(float16_t) Load 137(f16bias) + 448: 7(f16vec4) ImageSampleProjImplicitLod 445 446 Bias 447 + 449: 7(f16vec4) Load 413(texel) + 450: 7(f16vec4) FAdd 449 448 + Store 413(texel) 450 + 451: 143 Load 145(s2D) + 452: 249(fvec4) Load 251(c4) + 453: 52(float) CompositeExtract 452 3 + 454: 249(fvec4) CompositeInsert 453 452 2 + 455: 7(f16vec4) ImageSampleProjImplicitLod 451 454 + 456: 7(f16vec4) Load 413(texel) + 457: 7(f16vec4) FAdd 456 455 + Store 413(texel) 457 + 458: 143 Load 145(s2D) + 459: 7(f16vec4) Load 309(f16c4) + 460:6(float16_t) Load 137(f16bias) + 461:6(float16_t) CompositeExtract 459 3 + 462: 7(f16vec4) CompositeInsert 461 459 2 + 463: 7(f16vec4) ImageSampleProjImplicitLod 458 462 Bias 460 + 464: 7(f16vec4) Load 413(texel) + 465: 7(f16vec4) FAdd 464 463 + Store 413(texel) 465 + 466: 163 Load 165(s3D) + 467: 249(fvec4) Load 251(c4) + 468: 7(f16vec4) ImageSampleProjImplicitLod 466 467 + 469: 7(f16vec4) Load 413(texel) + 470: 7(f16vec4) FAdd 469 468 + Store 413(texel) 470 + 471: 163 Load 165(s3D) + 472: 7(f16vec4) Load 309(f16c4) + 473:6(float16_t) Load 137(f16bias) + 474: 7(f16vec4) ImageSampleProjImplicitLod 471 472 Bias 473 + 475: 7(f16vec4) Load 413(texel) + 476: 7(f16vec4) FAdd 475 474 + Store 413(texel) 476 + 477: 199 Load 201(s1DShadow) + 478: 249(fvec4) Load 251(c4) + 479: 52(float) CompositeExtract 478 2 + 480: 52(float) CompositeExtract 478 3 + 481: 249(fvec4) CompositeInsert 480 478 1 + 482:6(float16_t) ImageSampleProjDrefImplicitLod 477 481 479 + 483: 208(ptr) AccessChain 413(texel) 207 + 484:6(float16_t) Load 483 + 485:6(float16_t) FAdd 484 482 + 486: 208(ptr) AccessChain 413(texel) 207 + Store 486 485 + 487: 199 Load 201(s1DShadow) + 488:175(f16vec3) Load 177(f16c3) + 489: 52(float) Load 215(compare) + 490:6(float16_t) Load 137(f16bias) + 491:6(float16_t) CompositeExtract 488 2 + 492:175(f16vec3) CompositeInsert 491 488 1 + 493:6(float16_t) ImageSampleProjDrefImplicitLod 487 492 489 Bias 490 + 494: 208(ptr) AccessChain 413(texel) 207 + 495:6(float16_t) Load 494 + 496:6(float16_t) FAdd 495 493 + 497: 208(ptr) AccessChain 413(texel) 207 + Store 497 496 + 498: 224 Load 226(s2DShadow) + 499: 249(fvec4) Load 251(c4) + 500: 52(float) CompositeExtract 499 2 + 501: 52(float) CompositeExtract 499 3 + 502: 249(fvec4) CompositeInsert 501 499 2 + 503:6(float16_t) ImageSampleProjDrefImplicitLod 498 502 500 + 504: 208(ptr) AccessChain 413(texel) 207 + 505:6(float16_t) Load 504 + 506:6(float16_t) FAdd 505 503 + 507: 208(ptr) AccessChain 413(texel) 207 + Store 507 506 + 508: 224 Load 226(s2DShadow) + 509:175(f16vec3) Load 177(f16c3) + 510: 52(float) Load 215(compare) + 511:6(float16_t) Load 137(f16bias) + 512:6(float16_t) ImageSampleProjDrefImplicitLod 508 509 510 Bias 511 + 513: 208(ptr) AccessChain 413(texel) 207 + 514:6(float16_t) Load 513 + 515:6(float16_t) FAdd 514 512 + 516: 208(ptr) AccessChain 413(texel) 207 + Store 516 515 + 517: 357 Load 359(s2DRect) + 518: 167(fvec3) Load 169(c3) + 519: 7(f16vec4) ImageSampleProjImplicitLod 517 518 + 520: 7(f16vec4) Load 413(texel) + 521: 7(f16vec4) FAdd 520 519 + Store 413(texel) 521 + 522: 357 Load 359(s2DRect) + 523:175(f16vec3) Load 177(f16c3) + 524: 7(f16vec4) ImageSampleProjImplicitLod 522 523 + 525: 7(f16vec4) Load 413(texel) + 526: 7(f16vec4) FAdd 525 524 + Store 413(texel) 526 + 527: 357 Load 359(s2DRect) + 528: 249(fvec4) Load 251(c4) + 529: 52(float) CompositeExtract 528 3 + 530: 249(fvec4) CompositeInsert 529 528 2 + 531: 7(f16vec4) ImageSampleProjImplicitLod 527 530 + 532: 7(f16vec4) Load 413(texel) + 533: 7(f16vec4) FAdd 532 531 + Store 413(texel) 533 + 534: 357 Load 359(s2DRect) + 535: 7(f16vec4) Load 309(f16c4) + 536:6(float16_t) CompositeExtract 535 3 + 537: 7(f16vec4) CompositeInsert 536 535 2 + 538: 7(f16vec4) ImageSampleProjImplicitLod 534 537 + 539: 7(f16vec4) Load 413(texel) + 540: 7(f16vec4) FAdd 539 538 + Store 413(texel) 540 + 541: 371 Load 373(s2DRectShadow) + 542: 249(fvec4) Load 251(c4) + 543: 52(float) CompositeExtract 542 2 + 544: 52(float) CompositeExtract 542 3 + 545: 249(fvec4) CompositeInsert 544 542 2 + 546:6(float16_t) ImageSampleProjDrefImplicitLod 541 545 543 + 547: 208(ptr) AccessChain 413(texel) 207 + 548:6(float16_t) Load 547 + 549:6(float16_t) FAdd 548 546 + 550: 208(ptr) AccessChain 413(texel) 207 + Store 550 549 + 551: 371 Load 373(s2DRectShadow) + 552:175(f16vec3) Load 177(f16c3) + 553: 52(float) Load 215(compare) + 554:6(float16_t) ImageSampleProjDrefImplicitLod 551 552 553 + 555: 208(ptr) AccessChain 413(texel) 207 + 556:6(float16_t) Load 555 + 557:6(float16_t) FAdd 556 554 + 558: 208(ptr) AccessChain 413(texel) 207 + Store 558 557 + 559: 7(f16vec4) Load 413(texel) + ReturnValue 559 + FunctionEnd +13(testTextureLod(): 7(f16vec4) Function None 8 + 14: Label + 562(texel): 64(ptr) Variable Function + Store 562(texel) 121 + 563: 123 Load 125(s1D) + 564: 52(float) Load 128(c1) + 566: 52(float) Load 565(lod) + 567: 7(f16vec4) ImageSampleExplicitLod 563 564 Lod 566 + 568: 7(f16vec4) Load 562(texel) + 569: 7(f16vec4) FAdd 568 567 + Store 562(texel) 569 + 570: 123 Load 125(s1D) + 571:6(float16_t) Load 135(f16c1) + 573:6(float16_t) Load 572(f16lod) + 574: 7(f16vec4) ImageSampleExplicitLod 570 571 Lod 573 + 575: 7(f16vec4) Load 562(texel) + 576: 7(f16vec4) FAdd 575 574 + Store 562(texel) 576 + 577: 143 Load 145(s2D) + 578: 53(fvec2) Load 148(c2) + 579: 52(float) Load 565(lod) + 580: 7(f16vec4) ImageSampleExplicitLod 577 578 Lod 579 + 581: 7(f16vec4) Load 562(texel) + 582: 7(f16vec4) FAdd 581 580 + Store 562(texel) 582 + 583: 143 Load 145(s2D) + 584:154(f16vec2) Load 156(f16c2) + 585:6(float16_t) Load 572(f16lod) + 586: 7(f16vec4) ImageSampleExplicitLod 583 584 Lod 585 + 587: 7(f16vec4) Load 562(texel) + 588: 7(f16vec4) FAdd 587 586 + Store 562(texel) 588 + 589: 163 Load 165(s3D) + 590: 167(fvec3) Load 169(c3) + 591: 52(float) Load 565(lod) + 592: 7(f16vec4) ImageSampleExplicitLod 589 590 Lod 591 + 593: 7(f16vec4) Load 562(texel) + 594: 7(f16vec4) FAdd 593 592 + Store 562(texel) 594 + 595: 163 Load 165(s3D) + 596:175(f16vec3) Load 177(f16c3) + 597:6(float16_t) Load 572(f16lod) + 598: 7(f16vec4) ImageSampleExplicitLod 595 596 Lod 597 + 599: 7(f16vec4) Load 562(texel) + 600: 7(f16vec4) FAdd 599 598 + Store 562(texel) 600 + 601: 184 Load 186(sCube) + 602: 167(fvec3) Load 169(c3) + 603: 52(float) Load 565(lod) + 604: 7(f16vec4) ImageSampleExplicitLod 601 602 Lod 603 + 605: 7(f16vec4) Load 562(texel) + 606: 7(f16vec4) FAdd 605 604 + Store 562(texel) 606 + 607: 184 Load 186(sCube) + 608:175(f16vec3) Load 177(f16c3) + 609:6(float16_t) Load 572(f16lod) + 610: 7(f16vec4) ImageSampleExplicitLod 607 608 Lod 609 + 611: 7(f16vec4) Load 562(texel) + 612: 7(f16vec4) FAdd 611 610 + Store 562(texel) 612 + 613: 199 Load 201(s1DShadow) + 614: 167(fvec3) Load 169(c3) + 615: 52(float) Load 565(lod) + 616: 52(float) CompositeExtract 614 2 + 617:6(float16_t) ImageSampleDrefExplicitLod 613 614 616 Lod 615 + 618: 208(ptr) AccessChain 562(texel) 207 + 619:6(float16_t) Load 618 + 620:6(float16_t) FAdd 619 617 + 621: 208(ptr) AccessChain 562(texel) 207 + Store 621 620 + 622: 199 Load 201(s1DShadow) + 623:154(f16vec2) Load 156(f16c2) + 624: 52(float) Load 215(compare) + 625:6(float16_t) Load 572(f16lod) + 626:6(float16_t) ImageSampleDrefExplicitLod 622 623 624 Lod 625 + 627: 208(ptr) AccessChain 562(texel) 207 + 628:6(float16_t) Load 627 + 629:6(float16_t) FAdd 628 626 + 630: 208(ptr) AccessChain 562(texel) 207 + Store 630 629 + 631: 224 Load 226(s2DShadow) + 632: 167(fvec3) Load 169(c3) + 633: 52(float) Load 565(lod) + 634: 52(float) CompositeExtract 632 2 + 635:6(float16_t) ImageSampleDrefExplicitLod 631 632 634 Lod 633 + 636: 208(ptr) AccessChain 562(texel) 207 + 637:6(float16_t) Load 636 + 638:6(float16_t) FAdd 637 635 + 639: 208(ptr) AccessChain 562(texel) 207 + Store 639 638 + 640: 224 Load 226(s2DShadow) + 641:154(f16vec2) Load 156(f16c2) + 642: 52(float) Load 215(compare) + 643:6(float16_t) Load 572(f16lod) + 644:6(float16_t) ImageSampleDrefExplicitLod 640 641 642 Lod 643 + 645: 208(ptr) AccessChain 562(texel) 207 + 646:6(float16_t) Load 645 + 647:6(float16_t) FAdd 646 644 + 648: 208(ptr) AccessChain 562(texel) 207 + Store 648 647 + 649: 269 Load 271(s1DArray) + 650: 53(fvec2) Load 148(c2) + 651: 52(float) Load 565(lod) + 652: 7(f16vec4) ImageSampleExplicitLod 649 650 Lod 651 + 653: 7(f16vec4) Load 562(texel) + 654: 7(f16vec4) FAdd 653 652 + Store 562(texel) 654 + 655: 269 Load 271(s1DArray) + 656:154(f16vec2) Load 156(f16c2) + 657:6(float16_t) Load 572(f16lod) + 658: 7(f16vec4) ImageSampleExplicitLod 655 656 Lod 657 + 659: 7(f16vec4) Load 562(texel) + 660: 7(f16vec4) FAdd 659 658 + Store 562(texel) 660 + 661: 284 Load 286(s2DArray) + 662: 167(fvec3) Load 169(c3) + 663: 52(float) Load 565(lod) + 664: 7(f16vec4) ImageSampleExplicitLod 661 662 Lod 663 + 665: 7(f16vec4) Load 562(texel) + 666: 7(f16vec4) FAdd 665 664 + Store 562(texel) 666 + 667: 284 Load 286(s2DArray) + 668:175(f16vec3) Load 177(f16c3) + 669:6(float16_t) Load 572(f16lod) + 670: 7(f16vec4) ImageSampleExplicitLod 667 668 Lod 669 + 671: 7(f16vec4) Load 562(texel) + 672: 7(f16vec4) FAdd 671 670 + Store 562(texel) 672 + 673: 316 Load 318(s1DArrayShadow) + 674: 167(fvec3) Load 169(c3) + 675: 52(float) Load 565(lod) + 676: 52(float) CompositeExtract 674 2 + 677:6(float16_t) ImageSampleDrefExplicitLod 673 674 676 Lod 675 + 678: 208(ptr) AccessChain 562(texel) 207 + 679:6(float16_t) Load 678 + 680:6(float16_t) FAdd 679 677 + 681: 208(ptr) AccessChain 562(texel) 207 + Store 681 680 + 682: 316 Load 318(s1DArrayShadow) + 683:154(f16vec2) Load 156(f16c2) + 684: 52(float) Load 215(compare) + 685:6(float16_t) Load 572(f16lod) + 686:6(float16_t) ImageSampleDrefExplicitLod 682 683 684 Lod 685 + 687: 208(ptr) AccessChain 562(texel) 207 + 688:6(float16_t) Load 687 + 689:6(float16_t) FAdd 688 686 + 690: 208(ptr) AccessChain 562(texel) 207 + Store 690 689 + 691: 299 Load 301(sCubeArray) + 692: 249(fvec4) Load 251(c4) + 693: 52(float) Load 565(lod) + 694: 7(f16vec4) ImageSampleExplicitLod 691 692 Lod 693 + 695: 7(f16vec4) Load 562(texel) + 696: 7(f16vec4) FAdd 695 694 + Store 562(texel) 696 + 697: 299 Load 301(sCubeArray) + 698: 7(f16vec4) Load 309(f16c4) + 699:6(float16_t) Load 572(f16lod) + 700: 7(f16vec4) ImageSampleExplicitLod 697 698 Lod 699 + 701: 7(f16vec4) Load 562(texel) + 702: 7(f16vec4) FAdd 701 700 + Store 562(texel) 702 + 703: 7(f16vec4) Load 562(texel) + ReturnValue 703 + FunctionEnd +15(testTextureOffset(): 7(f16vec4) Function None 8 + 16: Label + 706(texel): 64(ptr) Variable Function + Store 706(texel) 121 + 707: 123 Load 125(s1D) + 708: 52(float) Load 128(c1) + 710: 7(f16vec4) ImageSampleImplicitLod 707 708 ConstOffset 709 + 711: 7(f16vec4) Load 706(texel) + 712: 7(f16vec4) FAdd 711 710 + Store 706(texel) 712 + 713: 123 Load 125(s1D) + 714:6(float16_t) Load 135(f16c1) + 715:6(float16_t) Load 137(f16bias) + 716: 7(f16vec4) ImageSampleImplicitLod 713 714 Bias ConstOffset 715 709 + 717: 7(f16vec4) Load 706(texel) + 718: 7(f16vec4) FAdd 717 716 + Store 706(texel) 718 + 719: 143 Load 145(s2D) + 720: 53(fvec2) Load 148(c2) + 723: 7(f16vec4) ImageSampleImplicitLod 719 720 ConstOffset 722 + 724: 7(f16vec4) Load 706(texel) + 725: 7(f16vec4) FAdd 724 723 + Store 706(texel) 725 + 726: 143 Load 145(s2D) + 727:154(f16vec2) Load 156(f16c2) + 728:6(float16_t) Load 137(f16bias) + 729: 7(f16vec4) ImageSampleImplicitLod 726 727 Bias ConstOffset 728 722 + 730: 7(f16vec4) Load 706(texel) + 731: 7(f16vec4) FAdd 730 729 + Store 706(texel) 731 + 732: 163 Load 165(s3D) + 733: 167(fvec3) Load 169(c3) + 736: 7(f16vec4) ImageSampleImplicitLod 732 733 ConstOffset 735 + 737: 7(f16vec4) Load 706(texel) + 738: 7(f16vec4) FAdd 737 736 + Store 706(texel) 738 + 739: 163 Load 165(s3D) + 740:175(f16vec3) Load 177(f16c3) + 741:6(float16_t) Load 137(f16bias) + 742: 7(f16vec4) ImageSampleImplicitLod 739 740 Bias ConstOffset 741 735 + 743: 7(f16vec4) Load 706(texel) + 744: 7(f16vec4) FAdd 743 742 + Store 706(texel) 744 + 745: 357 Load 359(s2DRect) + 746: 53(fvec2) Load 148(c2) + 747: 7(f16vec4) ImageSampleImplicitLod 745 746 ConstOffset 722 + 748: 7(f16vec4) Load 706(texel) + 749: 7(f16vec4) FAdd 748 747 + Store 706(texel) 749 + 750: 357 Load 359(s2DRect) + 751:154(f16vec2) Load 156(f16c2) + 752: 7(f16vec4) ImageSampleImplicitLod 750 751 ConstOffset 722 + 753: 7(f16vec4) Load 706(texel) + 754: 7(f16vec4) FAdd 753 752 + Store 706(texel) 754 + 755: 371 Load 373(s2DRectShadow) + 756: 167(fvec3) Load 169(c3) + 757: 52(float) CompositeExtract 756 2 + 758:6(float16_t) ImageSampleDrefImplicitLod 755 756 757 ConstOffset 722 + 759: 208(ptr) AccessChain 706(texel) 207 + 760:6(float16_t) Load 759 + 761:6(float16_t) FAdd 760 758 + 762: 208(ptr) AccessChain 706(texel) 207 + Store 762 761 + 763: 371 Load 373(s2DRectShadow) + 764:154(f16vec2) Load 156(f16c2) + 765: 52(float) Load 215(compare) + 766:6(float16_t) ImageSampleDrefImplicitLod 763 764 765 ConstOffset 722 + 767: 208(ptr) AccessChain 706(texel) 207 + 768:6(float16_t) Load 767 + 769:6(float16_t) FAdd 768 766 + 770: 208(ptr) AccessChain 706(texel) 207 + Store 770 769 + 771: 199 Load 201(s1DShadow) + 772: 167(fvec3) Load 169(c3) + 773: 52(float) CompositeExtract 772 2 + 774:6(float16_t) ImageSampleDrefImplicitLod 771 772 773 ConstOffset 709 + 775: 208(ptr) AccessChain 706(texel) 207 + 776:6(float16_t) Load 775 + 777:6(float16_t) FAdd 776 774 + 778: 208(ptr) AccessChain 706(texel) 207 + Store 778 777 + 779: 199 Load 201(s1DShadow) + 780:154(f16vec2) Load 156(f16c2) + 781: 52(float) Load 215(compare) + 782:6(float16_t) Load 137(f16bias) + 783:6(float16_t) ImageSampleDrefImplicitLod 779 780 781 Bias ConstOffset 782 709 + 784: 208(ptr) AccessChain 706(texel) 207 + 785:6(float16_t) Load 784 + 786:6(float16_t) FAdd 785 783 + 787: 208(ptr) AccessChain 706(texel) 207 + Store 787 786 + 788: 224 Load 226(s2DShadow) + 789: 167(fvec3) Load 169(c3) + 790: 52(float) CompositeExtract 789 2 + 791:6(float16_t) ImageSampleDrefImplicitLod 788 789 790 ConstOffset 722 + 792: 208(ptr) AccessChain 706(texel) 207 + 793:6(float16_t) Load 792 + 794:6(float16_t) FAdd 793 791 + 795: 208(ptr) AccessChain 706(texel) 207 + Store 795 794 + 796: 224 Load 226(s2DShadow) + 797:154(f16vec2) Load 156(f16c2) + 798: 52(float) Load 215(compare) + 799:6(float16_t) Load 137(f16bias) + 800:6(float16_t) ImageSampleDrefImplicitLod 796 797 798 Bias ConstOffset 799 722 + 801: 208(ptr) AccessChain 706(texel) 207 + 802:6(float16_t) Load 801 + 803:6(float16_t) FAdd 802 800 + 804: 208(ptr) AccessChain 706(texel) 207 + Store 804 803 + 805: 269 Load 271(s1DArray) + 806: 53(fvec2) Load 148(c2) + 807: 7(f16vec4) ImageSampleImplicitLod 805 806 ConstOffset 709 + 808: 7(f16vec4) Load 706(texel) + 809: 7(f16vec4) FAdd 808 807 + Store 706(texel) 809 + 810: 269 Load 271(s1DArray) + 811:154(f16vec2) Load 156(f16c2) + 812:6(float16_t) Load 137(f16bias) + 813: 7(f16vec4) ImageSampleImplicitLod 810 811 Bias ConstOffset 812 709 + 814: 7(f16vec4) Load 706(texel) + 815: 7(f16vec4) FAdd 814 813 + Store 706(texel) 815 + 816: 284 Load 286(s2DArray) + 817: 167(fvec3) Load 169(c3) + 818: 7(f16vec4) ImageSampleImplicitLod 816 817 ConstOffset 722 + 819: 7(f16vec4) Load 706(texel) + 820: 7(f16vec4) FAdd 819 818 + Store 706(texel) 820 + 821: 284 Load 286(s2DArray) + 822:175(f16vec3) Load 177(f16c3) + 823:6(float16_t) Load 137(f16bias) + 824: 7(f16vec4) ImageSampleImplicitLod 821 822 Bias ConstOffset 823 722 + 825: 7(f16vec4) Load 706(texel) + 826: 7(f16vec4) FAdd 825 824 + Store 706(texel) 826 + 827: 316 Load 318(s1DArrayShadow) + 828: 167(fvec3) Load 169(c3) + 829: 52(float) CompositeExtract 828 2 + 830:6(float16_t) ImageSampleDrefImplicitLod 827 828 829 ConstOffset 709 + 831: 208(ptr) AccessChain 706(texel) 207 + 832:6(float16_t) Load 831 + 833:6(float16_t) FAdd 832 830 + 834: 208(ptr) AccessChain 706(texel) 207 + Store 834 833 + 835: 316 Load 318(s1DArrayShadow) + 836:154(f16vec2) Load 156(f16c2) + 837: 52(float) Load 215(compare) + 838:6(float16_t) Load 137(f16bias) + 839:6(float16_t) ImageSampleDrefImplicitLod 835 836 837 Bias ConstOffset 838 709 + 840: 208(ptr) AccessChain 706(texel) 207 + 841:6(float16_t) Load 840 + 842:6(float16_t) FAdd 841 839 + 843: 208(ptr) AccessChain 706(texel) 207 + Store 843 842 + 844: 337 Load 339(s2DArrayShadow) + 845: 249(fvec4) Load 251(c4) + 846: 52(float) CompositeExtract 845 3 + 847:6(float16_t) ImageSampleDrefImplicitLod 844 845 846 ConstOffset 722 + 848: 208(ptr) AccessChain 706(texel) 207 + 849:6(float16_t) Load 848 + 850:6(float16_t) FAdd 849 847 + 851: 208(ptr) AccessChain 706(texel) 207 + Store 851 850 + 852: 337 Load 339(s2DArrayShadow) + 853:175(f16vec3) Load 177(f16c3) + 854: 52(float) Load 215(compare) + 855:6(float16_t) ImageSampleDrefImplicitLod 852 853 854 ConstOffset 722 + 856: 208(ptr) AccessChain 706(texel) 207 + 857:6(float16_t) Load 856 + 858:6(float16_t) FAdd 857 855 + 859: 208(ptr) AccessChain 706(texel) 207 + Store 859 858 + 860: 7(f16vec4) Load 706(texel) + ReturnValue 860 + FunctionEnd +17(testTextureProjOffset(): 7(f16vec4) Function None 8 + 18: Label + 863(texel): 64(ptr) Variable Function + Store 863(texel) 121 + 864: 123 Load 125(s1D) + 865: 53(fvec2) Load 148(c2) + 866: 7(f16vec4) ImageSampleProjImplicitLod 864 865 ConstOffset 709 + 867: 7(f16vec4) Load 863(texel) + 868: 7(f16vec4) FAdd 867 866 + Store 863(texel) 868 + 869: 123 Load 125(s1D) + 870:154(f16vec2) Load 156(f16c2) + 871:6(float16_t) Load 137(f16bias) + 872: 7(f16vec4) ImageSampleProjImplicitLod 869 870 Bias ConstOffset 871 709 + 873: 7(f16vec4) Load 863(texel) + 874: 7(f16vec4) FAdd 873 872 + Store 863(texel) 874 + 875: 123 Load 125(s1D) + 876: 249(fvec4) Load 251(c4) + 877: 52(float) CompositeExtract 876 3 + 878: 249(fvec4) CompositeInsert 877 876 1 + 879: 7(f16vec4) ImageSampleProjImplicitLod 875 878 ConstOffset 709 + 880: 7(f16vec4) Load 863(texel) + 881: 7(f16vec4) FAdd 880 879 + Store 863(texel) 881 + 882: 123 Load 125(s1D) + 883: 7(f16vec4) Load 309(f16c4) + 884:6(float16_t) Load 137(f16bias) + 885:6(float16_t) CompositeExtract 883 3 + 886: 7(f16vec4) CompositeInsert 885 883 1 + 887: 7(f16vec4) ImageSampleProjImplicitLod 882 886 Bias ConstOffset 884 709 + 888: 7(f16vec4) Load 863(texel) + 889: 7(f16vec4) FAdd 888 887 + Store 863(texel) 889 + 890: 143 Load 145(s2D) + 891: 167(fvec3) Load 169(c3) + 892: 7(f16vec4) ImageSampleProjImplicitLod 890 891 ConstOffset 722 + 893: 7(f16vec4) Load 863(texel) + 894: 7(f16vec4) FAdd 893 892 + Store 863(texel) 894 + 895: 143 Load 145(s2D) + 896:175(f16vec3) Load 177(f16c3) + 897:6(float16_t) Load 137(f16bias) + 898: 7(f16vec4) ImageSampleProjImplicitLod 895 896 Bias ConstOffset 897 722 + 899: 7(f16vec4) Load 863(texel) + 900: 7(f16vec4) FAdd 899 898 + Store 863(texel) 900 + 901: 143 Load 145(s2D) + 902: 249(fvec4) Load 251(c4) + 903: 52(float) CompositeExtract 902 3 + 904: 249(fvec4) CompositeInsert 903 902 2 + 905: 7(f16vec4) ImageSampleProjImplicitLod 901 904 ConstOffset 722 + 906: 7(f16vec4) Load 863(texel) + 907: 7(f16vec4) FAdd 906 905 + Store 863(texel) 907 + 908: 143 Load 145(s2D) + 909: 7(f16vec4) Load 309(f16c4) + 910:6(float16_t) Load 137(f16bias) + 911:6(float16_t) CompositeExtract 909 3 + 912: 7(f16vec4) CompositeInsert 911 909 2 + 913: 7(f16vec4) ImageSampleProjImplicitLod 908 912 Bias ConstOffset 910 722 + 914: 7(f16vec4) Load 863(texel) + 915: 7(f16vec4) FAdd 914 913 + Store 863(texel) 915 + 916: 163 Load 165(s3D) + 917: 249(fvec4) Load 251(c4) + 918: 7(f16vec4) ImageSampleProjImplicitLod 916 917 ConstOffset 735 + 919: 7(f16vec4) Load 863(texel) + 920: 7(f16vec4) FAdd 919 918 + Store 863(texel) 920 + 921: 163 Load 165(s3D) + 922: 7(f16vec4) Load 309(f16c4) + 923:6(float16_t) Load 137(f16bias) + 924: 7(f16vec4) ImageSampleProjImplicitLod 921 922 Bias ConstOffset 923 735 + 925: 7(f16vec4) Load 863(texel) + 926: 7(f16vec4) FAdd 925 924 + Store 863(texel) 926 + 927: 357 Load 359(s2DRect) + 928: 167(fvec3) Load 169(c3) + 929: 7(f16vec4) ImageSampleProjImplicitLod 927 928 ConstOffset 722 + 930: 7(f16vec4) Load 863(texel) + 931: 7(f16vec4) FAdd 930 929 + Store 863(texel) 931 + 932: 357 Load 359(s2DRect) + 933:175(f16vec3) Load 177(f16c3) + 934: 7(f16vec4) ImageSampleProjImplicitLod 932 933 ConstOffset 722 + 935: 7(f16vec4) Load 863(texel) + 936: 7(f16vec4) FAdd 935 934 + Store 863(texel) 936 + 937: 357 Load 359(s2DRect) + 938: 249(fvec4) Load 251(c4) + 939: 52(float) CompositeExtract 938 3 + 940: 249(fvec4) CompositeInsert 939 938 2 + 941: 7(f16vec4) ImageSampleProjImplicitLod 937 940 ConstOffset 722 + 942: 7(f16vec4) Load 863(texel) + 943: 7(f16vec4) FAdd 942 941 + Store 863(texel) 943 + 944: 357 Load 359(s2DRect) + 945: 7(f16vec4) Load 309(f16c4) + 946:6(float16_t) CompositeExtract 945 3 + 947: 7(f16vec4) CompositeInsert 946 945 2 + 948: 7(f16vec4) ImageSampleProjImplicitLod 944 947 ConstOffset 722 + 949: 7(f16vec4) Load 863(texel) + 950: 7(f16vec4) FAdd 949 948 + Store 863(texel) 950 + 951: 371 Load 373(s2DRectShadow) + 952: 249(fvec4) Load 251(c4) + 953: 52(float) CompositeExtract 952 2 + 954: 52(float) CompositeExtract 952 3 + 955: 249(fvec4) CompositeInsert 954 952 2 + 956:6(float16_t) ImageSampleProjDrefImplicitLod 951 955 953 ConstOffset 722 + 957: 208(ptr) AccessChain 863(texel) 207 + 958:6(float16_t) Load 957 + 959:6(float16_t) FAdd 958 956 + 960: 208(ptr) AccessChain 863(texel) 207 + Store 960 959 + 961: 371 Load 373(s2DRectShadow) + 962:175(f16vec3) Load 177(f16c3) + 963: 52(float) Load 215(compare) + 964:6(float16_t) ImageSampleProjDrefImplicitLod 961 962 963 ConstOffset 722 + 965: 208(ptr) AccessChain 863(texel) 207 + 966:6(float16_t) Load 965 + 967:6(float16_t) FAdd 966 964 + 968: 208(ptr) AccessChain 863(texel) 207 + Store 968 967 + 969: 199 Load 201(s1DShadow) + 970: 249(fvec4) Load 251(c4) + 971: 52(float) CompositeExtract 970 2 + 972: 52(float) CompositeExtract 970 3 + 973: 249(fvec4) CompositeInsert 972 970 1 + 974:6(float16_t) ImageSampleProjDrefImplicitLod 969 973 971 ConstOffset 709 + 975: 208(ptr) AccessChain 863(texel) 207 + 976:6(float16_t) Load 975 + 977:6(float16_t) FAdd 976 974 + 978: 208(ptr) AccessChain 863(texel) 207 + Store 978 977 + 979: 199 Load 201(s1DShadow) + 980:175(f16vec3) Load 177(f16c3) + 981: 52(float) Load 215(compare) + 982:6(float16_t) Load 137(f16bias) + 983:6(float16_t) CompositeExtract 980 2 + 984:175(f16vec3) CompositeInsert 983 980 1 + 985:6(float16_t) ImageSampleProjDrefImplicitLod 979 984 981 Bias ConstOffset 982 709 + 986: 208(ptr) AccessChain 863(texel) 207 + 987:6(float16_t) Load 986 + 988:6(float16_t) FAdd 987 985 + 989: 208(ptr) AccessChain 863(texel) 207 + Store 989 988 + 990: 224 Load 226(s2DShadow) + 991: 249(fvec4) Load 251(c4) + 992: 52(float) CompositeExtract 991 2 + 993: 52(float) CompositeExtract 991 3 + 994: 249(fvec4) CompositeInsert 993 991 2 + 995:6(float16_t) ImageSampleProjDrefImplicitLod 990 994 992 ConstOffset 722 + 996: 208(ptr) AccessChain 863(texel) 207 + 997:6(float16_t) Load 996 + 998:6(float16_t) FAdd 997 995 + 999: 208(ptr) AccessChain 863(texel) 207 + Store 999 998 + 1000: 224 Load 226(s2DShadow) + 1001:175(f16vec3) Load 177(f16c3) + 1002: 52(float) Load 215(compare) + 1003:6(float16_t) Load 137(f16bias) + 1004:6(float16_t) ImageSampleProjDrefImplicitLod 1000 1001 1002 Bias ConstOffset 1003 722 + 1005: 208(ptr) AccessChain 863(texel) 207 + 1006:6(float16_t) Load 1005 + 1007:6(float16_t) FAdd 1006 1004 + 1008: 208(ptr) AccessChain 863(texel) 207 + Store 1008 1007 + 1009: 7(f16vec4) Load 863(texel) + ReturnValue 1009 + FunctionEnd +19(testTextureLodOffset(): 7(f16vec4) Function None 8 + 20: Label + 1012(texel): 64(ptr) Variable Function + Store 1012(texel) 121 + 1013: 123 Load 125(s1D) + 1014: 52(float) Load 128(c1) + 1015: 52(float) Load 565(lod) + 1016: 7(f16vec4) ImageSampleExplicitLod 1013 1014 Lod ConstOffset 1015 709 + 1017: 7(f16vec4) Load 1012(texel) + 1018: 7(f16vec4) FAdd 1017 1016 + Store 1012(texel) 1018 + 1019: 123 Load 125(s1D) + 1020:6(float16_t) Load 135(f16c1) + 1021:6(float16_t) Load 572(f16lod) + 1022: 7(f16vec4) ImageSampleExplicitLod 1019 1020 Lod ConstOffset 1021 709 + 1023: 7(f16vec4) Load 1012(texel) + 1024: 7(f16vec4) FAdd 1023 1022 + Store 1012(texel) 1024 + 1025: 143 Load 145(s2D) + 1026: 53(fvec2) Load 148(c2) + 1027: 52(float) Load 565(lod) + 1028: 7(f16vec4) ImageSampleExplicitLod 1025 1026 Lod ConstOffset 1027 722 + 1029: 7(f16vec4) Load 1012(texel) + 1030: 7(f16vec4) FAdd 1029 1028 + Store 1012(texel) 1030 + 1031: 143 Load 145(s2D) + 1032:154(f16vec2) Load 156(f16c2) + 1033:6(float16_t) Load 572(f16lod) + 1034: 7(f16vec4) ImageSampleExplicitLod 1031 1032 Lod ConstOffset 1033 722 + 1035: 7(f16vec4) Load 1012(texel) + 1036: 7(f16vec4) FAdd 1035 1034 + Store 1012(texel) 1036 + 1037: 163 Load 165(s3D) + 1038: 167(fvec3) Load 169(c3) + 1039: 52(float) Load 565(lod) + 1040: 7(f16vec4) ImageSampleExplicitLod 1037 1038 Lod ConstOffset 1039 735 + 1041: 7(f16vec4) Load 1012(texel) + 1042: 7(f16vec4) FAdd 1041 1040 + Store 1012(texel) 1042 + 1043: 163 Load 165(s3D) + 1044:175(f16vec3) Load 177(f16c3) + 1045:6(float16_t) Load 572(f16lod) + 1046: 7(f16vec4) ImageSampleExplicitLod 1043 1044 Lod ConstOffset 1045 735 + 1047: 7(f16vec4) Load 1012(texel) + 1048: 7(f16vec4) FAdd 1047 1046 + Store 1012(texel) 1048 + 1049: 199 Load 201(s1DShadow) + 1050: 167(fvec3) Load 169(c3) + 1051: 52(float) Load 565(lod) + 1052: 52(float) CompositeExtract 1050 2 + 1053:6(float16_t) ImageSampleDrefExplicitLod 1049 1050 1052 Lod ConstOffset 1051 709 + 1054: 208(ptr) AccessChain 1012(texel) 207 + 1055:6(float16_t) Load 1054 + 1056:6(float16_t) FAdd 1055 1053 + 1057: 208(ptr) AccessChain 1012(texel) 207 + Store 1057 1056 + 1058: 199 Load 201(s1DShadow) + 1059:154(f16vec2) Load 156(f16c2) + 1060: 52(float) Load 215(compare) + 1061:6(float16_t) Load 572(f16lod) + 1062:6(float16_t) ImageSampleDrefExplicitLod 1058 1059 1060 Lod ConstOffset 1061 709 + 1063: 208(ptr) AccessChain 1012(texel) 207 + 1064:6(float16_t) Load 1063 + 1065:6(float16_t) FAdd 1064 1062 + 1066: 208(ptr) AccessChain 1012(texel) 207 + Store 1066 1065 + 1067: 224 Load 226(s2DShadow) + 1068: 167(fvec3) Load 169(c3) + 1069: 52(float) Load 565(lod) + 1070: 52(float) CompositeExtract 1068 2 + 1071:6(float16_t) ImageSampleDrefExplicitLod 1067 1068 1070 Lod ConstOffset 1069 722 + 1072: 208(ptr) AccessChain 1012(texel) 207 + 1073:6(float16_t) Load 1072 + 1074:6(float16_t) FAdd 1073 1071 + 1075: 208(ptr) AccessChain 1012(texel) 207 + Store 1075 1074 + 1076: 224 Load 226(s2DShadow) + 1077:154(f16vec2) Load 156(f16c2) + 1078: 52(float) Load 215(compare) + 1079:6(float16_t) Load 572(f16lod) + 1080:6(float16_t) ImageSampleDrefExplicitLod 1076 1077 1078 Lod ConstOffset 1079 722 + 1081: 208(ptr) AccessChain 1012(texel) 207 + 1082:6(float16_t) Load 1081 + 1083:6(float16_t) FAdd 1082 1080 + 1084: 208(ptr) AccessChain 1012(texel) 207 + Store 1084 1083 + 1085: 269 Load 271(s1DArray) + 1086: 53(fvec2) Load 148(c2) + 1087: 52(float) Load 565(lod) + 1088: 7(f16vec4) ImageSampleExplicitLod 1085 1086 Lod ConstOffset 1087 709 + 1089: 7(f16vec4) Load 1012(texel) + 1090: 7(f16vec4) FAdd 1089 1088 + Store 1012(texel) 1090 + 1091: 269 Load 271(s1DArray) + 1092:154(f16vec2) Load 156(f16c2) + 1093:6(float16_t) Load 572(f16lod) + 1094: 7(f16vec4) ImageSampleExplicitLod 1091 1092 Lod ConstOffset 1093 709 + 1095: 7(f16vec4) Load 1012(texel) + 1096: 7(f16vec4) FAdd 1095 1094 + Store 1012(texel) 1096 + 1097: 284 Load 286(s2DArray) + 1098: 167(fvec3) Load 169(c3) + 1099: 52(float) Load 565(lod) + 1100: 7(f16vec4) ImageSampleExplicitLod 1097 1098 Lod ConstOffset 1099 722 + 1101: 7(f16vec4) Load 1012(texel) + 1102: 7(f16vec4) FAdd 1101 1100 + Store 1012(texel) 1102 + 1103: 284 Load 286(s2DArray) + 1104:175(f16vec3) Load 177(f16c3) + 1105:6(float16_t) Load 572(f16lod) + 1106: 7(f16vec4) ImageSampleExplicitLod 1103 1104 Lod ConstOffset 1105 722 + 1107: 7(f16vec4) Load 1012(texel) + 1108: 7(f16vec4) FAdd 1107 1106 + Store 1012(texel) 1108 + 1109: 316 Load 318(s1DArrayShadow) + 1110: 167(fvec3) Load 169(c3) + 1111: 52(float) Load 565(lod) + 1112: 52(float) CompositeExtract 1110 2 + 1113:6(float16_t) ImageSampleDrefExplicitLod 1109 1110 1112 Lod ConstOffset 1111 709 + 1114: 208(ptr) AccessChain 1012(texel) 207 + 1115:6(float16_t) Load 1114 + 1116:6(float16_t) FAdd 1115 1113 + 1117: 208(ptr) AccessChain 1012(texel) 207 + Store 1117 1116 + 1118: 316 Load 318(s1DArrayShadow) + 1119:154(f16vec2) Load 156(f16c2) + 1120: 52(float) Load 215(compare) + 1121:6(float16_t) Load 572(f16lod) + 1122:6(float16_t) ImageSampleDrefExplicitLod 1118 1119 1120 Lod ConstOffset 1121 709 + 1123: 208(ptr) AccessChain 1012(texel) 207 + 1124:6(float16_t) Load 1123 + 1125:6(float16_t) FAdd 1124 1122 + 1126: 208(ptr) AccessChain 1012(texel) 207 + Store 1126 1125 + 1127: 7(f16vec4) Load 1012(texel) + ReturnValue 1127 + FunctionEnd +21(testTextureProjLodOffset(): 7(f16vec4) Function None 8 + 22: Label + 1130(texel): 64(ptr) Variable Function + Store 1130(texel) 121 + 1131: 123 Load 125(s1D) + 1132: 53(fvec2) Load 148(c2) + 1133: 52(float) Load 565(lod) + 1134: 7(f16vec4) ImageSampleProjExplicitLod 1131 1132 Lod ConstOffset 1133 709 + 1135: 7(f16vec4) Load 1130(texel) + 1136: 7(f16vec4) FAdd 1135 1134 + Store 1130(texel) 1136 + 1137: 123 Load 125(s1D) + 1138:154(f16vec2) Load 156(f16c2) + 1139:6(float16_t) Load 572(f16lod) + 1140: 7(f16vec4) ImageSampleProjExplicitLod 1137 1138 Lod ConstOffset 1139 709 + 1141: 7(f16vec4) Load 1130(texel) + 1142: 7(f16vec4) FAdd 1141 1140 + Store 1130(texel) 1142 + 1143: 123 Load 125(s1D) + 1144: 249(fvec4) Load 251(c4) + 1145: 52(float) Load 565(lod) + 1146: 52(float) CompositeExtract 1144 3 + 1147: 249(fvec4) CompositeInsert 1146 1144 1 + 1148: 7(f16vec4) ImageSampleProjExplicitLod 1143 1147 Lod ConstOffset 1145 709 + 1149: 7(f16vec4) Load 1130(texel) + 1150: 7(f16vec4) FAdd 1149 1148 + Store 1130(texel) 1150 + 1151: 123 Load 125(s1D) + 1152: 7(f16vec4) Load 309(f16c4) + 1153:6(float16_t) Load 572(f16lod) + 1154:6(float16_t) CompositeExtract 1152 3 + 1155: 7(f16vec4) CompositeInsert 1154 1152 1 + 1156: 7(f16vec4) ImageSampleProjExplicitLod 1151 1155 Lod ConstOffset 1153 709 + 1157: 7(f16vec4) Load 1130(texel) + 1158: 7(f16vec4) FAdd 1157 1156 + Store 1130(texel) 1158 + 1159: 143 Load 145(s2D) + 1160: 167(fvec3) Load 169(c3) + 1161: 52(float) Load 565(lod) + 1162: 7(f16vec4) ImageSampleProjExplicitLod 1159 1160 Lod ConstOffset 1161 722 + 1163: 7(f16vec4) Load 1130(texel) + 1164: 7(f16vec4) FAdd 1163 1162 + Store 1130(texel) 1164 + 1165: 143 Load 145(s2D) + 1166:175(f16vec3) Load 177(f16c3) + 1167:6(float16_t) Load 572(f16lod) + 1168: 7(f16vec4) ImageSampleProjExplicitLod 1165 1166 Lod ConstOffset 1167 722 + 1169: 7(f16vec4) Load 1130(texel) + 1170: 7(f16vec4) FAdd 1169 1168 + Store 1130(texel) 1170 + 1171: 143 Load 145(s2D) + 1172: 249(fvec4) Load 251(c4) + 1173: 52(float) Load 565(lod) + 1174: 52(float) CompositeExtract 1172 3 + 1175: 249(fvec4) CompositeInsert 1174 1172 2 + 1176: 7(f16vec4) ImageSampleProjExplicitLod 1171 1175 Lod ConstOffset 1173 722 + 1177: 7(f16vec4) Load 1130(texel) + 1178: 7(f16vec4) FAdd 1177 1176 + Store 1130(texel) 1178 + 1179: 143 Load 145(s2D) + 1180: 7(f16vec4) Load 309(f16c4) + 1181:6(float16_t) Load 572(f16lod) + 1182:6(float16_t) CompositeExtract 1180 3 + 1183: 7(f16vec4) CompositeInsert 1182 1180 2 + 1184: 7(f16vec4) ImageSampleProjExplicitLod 1179 1183 Lod ConstOffset 1181 722 + 1185: 7(f16vec4) Load 1130(texel) + 1186: 7(f16vec4) FAdd 1185 1184 + Store 1130(texel) 1186 + 1187: 163 Load 165(s3D) + 1188: 249(fvec4) Load 251(c4) + 1189: 52(float) Load 565(lod) + 1190: 7(f16vec4) ImageSampleProjExplicitLod 1187 1188 Lod ConstOffset 1189 735 + 1191: 7(f16vec4) Load 1130(texel) + 1192: 7(f16vec4) FAdd 1191 1190 + Store 1130(texel) 1192 + 1193: 163 Load 165(s3D) + 1194: 7(f16vec4) Load 309(f16c4) + 1195:6(float16_t) Load 572(f16lod) + 1196: 7(f16vec4) ImageSampleProjExplicitLod 1193 1194 Lod ConstOffset 1195 735 + 1197: 7(f16vec4) Load 1130(texel) + 1198: 7(f16vec4) FAdd 1197 1196 + Store 1130(texel) 1198 + 1199: 199 Load 201(s1DShadow) + 1200: 249(fvec4) Load 251(c4) + 1201: 52(float) Load 565(lod) + 1202: 52(float) CompositeExtract 1200 2 + 1203: 52(float) CompositeExtract 1200 3 + 1204: 249(fvec4) CompositeInsert 1203 1200 1 + 1205:6(float16_t) ImageSampleProjDrefExplicitLod 1199 1204 1202 Lod ConstOffset 1201 709 + 1206: 208(ptr) AccessChain 1130(texel) 207 + 1207:6(float16_t) Load 1206 + 1208:6(float16_t) FAdd 1207 1205 + 1209: 208(ptr) AccessChain 1130(texel) 207 + Store 1209 1208 + 1210: 199 Load 201(s1DShadow) + 1211:175(f16vec3) Load 177(f16c3) + 1212: 52(float) Load 215(compare) + 1213:6(float16_t) Load 572(f16lod) + 1214:6(float16_t) CompositeExtract 1211 2 + 1215:175(f16vec3) CompositeInsert 1214 1211 1 + 1216:6(float16_t) ImageSampleProjDrefExplicitLod 1210 1215 1212 Lod ConstOffset 1213 709 + 1217: 208(ptr) AccessChain 1130(texel) 207 + 1218:6(float16_t) Load 1217 + 1219:6(float16_t) FAdd 1218 1216 + 1220: 208(ptr) AccessChain 1130(texel) 207 + Store 1220 1219 + 1221: 224 Load 226(s2DShadow) + 1222: 249(fvec4) Load 251(c4) + 1223: 52(float) Load 565(lod) + 1224: 52(float) CompositeExtract 1222 2 + 1225: 52(float) CompositeExtract 1222 3 + 1226: 249(fvec4) CompositeInsert 1225 1222 2 + 1227:6(float16_t) ImageSampleProjDrefExplicitLod 1221 1226 1224 Lod ConstOffset 1223 722 + 1228: 208(ptr) AccessChain 1130(texel) 207 + 1229:6(float16_t) Load 1228 + 1230:6(float16_t) FAdd 1229 1227 + 1231: 208(ptr) AccessChain 1130(texel) 207 + Store 1231 1230 + 1232: 224 Load 226(s2DShadow) + 1233:175(f16vec3) Load 177(f16c3) + 1234: 52(float) Load 215(compare) + 1235:6(float16_t) Load 572(f16lod) + 1236:6(float16_t) ImageSampleProjDrefExplicitLod 1232 1233 1234 Lod ConstOffset 1235 722 + 1237: 208(ptr) AccessChain 1130(texel) 207 + 1238:6(float16_t) Load 1237 + 1239:6(float16_t) FAdd 1238 1236 + 1240: 208(ptr) AccessChain 1130(texel) 207 + Store 1240 1239 + 1241: 7(f16vec4) Load 1130(texel) + ReturnValue 1241 + FunctionEnd +23(testTexelFetch(): 7(f16vec4) Function None 8 + 24: Label + 1244(texel): 64(ptr) Variable Function + Store 1244(texel) 121 + 1245: 123 Load 125(s1D) + 1246: 52(float) Load 128(c1) + 1247: 47(int) ConvertFToS 1246 + 1248: 52(float) Load 565(lod) + 1249: 47(int) ConvertFToS 1248 + 1250: 122 Image 1245 + 1251: 7(f16vec4) ImageFetch 1250 1247 Lod 1249 + 1252: 7(f16vec4) Load 1244(texel) + 1253: 7(f16vec4) FAdd 1252 1251 + Store 1244(texel) 1253 + 1254: 143 Load 145(s2D) + 1255: 53(fvec2) Load 148(c2) + 1256: 721(ivec2) ConvertFToS 1255 + 1257: 52(float) Load 565(lod) + 1258: 47(int) ConvertFToS 1257 + 1259: 142 Image 1254 + 1260: 7(f16vec4) ImageFetch 1259 1256 Lod 1258 + 1261: 7(f16vec4) Load 1244(texel) + 1262: 7(f16vec4) FAdd 1261 1260 + Store 1244(texel) 1262 + 1263: 163 Load 165(s3D) + 1264: 167(fvec3) Load 169(c3) + 1265: 734(ivec3) ConvertFToS 1264 + 1266: 52(float) Load 565(lod) + 1267: 47(int) ConvertFToS 1266 + 1268: 162 Image 1263 + 1269: 7(f16vec4) ImageFetch 1268 1265 Lod 1267 + 1270: 7(f16vec4) Load 1244(texel) + 1271: 7(f16vec4) FAdd 1270 1269 + Store 1244(texel) 1271 + 1272: 357 Load 359(s2DRect) + 1273: 53(fvec2) Load 148(c2) + 1274: 721(ivec2) ConvertFToS 1273 + 1275: 356 Image 1272 + 1276: 7(f16vec4) ImageFetch 1275 1274 + 1277: 7(f16vec4) Load 1244(texel) + 1278: 7(f16vec4) FAdd 1277 1276 + Store 1244(texel) 1278 + 1279: 269 Load 271(s1DArray) + 1280: 53(fvec2) Load 148(c2) + 1281: 721(ivec2) ConvertFToS 1280 + 1282: 52(float) Load 565(lod) + 1283: 47(int) ConvertFToS 1282 + 1284: 268 Image 1279 + 1285: 7(f16vec4) ImageFetch 1284 1281 Lod 1283 + 1286: 7(f16vec4) Load 1244(texel) + 1287: 7(f16vec4) FAdd 1286 1285 + Store 1244(texel) 1287 + 1288: 284 Load 286(s2DArray) + 1289: 167(fvec3) Load 169(c3) + 1290: 734(ivec3) ConvertFToS 1289 + 1291: 52(float) Load 565(lod) + 1292: 47(int) ConvertFToS 1291 + 1293: 283 Image 1288 + 1294: 7(f16vec4) ImageFetch 1293 1290 Lod 1292 + 1295: 7(f16vec4) Load 1244(texel) + 1296: 7(f16vec4) FAdd 1295 1294 + Store 1244(texel) 1296 + 1301: 1298 Load 1300(sBuffer) + 1302: 52(float) Load 128(c1) + 1303: 47(int) ConvertFToS 1302 + 1304: 1297 Image 1301 + 1305: 7(f16vec4) ImageFetch 1304 1303 + 1306: 7(f16vec4) Load 1244(texel) + 1307: 7(f16vec4) FAdd 1306 1305 + Store 1244(texel) 1307 + 1312: 1309 Load 1311(s2DMS) + 1313: 53(fvec2) Load 148(c2) + 1314: 721(ivec2) ConvertFToS 1313 + 1315: 1308 Image 1312 + 1316: 7(f16vec4) ImageFetch 1315 1314 Sample 709 + 1317: 7(f16vec4) Load 1244(texel) + 1318: 7(f16vec4) FAdd 1317 1316 + Store 1244(texel) 1318 + 1323: 1320 Load 1322(s2DMSArray) + 1324: 167(fvec3) Load 169(c3) + 1325: 734(ivec3) ConvertFToS 1324 + 1327: 1319 Image 1323 + 1328: 7(f16vec4) ImageFetch 1327 1325 Sample 1326 + 1329: 7(f16vec4) Load 1244(texel) + 1330: 7(f16vec4) FAdd 1329 1328 + Store 1244(texel) 1330 + 1331: 7(f16vec4) Load 1244(texel) + ReturnValue 1331 + FunctionEnd +25(testTexelFetchOffset(): 7(f16vec4) Function None 8 + 26: Label + 1334(texel): 64(ptr) Variable Function + Store 1334(texel) 121 + 1335: 123 Load 125(s1D) + 1336: 52(float) Load 128(c1) + 1337: 47(int) ConvertFToS 1336 + 1338: 52(float) Load 565(lod) + 1339: 47(int) ConvertFToS 1338 + 1340: 122 Image 1335 + 1341: 7(f16vec4) ImageFetch 1340 1337 Lod ConstOffset 1339 709 + 1342: 7(f16vec4) Load 1334(texel) + 1343: 7(f16vec4) FAdd 1342 1341 + Store 1334(texel) 1343 + 1344: 143 Load 145(s2D) + 1345: 53(fvec2) Load 148(c2) + 1346: 721(ivec2) ConvertFToS 1345 + 1347: 52(float) Load 565(lod) + 1348: 47(int) ConvertFToS 1347 + 1349: 142 Image 1344 + 1350: 7(f16vec4) ImageFetch 1349 1346 Lod ConstOffset 1348 722 + 1351: 7(f16vec4) Load 1334(texel) + 1352: 7(f16vec4) FAdd 1351 1350 + Store 1334(texel) 1352 + 1353: 163 Load 165(s3D) + 1354: 167(fvec3) Load 169(c3) + 1355: 734(ivec3) ConvertFToS 1354 + 1356: 52(float) Load 565(lod) + 1357: 47(int) ConvertFToS 1356 + 1358: 162 Image 1353 + 1359: 7(f16vec4) ImageFetch 1358 1355 Lod ConstOffset 1357 735 + 1360: 7(f16vec4) Load 1334(texel) + 1361: 7(f16vec4) FAdd 1360 1359 + Store 1334(texel) 1361 + 1362: 357 Load 359(s2DRect) + 1363: 53(fvec2) Load 148(c2) + 1364: 721(ivec2) ConvertFToS 1363 + 1365: 356 Image 1362 + 1366: 7(f16vec4) ImageFetch 1365 1364 ConstOffset 722 + 1367: 7(f16vec4) Load 1334(texel) + 1368: 7(f16vec4) FAdd 1367 1366 + Store 1334(texel) 1368 + 1369: 269 Load 271(s1DArray) + 1370: 53(fvec2) Load 148(c2) + 1371: 721(ivec2) ConvertFToS 1370 + 1372: 52(float) Load 565(lod) + 1373: 47(int) ConvertFToS 1372 + 1374: 268 Image 1369 + 1375: 7(f16vec4) ImageFetch 1374 1371 Lod ConstOffset 1373 709 + 1376: 7(f16vec4) Load 1334(texel) + 1377: 7(f16vec4) FAdd 1376 1375 + Store 1334(texel) 1377 + 1378: 284 Load 286(s2DArray) + 1379: 167(fvec3) Load 169(c3) + 1380: 734(ivec3) ConvertFToS 1379 + 1381: 52(float) Load 565(lod) + 1382: 47(int) ConvertFToS 1381 + 1383: 283 Image 1378 + 1384: 7(f16vec4) ImageFetch 1383 1380 Lod ConstOffset 1382 722 + 1385: 7(f16vec4) Load 1334(texel) + 1386: 7(f16vec4) FAdd 1385 1384 + Store 1334(texel) 1386 + 1387: 7(f16vec4) Load 1334(texel) + ReturnValue 1387 + FunctionEnd +27(testTextureGrad(): 7(f16vec4) Function None 8 + 28: Label + 1390(texel): 64(ptr) Variable Function + Store 1390(texel) 121 + 1391: 123 Load 125(s1D) + 1392: 52(float) Load 128(c1) + 1394: 52(float) Load 1393(dPdxy1) + 1395: 52(float) Load 1393(dPdxy1) + 1396: 7(f16vec4) ImageSampleExplicitLod 1391 1392 Grad 1394 1395 + 1397: 7(f16vec4) Load 1390(texel) + 1398: 7(f16vec4) FAdd 1397 1396 + Store 1390(texel) 1398 + 1399: 123 Load 125(s1D) + 1400:6(float16_t) Load 135(f16c1) + 1402:6(float16_t) Load 1401(f16dPdxy1) + 1403:6(float16_t) Load 1401(f16dPdxy1) + 1404: 7(f16vec4) ImageSampleExplicitLod 1399 1400 Grad 1402 1403 + 1405: 7(f16vec4) Load 1390(texel) + 1406: 7(f16vec4) FAdd 1405 1404 + Store 1390(texel) 1406 + 1407: 143 Load 145(s2D) + 1408: 53(fvec2) Load 148(c2) + 1410: 53(fvec2) Load 1409(dPdxy2) + 1411: 53(fvec2) Load 1409(dPdxy2) + 1412: 7(f16vec4) ImageSampleExplicitLod 1407 1408 Grad 1410 1411 + 1413: 7(f16vec4) Load 1390(texel) + 1414: 7(f16vec4) FAdd 1413 1412 + Store 1390(texel) 1414 + 1415: 143 Load 145(s2D) + 1416:154(f16vec2) Load 156(f16c2) + 1418:154(f16vec2) Load 1417(f16dPdxy2) + 1419:154(f16vec2) Load 1417(f16dPdxy2) + 1420: 7(f16vec4) ImageSampleExplicitLod 1415 1416 Grad 1418 1419 + 1421: 7(f16vec4) Load 1390(texel) + 1422: 7(f16vec4) FAdd 1421 1420 + Store 1390(texel) 1422 + 1423: 163 Load 165(s3D) + 1424: 167(fvec3) Load 169(c3) + 1426: 167(fvec3) Load 1425(dPdxy3) + 1427: 167(fvec3) Load 1425(dPdxy3) + 1428: 7(f16vec4) ImageSampleExplicitLod 1423 1424 Grad 1426 1427 + 1429: 7(f16vec4) Load 1390(texel) + 1430: 7(f16vec4) FAdd 1429 1428 + Store 1390(texel) 1430 + 1431: 163 Load 165(s3D) + 1432:175(f16vec3) Load 177(f16c3) + 1434:175(f16vec3) Load 1433(f16dPdxy3) + 1435:175(f16vec3) Load 1433(f16dPdxy3) + 1436: 7(f16vec4) ImageSampleExplicitLod 1431 1432 Grad 1434 1435 + 1437: 7(f16vec4) Load 1390(texel) + 1438: 7(f16vec4) FAdd 1437 1436 + Store 1390(texel) 1438 + 1439: 184 Load 186(sCube) + 1440: 167(fvec3) Load 169(c3) + 1441: 167(fvec3) Load 1425(dPdxy3) + 1442: 167(fvec3) Load 1425(dPdxy3) + 1443: 7(f16vec4) ImageSampleExplicitLod 1439 1440 Grad 1441 1442 + 1444: 7(f16vec4) Load 1390(texel) + 1445: 7(f16vec4) FAdd 1444 1443 + Store 1390(texel) 1445 + 1446: 184 Load 186(sCube) + 1447:175(f16vec3) Load 177(f16c3) + 1448:175(f16vec3) Load 1433(f16dPdxy3) + 1449:175(f16vec3) Load 1433(f16dPdxy3) + 1450: 7(f16vec4) ImageSampleExplicitLod 1446 1447 Grad 1448 1449 + 1451: 7(f16vec4) Load 1390(texel) + 1452: 7(f16vec4) FAdd 1451 1450 + Store 1390(texel) 1452 + 1453: 357 Load 359(s2DRect) + 1454: 53(fvec2) Load 148(c2) + 1455: 53(fvec2) Load 1409(dPdxy2) + 1456: 53(fvec2) Load 1409(dPdxy2) + 1457: 7(f16vec4) ImageSampleExplicitLod 1453 1454 Grad 1455 1456 + 1458: 7(f16vec4) Load 1390(texel) + 1459: 7(f16vec4) FAdd 1458 1457 + Store 1390(texel) 1459 + 1460: 357 Load 359(s2DRect) + 1461:154(f16vec2) Load 156(f16c2) + 1462:154(f16vec2) Load 1417(f16dPdxy2) + 1463:154(f16vec2) Load 1417(f16dPdxy2) + 1464: 7(f16vec4) ImageSampleExplicitLod 1460 1461 Grad 1462 1463 + 1465: 7(f16vec4) Load 1390(texel) + 1466: 7(f16vec4) FAdd 1465 1464 + Store 1390(texel) 1466 + 1467: 371 Load 373(s2DRectShadow) + 1468: 167(fvec3) Load 169(c3) + 1469: 53(fvec2) Load 1409(dPdxy2) + 1470: 53(fvec2) Load 1409(dPdxy2) + 1471: 52(float) CompositeExtract 1468 2 + 1472:6(float16_t) ImageSampleDrefExplicitLod 1467 1468 1471 Grad 1469 1470 + 1473: 208(ptr) AccessChain 1390(texel) 207 + 1474:6(float16_t) Load 1473 + 1475:6(float16_t) FAdd 1474 1472 + 1476: 208(ptr) AccessChain 1390(texel) 207 + Store 1476 1475 + 1477: 371 Load 373(s2DRectShadow) + 1478:154(f16vec2) Load 156(f16c2) + 1479: 52(float) Load 215(compare) + 1480:154(f16vec2) Load 1417(f16dPdxy2) + 1481:154(f16vec2) Load 1417(f16dPdxy2) + 1482:6(float16_t) ImageSampleDrefExplicitLod 1477 1478 1479 Grad 1480 1481 + 1483: 208(ptr) AccessChain 1390(texel) 207 + 1484:6(float16_t) Load 1483 + 1485:6(float16_t) FAdd 1484 1482 + 1486: 208(ptr) AccessChain 1390(texel) 207 + Store 1486 1485 + 1487: 199 Load 201(s1DShadow) + 1488: 167(fvec3) Load 169(c3) + 1489: 52(float) Load 1393(dPdxy1) + 1490: 52(float) Load 1393(dPdxy1) + 1491: 52(float) CompositeExtract 1488 2 + 1492:6(float16_t) ImageSampleDrefExplicitLod 1487 1488 1491 Grad 1489 1490 + 1493: 208(ptr) AccessChain 1390(texel) 207 + 1494:6(float16_t) Load 1493 + 1495:6(float16_t) FAdd 1494 1492 + 1496: 208(ptr) AccessChain 1390(texel) 207 + Store 1496 1495 + 1497: 199 Load 201(s1DShadow) + 1498:154(f16vec2) Load 156(f16c2) + 1499: 52(float) Load 215(compare) + 1500:6(float16_t) Load 1401(f16dPdxy1) + 1501:6(float16_t) Load 1401(f16dPdxy1) + 1502:6(float16_t) ImageSampleDrefExplicitLod 1497 1498 1499 Grad 1500 1501 + 1503: 208(ptr) AccessChain 1390(texel) 207 + 1504:6(float16_t) Load 1503 + 1505:6(float16_t) FAdd 1504 1502 + 1506: 208(ptr) AccessChain 1390(texel) 207 + Store 1506 1505 + 1507: 224 Load 226(s2DShadow) + 1508: 167(fvec3) Load 169(c3) + 1509: 53(fvec2) Load 1409(dPdxy2) + 1510: 53(fvec2) Load 1409(dPdxy2) + 1511: 52(float) CompositeExtract 1508 2 + 1512:6(float16_t) ImageSampleDrefExplicitLod 1507 1508 1511 Grad 1509 1510 + 1513: 208(ptr) AccessChain 1390(texel) 207 + 1514:6(float16_t) Load 1513 + 1515:6(float16_t) FAdd 1514 1512 + 1516: 208(ptr) AccessChain 1390(texel) 207 + Store 1516 1515 + 1517: 224 Load 226(s2DShadow) + 1518:154(f16vec2) Load 156(f16c2) + 1519: 52(float) Load 215(compare) + 1520:154(f16vec2) Load 1417(f16dPdxy2) + 1521:154(f16vec2) Load 1417(f16dPdxy2) + 1522:6(float16_t) ImageSampleDrefExplicitLod 1517 1518 1519 Grad 1520 1521 + 1523: 208(ptr) AccessChain 1390(texel) 207 + 1524:6(float16_t) Load 1523 + 1525:6(float16_t) FAdd 1524 1522 + 1526: 208(ptr) AccessChain 1390(texel) 207 + Store 1526 1525 + 1527: 245 Load 247(sCubeShadow) + 1528: 249(fvec4) Load 251(c4) + 1529: 167(fvec3) Load 1425(dPdxy3) + 1530: 167(fvec3) Load 1425(dPdxy3) + 1531: 52(float) CompositeExtract 1528 3 + 1532:6(float16_t) ImageSampleDrefExplicitLod 1527 1528 1531 Grad 1529 1530 + 1533: 208(ptr) AccessChain 1390(texel) 207 + 1534:6(float16_t) Load 1533 + 1535:6(float16_t) FAdd 1534 1532 + 1536: 208(ptr) AccessChain 1390(texel) 207 + Store 1536 1535 + 1537: 245 Load 247(sCubeShadow) + 1538:175(f16vec3) Load 177(f16c3) + 1539: 52(float) Load 215(compare) + 1540:175(f16vec3) Load 1433(f16dPdxy3) + 1541:175(f16vec3) Load 1433(f16dPdxy3) + 1542:6(float16_t) ImageSampleDrefExplicitLod 1537 1538 1539 Grad 1540 1541 + 1543: 208(ptr) AccessChain 1390(texel) 207 + 1544:6(float16_t) Load 1543 + 1545:6(float16_t) FAdd 1544 1542 + 1546: 208(ptr) AccessChain 1390(texel) 207 + Store 1546 1545 + 1547: 269 Load 271(s1DArray) + 1548: 53(fvec2) Load 148(c2) + 1549: 52(float) Load 1393(dPdxy1) + 1550: 52(float) Load 1393(dPdxy1) + 1551: 7(f16vec4) ImageSampleExplicitLod 1547 1548 Grad 1549 1550 + 1552: 7(f16vec4) Load 1390(texel) + 1553: 7(f16vec4) FAdd 1552 1551 + Store 1390(texel) 1553 + 1554: 269 Load 271(s1DArray) + 1555:154(f16vec2) Load 156(f16c2) + 1556:6(float16_t) Load 1401(f16dPdxy1) + 1557:6(float16_t) Load 1401(f16dPdxy1) + 1558: 7(f16vec4) ImageSampleExplicitLod 1554 1555 Grad 1556 1557 + 1559: 7(f16vec4) Load 1390(texel) + 1560: 7(f16vec4) FAdd 1559 1558 + Store 1390(texel) 1560 + 1561: 284 Load 286(s2DArray) + 1562: 167(fvec3) Load 169(c3) + 1563: 53(fvec2) Load 1409(dPdxy2) + 1564: 53(fvec2) Load 1409(dPdxy2) + 1565: 7(f16vec4) ImageSampleExplicitLod 1561 1562 Grad 1563 1564 + 1566: 7(f16vec4) Load 1390(texel) + 1567: 7(f16vec4) FAdd 1566 1565 + Store 1390(texel) 1567 + 1568: 284 Load 286(s2DArray) + 1569:175(f16vec3) Load 177(f16c3) + 1570:154(f16vec2) Load 1417(f16dPdxy2) + 1571:154(f16vec2) Load 1417(f16dPdxy2) + 1572: 7(f16vec4) ImageSampleExplicitLod 1568 1569 Grad 1570 1571 + 1573: 7(f16vec4) Load 1390(texel) + 1574: 7(f16vec4) FAdd 1573 1572 + Store 1390(texel) 1574 + 1575: 316 Load 318(s1DArrayShadow) + 1576: 167(fvec3) Load 169(c3) + 1577: 52(float) Load 1393(dPdxy1) + 1578: 52(float) Load 1393(dPdxy1) + 1579: 52(float) CompositeExtract 1576 2 + 1580:6(float16_t) ImageSampleDrefExplicitLod 1575 1576 1579 Grad 1577 1578 + 1581: 208(ptr) AccessChain 1390(texel) 207 + 1582:6(float16_t) Load 1581 + 1583:6(float16_t) FAdd 1582 1580 + 1584: 208(ptr) AccessChain 1390(texel) 207 + Store 1584 1583 + 1585: 316 Load 318(s1DArrayShadow) + 1586:154(f16vec2) Load 156(f16c2) + 1587: 52(float) Load 215(compare) + 1588:6(float16_t) Load 1401(f16dPdxy1) + 1589:6(float16_t) Load 1401(f16dPdxy1) + 1590:6(float16_t) ImageSampleDrefExplicitLod 1585 1586 1587 Grad 1588 1589 + 1591: 208(ptr) AccessChain 1390(texel) 207 + 1592:6(float16_t) Load 1591 + 1593:6(float16_t) FAdd 1592 1590 + 1594: 208(ptr) AccessChain 1390(texel) 207 + Store 1594 1593 + 1595: 337 Load 339(s2DArrayShadow) + 1596: 249(fvec4) Load 251(c4) + 1597: 53(fvec2) Load 1409(dPdxy2) + 1598: 53(fvec2) Load 1409(dPdxy2) + 1599: 52(float) CompositeExtract 1596 3 + 1600:6(float16_t) ImageSampleDrefExplicitLod 1595 1596 1599 Grad 1597 1598 + 1601: 208(ptr) AccessChain 1390(texel) 207 + 1602:6(float16_t) Load 1601 + 1603:6(float16_t) FAdd 1602 1600 + 1604: 208(ptr) AccessChain 1390(texel) 207 + Store 1604 1603 + 1605: 337 Load 339(s2DArrayShadow) + 1606:175(f16vec3) Load 177(f16c3) + 1607: 52(float) Load 215(compare) + 1608:154(f16vec2) Load 1417(f16dPdxy2) + 1609:154(f16vec2) Load 1417(f16dPdxy2) + 1610:6(float16_t) ImageSampleDrefExplicitLod 1605 1606 1607 Grad 1608 1609 + 1611: 208(ptr) AccessChain 1390(texel) 207 + 1612:6(float16_t) Load 1611 + 1613:6(float16_t) FAdd 1612 1610 + 1614: 208(ptr) AccessChain 1390(texel) 207 + Store 1614 1613 + 1615: 299 Load 301(sCubeArray) + 1616: 249(fvec4) Load 251(c4) + 1617: 167(fvec3) Load 1425(dPdxy3) + 1618: 167(fvec3) Load 1425(dPdxy3) + 1619: 7(f16vec4) ImageSampleExplicitLod 1615 1616 Grad 1617 1618 + 1620: 7(f16vec4) Load 1390(texel) + 1621: 7(f16vec4) FAdd 1620 1619 + Store 1390(texel) 1621 + 1622: 299 Load 301(sCubeArray) + 1623: 7(f16vec4) Load 309(f16c4) + 1624:175(f16vec3) Load 1433(f16dPdxy3) + 1625:175(f16vec3) Load 1433(f16dPdxy3) + 1626: 7(f16vec4) ImageSampleExplicitLod 1622 1623 Grad 1624 1625 + 1627: 7(f16vec4) Load 1390(texel) + 1628: 7(f16vec4) FAdd 1627 1626 + Store 1390(texel) 1628 + 1629: 7(f16vec4) Load 1390(texel) + ReturnValue 1629 + FunctionEnd +29(testTextureGradOffset(): 7(f16vec4) Function None 8 + 30: Label + 1632(texel): 64(ptr) Variable Function + Store 1632(texel) 121 + 1633: 123 Load 125(s1D) + 1634: 52(float) Load 128(c1) + 1635: 52(float) Load 1393(dPdxy1) + 1636: 52(float) Load 1393(dPdxy1) + 1637: 7(f16vec4) ImageSampleExplicitLod 1633 1634 Grad ConstOffset 1635 1636 709 + 1638: 7(f16vec4) Load 1632(texel) + 1639: 7(f16vec4) FAdd 1638 1637 + Store 1632(texel) 1639 + 1640: 123 Load 125(s1D) + 1641:6(float16_t) Load 135(f16c1) + 1642:6(float16_t) Load 1401(f16dPdxy1) + 1643:6(float16_t) Load 1401(f16dPdxy1) + 1644: 7(f16vec4) ImageSampleExplicitLod 1640 1641 Grad ConstOffset 1642 1643 709 + 1645: 7(f16vec4) Load 1632(texel) + 1646: 7(f16vec4) FAdd 1645 1644 + Store 1632(texel) 1646 + 1647: 143 Load 145(s2D) + 1648: 53(fvec2) Load 148(c2) + 1649: 53(fvec2) Load 1409(dPdxy2) + 1650: 53(fvec2) Load 1409(dPdxy2) + 1651: 7(f16vec4) ImageSampleExplicitLod 1647 1648 Grad ConstOffset 1649 1650 722 + 1652: 7(f16vec4) Load 1632(texel) + 1653: 7(f16vec4) FAdd 1652 1651 + Store 1632(texel) 1653 + 1654: 143 Load 145(s2D) + 1655:154(f16vec2) Load 156(f16c2) + 1656:154(f16vec2) Load 1417(f16dPdxy2) + 1657:154(f16vec2) Load 1417(f16dPdxy2) + 1658: 7(f16vec4) ImageSampleExplicitLod 1654 1655 Grad ConstOffset 1656 1657 722 + 1659: 7(f16vec4) Load 1632(texel) + 1660: 7(f16vec4) FAdd 1659 1658 + Store 1632(texel) 1660 + 1661: 163 Load 165(s3D) + 1662: 167(fvec3) Load 169(c3) + 1663: 167(fvec3) Load 1425(dPdxy3) + 1664: 167(fvec3) Load 1425(dPdxy3) + 1665: 7(f16vec4) ImageSampleExplicitLod 1661 1662 Grad ConstOffset 1663 1664 735 + 1666: 7(f16vec4) Load 1632(texel) + 1667: 7(f16vec4) FAdd 1666 1665 + Store 1632(texel) 1667 + 1668: 163 Load 165(s3D) + 1669:175(f16vec3) Load 177(f16c3) + 1670:175(f16vec3) Load 1433(f16dPdxy3) + 1671:175(f16vec3) Load 1433(f16dPdxy3) + 1672: 7(f16vec4) ImageSampleExplicitLod 1668 1669 Grad ConstOffset 1670 1671 735 + 1673: 7(f16vec4) Load 1632(texel) + 1674: 7(f16vec4) FAdd 1673 1672 + Store 1632(texel) 1674 + 1675: 357 Load 359(s2DRect) + 1676: 53(fvec2) Load 148(c2) + 1677: 53(fvec2) Load 1409(dPdxy2) + 1678: 53(fvec2) Load 1409(dPdxy2) + 1679: 7(f16vec4) ImageSampleExplicitLod 1675 1676 Grad ConstOffset 1677 1678 722 + 1680: 7(f16vec4) Load 1632(texel) + 1681: 7(f16vec4) FAdd 1680 1679 + Store 1632(texel) 1681 + 1682: 357 Load 359(s2DRect) + 1683:154(f16vec2) Load 156(f16c2) + 1684:154(f16vec2) Load 1417(f16dPdxy2) + 1685:154(f16vec2) Load 1417(f16dPdxy2) + 1686: 7(f16vec4) ImageSampleExplicitLod 1682 1683 Grad ConstOffset 1684 1685 722 + 1687: 7(f16vec4) Load 1632(texel) + 1688: 7(f16vec4) FAdd 1687 1686 + Store 1632(texel) 1688 + 1689: 371 Load 373(s2DRectShadow) + 1690: 167(fvec3) Load 169(c3) + 1691: 53(fvec2) Load 1409(dPdxy2) + 1692: 53(fvec2) Load 1409(dPdxy2) + 1693: 52(float) CompositeExtract 1690 2 + 1694:6(float16_t) ImageSampleDrefExplicitLod 1689 1690 1693 Grad ConstOffset 1691 1692 722 + 1695: 208(ptr) AccessChain 1632(texel) 207 + 1696:6(float16_t) Load 1695 + 1697:6(float16_t) FAdd 1696 1694 + 1698: 208(ptr) AccessChain 1632(texel) 207 + Store 1698 1697 + 1699: 371 Load 373(s2DRectShadow) + 1700:154(f16vec2) Load 156(f16c2) + 1701: 52(float) Load 215(compare) + 1702:154(f16vec2) Load 1417(f16dPdxy2) + 1703:154(f16vec2) Load 1417(f16dPdxy2) + 1704:6(float16_t) ImageSampleDrefExplicitLod 1699 1700 1701 Grad ConstOffset 1702 1703 722 + 1705: 208(ptr) AccessChain 1632(texel) 207 + 1706:6(float16_t) Load 1705 + 1707:6(float16_t) FAdd 1706 1704 + 1708: 208(ptr) AccessChain 1632(texel) 207 + Store 1708 1707 + 1709: 199 Load 201(s1DShadow) + 1710: 167(fvec3) Load 169(c3) + 1711: 52(float) Load 1393(dPdxy1) + 1712: 52(float) Load 1393(dPdxy1) + 1713: 52(float) CompositeExtract 1710 2 + 1714:6(float16_t) ImageSampleDrefExplicitLod 1709 1710 1713 Grad ConstOffset 1711 1712 709 + 1715: 208(ptr) AccessChain 1632(texel) 207 + 1716:6(float16_t) Load 1715 + 1717:6(float16_t) FAdd 1716 1714 + 1718: 208(ptr) AccessChain 1632(texel) 207 + Store 1718 1717 + 1719: 199 Load 201(s1DShadow) + 1720:154(f16vec2) Load 156(f16c2) + 1721: 52(float) Load 215(compare) + 1722:6(float16_t) Load 1401(f16dPdxy1) + 1723:6(float16_t) Load 1401(f16dPdxy1) + 1724:6(float16_t) ImageSampleDrefExplicitLod 1719 1720 1721 Grad ConstOffset 1722 1723 709 + 1725: 208(ptr) AccessChain 1632(texel) 207 + 1726:6(float16_t) Load 1725 + 1727:6(float16_t) FAdd 1726 1724 + 1728: 208(ptr) AccessChain 1632(texel) 207 + Store 1728 1727 + 1729: 224 Load 226(s2DShadow) + 1730: 167(fvec3) Load 169(c3) + 1731: 53(fvec2) Load 1409(dPdxy2) + 1732: 53(fvec2) Load 1409(dPdxy2) + 1733: 52(float) CompositeExtract 1730 2 + 1734:6(float16_t) ImageSampleDrefExplicitLod 1729 1730 1733 Grad ConstOffset 1731 1732 722 + 1735: 208(ptr) AccessChain 1632(texel) 207 + 1736:6(float16_t) Load 1735 + 1737:6(float16_t) FAdd 1736 1734 + 1738: 208(ptr) AccessChain 1632(texel) 207 + Store 1738 1737 + 1739: 224 Load 226(s2DShadow) + 1740:154(f16vec2) Load 156(f16c2) + 1741: 52(float) Load 215(compare) + 1742:154(f16vec2) Load 1417(f16dPdxy2) + 1743:154(f16vec2) Load 1417(f16dPdxy2) + 1744:6(float16_t) ImageSampleDrefExplicitLod 1739 1740 1741 Grad ConstOffset 1742 1743 722 + 1745: 208(ptr) AccessChain 1632(texel) 207 + 1746:6(float16_t) Load 1745 + 1747:6(float16_t) FAdd 1746 1744 + 1748: 208(ptr) AccessChain 1632(texel) 207 + Store 1748 1747 + 1749: 269 Load 271(s1DArray) + 1750: 53(fvec2) Load 148(c2) + 1751: 52(float) Load 1393(dPdxy1) + 1752: 52(float) Load 1393(dPdxy1) + 1753: 7(f16vec4) ImageSampleExplicitLod 1749 1750 Grad ConstOffset 1751 1752 709 + 1754: 7(f16vec4) Load 1632(texel) + 1755: 7(f16vec4) FAdd 1754 1753 + Store 1632(texel) 1755 + 1756: 269 Load 271(s1DArray) + 1757:154(f16vec2) Load 156(f16c2) + 1758:6(float16_t) Load 1401(f16dPdxy1) + 1759:6(float16_t) Load 1401(f16dPdxy1) + 1760: 7(f16vec4) ImageSampleExplicitLod 1756 1757 Grad ConstOffset 1758 1759 709 + 1761: 7(f16vec4) Load 1632(texel) + 1762: 7(f16vec4) FAdd 1761 1760 + Store 1632(texel) 1762 + 1763: 284 Load 286(s2DArray) + 1764: 167(fvec3) Load 169(c3) + 1765: 53(fvec2) Load 1409(dPdxy2) + 1766: 53(fvec2) Load 1409(dPdxy2) + 1767: 7(f16vec4) ImageSampleExplicitLod 1763 1764 Grad ConstOffset 1765 1766 722 + 1768: 7(f16vec4) Load 1632(texel) + 1769: 7(f16vec4) FAdd 1768 1767 + Store 1632(texel) 1769 + 1770: 284 Load 286(s2DArray) + 1771:175(f16vec3) Load 177(f16c3) + 1772:154(f16vec2) Load 1417(f16dPdxy2) + 1773:154(f16vec2) Load 1417(f16dPdxy2) + 1774: 7(f16vec4) ImageSampleExplicitLod 1770 1771 Grad ConstOffset 1772 1773 722 + 1775: 7(f16vec4) Load 1632(texel) + 1776: 7(f16vec4) FAdd 1775 1774 + Store 1632(texel) 1776 + 1777: 316 Load 318(s1DArrayShadow) + 1778: 167(fvec3) Load 169(c3) + 1779: 52(float) Load 1393(dPdxy1) + 1780: 52(float) Load 1393(dPdxy1) + 1781: 52(float) CompositeExtract 1778 2 + 1782:6(float16_t) ImageSampleDrefExplicitLod 1777 1778 1781 Grad ConstOffset 1779 1780 709 + 1783: 208(ptr) AccessChain 1632(texel) 207 + 1784:6(float16_t) Load 1783 + 1785:6(float16_t) FAdd 1784 1782 + 1786: 208(ptr) AccessChain 1632(texel) 207 + Store 1786 1785 + 1787: 316 Load 318(s1DArrayShadow) + 1788:154(f16vec2) Load 156(f16c2) + 1789: 52(float) Load 215(compare) + 1790:6(float16_t) Load 1401(f16dPdxy1) + 1791:6(float16_t) Load 1401(f16dPdxy1) + 1792:6(float16_t) ImageSampleDrefExplicitLod 1787 1788 1789 Grad ConstOffset 1790 1791 709 + 1793: 208(ptr) AccessChain 1632(texel) 207 + 1794:6(float16_t) Load 1793 + 1795:6(float16_t) FAdd 1794 1792 + 1796: 208(ptr) AccessChain 1632(texel) 207 + Store 1796 1795 + 1797: 337 Load 339(s2DArrayShadow) + 1798: 249(fvec4) Load 251(c4) + 1799: 53(fvec2) Load 1409(dPdxy2) + 1800: 53(fvec2) Load 1409(dPdxy2) + 1801: 52(float) CompositeExtract 1798 3 + 1802:6(float16_t) ImageSampleDrefExplicitLod 1797 1798 1801 Grad ConstOffset 1799 1800 722 + 1803: 208(ptr) AccessChain 1632(texel) 207 + 1804:6(float16_t) Load 1803 + 1805:6(float16_t) FAdd 1804 1802 + 1806: 208(ptr) AccessChain 1632(texel) 207 + Store 1806 1805 + 1807: 337 Load 339(s2DArrayShadow) + 1808:175(f16vec3) Load 177(f16c3) + 1809: 52(float) Load 215(compare) + 1810:154(f16vec2) Load 1417(f16dPdxy2) + 1811:154(f16vec2) Load 1417(f16dPdxy2) + 1812:6(float16_t) ImageSampleDrefExplicitLod 1807 1808 1809 Grad ConstOffset 1810 1811 722 + 1813: 208(ptr) AccessChain 1632(texel) 207 + 1814:6(float16_t) Load 1813 + 1815:6(float16_t) FAdd 1814 1812 + 1816: 208(ptr) AccessChain 1632(texel) 207 + Store 1816 1815 + 1817: 7(f16vec4) Load 1632(texel) + ReturnValue 1817 + FunctionEnd +31(testTextureProjGrad(): 7(f16vec4) Function None 8 + 32: Label + 1820(texel): 64(ptr) Variable Function + Store 1820(texel) 121 + 1821: 123 Load 125(s1D) + 1822: 53(fvec2) Load 148(c2) + 1823: 52(float) Load 1393(dPdxy1) + 1824: 52(float) Load 1393(dPdxy1) + 1825: 7(f16vec4) ImageSampleProjExplicitLod 1821 1822 Grad 1823 1824 + 1826: 7(f16vec4) Load 1820(texel) + 1827: 7(f16vec4) FAdd 1826 1825 + Store 1820(texel) 1827 + 1828: 123 Load 125(s1D) + 1829:154(f16vec2) Load 156(f16c2) + 1830:6(float16_t) Load 1401(f16dPdxy1) + 1831:6(float16_t) Load 1401(f16dPdxy1) + 1832: 7(f16vec4) ImageSampleProjExplicitLod 1828 1829 Grad 1830 1831 + 1833: 7(f16vec4) Load 1820(texel) + 1834: 7(f16vec4) FAdd 1833 1832 + Store 1820(texel) 1834 + 1835: 123 Load 125(s1D) + 1836: 249(fvec4) Load 251(c4) + 1837: 52(float) Load 1393(dPdxy1) + 1838: 52(float) Load 1393(dPdxy1) + 1839: 52(float) CompositeExtract 1836 3 + 1840: 249(fvec4) CompositeInsert 1839 1836 1 + 1841: 7(f16vec4) ImageSampleProjExplicitLod 1835 1840 Grad 1837 1838 + 1842: 7(f16vec4) Load 1820(texel) + 1843: 7(f16vec4) FAdd 1842 1841 + Store 1820(texel) 1843 + 1844: 123 Load 125(s1D) + 1845: 7(f16vec4) Load 309(f16c4) + 1846:6(float16_t) Load 1401(f16dPdxy1) + 1847:6(float16_t) Load 1401(f16dPdxy1) + 1848:6(float16_t) CompositeExtract 1845 3 + 1849: 7(f16vec4) CompositeInsert 1848 1845 1 + 1850: 7(f16vec4) ImageSampleProjExplicitLod 1844 1849 Grad 1846 1847 + 1851: 7(f16vec4) Load 1820(texel) + 1852: 7(f16vec4) FAdd 1851 1850 + Store 1820(texel) 1852 + 1853: 143 Load 145(s2D) + 1854: 167(fvec3) Load 169(c3) + 1855: 53(fvec2) Load 1409(dPdxy2) + 1856: 53(fvec2) Load 1409(dPdxy2) + 1857: 7(f16vec4) ImageSampleProjExplicitLod 1853 1854 Grad 1855 1856 + 1858: 7(f16vec4) Load 1820(texel) + 1859: 7(f16vec4) FAdd 1858 1857 + Store 1820(texel) 1859 + 1860: 143 Load 145(s2D) + 1861:175(f16vec3) Load 177(f16c3) + 1862:154(f16vec2) Load 1417(f16dPdxy2) + 1863:154(f16vec2) Load 1417(f16dPdxy2) + 1864: 7(f16vec4) ImageSampleProjExplicitLod 1860 1861 Grad 1862 1863 + 1865: 7(f16vec4) Load 1820(texel) + 1866: 7(f16vec4) FAdd 1865 1864 + Store 1820(texel) 1866 + 1867: 143 Load 145(s2D) + 1868: 249(fvec4) Load 251(c4) + 1869: 53(fvec2) Load 1409(dPdxy2) + 1870: 53(fvec2) Load 1409(dPdxy2) + 1871: 52(float) CompositeExtract 1868 3 + 1872: 249(fvec4) CompositeInsert 1871 1868 2 + 1873: 7(f16vec4) ImageSampleProjExplicitLod 1867 1872 Grad 1869 1870 + 1874: 7(f16vec4) Load 1820(texel) + 1875: 7(f16vec4) FAdd 1874 1873 + Store 1820(texel) 1875 + 1876: 143 Load 145(s2D) + 1877: 7(f16vec4) Load 309(f16c4) + 1878:154(f16vec2) Load 1417(f16dPdxy2) + 1879:154(f16vec2) Load 1417(f16dPdxy2) + 1880:6(float16_t) CompositeExtract 1877 3 + 1881: 7(f16vec4) CompositeInsert 1880 1877 2 + 1882: 7(f16vec4) ImageSampleProjExplicitLod 1876 1881 Grad 1878 1879 + 1883: 7(f16vec4) Load 1820(texel) + 1884: 7(f16vec4) FAdd 1883 1882 + Store 1820(texel) 1884 + 1885: 163 Load 165(s3D) + 1886: 249(fvec4) Load 251(c4) + 1887: 167(fvec3) Load 1425(dPdxy3) + 1888: 167(fvec3) Load 1425(dPdxy3) + 1889: 7(f16vec4) ImageSampleProjExplicitLod 1885 1886 Grad 1887 1888 + 1890: 7(f16vec4) Load 1820(texel) + 1891: 7(f16vec4) FAdd 1890 1889 + Store 1820(texel) 1891 + 1892: 163 Load 165(s3D) + 1893: 7(f16vec4) Load 309(f16c4) + 1894:175(f16vec3) Load 1433(f16dPdxy3) + 1895:175(f16vec3) Load 1433(f16dPdxy3) + 1896: 7(f16vec4) ImageSampleProjExplicitLod 1892 1893 Grad 1894 1895 + 1897: 7(f16vec4) Load 1820(texel) + 1898: 7(f16vec4) FAdd 1897 1896 + Store 1820(texel) 1898 + 1899: 357 Load 359(s2DRect) + 1900: 167(fvec3) Load 169(c3) + 1901: 53(fvec2) Load 1409(dPdxy2) + 1902: 53(fvec2) Load 1409(dPdxy2) + 1903: 7(f16vec4) ImageSampleProjExplicitLod 1899 1900 Grad 1901 1902 + 1904: 7(f16vec4) Load 1820(texel) + 1905: 7(f16vec4) FAdd 1904 1903 + Store 1820(texel) 1905 + 1906: 357 Load 359(s2DRect) + 1907:175(f16vec3) Load 177(f16c3) + 1908:154(f16vec2) Load 1417(f16dPdxy2) + 1909:154(f16vec2) Load 1417(f16dPdxy2) + 1910: 7(f16vec4) ImageSampleProjExplicitLod 1906 1907 Grad 1908 1909 + 1911: 7(f16vec4) Load 1820(texel) + 1912: 7(f16vec4) FAdd 1911 1910 + Store 1820(texel) 1912 + 1913: 357 Load 359(s2DRect) + 1914: 249(fvec4) Load 251(c4) + 1915: 53(fvec2) Load 1409(dPdxy2) + 1916: 53(fvec2) Load 1409(dPdxy2) + 1917: 52(float) CompositeExtract 1914 3 + 1918: 249(fvec4) CompositeInsert 1917 1914 2 + 1919: 7(f16vec4) ImageSampleProjExplicitLod 1913 1918 Grad 1915 1916 + 1920: 7(f16vec4) Load 1820(texel) + 1921: 7(f16vec4) FAdd 1920 1919 + Store 1820(texel) 1921 + 1922: 357 Load 359(s2DRect) + 1923: 7(f16vec4) Load 309(f16c4) + 1924:154(f16vec2) Load 1417(f16dPdxy2) + 1925:154(f16vec2) Load 1417(f16dPdxy2) + 1926:6(float16_t) CompositeExtract 1923 3 + 1927: 7(f16vec4) CompositeInsert 1926 1923 2 + 1928: 7(f16vec4) ImageSampleProjExplicitLod 1922 1927 Grad 1924 1925 + 1929: 7(f16vec4) Load 1820(texel) + 1930: 7(f16vec4) FAdd 1929 1928 + Store 1820(texel) 1930 + 1931: 371 Load 373(s2DRectShadow) + 1932: 249(fvec4) Load 251(c4) + 1933: 53(fvec2) Load 1409(dPdxy2) + 1934: 53(fvec2) Load 1409(dPdxy2) + 1935: 52(float) CompositeExtract 1932 2 + 1936: 52(float) CompositeExtract 1932 3 + 1937: 249(fvec4) CompositeInsert 1936 1932 2 + 1938:6(float16_t) ImageSampleProjDrefExplicitLod 1931 1937 1935 Grad 1933 1934 + 1939: 208(ptr) AccessChain 1820(texel) 207 + 1940:6(float16_t) Load 1939 + 1941:6(float16_t) FAdd 1940 1938 + 1942: 208(ptr) AccessChain 1820(texel) 207 + Store 1942 1941 + 1943: 371 Load 373(s2DRectShadow) + 1944:175(f16vec3) Load 177(f16c3) + 1945: 52(float) Load 215(compare) + 1946:154(f16vec2) Load 1417(f16dPdxy2) + 1947:154(f16vec2) Load 1417(f16dPdxy2) + 1948:6(float16_t) ImageSampleProjDrefExplicitLod 1943 1944 1945 Grad 1946 1947 + 1949: 208(ptr) AccessChain 1820(texel) 207 + 1950:6(float16_t) Load 1949 + 1951:6(float16_t) FAdd 1950 1948 + 1952: 208(ptr) AccessChain 1820(texel) 207 + Store 1952 1951 + 1953: 199 Load 201(s1DShadow) + 1954: 249(fvec4) Load 251(c4) + 1955: 52(float) Load 1393(dPdxy1) + 1956: 52(float) Load 1393(dPdxy1) + 1957: 52(float) CompositeExtract 1954 2 + 1958: 52(float) CompositeExtract 1954 3 + 1959: 249(fvec4) CompositeInsert 1958 1954 1 + 1960:6(float16_t) ImageSampleProjDrefExplicitLod 1953 1959 1957 Grad 1955 1956 + 1961: 208(ptr) AccessChain 1820(texel) 207 + 1962:6(float16_t) Load 1961 + 1963:6(float16_t) FAdd 1962 1960 + 1964: 208(ptr) AccessChain 1820(texel) 207 + Store 1964 1963 + 1965: 199 Load 201(s1DShadow) + 1966:175(f16vec3) Load 177(f16c3) + 1967: 52(float) Load 215(compare) + 1968:6(float16_t) Load 1401(f16dPdxy1) + 1969:6(float16_t) Load 1401(f16dPdxy1) + 1970:6(float16_t) CompositeExtract 1966 2 + 1971:175(f16vec3) CompositeInsert 1970 1966 1 + 1972:6(float16_t) ImageSampleProjDrefExplicitLod 1965 1971 1967 Grad 1968 1969 + 1973: 208(ptr) AccessChain 1820(texel) 207 + 1974:6(float16_t) Load 1973 + 1975:6(float16_t) FAdd 1974 1972 + 1976: 208(ptr) AccessChain 1820(texel) 207 + Store 1976 1975 + 1977: 224 Load 226(s2DShadow) + 1978: 249(fvec4) Load 251(c4) + 1979: 53(fvec2) Load 1409(dPdxy2) + 1980: 53(fvec2) Load 1409(dPdxy2) + 1981: 52(float) CompositeExtract 1978 2 + 1982: 52(float) CompositeExtract 1978 3 + 1983: 249(fvec4) CompositeInsert 1982 1978 2 + 1984:6(float16_t) ImageSampleProjDrefExplicitLod 1977 1983 1981 Grad 1979 1980 + 1985: 208(ptr) AccessChain 1820(texel) 207 + 1986:6(float16_t) Load 1985 + 1987:6(float16_t) FAdd 1986 1984 + 1988: 208(ptr) AccessChain 1820(texel) 207 + Store 1988 1987 + 1989: 224 Load 226(s2DShadow) + 1990:175(f16vec3) Load 177(f16c3) + 1991: 52(float) Load 215(compare) + 1992:154(f16vec2) Load 1417(f16dPdxy2) + 1993:154(f16vec2) Load 1417(f16dPdxy2) + 1994:6(float16_t) ImageSampleProjDrefExplicitLod 1989 1990 1991 Grad 1992 1993 + 1995: 208(ptr) AccessChain 1820(texel) 207 + 1996:6(float16_t) Load 1995 + 1997:6(float16_t) FAdd 1996 1994 + 1998: 208(ptr) AccessChain 1820(texel) 207 + Store 1998 1997 + 1999: 7(f16vec4) Load 1820(texel) + ReturnValue 1999 + FunctionEnd +33(testTextureProjGradoffset(): 7(f16vec4) Function None 8 + 34: Label + 2002(texel): 64(ptr) Variable Function + Store 2002(texel) 121 + 2003: 123 Load 125(s1D) + 2004: 53(fvec2) Load 148(c2) + 2005: 52(float) Load 1393(dPdxy1) + 2006: 52(float) Load 1393(dPdxy1) + 2007: 7(f16vec4) ImageSampleProjExplicitLod 2003 2004 Grad ConstOffset 2005 2006 709 + 2008: 7(f16vec4) Load 2002(texel) + 2009: 7(f16vec4) FAdd 2008 2007 + Store 2002(texel) 2009 + 2010: 123 Load 125(s1D) + 2011:154(f16vec2) Load 156(f16c2) + 2012:6(float16_t) Load 1401(f16dPdxy1) + 2013:6(float16_t) Load 1401(f16dPdxy1) + 2014: 7(f16vec4) ImageSampleProjExplicitLod 2010 2011 Grad ConstOffset 2012 2013 709 + 2015: 7(f16vec4) Load 2002(texel) + 2016: 7(f16vec4) FAdd 2015 2014 + Store 2002(texel) 2016 + 2017: 123 Load 125(s1D) + 2018: 249(fvec4) Load 251(c4) + 2019: 52(float) Load 1393(dPdxy1) + 2020: 52(float) Load 1393(dPdxy1) + 2021: 52(float) CompositeExtract 2018 3 + 2022: 249(fvec4) CompositeInsert 2021 2018 1 + 2023: 7(f16vec4) ImageSampleProjExplicitLod 2017 2022 Grad ConstOffset 2019 2020 709 + 2024: 7(f16vec4) Load 2002(texel) + 2025: 7(f16vec4) FAdd 2024 2023 + Store 2002(texel) 2025 + 2026: 123 Load 125(s1D) + 2027: 7(f16vec4) Load 309(f16c4) + 2028:6(float16_t) Load 1401(f16dPdxy1) + 2029:6(float16_t) Load 1401(f16dPdxy1) + 2030:6(float16_t) CompositeExtract 2027 3 + 2031: 7(f16vec4) CompositeInsert 2030 2027 1 + 2032: 7(f16vec4) ImageSampleProjExplicitLod 2026 2031 Grad ConstOffset 2028 2029 709 + 2033: 7(f16vec4) Load 2002(texel) + 2034: 7(f16vec4) FAdd 2033 2032 + Store 2002(texel) 2034 + 2035: 143 Load 145(s2D) + 2036: 167(fvec3) Load 169(c3) + 2037: 53(fvec2) Load 1409(dPdxy2) + 2038: 53(fvec2) Load 1409(dPdxy2) + 2039: 7(f16vec4) ImageSampleProjExplicitLod 2035 2036 Grad ConstOffset 2037 2038 722 + 2040: 7(f16vec4) Load 2002(texel) + 2041: 7(f16vec4) FAdd 2040 2039 + Store 2002(texel) 2041 + 2042: 143 Load 145(s2D) + 2043:175(f16vec3) Load 177(f16c3) + 2044:154(f16vec2) Load 1417(f16dPdxy2) + 2045:154(f16vec2) Load 1417(f16dPdxy2) + 2046: 7(f16vec4) ImageSampleProjExplicitLod 2042 2043 Grad ConstOffset 2044 2045 722 + 2047: 7(f16vec4) Load 2002(texel) + 2048: 7(f16vec4) FAdd 2047 2046 + Store 2002(texel) 2048 + 2049: 143 Load 145(s2D) + 2050: 249(fvec4) Load 251(c4) + 2051: 53(fvec2) Load 1409(dPdxy2) + 2052: 53(fvec2) Load 1409(dPdxy2) + 2053: 52(float) CompositeExtract 2050 3 + 2054: 249(fvec4) CompositeInsert 2053 2050 2 + 2055: 7(f16vec4) ImageSampleProjExplicitLod 2049 2054 Grad ConstOffset 2051 2052 722 + 2056: 7(f16vec4) Load 2002(texel) + 2057: 7(f16vec4) FAdd 2056 2055 + Store 2002(texel) 2057 + 2058: 143 Load 145(s2D) + 2059: 7(f16vec4) Load 309(f16c4) + 2060:154(f16vec2) Load 1417(f16dPdxy2) + 2061:154(f16vec2) Load 1417(f16dPdxy2) + 2062:6(float16_t) CompositeExtract 2059 3 + 2063: 7(f16vec4) CompositeInsert 2062 2059 2 + 2064: 7(f16vec4) ImageSampleProjExplicitLod 2058 2063 Grad ConstOffset 2060 2061 722 + 2065: 7(f16vec4) Load 2002(texel) + 2066: 7(f16vec4) FAdd 2065 2064 + Store 2002(texel) 2066 + 2067: 357 Load 359(s2DRect) + 2068: 167(fvec3) Load 169(c3) + 2069: 53(fvec2) Load 1409(dPdxy2) + 2070: 53(fvec2) Load 1409(dPdxy2) + 2071: 7(f16vec4) ImageSampleProjExplicitLod 2067 2068 Grad ConstOffset 2069 2070 722 + 2072: 7(f16vec4) Load 2002(texel) + 2073: 7(f16vec4) FAdd 2072 2071 + Store 2002(texel) 2073 + 2074: 357 Load 359(s2DRect) + 2075:175(f16vec3) Load 177(f16c3) + 2076:154(f16vec2) Load 1417(f16dPdxy2) + 2077:154(f16vec2) Load 1417(f16dPdxy2) + 2078: 7(f16vec4) ImageSampleProjExplicitLod 2074 2075 Grad ConstOffset 2076 2077 722 + 2079: 7(f16vec4) Load 2002(texel) + 2080: 7(f16vec4) FAdd 2079 2078 + Store 2002(texel) 2080 + 2081: 357 Load 359(s2DRect) + 2082: 249(fvec4) Load 251(c4) + 2083: 53(fvec2) Load 1409(dPdxy2) + 2084: 53(fvec2) Load 1409(dPdxy2) + 2085: 52(float) CompositeExtract 2082 3 + 2086: 249(fvec4) CompositeInsert 2085 2082 2 + 2087: 7(f16vec4) ImageSampleProjExplicitLod 2081 2086 Grad ConstOffset 2083 2084 722 + 2088: 7(f16vec4) Load 2002(texel) + 2089: 7(f16vec4) FAdd 2088 2087 + Store 2002(texel) 2089 + 2090: 357 Load 359(s2DRect) + 2091: 7(f16vec4) Load 309(f16c4) + 2092:154(f16vec2) Load 1417(f16dPdxy2) + 2093:154(f16vec2) Load 1417(f16dPdxy2) + 2094:6(float16_t) CompositeExtract 2091 3 + 2095: 7(f16vec4) CompositeInsert 2094 2091 2 + 2096: 7(f16vec4) ImageSampleProjExplicitLod 2090 2095 Grad ConstOffset 2092 2093 722 + 2097: 7(f16vec4) Load 2002(texel) + 2098: 7(f16vec4) FAdd 2097 2096 + Store 2002(texel) 2098 + 2099: 371 Load 373(s2DRectShadow) + 2100: 249(fvec4) Load 251(c4) + 2101: 53(fvec2) Load 1409(dPdxy2) + 2102: 53(fvec2) Load 1409(dPdxy2) + 2103: 52(float) CompositeExtract 2100 2 + 2104: 52(float) CompositeExtract 2100 3 + 2105: 249(fvec4) CompositeInsert 2104 2100 2 + 2106:6(float16_t) ImageSampleProjDrefExplicitLod 2099 2105 2103 Grad ConstOffset 2101 2102 722 + 2107: 208(ptr) AccessChain 2002(texel) 207 + 2108:6(float16_t) Load 2107 + 2109:6(float16_t) FAdd 2108 2106 + 2110: 208(ptr) AccessChain 2002(texel) 207 + Store 2110 2109 + 2111: 371 Load 373(s2DRectShadow) + 2112:175(f16vec3) Load 177(f16c3) + 2113: 52(float) Load 215(compare) + 2114:154(f16vec2) Load 1417(f16dPdxy2) + 2115:154(f16vec2) Load 1417(f16dPdxy2) + 2116:6(float16_t) ImageSampleProjDrefExplicitLod 2111 2112 2113 Grad ConstOffset 2114 2115 722 + 2117: 208(ptr) AccessChain 2002(texel) 207 + 2118:6(float16_t) Load 2117 + 2119:6(float16_t) FAdd 2118 2116 + 2120: 208(ptr) AccessChain 2002(texel) 207 + Store 2120 2119 + 2121: 163 Load 165(s3D) + 2122: 249(fvec4) Load 251(c4) + 2123: 167(fvec3) Load 1425(dPdxy3) + 2124: 167(fvec3) Load 1425(dPdxy3) + 2125: 7(f16vec4) ImageSampleProjExplicitLod 2121 2122 Grad ConstOffset 2123 2124 735 + 2126: 7(f16vec4) Load 2002(texel) + 2127: 7(f16vec4) FAdd 2126 2125 + Store 2002(texel) 2127 + 2128: 163 Load 165(s3D) + 2129: 7(f16vec4) Load 309(f16c4) + 2130:175(f16vec3) Load 1433(f16dPdxy3) + 2131:175(f16vec3) Load 1433(f16dPdxy3) + 2132: 7(f16vec4) ImageSampleProjExplicitLod 2128 2129 Grad ConstOffset 2130 2131 735 + 2133: 7(f16vec4) Load 2002(texel) + 2134: 7(f16vec4) FAdd 2133 2132 + Store 2002(texel) 2134 + 2135: 199 Load 201(s1DShadow) + 2136: 249(fvec4) Load 251(c4) + 2137: 52(float) Load 1393(dPdxy1) + 2138: 52(float) Load 1393(dPdxy1) + 2139: 52(float) CompositeExtract 2136 2 + 2140: 52(float) CompositeExtract 2136 3 + 2141: 249(fvec4) CompositeInsert 2140 2136 1 + 2142:6(float16_t) ImageSampleProjDrefExplicitLod 2135 2141 2139 Grad ConstOffset 2137 2138 709 + 2143: 208(ptr) AccessChain 2002(texel) 207 + 2144:6(float16_t) Load 2143 + 2145:6(float16_t) FAdd 2144 2142 + 2146: 208(ptr) AccessChain 2002(texel) 207 + Store 2146 2145 + 2147: 199 Load 201(s1DShadow) + 2148:175(f16vec3) Load 177(f16c3) + 2149: 52(float) Load 215(compare) + 2150:6(float16_t) Load 1401(f16dPdxy1) + 2151:6(float16_t) Load 1401(f16dPdxy1) + 2152:6(float16_t) CompositeExtract 2148 2 + 2153:175(f16vec3) CompositeInsert 2152 2148 1 + 2154:6(float16_t) ImageSampleProjDrefExplicitLod 2147 2153 2149 Grad ConstOffset 2150 2151 709 + 2155: 208(ptr) AccessChain 2002(texel) 207 + 2156:6(float16_t) Load 2155 + 2157:6(float16_t) FAdd 2156 2154 + 2158: 208(ptr) AccessChain 2002(texel) 207 + Store 2158 2157 + 2159: 224 Load 226(s2DShadow) + 2160: 249(fvec4) Load 251(c4) + 2161: 53(fvec2) Load 1409(dPdxy2) + 2162: 53(fvec2) Load 1409(dPdxy2) + 2163: 52(float) CompositeExtract 2160 2 + 2164: 52(float) CompositeExtract 2160 3 + 2165: 249(fvec4) CompositeInsert 2164 2160 2 + 2166:6(float16_t) ImageSampleProjDrefExplicitLod 2159 2165 2163 Grad ConstOffset 2161 2162 722 + 2167: 208(ptr) AccessChain 2002(texel) 207 + 2168:6(float16_t) Load 2167 + 2169:6(float16_t) FAdd 2168 2166 + 2170: 208(ptr) AccessChain 2002(texel) 207 + Store 2170 2169 + 2171: 224 Load 226(s2DShadow) + 2172:175(f16vec3) Load 177(f16c3) + 2173: 52(float) Load 215(compare) + 2174:154(f16vec2) Load 1417(f16dPdxy2) + 2175:154(f16vec2) Load 1417(f16dPdxy2) + 2176:6(float16_t) ImageSampleProjDrefExplicitLod 2171 2172 2173 Grad ConstOffset 2174 2175 722 + 2177: 208(ptr) AccessChain 2002(texel) 207 + 2178:6(float16_t) Load 2177 + 2179:6(float16_t) FAdd 2178 2176 + 2180: 208(ptr) AccessChain 2002(texel) 207 + Store 2180 2179 + 2181: 7(f16vec4) Load 2002(texel) + ReturnValue 2181 + FunctionEnd +35(testTextureGather(): 7(f16vec4) Function None 8 + 36: Label + 2184(texel): 64(ptr) Variable Function + Store 2184(texel) 121 + 2185: 143 Load 145(s2D) + 2186: 53(fvec2) Load 148(c2) + 2188: 7(f16vec4) ImageGather 2185 2186 2187 + 2189: 7(f16vec4) Load 2184(texel) + 2190: 7(f16vec4) FAdd 2189 2188 + Store 2184(texel) 2190 + 2191: 143 Load 145(s2D) + 2192:154(f16vec2) Load 156(f16c2) + 2193:6(float16_t) Load 137(f16bias) + 2194: 7(f16vec4) ImageGather 2191 2192 2187 Bias 2193 + 2195: 7(f16vec4) Load 2184(texel) + 2196: 7(f16vec4) FAdd 2195 2194 + Store 2184(texel) 2196 + 2197: 284 Load 286(s2DArray) + 2198: 167(fvec3) Load 169(c3) + 2199: 7(f16vec4) ImageGather 2197 2198 2187 + 2200: 7(f16vec4) Load 2184(texel) + 2201: 7(f16vec4) FAdd 2200 2199 + Store 2184(texel) 2201 + 2202: 284 Load 286(s2DArray) + 2203:175(f16vec3) Load 177(f16c3) + 2204:6(float16_t) Load 137(f16bias) + 2205: 7(f16vec4) ImageGather 2202 2203 2187 Bias 2204 + 2206: 7(f16vec4) Load 2184(texel) + 2207: 7(f16vec4) FAdd 2206 2205 + Store 2184(texel) 2207 + 2208: 184 Load 186(sCube) + 2209: 167(fvec3) Load 169(c3) + 2210: 7(f16vec4) ImageGather 2208 2209 2187 + 2211: 7(f16vec4) Load 2184(texel) + 2212: 7(f16vec4) FAdd 2211 2210 + Store 2184(texel) 2212 + 2213: 184 Load 186(sCube) + 2214:175(f16vec3) Load 177(f16c3) + 2215:6(float16_t) Load 137(f16bias) + 2216: 7(f16vec4) ImageGather 2213 2214 2187 Bias 2215 + 2217: 7(f16vec4) Load 2184(texel) + 2218: 7(f16vec4) FAdd 2217 2216 + Store 2184(texel) 2218 + 2219: 299 Load 301(sCubeArray) + 2220: 249(fvec4) Load 251(c4) + 2221: 7(f16vec4) ImageGather 2219 2220 2187 + 2222: 7(f16vec4) Load 2184(texel) + 2223: 7(f16vec4) FAdd 2222 2221 + Store 2184(texel) 2223 + 2224: 299 Load 301(sCubeArray) + 2225: 7(f16vec4) Load 309(f16c4) + 2226:6(float16_t) Load 137(f16bias) + 2227: 7(f16vec4) ImageGather 2224 2225 2187 Bias 2226 + 2228: 7(f16vec4) Load 2184(texel) + 2229: 7(f16vec4) FAdd 2228 2227 + Store 2184(texel) 2229 + 2230: 357 Load 359(s2DRect) + 2231: 53(fvec2) Load 148(c2) + 2232: 7(f16vec4) ImageGather 2230 2231 2187 + 2233: 7(f16vec4) Load 2184(texel) + 2234: 7(f16vec4) FAdd 2233 2232 + Store 2184(texel) 2234 + 2235: 357 Load 359(s2DRect) + 2236:154(f16vec2) Load 156(f16c2) + 2237: 7(f16vec4) ImageGather 2235 2236 2187 + 2238: 7(f16vec4) Load 2184(texel) + 2239: 7(f16vec4) FAdd 2238 2237 + Store 2184(texel) 2239 + 2240: 224 Load 226(s2DShadow) + 2241: 53(fvec2) Load 148(c2) + 2242: 52(float) Load 215(compare) + 2243: 7(f16vec4) ImageDrefGather 2240 2241 2242 + 2244: 7(f16vec4) Load 2184(texel) + 2245: 7(f16vec4) FAdd 2244 2243 + Store 2184(texel) 2245 + 2246: 224 Load 226(s2DShadow) + 2247:154(f16vec2) Load 156(f16c2) + 2248: 52(float) Load 215(compare) + 2249: 7(f16vec4) ImageDrefGather 2246 2247 2248 + 2250: 7(f16vec4) Load 2184(texel) + 2251: 7(f16vec4) FAdd 2250 2249 + Store 2184(texel) 2251 + 2252: 337 Load 339(s2DArrayShadow) + 2253: 167(fvec3) Load 169(c3) + 2254: 52(float) Load 215(compare) + 2255: 7(f16vec4) ImageDrefGather 2252 2253 2254 + 2256: 7(f16vec4) Load 2184(texel) + 2257: 7(f16vec4) FAdd 2256 2255 + Store 2184(texel) 2257 + 2258: 337 Load 339(s2DArrayShadow) + 2259:175(f16vec3) Load 177(f16c3) + 2260: 52(float) Load 215(compare) + 2261: 7(f16vec4) ImageDrefGather 2258 2259 2260 + 2262: 7(f16vec4) Load 2184(texel) + 2263: 7(f16vec4) FAdd 2262 2261 + Store 2184(texel) 2263 + 2264: 245 Load 247(sCubeShadow) + 2265: 167(fvec3) Load 169(c3) + 2266: 52(float) Load 215(compare) + 2267: 7(f16vec4) ImageDrefGather 2264 2265 2266 + 2268: 7(f16vec4) Load 2184(texel) + 2269: 7(f16vec4) FAdd 2268 2267 + Store 2184(texel) 2269 + 2270: 245 Load 247(sCubeShadow) + 2271:175(f16vec3) Load 177(f16c3) + 2272: 52(float) Load 215(compare) + 2273: 7(f16vec4) ImageDrefGather 2270 2271 2272 + 2274: 7(f16vec4) Load 2184(texel) + 2275: 7(f16vec4) FAdd 2274 2273 + Store 2184(texel) 2275 + 2276: 391 Load 393(sCubeArrayShadow) + 2277: 249(fvec4) Load 251(c4) + 2278: 52(float) Load 215(compare) + 2279: 7(f16vec4) ImageDrefGather 2276 2277 2278 + 2280: 7(f16vec4) Load 2184(texel) + 2281: 7(f16vec4) FAdd 2280 2279 + Store 2184(texel) 2281 + 2282: 391 Load 393(sCubeArrayShadow) + 2283: 7(f16vec4) Load 309(f16c4) + 2284: 52(float) Load 215(compare) + 2285: 7(f16vec4) ImageDrefGather 2282 2283 2284 + 2286: 7(f16vec4) Load 2184(texel) + 2287: 7(f16vec4) FAdd 2286 2285 + Store 2184(texel) 2287 + 2288: 371 Load 373(s2DRectShadow) + 2289: 53(fvec2) Load 148(c2) + 2290: 52(float) Load 215(compare) + 2291: 7(f16vec4) ImageDrefGather 2288 2289 2290 + 2292: 7(f16vec4) Load 2184(texel) + 2293: 7(f16vec4) FAdd 2292 2291 + Store 2184(texel) 2293 + 2294: 371 Load 373(s2DRectShadow) + 2295:154(f16vec2) Load 156(f16c2) + 2296: 52(float) Load 215(compare) + 2297: 7(f16vec4) ImageDrefGather 2294 2295 2296 + 2298: 7(f16vec4) Load 2184(texel) + 2299: 7(f16vec4) FAdd 2298 2297 + Store 2184(texel) 2299 + 2300: 7(f16vec4) Load 2184(texel) + ReturnValue 2300 + FunctionEnd +37(testTextureGatherOffset(): 7(f16vec4) Function None 8 + 38: Label + 2303(texel): 64(ptr) Variable Function + Store 2303(texel) 121 + 2304: 143 Load 145(s2D) + 2305: 53(fvec2) Load 148(c2) + 2306: 7(f16vec4) ImageGather 2304 2305 2187 ConstOffset 722 + 2307: 7(f16vec4) Load 2303(texel) + 2308: 7(f16vec4) FAdd 2307 2306 + Store 2303(texel) 2308 + 2309: 143 Load 145(s2D) + 2310:154(f16vec2) Load 156(f16c2) + 2311:6(float16_t) Load 137(f16bias) + 2312: 7(f16vec4) ImageGather 2309 2310 2187 Bias ConstOffset 2311 722 + 2313: 7(f16vec4) Load 2303(texel) + 2314: 7(f16vec4) FAdd 2313 2312 + Store 2303(texel) 2314 + 2315: 284 Load 286(s2DArray) + 2316: 167(fvec3) Load 169(c3) + 2317: 7(f16vec4) ImageGather 2315 2316 2187 ConstOffset 722 + 2318: 7(f16vec4) Load 2303(texel) + 2319: 7(f16vec4) FAdd 2318 2317 + Store 2303(texel) 2319 + 2320: 284 Load 286(s2DArray) + 2321:175(f16vec3) Load 177(f16c3) + 2322:6(float16_t) Load 137(f16bias) + 2323: 7(f16vec4) ImageGather 2320 2321 2187 Bias ConstOffset 2322 722 + 2324: 7(f16vec4) Load 2303(texel) + 2325: 7(f16vec4) FAdd 2324 2323 + Store 2303(texel) 2325 + 2326: 357 Load 359(s2DRect) + 2327: 53(fvec2) Load 148(c2) + 2328: 7(f16vec4) ImageGather 2326 2327 2187 ConstOffset 722 + 2329: 7(f16vec4) Load 2303(texel) + 2330: 7(f16vec4) FAdd 2329 2328 + Store 2303(texel) 2330 + 2331: 357 Load 359(s2DRect) + 2332:154(f16vec2) Load 156(f16c2) + 2333: 7(f16vec4) ImageGather 2331 2332 2187 ConstOffset 722 + 2334: 7(f16vec4) Load 2303(texel) + 2335: 7(f16vec4) FAdd 2334 2333 + Store 2303(texel) 2335 + 2336: 224 Load 226(s2DShadow) + 2337: 53(fvec2) Load 148(c2) + 2338: 52(float) Load 215(compare) + 2339: 7(f16vec4) ImageDrefGather 2336 2337 2338 ConstOffset 722 + 2340: 7(f16vec4) Load 2303(texel) + 2341: 7(f16vec4) FAdd 2340 2339 + Store 2303(texel) 2341 + 2342: 224 Load 226(s2DShadow) + 2343:154(f16vec2) Load 156(f16c2) + 2344: 52(float) Load 215(compare) + 2345: 7(f16vec4) ImageDrefGather 2342 2343 2344 ConstOffset 722 + 2346: 7(f16vec4) Load 2303(texel) + 2347: 7(f16vec4) FAdd 2346 2345 + Store 2303(texel) 2347 + 2348: 337 Load 339(s2DArrayShadow) + 2349: 167(fvec3) Load 169(c3) + 2350: 52(float) Load 215(compare) + 2351: 7(f16vec4) ImageDrefGather 2348 2349 2350 ConstOffset 722 + 2352: 7(f16vec4) Load 2303(texel) + 2353: 7(f16vec4) FAdd 2352 2351 + Store 2303(texel) 2353 + 2354: 337 Load 339(s2DArrayShadow) + 2355:175(f16vec3) Load 177(f16c3) + 2356: 52(float) Load 215(compare) + 2357: 7(f16vec4) ImageDrefGather 2354 2355 2356 ConstOffset 722 + 2358: 7(f16vec4) Load 2303(texel) + 2359: 7(f16vec4) FAdd 2358 2357 + Store 2303(texel) 2359 + 2360: 371 Load 373(s2DRectShadow) + 2361: 53(fvec2) Load 148(c2) + 2362: 52(float) Load 215(compare) + 2363: 7(f16vec4) ImageDrefGather 2360 2361 2362 ConstOffset 722 + 2364: 7(f16vec4) Load 2303(texel) + 2365: 7(f16vec4) FAdd 2364 2363 + Store 2303(texel) 2365 + 2366: 371 Load 373(s2DRectShadow) + 2367:154(f16vec2) Load 156(f16c2) + 2368: 52(float) Load 215(compare) + 2369: 7(f16vec4) ImageDrefGather 2366 2367 2368 ConstOffset 722 + 2370: 7(f16vec4) Load 2303(texel) + 2371: 7(f16vec4) FAdd 2370 2369 + Store 2303(texel) 2371 + 2372: 7(f16vec4) Load 2303(texel) + ReturnValue 2372 + FunctionEnd +39(testTextureGatherOffsets(): 7(f16vec4) Function None 8 + 40: Label + 2375(texel): 64(ptr) Variable Function + Store 2375(texel) 121 + 2376: 143 Load 145(s2D) + 2377: 53(fvec2) Load 148(c2) + 2381: 7(f16vec4) ImageGather 2376 2377 2187 ConstOffsets 2380 + 2382: 7(f16vec4) Load 2375(texel) + 2383: 7(f16vec4) FAdd 2382 2381 + Store 2375(texel) 2383 + 2384: 143 Load 145(s2D) + 2385:154(f16vec2) Load 156(f16c2) + 2386:6(float16_t) Load 137(f16bias) + 2387: 7(f16vec4) ImageGather 2384 2385 2187 Bias ConstOffsets 2386 2380 + 2388: 7(f16vec4) Load 2375(texel) + 2389: 7(f16vec4) FAdd 2388 2387 + Store 2375(texel) 2389 + 2390: 284 Load 286(s2DArray) + 2391: 167(fvec3) Load 169(c3) + 2392: 7(f16vec4) ImageGather 2390 2391 2187 ConstOffsets 2380 + 2393: 7(f16vec4) Load 2375(texel) + 2394: 7(f16vec4) FAdd 2393 2392 + Store 2375(texel) 2394 + 2395: 284 Load 286(s2DArray) + 2396:175(f16vec3) Load 177(f16c3) + 2397:6(float16_t) Load 137(f16bias) + 2398: 7(f16vec4) ImageGather 2395 2396 2187 Bias ConstOffsets 2397 2380 + 2399: 7(f16vec4) Load 2375(texel) + 2400: 7(f16vec4) FAdd 2399 2398 + Store 2375(texel) 2400 + 2401: 357 Load 359(s2DRect) + 2402: 53(fvec2) Load 148(c2) + 2403: 7(f16vec4) ImageGather 2401 2402 2187 ConstOffsets 2380 + 2404: 7(f16vec4) Load 2375(texel) + 2405: 7(f16vec4) FAdd 2404 2403 + Store 2375(texel) 2405 + 2406: 357 Load 359(s2DRect) + 2407:154(f16vec2) Load 156(f16c2) + 2408: 7(f16vec4) ImageGather 2406 2407 2187 ConstOffsets 2380 + 2409: 7(f16vec4) Load 2375(texel) + 2410: 7(f16vec4) FAdd 2409 2408 + Store 2375(texel) 2410 + 2411: 224 Load 226(s2DShadow) + 2412: 53(fvec2) Load 148(c2) + 2413: 52(float) Load 215(compare) + 2414: 7(f16vec4) ImageDrefGather 2411 2412 2413 ConstOffsets 2380 + 2415: 7(f16vec4) Load 2375(texel) + 2416: 7(f16vec4) FAdd 2415 2414 + Store 2375(texel) 2416 + 2417: 224 Load 226(s2DShadow) + 2418:154(f16vec2) Load 156(f16c2) + 2419: 52(float) Load 215(compare) + 2420: 7(f16vec4) ImageDrefGather 2417 2418 2419 ConstOffsets 2380 + 2421: 7(f16vec4) Load 2375(texel) + 2422: 7(f16vec4) FAdd 2421 2420 + Store 2375(texel) 2422 + 2423: 337 Load 339(s2DArrayShadow) + 2424: 167(fvec3) Load 169(c3) + 2425: 52(float) Load 215(compare) + 2426: 7(f16vec4) ImageDrefGather 2423 2424 2425 ConstOffsets 2380 + 2427: 7(f16vec4) Load 2375(texel) + 2428: 7(f16vec4) FAdd 2427 2426 + Store 2375(texel) 2428 + 2429: 337 Load 339(s2DArrayShadow) + 2430:175(f16vec3) Load 177(f16c3) + 2431: 52(float) Load 215(compare) + 2432: 7(f16vec4) ImageDrefGather 2429 2430 2431 ConstOffsets 2380 + 2433: 7(f16vec4) Load 2375(texel) + 2434: 7(f16vec4) FAdd 2433 2432 + Store 2375(texel) 2434 + 2435: 371 Load 373(s2DRectShadow) + 2436: 53(fvec2) Load 148(c2) + 2437: 52(float) Load 215(compare) + 2438: 7(f16vec4) ImageDrefGather 2435 2436 2437 ConstOffsets 2380 + 2439: 7(f16vec4) Load 2375(texel) + 2440: 7(f16vec4) FAdd 2439 2438 + Store 2375(texel) 2440 + 2441: 371 Load 373(s2DRectShadow) + 2442:154(f16vec2) Load 156(f16c2) + 2443: 52(float) Load 215(compare) + 2444: 7(f16vec4) ImageDrefGather 2441 2442 2443 ConstOffsets 2380 + 2445: 7(f16vec4) Load 2375(texel) + 2446: 7(f16vec4) FAdd 2445 2444 + Store 2375(texel) 2446 + 2447: 7(f16vec4) Load 2375(texel) + ReturnValue 2447 + FunctionEnd +41(testTextureGatherLod(): 7(f16vec4) Function None 8 + 42: Label + 2450(texel): 64(ptr) Variable Function + Store 2450(texel) 121 + 2451: 143 Load 145(s2D) + 2452: 53(fvec2) Load 148(c2) + 2453: 52(float) Load 565(lod) + 2454: 7(f16vec4) ImageGather 2451 2452 2187 Lod 2453 + 2455: 7(f16vec4) Load 2450(texel) + 2456: 7(f16vec4) FAdd 2455 2454 + Store 2450(texel) 2456 + 2457: 143 Load 145(s2D) + 2458:154(f16vec2) Load 156(f16c2) + 2459:6(float16_t) Load 572(f16lod) + 2460: 7(f16vec4) ImageGather 2457 2458 2187 Lod 2459 + 2461: 7(f16vec4) Load 2450(texel) + 2462: 7(f16vec4) FAdd 2461 2460 + Store 2450(texel) 2462 + 2463: 284 Load 286(s2DArray) + 2464: 167(fvec3) Load 169(c3) + 2465: 52(float) Load 565(lod) + 2466: 7(f16vec4) ImageGather 2463 2464 2187 Lod 2465 + 2467: 7(f16vec4) Load 2450(texel) + 2468: 7(f16vec4) FAdd 2467 2466 + Store 2450(texel) 2468 + 2469: 284 Load 286(s2DArray) + 2470:175(f16vec3) Load 177(f16c3) + 2471:6(float16_t) Load 572(f16lod) + 2472: 7(f16vec4) ImageGather 2469 2470 2187 Lod 2471 + 2473: 7(f16vec4) Load 2450(texel) + 2474: 7(f16vec4) FAdd 2473 2472 + Store 2450(texel) 2474 + 2475: 184 Load 186(sCube) + 2476: 167(fvec3) Load 169(c3) + 2477: 52(float) Load 565(lod) + 2478: 7(f16vec4) ImageGather 2475 2476 2187 Lod 2477 + 2479: 7(f16vec4) Load 2450(texel) + 2480: 7(f16vec4) FAdd 2479 2478 + Store 2450(texel) 2480 + 2481: 184 Load 186(sCube) + 2482:175(f16vec3) Load 177(f16c3) + 2483:6(float16_t) Load 572(f16lod) + 2484: 7(f16vec4) ImageGather 2481 2482 2187 Lod 2483 + 2485: 7(f16vec4) Load 2450(texel) + 2486: 7(f16vec4) FAdd 2485 2484 + Store 2450(texel) 2486 + 2487: 299 Load 301(sCubeArray) + 2488: 249(fvec4) Load 251(c4) + 2489: 52(float) Load 565(lod) + 2490: 7(f16vec4) ImageGather 2487 2488 2187 Lod 2489 + 2491: 7(f16vec4) Load 2450(texel) + 2492: 7(f16vec4) FAdd 2491 2490 + Store 2450(texel) 2492 + 2493: 299 Load 301(sCubeArray) + 2494: 7(f16vec4) Load 309(f16c4) + 2495:6(float16_t) Load 572(f16lod) + 2496: 7(f16vec4) ImageGather 2493 2494 2187 Lod 2495 + 2497: 7(f16vec4) Load 2450(texel) + 2498: 7(f16vec4) FAdd 2497 2496 + Store 2450(texel) 2498 + 2499: 7(f16vec4) Load 2450(texel) + ReturnValue 2499 + FunctionEnd +43(testTextureGatherLodOffset(): 7(f16vec4) Function None 8 + 44: Label + 2502(texel): 64(ptr) Variable Function + Store 2502(texel) 121 + 2503: 143 Load 145(s2D) + 2504: 53(fvec2) Load 148(c2) + 2505: 52(float) Load 565(lod) + 2506: 7(f16vec4) ImageGather 2503 2504 2187 Lod ConstOffset 2505 722 + 2507: 7(f16vec4) Load 2502(texel) + 2508: 7(f16vec4) FAdd 2507 2506 + Store 2502(texel) 2508 + 2509: 143 Load 145(s2D) + 2510:154(f16vec2) Load 156(f16c2) + 2511:6(float16_t) Load 572(f16lod) + 2512: 7(f16vec4) ImageGather 2509 2510 2187 Lod ConstOffset 2511 722 + 2513: 7(f16vec4) Load 2502(texel) + 2514: 7(f16vec4) FAdd 2513 2512 + Store 2502(texel) 2514 + 2515: 284 Load 286(s2DArray) + 2516: 167(fvec3) Load 169(c3) + 2517: 52(float) Load 565(lod) + 2518: 7(f16vec4) ImageGather 2515 2516 2187 Lod ConstOffset 2517 722 + 2519: 7(f16vec4) Load 2502(texel) + 2520: 7(f16vec4) FAdd 2519 2518 + Store 2502(texel) 2520 + 2521: 284 Load 286(s2DArray) + 2522:175(f16vec3) Load 177(f16c3) + 2523:6(float16_t) Load 572(f16lod) + 2524: 7(f16vec4) ImageGather 2521 2522 2187 Lod ConstOffset 2523 722 + 2525: 7(f16vec4) Load 2502(texel) + 2526: 7(f16vec4) FAdd 2525 2524 + Store 2502(texel) 2526 + 2527: 7(f16vec4) Load 2502(texel) + ReturnValue 2527 + FunctionEnd +45(testTextureGatherLodOffsets(): 7(f16vec4) Function None 8 + 46: Label + 2530(texel): 64(ptr) Variable Function + Store 2530(texel) 121 + 2531: 143 Load 145(s2D) + 2532: 53(fvec2) Load 148(c2) + 2533: 52(float) Load 565(lod) + 2534: 7(f16vec4) ImageGather 2531 2532 2187 Lod ConstOffsets 2533 2380 + 2535: 7(f16vec4) Load 2530(texel) + 2536: 7(f16vec4) FAdd 2535 2534 + Store 2530(texel) 2536 + 2537: 143 Load 145(s2D) + 2538:154(f16vec2) Load 156(f16c2) + 2539:6(float16_t) Load 572(f16lod) + 2540: 7(f16vec4) ImageGather 2537 2538 2187 Lod ConstOffsets 2539 2380 + 2541: 7(f16vec4) Load 2530(texel) + 2542: 7(f16vec4) FAdd 2541 2540 + Store 2530(texel) 2542 + 2543: 284 Load 286(s2DArray) + 2544: 167(fvec3) Load 169(c3) + 2545: 52(float) Load 565(lod) + 2546: 7(f16vec4) ImageGather 2543 2544 2187 Lod ConstOffsets 2545 2380 + 2547: 7(f16vec4) Load 2530(texel) + 2548: 7(f16vec4) FAdd 2547 2546 + Store 2530(texel) 2548 + 2549: 284 Load 286(s2DArray) + 2550:175(f16vec3) Load 177(f16c3) + 2551:6(float16_t) Load 572(f16lod) + 2552: 7(f16vec4) ImageGather 2549 2550 2187 Lod ConstOffsets 2551 2380 + 2553: 7(f16vec4) Load 2530(texel) + 2554: 7(f16vec4) FAdd 2553 2552 + Store 2530(texel) 2554 + 2555: 7(f16vec4) Load 2530(texel) + ReturnValue 2555 + FunctionEnd +50(testTextureSize(): 48(ivec4) Function None 49 + 51: Label + 2559(size): 2558(ptr) Variable Function + Store 2559(size) 2560 + 2561: 123 Load 125(s1D) + 2562: 52(float) Load 565(lod) + 2563: 47(int) ConvertFToS 2562 + 2564: 122 Image 2561 + 2565: 47(int) ImageQuerySizeLod 2564 2563 + 2567: 2566(ptr) AccessChain 2559(size) 207 + 2568: 47(int) Load 2567 + 2569: 47(int) IAdd 2568 2565 + 2570: 2566(ptr) AccessChain 2559(size) 207 + Store 2570 2569 + 2571: 143 Load 145(s2D) + 2572: 52(float) Load 565(lod) + 2573: 47(int) ConvertFToS 2572 + 2574: 142 Image 2571 + 2575: 721(ivec2) ImageQuerySizeLod 2574 2573 + 2576: 48(ivec4) Load 2559(size) + 2577: 721(ivec2) VectorShuffle 2576 2576 0 1 + 2578: 721(ivec2) IAdd 2577 2575 + 2579: 48(ivec4) Load 2559(size) + 2580: 48(ivec4) VectorShuffle 2579 2578 4 5 2 3 + Store 2559(size) 2580 + 2581: 163 Load 165(s3D) + 2582: 52(float) Load 565(lod) + 2583: 47(int) ConvertFToS 2582 + 2584: 162 Image 2581 + 2585: 734(ivec3) ImageQuerySizeLod 2584 2583 + 2586: 48(ivec4) Load 2559(size) + 2587: 734(ivec3) VectorShuffle 2586 2586 0 1 2 + 2588: 734(ivec3) IAdd 2587 2585 + 2589: 48(ivec4) Load 2559(size) + 2590: 48(ivec4) VectorShuffle 2589 2588 4 5 6 3 + Store 2559(size) 2590 + 2591: 184 Load 186(sCube) + 2592: 52(float) Load 565(lod) + 2593: 47(int) ConvertFToS 2592 + 2594: 183 Image 2591 + 2595: 721(ivec2) ImageQuerySizeLod 2594 2593 + 2596: 48(ivec4) Load 2559(size) + 2597: 721(ivec2) VectorShuffle 2596 2596 0 1 + 2598: 721(ivec2) IAdd 2597 2595 + 2599: 48(ivec4) Load 2559(size) + 2600: 48(ivec4) VectorShuffle 2599 2598 4 5 2 3 + Store 2559(size) 2600 + 2601: 199 Load 201(s1DShadow) + 2602: 52(float) Load 565(lod) + 2603: 47(int) ConvertFToS 2602 + 2604: 198 Image 2601 + 2605: 47(int) ImageQuerySizeLod 2604 2603 + 2606: 2566(ptr) AccessChain 2559(size) 207 + 2607: 47(int) Load 2606 + 2608: 47(int) IAdd 2607 2605 + 2609: 2566(ptr) AccessChain 2559(size) 207 + Store 2609 2608 + 2610: 224 Load 226(s2DShadow) + 2611: 52(float) Load 565(lod) + 2612: 47(int) ConvertFToS 2611 + 2613: 223 Image 2610 + 2614: 721(ivec2) ImageQuerySizeLod 2613 2612 + 2615: 48(ivec4) Load 2559(size) + 2616: 721(ivec2) VectorShuffle 2615 2615 0 1 + 2617: 721(ivec2) IAdd 2616 2614 + 2618: 48(ivec4) Load 2559(size) + 2619: 48(ivec4) VectorShuffle 2618 2617 4 5 2 3 + Store 2559(size) 2619 + 2620: 245 Load 247(sCubeShadow) + 2621: 52(float) Load 565(lod) + 2622: 47(int) ConvertFToS 2621 + 2623: 244 Image 2620 + 2624: 721(ivec2) ImageQuerySizeLod 2623 2622 + 2625: 48(ivec4) Load 2559(size) + 2626: 721(ivec2) VectorShuffle 2625 2625 0 1 + 2627: 721(ivec2) IAdd 2626 2624 + 2628: 48(ivec4) Load 2559(size) + 2629: 48(ivec4) VectorShuffle 2628 2627 4 5 2 3 + Store 2559(size) 2629 + 2630: 299 Load 301(sCubeArray) + 2631: 52(float) Load 565(lod) + 2632: 47(int) ConvertFToS 2631 + 2633: 298 Image 2630 + 2634: 734(ivec3) ImageQuerySizeLod 2633 2632 + 2635: 48(ivec4) Load 2559(size) + 2636: 734(ivec3) VectorShuffle 2635 2635 0 1 2 + 2637: 734(ivec3) IAdd 2636 2634 + 2638: 48(ivec4) Load 2559(size) + 2639: 48(ivec4) VectorShuffle 2638 2637 4 5 6 3 + Store 2559(size) 2639 + 2640: 391 Load 393(sCubeArrayShadow) + 2641: 52(float) Load 565(lod) + 2642: 47(int) ConvertFToS 2641 + 2643: 390 Image 2640 + 2644: 734(ivec3) ImageQuerySizeLod 2643 2642 + 2645: 48(ivec4) Load 2559(size) + 2646: 734(ivec3) VectorShuffle 2645 2645 0 1 2 + 2647: 734(ivec3) IAdd 2646 2644 + 2648: 48(ivec4) Load 2559(size) + 2649: 48(ivec4) VectorShuffle 2648 2647 4 5 6 3 + Store 2559(size) 2649 + 2650: 357 Load 359(s2DRect) + 2651: 356 Image 2650 + 2652: 721(ivec2) ImageQuerySize 2651 + 2653: 48(ivec4) Load 2559(size) + 2654: 721(ivec2) VectorShuffle 2653 2653 0 1 + 2655: 721(ivec2) IAdd 2654 2652 + 2656: 48(ivec4) Load 2559(size) + 2657: 48(ivec4) VectorShuffle 2656 2655 4 5 2 3 + Store 2559(size) 2657 + 2658: 371 Load 373(s2DRectShadow) + 2659: 370 Image 2658 + 2660: 721(ivec2) ImageQuerySize 2659 + 2661: 48(ivec4) Load 2559(size) + 2662: 721(ivec2) VectorShuffle 2661 2661 0 1 + 2663: 721(ivec2) IAdd 2662 2660 + 2664: 48(ivec4) Load 2559(size) + 2665: 48(ivec4) VectorShuffle 2664 2663 4 5 2 3 + Store 2559(size) 2665 + 2666: 269 Load 271(s1DArray) + 2667: 52(float) Load 565(lod) + 2668: 47(int) ConvertFToS 2667 + 2669: 268 Image 2666 + 2670: 721(ivec2) ImageQuerySizeLod 2669 2668 + 2671: 48(ivec4) Load 2559(size) + 2672: 721(ivec2) VectorShuffle 2671 2671 0 1 + 2673: 721(ivec2) IAdd 2672 2670 + 2674: 48(ivec4) Load 2559(size) + 2675: 48(ivec4) VectorShuffle 2674 2673 4 5 2 3 + Store 2559(size) 2675 + 2676: 284 Load 286(s2DArray) + 2677: 52(float) Load 565(lod) + 2678: 47(int) ConvertFToS 2677 + 2679: 283 Image 2676 + 2680: 734(ivec3) ImageQuerySizeLod 2679 2678 + 2681: 48(ivec4) Load 2559(size) + 2682: 734(ivec3) VectorShuffle 2681 2681 0 1 2 + 2683: 734(ivec3) IAdd 2682 2680 + 2684: 48(ivec4) Load 2559(size) + 2685: 48(ivec4) VectorShuffle 2684 2683 4 5 6 3 + Store 2559(size) 2685 + 2686: 316 Load 318(s1DArrayShadow) + 2687: 52(float) Load 565(lod) + 2688: 47(int) ConvertFToS 2687 + 2689: 315 Image 2686 + 2690: 721(ivec2) ImageQuerySizeLod 2689 2688 + 2691: 48(ivec4) Load 2559(size) + 2692: 721(ivec2) VectorShuffle 2691 2691 0 1 + 2693: 721(ivec2) IAdd 2692 2690 + 2694: 48(ivec4) Load 2559(size) + 2695: 48(ivec4) VectorShuffle 2694 2693 4 5 2 3 + Store 2559(size) 2695 + 2696: 337 Load 339(s2DArrayShadow) + 2697: 52(float) Load 565(lod) + 2698: 47(int) ConvertFToS 2697 + 2699: 336 Image 2696 + 2700: 734(ivec3) ImageQuerySizeLod 2699 2698 + 2701: 48(ivec4) Load 2559(size) + 2702: 734(ivec3) VectorShuffle 2701 2701 0 1 2 + 2703: 734(ivec3) IAdd 2702 2700 + 2704: 48(ivec4) Load 2559(size) + 2705: 48(ivec4) VectorShuffle 2704 2703 4 5 6 3 + Store 2559(size) 2705 + 2706: 1298 Load 1300(sBuffer) + 2707: 1297 Image 2706 + 2708: 47(int) ImageQuerySize 2707 + 2709: 2566(ptr) AccessChain 2559(size) 207 + 2710: 47(int) Load 2709 + 2711: 47(int) IAdd 2710 2708 + 2712: 2566(ptr) AccessChain 2559(size) 207 + Store 2712 2711 + 2713: 1309 Load 1311(s2DMS) + 2714: 1308 Image 2713 + 2715: 721(ivec2) ImageQuerySize 2714 + 2716: 48(ivec4) Load 2559(size) + 2717: 721(ivec2) VectorShuffle 2716 2716 0 1 + 2718: 721(ivec2) IAdd 2717 2715 + 2719: 48(ivec4) Load 2559(size) + 2720: 48(ivec4) VectorShuffle 2719 2718 4 5 2 3 + Store 2559(size) 2720 + 2721: 1320 Load 1322(s2DMSArray) + 2722: 1319 Image 2721 + 2723: 734(ivec3) ImageQuerySize 2722 + 2724: 48(ivec4) Load 2559(size) + 2725: 734(ivec3) VectorShuffle 2724 2724 0 1 2 + 2726: 734(ivec3) IAdd 2725 2723 + 2727: 48(ivec4) Load 2559(size) + 2728: 48(ivec4) VectorShuffle 2727 2726 4 5 6 3 + Store 2559(size) 2728 + 2729: 48(ivec4) Load 2559(size) + ReturnValue 2729 + FunctionEnd +55(testTextureQueryLod(): 53(fvec2) Function None 54 + 56: Label + 2733(lod): 2732(ptr) Variable Function + Store 2733(lod) 2735 + 2736: 123 Load 125(s1D) + 2737: 52(float) Load 128(c1) + 2738: 53(fvec2) ImageQueryLod 2736 2737 + 2739: 53(fvec2) Load 2733(lod) + 2740: 53(fvec2) FAdd 2739 2738 + Store 2733(lod) 2740 + 2741: 123 Load 125(s1D) + 2742:6(float16_t) Load 135(f16c1) + 2743:154(f16vec2) ImageQueryLod 2741 2742 + 2744: 53(fvec2) Load 2733(lod) + 2745: 53(fvec2) FAdd 2744 2743 + Store 2733(lod) 2745 + 2746: 143 Load 145(s2D) + 2747: 53(fvec2) Load 148(c2) + 2748: 53(fvec2) ImageQueryLod 2746 2747 + 2749: 53(fvec2) Load 2733(lod) + 2750: 53(fvec2) FAdd 2749 2748 + Store 2733(lod) 2750 + 2751: 143 Load 145(s2D) + 2752:154(f16vec2) Load 156(f16c2) + 2753:154(f16vec2) ImageQueryLod 2751 2752 + 2754: 53(fvec2) Load 2733(lod) + 2755: 53(fvec2) FAdd 2754 2753 + Store 2733(lod) 2755 + 2756: 163 Load 165(s3D) + 2757: 167(fvec3) Load 169(c3) + 2758: 53(fvec2) ImageQueryLod 2756 2757 + 2759: 53(fvec2) Load 2733(lod) + 2760: 53(fvec2) FAdd 2759 2758 + Store 2733(lod) 2760 + 2761: 163 Load 165(s3D) + 2762:175(f16vec3) Load 177(f16c3) + 2763:154(f16vec2) ImageQueryLod 2761 2762 + 2764: 53(fvec2) Load 2733(lod) + 2765: 53(fvec2) FAdd 2764 2763 + Store 2733(lod) 2765 + 2766: 184 Load 186(sCube) + 2767: 167(fvec3) Load 169(c3) + 2768: 53(fvec2) ImageQueryLod 2766 2767 + 2769: 53(fvec2) Load 2733(lod) + 2770: 53(fvec2) FAdd 2769 2768 + Store 2733(lod) 2770 + 2771: 184 Load 186(sCube) + 2772:175(f16vec3) Load 177(f16c3) + 2773:154(f16vec2) ImageQueryLod 2771 2772 + 2774: 53(fvec2) Load 2733(lod) + 2775: 53(fvec2) FAdd 2774 2773 + Store 2733(lod) 2775 + 2776: 269 Load 271(s1DArray) + 2777: 52(float) Load 128(c1) + 2778: 53(fvec2) ImageQueryLod 2776 2777 + 2779: 53(fvec2) Load 2733(lod) + 2780: 53(fvec2) FAdd 2779 2778 + Store 2733(lod) 2780 + 2781: 269 Load 271(s1DArray) + 2782:6(float16_t) Load 135(f16c1) + 2783:154(f16vec2) ImageQueryLod 2781 2782 + 2784: 53(fvec2) Load 2733(lod) + 2785: 53(fvec2) FAdd 2784 2783 + Store 2733(lod) 2785 + 2786: 284 Load 286(s2DArray) + 2787: 53(fvec2) Load 148(c2) + 2788: 53(fvec2) ImageQueryLod 2786 2787 + 2789: 53(fvec2) Load 2733(lod) + 2790: 53(fvec2) FAdd 2789 2788 + Store 2733(lod) 2790 + 2791: 284 Load 286(s2DArray) + 2792:154(f16vec2) Load 156(f16c2) + 2793:154(f16vec2) ImageQueryLod 2791 2792 + 2794: 53(fvec2) Load 2733(lod) + 2795: 53(fvec2) FAdd 2794 2793 + Store 2733(lod) 2795 + 2796: 299 Load 301(sCubeArray) + 2797: 167(fvec3) Load 169(c3) + 2798: 53(fvec2) ImageQueryLod 2796 2797 + 2799: 53(fvec2) Load 2733(lod) + 2800: 53(fvec2) FAdd 2799 2798 + Store 2733(lod) 2800 + 2801: 299 Load 301(sCubeArray) + 2802:175(f16vec3) Load 177(f16c3) + 2803:154(f16vec2) ImageQueryLod 2801 2802 + 2804: 53(fvec2) Load 2733(lod) + 2805: 53(fvec2) FAdd 2804 2803 + Store 2733(lod) 2805 + 2806: 199 Load 201(s1DShadow) + 2807: 52(float) Load 128(c1) + 2808: 53(fvec2) ImageQueryLod 2806 2807 + 2809: 53(fvec2) Load 2733(lod) + 2810: 53(fvec2) FAdd 2809 2808 + Store 2733(lod) 2810 + 2811: 199 Load 201(s1DShadow) + 2812:6(float16_t) Load 135(f16c1) + 2813:154(f16vec2) ImageQueryLod 2811 2812 + 2814: 53(fvec2) Load 2733(lod) + 2815: 53(fvec2) FAdd 2814 2813 + Store 2733(lod) 2815 + 2816: 224 Load 226(s2DShadow) + 2817: 53(fvec2) Load 148(c2) + 2818: 53(fvec2) ImageQueryLod 2816 2817 + 2819: 53(fvec2) Load 2733(lod) + 2820: 53(fvec2) FAdd 2819 2818 + Store 2733(lod) 2820 + 2821: 224 Load 226(s2DShadow) + 2822:154(f16vec2) Load 156(f16c2) + 2823:154(f16vec2) ImageQueryLod 2821 2822 + 2824: 53(fvec2) Load 2733(lod) + 2825: 53(fvec2) FAdd 2824 2823 + Store 2733(lod) 2825 + 2826: 391 Load 393(sCubeArrayShadow) + 2827: 167(fvec3) Load 169(c3) + 2828: 53(fvec2) ImageQueryLod 2826 2827 + 2829: 53(fvec2) Load 2733(lod) + 2830: 53(fvec2) FAdd 2829 2828 + Store 2733(lod) 2830 + 2831: 391 Load 393(sCubeArrayShadow) + 2832:175(f16vec3) Load 177(f16c3) + 2833:154(f16vec2) ImageQueryLod 2831 2832 + 2834: 53(fvec2) Load 2733(lod) + 2835: 53(fvec2) FAdd 2834 2833 + Store 2733(lod) 2835 + 2836: 316 Load 318(s1DArrayShadow) + 2837: 52(float) Load 128(c1) + 2838: 53(fvec2) ImageQueryLod 2836 2837 + 2839: 53(fvec2) Load 2733(lod) + 2840: 53(fvec2) FAdd 2839 2838 + Store 2733(lod) 2840 + 2841: 316 Load 318(s1DArrayShadow) + 2842:6(float16_t) Load 135(f16c1) + 2843:154(f16vec2) ImageQueryLod 2841 2842 + 2844: 53(fvec2) Load 2733(lod) + 2845: 53(fvec2) FAdd 2844 2843 + Store 2733(lod) 2845 + 2846: 337 Load 339(s2DArrayShadow) + 2847: 53(fvec2) Load 148(c2) + 2848: 53(fvec2) ImageQueryLod 2846 2847 + 2849: 53(fvec2) Load 2733(lod) + 2850: 53(fvec2) FAdd 2849 2848 + Store 2733(lod) 2850 + 2851: 337 Load 339(s2DArrayShadow) + 2852:154(f16vec2) Load 156(f16c2) + 2853:154(f16vec2) ImageQueryLod 2851 2852 + 2854: 53(fvec2) Load 2733(lod) + 2855: 53(fvec2) FAdd 2854 2853 + Store 2733(lod) 2855 + 2856: 391 Load 393(sCubeArrayShadow) + 2857: 167(fvec3) Load 169(c3) + 2858: 53(fvec2) ImageQueryLod 2856 2857 + 2859: 53(fvec2) Load 2733(lod) + 2860: 53(fvec2) FAdd 2859 2858 + Store 2733(lod) 2860 + 2861: 391 Load 393(sCubeArrayShadow) + 2862:175(f16vec3) Load 177(f16c3) + 2863:154(f16vec2) ImageQueryLod 2861 2862 + 2864: 53(fvec2) Load 2733(lod) + 2865: 53(fvec2) FAdd 2864 2863 + Store 2733(lod) 2865 + 2866: 53(fvec2) Load 2733(lod) + ReturnValue 2866 + FunctionEnd +58(testTextureQueryLevels(): 47(int) Function None 57 + 59: Label + 2869(levels): 2566(ptr) Variable Function + Store 2869(levels) 2187 + 2870: 123 Load 125(s1D) + 2871: 122 Image 2870 + 2872: 47(int) ImageQueryLevels 2871 + 2873: 47(int) Load 2869(levels) + 2874: 47(int) IAdd 2873 2872 + Store 2869(levels) 2874 + 2875: 143 Load 145(s2D) + 2876: 142 Image 2875 + 2877: 47(int) ImageQueryLevels 2876 + 2878: 47(int) Load 2869(levels) + 2879: 47(int) IAdd 2878 2877 + Store 2869(levels) 2879 + 2880: 163 Load 165(s3D) + 2881: 162 Image 2880 + 2882: 47(int) ImageQueryLevels 2881 + 2883: 47(int) Load 2869(levels) + 2884: 47(int) IAdd 2883 2882 + Store 2869(levels) 2884 + 2885: 184 Load 186(sCube) + 2886: 183 Image 2885 + 2887: 47(int) ImageQueryLevels 2886 + 2888: 47(int) Load 2869(levels) + 2889: 47(int) IAdd 2888 2887 + Store 2869(levels) 2889 + 2890: 199 Load 201(s1DShadow) + 2891: 198 Image 2890 + 2892: 47(int) ImageQueryLevels 2891 + 2893: 47(int) Load 2869(levels) + 2894: 47(int) IAdd 2893 2892 + Store 2869(levels) 2894 + 2895: 224 Load 226(s2DShadow) + 2896: 223 Image 2895 + 2897: 47(int) ImageQueryLevels 2896 + 2898: 47(int) Load 2869(levels) + 2899: 47(int) IAdd 2898 2897 + Store 2869(levels) 2899 + 2900: 245 Load 247(sCubeShadow) + 2901: 244 Image 2900 + 2902: 47(int) ImageQueryLevels 2901 + 2903: 47(int) Load 2869(levels) + 2904: 47(int) IAdd 2903 2902 + Store 2869(levels) 2904 + 2905: 299 Load 301(sCubeArray) + 2906: 298 Image 2905 + 2907: 47(int) ImageQueryLevels 2906 + 2908: 47(int) Load 2869(levels) + 2909: 47(int) IAdd 2908 2907 + Store 2869(levels) 2909 + 2910: 391 Load 393(sCubeArrayShadow) + 2911: 390 Image 2910 + 2912: 47(int) ImageQueryLevels 2911 + 2913: 47(int) Load 2869(levels) + 2914: 47(int) IAdd 2913 2912 + Store 2869(levels) 2914 + 2915: 269 Load 271(s1DArray) + 2916: 268 Image 2915 + 2917: 47(int) ImageQueryLevels 2916 + 2918: 47(int) Load 2869(levels) + 2919: 47(int) IAdd 2918 2917 + Store 2869(levels) 2919 + 2920: 284 Load 286(s2DArray) + 2921: 283 Image 2920 + 2922: 47(int) ImageQueryLevels 2921 + 2923: 47(int) Load 2869(levels) + 2924: 47(int) IAdd 2923 2922 + Store 2869(levels) 2924 + 2925: 316 Load 318(s1DArrayShadow) + 2926: 315 Image 2925 + 2927: 47(int) ImageQueryLevels 2926 + 2928: 47(int) Load 2869(levels) + 2929: 47(int) IAdd 2928 2927 + Store 2869(levels) 2929 + 2930: 337 Load 339(s2DArrayShadow) + 2931: 336 Image 2930 + 2932: 47(int) ImageQueryLevels 2931 + 2933: 47(int) Load 2869(levels) + 2934: 47(int) IAdd 2933 2932 + Store 2869(levels) 2934 + 2935: 47(int) Load 2869(levels) + ReturnValue 2935 + FunctionEnd +60(testTextureSamples(): 47(int) Function None 57 + 61: Label + 2938(samples): 2566(ptr) Variable Function + Store 2938(samples) 2187 + 2939: 1309 Load 1311(s2DMS) + 2940: 1308 Image 2939 + 2941: 47(int) ImageQuerySamples 2940 + 2942: 47(int) Load 2938(samples) + 2943: 47(int) IAdd 2942 2941 + Store 2938(samples) 2943 + 2944: 1320 Load 1322(s2DMSArray) + 2945: 1319 Image 2944 + 2946: 47(int) ImageQuerySamples 2945 + 2947: 47(int) Load 2938(samples) + 2948: 47(int) IAdd 2947 2946 + Store 2938(samples) 2948 + 2949: 47(int) Load 2938(samples) + ReturnValue 2949 + FunctionEnd +62(testImageLoad(): 7(f16vec4) Function None 8 + 63: Label + 2952(texel): 64(ptr) Variable Function + Store 2952(texel) 121 + 2956: 2953 Load 2955(i1D) + 2957: 52(float) Load 128(c1) + 2958: 47(int) ConvertFToS 2957 + 2959: 7(f16vec4) ImageRead 2956 2958 + 2960: 7(f16vec4) Load 2952(texel) + 2961: 7(f16vec4) FAdd 2960 2959 + Store 2952(texel) 2961 + 2965: 2962 Load 2964(i2D) + 2966: 53(fvec2) Load 148(c2) + 2967: 721(ivec2) ConvertFToS 2966 + 2968: 7(f16vec4) ImageRead 2965 2967 + 2969: 7(f16vec4) Load 2952(texel) + 2970: 7(f16vec4) FAdd 2969 2968 + Store 2952(texel) 2970 + 2974: 2971 Load 2973(i3D) + 2975: 167(fvec3) Load 169(c3) + 2976: 734(ivec3) ConvertFToS 2975 + 2977: 7(f16vec4) ImageRead 2974 2976 + 2978: 7(f16vec4) Load 2952(texel) + 2979: 7(f16vec4) FAdd 2978 2977 + Store 2952(texel) 2979 + 2983: 2980 Load 2982(i2DRect) + 2984: 53(fvec2) Load 148(c2) + 2985: 721(ivec2) ConvertFToS 2984 + 2986: 7(f16vec4) ImageRead 2983 2985 + 2987: 7(f16vec4) Load 2952(texel) + 2988: 7(f16vec4) FAdd 2987 2986 + Store 2952(texel) 2988 + 2992: 2989 Load 2991(iCube) + 2993: 167(fvec3) Load 169(c3) + 2994: 734(ivec3) ConvertFToS 2993 + 2995: 7(f16vec4) ImageRead 2992 2994 + 2996: 7(f16vec4) Load 2952(texel) + 2997: 7(f16vec4) FAdd 2996 2995 + Store 2952(texel) 2997 + 3001: 2998 Load 3000(iBuffer) + 3002: 52(float) Load 128(c1) + 3003: 47(int) ConvertFToS 3002 + 3004: 7(f16vec4) ImageRead 3001 3003 + 3005: 7(f16vec4) Load 2952(texel) + 3006: 7(f16vec4) FAdd 3005 3004 + Store 2952(texel) 3006 + 3010: 3007 Load 3009(i1DArray) + 3011: 53(fvec2) Load 148(c2) + 3012: 721(ivec2) ConvertFToS 3011 + 3013: 7(f16vec4) ImageRead 3010 3012 + 3014: 7(f16vec4) Load 2952(texel) + 3015: 7(f16vec4) FAdd 3014 3013 + Store 2952(texel) 3015 + 3019: 3016 Load 3018(i2DArray) + 3020: 167(fvec3) Load 169(c3) + 3021: 734(ivec3) ConvertFToS 3020 + 3022: 7(f16vec4) ImageRead 3019 3021 + 3023: 7(f16vec4) Load 2952(texel) + 3024: 7(f16vec4) FAdd 3023 3022 + Store 2952(texel) 3024 + 3028: 3025 Load 3027(iCubeArray) + 3029: 167(fvec3) Load 169(c3) + 3030: 734(ivec3) ConvertFToS 3029 + 3031: 7(f16vec4) ImageRead 3028 3030 + 3032: 7(f16vec4) Load 2952(texel) + 3033: 7(f16vec4) FAdd 3032 3031 + Store 2952(texel) 3033 + 3037: 3034 Load 3036(i2DMS) + 3038: 53(fvec2) Load 148(c2) + 3039: 721(ivec2) ConvertFToS 3038 + 3040: 7(f16vec4) ImageRead 3037 3039 Sample 709 + 3041: 7(f16vec4) Load 2952(texel) + 3042: 7(f16vec4) FAdd 3041 3040 + Store 2952(texel) 3042 + 3046: 3043 Load 3045(i2DMSArray) + 3047: 167(fvec3) Load 169(c3) + 3048: 734(ivec3) ConvertFToS 3047 + 3049: 7(f16vec4) ImageRead 3046 3048 Sample 709 + 3050: 7(f16vec4) Load 2952(texel) + 3051: 7(f16vec4) FAdd 3050 3049 + Store 2952(texel) 3051 + 3052: 7(f16vec4) Load 2952(texel) + ReturnValue 3052 + FunctionEnd +67(testImageStore(vf164;): 2 Function None 65 + 66(data): 64(ptr) FunctionParameter + 68: Label + 3055: 2953 Load 2955(i1D) + 3056: 52(float) Load 128(c1) + 3057: 47(int) ConvertFToS 3056 + 3058: 7(f16vec4) Load 66(data) + ImageWrite 3055 3057 3058 + 3059: 2962 Load 2964(i2D) + 3060: 53(fvec2) Load 148(c2) + 3061: 721(ivec2) ConvertFToS 3060 + 3062: 7(f16vec4) Load 66(data) + ImageWrite 3059 3061 3062 + 3063: 2971 Load 2973(i3D) + 3064: 167(fvec3) Load 169(c3) + 3065: 734(ivec3) ConvertFToS 3064 + 3066: 7(f16vec4) Load 66(data) + ImageWrite 3063 3065 3066 + 3067: 2980 Load 2982(i2DRect) + 3068: 53(fvec2) Load 148(c2) + 3069: 721(ivec2) ConvertFToS 3068 + 3070: 7(f16vec4) Load 66(data) + ImageWrite 3067 3069 3070 + 3071: 2989 Load 2991(iCube) + 3072: 167(fvec3) Load 169(c3) + 3073: 734(ivec3) ConvertFToS 3072 + 3074: 7(f16vec4) Load 66(data) + ImageWrite 3071 3073 3074 + 3075: 2998 Load 3000(iBuffer) + 3076: 52(float) Load 128(c1) + 3077: 47(int) ConvertFToS 3076 + 3078: 7(f16vec4) Load 66(data) + ImageWrite 3075 3077 3078 + 3079: 3007 Load 3009(i1DArray) + 3080: 53(fvec2) Load 148(c2) + 3081: 721(ivec2) ConvertFToS 3080 + 3082: 7(f16vec4) Load 66(data) + ImageWrite 3079 3081 3082 + 3083: 3016 Load 3018(i2DArray) + 3084: 167(fvec3) Load 169(c3) + 3085: 734(ivec3) ConvertFToS 3084 + 3086: 7(f16vec4) Load 66(data) + ImageWrite 3083 3085 3086 + 3087: 3025 Load 3027(iCubeArray) + 3088: 167(fvec3) Load 169(c3) + 3089: 734(ivec3) ConvertFToS 3088 + 3090: 7(f16vec4) Load 66(data) + ImageWrite 3087 3089 3090 + 3091: 3034 Load 3036(i2DMS) + 3092: 53(fvec2) Load 148(c2) + 3093: 721(ivec2) ConvertFToS 3092 + 3094: 7(f16vec4) Load 66(data) + ImageWrite 3091 3093 3094 Sample 709 + 3095: 3043 Load 3045(i2DMSArray) + 3096: 167(fvec3) Load 169(c3) + 3097: 734(ivec3) ConvertFToS 3096 + 3098: 7(f16vec4) Load 66(data) + ImageWrite 3095 3097 3098 Sample 709 + Return + FunctionEnd +69(testSparseTexture(): 7(f16vec4) Function None 8 + 70: Label + 3099(texel): 64(ptr) Variable Function + Store 3099(texel) 121 + 3100: 143 Load 145(s2D) + 3101: 53(fvec2) Load 148(c2) + 3103:3102(ResType) ImageSparseSampleImplicitLod 3100 3101 + 3104: 7(f16vec4) CompositeExtract 3103 1 + Store 3099(texel) 3104 + 3105: 47(int) CompositeExtract 3103 0 + 3106: 143 Load 145(s2D) + 3107:154(f16vec2) Load 156(f16c2) + 3108:6(float16_t) Load 137(f16bias) + 3109:3102(ResType) ImageSparseSampleImplicitLod 3106 3107 Bias 3108 + 3110: 7(f16vec4) CompositeExtract 3109 1 + Store 3099(texel) 3110 + 3111: 47(int) CompositeExtract 3109 0 + 3112: 163 Load 165(s3D) + 3113: 167(fvec3) Load 169(c3) + 3114:3102(ResType) ImageSparseSampleImplicitLod 3112 3113 + 3115: 7(f16vec4) CompositeExtract 3114 1 + Store 3099(texel) 3115 + 3116: 47(int) CompositeExtract 3114 0 + 3117: 163 Load 165(s3D) + 3118:175(f16vec3) Load 177(f16c3) + 3119:6(float16_t) Load 137(f16bias) + 3120:3102(ResType) ImageSparseSampleImplicitLod 3117 3118 Bias 3119 + 3121: 7(f16vec4) CompositeExtract 3120 1 + Store 3099(texel) 3121 + 3122: 47(int) CompositeExtract 3120 0 + 3123: 184 Load 186(sCube) + 3124: 167(fvec3) Load 169(c3) + 3125:3102(ResType) ImageSparseSampleImplicitLod 3123 3124 + 3126: 7(f16vec4) CompositeExtract 3125 1 + Store 3099(texel) 3126 + 3127: 47(int) CompositeExtract 3125 0 + 3128: 184 Load 186(sCube) + 3129:175(f16vec3) Load 177(f16c3) + 3130:6(float16_t) Load 137(f16bias) + 3131:3102(ResType) ImageSparseSampleImplicitLod 3128 3129 Bias 3130 + 3132: 7(f16vec4) CompositeExtract 3131 1 + Store 3099(texel) 3132 + 3133: 47(int) CompositeExtract 3131 0 + 3134: 224 Load 226(s2DShadow) + 3135: 167(fvec3) Load 169(c3) + 3136: 208(ptr) AccessChain 3099(texel) 207 + 3137: 52(float) CompositeExtract 3135 2 + 3139:3138(ResType) ImageSparseSampleDrefImplicitLod 3134 3135 3137 + 3140:6(float16_t) CompositeExtract 3139 1 + Store 3136 3140 + 3141: 47(int) CompositeExtract 3139 0 + 3142: 224 Load 226(s2DShadow) + 3143:154(f16vec2) Load 156(f16c2) + 3144: 52(float) Load 215(compare) + 3145: 208(ptr) AccessChain 3099(texel) 207 + 3146:6(float16_t) Load 137(f16bias) + 3147:3138(ResType) ImageSparseSampleDrefImplicitLod 3142 3143 3144 Bias 3146 + 3148:6(float16_t) CompositeExtract 3147 1 + Store 3145 3148 + 3149: 47(int) CompositeExtract 3147 0 + 3150: 245 Load 247(sCubeShadow) + 3151: 249(fvec4) Load 251(c4) + 3152: 208(ptr) AccessChain 3099(texel) 207 + 3153: 52(float) CompositeExtract 3151 3 + 3154:3138(ResType) ImageSparseSampleDrefImplicitLod 3150 3151 3153 + 3155:6(float16_t) CompositeExtract 3154 1 + Store 3152 3155 + 3156: 47(int) CompositeExtract 3154 0 + 3157: 245 Load 247(sCubeShadow) + 3158:175(f16vec3) Load 177(f16c3) + 3159: 52(float) Load 215(compare) + 3160: 208(ptr) AccessChain 3099(texel) 207 + 3161:6(float16_t) Load 137(f16bias) + 3162:3138(ResType) ImageSparseSampleDrefImplicitLod 3157 3158 3159 Bias 3161 + 3163:6(float16_t) CompositeExtract 3162 1 + Store 3160 3163 + 3164: 47(int) CompositeExtract 3162 0 + 3165: 284 Load 286(s2DArray) + 3166: 167(fvec3) Load 169(c3) + 3167:3102(ResType) ImageSparseSampleImplicitLod 3165 3166 + 3168: 7(f16vec4) CompositeExtract 3167 1 + Store 3099(texel) 3168 + 3169: 47(int) CompositeExtract 3167 0 + 3170: 284 Load 286(s2DArray) + 3171:175(f16vec3) Load 177(f16c3) + 3172:6(float16_t) Load 137(f16bias) + 3173:3102(ResType) ImageSparseSampleImplicitLod 3170 3171 Bias 3172 + 3174: 7(f16vec4) CompositeExtract 3173 1 + Store 3099(texel) 3174 + 3175: 47(int) CompositeExtract 3173 0 + 3176: 299 Load 301(sCubeArray) + 3177: 249(fvec4) Load 251(c4) + 3178:3102(ResType) ImageSparseSampleImplicitLod 3176 3177 + 3179: 7(f16vec4) CompositeExtract 3178 1 + Store 3099(texel) 3179 + 3180: 47(int) CompositeExtract 3178 0 + 3181: 299 Load 301(sCubeArray) + 3182: 7(f16vec4) Load 309(f16c4) + 3183:6(float16_t) Load 137(f16bias) + 3184:3102(ResType) ImageSparseSampleImplicitLod 3181 3182 Bias 3183 + 3185: 7(f16vec4) CompositeExtract 3184 1 + Store 3099(texel) 3185 + 3186: 47(int) CompositeExtract 3184 0 + 3187: 337 Load 339(s2DArrayShadow) + 3188: 249(fvec4) Load 251(c4) + 3189: 208(ptr) AccessChain 3099(texel) 207 + 3190: 52(float) CompositeExtract 3188 3 + 3191:3138(ResType) ImageSparseSampleDrefImplicitLod 3187 3188 3190 + 3192:6(float16_t) CompositeExtract 3191 1 + Store 3189 3192 + 3193: 47(int) CompositeExtract 3191 0 + 3194: 337 Load 339(s2DArrayShadow) + 3195:175(f16vec3) Load 177(f16c3) + 3196: 52(float) Load 215(compare) + 3197: 208(ptr) AccessChain 3099(texel) 207 + 3198:3138(ResType) ImageSparseSampleDrefImplicitLod 3194 3195 3196 + 3199:6(float16_t) CompositeExtract 3198 1 + Store 3197 3199 + 3200: 47(int) CompositeExtract 3198 0 + 3201: 357 Load 359(s2DRect) + 3202: 53(fvec2) Load 148(c2) + 3203:3102(ResType) ImageSparseSampleImplicitLod 3201 3202 + 3204: 7(f16vec4) CompositeExtract 3203 1 + Store 3099(texel) 3204 + 3205: 47(int) CompositeExtract 3203 0 + 3206: 357 Load 359(s2DRect) + 3207:154(f16vec2) Load 156(f16c2) + 3208:3102(ResType) ImageSparseSampleImplicitLod 3206 3207 + 3209: 7(f16vec4) CompositeExtract 3208 1 + Store 3099(texel) 3209 + 3210: 47(int) CompositeExtract 3208 0 + 3211: 371 Load 373(s2DRectShadow) + 3212: 167(fvec3) Load 169(c3) + 3213: 208(ptr) AccessChain 3099(texel) 207 + 3214: 52(float) CompositeExtract 3212 2 + 3215:3138(ResType) ImageSparseSampleDrefImplicitLod 3211 3212 3214 + 3216:6(float16_t) CompositeExtract 3215 1 + Store 3213 3216 + 3217: 47(int) CompositeExtract 3215 0 + 3218: 371 Load 373(s2DRectShadow) + 3219:154(f16vec2) Load 156(f16c2) + 3220: 52(float) Load 215(compare) + 3221: 208(ptr) AccessChain 3099(texel) 207 + 3222:3138(ResType) ImageSparseSampleDrefImplicitLod 3218 3219 3220 + 3223:6(float16_t) CompositeExtract 3222 1 + Store 3221 3223 + 3224: 47(int) CompositeExtract 3222 0 + 3225: 391 Load 393(sCubeArrayShadow) + 3226: 249(fvec4) Load 251(c4) + 3227: 52(float) Load 215(compare) + 3228: 208(ptr) AccessChain 3099(texel) 207 + 3229:3138(ResType) ImageSparseSampleDrefImplicitLod 3225 3226 3227 + 3230:6(float16_t) CompositeExtract 3229 1 + Store 3228 3230 + 3231: 47(int) CompositeExtract 3229 0 + 3232: 391 Load 393(sCubeArrayShadow) + 3233: 7(f16vec4) Load 309(f16c4) + 3234: 52(float) Load 215(compare) + 3235: 208(ptr) AccessChain 3099(texel) 207 + 3236:3138(ResType) ImageSparseSampleDrefImplicitLod 3232 3233 3234 + 3237:6(float16_t) CompositeExtract 3236 1 + Store 3235 3237 + 3238: 47(int) CompositeExtract 3236 0 + 3239: 7(f16vec4) Load 3099(texel) + ReturnValue 3239 + FunctionEnd +71(testSparseTextureLod(): 7(f16vec4) Function None 8 + 72: Label + 3242(texel): 64(ptr) Variable Function + Store 3242(texel) 121 + 3243: 143 Load 145(s2D) + 3244: 53(fvec2) Load 148(c2) + 3245: 52(float) Load 565(lod) + 3246:3102(ResType) ImageSparseSampleExplicitLod 3243 3244 Lod 3245 + 3247: 7(f16vec4) CompositeExtract 3246 1 + Store 3242(texel) 3247 + 3248: 47(int) CompositeExtract 3246 0 + 3249: 143 Load 145(s2D) + 3250:154(f16vec2) Load 156(f16c2) + 3251:6(float16_t) Load 572(f16lod) + 3252:3102(ResType) ImageSparseSampleExplicitLod 3249 3250 Lod 3251 + 3253: 7(f16vec4) CompositeExtract 3252 1 + Store 3242(texel) 3253 + 3254: 47(int) CompositeExtract 3252 0 + 3255: 163 Load 165(s3D) + 3256: 167(fvec3) Load 169(c3) + 3257: 52(float) Load 565(lod) + 3258:3102(ResType) ImageSparseSampleExplicitLod 3255 3256 Lod 3257 + 3259: 7(f16vec4) CompositeExtract 3258 1 + Store 3242(texel) 3259 + 3260: 47(int) CompositeExtract 3258 0 + 3261: 163 Load 165(s3D) + 3262:175(f16vec3) Load 177(f16c3) + 3263:6(float16_t) Load 572(f16lod) + 3264:3102(ResType) ImageSparseSampleExplicitLod 3261 3262 Lod 3263 + 3265: 7(f16vec4) CompositeExtract 3264 1 + Store 3242(texel) 3265 + 3266: 47(int) CompositeExtract 3264 0 + 3267: 184 Load 186(sCube) + 3268: 167(fvec3) Load 169(c3) + 3269: 52(float) Load 565(lod) + 3270:3102(ResType) ImageSparseSampleExplicitLod 3267 3268 Lod 3269 + 3271: 7(f16vec4) CompositeExtract 3270 1 + Store 3242(texel) 3271 + 3272: 47(int) CompositeExtract 3270 0 + 3273: 184 Load 186(sCube) + 3274:175(f16vec3) Load 177(f16c3) + 3275:6(float16_t) Load 572(f16lod) + 3276:3102(ResType) ImageSparseSampleExplicitLod 3273 3274 Lod 3275 + 3277: 7(f16vec4) CompositeExtract 3276 1 + Store 3242(texel) 3277 + 3278: 47(int) CompositeExtract 3276 0 + 3279: 224 Load 226(s2DShadow) + 3280: 167(fvec3) Load 169(c3) + 3281: 52(float) Load 565(lod) + 3282: 208(ptr) AccessChain 3242(texel) 207 + 3283: 52(float) CompositeExtract 3280 2 + 3284:3138(ResType) ImageSparseSampleDrefExplicitLod 3279 3280 3283 Lod 3281 + 3285:6(float16_t) CompositeExtract 3284 1 + Store 3282 3285 + 3286: 47(int) CompositeExtract 3284 0 + 3287: 224 Load 226(s2DShadow) + 3288:154(f16vec2) Load 156(f16c2) + 3289: 52(float) Load 215(compare) + 3290:6(float16_t) Load 572(f16lod) + 3291: 208(ptr) AccessChain 3242(texel) 207 + 3292:3138(ResType) ImageSparseSampleDrefExplicitLod 3287 3288 3289 Lod 3290 + 3293:6(float16_t) CompositeExtract 3292 1 + Store 3291 3293 + 3294: 47(int) CompositeExtract 3292 0 + 3295: 284 Load 286(s2DArray) + 3296: 167(fvec3) Load 169(c3) + 3297: 52(float) Load 565(lod) + 3298:3102(ResType) ImageSparseSampleExplicitLod 3295 3296 Lod 3297 + 3299: 7(f16vec4) CompositeExtract 3298 1 + Store 3242(texel) 3299 + 3300: 47(int) CompositeExtract 3298 0 + 3301: 284 Load 286(s2DArray) + 3302:175(f16vec3) Load 177(f16c3) + 3303:6(float16_t) Load 572(f16lod) + 3304:3102(ResType) ImageSparseSampleExplicitLod 3301 3302 Lod 3303 + 3305: 7(f16vec4) CompositeExtract 3304 1 + Store 3242(texel) 3305 + 3306: 47(int) CompositeExtract 3304 0 + 3307: 299 Load 301(sCubeArray) + 3308: 249(fvec4) Load 251(c4) + 3309: 52(float) Load 565(lod) + 3310:3102(ResType) ImageSparseSampleExplicitLod 3307 3308 Lod 3309 + 3311: 7(f16vec4) CompositeExtract 3310 1 + Store 3242(texel) 3311 + 3312: 47(int) CompositeExtract 3310 0 + 3313: 299 Load 301(sCubeArray) + 3314: 7(f16vec4) Load 309(f16c4) + 3315:6(float16_t) Load 572(f16lod) + 3316:3102(ResType) ImageSparseSampleExplicitLod 3313 3314 Lod 3315 + 3317: 7(f16vec4) CompositeExtract 3316 1 + Store 3242(texel) 3317 + 3318: 47(int) CompositeExtract 3316 0 + 3319: 7(f16vec4) Load 3242(texel) + ReturnValue 3319 + FunctionEnd +73(testSparseTextureOffset(): 7(f16vec4) Function None 8 + 74: Label + 3322(texel): 64(ptr) Variable Function + Store 3322(texel) 121 + 3323: 143 Load 145(s2D) + 3324: 53(fvec2) Load 148(c2) + 3325:3102(ResType) ImageSparseSampleImplicitLod 3323 3324 ConstOffset 722 + 3326: 7(f16vec4) CompositeExtract 3325 1 + Store 3322(texel) 3326 + 3327: 47(int) CompositeExtract 3325 0 + 3328: 143 Load 145(s2D) + 3329:154(f16vec2) Load 156(f16c2) + 3330:6(float16_t) Load 137(f16bias) + 3331:3102(ResType) ImageSparseSampleImplicitLod 3328 3329 Bias ConstOffset 3330 722 + 3332: 7(f16vec4) CompositeExtract 3331 1 + Store 3322(texel) 3332 + 3333: 47(int) CompositeExtract 3331 0 + 3334: 163 Load 165(s3D) + 3335: 167(fvec3) Load 169(c3) + 3336:3102(ResType) ImageSparseSampleImplicitLod 3334 3335 ConstOffset 735 + 3337: 7(f16vec4) CompositeExtract 3336 1 + Store 3322(texel) 3337 + 3338: 47(int) CompositeExtract 3336 0 + 3339: 163 Load 165(s3D) + 3340:175(f16vec3) Load 177(f16c3) + 3341:6(float16_t) Load 137(f16bias) + 3342:3102(ResType) ImageSparseSampleImplicitLod 3339 3340 Bias ConstOffset 3341 735 + 3343: 7(f16vec4) CompositeExtract 3342 1 + Store 3322(texel) 3343 + 3344: 47(int) CompositeExtract 3342 0 + 3345: 357 Load 359(s2DRect) + 3346: 53(fvec2) Load 148(c2) + 3347:3102(ResType) ImageSparseSampleImplicitLod 3345 3346 ConstOffset 722 + 3348: 7(f16vec4) CompositeExtract 3347 1 + Store 3322(texel) 3348 + 3349: 47(int) CompositeExtract 3347 0 + 3350: 357 Load 359(s2DRect) + 3351:154(f16vec2) Load 156(f16c2) + 3352:3102(ResType) ImageSparseSampleImplicitLod 3350 3351 ConstOffset 722 + 3353: 7(f16vec4) CompositeExtract 3352 1 + Store 3322(texel) 3353 + 3354: 47(int) CompositeExtract 3352 0 + 3355: 371 Load 373(s2DRectShadow) + 3356: 167(fvec3) Load 169(c3) + 3357: 208(ptr) AccessChain 3322(texel) 207 + 3358: 52(float) CompositeExtract 3356 2 + 3359:3138(ResType) ImageSparseSampleDrefImplicitLod 3355 3356 3358 ConstOffset 722 + 3360:6(float16_t) CompositeExtract 3359 1 + Store 3357 3360 + 3361: 47(int) CompositeExtract 3359 0 + 3362: 371 Load 373(s2DRectShadow) + 3363:154(f16vec2) Load 156(f16c2) + 3364: 52(float) Load 215(compare) + 3365: 208(ptr) AccessChain 3322(texel) 207 + 3366:3138(ResType) ImageSparseSampleDrefImplicitLod 3362 3363 3364 ConstOffset 722 + 3367:6(float16_t) CompositeExtract 3366 1 + Store 3365 3367 + 3368: 47(int) CompositeExtract 3366 0 + 3369: 224 Load 226(s2DShadow) + 3370: 167(fvec3) Load 169(c3) + 3371: 208(ptr) AccessChain 3322(texel) 207 + 3372: 52(float) CompositeExtract 3370 2 + 3373:3138(ResType) ImageSparseSampleDrefImplicitLod 3369 3370 3372 ConstOffset 722 + 3374:6(float16_t) CompositeExtract 3373 1 + Store 3371 3374 + 3375: 47(int) CompositeExtract 3373 0 + 3376: 224 Load 226(s2DShadow) + 3377:154(f16vec2) Load 156(f16c2) + 3378: 52(float) Load 215(compare) + 3379: 208(ptr) AccessChain 3322(texel) 207 + 3380:6(float16_t) Load 137(f16bias) + 3381:3138(ResType) ImageSparseSampleDrefImplicitLod 3376 3377 3378 Bias ConstOffset 3380 722 + 3382:6(float16_t) CompositeExtract 3381 1 + Store 3379 3382 + 3383: 47(int) CompositeExtract 3381 0 + 3384: 284 Load 286(s2DArray) + 3385: 167(fvec3) Load 169(c3) + 3386:3102(ResType) ImageSparseSampleImplicitLod 3384 3385 ConstOffset 722 + 3387: 7(f16vec4) CompositeExtract 3386 1 + Store 3322(texel) 3387 + 3388: 47(int) CompositeExtract 3386 0 + 3389: 284 Load 286(s2DArray) + 3390:175(f16vec3) Load 177(f16c3) + 3391:6(float16_t) Load 137(f16bias) + 3392:3102(ResType) ImageSparseSampleImplicitLod 3389 3390 Bias ConstOffset 3391 722 + 3393: 7(f16vec4) CompositeExtract 3392 1 + Store 3322(texel) 3393 + 3394: 47(int) CompositeExtract 3392 0 + 3395: 337 Load 339(s2DArrayShadow) + 3396: 249(fvec4) Load 251(c4) + 3397: 208(ptr) AccessChain 3322(texel) 207 + 3398: 52(float) CompositeExtract 3396 3 + 3399:3138(ResType) ImageSparseSampleDrefImplicitLod 3395 3396 3398 ConstOffset 722 + 3400:6(float16_t) CompositeExtract 3399 1 + Store 3397 3400 + 3401: 47(int) CompositeExtract 3399 0 + 3402: 337 Load 339(s2DArrayShadow) + 3403:175(f16vec3) Load 177(f16c3) + 3404: 52(float) Load 215(compare) + 3405: 208(ptr) AccessChain 3322(texel) 207 + 3406:3138(ResType) ImageSparseSampleDrefImplicitLod 3402 3403 3404 ConstOffset 722 + 3407:6(float16_t) CompositeExtract 3406 1 + Store 3405 3407 + 3408: 47(int) CompositeExtract 3406 0 + 3409: 7(f16vec4) Load 3322(texel) + ReturnValue 3409 + FunctionEnd +75(testSparseTextureLodOffset(): 7(f16vec4) Function None 8 + 76: Label + 3412(texel): 64(ptr) Variable Function + Store 3412(texel) 121 + 3413: 143 Load 145(s2D) + 3414: 53(fvec2) Load 148(c2) + 3415: 52(float) Load 565(lod) + 3416:3102(ResType) ImageSparseSampleExplicitLod 3413 3414 Lod ConstOffset 3415 722 + 3417: 7(f16vec4) CompositeExtract 3416 1 + Store 3412(texel) 3417 + 3418: 47(int) CompositeExtract 3416 0 + 3419: 143 Load 145(s2D) + 3420:154(f16vec2) Load 156(f16c2) + 3421:6(float16_t) Load 572(f16lod) + 3422:3102(ResType) ImageSparseSampleExplicitLod 3419 3420 Lod ConstOffset 3421 722 + 3423: 7(f16vec4) CompositeExtract 3422 1 + Store 3412(texel) 3423 + 3424: 47(int) CompositeExtract 3422 0 + 3425: 163 Load 165(s3D) + 3426: 167(fvec3) Load 169(c3) + 3427: 52(float) Load 565(lod) + 3428:3102(ResType) ImageSparseSampleExplicitLod 3425 3426 Lod ConstOffset 3427 735 + 3429: 7(f16vec4) CompositeExtract 3428 1 + Store 3412(texel) 3429 + 3430: 47(int) CompositeExtract 3428 0 + 3431: 163 Load 165(s3D) + 3432:175(f16vec3) Load 177(f16c3) + 3433:6(float16_t) Load 572(f16lod) + 3434:3102(ResType) ImageSparseSampleExplicitLod 3431 3432 Lod ConstOffset 3433 735 + 3435: 7(f16vec4) CompositeExtract 3434 1 + Store 3412(texel) 3435 + 3436: 47(int) CompositeExtract 3434 0 + 3437: 224 Load 226(s2DShadow) + 3438: 167(fvec3) Load 169(c3) + 3439: 52(float) Load 565(lod) + 3440: 208(ptr) AccessChain 3412(texel) 207 + 3441: 52(float) CompositeExtract 3438 2 + 3442:3138(ResType) ImageSparseSampleDrefExplicitLod 3437 3438 3441 Lod ConstOffset 3439 722 + 3443:6(float16_t) CompositeExtract 3442 1 + Store 3440 3443 + 3444: 47(int) CompositeExtract 3442 0 + 3445: 224 Load 226(s2DShadow) + 3446:154(f16vec2) Load 156(f16c2) + 3447: 52(float) Load 215(compare) + 3448:6(float16_t) Load 572(f16lod) + 3449: 208(ptr) AccessChain 3412(texel) 207 + 3450:3138(ResType) ImageSparseSampleDrefExplicitLod 3445 3446 3447 Lod ConstOffset 3448 722 + 3451:6(float16_t) CompositeExtract 3450 1 + Store 3449 3451 + 3452: 47(int) CompositeExtract 3450 0 + 3453: 284 Load 286(s2DArray) + 3454: 167(fvec3) Load 169(c3) + 3455: 52(float) Load 565(lod) + 3456:3102(ResType) ImageSparseSampleExplicitLod 3453 3454 Lod ConstOffset 3455 722 + 3457: 7(f16vec4) CompositeExtract 3456 1 + Store 3412(texel) 3457 + 3458: 47(int) CompositeExtract 3456 0 + 3459: 284 Load 286(s2DArray) + 3460:175(f16vec3) Load 177(f16c3) + 3461:6(float16_t) Load 572(f16lod) + 3462:3102(ResType) ImageSparseSampleExplicitLod 3459 3460 Lod ConstOffset 3461 722 + 3463: 7(f16vec4) CompositeExtract 3462 1 + Store 3412(texel) 3463 + 3464: 47(int) CompositeExtract 3462 0 + 3465: 7(f16vec4) Load 3412(texel) + ReturnValue 3465 + FunctionEnd +77(testSparseTextureGrad(): 7(f16vec4) Function None 8 + 78: Label + 3468(texel): 64(ptr) Variable Function + Store 3468(texel) 121 + 3469: 143 Load 145(s2D) + 3470: 53(fvec2) Load 148(c2) + 3471: 53(fvec2) Load 1409(dPdxy2) + 3472: 53(fvec2) Load 1409(dPdxy2) + 3473:3102(ResType) ImageSparseSampleExplicitLod 3469 3470 Grad 3471 3472 + 3474: 7(f16vec4) CompositeExtract 3473 1 + Store 3468(texel) 3474 + 3475: 47(int) CompositeExtract 3473 0 + 3476: 143 Load 145(s2D) + 3477:154(f16vec2) Load 156(f16c2) + 3478:154(f16vec2) Load 1417(f16dPdxy2) + 3479:154(f16vec2) Load 1417(f16dPdxy2) + 3480:3102(ResType) ImageSparseSampleExplicitLod 3476 3477 Grad 3478 3479 + 3481: 7(f16vec4) CompositeExtract 3480 1 + Store 3468(texel) 3481 + 3482: 47(int) CompositeExtract 3480 0 + 3483: 163 Load 165(s3D) + 3484: 167(fvec3) Load 169(c3) + 3485: 167(fvec3) Load 1425(dPdxy3) + 3486: 167(fvec3) Load 1425(dPdxy3) + 3487:3102(ResType) ImageSparseSampleExplicitLod 3483 3484 Grad 3485 3486 + 3488: 7(f16vec4) CompositeExtract 3487 1 + Store 3468(texel) 3488 + 3489: 47(int) CompositeExtract 3487 0 + 3490: 163 Load 165(s3D) + 3491:175(f16vec3) Load 177(f16c3) + 3492:175(f16vec3) Load 1433(f16dPdxy3) + 3493:175(f16vec3) Load 1433(f16dPdxy3) + 3494:3102(ResType) ImageSparseSampleExplicitLod 3490 3491 Grad 3492 3493 + 3495: 7(f16vec4) CompositeExtract 3494 1 + Store 3468(texel) 3495 + 3496: 47(int) CompositeExtract 3494 0 + 3497: 184 Load 186(sCube) + 3498: 167(fvec3) Load 169(c3) + 3499: 167(fvec3) Load 1425(dPdxy3) + 3500: 167(fvec3) Load 1425(dPdxy3) + 3501:3102(ResType) ImageSparseSampleExplicitLod 3497 3498 Grad 3499 3500 + 3502: 7(f16vec4) CompositeExtract 3501 1 + Store 3468(texel) 3502 + 3503: 47(int) CompositeExtract 3501 0 + 3504: 184 Load 186(sCube) + 3505:175(f16vec3) Load 177(f16c3) + 3506:175(f16vec3) Load 1433(f16dPdxy3) + 3507:175(f16vec3) Load 1433(f16dPdxy3) + 3508:3102(ResType) ImageSparseSampleExplicitLod 3504 3505 Grad 3506 3507 + 3509: 7(f16vec4) CompositeExtract 3508 1 + Store 3468(texel) 3509 + 3510: 47(int) CompositeExtract 3508 0 + 3511: 357 Load 359(s2DRect) + 3512: 53(fvec2) Load 148(c2) + 3513: 53(fvec2) Load 1409(dPdxy2) + 3514: 53(fvec2) Load 1409(dPdxy2) + 3515:3102(ResType) ImageSparseSampleExplicitLod 3511 3512 Grad 3513 3514 + 3516: 7(f16vec4) CompositeExtract 3515 1 + Store 3468(texel) 3516 + 3517: 47(int) CompositeExtract 3515 0 + 3518: 357 Load 359(s2DRect) + 3519:154(f16vec2) Load 156(f16c2) + 3520:154(f16vec2) Load 1417(f16dPdxy2) + 3521:154(f16vec2) Load 1417(f16dPdxy2) + 3522:3102(ResType) ImageSparseSampleExplicitLod 3518 3519 Grad 3520 3521 + 3523: 7(f16vec4) CompositeExtract 3522 1 + Store 3468(texel) 3523 + 3524: 47(int) CompositeExtract 3522 0 + 3525: 371 Load 373(s2DRectShadow) + 3526: 167(fvec3) Load 169(c3) + 3527: 53(fvec2) Load 1409(dPdxy2) + 3528: 53(fvec2) Load 1409(dPdxy2) + 3529: 208(ptr) AccessChain 3468(texel) 207 + 3530: 52(float) CompositeExtract 3526 2 + 3531:3138(ResType) ImageSparseSampleDrefExplicitLod 3525 3526 3530 Grad 3527 3528 + 3532:6(float16_t) CompositeExtract 3531 1 + Store 3529 3532 + 3533: 47(int) CompositeExtract 3531 0 + 3534: 371 Load 373(s2DRectShadow) + 3535:154(f16vec2) Load 156(f16c2) + 3536: 52(float) Load 215(compare) + 3537:154(f16vec2) Load 1417(f16dPdxy2) + 3538:154(f16vec2) Load 1417(f16dPdxy2) + 3539: 208(ptr) AccessChain 3468(texel) 207 + 3540:3138(ResType) ImageSparseSampleDrefExplicitLod 3534 3535 3536 Grad 3537 3538 + 3541:6(float16_t) CompositeExtract 3540 1 + Store 3539 3541 + 3542: 47(int) CompositeExtract 3540 0 + 3543: 224 Load 226(s2DShadow) + 3544: 167(fvec3) Load 169(c3) + 3545: 53(fvec2) Load 1409(dPdxy2) + 3546: 53(fvec2) Load 1409(dPdxy2) + 3547: 208(ptr) AccessChain 3468(texel) 207 + 3548: 52(float) CompositeExtract 3544 2 + 3549:3138(ResType) ImageSparseSampleDrefExplicitLod 3543 3544 3548 Grad 3545 3546 + 3550:6(float16_t) CompositeExtract 3549 1 + Store 3547 3550 + 3551: 47(int) CompositeExtract 3549 0 + 3552: 224 Load 226(s2DShadow) + 3553:154(f16vec2) Load 156(f16c2) + 3554: 52(float) Load 215(compare) + 3555:154(f16vec2) Load 1417(f16dPdxy2) + 3556:154(f16vec2) Load 1417(f16dPdxy2) + 3557: 208(ptr) AccessChain 3468(texel) 207 + 3558:3138(ResType) ImageSparseSampleDrefExplicitLod 3552 3553 3554 Grad 3555 3556 + 3559:6(float16_t) CompositeExtract 3558 1 + Store 3557 3559 + 3560: 47(int) CompositeExtract 3558 0 + 3561: 245 Load 247(sCubeShadow) + 3562: 249(fvec4) Load 251(c4) + 3563: 167(fvec3) Load 1425(dPdxy3) + 3564: 167(fvec3) Load 1425(dPdxy3) + 3565: 208(ptr) AccessChain 3468(texel) 207 + 3566: 52(float) CompositeExtract 3562 3 + 3567:3138(ResType) ImageSparseSampleDrefExplicitLod 3561 3562 3566 Grad 3563 3564 + 3568:6(float16_t) CompositeExtract 3567 1 + Store 3565 3568 + 3569: 47(int) CompositeExtract 3567 0 + 3570: 245 Load 247(sCubeShadow) + 3571:175(f16vec3) Load 177(f16c3) + 3572: 52(float) Load 215(compare) + 3573:175(f16vec3) Load 1433(f16dPdxy3) + 3574:175(f16vec3) Load 1433(f16dPdxy3) + 3575: 208(ptr) AccessChain 3468(texel) 207 + 3576:3138(ResType) ImageSparseSampleDrefExplicitLod 3570 3571 3572 Grad 3573 3574 + 3577:6(float16_t) CompositeExtract 3576 1 + Store 3575 3577 + 3578: 47(int) CompositeExtract 3576 0 + 3579: 284 Load 286(s2DArray) + 3580: 167(fvec3) Load 169(c3) + 3581: 53(fvec2) Load 1409(dPdxy2) + 3582: 53(fvec2) Load 1409(dPdxy2) + 3583:3102(ResType) ImageSparseSampleExplicitLod 3579 3580 Grad 3581 3582 + 3584: 7(f16vec4) CompositeExtract 3583 1 + Store 3468(texel) 3584 + 3585: 47(int) CompositeExtract 3583 0 + 3586: 284 Load 286(s2DArray) + 3587:175(f16vec3) Load 177(f16c3) + 3588:154(f16vec2) Load 1417(f16dPdxy2) + 3589:154(f16vec2) Load 1417(f16dPdxy2) + 3590:3102(ResType) ImageSparseSampleExplicitLod 3586 3587 Grad 3588 3589 + 3591: 7(f16vec4) CompositeExtract 3590 1 + Store 3468(texel) 3591 + 3592: 47(int) CompositeExtract 3590 0 + 3593: 337 Load 339(s2DArrayShadow) + 3594: 249(fvec4) Load 251(c4) + 3595: 53(fvec2) Load 1409(dPdxy2) + 3596: 53(fvec2) Load 1409(dPdxy2) + 3597: 208(ptr) AccessChain 3468(texel) 207 + 3598: 52(float) CompositeExtract 3594 3 + 3599:3138(ResType) ImageSparseSampleDrefExplicitLod 3593 3594 3598 Grad 3595 3596 + 3600:6(float16_t) CompositeExtract 3599 1 + Store 3597 3600 + 3601: 47(int) CompositeExtract 3599 0 + 3602: 337 Load 339(s2DArrayShadow) + 3603:175(f16vec3) Load 177(f16c3) + 3604: 52(float) Load 215(compare) + 3605:154(f16vec2) Load 1417(f16dPdxy2) + 3606:154(f16vec2) Load 1417(f16dPdxy2) + 3607: 208(ptr) AccessChain 3468(texel) 207 + 3608:3138(ResType) ImageSparseSampleDrefExplicitLod 3602 3603 3604 Grad 3605 3606 + 3609:6(float16_t) CompositeExtract 3608 1 + Store 3607 3609 + 3610: 47(int) CompositeExtract 3608 0 + 3611: 299 Load 301(sCubeArray) + 3612: 249(fvec4) Load 251(c4) + 3613: 167(fvec3) Load 1425(dPdxy3) + 3614: 167(fvec3) Load 1425(dPdxy3) + 3615:3102(ResType) ImageSparseSampleExplicitLod 3611 3612 Grad 3613 3614 + 3616: 7(f16vec4) CompositeExtract 3615 1 + Store 3468(texel) 3616 + 3617: 47(int) CompositeExtract 3615 0 + 3618: 299 Load 301(sCubeArray) + 3619: 7(f16vec4) Load 309(f16c4) + 3620:175(f16vec3) Load 1433(f16dPdxy3) + 3621:175(f16vec3) Load 1433(f16dPdxy3) + 3622:3102(ResType) ImageSparseSampleExplicitLod 3618 3619 Grad 3620 3621 + 3623: 7(f16vec4) CompositeExtract 3622 1 + Store 3468(texel) 3623 + 3624: 47(int) CompositeExtract 3622 0 + 3625: 7(f16vec4) Load 3468(texel) + ReturnValue 3625 + FunctionEnd +79(testSparseTextureGradOffset(): 7(f16vec4) Function None 8 + 80: Label + 3628(texel): 64(ptr) Variable Function + Store 3628(texel) 121 + 3629: 143 Load 145(s2D) + 3630: 53(fvec2) Load 148(c2) + 3631: 53(fvec2) Load 1409(dPdxy2) + 3632: 53(fvec2) Load 1409(dPdxy2) + 3633:3102(ResType) ImageSparseSampleExplicitLod 3629 3630 Grad ConstOffset 3631 3632 722 + 3634: 7(f16vec4) CompositeExtract 3633 1 + Store 3628(texel) 3634 + 3635: 47(int) CompositeExtract 3633 0 + 3636: 143 Load 145(s2D) + 3637:154(f16vec2) Load 156(f16c2) + 3638:154(f16vec2) Load 1417(f16dPdxy2) + 3639:154(f16vec2) Load 1417(f16dPdxy2) + 3640:3102(ResType) ImageSparseSampleExplicitLod 3636 3637 Grad ConstOffset 3638 3639 722 + 3641: 7(f16vec4) CompositeExtract 3640 1 + Store 3628(texel) 3641 + 3642: 47(int) CompositeExtract 3640 0 + 3643: 163 Load 165(s3D) + 3644: 167(fvec3) Load 169(c3) + 3645: 167(fvec3) Load 1425(dPdxy3) + 3646: 167(fvec3) Load 1425(dPdxy3) + 3647:3102(ResType) ImageSparseSampleExplicitLod 3643 3644 Grad ConstOffset 3645 3646 735 + 3648: 7(f16vec4) CompositeExtract 3647 1 + Store 3628(texel) 3648 + 3649: 47(int) CompositeExtract 3647 0 + 3650: 163 Load 165(s3D) + 3651:175(f16vec3) Load 177(f16c3) + 3652:175(f16vec3) Load 1433(f16dPdxy3) + 3653:175(f16vec3) Load 1433(f16dPdxy3) + 3654:3102(ResType) ImageSparseSampleExplicitLod 3650 3651 Grad ConstOffset 3652 3653 735 + 3655: 7(f16vec4) CompositeExtract 3654 1 + Store 3628(texel) 3655 + 3656: 47(int) CompositeExtract 3654 0 + 3657: 357 Load 359(s2DRect) + 3658: 53(fvec2) Load 148(c2) + 3659: 53(fvec2) Load 1409(dPdxy2) + 3660: 53(fvec2) Load 1409(dPdxy2) + 3661:3102(ResType) ImageSparseSampleExplicitLod 3657 3658 Grad ConstOffset 3659 3660 722 + 3662: 7(f16vec4) CompositeExtract 3661 1 + Store 3628(texel) 3662 + 3663: 47(int) CompositeExtract 3661 0 + 3664: 357 Load 359(s2DRect) + 3665:154(f16vec2) Load 156(f16c2) + 3666:154(f16vec2) Load 1417(f16dPdxy2) + 3667:154(f16vec2) Load 1417(f16dPdxy2) + 3668:3102(ResType) ImageSparseSampleExplicitLod 3664 3665 Grad ConstOffset 3666 3667 722 + 3669: 7(f16vec4) CompositeExtract 3668 1 + Store 3628(texel) 3669 + 3670: 47(int) CompositeExtract 3668 0 + 3671: 371 Load 373(s2DRectShadow) + 3672: 167(fvec3) Load 169(c3) + 3673: 53(fvec2) Load 1409(dPdxy2) + 3674: 53(fvec2) Load 1409(dPdxy2) + 3675: 208(ptr) AccessChain 3628(texel) 207 + 3676: 52(float) CompositeExtract 3672 2 + 3677:3138(ResType) ImageSparseSampleDrefExplicitLod 3671 3672 3676 Grad ConstOffset 3673 3674 722 + 3678:6(float16_t) CompositeExtract 3677 1 + Store 3675 3678 + 3679: 47(int) CompositeExtract 3677 0 + 3680: 371 Load 373(s2DRectShadow) + 3681:154(f16vec2) Load 156(f16c2) + 3682: 52(float) Load 215(compare) + 3683:154(f16vec2) Load 1417(f16dPdxy2) + 3684:154(f16vec2) Load 1417(f16dPdxy2) + 3685: 208(ptr) AccessChain 3628(texel) 207 + 3686:3138(ResType) ImageSparseSampleDrefExplicitLod 3680 3681 3682 Grad ConstOffset 3683 3684 722 + 3687:6(float16_t) CompositeExtract 3686 1 + Store 3685 3687 + 3688: 47(int) CompositeExtract 3686 0 + 3689: 224 Load 226(s2DShadow) + 3690: 167(fvec3) Load 169(c3) + 3691: 53(fvec2) Load 1409(dPdxy2) + 3692: 53(fvec2) Load 1409(dPdxy2) + 3693: 208(ptr) AccessChain 3628(texel) 207 + 3694: 52(float) CompositeExtract 3690 2 + 3695:3138(ResType) ImageSparseSampleDrefExplicitLod 3689 3690 3694 Grad ConstOffset 3691 3692 722 + 3696:6(float16_t) CompositeExtract 3695 1 + Store 3693 3696 + 3697: 47(int) CompositeExtract 3695 0 + 3698: 224 Load 226(s2DShadow) + 3699:154(f16vec2) Load 156(f16c2) + 3700: 52(float) Load 215(compare) + 3701:154(f16vec2) Load 1417(f16dPdxy2) + 3702:154(f16vec2) Load 1417(f16dPdxy2) + 3703: 208(ptr) AccessChain 3628(texel) 207 + 3704:3138(ResType) ImageSparseSampleDrefExplicitLod 3698 3699 3700 Grad ConstOffset 3701 3702 722 + 3705:6(float16_t) CompositeExtract 3704 1 + Store 3703 3705 + 3706: 47(int) CompositeExtract 3704 0 + 3707: 284 Load 286(s2DArray) + 3708: 167(fvec3) Load 169(c3) + 3709: 53(fvec2) Load 1409(dPdxy2) + 3710: 53(fvec2) Load 1409(dPdxy2) + 3711:3102(ResType) ImageSparseSampleExplicitLod 3707 3708 Grad ConstOffset 3709 3710 722 + 3712: 7(f16vec4) CompositeExtract 3711 1 + Store 3628(texel) 3712 + 3713: 47(int) CompositeExtract 3711 0 + 3714: 284 Load 286(s2DArray) + 3715:175(f16vec3) Load 177(f16c3) + 3716:154(f16vec2) Load 1417(f16dPdxy2) + 3717:154(f16vec2) Load 1417(f16dPdxy2) + 3718:3102(ResType) ImageSparseSampleExplicitLod 3714 3715 Grad ConstOffset 3716 3717 722 + 3719: 7(f16vec4) CompositeExtract 3718 1 + Store 3628(texel) 3719 + 3720: 47(int) CompositeExtract 3718 0 + 3721: 337 Load 339(s2DArrayShadow) + 3722: 249(fvec4) Load 251(c4) + 3723: 53(fvec2) Load 1409(dPdxy2) + 3724: 53(fvec2) Load 1409(dPdxy2) + 3725: 208(ptr) AccessChain 3628(texel) 207 + 3726: 52(float) CompositeExtract 3722 3 + 3727:3138(ResType) ImageSparseSampleDrefExplicitLod 3721 3722 3726 Grad ConstOffset 3723 3724 722 + 3728:6(float16_t) CompositeExtract 3727 1 + Store 3725 3728 + 3729: 47(int) CompositeExtract 3727 0 + 3730: 337 Load 339(s2DArrayShadow) + 3731:175(f16vec3) Load 177(f16c3) + 3732: 52(float) Load 215(compare) + 3733:154(f16vec2) Load 1417(f16dPdxy2) + 3734:154(f16vec2) Load 1417(f16dPdxy2) + 3735: 208(ptr) AccessChain 3628(texel) 207 + 3736:3138(ResType) ImageSparseSampleDrefExplicitLod 3730 3731 3732 Grad ConstOffset 3733 3734 722 + 3737:6(float16_t) CompositeExtract 3736 1 + Store 3735 3737 + 3738: 47(int) CompositeExtract 3736 0 + 3739: 7(f16vec4) Load 3628(texel) + ReturnValue 3739 + FunctionEnd +81(testSparseTexelFetch(): 7(f16vec4) Function None 8 + 82: Label + 3742(texel): 64(ptr) Variable Function + Store 3742(texel) 121 + 3743: 143 Load 145(s2D) + 3744: 53(fvec2) Load 148(c2) + 3745: 721(ivec2) ConvertFToS 3744 + 3746: 52(float) Load 565(lod) + 3747: 47(int) ConvertFToS 3746 + 3748: 142 Image 3743 + 3749:3102(ResType) ImageSparseFetch 3748 3745 Lod 3747 + 3750: 7(f16vec4) CompositeExtract 3749 1 + Store 3742(texel) 3750 + 3751: 47(int) CompositeExtract 3749 0 + 3752: 163 Load 165(s3D) + 3753: 167(fvec3) Load 169(c3) + 3754: 734(ivec3) ConvertFToS 3753 + 3755: 52(float) Load 565(lod) + 3756: 47(int) ConvertFToS 3755 + 3757: 162 Image 3752 + 3758:3102(ResType) ImageSparseFetch 3757 3754 Lod 3756 + 3759: 7(f16vec4) CompositeExtract 3758 1 + Store 3742(texel) 3759 + 3760: 47(int) CompositeExtract 3758 0 + 3761: 357 Load 359(s2DRect) + 3762: 53(fvec2) Load 148(c2) + 3763: 721(ivec2) ConvertFToS 3762 + 3764: 356 Image 3761 + 3765:3102(ResType) ImageSparseFetch 3764 3763 + 3766: 7(f16vec4) CompositeExtract 3765 1 + Store 3742(texel) 3766 + 3767: 47(int) CompositeExtract 3765 0 + 3768: 284 Load 286(s2DArray) + 3769: 167(fvec3) Load 169(c3) + 3770: 734(ivec3) ConvertFToS 3769 + 3771: 52(float) Load 565(lod) + 3772: 47(int) ConvertFToS 3771 + 3773: 283 Image 3768 + 3774:3102(ResType) ImageSparseFetch 3773 3770 Lod 3772 + 3775: 7(f16vec4) CompositeExtract 3774 1 + Store 3742(texel) 3775 + 3776: 47(int) CompositeExtract 3774 0 + 3777: 1309 Load 1311(s2DMS) + 3778: 53(fvec2) Load 148(c2) + 3779: 721(ivec2) ConvertFToS 3778 + 3780: 1308 Image 3777 + 3781:3102(ResType) ImageSparseFetch 3780 3779 Sample 709 + 3782: 7(f16vec4) CompositeExtract 3781 1 + Store 3742(texel) 3782 + 3783: 47(int) CompositeExtract 3781 0 + 3784: 1320 Load 1322(s2DMSArray) + 3785: 167(fvec3) Load 169(c3) + 3786: 734(ivec3) ConvertFToS 3785 + 3787: 1319 Image 3784 + 3788:3102(ResType) ImageSparseFetch 3787 3786 Sample 1326 + 3789: 7(f16vec4) CompositeExtract 3788 1 + Store 3742(texel) 3789 + 3790: 47(int) CompositeExtract 3788 0 + 3791: 7(f16vec4) Load 3742(texel) + ReturnValue 3791 + FunctionEnd +83(testSparseTexelFetchOffset(): 7(f16vec4) Function None 8 + 84: Label + 3794(texel): 64(ptr) Variable Function + Store 3794(texel) 121 + 3795: 143 Load 145(s2D) + 3796: 53(fvec2) Load 148(c2) + 3797: 721(ivec2) ConvertFToS 3796 + 3798: 52(float) Load 565(lod) + 3799: 47(int) ConvertFToS 3798 + 3800: 142 Image 3795 + 3801:3102(ResType) ImageSparseFetch 3800 3797 Lod ConstOffset 3799 722 + 3802: 7(f16vec4) CompositeExtract 3801 1 + Store 3794(texel) 3802 + 3803: 47(int) CompositeExtract 3801 0 + 3804: 163 Load 165(s3D) + 3805: 167(fvec3) Load 169(c3) + 3806: 734(ivec3) ConvertFToS 3805 + 3807: 52(float) Load 565(lod) + 3808: 47(int) ConvertFToS 3807 + 3809: 162 Image 3804 + 3810:3102(ResType) ImageSparseFetch 3809 3806 Lod ConstOffset 3808 735 + 3811: 7(f16vec4) CompositeExtract 3810 1 + Store 3794(texel) 3811 + 3812: 47(int) CompositeExtract 3810 0 + 3813: 357 Load 359(s2DRect) + 3814: 53(fvec2) Load 148(c2) + 3815: 721(ivec2) ConvertFToS 3814 + 3816: 356 Image 3813 + 3817:3102(ResType) ImageSparseFetch 3816 3815 ConstOffset 722 + 3818: 7(f16vec4) CompositeExtract 3817 1 + Store 3794(texel) 3818 + 3819: 47(int) CompositeExtract 3817 0 + 3820: 284 Load 286(s2DArray) + 3821: 167(fvec3) Load 169(c3) + 3822: 734(ivec3) ConvertFToS 3821 + 3823: 52(float) Load 565(lod) + 3824: 47(int) ConvertFToS 3823 + 3825: 283 Image 3820 + 3826:3102(ResType) ImageSparseFetch 3825 3822 Lod ConstOffset 3824 722 + 3827: 7(f16vec4) CompositeExtract 3826 1 + Store 3794(texel) 3827 + 3828: 47(int) CompositeExtract 3826 0 + 3829: 7(f16vec4) Load 3794(texel) + ReturnValue 3829 + FunctionEnd +85(testSparseTextureGather(): 7(f16vec4) Function None 8 + 86: Label + 3832(texel): 64(ptr) Variable Function + Store 3832(texel) 121 + 3833: 143 Load 145(s2D) + 3834: 53(fvec2) Load 148(c2) + 3835:3102(ResType) ImageSparseGather 3833 3834 2187 + 3836: 7(f16vec4) CompositeExtract 3835 1 + Store 3832(texel) 3836 + 3837: 47(int) CompositeExtract 3835 0 + 3838: 143 Load 145(s2D) + 3839:154(f16vec2) Load 156(f16c2) + 3840:6(float16_t) Load 137(f16bias) + 3841:3102(ResType) ImageSparseGather 3838 3839 2187 Bias 3840 + 3842: 7(f16vec4) CompositeExtract 3841 1 + Store 3832(texel) 3842 + 3843: 47(int) CompositeExtract 3841 0 + 3844: 284 Load 286(s2DArray) + 3845: 167(fvec3) Load 169(c3) + 3846:3102(ResType) ImageSparseGather 3844 3845 2187 + 3847: 7(f16vec4) CompositeExtract 3846 1 + Store 3832(texel) 3847 + 3848: 47(int) CompositeExtract 3846 0 + 3849: 284 Load 286(s2DArray) + 3850:175(f16vec3) Load 177(f16c3) + 3851:6(float16_t) Load 137(f16bias) + 3852:3102(ResType) ImageSparseGather 3849 3850 2187 Bias 3851 + 3853: 7(f16vec4) CompositeExtract 3852 1 + Store 3832(texel) 3853 + 3854: 47(int) CompositeExtract 3852 0 + 3855: 184 Load 186(sCube) + 3856: 167(fvec3) Load 169(c3) + 3857:3102(ResType) ImageSparseGather 3855 3856 2187 + 3858: 7(f16vec4) CompositeExtract 3857 1 + Store 3832(texel) 3858 + 3859: 47(int) CompositeExtract 3857 0 + 3860: 184 Load 186(sCube) + 3861:175(f16vec3) Load 177(f16c3) + 3862:6(float16_t) Load 137(f16bias) + 3863:3102(ResType) ImageSparseGather 3860 3861 2187 Bias 3862 + 3864: 7(f16vec4) CompositeExtract 3863 1 + Store 3832(texel) 3864 + 3865: 47(int) CompositeExtract 3863 0 + 3866: 299 Load 301(sCubeArray) + 3867: 249(fvec4) Load 251(c4) + 3868:3102(ResType) ImageSparseGather 3866 3867 2187 + 3869: 7(f16vec4) CompositeExtract 3868 1 + Store 3832(texel) 3869 + 3870: 47(int) CompositeExtract 3868 0 + 3871: 299 Load 301(sCubeArray) + 3872: 7(f16vec4) Load 309(f16c4) + 3873:6(float16_t) Load 137(f16bias) + 3874:3102(ResType) ImageSparseGather 3871 3872 2187 Bias 3873 + 3875: 7(f16vec4) CompositeExtract 3874 1 + Store 3832(texel) 3875 + 3876: 47(int) CompositeExtract 3874 0 + 3877: 357 Load 359(s2DRect) + 3878: 53(fvec2) Load 148(c2) + 3879:3102(ResType) ImageSparseGather 3877 3878 2187 + 3880: 7(f16vec4) CompositeExtract 3879 1 + Store 3832(texel) 3880 + 3881: 47(int) CompositeExtract 3879 0 + 3882: 357 Load 359(s2DRect) + 3883:154(f16vec2) Load 156(f16c2) + 3884:3102(ResType) ImageSparseGather 3882 3883 2187 + 3885: 7(f16vec4) CompositeExtract 3884 1 + Store 3832(texel) 3885 + 3886: 47(int) CompositeExtract 3884 0 + 3887: 224 Load 226(s2DShadow) + 3888: 53(fvec2) Load 148(c2) + 3889: 52(float) Load 215(compare) + 3890:3102(ResType) ImageSparseDrefGather 3887 3888 3889 + 3891: 7(f16vec4) CompositeExtract 3890 1 + Store 3832(texel) 3891 + 3892: 47(int) CompositeExtract 3890 0 + 3893: 224 Load 226(s2DShadow) + 3894:154(f16vec2) Load 156(f16c2) + 3895: 52(float) Load 215(compare) + 3896:3102(ResType) ImageSparseDrefGather 3893 3894 3895 + 3897: 7(f16vec4) CompositeExtract 3896 1 + Store 3832(texel) 3897 + 3898: 47(int) CompositeExtract 3896 0 + 3899: 337 Load 339(s2DArrayShadow) + 3900: 167(fvec3) Load 169(c3) + 3901: 52(float) Load 215(compare) + 3902:3102(ResType) ImageSparseDrefGather 3899 3900 3901 + 3903: 7(f16vec4) CompositeExtract 3902 1 + Store 3832(texel) 3903 + 3904: 47(int) CompositeExtract 3902 0 + 3905: 337 Load 339(s2DArrayShadow) + 3906:175(f16vec3) Load 177(f16c3) + 3907: 52(float) Load 215(compare) + 3908:3102(ResType) ImageSparseDrefGather 3905 3906 3907 + 3909: 7(f16vec4) CompositeExtract 3908 1 + Store 3832(texel) 3909 + 3910: 47(int) CompositeExtract 3908 0 + 3911: 245 Load 247(sCubeShadow) + 3912: 167(fvec3) Load 169(c3) + 3913: 52(float) Load 215(compare) + 3914:3102(ResType) ImageSparseDrefGather 3911 3912 3913 + 3915: 7(f16vec4) CompositeExtract 3914 1 + Store 3832(texel) 3915 + 3916: 47(int) CompositeExtract 3914 0 + 3917: 245 Load 247(sCubeShadow) + 3918:175(f16vec3) Load 177(f16c3) + 3919: 52(float) Load 215(compare) + 3920:3102(ResType) ImageSparseDrefGather 3917 3918 3919 + 3921: 7(f16vec4) CompositeExtract 3920 1 + Store 3832(texel) 3921 + 3922: 47(int) CompositeExtract 3920 0 + 3923: 391 Load 393(sCubeArrayShadow) + 3924: 249(fvec4) Load 251(c4) + 3925: 52(float) Load 215(compare) + 3926:3102(ResType) ImageSparseDrefGather 3923 3924 3925 + 3927: 7(f16vec4) CompositeExtract 3926 1 + Store 3832(texel) 3927 + 3928: 47(int) CompositeExtract 3926 0 + 3929: 391 Load 393(sCubeArrayShadow) + 3930: 7(f16vec4) Load 309(f16c4) + 3931: 52(float) Load 215(compare) + 3932:3102(ResType) ImageSparseDrefGather 3929 3930 3931 + 3933: 7(f16vec4) CompositeExtract 3932 1 + Store 3832(texel) 3933 + 3934: 47(int) CompositeExtract 3932 0 + 3935: 371 Load 373(s2DRectShadow) + 3936: 53(fvec2) Load 148(c2) + 3937: 52(float) Load 215(compare) + 3938:3102(ResType) ImageSparseDrefGather 3935 3936 3937 + 3939: 7(f16vec4) CompositeExtract 3938 1 + Store 3832(texel) 3939 + 3940: 47(int) CompositeExtract 3938 0 + 3941: 371 Load 373(s2DRectShadow) + 3942:154(f16vec2) Load 156(f16c2) + 3943: 52(float) Load 215(compare) + 3944:3102(ResType) ImageSparseDrefGather 3941 3942 3943 + 3945: 7(f16vec4) CompositeExtract 3944 1 + Store 3832(texel) 3945 + 3946: 47(int) CompositeExtract 3944 0 + 3947: 7(f16vec4) Load 3832(texel) + ReturnValue 3947 + FunctionEnd +87(testSparseTextureGatherOffset(): 7(f16vec4) Function None 8 + 88: Label + 3950(texel): 64(ptr) Variable Function + Store 3950(texel) 121 + 3951: 143 Load 145(s2D) + 3952: 53(fvec2) Load 148(c2) + 3953:3102(ResType) ImageSparseGather 3951 3952 2187 ConstOffset 722 + 3954: 7(f16vec4) CompositeExtract 3953 1 + Store 3950(texel) 3954 + 3955: 47(int) CompositeExtract 3953 0 + 3956: 143 Load 145(s2D) + 3957:154(f16vec2) Load 156(f16c2) + 3958:6(float16_t) Load 137(f16bias) + 3959:3102(ResType) ImageSparseGather 3956 3957 2187 Bias ConstOffset 3958 722 + 3960: 7(f16vec4) CompositeExtract 3959 1 + Store 3950(texel) 3960 + 3961: 47(int) CompositeExtract 3959 0 + 3962: 284 Load 286(s2DArray) + 3963: 167(fvec3) Load 169(c3) + 3964:3102(ResType) ImageSparseGather 3962 3963 2187 ConstOffset 722 + 3965: 7(f16vec4) CompositeExtract 3964 1 + Store 3950(texel) 3965 + 3966: 47(int) CompositeExtract 3964 0 + 3967: 284 Load 286(s2DArray) + 3968:175(f16vec3) Load 177(f16c3) + 3969:6(float16_t) Load 137(f16bias) + 3970:3102(ResType) ImageSparseGather 3967 3968 2187 Bias ConstOffset 3969 722 + 3971: 7(f16vec4) CompositeExtract 3970 1 + Store 3950(texel) 3971 + 3972: 47(int) CompositeExtract 3970 0 + 3973: 357 Load 359(s2DRect) + 3974: 53(fvec2) Load 148(c2) + 3975:3102(ResType) ImageSparseGather 3973 3974 2187 ConstOffset 722 + 3976: 7(f16vec4) CompositeExtract 3975 1 + Store 3950(texel) 3976 + 3977: 47(int) CompositeExtract 3975 0 + 3978: 357 Load 359(s2DRect) + 3979:154(f16vec2) Load 156(f16c2) + 3980:3102(ResType) ImageSparseGather 3978 3979 2187 ConstOffset 722 + 3981: 7(f16vec4) CompositeExtract 3980 1 + Store 3950(texel) 3981 + 3982: 47(int) CompositeExtract 3980 0 + 3983: 224 Load 226(s2DShadow) + 3984: 53(fvec2) Load 148(c2) + 3985: 52(float) Load 215(compare) + 3986:3102(ResType) ImageSparseDrefGather 3983 3984 3985 ConstOffset 722 + 3987: 7(f16vec4) CompositeExtract 3986 1 + Store 3950(texel) 3987 + 3988: 47(int) CompositeExtract 3986 0 + 3989: 224 Load 226(s2DShadow) + 3990:154(f16vec2) Load 156(f16c2) + 3991: 52(float) Load 215(compare) + 3992:3102(ResType) ImageSparseDrefGather 3989 3990 3991 ConstOffset 722 + 3993: 7(f16vec4) CompositeExtract 3992 1 + Store 3950(texel) 3993 + 3994: 47(int) CompositeExtract 3992 0 + 3995: 337 Load 339(s2DArrayShadow) + 3996: 167(fvec3) Load 169(c3) + 3997: 52(float) Load 215(compare) + 3998:3102(ResType) ImageSparseDrefGather 3995 3996 3997 ConstOffset 722 + 3999: 7(f16vec4) CompositeExtract 3998 1 + Store 3950(texel) 3999 + 4000: 47(int) CompositeExtract 3998 0 + 4001: 337 Load 339(s2DArrayShadow) + 4002:175(f16vec3) Load 177(f16c3) + 4003: 52(float) Load 215(compare) + 4004:3102(ResType) ImageSparseDrefGather 4001 4002 4003 ConstOffset 722 + 4005: 7(f16vec4) CompositeExtract 4004 1 + Store 3950(texel) 4005 + 4006: 47(int) CompositeExtract 4004 0 + 4007: 371 Load 373(s2DRectShadow) + 4008: 53(fvec2) Load 148(c2) + 4009: 52(float) Load 215(compare) + 4010:3102(ResType) ImageSparseDrefGather 4007 4008 4009 ConstOffset 722 + 4011: 7(f16vec4) CompositeExtract 4010 1 + Store 3950(texel) 4011 + 4012: 47(int) CompositeExtract 4010 0 + 4013: 371 Load 373(s2DRectShadow) + 4014:154(f16vec2) Load 156(f16c2) + 4015: 52(float) Load 215(compare) + 4016:3102(ResType) ImageSparseDrefGather 4013 4014 4015 ConstOffset 722 + 4017: 7(f16vec4) CompositeExtract 4016 1 + Store 3950(texel) 4017 + 4018: 47(int) CompositeExtract 4016 0 + 4019: 7(f16vec4) Load 3950(texel) + ReturnValue 4019 + FunctionEnd +89(testSparseTextureGatherOffsets(): 7(f16vec4) Function None 8 + 90: Label + 4022(texel): 64(ptr) Variable Function + Store 4022(texel) 121 + 4023: 143 Load 145(s2D) + 4024: 53(fvec2) Load 148(c2) + 4025:3102(ResType) ImageSparseGather 4023 4024 2187 ConstOffsets 2380 + 4026: 7(f16vec4) CompositeExtract 4025 1 + Store 4022(texel) 4026 + 4027: 47(int) CompositeExtract 4025 0 + 4028: 143 Load 145(s2D) + 4029:154(f16vec2) Load 156(f16c2) + 4030:6(float16_t) Load 137(f16bias) + 4031:3102(ResType) ImageSparseGather 4028 4029 2187 Bias ConstOffsets 4030 2380 + 4032: 7(f16vec4) CompositeExtract 4031 1 + Store 4022(texel) 4032 + 4033: 47(int) CompositeExtract 4031 0 + 4034: 284 Load 286(s2DArray) + 4035: 167(fvec3) Load 169(c3) + 4036:3102(ResType) ImageSparseGather 4034 4035 2187 ConstOffsets 2380 + 4037: 7(f16vec4) CompositeExtract 4036 1 + Store 4022(texel) 4037 + 4038: 47(int) CompositeExtract 4036 0 + 4039: 284 Load 286(s2DArray) + 4040:175(f16vec3) Load 177(f16c3) + 4041:6(float16_t) Load 137(f16bias) + 4042:3102(ResType) ImageSparseGather 4039 4040 2187 Bias ConstOffsets 4041 2380 + 4043: 7(f16vec4) CompositeExtract 4042 1 + Store 4022(texel) 4043 + 4044: 47(int) CompositeExtract 4042 0 + 4045: 357 Load 359(s2DRect) + 4046: 53(fvec2) Load 148(c2) + 4047:3102(ResType) ImageSparseGather 4045 4046 2187 ConstOffsets 2380 + 4048: 7(f16vec4) CompositeExtract 4047 1 + Store 4022(texel) 4048 + 4049: 47(int) CompositeExtract 4047 0 + 4050: 357 Load 359(s2DRect) + 4051:154(f16vec2) Load 156(f16c2) + 4052:3102(ResType) ImageSparseGather 4050 4051 2187 ConstOffsets 2380 + 4053: 7(f16vec4) CompositeExtract 4052 1 + Store 4022(texel) 4053 + 4054: 47(int) CompositeExtract 4052 0 + 4055: 224 Load 226(s2DShadow) + 4056: 53(fvec2) Load 148(c2) + 4057: 52(float) Load 215(compare) + 4058:3102(ResType) ImageSparseDrefGather 4055 4056 4057 ConstOffsets 2380 + 4059: 7(f16vec4) CompositeExtract 4058 1 + Store 4022(texel) 4059 + 4060: 47(int) CompositeExtract 4058 0 + 4061: 224 Load 226(s2DShadow) + 4062:154(f16vec2) Load 156(f16c2) + 4063: 52(float) Load 215(compare) + 4064:3102(ResType) ImageSparseDrefGather 4061 4062 4063 ConstOffsets 2380 + 4065: 7(f16vec4) CompositeExtract 4064 1 + Store 4022(texel) 4065 + 4066: 47(int) CompositeExtract 4064 0 + 4067: 337 Load 339(s2DArrayShadow) + 4068: 167(fvec3) Load 169(c3) + 4069: 52(float) Load 215(compare) + 4070:3102(ResType) ImageSparseDrefGather 4067 4068 4069 ConstOffsets 2380 + 4071: 7(f16vec4) CompositeExtract 4070 1 + Store 4022(texel) 4071 + 4072: 47(int) CompositeExtract 4070 0 + 4073: 337 Load 339(s2DArrayShadow) + 4074:175(f16vec3) Load 177(f16c3) + 4075: 52(float) Load 215(compare) + 4076:3102(ResType) ImageSparseDrefGather 4073 4074 4075 ConstOffsets 2380 + 4077: 7(f16vec4) CompositeExtract 4076 1 + Store 4022(texel) 4077 + 4078: 47(int) CompositeExtract 4076 0 + 4079: 371 Load 373(s2DRectShadow) + 4080: 53(fvec2) Load 148(c2) + 4081: 52(float) Load 215(compare) + 4082:3102(ResType) ImageSparseDrefGather 4079 4080 4081 ConstOffsets 2380 + 4083: 7(f16vec4) CompositeExtract 4082 1 + Store 4022(texel) 4083 + 4084: 47(int) CompositeExtract 4082 0 + 4085: 371 Load 373(s2DRectShadow) + 4086:154(f16vec2) Load 156(f16c2) + 4087: 52(float) Load 215(compare) + 4088:3102(ResType) ImageSparseDrefGather 4085 4086 4087 ConstOffsets 2380 + 4089: 7(f16vec4) CompositeExtract 4088 1 + Store 4022(texel) 4089 + 4090: 47(int) CompositeExtract 4088 0 + 4091: 7(f16vec4) Load 4022(texel) + ReturnValue 4091 + FunctionEnd +91(testSparseTextureGatherLod(): 7(f16vec4) Function None 8 + 92: Label + 4094(texel): 64(ptr) Variable Function + Store 4094(texel) 121 + 4095: 143 Load 145(s2D) + 4096: 53(fvec2) Load 148(c2) + 4097: 52(float) Load 565(lod) + 4098:3102(ResType) ImageSparseGather 4095 4096 2187 Lod 4097 + 4099: 7(f16vec4) CompositeExtract 4098 1 + Store 4094(texel) 4099 + 4100: 47(int) CompositeExtract 4098 0 + 4101: 143 Load 145(s2D) + 4102:154(f16vec2) Load 156(f16c2) + 4103:6(float16_t) Load 572(f16lod) + 4104:3102(ResType) ImageSparseGather 4101 4102 2187 Lod 4103 + 4105: 7(f16vec4) CompositeExtract 4104 1 + Store 4094(texel) 4105 + 4106: 47(int) CompositeExtract 4104 0 + 4107: 284 Load 286(s2DArray) + 4108: 167(fvec3) Load 169(c3) + 4109: 52(float) Load 565(lod) + 4110:3102(ResType) ImageSparseGather 4107 4108 2187 Lod 4109 + 4111: 7(f16vec4) CompositeExtract 4110 1 + Store 4094(texel) 4111 + 4112: 47(int) CompositeExtract 4110 0 + 4113: 284 Load 286(s2DArray) + 4114:175(f16vec3) Load 177(f16c3) + 4115:6(float16_t) Load 572(f16lod) + 4116:3102(ResType) ImageSparseGather 4113 4114 2187 Lod 4115 + 4117: 7(f16vec4) CompositeExtract 4116 1 + Store 4094(texel) 4117 + 4118: 47(int) CompositeExtract 4116 0 + 4119: 184 Load 186(sCube) + 4120: 167(fvec3) Load 169(c3) + 4121: 52(float) Load 565(lod) + 4122:3102(ResType) ImageSparseGather 4119 4120 2187 Lod 4121 + 4123: 7(f16vec4) CompositeExtract 4122 1 + Store 4094(texel) 4123 + 4124: 47(int) CompositeExtract 4122 0 + 4125: 184 Load 186(sCube) + 4126:175(f16vec3) Load 177(f16c3) + 4127:6(float16_t) Load 572(f16lod) + 4128:3102(ResType) ImageSparseGather 4125 4126 2187 Lod 4127 + 4129: 7(f16vec4) CompositeExtract 4128 1 + Store 4094(texel) 4129 + 4130: 47(int) CompositeExtract 4128 0 + 4131: 299 Load 301(sCubeArray) + 4132: 249(fvec4) Load 251(c4) + 4133: 52(float) Load 565(lod) + 4134:3102(ResType) ImageSparseGather 4131 4132 2187 Lod 4133 + 4135: 7(f16vec4) CompositeExtract 4134 1 + Store 4094(texel) 4135 + 4136: 47(int) CompositeExtract 4134 0 + 4137: 299 Load 301(sCubeArray) + 4138: 7(f16vec4) Load 309(f16c4) + 4139:6(float16_t) Load 572(f16lod) + 4140:3102(ResType) ImageSparseGather 4137 4138 2187 Lod 4139 + 4141: 7(f16vec4) CompositeExtract 4140 1 + Store 4094(texel) 4141 + 4142: 47(int) CompositeExtract 4140 0 + 4143: 7(f16vec4) Load 4094(texel) + ReturnValue 4143 + FunctionEnd +93(testSparseTextureGatherLodOffset(): 7(f16vec4) Function None 8 + 94: Label + 4146(texel): 64(ptr) Variable Function + Store 4146(texel) 121 + 4147: 143 Load 145(s2D) + 4148: 53(fvec2) Load 148(c2) + 4149: 52(float) Load 565(lod) + 4150:3102(ResType) ImageSparseGather 4147 4148 2187 Lod ConstOffset 4149 722 + 4151: 7(f16vec4) CompositeExtract 4150 1 + Store 4146(texel) 4151 + 4152: 47(int) CompositeExtract 4150 0 + 4153: 143 Load 145(s2D) + 4154:154(f16vec2) Load 156(f16c2) + 4155:6(float16_t) Load 572(f16lod) + 4156:3102(ResType) ImageSparseGather 4153 4154 2187 Lod ConstOffset 4155 722 + 4157: 7(f16vec4) CompositeExtract 4156 1 + Store 4146(texel) 4157 + 4158: 47(int) CompositeExtract 4156 0 + 4159: 284 Load 286(s2DArray) + 4160: 167(fvec3) Load 169(c3) + 4161: 52(float) Load 565(lod) + 4162:3102(ResType) ImageSparseGather 4159 4160 2187 Lod ConstOffset 4161 722 + 4163: 7(f16vec4) CompositeExtract 4162 1 + Store 4146(texel) 4163 + 4164: 47(int) CompositeExtract 4162 0 + 4165: 284 Load 286(s2DArray) + 4166:175(f16vec3) Load 177(f16c3) + 4167:6(float16_t) Load 572(f16lod) + 4168:3102(ResType) ImageSparseGather 4165 4166 2187 Lod ConstOffset 4167 722 + 4169: 7(f16vec4) CompositeExtract 4168 1 + Store 4146(texel) 4169 + 4170: 47(int) CompositeExtract 4168 0 + 4171: 7(f16vec4) Load 4146(texel) + ReturnValue 4171 + FunctionEnd +95(testSparseTextureGatherLodOffsets(): 7(f16vec4) Function None 8 + 96: Label + 4174(texel): 64(ptr) Variable Function + Store 4174(texel) 121 + 4175: 143 Load 145(s2D) + 4176: 53(fvec2) Load 148(c2) + 4177: 52(float) Load 565(lod) + 4178:3102(ResType) ImageSparseGather 4175 4176 2187 Lod ConstOffsets 4177 2380 + 4179: 7(f16vec4) CompositeExtract 4178 1 + Store 4174(texel) 4179 + 4180: 47(int) CompositeExtract 4178 0 + 4181: 143 Load 145(s2D) + 4182:154(f16vec2) Load 156(f16c2) + 4183:6(float16_t) Load 572(f16lod) + 4184:3102(ResType) ImageSparseGather 4181 4182 2187 Lod ConstOffsets 4183 2380 + 4185: 7(f16vec4) CompositeExtract 4184 1 + Store 4174(texel) 4185 + 4186: 47(int) CompositeExtract 4184 0 + 4187: 284 Load 286(s2DArray) + 4188: 167(fvec3) Load 169(c3) + 4189: 52(float) Load 565(lod) + 4190:3102(ResType) ImageSparseGather 4187 4188 2187 Lod ConstOffsets 4189 2380 + 4191: 7(f16vec4) CompositeExtract 4190 1 + Store 4174(texel) 4191 + 4192: 47(int) CompositeExtract 4190 0 + 4193: 284 Load 286(s2DArray) + 4194:175(f16vec3) Load 177(f16c3) + 4195:6(float16_t) Load 572(f16lod) + 4196:3102(ResType) ImageSparseGather 4193 4194 2187 Lod ConstOffsets 4195 2380 + 4197: 7(f16vec4) CompositeExtract 4196 1 + Store 4174(texel) 4197 + 4198: 47(int) CompositeExtract 4196 0 + 4199: 7(f16vec4) Load 4174(texel) + ReturnValue 4199 + FunctionEnd +97(testSparseImageLoad(): 7(f16vec4) Function None 8 + 98: Label + 4202(texel): 64(ptr) Variable Function + Store 4202(texel) 121 + 4203: 2962 Load 2964(i2D) + 4204: 53(fvec2) Load 148(c2) + 4205: 721(ivec2) ConvertFToS 4204 + 4206:3102(ResType) ImageSparseRead 4203 4205 + 4207: 7(f16vec4) CompositeExtract 4206 1 + Store 4202(texel) 4207 + 4208: 47(int) CompositeExtract 4206 0 + 4209: 2971 Load 2973(i3D) + 4210: 167(fvec3) Load 169(c3) + 4211: 734(ivec3) ConvertFToS 4210 + 4212:3102(ResType) ImageSparseRead 4209 4211 + 4213: 7(f16vec4) CompositeExtract 4212 1 + Store 4202(texel) 4213 + 4214: 47(int) CompositeExtract 4212 0 + 4215: 2980 Load 2982(i2DRect) + 4216: 53(fvec2) Load 148(c2) + 4217: 721(ivec2) ConvertFToS 4216 + 4218:3102(ResType) ImageSparseRead 4215 4217 + 4219: 7(f16vec4) CompositeExtract 4218 1 + Store 4202(texel) 4219 + 4220: 47(int) CompositeExtract 4218 0 + 4221: 2989 Load 2991(iCube) + 4222: 167(fvec3) Load 169(c3) + 4223: 734(ivec3) ConvertFToS 4222 + 4224:3102(ResType) ImageSparseRead 4221 4223 + 4225: 7(f16vec4) CompositeExtract 4224 1 + Store 4202(texel) 4225 + 4226: 47(int) CompositeExtract 4224 0 + 4227: 3016 Load 3018(i2DArray) + 4228: 167(fvec3) Load 169(c3) + 4229: 734(ivec3) ConvertFToS 4228 + 4230:3102(ResType) ImageSparseRead 4227 4229 + 4231: 7(f16vec4) CompositeExtract 4230 1 + Store 4202(texel) 4231 + 4232: 47(int) CompositeExtract 4230 0 + 4233: 3025 Load 3027(iCubeArray) + 4234: 167(fvec3) Load 169(c3) + 4235: 734(ivec3) ConvertFToS 4234 + 4236:3102(ResType) ImageSparseRead 4233 4235 + 4237: 7(f16vec4) CompositeExtract 4236 1 + Store 4202(texel) 4237 + 4238: 47(int) CompositeExtract 4236 0 + 4239: 3034 Load 3036(i2DMS) + 4240: 53(fvec2) Load 148(c2) + 4241: 721(ivec2) ConvertFToS 4240 + 4242:3102(ResType) ImageSparseRead 4239 4241 Sample 709 + 4243: 7(f16vec4) CompositeExtract 4242 1 + Store 4202(texel) 4243 + 4244: 47(int) CompositeExtract 4242 0 + 4245: 3043 Load 3045(i2DMSArray) + 4246: 167(fvec3) Load 169(c3) + 4247: 734(ivec3) ConvertFToS 4246 + 4248:3102(ResType) ImageSparseRead 4245 4247 Sample 1326 + 4249: 7(f16vec4) CompositeExtract 4248 1 + Store 4202(texel) 4249 + 4250: 47(int) CompositeExtract 4248 0 + 4251: 7(f16vec4) Load 4202(texel) + ReturnValue 4251 + FunctionEnd +99(testSparseTextureClamp(): 7(f16vec4) Function None 8 + 100: Label + 4254(texel): 64(ptr) Variable Function + Store 4254(texel) 121 + 4255: 143 Load 145(s2D) + 4256: 53(fvec2) Load 148(c2) + 4258: 52(float) Load 4257(lodClamp) + 4259:3102(ResType) ImageSparseSampleImplicitLod 4255 4256 MinLod 4258 + 4260: 7(f16vec4) CompositeExtract 4259 1 + Store 4254(texel) 4260 + 4261: 47(int) CompositeExtract 4259 0 + 4262: 143 Load 145(s2D) + 4263:154(f16vec2) Load 156(f16c2) + 4265:6(float16_t) Load 4264(f16lodClamp) + 4266:6(float16_t) Load 137(f16bias) + 4267:3102(ResType) ImageSparseSampleImplicitLod 4262 4263 Bias MinLod 4266 4265 + 4268: 7(f16vec4) CompositeExtract 4267 1 + Store 4254(texel) 4268 + 4269: 47(int) CompositeExtract 4267 0 + 4270: 163 Load 165(s3D) + 4271: 167(fvec3) Load 169(c3) + 4272: 52(float) Load 4257(lodClamp) + 4273:3102(ResType) ImageSparseSampleImplicitLod 4270 4271 MinLod 4272 + 4274: 7(f16vec4) CompositeExtract 4273 1 + Store 4254(texel) 4274 + 4275: 47(int) CompositeExtract 4273 0 + 4276: 163 Load 165(s3D) + 4277:175(f16vec3) Load 177(f16c3) + 4278:6(float16_t) Load 4264(f16lodClamp) + 4279:6(float16_t) Load 137(f16bias) + 4280:3102(ResType) ImageSparseSampleImplicitLod 4276 4277 Bias MinLod 4279 4278 + 4281: 7(f16vec4) CompositeExtract 4280 1 + Store 4254(texel) 4281 + 4282: 47(int) CompositeExtract 4280 0 + 4283: 184 Load 186(sCube) + 4284: 167(fvec3) Load 169(c3) + 4285: 52(float) Load 4257(lodClamp) + 4286:3102(ResType) ImageSparseSampleImplicitLod 4283 4284 MinLod 4285 + 4287: 7(f16vec4) CompositeExtract 4286 1 + Store 4254(texel) 4287 + 4288: 47(int) CompositeExtract 4286 0 + 4289: 184 Load 186(sCube) + 4290:175(f16vec3) Load 177(f16c3) + 4291:6(float16_t) Load 4264(f16lodClamp) + 4292:6(float16_t) Load 137(f16bias) + 4293:3102(ResType) ImageSparseSampleImplicitLod 4289 4290 Bias MinLod 4292 4291 + 4294: 7(f16vec4) CompositeExtract 4293 1 + Store 4254(texel) 4294 + 4295: 47(int) CompositeExtract 4293 0 + 4296: 224 Load 226(s2DShadow) + 4297: 167(fvec3) Load 169(c3) + 4298: 52(float) Load 4257(lodClamp) + 4299: 208(ptr) AccessChain 4254(texel) 207 + 4300: 52(float) CompositeExtract 4297 2 + 4301:3138(ResType) ImageSparseSampleDrefImplicitLod 4296 4297 4300 MinLod 4298 + 4302:6(float16_t) CompositeExtract 4301 1 + Store 4299 4302 + 4303: 47(int) CompositeExtract 4301 0 + 4304: 224 Load 226(s2DShadow) + 4305:154(f16vec2) Load 156(f16c2) + 4306: 52(float) Load 215(compare) + 4307:6(float16_t) Load 4264(f16lodClamp) + 4308: 208(ptr) AccessChain 4254(texel) 207 + 4309:6(float16_t) Load 137(f16bias) + 4310:3138(ResType) ImageSparseSampleDrefImplicitLod 4304 4305 4306 Bias MinLod 4309 4307 + 4311:6(float16_t) CompositeExtract 4310 1 + Store 4308 4311 + 4312: 47(int) CompositeExtract 4310 0 + 4313: 245 Load 247(sCubeShadow) + 4314: 249(fvec4) Load 251(c4) + 4315: 52(float) Load 4257(lodClamp) + 4316: 208(ptr) AccessChain 4254(texel) 207 + 4317: 52(float) CompositeExtract 4314 3 + 4318:3138(ResType) ImageSparseSampleDrefImplicitLod 4313 4314 4317 MinLod 4315 + 4319:6(float16_t) CompositeExtract 4318 1 + Store 4316 4319 + 4320: 47(int) CompositeExtract 4318 0 + 4321: 245 Load 247(sCubeShadow) + 4322:175(f16vec3) Load 177(f16c3) + 4323: 52(float) Load 215(compare) + 4324:6(float16_t) Load 4264(f16lodClamp) + 4325: 208(ptr) AccessChain 4254(texel) 207 + 4326:6(float16_t) Load 137(f16bias) + 4327:3138(ResType) ImageSparseSampleDrefImplicitLod 4321 4322 4323 Bias MinLod 4326 4324 + 4328:6(float16_t) CompositeExtract 4327 1 + Store 4325 4328 + 4329: 47(int) CompositeExtract 4327 0 + 4330: 284 Load 286(s2DArray) + 4331: 167(fvec3) Load 169(c3) + 4332: 52(float) Load 4257(lodClamp) + 4333:3102(ResType) ImageSparseSampleImplicitLod 4330 4331 MinLod 4332 + 4334: 7(f16vec4) CompositeExtract 4333 1 + Store 4254(texel) 4334 + 4335: 47(int) CompositeExtract 4333 0 + 4336: 284 Load 286(s2DArray) + 4337:175(f16vec3) Load 177(f16c3) + 4338:6(float16_t) Load 4264(f16lodClamp) + 4339:6(float16_t) Load 137(f16bias) + 4340:3102(ResType) ImageSparseSampleImplicitLod 4336 4337 Bias MinLod 4339 4338 + 4341: 7(f16vec4) CompositeExtract 4340 1 + Store 4254(texel) 4341 + 4342: 47(int) CompositeExtract 4340 0 + 4343: 299 Load 301(sCubeArray) + 4344: 249(fvec4) Load 251(c4) + 4345: 52(float) Load 4257(lodClamp) + 4346:3102(ResType) ImageSparseSampleImplicitLod 4343 4344 MinLod 4345 + 4347: 7(f16vec4) CompositeExtract 4346 1 + Store 4254(texel) 4347 + 4348: 47(int) CompositeExtract 4346 0 + 4349: 299 Load 301(sCubeArray) + 4350: 7(f16vec4) Load 309(f16c4) + 4351:6(float16_t) Load 4264(f16lodClamp) + 4352:6(float16_t) Load 137(f16bias) + 4353:3102(ResType) ImageSparseSampleImplicitLod 4349 4350 Bias MinLod 4352 4351 + 4354: 7(f16vec4) CompositeExtract 4353 1 + Store 4254(texel) 4354 + 4355: 47(int) CompositeExtract 4353 0 + 4356: 337 Load 339(s2DArrayShadow) + 4357: 249(fvec4) Load 251(c4) + 4358: 52(float) Load 4257(lodClamp) + 4359: 208(ptr) AccessChain 4254(texel) 207 + 4360: 52(float) CompositeExtract 4357 3 + 4361:3138(ResType) ImageSparseSampleDrefImplicitLod 4356 4357 4360 MinLod 4358 + 4362:6(float16_t) CompositeExtract 4361 1 + Store 4359 4362 + 4363: 47(int) CompositeExtract 4361 0 + 4364: 337 Load 339(s2DArrayShadow) + 4365:175(f16vec3) Load 177(f16c3) + 4366: 52(float) Load 215(compare) + 4367:6(float16_t) Load 4264(f16lodClamp) + 4368: 208(ptr) AccessChain 4254(texel) 207 + 4369:3138(ResType) ImageSparseSampleDrefImplicitLod 4364 4365 4366 MinLod 4367 + 4370:6(float16_t) CompositeExtract 4369 1 + Store 4368 4370 + 4371: 47(int) CompositeExtract 4369 0 + 4372: 391 Load 393(sCubeArrayShadow) + 4373: 249(fvec4) Load 251(c4) + 4374: 52(float) Load 215(compare) + 4375: 52(float) Load 4257(lodClamp) + 4376: 208(ptr) AccessChain 4254(texel) 207 + 4377:3138(ResType) ImageSparseSampleDrefImplicitLod 4372 4373 4374 MinLod 4375 + 4378:6(float16_t) CompositeExtract 4377 1 + Store 4376 4378 + 4379: 47(int) CompositeExtract 4377 0 + 4380: 391 Load 393(sCubeArrayShadow) + 4381: 7(f16vec4) Load 309(f16c4) + 4382: 52(float) Load 215(compare) + 4383:6(float16_t) Load 4264(f16lodClamp) + 4384: 208(ptr) AccessChain 4254(texel) 207 + 4385:3138(ResType) ImageSparseSampleDrefImplicitLod 4380 4381 4382 MinLod 4383 + 4386:6(float16_t) CompositeExtract 4385 1 + Store 4384 4386 + 4387: 47(int) CompositeExtract 4385 0 + 4388: 7(f16vec4) Load 4254(texel) + ReturnValue 4388 + FunctionEnd +101(testTextureClamp(): 7(f16vec4) Function None 8 + 102: Label + 4391(texel): 64(ptr) Variable Function + Store 4391(texel) 121 + 4392: 123 Load 125(s1D) + 4393: 52(float) Load 128(c1) + 4394: 52(float) Load 4257(lodClamp) + 4395: 7(f16vec4) ImageSampleImplicitLod 4392 4393 MinLod 4394 + 4396: 7(f16vec4) Load 4391(texel) + 4397: 7(f16vec4) FAdd 4396 4395 + Store 4391(texel) 4397 + 4398: 123 Load 125(s1D) + 4399:6(float16_t) Load 135(f16c1) + 4400:6(float16_t) Load 4264(f16lodClamp) + 4401:6(float16_t) Load 137(f16bias) + 4402: 7(f16vec4) ImageSampleImplicitLod 4398 4399 Bias MinLod 4401 4400 + 4403: 7(f16vec4) Load 4391(texel) + 4404: 7(f16vec4) FAdd 4403 4402 + Store 4391(texel) 4404 + 4405: 143 Load 145(s2D) + 4406: 53(fvec2) Load 148(c2) + 4407: 52(float) Load 4257(lodClamp) + 4408: 7(f16vec4) ImageSampleImplicitLod 4405 4406 MinLod 4407 + 4409: 7(f16vec4) Load 4391(texel) + 4410: 7(f16vec4) FAdd 4409 4408 + Store 4391(texel) 4410 + 4411: 143 Load 145(s2D) + 4412:154(f16vec2) Load 156(f16c2) + 4413:6(float16_t) Load 4264(f16lodClamp) + 4414:6(float16_t) Load 137(f16bias) + 4415: 7(f16vec4) ImageSampleImplicitLod 4411 4412 Bias MinLod 4414 4413 + 4416: 7(f16vec4) Load 4391(texel) + 4417: 7(f16vec4) FAdd 4416 4415 + Store 4391(texel) 4417 + 4418: 163 Load 165(s3D) + 4419: 167(fvec3) Load 169(c3) + 4420: 52(float) Load 4257(lodClamp) + 4421: 7(f16vec4) ImageSampleImplicitLod 4418 4419 MinLod 4420 + 4422: 7(f16vec4) Load 4391(texel) + 4423: 7(f16vec4) FAdd 4422 4421 + Store 4391(texel) 4423 + 4424: 163 Load 165(s3D) + 4425:175(f16vec3) Load 177(f16c3) + 4426:6(float16_t) Load 4264(f16lodClamp) + 4427:6(float16_t) Load 137(f16bias) + 4428: 7(f16vec4) ImageSampleImplicitLod 4424 4425 Bias MinLod 4427 4426 + 4429: 7(f16vec4) Load 4391(texel) + 4430: 7(f16vec4) FAdd 4429 4428 + Store 4391(texel) 4430 + 4431: 184 Load 186(sCube) + 4432: 167(fvec3) Load 169(c3) + 4433: 52(float) Load 4257(lodClamp) + 4434: 7(f16vec4) ImageSampleImplicitLod 4431 4432 MinLod 4433 + 4435: 7(f16vec4) Load 4391(texel) + 4436: 7(f16vec4) FAdd 4435 4434 + Store 4391(texel) 4436 + 4437: 184 Load 186(sCube) + 4438:175(f16vec3) Load 177(f16c3) + 4439:6(float16_t) Load 4264(f16lodClamp) + 4440:6(float16_t) Load 137(f16bias) + 4441: 7(f16vec4) ImageSampleImplicitLod 4437 4438 Bias MinLod 4440 4439 + 4442: 7(f16vec4) Load 4391(texel) + 4443: 7(f16vec4) FAdd 4442 4441 + Store 4391(texel) 4443 + 4444: 199 Load 201(s1DShadow) + 4445: 167(fvec3) Load 169(c3) + 4446: 52(float) Load 4257(lodClamp) + 4447: 52(float) CompositeExtract 4445 2 + 4448:6(float16_t) ImageSampleDrefImplicitLod 4444 4445 4447 MinLod 4446 + 4449: 208(ptr) AccessChain 4391(texel) 207 + 4450:6(float16_t) Load 4449 + 4451:6(float16_t) FAdd 4450 4448 + 4452: 208(ptr) AccessChain 4391(texel) 207 + Store 4452 4451 + 4453: 199 Load 201(s1DShadow) + 4454:154(f16vec2) Load 156(f16c2) + 4455: 52(float) Load 215(compare) + 4456:6(float16_t) Load 4264(f16lodClamp) + 4457:6(float16_t) Load 137(f16bias) + 4458:6(float16_t) ImageSampleDrefImplicitLod 4453 4454 4455 Bias MinLod 4457 4456 + 4459: 208(ptr) AccessChain 4391(texel) 207 + 4460:6(float16_t) Load 4459 + 4461:6(float16_t) FAdd 4460 4458 + 4462: 208(ptr) AccessChain 4391(texel) 207 + Store 4462 4461 + 4463: 224 Load 226(s2DShadow) + 4464: 167(fvec3) Load 169(c3) + 4465: 52(float) Load 4257(lodClamp) + 4466: 52(float) CompositeExtract 4464 2 + 4467:6(float16_t) ImageSampleDrefImplicitLod 4463 4464 4466 MinLod 4465 + 4468: 208(ptr) AccessChain 4391(texel) 207 + 4469:6(float16_t) Load 4468 + 4470:6(float16_t) FAdd 4469 4467 + 4471: 208(ptr) AccessChain 4391(texel) 207 + Store 4471 4470 + 4472: 224 Load 226(s2DShadow) + 4473:154(f16vec2) Load 156(f16c2) + 4474: 52(float) Load 215(compare) + 4475:6(float16_t) Load 4264(f16lodClamp) + 4476:6(float16_t) Load 137(f16bias) + 4477:6(float16_t) ImageSampleDrefImplicitLod 4472 4473 4474 Bias MinLod 4476 4475 + 4478: 208(ptr) AccessChain 4391(texel) 207 + 4479:6(float16_t) Load 4478 + 4480:6(float16_t) FAdd 4479 4477 + 4481: 208(ptr) AccessChain 4391(texel) 207 + Store 4481 4480 + 4482: 245 Load 247(sCubeShadow) + 4483: 249(fvec4) Load 251(c4) + 4484: 52(float) Load 4257(lodClamp) + 4485: 52(float) CompositeExtract 4483 3 + 4486:6(float16_t) ImageSampleDrefImplicitLod 4482 4483 4485 MinLod 4484 + 4487: 208(ptr) AccessChain 4391(texel) 207 + 4488:6(float16_t) Load 4487 + 4489:6(float16_t) FAdd 4488 4486 + 4490: 208(ptr) AccessChain 4391(texel) 207 + Store 4490 4489 + 4491: 245 Load 247(sCubeShadow) + 4492:175(f16vec3) Load 177(f16c3) + 4493: 52(float) Load 215(compare) + 4494:6(float16_t) Load 4264(f16lodClamp) + 4495:6(float16_t) Load 137(f16bias) + 4496:6(float16_t) ImageSampleDrefImplicitLod 4491 4492 4493 Bias MinLod 4495 4494 + 4497: 208(ptr) AccessChain 4391(texel) 207 + 4498:6(float16_t) Load 4497 + 4499:6(float16_t) FAdd 4498 4496 + 4500: 208(ptr) AccessChain 4391(texel) 207 + Store 4500 4499 + 4501: 269 Load 271(s1DArray) + 4502: 53(fvec2) Load 148(c2) + 4503: 52(float) Load 4257(lodClamp) + 4504: 7(f16vec4) ImageSampleImplicitLod 4501 4502 MinLod 4503 + 4505: 7(f16vec4) Load 4391(texel) + 4506: 7(f16vec4) FAdd 4505 4504 + Store 4391(texel) 4506 + 4507: 269 Load 271(s1DArray) + 4508:154(f16vec2) Load 156(f16c2) + 4509:6(float16_t) Load 4264(f16lodClamp) + 4510:6(float16_t) Load 137(f16bias) + 4511: 7(f16vec4) ImageSampleImplicitLod 4507 4508 Bias MinLod 4510 4509 + 4512: 7(f16vec4) Load 4391(texel) + 4513: 7(f16vec4) FAdd 4512 4511 + Store 4391(texel) 4513 + 4514: 284 Load 286(s2DArray) + 4515: 167(fvec3) Load 169(c3) + 4516: 52(float) Load 4257(lodClamp) + 4517: 7(f16vec4) ImageSampleImplicitLod 4514 4515 MinLod 4516 + 4518: 7(f16vec4) Load 4391(texel) + 4519: 7(f16vec4) FAdd 4518 4517 + Store 4391(texel) 4519 + 4520: 284 Load 286(s2DArray) + 4521:175(f16vec3) Load 177(f16c3) + 4522:6(float16_t) Load 4264(f16lodClamp) + 4523:6(float16_t) Load 137(f16bias) + 4524: 7(f16vec4) ImageSampleImplicitLod 4520 4521 Bias MinLod 4523 4522 + 4525: 7(f16vec4) Load 4391(texel) + 4526: 7(f16vec4) FAdd 4525 4524 + Store 4391(texel) 4526 + 4527: 299 Load 301(sCubeArray) + 4528: 249(fvec4) Load 251(c4) + 4529: 52(float) Load 4257(lodClamp) + 4530: 7(f16vec4) ImageSampleImplicitLod 4527 4528 MinLod 4529 + 4531: 7(f16vec4) Load 4391(texel) + 4532: 7(f16vec4) FAdd 4531 4530 + Store 4391(texel) 4532 + 4533: 299 Load 301(sCubeArray) + 4534: 7(f16vec4) Load 309(f16c4) + 4535:6(float16_t) Load 4264(f16lodClamp) + 4536:6(float16_t) Load 137(f16bias) + 4537: 7(f16vec4) ImageSampleImplicitLod 4533 4534 Bias MinLod 4536 4535 + 4538: 7(f16vec4) Load 4391(texel) + 4539: 7(f16vec4) FAdd 4538 4537 + Store 4391(texel) 4539 + 4540: 316 Load 318(s1DArrayShadow) + 4541: 167(fvec3) Load 169(c3) + 4542: 52(float) Load 4257(lodClamp) + 4543: 52(float) CompositeExtract 4541 2 + 4544:6(float16_t) ImageSampleDrefImplicitLod 4540 4541 4543 MinLod 4542 + 4545: 208(ptr) AccessChain 4391(texel) 207 + 4546:6(float16_t) Load 4545 + 4547:6(float16_t) FAdd 4546 4544 + 4548: 208(ptr) AccessChain 4391(texel) 207 + Store 4548 4547 + 4549: 316 Load 318(s1DArrayShadow) + 4550:154(f16vec2) Load 156(f16c2) + 4551: 52(float) Load 215(compare) + 4552:6(float16_t) Load 4264(f16lodClamp) + 4553:6(float16_t) Load 137(f16bias) + 4554:6(float16_t) ImageSampleDrefImplicitLod 4549 4550 4551 Bias MinLod 4553 4552 + 4555: 208(ptr) AccessChain 4391(texel) 207 + 4556:6(float16_t) Load 4555 + 4557:6(float16_t) FAdd 4556 4554 + 4558: 208(ptr) AccessChain 4391(texel) 207 + Store 4558 4557 + 4559: 337 Load 339(s2DArrayShadow) + 4560: 249(fvec4) Load 251(c4) + 4561: 52(float) Load 4257(lodClamp) + 4562: 52(float) CompositeExtract 4560 3 + 4563:6(float16_t) ImageSampleDrefImplicitLod 4559 4560 4562 MinLod 4561 + 4564: 208(ptr) AccessChain 4391(texel) 207 + 4565:6(float16_t) Load 4564 + 4566:6(float16_t) FAdd 4565 4563 + 4567: 208(ptr) AccessChain 4391(texel) 207 + Store 4567 4566 + 4568: 337 Load 339(s2DArrayShadow) + 4569:175(f16vec3) Load 177(f16c3) + 4570: 52(float) Load 215(compare) + 4571:6(float16_t) Load 4264(f16lodClamp) + 4572:6(float16_t) ImageSampleDrefImplicitLod 4568 4569 4570 MinLod 4571 + 4573: 208(ptr) AccessChain 4391(texel) 207 + 4574:6(float16_t) Load 4573 + 4575:6(float16_t) FAdd 4574 4572 + 4576: 208(ptr) AccessChain 4391(texel) 207 + Store 4576 4575 + 4577: 391 Load 393(sCubeArrayShadow) + 4578: 249(fvec4) Load 251(c4) + 4579: 52(float) Load 215(compare) + 4580: 52(float) Load 4257(lodClamp) + 4581:6(float16_t) ImageSampleDrefImplicitLod 4577 4578 4579 MinLod 4580 + 4582: 208(ptr) AccessChain 4391(texel) 207 + 4583:6(float16_t) Load 4582 + 4584:6(float16_t) FAdd 4583 4581 + 4585: 208(ptr) AccessChain 4391(texel) 207 + Store 4585 4584 + 4586: 391 Load 393(sCubeArrayShadow) + 4587: 7(f16vec4) Load 309(f16c4) + 4588: 52(float) Load 215(compare) + 4589:6(float16_t) Load 4264(f16lodClamp) + 4590:6(float16_t) ImageSampleDrefImplicitLod 4586 4587 4588 MinLod 4589 + 4591: 208(ptr) AccessChain 4391(texel) 207 + 4592:6(float16_t) Load 4591 + 4593:6(float16_t) FAdd 4592 4590 + 4594: 208(ptr) AccessChain 4391(texel) 207 + Store 4594 4593 + 4595: 7(f16vec4) Load 4391(texel) + ReturnValue 4595 + FunctionEnd +103(testSparseTextureOffsetClamp(): 7(f16vec4) Function None 8 + 104: Label + 4598(texel): 64(ptr) Variable Function + Store 4598(texel) 121 + 4599: 143 Load 145(s2D) + 4600: 53(fvec2) Load 148(c2) + 4601: 52(float) Load 4257(lodClamp) + 4602:3102(ResType) ImageSparseSampleImplicitLod 4599 4600 ConstOffset MinLod 722 4601 + 4603: 7(f16vec4) CompositeExtract 4602 1 + Store 4598(texel) 4603 + 4604: 47(int) CompositeExtract 4602 0 + 4605: 143 Load 145(s2D) + 4606:154(f16vec2) Load 156(f16c2) + 4607:6(float16_t) Load 4264(f16lodClamp) + 4608:6(float16_t) Load 137(f16bias) + 4609:3102(ResType) ImageSparseSampleImplicitLod 4605 4606 Bias ConstOffset MinLod 4608 722 4607 + 4610: 7(f16vec4) CompositeExtract 4609 1 + Store 4598(texel) 4610 + 4611: 47(int) CompositeExtract 4609 0 + 4612: 163 Load 165(s3D) + 4613: 167(fvec3) Load 169(c3) + 4614: 52(float) Load 4257(lodClamp) + 4615:3102(ResType) ImageSparseSampleImplicitLod 4612 4613 ConstOffset MinLod 735 4614 + 4616: 7(f16vec4) CompositeExtract 4615 1 + Store 4598(texel) 4616 + 4617: 47(int) CompositeExtract 4615 0 + 4618: 163 Load 165(s3D) + 4619:175(f16vec3) Load 177(f16c3) + 4620:6(float16_t) Load 4264(f16lodClamp) + 4621:6(float16_t) Load 137(f16bias) + 4622:3102(ResType) ImageSparseSampleImplicitLod 4618 4619 Bias ConstOffset MinLod 4621 735 4620 + 4623: 7(f16vec4) CompositeExtract 4622 1 + Store 4598(texel) 4623 + 4624: 47(int) CompositeExtract 4622 0 + 4625: 224 Load 226(s2DShadow) + 4626: 167(fvec3) Load 169(c3) + 4627: 52(float) Load 4257(lodClamp) + 4628: 208(ptr) AccessChain 4598(texel) 207 + 4629: 52(float) CompositeExtract 4626 2 + 4630:3138(ResType) ImageSparseSampleDrefImplicitLod 4625 4626 4629 ConstOffset MinLod 722 4627 + 4631:6(float16_t) CompositeExtract 4630 1 + Store 4628 4631 + 4632: 47(int) CompositeExtract 4630 0 + 4633: 224 Load 226(s2DShadow) + 4634:154(f16vec2) Load 156(f16c2) + 4635: 52(float) Load 215(compare) + 4636:6(float16_t) Load 4264(f16lodClamp) + 4637: 208(ptr) AccessChain 4598(texel) 207 + 4638:6(float16_t) Load 137(f16bias) + 4639:3138(ResType) ImageSparseSampleDrefImplicitLod 4633 4634 4635 Bias ConstOffset MinLod 4638 722 4636 + 4640:6(float16_t) CompositeExtract 4639 1 + Store 4637 4640 + 4641: 47(int) CompositeExtract 4639 0 + 4642: 284 Load 286(s2DArray) + 4643: 167(fvec3) Load 169(c3) + 4644: 52(float) Load 4257(lodClamp) + 4645:3102(ResType) ImageSparseSampleImplicitLod 4642 4643 ConstOffset MinLod 722 4644 + 4646: 7(f16vec4) CompositeExtract 4645 1 + Store 4598(texel) 4646 + 4647: 47(int) CompositeExtract 4645 0 + 4648: 284 Load 286(s2DArray) + 4649:175(f16vec3) Load 177(f16c3) + 4650:6(float16_t) Load 4264(f16lodClamp) + 4651:6(float16_t) Load 137(f16bias) + 4652:3102(ResType) ImageSparseSampleImplicitLod 4648 4649 Bias ConstOffset MinLod 4651 722 4650 + 4653: 7(f16vec4) CompositeExtract 4652 1 + Store 4598(texel) 4653 + 4654: 47(int) CompositeExtract 4652 0 + 4655: 337 Load 339(s2DArrayShadow) + 4656: 249(fvec4) Load 251(c4) + 4657: 52(float) Load 4257(lodClamp) + 4658: 208(ptr) AccessChain 4598(texel) 207 + 4659: 52(float) CompositeExtract 4656 3 + 4660:3138(ResType) ImageSparseSampleDrefImplicitLod 4655 4656 4659 ConstOffset MinLod 722 4657 + 4661:6(float16_t) CompositeExtract 4660 1 + Store 4658 4661 + 4662: 47(int) CompositeExtract 4660 0 + 4663: 337 Load 339(s2DArrayShadow) + 4664:175(f16vec3) Load 177(f16c3) + 4665: 52(float) Load 215(compare) + 4666:6(float16_t) Load 4264(f16lodClamp) + 4667: 208(ptr) AccessChain 4598(texel) 207 + 4668:3138(ResType) ImageSparseSampleDrefImplicitLod 4663 4664 4665 ConstOffset MinLod 722 4666 + 4669:6(float16_t) CompositeExtract 4668 1 + Store 4667 4669 + 4670: 47(int) CompositeExtract 4668 0 + 4671: 7(f16vec4) Load 4598(texel) + ReturnValue 4671 + FunctionEnd +105(testTextureOffsetClamp(): 7(f16vec4) Function None 8 + 106: Label + 4674(texel): 64(ptr) Variable Function + Store 4674(texel) 121 + 4675: 123 Load 125(s1D) + 4676: 52(float) Load 128(c1) + 4677: 52(float) Load 4257(lodClamp) + 4678: 7(f16vec4) ImageSampleImplicitLod 4675 4676 ConstOffset MinLod 709 4677 + 4679: 7(f16vec4) Load 4674(texel) + 4680: 7(f16vec4) FAdd 4679 4678 + Store 4674(texel) 4680 + 4681: 123 Load 125(s1D) + 4682:6(float16_t) Load 135(f16c1) + 4683:6(float16_t) Load 4264(f16lodClamp) + 4684:6(float16_t) Load 137(f16bias) + 4685: 7(f16vec4) ImageSampleImplicitLod 4681 4682 Bias ConstOffset MinLod 4684 709 4683 + 4686: 7(f16vec4) Load 4674(texel) + 4687: 7(f16vec4) FAdd 4686 4685 + Store 4674(texel) 4687 + 4688: 143 Load 145(s2D) + 4689: 53(fvec2) Load 148(c2) + 4690: 52(float) Load 4257(lodClamp) + 4691: 7(f16vec4) ImageSampleImplicitLod 4688 4689 ConstOffset MinLod 722 4690 + 4692: 7(f16vec4) Load 4674(texel) + 4693: 7(f16vec4) FAdd 4692 4691 + Store 4674(texel) 4693 + 4694: 143 Load 145(s2D) + 4695:154(f16vec2) Load 156(f16c2) + 4696:6(float16_t) Load 4264(f16lodClamp) + 4697:6(float16_t) Load 137(f16bias) + 4698: 7(f16vec4) ImageSampleImplicitLod 4694 4695 Bias ConstOffset MinLod 4697 722 4696 + 4699: 7(f16vec4) Load 4674(texel) + 4700: 7(f16vec4) FAdd 4699 4698 + Store 4674(texel) 4700 + 4701: 163 Load 165(s3D) + 4702: 167(fvec3) Load 169(c3) + 4703: 52(float) Load 4257(lodClamp) + 4704: 7(f16vec4) ImageSampleImplicitLod 4701 4702 ConstOffset MinLod 735 4703 + 4705: 7(f16vec4) Load 4674(texel) + 4706: 7(f16vec4) FAdd 4705 4704 + Store 4674(texel) 4706 + 4707: 163 Load 165(s3D) + 4708:175(f16vec3) Load 177(f16c3) + 4709:6(float16_t) Load 4264(f16lodClamp) + 4710:6(float16_t) Load 137(f16bias) + 4711: 7(f16vec4) ImageSampleImplicitLod 4707 4708 Bias ConstOffset MinLod 4710 735 4709 + 4712: 7(f16vec4) Load 4674(texel) + 4713: 7(f16vec4) FAdd 4712 4711 + Store 4674(texel) 4713 + 4714: 199 Load 201(s1DShadow) + 4715: 167(fvec3) Load 169(c3) + 4716: 52(float) Load 4257(lodClamp) + 4717: 52(float) CompositeExtract 4715 2 + 4718:6(float16_t) ImageSampleDrefImplicitLod 4714 4715 4717 ConstOffset MinLod 709 4716 + 4719: 208(ptr) AccessChain 4674(texel) 207 + 4720:6(float16_t) Load 4719 + 4721:6(float16_t) FAdd 4720 4718 + 4722: 208(ptr) AccessChain 4674(texel) 207 + Store 4722 4721 + 4723: 199 Load 201(s1DShadow) + 4724:154(f16vec2) Load 156(f16c2) + 4725: 52(float) Load 215(compare) + 4726:6(float16_t) Load 4264(f16lodClamp) + 4727:6(float16_t) Load 137(f16bias) + 4728:6(float16_t) ImageSampleDrefImplicitLod 4723 4724 4725 Bias ConstOffset MinLod 4727 709 4726 + 4729: 208(ptr) AccessChain 4674(texel) 207 + 4730:6(float16_t) Load 4729 + 4731:6(float16_t) FAdd 4730 4728 + 4732: 208(ptr) AccessChain 4674(texel) 207 + Store 4732 4731 + 4733: 224 Load 226(s2DShadow) + 4734: 167(fvec3) Load 169(c3) + 4735: 52(float) Load 4257(lodClamp) + 4736: 52(float) CompositeExtract 4734 2 + 4737:6(float16_t) ImageSampleDrefImplicitLod 4733 4734 4736 ConstOffset MinLod 722 4735 + 4738: 208(ptr) AccessChain 4674(texel) 207 + 4739:6(float16_t) Load 4738 + 4740:6(float16_t) FAdd 4739 4737 + 4741: 208(ptr) AccessChain 4674(texel) 207 + Store 4741 4740 + 4742: 224 Load 226(s2DShadow) + 4743:154(f16vec2) Load 156(f16c2) + 4744: 52(float) Load 215(compare) + 4745:6(float16_t) Load 4264(f16lodClamp) + 4746:6(float16_t) Load 137(f16bias) + 4747:6(float16_t) ImageSampleDrefImplicitLod 4742 4743 4744 Bias ConstOffset MinLod 4746 722 4745 + 4748: 208(ptr) AccessChain 4674(texel) 207 + 4749:6(float16_t) Load 4748 + 4750:6(float16_t) FAdd 4749 4747 + 4751: 208(ptr) AccessChain 4674(texel) 207 + Store 4751 4750 + 4752: 269 Load 271(s1DArray) + 4753: 53(fvec2) Load 148(c2) + 4754: 52(float) Load 4257(lodClamp) + 4755: 7(f16vec4) ImageSampleImplicitLod 4752 4753 ConstOffset MinLod 709 4754 + 4756: 7(f16vec4) Load 4674(texel) + 4757: 7(f16vec4) FAdd 4756 4755 + Store 4674(texel) 4757 + 4758: 269 Load 271(s1DArray) + 4759:154(f16vec2) Load 156(f16c2) + 4760:6(float16_t) Load 4264(f16lodClamp) + 4761:6(float16_t) Load 137(f16bias) + 4762: 7(f16vec4) ImageSampleImplicitLod 4758 4759 Bias ConstOffset MinLod 4761 709 4760 + 4763: 7(f16vec4) Load 4674(texel) + 4764: 7(f16vec4) FAdd 4763 4762 + Store 4674(texel) 4764 + 4765: 284 Load 286(s2DArray) + 4766: 167(fvec3) Load 169(c3) + 4767: 52(float) Load 4257(lodClamp) + 4768: 7(f16vec4) ImageSampleImplicitLod 4765 4766 ConstOffset MinLod 722 4767 + 4769: 7(f16vec4) Load 4674(texel) + 4770: 7(f16vec4) FAdd 4769 4768 + Store 4674(texel) 4770 + 4771: 284 Load 286(s2DArray) + 4772:175(f16vec3) Load 177(f16c3) + 4773:6(float16_t) Load 4264(f16lodClamp) + 4774:6(float16_t) Load 137(f16bias) + 4775: 7(f16vec4) ImageSampleImplicitLod 4771 4772 Bias ConstOffset MinLod 4774 722 4773 + 4776: 7(f16vec4) Load 4674(texel) + 4777: 7(f16vec4) FAdd 4776 4775 + Store 4674(texel) 4777 + 4778: 316 Load 318(s1DArrayShadow) + 4779: 167(fvec3) Load 169(c3) + 4780: 52(float) Load 4257(lodClamp) + 4781: 52(float) CompositeExtract 4779 2 + 4782:6(float16_t) ImageSampleDrefImplicitLod 4778 4779 4781 ConstOffset MinLod 709 4780 + 4783: 208(ptr) AccessChain 4674(texel) 207 + 4784:6(float16_t) Load 4783 + 4785:6(float16_t) FAdd 4784 4782 + 4786: 208(ptr) AccessChain 4674(texel) 207 + Store 4786 4785 + 4787: 316 Load 318(s1DArrayShadow) + 4788:154(f16vec2) Load 156(f16c2) + 4789: 52(float) Load 215(compare) + 4790:6(float16_t) Load 4264(f16lodClamp) + 4791:6(float16_t) Load 137(f16bias) + 4792:6(float16_t) ImageSampleDrefImplicitLod 4787 4788 4789 Bias ConstOffset MinLod 4791 709 4790 + 4793: 208(ptr) AccessChain 4674(texel) 207 + 4794:6(float16_t) Load 4793 + 4795:6(float16_t) FAdd 4794 4792 + 4796: 208(ptr) AccessChain 4674(texel) 207 + Store 4796 4795 + 4797: 337 Load 339(s2DArrayShadow) + 4798: 249(fvec4) Load 251(c4) + 4799: 52(float) Load 4257(lodClamp) + 4800: 52(float) CompositeExtract 4798 3 + 4801:6(float16_t) ImageSampleDrefImplicitLod 4797 4798 4800 ConstOffset MinLod 722 4799 + 4802: 208(ptr) AccessChain 4674(texel) 207 + 4803:6(float16_t) Load 4802 + 4804:6(float16_t) FAdd 4803 4801 + 4805: 208(ptr) AccessChain 4674(texel) 207 + Store 4805 4804 + 4806: 337 Load 339(s2DArrayShadow) + 4807:175(f16vec3) Load 177(f16c3) + 4808: 52(float) Load 215(compare) + 4809:6(float16_t) Load 4264(f16lodClamp) + 4810:6(float16_t) ImageSampleDrefImplicitLod 4806 4807 4808 ConstOffset MinLod 722 4809 + 4811: 208(ptr) AccessChain 4674(texel) 207 + 4812:6(float16_t) Load 4811 + 4813:6(float16_t) FAdd 4812 4810 + 4814: 208(ptr) AccessChain 4674(texel) 207 + Store 4814 4813 + 4815: 7(f16vec4) Load 4674(texel) + ReturnValue 4815 + FunctionEnd +107(testSparseTextureGradClamp(): 7(f16vec4) Function None 8 + 108: Label + 4818(texel): 64(ptr) Variable Function + Store 4818(texel) 121 + 4819: 143 Load 145(s2D) + 4820: 53(fvec2) Load 148(c2) + 4821: 53(fvec2) Load 1409(dPdxy2) + 4822: 53(fvec2) Load 1409(dPdxy2) + 4823: 52(float) Load 4257(lodClamp) + 4824:3102(ResType) ImageSparseSampleExplicitLod 4819 4820 Grad MinLod 4821 4822 4823 + 4825: 7(f16vec4) CompositeExtract 4824 1 + Store 4818(texel) 4825 + 4826: 47(int) CompositeExtract 4824 0 + 4827: 143 Load 145(s2D) + 4828:154(f16vec2) Load 156(f16c2) + 4829:154(f16vec2) Load 1417(f16dPdxy2) + 4830:154(f16vec2) Load 1417(f16dPdxy2) + 4831:6(float16_t) Load 4264(f16lodClamp) + 4832:3102(ResType) ImageSparseSampleExplicitLod 4827 4828 Grad MinLod 4829 4830 4831 + 4833: 7(f16vec4) CompositeExtract 4832 1 + Store 4818(texel) 4833 + 4834: 47(int) CompositeExtract 4832 0 + 4835: 163 Load 165(s3D) + 4836: 167(fvec3) Load 169(c3) + 4837: 167(fvec3) Load 1425(dPdxy3) + 4838: 167(fvec3) Load 1425(dPdxy3) + 4839: 52(float) Load 4257(lodClamp) + 4840:3102(ResType) ImageSparseSampleExplicitLod 4835 4836 Grad MinLod 4837 4838 4839 + 4841: 7(f16vec4) CompositeExtract 4840 1 + Store 4818(texel) 4841 + 4842: 47(int) CompositeExtract 4840 0 + 4843: 163 Load 165(s3D) + 4844:175(f16vec3) Load 177(f16c3) + 4845:175(f16vec3) Load 1433(f16dPdxy3) + 4846:175(f16vec3) Load 1433(f16dPdxy3) + 4847:6(float16_t) Load 4264(f16lodClamp) + 4848:3102(ResType) ImageSparseSampleExplicitLod 4843 4844 Grad MinLod 4845 4846 4847 + 4849: 7(f16vec4) CompositeExtract 4848 1 + Store 4818(texel) 4849 + 4850: 47(int) CompositeExtract 4848 0 + 4851: 184 Load 186(sCube) + 4852: 167(fvec3) Load 169(c3) + 4853: 167(fvec3) Load 1425(dPdxy3) + 4854: 167(fvec3) Load 1425(dPdxy3) + 4855: 52(float) Load 4257(lodClamp) + 4856:3102(ResType) ImageSparseSampleExplicitLod 4851 4852 Grad MinLod 4853 4854 4855 + 4857: 7(f16vec4) CompositeExtract 4856 1 + Store 4818(texel) 4857 + 4858: 47(int) CompositeExtract 4856 0 + 4859: 184 Load 186(sCube) + 4860:175(f16vec3) Load 177(f16c3) + 4861:175(f16vec3) Load 1433(f16dPdxy3) + 4862:175(f16vec3) Load 1433(f16dPdxy3) + 4863:6(float16_t) Load 4264(f16lodClamp) + 4864:3102(ResType) ImageSparseSampleExplicitLod 4859 4860 Grad MinLod 4861 4862 4863 + 4865: 7(f16vec4) CompositeExtract 4864 1 + Store 4818(texel) 4865 + 4866: 47(int) CompositeExtract 4864 0 + 4867: 224 Load 226(s2DShadow) + 4868: 167(fvec3) Load 169(c3) + 4869: 53(fvec2) Load 1409(dPdxy2) + 4870: 53(fvec2) Load 1409(dPdxy2) + 4871: 52(float) Load 4257(lodClamp) + 4872: 208(ptr) AccessChain 4818(texel) 207 + 4873: 52(float) CompositeExtract 4868 2 + 4874:3138(ResType) ImageSparseSampleDrefExplicitLod 4867 4868 4873 Grad MinLod 4869 4870 4871 + 4875:6(float16_t) CompositeExtract 4874 1 + Store 4872 4875 + 4876: 47(int) CompositeExtract 4874 0 + 4877: 224 Load 226(s2DShadow) + 4878:154(f16vec2) Load 156(f16c2) + 4879: 52(float) Load 215(compare) + 4880:154(f16vec2) Load 1417(f16dPdxy2) + 4881:154(f16vec2) Load 1417(f16dPdxy2) + 4882:6(float16_t) Load 4264(f16lodClamp) + 4883: 208(ptr) AccessChain 4818(texel) 207 + 4884:3138(ResType) ImageSparseSampleDrefExplicitLod 4877 4878 4879 Grad MinLod 4880 4881 4882 + 4885:6(float16_t) CompositeExtract 4884 1 + Store 4883 4885 + 4886: 47(int) CompositeExtract 4884 0 + 4887: 245 Load 247(sCubeShadow) + 4888: 249(fvec4) Load 251(c4) + 4889: 167(fvec3) Load 1425(dPdxy3) + 4890: 167(fvec3) Load 1425(dPdxy3) + 4891: 52(float) Load 4257(lodClamp) + 4892: 208(ptr) AccessChain 4818(texel) 207 + 4893: 52(float) CompositeExtract 4888 3 + 4894:3138(ResType) ImageSparseSampleDrefExplicitLod 4887 4888 4893 Grad MinLod 4889 4890 4891 + 4895:6(float16_t) CompositeExtract 4894 1 + Store 4892 4895 + 4896: 47(int) CompositeExtract 4894 0 + 4897: 245 Load 247(sCubeShadow) + 4898:175(f16vec3) Load 177(f16c3) + 4899: 52(float) Load 215(compare) + 4900:175(f16vec3) Load 1433(f16dPdxy3) + 4901:175(f16vec3) Load 1433(f16dPdxy3) + 4902:6(float16_t) Load 4264(f16lodClamp) + 4903: 208(ptr) AccessChain 4818(texel) 207 + 4904:3138(ResType) ImageSparseSampleDrefExplicitLod 4897 4898 4899 Grad MinLod 4900 4901 4902 + 4905:6(float16_t) CompositeExtract 4904 1 + Store 4903 4905 + 4906: 47(int) CompositeExtract 4904 0 + 4907: 284 Load 286(s2DArray) + 4908: 167(fvec3) Load 169(c3) + 4909: 53(fvec2) Load 1409(dPdxy2) + 4910: 53(fvec2) Load 1409(dPdxy2) + 4911: 52(float) Load 4257(lodClamp) + 4912:3102(ResType) ImageSparseSampleExplicitLod 4907 4908 Grad MinLod 4909 4910 4911 + 4913: 7(f16vec4) CompositeExtract 4912 1 + Store 4818(texel) 4913 + 4914: 47(int) CompositeExtract 4912 0 + 4915: 284 Load 286(s2DArray) + 4916:175(f16vec3) Load 177(f16c3) + 4917:154(f16vec2) Load 1417(f16dPdxy2) + 4918:154(f16vec2) Load 1417(f16dPdxy2) + 4919:6(float16_t) Load 4264(f16lodClamp) + 4920:3102(ResType) ImageSparseSampleExplicitLod 4915 4916 Grad MinLod 4917 4918 4919 + 4921: 7(f16vec4) CompositeExtract 4920 1 + Store 4818(texel) 4921 + 4922: 47(int) CompositeExtract 4920 0 + 4923: 337 Load 339(s2DArrayShadow) + 4924: 249(fvec4) Load 251(c4) + 4925: 53(fvec2) Load 1409(dPdxy2) + 4926: 53(fvec2) Load 1409(dPdxy2) + 4927: 52(float) Load 4257(lodClamp) + 4928: 208(ptr) AccessChain 4818(texel) 207 + 4929: 52(float) CompositeExtract 4924 3 + 4930:3138(ResType) ImageSparseSampleDrefExplicitLod 4923 4924 4929 Grad MinLod 4925 4926 4927 + 4931:6(float16_t) CompositeExtract 4930 1 + Store 4928 4931 + 4932: 47(int) CompositeExtract 4930 0 + 4933: 337 Load 339(s2DArrayShadow) + 4934:175(f16vec3) Load 177(f16c3) + 4935: 52(float) Load 215(compare) + 4936:154(f16vec2) Load 1417(f16dPdxy2) + 4937:154(f16vec2) Load 1417(f16dPdxy2) + 4938:6(float16_t) Load 4264(f16lodClamp) + 4939: 208(ptr) AccessChain 4818(texel) 207 + 4940:3138(ResType) ImageSparseSampleDrefExplicitLod 4933 4934 4935 Grad MinLod 4936 4937 4938 + 4941:6(float16_t) CompositeExtract 4940 1 + Store 4939 4941 + 4942: 47(int) CompositeExtract 4940 0 + 4943: 299 Load 301(sCubeArray) + 4944: 249(fvec4) Load 251(c4) + 4945: 167(fvec3) Load 1425(dPdxy3) + 4946: 167(fvec3) Load 1425(dPdxy3) + 4947: 52(float) Load 4257(lodClamp) + 4948:3102(ResType) ImageSparseSampleExplicitLod 4943 4944 Grad MinLod 4945 4946 4947 + 4949: 7(f16vec4) CompositeExtract 4948 1 + Store 4818(texel) 4949 + 4950: 47(int) CompositeExtract 4948 0 + 4951: 299 Load 301(sCubeArray) + 4952: 7(f16vec4) Load 309(f16c4) + 4953:175(f16vec3) Load 1433(f16dPdxy3) + 4954:175(f16vec3) Load 1433(f16dPdxy3) + 4955:6(float16_t) Load 4264(f16lodClamp) + 4956:3102(ResType) ImageSparseSampleExplicitLod 4951 4952 Grad MinLod 4953 4954 4955 + 4957: 7(f16vec4) CompositeExtract 4956 1 + Store 4818(texel) 4957 + 4958: 47(int) CompositeExtract 4956 0 + 4959: 7(f16vec4) Load 4818(texel) + ReturnValue 4959 + FunctionEnd +109(testTextureGradClamp(): 7(f16vec4) Function None 8 + 110: Label + 4962(texel): 64(ptr) Variable Function + Store 4962(texel) 121 + 4963: 123 Load 125(s1D) + 4964: 52(float) Load 128(c1) + 4965: 52(float) Load 1393(dPdxy1) + 4966: 52(float) Load 1393(dPdxy1) + 4967: 52(float) Load 4257(lodClamp) + 4968: 7(f16vec4) ImageSampleExplicitLod 4963 4964 Grad MinLod 4965 4966 4967 + 4969: 7(f16vec4) Load 4962(texel) + 4970: 7(f16vec4) FAdd 4969 4968 + Store 4962(texel) 4970 + 4971: 123 Load 125(s1D) + 4972:6(float16_t) Load 135(f16c1) + 4973:6(float16_t) Load 1401(f16dPdxy1) + 4974:6(float16_t) Load 1401(f16dPdxy1) + 4975:6(float16_t) Load 4264(f16lodClamp) + 4976: 7(f16vec4) ImageSampleExplicitLod 4971 4972 Grad MinLod 4973 4974 4975 + 4977: 7(f16vec4) Load 4962(texel) + 4978: 7(f16vec4) FAdd 4977 4976 + Store 4962(texel) 4978 + 4979: 143 Load 145(s2D) + 4980: 53(fvec2) Load 148(c2) + 4981: 53(fvec2) Load 1409(dPdxy2) + 4982: 53(fvec2) Load 1409(dPdxy2) + 4983: 52(float) Load 4257(lodClamp) + 4984: 7(f16vec4) ImageSampleExplicitLod 4979 4980 Grad MinLod 4981 4982 4983 + 4985: 7(f16vec4) Load 4962(texel) + 4986: 7(f16vec4) FAdd 4985 4984 + Store 4962(texel) 4986 + 4987: 143 Load 145(s2D) + 4988:154(f16vec2) Load 156(f16c2) + 4989:154(f16vec2) Load 1417(f16dPdxy2) + 4990:154(f16vec2) Load 1417(f16dPdxy2) + 4991:6(float16_t) Load 4264(f16lodClamp) + 4992: 7(f16vec4) ImageSampleExplicitLod 4987 4988 Grad MinLod 4989 4990 4991 + 4993: 7(f16vec4) Load 4962(texel) + 4994: 7(f16vec4) FAdd 4993 4992 + Store 4962(texel) 4994 + 4995: 163 Load 165(s3D) + 4996: 167(fvec3) Load 169(c3) + 4997: 167(fvec3) Load 1425(dPdxy3) + 4998: 167(fvec3) Load 1425(dPdxy3) + 4999: 52(float) Load 4257(lodClamp) + 5000: 7(f16vec4) ImageSampleExplicitLod 4995 4996 Grad MinLod 4997 4998 4999 + 5001: 7(f16vec4) Load 4962(texel) + 5002: 7(f16vec4) FAdd 5001 5000 + Store 4962(texel) 5002 + 5003: 163 Load 165(s3D) + 5004:175(f16vec3) Load 177(f16c3) + 5005:175(f16vec3) Load 1433(f16dPdxy3) + 5006:175(f16vec3) Load 1433(f16dPdxy3) + 5007:6(float16_t) Load 4264(f16lodClamp) + 5008: 7(f16vec4) ImageSampleExplicitLod 5003 5004 Grad MinLod 5005 5006 5007 + 5009: 7(f16vec4) Load 4962(texel) + 5010: 7(f16vec4) FAdd 5009 5008 + Store 4962(texel) 5010 + 5011: 184 Load 186(sCube) + 5012: 167(fvec3) Load 169(c3) + 5013: 167(fvec3) Load 1425(dPdxy3) + 5014: 167(fvec3) Load 1425(dPdxy3) + 5015: 52(float) Load 4257(lodClamp) + 5016: 7(f16vec4) ImageSampleExplicitLod 5011 5012 Grad MinLod 5013 5014 5015 + 5017: 7(f16vec4) Load 4962(texel) + 5018: 7(f16vec4) FAdd 5017 5016 + Store 4962(texel) 5018 + 5019: 184 Load 186(sCube) + 5020:175(f16vec3) Load 177(f16c3) + 5021:175(f16vec3) Load 1433(f16dPdxy3) + 5022:175(f16vec3) Load 1433(f16dPdxy3) + 5023:6(float16_t) Load 4264(f16lodClamp) + 5024: 7(f16vec4) ImageSampleExplicitLod 5019 5020 Grad MinLod 5021 5022 5023 + 5025: 7(f16vec4) Load 4962(texel) + 5026: 7(f16vec4) FAdd 5025 5024 + Store 4962(texel) 5026 + 5027: 199 Load 201(s1DShadow) + 5028: 167(fvec3) Load 169(c3) + 5029: 52(float) Load 1393(dPdxy1) + 5030: 52(float) Load 1393(dPdxy1) + 5031: 52(float) Load 4257(lodClamp) + 5032: 52(float) CompositeExtract 5028 2 + 5033:6(float16_t) ImageSampleDrefExplicitLod 5027 5028 5032 Grad MinLod 5029 5030 5031 + 5034: 208(ptr) AccessChain 4962(texel) 207 + 5035:6(float16_t) Load 5034 + 5036:6(float16_t) FAdd 5035 5033 + 5037: 208(ptr) AccessChain 4962(texel) 207 + Store 5037 5036 + 5038: 199 Load 201(s1DShadow) + 5039:154(f16vec2) Load 156(f16c2) + 5040: 52(float) Load 215(compare) + 5041:6(float16_t) Load 1401(f16dPdxy1) + 5042:6(float16_t) Load 1401(f16dPdxy1) + 5043:6(float16_t) Load 4264(f16lodClamp) + 5044:6(float16_t) ImageSampleDrefExplicitLod 5038 5039 5040 Grad MinLod 5041 5042 5043 + 5045: 208(ptr) AccessChain 4962(texel) 207 + 5046:6(float16_t) Load 5045 + 5047:6(float16_t) FAdd 5046 5044 + 5048: 208(ptr) AccessChain 4962(texel) 207 + Store 5048 5047 + 5049: 224 Load 226(s2DShadow) + 5050: 167(fvec3) Load 169(c3) + 5051: 53(fvec2) Load 1409(dPdxy2) + 5052: 53(fvec2) Load 1409(dPdxy2) + 5053: 52(float) Load 4257(lodClamp) + 5054: 52(float) CompositeExtract 5050 2 + 5055:6(float16_t) ImageSampleDrefExplicitLod 5049 5050 5054 Grad MinLod 5051 5052 5053 + 5056: 208(ptr) AccessChain 4962(texel) 207 + 5057:6(float16_t) Load 5056 + 5058:6(float16_t) FAdd 5057 5055 + 5059: 208(ptr) AccessChain 4962(texel) 207 + Store 5059 5058 + 5060: 224 Load 226(s2DShadow) + 5061:154(f16vec2) Load 156(f16c2) + 5062: 52(float) Load 215(compare) + 5063:154(f16vec2) Load 1417(f16dPdxy2) + 5064:154(f16vec2) Load 1417(f16dPdxy2) + 5065:6(float16_t) Load 4264(f16lodClamp) + 5066:6(float16_t) ImageSampleDrefExplicitLod 5060 5061 5062 Grad MinLod 5063 5064 5065 + 5067: 208(ptr) AccessChain 4962(texel) 207 + 5068:6(float16_t) Load 5067 + 5069:6(float16_t) FAdd 5068 5066 + 5070: 208(ptr) AccessChain 4962(texel) 207 + Store 5070 5069 + 5071: 245 Load 247(sCubeShadow) + 5072: 249(fvec4) Load 251(c4) + 5073: 167(fvec3) Load 1425(dPdxy3) + 5074: 167(fvec3) Load 1425(dPdxy3) + 5075: 52(float) Load 4257(lodClamp) + 5076: 52(float) CompositeExtract 5072 3 + 5077:6(float16_t) ImageSampleDrefExplicitLod 5071 5072 5076 Grad MinLod 5073 5074 5075 + 5078: 208(ptr) AccessChain 4962(texel) 207 + 5079:6(float16_t) Load 5078 + 5080:6(float16_t) FAdd 5079 5077 + 5081: 208(ptr) AccessChain 4962(texel) 207 + Store 5081 5080 + 5082: 245 Load 247(sCubeShadow) + 5083:175(f16vec3) Load 177(f16c3) + 5084: 52(float) Load 215(compare) + 5085:175(f16vec3) Load 1433(f16dPdxy3) + 5086:175(f16vec3) Load 1433(f16dPdxy3) + 5087:6(float16_t) Load 4264(f16lodClamp) + 5088:6(float16_t) ImageSampleDrefExplicitLod 5082 5083 5084 Grad MinLod 5085 5086 5087 + 5089: 208(ptr) AccessChain 4962(texel) 207 + 5090:6(float16_t) Load 5089 + 5091:6(float16_t) FAdd 5090 5088 + 5092: 208(ptr) AccessChain 4962(texel) 207 + Store 5092 5091 + 5093: 269 Load 271(s1DArray) + 5094: 53(fvec2) Load 148(c2) + 5095: 52(float) Load 1393(dPdxy1) + 5096: 52(float) Load 1393(dPdxy1) + 5097: 52(float) Load 4257(lodClamp) + 5098: 7(f16vec4) ImageSampleExplicitLod 5093 5094 Grad MinLod 5095 5096 5097 + 5099: 7(f16vec4) Load 4962(texel) + 5100: 7(f16vec4) FAdd 5099 5098 + Store 4962(texel) 5100 + 5101: 269 Load 271(s1DArray) + 5102:154(f16vec2) Load 156(f16c2) + 5103:6(float16_t) Load 1401(f16dPdxy1) + 5104:6(float16_t) Load 1401(f16dPdxy1) + 5105:6(float16_t) Load 4264(f16lodClamp) + 5106: 7(f16vec4) ImageSampleExplicitLod 5101 5102 Grad MinLod 5103 5104 5105 + 5107: 7(f16vec4) Load 4962(texel) + 5108: 7(f16vec4) FAdd 5107 5106 + Store 4962(texel) 5108 + 5109: 284 Load 286(s2DArray) + 5110: 167(fvec3) Load 169(c3) + 5111: 53(fvec2) Load 1409(dPdxy2) + 5112: 53(fvec2) Load 1409(dPdxy2) + 5113: 52(float) Load 4257(lodClamp) + 5114: 7(f16vec4) ImageSampleExplicitLod 5109 5110 Grad MinLod 5111 5112 5113 + 5115: 7(f16vec4) Load 4962(texel) + 5116: 7(f16vec4) FAdd 5115 5114 + Store 4962(texel) 5116 + 5117: 284 Load 286(s2DArray) + 5118:175(f16vec3) Load 177(f16c3) + 5119:154(f16vec2) Load 1417(f16dPdxy2) + 5120:154(f16vec2) Load 1417(f16dPdxy2) + 5121:6(float16_t) Load 4264(f16lodClamp) + 5122: 7(f16vec4) ImageSampleExplicitLod 5117 5118 Grad MinLod 5119 5120 5121 + 5123: 7(f16vec4) Load 4962(texel) + 5124: 7(f16vec4) FAdd 5123 5122 + Store 4962(texel) 5124 + 5125: 316 Load 318(s1DArrayShadow) + 5126: 167(fvec3) Load 169(c3) + 5127: 52(float) Load 1393(dPdxy1) + 5128: 52(float) Load 1393(dPdxy1) + 5129: 52(float) Load 4257(lodClamp) + 5130: 52(float) CompositeExtract 5126 2 + 5131:6(float16_t) ImageSampleDrefExplicitLod 5125 5126 5130 Grad MinLod 5127 5128 5129 + 5132: 208(ptr) AccessChain 4962(texel) 207 + 5133:6(float16_t) Load 5132 + 5134:6(float16_t) FAdd 5133 5131 + 5135: 208(ptr) AccessChain 4962(texel) 207 + Store 5135 5134 + 5136: 316 Load 318(s1DArrayShadow) + 5137:154(f16vec2) Load 156(f16c2) + 5138: 52(float) Load 215(compare) + 5139:6(float16_t) Load 1401(f16dPdxy1) + 5140:6(float16_t) Load 1401(f16dPdxy1) + 5141:6(float16_t) Load 4264(f16lodClamp) + 5142:6(float16_t) ImageSampleDrefExplicitLod 5136 5137 5138 Grad MinLod 5139 5140 5141 + 5143: 208(ptr) AccessChain 4962(texel) 207 + 5144:6(float16_t) Load 5143 + 5145:6(float16_t) FAdd 5144 5142 + 5146: 208(ptr) AccessChain 4962(texel) 207 + Store 5146 5145 + 5147: 337 Load 339(s2DArrayShadow) + 5148: 249(fvec4) Load 251(c4) + 5149: 53(fvec2) Load 1409(dPdxy2) + 5150: 53(fvec2) Load 1409(dPdxy2) + 5151: 52(float) Load 4257(lodClamp) + 5152: 52(float) CompositeExtract 5148 3 + 5153:6(float16_t) ImageSampleDrefExplicitLod 5147 5148 5152 Grad MinLod 5149 5150 5151 + 5154: 208(ptr) AccessChain 4962(texel) 207 + 5155:6(float16_t) Load 5154 + 5156:6(float16_t) FAdd 5155 5153 + 5157: 208(ptr) AccessChain 4962(texel) 207 + Store 5157 5156 + 5158: 337 Load 339(s2DArrayShadow) + 5159:175(f16vec3) Load 177(f16c3) + 5160: 52(float) Load 215(compare) + 5161:154(f16vec2) Load 1417(f16dPdxy2) + 5162:154(f16vec2) Load 1417(f16dPdxy2) + 5163:6(float16_t) Load 4264(f16lodClamp) + 5164:6(float16_t) ImageSampleDrefExplicitLod 5158 5159 5160 Grad MinLod 5161 5162 5163 + 5165: 208(ptr) AccessChain 4962(texel) 207 + 5166:6(float16_t) Load 5165 + 5167:6(float16_t) FAdd 5166 5164 + 5168: 208(ptr) AccessChain 4962(texel) 207 + Store 5168 5167 + 5169: 299 Load 301(sCubeArray) + 5170: 249(fvec4) Load 251(c4) + 5171: 167(fvec3) Load 1425(dPdxy3) + 5172: 167(fvec3) Load 1425(dPdxy3) + 5173: 52(float) Load 4257(lodClamp) + 5174: 7(f16vec4) ImageSampleExplicitLod 5169 5170 Grad MinLod 5171 5172 5173 + 5175: 7(f16vec4) Load 4962(texel) + 5176: 7(f16vec4) FAdd 5175 5174 + Store 4962(texel) 5176 + 5177: 299 Load 301(sCubeArray) + 5178: 7(f16vec4) Load 309(f16c4) + 5179:175(f16vec3) Load 1433(f16dPdxy3) + 5180:175(f16vec3) Load 1433(f16dPdxy3) + 5181:6(float16_t) Load 4264(f16lodClamp) + 5182: 7(f16vec4) ImageSampleExplicitLod 5177 5178 Grad MinLod 5179 5180 5181 + 5183: 7(f16vec4) Load 4962(texel) + 5184: 7(f16vec4) FAdd 5183 5182 + Store 4962(texel) 5184 + 5185: 7(f16vec4) Load 4962(texel) + ReturnValue 5185 + FunctionEnd +111(testSparseTextureGradOffsetClamp(): 7(f16vec4) Function None 8 + 112: Label + 5188(texel): 64(ptr) Variable Function + Store 5188(texel) 121 + 5189: 143 Load 145(s2D) + 5190: 53(fvec2) Load 148(c2) + 5191: 53(fvec2) Load 1409(dPdxy2) + 5192: 53(fvec2) Load 1409(dPdxy2) + 5193: 52(float) Load 4257(lodClamp) + 5194:3102(ResType) ImageSparseSampleExplicitLod 5189 5190 Grad ConstOffset MinLod 5191 5192 722 5193 + 5195: 7(f16vec4) CompositeExtract 5194 1 + Store 5188(texel) 5195 + 5196: 47(int) CompositeExtract 5194 0 + 5197: 143 Load 145(s2D) + 5198:154(f16vec2) Load 156(f16c2) + 5199:154(f16vec2) Load 1417(f16dPdxy2) + 5200:154(f16vec2) Load 1417(f16dPdxy2) + 5201:6(float16_t) Load 4264(f16lodClamp) + 5202:3102(ResType) ImageSparseSampleExplicitLod 5197 5198 Grad ConstOffset MinLod 5199 5200 722 5201 + 5203: 7(f16vec4) CompositeExtract 5202 1 + Store 5188(texel) 5203 + 5204: 47(int) CompositeExtract 5202 0 + 5205: 163 Load 165(s3D) + 5206: 167(fvec3) Load 169(c3) + 5207: 167(fvec3) Load 1425(dPdxy3) + 5208: 167(fvec3) Load 1425(dPdxy3) + 5209: 52(float) Load 4257(lodClamp) + 5210:3102(ResType) ImageSparseSampleExplicitLod 5205 5206 Grad ConstOffset MinLod 5207 5208 735 5209 + 5211: 7(f16vec4) CompositeExtract 5210 1 + Store 5188(texel) 5211 + 5212: 47(int) CompositeExtract 5210 0 + 5213: 163 Load 165(s3D) + 5214:175(f16vec3) Load 177(f16c3) + 5215:175(f16vec3) Load 1433(f16dPdxy3) + 5216:175(f16vec3) Load 1433(f16dPdxy3) + 5217:6(float16_t) Load 4264(f16lodClamp) + 5218:3102(ResType) ImageSparseSampleExplicitLod 5213 5214 Grad ConstOffset MinLod 5215 5216 735 5217 + 5219: 7(f16vec4) CompositeExtract 5218 1 + Store 5188(texel) 5219 + 5220: 47(int) CompositeExtract 5218 0 + 5221: 224 Load 226(s2DShadow) + 5222: 167(fvec3) Load 169(c3) + 5223: 53(fvec2) Load 1409(dPdxy2) + 5224: 53(fvec2) Load 1409(dPdxy2) + 5225: 52(float) Load 4257(lodClamp) + 5226: 208(ptr) AccessChain 5188(texel) 207 + 5227: 52(float) CompositeExtract 5222 2 + 5228:3138(ResType) ImageSparseSampleDrefExplicitLod 5221 5222 5227 Grad ConstOffset MinLod 5223 5224 722 5225 + 5229:6(float16_t) CompositeExtract 5228 1 + Store 5226 5229 + 5230: 47(int) CompositeExtract 5228 0 + 5231: 224 Load 226(s2DShadow) + 5232:154(f16vec2) Load 156(f16c2) + 5233: 52(float) Load 215(compare) + 5234:154(f16vec2) Load 1417(f16dPdxy2) + 5235:154(f16vec2) Load 1417(f16dPdxy2) + 5236:6(float16_t) Load 4264(f16lodClamp) + 5237: 208(ptr) AccessChain 5188(texel) 207 + 5238:3138(ResType) ImageSparseSampleDrefExplicitLod 5231 5232 5233 Grad ConstOffset MinLod 5234 5235 722 5236 + 5239:6(float16_t) CompositeExtract 5238 1 + Store 5237 5239 + 5240: 47(int) CompositeExtract 5238 0 + 5241: 284 Load 286(s2DArray) + 5242: 167(fvec3) Load 169(c3) + 5243: 53(fvec2) Load 1409(dPdxy2) + 5244: 53(fvec2) Load 1409(dPdxy2) + 5245: 52(float) Load 4257(lodClamp) + 5246:3102(ResType) ImageSparseSampleExplicitLod 5241 5242 Grad ConstOffset MinLod 5243 5244 722 5245 + 5247: 7(f16vec4) CompositeExtract 5246 1 + Store 5188(texel) 5247 + 5248: 47(int) CompositeExtract 5246 0 + 5249: 284 Load 286(s2DArray) + 5250:175(f16vec3) Load 177(f16c3) + 5251:154(f16vec2) Load 1417(f16dPdxy2) + 5252:154(f16vec2) Load 1417(f16dPdxy2) + 5253:6(float16_t) Load 4264(f16lodClamp) + 5254:3102(ResType) ImageSparseSampleExplicitLod 5249 5250 Grad ConstOffset MinLod 5251 5252 722 5253 + 5255: 7(f16vec4) CompositeExtract 5254 1 + Store 5188(texel) 5255 + 5256: 47(int) CompositeExtract 5254 0 + 5257: 337 Load 339(s2DArrayShadow) + 5258: 249(fvec4) Load 251(c4) + 5259: 53(fvec2) Load 1409(dPdxy2) + 5260: 53(fvec2) Load 1409(dPdxy2) + 5261: 52(float) Load 4257(lodClamp) + 5262: 208(ptr) AccessChain 5188(texel) 207 + 5263: 52(float) CompositeExtract 5258 3 + 5264:3138(ResType) ImageSparseSampleDrefExplicitLod 5257 5258 5263 Grad ConstOffset MinLod 5259 5260 722 5261 + 5265:6(float16_t) CompositeExtract 5264 1 + Store 5262 5265 + 5266: 47(int) CompositeExtract 5264 0 + 5267: 337 Load 339(s2DArrayShadow) + 5268:175(f16vec3) Load 177(f16c3) + 5269: 52(float) Load 215(compare) + 5270:154(f16vec2) Load 1417(f16dPdxy2) + 5271:154(f16vec2) Load 1417(f16dPdxy2) + 5272:6(float16_t) Load 4264(f16lodClamp) + 5273: 208(ptr) AccessChain 5188(texel) 207 + 5274:3138(ResType) ImageSparseSampleDrefExplicitLod 5267 5268 5269 Grad ConstOffset MinLod 5270 5271 722 5272 + 5275:6(float16_t) CompositeExtract 5274 1 + Store 5273 5275 + 5276: 47(int) CompositeExtract 5274 0 + 5277: 7(f16vec4) Load 5188(texel) + ReturnValue 5277 + FunctionEnd +113(testTextureGradOffsetClamp(): 7(f16vec4) Function None 8 + 114: Label + 5280(texel): 64(ptr) Variable Function + Store 5280(texel) 121 + 5281: 123 Load 125(s1D) + 5282: 52(float) Load 128(c1) + 5283: 52(float) Load 1393(dPdxy1) + 5284: 52(float) Load 1393(dPdxy1) + 5285: 52(float) Load 4257(lodClamp) + 5286: 7(f16vec4) ImageSampleExplicitLod 5281 5282 Grad ConstOffset MinLod 5283 5284 709 5285 + 5287: 7(f16vec4) Load 5280(texel) + 5288: 7(f16vec4) FAdd 5287 5286 + Store 5280(texel) 5288 + 5289: 123 Load 125(s1D) + 5290:6(float16_t) Load 135(f16c1) + 5291:6(float16_t) Load 1401(f16dPdxy1) + 5292:6(float16_t) Load 1401(f16dPdxy1) + 5293:6(float16_t) Load 4264(f16lodClamp) + 5294: 7(f16vec4) ImageSampleExplicitLod 5289 5290 Grad ConstOffset MinLod 5291 5292 709 5293 + 5295: 7(f16vec4) Load 5280(texel) + 5296: 7(f16vec4) FAdd 5295 5294 + Store 5280(texel) 5296 + 5297: 143 Load 145(s2D) + 5298: 53(fvec2) Load 148(c2) + 5299: 53(fvec2) Load 1409(dPdxy2) + 5300: 53(fvec2) Load 1409(dPdxy2) + 5301: 52(float) Load 4257(lodClamp) + 5302: 7(f16vec4) ImageSampleExplicitLod 5297 5298 Grad ConstOffset MinLod 5299 5300 722 5301 + 5303: 7(f16vec4) Load 5280(texel) + 5304: 7(f16vec4) FAdd 5303 5302 + Store 5280(texel) 5304 + 5305: 143 Load 145(s2D) + 5306:154(f16vec2) Load 156(f16c2) + 5307:154(f16vec2) Load 1417(f16dPdxy2) + 5308:154(f16vec2) Load 1417(f16dPdxy2) + 5309:6(float16_t) Load 4264(f16lodClamp) + 5310: 7(f16vec4) ImageSampleExplicitLod 5305 5306 Grad ConstOffset MinLod 5307 5308 722 5309 + 5311: 7(f16vec4) Load 5280(texel) + 5312: 7(f16vec4) FAdd 5311 5310 + Store 5280(texel) 5312 + 5313: 163 Load 165(s3D) + 5314: 167(fvec3) Load 169(c3) + 5315: 167(fvec3) Load 1425(dPdxy3) + 5316: 167(fvec3) Load 1425(dPdxy3) + 5317: 52(float) Load 4257(lodClamp) + 5318: 7(f16vec4) ImageSampleExplicitLod 5313 5314 Grad ConstOffset MinLod 5315 5316 735 5317 + 5319: 7(f16vec4) Load 5280(texel) + 5320: 7(f16vec4) FAdd 5319 5318 + Store 5280(texel) 5320 + 5321: 163 Load 165(s3D) + 5322:175(f16vec3) Load 177(f16c3) + 5323:175(f16vec3) Load 1433(f16dPdxy3) + 5324:175(f16vec3) Load 1433(f16dPdxy3) + 5325:6(float16_t) Load 4264(f16lodClamp) + 5326: 7(f16vec4) ImageSampleExplicitLod 5321 5322 Grad ConstOffset MinLod 5323 5324 735 5325 + 5327: 7(f16vec4) Load 5280(texel) + 5328: 7(f16vec4) FAdd 5327 5326 + Store 5280(texel) 5328 + 5329: 199 Load 201(s1DShadow) + 5330: 167(fvec3) Load 169(c3) + 5331: 52(float) Load 1393(dPdxy1) + 5332: 52(float) Load 1393(dPdxy1) + 5333: 52(float) Load 4257(lodClamp) + 5334: 52(float) CompositeExtract 5330 2 + 5335:6(float16_t) ImageSampleDrefExplicitLod 5329 5330 5334 Grad ConstOffset MinLod 5331 5332 709 5333 + 5336: 208(ptr) AccessChain 5280(texel) 207 + 5337:6(float16_t) Load 5336 + 5338:6(float16_t) FAdd 5337 5335 + 5339: 208(ptr) AccessChain 5280(texel) 207 + Store 5339 5338 + 5340: 199 Load 201(s1DShadow) + 5341:154(f16vec2) Load 156(f16c2) + 5342: 52(float) Load 215(compare) + 5343:6(float16_t) Load 1401(f16dPdxy1) + 5344:6(float16_t) Load 1401(f16dPdxy1) + 5345:6(float16_t) Load 4264(f16lodClamp) + 5346:6(float16_t) ImageSampleDrefExplicitLod 5340 5341 5342 Grad ConstOffset MinLod 5343 5344 709 5345 + 5347: 208(ptr) AccessChain 5280(texel) 207 + 5348:6(float16_t) Load 5347 + 5349:6(float16_t) FAdd 5348 5346 + 5350: 208(ptr) AccessChain 5280(texel) 207 + Store 5350 5349 + 5351: 224 Load 226(s2DShadow) + 5352: 167(fvec3) Load 169(c3) + 5353: 53(fvec2) Load 1409(dPdxy2) + 5354: 53(fvec2) Load 1409(dPdxy2) + 5355: 52(float) Load 4257(lodClamp) + 5356: 52(float) CompositeExtract 5352 2 + 5357:6(float16_t) ImageSampleDrefExplicitLod 5351 5352 5356 Grad ConstOffset MinLod 5353 5354 722 5355 + 5358: 208(ptr) AccessChain 5280(texel) 207 + 5359:6(float16_t) Load 5358 + 5360:6(float16_t) FAdd 5359 5357 + 5361: 208(ptr) AccessChain 5280(texel) 207 + Store 5361 5360 + 5362: 224 Load 226(s2DShadow) + 5363:154(f16vec2) Load 156(f16c2) + 5364: 52(float) Load 215(compare) + 5365:154(f16vec2) Load 1417(f16dPdxy2) + 5366:154(f16vec2) Load 1417(f16dPdxy2) + 5367:6(float16_t) Load 4264(f16lodClamp) + 5368:6(float16_t) ImageSampleDrefExplicitLod 5362 5363 5364 Grad ConstOffset MinLod 5365 5366 722 5367 + 5369: 208(ptr) AccessChain 5280(texel) 207 + 5370:6(float16_t) Load 5369 + 5371:6(float16_t) FAdd 5370 5368 + 5372: 208(ptr) AccessChain 5280(texel) 207 + Store 5372 5371 + 5373: 269 Load 271(s1DArray) + 5374: 53(fvec2) Load 148(c2) + 5375: 52(float) Load 1393(dPdxy1) + 5376: 52(float) Load 1393(dPdxy1) + 5377: 52(float) Load 4257(lodClamp) + 5378: 7(f16vec4) ImageSampleExplicitLod 5373 5374 Grad ConstOffset MinLod 5375 5376 709 5377 + 5379: 7(f16vec4) Load 5280(texel) + 5380: 7(f16vec4) FAdd 5379 5378 + Store 5280(texel) 5380 + 5381: 269 Load 271(s1DArray) + 5382:154(f16vec2) Load 156(f16c2) + 5383:6(float16_t) Load 1401(f16dPdxy1) + 5384:6(float16_t) Load 1401(f16dPdxy1) + 5385:6(float16_t) Load 4264(f16lodClamp) + 5386: 7(f16vec4) ImageSampleExplicitLod 5381 5382 Grad ConstOffset MinLod 5383 5384 709 5385 + 5387: 7(f16vec4) Load 5280(texel) + 5388: 7(f16vec4) FAdd 5387 5386 + Store 5280(texel) 5388 + 5389: 284 Load 286(s2DArray) + 5390: 167(fvec3) Load 169(c3) + 5391: 53(fvec2) Load 1409(dPdxy2) + 5392: 53(fvec2) Load 1409(dPdxy2) + 5393: 52(float) Load 4257(lodClamp) + 5394: 7(f16vec4) ImageSampleExplicitLod 5389 5390 Grad ConstOffset MinLod 5391 5392 722 5393 + 5395: 7(f16vec4) Load 5280(texel) + 5396: 7(f16vec4) FAdd 5395 5394 + Store 5280(texel) 5396 + 5397: 284 Load 286(s2DArray) + 5398:175(f16vec3) Load 177(f16c3) + 5399:154(f16vec2) Load 1417(f16dPdxy2) + 5400:154(f16vec2) Load 1417(f16dPdxy2) + 5401:6(float16_t) Load 4264(f16lodClamp) + 5402: 7(f16vec4) ImageSampleExplicitLod 5397 5398 Grad ConstOffset MinLod 5399 5400 722 5401 + 5403: 7(f16vec4) Load 5280(texel) + 5404: 7(f16vec4) FAdd 5403 5402 + Store 5280(texel) 5404 + 5405: 316 Load 318(s1DArrayShadow) + 5406: 167(fvec3) Load 169(c3) + 5407: 52(float) Load 1393(dPdxy1) + 5408: 52(float) Load 1393(dPdxy1) + 5409: 52(float) Load 4257(lodClamp) + 5410: 52(float) CompositeExtract 5406 2 + 5411:6(float16_t) ImageSampleDrefExplicitLod 5405 5406 5410 Grad ConstOffset MinLod 5407 5408 709 5409 + 5412: 208(ptr) AccessChain 5280(texel) 207 + 5413:6(float16_t) Load 5412 + 5414:6(float16_t) FAdd 5413 5411 + 5415: 208(ptr) AccessChain 5280(texel) 207 + Store 5415 5414 + 5416: 316 Load 318(s1DArrayShadow) + 5417:154(f16vec2) Load 156(f16c2) + 5418: 52(float) Load 215(compare) + 5419:6(float16_t) Load 1401(f16dPdxy1) + 5420:6(float16_t) Load 1401(f16dPdxy1) + 5421:6(float16_t) Load 4264(f16lodClamp) + 5422:6(float16_t) ImageSampleDrefExplicitLod 5416 5417 5418 Grad ConstOffset MinLod 5419 5420 709 5421 + 5423: 208(ptr) AccessChain 5280(texel) 207 + 5424:6(float16_t) Load 5423 + 5425:6(float16_t) FAdd 5424 5422 + 5426: 208(ptr) AccessChain 5280(texel) 207 + Store 5426 5425 + 5427: 337 Load 339(s2DArrayShadow) + 5428: 249(fvec4) Load 251(c4) + 5429: 53(fvec2) Load 1409(dPdxy2) + 5430: 53(fvec2) Load 1409(dPdxy2) + 5431: 52(float) Load 4257(lodClamp) + 5432: 52(float) CompositeExtract 5428 3 + 5433:6(float16_t) ImageSampleDrefExplicitLod 5427 5428 5432 Grad ConstOffset MinLod 5429 5430 722 5431 + 5434: 208(ptr) AccessChain 5280(texel) 207 + 5435:6(float16_t) Load 5434 + 5436:6(float16_t) FAdd 5435 5433 + 5437: 208(ptr) AccessChain 5280(texel) 207 + Store 5437 5436 + 5438: 337 Load 339(s2DArrayShadow) + 5439:175(f16vec3) Load 177(f16c3) + 5440: 52(float) Load 215(compare) + 5441:154(f16vec2) Load 1417(f16dPdxy2) + 5442:154(f16vec2) Load 1417(f16dPdxy2) + 5443:6(float16_t) Load 4264(f16lodClamp) + 5444:6(float16_t) ImageSampleDrefExplicitLod 5438 5439 5440 Grad ConstOffset MinLod 5441 5442 722 5443 + 5445: 208(ptr) AccessChain 5280(texel) 207 + 5446:6(float16_t) Load 5445 + 5447:6(float16_t) FAdd 5446 5444 + 5448: 208(ptr) AccessChain 5280(texel) 207 + Store 5448 5447 + 5449: 7(f16vec4) Load 5280(texel) + ReturnValue 5449 + FunctionEnd +115(testCombinedTextureSampler(): 7(f16vec4) Function None 8 + 116: Label + 5452(texel): 64(ptr) Variable Function + Store 5452(texel) 121 + 5455: 122 Load 5454(t1D) + 5459: 5456 Load 5458(s) + 5460: 123 SampledImage 5455 5459 + 5461: 52(float) Load 128(c1) + 5462: 7(f16vec4) ImageSampleImplicitLod 5460 5461 + 5463: 7(f16vec4) Load 5452(texel) + 5464: 7(f16vec4) FAdd 5463 5462 + Store 5452(texel) 5464 + 5465: 122 Load 5454(t1D) + 5466: 5456 Load 5458(s) + 5467: 123 SampledImage 5465 5466 + 5468:6(float16_t) Load 135(f16c1) + 5469:6(float16_t) Load 137(f16bias) + 5470: 7(f16vec4) ImageSampleImplicitLod 5467 5468 Bias 5469 + 5471: 7(f16vec4) Load 5452(texel) + 5472: 7(f16vec4) FAdd 5471 5470 + Store 5452(texel) 5472 + 5475: 142 Load 5474(t2D) + 5476: 5456 Load 5458(s) + 5477: 143 SampledImage 5475 5476 + 5478: 53(fvec2) Load 148(c2) + 5479: 7(f16vec4) ImageSampleImplicitLod 5477 5478 + 5480: 7(f16vec4) Load 5452(texel) + 5481: 7(f16vec4) FAdd 5480 5479 + Store 5452(texel) 5481 + 5482: 142 Load 5474(t2D) + 5483: 5456 Load 5458(s) + 5484: 143 SampledImage 5482 5483 + 5485:154(f16vec2) Load 156(f16c2) + 5486:6(float16_t) Load 137(f16bias) + 5487: 7(f16vec4) ImageSampleImplicitLod 5484 5485 Bias 5486 + 5488: 7(f16vec4) Load 5452(texel) + 5489: 7(f16vec4) FAdd 5488 5487 + Store 5452(texel) 5489 + 5492: 162 Load 5491(t3D) + 5493: 5456 Load 5458(s) + 5494: 163 SampledImage 5492 5493 + 5495: 167(fvec3) Load 169(c3) + 5496: 7(f16vec4) ImageSampleImplicitLod 5494 5495 + 5497: 7(f16vec4) Load 5452(texel) + 5498: 7(f16vec4) FAdd 5497 5496 + Store 5452(texel) 5498 + 5499: 162 Load 5491(t3D) + 5500: 5456 Load 5458(s) + 5501: 163 SampledImage 5499 5500 + 5502:175(f16vec3) Load 177(f16c3) + 5503:6(float16_t) Load 137(f16bias) + 5504: 7(f16vec4) ImageSampleImplicitLod 5501 5502 Bias 5503 + 5505: 7(f16vec4) Load 5452(texel) + 5506: 7(f16vec4) FAdd 5505 5504 + Store 5452(texel) 5506 + 5509: 183 Load 5508(tCube) + 5510: 5456 Load 5458(s) + 5511: 184 SampledImage 5509 5510 + 5512: 167(fvec3) Load 169(c3) + 5513: 7(f16vec4) ImageSampleImplicitLod 5511 5512 + 5514: 7(f16vec4) Load 5452(texel) + 5515: 7(f16vec4) FAdd 5514 5513 + Store 5452(texel) 5515 + 5516: 183 Load 5508(tCube) + 5517: 5456 Load 5458(s) + 5518: 184 SampledImage 5516 5517 + 5519:175(f16vec3) Load 177(f16c3) + 5520:6(float16_t) Load 137(f16bias) + 5521: 7(f16vec4) ImageSampleImplicitLod 5518 5519 Bias 5520 + 5522: 7(f16vec4) Load 5452(texel) + 5523: 7(f16vec4) FAdd 5522 5521 + Store 5452(texel) 5523 + 5524: 122 Load 5454(t1D) + 5526: 5456 Load 5525(sShadow) + 5527: 199 SampledImage 5524 5526 + 5528: 167(fvec3) Load 169(c3) + 5529: 52(float) CompositeExtract 5528 2 + 5530:6(float16_t) ImageSampleDrefImplicitLod 5527 5528 5529 + 5531: 208(ptr) AccessChain 5452(texel) 207 + 5532:6(float16_t) Load 5531 + 5533:6(float16_t) FAdd 5532 5530 + 5534: 208(ptr) AccessChain 5452(texel) 207 + Store 5534 5533 + 5535: 122 Load 5454(t1D) + 5536: 5456 Load 5525(sShadow) + 5537: 199 SampledImage 5535 5536 + 5538:154(f16vec2) Load 156(f16c2) + 5539: 52(float) Load 215(compare) + 5540:6(float16_t) Load 137(f16bias) + 5541:6(float16_t) ImageSampleDrefImplicitLod 5537 5538 5539 Bias 5540 + 5542: 208(ptr) AccessChain 5452(texel) 207 + 5543:6(float16_t) Load 5542 + 5544:6(float16_t) FAdd 5543 5541 + 5545: 208(ptr) AccessChain 5452(texel) 207 + Store 5545 5544 + 5546: 142 Load 5474(t2D) + 5547: 5456 Load 5525(sShadow) + 5548: 224 SampledImage 5546 5547 + 5549: 167(fvec3) Load 169(c3) + 5550: 52(float) CompositeExtract 5549 2 + 5551:6(float16_t) ImageSampleDrefImplicitLod 5548 5549 5550 + 5552: 208(ptr) AccessChain 5452(texel) 207 + 5553:6(float16_t) Load 5552 + 5554:6(float16_t) FAdd 5553 5551 + 5555: 208(ptr) AccessChain 5452(texel) 207 + Store 5555 5554 + 5556: 142 Load 5474(t2D) + 5557: 5456 Load 5525(sShadow) + 5558: 224 SampledImage 5556 5557 + 5559:154(f16vec2) Load 156(f16c2) + 5560: 52(float) Load 215(compare) + 5561:6(float16_t) Load 137(f16bias) + 5562:6(float16_t) ImageSampleDrefImplicitLod 5558 5559 5560 Bias 5561 + 5563: 208(ptr) AccessChain 5452(texel) 207 + 5564:6(float16_t) Load 5563 + 5565:6(float16_t) FAdd 5564 5562 + 5566: 208(ptr) AccessChain 5452(texel) 207 + Store 5566 5565 + 5567: 183 Load 5508(tCube) + 5568: 5456 Load 5525(sShadow) + 5569: 245 SampledImage 5567 5568 + 5570: 249(fvec4) Load 251(c4) + 5571: 52(float) CompositeExtract 5570 3 + 5572:6(float16_t) ImageSampleDrefImplicitLod 5569 5570 5571 + 5573: 208(ptr) AccessChain 5452(texel) 207 + 5574:6(float16_t) Load 5573 + 5575:6(float16_t) FAdd 5574 5572 + 5576: 208(ptr) AccessChain 5452(texel) 207 + Store 5576 5575 + 5577: 183 Load 5508(tCube) + 5578: 5456 Load 5525(sShadow) + 5579: 245 SampledImage 5577 5578 + 5580:175(f16vec3) Load 177(f16c3) + 5581: 52(float) Load 215(compare) + 5582:6(float16_t) Load 137(f16bias) + 5583:6(float16_t) ImageSampleDrefImplicitLod 5579 5580 5581 Bias 5582 + 5584: 208(ptr) AccessChain 5452(texel) 207 + 5585:6(float16_t) Load 5584 + 5586:6(float16_t) FAdd 5585 5583 + 5587: 208(ptr) AccessChain 5452(texel) 207 + Store 5587 5586 + 5590: 268 Load 5589(t1DArray) + 5591: 5456 Load 5458(s) + 5592: 269 SampledImage 5590 5591 + 5593: 53(fvec2) Load 148(c2) + 5594: 7(f16vec4) ImageSampleImplicitLod 5592 5593 + 5595: 7(f16vec4) Load 5452(texel) + 5596: 7(f16vec4) FAdd 5595 5594 + Store 5452(texel) 5596 + 5597: 268 Load 5589(t1DArray) + 5598: 5456 Load 5458(s) + 5599: 269 SampledImage 5597 5598 + 5600:154(f16vec2) Load 156(f16c2) + 5601:6(float16_t) Load 137(f16bias) + 5602: 7(f16vec4) ImageSampleImplicitLod 5599 5600 Bias 5601 + 5603: 7(f16vec4) Load 5452(texel) + 5604: 7(f16vec4) FAdd 5603 5602 + Store 5452(texel) 5604 + 5607: 283 Load 5606(t2DArray) + 5608: 5456 Load 5458(s) + 5609: 284 SampledImage 5607 5608 + 5610: 167(fvec3) Load 169(c3) + 5611: 7(f16vec4) ImageSampleImplicitLod 5609 5610 + 5612: 7(f16vec4) Load 5452(texel) + 5613: 7(f16vec4) FAdd 5612 5611 + Store 5452(texel) 5613 + 5614: 283 Load 5606(t2DArray) + 5615: 5456 Load 5458(s) + 5616: 284 SampledImage 5614 5615 + 5617:175(f16vec3) Load 177(f16c3) + 5618:6(float16_t) Load 137(f16bias) + 5619: 7(f16vec4) ImageSampleImplicitLod 5616 5617 Bias 5618 + 5620: 7(f16vec4) Load 5452(texel) + 5621: 7(f16vec4) FAdd 5620 5619 + Store 5452(texel) 5621 + 5624: 298 Load 5623(tCubeArray) + 5625: 5456 Load 5458(s) + 5626: 299 SampledImage 5624 5625 + 5627: 249(fvec4) Load 251(c4) + 5628: 7(f16vec4) ImageSampleImplicitLod 5626 5627 + 5629: 7(f16vec4) Load 5452(texel) + 5630: 7(f16vec4) FAdd 5629 5628 + Store 5452(texel) 5630 + 5631: 298 Load 5623(tCubeArray) + 5632: 5456 Load 5458(s) + 5633: 299 SampledImage 5631 5632 + 5634: 7(f16vec4) Load 309(f16c4) + 5635:6(float16_t) Load 137(f16bias) + 5636: 7(f16vec4) ImageSampleImplicitLod 5633 5634 Bias 5635 + 5637: 7(f16vec4) Load 5452(texel) + 5638: 7(f16vec4) FAdd 5637 5636 + Store 5452(texel) 5638 + 5639: 268 Load 5589(t1DArray) + 5640: 5456 Load 5525(sShadow) + 5641: 316 SampledImage 5639 5640 + 5642: 167(fvec3) Load 169(c3) + 5643: 52(float) CompositeExtract 5642 2 + 5644:6(float16_t) ImageSampleDrefImplicitLod 5641 5642 5643 + 5645: 208(ptr) AccessChain 5452(texel) 207 + 5646:6(float16_t) Load 5645 + 5647:6(float16_t) FAdd 5646 5644 + 5648: 208(ptr) AccessChain 5452(texel) 207 + Store 5648 5647 + 5649: 268 Load 5589(t1DArray) + 5650: 5456 Load 5525(sShadow) + 5651: 316 SampledImage 5649 5650 + 5652:154(f16vec2) Load 156(f16c2) + 5653: 52(float) Load 215(compare) + 5654:6(float16_t) Load 137(f16bias) + 5655:6(float16_t) ImageSampleDrefImplicitLod 5651 5652 5653 Bias 5654 + 5656: 208(ptr) AccessChain 5452(texel) 207 + 5657:6(float16_t) Load 5656 + 5658:6(float16_t) FAdd 5657 5655 + 5659: 208(ptr) AccessChain 5452(texel) 207 + Store 5659 5658 + 5660: 283 Load 5606(t2DArray) + 5661: 5456 Load 5525(sShadow) + 5662: 337 SampledImage 5660 5661 + 5663: 249(fvec4) Load 251(c4) + 5664: 52(float) CompositeExtract 5663 3 + 5665:6(float16_t) ImageSampleDrefImplicitLod 5662 5663 5664 + 5666: 208(ptr) AccessChain 5452(texel) 207 + 5667:6(float16_t) Load 5666 + 5668:6(float16_t) FAdd 5667 5665 + 5669: 208(ptr) AccessChain 5452(texel) 207 + Store 5669 5668 + 5670: 283 Load 5606(t2DArray) + 5671: 5456 Load 5525(sShadow) + 5672: 337 SampledImage 5670 5671 + 5673:175(f16vec3) Load 177(f16c3) + 5674: 52(float) Load 215(compare) + 5675:6(float16_t) ImageSampleDrefImplicitLod 5672 5673 5674 + 5676: 208(ptr) AccessChain 5452(texel) 207 + 5677:6(float16_t) Load 5676 + 5678:6(float16_t) FAdd 5677 5675 + 5679: 208(ptr) AccessChain 5452(texel) 207 + Store 5679 5678 + 5682: 356 Load 5681(t2DRect) + 5683: 5456 Load 5458(s) + 5684: 357 SampledImage 5682 5683 + 5685: 53(fvec2) Load 148(c2) + 5686: 7(f16vec4) ImageSampleImplicitLod 5684 5685 + 5687: 7(f16vec4) Load 5452(texel) + 5688: 7(f16vec4) FAdd 5687 5686 + Store 5452(texel) 5688 + 5689: 356 Load 5681(t2DRect) + 5690: 5456 Load 5458(s) + 5691: 357 SampledImage 5689 5690 + 5692:154(f16vec2) Load 156(f16c2) + 5693: 7(f16vec4) ImageSampleImplicitLod 5691 5692 + 5694: 7(f16vec4) Load 5452(texel) + 5695: 7(f16vec4) FAdd 5694 5693 + Store 5452(texel) 5695 + 5696: 356 Load 5681(t2DRect) + 5697: 5456 Load 5525(sShadow) + 5698: 371 SampledImage 5696 5697 + 5699: 167(fvec3) Load 169(c3) + 5700: 52(float) CompositeExtract 5699 2 + 5701:6(float16_t) ImageSampleDrefImplicitLod 5698 5699 5700 + 5702: 208(ptr) AccessChain 5452(texel) 207 + 5703:6(float16_t) Load 5702 + 5704:6(float16_t) FAdd 5703 5701 + 5705: 208(ptr) AccessChain 5452(texel) 207 + Store 5705 5704 + 5706: 356 Load 5681(t2DRect) + 5707: 5456 Load 5525(sShadow) + 5708: 371 SampledImage 5706 5707 + 5709:154(f16vec2) Load 156(f16c2) + 5710: 52(float) Load 215(compare) + 5711:6(float16_t) ImageSampleDrefImplicitLod 5708 5709 5710 + 5712: 208(ptr) AccessChain 5452(texel) 207 + 5713:6(float16_t) Load 5712 + 5714:6(float16_t) FAdd 5713 5711 + 5715: 208(ptr) AccessChain 5452(texel) 207 + Store 5715 5714 + 5716: 298 Load 5623(tCubeArray) + 5717: 5456 Load 5525(sShadow) + 5718: 391 SampledImage 5716 5717 + 5719: 249(fvec4) Load 251(c4) + 5720: 52(float) Load 215(compare) + 5721:6(float16_t) ImageSampleDrefImplicitLod 5718 5719 5720 + 5722: 208(ptr) AccessChain 5452(texel) 207 + 5723:6(float16_t) Load 5722 + 5724:6(float16_t) FAdd 5723 5721 + 5725: 208(ptr) AccessChain 5452(texel) 207 + Store 5725 5724 + 5726: 298 Load 5623(tCubeArray) + 5727: 5456 Load 5525(sShadow) + 5728: 391 SampledImage 5726 5727 + 5729: 7(f16vec4) Load 309(f16c4) + 5730: 52(float) Load 215(compare) + 5731:6(float16_t) ImageSampleDrefImplicitLod 5728 5729 5730 + 5732: 208(ptr) AccessChain 5452(texel) 207 + 5733:6(float16_t) Load 5732 + 5734:6(float16_t) FAdd 5733 5731 + 5735: 208(ptr) AccessChain 5452(texel) 207 + Store 5735 5734 + 5736: 7(f16vec4) Load 5452(texel) + ReturnValue 5736 + FunctionEnd +117(testSubpassLoad(): 7(f16vec4) Function None 8 + 118: Label + 5742: 5739 Load 5741(subpass) + 5744: 7(f16vec4) ImageRead 5742 5743 + 5748: 5745 Load 5747(subpassMS) + 5749: 7(f16vec4) ImageRead 5748 5743 Sample 1326 + 5750: 7(f16vec4) FAdd 5744 5749 + ReturnValue 5750 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float32.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float32.frag.out new file mode 100644 index 00000000000..1a325ea1876 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float32.frag.out @@ -0,0 +1,811 @@ +spv.float32.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.1 specification (or requires extension) + OpCapability Float16 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 533 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + Capability DerivativeControl + Capability InterpolationFunction + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 471 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" + Name 4 "main" + Name 6 "literal(" + Name 8 "operators(" + Name 10 "typeCast(" + Name 12 "builtinAngleTrigFuncs(" + Name 14 "builtinExpFuncs(" + Name 16 "builtinCommonFuncs(" + Name 18 "builtinGeometryFuncs(" + Name 20 "builtinMatrixFuncs(" + Name 22 "builtinVecRelFuncs(" + Name 24 "builtinFragProcFuncs(" + Name 29 "f32v" + Name 40 "f32v" + Name 62 "f32m" + Name 85 "f32" + Name 109 "b" + Name 152 "f64v" + Name 155 "f32v" + Name 160 "bv" + Name 175 "f16v" + Name 183 "i8v" + Name 189 "i16v" + Name 195 "i32v" + Name 201 "i64v" + Name 207 "u8v" + Name 213 "u16v" + Name 218 "u32v" + Name 224 "u64v" + Name 229 "f32v2" + Name 230 "f32v1" + Name 262 "f32v2" + Name 263 "f32v1" + Name 279 "f32v2" + Name 280 "f32v1" + Name 301 "f32" + Name 305 "f32v3" + Name 345 "bv" + Name 366 "b" + Name 376 "iv" + Name 377 "ResType" + Name 384 "f32" + Name 385 "f32v1" + Name 389 "f32v2" + Name 395 "f32v3" + Name 414 "f32m3" + Name 415 "f32m1" + Name 417 "f32m2" + Name 426 "f32v1" + Name 428 "f32v2" + Name 433 "f32m4" + Name 436 "f32" + Name 439 "f32m5" + Name 444 "f32m6" + Name 445 "f32m7" + Name 448 "bv" + Name 449 "f32v1" + Name 451 "f32v2" + Name 469 "f32v" + Name 471 "if32v" + Name 520 "S" + MemberName 520(S) 0 "x" + MemberName 520(S) 1 "y" + MemberName 520(S) 2 "z" + Name 522 "B1" + MemberName 522(B1) 0 "a" + MemberName 522(B1) 1 "b" + MemberName 522(B1) 2 "c" + MemberName 522(B1) 3 "d" + MemberName 522(B1) 4 "e" + MemberName 522(B1) 5 "f" + MemberName 522(B1) 6 "g" + MemberName 522(B1) 7 "h" + Name 524 "" + Name 525 "sf16" + Name 526 "sf" + Name 527 "sd" + Name 528 "f16_to_f" + Name 530 "f16_to_d" + Name 531 "f_to_f16" + Name 532 "d_to_f16" + Decorate 518 ArrayStride 16 + Decorate 519 ArrayStride 32 + MemberDecorate 520(S) 0 Offset 0 + MemberDecorate 520(S) 1 Offset 8 + MemberDecorate 520(S) 2 Offset 16 + Decorate 521 ArrayStride 32 + MemberDecorate 522(B1) 0 Offset 0 + MemberDecorate 522(B1) 1 Offset 8 + MemberDecorate 522(B1) 2 Offset 16 + MemberDecorate 522(B1) 3 Offset 32 + MemberDecorate 522(B1) 4 ColMajor + MemberDecorate 522(B1) 4 Offset 64 + MemberDecorate 522(B1) 4 MatrixStride 16 + MemberDecorate 522(B1) 5 ColMajor + MemberDecorate 522(B1) 5 Offset 96 + MemberDecorate 522(B1) 5 MatrixStride 16 + MemberDecorate 522(B1) 6 Offset 160 + MemberDecorate 522(B1) 7 Offset 192 + Decorate 522(B1) Block + Decorate 524 DescriptorSet 0 + Decorate 525(sf16) SpecId 100 + Decorate 526(sf) SpecId 101 + Decorate 527(sd) SpecId 102 + 2: TypeVoid + 3: TypeFunction 2 + 26: TypeFloat 32 + 27: TypeVector 26(float) 2 + 28: TypePointer Function 27(fvec2) + 30: 26(float) Constant 897988541 + 31: TypeInt 32 0 + 32: 31(int) Constant 0 + 33: TypePointer Function 26(float) + 35: 26(float) Constant 3196059648 + 36: 26(float) Constant 1022739087 + 37: 27(fvec2) ConstantComposite 35 36 + 54: 26(float) Constant 1065353216 + 60: TypeMatrix 27(fvec2) 2 + 61: TypePointer Function 60 + 88: 31(int) Constant 1 + 107: TypeBool + 108: TypePointer Function 107(bool) + 149: TypeFloat 64 + 150: TypeVector 149(float64_t) 3 + 151: TypePointer Function 150(f64vec3) + 153: TypeVector 26(float) 3 + 154: TypePointer Function 153(fvec3) + 158: TypeVector 107(bool) 3 + 159: TypePointer Function 158(bvec3) + 162: 26(float) Constant 0 + 163: 153(fvec3) ConstantComposite 162 162 162 + 164: 153(fvec3) ConstantComposite 54 54 54 + 172: TypeFloat 16 + 173: TypeVector 172(float16_t) 3 + 174: TypePointer Function 173(f16vec3) + 180: TypeInt 8 1 + 181: TypeVector 180(int8_t) 3 + 182: TypePointer Function 181(i8vec3) + 186: TypeInt 16 1 + 187: TypeVector 186(int16_t) 3 + 188: TypePointer Function 187(i16vec3) + 192: TypeInt 32 1 + 193: TypeVector 192(int) 3 + 194: TypePointer Function 193(ivec3) + 198: TypeInt 64 1 + 199: TypeVector 198(int64_t) 3 + 200: TypePointer Function 199(i64vec3) + 204: TypeInt 8 0 + 205: TypeVector 204(int8_t) 3 + 206: TypePointer Function 205(i8vec3) + 210: TypeInt 16 0 + 211: TypeVector 210(int16_t) 3 + 212: TypePointer Function 211(i16vec3) + 216: TypeVector 31(int) 3 + 217: TypePointer Function 216(ivec3) + 221: TypeInt 64 0 + 222: TypeVector 221(int64_t) 3 + 223: TypePointer Function 222(i64vec3) + 227: TypeVector 26(float) 4 + 228: TypePointer Function 227(fvec4) + 377(ResType): TypeStruct 153(fvec3) 193(ivec3) + 412: TypeMatrix 153(fvec3) 2 + 413: TypePointer Function 412 + 431: TypeMatrix 27(fvec2) 3 + 432: TypePointer Function 431 + 437: TypeMatrix 153(fvec3) 3 + 438: TypePointer Function 437 + 442: TypeMatrix 227(fvec4) 4 + 443: TypePointer Function 442 + 470: TypePointer Input 153(fvec3) + 471(if32v): 470(ptr) Variable Input + 472: TypePointer Input 26(float) + 509: 192(int) Constant 1 + 514: 26(float) Constant 1056964608 + 515: 27(fvec2) ConstantComposite 514 514 + 517: 31(int) Constant 2 + 518: TypeArray 26(float) 517 + 519: TypeArray 412 517 + 520(S): TypeStruct 26(float) 27(fvec2) 153(fvec3) + 521: TypeArray 520(S) 517 + 522(B1): TypeStruct 26(float) 27(fvec2) 153(fvec3) 518 412 519 520(S) 521 + 523: TypePointer Uniform 522(B1) + 524: 523(ptr) Variable Uniform + 525(sf16):172(float16_t) SpecConstant 12288 + 526(sf): 26(float) SpecConstant 1048576000 + 527(sd):149(float64_t) SpecConstant 0 1071644672 + 528(f16_to_f): 26(float) SpecConstantOp 115 525(sf16) + 529: 26(float) SpecConstantOp 115 525(sf16) + 530(f16_to_d):149(float64_t) SpecConstantOp 115 529 + 531(f_to_f16):172(float16_t) SpecConstantOp 115 526(sf) + 532(d_to_f16):172(float16_t) SpecConstantOp 115 527(sd) + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 29(f32v): 28(ptr) Variable Function + 34: 33(ptr) AccessChain 29(f32v) 32 + Store 34 30 + 38: 27(fvec2) Load 29(f32v) + 39: 27(fvec2) FAdd 38 37 + Store 29(f32v) 39 + Return + FunctionEnd + 8(operators(): 2 Function None 3 + 9: Label + 40(f32v): 28(ptr) Variable Function + 62(f32m): 61(ptr) Variable Function + 85(f32): 33(ptr) Variable Function + 109(b): 108(ptr) Variable Function + 41: 27(fvec2) Load 40(f32v) + 42: 27(fvec2) Load 40(f32v) + 43: 27(fvec2) FAdd 42 41 + Store 40(f32v) 43 + 44: 27(fvec2) Load 40(f32v) + 45: 27(fvec2) Load 40(f32v) + 46: 27(fvec2) FSub 45 44 + Store 40(f32v) 46 + 47: 27(fvec2) Load 40(f32v) + 48: 27(fvec2) Load 40(f32v) + 49: 27(fvec2) FMul 48 47 + Store 40(f32v) 49 + 50: 27(fvec2) Load 40(f32v) + 51: 27(fvec2) Load 40(f32v) + 52: 27(fvec2) FDiv 51 50 + Store 40(f32v) 52 + 53: 27(fvec2) Load 40(f32v) + 55: 27(fvec2) CompositeConstruct 54 54 + 56: 27(fvec2) FAdd 53 55 + Store 40(f32v) 56 + 57: 27(fvec2) Load 40(f32v) + 58: 27(fvec2) CompositeConstruct 54 54 + 59: 27(fvec2) FSub 57 58 + Store 40(f32v) 59 + 63: 60 Load 62(f32m) + 64: 27(fvec2) CompositeConstruct 54 54 + 65: 27(fvec2) CompositeExtract 63 0 + 66: 27(fvec2) FAdd 65 64 + 67: 27(fvec2) CompositeExtract 63 1 + 68: 27(fvec2) FAdd 67 64 + 69: 60 CompositeConstruct 66 68 + Store 62(f32m) 69 + 70: 60 Load 62(f32m) + 71: 27(fvec2) CompositeConstruct 54 54 + 72: 27(fvec2) CompositeExtract 70 0 + 73: 27(fvec2) FSub 72 71 + 74: 27(fvec2) CompositeExtract 70 1 + 75: 27(fvec2) FSub 74 71 + 76: 60 CompositeConstruct 73 75 + Store 62(f32m) 76 + 77: 27(fvec2) Load 40(f32v) + 78: 27(fvec2) FNegate 77 + Store 40(f32v) 78 + 79: 60 Load 62(f32m) + 80: 27(fvec2) CompositeExtract 79 0 + 81: 27(fvec2) FNegate 80 + 82: 27(fvec2) CompositeExtract 79 1 + 83: 27(fvec2) FNegate 82 + 84: 60 CompositeConstruct 81 83 + Store 62(f32m) 84 + 86: 33(ptr) AccessChain 40(f32v) 32 + 87: 26(float) Load 86 + 89: 33(ptr) AccessChain 40(f32v) 88 + 90: 26(float) Load 89 + 91: 26(float) FAdd 87 90 + Store 85(f32) 91 + 92: 33(ptr) AccessChain 40(f32v) 32 + 93: 26(float) Load 92 + 94: 33(ptr) AccessChain 40(f32v) 88 + 95: 26(float) Load 94 + 96: 26(float) FSub 93 95 + Store 85(f32) 96 + 97: 33(ptr) AccessChain 40(f32v) 32 + 98: 26(float) Load 97 + 99: 33(ptr) AccessChain 40(f32v) 88 + 100: 26(float) Load 99 + 101: 26(float) FMul 98 100 + Store 85(f32) 101 + 102: 33(ptr) AccessChain 40(f32v) 32 + 103: 26(float) Load 102 + 104: 33(ptr) AccessChain 40(f32v) 88 + 105: 26(float) Load 104 + 106: 26(float) FDiv 103 105 + Store 85(f32) 106 + 110: 33(ptr) AccessChain 40(f32v) 32 + 111: 26(float) Load 110 + 112: 26(float) Load 85(f32) + 113: 107(bool) FOrdNotEqual 111 112 + Store 109(b) 113 + 114: 33(ptr) AccessChain 40(f32v) 88 + 115: 26(float) Load 114 + 116: 26(float) Load 85(f32) + 117: 107(bool) FOrdEqual 115 116 + Store 109(b) 117 + 118: 33(ptr) AccessChain 40(f32v) 32 + 119: 26(float) Load 118 + 120: 26(float) Load 85(f32) + 121: 107(bool) FOrdGreaterThan 119 120 + Store 109(b) 121 + 122: 33(ptr) AccessChain 40(f32v) 88 + 123: 26(float) Load 122 + 124: 26(float) Load 85(f32) + 125: 107(bool) FOrdLessThan 123 124 + Store 109(b) 125 + 126: 33(ptr) AccessChain 40(f32v) 32 + 127: 26(float) Load 126 + 128: 26(float) Load 85(f32) + 129: 107(bool) FOrdGreaterThanEqual 127 128 + Store 109(b) 129 + 130: 33(ptr) AccessChain 40(f32v) 88 + 131: 26(float) Load 130 + 132: 26(float) Load 85(f32) + 133: 107(bool) FOrdLessThanEqual 131 132 + Store 109(b) 133 + 134: 27(fvec2) Load 40(f32v) + 135: 26(float) Load 85(f32) + 136: 27(fvec2) VectorTimesScalar 134 135 + Store 40(f32v) 136 + 137: 60 Load 62(f32m) + 138: 26(float) Load 85(f32) + 139: 60 MatrixTimesScalar 137 138 + Store 62(f32m) 139 + 140: 60 Load 62(f32m) + 141: 27(fvec2) Load 40(f32v) + 142: 27(fvec2) MatrixTimesVector 140 141 + Store 40(f32v) 142 + 143: 27(fvec2) Load 40(f32v) + 144: 60 Load 62(f32m) + 145: 27(fvec2) VectorTimesMatrix 143 144 + Store 40(f32v) 145 + 146: 60 Load 62(f32m) + 147: 60 Load 62(f32m) + 148: 60 MatrixTimesMatrix 146 147 + Store 62(f32m) 148 + Return + FunctionEnd + 10(typeCast(): 2 Function None 3 + 11: Label + 152(f64v): 151(ptr) Variable Function + 155(f32v): 154(ptr) Variable Function + 160(bv): 159(ptr) Variable Function + 175(f16v): 174(ptr) Variable Function + 183(i8v): 182(ptr) Variable Function + 189(i16v): 188(ptr) Variable Function + 195(i32v): 194(ptr) Variable Function + 201(i64v): 200(ptr) Variable Function + 207(u8v): 206(ptr) Variable Function + 213(u16v): 212(ptr) Variable Function + 218(u32v): 217(ptr) Variable Function + 224(u64v): 223(ptr) Variable Function + 156: 153(fvec3) Load 155(f32v) + 157:150(f64vec3) FConvert 156 + Store 152(f64v) 157 + 161: 158(bvec3) Load 160(bv) + 165: 153(fvec3) Select 161 164 163 + Store 155(f32v) 165 + 166: 153(fvec3) Load 155(f32v) + 167: 158(bvec3) FOrdNotEqual 166 163 + Store 160(bv) 167 + 168:150(f64vec3) Load 152(f64v) + 169: 153(fvec3) FConvert 168 + Store 155(f32v) 169 + 170: 153(fvec3) Load 155(f32v) + 171:150(f64vec3) FConvert 170 + Store 152(f64v) 171 + 176:173(f16vec3) Load 175(f16v) + 177: 153(fvec3) FConvert 176 + Store 155(f32v) 177 + 178: 153(fvec3) Load 155(f32v) + 179:173(f16vec3) FConvert 178 + Store 175(f16v) 179 + 184: 153(fvec3) Load 155(f32v) + 185: 181(i8vec3) ConvertFToS 184 + Store 183(i8v) 185 + 190: 153(fvec3) Load 155(f32v) + 191:187(i16vec3) ConvertFToS 190 + Store 189(i16v) 191 + 196: 153(fvec3) Load 155(f32v) + 197: 193(ivec3) ConvertFToS 196 + Store 195(i32v) 197 + 202: 153(fvec3) Load 155(f32v) + 203:199(i64vec3) ConvertFToS 202 + Store 201(i64v) 203 + 208: 153(fvec3) Load 155(f32v) + 209: 205(i8vec3) ConvertFToU 208 + Store 207(u8v) 209 + 214: 153(fvec3) Load 155(f32v) + 215:211(i16vec3) ConvertFToU 214 + Store 213(u16v) 215 + 219: 153(fvec3) Load 155(f32v) + 220: 216(ivec3) ConvertFToU 219 + Store 218(u32v) 220 + 225: 153(fvec3) Load 155(f32v) + 226:222(i64vec3) ConvertFToU 225 + Store 224(u64v) 226 + Return + FunctionEnd +12(builtinAngleTrigFuncs(): 2 Function None 3 + 13: Label + 229(f32v2): 228(ptr) Variable Function + 230(f32v1): 228(ptr) Variable Function + 231: 227(fvec4) Load 230(f32v1) + 232: 227(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 231 + Store 229(f32v2) 232 + 233: 227(fvec4) Load 230(f32v1) + 234: 227(fvec4) ExtInst 1(GLSL.std.450) 12(Degrees) 233 + Store 229(f32v2) 234 + 235: 227(fvec4) Load 230(f32v1) + 236: 227(fvec4) ExtInst 1(GLSL.std.450) 13(Sin) 235 + Store 229(f32v2) 236 + 237: 227(fvec4) Load 230(f32v1) + 238: 227(fvec4) ExtInst 1(GLSL.std.450) 14(Cos) 237 + Store 229(f32v2) 238 + 239: 227(fvec4) Load 230(f32v1) + 240: 227(fvec4) ExtInst 1(GLSL.std.450) 15(Tan) 239 + Store 229(f32v2) 240 + 241: 227(fvec4) Load 230(f32v1) + 242: 227(fvec4) ExtInst 1(GLSL.std.450) 16(Asin) 241 + Store 229(f32v2) 242 + 243: 227(fvec4) Load 230(f32v1) + 244: 227(fvec4) ExtInst 1(GLSL.std.450) 17(Acos) 243 + Store 229(f32v2) 244 + 245: 227(fvec4) Load 230(f32v1) + 246: 227(fvec4) Load 229(f32v2) + 247: 227(fvec4) ExtInst 1(GLSL.std.450) 25(Atan2) 245 246 + Store 229(f32v2) 247 + 248: 227(fvec4) Load 230(f32v1) + 249: 227(fvec4) ExtInst 1(GLSL.std.450) 18(Atan) 248 + Store 229(f32v2) 249 + 250: 227(fvec4) Load 230(f32v1) + 251: 227(fvec4) ExtInst 1(GLSL.std.450) 19(Sinh) 250 + Store 229(f32v2) 251 + 252: 227(fvec4) Load 230(f32v1) + 253: 227(fvec4) ExtInst 1(GLSL.std.450) 20(Cosh) 252 + Store 229(f32v2) 253 + 254: 227(fvec4) Load 230(f32v1) + 255: 227(fvec4) ExtInst 1(GLSL.std.450) 21(Tanh) 254 + Store 229(f32v2) 255 + 256: 227(fvec4) Load 230(f32v1) + 257: 227(fvec4) ExtInst 1(GLSL.std.450) 22(Asinh) 256 + Store 229(f32v2) 257 + 258: 227(fvec4) Load 230(f32v1) + 259: 227(fvec4) ExtInst 1(GLSL.std.450) 23(Acosh) 258 + Store 229(f32v2) 259 + 260: 227(fvec4) Load 230(f32v1) + 261: 227(fvec4) ExtInst 1(GLSL.std.450) 24(Atanh) 260 + Store 229(f32v2) 261 + Return + FunctionEnd +14(builtinExpFuncs(): 2 Function None 3 + 15: Label + 262(f32v2): 28(ptr) Variable Function + 263(f32v1): 28(ptr) Variable Function + 264: 27(fvec2) Load 263(f32v1) + 265: 27(fvec2) Load 262(f32v2) + 266: 27(fvec2) ExtInst 1(GLSL.std.450) 26(Pow) 264 265 + Store 262(f32v2) 266 + 267: 27(fvec2) Load 263(f32v1) + 268: 27(fvec2) ExtInst 1(GLSL.std.450) 27(Exp) 267 + Store 262(f32v2) 268 + 269: 27(fvec2) Load 263(f32v1) + 270: 27(fvec2) ExtInst 1(GLSL.std.450) 28(Log) 269 + Store 262(f32v2) 270 + 271: 27(fvec2) Load 263(f32v1) + 272: 27(fvec2) ExtInst 1(GLSL.std.450) 29(Exp2) 271 + Store 262(f32v2) 272 + 273: 27(fvec2) Load 263(f32v1) + 274: 27(fvec2) ExtInst 1(GLSL.std.450) 30(Log2) 273 + Store 262(f32v2) 274 + 275: 27(fvec2) Load 263(f32v1) + 276: 27(fvec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 275 + Store 262(f32v2) 276 + 277: 27(fvec2) Load 263(f32v1) + 278: 27(fvec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 277 + Store 262(f32v2) 278 + Return + FunctionEnd +16(builtinCommonFuncs(): 2 Function None 3 + 17: Label + 279(f32v2): 154(ptr) Variable Function + 280(f32v1): 154(ptr) Variable Function + 301(f32): 33(ptr) Variable Function + 305(f32v3): 154(ptr) Variable Function + 345(bv): 159(ptr) Variable Function + 366(b): 108(ptr) Variable Function + 376(iv): 194(ptr) Variable Function + 281: 153(fvec3) Load 280(f32v1) + 282: 153(fvec3) ExtInst 1(GLSL.std.450) 4(FAbs) 281 + Store 279(f32v2) 282 + 283: 153(fvec3) Load 280(f32v1) + 284: 153(fvec3) ExtInst 1(GLSL.std.450) 6(FSign) 283 + Store 279(f32v2) 284 + 285: 153(fvec3) Load 280(f32v1) + 286: 153(fvec3) ExtInst 1(GLSL.std.450) 8(Floor) 285 + Store 279(f32v2) 286 + 287: 153(fvec3) Load 280(f32v1) + 288: 153(fvec3) ExtInst 1(GLSL.std.450) 3(Trunc) 287 + Store 279(f32v2) 288 + 289: 153(fvec3) Load 280(f32v1) + 290: 153(fvec3) ExtInst 1(GLSL.std.450) 1(Round) 289 + Store 279(f32v2) 290 + 291: 153(fvec3) Load 280(f32v1) + 292: 153(fvec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 291 + Store 279(f32v2) 292 + 293: 153(fvec3) Load 280(f32v1) + 294: 153(fvec3) ExtInst 1(GLSL.std.450) 9(Ceil) 293 + Store 279(f32v2) 294 + 295: 153(fvec3) Load 280(f32v1) + 296: 153(fvec3) ExtInst 1(GLSL.std.450) 10(Fract) 295 + Store 279(f32v2) 296 + 297: 153(fvec3) Load 280(f32v1) + 298: 153(fvec3) Load 279(f32v2) + 299: 153(fvec3) FMod 297 298 + Store 279(f32v2) 299 + 300: 153(fvec3) Load 280(f32v1) + 302: 26(float) Load 301(f32) + 303: 153(fvec3) CompositeConstruct 302 302 302 + 304: 153(fvec3) FMod 300 303 + Store 279(f32v2) 304 + 306: 153(fvec3) Load 280(f32v1) + 307: 153(fvec3) ExtInst 1(GLSL.std.450) 35(Modf) 306 279(f32v2) + Store 305(f32v3) 307 + 308: 153(fvec3) Load 280(f32v1) + 309: 153(fvec3) Load 279(f32v2) + 310: 153(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 308 309 + Store 305(f32v3) 310 + 311: 153(fvec3) Load 280(f32v1) + 312: 26(float) Load 301(f32) + 313: 153(fvec3) CompositeConstruct 312 312 312 + 314: 153(fvec3) ExtInst 1(GLSL.std.450) 37(FMin) 311 313 + Store 305(f32v3) 314 + 315: 153(fvec3) Load 280(f32v1) + 316: 153(fvec3) Load 279(f32v2) + 317: 153(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 315 316 + Store 305(f32v3) 317 + 318: 153(fvec3) Load 280(f32v1) + 319: 26(float) Load 301(f32) + 320: 153(fvec3) CompositeConstruct 319 319 319 + 321: 153(fvec3) ExtInst 1(GLSL.std.450) 40(FMax) 318 320 + Store 305(f32v3) 321 + 322: 153(fvec3) Load 280(f32v1) + 323: 26(float) Load 301(f32) + 324: 33(ptr) AccessChain 279(f32v2) 32 + 325: 26(float) Load 324 + 326: 153(fvec3) CompositeConstruct 323 323 323 + 327: 153(fvec3) CompositeConstruct 325 325 325 + 328: 153(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 322 326 327 + Store 305(f32v3) 328 + 329: 153(fvec3) Load 280(f32v1) + 330: 153(fvec3) Load 279(f32v2) + 331: 26(float) Load 301(f32) + 332: 153(fvec3) CompositeConstruct 331 331 331 + 333: 153(fvec3) ExtInst 1(GLSL.std.450) 43(FClamp) 329 330 332 + Store 305(f32v3) 333 + 334: 153(fvec3) Load 280(f32v1) + 335: 153(fvec3) Load 279(f32v2) + 336: 26(float) Load 301(f32) + 337: 153(fvec3) CompositeConstruct 336 336 336 + 338: 153(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 334 335 337 + Store 305(f32v3) 338 + 339: 153(fvec3) Load 280(f32v1) + 340: 153(fvec3) Load 279(f32v2) + 341: 153(fvec3) Load 305(f32v3) + 342: 153(fvec3) ExtInst 1(GLSL.std.450) 46(FMix) 339 340 341 + Store 305(f32v3) 342 + 343: 153(fvec3) Load 280(f32v1) + 344: 153(fvec3) Load 279(f32v2) + 346: 158(bvec3) Load 345(bv) + 347: 153(fvec3) Select 346 344 343 + Store 305(f32v3) 347 + 348: 153(fvec3) Load 280(f32v1) + 349: 153(fvec3) Load 279(f32v2) + 350: 153(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 348 349 + Store 305(f32v3) 350 + 351: 26(float) Load 301(f32) + 352: 153(fvec3) Load 305(f32v3) + 353: 153(fvec3) CompositeConstruct 351 351 351 + 354: 153(fvec3) ExtInst 1(GLSL.std.450) 48(Step) 353 352 + Store 305(f32v3) 354 + 355: 153(fvec3) Load 280(f32v1) + 356: 153(fvec3) Load 279(f32v2) + 357: 153(fvec3) Load 305(f32v3) + 358: 153(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 355 356 357 + Store 305(f32v3) 358 + 359: 26(float) Load 301(f32) + 360: 33(ptr) AccessChain 280(f32v1) 32 + 361: 26(float) Load 360 + 362: 153(fvec3) Load 279(f32v2) + 363: 153(fvec3) CompositeConstruct 359 359 359 + 364: 153(fvec3) CompositeConstruct 361 361 361 + 365: 153(fvec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 363 364 362 + Store 305(f32v3) 365 + 367: 26(float) Load 301(f32) + 368: 107(bool) IsNan 367 + Store 366(b) 368 + 369: 153(fvec3) Load 280(f32v1) + 370: 158(bvec3) IsInf 369 + Store 345(bv) 370 + 371: 153(fvec3) Load 280(f32v1) + 372: 153(fvec3) Load 279(f32v2) + 373: 153(fvec3) Load 305(f32v3) + 374: 153(fvec3) ExtInst 1(GLSL.std.450) 50(Fma) 371 372 373 + Store 305(f32v3) 374 + 375: 153(fvec3) Load 280(f32v1) + 378:377(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 375 + 379: 193(ivec3) CompositeExtract 378 1 + Store 376(iv) 379 + 380: 153(fvec3) CompositeExtract 378 0 + Store 279(f32v2) 380 + 381: 153(fvec3) Load 280(f32v1) + 382: 193(ivec3) Load 376(iv) + 383: 153(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 381 382 + Store 279(f32v2) 383 + Return + FunctionEnd +18(builtinGeometryFuncs(): 2 Function None 3 + 19: Label + 384(f32): 33(ptr) Variable Function + 385(f32v1): 154(ptr) Variable Function + 389(f32v2): 154(ptr) Variable Function + 395(f32v3): 154(ptr) Variable Function + 386: 153(fvec3) Load 385(f32v1) + 387: 26(float) ExtInst 1(GLSL.std.450) 66(Length) 386 + Store 384(f32) 387 + 388: 153(fvec3) Load 385(f32v1) + 390: 153(fvec3) Load 389(f32v2) + 391: 26(float) ExtInst 1(GLSL.std.450) 67(Distance) 388 390 + Store 384(f32) 391 + 392: 153(fvec3) Load 385(f32v1) + 393: 153(fvec3) Load 389(f32v2) + 394: 26(float) Dot 392 393 + Store 384(f32) 394 + 396: 153(fvec3) Load 385(f32v1) + 397: 153(fvec3) Load 389(f32v2) + 398: 153(fvec3) ExtInst 1(GLSL.std.450) 68(Cross) 396 397 + Store 395(f32v3) 398 + 399: 153(fvec3) Load 385(f32v1) + 400: 153(fvec3) ExtInst 1(GLSL.std.450) 69(Normalize) 399 + Store 389(f32v2) 400 + 401: 153(fvec3) Load 385(f32v1) + 402: 153(fvec3) Load 389(f32v2) + 403: 153(fvec3) Load 395(f32v3) + 404: 153(fvec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 401 402 403 + Store 395(f32v3) 404 + 405: 153(fvec3) Load 385(f32v1) + 406: 153(fvec3) Load 389(f32v2) + 407: 153(fvec3) ExtInst 1(GLSL.std.450) 71(Reflect) 405 406 + Store 395(f32v3) 407 + 408: 153(fvec3) Load 385(f32v1) + 409: 153(fvec3) Load 389(f32v2) + 410: 26(float) Load 384(f32) + 411: 153(fvec3) ExtInst 1(GLSL.std.450) 72(Refract) 408 409 410 + Store 395(f32v3) 411 + Return + FunctionEnd +20(builtinMatrixFuncs(): 2 Function None 3 + 21: Label + 414(f32m3): 413(ptr) Variable Function + 415(f32m1): 413(ptr) Variable Function + 417(f32m2): 413(ptr) Variable Function + 426(f32v1): 154(ptr) Variable Function + 428(f32v2): 28(ptr) Variable Function + 433(f32m4): 432(ptr) Variable Function + 436(f32): 33(ptr) Variable Function + 439(f32m5): 438(ptr) Variable Function + 444(f32m6): 443(ptr) Variable Function + 445(f32m7): 443(ptr) Variable Function + 416: 412 Load 415(f32m1) + 418: 412 Load 417(f32m2) + 419: 153(fvec3) CompositeExtract 416 0 + 420: 153(fvec3) CompositeExtract 418 0 + 421: 153(fvec3) FMul 419 420 + 422: 153(fvec3) CompositeExtract 416 1 + 423: 153(fvec3) CompositeExtract 418 1 + 424: 153(fvec3) FMul 422 423 + 425: 412 CompositeConstruct 421 424 + Store 414(f32m3) 425 + 427: 153(fvec3) Load 426(f32v1) + 429: 27(fvec2) Load 428(f32v2) + 430: 412 OuterProduct 427 429 + Store 415(f32m1) 430 + 434: 412 Load 415(f32m1) + 435: 431 Transpose 434 + Store 433(f32m4) 435 + 440: 437 Load 439(f32m5) + 441: 26(float) ExtInst 1(GLSL.std.450) 33(Determinant) 440 + Store 436(f32) 441 + 446: 442 Load 445(f32m7) + 447: 442 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 446 + Store 444(f32m6) 447 + Return + FunctionEnd +22(builtinVecRelFuncs(): 2 Function None 3 + 23: Label + 448(bv): 159(ptr) Variable Function + 449(f32v1): 154(ptr) Variable Function + 451(f32v2): 154(ptr) Variable Function + 450: 153(fvec3) Load 449(f32v1) + 452: 153(fvec3) Load 451(f32v2) + 453: 158(bvec3) FOrdLessThan 450 452 + Store 448(bv) 453 + 454: 153(fvec3) Load 449(f32v1) + 455: 153(fvec3) Load 451(f32v2) + 456: 158(bvec3) FOrdLessThanEqual 454 455 + Store 448(bv) 456 + 457: 153(fvec3) Load 449(f32v1) + 458: 153(fvec3) Load 451(f32v2) + 459: 158(bvec3) FOrdGreaterThan 457 458 + Store 448(bv) 459 + 460: 153(fvec3) Load 449(f32v1) + 461: 153(fvec3) Load 451(f32v2) + 462: 158(bvec3) FOrdGreaterThanEqual 460 461 + Store 448(bv) 462 + 463: 153(fvec3) Load 449(f32v1) + 464: 153(fvec3) Load 451(f32v2) + 465: 158(bvec3) FOrdEqual 463 464 + Store 448(bv) 465 + 466: 153(fvec3) Load 449(f32v1) + 467: 153(fvec3) Load 451(f32v2) + 468: 158(bvec3) FOrdNotEqual 466 467 + Store 448(bv) 468 + Return + FunctionEnd +24(builtinFragProcFuncs(): 2 Function None 3 + 25: Label + 469(f32v): 154(ptr) Variable Function + 473: 472(ptr) AccessChain 471(if32v) 32 + 474: 26(float) Load 473 + 475: 26(float) DPdx 474 + 476: 33(ptr) AccessChain 469(f32v) 32 + Store 476 475 + 477: 472(ptr) AccessChain 471(if32v) 88 + 478: 26(float) Load 477 + 479: 26(float) DPdy 478 + 480: 33(ptr) AccessChain 469(f32v) 88 + Store 480 479 + 481: 153(fvec3) Load 471(if32v) + 482: 27(fvec2) VectorShuffle 481 481 0 1 + 483: 27(fvec2) DPdxFine 482 + 484: 153(fvec3) Load 469(f32v) + 485: 153(fvec3) VectorShuffle 484 483 3 4 2 + Store 469(f32v) 485 + 486: 153(fvec3) Load 471(if32v) + 487: 27(fvec2) VectorShuffle 486 486 0 1 + 488: 27(fvec2) DPdyFine 487 + 489: 153(fvec3) Load 469(f32v) + 490: 153(fvec3) VectorShuffle 489 488 3 4 2 + Store 469(f32v) 490 + 491: 153(fvec3) Load 471(if32v) + 492: 153(fvec3) DPdxCoarse 491 + Store 469(f32v) 492 + 493: 153(fvec3) Load 471(if32v) + 494: 153(fvec3) DPdxCoarse 493 + Store 469(f32v) 494 + 495: 472(ptr) AccessChain 471(if32v) 32 + 496: 26(float) Load 495 + 497: 26(float) Fwidth 496 + 498: 33(ptr) AccessChain 469(f32v) 32 + Store 498 497 + 499: 153(fvec3) Load 471(if32v) + 500: 27(fvec2) VectorShuffle 499 499 0 1 + 501: 27(fvec2) FwidthFine 500 + 502: 153(fvec3) Load 469(f32v) + 503: 153(fvec3) VectorShuffle 502 501 3 4 2 + Store 469(f32v) 503 + 504: 153(fvec3) Load 471(if32v) + 505: 153(fvec3) FwidthCoarse 504 + Store 469(f32v) 505 + 506: 472(ptr) AccessChain 471(if32v) 32 + 507: 26(float) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 506 + 508: 33(ptr) AccessChain 469(f32v) 32 + Store 508 507 + 510: 153(fvec3) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 471(if32v) 509 + 511: 27(fvec2) VectorShuffle 510 510 0 1 + 512: 153(fvec3) Load 469(f32v) + 513: 153(fvec3) VectorShuffle 512 511 3 4 2 + Store 469(f32v) 513 + 516: 153(fvec3) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 471(if32v) 515 + Store 469(f32v) 516 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float64.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float64.frag.out new file mode 100644 index 00000000000..78dca756489 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.float64.frag.out @@ -0,0 +1,799 @@ +spv.float64.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.1 specification (or requires extension) + OpCapability Float16 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 524 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + Capability DerivativeControl + Capability InterpolationFunction + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 461 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" + Name 4 "main" + Name 6 "literal(" + Name 8 "operators(" + Name 10 "typeCast(" + Name 12 "builtinAngleTrigFuncs(" + Name 14 "builtinExpFuncs(" + Name 16 "builtinCommonFuncs(" + Name 18 "builtinGeometryFuncs(" + Name 20 "builtinMatrixFuncs(" + Name 22 "builtinVecRelFuncs(" + Name 24 "builtinFragProcFuncs(" + Name 29 "f64v" + Name 40 "f64v" + Name 62 "f64m" + Name 85 "f64" + Name 109 "b" + Name 151 "f64v" + Name 154 "bv" + Name 165 "f16v" + Name 173 "i8v" + Name 179 "i16v" + Name 185 "i32v" + Name 191 "i64v" + Name 197 "u8v" + Name 203 "u16v" + Name 208 "u32v" + Name 214 "u64v" + Name 219 "f64v2" + Name 220 "f64v1" + Name 252 "f64v2" + Name 253 "f64v1" + Name 269 "f64v2" + Name 270 "f64v1" + Name 291 "f64" + Name 295 "f64v3" + Name 335 "bv" + Name 356 "b" + Name 366 "iv" + Name 367 "ResType" + Name 374 "f64" + Name 375 "f64v1" + Name 379 "f64v2" + Name 385 "f64v3" + Name 404 "f64m3" + Name 405 "f64m1" + Name 407 "f64m2" + Name 416 "f64v1" + Name 418 "f64v2" + Name 423 "f64m4" + Name 426 "f64" + Name 429 "f64m5" + Name 434 "f64m6" + Name 435 "f64m7" + Name 438 "bv" + Name 439 "f64v1" + Name 441 "f64v2" + Name 459 "f64v" + Name 461 "if64v" + Name 510 "S" + MemberName 510(S) 0 "x" + MemberName 510(S) 1 "y" + MemberName 510(S) 2 "z" + Name 512 "B1" + MemberName 512(B1) 0 "a" + MemberName 512(B1) 1 "b" + MemberName 512(B1) 2 "c" + MemberName 512(B1) 3 "d" + MemberName 512(B1) 4 "e" + MemberName 512(B1) 5 "f" + MemberName 512(B1) 6 "g" + MemberName 512(B1) 7 "h" + Name 514 "" + Name 515 "sf16" + Name 517 "sf" + Name 518 "sd" + Name 519 "f16_to_f" + Name 521 "f16_to_d" + Name 522 "f_to_f16" + Name 523 "d_to_f16" + Decorate 461(if64v) Flat + Decorate 508 ArrayStride 16 + Decorate 509 ArrayStride 64 + MemberDecorate 510(S) 0 Offset 0 + MemberDecorate 510(S) 1 Offset 16 + MemberDecorate 510(S) 2 Offset 32 + Decorate 511 ArrayStride 64 + MemberDecorate 512(B1) 0 Offset 0 + MemberDecorate 512(B1) 1 Offset 16 + MemberDecorate 512(B1) 2 Offset 32 + MemberDecorate 512(B1) 3 Offset 64 + MemberDecorate 512(B1) 4 ColMajor + MemberDecorate 512(B1) 4 Offset 96 + MemberDecorate 512(B1) 4 MatrixStride 32 + MemberDecorate 512(B1) 5 ColMajor + MemberDecorate 512(B1) 5 Offset 160 + MemberDecorate 512(B1) 5 MatrixStride 32 + MemberDecorate 512(B1) 6 Offset 288 + MemberDecorate 512(B1) 7 Offset 352 + Decorate 512(B1) Block + Decorate 514 DescriptorSet 0 + Decorate 515(sf16) SpecId 100 + Decorate 517(sf) SpecId 101 + Decorate 518(sd) SpecId 102 + 2: TypeVoid + 3: TypeFunction 2 + 26: TypeFloat 64 + 27: TypeVector 26(float64_t) 2 + 28: TypePointer Function 27(f64vec2) + 30:26(float64_t) Constant 2696277389 1051772663 + 31: TypeInt 32 0 + 32: 31(int) Constant 0 + 33: TypePointer Function 26(float64_t) + 35:26(float64_t) Constant 0 3218079744 + 36:26(float64_t) Constant 3951369912 1067366481 + 37: 27(f64vec2) ConstantComposite 35 36 + 54:26(float64_t) Constant 0 1072693248 + 60: TypeMatrix 27(f64vec2) 2 + 61: TypePointer Function 60 + 88: 31(int) Constant 1 + 107: TypeBool + 108: TypePointer Function 107(bool) + 149: TypeVector 26(float64_t) 3 + 150: TypePointer Function 149(f64vec3) + 152: TypeVector 107(bool) 3 + 153: TypePointer Function 152(bvec3) + 156:26(float64_t) Constant 0 0 + 157:149(f64vec3) ConstantComposite 156 156 156 + 158:149(f64vec3) ConstantComposite 54 54 54 + 162: TypeFloat 16 + 163: TypeVector 162(float16_t) 3 + 164: TypePointer Function 163(f16vec3) + 170: TypeInt 8 1 + 171: TypeVector 170(int8_t) 3 + 172: TypePointer Function 171(i8vec3) + 176: TypeInt 16 1 + 177: TypeVector 176(int16_t) 3 + 178: TypePointer Function 177(i16vec3) + 182: TypeInt 32 1 + 183: TypeVector 182(int) 3 + 184: TypePointer Function 183(ivec3) + 188: TypeInt 64 1 + 189: TypeVector 188(int64_t) 3 + 190: TypePointer Function 189(i64vec3) + 194: TypeInt 8 0 + 195: TypeVector 194(int8_t) 3 + 196: TypePointer Function 195(i8vec3) + 200: TypeInt 16 0 + 201: TypeVector 200(int16_t) 3 + 202: TypePointer Function 201(i16vec3) + 206: TypeVector 31(int) 3 + 207: TypePointer Function 206(ivec3) + 211: TypeInt 64 0 + 212: TypeVector 211(int64_t) 3 + 213: TypePointer Function 212(i64vec3) + 217: TypeVector 26(float64_t) 4 + 218: TypePointer Function 217(f64vec4) + 367(ResType): TypeStruct 149(f64vec3) 183(ivec3) + 402: TypeMatrix 149(f64vec3) 2 + 403: TypePointer Function 402 + 421: TypeMatrix 27(f64vec2) 3 + 422: TypePointer Function 421 + 427: TypeMatrix 149(f64vec3) 3 + 428: TypePointer Function 427 + 432: TypeMatrix 217(f64vec4) 4 + 433: TypePointer Function 432 + 460: TypePointer Input 149(f64vec3) + 461(if64v): 460(ptr) Variable Input + 462: TypePointer Input 26(float64_t) + 499: 182(int) Constant 1 + 504:26(float64_t) Constant 0 1071644672 + 505: 27(f64vec2) ConstantComposite 504 504 + 507: 31(int) Constant 2 + 508: TypeArray 26(float64_t) 507 + 509: TypeArray 402 507 + 510(S): TypeStruct 26(float64_t) 27(f64vec2) 149(f64vec3) + 511: TypeArray 510(S) 507 + 512(B1): TypeStruct 26(float64_t) 27(f64vec2) 149(f64vec3) 508 402 509 510(S) 511 + 513: TypePointer Uniform 512(B1) + 514: 513(ptr) Variable Uniform + 515(sf16):162(float16_t) SpecConstant 12288 + 516: TypeFloat 32 + 517(sf): 516(float) SpecConstant 1048576000 + 518(sd):26(float64_t) SpecConstant 0 1071644672 + 519(f16_to_f): 516(float) SpecConstantOp 115 515(sf16) + 520: 516(float) SpecConstantOp 115 515(sf16) + 521(f16_to_d):26(float64_t) SpecConstantOp 115 520 + 522(f_to_f16):162(float16_t) SpecConstantOp 115 517(sf) + 523(d_to_f16):162(float16_t) SpecConstantOp 115 518(sd) + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 29(f64v): 28(ptr) Variable Function + 34: 33(ptr) AccessChain 29(f64v) 32 + Store 34 30 + 38: 27(f64vec2) Load 29(f64v) + 39: 27(f64vec2) FAdd 38 37 + Store 29(f64v) 39 + Return + FunctionEnd + 8(operators(): 2 Function None 3 + 9: Label + 40(f64v): 28(ptr) Variable Function + 62(f64m): 61(ptr) Variable Function + 85(f64): 33(ptr) Variable Function + 109(b): 108(ptr) Variable Function + 41: 27(f64vec2) Load 40(f64v) + 42: 27(f64vec2) Load 40(f64v) + 43: 27(f64vec2) FAdd 42 41 + Store 40(f64v) 43 + 44: 27(f64vec2) Load 40(f64v) + 45: 27(f64vec2) Load 40(f64v) + 46: 27(f64vec2) FSub 45 44 + Store 40(f64v) 46 + 47: 27(f64vec2) Load 40(f64v) + 48: 27(f64vec2) Load 40(f64v) + 49: 27(f64vec2) FMul 48 47 + Store 40(f64v) 49 + 50: 27(f64vec2) Load 40(f64v) + 51: 27(f64vec2) Load 40(f64v) + 52: 27(f64vec2) FDiv 51 50 + Store 40(f64v) 52 + 53: 27(f64vec2) Load 40(f64v) + 55: 27(f64vec2) CompositeConstruct 54 54 + 56: 27(f64vec2) FAdd 53 55 + Store 40(f64v) 56 + 57: 27(f64vec2) Load 40(f64v) + 58: 27(f64vec2) CompositeConstruct 54 54 + 59: 27(f64vec2) FSub 57 58 + Store 40(f64v) 59 + 63: 60 Load 62(f64m) + 64: 27(f64vec2) CompositeConstruct 54 54 + 65: 27(f64vec2) CompositeExtract 63 0 + 66: 27(f64vec2) FAdd 65 64 + 67: 27(f64vec2) CompositeExtract 63 1 + 68: 27(f64vec2) FAdd 67 64 + 69: 60 CompositeConstruct 66 68 + Store 62(f64m) 69 + 70: 60 Load 62(f64m) + 71: 27(f64vec2) CompositeConstruct 54 54 + 72: 27(f64vec2) CompositeExtract 70 0 + 73: 27(f64vec2) FSub 72 71 + 74: 27(f64vec2) CompositeExtract 70 1 + 75: 27(f64vec2) FSub 74 71 + 76: 60 CompositeConstruct 73 75 + Store 62(f64m) 76 + 77: 27(f64vec2) Load 40(f64v) + 78: 27(f64vec2) FNegate 77 + Store 40(f64v) 78 + 79: 60 Load 62(f64m) + 80: 27(f64vec2) CompositeExtract 79 0 + 81: 27(f64vec2) FNegate 80 + 82: 27(f64vec2) CompositeExtract 79 1 + 83: 27(f64vec2) FNegate 82 + 84: 60 CompositeConstruct 81 83 + Store 62(f64m) 84 + 86: 33(ptr) AccessChain 40(f64v) 32 + 87:26(float64_t) Load 86 + 89: 33(ptr) AccessChain 40(f64v) 88 + 90:26(float64_t) Load 89 + 91:26(float64_t) FAdd 87 90 + Store 85(f64) 91 + 92: 33(ptr) AccessChain 40(f64v) 32 + 93:26(float64_t) Load 92 + 94: 33(ptr) AccessChain 40(f64v) 88 + 95:26(float64_t) Load 94 + 96:26(float64_t) FSub 93 95 + Store 85(f64) 96 + 97: 33(ptr) AccessChain 40(f64v) 32 + 98:26(float64_t) Load 97 + 99: 33(ptr) AccessChain 40(f64v) 88 + 100:26(float64_t) Load 99 + 101:26(float64_t) FMul 98 100 + Store 85(f64) 101 + 102: 33(ptr) AccessChain 40(f64v) 32 + 103:26(float64_t) Load 102 + 104: 33(ptr) AccessChain 40(f64v) 88 + 105:26(float64_t) Load 104 + 106:26(float64_t) FDiv 103 105 + Store 85(f64) 106 + 110: 33(ptr) AccessChain 40(f64v) 32 + 111:26(float64_t) Load 110 + 112:26(float64_t) Load 85(f64) + 113: 107(bool) FOrdNotEqual 111 112 + Store 109(b) 113 + 114: 33(ptr) AccessChain 40(f64v) 88 + 115:26(float64_t) Load 114 + 116:26(float64_t) Load 85(f64) + 117: 107(bool) FOrdEqual 115 116 + Store 109(b) 117 + 118: 33(ptr) AccessChain 40(f64v) 32 + 119:26(float64_t) Load 118 + 120:26(float64_t) Load 85(f64) + 121: 107(bool) FOrdGreaterThan 119 120 + Store 109(b) 121 + 122: 33(ptr) AccessChain 40(f64v) 88 + 123:26(float64_t) Load 122 + 124:26(float64_t) Load 85(f64) + 125: 107(bool) FOrdLessThan 123 124 + Store 109(b) 125 + 126: 33(ptr) AccessChain 40(f64v) 32 + 127:26(float64_t) Load 126 + 128:26(float64_t) Load 85(f64) + 129: 107(bool) FOrdGreaterThanEqual 127 128 + Store 109(b) 129 + 130: 33(ptr) AccessChain 40(f64v) 88 + 131:26(float64_t) Load 130 + 132:26(float64_t) Load 85(f64) + 133: 107(bool) FOrdLessThanEqual 131 132 + Store 109(b) 133 + 134: 27(f64vec2) Load 40(f64v) + 135:26(float64_t) Load 85(f64) + 136: 27(f64vec2) VectorTimesScalar 134 135 + Store 40(f64v) 136 + 137: 60 Load 62(f64m) + 138:26(float64_t) Load 85(f64) + 139: 60 MatrixTimesScalar 137 138 + Store 62(f64m) 139 + 140: 60 Load 62(f64m) + 141: 27(f64vec2) Load 40(f64v) + 142: 27(f64vec2) MatrixTimesVector 140 141 + Store 40(f64v) 142 + 143: 27(f64vec2) Load 40(f64v) + 144: 60 Load 62(f64m) + 145: 27(f64vec2) VectorTimesMatrix 143 144 + Store 40(f64v) 145 + 146: 60 Load 62(f64m) + 147: 60 Load 62(f64m) + 148: 60 MatrixTimesMatrix 146 147 + Store 62(f64m) 148 + Return + FunctionEnd + 10(typeCast(): 2 Function None 3 + 11: Label + 151(f64v): 150(ptr) Variable Function + 154(bv): 153(ptr) Variable Function + 165(f16v): 164(ptr) Variable Function + 173(i8v): 172(ptr) Variable Function + 179(i16v): 178(ptr) Variable Function + 185(i32v): 184(ptr) Variable Function + 191(i64v): 190(ptr) Variable Function + 197(u8v): 196(ptr) Variable Function + 203(u16v): 202(ptr) Variable Function + 208(u32v): 207(ptr) Variable Function + 214(u64v): 213(ptr) Variable Function + 155: 152(bvec3) Load 154(bv) + 159:149(f64vec3) Select 155 158 157 + Store 151(f64v) 159 + 160:149(f64vec3) Load 151(f64v) + 161: 152(bvec3) FOrdNotEqual 160 157 + Store 154(bv) 161 + 166:163(f16vec3) Load 165(f16v) + 167:149(f64vec3) FConvert 166 + Store 151(f64v) 167 + 168:149(f64vec3) Load 151(f64v) + 169:163(f16vec3) FConvert 168 + Store 165(f16v) 169 + 174:149(f64vec3) Load 151(f64v) + 175: 171(i8vec3) ConvertFToS 174 + Store 173(i8v) 175 + 180:149(f64vec3) Load 151(f64v) + 181:177(i16vec3) ConvertFToS 180 + Store 179(i16v) 181 + 186:149(f64vec3) Load 151(f64v) + 187: 183(ivec3) ConvertFToS 186 + Store 185(i32v) 187 + 192:149(f64vec3) Load 151(f64v) + 193:189(i64vec3) ConvertFToS 192 + Store 191(i64v) 193 + 198:149(f64vec3) Load 151(f64v) + 199: 195(i8vec3) ConvertFToU 198 + Store 197(u8v) 199 + 204:149(f64vec3) Load 151(f64v) + 205:201(i16vec3) ConvertFToU 204 + Store 203(u16v) 205 + 209:149(f64vec3) Load 151(f64v) + 210: 206(ivec3) ConvertFToU 209 + Store 208(u32v) 210 + 215:149(f64vec3) Load 151(f64v) + 216:212(i64vec3) ConvertFToU 215 + Store 214(u64v) 216 + Return + FunctionEnd +12(builtinAngleTrigFuncs(): 2 Function None 3 + 13: Label + 219(f64v2): 218(ptr) Variable Function + 220(f64v1): 218(ptr) Variable Function + 221:217(f64vec4) Load 220(f64v1) + 222:217(f64vec4) ExtInst 1(GLSL.std.450) 11(Radians) 221 + Store 219(f64v2) 222 + 223:217(f64vec4) Load 220(f64v1) + 224:217(f64vec4) ExtInst 1(GLSL.std.450) 12(Degrees) 223 + Store 219(f64v2) 224 + 225:217(f64vec4) Load 220(f64v1) + 226:217(f64vec4) ExtInst 1(GLSL.std.450) 13(Sin) 225 + Store 219(f64v2) 226 + 227:217(f64vec4) Load 220(f64v1) + 228:217(f64vec4) ExtInst 1(GLSL.std.450) 14(Cos) 227 + Store 219(f64v2) 228 + 229:217(f64vec4) Load 220(f64v1) + 230:217(f64vec4) ExtInst 1(GLSL.std.450) 15(Tan) 229 + Store 219(f64v2) 230 + 231:217(f64vec4) Load 220(f64v1) + 232:217(f64vec4) ExtInst 1(GLSL.std.450) 16(Asin) 231 + Store 219(f64v2) 232 + 233:217(f64vec4) Load 220(f64v1) + 234:217(f64vec4) ExtInst 1(GLSL.std.450) 17(Acos) 233 + Store 219(f64v2) 234 + 235:217(f64vec4) Load 220(f64v1) + 236:217(f64vec4) Load 219(f64v2) + 237:217(f64vec4) ExtInst 1(GLSL.std.450) 25(Atan2) 235 236 + Store 219(f64v2) 237 + 238:217(f64vec4) Load 220(f64v1) + 239:217(f64vec4) ExtInst 1(GLSL.std.450) 18(Atan) 238 + Store 219(f64v2) 239 + 240:217(f64vec4) Load 220(f64v1) + 241:217(f64vec4) ExtInst 1(GLSL.std.450) 19(Sinh) 240 + Store 219(f64v2) 241 + 242:217(f64vec4) Load 220(f64v1) + 243:217(f64vec4) ExtInst 1(GLSL.std.450) 20(Cosh) 242 + Store 219(f64v2) 243 + 244:217(f64vec4) Load 220(f64v1) + 245:217(f64vec4) ExtInst 1(GLSL.std.450) 21(Tanh) 244 + Store 219(f64v2) 245 + 246:217(f64vec4) Load 220(f64v1) + 247:217(f64vec4) ExtInst 1(GLSL.std.450) 22(Asinh) 246 + Store 219(f64v2) 247 + 248:217(f64vec4) Load 220(f64v1) + 249:217(f64vec4) ExtInst 1(GLSL.std.450) 23(Acosh) 248 + Store 219(f64v2) 249 + 250:217(f64vec4) Load 220(f64v1) + 251:217(f64vec4) ExtInst 1(GLSL.std.450) 24(Atanh) 250 + Store 219(f64v2) 251 + Return + FunctionEnd +14(builtinExpFuncs(): 2 Function None 3 + 15: Label + 252(f64v2): 28(ptr) Variable Function + 253(f64v1): 28(ptr) Variable Function + 254: 27(f64vec2) Load 253(f64v1) + 255: 27(f64vec2) Load 252(f64v2) + 256: 27(f64vec2) ExtInst 1(GLSL.std.450) 26(Pow) 254 255 + Store 252(f64v2) 256 + 257: 27(f64vec2) Load 253(f64v1) + 258: 27(f64vec2) ExtInst 1(GLSL.std.450) 27(Exp) 257 + Store 252(f64v2) 258 + 259: 27(f64vec2) Load 253(f64v1) + 260: 27(f64vec2) ExtInst 1(GLSL.std.450) 28(Log) 259 + Store 252(f64v2) 260 + 261: 27(f64vec2) Load 253(f64v1) + 262: 27(f64vec2) ExtInst 1(GLSL.std.450) 29(Exp2) 261 + Store 252(f64v2) 262 + 263: 27(f64vec2) Load 253(f64v1) + 264: 27(f64vec2) ExtInst 1(GLSL.std.450) 30(Log2) 263 + Store 252(f64v2) 264 + 265: 27(f64vec2) Load 253(f64v1) + 266: 27(f64vec2) ExtInst 1(GLSL.std.450) 31(Sqrt) 265 + Store 252(f64v2) 266 + 267: 27(f64vec2) Load 253(f64v1) + 268: 27(f64vec2) ExtInst 1(GLSL.std.450) 32(InverseSqrt) 267 + Store 252(f64v2) 268 + Return + FunctionEnd +16(builtinCommonFuncs(): 2 Function None 3 + 17: Label + 269(f64v2): 150(ptr) Variable Function + 270(f64v1): 150(ptr) Variable Function + 291(f64): 33(ptr) Variable Function + 295(f64v3): 150(ptr) Variable Function + 335(bv): 153(ptr) Variable Function + 356(b): 108(ptr) Variable Function + 366(iv): 184(ptr) Variable Function + 271:149(f64vec3) Load 270(f64v1) + 272:149(f64vec3) ExtInst 1(GLSL.std.450) 4(FAbs) 271 + Store 269(f64v2) 272 + 273:149(f64vec3) Load 270(f64v1) + 274:149(f64vec3) ExtInst 1(GLSL.std.450) 6(FSign) 273 + Store 269(f64v2) 274 + 275:149(f64vec3) Load 270(f64v1) + 276:149(f64vec3) ExtInst 1(GLSL.std.450) 8(Floor) 275 + Store 269(f64v2) 276 + 277:149(f64vec3) Load 270(f64v1) + 278:149(f64vec3) ExtInst 1(GLSL.std.450) 3(Trunc) 277 + Store 269(f64v2) 278 + 279:149(f64vec3) Load 270(f64v1) + 280:149(f64vec3) ExtInst 1(GLSL.std.450) 1(Round) 279 + Store 269(f64v2) 280 + 281:149(f64vec3) Load 270(f64v1) + 282:149(f64vec3) ExtInst 1(GLSL.std.450) 2(RoundEven) 281 + Store 269(f64v2) 282 + 283:149(f64vec3) Load 270(f64v1) + 284:149(f64vec3) ExtInst 1(GLSL.std.450) 9(Ceil) 283 + Store 269(f64v2) 284 + 285:149(f64vec3) Load 270(f64v1) + 286:149(f64vec3) ExtInst 1(GLSL.std.450) 10(Fract) 285 + Store 269(f64v2) 286 + 287:149(f64vec3) Load 270(f64v1) + 288:149(f64vec3) Load 269(f64v2) + 289:149(f64vec3) FMod 287 288 + Store 269(f64v2) 289 + 290:149(f64vec3) Load 270(f64v1) + 292:26(float64_t) Load 291(f64) + 293:149(f64vec3) CompositeConstruct 292 292 292 + 294:149(f64vec3) FMod 290 293 + Store 269(f64v2) 294 + 296:149(f64vec3) Load 270(f64v1) + 297:149(f64vec3) ExtInst 1(GLSL.std.450) 35(Modf) 296 269(f64v2) + Store 295(f64v3) 297 + 298:149(f64vec3) Load 270(f64v1) + 299:149(f64vec3) Load 269(f64v2) + 300:149(f64vec3) ExtInst 1(GLSL.std.450) 37(FMin) 298 299 + Store 295(f64v3) 300 + 301:149(f64vec3) Load 270(f64v1) + 302:26(float64_t) Load 291(f64) + 303:149(f64vec3) CompositeConstruct 302 302 302 + 304:149(f64vec3) ExtInst 1(GLSL.std.450) 37(FMin) 301 303 + Store 295(f64v3) 304 + 305:149(f64vec3) Load 270(f64v1) + 306:149(f64vec3) Load 269(f64v2) + 307:149(f64vec3) ExtInst 1(GLSL.std.450) 40(FMax) 305 306 + Store 295(f64v3) 307 + 308:149(f64vec3) Load 270(f64v1) + 309:26(float64_t) Load 291(f64) + 310:149(f64vec3) CompositeConstruct 309 309 309 + 311:149(f64vec3) ExtInst 1(GLSL.std.450) 40(FMax) 308 310 + Store 295(f64v3) 311 + 312:149(f64vec3) Load 270(f64v1) + 313:26(float64_t) Load 291(f64) + 314: 33(ptr) AccessChain 269(f64v2) 32 + 315:26(float64_t) Load 314 + 316:149(f64vec3) CompositeConstruct 313 313 313 + 317:149(f64vec3) CompositeConstruct 315 315 315 + 318:149(f64vec3) ExtInst 1(GLSL.std.450) 43(FClamp) 312 316 317 + Store 295(f64v3) 318 + 319:149(f64vec3) Load 270(f64v1) + 320:149(f64vec3) Load 269(f64v2) + 321:26(float64_t) Load 291(f64) + 322:149(f64vec3) CompositeConstruct 321 321 321 + 323:149(f64vec3) ExtInst 1(GLSL.std.450) 43(FClamp) 319 320 322 + Store 295(f64v3) 323 + 324:149(f64vec3) Load 270(f64v1) + 325:149(f64vec3) Load 269(f64v2) + 326:26(float64_t) Load 291(f64) + 327:149(f64vec3) CompositeConstruct 326 326 326 + 328:149(f64vec3) ExtInst 1(GLSL.std.450) 46(FMix) 324 325 327 + Store 295(f64v3) 328 + 329:149(f64vec3) Load 270(f64v1) + 330:149(f64vec3) Load 269(f64v2) + 331:149(f64vec3) Load 295(f64v3) + 332:149(f64vec3) ExtInst 1(GLSL.std.450) 46(FMix) 329 330 331 + Store 295(f64v3) 332 + 333:149(f64vec3) Load 270(f64v1) + 334:149(f64vec3) Load 269(f64v2) + 336: 152(bvec3) Load 335(bv) + 337:149(f64vec3) Select 336 334 333 + Store 295(f64v3) 337 + 338:149(f64vec3) Load 270(f64v1) + 339:149(f64vec3) Load 269(f64v2) + 340:149(f64vec3) ExtInst 1(GLSL.std.450) 48(Step) 338 339 + Store 295(f64v3) 340 + 341:26(float64_t) Load 291(f64) + 342:149(f64vec3) Load 295(f64v3) + 343:149(f64vec3) CompositeConstruct 341 341 341 + 344:149(f64vec3) ExtInst 1(GLSL.std.450) 48(Step) 343 342 + Store 295(f64v3) 344 + 345:149(f64vec3) Load 270(f64v1) + 346:149(f64vec3) Load 269(f64v2) + 347:149(f64vec3) Load 295(f64v3) + 348:149(f64vec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 345 346 347 + Store 295(f64v3) 348 + 349:26(float64_t) Load 291(f64) + 350: 33(ptr) AccessChain 270(f64v1) 32 + 351:26(float64_t) Load 350 + 352:149(f64vec3) Load 269(f64v2) + 353:149(f64vec3) CompositeConstruct 349 349 349 + 354:149(f64vec3) CompositeConstruct 351 351 351 + 355:149(f64vec3) ExtInst 1(GLSL.std.450) 49(SmoothStep) 353 354 352 + Store 295(f64v3) 355 + 357:26(float64_t) Load 291(f64) + 358: 107(bool) IsNan 357 + Store 356(b) 358 + 359:149(f64vec3) Load 270(f64v1) + 360: 152(bvec3) IsInf 359 + Store 335(bv) 360 + 361:149(f64vec3) Load 270(f64v1) + 362:149(f64vec3) Load 269(f64v2) + 363:149(f64vec3) Load 295(f64v3) + 364:149(f64vec3) ExtInst 1(GLSL.std.450) 50(Fma) 361 362 363 + Store 295(f64v3) 364 + 365:149(f64vec3) Load 270(f64v1) + 368:367(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 365 + 369: 183(ivec3) CompositeExtract 368 1 + Store 366(iv) 369 + 370:149(f64vec3) CompositeExtract 368 0 + Store 269(f64v2) 370 + 371:149(f64vec3) Load 270(f64v1) + 372: 183(ivec3) Load 366(iv) + 373:149(f64vec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 371 372 + Store 269(f64v2) 373 + Return + FunctionEnd +18(builtinGeometryFuncs(): 2 Function None 3 + 19: Label + 374(f64): 33(ptr) Variable Function + 375(f64v1): 150(ptr) Variable Function + 379(f64v2): 150(ptr) Variable Function + 385(f64v3): 150(ptr) Variable Function + 376:149(f64vec3) Load 375(f64v1) + 377:26(float64_t) ExtInst 1(GLSL.std.450) 66(Length) 376 + Store 374(f64) 377 + 378:149(f64vec3) Load 375(f64v1) + 380:149(f64vec3) Load 379(f64v2) + 381:26(float64_t) ExtInst 1(GLSL.std.450) 67(Distance) 378 380 + Store 374(f64) 381 + 382:149(f64vec3) Load 375(f64v1) + 383:149(f64vec3) Load 379(f64v2) + 384:26(float64_t) Dot 382 383 + Store 374(f64) 384 + 386:149(f64vec3) Load 375(f64v1) + 387:149(f64vec3) Load 379(f64v2) + 388:149(f64vec3) ExtInst 1(GLSL.std.450) 68(Cross) 386 387 + Store 385(f64v3) 388 + 389:149(f64vec3) Load 375(f64v1) + 390:149(f64vec3) ExtInst 1(GLSL.std.450) 69(Normalize) 389 + Store 379(f64v2) 390 + 391:149(f64vec3) Load 375(f64v1) + 392:149(f64vec3) Load 379(f64v2) + 393:149(f64vec3) Load 385(f64v3) + 394:149(f64vec3) ExtInst 1(GLSL.std.450) 70(FaceForward) 391 392 393 + Store 385(f64v3) 394 + 395:149(f64vec3) Load 375(f64v1) + 396:149(f64vec3) Load 379(f64v2) + 397:149(f64vec3) ExtInst 1(GLSL.std.450) 71(Reflect) 395 396 + Store 385(f64v3) 397 + 398:149(f64vec3) Load 375(f64v1) + 399:149(f64vec3) Load 379(f64v2) + 400:26(float64_t) Load 374(f64) + 401:149(f64vec3) ExtInst 1(GLSL.std.450) 72(Refract) 398 399 400 + Store 385(f64v3) 401 + Return + FunctionEnd +20(builtinMatrixFuncs(): 2 Function None 3 + 21: Label + 404(f64m3): 403(ptr) Variable Function + 405(f64m1): 403(ptr) Variable Function + 407(f64m2): 403(ptr) Variable Function + 416(f64v1): 150(ptr) Variable Function + 418(f64v2): 28(ptr) Variable Function + 423(f64m4): 422(ptr) Variable Function + 426(f64): 33(ptr) Variable Function + 429(f64m5): 428(ptr) Variable Function + 434(f64m6): 433(ptr) Variable Function + 435(f64m7): 433(ptr) Variable Function + 406: 402 Load 405(f64m1) + 408: 402 Load 407(f64m2) + 409:149(f64vec3) CompositeExtract 406 0 + 410:149(f64vec3) CompositeExtract 408 0 + 411:149(f64vec3) FMul 409 410 + 412:149(f64vec3) CompositeExtract 406 1 + 413:149(f64vec3) CompositeExtract 408 1 + 414:149(f64vec3) FMul 412 413 + 415: 402 CompositeConstruct 411 414 + Store 404(f64m3) 415 + 417:149(f64vec3) Load 416(f64v1) + 419: 27(f64vec2) Load 418(f64v2) + 420: 402 OuterProduct 417 419 + Store 405(f64m1) 420 + 424: 402 Load 405(f64m1) + 425: 421 Transpose 424 + Store 423(f64m4) 425 + 430: 427 Load 429(f64m5) + 431:26(float64_t) ExtInst 1(GLSL.std.450) 33(Determinant) 430 + Store 426(f64) 431 + 436: 432 Load 435(f64m7) + 437: 432 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 436 + Store 434(f64m6) 437 + Return + FunctionEnd +22(builtinVecRelFuncs(): 2 Function None 3 + 23: Label + 438(bv): 153(ptr) Variable Function + 439(f64v1): 150(ptr) Variable Function + 441(f64v2): 150(ptr) Variable Function + 440:149(f64vec3) Load 439(f64v1) + 442:149(f64vec3) Load 441(f64v2) + 443: 152(bvec3) FOrdLessThan 440 442 + Store 438(bv) 443 + 444:149(f64vec3) Load 439(f64v1) + 445:149(f64vec3) Load 441(f64v2) + 446: 152(bvec3) FOrdLessThanEqual 444 445 + Store 438(bv) 446 + 447:149(f64vec3) Load 439(f64v1) + 448:149(f64vec3) Load 441(f64v2) + 449: 152(bvec3) FOrdGreaterThan 447 448 + Store 438(bv) 449 + 450:149(f64vec3) Load 439(f64v1) + 451:149(f64vec3) Load 441(f64v2) + 452: 152(bvec3) FOrdGreaterThanEqual 450 451 + Store 438(bv) 452 + 453:149(f64vec3) Load 439(f64v1) + 454:149(f64vec3) Load 441(f64v2) + 455: 152(bvec3) FOrdEqual 453 454 + Store 438(bv) 455 + 456:149(f64vec3) Load 439(f64v1) + 457:149(f64vec3) Load 441(f64v2) + 458: 152(bvec3) FOrdNotEqual 456 457 + Store 438(bv) 458 + Return + FunctionEnd +24(builtinFragProcFuncs(): 2 Function None 3 + 25: Label + 459(f64v): 150(ptr) Variable Function + 463: 462(ptr) AccessChain 461(if64v) 32 + 464:26(float64_t) Load 463 + 465:26(float64_t) DPdx 464 + 466: 33(ptr) AccessChain 459(f64v) 32 + Store 466 465 + 467: 462(ptr) AccessChain 461(if64v) 88 + 468:26(float64_t) Load 467 + 469:26(float64_t) DPdy 468 + 470: 33(ptr) AccessChain 459(f64v) 88 + Store 470 469 + 471:149(f64vec3) Load 461(if64v) + 472: 27(f64vec2) VectorShuffle 471 471 0 1 + 473: 27(f64vec2) DPdxFine 472 + 474:149(f64vec3) Load 459(f64v) + 475:149(f64vec3) VectorShuffle 474 473 3 4 2 + Store 459(f64v) 475 + 476:149(f64vec3) Load 461(if64v) + 477: 27(f64vec2) VectorShuffle 476 476 0 1 + 478: 27(f64vec2) DPdyFine 477 + 479:149(f64vec3) Load 459(f64v) + 480:149(f64vec3) VectorShuffle 479 478 3 4 2 + Store 459(f64v) 480 + 481:149(f64vec3) Load 461(if64v) + 482:149(f64vec3) DPdxCoarse 481 + Store 459(f64v) 482 + 483:149(f64vec3) Load 461(if64v) + 484:149(f64vec3) DPdxCoarse 483 + Store 459(f64v) 484 + 485: 462(ptr) AccessChain 461(if64v) 32 + 486:26(float64_t) Load 485 + 487:26(float64_t) Fwidth 486 + 488: 33(ptr) AccessChain 459(f64v) 32 + Store 488 487 + 489:149(f64vec3) Load 461(if64v) + 490: 27(f64vec2) VectorShuffle 489 489 0 1 + 491: 27(f64vec2) FwidthFine 490 + 492:149(f64vec3) Load 459(f64v) + 493:149(f64vec3) VectorShuffle 492 491 3 4 2 + Store 459(f64v) 493 + 494:149(f64vec3) Load 461(if64v) + 495:149(f64vec3) FwidthCoarse 494 + Store 459(f64v) 495 + 496: 462(ptr) AccessChain 461(if64v) 32 + 497:26(float64_t) ExtInst 1(GLSL.std.450) 76(InterpolateAtCentroid) 496 + 498: 33(ptr) AccessChain 459(f64v) 32 + Store 498 497 + 500:149(f64vec3) ExtInst 1(GLSL.std.450) 77(InterpolateAtSample) 461(if64v) 499 + 501: 27(f64vec2) VectorShuffle 500 500 0 1 + 502:149(f64vec3) Load 459(f64v) + 503:149(f64vec3) VectorShuffle 502 501 3 4 2 + Store 459(f64v) 503 + 506:149(f64vec3) ExtInst 1(GLSL.std.450) 78(InterpolateAtOffset) 461(if64v) 505 + Store 459(f64v) 506 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.flowControl.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.flowControl.frag.out index ca04e07cbb2..30c2a4b6ecd 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.flowControl.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.flowControl.frag.out @@ -1,6 +1,6 @@ spv.flowControl.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-complex-condition.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-complex-condition.vert.out index 0bea463f0f9..41275a45cec 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-complex-condition.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-complex-condition.vert.out @@ -1,6 +1,6 @@ spv.for-complex-condition.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-continue-break.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-continue-break.vert.out index 98c8fd07419..ff94a931367 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-continue-break.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-continue-break.vert.out @@ -1,6 +1,6 @@ spv.for-continue-break.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 45 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-nobody.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-nobody.vert.out index 919c71aa82e..2a3bcf40ee9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-nobody.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-nobody.vert.out @@ -1,6 +1,6 @@ spv.for-nobody.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 25 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-notest.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-notest.vert.out index b2e574c2ba0..36c4a96a3ad 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-notest.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-notest.vert.out @@ -1,6 +1,6 @@ spv.for-notest.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-simple.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-simple.vert.out index 945668c5b6c..ecb539f902a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-simple.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.for-simple.vert.out @@ -1,6 +1,6 @@ spv.for-simple.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forLoop.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forLoop.frag.out index 6095a45047d..a07921ce775 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forLoop.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forLoop.frag.out @@ -1,6 +1,6 @@ spv.forLoop.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 131 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forwardFun.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forwardFun.frag.out index 06d76bff133..32875b2ce34 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forwardFun.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.forwardFun.frag.out @@ -1,6 +1,6 @@ spv.forwardFun.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 60 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity-es.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity-es.frag.out new file mode 100644 index 00000000000..01ac38336af --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity-es.frag.out @@ -0,0 +1,45 @@ +spv.fragmentDensity-es.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 18 + + Capability Shader + Capability FragmentDensityEXT + Extension "SPV_EXT_fragment_invocation_density" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 11 14 16 + ExecutionMode 4 OriginUpperLeft + Source ESSL 310 + SourceExtension "GL_EXT_fragment_invocation_density" + Name 4 "main" + Name 9 "FragSize" + Name 11 "gl_FragSizeEXT" + Name 14 "FragInvocationCount" + Name 16 "gl_FragInvocationCountEXT" + Decorate 9(FragSize) Location 0 + Decorate 11(gl_FragSizeEXT) Flat + Decorate 11(gl_FragSizeEXT) BuiltIn FragSizeEXT + Decorate 14(FragInvocationCount) Location 2 + Decorate 16(gl_FragInvocationCountEXT) Flat + Decorate 16(gl_FragInvocationCountEXT) BuiltIn FragInvocationCountEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypeVector 6(int) 2 + 8: TypePointer Output 7(ivec2) + 9(FragSize): 8(ptr) Variable Output + 10: TypePointer Input 7(ivec2) +11(gl_FragSizeEXT): 10(ptr) Variable Input + 13: TypePointer Output 6(int) +14(FragInvocationCount): 13(ptr) Variable Output + 15: TypePointer Input 6(int) +16(gl_FragInvocationCountEXT): 15(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 12: 7(ivec2) Load 11(gl_FragSizeEXT) + Store 9(FragSize) 12 + 17: 6(int) Load 16(gl_FragInvocationCountEXT) + Store 14(FragInvocationCount) 17 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity-neg.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity-neg.frag.out new file mode 100644 index 00000000000..6b5078bdd50 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity-neg.frag.out @@ -0,0 +1,7 @@ +spv.fragmentDensity-neg.frag +ERROR: 0:10: 'gl_FragSizeEXT' : required extension not requested: GL_EXT_fragment_invocation_density +ERROR: 0:11: 'gl_FragInvocationCountEXT' : required extension not requested: GL_EXT_fragment_invocation_density +ERROR: 2 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity.frag.out new file mode 100644 index 00000000000..8bbc37cc5b2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity.frag.out @@ -0,0 +1,48 @@ +spv.fragmentDensity.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 21 + + Capability Shader + Capability FragmentDensityEXT + Extension "SPV_EXT_fragment_invocation_density" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 13 17 19 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_fragment_invocation_density" + Name 4 "main" + Name 9 "FragSize" + Name 13 "gl_FragSizeEXT" + Name 17 "FragInvocationCount" + Name 19 "gl_FragInvocationCountEXT" + Decorate 9(FragSize) Location 0 + Decorate 13(gl_FragSizeEXT) Flat + Decorate 13(gl_FragSizeEXT) BuiltIn FragSizeEXT + Decorate 17(FragInvocationCount) Location 2 + Decorate 19(gl_FragInvocationCountEXT) Flat + Decorate 19(gl_FragInvocationCountEXT) BuiltIn FragInvocationCountEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer Output 7(fvec2) + 9(FragSize): 8(ptr) Variable Output + 10: TypeInt 32 1 + 11: TypeVector 10(int) 2 + 12: TypePointer Input 11(ivec2) +13(gl_FragSizeEXT): 12(ptr) Variable Input + 16: TypePointer Output 10(int) +17(FragInvocationCount): 16(ptr) Variable Output + 18: TypePointer Input 10(int) +19(gl_FragInvocationCountEXT): 18(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 14: 11(ivec2) Load 13(gl_FragSizeEXT) + 15: 7(fvec2) ConvertSToF 14 + Store 9(FragSize) 15 + 20: 10(int) Load 19(gl_FragInvocationCountEXT) + Store 17(FragInvocationCount) 20 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity.vert.out new file mode 100644 index 00000000000..ff77a3ecc05 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentDensity.vert.out @@ -0,0 +1,9 @@ +spv.fragmentDensity.vert +ERROR: 0:10: 'gl_FragSizeEXT' : undeclared identifier +ERROR: 0:10: 'assign' : cannot convert from ' temp float' to 'layout( location=0) smooth out highp 2-component vector of uint' +ERROR: 0:11: 'gl_FragInvocationCountEXT' : undeclared identifier +ERROR: 0:11: 'assign' : cannot convert from ' temp float' to 'layout( location=2) smooth out highp int' +ERROR: 4 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentShaderBarycentric.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentShaderBarycentric.frag.out new file mode 100644 index 00000000000..ffb3527c0bd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentShaderBarycentric.frag.out @@ -0,0 +1,69 @@ +spv.fragmentShaderBarycentric.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 43 + + Capability Shader + Capability FragmentBarycentricNV + Extension "SPV_NV_fragment_shader_barycentric" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 8 11 21 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_NV_fragment_shader_barycentric" + Name 4 "main" + Name 8 "value" + Name 11 "gl_BaryCoordNV" + Name 17 "vertices" + MemberName 17(vertices) 0 "attrib" + Name 21 "v" + Decorate 8(value) Location 1 + Decorate 11(gl_BaryCoordNV) BuiltIn BaryCoordNV + Decorate 17(vertices) Block + Decorate 21(v) Location 0 + Decorate 21(v) PerVertexNV + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Output 6(float) + 8(value): 7(ptr) Variable Output + 9: TypeVector 6(float) 3 + 10: TypePointer Input 9(fvec3) +11(gl_BaryCoordNV): 10(ptr) Variable Input + 12: TypeInt 32 0 + 13: 12(int) Constant 0 + 14: TypePointer Input 6(float) + 17(vertices): TypeStruct 6(float) + 18: 12(int) Constant 3 + 19: TypeArray 17(vertices) 18 + 20: TypePointer Input 19 + 21(v): 20(ptr) Variable Input + 22: TypeInt 32 1 + 23: 22(int) Constant 0 + 27: 12(int) Constant 1 + 30: 22(int) Constant 1 + 35: 12(int) Constant 2 + 38: 22(int) Constant 2 + 4(main): 2 Function None 3 + 5: Label + 15: 14(ptr) AccessChain 11(gl_BaryCoordNV) 13 + 16: 6(float) Load 15 + 24: 14(ptr) AccessChain 21(v) 23 23 + 25: 6(float) Load 24 + 26: 6(float) FMul 16 25 + 28: 14(ptr) AccessChain 11(gl_BaryCoordNV) 27 + 29: 6(float) Load 28 + 31: 14(ptr) AccessChain 21(v) 30 23 + 32: 6(float) Load 31 + 33: 6(float) FMul 29 32 + 34: 6(float) FAdd 26 33 + 36: 14(ptr) AccessChain 11(gl_BaryCoordNV) 35 + 37: 6(float) Load 36 + 39: 14(ptr) AccessChain 21(v) 38 23 + 40: 6(float) Load 39 + 41: 6(float) FMul 37 40 + 42: 6(float) FAdd 34 41 + Store 8(value) 42 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentShaderBarycentric2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentShaderBarycentric2.frag.out new file mode 100644 index 00000000000..05dce7a7dfa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fragmentShaderBarycentric2.frag.out @@ -0,0 +1,65 @@ +spv.fragmentShaderBarycentric2.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 42 + + Capability Shader + Capability FragmentBarycentricNV + Extension "SPV_NV_fragment_shader_barycentric" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 8 11 20 + ExecutionMode 4 OriginUpperLeft + Source ESSL 320 + SourceExtension "GL_NV_fragment_shader_barycentric" + Name 4 "main" + Name 8 "value" + Name 11 "gl_BaryCoordNoPerspNV" + Name 20 "vertexIDs" + Decorate 8(value) Location 1 + Decorate 11(gl_BaryCoordNoPerspNV) BuiltIn BaryCoordNoPerspNV + Decorate 20(vertexIDs) Location 0 + Decorate 20(vertexIDs) PerVertexNV + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Output 6(float) + 8(value): 7(ptr) Variable Output + 9: TypeVector 6(float) 3 + 10: TypePointer Input 9(fvec3) +11(gl_BaryCoordNoPerspNV): 10(ptr) Variable Input + 12: TypeInt 32 0 + 13: 12(int) Constant 0 + 14: TypePointer Input 6(float) + 17: 12(int) Constant 3 + 18: TypeArray 6(float) 17 + 19: TypePointer Input 18 + 20(vertexIDs): 19(ptr) Variable Input + 21: TypeInt 32 1 + 22: 21(int) Constant 0 + 26: 12(int) Constant 1 + 29: 21(int) Constant 1 + 34: 12(int) Constant 2 + 37: 21(int) Constant 2 + 4(main): 2 Function None 3 + 5: Label + 15: 14(ptr) AccessChain 11(gl_BaryCoordNoPerspNV) 13 + 16: 6(float) Load 15 + 23: 14(ptr) AccessChain 20(vertexIDs) 22 + 24: 6(float) Load 23 + 25: 6(float) FMul 16 24 + 27: 14(ptr) AccessChain 11(gl_BaryCoordNoPerspNV) 26 + 28: 6(float) Load 27 + 30: 14(ptr) AccessChain 20(vertexIDs) 29 + 31: 6(float) Load 30 + 32: 6(float) FMul 28 31 + 33: 6(float) FAdd 25 32 + 35: 14(ptr) AccessChain 11(gl_BaryCoordNoPerspNV) 34 + 36: 6(float) Load 35 + 38: 14(ptr) AccessChain 20(vertexIDs) 37 + 39: 6(float) Load 38 + 40: 6(float) FMul 36 39 + 41: 6(float) FAdd 33 40 + Store 8(value) 41 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out new file mode 100644 index 00000000000..76c8e44d330 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out @@ -0,0 +1,37 @@ +spv.fullyCovered.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 18 + + Capability Shader + Capability FragmentFullyCoveredEXT + Extension "SPV_EXT_fragment_fully_covered" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 12 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_NV_conservative_raster_underestimation" + Name 4 "main" + Name 9 "color" + Name 12 "gl_FragFullyCoveredNV" + Decorate 12(gl_FragFullyCoveredNV) BuiltIn FullyCoveredEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(color): 8(ptr) Variable Output + 10: TypeBool + 11: TypePointer Input 10(bool) +12(gl_FragFullyCoveredNV): 11(ptr) Variable Input + 14: 6(float) Constant 0 + 15: 6(float) Constant 1065353216 + 4(main): 2 Function None 3 + 5: Label + 13: 10(bool) Load 12(gl_FragFullyCoveredNV) + 16: 6(float) Select 13 15 14 + 17: 7(fvec4) CompositeConstruct 16 14 14 14 + Store 9(color) 17 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionCall.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionCall.frag.out index c9762d9054e..269b74e64eb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionCall.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionCall.frag.out @@ -4,7 +4,7 @@ WARNING: 0:4: varying deprecated in version 130; may be removed in future releas WARNING: 0:5: varying deprecated in version 130; may be removed in future release // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 76 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out index 71f994e0562..ff94077f535 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionNestedOpaque.vert.out @@ -1,6 +1,12 @@ spv.functionNestedOpaque.vert +error: SPIRV-Tools Validation Errors +error: UniformConstant OpVariable '36[si] 'has illegal type. +From Vulkan spec, section 14.5.2: +Variables identified with the UniformConstant storage class are used only as handles to refer to opaque resources. Such variables must be typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, OpTypeAccelerationStructureNV, or an array of one of these types. + %si = OpVariable %_ptr_UniformConstant_S UniformConstant + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionSemantics.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionSemantics.frag.out index e81cb30c410..49bdf7cdb7d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionSemantics.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.functionSemantics.frag.out @@ -1,6 +1,6 @@ spv.functionSemantics.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 156 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glFragColor.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glFragColor.frag.out index 15f77654c3e..55fb24f125e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glFragColor.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glFragColor.frag.out @@ -1,6 +1,6 @@ spv.glFragColor.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 12 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out index e26fd6ada35..079e8d52331 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.autoassign.frag.out @@ -1,6 +1,6 @@ spv.glsl.register.autoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 142 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out index 5fd0596b8e1..44d63ed1d78 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.glsl.register.noautoassign.frag.out @@ -1,6 +1,6 @@ spv.glsl.register.noautoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 142 Capability Shader @@ -41,19 +41,25 @@ spv.glsl.register.noautoassign.frag Name 137 "FragColor" Name 141 "g_tTex_unused3" Decorate 17(g_tTex1) DescriptorSet 0 - Decorate 17(g_tTex1) Binding 11 + Decorate 17(g_tTex1) Binding 17 Decorate 21(g_sSamp1) DescriptorSet 0 Decorate 21(g_sSamp1) Binding 5 Decorate 27(g_tTex2) DescriptorSet 0 + Decorate 27(g_tTex2) Binding 18 Decorate 29(g_sSamp2) DescriptorSet 0 + Decorate 29(g_sSamp2) Binding 6 Decorate 39(g_tTex3) DescriptorSet 0 - Decorate 39(g_tTex3) Binding 13 + Decorate 39(g_tTex3) Binding 19 Decorate 46(g_sSamp3) DescriptorSet 0 Decorate 46(g_sSamp3) Binding 7 Decorate 64(g_tTex4) DescriptorSet 0 + Decorate 64(g_tTex4) Binding 20 Decorate 69(g_sSamp4) DescriptorSet 0 + Decorate 69(g_sSamp4) Binding 8 Decorate 84(g_tTex5) DescriptorSet 0 + Decorate 84(g_tTex5) Binding 21 Decorate 86(g_sSamp5) DescriptorSet 0 + Decorate 86(g_sSamp5) Binding 9 MemberDecorate 93(MyStruct_t) 0 Offset 0 MemberDecorate 93(MyStruct_t) 1 Offset 4 MemberDecorate 93(MyStruct_t) 2 Offset 16 @@ -65,13 +71,16 @@ spv.glsl.register.noautoassign.frag Decorate 97 DescriptorSet 0 Decorate 97 Binding 19 Decorate 119(g_tTex_unused1) DescriptorSet 0 - Decorate 119(g_tTex_unused1) Binding 10 + Decorate 119(g_tTex_unused1) Binding 22 Decorate 121(g_sSamp_unused1) DescriptorSet 0 + Decorate 121(g_sSamp_unused1) Binding 10 Decorate 126(g_tTex_unused2) DescriptorSet 0 - Decorate 126(g_tTex_unused2) Binding 12 + Decorate 126(g_tTex_unused2) Binding 23 Decorate 128(g_sSamp_unused2) DescriptorSet 0 + Decorate 128(g_sSamp_unused2) Binding 11 Decorate 137(FragColor) Location 0 Decorate 141(g_tTex_unused3) DescriptorSet 0 + Decorate 141(g_tTex_unused3) Binding 24 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out index 9eddfdfad52..9912d4e4b92 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslDebugInfo.frag.out @@ -1,6 +1,6 @@ spv.hlslDebugInfo.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 19 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslOffsets.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslOffsets.vert.out index f96a629e927..af59fdbf451 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslOffsets.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.hlslOffsets.vert.out @@ -18,7 +18,7 @@ Shader version: 450 0:? 'anon@0' (layout( column_major std430) buffer block{layout( column_major std430) buffer highp float m0, layout( column_major std430) buffer highp 3-component vector of float m4, layout( column_major std430) buffer highp float m16, layout( column_major std430 offset=20) buffer highp 3-component vector of float m20, layout( column_major std430) buffer highp 3-component vector of float m32, layout( column_major std430) buffer highp 2-component vector of float m48, layout( column_major std430) buffer highp 2-component vector of float m56, layout( column_major std430) buffer highp float m64, layout( column_major std430) buffer highp 2-component vector of float m68, layout( column_major std430) buffer highp float m76, layout( column_major std430) buffer highp float m80, layout( column_major std430 offset=88) buffer highp 2-component vector of float m88, layout( column_major std430) buffer highp 2-component vector of float m96, layout( column_major std430) buffer 2-component vector of double m112}) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 14 Capability Shader @@ -66,8 +66,8 @@ Shader version: 450 7: TypeVector 6(float) 3 8: TypeVector 6(float) 2 9: TypeFloat 64 - 10: TypeVector 9(float) 2 - 11(block): TypeStruct 6(float) 7(fvec3) 6(float) 7(fvec3) 7(fvec3) 8(fvec2) 8(fvec2) 6(float) 8(fvec2) 6(float) 6(float) 8(fvec2) 8(fvec2) 10(fvec2) + 10: TypeVector 9(float64_t) 2 + 11(block): TypeStruct 6(float) 7(fvec3) 6(float) 7(fvec3) 7(fvec3) 8(fvec2) 8(fvec2) 6(float) 8(fvec2) 6(float) 6(float) 8(fvec2) 8(fvec2) 10(f64vec2) 12: TypePointer Uniform 11(block) 13: 12(ptr) Variable Uniform 4(main): 2 Function None 3 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.image.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.image.frag.out index 6e35b36761b..a5441801152 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.image.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.image.frag.out @@ -1,7 +1,11 @@ spv.image.frag +error: SPIRV-Tools Validation Errors +error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability ImageRect + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 376 +// Generated by (magic number): 80007 +// Id's are bound by 395 Capability Shader Capability StorageImageMultisample @@ -15,7 +19,7 @@ spv.image.frag Capability StorageImageWriteWithoutFormat 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 132 142 152 248 362 375 + EntryPoint Fragment 4 "main" 132 142 152 248 381 394 ExecutionMode 4 OriginUpperLeft Source GLSL 450 Name 4 "main" @@ -39,9 +43,11 @@ spv.image.frag Name 232 "ii1D" Name 245 "ui2D" Name 248 "value" - Name 357 "wo2D" - Name 362 "fragData" - Name 375 "ic4D" + Name 357 "ii2DMS" + Name 367 "ui2DMSArray" + Name 376 "wo2D" + Name 381 "fragData" + Name 394 "ic4D" Decorate 15(i1D) DescriptorSet 0 Decorate 15(i1D) Binding 0 Decorate 27(i2D) DescriptorSet 0 @@ -72,10 +78,14 @@ spv.image.frag Decorate 245(ui2D) DescriptorSet 0 Decorate 245(ui2D) Binding 12 Decorate 248(value) Flat - Decorate 357(wo2D) DescriptorSet 0 - Decorate 357(wo2D) Binding 1 - Decorate 357(wo2D) NonReadable - Decorate 375(ic4D) Flat + Decorate 357(ii2DMS) DescriptorSet 0 + Decorate 357(ii2DMS) Binding 13 + Decorate 367(ui2DMSArray) DescriptorSet 0 + Decorate 367(ui2DMSArray) Binding 14 + Decorate 376(wo2D) DescriptorSet 0 + Decorate 376(wo2D) Binding 1 + Decorate 376(wo2D) NonReadable + Decorate 394(ic4D) Flat 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -157,16 +167,22 @@ spv.image.frag 340: 6(int) Constant 18 341: 6(int) Constant 17 349: 18(int) Constant 19 - 355: TypeImage 12(float) 2D nonsampled format:Unknown + 355: TypeImage 6(int) 2D multi-sampled nonsampled format:R32i 356: TypePointer UniformConstant 355 - 357(wo2D): 356(ptr) Variable UniformConstant - 361: TypePointer Output 125(fvec4) - 362(fragData): 361(ptr) Variable Output - 367: TypeBool - 370: TypeVector 367(bool) 4 - 373: TypeVector 6(int) 4 - 374: TypePointer Input 373(ivec4) - 375(ic4D): 374(ptr) Variable Input + 357(ii2DMS): 356(ptr) Variable UniformConstant + 365: TypeImage 18(int) 2D array multi-sampled nonsampled format:R32ui + 366: TypePointer UniformConstant 365 +367(ui2DMSArray): 366(ptr) Variable UniformConstant + 374: TypeImage 12(float) 2D nonsampled format:Unknown + 375: TypePointer UniformConstant 374 + 376(wo2D): 375(ptr) Variable UniformConstant + 380: TypePointer Output 125(fvec4) + 381(fragData): 380(ptr) Variable Output + 386: TypeBool + 389: TypeVector 386(bool) 4 + 392: TypeVector 6(int) 4 + 393: TypePointer Input 392(ivec4) + 394(ic4D): 393(ptr) Variable Input 4(main): 2 Function None 3 5: Label 9(iv): 8(ptr) Variable Function @@ -493,18 +509,33 @@ spv.image.frag 353: 18(int) Load 229(ui) 354: 18(int) IAdd 353 352 Store 229(ui) 354 - 358: 355 Load 357(wo2D) - 359: 29(ivec2) Load 142(ic2D) - 360: 125(fvec4) Load 127(v) - ImageWrite 358 359 360 - 363: 18(int) Load 229(ui) - 364: 20(ptr) AccessChain 9(iv) 237 - 365: 6(int) Load 364 - 366: 18(int) Bitcast 365 - 368: 367(bool) INotEqual 363 366 - 369: 125(fvec4) Load 127(v) - 371: 370(bvec4) CompositeConstruct 368 368 368 368 - 372: 125(fvec4) Select 371 369 129 - Store 362(fragData) 372 + 358: 29(ivec2) Load 142(ic2D) + 359: 235(ptr) ImageTexelPointer 357(ii2DMS) 358 216 + 360: 6(int) AtomicCompareExchange 359 237 19 19 341 340 + 361: 20(ptr) AccessChain 9(iv) 19 + 362: 6(int) Load 361 + 363: 6(int) IAdd 362 360 + 364: 20(ptr) AccessChain 9(iv) 19 + Store 364 363 + 368: 7(ivec3) Load 152(ic3D) + 369: 18(int) Load 248(value) + 370: 250(ptr) ImageTexelPointer 367(ui2DMSArray) 368 220 + 371: 18(int) AtomicCompareExchange 370 237 19 19 369 349 + 372: 18(int) Load 229(ui) + 373: 18(int) IAdd 372 371 + Store 229(ui) 373 + 377: 374 Load 376(wo2D) + 378: 29(ivec2) Load 142(ic2D) + 379: 125(fvec4) Load 127(v) + ImageWrite 377 378 379 + 382: 18(int) Load 229(ui) + 383: 20(ptr) AccessChain 9(iv) 237 + 384: 6(int) Load 383 + 385: 18(int) Bitcast 384 + 387: 386(bool) INotEqual 382 385 + 388: 125(fvec4) Load 127(v) + 390: 389(bvec4) CompositeConstruct 387 387 387 387 + 391: 125(fvec4) Select 390 388 129 + Store 381(fragData) 391 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out index 50b04a82747..db9177d08d2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.imageLoadStoreLod.frag.out @@ -1,6 +1,10 @@ spv.imageLoadStoreLod.frag +error: SPIRV-Tools Validation Errors +error: Image Operand Lod can only be used with ExplicitLod opcodes and OpImageFetch + %19 = OpImageRead %v4float %15 %int_1 Lod %int_3 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 82 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.amd.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.amd.frag.out new file mode 100644 index 00000000000..0e3323bfce1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.amd.frag.out @@ -0,0 +1,803 @@ +spv.int16.amd.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability Float16 + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 560 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability StorageUniform16 + Capability StorageInputOutput16 + Extension "SPV_AMD_gpu_shader_int16" + Extension "SPV_KHR_16bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 519 521 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_AMD_gpu_shader_half_float" + SourceExtension "GL_AMD_gpu_shader_int16" + SourceExtension "GL_ARB_gpu_shader_int64" + Name 4 "main" + Name 6 "literal(" + Name 8 "operators(" + Name 10 "typeCast(" + Name 12 "builtinFuncs(" + Name 16 "u16" + Name 25 "Uniforms" + MemberName 25(Uniforms) 0 "i" + Name 27 "" + Name 34 "indexable" + Name 45 "indexable" + Name 51 "u16v" + Name 57 "i16" + Name 70 "u16" + Name 127 "b" + Name 148 "u" + Name 159 "i" + Name 189 "i16v" + Name 192 "bv" + Name 200 "u16v" + Name 213 "iv" + Name 226 "uv" + Name 240 "fv" + Name 252 "dv" + Name 264 "f16v" + Name 276 "i64v" + Name 290 "u64v" + Name 305 "i16v" + Name 311 "i16" + Name 319 "u16v" + Name 321 "u16" + Name 393 "f16v" + Name 396 "exp" + Name 397 "ResType" + Name 418 "packi" + Name 423 "packu" + Name 432 "packi64" + Name 441 "packu64" + Name 450 "bv" + Name 515 "Block" + MemberName 515(Block) 0 "i16v" + MemberName 515(Block) 1 "u16" + Name 517 "block" + Name 519 "iu16v" + Name 521 "ii16" + Name 522 "si64" + Name 523 "su64" + Name 524 "si" + Name 525 "su" + Name 526 "sb" + Name 527 "si16" + Name 528 "su16" + Name 529 "i16_to_b" + Name 530 "u16_to_b" + Name 531 "b_to_i16" + Name 532 "b_to_u16" + Name 533 "i16_to_i" + Name 535 "u16_to_i" + Name 536 "i_to_i16" + Name 538 "i_to_u16" + Name 540 "i16_to_u" + Name 541 "u16_to_u" + Name 543 "u_to_i16" + Name 544 "u_to_u16" + Name 545 "i16_to_i64" + Name 548 "u16_to_i64" + Name 549 "i64_to_i16" + Name 551 "i64_to_u16" + Name 553 "i16_to_u64" + Name 554 "u16_to_u64" + Name 556 "u64_to_i16" + Name 557 "u64_to_u16" + Name 558 "i16_to_u16" + Name 559 "u16_to_i16" + MemberDecorate 25(Uniforms) 0 Offset 0 + Decorate 25(Uniforms) Block + Decorate 27 DescriptorSet 0 + Decorate 27 Binding 0 + MemberDecorate 515(Block) 0 Offset 0 + MemberDecorate 515(Block) 1 Offset 6 + Decorate 515(Block) Block + Decorate 517(block) DescriptorSet 0 + Decorate 517(block) Binding 1 + Decorate 519(iu16v) Flat + Decorate 519(iu16v) Location 0 + Decorate 521(ii16) Flat + Decorate 521(ii16) Location 1 + Decorate 522(si64) SpecId 100 + Decorate 523(su64) SpecId 101 + Decorate 524(si) SpecId 102 + Decorate 525(su) SpecId 103 + Decorate 526(sb) SpecId 104 + Decorate 527(si16) SpecId 105 + Decorate 528(su16) SpecId 106 + 2: TypeVoid + 3: TypeFunction 2 + 14: TypeInt 16 0 + 15: TypePointer Function 14(int16_t) + 17: TypeInt 16 1 + 18: TypeInt 32 0 + 19: 18(int) Constant 3 + 20: TypeArray 17(int16_t) 19 + 21: 17(int16_t) Constant 273 + 22: 17(int16_t) Constant 4294967294 + 23: 17(int16_t) Constant 256 + 24: 20 ConstantComposite 21 22 23 + 25(Uniforms): TypeStruct 18(int) + 26: TypePointer Uniform 25(Uniforms) + 27: 26(ptr) Variable Uniform + 28: TypeInt 32 1 + 29: 28(int) Constant 0 + 30: TypePointer Uniform 18(int) + 33: TypePointer Function 20 + 35: TypePointer Function 17(int16_t) + 39: TypeArray 14(int16_t) 19 + 40: 14(int16_t) Constant 65535 + 41: 39 ConstantComposite 40 40 40 + 44: TypePointer Function 39 + 49: TypeVector 14(int16_t) 3 + 50: TypePointer Function 49(i16vec3) + 53: 17(int16_t) Constant 1 + 54: TypeVector 17(int16_t) 3 + 111: 18(int) Constant 1 + 117: 18(int) Constant 2 + 125: TypeBool + 126: TypePointer Function 125(bool) + 128: 18(int) Constant 0 + 147: TypePointer Function 18(int) + 158: TypePointer Function 28(int) + 187: TypeVector 17(int16_t) 2 + 188: TypePointer Function 187(i16vec2) + 190: TypeVector 125(bool) 2 + 191: TypePointer Function 190(bvec2) + 194: 17(int16_t) Constant 0 + 195:187(i16vec2) ConstantComposite 194 194 + 196:187(i16vec2) ConstantComposite 53 53 + 198: TypeVector 14(int16_t) 2 + 199: TypePointer Function 198(i16vec2) + 202: 14(int16_t) Constant 0 + 203: 14(int16_t) Constant 1 + 204:198(i16vec2) ConstantComposite 202 202 + 205:198(i16vec2) ConstantComposite 203 203 + 211: TypeVector 28(int) 2 + 212: TypePointer Function 211(ivec2) + 222: TypeVector 18(int) 2 + 225: TypePointer Function 222(ivec2) + 237: TypeFloat 32 + 238: TypeVector 237(float) 2 + 239: TypePointer Function 238(fvec2) + 249: TypeFloat 64 + 250: TypeVector 249(float64_t) 2 + 251: TypePointer Function 250(f64vec2) + 261: TypeFloat 16 + 262: TypeVector 261(float16_t) 2 + 263: TypePointer Function 262(f16vec2) + 273: TypeInt 64 1 + 274: TypeVector 273(int64_t) 2 + 275: TypePointer Function 274(i64vec2) + 285: TypeInt 64 0 + 286: TypeVector 285(int64_t) 2 + 289: TypePointer Function 286(i64vec2) + 316: 17(int16_t) Constant 4294967295 + 317:187(i16vec2) ConstantComposite 316 316 + 326: 49(i16vec3) ConstantComposite 202 202 202 + 368: 125(bool) ConstantTrue + 375: 125(bool) ConstantFalse + 376: 190(bvec2) ConstantComposite 375 375 + 388: TypeVector 125(bool) 3 + 389: 388(bvec3) ConstantComposite 375 375 375 + 391: TypeVector 261(float16_t) 3 + 392: TypePointer Function 391(f16vec3) + 395: TypePointer Function 54(i16vec3) + 397(ResType): TypeStruct 391(f16vec3) 54(i16vec3) + 407: TypePointer Function 261(float16_t) + 431: TypePointer Function 273(int64_t) + 434: TypeVector 17(int16_t) 4 + 440: TypePointer Function 285(int64_t) + 443: TypeVector 14(int16_t) 4 + 449: TypePointer Function 388(bvec3) + 515(Block): TypeStruct 54(i16vec3) 14(int16_t) + 516: TypePointer Uniform 515(Block) + 517(block): 516(ptr) Variable Uniform + 518: TypePointer Input 49(i16vec3) + 519(iu16v): 518(ptr) Variable Input + 520: TypePointer Input 17(int16_t) + 521(ii16): 520(ptr) Variable Input + 522(si64):273(int64_t) SpecConstant 4294967286 4294967295 + 523(su64):285(int64_t) SpecConstant 20 0 + 524(si): 28(int) SpecConstant 4294967291 + 525(su): 18(int) SpecConstant 4 + 526(sb): 125(bool) SpecConstantTrue + 527(si16): 17(int16_t) SpecConstant 4294967291 + 528(su16): 14(int16_t) SpecConstant 4 + 529(i16_to_b): 125(bool) SpecConstantOp 171 527(si16) 202 + 530(u16_to_b): 125(bool) SpecConstantOp 171 528(su16) 202 + 531(b_to_i16): 17(int16_t) SpecConstantOp 169 526(sb) 53 194 + 532(b_to_u16): 14(int16_t) SpecConstantOp 169 526(sb) 203 202 + 533(i16_to_i): 28(int) SpecConstantOp 114 527(si16) + 534: 18(int) SpecConstantOp 113 528(su16) + 535(u16_to_i): 28(int) SpecConstantOp 128 534 128 + 536(i_to_i16): 17(int16_t) SpecConstantOp 114 524(si) + 537: 17(int16_t) SpecConstantOp 114 524(si) + 538(i_to_u16): 14(int16_t) SpecConstantOp 128 537 202 + 539: 28(int) SpecConstantOp 114 527(si16) + 540(i16_to_u): 18(int) SpecConstantOp 128 539 128 + 541(u16_to_u): 18(int) SpecConstantOp 113 528(su16) + 542: 14(int16_t) SpecConstantOp 113 525(su) + 543(u_to_i16): 17(int16_t) SpecConstantOp 128 542 202 + 544(u_to_u16): 14(int16_t) SpecConstantOp 113 525(su) + 545(i16_to_i64):273(int64_t) SpecConstantOp 114 527(si16) + 546:285(int64_t) SpecConstantOp 113 528(su16) + 547:285(int64_t) Constant 0 0 + 548(u16_to_i64):273(int64_t) SpecConstantOp 128 546 547 + 549(i64_to_i16): 17(int16_t) SpecConstantOp 114 522(si64) + 550: 17(int16_t) SpecConstantOp 114 522(si64) + 551(i64_to_u16): 14(int16_t) SpecConstantOp 128 550 202 + 552:273(int64_t) SpecConstantOp 114 527(si16) + 553(i16_to_u64):285(int64_t) SpecConstantOp 128 552 547 + 554(u16_to_u64):285(int64_t) SpecConstantOp 113 528(su16) + 555: 14(int16_t) SpecConstantOp 113 523(su64) + 556(u64_to_i16): 17(int16_t) SpecConstantOp 128 555 202 + 557(u64_to_u16): 14(int16_t) SpecConstantOp 113 523(su64) + 558(i16_to_u16): 14(int16_t) SpecConstantOp 128 527(si16) 202 + 559(u16_to_i16): 17(int16_t) SpecConstantOp 128 528(su16) 202 + 4(main): 2 Function None 3 + 5: Label + 511: 2 FunctionCall 6(literal() + 512: 2 FunctionCall 8(operators() + 513: 2 FunctionCall 10(typeCast() + 514: 2 FunctionCall 12(builtinFuncs() + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 16(u16): 15(ptr) Variable Function + 34(indexable): 33(ptr) Variable Function + 45(indexable): 44(ptr) Variable Function + 31: 30(ptr) AccessChain 27 29 + 32: 18(int) Load 31 + Store 34(indexable) 24 + 36: 35(ptr) AccessChain 34(indexable) 32 + 37: 17(int16_t) Load 36 + 38: 14(int16_t) Bitcast 37 + 42: 30(ptr) AccessChain 27 29 + 43: 18(int) Load 42 + Store 45(indexable) 41 + 46: 15(ptr) AccessChain 45(indexable) 43 + 47: 14(int16_t) Load 46 + 48: 14(int16_t) IAdd 38 47 + Store 16(u16) 48 + Return + FunctionEnd + 8(operators(): 2 Function None 3 + 9: Label + 51(u16v): 50(ptr) Variable Function + 57(i16): 35(ptr) Variable Function + 70(u16): 15(ptr) Variable Function + 127(b): 126(ptr) Variable Function + 148(u): 147(ptr) Variable Function + 159(i): 158(ptr) Variable Function + 52: 49(i16vec3) Load 51(u16v) + 55: 54(i16vec3) CompositeConstruct 53 53 53 + 56: 49(i16vec3) IAdd 52 55 + Store 51(u16v) 56 + 58: 17(int16_t) Load 57(i16) + 59: 17(int16_t) ISub 58 53 + Store 57(i16) 59 + 60: 17(int16_t) Load 57(i16) + 61: 17(int16_t) IAdd 60 53 + Store 57(i16) 61 + 62: 49(i16vec3) Load 51(u16v) + 63: 54(i16vec3) CompositeConstruct 53 53 53 + 64: 49(i16vec3) ISub 62 63 + Store 51(u16v) 64 + 65: 49(i16vec3) Load 51(u16v) + 66: 49(i16vec3) Not 65 + Store 51(u16v) 66 + 67: 17(int16_t) Load 57(i16) + Store 57(i16) 67 + 68: 49(i16vec3) Load 51(u16v) + 69: 49(i16vec3) SNegate 68 + Store 51(u16v) 69 + 71: 17(int16_t) Load 57(i16) + 72: 14(int16_t) Bitcast 71 + 73: 14(int16_t) Load 70(u16) + 74: 14(int16_t) IAdd 73 72 + Store 70(u16) 74 + 75: 49(i16vec3) Load 51(u16v) + 76: 49(i16vec3) Load 51(u16v) + 77: 49(i16vec3) ISub 76 75 + Store 51(u16v) 77 + 78: 17(int16_t) Load 57(i16) + 79: 17(int16_t) Load 57(i16) + 80: 17(int16_t) IMul 79 78 + Store 57(i16) 80 + 81: 49(i16vec3) Load 51(u16v) + 82: 49(i16vec3) Load 51(u16v) + 83: 49(i16vec3) UDiv 82 81 + Store 51(u16v) 83 + 84: 17(int16_t) Load 57(i16) + 85: 14(int16_t) Bitcast 84 + 86: 49(i16vec3) Load 51(u16v) + 87: 49(i16vec3) CompositeConstruct 85 85 85 + 88: 49(i16vec3) UMod 86 87 + Store 51(u16v) 88 + 89: 49(i16vec3) Load 51(u16v) + 90: 49(i16vec3) Load 51(u16v) + 91: 49(i16vec3) IAdd 89 90 + Store 51(u16v) 91 + 92: 17(int16_t) Load 57(i16) + 93: 14(int16_t) Bitcast 92 + 94: 14(int16_t) Load 70(u16) + 95: 14(int16_t) ISub 93 94 + Store 70(u16) 95 + 96: 49(i16vec3) Load 51(u16v) + 97: 17(int16_t) Load 57(i16) + 98: 14(int16_t) Bitcast 97 + 99: 49(i16vec3) CompositeConstruct 98 98 98 + 100: 49(i16vec3) IMul 96 99 + Store 51(u16v) 100 + 101: 17(int16_t) Load 57(i16) + 102: 17(int16_t) Load 57(i16) + 103: 17(int16_t) IMul 101 102 + Store 57(i16) 103 + 104: 17(int16_t) Load 57(i16) + 105: 17(int16_t) Load 57(i16) + 106: 17(int16_t) SMod 104 105 + Store 57(i16) 106 + 107: 17(int16_t) Load 57(i16) + 108: 49(i16vec3) Load 51(u16v) + 109: 54(i16vec3) CompositeConstruct 107 107 107 + 110: 49(i16vec3) ShiftLeftLogical 108 109 + Store 51(u16v) 110 + 112: 15(ptr) AccessChain 51(u16v) 111 + 113: 14(int16_t) Load 112 + 114: 17(int16_t) Load 57(i16) + 115: 17(int16_t) ShiftRightArithmetic 114 113 + Store 57(i16) 115 + 116: 17(int16_t) Load 57(i16) + 118: 15(ptr) AccessChain 51(u16v) 117 + 119: 14(int16_t) Load 118 + 120: 17(int16_t) ShiftLeftLogical 116 119 + Store 57(i16) 120 + 121: 49(i16vec3) Load 51(u16v) + 122: 17(int16_t) Load 57(i16) + 123: 54(i16vec3) CompositeConstruct 122 122 122 + 124: 49(i16vec3) ShiftLeftLogical 121 123 + Store 51(u16v) 124 + 129: 15(ptr) AccessChain 51(u16v) 128 + 130: 14(int16_t) Load 129 + 131: 17(int16_t) Load 57(i16) + 132: 14(int16_t) Bitcast 131 + 133: 125(bool) INotEqual 130 132 + Store 127(b) 133 + 134: 17(int16_t) Load 57(i16) + 135: 14(int16_t) Bitcast 134 + 136: 15(ptr) AccessChain 51(u16v) 128 + 137: 14(int16_t) Load 136 + 138: 125(bool) IEqual 135 137 + Store 127(b) 138 + 139: 15(ptr) AccessChain 51(u16v) 128 + 140: 14(int16_t) Load 139 + 141: 15(ptr) AccessChain 51(u16v) 111 + 142: 14(int16_t) Load 141 + 143: 125(bool) UGreaterThan 140 142 + Store 127(b) 143 + 144: 17(int16_t) Load 57(i16) + 145: 28(int) SConvert 144 + 146: 18(int) Bitcast 145 + 149: 18(int) Load 148(u) + 150: 125(bool) ULessThan 146 149 + Store 127(b) 150 + 151: 15(ptr) AccessChain 51(u16v) 111 + 152: 14(int16_t) Load 151 + 153: 15(ptr) AccessChain 51(u16v) 128 + 154: 14(int16_t) Load 153 + 155: 125(bool) UGreaterThanEqual 152 154 + Store 127(b) 155 + 156: 17(int16_t) Load 57(i16) + 157: 28(int) SConvert 156 + 160: 28(int) Load 159(i) + 161: 125(bool) SLessThanEqual 157 160 + Store 127(b) 161 + 162: 17(int16_t) Load 57(i16) + 163: 14(int16_t) Bitcast 162 + 164: 49(i16vec3) Load 51(u16v) + 165: 49(i16vec3) CompositeConstruct 163 163 163 + 166: 49(i16vec3) BitwiseOr 164 165 + Store 51(u16v) 166 + 167: 17(int16_t) Load 57(i16) + 168: 14(int16_t) Bitcast 167 + 169: 14(int16_t) Load 70(u16) + 170: 14(int16_t) BitwiseOr 168 169 + Store 70(u16) 170 + 171: 17(int16_t) Load 57(i16) + 172: 17(int16_t) Load 57(i16) + 173: 17(int16_t) BitwiseAnd 172 171 + Store 57(i16) 173 + 174: 49(i16vec3) Load 51(u16v) + 175: 49(i16vec3) Load 51(u16v) + 176: 49(i16vec3) BitwiseAnd 174 175 + Store 51(u16v) 176 + 177: 17(int16_t) Load 57(i16) + 178: 14(int16_t) Bitcast 177 + 179: 49(i16vec3) Load 51(u16v) + 180: 49(i16vec3) CompositeConstruct 178 178 178 + 181: 49(i16vec3) BitwiseXor 179 180 + Store 51(u16v) 181 + 182: 49(i16vec3) Load 51(u16v) + 183: 17(int16_t) Load 57(i16) + 184: 14(int16_t) Bitcast 183 + 185: 49(i16vec3) CompositeConstruct 184 184 184 + 186: 49(i16vec3) BitwiseXor 182 185 + Store 51(u16v) 186 + Return + FunctionEnd + 10(typeCast(): 2 Function None 3 + 11: Label + 189(i16v): 188(ptr) Variable Function + 192(bv): 191(ptr) Variable Function + 200(u16v): 199(ptr) Variable Function + 213(iv): 212(ptr) Variable Function + 226(uv): 225(ptr) Variable Function + 240(fv): 239(ptr) Variable Function + 252(dv): 251(ptr) Variable Function + 264(f16v): 263(ptr) Variable Function + 276(i64v): 275(ptr) Variable Function + 290(u64v): 289(ptr) Variable Function + 193: 190(bvec2) Load 192(bv) + 197:187(i16vec2) Select 193 196 195 + Store 189(i16v) 197 + 201: 190(bvec2) Load 192(bv) + 206:198(i16vec2) Select 201 205 204 + Store 200(u16v) 206 + 207:187(i16vec2) Load 189(i16v) + 208: 190(bvec2) INotEqual 207 204 + Store 192(bv) 208 + 209:198(i16vec2) Load 200(u16v) + 210: 190(bvec2) INotEqual 209 204 + Store 192(bv) 210 + 214: 211(ivec2) Load 213(iv) + 215:187(i16vec2) SConvert 214 + Store 189(i16v) 215 + 216: 211(ivec2) Load 213(iv) + 217:187(i16vec2) SConvert 216 + 218:198(i16vec2) Bitcast 217 + Store 200(u16v) 218 + 219:187(i16vec2) Load 189(i16v) + 220: 211(ivec2) SConvert 219 + Store 213(iv) 220 + 221:198(i16vec2) Load 200(u16v) + 223: 222(ivec2) UConvert 221 + 224: 211(ivec2) Bitcast 223 + Store 213(iv) 224 + 227: 222(ivec2) Load 226(uv) + 228:198(i16vec2) UConvert 227 + 229:187(i16vec2) Bitcast 228 + Store 189(i16v) 229 + 230: 222(ivec2) Load 226(uv) + 231:198(i16vec2) UConvert 230 + Store 200(u16v) 231 + 232:187(i16vec2) Load 189(i16v) + 233: 211(ivec2) SConvert 232 + 234: 222(ivec2) Bitcast 233 + Store 226(uv) 234 + 235:198(i16vec2) Load 200(u16v) + 236: 222(ivec2) UConvert 235 + Store 226(uv) 236 + 241: 238(fvec2) Load 240(fv) + 242:187(i16vec2) ConvertFToS 241 + Store 189(i16v) 242 + 243: 238(fvec2) Load 240(fv) + 244:198(i16vec2) ConvertFToU 243 + Store 200(u16v) 244 + 245:187(i16vec2) Load 189(i16v) + 246: 238(fvec2) ConvertSToF 245 + Store 240(fv) 246 + 247:198(i16vec2) Load 200(u16v) + 248: 238(fvec2) ConvertUToF 247 + Store 240(fv) 248 + 253:250(f64vec2) Load 252(dv) + 254:187(i16vec2) ConvertFToS 253 + Store 189(i16v) 254 + 255:250(f64vec2) Load 252(dv) + 256:198(i16vec2) ConvertFToU 255 + Store 200(u16v) 256 + 257:187(i16vec2) Load 189(i16v) + 258:250(f64vec2) ConvertSToF 257 + Store 252(dv) 258 + 259:198(i16vec2) Load 200(u16v) + 260:250(f64vec2) ConvertUToF 259 + Store 252(dv) 260 + 265:262(f16vec2) Load 264(f16v) + 266:187(i16vec2) ConvertFToS 265 + Store 189(i16v) 266 + 267:262(f16vec2) Load 264(f16v) + 268:198(i16vec2) ConvertFToU 267 + Store 200(u16v) 268 + 269:187(i16vec2) Load 189(i16v) + 270:262(f16vec2) ConvertSToF 269 + Store 264(f16v) 270 + 271:198(i16vec2) Load 200(u16v) + 272:262(f16vec2) ConvertUToF 271 + Store 264(f16v) 272 + 277:274(i64vec2) Load 276(i64v) + 278:187(i16vec2) SConvert 277 + Store 189(i16v) 278 + 279:274(i64vec2) Load 276(i64v) + 280:187(i16vec2) SConvert 279 + 281:198(i16vec2) Bitcast 280 + Store 200(u16v) 281 + 282:187(i16vec2) Load 189(i16v) + 283:274(i64vec2) SConvert 282 + Store 276(i64v) 283 + 284:198(i16vec2) Load 200(u16v) + 287:286(i64vec2) UConvert 284 + 288:274(i64vec2) Bitcast 287 + Store 276(i64v) 288 + 291:286(i64vec2) Load 290(u64v) + 292:198(i16vec2) UConvert 291 + 293:187(i16vec2) Bitcast 292 + Store 189(i16v) 293 + 294:286(i64vec2) Load 290(u64v) + 295:198(i16vec2) UConvert 294 + Store 200(u16v) 295 + 296:187(i16vec2) Load 189(i16v) + 297:274(i64vec2) SConvert 296 + 298:286(i64vec2) Bitcast 297 + Store 290(u64v) 298 + 299:198(i16vec2) Load 200(u16v) + 300:286(i64vec2) UConvert 299 + Store 290(u64v) 300 + 301:198(i16vec2) Load 200(u16v) + 302:187(i16vec2) Bitcast 301 + Store 189(i16v) 302 + 303:187(i16vec2) Load 189(i16v) + 304:198(i16vec2) Bitcast 303 + Store 200(u16v) 304 + Return + FunctionEnd +12(builtinFuncs(): 2 Function None 3 + 13: Label + 305(i16v): 188(ptr) Variable Function + 311(i16): 35(ptr) Variable Function + 319(u16v): 50(ptr) Variable Function + 321(u16): 15(ptr) Variable Function + 393(f16v): 392(ptr) Variable Function + 396(exp): 395(ptr) Variable Function + 418(packi): 158(ptr) Variable Function + 423(packu): 147(ptr) Variable Function + 432(packi64): 431(ptr) Variable Function + 441(packu64): 440(ptr) Variable Function + 450(bv): 449(ptr) Variable Function + 306:187(i16vec2) Load 305(i16v) + 307:187(i16vec2) ExtInst 1(GLSL.std.450) 5(SAbs) 306 + Store 305(i16v) 307 + 308:187(i16vec2) Load 305(i16v) + 309:187(i16vec2) ExtInst 1(GLSL.std.450) 7(SSign) 308 + Store 305(i16v) 309 + 310:187(i16vec2) Load 305(i16v) + 312: 17(int16_t) Load 311(i16) + 313:187(i16vec2) CompositeConstruct 312 312 + 314:187(i16vec2) ExtInst 1(GLSL.std.450) 39(SMin) 310 313 + Store 305(i16v) 314 + 315:187(i16vec2) Load 305(i16v) + 318:187(i16vec2) ExtInst 1(GLSL.std.450) 39(SMin) 315 317 + Store 305(i16v) 318 + 320: 49(i16vec3) Load 319(u16v) + 322: 14(int16_t) Load 321(u16) + 323: 49(i16vec3) CompositeConstruct 322 322 322 + 324: 49(i16vec3) ExtInst 1(GLSL.std.450) 38(UMin) 320 323 + Store 319(u16v) 324 + 325: 49(i16vec3) Load 319(u16v) + 327: 49(i16vec3) ExtInst 1(GLSL.std.450) 38(UMin) 325 326 + Store 319(u16v) 327 + 328:187(i16vec2) Load 305(i16v) + 329: 17(int16_t) Load 311(i16) + 330:187(i16vec2) CompositeConstruct 329 329 + 331:187(i16vec2) ExtInst 1(GLSL.std.450) 42(SMax) 328 330 + Store 305(i16v) 331 + 332:187(i16vec2) Load 305(i16v) + 333:187(i16vec2) ExtInst 1(GLSL.std.450) 42(SMax) 332 317 + Store 305(i16v) 333 + 334: 49(i16vec3) Load 319(u16v) + 335: 14(int16_t) Load 321(u16) + 336: 49(i16vec3) CompositeConstruct 335 335 335 + 337: 49(i16vec3) ExtInst 1(GLSL.std.450) 41(UMax) 334 336 + Store 319(u16v) 337 + 338: 49(i16vec3) Load 319(u16v) + 339: 49(i16vec3) ExtInst 1(GLSL.std.450) 41(UMax) 338 326 + Store 319(u16v) 339 + 340:187(i16vec2) Load 305(i16v) + 341: 17(int16_t) Load 311(i16) + 342: 17(int16_t) SNegate 341 + 343: 17(int16_t) Load 311(i16) + 344:187(i16vec2) CompositeConstruct 342 342 + 345:187(i16vec2) CompositeConstruct 343 343 + 346:187(i16vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 340 344 345 + Store 305(i16v) 346 + 347:187(i16vec2) Load 305(i16v) + 348:187(i16vec2) Load 305(i16v) + 349:187(i16vec2) SNegate 348 + 350:187(i16vec2) Load 305(i16v) + 351:187(i16vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 347 349 350 + Store 305(i16v) 351 + 352: 49(i16vec3) Load 319(u16v) + 353: 14(int16_t) Load 321(u16) + 354: 14(int16_t) SNegate 353 + 355: 14(int16_t) Load 321(u16) + 356: 49(i16vec3) CompositeConstruct 354 354 354 + 357: 49(i16vec3) CompositeConstruct 355 355 355 + 358: 49(i16vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 352 356 357 + Store 319(u16v) 358 + 359: 49(i16vec3) Load 319(u16v) + 360: 49(i16vec3) Load 319(u16v) + 361: 49(i16vec3) SNegate 360 + 362: 49(i16vec3) Load 319(u16v) + 363: 49(i16vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 359 361 362 + Store 319(u16v) 363 + 364: 35(ptr) AccessChain 305(i16v) 128 + 365: 17(int16_t) Load 364 + 366: 35(ptr) AccessChain 305(i16v) 111 + 367: 17(int16_t) Load 366 + 369: 17(int16_t) Select 368 367 365 + Store 311(i16) 369 + 370: 17(int16_t) Load 311(i16) + 371:187(i16vec2) CompositeConstruct 370 370 + 372: 17(int16_t) Load 311(i16) + 373: 17(int16_t) SNegate 372 + 374:187(i16vec2) CompositeConstruct 373 373 + 377:187(i16vec2) Select 376 374 371 + Store 305(i16v) 377 + 378: 15(ptr) AccessChain 319(u16v) 128 + 379: 14(int16_t) Load 378 + 380: 15(ptr) AccessChain 319(u16v) 111 + 381: 14(int16_t) Load 380 + 382: 14(int16_t) Select 368 381 379 + Store 321(u16) 382 + 383: 14(int16_t) Load 321(u16) + 384: 49(i16vec3) CompositeConstruct 383 383 383 + 385: 14(int16_t) Load 321(u16) + 386: 14(int16_t) SNegate 385 + 387: 49(i16vec3) CompositeConstruct 386 386 386 + 390: 49(i16vec3) Select 389 387 384 + Store 319(u16v) 390 + 394:391(f16vec3) Load 393(f16v) + 398:397(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 394 + 399: 54(i16vec3) CompositeExtract 398 1 + Store 396(exp) 399 + 400:391(f16vec3) CompositeExtract 398 0 + Store 393(f16v) 400 + 401:391(f16vec3) Load 393(f16v) + 402: 54(i16vec3) Load 396(exp) + 403:391(f16vec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 401 402 + Store 393(f16v) 403 + 404:391(f16vec3) Load 393(f16v) + 405:262(f16vec2) VectorShuffle 404 404 0 1 + 406:187(i16vec2) Bitcast 405 + Store 305(i16v) 406 + 408: 407(ptr) AccessChain 393(f16v) 117 + 409:261(float16_t) Load 408 + 410: 14(int16_t) Bitcast 409 + 411: 15(ptr) AccessChain 319(u16v) 128 + Store 411 410 + 412:187(i16vec2) Load 305(i16v) + 413:262(f16vec2) Bitcast 412 + 414:391(f16vec3) Load 393(f16v) + 415:391(f16vec3) VectorShuffle 414 413 3 4 2 + Store 393(f16v) 415 + 416: 49(i16vec3) Load 319(u16v) + 417:391(f16vec3) Bitcast 416 + Store 393(f16v) 417 + 419:187(i16vec2) Load 305(i16v) + 420: 28(int) Bitcast 419 + Store 418(packi) 420 + 421: 28(int) Load 418(packi) + 422:187(i16vec2) Bitcast 421 + Store 305(i16v) 422 + 424: 49(i16vec3) Load 319(u16v) + 425:198(i16vec2) VectorShuffle 424 424 0 1 + 426: 18(int) Bitcast 425 + Store 423(packu) 426 + 427: 18(int) Load 423(packu) + 428:198(i16vec2) Bitcast 427 + 429: 49(i16vec3) Load 319(u16v) + 430: 49(i16vec3) VectorShuffle 429 428 3 4 2 + Store 319(u16v) 430 + 433: 17(int16_t) Load 311(i16) + 435:434(i16vec4) CompositeConstruct 433 433 433 433 + 436:273(int64_t) Bitcast 435 + Store 432(packi64) 436 + 437:273(int64_t) Load 432(packi64) + 438:434(i16vec4) Bitcast 437 + 439:187(i16vec2) VectorShuffle 438 438 0 1 + Store 305(i16v) 439 + 442: 14(int16_t) Load 321(u16) + 444:443(i16vec4) CompositeConstruct 442 442 442 442 + 445:285(int64_t) Bitcast 444 + Store 441(packu64) 445 + 446:285(int64_t) Load 441(packu64) + 447:443(i16vec4) Bitcast 446 + 448: 49(i16vec3) VectorShuffle 447 447 0 1 2 + Store 319(u16v) 448 + 451: 49(i16vec3) Load 319(u16v) + 452: 14(int16_t) Load 321(u16) + 453: 49(i16vec3) CompositeConstruct 452 452 452 + 454: 388(bvec3) ULessThan 451 453 + Store 450(bv) 454 + 455:187(i16vec2) Load 305(i16v) + 456: 17(int16_t) Load 311(i16) + 457:187(i16vec2) CompositeConstruct 456 456 + 458: 190(bvec2) SLessThan 455 457 + 459: 388(bvec3) Load 450(bv) + 460: 388(bvec3) VectorShuffle 459 458 3 4 2 + Store 450(bv) 460 + 461: 49(i16vec3) Load 319(u16v) + 462: 14(int16_t) Load 321(u16) + 463: 49(i16vec3) CompositeConstruct 462 462 462 + 464: 388(bvec3) ULessThanEqual 461 463 + Store 450(bv) 464 + 465:187(i16vec2) Load 305(i16v) + 466: 17(int16_t) Load 311(i16) + 467:187(i16vec2) CompositeConstruct 466 466 + 468: 190(bvec2) SLessThanEqual 465 467 + 469: 388(bvec3) Load 450(bv) + 470: 388(bvec3) VectorShuffle 469 468 3 4 2 + Store 450(bv) 470 + 471: 49(i16vec3) Load 319(u16v) + 472: 14(int16_t) Load 321(u16) + 473: 49(i16vec3) CompositeConstruct 472 472 472 + 474: 388(bvec3) UGreaterThan 471 473 + Store 450(bv) 474 + 475:187(i16vec2) Load 305(i16v) + 476: 17(int16_t) Load 311(i16) + 477:187(i16vec2) CompositeConstruct 476 476 + 478: 190(bvec2) SGreaterThan 475 477 + 479: 388(bvec3) Load 450(bv) + 480: 388(bvec3) VectorShuffle 479 478 3 4 2 + Store 450(bv) 480 + 481: 49(i16vec3) Load 319(u16v) + 482: 14(int16_t) Load 321(u16) + 483: 49(i16vec3) CompositeConstruct 482 482 482 + 484: 388(bvec3) UGreaterThanEqual 481 483 + Store 450(bv) 484 + 485:187(i16vec2) Load 305(i16v) + 486: 17(int16_t) Load 311(i16) + 487:187(i16vec2) CompositeConstruct 486 486 + 488: 190(bvec2) SGreaterThanEqual 485 487 + 489: 388(bvec3) Load 450(bv) + 490: 388(bvec3) VectorShuffle 489 488 3 4 2 + Store 450(bv) 490 + 491: 49(i16vec3) Load 319(u16v) + 492: 14(int16_t) Load 321(u16) + 493: 49(i16vec3) CompositeConstruct 492 492 492 + 494: 388(bvec3) IEqual 491 493 + Store 450(bv) 494 + 495:187(i16vec2) Load 305(i16v) + 496: 17(int16_t) Load 311(i16) + 497:187(i16vec2) CompositeConstruct 496 496 + 498: 190(bvec2) IEqual 495 497 + 499: 388(bvec3) Load 450(bv) + 500: 388(bvec3) VectorShuffle 499 498 3 4 2 + Store 450(bv) 500 + 501: 49(i16vec3) Load 319(u16v) + 502: 14(int16_t) Load 321(u16) + 503: 49(i16vec3) CompositeConstruct 502 502 502 + 504: 388(bvec3) INotEqual 501 503 + Store 450(bv) 504 + 505:187(i16vec2) Load 305(i16v) + 506: 17(int16_t) Load 311(i16) + 507:187(i16vec2) CompositeConstruct 506 506 + 508: 190(bvec2) INotEqual 505 507 + 509: 388(bvec3) Load 450(bv) + 510: 388(bvec3) VectorShuffle 509 508 3 4 2 + Store 450(bv) 510 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.frag.out index 6cc60705418..3ba5c0715dc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int16.frag.out @@ -1,779 +1,746 @@ spv.int16.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability Float16 + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 561 +// Generated by (magic number): 80007 +// Id's are bound by 523 Capability Shader Capability Float16 Capability Float64 Capability Int64 Capability Int16 + Capability Int8 Capability StorageUniform16 - Capability StorageInputOutput16 - Extension "SPV_AMD_gpu_shader_half_float" - Extension "SPV_AMD_gpu_shader_int16" Extension "SPV_KHR_16bit_storage" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 520 522 + EntryPoint Fragment 4 "main" ExecutionMode 4 OriginUpperLeft Source GLSL 450 - SourceExtension "GL_AMD_gpu_shader_half_float" - SourceExtension "GL_AMD_gpu_shader_int16" - SourceExtension "GL_ARB_gpu_shader_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" Name 4 "main" Name 6 "literal(" - Name 8 "operators(" - Name 10 "typeCast(" + Name 8 "typeCast16(" + Name 10 "operators(" Name 12 "builtinFuncs(" - Name 16 "u16" - Name 25 "Uniforms" - MemberName 25(Uniforms) 0 "i" - Name 27 "" - Name 34 "indexable" - Name 45 "indexable" - Name 51 "u16v" - Name 57 "i16" - Name 70 "u16" - Name 108 "i" - Name 130 "b" - Name 151 "u" - Name 190 "i16v" - Name 193 "bv" - Name 201 "u16v" - Name 214 "iv" + Name 16 "i16" + Name 24 "Uniforms" + MemberName 24(Uniforms) 0 "index" + Name 26 "" + Name 33 "indexable" + Name 38 "u16" + Name 46 "indexable" + Name 51 "i32v" + Name 54 "i16v" + Name 59 "u16v" + Name 67 "u32v" + Name 74 "i64v" + Name 80 "u64v" + Name 94 "f16v" + Name 100 "f32v" + Name 106 "f64v" + Name 154 "i8v" + Name 163 "u8v" + Name 176 "bv" + Name 195 "u16v" + Name 200 "i16" + Name 220 "i" Name 227 "uv" - Name 241 "fv" - Name 253 "dv" - Name 265 "f16v" - Name 277 "i64v" - Name 291 "u64v" - Name 306 "i16v" - Name 312 "i16" - Name 320 "u16v" - Name 322 "u16" - Name 394 "f16v" - Name 397 "exp" - Name 398 "ResType" - Name 419 "packi" - Name 424 "packu" - Name 433 "packi64" - Name 442 "packu64" - Name 451 "bv" - Name 516 "Block" - MemberName 516(Block) 0 "i16v" - MemberName 516(Block) 1 "u16" - Name 518 "block" - Name 520 "iu16v" - Name 522 "ii16" - Name 523 "si64" - Name 524 "su64" - Name 525 "si" - Name 526 "su" - Name 527 "sb" - Name 528 "si16" - Name 529 "su16" - MemberDecorate 25(Uniforms) 0 Offset 0 - Decorate 25(Uniforms) Block - Decorate 27 DescriptorSet 0 - Decorate 27 Binding 0 - MemberDecorate 516(Block) 0 Offset 0 - MemberDecorate 516(Block) 1 Offset 6 - Decorate 516(Block) Block - Decorate 518(block) DescriptorSet 0 - Decorate 518(block) Binding 1 - Decorate 520(iu16v) Flat - Decorate 520(iu16v) Location 0 - Decorate 522(ii16) Flat - Decorate 522(ii16) Location 1 - Decorate 523(si64) SpecId 100 - Decorate 524(su64) SpecId 101 - Decorate 525(si) SpecId 102 - Decorate 526(su) SpecId 103 - Decorate 527(sb) SpecId 104 - Decorate 528(si16) SpecId 105 - Decorate 529(su16) SpecId 106 + Name 243 "i64" + Name 281 "b" + Name 343 "i16v" + Name 346 "i16" + Name 356 "u16v" + Name 358 "u16" + Name 428 "i32" + Name 431 "i64" + Name 434 "i16v4" + Name 437 "u32" + Name 438 "u16v2" + Name 442 "u64" + Name 445 "u16v4" + Name 457 "bv" + Name 518 "Block" + MemberName 518(Block) 0 "i16" + MemberName 518(Block) 1 "i16v2" + MemberName 518(Block) 2 "i16v3" + MemberName 518(Block) 3 "i16v4" + MemberName 518(Block) 4 "u16" + MemberName 518(Block) 5 "u16v2" + MemberName 518(Block) 6 "u16v3" + MemberName 518(Block) 7 "u16v4" + Name 520 "block" + Name 521 "si16" + Name 522 "su16" + MemberDecorate 24(Uniforms) 0 Offset 0 + Decorate 24(Uniforms) Block + Decorate 26 DescriptorSet 0 + Decorate 26 Binding 0 + MemberDecorate 518(Block) 0 Offset 0 + MemberDecorate 518(Block) 1 Offset 4 + MemberDecorate 518(Block) 2 Offset 8 + MemberDecorate 518(Block) 3 Offset 16 + MemberDecorate 518(Block) 4 Offset 24 + MemberDecorate 518(Block) 5 Offset 28 + MemberDecorate 518(Block) 6 Offset 32 + MemberDecorate 518(Block) 7 Offset 40 + Decorate 518(Block) Block + Decorate 520(block) DescriptorSet 0 + Decorate 520(block) Binding 1 + Decorate 521(si16) SpecId 100 + Decorate 522(su16) SpecId 101 2: TypeVoid 3: TypeFunction 2 - 14: TypeInt 16 0 - 15: TypePointer Function 14(int) - 17: TypeInt 16 1 - 18: TypeInt 32 0 - 19: 18(int) Constant 3 - 20: TypeArray 17(int) 19 - 21: 17(int) Constant 273 - 22: 17(int) Constant 65534 - 23: 17(int) Constant 256 - 24: 20 ConstantComposite 21 22 23 - 25(Uniforms): TypeStruct 18(int) - 26: TypePointer Uniform 25(Uniforms) - 27: 26(ptr) Variable Uniform - 28: TypeInt 32 1 - 29: 28(int) Constant 0 - 30: TypePointer Uniform 18(int) - 33: TypePointer Function 20 - 35: TypePointer Function 17(int) - 39: TypeArray 14(int) 19 - 40: 14(int) Constant 65535 - 41: 39 ConstantComposite 40 40 40 - 44: TypePointer Function 39 - 49: TypeVector 14(int) 3 - 50: TypePointer Function 49(ivec3) - 53: 17(int) Constant 1 - 54: TypeVector 17(int) 3 - 107: TypePointer Function 28(int) - 111: TypeVector 28(int) 3 - 114: 18(int) Constant 1 - 120: 18(int) Constant 2 - 128: TypeBool - 129: TypePointer Function 128(bool) - 131: 18(int) Constant 0 - 150: TypePointer Function 18(int) - 188: TypeVector 17(int) 2 - 189: TypePointer Function 188(ivec2) - 191: TypeVector 128(bool) 2 - 192: TypePointer Function 191(bvec2) - 195: 17(int) Constant 0 - 196: 188(ivec2) ConstantComposite 195 195 - 197: 188(ivec2) ConstantComposite 53 53 - 199: TypeVector 14(int) 2 - 200: TypePointer Function 199(ivec2) - 203: 14(int) Constant 0 - 204: 14(int) Constant 1 - 205: 199(ivec2) ConstantComposite 203 203 - 206: 199(ivec2) ConstantComposite 204 204 - 212: TypeVector 28(int) 2 - 213: TypePointer Function 212(ivec2) - 223: TypeVector 18(int) 2 - 226: TypePointer Function 223(ivec2) - 238: TypeFloat 32 - 239: TypeVector 238(float) 2 - 240: TypePointer Function 239(fvec2) - 250: TypeFloat 64 - 251: TypeVector 250(float) 2 - 252: TypePointer Function 251(fvec2) - 262: TypeFloat 16 - 263: TypeVector 262(float) 2 - 264: TypePointer Function 263(fvec2) - 274: TypeInt 64 1 - 275: TypeVector 274(int) 2 - 276: TypePointer Function 275(ivec2) - 286: TypeInt 64 0 - 287: TypeVector 286(int) 2 - 290: TypePointer Function 287(ivec2) - 317: 17(int) Constant 65535 - 318: 188(ivec2) ConstantComposite 317 317 - 327: 49(ivec3) ConstantComposite 203 203 203 - 369: 128(bool) ConstantTrue - 376: 128(bool) ConstantFalse - 377: 191(bvec2) ConstantComposite 376 376 - 389: TypeVector 128(bool) 3 - 390: 389(bvec3) ConstantComposite 376 376 376 - 392: TypeVector 262(float) 3 - 393: TypePointer Function 392(fvec3) - 396: TypePointer Function 54(ivec3) - 398(ResType): TypeStruct 392(fvec3) 54(ivec3) - 408: TypePointer Function 262(float) - 432: TypePointer Function 274(int) - 435: TypeVector 17(int) 4 - 441: TypePointer Function 286(int) - 444: TypeVector 14(int) 4 - 450: TypePointer Function 389(bvec3) - 516(Block): TypeStruct 54(ivec3) 14(int) - 517: TypePointer Uniform 516(Block) - 518(block): 517(ptr) Variable Uniform - 519: TypePointer Input 49(ivec3) - 520(iu16v): 519(ptr) Variable Input - 521: TypePointer Input 17(int) - 522(ii16): 521(ptr) Variable Input - 523(si64): 274(int) SpecConstant 4294967286 4294967295 - 524(su64): 286(int) SpecConstant 20 0 - 525(si): 28(int) SpecConstant 4294967291 - 526(su): 18(int) SpecConstant 4 - 527(sb): 128(bool) SpecConstantTrue - 528(si16): 17(int) SpecConstant 65531 - 529(su16): 14(int) SpecConstant 4 - 530: 128(bool) SpecConstantOp 171 528(si16) 203 - 531: 128(bool) SpecConstantOp 171 529(su16) 203 - 532: 17(int) SpecConstantOp 169 527(sb) 53 195 - 533: 14(int) SpecConstantOp 169 527(sb) 204 203 - 534: 28(int) SpecConstantOp 114 528(si16) - 535: 18(int) SpecConstantOp 113 529(su16) - 536: 28(int) SpecConstantOp 128 535 131 - 537: 17(int) SpecConstantOp 114 525(si) - 538: 17(int) SpecConstantOp 114 525(si) - 539: 14(int) SpecConstantOp 128 538 203 - 540: 28(int) SpecConstantOp 114 528(si16) - 541: 18(int) SpecConstantOp 128 540 131 - 542: 18(int) SpecConstantOp 113 529(su16) - 543: 14(int) SpecConstantOp 113 526(su) - 544: 17(int) SpecConstantOp 128 543 203 - 545: 14(int) SpecConstantOp 113 526(su) - 546: 274(int) SpecConstantOp 114 528(si16) - 547: 286(int) SpecConstantOp 113 529(su16) - 548: 286(int) Constant 0 0 - 549: 274(int) SpecConstantOp 128 547 548 - 550: 17(int) SpecConstantOp 114 523(si64) - 551: 17(int) SpecConstantOp 114 523(si64) - 552: 14(int) SpecConstantOp 128 551 203 - 553: 274(int) SpecConstantOp 114 528(si16) - 554: 286(int) SpecConstantOp 128 553 548 - 555: 286(int) SpecConstantOp 113 529(su16) - 556: 14(int) SpecConstantOp 113 524(su64) - 557: 17(int) SpecConstantOp 128 556 203 - 558: 14(int) SpecConstantOp 113 524(su64) - 559: 14(int) SpecConstantOp 128 528(si16) 203 - 560: 17(int) SpecConstantOp 128 529(su16) 203 + 14: TypeInt 16 1 + 15: TypePointer Function 14(int16_t) + 17: TypeInt 32 0 + 18: 17(int) Constant 3 + 19: TypeArray 14(int16_t) 18 + 20: 14(int16_t) Constant 4294962927 + 21: 14(int16_t) Constant 4294967295 + 22: 14(int16_t) Constant 16384 + 23: 19 ConstantComposite 20 21 22 + 24(Uniforms): TypeStruct 17(int) + 25: TypePointer Uniform 24(Uniforms) + 26: 25(ptr) Variable Uniform + 27: TypeInt 32 1 + 28: 27(int) Constant 0 + 29: TypePointer Uniform 17(int) + 32: TypePointer Function 19 + 36: TypeInt 16 0 + 37: TypePointer Function 36(int16_t) + 39: TypeArray 36(int16_t) 18 + 40: 36(int16_t) Constant 65535 + 41: 36(int16_t) Constant 32767 + 42: 39 ConstantComposite 40 40 41 + 45: TypePointer Function 39 + 49: TypeVector 27(int) 2 + 50: TypePointer Function 49(ivec2) + 52: TypeVector 14(int16_t) 2 + 53: TypePointer Function 52(i16vec2) + 57: TypeVector 36(int16_t) 2 + 58: TypePointer Function 57(i16vec2) + 61: TypeVector 17(int) 2 + 66: TypePointer Function 61(ivec2) + 71: TypeInt 64 1 + 72: TypeVector 71(int64_t) 2 + 73: TypePointer Function 72(i64vec2) + 77: TypeInt 64 0 + 78: TypeVector 77(int64_t) 2 + 79: TypePointer Function 78(i64vec2) + 91: TypeFloat 16 + 92: TypeVector 91(float16_t) 2 + 93: TypePointer Function 92(f16vec2) + 97: TypeFloat 32 + 98: TypeVector 97(float) 2 + 99: TypePointer Function 98(fvec2) + 103: TypeFloat 64 + 104: TypeVector 103(float64_t) 2 + 105: TypePointer Function 104(f64vec2) + 151: TypeInt 8 1 + 152: TypeVector 151(int8_t) 2 + 153: TypePointer Function 152(i8vec2) + 158: TypeInt 8 0 + 159: TypeVector 158(int8_t) 2 + 162: TypePointer Function 159(i8vec2) + 173: TypeBool + 174: TypeVector 173(bool) 2 + 175: TypePointer Function 174(bvec2) + 178: 14(int16_t) Constant 0 + 179: 14(int16_t) Constant 1 + 180: 52(i16vec2) ConstantComposite 178 178 + 181: 52(i16vec2) ConstantComposite 179 179 + 184: 36(int16_t) Constant 0 + 185: 36(int16_t) Constant 1 + 186: 57(i16vec2) ConstantComposite 184 184 + 187: 57(i16vec2) ConstantComposite 185 185 + 193: TypeVector 36(int16_t) 3 + 194: TypePointer Function 193(i16vec3) + 197: TypeVector 14(int16_t) 3 + 219: TypePointer Function 27(int) + 225: TypeVector 17(int) 3 + 226: TypePointer Function 225(ivec3) + 242: TypePointer Function 71(int64_t) + 264: 17(int) Constant 1 + 270: 17(int) Constant 2 + 276: TypeVector 27(int) 3 + 280: TypePointer Function 173(bool) + 282: 17(int) Constant 0 + 296: TypePointer Function 17(int) + 354: 52(i16vec2) ConstantComposite 21 21 + 363:193(i16vec3) ConstantComposite 184 184 184 + 405: 173(bool) ConstantTrue + 412: 173(bool) ConstantFalse + 413: 174(bvec2) ConstantComposite 412 412 + 425: TypeVector 173(bool) 3 + 426: 425(bvec3) ConstantComposite 412 412 412 + 432: TypeVector 14(int16_t) 4 + 433: TypePointer Function 432(i16vec4) + 441: TypePointer Function 77(int64_t) + 443: TypeVector 36(int16_t) 4 + 444: TypePointer Function 443(i16vec4) + 456: TypePointer Function 425(bvec3) + 518(Block): TypeStruct 14(int16_t) 52(i16vec2) 197(i16vec3) 432(i16vec4) 36(int16_t) 57(i16vec2) 193(i16vec3) 443(i16vec4) + 519: TypePointer Uniform 518(Block) + 520(block): 519(ptr) Variable Uniform + 521(si16): 14(int16_t) SpecConstant 4294967286 + 522(su16): 36(int16_t) SpecConstant 20 4(main): 2 Function None 3 5: Label - 512: 2 FunctionCall 6(literal() - 513: 2 FunctionCall 8(operators() - 514: 2 FunctionCall 10(typeCast() - 515: 2 FunctionCall 12(builtinFuncs() Return FunctionEnd 6(literal(): 2 Function None 3 7: Label - 16(u16): 15(ptr) Variable Function - 34(indexable): 33(ptr) Variable Function - 45(indexable): 44(ptr) Variable Function - 31: 30(ptr) AccessChain 27 29 - 32: 18(int) Load 31 - Store 34(indexable) 24 - 36: 35(ptr) AccessChain 34(indexable) 32 - 37: 17(int) Load 36 - 38: 14(int) Bitcast 37 - 42: 30(ptr) AccessChain 27 29 - 43: 18(int) Load 42 - Store 45(indexable) 41 - 46: 15(ptr) AccessChain 45(indexable) 43 - 47: 14(int) Load 46 - 48: 14(int) IAdd 38 47 - Store 16(u16) 48 + 16(i16): 15(ptr) Variable Function + 33(indexable): 32(ptr) Variable Function + 38(u16): 37(ptr) Variable Function + 46(indexable): 45(ptr) Variable Function + 30: 29(ptr) AccessChain 26 28 + 31: 17(int) Load 30 + Store 33(indexable) 23 + 34: 15(ptr) AccessChain 33(indexable) 31 + 35: 14(int16_t) Load 34 + Store 16(i16) 35 + 43: 29(ptr) AccessChain 26 28 + 44: 17(int) Load 43 + Store 46(indexable) 42 + 47: 37(ptr) AccessChain 46(indexable) 44 + 48: 36(int16_t) Load 47 + Store 38(u16) 48 Return FunctionEnd - 8(operators(): 2 Function None 3 + 8(typeCast16(): 2 Function None 3 9: Label - 51(u16v): 50(ptr) Variable Function - 57(i16): 35(ptr) Variable Function - 70(u16): 15(ptr) Variable Function - 108(i): 107(ptr) Variable Function - 130(b): 129(ptr) Variable Function - 151(u): 150(ptr) Variable Function - 52: 49(ivec3) Load 51(u16v) - 55: 54(ivec3) CompositeConstruct 53 53 53 - 56: 49(ivec3) IAdd 52 55 - Store 51(u16v) 56 - 58: 17(int) Load 57(i16) - 59: 17(int) ISub 58 53 - Store 57(i16) 59 - 60: 17(int) Load 57(i16) - 61: 17(int) IAdd 60 53 - Store 57(i16) 61 - 62: 49(ivec3) Load 51(u16v) - 63: 54(ivec3) CompositeConstruct 53 53 53 - 64: 49(ivec3) ISub 62 63 - Store 51(u16v) 64 - 65: 49(ivec3) Load 51(u16v) - 66: 49(ivec3) Not 65 - Store 51(u16v) 66 - 67: 17(int) Load 57(i16) - Store 57(i16) 67 - 68: 49(ivec3) Load 51(u16v) - 69: 49(ivec3) SNegate 68 - Store 51(u16v) 69 - 71: 17(int) Load 57(i16) - 72: 14(int) Bitcast 71 - 73: 14(int) Load 70(u16) - 74: 14(int) IAdd 73 72 - Store 70(u16) 74 - 75: 49(ivec3) Load 51(u16v) - 76: 49(ivec3) Load 51(u16v) - 77: 49(ivec3) ISub 76 75 - Store 51(u16v) 77 - 78: 17(int) Load 57(i16) - 79: 17(int) Load 57(i16) - 80: 17(int) IMul 79 78 - Store 57(i16) 80 - 81: 49(ivec3) Load 51(u16v) - 82: 49(ivec3) Load 51(u16v) - 83: 49(ivec3) UDiv 82 81 - Store 51(u16v) 83 - 84: 17(int) Load 57(i16) - 85: 14(int) Bitcast 84 - 86: 49(ivec3) Load 51(u16v) - 87: 49(ivec3) CompositeConstruct 85 85 85 - 88: 49(ivec3) UMod 86 87 - Store 51(u16v) 88 - 89: 49(ivec3) Load 51(u16v) - 90: 49(ivec3) Load 51(u16v) - 91: 49(ivec3) IAdd 89 90 - Store 51(u16v) 91 - 92: 17(int) Load 57(i16) - 93: 14(int) Bitcast 92 - 94: 14(int) Load 70(u16) - 95: 14(int) ISub 93 94 - Store 70(u16) 95 - 96: 49(ivec3) Load 51(u16v) - 97: 17(int) Load 57(i16) - 98: 14(int) Bitcast 97 - 99: 49(ivec3) CompositeConstruct 98 98 98 - 100: 49(ivec3) IMul 96 99 - Store 51(u16v) 100 - 101: 17(int) Load 57(i16) - 102: 17(int) Load 57(i16) - 103: 17(int) IMul 101 102 - Store 57(i16) 103 - 104: 17(int) Load 57(i16) - 105: 17(int) Load 57(i16) - 106: 17(int) SMod 104 105 - Store 57(i16) 106 - 109: 28(int) Load 108(i) - 110: 49(ivec3) Load 51(u16v) - 112: 111(ivec3) CompositeConstruct 109 109 109 - 113: 49(ivec3) ShiftLeftLogical 110 112 - Store 51(u16v) 113 - 115: 15(ptr) AccessChain 51(u16v) 114 - 116: 14(int) Load 115 - 117: 17(int) Load 57(i16) - 118: 17(int) ShiftRightArithmetic 117 116 - Store 57(i16) 118 - 119: 17(int) Load 57(i16) - 121: 15(ptr) AccessChain 51(u16v) 120 - 122: 14(int) Load 121 - 123: 17(int) ShiftLeftLogical 119 122 - Store 57(i16) 123 - 124: 49(ivec3) Load 51(u16v) - 125: 17(int) Load 57(i16) - 126: 54(ivec3) CompositeConstruct 125 125 125 - 127: 49(ivec3) ShiftLeftLogical 124 126 - Store 51(u16v) 127 - 132: 15(ptr) AccessChain 51(u16v) 131 - 133: 14(int) Load 132 - 134: 17(int) Load 57(i16) - 135: 14(int) Bitcast 134 - 136: 128(bool) INotEqual 133 135 - Store 130(b) 136 - 137: 17(int) Load 57(i16) - 138: 14(int) Bitcast 137 - 139: 15(ptr) AccessChain 51(u16v) 131 - 140: 14(int) Load 139 - 141: 128(bool) IEqual 138 140 - Store 130(b) 141 - 142: 15(ptr) AccessChain 51(u16v) 131 - 143: 14(int) Load 142 - 144: 15(ptr) AccessChain 51(u16v) 114 - 145: 14(int) Load 144 - 146: 128(bool) UGreaterThan 143 145 - Store 130(b) 146 - 147: 17(int) Load 57(i16) - 148: 28(int) SConvert 147 - 149: 18(int) Bitcast 148 - 152: 18(int) Load 151(u) - 153: 128(bool) ULessThan 149 152 - Store 130(b) 153 - 154: 15(ptr) AccessChain 51(u16v) 114 - 155: 14(int) Load 154 - 156: 15(ptr) AccessChain 51(u16v) 131 - 157: 14(int) Load 156 - 158: 128(bool) UGreaterThanEqual 155 157 - Store 130(b) 158 - 159: 17(int) Load 57(i16) - 160: 28(int) SConvert 159 - 161: 28(int) Load 108(i) - 162: 128(bool) SLessThanEqual 160 161 - Store 130(b) 162 - 163: 17(int) Load 57(i16) - 164: 14(int) Bitcast 163 - 165: 49(ivec3) Load 51(u16v) - 166: 49(ivec3) CompositeConstruct 164 164 164 - 167: 49(ivec3) BitwiseOr 165 166 - Store 51(u16v) 167 - 168: 17(int) Load 57(i16) - 169: 14(int) Bitcast 168 - 170: 14(int) Load 70(u16) - 171: 14(int) BitwiseOr 169 170 - Store 70(u16) 171 - 172: 17(int) Load 57(i16) - 173: 17(int) Load 57(i16) - 174: 17(int) BitwiseAnd 173 172 - Store 57(i16) 174 - 175: 49(ivec3) Load 51(u16v) - 176: 49(ivec3) Load 51(u16v) - 177: 49(ivec3) BitwiseAnd 175 176 - Store 51(u16v) 177 - 178: 17(int) Load 57(i16) - 179: 14(int) Bitcast 178 - 180: 49(ivec3) Load 51(u16v) - 181: 49(ivec3) CompositeConstruct 179 179 179 - 182: 49(ivec3) BitwiseXor 180 181 - Store 51(u16v) 182 - 183: 49(ivec3) Load 51(u16v) - 184: 17(int) Load 57(i16) - 185: 14(int) Bitcast 184 - 186: 49(ivec3) CompositeConstruct 185 185 185 - 187: 49(ivec3) BitwiseXor 183 186 - Store 51(u16v) 187 + 51(i32v): 50(ptr) Variable Function + 54(i16v): 53(ptr) Variable Function + 59(u16v): 58(ptr) Variable Function + 67(u32v): 66(ptr) Variable Function + 74(i64v): 73(ptr) Variable Function + 80(u64v): 79(ptr) Variable Function + 94(f16v): 93(ptr) Variable Function + 100(f32v): 99(ptr) Variable Function + 106(f64v): 105(ptr) Variable Function + 154(i8v): 153(ptr) Variable Function + 163(u8v): 162(ptr) Variable Function + 176(bv): 175(ptr) Variable Function + 55: 52(i16vec2) Load 54(i16v) + 56: 49(ivec2) SConvert 55 + Store 51(i32v) 56 + 60: 57(i16vec2) Load 59(u16v) + 62: 61(ivec2) UConvert 60 + 63: 49(ivec2) Bitcast 62 + Store 51(i32v) 63 + 64: 52(i16vec2) Load 54(i16v) + 65: 57(i16vec2) Bitcast 64 + Store 59(u16v) 65 + 68: 52(i16vec2) Load 54(i16v) + 69: 49(ivec2) SConvert 68 + 70: 61(ivec2) Bitcast 69 + Store 67(u32v) 70 + 75: 52(i16vec2) Load 54(i16v) + 76: 72(i64vec2) SConvert 75 + Store 74(i64v) 76 + 81: 52(i16vec2) Load 54(i16v) + 82: 72(i64vec2) SConvert 81 + 83: 78(i64vec2) Bitcast 82 + Store 80(u64v) 83 + 84: 57(i16vec2) Load 59(u16v) + 85: 61(ivec2) UConvert 84 + Store 67(u32v) 85 + 86: 57(i16vec2) Load 59(u16v) + 87: 78(i64vec2) UConvert 86 + 88: 72(i64vec2) Bitcast 87 + Store 74(i64v) 88 + 89: 57(i16vec2) Load 59(u16v) + 90: 78(i64vec2) UConvert 89 + Store 80(u64v) 90 + 95: 52(i16vec2) Load 54(i16v) + 96: 92(f16vec2) ConvertSToF 95 + Store 94(f16v) 96 + 101: 52(i16vec2) Load 54(i16v) + 102: 98(fvec2) ConvertSToF 101 + Store 100(f32v) 102 + 107: 52(i16vec2) Load 54(i16v) + 108:104(f64vec2) ConvertSToF 107 + Store 106(f64v) 108 + 109: 57(i16vec2) Load 59(u16v) + 110: 92(f16vec2) ConvertUToF 109 + Store 94(f16v) 110 + 111: 57(i16vec2) Load 59(u16v) + 112: 98(fvec2) ConvertUToF 111 + Store 100(f32v) 112 + 113: 57(i16vec2) Load 59(u16v) + 114:104(f64vec2) ConvertUToF 113 + Store 106(f64v) 114 + 115: 52(i16vec2) Load 54(i16v) + 116: 49(ivec2) SConvert 115 + Store 51(i32v) 116 + 117: 57(i16vec2) Load 59(u16v) + 118: 61(ivec2) UConvert 117 + 119: 49(ivec2) Bitcast 118 + Store 51(i32v) 119 + 120: 52(i16vec2) Load 54(i16v) + 121: 57(i16vec2) Bitcast 120 + Store 59(u16v) 121 + 122: 52(i16vec2) Load 54(i16v) + 123: 49(ivec2) SConvert 122 + 124: 61(ivec2) Bitcast 123 + Store 67(u32v) 124 + 125: 52(i16vec2) Load 54(i16v) + 126: 72(i64vec2) SConvert 125 + Store 74(i64v) 126 + 127: 52(i16vec2) Load 54(i16v) + 128: 72(i64vec2) SConvert 127 + 129: 78(i64vec2) Bitcast 128 + Store 80(u64v) 129 + 130: 57(i16vec2) Load 59(u16v) + 131: 61(ivec2) UConvert 130 + Store 67(u32v) 131 + 132: 57(i16vec2) Load 59(u16v) + 133: 78(i64vec2) UConvert 132 + 134: 72(i64vec2) Bitcast 133 + Store 74(i64v) 134 + 135: 57(i16vec2) Load 59(u16v) + 136: 78(i64vec2) UConvert 135 + 137: 72(i64vec2) Bitcast 136 + 138: 78(i64vec2) Bitcast 137 + Store 80(u64v) 138 + 139: 52(i16vec2) Load 54(i16v) + 140: 92(f16vec2) ConvertSToF 139 + Store 94(f16v) 140 + 141: 52(i16vec2) Load 54(i16v) + 142: 98(fvec2) ConvertSToF 141 + Store 100(f32v) 142 + 143: 52(i16vec2) Load 54(i16v) + 144:104(f64vec2) ConvertSToF 143 + Store 106(f64v) 144 + 145: 57(i16vec2) Load 59(u16v) + 146: 92(f16vec2) ConvertUToF 145 + Store 94(f16v) 146 + 147: 57(i16vec2) Load 59(u16v) + 148: 98(fvec2) ConvertUToF 147 + Store 100(f32v) 148 + 149: 57(i16vec2) Load 59(u16v) + 150:104(f64vec2) ConvertUToF 149 + Store 106(f64v) 150 + 155: 52(i16vec2) Load 54(i16v) + 156: 152(i8vec2) SConvert 155 + Store 154(i8v) 156 + 157: 57(i16vec2) Load 59(u16v) + 160: 159(i8vec2) UConvert 157 + 161: 152(i8vec2) Bitcast 160 + Store 154(i8v) 161 + 164: 52(i16vec2) Load 54(i16v) + 165: 152(i8vec2) SConvert 164 + 166: 159(i8vec2) Bitcast 165 + Store 163(u8v) 166 + 167: 57(i16vec2) Load 59(u16v) + 168: 159(i8vec2) UConvert 167 + Store 163(u8v) 168 + 169: 57(i16vec2) Load 59(u16v) + 170: 159(i8vec2) UConvert 169 + 171: 57(i16vec2) UConvert 170 + 172: 52(i16vec2) Bitcast 171 + Store 54(i16v) 172 + 177: 174(bvec2) Load 176(bv) + 182: 52(i16vec2) Select 177 181 180 + Store 54(i16v) 182 + 183: 174(bvec2) Load 176(bv) + 188: 57(i16vec2) Select 183 187 186 + Store 59(u16v) 188 + 189: 52(i16vec2) Load 54(i16v) + 190: 174(bvec2) INotEqual 189 186 + Store 176(bv) 190 + 191: 57(i16vec2) Load 59(u16v) + 192: 174(bvec2) INotEqual 191 186 + Store 176(bv) 192 Return FunctionEnd - 10(typeCast(): 2 Function None 3 + 10(operators(): 2 Function None 3 11: Label - 190(i16v): 189(ptr) Variable Function - 193(bv): 192(ptr) Variable Function - 201(u16v): 200(ptr) Variable Function - 214(iv): 213(ptr) Variable Function + 195(u16v): 194(ptr) Variable Function + 200(i16): 15(ptr) Variable Function + 220(i): 219(ptr) Variable Function 227(uv): 226(ptr) Variable Function - 241(fv): 240(ptr) Variable Function - 253(dv): 252(ptr) Variable Function - 265(f16v): 264(ptr) Variable Function - 277(i64v): 276(ptr) Variable Function - 291(u64v): 290(ptr) Variable Function - 194: 191(bvec2) Load 193(bv) - 198: 188(ivec2) Select 194 197 196 - Store 190(i16v) 198 - 202: 191(bvec2) Load 193(bv) - 207: 199(ivec2) Select 202 206 205 - Store 201(u16v) 207 - 208: 188(ivec2) Load 190(i16v) - 209: 191(bvec2) INotEqual 208 205 - Store 193(bv) 209 - 210: 199(ivec2) Load 201(u16v) - 211: 191(bvec2) INotEqual 210 205 - Store 193(bv) 211 - 215: 212(ivec2) Load 214(iv) - 216: 188(ivec2) SConvert 215 - Store 190(i16v) 216 - 217: 212(ivec2) Load 214(iv) - 218: 188(ivec2) SConvert 217 - 219: 199(ivec2) Bitcast 218 - Store 201(u16v) 219 - 220: 188(ivec2) Load 190(i16v) - 221: 212(ivec2) SConvert 220 - Store 214(iv) 221 - 222: 199(ivec2) Load 201(u16v) - 224: 223(ivec2) UConvert 222 - 225: 212(ivec2) Bitcast 224 - Store 214(iv) 225 - 228: 223(ivec2) Load 227(uv) - 229: 199(ivec2) UConvert 228 - 230: 188(ivec2) Bitcast 229 - Store 190(i16v) 230 - 231: 223(ivec2) Load 227(uv) - 232: 199(ivec2) UConvert 231 - Store 201(u16v) 232 - 233: 188(ivec2) Load 190(i16v) - 234: 212(ivec2) SConvert 233 - 235: 223(ivec2) Bitcast 234 - Store 227(uv) 235 - 236: 199(ivec2) Load 201(u16v) - 237: 223(ivec2) UConvert 236 + 243(i64): 242(ptr) Variable Function + 281(b): 280(ptr) Variable Function + 196:193(i16vec3) Load 195(u16v) + 198:197(i16vec3) CompositeConstruct 179 179 179 + 199:193(i16vec3) IAdd 196 198 + Store 195(u16v) 199 + 201: 14(int16_t) Load 200(i16) + 202: 14(int16_t) ISub 201 179 + Store 200(i16) 202 + 203: 14(int16_t) Load 200(i16) + 204: 14(int16_t) IAdd 203 179 + Store 200(i16) 204 + 205:193(i16vec3) Load 195(u16v) + 206:197(i16vec3) CompositeConstruct 179 179 179 + 207:193(i16vec3) ISub 205 206 + Store 195(u16v) 207 + 208:193(i16vec3) Load 195(u16v) + 209:193(i16vec3) Not 208 + Store 195(u16v) 209 + 210: 14(int16_t) Load 200(i16) + Store 200(i16) 210 + 211:193(i16vec3) Load 195(u16v) + 212:193(i16vec3) SNegate 211 + Store 195(u16v) 212 + 213: 14(int16_t) Load 200(i16) + 214: 14(int16_t) Load 200(i16) + 215: 14(int16_t) IAdd 214 213 + Store 200(i16) 215 + 216:193(i16vec3) Load 195(u16v) + 217:193(i16vec3) Load 195(u16v) + 218:193(i16vec3) ISub 217 216 + Store 195(u16v) 218 + 221: 14(int16_t) Load 200(i16) + 222: 27(int) SConvert 221 + 223: 27(int) Load 220(i) + 224: 27(int) IMul 223 222 + Store 220(i) 224 + 228:193(i16vec3) Load 195(u16v) + 229: 225(ivec3) UConvert 228 + 230: 225(ivec3) Load 227(uv) + 231: 225(ivec3) UDiv 230 229 + Store 227(uv) 231 + 232: 14(int16_t) Load 200(i16) + 233: 27(int) SConvert 232 + 234: 17(int) Bitcast 233 + 235: 225(ivec3) Load 227(uv) + 236: 225(ivec3) CompositeConstruct 234 234 234 + 237: 225(ivec3) UMod 235 236 Store 227(uv) 237 - 242: 239(fvec2) Load 241(fv) - 243: 188(ivec2) ConvertFToS 242 - Store 190(i16v) 243 - 244: 239(fvec2) Load 241(fv) - 245: 199(ivec2) ConvertFToU 244 - Store 201(u16v) 245 - 246: 188(ivec2) Load 190(i16v) - 247: 239(fvec2) ConvertSToF 246 - Store 241(fv) 247 - 248: 199(ivec2) Load 201(u16v) - 249: 239(fvec2) ConvertUToF 248 - Store 241(fv) 249 - 254: 251(fvec2) Load 253(dv) - 255: 188(ivec2) ConvertFToS 254 - Store 190(i16v) 255 - 256: 251(fvec2) Load 253(dv) - 257: 199(ivec2) ConvertFToU 256 - Store 201(u16v) 257 - 258: 188(ivec2) Load 190(i16v) - 259: 251(fvec2) ConvertSToF 258 - Store 253(dv) 259 - 260: 199(ivec2) Load 201(u16v) - 261: 251(fvec2) ConvertUToF 260 - Store 253(dv) 261 - 266: 263(fvec2) Load 265(f16v) - 267: 188(ivec2) ConvertFToS 266 - Store 190(i16v) 267 - 268: 263(fvec2) Load 265(f16v) - 269: 199(ivec2) ConvertFToU 268 - Store 201(u16v) 269 - 270: 188(ivec2) Load 190(i16v) - 271: 263(fvec2) ConvertSToF 270 - Store 265(f16v) 271 - 272: 199(ivec2) Load 201(u16v) - 273: 263(fvec2) ConvertUToF 272 - Store 265(f16v) 273 - 278: 275(ivec2) Load 277(i64v) - 279: 188(ivec2) SConvert 278 - Store 190(i16v) 279 - 280: 275(ivec2) Load 277(i64v) - 281: 188(ivec2) SConvert 280 - 282: 199(ivec2) Bitcast 281 - Store 201(u16v) 282 - 283: 188(ivec2) Load 190(i16v) - 284: 275(ivec2) SConvert 283 - Store 277(i64v) 284 - 285: 199(ivec2) Load 201(u16v) - 288: 287(ivec2) UConvert 285 - 289: 275(ivec2) Bitcast 288 - Store 277(i64v) 289 - 292: 287(ivec2) Load 291(u64v) - 293: 199(ivec2) UConvert 292 - 294: 188(ivec2) Bitcast 293 - Store 190(i16v) 294 - 295: 287(ivec2) Load 291(u64v) - 296: 199(ivec2) UConvert 295 - Store 201(u16v) 296 - 297: 188(ivec2) Load 190(i16v) - 298: 275(ivec2) SConvert 297 - 299: 287(ivec2) Bitcast 298 - Store 291(u64v) 299 - 300: 199(ivec2) Load 201(u16v) - 301: 287(ivec2) UConvert 300 - Store 291(u64v) 301 - 302: 199(ivec2) Load 201(u16v) - 303: 188(ivec2) Bitcast 302 - Store 190(i16v) 303 - 304: 188(ivec2) Load 190(i16v) - 305: 199(ivec2) Bitcast 304 - Store 201(u16v) 305 + 238:193(i16vec3) Load 195(u16v) + 239: 225(ivec3) UConvert 238 + 240: 225(ivec3) Load 227(uv) + 241: 225(ivec3) IAdd 239 240 + Store 227(uv) 241 + 244: 14(int16_t) Load 200(i16) + 245: 71(int64_t) SConvert 244 + 246: 71(int64_t) Load 243(i64) + 247: 71(int64_t) ISub 245 246 + Store 243(i64) 247 + 248:193(i16vec3) Load 195(u16v) + 249: 225(ivec3) UConvert 248 + 250: 225(ivec3) Load 227(uv) + 251: 225(ivec3) IMul 249 250 + Store 227(uv) 251 + 252: 14(int16_t) Load 200(i16) + 253: 71(int64_t) SConvert 252 + 254: 71(int64_t) Load 243(i64) + 255: 71(int64_t) IMul 253 254 + Store 243(i64) 255 + 256: 14(int16_t) Load 200(i16) + 257: 27(int) SConvert 256 + 258: 27(int) Load 220(i) + 259: 27(int) SMod 257 258 + Store 220(i) 259 + 260: 14(int16_t) Load 200(i16) + 261:193(i16vec3) Load 195(u16v) + 262:197(i16vec3) CompositeConstruct 260 260 260 + 263:193(i16vec3) ShiftLeftLogical 261 262 + Store 195(u16v) 263 + 265: 37(ptr) AccessChain 195(u16v) 264 + 266: 36(int16_t) Load 265 + 267: 14(int16_t) Load 200(i16) + 268: 14(int16_t) ShiftRightArithmetic 267 266 + Store 200(i16) 268 + 269: 14(int16_t) Load 200(i16) + 271: 37(ptr) AccessChain 195(u16v) 270 + 272: 36(int16_t) Load 271 + 273: 14(int16_t) ShiftLeftLogical 269 272 + Store 200(i16) 273 + 274:193(i16vec3) Load 195(u16v) + 275: 27(int) Load 220(i) + 277: 276(ivec3) CompositeConstruct 275 275 275 + 278:193(i16vec3) ShiftLeftLogical 274 277 + 279: 225(ivec3) UConvert 278 + Store 227(uv) 279 + 283: 37(ptr) AccessChain 195(u16v) 282 + 284: 36(int16_t) Load 283 + 285: 14(int16_t) Load 200(i16) + 286: 36(int16_t) Bitcast 285 + 287: 173(bool) INotEqual 284 286 + Store 281(b) 287 + 288: 14(int16_t) Load 200(i16) + 289: 36(int16_t) Bitcast 288 + 290: 37(ptr) AccessChain 195(u16v) 282 + 291: 36(int16_t) Load 290 + 292: 173(bool) IEqual 289 291 + Store 281(b) 292 + 293: 37(ptr) AccessChain 195(u16v) 282 + 294: 36(int16_t) Load 293 + 295: 17(int) UConvert 294 + 297: 296(ptr) AccessChain 227(uv) 264 + 298: 17(int) Load 297 + 299: 173(bool) UGreaterThan 295 298 + Store 281(b) 299 + 300: 14(int16_t) Load 200(i16) + 301: 27(int) SConvert 300 + 302: 27(int) Load 220(i) + 303: 173(bool) SLessThan 301 302 + Store 281(b) 303 + 304: 37(ptr) AccessChain 195(u16v) 264 + 305: 36(int16_t) Load 304 + 306: 17(int) UConvert 305 + 307: 296(ptr) AccessChain 227(uv) 282 + 308: 17(int) Load 307 + 309: 173(bool) UGreaterThanEqual 306 308 + Store 281(b) 309 + 310: 14(int16_t) Load 200(i16) + 311: 27(int) SConvert 310 + 312: 27(int) Load 220(i) + 313: 173(bool) SLessThanEqual 311 312 + Store 281(b) 313 + 314: 14(int16_t) Load 200(i16) + 315: 27(int) SConvert 314 + 316: 17(int) Bitcast 315 + 317: 225(ivec3) Load 227(uv) + 318: 225(ivec3) CompositeConstruct 316 316 316 + 319: 225(ivec3) BitwiseOr 317 318 + Store 227(uv) 319 + 320: 14(int16_t) Load 200(i16) + 321: 27(int) SConvert 320 + 322: 27(int) Load 220(i) + 323: 27(int) BitwiseOr 321 322 + Store 220(i) 323 + 324: 14(int16_t) Load 200(i16) + 325: 71(int64_t) SConvert 324 + 326: 71(int64_t) Load 243(i64) + 327: 71(int64_t) BitwiseAnd 326 325 + Store 243(i64) 327 + 328:193(i16vec3) Load 195(u16v) + 329: 225(ivec3) UConvert 328 + 330: 225(ivec3) Load 227(uv) + 331: 225(ivec3) BitwiseAnd 329 330 + Store 227(uv) 331 + 332: 14(int16_t) Load 200(i16) + 333: 27(int) SConvert 332 + 334: 17(int) Bitcast 333 + 335: 225(ivec3) Load 227(uv) + 336: 225(ivec3) CompositeConstruct 334 334 334 + 337: 225(ivec3) BitwiseXor 335 336 + Store 227(uv) 337 + 338:193(i16vec3) Load 195(u16v) + 339: 14(int16_t) Load 200(i16) + 340: 36(int16_t) Bitcast 339 + 341:193(i16vec3) CompositeConstruct 340 340 340 + 342:193(i16vec3) BitwiseXor 338 341 + Store 195(u16v) 342 Return FunctionEnd 12(builtinFuncs(): 2 Function None 3 13: Label - 306(i16v): 189(ptr) Variable Function - 312(i16): 35(ptr) Variable Function - 320(u16v): 50(ptr) Variable Function - 322(u16): 15(ptr) Variable Function - 394(f16v): 393(ptr) Variable Function - 397(exp): 396(ptr) Variable Function - 419(packi): 107(ptr) Variable Function - 424(packu): 150(ptr) Variable Function - 433(packi64): 432(ptr) Variable Function - 442(packu64): 441(ptr) Variable Function - 451(bv): 450(ptr) Variable Function - 307: 188(ivec2) Load 306(i16v) - 308: 188(ivec2) ExtInst 1(GLSL.std.450) 5(SAbs) 307 - Store 306(i16v) 308 - 309: 188(ivec2) Load 306(i16v) - 310: 188(ivec2) ExtInst 1(GLSL.std.450) 7(SSign) 309 - Store 306(i16v) 310 - 311: 188(ivec2) Load 306(i16v) - 313: 17(int) Load 312(i16) - 314: 188(ivec2) CompositeConstruct 313 313 - 315: 188(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 311 314 - Store 306(i16v) 315 - 316: 188(ivec2) Load 306(i16v) - 319: 188(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 316 318 - Store 306(i16v) 319 - 321: 49(ivec3) Load 320(u16v) - 323: 14(int) Load 322(u16) - 324: 49(ivec3) CompositeConstruct 323 323 323 - 325: 49(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 321 324 - Store 320(u16v) 325 - 326: 49(ivec3) Load 320(u16v) - 328: 49(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 326 327 - Store 320(u16v) 328 - 329: 188(ivec2) Load 306(i16v) - 330: 17(int) Load 312(i16) - 331: 188(ivec2) CompositeConstruct 330 330 - 332: 188(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 329 331 - Store 306(i16v) 332 - 333: 188(ivec2) Load 306(i16v) - 334: 188(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 333 318 - Store 306(i16v) 334 - 335: 49(ivec3) Load 320(u16v) - 336: 14(int) Load 322(u16) - 337: 49(ivec3) CompositeConstruct 336 336 336 - 338: 49(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 335 337 - Store 320(u16v) 338 - 339: 49(ivec3) Load 320(u16v) - 340: 49(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 339 327 - Store 320(u16v) 340 - 341: 188(ivec2) Load 306(i16v) - 342: 17(int) Load 312(i16) - 343: 17(int) SNegate 342 - 344: 17(int) Load 312(i16) - 345: 188(ivec2) CompositeConstruct 343 343 - 346: 188(ivec2) CompositeConstruct 344 344 - 347: 188(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 341 345 346 - Store 306(i16v) 347 - 348: 188(ivec2) Load 306(i16v) - 349: 188(ivec2) Load 306(i16v) - 350: 188(ivec2) SNegate 349 - 351: 188(ivec2) Load 306(i16v) - 352: 188(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 348 350 351 - Store 306(i16v) 352 - 353: 49(ivec3) Load 320(u16v) - 354: 14(int) Load 322(u16) - 355: 14(int) SNegate 354 - 356: 14(int) Load 322(u16) - 357: 49(ivec3) CompositeConstruct 355 355 355 - 358: 49(ivec3) CompositeConstruct 356 356 356 - 359: 49(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 353 357 358 - Store 320(u16v) 359 - 360: 49(ivec3) Load 320(u16v) - 361: 49(ivec3) Load 320(u16v) - 362: 49(ivec3) SNegate 361 - 363: 49(ivec3) Load 320(u16v) - 364: 49(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 360 362 363 - Store 320(u16v) 364 - 365: 35(ptr) AccessChain 306(i16v) 131 - 366: 17(int) Load 365 - 367: 35(ptr) AccessChain 306(i16v) 114 - 368: 17(int) Load 367 - 370: 17(int) Select 369 368 366 - Store 312(i16) 370 - 371: 17(int) Load 312(i16) - 372: 188(ivec2) CompositeConstruct 371 371 - 373: 17(int) Load 312(i16) - 374: 17(int) SNegate 373 - 375: 188(ivec2) CompositeConstruct 374 374 - 378: 188(ivec2) Select 377 375 372 - Store 306(i16v) 378 - 379: 15(ptr) AccessChain 320(u16v) 131 - 380: 14(int) Load 379 - 381: 15(ptr) AccessChain 320(u16v) 114 - 382: 14(int) Load 381 - 383: 14(int) Select 369 382 380 - Store 322(u16) 383 - 384: 14(int) Load 322(u16) - 385: 49(ivec3) CompositeConstruct 384 384 384 - 386: 14(int) Load 322(u16) - 387: 14(int) SNegate 386 - 388: 49(ivec3) CompositeConstruct 387 387 387 - 391: 49(ivec3) Select 390 388 385 - Store 320(u16v) 391 - 395: 392(fvec3) Load 394(f16v) - 399:398(ResType) ExtInst 1(GLSL.std.450) 52(FrexpStruct) 395 - 400: 54(ivec3) CompositeExtract 399 1 - Store 397(exp) 400 - 401: 392(fvec3) CompositeExtract 399 0 - Store 394(f16v) 401 - 402: 392(fvec3) Load 394(f16v) - 403: 54(ivec3) Load 397(exp) - 404: 392(fvec3) ExtInst 1(GLSL.std.450) 53(Ldexp) 402 403 - Store 394(f16v) 404 - 405: 392(fvec3) Load 394(f16v) - 406: 263(fvec2) VectorShuffle 405 405 0 1 - 407: 188(ivec2) Bitcast 406 - Store 306(i16v) 407 - 409: 408(ptr) AccessChain 394(f16v) 120 - 410: 262(float) Load 409 - 411: 14(int) Bitcast 410 - 412: 15(ptr) AccessChain 320(u16v) 131 - Store 412 411 - 413: 188(ivec2) Load 306(i16v) - 414: 263(fvec2) Bitcast 413 - 415: 392(fvec3) Load 394(f16v) - 416: 392(fvec3) VectorShuffle 415 414 3 4 2 - Store 394(f16v) 416 - 417: 49(ivec3) Load 320(u16v) - 418: 392(fvec3) Bitcast 417 - Store 394(f16v) 418 - 420: 188(ivec2) Load 306(i16v) - 421: 28(int) Bitcast 420 - Store 419(packi) 421 - 422: 28(int) Load 419(packi) - 423: 188(ivec2) Bitcast 422 - Store 306(i16v) 423 - 425: 49(ivec3) Load 320(u16v) - 426: 199(ivec2) VectorShuffle 425 425 0 1 - 427: 18(int) Bitcast 426 - Store 424(packu) 427 - 428: 18(int) Load 424(packu) - 429: 199(ivec2) Bitcast 428 - 430: 49(ivec3) Load 320(u16v) - 431: 49(ivec3) VectorShuffle 430 429 3 4 2 - Store 320(u16v) 431 - 434: 17(int) Load 312(i16) - 436: 435(ivec4) CompositeConstruct 434 434 434 434 - 437: 274(int) Bitcast 436 - Store 433(packi64) 437 - 438: 274(int) Load 433(packi64) - 439: 435(ivec4) Bitcast 438 - 440: 188(ivec2) VectorShuffle 439 439 0 1 - Store 306(i16v) 440 - 443: 14(int) Load 322(u16) - 445: 444(ivec4) CompositeConstruct 443 443 443 443 - 446: 286(int) Bitcast 445 - Store 442(packu64) 446 - 447: 286(int) Load 442(packu64) - 448: 444(ivec4) Bitcast 447 - 449: 49(ivec3) VectorShuffle 448 448 0 1 2 - Store 320(u16v) 449 - 452: 49(ivec3) Load 320(u16v) - 453: 14(int) Load 322(u16) - 454: 49(ivec3) CompositeConstruct 453 453 453 - 455: 389(bvec3) ULessThan 452 454 - Store 451(bv) 455 - 456: 188(ivec2) Load 306(i16v) - 457: 17(int) Load 312(i16) - 458: 188(ivec2) CompositeConstruct 457 457 - 459: 191(bvec2) SLessThan 456 458 - 460: 389(bvec3) Load 451(bv) - 461: 389(bvec3) VectorShuffle 460 459 3 4 2 - Store 451(bv) 461 - 462: 49(ivec3) Load 320(u16v) - 463: 14(int) Load 322(u16) - 464: 49(ivec3) CompositeConstruct 463 463 463 - 465: 389(bvec3) ULessThanEqual 462 464 - Store 451(bv) 465 - 466: 188(ivec2) Load 306(i16v) - 467: 17(int) Load 312(i16) - 468: 188(ivec2) CompositeConstruct 467 467 - 469: 191(bvec2) SLessThanEqual 466 468 - 470: 389(bvec3) Load 451(bv) - 471: 389(bvec3) VectorShuffle 470 469 3 4 2 - Store 451(bv) 471 - 472: 49(ivec3) Load 320(u16v) - 473: 14(int) Load 322(u16) - 474: 49(ivec3) CompositeConstruct 473 473 473 - 475: 389(bvec3) UGreaterThan 472 474 - Store 451(bv) 475 - 476: 188(ivec2) Load 306(i16v) - 477: 17(int) Load 312(i16) - 478: 188(ivec2) CompositeConstruct 477 477 - 479: 191(bvec2) SGreaterThan 476 478 - 480: 389(bvec3) Load 451(bv) - 481: 389(bvec3) VectorShuffle 480 479 3 4 2 - Store 451(bv) 481 - 482: 49(ivec3) Load 320(u16v) - 483: 14(int) Load 322(u16) - 484: 49(ivec3) CompositeConstruct 483 483 483 - 485: 389(bvec3) UGreaterThanEqual 482 484 - Store 451(bv) 485 - 486: 188(ivec2) Load 306(i16v) - 487: 17(int) Load 312(i16) - 488: 188(ivec2) CompositeConstruct 487 487 - 489: 191(bvec2) SGreaterThanEqual 486 488 - 490: 389(bvec3) Load 451(bv) - 491: 389(bvec3) VectorShuffle 490 489 3 4 2 - Store 451(bv) 491 - 492: 49(ivec3) Load 320(u16v) - 493: 14(int) Load 322(u16) - 494: 49(ivec3) CompositeConstruct 493 493 493 - 495: 389(bvec3) IEqual 492 494 - Store 451(bv) 495 - 496: 188(ivec2) Load 306(i16v) - 497: 17(int) Load 312(i16) - 498: 188(ivec2) CompositeConstruct 497 497 - 499: 191(bvec2) IEqual 496 498 - 500: 389(bvec3) Load 451(bv) - 501: 389(bvec3) VectorShuffle 500 499 3 4 2 - Store 451(bv) 501 - 502: 49(ivec3) Load 320(u16v) - 503: 14(int) Load 322(u16) - 504: 49(ivec3) CompositeConstruct 503 503 503 - 505: 389(bvec3) INotEqual 502 504 - Store 451(bv) 505 - 506: 188(ivec2) Load 306(i16v) - 507: 17(int) Load 312(i16) - 508: 188(ivec2) CompositeConstruct 507 507 - 509: 191(bvec2) INotEqual 506 508 - 510: 389(bvec3) Load 451(bv) - 511: 389(bvec3) VectorShuffle 510 509 3 4 2 - Store 451(bv) 511 + 343(i16v): 53(ptr) Variable Function + 346(i16): 15(ptr) Variable Function + 356(u16v): 194(ptr) Variable Function + 358(u16): 37(ptr) Variable Function + 428(i32): 219(ptr) Variable Function + 431(i64): 242(ptr) Variable Function + 434(i16v4): 433(ptr) Variable Function + 437(u32): 296(ptr) Variable Function + 438(u16v2): 58(ptr) Variable Function + 442(u64): 441(ptr) Variable Function + 445(u16v4): 444(ptr) Variable Function + 457(bv): 456(ptr) Variable Function + 344: 52(i16vec2) Load 343(i16v) + 345: 52(i16vec2) ExtInst 1(GLSL.std.450) 5(SAbs) 344 + Store 343(i16v) 345 + 347: 14(int16_t) Load 346(i16) + 348: 14(int16_t) ExtInst 1(GLSL.std.450) 7(SSign) 347 + Store 346(i16) 348 + 349: 52(i16vec2) Load 343(i16v) + 350: 14(int16_t) Load 346(i16) + 351: 52(i16vec2) CompositeConstruct 350 350 + 352: 52(i16vec2) ExtInst 1(GLSL.std.450) 39(SMin) 349 351 + Store 343(i16v) 352 + 353: 52(i16vec2) Load 343(i16v) + 355: 52(i16vec2) ExtInst 1(GLSL.std.450) 39(SMin) 353 354 + Store 343(i16v) 355 + 357:193(i16vec3) Load 356(u16v) + 359: 36(int16_t) Load 358(u16) + 360:193(i16vec3) CompositeConstruct 359 359 359 + 361:193(i16vec3) ExtInst 1(GLSL.std.450) 38(UMin) 357 360 + Store 356(u16v) 361 + 362:193(i16vec3) Load 356(u16v) + 364:193(i16vec3) ExtInst 1(GLSL.std.450) 38(UMin) 362 363 + Store 356(u16v) 364 + 365: 52(i16vec2) Load 343(i16v) + 366: 14(int16_t) Load 346(i16) + 367: 52(i16vec2) CompositeConstruct 366 366 + 368: 52(i16vec2) ExtInst 1(GLSL.std.450) 42(SMax) 365 367 + Store 343(i16v) 368 + 369: 52(i16vec2) Load 343(i16v) + 370: 52(i16vec2) ExtInst 1(GLSL.std.450) 42(SMax) 369 354 + Store 343(i16v) 370 + 371:193(i16vec3) Load 356(u16v) + 372: 36(int16_t) Load 358(u16) + 373:193(i16vec3) CompositeConstruct 372 372 372 + 374:193(i16vec3) ExtInst 1(GLSL.std.450) 41(UMax) 371 373 + Store 356(u16v) 374 + 375:193(i16vec3) Load 356(u16v) + 376:193(i16vec3) ExtInst 1(GLSL.std.450) 41(UMax) 375 363 + Store 356(u16v) 376 + 377: 52(i16vec2) Load 343(i16v) + 378: 14(int16_t) Load 346(i16) + 379: 14(int16_t) SNegate 378 + 380: 14(int16_t) Load 346(i16) + 381: 52(i16vec2) CompositeConstruct 379 379 + 382: 52(i16vec2) CompositeConstruct 380 380 + 383: 52(i16vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 377 381 382 + Store 343(i16v) 383 + 384: 52(i16vec2) Load 343(i16v) + 385: 52(i16vec2) Load 343(i16v) + 386: 52(i16vec2) SNegate 385 + 387: 52(i16vec2) Load 343(i16v) + 388: 52(i16vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 384 386 387 + Store 343(i16v) 388 + 389:193(i16vec3) Load 356(u16v) + 390: 36(int16_t) Load 358(u16) + 391: 36(int16_t) SNegate 390 + 392: 36(int16_t) Load 358(u16) + 393:193(i16vec3) CompositeConstruct 391 391 391 + 394:193(i16vec3) CompositeConstruct 392 392 392 + 395:193(i16vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 389 393 394 + Store 356(u16v) 395 + 396:193(i16vec3) Load 356(u16v) + 397:193(i16vec3) Load 356(u16v) + 398:193(i16vec3) SNegate 397 + 399:193(i16vec3) Load 356(u16v) + 400:193(i16vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 396 398 399 + Store 356(u16v) 400 + 401: 15(ptr) AccessChain 343(i16v) 282 + 402: 14(int16_t) Load 401 + 403: 15(ptr) AccessChain 343(i16v) 264 + 404: 14(int16_t) Load 403 + 406: 14(int16_t) Select 405 404 402 + Store 346(i16) 406 + 407: 14(int16_t) Load 346(i16) + 408: 52(i16vec2) CompositeConstruct 407 407 + 409: 14(int16_t) Load 346(i16) + 410: 14(int16_t) SNegate 409 + 411: 52(i16vec2) CompositeConstruct 410 410 + 414: 52(i16vec2) Select 413 411 408 + Store 343(i16v) 414 + 415: 37(ptr) AccessChain 356(u16v) 282 + 416: 36(int16_t) Load 415 + 417: 37(ptr) AccessChain 356(u16v) 264 + 418: 36(int16_t) Load 417 + 419: 36(int16_t) Select 405 418 416 + Store 358(u16) 419 + 420: 36(int16_t) Load 358(u16) + 421:193(i16vec3) CompositeConstruct 420 420 420 + 422: 36(int16_t) Load 358(u16) + 423: 36(int16_t) SNegate 422 + 424:193(i16vec3) CompositeConstruct 423 423 423 + 427:193(i16vec3) Select 426 424 421 + Store 356(u16v) 427 + 429: 52(i16vec2) Load 343(i16v) + 430: 27(int) Bitcast 429 + Store 428(i32) 430 + 435:432(i16vec4) Load 434(i16v4) + 436: 71(int64_t) Bitcast 435 + Store 431(i64) 436 + 439: 57(i16vec2) Load 438(u16v2) + 440: 17(int) Bitcast 439 + Store 437(u32) 440 + 446:443(i16vec4) Load 445(u16v4) + 447: 77(int64_t) Bitcast 446 + Store 442(u64) 447 + 448: 27(int) Load 428(i32) + 449: 52(i16vec2) Bitcast 448 + Store 343(i16v) 449 + 450: 71(int64_t) Load 431(i64) + 451:432(i16vec4) Bitcast 450 + Store 434(i16v4) 451 + 452: 17(int) Load 437(u32) + 453: 57(i16vec2) Bitcast 452 + Store 438(u16v2) 453 + 454: 77(int64_t) Load 442(u64) + 455:443(i16vec4) Bitcast 454 + Store 445(u16v4) 455 + 458:193(i16vec3) Load 356(u16v) + 459: 36(int16_t) Load 358(u16) + 460:193(i16vec3) CompositeConstruct 459 459 459 + 461: 425(bvec3) ULessThan 458 460 + Store 457(bv) 461 + 462: 52(i16vec2) Load 343(i16v) + 463: 14(int16_t) Load 346(i16) + 464: 52(i16vec2) CompositeConstruct 463 463 + 465: 174(bvec2) SLessThan 462 464 + 466: 425(bvec3) Load 457(bv) + 467: 425(bvec3) VectorShuffle 466 465 3 4 2 + Store 457(bv) 467 + 468:193(i16vec3) Load 356(u16v) + 469: 36(int16_t) Load 358(u16) + 470:193(i16vec3) CompositeConstruct 469 469 469 + 471: 425(bvec3) ULessThanEqual 468 470 + Store 457(bv) 471 + 472: 52(i16vec2) Load 343(i16v) + 473: 14(int16_t) Load 346(i16) + 474: 52(i16vec2) CompositeConstruct 473 473 + 475: 174(bvec2) SLessThanEqual 472 474 + 476: 425(bvec3) Load 457(bv) + 477: 425(bvec3) VectorShuffle 476 475 3 4 2 + Store 457(bv) 477 + 478:193(i16vec3) Load 356(u16v) + 479: 36(int16_t) Load 358(u16) + 480:193(i16vec3) CompositeConstruct 479 479 479 + 481: 425(bvec3) UGreaterThan 478 480 + Store 457(bv) 481 + 482: 52(i16vec2) Load 343(i16v) + 483: 14(int16_t) Load 346(i16) + 484: 52(i16vec2) CompositeConstruct 483 483 + 485: 174(bvec2) SGreaterThan 482 484 + 486: 425(bvec3) Load 457(bv) + 487: 425(bvec3) VectorShuffle 486 485 3 4 2 + Store 457(bv) 487 + 488:193(i16vec3) Load 356(u16v) + 489: 36(int16_t) Load 358(u16) + 490:193(i16vec3) CompositeConstruct 489 489 489 + 491: 425(bvec3) UGreaterThanEqual 488 490 + Store 457(bv) 491 + 492: 52(i16vec2) Load 343(i16v) + 493: 14(int16_t) Load 346(i16) + 494: 52(i16vec2) CompositeConstruct 493 493 + 495: 174(bvec2) SGreaterThanEqual 492 494 + 496: 425(bvec3) Load 457(bv) + 497: 425(bvec3) VectorShuffle 496 495 3 4 2 + Store 457(bv) 497 + 498:193(i16vec3) Load 356(u16v) + 499: 36(int16_t) Load 358(u16) + 500:193(i16vec3) CompositeConstruct 499 499 499 + 501: 425(bvec3) IEqual 498 500 + Store 457(bv) 501 + 502: 52(i16vec2) Load 343(i16v) + 503: 14(int16_t) Load 346(i16) + 504: 52(i16vec2) CompositeConstruct 503 503 + 505: 174(bvec2) IEqual 502 504 + 506: 425(bvec3) Load 457(bv) + 507: 425(bvec3) VectorShuffle 506 505 3 4 2 + Store 457(bv) 507 + 508:193(i16vec3) Load 356(u16v) + 509: 36(int16_t) Load 358(u16) + 510:193(i16vec3) CompositeConstruct 509 509 509 + 511: 425(bvec3) INotEqual 508 510 + Store 457(bv) 511 + 512: 52(i16vec2) Load 343(i16v) + 513: 14(int16_t) Load 346(i16) + 514: 52(i16vec2) CompositeConstruct 513 513 + 515: 174(bvec2) INotEqual 512 514 + 516: 425(bvec3) Load 457(bv) + 517: 425(bvec3) VectorShuffle 516 515 3 4 2 + Store 457(bv) 517 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int32.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int32.frag.out new file mode 100644 index 00000000000..3b93428447d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int32.frag.out @@ -0,0 +1,716 @@ +spv.int32.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.1 specification (or requires extension) + OpCapability Float16 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 493 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" + Name 4 "main" + Name 6 "literal(" + Name 8 "typeCast32(" + Name 10 "operators(" + Name 12 "builtinFuncs(" + Name 16 "u32Max" + Name 20 "i32" + Name 27 "Uniforms" + MemberName 27(Uniforms) 0 "index" + Name 29 "" + Name 35 "indexable" + Name 39 "u32" + Name 46 "indexable" + Name 51 "u32v" + Name 54 "i32v" + Name 60 "i64v" + Name 66 "u64v" + Name 78 "f32v" + Name 84 "f64v" + Name 94 "i8v" + Name 105 "i16v" + Name 125 "u8v" + Name 132 "u16v" + Name 152 "f16v" + Name 168 "bv" + Name 186 "u32v" + Name 191 "i32" + Name 210 "i" + Name 214 "uv" + Name 227 "i64" + Name 260 "b" + Name 312 "i32v" + Name 315 "i32" + Name 325 "u32v" + Name 327 "u32" + Name 399 "i8v4" + Name 402 "i16v2" + Name 407 "u8v4" + Name 410 "u16v2" + Name 413 "i64" + Name 416 "u32v2" + Name 418 "u64" + Name 422 "bv" + Name 485 "Block" + MemberName 485(Block) 0 "i32" + MemberName 485(Block) 1 "i32v2" + MemberName 485(Block) 2 "i32v3" + MemberName 485(Block) 3 "i32v4" + MemberName 485(Block) 4 "u32" + MemberName 485(Block) 5 "u32v2" + MemberName 485(Block) 6 "u32v3" + MemberName 485(Block) 7 "u32v4" + Name 487 "block" + Name 488 "si32" + Name 489 "su32" + Name 490 "si" + Name 491 "su" + Name 492 "sb" + MemberDecorate 27(Uniforms) 0 Offset 0 + Decorate 27(Uniforms) Block + Decorate 29 DescriptorSet 0 + Decorate 29 Binding 0 + MemberDecorate 485(Block) 0 Offset 0 + MemberDecorate 485(Block) 1 Offset 8 + MemberDecorate 485(Block) 2 Offset 16 + MemberDecorate 485(Block) 3 Offset 32 + MemberDecorate 485(Block) 4 Offset 48 + MemberDecorate 485(Block) 5 Offset 56 + MemberDecorate 485(Block) 6 Offset 64 + MemberDecorate 485(Block) 7 Offset 80 + Decorate 485(Block) Block + Decorate 487(block) DescriptorSet 0 + Decorate 487(block) Binding 1 + Decorate 488(si32) SpecId 100 + Decorate 489(su32) SpecId 101 + Decorate 490(si) SpecId 102 + Decorate 491(su) SpecId 103 + Decorate 492(sb) SpecId 104 + 2: TypeVoid + 3: TypeFunction 2 + 14: TypeInt 32 0 + 15: TypePointer Private 14(int) + 16(u32Max): 15(ptr) Variable Private + 17: 14(int) Constant 4294967295 + 18: TypeInt 32 1 + 19: TypePointer Function 18(int) + 21: 14(int) Constant 3 + 22: TypeArray 18(int) 21 + 23: 18(int) Constant 4008636143 + 24: 18(int) Constant 4294967295 + 25: 18(int) Constant 536870912 + 26: 22 ConstantComposite 23 24 25 + 27(Uniforms): TypeStruct 14(int) + 28: TypePointer Uniform 27(Uniforms) + 29: 28(ptr) Variable Uniform + 30: 18(int) Constant 0 + 31: TypePointer Uniform 14(int) + 34: TypePointer Function 22 + 38: TypePointer Function 14(int) + 40: TypeArray 14(int) 21 + 41: 14(int) Constant 2147483647 + 42: 40 ConstantComposite 17 17 41 + 45: TypePointer Function 40 + 49: TypeVector 14(int) 2 + 50: TypePointer Function 49(ivec2) + 52: TypeVector 18(int) 2 + 53: TypePointer Function 52(ivec2) + 57: TypeInt 64 1 + 58: TypeVector 57(int64_t) 2 + 59: TypePointer Function 58(i64vec2) + 63: TypeInt 64 0 + 64: TypeVector 63(int64_t) 2 + 65: TypePointer Function 64(i64vec2) + 75: TypeFloat 32 + 76: TypeVector 75(float) 2 + 77: TypePointer Function 76(fvec2) + 81: TypeFloat 64 + 82: TypeVector 81(float64_t) 2 + 83: TypePointer Function 82(f64vec2) + 91: TypeInt 8 1 + 92: TypeVector 91(int8_t) 2 + 93: TypePointer Function 92(i8vec2) + 98: TypeInt 8 0 + 99: TypeVector 98(int8_t) 2 + 102: TypeInt 16 1 + 103: TypeVector 102(int16_t) 2 + 104: TypePointer Function 103(i16vec2) + 109: TypeInt 16 0 + 110: TypeVector 109(int16_t) 2 + 124: TypePointer Function 99(i8vec2) + 131: TypePointer Function 110(i16vec2) + 149: TypeFloat 16 + 150: TypeVector 149(float16_t) 2 + 151: TypePointer Function 150(f16vec2) + 165: TypeBool + 166: TypeVector 165(bool) 2 + 167: TypePointer Function 166(bvec2) + 170: 18(int) Constant 1 + 171: 52(ivec2) ConstantComposite 30 30 + 172: 52(ivec2) ConstantComposite 170 170 + 175: 14(int) Constant 0 + 176: 14(int) Constant 1 + 177: 49(ivec2) ConstantComposite 175 175 + 178: 49(ivec2) ConstantComposite 176 176 + 184: TypeVector 14(int) 3 + 185: TypePointer Function 184(ivec3) + 188: TypeVector 18(int) 3 + 226: TypePointer Function 57(int64_t) + 251: 14(int) Constant 2 + 259: TypePointer Function 165(bool) + 323: 52(ivec2) ConstantComposite 24 24 + 332: 184(ivec3) ConstantComposite 175 175 175 + 374: 165(bool) ConstantTrue + 381: 165(bool) ConstantFalse + 382: 166(bvec2) ConstantComposite 381 381 + 394: TypeVector 165(bool) 3 + 395: 394(bvec3) ConstantComposite 381 381 381 + 397: TypeVector 91(int8_t) 4 + 398: TypePointer Function 397(i8vec4) + 405: TypeVector 98(int8_t) 4 + 406: TypePointer Function 405(i8vec4) + 417: TypePointer Function 63(int64_t) + 421: TypePointer Function 394(bvec3) + 483: TypeVector 18(int) 4 + 484: TypeVector 14(int) 4 + 485(Block): TypeStruct 18(int) 52(ivec2) 188(ivec3) 483(ivec4) 14(int) 49(ivec2) 184(ivec3) 484(ivec4) + 486: TypePointer Uniform 485(Block) + 487(block): 486(ptr) Variable Uniform + 488(si32): 18(int) SpecConstant 4294967286 + 489(su32): 14(int) SpecConstant 20 + 490(si): 18(int) SpecConstant 4294967291 + 491(su): 14(int) SpecConstant 4 + 492(sb): 165(bool) SpecConstantTrue + 4(main): 2 Function None 3 + 5: Label + Store 16(u32Max) 17 + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 20(i32): 19(ptr) Variable Function + 35(indexable): 34(ptr) Variable Function + 39(u32): 38(ptr) Variable Function + 46(indexable): 45(ptr) Variable Function + 32: 31(ptr) AccessChain 29 30 + 33: 14(int) Load 32 + Store 35(indexable) 26 + 36: 19(ptr) AccessChain 35(indexable) 33 + 37: 18(int) Load 36 + Store 20(i32) 37 + 43: 31(ptr) AccessChain 29 30 + 44: 14(int) Load 43 + Store 46(indexable) 42 + 47: 38(ptr) AccessChain 46(indexable) 44 + 48: 14(int) Load 47 + Store 39(u32) 48 + Return + FunctionEnd + 8(typeCast32(): 2 Function None 3 + 9: Label + 51(u32v): 50(ptr) Variable Function + 54(i32v): 53(ptr) Variable Function + 60(i64v): 59(ptr) Variable Function + 66(u64v): 65(ptr) Variable Function + 78(f32v): 77(ptr) Variable Function + 84(f64v): 83(ptr) Variable Function + 94(i8v): 93(ptr) Variable Function + 105(i16v): 104(ptr) Variable Function + 125(u8v): 124(ptr) Variable Function + 132(u16v): 131(ptr) Variable Function + 152(f16v): 151(ptr) Variable Function + 168(bv): 167(ptr) Variable Function + 55: 52(ivec2) Load 54(i32v) + 56: 49(ivec2) Bitcast 55 + Store 51(u32v) 56 + 61: 52(ivec2) Load 54(i32v) + 62: 58(i64vec2) SConvert 61 + Store 60(i64v) 62 + 67: 52(ivec2) Load 54(i32v) + 68: 58(i64vec2) SConvert 67 + 69: 64(i64vec2) Bitcast 68 + Store 66(u64v) 69 + 70: 49(ivec2) Load 51(u32v) + 71: 64(i64vec2) UConvert 70 + 72: 58(i64vec2) Bitcast 71 + Store 60(i64v) 72 + 73: 49(ivec2) Load 51(u32v) + 74: 64(i64vec2) UConvert 73 + Store 66(u64v) 74 + 79: 52(ivec2) Load 54(i32v) + 80: 76(fvec2) ConvertSToF 79 + Store 78(f32v) 80 + 85: 52(ivec2) Load 54(i32v) + 86: 82(f64vec2) ConvertSToF 85 + Store 84(f64v) 86 + 87: 49(ivec2) Load 51(u32v) + 88: 76(fvec2) ConvertUToF 87 + Store 78(f32v) 88 + 89: 49(ivec2) Load 51(u32v) + 90: 82(f64vec2) ConvertUToF 89 + Store 84(f64v) 90 + 95: 52(ivec2) Load 54(i32v) + 96: 92(i8vec2) SConvert 95 + Store 94(i8v) 96 + 97: 49(ivec2) Load 51(u32v) + 100: 99(i8vec2) UConvert 97 + 101: 92(i8vec2) Bitcast 100 + Store 94(i8v) 101 + 106: 52(ivec2) Load 54(i32v) + 107:103(i16vec2) SConvert 106 + Store 105(i16v) 107 + 108: 49(ivec2) Load 51(u32v) + 111:110(i16vec2) UConvert 108 + 112:103(i16vec2) Bitcast 111 + Store 105(i16v) 112 + 113: 52(ivec2) Load 54(i32v) + 114: 18(int) CompositeExtract 113 0 + 115: 18(int) CompositeExtract 113 1 + 116: 52(ivec2) CompositeConstruct 114 115 + Store 54(i32v) 116 + 117: 49(ivec2) Load 51(u32v) + 118: 52(ivec2) Bitcast 117 + Store 54(i32v) 118 + 119: 52(ivec2) Load 54(i32v) + 120: 58(i64vec2) SConvert 119 + Store 60(i64v) 120 + 121: 49(ivec2) Load 51(u32v) + 122: 64(i64vec2) UConvert 121 + 123: 58(i64vec2) Bitcast 122 + Store 60(i64v) 123 + 126: 52(ivec2) Load 54(i32v) + 127: 92(i8vec2) SConvert 126 + 128: 99(i8vec2) Bitcast 127 + Store 125(u8v) 128 + 129: 49(ivec2) Load 51(u32v) + 130: 99(i8vec2) UConvert 129 + Store 125(u8v) 130 + 133: 52(ivec2) Load 54(i32v) + 134:103(i16vec2) SConvert 133 + 135:110(i16vec2) Bitcast 134 + Store 132(u16v) 135 + 136: 49(ivec2) Load 51(u32v) + 137:110(i16vec2) UConvert 136 + Store 132(u16v) 137 + 138: 52(ivec2) Load 54(i32v) + 139: 49(ivec2) Bitcast 138 + Store 51(u32v) 139 + 140: 49(ivec2) Load 51(u32v) + 141: 14(int) CompositeExtract 140 0 + 142: 14(int) CompositeExtract 140 1 + 143: 49(ivec2) CompositeConstruct 141 142 + Store 51(u32v) 143 + 144: 52(ivec2) Load 54(i32v) + 145: 58(i64vec2) SConvert 144 + 146: 64(i64vec2) Bitcast 145 + Store 66(u64v) 146 + 147: 49(ivec2) Load 51(u32v) + 148: 64(i64vec2) UConvert 147 + Store 66(u64v) 148 + 153: 52(ivec2) Load 54(i32v) + 154:150(f16vec2) ConvertSToF 153 + Store 152(f16v) 154 + 155: 52(ivec2) Load 54(i32v) + 156: 76(fvec2) ConvertSToF 155 + Store 78(f32v) 156 + 157: 52(ivec2) Load 54(i32v) + 158: 82(f64vec2) ConvertSToF 157 + Store 84(f64v) 158 + 159: 49(ivec2) Load 51(u32v) + 160:150(f16vec2) ConvertUToF 159 + Store 152(f16v) 160 + 161: 49(ivec2) Load 51(u32v) + 162: 76(fvec2) ConvertUToF 161 + Store 78(f32v) 162 + 163: 49(ivec2) Load 51(u32v) + 164: 82(f64vec2) ConvertUToF 163 + Store 84(f64v) 164 + 169: 166(bvec2) Load 168(bv) + 173: 52(ivec2) Select 169 172 171 + Store 54(i32v) 173 + 174: 166(bvec2) Load 168(bv) + 179: 49(ivec2) Select 174 178 177 + Store 51(u32v) 179 + 180: 52(ivec2) Load 54(i32v) + 181: 166(bvec2) INotEqual 180 177 + Store 168(bv) 181 + 182: 49(ivec2) Load 51(u32v) + 183: 166(bvec2) INotEqual 182 177 + Store 168(bv) 183 + Return + FunctionEnd + 10(operators(): 2 Function None 3 + 11: Label + 186(u32v): 185(ptr) Variable Function + 191(i32): 19(ptr) Variable Function + 210(i): 19(ptr) Variable Function + 214(uv): 185(ptr) Variable Function + 227(i64): 226(ptr) Variable Function + 260(b): 259(ptr) Variable Function + 187: 184(ivec3) Load 186(u32v) + 189: 188(ivec3) CompositeConstruct 170 170 170 + 190: 184(ivec3) IAdd 187 189 + Store 186(u32v) 190 + 192: 18(int) Load 191(i32) + 193: 18(int) ISub 192 170 + Store 191(i32) 193 + 194: 18(int) Load 191(i32) + 195: 18(int) IAdd 194 170 + Store 191(i32) 195 + 196: 184(ivec3) Load 186(u32v) + 197: 188(ivec3) CompositeConstruct 170 170 170 + 198: 184(ivec3) ISub 196 197 + Store 186(u32v) 198 + 199: 184(ivec3) Load 186(u32v) + 200: 184(ivec3) Not 199 + Store 186(u32v) 200 + 201: 18(int) Load 191(i32) + Store 191(i32) 201 + 202: 184(ivec3) Load 186(u32v) + 203: 184(ivec3) SNegate 202 + Store 186(u32v) 203 + 204: 18(int) Load 191(i32) + 205: 18(int) Load 191(i32) + 206: 18(int) IAdd 205 204 + Store 191(i32) 206 + 207: 184(ivec3) Load 186(u32v) + 208: 184(ivec3) Load 186(u32v) + 209: 184(ivec3) ISub 208 207 + Store 186(u32v) 209 + 211: 18(int) Load 191(i32) + 212: 18(int) Load 210(i) + 213: 18(int) IMul 212 211 + Store 210(i) 213 + 215: 184(ivec3) Load 186(u32v) + 216: 184(ivec3) Load 214(uv) + 217: 184(ivec3) UDiv 216 215 + Store 214(uv) 217 + 218: 18(int) Load 191(i32) + 219: 14(int) Bitcast 218 + 220: 184(ivec3) Load 214(uv) + 221: 184(ivec3) CompositeConstruct 219 219 219 + 222: 184(ivec3) UMod 220 221 + Store 214(uv) 222 + 223: 184(ivec3) Load 186(u32v) + 224: 184(ivec3) Load 214(uv) + 225: 184(ivec3) IAdd 223 224 + Store 214(uv) 225 + 228: 18(int) Load 191(i32) + 229: 57(int64_t) SConvert 228 + 230: 57(int64_t) Load 227(i64) + 231: 57(int64_t) ISub 229 230 + Store 227(i64) 231 + 232: 184(ivec3) Load 186(u32v) + 233: 184(ivec3) Load 214(uv) + 234: 184(ivec3) IMul 232 233 + Store 214(uv) 234 + 235: 18(int) Load 191(i32) + 236: 57(int64_t) SConvert 235 + 237: 57(int64_t) Load 227(i64) + 238: 57(int64_t) IMul 236 237 + Store 227(i64) 238 + 239: 18(int) Load 191(i32) + 240: 18(int) Load 210(i) + 241: 18(int) SMod 239 240 + Store 210(i) 241 + 242: 18(int) Load 191(i32) + 243: 184(ivec3) Load 186(u32v) + 244: 188(ivec3) CompositeConstruct 242 242 242 + 245: 184(ivec3) ShiftLeftLogical 243 244 + Store 186(u32v) 245 + 246: 38(ptr) AccessChain 186(u32v) 176 + 247: 14(int) Load 246 + 248: 18(int) Load 191(i32) + 249: 18(int) ShiftRightArithmetic 248 247 + Store 191(i32) 249 + 250: 57(int64_t) Load 227(i64) + 252: 38(ptr) AccessChain 186(u32v) 251 + 253: 14(int) Load 252 + 254: 57(int64_t) ShiftLeftLogical 250 253 + Store 227(i64) 254 + 255: 184(ivec3) Load 186(u32v) + 256: 18(int) Load 210(i) + 257: 188(ivec3) CompositeConstruct 256 256 256 + 258: 184(ivec3) ShiftLeftLogical 255 257 + Store 214(uv) 258 + 261: 38(ptr) AccessChain 186(u32v) 175 + 262: 14(int) Load 261 + 263: 18(int) Load 191(i32) + 264: 14(int) Bitcast 263 + 265: 165(bool) INotEqual 262 264 + Store 260(b) 265 + 266: 18(int) Load 191(i32) + 267: 14(int) Bitcast 266 + 268: 38(ptr) AccessChain 186(u32v) 175 + 269: 14(int) Load 268 + 270: 165(bool) IEqual 267 269 + Store 260(b) 270 + 271: 38(ptr) AccessChain 186(u32v) 175 + 272: 14(int) Load 271 + 273: 38(ptr) AccessChain 214(uv) 176 + 274: 14(int) Load 273 + 275: 165(bool) UGreaterThan 272 274 + Store 260(b) 275 + 276: 18(int) Load 191(i32) + 277: 18(int) Load 210(i) + 278: 165(bool) SLessThan 276 277 + Store 260(b) 278 + 279: 38(ptr) AccessChain 186(u32v) 176 + 280: 14(int) Load 279 + 281: 38(ptr) AccessChain 214(uv) 175 + 282: 14(int) Load 281 + 283: 165(bool) UGreaterThanEqual 280 282 + Store 260(b) 283 + 284: 18(int) Load 191(i32) + 285: 18(int) Load 210(i) + 286: 165(bool) SLessThanEqual 284 285 + Store 260(b) 286 + 287: 18(int) Load 191(i32) + 288: 14(int) Bitcast 287 + 289: 184(ivec3) Load 214(uv) + 290: 184(ivec3) CompositeConstruct 288 288 288 + 291: 184(ivec3) BitwiseOr 289 290 + Store 214(uv) 291 + 292: 18(int) Load 191(i32) + 293: 18(int) Load 210(i) + 294: 18(int) BitwiseOr 292 293 + Store 210(i) 294 + 295: 18(int) Load 191(i32) + 296: 57(int64_t) SConvert 295 + 297: 57(int64_t) Load 227(i64) + 298: 57(int64_t) BitwiseAnd 297 296 + Store 227(i64) 298 + 299: 184(ivec3) Load 186(u32v) + 300: 184(ivec3) Load 214(uv) + 301: 184(ivec3) BitwiseAnd 299 300 + Store 214(uv) 301 + 302: 18(int) Load 191(i32) + 303: 14(int) Bitcast 302 + 304: 184(ivec3) Load 214(uv) + 305: 184(ivec3) CompositeConstruct 303 303 303 + 306: 184(ivec3) BitwiseXor 304 305 + Store 214(uv) 306 + 307: 184(ivec3) Load 186(u32v) + 308: 18(int) Load 191(i32) + 309: 14(int) Bitcast 308 + 310: 184(ivec3) CompositeConstruct 309 309 309 + 311: 184(ivec3) BitwiseXor 307 310 + Store 186(u32v) 311 + Return + FunctionEnd +12(builtinFuncs(): 2 Function None 3 + 13: Label + 312(i32v): 53(ptr) Variable Function + 315(i32): 19(ptr) Variable Function + 325(u32v): 185(ptr) Variable Function + 327(u32): 38(ptr) Variable Function + 399(i8v4): 398(ptr) Variable Function + 402(i16v2): 104(ptr) Variable Function + 407(u8v4): 406(ptr) Variable Function + 410(u16v2): 131(ptr) Variable Function + 413(i64): 226(ptr) Variable Function + 416(u32v2): 50(ptr) Variable Function + 418(u64): 417(ptr) Variable Function + 422(bv): 421(ptr) Variable Function + 313: 52(ivec2) Load 312(i32v) + 314: 52(ivec2) ExtInst 1(GLSL.std.450) 5(SAbs) 313 + Store 312(i32v) 314 + 316: 18(int) Load 315(i32) + 317: 18(int) ExtInst 1(GLSL.std.450) 7(SSign) 316 + Store 315(i32) 317 + 318: 52(ivec2) Load 312(i32v) + 319: 18(int) Load 315(i32) + 320: 52(ivec2) CompositeConstruct 319 319 + 321: 52(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 318 320 + Store 312(i32v) 321 + 322: 52(ivec2) Load 312(i32v) + 324: 52(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 322 323 + Store 312(i32v) 324 + 326: 184(ivec3) Load 325(u32v) + 328: 14(int) Load 327(u32) + 329: 184(ivec3) CompositeConstruct 328 328 328 + 330: 184(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 326 329 + Store 325(u32v) 330 + 331: 184(ivec3) Load 325(u32v) + 333: 184(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 331 332 + Store 325(u32v) 333 + 334: 52(ivec2) Load 312(i32v) + 335: 18(int) Load 315(i32) + 336: 52(ivec2) CompositeConstruct 335 335 + 337: 52(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 334 336 + Store 312(i32v) 337 + 338: 52(ivec2) Load 312(i32v) + 339: 52(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 338 323 + Store 312(i32v) 339 + 340: 184(ivec3) Load 325(u32v) + 341: 14(int) Load 327(u32) + 342: 184(ivec3) CompositeConstruct 341 341 341 + 343: 184(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 340 342 + Store 325(u32v) 343 + 344: 184(ivec3) Load 325(u32v) + 345: 184(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 344 332 + Store 325(u32v) 345 + 346: 52(ivec2) Load 312(i32v) + 347: 18(int) Load 315(i32) + 348: 18(int) SNegate 347 + 349: 18(int) Load 315(i32) + 350: 52(ivec2) CompositeConstruct 348 348 + 351: 52(ivec2) CompositeConstruct 349 349 + 352: 52(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 346 350 351 + Store 312(i32v) 352 + 353: 52(ivec2) Load 312(i32v) + 354: 52(ivec2) Load 312(i32v) + 355: 52(ivec2) SNegate 354 + 356: 52(ivec2) Load 312(i32v) + 357: 52(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 353 355 356 + Store 312(i32v) 357 + 358: 184(ivec3) Load 325(u32v) + 359: 14(int) Load 327(u32) + 360: 14(int) SNegate 359 + 361: 14(int) Load 327(u32) + 362: 184(ivec3) CompositeConstruct 360 360 360 + 363: 184(ivec3) CompositeConstruct 361 361 361 + 364: 184(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 358 362 363 + Store 325(u32v) 364 + 365: 184(ivec3) Load 325(u32v) + 366: 184(ivec3) Load 325(u32v) + 367: 184(ivec3) SNegate 366 + 368: 184(ivec3) Load 325(u32v) + 369: 184(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 365 367 368 + Store 325(u32v) 369 + 370: 19(ptr) AccessChain 312(i32v) 175 + 371: 18(int) Load 370 + 372: 19(ptr) AccessChain 312(i32v) 176 + 373: 18(int) Load 372 + 375: 18(int) Select 374 373 371 + Store 315(i32) 375 + 376: 18(int) Load 315(i32) + 377: 52(ivec2) CompositeConstruct 376 376 + 378: 18(int) Load 315(i32) + 379: 18(int) SNegate 378 + 380: 52(ivec2) CompositeConstruct 379 379 + 383: 52(ivec2) Select 382 380 377 + Store 312(i32v) 383 + 384: 38(ptr) AccessChain 325(u32v) 175 + 385: 14(int) Load 384 + 386: 38(ptr) AccessChain 325(u32v) 176 + 387: 14(int) Load 386 + 388: 14(int) Select 374 387 385 + Store 327(u32) 388 + 389: 14(int) Load 327(u32) + 390: 184(ivec3) CompositeConstruct 389 389 389 + 391: 14(int) Load 327(u32) + 392: 14(int) SNegate 391 + 393: 184(ivec3) CompositeConstruct 392 392 392 + 396: 184(ivec3) Select 395 393 390 + Store 325(u32v) 396 + 400: 397(i8vec4) Load 399(i8v4) + 401: 18(int) Bitcast 400 + Store 315(i32) 401 + 403:103(i16vec2) Load 402(i16v2) + 404: 18(int) Bitcast 403 + Store 315(i32) 404 + 408: 405(i8vec4) Load 407(u8v4) + 409: 14(int) Bitcast 408 + Store 327(u32) 409 + 411:110(i16vec2) Load 410(u16v2) + 412: 14(int) Bitcast 411 + Store 327(u32) 412 + 414: 57(int64_t) Load 413(i64) + 415: 52(ivec2) Bitcast 414 + Store 312(i32v) 415 + 419: 63(int64_t) Load 418(u64) + 420: 49(ivec2) Bitcast 419 + Store 416(u32v2) 420 + 423: 184(ivec3) Load 325(u32v) + 424: 14(int) Load 327(u32) + 425: 184(ivec3) CompositeConstruct 424 424 424 + 426: 394(bvec3) ULessThan 423 425 + Store 422(bv) 426 + 427: 52(ivec2) Load 312(i32v) + 428: 18(int) Load 315(i32) + 429: 52(ivec2) CompositeConstruct 428 428 + 430: 166(bvec2) SLessThan 427 429 + 431: 394(bvec3) Load 422(bv) + 432: 394(bvec3) VectorShuffle 431 430 3 4 2 + Store 422(bv) 432 + 433: 184(ivec3) Load 325(u32v) + 434: 14(int) Load 327(u32) + 435: 184(ivec3) CompositeConstruct 434 434 434 + 436: 394(bvec3) ULessThanEqual 433 435 + Store 422(bv) 436 + 437: 52(ivec2) Load 312(i32v) + 438: 18(int) Load 315(i32) + 439: 52(ivec2) CompositeConstruct 438 438 + 440: 166(bvec2) SLessThanEqual 437 439 + 441: 394(bvec3) Load 422(bv) + 442: 394(bvec3) VectorShuffle 441 440 3 4 2 + Store 422(bv) 442 + 443: 184(ivec3) Load 325(u32v) + 444: 14(int) Load 327(u32) + 445: 184(ivec3) CompositeConstruct 444 444 444 + 446: 394(bvec3) UGreaterThan 443 445 + Store 422(bv) 446 + 447: 52(ivec2) Load 312(i32v) + 448: 18(int) Load 315(i32) + 449: 52(ivec2) CompositeConstruct 448 448 + 450: 166(bvec2) SGreaterThan 447 449 + 451: 394(bvec3) Load 422(bv) + 452: 394(bvec3) VectorShuffle 451 450 3 4 2 + Store 422(bv) 452 + 453: 184(ivec3) Load 325(u32v) + 454: 14(int) Load 327(u32) + 455: 184(ivec3) CompositeConstruct 454 454 454 + 456: 394(bvec3) UGreaterThanEqual 453 455 + Store 422(bv) 456 + 457: 52(ivec2) Load 312(i32v) + 458: 18(int) Load 315(i32) + 459: 52(ivec2) CompositeConstruct 458 458 + 460: 166(bvec2) SGreaterThanEqual 457 459 + 461: 394(bvec3) Load 422(bv) + 462: 394(bvec3) VectorShuffle 461 460 3 4 2 + Store 422(bv) 462 + 463: 184(ivec3) Load 325(u32v) + 464: 14(int) Load 327(u32) + 465: 184(ivec3) CompositeConstruct 464 464 464 + 466: 394(bvec3) IEqual 463 465 + Store 422(bv) 466 + 467: 52(ivec2) Load 312(i32v) + 468: 18(int) Load 315(i32) + 469: 52(ivec2) CompositeConstruct 468 468 + 470: 166(bvec2) IEqual 467 469 + 471: 394(bvec3) Load 422(bv) + 472: 394(bvec3) VectorShuffle 471 470 3 4 2 + Store 422(bv) 472 + 473: 184(ivec3) Load 325(u32v) + 474: 14(int) Load 327(u32) + 475: 184(ivec3) CompositeConstruct 474 474 474 + 476: 394(bvec3) INotEqual 473 475 + Store 422(bv) 476 + 477: 52(ivec2) Load 312(i32v) + 478: 18(int) Load 315(i32) + 479: 52(ivec2) CompositeConstruct 478 478 + 480: 166(bvec2) INotEqual 477 479 + 481: 394(bvec3) Load 422(bv) + 482: 394(bvec3) VectorShuffle 481 480 3 4 2 + Store 422(bv) 482 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int64.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int64.frag.out index 3c6dc8509b4..f2c54f16190 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int64.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int64.frag.out @@ -1,7 +1,11 @@ spv.int64.frag +error: SPIRV-Tools Validation Errors +error: OpDecorate SpecId decoration target '1' is not a scalar specialization constant. + OpDecorate %su64inc SpecId 105 + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 480 +// Generated by (magic number): 80007 +// Id's are bound by 489 Capability Shader Capability Float64 @@ -12,6 +16,7 @@ spv.int64.frag ExecutionMode 4 OriginUpperLeft Source GLSL 450 SourceExtension "GL_ARB_gpu_shader_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" Name 4 "main" Name 6 "literal(" Name 8 "typeCast(" @@ -36,52 +41,68 @@ spv.int64.frag Name 139 "i64" Name 159 "i" Name 166 "uv" - Name 218 "b" - Name 278 "i64v" - Name 281 "i64" - Name 291 "u64v" - Name 293 "u64" - Name 365 "dv" - Name 384 "iv" - Name 389 "uv" - Name 393 "bv" - Name 454 "Block" - MemberName 454(Block) 0 "i64v" - MemberName 454(Block) 1 "u64" - Name 456 "block" - Name 457 "si64" - Name 458 "su64" - Name 459 "si" - Name 460 "su" - Name 461 "sb" + Name 226 "b" + Name 286 "i64v" + Name 289 "i64" + Name 299 "u64v" + Name 301 "u64" + Name 373 "dv" + Name 392 "iv" + Name 397 "uv" + Name 401 "bv" + Name 462 "Block" + MemberName 462(Block) 0 "i64v" + MemberName 462(Block) 1 "u64" + Name 464 "block" + Name 465 "si64" + Name 466 "su64" + Name 467 "si" + Name 468 "su" + Name 469 "sb" + Name 470 "su64inc" + Name 471 "i64_to_b" + Name 472 "u64_to_b" + Name 473 "b_to_i64" + Name 474 "b_to_u64" + Name 475 "i64_to_i" + Name 476 "i_to_i64" + Name 477 "u64_to_u" + Name 478 "u_to_u64" + Name 479 "u64_to_i64" + Name 480 "i64_to_u64" + Name 482 "u64_to_i" + Name 484 "i_to_u64" + Name 486 "i64_to_u" + Name 488 "u_to_i64" MemberDecorate 28(Uniforms) 0 Offset 0 Decorate 28(Uniforms) Block Decorate 30 DescriptorSet 0 Decorate 30 Binding 0 - MemberDecorate 454(Block) 0 Offset 0 - MemberDecorate 454(Block) 1 Offset 24 - Decorate 454(Block) Block - Decorate 456(block) DescriptorSet 0 - Decorate 456(block) Binding 1 - Decorate 457(si64) SpecId 100 - Decorate 458(su64) SpecId 101 - Decorate 459(si) SpecId 102 - Decorate 460(su) SpecId 103 - Decorate 461(sb) SpecId 104 + MemberDecorate 462(Block) 0 Offset 0 + MemberDecorate 462(Block) 1 Offset 24 + Decorate 462(Block) Block + Decorate 464(block) DescriptorSet 0 + Decorate 464(block) Binding 1 + Decorate 465(si64) SpecId 100 + Decorate 466(su64) SpecId 101 + Decorate 467(si) SpecId 102 + Decorate 468(su) SpecId 103 + Decorate 469(sb) SpecId 104 + Decorate 470(su64inc) SpecId 105 2: TypeVoid 3: TypeFunction 2 14: TypeInt 64 0 - 15: TypePointer Private 14(int) + 15: TypePointer Private 14(int64_t) 16(u64Max): 15(ptr) Variable Private - 17: 14(int) Constant 4294967295 4294967295 + 17: 14(int64_t) Constant 4294967295 4294967295 18: TypeInt 64 1 - 19: TypePointer Function 18(int) + 19: TypePointer Function 18(int64_t) 21: TypeInt 32 0 22: 21(int) Constant 3 - 23: TypeArray 18(int) 22 - 24: 18(int) Constant 4008636143 4008636142 - 25: 18(int) Constant 4294967295 4294967295 - 26: 18(int) Constant 0 1 + 23: TypeArray 18(int64_t) 22 + 24: 18(int64_t) Constant 4008636143 4008636142 + 25: 18(int64_t) Constant 4294967295 4294967295 + 26: 18(int64_t) Constant 0 1 27: 23 ConstantComposite 24 25 26 28(Uniforms): TypeStruct 21(int) 29: TypePointer Uniform 28(Uniforms) @@ -90,27 +111,27 @@ spv.int64.frag 32: 31(int) Constant 0 33: TypePointer Uniform 21(int) 36: TypePointer Function 23 - 40: TypePointer Function 14(int) - 42: TypeArray 14(int) 22 - 43: 14(int) Constant 0 1 - 44: 14(int) Constant 4294967295 1 + 40: TypePointer Function 14(int64_t) + 42: TypeArray 14(int64_t) 22 + 43: 14(int64_t) Constant 0 1 + 44: 14(int64_t) Constant 4294967295 1 45: 42 ConstantComposite 17 43 44 48: TypePointer Function 42 - 52: TypeVector 18(int) 2 - 53: TypePointer Function 52(ivec2) + 52: TypeVector 18(int64_t) 2 + 53: TypePointer Function 52(i64vec2) 55: TypeBool 56: TypeVector 55(bool) 2 57: TypePointer Function 56(bvec2) - 60: 18(int) Constant 0 0 - 61: 18(int) Constant 1 0 - 62: 52(ivec2) ConstantComposite 60 60 - 63: 52(ivec2) ConstantComposite 61 61 - 65: TypeVector 14(int) 2 - 66: TypePointer Function 65(ivec2) - 69: 14(int) Constant 0 0 - 70: 14(int) Constant 1 0 - 71: 65(ivec2) ConstantComposite 69 69 - 72: 65(ivec2) ConstantComposite 70 70 + 60: 18(int64_t) Constant 0 0 + 61: 18(int64_t) Constant 1 0 + 62: 52(i64vec2) ConstantComposite 60 60 + 63: 52(i64vec2) ConstantComposite 61 61 + 65: TypeVector 14(int64_t) 2 + 66: TypePointer Function 65(i64vec2) + 69: 14(int64_t) Constant 0 0 + 70: 14(int64_t) Constant 1 0 + 71: 65(i64vec2) ConstantComposite 69 69 + 72: 65(i64vec2) ConstantComposite 70 70 74: TypeVector 31(int) 2 75: TypePointer Function 74(ivec2) 81: TypeVector 21(int) 2 @@ -119,61 +140,62 @@ spv.int64.frag 89: TypeVector 88(float) 2 90: TypePointer Function 89(fvec2) 94: TypeFloat 64 - 95: TypeVector 94(float) 2 - 96: TypePointer Function 95(fvec2) - 132: TypeVector 14(int) 3 - 133: TypePointer Function 132(ivec3) - 136: TypeVector 18(int) 3 + 95: TypeVector 94(float64_t) 2 + 96: TypePointer Function 95(f64vec2) + 132: TypeVector 14(int64_t) 3 + 133: TypePointer Function 132(i64vec3) + 136: TypeVector 18(int64_t) 3 158: TypePointer Function 31(int) 164: TypeVector 21(int) 3 165: TypePointer Function 164(ivec3) 199: TypeVector 31(int) 3 - 202: 21(int) Constant 1 - 203: TypePointer Function 21(int) - 209: 21(int) Constant 2 - 217: TypePointer Function 55(bool) - 219: 21(int) Constant 0 - 289: 52(ivec2) ConstantComposite 25 25 - 298: 132(ivec3) ConstantComposite 69 69 69 - 340: 55(bool) ConstantTrue - 347: 55(bool) ConstantFalse - 348: 56(bvec2) ConstantComposite 347 347 - 360: TypeVector 55(bool) 3 - 361: 360(bvec3) ConstantComposite 347 347 347 - 363: TypeVector 94(float) 3 - 364: TypePointer Function 363(fvec3) - 369: TypePointer Function 94(float) - 380: 31(int) Constant 1 - 381: 31(int) Constant 2 - 382: 74(ivec2) ConstantComposite 380 381 - 387: 81(ivec2) ConstantComposite 209 22 - 392: TypePointer Function 360(bvec3) - 454(Block): TypeStruct 136(ivec3) 14(int) - 455: TypePointer Uniform 454(Block) - 456(block): 455(ptr) Variable Uniform - 457(si64): 18(int) SpecConstant 4294967286 4294967295 - 458(su64): 14(int) SpecConstant 20 0 - 459(si): 31(int) SpecConstant 4294967291 - 460(su): 21(int) SpecConstant 4 - 461(sb): 55(bool) SpecConstantTrue - 462: 55(bool) SpecConstantOp 171 457(si64) 69 - 463: 55(bool) SpecConstantOp 171 458(su64) 69 - 464: 18(int) SpecConstantOp 169 461(sb) 61 60 - 465: 14(int) SpecConstantOp 169 461(sb) 70 69 - 466: 31(int) SpecConstantOp 114 457(si64) - 467: 18(int) SpecConstantOp 114 459(si) - 468: 21(int) SpecConstantOp 113 458(su64) - 469: 14(int) SpecConstantOp 113 460(su) - 470: 18(int) SpecConstantOp 128 458(su64) 69 - 471: 14(int) SpecConstantOp 128 457(si64) 69 - 472: 21(int) SpecConstantOp 113 458(su64) - 473: 31(int) SpecConstantOp 128 472 219 - 474: 18(int) SpecConstantOp 114 459(si) - 475: 14(int) SpecConstantOp 128 474 69 - 476: 31(int) SpecConstantOp 114 457(si64) - 477: 21(int) SpecConstantOp 128 476 219 - 478: 14(int) SpecConstantOp 113 460(su) - 479: 18(int) SpecConstantOp 128 478 69 + 203: 21(int) Constant 1 + 204: TypePointer Function 21(int) + 217: 21(int) Constant 2 + 225: TypePointer Function 55(bool) + 227: 21(int) Constant 0 + 297: 52(i64vec2) ConstantComposite 25 25 + 306:132(i64vec3) ConstantComposite 69 69 69 + 348: 55(bool) ConstantTrue + 355: 55(bool) ConstantFalse + 356: 56(bvec2) ConstantComposite 355 355 + 368: TypeVector 55(bool) 3 + 369: 368(bvec3) ConstantComposite 355 355 355 + 371: TypeVector 94(float64_t) 3 + 372: TypePointer Function 371(f64vec3) + 377: TypePointer Function 94(float64_t) + 388: 31(int) Constant 1 + 389: 31(int) Constant 2 + 390: 74(ivec2) ConstantComposite 388 389 + 395: 81(ivec2) ConstantComposite 217 22 + 400: TypePointer Function 368(bvec3) + 462(Block): TypeStruct 136(i64vec3) 14(int64_t) + 463: TypePointer Uniform 462(Block) + 464(block): 463(ptr) Variable Uniform + 465(si64): 18(int64_t) SpecConstant 4294967286 4294967295 + 466(su64): 14(int64_t) SpecConstant 20 0 + 467(si): 31(int) SpecConstant 4294967291 + 468(su): 21(int) SpecConstant 4 + 469(sb): 55(bool) SpecConstantTrue + 470(su64inc): 14(int64_t) SpecConstantOp 128 466(su64) 70 + 471(i64_to_b): 55(bool) SpecConstantOp 171 465(si64) 69 + 472(u64_to_b): 55(bool) SpecConstantOp 171 466(su64) 69 + 473(b_to_i64): 18(int64_t) SpecConstantOp 169 469(sb) 61 60 + 474(b_to_u64): 14(int64_t) SpecConstantOp 169 469(sb) 70 69 + 475(i64_to_i): 31(int) SpecConstantOp 114 465(si64) + 476(i_to_i64): 18(int64_t) SpecConstantOp 114 467(si) + 477(u64_to_u): 21(int) SpecConstantOp 113 466(su64) + 478(u_to_u64): 14(int64_t) SpecConstantOp 113 468(su) + 479(u64_to_i64): 18(int64_t) SpecConstantOp 128 466(su64) 69 + 480(i64_to_u64): 14(int64_t) SpecConstantOp 128 465(si64) 69 + 481: 21(int) SpecConstantOp 113 466(su64) + 482(u64_to_i): 31(int) SpecConstantOp 128 481 227 + 483: 18(int64_t) SpecConstantOp 114 467(si) + 484(i_to_u64): 14(int64_t) SpecConstantOp 128 483 69 + 485: 31(int) SpecConstantOp 114 465(si64) + 486(i64_to_u): 21(int) SpecConstantOp 128 485 227 + 487: 14(int64_t) SpecConstantOp 113 468(su) + 488(u_to_i64): 18(int64_t) SpecConstantOp 128 487 69 4(main): 2 Function None 3 5: Label Store 16(u64Max) 17 @@ -189,13 +211,13 @@ spv.int64.frag 35: 21(int) Load 34 Store 37(indexable) 27 38: 19(ptr) AccessChain 37(indexable) 35 - 39: 18(int) Load 38 + 39: 18(int64_t) Load 38 Store 20(i64) 39 46: 33(ptr) AccessChain 30 32 47: 21(int) Load 46 Store 49(indexable) 45 50: 40(ptr) AccessChain 49(indexable) 47 - 51: 14(int) Load 50 + 51: 14(int64_t) Load 50 Store 41(u64) 51 Return FunctionEnd @@ -209,74 +231,74 @@ spv.int64.frag 91(fv): 90(ptr) Variable Function 97(dv): 96(ptr) Variable Function 59: 56(bvec2) Load 58(bv) - 64: 52(ivec2) Select 59 63 62 + 64: 52(i64vec2) Select 59 63 62 Store 54(i64v) 64 68: 56(bvec2) Load 58(bv) - 73: 65(ivec2) Select 68 72 71 + 73: 65(i64vec2) Select 68 72 71 Store 67(u64v) 73 77: 74(ivec2) Load 76(iv) - 78: 52(ivec2) SConvert 77 + 78: 52(i64vec2) SConvert 77 Store 54(i64v) 78 - 79: 52(ivec2) Load 54(i64v) + 79: 52(i64vec2) Load 54(i64v) 80: 74(ivec2) SConvert 79 Store 76(iv) 80 84: 81(ivec2) Load 83(uv) - 85: 65(ivec2) UConvert 84 + 85: 65(i64vec2) UConvert 84 Store 67(u64v) 85 - 86: 65(ivec2) Load 67(u64v) + 86: 65(i64vec2) Load 67(u64v) 87: 81(ivec2) UConvert 86 Store 83(uv) 87 - 92: 52(ivec2) Load 54(i64v) + 92: 52(i64vec2) Load 54(i64v) 93: 89(fvec2) ConvertSToF 92 Store 91(fv) 93 - 98: 52(ivec2) Load 54(i64v) - 99: 95(fvec2) ConvertSToF 98 + 98: 52(i64vec2) Load 54(i64v) + 99: 95(f64vec2) ConvertSToF 98 Store 97(dv) 99 - 100: 65(ivec2) Load 67(u64v) + 100: 65(i64vec2) Load 67(u64v) 101: 89(fvec2) ConvertUToF 100 Store 91(fv) 101 - 102: 65(ivec2) Load 67(u64v) - 103: 95(fvec2) ConvertUToF 102 + 102: 65(i64vec2) Load 67(u64v) + 103: 95(f64vec2) ConvertUToF 102 Store 97(dv) 103 104: 89(fvec2) Load 91(fv) - 105: 52(ivec2) ConvertFToS 104 + 105: 52(i64vec2) ConvertFToS 104 Store 54(i64v) 105 - 106: 95(fvec2) Load 97(dv) - 107: 52(ivec2) ConvertFToS 106 + 106: 95(f64vec2) Load 97(dv) + 107: 52(i64vec2) ConvertFToS 106 Store 54(i64v) 107 108: 89(fvec2) Load 91(fv) - 109: 65(ivec2) ConvertFToU 108 + 109: 65(i64vec2) ConvertFToU 108 Store 67(u64v) 109 - 110: 95(fvec2) Load 97(dv) - 111: 65(ivec2) ConvertFToU 110 + 110: 95(f64vec2) Load 97(dv) + 111: 65(i64vec2) ConvertFToU 110 Store 67(u64v) 111 - 112: 52(ivec2) Load 54(i64v) + 112: 52(i64vec2) Load 54(i64v) 113: 56(bvec2) INotEqual 112 71 Store 58(bv) 113 - 114: 65(ivec2) Load 67(u64v) + 114: 65(i64vec2) Load 67(u64v) 115: 56(bvec2) INotEqual 114 71 Store 58(bv) 115 - 116: 52(ivec2) Load 54(i64v) - 117: 65(ivec2) Bitcast 116 + 116: 52(i64vec2) Load 54(i64v) + 117: 65(i64vec2) Bitcast 116 Store 67(u64v) 117 - 118: 65(ivec2) Load 67(u64v) - 119: 52(ivec2) Bitcast 118 + 118: 65(i64vec2) Load 67(u64v) + 119: 52(i64vec2) Bitcast 118 Store 54(i64v) 119 - 120: 52(ivec2) Load 54(i64v) + 120: 52(i64vec2) Load 54(i64v) 121: 74(ivec2) SConvert 120 122: 81(ivec2) Bitcast 121 Store 83(uv) 122 123: 81(ivec2) Load 83(uv) - 124: 65(ivec2) UConvert 123 - 125: 52(ivec2) Bitcast 124 + 124: 65(i64vec2) UConvert 123 + 125: 52(i64vec2) Bitcast 124 Store 54(i64v) 125 - 126: 65(ivec2) Load 67(u64v) + 126: 65(i64vec2) Load 67(u64v) 127: 81(ivec2) UConvert 126 128: 74(ivec2) Bitcast 127 Store 76(iv) 128 129: 74(ivec2) Load 76(iv) - 130: 52(ivec2) SConvert 129 - 131: 65(ivec2) Bitcast 130 + 130: 52(i64vec2) SConvert 129 + 131: 65(i64vec2) Bitcast 130 Store 67(u64v) 131 Return FunctionEnd @@ -286,371 +308,381 @@ spv.int64.frag 139(i64): 19(ptr) Variable Function 159(i): 158(ptr) Variable Function 166(uv): 165(ptr) Variable Function - 218(b): 217(ptr) Variable Function - 135: 132(ivec3) Load 134(u64v) - 137: 136(ivec3) CompositeConstruct 61 61 61 - 138: 132(ivec3) IAdd 135 137 + 226(b): 225(ptr) Variable Function + 135:132(i64vec3) Load 134(u64v) + 137:136(i64vec3) CompositeConstruct 61 61 61 + 138:132(i64vec3) IAdd 135 137 Store 134(u64v) 138 - 140: 18(int) Load 139(i64) - 141: 18(int) ISub 140 61 + 140: 18(int64_t) Load 139(i64) + 141: 18(int64_t) ISub 140 61 Store 139(i64) 141 - 142: 18(int) Load 139(i64) - 143: 18(int) IAdd 142 61 + 142: 18(int64_t) Load 139(i64) + 143: 18(int64_t) IAdd 142 61 Store 139(i64) 143 - 144: 132(ivec3) Load 134(u64v) - 145: 136(ivec3) CompositeConstruct 61 61 61 - 146: 132(ivec3) ISub 144 145 + 144:132(i64vec3) Load 134(u64v) + 145:136(i64vec3) CompositeConstruct 61 61 61 + 146:132(i64vec3) ISub 144 145 Store 134(u64v) 146 - 147: 132(ivec3) Load 134(u64v) - 148: 132(ivec3) Not 147 + 147:132(i64vec3) Load 134(u64v) + 148:132(i64vec3) Not 147 Store 134(u64v) 148 - 149: 18(int) Load 139(i64) + 149: 18(int64_t) Load 139(i64) Store 139(i64) 149 - 150: 132(ivec3) Load 134(u64v) - 151: 132(ivec3) SNegate 150 + 150:132(i64vec3) Load 134(u64v) + 151:132(i64vec3) SNegate 150 Store 134(u64v) 151 - 152: 18(int) Load 139(i64) - 153: 18(int) Load 139(i64) - 154: 18(int) IAdd 153 152 + 152: 18(int64_t) Load 139(i64) + 153: 18(int64_t) Load 139(i64) + 154: 18(int64_t) IAdd 153 152 Store 139(i64) 154 - 155: 132(ivec3) Load 134(u64v) - 156: 132(ivec3) Load 134(u64v) - 157: 132(ivec3) ISub 156 155 + 155:132(i64vec3) Load 134(u64v) + 156:132(i64vec3) Load 134(u64v) + 157:132(i64vec3) ISub 156 155 Store 134(u64v) 157 160: 31(int) Load 159(i) - 161: 18(int) SConvert 160 - 162: 18(int) Load 139(i64) - 163: 18(int) IMul 162 161 + 161: 18(int64_t) SConvert 160 + 162: 18(int64_t) Load 139(i64) + 163: 18(int64_t) IMul 162 161 Store 139(i64) 163 167: 164(ivec3) Load 166(uv) - 168: 132(ivec3) UConvert 167 - 169: 132(ivec3) Load 134(u64v) - 170: 132(ivec3) UDiv 169 168 + 168:132(i64vec3) UConvert 167 + 169:132(i64vec3) Load 134(u64v) + 170:132(i64vec3) UDiv 169 168 Store 134(u64v) 170 171: 31(int) Load 159(i) - 172: 18(int) SConvert 171 - 173: 14(int) Bitcast 172 - 174: 132(ivec3) Load 134(u64v) - 175: 132(ivec3) CompositeConstruct 173 173 173 - 176: 132(ivec3) UMod 174 175 + 172: 18(int64_t) SConvert 171 + 173: 14(int64_t) Bitcast 172 + 174:132(i64vec3) Load 134(u64v) + 175:132(i64vec3) CompositeConstruct 173 173 173 + 176:132(i64vec3) UMod 174 175 Store 134(u64v) 176 - 177: 132(ivec3) Load 134(u64v) + 177:132(i64vec3) Load 134(u64v) 178: 164(ivec3) Load 166(uv) - 179: 132(ivec3) UConvert 178 - 180: 132(ivec3) IAdd 177 179 + 179:132(i64vec3) UConvert 178 + 180:132(i64vec3) IAdd 177 179 Store 134(u64v) 180 - 181: 18(int) Load 139(i64) + 181: 18(int64_t) Load 139(i64) 182: 31(int) Load 159(i) - 183: 18(int) SConvert 182 - 184: 18(int) ISub 181 183 + 183: 18(int64_t) SConvert 182 + 184: 18(int64_t) ISub 181 183 Store 139(i64) 184 - 185: 132(ivec3) Load 134(u64v) + 185:132(i64vec3) Load 134(u64v) 186: 164(ivec3) Load 166(uv) - 187: 132(ivec3) UConvert 186 - 188: 132(ivec3) IMul 185 187 + 187:132(i64vec3) UConvert 186 + 188:132(i64vec3) IMul 185 187 Store 134(u64v) 188 - 189: 18(int) Load 139(i64) + 189: 18(int64_t) Load 139(i64) 190: 31(int) Load 159(i) - 191: 18(int) SConvert 190 - 192: 18(int) IMul 189 191 + 191: 18(int64_t) SConvert 190 + 192: 18(int64_t) IMul 189 191 Store 139(i64) 192 - 193: 18(int) Load 139(i64) + 193: 18(int64_t) Load 139(i64) 194: 31(int) Load 159(i) - 195: 18(int) SConvert 194 - 196: 18(int) SMod 193 195 + 195: 18(int64_t) SConvert 194 + 196: 18(int64_t) SMod 193 195 Store 139(i64) 196 - 197: 31(int) Load 159(i) - 198: 132(ivec3) Load 134(u64v) - 200: 199(ivec3) CompositeConstruct 197 197 197 - 201: 132(ivec3) ShiftLeftLogical 198 200 + 197:132(i64vec3) Load 134(u64v) + 198: 31(int) Load 159(i) + 200: 199(ivec3) CompositeConstruct 198 198 198 + 201:132(i64vec3) ShiftLeftLogical 197 200 Store 134(u64v) 201 - 204: 203(ptr) AccessChain 166(uv) 202 - 205: 21(int) Load 204 - 206: 18(int) Load 139(i64) - 207: 18(int) ShiftRightArithmetic 206 205 + 202: 18(int64_t) Load 139(i64) + 205: 204(ptr) AccessChain 166(uv) 203 + 206: 21(int) Load 205 + 207: 18(int64_t) ShiftRightArithmetic 202 206 Store 139(i64) 207 - 208: 18(int) Load 139(i64) - 210: 40(ptr) AccessChain 134(u64v) 209 - 211: 14(int) Load 210 - 212: 18(int) ShiftLeftLogical 208 211 - Store 139(i64) 212 - 213: 132(ivec3) Load 134(u64v) - 214: 18(int) Load 139(i64) - 215: 136(ivec3) CompositeConstruct 214 214 214 - 216: 132(ivec3) ShiftLeftLogical 213 215 - Store 134(u64v) 216 - 220: 40(ptr) AccessChain 134(u64v) 219 - 221: 14(int) Load 220 - 222: 18(int) Load 139(i64) - 223: 14(int) Bitcast 222 - 224: 55(bool) INotEqual 221 223 - Store 218(b) 224 - 225: 18(int) Load 139(i64) - 226: 14(int) Bitcast 225 - 227: 40(ptr) AccessChain 134(u64v) 219 - 228: 14(int) Load 227 - 229: 55(bool) IEqual 226 228 - Store 218(b) 229 - 230: 40(ptr) AccessChain 134(u64v) 219 - 231: 14(int) Load 230 - 232: 203(ptr) AccessChain 166(uv) 202 - 233: 21(int) Load 232 - 234: 14(int) UConvert 233 - 235: 55(bool) UGreaterThan 231 234 - Store 218(b) 235 - 236: 18(int) Load 139(i64) - 237: 31(int) Load 159(i) - 238: 18(int) SConvert 237 - 239: 55(bool) SLessThan 236 238 - Store 218(b) 239 - 240: 40(ptr) AccessChain 134(u64v) 202 - 241: 14(int) Load 240 - 242: 203(ptr) AccessChain 166(uv) 219 - 243: 21(int) Load 242 - 244: 14(int) UConvert 243 - 245: 55(bool) UGreaterThanEqual 241 244 - Store 218(b) 245 - 246: 18(int) Load 139(i64) - 247: 31(int) Load 159(i) - 248: 18(int) SConvert 247 - 249: 55(bool) SLessThanEqual 246 248 - Store 218(b) 249 - 250: 31(int) Load 159(i) - 251: 18(int) SConvert 250 - 252: 14(int) Bitcast 251 - 253: 132(ivec3) Load 134(u64v) - 254: 132(ivec3) CompositeConstruct 252 252 252 - 255: 132(ivec3) BitwiseOr 253 254 - Store 134(u64v) 255 - 256: 18(int) Load 139(i64) - 257: 31(int) Load 159(i) - 258: 18(int) SConvert 257 - 259: 18(int) BitwiseOr 256 258 - Store 139(i64) 259 - 260: 31(int) Load 159(i) - 261: 18(int) SConvert 260 - 262: 18(int) Load 139(i64) - 263: 18(int) BitwiseAnd 262 261 - Store 139(i64) 263 - 264: 132(ivec3) Load 134(u64v) - 265: 164(ivec3) Load 166(uv) - 266: 132(ivec3) UConvert 265 - 267: 132(ivec3) BitwiseAnd 264 266 - Store 134(u64v) 267 - 268: 18(int) Load 139(i64) - 269: 14(int) Bitcast 268 - 270: 132(ivec3) Load 134(u64v) - 271: 132(ivec3) CompositeConstruct 269 269 269 - 272: 132(ivec3) BitwiseXor 270 271 - Store 134(u64v) 272 - 273: 132(ivec3) Load 134(u64v) - 274: 18(int) Load 139(i64) - 275: 14(int) Bitcast 274 - 276: 132(ivec3) CompositeConstruct 275 275 275 - 277: 132(ivec3) BitwiseXor 273 276 - Store 134(u64v) 277 + 208: 31(int) Load 159(i) + 209:132(i64vec3) Load 134(u64v) + 210: 199(ivec3) CompositeConstruct 208 208 208 + 211:132(i64vec3) ShiftLeftLogical 209 210 + Store 134(u64v) 211 + 212: 204(ptr) AccessChain 166(uv) 203 + 213: 21(int) Load 212 + 214: 18(int64_t) Load 139(i64) + 215: 18(int64_t) ShiftRightArithmetic 214 213 + Store 139(i64) 215 + 216: 18(int64_t) Load 139(i64) + 218: 40(ptr) AccessChain 134(u64v) 217 + 219: 14(int64_t) Load 218 + 220: 18(int64_t) ShiftLeftLogical 216 219 + Store 139(i64) 220 + 221:132(i64vec3) Load 134(u64v) + 222: 18(int64_t) Load 139(i64) + 223:136(i64vec3) CompositeConstruct 222 222 222 + 224:132(i64vec3) ShiftLeftLogical 221 223 + Store 134(u64v) 224 + 228: 40(ptr) AccessChain 134(u64v) 227 + 229: 14(int64_t) Load 228 + 230: 18(int64_t) Load 139(i64) + 231: 14(int64_t) Bitcast 230 + 232: 55(bool) INotEqual 229 231 + Store 226(b) 232 + 233: 18(int64_t) Load 139(i64) + 234: 14(int64_t) Bitcast 233 + 235: 40(ptr) AccessChain 134(u64v) 227 + 236: 14(int64_t) Load 235 + 237: 55(bool) IEqual 234 236 + Store 226(b) 237 + 238: 40(ptr) AccessChain 134(u64v) 227 + 239: 14(int64_t) Load 238 + 240: 204(ptr) AccessChain 166(uv) 203 + 241: 21(int) Load 240 + 242: 14(int64_t) UConvert 241 + 243: 55(bool) UGreaterThan 239 242 + Store 226(b) 243 + 244: 18(int64_t) Load 139(i64) + 245: 31(int) Load 159(i) + 246: 18(int64_t) SConvert 245 + 247: 55(bool) SLessThan 244 246 + Store 226(b) 247 + 248: 40(ptr) AccessChain 134(u64v) 203 + 249: 14(int64_t) Load 248 + 250: 204(ptr) AccessChain 166(uv) 227 + 251: 21(int) Load 250 + 252: 14(int64_t) UConvert 251 + 253: 55(bool) UGreaterThanEqual 249 252 + Store 226(b) 253 + 254: 18(int64_t) Load 139(i64) + 255: 31(int) Load 159(i) + 256: 18(int64_t) SConvert 255 + 257: 55(bool) SLessThanEqual 254 256 + Store 226(b) 257 + 258: 31(int) Load 159(i) + 259: 18(int64_t) SConvert 258 + 260: 14(int64_t) Bitcast 259 + 261:132(i64vec3) Load 134(u64v) + 262:132(i64vec3) CompositeConstruct 260 260 260 + 263:132(i64vec3) BitwiseOr 261 262 + Store 134(u64v) 263 + 264: 18(int64_t) Load 139(i64) + 265: 31(int) Load 159(i) + 266: 18(int64_t) SConvert 265 + 267: 18(int64_t) BitwiseOr 264 266 + Store 139(i64) 267 + 268: 31(int) Load 159(i) + 269: 18(int64_t) SConvert 268 + 270: 18(int64_t) Load 139(i64) + 271: 18(int64_t) BitwiseAnd 270 269 + Store 139(i64) 271 + 272:132(i64vec3) Load 134(u64v) + 273: 164(ivec3) Load 166(uv) + 274:132(i64vec3) UConvert 273 + 275:132(i64vec3) BitwiseAnd 272 274 + Store 134(u64v) 275 + 276: 18(int64_t) Load 139(i64) + 277: 14(int64_t) Bitcast 276 + 278:132(i64vec3) Load 134(u64v) + 279:132(i64vec3) CompositeConstruct 277 277 277 + 280:132(i64vec3) BitwiseXor 278 279 + Store 134(u64v) 280 + 281:132(i64vec3) Load 134(u64v) + 282: 18(int64_t) Load 139(i64) + 283: 14(int64_t) Bitcast 282 + 284:132(i64vec3) CompositeConstruct 283 283 283 + 285:132(i64vec3) BitwiseXor 281 284 + Store 134(u64v) 285 Return FunctionEnd 12(builtinFuncs(): 2 Function None 3 13: Label - 278(i64v): 53(ptr) Variable Function - 281(i64): 19(ptr) Variable Function - 291(u64v): 133(ptr) Variable Function - 293(u64): 40(ptr) Variable Function - 365(dv): 364(ptr) Variable Function - 384(iv): 75(ptr) Variable Function - 389(uv): 82(ptr) Variable Function - 393(bv): 392(ptr) Variable Function - 279: 52(ivec2) Load 278(i64v) - 280: 52(ivec2) ExtInst 1(GLSL.std.450) 5(SAbs) 279 - Store 278(i64v) 280 - 282: 18(int) Load 281(i64) - 283: 18(int) ExtInst 1(GLSL.std.450) 7(SSign) 282 - Store 281(i64) 283 - 284: 52(ivec2) Load 278(i64v) - 285: 18(int) Load 281(i64) - 286: 52(ivec2) CompositeConstruct 285 285 - 287: 52(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 284 286 - Store 278(i64v) 287 - 288: 52(ivec2) Load 278(i64v) - 290: 52(ivec2) ExtInst 1(GLSL.std.450) 39(SMin) 288 289 - Store 278(i64v) 290 - 292: 132(ivec3) Load 291(u64v) - 294: 14(int) Load 293(u64) - 295: 132(ivec3) CompositeConstruct 294 294 294 - 296: 132(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 292 295 - Store 291(u64v) 296 - 297: 132(ivec3) Load 291(u64v) - 299: 132(ivec3) ExtInst 1(GLSL.std.450) 38(UMin) 297 298 - Store 291(u64v) 299 - 300: 52(ivec2) Load 278(i64v) - 301: 18(int) Load 281(i64) - 302: 52(ivec2) CompositeConstruct 301 301 - 303: 52(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 300 302 - Store 278(i64v) 303 - 304: 52(ivec2) Load 278(i64v) - 305: 52(ivec2) ExtInst 1(GLSL.std.450) 42(SMax) 304 289 - Store 278(i64v) 305 - 306: 132(ivec3) Load 291(u64v) - 307: 14(int) Load 293(u64) - 308: 132(ivec3) CompositeConstruct 307 307 307 - 309: 132(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 306 308 - Store 291(u64v) 309 - 310: 132(ivec3) Load 291(u64v) - 311: 132(ivec3) ExtInst 1(GLSL.std.450) 41(UMax) 310 298 - Store 291(u64v) 311 - 312: 52(ivec2) Load 278(i64v) - 313: 18(int) Load 281(i64) - 314: 18(int) SNegate 313 - 315: 18(int) Load 281(i64) - 316: 52(ivec2) CompositeConstruct 314 314 - 317: 52(ivec2) CompositeConstruct 315 315 - 318: 52(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 312 316 317 - Store 278(i64v) 318 - 319: 52(ivec2) Load 278(i64v) - 320: 52(ivec2) Load 278(i64v) - 321: 52(ivec2) SNegate 320 - 322: 52(ivec2) Load 278(i64v) - 323: 52(ivec2) ExtInst 1(GLSL.std.450) 45(SClamp) 319 321 322 - Store 278(i64v) 323 - 324: 132(ivec3) Load 291(u64v) - 325: 14(int) Load 293(u64) - 326: 14(int) SNegate 325 - 327: 14(int) Load 293(u64) - 328: 132(ivec3) CompositeConstruct 326 326 326 - 329: 132(ivec3) CompositeConstruct 327 327 327 - 330: 132(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 324 328 329 - Store 291(u64v) 330 - 331: 132(ivec3) Load 291(u64v) - 332: 132(ivec3) Load 291(u64v) - 333: 132(ivec3) SNegate 332 - 334: 132(ivec3) Load 291(u64v) - 335: 132(ivec3) ExtInst 1(GLSL.std.450) 44(UClamp) 331 333 334 - Store 291(u64v) 335 - 336: 19(ptr) AccessChain 278(i64v) 219 - 337: 18(int) Load 336 - 338: 19(ptr) AccessChain 278(i64v) 202 - 339: 18(int) Load 338 - 341: 18(int) Select 340 339 337 - Store 281(i64) 341 - 342: 18(int) Load 281(i64) - 343: 52(ivec2) CompositeConstruct 342 342 - 344: 18(int) Load 281(i64) - 345: 18(int) SNegate 344 - 346: 52(ivec2) CompositeConstruct 345 345 - 349: 52(ivec2) Select 348 346 343 - Store 278(i64v) 349 - 350: 40(ptr) AccessChain 291(u64v) 219 - 351: 14(int) Load 350 - 352: 40(ptr) AccessChain 291(u64v) 202 - 353: 14(int) Load 352 - 354: 14(int) Select 340 353 351 - Store 293(u64) 354 - 355: 14(int) Load 293(u64) - 356: 132(ivec3) CompositeConstruct 355 355 355 - 357: 14(int) Load 293(u64) - 358: 14(int) SNegate 357 - 359: 132(ivec3) CompositeConstruct 358 358 358 - 362: 132(ivec3) Select 361 359 356 - Store 291(u64v) 362 - 366: 363(fvec3) Load 365(dv) - 367: 95(fvec2) VectorShuffle 366 366 0 1 - 368: 52(ivec2) Bitcast 367 - Store 278(i64v) 368 - 370: 369(ptr) AccessChain 365(dv) 209 - 371: 94(float) Load 370 - 372: 14(int) Bitcast 371 - 373: 40(ptr) AccessChain 291(u64v) 219 - Store 373 372 - 374: 52(ivec2) Load 278(i64v) - 375: 95(fvec2) Bitcast 374 - 376: 363(fvec3) Load 365(dv) - 377: 363(fvec3) VectorShuffle 376 375 3 4 2 - Store 365(dv) 377 - 378: 132(ivec3) Load 291(u64v) - 379: 363(fvec3) Bitcast 378 - Store 365(dv) 379 - 383: 18(int) Bitcast 382 - Store 281(i64) 383 - 385: 18(int) Load 281(i64) - 386: 74(ivec2) Bitcast 385 - Store 384(iv) 386 - 388: 14(int) Bitcast 387 - Store 293(u64) 388 - 390: 14(int) Load 293(u64) - 391: 81(ivec2) Bitcast 390 - Store 389(uv) 391 - 394: 132(ivec3) Load 291(u64v) - 395: 14(int) Load 293(u64) - 396: 132(ivec3) CompositeConstruct 395 395 395 - 397: 360(bvec3) ULessThan 394 396 - Store 393(bv) 397 - 398: 52(ivec2) Load 278(i64v) - 399: 18(int) Load 281(i64) - 400: 52(ivec2) CompositeConstruct 399 399 - 401: 56(bvec2) SLessThan 398 400 - 402: 360(bvec3) Load 393(bv) - 403: 360(bvec3) VectorShuffle 402 401 3 4 2 - Store 393(bv) 403 - 404: 132(ivec3) Load 291(u64v) - 405: 14(int) Load 293(u64) - 406: 132(ivec3) CompositeConstruct 405 405 405 - 407: 360(bvec3) ULessThanEqual 404 406 - Store 393(bv) 407 - 408: 52(ivec2) Load 278(i64v) - 409: 18(int) Load 281(i64) - 410: 52(ivec2) CompositeConstruct 409 409 - 411: 56(bvec2) SLessThanEqual 408 410 - 412: 360(bvec3) Load 393(bv) - 413: 360(bvec3) VectorShuffle 412 411 3 4 2 - Store 393(bv) 413 - 414: 132(ivec3) Load 291(u64v) - 415: 14(int) Load 293(u64) - 416: 132(ivec3) CompositeConstruct 415 415 415 - 417: 360(bvec3) UGreaterThan 414 416 - Store 393(bv) 417 - 418: 52(ivec2) Load 278(i64v) - 419: 18(int) Load 281(i64) - 420: 52(ivec2) CompositeConstruct 419 419 - 421: 56(bvec2) SGreaterThan 418 420 - 422: 360(bvec3) Load 393(bv) - 423: 360(bvec3) VectorShuffle 422 421 3 4 2 - Store 393(bv) 423 - 424: 132(ivec3) Load 291(u64v) - 425: 14(int) Load 293(u64) - 426: 132(ivec3) CompositeConstruct 425 425 425 - 427: 360(bvec3) UGreaterThanEqual 424 426 - Store 393(bv) 427 - 428: 52(ivec2) Load 278(i64v) - 429: 18(int) Load 281(i64) - 430: 52(ivec2) CompositeConstruct 429 429 - 431: 56(bvec2) SGreaterThanEqual 428 430 - 432: 360(bvec3) Load 393(bv) - 433: 360(bvec3) VectorShuffle 432 431 3 4 2 - Store 393(bv) 433 - 434: 132(ivec3) Load 291(u64v) - 435: 14(int) Load 293(u64) - 436: 132(ivec3) CompositeConstruct 435 435 435 - 437: 360(bvec3) IEqual 434 436 - Store 393(bv) 437 - 438: 52(ivec2) Load 278(i64v) - 439: 18(int) Load 281(i64) - 440: 52(ivec2) CompositeConstruct 439 439 - 441: 56(bvec2) IEqual 438 440 - 442: 360(bvec3) Load 393(bv) - 443: 360(bvec3) VectorShuffle 442 441 3 4 2 - Store 393(bv) 443 - 444: 132(ivec3) Load 291(u64v) - 445: 14(int) Load 293(u64) - 446: 132(ivec3) CompositeConstruct 445 445 445 - 447: 360(bvec3) INotEqual 444 446 - Store 393(bv) 447 - 448: 52(ivec2) Load 278(i64v) - 449: 18(int) Load 281(i64) - 450: 52(ivec2) CompositeConstruct 449 449 - 451: 56(bvec2) INotEqual 448 450 - 452: 360(bvec3) Load 393(bv) - 453: 360(bvec3) VectorShuffle 452 451 3 4 2 - Store 393(bv) 453 + 286(i64v): 53(ptr) Variable Function + 289(i64): 19(ptr) Variable Function + 299(u64v): 133(ptr) Variable Function + 301(u64): 40(ptr) Variable Function + 373(dv): 372(ptr) Variable Function + 392(iv): 75(ptr) Variable Function + 397(uv): 82(ptr) Variable Function + 401(bv): 400(ptr) Variable Function + 287: 52(i64vec2) Load 286(i64v) + 288: 52(i64vec2) ExtInst 1(GLSL.std.450) 5(SAbs) 287 + Store 286(i64v) 288 + 290: 18(int64_t) Load 289(i64) + 291: 18(int64_t) ExtInst 1(GLSL.std.450) 7(SSign) 290 + Store 289(i64) 291 + 292: 52(i64vec2) Load 286(i64v) + 293: 18(int64_t) Load 289(i64) + 294: 52(i64vec2) CompositeConstruct 293 293 + 295: 52(i64vec2) ExtInst 1(GLSL.std.450) 39(SMin) 292 294 + Store 286(i64v) 295 + 296: 52(i64vec2) Load 286(i64v) + 298: 52(i64vec2) ExtInst 1(GLSL.std.450) 39(SMin) 296 297 + Store 286(i64v) 298 + 300:132(i64vec3) Load 299(u64v) + 302: 14(int64_t) Load 301(u64) + 303:132(i64vec3) CompositeConstruct 302 302 302 + 304:132(i64vec3) ExtInst 1(GLSL.std.450) 38(UMin) 300 303 + Store 299(u64v) 304 + 305:132(i64vec3) Load 299(u64v) + 307:132(i64vec3) ExtInst 1(GLSL.std.450) 38(UMin) 305 306 + Store 299(u64v) 307 + 308: 52(i64vec2) Load 286(i64v) + 309: 18(int64_t) Load 289(i64) + 310: 52(i64vec2) CompositeConstruct 309 309 + 311: 52(i64vec2) ExtInst 1(GLSL.std.450) 42(SMax) 308 310 + Store 286(i64v) 311 + 312: 52(i64vec2) Load 286(i64v) + 313: 52(i64vec2) ExtInst 1(GLSL.std.450) 42(SMax) 312 297 + Store 286(i64v) 313 + 314:132(i64vec3) Load 299(u64v) + 315: 14(int64_t) Load 301(u64) + 316:132(i64vec3) CompositeConstruct 315 315 315 + 317:132(i64vec3) ExtInst 1(GLSL.std.450) 41(UMax) 314 316 + Store 299(u64v) 317 + 318:132(i64vec3) Load 299(u64v) + 319:132(i64vec3) ExtInst 1(GLSL.std.450) 41(UMax) 318 306 + Store 299(u64v) 319 + 320: 52(i64vec2) Load 286(i64v) + 321: 18(int64_t) Load 289(i64) + 322: 18(int64_t) SNegate 321 + 323: 18(int64_t) Load 289(i64) + 324: 52(i64vec2) CompositeConstruct 322 322 + 325: 52(i64vec2) CompositeConstruct 323 323 + 326: 52(i64vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 320 324 325 + Store 286(i64v) 326 + 327: 52(i64vec2) Load 286(i64v) + 328: 52(i64vec2) Load 286(i64v) + 329: 52(i64vec2) SNegate 328 + 330: 52(i64vec2) Load 286(i64v) + 331: 52(i64vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 327 329 330 + Store 286(i64v) 331 + 332:132(i64vec3) Load 299(u64v) + 333: 14(int64_t) Load 301(u64) + 334: 14(int64_t) SNegate 333 + 335: 14(int64_t) Load 301(u64) + 336:132(i64vec3) CompositeConstruct 334 334 334 + 337:132(i64vec3) CompositeConstruct 335 335 335 + 338:132(i64vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 332 336 337 + Store 299(u64v) 338 + 339:132(i64vec3) Load 299(u64v) + 340:132(i64vec3) Load 299(u64v) + 341:132(i64vec3) SNegate 340 + 342:132(i64vec3) Load 299(u64v) + 343:132(i64vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 339 341 342 + Store 299(u64v) 343 + 344: 19(ptr) AccessChain 286(i64v) 227 + 345: 18(int64_t) Load 344 + 346: 19(ptr) AccessChain 286(i64v) 203 + 347: 18(int64_t) Load 346 + 349: 18(int64_t) Select 348 347 345 + Store 289(i64) 349 + 350: 18(int64_t) Load 289(i64) + 351: 52(i64vec2) CompositeConstruct 350 350 + 352: 18(int64_t) Load 289(i64) + 353: 18(int64_t) SNegate 352 + 354: 52(i64vec2) CompositeConstruct 353 353 + 357: 52(i64vec2) Select 356 354 351 + Store 286(i64v) 357 + 358: 40(ptr) AccessChain 299(u64v) 227 + 359: 14(int64_t) Load 358 + 360: 40(ptr) AccessChain 299(u64v) 203 + 361: 14(int64_t) Load 360 + 362: 14(int64_t) Select 348 361 359 + Store 301(u64) 362 + 363: 14(int64_t) Load 301(u64) + 364:132(i64vec3) CompositeConstruct 363 363 363 + 365: 14(int64_t) Load 301(u64) + 366: 14(int64_t) SNegate 365 + 367:132(i64vec3) CompositeConstruct 366 366 366 + 370:132(i64vec3) Select 369 367 364 + Store 299(u64v) 370 + 374:371(f64vec3) Load 373(dv) + 375: 95(f64vec2) VectorShuffle 374 374 0 1 + 376: 52(i64vec2) Bitcast 375 + Store 286(i64v) 376 + 378: 377(ptr) AccessChain 373(dv) 217 + 379:94(float64_t) Load 378 + 380: 14(int64_t) Bitcast 379 + 381: 40(ptr) AccessChain 299(u64v) 227 + Store 381 380 + 382: 52(i64vec2) Load 286(i64v) + 383: 95(f64vec2) Bitcast 382 + 384:371(f64vec3) Load 373(dv) + 385:371(f64vec3) VectorShuffle 384 383 3 4 2 + Store 373(dv) 385 + 386:132(i64vec3) Load 299(u64v) + 387:371(f64vec3) Bitcast 386 + Store 373(dv) 387 + 391: 18(int64_t) Bitcast 390 + Store 289(i64) 391 + 393: 18(int64_t) Load 289(i64) + 394: 74(ivec2) Bitcast 393 + Store 392(iv) 394 + 396: 14(int64_t) Bitcast 395 + Store 301(u64) 396 + 398: 14(int64_t) Load 301(u64) + 399: 81(ivec2) Bitcast 398 + Store 397(uv) 399 + 402:132(i64vec3) Load 299(u64v) + 403: 14(int64_t) Load 301(u64) + 404:132(i64vec3) CompositeConstruct 403 403 403 + 405: 368(bvec3) ULessThan 402 404 + Store 401(bv) 405 + 406: 52(i64vec2) Load 286(i64v) + 407: 18(int64_t) Load 289(i64) + 408: 52(i64vec2) CompositeConstruct 407 407 + 409: 56(bvec2) SLessThan 406 408 + 410: 368(bvec3) Load 401(bv) + 411: 368(bvec3) VectorShuffle 410 409 3 4 2 + Store 401(bv) 411 + 412:132(i64vec3) Load 299(u64v) + 413: 14(int64_t) Load 301(u64) + 414:132(i64vec3) CompositeConstruct 413 413 413 + 415: 368(bvec3) ULessThanEqual 412 414 + Store 401(bv) 415 + 416: 52(i64vec2) Load 286(i64v) + 417: 18(int64_t) Load 289(i64) + 418: 52(i64vec2) CompositeConstruct 417 417 + 419: 56(bvec2) SLessThanEqual 416 418 + 420: 368(bvec3) Load 401(bv) + 421: 368(bvec3) VectorShuffle 420 419 3 4 2 + Store 401(bv) 421 + 422:132(i64vec3) Load 299(u64v) + 423: 14(int64_t) Load 301(u64) + 424:132(i64vec3) CompositeConstruct 423 423 423 + 425: 368(bvec3) UGreaterThan 422 424 + Store 401(bv) 425 + 426: 52(i64vec2) Load 286(i64v) + 427: 18(int64_t) Load 289(i64) + 428: 52(i64vec2) CompositeConstruct 427 427 + 429: 56(bvec2) SGreaterThan 426 428 + 430: 368(bvec3) Load 401(bv) + 431: 368(bvec3) VectorShuffle 430 429 3 4 2 + Store 401(bv) 431 + 432:132(i64vec3) Load 299(u64v) + 433: 14(int64_t) Load 301(u64) + 434:132(i64vec3) CompositeConstruct 433 433 433 + 435: 368(bvec3) UGreaterThanEqual 432 434 + Store 401(bv) 435 + 436: 52(i64vec2) Load 286(i64v) + 437: 18(int64_t) Load 289(i64) + 438: 52(i64vec2) CompositeConstruct 437 437 + 439: 56(bvec2) SGreaterThanEqual 436 438 + 440: 368(bvec3) Load 401(bv) + 441: 368(bvec3) VectorShuffle 440 439 3 4 2 + Store 401(bv) 441 + 442:132(i64vec3) Load 299(u64v) + 443: 14(int64_t) Load 301(u64) + 444:132(i64vec3) CompositeConstruct 443 443 443 + 445: 368(bvec3) IEqual 442 444 + Store 401(bv) 445 + 446: 52(i64vec2) Load 286(i64v) + 447: 18(int64_t) Load 289(i64) + 448: 52(i64vec2) CompositeConstruct 447 447 + 449: 56(bvec2) IEqual 446 448 + 450: 368(bvec3) Load 401(bv) + 451: 368(bvec3) VectorShuffle 450 449 3 4 2 + Store 401(bv) 451 + 452:132(i64vec3) Load 299(u64v) + 453: 14(int64_t) Load 301(u64) + 454:132(i64vec3) CompositeConstruct 453 453 453 + 455: 368(bvec3) INotEqual 452 454 + Store 401(bv) 455 + 456: 52(i64vec2) Load 286(i64v) + 457: 18(int64_t) Load 289(i64) + 458: 52(i64vec2) CompositeConstruct 457 457 + 459: 56(bvec2) INotEqual 456 458 + 460: 368(bvec3) Load 401(bv) + 461: 368(bvec3) VectorShuffle 460 459 3 4 2 + Store 401(bv) 461 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int8.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int8.frag.out new file mode 100644 index 00000000000..1c65384f377 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.int8.frag.out @@ -0,0 +1,741 @@ +spv.int8.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.1 specification (or requires extension) + OpCapability Float16 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 518 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + Capability CapabilityUniformAndStorageBuffer8BitAccess + Extension "SPV_KHR_8bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" + Name 4 "main" + Name 6 "literal(" + Name 8 "typeCast8(" + Name 10 "operators(" + Name 12 "builtinFuncs(" + Name 16 "i8" + Name 24 "Uniforms" + MemberName 24(Uniforms) 0 "index" + Name 26 "" + Name 33 "indexable" + Name 38 "u8" + Name 46 "indexable" + Name 51 "u8v" + Name 54 "i8v" + Name 60 "i16v" + Name 70 "i32v" + Name 78 "u32v" + Name 85 "i64v" + Name 91 "u64v" + Name 105 "f16v" + Name 111 "f32v" + Name 117 "f64v" + Name 144 "u16v" + Name 174 "bv" + Name 192 "u8v" + Name 197 "i8" + Name 217 "i" + Name 224 "uv" + Name 240 "i16" + Name 276 "b" + Name 338 "i8v" + Name 341 "i8" + Name 351 "u8v" + Name 353 "u8" + Name 423 "i16" + Name 426 "i32" + Name 429 "i8v4" + Name 433 "u16" + Name 434 "u8v2" + Name 437 "u32" + Name 440 "u8v4" + Name 452 "bv" + Name 513 "Block" + MemberName 513(Block) 0 "i8" + MemberName 513(Block) 1 "i8v2" + MemberName 513(Block) 2 "i8v3" + MemberName 513(Block) 3 "i8v4" + MemberName 513(Block) 4 "u8" + MemberName 513(Block) 5 "u8v2" + MemberName 513(Block) 6 "u8v3" + MemberName 513(Block) 7 "u8v4" + Name 515 "block" + Name 516 "si8" + Name 517 "su8" + MemberDecorate 24(Uniforms) 0 Offset 0 + Decorate 24(Uniforms) Block + Decorate 26 DescriptorSet 0 + Decorate 26 Binding 0 + MemberDecorate 513(Block) 0 Offset 0 + MemberDecorate 513(Block) 1 Offset 2 + MemberDecorate 513(Block) 2 Offset 4 + MemberDecorate 513(Block) 3 Offset 8 + MemberDecorate 513(Block) 4 Offset 12 + MemberDecorate 513(Block) 5 Offset 14 + MemberDecorate 513(Block) 6 Offset 16 + MemberDecorate 513(Block) 7 Offset 20 + Decorate 513(Block) Block + Decorate 515(block) DescriptorSet 0 + Decorate 515(block) Binding 1 + Decorate 516(si8) SpecId 100 + Decorate 517(su8) SpecId 101 + 2: TypeVoid + 3: TypeFunction 2 + 14: TypeInt 8 1 + 15: TypePointer Function 14(int8_t) + 17: TypeInt 32 0 + 18: 17(int) Constant 3 + 19: TypeArray 14(int8_t) 18 + 20: 14(int8_t) Constant 4294967279 + 21: 14(int8_t) Constant 4294967295 + 22: 14(int8_t) Constant 0 + 23: 19 ConstantComposite 20 21 22 + 24(Uniforms): TypeStruct 17(int) + 25: TypePointer Uniform 24(Uniforms) + 26: 25(ptr) Variable Uniform + 27: TypeInt 32 1 + 28: 27(int) Constant 0 + 29: TypePointer Uniform 17(int) + 32: TypePointer Function 19 + 36: TypeInt 8 0 + 37: TypePointer Function 36(int8_t) + 39: TypeArray 36(int8_t) 18 + 40: 36(int8_t) Constant 255 + 41: 36(int8_t) Constant 127 + 42: 39 ConstantComposite 40 40 41 + 45: TypePointer Function 39 + 49: TypeVector 36(int8_t) 2 + 50: TypePointer Function 49(i8vec2) + 52: TypeVector 14(int8_t) 2 + 53: TypePointer Function 52(i8vec2) + 57: TypeInt 16 1 + 58: TypeVector 57(int16_t) 2 + 59: TypePointer Function 58(i16vec2) + 64: TypeInt 16 0 + 65: TypeVector 64(int16_t) 2 + 68: TypeVector 27(int) 2 + 69: TypePointer Function 68(ivec2) + 74: TypeVector 17(int) 2 + 77: TypePointer Function 74(ivec2) + 82: TypeInt 64 1 + 83: TypeVector 82(int64_t) 2 + 84: TypePointer Function 83(i64vec2) + 88: TypeInt 64 0 + 89: TypeVector 88(int64_t) 2 + 90: TypePointer Function 89(i64vec2) + 102: TypeFloat 16 + 103: TypeVector 102(float16_t) 2 + 104: TypePointer Function 103(f16vec2) + 108: TypeFloat 32 + 109: TypeVector 108(float) 2 + 110: TypePointer Function 109(fvec2) + 114: TypeFloat 64 + 115: TypeVector 114(float64_t) 2 + 116: TypePointer Function 115(f64vec2) + 143: TypePointer Function 65(i16vec2) + 171: TypeBool + 172: TypeVector 171(bool) 2 + 173: TypePointer Function 172(bvec2) + 176: 14(int8_t) Constant 1 + 177: 52(i8vec2) ConstantComposite 22 22 + 178: 52(i8vec2) ConstantComposite 176 176 + 181: 36(int8_t) Constant 0 + 182: 36(int8_t) Constant 1 + 183: 49(i8vec2) ConstantComposite 181 181 + 184: 49(i8vec2) ConstantComposite 182 182 + 190: TypeVector 36(int8_t) 3 + 191: TypePointer Function 190(i8vec3) + 194: TypeVector 14(int8_t) 3 + 216: TypePointer Function 27(int) + 222: TypeVector 17(int) 3 + 223: TypePointer Function 222(ivec3) + 239: TypePointer Function 57(int16_t) + 261: 17(int) Constant 1 + 267: 17(int) Constant 2 + 275: TypePointer Function 171(bool) + 277: 17(int) Constant 0 + 291: TypePointer Function 17(int) + 349: 52(i8vec2) ConstantComposite 21 21 + 358: 190(i8vec3) ConstantComposite 181 181 181 + 400: 171(bool) ConstantTrue + 407: 171(bool) ConstantFalse + 408: 172(bvec2) ConstantComposite 407 407 + 420: TypeVector 171(bool) 3 + 421: 420(bvec3) ConstantComposite 407 407 407 + 427: TypeVector 14(int8_t) 4 + 428: TypePointer Function 427(i8vec4) + 432: TypePointer Function 64(int16_t) + 438: TypeVector 36(int8_t) 4 + 439: TypePointer Function 438(i8vec4) + 451: TypePointer Function 420(bvec3) + 513(Block): TypeStruct 14(int8_t) 52(i8vec2) 194(i8vec3) 427(i8vec4) 36(int8_t) 49(i8vec2) 190(i8vec3) 438(i8vec4) + 514: TypePointer Uniform 513(Block) + 515(block): 514(ptr) Variable Uniform + 516(si8): 14(int8_t) SpecConstant 4294967286 + 517(su8): 36(int8_t) SpecConstant 20 + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 16(i8): 15(ptr) Variable Function + 33(indexable): 32(ptr) Variable Function + 38(u8): 37(ptr) Variable Function + 46(indexable): 45(ptr) Variable Function + 30: 29(ptr) AccessChain 26 28 + 31: 17(int) Load 30 + Store 33(indexable) 23 + 34: 15(ptr) AccessChain 33(indexable) 31 + 35: 14(int8_t) Load 34 + Store 16(i8) 35 + 43: 29(ptr) AccessChain 26 28 + 44: 17(int) Load 43 + Store 46(indexable) 42 + 47: 37(ptr) AccessChain 46(indexable) 44 + 48: 36(int8_t) Load 47 + Store 38(u8) 48 + Return + FunctionEnd + 8(typeCast8(): 2 Function None 3 + 9: Label + 51(u8v): 50(ptr) Variable Function + 54(i8v): 53(ptr) Variable Function + 60(i16v): 59(ptr) Variable Function + 70(i32v): 69(ptr) Variable Function + 78(u32v): 77(ptr) Variable Function + 85(i64v): 84(ptr) Variable Function + 91(u64v): 90(ptr) Variable Function + 105(f16v): 104(ptr) Variable Function + 111(f32v): 110(ptr) Variable Function + 117(f64v): 116(ptr) Variable Function + 144(u16v): 143(ptr) Variable Function + 174(bv): 173(ptr) Variable Function + 55: 52(i8vec2) Load 54(i8v) + 56: 49(i8vec2) Bitcast 55 + Store 51(u8v) 56 + 61: 52(i8vec2) Load 54(i8v) + 62: 58(i16vec2) SConvert 61 + Store 60(i16v) 62 + 63: 49(i8vec2) Load 51(u8v) + 66: 65(i16vec2) UConvert 63 + 67: 58(i16vec2) Bitcast 66 + Store 60(i16v) 67 + 71: 52(i8vec2) Load 54(i8v) + 72: 68(ivec2) SConvert 71 + Store 70(i32v) 72 + 73: 49(i8vec2) Load 51(u8v) + 75: 74(ivec2) UConvert 73 + 76: 68(ivec2) Bitcast 75 + Store 70(i32v) 76 + 79: 52(i8vec2) Load 54(i8v) + 80: 68(ivec2) SConvert 79 + 81: 74(ivec2) Bitcast 80 + Store 78(u32v) 81 + 86: 52(i8vec2) Load 54(i8v) + 87: 83(i64vec2) SConvert 86 + Store 85(i64v) 87 + 92: 52(i8vec2) Load 54(i8v) + 93: 83(i64vec2) SConvert 92 + 94: 89(i64vec2) Bitcast 93 + Store 91(u64v) 94 + 95: 49(i8vec2) Load 51(u8v) + 96: 74(ivec2) UConvert 95 + Store 78(u32v) 96 + 97: 49(i8vec2) Load 51(u8v) + 98: 89(i64vec2) UConvert 97 + 99: 83(i64vec2) Bitcast 98 + Store 85(i64v) 99 + 100: 49(i8vec2) Load 51(u8v) + 101: 89(i64vec2) UConvert 100 + Store 91(u64v) 101 + 106: 52(i8vec2) Load 54(i8v) + 107:103(f16vec2) ConvertSToF 106 + Store 105(f16v) 107 + 112: 52(i8vec2) Load 54(i8v) + 113: 109(fvec2) ConvertSToF 112 + Store 111(f32v) 113 + 118: 52(i8vec2) Load 54(i8v) + 119:115(f64vec2) ConvertSToF 118 + Store 117(f64v) 119 + 120: 49(i8vec2) Load 51(u8v) + 121:103(f16vec2) ConvertUToF 120 + Store 105(f16v) 121 + 122: 49(i8vec2) Load 51(u8v) + 123: 109(fvec2) ConvertUToF 122 + Store 111(f32v) 123 + 124: 49(i8vec2) Load 51(u8v) + 125:115(f64vec2) ConvertUToF 124 + Store 117(f64v) 125 + 126: 49(i8vec2) Load 51(u8v) + 127: 52(i8vec2) Bitcast 126 + Store 54(i8v) 127 + 128: 52(i8vec2) Load 54(i8v) + 129: 58(i16vec2) SConvert 128 + Store 60(i16v) 129 + 130: 49(i8vec2) Load 51(u8v) + 131: 65(i16vec2) UConvert 130 + 132: 58(i16vec2) Bitcast 131 + Store 60(i16v) 132 + 133: 52(i8vec2) Load 54(i8v) + 134: 68(ivec2) SConvert 133 + Store 70(i32v) 134 + 135: 49(i8vec2) Load 51(u8v) + 136: 74(ivec2) UConvert 135 + 137: 68(ivec2) Bitcast 136 + Store 70(i32v) 137 + 138: 52(i8vec2) Load 54(i8v) + 139: 83(i64vec2) SConvert 138 + Store 85(i64v) 139 + 140: 52(i8vec2) Load 54(i8v) + 141: 83(i64vec2) SConvert 140 + 142: 89(i64vec2) Bitcast 141 + Store 91(u64v) 142 + 145: 52(i8vec2) Load 54(i8v) + 146: 58(i16vec2) SConvert 145 + 147: 65(i16vec2) Bitcast 146 + Store 144(u16v) 147 + 148: 49(i8vec2) Load 51(u8v) + 149: 65(i16vec2) UConvert 148 + Store 144(u16v) 149 + 150: 49(i8vec2) Load 51(u8v) + 151: 74(ivec2) UConvert 150 + Store 78(u32v) 151 + 152: 49(i8vec2) Load 51(u8v) + 153: 89(i64vec2) UConvert 152 + 154: 83(i64vec2) Bitcast 153 + Store 85(i64v) 154 + 155: 49(i8vec2) Load 51(u8v) + 156: 89(i64vec2) UConvert 155 + 157: 83(i64vec2) Bitcast 156 + 158: 89(i64vec2) Bitcast 157 + Store 91(u64v) 158 + 159: 52(i8vec2) Load 54(i8v) + 160:103(f16vec2) ConvertSToF 159 + Store 105(f16v) 160 + 161: 52(i8vec2) Load 54(i8v) + 162: 109(fvec2) ConvertSToF 161 + Store 111(f32v) 162 + 163: 52(i8vec2) Load 54(i8v) + 164:115(f64vec2) ConvertSToF 163 + Store 117(f64v) 164 + 165: 49(i8vec2) Load 51(u8v) + 166:103(f16vec2) ConvertUToF 165 + Store 105(f16v) 166 + 167: 49(i8vec2) Load 51(u8v) + 168: 109(fvec2) ConvertUToF 167 + Store 111(f32v) 168 + 169: 49(i8vec2) Load 51(u8v) + 170:115(f64vec2) ConvertUToF 169 + Store 117(f64v) 170 + 175: 172(bvec2) Load 174(bv) + 179: 52(i8vec2) Select 175 178 177 + Store 54(i8v) 179 + 180: 172(bvec2) Load 174(bv) + 185: 49(i8vec2) Select 180 184 183 + Store 51(u8v) 185 + 186: 52(i8vec2) Load 54(i8v) + 187: 172(bvec2) INotEqual 186 183 + Store 174(bv) 187 + 188: 49(i8vec2) Load 51(u8v) + 189: 172(bvec2) INotEqual 188 183 + Store 174(bv) 189 + Return + FunctionEnd + 10(operators(): 2 Function None 3 + 11: Label + 192(u8v): 191(ptr) Variable Function + 197(i8): 15(ptr) Variable Function + 217(i): 216(ptr) Variable Function + 224(uv): 223(ptr) Variable Function + 240(i16): 239(ptr) Variable Function + 276(b): 275(ptr) Variable Function + 193: 190(i8vec3) Load 192(u8v) + 195: 194(i8vec3) CompositeConstruct 176 176 176 + 196: 190(i8vec3) IAdd 193 195 + Store 192(u8v) 196 + 198: 14(int8_t) Load 197(i8) + 199: 14(int8_t) ISub 198 176 + Store 197(i8) 199 + 200: 14(int8_t) Load 197(i8) + 201: 14(int8_t) IAdd 200 176 + Store 197(i8) 201 + 202: 190(i8vec3) Load 192(u8v) + 203: 194(i8vec3) CompositeConstruct 176 176 176 + 204: 190(i8vec3) ISub 202 203 + Store 192(u8v) 204 + 205: 190(i8vec3) Load 192(u8v) + 206: 190(i8vec3) Not 205 + Store 192(u8v) 206 + 207: 14(int8_t) Load 197(i8) + Store 197(i8) 207 + 208: 190(i8vec3) Load 192(u8v) + 209: 190(i8vec3) SNegate 208 + Store 192(u8v) 209 + 210: 14(int8_t) Load 197(i8) + 211: 14(int8_t) Load 197(i8) + 212: 14(int8_t) IAdd 211 210 + Store 197(i8) 212 + 213: 190(i8vec3) Load 192(u8v) + 214: 190(i8vec3) Load 192(u8v) + 215: 190(i8vec3) ISub 214 213 + Store 192(u8v) 215 + 218: 14(int8_t) Load 197(i8) + 219: 27(int) SConvert 218 + 220: 27(int) Load 217(i) + 221: 27(int) IMul 220 219 + Store 217(i) 221 + 225: 190(i8vec3) Load 192(u8v) + 226: 222(ivec3) UConvert 225 + 227: 222(ivec3) Load 224(uv) + 228: 222(ivec3) UDiv 227 226 + Store 224(uv) 228 + 229: 14(int8_t) Load 197(i8) + 230: 27(int) SConvert 229 + 231: 17(int) Bitcast 230 + 232: 222(ivec3) Load 224(uv) + 233: 222(ivec3) CompositeConstruct 231 231 231 + 234: 222(ivec3) UMod 232 233 + Store 224(uv) 234 + 235: 190(i8vec3) Load 192(u8v) + 236: 222(ivec3) UConvert 235 + 237: 222(ivec3) Load 224(uv) + 238: 222(ivec3) IAdd 236 237 + Store 224(uv) 238 + 241: 14(int8_t) Load 197(i8) + 242: 57(int16_t) SConvert 241 + 243: 57(int16_t) Load 240(i16) + 244: 57(int16_t) ISub 242 243 + Store 240(i16) 244 + 245: 190(i8vec3) Load 192(u8v) + 246: 222(ivec3) UConvert 245 + 247: 222(ivec3) Load 224(uv) + 248: 222(ivec3) IMul 246 247 + Store 224(uv) 248 + 249: 14(int8_t) Load 197(i8) + 250: 57(int16_t) SConvert 249 + 251: 57(int16_t) Load 240(i16) + 252: 57(int16_t) IMul 250 251 + Store 240(i16) 252 + 253: 14(int8_t) Load 197(i8) + 254: 27(int) SConvert 253 + 255: 27(int) Load 217(i) + 256: 27(int) SMod 254 255 + Store 217(i) 256 + 257: 14(int8_t) Load 197(i8) + 258: 190(i8vec3) Load 192(u8v) + 259: 194(i8vec3) CompositeConstruct 257 257 257 + 260: 190(i8vec3) ShiftLeftLogical 258 259 + Store 192(u8v) 260 + 262: 37(ptr) AccessChain 192(u8v) 261 + 263: 36(int8_t) Load 262 + 264: 14(int8_t) Load 197(i8) + 265: 14(int8_t) ShiftRightArithmetic 264 263 + Store 197(i8) 265 + 266: 14(int8_t) Load 197(i8) + 268: 37(ptr) AccessChain 192(u8v) 267 + 269: 36(int8_t) Load 268 + 270: 14(int8_t) ShiftLeftLogical 266 269 + Store 197(i8) 270 + 271: 190(i8vec3) Load 192(u8v) + 272: 14(int8_t) Load 197(i8) + 273: 194(i8vec3) CompositeConstruct 272 272 272 + 274: 190(i8vec3) ShiftLeftLogical 271 273 + Store 192(u8v) 274 + 278: 37(ptr) AccessChain 192(u8v) 277 + 279: 36(int8_t) Load 278 + 280: 14(int8_t) Load 197(i8) + 281: 36(int8_t) Bitcast 280 + 282: 171(bool) INotEqual 279 281 + Store 276(b) 282 + 283: 14(int8_t) Load 197(i8) + 284: 36(int8_t) Bitcast 283 + 285: 37(ptr) AccessChain 192(u8v) 277 + 286: 36(int8_t) Load 285 + 287: 171(bool) IEqual 284 286 + Store 276(b) 287 + 288: 37(ptr) AccessChain 192(u8v) 277 + 289: 36(int8_t) Load 288 + 290: 17(int) UConvert 289 + 292: 291(ptr) AccessChain 224(uv) 261 + 293: 17(int) Load 292 + 294: 171(bool) UGreaterThan 290 293 + Store 276(b) 294 + 295: 14(int8_t) Load 197(i8) + 296: 27(int) SConvert 295 + 297: 27(int) Load 217(i) + 298: 171(bool) SLessThan 296 297 + Store 276(b) 298 + 299: 37(ptr) AccessChain 192(u8v) 261 + 300: 36(int8_t) Load 299 + 301: 17(int) UConvert 300 + 302: 291(ptr) AccessChain 224(uv) 277 + 303: 17(int) Load 302 + 304: 171(bool) UGreaterThanEqual 301 303 + Store 276(b) 304 + 305: 14(int8_t) Load 197(i8) + 306: 27(int) SConvert 305 + 307: 27(int) Load 217(i) + 308: 171(bool) SLessThanEqual 306 307 + Store 276(b) 308 + 309: 14(int8_t) Load 197(i8) + 310: 27(int) SConvert 309 + 311: 17(int) Bitcast 310 + 312: 222(ivec3) Load 224(uv) + 313: 222(ivec3) CompositeConstruct 311 311 311 + 314: 222(ivec3) BitwiseOr 312 313 + Store 224(uv) 314 + 315: 14(int8_t) Load 197(i8) + 316: 27(int) SConvert 315 + 317: 27(int) Load 217(i) + 318: 27(int) BitwiseOr 316 317 + Store 217(i) 318 + 319: 14(int8_t) Load 197(i8) + 320: 57(int16_t) SConvert 319 + 321: 57(int16_t) Load 240(i16) + 322: 57(int16_t) BitwiseAnd 321 320 + Store 240(i16) 322 + 323: 190(i8vec3) Load 192(u8v) + 324: 222(ivec3) UConvert 323 + 325: 222(ivec3) Load 224(uv) + 326: 222(ivec3) BitwiseAnd 324 325 + Store 224(uv) 326 + 327: 14(int8_t) Load 197(i8) + 328: 27(int) SConvert 327 + 329: 17(int) Bitcast 328 + 330: 222(ivec3) Load 224(uv) + 331: 222(ivec3) CompositeConstruct 329 329 329 + 332: 222(ivec3) BitwiseXor 330 331 + Store 224(uv) 332 + 333: 190(i8vec3) Load 192(u8v) + 334: 14(int8_t) Load 197(i8) + 335: 36(int8_t) Bitcast 334 + 336: 190(i8vec3) CompositeConstruct 335 335 335 + 337: 190(i8vec3) BitwiseXor 333 336 + Store 192(u8v) 337 + Return + FunctionEnd +12(builtinFuncs(): 2 Function None 3 + 13: Label + 338(i8v): 53(ptr) Variable Function + 341(i8): 15(ptr) Variable Function + 351(u8v): 191(ptr) Variable Function + 353(u8): 37(ptr) Variable Function + 423(i16): 239(ptr) Variable Function + 426(i32): 216(ptr) Variable Function + 429(i8v4): 428(ptr) Variable Function + 433(u16): 432(ptr) Variable Function + 434(u8v2): 50(ptr) Variable Function + 437(u32): 291(ptr) Variable Function + 440(u8v4): 439(ptr) Variable Function + 452(bv): 451(ptr) Variable Function + 339: 52(i8vec2) Load 338(i8v) + 340: 52(i8vec2) ExtInst 1(GLSL.std.450) 5(SAbs) 339 + Store 338(i8v) 340 + 342: 14(int8_t) Load 341(i8) + 343: 14(int8_t) ExtInst 1(GLSL.std.450) 7(SSign) 342 + Store 341(i8) 343 + 344: 52(i8vec2) Load 338(i8v) + 345: 14(int8_t) Load 341(i8) + 346: 52(i8vec2) CompositeConstruct 345 345 + 347: 52(i8vec2) ExtInst 1(GLSL.std.450) 39(SMin) 344 346 + Store 338(i8v) 347 + 348: 52(i8vec2) Load 338(i8v) + 350: 52(i8vec2) ExtInst 1(GLSL.std.450) 39(SMin) 348 349 + Store 338(i8v) 350 + 352: 190(i8vec3) Load 351(u8v) + 354: 36(int8_t) Load 353(u8) + 355: 190(i8vec3) CompositeConstruct 354 354 354 + 356: 190(i8vec3) ExtInst 1(GLSL.std.450) 38(UMin) 352 355 + Store 351(u8v) 356 + 357: 190(i8vec3) Load 351(u8v) + 359: 190(i8vec3) ExtInst 1(GLSL.std.450) 38(UMin) 357 358 + Store 351(u8v) 359 + 360: 52(i8vec2) Load 338(i8v) + 361: 14(int8_t) Load 341(i8) + 362: 52(i8vec2) CompositeConstruct 361 361 + 363: 52(i8vec2) ExtInst 1(GLSL.std.450) 42(SMax) 360 362 + Store 338(i8v) 363 + 364: 52(i8vec2) Load 338(i8v) + 365: 52(i8vec2) ExtInst 1(GLSL.std.450) 42(SMax) 364 349 + Store 338(i8v) 365 + 366: 190(i8vec3) Load 351(u8v) + 367: 36(int8_t) Load 353(u8) + 368: 190(i8vec3) CompositeConstruct 367 367 367 + 369: 190(i8vec3) ExtInst 1(GLSL.std.450) 41(UMax) 366 368 + Store 351(u8v) 369 + 370: 190(i8vec3) Load 351(u8v) + 371: 190(i8vec3) ExtInst 1(GLSL.std.450) 41(UMax) 370 358 + Store 351(u8v) 371 + 372: 52(i8vec2) Load 338(i8v) + 373: 14(int8_t) Load 341(i8) + 374: 14(int8_t) SNegate 373 + 375: 14(int8_t) Load 341(i8) + 376: 52(i8vec2) CompositeConstruct 374 374 + 377: 52(i8vec2) CompositeConstruct 375 375 + 378: 52(i8vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 372 376 377 + Store 338(i8v) 378 + 379: 52(i8vec2) Load 338(i8v) + 380: 52(i8vec2) Load 338(i8v) + 381: 52(i8vec2) SNegate 380 + 382: 52(i8vec2) Load 338(i8v) + 383: 52(i8vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 379 381 382 + Store 338(i8v) 383 + 384: 190(i8vec3) Load 351(u8v) + 385: 36(int8_t) Load 353(u8) + 386: 36(int8_t) SNegate 385 + 387: 36(int8_t) Load 353(u8) + 388: 190(i8vec3) CompositeConstruct 386 386 386 + 389: 190(i8vec3) CompositeConstruct 387 387 387 + 390: 190(i8vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 384 388 389 + Store 351(u8v) 390 + 391: 190(i8vec3) Load 351(u8v) + 392: 190(i8vec3) Load 351(u8v) + 393: 190(i8vec3) SNegate 392 + 394: 190(i8vec3) Load 351(u8v) + 395: 190(i8vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 391 393 394 + Store 351(u8v) 395 + 396: 15(ptr) AccessChain 338(i8v) 277 + 397: 14(int8_t) Load 396 + 398: 15(ptr) AccessChain 338(i8v) 261 + 399: 14(int8_t) Load 398 + 401: 14(int8_t) Select 400 399 397 + Store 341(i8) 401 + 402: 14(int8_t) Load 341(i8) + 403: 52(i8vec2) CompositeConstruct 402 402 + 404: 14(int8_t) Load 341(i8) + 405: 14(int8_t) SNegate 404 + 406: 52(i8vec2) CompositeConstruct 405 405 + 409: 52(i8vec2) Select 408 406 403 + Store 338(i8v) 409 + 410: 37(ptr) AccessChain 351(u8v) 277 + 411: 36(int8_t) Load 410 + 412: 37(ptr) AccessChain 351(u8v) 261 + 413: 36(int8_t) Load 412 + 414: 36(int8_t) Select 400 413 411 + Store 353(u8) 414 + 415: 36(int8_t) Load 353(u8) + 416: 190(i8vec3) CompositeConstruct 415 415 415 + 417: 36(int8_t) Load 353(u8) + 418: 36(int8_t) SNegate 417 + 419: 190(i8vec3) CompositeConstruct 418 418 418 + 422: 190(i8vec3) Select 421 419 416 + Store 351(u8v) 422 + 424: 52(i8vec2) Load 338(i8v) + 425: 57(int16_t) Bitcast 424 + Store 423(i16) 425 + 430: 427(i8vec4) Load 429(i8v4) + 431: 27(int) Bitcast 430 + Store 426(i32) 431 + 435: 49(i8vec2) Load 434(u8v2) + 436: 64(int16_t) Bitcast 435 + Store 433(u16) 436 + 441: 438(i8vec4) Load 440(u8v4) + 442: 17(int) Bitcast 441 + Store 437(u32) 442 + 443: 57(int16_t) Load 423(i16) + 444: 52(i8vec2) Bitcast 443 + Store 338(i8v) 444 + 445: 27(int) Load 426(i32) + 446: 427(i8vec4) Bitcast 445 + Store 429(i8v4) 446 + 447: 64(int16_t) Load 433(u16) + 448: 49(i8vec2) Bitcast 447 + Store 434(u8v2) 448 + 449: 17(int) Load 437(u32) + 450: 438(i8vec4) Bitcast 449 + Store 440(u8v4) 450 + 453: 190(i8vec3) Load 351(u8v) + 454: 36(int8_t) Load 353(u8) + 455: 190(i8vec3) CompositeConstruct 454 454 454 + 456: 420(bvec3) ULessThan 453 455 + Store 452(bv) 456 + 457: 52(i8vec2) Load 338(i8v) + 458: 14(int8_t) Load 341(i8) + 459: 52(i8vec2) CompositeConstruct 458 458 + 460: 172(bvec2) SLessThan 457 459 + 461: 420(bvec3) Load 452(bv) + 462: 420(bvec3) VectorShuffle 461 460 3 4 2 + Store 452(bv) 462 + 463: 190(i8vec3) Load 351(u8v) + 464: 36(int8_t) Load 353(u8) + 465: 190(i8vec3) CompositeConstruct 464 464 464 + 466: 420(bvec3) ULessThanEqual 463 465 + Store 452(bv) 466 + 467: 52(i8vec2) Load 338(i8v) + 468: 14(int8_t) Load 341(i8) + 469: 52(i8vec2) CompositeConstruct 468 468 + 470: 172(bvec2) SLessThanEqual 467 469 + 471: 420(bvec3) Load 452(bv) + 472: 420(bvec3) VectorShuffle 471 470 3 4 2 + Store 452(bv) 472 + 473: 190(i8vec3) Load 351(u8v) + 474: 36(int8_t) Load 353(u8) + 475: 190(i8vec3) CompositeConstruct 474 474 474 + 476: 420(bvec3) UGreaterThan 473 475 + Store 452(bv) 476 + 477: 52(i8vec2) Load 338(i8v) + 478: 14(int8_t) Load 341(i8) + 479: 52(i8vec2) CompositeConstruct 478 478 + 480: 172(bvec2) SGreaterThan 477 479 + 481: 420(bvec3) Load 452(bv) + 482: 420(bvec3) VectorShuffle 481 480 3 4 2 + Store 452(bv) 482 + 483: 190(i8vec3) Load 351(u8v) + 484: 36(int8_t) Load 353(u8) + 485: 190(i8vec3) CompositeConstruct 484 484 484 + 486: 420(bvec3) UGreaterThanEqual 483 485 + Store 452(bv) 486 + 487: 52(i8vec2) Load 338(i8v) + 488: 14(int8_t) Load 341(i8) + 489: 52(i8vec2) CompositeConstruct 488 488 + 490: 172(bvec2) SGreaterThanEqual 487 489 + 491: 420(bvec3) Load 452(bv) + 492: 420(bvec3) VectorShuffle 491 490 3 4 2 + Store 452(bv) 492 + 493: 190(i8vec3) Load 351(u8v) + 494: 36(int8_t) Load 353(u8) + 495: 190(i8vec3) CompositeConstruct 494 494 494 + 496: 420(bvec3) IEqual 493 495 + Store 452(bv) 496 + 497: 52(i8vec2) Load 338(i8v) + 498: 14(int8_t) Load 341(i8) + 499: 52(i8vec2) CompositeConstruct 498 498 + 500: 172(bvec2) IEqual 497 499 + 501: 420(bvec3) Load 452(bv) + 502: 420(bvec3) VectorShuffle 501 500 3 4 2 + Store 452(bv) 502 + 503: 190(i8vec3) Load 351(u8v) + 504: 36(int8_t) Load 353(u8) + 505: 190(i8vec3) CompositeConstruct 504 504 504 + 506: 420(bvec3) INotEqual 503 505 + Store 452(bv) 506 + 507: 52(i8vec2) Load 338(i8v) + 508: 14(int8_t) Load 341(i8) + 509: 52(i8vec2) CompositeConstruct 508 508 + 510: 172(bvec2) INotEqual 507 509 + 511: 420(bvec3) Load 452(bv) + 512: 420(bvec3) VectorShuffle 511 510 3 4 2 + Store 452(bv) 512 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.intOps.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.intOps.vert.out index 33e57bf37cd..2a637832077 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.intOps.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.intOps.vert.out @@ -1,6 +1,6 @@ spv.intOps.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 268 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.interpOps.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.interpOps.frag.out index 05e7f62f6af..699524dd954 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.interpOps.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.interpOps.frag.out @@ -1,6 +1,6 @@ spv.interpOps.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 100 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.layoutNested.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.layoutNested.vert.out index 3e73b84ac66..b5ef8834546 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.layoutNested.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.layoutNested.vert.out @@ -1,6 +1,6 @@ spv.layoutNested.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 66 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.length.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.length.frag.out index 2bb07e2ee11..8e799fbb42a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.length.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.length.frag.out @@ -1,6 +1,6 @@ spv.length.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 33 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.localAggregates.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.localAggregates.frag.out index b59dfd89a52..5f89611e6f2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.localAggregates.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.localAggregates.frag.out @@ -1,6 +1,6 @@ spv.localAggregates.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 136 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loops.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loops.frag.out index 7ce2c1c5bee..046360f609e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loops.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loops.frag.out @@ -1,6 +1,6 @@ spv.loops.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 725 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loopsArtificial.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loopsArtificial.frag.out index a2339bd849c..d0d60542f86 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loopsArtificial.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.loopsArtificial.frag.out @@ -1,6 +1,6 @@ spv.loopsArtificial.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 158 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matFun.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matFun.vert.out index 832f38ed6dd..47b692f7250 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matFun.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matFun.vert.out @@ -1,6 +1,6 @@ spv.matFun.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 103 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix.frag.out index 1ac5ad5af26..c2b4a1f6c88 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix.frag.out @@ -1,6 +1,6 @@ spv.matrix.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 286 Capability Shader @@ -36,8 +36,8 @@ spv.matrix.frag 28(f): 27(ptr) Variable Input 81: 6(float) Constant 1065353216 136: TypeFloat 64 - 137: TypeVector 136(float) 4 - 138: TypeMatrix 137(fvec4) 3 + 137: TypeVector 136(float64_t) 4 + 138: TypeMatrix 137(f64vec4) 3 139: TypePointer Function 138 157: TypeVector 6(float) 3 158: TypePointer Function 157(fvec3) @@ -193,19 +193,19 @@ spv.matrix.frag Store 10(sum34) 135 141: 8 Load 10(sum34) 142: 7(fvec4) CompositeExtract 141 0 - 143: 137(fvec4) FConvert 142 + 143:137(f64vec4) FConvert 142 144: 7(fvec4) CompositeExtract 141 1 - 145: 137(fvec4) FConvert 144 + 145:137(f64vec4) FConvert 144 146: 7(fvec4) CompositeExtract 141 2 - 147: 137(fvec4) FConvert 146 + 147:137(f64vec4) FConvert 146 148: 138 CompositeConstruct 143 145 147 Store 140(dm) 148 149: 138 Load 140(dm) - 150: 137(fvec4) CompositeExtract 149 0 + 150:137(f64vec4) CompositeExtract 149 0 151: 7(fvec4) FConvert 150 - 152: 137(fvec4) CompositeExtract 149 1 + 152:137(f64vec4) CompositeExtract 149 1 153: 7(fvec4) FConvert 152 - 154: 137(fvec4) CompositeExtract 149 2 + 154:137(f64vec4) CompositeExtract 149 2 155: 7(fvec4) FConvert 154 156: 8 CompositeConstruct 151 153 155 Store 10(sum34) 156 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix2.frag.out index b6d747362a0..dc574a40d80 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.matrix2.frag.out @@ -1,6 +1,6 @@ spv.matrix2.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 221 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryQualifier.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryQualifier.frag.out index b1ae8df8a58..4113cc9509b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryQualifier.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryQualifier.frag.out @@ -1,6 +1,10 @@ spv.memoryQualifier.frag +error: SPIRV-Tools Validation Errors +error: Capability ImageRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability ImageRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 97 Capability Shader @@ -35,6 +39,7 @@ spv.memoryQualifier.frag Decorate 19(i2D) DescriptorSet 0 Decorate 19(i2D) Binding 1 Decorate 19(i2D) Volatile + Decorate 19(i2D) Coherent Decorate 28(i2DRect) DescriptorSet 0 Decorate 28(i2DRect) Binding 2 Decorate 28(i2DRect) Restrict @@ -48,6 +53,7 @@ spv.memoryQualifier.frag MemberDecorate 49(Data) 1 Offset 8 MemberDecorate 50(Buffer) 0 Coherent MemberDecorate 50(Buffer) 0 Volatile + MemberDecorate 50(Buffer) 0 Coherent MemberDecorate 50(Buffer) 0 Offset 0 MemberDecorate 50(Buffer) 1 Coherent MemberDecorate 50(Buffer) 1 Restrict diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out new file mode 100644 index 00000000000..46f9a078a97 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics.comp.out @@ -0,0 +1,239 @@ +spv.memoryScopeSemantics.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 142 + + Capability Shader + Capability Int64 + Capability Int64Atomics + Capability CapabilityVulkanMemoryModelKHR + Capability CapabilityVulkanMemoryModelDeviceScopeKHR + Extension "SPV_KHR_vulkan_memory_model" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical VulkanKHR + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 1 1 1 + Source GLSL 450 + SourceExtension "GL_ARB_gpu_shader_int64" + SourceExtension "GL_KHR_memory_scope_semantics" + Name 4 "main" + Name 8 "origi" + Name 10 "atomi" + Name 21 "origu" + Name 23 "atomu" + Name 24 "value" + Name 36 "imagei" + Name 45 "imageu" + Name 65 "BufferU" + MemberName 65(BufferU) 0 "x" + Name 67 "bufferu" + Name 72 "y" + Name 77 "BufferI" + MemberName 77(BufferI) 0 "x" + Name 79 "bufferi" + Name 83 "A" + MemberName 83(A) 0 "x" + Name 84 "BufferJ" + MemberName 84(BufferJ) 0 "a" + Name 87 "bufferj" + Name 98 "BufferK" + MemberName 98(BufferK) 0 "x" + Name 100 "bufferk" + Name 109 "imagej" + Name 121 "samp" + Name 132 "atomu64" + Name 137 "atomi64" + Decorate 36(imagei) DescriptorSet 0 + Decorate 36(imagei) Binding 1 + Decorate 45(imageu) DescriptorSet 0 + Decorate 45(imageu) Binding 0 + MemberDecorate 65(BufferU) 0 Offset 0 + Decorate 65(BufferU) BufferBlock + Decorate 67(bufferu) DescriptorSet 0 + Decorate 67(bufferu) Binding 2 + MemberDecorate 77(BufferI) 0 Offset 0 + Decorate 77(BufferI) BufferBlock + Decorate 79(bufferi) DescriptorSet 0 + Decorate 79(bufferi) Binding 3 + Decorate 82 ArrayStride 4 + MemberDecorate 83(A) 0 Offset 0 + MemberDecorate 84(BufferJ) 0 Offset 0 + Decorate 84(BufferJ) BufferBlock + Decorate 87(bufferj) DescriptorSet 0 + Decorate 87(bufferj) Binding 4 + MemberDecorate 98(BufferK) 0 Offset 0 + Decorate 98(BufferK) Block + Decorate 100(bufferk) DescriptorSet 0 + Decorate 100(bufferk) Binding 7 + Decorate 109(imagej) DescriptorSet 0 + Decorate 109(imagej) Binding 5 + Decorate 121(samp) DescriptorSet 0 + Decorate 121(samp) Binding 6 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 9: TypePointer Workgroup 6(int) + 10(atomi): 9(ptr) Variable Workgroup + 11: 6(int) Constant 3 + 12: 6(int) Constant 1 + 13: 6(int) Constant 320 + 14: 6(int) Constant 4 + 15: TypeInt 32 0 + 16: 15(int) Constant 5 + 17: 15(int) Constant 0 + 18: 15(int) Constant 324 + 20: TypePointer Function 15(int) + 22: TypePointer Workgroup 15(int) + 23(atomu): 22(ptr) Variable Workgroup + 24(value): 22(ptr) Variable Workgroup + 26: 15(int) Constant 2 + 28: 6(int) Constant 64 + 29: 6(int) Constant 2 + 30: 15(int) Constant 66 + 33: 15(int) Constant 68 + 34: TypeImage 6(int) 2D nonsampled format:R32i + 35: TypePointer UniformConstant 34 + 36(imagei): 35(ptr) Variable UniformConstant + 37: TypeVector 6(int) 2 + 38: 6(int) Constant 0 + 39: 37(ivec2) ConstantComposite 38 38 + 40: TypePointer Image 6(int) + 43: TypeImage 15(int) 2D nonsampled format:R32ui + 44: TypePointer UniformConstant 43 + 45(imageu): 44(ptr) Variable UniformConstant + 46: 15(int) Constant 3 + 47: TypePointer Image 15(int) + 50: 15(int) Constant 4 + 52: 15(int) Constant 7 + 57: 6(int) Constant 7 + 61: 15(int) Constant 10 + 63: 15(int) Constant 322 + 65(BufferU): TypeStruct 15(int) + 66: TypePointer Uniform 65(BufferU) + 67(bufferu): 66(ptr) Variable Uniform + 68: TypePointer Uniform 15(int) + 70: 15(int) Constant 1 + 77(BufferI): TypeStruct 15(int) + 78: TypePointer Uniform 77(BufferI) + 79(bufferi): 78(ptr) Variable Uniform + 82: TypeArray 15(int) 26 + 83(A): TypeStruct 82 + 84(BufferJ): TypeStruct 83(A) + 85: TypeArray 84(BufferJ) 26 + 86: TypePointer Uniform 85 + 87(bufferj): 86(ptr) Variable Uniform + 94: TypePointer Uniform 83(A) + 98(BufferK): TypeStruct 15(int) + 99: TypePointer Uniform 98(BufferK) + 100(bufferk): 99(ptr) Variable Uniform + 105: TypeVector 6(int) 4 + 107: TypeArray 34 26 + 108: TypePointer UniformConstant 107 + 109(imagej): 108(ptr) Variable UniformConstant + 115: 105(ivec4) ConstantComposite 38 38 38 38 + 116: TypeFloat 32 + 117: TypeImage 116(float) 2D sampled format:Unknown + 118: TypeSampledImage 117 + 119: TypeArray 118 26 + 120: TypePointer UniformConstant 119 + 121(samp): 120(ptr) Variable UniformConstant + 122: TypePointer UniformConstant 118 + 125: TypeVector 116(float) 2 + 126: 116(float) Constant 0 + 127: 125(fvec2) ConstantComposite 126 126 + 128: TypeVector 116(float) 4 + 130: TypeInt 64 0 + 131: TypePointer Workgroup 130(int64_t) + 132(atomu64): 131(ptr) Variable Workgroup + 133:130(int64_t) Constant 7 0 + 135: TypeInt 64 1 + 136: TypePointer Workgroup 135(int64_t) + 137(atomi64): 136(ptr) Variable Workgroup + 138:135(int64_t) Constant 10 0 + 4(main): 2 Function None 3 + 5: Label + 8(origi): 7(ptr) Variable Function + 21(origu): 20(ptr) Variable Function + 72(y): 20(ptr) Variable Function + 19: 6(int) AtomicIAdd 10(atomi) 12 18 11 + Store 8(origi) 19 + 25: 15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26 + 27: 15(int) AtomicAnd 23(atomu) 16 17 25 + Store 21(origu) 27 + 31: 6(int) AtomicLoad 10(atomi) 12 30 + Store 8(origi) 31 + 32: 15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26 + AtomicStore 23(atomu) 12 33 32 + 41: 40(ptr) ImageTexelPointer 36(imagei) 39 17 + 42: 6(int) AtomicLoad 41 12 30 + Store 8(origi) 42 + 48: 47(ptr) ImageTexelPointer 45(imageu) 39 17 + 49: 15(int) AtomicIAdd 48 12 30 46 + Store 21(origu) 49 + 51: 47(ptr) ImageTexelPointer 45(imageu) 39 17 + AtomicStore 51 12 33 50 + 53: 15(int) AtomicOr 23(atomu) 12 17 52 + Store 21(origu) 53 + 54: 15(int) AtomicXor 23(atomu) 12 17 52 + Store 21(origu) 54 + 55: 15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26 + 56: 15(int) AtomicUMin 23(atomu) 12 17 55 + Store 21(origu) 56 + 58: 6(int) AtomicSMax 10(atomi) 12 17 57 + Store 8(origi) 58 + 59: 6(int) Load 8(origi) + 60: 6(int) AtomicExchange 10(atomi) 12 17 59 + Store 8(origi) 60 + 62: 15(int) Load 24(value) MakePointerVisibleKHR NonPrivatePointerKHR 26 + 64: 15(int) AtomicCompareExchange 23(atomu) 12 63 63 62 61 + Store 21(origu) 64 + 69: 68(ptr) AccessChain 67(bufferu) 38 + 71: 15(int) AtomicIAdd 69 12 18 70 + MemoryBarrier 26 18 + ControlBarrier 26 26 63 + ControlBarrier 26 26 17 + 73: 68(ptr) AccessChain 67(bufferu) 38 + 74: 15(int) Load 73 MakePointerVisibleKHR NonPrivatePointerKHR 26 + Store 72(y) 74 + 75: 15(int) Load 72(y) + 76: 68(ptr) AccessChain 67(bufferu) 38 + Store 76 75 MakePointerAvailableKHR NonPrivatePointerKHR 26 + 80: 68(ptr) AccessChain 79(bufferi) 38 + 81: 15(int) Load 80 MakePointerVisibleKHR NonPrivatePointerKHR 16 + Store 72(y) 81 + 88: 68(ptr) AccessChain 87(bufferj) 38 38 38 12 + 89: 15(int) Load 88 Volatile MakePointerVisibleKHR NonPrivatePointerKHR 46 + Store 72(y) 89 + 90: 15(int) Load 72(y) + 91: 68(ptr) AccessChain 79(bufferi) 38 + Store 91 90 MakePointerAvailableKHR NonPrivatePointerKHR 16 + 92: 15(int) Load 72(y) + 93: 68(ptr) AccessChain 87(bufferj) 38 38 38 12 + Store 93 92 Volatile MakePointerAvailableKHR NonPrivatePointerKHR 46 + 95: 94(ptr) AccessChain 87(bufferj) 12 38 + 96: 83(A) Load 95 Volatile MakePointerVisibleKHR NonPrivatePointerKHR 46 + 97: 94(ptr) AccessChain 87(bufferj) 38 38 + Store 97 96 Volatile MakePointerAvailableKHR NonPrivatePointerKHR 46 + 101: 68(ptr) AccessChain 100(bufferk) 38 + 102: 15(int) Load 101 NonPrivatePointerKHR + 103: 68(ptr) AccessChain 79(bufferi) 38 + Store 103 102 MakePointerAvailableKHR NonPrivatePointerKHR 16 + 104: 34 Load 36(imagei) + 106: 105(ivec4) ImageRead 104 39 MakeTexelVisibleKHR NonPrivateTexelKHR VolatileTexelKHR 16 + 110: 35(ptr) AccessChain 109(imagej) 38 + 111: 34 Load 110 + 112: 105(ivec4) ImageRead 111 39 NonPrivateTexelKHR + 113: 35(ptr) AccessChain 109(imagej) 12 + 114: 34 Load 113 + ImageWrite 114 39 115 NonPrivateTexelKHR + 123: 122(ptr) AccessChain 121(samp) 38 + 124: 118 Load 123 + 129: 128(fvec4) ImageSampleExplicitLod 124 127 Lod NonPrivateTexelKHR 126 + 134:130(int64_t) AtomicUMax 132(atomu64) 12 17 133 + Store 132(atomu64) 134 MakePointerAvailableKHR NonPrivatePointerKHR 26 + 139:130(int64_t) Load 132(atomu64) MakePointerVisibleKHR NonPrivatePointerKHR 26 + 140:135(int64_t) Bitcast 139 + 141:135(int64_t) AtomicCompareExchange 137(atomi64) 12 63 63 140 138 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out new file mode 100644 index 00000000000..c4149d87157 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.memoryScopeSemantics_Error.comp.out @@ -0,0 +1,17 @@ +spv.memoryScopeSemantics_Error.comp +ERROR: 0:15: 'atomicStore' : gl_SemanticsAcquire must not be used with (image) atomic store +ERROR: 0:16: 'imageAtomicLoad' : gl_SemanticsRelease must not be used with (image) atomic load +ERROR: 0:17: 'atomicStore' : gl_SemanticsAcquireRelease must not be used with (image) atomic load/store +ERROR: 0:18: 'atomicStore' : Invalid semantics value +ERROR: 0:19: 'imageAtomicLoad' : Invalid storage class semantics value +ERROR: 0:20: 'memoryBarrier' : Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:21: 'memoryBarrier' : Storage class semantics must not be zero +ERROR: 0:22: 'memoryBarrier' : Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:23: 'atomicAdd' : Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or gl_SemanticsAcquireRelease +ERROR: 0:24: 'atomicCompSwap' : semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 0:25: 'memoryBarrier' : gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease +ERROR: 0:26: 'memoryBarrier' : gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease +ERROR: 12 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.merge-unreachable.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.merge-unreachable.frag.out index 24c0f4b4466..7ec0f33dfc4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.merge-unreachable.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.merge-unreachable.frag.out @@ -1,6 +1,6 @@ spv.merge-unreachable.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 25 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out new file mode 100644 index 00000000000..8090f7bf08e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out @@ -0,0 +1,258 @@ +spv.meshShaderBuiltins.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 146 + + Capability ClipDistance + Capability CullDistance + Capability MultiViewport + Capability DrawParameters + Capability ShaderViewportMaskNV + Capability MeshShadingNV + Extension "SPV_KHR_shader_draw_parameters" + Extension "SPV_NV_mesh_shader" + Extension "SPV_NV_viewport_array2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 17 34 88 128 139 143 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 460 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "gid" + Name 17 "gl_WorkGroupID" + Name 30 "gl_MeshPerVertexNV" + MemberName 30(gl_MeshPerVertexNV) 0 "gl_Position" + MemberName 30(gl_MeshPerVertexNV) 1 "gl_PointSize" + MemberName 30(gl_MeshPerVertexNV) 2 "gl_ClipDistance" + MemberName 30(gl_MeshPerVertexNV) 3 "gl_CullDistance" + MemberName 30(gl_MeshPerVertexNV) 4 "gl_PositionPerViewNV" + MemberName 30(gl_MeshPerVertexNV) 5 "gl_ClipDistancePerViewNV" + MemberName 30(gl_MeshPerVertexNV) 6 "gl_CullDistancePerViewNV" + Name 34 "gl_MeshVerticesNV" + Name 84 "gl_MeshPerPrimitiveNV" + MemberName 84(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID" + MemberName 84(gl_MeshPerPrimitiveNV) 1 "gl_Layer" + MemberName 84(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" + MemberName 84(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" + MemberName 84(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV" + MemberName 84(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV" + Name 88 "gl_MeshPrimitivesNV" + Name 128 "gl_PrimitiveIndicesNV" + Name 139 "gl_DrawID" + Name 143 "gl_PrimitiveCountNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 30(gl_MeshPerVertexNV) 0 BuiltIn Position + MemberDecorate 30(gl_MeshPerVertexNV) 1 BuiltIn PointSize + MemberDecorate 30(gl_MeshPerVertexNV) 2 BuiltIn ClipDistance + MemberDecorate 30(gl_MeshPerVertexNV) 3 BuiltIn CullDistance + MemberDecorate 30(gl_MeshPerVertexNV) 4 PerViewNV + MemberDecorate 30(gl_MeshPerVertexNV) 4 BuiltIn PositionPerViewNV + MemberDecorate 30(gl_MeshPerVertexNV) 5 PerViewNV + MemberDecorate 30(gl_MeshPerVertexNV) 5 BuiltIn ClipDistancePerViewNV + MemberDecorate 30(gl_MeshPerVertexNV) 6 PerViewNV + MemberDecorate 30(gl_MeshPerVertexNV) 6 BuiltIn CullDistancePerViewNV + Decorate 30(gl_MeshPerVertexNV) Block + MemberDecorate 84(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId + MemberDecorate 84(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer + MemberDecorate 84(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex + MemberDecorate 84(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 4 PerPrimitiveNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 4 PerViewNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 4 BuiltIn LayerPerViewNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 PerPrimitiveNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 PerViewNV + MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV + Decorate 84(gl_MeshPerPrimitiveNV) Block + Decorate 128(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV + Decorate 139(gl_DrawID) BuiltIn DrawIndex + Decorate 143(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV + Decorate 145 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) +17(gl_WorkGroupID): 10(ptr) Variable Input + 20: TypeFloat 32 + 21: TypeVector 20(float) 4 + 22: 6(int) Constant 4 + 23: TypeArray 20(float) 22 + 24: 6(int) Constant 3 + 25: TypeArray 20(float) 24 + 26: TypeArray 21(fvec4) 22 + 27: 6(int) Constant 1 + 28: TypeArray 20(float) 27 + 29: TypeArray 28 22 +30(gl_MeshPerVertexNV): TypeStruct 21(fvec4) 20(float) 23 25 26 29 29 + 31: 6(int) Constant 81 + 32: TypeArray 30(gl_MeshPerVertexNV) 31 + 33: TypePointer Output 32 +34(gl_MeshVerticesNV): 33(ptr) Variable Output + 36: TypeInt 32 1 + 37: 36(int) Constant 0 + 38: 20(float) Constant 1065353216 + 39: 21(fvec4) ConstantComposite 38 38 38 38 + 40: TypePointer Output 21(fvec4) + 43: 36(int) Constant 1 + 44: 20(float) Constant 1073741824 + 45: TypePointer Output 20(float) + 48: 36(int) Constant 2 + 49: 36(int) Constant 3 + 50: 20(float) Constant 1077936128 + 53: 20(float) Constant 1082130432 + 55: 6(int) Constant 264 + 56: 6(int) Constant 2 + 81: TypeArray 36(int) 27 + 82: TypeArray 36(int) 22 + 83: TypeArray 81 22 +84(gl_MeshPerPrimitiveNV): TypeStruct 36(int) 36(int) 36(int) 81 82 83 + 85: 6(int) Constant 32 + 86: TypeArray 84(gl_MeshPerPrimitiveNV) 85 + 87: TypePointer Output 86 +88(gl_MeshPrimitivesNV): 87(ptr) Variable Output + 90: 36(int) Constant 6 + 91: TypePointer Output 36(int) + 94: 36(int) Constant 7 + 97: 36(int) Constant 8 + 100: 36(int) Constant 9 + 126: TypeArray 6(int) 31 + 127: TypePointer Output 126 +128(gl_PrimitiveIndicesNV): 127(ptr) Variable Output + 129: 6(int) Constant 257 + 130: TypePointer Output 6(int) + 138: TypePointer Input 36(int) + 139(gl_DrawID): 138(ptr) Variable Input + 142: 6(int) Constant 16909060 +143(gl_PrimitiveCountNV): 130(ptr) Variable Output + 144: 6(int) Constant 96 + 145: 9(ivec3) ConstantComposite 85 27 27 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(gid): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 18: 13(ptr) AccessChain 17(gl_WorkGroupID) 12 + 19: 6(int) Load 18 + Store 16(gid) 19 + 35: 6(int) Load 8(iid) + 41: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 35 37 + Store 41 39 + 42: 6(int) Load 8(iid) + 46: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 42 43 + Store 46 44 + 47: 6(int) Load 8(iid) + 51: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 47 48 49 + Store 51 50 + 52: 6(int) Load 8(iid) + 54: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 52 49 48 + Store 54 53 + MemoryBarrier 27 55 + ControlBarrier 56 56 55 + 57: 6(int) Load 8(iid) + 58: 6(int) IAdd 57 27 + 59: 6(int) Load 8(iid) + 60: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 59 37 + 61: 21(fvec4) Load 60 + 62: 40(ptr) AccessChain 34(gl_MeshVerticesNV) 58 37 + Store 62 61 + 63: 6(int) Load 8(iid) + 64: 6(int) IAdd 63 27 + 65: 6(int) Load 8(iid) + 66: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 65 43 + 67: 20(float) Load 66 + 68: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 64 43 + Store 68 67 + 69: 6(int) Load 8(iid) + 70: 6(int) IAdd 69 27 + 71: 6(int) Load 8(iid) + 72: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 71 48 49 + 73: 20(float) Load 72 + 74: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 70 48 49 + Store 74 73 + 75: 6(int) Load 8(iid) + 76: 6(int) IAdd 75 27 + 77: 6(int) Load 8(iid) + 78: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 77 49 48 + 79: 20(float) Load 78 + 80: 45(ptr) AccessChain 34(gl_MeshVerticesNV) 76 49 48 + Store 80 79 + MemoryBarrier 27 55 + ControlBarrier 56 56 55 + 89: 6(int) Load 8(iid) + 92: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 89 37 + Store 92 90 + 93: 6(int) Load 8(iid) + 95: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 93 43 + Store 95 94 + 96: 6(int) Load 8(iid) + 98: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 96 48 + Store 98 97 + 99: 6(int) Load 8(iid) + 101: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 99 49 37 + Store 101 100 + MemoryBarrier 27 55 + ControlBarrier 56 56 55 + 102: 6(int) Load 8(iid) + 103: 6(int) IAdd 102 27 + 104: 6(int) Load 8(iid) + 105: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 104 37 + 106: 36(int) Load 105 + 107: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 103 37 + Store 107 106 + 108: 6(int) Load 8(iid) + 109: 6(int) IAdd 108 27 + 110: 6(int) Load 8(iid) + 111: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 110 43 + 112: 36(int) Load 111 + 113: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 109 43 + Store 113 112 + 114: 6(int) Load 8(iid) + 115: 6(int) IAdd 114 27 + 116: 6(int) Load 8(iid) + 117: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 116 48 + 118: 36(int) Load 117 + 119: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 115 48 + Store 119 118 + 120: 6(int) Load 8(iid) + 121: 6(int) IAdd 120 27 + 122: 6(int) Load 8(iid) + 123: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 122 49 37 + 124: 36(int) Load 123 + 125: 91(ptr) AccessChain 88(gl_MeshPrimitivesNV) 121 49 37 + Store 125 124 + MemoryBarrier 27 55 + ControlBarrier 56 56 55 + 131: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 37 + Store 131 129 + 132: 6(int) Load 16(gid) + 133: 6(int) Load 16(gid) + 134: 6(int) ISub 133 27 + 135: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 134 + 136: 6(int) Load 135 + 137: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 132 + Store 137 136 + 140: 36(int) Load 139(gl_DrawID) + 141: 6(int) Bitcast 140 + 142: 141 WritePackedPrimitiveIndices4x8NV + Store 143(gl_PrimitiveCountNV) 144 + MemoryBarrier 27 55 + ControlBarrier 56 56 55 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out new file mode 100644 index 00000000000..b912acafcf5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderPerViewBuiltins.mesh.out @@ -0,0 +1,214 @@ +spv.meshShaderPerViewBuiltins.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 126 + + Capability MultiViewport + Capability PerViewAttributesNV + Capability MeshShadingNV + Extension "SPV_NVX_multiview_per_view_attributes" + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 20 21 40 72 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "viewID" + Name 20 "gl_MeshViewIndicesNV" + Name 21 "gl_MeshViewCountNV" + Name 36 "gl_MeshPerVertexNV" + MemberName 36(gl_MeshPerVertexNV) 0 "gl_Position" + MemberName 36(gl_MeshPerVertexNV) 1 "gl_PointSize" + MemberName 36(gl_MeshPerVertexNV) 2 "gl_ClipDistance" + MemberName 36(gl_MeshPerVertexNV) 3 "gl_CullDistance" + MemberName 36(gl_MeshPerVertexNV) 4 "gl_PositionPerViewNV" + MemberName 36(gl_MeshPerVertexNV) 5 "gl_ClipDistancePerViewNV" + MemberName 36(gl_MeshPerVertexNV) 6 "gl_CullDistancePerViewNV" + Name 40 "gl_MeshVerticesNV" + Name 68 "gl_MeshPerPrimitiveNV" + MemberName 68(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID" + MemberName 68(gl_MeshPerPrimitiveNV) 1 "gl_Layer" + MemberName 68(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" + MemberName 68(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" + MemberName 68(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV" + MemberName 68(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV" + Name 72 "gl_MeshPrimitivesNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 20(gl_MeshViewIndicesNV) BuiltIn MeshViewIndicesNV + Decorate 21(gl_MeshViewCountNV) BuiltIn MeshViewCountNV + MemberDecorate 36(gl_MeshPerVertexNV) 0 BuiltIn Position + MemberDecorate 36(gl_MeshPerVertexNV) 1 BuiltIn PointSize + MemberDecorate 36(gl_MeshPerVertexNV) 2 BuiltIn ClipDistance + MemberDecorate 36(gl_MeshPerVertexNV) 3 BuiltIn CullDistance + MemberDecorate 36(gl_MeshPerVertexNV) 4 PerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 4 BuiltIn PositionPerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 5 PerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 5 BuiltIn ClipDistancePerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 6 PerViewNV + MemberDecorate 36(gl_MeshPerVertexNV) 6 BuiltIn CullDistancePerViewNV + Decorate 36(gl_MeshPerVertexNV) Block + MemberDecorate 68(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId + MemberDecorate 68(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer + MemberDecorate 68(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex + MemberDecorate 68(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 4 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 4 PerViewNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 4 BuiltIn LayerPerViewNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 5 PerPrimitiveNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 5 PerViewNV + MemberDecorate 68(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV + Decorate 68(gl_MeshPerPrimitiveNV) Block + Decorate 125 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 17: 6(int) Constant 4 + 18: TypeArray 6(int) 17 + 19: TypePointer Input 18 +20(gl_MeshViewIndicesNV): 19(ptr) Variable Input +21(gl_MeshViewCountNV): 13(ptr) Variable Input + 26: TypeFloat 32 + 27: TypeVector 26(float) 4 + 28: 6(int) Constant 1 + 29: TypeArray 26(float) 28 + 30: TypeArray 27(fvec4) 17 + 31: 6(int) Constant 3 + 32: TypeArray 26(float) 31 + 33: TypeArray 32 17 + 34: TypeArray 26(float) 17 + 35: TypeArray 34 17 +36(gl_MeshPerVertexNV): TypeStruct 27(fvec4) 26(float) 29 29 30 33 35 + 37: 6(int) Constant 81 + 38: TypeArray 36(gl_MeshPerVertexNV) 37 + 39: TypePointer Output 38 +40(gl_MeshVerticesNV): 39(ptr) Variable Output + 42: TypeInt 32 1 + 43: 42(int) Constant 4 + 45: 26(float) Constant 1065353216 + 46: 26(float) Constant 1073741824 + 47: 26(float) Constant 1077936128 + 48: 26(float) Constant 1082130432 + 49: 27(fvec4) ConstantComposite 45 46 47 48 + 50: TypePointer Output 27(fvec4) + 53: 42(int) Constant 5 + 55: 42(int) Constant 2 + 56: 26(float) Constant 1084227584 + 57: TypePointer Output 26(float) + 60: 42(int) Constant 6 + 62: 42(int) Constant 3 + 63: 26(float) Constant 1086324736 + 65: TypeArray 42(int) 28 + 66: TypeArray 42(int) 17 + 67: TypeArray 65 17 +68(gl_MeshPerPrimitiveNV): TypeStruct 42(int) 42(int) 42(int) 65 66 67 + 69: 6(int) Constant 32 + 70: TypeArray 68(gl_MeshPerPrimitiveNV) 69 + 71: TypePointer Output 70 +72(gl_MeshPrimitivesNV): 71(ptr) Variable Output + 75: 42(int) Constant 7 + 76: TypePointer Output 42(int) + 80: 42(int) Constant 0 + 81: 42(int) Constant 8 + 83: 6(int) Constant 264 + 84: 6(int) Constant 2 + 125: 9(ivec3) ConstantComposite 69 28 28 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(viewID): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 22: 6(int) Load 21(gl_MeshViewCountNV) + 23: 6(int) UMod 22 17 + 24: 13(ptr) AccessChain 20(gl_MeshViewIndicesNV) 23 + 25: 6(int) Load 24 + Store 16(viewID) 25 + 41: 6(int) Load 8(iid) + 44: 6(int) Load 16(viewID) + 51: 50(ptr) AccessChain 40(gl_MeshVerticesNV) 41 43 44 + Store 51 49 + 52: 6(int) Load 8(iid) + 54: 6(int) Load 16(viewID) + 58: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 52 53 54 55 + Store 58 56 + 59: 6(int) Load 8(iid) + 61: 6(int) Load 16(viewID) + 64: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 59 60 61 62 + Store 64 63 + 73: 6(int) Load 8(iid) + 74: 6(int) Load 16(viewID) + 77: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 73 43 74 + Store 77 75 + 78: 6(int) Load 8(iid) + 79: 6(int) Load 16(viewID) + 82: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 78 53 79 80 + Store 82 81 + MemoryBarrier 28 83 + ControlBarrier 84 84 83 + 85: 6(int) Load 8(iid) + 86: 6(int) IAdd 85 28 + 87: 6(int) Load 16(viewID) + 88: 6(int) Load 8(iid) + 89: 6(int) Load 16(viewID) + 90: 50(ptr) AccessChain 40(gl_MeshVerticesNV) 88 43 89 + 91: 27(fvec4) Load 90 + 92: 50(ptr) AccessChain 40(gl_MeshVerticesNV) 86 43 87 + Store 92 91 + 93: 6(int) Load 8(iid) + 94: 6(int) IAdd 93 28 + 95: 6(int) Load 16(viewID) + 96: 6(int) Load 8(iid) + 97: 6(int) Load 16(viewID) + 98: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 96 53 97 55 + 99: 26(float) Load 98 + 100: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 94 53 95 55 + Store 100 99 + 101: 6(int) Load 8(iid) + 102: 6(int) IAdd 101 28 + 103: 6(int) Load 16(viewID) + 104: 6(int) Load 8(iid) + 105: 6(int) Load 16(viewID) + 106: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 104 60 105 62 + 107: 26(float) Load 106 + 108: 57(ptr) AccessChain 40(gl_MeshVerticesNV) 102 60 103 62 + Store 108 107 + 109: 6(int) Load 8(iid) + 110: 6(int) IAdd 109 28 + 111: 6(int) Load 16(viewID) + 112: 6(int) Load 8(iid) + 113: 6(int) Load 16(viewID) + 114: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 112 43 113 + 115: 42(int) Load 114 + 116: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 110 43 111 + Store 116 115 + 117: 6(int) Load 8(iid) + 118: 6(int) IAdd 117 28 + 119: 6(int) Load 16(viewID) + 120: 6(int) Load 8(iid) + 121: 6(int) Load 16(viewID) + 122: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 120 53 121 80 + 123: 42(int) Load 122 + 124: 76(ptr) AccessChain 72(gl_MeshPrimitivesNV) 118 53 119 80 + Store 124 123 + MemoryBarrier 28 83 + ControlBarrier 84 84 83 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderPerViewUserDefined.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderPerViewUserDefined.mesh.out new file mode 100644 index 00000000000..7e7a37db993 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderPerViewUserDefined.mesh.out @@ -0,0 +1,156 @@ +spv.meshShaderPerViewUserDefined.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 90 + + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 20 21 35 67 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "viewID" + Name 20 "gl_MeshViewIndicesNV" + Name 21 "gl_MeshViewCountNV" + Name 31 "block" + MemberName 31(block) 0 "color1" + MemberName 31(block) 1 "color2" + MemberName 31(block) 2 "color3" + MemberName 31(block) 3 "color4" + Name 35 "b" + Name 64 "perviewBlock" + MemberName 64(perviewBlock) 0 "color5" + MemberName 64(perviewBlock) 1 "color6" + MemberName 64(perviewBlock) 2 "color7" + MemberName 64(perviewBlock) 3 "color8" + Name 67 "b2" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 20(gl_MeshViewIndicesNV) BuiltIn MeshViewIndicesNV + Decorate 21(gl_MeshViewCountNV) BuiltIn MeshViewCountNV + MemberDecorate 31(block) 0 PerPrimitiveNV + MemberDecorate 31(block) 0 PerViewNV + MemberDecorate 31(block) 1 PerPrimitiveNV + MemberDecorate 31(block) 2 PerViewNV + Decorate 31(block) Block + Decorate 35(b) Location 0 + MemberDecorate 64(perviewBlock) 0 PerPrimitiveNV + MemberDecorate 64(perviewBlock) 0 PerViewNV + MemberDecorate 64(perviewBlock) 1 PerPrimitiveNV + MemberDecorate 64(perviewBlock) 1 PerViewNV + MemberDecorate 64(perviewBlock) 2 PerViewNV + MemberDecorate 64(perviewBlock) 3 PerViewNV + Decorate 64(perviewBlock) Block + Decorate 67(b2) Location 10 + Decorate 89 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 17: 6(int) Constant 4 + 18: TypeArray 6(int) 17 + 19: TypePointer Input 18 +20(gl_MeshViewIndicesNV): 19(ptr) Variable Input +21(gl_MeshViewCountNV): 13(ptr) Variable Input + 26: TypeFloat 32 + 27: TypeVector 26(float) 4 + 28: 6(int) Constant 3 + 29: TypeArray 27(fvec4) 28 + 30: TypeArray 29 17 + 31(block): TypeStruct 30 29 30 27(fvec4) + 32: 6(int) Constant 81 + 33: TypeArray 31(block) 32 + 34: TypePointer Output 33 + 35(b): 34(ptr) Variable Output + 37: TypeInt 32 1 + 38: 37(int) Constant 0 + 40: 37(int) Constant 2 + 41: 26(float) Constant 1065353216 + 42: 27(fvec4) ConstantComposite 41 41 41 41 + 43: TypePointer Output 27(fvec4) + 46: 37(int) Constant 1 + 47: 26(float) Constant 1073741824 + 48: 27(fvec4) ConstantComposite 47 47 47 47 + 52: 26(float) Constant 1077936128 + 53: 27(fvec4) ConstantComposite 52 52 52 52 + 56: 37(int) Constant 3 + 57: 26(float) Constant 1082130432 + 58: 27(fvec4) ConstantComposite 57 57 57 57 + 60: 6(int) Constant 1 + 61: 6(int) Constant 264 + 62: 6(int) Constant 2 + 63: TypeArray 27(fvec4) 17 +64(perviewBlock): TypeStruct 63 30 30 63 + 65: TypeArray 64(perviewBlock) 32 + 66: TypePointer Output 65 + 67(b2): 66(ptr) Variable Output + 70: 26(float) Constant 1084227584 + 71: 27(fvec4) ConstantComposite 70 70 70 70 + 75: 26(float) Constant 1086324736 + 76: 27(fvec4) ConstantComposite 75 75 75 75 + 80: 26(float) Constant 1088421888 + 81: 27(fvec4) ConstantComposite 80 80 80 80 + 85: 26(float) Constant 1090519040 + 86: 27(fvec4) ConstantComposite 85 85 85 85 + 88: 6(int) Constant 32 + 89: 9(ivec3) ConstantComposite 88 60 60 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(viewID): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 22: 6(int) Load 21(gl_MeshViewCountNV) + 23: 6(int) UMod 22 17 + 24: 13(ptr) AccessChain 20(gl_MeshViewIndicesNV) 23 + 25: 6(int) Load 24 + Store 16(viewID) 25 + 36: 6(int) Load 8(iid) + 39: 6(int) Load 16(viewID) + 44: 43(ptr) AccessChain 35(b) 36 38 39 40 + Store 44 42 + 45: 6(int) Load 8(iid) + 49: 43(ptr) AccessChain 35(b) 45 46 46 + Store 49 48 + 50: 6(int) Load 8(iid) + 51: 6(int) Load 16(viewID) + 54: 43(ptr) AccessChain 35(b) 50 40 51 40 + Store 54 53 + 55: 6(int) Load 8(iid) + 59: 43(ptr) AccessChain 35(b) 55 56 + Store 59 58 + MemoryBarrier 60 61 + ControlBarrier 62 62 61 + 68: 6(int) Load 8(iid) + 69: 6(int) Load 16(viewID) + 72: 43(ptr) AccessChain 67(b2) 68 38 69 + Store 72 71 + 73: 6(int) Load 8(iid) + 74: 6(int) Load 16(viewID) + 77: 43(ptr) AccessChain 67(b2) 73 46 74 46 + Store 77 76 + 78: 6(int) Load 8(iid) + 79: 6(int) Load 16(viewID) + 82: 43(ptr) AccessChain 67(b2) 78 40 79 40 + Store 82 81 + 83: 6(int) Load 8(iid) + 84: 6(int) Load 16(viewID) + 87: 43(ptr) AccessChain 67(b2) 83 56 84 + Store 87 86 + MemoryBarrier 60 61 + ControlBarrier 62 62 61 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out new file mode 100644 index 00000000000..f4491c0ec4a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out @@ -0,0 +1,201 @@ +spv.meshShaderRedeclBuiltins.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 120 + + Capability ClipDistance + Capability CullDistance + Capability MultiViewport + Capability ShaderViewportMaskNV + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + Extension "SPV_NV_viewport_array2" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 17 28 81 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 460 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "gid" + Name 17 "gl_WorkGroupID" + Name 24 "gl_MeshPerVertexNV" + MemberName 24(gl_MeshPerVertexNV) 0 "gl_Position" + MemberName 24(gl_MeshPerVertexNV) 1 "gl_PointSize" + MemberName 24(gl_MeshPerVertexNV) 2 "gl_ClipDistance" + MemberName 24(gl_MeshPerVertexNV) 3 "gl_CullDistance" + Name 28 "gl_MeshVerticesNV" + Name 77 "gl_MeshPerPrimitiveNV" + MemberName 77(gl_MeshPerPrimitiveNV) 0 "gl_PrimitiveID" + MemberName 77(gl_MeshPerPrimitiveNV) 1 "gl_Layer" + MemberName 77(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" + MemberName 77(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" + Name 81 "gl_MeshPrimitivesNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 24(gl_MeshPerVertexNV) 0 BuiltIn Position + MemberDecorate 24(gl_MeshPerVertexNV) 1 BuiltIn PointSize + MemberDecorate 24(gl_MeshPerVertexNV) 2 BuiltIn ClipDistance + MemberDecorate 24(gl_MeshPerVertexNV) 3 BuiltIn CullDistance + Decorate 24(gl_MeshPerVertexNV) Block + MemberDecorate 77(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 0 BuiltIn PrimitiveId + MemberDecorate 77(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 1 BuiltIn Layer + MemberDecorate 77(gl_MeshPerPrimitiveNV) 2 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 2 BuiltIn ViewportIndex + MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV + MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV + Decorate 77(gl_MeshPerPrimitiveNV) Block + Decorate 119 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) +17(gl_WorkGroupID): 10(ptr) Variable Input + 20: TypeFloat 32 + 21: TypeVector 20(float) 4 + 22: 6(int) Constant 4 + 23: TypeArray 20(float) 22 +24(gl_MeshPerVertexNV): TypeStruct 21(fvec4) 20(float) 23 23 + 25: 6(int) Constant 81 + 26: TypeArray 24(gl_MeshPerVertexNV) 25 + 27: TypePointer Output 26 +28(gl_MeshVerticesNV): 27(ptr) Variable Output + 30: TypeInt 32 1 + 31: 30(int) Constant 0 + 32: 20(float) Constant 1065353216 + 33: 21(fvec4) ConstantComposite 32 32 32 32 + 34: TypePointer Output 21(fvec4) + 37: 30(int) Constant 1 + 38: 20(float) Constant 1073741824 + 39: TypePointer Output 20(float) + 42: 30(int) Constant 2 + 43: 30(int) Constant 3 + 44: 20(float) Constant 1077936128 + 47: 20(float) Constant 1082130432 + 49: 6(int) Constant 1 + 50: 6(int) Constant 264 + 51: 6(int) Constant 2 + 76: TypeArray 30(int) 49 +77(gl_MeshPerPrimitiveNV): TypeStruct 30(int) 30(int) 30(int) 76 + 78: 6(int) Constant 32 + 79: TypeArray 77(gl_MeshPerPrimitiveNV) 78 + 80: TypePointer Output 79 +81(gl_MeshPrimitivesNV): 80(ptr) Variable Output + 83: 30(int) Constant 6 + 84: TypePointer Output 30(int) + 87: 30(int) Constant 7 + 90: 30(int) Constant 8 + 93: 30(int) Constant 9 + 119: 9(ivec3) ConstantComposite 78 49 49 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(gid): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 18: 13(ptr) AccessChain 17(gl_WorkGroupID) 12 + 19: 6(int) Load 18 + Store 16(gid) 19 + 29: 6(int) Load 8(iid) + 35: 34(ptr) AccessChain 28(gl_MeshVerticesNV) 29 31 + Store 35 33 + 36: 6(int) Load 8(iid) + 40: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 36 37 + Store 40 38 + 41: 6(int) Load 8(iid) + 45: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 41 42 43 + Store 45 44 + 46: 6(int) Load 8(iid) + 48: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 46 43 42 + Store 48 47 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + 52: 6(int) Load 8(iid) + 53: 6(int) IAdd 52 49 + 54: 6(int) Load 8(iid) + 55: 34(ptr) AccessChain 28(gl_MeshVerticesNV) 54 31 + 56: 21(fvec4) Load 55 + 57: 34(ptr) AccessChain 28(gl_MeshVerticesNV) 53 31 + Store 57 56 + 58: 6(int) Load 8(iid) + 59: 6(int) IAdd 58 49 + 60: 6(int) Load 8(iid) + 61: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 60 37 + 62: 20(float) Load 61 + 63: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 59 37 + Store 63 62 + 64: 6(int) Load 8(iid) + 65: 6(int) IAdd 64 49 + 66: 6(int) Load 8(iid) + 67: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 66 42 43 + 68: 20(float) Load 67 + 69: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 65 42 43 + Store 69 68 + 70: 6(int) Load 8(iid) + 71: 6(int) IAdd 70 49 + 72: 6(int) Load 8(iid) + 73: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 72 43 42 + 74: 20(float) Load 73 + 75: 39(ptr) AccessChain 28(gl_MeshVerticesNV) 71 43 42 + Store 75 74 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + 82: 6(int) Load 8(iid) + 85: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 82 31 + Store 85 83 + 86: 6(int) Load 8(iid) + 88: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 86 37 + Store 88 87 + 89: 6(int) Load 8(iid) + 91: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 89 42 + Store 91 90 + 92: 6(int) Load 8(iid) + 94: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 92 43 31 + Store 94 93 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + 95: 6(int) Load 8(iid) + 96: 6(int) IAdd 95 49 + 97: 6(int) Load 8(iid) + 98: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 97 31 + 99: 30(int) Load 98 + 100: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 96 31 + Store 100 99 + 101: 6(int) Load 8(iid) + 102: 6(int) IAdd 101 49 + 103: 6(int) Load 8(iid) + 104: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 103 37 + 105: 30(int) Load 104 + 106: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 102 37 + Store 106 105 + 107: 6(int) Load 8(iid) + 108: 6(int) IAdd 107 49 + 109: 6(int) Load 8(iid) + 110: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 109 42 + 111: 30(int) Load 110 + 112: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 108 42 + Store 112 111 + 113: 6(int) Load 8(iid) + 114: 6(int) IAdd 113 49 + 115: 6(int) Load 8(iid) + 116: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 115 43 31 + 117: 30(int) Load 116 + 118: 84(ptr) AccessChain 81(gl_MeshPrimitivesNV) 114 43 31 + Store 118 117 + MemoryBarrier 49 50 + ControlBarrier 51 51 50 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclPerViewBuiltins.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclPerViewBuiltins.mesh.out new file mode 100644 index 00000000000..6672dc24344 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclPerViewBuiltins.mesh.out @@ -0,0 +1,187 @@ +spv.meshShaderRedeclPerViewBuiltins.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 120 + + Capability PerViewAttributesNV + Capability MeshShadingNV + Extension "SPV_NVX_multiview_per_view_attributes" + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 20 21 35 67 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "viewID" + Name 20 "gl_MeshViewIndicesNV" + Name 21 "gl_MeshViewCountNV" + Name 31 "gl_MeshPerVertexNV" + MemberName 31(gl_MeshPerVertexNV) 0 "gl_PositionPerViewNV" + MemberName 31(gl_MeshPerVertexNV) 1 "gl_ClipDistancePerViewNV" + MemberName 31(gl_MeshPerVertexNV) 2 "gl_CullDistancePerViewNV" + Name 35 "gl_MeshVerticesNV" + Name 63 "gl_MeshPerPrimitiveNV" + MemberName 63(gl_MeshPerPrimitiveNV) 0 "gl_LayerPerViewNV" + MemberName 63(gl_MeshPerPrimitiveNV) 1 "gl_ViewportMaskPerViewNV" + Name 67 "gl_MeshPrimitivesNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 20(gl_MeshViewIndicesNV) BuiltIn MeshViewIndicesNV + Decorate 21(gl_MeshViewCountNV) BuiltIn MeshViewCountNV + MemberDecorate 31(gl_MeshPerVertexNV) 0 PerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 0 BuiltIn PositionPerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 1 PerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 1 BuiltIn ClipDistancePerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 2 PerViewNV + MemberDecorate 31(gl_MeshPerVertexNV) 2 BuiltIn CullDistancePerViewNV + Decorate 31(gl_MeshPerVertexNV) Block + MemberDecorate 63(gl_MeshPerPrimitiveNV) 0 PerPrimitiveNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 0 PerViewNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 0 BuiltIn LayerPerViewNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 1 PerPrimitiveNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 1 PerViewNV + MemberDecorate 63(gl_MeshPerPrimitiveNV) 1 BuiltIn ViewportMaskPerViewNV + Decorate 63(gl_MeshPerPrimitiveNV) Block + Decorate 119 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 17: 6(int) Constant 4 + 18: TypeArray 6(int) 17 + 19: TypePointer Input 18 +20(gl_MeshViewIndicesNV): 19(ptr) Variable Input +21(gl_MeshViewCountNV): 13(ptr) Variable Input + 26: TypeFloat 32 + 27: TypeVector 26(float) 4 + 28: TypeArray 27(fvec4) 17 + 29: TypeArray 26(float) 17 + 30: TypeArray 29 17 +31(gl_MeshPerVertexNV): TypeStruct 28 30 30 + 32: 6(int) Constant 81 + 33: TypeArray 31(gl_MeshPerVertexNV) 32 + 34: TypePointer Output 33 +35(gl_MeshVerticesNV): 34(ptr) Variable Output + 37: TypeInt 32 1 + 38: 37(int) Constant 0 + 40: 26(float) Constant 1065353216 + 41: 26(float) Constant 1073741824 + 42: 26(float) Constant 1077936128 + 43: 26(float) Constant 1082130432 + 44: 27(fvec4) ConstantComposite 40 41 42 43 + 45: TypePointer Output 27(fvec4) + 48: 37(int) Constant 1 + 50: 37(int) Constant 2 + 51: 26(float) Constant 1084227584 + 52: TypePointer Output 26(float) + 56: 37(int) Constant 3 + 57: 26(float) Constant 1086324736 + 59: TypeArray 37(int) 17 + 60: 6(int) Constant 1 + 61: TypeArray 37(int) 60 + 62: TypeArray 61 17 +63(gl_MeshPerPrimitiveNV): TypeStruct 59 62 + 64: 6(int) Constant 32 + 65: TypeArray 63(gl_MeshPerPrimitiveNV) 64 + 66: TypePointer Output 65 +67(gl_MeshPrimitivesNV): 66(ptr) Variable Output + 70: 37(int) Constant 7 + 71: TypePointer Output 37(int) + 75: 37(int) Constant 8 + 77: 6(int) Constant 264 + 78: 6(int) Constant 2 + 119: 9(ivec3) ConstantComposite 64 60 60 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(viewID): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 22: 6(int) Load 21(gl_MeshViewCountNV) + 23: 6(int) UMod 22 17 + 24: 13(ptr) AccessChain 20(gl_MeshViewIndicesNV) 23 + 25: 6(int) Load 24 + Store 16(viewID) 25 + 36: 6(int) Load 8(iid) + 39: 6(int) Load 16(viewID) + 46: 45(ptr) AccessChain 35(gl_MeshVerticesNV) 36 38 39 + Store 46 44 + 47: 6(int) Load 8(iid) + 49: 6(int) Load 16(viewID) + 53: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 47 48 49 50 + Store 53 51 + 54: 6(int) Load 8(iid) + 55: 6(int) Load 16(viewID) + 58: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 54 50 55 56 + Store 58 57 + 68: 6(int) Load 8(iid) + 69: 6(int) Load 16(viewID) + 72: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 68 38 69 + Store 72 70 + 73: 6(int) Load 8(iid) + 74: 6(int) Load 16(viewID) + 76: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 73 48 74 38 + Store 76 75 + MemoryBarrier 60 77 + ControlBarrier 78 78 77 + 79: 6(int) Load 8(iid) + 80: 6(int) IAdd 79 60 + 81: 6(int) Load 16(viewID) + 82: 6(int) Load 8(iid) + 83: 6(int) Load 16(viewID) + 84: 45(ptr) AccessChain 35(gl_MeshVerticesNV) 82 38 83 + 85: 27(fvec4) Load 84 + 86: 45(ptr) AccessChain 35(gl_MeshVerticesNV) 80 38 81 + Store 86 85 + 87: 6(int) Load 8(iid) + 88: 6(int) IAdd 87 60 + 89: 6(int) Load 16(viewID) + 90: 6(int) Load 8(iid) + 91: 6(int) Load 16(viewID) + 92: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 90 48 91 50 + 93: 26(float) Load 92 + 94: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 88 48 89 50 + Store 94 93 + 95: 6(int) Load 8(iid) + 96: 6(int) IAdd 95 60 + 97: 6(int) Load 16(viewID) + 98: 6(int) Load 8(iid) + 99: 6(int) Load 16(viewID) + 100: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 98 50 99 56 + 101: 26(float) Load 100 + 102: 52(ptr) AccessChain 35(gl_MeshVerticesNV) 96 50 97 56 + Store 102 101 + 103: 6(int) Load 8(iid) + 104: 6(int) IAdd 103 60 + 105: 6(int) Load 16(viewID) + 106: 6(int) Load 8(iid) + 107: 6(int) Load 16(viewID) + 108: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 106 38 107 + 109: 37(int) Load 108 + 110: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 104 38 105 + Store 110 109 + 111: 6(int) Load 8(iid) + 112: 6(int) IAdd 111 60 + 113: 6(int) Load 16(viewID) + 114: 6(int) Load 8(iid) + 115: 6(int) Load 16(viewID) + 116: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 114 48 115 38 + 117: 37(int) Load 116 + 118: 71(ptr) AccessChain 67(gl_MeshPrimitivesNV) 112 48 113 38 + Store 118 117 + MemoryBarrier 60 77 + ControlBarrier 78 78 77 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderSharedMem.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderSharedMem.mesh.out new file mode 100644 index 00000000000..198f8129ac1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderSharedMem.mesh.out @@ -0,0 +1,128 @@ +spv.meshShaderSharedMem.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 77 + + Capability StorageImageWriteWithoutFormat + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 17 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "gid" + Name 17 "gl_WorkGroupID" + Name 20 "i" + Name 34 "mem" + Name 37 "block0" + MemberName 37(block0) 0 "uni_value" + Name 39 "" + Name 55 "uni_image" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 37(block0) 0 Offset 0 + Decorate 37(block0) Block + Decorate 39 DescriptorSet 0 + Decorate 55(uni_image) DescriptorSet 0 + Decorate 55(uni_image) NonReadable + Decorate 76 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) +17(gl_WorkGroupID): 10(ptr) Variable Input + 27: 6(int) Constant 10 + 28: TypeBool + 30: TypeFloat 32 + 31: TypeVector 30(float) 4 + 32: TypeArray 31(fvec4) 27 + 33: TypePointer Workgroup 32 + 34(mem): 33(ptr) Variable Workgroup + 37(block0): TypeStruct 6(int) + 38: TypePointer Uniform 37(block0) + 39: 38(ptr) Variable Uniform + 40: TypeInt 32 1 + 41: 40(int) Constant 0 + 42: TypePointer Uniform 6(int) + 48: TypePointer Workgroup 31(fvec4) + 51: 40(int) Constant 1 + 53: TypeImage 30(float) 2D nonsampled format:Unknown + 54: TypePointer UniformConstant 53 + 55(uni_image): 54(ptr) Variable UniformConstant + 59: TypeVector 40(int) 2 + 69: 6(int) Constant 1 + 73: 6(int) Constant 264 + 74: 6(int) Constant 2 + 75: 6(int) Constant 32 + 76: 9(ivec3) ConstantComposite 75 69 69 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(gid): 7(ptr) Variable Function + 20(i): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 18: 13(ptr) AccessChain 17(gl_WorkGroupID) 12 + 19: 6(int) Load 18 + Store 16(gid) 19 + Store 20(i) 12 + Branch 21 + 21: Label + LoopMerge 23 24 None + Branch 25 + 25: Label + 26: 6(int) Load 20(i) + 29: 28(bool) ULessThan 26 27 + BranchConditional 29 22 23 + 22: Label + 35: 6(int) Load 20(i) + 36: 6(int) Load 20(i) + 43: 42(ptr) AccessChain 39 41 + 44: 6(int) Load 43 + 45: 6(int) IAdd 36 44 + 46: 30(float) ConvertUToF 45 + 47: 31(fvec4) CompositeConstruct 46 46 46 46 + 49: 48(ptr) AccessChain 34(mem) 35 + Store 49 47 + Branch 24 + 24: Label + 50: 6(int) Load 20(i) + 52: 6(int) IAdd 50 51 + Store 20(i) 52 + Branch 21 + 23: Label + 56: 53 Load 55(uni_image) + 57: 6(int) Load 8(iid) + 58: 40(int) Bitcast 57 + 60: 59(ivec2) CompositeConstruct 58 58 + 61: 6(int) Load 16(gid) + 62: 48(ptr) AccessChain 34(mem) 61 + 63: 31(fvec4) Load 62 + ImageWrite 56 60 63 + 64: 53 Load 55(uni_image) + 65: 6(int) Load 8(iid) + 66: 40(int) Bitcast 65 + 67: 59(ivec2) CompositeConstruct 66 66 + 68: 6(int) Load 16(gid) + 70: 6(int) IAdd 68 69 + 71: 48(ptr) AccessChain 34(mem) 70 + 72: 31(fvec4) Load 71 + ImageWrite 64 67 72 + MemoryBarrier 69 73 + ControlBarrier 74 74 73 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderTaskMem.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderTaskMem.mesh.out new file mode 100644 index 00000000000..93b2a457c72 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderTaskMem.mesh.out @@ -0,0 +1,107 @@ +spv.meshShaderTaskMem.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 58 + + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 22 30 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 18 "outBlock" + MemberName 18(outBlock) 0 "gid5" + MemberName 18(outBlock) 1 "gid6" + Name 22 "myblk" + Name 28 "taskBlock" + MemberName 28(taskBlock) 0 "gid1" + MemberName 28(taskBlock) 1 "gid2" + Name 30 "mytask" + Name 36 "bufferBlock" + MemberName 36(bufferBlock) 0 "gid3" + MemberName 36(bufferBlock) 1 "gid4" + Name 38 "mybuf" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 18(outBlock) Block + Decorate 22(myblk) Location 0 + Decorate 27 ArrayStride 4 + MemberDecorate 28(taskBlock) 0 PerTaskNV + MemberDecorate 28(taskBlock) 0 Offset 0 + MemberDecorate 28(taskBlock) 1 PerTaskNV + MemberDecorate 28(taskBlock) 1 Offset 16 + Decorate 28(taskBlock) Block + Decorate 35 ArrayStride 4 + MemberDecorate 36(bufferBlock) 0 Offset 0 + MemberDecorate 36(bufferBlock) 1 Offset 16 + Decorate 36(bufferBlock) BufferBlock + Decorate 38(mybuf) DescriptorSet 0 + Decorate 57 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) + 16: TypeFloat 32 + 17: TypeVector 16(float) 4 + 18(outBlock): TypeStruct 16(float) 17(fvec4) + 19: 6(int) Constant 81 + 20: TypeArray 18(outBlock) 19 + 21: TypePointer Output 20 + 22(myblk): 21(ptr) Variable Output + 24: TypeInt 32 1 + 25: 24(int) Constant 0 + 26: 6(int) Constant 2 + 27: TypeArray 16(float) 26 + 28(taskBlock): TypeStruct 27 17(fvec4) + 29: TypePointer Input 28(taskBlock) + 30(mytask): 29(ptr) Variable Input + 31: 24(int) Constant 1 + 32: TypePointer Input 16(float) + 35: TypeArray 16(float) 26 + 36(bufferBlock): TypeStruct 35 17(fvec4) + 37: TypePointer Uniform 36(bufferBlock) + 38(mybuf): 37(ptr) Variable Uniform + 39: TypePointer Uniform 16(float) + 43: TypePointer Output 16(float) + 46: TypePointer Input 17(fvec4) + 49: TypePointer Uniform 17(fvec4) + 53: TypePointer Output 17(fvec4) + 55: 6(int) Constant 32 + 56: 6(int) Constant 1 + 57: 9(ivec3) ConstantComposite 55 56 56 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 23: 6(int) Load 8(iid) + 33: 32(ptr) AccessChain 30(mytask) 25 31 + 34: 16(float) Load 33 + 40: 39(ptr) AccessChain 38(mybuf) 25 31 + 41: 16(float) Load 40 + 42: 16(float) FAdd 34 41 + 44: 43(ptr) AccessChain 22(myblk) 23 25 + Store 44 42 + 45: 6(int) Load 8(iid) + 47: 46(ptr) AccessChain 30(mytask) 31 + 48: 17(fvec4) Load 47 + 50: 49(ptr) AccessChain 38(mybuf) 31 + 51: 17(fvec4) Load 50 + 52: 17(fvec4) FAdd 48 51 + 54: 53(ptr) AccessChain 22(myblk) 45 31 + Store 54 52 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderUserDefined.mesh.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderUserDefined.mesh.out new file mode 100644 index 00000000000..c3ec91507fa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshShaderUserDefined.mesh.out @@ -0,0 +1,203 @@ +spv.meshShaderUserDefined.mesh +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 138 + + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint MeshNV 4 "main" 11 17 34 101 + ExecutionMode 4 LocalSize 32 1 1 + ExecutionMode 4 OutputVertices 81 + ExecutionMode 4 OutputPrimitivesNV 32 + ExecutionMode 4 OutputTrianglesNV + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "gid" + Name 17 "gl_WorkGroupID" + Name 30 "myblock" + MemberName 30(myblock) 0 "f" + MemberName 30(myblock) 1 "fArr" + MemberName 30(myblock) 2 "pos" + MemberName 30(myblock) 3 "posArr" + MemberName 30(myblock) 4 "m" + MemberName 30(myblock) 5 "mArr" + Name 34 "blk" + Name 97 "myblock2" + MemberName 97(myblock2) 0 "f" + MemberName 97(myblock2) 1 "pos" + MemberName 97(myblock2) 2 "m" + Name 101 "blk2" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 30(myblock) 0 PerPrimitiveNV + MemberDecorate 30(myblock) 1 PerPrimitiveNV + MemberDecorate 30(myblock) 2 PerPrimitiveNV + MemberDecorate 30(myblock) 3 PerPrimitiveNV + MemberDecorate 30(myblock) 4 PerPrimitiveNV + MemberDecorate 30(myblock) 5 PerPrimitiveNV + Decorate 30(myblock) Block + Decorate 34(blk) Location 0 + Decorate 97(myblock2) Block + Decorate 101(blk2) Location 20 + Decorate 137 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) +17(gl_WorkGroupID): 10(ptr) Variable Input + 20: TypeFloat 32 + 21: 6(int) Constant 4 + 22: TypeArray 20(float) 21 + 23: TypeVector 20(float) 3 + 24: TypeVector 20(float) 4 + 25: TypeArray 24(fvec4) 21 + 26: TypeMatrix 24(fvec4) 4 + 27: TypeMatrix 23(fvec3) 3 + 28: 6(int) Constant 2 + 29: TypeArray 27 28 + 30(myblock): TypeStruct 20(float) 22 23(fvec3) 25 26 29 + 31: 6(int) Constant 32 + 32: TypeArray 30(myblock) 31 + 33: TypePointer Output 32 + 34(blk): 33(ptr) Variable Output + 36: TypeInt 32 1 + 37: 36(int) Constant 0 + 38: 20(float) Constant 1093664768 + 39: TypePointer Output 20(float) + 42: 6(int) Constant 1 + 44: 36(int) Constant 1 + 52: 36(int) Constant 2 + 53: 20(float) Constant 1096810496 + 54: 20(float) Constant 1097859072 + 55: 20(float) Constant 1095761920 + 56: 23(fvec3) ConstantComposite 53 54 55 + 57: TypePointer Output 23(fvec3) + 63: 36(int) Constant 3 + 68: TypePointer Output 24(fvec4) + 74: 36(int) Constant 4 + 75: 20(float) Constant 1098907648 + 76: 24(fvec4) ConstantComposite 55 53 54 75 + 81: 36(int) Constant 5 + 84: 6(int) Constant 3 + 91: 20(float) Constant 1099431936 + 92: 20(float) Constant 1099956224 + 93: 20(float) Constant 1100480512 + 94: 23(fvec3) ConstantComposite 91 92 93 + 96: 6(int) Constant 264 + 97(myblock2): TypeStruct 20(float) 24(fvec4) 26 + 98: 6(int) Constant 81 + 99: TypeArray 97(myblock2) 98 + 100: TypePointer Output 99 + 101(blk2): 100(ptr) Variable Output + 107: 20(float) Constant 1101004800 + 111: 20(float) Constant 1101529088 + 112: 20(float) Constant 1102053376 + 113: 20(float) Constant 1102577664 + 114: 20(float) Constant 1103101952 + 115: 24(fvec4) ConstantComposite 111 112 113 114 + 127: 20(float) Constant 1105723392 + 137: 9(ivec3) ConstantComposite 31 42 42 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(gid): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 18: 13(ptr) AccessChain 17(gl_WorkGroupID) 12 + 19: 6(int) Load 18 + Store 16(gid) 19 + 35: 6(int) Load 8(iid) + 40: 39(ptr) AccessChain 34(blk) 35 37 + Store 40 38 + 41: 6(int) Load 8(iid) + 43: 6(int) IAdd 41 42 + 45: 6(int) Load 16(gid) + 46: 6(int) Load 8(iid) + 47: 39(ptr) AccessChain 34(blk) 46 37 + 48: 20(float) Load 47 + 49: 39(ptr) AccessChain 34(blk) 43 44 45 + Store 49 48 + 50: 6(int) Load 8(iid) + 51: 6(int) UDiv 50 28 + 58: 57(ptr) AccessChain 34(blk) 51 52 + 59: 23(fvec3) Load 58 + 60: 23(fvec3) VectorShuffle 59 56 5 3 4 + Store 58 60 + 61: 6(int) Load 8(iid) + 62: 6(int) IMul 61 28 + 64: 6(int) Load 8(iid) + 65: 6(int) UDiv 64 28 + 66: 57(ptr) AccessChain 34(blk) 65 52 + 67: 23(fvec3) Load 66 + 69: 68(ptr) AccessChain 34(blk) 62 63 44 + 70: 24(fvec4) Load 69 + 71: 24(fvec4) VectorShuffle 70 67 0 4 5 6 + Store 69 71 + 72: 6(int) Load 8(iid) + 73: 6(int) UDiv 72 21 + 77: 68(ptr) AccessChain 34(blk) 73 74 52 + 78: 24(fvec4) Load 77 + 79: 24(fvec4) VectorShuffle 78 76 7 6 5 4 + Store 77 79 + 80: 6(int) Load 8(iid) + 82: 6(int) Load 8(iid) + 83: 6(int) UDiv 82 21 + 85: 39(ptr) AccessChain 34(blk) 83 74 52 84 + 86: 20(float) Load 85 + 87: 39(ptr) AccessChain 34(blk) 80 81 37 44 42 + Store 87 86 + 88: 6(int) Load 8(iid) + 89: 6(int) IMul 88 21 + 90: 6(int) Load 16(gid) + 95: 57(ptr) AccessChain 34(blk) 89 81 44 90 + Store 95 94 + MemoryBarrier 42 96 + ControlBarrier 28 28 96 + 102: 6(int) Load 8(iid) + 103: 6(int) Load 8(iid) + 104: 6(int) ISub 103 42 + 105: 39(ptr) AccessChain 101(blk2) 104 37 + 106: 20(float) Load 105 + 108: 20(float) FAdd 106 107 + 109: 39(ptr) AccessChain 101(blk2) 102 37 + Store 109 108 + 110: 6(int) Load 8(iid) + 116: 68(ptr) AccessChain 101(blk2) 110 44 + Store 116 115 + 117: 6(int) Load 8(iid) + 118: 6(int) IAdd 117 42 + 119: 6(int) Load 16(gid) + 120: 6(int) Load 8(iid) + 121: 68(ptr) AccessChain 101(blk2) 120 44 + 122: 24(fvec4) Load 121 + 123: 68(ptr) AccessChain 101(blk2) 118 52 119 + Store 123 122 + 124: 6(int) Load 8(iid) + 125: 6(int) IAdd 124 42 + 126: 6(int) Load 16(gid) + 128: 39(ptr) AccessChain 101(blk2) 125 52 126 28 + Store 128 127 + 129: 6(int) Load 8(iid) + 130: 6(int) IAdd 129 28 + 131: 6(int) Load 8(iid) + 132: 6(int) IAdd 131 42 + 133: 6(int) Load 16(gid) + 134: 68(ptr) AccessChain 101(blk2) 132 52 133 + 135: 24(fvec4) Load 134 + 136: 68(ptr) AccessChain 101(blk2) 130 52 63 + Store 136 135 + MemoryBarrier 42 96 + ControlBarrier 28 28 96 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshTaskShader.task.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshTaskShader.task.out new file mode 100644 index 00000000000..9ac27fa9b73 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.meshTaskShader.task.out @@ -0,0 +1,172 @@ +spv.meshTaskShader.task +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 104 + + Capability StorageImageWriteWithoutFormat + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint TaskNV 4 "main" 11 17 80 101 + ExecutionMode 4 LocalSize 32 1 1 + Source GLSL 450 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "iid" + Name 11 "gl_LocalInvocationID" + Name 16 "gid" + Name 17 "gl_WorkGroupID" + Name 20 "i" + Name 34 "mem" + Name 37 "block0" + MemberName 37(block0) 0 "uni_value" + Name 39 "" + Name 55 "uni_image" + Name 78 "Task" + MemberName 78(Task) 0 "dummy" + MemberName 78(Task) 1 "submesh" + Name 80 "mytask" + Name 101 "gl_TaskCountNV" + Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId + Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId + MemberDecorate 37(block0) 0 Offset 0 + Decorate 37(block0) Block + Decorate 39 DescriptorSet 0 + Decorate 55(uni_image) DescriptorSet 0 + Decorate 55(uni_image) Binding 0 + Decorate 55(uni_image) NonReadable + Decorate 77 ArrayStride 8 + MemberDecorate 78(Task) 0 PerTaskNV + MemberDecorate 78(Task) 0 Offset 0 + MemberDecorate 78(Task) 1 PerTaskNV + MemberDecorate 78(Task) 1 Offset 8 + Decorate 78(Task) Block + Decorate 101(gl_TaskCountNV) BuiltIn TaskCountNV + Decorate 103 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypeVector 6(int) 3 + 10: TypePointer Input 9(ivec3) +11(gl_LocalInvocationID): 10(ptr) Variable Input + 12: 6(int) Constant 0 + 13: TypePointer Input 6(int) +17(gl_WorkGroupID): 10(ptr) Variable Input + 27: 6(int) Constant 10 + 28: TypeBool + 30: TypeFloat 32 + 31: TypeVector 30(float) 4 + 32: TypeArray 31(fvec4) 27 + 33: TypePointer Workgroup 32 + 34(mem): 33(ptr) Variable Workgroup + 37(block0): TypeStruct 6(int) + 38: TypePointer Uniform 37(block0) + 39: 38(ptr) Variable Uniform + 40: TypeInt 32 1 + 41: 40(int) Constant 0 + 42: TypePointer Uniform 6(int) + 48: TypePointer Workgroup 31(fvec4) + 51: 40(int) Constant 1 + 53: TypeImage 30(float) 2D nonsampled format:Unknown + 54: TypePointer UniformConstant 53 + 55(uni_image): 54(ptr) Variable UniformConstant + 59: TypeVector 40(int) 2 + 69: 6(int) Constant 1 + 73: 6(int) Constant 264 + 74: 6(int) Constant 2 + 75: TypeVector 30(float) 2 + 76: 6(int) Constant 3 + 77: TypeArray 75(fvec2) 76 + 78(Task): TypeStruct 75(fvec2) 77 + 79: TypePointer Output 78(Task) + 80(mytask): 79(ptr) Variable Output + 81: 30(float) Constant 1106247680 + 82: 30(float) Constant 1106771968 + 83: 75(fvec2) ConstantComposite 81 82 + 84: TypePointer Output 75(fvec2) + 86: 30(float) Constant 1107296256 + 87: 30(float) Constant 1107558400 + 88: 75(fvec2) ConstantComposite 86 87 + 90: 30(float) Constant 1107820544 + 91: 30(float) Constant 1108082688 + 92: 75(fvec2) ConstantComposite 90 91 + 94: 40(int) Constant 2 + 100: TypePointer Output 6(int) +101(gl_TaskCountNV): 100(ptr) Variable Output + 102: 6(int) Constant 32 + 103: 9(ivec3) ConstantComposite 102 69 69 + 4(main): 2 Function None 3 + 5: Label + 8(iid): 7(ptr) Variable Function + 16(gid): 7(ptr) Variable Function + 20(i): 7(ptr) Variable Function + 14: 13(ptr) AccessChain 11(gl_LocalInvocationID) 12 + 15: 6(int) Load 14 + Store 8(iid) 15 + 18: 13(ptr) AccessChain 17(gl_WorkGroupID) 12 + 19: 6(int) Load 18 + Store 16(gid) 19 + Store 20(i) 12 + Branch 21 + 21: Label + LoopMerge 23 24 None + Branch 25 + 25: Label + 26: 6(int) Load 20(i) + 29: 28(bool) ULessThan 26 27 + BranchConditional 29 22 23 + 22: Label + 35: 6(int) Load 20(i) + 36: 6(int) Load 20(i) + 43: 42(ptr) AccessChain 39 41 + 44: 6(int) Load 43 + 45: 6(int) IAdd 36 44 + 46: 30(float) ConvertUToF 45 + 47: 31(fvec4) CompositeConstruct 46 46 46 46 + 49: 48(ptr) AccessChain 34(mem) 35 + Store 49 47 + Branch 24 + 24: Label + 50: 6(int) Load 20(i) + 52: 6(int) IAdd 50 51 + Store 20(i) 52 + Branch 21 + 23: Label + 56: 53 Load 55(uni_image) + 57: 6(int) Load 8(iid) + 58: 40(int) Bitcast 57 + 60: 59(ivec2) CompositeConstruct 58 58 + 61: 6(int) Load 16(gid) + 62: 48(ptr) AccessChain 34(mem) 61 + 63: 31(fvec4) Load 62 + ImageWrite 56 60 63 + 64: 53 Load 55(uni_image) + 65: 6(int) Load 8(iid) + 66: 40(int) Bitcast 65 + 67: 59(ivec2) CompositeConstruct 66 66 + 68: 6(int) Load 16(gid) + 70: 6(int) IAdd 68 69 + 71: 48(ptr) AccessChain 34(mem) 70 + 72: 31(fvec4) Load 71 + ImageWrite 64 67 72 + MemoryBarrier 69 73 + ControlBarrier 74 74 73 + 85: 84(ptr) AccessChain 80(mytask) 41 + Store 85 83 + 89: 84(ptr) AccessChain 80(mytask) 51 41 + Store 89 88 + 93: 84(ptr) AccessChain 80(mytask) 51 51 + Store 93 92 + 95: 6(int) Load 16(gid) + 96: 6(int) UMod 95 74 + 97: 84(ptr) AccessChain 80(mytask) 51 96 + 98: 75(fvec2) Load 97 + 99: 84(ptr) AccessChain 80(mytask) 51 94 + Store 99 98 + MemoryBarrier 69 73 + ControlBarrier 74 74 73 + Store 101(gl_TaskCountNV) 76 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStruct.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStruct.comp.out index 04e9c3a3e4e..7e88a59065b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStruct.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStruct.comp.out @@ -1,6 +1,6 @@ spv.multiStruct.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 161 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStructFuncall.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStructFuncall.frag.out index 195f20f764c..14c851cac18 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStructFuncall.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiStructFuncall.frag.out @@ -1,7 +1,7 @@ spv.multiStructFuncall.frag // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 63 +// Generated by (magic number): 80007 +// Id's are bound by 66 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -23,20 +23,21 @@ spv.multiStructFuncall.frag Name 23 "blockName" MemberName 23(blockName) 0 "s1" Name 25 "" - Name 33 "s2" - Name 36 "S" - MemberName 36(S) 0 "m" - Name 38 "param" - Name 45 "param" + Name 31 "S" + MemberName 31(S) 0 "m" + Name 32 "arg" + Name 39 "s2" + Name 42 "param" Name 48 "param" - Name 59 "param" + Name 51 "param" + Name 62 "param" MemberDecorate 22(S) 0 ColMajor MemberDecorate 22(S) 0 Offset 0 MemberDecorate 22(S) 0 MatrixStride 16 MemberDecorate 23(blockName) 0 Offset 0 Decorate 23(blockName) BufferBlock Decorate 25 DescriptorSet 0 - MemberDecorate 36(S) 0 ColMajor + MemberDecorate 31(S) 0 ColMajor 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -53,48 +54,52 @@ spv.multiStructFuncall.frag 26: TypeInt 32 1 27: 26(int) Constant 0 28: TypePointer Uniform 22(S) - 32: TypePointer Private 9(S) - 33(s2): 32(ptr) Variable Private - 36(S): TypeStruct 8 - 37: TypePointer Function 36(S) - 42: TypePointer Function 8 - 57: TypePointer Uniform 8 + 31(S): TypeStruct 8 + 34: TypePointer Function 8 + 38: TypePointer Private 9(S) + 39(s2): 38(ptr) Variable Private + 60: TypePointer Uniform 8 4(main): 2 Function None 3 5: Label - 38(param): 37(ptr) Variable Function - 45(param): 14(ptr) Variable Function - 48(param): 37(ptr) Variable Function - 59(param): 14(ptr) Variable Function + 32(arg): 14(ptr) Variable Function + 42(param): 14(ptr) Variable Function + 48(param): 14(ptr) Variable Function + 51(param): 14(ptr) Variable Function + 62(param): 14(ptr) Variable Function 29: 28(ptr) AccessChain 25 27 30: 22(S) Load 29 - 31: 2 FunctionCall 12(fooConst(struct-S-mf441;) 30 - 34: 9(S) Load 33(s2) - 35: 2 FunctionCall 12(fooConst(struct-S-mf441;) 34 - 39: 28(ptr) AccessChain 25 27 - 40: 22(S) Load 39 - 41: 8 CompositeExtract 40 0 - 43: 42(ptr) AccessChain 38(param) 27 - Store 43 41 - 44: 2 FunctionCall 17(foo(struct-S-mf441;) 38(param) - 46: 9(S) Load 33(s2) - Store 45(param) 46 - 47: 2 FunctionCall 17(foo(struct-S-mf441;) 45(param) - 49: 28(ptr) AccessChain 25 27 - 50: 22(S) Load 49 - 51: 8 CompositeExtract 50 0 - 52: 42(ptr) AccessChain 48(param) 27 - Store 52 51 - 53: 2 FunctionCall 20(fooOut(struct-S-mf441;) 48(param) - 54: 36(S) Load 48(param) - 55: 28(ptr) AccessChain 25 27 - 56: 8 CompositeExtract 54 0 - 58: 57(ptr) AccessChain 55 27 - Store 58 56 - 60: 9(S) Load 33(s2) - Store 59(param) 60 - 61: 2 FunctionCall 20(fooOut(struct-S-mf441;) 59(param) - 62: 9(S) Load 59(param) - Store 33(s2) 62 + 33: 8 CompositeExtract 30 0 + 35: 34(ptr) AccessChain 32(arg) 27 + Store 35 33 + 36: 9(S) Load 32(arg) + 37: 2 FunctionCall 12(fooConst(struct-S-mf441;) 36 + 40: 9(S) Load 39(s2) + 41: 2 FunctionCall 12(fooConst(struct-S-mf441;) 40 + 43: 28(ptr) AccessChain 25 27 + 44: 22(S) Load 43 + 45: 8 CompositeExtract 44 0 + 46: 34(ptr) AccessChain 42(param) 27 + Store 46 45 + 47: 2 FunctionCall 17(foo(struct-S-mf441;) 42(param) + 49: 9(S) Load 39(s2) + Store 48(param) 49 + 50: 2 FunctionCall 17(foo(struct-S-mf441;) 48(param) + 52: 28(ptr) AccessChain 25 27 + 53: 22(S) Load 52 + 54: 8 CompositeExtract 53 0 + 55: 34(ptr) AccessChain 51(param) 27 + Store 55 54 + 56: 2 FunctionCall 20(fooOut(struct-S-mf441;) 51(param) + 57: 9(S) Load 51(param) + 58: 28(ptr) AccessChain 25 27 + 59: 8 CompositeExtract 57 0 + 61: 60(ptr) AccessChain 58 27 + Store 61 59 + 63: 9(S) Load 39(s2) + Store 62(param) 63 + 64: 2 FunctionCall 20(fooOut(struct-S-mf441;) 62(param) + 65: 9(S) Load 62(param) + Store 39(s2) 65 Return FunctionEnd 12(fooConst(struct-S-mf441;): 2 Function None 10 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiView.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiView.frag.out index 0633a121975..9dbd36b992b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiView.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiView.frag.out @@ -1,11 +1,10 @@ spv.multiView.frag -// Module Version 10000 -// Generated by (magic number): 80002 +// Module Version 10300 +// Generated by (magic number): 80007 // Id's are bound by 17 Capability Shader Capability MultiView - Extension "SPV_KHR_multiview" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 "main" 9 12 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out index b3ed72c3947..7874b946496 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.tesc.out @@ -1,6 +1,10 @@ spv.multiviewPerViewAttributes.tesc +error: SPIRV-Tools Validation Errors +error: OpMemberName Member '5' index is larger than Type '27[gl_PositionPerViewNV]'s member count. + OpMemberName %gl_PerVertex_0 5 "gl_PositionPerViewNV" + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 37 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out index f4a589e8183..c8377cfae73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.multiviewPerViewAttributes.vert.out @@ -1,6 +1,6 @@ spv.multiviewPerViewAttributes.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 29 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.newTexture.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.newTexture.frag.out index 4d3f4c7b821..5e462bed4ba 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.newTexture.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.newTexture.frag.out @@ -1,6 +1,10 @@ spv.newTexture.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 284 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out index 6cdc321f58c..066f81f78fa 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noBuiltInLoc.vert.out @@ -1,12 +1,13 @@ spv.noBuiltInLoc.vert // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 33 +// Generated by (magic number): 80007 +// Id's are bound by 35 Capability Shader + Capability AtomicStorage 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 9 11 18 31 32 + EntryPoint Vertex 4 "main" 9 11 18 33 34 Source GLSL 450 Name 4 "main" Name 9 "bar" @@ -20,8 +21,9 @@ spv.noBuiltInLoc.vert Name 24 "uv1" Name 26 "uv2" Name 29 "uv3" - Name 31 "gl_VertexID" - Name 32 "gl_InstanceID" + Name 31 "a_uint" + Name 33 "gl_VertexID" + Name 34 "gl_InstanceID" Decorate 9(bar) Location 0 Decorate 11(foo) Location 0 MemberDecorate 16(gl_PerVertex) 0 BuiltIn Position @@ -35,8 +37,11 @@ spv.noBuiltInLoc.vert Decorate 26(uv2) DescriptorSet 0 Decorate 29(uv3) Location 2 Decorate 29(uv3) DescriptorSet 0 - Decorate 31(gl_VertexID) BuiltIn VertexId - Decorate 32(gl_InstanceID) BuiltIn InstanceId + Decorate 31(a_uint) Offset 0 + Decorate 31(a_uint) DescriptorSet 0 + Decorate 31(a_uint) Binding 0 + Decorate 33(gl_VertexID) BuiltIn VertexId + Decorate 34(gl_InstanceID) BuiltIn InstanceId 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -60,9 +65,11 @@ spv.noBuiltInLoc.vert 27: TypeVector 6(float) 3 28: TypePointer UniformConstant 27(fvec3) 29(uv3): 28(ptr) Variable UniformConstant - 30: TypePointer Input 19(int) - 31(gl_VertexID): 30(ptr) Variable Input -32(gl_InstanceID): 30(ptr) Variable Input + 30: TypePointer AtomicCounter 13(int) + 31(a_uint): 30(ptr) Variable AtomicCounter + 32: TypePointer Input 19(int) + 33(gl_VertexID): 32(ptr) Variable Input +34(gl_InstanceID): 32(ptr) Variable Input 4(main): 2 Function None 3 5: Label 12: 7(fvec4) Load 11(foo) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noDeadDecorations.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noDeadDecorations.vert.out index cba32b5f422..d7e37027184 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noDeadDecorations.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noDeadDecorations.vert.out @@ -1,6 +1,6 @@ spv.noDeadDecorations.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 32 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noWorkgroup.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noWorkgroup.comp.out index 97e7119705a..2624fdcdbd9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noWorkgroup.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.noWorkgroup.comp.out @@ -1,6 +1,6 @@ spv.noWorkgroup.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 12 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonSquare.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonSquare.vert.out index ca472521091..679a5f0f96b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonSquare.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonSquare.vert.out @@ -1,6 +1,6 @@ spv.nonSquare.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 90 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonuniform.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonuniform.frag.out new file mode 100644 index 00000000000..972276a6bf7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.nonuniform.frag.out @@ -0,0 +1,359 @@ +spv.nonuniform.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 210 + + Capability Shader + Capability InputAttachment + Capability SampledBuffer + Capability ImageBuffer + Capability CapabilityShaderNonUniformEXT + Capability CapabilityRuntimeDescriptorArrayEXT + Capability CapabilityInputAttachmentArrayDynamicIndexingEXT + Capability CapabilityUniformTexelBufferArrayDynamicIndexingEXT + Capability CapabilityStorageTexelBufferArrayDynamicIndexingEXT + Capability CapabilityUniformBufferArrayNonUniformIndexingEXT + Capability CapabilitySampledImageArrayNonUniformIndexingEXT + Capability CapabilityStorageBufferArrayNonUniformIndexingEXT + Capability CapabilityStorageImageArrayNonUniformIndexingEXT + Capability CapabilityInputAttachmentArrayNonUniformIndexingEXT + Capability CapabilityUniformTexelBufferArrayNonUniformIndexingEXT + Capability CapabilityStorageTexelBufferArrayNonUniformIndexingEXT + Extension "SPV_EXT_descriptor_indexing" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 33 90 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_nonuniform_qualifier" + Name 4 "main" + Name 11 "foo(i1;i1;" + Name 9 "nupi" + Name 10 "f" + Name 16 "a" + Name 17 "nu_li" + Name 18 "param" + Name 20 "param" + Name 30 "b" + Name 33 "nu_inv4" + Name 39 "nu_gf" + Name 45 "inputAttachmentDyn" + Name 46 "dyn_i" + Name 62 "uniformTexelBufferDyn" + Name 76 "storageTexelBufferDyn" + Name 85 "uname" + MemberName 85(uname) 0 "a" + Name 88 "uniformBuffer" + Name 90 "nu_ii" + Name 97 "bname" + MemberName 97(bname) 0 "b" + Name 100 "storageBuffer" + Name 110 "sampledImage" + Name 125 "storageImage" + Name 137 "inputAttachment" + Name 147 "uniformTexelBuffer" + Name 158 "storageTexelBuffer" + Name 168 "v" + Name 183 "uv" + Name 193 "m" + Name 201 "S" + MemberName 201(S) 0 "a" + Name 203 "s" + Decorate 13 DecorationNonUniformEXT + Decorate 17(nu_li) DecorationNonUniformEXT + Decorate 19 DecorationNonUniformEXT + Decorate 23 DecorationNonUniformEXT + Decorate 26 DecorationNonUniformEXT + Decorate 27 DecorationNonUniformEXT + Decorate 33(nu_inv4) Location 0 + Decorate 33(nu_inv4) DecorationNonUniformEXT + Decorate 38 DecorationNonUniformEXT + Decorate 39(nu_gf) DecorationNonUniformEXT + Decorate 40 DecorationNonUniformEXT + Decorate 41 DecorationNonUniformEXT + Decorate 45(inputAttachmentDyn) DescriptorSet 0 + Decorate 45(inputAttachmentDyn) Binding 0 + Decorate 45(inputAttachmentDyn) InputAttachmentIndex 0 + Decorate 62(uniformTexelBufferDyn) DescriptorSet 0 + Decorate 62(uniformTexelBufferDyn) Binding 1 + Decorate 76(storageTexelBufferDyn) DescriptorSet 0 + Decorate 76(storageTexelBufferDyn) Binding 2 + MemberDecorate 85(uname) 0 Offset 0 + Decorate 85(uname) Block + Decorate 88(uniformBuffer) DescriptorSet 0 + Decorate 88(uniformBuffer) Binding 3 + Decorate 90(nu_ii) Flat + Decorate 90(nu_ii) Location 1 + Decorate 90(nu_ii) DecorationNonUniformEXT + Decorate 91 DecorationNonUniformEXT + Decorate 94 DecorationNonUniformEXT + MemberDecorate 97(bname) 0 Offset 0 + Decorate 97(bname) BufferBlock + Decorate 100(storageBuffer) DescriptorSet 0 + Decorate 100(storageBuffer) Binding 4 + Decorate 101 DecorationNonUniformEXT + Decorate 103 DecorationNonUniformEXT + Decorate 110(sampledImage) DescriptorSet 0 + Decorate 110(sampledImage) Binding 5 + Decorate 111 DecorationNonUniformEXT + Decorate 114 DecorationNonUniformEXT + Decorate 125(storageImage) DescriptorSet 0 + Decorate 125(storageImage) Binding 6 + Decorate 126 DecorationNonUniformEXT + Decorate 129 DecorationNonUniformEXT + Decorate 137(inputAttachment) DescriptorSet 0 + Decorate 137(inputAttachment) Binding 7 + Decorate 137(inputAttachment) InputAttachmentIndex 1 + Decorate 138 DecorationNonUniformEXT + Decorate 140 DecorationNonUniformEXT + Decorate 147(uniformTexelBuffer) DescriptorSet 0 + Decorate 147(uniformTexelBuffer) Binding 8 + Decorate 148 DecorationNonUniformEXT + Decorate 150 DecorationNonUniformEXT + Decorate 158(storageTexelBuffer) DescriptorSet 0 + Decorate 158(storageTexelBuffer) Binding 9 + Decorate 159 DecorationNonUniformEXT + Decorate 161 DecorationNonUniformEXT + Decorate 168(v) DecorationNonUniformEXT + Decorate 171 DecorationNonUniformEXT + Decorate 173 DecorationNonUniformEXT + Decorate 178 DecorationNonUniformEXT + Decorate 180 DecorationNonUniformEXT + Decorate 184 DecorationNonUniformEXT + Decorate 186 DecorationNonUniformEXT + Decorate 188 DecorationNonUniformEXT + Decorate 193(m) DecorationNonUniformEXT + Decorate 195 DecorationNonUniformEXT + Decorate 203(s) DecorationNonUniformEXT + Decorate 205 DecorationNonUniformEXT + Decorate 207 DecorationNonUniformEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypePointer Function 6(int) + 8: TypeFunction 6(int) 7(ptr) 7(ptr) + 25: 6(int) Constant 2 + 28: TypeFloat 32 + 29: TypePointer Function 28(float) + 31: TypeVector 28(float) 4 + 32: TypePointer Input 31(fvec4) + 33(nu_inv4): 32(ptr) Variable Input + 34: TypeInt 32 0 + 35: 34(int) Constant 0 + 36: TypePointer Input 28(float) + 42: TypeImage 28(float) SubpassData nonsampled format:Unknown + 43: TypeRuntimeArray 42 + 44: TypePointer UniformConstant 43 +45(inputAttachmentDyn): 44(ptr) Variable UniformConstant + 48: TypePointer UniformConstant 42 + 51: 6(int) Constant 0 + 52: TypeVector 6(int) 2 + 53: 52(ivec2) ConstantComposite 51 51 + 58: TypeImage 28(float) Buffer sampled format:Unknown + 59: TypeSampledImage 58 + 60: TypeRuntimeArray 59 + 61: TypePointer UniformConstant 60 +62(uniformTexelBufferDyn): 61(ptr) Variable UniformConstant + 64: TypePointer UniformConstant 59 + 67: 6(int) Constant 1 + 73: TypeImage 28(float) Buffer nonsampled format:R32f + 74: TypeRuntimeArray 73 + 75: TypePointer UniformConstant 74 +76(storageTexelBufferDyn): 75(ptr) Variable UniformConstant + 78: TypePointer UniformConstant 73 + 85(uname): TypeStruct 28(float) + 86: TypeRuntimeArray 85(uname) + 87: TypePointer Uniform 86 +88(uniformBuffer): 87(ptr) Variable Uniform + 89: TypePointer Input 6(int) + 90(nu_ii): 89(ptr) Variable Input + 92: TypePointer Uniform 28(float) + 97(bname): TypeStruct 28(float) + 98: TypeRuntimeArray 97(bname) + 99: TypePointer Uniform 98 +100(storageBuffer): 99(ptr) Variable Uniform + 106: TypeImage 28(float) 2D sampled format:Unknown + 107: TypeSampledImage 106 + 108: TypeRuntimeArray 107 + 109: TypePointer UniformConstant 108 +110(sampledImage): 109(ptr) Variable UniformConstant + 112: TypePointer UniformConstant 107 + 115: TypeVector 28(float) 2 + 116: 28(float) Constant 1056964608 + 117: 115(fvec2) ConstantComposite 116 116 + 122: TypeImage 28(float) 2D nonsampled format:R32f + 123: TypeRuntimeArray 122 + 124: TypePointer UniformConstant 123 +125(storageImage): 124(ptr) Variable UniformConstant + 127: TypePointer UniformConstant 122 + 130: 52(ivec2) ConstantComposite 67 67 + 135: TypeRuntimeArray 42 + 136: TypePointer UniformConstant 135 +137(inputAttachment): 136(ptr) Variable UniformConstant + 145: TypeRuntimeArray 59 + 146: TypePointer UniformConstant 145 +147(uniformTexelBuffer): 146(ptr) Variable UniformConstant + 156: TypeRuntimeArray 73 + 157: TypePointer UniformConstant 156 +158(storageTexelBuffer): 157(ptr) Variable UniformConstant + 166: TypeVector 6(int) 4 + 167: TypePointer Function 166(ivec4) + 169: 34(int) Constant 1 + 176: 34(int) Constant 2 + 191: TypeMatrix 31(fvec4) 4 + 192: TypePointer Function 191 + 201(S): TypeStruct 6(int) + 202: TypePointer Function 201(S) + 4(main): 2 Function None 3 + 5: Label + 16(a): 7(ptr) Variable Function + 17(nu_li): 7(ptr) Variable Function + 18(param): 7(ptr) Variable Function + 20(param): 7(ptr) Variable Function + 30(b): 29(ptr) Variable Function + 39(nu_gf): 29(ptr) Variable Function + 46(dyn_i): 7(ptr) Variable Function + 168(v): 167(ptr) Variable Function + 183(uv): 167(ptr) Variable Function + 193(m): 192(ptr) Variable Function + 203(s): 202(ptr) Variable Function + 19: 6(int) Load 17(nu_li) + Store 18(param) 19 + 21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param) + 22: 6(int) Load 20(param) + Store 17(nu_li) 22 + Store 16(a) 21 + 23: 6(int) Load 16(a) + 24: 6(int) Load 16(a) + 26: 6(int) IMul 24 25 + 27: 6(int) IAdd 23 26 + Store 17(nu_li) 27 + 37: 36(ptr) AccessChain 33(nu_inv4) 35 + 38: 28(float) Load 37 + 40: 28(float) Load 39(nu_gf) + 41: 28(float) FMul 38 40 + Store 30(b) 41 + 47: 6(int) Load 46(dyn_i) + 49: 48(ptr) AccessChain 45(inputAttachmentDyn) 47 + 50: 42 Load 49 + 54: 31(fvec4) ImageRead 50 53 + 55: 28(float) CompositeExtract 54 0 + 56: 28(float) Load 30(b) + 57: 28(float) FAdd 56 55 + Store 30(b) 57 + 63: 6(int) Load 46(dyn_i) + 65: 64(ptr) AccessChain 62(uniformTexelBufferDyn) 63 + 66: 59 Load 65 + 68: 58 Image 66 + 69: 31(fvec4) ImageFetch 68 67 + 70: 28(float) CompositeExtract 69 0 + 71: 28(float) Load 30(b) + 72: 28(float) FAdd 71 70 + Store 30(b) 72 + 77: 6(int) Load 46(dyn_i) + 79: 78(ptr) AccessChain 76(storageTexelBufferDyn) 77 + 80: 73 Load 79 + 81: 31(fvec4) ImageRead 80 67 + 82: 28(float) CompositeExtract 81 0 + 83: 28(float) Load 30(b) + 84: 28(float) FAdd 83 82 + Store 30(b) 84 + 91: 6(int) Load 90(nu_ii) + 93: 92(ptr) AccessChain 88(uniformBuffer) 91 51 + 94: 28(float) Load 93 + 95: 28(float) Load 30(b) + 96: 28(float) FAdd 95 94 + Store 30(b) 96 + 101: 6(int) Load 90(nu_ii) + 102: 92(ptr) AccessChain 100(storageBuffer) 101 51 + 103: 28(float) Load 102 + 104: 28(float) Load 30(b) + 105: 28(float) FAdd 104 103 + Store 30(b) 105 + 111: 6(int) Load 90(nu_ii) + 113: 112(ptr) AccessChain 110(sampledImage) 111 + 114: 107 Load 113 + 118: 31(fvec4) ImageSampleImplicitLod 114 117 + 119: 28(float) CompositeExtract 118 0 + 120: 28(float) Load 30(b) + 121: 28(float) FAdd 120 119 + Store 30(b) 121 + 126: 6(int) Load 90(nu_ii) + 128: 127(ptr) AccessChain 125(storageImage) 126 + 129: 122 Load 128 + 131: 31(fvec4) ImageRead 129 130 + 132: 28(float) CompositeExtract 131 0 + 133: 28(float) Load 30(b) + 134: 28(float) FAdd 133 132 + Store 30(b) 134 + 138: 6(int) Load 90(nu_ii) + 139: 48(ptr) AccessChain 137(inputAttachment) 138 + 140: 42 Load 139 + 141: 31(fvec4) ImageRead 140 53 + 142: 28(float) CompositeExtract 141 0 + 143: 28(float) Load 30(b) + 144: 28(float) FAdd 143 142 + Store 30(b) 144 + 148: 6(int) Load 90(nu_ii) + 149: 64(ptr) AccessChain 147(uniformTexelBuffer) 148 + 150: 59 Load 149 + 151: 58 Image 150 + 152: 31(fvec4) ImageFetch 151 67 + 153: 28(float) CompositeExtract 152 0 + 154: 28(float) Load 30(b) + 155: 28(float) FAdd 154 153 + Store 30(b) 155 + 159: 6(int) Load 90(nu_ii) + 160: 78(ptr) AccessChain 158(storageTexelBuffer) 159 + 161: 73 Load 160 + 162: 31(fvec4) ImageRead 161 67 + 163: 28(float) CompositeExtract 162 0 + 164: 28(float) Load 30(b) + 165: 28(float) FAdd 164 163 + Store 30(b) 165 + 170: 7(ptr) AccessChain 168(v) 169 + 171: 6(int) Load 170 + 172: 92(ptr) AccessChain 88(uniformBuffer) 171 51 + 173: 28(float) Load 172 + 174: 28(float) Load 30(b) + 175: 28(float) FAdd 174 173 + Store 30(b) 175 + 177: 7(ptr) AccessChain 168(v) 176 + 178: 6(int) Load 177 + 179: 92(ptr) AccessChain 88(uniformBuffer) 178 51 + 180: 28(float) Load 179 + 181: 28(float) Load 30(b) + 182: 28(float) FAdd 181 180 + Store 30(b) 182 + 184: 6(int) Load 90(nu_ii) + 185: 7(ptr) AccessChain 183(uv) 184 + 186: 6(int) Load 185 + 187: 92(ptr) AccessChain 88(uniformBuffer) 186 51 + 188: 28(float) Load 187 + 189: 28(float) Load 30(b) + 190: 28(float) FAdd 189 188 + Store 30(b) 190 + 194: 29(ptr) AccessChain 193(m) 25 176 + 195: 28(float) Load 194 + 196: 6(int) ConvertFToS 195 + 197: 92(ptr) AccessChain 88(uniformBuffer) 196 51 + 198: 28(float) Load 197 + 199: 28(float) Load 30(b) + 200: 28(float) FAdd 199 198 + Store 30(b) 200 + 204: 7(ptr) AccessChain 203(s) 51 + 205: 6(int) Load 204 + 206: 92(ptr) AccessChain 88(uniformBuffer) 205 51 + 207: 28(float) Load 206 + 208: 28(float) Load 30(b) + 209: 28(float) FAdd 208 207 + Store 30(b) 209 + Return + FunctionEnd + 11(foo(i1;i1;): 6(int) Function None 8 + 9(nupi): 7(ptr) FunctionParameter + 10(f): 7(ptr) FunctionParameter + 12: Label + 13: 6(int) Load 9(nupi) + ReturnValue 13 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.offsets.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.offsets.frag.out index f9b01441719..17d7b86e11f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.offsets.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.offsets.frag.out @@ -1,6 +1,6 @@ spv.offsets.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 15 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out index 28d96bb73a7..a7e627a2c9f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out @@ -1,6 +1,10 @@ spv.paramMemory.frag +error: SPIRV-Tools Validation Errors +error: OpFunctionCall Argument '38[image1]'s type does not match Function '8's parameter type. + %41 = OpFunctionCall %v4float %image_load_I21_vi2_ %image1 %param + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 69 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.perprimitiveNV.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.perprimitiveNV.frag.out new file mode 100644 index 00000000000..eaff400c091 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.perprimitiveNV.frag.out @@ -0,0 +1,54 @@ +spv.perprimitiveNV.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 23 + + Capability Shader + Capability MeshShadingNV + Extension "SPV_NV_mesh_shader" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 8 11 19 + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + SourceExtension "GL_NV_mesh_shader" + Name 4 "main" + Name 8 "g" + Name 9 "B" + MemberName 9(B) 0 "f" + Name 11 "" + Name 17 "C" + MemberName 17(C) 0 "h" + Name 19 "" + Decorate 8(g) Location 8 + MemberDecorate 9(B) 0 PerPrimitiveNV + Decorate 9(B) Block + Decorate 11 Location 0 + MemberDecorate 17(C) 0 Flat + MemberDecorate 17(C) 0 Centroid + Decorate 17(C) Block + Decorate 19 Location 4 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Output 6(float) + 8(g): 7(ptr) Variable Output + 9(B): TypeStruct 6(float) + 10: TypePointer Input 9(B) + 11: 10(ptr) Variable Input + 12: TypeInt 32 1 + 13: 12(int) Constant 0 + 14: TypePointer Input 6(float) + 17(C): TypeStruct 6(float) + 18: TypePointer Input 17(C) + 19: 18(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 15: 14(ptr) AccessChain 11 13 + 16: 6(float) Load 15 + 20: 14(ptr) AccessChain 19 13 + 21: 6(float) Load 20 + 22: 6(float) FAdd 16 21 + Store 8(g) 22 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tesc.out index 91c2f35dfb7..95a048fc75f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tesc.out @@ -1,6 +1,6 @@ spv.precise.tesc // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 72 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tese.out index c05ced41551..a73cbd8327e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tese.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precise.tese.out @@ -1,6 +1,6 @@ spv.precise.tese // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 119 Capability Tessellation diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precision.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precision.frag.out index 2284108f23e..5ddb4927248 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precision.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precision.frag.out @@ -1,6 +1,6 @@ spv.precision.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 127 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precisionNonESSamp.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precisionNonESSamp.frag.out index 5bb1dee985e..922200182b7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precisionNonESSamp.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.precisionNonESSamp.frag.out @@ -1,6 +1,6 @@ spv.precisionNonESSamp.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 47 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.prepost.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.prepost.frag.out index 68a6909b3ea..3b4bfd8acad 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.prepost.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.prepost.frag.out @@ -1,6 +1,6 @@ spv.prepost.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 94 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstant.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstant.vert.out index e86320fa099..40ee328461c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstant.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstant.vert.out @@ -1,6 +1,6 @@ spv.pushConstant.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 35 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstantAnon.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstantAnon.vert.out index 37e61ae9106..b03855da573 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstantAnon.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.pushConstantAnon.vert.out @@ -1,6 +1,6 @@ spv.pushConstantAnon.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 38 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.qualifiers.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.qualifiers.vert.out index fa51edc175a..ffdc6f8056a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.qualifiers.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.qualifiers.vert.out @@ -1,6 +1,6 @@ spv.qualifiers.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 21 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.queryL.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.queryL.frag.out index 419d213ce15..b737a35b7e0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.queryL.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.queryL.frag.out @@ -1,6 +1,10 @@ spv.queryL.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 224 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rankShift.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rankShift.comp.out new file mode 100644 index 00000000000..3ca7514599f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rankShift.comp.out @@ -0,0 +1,57 @@ +spv.rankShift.comp +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 33 + + Capability Shader + Capability Int64 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" + ExecutionMode 4 LocalSize 54 1 1 + Source GLSL 450 + SourceExtension "GL_ARB_gpu_shader_int64" + Name 4 "main" + Name 8 "result" + Name 11 "arg0" + Name 15 "arg1" + Decorate 11(arg0) Location 4 + Decorate 15(arg1) Location 5 + Decorate 32 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 64 0 + 7: TypePointer Function 6(int64_t) + 9: TypeInt 64 1 + 10: TypePointer UniformConstant 9(int64_t) + 11(arg0): 10(ptr) Variable UniformConstant + 13: TypeInt 32 0 + 14: TypePointer UniformConstant 13(int) + 15(arg1): 14(ptr) Variable UniformConstant + 29: TypeVector 13(int) 3 + 30: 13(int) Constant 54 + 31: 13(int) Constant 1 + 32: 29(ivec3) ConstantComposite 30 31 31 + 4(main): 2 Function None 3 + 5: Label + 8(result): 7(ptr) Variable Function + 12: 9(int64_t) Load 11(arg0) + 16: 13(int) Load 15(arg1) + 17: 9(int64_t) ShiftLeftLogical 12 16 + 18: 6(int64_t) Bitcast 17 + Store 8(result) 18 + 19: 9(int64_t) Load 11(arg0) + 20: 13(int) Load 15(arg1) + 21: 9(int64_t) ShiftRightArithmetic 19 20 + 22: 6(int64_t) Bitcast 21 + Store 8(result) 22 + 23: 13(int) Load 15(arg1) + 24: 6(int64_t) Load 8(result) + 25: 6(int64_t) ShiftLeftLogical 24 23 + Store 8(result) 25 + 26: 13(int) Load 15(arg1) + 27: 6(int64_t) Load 8(result) + 28: 6(int64_t) ShiftRightLogical 27 26 + Store 8(result) 28 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign-2.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign-2.frag.out index 14040df4b4b..533e3880361 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign-2.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign-2.frag.out @@ -1,6 +1,6 @@ spv.register.autoassign-2.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 47 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign.frag.out index 854025322a8..683ae08d483 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.autoassign.frag.out @@ -1,6 +1,6 @@ spv.register.autoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 155 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.noautoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.noautoassign.frag.out index a6339935138..166d92d920d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.noautoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.noautoassign.frag.out @@ -1,6 +1,6 @@ spv.register.noautoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 155 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out index 2a2232648a5..c42832a9730 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out @@ -1,6 +1,6 @@ spv.register.subpass.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 40 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rw.autoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rw.autoassign.frag.out index ecca7617842..2ee30bc5cb0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rw.autoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.rw.autoassign.frag.out @@ -1,6 +1,6 @@ spv.rw.autoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 42 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sample.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sample.frag.out index 166ce943dcf..e4d38f35a6b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sample.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sample.frag.out @@ -1,6 +1,6 @@ spv.sample.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 13 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleId.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleId.frag.out index 11ade877954..894d8db880d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleId.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleId.frag.out @@ -1,6 +1,6 @@ spv.sampleId.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 26 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out index 848b4a048dc..ae7e8241be1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out @@ -1,6 +1,10 @@ spv.sampleMaskOverrideCoverage.frag +error: SPIRV-Tools Validation Errors +error: Operand 2 of Decorate requires one of these capabilities: SampleMaskOverrideCoverageNV + OpDecorate %gl_SampleMask OverrideCoverageNV + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplePosition.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplePosition.frag.out index 5f4a0b93e0c..882423ee8d4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplePosition.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplePosition.frag.out @@ -1,6 +1,6 @@ spv.samplePosition.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 30 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplerlessTextureFunctions.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplerlessTextureFunctions.frag.out new file mode 100644 index 00000000000..0f09b43e765 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.samplerlessTextureFunctions.frag.out @@ -0,0 +1,93 @@ +spv.samplerlessTextureFunctions.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 51 + + Capability Shader + Capability SampledBuffer + Capability ImageQuery + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_samplerless_texture_functions" + Name 4 "main" + Name 9 "tex2DFetch" + Name 12 "tex2D" + Name 19 "texMSFetch" + Name 22 "texMS" + Name 25 "bufFetch" + Name 28 "buf" + Name 31 "tex2DFetchOffset" + Name 35 "tex2DSize" + Name 38 "texMSSize" + Name 42 "bufSize" + Name 45 "tex2DLevels" + Name 48 "texMSSamples" + Decorate 12(tex2D) DescriptorSet 0 + Decorate 12(tex2D) Binding 1 + Decorate 22(texMS) DescriptorSet 0 + Decorate 22(texMS) Binding 1 + Decorate 28(buf) DescriptorSet 0 + Decorate 28(buf) Binding 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Function 7(fvec4) + 10: TypeImage 6(float) 2D sampled format:Unknown + 11: TypePointer UniformConstant 10 + 12(tex2D): 11(ptr) Variable UniformConstant + 14: TypeInt 32 1 + 15: TypeVector 14(int) 2 + 16: 14(int) Constant 0 + 17: 15(ivec2) ConstantComposite 16 16 + 20: TypeImage 6(float) 2D multi-sampled sampled format:Unknown + 21: TypePointer UniformConstant 20 + 22(texMS): 21(ptr) Variable UniformConstant + 26: TypeImage 6(float) Buffer sampled format:Unknown + 27: TypePointer UniformConstant 26 + 28(buf): 27(ptr) Variable UniformConstant + 34: TypePointer Function 15(ivec2) + 41: TypePointer Function 14(int) + 4(main): 2 Function None 3 + 5: Label + 9(tex2DFetch): 8(ptr) Variable Function + 19(texMSFetch): 8(ptr) Variable Function + 25(bufFetch): 8(ptr) Variable Function +31(tex2DFetchOffset): 8(ptr) Variable Function + 35(tex2DSize): 34(ptr) Variable Function + 38(texMSSize): 34(ptr) Variable Function + 42(bufSize): 41(ptr) Variable Function + 45(tex2DLevels): 41(ptr) Variable Function +48(texMSSamples): 41(ptr) Variable Function + 13: 10 Load 12(tex2D) + 18: 7(fvec4) ImageFetch 13 17 Lod 16 + Store 9(tex2DFetch) 18 + 23: 20 Load 22(texMS) + 24: 7(fvec4) ImageFetch 23 17 Sample 16 + Store 19(texMSFetch) 24 + 29: 26 Load 28(buf) + 30: 7(fvec4) ImageFetch 29 16 + Store 25(bufFetch) 30 + 32: 10 Load 12(tex2D) + 33: 7(fvec4) ImageFetch 32 17 Lod ConstOffset 16 17 + Store 31(tex2DFetchOffset) 33 + 36: 10 Load 12(tex2D) + 37: 15(ivec2) ImageQuerySizeLod 36 16 + Store 35(tex2DSize) 37 + 39: 20 Load 22(texMS) + 40: 15(ivec2) ImageQuerySize 39 + Store 38(texMSSize) 40 + 43: 26 Load 28(buf) + 44: 14(int) ImageQuerySize 43 + Store 42(bufSize) 44 + 46: 10 Load 12(tex2D) + 47: 14(int) ImageQueryLevels 46 + Store 45(tex2DLevels) 47 + 49: 20 Load 22(texMS) + 50: 14(int) ImageQuerySamples 49 + Store 48(texMSSamples) 50 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.scalarlayout.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.scalarlayout.frag.out new file mode 100644 index 00000000000..2935e1a0941 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.scalarlayout.frag.out @@ -0,0 +1,80 @@ +spv.scalarlayout.frag +error: SPIRV-Tools Validation Errors +error: Structure id 17 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 4 is not aligned to 8 + %B1 = OpTypeStruct %float %v2float %v3float %_arr_float_uint_2 %mat2v3float %_arr_mat2v3float_uint_2 %float %S %_arr_S_uint_2 + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 20 + + Capability Shader + Capability Float64 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_scalar_block_layout" + Name 4 "main" + Name 15 "S" + MemberName 15(S) 0 "a" + MemberName 15(S) 1 "b" + MemberName 15(S) 2 "c" + MemberName 15(S) 3 "d" + MemberName 15(S) 4 "e" + MemberName 15(S) 5 "f" + Name 17 "B1" + MemberName 17(B1) 0 "a" + MemberName 17(B1) 1 "b" + MemberName 17(B1) 2 "c" + MemberName 17(B1) 3 "d" + MemberName 17(B1) 4 "e" + MemberName 17(B1) 5 "f" + MemberName 17(B1) 6 "g" + MemberName 17(B1) 7 "h" + MemberName 17(B1) 8 "i" + Name 19 "" + Decorate 11 ArrayStride 4 + Decorate 13 ArrayStride 24 + MemberDecorate 15(S) 0 Offset 0 + MemberDecorate 15(S) 1 Offset 4 + MemberDecorate 15(S) 2 Offset 16 + MemberDecorate 15(S) 3 Offset 24 + MemberDecorate 15(S) 4 Offset 28 + MemberDecorate 15(S) 5 Offset 40 + Decorate 16 ArrayStride 48 + MemberDecorate 17(B1) 0 Offset 0 + MemberDecorate 17(B1) 1 Offset 4 + MemberDecorate 17(B1) 2 Offset 12 + MemberDecorate 17(B1) 3 Offset 24 + MemberDecorate 17(B1) 4 ColMajor + MemberDecorate 17(B1) 4 Offset 32 + MemberDecorate 17(B1) 4 MatrixStride 12 + MemberDecorate 17(B1) 5 ColMajor + MemberDecorate 17(B1) 5 Offset 56 + MemberDecorate 17(B1) 5 MatrixStride 12 + MemberDecorate 17(B1) 6 Offset 104 + MemberDecorate 17(B1) 7 Offset 112 + MemberDecorate 17(B1) 8 Offset 160 + Decorate 17(B1) Block + Decorate 19 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypeVector 6(float) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(float) 10 + 12: TypeMatrix 8(fvec3) 2 + 13: TypeArray 12 10 + 14: TypeFloat 64 + 15(S): TypeStruct 6(float) 7(fvec2) 14(float64_t) 6(float) 8(fvec3) 6(float) + 16: TypeArray 15(S) 10 + 17(B1): TypeStruct 6(float) 7(fvec2) 8(fvec3) 11 12 13 6(float) 15(S) 16 + 18: TypePointer Uniform 17(B1) + 19: 18(ptr) Variable Uniform + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.scalarlayoutfloat16.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.scalarlayoutfloat16.frag.out new file mode 100644 index 00000000000..9118636f2d1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.scalarlayoutfloat16.frag.out @@ -0,0 +1,72 @@ +spv.scalarlayoutfloat16.frag +error: SPIRV-Tools Validation Errors +error: Structure id 15 decorated as Block for variable in Uniform storage class must follow standard uniform buffer layout rules: member 1 at offset 2 is not aligned to 4 + %B1 = OpTypeStruct %half %v2half %v3half %_arr_half_uint_2 %half %S %_arr_S_uint_2 + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 18 + + Capability Shader + Capability Float64 + Capability StorageUniform16 + Extension "SPV_KHR_16bit_storage" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_EXT_scalar_block_layout" + SourceExtension "GL_EXT_shader_16bit_storage" + Name 4 "main" + Name 13 "S" + MemberName 13(S) 0 "a" + MemberName 13(S) 1 "b" + MemberName 13(S) 2 "c" + MemberName 13(S) 3 "d" + MemberName 13(S) 4 "e" + MemberName 13(S) 5 "f" + Name 15 "B1" + MemberName 15(B1) 0 "a" + MemberName 15(B1) 1 "b" + MemberName 15(B1) 2 "c" + MemberName 15(B1) 3 "d" + MemberName 15(B1) 4 "g" + MemberName 15(B1) 5 "h" + MemberName 15(B1) 6 "i" + Name 17 "" + Decorate 11 ArrayStride 2 + MemberDecorate 13(S) 0 Offset 0 + MemberDecorate 13(S) 1 Offset 2 + MemberDecorate 13(S) 2 Offset 8 + MemberDecorate 13(S) 3 Offset 16 + MemberDecorate 13(S) 4 Offset 18 + MemberDecorate 13(S) 5 Offset 24 + Decorate 14 ArrayStride 32 + MemberDecorate 15(B1) 0 Offset 0 + MemberDecorate 15(B1) 1 Offset 2 + MemberDecorate 15(B1) 2 Offset 6 + MemberDecorate 15(B1) 3 Offset 12 + MemberDecorate 15(B1) 4 Offset 16 + MemberDecorate 15(B1) 5 Offset 24 + MemberDecorate 15(B1) 6 Offset 56 + Decorate 15(B1) Block + Decorate 17 DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 16 + 7: TypeVector 6(float16_t) 2 + 8: TypeVector 6(float16_t) 3 + 9: TypeInt 32 0 + 10: 9(int) Constant 2 + 11: TypeArray 6(float16_t) 10 + 12: TypeFloat 64 + 13(S): TypeStruct 6(float16_t) 7(f16vec2) 12(float64_t) 6(float16_t) 8(f16vec3) 6(float16_t) + 14: TypeArray 13(S) 10 + 15(B1): TypeStruct 6(float16_t) 7(f16vec2) 8(f16vec3) 11 6(float16_t) 13(S) 14 + 16: TypePointer Uniform 15(B1) + 17: 16(ptr) Variable Uniform + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.separate.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.separate.frag.out index 0e6243be919..b9fefd70990 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.separate.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.separate.frag.out @@ -1,6 +1,10 @@ spv.separate.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 319 Capability Shader @@ -28,33 +32,33 @@ spv.separate.frag Name 84 "itexCubeArray" Name 91 "utexCubeArray" Name 98 "tex1DArray" - Name 106 "itex1DArray" - Name 113 "utex1D" - Name 120 "itex1D" - Name 127 "utex1DArray" - Name 134 "texBuffer" - Name 146 "tex2DArray" - Name 158 "itex2D" - Name 165 "itex3D" - Name 172 "itexCube" - Name 179 "itex2DArray" - Name 186 "utex2D" - Name 193 "utex3D" - Name 200 "utexCube" - Name 207 "utex2DArray" - Name 214 "itex2DRect" - Name 221 "utex2DRect" - Name 228 "itexBuffer" - Name 235 "utexBuffer" - Name 242 "tex2DMS" - Name 249 "itex2DMS" - Name 256 "utex2DMS" - Name 263 "tex2DMSArray" - Name 270 "itex2DMSArray" - Name 277 "utex2DMSArray" - Name 284 "tex1D" - Name 294 "tex3D" - Name 305 "tex2DRect" + Name 105 "itex1DArray" + Name 112 "utex1D" + Name 119 "itex1D" + Name 126 "utex1DArray" + Name 133 "texBuffer" + Name 145 "tex2DArray" + Name 157 "itex2D" + Name 164 "itex3D" + Name 171 "itexCube" + Name 178 "itex2DArray" + Name 185 "utex2D" + Name 192 "utex3D" + Name 199 "utexCube" + Name 206 "utex2DArray" + Name 213 "itex2DRect" + Name 220 "utex2DRect" + Name 227 "itexBuffer" + Name 234 "utexBuffer" + Name 241 "tex2DMS" + Name 248 "itex2DMS" + Name 255 "utex2DMS" + Name 262 "tex2DMSArray" + Name 269 "itex2DMSArray" + Name 276 "utex2DMSArray" + Name 283 "tex1D" + Name 293 "tex3D" + Name 304 "tex2DRect" Decorate 14(t2d) DescriptorSet 0 Decorate 18(s) DescriptorSet 0 Decorate 31(t3d) DescriptorSet 0 @@ -67,33 +71,33 @@ spv.separate.frag Decorate 84(itexCubeArray) DescriptorSet 0 Decorate 91(utexCubeArray) DescriptorSet 0 Decorate 98(tex1DArray) DescriptorSet 0 - Decorate 106(itex1DArray) DescriptorSet 0 - Decorate 113(utex1D) DescriptorSet 0 - Decorate 120(itex1D) DescriptorSet 0 - Decorate 127(utex1DArray) DescriptorSet 0 - Decorate 134(texBuffer) DescriptorSet 0 - Decorate 146(tex2DArray) DescriptorSet 0 - Decorate 158(itex2D) DescriptorSet 0 - Decorate 165(itex3D) DescriptorSet 0 - Decorate 172(itexCube) DescriptorSet 0 - Decorate 179(itex2DArray) DescriptorSet 0 - Decorate 186(utex2D) DescriptorSet 0 - Decorate 193(utex3D) DescriptorSet 0 - Decorate 200(utexCube) DescriptorSet 0 - Decorate 207(utex2DArray) DescriptorSet 0 - Decorate 214(itex2DRect) DescriptorSet 0 - Decorate 221(utex2DRect) DescriptorSet 0 - Decorate 228(itexBuffer) DescriptorSet 0 - Decorate 235(utexBuffer) DescriptorSet 0 - Decorate 242(tex2DMS) DescriptorSet 0 - Decorate 249(itex2DMS) DescriptorSet 0 - Decorate 256(utex2DMS) DescriptorSet 0 - Decorate 263(tex2DMSArray) DescriptorSet 0 - Decorate 270(itex2DMSArray) DescriptorSet 0 - Decorate 277(utex2DMSArray) DescriptorSet 0 - Decorate 284(tex1D) DescriptorSet 0 - Decorate 294(tex3D) DescriptorSet 0 - Decorate 305(tex2DRect) DescriptorSet 0 + Decorate 105(itex1DArray) DescriptorSet 0 + Decorate 112(utex1D) DescriptorSet 0 + Decorate 119(itex1D) DescriptorSet 0 + Decorate 126(utex1DArray) DescriptorSet 0 + Decorate 133(texBuffer) DescriptorSet 0 + Decorate 145(tex2DArray) DescriptorSet 0 + Decorate 157(itex2D) DescriptorSet 0 + Decorate 164(itex3D) DescriptorSet 0 + Decorate 171(itexCube) DescriptorSet 0 + Decorate 178(itex2DArray) DescriptorSet 0 + Decorate 185(utex2D) DescriptorSet 0 + Decorate 192(utex3D) DescriptorSet 0 + Decorate 199(utexCube) DescriptorSet 0 + Decorate 206(utex2DArray) DescriptorSet 0 + Decorate 213(itex2DRect) DescriptorSet 0 + Decorate 220(utex2DRect) DescriptorSet 0 + Decorate 227(itexBuffer) DescriptorSet 0 + Decorate 234(utexBuffer) DescriptorSet 0 + Decorate 241(tex2DMS) DescriptorSet 0 + Decorate 248(itex2DMS) DescriptorSet 0 + Decorate 255(utex2DMS) DescriptorSet 0 + Decorate 262(tex2DMSArray) DescriptorSet 0 + Decorate 269(itex2DMSArray) DescriptorSet 0 + Decorate 276(utex2DMSArray) DescriptorSet 0 + Decorate 283(tex1D) DescriptorSet 0 + Decorate 293(tex3D) DescriptorSet 0 + Decorate 304(tex2DRect) DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 8: TypeFloat 32 @@ -147,127 +151,127 @@ spv.separate.frag 90: TypePointer UniformConstant 89 91(utexCubeArray): 90(ptr) Variable UniformConstant 94: TypeSampledImage 89 - 96: TypeImage 8(float) 1D array sampled format:Unknown + 96: TypeImage 8(float) 1D depth array sampled format:Unknown 97: TypePointer UniformConstant 96 98(tex1DArray): 97(ptr) Variable UniformConstant - 101: TypeImage 8(float) 1D depth array sampled format:Unknown - 102: TypeSampledImage 101 - 104: TypeImage 32(int) 1D array sampled format:Unknown - 105: TypePointer UniformConstant 104 -106(itex1DArray): 105(ptr) Variable UniformConstant - 109: TypeSampledImage 104 - 111: TypeImage 27(int) 1D sampled format:Unknown - 112: TypePointer UniformConstant 111 - 113(utex1D): 112(ptr) Variable UniformConstant - 116: TypeSampledImage 111 - 118: TypeImage 32(int) 1D sampled format:Unknown - 119: TypePointer UniformConstant 118 - 120(itex1D): 119(ptr) Variable UniformConstant - 123: TypeSampledImage 118 - 125: TypeImage 27(int) 1D array sampled format:Unknown - 126: TypePointer UniformConstant 125 -127(utex1DArray): 126(ptr) Variable UniformConstant - 130: TypeSampledImage 125 - 132: TypeImage 8(float) Buffer sampled format:Unknown - 133: TypePointer UniformConstant 132 - 134(texBuffer): 133(ptr) Variable UniformConstant - 137: TypeSampledImage 132 - 141: TypeImage 8(float) Cube depth sampled format:Unknown - 142: TypeSampledImage 141 - 144: TypeImage 8(float) 2D array sampled format:Unknown - 145: TypePointer UniformConstant 144 - 146(tex2DArray): 145(ptr) Variable UniformConstant - 149: TypeSampledImage 144 - 153: TypeImage 8(float) 2D depth array sampled format:Unknown - 154: TypeSampledImage 153 - 156: TypeImage 32(int) 2D sampled format:Unknown - 157: TypePointer UniformConstant 156 - 158(itex2D): 157(ptr) Variable UniformConstant - 161: TypeSampledImage 156 - 163: TypeImage 32(int) 3D sampled format:Unknown - 164: TypePointer UniformConstant 163 - 165(itex3D): 164(ptr) Variable UniformConstant - 168: TypeSampledImage 163 - 170: TypeImage 32(int) Cube sampled format:Unknown - 171: TypePointer UniformConstant 170 - 172(itexCube): 171(ptr) Variable UniformConstant - 175: TypeSampledImage 170 - 177: TypeImage 32(int) 2D array sampled format:Unknown - 178: TypePointer UniformConstant 177 -179(itex2DArray): 178(ptr) Variable UniformConstant - 182: TypeSampledImage 177 - 184: TypeImage 27(int) 2D sampled format:Unknown - 185: TypePointer UniformConstant 184 - 186(utex2D): 185(ptr) Variable UniformConstant - 189: TypeSampledImage 184 - 191: TypeImage 27(int) 3D sampled format:Unknown - 192: TypePointer UniformConstant 191 - 193(utex3D): 192(ptr) Variable UniformConstant - 196: TypeSampledImage 191 - 198: TypeImage 27(int) Cube sampled format:Unknown - 199: TypePointer UniformConstant 198 - 200(utexCube): 199(ptr) Variable UniformConstant - 203: TypeSampledImage 198 - 205: TypeImage 27(int) 2D array sampled format:Unknown - 206: TypePointer UniformConstant 205 -207(utex2DArray): 206(ptr) Variable UniformConstant - 210: TypeSampledImage 205 - 212: TypeImage 32(int) Rect sampled format:Unknown - 213: TypePointer UniformConstant 212 - 214(itex2DRect): 213(ptr) Variable UniformConstant - 217: TypeSampledImage 212 - 219: TypeImage 27(int) Rect sampled format:Unknown - 220: TypePointer UniformConstant 219 - 221(utex2DRect): 220(ptr) Variable UniformConstant - 224: TypeSampledImage 219 - 226: TypeImage 32(int) Buffer sampled format:Unknown - 227: TypePointer UniformConstant 226 - 228(itexBuffer): 227(ptr) Variable UniformConstant - 231: TypeSampledImage 226 - 233: TypeImage 27(int) Buffer sampled format:Unknown - 234: TypePointer UniformConstant 233 - 235(utexBuffer): 234(ptr) Variable UniformConstant - 238: TypeSampledImage 233 - 240: TypeImage 8(float) 2D multi-sampled sampled format:Unknown - 241: TypePointer UniformConstant 240 - 242(tex2DMS): 241(ptr) Variable UniformConstant - 245: TypeSampledImage 240 - 247: TypeImage 32(int) 2D multi-sampled sampled format:Unknown - 248: TypePointer UniformConstant 247 - 249(itex2DMS): 248(ptr) Variable UniformConstant - 252: TypeSampledImage 247 - 254: TypeImage 27(int) 2D multi-sampled sampled format:Unknown - 255: TypePointer UniformConstant 254 - 256(utex2DMS): 255(ptr) Variable UniformConstant - 259: TypeSampledImage 254 - 261: TypeImage 8(float) 2D array multi-sampled sampled format:Unknown - 262: TypePointer UniformConstant 261 -263(tex2DMSArray): 262(ptr) Variable UniformConstant - 266: TypeSampledImage 261 - 268: TypeImage 32(int) 2D array multi-sampled sampled format:Unknown - 269: TypePointer UniformConstant 268 -270(itex2DMSArray): 269(ptr) Variable UniformConstant - 273: TypeSampledImage 268 - 275: TypeImage 27(int) 2D array multi-sampled sampled format:Unknown - 276: TypePointer UniformConstant 275 -277(utex2DMSArray): 276(ptr) Variable UniformConstant - 280: TypeSampledImage 275 - 282: TypeImage 8(float) 1D sampled format:Unknown - 283: TypePointer UniformConstant 282 - 284(tex1D): 283(ptr) Variable UniformConstant - 287: TypeSampledImage 282 - 291: TypeImage 8(float) 1D depth sampled format:Unknown - 292: TypeSampledImage 291 - 294(tex3D): 36(ptr) Variable UniformConstant - 300: TypeImage 8(float) 2D depth sampled format:Unknown - 301: TypeSampledImage 300 - 303: TypeImage 8(float) Rect sampled format:Unknown - 304: TypePointer UniformConstant 303 - 305(tex2DRect): 304(ptr) Variable UniformConstant - 308: TypeSampledImage 303 - 312: TypeImage 8(float) Rect depth sampled format:Unknown - 313: TypeSampledImage 312 - 317: TypeSampledImage 96 + 101: TypeSampledImage 96 + 103: TypeImage 32(int) 1D array sampled format:Unknown + 104: TypePointer UniformConstant 103 +105(itex1DArray): 104(ptr) Variable UniformConstant + 108: TypeSampledImage 103 + 110: TypeImage 27(int) 1D sampled format:Unknown + 111: TypePointer UniformConstant 110 + 112(utex1D): 111(ptr) Variable UniformConstant + 115: TypeSampledImage 110 + 117: TypeImage 32(int) 1D sampled format:Unknown + 118: TypePointer UniformConstant 117 + 119(itex1D): 118(ptr) Variable UniformConstant + 122: TypeSampledImage 117 + 124: TypeImage 27(int) 1D array sampled format:Unknown + 125: TypePointer UniformConstant 124 +126(utex1DArray): 125(ptr) Variable UniformConstant + 129: TypeSampledImage 124 + 131: TypeImage 8(float) Buffer sampled format:Unknown + 132: TypePointer UniformConstant 131 + 133(texBuffer): 132(ptr) Variable UniformConstant + 136: TypeSampledImage 131 + 140: TypeImage 8(float) Cube depth sampled format:Unknown + 141: TypeSampledImage 140 + 143: TypeImage 8(float) 2D array sampled format:Unknown + 144: TypePointer UniformConstant 143 + 145(tex2DArray): 144(ptr) Variable UniformConstant + 148: TypeSampledImage 143 + 152: TypeImage 8(float) 2D depth array sampled format:Unknown + 153: TypeSampledImage 152 + 155: TypeImage 32(int) 2D sampled format:Unknown + 156: TypePointer UniformConstant 155 + 157(itex2D): 156(ptr) Variable UniformConstant + 160: TypeSampledImage 155 + 162: TypeImage 32(int) 3D sampled format:Unknown + 163: TypePointer UniformConstant 162 + 164(itex3D): 163(ptr) Variable UniformConstant + 167: TypeSampledImage 162 + 169: TypeImage 32(int) Cube sampled format:Unknown + 170: TypePointer UniformConstant 169 + 171(itexCube): 170(ptr) Variable UniformConstant + 174: TypeSampledImage 169 + 176: TypeImage 32(int) 2D array sampled format:Unknown + 177: TypePointer UniformConstant 176 +178(itex2DArray): 177(ptr) Variable UniformConstant + 181: TypeSampledImage 176 + 183: TypeImage 27(int) 2D sampled format:Unknown + 184: TypePointer UniformConstant 183 + 185(utex2D): 184(ptr) Variable UniformConstant + 188: TypeSampledImage 183 + 190: TypeImage 27(int) 3D sampled format:Unknown + 191: TypePointer UniformConstant 190 + 192(utex3D): 191(ptr) Variable UniformConstant + 195: TypeSampledImage 190 + 197: TypeImage 27(int) Cube sampled format:Unknown + 198: TypePointer UniformConstant 197 + 199(utexCube): 198(ptr) Variable UniformConstant + 202: TypeSampledImage 197 + 204: TypeImage 27(int) 2D array sampled format:Unknown + 205: TypePointer UniformConstant 204 +206(utex2DArray): 205(ptr) Variable UniformConstant + 209: TypeSampledImage 204 + 211: TypeImage 32(int) Rect sampled format:Unknown + 212: TypePointer UniformConstant 211 + 213(itex2DRect): 212(ptr) Variable UniformConstant + 216: TypeSampledImage 211 + 218: TypeImage 27(int) Rect sampled format:Unknown + 219: TypePointer UniformConstant 218 + 220(utex2DRect): 219(ptr) Variable UniformConstant + 223: TypeSampledImage 218 + 225: TypeImage 32(int) Buffer sampled format:Unknown + 226: TypePointer UniformConstant 225 + 227(itexBuffer): 226(ptr) Variable UniformConstant + 230: TypeSampledImage 225 + 232: TypeImage 27(int) Buffer sampled format:Unknown + 233: TypePointer UniformConstant 232 + 234(utexBuffer): 233(ptr) Variable UniformConstant + 237: TypeSampledImage 232 + 239: TypeImage 8(float) 2D multi-sampled sampled format:Unknown + 240: TypePointer UniformConstant 239 + 241(tex2DMS): 240(ptr) Variable UniformConstant + 244: TypeSampledImage 239 + 246: TypeImage 32(int) 2D multi-sampled sampled format:Unknown + 247: TypePointer UniformConstant 246 + 248(itex2DMS): 247(ptr) Variable UniformConstant + 251: TypeSampledImage 246 + 253: TypeImage 27(int) 2D multi-sampled sampled format:Unknown + 254: TypePointer UniformConstant 253 + 255(utex2DMS): 254(ptr) Variable UniformConstant + 258: TypeSampledImage 253 + 260: TypeImage 8(float) 2D array multi-sampled sampled format:Unknown + 261: TypePointer UniformConstant 260 +262(tex2DMSArray): 261(ptr) Variable UniformConstant + 265: TypeSampledImage 260 + 267: TypeImage 32(int) 2D array multi-sampled sampled format:Unknown + 268: TypePointer UniformConstant 267 +269(itex2DMSArray): 268(ptr) Variable UniformConstant + 272: TypeSampledImage 267 + 274: TypeImage 27(int) 2D array multi-sampled sampled format:Unknown + 275: TypePointer UniformConstant 274 +276(utex2DMSArray): 275(ptr) Variable UniformConstant + 279: TypeSampledImage 274 + 281: TypeImage 8(float) 1D sampled format:Unknown + 282: TypePointer UniformConstant 281 + 283(tex1D): 282(ptr) Variable UniformConstant + 286: TypeSampledImage 281 + 290: TypeImage 8(float) 1D depth sampled format:Unknown + 291: TypeSampledImage 290 + 293(tex3D): 36(ptr) Variable UniformConstant + 299: TypeImage 8(float) 2D depth sampled format:Unknown + 300: TypeSampledImage 299 + 302: TypeImage 8(float) Rect sampled format:Unknown + 303: TypePointer UniformConstant 302 + 304(tex2DRect): 303(ptr) Variable UniformConstant + 307: TypeSampledImage 302 + 311: TypeImage 8(float) Rect depth sampled format:Unknown + 312: TypeSampledImage 311 + 316: TypeImage 8(float) 1D array sampled format:Unknown + 317: TypeSampledImage 316 4(main): 2 Function None 3 5: Label 15: 12 Load 14(t2d) @@ -316,105 +320,105 @@ spv.separate.frag 95: 94 SampledImage 92 93 99: 96 Load 98(tex1DArray) 100: 16 Load 77(sShadow) - 103: 102 SampledImage 99 100 - 107: 104 Load 106(itex1DArray) - 108: 16 Load 18(s) - 110: 109 SampledImage 107 108 - 114: 111 Load 113(utex1D) - 115: 16 Load 18(s) - 117: 116 SampledImage 114 115 - 121: 118 Load 120(itex1D) - 122: 16 Load 18(s) - 124: 123 SampledImage 121 122 - 128: 125 Load 127(utex1DArray) - 129: 16 Load 18(s) - 131: 130 SampledImage 128 129 - 135: 132 Load 134(texBuffer) - 136: 16 Load 18(s) - 138: 137 SampledImage 135 136 - 139: 62 Load 64(texCube) - 140: 16 Load 77(sShadow) - 143: 142 SampledImage 139 140 - 147: 144 Load 146(tex2DArray) - 148: 16 Load 18(s) - 150: 149 SampledImage 147 148 - 151: 144 Load 146(tex2DArray) - 152: 16 Load 77(sShadow) - 155: 154 SampledImage 151 152 - 159: 156 Load 158(itex2D) - 160: 16 Load 18(s) - 162: 161 SampledImage 159 160 - 166: 163 Load 165(itex3D) - 167: 16 Load 18(s) - 169: 168 SampledImage 166 167 - 173: 170 Load 172(itexCube) - 174: 16 Load 18(s) - 176: 175 SampledImage 173 174 - 180: 177 Load 179(itex2DArray) - 181: 16 Load 18(s) - 183: 182 SampledImage 180 181 - 187: 184 Load 186(utex2D) - 188: 16 Load 18(s) - 190: 189 SampledImage 187 188 - 194: 191 Load 193(utex3D) - 195: 16 Load 18(s) - 197: 196 SampledImage 194 195 - 201: 198 Load 200(utexCube) - 202: 16 Load 18(s) - 204: 203 SampledImage 201 202 - 208: 205 Load 207(utex2DArray) - 209: 16 Load 18(s) - 211: 210 SampledImage 208 209 - 215: 212 Load 214(itex2DRect) - 216: 16 Load 18(s) - 218: 217 SampledImage 215 216 - 222: 219 Load 221(utex2DRect) - 223: 16 Load 18(s) - 225: 224 SampledImage 222 223 - 229: 226 Load 228(itexBuffer) - 230: 16 Load 18(s) - 232: 231 SampledImage 229 230 - 236: 233 Load 235(utexBuffer) - 237: 16 Load 18(s) - 239: 238 SampledImage 236 237 - 243: 240 Load 242(tex2DMS) - 244: 16 Load 18(s) - 246: 245 SampledImage 243 244 - 250: 247 Load 249(itex2DMS) - 251: 16 Load 18(s) - 253: 252 SampledImage 250 251 - 257: 254 Load 256(utex2DMS) - 258: 16 Load 18(s) - 260: 259 SampledImage 257 258 - 264: 261 Load 263(tex2DMSArray) - 265: 16 Load 18(s) - 267: 266 SampledImage 264 265 - 271: 268 Load 270(itex2DMSArray) - 272: 16 Load 18(s) - 274: 273 SampledImage 271 272 - 278: 275 Load 277(utex2DMSArray) - 279: 16 Load 18(s) - 281: 280 SampledImage 278 279 - 285: 282 Load 284(tex1D) - 286: 16 Load 18(s) - 288: 287 SampledImage 285 286 - 289: 282 Load 284(tex1D) - 290: 16 Load 77(sShadow) - 293: 292 SampledImage 289 290 - 295: 26 Load 294(tex3D) - 296: 16 Load 18(s) - 297: 45 SampledImage 295 296 - 298: 12 Load 58(tex2D) - 299: 16 Load 77(sShadow) - 302: 301 SampledImage 298 299 - 306: 303 Load 305(tex2DRect) - 307: 16 Load 18(s) - 309: 308 SampledImage 306 307 - 310: 303 Load 305(tex2DRect) - 311: 16 Load 77(sShadow) - 314: 313 SampledImage 310 311 - 315: 96 Load 98(tex1DArray) - 316: 16 Load 18(s) - 318: 317 SampledImage 315 316 + 102: 101 SampledImage 99 100 + 106: 103 Load 105(itex1DArray) + 107: 16 Load 18(s) + 109: 108 SampledImage 106 107 + 113: 110 Load 112(utex1D) + 114: 16 Load 18(s) + 116: 115 SampledImage 113 114 + 120: 117 Load 119(itex1D) + 121: 16 Load 18(s) + 123: 122 SampledImage 120 121 + 127: 124 Load 126(utex1DArray) + 128: 16 Load 18(s) + 130: 129 SampledImage 127 128 + 134: 131 Load 133(texBuffer) + 135: 16 Load 18(s) + 137: 136 SampledImage 134 135 + 138: 62 Load 64(texCube) + 139: 16 Load 77(sShadow) + 142: 141 SampledImage 138 139 + 146: 143 Load 145(tex2DArray) + 147: 16 Load 18(s) + 149: 148 SampledImage 146 147 + 150: 143 Load 145(tex2DArray) + 151: 16 Load 77(sShadow) + 154: 153 SampledImage 150 151 + 158: 155 Load 157(itex2D) + 159: 16 Load 18(s) + 161: 160 SampledImage 158 159 + 165: 162 Load 164(itex3D) + 166: 16 Load 18(s) + 168: 167 SampledImage 165 166 + 172: 169 Load 171(itexCube) + 173: 16 Load 18(s) + 175: 174 SampledImage 172 173 + 179: 176 Load 178(itex2DArray) + 180: 16 Load 18(s) + 182: 181 SampledImage 179 180 + 186: 183 Load 185(utex2D) + 187: 16 Load 18(s) + 189: 188 SampledImage 186 187 + 193: 190 Load 192(utex3D) + 194: 16 Load 18(s) + 196: 195 SampledImage 193 194 + 200: 197 Load 199(utexCube) + 201: 16 Load 18(s) + 203: 202 SampledImage 200 201 + 207: 204 Load 206(utex2DArray) + 208: 16 Load 18(s) + 210: 209 SampledImage 207 208 + 214: 211 Load 213(itex2DRect) + 215: 16 Load 18(s) + 217: 216 SampledImage 214 215 + 221: 218 Load 220(utex2DRect) + 222: 16 Load 18(s) + 224: 223 SampledImage 221 222 + 228: 225 Load 227(itexBuffer) + 229: 16 Load 18(s) + 231: 230 SampledImage 228 229 + 235: 232 Load 234(utexBuffer) + 236: 16 Load 18(s) + 238: 237 SampledImage 235 236 + 242: 239 Load 241(tex2DMS) + 243: 16 Load 18(s) + 245: 244 SampledImage 242 243 + 249: 246 Load 248(itex2DMS) + 250: 16 Load 18(s) + 252: 251 SampledImage 249 250 + 256: 253 Load 255(utex2DMS) + 257: 16 Load 18(s) + 259: 258 SampledImage 256 257 + 263: 260 Load 262(tex2DMSArray) + 264: 16 Load 18(s) + 266: 265 SampledImage 263 264 + 270: 267 Load 269(itex2DMSArray) + 271: 16 Load 18(s) + 273: 272 SampledImage 270 271 + 277: 274 Load 276(utex2DMSArray) + 278: 16 Load 18(s) + 280: 279 SampledImage 277 278 + 284: 281 Load 283(tex1D) + 285: 16 Load 18(s) + 287: 286 SampledImage 284 285 + 288: 281 Load 283(tex1D) + 289: 16 Load 77(sShadow) + 292: 291 SampledImage 288 289 + 294: 26 Load 293(tex3D) + 295: 16 Load 18(s) + 296: 45 SampledImage 294 295 + 297: 12 Load 58(tex2D) + 298: 16 Load 77(sShadow) + 301: 300 SampledImage 297 298 + 305: 302 Load 304(tex2DRect) + 306: 16 Load 18(s) + 308: 307 SampledImage 305 306 + 309: 302 Load 304(tex2DRect) + 310: 16 Load 77(sShadow) + 313: 312 SampledImage 309 310 + 314: 96 Load 98(tex1DArray) + 315: 16 Load 18(s) + 318: 317 SampledImage 314 315 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.set.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.set.vert.out index 530b5546b66..16d771fce6c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.set.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.set.vert.out @@ -1,6 +1,6 @@ spv.set.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallot.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallot.comp.out index 8be7a06f273..2f0e5a0b78d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallot.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallot.comp.out @@ -1,6 +1,6 @@ spv.shaderBallot.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 298 Capability Shader @@ -52,8 +52,8 @@ spv.shaderBallot.comp 12(gl_SubGroupSizeARB): 9(ptr) Variable Input 15: 6(int) Constant 4 17: TypeInt 64 0 - 18: TypePointer Function 17(int) - 20: TypePointer Input 17(int) + 18: TypePointer Function 17(int64_t) + 20: TypePointer Input 17(int64_t) 21(gl_SubGroupEqMaskARB): 20(ptr) Variable Input 23(gl_SubGroupGeMaskARB): 20(ptr) Variable Input 26(gl_SubGroupGtMaskARB): 20(ptr) Variable Input @@ -99,22 +99,22 @@ spv.shaderBallot.comp 14: 6(int) IAdd 11 13 16: 6(int) UMod 14 15 Store 8(invocation) 16 - 22: 17(int) Load 21(gl_SubGroupEqMaskARB) - 24: 17(int) Load 23(gl_SubGroupGeMaskARB) - 25: 17(int) IAdd 22 24 - 27: 17(int) Load 26(gl_SubGroupGtMaskARB) - 28: 17(int) IAdd 25 27 - 30: 17(int) Load 29(gl_SubGroupLeMaskARB) - 31: 17(int) IAdd 28 30 - 33: 17(int) Load 32(gl_SubGroupLtMaskARB) - 34: 17(int) IAdd 31 33 + 22: 17(int64_t) Load 21(gl_SubGroupEqMaskARB) + 24: 17(int64_t) Load 23(gl_SubGroupGeMaskARB) + 25: 17(int64_t) IAdd 22 24 + 27: 17(int64_t) Load 26(gl_SubGroupGtMaskARB) + 28: 17(int64_t) IAdd 25 27 + 30: 17(int64_t) Load 29(gl_SubGroupLeMaskARB) + 31: 17(int64_t) IAdd 28 30 + 33: 17(int64_t) Load 32(gl_SubGroupLtMaskARB) + 34: 17(int64_t) IAdd 31 33 Store 19(relMask) 34 - 35: 17(int) Load 19(relMask) + 35: 17(int64_t) Load 19(relMask) 39: 38(ivec4) SubgroupBallotKHR 37 40: 6(int) CompositeExtract 39 0 41: 6(int) CompositeExtract 39 1 43: 42(ivec2) CompositeConstruct 40 41 - 44: 17(int) Bitcast 43 + 44: 17(int64_t) Bitcast 43 45: 36(bool) IEqual 35 44 SelectionMerge 47 None BranchConditional 45 46 216 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out index 51a52f3005f..5219a3a429a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out @@ -1,16 +1,19 @@ spv.shaderBallotAMD.comp +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability Float16 + // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 1048 +// Generated by (magic number): 80007 +// Id's are bound by 1343 Capability Shader Capability Float16 Capability Float64 Capability Int64 Capability Groups + Capability Int16 Capability StorageUniformBufferBlock16 - Capability StorageUniform16 - Extension "SPV_AMD_gpu_shader_half_float" Extension "SPV_AMD_shader_ballot" Extension "SPV_KHR_16bit_storage" 1: ExtInstImport "GLSL.std.450" @@ -19,29 +22,34 @@ spv.shaderBallotAMD.comp ExecutionMode 4 LocalSize 8 8 1 Source GLSL 450 SourceExtension "GL_AMD_gpu_shader_half_float" + SourceExtension "GL_AMD_gpu_shader_int16" SourceExtension "GL_AMD_shader_ballot" SourceExtension "GL_ARB_gpu_shader_int64" Name 4 "main" - Name 18 "Buffers" - MemberName 18(Buffers) 0 "i" - MemberName 18(Buffers) 1 "uv" - MemberName 18(Buffers) 2 "fv" - MemberName 18(Buffers) 3 "dv" - MemberName 18(Buffers) 4 "i64" - MemberName 18(Buffers) 5 "u64v" - MemberName 18(Buffers) 6 "f16v" - Name 20 "" - MemberDecorate 18(Buffers) 0 Offset 0 - MemberDecorate 18(Buffers) 1 Offset 8 - MemberDecorate 18(Buffers) 2 Offset 16 - MemberDecorate 18(Buffers) 3 Offset 32 - MemberDecorate 18(Buffers) 4 Offset 64 - MemberDecorate 18(Buffers) 5 Offset 80 - MemberDecorate 18(Buffers) 6 Offset 96 - Decorate 18(Buffers) BufferBlock - Decorate 20 DescriptorSet 0 - Decorate 20 Binding 0 - Decorate 1047 BuiltIn WorkgroupSize + Name 21 "Buffers" + MemberName 21(Buffers) 0 "i" + MemberName 21(Buffers) 1 "uv" + MemberName 21(Buffers) 2 "fv" + MemberName 21(Buffers) 3 "dv" + MemberName 21(Buffers) 4 "i64" + MemberName 21(Buffers) 5 "u64v" + MemberName 21(Buffers) 6 "f16v" + MemberName 21(Buffers) 7 "i16v" + MemberName 21(Buffers) 8 "u16" + Name 23 "" + MemberDecorate 21(Buffers) 0 Offset 0 + MemberDecorate 21(Buffers) 1 Offset 8 + MemberDecorate 21(Buffers) 2 Offset 16 + MemberDecorate 21(Buffers) 3 Offset 32 + MemberDecorate 21(Buffers) 4 Offset 64 + MemberDecorate 21(Buffers) 5 Offset 80 + MemberDecorate 21(Buffers) 6 Offset 96 + MemberDecorate 21(Buffers) 7 Offset 104 + MemberDecorate 21(Buffers) 8 Offset 112 + Decorate 21(Buffers) BufferBlock + Decorate 23 DescriptorSet 0 + Decorate 23 Binding 0 + Decorate 1342 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 @@ -50,1169 +58,1500 @@ spv.shaderBallotAMD.comp 9: TypeFloat 32 10: TypeVector 9(float) 3 11: TypeFloat 64 - 12: TypeVector 11(float) 4 + 12: TypeVector 11(float64_t) 4 13: TypeInt 64 1 14: TypeInt 64 0 - 15: TypeVector 14(int) 2 + 15: TypeVector 14(int64_t) 2 16: TypeFloat 16 - 17: TypeVector 16(float) 3 - 18(Buffers): TypeStruct 6(int) 8(ivec2) 10(fvec3) 12(fvec4) 13(int) 15(ivec2) 17(fvec3) - 19: TypePointer Uniform 18(Buffers) - 20: 19(ptr) Variable Uniform - 21: 6(int) Constant 0 - 22: TypePointer Uniform 6(int) - 25: 7(int) Constant 3 - 28: 6(int) Constant 1 - 29: TypePointer Uniform 8(ivec2) - 38: 6(int) Constant 2 - 39: TypePointer Uniform 10(fvec3) - 50: 6(int) Constant 3 - 51: TypePointer Uniform 12(fvec4) - 64: 6(int) Constant 4 - 65: TypePointer Uniform 13(int) - 70: 6(int) Constant 5 - 71: TypePointer Uniform 15(ivec2) - 80: 6(int) Constant 6 - 81: TypePointer Uniform 17(fvec3) - 1044: TypeVector 7(int) 3 - 1045: 7(int) Constant 8 - 1046: 7(int) Constant 1 - 1047: 1044(ivec3) ConstantComposite 1045 1045 1046 + 17: TypeVector 16(float16_t) 3 + 18: TypeInt 16 1 + 19: TypeVector 18(int16_t) 4 + 20: TypeInt 16 0 + 21(Buffers): TypeStruct 6(int) 8(ivec2) 10(fvec3) 12(f64vec4) 13(int64_t) 15(i64vec2) 17(f16vec3) 19(i16vec4) 20(int16_t) + 22: TypePointer Uniform 21(Buffers) + 23: 22(ptr) Variable Uniform + 24: 6(int) Constant 0 + 25: TypePointer Uniform 6(int) + 28: 7(int) Constant 3 + 31: 6(int) Constant 1 + 32: TypePointer Uniform 8(ivec2) + 41: 6(int) Constant 2 + 42: TypePointer Uniform 10(fvec3) + 53: 6(int) Constant 3 + 54: TypePointer Uniform 12(f64vec4) + 67: 6(int) Constant 4 + 68: TypePointer Uniform 13(int64_t) + 73: 6(int) Constant 5 + 74: TypePointer Uniform 15(i64vec2) + 83: 6(int) Constant 6 + 84: TypePointer Uniform 17(f16vec3) + 95: 6(int) Constant 7 + 96: TypePointer Uniform 19(i16vec4) + 109: 6(int) Constant 8 + 110: TypePointer Uniform 20(int16_t) + 1339: TypeVector 7(int) 3 + 1340: 7(int) Constant 8 + 1341: 7(int) Constant 1 + 1342: 1339(ivec3) ConstantComposite 1340 1340 1341 4(main): 2 Function None 3 5: Label - 23: 22(ptr) AccessChain 20 21 - 24: 6(int) Load 23 - 26: 6(int) GroupSMin 25 Reduce 24 - 27: 22(ptr) AccessChain 20 21 - Store 27 26 - 30: 29(ptr) AccessChain 20 28 - 31: 8(ivec2) Load 30 - 32: 7(int) CompositeExtract 31 0 - 33: 7(int) GroupUMin 25 Reduce 32 - 34: 7(int) CompositeExtract 31 1 - 35: 7(int) GroupUMin 25 Reduce 34 - 36: 8(ivec2) CompositeConstruct 33 35 - 37: 29(ptr) AccessChain 20 28 - Store 37 36 - 40: 39(ptr) AccessChain 20 38 - 41: 10(fvec3) Load 40 - 42: 9(float) CompositeExtract 41 0 - 43: 9(float) GroupFMin 25 Reduce 42 - 44: 9(float) CompositeExtract 41 1 - 45: 9(float) GroupFMin 25 Reduce 44 - 46: 9(float) CompositeExtract 41 2 - 47: 9(float) GroupFMin 25 Reduce 46 - 48: 10(fvec3) CompositeConstruct 43 45 47 - 49: 39(ptr) AccessChain 20 38 - Store 49 48 - 52: 51(ptr) AccessChain 20 50 - 53: 12(fvec4) Load 52 - 54: 11(float) CompositeExtract 53 0 - 55: 11(float) GroupFMin 25 Reduce 54 - 56: 11(float) CompositeExtract 53 1 - 57: 11(float) GroupFMin 25 Reduce 56 - 58: 11(float) CompositeExtract 53 2 - 59: 11(float) GroupFMin 25 Reduce 58 - 60: 11(float) CompositeExtract 53 3 - 61: 11(float) GroupFMin 25 Reduce 60 - 62: 12(fvec4) CompositeConstruct 55 57 59 61 - 63: 51(ptr) AccessChain 20 50 - Store 63 62 - 66: 65(ptr) AccessChain 20 64 - 67: 13(int) Load 66 - 68: 13(int) GroupSMin 25 Reduce 67 - 69: 65(ptr) AccessChain 20 64 - Store 69 68 - 72: 71(ptr) AccessChain 20 70 - 73: 15(ivec2) Load 72 - 74: 14(int) CompositeExtract 73 0 - 75: 14(int) GroupUMin 25 Reduce 74 - 76: 14(int) CompositeExtract 73 1 - 77: 14(int) GroupUMin 25 Reduce 76 - 78: 15(ivec2) CompositeConstruct 75 77 - 79: 71(ptr) AccessChain 20 70 - Store 79 78 - 82: 81(ptr) AccessChain 20 80 - 83: 17(fvec3) Load 82 - 84: 16(float) CompositeExtract 83 0 - 85: 16(float) GroupFMin 25 Reduce 84 - 86: 16(float) CompositeExtract 83 1 - 87: 16(float) GroupFMin 25 Reduce 86 - 88: 16(float) CompositeExtract 83 2 - 89: 16(float) GroupFMin 25 Reduce 88 - 90: 17(fvec3) CompositeConstruct 85 87 89 - 91: 81(ptr) AccessChain 20 80 - Store 91 90 - 92: 22(ptr) AccessChain 20 21 - 93: 6(int) Load 92 - 94: 6(int) GroupSMax 25 Reduce 93 - 95: 22(ptr) AccessChain 20 21 - Store 95 94 - 96: 29(ptr) AccessChain 20 28 - 97: 8(ivec2) Load 96 - 98: 7(int) CompositeExtract 97 0 - 99: 7(int) GroupUMax 25 Reduce 98 - 100: 7(int) CompositeExtract 97 1 - 101: 7(int) GroupUMax 25 Reduce 100 - 102: 8(ivec2) CompositeConstruct 99 101 - 103: 29(ptr) AccessChain 20 28 - Store 103 102 - 104: 39(ptr) AccessChain 20 38 - 105: 10(fvec3) Load 104 - 106: 9(float) CompositeExtract 105 0 - 107: 9(float) GroupFMax 25 Reduce 106 - 108: 9(float) CompositeExtract 105 1 - 109: 9(float) GroupFMax 25 Reduce 108 - 110: 9(float) CompositeExtract 105 2 - 111: 9(float) GroupFMax 25 Reduce 110 - 112: 10(fvec3) CompositeConstruct 107 109 111 - 113: 39(ptr) AccessChain 20 38 - Store 113 112 - 114: 51(ptr) AccessChain 20 50 - 115: 12(fvec4) Load 114 - 116: 11(float) CompositeExtract 115 0 - 117: 11(float) GroupFMax 25 Reduce 116 - 118: 11(float) CompositeExtract 115 1 - 119: 11(float) GroupFMax 25 Reduce 118 - 120: 11(float) CompositeExtract 115 2 - 121: 11(float) GroupFMax 25 Reduce 120 - 122: 11(float) CompositeExtract 115 3 - 123: 11(float) GroupFMax 25 Reduce 122 - 124: 12(fvec4) CompositeConstruct 117 119 121 123 - 125: 51(ptr) AccessChain 20 50 - Store 125 124 - 126: 65(ptr) AccessChain 20 64 - 127: 13(int) Load 126 - 128: 13(int) GroupSMax 25 Reduce 127 - 129: 65(ptr) AccessChain 20 64 - Store 129 128 - 130: 71(ptr) AccessChain 20 70 - 131: 15(ivec2) Load 130 - 132: 14(int) CompositeExtract 131 0 - 133: 14(int) GroupUMax 25 Reduce 132 - 134: 14(int) CompositeExtract 131 1 - 135: 14(int) GroupUMax 25 Reduce 134 - 136: 15(ivec2) CompositeConstruct 133 135 - 137: 71(ptr) AccessChain 20 70 - Store 137 136 - 138: 81(ptr) AccessChain 20 80 - 139: 17(fvec3) Load 138 - 140: 16(float) CompositeExtract 139 0 - 141: 16(float) GroupFMax 25 Reduce 140 - 142: 16(float) CompositeExtract 139 1 - 143: 16(float) GroupFMax 25 Reduce 142 - 144: 16(float) CompositeExtract 139 2 - 145: 16(float) GroupFMax 25 Reduce 144 - 146: 17(fvec3) CompositeConstruct 141 143 145 - 147: 81(ptr) AccessChain 20 80 - Store 147 146 - 148: 22(ptr) AccessChain 20 21 - 149: 6(int) Load 148 - 150: 6(int) GroupIAdd 25 Reduce 149 - 151: 22(ptr) AccessChain 20 21 - Store 151 150 - 152: 29(ptr) AccessChain 20 28 - 153: 8(ivec2) Load 152 - 154: 7(int) CompositeExtract 153 0 - 155: 7(int) GroupIAdd 25 Reduce 154 - 156: 7(int) CompositeExtract 153 1 - 157: 7(int) GroupIAdd 25 Reduce 156 - 158: 8(ivec2) CompositeConstruct 155 157 - 159: 29(ptr) AccessChain 20 28 - Store 159 158 - 160: 39(ptr) AccessChain 20 38 - 161: 10(fvec3) Load 160 - 162: 9(float) CompositeExtract 161 0 - 163: 9(float) GroupFAdd 25 Reduce 162 - 164: 9(float) CompositeExtract 161 1 - 165: 9(float) GroupFAdd 25 Reduce 164 - 166: 9(float) CompositeExtract 161 2 - 167: 9(float) GroupFAdd 25 Reduce 166 - 168: 10(fvec3) CompositeConstruct 163 165 167 - 169: 39(ptr) AccessChain 20 38 - Store 169 168 - 170: 51(ptr) AccessChain 20 50 - 171: 12(fvec4) Load 170 - 172: 11(float) CompositeExtract 171 0 - 173: 11(float) GroupFAdd 25 Reduce 172 - 174: 11(float) CompositeExtract 171 1 - 175: 11(float) GroupFAdd 25 Reduce 174 - 176: 11(float) CompositeExtract 171 2 - 177: 11(float) GroupFAdd 25 Reduce 176 - 178: 11(float) CompositeExtract 171 3 - 179: 11(float) GroupFAdd 25 Reduce 178 - 180: 12(fvec4) CompositeConstruct 173 175 177 179 - 181: 51(ptr) AccessChain 20 50 - Store 181 180 - 182: 65(ptr) AccessChain 20 64 - 183: 13(int) Load 182 - 184: 13(int) GroupIAdd 25 Reduce 183 - 185: 65(ptr) AccessChain 20 64 - Store 185 184 - 186: 71(ptr) AccessChain 20 70 - 187: 15(ivec2) Load 186 - 188: 14(int) CompositeExtract 187 0 - 189: 14(int) GroupIAdd 25 Reduce 188 - 190: 14(int) CompositeExtract 187 1 - 191: 14(int) GroupIAdd 25 Reduce 190 - 192: 15(ivec2) CompositeConstruct 189 191 - 193: 71(ptr) AccessChain 20 70 - Store 193 192 - 194: 81(ptr) AccessChain 20 80 - 195: 17(fvec3) Load 194 - 196: 16(float) CompositeExtract 195 0 - 197: 16(float) GroupFAdd 25 Reduce 196 - 198: 16(float) CompositeExtract 195 1 - 199: 16(float) GroupFAdd 25 Reduce 198 - 200: 16(float) CompositeExtract 195 2 - 201: 16(float) GroupFAdd 25 Reduce 200 - 202: 17(fvec3) CompositeConstruct 197 199 201 - 203: 81(ptr) AccessChain 20 80 - Store 203 202 - 204: 22(ptr) AccessChain 20 21 - 205: 6(int) Load 204 - 206: 6(int) GroupSMinNonUniformAMD 25 Reduce 205 - 207: 22(ptr) AccessChain 20 21 - Store 207 206 - 208: 29(ptr) AccessChain 20 28 - 209: 8(ivec2) Load 208 - 210: 7(int) CompositeExtract 209 0 - 211: 7(int) GroupUMinNonUniformAMD 25 Reduce 210 - 212: 7(int) CompositeExtract 209 1 - 213: 7(int) GroupUMinNonUniformAMD 25 Reduce 212 - 214: 8(ivec2) CompositeConstruct 211 213 - 215: 29(ptr) AccessChain 20 28 - Store 215 214 - 216: 39(ptr) AccessChain 20 38 - 217: 10(fvec3) Load 216 - 218: 9(float) CompositeExtract 217 0 - 219: 9(float) GroupFMinNonUniformAMD 25 Reduce 218 - 220: 9(float) CompositeExtract 217 1 - 221: 9(float) GroupFMinNonUniformAMD 25 Reduce 220 - 222: 9(float) CompositeExtract 217 2 - 223: 9(float) GroupFMinNonUniformAMD 25 Reduce 222 - 224: 10(fvec3) CompositeConstruct 219 221 223 - 225: 39(ptr) AccessChain 20 38 - Store 225 224 - 226: 51(ptr) AccessChain 20 50 - 227: 12(fvec4) Load 226 - 228: 11(float) CompositeExtract 227 0 - 229: 11(float) GroupFMinNonUniformAMD 25 Reduce 228 - 230: 11(float) CompositeExtract 227 1 - 231: 11(float) GroupFMinNonUniformAMD 25 Reduce 230 - 232: 11(float) CompositeExtract 227 2 - 233: 11(float) GroupFMinNonUniformAMD 25 Reduce 232 - 234: 11(float) CompositeExtract 227 3 - 235: 11(float) GroupFMinNonUniformAMD 25 Reduce 234 - 236: 12(fvec4) CompositeConstruct 229 231 233 235 - 237: 51(ptr) AccessChain 20 50 - Store 237 236 - 238: 65(ptr) AccessChain 20 64 - 239: 13(int) Load 238 - 240: 13(int) GroupSMinNonUniformAMD 25 Reduce 239 - 241: 65(ptr) AccessChain 20 64 - Store 241 240 - 242: 71(ptr) AccessChain 20 70 - 243: 15(ivec2) Load 242 - 244: 14(int) CompositeExtract 243 0 - 245: 14(int) GroupUMinNonUniformAMD 25 Reduce 244 - 246: 14(int) CompositeExtract 243 1 - 247: 14(int) GroupUMinNonUniformAMD 25 Reduce 246 - 248: 15(ivec2) CompositeConstruct 245 247 - 249: 71(ptr) AccessChain 20 70 - Store 249 248 - 250: 81(ptr) AccessChain 20 80 - 251: 17(fvec3) Load 250 - 252: 16(float) CompositeExtract 251 0 - 253: 16(float) GroupFMinNonUniformAMD 25 Reduce 252 - 254: 16(float) CompositeExtract 251 1 - 255: 16(float) GroupFMinNonUniformAMD 25 Reduce 254 - 256: 16(float) CompositeExtract 251 2 - 257: 16(float) GroupFMinNonUniformAMD 25 Reduce 256 - 258: 17(fvec3) CompositeConstruct 253 255 257 - 259: 81(ptr) AccessChain 20 80 - Store 259 258 - 260: 22(ptr) AccessChain 20 21 - 261: 6(int) Load 260 - 262: 6(int) GroupSMaxNonUniformAMD 25 Reduce 261 - 263: 22(ptr) AccessChain 20 21 - Store 263 262 - 264: 29(ptr) AccessChain 20 28 - 265: 8(ivec2) Load 264 - 266: 7(int) CompositeExtract 265 0 - 267: 7(int) GroupUMaxNonUniformAMD 25 Reduce 266 - 268: 7(int) CompositeExtract 265 1 - 269: 7(int) GroupUMaxNonUniformAMD 25 Reduce 268 - 270: 8(ivec2) CompositeConstruct 267 269 - 271: 29(ptr) AccessChain 20 28 - Store 271 270 - 272: 39(ptr) AccessChain 20 38 - 273: 10(fvec3) Load 272 - 274: 9(float) CompositeExtract 273 0 - 275: 9(float) GroupFMaxNonUniformAMD 25 Reduce 274 - 276: 9(float) CompositeExtract 273 1 - 277: 9(float) GroupFMaxNonUniformAMD 25 Reduce 276 - 278: 9(float) CompositeExtract 273 2 - 279: 9(float) GroupFMaxNonUniformAMD 25 Reduce 278 - 280: 10(fvec3) CompositeConstruct 275 277 279 - 281: 39(ptr) AccessChain 20 38 - Store 281 280 - 282: 51(ptr) AccessChain 20 50 - 283: 12(fvec4) Load 282 - 284: 11(float) CompositeExtract 283 0 - 285: 11(float) GroupFMaxNonUniformAMD 25 Reduce 284 - 286: 11(float) CompositeExtract 283 1 - 287: 11(float) GroupFMaxNonUniformAMD 25 Reduce 286 - 288: 11(float) CompositeExtract 283 2 - 289: 11(float) GroupFMaxNonUniformAMD 25 Reduce 288 - 290: 11(float) CompositeExtract 283 3 - 291: 11(float) GroupFMaxNonUniformAMD 25 Reduce 290 - 292: 12(fvec4) CompositeConstruct 285 287 289 291 - 293: 51(ptr) AccessChain 20 50 - Store 293 292 - 294: 65(ptr) AccessChain 20 64 - 295: 13(int) Load 294 - 296: 13(int) GroupSMaxNonUniformAMD 25 Reduce 295 - 297: 65(ptr) AccessChain 20 64 - Store 297 296 - 298: 71(ptr) AccessChain 20 70 - 299: 15(ivec2) Load 298 - 300: 14(int) CompositeExtract 299 0 - 301: 14(int) GroupUMaxNonUniformAMD 25 Reduce 300 - 302: 14(int) CompositeExtract 299 1 - 303: 14(int) GroupUMaxNonUniformAMD 25 Reduce 302 - 304: 15(ivec2) CompositeConstruct 301 303 - 305: 71(ptr) AccessChain 20 70 - Store 305 304 - 306: 81(ptr) AccessChain 20 80 - 307: 17(fvec3) Load 306 - 308: 16(float) CompositeExtract 307 0 - 309: 16(float) GroupFMaxNonUniformAMD 25 Reduce 308 - 310: 16(float) CompositeExtract 307 1 - 311: 16(float) GroupFMaxNonUniformAMD 25 Reduce 310 - 312: 16(float) CompositeExtract 307 2 - 313: 16(float) GroupFMaxNonUniformAMD 25 Reduce 312 - 314: 17(fvec3) CompositeConstruct 309 311 313 - 315: 81(ptr) AccessChain 20 80 - Store 315 314 - 316: 22(ptr) AccessChain 20 21 - 317: 6(int) Load 316 - 318: 6(int) GroupIAddNonUniformAMD 25 Reduce 317 - 319: 22(ptr) AccessChain 20 21 - Store 319 318 - 320: 29(ptr) AccessChain 20 28 - 321: 8(ivec2) Load 320 - 322: 7(int) CompositeExtract 321 0 - 323: 7(int) GroupIAddNonUniformAMD 25 Reduce 322 - 324: 7(int) CompositeExtract 321 1 - 325: 7(int) GroupIAddNonUniformAMD 25 Reduce 324 - 326: 8(ivec2) CompositeConstruct 323 325 - 327: 29(ptr) AccessChain 20 28 - Store 327 326 - 328: 39(ptr) AccessChain 20 38 - 329: 10(fvec3) Load 328 - 330: 9(float) CompositeExtract 329 0 - 331: 9(float) GroupFAddNonUniformAMD 25 Reduce 330 - 332: 9(float) CompositeExtract 329 1 - 333: 9(float) GroupFAddNonUniformAMD 25 Reduce 332 - 334: 9(float) CompositeExtract 329 2 - 335: 9(float) GroupFAddNonUniformAMD 25 Reduce 334 - 336: 10(fvec3) CompositeConstruct 331 333 335 - 337: 39(ptr) AccessChain 20 38 - Store 337 336 - 338: 51(ptr) AccessChain 20 50 - 339: 12(fvec4) Load 338 - 340: 11(float) CompositeExtract 339 0 - 341: 11(float) GroupFAddNonUniformAMD 25 Reduce 340 - 342: 11(float) CompositeExtract 339 1 - 343: 11(float) GroupFAddNonUniformAMD 25 Reduce 342 - 344: 11(float) CompositeExtract 339 2 - 345: 11(float) GroupFAddNonUniformAMD 25 Reduce 344 - 346: 11(float) CompositeExtract 339 3 - 347: 11(float) GroupFAddNonUniformAMD 25 Reduce 346 - 348: 12(fvec4) CompositeConstruct 341 343 345 347 - 349: 51(ptr) AccessChain 20 50 - Store 349 348 - 350: 65(ptr) AccessChain 20 64 - 351: 13(int) Load 350 - 352: 13(int) GroupIAddNonUniformAMD 25 Reduce 351 - 353: 65(ptr) AccessChain 20 64 - Store 353 352 - 354: 71(ptr) AccessChain 20 70 - 355: 15(ivec2) Load 354 - 356: 14(int) CompositeExtract 355 0 - 357: 14(int) GroupIAddNonUniformAMD 25 Reduce 356 - 358: 14(int) CompositeExtract 355 1 - 359: 14(int) GroupIAddNonUniformAMD 25 Reduce 358 - 360: 15(ivec2) CompositeConstruct 357 359 - 361: 71(ptr) AccessChain 20 70 - Store 361 360 - 362: 81(ptr) AccessChain 20 80 - 363: 17(fvec3) Load 362 - 364: 16(float) CompositeExtract 363 0 - 365: 16(float) GroupFAddNonUniformAMD 25 Reduce 364 - 366: 16(float) CompositeExtract 363 1 - 367: 16(float) GroupFAddNonUniformAMD 25 Reduce 366 - 368: 16(float) CompositeExtract 363 2 - 369: 16(float) GroupFAddNonUniformAMD 25 Reduce 368 - 370: 17(fvec3) CompositeConstruct 365 367 369 - 371: 81(ptr) AccessChain 20 80 - Store 371 370 - 372: 22(ptr) AccessChain 20 21 - 373: 6(int) Load 372 - 374: 6(int) GroupSMin 25 InclusiveScan 373 - 375: 22(ptr) AccessChain 20 21 - Store 375 374 - 376: 29(ptr) AccessChain 20 28 - 377: 8(ivec2) Load 376 - 378: 7(int) CompositeExtract 377 0 - 379: 7(int) GroupUMin 25 InclusiveScan 378 - 380: 7(int) CompositeExtract 377 1 - 381: 7(int) GroupUMin 25 InclusiveScan 380 - 382: 8(ivec2) CompositeConstruct 379 381 - 383: 29(ptr) AccessChain 20 28 - Store 383 382 - 384: 39(ptr) AccessChain 20 38 - 385: 10(fvec3) Load 384 - 386: 9(float) CompositeExtract 385 0 - 387: 9(float) GroupFMin 25 InclusiveScan 386 - 388: 9(float) CompositeExtract 385 1 - 389: 9(float) GroupFMin 25 InclusiveScan 388 - 390: 9(float) CompositeExtract 385 2 - 391: 9(float) GroupFMin 25 InclusiveScan 390 - 392: 10(fvec3) CompositeConstruct 387 389 391 - 393: 39(ptr) AccessChain 20 38 - Store 393 392 - 394: 51(ptr) AccessChain 20 50 - 395: 12(fvec4) Load 394 - 396: 11(float) CompositeExtract 395 0 - 397: 11(float) GroupFMin 25 InclusiveScan 396 - 398: 11(float) CompositeExtract 395 1 - 399: 11(float) GroupFMin 25 InclusiveScan 398 - 400: 11(float) CompositeExtract 395 2 - 401: 11(float) GroupFMin 25 InclusiveScan 400 - 402: 11(float) CompositeExtract 395 3 - 403: 11(float) GroupFMin 25 InclusiveScan 402 - 404: 12(fvec4) CompositeConstruct 397 399 401 403 - 405: 51(ptr) AccessChain 20 50 - Store 405 404 - 406: 65(ptr) AccessChain 20 64 - 407: 13(int) Load 406 - 408: 13(int) GroupSMin 25 InclusiveScan 407 - 409: 65(ptr) AccessChain 20 64 - Store 409 408 - 410: 71(ptr) AccessChain 20 70 - 411: 15(ivec2) Load 410 - 412: 14(int) CompositeExtract 411 0 - 413: 14(int) GroupUMin 25 InclusiveScan 412 - 414: 14(int) CompositeExtract 411 1 - 415: 14(int) GroupUMin 25 InclusiveScan 414 - 416: 15(ivec2) CompositeConstruct 413 415 - 417: 71(ptr) AccessChain 20 70 - Store 417 416 - 418: 81(ptr) AccessChain 20 80 - 419: 17(fvec3) Load 418 - 420: 16(float) CompositeExtract 419 0 - 421: 16(float) GroupFMin 25 InclusiveScan 420 - 422: 16(float) CompositeExtract 419 1 - 423: 16(float) GroupFMin 25 InclusiveScan 422 - 424: 16(float) CompositeExtract 419 2 - 425: 16(float) GroupFMin 25 InclusiveScan 424 - 426: 17(fvec3) CompositeConstruct 421 423 425 - 427: 81(ptr) AccessChain 20 80 - Store 427 426 - 428: 22(ptr) AccessChain 20 21 - 429: 6(int) Load 428 - 430: 6(int) GroupSMax 25 InclusiveScan 429 - 431: 22(ptr) AccessChain 20 21 - Store 431 430 - 432: 29(ptr) AccessChain 20 28 - 433: 8(ivec2) Load 432 - 434: 7(int) CompositeExtract 433 0 - 435: 7(int) GroupUMax 25 InclusiveScan 434 - 436: 7(int) CompositeExtract 433 1 - 437: 7(int) GroupUMax 25 InclusiveScan 436 - 438: 8(ivec2) CompositeConstruct 435 437 - 439: 29(ptr) AccessChain 20 28 - Store 439 438 - 440: 39(ptr) AccessChain 20 38 - 441: 10(fvec3) Load 440 - 442: 9(float) CompositeExtract 441 0 - 443: 9(float) GroupFMax 25 InclusiveScan 442 - 444: 9(float) CompositeExtract 441 1 - 445: 9(float) GroupFMax 25 InclusiveScan 444 - 446: 9(float) CompositeExtract 441 2 - 447: 9(float) GroupFMax 25 InclusiveScan 446 - 448: 10(fvec3) CompositeConstruct 443 445 447 - 449: 39(ptr) AccessChain 20 38 - Store 449 448 - 450: 51(ptr) AccessChain 20 50 - 451: 12(fvec4) Load 450 - 452: 11(float) CompositeExtract 451 0 - 453: 11(float) GroupFMax 25 InclusiveScan 452 - 454: 11(float) CompositeExtract 451 1 - 455: 11(float) GroupFMax 25 InclusiveScan 454 - 456: 11(float) CompositeExtract 451 2 - 457: 11(float) GroupFMax 25 InclusiveScan 456 - 458: 11(float) CompositeExtract 451 3 - 459: 11(float) GroupFMax 25 InclusiveScan 458 - 460: 12(fvec4) CompositeConstruct 453 455 457 459 - 461: 51(ptr) AccessChain 20 50 - Store 461 460 - 462: 65(ptr) AccessChain 20 64 - 463: 13(int) Load 462 - 464: 13(int) GroupSMax 25 InclusiveScan 463 - 465: 65(ptr) AccessChain 20 64 - Store 465 464 - 466: 71(ptr) AccessChain 20 70 - 467: 15(ivec2) Load 466 - 468: 14(int) CompositeExtract 467 0 - 469: 14(int) GroupUMax 25 InclusiveScan 468 - 470: 14(int) CompositeExtract 467 1 - 471: 14(int) GroupUMax 25 InclusiveScan 470 - 472: 15(ivec2) CompositeConstruct 469 471 - 473: 71(ptr) AccessChain 20 70 - Store 473 472 - 474: 81(ptr) AccessChain 20 80 - 475: 17(fvec3) Load 474 - 476: 16(float) CompositeExtract 475 0 - 477: 16(float) GroupFMax 25 InclusiveScan 476 - 478: 16(float) CompositeExtract 475 1 - 479: 16(float) GroupFMax 25 InclusiveScan 478 - 480: 16(float) CompositeExtract 475 2 - 481: 16(float) GroupFMax 25 InclusiveScan 480 - 482: 17(fvec3) CompositeConstruct 477 479 481 - 483: 81(ptr) AccessChain 20 80 - Store 483 482 - 484: 22(ptr) AccessChain 20 21 - 485: 6(int) Load 484 - 486: 6(int) GroupIAdd 25 InclusiveScan 485 - 487: 22(ptr) AccessChain 20 21 - Store 487 486 - 488: 29(ptr) AccessChain 20 28 - 489: 8(ivec2) Load 488 - 490: 7(int) CompositeExtract 489 0 - 491: 7(int) GroupIAdd 25 InclusiveScan 490 - 492: 7(int) CompositeExtract 489 1 - 493: 7(int) GroupIAdd 25 InclusiveScan 492 - 494: 8(ivec2) CompositeConstruct 491 493 - 495: 29(ptr) AccessChain 20 28 - Store 495 494 - 496: 39(ptr) AccessChain 20 38 - 497: 10(fvec3) Load 496 - 498: 9(float) CompositeExtract 497 0 - 499: 9(float) GroupFAdd 25 InclusiveScan 498 - 500: 9(float) CompositeExtract 497 1 - 501: 9(float) GroupFAdd 25 InclusiveScan 500 - 502: 9(float) CompositeExtract 497 2 - 503: 9(float) GroupFAdd 25 InclusiveScan 502 - 504: 10(fvec3) CompositeConstruct 499 501 503 - 505: 39(ptr) AccessChain 20 38 - Store 505 504 - 506: 51(ptr) AccessChain 20 50 - 507: 12(fvec4) Load 506 - 508: 11(float) CompositeExtract 507 0 - 509: 11(float) GroupFAdd 25 InclusiveScan 508 - 510: 11(float) CompositeExtract 507 1 - 511: 11(float) GroupFAdd 25 InclusiveScan 510 - 512: 11(float) CompositeExtract 507 2 - 513: 11(float) GroupFAdd 25 InclusiveScan 512 - 514: 11(float) CompositeExtract 507 3 - 515: 11(float) GroupFAdd 25 InclusiveScan 514 - 516: 12(fvec4) CompositeConstruct 509 511 513 515 - 517: 51(ptr) AccessChain 20 50 - Store 517 516 - 518: 65(ptr) AccessChain 20 64 - 519: 13(int) Load 518 - 520: 13(int) GroupIAdd 25 InclusiveScan 519 - 521: 65(ptr) AccessChain 20 64 - Store 521 520 - 522: 71(ptr) AccessChain 20 70 - 523: 15(ivec2) Load 522 - 524: 14(int) CompositeExtract 523 0 - 525: 14(int) GroupIAdd 25 InclusiveScan 524 - 526: 14(int) CompositeExtract 523 1 - 527: 14(int) GroupIAdd 25 InclusiveScan 526 - 528: 15(ivec2) CompositeConstruct 525 527 - 529: 71(ptr) AccessChain 20 70 - Store 529 528 - 530: 81(ptr) AccessChain 20 80 - 531: 17(fvec3) Load 530 - 532: 16(float) CompositeExtract 531 0 - 533: 16(float) GroupFAdd 25 InclusiveScan 532 - 534: 16(float) CompositeExtract 531 1 - 535: 16(float) GroupFAdd 25 InclusiveScan 534 - 536: 16(float) CompositeExtract 531 2 - 537: 16(float) GroupFAdd 25 InclusiveScan 536 - 538: 17(fvec3) CompositeConstruct 533 535 537 - 539: 81(ptr) AccessChain 20 80 - Store 539 538 - 540: 22(ptr) AccessChain 20 21 - 541: 6(int) Load 540 - 542: 6(int) GroupSMin 25 ExclusiveScan 541 - 543: 22(ptr) AccessChain 20 21 - Store 543 542 - 544: 29(ptr) AccessChain 20 28 - 545: 8(ivec2) Load 544 - 546: 7(int) CompositeExtract 545 0 - 547: 7(int) GroupUMin 25 ExclusiveScan 546 - 548: 7(int) CompositeExtract 545 1 - 549: 7(int) GroupUMin 25 ExclusiveScan 548 - 550: 8(ivec2) CompositeConstruct 547 549 - 551: 29(ptr) AccessChain 20 28 - Store 551 550 - 552: 39(ptr) AccessChain 20 38 - 553: 10(fvec3) Load 552 - 554: 9(float) CompositeExtract 553 0 - 555: 9(float) GroupFMin 25 ExclusiveScan 554 - 556: 9(float) CompositeExtract 553 1 - 557: 9(float) GroupFMin 25 ExclusiveScan 556 - 558: 9(float) CompositeExtract 553 2 - 559: 9(float) GroupFMin 25 ExclusiveScan 558 - 560: 10(fvec3) CompositeConstruct 555 557 559 - 561: 39(ptr) AccessChain 20 38 - Store 561 560 - 562: 51(ptr) AccessChain 20 50 - 563: 12(fvec4) Load 562 - 564: 11(float) CompositeExtract 563 0 - 565: 11(float) GroupFMin 25 ExclusiveScan 564 - 566: 11(float) CompositeExtract 563 1 - 567: 11(float) GroupFMin 25 ExclusiveScan 566 - 568: 11(float) CompositeExtract 563 2 - 569: 11(float) GroupFMin 25 ExclusiveScan 568 - 570: 11(float) CompositeExtract 563 3 - 571: 11(float) GroupFMin 25 ExclusiveScan 570 - 572: 12(fvec4) CompositeConstruct 565 567 569 571 - 573: 51(ptr) AccessChain 20 50 - Store 573 572 - 574: 65(ptr) AccessChain 20 64 - 575: 13(int) Load 574 - 576: 13(int) GroupSMin 25 ExclusiveScan 575 - 577: 65(ptr) AccessChain 20 64 - Store 577 576 - 578: 71(ptr) AccessChain 20 70 - 579: 15(ivec2) Load 578 - 580: 14(int) CompositeExtract 579 0 - 581: 14(int) GroupUMin 25 ExclusiveScan 580 - 582: 14(int) CompositeExtract 579 1 - 583: 14(int) GroupUMin 25 ExclusiveScan 582 - 584: 15(ivec2) CompositeConstruct 581 583 - 585: 71(ptr) AccessChain 20 70 - Store 585 584 - 586: 81(ptr) AccessChain 20 80 - 587: 17(fvec3) Load 586 - 588: 16(float) CompositeExtract 587 0 - 589: 16(float) GroupFMin 25 ExclusiveScan 588 - 590: 16(float) CompositeExtract 587 1 - 591: 16(float) GroupFMin 25 ExclusiveScan 590 - 592: 16(float) CompositeExtract 587 2 - 593: 16(float) GroupFMin 25 ExclusiveScan 592 - 594: 17(fvec3) CompositeConstruct 589 591 593 - 595: 81(ptr) AccessChain 20 80 - Store 595 594 - 596: 22(ptr) AccessChain 20 21 - 597: 6(int) Load 596 - 598: 6(int) GroupSMax 25 ExclusiveScan 597 - 599: 22(ptr) AccessChain 20 21 - Store 599 598 - 600: 29(ptr) AccessChain 20 28 - 601: 8(ivec2) Load 600 - 602: 7(int) CompositeExtract 601 0 - 603: 7(int) GroupUMax 25 ExclusiveScan 602 - 604: 7(int) CompositeExtract 601 1 - 605: 7(int) GroupUMax 25 ExclusiveScan 604 - 606: 8(ivec2) CompositeConstruct 603 605 - 607: 29(ptr) AccessChain 20 28 - Store 607 606 - 608: 39(ptr) AccessChain 20 38 - 609: 10(fvec3) Load 608 - 610: 9(float) CompositeExtract 609 0 - 611: 9(float) GroupFMax 25 ExclusiveScan 610 - 612: 9(float) CompositeExtract 609 1 - 613: 9(float) GroupFMax 25 ExclusiveScan 612 - 614: 9(float) CompositeExtract 609 2 - 615: 9(float) GroupFMax 25 ExclusiveScan 614 - 616: 10(fvec3) CompositeConstruct 611 613 615 - 617: 39(ptr) AccessChain 20 38 - Store 617 616 - 618: 51(ptr) AccessChain 20 50 - 619: 12(fvec4) Load 618 - 620: 11(float) CompositeExtract 619 0 - 621: 11(float) GroupFMax 25 ExclusiveScan 620 - 622: 11(float) CompositeExtract 619 1 - 623: 11(float) GroupFMax 25 ExclusiveScan 622 - 624: 11(float) CompositeExtract 619 2 - 625: 11(float) GroupFMax 25 ExclusiveScan 624 - 626: 11(float) CompositeExtract 619 3 - 627: 11(float) GroupFMax 25 ExclusiveScan 626 - 628: 12(fvec4) CompositeConstruct 621 623 625 627 - 629: 51(ptr) AccessChain 20 50 - Store 629 628 - 630: 65(ptr) AccessChain 20 64 - 631: 13(int) Load 630 - 632: 13(int) GroupSMax 25 ExclusiveScan 631 - 633: 65(ptr) AccessChain 20 64 - Store 633 632 - 634: 71(ptr) AccessChain 20 70 - 635: 15(ivec2) Load 634 - 636: 14(int) CompositeExtract 635 0 - 637: 14(int) GroupUMax 25 ExclusiveScan 636 - 638: 14(int) CompositeExtract 635 1 - 639: 14(int) GroupUMax 25 ExclusiveScan 638 - 640: 15(ivec2) CompositeConstruct 637 639 - 641: 71(ptr) AccessChain 20 70 - Store 641 640 - 642: 81(ptr) AccessChain 20 80 - 643: 17(fvec3) Load 642 - 644: 16(float) CompositeExtract 643 0 - 645: 16(float) GroupFMax 25 ExclusiveScan 644 - 646: 16(float) CompositeExtract 643 1 - 647: 16(float) GroupFMax 25 ExclusiveScan 646 - 648: 16(float) CompositeExtract 643 2 - 649: 16(float) GroupFMax 25 ExclusiveScan 648 - 650: 17(fvec3) CompositeConstruct 645 647 649 - 651: 81(ptr) AccessChain 20 80 - Store 651 650 - 652: 22(ptr) AccessChain 20 21 - 653: 6(int) Load 652 - 654: 6(int) GroupIAdd 25 ExclusiveScan 653 - 655: 22(ptr) AccessChain 20 21 - Store 655 654 - 656: 29(ptr) AccessChain 20 28 - 657: 8(ivec2) Load 656 - 658: 7(int) CompositeExtract 657 0 - 659: 7(int) GroupIAdd 25 ExclusiveScan 658 - 660: 7(int) CompositeExtract 657 1 - 661: 7(int) GroupIAdd 25 ExclusiveScan 660 - 662: 8(ivec2) CompositeConstruct 659 661 - 663: 29(ptr) AccessChain 20 28 - Store 663 662 - 664: 39(ptr) AccessChain 20 38 - 665: 10(fvec3) Load 664 - 666: 9(float) CompositeExtract 665 0 - 667: 9(float) GroupFAdd 25 ExclusiveScan 666 - 668: 9(float) CompositeExtract 665 1 - 669: 9(float) GroupFAdd 25 ExclusiveScan 668 - 670: 9(float) CompositeExtract 665 2 - 671: 9(float) GroupFAdd 25 ExclusiveScan 670 - 672: 10(fvec3) CompositeConstruct 667 669 671 - 673: 39(ptr) AccessChain 20 38 - Store 673 672 - 674: 51(ptr) AccessChain 20 50 - 675: 12(fvec4) Load 674 - 676: 11(float) CompositeExtract 675 0 - 677: 11(float) GroupFAdd 25 ExclusiveScan 676 - 678: 11(float) CompositeExtract 675 1 - 679: 11(float) GroupFAdd 25 ExclusiveScan 678 - 680: 11(float) CompositeExtract 675 2 - 681: 11(float) GroupFAdd 25 ExclusiveScan 680 - 682: 11(float) CompositeExtract 675 3 - 683: 11(float) GroupFAdd 25 ExclusiveScan 682 - 684: 12(fvec4) CompositeConstruct 677 679 681 683 - 685: 51(ptr) AccessChain 20 50 - Store 685 684 - 686: 65(ptr) AccessChain 20 64 - 687: 13(int) Load 686 - 688: 13(int) GroupIAdd 25 ExclusiveScan 687 - 689: 65(ptr) AccessChain 20 64 - Store 689 688 - 690: 71(ptr) AccessChain 20 70 - 691: 15(ivec2) Load 690 - 692: 14(int) CompositeExtract 691 0 - 693: 14(int) GroupIAdd 25 ExclusiveScan 692 - 694: 14(int) CompositeExtract 691 1 - 695: 14(int) GroupIAdd 25 ExclusiveScan 694 - 696: 15(ivec2) CompositeConstruct 693 695 - 697: 71(ptr) AccessChain 20 70 - Store 697 696 - 698: 81(ptr) AccessChain 20 80 - 699: 17(fvec3) Load 698 - 700: 16(float) CompositeExtract 699 0 - 701: 16(float) GroupFAdd 25 ExclusiveScan 700 - 702: 16(float) CompositeExtract 699 1 - 703: 16(float) GroupFAdd 25 ExclusiveScan 702 - 704: 16(float) CompositeExtract 699 2 - 705: 16(float) GroupFAdd 25 ExclusiveScan 704 - 706: 17(fvec3) CompositeConstruct 701 703 705 - 707: 81(ptr) AccessChain 20 80 - Store 707 706 - 708: 22(ptr) AccessChain 20 21 - 709: 6(int) Load 708 - 710: 6(int) GroupSMinNonUniformAMD 25 InclusiveScan 709 - 711: 22(ptr) AccessChain 20 21 - Store 711 710 - 712: 29(ptr) AccessChain 20 28 - 713: 8(ivec2) Load 712 - 714: 7(int) CompositeExtract 713 0 - 715: 7(int) GroupUMinNonUniformAMD 25 InclusiveScan 714 - 716: 7(int) CompositeExtract 713 1 - 717: 7(int) GroupUMinNonUniformAMD 25 InclusiveScan 716 - 718: 8(ivec2) CompositeConstruct 715 717 - 719: 29(ptr) AccessChain 20 28 - Store 719 718 - 720: 39(ptr) AccessChain 20 38 - 721: 10(fvec3) Load 720 - 722: 9(float) CompositeExtract 721 0 - 723: 9(float) GroupFMinNonUniformAMD 25 InclusiveScan 722 - 724: 9(float) CompositeExtract 721 1 - 725: 9(float) GroupFMinNonUniformAMD 25 InclusiveScan 724 - 726: 9(float) CompositeExtract 721 2 - 727: 9(float) GroupFMinNonUniformAMD 25 InclusiveScan 726 - 728: 10(fvec3) CompositeConstruct 723 725 727 - 729: 39(ptr) AccessChain 20 38 - Store 729 728 - 730: 51(ptr) AccessChain 20 50 - 731: 12(fvec4) Load 730 - 732: 11(float) CompositeExtract 731 0 - 733: 11(float) GroupFMinNonUniformAMD 25 InclusiveScan 732 - 734: 11(float) CompositeExtract 731 1 - 735: 11(float) GroupFMinNonUniformAMD 25 InclusiveScan 734 - 736: 11(float) CompositeExtract 731 2 - 737: 11(float) GroupFMinNonUniformAMD 25 InclusiveScan 736 - 738: 11(float) CompositeExtract 731 3 - 739: 11(float) GroupFMinNonUniformAMD 25 InclusiveScan 738 - 740: 12(fvec4) CompositeConstruct 733 735 737 739 - 741: 51(ptr) AccessChain 20 50 - Store 741 740 - 742: 65(ptr) AccessChain 20 64 - 743: 13(int) Load 742 - 744: 13(int) GroupSMinNonUniformAMD 25 InclusiveScan 743 - 745: 65(ptr) AccessChain 20 64 - Store 745 744 - 746: 71(ptr) AccessChain 20 70 - 747: 15(ivec2) Load 746 - 748: 14(int) CompositeExtract 747 0 - 749: 14(int) GroupUMinNonUniformAMD 25 InclusiveScan 748 - 750: 14(int) CompositeExtract 747 1 - 751: 14(int) GroupUMinNonUniformAMD 25 InclusiveScan 750 - 752: 15(ivec2) CompositeConstruct 749 751 - 753: 71(ptr) AccessChain 20 70 - Store 753 752 - 754: 81(ptr) AccessChain 20 80 - 755: 17(fvec3) Load 754 - 756: 16(float) CompositeExtract 755 0 - 757: 16(float) GroupFMinNonUniformAMD 25 InclusiveScan 756 - 758: 16(float) CompositeExtract 755 1 - 759: 16(float) GroupFMinNonUniformAMD 25 InclusiveScan 758 - 760: 16(float) CompositeExtract 755 2 - 761: 16(float) GroupFMinNonUniformAMD 25 InclusiveScan 760 - 762: 17(fvec3) CompositeConstruct 757 759 761 - 763: 81(ptr) AccessChain 20 80 - Store 763 762 - 764: 22(ptr) AccessChain 20 21 - 765: 6(int) Load 764 - 766: 6(int) GroupSMaxNonUniformAMD 25 InclusiveScan 765 - 767: 22(ptr) AccessChain 20 21 - Store 767 766 - 768: 29(ptr) AccessChain 20 28 - 769: 8(ivec2) Load 768 - 770: 7(int) CompositeExtract 769 0 - 771: 7(int) GroupUMaxNonUniformAMD 25 InclusiveScan 770 - 772: 7(int) CompositeExtract 769 1 - 773: 7(int) GroupUMaxNonUniformAMD 25 InclusiveScan 772 - 774: 8(ivec2) CompositeConstruct 771 773 - 775: 29(ptr) AccessChain 20 28 - Store 775 774 - 776: 39(ptr) AccessChain 20 38 - 777: 10(fvec3) Load 776 - 778: 9(float) CompositeExtract 777 0 - 779: 9(float) GroupFMaxNonUniformAMD 25 InclusiveScan 778 - 780: 9(float) CompositeExtract 777 1 - 781: 9(float) GroupFMaxNonUniformAMD 25 InclusiveScan 780 - 782: 9(float) CompositeExtract 777 2 - 783: 9(float) GroupFMaxNonUniformAMD 25 InclusiveScan 782 - 784: 10(fvec3) CompositeConstruct 779 781 783 - 785: 39(ptr) AccessChain 20 38 - Store 785 784 - 786: 51(ptr) AccessChain 20 50 - 787: 12(fvec4) Load 786 - 788: 11(float) CompositeExtract 787 0 - 789: 11(float) GroupFMaxNonUniformAMD 25 InclusiveScan 788 - 790: 11(float) CompositeExtract 787 1 - 791: 11(float) GroupFMaxNonUniformAMD 25 InclusiveScan 790 - 792: 11(float) CompositeExtract 787 2 - 793: 11(float) GroupFMaxNonUniformAMD 25 InclusiveScan 792 - 794: 11(float) CompositeExtract 787 3 - 795: 11(float) GroupFMaxNonUniformAMD 25 InclusiveScan 794 - 796: 12(fvec4) CompositeConstruct 789 791 793 795 - 797: 51(ptr) AccessChain 20 50 - Store 797 796 - 798: 65(ptr) AccessChain 20 64 - 799: 13(int) Load 798 - 800: 13(int) GroupSMaxNonUniformAMD 25 InclusiveScan 799 - 801: 65(ptr) AccessChain 20 64 - Store 801 800 - 802: 71(ptr) AccessChain 20 70 - 803: 15(ivec2) Load 802 - 804: 14(int) CompositeExtract 803 0 - 805: 14(int) GroupUMaxNonUniformAMD 25 InclusiveScan 804 - 806: 14(int) CompositeExtract 803 1 - 807: 14(int) GroupUMaxNonUniformAMD 25 InclusiveScan 806 - 808: 15(ivec2) CompositeConstruct 805 807 - 809: 71(ptr) AccessChain 20 70 - Store 809 808 - 810: 81(ptr) AccessChain 20 80 - 811: 17(fvec3) Load 810 - 812: 16(float) CompositeExtract 811 0 - 813: 16(float) GroupFMaxNonUniformAMD 25 InclusiveScan 812 - 814: 16(float) CompositeExtract 811 1 - 815: 16(float) GroupFMaxNonUniformAMD 25 InclusiveScan 814 - 816: 16(float) CompositeExtract 811 2 - 817: 16(float) GroupFMaxNonUniformAMD 25 InclusiveScan 816 - 818: 17(fvec3) CompositeConstruct 813 815 817 - 819: 81(ptr) AccessChain 20 80 - Store 819 818 - 820: 22(ptr) AccessChain 20 21 - 821: 6(int) Load 820 - 822: 6(int) GroupIAddNonUniformAMD 25 InclusiveScan 821 - 823: 22(ptr) AccessChain 20 21 - Store 823 822 - 824: 29(ptr) AccessChain 20 28 - 825: 8(ivec2) Load 824 - 826: 7(int) CompositeExtract 825 0 - 827: 7(int) GroupIAddNonUniformAMD 25 InclusiveScan 826 - 828: 7(int) CompositeExtract 825 1 - 829: 7(int) GroupIAddNonUniformAMD 25 InclusiveScan 828 - 830: 8(ivec2) CompositeConstruct 827 829 - 831: 29(ptr) AccessChain 20 28 - Store 831 830 - 832: 39(ptr) AccessChain 20 38 - 833: 10(fvec3) Load 832 - 834: 9(float) CompositeExtract 833 0 - 835: 9(float) GroupFAddNonUniformAMD 25 InclusiveScan 834 - 836: 9(float) CompositeExtract 833 1 - 837: 9(float) GroupFAddNonUniformAMD 25 InclusiveScan 836 - 838: 9(float) CompositeExtract 833 2 - 839: 9(float) GroupFAddNonUniformAMD 25 InclusiveScan 838 - 840: 10(fvec3) CompositeConstruct 835 837 839 - 841: 39(ptr) AccessChain 20 38 - Store 841 840 - 842: 51(ptr) AccessChain 20 50 - 843: 12(fvec4) Load 842 - 844: 11(float) CompositeExtract 843 0 - 845: 11(float) GroupFAddNonUniformAMD 25 InclusiveScan 844 - 846: 11(float) CompositeExtract 843 1 - 847: 11(float) GroupFAddNonUniformAMD 25 InclusiveScan 846 - 848: 11(float) CompositeExtract 843 2 - 849: 11(float) GroupFAddNonUniformAMD 25 InclusiveScan 848 - 850: 11(float) CompositeExtract 843 3 - 851: 11(float) GroupFAddNonUniformAMD 25 InclusiveScan 850 - 852: 12(fvec4) CompositeConstruct 845 847 849 851 - 853: 51(ptr) AccessChain 20 50 - Store 853 852 - 854: 65(ptr) AccessChain 20 64 - 855: 13(int) Load 854 - 856: 13(int) GroupIAddNonUniformAMD 25 InclusiveScan 855 - 857: 65(ptr) AccessChain 20 64 - Store 857 856 - 858: 71(ptr) AccessChain 20 70 - 859: 15(ivec2) Load 858 - 860: 14(int) CompositeExtract 859 0 - 861: 14(int) GroupIAddNonUniformAMD 25 InclusiveScan 860 - 862: 14(int) CompositeExtract 859 1 - 863: 14(int) GroupIAddNonUniformAMD 25 InclusiveScan 862 - 864: 15(ivec2) CompositeConstruct 861 863 - 865: 71(ptr) AccessChain 20 70 - Store 865 864 - 866: 81(ptr) AccessChain 20 80 - 867: 17(fvec3) Load 866 - 868: 16(float) CompositeExtract 867 0 - 869: 16(float) GroupFAddNonUniformAMD 25 InclusiveScan 868 - 870: 16(float) CompositeExtract 867 1 - 871: 16(float) GroupFAddNonUniformAMD 25 InclusiveScan 870 - 872: 16(float) CompositeExtract 867 2 - 873: 16(float) GroupFAddNonUniformAMD 25 InclusiveScan 872 - 874: 17(fvec3) CompositeConstruct 869 871 873 - 875: 81(ptr) AccessChain 20 80 - Store 875 874 - 876: 22(ptr) AccessChain 20 21 - 877: 6(int) Load 876 - 878: 6(int) GroupSMinNonUniformAMD 25 ExclusiveScan 877 - 879: 22(ptr) AccessChain 20 21 - Store 879 878 - 880: 29(ptr) AccessChain 20 28 - 881: 8(ivec2) Load 880 - 882: 7(int) CompositeExtract 881 0 - 883: 7(int) GroupUMinNonUniformAMD 25 ExclusiveScan 882 - 884: 7(int) CompositeExtract 881 1 - 885: 7(int) GroupUMinNonUniformAMD 25 ExclusiveScan 884 - 886: 8(ivec2) CompositeConstruct 883 885 - 887: 29(ptr) AccessChain 20 28 - Store 887 886 - 888: 39(ptr) AccessChain 20 38 - 889: 10(fvec3) Load 888 - 890: 9(float) CompositeExtract 889 0 - 891: 9(float) GroupFMinNonUniformAMD 25 ExclusiveScan 890 - 892: 9(float) CompositeExtract 889 1 - 893: 9(float) GroupFMinNonUniformAMD 25 ExclusiveScan 892 - 894: 9(float) CompositeExtract 889 2 - 895: 9(float) GroupFMinNonUniformAMD 25 ExclusiveScan 894 - 896: 10(fvec3) CompositeConstruct 891 893 895 - 897: 39(ptr) AccessChain 20 38 - Store 897 896 - 898: 51(ptr) AccessChain 20 50 - 899: 12(fvec4) Load 898 - 900: 11(float) CompositeExtract 899 0 - 901: 11(float) GroupFMinNonUniformAMD 25 ExclusiveScan 900 - 902: 11(float) CompositeExtract 899 1 - 903: 11(float) GroupFMinNonUniformAMD 25 ExclusiveScan 902 - 904: 11(float) CompositeExtract 899 2 - 905: 11(float) GroupFMinNonUniformAMD 25 ExclusiveScan 904 - 906: 11(float) CompositeExtract 899 3 - 907: 11(float) GroupFMinNonUniformAMD 25 ExclusiveScan 906 - 908: 12(fvec4) CompositeConstruct 901 903 905 907 - 909: 51(ptr) AccessChain 20 50 - Store 909 908 - 910: 65(ptr) AccessChain 20 64 - 911: 13(int) Load 910 - 912: 13(int) GroupSMinNonUniformAMD 25 ExclusiveScan 911 - 913: 65(ptr) AccessChain 20 64 - Store 913 912 - 914: 71(ptr) AccessChain 20 70 - 915: 15(ivec2) Load 914 - 916: 14(int) CompositeExtract 915 0 - 917: 14(int) GroupUMinNonUniformAMD 25 ExclusiveScan 916 - 918: 14(int) CompositeExtract 915 1 - 919: 14(int) GroupUMinNonUniformAMD 25 ExclusiveScan 918 - 920: 15(ivec2) CompositeConstruct 917 919 - 921: 71(ptr) AccessChain 20 70 - Store 921 920 - 922: 81(ptr) AccessChain 20 80 - 923: 17(fvec3) Load 922 - 924: 16(float) CompositeExtract 923 0 - 925: 16(float) GroupFMinNonUniformAMD 25 ExclusiveScan 924 - 926: 16(float) CompositeExtract 923 1 - 927: 16(float) GroupFMinNonUniformAMD 25 ExclusiveScan 926 - 928: 16(float) CompositeExtract 923 2 - 929: 16(float) GroupFMinNonUniformAMD 25 ExclusiveScan 928 - 930: 17(fvec3) CompositeConstruct 925 927 929 - 931: 81(ptr) AccessChain 20 80 - Store 931 930 - 932: 22(ptr) AccessChain 20 21 - 933: 6(int) Load 932 - 934: 6(int) GroupSMaxNonUniformAMD 25 ExclusiveScan 933 - 935: 22(ptr) AccessChain 20 21 - Store 935 934 - 936: 29(ptr) AccessChain 20 28 - 937: 8(ivec2) Load 936 - 938: 7(int) CompositeExtract 937 0 - 939: 7(int) GroupUMaxNonUniformAMD 25 ExclusiveScan 938 - 940: 7(int) CompositeExtract 937 1 - 941: 7(int) GroupUMaxNonUniformAMD 25 ExclusiveScan 940 - 942: 8(ivec2) CompositeConstruct 939 941 - 943: 29(ptr) AccessChain 20 28 - Store 943 942 - 944: 39(ptr) AccessChain 20 38 - 945: 10(fvec3) Load 944 - 946: 9(float) CompositeExtract 945 0 - 947: 9(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 946 - 948: 9(float) CompositeExtract 945 1 - 949: 9(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 948 - 950: 9(float) CompositeExtract 945 2 - 951: 9(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 950 - 952: 10(fvec3) CompositeConstruct 947 949 951 - 953: 39(ptr) AccessChain 20 38 - Store 953 952 - 954: 51(ptr) AccessChain 20 50 - 955: 12(fvec4) Load 954 - 956: 11(float) CompositeExtract 955 0 - 957: 11(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 956 - 958: 11(float) CompositeExtract 955 1 - 959: 11(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 958 - 960: 11(float) CompositeExtract 955 2 - 961: 11(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 960 - 962: 11(float) CompositeExtract 955 3 - 963: 11(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 962 - 964: 12(fvec4) CompositeConstruct 957 959 961 963 - 965: 51(ptr) AccessChain 20 50 - Store 965 964 - 966: 65(ptr) AccessChain 20 64 - 967: 13(int) Load 966 - 968: 13(int) GroupSMaxNonUniformAMD 25 ExclusiveScan 967 - 969: 65(ptr) AccessChain 20 64 - Store 969 968 - 970: 71(ptr) AccessChain 20 70 - 971: 15(ivec2) Load 970 - 972: 14(int) CompositeExtract 971 0 - 973: 14(int) GroupUMaxNonUniformAMD 25 ExclusiveScan 972 - 974: 14(int) CompositeExtract 971 1 - 975: 14(int) GroupUMaxNonUniformAMD 25 ExclusiveScan 974 - 976: 15(ivec2) CompositeConstruct 973 975 - 977: 71(ptr) AccessChain 20 70 - Store 977 976 - 978: 81(ptr) AccessChain 20 80 - 979: 17(fvec3) Load 978 - 980: 16(float) CompositeExtract 979 0 - 981: 16(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 980 - 982: 16(float) CompositeExtract 979 1 - 983: 16(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 982 - 984: 16(float) CompositeExtract 979 2 - 985: 16(float) GroupFMaxNonUniformAMD 25 ExclusiveScan 984 - 986: 17(fvec3) CompositeConstruct 981 983 985 - 987: 81(ptr) AccessChain 20 80 - Store 987 986 - 988: 22(ptr) AccessChain 20 21 - 989: 6(int) Load 988 - 990: 6(int) GroupIAddNonUniformAMD 25 ExclusiveScan 989 - 991: 22(ptr) AccessChain 20 21 - Store 991 990 - 992: 29(ptr) AccessChain 20 28 - 993: 8(ivec2) Load 992 - 994: 7(int) CompositeExtract 993 0 - 995: 7(int) GroupIAddNonUniformAMD 25 ExclusiveScan 994 - 996: 7(int) CompositeExtract 993 1 - 997: 7(int) GroupIAddNonUniformAMD 25 ExclusiveScan 996 - 998: 8(ivec2) CompositeConstruct 995 997 - 999: 29(ptr) AccessChain 20 28 - Store 999 998 - 1000: 39(ptr) AccessChain 20 38 - 1001: 10(fvec3) Load 1000 - 1002: 9(float) CompositeExtract 1001 0 - 1003: 9(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1002 - 1004: 9(float) CompositeExtract 1001 1 - 1005: 9(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1004 - 1006: 9(float) CompositeExtract 1001 2 - 1007: 9(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1006 - 1008: 10(fvec3) CompositeConstruct 1003 1005 1007 - 1009: 39(ptr) AccessChain 20 38 - Store 1009 1008 - 1010: 51(ptr) AccessChain 20 50 - 1011: 12(fvec4) Load 1010 - 1012: 11(float) CompositeExtract 1011 0 - 1013: 11(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1012 - 1014: 11(float) CompositeExtract 1011 1 - 1015: 11(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1014 - 1016: 11(float) CompositeExtract 1011 2 - 1017: 11(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1016 - 1018: 11(float) CompositeExtract 1011 3 - 1019: 11(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1018 - 1020: 12(fvec4) CompositeConstruct 1013 1015 1017 1019 - 1021: 51(ptr) AccessChain 20 50 - Store 1021 1020 - 1022: 65(ptr) AccessChain 20 64 - 1023: 13(int) Load 1022 - 1024: 13(int) GroupIAddNonUniformAMD 25 ExclusiveScan 1023 - 1025: 65(ptr) AccessChain 20 64 - Store 1025 1024 - 1026: 71(ptr) AccessChain 20 70 - 1027: 15(ivec2) Load 1026 - 1028: 14(int) CompositeExtract 1027 0 - 1029: 14(int) GroupIAddNonUniformAMD 25 ExclusiveScan 1028 - 1030: 14(int) CompositeExtract 1027 1 - 1031: 14(int) GroupIAddNonUniformAMD 25 ExclusiveScan 1030 - 1032: 15(ivec2) CompositeConstruct 1029 1031 - 1033: 71(ptr) AccessChain 20 70 - Store 1033 1032 - 1034: 81(ptr) AccessChain 20 80 - 1035: 17(fvec3) Load 1034 - 1036: 16(float) CompositeExtract 1035 0 - 1037: 16(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1036 - 1038: 16(float) CompositeExtract 1035 1 - 1039: 16(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1038 - 1040: 16(float) CompositeExtract 1035 2 - 1041: 16(float) GroupFAddNonUniformAMD 25 ExclusiveScan 1040 - 1042: 17(fvec3) CompositeConstruct 1037 1039 1041 - 1043: 81(ptr) AccessChain 20 80 - Store 1043 1042 + 26: 25(ptr) AccessChain 23 24 + 27: 6(int) Load 26 + 29: 6(int) GroupSMin 28 Reduce 27 + 30: 25(ptr) AccessChain 23 24 + Store 30 29 + 33: 32(ptr) AccessChain 23 31 + 34: 8(ivec2) Load 33 + 35: 7(int) CompositeExtract 34 0 + 36: 7(int) GroupUMin 28 Reduce 35 + 37: 7(int) CompositeExtract 34 1 + 38: 7(int) GroupUMin 28 Reduce 37 + 39: 8(ivec2) CompositeConstruct 36 38 + 40: 32(ptr) AccessChain 23 31 + Store 40 39 + 43: 42(ptr) AccessChain 23 41 + 44: 10(fvec3) Load 43 + 45: 9(float) CompositeExtract 44 0 + 46: 9(float) GroupFMin 28 Reduce 45 + 47: 9(float) CompositeExtract 44 1 + 48: 9(float) GroupFMin 28 Reduce 47 + 49: 9(float) CompositeExtract 44 2 + 50: 9(float) GroupFMin 28 Reduce 49 + 51: 10(fvec3) CompositeConstruct 46 48 50 + 52: 42(ptr) AccessChain 23 41 + Store 52 51 + 55: 54(ptr) AccessChain 23 53 + 56: 12(f64vec4) Load 55 + 57:11(float64_t) CompositeExtract 56 0 + 58:11(float64_t) GroupFMin 28 Reduce 57 + 59:11(float64_t) CompositeExtract 56 1 + 60:11(float64_t) GroupFMin 28 Reduce 59 + 61:11(float64_t) CompositeExtract 56 2 + 62:11(float64_t) GroupFMin 28 Reduce 61 + 63:11(float64_t) CompositeExtract 56 3 + 64:11(float64_t) GroupFMin 28 Reduce 63 + 65: 12(f64vec4) CompositeConstruct 58 60 62 64 + 66: 54(ptr) AccessChain 23 53 + Store 66 65 + 69: 68(ptr) AccessChain 23 67 + 70: 13(int64_t) Load 69 + 71: 13(int64_t) GroupSMin 28 Reduce 70 + 72: 68(ptr) AccessChain 23 67 + Store 72 71 + 75: 74(ptr) AccessChain 23 73 + 76: 15(i64vec2) Load 75 + 77: 14(int64_t) CompositeExtract 76 0 + 78: 14(int64_t) GroupUMin 28 Reduce 77 + 79: 14(int64_t) CompositeExtract 76 1 + 80: 14(int64_t) GroupUMin 28 Reduce 79 + 81: 15(i64vec2) CompositeConstruct 78 80 + 82: 74(ptr) AccessChain 23 73 + Store 82 81 + 85: 84(ptr) AccessChain 23 83 + 86: 17(f16vec3) Load 85 + 87:16(float16_t) CompositeExtract 86 0 + 88:16(float16_t) GroupFMin 28 Reduce 87 + 89:16(float16_t) CompositeExtract 86 1 + 90:16(float16_t) GroupFMin 28 Reduce 89 + 91:16(float16_t) CompositeExtract 86 2 + 92:16(float16_t) GroupFMin 28 Reduce 91 + 93: 17(f16vec3) CompositeConstruct 88 90 92 + 94: 84(ptr) AccessChain 23 83 + Store 94 93 + 97: 96(ptr) AccessChain 23 95 + 98: 19(i16vec4) Load 97 + 99: 18(int16_t) CompositeExtract 98 0 + 100: 18(int16_t) GroupSMin 28 Reduce 99 + 101: 18(int16_t) CompositeExtract 98 1 + 102: 18(int16_t) GroupSMin 28 Reduce 101 + 103: 18(int16_t) CompositeExtract 98 2 + 104: 18(int16_t) GroupSMin 28 Reduce 103 + 105: 18(int16_t) CompositeExtract 98 3 + 106: 18(int16_t) GroupSMin 28 Reduce 105 + 107: 19(i16vec4) CompositeConstruct 100 102 104 106 + 108: 96(ptr) AccessChain 23 95 + Store 108 107 + 111: 110(ptr) AccessChain 23 109 + 112: 20(int16_t) Load 111 + 113: 20(int16_t) GroupUMin 28 Reduce 112 + 114: 110(ptr) AccessChain 23 109 + Store 114 113 + 115: 25(ptr) AccessChain 23 24 + 116: 6(int) Load 115 + 117: 6(int) GroupSMax 28 Reduce 116 + 118: 25(ptr) AccessChain 23 24 + Store 118 117 + 119: 32(ptr) AccessChain 23 31 + 120: 8(ivec2) Load 119 + 121: 7(int) CompositeExtract 120 0 + 122: 7(int) GroupUMax 28 Reduce 121 + 123: 7(int) CompositeExtract 120 1 + 124: 7(int) GroupUMax 28 Reduce 123 + 125: 8(ivec2) CompositeConstruct 122 124 + 126: 32(ptr) AccessChain 23 31 + Store 126 125 + 127: 42(ptr) AccessChain 23 41 + 128: 10(fvec3) Load 127 + 129: 9(float) CompositeExtract 128 0 + 130: 9(float) GroupFMax 28 Reduce 129 + 131: 9(float) CompositeExtract 128 1 + 132: 9(float) GroupFMax 28 Reduce 131 + 133: 9(float) CompositeExtract 128 2 + 134: 9(float) GroupFMax 28 Reduce 133 + 135: 10(fvec3) CompositeConstruct 130 132 134 + 136: 42(ptr) AccessChain 23 41 + Store 136 135 + 137: 54(ptr) AccessChain 23 53 + 138: 12(f64vec4) Load 137 + 139:11(float64_t) CompositeExtract 138 0 + 140:11(float64_t) GroupFMax 28 Reduce 139 + 141:11(float64_t) CompositeExtract 138 1 + 142:11(float64_t) GroupFMax 28 Reduce 141 + 143:11(float64_t) CompositeExtract 138 2 + 144:11(float64_t) GroupFMax 28 Reduce 143 + 145:11(float64_t) CompositeExtract 138 3 + 146:11(float64_t) GroupFMax 28 Reduce 145 + 147: 12(f64vec4) CompositeConstruct 140 142 144 146 + 148: 54(ptr) AccessChain 23 53 + Store 148 147 + 149: 68(ptr) AccessChain 23 67 + 150: 13(int64_t) Load 149 + 151: 13(int64_t) GroupSMax 28 Reduce 150 + 152: 68(ptr) AccessChain 23 67 + Store 152 151 + 153: 74(ptr) AccessChain 23 73 + 154: 15(i64vec2) Load 153 + 155: 14(int64_t) CompositeExtract 154 0 + 156: 14(int64_t) GroupUMax 28 Reduce 155 + 157: 14(int64_t) CompositeExtract 154 1 + 158: 14(int64_t) GroupUMax 28 Reduce 157 + 159: 15(i64vec2) CompositeConstruct 156 158 + 160: 74(ptr) AccessChain 23 73 + Store 160 159 + 161: 84(ptr) AccessChain 23 83 + 162: 17(f16vec3) Load 161 + 163:16(float16_t) CompositeExtract 162 0 + 164:16(float16_t) GroupFMax 28 Reduce 163 + 165:16(float16_t) CompositeExtract 162 1 + 166:16(float16_t) GroupFMax 28 Reduce 165 + 167:16(float16_t) CompositeExtract 162 2 + 168:16(float16_t) GroupFMax 28 Reduce 167 + 169: 17(f16vec3) CompositeConstruct 164 166 168 + 170: 84(ptr) AccessChain 23 83 + Store 170 169 + 171: 96(ptr) AccessChain 23 95 + 172: 19(i16vec4) Load 171 + 173: 18(int16_t) CompositeExtract 172 0 + 174: 18(int16_t) GroupSMax 28 Reduce 173 + 175: 18(int16_t) CompositeExtract 172 1 + 176: 18(int16_t) GroupSMax 28 Reduce 175 + 177: 18(int16_t) CompositeExtract 172 2 + 178: 18(int16_t) GroupSMax 28 Reduce 177 + 179: 18(int16_t) CompositeExtract 172 3 + 180: 18(int16_t) GroupSMax 28 Reduce 179 + 181: 19(i16vec4) CompositeConstruct 174 176 178 180 + 182: 96(ptr) AccessChain 23 95 + Store 182 181 + 183: 110(ptr) AccessChain 23 109 + 184: 20(int16_t) Load 183 + 185: 20(int16_t) GroupUMax 28 Reduce 184 + 186: 110(ptr) AccessChain 23 109 + Store 186 185 + 187: 25(ptr) AccessChain 23 24 + 188: 6(int) Load 187 + 189: 6(int) GroupIAdd 28 Reduce 188 + 190: 25(ptr) AccessChain 23 24 + Store 190 189 + 191: 32(ptr) AccessChain 23 31 + 192: 8(ivec2) Load 191 + 193: 7(int) CompositeExtract 192 0 + 194: 7(int) GroupIAdd 28 Reduce 193 + 195: 7(int) CompositeExtract 192 1 + 196: 7(int) GroupIAdd 28 Reduce 195 + 197: 8(ivec2) CompositeConstruct 194 196 + 198: 32(ptr) AccessChain 23 31 + Store 198 197 + 199: 42(ptr) AccessChain 23 41 + 200: 10(fvec3) Load 199 + 201: 9(float) CompositeExtract 200 0 + 202: 9(float) GroupFAdd 28 Reduce 201 + 203: 9(float) CompositeExtract 200 1 + 204: 9(float) GroupFAdd 28 Reduce 203 + 205: 9(float) CompositeExtract 200 2 + 206: 9(float) GroupFAdd 28 Reduce 205 + 207: 10(fvec3) CompositeConstruct 202 204 206 + 208: 42(ptr) AccessChain 23 41 + Store 208 207 + 209: 54(ptr) AccessChain 23 53 + 210: 12(f64vec4) Load 209 + 211:11(float64_t) CompositeExtract 210 0 + 212:11(float64_t) GroupFAdd 28 Reduce 211 + 213:11(float64_t) CompositeExtract 210 1 + 214:11(float64_t) GroupFAdd 28 Reduce 213 + 215:11(float64_t) CompositeExtract 210 2 + 216:11(float64_t) GroupFAdd 28 Reduce 215 + 217:11(float64_t) CompositeExtract 210 3 + 218:11(float64_t) GroupFAdd 28 Reduce 217 + 219: 12(f64vec4) CompositeConstruct 212 214 216 218 + 220: 54(ptr) AccessChain 23 53 + Store 220 219 + 221: 68(ptr) AccessChain 23 67 + 222: 13(int64_t) Load 221 + 223: 13(int64_t) GroupIAdd 28 Reduce 222 + 224: 68(ptr) AccessChain 23 67 + Store 224 223 + 225: 74(ptr) AccessChain 23 73 + 226: 15(i64vec2) Load 225 + 227: 14(int64_t) CompositeExtract 226 0 + 228: 14(int64_t) GroupIAdd 28 Reduce 227 + 229: 14(int64_t) CompositeExtract 226 1 + 230: 14(int64_t) GroupIAdd 28 Reduce 229 + 231: 15(i64vec2) CompositeConstruct 228 230 + 232: 74(ptr) AccessChain 23 73 + Store 232 231 + 233: 84(ptr) AccessChain 23 83 + 234: 17(f16vec3) Load 233 + 235:16(float16_t) CompositeExtract 234 0 + 236:16(float16_t) GroupFAdd 28 Reduce 235 + 237:16(float16_t) CompositeExtract 234 1 + 238:16(float16_t) GroupFAdd 28 Reduce 237 + 239:16(float16_t) CompositeExtract 234 2 + 240:16(float16_t) GroupFAdd 28 Reduce 239 + 241: 17(f16vec3) CompositeConstruct 236 238 240 + 242: 84(ptr) AccessChain 23 83 + Store 242 241 + 243: 96(ptr) AccessChain 23 95 + 244: 19(i16vec4) Load 243 + 245: 18(int16_t) CompositeExtract 244 0 + 246: 18(int16_t) GroupIAdd 28 Reduce 245 + 247: 18(int16_t) CompositeExtract 244 1 + 248: 18(int16_t) GroupIAdd 28 Reduce 247 + 249: 18(int16_t) CompositeExtract 244 2 + 250: 18(int16_t) GroupIAdd 28 Reduce 249 + 251: 18(int16_t) CompositeExtract 244 3 + 252: 18(int16_t) GroupIAdd 28 Reduce 251 + 253: 19(i16vec4) CompositeConstruct 246 248 250 252 + 254: 96(ptr) AccessChain 23 95 + Store 254 253 + 255: 110(ptr) AccessChain 23 109 + 256: 20(int16_t) Load 255 + 257: 20(int16_t) GroupIAdd 28 Reduce 256 + 258: 110(ptr) AccessChain 23 109 + Store 258 257 + 259: 25(ptr) AccessChain 23 24 + 260: 6(int) Load 259 + 261: 6(int) GroupSMinNonUniformAMD 28 Reduce 260 + 262: 25(ptr) AccessChain 23 24 + Store 262 261 + 263: 32(ptr) AccessChain 23 31 + 264: 8(ivec2) Load 263 + 265: 7(int) CompositeExtract 264 0 + 266: 7(int) GroupUMinNonUniformAMD 28 Reduce 265 + 267: 7(int) CompositeExtract 264 1 + 268: 7(int) GroupUMinNonUniformAMD 28 Reduce 267 + 269: 8(ivec2) CompositeConstruct 266 268 + 270: 32(ptr) AccessChain 23 31 + Store 270 269 + 271: 42(ptr) AccessChain 23 41 + 272: 10(fvec3) Load 271 + 273: 9(float) CompositeExtract 272 0 + 274: 9(float) GroupFMinNonUniformAMD 28 Reduce 273 + 275: 9(float) CompositeExtract 272 1 + 276: 9(float) GroupFMinNonUniformAMD 28 Reduce 275 + 277: 9(float) CompositeExtract 272 2 + 278: 9(float) GroupFMinNonUniformAMD 28 Reduce 277 + 279: 10(fvec3) CompositeConstruct 274 276 278 + 280: 42(ptr) AccessChain 23 41 + Store 280 279 + 281: 54(ptr) AccessChain 23 53 + 282: 12(f64vec4) Load 281 + 283:11(float64_t) CompositeExtract 282 0 + 284:11(float64_t) GroupFMinNonUniformAMD 28 Reduce 283 + 285:11(float64_t) CompositeExtract 282 1 + 286:11(float64_t) GroupFMinNonUniformAMD 28 Reduce 285 + 287:11(float64_t) CompositeExtract 282 2 + 288:11(float64_t) GroupFMinNonUniformAMD 28 Reduce 287 + 289:11(float64_t) CompositeExtract 282 3 + 290:11(float64_t) GroupFMinNonUniformAMD 28 Reduce 289 + 291: 12(f64vec4) CompositeConstruct 284 286 288 290 + 292: 54(ptr) AccessChain 23 53 + Store 292 291 + 293: 68(ptr) AccessChain 23 67 + 294: 13(int64_t) Load 293 + 295: 13(int64_t) GroupSMinNonUniformAMD 28 Reduce 294 + 296: 68(ptr) AccessChain 23 67 + Store 296 295 + 297: 74(ptr) AccessChain 23 73 + 298: 15(i64vec2) Load 297 + 299: 14(int64_t) CompositeExtract 298 0 + 300: 14(int64_t) GroupUMinNonUniformAMD 28 Reduce 299 + 301: 14(int64_t) CompositeExtract 298 1 + 302: 14(int64_t) GroupUMinNonUniformAMD 28 Reduce 301 + 303: 15(i64vec2) CompositeConstruct 300 302 + 304: 74(ptr) AccessChain 23 73 + Store 304 303 + 305: 84(ptr) AccessChain 23 83 + 306: 17(f16vec3) Load 305 + 307:16(float16_t) CompositeExtract 306 0 + 308:16(float16_t) GroupFMinNonUniformAMD 28 Reduce 307 + 309:16(float16_t) CompositeExtract 306 1 + 310:16(float16_t) GroupFMinNonUniformAMD 28 Reduce 309 + 311:16(float16_t) CompositeExtract 306 2 + 312:16(float16_t) GroupFMinNonUniformAMD 28 Reduce 311 + 313: 17(f16vec3) CompositeConstruct 308 310 312 + 314: 84(ptr) AccessChain 23 83 + Store 314 313 + 315: 96(ptr) AccessChain 23 95 + 316: 19(i16vec4) Load 315 + 317: 18(int16_t) CompositeExtract 316 0 + 318: 18(int16_t) GroupSMinNonUniformAMD 28 Reduce 317 + 319: 18(int16_t) CompositeExtract 316 1 + 320: 18(int16_t) GroupSMinNonUniformAMD 28 Reduce 319 + 321: 18(int16_t) CompositeExtract 316 2 + 322: 18(int16_t) GroupSMinNonUniformAMD 28 Reduce 321 + 323: 18(int16_t) CompositeExtract 316 3 + 324: 18(int16_t) GroupSMinNonUniformAMD 28 Reduce 323 + 325: 19(i16vec4) CompositeConstruct 318 320 322 324 + 326: 96(ptr) AccessChain 23 95 + Store 326 325 + 327: 110(ptr) AccessChain 23 109 + 328: 20(int16_t) Load 327 + 329: 20(int16_t) GroupUMinNonUniformAMD 28 Reduce 328 + 330: 110(ptr) AccessChain 23 109 + Store 330 329 + 331: 25(ptr) AccessChain 23 24 + 332: 6(int) Load 331 + 333: 6(int) GroupSMaxNonUniformAMD 28 Reduce 332 + 334: 25(ptr) AccessChain 23 24 + Store 334 333 + 335: 32(ptr) AccessChain 23 31 + 336: 8(ivec2) Load 335 + 337: 7(int) CompositeExtract 336 0 + 338: 7(int) GroupUMaxNonUniformAMD 28 Reduce 337 + 339: 7(int) CompositeExtract 336 1 + 340: 7(int) GroupUMaxNonUniformAMD 28 Reduce 339 + 341: 8(ivec2) CompositeConstruct 338 340 + 342: 32(ptr) AccessChain 23 31 + Store 342 341 + 343: 42(ptr) AccessChain 23 41 + 344: 10(fvec3) Load 343 + 345: 9(float) CompositeExtract 344 0 + 346: 9(float) GroupFMaxNonUniformAMD 28 Reduce 345 + 347: 9(float) CompositeExtract 344 1 + 348: 9(float) GroupFMaxNonUniformAMD 28 Reduce 347 + 349: 9(float) CompositeExtract 344 2 + 350: 9(float) GroupFMaxNonUniformAMD 28 Reduce 349 + 351: 10(fvec3) CompositeConstruct 346 348 350 + 352: 42(ptr) AccessChain 23 41 + Store 352 351 + 353: 54(ptr) AccessChain 23 53 + 354: 12(f64vec4) Load 353 + 355:11(float64_t) CompositeExtract 354 0 + 356:11(float64_t) GroupFMaxNonUniformAMD 28 Reduce 355 + 357:11(float64_t) CompositeExtract 354 1 + 358:11(float64_t) GroupFMaxNonUniformAMD 28 Reduce 357 + 359:11(float64_t) CompositeExtract 354 2 + 360:11(float64_t) GroupFMaxNonUniformAMD 28 Reduce 359 + 361:11(float64_t) CompositeExtract 354 3 + 362:11(float64_t) GroupFMaxNonUniformAMD 28 Reduce 361 + 363: 12(f64vec4) CompositeConstruct 356 358 360 362 + 364: 54(ptr) AccessChain 23 53 + Store 364 363 + 365: 68(ptr) AccessChain 23 67 + 366: 13(int64_t) Load 365 + 367: 13(int64_t) GroupSMaxNonUniformAMD 28 Reduce 366 + 368: 68(ptr) AccessChain 23 67 + Store 368 367 + 369: 74(ptr) AccessChain 23 73 + 370: 15(i64vec2) Load 369 + 371: 14(int64_t) CompositeExtract 370 0 + 372: 14(int64_t) GroupUMaxNonUniformAMD 28 Reduce 371 + 373: 14(int64_t) CompositeExtract 370 1 + 374: 14(int64_t) GroupUMaxNonUniformAMD 28 Reduce 373 + 375: 15(i64vec2) CompositeConstruct 372 374 + 376: 74(ptr) AccessChain 23 73 + Store 376 375 + 377: 84(ptr) AccessChain 23 83 + 378: 17(f16vec3) Load 377 + 379:16(float16_t) CompositeExtract 378 0 + 380:16(float16_t) GroupFMaxNonUniformAMD 28 Reduce 379 + 381:16(float16_t) CompositeExtract 378 1 + 382:16(float16_t) GroupFMaxNonUniformAMD 28 Reduce 381 + 383:16(float16_t) CompositeExtract 378 2 + 384:16(float16_t) GroupFMaxNonUniformAMD 28 Reduce 383 + 385: 17(f16vec3) CompositeConstruct 380 382 384 + 386: 84(ptr) AccessChain 23 83 + Store 386 385 + 387: 96(ptr) AccessChain 23 95 + 388: 19(i16vec4) Load 387 + 389: 18(int16_t) CompositeExtract 388 0 + 390: 18(int16_t) GroupSMaxNonUniformAMD 28 Reduce 389 + 391: 18(int16_t) CompositeExtract 388 1 + 392: 18(int16_t) GroupSMaxNonUniformAMD 28 Reduce 391 + 393: 18(int16_t) CompositeExtract 388 2 + 394: 18(int16_t) GroupSMaxNonUniformAMD 28 Reduce 393 + 395: 18(int16_t) CompositeExtract 388 3 + 396: 18(int16_t) GroupSMaxNonUniformAMD 28 Reduce 395 + 397: 19(i16vec4) CompositeConstruct 390 392 394 396 + 398: 96(ptr) AccessChain 23 95 + Store 398 397 + 399: 110(ptr) AccessChain 23 109 + 400: 20(int16_t) Load 399 + 401: 20(int16_t) GroupUMaxNonUniformAMD 28 Reduce 400 + 402: 110(ptr) AccessChain 23 109 + Store 402 401 + 403: 25(ptr) AccessChain 23 24 + 404: 6(int) Load 403 + 405: 6(int) GroupIAddNonUniformAMD 28 Reduce 404 + 406: 25(ptr) AccessChain 23 24 + Store 406 405 + 407: 32(ptr) AccessChain 23 31 + 408: 8(ivec2) Load 407 + 409: 7(int) CompositeExtract 408 0 + 410: 7(int) GroupIAddNonUniformAMD 28 Reduce 409 + 411: 7(int) CompositeExtract 408 1 + 412: 7(int) GroupIAddNonUniformAMD 28 Reduce 411 + 413: 8(ivec2) CompositeConstruct 410 412 + 414: 32(ptr) AccessChain 23 31 + Store 414 413 + 415: 42(ptr) AccessChain 23 41 + 416: 10(fvec3) Load 415 + 417: 9(float) CompositeExtract 416 0 + 418: 9(float) GroupFAddNonUniformAMD 28 Reduce 417 + 419: 9(float) CompositeExtract 416 1 + 420: 9(float) GroupFAddNonUniformAMD 28 Reduce 419 + 421: 9(float) CompositeExtract 416 2 + 422: 9(float) GroupFAddNonUniformAMD 28 Reduce 421 + 423: 10(fvec3) CompositeConstruct 418 420 422 + 424: 42(ptr) AccessChain 23 41 + Store 424 423 + 425: 54(ptr) AccessChain 23 53 + 426: 12(f64vec4) Load 425 + 427:11(float64_t) CompositeExtract 426 0 + 428:11(float64_t) GroupFAddNonUniformAMD 28 Reduce 427 + 429:11(float64_t) CompositeExtract 426 1 + 430:11(float64_t) GroupFAddNonUniformAMD 28 Reduce 429 + 431:11(float64_t) CompositeExtract 426 2 + 432:11(float64_t) GroupFAddNonUniformAMD 28 Reduce 431 + 433:11(float64_t) CompositeExtract 426 3 + 434:11(float64_t) GroupFAddNonUniformAMD 28 Reduce 433 + 435: 12(f64vec4) CompositeConstruct 428 430 432 434 + 436: 54(ptr) AccessChain 23 53 + Store 436 435 + 437: 68(ptr) AccessChain 23 67 + 438: 13(int64_t) Load 437 + 439: 13(int64_t) GroupIAddNonUniformAMD 28 Reduce 438 + 440: 68(ptr) AccessChain 23 67 + Store 440 439 + 441: 74(ptr) AccessChain 23 73 + 442: 15(i64vec2) Load 441 + 443: 14(int64_t) CompositeExtract 442 0 + 444: 14(int64_t) GroupIAddNonUniformAMD 28 Reduce 443 + 445: 14(int64_t) CompositeExtract 442 1 + 446: 14(int64_t) GroupIAddNonUniformAMD 28 Reduce 445 + 447: 15(i64vec2) CompositeConstruct 444 446 + 448: 74(ptr) AccessChain 23 73 + Store 448 447 + 449: 84(ptr) AccessChain 23 83 + 450: 17(f16vec3) Load 449 + 451:16(float16_t) CompositeExtract 450 0 + 452:16(float16_t) GroupFAddNonUniformAMD 28 Reduce 451 + 453:16(float16_t) CompositeExtract 450 1 + 454:16(float16_t) GroupFAddNonUniformAMD 28 Reduce 453 + 455:16(float16_t) CompositeExtract 450 2 + 456:16(float16_t) GroupFAddNonUniformAMD 28 Reduce 455 + 457: 17(f16vec3) CompositeConstruct 452 454 456 + 458: 84(ptr) AccessChain 23 83 + Store 458 457 + 459: 96(ptr) AccessChain 23 95 + 460: 19(i16vec4) Load 459 + 461: 18(int16_t) CompositeExtract 460 0 + 462: 18(int16_t) GroupIAddNonUniformAMD 28 Reduce 461 + 463: 18(int16_t) CompositeExtract 460 1 + 464: 18(int16_t) GroupIAddNonUniformAMD 28 Reduce 463 + 465: 18(int16_t) CompositeExtract 460 2 + 466: 18(int16_t) GroupIAddNonUniformAMD 28 Reduce 465 + 467: 18(int16_t) CompositeExtract 460 3 + 468: 18(int16_t) GroupIAddNonUniformAMD 28 Reduce 467 + 469: 19(i16vec4) CompositeConstruct 462 464 466 468 + 470: 96(ptr) AccessChain 23 95 + Store 470 469 + 471: 110(ptr) AccessChain 23 109 + 472: 20(int16_t) Load 471 + 473: 20(int16_t) GroupIAddNonUniformAMD 28 Reduce 472 + 474: 110(ptr) AccessChain 23 109 + Store 474 473 + 475: 25(ptr) AccessChain 23 24 + 476: 6(int) Load 475 + 477: 6(int) GroupSMin 28 InclusiveScan 476 + 478: 25(ptr) AccessChain 23 24 + Store 478 477 + 479: 32(ptr) AccessChain 23 31 + 480: 8(ivec2) Load 479 + 481: 7(int) CompositeExtract 480 0 + 482: 7(int) GroupUMin 28 InclusiveScan 481 + 483: 7(int) CompositeExtract 480 1 + 484: 7(int) GroupUMin 28 InclusiveScan 483 + 485: 8(ivec2) CompositeConstruct 482 484 + 486: 32(ptr) AccessChain 23 31 + Store 486 485 + 487: 42(ptr) AccessChain 23 41 + 488: 10(fvec3) Load 487 + 489: 9(float) CompositeExtract 488 0 + 490: 9(float) GroupFMin 28 InclusiveScan 489 + 491: 9(float) CompositeExtract 488 1 + 492: 9(float) GroupFMin 28 InclusiveScan 491 + 493: 9(float) CompositeExtract 488 2 + 494: 9(float) GroupFMin 28 InclusiveScan 493 + 495: 10(fvec3) CompositeConstruct 490 492 494 + 496: 42(ptr) AccessChain 23 41 + Store 496 495 + 497: 54(ptr) AccessChain 23 53 + 498: 12(f64vec4) Load 497 + 499:11(float64_t) CompositeExtract 498 0 + 500:11(float64_t) GroupFMin 28 InclusiveScan 499 + 501:11(float64_t) CompositeExtract 498 1 + 502:11(float64_t) GroupFMin 28 InclusiveScan 501 + 503:11(float64_t) CompositeExtract 498 2 + 504:11(float64_t) GroupFMin 28 InclusiveScan 503 + 505:11(float64_t) CompositeExtract 498 3 + 506:11(float64_t) GroupFMin 28 InclusiveScan 505 + 507: 12(f64vec4) CompositeConstruct 500 502 504 506 + 508: 54(ptr) AccessChain 23 53 + Store 508 507 + 509: 68(ptr) AccessChain 23 67 + 510: 13(int64_t) Load 509 + 511: 13(int64_t) GroupSMin 28 InclusiveScan 510 + 512: 68(ptr) AccessChain 23 67 + Store 512 511 + 513: 74(ptr) AccessChain 23 73 + 514: 15(i64vec2) Load 513 + 515: 14(int64_t) CompositeExtract 514 0 + 516: 14(int64_t) GroupUMin 28 InclusiveScan 515 + 517: 14(int64_t) CompositeExtract 514 1 + 518: 14(int64_t) GroupUMin 28 InclusiveScan 517 + 519: 15(i64vec2) CompositeConstruct 516 518 + 520: 74(ptr) AccessChain 23 73 + Store 520 519 + 521: 84(ptr) AccessChain 23 83 + 522: 17(f16vec3) Load 521 + 523:16(float16_t) CompositeExtract 522 0 + 524:16(float16_t) GroupFMin 28 InclusiveScan 523 + 525:16(float16_t) CompositeExtract 522 1 + 526:16(float16_t) GroupFMin 28 InclusiveScan 525 + 527:16(float16_t) CompositeExtract 522 2 + 528:16(float16_t) GroupFMin 28 InclusiveScan 527 + 529: 17(f16vec3) CompositeConstruct 524 526 528 + 530: 84(ptr) AccessChain 23 83 + Store 530 529 + 531: 96(ptr) AccessChain 23 95 + 532: 19(i16vec4) Load 531 + 533: 18(int16_t) CompositeExtract 532 0 + 534: 18(int16_t) GroupSMin 28 InclusiveScan 533 + 535: 18(int16_t) CompositeExtract 532 1 + 536: 18(int16_t) GroupSMin 28 InclusiveScan 535 + 537: 18(int16_t) CompositeExtract 532 2 + 538: 18(int16_t) GroupSMin 28 InclusiveScan 537 + 539: 18(int16_t) CompositeExtract 532 3 + 540: 18(int16_t) GroupSMin 28 InclusiveScan 539 + 541: 19(i16vec4) CompositeConstruct 534 536 538 540 + 542: 96(ptr) AccessChain 23 95 + Store 542 541 + 543: 110(ptr) AccessChain 23 109 + 544: 20(int16_t) Load 543 + 545: 20(int16_t) GroupUMin 28 InclusiveScan 544 + 546: 110(ptr) AccessChain 23 109 + Store 546 545 + 547: 25(ptr) AccessChain 23 24 + 548: 6(int) Load 547 + 549: 6(int) GroupSMax 28 InclusiveScan 548 + 550: 25(ptr) AccessChain 23 24 + Store 550 549 + 551: 32(ptr) AccessChain 23 31 + 552: 8(ivec2) Load 551 + 553: 7(int) CompositeExtract 552 0 + 554: 7(int) GroupUMax 28 InclusiveScan 553 + 555: 7(int) CompositeExtract 552 1 + 556: 7(int) GroupUMax 28 InclusiveScan 555 + 557: 8(ivec2) CompositeConstruct 554 556 + 558: 32(ptr) AccessChain 23 31 + Store 558 557 + 559: 42(ptr) AccessChain 23 41 + 560: 10(fvec3) Load 559 + 561: 9(float) CompositeExtract 560 0 + 562: 9(float) GroupFMax 28 InclusiveScan 561 + 563: 9(float) CompositeExtract 560 1 + 564: 9(float) GroupFMax 28 InclusiveScan 563 + 565: 9(float) CompositeExtract 560 2 + 566: 9(float) GroupFMax 28 InclusiveScan 565 + 567: 10(fvec3) CompositeConstruct 562 564 566 + 568: 42(ptr) AccessChain 23 41 + Store 568 567 + 569: 54(ptr) AccessChain 23 53 + 570: 12(f64vec4) Load 569 + 571:11(float64_t) CompositeExtract 570 0 + 572:11(float64_t) GroupFMax 28 InclusiveScan 571 + 573:11(float64_t) CompositeExtract 570 1 + 574:11(float64_t) GroupFMax 28 InclusiveScan 573 + 575:11(float64_t) CompositeExtract 570 2 + 576:11(float64_t) GroupFMax 28 InclusiveScan 575 + 577:11(float64_t) CompositeExtract 570 3 + 578:11(float64_t) GroupFMax 28 InclusiveScan 577 + 579: 12(f64vec4) CompositeConstruct 572 574 576 578 + 580: 54(ptr) AccessChain 23 53 + Store 580 579 + 581: 68(ptr) AccessChain 23 67 + 582: 13(int64_t) Load 581 + 583: 13(int64_t) GroupSMax 28 InclusiveScan 582 + 584: 68(ptr) AccessChain 23 67 + Store 584 583 + 585: 74(ptr) AccessChain 23 73 + 586: 15(i64vec2) Load 585 + 587: 14(int64_t) CompositeExtract 586 0 + 588: 14(int64_t) GroupUMax 28 InclusiveScan 587 + 589: 14(int64_t) CompositeExtract 586 1 + 590: 14(int64_t) GroupUMax 28 InclusiveScan 589 + 591: 15(i64vec2) CompositeConstruct 588 590 + 592: 74(ptr) AccessChain 23 73 + Store 592 591 + 593: 84(ptr) AccessChain 23 83 + 594: 17(f16vec3) Load 593 + 595:16(float16_t) CompositeExtract 594 0 + 596:16(float16_t) GroupFMax 28 InclusiveScan 595 + 597:16(float16_t) CompositeExtract 594 1 + 598:16(float16_t) GroupFMax 28 InclusiveScan 597 + 599:16(float16_t) CompositeExtract 594 2 + 600:16(float16_t) GroupFMax 28 InclusiveScan 599 + 601: 17(f16vec3) CompositeConstruct 596 598 600 + 602: 84(ptr) AccessChain 23 83 + Store 602 601 + 603: 96(ptr) AccessChain 23 95 + 604: 19(i16vec4) Load 603 + 605: 18(int16_t) CompositeExtract 604 0 + 606: 18(int16_t) GroupSMax 28 InclusiveScan 605 + 607: 18(int16_t) CompositeExtract 604 1 + 608: 18(int16_t) GroupSMax 28 InclusiveScan 607 + 609: 18(int16_t) CompositeExtract 604 2 + 610: 18(int16_t) GroupSMax 28 InclusiveScan 609 + 611: 18(int16_t) CompositeExtract 604 3 + 612: 18(int16_t) GroupSMax 28 InclusiveScan 611 + 613: 19(i16vec4) CompositeConstruct 606 608 610 612 + 614: 96(ptr) AccessChain 23 95 + Store 614 613 + 615: 110(ptr) AccessChain 23 109 + 616: 20(int16_t) Load 615 + 617: 20(int16_t) GroupUMax 28 InclusiveScan 616 + 618: 110(ptr) AccessChain 23 109 + Store 618 617 + 619: 25(ptr) AccessChain 23 24 + 620: 6(int) Load 619 + 621: 6(int) GroupIAdd 28 InclusiveScan 620 + 622: 25(ptr) AccessChain 23 24 + Store 622 621 + 623: 32(ptr) AccessChain 23 31 + 624: 8(ivec2) Load 623 + 625: 7(int) CompositeExtract 624 0 + 626: 7(int) GroupIAdd 28 InclusiveScan 625 + 627: 7(int) CompositeExtract 624 1 + 628: 7(int) GroupIAdd 28 InclusiveScan 627 + 629: 8(ivec2) CompositeConstruct 626 628 + 630: 32(ptr) AccessChain 23 31 + Store 630 629 + 631: 42(ptr) AccessChain 23 41 + 632: 10(fvec3) Load 631 + 633: 9(float) CompositeExtract 632 0 + 634: 9(float) GroupFAdd 28 InclusiveScan 633 + 635: 9(float) CompositeExtract 632 1 + 636: 9(float) GroupFAdd 28 InclusiveScan 635 + 637: 9(float) CompositeExtract 632 2 + 638: 9(float) GroupFAdd 28 InclusiveScan 637 + 639: 10(fvec3) CompositeConstruct 634 636 638 + 640: 42(ptr) AccessChain 23 41 + Store 640 639 + 641: 54(ptr) AccessChain 23 53 + 642: 12(f64vec4) Load 641 + 643:11(float64_t) CompositeExtract 642 0 + 644:11(float64_t) GroupFAdd 28 InclusiveScan 643 + 645:11(float64_t) CompositeExtract 642 1 + 646:11(float64_t) GroupFAdd 28 InclusiveScan 645 + 647:11(float64_t) CompositeExtract 642 2 + 648:11(float64_t) GroupFAdd 28 InclusiveScan 647 + 649:11(float64_t) CompositeExtract 642 3 + 650:11(float64_t) GroupFAdd 28 InclusiveScan 649 + 651: 12(f64vec4) CompositeConstruct 644 646 648 650 + 652: 54(ptr) AccessChain 23 53 + Store 652 651 + 653: 68(ptr) AccessChain 23 67 + 654: 13(int64_t) Load 653 + 655: 13(int64_t) GroupIAdd 28 InclusiveScan 654 + 656: 68(ptr) AccessChain 23 67 + Store 656 655 + 657: 74(ptr) AccessChain 23 73 + 658: 15(i64vec2) Load 657 + 659: 14(int64_t) CompositeExtract 658 0 + 660: 14(int64_t) GroupIAdd 28 InclusiveScan 659 + 661: 14(int64_t) CompositeExtract 658 1 + 662: 14(int64_t) GroupIAdd 28 InclusiveScan 661 + 663: 15(i64vec2) CompositeConstruct 660 662 + 664: 74(ptr) AccessChain 23 73 + Store 664 663 + 665: 84(ptr) AccessChain 23 83 + 666: 17(f16vec3) Load 665 + 667:16(float16_t) CompositeExtract 666 0 + 668:16(float16_t) GroupFAdd 28 InclusiveScan 667 + 669:16(float16_t) CompositeExtract 666 1 + 670:16(float16_t) GroupFAdd 28 InclusiveScan 669 + 671:16(float16_t) CompositeExtract 666 2 + 672:16(float16_t) GroupFAdd 28 InclusiveScan 671 + 673: 17(f16vec3) CompositeConstruct 668 670 672 + 674: 84(ptr) AccessChain 23 83 + Store 674 673 + 675: 96(ptr) AccessChain 23 95 + 676: 19(i16vec4) Load 675 + 677: 18(int16_t) CompositeExtract 676 0 + 678: 18(int16_t) GroupIAdd 28 InclusiveScan 677 + 679: 18(int16_t) CompositeExtract 676 1 + 680: 18(int16_t) GroupIAdd 28 InclusiveScan 679 + 681: 18(int16_t) CompositeExtract 676 2 + 682: 18(int16_t) GroupIAdd 28 InclusiveScan 681 + 683: 18(int16_t) CompositeExtract 676 3 + 684: 18(int16_t) GroupIAdd 28 InclusiveScan 683 + 685: 19(i16vec4) CompositeConstruct 678 680 682 684 + 686: 96(ptr) AccessChain 23 95 + Store 686 685 + 687: 110(ptr) AccessChain 23 109 + 688: 20(int16_t) Load 687 + 689: 20(int16_t) GroupIAdd 28 InclusiveScan 688 + 690: 110(ptr) AccessChain 23 109 + Store 690 689 + 691: 25(ptr) AccessChain 23 24 + 692: 6(int) Load 691 + 693: 6(int) GroupSMin 28 ExclusiveScan 692 + 694: 25(ptr) AccessChain 23 24 + Store 694 693 + 695: 32(ptr) AccessChain 23 31 + 696: 8(ivec2) Load 695 + 697: 7(int) CompositeExtract 696 0 + 698: 7(int) GroupUMin 28 ExclusiveScan 697 + 699: 7(int) CompositeExtract 696 1 + 700: 7(int) GroupUMin 28 ExclusiveScan 699 + 701: 8(ivec2) CompositeConstruct 698 700 + 702: 32(ptr) AccessChain 23 31 + Store 702 701 + 703: 42(ptr) AccessChain 23 41 + 704: 10(fvec3) Load 703 + 705: 9(float) CompositeExtract 704 0 + 706: 9(float) GroupFMin 28 ExclusiveScan 705 + 707: 9(float) CompositeExtract 704 1 + 708: 9(float) GroupFMin 28 ExclusiveScan 707 + 709: 9(float) CompositeExtract 704 2 + 710: 9(float) GroupFMin 28 ExclusiveScan 709 + 711: 10(fvec3) CompositeConstruct 706 708 710 + 712: 42(ptr) AccessChain 23 41 + Store 712 711 + 713: 54(ptr) AccessChain 23 53 + 714: 12(f64vec4) Load 713 + 715:11(float64_t) CompositeExtract 714 0 + 716:11(float64_t) GroupFMin 28 ExclusiveScan 715 + 717:11(float64_t) CompositeExtract 714 1 + 718:11(float64_t) GroupFMin 28 ExclusiveScan 717 + 719:11(float64_t) CompositeExtract 714 2 + 720:11(float64_t) GroupFMin 28 ExclusiveScan 719 + 721:11(float64_t) CompositeExtract 714 3 + 722:11(float64_t) GroupFMin 28 ExclusiveScan 721 + 723: 12(f64vec4) CompositeConstruct 716 718 720 722 + 724: 54(ptr) AccessChain 23 53 + Store 724 723 + 725: 68(ptr) AccessChain 23 67 + 726: 13(int64_t) Load 725 + 727: 13(int64_t) GroupSMin 28 ExclusiveScan 726 + 728: 68(ptr) AccessChain 23 67 + Store 728 727 + 729: 74(ptr) AccessChain 23 73 + 730: 15(i64vec2) Load 729 + 731: 14(int64_t) CompositeExtract 730 0 + 732: 14(int64_t) GroupUMin 28 ExclusiveScan 731 + 733: 14(int64_t) CompositeExtract 730 1 + 734: 14(int64_t) GroupUMin 28 ExclusiveScan 733 + 735: 15(i64vec2) CompositeConstruct 732 734 + 736: 74(ptr) AccessChain 23 73 + Store 736 735 + 737: 84(ptr) AccessChain 23 83 + 738: 17(f16vec3) Load 737 + 739:16(float16_t) CompositeExtract 738 0 + 740:16(float16_t) GroupFMin 28 ExclusiveScan 739 + 741:16(float16_t) CompositeExtract 738 1 + 742:16(float16_t) GroupFMin 28 ExclusiveScan 741 + 743:16(float16_t) CompositeExtract 738 2 + 744:16(float16_t) GroupFMin 28 ExclusiveScan 743 + 745: 17(f16vec3) CompositeConstruct 740 742 744 + 746: 84(ptr) AccessChain 23 83 + Store 746 745 + 747: 96(ptr) AccessChain 23 95 + 748: 19(i16vec4) Load 747 + 749: 18(int16_t) CompositeExtract 748 0 + 750: 18(int16_t) GroupSMin 28 ExclusiveScan 749 + 751: 18(int16_t) CompositeExtract 748 1 + 752: 18(int16_t) GroupSMin 28 ExclusiveScan 751 + 753: 18(int16_t) CompositeExtract 748 2 + 754: 18(int16_t) GroupSMin 28 ExclusiveScan 753 + 755: 18(int16_t) CompositeExtract 748 3 + 756: 18(int16_t) GroupSMin 28 ExclusiveScan 755 + 757: 19(i16vec4) CompositeConstruct 750 752 754 756 + 758: 96(ptr) AccessChain 23 95 + Store 758 757 + 759: 110(ptr) AccessChain 23 109 + 760: 20(int16_t) Load 759 + 761: 20(int16_t) GroupUMin 28 ExclusiveScan 760 + 762: 110(ptr) AccessChain 23 109 + Store 762 761 + 763: 25(ptr) AccessChain 23 24 + 764: 6(int) Load 763 + 765: 6(int) GroupSMax 28 ExclusiveScan 764 + 766: 25(ptr) AccessChain 23 24 + Store 766 765 + 767: 32(ptr) AccessChain 23 31 + 768: 8(ivec2) Load 767 + 769: 7(int) CompositeExtract 768 0 + 770: 7(int) GroupUMax 28 ExclusiveScan 769 + 771: 7(int) CompositeExtract 768 1 + 772: 7(int) GroupUMax 28 ExclusiveScan 771 + 773: 8(ivec2) CompositeConstruct 770 772 + 774: 32(ptr) AccessChain 23 31 + Store 774 773 + 775: 42(ptr) AccessChain 23 41 + 776: 10(fvec3) Load 775 + 777: 9(float) CompositeExtract 776 0 + 778: 9(float) GroupFMax 28 ExclusiveScan 777 + 779: 9(float) CompositeExtract 776 1 + 780: 9(float) GroupFMax 28 ExclusiveScan 779 + 781: 9(float) CompositeExtract 776 2 + 782: 9(float) GroupFMax 28 ExclusiveScan 781 + 783: 10(fvec3) CompositeConstruct 778 780 782 + 784: 42(ptr) AccessChain 23 41 + Store 784 783 + 785: 54(ptr) AccessChain 23 53 + 786: 12(f64vec4) Load 785 + 787:11(float64_t) CompositeExtract 786 0 + 788:11(float64_t) GroupFMax 28 ExclusiveScan 787 + 789:11(float64_t) CompositeExtract 786 1 + 790:11(float64_t) GroupFMax 28 ExclusiveScan 789 + 791:11(float64_t) CompositeExtract 786 2 + 792:11(float64_t) GroupFMax 28 ExclusiveScan 791 + 793:11(float64_t) CompositeExtract 786 3 + 794:11(float64_t) GroupFMax 28 ExclusiveScan 793 + 795: 12(f64vec4) CompositeConstruct 788 790 792 794 + 796: 54(ptr) AccessChain 23 53 + Store 796 795 + 797: 68(ptr) AccessChain 23 67 + 798: 13(int64_t) Load 797 + 799: 13(int64_t) GroupSMax 28 ExclusiveScan 798 + 800: 68(ptr) AccessChain 23 67 + Store 800 799 + 801: 74(ptr) AccessChain 23 73 + 802: 15(i64vec2) Load 801 + 803: 14(int64_t) CompositeExtract 802 0 + 804: 14(int64_t) GroupUMax 28 ExclusiveScan 803 + 805: 14(int64_t) CompositeExtract 802 1 + 806: 14(int64_t) GroupUMax 28 ExclusiveScan 805 + 807: 15(i64vec2) CompositeConstruct 804 806 + 808: 74(ptr) AccessChain 23 73 + Store 808 807 + 809: 84(ptr) AccessChain 23 83 + 810: 17(f16vec3) Load 809 + 811:16(float16_t) CompositeExtract 810 0 + 812:16(float16_t) GroupFMax 28 ExclusiveScan 811 + 813:16(float16_t) CompositeExtract 810 1 + 814:16(float16_t) GroupFMax 28 ExclusiveScan 813 + 815:16(float16_t) CompositeExtract 810 2 + 816:16(float16_t) GroupFMax 28 ExclusiveScan 815 + 817: 17(f16vec3) CompositeConstruct 812 814 816 + 818: 84(ptr) AccessChain 23 83 + Store 818 817 + 819: 96(ptr) AccessChain 23 95 + 820: 19(i16vec4) Load 819 + 821: 18(int16_t) CompositeExtract 820 0 + 822: 18(int16_t) GroupSMax 28 ExclusiveScan 821 + 823: 18(int16_t) CompositeExtract 820 1 + 824: 18(int16_t) GroupSMax 28 ExclusiveScan 823 + 825: 18(int16_t) CompositeExtract 820 2 + 826: 18(int16_t) GroupSMax 28 ExclusiveScan 825 + 827: 18(int16_t) CompositeExtract 820 3 + 828: 18(int16_t) GroupSMax 28 ExclusiveScan 827 + 829: 19(i16vec4) CompositeConstruct 822 824 826 828 + 830: 96(ptr) AccessChain 23 95 + Store 830 829 + 831: 110(ptr) AccessChain 23 109 + 832: 20(int16_t) Load 831 + 833: 20(int16_t) GroupUMax 28 ExclusiveScan 832 + 834: 110(ptr) AccessChain 23 109 + Store 834 833 + 835: 25(ptr) AccessChain 23 24 + 836: 6(int) Load 835 + 837: 6(int) GroupIAdd 28 ExclusiveScan 836 + 838: 25(ptr) AccessChain 23 24 + Store 838 837 + 839: 32(ptr) AccessChain 23 31 + 840: 8(ivec2) Load 839 + 841: 7(int) CompositeExtract 840 0 + 842: 7(int) GroupIAdd 28 ExclusiveScan 841 + 843: 7(int) CompositeExtract 840 1 + 844: 7(int) GroupIAdd 28 ExclusiveScan 843 + 845: 8(ivec2) CompositeConstruct 842 844 + 846: 32(ptr) AccessChain 23 31 + Store 846 845 + 847: 42(ptr) AccessChain 23 41 + 848: 10(fvec3) Load 847 + 849: 9(float) CompositeExtract 848 0 + 850: 9(float) GroupFAdd 28 ExclusiveScan 849 + 851: 9(float) CompositeExtract 848 1 + 852: 9(float) GroupFAdd 28 ExclusiveScan 851 + 853: 9(float) CompositeExtract 848 2 + 854: 9(float) GroupFAdd 28 ExclusiveScan 853 + 855: 10(fvec3) CompositeConstruct 850 852 854 + 856: 42(ptr) AccessChain 23 41 + Store 856 855 + 857: 54(ptr) AccessChain 23 53 + 858: 12(f64vec4) Load 857 + 859:11(float64_t) CompositeExtract 858 0 + 860:11(float64_t) GroupFAdd 28 ExclusiveScan 859 + 861:11(float64_t) CompositeExtract 858 1 + 862:11(float64_t) GroupFAdd 28 ExclusiveScan 861 + 863:11(float64_t) CompositeExtract 858 2 + 864:11(float64_t) GroupFAdd 28 ExclusiveScan 863 + 865:11(float64_t) CompositeExtract 858 3 + 866:11(float64_t) GroupFAdd 28 ExclusiveScan 865 + 867: 12(f64vec4) CompositeConstruct 860 862 864 866 + 868: 54(ptr) AccessChain 23 53 + Store 868 867 + 869: 68(ptr) AccessChain 23 67 + 870: 13(int64_t) Load 869 + 871: 13(int64_t) GroupIAdd 28 ExclusiveScan 870 + 872: 68(ptr) AccessChain 23 67 + Store 872 871 + 873: 74(ptr) AccessChain 23 73 + 874: 15(i64vec2) Load 873 + 875: 14(int64_t) CompositeExtract 874 0 + 876: 14(int64_t) GroupIAdd 28 ExclusiveScan 875 + 877: 14(int64_t) CompositeExtract 874 1 + 878: 14(int64_t) GroupIAdd 28 ExclusiveScan 877 + 879: 15(i64vec2) CompositeConstruct 876 878 + 880: 74(ptr) AccessChain 23 73 + Store 880 879 + 881: 84(ptr) AccessChain 23 83 + 882: 17(f16vec3) Load 881 + 883:16(float16_t) CompositeExtract 882 0 + 884:16(float16_t) GroupFAdd 28 ExclusiveScan 883 + 885:16(float16_t) CompositeExtract 882 1 + 886:16(float16_t) GroupFAdd 28 ExclusiveScan 885 + 887:16(float16_t) CompositeExtract 882 2 + 888:16(float16_t) GroupFAdd 28 ExclusiveScan 887 + 889: 17(f16vec3) CompositeConstruct 884 886 888 + 890: 84(ptr) AccessChain 23 83 + Store 890 889 + 891: 96(ptr) AccessChain 23 95 + 892: 19(i16vec4) Load 891 + 893: 18(int16_t) CompositeExtract 892 0 + 894: 18(int16_t) GroupIAdd 28 ExclusiveScan 893 + 895: 18(int16_t) CompositeExtract 892 1 + 896: 18(int16_t) GroupIAdd 28 ExclusiveScan 895 + 897: 18(int16_t) CompositeExtract 892 2 + 898: 18(int16_t) GroupIAdd 28 ExclusiveScan 897 + 899: 18(int16_t) CompositeExtract 892 3 + 900: 18(int16_t) GroupIAdd 28 ExclusiveScan 899 + 901: 19(i16vec4) CompositeConstruct 894 896 898 900 + 902: 96(ptr) AccessChain 23 95 + Store 902 901 + 903: 110(ptr) AccessChain 23 109 + 904: 20(int16_t) Load 903 + 905: 20(int16_t) GroupIAdd 28 ExclusiveScan 904 + 906: 110(ptr) AccessChain 23 109 + Store 906 905 + 907: 25(ptr) AccessChain 23 24 + 908: 6(int) Load 907 + 909: 6(int) GroupSMinNonUniformAMD 28 InclusiveScan 908 + 910: 25(ptr) AccessChain 23 24 + Store 910 909 + 911: 32(ptr) AccessChain 23 31 + 912: 8(ivec2) Load 911 + 913: 7(int) CompositeExtract 912 0 + 914: 7(int) GroupUMinNonUniformAMD 28 InclusiveScan 913 + 915: 7(int) CompositeExtract 912 1 + 916: 7(int) GroupUMinNonUniformAMD 28 InclusiveScan 915 + 917: 8(ivec2) CompositeConstruct 914 916 + 918: 32(ptr) AccessChain 23 31 + Store 918 917 + 919: 42(ptr) AccessChain 23 41 + 920: 10(fvec3) Load 919 + 921: 9(float) CompositeExtract 920 0 + 922: 9(float) GroupFMinNonUniformAMD 28 InclusiveScan 921 + 923: 9(float) CompositeExtract 920 1 + 924: 9(float) GroupFMinNonUniformAMD 28 InclusiveScan 923 + 925: 9(float) CompositeExtract 920 2 + 926: 9(float) GroupFMinNonUniformAMD 28 InclusiveScan 925 + 927: 10(fvec3) CompositeConstruct 922 924 926 + 928: 42(ptr) AccessChain 23 41 + Store 928 927 + 929: 54(ptr) AccessChain 23 53 + 930: 12(f64vec4) Load 929 + 931:11(float64_t) CompositeExtract 930 0 + 932:11(float64_t) GroupFMinNonUniformAMD 28 InclusiveScan 931 + 933:11(float64_t) CompositeExtract 930 1 + 934:11(float64_t) GroupFMinNonUniformAMD 28 InclusiveScan 933 + 935:11(float64_t) CompositeExtract 930 2 + 936:11(float64_t) GroupFMinNonUniformAMD 28 InclusiveScan 935 + 937:11(float64_t) CompositeExtract 930 3 + 938:11(float64_t) GroupFMinNonUniformAMD 28 InclusiveScan 937 + 939: 12(f64vec4) CompositeConstruct 932 934 936 938 + 940: 54(ptr) AccessChain 23 53 + Store 940 939 + 941: 68(ptr) AccessChain 23 67 + 942: 13(int64_t) Load 941 + 943: 13(int64_t) GroupSMinNonUniformAMD 28 InclusiveScan 942 + 944: 68(ptr) AccessChain 23 67 + Store 944 943 + 945: 74(ptr) AccessChain 23 73 + 946: 15(i64vec2) Load 945 + 947: 14(int64_t) CompositeExtract 946 0 + 948: 14(int64_t) GroupUMinNonUniformAMD 28 InclusiveScan 947 + 949: 14(int64_t) CompositeExtract 946 1 + 950: 14(int64_t) GroupUMinNonUniformAMD 28 InclusiveScan 949 + 951: 15(i64vec2) CompositeConstruct 948 950 + 952: 74(ptr) AccessChain 23 73 + Store 952 951 + 953: 84(ptr) AccessChain 23 83 + 954: 17(f16vec3) Load 953 + 955:16(float16_t) CompositeExtract 954 0 + 956:16(float16_t) GroupFMinNonUniformAMD 28 InclusiveScan 955 + 957:16(float16_t) CompositeExtract 954 1 + 958:16(float16_t) GroupFMinNonUniformAMD 28 InclusiveScan 957 + 959:16(float16_t) CompositeExtract 954 2 + 960:16(float16_t) GroupFMinNonUniformAMD 28 InclusiveScan 959 + 961: 17(f16vec3) CompositeConstruct 956 958 960 + 962: 84(ptr) AccessChain 23 83 + Store 962 961 + 963: 96(ptr) AccessChain 23 95 + 964: 19(i16vec4) Load 963 + 965: 18(int16_t) CompositeExtract 964 0 + 966: 18(int16_t) GroupSMinNonUniformAMD 28 InclusiveScan 965 + 967: 18(int16_t) CompositeExtract 964 1 + 968: 18(int16_t) GroupSMinNonUniformAMD 28 InclusiveScan 967 + 969: 18(int16_t) CompositeExtract 964 2 + 970: 18(int16_t) GroupSMinNonUniformAMD 28 InclusiveScan 969 + 971: 18(int16_t) CompositeExtract 964 3 + 972: 18(int16_t) GroupSMinNonUniformAMD 28 InclusiveScan 971 + 973: 19(i16vec4) CompositeConstruct 966 968 970 972 + 974: 96(ptr) AccessChain 23 95 + Store 974 973 + 975: 110(ptr) AccessChain 23 109 + 976: 20(int16_t) Load 975 + 977: 20(int16_t) GroupUMinNonUniformAMD 28 InclusiveScan 976 + 978: 110(ptr) AccessChain 23 109 + Store 978 977 + 979: 25(ptr) AccessChain 23 24 + 980: 6(int) Load 979 + 981: 6(int) GroupSMaxNonUniformAMD 28 InclusiveScan 980 + 982: 25(ptr) AccessChain 23 24 + Store 982 981 + 983: 32(ptr) AccessChain 23 31 + 984: 8(ivec2) Load 983 + 985: 7(int) CompositeExtract 984 0 + 986: 7(int) GroupUMaxNonUniformAMD 28 InclusiveScan 985 + 987: 7(int) CompositeExtract 984 1 + 988: 7(int) GroupUMaxNonUniformAMD 28 InclusiveScan 987 + 989: 8(ivec2) CompositeConstruct 986 988 + 990: 32(ptr) AccessChain 23 31 + Store 990 989 + 991: 42(ptr) AccessChain 23 41 + 992: 10(fvec3) Load 991 + 993: 9(float) CompositeExtract 992 0 + 994: 9(float) GroupFMaxNonUniformAMD 28 InclusiveScan 993 + 995: 9(float) CompositeExtract 992 1 + 996: 9(float) GroupFMaxNonUniformAMD 28 InclusiveScan 995 + 997: 9(float) CompositeExtract 992 2 + 998: 9(float) GroupFMaxNonUniformAMD 28 InclusiveScan 997 + 999: 10(fvec3) CompositeConstruct 994 996 998 + 1000: 42(ptr) AccessChain 23 41 + Store 1000 999 + 1001: 54(ptr) AccessChain 23 53 + 1002: 12(f64vec4) Load 1001 + 1003:11(float64_t) CompositeExtract 1002 0 + 1004:11(float64_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1003 + 1005:11(float64_t) CompositeExtract 1002 1 + 1006:11(float64_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1005 + 1007:11(float64_t) CompositeExtract 1002 2 + 1008:11(float64_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1007 + 1009:11(float64_t) CompositeExtract 1002 3 + 1010:11(float64_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1009 + 1011: 12(f64vec4) CompositeConstruct 1004 1006 1008 1010 + 1012: 54(ptr) AccessChain 23 53 + Store 1012 1011 + 1013: 68(ptr) AccessChain 23 67 + 1014: 13(int64_t) Load 1013 + 1015: 13(int64_t) GroupSMaxNonUniformAMD 28 InclusiveScan 1014 + 1016: 68(ptr) AccessChain 23 67 + Store 1016 1015 + 1017: 74(ptr) AccessChain 23 73 + 1018: 15(i64vec2) Load 1017 + 1019: 14(int64_t) CompositeExtract 1018 0 + 1020: 14(int64_t) GroupUMaxNonUniformAMD 28 InclusiveScan 1019 + 1021: 14(int64_t) CompositeExtract 1018 1 + 1022: 14(int64_t) GroupUMaxNonUniformAMD 28 InclusiveScan 1021 + 1023: 15(i64vec2) CompositeConstruct 1020 1022 + 1024: 74(ptr) AccessChain 23 73 + Store 1024 1023 + 1025: 84(ptr) AccessChain 23 83 + 1026: 17(f16vec3) Load 1025 + 1027:16(float16_t) CompositeExtract 1026 0 + 1028:16(float16_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1027 + 1029:16(float16_t) CompositeExtract 1026 1 + 1030:16(float16_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1029 + 1031:16(float16_t) CompositeExtract 1026 2 + 1032:16(float16_t) GroupFMaxNonUniformAMD 28 InclusiveScan 1031 + 1033: 17(f16vec3) CompositeConstruct 1028 1030 1032 + 1034: 84(ptr) AccessChain 23 83 + Store 1034 1033 + 1035: 96(ptr) AccessChain 23 95 + 1036: 19(i16vec4) Load 1035 + 1037: 18(int16_t) CompositeExtract 1036 0 + 1038: 18(int16_t) GroupSMaxNonUniformAMD 28 InclusiveScan 1037 + 1039: 18(int16_t) CompositeExtract 1036 1 + 1040: 18(int16_t) GroupSMaxNonUniformAMD 28 InclusiveScan 1039 + 1041: 18(int16_t) CompositeExtract 1036 2 + 1042: 18(int16_t) GroupSMaxNonUniformAMD 28 InclusiveScan 1041 + 1043: 18(int16_t) CompositeExtract 1036 3 + 1044: 18(int16_t) GroupSMaxNonUniformAMD 28 InclusiveScan 1043 + 1045: 19(i16vec4) CompositeConstruct 1038 1040 1042 1044 + 1046: 96(ptr) AccessChain 23 95 + Store 1046 1045 + 1047: 110(ptr) AccessChain 23 109 + 1048: 20(int16_t) Load 1047 + 1049: 20(int16_t) GroupUMaxNonUniformAMD 28 InclusiveScan 1048 + 1050: 110(ptr) AccessChain 23 109 + Store 1050 1049 + 1051: 25(ptr) AccessChain 23 24 + 1052: 6(int) Load 1051 + 1053: 6(int) GroupIAddNonUniformAMD 28 InclusiveScan 1052 + 1054: 25(ptr) AccessChain 23 24 + Store 1054 1053 + 1055: 32(ptr) AccessChain 23 31 + 1056: 8(ivec2) Load 1055 + 1057: 7(int) CompositeExtract 1056 0 + 1058: 7(int) GroupIAddNonUniformAMD 28 InclusiveScan 1057 + 1059: 7(int) CompositeExtract 1056 1 + 1060: 7(int) GroupIAddNonUniformAMD 28 InclusiveScan 1059 + 1061: 8(ivec2) CompositeConstruct 1058 1060 + 1062: 32(ptr) AccessChain 23 31 + Store 1062 1061 + 1063: 42(ptr) AccessChain 23 41 + 1064: 10(fvec3) Load 1063 + 1065: 9(float) CompositeExtract 1064 0 + 1066: 9(float) GroupFAddNonUniformAMD 28 InclusiveScan 1065 + 1067: 9(float) CompositeExtract 1064 1 + 1068: 9(float) GroupFAddNonUniformAMD 28 InclusiveScan 1067 + 1069: 9(float) CompositeExtract 1064 2 + 1070: 9(float) GroupFAddNonUniformAMD 28 InclusiveScan 1069 + 1071: 10(fvec3) CompositeConstruct 1066 1068 1070 + 1072: 42(ptr) AccessChain 23 41 + Store 1072 1071 + 1073: 54(ptr) AccessChain 23 53 + 1074: 12(f64vec4) Load 1073 + 1075:11(float64_t) CompositeExtract 1074 0 + 1076:11(float64_t) GroupFAddNonUniformAMD 28 InclusiveScan 1075 + 1077:11(float64_t) CompositeExtract 1074 1 + 1078:11(float64_t) GroupFAddNonUniformAMD 28 InclusiveScan 1077 + 1079:11(float64_t) CompositeExtract 1074 2 + 1080:11(float64_t) GroupFAddNonUniformAMD 28 InclusiveScan 1079 + 1081:11(float64_t) CompositeExtract 1074 3 + 1082:11(float64_t) GroupFAddNonUniformAMD 28 InclusiveScan 1081 + 1083: 12(f64vec4) CompositeConstruct 1076 1078 1080 1082 + 1084: 54(ptr) AccessChain 23 53 + Store 1084 1083 + 1085: 68(ptr) AccessChain 23 67 + 1086: 13(int64_t) Load 1085 + 1087: 13(int64_t) GroupIAddNonUniformAMD 28 InclusiveScan 1086 + 1088: 68(ptr) AccessChain 23 67 + Store 1088 1087 + 1089: 74(ptr) AccessChain 23 73 + 1090: 15(i64vec2) Load 1089 + 1091: 14(int64_t) CompositeExtract 1090 0 + 1092: 14(int64_t) GroupIAddNonUniformAMD 28 InclusiveScan 1091 + 1093: 14(int64_t) CompositeExtract 1090 1 + 1094: 14(int64_t) GroupIAddNonUniformAMD 28 InclusiveScan 1093 + 1095: 15(i64vec2) CompositeConstruct 1092 1094 + 1096: 74(ptr) AccessChain 23 73 + Store 1096 1095 + 1097: 84(ptr) AccessChain 23 83 + 1098: 17(f16vec3) Load 1097 + 1099:16(float16_t) CompositeExtract 1098 0 + 1100:16(float16_t) GroupFAddNonUniformAMD 28 InclusiveScan 1099 + 1101:16(float16_t) CompositeExtract 1098 1 + 1102:16(float16_t) GroupFAddNonUniformAMD 28 InclusiveScan 1101 + 1103:16(float16_t) CompositeExtract 1098 2 + 1104:16(float16_t) GroupFAddNonUniformAMD 28 InclusiveScan 1103 + 1105: 17(f16vec3) CompositeConstruct 1100 1102 1104 + 1106: 84(ptr) AccessChain 23 83 + Store 1106 1105 + 1107: 96(ptr) AccessChain 23 95 + 1108: 19(i16vec4) Load 1107 + 1109: 18(int16_t) CompositeExtract 1108 0 + 1110: 18(int16_t) GroupIAddNonUniformAMD 28 InclusiveScan 1109 + 1111: 18(int16_t) CompositeExtract 1108 1 + 1112: 18(int16_t) GroupIAddNonUniformAMD 28 InclusiveScan 1111 + 1113: 18(int16_t) CompositeExtract 1108 2 + 1114: 18(int16_t) GroupIAddNonUniformAMD 28 InclusiveScan 1113 + 1115: 18(int16_t) CompositeExtract 1108 3 + 1116: 18(int16_t) GroupIAddNonUniformAMD 28 InclusiveScan 1115 + 1117: 19(i16vec4) CompositeConstruct 1110 1112 1114 1116 + 1118: 96(ptr) AccessChain 23 95 + Store 1118 1117 + 1119: 110(ptr) AccessChain 23 109 + 1120: 20(int16_t) Load 1119 + 1121: 20(int16_t) GroupIAddNonUniformAMD 28 InclusiveScan 1120 + 1122: 110(ptr) AccessChain 23 109 + Store 1122 1121 + 1123: 25(ptr) AccessChain 23 24 + 1124: 6(int) Load 1123 + 1125: 6(int) GroupSMinNonUniformAMD 28 ExclusiveScan 1124 + 1126: 25(ptr) AccessChain 23 24 + Store 1126 1125 + 1127: 32(ptr) AccessChain 23 31 + 1128: 8(ivec2) Load 1127 + 1129: 7(int) CompositeExtract 1128 0 + 1130: 7(int) GroupUMinNonUniformAMD 28 ExclusiveScan 1129 + 1131: 7(int) CompositeExtract 1128 1 + 1132: 7(int) GroupUMinNonUniformAMD 28 ExclusiveScan 1131 + 1133: 8(ivec2) CompositeConstruct 1130 1132 + 1134: 32(ptr) AccessChain 23 31 + Store 1134 1133 + 1135: 42(ptr) AccessChain 23 41 + 1136: 10(fvec3) Load 1135 + 1137: 9(float) CompositeExtract 1136 0 + 1138: 9(float) GroupFMinNonUniformAMD 28 ExclusiveScan 1137 + 1139: 9(float) CompositeExtract 1136 1 + 1140: 9(float) GroupFMinNonUniformAMD 28 ExclusiveScan 1139 + 1141: 9(float) CompositeExtract 1136 2 + 1142: 9(float) GroupFMinNonUniformAMD 28 ExclusiveScan 1141 + 1143: 10(fvec3) CompositeConstruct 1138 1140 1142 + 1144: 42(ptr) AccessChain 23 41 + Store 1144 1143 + 1145: 54(ptr) AccessChain 23 53 + 1146: 12(f64vec4) Load 1145 + 1147:11(float64_t) CompositeExtract 1146 0 + 1148:11(float64_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1147 + 1149:11(float64_t) CompositeExtract 1146 1 + 1150:11(float64_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1149 + 1151:11(float64_t) CompositeExtract 1146 2 + 1152:11(float64_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1151 + 1153:11(float64_t) CompositeExtract 1146 3 + 1154:11(float64_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1153 + 1155: 12(f64vec4) CompositeConstruct 1148 1150 1152 1154 + 1156: 54(ptr) AccessChain 23 53 + Store 1156 1155 + 1157: 68(ptr) AccessChain 23 67 + 1158: 13(int64_t) Load 1157 + 1159: 13(int64_t) GroupSMinNonUniformAMD 28 ExclusiveScan 1158 + 1160: 68(ptr) AccessChain 23 67 + Store 1160 1159 + 1161: 74(ptr) AccessChain 23 73 + 1162: 15(i64vec2) Load 1161 + 1163: 14(int64_t) CompositeExtract 1162 0 + 1164: 14(int64_t) GroupUMinNonUniformAMD 28 ExclusiveScan 1163 + 1165: 14(int64_t) CompositeExtract 1162 1 + 1166: 14(int64_t) GroupUMinNonUniformAMD 28 ExclusiveScan 1165 + 1167: 15(i64vec2) CompositeConstruct 1164 1166 + 1168: 74(ptr) AccessChain 23 73 + Store 1168 1167 + 1169: 84(ptr) AccessChain 23 83 + 1170: 17(f16vec3) Load 1169 + 1171:16(float16_t) CompositeExtract 1170 0 + 1172:16(float16_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1171 + 1173:16(float16_t) CompositeExtract 1170 1 + 1174:16(float16_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1173 + 1175:16(float16_t) CompositeExtract 1170 2 + 1176:16(float16_t) GroupFMinNonUniformAMD 28 ExclusiveScan 1175 + 1177: 17(f16vec3) CompositeConstruct 1172 1174 1176 + 1178: 84(ptr) AccessChain 23 83 + Store 1178 1177 + 1179: 96(ptr) AccessChain 23 95 + 1180: 19(i16vec4) Load 1179 + 1181: 18(int16_t) CompositeExtract 1180 0 + 1182: 18(int16_t) GroupSMinNonUniformAMD 28 ExclusiveScan 1181 + 1183: 18(int16_t) CompositeExtract 1180 1 + 1184: 18(int16_t) GroupSMinNonUniformAMD 28 ExclusiveScan 1183 + 1185: 18(int16_t) CompositeExtract 1180 2 + 1186: 18(int16_t) GroupSMinNonUniformAMD 28 ExclusiveScan 1185 + 1187: 18(int16_t) CompositeExtract 1180 3 + 1188: 18(int16_t) GroupSMinNonUniformAMD 28 ExclusiveScan 1187 + 1189: 19(i16vec4) CompositeConstruct 1182 1184 1186 1188 + 1190: 96(ptr) AccessChain 23 95 + Store 1190 1189 + 1191: 110(ptr) AccessChain 23 109 + 1192: 20(int16_t) Load 1191 + 1193: 20(int16_t) GroupUMinNonUniformAMD 28 ExclusiveScan 1192 + 1194: 110(ptr) AccessChain 23 109 + Store 1194 1193 + 1195: 25(ptr) AccessChain 23 24 + 1196: 6(int) Load 1195 + 1197: 6(int) GroupSMaxNonUniformAMD 28 ExclusiveScan 1196 + 1198: 25(ptr) AccessChain 23 24 + Store 1198 1197 + 1199: 32(ptr) AccessChain 23 31 + 1200: 8(ivec2) Load 1199 + 1201: 7(int) CompositeExtract 1200 0 + 1202: 7(int) GroupUMaxNonUniformAMD 28 ExclusiveScan 1201 + 1203: 7(int) CompositeExtract 1200 1 + 1204: 7(int) GroupUMaxNonUniformAMD 28 ExclusiveScan 1203 + 1205: 8(ivec2) CompositeConstruct 1202 1204 + 1206: 32(ptr) AccessChain 23 31 + Store 1206 1205 + 1207: 42(ptr) AccessChain 23 41 + 1208: 10(fvec3) Load 1207 + 1209: 9(float) CompositeExtract 1208 0 + 1210: 9(float) GroupFMaxNonUniformAMD 28 ExclusiveScan 1209 + 1211: 9(float) CompositeExtract 1208 1 + 1212: 9(float) GroupFMaxNonUniformAMD 28 ExclusiveScan 1211 + 1213: 9(float) CompositeExtract 1208 2 + 1214: 9(float) GroupFMaxNonUniformAMD 28 ExclusiveScan 1213 + 1215: 10(fvec3) CompositeConstruct 1210 1212 1214 + 1216: 42(ptr) AccessChain 23 41 + Store 1216 1215 + 1217: 54(ptr) AccessChain 23 53 + 1218: 12(f64vec4) Load 1217 + 1219:11(float64_t) CompositeExtract 1218 0 + 1220:11(float64_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1219 + 1221:11(float64_t) CompositeExtract 1218 1 + 1222:11(float64_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1221 + 1223:11(float64_t) CompositeExtract 1218 2 + 1224:11(float64_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1223 + 1225:11(float64_t) CompositeExtract 1218 3 + 1226:11(float64_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1225 + 1227: 12(f64vec4) CompositeConstruct 1220 1222 1224 1226 + 1228: 54(ptr) AccessChain 23 53 + Store 1228 1227 + 1229: 68(ptr) AccessChain 23 67 + 1230: 13(int64_t) Load 1229 + 1231: 13(int64_t) GroupSMaxNonUniformAMD 28 ExclusiveScan 1230 + 1232: 68(ptr) AccessChain 23 67 + Store 1232 1231 + 1233: 74(ptr) AccessChain 23 73 + 1234: 15(i64vec2) Load 1233 + 1235: 14(int64_t) CompositeExtract 1234 0 + 1236: 14(int64_t) GroupUMaxNonUniformAMD 28 ExclusiveScan 1235 + 1237: 14(int64_t) CompositeExtract 1234 1 + 1238: 14(int64_t) GroupUMaxNonUniformAMD 28 ExclusiveScan 1237 + 1239: 15(i64vec2) CompositeConstruct 1236 1238 + 1240: 74(ptr) AccessChain 23 73 + Store 1240 1239 + 1241: 84(ptr) AccessChain 23 83 + 1242: 17(f16vec3) Load 1241 + 1243:16(float16_t) CompositeExtract 1242 0 + 1244:16(float16_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1243 + 1245:16(float16_t) CompositeExtract 1242 1 + 1246:16(float16_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1245 + 1247:16(float16_t) CompositeExtract 1242 2 + 1248:16(float16_t) GroupFMaxNonUniformAMD 28 ExclusiveScan 1247 + 1249: 17(f16vec3) CompositeConstruct 1244 1246 1248 + 1250: 84(ptr) AccessChain 23 83 + Store 1250 1249 + 1251: 96(ptr) AccessChain 23 95 + 1252: 19(i16vec4) Load 1251 + 1253: 18(int16_t) CompositeExtract 1252 0 + 1254: 18(int16_t) GroupSMaxNonUniformAMD 28 ExclusiveScan 1253 + 1255: 18(int16_t) CompositeExtract 1252 1 + 1256: 18(int16_t) GroupSMaxNonUniformAMD 28 ExclusiveScan 1255 + 1257: 18(int16_t) CompositeExtract 1252 2 + 1258: 18(int16_t) GroupSMaxNonUniformAMD 28 ExclusiveScan 1257 + 1259: 18(int16_t) CompositeExtract 1252 3 + 1260: 18(int16_t) GroupSMaxNonUniformAMD 28 ExclusiveScan 1259 + 1261: 19(i16vec4) CompositeConstruct 1254 1256 1258 1260 + 1262: 96(ptr) AccessChain 23 95 + Store 1262 1261 + 1263: 110(ptr) AccessChain 23 109 + 1264: 20(int16_t) Load 1263 + 1265: 20(int16_t) GroupUMaxNonUniformAMD 28 ExclusiveScan 1264 + 1266: 110(ptr) AccessChain 23 109 + Store 1266 1265 + 1267: 25(ptr) AccessChain 23 24 + 1268: 6(int) Load 1267 + 1269: 6(int) GroupIAddNonUniformAMD 28 ExclusiveScan 1268 + 1270: 25(ptr) AccessChain 23 24 + Store 1270 1269 + 1271: 32(ptr) AccessChain 23 31 + 1272: 8(ivec2) Load 1271 + 1273: 7(int) CompositeExtract 1272 0 + 1274: 7(int) GroupIAddNonUniformAMD 28 ExclusiveScan 1273 + 1275: 7(int) CompositeExtract 1272 1 + 1276: 7(int) GroupIAddNonUniformAMD 28 ExclusiveScan 1275 + 1277: 8(ivec2) CompositeConstruct 1274 1276 + 1278: 32(ptr) AccessChain 23 31 + Store 1278 1277 + 1279: 42(ptr) AccessChain 23 41 + 1280: 10(fvec3) Load 1279 + 1281: 9(float) CompositeExtract 1280 0 + 1282: 9(float) GroupFAddNonUniformAMD 28 ExclusiveScan 1281 + 1283: 9(float) CompositeExtract 1280 1 + 1284: 9(float) GroupFAddNonUniformAMD 28 ExclusiveScan 1283 + 1285: 9(float) CompositeExtract 1280 2 + 1286: 9(float) GroupFAddNonUniformAMD 28 ExclusiveScan 1285 + 1287: 10(fvec3) CompositeConstruct 1282 1284 1286 + 1288: 42(ptr) AccessChain 23 41 + Store 1288 1287 + 1289: 54(ptr) AccessChain 23 53 + 1290: 12(f64vec4) Load 1289 + 1291:11(float64_t) CompositeExtract 1290 0 + 1292:11(float64_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1291 + 1293:11(float64_t) CompositeExtract 1290 1 + 1294:11(float64_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1293 + 1295:11(float64_t) CompositeExtract 1290 2 + 1296:11(float64_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1295 + 1297:11(float64_t) CompositeExtract 1290 3 + 1298:11(float64_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1297 + 1299: 12(f64vec4) CompositeConstruct 1292 1294 1296 1298 + 1300: 54(ptr) AccessChain 23 53 + Store 1300 1299 + 1301: 68(ptr) AccessChain 23 67 + 1302: 13(int64_t) Load 1301 + 1303: 13(int64_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1302 + 1304: 68(ptr) AccessChain 23 67 + Store 1304 1303 + 1305: 74(ptr) AccessChain 23 73 + 1306: 15(i64vec2) Load 1305 + 1307: 14(int64_t) CompositeExtract 1306 0 + 1308: 14(int64_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1307 + 1309: 14(int64_t) CompositeExtract 1306 1 + 1310: 14(int64_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1309 + 1311: 15(i64vec2) CompositeConstruct 1308 1310 + 1312: 74(ptr) AccessChain 23 73 + Store 1312 1311 + 1313: 84(ptr) AccessChain 23 83 + 1314: 17(f16vec3) Load 1313 + 1315:16(float16_t) CompositeExtract 1314 0 + 1316:16(float16_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1315 + 1317:16(float16_t) CompositeExtract 1314 1 + 1318:16(float16_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1317 + 1319:16(float16_t) CompositeExtract 1314 2 + 1320:16(float16_t) GroupFAddNonUniformAMD 28 ExclusiveScan 1319 + 1321: 17(f16vec3) CompositeConstruct 1316 1318 1320 + 1322: 84(ptr) AccessChain 23 83 + Store 1322 1321 + 1323: 96(ptr) AccessChain 23 95 + 1324: 19(i16vec4) Load 1323 + 1325: 18(int16_t) CompositeExtract 1324 0 + 1326: 18(int16_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1325 + 1327: 18(int16_t) CompositeExtract 1324 1 + 1328: 18(int16_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1327 + 1329: 18(int16_t) CompositeExtract 1324 2 + 1330: 18(int16_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1329 + 1331: 18(int16_t) CompositeExtract 1324 3 + 1332: 18(int16_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1331 + 1333: 19(i16vec4) CompositeConstruct 1326 1328 1330 1332 + 1334: 96(ptr) AccessChain 23 95 + Store 1334 1333 + 1335: 110(ptr) AccessChain 23 109 + 1336: 20(int16_t) Load 1335 + 1337: 20(int16_t) GroupIAddNonUniformAMD 28 ExclusiveScan 1336 + 1338: 110(ptr) AccessChain 23 109 + Store 1338 1337 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderDrawParams.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderDrawParams.vert.out index 36c5ca5916c..d6b43e8fe9b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderDrawParams.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderDrawParams.vert.out @@ -1,6 +1,6 @@ spv.shaderDrawParams.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 53 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out index 56081b12928..788d3ee6973 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderFragMaskAMD.frag.out @@ -1,6 +1,6 @@ spv.shaderFragMaskAMD.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 80 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderGroupVote.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderGroupVote.comp.out index abd180468ce..e45f5858376 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderGroupVote.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderGroupVote.comp.out @@ -1,6 +1,6 @@ spv.shaderGroupVote.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 33 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderImageFootprint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderImageFootprint.frag.out new file mode 100644 index 00000000000..2ada2b5af74 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderImageFootprint.frag.out @@ -0,0 +1,849 @@ +spv.shaderImageFootprint.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 622 + + Capability Shader + Capability MinLod + Capability Bad + Extension "SPV_NV_shader_image_footprint" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 21 24 76 125 225 275 277 387 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_NV_shader_texture_footprint" + Name 4 "main" + Name 8 "result2D" + MemberName 8(result2D) 0 "ret2D" + MemberName 8(result2D) 1 "anchor2D" + MemberName 8(result2D) 2 "offset2D" + MemberName 8(result2D) 3 "mask2D" + MemberName 8(result2D) 4 "lod2D" + MemberName 8(result2D) 5 "granularity2D" + Name 10 "" + Name 17 "sample2D" + Name 21 "P2" + Name 24 "granularity" + Name 28 "gl_TextureFootprint2DNV" + MemberName 28(gl_TextureFootprint2DNV) 0 "anchor" + MemberName 28(gl_TextureFootprint2DNV) 1 "offset" + MemberName 28(gl_TextureFootprint2DNV) 2 "mask" + MemberName 28(gl_TextureFootprint2DNV) 3 "lod" + MemberName 28(gl_TextureFootprint2DNV) 4 "granularity" + Name 30 "fp2D" + Name 31 "ResType" + Name 76 "bias" + Name 78 "ResType" + Name 125 "lodClamp" + Name 128 "ResType" + Name 178 "ResType" + Name 225 "lod" + Name 228 "ResType" + Name 275 "dx" + Name 277 "dy" + Name 280 "ResType" + Name 331 "ResType" + Name 377 "result3D" + MemberName 377(result3D) 0 "ret3D" + MemberName 377(result3D) 1 "anchor3D" + MemberName 377(result3D) 2 "offset3D" + MemberName 377(result3D) 3 "mask3D" + MemberName 377(result3D) 4 "lod3D" + MemberName 377(result3D) 5 "granularity3D" + Name 379 "" + Name 383 "sample3D" + Name 387 "P3" + Name 390 "gl_TextureFootprint3DNV" + MemberName 390(gl_TextureFootprint3DNV) 0 "anchor" + MemberName 390(gl_TextureFootprint3DNV) 1 "offset" + MemberName 390(gl_TextureFootprint3DNV) 2 "mask" + MemberName 390(gl_TextureFootprint3DNV) 3 "lod" + MemberName 390(gl_TextureFootprint3DNV) 4 "granularity" + Name 392 "fp3D" + Name 393 "ResType" + Name 429 "ResType" + Name 478 "ResType" + Name 528 "ResType" + Name 577 "ResType" + MemberDecorate 8(result2D) 0 Offset 0 + MemberDecorate 8(result2D) 1 Offset 8 + MemberDecorate 8(result2D) 2 Offset 16 + MemberDecorate 8(result2D) 3 Offset 24 + MemberDecorate 8(result2D) 4 Offset 32 + MemberDecorate 8(result2D) 5 Offset 36 + Decorate 8(result2D) BufferBlock + Decorate 10 DescriptorSet 0 + Decorate 17(sample2D) DescriptorSet 0 + Decorate 21(P2) Location 0 + Decorate 24(granularity) Flat + Decorate 24(granularity) Location 3 + Decorate 76(bias) Location 9 + Decorate 125(lodClamp) Location 4 + Decorate 225(lod) Location 5 + Decorate 275(dx) Location 6 + Decorate 277(dy) Location 8 + MemberDecorate 377(result3D) 0 Offset 0 + MemberDecorate 377(result3D) 1 Offset 16 + MemberDecorate 377(result3D) 2 Offset 32 + MemberDecorate 377(result3D) 3 Offset 48 + MemberDecorate 377(result3D) 4 Offset 56 + MemberDecorate 377(result3D) 5 Offset 60 + Decorate 377(result3D) BufferBlock + Decorate 379 DescriptorSet 0 + Decorate 383(sample3D) DescriptorSet 0 + Decorate 387(P3) Location 2 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 2 + 8(result2D): TypeStruct 6(int) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 9: TypePointer Uniform 8(result2D) + 10: 9(ptr) Variable Uniform + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: TypeFloat 32 + 14: TypeImage 13(float) 2D sampled format:Unknown + 15: TypeSampledImage 14 + 16: TypePointer UniformConstant 15 + 17(sample2D): 16(ptr) Variable UniformConstant + 19: TypeVector 13(float) 2 + 20: TypePointer Input 19(fvec2) + 21(P2): 20(ptr) Variable Input + 23: TypePointer Input 11(int) + 24(granularity): 23(ptr) Variable Input + 26: TypeBool + 27: 26(bool) ConstantTrue +28(gl_TextureFootprint2DNV): TypeStruct 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 29: TypePointer Function 28(gl_TextureFootprint2DNV) + 31(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 34: TypePointer Function 7(ivec2) + 36: 11(int) Constant 1 + 39: 11(int) Constant 2 + 42: 11(int) Constant 3 + 44: TypePointer Function 6(int) + 46: 11(int) Constant 4 + 50: 6(int) Constant 1 + 51: 6(int) Constant 0 + 53: TypePointer Uniform 6(int) + 57: TypePointer Uniform 7(ivec2) + 68: 11(int) Constant 5 + 75: TypePointer Input 13(float) + 76(bias): 75(ptr) Variable Input + 78(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 125(lodClamp): 75(ptr) Variable Input + 128(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 178(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 225(lod): 75(ptr) Variable Input + 228(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 275(dx): 20(ptr) Variable Input + 277(dy): 20(ptr) Variable Input + 280(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 331(ResType): TypeStruct 26(bool) 7(ivec2) 7(ivec2) 7(ivec2) 6(int) 6(int) + 376: TypeVector 6(int) 3 + 377(result3D): TypeStruct 6(int) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 378: TypePointer Uniform 377(result3D) + 379: 378(ptr) Variable Uniform + 380: TypeImage 13(float) 3D sampled format:Unknown + 381: TypeSampledImage 380 + 382: TypePointer UniformConstant 381 + 383(sample3D): 382(ptr) Variable UniformConstant + 385: TypeVector 13(float) 3 + 386: TypePointer Input 385(fvec3) + 387(P3): 386(ptr) Variable Input +390(gl_TextureFootprint3DNV): TypeStruct 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 391: TypePointer Function 390(gl_TextureFootprint3DNV) + 393(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 396: TypePointer Function 376(ivec3) + 411: TypePointer Uniform 376(ivec3) + 429(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 478(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 528(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 577(ResType): TypeStruct 26(bool) 376(ivec3) 376(ivec3) 7(ivec2) 6(int) 6(int) + 4(main): 2 Function None 3 + 5: Label + 30(fp2D): 29(ptr) Variable Function + 392(fp3D): 391(ptr) Variable Function + 18: 15 Load 17(sample2D) + 22: 19(fvec2) Load 21(P2) + 25: 11(int) Load 24(granularity) + 32: 31(ResType) ImageSampleFootprintNV 18 22 25 27 + 33: 7(ivec2) CompositeExtract 32 1 + 35: 34(ptr) AccessChain 30(fp2D) 12 + Store 35 33 + 37: 7(ivec2) CompositeExtract 32 2 + 38: 34(ptr) AccessChain 30(fp2D) 36 + Store 38 37 + 40: 7(ivec2) CompositeExtract 32 3 + 41: 34(ptr) AccessChain 30(fp2D) 39 + Store 41 40 + 43: 6(int) CompositeExtract 32 4 + 45: 44(ptr) AccessChain 30(fp2D) 42 + Store 45 43 + 47: 6(int) CompositeExtract 32 5 + 48: 44(ptr) AccessChain 30(fp2D) 46 + Store 48 47 + 49: 26(bool) CompositeExtract 32 0 + 52: 6(int) Select 49 50 51 + 54: 53(ptr) AccessChain 10 12 + Store 54 52 + 55: 34(ptr) AccessChain 30(fp2D) 12 + 56: 7(ivec2) Load 55 + 58: 57(ptr) AccessChain 10 36 + Store 58 56 + 59: 34(ptr) AccessChain 30(fp2D) 36 + 60: 7(ivec2) Load 59 + 61: 57(ptr) AccessChain 10 39 + Store 61 60 + 62: 34(ptr) AccessChain 30(fp2D) 39 + 63: 7(ivec2) Load 62 + 64: 57(ptr) AccessChain 10 42 + Store 64 63 + 65: 44(ptr) AccessChain 30(fp2D) 42 + 66: 6(int) Load 65 + 67: 53(ptr) AccessChain 10 46 + Store 67 66 + 69: 44(ptr) AccessChain 30(fp2D) 46 + 70: 6(int) Load 69 + 71: 53(ptr) AccessChain 10 68 + Store 71 70 + 72: 15 Load 17(sample2D) + 73: 19(fvec2) Load 21(P2) + 74: 11(int) Load 24(granularity) + 77: 13(float) Load 76(bias) + 79: 78(ResType) ImageSampleFootprintNV 72 73 74 27 Bias 77 + 80: 7(ivec2) CompositeExtract 79 1 + 81: 34(ptr) AccessChain 30(fp2D) 12 + Store 81 80 + 82: 7(ivec2) CompositeExtract 79 2 + 83: 34(ptr) AccessChain 30(fp2D) 36 + Store 83 82 + 84: 7(ivec2) CompositeExtract 79 3 + 85: 34(ptr) AccessChain 30(fp2D) 39 + Store 85 84 + 86: 6(int) CompositeExtract 79 4 + 87: 44(ptr) AccessChain 30(fp2D) 42 + Store 87 86 + 88: 6(int) CompositeExtract 79 5 + 89: 44(ptr) AccessChain 30(fp2D) 46 + Store 89 88 + 90: 26(bool) CompositeExtract 79 0 + 91: 6(int) Select 90 50 51 + 92: 53(ptr) AccessChain 10 12 + Store 92 91 + 93: 34(ptr) AccessChain 30(fp2D) 12 + 94: 7(ivec2) Load 93 + 95: 57(ptr) AccessChain 10 36 + 96: 7(ivec2) Load 95 + 97: 7(ivec2) IAdd 96 94 + 98: 57(ptr) AccessChain 10 36 + Store 98 97 + 99: 34(ptr) AccessChain 30(fp2D) 36 + 100: 7(ivec2) Load 99 + 101: 57(ptr) AccessChain 10 39 + 102: 7(ivec2) Load 101 + 103: 7(ivec2) IAdd 102 100 + 104: 57(ptr) AccessChain 10 39 + Store 104 103 + 105: 34(ptr) AccessChain 30(fp2D) 39 + 106: 7(ivec2) Load 105 + 107: 57(ptr) AccessChain 10 42 + 108: 7(ivec2) Load 107 + 109: 7(ivec2) IAdd 108 106 + 110: 57(ptr) AccessChain 10 42 + Store 110 109 + 111: 44(ptr) AccessChain 30(fp2D) 42 + 112: 6(int) Load 111 + 113: 53(ptr) AccessChain 10 46 + 114: 6(int) Load 113 + 115: 6(int) IAdd 114 112 + 116: 53(ptr) AccessChain 10 46 + Store 116 115 + 117: 44(ptr) AccessChain 30(fp2D) 46 + 118: 6(int) Load 117 + 119: 53(ptr) AccessChain 10 68 + 120: 6(int) Load 119 + 121: 6(int) IAdd 120 118 + 122: 53(ptr) AccessChain 10 68 + Store 122 121 + 123: 15 Load 17(sample2D) + 124: 19(fvec2) Load 21(P2) + 126: 13(float) Load 125(lodClamp) + 127: 11(int) Load 24(granularity) + 129:128(ResType) ImageSampleFootprintNV 123 124 127 27 MinLod 126 + 130: 7(ivec2) CompositeExtract 129 1 + 131: 34(ptr) AccessChain 30(fp2D) 12 + Store 131 130 + 132: 7(ivec2) CompositeExtract 129 2 + 133: 34(ptr) AccessChain 30(fp2D) 36 + Store 133 132 + 134: 7(ivec2) CompositeExtract 129 3 + 135: 34(ptr) AccessChain 30(fp2D) 39 + Store 135 134 + 136: 6(int) CompositeExtract 129 4 + 137: 44(ptr) AccessChain 30(fp2D) 42 + Store 137 136 + 138: 6(int) CompositeExtract 129 5 + 139: 44(ptr) AccessChain 30(fp2D) 46 + Store 139 138 + 140: 26(bool) CompositeExtract 129 0 + 141: 6(int) Select 140 50 51 + 142: 53(ptr) AccessChain 10 12 + Store 142 141 + 143: 34(ptr) AccessChain 30(fp2D) 12 + 144: 7(ivec2) Load 143 + 145: 57(ptr) AccessChain 10 36 + 146: 7(ivec2) Load 145 + 147: 7(ivec2) IAdd 146 144 + 148: 57(ptr) AccessChain 10 36 + Store 148 147 + 149: 34(ptr) AccessChain 30(fp2D) 36 + 150: 7(ivec2) Load 149 + 151: 57(ptr) AccessChain 10 39 + 152: 7(ivec2) Load 151 + 153: 7(ivec2) IAdd 152 150 + 154: 57(ptr) AccessChain 10 39 + Store 154 153 + 155: 34(ptr) AccessChain 30(fp2D) 39 + 156: 7(ivec2) Load 155 + 157: 57(ptr) AccessChain 10 42 + 158: 7(ivec2) Load 157 + 159: 7(ivec2) IAdd 158 156 + 160: 57(ptr) AccessChain 10 42 + Store 160 159 + 161: 44(ptr) AccessChain 30(fp2D) 42 + 162: 6(int) Load 161 + 163: 53(ptr) AccessChain 10 46 + 164: 6(int) Load 163 + 165: 6(int) IAdd 164 162 + 166: 53(ptr) AccessChain 10 46 + Store 166 165 + 167: 44(ptr) AccessChain 30(fp2D) 46 + 168: 6(int) Load 167 + 169: 53(ptr) AccessChain 10 68 + 170: 6(int) Load 169 + 171: 6(int) IAdd 170 168 + 172: 53(ptr) AccessChain 10 68 + Store 172 171 + 173: 15 Load 17(sample2D) + 174: 19(fvec2) Load 21(P2) + 175: 13(float) Load 125(lodClamp) + 176: 11(int) Load 24(granularity) + 177: 13(float) Load 76(bias) + 179:178(ResType) ImageSampleFootprintNV 173 174 176 27 Bias MinLod 177 175 + 180: 7(ivec2) CompositeExtract 179 1 + 181: 34(ptr) AccessChain 30(fp2D) 12 + Store 181 180 + 182: 7(ivec2) CompositeExtract 179 2 + 183: 34(ptr) AccessChain 30(fp2D) 36 + Store 183 182 + 184: 7(ivec2) CompositeExtract 179 3 + 185: 34(ptr) AccessChain 30(fp2D) 39 + Store 185 184 + 186: 6(int) CompositeExtract 179 4 + 187: 44(ptr) AccessChain 30(fp2D) 42 + Store 187 186 + 188: 6(int) CompositeExtract 179 5 + 189: 44(ptr) AccessChain 30(fp2D) 46 + Store 189 188 + 190: 26(bool) CompositeExtract 179 0 + 191: 6(int) Select 190 50 51 + 192: 53(ptr) AccessChain 10 12 + Store 192 191 + 193: 34(ptr) AccessChain 30(fp2D) 12 + 194: 7(ivec2) Load 193 + 195: 57(ptr) AccessChain 10 36 + 196: 7(ivec2) Load 195 + 197: 7(ivec2) IAdd 196 194 + 198: 57(ptr) AccessChain 10 36 + Store 198 197 + 199: 34(ptr) AccessChain 30(fp2D) 36 + 200: 7(ivec2) Load 199 + 201: 57(ptr) AccessChain 10 39 + 202: 7(ivec2) Load 201 + 203: 7(ivec2) IAdd 202 200 + 204: 57(ptr) AccessChain 10 39 + Store 204 203 + 205: 34(ptr) AccessChain 30(fp2D) 39 + 206: 7(ivec2) Load 205 + 207: 57(ptr) AccessChain 10 42 + 208: 7(ivec2) Load 207 + 209: 7(ivec2) IAdd 208 206 + 210: 57(ptr) AccessChain 10 42 + Store 210 209 + 211: 44(ptr) AccessChain 30(fp2D) 42 + 212: 6(int) Load 211 + 213: 53(ptr) AccessChain 10 46 + 214: 6(int) Load 213 + 215: 6(int) IAdd 214 212 + 216: 53(ptr) AccessChain 10 46 + Store 216 215 + 217: 44(ptr) AccessChain 30(fp2D) 46 + 218: 6(int) Load 217 + 219: 53(ptr) AccessChain 10 68 + 220: 6(int) Load 219 + 221: 6(int) IAdd 220 218 + 222: 53(ptr) AccessChain 10 68 + Store 222 221 + 223: 15 Load 17(sample2D) + 224: 19(fvec2) Load 21(P2) + 226: 13(float) Load 225(lod) + 227: 11(int) Load 24(granularity) + 229:228(ResType) ImageSampleFootprintNV 223 224 227 27 Lod 226 + 230: 7(ivec2) CompositeExtract 229 1 + 231: 34(ptr) AccessChain 30(fp2D) 12 + Store 231 230 + 232: 7(ivec2) CompositeExtract 229 2 + 233: 34(ptr) AccessChain 30(fp2D) 36 + Store 233 232 + 234: 7(ivec2) CompositeExtract 229 3 + 235: 34(ptr) AccessChain 30(fp2D) 39 + Store 235 234 + 236: 6(int) CompositeExtract 229 4 + 237: 44(ptr) AccessChain 30(fp2D) 42 + Store 237 236 + 238: 6(int) CompositeExtract 229 5 + 239: 44(ptr) AccessChain 30(fp2D) 46 + Store 239 238 + 240: 26(bool) CompositeExtract 229 0 + 241: 6(int) Select 240 50 51 + 242: 53(ptr) AccessChain 10 12 + Store 242 241 + 243: 34(ptr) AccessChain 30(fp2D) 12 + 244: 7(ivec2) Load 243 + 245: 57(ptr) AccessChain 10 36 + 246: 7(ivec2) Load 245 + 247: 7(ivec2) IAdd 246 244 + 248: 57(ptr) AccessChain 10 36 + Store 248 247 + 249: 34(ptr) AccessChain 30(fp2D) 36 + 250: 7(ivec2) Load 249 + 251: 57(ptr) AccessChain 10 39 + 252: 7(ivec2) Load 251 + 253: 7(ivec2) IAdd 252 250 + 254: 57(ptr) AccessChain 10 39 + Store 254 253 + 255: 34(ptr) AccessChain 30(fp2D) 39 + 256: 7(ivec2) Load 255 + 257: 57(ptr) AccessChain 10 42 + 258: 7(ivec2) Load 257 + 259: 7(ivec2) IAdd 258 256 + 260: 57(ptr) AccessChain 10 42 + Store 260 259 + 261: 44(ptr) AccessChain 30(fp2D) 42 + 262: 6(int) Load 261 + 263: 53(ptr) AccessChain 10 46 + 264: 6(int) Load 263 + 265: 6(int) IAdd 264 262 + 266: 53(ptr) AccessChain 10 46 + Store 266 265 + 267: 44(ptr) AccessChain 30(fp2D) 46 + 268: 6(int) Load 267 + 269: 53(ptr) AccessChain 10 68 + 270: 6(int) Load 269 + 271: 6(int) IAdd 270 268 + 272: 53(ptr) AccessChain 10 68 + Store 272 271 + 273: 15 Load 17(sample2D) + 274: 19(fvec2) Load 21(P2) + 276: 19(fvec2) Load 275(dx) + 278: 19(fvec2) Load 277(dy) + 279: 11(int) Load 24(granularity) + 281:280(ResType) ImageSampleFootprintNV 273 274 279 27 Grad 276 278 + 282: 7(ivec2) CompositeExtract 281 1 + 283: 34(ptr) AccessChain 30(fp2D) 12 + Store 283 282 + 284: 7(ivec2) CompositeExtract 281 2 + 285: 34(ptr) AccessChain 30(fp2D) 36 + Store 285 284 + 286: 7(ivec2) CompositeExtract 281 3 + 287: 34(ptr) AccessChain 30(fp2D) 39 + Store 287 286 + 288: 6(int) CompositeExtract 281 4 + 289: 44(ptr) AccessChain 30(fp2D) 42 + Store 289 288 + 290: 6(int) CompositeExtract 281 5 + 291: 44(ptr) AccessChain 30(fp2D) 46 + Store 291 290 + 292: 26(bool) CompositeExtract 281 0 + 293: 6(int) Select 292 50 51 + 294: 53(ptr) AccessChain 10 12 + Store 294 293 + 295: 34(ptr) AccessChain 30(fp2D) 12 + 296: 7(ivec2) Load 295 + 297: 57(ptr) AccessChain 10 36 + 298: 7(ivec2) Load 297 + 299: 7(ivec2) IAdd 298 296 + 300: 57(ptr) AccessChain 10 36 + Store 300 299 + 301: 34(ptr) AccessChain 30(fp2D) 36 + 302: 7(ivec2) Load 301 + 303: 57(ptr) AccessChain 10 39 + 304: 7(ivec2) Load 303 + 305: 7(ivec2) IAdd 304 302 + 306: 57(ptr) AccessChain 10 39 + Store 306 305 + 307: 34(ptr) AccessChain 30(fp2D) 39 + 308: 7(ivec2) Load 307 + 309: 57(ptr) AccessChain 10 42 + 310: 7(ivec2) Load 309 + 311: 7(ivec2) IAdd 310 308 + 312: 57(ptr) AccessChain 10 42 + Store 312 311 + 313: 44(ptr) AccessChain 30(fp2D) 42 + 314: 6(int) Load 313 + 315: 53(ptr) AccessChain 10 46 + 316: 6(int) Load 315 + 317: 6(int) IAdd 316 314 + 318: 53(ptr) AccessChain 10 46 + Store 318 317 + 319: 44(ptr) AccessChain 30(fp2D) 46 + 320: 6(int) Load 319 + 321: 53(ptr) AccessChain 10 68 + 322: 6(int) Load 321 + 323: 6(int) IAdd 322 320 + 324: 53(ptr) AccessChain 10 68 + Store 324 323 + 325: 15 Load 17(sample2D) + 326: 19(fvec2) Load 21(P2) + 327: 19(fvec2) Load 275(dx) + 328: 19(fvec2) Load 277(dy) + 329: 13(float) Load 125(lodClamp) + 330: 11(int) Load 24(granularity) + 332:331(ResType) ImageSampleFootprintNV 325 326 330 27 Grad MinLod 327 328 329 + 333: 7(ivec2) CompositeExtract 332 1 + 334: 34(ptr) AccessChain 30(fp2D) 12 + Store 334 333 + 335: 7(ivec2) CompositeExtract 332 2 + 336: 34(ptr) AccessChain 30(fp2D) 36 + Store 336 335 + 337: 7(ivec2) CompositeExtract 332 3 + 338: 34(ptr) AccessChain 30(fp2D) 39 + Store 338 337 + 339: 6(int) CompositeExtract 332 4 + 340: 44(ptr) AccessChain 30(fp2D) 42 + Store 340 339 + 341: 6(int) CompositeExtract 332 5 + 342: 44(ptr) AccessChain 30(fp2D) 46 + Store 342 341 + 343: 26(bool) CompositeExtract 332 0 + 344: 6(int) Select 343 50 51 + 345: 53(ptr) AccessChain 10 12 + Store 345 344 + 346: 34(ptr) AccessChain 30(fp2D) 12 + 347: 7(ivec2) Load 346 + 348: 57(ptr) AccessChain 10 36 + 349: 7(ivec2) Load 348 + 350: 7(ivec2) IAdd 349 347 + 351: 57(ptr) AccessChain 10 36 + Store 351 350 + 352: 34(ptr) AccessChain 30(fp2D) 36 + 353: 7(ivec2) Load 352 + 354: 57(ptr) AccessChain 10 39 + 355: 7(ivec2) Load 354 + 356: 7(ivec2) IAdd 355 353 + 357: 57(ptr) AccessChain 10 39 + Store 357 356 + 358: 34(ptr) AccessChain 30(fp2D) 39 + 359: 7(ivec2) Load 358 + 360: 57(ptr) AccessChain 10 42 + 361: 7(ivec2) Load 360 + 362: 7(ivec2) IAdd 361 359 + 363: 57(ptr) AccessChain 10 42 + Store 363 362 + 364: 44(ptr) AccessChain 30(fp2D) 42 + 365: 6(int) Load 364 + 366: 53(ptr) AccessChain 10 46 + 367: 6(int) Load 366 + 368: 6(int) IAdd 367 365 + 369: 53(ptr) AccessChain 10 46 + Store 369 368 + 370: 44(ptr) AccessChain 30(fp2D) 46 + 371: 6(int) Load 370 + 372: 53(ptr) AccessChain 10 68 + 373: 6(int) Load 372 + 374: 6(int) IAdd 373 371 + 375: 53(ptr) AccessChain 10 68 + Store 375 374 + 384: 381 Load 383(sample3D) + 388: 385(fvec3) Load 387(P3) + 389: 11(int) Load 24(granularity) + 394:393(ResType) ImageSampleFootprintNV 384 388 389 27 + 395: 376(ivec3) CompositeExtract 394 1 + 397: 396(ptr) AccessChain 392(fp3D) 12 + Store 397 395 + 398: 376(ivec3) CompositeExtract 394 2 + 399: 396(ptr) AccessChain 392(fp3D) 36 + Store 399 398 + 400: 7(ivec2) CompositeExtract 394 3 + 401: 34(ptr) AccessChain 392(fp3D) 39 + Store 401 400 + 402: 6(int) CompositeExtract 394 4 + 403: 44(ptr) AccessChain 392(fp3D) 42 + Store 403 402 + 404: 6(int) CompositeExtract 394 5 + 405: 44(ptr) AccessChain 392(fp3D) 46 + Store 405 404 + 406: 26(bool) CompositeExtract 394 0 + 407: 6(int) Select 406 50 51 + 408: 53(ptr) AccessChain 379 12 + Store 408 407 + 409: 396(ptr) AccessChain 392(fp3D) 12 + 410: 376(ivec3) Load 409 + 412: 411(ptr) AccessChain 379 36 + Store 412 410 + 413: 396(ptr) AccessChain 392(fp3D) 36 + 414: 376(ivec3) Load 413 + 415: 411(ptr) AccessChain 379 39 + Store 415 414 + 416: 34(ptr) AccessChain 392(fp3D) 39 + 417: 7(ivec2) Load 416 + 418: 57(ptr) AccessChain 379 42 + Store 418 417 + 419: 44(ptr) AccessChain 392(fp3D) 42 + 420: 6(int) Load 419 + 421: 53(ptr) AccessChain 379 46 + Store 421 420 + 422: 44(ptr) AccessChain 392(fp3D) 46 + 423: 6(int) Load 422 + 424: 53(ptr) AccessChain 379 68 + Store 424 423 + 425: 381 Load 383(sample3D) + 426: 385(fvec3) Load 387(P3) + 427: 11(int) Load 24(granularity) + 428: 13(float) Load 76(bias) + 430:429(ResType) ImageSampleFootprintNV 425 426 427 27 Bias 428 + 431: 376(ivec3) CompositeExtract 430 1 + 432: 396(ptr) AccessChain 392(fp3D) 12 + Store 432 431 + 433: 376(ivec3) CompositeExtract 430 2 + 434: 396(ptr) AccessChain 392(fp3D) 36 + Store 434 433 + 435: 7(ivec2) CompositeExtract 430 3 + 436: 34(ptr) AccessChain 392(fp3D) 39 + Store 436 435 + 437: 6(int) CompositeExtract 430 4 + 438: 44(ptr) AccessChain 392(fp3D) 42 + Store 438 437 + 439: 6(int) CompositeExtract 430 5 + 440: 44(ptr) AccessChain 392(fp3D) 46 + Store 440 439 + 441: 26(bool) CompositeExtract 430 0 + 442: 6(int) Select 441 50 51 + 443: 53(ptr) AccessChain 379 12 + Store 443 442 + 444: 396(ptr) AccessChain 392(fp3D) 12 + 445: 376(ivec3) Load 444 + 446: 411(ptr) AccessChain 379 36 + 447: 376(ivec3) Load 446 + 448: 376(ivec3) IAdd 447 445 + 449: 411(ptr) AccessChain 379 36 + Store 449 448 + 450: 396(ptr) AccessChain 392(fp3D) 36 + 451: 376(ivec3) Load 450 + 452: 411(ptr) AccessChain 379 39 + 453: 376(ivec3) Load 452 + 454: 376(ivec3) IAdd 453 451 + 455: 411(ptr) AccessChain 379 39 + Store 455 454 + 456: 34(ptr) AccessChain 392(fp3D) 39 + 457: 7(ivec2) Load 456 + 458: 57(ptr) AccessChain 379 42 + 459: 7(ivec2) Load 458 + 460: 7(ivec2) IAdd 459 457 + 461: 57(ptr) AccessChain 379 42 + Store 461 460 + 462: 44(ptr) AccessChain 392(fp3D) 42 + 463: 6(int) Load 462 + 464: 53(ptr) AccessChain 379 46 + 465: 6(int) Load 464 + 466: 6(int) IAdd 465 463 + 467: 53(ptr) AccessChain 379 46 + Store 467 466 + 468: 44(ptr) AccessChain 392(fp3D) 46 + 469: 6(int) Load 468 + 470: 53(ptr) AccessChain 379 68 + 471: 6(int) Load 470 + 472: 6(int) IAdd 471 469 + 473: 53(ptr) AccessChain 379 68 + Store 473 472 + 474: 381 Load 383(sample3D) + 475: 385(fvec3) Load 387(P3) + 476: 13(float) Load 125(lodClamp) + 477: 11(int) Load 24(granularity) + 479:478(ResType) ImageSampleFootprintNV 474 475 477 27 MinLod 476 + 480: 376(ivec3) CompositeExtract 479 1 + 481: 396(ptr) AccessChain 392(fp3D) 12 + Store 481 480 + 482: 376(ivec3) CompositeExtract 479 2 + 483: 396(ptr) AccessChain 392(fp3D) 36 + Store 483 482 + 484: 7(ivec2) CompositeExtract 479 3 + 485: 34(ptr) AccessChain 392(fp3D) 39 + Store 485 484 + 486: 6(int) CompositeExtract 479 4 + 487: 44(ptr) AccessChain 392(fp3D) 42 + Store 487 486 + 488: 6(int) CompositeExtract 479 5 + 489: 44(ptr) AccessChain 392(fp3D) 46 + Store 489 488 + 490: 26(bool) CompositeExtract 479 0 + 491: 6(int) Select 490 50 51 + 492: 53(ptr) AccessChain 379 12 + Store 492 491 + 493: 396(ptr) AccessChain 392(fp3D) 12 + 494: 376(ivec3) Load 493 + 495: 411(ptr) AccessChain 379 36 + 496: 376(ivec3) Load 495 + 497: 376(ivec3) IAdd 496 494 + 498: 411(ptr) AccessChain 379 36 + Store 498 497 + 499: 396(ptr) AccessChain 392(fp3D) 36 + 500: 376(ivec3) Load 499 + 501: 411(ptr) AccessChain 379 39 + 502: 376(ivec3) Load 501 + 503: 376(ivec3) IAdd 502 500 + 504: 411(ptr) AccessChain 379 39 + Store 504 503 + 505: 34(ptr) AccessChain 392(fp3D) 39 + 506: 7(ivec2) Load 505 + 507: 57(ptr) AccessChain 379 42 + 508: 7(ivec2) Load 507 + 509: 7(ivec2) IAdd 508 506 + 510: 57(ptr) AccessChain 379 42 + Store 510 509 + 511: 44(ptr) AccessChain 392(fp3D) 42 + 512: 6(int) Load 511 + 513: 53(ptr) AccessChain 379 46 + 514: 6(int) Load 513 + 515: 6(int) IAdd 514 512 + 516: 53(ptr) AccessChain 379 46 + Store 516 515 + 517: 44(ptr) AccessChain 392(fp3D) 46 + 518: 6(int) Load 517 + 519: 53(ptr) AccessChain 379 68 + 520: 6(int) Load 519 + 521: 6(int) IAdd 520 518 + 522: 53(ptr) AccessChain 379 68 + Store 522 521 + 523: 381 Load 383(sample3D) + 524: 385(fvec3) Load 387(P3) + 525: 13(float) Load 125(lodClamp) + 526: 11(int) Load 24(granularity) + 527: 13(float) Load 76(bias) + 529:528(ResType) ImageSampleFootprintNV 523 524 526 27 Bias MinLod 527 525 + 530: 376(ivec3) CompositeExtract 529 1 + 531: 396(ptr) AccessChain 392(fp3D) 12 + Store 531 530 + 532: 376(ivec3) CompositeExtract 529 2 + 533: 396(ptr) AccessChain 392(fp3D) 36 + Store 533 532 + 534: 7(ivec2) CompositeExtract 529 3 + 535: 34(ptr) AccessChain 392(fp3D) 39 + Store 535 534 + 536: 6(int) CompositeExtract 529 4 + 537: 44(ptr) AccessChain 392(fp3D) 42 + Store 537 536 + 538: 6(int) CompositeExtract 529 5 + 539: 44(ptr) AccessChain 392(fp3D) 46 + Store 539 538 + 540: 26(bool) CompositeExtract 529 0 + 541: 6(int) Select 540 50 51 + 542: 53(ptr) AccessChain 379 12 + Store 542 541 + 543: 396(ptr) AccessChain 392(fp3D) 12 + 544: 376(ivec3) Load 543 + 545: 411(ptr) AccessChain 379 36 + 546: 376(ivec3) Load 545 + 547: 376(ivec3) IAdd 546 544 + 548: 411(ptr) AccessChain 379 36 + Store 548 547 + 549: 396(ptr) AccessChain 392(fp3D) 36 + 550: 376(ivec3) Load 549 + 551: 411(ptr) AccessChain 379 39 + 552: 376(ivec3) Load 551 + 553: 376(ivec3) IAdd 552 550 + 554: 411(ptr) AccessChain 379 39 + Store 554 553 + 555: 34(ptr) AccessChain 392(fp3D) 39 + 556: 7(ivec2) Load 555 + 557: 57(ptr) AccessChain 379 42 + 558: 7(ivec2) Load 557 + 559: 7(ivec2) IAdd 558 556 + 560: 57(ptr) AccessChain 379 42 + Store 560 559 + 561: 44(ptr) AccessChain 392(fp3D) 42 + 562: 6(int) Load 561 + 563: 53(ptr) AccessChain 379 46 + 564: 6(int) Load 563 + 565: 6(int) IAdd 564 562 + 566: 53(ptr) AccessChain 379 46 + Store 566 565 + 567: 44(ptr) AccessChain 392(fp3D) 46 + 568: 6(int) Load 567 + 569: 53(ptr) AccessChain 379 68 + 570: 6(int) Load 569 + 571: 6(int) IAdd 570 568 + 572: 53(ptr) AccessChain 379 68 + Store 572 571 + 573: 381 Load 383(sample3D) + 574: 385(fvec3) Load 387(P3) + 575: 13(float) Load 225(lod) + 576: 11(int) Load 24(granularity) + 578:577(ResType) ImageSampleFootprintNV 573 574 576 27 Lod 575 + 579: 376(ivec3) CompositeExtract 578 1 + 580: 396(ptr) AccessChain 392(fp3D) 12 + Store 580 579 + 581: 376(ivec3) CompositeExtract 578 2 + 582: 396(ptr) AccessChain 392(fp3D) 36 + Store 582 581 + 583: 7(ivec2) CompositeExtract 578 3 + 584: 34(ptr) AccessChain 392(fp3D) 39 + Store 584 583 + 585: 6(int) CompositeExtract 578 4 + 586: 44(ptr) AccessChain 392(fp3D) 42 + Store 586 585 + 587: 6(int) CompositeExtract 578 5 + 588: 44(ptr) AccessChain 392(fp3D) 46 + Store 588 587 + 589: 26(bool) CompositeExtract 578 0 + 590: 6(int) Select 589 50 51 + 591: 53(ptr) AccessChain 379 12 + Store 591 590 + 592: 396(ptr) AccessChain 392(fp3D) 12 + 593: 376(ivec3) Load 592 + 594: 411(ptr) AccessChain 379 36 + 595: 376(ivec3) Load 594 + 596: 376(ivec3) IAdd 595 593 + 597: 411(ptr) AccessChain 379 36 + Store 597 596 + 598: 396(ptr) AccessChain 392(fp3D) 36 + 599: 376(ivec3) Load 598 + 600: 411(ptr) AccessChain 379 39 + 601: 376(ivec3) Load 600 + 602: 376(ivec3) IAdd 601 599 + 603: 411(ptr) AccessChain 379 39 + Store 603 602 + 604: 34(ptr) AccessChain 392(fp3D) 39 + 605: 7(ivec2) Load 604 + 606: 57(ptr) AccessChain 379 42 + 607: 7(ivec2) Load 606 + 608: 7(ivec2) IAdd 607 605 + 609: 57(ptr) AccessChain 379 42 + Store 609 608 + 610: 44(ptr) AccessChain 392(fp3D) 42 + 611: 6(int) Load 610 + 612: 53(ptr) AccessChain 379 46 + 613: 6(int) Load 612 + 614: 6(int) IAdd 613 611 + 615: 53(ptr) AccessChain 379 46 + Store 615 614 + 616: 44(ptr) AccessChain 392(fp3D) 46 + 617: 6(int) Load 616 + 618: 53(ptr) AccessChain 379 68 + 619: 6(int) Load 618 + 620: 6(int) IAdd 619 617 + 621: 53(ptr) AccessChain 379 68 + Store 621 620 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderStencilExport.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderStencilExport.frag.out index a126e96ebe9..8fc691ee1d1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderStencilExport.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shaderStencilExport.frag.out @@ -1,6 +1,6 @@ spv.shaderStencilExport.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 10 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shadingRate.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shadingRate.frag.out new file mode 100644 index 00000000000..11477769b13 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shadingRate.frag.out @@ -0,0 +1,48 @@ +spv.shadingRate.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 21 + + Capability Shader + Capability FragmentDensityEXT + Extension "SPV_NV_shading_rate" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 13 17 19 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_NV_shading_rate_image" + Name 4 "main" + Name 9 "FragmentSize" + Name 13 "gl_FragmentSizeNV" + Name 17 "InvocationsPerPixel" + Name 19 "gl_InvocationsPerPixelNV" + Decorate 9(FragmentSize) Location 0 + Decorate 13(gl_FragmentSizeNV) Flat + Decorate 13(gl_FragmentSizeNV) BuiltIn FragSizeEXT + Decorate 17(InvocationsPerPixel) Location 2 + Decorate 19(gl_InvocationsPerPixelNV) Flat + Decorate 19(gl_InvocationsPerPixelNV) BuiltIn FragInvocationCountEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer Output 7(fvec2) + 9(FragmentSize): 8(ptr) Variable Output + 10: TypeInt 32 1 + 11: TypeVector 10(int) 2 + 12: TypePointer Input 11(ivec2) +13(gl_FragmentSizeNV): 12(ptr) Variable Input + 16: TypePointer Output 10(int) +17(InvocationsPerPixel): 16(ptr) Variable Output + 18: TypePointer Input 10(int) +19(gl_InvocationsPerPixelNV): 18(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 14: 11(ivec2) Load 13(gl_FragmentSizeNV) + 15: 7(fvec2) ConvertSToF 14 + Store 9(FragmentSize) 15 + 20: 10(int) Load 19(gl_InvocationsPerPixelNV) + Store 17(InvocationsPerPixel) 20 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shiftOps.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shiftOps.frag.out index b2bfcad1278..3085a55d452 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shiftOps.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shiftOps.frag.out @@ -1,6 +1,6 @@ spv.shiftOps.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 38 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shortCircuit.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shortCircuit.frag.out index 33eec772282..d651824597a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shortCircuit.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.shortCircuit.frag.out @@ -1,6 +1,6 @@ spv.shortCircuit.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 147 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleFunctionCall.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleFunctionCall.frag.out index 62b42550123..627b31c1a8c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleFunctionCall.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleFunctionCall.frag.out @@ -1,6 +1,6 @@ spv.simpleFunctionCall.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 19 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleMat.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleMat.vert.out index 56933e4c464..85574585454 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleMat.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.simpleMat.vert.out @@ -2,7 +2,7 @@ spv.simpleMat.vert WARNING: 0:3: varying deprecated in version 130; may be removed in future release // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 39 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTexture.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTexture.frag.out index 376a8747519..78a2c2e75ae 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTexture.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTexture.frag.out @@ -1,9 +1,14 @@ spv.sparseTexture.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 438 Capability Shader + Capability ImageGatherExtended Capability StorageImageMultisample Capability SampledRect Capability SparseResidency @@ -182,14 +187,14 @@ spv.sparseTexture.frag 414(i2DMS): 413(ptr) Variable UniformConstant 422: TypePointer Output 11(fvec4) 423(outColor): 422(ptr) Variable Output - 426: TypeBool + 425: TypeBool 4(main): 2 Function None 3 5: Label 8(resident): 7(ptr) Variable Function 13(texel): 12(ptr) Variable Function 18(itexel): 17(ptr) Variable Function 23(utexel): 22(ptr) Variable Function - 424: 12(ptr) Variable Function + 427: 12(ptr) Variable Function Store 8(resident) 9 Store 13(texel) 15 Store 18(itexel) 19 @@ -565,13 +570,13 @@ spv.sparseTexture.frag 420: 6(int) Load 8(resident) 421: 6(int) BitwiseOr 420 419 Store 8(resident) 421 - 425: 6(int) Load 8(resident) - 427: 426(bool) ImageSparseTexelsResident 425 + 424: 6(int) Load 8(resident) + 426: 425(bool) ImageSparseTexelsResident 424 SelectionMerge 429 None - BranchConditional 427 428 431 + BranchConditional 426 428 431 428: Label 430: 11(fvec4) Load 13(texel) - Store 424 430 + Store 427 430 Branch 429 431: Label 432: 16(ivec4) Load 18(itexel) @@ -579,10 +584,10 @@ spv.sparseTexture.frag 434: 21(ivec4) Load 23(utexel) 435: 11(fvec4) ConvertUToF 434 436: 11(fvec4) FAdd 433 435 - Store 424 436 + Store 427 436 Branch 429 429: Label - 437: 11(fvec4) Load 424 + 437: 11(fvec4) Load 427 Store 423(outColor) 437 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out index 21f9583cab8..fe210f7492e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.sparseTextureClamp.frag.out @@ -1,6 +1,10 @@ spv.sparseTextureClamp.frag +error: SPIRV-Tools Validation Errors +error: Capability SampledRect is not allowed by Vulkan 1.0 specification (or requires extension) + OpCapability SampledRect + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 360 Capability Shader @@ -145,14 +149,14 @@ spv.sparseTextureClamp.frag 310: 157(ivec2) ConstantComposite 143 143 344: TypePointer Output 11(fvec4) 345(outColor): 344(ptr) Variable Output - 348: TypeBool + 347: TypeBool 4(main): 2 Function None 3 5: Label 8(resident): 7(ptr) Variable Function 13(texel): 12(ptr) Variable Function 18(itexel): 17(ptr) Variable Function 23(utexel): 22(ptr) Variable Function - 346: 12(ptr) Variable Function + 349: 12(ptr) Variable Function Store 8(resident) 9 Store 13(texel) 15 Store 18(itexel) 19 @@ -442,13 +446,13 @@ spv.sparseTextureClamp.frag 342: 16(ivec4) Load 18(itexel) 343: 16(ivec4) IAdd 342 341 Store 18(itexel) 343 - 347: 6(int) Load 8(resident) - 349: 348(bool) ImageSparseTexelsResident 347 + 346: 6(int) Load 8(resident) + 348: 347(bool) ImageSparseTexelsResident 346 SelectionMerge 351 None - BranchConditional 349 350 353 + BranchConditional 348 350 353 350: Label 352: 11(fvec4) Load 13(texel) - Store 346 352 + Store 349 352 Branch 351 353: Label 354: 16(ivec4) Load 18(itexel) @@ -456,10 +460,10 @@ spv.sparseTextureClamp.frag 356: 21(ivec4) Load 23(utexel) 357: 11(fvec4) ConvertUToF 356 358: 11(fvec4) FAdd 355 357 - Store 346 358 + Store 349 358 Branch 351 351: Label - 359: 11(fvec4) Load 346 + 359: 11(fvec4) Load 349 Store 345(outColor) 359 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out index 766bdaf78db..70fbd09e2e6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out @@ -1,6 +1,6 @@ spv.specConst.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.comp.out index de8411be7d0..b8aa3ddfb22 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.comp.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.comp.out @@ -1,6 +1,6 @@ spv.specConstant.comp // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out index 8dda41d4951..0d47dce7652 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out @@ -1,6 +1,6 @@ spv.specConstant.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 81 Capability Shader @@ -11,7 +11,7 @@ spv.specConstant.vert Source GLSL 400 Name 4 "main" Name 9 "arraySize" - Name 14 "foo(vf4[s1506];" + Name 14 "foo(vf4[s2765];" Name 13 "p" Name 17 "builtin_spec_constant(" Name 20 "color" @@ -64,18 +64,18 @@ spv.specConstant.vert 33: TypeInt 32 0 34(scale): 33(int) SpecConstant 2 38: TypeFloat 64 - 39(spDouble): 38(float) SpecConstant 1413754136 1074340347 + 39(spDouble):38(float64_t) SpecConstant 1413754136 1074340347 40(spFloat): 6(float) SpecConstant 1078523331 - 41: 38(float) SpecConstantOp 115 40(spFloat) + 41:38(float64_t) SpecConstantOp 115 40(spFloat) 50(dupArraySize): 8(int) SpecConstant 12 51: TypeArray 7(fvec4) 50(dupArraySize) 52: TypePointer Input 51 53(dupUcol): 52(ptr) Variable Input 60(spDupBool): 29(bool) SpecConstantTrue 63(dupScale): 33(int) SpecConstant 2 - 67(spDupDouble): 38(float) SpecConstant 1413754136 1074340347 + 67(spDupDouble):38(float64_t) SpecConstant 1413754136 1074340347 68(spDupFloat): 6(float) SpecConstant 1078523331 - 69: 38(float) SpecConstantOp 115 68(spDupFloat) + 69:38(float64_t) SpecConstantOp 115 68(spDupFloat) 75: TypePointer Function 8(int) 77(gl_MaxImageUnits): 8(int) SpecConstant 8 4(main): 2 Function None 3 @@ -94,7 +94,7 @@ spv.specConstant.vert Store 20(color) 37 Branch 32 32: Label - 42: 38(float) FDiv 39(spDouble) 41 + 42:38(float64_t) FDiv 39(spDouble) 41 43: 6(float) FConvert 42 44: 7(fvec4) Load 20(color) 45: 7(fvec4) CompositeConstruct 43 43 43 43 @@ -102,10 +102,10 @@ spv.specConstant.vert Store 20(color) 46 48: 10 Load 22(ucol) Store 47(param) 48 - 49: 2 FunctionCall 14(foo(vf4[s1506];) 47(param) + 49: 2 FunctionCall 14(foo(vf4[s2765];) 47(param) Return FunctionEnd -14(foo(vf4[s1506];): 2 Function None 12 +14(foo(vf4[s2765];): 2 Function None 12 13(p): 11(ptr) FunctionParameter 15: Label 54: 24(ptr) AccessChain 53(dupUcol) 23 @@ -125,7 +125,7 @@ spv.specConstant.vert Store 20(color) 66 Branch 62 62: Label - 70: 38(float) FDiv 67(spDupDouble) 69 + 70:38(float64_t) FDiv 67(spDupDouble) 69 71: 6(float) FConvert 70 72: 7(fvec4) Load 20(color) 73: 7(fvec4) CompositeConstruct 71 71 71 71 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out index 194f567f869..58d4b6a3fd6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out @@ -1,6 +1,6 @@ spv.specConstantComposite.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 43 Capability Shader @@ -41,7 +41,7 @@ spv.specConstantComposite.vert 32: TypePointer Function 14(int) 37(spec_float): 24(float) SpecConstant 1078523331 38: TypeFloat 64 - 39(spec_double): 38(float) SpecConstant 1413754136 1074340347 + 39(spec_double):38(float64_t) SpecConstant 1413754136 1074340347 40: TypeArray 25(fvec4) 28(spec_int) 41: TypePointer Input 40 42(global_vec4_array_with_spec_length): 41(ptr) Variable Input diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out index 429e0682572..0f141e38682 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out @@ -1,6 +1,6 @@ spv.specConstantOperations.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 162 Capability Shader @@ -18,10 +18,68 @@ spv.specConstantOperations.vert Name 42 "sp_uint" Name 43 "sp_sint" Name 45 "sp_double" + Name 46 "float_from_double" + Name 47 "double_from_float" + Name 49 "bool_from_int" + Name 50 "bool_from_uint" + Name 51 "int_from_bool" + Name 53 "uint_from_bool" + Name 54 "sp_uint_from_sint" + Name 55 "sp_sint_from_uint" + Name 56 "negate_int" + Name 57 "not_int" + Name 58 "sp_int_add_two" + Name 61 "sp_int_add_two_sub_three" + Name 63 "sp_int_add_two_sub_four" + Name 64 "sp_sint_mul_two" + Name 66 "sp_uint_mul_two" + Name 68 "sp_sint_mul_two_div_five" + Name 70 "sp_uint_mul_two_div_five" + Name 71 "sp_sint_rem_four" + Name 73 "sp_uint_rem_four" + Name 75 "sp_sint_mul_three_div_five" + Name 77 "sp_sint_shift_right_arithmetic" + Name 79 "sp_uint_shift_right_arithmetic" + Name 80 "sp_sint_shift_left" + Name 81 "sp_uint_shift_left" + Name 83 "sp_sint_or_256" + Name 85 "sp_uint_xor_512" + Name 86 "sp_int_lt_sp_sint" + Name 87 "sp_uint_equal_sp_uint" + Name 88 "sp_int_gt_sp_sint" + Name 91 "iv" + Name 95 "uv" + Name 98 "bv_from_iv" + Name 99 "bv_from_uv" + Name 102 "iv_from_bv" + Name 104 "uv_from_bv" + Name 105 "uv_from_iv" + Name 106 "iv_from_uv" + Name 107 "not_iv" + Name 108 "negate_iv" + Name 110 "iv_add_two" + Name 113 "iv_add_two_sub_three" + Name 115 "iv_add_two_sub_four" + Name 116 "iv_mul_two" + Name 118 "iv_mul_two_div_five" + Name 119 "iv_rem_four" + Name 121 "iv_shift_right_arithmetic" + Name 122 "iv_shift_left" + Name 125 "iv_or_1024" + Name 128 "uv_xor_2048" + Name 129 "iv_x" + Name 131 "iv_yx" + Name 133 "iv_zyx" + Name 134 "iv_yzxw" Name 135 "a" Name 136 "b" Name 137 "c" Name 142 "ternayArray1" + Name 145 "t1" + Name 146 "t2" + Name 148 "t3" + Name 152 "t4" + Name 161 "v2" Decorate 19(sp_int) SpecId 201 Decorate 40(sp_float) SpecId 200 Decorate 42(sp_uint) SpecId 202 @@ -52,96 +110,96 @@ spv.specConstantOperations.vert 42(sp_uint): 41(int) SpecConstant 100 43(sp_sint): 6(int) SpecConstant 4294967286 44: TypeFloat 64 - 45(sp_double): 44(float) SpecConstant 2333366019 1074118410 - 46: 39(float) SpecConstantOp 115 45(sp_double) - 47: 44(float) SpecConstantOp 115 40(sp_float) + 45(sp_double):44(float64_t) SpecConstant 2333366019 1074118410 +46(float_from_double): 39(float) SpecConstantOp 115 45(sp_double) +47(double_from_float):44(float64_t) SpecConstantOp 115 40(sp_float) 48: 41(int) Constant 0 - 49: 22(bool) SpecConstantOp 171 19(sp_int) 48 - 50: 22(bool) SpecConstantOp 171 42(sp_uint) 48 - 51: 6(int) SpecConstantOp 169 49 32 12 +49(bool_from_int): 22(bool) SpecConstantOp 171 19(sp_int) 48 +50(bool_from_uint): 22(bool) SpecConstantOp 171 42(sp_uint) 48 +51(int_from_bool): 6(int) SpecConstantOp 169 49(bool_from_int) 32 12 52: 41(int) Constant 1 - 53: 41(int) SpecConstantOp 169 49 52 48 - 54: 41(int) SpecConstantOp 128 43(sp_sint) 48 - 55: 6(int) SpecConstantOp 128 42(sp_uint) 48 - 56: 6(int) SpecConstantOp 126 19(sp_int) - 57: 6(int) SpecConstantOp 200 19(sp_int) - 58: 6(int) SpecConstantOp 128 19(sp_int) 20 +53(uint_from_bool): 41(int) SpecConstantOp 169 49(bool_from_int) 52 48 +54(sp_uint_from_sint): 41(int) SpecConstantOp 128 43(sp_sint) 48 +55(sp_sint_from_uint): 6(int) SpecConstantOp 128 42(sp_uint) 48 + 56(negate_int): 6(int) SpecConstantOp 126 19(sp_int) + 57(not_int): 6(int) SpecConstantOp 200 19(sp_int) +58(sp_int_add_two): 6(int) SpecConstantOp 128 19(sp_int) 20 59: 6(int) SpecConstantOp 128 19(sp_int) 20 60: 6(int) Constant 3 - 61: 6(int) SpecConstantOp 130 59 60 +61(sp_int_add_two_sub_three): 6(int) SpecConstantOp 130 59 60 62: 6(int) Constant 4 - 63: 6(int) SpecConstantOp 130 58 62 - 64: 6(int) SpecConstantOp 132 43(sp_sint) 20 +63(sp_int_add_two_sub_four): 6(int) SpecConstantOp 130 58(sp_int_add_two) 62 +64(sp_sint_mul_two): 6(int) SpecConstantOp 132 43(sp_sint) 20 65: 41(int) Constant 2 - 66: 41(int) SpecConstantOp 132 42(sp_uint) 65 +66(sp_uint_mul_two): 41(int) SpecConstantOp 132 42(sp_uint) 65 67: 6(int) Constant 5 - 68: 6(int) SpecConstantOp 135 64 67 +68(sp_sint_mul_two_div_five): 6(int) SpecConstantOp 135 64(sp_sint_mul_two) 67 69: 41(int) Constant 5 - 70: 41(int) SpecConstantOp 134 66 69 - 71: 6(int) SpecConstantOp 139 43(sp_sint) 62 +70(sp_uint_mul_two_div_five): 41(int) SpecConstantOp 134 66(sp_uint_mul_two) 69 +71(sp_sint_rem_four): 6(int) SpecConstantOp 139 43(sp_sint) 62 72: 41(int) Constant 4 - 73: 41(int) SpecConstantOp 137 42(sp_uint) 72 +73(sp_uint_rem_four): 41(int) SpecConstantOp 137 42(sp_uint) 72 74: 6(int) SpecConstantOp 132 43(sp_sint) 60 - 75: 6(int) SpecConstantOp 135 74 67 +75(sp_sint_mul_three_div_five): 6(int) SpecConstantOp 135 74 67 76: 6(int) Constant 10 - 77: 6(int) SpecConstantOp 195 43(sp_sint) 76 +77(sp_sint_shift_right_arithmetic): 6(int) SpecConstantOp 195 43(sp_sint) 76 78: 6(int) Constant 20 - 79: 41(int) SpecConstantOp 194 42(sp_uint) 78 - 80: 6(int) SpecConstantOp 196 43(sp_sint) 32 - 81: 41(int) SpecConstantOp 196 42(sp_uint) 20 +79(sp_uint_shift_right_arithmetic): 41(int) SpecConstantOp 194 42(sp_uint) 78 +80(sp_sint_shift_left): 6(int) SpecConstantOp 196 43(sp_sint) 32 +81(sp_uint_shift_left): 41(int) SpecConstantOp 196 42(sp_uint) 20 82: 6(int) Constant 256 - 83: 6(int) SpecConstantOp 197 43(sp_sint) 82 +83(sp_sint_or_256): 6(int) SpecConstantOp 197 43(sp_sint) 82 84: 41(int) Constant 512 - 85: 41(int) SpecConstantOp 198 42(sp_uint) 84 - 86: 22(bool) SpecConstantOp 177 19(sp_int) 43(sp_sint) - 87: 22(bool) SpecConstantOp 170 42(sp_uint) 42(sp_uint) - 88: 22(bool) SpecConstantOp 173 19(sp_int) 43(sp_sint) +85(sp_uint_xor_512): 41(int) SpecConstantOp 198 42(sp_uint) 84 +86(sp_int_lt_sp_sint): 22(bool) SpecConstantOp 177 19(sp_int) 43(sp_sint) +87(sp_uint_equal_sp_uint): 22(bool) SpecConstantOp 170 42(sp_uint) 42(sp_uint) +88(sp_int_gt_sp_sint): 22(bool) SpecConstantOp 173 19(sp_int) 43(sp_sint) 89: 6(int) Constant 30 90: TypeVector 6(int) 4 - 91: 90(ivec4) SpecConstantComposite 78 89 19(sp_int) 19(sp_int) + 91(iv): 90(ivec4) SpecConstantComposite 78 89 19(sp_int) 19(sp_int) 92: 41(int) Constant 4294967295 93: 41(int) Constant 4294967294 94: TypeVector 41(int) 4 - 95: 94(ivec4) SpecConstantComposite 42(sp_uint) 42(sp_uint) 92 93 + 95(uv): 94(ivec4) SpecConstantComposite 42(sp_uint) 42(sp_uint) 92 93 96: TypeVector 22(bool) 4 97: 94(ivec4) ConstantComposite 48 48 48 48 - 98: 96(bvec4) SpecConstantOp 171 91 97 - 99: 96(bvec4) SpecConstantOp 171 95 97 + 98(bv_from_iv): 96(bvec4) SpecConstantOp 171 91(iv) 97 + 99(bv_from_uv): 96(bvec4) SpecConstantOp 171 95(uv) 97 100: 90(ivec4) ConstantComposite 12 12 12 12 101: 90(ivec4) ConstantComposite 32 32 32 32 - 102: 90(ivec4) SpecConstantOp 169 98 101 100 + 102(iv_from_bv): 90(ivec4) SpecConstantOp 169 98(bv_from_iv) 101 100 103: 94(ivec4) ConstantComposite 52 52 52 52 - 104: 94(ivec4) SpecConstantOp 169 98 103 97 - 105: 94(ivec4) SpecConstantOp 128 91 97 - 106: 90(ivec4) SpecConstantOp 128 95 97 - 107: 90(ivec4) SpecConstantOp 200 91 - 108: 90(ivec4) SpecConstantOp 126 91 + 104(uv_from_bv): 94(ivec4) SpecConstantOp 169 98(bv_from_iv) 103 97 + 105(uv_from_iv): 94(ivec4) SpecConstantOp 128 91(iv) 97 + 106(iv_from_uv): 90(ivec4) SpecConstantOp 128 95(uv) 97 + 107(not_iv): 90(ivec4) SpecConstantOp 200 91(iv) + 108(negate_iv): 90(ivec4) SpecConstantOp 126 91(iv) 109: 90(ivec4) ConstantComposite 20 20 20 20 - 110: 90(ivec4) SpecConstantOp 128 91 109 - 111: 90(ivec4) SpecConstantOp 128 91 109 + 110(iv_add_two): 90(ivec4) SpecConstantOp 128 91(iv) 109 + 111: 90(ivec4) SpecConstantOp 128 91(iv) 109 112: 90(ivec4) ConstantComposite 60 60 60 60 - 113: 90(ivec4) SpecConstantOp 130 111 112 +113(iv_add_two_sub_three): 90(ivec4) SpecConstantOp 130 111 112 114: 90(ivec4) ConstantComposite 62 62 62 62 - 115: 90(ivec4) SpecConstantOp 130 113 114 - 116: 90(ivec4) SpecConstantOp 132 91 109 +115(iv_add_two_sub_four): 90(ivec4) SpecConstantOp 130 113(iv_add_two_sub_three) 114 + 116(iv_mul_two): 90(ivec4) SpecConstantOp 132 91(iv) 109 117: 90(ivec4) ConstantComposite 67 67 67 67 - 118: 90(ivec4) SpecConstantOp 135 116 117 - 119: 90(ivec4) SpecConstantOp 139 91 114 +118(iv_mul_two_div_five): 90(ivec4) SpecConstantOp 135 116(iv_mul_two) 117 +119(iv_rem_four): 90(ivec4) SpecConstantOp 139 91(iv) 114 120: 90(ivec4) ConstantComposite 76 76 76 76 - 121: 90(ivec4) SpecConstantOp 195 91 120 - 122: 90(ivec4) SpecConstantOp 196 91 109 +121(iv_shift_right_arithmetic): 90(ivec4) SpecConstantOp 195 91(iv) 120 +122(iv_shift_left): 90(ivec4) SpecConstantOp 196 91(iv) 109 123: 6(int) Constant 1024 124: 90(ivec4) ConstantComposite 123 123 123 123 - 125: 90(ivec4) SpecConstantOp 197 91 124 + 125(iv_or_1024): 90(ivec4) SpecConstantOp 197 91(iv) 124 126: 41(int) Constant 2048 127: 94(ivec4) ConstantComposite 126 126 126 126 - 128: 94(ivec4) SpecConstantOp 198 95 127 - 129: 6(int) SpecConstantOp 81 91 0 +128(uv_xor_2048): 94(ivec4) SpecConstantOp 198 95(uv) 127 + 129(iv_x): 6(int) SpecConstantOp 81 91(iv) 0 130: TypeVector 6(int) 2 - 131: 130(ivec2) SpecConstantOp 79 91 91 1(GLSL.std.450) 0 + 131(iv_yx): 130(ivec2) SpecConstantOp 79 91(iv) 91(iv) 1(GLSL.std.450) 0 132: TypeVector 6(int) 3 - 133: 132(ivec3) SpecConstantOp 79 91 91 2 1(GLSL.std.450) 0 - 134: 90(ivec4) SpecConstantOp 79 91 91 1(GLSL.std.450) 2 0 3 + 133(iv_zyx): 132(ivec3) SpecConstantOp 79 91(iv) 91(iv) 2 1(GLSL.std.450) 0 + 134(iv_yzxw): 90(ivec4) SpecConstantOp 79 91(iv) 91(iv) 1(GLSL.std.450) 2 0 3 135(a): 6(int) SpecConstant 4 136(b): 6(int) SpecConstant 6 137(c): 22(bool) SpecConstantTrue @@ -152,14 +210,14 @@ spv.specConstantOperations.vert 142(ternayArray1): 141(ptr) Variable Private 143: 6(int) Constant 13 144: 6(int) Constant 17 - 145: 6(int) SpecConstantOp 169 137(c) 143 144 - 146: 6(int) SpecConstantOp 169 137(c) 135(a) 144 + 145(t1): 6(int) SpecConstantOp 169 137(c) 143 144 + 146(t2): 6(int) SpecConstantOp 169 137(c) 135(a) 144 147: 22(bool) ConstantTrue - 148: 6(int) SpecConstantOp 169 147 135(a) 144 + 148(t3): 6(int) SpecConstantOp 169 147 135(a) 144 149: 22(bool) SpecConstantOp 173 135(a) 136(b) 150: 6(int) SpecConstantOp 128 143 135(a) 151: 6(int) SpecConstantOp 132 144 136(b) - 152: 6(int) SpecConstantOp 169 149 150 151 + 152(t4): 6(int) SpecConstantOp 169 149 150 151 153: 22(bool) SpecConstantOp 168 137(c) 154: TypeVector 39(float) 2 155: 39(float) Constant 1065353216 @@ -168,7 +226,7 @@ spv.specConstantOperations.vert 158: 154(fvec2) ConstantComposite 157 157 159: TypeVector 22(bool) 2 160: 159(bvec2) SpecConstantComposite 153 153 - 161: 154(fvec2) SpecConstantOp 169 160 156 158 + 161(v2): 154(fvec2) SpecConstantOp 169 160 156 158 4(main): 2 Function None 3 5: Label Return diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out index 02de2cb25cc..40afa15f1c6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssbo.autoassign.frag.out @@ -1,6 +1,6 @@ spv.ssbo.autoassign.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 99 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssboAlias.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssboAlias.frag.out index 876646d8e45..f03d2ca9a93 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssboAlias.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.ssboAlias.frag.out @@ -1,12 +1,12 @@ spv.ssboAlias.frag // Module Version 10000 -// Generated by (magic number): 80002 -// Id's are bound by 46 +// Generated by (magic number): 80007 +// Id's are bound by 44 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 43 + EntryPoint Fragment 4 "main" 41 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -17,10 +17,10 @@ spv.ssboAlias.frag Name 18 "Buf1@count" MemberName 18(Buf1@count) 0 "@count" Name 20 "Buf1@count" - Name 30 "Buf2" - Name 31 "Buf2@count" - Name 43 "@entryPointOutput" - Name 45 "Buf3" + Name 28 "Buf2" + Name 29 "Buf2@count" + Name 41 "@entryPointOutput" + Name 43 "Buf3" Decorate 12 ArrayStride 4 MemberDecorate 13(Buf1) 0 Offset 0 Decorate 13(Buf1) BufferBlock @@ -30,13 +30,13 @@ spv.ssboAlias.frag Decorate 18(Buf1@count) BufferBlock Decorate 20(Buf1@count) DescriptorSet 0 Decorate 20(Buf1@count) Binding 83 - Decorate 30(Buf2) DescriptorSet 0 - Decorate 30(Buf2) Binding 85 - Decorate 31(Buf2@count) DescriptorSet 0 - Decorate 31(Buf2@count) Binding 86 - Decorate 43(@entryPointOutput) Location 0 - Decorate 45(Buf3) DescriptorSet 0 - Decorate 45(Buf3) Binding 84 + Decorate 28(Buf2) DescriptorSet 0 + Decorate 28(Buf2) Binding 85 + Decorate 29(Buf2@count) DescriptorSet 0 + Decorate 29(Buf2@count) Binding 86 + Decorate 41(@entryPointOutput) Location 0 + Decorate 43(Buf3) DescriptorSet 0 + Decorate 43(Buf3) Binding 84 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -49,40 +49,38 @@ spv.ssboAlias.frag 15(Buf1): 14(ptr) Variable Uniform 16: TypeInt 32 1 17: 16(int) Constant 0 - 18(Buf1@count): TypeStruct 16(int) + 18(Buf1@count): TypeStruct 11(int) 19: TypePointer Uniform 18(Buf1@count) 20(Buf1@count): 19(ptr) Variable Uniform - 21: TypePointer Uniform 16(int) - 23: 16(int) Constant 1 - 24: 11(int) Constant 1 - 25: 11(int) Constant 0 - 27: 11(int) Constant 10 - 28: TypePointer Uniform 11(int) - 30(Buf2): 14(ptr) Variable Uniform - 31(Buf2@count): 19(ptr) Variable Uniform - 34: 11(int) Constant 20 - 36: 6(float) Constant 1065353216 - 37: 6(float) Constant 1077936128 - 38: 6(float) Constant 1084227584 - 39: 7(fvec4) ConstantComposite 36 37 38 36 - 42: TypePointer Output 7(fvec4) -43(@entryPointOutput): 42(ptr) Variable Output - 45(Buf3): 14(ptr) Variable Uniform + 21: TypePointer Uniform 11(int) + 23: 11(int) Constant 1 + 24: 11(int) Constant 0 + 26: 11(int) Constant 10 + 28(Buf2): 14(ptr) Variable Uniform + 29(Buf2@count): 19(ptr) Variable Uniform + 32: 11(int) Constant 20 + 34: 6(float) Constant 1065353216 + 35: 6(float) Constant 1077936128 + 36: 6(float) Constant 1084227584 + 37: 7(fvec4) ConstantComposite 34 35 36 34 + 40: TypePointer Output 7(fvec4) +41(@entryPointOutput): 40(ptr) Variable Output + 43(Buf3): 14(ptr) Variable Uniform 4(main): 2 Function None 3 5: Label - 44: 7(fvec4) FunctionCall 9(@main() - Store 43(@entryPointOutput) 44 + 42: 7(fvec4) FunctionCall 9(@main() + Store 41(@entryPointOutput) 42 Return FunctionEnd 9(@main(): 7(fvec4) Function None 8 10: Label 22: 21(ptr) AccessChain 20(Buf1@count) 17 - 26: 11(int) AtomicIAdd 22 24 25 23 - 29: 28(ptr) AccessChain 15(Buf1) 17 26 - Store 29 27 - 32: 21(ptr) AccessChain 31(Buf2@count) 17 - 33: 11(int) AtomicIAdd 32 24 25 23 - 35: 28(ptr) AccessChain 30(Buf2) 17 33 - Store 35 34 - ReturnValue 39 + 25: 11(int) AtomicIAdd 22 23 24 23 + 27: 21(ptr) AccessChain 15(Buf1) 17 25 + Store 27 26 + 30: 21(ptr) AccessChain 29(Buf2@count) 17 + 31: 11(int) AtomicIAdd 30 23 24 23 + 33: 21(ptr) AccessChain 28(Buf2) 17 31 + Store 33 32 + ReturnValue 37 FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out index b2c9b39b2ba..732e5b4ca61 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.tesc.out @@ -1,6 +1,10 @@ spv.stereoViewRendering.tesc +error: SPIRV-Tools Validation Errors +error: When BuiltIn decoration is applied to a structure-type member, all members of that structure type must also be decorated with BuiltIn (No allowed mixing of built-in variables and non-built-in variables within a single structure). Structure id 27 does not meet this requirement. + %gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1 %v4float + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 38 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.vert.out index f2b22d5f5b7..afd8c75a27f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.stereoViewRendering.vert.out @@ -1,6 +1,6 @@ spv.stereoViewRendering.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 27 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.storageBuffer.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.storageBuffer.vert.out index b8b7e9410e6..71c3bf28b34 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.storageBuffer.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.storageBuffer.vert.out @@ -1,6 +1,6 @@ spv.storageBuffer.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 31 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structAssignment.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structAssignment.frag.out index b107de2bd74..ec771cc367e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structAssignment.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structAssignment.frag.out @@ -3,7 +3,7 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to "precision mediump int; precision highp float;" // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structDeref.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structDeref.frag.out index fb55c71ac8f..a7915b40298 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structDeref.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structDeref.frag.out @@ -1,6 +1,6 @@ spv.structDeref.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 123 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structure.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structure.frag.out index 5672196e964..0592084b904 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structure.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.structure.frag.out @@ -1,6 +1,6 @@ spv.structure.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 60 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.frag.out new file mode 100644 index 00000000000..4dd636e5a20 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.frag.out @@ -0,0 +1,44 @@ +spv.subgroup.frag +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 17 + + Capability Shader + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 11 13 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 9 "data" + Name 11 "gl_SubgroupSize" + Name 13 "gl_SubgroupInvocationID" + Decorate 9(data) Location 0 + Decorate 11(gl_SubgroupSize) RelaxedPrecision + Decorate 11(gl_SubgroupSize) Flat + Decorate 11(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 12 RelaxedPrecision + Decorate 13(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 13(gl_SubgroupInvocationID) Flat + Decorate 13(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 14 RelaxedPrecision + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 4 + 8: TypePointer Output 7(ivec4) + 9(data): 8(ptr) Variable Output + 10: TypePointer Input 6(int) +11(gl_SubgroupSize): 10(ptr) Variable Input +13(gl_SubgroupInvocationID): 10(ptr) Variable Input + 15: 6(int) Constant 0 + 4(main): 2 Function None 3 + 5: Label + 12: 6(int) Load 11(gl_SubgroupSize) + 14: 6(int) Load 13(gl_SubgroupInvocationID) + 16: 7(ivec4) CompositeConstruct 12 14 15 15 + Store 9(data) 16 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.geom.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.geom.out new file mode 100644 index 00000000000..a68343af6b3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.geom.out @@ -0,0 +1,62 @@ +spv.subgroup.geom +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 26 + + Capability Geometry + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Geometry 4 "main" 15 18 20 + ExecutionMode 4 InputPoints + ExecutionMode 4 Invocations 1 + ExecutionMode 4 OutputPoints + ExecutionMode 4 OutputVertices 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 9 "Output" + MemberName 9(Output) 0 "result" + Name 11 "" + Name 15 "gl_PrimitiveIDIn" + Name 18 "gl_SubgroupSize" + Name 20 "gl_SubgroupInvocationID" + Decorate 8 ArrayStride 16 + MemberDecorate 9(Output) 0 Offset 0 + Decorate 9(Output) Block + Decorate 11 DescriptorSet 0 + Decorate 11 Binding 0 + Decorate 15(gl_PrimitiveIDIn) BuiltIn PrimitiveId + Decorate 18(gl_SubgroupSize) RelaxedPrecision + Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 19 RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 21 RelaxedPrecision + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 4 + 8: TypeRuntimeArray 7(ivec4) + 9(Output): TypeStruct 8 + 10: TypePointer StorageBuffer 9(Output) + 11: 10(ptr) Variable StorageBuffer + 12: TypeInt 32 1 + 13: 12(int) Constant 0 + 14: TypePointer Input 12(int) +15(gl_PrimitiveIDIn): 14(ptr) Variable Input + 17: TypePointer Input 6(int) +18(gl_SubgroupSize): 17(ptr) Variable Input +20(gl_SubgroupInvocationID): 17(ptr) Variable Input + 22: 6(int) Constant 0 + 24: TypePointer StorageBuffer 7(ivec4) + 4(main): 2 Function None 3 + 5: Label + 16: 12(int) Load 15(gl_PrimitiveIDIn) + 19: 6(int) Load 18(gl_SubgroupSize) + 21: 6(int) Load 20(gl_SubgroupInvocationID) + 23: 7(ivec4) CompositeConstruct 19 21 22 22 + 25: 24(ptr) AccessChain 11 13 16 + Store 25 23 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.tesc.out new file mode 100644 index 00000000000..4e362e2dda0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.tesc.out @@ -0,0 +1,59 @@ +spv.subgroup.tesc +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 26 + + Capability Tessellation + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint TessellationControl 4 "main" 15 18 20 + ExecutionMode 4 OutputVertices 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 9 "Output" + MemberName 9(Output) 0 "result" + Name 11 "" + Name 15 "gl_PrimitiveID" + Name 18 "gl_SubgroupSize" + Name 20 "gl_SubgroupInvocationID" + Decorate 8 ArrayStride 16 + MemberDecorate 9(Output) 0 Offset 0 + Decorate 9(Output) Block + Decorate 11 DescriptorSet 0 + Decorate 11 Binding 0 + Decorate 15(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 18(gl_SubgroupSize) RelaxedPrecision + Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 19 RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 21 RelaxedPrecision + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 4 + 8: TypeRuntimeArray 7(ivec4) + 9(Output): TypeStruct 8 + 10: TypePointer StorageBuffer 9(Output) + 11: 10(ptr) Variable StorageBuffer + 12: TypeInt 32 1 + 13: 12(int) Constant 0 + 14: TypePointer Input 12(int) +15(gl_PrimitiveID): 14(ptr) Variable Input + 17: TypePointer Input 6(int) +18(gl_SubgroupSize): 17(ptr) Variable Input +20(gl_SubgroupInvocationID): 17(ptr) Variable Input + 22: 6(int) Constant 0 + 24: TypePointer StorageBuffer 7(ivec4) + 4(main): 2 Function None 3 + 5: Label + 16: 12(int) Load 15(gl_PrimitiveID) + 19: 6(int) Load 18(gl_SubgroupSize) + 21: 6(int) Load 20(gl_SubgroupInvocationID) + 23: 7(ivec4) CompositeConstruct 19 21 22 22 + 25: 24(ptr) AccessChain 11 13 16 + Store 25 23 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.tese.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.tese.out new file mode 100644 index 00000000000..e09f558d580 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.tese.out @@ -0,0 +1,61 @@ +spv.subgroup.tese +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 26 + + Capability Tessellation + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint TessellationEvaluation 4 "main" 15 18 20 + ExecutionMode 4 Isolines + ExecutionMode 4 SpacingEqual + ExecutionMode 4 VertexOrderCcw + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 9 "Output" + MemberName 9(Output) 0 "result" + Name 11 "" + Name 15 "gl_PrimitiveID" + Name 18 "gl_SubgroupSize" + Name 20 "gl_SubgroupInvocationID" + Decorate 8 ArrayStride 16 + MemberDecorate 9(Output) 0 Offset 0 + Decorate 9(Output) Block + Decorate 11 DescriptorSet 0 + Decorate 11 Binding 0 + Decorate 15(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 18(gl_SubgroupSize) RelaxedPrecision + Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 19 RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 21 RelaxedPrecision + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 4 + 8: TypeRuntimeArray 7(ivec4) + 9(Output): TypeStruct 8 + 10: TypePointer StorageBuffer 9(Output) + 11: 10(ptr) Variable StorageBuffer + 12: TypeInt 32 1 + 13: 12(int) Constant 0 + 14: TypePointer Input 12(int) +15(gl_PrimitiveID): 14(ptr) Variable Input + 17: TypePointer Input 6(int) +18(gl_SubgroupSize): 17(ptr) Variable Input +20(gl_SubgroupInvocationID): 17(ptr) Variable Input + 22: 6(int) Constant 0 + 24: TypePointer StorageBuffer 7(ivec4) + 4(main): 2 Function None 3 + 5: Label + 16: 12(int) Load 15(gl_PrimitiveID) + 19: 6(int) Load 18(gl_SubgroupSize) + 21: 6(int) Load 20(gl_SubgroupInvocationID) + 23: 7(ivec4) CompositeConstruct 19 21 22 22 + 25: 24(ptr) AccessChain 11 13 16 + Store 25 23 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.vert.out new file mode 100644 index 00000000000..2fbc92ba217 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroup.vert.out @@ -0,0 +1,58 @@ +spv.subgroup.vert +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 26 + + Capability Shader + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 15 18 20 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 9 "Output" + MemberName 9(Output) 0 "result" + Name 11 "" + Name 15 "gl_VertexIndex" + Name 18 "gl_SubgroupSize" + Name 20 "gl_SubgroupInvocationID" + Decorate 8 ArrayStride 16 + MemberDecorate 9(Output) 0 Offset 0 + Decorate 9(Output) Block + Decorate 11 DescriptorSet 0 + Decorate 11 Binding 0 + Decorate 15(gl_VertexIndex) BuiltIn VertexIndex + Decorate 18(gl_SubgroupSize) RelaxedPrecision + Decorate 18(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 19 RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 20(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 21 RelaxedPrecision + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypeVector 6(int) 4 + 8: TypeRuntimeArray 7(ivec4) + 9(Output): TypeStruct 8 + 10: TypePointer StorageBuffer 9(Output) + 11: 10(ptr) Variable StorageBuffer + 12: TypeInt 32 1 + 13: 12(int) Constant 0 + 14: TypePointer Input 12(int) +15(gl_VertexIndex): 14(ptr) Variable Input + 17: TypePointer Input 6(int) +18(gl_SubgroupSize): 17(ptr) Variable Input +20(gl_SubgroupInvocationID): 17(ptr) Variable Input + 22: 6(int) Constant 0 + 24: TypePointer StorageBuffer 7(ivec4) + 4(main): 2 Function None 3 + 5: Label + 16: 12(int) Load 15(gl_VertexIndex) + 19: 6(int) Load 18(gl_SubgroupSize) + 21: 6(int) Load 20(gl_SubgroupInvocationID) + 23: 7(ivec4) CompositeConstruct 19 21 22 22 + 25: 24(ptr) AccessChain 11 13 16 + Store 25 23 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupArithmetic.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupArithmetic.comp.out new file mode 100644 index 00000000000..f4e251a0c05 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupArithmetic.comp.out @@ -0,0 +1,2428 @@ +spv.subgroupArithmetic.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 2085 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformArithmetic + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_arithmetic" + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 24 "Buffers" + MemberName 24(Buffers) 0 "f4" + MemberName 24(Buffers) 1 "i4" + MemberName 24(Buffers) 2 "u4" + MemberName 24(Buffers) 3 "d4" + Name 27 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 24(Buffers) 0 Offset 0 + MemberDecorate 24(Buffers) 1 Offset 16 + MemberDecorate 24(Buffers) 2 Offset 32 + MemberDecorate 24(Buffers) 3 Offset 64 + Decorate 24(Buffers) Block + Decorate 27(data) DescriptorSet 0 + Decorate 27(data) Binding 0 + Decorate 2084 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeFloat 32 + 18: TypeVector 17(float) 4 + 19: TypeInt 32 1 + 20: TypeVector 19(int) 4 + 21: TypeVector 6(int) 4 + 22: TypeFloat 64 + 23: TypeVector 22(float64_t) 4 + 24(Buffers): TypeStruct 18(fvec4) 20(ivec4) 21(ivec4) 23(f64vec4) + 25: TypeArray 24(Buffers) 15 + 26: TypePointer StorageBuffer 25 + 27(data): 26(ptr) Variable StorageBuffer + 29: 19(int) Constant 0 + 30: 6(int) Constant 0 + 31: TypePointer StorageBuffer 17(float) + 34: 6(int) Constant 3 + 38: 19(int) Constant 1 + 39: TypeVector 17(float) 2 + 40: TypePointer StorageBuffer 18(fvec4) + 49: 19(int) Constant 2 + 50: TypeVector 17(float) 3 + 59: 19(int) Constant 3 + 65: TypePointer StorageBuffer 19(int) + 71: TypeVector 19(int) 2 + 72: TypePointer StorageBuffer 20(ivec4) + 81: TypeVector 19(int) 3 + 95: TypePointer StorageBuffer 6(int) + 101: TypeVector 6(int) 2 + 102: TypePointer StorageBuffer 21(ivec4) + 111: TypeVector 6(int) 3 + 125: TypePointer StorageBuffer 22(float64_t) + 131: TypeVector 22(float64_t) 2 + 132: TypePointer StorageBuffer 23(f64vec4) + 141: TypeVector 22(float64_t) 3 + 521: TypeBool + 530: 71(ivec2) ConstantComposite 29 29 + 531: TypeVector 521(bool) 2 + 534: 71(ivec2) ConstantComposite 38 38 + 543: 81(ivec3) ConstantComposite 29 29 29 + 544: TypeVector 521(bool) 3 + 547: 81(ivec3) ConstantComposite 38 38 38 + 555: 20(ivec4) ConstantComposite 29 29 29 29 + 556: TypeVector 521(bool) 4 + 559: 20(ivec4) ConstantComposite 38 38 38 38 + 2082: 6(int) Constant 8 + 2083: 6(int) Constant 1 + 2084: 111(ivec3) ConstantComposite 2082 2083 2083 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 28: 6(int) Load 8(invocation) + 32: 31(ptr) AccessChain 27(data) 29 29 30 + 33: 17(float) Load 32 + 35: 17(float) GroupNonUniformFAdd 34 Reduce 33 + 36: 31(ptr) AccessChain 27(data) 28 29 30 + Store 36 35 + 37: 6(int) Load 8(invocation) + 41: 40(ptr) AccessChain 27(data) 38 29 + 42: 18(fvec4) Load 41 + 43: 39(fvec2) VectorShuffle 42 42 0 1 + 44: 39(fvec2) GroupNonUniformFAdd 34 Reduce 43 + 45: 40(ptr) AccessChain 27(data) 37 29 + 46: 18(fvec4) Load 45 + 47: 18(fvec4) VectorShuffle 46 44 4 5 2 3 + Store 45 47 + 48: 6(int) Load 8(invocation) + 51: 40(ptr) AccessChain 27(data) 49 29 + 52: 18(fvec4) Load 51 + 53: 50(fvec3) VectorShuffle 52 52 0 1 2 + 54: 50(fvec3) GroupNonUniformFAdd 34 Reduce 53 + 55: 40(ptr) AccessChain 27(data) 48 29 + 56: 18(fvec4) Load 55 + 57: 18(fvec4) VectorShuffle 56 54 4 5 6 3 + Store 55 57 + 58: 6(int) Load 8(invocation) + 60: 40(ptr) AccessChain 27(data) 59 29 + 61: 18(fvec4) Load 60 + 62: 18(fvec4) GroupNonUniformFAdd 34 Reduce 61 + 63: 40(ptr) AccessChain 27(data) 58 29 + Store 63 62 + 64: 6(int) Load 8(invocation) + 66: 65(ptr) AccessChain 27(data) 29 38 30 + 67: 19(int) Load 66 + 68: 19(int) GroupNonUniformIAdd 34 Reduce 67 + 69: 65(ptr) AccessChain 27(data) 64 38 30 + Store 69 68 + 70: 6(int) Load 8(invocation) + 73: 72(ptr) AccessChain 27(data) 38 38 + 74: 20(ivec4) Load 73 + 75: 71(ivec2) VectorShuffle 74 74 0 1 + 76: 71(ivec2) GroupNonUniformIAdd 34 Reduce 75 + 77: 72(ptr) AccessChain 27(data) 70 38 + 78: 20(ivec4) Load 77 + 79: 20(ivec4) VectorShuffle 78 76 4 5 2 3 + Store 77 79 + 80: 6(int) Load 8(invocation) + 82: 72(ptr) AccessChain 27(data) 49 38 + 83: 20(ivec4) Load 82 + 84: 81(ivec3) VectorShuffle 83 83 0 1 2 + 85: 81(ivec3) GroupNonUniformIAdd 34 Reduce 84 + 86: 72(ptr) AccessChain 27(data) 80 38 + 87: 20(ivec4) Load 86 + 88: 20(ivec4) VectorShuffle 87 85 4 5 6 3 + Store 86 88 + 89: 6(int) Load 8(invocation) + 90: 72(ptr) AccessChain 27(data) 59 38 + 91: 20(ivec4) Load 90 + 92: 20(ivec4) GroupNonUniformIAdd 34 Reduce 91 + 93: 72(ptr) AccessChain 27(data) 89 38 + Store 93 92 + 94: 6(int) Load 8(invocation) + 96: 95(ptr) AccessChain 27(data) 29 49 30 + 97: 6(int) Load 96 + 98: 6(int) GroupNonUniformIAdd 34 Reduce 97 + 99: 95(ptr) AccessChain 27(data) 94 49 30 + Store 99 98 + 100: 6(int) Load 8(invocation) + 103: 102(ptr) AccessChain 27(data) 38 49 + 104: 21(ivec4) Load 103 + 105: 101(ivec2) VectorShuffle 104 104 0 1 + 106: 101(ivec2) GroupNonUniformIAdd 34 Reduce 105 + 107: 102(ptr) AccessChain 27(data) 100 49 + 108: 21(ivec4) Load 107 + 109: 21(ivec4) VectorShuffle 108 106 4 5 2 3 + Store 107 109 + 110: 6(int) Load 8(invocation) + 112: 102(ptr) AccessChain 27(data) 49 49 + 113: 21(ivec4) Load 112 + 114: 111(ivec3) VectorShuffle 113 113 0 1 2 + 115: 111(ivec3) GroupNonUniformIAdd 34 Reduce 114 + 116: 102(ptr) AccessChain 27(data) 110 49 + 117: 21(ivec4) Load 116 + 118: 21(ivec4) VectorShuffle 117 115 4 5 6 3 + Store 116 118 + 119: 6(int) Load 8(invocation) + 120: 102(ptr) AccessChain 27(data) 59 49 + 121: 21(ivec4) Load 120 + 122: 21(ivec4) GroupNonUniformIAdd 34 Reduce 121 + 123: 102(ptr) AccessChain 27(data) 119 49 + Store 123 122 + 124: 6(int) Load 8(invocation) + 126: 125(ptr) AccessChain 27(data) 29 59 30 + 127:22(float64_t) Load 126 + 128:22(float64_t) GroupNonUniformFAdd 34 Reduce 127 + 129: 125(ptr) AccessChain 27(data) 124 59 30 + Store 129 128 + 130: 6(int) Load 8(invocation) + 133: 132(ptr) AccessChain 27(data) 38 59 + 134: 23(f64vec4) Load 133 + 135:131(f64vec2) VectorShuffle 134 134 0 1 + 136:131(f64vec2) GroupNonUniformFAdd 34 Reduce 135 + 137: 132(ptr) AccessChain 27(data) 130 59 + 138: 23(f64vec4) Load 137 + 139: 23(f64vec4) VectorShuffle 138 136 4 5 2 3 + Store 137 139 + 140: 6(int) Load 8(invocation) + 142: 132(ptr) AccessChain 27(data) 49 59 + 143: 23(f64vec4) Load 142 + 144:141(f64vec3) VectorShuffle 143 143 0 1 2 + 145:141(f64vec3) GroupNonUniformFAdd 34 Reduce 144 + 146: 132(ptr) AccessChain 27(data) 140 59 + 147: 23(f64vec4) Load 146 + 148: 23(f64vec4) VectorShuffle 147 145 4 5 6 3 + Store 146 148 + 149: 6(int) Load 8(invocation) + 150: 132(ptr) AccessChain 27(data) 59 59 + 151: 23(f64vec4) Load 150 + 152: 23(f64vec4) GroupNonUniformFAdd 34 Reduce 151 + 153: 132(ptr) AccessChain 27(data) 149 59 + Store 153 152 + 154: 6(int) Load 8(invocation) + 155: 31(ptr) AccessChain 27(data) 29 29 30 + 156: 17(float) Load 155 + 157: 17(float) GroupNonUniformFMul 34 Reduce 156 + 158: 31(ptr) AccessChain 27(data) 154 29 30 + Store 158 157 + 159: 6(int) Load 8(invocation) + 160: 40(ptr) AccessChain 27(data) 38 29 + 161: 18(fvec4) Load 160 + 162: 39(fvec2) VectorShuffle 161 161 0 1 + 163: 39(fvec2) GroupNonUniformFMul 34 Reduce 162 + 164: 40(ptr) AccessChain 27(data) 159 29 + 165: 18(fvec4) Load 164 + 166: 18(fvec4) VectorShuffle 165 163 4 5 2 3 + Store 164 166 + 167: 6(int) Load 8(invocation) + 168: 40(ptr) AccessChain 27(data) 49 29 + 169: 18(fvec4) Load 168 + 170: 50(fvec3) VectorShuffle 169 169 0 1 2 + 171: 50(fvec3) GroupNonUniformFMul 34 Reduce 170 + 172: 40(ptr) AccessChain 27(data) 167 29 + 173: 18(fvec4) Load 172 + 174: 18(fvec4) VectorShuffle 173 171 4 5 6 3 + Store 172 174 + 175: 6(int) Load 8(invocation) + 176: 40(ptr) AccessChain 27(data) 59 29 + 177: 18(fvec4) Load 176 + 178: 18(fvec4) GroupNonUniformFMul 34 Reduce 177 + 179: 40(ptr) AccessChain 27(data) 175 29 + Store 179 178 + 180: 6(int) Load 8(invocation) + 181: 65(ptr) AccessChain 27(data) 29 38 30 + 182: 19(int) Load 181 + 183: 19(int) GroupNonUniformIMul 34 Reduce 182 + 184: 65(ptr) AccessChain 27(data) 180 38 30 + Store 184 183 + 185: 6(int) Load 8(invocation) + 186: 72(ptr) AccessChain 27(data) 38 38 + 187: 20(ivec4) Load 186 + 188: 71(ivec2) VectorShuffle 187 187 0 1 + 189: 71(ivec2) GroupNonUniformIMul 34 Reduce 188 + 190: 72(ptr) AccessChain 27(data) 185 38 + 191: 20(ivec4) Load 190 + 192: 20(ivec4) VectorShuffle 191 189 4 5 2 3 + Store 190 192 + 193: 6(int) Load 8(invocation) + 194: 72(ptr) AccessChain 27(data) 49 38 + 195: 20(ivec4) Load 194 + 196: 81(ivec3) VectorShuffle 195 195 0 1 2 + 197: 81(ivec3) GroupNonUniformIMul 34 Reduce 196 + 198: 72(ptr) AccessChain 27(data) 193 38 + 199: 20(ivec4) Load 198 + 200: 20(ivec4) VectorShuffle 199 197 4 5 6 3 + Store 198 200 + 201: 6(int) Load 8(invocation) + 202: 72(ptr) AccessChain 27(data) 59 38 + 203: 20(ivec4) Load 202 + 204: 20(ivec4) GroupNonUniformIMul 34 Reduce 203 + 205: 72(ptr) AccessChain 27(data) 201 38 + Store 205 204 + 206: 6(int) Load 8(invocation) + 207: 95(ptr) AccessChain 27(data) 29 49 30 + 208: 6(int) Load 207 + 209: 6(int) GroupNonUniformIMul 34 Reduce 208 + 210: 95(ptr) AccessChain 27(data) 206 49 30 + Store 210 209 + 211: 6(int) Load 8(invocation) + 212: 102(ptr) AccessChain 27(data) 38 49 + 213: 21(ivec4) Load 212 + 214: 101(ivec2) VectorShuffle 213 213 0 1 + 215: 101(ivec2) GroupNonUniformIMul 34 Reduce 214 + 216: 102(ptr) AccessChain 27(data) 211 49 + 217: 21(ivec4) Load 216 + 218: 21(ivec4) VectorShuffle 217 215 4 5 2 3 + Store 216 218 + 219: 6(int) Load 8(invocation) + 220: 102(ptr) AccessChain 27(data) 49 49 + 221: 21(ivec4) Load 220 + 222: 111(ivec3) VectorShuffle 221 221 0 1 2 + 223: 111(ivec3) GroupNonUniformIMul 34 Reduce 222 + 224: 102(ptr) AccessChain 27(data) 219 49 + 225: 21(ivec4) Load 224 + 226: 21(ivec4) VectorShuffle 225 223 4 5 6 3 + Store 224 226 + 227: 6(int) Load 8(invocation) + 228: 102(ptr) AccessChain 27(data) 59 49 + 229: 21(ivec4) Load 228 + 230: 21(ivec4) GroupNonUniformIMul 34 Reduce 229 + 231: 102(ptr) AccessChain 27(data) 227 49 + Store 231 230 + 232: 6(int) Load 8(invocation) + 233: 125(ptr) AccessChain 27(data) 29 59 30 + 234:22(float64_t) Load 233 + 235:22(float64_t) GroupNonUniformFMul 34 Reduce 234 + 236: 125(ptr) AccessChain 27(data) 232 59 30 + Store 236 235 + 237: 6(int) Load 8(invocation) + 238: 132(ptr) AccessChain 27(data) 38 59 + 239: 23(f64vec4) Load 238 + 240:131(f64vec2) VectorShuffle 239 239 0 1 + 241:131(f64vec2) GroupNonUniformFMul 34 Reduce 240 + 242: 132(ptr) AccessChain 27(data) 237 59 + 243: 23(f64vec4) Load 242 + 244: 23(f64vec4) VectorShuffle 243 241 4 5 2 3 + Store 242 244 + 245: 6(int) Load 8(invocation) + 246: 132(ptr) AccessChain 27(data) 49 59 + 247: 23(f64vec4) Load 246 + 248:141(f64vec3) VectorShuffle 247 247 0 1 2 + 249:141(f64vec3) GroupNonUniformFMul 34 Reduce 248 + 250: 132(ptr) AccessChain 27(data) 245 59 + 251: 23(f64vec4) Load 250 + 252: 23(f64vec4) VectorShuffle 251 249 4 5 6 3 + Store 250 252 + 253: 6(int) Load 8(invocation) + 254: 132(ptr) AccessChain 27(data) 59 59 + 255: 23(f64vec4) Load 254 + 256: 23(f64vec4) GroupNonUniformFMul 34 Reduce 255 + 257: 132(ptr) AccessChain 27(data) 253 59 + Store 257 256 + 258: 6(int) Load 8(invocation) + 259: 31(ptr) AccessChain 27(data) 29 29 30 + 260: 17(float) Load 259 + 261: 17(float) GroupNonUniformFMin 34 Reduce 260 + 262: 31(ptr) AccessChain 27(data) 258 29 30 + Store 262 261 + 263: 6(int) Load 8(invocation) + 264: 40(ptr) AccessChain 27(data) 38 29 + 265: 18(fvec4) Load 264 + 266: 39(fvec2) VectorShuffle 265 265 0 1 + 267: 39(fvec2) GroupNonUniformFMin 34 Reduce 266 + 268: 40(ptr) AccessChain 27(data) 263 29 + 269: 18(fvec4) Load 268 + 270: 18(fvec4) VectorShuffle 269 267 4 5 2 3 + Store 268 270 + 271: 6(int) Load 8(invocation) + 272: 40(ptr) AccessChain 27(data) 49 29 + 273: 18(fvec4) Load 272 + 274: 50(fvec3) VectorShuffle 273 273 0 1 2 + 275: 50(fvec3) GroupNonUniformFMin 34 Reduce 274 + 276: 40(ptr) AccessChain 27(data) 271 29 + 277: 18(fvec4) Load 276 + 278: 18(fvec4) VectorShuffle 277 275 4 5 6 3 + Store 276 278 + 279: 6(int) Load 8(invocation) + 280: 40(ptr) AccessChain 27(data) 59 29 + 281: 18(fvec4) Load 280 + 282: 18(fvec4) GroupNonUniformFMin 34 Reduce 281 + 283: 40(ptr) AccessChain 27(data) 279 29 + Store 283 282 + 284: 6(int) Load 8(invocation) + 285: 65(ptr) AccessChain 27(data) 29 38 30 + 286: 19(int) Load 285 + 287: 19(int) GroupNonUniformSMin 34 Reduce 286 + 288: 65(ptr) AccessChain 27(data) 284 38 30 + Store 288 287 + 289: 6(int) Load 8(invocation) + 290: 72(ptr) AccessChain 27(data) 38 38 + 291: 20(ivec4) Load 290 + 292: 71(ivec2) VectorShuffle 291 291 0 1 + 293: 71(ivec2) GroupNonUniformSMin 34 Reduce 292 + 294: 72(ptr) AccessChain 27(data) 289 38 + 295: 20(ivec4) Load 294 + 296: 20(ivec4) VectorShuffle 295 293 4 5 2 3 + Store 294 296 + 297: 6(int) Load 8(invocation) + 298: 72(ptr) AccessChain 27(data) 49 38 + 299: 20(ivec4) Load 298 + 300: 81(ivec3) VectorShuffle 299 299 0 1 2 + 301: 81(ivec3) GroupNonUniformSMin 34 Reduce 300 + 302: 72(ptr) AccessChain 27(data) 297 38 + 303: 20(ivec4) Load 302 + 304: 20(ivec4) VectorShuffle 303 301 4 5 6 3 + Store 302 304 + 305: 6(int) Load 8(invocation) + 306: 72(ptr) AccessChain 27(data) 59 38 + 307: 20(ivec4) Load 306 + 308: 20(ivec4) GroupNonUniformSMin 34 Reduce 307 + 309: 72(ptr) AccessChain 27(data) 305 38 + Store 309 308 + 310: 6(int) Load 8(invocation) + 311: 95(ptr) AccessChain 27(data) 29 49 30 + 312: 6(int) Load 311 + 313: 6(int) GroupNonUniformUMin 34 Reduce 312 + 314: 95(ptr) AccessChain 27(data) 310 49 30 + Store 314 313 + 315: 6(int) Load 8(invocation) + 316: 102(ptr) AccessChain 27(data) 38 49 + 317: 21(ivec4) Load 316 + 318: 101(ivec2) VectorShuffle 317 317 0 1 + 319: 101(ivec2) GroupNonUniformUMin 34 Reduce 318 + 320: 102(ptr) AccessChain 27(data) 315 49 + 321: 21(ivec4) Load 320 + 322: 21(ivec4) VectorShuffle 321 319 4 5 2 3 + Store 320 322 + 323: 6(int) Load 8(invocation) + 324: 102(ptr) AccessChain 27(data) 49 49 + 325: 21(ivec4) Load 324 + 326: 111(ivec3) VectorShuffle 325 325 0 1 2 + 327: 111(ivec3) GroupNonUniformUMin 34 Reduce 326 + 328: 102(ptr) AccessChain 27(data) 323 49 + 329: 21(ivec4) Load 328 + 330: 21(ivec4) VectorShuffle 329 327 4 5 6 3 + Store 328 330 + 331: 6(int) Load 8(invocation) + 332: 102(ptr) AccessChain 27(data) 59 49 + 333: 21(ivec4) Load 332 + 334: 21(ivec4) GroupNonUniformUMin 34 Reduce 333 + 335: 102(ptr) AccessChain 27(data) 331 49 + Store 335 334 + 336: 6(int) Load 8(invocation) + 337: 125(ptr) AccessChain 27(data) 29 59 30 + 338:22(float64_t) Load 337 + 339:22(float64_t) GroupNonUniformFMin 34 Reduce 338 + 340: 125(ptr) AccessChain 27(data) 336 59 30 + Store 340 339 + 341: 6(int) Load 8(invocation) + 342: 132(ptr) AccessChain 27(data) 38 59 + 343: 23(f64vec4) Load 342 + 344:131(f64vec2) VectorShuffle 343 343 0 1 + 345:131(f64vec2) GroupNonUniformFMin 34 Reduce 344 + 346: 132(ptr) AccessChain 27(data) 341 59 + 347: 23(f64vec4) Load 346 + 348: 23(f64vec4) VectorShuffle 347 345 4 5 2 3 + Store 346 348 + 349: 6(int) Load 8(invocation) + 350: 132(ptr) AccessChain 27(data) 49 59 + 351: 23(f64vec4) Load 350 + 352:141(f64vec3) VectorShuffle 351 351 0 1 2 + 353:141(f64vec3) GroupNonUniformFMin 34 Reduce 352 + 354: 132(ptr) AccessChain 27(data) 349 59 + 355: 23(f64vec4) Load 354 + 356: 23(f64vec4) VectorShuffle 355 353 4 5 6 3 + Store 354 356 + 357: 6(int) Load 8(invocation) + 358: 132(ptr) AccessChain 27(data) 59 59 + 359: 23(f64vec4) Load 358 + 360: 23(f64vec4) GroupNonUniformFMin 34 Reduce 359 + 361: 132(ptr) AccessChain 27(data) 357 59 + Store 361 360 + 362: 6(int) Load 8(invocation) + 363: 31(ptr) AccessChain 27(data) 29 29 30 + 364: 17(float) Load 363 + 365: 17(float) GroupNonUniformFMax 34 Reduce 364 + 366: 31(ptr) AccessChain 27(data) 362 29 30 + Store 366 365 + 367: 6(int) Load 8(invocation) + 368: 40(ptr) AccessChain 27(data) 38 29 + 369: 18(fvec4) Load 368 + 370: 39(fvec2) VectorShuffle 369 369 0 1 + 371: 39(fvec2) GroupNonUniformFMax 34 Reduce 370 + 372: 40(ptr) AccessChain 27(data) 367 29 + 373: 18(fvec4) Load 372 + 374: 18(fvec4) VectorShuffle 373 371 4 5 2 3 + Store 372 374 + 375: 6(int) Load 8(invocation) + 376: 40(ptr) AccessChain 27(data) 49 29 + 377: 18(fvec4) Load 376 + 378: 50(fvec3) VectorShuffle 377 377 0 1 2 + 379: 50(fvec3) GroupNonUniformFMax 34 Reduce 378 + 380: 40(ptr) AccessChain 27(data) 375 29 + 381: 18(fvec4) Load 380 + 382: 18(fvec4) VectorShuffle 381 379 4 5 6 3 + Store 380 382 + 383: 6(int) Load 8(invocation) + 384: 40(ptr) AccessChain 27(data) 59 29 + 385: 18(fvec4) Load 384 + 386: 18(fvec4) GroupNonUniformFMax 34 Reduce 385 + 387: 40(ptr) AccessChain 27(data) 383 29 + Store 387 386 + 388: 6(int) Load 8(invocation) + 389: 65(ptr) AccessChain 27(data) 29 38 30 + 390: 19(int) Load 389 + 391: 19(int) GroupNonUniformSMax 34 Reduce 390 + 392: 65(ptr) AccessChain 27(data) 388 38 30 + Store 392 391 + 393: 6(int) Load 8(invocation) + 394: 72(ptr) AccessChain 27(data) 38 38 + 395: 20(ivec4) Load 394 + 396: 71(ivec2) VectorShuffle 395 395 0 1 + 397: 71(ivec2) GroupNonUniformSMax 34 Reduce 396 + 398: 72(ptr) AccessChain 27(data) 393 38 + 399: 20(ivec4) Load 398 + 400: 20(ivec4) VectorShuffle 399 397 4 5 2 3 + Store 398 400 + 401: 6(int) Load 8(invocation) + 402: 72(ptr) AccessChain 27(data) 49 38 + 403: 20(ivec4) Load 402 + 404: 81(ivec3) VectorShuffle 403 403 0 1 2 + 405: 81(ivec3) GroupNonUniformSMax 34 Reduce 404 + 406: 72(ptr) AccessChain 27(data) 401 38 + 407: 20(ivec4) Load 406 + 408: 20(ivec4) VectorShuffle 407 405 4 5 6 3 + Store 406 408 + 409: 6(int) Load 8(invocation) + 410: 72(ptr) AccessChain 27(data) 59 38 + 411: 20(ivec4) Load 410 + 412: 20(ivec4) GroupNonUniformSMax 34 Reduce 411 + 413: 72(ptr) AccessChain 27(data) 409 38 + Store 413 412 + 414: 6(int) Load 8(invocation) + 415: 95(ptr) AccessChain 27(data) 29 49 30 + 416: 6(int) Load 415 + 417: 6(int) GroupNonUniformUMax 34 Reduce 416 + 418: 95(ptr) AccessChain 27(data) 414 49 30 + Store 418 417 + 419: 6(int) Load 8(invocation) + 420: 102(ptr) AccessChain 27(data) 38 49 + 421: 21(ivec4) Load 420 + 422: 101(ivec2) VectorShuffle 421 421 0 1 + 423: 101(ivec2) GroupNonUniformUMax 34 Reduce 422 + 424: 102(ptr) AccessChain 27(data) 419 49 + 425: 21(ivec4) Load 424 + 426: 21(ivec4) VectorShuffle 425 423 4 5 2 3 + Store 424 426 + 427: 6(int) Load 8(invocation) + 428: 102(ptr) AccessChain 27(data) 49 49 + 429: 21(ivec4) Load 428 + 430: 111(ivec3) VectorShuffle 429 429 0 1 2 + 431: 111(ivec3) GroupNonUniformUMax 34 Reduce 430 + 432: 102(ptr) AccessChain 27(data) 427 49 + 433: 21(ivec4) Load 432 + 434: 21(ivec4) VectorShuffle 433 431 4 5 6 3 + Store 432 434 + 435: 6(int) Load 8(invocation) + 436: 102(ptr) AccessChain 27(data) 59 49 + 437: 21(ivec4) Load 436 + 438: 21(ivec4) GroupNonUniformUMax 34 Reduce 437 + 439: 102(ptr) AccessChain 27(data) 435 49 + Store 439 438 + 440: 6(int) Load 8(invocation) + 441: 125(ptr) AccessChain 27(data) 29 59 30 + 442:22(float64_t) Load 441 + 443:22(float64_t) GroupNonUniformFMax 34 Reduce 442 + 444: 125(ptr) AccessChain 27(data) 440 59 30 + Store 444 443 + 445: 6(int) Load 8(invocation) + 446: 132(ptr) AccessChain 27(data) 38 59 + 447: 23(f64vec4) Load 446 + 448:131(f64vec2) VectorShuffle 447 447 0 1 + 449:131(f64vec2) GroupNonUniformFMax 34 Reduce 448 + 450: 132(ptr) AccessChain 27(data) 445 59 + 451: 23(f64vec4) Load 450 + 452: 23(f64vec4) VectorShuffle 451 449 4 5 2 3 + Store 450 452 + 453: 6(int) Load 8(invocation) + 454: 132(ptr) AccessChain 27(data) 49 59 + 455: 23(f64vec4) Load 454 + 456:141(f64vec3) VectorShuffle 455 455 0 1 2 + 457:141(f64vec3) GroupNonUniformFMax 34 Reduce 456 + 458: 132(ptr) AccessChain 27(data) 453 59 + 459: 23(f64vec4) Load 458 + 460: 23(f64vec4) VectorShuffle 459 457 4 5 6 3 + Store 458 460 + 461: 6(int) Load 8(invocation) + 462: 132(ptr) AccessChain 27(data) 59 59 + 463: 23(f64vec4) Load 462 + 464: 23(f64vec4) GroupNonUniformFMax 34 Reduce 463 + 465: 132(ptr) AccessChain 27(data) 461 59 + Store 465 464 + 466: 6(int) Load 8(invocation) + 467: 65(ptr) AccessChain 27(data) 29 38 30 + 468: 19(int) Load 467 + 469: 19(int) GroupNonUniformBitwiseAnd 34 Reduce 468 + 470: 65(ptr) AccessChain 27(data) 466 38 30 + Store 470 469 + 471: 6(int) Load 8(invocation) + 472: 72(ptr) AccessChain 27(data) 38 38 + 473: 20(ivec4) Load 472 + 474: 71(ivec2) VectorShuffle 473 473 0 1 + 475: 71(ivec2) GroupNonUniformBitwiseAnd 34 Reduce 474 + 476: 72(ptr) AccessChain 27(data) 471 38 + 477: 20(ivec4) Load 476 + 478: 20(ivec4) VectorShuffle 477 475 4 5 2 3 + Store 476 478 + 479: 6(int) Load 8(invocation) + 480: 72(ptr) AccessChain 27(data) 49 38 + 481: 20(ivec4) Load 480 + 482: 81(ivec3) VectorShuffle 481 481 0 1 2 + 483: 81(ivec3) GroupNonUniformBitwiseAnd 34 Reduce 482 + 484: 72(ptr) AccessChain 27(data) 479 38 + 485: 20(ivec4) Load 484 + 486: 20(ivec4) VectorShuffle 485 483 4 5 6 3 + Store 484 486 + 487: 6(int) Load 8(invocation) + 488: 72(ptr) AccessChain 27(data) 59 38 + 489: 20(ivec4) Load 488 + 490: 20(ivec4) GroupNonUniformBitwiseAnd 34 Reduce 489 + 491: 72(ptr) AccessChain 27(data) 487 38 + Store 491 490 + 492: 6(int) Load 8(invocation) + 493: 95(ptr) AccessChain 27(data) 29 49 30 + 494: 6(int) Load 493 + 495: 6(int) GroupNonUniformBitwiseAnd 34 Reduce 494 + 496: 95(ptr) AccessChain 27(data) 492 49 30 + Store 496 495 + 497: 6(int) Load 8(invocation) + 498: 102(ptr) AccessChain 27(data) 38 49 + 499: 21(ivec4) Load 498 + 500: 101(ivec2) VectorShuffle 499 499 0 1 + 501: 101(ivec2) GroupNonUniformBitwiseAnd 34 Reduce 500 + 502: 102(ptr) AccessChain 27(data) 497 49 + 503: 21(ivec4) Load 502 + 504: 21(ivec4) VectorShuffle 503 501 4 5 2 3 + Store 502 504 + 505: 6(int) Load 8(invocation) + 506: 102(ptr) AccessChain 27(data) 49 49 + 507: 21(ivec4) Load 506 + 508: 111(ivec3) VectorShuffle 507 507 0 1 2 + 509: 111(ivec3) GroupNonUniformBitwiseAnd 34 Reduce 508 + 510: 102(ptr) AccessChain 27(data) 505 49 + 511: 21(ivec4) Load 510 + 512: 21(ivec4) VectorShuffle 511 509 4 5 6 3 + Store 510 512 + 513: 6(int) Load 8(invocation) + 514: 102(ptr) AccessChain 27(data) 59 49 + 515: 21(ivec4) Load 514 + 516: 21(ivec4) GroupNonUniformBitwiseAnd 34 Reduce 515 + 517: 102(ptr) AccessChain 27(data) 513 49 + Store 517 516 + 518: 6(int) Load 8(invocation) + 519: 65(ptr) AccessChain 27(data) 29 38 30 + 520: 19(int) Load 519 + 522: 521(bool) SLessThan 520 29 + 523: 521(bool) GroupNonUniformLogicalAnd 34 Reduce 522 + 524: 19(int) Select 523 38 29 + 525: 65(ptr) AccessChain 27(data) 518 38 30 + Store 525 524 + 526: 6(int) Load 8(invocation) + 527: 72(ptr) AccessChain 27(data) 38 38 + 528: 20(ivec4) Load 527 + 529: 71(ivec2) VectorShuffle 528 528 0 1 + 532: 531(bvec2) SLessThan 529 530 + 533: 531(bvec2) GroupNonUniformLogicalAnd 34 Reduce 532 + 535: 71(ivec2) Select 533 534 530 + 536: 72(ptr) AccessChain 27(data) 526 38 + 537: 20(ivec4) Load 536 + 538: 20(ivec4) VectorShuffle 537 535 4 5 2 3 + Store 536 538 + 539: 6(int) Load 8(invocation) + 540: 72(ptr) AccessChain 27(data) 38 38 + 541: 20(ivec4) Load 540 + 542: 81(ivec3) VectorShuffle 541 541 0 1 2 + 545: 544(bvec3) SLessThan 542 543 + 546: 544(bvec3) GroupNonUniformLogicalAnd 34 Reduce 545 + 548: 81(ivec3) Select 546 547 543 + 549: 72(ptr) AccessChain 27(data) 539 38 + 550: 20(ivec4) Load 549 + 551: 20(ivec4) VectorShuffle 550 548 4 5 6 3 + Store 549 551 + 552: 6(int) Load 8(invocation) + 553: 72(ptr) AccessChain 27(data) 38 38 + 554: 20(ivec4) Load 553 + 557: 556(bvec4) SLessThan 554 555 + 558: 556(bvec4) GroupNonUniformLogicalAnd 34 Reduce 557 + 560: 20(ivec4) Select 558 559 555 + 561: 72(ptr) AccessChain 27(data) 552 38 + Store 561 560 + 562: 6(int) Load 8(invocation) + 563: 65(ptr) AccessChain 27(data) 29 38 30 + 564: 19(int) Load 563 + 565: 19(int) GroupNonUniformBitwiseOr 34 Reduce 564 + 566: 65(ptr) AccessChain 27(data) 562 38 30 + Store 566 565 + 567: 6(int) Load 8(invocation) + 568: 72(ptr) AccessChain 27(data) 38 38 + 569: 20(ivec4) Load 568 + 570: 71(ivec2) VectorShuffle 569 569 0 1 + 571: 71(ivec2) GroupNonUniformBitwiseOr 34 Reduce 570 + 572: 72(ptr) AccessChain 27(data) 567 38 + 573: 20(ivec4) Load 572 + 574: 20(ivec4) VectorShuffle 573 571 4 5 2 3 + Store 572 574 + 575: 6(int) Load 8(invocation) + 576: 72(ptr) AccessChain 27(data) 49 38 + 577: 20(ivec4) Load 576 + 578: 81(ivec3) VectorShuffle 577 577 0 1 2 + 579: 81(ivec3) GroupNonUniformBitwiseOr 34 Reduce 578 + 580: 72(ptr) AccessChain 27(data) 575 38 + 581: 20(ivec4) Load 580 + 582: 20(ivec4) VectorShuffle 581 579 4 5 6 3 + Store 580 582 + 583: 6(int) Load 8(invocation) + 584: 72(ptr) AccessChain 27(data) 59 38 + 585: 20(ivec4) Load 584 + 586: 20(ivec4) GroupNonUniformBitwiseOr 34 Reduce 585 + 587: 72(ptr) AccessChain 27(data) 583 38 + Store 587 586 + 588: 6(int) Load 8(invocation) + 589: 95(ptr) AccessChain 27(data) 29 49 30 + 590: 6(int) Load 589 + 591: 6(int) GroupNonUniformBitwiseOr 34 Reduce 590 + 592: 95(ptr) AccessChain 27(data) 588 49 30 + Store 592 591 + 593: 6(int) Load 8(invocation) + 594: 102(ptr) AccessChain 27(data) 38 49 + 595: 21(ivec4) Load 594 + 596: 101(ivec2) VectorShuffle 595 595 0 1 + 597: 101(ivec2) GroupNonUniformBitwiseOr 34 Reduce 596 + 598: 102(ptr) AccessChain 27(data) 593 49 + 599: 21(ivec4) Load 598 + 600: 21(ivec4) VectorShuffle 599 597 4 5 2 3 + Store 598 600 + 601: 6(int) Load 8(invocation) + 602: 102(ptr) AccessChain 27(data) 49 49 + 603: 21(ivec4) Load 602 + 604: 111(ivec3) VectorShuffle 603 603 0 1 2 + 605: 111(ivec3) GroupNonUniformBitwiseOr 34 Reduce 604 + 606: 102(ptr) AccessChain 27(data) 601 49 + 607: 21(ivec4) Load 606 + 608: 21(ivec4) VectorShuffle 607 605 4 5 6 3 + Store 606 608 + 609: 6(int) Load 8(invocation) + 610: 102(ptr) AccessChain 27(data) 59 49 + 611: 21(ivec4) Load 610 + 612: 21(ivec4) GroupNonUniformBitwiseOr 34 Reduce 611 + 613: 102(ptr) AccessChain 27(data) 609 49 + Store 613 612 + 614: 6(int) Load 8(invocation) + 615: 65(ptr) AccessChain 27(data) 29 38 30 + 616: 19(int) Load 615 + 617: 521(bool) SLessThan 616 29 + 618: 521(bool) GroupNonUniformLogicalOr 34 Reduce 617 + 619: 19(int) Select 618 38 29 + 620: 65(ptr) AccessChain 27(data) 614 38 30 + Store 620 619 + 621: 6(int) Load 8(invocation) + 622: 72(ptr) AccessChain 27(data) 38 38 + 623: 20(ivec4) Load 622 + 624: 71(ivec2) VectorShuffle 623 623 0 1 + 625: 531(bvec2) SLessThan 624 530 + 626: 531(bvec2) GroupNonUniformLogicalOr 34 Reduce 625 + 627: 71(ivec2) Select 626 534 530 + 628: 72(ptr) AccessChain 27(data) 621 38 + 629: 20(ivec4) Load 628 + 630: 20(ivec4) VectorShuffle 629 627 4 5 2 3 + Store 628 630 + 631: 6(int) Load 8(invocation) + 632: 72(ptr) AccessChain 27(data) 38 38 + 633: 20(ivec4) Load 632 + 634: 81(ivec3) VectorShuffle 633 633 0 1 2 + 635: 544(bvec3) SLessThan 634 543 + 636: 544(bvec3) GroupNonUniformLogicalOr 34 Reduce 635 + 637: 81(ivec3) Select 636 547 543 + 638: 72(ptr) AccessChain 27(data) 631 38 + 639: 20(ivec4) Load 638 + 640: 20(ivec4) VectorShuffle 639 637 4 5 6 3 + Store 638 640 + 641: 6(int) Load 8(invocation) + 642: 72(ptr) AccessChain 27(data) 38 38 + 643: 20(ivec4) Load 642 + 644: 556(bvec4) SLessThan 643 555 + 645: 556(bvec4) GroupNonUniformLogicalOr 34 Reduce 644 + 646: 20(ivec4) Select 645 559 555 + 647: 72(ptr) AccessChain 27(data) 641 38 + Store 647 646 + 648: 6(int) Load 8(invocation) + 649: 65(ptr) AccessChain 27(data) 29 38 30 + 650: 19(int) Load 649 + 651: 19(int) GroupNonUniformBitwiseXor 34 Reduce 650 + 652: 65(ptr) AccessChain 27(data) 648 38 30 + Store 652 651 + 653: 6(int) Load 8(invocation) + 654: 72(ptr) AccessChain 27(data) 38 38 + 655: 20(ivec4) Load 654 + 656: 71(ivec2) VectorShuffle 655 655 0 1 + 657: 71(ivec2) GroupNonUniformBitwiseXor 34 Reduce 656 + 658: 72(ptr) AccessChain 27(data) 653 38 + 659: 20(ivec4) Load 658 + 660: 20(ivec4) VectorShuffle 659 657 4 5 2 3 + Store 658 660 + 661: 6(int) Load 8(invocation) + 662: 72(ptr) AccessChain 27(data) 49 38 + 663: 20(ivec4) Load 662 + 664: 81(ivec3) VectorShuffle 663 663 0 1 2 + 665: 81(ivec3) GroupNonUniformBitwiseXor 34 Reduce 664 + 666: 72(ptr) AccessChain 27(data) 661 38 + 667: 20(ivec4) Load 666 + 668: 20(ivec4) VectorShuffle 667 665 4 5 6 3 + Store 666 668 + 669: 6(int) Load 8(invocation) + 670: 72(ptr) AccessChain 27(data) 59 38 + 671: 20(ivec4) Load 670 + 672: 20(ivec4) GroupNonUniformBitwiseXor 34 Reduce 671 + 673: 72(ptr) AccessChain 27(data) 669 38 + Store 673 672 + 674: 6(int) Load 8(invocation) + 675: 95(ptr) AccessChain 27(data) 29 49 30 + 676: 6(int) Load 675 + 677: 6(int) GroupNonUniformBitwiseXor 34 Reduce 676 + 678: 95(ptr) AccessChain 27(data) 674 49 30 + Store 678 677 + 679: 6(int) Load 8(invocation) + 680: 102(ptr) AccessChain 27(data) 38 49 + 681: 21(ivec4) Load 680 + 682: 101(ivec2) VectorShuffle 681 681 0 1 + 683: 101(ivec2) GroupNonUniformBitwiseXor 34 Reduce 682 + 684: 102(ptr) AccessChain 27(data) 679 49 + 685: 21(ivec4) Load 684 + 686: 21(ivec4) VectorShuffle 685 683 4 5 2 3 + Store 684 686 + 687: 6(int) Load 8(invocation) + 688: 102(ptr) AccessChain 27(data) 49 49 + 689: 21(ivec4) Load 688 + 690: 111(ivec3) VectorShuffle 689 689 0 1 2 + 691: 111(ivec3) GroupNonUniformBitwiseXor 34 Reduce 690 + 692: 102(ptr) AccessChain 27(data) 687 49 + 693: 21(ivec4) Load 692 + 694: 21(ivec4) VectorShuffle 693 691 4 5 6 3 + Store 692 694 + 695: 6(int) Load 8(invocation) + 696: 102(ptr) AccessChain 27(data) 59 49 + 697: 21(ivec4) Load 696 + 698: 21(ivec4) GroupNonUniformBitwiseXor 34 Reduce 697 + 699: 102(ptr) AccessChain 27(data) 695 49 + Store 699 698 + 700: 6(int) Load 8(invocation) + 701: 65(ptr) AccessChain 27(data) 29 38 30 + 702: 19(int) Load 701 + 703: 521(bool) SLessThan 702 29 + 704: 521(bool) GroupNonUniformLogicalXor 34 Reduce 703 + 705: 19(int) Select 704 38 29 + 706: 65(ptr) AccessChain 27(data) 700 38 30 + Store 706 705 + 707: 6(int) Load 8(invocation) + 708: 72(ptr) AccessChain 27(data) 38 38 + 709: 20(ivec4) Load 708 + 710: 71(ivec2) VectorShuffle 709 709 0 1 + 711: 531(bvec2) SLessThan 710 530 + 712: 531(bvec2) GroupNonUniformLogicalXor 34 Reduce 711 + 713: 71(ivec2) Select 712 534 530 + 714: 72(ptr) AccessChain 27(data) 707 38 + 715: 20(ivec4) Load 714 + 716: 20(ivec4) VectorShuffle 715 713 4 5 2 3 + Store 714 716 + 717: 6(int) Load 8(invocation) + 718: 72(ptr) AccessChain 27(data) 38 38 + 719: 20(ivec4) Load 718 + 720: 81(ivec3) VectorShuffle 719 719 0 1 2 + 721: 544(bvec3) SLessThan 720 543 + 722: 544(bvec3) GroupNonUniformLogicalXor 34 Reduce 721 + 723: 81(ivec3) Select 722 547 543 + 724: 72(ptr) AccessChain 27(data) 717 38 + 725: 20(ivec4) Load 724 + 726: 20(ivec4) VectorShuffle 725 723 4 5 6 3 + Store 724 726 + 727: 6(int) Load 8(invocation) + 728: 72(ptr) AccessChain 27(data) 38 38 + 729: 20(ivec4) Load 728 + 730: 556(bvec4) SLessThan 729 555 + 731: 556(bvec4) GroupNonUniformLogicalXor 34 Reduce 730 + 732: 20(ivec4) Select 731 559 555 + 733: 72(ptr) AccessChain 27(data) 727 38 + Store 733 732 + 734: 6(int) Load 8(invocation) + 735: 31(ptr) AccessChain 27(data) 29 29 30 + 736: 17(float) Load 735 + 737: 17(float) GroupNonUniformFAdd 34 InclusiveScan 736 + 738: 31(ptr) AccessChain 27(data) 734 29 30 + Store 738 737 + 739: 6(int) Load 8(invocation) + 740: 40(ptr) AccessChain 27(data) 38 29 + 741: 18(fvec4) Load 740 + 742: 39(fvec2) VectorShuffle 741 741 0 1 + 743: 39(fvec2) GroupNonUniformFAdd 34 InclusiveScan 742 + 744: 40(ptr) AccessChain 27(data) 739 29 + 745: 18(fvec4) Load 744 + 746: 18(fvec4) VectorShuffle 745 743 4 5 2 3 + Store 744 746 + 747: 6(int) Load 8(invocation) + 748: 40(ptr) AccessChain 27(data) 49 29 + 749: 18(fvec4) Load 748 + 750: 50(fvec3) VectorShuffle 749 749 0 1 2 + 751: 50(fvec3) GroupNonUniformFAdd 34 InclusiveScan 750 + 752: 40(ptr) AccessChain 27(data) 747 29 + 753: 18(fvec4) Load 752 + 754: 18(fvec4) VectorShuffle 753 751 4 5 6 3 + Store 752 754 + 755: 6(int) Load 8(invocation) + 756: 40(ptr) AccessChain 27(data) 59 29 + 757: 18(fvec4) Load 756 + 758: 18(fvec4) GroupNonUniformFAdd 34 InclusiveScan 757 + 759: 40(ptr) AccessChain 27(data) 755 29 + Store 759 758 + 760: 6(int) Load 8(invocation) + 761: 65(ptr) AccessChain 27(data) 29 38 30 + 762: 19(int) Load 761 + 763: 19(int) GroupNonUniformIAdd 34 InclusiveScan 762 + 764: 65(ptr) AccessChain 27(data) 760 38 30 + Store 764 763 + 765: 6(int) Load 8(invocation) + 766: 72(ptr) AccessChain 27(data) 38 38 + 767: 20(ivec4) Load 766 + 768: 71(ivec2) VectorShuffle 767 767 0 1 + 769: 71(ivec2) GroupNonUniformIAdd 34 InclusiveScan 768 + 770: 72(ptr) AccessChain 27(data) 765 38 + 771: 20(ivec4) Load 770 + 772: 20(ivec4) VectorShuffle 771 769 4 5 2 3 + Store 770 772 + 773: 6(int) Load 8(invocation) + 774: 72(ptr) AccessChain 27(data) 49 38 + 775: 20(ivec4) Load 774 + 776: 81(ivec3) VectorShuffle 775 775 0 1 2 + 777: 81(ivec3) GroupNonUniformIAdd 34 InclusiveScan 776 + 778: 72(ptr) AccessChain 27(data) 773 38 + 779: 20(ivec4) Load 778 + 780: 20(ivec4) VectorShuffle 779 777 4 5 6 3 + Store 778 780 + 781: 6(int) Load 8(invocation) + 782: 72(ptr) AccessChain 27(data) 59 38 + 783: 20(ivec4) Load 782 + 784: 20(ivec4) GroupNonUniformIAdd 34 InclusiveScan 783 + 785: 72(ptr) AccessChain 27(data) 781 38 + Store 785 784 + 786: 6(int) Load 8(invocation) + 787: 95(ptr) AccessChain 27(data) 29 49 30 + 788: 6(int) Load 787 + 789: 6(int) GroupNonUniformIAdd 34 InclusiveScan 788 + 790: 95(ptr) AccessChain 27(data) 786 49 30 + Store 790 789 + 791: 6(int) Load 8(invocation) + 792: 102(ptr) AccessChain 27(data) 38 49 + 793: 21(ivec4) Load 792 + 794: 101(ivec2) VectorShuffle 793 793 0 1 + 795: 101(ivec2) GroupNonUniformIAdd 34 InclusiveScan 794 + 796: 102(ptr) AccessChain 27(data) 791 49 + 797: 21(ivec4) Load 796 + 798: 21(ivec4) VectorShuffle 797 795 4 5 2 3 + Store 796 798 + 799: 6(int) Load 8(invocation) + 800: 102(ptr) AccessChain 27(data) 49 49 + 801: 21(ivec4) Load 800 + 802: 111(ivec3) VectorShuffle 801 801 0 1 2 + 803: 111(ivec3) GroupNonUniformIAdd 34 InclusiveScan 802 + 804: 102(ptr) AccessChain 27(data) 799 49 + 805: 21(ivec4) Load 804 + 806: 21(ivec4) VectorShuffle 805 803 4 5 6 3 + Store 804 806 + 807: 6(int) Load 8(invocation) + 808: 102(ptr) AccessChain 27(data) 59 49 + 809: 21(ivec4) Load 808 + 810: 21(ivec4) GroupNonUniformIAdd 34 InclusiveScan 809 + 811: 102(ptr) AccessChain 27(data) 807 49 + Store 811 810 + 812: 6(int) Load 8(invocation) + 813: 125(ptr) AccessChain 27(data) 29 59 30 + 814:22(float64_t) Load 813 + 815:22(float64_t) GroupNonUniformFAdd 34 InclusiveScan 814 + 816: 125(ptr) AccessChain 27(data) 812 59 30 + Store 816 815 + 817: 6(int) Load 8(invocation) + 818: 132(ptr) AccessChain 27(data) 38 59 + 819: 23(f64vec4) Load 818 + 820:131(f64vec2) VectorShuffle 819 819 0 1 + 821:131(f64vec2) GroupNonUniformFAdd 34 InclusiveScan 820 + 822: 132(ptr) AccessChain 27(data) 817 59 + 823: 23(f64vec4) Load 822 + 824: 23(f64vec4) VectorShuffle 823 821 4 5 2 3 + Store 822 824 + 825: 6(int) Load 8(invocation) + 826: 132(ptr) AccessChain 27(data) 49 59 + 827: 23(f64vec4) Load 826 + 828:141(f64vec3) VectorShuffle 827 827 0 1 2 + 829:141(f64vec3) GroupNonUniformFAdd 34 InclusiveScan 828 + 830: 132(ptr) AccessChain 27(data) 825 59 + 831: 23(f64vec4) Load 830 + 832: 23(f64vec4) VectorShuffle 831 829 4 5 6 3 + Store 830 832 + 833: 6(int) Load 8(invocation) + 834: 132(ptr) AccessChain 27(data) 59 59 + 835: 23(f64vec4) Load 834 + 836: 23(f64vec4) GroupNonUniformFAdd 34 InclusiveScan 835 + 837: 132(ptr) AccessChain 27(data) 833 59 + Store 837 836 + 838: 6(int) Load 8(invocation) + 839: 31(ptr) AccessChain 27(data) 29 29 30 + 840: 17(float) Load 839 + 841: 17(float) GroupNonUniformFMul 34 InclusiveScan 840 + 842: 31(ptr) AccessChain 27(data) 838 29 30 + Store 842 841 + 843: 6(int) Load 8(invocation) + 844: 40(ptr) AccessChain 27(data) 38 29 + 845: 18(fvec4) Load 844 + 846: 39(fvec2) VectorShuffle 845 845 0 1 + 847: 39(fvec2) GroupNonUniformFMul 34 InclusiveScan 846 + 848: 40(ptr) AccessChain 27(data) 843 29 + 849: 18(fvec4) Load 848 + 850: 18(fvec4) VectorShuffle 849 847 4 5 2 3 + Store 848 850 + 851: 6(int) Load 8(invocation) + 852: 40(ptr) AccessChain 27(data) 49 29 + 853: 18(fvec4) Load 852 + 854: 50(fvec3) VectorShuffle 853 853 0 1 2 + 855: 50(fvec3) GroupNonUniformFMul 34 InclusiveScan 854 + 856: 40(ptr) AccessChain 27(data) 851 29 + 857: 18(fvec4) Load 856 + 858: 18(fvec4) VectorShuffle 857 855 4 5 6 3 + Store 856 858 + 859: 6(int) Load 8(invocation) + 860: 40(ptr) AccessChain 27(data) 59 29 + 861: 18(fvec4) Load 860 + 862: 18(fvec4) GroupNonUniformFMul 34 InclusiveScan 861 + 863: 40(ptr) AccessChain 27(data) 859 29 + Store 863 862 + 864: 6(int) Load 8(invocation) + 865: 65(ptr) AccessChain 27(data) 29 38 30 + 866: 19(int) Load 865 + 867: 19(int) GroupNonUniformIMul 34 InclusiveScan 866 + 868: 65(ptr) AccessChain 27(data) 864 38 30 + Store 868 867 + 869: 6(int) Load 8(invocation) + 870: 72(ptr) AccessChain 27(data) 38 38 + 871: 20(ivec4) Load 870 + 872: 71(ivec2) VectorShuffle 871 871 0 1 + 873: 71(ivec2) GroupNonUniformIMul 34 InclusiveScan 872 + 874: 72(ptr) AccessChain 27(data) 869 38 + 875: 20(ivec4) Load 874 + 876: 20(ivec4) VectorShuffle 875 873 4 5 2 3 + Store 874 876 + 877: 6(int) Load 8(invocation) + 878: 72(ptr) AccessChain 27(data) 49 38 + 879: 20(ivec4) Load 878 + 880: 81(ivec3) VectorShuffle 879 879 0 1 2 + 881: 81(ivec3) GroupNonUniformIMul 34 InclusiveScan 880 + 882: 72(ptr) AccessChain 27(data) 877 38 + 883: 20(ivec4) Load 882 + 884: 20(ivec4) VectorShuffle 883 881 4 5 6 3 + Store 882 884 + 885: 6(int) Load 8(invocation) + 886: 72(ptr) AccessChain 27(data) 59 38 + 887: 20(ivec4) Load 886 + 888: 20(ivec4) GroupNonUniformIMul 34 InclusiveScan 887 + 889: 72(ptr) AccessChain 27(data) 885 38 + Store 889 888 + 890: 6(int) Load 8(invocation) + 891: 95(ptr) AccessChain 27(data) 29 49 30 + 892: 6(int) Load 891 + 893: 6(int) GroupNonUniformIMul 34 InclusiveScan 892 + 894: 95(ptr) AccessChain 27(data) 890 49 30 + Store 894 893 + 895: 6(int) Load 8(invocation) + 896: 102(ptr) AccessChain 27(data) 38 49 + 897: 21(ivec4) Load 896 + 898: 101(ivec2) VectorShuffle 897 897 0 1 + 899: 101(ivec2) GroupNonUniformIMul 34 InclusiveScan 898 + 900: 102(ptr) AccessChain 27(data) 895 49 + 901: 21(ivec4) Load 900 + 902: 21(ivec4) VectorShuffle 901 899 4 5 2 3 + Store 900 902 + 903: 6(int) Load 8(invocation) + 904: 102(ptr) AccessChain 27(data) 49 49 + 905: 21(ivec4) Load 904 + 906: 111(ivec3) VectorShuffle 905 905 0 1 2 + 907: 111(ivec3) GroupNonUniformIMul 34 InclusiveScan 906 + 908: 102(ptr) AccessChain 27(data) 903 49 + 909: 21(ivec4) Load 908 + 910: 21(ivec4) VectorShuffle 909 907 4 5 6 3 + Store 908 910 + 911: 6(int) Load 8(invocation) + 912: 102(ptr) AccessChain 27(data) 59 49 + 913: 21(ivec4) Load 912 + 914: 21(ivec4) GroupNonUniformIMul 34 InclusiveScan 913 + 915: 102(ptr) AccessChain 27(data) 911 49 + Store 915 914 + 916: 6(int) Load 8(invocation) + 917: 125(ptr) AccessChain 27(data) 29 59 30 + 918:22(float64_t) Load 917 + 919:22(float64_t) GroupNonUniformFMul 34 InclusiveScan 918 + 920: 125(ptr) AccessChain 27(data) 916 59 30 + Store 920 919 + 921: 6(int) Load 8(invocation) + 922: 132(ptr) AccessChain 27(data) 38 59 + 923: 23(f64vec4) Load 922 + 924:131(f64vec2) VectorShuffle 923 923 0 1 + 925:131(f64vec2) GroupNonUniformFMul 34 InclusiveScan 924 + 926: 132(ptr) AccessChain 27(data) 921 59 + 927: 23(f64vec4) Load 926 + 928: 23(f64vec4) VectorShuffle 927 925 4 5 2 3 + Store 926 928 + 929: 6(int) Load 8(invocation) + 930: 132(ptr) AccessChain 27(data) 49 59 + 931: 23(f64vec4) Load 930 + 932:141(f64vec3) VectorShuffle 931 931 0 1 2 + 933:141(f64vec3) GroupNonUniformFMul 34 InclusiveScan 932 + 934: 132(ptr) AccessChain 27(data) 929 59 + 935: 23(f64vec4) Load 934 + 936: 23(f64vec4) VectorShuffle 935 933 4 5 6 3 + Store 934 936 + 937: 6(int) Load 8(invocation) + 938: 132(ptr) AccessChain 27(data) 59 59 + 939: 23(f64vec4) Load 938 + 940: 23(f64vec4) GroupNonUniformFMul 34 InclusiveScan 939 + 941: 132(ptr) AccessChain 27(data) 937 59 + Store 941 940 + 942: 6(int) Load 8(invocation) + 943: 31(ptr) AccessChain 27(data) 29 29 30 + 944: 17(float) Load 943 + 945: 17(float) GroupNonUniformFMin 34 InclusiveScan 944 + 946: 31(ptr) AccessChain 27(data) 942 29 30 + Store 946 945 + 947: 6(int) Load 8(invocation) + 948: 40(ptr) AccessChain 27(data) 38 29 + 949: 18(fvec4) Load 948 + 950: 39(fvec2) VectorShuffle 949 949 0 1 + 951: 39(fvec2) GroupNonUniformFMin 34 InclusiveScan 950 + 952: 40(ptr) AccessChain 27(data) 947 29 + 953: 18(fvec4) Load 952 + 954: 18(fvec4) VectorShuffle 953 951 4 5 2 3 + Store 952 954 + 955: 6(int) Load 8(invocation) + 956: 40(ptr) AccessChain 27(data) 49 29 + 957: 18(fvec4) Load 956 + 958: 50(fvec3) VectorShuffle 957 957 0 1 2 + 959: 50(fvec3) GroupNonUniformFMin 34 InclusiveScan 958 + 960: 40(ptr) AccessChain 27(data) 955 29 + 961: 18(fvec4) Load 960 + 962: 18(fvec4) VectorShuffle 961 959 4 5 6 3 + Store 960 962 + 963: 6(int) Load 8(invocation) + 964: 40(ptr) AccessChain 27(data) 59 29 + 965: 18(fvec4) Load 964 + 966: 18(fvec4) GroupNonUniformFMin 34 InclusiveScan 965 + 967: 40(ptr) AccessChain 27(data) 963 29 + Store 967 966 + 968: 6(int) Load 8(invocation) + 969: 65(ptr) AccessChain 27(data) 29 38 30 + 970: 19(int) Load 969 + 971: 19(int) GroupNonUniformSMin 34 InclusiveScan 970 + 972: 65(ptr) AccessChain 27(data) 968 38 30 + Store 972 971 + 973: 6(int) Load 8(invocation) + 974: 72(ptr) AccessChain 27(data) 38 38 + 975: 20(ivec4) Load 974 + 976: 71(ivec2) VectorShuffle 975 975 0 1 + 977: 71(ivec2) GroupNonUniformSMin 34 InclusiveScan 976 + 978: 72(ptr) AccessChain 27(data) 973 38 + 979: 20(ivec4) Load 978 + 980: 20(ivec4) VectorShuffle 979 977 4 5 2 3 + Store 978 980 + 981: 6(int) Load 8(invocation) + 982: 72(ptr) AccessChain 27(data) 49 38 + 983: 20(ivec4) Load 982 + 984: 81(ivec3) VectorShuffle 983 983 0 1 2 + 985: 81(ivec3) GroupNonUniformSMin 34 InclusiveScan 984 + 986: 72(ptr) AccessChain 27(data) 981 38 + 987: 20(ivec4) Load 986 + 988: 20(ivec4) VectorShuffle 987 985 4 5 6 3 + Store 986 988 + 989: 6(int) Load 8(invocation) + 990: 72(ptr) AccessChain 27(data) 59 38 + 991: 20(ivec4) Load 990 + 992: 20(ivec4) GroupNonUniformSMin 34 InclusiveScan 991 + 993: 72(ptr) AccessChain 27(data) 989 38 + Store 993 992 + 994: 6(int) Load 8(invocation) + 995: 95(ptr) AccessChain 27(data) 29 49 30 + 996: 6(int) Load 995 + 997: 6(int) GroupNonUniformUMin 34 InclusiveScan 996 + 998: 95(ptr) AccessChain 27(data) 994 49 30 + Store 998 997 + 999: 6(int) Load 8(invocation) + 1000: 102(ptr) AccessChain 27(data) 38 49 + 1001: 21(ivec4) Load 1000 + 1002: 101(ivec2) VectorShuffle 1001 1001 0 1 + 1003: 101(ivec2) GroupNonUniformUMin 34 InclusiveScan 1002 + 1004: 102(ptr) AccessChain 27(data) 999 49 + 1005: 21(ivec4) Load 1004 + 1006: 21(ivec4) VectorShuffle 1005 1003 4 5 2 3 + Store 1004 1006 + 1007: 6(int) Load 8(invocation) + 1008: 102(ptr) AccessChain 27(data) 49 49 + 1009: 21(ivec4) Load 1008 + 1010: 111(ivec3) VectorShuffle 1009 1009 0 1 2 + 1011: 111(ivec3) GroupNonUniformUMin 34 InclusiveScan 1010 + 1012: 102(ptr) AccessChain 27(data) 1007 49 + 1013: 21(ivec4) Load 1012 + 1014: 21(ivec4) VectorShuffle 1013 1011 4 5 6 3 + Store 1012 1014 + 1015: 6(int) Load 8(invocation) + 1016: 102(ptr) AccessChain 27(data) 59 49 + 1017: 21(ivec4) Load 1016 + 1018: 21(ivec4) GroupNonUniformUMin 34 InclusiveScan 1017 + 1019: 102(ptr) AccessChain 27(data) 1015 49 + Store 1019 1018 + 1020: 6(int) Load 8(invocation) + 1021: 125(ptr) AccessChain 27(data) 29 59 30 + 1022:22(float64_t) Load 1021 + 1023:22(float64_t) GroupNonUniformFMin 34 InclusiveScan 1022 + 1024: 125(ptr) AccessChain 27(data) 1020 59 30 + Store 1024 1023 + 1025: 6(int) Load 8(invocation) + 1026: 132(ptr) AccessChain 27(data) 38 59 + 1027: 23(f64vec4) Load 1026 + 1028:131(f64vec2) VectorShuffle 1027 1027 0 1 + 1029:131(f64vec2) GroupNonUniformFMin 34 InclusiveScan 1028 + 1030: 132(ptr) AccessChain 27(data) 1025 59 + 1031: 23(f64vec4) Load 1030 + 1032: 23(f64vec4) VectorShuffle 1031 1029 4 5 2 3 + Store 1030 1032 + 1033: 6(int) Load 8(invocation) + 1034: 132(ptr) AccessChain 27(data) 49 59 + 1035: 23(f64vec4) Load 1034 + 1036:141(f64vec3) VectorShuffle 1035 1035 0 1 2 + 1037:141(f64vec3) GroupNonUniformFMin 34 InclusiveScan 1036 + 1038: 132(ptr) AccessChain 27(data) 1033 59 + 1039: 23(f64vec4) Load 1038 + 1040: 23(f64vec4) VectorShuffle 1039 1037 4 5 6 3 + Store 1038 1040 + 1041: 6(int) Load 8(invocation) + 1042: 132(ptr) AccessChain 27(data) 59 59 + 1043: 23(f64vec4) Load 1042 + 1044: 23(f64vec4) GroupNonUniformFMin 34 InclusiveScan 1043 + 1045: 132(ptr) AccessChain 27(data) 1041 59 + Store 1045 1044 + 1046: 6(int) Load 8(invocation) + 1047: 31(ptr) AccessChain 27(data) 29 29 30 + 1048: 17(float) Load 1047 + 1049: 17(float) GroupNonUniformFMax 34 InclusiveScan 1048 + 1050: 31(ptr) AccessChain 27(data) 1046 29 30 + Store 1050 1049 + 1051: 6(int) Load 8(invocation) + 1052: 40(ptr) AccessChain 27(data) 38 29 + 1053: 18(fvec4) Load 1052 + 1054: 39(fvec2) VectorShuffle 1053 1053 0 1 + 1055: 39(fvec2) GroupNonUniformFMax 34 InclusiveScan 1054 + 1056: 40(ptr) AccessChain 27(data) 1051 29 + 1057: 18(fvec4) Load 1056 + 1058: 18(fvec4) VectorShuffle 1057 1055 4 5 2 3 + Store 1056 1058 + 1059: 6(int) Load 8(invocation) + 1060: 40(ptr) AccessChain 27(data) 49 29 + 1061: 18(fvec4) Load 1060 + 1062: 50(fvec3) VectorShuffle 1061 1061 0 1 2 + 1063: 50(fvec3) GroupNonUniformFMax 34 InclusiveScan 1062 + 1064: 40(ptr) AccessChain 27(data) 1059 29 + 1065: 18(fvec4) Load 1064 + 1066: 18(fvec4) VectorShuffle 1065 1063 4 5 6 3 + Store 1064 1066 + 1067: 6(int) Load 8(invocation) + 1068: 40(ptr) AccessChain 27(data) 59 29 + 1069: 18(fvec4) Load 1068 + 1070: 18(fvec4) GroupNonUniformFMax 34 InclusiveScan 1069 + 1071: 40(ptr) AccessChain 27(data) 1067 29 + Store 1071 1070 + 1072: 6(int) Load 8(invocation) + 1073: 65(ptr) AccessChain 27(data) 29 38 30 + 1074: 19(int) Load 1073 + 1075: 19(int) GroupNonUniformSMax 34 InclusiveScan 1074 + 1076: 65(ptr) AccessChain 27(data) 1072 38 30 + Store 1076 1075 + 1077: 6(int) Load 8(invocation) + 1078: 72(ptr) AccessChain 27(data) 38 38 + 1079: 20(ivec4) Load 1078 + 1080: 71(ivec2) VectorShuffle 1079 1079 0 1 + 1081: 71(ivec2) GroupNonUniformSMax 34 InclusiveScan 1080 + 1082: 72(ptr) AccessChain 27(data) 1077 38 + 1083: 20(ivec4) Load 1082 + 1084: 20(ivec4) VectorShuffle 1083 1081 4 5 2 3 + Store 1082 1084 + 1085: 6(int) Load 8(invocation) + 1086: 72(ptr) AccessChain 27(data) 49 38 + 1087: 20(ivec4) Load 1086 + 1088: 81(ivec3) VectorShuffle 1087 1087 0 1 2 + 1089: 81(ivec3) GroupNonUniformSMax 34 InclusiveScan 1088 + 1090: 72(ptr) AccessChain 27(data) 1085 38 + 1091: 20(ivec4) Load 1090 + 1092: 20(ivec4) VectorShuffle 1091 1089 4 5 6 3 + Store 1090 1092 + 1093: 6(int) Load 8(invocation) + 1094: 72(ptr) AccessChain 27(data) 59 38 + 1095: 20(ivec4) Load 1094 + 1096: 20(ivec4) GroupNonUniformSMax 34 InclusiveScan 1095 + 1097: 72(ptr) AccessChain 27(data) 1093 38 + Store 1097 1096 + 1098: 6(int) Load 8(invocation) + 1099: 95(ptr) AccessChain 27(data) 29 49 30 + 1100: 6(int) Load 1099 + 1101: 6(int) GroupNonUniformUMax 34 InclusiveScan 1100 + 1102: 95(ptr) AccessChain 27(data) 1098 49 30 + Store 1102 1101 + 1103: 6(int) Load 8(invocation) + 1104: 102(ptr) AccessChain 27(data) 38 49 + 1105: 21(ivec4) Load 1104 + 1106: 101(ivec2) VectorShuffle 1105 1105 0 1 + 1107: 101(ivec2) GroupNonUniformUMax 34 InclusiveScan 1106 + 1108: 102(ptr) AccessChain 27(data) 1103 49 + 1109: 21(ivec4) Load 1108 + 1110: 21(ivec4) VectorShuffle 1109 1107 4 5 2 3 + Store 1108 1110 + 1111: 6(int) Load 8(invocation) + 1112: 102(ptr) AccessChain 27(data) 49 49 + 1113: 21(ivec4) Load 1112 + 1114: 111(ivec3) VectorShuffle 1113 1113 0 1 2 + 1115: 111(ivec3) GroupNonUniformUMax 34 InclusiveScan 1114 + 1116: 102(ptr) AccessChain 27(data) 1111 49 + 1117: 21(ivec4) Load 1116 + 1118: 21(ivec4) VectorShuffle 1117 1115 4 5 6 3 + Store 1116 1118 + 1119: 6(int) Load 8(invocation) + 1120: 102(ptr) AccessChain 27(data) 59 49 + 1121: 21(ivec4) Load 1120 + 1122: 21(ivec4) GroupNonUniformUMax 34 InclusiveScan 1121 + 1123: 102(ptr) AccessChain 27(data) 1119 49 + Store 1123 1122 + 1124: 6(int) Load 8(invocation) + 1125: 125(ptr) AccessChain 27(data) 29 59 30 + 1126:22(float64_t) Load 1125 + 1127:22(float64_t) GroupNonUniformFMax 34 InclusiveScan 1126 + 1128: 125(ptr) AccessChain 27(data) 1124 59 30 + Store 1128 1127 + 1129: 6(int) Load 8(invocation) + 1130: 132(ptr) AccessChain 27(data) 38 59 + 1131: 23(f64vec4) Load 1130 + 1132:131(f64vec2) VectorShuffle 1131 1131 0 1 + 1133:131(f64vec2) GroupNonUniformFMax 34 InclusiveScan 1132 + 1134: 132(ptr) AccessChain 27(data) 1129 59 + 1135: 23(f64vec4) Load 1134 + 1136: 23(f64vec4) VectorShuffle 1135 1133 4 5 2 3 + Store 1134 1136 + 1137: 6(int) Load 8(invocation) + 1138: 132(ptr) AccessChain 27(data) 49 59 + 1139: 23(f64vec4) Load 1138 + 1140:141(f64vec3) VectorShuffle 1139 1139 0 1 2 + 1141:141(f64vec3) GroupNonUniformFMax 34 InclusiveScan 1140 + 1142: 132(ptr) AccessChain 27(data) 1137 59 + 1143: 23(f64vec4) Load 1142 + 1144: 23(f64vec4) VectorShuffle 1143 1141 4 5 6 3 + Store 1142 1144 + 1145: 6(int) Load 8(invocation) + 1146: 132(ptr) AccessChain 27(data) 59 59 + 1147: 23(f64vec4) Load 1146 + 1148: 23(f64vec4) GroupNonUniformFMax 34 InclusiveScan 1147 + 1149: 132(ptr) AccessChain 27(data) 1145 59 + Store 1149 1148 + 1150: 6(int) Load 8(invocation) + 1151: 65(ptr) AccessChain 27(data) 29 38 30 + 1152: 19(int) Load 1151 + 1153: 19(int) GroupNonUniformBitwiseAnd 34 InclusiveScan 1152 + 1154: 65(ptr) AccessChain 27(data) 1150 38 30 + Store 1154 1153 + 1155: 6(int) Load 8(invocation) + 1156: 72(ptr) AccessChain 27(data) 38 38 + 1157: 20(ivec4) Load 1156 + 1158: 71(ivec2) VectorShuffle 1157 1157 0 1 + 1159: 71(ivec2) GroupNonUniformBitwiseAnd 34 InclusiveScan 1158 + 1160: 72(ptr) AccessChain 27(data) 1155 38 + 1161: 20(ivec4) Load 1160 + 1162: 20(ivec4) VectorShuffle 1161 1159 4 5 2 3 + Store 1160 1162 + 1163: 6(int) Load 8(invocation) + 1164: 72(ptr) AccessChain 27(data) 49 38 + 1165: 20(ivec4) Load 1164 + 1166: 81(ivec3) VectorShuffle 1165 1165 0 1 2 + 1167: 81(ivec3) GroupNonUniformBitwiseAnd 34 InclusiveScan 1166 + 1168: 72(ptr) AccessChain 27(data) 1163 38 + 1169: 20(ivec4) Load 1168 + 1170: 20(ivec4) VectorShuffle 1169 1167 4 5 6 3 + Store 1168 1170 + 1171: 6(int) Load 8(invocation) + 1172: 72(ptr) AccessChain 27(data) 59 38 + 1173: 20(ivec4) Load 1172 + 1174: 20(ivec4) GroupNonUniformBitwiseAnd 34 InclusiveScan 1173 + 1175: 72(ptr) AccessChain 27(data) 1171 38 + Store 1175 1174 + 1176: 6(int) Load 8(invocation) + 1177: 95(ptr) AccessChain 27(data) 29 49 30 + 1178: 6(int) Load 1177 + 1179: 6(int) GroupNonUniformBitwiseAnd 34 InclusiveScan 1178 + 1180: 95(ptr) AccessChain 27(data) 1176 49 30 + Store 1180 1179 + 1181: 6(int) Load 8(invocation) + 1182: 102(ptr) AccessChain 27(data) 38 49 + 1183: 21(ivec4) Load 1182 + 1184: 101(ivec2) VectorShuffle 1183 1183 0 1 + 1185: 101(ivec2) GroupNonUniformBitwiseAnd 34 InclusiveScan 1184 + 1186: 102(ptr) AccessChain 27(data) 1181 49 + 1187: 21(ivec4) Load 1186 + 1188: 21(ivec4) VectorShuffle 1187 1185 4 5 2 3 + Store 1186 1188 + 1189: 6(int) Load 8(invocation) + 1190: 102(ptr) AccessChain 27(data) 49 49 + 1191: 21(ivec4) Load 1190 + 1192: 111(ivec3) VectorShuffle 1191 1191 0 1 2 + 1193: 111(ivec3) GroupNonUniformBitwiseAnd 34 InclusiveScan 1192 + 1194: 102(ptr) AccessChain 27(data) 1189 49 + 1195: 21(ivec4) Load 1194 + 1196: 21(ivec4) VectorShuffle 1195 1193 4 5 6 3 + Store 1194 1196 + 1197: 6(int) Load 8(invocation) + 1198: 102(ptr) AccessChain 27(data) 59 49 + 1199: 21(ivec4) Load 1198 + 1200: 21(ivec4) GroupNonUniformBitwiseAnd 34 InclusiveScan 1199 + 1201: 102(ptr) AccessChain 27(data) 1197 49 + Store 1201 1200 + 1202: 6(int) Load 8(invocation) + 1203: 65(ptr) AccessChain 27(data) 29 38 30 + 1204: 19(int) Load 1203 + 1205: 521(bool) SLessThan 1204 29 + 1206: 521(bool) GroupNonUniformLogicalAnd 34 InclusiveScan 1205 + 1207: 19(int) Select 1206 38 29 + 1208: 65(ptr) AccessChain 27(data) 1202 38 30 + Store 1208 1207 + 1209: 6(int) Load 8(invocation) + 1210: 72(ptr) AccessChain 27(data) 38 38 + 1211: 20(ivec4) Load 1210 + 1212: 71(ivec2) VectorShuffle 1211 1211 0 1 + 1213: 531(bvec2) SLessThan 1212 530 + 1214: 531(bvec2) GroupNonUniformLogicalAnd 34 InclusiveScan 1213 + 1215: 71(ivec2) Select 1214 534 530 + 1216: 72(ptr) AccessChain 27(data) 1209 38 + 1217: 20(ivec4) Load 1216 + 1218: 20(ivec4) VectorShuffle 1217 1215 4 5 2 3 + Store 1216 1218 + 1219: 6(int) Load 8(invocation) + 1220: 72(ptr) AccessChain 27(data) 38 38 + 1221: 20(ivec4) Load 1220 + 1222: 81(ivec3) VectorShuffle 1221 1221 0 1 2 + 1223: 544(bvec3) SLessThan 1222 543 + 1224: 544(bvec3) GroupNonUniformLogicalAnd 34 InclusiveScan 1223 + 1225: 81(ivec3) Select 1224 547 543 + 1226: 72(ptr) AccessChain 27(data) 1219 38 + 1227: 20(ivec4) Load 1226 + 1228: 20(ivec4) VectorShuffle 1227 1225 4 5 6 3 + Store 1226 1228 + 1229: 6(int) Load 8(invocation) + 1230: 72(ptr) AccessChain 27(data) 38 38 + 1231: 20(ivec4) Load 1230 + 1232: 556(bvec4) SLessThan 1231 555 + 1233: 556(bvec4) GroupNonUniformLogicalAnd 34 InclusiveScan 1232 + 1234: 20(ivec4) Select 1233 559 555 + 1235: 72(ptr) AccessChain 27(data) 1229 38 + Store 1235 1234 + 1236: 6(int) Load 8(invocation) + 1237: 65(ptr) AccessChain 27(data) 29 38 30 + 1238: 19(int) Load 1237 + 1239: 19(int) GroupNonUniformBitwiseOr 34 InclusiveScan 1238 + 1240: 65(ptr) AccessChain 27(data) 1236 38 30 + Store 1240 1239 + 1241: 6(int) Load 8(invocation) + 1242: 72(ptr) AccessChain 27(data) 38 38 + 1243: 20(ivec4) Load 1242 + 1244: 71(ivec2) VectorShuffle 1243 1243 0 1 + 1245: 71(ivec2) GroupNonUniformBitwiseOr 34 InclusiveScan 1244 + 1246: 72(ptr) AccessChain 27(data) 1241 38 + 1247: 20(ivec4) Load 1246 + 1248: 20(ivec4) VectorShuffle 1247 1245 4 5 2 3 + Store 1246 1248 + 1249: 6(int) Load 8(invocation) + 1250: 72(ptr) AccessChain 27(data) 49 38 + 1251: 20(ivec4) Load 1250 + 1252: 81(ivec3) VectorShuffle 1251 1251 0 1 2 + 1253: 81(ivec3) GroupNonUniformBitwiseOr 34 InclusiveScan 1252 + 1254: 72(ptr) AccessChain 27(data) 1249 38 + 1255: 20(ivec4) Load 1254 + 1256: 20(ivec4) VectorShuffle 1255 1253 4 5 6 3 + Store 1254 1256 + 1257: 6(int) Load 8(invocation) + 1258: 72(ptr) AccessChain 27(data) 59 38 + 1259: 20(ivec4) Load 1258 + 1260: 20(ivec4) GroupNonUniformBitwiseOr 34 InclusiveScan 1259 + 1261: 72(ptr) AccessChain 27(data) 1257 38 + Store 1261 1260 + 1262: 6(int) Load 8(invocation) + 1263: 95(ptr) AccessChain 27(data) 29 49 30 + 1264: 6(int) Load 1263 + 1265: 6(int) GroupNonUniformBitwiseOr 34 InclusiveScan 1264 + 1266: 95(ptr) AccessChain 27(data) 1262 49 30 + Store 1266 1265 + 1267: 6(int) Load 8(invocation) + 1268: 102(ptr) AccessChain 27(data) 38 49 + 1269: 21(ivec4) Load 1268 + 1270: 101(ivec2) VectorShuffle 1269 1269 0 1 + 1271: 101(ivec2) GroupNonUniformBitwiseOr 34 InclusiveScan 1270 + 1272: 102(ptr) AccessChain 27(data) 1267 49 + 1273: 21(ivec4) Load 1272 + 1274: 21(ivec4) VectorShuffle 1273 1271 4 5 2 3 + Store 1272 1274 + 1275: 6(int) Load 8(invocation) + 1276: 102(ptr) AccessChain 27(data) 49 49 + 1277: 21(ivec4) Load 1276 + 1278: 111(ivec3) VectorShuffle 1277 1277 0 1 2 + 1279: 111(ivec3) GroupNonUniformBitwiseOr 34 InclusiveScan 1278 + 1280: 102(ptr) AccessChain 27(data) 1275 49 + 1281: 21(ivec4) Load 1280 + 1282: 21(ivec4) VectorShuffle 1281 1279 4 5 6 3 + Store 1280 1282 + 1283: 6(int) Load 8(invocation) + 1284: 102(ptr) AccessChain 27(data) 59 49 + 1285: 21(ivec4) Load 1284 + 1286: 21(ivec4) GroupNonUniformBitwiseOr 34 InclusiveScan 1285 + 1287: 102(ptr) AccessChain 27(data) 1283 49 + Store 1287 1286 + 1288: 6(int) Load 8(invocation) + 1289: 65(ptr) AccessChain 27(data) 29 38 30 + 1290: 19(int) Load 1289 + 1291: 521(bool) SLessThan 1290 29 + 1292: 521(bool) GroupNonUniformLogicalOr 34 InclusiveScan 1291 + 1293: 19(int) Select 1292 38 29 + 1294: 65(ptr) AccessChain 27(data) 1288 38 30 + Store 1294 1293 + 1295: 6(int) Load 8(invocation) + 1296: 72(ptr) AccessChain 27(data) 38 38 + 1297: 20(ivec4) Load 1296 + 1298: 71(ivec2) VectorShuffle 1297 1297 0 1 + 1299: 531(bvec2) SLessThan 1298 530 + 1300: 531(bvec2) GroupNonUniformLogicalOr 34 InclusiveScan 1299 + 1301: 71(ivec2) Select 1300 534 530 + 1302: 72(ptr) AccessChain 27(data) 1295 38 + 1303: 20(ivec4) Load 1302 + 1304: 20(ivec4) VectorShuffle 1303 1301 4 5 2 3 + Store 1302 1304 + 1305: 6(int) Load 8(invocation) + 1306: 72(ptr) AccessChain 27(data) 38 38 + 1307: 20(ivec4) Load 1306 + 1308: 81(ivec3) VectorShuffle 1307 1307 0 1 2 + 1309: 544(bvec3) SLessThan 1308 543 + 1310: 544(bvec3) GroupNonUniformLogicalOr 34 InclusiveScan 1309 + 1311: 81(ivec3) Select 1310 547 543 + 1312: 72(ptr) AccessChain 27(data) 1305 38 + 1313: 20(ivec4) Load 1312 + 1314: 20(ivec4) VectorShuffle 1313 1311 4 5 6 3 + Store 1312 1314 + 1315: 6(int) Load 8(invocation) + 1316: 72(ptr) AccessChain 27(data) 38 38 + 1317: 20(ivec4) Load 1316 + 1318: 556(bvec4) SLessThan 1317 555 + 1319: 556(bvec4) GroupNonUniformLogicalOr 34 InclusiveScan 1318 + 1320: 20(ivec4) Select 1319 559 555 + 1321: 72(ptr) AccessChain 27(data) 1315 38 + Store 1321 1320 + 1322: 6(int) Load 8(invocation) + 1323: 65(ptr) AccessChain 27(data) 29 38 30 + 1324: 19(int) Load 1323 + 1325: 19(int) GroupNonUniformBitwiseXor 34 InclusiveScan 1324 + 1326: 65(ptr) AccessChain 27(data) 1322 38 30 + Store 1326 1325 + 1327: 6(int) Load 8(invocation) + 1328: 72(ptr) AccessChain 27(data) 38 38 + 1329: 20(ivec4) Load 1328 + 1330: 71(ivec2) VectorShuffle 1329 1329 0 1 + 1331: 71(ivec2) GroupNonUniformBitwiseXor 34 InclusiveScan 1330 + 1332: 72(ptr) AccessChain 27(data) 1327 38 + 1333: 20(ivec4) Load 1332 + 1334: 20(ivec4) VectorShuffle 1333 1331 4 5 2 3 + Store 1332 1334 + 1335: 6(int) Load 8(invocation) + 1336: 72(ptr) AccessChain 27(data) 49 38 + 1337: 20(ivec4) Load 1336 + 1338: 81(ivec3) VectorShuffle 1337 1337 0 1 2 + 1339: 81(ivec3) GroupNonUniformBitwiseXor 34 InclusiveScan 1338 + 1340: 72(ptr) AccessChain 27(data) 1335 38 + 1341: 20(ivec4) Load 1340 + 1342: 20(ivec4) VectorShuffle 1341 1339 4 5 6 3 + Store 1340 1342 + 1343: 6(int) Load 8(invocation) + 1344: 72(ptr) AccessChain 27(data) 59 38 + 1345: 20(ivec4) Load 1344 + 1346: 20(ivec4) GroupNonUniformBitwiseXor 34 InclusiveScan 1345 + 1347: 72(ptr) AccessChain 27(data) 1343 38 + Store 1347 1346 + 1348: 6(int) Load 8(invocation) + 1349: 95(ptr) AccessChain 27(data) 29 49 30 + 1350: 6(int) Load 1349 + 1351: 6(int) GroupNonUniformBitwiseXor 34 InclusiveScan 1350 + 1352: 95(ptr) AccessChain 27(data) 1348 49 30 + Store 1352 1351 + 1353: 6(int) Load 8(invocation) + 1354: 102(ptr) AccessChain 27(data) 38 49 + 1355: 21(ivec4) Load 1354 + 1356: 101(ivec2) VectorShuffle 1355 1355 0 1 + 1357: 101(ivec2) GroupNonUniformBitwiseXor 34 InclusiveScan 1356 + 1358: 102(ptr) AccessChain 27(data) 1353 49 + 1359: 21(ivec4) Load 1358 + 1360: 21(ivec4) VectorShuffle 1359 1357 4 5 2 3 + Store 1358 1360 + 1361: 6(int) Load 8(invocation) + 1362: 102(ptr) AccessChain 27(data) 49 49 + 1363: 21(ivec4) Load 1362 + 1364: 111(ivec3) VectorShuffle 1363 1363 0 1 2 + 1365: 111(ivec3) GroupNonUniformBitwiseXor 34 InclusiveScan 1364 + 1366: 102(ptr) AccessChain 27(data) 1361 49 + 1367: 21(ivec4) Load 1366 + 1368: 21(ivec4) VectorShuffle 1367 1365 4 5 6 3 + Store 1366 1368 + 1369: 6(int) Load 8(invocation) + 1370: 102(ptr) AccessChain 27(data) 59 49 + 1371: 21(ivec4) Load 1370 + 1372: 21(ivec4) GroupNonUniformBitwiseXor 34 InclusiveScan 1371 + 1373: 102(ptr) AccessChain 27(data) 1369 49 + Store 1373 1372 + 1374: 6(int) Load 8(invocation) + 1375: 65(ptr) AccessChain 27(data) 29 38 30 + 1376: 19(int) Load 1375 + 1377: 521(bool) SLessThan 1376 29 + 1378: 521(bool) GroupNonUniformLogicalXor 34 InclusiveScan 1377 + 1379: 19(int) Select 1378 38 29 + 1380: 65(ptr) AccessChain 27(data) 1374 38 30 + Store 1380 1379 + 1381: 6(int) Load 8(invocation) + 1382: 72(ptr) AccessChain 27(data) 38 38 + 1383: 20(ivec4) Load 1382 + 1384: 71(ivec2) VectorShuffle 1383 1383 0 1 + 1385: 531(bvec2) SLessThan 1384 530 + 1386: 531(bvec2) GroupNonUniformLogicalXor 34 InclusiveScan 1385 + 1387: 71(ivec2) Select 1386 534 530 + 1388: 72(ptr) AccessChain 27(data) 1381 38 + 1389: 20(ivec4) Load 1388 + 1390: 20(ivec4) VectorShuffle 1389 1387 4 5 2 3 + Store 1388 1390 + 1391: 6(int) Load 8(invocation) + 1392: 72(ptr) AccessChain 27(data) 38 38 + 1393: 20(ivec4) Load 1392 + 1394: 81(ivec3) VectorShuffle 1393 1393 0 1 2 + 1395: 544(bvec3) SLessThan 1394 543 + 1396: 544(bvec3) GroupNonUniformLogicalXor 34 InclusiveScan 1395 + 1397: 81(ivec3) Select 1396 547 543 + 1398: 72(ptr) AccessChain 27(data) 1391 38 + 1399: 20(ivec4) Load 1398 + 1400: 20(ivec4) VectorShuffle 1399 1397 4 5 6 3 + Store 1398 1400 + 1401: 6(int) Load 8(invocation) + 1402: 72(ptr) AccessChain 27(data) 38 38 + 1403: 20(ivec4) Load 1402 + 1404: 556(bvec4) SLessThan 1403 555 + 1405: 556(bvec4) GroupNonUniformLogicalXor 34 InclusiveScan 1404 + 1406: 20(ivec4) Select 1405 559 555 + 1407: 72(ptr) AccessChain 27(data) 1401 38 + Store 1407 1406 + 1408: 6(int) Load 8(invocation) + 1409: 31(ptr) AccessChain 27(data) 29 29 30 + 1410: 17(float) Load 1409 + 1411: 17(float) GroupNonUniformFAdd 34 ExclusiveScan 1410 + 1412: 31(ptr) AccessChain 27(data) 1408 29 30 + Store 1412 1411 + 1413: 6(int) Load 8(invocation) + 1414: 40(ptr) AccessChain 27(data) 38 29 + 1415: 18(fvec4) Load 1414 + 1416: 39(fvec2) VectorShuffle 1415 1415 0 1 + 1417: 39(fvec2) GroupNonUniformFAdd 34 ExclusiveScan 1416 + 1418: 40(ptr) AccessChain 27(data) 1413 29 + 1419: 18(fvec4) Load 1418 + 1420: 18(fvec4) VectorShuffle 1419 1417 4 5 2 3 + Store 1418 1420 + 1421: 6(int) Load 8(invocation) + 1422: 40(ptr) AccessChain 27(data) 49 29 + 1423: 18(fvec4) Load 1422 + 1424: 50(fvec3) VectorShuffle 1423 1423 0 1 2 + 1425: 50(fvec3) GroupNonUniformFAdd 34 ExclusiveScan 1424 + 1426: 40(ptr) AccessChain 27(data) 1421 29 + 1427: 18(fvec4) Load 1426 + 1428: 18(fvec4) VectorShuffle 1427 1425 4 5 6 3 + Store 1426 1428 + 1429: 6(int) Load 8(invocation) + 1430: 40(ptr) AccessChain 27(data) 59 29 + 1431: 18(fvec4) Load 1430 + 1432: 18(fvec4) GroupNonUniformFAdd 34 ExclusiveScan 1431 + 1433: 40(ptr) AccessChain 27(data) 1429 29 + Store 1433 1432 + 1434: 6(int) Load 8(invocation) + 1435: 65(ptr) AccessChain 27(data) 29 38 30 + 1436: 19(int) Load 1435 + 1437: 19(int) GroupNonUniformIAdd 34 ExclusiveScan 1436 + 1438: 65(ptr) AccessChain 27(data) 1434 38 30 + Store 1438 1437 + 1439: 6(int) Load 8(invocation) + 1440: 72(ptr) AccessChain 27(data) 38 38 + 1441: 20(ivec4) Load 1440 + 1442: 71(ivec2) VectorShuffle 1441 1441 0 1 + 1443: 71(ivec2) GroupNonUniformIAdd 34 ExclusiveScan 1442 + 1444: 72(ptr) AccessChain 27(data) 1439 38 + 1445: 20(ivec4) Load 1444 + 1446: 20(ivec4) VectorShuffle 1445 1443 4 5 2 3 + Store 1444 1446 + 1447: 6(int) Load 8(invocation) + 1448: 72(ptr) AccessChain 27(data) 49 38 + 1449: 20(ivec4) Load 1448 + 1450: 81(ivec3) VectorShuffle 1449 1449 0 1 2 + 1451: 81(ivec3) GroupNonUniformIAdd 34 ExclusiveScan 1450 + 1452: 72(ptr) AccessChain 27(data) 1447 38 + 1453: 20(ivec4) Load 1452 + 1454: 20(ivec4) VectorShuffle 1453 1451 4 5 6 3 + Store 1452 1454 + 1455: 6(int) Load 8(invocation) + 1456: 72(ptr) AccessChain 27(data) 59 38 + 1457: 20(ivec4) Load 1456 + 1458: 20(ivec4) GroupNonUniformIAdd 34 ExclusiveScan 1457 + 1459: 72(ptr) AccessChain 27(data) 1455 38 + Store 1459 1458 + 1460: 6(int) Load 8(invocation) + 1461: 95(ptr) AccessChain 27(data) 29 49 30 + 1462: 6(int) Load 1461 + 1463: 6(int) GroupNonUniformIAdd 34 ExclusiveScan 1462 + 1464: 95(ptr) AccessChain 27(data) 1460 49 30 + Store 1464 1463 + 1465: 6(int) Load 8(invocation) + 1466: 102(ptr) AccessChain 27(data) 38 49 + 1467: 21(ivec4) Load 1466 + 1468: 101(ivec2) VectorShuffle 1467 1467 0 1 + 1469: 101(ivec2) GroupNonUniformIAdd 34 ExclusiveScan 1468 + 1470: 102(ptr) AccessChain 27(data) 1465 49 + 1471: 21(ivec4) Load 1470 + 1472: 21(ivec4) VectorShuffle 1471 1469 4 5 2 3 + Store 1470 1472 + 1473: 6(int) Load 8(invocation) + 1474: 102(ptr) AccessChain 27(data) 49 49 + 1475: 21(ivec4) Load 1474 + 1476: 111(ivec3) VectorShuffle 1475 1475 0 1 2 + 1477: 111(ivec3) GroupNonUniformIAdd 34 ExclusiveScan 1476 + 1478: 102(ptr) AccessChain 27(data) 1473 49 + 1479: 21(ivec4) Load 1478 + 1480: 21(ivec4) VectorShuffle 1479 1477 4 5 6 3 + Store 1478 1480 + 1481: 6(int) Load 8(invocation) + 1482: 102(ptr) AccessChain 27(data) 59 49 + 1483: 21(ivec4) Load 1482 + 1484: 21(ivec4) GroupNonUniformIAdd 34 ExclusiveScan 1483 + 1485: 102(ptr) AccessChain 27(data) 1481 49 + Store 1485 1484 + 1486: 6(int) Load 8(invocation) + 1487: 125(ptr) AccessChain 27(data) 29 59 30 + 1488:22(float64_t) Load 1487 + 1489:22(float64_t) GroupNonUniformFAdd 34 ExclusiveScan 1488 + 1490: 125(ptr) AccessChain 27(data) 1486 59 30 + Store 1490 1489 + 1491: 6(int) Load 8(invocation) + 1492: 132(ptr) AccessChain 27(data) 38 59 + 1493: 23(f64vec4) Load 1492 + 1494:131(f64vec2) VectorShuffle 1493 1493 0 1 + 1495:131(f64vec2) GroupNonUniformFAdd 34 ExclusiveScan 1494 + 1496: 132(ptr) AccessChain 27(data) 1491 59 + 1497: 23(f64vec4) Load 1496 + 1498: 23(f64vec4) VectorShuffle 1497 1495 4 5 2 3 + Store 1496 1498 + 1499: 6(int) Load 8(invocation) + 1500: 132(ptr) AccessChain 27(data) 49 59 + 1501: 23(f64vec4) Load 1500 + 1502:141(f64vec3) VectorShuffle 1501 1501 0 1 2 + 1503:141(f64vec3) GroupNonUniformFAdd 34 ExclusiveScan 1502 + 1504: 132(ptr) AccessChain 27(data) 1499 59 + 1505: 23(f64vec4) Load 1504 + 1506: 23(f64vec4) VectorShuffle 1505 1503 4 5 6 3 + Store 1504 1506 + 1507: 6(int) Load 8(invocation) + 1508: 132(ptr) AccessChain 27(data) 59 59 + 1509: 23(f64vec4) Load 1508 + 1510: 23(f64vec4) GroupNonUniformFAdd 34 ExclusiveScan 1509 + 1511: 132(ptr) AccessChain 27(data) 1507 59 + Store 1511 1510 + 1512: 6(int) Load 8(invocation) + 1513: 31(ptr) AccessChain 27(data) 29 29 30 + 1514: 17(float) Load 1513 + 1515: 17(float) GroupNonUniformFMul 34 ExclusiveScan 1514 + 1516: 31(ptr) AccessChain 27(data) 1512 29 30 + Store 1516 1515 + 1517: 6(int) Load 8(invocation) + 1518: 40(ptr) AccessChain 27(data) 38 29 + 1519: 18(fvec4) Load 1518 + 1520: 39(fvec2) VectorShuffle 1519 1519 0 1 + 1521: 39(fvec2) GroupNonUniformFMul 34 ExclusiveScan 1520 + 1522: 40(ptr) AccessChain 27(data) 1517 29 + 1523: 18(fvec4) Load 1522 + 1524: 18(fvec4) VectorShuffle 1523 1521 4 5 2 3 + Store 1522 1524 + 1525: 6(int) Load 8(invocation) + 1526: 40(ptr) AccessChain 27(data) 49 29 + 1527: 18(fvec4) Load 1526 + 1528: 50(fvec3) VectorShuffle 1527 1527 0 1 2 + 1529: 50(fvec3) GroupNonUniformFMul 34 ExclusiveScan 1528 + 1530: 40(ptr) AccessChain 27(data) 1525 29 + 1531: 18(fvec4) Load 1530 + 1532: 18(fvec4) VectorShuffle 1531 1529 4 5 6 3 + Store 1530 1532 + 1533: 6(int) Load 8(invocation) + 1534: 40(ptr) AccessChain 27(data) 59 29 + 1535: 18(fvec4) Load 1534 + 1536: 18(fvec4) GroupNonUniformFMul 34 ExclusiveScan 1535 + 1537: 40(ptr) AccessChain 27(data) 1533 29 + Store 1537 1536 + 1538: 6(int) Load 8(invocation) + 1539: 65(ptr) AccessChain 27(data) 29 38 30 + 1540: 19(int) Load 1539 + 1541: 19(int) GroupNonUniformIMul 34 ExclusiveScan 1540 + 1542: 65(ptr) AccessChain 27(data) 1538 38 30 + Store 1542 1541 + 1543: 6(int) Load 8(invocation) + 1544: 72(ptr) AccessChain 27(data) 38 38 + 1545: 20(ivec4) Load 1544 + 1546: 71(ivec2) VectorShuffle 1545 1545 0 1 + 1547: 71(ivec2) GroupNonUniformIMul 34 ExclusiveScan 1546 + 1548: 72(ptr) AccessChain 27(data) 1543 38 + 1549: 20(ivec4) Load 1548 + 1550: 20(ivec4) VectorShuffle 1549 1547 4 5 2 3 + Store 1548 1550 + 1551: 6(int) Load 8(invocation) + 1552: 72(ptr) AccessChain 27(data) 49 38 + 1553: 20(ivec4) Load 1552 + 1554: 81(ivec3) VectorShuffle 1553 1553 0 1 2 + 1555: 81(ivec3) GroupNonUniformIMul 34 ExclusiveScan 1554 + 1556: 72(ptr) AccessChain 27(data) 1551 38 + 1557: 20(ivec4) Load 1556 + 1558: 20(ivec4) VectorShuffle 1557 1555 4 5 6 3 + Store 1556 1558 + 1559: 6(int) Load 8(invocation) + 1560: 72(ptr) AccessChain 27(data) 59 38 + 1561: 20(ivec4) Load 1560 + 1562: 20(ivec4) GroupNonUniformIMul 34 ExclusiveScan 1561 + 1563: 72(ptr) AccessChain 27(data) 1559 38 + Store 1563 1562 + 1564: 6(int) Load 8(invocation) + 1565: 95(ptr) AccessChain 27(data) 29 49 30 + 1566: 6(int) Load 1565 + 1567: 6(int) GroupNonUniformIMul 34 ExclusiveScan 1566 + 1568: 95(ptr) AccessChain 27(data) 1564 49 30 + Store 1568 1567 + 1569: 6(int) Load 8(invocation) + 1570: 102(ptr) AccessChain 27(data) 38 49 + 1571: 21(ivec4) Load 1570 + 1572: 101(ivec2) VectorShuffle 1571 1571 0 1 + 1573: 101(ivec2) GroupNonUniformIMul 34 ExclusiveScan 1572 + 1574: 102(ptr) AccessChain 27(data) 1569 49 + 1575: 21(ivec4) Load 1574 + 1576: 21(ivec4) VectorShuffle 1575 1573 4 5 2 3 + Store 1574 1576 + 1577: 6(int) Load 8(invocation) + 1578: 102(ptr) AccessChain 27(data) 49 49 + 1579: 21(ivec4) Load 1578 + 1580: 111(ivec3) VectorShuffle 1579 1579 0 1 2 + 1581: 111(ivec3) GroupNonUniformIMul 34 ExclusiveScan 1580 + 1582: 102(ptr) AccessChain 27(data) 1577 49 + 1583: 21(ivec4) Load 1582 + 1584: 21(ivec4) VectorShuffle 1583 1581 4 5 6 3 + Store 1582 1584 + 1585: 6(int) Load 8(invocation) + 1586: 102(ptr) AccessChain 27(data) 59 49 + 1587: 21(ivec4) Load 1586 + 1588: 21(ivec4) GroupNonUniformIMul 34 ExclusiveScan 1587 + 1589: 102(ptr) AccessChain 27(data) 1585 49 + Store 1589 1588 + 1590: 6(int) Load 8(invocation) + 1591: 125(ptr) AccessChain 27(data) 29 59 30 + 1592:22(float64_t) Load 1591 + 1593:22(float64_t) GroupNonUniformFMul 34 ExclusiveScan 1592 + 1594: 125(ptr) AccessChain 27(data) 1590 59 30 + Store 1594 1593 + 1595: 6(int) Load 8(invocation) + 1596: 132(ptr) AccessChain 27(data) 38 59 + 1597: 23(f64vec4) Load 1596 + 1598:131(f64vec2) VectorShuffle 1597 1597 0 1 + 1599:131(f64vec2) GroupNonUniformFMul 34 ExclusiveScan 1598 + 1600: 132(ptr) AccessChain 27(data) 1595 59 + 1601: 23(f64vec4) Load 1600 + 1602: 23(f64vec4) VectorShuffle 1601 1599 4 5 2 3 + Store 1600 1602 + 1603: 6(int) Load 8(invocation) + 1604: 132(ptr) AccessChain 27(data) 49 59 + 1605: 23(f64vec4) Load 1604 + 1606:141(f64vec3) VectorShuffle 1605 1605 0 1 2 + 1607:141(f64vec3) GroupNonUniformFMul 34 ExclusiveScan 1606 + 1608: 132(ptr) AccessChain 27(data) 1603 59 + 1609: 23(f64vec4) Load 1608 + 1610: 23(f64vec4) VectorShuffle 1609 1607 4 5 6 3 + Store 1608 1610 + 1611: 6(int) Load 8(invocation) + 1612: 132(ptr) AccessChain 27(data) 59 59 + 1613: 23(f64vec4) Load 1612 + 1614: 23(f64vec4) GroupNonUniformFMul 34 ExclusiveScan 1613 + 1615: 132(ptr) AccessChain 27(data) 1611 59 + Store 1615 1614 + 1616: 6(int) Load 8(invocation) + 1617: 31(ptr) AccessChain 27(data) 29 29 30 + 1618: 17(float) Load 1617 + 1619: 17(float) GroupNonUniformFMin 34 ExclusiveScan 1618 + 1620: 31(ptr) AccessChain 27(data) 1616 29 30 + Store 1620 1619 + 1621: 6(int) Load 8(invocation) + 1622: 40(ptr) AccessChain 27(data) 38 29 + 1623: 18(fvec4) Load 1622 + 1624: 39(fvec2) VectorShuffle 1623 1623 0 1 + 1625: 39(fvec2) GroupNonUniformFMin 34 ExclusiveScan 1624 + 1626: 40(ptr) AccessChain 27(data) 1621 29 + 1627: 18(fvec4) Load 1626 + 1628: 18(fvec4) VectorShuffle 1627 1625 4 5 2 3 + Store 1626 1628 + 1629: 6(int) Load 8(invocation) + 1630: 40(ptr) AccessChain 27(data) 49 29 + 1631: 18(fvec4) Load 1630 + 1632: 50(fvec3) VectorShuffle 1631 1631 0 1 2 + 1633: 50(fvec3) GroupNonUniformFMin 34 ExclusiveScan 1632 + 1634: 40(ptr) AccessChain 27(data) 1629 29 + 1635: 18(fvec4) Load 1634 + 1636: 18(fvec4) VectorShuffle 1635 1633 4 5 6 3 + Store 1634 1636 + 1637: 6(int) Load 8(invocation) + 1638: 40(ptr) AccessChain 27(data) 59 29 + 1639: 18(fvec4) Load 1638 + 1640: 18(fvec4) GroupNonUniformFMin 34 ExclusiveScan 1639 + 1641: 40(ptr) AccessChain 27(data) 1637 29 + Store 1641 1640 + 1642: 6(int) Load 8(invocation) + 1643: 65(ptr) AccessChain 27(data) 29 38 30 + 1644: 19(int) Load 1643 + 1645: 19(int) GroupNonUniformSMin 34 ExclusiveScan 1644 + 1646: 65(ptr) AccessChain 27(data) 1642 38 30 + Store 1646 1645 + 1647: 6(int) Load 8(invocation) + 1648: 72(ptr) AccessChain 27(data) 38 38 + 1649: 20(ivec4) Load 1648 + 1650: 71(ivec2) VectorShuffle 1649 1649 0 1 + 1651: 71(ivec2) GroupNonUniformSMin 34 ExclusiveScan 1650 + 1652: 72(ptr) AccessChain 27(data) 1647 38 + 1653: 20(ivec4) Load 1652 + 1654: 20(ivec4) VectorShuffle 1653 1651 4 5 2 3 + Store 1652 1654 + 1655: 6(int) Load 8(invocation) + 1656: 72(ptr) AccessChain 27(data) 49 38 + 1657: 20(ivec4) Load 1656 + 1658: 81(ivec3) VectorShuffle 1657 1657 0 1 2 + 1659: 81(ivec3) GroupNonUniformSMin 34 ExclusiveScan 1658 + 1660: 72(ptr) AccessChain 27(data) 1655 38 + 1661: 20(ivec4) Load 1660 + 1662: 20(ivec4) VectorShuffle 1661 1659 4 5 6 3 + Store 1660 1662 + 1663: 6(int) Load 8(invocation) + 1664: 72(ptr) AccessChain 27(data) 59 38 + 1665: 20(ivec4) Load 1664 + 1666: 20(ivec4) GroupNonUniformSMin 34 ExclusiveScan 1665 + 1667: 72(ptr) AccessChain 27(data) 1663 38 + Store 1667 1666 + 1668: 6(int) Load 8(invocation) + 1669: 95(ptr) AccessChain 27(data) 29 49 30 + 1670: 6(int) Load 1669 + 1671: 6(int) GroupNonUniformUMin 34 ExclusiveScan 1670 + 1672: 95(ptr) AccessChain 27(data) 1668 49 30 + Store 1672 1671 + 1673: 6(int) Load 8(invocation) + 1674: 102(ptr) AccessChain 27(data) 38 49 + 1675: 21(ivec4) Load 1674 + 1676: 101(ivec2) VectorShuffle 1675 1675 0 1 + 1677: 101(ivec2) GroupNonUniformUMin 34 ExclusiveScan 1676 + 1678: 102(ptr) AccessChain 27(data) 1673 49 + 1679: 21(ivec4) Load 1678 + 1680: 21(ivec4) VectorShuffle 1679 1677 4 5 2 3 + Store 1678 1680 + 1681: 6(int) Load 8(invocation) + 1682: 102(ptr) AccessChain 27(data) 49 49 + 1683: 21(ivec4) Load 1682 + 1684: 111(ivec3) VectorShuffle 1683 1683 0 1 2 + 1685: 111(ivec3) GroupNonUniformUMin 34 ExclusiveScan 1684 + 1686: 102(ptr) AccessChain 27(data) 1681 49 + 1687: 21(ivec4) Load 1686 + 1688: 21(ivec4) VectorShuffle 1687 1685 4 5 6 3 + Store 1686 1688 + 1689: 6(int) Load 8(invocation) + 1690: 102(ptr) AccessChain 27(data) 59 49 + 1691: 21(ivec4) Load 1690 + 1692: 21(ivec4) GroupNonUniformUMin 34 ExclusiveScan 1691 + 1693: 102(ptr) AccessChain 27(data) 1689 49 + Store 1693 1692 + 1694: 6(int) Load 8(invocation) + 1695: 125(ptr) AccessChain 27(data) 29 59 30 + 1696:22(float64_t) Load 1695 + 1697:22(float64_t) GroupNonUniformFMin 34 ExclusiveScan 1696 + 1698: 125(ptr) AccessChain 27(data) 1694 59 30 + Store 1698 1697 + 1699: 6(int) Load 8(invocation) + 1700: 132(ptr) AccessChain 27(data) 38 59 + 1701: 23(f64vec4) Load 1700 + 1702:131(f64vec2) VectorShuffle 1701 1701 0 1 + 1703:131(f64vec2) GroupNonUniformFMin 34 ExclusiveScan 1702 + 1704: 132(ptr) AccessChain 27(data) 1699 59 + 1705: 23(f64vec4) Load 1704 + 1706: 23(f64vec4) VectorShuffle 1705 1703 4 5 2 3 + Store 1704 1706 + 1707: 6(int) Load 8(invocation) + 1708: 132(ptr) AccessChain 27(data) 49 59 + 1709: 23(f64vec4) Load 1708 + 1710:141(f64vec3) VectorShuffle 1709 1709 0 1 2 + 1711:141(f64vec3) GroupNonUniformFMin 34 ExclusiveScan 1710 + 1712: 132(ptr) AccessChain 27(data) 1707 59 + 1713: 23(f64vec4) Load 1712 + 1714: 23(f64vec4) VectorShuffle 1713 1711 4 5 6 3 + Store 1712 1714 + 1715: 6(int) Load 8(invocation) + 1716: 132(ptr) AccessChain 27(data) 59 59 + 1717: 23(f64vec4) Load 1716 + 1718: 23(f64vec4) GroupNonUniformFMin 34 ExclusiveScan 1717 + 1719: 132(ptr) AccessChain 27(data) 1715 59 + Store 1719 1718 + 1720: 6(int) Load 8(invocation) + 1721: 31(ptr) AccessChain 27(data) 29 29 30 + 1722: 17(float) Load 1721 + 1723: 17(float) GroupNonUniformFMax 34 ExclusiveScan 1722 + 1724: 31(ptr) AccessChain 27(data) 1720 29 30 + Store 1724 1723 + 1725: 6(int) Load 8(invocation) + 1726: 40(ptr) AccessChain 27(data) 38 29 + 1727: 18(fvec4) Load 1726 + 1728: 39(fvec2) VectorShuffle 1727 1727 0 1 + 1729: 39(fvec2) GroupNonUniformFMax 34 ExclusiveScan 1728 + 1730: 40(ptr) AccessChain 27(data) 1725 29 + 1731: 18(fvec4) Load 1730 + 1732: 18(fvec4) VectorShuffle 1731 1729 4 5 2 3 + Store 1730 1732 + 1733: 6(int) Load 8(invocation) + 1734: 40(ptr) AccessChain 27(data) 49 29 + 1735: 18(fvec4) Load 1734 + 1736: 50(fvec3) VectorShuffle 1735 1735 0 1 2 + 1737: 50(fvec3) GroupNonUniformFMax 34 ExclusiveScan 1736 + 1738: 40(ptr) AccessChain 27(data) 1733 29 + 1739: 18(fvec4) Load 1738 + 1740: 18(fvec4) VectorShuffle 1739 1737 4 5 6 3 + Store 1738 1740 + 1741: 6(int) Load 8(invocation) + 1742: 40(ptr) AccessChain 27(data) 59 29 + 1743: 18(fvec4) Load 1742 + 1744: 18(fvec4) GroupNonUniformFMax 34 ExclusiveScan 1743 + 1745: 40(ptr) AccessChain 27(data) 1741 29 + Store 1745 1744 + 1746: 6(int) Load 8(invocation) + 1747: 65(ptr) AccessChain 27(data) 29 38 30 + 1748: 19(int) Load 1747 + 1749: 19(int) GroupNonUniformSMax 34 ExclusiveScan 1748 + 1750: 65(ptr) AccessChain 27(data) 1746 38 30 + Store 1750 1749 + 1751: 6(int) Load 8(invocation) + 1752: 72(ptr) AccessChain 27(data) 38 38 + 1753: 20(ivec4) Load 1752 + 1754: 71(ivec2) VectorShuffle 1753 1753 0 1 + 1755: 71(ivec2) GroupNonUniformSMax 34 ExclusiveScan 1754 + 1756: 72(ptr) AccessChain 27(data) 1751 38 + 1757: 20(ivec4) Load 1756 + 1758: 20(ivec4) VectorShuffle 1757 1755 4 5 2 3 + Store 1756 1758 + 1759: 6(int) Load 8(invocation) + 1760: 72(ptr) AccessChain 27(data) 49 38 + 1761: 20(ivec4) Load 1760 + 1762: 81(ivec3) VectorShuffle 1761 1761 0 1 2 + 1763: 81(ivec3) GroupNonUniformSMax 34 ExclusiveScan 1762 + 1764: 72(ptr) AccessChain 27(data) 1759 38 + 1765: 20(ivec4) Load 1764 + 1766: 20(ivec4) VectorShuffle 1765 1763 4 5 6 3 + Store 1764 1766 + 1767: 6(int) Load 8(invocation) + 1768: 72(ptr) AccessChain 27(data) 59 38 + 1769: 20(ivec4) Load 1768 + 1770: 20(ivec4) GroupNonUniformSMax 34 ExclusiveScan 1769 + 1771: 72(ptr) AccessChain 27(data) 1767 38 + Store 1771 1770 + 1772: 6(int) Load 8(invocation) + 1773: 95(ptr) AccessChain 27(data) 29 49 30 + 1774: 6(int) Load 1773 + 1775: 6(int) GroupNonUniformUMax 34 ExclusiveScan 1774 + 1776: 95(ptr) AccessChain 27(data) 1772 49 30 + Store 1776 1775 + 1777: 6(int) Load 8(invocation) + 1778: 102(ptr) AccessChain 27(data) 38 49 + 1779: 21(ivec4) Load 1778 + 1780: 101(ivec2) VectorShuffle 1779 1779 0 1 + 1781: 101(ivec2) GroupNonUniformUMax 34 ExclusiveScan 1780 + 1782: 102(ptr) AccessChain 27(data) 1777 49 + 1783: 21(ivec4) Load 1782 + 1784: 21(ivec4) VectorShuffle 1783 1781 4 5 2 3 + Store 1782 1784 + 1785: 6(int) Load 8(invocation) + 1786: 102(ptr) AccessChain 27(data) 49 49 + 1787: 21(ivec4) Load 1786 + 1788: 111(ivec3) VectorShuffle 1787 1787 0 1 2 + 1789: 111(ivec3) GroupNonUniformUMax 34 ExclusiveScan 1788 + 1790: 102(ptr) AccessChain 27(data) 1785 49 + 1791: 21(ivec4) Load 1790 + 1792: 21(ivec4) VectorShuffle 1791 1789 4 5 6 3 + Store 1790 1792 + 1793: 6(int) Load 8(invocation) + 1794: 102(ptr) AccessChain 27(data) 59 49 + 1795: 21(ivec4) Load 1794 + 1796: 21(ivec4) GroupNonUniformUMax 34 ExclusiveScan 1795 + 1797: 102(ptr) AccessChain 27(data) 1793 49 + Store 1797 1796 + 1798: 6(int) Load 8(invocation) + 1799: 125(ptr) AccessChain 27(data) 29 59 30 + 1800:22(float64_t) Load 1799 + 1801:22(float64_t) GroupNonUniformFMax 34 ExclusiveScan 1800 + 1802: 125(ptr) AccessChain 27(data) 1798 59 30 + Store 1802 1801 + 1803: 6(int) Load 8(invocation) + 1804: 132(ptr) AccessChain 27(data) 38 59 + 1805: 23(f64vec4) Load 1804 + 1806:131(f64vec2) VectorShuffle 1805 1805 0 1 + 1807:131(f64vec2) GroupNonUniformFMax 34 ExclusiveScan 1806 + 1808: 132(ptr) AccessChain 27(data) 1803 59 + 1809: 23(f64vec4) Load 1808 + 1810: 23(f64vec4) VectorShuffle 1809 1807 4 5 2 3 + Store 1808 1810 + 1811: 6(int) Load 8(invocation) + 1812: 132(ptr) AccessChain 27(data) 49 59 + 1813: 23(f64vec4) Load 1812 + 1814:141(f64vec3) VectorShuffle 1813 1813 0 1 2 + 1815:141(f64vec3) GroupNonUniformFMax 34 ExclusiveScan 1814 + 1816: 132(ptr) AccessChain 27(data) 1811 59 + 1817: 23(f64vec4) Load 1816 + 1818: 23(f64vec4) VectorShuffle 1817 1815 4 5 6 3 + Store 1816 1818 + 1819: 6(int) Load 8(invocation) + 1820: 132(ptr) AccessChain 27(data) 59 59 + 1821: 23(f64vec4) Load 1820 + 1822: 23(f64vec4) GroupNonUniformFMax 34 ExclusiveScan 1821 + 1823: 132(ptr) AccessChain 27(data) 1819 59 + Store 1823 1822 + 1824: 6(int) Load 8(invocation) + 1825: 65(ptr) AccessChain 27(data) 29 38 30 + 1826: 19(int) Load 1825 + 1827: 19(int) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1826 + 1828: 65(ptr) AccessChain 27(data) 1824 38 30 + Store 1828 1827 + 1829: 6(int) Load 8(invocation) + 1830: 72(ptr) AccessChain 27(data) 38 38 + 1831: 20(ivec4) Load 1830 + 1832: 71(ivec2) VectorShuffle 1831 1831 0 1 + 1833: 71(ivec2) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1832 + 1834: 72(ptr) AccessChain 27(data) 1829 38 + 1835: 20(ivec4) Load 1834 + 1836: 20(ivec4) VectorShuffle 1835 1833 4 5 2 3 + Store 1834 1836 + 1837: 6(int) Load 8(invocation) + 1838: 72(ptr) AccessChain 27(data) 49 38 + 1839: 20(ivec4) Load 1838 + 1840: 81(ivec3) VectorShuffle 1839 1839 0 1 2 + 1841: 81(ivec3) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1840 + 1842: 72(ptr) AccessChain 27(data) 1837 38 + 1843: 20(ivec4) Load 1842 + 1844: 20(ivec4) VectorShuffle 1843 1841 4 5 6 3 + Store 1842 1844 + 1845: 6(int) Load 8(invocation) + 1846: 72(ptr) AccessChain 27(data) 59 38 + 1847: 20(ivec4) Load 1846 + 1848: 20(ivec4) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1847 + 1849: 72(ptr) AccessChain 27(data) 1845 38 + Store 1849 1848 + 1850: 6(int) Load 8(invocation) + 1851: 95(ptr) AccessChain 27(data) 29 49 30 + 1852: 6(int) Load 1851 + 1853: 6(int) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1852 + 1854: 95(ptr) AccessChain 27(data) 1850 49 30 + Store 1854 1853 + 1855: 6(int) Load 8(invocation) + 1856: 102(ptr) AccessChain 27(data) 38 49 + 1857: 21(ivec4) Load 1856 + 1858: 101(ivec2) VectorShuffle 1857 1857 0 1 + 1859: 101(ivec2) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1858 + 1860: 102(ptr) AccessChain 27(data) 1855 49 + 1861: 21(ivec4) Load 1860 + 1862: 21(ivec4) VectorShuffle 1861 1859 4 5 2 3 + Store 1860 1862 + 1863: 6(int) Load 8(invocation) + 1864: 102(ptr) AccessChain 27(data) 49 49 + 1865: 21(ivec4) Load 1864 + 1866: 111(ivec3) VectorShuffle 1865 1865 0 1 2 + 1867: 111(ivec3) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1866 + 1868: 102(ptr) AccessChain 27(data) 1863 49 + 1869: 21(ivec4) Load 1868 + 1870: 21(ivec4) VectorShuffle 1869 1867 4 5 6 3 + Store 1868 1870 + 1871: 6(int) Load 8(invocation) + 1872: 102(ptr) AccessChain 27(data) 59 49 + 1873: 21(ivec4) Load 1872 + 1874: 21(ivec4) GroupNonUniformBitwiseAnd 34 ExclusiveScan 1873 + 1875: 102(ptr) AccessChain 27(data) 1871 49 + Store 1875 1874 + 1876: 6(int) Load 8(invocation) + 1877: 65(ptr) AccessChain 27(data) 29 38 30 + 1878: 19(int) Load 1877 + 1879: 521(bool) SLessThan 1878 29 + 1880: 521(bool) GroupNonUniformLogicalAnd 34 ExclusiveScan 1879 + 1881: 19(int) Select 1880 38 29 + 1882: 65(ptr) AccessChain 27(data) 1876 38 30 + Store 1882 1881 + 1883: 6(int) Load 8(invocation) + 1884: 72(ptr) AccessChain 27(data) 38 38 + 1885: 20(ivec4) Load 1884 + 1886: 71(ivec2) VectorShuffle 1885 1885 0 1 + 1887: 531(bvec2) SLessThan 1886 530 + 1888: 531(bvec2) GroupNonUniformLogicalAnd 34 ExclusiveScan 1887 + 1889: 71(ivec2) Select 1888 534 530 + 1890: 72(ptr) AccessChain 27(data) 1883 38 + 1891: 20(ivec4) Load 1890 + 1892: 20(ivec4) VectorShuffle 1891 1889 4 5 2 3 + Store 1890 1892 + 1893: 6(int) Load 8(invocation) + 1894: 72(ptr) AccessChain 27(data) 38 38 + 1895: 20(ivec4) Load 1894 + 1896: 81(ivec3) VectorShuffle 1895 1895 0 1 2 + 1897: 544(bvec3) SLessThan 1896 543 + 1898: 544(bvec3) GroupNonUniformLogicalAnd 34 ExclusiveScan 1897 + 1899: 81(ivec3) Select 1898 547 543 + 1900: 72(ptr) AccessChain 27(data) 1893 38 + 1901: 20(ivec4) Load 1900 + 1902: 20(ivec4) VectorShuffle 1901 1899 4 5 6 3 + Store 1900 1902 + 1903: 6(int) Load 8(invocation) + 1904: 72(ptr) AccessChain 27(data) 38 38 + 1905: 20(ivec4) Load 1904 + 1906: 556(bvec4) SLessThan 1905 555 + 1907: 556(bvec4) GroupNonUniformLogicalAnd 34 ExclusiveScan 1906 + 1908: 20(ivec4) Select 1907 559 555 + 1909: 72(ptr) AccessChain 27(data) 1903 38 + Store 1909 1908 + 1910: 6(int) Load 8(invocation) + 1911: 65(ptr) AccessChain 27(data) 29 38 30 + 1912: 19(int) Load 1911 + 1913: 19(int) GroupNonUniformBitwiseOr 34 ExclusiveScan 1912 + 1914: 65(ptr) AccessChain 27(data) 1910 38 30 + Store 1914 1913 + 1915: 6(int) Load 8(invocation) + 1916: 72(ptr) AccessChain 27(data) 38 38 + 1917: 20(ivec4) Load 1916 + 1918: 71(ivec2) VectorShuffle 1917 1917 0 1 + 1919: 71(ivec2) GroupNonUniformBitwiseOr 34 ExclusiveScan 1918 + 1920: 72(ptr) AccessChain 27(data) 1915 38 + 1921: 20(ivec4) Load 1920 + 1922: 20(ivec4) VectorShuffle 1921 1919 4 5 2 3 + Store 1920 1922 + 1923: 6(int) Load 8(invocation) + 1924: 72(ptr) AccessChain 27(data) 49 38 + 1925: 20(ivec4) Load 1924 + 1926: 81(ivec3) VectorShuffle 1925 1925 0 1 2 + 1927: 81(ivec3) GroupNonUniformBitwiseOr 34 ExclusiveScan 1926 + 1928: 72(ptr) AccessChain 27(data) 1923 38 + 1929: 20(ivec4) Load 1928 + 1930: 20(ivec4) VectorShuffle 1929 1927 4 5 6 3 + Store 1928 1930 + 1931: 6(int) Load 8(invocation) + 1932: 72(ptr) AccessChain 27(data) 59 38 + 1933: 20(ivec4) Load 1932 + 1934: 20(ivec4) GroupNonUniformBitwiseOr 34 ExclusiveScan 1933 + 1935: 72(ptr) AccessChain 27(data) 1931 38 + Store 1935 1934 + 1936: 6(int) Load 8(invocation) + 1937: 95(ptr) AccessChain 27(data) 29 49 30 + 1938: 6(int) Load 1937 + 1939: 6(int) GroupNonUniformBitwiseOr 34 ExclusiveScan 1938 + 1940: 95(ptr) AccessChain 27(data) 1936 49 30 + Store 1940 1939 + 1941: 6(int) Load 8(invocation) + 1942: 102(ptr) AccessChain 27(data) 38 49 + 1943: 21(ivec4) Load 1942 + 1944: 101(ivec2) VectorShuffle 1943 1943 0 1 + 1945: 101(ivec2) GroupNonUniformBitwiseOr 34 ExclusiveScan 1944 + 1946: 102(ptr) AccessChain 27(data) 1941 49 + 1947: 21(ivec4) Load 1946 + 1948: 21(ivec4) VectorShuffle 1947 1945 4 5 2 3 + Store 1946 1948 + 1949: 6(int) Load 8(invocation) + 1950: 102(ptr) AccessChain 27(data) 49 49 + 1951: 21(ivec4) Load 1950 + 1952: 111(ivec3) VectorShuffle 1951 1951 0 1 2 + 1953: 111(ivec3) GroupNonUniformBitwiseOr 34 ExclusiveScan 1952 + 1954: 102(ptr) AccessChain 27(data) 1949 49 + 1955: 21(ivec4) Load 1954 + 1956: 21(ivec4) VectorShuffle 1955 1953 4 5 6 3 + Store 1954 1956 + 1957: 6(int) Load 8(invocation) + 1958: 102(ptr) AccessChain 27(data) 59 49 + 1959: 21(ivec4) Load 1958 + 1960: 21(ivec4) GroupNonUniformBitwiseOr 34 ExclusiveScan 1959 + 1961: 102(ptr) AccessChain 27(data) 1957 49 + Store 1961 1960 + 1962: 6(int) Load 8(invocation) + 1963: 65(ptr) AccessChain 27(data) 29 38 30 + 1964: 19(int) Load 1963 + 1965: 521(bool) SLessThan 1964 29 + 1966: 521(bool) GroupNonUniformLogicalOr 34 ExclusiveScan 1965 + 1967: 19(int) Select 1966 38 29 + 1968: 65(ptr) AccessChain 27(data) 1962 38 30 + Store 1968 1967 + 1969: 6(int) Load 8(invocation) + 1970: 72(ptr) AccessChain 27(data) 38 38 + 1971: 20(ivec4) Load 1970 + 1972: 71(ivec2) VectorShuffle 1971 1971 0 1 + 1973: 531(bvec2) SLessThan 1972 530 + 1974: 531(bvec2) GroupNonUniformLogicalOr 34 ExclusiveScan 1973 + 1975: 71(ivec2) Select 1974 534 530 + 1976: 72(ptr) AccessChain 27(data) 1969 38 + 1977: 20(ivec4) Load 1976 + 1978: 20(ivec4) VectorShuffle 1977 1975 4 5 2 3 + Store 1976 1978 + 1979: 6(int) Load 8(invocation) + 1980: 72(ptr) AccessChain 27(data) 38 38 + 1981: 20(ivec4) Load 1980 + 1982: 81(ivec3) VectorShuffle 1981 1981 0 1 2 + 1983: 544(bvec3) SLessThan 1982 543 + 1984: 544(bvec3) GroupNonUniformLogicalOr 34 ExclusiveScan 1983 + 1985: 81(ivec3) Select 1984 547 543 + 1986: 72(ptr) AccessChain 27(data) 1979 38 + 1987: 20(ivec4) Load 1986 + 1988: 20(ivec4) VectorShuffle 1987 1985 4 5 6 3 + Store 1986 1988 + 1989: 6(int) Load 8(invocation) + 1990: 72(ptr) AccessChain 27(data) 38 38 + 1991: 20(ivec4) Load 1990 + 1992: 556(bvec4) SLessThan 1991 555 + 1993: 556(bvec4) GroupNonUniformLogicalOr 34 ExclusiveScan 1992 + 1994: 20(ivec4) Select 1993 559 555 + 1995: 72(ptr) AccessChain 27(data) 1989 38 + Store 1995 1994 + 1996: 6(int) Load 8(invocation) + 1997: 65(ptr) AccessChain 27(data) 29 38 30 + 1998: 19(int) Load 1997 + 1999: 19(int) GroupNonUniformBitwiseXor 34 ExclusiveScan 1998 + 2000: 65(ptr) AccessChain 27(data) 1996 38 30 + Store 2000 1999 + 2001: 6(int) Load 8(invocation) + 2002: 72(ptr) AccessChain 27(data) 38 38 + 2003: 20(ivec4) Load 2002 + 2004: 71(ivec2) VectorShuffle 2003 2003 0 1 + 2005: 71(ivec2) GroupNonUniformBitwiseXor 34 ExclusiveScan 2004 + 2006: 72(ptr) AccessChain 27(data) 2001 38 + 2007: 20(ivec4) Load 2006 + 2008: 20(ivec4) VectorShuffle 2007 2005 4 5 2 3 + Store 2006 2008 + 2009: 6(int) Load 8(invocation) + 2010: 72(ptr) AccessChain 27(data) 49 38 + 2011: 20(ivec4) Load 2010 + 2012: 81(ivec3) VectorShuffle 2011 2011 0 1 2 + 2013: 81(ivec3) GroupNonUniformBitwiseXor 34 ExclusiveScan 2012 + 2014: 72(ptr) AccessChain 27(data) 2009 38 + 2015: 20(ivec4) Load 2014 + 2016: 20(ivec4) VectorShuffle 2015 2013 4 5 6 3 + Store 2014 2016 + 2017: 6(int) Load 8(invocation) + 2018: 72(ptr) AccessChain 27(data) 59 38 + 2019: 20(ivec4) Load 2018 + 2020: 20(ivec4) GroupNonUniformBitwiseXor 34 ExclusiveScan 2019 + 2021: 72(ptr) AccessChain 27(data) 2017 38 + Store 2021 2020 + 2022: 6(int) Load 8(invocation) + 2023: 95(ptr) AccessChain 27(data) 29 49 30 + 2024: 6(int) Load 2023 + 2025: 6(int) GroupNonUniformBitwiseXor 34 ExclusiveScan 2024 + 2026: 95(ptr) AccessChain 27(data) 2022 49 30 + Store 2026 2025 + 2027: 6(int) Load 8(invocation) + 2028: 102(ptr) AccessChain 27(data) 38 49 + 2029: 21(ivec4) Load 2028 + 2030: 101(ivec2) VectorShuffle 2029 2029 0 1 + 2031: 101(ivec2) GroupNonUniformBitwiseXor 34 ExclusiveScan 2030 + 2032: 102(ptr) AccessChain 27(data) 2027 49 + 2033: 21(ivec4) Load 2032 + 2034: 21(ivec4) VectorShuffle 2033 2031 4 5 2 3 + Store 2032 2034 + 2035: 6(int) Load 8(invocation) + 2036: 102(ptr) AccessChain 27(data) 49 49 + 2037: 21(ivec4) Load 2036 + 2038: 111(ivec3) VectorShuffle 2037 2037 0 1 2 + 2039: 111(ivec3) GroupNonUniformBitwiseXor 34 ExclusiveScan 2038 + 2040: 102(ptr) AccessChain 27(data) 2035 49 + 2041: 21(ivec4) Load 2040 + 2042: 21(ivec4) VectorShuffle 2041 2039 4 5 6 3 + Store 2040 2042 + 2043: 6(int) Load 8(invocation) + 2044: 102(ptr) AccessChain 27(data) 59 49 + 2045: 21(ivec4) Load 2044 + 2046: 21(ivec4) GroupNonUniformBitwiseXor 34 ExclusiveScan 2045 + 2047: 102(ptr) AccessChain 27(data) 2043 49 + Store 2047 2046 + 2048: 6(int) Load 8(invocation) + 2049: 65(ptr) AccessChain 27(data) 29 38 30 + 2050: 19(int) Load 2049 + 2051: 521(bool) SLessThan 2050 29 + 2052: 521(bool) GroupNonUniformLogicalXor 34 ExclusiveScan 2051 + 2053: 19(int) Select 2052 38 29 + 2054: 65(ptr) AccessChain 27(data) 2048 38 30 + Store 2054 2053 + 2055: 6(int) Load 8(invocation) + 2056: 72(ptr) AccessChain 27(data) 38 38 + 2057: 20(ivec4) Load 2056 + 2058: 71(ivec2) VectorShuffle 2057 2057 0 1 + 2059: 531(bvec2) SLessThan 2058 530 + 2060: 531(bvec2) GroupNonUniformLogicalXor 34 ExclusiveScan 2059 + 2061: 71(ivec2) Select 2060 534 530 + 2062: 72(ptr) AccessChain 27(data) 2055 38 + 2063: 20(ivec4) Load 2062 + 2064: 20(ivec4) VectorShuffle 2063 2061 4 5 2 3 + Store 2062 2064 + 2065: 6(int) Load 8(invocation) + 2066: 72(ptr) AccessChain 27(data) 38 38 + 2067: 20(ivec4) Load 2066 + 2068: 81(ivec3) VectorShuffle 2067 2067 0 1 2 + 2069: 544(bvec3) SLessThan 2068 543 + 2070: 544(bvec3) GroupNonUniformLogicalXor 34 ExclusiveScan 2069 + 2071: 81(ivec3) Select 2070 547 543 + 2072: 72(ptr) AccessChain 27(data) 2065 38 + 2073: 20(ivec4) Load 2072 + 2074: 20(ivec4) VectorShuffle 2073 2071 4 5 6 3 + Store 2072 2074 + 2075: 6(int) Load 8(invocation) + 2076: 72(ptr) AccessChain 27(data) 38 38 + 2077: 20(ivec4) Load 2076 + 2078: 556(bvec4) SLessThan 2077 555 + 2079: 556(bvec4) GroupNonUniformLogicalXor 34 ExclusiveScan 2078 + 2080: 20(ivec4) Select 2079 559 555 + 2081: 72(ptr) AccessChain 27(data) 2075 38 + Store 2081 2080 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBallot.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBallot.comp.out new file mode 100644 index 00000000000..ea152d9af9a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBallot.comp.out @@ -0,0 +1,505 @@ +spv.subgroupBallot.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 397 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformBallot + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 21 23 26 29 32 + ExecutionMode 4 LocalSize 8 8 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_ballot" + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 19 "relMask" + Name 21 "gl_SubgroupEqMask" + Name 23 "gl_SubgroupGeMask" + Name 26 "gl_SubgroupGtMask" + Name 29 "gl_SubgroupLeMask" + Name 32 "gl_SubgroupLtMask" + Name 35 "result" + Name 46 "Buffers" + MemberName 46(Buffers) 0 "f4" + MemberName 46(Buffers) 1 "i4" + MemberName 46(Buffers) 2 "u4" + MemberName 46(Buffers) 3 "d4" + Name 49 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + Decorate 21(gl_SubgroupEqMask) BuiltIn SubgroupEqMaskKHR + Decorate 23(gl_SubgroupGeMask) BuiltIn SubgroupGeMaskKHR + Decorate 26(gl_SubgroupGtMask) BuiltIn SubgroupGtMaskKHR + Decorate 29(gl_SubgroupLeMask) BuiltIn SubgroupLeMaskKHR + Decorate 32(gl_SubgroupLtMask) BuiltIn SubgroupLtMaskKHR + MemberDecorate 46(Buffers) 0 Offset 0 + MemberDecorate 46(Buffers) 1 Offset 16 + MemberDecorate 46(Buffers) 2 Offset 32 + MemberDecorate 46(Buffers) 3 Offset 64 + Decorate 46(Buffers) Block + Decorate 49(data) DescriptorSet 0 + Decorate 49(data) Binding 0 + Decorate 396 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeVector 6(int) 4 + 18: TypePointer Function 17(ivec4) + 20: TypePointer Input 17(ivec4) +21(gl_SubgroupEqMask): 20(ptr) Variable Input +23(gl_SubgroupGeMask): 20(ptr) Variable Input +26(gl_SubgroupGtMask): 20(ptr) Variable Input +29(gl_SubgroupLeMask): 20(ptr) Variable Input +32(gl_SubgroupLtMask): 20(ptr) Variable Input + 36: TypeBool + 37: 36(bool) ConstantTrue + 38: 6(int) Constant 3 + 40: TypeFloat 32 + 41: TypeVector 40(float) 4 + 42: TypeInt 32 1 + 43: TypeVector 42(int) 4 + 44: TypeFloat 64 + 45: TypeVector 44(float64_t) 4 + 46(Buffers): TypeStruct 41(fvec4) 43(ivec4) 17(ivec4) 45(f64vec4) + 47: TypeArray 46(Buffers) 15 + 48: TypePointer StorageBuffer 47 + 49(data): 48(ptr) Variable StorageBuffer + 51: 42(int) Constant 2 + 54: 6(int) Constant 0 + 55: TypePointer StorageBuffer 6(int) + 60: 42(int) Constant 1 + 61: 42(int) Constant 0 + 64: 6(int) Constant 1 + 72: 6(int) Constant 2 + 83: TypeVector 36(bool) 4 + 88: TypePointer StorageBuffer 17(ivec4) + 96: TypePointer StorageBuffer 40(float) + 102: TypeVector 40(float) 2 + 103: TypePointer StorageBuffer 41(fvec4) + 112: TypeVector 40(float) 3 + 121: 42(int) Constant 3 + 127: TypePointer StorageBuffer 42(int) + 133: TypeVector 42(int) 2 + 134: TypePointer StorageBuffer 43(ivec4) + 143: TypeVector 42(int) 3 + 162: TypeVector 6(int) 2 + 171: TypeVector 6(int) 3 + 185: TypePointer StorageBuffer 44(float64_t) + 191: TypeVector 44(float64_t) 2 + 192: TypePointer StorageBuffer 45(f64vec4) + 201: TypeVector 44(float64_t) 3 + 225: 133(ivec2) ConstantComposite 61 61 + 226: TypeVector 36(bool) 2 + 229: 133(ivec2) ConstantComposite 60 60 + 238: 143(ivec3) ConstantComposite 61 61 61 + 239: TypeVector 36(bool) 3 + 242: 143(ivec3) ConstantComposite 60 60 60 + 250: 43(ivec4) ConstantComposite 61 61 61 61 + 253: 43(ivec4) ConstantComposite 60 60 60 60 + 395: 6(int) Constant 8 + 396: 171(ivec3) ConstantComposite 395 395 64 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 19(relMask): 18(ptr) Variable Function + 35(result): 18(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 22: 17(ivec4) Load 21(gl_SubgroupEqMask) + 24: 17(ivec4) Load 23(gl_SubgroupGeMask) + 25: 17(ivec4) IAdd 22 24 + 27: 17(ivec4) Load 26(gl_SubgroupGtMask) + 28: 17(ivec4) IAdd 25 27 + 30: 17(ivec4) Load 29(gl_SubgroupLeMask) + 31: 17(ivec4) IAdd 28 30 + 33: 17(ivec4) Load 32(gl_SubgroupLtMask) + 34: 17(ivec4) IAdd 31 33 + Store 19(relMask) 34 + 39: 17(ivec4) GroupNonUniformBallot 38 37 + Store 35(result) 39 + 50: 6(int) Load 8(invocation) + 52: 17(ivec4) Load 35(result) + 53: 6(int) GroupNonUniformBallotBitCount 38 Reduce 52 + 56: 55(ptr) AccessChain 49(data) 50 51 54 + Store 56 53 + 57: 6(int) Load 8(invocation) + 58: 17(ivec4) Load 35(result) + 59: 36(bool) GroupNonUniformBallotBitExtract 38 58 54 + 62: 42(int) Select 59 60 61 + 63: 6(int) Bitcast 62 + 65: 55(ptr) AccessChain 49(data) 57 51 64 + Store 65 63 + 66: 6(int) Load 8(invocation) + 67: 17(ivec4) Load 35(result) + 68: 6(int) GroupNonUniformBallotBitCount 38 InclusiveScan 67 + 69: 17(ivec4) Load 35(result) + 70: 6(int) GroupNonUniformBallotBitCount 38 ExclusiveScan 69 + 71: 6(int) IAdd 68 70 + 73: 55(ptr) AccessChain 49(data) 66 51 72 + Store 73 71 + 74: 6(int) Load 8(invocation) + 75: 17(ivec4) Load 35(result) + 76: 6(int) GroupNonUniformBallotFindLSB 38 75 + 77: 17(ivec4) Load 35(result) + 78: 6(int) GroupNonUniformBallotFindMSB 38 77 + 79: 6(int) IAdd 76 78 + 80: 55(ptr) AccessChain 49(data) 74 51 38 + Store 80 79 + 81: 17(ivec4) Load 19(relMask) + 82: 17(ivec4) Load 35(result) + 84: 83(bvec4) IEqual 81 82 + 85: 36(bool) All 84 + SelectionMerge 87 None + BranchConditional 85 86 87 + 86: Label + 89: 88(ptr) AccessChain 49(data) 61 51 + 90: 17(ivec4) Load 89 + 91: 36(bool) GroupNonUniformInverseBallot 38 90 + Branch 87 + 87: Label + 92: 36(bool) Phi 85 5 91 86 + SelectionMerge 94 None + BranchConditional 92 93 256 + 93: Label + 95: 6(int) Load 8(invocation) + 97: 96(ptr) AccessChain 49(data) 61 61 54 + 98: 40(float) Load 97 + 99: 40(float) GroupNonUniformBroadcast 38 98 38 + 100: 96(ptr) AccessChain 49(data) 95 61 54 + Store 100 99 + 101: 6(int) Load 8(invocation) + 104: 103(ptr) AccessChain 49(data) 60 61 + 105: 41(fvec4) Load 104 + 106: 102(fvec2) VectorShuffle 105 105 0 1 + 107: 102(fvec2) GroupNonUniformBroadcast 38 106 38 + 108: 103(ptr) AccessChain 49(data) 101 61 + 109: 41(fvec4) Load 108 + 110: 41(fvec4) VectorShuffle 109 107 4 5 2 3 + Store 108 110 + 111: 6(int) Load 8(invocation) + 113: 103(ptr) AccessChain 49(data) 51 61 + 114: 41(fvec4) Load 113 + 115: 112(fvec3) VectorShuffle 114 114 0 1 2 + 116: 112(fvec3) GroupNonUniformBroadcast 38 115 38 + 117: 103(ptr) AccessChain 49(data) 111 61 + 118: 41(fvec4) Load 117 + 119: 41(fvec4) VectorShuffle 118 116 4 5 6 3 + Store 117 119 + 120: 6(int) Load 8(invocation) + 122: 103(ptr) AccessChain 49(data) 121 61 + 123: 41(fvec4) Load 122 + 124: 41(fvec4) GroupNonUniformBroadcast 38 123 38 + 125: 103(ptr) AccessChain 49(data) 120 61 + Store 125 124 + 126: 6(int) Load 8(invocation) + 128: 127(ptr) AccessChain 49(data) 61 60 54 + 129: 42(int) Load 128 + 130: 42(int) GroupNonUniformBroadcast 38 129 72 + 131: 127(ptr) AccessChain 49(data) 126 60 54 + Store 131 130 + 132: 6(int) Load 8(invocation) + 135: 134(ptr) AccessChain 49(data) 60 60 + 136: 43(ivec4) Load 135 + 137: 133(ivec2) VectorShuffle 136 136 0 1 + 138: 133(ivec2) GroupNonUniformBroadcast 38 137 72 + 139: 134(ptr) AccessChain 49(data) 132 60 + 140: 43(ivec4) Load 139 + 141: 43(ivec4) VectorShuffle 140 138 4 5 2 3 + Store 139 141 + 142: 6(int) Load 8(invocation) + 144: 134(ptr) AccessChain 49(data) 51 60 + 145: 43(ivec4) Load 144 + 146: 143(ivec3) VectorShuffle 145 145 0 1 2 + 147: 143(ivec3) GroupNonUniformBroadcast 38 146 72 + 148: 134(ptr) AccessChain 49(data) 142 60 + 149: 43(ivec4) Load 148 + 150: 43(ivec4) VectorShuffle 149 147 4 5 6 3 + Store 148 150 + 151: 6(int) Load 8(invocation) + 152: 134(ptr) AccessChain 49(data) 121 60 + 153: 43(ivec4) Load 152 + 154: 43(ivec4) GroupNonUniformBroadcast 38 153 72 + 155: 134(ptr) AccessChain 49(data) 151 60 + Store 155 154 + 156: 6(int) Load 8(invocation) + 157: 55(ptr) AccessChain 49(data) 61 51 54 + 158: 6(int) Load 157 + 159: 6(int) GroupNonUniformBroadcast 38 158 64 + 160: 55(ptr) AccessChain 49(data) 156 51 54 + Store 160 159 + 161: 6(int) Load 8(invocation) + 163: 88(ptr) AccessChain 49(data) 60 51 + 164: 17(ivec4) Load 163 + 165: 162(ivec2) VectorShuffle 164 164 0 1 + 166: 162(ivec2) GroupNonUniformBroadcast 38 165 64 + 167: 88(ptr) AccessChain 49(data) 161 51 + 168: 17(ivec4) Load 167 + 169: 17(ivec4) VectorShuffle 168 166 4 5 2 3 + Store 167 169 + 170: 6(int) Load 8(invocation) + 172: 88(ptr) AccessChain 49(data) 51 51 + 173: 17(ivec4) Load 172 + 174: 171(ivec3) VectorShuffle 173 173 0 1 2 + 175: 171(ivec3) GroupNonUniformBroadcast 38 174 64 + 176: 88(ptr) AccessChain 49(data) 170 51 + 177: 17(ivec4) Load 176 + 178: 17(ivec4) VectorShuffle 177 175 4 5 6 3 + Store 176 178 + 179: 6(int) Load 8(invocation) + 180: 88(ptr) AccessChain 49(data) 121 51 + 181: 17(ivec4) Load 180 + 182: 17(ivec4) GroupNonUniformBroadcast 38 181 64 + 183: 88(ptr) AccessChain 49(data) 179 51 + Store 183 182 + 184: 6(int) Load 8(invocation) + 186: 185(ptr) AccessChain 49(data) 61 121 54 + 187:44(float64_t) Load 186 + 188:44(float64_t) GroupNonUniformBroadcast 38 187 54 + 189: 185(ptr) AccessChain 49(data) 184 121 54 + Store 189 188 + 190: 6(int) Load 8(invocation) + 193: 192(ptr) AccessChain 49(data) 60 121 + 194: 45(f64vec4) Load 193 + 195:191(f64vec2) VectorShuffle 194 194 0 1 + 196:191(f64vec2) GroupNonUniformBroadcast 38 195 54 + 197: 192(ptr) AccessChain 49(data) 190 121 + 198: 45(f64vec4) Load 197 + 199: 45(f64vec4) VectorShuffle 198 196 4 5 2 3 + Store 197 199 + 200: 6(int) Load 8(invocation) + 202: 192(ptr) AccessChain 49(data) 51 121 + 203: 45(f64vec4) Load 202 + 204:201(f64vec3) VectorShuffle 203 203 0 1 2 + 205:201(f64vec3) GroupNonUniformBroadcast 38 204 54 + 206: 192(ptr) AccessChain 49(data) 200 121 + 207: 45(f64vec4) Load 206 + 208: 45(f64vec4) VectorShuffle 207 205 4 5 6 3 + Store 206 208 + 209: 6(int) Load 8(invocation) + 210: 192(ptr) AccessChain 49(data) 121 121 + 211: 45(f64vec4) Load 210 + 212: 45(f64vec4) GroupNonUniformBroadcast 38 211 54 + 213: 192(ptr) AccessChain 49(data) 209 121 + Store 213 212 + 214: 6(int) Load 8(invocation) + 215: 127(ptr) AccessChain 49(data) 61 60 54 + 216: 42(int) Load 215 + 217: 36(bool) SLessThan 216 61 + 218: 36(bool) GroupNonUniformBroadcast 38 217 64 + 219: 42(int) Select 218 60 61 + 220: 127(ptr) AccessChain 49(data) 214 60 54 + Store 220 219 + 221: 6(int) Load 8(invocation) + 222: 134(ptr) AccessChain 49(data) 60 60 + 223: 43(ivec4) Load 222 + 224: 133(ivec2) VectorShuffle 223 223 0 1 + 227: 226(bvec2) SLessThan 224 225 + 228: 226(bvec2) GroupNonUniformBroadcast 38 227 64 + 230: 133(ivec2) Select 228 229 225 + 231: 134(ptr) AccessChain 49(data) 221 60 + 232: 43(ivec4) Load 231 + 233: 43(ivec4) VectorShuffle 232 230 4 5 2 3 + Store 231 233 + 234: 6(int) Load 8(invocation) + 235: 134(ptr) AccessChain 49(data) 60 60 + 236: 43(ivec4) Load 235 + 237: 143(ivec3) VectorShuffle 236 236 0 1 2 + 240: 239(bvec3) SLessThan 237 238 + 241: 239(bvec3) GroupNonUniformBroadcast 38 240 64 + 243: 143(ivec3) Select 241 242 238 + 244: 134(ptr) AccessChain 49(data) 234 60 + 245: 43(ivec4) Load 244 + 246: 43(ivec4) VectorShuffle 245 243 4 5 6 3 + Store 244 246 + 247: 6(int) Load 8(invocation) + 248: 134(ptr) AccessChain 49(data) 60 60 + 249: 43(ivec4) Load 248 + 251: 83(bvec4) SLessThan 249 250 + 252: 83(bvec4) GroupNonUniformBroadcast 38 251 64 + 254: 43(ivec4) Select 252 253 250 + 255: 134(ptr) AccessChain 49(data) 247 60 + Store 255 254 + Branch 94 + 256: Label + 257: 6(int) Load 8(invocation) + 258: 96(ptr) AccessChain 49(data) 61 61 54 + 259: 40(float) Load 258 + 260: 40(float) GroupNonUniformBroadcastFirst 38 259 + 261: 96(ptr) AccessChain 49(data) 257 61 54 + Store 261 260 + 262: 6(int) Load 8(invocation) + 263: 103(ptr) AccessChain 49(data) 60 61 + 264: 41(fvec4) Load 263 + 265: 102(fvec2) VectorShuffle 264 264 0 1 + 266: 102(fvec2) GroupNonUniformBroadcastFirst 38 265 + 267: 103(ptr) AccessChain 49(data) 262 61 + 268: 41(fvec4) Load 267 + 269: 41(fvec4) VectorShuffle 268 266 4 5 2 3 + Store 267 269 + 270: 6(int) Load 8(invocation) + 271: 103(ptr) AccessChain 49(data) 51 61 + 272: 41(fvec4) Load 271 + 273: 112(fvec3) VectorShuffle 272 272 0 1 2 + 274: 112(fvec3) GroupNonUniformBroadcastFirst 38 273 + 275: 103(ptr) AccessChain 49(data) 270 61 + 276: 41(fvec4) Load 275 + 277: 41(fvec4) VectorShuffle 276 274 4 5 6 3 + Store 275 277 + 278: 6(int) Load 8(invocation) + 279: 103(ptr) AccessChain 49(data) 121 61 + 280: 41(fvec4) Load 279 + 281: 41(fvec4) GroupNonUniformBroadcastFirst 38 280 + 282: 103(ptr) AccessChain 49(data) 278 61 + Store 282 281 + 283: 6(int) Load 8(invocation) + 284: 127(ptr) AccessChain 49(data) 61 60 54 + 285: 42(int) Load 284 + 286: 42(int) GroupNonUniformBroadcastFirst 38 285 + 287: 127(ptr) AccessChain 49(data) 283 60 54 + Store 287 286 + 288: 6(int) Load 8(invocation) + 289: 134(ptr) AccessChain 49(data) 60 60 + 290: 43(ivec4) Load 289 + 291: 133(ivec2) VectorShuffle 290 290 0 1 + 292: 133(ivec2) GroupNonUniformBroadcastFirst 38 291 + 293: 134(ptr) AccessChain 49(data) 288 60 + 294: 43(ivec4) Load 293 + 295: 43(ivec4) VectorShuffle 294 292 4 5 2 3 + Store 293 295 + 296: 6(int) Load 8(invocation) + 297: 134(ptr) AccessChain 49(data) 51 60 + 298: 43(ivec4) Load 297 + 299: 143(ivec3) VectorShuffle 298 298 0 1 2 + 300: 143(ivec3) GroupNonUniformBroadcastFirst 38 299 + 301: 134(ptr) AccessChain 49(data) 296 60 + 302: 43(ivec4) Load 301 + 303: 43(ivec4) VectorShuffle 302 300 4 5 6 3 + Store 301 303 + 304: 6(int) Load 8(invocation) + 305: 134(ptr) AccessChain 49(data) 121 60 + 306: 43(ivec4) Load 305 + 307: 43(ivec4) GroupNonUniformBroadcastFirst 38 306 + 308: 134(ptr) AccessChain 49(data) 304 60 + Store 308 307 + 309: 6(int) Load 8(invocation) + 310: 55(ptr) AccessChain 49(data) 61 51 54 + 311: 6(int) Load 310 + 312: 6(int) GroupNonUniformBroadcastFirst 38 311 + 313: 55(ptr) AccessChain 49(data) 309 51 54 + Store 313 312 + 314: 6(int) Load 8(invocation) + 315: 88(ptr) AccessChain 49(data) 60 51 + 316: 17(ivec4) Load 315 + 317: 162(ivec2) VectorShuffle 316 316 0 1 + 318: 162(ivec2) GroupNonUniformBroadcastFirst 38 317 + 319: 88(ptr) AccessChain 49(data) 314 51 + 320: 17(ivec4) Load 319 + 321: 17(ivec4) VectorShuffle 320 318 4 5 2 3 + Store 319 321 + 322: 6(int) Load 8(invocation) + 323: 88(ptr) AccessChain 49(data) 51 51 + 324: 17(ivec4) Load 323 + 325: 171(ivec3) VectorShuffle 324 324 0 1 2 + 326: 171(ivec3) GroupNonUniformBroadcastFirst 38 325 + 327: 88(ptr) AccessChain 49(data) 322 51 + 328: 17(ivec4) Load 327 + 329: 17(ivec4) VectorShuffle 328 326 4 5 6 3 + Store 327 329 + 330: 6(int) Load 8(invocation) + 331: 88(ptr) AccessChain 49(data) 121 51 + 332: 17(ivec4) Load 331 + 333: 17(ivec4) GroupNonUniformBroadcastFirst 38 332 + 334: 88(ptr) AccessChain 49(data) 330 51 + Store 334 333 + 335: 6(int) Load 8(invocation) + 336: 185(ptr) AccessChain 49(data) 61 121 54 + 337:44(float64_t) Load 336 + 338:44(float64_t) GroupNonUniformBroadcastFirst 38 337 + 339: 185(ptr) AccessChain 49(data) 335 121 54 + Store 339 338 + 340: 6(int) Load 8(invocation) + 341: 192(ptr) AccessChain 49(data) 60 121 + 342: 45(f64vec4) Load 341 + 343:191(f64vec2) VectorShuffle 342 342 0 1 + 344:191(f64vec2) GroupNonUniformBroadcastFirst 38 343 + 345: 192(ptr) AccessChain 49(data) 340 121 + 346: 45(f64vec4) Load 345 + 347: 45(f64vec4) VectorShuffle 346 344 4 5 2 3 + Store 345 347 + 348: 6(int) Load 8(invocation) + 349: 192(ptr) AccessChain 49(data) 51 121 + 350: 45(f64vec4) Load 349 + 351:201(f64vec3) VectorShuffle 350 350 0 1 2 + 352:201(f64vec3) GroupNonUniformBroadcastFirst 38 351 + 353: 192(ptr) AccessChain 49(data) 348 121 + 354: 45(f64vec4) Load 353 + 355: 45(f64vec4) VectorShuffle 354 352 4 5 6 3 + Store 353 355 + 356: 6(int) Load 8(invocation) + 357: 192(ptr) AccessChain 49(data) 121 121 + 358: 45(f64vec4) Load 357 + 359: 45(f64vec4) GroupNonUniformBroadcastFirst 38 358 + 360: 192(ptr) AccessChain 49(data) 356 121 + Store 360 359 + 361: 6(int) Load 8(invocation) + 362: 127(ptr) AccessChain 49(data) 61 60 54 + 363: 42(int) Load 362 + 364: 36(bool) SLessThan 363 61 + 365: 36(bool) GroupNonUniformBroadcastFirst 38 364 + 366: 42(int) Select 365 60 61 + 367: 127(ptr) AccessChain 49(data) 361 60 54 + Store 367 366 + 368: 6(int) Load 8(invocation) + 369: 134(ptr) AccessChain 49(data) 60 60 + 370: 43(ivec4) Load 369 + 371: 133(ivec2) VectorShuffle 370 370 0 1 + 372: 226(bvec2) SLessThan 371 225 + 373: 226(bvec2) GroupNonUniformBroadcastFirst 38 372 + 374: 133(ivec2) Select 373 229 225 + 375: 134(ptr) AccessChain 49(data) 368 60 + 376: 43(ivec4) Load 375 + 377: 43(ivec4) VectorShuffle 376 374 4 5 2 3 + Store 375 377 + 378: 6(int) Load 8(invocation) + 379: 134(ptr) AccessChain 49(data) 60 60 + 380: 43(ivec4) Load 379 + 381: 143(ivec3) VectorShuffle 380 380 0 1 2 + 382: 239(bvec3) SLessThan 381 238 + 383: 239(bvec3) GroupNonUniformBroadcastFirst 38 382 + 384: 143(ivec3) Select 383 242 238 + 385: 134(ptr) AccessChain 49(data) 378 60 + 386: 43(ivec4) Load 385 + 387: 43(ivec4) VectorShuffle 386 384 4 5 6 3 + Store 385 387 + 388: 6(int) Load 8(invocation) + 389: 134(ptr) AccessChain 49(data) 60 60 + 390: 43(ivec4) Load 389 + 391: 83(bvec4) SLessThan 390 250 + 392: 83(bvec4) GroupNonUniformBroadcastFirst 38 391 + 393: 43(ivec4) Select 392 253 250 + 394: 134(ptr) AccessChain 49(data) 388 60 + Store 394 393 + Branch 94 + 94: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBallotNeg.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBallotNeg.comp.out new file mode 100644 index 00000000000..49b6b540db3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBallotNeg.comp.out @@ -0,0 +1,6 @@ +spv.subgroupBallotNeg.comp +ERROR: 0:32: 'id' : argument must be compile-time constant +ERROR: 1 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBasic.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBasic.comp.out new file mode 100644 index 00000000000..641534d5b73 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupBasic.comp.out @@ -0,0 +1,84 @@ +spv.subgroupBasic.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 40 + + Capability Shader + Capability GroupNonUniform + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 14 19 22 25 + ExecutionMode 4 LocalSize 8 8 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + Name 4 "main" + Name 8 "Buffer" + MemberName 8(Buffer) 0 "a" + Name 10 "data" + Name 14 "gl_SubgroupSize" + Name 19 "gl_SubgroupInvocationID" + Name 22 "gl_NumSubgroups" + Name 25 "gl_SubgroupID" + Decorate 7 ArrayStride 4 + MemberDecorate 8(Buffer) 0 Offset 0 + Decorate 8(Buffer) Block + Decorate 10(data) DescriptorSet 0 + Decorate 10(data) Binding 0 + Decorate 14(gl_SubgroupSize) RelaxedPrecision + Decorate 14(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 15 RelaxedPrecision + Decorate 19(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 19(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 20 RelaxedPrecision + Decorate 22(gl_NumSubgroups) BuiltIn NumSubgroups + Decorate 25(gl_SubgroupID) BuiltIn SubgroupId + Decorate 39 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypeRuntimeArray 6(int) + 8(Buffer): TypeStruct 7 + 9: TypePointer StorageBuffer 8(Buffer) + 10(data): 9(ptr) Variable StorageBuffer + 11: 6(int) Constant 0 + 12: TypeInt 32 0 + 13: TypePointer Input 12(int) +14(gl_SubgroupSize): 13(ptr) Variable Input + 16: 6(int) Constant 1 + 17: TypePointer StorageBuffer 6(int) +19(gl_SubgroupInvocationID): 13(ptr) Variable Input +22(gl_NumSubgroups): 13(ptr) Variable Input +25(gl_SubgroupID): 13(ptr) Variable Input + 27: TypeBool + 28: 12(int) Constant 3 + 32: 12(int) Constant 3400 + 33: 12(int) Constant 72 + 34: 12(int) Constant 264 + 35: 12(int) Constant 2056 + 36: TypeVector 12(int) 3 + 37: 12(int) Constant 8 + 38: 12(int) Constant 1 + 39: 36(ivec3) ConstantComposite 37 37 38 + 4(main): 2 Function None 3 + 5: Label + 15: 12(int) Load 14(gl_SubgroupSize) + 18: 17(ptr) AccessChain 10(data) 11 15 + Store 18 16 + 20: 12(int) Load 19(gl_SubgroupInvocationID) + 21: 17(ptr) AccessChain 10(data) 11 20 + Store 21 16 + 23: 12(int) Load 22(gl_NumSubgroups) + 24: 17(ptr) AccessChain 10(data) 11 23 + Store 24 16 + 26: 12(int) Load 25(gl_SubgroupID) + 29: 27(bool) GroupNonUniformElect 28 + 30: 6(int) Select 29 16 11 + 31: 17(ptr) AccessChain 10(data) 11 26 + Store 31 30 + ControlBarrier 28 28 32 + MemoryBarrier 28 32 + MemoryBarrier 28 33 + MemoryBarrier 28 34 + MemoryBarrier 28 35 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupClustered.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupClustered.comp.out new file mode 100644 index 00000000000..150eb8aa45b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupClustered.comp.out @@ -0,0 +1,880 @@ +spv.subgroupClustered.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 737 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformClustered + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_KHR_shader_subgroup_clustered" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 24 "Buffers" + MemberName 24(Buffers) 0 "f4" + MemberName 24(Buffers) 1 "i4" + MemberName 24(Buffers) 2 "u4" + MemberName 24(Buffers) 3 "d4" + Name 27 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 24(Buffers) 0 Offset 0 + MemberDecorate 24(Buffers) 1 Offset 16 + MemberDecorate 24(Buffers) 2 Offset 32 + MemberDecorate 24(Buffers) 3 Offset 64 + Decorate 24(Buffers) Block + Decorate 27(data) DescriptorSet 0 + Decorate 27(data) Binding 0 + Decorate 736 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeFloat 32 + 18: TypeVector 17(float) 4 + 19: TypeInt 32 1 + 20: TypeVector 19(int) 4 + 21: TypeVector 6(int) 4 + 22: TypeFloat 64 + 23: TypeVector 22(float64_t) 4 + 24(Buffers): TypeStruct 18(fvec4) 20(ivec4) 21(ivec4) 23(f64vec4) + 25: TypeArray 24(Buffers) 15 + 26: TypePointer StorageBuffer 25 + 27(data): 26(ptr) Variable StorageBuffer + 29: 19(int) Constant 0 + 30: 6(int) Constant 0 + 31: TypePointer StorageBuffer 17(float) + 34: 6(int) Constant 1 + 35: 6(int) Constant 3 + 39: 19(int) Constant 1 + 40: TypeVector 17(float) 2 + 41: TypePointer StorageBuffer 18(fvec4) + 50: 19(int) Constant 2 + 51: TypeVector 17(float) 3 + 60: 19(int) Constant 3 + 66: TypePointer StorageBuffer 19(int) + 72: TypeVector 19(int) 2 + 73: TypePointer StorageBuffer 20(ivec4) + 82: TypeVector 19(int) 3 + 96: TypePointer StorageBuffer 6(int) + 102: TypeVector 6(int) 2 + 103: TypePointer StorageBuffer 21(ivec4) + 112: TypeVector 6(int) 3 + 126: TypePointer StorageBuffer 22(float64_t) + 132: TypeVector 22(float64_t) 2 + 133: TypePointer StorageBuffer 23(f64vec4) + 142: TypeVector 22(float64_t) 3 + 522: TypeBool + 531: 72(ivec2) ConstantComposite 29 29 + 532: TypeVector 522(bool) 2 + 535: 72(ivec2) ConstantComposite 39 39 + 544: 82(ivec3) ConstantComposite 29 29 29 + 545: TypeVector 522(bool) 3 + 548: 82(ivec3) ConstantComposite 39 39 39 + 556: 20(ivec4) ConstantComposite 29 29 29 29 + 557: TypeVector 522(bool) 4 + 560: 20(ivec4) ConstantComposite 39 39 39 39 + 735: 6(int) Constant 8 + 736: 112(ivec3) ConstantComposite 735 34 34 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 28: 6(int) Load 8(invocation) + 32: 31(ptr) AccessChain 27(data) 29 29 30 + 33: 17(float) Load 32 + 36: 17(float) GroupNonUniformFAdd 35 ClusteredReduce 33 34 + 37: 31(ptr) AccessChain 27(data) 28 29 30 + Store 37 36 + 38: 6(int) Load 8(invocation) + 42: 41(ptr) AccessChain 27(data) 39 29 + 43: 18(fvec4) Load 42 + 44: 40(fvec2) VectorShuffle 43 43 0 1 + 45: 40(fvec2) GroupNonUniformFAdd 35 ClusteredReduce 44 34 + 46: 41(ptr) AccessChain 27(data) 38 29 + 47: 18(fvec4) Load 46 + 48: 18(fvec4) VectorShuffle 47 45 4 5 2 3 + Store 46 48 + 49: 6(int) Load 8(invocation) + 52: 41(ptr) AccessChain 27(data) 50 29 + 53: 18(fvec4) Load 52 + 54: 51(fvec3) VectorShuffle 53 53 0 1 2 + 55: 51(fvec3) GroupNonUniformFAdd 35 ClusteredReduce 54 34 + 56: 41(ptr) AccessChain 27(data) 49 29 + 57: 18(fvec4) Load 56 + 58: 18(fvec4) VectorShuffle 57 55 4 5 6 3 + Store 56 58 + 59: 6(int) Load 8(invocation) + 61: 41(ptr) AccessChain 27(data) 60 29 + 62: 18(fvec4) Load 61 + 63: 18(fvec4) GroupNonUniformFAdd 35 ClusteredReduce 62 34 + 64: 41(ptr) AccessChain 27(data) 59 29 + Store 64 63 + 65: 6(int) Load 8(invocation) + 67: 66(ptr) AccessChain 27(data) 29 39 30 + 68: 19(int) Load 67 + 69: 19(int) GroupNonUniformIAdd 35 ClusteredReduce 68 34 + 70: 66(ptr) AccessChain 27(data) 65 39 30 + Store 70 69 + 71: 6(int) Load 8(invocation) + 74: 73(ptr) AccessChain 27(data) 39 39 + 75: 20(ivec4) Load 74 + 76: 72(ivec2) VectorShuffle 75 75 0 1 + 77: 72(ivec2) GroupNonUniformIAdd 35 ClusteredReduce 76 34 + 78: 73(ptr) AccessChain 27(data) 71 39 + 79: 20(ivec4) Load 78 + 80: 20(ivec4) VectorShuffle 79 77 4 5 2 3 + Store 78 80 + 81: 6(int) Load 8(invocation) + 83: 73(ptr) AccessChain 27(data) 50 39 + 84: 20(ivec4) Load 83 + 85: 82(ivec3) VectorShuffle 84 84 0 1 2 + 86: 82(ivec3) GroupNonUniformIAdd 35 ClusteredReduce 85 34 + 87: 73(ptr) AccessChain 27(data) 81 39 + 88: 20(ivec4) Load 87 + 89: 20(ivec4) VectorShuffle 88 86 4 5 6 3 + Store 87 89 + 90: 6(int) Load 8(invocation) + 91: 73(ptr) AccessChain 27(data) 60 39 + 92: 20(ivec4) Load 91 + 93: 20(ivec4) GroupNonUniformIAdd 35 ClusteredReduce 92 34 + 94: 73(ptr) AccessChain 27(data) 90 39 + Store 94 93 + 95: 6(int) Load 8(invocation) + 97: 96(ptr) AccessChain 27(data) 29 50 30 + 98: 6(int) Load 97 + 99: 6(int) GroupNonUniformIAdd 35 ClusteredReduce 98 34 + 100: 96(ptr) AccessChain 27(data) 95 50 30 + Store 100 99 + 101: 6(int) Load 8(invocation) + 104: 103(ptr) AccessChain 27(data) 39 50 + 105: 21(ivec4) Load 104 + 106: 102(ivec2) VectorShuffle 105 105 0 1 + 107: 102(ivec2) GroupNonUniformIAdd 35 ClusteredReduce 106 34 + 108: 103(ptr) AccessChain 27(data) 101 50 + 109: 21(ivec4) Load 108 + 110: 21(ivec4) VectorShuffle 109 107 4 5 2 3 + Store 108 110 + 111: 6(int) Load 8(invocation) + 113: 103(ptr) AccessChain 27(data) 50 50 + 114: 21(ivec4) Load 113 + 115: 112(ivec3) VectorShuffle 114 114 0 1 2 + 116: 112(ivec3) GroupNonUniformIAdd 35 ClusteredReduce 115 34 + 117: 103(ptr) AccessChain 27(data) 111 50 + 118: 21(ivec4) Load 117 + 119: 21(ivec4) VectorShuffle 118 116 4 5 6 3 + Store 117 119 + 120: 6(int) Load 8(invocation) + 121: 103(ptr) AccessChain 27(data) 60 50 + 122: 21(ivec4) Load 121 + 123: 21(ivec4) GroupNonUniformIAdd 35 ClusteredReduce 122 34 + 124: 103(ptr) AccessChain 27(data) 120 50 + Store 124 123 + 125: 6(int) Load 8(invocation) + 127: 126(ptr) AccessChain 27(data) 29 60 30 + 128:22(float64_t) Load 127 + 129:22(float64_t) GroupNonUniformFAdd 35 ClusteredReduce 128 34 + 130: 126(ptr) AccessChain 27(data) 125 60 30 + Store 130 129 + 131: 6(int) Load 8(invocation) + 134: 133(ptr) AccessChain 27(data) 39 60 + 135: 23(f64vec4) Load 134 + 136:132(f64vec2) VectorShuffle 135 135 0 1 + 137:132(f64vec2) GroupNonUniformFAdd 35 ClusteredReduce 136 34 + 138: 133(ptr) AccessChain 27(data) 131 60 + 139: 23(f64vec4) Load 138 + 140: 23(f64vec4) VectorShuffle 139 137 4 5 2 3 + Store 138 140 + 141: 6(int) Load 8(invocation) + 143: 133(ptr) AccessChain 27(data) 50 60 + 144: 23(f64vec4) Load 143 + 145:142(f64vec3) VectorShuffle 144 144 0 1 2 + 146:142(f64vec3) GroupNonUniformFAdd 35 ClusteredReduce 145 34 + 147: 133(ptr) AccessChain 27(data) 141 60 + 148: 23(f64vec4) Load 147 + 149: 23(f64vec4) VectorShuffle 148 146 4 5 6 3 + Store 147 149 + 150: 6(int) Load 8(invocation) + 151: 133(ptr) AccessChain 27(data) 60 60 + 152: 23(f64vec4) Load 151 + 153: 23(f64vec4) GroupNonUniformFAdd 35 ClusteredReduce 152 34 + 154: 133(ptr) AccessChain 27(data) 150 60 + Store 154 153 + 155: 6(int) Load 8(invocation) + 156: 31(ptr) AccessChain 27(data) 29 29 30 + 157: 17(float) Load 156 + 158: 17(float) GroupNonUniformFMul 35 ClusteredReduce 157 34 + 159: 31(ptr) AccessChain 27(data) 155 29 30 + Store 159 158 + 160: 6(int) Load 8(invocation) + 161: 41(ptr) AccessChain 27(data) 39 29 + 162: 18(fvec4) Load 161 + 163: 40(fvec2) VectorShuffle 162 162 0 1 + 164: 40(fvec2) GroupNonUniformFMul 35 ClusteredReduce 163 34 + 165: 41(ptr) AccessChain 27(data) 160 29 + 166: 18(fvec4) Load 165 + 167: 18(fvec4) VectorShuffle 166 164 4 5 2 3 + Store 165 167 + 168: 6(int) Load 8(invocation) + 169: 41(ptr) AccessChain 27(data) 50 29 + 170: 18(fvec4) Load 169 + 171: 51(fvec3) VectorShuffle 170 170 0 1 2 + 172: 51(fvec3) GroupNonUniformFMul 35 ClusteredReduce 171 34 + 173: 41(ptr) AccessChain 27(data) 168 29 + 174: 18(fvec4) Load 173 + 175: 18(fvec4) VectorShuffle 174 172 4 5 6 3 + Store 173 175 + 176: 6(int) Load 8(invocation) + 177: 41(ptr) AccessChain 27(data) 60 29 + 178: 18(fvec4) Load 177 + 179: 18(fvec4) GroupNonUniformFMul 35 ClusteredReduce 178 34 + 180: 41(ptr) AccessChain 27(data) 176 29 + Store 180 179 + 181: 6(int) Load 8(invocation) + 182: 66(ptr) AccessChain 27(data) 29 39 30 + 183: 19(int) Load 182 + 184: 19(int) GroupNonUniformIMul 35 ClusteredReduce 183 34 + 185: 66(ptr) AccessChain 27(data) 181 39 30 + Store 185 184 + 186: 6(int) Load 8(invocation) + 187: 73(ptr) AccessChain 27(data) 39 39 + 188: 20(ivec4) Load 187 + 189: 72(ivec2) VectorShuffle 188 188 0 1 + 190: 72(ivec2) GroupNonUniformIMul 35 ClusteredReduce 189 34 + 191: 73(ptr) AccessChain 27(data) 186 39 + 192: 20(ivec4) Load 191 + 193: 20(ivec4) VectorShuffle 192 190 4 5 2 3 + Store 191 193 + 194: 6(int) Load 8(invocation) + 195: 73(ptr) AccessChain 27(data) 50 39 + 196: 20(ivec4) Load 195 + 197: 82(ivec3) VectorShuffle 196 196 0 1 2 + 198: 82(ivec3) GroupNonUniformIMul 35 ClusteredReduce 197 34 + 199: 73(ptr) AccessChain 27(data) 194 39 + 200: 20(ivec4) Load 199 + 201: 20(ivec4) VectorShuffle 200 198 4 5 6 3 + Store 199 201 + 202: 6(int) Load 8(invocation) + 203: 73(ptr) AccessChain 27(data) 60 39 + 204: 20(ivec4) Load 203 + 205: 20(ivec4) GroupNonUniformIMul 35 ClusteredReduce 204 34 + 206: 73(ptr) AccessChain 27(data) 202 39 + Store 206 205 + 207: 6(int) Load 8(invocation) + 208: 96(ptr) AccessChain 27(data) 29 50 30 + 209: 6(int) Load 208 + 210: 6(int) GroupNonUniformIMul 35 ClusteredReduce 209 34 + 211: 96(ptr) AccessChain 27(data) 207 50 30 + Store 211 210 + 212: 6(int) Load 8(invocation) + 213: 103(ptr) AccessChain 27(data) 39 50 + 214: 21(ivec4) Load 213 + 215: 102(ivec2) VectorShuffle 214 214 0 1 + 216: 102(ivec2) GroupNonUniformIMul 35 ClusteredReduce 215 34 + 217: 103(ptr) AccessChain 27(data) 212 50 + 218: 21(ivec4) Load 217 + 219: 21(ivec4) VectorShuffle 218 216 4 5 2 3 + Store 217 219 + 220: 6(int) Load 8(invocation) + 221: 103(ptr) AccessChain 27(data) 50 50 + 222: 21(ivec4) Load 221 + 223: 112(ivec3) VectorShuffle 222 222 0 1 2 + 224: 112(ivec3) GroupNonUniformIMul 35 ClusteredReduce 223 34 + 225: 103(ptr) AccessChain 27(data) 220 50 + 226: 21(ivec4) Load 225 + 227: 21(ivec4) VectorShuffle 226 224 4 5 6 3 + Store 225 227 + 228: 6(int) Load 8(invocation) + 229: 103(ptr) AccessChain 27(data) 60 50 + 230: 21(ivec4) Load 229 + 231: 21(ivec4) GroupNonUniformIMul 35 ClusteredReduce 230 34 + 232: 103(ptr) AccessChain 27(data) 228 50 + Store 232 231 + 233: 6(int) Load 8(invocation) + 234: 126(ptr) AccessChain 27(data) 29 60 30 + 235:22(float64_t) Load 234 + 236:22(float64_t) GroupNonUniformFMul 35 ClusteredReduce 235 34 + 237: 126(ptr) AccessChain 27(data) 233 60 30 + Store 237 236 + 238: 6(int) Load 8(invocation) + 239: 133(ptr) AccessChain 27(data) 39 60 + 240: 23(f64vec4) Load 239 + 241:132(f64vec2) VectorShuffle 240 240 0 1 + 242:132(f64vec2) GroupNonUniformFMul 35 ClusteredReduce 241 34 + 243: 133(ptr) AccessChain 27(data) 238 60 + 244: 23(f64vec4) Load 243 + 245: 23(f64vec4) VectorShuffle 244 242 4 5 2 3 + Store 243 245 + 246: 6(int) Load 8(invocation) + 247: 133(ptr) AccessChain 27(data) 50 60 + 248: 23(f64vec4) Load 247 + 249:142(f64vec3) VectorShuffle 248 248 0 1 2 + 250:142(f64vec3) GroupNonUniformFMul 35 ClusteredReduce 249 34 + 251: 133(ptr) AccessChain 27(data) 246 60 + 252: 23(f64vec4) Load 251 + 253: 23(f64vec4) VectorShuffle 252 250 4 5 6 3 + Store 251 253 + 254: 6(int) Load 8(invocation) + 255: 133(ptr) AccessChain 27(data) 60 60 + 256: 23(f64vec4) Load 255 + 257: 23(f64vec4) GroupNonUniformFMul 35 ClusteredReduce 256 34 + 258: 133(ptr) AccessChain 27(data) 254 60 + Store 258 257 + 259: 6(int) Load 8(invocation) + 260: 31(ptr) AccessChain 27(data) 29 29 30 + 261: 17(float) Load 260 + 262: 17(float) GroupNonUniformFMin 35 ClusteredReduce 261 34 + 263: 31(ptr) AccessChain 27(data) 259 29 30 + Store 263 262 + 264: 6(int) Load 8(invocation) + 265: 41(ptr) AccessChain 27(data) 39 29 + 266: 18(fvec4) Load 265 + 267: 40(fvec2) VectorShuffle 266 266 0 1 + 268: 40(fvec2) GroupNonUniformFMin 35 ClusteredReduce 267 34 + 269: 41(ptr) AccessChain 27(data) 264 29 + 270: 18(fvec4) Load 269 + 271: 18(fvec4) VectorShuffle 270 268 4 5 2 3 + Store 269 271 + 272: 6(int) Load 8(invocation) + 273: 41(ptr) AccessChain 27(data) 50 29 + 274: 18(fvec4) Load 273 + 275: 51(fvec3) VectorShuffle 274 274 0 1 2 + 276: 51(fvec3) GroupNonUniformFMin 35 ClusteredReduce 275 34 + 277: 41(ptr) AccessChain 27(data) 272 29 + 278: 18(fvec4) Load 277 + 279: 18(fvec4) VectorShuffle 278 276 4 5 6 3 + Store 277 279 + 280: 6(int) Load 8(invocation) + 281: 41(ptr) AccessChain 27(data) 60 29 + 282: 18(fvec4) Load 281 + 283: 18(fvec4) GroupNonUniformFMin 35 ClusteredReduce 282 34 + 284: 41(ptr) AccessChain 27(data) 280 29 + Store 284 283 + 285: 6(int) Load 8(invocation) + 286: 66(ptr) AccessChain 27(data) 29 39 30 + 287: 19(int) Load 286 + 288: 19(int) GroupNonUniformSMin 35 ClusteredReduce 287 34 + 289: 66(ptr) AccessChain 27(data) 285 39 30 + Store 289 288 + 290: 6(int) Load 8(invocation) + 291: 73(ptr) AccessChain 27(data) 39 39 + 292: 20(ivec4) Load 291 + 293: 72(ivec2) VectorShuffle 292 292 0 1 + 294: 72(ivec2) GroupNonUniformSMin 35 ClusteredReduce 293 34 + 295: 73(ptr) AccessChain 27(data) 290 39 + 296: 20(ivec4) Load 295 + 297: 20(ivec4) VectorShuffle 296 294 4 5 2 3 + Store 295 297 + 298: 6(int) Load 8(invocation) + 299: 73(ptr) AccessChain 27(data) 50 39 + 300: 20(ivec4) Load 299 + 301: 82(ivec3) VectorShuffle 300 300 0 1 2 + 302: 82(ivec3) GroupNonUniformSMin 35 ClusteredReduce 301 34 + 303: 73(ptr) AccessChain 27(data) 298 39 + 304: 20(ivec4) Load 303 + 305: 20(ivec4) VectorShuffle 304 302 4 5 6 3 + Store 303 305 + 306: 6(int) Load 8(invocation) + 307: 73(ptr) AccessChain 27(data) 60 39 + 308: 20(ivec4) Load 307 + 309: 20(ivec4) GroupNonUniformSMin 35 ClusteredReduce 308 34 + 310: 73(ptr) AccessChain 27(data) 306 39 + Store 310 309 + 311: 6(int) Load 8(invocation) + 312: 96(ptr) AccessChain 27(data) 29 50 30 + 313: 6(int) Load 312 + 314: 6(int) GroupNonUniformUMin 35 ClusteredReduce 313 34 + 315: 96(ptr) AccessChain 27(data) 311 50 30 + Store 315 314 + 316: 6(int) Load 8(invocation) + 317: 103(ptr) AccessChain 27(data) 39 50 + 318: 21(ivec4) Load 317 + 319: 102(ivec2) VectorShuffle 318 318 0 1 + 320: 102(ivec2) GroupNonUniformUMin 35 ClusteredReduce 319 34 + 321: 103(ptr) AccessChain 27(data) 316 50 + 322: 21(ivec4) Load 321 + 323: 21(ivec4) VectorShuffle 322 320 4 5 2 3 + Store 321 323 + 324: 6(int) Load 8(invocation) + 325: 103(ptr) AccessChain 27(data) 50 50 + 326: 21(ivec4) Load 325 + 327: 112(ivec3) VectorShuffle 326 326 0 1 2 + 328: 112(ivec3) GroupNonUniformUMin 35 ClusteredReduce 327 34 + 329: 103(ptr) AccessChain 27(data) 324 50 + 330: 21(ivec4) Load 329 + 331: 21(ivec4) VectorShuffle 330 328 4 5 6 3 + Store 329 331 + 332: 6(int) Load 8(invocation) + 333: 103(ptr) AccessChain 27(data) 60 50 + 334: 21(ivec4) Load 333 + 335: 21(ivec4) GroupNonUniformUMin 35 ClusteredReduce 334 34 + 336: 103(ptr) AccessChain 27(data) 332 50 + Store 336 335 + 337: 6(int) Load 8(invocation) + 338: 126(ptr) AccessChain 27(data) 29 60 30 + 339:22(float64_t) Load 338 + 340:22(float64_t) GroupNonUniformFMin 35 ClusteredReduce 339 34 + 341: 126(ptr) AccessChain 27(data) 337 60 30 + Store 341 340 + 342: 6(int) Load 8(invocation) + 343: 133(ptr) AccessChain 27(data) 39 60 + 344: 23(f64vec4) Load 343 + 345:132(f64vec2) VectorShuffle 344 344 0 1 + 346:132(f64vec2) GroupNonUniformFMin 35 ClusteredReduce 345 34 + 347: 133(ptr) AccessChain 27(data) 342 60 + 348: 23(f64vec4) Load 347 + 349: 23(f64vec4) VectorShuffle 348 346 4 5 2 3 + Store 347 349 + 350: 6(int) Load 8(invocation) + 351: 133(ptr) AccessChain 27(data) 50 60 + 352: 23(f64vec4) Load 351 + 353:142(f64vec3) VectorShuffle 352 352 0 1 2 + 354:142(f64vec3) GroupNonUniformFMin 35 ClusteredReduce 353 34 + 355: 133(ptr) AccessChain 27(data) 350 60 + 356: 23(f64vec4) Load 355 + 357: 23(f64vec4) VectorShuffle 356 354 4 5 6 3 + Store 355 357 + 358: 6(int) Load 8(invocation) + 359: 133(ptr) AccessChain 27(data) 60 60 + 360: 23(f64vec4) Load 359 + 361: 23(f64vec4) GroupNonUniformFMin 35 ClusteredReduce 360 34 + 362: 133(ptr) AccessChain 27(data) 358 60 + Store 362 361 + 363: 6(int) Load 8(invocation) + 364: 31(ptr) AccessChain 27(data) 29 29 30 + 365: 17(float) Load 364 + 366: 17(float) GroupNonUniformFMax 35 ClusteredReduce 365 34 + 367: 31(ptr) AccessChain 27(data) 363 29 30 + Store 367 366 + 368: 6(int) Load 8(invocation) + 369: 41(ptr) AccessChain 27(data) 39 29 + 370: 18(fvec4) Load 369 + 371: 40(fvec2) VectorShuffle 370 370 0 1 + 372: 40(fvec2) GroupNonUniformFMax 35 ClusteredReduce 371 34 + 373: 41(ptr) AccessChain 27(data) 368 29 + 374: 18(fvec4) Load 373 + 375: 18(fvec4) VectorShuffle 374 372 4 5 2 3 + Store 373 375 + 376: 6(int) Load 8(invocation) + 377: 41(ptr) AccessChain 27(data) 50 29 + 378: 18(fvec4) Load 377 + 379: 51(fvec3) VectorShuffle 378 378 0 1 2 + 380: 51(fvec3) GroupNonUniformFMax 35 ClusteredReduce 379 34 + 381: 41(ptr) AccessChain 27(data) 376 29 + 382: 18(fvec4) Load 381 + 383: 18(fvec4) VectorShuffle 382 380 4 5 6 3 + Store 381 383 + 384: 6(int) Load 8(invocation) + 385: 41(ptr) AccessChain 27(data) 60 29 + 386: 18(fvec4) Load 385 + 387: 18(fvec4) GroupNonUniformFMax 35 ClusteredReduce 386 34 + 388: 41(ptr) AccessChain 27(data) 384 29 + Store 388 387 + 389: 6(int) Load 8(invocation) + 390: 66(ptr) AccessChain 27(data) 29 39 30 + 391: 19(int) Load 390 + 392: 19(int) GroupNonUniformSMax 35 ClusteredReduce 391 34 + 393: 66(ptr) AccessChain 27(data) 389 39 30 + Store 393 392 + 394: 6(int) Load 8(invocation) + 395: 73(ptr) AccessChain 27(data) 39 39 + 396: 20(ivec4) Load 395 + 397: 72(ivec2) VectorShuffle 396 396 0 1 + 398: 72(ivec2) GroupNonUniformSMax 35 ClusteredReduce 397 34 + 399: 73(ptr) AccessChain 27(data) 394 39 + 400: 20(ivec4) Load 399 + 401: 20(ivec4) VectorShuffle 400 398 4 5 2 3 + Store 399 401 + 402: 6(int) Load 8(invocation) + 403: 73(ptr) AccessChain 27(data) 50 39 + 404: 20(ivec4) Load 403 + 405: 82(ivec3) VectorShuffle 404 404 0 1 2 + 406: 82(ivec3) GroupNonUniformSMax 35 ClusteredReduce 405 34 + 407: 73(ptr) AccessChain 27(data) 402 39 + 408: 20(ivec4) Load 407 + 409: 20(ivec4) VectorShuffle 408 406 4 5 6 3 + Store 407 409 + 410: 6(int) Load 8(invocation) + 411: 73(ptr) AccessChain 27(data) 60 39 + 412: 20(ivec4) Load 411 + 413: 20(ivec4) GroupNonUniformSMax 35 ClusteredReduce 412 34 + 414: 73(ptr) AccessChain 27(data) 410 39 + Store 414 413 + 415: 6(int) Load 8(invocation) + 416: 96(ptr) AccessChain 27(data) 29 50 30 + 417: 6(int) Load 416 + 418: 6(int) GroupNonUniformUMax 35 ClusteredReduce 417 34 + 419: 96(ptr) AccessChain 27(data) 415 50 30 + Store 419 418 + 420: 6(int) Load 8(invocation) + 421: 103(ptr) AccessChain 27(data) 39 50 + 422: 21(ivec4) Load 421 + 423: 102(ivec2) VectorShuffle 422 422 0 1 + 424: 102(ivec2) GroupNonUniformUMax 35 ClusteredReduce 423 34 + 425: 103(ptr) AccessChain 27(data) 420 50 + 426: 21(ivec4) Load 425 + 427: 21(ivec4) VectorShuffle 426 424 4 5 2 3 + Store 425 427 + 428: 6(int) Load 8(invocation) + 429: 103(ptr) AccessChain 27(data) 50 50 + 430: 21(ivec4) Load 429 + 431: 112(ivec3) VectorShuffle 430 430 0 1 2 + 432: 112(ivec3) GroupNonUniformUMax 35 ClusteredReduce 431 34 + 433: 103(ptr) AccessChain 27(data) 428 50 + 434: 21(ivec4) Load 433 + 435: 21(ivec4) VectorShuffle 434 432 4 5 6 3 + Store 433 435 + 436: 6(int) Load 8(invocation) + 437: 103(ptr) AccessChain 27(data) 60 50 + 438: 21(ivec4) Load 437 + 439: 21(ivec4) GroupNonUniformUMax 35 ClusteredReduce 438 34 + 440: 103(ptr) AccessChain 27(data) 436 50 + Store 440 439 + 441: 6(int) Load 8(invocation) + 442: 126(ptr) AccessChain 27(data) 29 60 30 + 443:22(float64_t) Load 442 + 444:22(float64_t) GroupNonUniformFMax 35 ClusteredReduce 443 34 + 445: 126(ptr) AccessChain 27(data) 441 60 30 + Store 445 444 + 446: 6(int) Load 8(invocation) + 447: 133(ptr) AccessChain 27(data) 39 60 + 448: 23(f64vec4) Load 447 + 449:132(f64vec2) VectorShuffle 448 448 0 1 + 450:132(f64vec2) GroupNonUniformFMax 35 ClusteredReduce 449 34 + 451: 133(ptr) AccessChain 27(data) 446 60 + 452: 23(f64vec4) Load 451 + 453: 23(f64vec4) VectorShuffle 452 450 4 5 2 3 + Store 451 453 + 454: 6(int) Load 8(invocation) + 455: 133(ptr) AccessChain 27(data) 50 60 + 456: 23(f64vec4) Load 455 + 457:142(f64vec3) VectorShuffle 456 456 0 1 2 + 458:142(f64vec3) GroupNonUniformFMax 35 ClusteredReduce 457 34 + 459: 133(ptr) AccessChain 27(data) 454 60 + 460: 23(f64vec4) Load 459 + 461: 23(f64vec4) VectorShuffle 460 458 4 5 6 3 + Store 459 461 + 462: 6(int) Load 8(invocation) + 463: 133(ptr) AccessChain 27(data) 60 60 + 464: 23(f64vec4) Load 463 + 465: 23(f64vec4) GroupNonUniformFMax 35 ClusteredReduce 464 34 + 466: 133(ptr) AccessChain 27(data) 462 60 + Store 466 465 + 467: 6(int) Load 8(invocation) + 468: 66(ptr) AccessChain 27(data) 29 39 30 + 469: 19(int) Load 468 + 470: 19(int) GroupNonUniformBitwiseAnd 35 ClusteredReduce 469 34 + 471: 66(ptr) AccessChain 27(data) 467 39 30 + Store 471 470 + 472: 6(int) Load 8(invocation) + 473: 73(ptr) AccessChain 27(data) 39 39 + 474: 20(ivec4) Load 473 + 475: 72(ivec2) VectorShuffle 474 474 0 1 + 476: 72(ivec2) GroupNonUniformBitwiseAnd 35 ClusteredReduce 475 34 + 477: 73(ptr) AccessChain 27(data) 472 39 + 478: 20(ivec4) Load 477 + 479: 20(ivec4) VectorShuffle 478 476 4 5 2 3 + Store 477 479 + 480: 6(int) Load 8(invocation) + 481: 73(ptr) AccessChain 27(data) 50 39 + 482: 20(ivec4) Load 481 + 483: 82(ivec3) VectorShuffle 482 482 0 1 2 + 484: 82(ivec3) GroupNonUniformBitwiseAnd 35 ClusteredReduce 483 34 + 485: 73(ptr) AccessChain 27(data) 480 39 + 486: 20(ivec4) Load 485 + 487: 20(ivec4) VectorShuffle 486 484 4 5 6 3 + Store 485 487 + 488: 6(int) Load 8(invocation) + 489: 73(ptr) AccessChain 27(data) 60 39 + 490: 20(ivec4) Load 489 + 491: 20(ivec4) GroupNonUniformBitwiseAnd 35 ClusteredReduce 490 34 + 492: 73(ptr) AccessChain 27(data) 488 39 + Store 492 491 + 493: 6(int) Load 8(invocation) + 494: 96(ptr) AccessChain 27(data) 29 50 30 + 495: 6(int) Load 494 + 496: 6(int) GroupNonUniformBitwiseAnd 35 ClusteredReduce 495 34 + 497: 96(ptr) AccessChain 27(data) 493 50 30 + Store 497 496 + 498: 6(int) Load 8(invocation) + 499: 103(ptr) AccessChain 27(data) 39 50 + 500: 21(ivec4) Load 499 + 501: 102(ivec2) VectorShuffle 500 500 0 1 + 502: 102(ivec2) GroupNonUniformBitwiseAnd 35 ClusteredReduce 501 34 + 503: 103(ptr) AccessChain 27(data) 498 50 + 504: 21(ivec4) Load 503 + 505: 21(ivec4) VectorShuffle 504 502 4 5 2 3 + Store 503 505 + 506: 6(int) Load 8(invocation) + 507: 103(ptr) AccessChain 27(data) 50 50 + 508: 21(ivec4) Load 507 + 509: 112(ivec3) VectorShuffle 508 508 0 1 2 + 510: 112(ivec3) GroupNonUniformBitwiseAnd 35 ClusteredReduce 509 34 + 511: 103(ptr) AccessChain 27(data) 506 50 + 512: 21(ivec4) Load 511 + 513: 21(ivec4) VectorShuffle 512 510 4 5 6 3 + Store 511 513 + 514: 6(int) Load 8(invocation) + 515: 103(ptr) AccessChain 27(data) 60 50 + 516: 21(ivec4) Load 515 + 517: 21(ivec4) GroupNonUniformBitwiseAnd 35 ClusteredReduce 516 34 + 518: 103(ptr) AccessChain 27(data) 514 50 + Store 518 517 + 519: 6(int) Load 8(invocation) + 520: 66(ptr) AccessChain 27(data) 29 39 30 + 521: 19(int) Load 520 + 523: 522(bool) SLessThan 521 29 + 524: 522(bool) GroupNonUniformLogicalAnd 35 ClusteredReduce 523 34 + 525: 19(int) Select 524 39 29 + 526: 66(ptr) AccessChain 27(data) 519 39 30 + Store 526 525 + 527: 6(int) Load 8(invocation) + 528: 73(ptr) AccessChain 27(data) 39 39 + 529: 20(ivec4) Load 528 + 530: 72(ivec2) VectorShuffle 529 529 0 1 + 533: 532(bvec2) SLessThan 530 531 + 534: 532(bvec2) GroupNonUniformLogicalAnd 35 ClusteredReduce 533 34 + 536: 72(ivec2) Select 534 535 531 + 537: 73(ptr) AccessChain 27(data) 527 39 + 538: 20(ivec4) Load 537 + 539: 20(ivec4) VectorShuffle 538 536 4 5 2 3 + Store 537 539 + 540: 6(int) Load 8(invocation) + 541: 73(ptr) AccessChain 27(data) 39 39 + 542: 20(ivec4) Load 541 + 543: 82(ivec3) VectorShuffle 542 542 0 1 2 + 546: 545(bvec3) SLessThan 543 544 + 547: 545(bvec3) GroupNonUniformLogicalAnd 35 ClusteredReduce 546 34 + 549: 82(ivec3) Select 547 548 544 + 550: 73(ptr) AccessChain 27(data) 540 39 + 551: 20(ivec4) Load 550 + 552: 20(ivec4) VectorShuffle 551 549 4 5 6 3 + Store 550 552 + 553: 6(int) Load 8(invocation) + 554: 73(ptr) AccessChain 27(data) 39 39 + 555: 20(ivec4) Load 554 + 558: 557(bvec4) SLessThan 555 556 + 559: 557(bvec4) GroupNonUniformLogicalAnd 35 ClusteredReduce 558 34 + 561: 20(ivec4) Select 559 560 556 + 562: 73(ptr) AccessChain 27(data) 553 39 + Store 562 561 + 563: 6(int) Load 8(invocation) + 564: 66(ptr) AccessChain 27(data) 29 39 30 + 565: 19(int) Load 564 + 566: 19(int) GroupNonUniformBitwiseOr 35 ClusteredReduce 565 34 + 567: 66(ptr) AccessChain 27(data) 563 39 30 + Store 567 566 + 568: 6(int) Load 8(invocation) + 569: 73(ptr) AccessChain 27(data) 39 39 + 570: 20(ivec4) Load 569 + 571: 72(ivec2) VectorShuffle 570 570 0 1 + 572: 72(ivec2) GroupNonUniformBitwiseOr 35 ClusteredReduce 571 34 + 573: 73(ptr) AccessChain 27(data) 568 39 + 574: 20(ivec4) Load 573 + 575: 20(ivec4) VectorShuffle 574 572 4 5 2 3 + Store 573 575 + 576: 6(int) Load 8(invocation) + 577: 73(ptr) AccessChain 27(data) 50 39 + 578: 20(ivec4) Load 577 + 579: 82(ivec3) VectorShuffle 578 578 0 1 2 + 580: 82(ivec3) GroupNonUniformBitwiseOr 35 ClusteredReduce 579 34 + 581: 73(ptr) AccessChain 27(data) 576 39 + 582: 20(ivec4) Load 581 + 583: 20(ivec4) VectorShuffle 582 580 4 5 6 3 + Store 581 583 + 584: 6(int) Load 8(invocation) + 585: 73(ptr) AccessChain 27(data) 60 39 + 586: 20(ivec4) Load 585 + 587: 20(ivec4) GroupNonUniformBitwiseOr 35 ClusteredReduce 586 34 + 588: 73(ptr) AccessChain 27(data) 584 39 + Store 588 587 + 589: 6(int) Load 8(invocation) + 590: 96(ptr) AccessChain 27(data) 29 50 30 + 591: 6(int) Load 590 + 592: 6(int) GroupNonUniformBitwiseOr 35 ClusteredReduce 591 34 + 593: 96(ptr) AccessChain 27(data) 589 50 30 + Store 593 592 + 594: 6(int) Load 8(invocation) + 595: 103(ptr) AccessChain 27(data) 39 50 + 596: 21(ivec4) Load 595 + 597: 102(ivec2) VectorShuffle 596 596 0 1 + 598: 102(ivec2) GroupNonUniformBitwiseOr 35 ClusteredReduce 597 34 + 599: 103(ptr) AccessChain 27(data) 594 50 + 600: 21(ivec4) Load 599 + 601: 21(ivec4) VectorShuffle 600 598 4 5 2 3 + Store 599 601 + 602: 6(int) Load 8(invocation) + 603: 103(ptr) AccessChain 27(data) 50 50 + 604: 21(ivec4) Load 603 + 605: 112(ivec3) VectorShuffle 604 604 0 1 2 + 606: 112(ivec3) GroupNonUniformBitwiseOr 35 ClusteredReduce 605 34 + 607: 103(ptr) AccessChain 27(data) 602 50 + 608: 21(ivec4) Load 607 + 609: 21(ivec4) VectorShuffle 608 606 4 5 6 3 + Store 607 609 + 610: 6(int) Load 8(invocation) + 611: 103(ptr) AccessChain 27(data) 60 50 + 612: 21(ivec4) Load 611 + 613: 21(ivec4) GroupNonUniformBitwiseOr 35 ClusteredReduce 612 34 + 614: 103(ptr) AccessChain 27(data) 610 50 + Store 614 613 + 615: 6(int) Load 8(invocation) + 616: 66(ptr) AccessChain 27(data) 29 39 30 + 617: 19(int) Load 616 + 618: 522(bool) SLessThan 617 29 + 619: 522(bool) GroupNonUniformLogicalOr 35 ClusteredReduce 618 34 + 620: 19(int) Select 619 39 29 + 621: 66(ptr) AccessChain 27(data) 615 39 30 + Store 621 620 + 622: 6(int) Load 8(invocation) + 623: 73(ptr) AccessChain 27(data) 39 39 + 624: 20(ivec4) Load 623 + 625: 72(ivec2) VectorShuffle 624 624 0 1 + 626: 532(bvec2) SLessThan 625 531 + 627: 532(bvec2) GroupNonUniformLogicalOr 35 ClusteredReduce 626 34 + 628: 72(ivec2) Select 627 535 531 + 629: 73(ptr) AccessChain 27(data) 622 39 + 630: 20(ivec4) Load 629 + 631: 20(ivec4) VectorShuffle 630 628 4 5 2 3 + Store 629 631 + 632: 6(int) Load 8(invocation) + 633: 73(ptr) AccessChain 27(data) 39 39 + 634: 20(ivec4) Load 633 + 635: 82(ivec3) VectorShuffle 634 634 0 1 2 + 636: 545(bvec3) SLessThan 635 544 + 637: 545(bvec3) GroupNonUniformLogicalOr 35 ClusteredReduce 636 34 + 638: 82(ivec3) Select 637 548 544 + 639: 73(ptr) AccessChain 27(data) 632 39 + 640: 20(ivec4) Load 639 + 641: 20(ivec4) VectorShuffle 640 638 4 5 6 3 + Store 639 641 + 642: 6(int) Load 8(invocation) + 643: 73(ptr) AccessChain 27(data) 39 39 + 644: 20(ivec4) Load 643 + 645: 557(bvec4) SLessThan 644 556 + 646: 557(bvec4) GroupNonUniformLogicalOr 35 ClusteredReduce 645 34 + 647: 20(ivec4) Select 646 560 556 + 648: 73(ptr) AccessChain 27(data) 642 39 + Store 648 647 + 649: 6(int) Load 8(invocation) + 650: 66(ptr) AccessChain 27(data) 29 39 30 + 651: 19(int) Load 650 + 652: 19(int) GroupNonUniformBitwiseXor 35 ClusteredReduce 651 34 + 653: 66(ptr) AccessChain 27(data) 649 39 30 + Store 653 652 + 654: 6(int) Load 8(invocation) + 655: 73(ptr) AccessChain 27(data) 39 39 + 656: 20(ivec4) Load 655 + 657: 72(ivec2) VectorShuffle 656 656 0 1 + 658: 72(ivec2) GroupNonUniformBitwiseXor 35 ClusteredReduce 657 34 + 659: 73(ptr) AccessChain 27(data) 654 39 + 660: 20(ivec4) Load 659 + 661: 20(ivec4) VectorShuffle 660 658 4 5 2 3 + Store 659 661 + 662: 6(int) Load 8(invocation) + 663: 73(ptr) AccessChain 27(data) 50 39 + 664: 20(ivec4) Load 663 + 665: 82(ivec3) VectorShuffle 664 664 0 1 2 + 666: 82(ivec3) GroupNonUniformBitwiseXor 35 ClusteredReduce 665 34 + 667: 73(ptr) AccessChain 27(data) 662 39 + 668: 20(ivec4) Load 667 + 669: 20(ivec4) VectorShuffle 668 666 4 5 6 3 + Store 667 669 + 670: 6(int) Load 8(invocation) + 671: 73(ptr) AccessChain 27(data) 60 39 + 672: 20(ivec4) Load 671 + 673: 20(ivec4) GroupNonUniformBitwiseXor 35 ClusteredReduce 672 34 + 674: 73(ptr) AccessChain 27(data) 670 39 + Store 674 673 + 675: 6(int) Load 8(invocation) + 676: 96(ptr) AccessChain 27(data) 29 50 30 + 677: 6(int) Load 676 + 678: 6(int) GroupNonUniformBitwiseXor 35 ClusteredReduce 677 34 + 679: 96(ptr) AccessChain 27(data) 675 50 30 + Store 679 678 + 680: 6(int) Load 8(invocation) + 681: 103(ptr) AccessChain 27(data) 39 50 + 682: 21(ivec4) Load 681 + 683: 102(ivec2) VectorShuffle 682 682 0 1 + 684: 102(ivec2) GroupNonUniformBitwiseXor 35 ClusteredReduce 683 34 + 685: 103(ptr) AccessChain 27(data) 680 50 + 686: 21(ivec4) Load 685 + 687: 21(ivec4) VectorShuffle 686 684 4 5 2 3 + Store 685 687 + 688: 6(int) Load 8(invocation) + 689: 103(ptr) AccessChain 27(data) 50 50 + 690: 21(ivec4) Load 689 + 691: 112(ivec3) VectorShuffle 690 690 0 1 2 + 692: 112(ivec3) GroupNonUniformBitwiseXor 35 ClusteredReduce 691 34 + 693: 103(ptr) AccessChain 27(data) 688 50 + 694: 21(ivec4) Load 693 + 695: 21(ivec4) VectorShuffle 694 692 4 5 6 3 + Store 693 695 + 696: 6(int) Load 8(invocation) + 697: 103(ptr) AccessChain 27(data) 60 50 + 698: 21(ivec4) Load 697 + 699: 21(ivec4) GroupNonUniformBitwiseXor 35 ClusteredReduce 698 34 + 700: 103(ptr) AccessChain 27(data) 696 50 + Store 700 699 + 701: 6(int) Load 8(invocation) + 702: 66(ptr) AccessChain 27(data) 29 39 30 + 703: 19(int) Load 702 + 704: 522(bool) SLessThan 703 29 + 705: 522(bool) GroupNonUniformLogicalXor 35 ClusteredReduce 704 34 + 706: 19(int) Select 705 39 29 + 707: 66(ptr) AccessChain 27(data) 701 39 30 + Store 707 706 + 708: 6(int) Load 8(invocation) + 709: 73(ptr) AccessChain 27(data) 39 39 + 710: 20(ivec4) Load 709 + 711: 72(ivec2) VectorShuffle 710 710 0 1 + 712: 532(bvec2) SLessThan 711 531 + 713: 532(bvec2) GroupNonUniformLogicalXor 35 ClusteredReduce 712 34 + 714: 72(ivec2) Select 713 535 531 + 715: 73(ptr) AccessChain 27(data) 708 39 + 716: 20(ivec4) Load 715 + 717: 20(ivec4) VectorShuffle 716 714 4 5 2 3 + Store 715 717 + 718: 6(int) Load 8(invocation) + 719: 73(ptr) AccessChain 27(data) 39 39 + 720: 20(ivec4) Load 719 + 721: 82(ivec3) VectorShuffle 720 720 0 1 2 + 722: 545(bvec3) SLessThan 721 544 + 723: 545(bvec3) GroupNonUniformLogicalXor 35 ClusteredReduce 722 34 + 724: 82(ivec3) Select 723 548 544 + 725: 73(ptr) AccessChain 27(data) 718 39 + 726: 20(ivec4) Load 725 + 727: 20(ivec4) VectorShuffle 726 724 4 5 6 3 + Store 725 727 + 728: 6(int) Load 8(invocation) + 729: 73(ptr) AccessChain 27(data) 39 39 + 730: 20(ivec4) Load 729 + 731: 557(bvec4) SLessThan 730 556 + 732: 557(bvec4) GroupNonUniformLogicalXor 35 ClusteredReduce 731 34 + 733: 20(ivec4) Select 732 560 556 + 734: 73(ptr) AccessChain 27(data) 728 39 + Store 734 733 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupClusteredNeg.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupClusteredNeg.comp.out new file mode 100644 index 00000000000..911ff72dca2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupClusteredNeg.comp.out @@ -0,0 +1,13 @@ +spv.subgroupClusteredNeg.comp +ERROR: 0:22: 'cluster size' : argument must be at least 1 +ERROR: 0:24: 'cluster size' : argument must be a power of 2 +ERROR: 0:27: 'cluster size' : argument must be a power of 2 +ERROR: 0:29: 'cluster size' : argument must be at least 1 +ERROR: 0:31: 'cluster size' : argument must be at least 1 +ERROR: 0:33: 'cluster size' : argument must be compile-time constant +ERROR: 0:36: 'cluster size' : argument must be compile-time constant +ERROR: 0:37: 'cluster size' : argument must be compile-time constant +ERROR: 8 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupPartitioned.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupPartitioned.comp.out new file mode 100644 index 00000000000..e967df4a235 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupPartitioned.comp.out @@ -0,0 +1,2876 @@ +spv.subgroupPartitioned.comp +error: SPIRV-Tools Validation Errors +error: Opcode GroupNonUniformFAdd requires one of these capabilities: GroupNonUniformArithmetic GroupNonUniformClustered + %179 = OpGroupNonUniformFAdd %float %uint_3 PartitionedReduceNV %176 %177 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 2506 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformPartitionedNV + Extension "SPV_NV_shader_subgroup_partitioned" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_NV_shader_subgroup_partitioned" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 19 "ballot" + Name 28 "Buffers" + MemberName 28(Buffers) 0 "f4" + MemberName 28(Buffers) 1 "i4" + MemberName 28(Buffers) 2 "u4" + MemberName 28(Buffers) 3 "d4" + Name 31 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 28(Buffers) 0 Offset 0 + MemberDecorate 28(Buffers) 1 Offset 16 + MemberDecorate 28(Buffers) 2 Offset 32 + MemberDecorate 28(Buffers) 3 Offset 64 + Decorate 28(Buffers) Block + Decorate 31(data) DescriptorSet 0 + Decorate 31(data) Binding 0 + Decorate 2505 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeVector 6(int) 4 + 18: TypePointer Function 17(ivec4) + 22: TypeFloat 32 + 23: TypeVector 22(float) 4 + 24: TypeInt 32 1 + 25: TypeVector 24(int) 4 + 26: TypeFloat 64 + 27: TypeVector 26(float64_t) 4 + 28(Buffers): TypeStruct 23(fvec4) 25(ivec4) 17(ivec4) 27(f64vec4) + 29: TypeArray 28(Buffers) 15 + 30: TypePointer StorageBuffer 29 + 31(data): 30(ptr) Variable StorageBuffer + 33: 24(int) Constant 2 + 34: 24(int) Constant 0 + 35: 6(int) Constant 0 + 36: TypePointer StorageBuffer 22(float) + 40: TypePointer StorageBuffer 17(ivec4) + 43: TypeVector 22(float) 2 + 44: TypePointer StorageBuffer 23(fvec4) + 51: TypeVector 22(float) 3 + 63: 24(int) Constant 1 + 64: TypePointer StorageBuffer 24(int) + 70: TypeVector 24(int) 2 + 71: TypePointer StorageBuffer 25(ivec4) + 78: TypeVector 24(int) 3 + 90: TypePointer StorageBuffer 6(int) + 96: TypeVector 6(int) 2 + 103: TypeVector 6(int) 3 + 115: 24(int) Constant 3 + 116: TypePointer StorageBuffer 26(float64_t) + 122: TypeVector 26(float64_t) 2 + 123: TypePointer StorageBuffer 27(f64vec4) + 130: TypeVector 26(float64_t) 3 + 144: TypeBool + 152: TypeVector 144(bool) 2 + 153: 96(ivec2) ConstantComposite 35 35 + 161: TypeVector 144(bool) 3 + 162: 103(ivec3) ConstantComposite 35 35 35 + 169: TypeVector 144(bool) 4 + 170: 17(ivec4) ConstantComposite 35 35 35 35 + 178: 6(int) Constant 3 + 727: 70(ivec2) ConstantComposite 34 34 + 731: 70(ivec2) ConstantComposite 63 63 + 740: 78(ivec3) ConstantComposite 34 34 34 + 744: 78(ivec3) ConstantComposite 63 63 63 + 752: 25(ivec4) ConstantComposite 34 34 34 34 + 756: 25(ivec4) ConstantComposite 63 63 63 63 + 2503: 6(int) Constant 8 + 2504: 6(int) Constant 1 + 2505: 103(ivec3) ConstantComposite 2503 2504 2504 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 19(ballot): 18(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 20: 6(int) Load 8(invocation) + 21: 17(ivec4) GroupNonUniformPartitionNV 20 + Store 19(ballot) 21 + 32: 6(int) Load 8(invocation) + 37: 36(ptr) AccessChain 31(data) 34 34 35 + 38: 22(float) Load 37 + 39: 17(ivec4) GroupNonUniformPartitionNV 38 + 41: 40(ptr) AccessChain 31(data) 32 33 + Store 41 39 + 42: 6(int) Load 8(invocation) + 45: 44(ptr) AccessChain 31(data) 34 34 + 46: 23(fvec4) Load 45 + 47: 43(fvec2) VectorShuffle 46 46 0 1 + 48: 17(ivec4) GroupNonUniformPartitionNV 47 + 49: 40(ptr) AccessChain 31(data) 42 33 + Store 49 48 + 50: 6(int) Load 8(invocation) + 52: 44(ptr) AccessChain 31(data) 34 34 + 53: 23(fvec4) Load 52 + 54: 51(fvec3) VectorShuffle 53 53 0 1 2 + 55: 17(ivec4) GroupNonUniformPartitionNV 54 + 56: 40(ptr) AccessChain 31(data) 50 33 + Store 56 55 + 57: 6(int) Load 8(invocation) + 58: 44(ptr) AccessChain 31(data) 34 34 + 59: 23(fvec4) Load 58 + 60: 17(ivec4) GroupNonUniformPartitionNV 59 + 61: 40(ptr) AccessChain 31(data) 57 33 + Store 61 60 + 62: 6(int) Load 8(invocation) + 65: 64(ptr) AccessChain 31(data) 34 63 35 + 66: 24(int) Load 65 + 67: 17(ivec4) GroupNonUniformPartitionNV 66 + 68: 40(ptr) AccessChain 31(data) 62 33 + Store 68 67 + 69: 6(int) Load 8(invocation) + 72: 71(ptr) AccessChain 31(data) 34 63 + 73: 25(ivec4) Load 72 + 74: 70(ivec2) VectorShuffle 73 73 0 1 + 75: 17(ivec4) GroupNonUniformPartitionNV 74 + 76: 40(ptr) AccessChain 31(data) 69 33 + Store 76 75 + 77: 6(int) Load 8(invocation) + 79: 71(ptr) AccessChain 31(data) 34 63 + 80: 25(ivec4) Load 79 + 81: 78(ivec3) VectorShuffle 80 80 0 1 2 + 82: 17(ivec4) GroupNonUniformPartitionNV 81 + 83: 40(ptr) AccessChain 31(data) 77 33 + Store 83 82 + 84: 6(int) Load 8(invocation) + 85: 71(ptr) AccessChain 31(data) 34 63 + 86: 25(ivec4) Load 85 + 87: 17(ivec4) GroupNonUniformPartitionNV 86 + 88: 40(ptr) AccessChain 31(data) 84 33 + Store 88 87 + 89: 6(int) Load 8(invocation) + 91: 90(ptr) AccessChain 31(data) 34 33 35 + 92: 6(int) Load 91 + 93: 17(ivec4) GroupNonUniformPartitionNV 92 + 94: 40(ptr) AccessChain 31(data) 89 33 + Store 94 93 + 95: 6(int) Load 8(invocation) + 97: 40(ptr) AccessChain 31(data) 34 33 + 98: 17(ivec4) Load 97 + 99: 96(ivec2) VectorShuffle 98 98 0 1 + 100: 17(ivec4) GroupNonUniformPartitionNV 99 + 101: 40(ptr) AccessChain 31(data) 95 33 + Store 101 100 + 102: 6(int) Load 8(invocation) + 104: 40(ptr) AccessChain 31(data) 34 33 + 105: 17(ivec4) Load 104 + 106: 103(ivec3) VectorShuffle 105 105 0 1 2 + 107: 17(ivec4) GroupNonUniformPartitionNV 106 + 108: 40(ptr) AccessChain 31(data) 102 33 + Store 108 107 + 109: 6(int) Load 8(invocation) + 110: 40(ptr) AccessChain 31(data) 34 33 + 111: 17(ivec4) Load 110 + 112: 17(ivec4) GroupNonUniformPartitionNV 111 + 113: 40(ptr) AccessChain 31(data) 109 33 + Store 113 112 + 114: 6(int) Load 8(invocation) + 117: 116(ptr) AccessChain 31(data) 34 115 35 + 118:26(float64_t) Load 117 + 119: 17(ivec4) GroupNonUniformPartitionNV 118 + 120: 40(ptr) AccessChain 31(data) 114 33 + Store 120 119 + 121: 6(int) Load 8(invocation) + 124: 123(ptr) AccessChain 31(data) 34 115 + 125: 27(f64vec4) Load 124 + 126:122(f64vec2) VectorShuffle 125 125 0 1 + 127: 17(ivec4) GroupNonUniformPartitionNV 126 + 128: 40(ptr) AccessChain 31(data) 121 33 + Store 128 127 + 129: 6(int) Load 8(invocation) + 131: 123(ptr) AccessChain 31(data) 34 115 + 132: 27(f64vec4) Load 131 + 133:130(f64vec3) VectorShuffle 132 132 0 1 2 + 134: 17(ivec4) GroupNonUniformPartitionNV 133 + 135: 40(ptr) AccessChain 31(data) 129 33 + Store 135 134 + 136: 6(int) Load 8(invocation) + 137: 123(ptr) AccessChain 31(data) 34 115 + 138: 27(f64vec4) Load 137 + 139: 17(ivec4) GroupNonUniformPartitionNV 138 + 140: 40(ptr) AccessChain 31(data) 136 33 + Store 140 139 + 141: 6(int) Load 8(invocation) + 142: 64(ptr) AccessChain 31(data) 34 63 35 + 143: 24(int) Load 142 + 145: 144(bool) INotEqual 143 35 + 146: 17(ivec4) GroupNonUniformPartitionNV 145 + 147: 40(ptr) AccessChain 31(data) 141 33 + Store 147 146 + 148: 6(int) Load 8(invocation) + 149: 71(ptr) AccessChain 31(data) 34 63 + 150: 25(ivec4) Load 149 + 151: 70(ivec2) VectorShuffle 150 150 0 1 + 154: 152(bvec2) INotEqual 151 153 + 155: 17(ivec4) GroupNonUniformPartitionNV 154 + 156: 40(ptr) AccessChain 31(data) 148 33 + Store 156 155 + 157: 6(int) Load 8(invocation) + 158: 71(ptr) AccessChain 31(data) 34 63 + 159: 25(ivec4) Load 158 + 160: 78(ivec3) VectorShuffle 159 159 0 1 2 + 163: 161(bvec3) INotEqual 160 162 + 164: 17(ivec4) GroupNonUniformPartitionNV 163 + 165: 40(ptr) AccessChain 31(data) 157 33 + Store 165 164 + 166: 6(int) Load 8(invocation) + 167: 71(ptr) AccessChain 31(data) 34 63 + 168: 25(ivec4) Load 167 + 171: 169(bvec4) INotEqual 168 170 + 172: 17(ivec4) GroupNonUniformPartitionNV 171 + 173: 40(ptr) AccessChain 31(data) 166 33 + Store 173 172 + 174: 6(int) Load 8(invocation) + 175: 36(ptr) AccessChain 31(data) 34 34 35 + 176: 22(float) Load 175 + 177: 17(ivec4) Load 19(ballot) + 179: 22(float) GroupNonUniformFAdd 178 PartitionedReduceNV 176 177 + 180: 36(ptr) AccessChain 31(data) 174 34 35 + Store 180 179 + 181: 6(int) Load 8(invocation) + 182: 44(ptr) AccessChain 31(data) 63 34 + 183: 23(fvec4) Load 182 + 184: 43(fvec2) VectorShuffle 183 183 0 1 + 185: 17(ivec4) Load 19(ballot) + 186: 43(fvec2) GroupNonUniformFAdd 178 PartitionedReduceNV 184 185 + 187: 44(ptr) AccessChain 31(data) 181 34 + 188: 23(fvec4) Load 187 + 189: 23(fvec4) VectorShuffle 188 186 4 5 2 3 + Store 187 189 + 190: 6(int) Load 8(invocation) + 191: 44(ptr) AccessChain 31(data) 33 34 + 192: 23(fvec4) Load 191 + 193: 51(fvec3) VectorShuffle 192 192 0 1 2 + 194: 17(ivec4) Load 19(ballot) + 195: 51(fvec3) GroupNonUniformFAdd 178 PartitionedReduceNV 193 194 + 196: 44(ptr) AccessChain 31(data) 190 34 + 197: 23(fvec4) Load 196 + 198: 23(fvec4) VectorShuffle 197 195 4 5 6 3 + Store 196 198 + 199: 6(int) Load 8(invocation) + 200: 44(ptr) AccessChain 31(data) 115 34 + 201: 23(fvec4) Load 200 + 202: 17(ivec4) Load 19(ballot) + 203: 23(fvec4) GroupNonUniformFAdd 178 PartitionedReduceNV 201 202 + 204: 44(ptr) AccessChain 31(data) 199 34 + Store 204 203 + 205: 6(int) Load 8(invocation) + 206: 64(ptr) AccessChain 31(data) 34 63 35 + 207: 24(int) Load 206 + 208: 17(ivec4) Load 19(ballot) + 209: 24(int) GroupNonUniformIAdd 178 PartitionedReduceNV 207 208 + 210: 64(ptr) AccessChain 31(data) 205 63 35 + Store 210 209 + 211: 6(int) Load 8(invocation) + 212: 71(ptr) AccessChain 31(data) 63 63 + 213: 25(ivec4) Load 212 + 214: 70(ivec2) VectorShuffle 213 213 0 1 + 215: 17(ivec4) Load 19(ballot) + 216: 70(ivec2) GroupNonUniformIAdd 178 PartitionedReduceNV 214 215 + 217: 71(ptr) AccessChain 31(data) 211 63 + 218: 25(ivec4) Load 217 + 219: 25(ivec4) VectorShuffle 218 216 4 5 2 3 + Store 217 219 + 220: 6(int) Load 8(invocation) + 221: 71(ptr) AccessChain 31(data) 33 63 + 222: 25(ivec4) Load 221 + 223: 78(ivec3) VectorShuffle 222 222 0 1 2 + 224: 17(ivec4) Load 19(ballot) + 225: 78(ivec3) GroupNonUniformIAdd 178 PartitionedReduceNV 223 224 + 226: 71(ptr) AccessChain 31(data) 220 63 + 227: 25(ivec4) Load 226 + 228: 25(ivec4) VectorShuffle 227 225 4 5 6 3 + Store 226 228 + 229: 6(int) Load 8(invocation) + 230: 71(ptr) AccessChain 31(data) 115 63 + 231: 25(ivec4) Load 230 + 232: 17(ivec4) Load 19(ballot) + 233: 25(ivec4) GroupNonUniformIAdd 178 PartitionedReduceNV 231 232 + 234: 71(ptr) AccessChain 31(data) 229 63 + Store 234 233 + 235: 6(int) Load 8(invocation) + 236: 90(ptr) AccessChain 31(data) 34 33 35 + 237: 6(int) Load 236 + 238: 17(ivec4) Load 19(ballot) + 239: 6(int) GroupNonUniformIAdd 178 PartitionedReduceNV 237 238 + 240: 90(ptr) AccessChain 31(data) 235 33 35 + Store 240 239 + 241: 6(int) Load 8(invocation) + 242: 40(ptr) AccessChain 31(data) 63 33 + 243: 17(ivec4) Load 242 + 244: 96(ivec2) VectorShuffle 243 243 0 1 + 245: 17(ivec4) Load 19(ballot) + 246: 96(ivec2) GroupNonUniformIAdd 178 PartitionedReduceNV 244 245 + 247: 40(ptr) AccessChain 31(data) 241 33 + 248: 17(ivec4) Load 247 + 249: 17(ivec4) VectorShuffle 248 246 4 5 2 3 + Store 247 249 + 250: 6(int) Load 8(invocation) + 251: 40(ptr) AccessChain 31(data) 33 33 + 252: 17(ivec4) Load 251 + 253: 103(ivec3) VectorShuffle 252 252 0 1 2 + 254: 17(ivec4) Load 19(ballot) + 255: 103(ivec3) GroupNonUniformIAdd 178 PartitionedReduceNV 253 254 + 256: 40(ptr) AccessChain 31(data) 250 33 + 257: 17(ivec4) Load 256 + 258: 17(ivec4) VectorShuffle 257 255 4 5 6 3 + Store 256 258 + 259: 6(int) Load 8(invocation) + 260: 40(ptr) AccessChain 31(data) 115 33 + 261: 17(ivec4) Load 260 + 262: 17(ivec4) Load 19(ballot) + 263: 17(ivec4) GroupNonUniformIAdd 178 PartitionedReduceNV 261 262 + 264: 40(ptr) AccessChain 31(data) 259 33 + Store 264 263 + 265: 6(int) Load 8(invocation) + 266: 116(ptr) AccessChain 31(data) 34 115 35 + 267:26(float64_t) Load 266 + 268: 17(ivec4) Load 19(ballot) + 269:26(float64_t) GroupNonUniformFAdd 178 PartitionedReduceNV 267 268 + 270: 116(ptr) AccessChain 31(data) 265 115 35 + Store 270 269 + 271: 6(int) Load 8(invocation) + 272: 123(ptr) AccessChain 31(data) 63 115 + 273: 27(f64vec4) Load 272 + 274:122(f64vec2) VectorShuffle 273 273 0 1 + 275: 17(ivec4) Load 19(ballot) + 276:122(f64vec2) GroupNonUniformFAdd 178 PartitionedReduceNV 274 275 + 277: 123(ptr) AccessChain 31(data) 271 115 + 278: 27(f64vec4) Load 277 + 279: 27(f64vec4) VectorShuffle 278 276 4 5 2 3 + Store 277 279 + 280: 6(int) Load 8(invocation) + 281: 123(ptr) AccessChain 31(data) 33 115 + 282: 27(f64vec4) Load 281 + 283:130(f64vec3) VectorShuffle 282 282 0 1 2 + 284: 17(ivec4) Load 19(ballot) + 285:130(f64vec3) GroupNonUniformFAdd 178 PartitionedReduceNV 283 284 + 286: 123(ptr) AccessChain 31(data) 280 115 + 287: 27(f64vec4) Load 286 + 288: 27(f64vec4) VectorShuffle 287 285 4 5 6 3 + Store 286 288 + 289: 6(int) Load 8(invocation) + 290: 123(ptr) AccessChain 31(data) 115 115 + 291: 27(f64vec4) Load 290 + 292: 17(ivec4) Load 19(ballot) + 293: 27(f64vec4) GroupNonUniformFAdd 178 PartitionedReduceNV 291 292 + 294: 123(ptr) AccessChain 31(data) 289 115 + Store 294 293 + 295: 6(int) Load 8(invocation) + 296: 36(ptr) AccessChain 31(data) 34 34 35 + 297: 22(float) Load 296 + 298: 17(ivec4) Load 19(ballot) + 299: 22(float) GroupNonUniformFMul 178 PartitionedReduceNV 297 298 + 300: 36(ptr) AccessChain 31(data) 295 34 35 + Store 300 299 + 301: 6(int) Load 8(invocation) + 302: 44(ptr) AccessChain 31(data) 63 34 + 303: 23(fvec4) Load 302 + 304: 43(fvec2) VectorShuffle 303 303 0 1 + 305: 17(ivec4) Load 19(ballot) + 306: 43(fvec2) GroupNonUniformFMul 178 PartitionedReduceNV 304 305 + 307: 44(ptr) AccessChain 31(data) 301 34 + 308: 23(fvec4) Load 307 + 309: 23(fvec4) VectorShuffle 308 306 4 5 2 3 + Store 307 309 + 310: 6(int) Load 8(invocation) + 311: 44(ptr) AccessChain 31(data) 33 34 + 312: 23(fvec4) Load 311 + 313: 51(fvec3) VectorShuffle 312 312 0 1 2 + 314: 17(ivec4) Load 19(ballot) + 315: 51(fvec3) GroupNonUniformFMul 178 PartitionedReduceNV 313 314 + 316: 44(ptr) AccessChain 31(data) 310 34 + 317: 23(fvec4) Load 316 + 318: 23(fvec4) VectorShuffle 317 315 4 5 6 3 + Store 316 318 + 319: 6(int) Load 8(invocation) + 320: 44(ptr) AccessChain 31(data) 115 34 + 321: 23(fvec4) Load 320 + 322: 17(ivec4) Load 19(ballot) + 323: 23(fvec4) GroupNonUniformFMul 178 PartitionedReduceNV 321 322 + 324: 44(ptr) AccessChain 31(data) 319 34 + Store 324 323 + 325: 6(int) Load 8(invocation) + 326: 64(ptr) AccessChain 31(data) 34 63 35 + 327: 24(int) Load 326 + 328: 17(ivec4) Load 19(ballot) + 329: 24(int) GroupNonUniformIMul 178 PartitionedReduceNV 327 328 + 330: 64(ptr) AccessChain 31(data) 325 63 35 + Store 330 329 + 331: 6(int) Load 8(invocation) + 332: 71(ptr) AccessChain 31(data) 63 63 + 333: 25(ivec4) Load 332 + 334: 70(ivec2) VectorShuffle 333 333 0 1 + 335: 17(ivec4) Load 19(ballot) + 336: 70(ivec2) GroupNonUniformIMul 178 PartitionedReduceNV 334 335 + 337: 71(ptr) AccessChain 31(data) 331 63 + 338: 25(ivec4) Load 337 + 339: 25(ivec4) VectorShuffle 338 336 4 5 2 3 + Store 337 339 + 340: 6(int) Load 8(invocation) + 341: 71(ptr) AccessChain 31(data) 33 63 + 342: 25(ivec4) Load 341 + 343: 78(ivec3) VectorShuffle 342 342 0 1 2 + 344: 17(ivec4) Load 19(ballot) + 345: 78(ivec3) GroupNonUniformIMul 178 PartitionedReduceNV 343 344 + 346: 71(ptr) AccessChain 31(data) 340 63 + 347: 25(ivec4) Load 346 + 348: 25(ivec4) VectorShuffle 347 345 4 5 6 3 + Store 346 348 + 349: 6(int) Load 8(invocation) + 350: 71(ptr) AccessChain 31(data) 115 63 + 351: 25(ivec4) Load 350 + 352: 17(ivec4) Load 19(ballot) + 353: 25(ivec4) GroupNonUniformIMul 178 PartitionedReduceNV 351 352 + 354: 71(ptr) AccessChain 31(data) 349 63 + Store 354 353 + 355: 6(int) Load 8(invocation) + 356: 90(ptr) AccessChain 31(data) 34 33 35 + 357: 6(int) Load 356 + 358: 17(ivec4) Load 19(ballot) + 359: 6(int) GroupNonUniformIMul 178 PartitionedReduceNV 357 358 + 360: 90(ptr) AccessChain 31(data) 355 33 35 + Store 360 359 + 361: 6(int) Load 8(invocation) + 362: 40(ptr) AccessChain 31(data) 63 33 + 363: 17(ivec4) Load 362 + 364: 96(ivec2) VectorShuffle 363 363 0 1 + 365: 17(ivec4) Load 19(ballot) + 366: 96(ivec2) GroupNonUniformIMul 178 PartitionedReduceNV 364 365 + 367: 40(ptr) AccessChain 31(data) 361 33 + 368: 17(ivec4) Load 367 + 369: 17(ivec4) VectorShuffle 368 366 4 5 2 3 + Store 367 369 + 370: 6(int) Load 8(invocation) + 371: 40(ptr) AccessChain 31(data) 33 33 + 372: 17(ivec4) Load 371 + 373: 103(ivec3) VectorShuffle 372 372 0 1 2 + 374: 17(ivec4) Load 19(ballot) + 375: 103(ivec3) GroupNonUniformIMul 178 PartitionedReduceNV 373 374 + 376: 40(ptr) AccessChain 31(data) 370 33 + 377: 17(ivec4) Load 376 + 378: 17(ivec4) VectorShuffle 377 375 4 5 6 3 + Store 376 378 + 379: 6(int) Load 8(invocation) + 380: 40(ptr) AccessChain 31(data) 115 33 + 381: 17(ivec4) Load 380 + 382: 17(ivec4) Load 19(ballot) + 383: 17(ivec4) GroupNonUniformIMul 178 PartitionedReduceNV 381 382 + 384: 40(ptr) AccessChain 31(data) 379 33 + Store 384 383 + 385: 6(int) Load 8(invocation) + 386: 116(ptr) AccessChain 31(data) 34 115 35 + 387:26(float64_t) Load 386 + 388: 17(ivec4) Load 19(ballot) + 389:26(float64_t) GroupNonUniformFMul 178 PartitionedReduceNV 387 388 + 390: 116(ptr) AccessChain 31(data) 385 115 35 + Store 390 389 + 391: 6(int) Load 8(invocation) + 392: 123(ptr) AccessChain 31(data) 63 115 + 393: 27(f64vec4) Load 392 + 394:122(f64vec2) VectorShuffle 393 393 0 1 + 395: 17(ivec4) Load 19(ballot) + 396:122(f64vec2) GroupNonUniformFMul 178 PartitionedReduceNV 394 395 + 397: 123(ptr) AccessChain 31(data) 391 115 + 398: 27(f64vec4) Load 397 + 399: 27(f64vec4) VectorShuffle 398 396 4 5 2 3 + Store 397 399 + 400: 6(int) Load 8(invocation) + 401: 123(ptr) AccessChain 31(data) 33 115 + 402: 27(f64vec4) Load 401 + 403:130(f64vec3) VectorShuffle 402 402 0 1 2 + 404: 17(ivec4) Load 19(ballot) + 405:130(f64vec3) GroupNonUniformFMul 178 PartitionedReduceNV 403 404 + 406: 123(ptr) AccessChain 31(data) 400 115 + 407: 27(f64vec4) Load 406 + 408: 27(f64vec4) VectorShuffle 407 405 4 5 6 3 + Store 406 408 + 409: 6(int) Load 8(invocation) + 410: 123(ptr) AccessChain 31(data) 115 115 + 411: 27(f64vec4) Load 410 + 412: 17(ivec4) Load 19(ballot) + 413: 27(f64vec4) GroupNonUniformFMul 178 PartitionedReduceNV 411 412 + 414: 123(ptr) AccessChain 31(data) 409 115 + Store 414 413 + 415: 6(int) Load 8(invocation) + 416: 36(ptr) AccessChain 31(data) 34 34 35 + 417: 22(float) Load 416 + 418: 17(ivec4) Load 19(ballot) + 419: 22(float) GroupNonUniformFMin 178 PartitionedReduceNV 417 418 + 420: 36(ptr) AccessChain 31(data) 415 34 35 + Store 420 419 + 421: 6(int) Load 8(invocation) + 422: 44(ptr) AccessChain 31(data) 63 34 + 423: 23(fvec4) Load 422 + 424: 43(fvec2) VectorShuffle 423 423 0 1 + 425: 17(ivec4) Load 19(ballot) + 426: 43(fvec2) GroupNonUniformFMin 178 PartitionedReduceNV 424 425 + 427: 44(ptr) AccessChain 31(data) 421 34 + 428: 23(fvec4) Load 427 + 429: 23(fvec4) VectorShuffle 428 426 4 5 2 3 + Store 427 429 + 430: 6(int) Load 8(invocation) + 431: 44(ptr) AccessChain 31(data) 33 34 + 432: 23(fvec4) Load 431 + 433: 51(fvec3) VectorShuffle 432 432 0 1 2 + 434: 17(ivec4) Load 19(ballot) + 435: 51(fvec3) GroupNonUniformFMin 178 PartitionedReduceNV 433 434 + 436: 44(ptr) AccessChain 31(data) 430 34 + 437: 23(fvec4) Load 436 + 438: 23(fvec4) VectorShuffle 437 435 4 5 6 3 + Store 436 438 + 439: 6(int) Load 8(invocation) + 440: 44(ptr) AccessChain 31(data) 115 34 + 441: 23(fvec4) Load 440 + 442: 17(ivec4) Load 19(ballot) + 443: 23(fvec4) GroupNonUniformFMin 178 PartitionedReduceNV 441 442 + 444: 44(ptr) AccessChain 31(data) 439 34 + Store 444 443 + 445: 6(int) Load 8(invocation) + 446: 64(ptr) AccessChain 31(data) 34 63 35 + 447: 24(int) Load 446 + 448: 17(ivec4) Load 19(ballot) + 449: 24(int) GroupNonUniformSMin 178 PartitionedReduceNV 447 448 + 450: 64(ptr) AccessChain 31(data) 445 63 35 + Store 450 449 + 451: 6(int) Load 8(invocation) + 452: 71(ptr) AccessChain 31(data) 63 63 + 453: 25(ivec4) Load 452 + 454: 70(ivec2) VectorShuffle 453 453 0 1 + 455: 17(ivec4) Load 19(ballot) + 456: 70(ivec2) GroupNonUniformSMin 178 PartitionedReduceNV 454 455 + 457: 71(ptr) AccessChain 31(data) 451 63 + 458: 25(ivec4) Load 457 + 459: 25(ivec4) VectorShuffle 458 456 4 5 2 3 + Store 457 459 + 460: 6(int) Load 8(invocation) + 461: 71(ptr) AccessChain 31(data) 33 63 + 462: 25(ivec4) Load 461 + 463: 78(ivec3) VectorShuffle 462 462 0 1 2 + 464: 17(ivec4) Load 19(ballot) + 465: 78(ivec3) GroupNonUniformSMin 178 PartitionedReduceNV 463 464 + 466: 71(ptr) AccessChain 31(data) 460 63 + 467: 25(ivec4) Load 466 + 468: 25(ivec4) VectorShuffle 467 465 4 5 6 3 + Store 466 468 + 469: 6(int) Load 8(invocation) + 470: 71(ptr) AccessChain 31(data) 115 63 + 471: 25(ivec4) Load 470 + 472: 17(ivec4) Load 19(ballot) + 473: 25(ivec4) GroupNonUniformSMin 178 PartitionedReduceNV 471 472 + 474: 71(ptr) AccessChain 31(data) 469 63 + Store 474 473 + 475: 6(int) Load 8(invocation) + 476: 90(ptr) AccessChain 31(data) 34 33 35 + 477: 6(int) Load 476 + 478: 17(ivec4) Load 19(ballot) + 479: 6(int) GroupNonUniformUMin 178 PartitionedReduceNV 477 478 + 480: 90(ptr) AccessChain 31(data) 475 33 35 + Store 480 479 + 481: 6(int) Load 8(invocation) + 482: 40(ptr) AccessChain 31(data) 63 33 + 483: 17(ivec4) Load 482 + 484: 96(ivec2) VectorShuffle 483 483 0 1 + 485: 17(ivec4) Load 19(ballot) + 486: 96(ivec2) GroupNonUniformUMin 178 PartitionedReduceNV 484 485 + 487: 40(ptr) AccessChain 31(data) 481 33 + 488: 17(ivec4) Load 487 + 489: 17(ivec4) VectorShuffle 488 486 4 5 2 3 + Store 487 489 + 490: 6(int) Load 8(invocation) + 491: 40(ptr) AccessChain 31(data) 33 33 + 492: 17(ivec4) Load 491 + 493: 103(ivec3) VectorShuffle 492 492 0 1 2 + 494: 17(ivec4) Load 19(ballot) + 495: 103(ivec3) GroupNonUniformUMin 178 PartitionedReduceNV 493 494 + 496: 40(ptr) AccessChain 31(data) 490 33 + 497: 17(ivec4) Load 496 + 498: 17(ivec4) VectorShuffle 497 495 4 5 6 3 + Store 496 498 + 499: 6(int) Load 8(invocation) + 500: 40(ptr) AccessChain 31(data) 115 33 + 501: 17(ivec4) Load 500 + 502: 17(ivec4) Load 19(ballot) + 503: 17(ivec4) GroupNonUniformUMin 178 PartitionedReduceNV 501 502 + 504: 40(ptr) AccessChain 31(data) 499 33 + Store 504 503 + 505: 6(int) Load 8(invocation) + 506: 116(ptr) AccessChain 31(data) 34 115 35 + 507:26(float64_t) Load 506 + 508: 17(ivec4) Load 19(ballot) + 509:26(float64_t) GroupNonUniformFMin 178 PartitionedReduceNV 507 508 + 510: 116(ptr) AccessChain 31(data) 505 115 35 + Store 510 509 + 511: 6(int) Load 8(invocation) + 512: 123(ptr) AccessChain 31(data) 63 115 + 513: 27(f64vec4) Load 512 + 514:122(f64vec2) VectorShuffle 513 513 0 1 + 515: 17(ivec4) Load 19(ballot) + 516:122(f64vec2) GroupNonUniformFMin 178 PartitionedReduceNV 514 515 + 517: 123(ptr) AccessChain 31(data) 511 115 + 518: 27(f64vec4) Load 517 + 519: 27(f64vec4) VectorShuffle 518 516 4 5 2 3 + Store 517 519 + 520: 6(int) Load 8(invocation) + 521: 123(ptr) AccessChain 31(data) 33 115 + 522: 27(f64vec4) Load 521 + 523:130(f64vec3) VectorShuffle 522 522 0 1 2 + 524: 17(ivec4) Load 19(ballot) + 525:130(f64vec3) GroupNonUniformFMin 178 PartitionedReduceNV 523 524 + 526: 123(ptr) AccessChain 31(data) 520 115 + 527: 27(f64vec4) Load 526 + 528: 27(f64vec4) VectorShuffle 527 525 4 5 6 3 + Store 526 528 + 529: 6(int) Load 8(invocation) + 530: 123(ptr) AccessChain 31(data) 115 115 + 531: 27(f64vec4) Load 530 + 532: 17(ivec4) Load 19(ballot) + 533: 27(f64vec4) GroupNonUniformFMin 178 PartitionedReduceNV 531 532 + 534: 123(ptr) AccessChain 31(data) 529 115 + Store 534 533 + 535: 6(int) Load 8(invocation) + 536: 36(ptr) AccessChain 31(data) 34 34 35 + 537: 22(float) Load 536 + 538: 17(ivec4) Load 19(ballot) + 539: 22(float) GroupNonUniformFMax 178 PartitionedReduceNV 537 538 + 540: 36(ptr) AccessChain 31(data) 535 34 35 + Store 540 539 + 541: 6(int) Load 8(invocation) + 542: 44(ptr) AccessChain 31(data) 63 34 + 543: 23(fvec4) Load 542 + 544: 43(fvec2) VectorShuffle 543 543 0 1 + 545: 17(ivec4) Load 19(ballot) + 546: 43(fvec2) GroupNonUniformFMax 178 PartitionedReduceNV 544 545 + 547: 44(ptr) AccessChain 31(data) 541 34 + 548: 23(fvec4) Load 547 + 549: 23(fvec4) VectorShuffle 548 546 4 5 2 3 + Store 547 549 + 550: 6(int) Load 8(invocation) + 551: 44(ptr) AccessChain 31(data) 33 34 + 552: 23(fvec4) Load 551 + 553: 51(fvec3) VectorShuffle 552 552 0 1 2 + 554: 17(ivec4) Load 19(ballot) + 555: 51(fvec3) GroupNonUniformFMax 178 PartitionedReduceNV 553 554 + 556: 44(ptr) AccessChain 31(data) 550 34 + 557: 23(fvec4) Load 556 + 558: 23(fvec4) VectorShuffle 557 555 4 5 6 3 + Store 556 558 + 559: 6(int) Load 8(invocation) + 560: 44(ptr) AccessChain 31(data) 115 34 + 561: 23(fvec4) Load 560 + 562: 17(ivec4) Load 19(ballot) + 563: 23(fvec4) GroupNonUniformFMax 178 PartitionedReduceNV 561 562 + 564: 44(ptr) AccessChain 31(data) 559 34 + Store 564 563 + 565: 6(int) Load 8(invocation) + 566: 64(ptr) AccessChain 31(data) 34 63 35 + 567: 24(int) Load 566 + 568: 17(ivec4) Load 19(ballot) + 569: 24(int) GroupNonUniformSMax 178 PartitionedReduceNV 567 568 + 570: 64(ptr) AccessChain 31(data) 565 63 35 + Store 570 569 + 571: 6(int) Load 8(invocation) + 572: 71(ptr) AccessChain 31(data) 63 63 + 573: 25(ivec4) Load 572 + 574: 70(ivec2) VectorShuffle 573 573 0 1 + 575: 17(ivec4) Load 19(ballot) + 576: 70(ivec2) GroupNonUniformSMax 178 PartitionedReduceNV 574 575 + 577: 71(ptr) AccessChain 31(data) 571 63 + 578: 25(ivec4) Load 577 + 579: 25(ivec4) VectorShuffle 578 576 4 5 2 3 + Store 577 579 + 580: 6(int) Load 8(invocation) + 581: 71(ptr) AccessChain 31(data) 33 63 + 582: 25(ivec4) Load 581 + 583: 78(ivec3) VectorShuffle 582 582 0 1 2 + 584: 17(ivec4) Load 19(ballot) + 585: 78(ivec3) GroupNonUniformSMax 178 PartitionedReduceNV 583 584 + 586: 71(ptr) AccessChain 31(data) 580 63 + 587: 25(ivec4) Load 586 + 588: 25(ivec4) VectorShuffle 587 585 4 5 6 3 + Store 586 588 + 589: 6(int) Load 8(invocation) + 590: 71(ptr) AccessChain 31(data) 115 63 + 591: 25(ivec4) Load 590 + 592: 17(ivec4) Load 19(ballot) + 593: 25(ivec4) GroupNonUniformSMax 178 PartitionedReduceNV 591 592 + 594: 71(ptr) AccessChain 31(data) 589 63 + Store 594 593 + 595: 6(int) Load 8(invocation) + 596: 90(ptr) AccessChain 31(data) 34 33 35 + 597: 6(int) Load 596 + 598: 17(ivec4) Load 19(ballot) + 599: 6(int) GroupNonUniformUMax 178 PartitionedReduceNV 597 598 + 600: 90(ptr) AccessChain 31(data) 595 33 35 + Store 600 599 + 601: 6(int) Load 8(invocation) + 602: 40(ptr) AccessChain 31(data) 63 33 + 603: 17(ivec4) Load 602 + 604: 96(ivec2) VectorShuffle 603 603 0 1 + 605: 17(ivec4) Load 19(ballot) + 606: 96(ivec2) GroupNonUniformUMax 178 PartitionedReduceNV 604 605 + 607: 40(ptr) AccessChain 31(data) 601 33 + 608: 17(ivec4) Load 607 + 609: 17(ivec4) VectorShuffle 608 606 4 5 2 3 + Store 607 609 + 610: 6(int) Load 8(invocation) + 611: 40(ptr) AccessChain 31(data) 33 33 + 612: 17(ivec4) Load 611 + 613: 103(ivec3) VectorShuffle 612 612 0 1 2 + 614: 17(ivec4) Load 19(ballot) + 615: 103(ivec3) GroupNonUniformUMax 178 PartitionedReduceNV 613 614 + 616: 40(ptr) AccessChain 31(data) 610 33 + 617: 17(ivec4) Load 616 + 618: 17(ivec4) VectorShuffle 617 615 4 5 6 3 + Store 616 618 + 619: 6(int) Load 8(invocation) + 620: 40(ptr) AccessChain 31(data) 115 33 + 621: 17(ivec4) Load 620 + 622: 17(ivec4) Load 19(ballot) + 623: 17(ivec4) GroupNonUniformUMax 178 PartitionedReduceNV 621 622 + 624: 40(ptr) AccessChain 31(data) 619 33 + Store 624 623 + 625: 6(int) Load 8(invocation) + 626: 116(ptr) AccessChain 31(data) 34 115 35 + 627:26(float64_t) Load 626 + 628: 17(ivec4) Load 19(ballot) + 629:26(float64_t) GroupNonUniformFMax 178 PartitionedReduceNV 627 628 + 630: 116(ptr) AccessChain 31(data) 625 115 35 + Store 630 629 + 631: 6(int) Load 8(invocation) + 632: 123(ptr) AccessChain 31(data) 63 115 + 633: 27(f64vec4) Load 632 + 634:122(f64vec2) VectorShuffle 633 633 0 1 + 635: 17(ivec4) Load 19(ballot) + 636:122(f64vec2) GroupNonUniformFMax 178 PartitionedReduceNV 634 635 + 637: 123(ptr) AccessChain 31(data) 631 115 + 638: 27(f64vec4) Load 637 + 639: 27(f64vec4) VectorShuffle 638 636 4 5 2 3 + Store 637 639 + 640: 6(int) Load 8(invocation) + 641: 123(ptr) AccessChain 31(data) 33 115 + 642: 27(f64vec4) Load 641 + 643:130(f64vec3) VectorShuffle 642 642 0 1 2 + 644: 17(ivec4) Load 19(ballot) + 645:130(f64vec3) GroupNonUniformFMax 178 PartitionedReduceNV 643 644 + 646: 123(ptr) AccessChain 31(data) 640 115 + 647: 27(f64vec4) Load 646 + 648: 27(f64vec4) VectorShuffle 647 645 4 5 6 3 + Store 646 648 + 649: 6(int) Load 8(invocation) + 650: 123(ptr) AccessChain 31(data) 115 115 + 651: 27(f64vec4) Load 650 + 652: 17(ivec4) Load 19(ballot) + 653: 27(f64vec4) GroupNonUniformFMax 178 PartitionedReduceNV 651 652 + 654: 123(ptr) AccessChain 31(data) 649 115 + Store 654 653 + 655: 6(int) Load 8(invocation) + 656: 64(ptr) AccessChain 31(data) 34 63 35 + 657: 24(int) Load 656 + 658: 17(ivec4) Load 19(ballot) + 659: 24(int) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 657 658 + 660: 64(ptr) AccessChain 31(data) 655 63 35 + Store 660 659 + 661: 6(int) Load 8(invocation) + 662: 71(ptr) AccessChain 31(data) 63 63 + 663: 25(ivec4) Load 662 + 664: 70(ivec2) VectorShuffle 663 663 0 1 + 665: 17(ivec4) Load 19(ballot) + 666: 70(ivec2) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 664 665 + 667: 71(ptr) AccessChain 31(data) 661 63 + 668: 25(ivec4) Load 667 + 669: 25(ivec4) VectorShuffle 668 666 4 5 2 3 + Store 667 669 + 670: 6(int) Load 8(invocation) + 671: 71(ptr) AccessChain 31(data) 33 63 + 672: 25(ivec4) Load 671 + 673: 78(ivec3) VectorShuffle 672 672 0 1 2 + 674: 17(ivec4) Load 19(ballot) + 675: 78(ivec3) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 673 674 + 676: 71(ptr) AccessChain 31(data) 670 63 + 677: 25(ivec4) Load 676 + 678: 25(ivec4) VectorShuffle 677 675 4 5 6 3 + Store 676 678 + 679: 6(int) Load 8(invocation) + 680: 71(ptr) AccessChain 31(data) 115 63 + 681: 25(ivec4) Load 680 + 682: 17(ivec4) Load 19(ballot) + 683: 25(ivec4) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 681 682 + 684: 71(ptr) AccessChain 31(data) 679 63 + Store 684 683 + 685: 6(int) Load 8(invocation) + 686: 90(ptr) AccessChain 31(data) 34 33 35 + 687: 6(int) Load 686 + 688: 17(ivec4) Load 19(ballot) + 689: 6(int) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 687 688 + 690: 90(ptr) AccessChain 31(data) 685 33 35 + Store 690 689 + 691: 6(int) Load 8(invocation) + 692: 40(ptr) AccessChain 31(data) 63 33 + 693: 17(ivec4) Load 692 + 694: 96(ivec2) VectorShuffle 693 693 0 1 + 695: 17(ivec4) Load 19(ballot) + 696: 96(ivec2) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 694 695 + 697: 40(ptr) AccessChain 31(data) 691 33 + 698: 17(ivec4) Load 697 + 699: 17(ivec4) VectorShuffle 698 696 4 5 2 3 + Store 697 699 + 700: 6(int) Load 8(invocation) + 701: 40(ptr) AccessChain 31(data) 33 33 + 702: 17(ivec4) Load 701 + 703: 103(ivec3) VectorShuffle 702 702 0 1 2 + 704: 17(ivec4) Load 19(ballot) + 705: 103(ivec3) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 703 704 + 706: 40(ptr) AccessChain 31(data) 700 33 + 707: 17(ivec4) Load 706 + 708: 17(ivec4) VectorShuffle 707 705 4 5 6 3 + Store 706 708 + 709: 6(int) Load 8(invocation) + 710: 40(ptr) AccessChain 31(data) 115 33 + 711: 17(ivec4) Load 710 + 712: 17(ivec4) Load 19(ballot) + 713: 17(ivec4) GroupNonUniformBitwiseAnd 178 PartitionedReduceNV 711 712 + 714: 40(ptr) AccessChain 31(data) 709 33 + Store 714 713 + 715: 6(int) Load 8(invocation) + 716: 64(ptr) AccessChain 31(data) 34 63 35 + 717: 24(int) Load 716 + 718: 144(bool) SLessThan 717 34 + 719: 17(ivec4) Load 19(ballot) + 720: 144(bool) GroupNonUniformLogicalAnd 178 PartitionedReduceNV 718 719 + 721: 24(int) Select 720 63 34 + 722: 64(ptr) AccessChain 31(data) 715 63 35 + Store 722 721 + 723: 6(int) Load 8(invocation) + 724: 71(ptr) AccessChain 31(data) 63 63 + 725: 25(ivec4) Load 724 + 726: 70(ivec2) VectorShuffle 725 725 0 1 + 728: 152(bvec2) SLessThan 726 727 + 729: 17(ivec4) Load 19(ballot) + 730: 152(bvec2) GroupNonUniformLogicalAnd 178 PartitionedReduceNV 728 729 + 732: 70(ivec2) Select 730 731 727 + 733: 71(ptr) AccessChain 31(data) 723 63 + 734: 25(ivec4) Load 733 + 735: 25(ivec4) VectorShuffle 734 732 4 5 2 3 + Store 733 735 + 736: 6(int) Load 8(invocation) + 737: 71(ptr) AccessChain 31(data) 63 63 + 738: 25(ivec4) Load 737 + 739: 78(ivec3) VectorShuffle 738 738 0 1 2 + 741: 161(bvec3) SLessThan 739 740 + 742: 17(ivec4) Load 19(ballot) + 743: 161(bvec3) GroupNonUniformLogicalAnd 178 PartitionedReduceNV 741 742 + 745: 78(ivec3) Select 743 744 740 + 746: 71(ptr) AccessChain 31(data) 736 63 + 747: 25(ivec4) Load 746 + 748: 25(ivec4) VectorShuffle 747 745 4 5 6 3 + Store 746 748 + 749: 6(int) Load 8(invocation) + 750: 71(ptr) AccessChain 31(data) 63 63 + 751: 25(ivec4) Load 750 + 753: 169(bvec4) SLessThan 751 752 + 754: 17(ivec4) Load 19(ballot) + 755: 169(bvec4) GroupNonUniformLogicalAnd 178 PartitionedReduceNV 753 754 + 757: 25(ivec4) Select 755 756 752 + 758: 71(ptr) AccessChain 31(data) 749 63 + Store 758 757 + 759: 6(int) Load 8(invocation) + 760: 64(ptr) AccessChain 31(data) 34 63 35 + 761: 24(int) Load 760 + 762: 17(ivec4) Load 19(ballot) + 763: 24(int) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 761 762 + 764: 64(ptr) AccessChain 31(data) 759 63 35 + Store 764 763 + 765: 6(int) Load 8(invocation) + 766: 71(ptr) AccessChain 31(data) 63 63 + 767: 25(ivec4) Load 766 + 768: 70(ivec2) VectorShuffle 767 767 0 1 + 769: 17(ivec4) Load 19(ballot) + 770: 70(ivec2) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 768 769 + 771: 71(ptr) AccessChain 31(data) 765 63 + 772: 25(ivec4) Load 771 + 773: 25(ivec4) VectorShuffle 772 770 4 5 2 3 + Store 771 773 + 774: 6(int) Load 8(invocation) + 775: 71(ptr) AccessChain 31(data) 33 63 + 776: 25(ivec4) Load 775 + 777: 78(ivec3) VectorShuffle 776 776 0 1 2 + 778: 17(ivec4) Load 19(ballot) + 779: 78(ivec3) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 777 778 + 780: 71(ptr) AccessChain 31(data) 774 63 + 781: 25(ivec4) Load 780 + 782: 25(ivec4) VectorShuffle 781 779 4 5 6 3 + Store 780 782 + 783: 6(int) Load 8(invocation) + 784: 71(ptr) AccessChain 31(data) 115 63 + 785: 25(ivec4) Load 784 + 786: 17(ivec4) Load 19(ballot) + 787: 25(ivec4) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 785 786 + 788: 71(ptr) AccessChain 31(data) 783 63 + Store 788 787 + 789: 6(int) Load 8(invocation) + 790: 90(ptr) AccessChain 31(data) 34 33 35 + 791: 6(int) Load 790 + 792: 17(ivec4) Load 19(ballot) + 793: 6(int) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 791 792 + 794: 90(ptr) AccessChain 31(data) 789 33 35 + Store 794 793 + 795: 6(int) Load 8(invocation) + 796: 40(ptr) AccessChain 31(data) 63 33 + 797: 17(ivec4) Load 796 + 798: 96(ivec2) VectorShuffle 797 797 0 1 + 799: 17(ivec4) Load 19(ballot) + 800: 96(ivec2) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 798 799 + 801: 40(ptr) AccessChain 31(data) 795 33 + 802: 17(ivec4) Load 801 + 803: 17(ivec4) VectorShuffle 802 800 4 5 2 3 + Store 801 803 + 804: 6(int) Load 8(invocation) + 805: 40(ptr) AccessChain 31(data) 33 33 + 806: 17(ivec4) Load 805 + 807: 103(ivec3) VectorShuffle 806 806 0 1 2 + 808: 17(ivec4) Load 19(ballot) + 809: 103(ivec3) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 807 808 + 810: 40(ptr) AccessChain 31(data) 804 33 + 811: 17(ivec4) Load 810 + 812: 17(ivec4) VectorShuffle 811 809 4 5 6 3 + Store 810 812 + 813: 6(int) Load 8(invocation) + 814: 40(ptr) AccessChain 31(data) 115 33 + 815: 17(ivec4) Load 814 + 816: 17(ivec4) Load 19(ballot) + 817: 17(ivec4) GroupNonUniformBitwiseOr 178 PartitionedReduceNV 815 816 + 818: 40(ptr) AccessChain 31(data) 813 33 + Store 818 817 + 819: 6(int) Load 8(invocation) + 820: 64(ptr) AccessChain 31(data) 34 63 35 + 821: 24(int) Load 820 + 822: 144(bool) SLessThan 821 34 + 823: 17(ivec4) Load 19(ballot) + 824: 144(bool) GroupNonUniformLogicalOr 178 PartitionedReduceNV 822 823 + 825: 24(int) Select 824 63 34 + 826: 64(ptr) AccessChain 31(data) 819 63 35 + Store 826 825 + 827: 6(int) Load 8(invocation) + 828: 71(ptr) AccessChain 31(data) 63 63 + 829: 25(ivec4) Load 828 + 830: 70(ivec2) VectorShuffle 829 829 0 1 + 831: 152(bvec2) SLessThan 830 727 + 832: 17(ivec4) Load 19(ballot) + 833: 152(bvec2) GroupNonUniformLogicalOr 178 PartitionedReduceNV 831 832 + 834: 70(ivec2) Select 833 731 727 + 835: 71(ptr) AccessChain 31(data) 827 63 + 836: 25(ivec4) Load 835 + 837: 25(ivec4) VectorShuffle 836 834 4 5 2 3 + Store 835 837 + 838: 6(int) Load 8(invocation) + 839: 71(ptr) AccessChain 31(data) 63 63 + 840: 25(ivec4) Load 839 + 841: 78(ivec3) VectorShuffle 840 840 0 1 2 + 842: 161(bvec3) SLessThan 841 740 + 843: 17(ivec4) Load 19(ballot) + 844: 161(bvec3) GroupNonUniformLogicalOr 178 PartitionedReduceNV 842 843 + 845: 78(ivec3) Select 844 744 740 + 846: 71(ptr) AccessChain 31(data) 838 63 + 847: 25(ivec4) Load 846 + 848: 25(ivec4) VectorShuffle 847 845 4 5 6 3 + Store 846 848 + 849: 6(int) Load 8(invocation) + 850: 71(ptr) AccessChain 31(data) 63 63 + 851: 25(ivec4) Load 850 + 852: 169(bvec4) SLessThan 851 752 + 853: 17(ivec4) Load 19(ballot) + 854: 169(bvec4) GroupNonUniformLogicalOr 178 PartitionedReduceNV 852 853 + 855: 25(ivec4) Select 854 756 752 + 856: 71(ptr) AccessChain 31(data) 849 63 + Store 856 855 + 857: 6(int) Load 8(invocation) + 858: 64(ptr) AccessChain 31(data) 34 63 35 + 859: 24(int) Load 858 + 860: 17(ivec4) Load 19(ballot) + 861: 24(int) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 859 860 + 862: 64(ptr) AccessChain 31(data) 857 63 35 + Store 862 861 + 863: 6(int) Load 8(invocation) + 864: 71(ptr) AccessChain 31(data) 63 63 + 865: 25(ivec4) Load 864 + 866: 70(ivec2) VectorShuffle 865 865 0 1 + 867: 17(ivec4) Load 19(ballot) + 868: 70(ivec2) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 866 867 + 869: 71(ptr) AccessChain 31(data) 863 63 + 870: 25(ivec4) Load 869 + 871: 25(ivec4) VectorShuffle 870 868 4 5 2 3 + Store 869 871 + 872: 6(int) Load 8(invocation) + 873: 71(ptr) AccessChain 31(data) 33 63 + 874: 25(ivec4) Load 873 + 875: 78(ivec3) VectorShuffle 874 874 0 1 2 + 876: 17(ivec4) Load 19(ballot) + 877: 78(ivec3) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 875 876 + 878: 71(ptr) AccessChain 31(data) 872 63 + 879: 25(ivec4) Load 878 + 880: 25(ivec4) VectorShuffle 879 877 4 5 6 3 + Store 878 880 + 881: 6(int) Load 8(invocation) + 882: 71(ptr) AccessChain 31(data) 115 63 + 883: 25(ivec4) Load 882 + 884: 17(ivec4) Load 19(ballot) + 885: 25(ivec4) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 883 884 + 886: 71(ptr) AccessChain 31(data) 881 63 + Store 886 885 + 887: 6(int) Load 8(invocation) + 888: 90(ptr) AccessChain 31(data) 34 33 35 + 889: 6(int) Load 888 + 890: 17(ivec4) Load 19(ballot) + 891: 6(int) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 889 890 + 892: 90(ptr) AccessChain 31(data) 887 33 35 + Store 892 891 + 893: 6(int) Load 8(invocation) + 894: 40(ptr) AccessChain 31(data) 63 33 + 895: 17(ivec4) Load 894 + 896: 96(ivec2) VectorShuffle 895 895 0 1 + 897: 17(ivec4) Load 19(ballot) + 898: 96(ivec2) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 896 897 + 899: 40(ptr) AccessChain 31(data) 893 33 + 900: 17(ivec4) Load 899 + 901: 17(ivec4) VectorShuffle 900 898 4 5 2 3 + Store 899 901 + 902: 6(int) Load 8(invocation) + 903: 40(ptr) AccessChain 31(data) 33 33 + 904: 17(ivec4) Load 903 + 905: 103(ivec3) VectorShuffle 904 904 0 1 2 + 906: 17(ivec4) Load 19(ballot) + 907: 103(ivec3) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 905 906 + 908: 40(ptr) AccessChain 31(data) 902 33 + 909: 17(ivec4) Load 908 + 910: 17(ivec4) VectorShuffle 909 907 4 5 6 3 + Store 908 910 + 911: 6(int) Load 8(invocation) + 912: 40(ptr) AccessChain 31(data) 115 33 + 913: 17(ivec4) Load 912 + 914: 17(ivec4) Load 19(ballot) + 915: 17(ivec4) GroupNonUniformBitwiseXor 178 PartitionedReduceNV 913 914 + 916: 40(ptr) AccessChain 31(data) 911 33 + Store 916 915 + 917: 6(int) Load 8(invocation) + 918: 64(ptr) AccessChain 31(data) 34 63 35 + 919: 24(int) Load 918 + 920: 144(bool) SLessThan 919 34 + 921: 17(ivec4) Load 19(ballot) + 922: 144(bool) GroupNonUniformLogicalXor 178 PartitionedReduceNV 920 921 + 923: 24(int) Select 922 63 34 + 924: 64(ptr) AccessChain 31(data) 917 63 35 + Store 924 923 + 925: 6(int) Load 8(invocation) + 926: 71(ptr) AccessChain 31(data) 63 63 + 927: 25(ivec4) Load 926 + 928: 70(ivec2) VectorShuffle 927 927 0 1 + 929: 152(bvec2) SLessThan 928 727 + 930: 17(ivec4) Load 19(ballot) + 931: 152(bvec2) GroupNonUniformLogicalXor 178 PartitionedReduceNV 929 930 + 932: 70(ivec2) Select 931 731 727 + 933: 71(ptr) AccessChain 31(data) 925 63 + 934: 25(ivec4) Load 933 + 935: 25(ivec4) VectorShuffle 934 932 4 5 2 3 + Store 933 935 + 936: 6(int) Load 8(invocation) + 937: 71(ptr) AccessChain 31(data) 63 63 + 938: 25(ivec4) Load 937 + 939: 78(ivec3) VectorShuffle 938 938 0 1 2 + 940: 161(bvec3) SLessThan 939 740 + 941: 17(ivec4) Load 19(ballot) + 942: 161(bvec3) GroupNonUniformLogicalXor 178 PartitionedReduceNV 940 941 + 943: 78(ivec3) Select 942 744 740 + 944: 71(ptr) AccessChain 31(data) 936 63 + 945: 25(ivec4) Load 944 + 946: 25(ivec4) VectorShuffle 945 943 4 5 6 3 + Store 944 946 + 947: 6(int) Load 8(invocation) + 948: 71(ptr) AccessChain 31(data) 63 63 + 949: 25(ivec4) Load 948 + 950: 169(bvec4) SLessThan 949 752 + 951: 17(ivec4) Load 19(ballot) + 952: 169(bvec4) GroupNonUniformLogicalXor 178 PartitionedReduceNV 950 951 + 953: 25(ivec4) Select 952 756 752 + 954: 71(ptr) AccessChain 31(data) 947 63 + Store 954 953 + 955: 6(int) Load 8(invocation) + 956: 36(ptr) AccessChain 31(data) 34 34 35 + 957: 22(float) Load 956 + 958: 17(ivec4) Load 19(ballot) + 959: 22(float) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 957 958 + 960: 36(ptr) AccessChain 31(data) 955 34 35 + Store 960 959 + 961: 6(int) Load 8(invocation) + 962: 44(ptr) AccessChain 31(data) 63 34 + 963: 23(fvec4) Load 962 + 964: 43(fvec2) VectorShuffle 963 963 0 1 + 965: 17(ivec4) Load 19(ballot) + 966: 43(fvec2) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 964 965 + 967: 44(ptr) AccessChain 31(data) 961 34 + 968: 23(fvec4) Load 967 + 969: 23(fvec4) VectorShuffle 968 966 4 5 2 3 + Store 967 969 + 970: 6(int) Load 8(invocation) + 971: 44(ptr) AccessChain 31(data) 33 34 + 972: 23(fvec4) Load 971 + 973: 51(fvec3) VectorShuffle 972 972 0 1 2 + 974: 17(ivec4) Load 19(ballot) + 975: 51(fvec3) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 973 974 + 976: 44(ptr) AccessChain 31(data) 970 34 + 977: 23(fvec4) Load 976 + 978: 23(fvec4) VectorShuffle 977 975 4 5 6 3 + Store 976 978 + 979: 6(int) Load 8(invocation) + 980: 44(ptr) AccessChain 31(data) 115 34 + 981: 23(fvec4) Load 980 + 982: 17(ivec4) Load 19(ballot) + 983: 23(fvec4) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 981 982 + 984: 44(ptr) AccessChain 31(data) 979 34 + Store 984 983 + 985: 6(int) Load 8(invocation) + 986: 64(ptr) AccessChain 31(data) 34 63 35 + 987: 24(int) Load 986 + 988: 17(ivec4) Load 19(ballot) + 989: 24(int) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 987 988 + 990: 64(ptr) AccessChain 31(data) 985 63 35 + Store 990 989 + 991: 6(int) Load 8(invocation) + 992: 71(ptr) AccessChain 31(data) 63 63 + 993: 25(ivec4) Load 992 + 994: 70(ivec2) VectorShuffle 993 993 0 1 + 995: 17(ivec4) Load 19(ballot) + 996: 70(ivec2) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 994 995 + 997: 71(ptr) AccessChain 31(data) 991 63 + 998: 25(ivec4) Load 997 + 999: 25(ivec4) VectorShuffle 998 996 4 5 2 3 + Store 997 999 + 1000: 6(int) Load 8(invocation) + 1001: 71(ptr) AccessChain 31(data) 33 63 + 1002: 25(ivec4) Load 1001 + 1003: 78(ivec3) VectorShuffle 1002 1002 0 1 2 + 1004: 17(ivec4) Load 19(ballot) + 1005: 78(ivec3) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 1003 1004 + 1006: 71(ptr) AccessChain 31(data) 1000 63 + 1007: 25(ivec4) Load 1006 + 1008: 25(ivec4) VectorShuffle 1007 1005 4 5 6 3 + Store 1006 1008 + 1009: 6(int) Load 8(invocation) + 1010: 71(ptr) AccessChain 31(data) 115 63 + 1011: 25(ivec4) Load 1010 + 1012: 17(ivec4) Load 19(ballot) + 1013: 25(ivec4) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 1011 1012 + 1014: 71(ptr) AccessChain 31(data) 1009 63 + Store 1014 1013 + 1015: 6(int) Load 8(invocation) + 1016: 90(ptr) AccessChain 31(data) 34 33 35 + 1017: 6(int) Load 1016 + 1018: 17(ivec4) Load 19(ballot) + 1019: 6(int) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 1017 1018 + 1020: 90(ptr) AccessChain 31(data) 1015 33 35 + Store 1020 1019 + 1021: 6(int) Load 8(invocation) + 1022: 40(ptr) AccessChain 31(data) 63 33 + 1023: 17(ivec4) Load 1022 + 1024: 96(ivec2) VectorShuffle 1023 1023 0 1 + 1025: 17(ivec4) Load 19(ballot) + 1026: 96(ivec2) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 1024 1025 + 1027: 40(ptr) AccessChain 31(data) 1021 33 + 1028: 17(ivec4) Load 1027 + 1029: 17(ivec4) VectorShuffle 1028 1026 4 5 2 3 + Store 1027 1029 + 1030: 6(int) Load 8(invocation) + 1031: 40(ptr) AccessChain 31(data) 33 33 + 1032: 17(ivec4) Load 1031 + 1033: 103(ivec3) VectorShuffle 1032 1032 0 1 2 + 1034: 17(ivec4) Load 19(ballot) + 1035: 103(ivec3) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 1033 1034 + 1036: 40(ptr) AccessChain 31(data) 1030 33 + 1037: 17(ivec4) Load 1036 + 1038: 17(ivec4) VectorShuffle 1037 1035 4 5 6 3 + Store 1036 1038 + 1039: 6(int) Load 8(invocation) + 1040: 40(ptr) AccessChain 31(data) 115 33 + 1041: 17(ivec4) Load 1040 + 1042: 17(ivec4) Load 19(ballot) + 1043: 17(ivec4) GroupNonUniformIAdd 178 PartitionedInclusiveScanNV 1041 1042 + 1044: 40(ptr) AccessChain 31(data) 1039 33 + Store 1044 1043 + 1045: 6(int) Load 8(invocation) + 1046: 116(ptr) AccessChain 31(data) 34 115 35 + 1047:26(float64_t) Load 1046 + 1048: 17(ivec4) Load 19(ballot) + 1049:26(float64_t) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 1047 1048 + 1050: 116(ptr) AccessChain 31(data) 1045 115 35 + Store 1050 1049 + 1051: 6(int) Load 8(invocation) + 1052: 123(ptr) AccessChain 31(data) 63 115 + 1053: 27(f64vec4) Load 1052 + 1054:122(f64vec2) VectorShuffle 1053 1053 0 1 + 1055: 17(ivec4) Load 19(ballot) + 1056:122(f64vec2) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 1054 1055 + 1057: 123(ptr) AccessChain 31(data) 1051 115 + 1058: 27(f64vec4) Load 1057 + 1059: 27(f64vec4) VectorShuffle 1058 1056 4 5 2 3 + Store 1057 1059 + 1060: 6(int) Load 8(invocation) + 1061: 123(ptr) AccessChain 31(data) 33 115 + 1062: 27(f64vec4) Load 1061 + 1063:130(f64vec3) VectorShuffle 1062 1062 0 1 2 + 1064: 17(ivec4) Load 19(ballot) + 1065:130(f64vec3) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 1063 1064 + 1066: 123(ptr) AccessChain 31(data) 1060 115 + 1067: 27(f64vec4) Load 1066 + 1068: 27(f64vec4) VectorShuffle 1067 1065 4 5 6 3 + Store 1066 1068 + 1069: 6(int) Load 8(invocation) + 1070: 123(ptr) AccessChain 31(data) 115 115 + 1071: 27(f64vec4) Load 1070 + 1072: 17(ivec4) Load 19(ballot) + 1073: 27(f64vec4) GroupNonUniformFAdd 178 PartitionedInclusiveScanNV 1071 1072 + 1074: 123(ptr) AccessChain 31(data) 1069 115 + Store 1074 1073 + 1075: 6(int) Load 8(invocation) + 1076: 36(ptr) AccessChain 31(data) 34 34 35 + 1077: 22(float) Load 1076 + 1078: 17(ivec4) Load 19(ballot) + 1079: 22(float) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1077 1078 + 1080: 36(ptr) AccessChain 31(data) 1075 34 35 + Store 1080 1079 + 1081: 6(int) Load 8(invocation) + 1082: 44(ptr) AccessChain 31(data) 63 34 + 1083: 23(fvec4) Load 1082 + 1084: 43(fvec2) VectorShuffle 1083 1083 0 1 + 1085: 17(ivec4) Load 19(ballot) + 1086: 43(fvec2) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1084 1085 + 1087: 44(ptr) AccessChain 31(data) 1081 34 + 1088: 23(fvec4) Load 1087 + 1089: 23(fvec4) VectorShuffle 1088 1086 4 5 2 3 + Store 1087 1089 + 1090: 6(int) Load 8(invocation) + 1091: 44(ptr) AccessChain 31(data) 33 34 + 1092: 23(fvec4) Load 1091 + 1093: 51(fvec3) VectorShuffle 1092 1092 0 1 2 + 1094: 17(ivec4) Load 19(ballot) + 1095: 51(fvec3) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1093 1094 + 1096: 44(ptr) AccessChain 31(data) 1090 34 + 1097: 23(fvec4) Load 1096 + 1098: 23(fvec4) VectorShuffle 1097 1095 4 5 6 3 + Store 1096 1098 + 1099: 6(int) Load 8(invocation) + 1100: 44(ptr) AccessChain 31(data) 115 34 + 1101: 23(fvec4) Load 1100 + 1102: 17(ivec4) Load 19(ballot) + 1103: 23(fvec4) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1101 1102 + 1104: 44(ptr) AccessChain 31(data) 1099 34 + Store 1104 1103 + 1105: 6(int) Load 8(invocation) + 1106: 64(ptr) AccessChain 31(data) 34 63 35 + 1107: 24(int) Load 1106 + 1108: 17(ivec4) Load 19(ballot) + 1109: 24(int) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1107 1108 + 1110: 64(ptr) AccessChain 31(data) 1105 63 35 + Store 1110 1109 + 1111: 6(int) Load 8(invocation) + 1112: 71(ptr) AccessChain 31(data) 63 63 + 1113: 25(ivec4) Load 1112 + 1114: 70(ivec2) VectorShuffle 1113 1113 0 1 + 1115: 17(ivec4) Load 19(ballot) + 1116: 70(ivec2) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1114 1115 + 1117: 71(ptr) AccessChain 31(data) 1111 63 + 1118: 25(ivec4) Load 1117 + 1119: 25(ivec4) VectorShuffle 1118 1116 4 5 2 3 + Store 1117 1119 + 1120: 6(int) Load 8(invocation) + 1121: 71(ptr) AccessChain 31(data) 33 63 + 1122: 25(ivec4) Load 1121 + 1123: 78(ivec3) VectorShuffle 1122 1122 0 1 2 + 1124: 17(ivec4) Load 19(ballot) + 1125: 78(ivec3) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1123 1124 + 1126: 71(ptr) AccessChain 31(data) 1120 63 + 1127: 25(ivec4) Load 1126 + 1128: 25(ivec4) VectorShuffle 1127 1125 4 5 6 3 + Store 1126 1128 + 1129: 6(int) Load 8(invocation) + 1130: 71(ptr) AccessChain 31(data) 115 63 + 1131: 25(ivec4) Load 1130 + 1132: 17(ivec4) Load 19(ballot) + 1133: 25(ivec4) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1131 1132 + 1134: 71(ptr) AccessChain 31(data) 1129 63 + Store 1134 1133 + 1135: 6(int) Load 8(invocation) + 1136: 90(ptr) AccessChain 31(data) 34 33 35 + 1137: 6(int) Load 1136 + 1138: 17(ivec4) Load 19(ballot) + 1139: 6(int) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1137 1138 + 1140: 90(ptr) AccessChain 31(data) 1135 33 35 + Store 1140 1139 + 1141: 6(int) Load 8(invocation) + 1142: 40(ptr) AccessChain 31(data) 63 33 + 1143: 17(ivec4) Load 1142 + 1144: 96(ivec2) VectorShuffle 1143 1143 0 1 + 1145: 17(ivec4) Load 19(ballot) + 1146: 96(ivec2) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1144 1145 + 1147: 40(ptr) AccessChain 31(data) 1141 33 + 1148: 17(ivec4) Load 1147 + 1149: 17(ivec4) VectorShuffle 1148 1146 4 5 2 3 + Store 1147 1149 + 1150: 6(int) Load 8(invocation) + 1151: 40(ptr) AccessChain 31(data) 33 33 + 1152: 17(ivec4) Load 1151 + 1153: 103(ivec3) VectorShuffle 1152 1152 0 1 2 + 1154: 17(ivec4) Load 19(ballot) + 1155: 103(ivec3) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1153 1154 + 1156: 40(ptr) AccessChain 31(data) 1150 33 + 1157: 17(ivec4) Load 1156 + 1158: 17(ivec4) VectorShuffle 1157 1155 4 5 6 3 + Store 1156 1158 + 1159: 6(int) Load 8(invocation) + 1160: 40(ptr) AccessChain 31(data) 115 33 + 1161: 17(ivec4) Load 1160 + 1162: 17(ivec4) Load 19(ballot) + 1163: 17(ivec4) GroupNonUniformIMul 178 PartitionedInclusiveScanNV 1161 1162 + 1164: 40(ptr) AccessChain 31(data) 1159 33 + Store 1164 1163 + 1165: 6(int) Load 8(invocation) + 1166: 116(ptr) AccessChain 31(data) 34 115 35 + 1167:26(float64_t) Load 1166 + 1168: 17(ivec4) Load 19(ballot) + 1169:26(float64_t) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1167 1168 + 1170: 116(ptr) AccessChain 31(data) 1165 115 35 + Store 1170 1169 + 1171: 6(int) Load 8(invocation) + 1172: 123(ptr) AccessChain 31(data) 63 115 + 1173: 27(f64vec4) Load 1172 + 1174:122(f64vec2) VectorShuffle 1173 1173 0 1 + 1175: 17(ivec4) Load 19(ballot) + 1176:122(f64vec2) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1174 1175 + 1177: 123(ptr) AccessChain 31(data) 1171 115 + 1178: 27(f64vec4) Load 1177 + 1179: 27(f64vec4) VectorShuffle 1178 1176 4 5 2 3 + Store 1177 1179 + 1180: 6(int) Load 8(invocation) + 1181: 123(ptr) AccessChain 31(data) 33 115 + 1182: 27(f64vec4) Load 1181 + 1183:130(f64vec3) VectorShuffle 1182 1182 0 1 2 + 1184: 17(ivec4) Load 19(ballot) + 1185:130(f64vec3) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1183 1184 + 1186: 123(ptr) AccessChain 31(data) 1180 115 + 1187: 27(f64vec4) Load 1186 + 1188: 27(f64vec4) VectorShuffle 1187 1185 4 5 6 3 + Store 1186 1188 + 1189: 6(int) Load 8(invocation) + 1190: 123(ptr) AccessChain 31(data) 115 115 + 1191: 27(f64vec4) Load 1190 + 1192: 17(ivec4) Load 19(ballot) + 1193: 27(f64vec4) GroupNonUniformFMul 178 PartitionedInclusiveScanNV 1191 1192 + 1194: 123(ptr) AccessChain 31(data) 1189 115 + Store 1194 1193 + 1195: 6(int) Load 8(invocation) + 1196: 36(ptr) AccessChain 31(data) 34 34 35 + 1197: 22(float) Load 1196 + 1198: 17(ivec4) Load 19(ballot) + 1199: 22(float) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1197 1198 + 1200: 36(ptr) AccessChain 31(data) 1195 34 35 + Store 1200 1199 + 1201: 6(int) Load 8(invocation) + 1202: 44(ptr) AccessChain 31(data) 63 34 + 1203: 23(fvec4) Load 1202 + 1204: 43(fvec2) VectorShuffle 1203 1203 0 1 + 1205: 17(ivec4) Load 19(ballot) + 1206: 43(fvec2) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1204 1205 + 1207: 44(ptr) AccessChain 31(data) 1201 34 + 1208: 23(fvec4) Load 1207 + 1209: 23(fvec4) VectorShuffle 1208 1206 4 5 2 3 + Store 1207 1209 + 1210: 6(int) Load 8(invocation) + 1211: 44(ptr) AccessChain 31(data) 33 34 + 1212: 23(fvec4) Load 1211 + 1213: 51(fvec3) VectorShuffle 1212 1212 0 1 2 + 1214: 17(ivec4) Load 19(ballot) + 1215: 51(fvec3) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1213 1214 + 1216: 44(ptr) AccessChain 31(data) 1210 34 + 1217: 23(fvec4) Load 1216 + 1218: 23(fvec4) VectorShuffle 1217 1215 4 5 6 3 + Store 1216 1218 + 1219: 6(int) Load 8(invocation) + 1220: 44(ptr) AccessChain 31(data) 115 34 + 1221: 23(fvec4) Load 1220 + 1222: 17(ivec4) Load 19(ballot) + 1223: 23(fvec4) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1221 1222 + 1224: 44(ptr) AccessChain 31(data) 1219 34 + Store 1224 1223 + 1225: 6(int) Load 8(invocation) + 1226: 64(ptr) AccessChain 31(data) 34 63 35 + 1227: 24(int) Load 1226 + 1228: 17(ivec4) Load 19(ballot) + 1229: 24(int) GroupNonUniformSMin 178 PartitionedInclusiveScanNV 1227 1228 + 1230: 64(ptr) AccessChain 31(data) 1225 63 35 + Store 1230 1229 + 1231: 6(int) Load 8(invocation) + 1232: 71(ptr) AccessChain 31(data) 63 63 + 1233: 25(ivec4) Load 1232 + 1234: 70(ivec2) VectorShuffle 1233 1233 0 1 + 1235: 17(ivec4) Load 19(ballot) + 1236: 70(ivec2) GroupNonUniformSMin 178 PartitionedInclusiveScanNV 1234 1235 + 1237: 71(ptr) AccessChain 31(data) 1231 63 + 1238: 25(ivec4) Load 1237 + 1239: 25(ivec4) VectorShuffle 1238 1236 4 5 2 3 + Store 1237 1239 + 1240: 6(int) Load 8(invocation) + 1241: 71(ptr) AccessChain 31(data) 33 63 + 1242: 25(ivec4) Load 1241 + 1243: 78(ivec3) VectorShuffle 1242 1242 0 1 2 + 1244: 17(ivec4) Load 19(ballot) + 1245: 78(ivec3) GroupNonUniformSMin 178 PartitionedInclusiveScanNV 1243 1244 + 1246: 71(ptr) AccessChain 31(data) 1240 63 + 1247: 25(ivec4) Load 1246 + 1248: 25(ivec4) VectorShuffle 1247 1245 4 5 6 3 + Store 1246 1248 + 1249: 6(int) Load 8(invocation) + 1250: 71(ptr) AccessChain 31(data) 115 63 + 1251: 25(ivec4) Load 1250 + 1252: 17(ivec4) Load 19(ballot) + 1253: 25(ivec4) GroupNonUniformSMin 178 PartitionedInclusiveScanNV 1251 1252 + 1254: 71(ptr) AccessChain 31(data) 1249 63 + Store 1254 1253 + 1255: 6(int) Load 8(invocation) + 1256: 90(ptr) AccessChain 31(data) 34 33 35 + 1257: 6(int) Load 1256 + 1258: 17(ivec4) Load 19(ballot) + 1259: 6(int) GroupNonUniformUMin 178 PartitionedInclusiveScanNV 1257 1258 + 1260: 90(ptr) AccessChain 31(data) 1255 33 35 + Store 1260 1259 + 1261: 6(int) Load 8(invocation) + 1262: 40(ptr) AccessChain 31(data) 63 33 + 1263: 17(ivec4) Load 1262 + 1264: 96(ivec2) VectorShuffle 1263 1263 0 1 + 1265: 17(ivec4) Load 19(ballot) + 1266: 96(ivec2) GroupNonUniformUMin 178 PartitionedInclusiveScanNV 1264 1265 + 1267: 40(ptr) AccessChain 31(data) 1261 33 + 1268: 17(ivec4) Load 1267 + 1269: 17(ivec4) VectorShuffle 1268 1266 4 5 2 3 + Store 1267 1269 + 1270: 6(int) Load 8(invocation) + 1271: 40(ptr) AccessChain 31(data) 33 33 + 1272: 17(ivec4) Load 1271 + 1273: 103(ivec3) VectorShuffle 1272 1272 0 1 2 + 1274: 17(ivec4) Load 19(ballot) + 1275: 103(ivec3) GroupNonUniformUMin 178 PartitionedInclusiveScanNV 1273 1274 + 1276: 40(ptr) AccessChain 31(data) 1270 33 + 1277: 17(ivec4) Load 1276 + 1278: 17(ivec4) VectorShuffle 1277 1275 4 5 6 3 + Store 1276 1278 + 1279: 6(int) Load 8(invocation) + 1280: 40(ptr) AccessChain 31(data) 115 33 + 1281: 17(ivec4) Load 1280 + 1282: 17(ivec4) Load 19(ballot) + 1283: 17(ivec4) GroupNonUniformUMin 178 PartitionedInclusiveScanNV 1281 1282 + 1284: 40(ptr) AccessChain 31(data) 1279 33 + Store 1284 1283 + 1285: 6(int) Load 8(invocation) + 1286: 116(ptr) AccessChain 31(data) 34 115 35 + 1287:26(float64_t) Load 1286 + 1288: 17(ivec4) Load 19(ballot) + 1289:26(float64_t) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1287 1288 + 1290: 116(ptr) AccessChain 31(data) 1285 115 35 + Store 1290 1289 + 1291: 6(int) Load 8(invocation) + 1292: 123(ptr) AccessChain 31(data) 63 115 + 1293: 27(f64vec4) Load 1292 + 1294:122(f64vec2) VectorShuffle 1293 1293 0 1 + 1295: 17(ivec4) Load 19(ballot) + 1296:122(f64vec2) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1294 1295 + 1297: 123(ptr) AccessChain 31(data) 1291 115 + 1298: 27(f64vec4) Load 1297 + 1299: 27(f64vec4) VectorShuffle 1298 1296 4 5 2 3 + Store 1297 1299 + 1300: 6(int) Load 8(invocation) + 1301: 123(ptr) AccessChain 31(data) 33 115 + 1302: 27(f64vec4) Load 1301 + 1303:130(f64vec3) VectorShuffle 1302 1302 0 1 2 + 1304: 17(ivec4) Load 19(ballot) + 1305:130(f64vec3) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1303 1304 + 1306: 123(ptr) AccessChain 31(data) 1300 115 + 1307: 27(f64vec4) Load 1306 + 1308: 27(f64vec4) VectorShuffle 1307 1305 4 5 6 3 + Store 1306 1308 + 1309: 6(int) Load 8(invocation) + 1310: 123(ptr) AccessChain 31(data) 115 115 + 1311: 27(f64vec4) Load 1310 + 1312: 17(ivec4) Load 19(ballot) + 1313: 27(f64vec4) GroupNonUniformFMin 178 PartitionedInclusiveScanNV 1311 1312 + 1314: 123(ptr) AccessChain 31(data) 1309 115 + Store 1314 1313 + 1315: 6(int) Load 8(invocation) + 1316: 36(ptr) AccessChain 31(data) 34 34 35 + 1317: 22(float) Load 1316 + 1318: 17(ivec4) Load 19(ballot) + 1319: 22(float) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1317 1318 + 1320: 36(ptr) AccessChain 31(data) 1315 34 35 + Store 1320 1319 + 1321: 6(int) Load 8(invocation) + 1322: 44(ptr) AccessChain 31(data) 63 34 + 1323: 23(fvec4) Load 1322 + 1324: 43(fvec2) VectorShuffle 1323 1323 0 1 + 1325: 17(ivec4) Load 19(ballot) + 1326: 43(fvec2) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1324 1325 + 1327: 44(ptr) AccessChain 31(data) 1321 34 + 1328: 23(fvec4) Load 1327 + 1329: 23(fvec4) VectorShuffle 1328 1326 4 5 2 3 + Store 1327 1329 + 1330: 6(int) Load 8(invocation) + 1331: 44(ptr) AccessChain 31(data) 33 34 + 1332: 23(fvec4) Load 1331 + 1333: 51(fvec3) VectorShuffle 1332 1332 0 1 2 + 1334: 17(ivec4) Load 19(ballot) + 1335: 51(fvec3) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1333 1334 + 1336: 44(ptr) AccessChain 31(data) 1330 34 + 1337: 23(fvec4) Load 1336 + 1338: 23(fvec4) VectorShuffle 1337 1335 4 5 6 3 + Store 1336 1338 + 1339: 6(int) Load 8(invocation) + 1340: 44(ptr) AccessChain 31(data) 115 34 + 1341: 23(fvec4) Load 1340 + 1342: 17(ivec4) Load 19(ballot) + 1343: 23(fvec4) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1341 1342 + 1344: 44(ptr) AccessChain 31(data) 1339 34 + Store 1344 1343 + 1345: 6(int) Load 8(invocation) + 1346: 64(ptr) AccessChain 31(data) 34 63 35 + 1347: 24(int) Load 1346 + 1348: 17(ivec4) Load 19(ballot) + 1349: 24(int) GroupNonUniformSMax 178 PartitionedInclusiveScanNV 1347 1348 + 1350: 64(ptr) AccessChain 31(data) 1345 63 35 + Store 1350 1349 + 1351: 6(int) Load 8(invocation) + 1352: 71(ptr) AccessChain 31(data) 63 63 + 1353: 25(ivec4) Load 1352 + 1354: 70(ivec2) VectorShuffle 1353 1353 0 1 + 1355: 17(ivec4) Load 19(ballot) + 1356: 70(ivec2) GroupNonUniformSMax 178 PartitionedInclusiveScanNV 1354 1355 + 1357: 71(ptr) AccessChain 31(data) 1351 63 + 1358: 25(ivec4) Load 1357 + 1359: 25(ivec4) VectorShuffle 1358 1356 4 5 2 3 + Store 1357 1359 + 1360: 6(int) Load 8(invocation) + 1361: 71(ptr) AccessChain 31(data) 33 63 + 1362: 25(ivec4) Load 1361 + 1363: 78(ivec3) VectorShuffle 1362 1362 0 1 2 + 1364: 17(ivec4) Load 19(ballot) + 1365: 78(ivec3) GroupNonUniformSMax 178 PartitionedInclusiveScanNV 1363 1364 + 1366: 71(ptr) AccessChain 31(data) 1360 63 + 1367: 25(ivec4) Load 1366 + 1368: 25(ivec4) VectorShuffle 1367 1365 4 5 6 3 + Store 1366 1368 + 1369: 6(int) Load 8(invocation) + 1370: 71(ptr) AccessChain 31(data) 115 63 + 1371: 25(ivec4) Load 1370 + 1372: 17(ivec4) Load 19(ballot) + 1373: 25(ivec4) GroupNonUniformSMax 178 PartitionedInclusiveScanNV 1371 1372 + 1374: 71(ptr) AccessChain 31(data) 1369 63 + Store 1374 1373 + 1375: 6(int) Load 8(invocation) + 1376: 90(ptr) AccessChain 31(data) 34 33 35 + 1377: 6(int) Load 1376 + 1378: 17(ivec4) Load 19(ballot) + 1379: 6(int) GroupNonUniformUMax 178 PartitionedInclusiveScanNV 1377 1378 + 1380: 90(ptr) AccessChain 31(data) 1375 33 35 + Store 1380 1379 + 1381: 6(int) Load 8(invocation) + 1382: 40(ptr) AccessChain 31(data) 63 33 + 1383: 17(ivec4) Load 1382 + 1384: 96(ivec2) VectorShuffle 1383 1383 0 1 + 1385: 17(ivec4) Load 19(ballot) + 1386: 96(ivec2) GroupNonUniformUMax 178 PartitionedInclusiveScanNV 1384 1385 + 1387: 40(ptr) AccessChain 31(data) 1381 33 + 1388: 17(ivec4) Load 1387 + 1389: 17(ivec4) VectorShuffle 1388 1386 4 5 2 3 + Store 1387 1389 + 1390: 6(int) Load 8(invocation) + 1391: 40(ptr) AccessChain 31(data) 33 33 + 1392: 17(ivec4) Load 1391 + 1393: 103(ivec3) VectorShuffle 1392 1392 0 1 2 + 1394: 17(ivec4) Load 19(ballot) + 1395: 103(ivec3) GroupNonUniformUMax 178 PartitionedInclusiveScanNV 1393 1394 + 1396: 40(ptr) AccessChain 31(data) 1390 33 + 1397: 17(ivec4) Load 1396 + 1398: 17(ivec4) VectorShuffle 1397 1395 4 5 6 3 + Store 1396 1398 + 1399: 6(int) Load 8(invocation) + 1400: 40(ptr) AccessChain 31(data) 115 33 + 1401: 17(ivec4) Load 1400 + 1402: 17(ivec4) Load 19(ballot) + 1403: 17(ivec4) GroupNonUniformUMax 178 PartitionedInclusiveScanNV 1401 1402 + 1404: 40(ptr) AccessChain 31(data) 1399 33 + Store 1404 1403 + 1405: 6(int) Load 8(invocation) + 1406: 116(ptr) AccessChain 31(data) 34 115 35 + 1407:26(float64_t) Load 1406 + 1408: 17(ivec4) Load 19(ballot) + 1409:26(float64_t) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1407 1408 + 1410: 116(ptr) AccessChain 31(data) 1405 115 35 + Store 1410 1409 + 1411: 6(int) Load 8(invocation) + 1412: 123(ptr) AccessChain 31(data) 63 115 + 1413: 27(f64vec4) Load 1412 + 1414:122(f64vec2) VectorShuffle 1413 1413 0 1 + 1415: 17(ivec4) Load 19(ballot) + 1416:122(f64vec2) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1414 1415 + 1417: 123(ptr) AccessChain 31(data) 1411 115 + 1418: 27(f64vec4) Load 1417 + 1419: 27(f64vec4) VectorShuffle 1418 1416 4 5 2 3 + Store 1417 1419 + 1420: 6(int) Load 8(invocation) + 1421: 123(ptr) AccessChain 31(data) 33 115 + 1422: 27(f64vec4) Load 1421 + 1423:130(f64vec3) VectorShuffle 1422 1422 0 1 2 + 1424: 17(ivec4) Load 19(ballot) + 1425:130(f64vec3) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1423 1424 + 1426: 123(ptr) AccessChain 31(data) 1420 115 + 1427: 27(f64vec4) Load 1426 + 1428: 27(f64vec4) VectorShuffle 1427 1425 4 5 6 3 + Store 1426 1428 + 1429: 6(int) Load 8(invocation) + 1430: 123(ptr) AccessChain 31(data) 115 115 + 1431: 27(f64vec4) Load 1430 + 1432: 17(ivec4) Load 19(ballot) + 1433: 27(f64vec4) GroupNonUniformFMax 178 PartitionedInclusiveScanNV 1431 1432 + 1434: 123(ptr) AccessChain 31(data) 1429 115 + Store 1434 1433 + 1435: 6(int) Load 8(invocation) + 1436: 64(ptr) AccessChain 31(data) 34 63 35 + 1437: 24(int) Load 1436 + 1438: 17(ivec4) Load 19(ballot) + 1439: 24(int) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1437 1438 + 1440: 64(ptr) AccessChain 31(data) 1435 63 35 + Store 1440 1439 + 1441: 6(int) Load 8(invocation) + 1442: 71(ptr) AccessChain 31(data) 63 63 + 1443: 25(ivec4) Load 1442 + 1444: 70(ivec2) VectorShuffle 1443 1443 0 1 + 1445: 17(ivec4) Load 19(ballot) + 1446: 70(ivec2) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1444 1445 + 1447: 71(ptr) AccessChain 31(data) 1441 63 + 1448: 25(ivec4) Load 1447 + 1449: 25(ivec4) VectorShuffle 1448 1446 4 5 2 3 + Store 1447 1449 + 1450: 6(int) Load 8(invocation) + 1451: 71(ptr) AccessChain 31(data) 33 63 + 1452: 25(ivec4) Load 1451 + 1453: 78(ivec3) VectorShuffle 1452 1452 0 1 2 + 1454: 17(ivec4) Load 19(ballot) + 1455: 78(ivec3) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1453 1454 + 1456: 71(ptr) AccessChain 31(data) 1450 63 + 1457: 25(ivec4) Load 1456 + 1458: 25(ivec4) VectorShuffle 1457 1455 4 5 6 3 + Store 1456 1458 + 1459: 6(int) Load 8(invocation) + 1460: 71(ptr) AccessChain 31(data) 115 63 + 1461: 25(ivec4) Load 1460 + 1462: 17(ivec4) Load 19(ballot) + 1463: 25(ivec4) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1461 1462 + 1464: 71(ptr) AccessChain 31(data) 1459 63 + Store 1464 1463 + 1465: 6(int) Load 8(invocation) + 1466: 90(ptr) AccessChain 31(data) 34 33 35 + 1467: 6(int) Load 1466 + 1468: 17(ivec4) Load 19(ballot) + 1469: 6(int) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1467 1468 + 1470: 90(ptr) AccessChain 31(data) 1465 33 35 + Store 1470 1469 + 1471: 6(int) Load 8(invocation) + 1472: 40(ptr) AccessChain 31(data) 63 33 + 1473: 17(ivec4) Load 1472 + 1474: 96(ivec2) VectorShuffle 1473 1473 0 1 + 1475: 17(ivec4) Load 19(ballot) + 1476: 96(ivec2) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1474 1475 + 1477: 40(ptr) AccessChain 31(data) 1471 33 + 1478: 17(ivec4) Load 1477 + 1479: 17(ivec4) VectorShuffle 1478 1476 4 5 2 3 + Store 1477 1479 + 1480: 6(int) Load 8(invocation) + 1481: 40(ptr) AccessChain 31(data) 33 33 + 1482: 17(ivec4) Load 1481 + 1483: 103(ivec3) VectorShuffle 1482 1482 0 1 2 + 1484: 17(ivec4) Load 19(ballot) + 1485: 103(ivec3) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1483 1484 + 1486: 40(ptr) AccessChain 31(data) 1480 33 + 1487: 17(ivec4) Load 1486 + 1488: 17(ivec4) VectorShuffle 1487 1485 4 5 6 3 + Store 1486 1488 + 1489: 6(int) Load 8(invocation) + 1490: 40(ptr) AccessChain 31(data) 115 33 + 1491: 17(ivec4) Load 1490 + 1492: 17(ivec4) Load 19(ballot) + 1493: 17(ivec4) GroupNonUniformBitwiseAnd 178 PartitionedInclusiveScanNV 1491 1492 + 1494: 40(ptr) AccessChain 31(data) 1489 33 + Store 1494 1493 + 1495: 6(int) Load 8(invocation) + 1496: 64(ptr) AccessChain 31(data) 34 63 35 + 1497: 24(int) Load 1496 + 1498: 144(bool) SLessThan 1497 34 + 1499: 17(ivec4) Load 19(ballot) + 1500: 144(bool) GroupNonUniformLogicalAnd 178 PartitionedInclusiveScanNV 1498 1499 + 1501: 24(int) Select 1500 63 34 + 1502: 64(ptr) AccessChain 31(data) 1495 63 35 + Store 1502 1501 + 1503: 6(int) Load 8(invocation) + 1504: 71(ptr) AccessChain 31(data) 63 63 + 1505: 25(ivec4) Load 1504 + 1506: 70(ivec2) VectorShuffle 1505 1505 0 1 + 1507: 152(bvec2) SLessThan 1506 727 + 1508: 17(ivec4) Load 19(ballot) + 1509: 152(bvec2) GroupNonUniformLogicalAnd 178 PartitionedInclusiveScanNV 1507 1508 + 1510: 70(ivec2) Select 1509 731 727 + 1511: 71(ptr) AccessChain 31(data) 1503 63 + 1512: 25(ivec4) Load 1511 + 1513: 25(ivec4) VectorShuffle 1512 1510 4 5 2 3 + Store 1511 1513 + 1514: 6(int) Load 8(invocation) + 1515: 71(ptr) AccessChain 31(data) 63 63 + 1516: 25(ivec4) Load 1515 + 1517: 78(ivec3) VectorShuffle 1516 1516 0 1 2 + 1518: 161(bvec3) SLessThan 1517 740 + 1519: 17(ivec4) Load 19(ballot) + 1520: 161(bvec3) GroupNonUniformLogicalAnd 178 PartitionedInclusiveScanNV 1518 1519 + 1521: 78(ivec3) Select 1520 744 740 + 1522: 71(ptr) AccessChain 31(data) 1514 63 + 1523: 25(ivec4) Load 1522 + 1524: 25(ivec4) VectorShuffle 1523 1521 4 5 6 3 + Store 1522 1524 + 1525: 6(int) Load 8(invocation) + 1526: 71(ptr) AccessChain 31(data) 63 63 + 1527: 25(ivec4) Load 1526 + 1528: 169(bvec4) SLessThan 1527 752 + 1529: 17(ivec4) Load 19(ballot) + 1530: 169(bvec4) GroupNonUniformLogicalAnd 178 PartitionedInclusiveScanNV 1528 1529 + 1531: 25(ivec4) Select 1530 756 752 + 1532: 71(ptr) AccessChain 31(data) 1525 63 + Store 1532 1531 + 1533: 6(int) Load 8(invocation) + 1534: 64(ptr) AccessChain 31(data) 34 63 35 + 1535: 24(int) Load 1534 + 1536: 17(ivec4) Load 19(ballot) + 1537: 24(int) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1535 1536 + 1538: 64(ptr) AccessChain 31(data) 1533 63 35 + Store 1538 1537 + 1539: 6(int) Load 8(invocation) + 1540: 71(ptr) AccessChain 31(data) 63 63 + 1541: 25(ivec4) Load 1540 + 1542: 70(ivec2) VectorShuffle 1541 1541 0 1 + 1543: 17(ivec4) Load 19(ballot) + 1544: 70(ivec2) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1542 1543 + 1545: 71(ptr) AccessChain 31(data) 1539 63 + 1546: 25(ivec4) Load 1545 + 1547: 25(ivec4) VectorShuffle 1546 1544 4 5 2 3 + Store 1545 1547 + 1548: 6(int) Load 8(invocation) + 1549: 71(ptr) AccessChain 31(data) 33 63 + 1550: 25(ivec4) Load 1549 + 1551: 78(ivec3) VectorShuffle 1550 1550 0 1 2 + 1552: 17(ivec4) Load 19(ballot) + 1553: 78(ivec3) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1551 1552 + 1554: 71(ptr) AccessChain 31(data) 1548 63 + 1555: 25(ivec4) Load 1554 + 1556: 25(ivec4) VectorShuffle 1555 1553 4 5 6 3 + Store 1554 1556 + 1557: 6(int) Load 8(invocation) + 1558: 71(ptr) AccessChain 31(data) 115 63 + 1559: 25(ivec4) Load 1558 + 1560: 17(ivec4) Load 19(ballot) + 1561: 25(ivec4) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1559 1560 + 1562: 71(ptr) AccessChain 31(data) 1557 63 + Store 1562 1561 + 1563: 6(int) Load 8(invocation) + 1564: 90(ptr) AccessChain 31(data) 34 33 35 + 1565: 6(int) Load 1564 + 1566: 17(ivec4) Load 19(ballot) + 1567: 6(int) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1565 1566 + 1568: 90(ptr) AccessChain 31(data) 1563 33 35 + Store 1568 1567 + 1569: 6(int) Load 8(invocation) + 1570: 40(ptr) AccessChain 31(data) 63 33 + 1571: 17(ivec4) Load 1570 + 1572: 96(ivec2) VectorShuffle 1571 1571 0 1 + 1573: 17(ivec4) Load 19(ballot) + 1574: 96(ivec2) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1572 1573 + 1575: 40(ptr) AccessChain 31(data) 1569 33 + 1576: 17(ivec4) Load 1575 + 1577: 17(ivec4) VectorShuffle 1576 1574 4 5 2 3 + Store 1575 1577 + 1578: 6(int) Load 8(invocation) + 1579: 40(ptr) AccessChain 31(data) 33 33 + 1580: 17(ivec4) Load 1579 + 1581: 103(ivec3) VectorShuffle 1580 1580 0 1 2 + 1582: 17(ivec4) Load 19(ballot) + 1583: 103(ivec3) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1581 1582 + 1584: 40(ptr) AccessChain 31(data) 1578 33 + 1585: 17(ivec4) Load 1584 + 1586: 17(ivec4) VectorShuffle 1585 1583 4 5 6 3 + Store 1584 1586 + 1587: 6(int) Load 8(invocation) + 1588: 40(ptr) AccessChain 31(data) 115 33 + 1589: 17(ivec4) Load 1588 + 1590: 17(ivec4) Load 19(ballot) + 1591: 17(ivec4) GroupNonUniformBitwiseOr 178 PartitionedInclusiveScanNV 1589 1590 + 1592: 40(ptr) AccessChain 31(data) 1587 33 + Store 1592 1591 + 1593: 6(int) Load 8(invocation) + 1594: 64(ptr) AccessChain 31(data) 34 63 35 + 1595: 24(int) Load 1594 + 1596: 144(bool) SLessThan 1595 34 + 1597: 17(ivec4) Load 19(ballot) + 1598: 144(bool) GroupNonUniformLogicalOr 178 PartitionedInclusiveScanNV 1596 1597 + 1599: 24(int) Select 1598 63 34 + 1600: 64(ptr) AccessChain 31(data) 1593 63 35 + Store 1600 1599 + 1601: 6(int) Load 8(invocation) + 1602: 71(ptr) AccessChain 31(data) 63 63 + 1603: 25(ivec4) Load 1602 + 1604: 70(ivec2) VectorShuffle 1603 1603 0 1 + 1605: 152(bvec2) SLessThan 1604 727 + 1606: 17(ivec4) Load 19(ballot) + 1607: 152(bvec2) GroupNonUniformLogicalOr 178 PartitionedInclusiveScanNV 1605 1606 + 1608: 70(ivec2) Select 1607 731 727 + 1609: 71(ptr) AccessChain 31(data) 1601 63 + 1610: 25(ivec4) Load 1609 + 1611: 25(ivec4) VectorShuffle 1610 1608 4 5 2 3 + Store 1609 1611 + 1612: 6(int) Load 8(invocation) + 1613: 71(ptr) AccessChain 31(data) 63 63 + 1614: 25(ivec4) Load 1613 + 1615: 78(ivec3) VectorShuffle 1614 1614 0 1 2 + 1616: 161(bvec3) SLessThan 1615 740 + 1617: 17(ivec4) Load 19(ballot) + 1618: 161(bvec3) GroupNonUniformLogicalOr 178 PartitionedInclusiveScanNV 1616 1617 + 1619: 78(ivec3) Select 1618 744 740 + 1620: 71(ptr) AccessChain 31(data) 1612 63 + 1621: 25(ivec4) Load 1620 + 1622: 25(ivec4) VectorShuffle 1621 1619 4 5 6 3 + Store 1620 1622 + 1623: 6(int) Load 8(invocation) + 1624: 71(ptr) AccessChain 31(data) 63 63 + 1625: 25(ivec4) Load 1624 + 1626: 169(bvec4) SLessThan 1625 752 + 1627: 17(ivec4) Load 19(ballot) + 1628: 169(bvec4) GroupNonUniformLogicalOr 178 PartitionedInclusiveScanNV 1626 1627 + 1629: 25(ivec4) Select 1628 756 752 + 1630: 71(ptr) AccessChain 31(data) 1623 63 + Store 1630 1629 + 1631: 6(int) Load 8(invocation) + 1632: 64(ptr) AccessChain 31(data) 34 63 35 + 1633: 24(int) Load 1632 + 1634: 17(ivec4) Load 19(ballot) + 1635: 24(int) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1633 1634 + 1636: 64(ptr) AccessChain 31(data) 1631 63 35 + Store 1636 1635 + 1637: 6(int) Load 8(invocation) + 1638: 71(ptr) AccessChain 31(data) 63 63 + 1639: 25(ivec4) Load 1638 + 1640: 70(ivec2) VectorShuffle 1639 1639 0 1 + 1641: 17(ivec4) Load 19(ballot) + 1642: 70(ivec2) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1640 1641 + 1643: 71(ptr) AccessChain 31(data) 1637 63 + 1644: 25(ivec4) Load 1643 + 1645: 25(ivec4) VectorShuffle 1644 1642 4 5 2 3 + Store 1643 1645 + 1646: 6(int) Load 8(invocation) + 1647: 71(ptr) AccessChain 31(data) 33 63 + 1648: 25(ivec4) Load 1647 + 1649: 78(ivec3) VectorShuffle 1648 1648 0 1 2 + 1650: 17(ivec4) Load 19(ballot) + 1651: 78(ivec3) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1649 1650 + 1652: 71(ptr) AccessChain 31(data) 1646 63 + 1653: 25(ivec4) Load 1652 + 1654: 25(ivec4) VectorShuffle 1653 1651 4 5 6 3 + Store 1652 1654 + 1655: 6(int) Load 8(invocation) + 1656: 71(ptr) AccessChain 31(data) 115 63 + 1657: 25(ivec4) Load 1656 + 1658: 17(ivec4) Load 19(ballot) + 1659: 25(ivec4) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1657 1658 + 1660: 71(ptr) AccessChain 31(data) 1655 63 + Store 1660 1659 + 1661: 6(int) Load 8(invocation) + 1662: 90(ptr) AccessChain 31(data) 34 33 35 + 1663: 6(int) Load 1662 + 1664: 17(ivec4) Load 19(ballot) + 1665: 6(int) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1663 1664 + 1666: 90(ptr) AccessChain 31(data) 1661 33 35 + Store 1666 1665 + 1667: 6(int) Load 8(invocation) + 1668: 40(ptr) AccessChain 31(data) 63 33 + 1669: 17(ivec4) Load 1668 + 1670: 96(ivec2) VectorShuffle 1669 1669 0 1 + 1671: 17(ivec4) Load 19(ballot) + 1672: 96(ivec2) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1670 1671 + 1673: 40(ptr) AccessChain 31(data) 1667 33 + 1674: 17(ivec4) Load 1673 + 1675: 17(ivec4) VectorShuffle 1674 1672 4 5 2 3 + Store 1673 1675 + 1676: 6(int) Load 8(invocation) + 1677: 40(ptr) AccessChain 31(data) 33 33 + 1678: 17(ivec4) Load 1677 + 1679: 103(ivec3) VectorShuffle 1678 1678 0 1 2 + 1680: 17(ivec4) Load 19(ballot) + 1681: 103(ivec3) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1679 1680 + 1682: 40(ptr) AccessChain 31(data) 1676 33 + 1683: 17(ivec4) Load 1682 + 1684: 17(ivec4) VectorShuffle 1683 1681 4 5 6 3 + Store 1682 1684 + 1685: 6(int) Load 8(invocation) + 1686: 40(ptr) AccessChain 31(data) 115 33 + 1687: 17(ivec4) Load 1686 + 1688: 17(ivec4) Load 19(ballot) + 1689: 17(ivec4) GroupNonUniformBitwiseXor 178 PartitionedInclusiveScanNV 1687 1688 + 1690: 40(ptr) AccessChain 31(data) 1685 33 + Store 1690 1689 + 1691: 6(int) Load 8(invocation) + 1692: 64(ptr) AccessChain 31(data) 34 63 35 + 1693: 24(int) Load 1692 + 1694: 144(bool) SLessThan 1693 34 + 1695: 17(ivec4) Load 19(ballot) + 1696: 144(bool) GroupNonUniformLogicalXor 178 PartitionedInclusiveScanNV 1694 1695 + 1697: 24(int) Select 1696 63 34 + 1698: 64(ptr) AccessChain 31(data) 1691 63 35 + Store 1698 1697 + 1699: 6(int) Load 8(invocation) + 1700: 71(ptr) AccessChain 31(data) 63 63 + 1701: 25(ivec4) Load 1700 + 1702: 70(ivec2) VectorShuffle 1701 1701 0 1 + 1703: 152(bvec2) SLessThan 1702 727 + 1704: 17(ivec4) Load 19(ballot) + 1705: 152(bvec2) GroupNonUniformLogicalXor 178 PartitionedInclusiveScanNV 1703 1704 + 1706: 70(ivec2) Select 1705 731 727 + 1707: 71(ptr) AccessChain 31(data) 1699 63 + 1708: 25(ivec4) Load 1707 + 1709: 25(ivec4) VectorShuffle 1708 1706 4 5 2 3 + Store 1707 1709 + 1710: 6(int) Load 8(invocation) + 1711: 71(ptr) AccessChain 31(data) 63 63 + 1712: 25(ivec4) Load 1711 + 1713: 78(ivec3) VectorShuffle 1712 1712 0 1 2 + 1714: 161(bvec3) SLessThan 1713 740 + 1715: 17(ivec4) Load 19(ballot) + 1716: 161(bvec3) GroupNonUniformLogicalXor 178 PartitionedInclusiveScanNV 1714 1715 + 1717: 78(ivec3) Select 1716 744 740 + 1718: 71(ptr) AccessChain 31(data) 1710 63 + 1719: 25(ivec4) Load 1718 + 1720: 25(ivec4) VectorShuffle 1719 1717 4 5 6 3 + Store 1718 1720 + 1721: 6(int) Load 8(invocation) + 1722: 71(ptr) AccessChain 31(data) 63 63 + 1723: 25(ivec4) Load 1722 + 1724: 169(bvec4) SLessThan 1723 752 + 1725: 17(ivec4) Load 19(ballot) + 1726: 169(bvec4) GroupNonUniformLogicalXor 178 PartitionedInclusiveScanNV 1724 1725 + 1727: 25(ivec4) Select 1726 756 752 + 1728: 71(ptr) AccessChain 31(data) 1721 63 + Store 1728 1727 + 1729: 6(int) Load 8(invocation) + 1730: 36(ptr) AccessChain 31(data) 34 34 35 + 1731: 22(float) Load 1730 + 1732: 17(ivec4) Load 19(ballot) + 1733: 22(float) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1731 1732 + 1734: 36(ptr) AccessChain 31(data) 1729 34 35 + Store 1734 1733 + 1735: 6(int) Load 8(invocation) + 1736: 44(ptr) AccessChain 31(data) 63 34 + 1737: 23(fvec4) Load 1736 + 1738: 43(fvec2) VectorShuffle 1737 1737 0 1 + 1739: 17(ivec4) Load 19(ballot) + 1740: 43(fvec2) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1738 1739 + 1741: 44(ptr) AccessChain 31(data) 1735 34 + 1742: 23(fvec4) Load 1741 + 1743: 23(fvec4) VectorShuffle 1742 1740 4 5 2 3 + Store 1741 1743 + 1744: 6(int) Load 8(invocation) + 1745: 44(ptr) AccessChain 31(data) 33 34 + 1746: 23(fvec4) Load 1745 + 1747: 51(fvec3) VectorShuffle 1746 1746 0 1 2 + 1748: 17(ivec4) Load 19(ballot) + 1749: 51(fvec3) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1747 1748 + 1750: 44(ptr) AccessChain 31(data) 1744 34 + 1751: 23(fvec4) Load 1750 + 1752: 23(fvec4) VectorShuffle 1751 1749 4 5 6 3 + Store 1750 1752 + 1753: 6(int) Load 8(invocation) + 1754: 44(ptr) AccessChain 31(data) 115 34 + 1755: 23(fvec4) Load 1754 + 1756: 17(ivec4) Load 19(ballot) + 1757: 23(fvec4) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1755 1756 + 1758: 44(ptr) AccessChain 31(data) 1753 34 + Store 1758 1757 + 1759: 6(int) Load 8(invocation) + 1760: 64(ptr) AccessChain 31(data) 34 63 35 + 1761: 24(int) Load 1760 + 1762: 17(ivec4) Load 19(ballot) + 1763: 24(int) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1761 1762 + 1764: 64(ptr) AccessChain 31(data) 1759 63 35 + Store 1764 1763 + 1765: 6(int) Load 8(invocation) + 1766: 71(ptr) AccessChain 31(data) 63 63 + 1767: 25(ivec4) Load 1766 + 1768: 70(ivec2) VectorShuffle 1767 1767 0 1 + 1769: 17(ivec4) Load 19(ballot) + 1770: 70(ivec2) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1768 1769 + 1771: 71(ptr) AccessChain 31(data) 1765 63 + 1772: 25(ivec4) Load 1771 + 1773: 25(ivec4) VectorShuffle 1772 1770 4 5 2 3 + Store 1771 1773 + 1774: 6(int) Load 8(invocation) + 1775: 71(ptr) AccessChain 31(data) 33 63 + 1776: 25(ivec4) Load 1775 + 1777: 78(ivec3) VectorShuffle 1776 1776 0 1 2 + 1778: 17(ivec4) Load 19(ballot) + 1779: 78(ivec3) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1777 1778 + 1780: 71(ptr) AccessChain 31(data) 1774 63 + 1781: 25(ivec4) Load 1780 + 1782: 25(ivec4) VectorShuffle 1781 1779 4 5 6 3 + Store 1780 1782 + 1783: 6(int) Load 8(invocation) + 1784: 71(ptr) AccessChain 31(data) 115 63 + 1785: 25(ivec4) Load 1784 + 1786: 17(ivec4) Load 19(ballot) + 1787: 25(ivec4) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1785 1786 + 1788: 71(ptr) AccessChain 31(data) 1783 63 + Store 1788 1787 + 1789: 6(int) Load 8(invocation) + 1790: 90(ptr) AccessChain 31(data) 34 33 35 + 1791: 6(int) Load 1790 + 1792: 17(ivec4) Load 19(ballot) + 1793: 6(int) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1791 1792 + 1794: 90(ptr) AccessChain 31(data) 1789 33 35 + Store 1794 1793 + 1795: 6(int) Load 8(invocation) + 1796: 40(ptr) AccessChain 31(data) 63 33 + 1797: 17(ivec4) Load 1796 + 1798: 96(ivec2) VectorShuffle 1797 1797 0 1 + 1799: 17(ivec4) Load 19(ballot) + 1800: 96(ivec2) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1798 1799 + 1801: 40(ptr) AccessChain 31(data) 1795 33 + 1802: 17(ivec4) Load 1801 + 1803: 17(ivec4) VectorShuffle 1802 1800 4 5 2 3 + Store 1801 1803 + 1804: 6(int) Load 8(invocation) + 1805: 40(ptr) AccessChain 31(data) 33 33 + 1806: 17(ivec4) Load 1805 + 1807: 103(ivec3) VectorShuffle 1806 1806 0 1 2 + 1808: 17(ivec4) Load 19(ballot) + 1809: 103(ivec3) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1807 1808 + 1810: 40(ptr) AccessChain 31(data) 1804 33 + 1811: 17(ivec4) Load 1810 + 1812: 17(ivec4) VectorShuffle 1811 1809 4 5 6 3 + Store 1810 1812 + 1813: 6(int) Load 8(invocation) + 1814: 40(ptr) AccessChain 31(data) 115 33 + 1815: 17(ivec4) Load 1814 + 1816: 17(ivec4) Load 19(ballot) + 1817: 17(ivec4) GroupNonUniformIAdd 178 PartitionedExclusiveScanNV 1815 1816 + 1818: 40(ptr) AccessChain 31(data) 1813 33 + Store 1818 1817 + 1819: 6(int) Load 8(invocation) + 1820: 116(ptr) AccessChain 31(data) 34 115 35 + 1821:26(float64_t) Load 1820 + 1822: 17(ivec4) Load 19(ballot) + 1823:26(float64_t) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1821 1822 + 1824: 116(ptr) AccessChain 31(data) 1819 115 35 + Store 1824 1823 + 1825: 6(int) Load 8(invocation) + 1826: 123(ptr) AccessChain 31(data) 63 115 + 1827: 27(f64vec4) Load 1826 + 1828:122(f64vec2) VectorShuffle 1827 1827 0 1 + 1829: 17(ivec4) Load 19(ballot) + 1830:122(f64vec2) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1828 1829 + 1831: 123(ptr) AccessChain 31(data) 1825 115 + 1832: 27(f64vec4) Load 1831 + 1833: 27(f64vec4) VectorShuffle 1832 1830 4 5 2 3 + Store 1831 1833 + 1834: 6(int) Load 8(invocation) + 1835: 123(ptr) AccessChain 31(data) 33 115 + 1836: 27(f64vec4) Load 1835 + 1837:130(f64vec3) VectorShuffle 1836 1836 0 1 2 + 1838: 17(ivec4) Load 19(ballot) + 1839:130(f64vec3) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1837 1838 + 1840: 123(ptr) AccessChain 31(data) 1834 115 + 1841: 27(f64vec4) Load 1840 + 1842: 27(f64vec4) VectorShuffle 1841 1839 4 5 6 3 + Store 1840 1842 + 1843: 6(int) Load 8(invocation) + 1844: 123(ptr) AccessChain 31(data) 115 115 + 1845: 27(f64vec4) Load 1844 + 1846: 17(ivec4) Load 19(ballot) + 1847: 27(f64vec4) GroupNonUniformFAdd 178 PartitionedExclusiveScanNV 1845 1846 + 1848: 123(ptr) AccessChain 31(data) 1843 115 + Store 1848 1847 + 1849: 6(int) Load 8(invocation) + 1850: 36(ptr) AccessChain 31(data) 34 34 35 + 1851: 22(float) Load 1850 + 1852: 17(ivec4) Load 19(ballot) + 1853: 22(float) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1851 1852 + 1854: 36(ptr) AccessChain 31(data) 1849 34 35 + Store 1854 1853 + 1855: 6(int) Load 8(invocation) + 1856: 44(ptr) AccessChain 31(data) 63 34 + 1857: 23(fvec4) Load 1856 + 1858: 43(fvec2) VectorShuffle 1857 1857 0 1 + 1859: 17(ivec4) Load 19(ballot) + 1860: 43(fvec2) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1858 1859 + 1861: 44(ptr) AccessChain 31(data) 1855 34 + 1862: 23(fvec4) Load 1861 + 1863: 23(fvec4) VectorShuffle 1862 1860 4 5 2 3 + Store 1861 1863 + 1864: 6(int) Load 8(invocation) + 1865: 44(ptr) AccessChain 31(data) 33 34 + 1866: 23(fvec4) Load 1865 + 1867: 51(fvec3) VectorShuffle 1866 1866 0 1 2 + 1868: 17(ivec4) Load 19(ballot) + 1869: 51(fvec3) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1867 1868 + 1870: 44(ptr) AccessChain 31(data) 1864 34 + 1871: 23(fvec4) Load 1870 + 1872: 23(fvec4) VectorShuffle 1871 1869 4 5 6 3 + Store 1870 1872 + 1873: 6(int) Load 8(invocation) + 1874: 44(ptr) AccessChain 31(data) 115 34 + 1875: 23(fvec4) Load 1874 + 1876: 17(ivec4) Load 19(ballot) + 1877: 23(fvec4) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1875 1876 + 1878: 44(ptr) AccessChain 31(data) 1873 34 + Store 1878 1877 + 1879: 6(int) Load 8(invocation) + 1880: 64(ptr) AccessChain 31(data) 34 63 35 + 1881: 24(int) Load 1880 + 1882: 17(ivec4) Load 19(ballot) + 1883: 24(int) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1881 1882 + 1884: 64(ptr) AccessChain 31(data) 1879 63 35 + Store 1884 1883 + 1885: 6(int) Load 8(invocation) + 1886: 71(ptr) AccessChain 31(data) 63 63 + 1887: 25(ivec4) Load 1886 + 1888: 70(ivec2) VectorShuffle 1887 1887 0 1 + 1889: 17(ivec4) Load 19(ballot) + 1890: 70(ivec2) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1888 1889 + 1891: 71(ptr) AccessChain 31(data) 1885 63 + 1892: 25(ivec4) Load 1891 + 1893: 25(ivec4) VectorShuffle 1892 1890 4 5 2 3 + Store 1891 1893 + 1894: 6(int) Load 8(invocation) + 1895: 71(ptr) AccessChain 31(data) 33 63 + 1896: 25(ivec4) Load 1895 + 1897: 78(ivec3) VectorShuffle 1896 1896 0 1 2 + 1898: 17(ivec4) Load 19(ballot) + 1899: 78(ivec3) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1897 1898 + 1900: 71(ptr) AccessChain 31(data) 1894 63 + 1901: 25(ivec4) Load 1900 + 1902: 25(ivec4) VectorShuffle 1901 1899 4 5 6 3 + Store 1900 1902 + 1903: 6(int) Load 8(invocation) + 1904: 71(ptr) AccessChain 31(data) 115 63 + 1905: 25(ivec4) Load 1904 + 1906: 17(ivec4) Load 19(ballot) + 1907: 25(ivec4) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1905 1906 + 1908: 71(ptr) AccessChain 31(data) 1903 63 + Store 1908 1907 + 1909: 6(int) Load 8(invocation) + 1910: 90(ptr) AccessChain 31(data) 34 33 35 + 1911: 6(int) Load 1910 + 1912: 17(ivec4) Load 19(ballot) + 1913: 6(int) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1911 1912 + 1914: 90(ptr) AccessChain 31(data) 1909 33 35 + Store 1914 1913 + 1915: 6(int) Load 8(invocation) + 1916: 40(ptr) AccessChain 31(data) 63 33 + 1917: 17(ivec4) Load 1916 + 1918: 96(ivec2) VectorShuffle 1917 1917 0 1 + 1919: 17(ivec4) Load 19(ballot) + 1920: 96(ivec2) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1918 1919 + 1921: 40(ptr) AccessChain 31(data) 1915 33 + 1922: 17(ivec4) Load 1921 + 1923: 17(ivec4) VectorShuffle 1922 1920 4 5 2 3 + Store 1921 1923 + 1924: 6(int) Load 8(invocation) + 1925: 40(ptr) AccessChain 31(data) 33 33 + 1926: 17(ivec4) Load 1925 + 1927: 103(ivec3) VectorShuffle 1926 1926 0 1 2 + 1928: 17(ivec4) Load 19(ballot) + 1929: 103(ivec3) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1927 1928 + 1930: 40(ptr) AccessChain 31(data) 1924 33 + 1931: 17(ivec4) Load 1930 + 1932: 17(ivec4) VectorShuffle 1931 1929 4 5 6 3 + Store 1930 1932 + 1933: 6(int) Load 8(invocation) + 1934: 40(ptr) AccessChain 31(data) 115 33 + 1935: 17(ivec4) Load 1934 + 1936: 17(ivec4) Load 19(ballot) + 1937: 17(ivec4) GroupNonUniformIMul 178 PartitionedExclusiveScanNV 1935 1936 + 1938: 40(ptr) AccessChain 31(data) 1933 33 + Store 1938 1937 + 1939: 6(int) Load 8(invocation) + 1940: 116(ptr) AccessChain 31(data) 34 115 35 + 1941:26(float64_t) Load 1940 + 1942: 17(ivec4) Load 19(ballot) + 1943:26(float64_t) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1941 1942 + 1944: 116(ptr) AccessChain 31(data) 1939 115 35 + Store 1944 1943 + 1945: 6(int) Load 8(invocation) + 1946: 123(ptr) AccessChain 31(data) 63 115 + 1947: 27(f64vec4) Load 1946 + 1948:122(f64vec2) VectorShuffle 1947 1947 0 1 + 1949: 17(ivec4) Load 19(ballot) + 1950:122(f64vec2) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1948 1949 + 1951: 123(ptr) AccessChain 31(data) 1945 115 + 1952: 27(f64vec4) Load 1951 + 1953: 27(f64vec4) VectorShuffle 1952 1950 4 5 2 3 + Store 1951 1953 + 1954: 6(int) Load 8(invocation) + 1955: 123(ptr) AccessChain 31(data) 33 115 + 1956: 27(f64vec4) Load 1955 + 1957:130(f64vec3) VectorShuffle 1956 1956 0 1 2 + 1958: 17(ivec4) Load 19(ballot) + 1959:130(f64vec3) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1957 1958 + 1960: 123(ptr) AccessChain 31(data) 1954 115 + 1961: 27(f64vec4) Load 1960 + 1962: 27(f64vec4) VectorShuffle 1961 1959 4 5 6 3 + Store 1960 1962 + 1963: 6(int) Load 8(invocation) + 1964: 123(ptr) AccessChain 31(data) 115 115 + 1965: 27(f64vec4) Load 1964 + 1966: 17(ivec4) Load 19(ballot) + 1967: 27(f64vec4) GroupNonUniformFMul 178 PartitionedExclusiveScanNV 1965 1966 + 1968: 123(ptr) AccessChain 31(data) 1963 115 + Store 1968 1967 + 1969: 6(int) Load 8(invocation) + 1970: 36(ptr) AccessChain 31(data) 34 34 35 + 1971: 22(float) Load 1970 + 1972: 17(ivec4) Load 19(ballot) + 1973: 22(float) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 1971 1972 + 1974: 36(ptr) AccessChain 31(data) 1969 34 35 + Store 1974 1973 + 1975: 6(int) Load 8(invocation) + 1976: 44(ptr) AccessChain 31(data) 63 34 + 1977: 23(fvec4) Load 1976 + 1978: 43(fvec2) VectorShuffle 1977 1977 0 1 + 1979: 17(ivec4) Load 19(ballot) + 1980: 43(fvec2) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 1978 1979 + 1981: 44(ptr) AccessChain 31(data) 1975 34 + 1982: 23(fvec4) Load 1981 + 1983: 23(fvec4) VectorShuffle 1982 1980 4 5 2 3 + Store 1981 1983 + 1984: 6(int) Load 8(invocation) + 1985: 44(ptr) AccessChain 31(data) 33 34 + 1986: 23(fvec4) Load 1985 + 1987: 51(fvec3) VectorShuffle 1986 1986 0 1 2 + 1988: 17(ivec4) Load 19(ballot) + 1989: 51(fvec3) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 1987 1988 + 1990: 44(ptr) AccessChain 31(data) 1984 34 + 1991: 23(fvec4) Load 1990 + 1992: 23(fvec4) VectorShuffle 1991 1989 4 5 6 3 + Store 1990 1992 + 1993: 6(int) Load 8(invocation) + 1994: 44(ptr) AccessChain 31(data) 115 34 + 1995: 23(fvec4) Load 1994 + 1996: 17(ivec4) Load 19(ballot) + 1997: 23(fvec4) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 1995 1996 + 1998: 44(ptr) AccessChain 31(data) 1993 34 + Store 1998 1997 + 1999: 6(int) Load 8(invocation) + 2000: 64(ptr) AccessChain 31(data) 34 63 35 + 2001: 24(int) Load 2000 + 2002: 17(ivec4) Load 19(ballot) + 2003: 24(int) GroupNonUniformSMin 178 PartitionedExclusiveScanNV 2001 2002 + 2004: 64(ptr) AccessChain 31(data) 1999 63 35 + Store 2004 2003 + 2005: 6(int) Load 8(invocation) + 2006: 71(ptr) AccessChain 31(data) 63 63 + 2007: 25(ivec4) Load 2006 + 2008: 70(ivec2) VectorShuffle 2007 2007 0 1 + 2009: 17(ivec4) Load 19(ballot) + 2010: 70(ivec2) GroupNonUniformSMin 178 PartitionedExclusiveScanNV 2008 2009 + 2011: 71(ptr) AccessChain 31(data) 2005 63 + 2012: 25(ivec4) Load 2011 + 2013: 25(ivec4) VectorShuffle 2012 2010 4 5 2 3 + Store 2011 2013 + 2014: 6(int) Load 8(invocation) + 2015: 71(ptr) AccessChain 31(data) 33 63 + 2016: 25(ivec4) Load 2015 + 2017: 78(ivec3) VectorShuffle 2016 2016 0 1 2 + 2018: 17(ivec4) Load 19(ballot) + 2019: 78(ivec3) GroupNonUniformSMin 178 PartitionedExclusiveScanNV 2017 2018 + 2020: 71(ptr) AccessChain 31(data) 2014 63 + 2021: 25(ivec4) Load 2020 + 2022: 25(ivec4) VectorShuffle 2021 2019 4 5 6 3 + Store 2020 2022 + 2023: 6(int) Load 8(invocation) + 2024: 71(ptr) AccessChain 31(data) 115 63 + 2025: 25(ivec4) Load 2024 + 2026: 17(ivec4) Load 19(ballot) + 2027: 25(ivec4) GroupNonUniformSMin 178 PartitionedExclusiveScanNV 2025 2026 + 2028: 71(ptr) AccessChain 31(data) 2023 63 + Store 2028 2027 + 2029: 6(int) Load 8(invocation) + 2030: 90(ptr) AccessChain 31(data) 34 33 35 + 2031: 6(int) Load 2030 + 2032: 17(ivec4) Load 19(ballot) + 2033: 6(int) GroupNonUniformUMin 178 PartitionedExclusiveScanNV 2031 2032 + 2034: 90(ptr) AccessChain 31(data) 2029 33 35 + Store 2034 2033 + 2035: 6(int) Load 8(invocation) + 2036: 40(ptr) AccessChain 31(data) 63 33 + 2037: 17(ivec4) Load 2036 + 2038: 96(ivec2) VectorShuffle 2037 2037 0 1 + 2039: 17(ivec4) Load 19(ballot) + 2040: 96(ivec2) GroupNonUniformUMin 178 PartitionedExclusiveScanNV 2038 2039 + 2041: 40(ptr) AccessChain 31(data) 2035 33 + 2042: 17(ivec4) Load 2041 + 2043: 17(ivec4) VectorShuffle 2042 2040 4 5 2 3 + Store 2041 2043 + 2044: 6(int) Load 8(invocation) + 2045: 40(ptr) AccessChain 31(data) 33 33 + 2046: 17(ivec4) Load 2045 + 2047: 103(ivec3) VectorShuffle 2046 2046 0 1 2 + 2048: 17(ivec4) Load 19(ballot) + 2049: 103(ivec3) GroupNonUniformUMin 178 PartitionedExclusiveScanNV 2047 2048 + 2050: 40(ptr) AccessChain 31(data) 2044 33 + 2051: 17(ivec4) Load 2050 + 2052: 17(ivec4) VectorShuffle 2051 2049 4 5 6 3 + Store 2050 2052 + 2053: 6(int) Load 8(invocation) + 2054: 40(ptr) AccessChain 31(data) 115 33 + 2055: 17(ivec4) Load 2054 + 2056: 17(ivec4) Load 19(ballot) + 2057: 17(ivec4) GroupNonUniformUMin 178 PartitionedExclusiveScanNV 2055 2056 + 2058: 40(ptr) AccessChain 31(data) 2053 33 + Store 2058 2057 + 2059: 6(int) Load 8(invocation) + 2060: 116(ptr) AccessChain 31(data) 34 115 35 + 2061:26(float64_t) Load 2060 + 2062: 17(ivec4) Load 19(ballot) + 2063:26(float64_t) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 2061 2062 + 2064: 116(ptr) AccessChain 31(data) 2059 115 35 + Store 2064 2063 + 2065: 6(int) Load 8(invocation) + 2066: 123(ptr) AccessChain 31(data) 63 115 + 2067: 27(f64vec4) Load 2066 + 2068:122(f64vec2) VectorShuffle 2067 2067 0 1 + 2069: 17(ivec4) Load 19(ballot) + 2070:122(f64vec2) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 2068 2069 + 2071: 123(ptr) AccessChain 31(data) 2065 115 + 2072: 27(f64vec4) Load 2071 + 2073: 27(f64vec4) VectorShuffle 2072 2070 4 5 2 3 + Store 2071 2073 + 2074: 6(int) Load 8(invocation) + 2075: 123(ptr) AccessChain 31(data) 33 115 + 2076: 27(f64vec4) Load 2075 + 2077:130(f64vec3) VectorShuffle 2076 2076 0 1 2 + 2078: 17(ivec4) Load 19(ballot) + 2079:130(f64vec3) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 2077 2078 + 2080: 123(ptr) AccessChain 31(data) 2074 115 + 2081: 27(f64vec4) Load 2080 + 2082: 27(f64vec4) VectorShuffle 2081 2079 4 5 6 3 + Store 2080 2082 + 2083: 6(int) Load 8(invocation) + 2084: 123(ptr) AccessChain 31(data) 115 115 + 2085: 27(f64vec4) Load 2084 + 2086: 17(ivec4) Load 19(ballot) + 2087: 27(f64vec4) GroupNonUniformFMin 178 PartitionedExclusiveScanNV 2085 2086 + 2088: 123(ptr) AccessChain 31(data) 2083 115 + Store 2088 2087 + 2089: 6(int) Load 8(invocation) + 2090: 36(ptr) AccessChain 31(data) 34 34 35 + 2091: 22(float) Load 2090 + 2092: 17(ivec4) Load 19(ballot) + 2093: 22(float) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2091 2092 + 2094: 36(ptr) AccessChain 31(data) 2089 34 35 + Store 2094 2093 + 2095: 6(int) Load 8(invocation) + 2096: 44(ptr) AccessChain 31(data) 63 34 + 2097: 23(fvec4) Load 2096 + 2098: 43(fvec2) VectorShuffle 2097 2097 0 1 + 2099: 17(ivec4) Load 19(ballot) + 2100: 43(fvec2) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2098 2099 + 2101: 44(ptr) AccessChain 31(data) 2095 34 + 2102: 23(fvec4) Load 2101 + 2103: 23(fvec4) VectorShuffle 2102 2100 4 5 2 3 + Store 2101 2103 + 2104: 6(int) Load 8(invocation) + 2105: 44(ptr) AccessChain 31(data) 33 34 + 2106: 23(fvec4) Load 2105 + 2107: 51(fvec3) VectorShuffle 2106 2106 0 1 2 + 2108: 17(ivec4) Load 19(ballot) + 2109: 51(fvec3) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2107 2108 + 2110: 44(ptr) AccessChain 31(data) 2104 34 + 2111: 23(fvec4) Load 2110 + 2112: 23(fvec4) VectorShuffle 2111 2109 4 5 6 3 + Store 2110 2112 + 2113: 6(int) Load 8(invocation) + 2114: 44(ptr) AccessChain 31(data) 115 34 + 2115: 23(fvec4) Load 2114 + 2116: 17(ivec4) Load 19(ballot) + 2117: 23(fvec4) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2115 2116 + 2118: 44(ptr) AccessChain 31(data) 2113 34 + Store 2118 2117 + 2119: 6(int) Load 8(invocation) + 2120: 64(ptr) AccessChain 31(data) 34 63 35 + 2121: 24(int) Load 2120 + 2122: 17(ivec4) Load 19(ballot) + 2123: 24(int) GroupNonUniformSMax 178 PartitionedExclusiveScanNV 2121 2122 + 2124: 64(ptr) AccessChain 31(data) 2119 63 35 + Store 2124 2123 + 2125: 6(int) Load 8(invocation) + 2126: 71(ptr) AccessChain 31(data) 63 63 + 2127: 25(ivec4) Load 2126 + 2128: 70(ivec2) VectorShuffle 2127 2127 0 1 + 2129: 17(ivec4) Load 19(ballot) + 2130: 70(ivec2) GroupNonUniformSMax 178 PartitionedExclusiveScanNV 2128 2129 + 2131: 71(ptr) AccessChain 31(data) 2125 63 + 2132: 25(ivec4) Load 2131 + 2133: 25(ivec4) VectorShuffle 2132 2130 4 5 2 3 + Store 2131 2133 + 2134: 6(int) Load 8(invocation) + 2135: 71(ptr) AccessChain 31(data) 33 63 + 2136: 25(ivec4) Load 2135 + 2137: 78(ivec3) VectorShuffle 2136 2136 0 1 2 + 2138: 17(ivec4) Load 19(ballot) + 2139: 78(ivec3) GroupNonUniformSMax 178 PartitionedExclusiveScanNV 2137 2138 + 2140: 71(ptr) AccessChain 31(data) 2134 63 + 2141: 25(ivec4) Load 2140 + 2142: 25(ivec4) VectorShuffle 2141 2139 4 5 6 3 + Store 2140 2142 + 2143: 6(int) Load 8(invocation) + 2144: 71(ptr) AccessChain 31(data) 115 63 + 2145: 25(ivec4) Load 2144 + 2146: 17(ivec4) Load 19(ballot) + 2147: 25(ivec4) GroupNonUniformSMax 178 PartitionedExclusiveScanNV 2145 2146 + 2148: 71(ptr) AccessChain 31(data) 2143 63 + Store 2148 2147 + 2149: 6(int) Load 8(invocation) + 2150: 90(ptr) AccessChain 31(data) 34 33 35 + 2151: 6(int) Load 2150 + 2152: 17(ivec4) Load 19(ballot) + 2153: 6(int) GroupNonUniformUMax 178 PartitionedExclusiveScanNV 2151 2152 + 2154: 90(ptr) AccessChain 31(data) 2149 33 35 + Store 2154 2153 + 2155: 6(int) Load 8(invocation) + 2156: 40(ptr) AccessChain 31(data) 63 33 + 2157: 17(ivec4) Load 2156 + 2158: 96(ivec2) VectorShuffle 2157 2157 0 1 + 2159: 17(ivec4) Load 19(ballot) + 2160: 96(ivec2) GroupNonUniformUMax 178 PartitionedExclusiveScanNV 2158 2159 + 2161: 40(ptr) AccessChain 31(data) 2155 33 + 2162: 17(ivec4) Load 2161 + 2163: 17(ivec4) VectorShuffle 2162 2160 4 5 2 3 + Store 2161 2163 + 2164: 6(int) Load 8(invocation) + 2165: 40(ptr) AccessChain 31(data) 33 33 + 2166: 17(ivec4) Load 2165 + 2167: 103(ivec3) VectorShuffle 2166 2166 0 1 2 + 2168: 17(ivec4) Load 19(ballot) + 2169: 103(ivec3) GroupNonUniformUMax 178 PartitionedExclusiveScanNV 2167 2168 + 2170: 40(ptr) AccessChain 31(data) 2164 33 + 2171: 17(ivec4) Load 2170 + 2172: 17(ivec4) VectorShuffle 2171 2169 4 5 6 3 + Store 2170 2172 + 2173: 6(int) Load 8(invocation) + 2174: 40(ptr) AccessChain 31(data) 115 33 + 2175: 17(ivec4) Load 2174 + 2176: 17(ivec4) Load 19(ballot) + 2177: 17(ivec4) GroupNonUniformUMax 178 PartitionedExclusiveScanNV 2175 2176 + 2178: 40(ptr) AccessChain 31(data) 2173 33 + Store 2178 2177 + 2179: 6(int) Load 8(invocation) + 2180: 116(ptr) AccessChain 31(data) 34 115 35 + 2181:26(float64_t) Load 2180 + 2182: 17(ivec4) Load 19(ballot) + 2183:26(float64_t) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2181 2182 + 2184: 116(ptr) AccessChain 31(data) 2179 115 35 + Store 2184 2183 + 2185: 6(int) Load 8(invocation) + 2186: 123(ptr) AccessChain 31(data) 63 115 + 2187: 27(f64vec4) Load 2186 + 2188:122(f64vec2) VectorShuffle 2187 2187 0 1 + 2189: 17(ivec4) Load 19(ballot) + 2190:122(f64vec2) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2188 2189 + 2191: 123(ptr) AccessChain 31(data) 2185 115 + 2192: 27(f64vec4) Load 2191 + 2193: 27(f64vec4) VectorShuffle 2192 2190 4 5 2 3 + Store 2191 2193 + 2194: 6(int) Load 8(invocation) + 2195: 123(ptr) AccessChain 31(data) 33 115 + 2196: 27(f64vec4) Load 2195 + 2197:130(f64vec3) VectorShuffle 2196 2196 0 1 2 + 2198: 17(ivec4) Load 19(ballot) + 2199:130(f64vec3) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2197 2198 + 2200: 123(ptr) AccessChain 31(data) 2194 115 + 2201: 27(f64vec4) Load 2200 + 2202: 27(f64vec4) VectorShuffle 2201 2199 4 5 6 3 + Store 2200 2202 + 2203: 6(int) Load 8(invocation) + 2204: 123(ptr) AccessChain 31(data) 115 115 + 2205: 27(f64vec4) Load 2204 + 2206: 17(ivec4) Load 19(ballot) + 2207: 27(f64vec4) GroupNonUniformFMax 178 PartitionedExclusiveScanNV 2205 2206 + 2208: 123(ptr) AccessChain 31(data) 2203 115 + Store 2208 2207 + 2209: 6(int) Load 8(invocation) + 2210: 64(ptr) AccessChain 31(data) 34 63 35 + 2211: 24(int) Load 2210 + 2212: 17(ivec4) Load 19(ballot) + 2213: 24(int) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2211 2212 + 2214: 64(ptr) AccessChain 31(data) 2209 63 35 + Store 2214 2213 + 2215: 6(int) Load 8(invocation) + 2216: 71(ptr) AccessChain 31(data) 63 63 + 2217: 25(ivec4) Load 2216 + 2218: 70(ivec2) VectorShuffle 2217 2217 0 1 + 2219: 17(ivec4) Load 19(ballot) + 2220: 70(ivec2) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2218 2219 + 2221: 71(ptr) AccessChain 31(data) 2215 63 + 2222: 25(ivec4) Load 2221 + 2223: 25(ivec4) VectorShuffle 2222 2220 4 5 2 3 + Store 2221 2223 + 2224: 6(int) Load 8(invocation) + 2225: 71(ptr) AccessChain 31(data) 33 63 + 2226: 25(ivec4) Load 2225 + 2227: 78(ivec3) VectorShuffle 2226 2226 0 1 2 + 2228: 17(ivec4) Load 19(ballot) + 2229: 78(ivec3) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2227 2228 + 2230: 71(ptr) AccessChain 31(data) 2224 63 + 2231: 25(ivec4) Load 2230 + 2232: 25(ivec4) VectorShuffle 2231 2229 4 5 6 3 + Store 2230 2232 + 2233: 6(int) Load 8(invocation) + 2234: 71(ptr) AccessChain 31(data) 115 63 + 2235: 25(ivec4) Load 2234 + 2236: 17(ivec4) Load 19(ballot) + 2237: 25(ivec4) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2235 2236 + 2238: 71(ptr) AccessChain 31(data) 2233 63 + Store 2238 2237 + 2239: 6(int) Load 8(invocation) + 2240: 90(ptr) AccessChain 31(data) 34 33 35 + 2241: 6(int) Load 2240 + 2242: 17(ivec4) Load 19(ballot) + 2243: 6(int) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2241 2242 + 2244: 90(ptr) AccessChain 31(data) 2239 33 35 + Store 2244 2243 + 2245: 6(int) Load 8(invocation) + 2246: 40(ptr) AccessChain 31(data) 63 33 + 2247: 17(ivec4) Load 2246 + 2248: 96(ivec2) VectorShuffle 2247 2247 0 1 + 2249: 17(ivec4) Load 19(ballot) + 2250: 96(ivec2) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2248 2249 + 2251: 40(ptr) AccessChain 31(data) 2245 33 + 2252: 17(ivec4) Load 2251 + 2253: 17(ivec4) VectorShuffle 2252 2250 4 5 2 3 + Store 2251 2253 + 2254: 6(int) Load 8(invocation) + 2255: 40(ptr) AccessChain 31(data) 33 33 + 2256: 17(ivec4) Load 2255 + 2257: 103(ivec3) VectorShuffle 2256 2256 0 1 2 + 2258: 17(ivec4) Load 19(ballot) + 2259: 103(ivec3) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2257 2258 + 2260: 40(ptr) AccessChain 31(data) 2254 33 + 2261: 17(ivec4) Load 2260 + 2262: 17(ivec4) VectorShuffle 2261 2259 4 5 6 3 + Store 2260 2262 + 2263: 6(int) Load 8(invocation) + 2264: 40(ptr) AccessChain 31(data) 115 33 + 2265: 17(ivec4) Load 2264 + 2266: 17(ivec4) Load 19(ballot) + 2267: 17(ivec4) GroupNonUniformBitwiseAnd 178 PartitionedExclusiveScanNV 2265 2266 + 2268: 40(ptr) AccessChain 31(data) 2263 33 + Store 2268 2267 + 2269: 6(int) Load 8(invocation) + 2270: 64(ptr) AccessChain 31(data) 34 63 35 + 2271: 24(int) Load 2270 + 2272: 144(bool) SLessThan 2271 34 + 2273: 17(ivec4) Load 19(ballot) + 2274: 144(bool) GroupNonUniformLogicalAnd 178 PartitionedExclusiveScanNV 2272 2273 + 2275: 24(int) Select 2274 63 34 + 2276: 64(ptr) AccessChain 31(data) 2269 63 35 + Store 2276 2275 + 2277: 6(int) Load 8(invocation) + 2278: 71(ptr) AccessChain 31(data) 63 63 + 2279: 25(ivec4) Load 2278 + 2280: 70(ivec2) VectorShuffle 2279 2279 0 1 + 2281: 152(bvec2) SLessThan 2280 727 + 2282: 17(ivec4) Load 19(ballot) + 2283: 152(bvec2) GroupNonUniformLogicalAnd 178 PartitionedExclusiveScanNV 2281 2282 + 2284: 70(ivec2) Select 2283 731 727 + 2285: 71(ptr) AccessChain 31(data) 2277 63 + 2286: 25(ivec4) Load 2285 + 2287: 25(ivec4) VectorShuffle 2286 2284 4 5 2 3 + Store 2285 2287 + 2288: 6(int) Load 8(invocation) + 2289: 71(ptr) AccessChain 31(data) 63 63 + 2290: 25(ivec4) Load 2289 + 2291: 78(ivec3) VectorShuffle 2290 2290 0 1 2 + 2292: 161(bvec3) SLessThan 2291 740 + 2293: 17(ivec4) Load 19(ballot) + 2294: 161(bvec3) GroupNonUniformLogicalAnd 178 PartitionedExclusiveScanNV 2292 2293 + 2295: 78(ivec3) Select 2294 744 740 + 2296: 71(ptr) AccessChain 31(data) 2288 63 + 2297: 25(ivec4) Load 2296 + 2298: 25(ivec4) VectorShuffle 2297 2295 4 5 6 3 + Store 2296 2298 + 2299: 6(int) Load 8(invocation) + 2300: 71(ptr) AccessChain 31(data) 63 63 + 2301: 25(ivec4) Load 2300 + 2302: 169(bvec4) SLessThan 2301 752 + 2303: 17(ivec4) Load 19(ballot) + 2304: 169(bvec4) GroupNonUniformLogicalAnd 178 PartitionedExclusiveScanNV 2302 2303 + 2305: 25(ivec4) Select 2304 756 752 + 2306: 71(ptr) AccessChain 31(data) 2299 63 + Store 2306 2305 + 2307: 6(int) Load 8(invocation) + 2308: 64(ptr) AccessChain 31(data) 34 63 35 + 2309: 24(int) Load 2308 + 2310: 17(ivec4) Load 19(ballot) + 2311: 24(int) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2309 2310 + 2312: 64(ptr) AccessChain 31(data) 2307 63 35 + Store 2312 2311 + 2313: 6(int) Load 8(invocation) + 2314: 71(ptr) AccessChain 31(data) 63 63 + 2315: 25(ivec4) Load 2314 + 2316: 70(ivec2) VectorShuffle 2315 2315 0 1 + 2317: 17(ivec4) Load 19(ballot) + 2318: 70(ivec2) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2316 2317 + 2319: 71(ptr) AccessChain 31(data) 2313 63 + 2320: 25(ivec4) Load 2319 + 2321: 25(ivec4) VectorShuffle 2320 2318 4 5 2 3 + Store 2319 2321 + 2322: 6(int) Load 8(invocation) + 2323: 71(ptr) AccessChain 31(data) 33 63 + 2324: 25(ivec4) Load 2323 + 2325: 78(ivec3) VectorShuffle 2324 2324 0 1 2 + 2326: 17(ivec4) Load 19(ballot) + 2327: 78(ivec3) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2325 2326 + 2328: 71(ptr) AccessChain 31(data) 2322 63 + 2329: 25(ivec4) Load 2328 + 2330: 25(ivec4) VectorShuffle 2329 2327 4 5 6 3 + Store 2328 2330 + 2331: 6(int) Load 8(invocation) + 2332: 71(ptr) AccessChain 31(data) 115 63 + 2333: 25(ivec4) Load 2332 + 2334: 17(ivec4) Load 19(ballot) + 2335: 25(ivec4) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2333 2334 + 2336: 71(ptr) AccessChain 31(data) 2331 63 + Store 2336 2335 + 2337: 6(int) Load 8(invocation) + 2338: 90(ptr) AccessChain 31(data) 34 33 35 + 2339: 6(int) Load 2338 + 2340: 17(ivec4) Load 19(ballot) + 2341: 6(int) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2339 2340 + 2342: 90(ptr) AccessChain 31(data) 2337 33 35 + Store 2342 2341 + 2343: 6(int) Load 8(invocation) + 2344: 40(ptr) AccessChain 31(data) 63 33 + 2345: 17(ivec4) Load 2344 + 2346: 96(ivec2) VectorShuffle 2345 2345 0 1 + 2347: 17(ivec4) Load 19(ballot) + 2348: 96(ivec2) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2346 2347 + 2349: 40(ptr) AccessChain 31(data) 2343 33 + 2350: 17(ivec4) Load 2349 + 2351: 17(ivec4) VectorShuffle 2350 2348 4 5 2 3 + Store 2349 2351 + 2352: 6(int) Load 8(invocation) + 2353: 40(ptr) AccessChain 31(data) 33 33 + 2354: 17(ivec4) Load 2353 + 2355: 103(ivec3) VectorShuffle 2354 2354 0 1 2 + 2356: 17(ivec4) Load 19(ballot) + 2357: 103(ivec3) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2355 2356 + 2358: 40(ptr) AccessChain 31(data) 2352 33 + 2359: 17(ivec4) Load 2358 + 2360: 17(ivec4) VectorShuffle 2359 2357 4 5 6 3 + Store 2358 2360 + 2361: 6(int) Load 8(invocation) + 2362: 40(ptr) AccessChain 31(data) 115 33 + 2363: 17(ivec4) Load 2362 + 2364: 17(ivec4) Load 19(ballot) + 2365: 17(ivec4) GroupNonUniformBitwiseOr 178 PartitionedExclusiveScanNV 2363 2364 + 2366: 40(ptr) AccessChain 31(data) 2361 33 + Store 2366 2365 + 2367: 6(int) Load 8(invocation) + 2368: 64(ptr) AccessChain 31(data) 34 63 35 + 2369: 24(int) Load 2368 + 2370: 144(bool) SLessThan 2369 34 + 2371: 17(ivec4) Load 19(ballot) + 2372: 144(bool) GroupNonUniformLogicalOr 178 PartitionedExclusiveScanNV 2370 2371 + 2373: 24(int) Select 2372 63 34 + 2374: 64(ptr) AccessChain 31(data) 2367 63 35 + Store 2374 2373 + 2375: 6(int) Load 8(invocation) + 2376: 71(ptr) AccessChain 31(data) 63 63 + 2377: 25(ivec4) Load 2376 + 2378: 70(ivec2) VectorShuffle 2377 2377 0 1 + 2379: 152(bvec2) SLessThan 2378 727 + 2380: 17(ivec4) Load 19(ballot) + 2381: 152(bvec2) GroupNonUniformLogicalOr 178 PartitionedExclusiveScanNV 2379 2380 + 2382: 70(ivec2) Select 2381 731 727 + 2383: 71(ptr) AccessChain 31(data) 2375 63 + 2384: 25(ivec4) Load 2383 + 2385: 25(ivec4) VectorShuffle 2384 2382 4 5 2 3 + Store 2383 2385 + 2386: 6(int) Load 8(invocation) + 2387: 71(ptr) AccessChain 31(data) 63 63 + 2388: 25(ivec4) Load 2387 + 2389: 78(ivec3) VectorShuffle 2388 2388 0 1 2 + 2390: 161(bvec3) SLessThan 2389 740 + 2391: 17(ivec4) Load 19(ballot) + 2392: 161(bvec3) GroupNonUniformLogicalOr 178 PartitionedExclusiveScanNV 2390 2391 + 2393: 78(ivec3) Select 2392 744 740 + 2394: 71(ptr) AccessChain 31(data) 2386 63 + 2395: 25(ivec4) Load 2394 + 2396: 25(ivec4) VectorShuffle 2395 2393 4 5 6 3 + Store 2394 2396 + 2397: 6(int) Load 8(invocation) + 2398: 71(ptr) AccessChain 31(data) 63 63 + 2399: 25(ivec4) Load 2398 + 2400: 169(bvec4) SLessThan 2399 752 + 2401: 17(ivec4) Load 19(ballot) + 2402: 169(bvec4) GroupNonUniformLogicalOr 178 PartitionedExclusiveScanNV 2400 2401 + 2403: 25(ivec4) Select 2402 756 752 + 2404: 71(ptr) AccessChain 31(data) 2397 63 + Store 2404 2403 + 2405: 6(int) Load 8(invocation) + 2406: 64(ptr) AccessChain 31(data) 34 63 35 + 2407: 24(int) Load 2406 + 2408: 17(ivec4) Load 19(ballot) + 2409: 24(int) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2407 2408 + 2410: 64(ptr) AccessChain 31(data) 2405 63 35 + Store 2410 2409 + 2411: 6(int) Load 8(invocation) + 2412: 71(ptr) AccessChain 31(data) 63 63 + 2413: 25(ivec4) Load 2412 + 2414: 70(ivec2) VectorShuffle 2413 2413 0 1 + 2415: 17(ivec4) Load 19(ballot) + 2416: 70(ivec2) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2414 2415 + 2417: 71(ptr) AccessChain 31(data) 2411 63 + 2418: 25(ivec4) Load 2417 + 2419: 25(ivec4) VectorShuffle 2418 2416 4 5 2 3 + Store 2417 2419 + 2420: 6(int) Load 8(invocation) + 2421: 71(ptr) AccessChain 31(data) 33 63 + 2422: 25(ivec4) Load 2421 + 2423: 78(ivec3) VectorShuffle 2422 2422 0 1 2 + 2424: 17(ivec4) Load 19(ballot) + 2425: 78(ivec3) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2423 2424 + 2426: 71(ptr) AccessChain 31(data) 2420 63 + 2427: 25(ivec4) Load 2426 + 2428: 25(ivec4) VectorShuffle 2427 2425 4 5 6 3 + Store 2426 2428 + 2429: 6(int) Load 8(invocation) + 2430: 71(ptr) AccessChain 31(data) 115 63 + 2431: 25(ivec4) Load 2430 + 2432: 17(ivec4) Load 19(ballot) + 2433: 25(ivec4) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2431 2432 + 2434: 71(ptr) AccessChain 31(data) 2429 63 + Store 2434 2433 + 2435: 6(int) Load 8(invocation) + 2436: 90(ptr) AccessChain 31(data) 34 33 35 + 2437: 6(int) Load 2436 + 2438: 17(ivec4) Load 19(ballot) + 2439: 6(int) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2437 2438 + 2440: 90(ptr) AccessChain 31(data) 2435 33 35 + Store 2440 2439 + 2441: 6(int) Load 8(invocation) + 2442: 40(ptr) AccessChain 31(data) 63 33 + 2443: 17(ivec4) Load 2442 + 2444: 96(ivec2) VectorShuffle 2443 2443 0 1 + 2445: 17(ivec4) Load 19(ballot) + 2446: 96(ivec2) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2444 2445 + 2447: 40(ptr) AccessChain 31(data) 2441 33 + 2448: 17(ivec4) Load 2447 + 2449: 17(ivec4) VectorShuffle 2448 2446 4 5 2 3 + Store 2447 2449 + 2450: 6(int) Load 8(invocation) + 2451: 40(ptr) AccessChain 31(data) 33 33 + 2452: 17(ivec4) Load 2451 + 2453: 103(ivec3) VectorShuffle 2452 2452 0 1 2 + 2454: 17(ivec4) Load 19(ballot) + 2455: 103(ivec3) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2453 2454 + 2456: 40(ptr) AccessChain 31(data) 2450 33 + 2457: 17(ivec4) Load 2456 + 2458: 17(ivec4) VectorShuffle 2457 2455 4 5 6 3 + Store 2456 2458 + 2459: 6(int) Load 8(invocation) + 2460: 40(ptr) AccessChain 31(data) 115 33 + 2461: 17(ivec4) Load 2460 + 2462: 17(ivec4) Load 19(ballot) + 2463: 17(ivec4) GroupNonUniformBitwiseXor 178 PartitionedExclusiveScanNV 2461 2462 + 2464: 40(ptr) AccessChain 31(data) 2459 33 + Store 2464 2463 + 2465: 6(int) Load 8(invocation) + 2466: 64(ptr) AccessChain 31(data) 34 63 35 + 2467: 24(int) Load 2466 + 2468: 144(bool) SLessThan 2467 34 + 2469: 17(ivec4) Load 19(ballot) + 2470: 144(bool) GroupNonUniformLogicalXor 178 PartitionedExclusiveScanNV 2468 2469 + 2471: 24(int) Select 2470 63 34 + 2472: 64(ptr) AccessChain 31(data) 2465 63 35 + Store 2472 2471 + 2473: 6(int) Load 8(invocation) + 2474: 71(ptr) AccessChain 31(data) 63 63 + 2475: 25(ivec4) Load 2474 + 2476: 70(ivec2) VectorShuffle 2475 2475 0 1 + 2477: 152(bvec2) SLessThan 2476 727 + 2478: 17(ivec4) Load 19(ballot) + 2479: 152(bvec2) GroupNonUniformLogicalXor 178 PartitionedExclusiveScanNV 2477 2478 + 2480: 70(ivec2) Select 2479 731 727 + 2481: 71(ptr) AccessChain 31(data) 2473 63 + 2482: 25(ivec4) Load 2481 + 2483: 25(ivec4) VectorShuffle 2482 2480 4 5 2 3 + Store 2481 2483 + 2484: 6(int) Load 8(invocation) + 2485: 71(ptr) AccessChain 31(data) 63 63 + 2486: 25(ivec4) Load 2485 + 2487: 78(ivec3) VectorShuffle 2486 2486 0 1 2 + 2488: 161(bvec3) SLessThan 2487 740 + 2489: 17(ivec4) Load 19(ballot) + 2490: 161(bvec3) GroupNonUniformLogicalXor 178 PartitionedExclusiveScanNV 2488 2489 + 2491: 78(ivec3) Select 2490 744 740 + 2492: 71(ptr) AccessChain 31(data) 2484 63 + 2493: 25(ivec4) Load 2492 + 2494: 25(ivec4) VectorShuffle 2493 2491 4 5 6 3 + Store 2492 2494 + 2495: 6(int) Load 8(invocation) + 2496: 71(ptr) AccessChain 31(data) 63 63 + 2497: 25(ivec4) Load 2496 + 2498: 169(bvec4) SLessThan 2497 752 + 2499: 17(ivec4) Load 19(ballot) + 2500: 169(bvec4) GroupNonUniformLogicalXor 178 PartitionedExclusiveScanNV 2498 2499 + 2501: 25(ivec4) Select 2500 756 752 + 2502: 71(ptr) AccessChain 31(data) 2495 63 + Store 2502 2501 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupQuad.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupQuad.comp.out new file mode 100644 index 00000000000..435c490f439 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupQuad.comp.out @@ -0,0 +1,739 @@ +spv.subgroupQuad.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 616 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformQuad + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 1 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_KHR_shader_subgroup_quad" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 24 "Buffers" + MemberName 24(Buffers) 0 "f4" + MemberName 24(Buffers) 1 "i4" + MemberName 24(Buffers) 2 "u4" + MemberName 24(Buffers) 3 "d4" + Name 27 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 24(Buffers) 0 Offset 0 + MemberDecorate 24(Buffers) 1 Offset 16 + MemberDecorate 24(Buffers) 2 Offset 32 + MemberDecorate 24(Buffers) 3 Offset 64 + Decorate 24(Buffers) Block + Decorate 27(data) DescriptorSet 0 + Decorate 27(data) Binding 0 + Decorate 615 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeFloat 32 + 18: TypeVector 17(float) 4 + 19: TypeInt 32 1 + 20: TypeVector 19(int) 4 + 21: TypeVector 6(int) 4 + 22: TypeFloat 64 + 23: TypeVector 22(float64_t) 4 + 24(Buffers): TypeStruct 18(fvec4) 20(ivec4) 21(ivec4) 23(f64vec4) + 25: TypeArray 24(Buffers) 15 + 26: TypePointer StorageBuffer 25 + 27(data): 26(ptr) Variable StorageBuffer + 29: 19(int) Constant 0 + 30: 6(int) Constant 0 + 31: TypePointer StorageBuffer 17(float) + 34: 6(int) Constant 1 + 35: 6(int) Constant 3 + 39: 19(int) Constant 1 + 40: TypeVector 17(float) 2 + 41: TypePointer StorageBuffer 18(fvec4) + 50: 19(int) Constant 2 + 51: TypeVector 17(float) 3 + 60: 19(int) Constant 3 + 66: TypePointer StorageBuffer 19(int) + 72: TypeVector 19(int) 2 + 73: TypePointer StorageBuffer 20(ivec4) + 82: TypeVector 19(int) 3 + 96: TypePointer StorageBuffer 6(int) + 102: TypeVector 6(int) 2 + 103: TypePointer StorageBuffer 21(ivec4) + 112: TypeVector 6(int) 3 + 126: TypePointer StorageBuffer 22(float64_t) + 132: TypeVector 22(float64_t) 2 + 133: TypePointer StorageBuffer 23(f64vec4) + 142: TypeVector 22(float64_t) 3 + 158: TypeBool + 167: 72(ivec2) ConstantComposite 29 29 + 168: TypeVector 158(bool) 2 + 171: 72(ivec2) ConstantComposite 39 39 + 180: 82(ivec3) ConstantComposite 29 29 29 + 181: TypeVector 158(bool) 3 + 184: 82(ivec3) ConstantComposite 39 39 39 + 192: 20(ivec4) ConstantComposite 29 29 29 29 + 193: TypeVector 158(bool) 4 + 196: 20(ivec4) ConstantComposite 39 39 39 39 + 478: 6(int) Constant 2 + 614: 6(int) Constant 8 + 615: 112(ivec3) ConstantComposite 614 34 34 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 28: 6(int) Load 8(invocation) + 32: 31(ptr) AccessChain 27(data) 29 29 30 + 33: 17(float) Load 32 + 36: 17(float) GroupNonUniformQuadBroadcast 35 33 34 + 37: 31(ptr) AccessChain 27(data) 28 29 30 + Store 37 36 + 38: 6(int) Load 8(invocation) + 42: 41(ptr) AccessChain 27(data) 39 29 + 43: 18(fvec4) Load 42 + 44: 40(fvec2) VectorShuffle 43 43 0 1 + 45: 40(fvec2) GroupNonUniformQuadBroadcast 35 44 34 + 46: 41(ptr) AccessChain 27(data) 38 29 + 47: 18(fvec4) Load 46 + 48: 18(fvec4) VectorShuffle 47 45 4 5 2 3 + Store 46 48 + 49: 6(int) Load 8(invocation) + 52: 41(ptr) AccessChain 27(data) 50 29 + 53: 18(fvec4) Load 52 + 54: 51(fvec3) VectorShuffle 53 53 0 1 2 + 55: 51(fvec3) GroupNonUniformQuadBroadcast 35 54 34 + 56: 41(ptr) AccessChain 27(data) 49 29 + 57: 18(fvec4) Load 56 + 58: 18(fvec4) VectorShuffle 57 55 4 5 6 3 + Store 56 58 + 59: 6(int) Load 8(invocation) + 61: 41(ptr) AccessChain 27(data) 60 29 + 62: 18(fvec4) Load 61 + 63: 18(fvec4) GroupNonUniformQuadBroadcast 35 62 34 + 64: 41(ptr) AccessChain 27(data) 59 29 + Store 64 63 + 65: 6(int) Load 8(invocation) + 67: 66(ptr) AccessChain 27(data) 29 39 30 + 68: 19(int) Load 67 + 69: 19(int) GroupNonUniformQuadBroadcast 35 68 34 + 70: 66(ptr) AccessChain 27(data) 65 39 30 + Store 70 69 + 71: 6(int) Load 8(invocation) + 74: 73(ptr) AccessChain 27(data) 39 39 + 75: 20(ivec4) Load 74 + 76: 72(ivec2) VectorShuffle 75 75 0 1 + 77: 72(ivec2) GroupNonUniformQuadBroadcast 35 76 34 + 78: 73(ptr) AccessChain 27(data) 71 39 + 79: 20(ivec4) Load 78 + 80: 20(ivec4) VectorShuffle 79 77 4 5 2 3 + Store 78 80 + 81: 6(int) Load 8(invocation) + 83: 73(ptr) AccessChain 27(data) 50 39 + 84: 20(ivec4) Load 83 + 85: 82(ivec3) VectorShuffle 84 84 0 1 2 + 86: 82(ivec3) GroupNonUniformQuadBroadcast 35 85 34 + 87: 73(ptr) AccessChain 27(data) 81 39 + 88: 20(ivec4) Load 87 + 89: 20(ivec4) VectorShuffle 88 86 4 5 6 3 + Store 87 89 + 90: 6(int) Load 8(invocation) + 91: 73(ptr) AccessChain 27(data) 60 39 + 92: 20(ivec4) Load 91 + 93: 20(ivec4) GroupNonUniformQuadBroadcast 35 92 34 + 94: 73(ptr) AccessChain 27(data) 90 39 + Store 94 93 + 95: 6(int) Load 8(invocation) + 97: 96(ptr) AccessChain 27(data) 29 50 30 + 98: 6(int) Load 97 + 99: 6(int) GroupNonUniformQuadBroadcast 35 98 34 + 100: 96(ptr) AccessChain 27(data) 95 50 30 + Store 100 99 + 101: 6(int) Load 8(invocation) + 104: 103(ptr) AccessChain 27(data) 39 50 + 105: 21(ivec4) Load 104 + 106: 102(ivec2) VectorShuffle 105 105 0 1 + 107: 102(ivec2) GroupNonUniformQuadBroadcast 35 106 34 + 108: 103(ptr) AccessChain 27(data) 101 50 + 109: 21(ivec4) Load 108 + 110: 21(ivec4) VectorShuffle 109 107 4 5 2 3 + Store 108 110 + 111: 6(int) Load 8(invocation) + 113: 103(ptr) AccessChain 27(data) 50 50 + 114: 21(ivec4) Load 113 + 115: 112(ivec3) VectorShuffle 114 114 0 1 2 + 116: 112(ivec3) GroupNonUniformQuadBroadcast 35 115 34 + 117: 103(ptr) AccessChain 27(data) 111 50 + 118: 21(ivec4) Load 117 + 119: 21(ivec4) VectorShuffle 118 116 4 5 6 3 + Store 117 119 + 120: 6(int) Load 8(invocation) + 121: 103(ptr) AccessChain 27(data) 60 50 + 122: 21(ivec4) Load 121 + 123: 21(ivec4) GroupNonUniformQuadBroadcast 35 122 34 + 124: 103(ptr) AccessChain 27(data) 120 50 + Store 124 123 + 125: 6(int) Load 8(invocation) + 127: 126(ptr) AccessChain 27(data) 29 60 30 + 128:22(float64_t) Load 127 + 129:22(float64_t) GroupNonUniformQuadBroadcast 35 128 34 + 130: 126(ptr) AccessChain 27(data) 125 60 30 + Store 130 129 + 131: 6(int) Load 8(invocation) + 134: 133(ptr) AccessChain 27(data) 39 60 + 135: 23(f64vec4) Load 134 + 136:132(f64vec2) VectorShuffle 135 135 0 1 + 137:132(f64vec2) GroupNonUniformQuadBroadcast 35 136 34 + 138: 133(ptr) AccessChain 27(data) 131 60 + 139: 23(f64vec4) Load 138 + 140: 23(f64vec4) VectorShuffle 139 137 4 5 2 3 + Store 138 140 + 141: 6(int) Load 8(invocation) + 143: 133(ptr) AccessChain 27(data) 50 60 + 144: 23(f64vec4) Load 143 + 145:142(f64vec3) VectorShuffle 144 144 0 1 2 + 146:142(f64vec3) GroupNonUniformQuadBroadcast 35 145 34 + 147: 133(ptr) AccessChain 27(data) 141 60 + 148: 23(f64vec4) Load 147 + 149: 23(f64vec4) VectorShuffle 148 146 4 5 6 3 + Store 147 149 + 150: 6(int) Load 8(invocation) + 151: 133(ptr) AccessChain 27(data) 60 60 + 152: 23(f64vec4) Load 151 + 153: 23(f64vec4) GroupNonUniformQuadBroadcast 35 152 34 + 154: 133(ptr) AccessChain 27(data) 150 60 + Store 154 153 + 155: 6(int) Load 8(invocation) + 156: 66(ptr) AccessChain 27(data) 29 39 30 + 157: 19(int) Load 156 + 159: 158(bool) SLessThan 157 29 + 160: 158(bool) GroupNonUniformQuadBroadcast 35 159 34 + 161: 19(int) Select 160 39 29 + 162: 66(ptr) AccessChain 27(data) 155 39 30 + Store 162 161 + 163: 6(int) Load 8(invocation) + 164: 73(ptr) AccessChain 27(data) 39 39 + 165: 20(ivec4) Load 164 + 166: 72(ivec2) VectorShuffle 165 165 0 1 + 169: 168(bvec2) SLessThan 166 167 + 170: 168(bvec2) GroupNonUniformQuadBroadcast 35 169 34 + 172: 72(ivec2) Select 170 171 167 + 173: 73(ptr) AccessChain 27(data) 163 39 + 174: 20(ivec4) Load 173 + 175: 20(ivec4) VectorShuffle 174 172 4 5 2 3 + Store 173 175 + 176: 6(int) Load 8(invocation) + 177: 73(ptr) AccessChain 27(data) 39 39 + 178: 20(ivec4) Load 177 + 179: 82(ivec3) VectorShuffle 178 178 0 1 2 + 182: 181(bvec3) SLessThan 179 180 + 183: 181(bvec3) GroupNonUniformQuadBroadcast 35 182 34 + 185: 82(ivec3) Select 183 184 180 + 186: 73(ptr) AccessChain 27(data) 176 39 + 187: 20(ivec4) Load 186 + 188: 20(ivec4) VectorShuffle 187 185 4 5 6 3 + Store 186 188 + 189: 6(int) Load 8(invocation) + 190: 73(ptr) AccessChain 27(data) 39 39 + 191: 20(ivec4) Load 190 + 194: 193(bvec4) SLessThan 191 192 + 195: 193(bvec4) GroupNonUniformQuadBroadcast 35 194 34 + 197: 20(ivec4) Select 195 196 192 + 198: 73(ptr) AccessChain 27(data) 189 39 + Store 198 197 + 199: 6(int) Load 8(invocation) + 200: 31(ptr) AccessChain 27(data) 29 29 30 + 201: 17(float) Load 200 + 202: 17(float) GroupNonUniformQuadSwap 35 201 30 + 203: 31(ptr) AccessChain 27(data) 199 29 30 + Store 203 202 + 204: 6(int) Load 8(invocation) + 205: 41(ptr) AccessChain 27(data) 39 29 + 206: 18(fvec4) Load 205 + 207: 40(fvec2) VectorShuffle 206 206 0 1 + 208: 40(fvec2) GroupNonUniformQuadSwap 35 207 30 + 209: 41(ptr) AccessChain 27(data) 204 29 + 210: 18(fvec4) Load 209 + 211: 18(fvec4) VectorShuffle 210 208 4 5 2 3 + Store 209 211 + 212: 6(int) Load 8(invocation) + 213: 41(ptr) AccessChain 27(data) 50 29 + 214: 18(fvec4) Load 213 + 215: 51(fvec3) VectorShuffle 214 214 0 1 2 + 216: 51(fvec3) GroupNonUniformQuadSwap 35 215 30 + 217: 41(ptr) AccessChain 27(data) 212 29 + 218: 18(fvec4) Load 217 + 219: 18(fvec4) VectorShuffle 218 216 4 5 6 3 + Store 217 219 + 220: 6(int) Load 8(invocation) + 221: 41(ptr) AccessChain 27(data) 60 29 + 222: 18(fvec4) Load 221 + 223: 18(fvec4) GroupNonUniformQuadSwap 35 222 30 + 224: 41(ptr) AccessChain 27(data) 220 29 + Store 224 223 + 225: 6(int) Load 8(invocation) + 226: 66(ptr) AccessChain 27(data) 29 39 30 + 227: 19(int) Load 226 + 228: 19(int) GroupNonUniformQuadSwap 35 227 30 + 229: 66(ptr) AccessChain 27(data) 225 39 30 + Store 229 228 + 230: 6(int) Load 8(invocation) + 231: 73(ptr) AccessChain 27(data) 39 39 + 232: 20(ivec4) Load 231 + 233: 72(ivec2) VectorShuffle 232 232 0 1 + 234: 72(ivec2) GroupNonUniformQuadSwap 35 233 30 + 235: 73(ptr) AccessChain 27(data) 230 39 + 236: 20(ivec4) Load 235 + 237: 20(ivec4) VectorShuffle 236 234 4 5 2 3 + Store 235 237 + 238: 6(int) Load 8(invocation) + 239: 73(ptr) AccessChain 27(data) 50 39 + 240: 20(ivec4) Load 239 + 241: 82(ivec3) VectorShuffle 240 240 0 1 2 + 242: 82(ivec3) GroupNonUniformQuadSwap 35 241 30 + 243: 73(ptr) AccessChain 27(data) 238 39 + 244: 20(ivec4) Load 243 + 245: 20(ivec4) VectorShuffle 244 242 4 5 6 3 + Store 243 245 + 246: 6(int) Load 8(invocation) + 247: 73(ptr) AccessChain 27(data) 60 39 + 248: 20(ivec4) Load 247 + 249: 20(ivec4) GroupNonUniformQuadSwap 35 248 30 + 250: 73(ptr) AccessChain 27(data) 246 39 + Store 250 249 + 251: 6(int) Load 8(invocation) + 252: 96(ptr) AccessChain 27(data) 29 50 30 + 253: 6(int) Load 252 + 254: 6(int) GroupNonUniformQuadSwap 35 253 30 + 255: 96(ptr) AccessChain 27(data) 251 50 30 + Store 255 254 + 256: 6(int) Load 8(invocation) + 257: 103(ptr) AccessChain 27(data) 39 50 + 258: 21(ivec4) Load 257 + 259: 102(ivec2) VectorShuffle 258 258 0 1 + 260: 102(ivec2) GroupNonUniformQuadSwap 35 259 30 + 261: 103(ptr) AccessChain 27(data) 256 50 + 262: 21(ivec4) Load 261 + 263: 21(ivec4) VectorShuffle 262 260 4 5 2 3 + Store 261 263 + 264: 6(int) Load 8(invocation) + 265: 103(ptr) AccessChain 27(data) 50 50 + 266: 21(ivec4) Load 265 + 267: 112(ivec3) VectorShuffle 266 266 0 1 2 + 268: 112(ivec3) GroupNonUniformQuadSwap 35 267 30 + 269: 103(ptr) AccessChain 27(data) 264 50 + 270: 21(ivec4) Load 269 + 271: 21(ivec4) VectorShuffle 270 268 4 5 6 3 + Store 269 271 + 272: 6(int) Load 8(invocation) + 273: 103(ptr) AccessChain 27(data) 60 50 + 274: 21(ivec4) Load 273 + 275: 21(ivec4) GroupNonUniformQuadSwap 35 274 30 + 276: 103(ptr) AccessChain 27(data) 272 50 + Store 276 275 + 277: 6(int) Load 8(invocation) + 278: 126(ptr) AccessChain 27(data) 29 60 30 + 279:22(float64_t) Load 278 + 280:22(float64_t) GroupNonUniformQuadSwap 35 279 30 + 281: 126(ptr) AccessChain 27(data) 277 60 30 + Store 281 280 + 282: 6(int) Load 8(invocation) + 283: 133(ptr) AccessChain 27(data) 39 60 + 284: 23(f64vec4) Load 283 + 285:132(f64vec2) VectorShuffle 284 284 0 1 + 286:132(f64vec2) GroupNonUniformQuadSwap 35 285 30 + 287: 133(ptr) AccessChain 27(data) 282 60 + 288: 23(f64vec4) Load 287 + 289: 23(f64vec4) VectorShuffle 288 286 4 5 2 3 + Store 287 289 + 290: 6(int) Load 8(invocation) + 291: 133(ptr) AccessChain 27(data) 50 60 + 292: 23(f64vec4) Load 291 + 293:142(f64vec3) VectorShuffle 292 292 0 1 2 + 294:142(f64vec3) GroupNonUniformQuadSwap 35 293 30 + 295: 133(ptr) AccessChain 27(data) 290 60 + 296: 23(f64vec4) Load 295 + 297: 23(f64vec4) VectorShuffle 296 294 4 5 6 3 + Store 295 297 + 298: 6(int) Load 8(invocation) + 299: 133(ptr) AccessChain 27(data) 60 60 + 300: 23(f64vec4) Load 299 + 301: 23(f64vec4) GroupNonUniformQuadSwap 35 300 30 + 302: 133(ptr) AccessChain 27(data) 298 60 + Store 302 301 + 303: 6(int) Load 8(invocation) + 304: 66(ptr) AccessChain 27(data) 29 39 30 + 305: 19(int) Load 304 + 306: 158(bool) SLessThan 305 29 + 307: 158(bool) GroupNonUniformQuadSwap 35 306 30 + 308: 19(int) Select 307 39 29 + 309: 66(ptr) AccessChain 27(data) 303 39 30 + Store 309 308 + 310: 6(int) Load 8(invocation) + 311: 73(ptr) AccessChain 27(data) 39 39 + 312: 20(ivec4) Load 311 + 313: 72(ivec2) VectorShuffle 312 312 0 1 + 314: 168(bvec2) SLessThan 313 167 + 315: 168(bvec2) GroupNonUniformQuadSwap 35 314 30 + 316: 72(ivec2) Select 315 171 167 + 317: 73(ptr) AccessChain 27(data) 310 39 + 318: 20(ivec4) Load 317 + 319: 20(ivec4) VectorShuffle 318 316 4 5 2 3 + Store 317 319 + 320: 6(int) Load 8(invocation) + 321: 73(ptr) AccessChain 27(data) 39 39 + 322: 20(ivec4) Load 321 + 323: 82(ivec3) VectorShuffle 322 322 0 1 2 + 324: 181(bvec3) SLessThan 323 180 + 325: 181(bvec3) GroupNonUniformQuadSwap 35 324 30 + 326: 82(ivec3) Select 325 184 180 + 327: 73(ptr) AccessChain 27(data) 320 39 + 328: 20(ivec4) Load 327 + 329: 20(ivec4) VectorShuffle 328 326 4 5 6 3 + Store 327 329 + 330: 6(int) Load 8(invocation) + 331: 73(ptr) AccessChain 27(data) 39 39 + 332: 20(ivec4) Load 331 + 333: 193(bvec4) SLessThan 332 192 + 334: 193(bvec4) GroupNonUniformQuadSwap 35 333 30 + 335: 20(ivec4) Select 334 196 192 + 336: 73(ptr) AccessChain 27(data) 330 39 + Store 336 335 + 337: 6(int) Load 8(invocation) + 338: 31(ptr) AccessChain 27(data) 29 29 30 + 339: 17(float) Load 338 + 340: 17(float) GroupNonUniformQuadSwap 35 339 34 + 341: 31(ptr) AccessChain 27(data) 337 29 30 + Store 341 340 + 342: 6(int) Load 8(invocation) + 343: 41(ptr) AccessChain 27(data) 39 29 + 344: 18(fvec4) Load 343 + 345: 40(fvec2) VectorShuffle 344 344 0 1 + 346: 40(fvec2) GroupNonUniformQuadSwap 35 345 34 + 347: 41(ptr) AccessChain 27(data) 342 29 + 348: 18(fvec4) Load 347 + 349: 18(fvec4) VectorShuffle 348 346 4 5 2 3 + Store 347 349 + 350: 6(int) Load 8(invocation) + 351: 41(ptr) AccessChain 27(data) 50 29 + 352: 18(fvec4) Load 351 + 353: 51(fvec3) VectorShuffle 352 352 0 1 2 + 354: 51(fvec3) GroupNonUniformQuadSwap 35 353 34 + 355: 41(ptr) AccessChain 27(data) 350 29 + 356: 18(fvec4) Load 355 + 357: 18(fvec4) VectorShuffle 356 354 4 5 6 3 + Store 355 357 + 358: 6(int) Load 8(invocation) + 359: 41(ptr) AccessChain 27(data) 60 29 + 360: 18(fvec4) Load 359 + 361: 18(fvec4) GroupNonUniformQuadSwap 35 360 34 + 362: 41(ptr) AccessChain 27(data) 358 29 + Store 362 361 + 363: 6(int) Load 8(invocation) + 364: 66(ptr) AccessChain 27(data) 29 39 30 + 365: 19(int) Load 364 + 366: 19(int) GroupNonUniformQuadSwap 35 365 34 + 367: 66(ptr) AccessChain 27(data) 363 39 30 + Store 367 366 + 368: 6(int) Load 8(invocation) + 369: 73(ptr) AccessChain 27(data) 39 39 + 370: 20(ivec4) Load 369 + 371: 72(ivec2) VectorShuffle 370 370 0 1 + 372: 72(ivec2) GroupNonUniformQuadSwap 35 371 34 + 373: 73(ptr) AccessChain 27(data) 368 39 + 374: 20(ivec4) Load 373 + 375: 20(ivec4) VectorShuffle 374 372 4 5 2 3 + Store 373 375 + 376: 6(int) Load 8(invocation) + 377: 73(ptr) AccessChain 27(data) 50 39 + 378: 20(ivec4) Load 377 + 379: 82(ivec3) VectorShuffle 378 378 0 1 2 + 380: 82(ivec3) GroupNonUniformQuadSwap 35 379 34 + 381: 73(ptr) AccessChain 27(data) 376 39 + 382: 20(ivec4) Load 381 + 383: 20(ivec4) VectorShuffle 382 380 4 5 6 3 + Store 381 383 + 384: 6(int) Load 8(invocation) + 385: 73(ptr) AccessChain 27(data) 60 39 + 386: 20(ivec4) Load 385 + 387: 20(ivec4) GroupNonUniformQuadSwap 35 386 34 + 388: 73(ptr) AccessChain 27(data) 384 39 + Store 388 387 + 389: 6(int) Load 8(invocation) + 390: 96(ptr) AccessChain 27(data) 29 50 30 + 391: 6(int) Load 390 + 392: 6(int) GroupNonUniformQuadSwap 35 391 34 + 393: 96(ptr) AccessChain 27(data) 389 50 30 + Store 393 392 + 394: 6(int) Load 8(invocation) + 395: 103(ptr) AccessChain 27(data) 39 50 + 396: 21(ivec4) Load 395 + 397: 102(ivec2) VectorShuffle 396 396 0 1 + 398: 102(ivec2) GroupNonUniformQuadSwap 35 397 34 + 399: 103(ptr) AccessChain 27(data) 394 50 + 400: 21(ivec4) Load 399 + 401: 21(ivec4) VectorShuffle 400 398 4 5 2 3 + Store 399 401 + 402: 6(int) Load 8(invocation) + 403: 103(ptr) AccessChain 27(data) 50 50 + 404: 21(ivec4) Load 403 + 405: 112(ivec3) VectorShuffle 404 404 0 1 2 + 406: 112(ivec3) GroupNonUniformQuadSwap 35 405 34 + 407: 103(ptr) AccessChain 27(data) 402 50 + 408: 21(ivec4) Load 407 + 409: 21(ivec4) VectorShuffle 408 406 4 5 6 3 + Store 407 409 + 410: 6(int) Load 8(invocation) + 411: 103(ptr) AccessChain 27(data) 60 50 + 412: 21(ivec4) Load 411 + 413: 21(ivec4) GroupNonUniformQuadSwap 35 412 34 + 414: 103(ptr) AccessChain 27(data) 410 50 + Store 414 413 + 415: 6(int) Load 8(invocation) + 416: 126(ptr) AccessChain 27(data) 29 60 30 + 417:22(float64_t) Load 416 + 418:22(float64_t) GroupNonUniformQuadSwap 35 417 34 + 419: 126(ptr) AccessChain 27(data) 415 60 30 + Store 419 418 + 420: 6(int) Load 8(invocation) + 421: 133(ptr) AccessChain 27(data) 39 60 + 422: 23(f64vec4) Load 421 + 423:132(f64vec2) VectorShuffle 422 422 0 1 + 424:132(f64vec2) GroupNonUniformQuadSwap 35 423 34 + 425: 133(ptr) AccessChain 27(data) 420 60 + 426: 23(f64vec4) Load 425 + 427: 23(f64vec4) VectorShuffle 426 424 4 5 2 3 + Store 425 427 + 428: 6(int) Load 8(invocation) + 429: 133(ptr) AccessChain 27(data) 50 60 + 430: 23(f64vec4) Load 429 + 431:142(f64vec3) VectorShuffle 430 430 0 1 2 + 432:142(f64vec3) GroupNonUniformQuadSwap 35 431 34 + 433: 133(ptr) AccessChain 27(data) 428 60 + 434: 23(f64vec4) Load 433 + 435: 23(f64vec4) VectorShuffle 434 432 4 5 6 3 + Store 433 435 + 436: 6(int) Load 8(invocation) + 437: 133(ptr) AccessChain 27(data) 60 60 + 438: 23(f64vec4) Load 437 + 439: 23(f64vec4) GroupNonUniformQuadSwap 35 438 34 + 440: 133(ptr) AccessChain 27(data) 436 60 + Store 440 439 + 441: 6(int) Load 8(invocation) + 442: 66(ptr) AccessChain 27(data) 29 39 30 + 443: 19(int) Load 442 + 444: 158(bool) SLessThan 443 29 + 445: 158(bool) GroupNonUniformQuadSwap 35 444 34 + 446: 19(int) Select 445 39 29 + 447: 66(ptr) AccessChain 27(data) 441 39 30 + Store 447 446 + 448: 6(int) Load 8(invocation) + 449: 73(ptr) AccessChain 27(data) 39 39 + 450: 20(ivec4) Load 449 + 451: 72(ivec2) VectorShuffle 450 450 0 1 + 452: 168(bvec2) SLessThan 451 167 + 453: 168(bvec2) GroupNonUniformQuadSwap 35 452 34 + 454: 72(ivec2) Select 453 171 167 + 455: 73(ptr) AccessChain 27(data) 448 39 + 456: 20(ivec4) Load 455 + 457: 20(ivec4) VectorShuffle 456 454 4 5 2 3 + Store 455 457 + 458: 6(int) Load 8(invocation) + 459: 73(ptr) AccessChain 27(data) 39 39 + 460: 20(ivec4) Load 459 + 461: 82(ivec3) VectorShuffle 460 460 0 1 2 + 462: 181(bvec3) SLessThan 461 180 + 463: 181(bvec3) GroupNonUniformQuadSwap 35 462 34 + 464: 82(ivec3) Select 463 184 180 + 465: 73(ptr) AccessChain 27(data) 458 39 + 466: 20(ivec4) Load 465 + 467: 20(ivec4) VectorShuffle 466 464 4 5 6 3 + Store 465 467 + 468: 6(int) Load 8(invocation) + 469: 73(ptr) AccessChain 27(data) 39 39 + 470: 20(ivec4) Load 469 + 471: 193(bvec4) SLessThan 470 192 + 472: 193(bvec4) GroupNonUniformQuadSwap 35 471 34 + 473: 20(ivec4) Select 472 196 192 + 474: 73(ptr) AccessChain 27(data) 468 39 + Store 474 473 + 475: 6(int) Load 8(invocation) + 476: 31(ptr) AccessChain 27(data) 29 29 30 + 477: 17(float) Load 476 + 479: 17(float) GroupNonUniformQuadSwap 35 477 478 + 480: 31(ptr) AccessChain 27(data) 475 29 30 + Store 480 479 + 481: 6(int) Load 8(invocation) + 482: 41(ptr) AccessChain 27(data) 39 29 + 483: 18(fvec4) Load 482 + 484: 40(fvec2) VectorShuffle 483 483 0 1 + 485: 40(fvec2) GroupNonUniformQuadSwap 35 484 478 + 486: 41(ptr) AccessChain 27(data) 481 29 + 487: 18(fvec4) Load 486 + 488: 18(fvec4) VectorShuffle 487 485 4 5 2 3 + Store 486 488 + 489: 6(int) Load 8(invocation) + 490: 41(ptr) AccessChain 27(data) 50 29 + 491: 18(fvec4) Load 490 + 492: 51(fvec3) VectorShuffle 491 491 0 1 2 + 493: 51(fvec3) GroupNonUniformQuadSwap 35 492 478 + 494: 41(ptr) AccessChain 27(data) 489 29 + 495: 18(fvec4) Load 494 + 496: 18(fvec4) VectorShuffle 495 493 4 5 6 3 + Store 494 496 + 497: 6(int) Load 8(invocation) + 498: 41(ptr) AccessChain 27(data) 60 29 + 499: 18(fvec4) Load 498 + 500: 18(fvec4) GroupNonUniformQuadSwap 35 499 478 + 501: 41(ptr) AccessChain 27(data) 497 29 + Store 501 500 + 502: 6(int) Load 8(invocation) + 503: 66(ptr) AccessChain 27(data) 29 39 30 + 504: 19(int) Load 503 + 505: 19(int) GroupNonUniformQuadSwap 35 504 478 + 506: 66(ptr) AccessChain 27(data) 502 39 30 + Store 506 505 + 507: 6(int) Load 8(invocation) + 508: 73(ptr) AccessChain 27(data) 39 39 + 509: 20(ivec4) Load 508 + 510: 72(ivec2) VectorShuffle 509 509 0 1 + 511: 72(ivec2) GroupNonUniformQuadSwap 35 510 478 + 512: 73(ptr) AccessChain 27(data) 507 39 + 513: 20(ivec4) Load 512 + 514: 20(ivec4) VectorShuffle 513 511 4 5 2 3 + Store 512 514 + 515: 6(int) Load 8(invocation) + 516: 73(ptr) AccessChain 27(data) 50 39 + 517: 20(ivec4) Load 516 + 518: 82(ivec3) VectorShuffle 517 517 0 1 2 + 519: 82(ivec3) GroupNonUniformQuadSwap 35 518 478 + 520: 73(ptr) AccessChain 27(data) 515 39 + 521: 20(ivec4) Load 520 + 522: 20(ivec4) VectorShuffle 521 519 4 5 6 3 + Store 520 522 + 523: 6(int) Load 8(invocation) + 524: 73(ptr) AccessChain 27(data) 60 39 + 525: 20(ivec4) Load 524 + 526: 20(ivec4) GroupNonUniformQuadSwap 35 525 478 + 527: 73(ptr) AccessChain 27(data) 523 39 + Store 527 526 + 528: 6(int) Load 8(invocation) + 529: 96(ptr) AccessChain 27(data) 29 50 30 + 530: 6(int) Load 529 + 531: 6(int) GroupNonUniformQuadSwap 35 530 478 + 532: 96(ptr) AccessChain 27(data) 528 50 30 + Store 532 531 + 533: 6(int) Load 8(invocation) + 534: 103(ptr) AccessChain 27(data) 39 50 + 535: 21(ivec4) Load 534 + 536: 102(ivec2) VectorShuffle 535 535 0 1 + 537: 102(ivec2) GroupNonUniformQuadSwap 35 536 478 + 538: 103(ptr) AccessChain 27(data) 533 50 + 539: 21(ivec4) Load 538 + 540: 21(ivec4) VectorShuffle 539 537 4 5 2 3 + Store 538 540 + 541: 6(int) Load 8(invocation) + 542: 103(ptr) AccessChain 27(data) 50 50 + 543: 21(ivec4) Load 542 + 544: 112(ivec3) VectorShuffle 543 543 0 1 2 + 545: 112(ivec3) GroupNonUniformQuadSwap 35 544 478 + 546: 103(ptr) AccessChain 27(data) 541 50 + 547: 21(ivec4) Load 546 + 548: 21(ivec4) VectorShuffle 547 545 4 5 6 3 + Store 546 548 + 549: 6(int) Load 8(invocation) + 550: 103(ptr) AccessChain 27(data) 60 50 + 551: 21(ivec4) Load 550 + 552: 21(ivec4) GroupNonUniformQuadSwap 35 551 478 + 553: 103(ptr) AccessChain 27(data) 549 50 + Store 553 552 + 554: 6(int) Load 8(invocation) + 555: 126(ptr) AccessChain 27(data) 29 60 30 + 556:22(float64_t) Load 555 + 557:22(float64_t) GroupNonUniformQuadSwap 35 556 478 + 558: 126(ptr) AccessChain 27(data) 554 60 30 + Store 558 557 + 559: 6(int) Load 8(invocation) + 560: 133(ptr) AccessChain 27(data) 39 60 + 561: 23(f64vec4) Load 560 + 562:132(f64vec2) VectorShuffle 561 561 0 1 + 563:132(f64vec2) GroupNonUniformQuadSwap 35 562 478 + 564: 133(ptr) AccessChain 27(data) 559 60 + 565: 23(f64vec4) Load 564 + 566: 23(f64vec4) VectorShuffle 565 563 4 5 2 3 + Store 564 566 + 567: 6(int) Load 8(invocation) + 568: 133(ptr) AccessChain 27(data) 50 60 + 569: 23(f64vec4) Load 568 + 570:142(f64vec3) VectorShuffle 569 569 0 1 2 + 571:142(f64vec3) GroupNonUniformQuadSwap 35 570 478 + 572: 133(ptr) AccessChain 27(data) 567 60 + 573: 23(f64vec4) Load 572 + 574: 23(f64vec4) VectorShuffle 573 571 4 5 6 3 + Store 572 574 + 575: 6(int) Load 8(invocation) + 576: 133(ptr) AccessChain 27(data) 60 60 + 577: 23(f64vec4) Load 576 + 578: 23(f64vec4) GroupNonUniformQuadSwap 35 577 478 + 579: 133(ptr) AccessChain 27(data) 575 60 + Store 579 578 + 580: 6(int) Load 8(invocation) + 581: 66(ptr) AccessChain 27(data) 29 39 30 + 582: 19(int) Load 581 + 583: 158(bool) SLessThan 582 29 + 584: 158(bool) GroupNonUniformQuadSwap 35 583 478 + 585: 19(int) Select 584 39 29 + 586: 66(ptr) AccessChain 27(data) 580 39 30 + Store 586 585 + 587: 6(int) Load 8(invocation) + 588: 73(ptr) AccessChain 27(data) 39 39 + 589: 20(ivec4) Load 588 + 590: 72(ivec2) VectorShuffle 589 589 0 1 + 591: 168(bvec2) SLessThan 590 167 + 592: 168(bvec2) GroupNonUniformQuadSwap 35 591 478 + 593: 72(ivec2) Select 592 171 167 + 594: 73(ptr) AccessChain 27(data) 587 39 + 595: 20(ivec4) Load 594 + 596: 20(ivec4) VectorShuffle 595 593 4 5 2 3 + Store 594 596 + 597: 6(int) Load 8(invocation) + 598: 73(ptr) AccessChain 27(data) 39 39 + 599: 20(ivec4) Load 598 + 600: 82(ivec3) VectorShuffle 599 599 0 1 2 + 601: 181(bvec3) SLessThan 600 180 + 602: 181(bvec3) GroupNonUniformQuadSwap 35 601 478 + 603: 82(ivec3) Select 602 184 180 + 604: 73(ptr) AccessChain 27(data) 597 39 + 605: 20(ivec4) Load 604 + 606: 20(ivec4) VectorShuffle 605 603 4 5 6 3 + Store 604 606 + 607: 6(int) Load 8(invocation) + 608: 73(ptr) AccessChain 27(data) 39 39 + 609: 20(ivec4) Load 608 + 610: 193(bvec4) SLessThan 609 192 + 611: 193(bvec4) GroupNonUniformQuadSwap 35 610 478 + 612: 20(ivec4) Select 611 196 192 + 613: 73(ptr) AccessChain 27(data) 607 39 + Store 613 612 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupShuffle.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupShuffle.comp.out new file mode 100644 index 00000000000..991c6fa77a7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupShuffle.comp.out @@ -0,0 +1,462 @@ +spv.subgroupShuffle.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 379 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformShuffle + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 8 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_KHR_shader_subgroup_shuffle" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 24 "Buffers" + MemberName 24(Buffers) 0 "f4" + MemberName 24(Buffers) 1 "i4" + MemberName 24(Buffers) 2 "u4" + MemberName 24(Buffers) 3 "d4" + Name 27 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 24(Buffers) 0 Offset 0 + MemberDecorate 24(Buffers) 1 Offset 16 + MemberDecorate 24(Buffers) 2 Offset 32 + MemberDecorate 24(Buffers) 3 Offset 64 + Decorate 24(Buffers) Block + Decorate 27(data) DescriptorSet 0 + Decorate 27(data) Binding 0 + Decorate 378 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeFloat 32 + 18: TypeVector 17(float) 4 + 19: TypeInt 32 1 + 20: TypeVector 19(int) 4 + 21: TypeVector 6(int) 4 + 22: TypeFloat 64 + 23: TypeVector 22(float64_t) 4 + 24(Buffers): TypeStruct 18(fvec4) 20(ivec4) 21(ivec4) 23(f64vec4) + 25: TypeArray 24(Buffers) 15 + 26: TypePointer StorageBuffer 25 + 27(data): 26(ptr) Variable StorageBuffer + 29: 19(int) Constant 0 + 30: 6(int) Constant 0 + 31: TypePointer StorageBuffer 17(float) + 35: 6(int) Constant 3 + 39: 19(int) Constant 1 + 40: TypeVector 17(float) 2 + 41: TypePointer StorageBuffer 18(fvec4) + 51: 19(int) Constant 2 + 52: TypeVector 17(float) 3 + 62: 19(int) Constant 3 + 69: TypePointer StorageBuffer 19(int) + 76: TypeVector 19(int) 2 + 77: TypePointer StorageBuffer 20(ivec4) + 87: TypeVector 19(int) 3 + 103: TypePointer StorageBuffer 6(int) + 110: TypeVector 6(int) 2 + 111: TypePointer StorageBuffer 21(ivec4) + 121: TypeVector 6(int) 3 + 137: TypePointer StorageBuffer 22(float64_t) + 144: TypeVector 22(float64_t) 2 + 145: TypePointer StorageBuffer 23(f64vec4) + 155: TypeVector 22(float64_t) 3 + 173: TypeBool + 183: 76(ivec2) ConstantComposite 29 29 + 184: TypeVector 173(bool) 2 + 188: 76(ivec2) ConstantComposite 39 39 + 197: 87(ivec3) ConstantComposite 29 29 29 + 198: TypeVector 173(bool) 3 + 202: 87(ivec3) ConstantComposite 39 39 39 + 210: 20(ivec4) ConstantComposite 29 29 29 29 + 211: TypeVector 173(bool) 4 + 215: 20(ivec4) ConstantComposite 39 39 39 39 + 376: 6(int) Constant 8 + 377: 6(int) Constant 1 + 378: 121(ivec3) ConstantComposite 376 376 377 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 28: 6(int) Load 8(invocation) + 32: 31(ptr) AccessChain 27(data) 29 29 30 + 33: 17(float) Load 32 + 34: 6(int) Load 8(invocation) + 36: 17(float) GroupNonUniformShuffle 35 33 34 + 37: 31(ptr) AccessChain 27(data) 28 29 30 + Store 37 36 + 38: 6(int) Load 8(invocation) + 42: 41(ptr) AccessChain 27(data) 39 29 + 43: 18(fvec4) Load 42 + 44: 40(fvec2) VectorShuffle 43 43 0 1 + 45: 6(int) Load 8(invocation) + 46: 40(fvec2) GroupNonUniformShuffle 35 44 45 + 47: 41(ptr) AccessChain 27(data) 38 29 + 48: 18(fvec4) Load 47 + 49: 18(fvec4) VectorShuffle 48 46 4 5 2 3 + Store 47 49 + 50: 6(int) Load 8(invocation) + 53: 41(ptr) AccessChain 27(data) 51 29 + 54: 18(fvec4) Load 53 + 55: 52(fvec3) VectorShuffle 54 54 0 1 2 + 56: 6(int) Load 8(invocation) + 57: 52(fvec3) GroupNonUniformShuffle 35 55 56 + 58: 41(ptr) AccessChain 27(data) 50 29 + 59: 18(fvec4) Load 58 + 60: 18(fvec4) VectorShuffle 59 57 4 5 6 3 + Store 58 60 + 61: 6(int) Load 8(invocation) + 63: 41(ptr) AccessChain 27(data) 62 29 + 64: 18(fvec4) Load 63 + 65: 6(int) Load 8(invocation) + 66: 18(fvec4) GroupNonUniformShuffle 35 64 65 + 67: 41(ptr) AccessChain 27(data) 61 29 + Store 67 66 + 68: 6(int) Load 8(invocation) + 70: 69(ptr) AccessChain 27(data) 29 39 30 + 71: 19(int) Load 70 + 72: 6(int) Load 8(invocation) + 73: 19(int) GroupNonUniformShuffle 35 71 72 + 74: 69(ptr) AccessChain 27(data) 68 39 30 + Store 74 73 + 75: 6(int) Load 8(invocation) + 78: 77(ptr) AccessChain 27(data) 39 39 + 79: 20(ivec4) Load 78 + 80: 76(ivec2) VectorShuffle 79 79 0 1 + 81: 6(int) Load 8(invocation) + 82: 76(ivec2) GroupNonUniformShuffle 35 80 81 + 83: 77(ptr) AccessChain 27(data) 75 39 + 84: 20(ivec4) Load 83 + 85: 20(ivec4) VectorShuffle 84 82 4 5 2 3 + Store 83 85 + 86: 6(int) Load 8(invocation) + 88: 77(ptr) AccessChain 27(data) 51 39 + 89: 20(ivec4) Load 88 + 90: 87(ivec3) VectorShuffle 89 89 0 1 2 + 91: 6(int) Load 8(invocation) + 92: 87(ivec3) GroupNonUniformShuffle 35 90 91 + 93: 77(ptr) AccessChain 27(data) 86 39 + 94: 20(ivec4) Load 93 + 95: 20(ivec4) VectorShuffle 94 92 4 5 6 3 + Store 93 95 + 96: 6(int) Load 8(invocation) + 97: 77(ptr) AccessChain 27(data) 62 39 + 98: 20(ivec4) Load 97 + 99: 6(int) Load 8(invocation) + 100: 20(ivec4) GroupNonUniformShuffle 35 98 99 + 101: 77(ptr) AccessChain 27(data) 96 39 + Store 101 100 + 102: 6(int) Load 8(invocation) + 104: 103(ptr) AccessChain 27(data) 29 51 30 + 105: 6(int) Load 104 + 106: 6(int) Load 8(invocation) + 107: 6(int) GroupNonUniformShuffle 35 105 106 + 108: 103(ptr) AccessChain 27(data) 102 51 30 + Store 108 107 + 109: 6(int) Load 8(invocation) + 112: 111(ptr) AccessChain 27(data) 39 51 + 113: 21(ivec4) Load 112 + 114: 110(ivec2) VectorShuffle 113 113 0 1 + 115: 6(int) Load 8(invocation) + 116: 110(ivec2) GroupNonUniformShuffle 35 114 115 + 117: 111(ptr) AccessChain 27(data) 109 51 + 118: 21(ivec4) Load 117 + 119: 21(ivec4) VectorShuffle 118 116 4 5 2 3 + Store 117 119 + 120: 6(int) Load 8(invocation) + 122: 111(ptr) AccessChain 27(data) 51 51 + 123: 21(ivec4) Load 122 + 124: 121(ivec3) VectorShuffle 123 123 0 1 2 + 125: 6(int) Load 8(invocation) + 126: 121(ivec3) GroupNonUniformShuffle 35 124 125 + 127: 111(ptr) AccessChain 27(data) 120 51 + 128: 21(ivec4) Load 127 + 129: 21(ivec4) VectorShuffle 128 126 4 5 6 3 + Store 127 129 + 130: 6(int) Load 8(invocation) + 131: 111(ptr) AccessChain 27(data) 62 51 + 132: 21(ivec4) Load 131 + 133: 6(int) Load 8(invocation) + 134: 21(ivec4) GroupNonUniformShuffle 35 132 133 + 135: 111(ptr) AccessChain 27(data) 130 51 + Store 135 134 + 136: 6(int) Load 8(invocation) + 138: 137(ptr) AccessChain 27(data) 29 62 30 + 139:22(float64_t) Load 138 + 140: 6(int) Load 8(invocation) + 141:22(float64_t) GroupNonUniformShuffle 35 139 140 + 142: 137(ptr) AccessChain 27(data) 136 62 30 + Store 142 141 + 143: 6(int) Load 8(invocation) + 146: 145(ptr) AccessChain 27(data) 39 62 + 147: 23(f64vec4) Load 146 + 148:144(f64vec2) VectorShuffle 147 147 0 1 + 149: 6(int) Load 8(invocation) + 150:144(f64vec2) GroupNonUniformShuffle 35 148 149 + 151: 145(ptr) AccessChain 27(data) 143 62 + 152: 23(f64vec4) Load 151 + 153: 23(f64vec4) VectorShuffle 152 150 4 5 2 3 + Store 151 153 + 154: 6(int) Load 8(invocation) + 156: 145(ptr) AccessChain 27(data) 51 62 + 157: 23(f64vec4) Load 156 + 158:155(f64vec3) VectorShuffle 157 157 0 1 2 + 159: 6(int) Load 8(invocation) + 160:155(f64vec3) GroupNonUniformShuffle 35 158 159 + 161: 145(ptr) AccessChain 27(data) 154 62 + 162: 23(f64vec4) Load 161 + 163: 23(f64vec4) VectorShuffle 162 160 4 5 6 3 + Store 161 163 + 164: 6(int) Load 8(invocation) + 165: 145(ptr) AccessChain 27(data) 62 62 + 166: 23(f64vec4) Load 165 + 167: 6(int) Load 8(invocation) + 168: 23(f64vec4) GroupNonUniformShuffle 35 166 167 + 169: 145(ptr) AccessChain 27(data) 164 62 + Store 169 168 + 170: 6(int) Load 8(invocation) + 171: 69(ptr) AccessChain 27(data) 29 39 30 + 172: 19(int) Load 171 + 174: 173(bool) SLessThan 172 29 + 175: 6(int) Load 8(invocation) + 176: 173(bool) GroupNonUniformShuffle 35 174 175 + 177: 19(int) Select 176 39 29 + 178: 69(ptr) AccessChain 27(data) 170 39 30 + Store 178 177 + 179: 6(int) Load 8(invocation) + 180: 77(ptr) AccessChain 27(data) 39 39 + 181: 20(ivec4) Load 180 + 182: 76(ivec2) VectorShuffle 181 181 0 1 + 185: 184(bvec2) SLessThan 182 183 + 186: 6(int) Load 8(invocation) + 187: 184(bvec2) GroupNonUniformShuffle 35 185 186 + 189: 76(ivec2) Select 187 188 183 + 190: 77(ptr) AccessChain 27(data) 179 39 + 191: 20(ivec4) Load 190 + 192: 20(ivec4) VectorShuffle 191 189 4 5 2 3 + Store 190 192 + 193: 6(int) Load 8(invocation) + 194: 77(ptr) AccessChain 27(data) 39 39 + 195: 20(ivec4) Load 194 + 196: 87(ivec3) VectorShuffle 195 195 0 1 2 + 199: 198(bvec3) SLessThan 196 197 + 200: 6(int) Load 8(invocation) + 201: 198(bvec3) GroupNonUniformShuffle 35 199 200 + 203: 87(ivec3) Select 201 202 197 + 204: 77(ptr) AccessChain 27(data) 193 39 + 205: 20(ivec4) Load 204 + 206: 20(ivec4) VectorShuffle 205 203 4 5 6 3 + Store 204 206 + 207: 6(int) Load 8(invocation) + 208: 77(ptr) AccessChain 27(data) 39 39 + 209: 20(ivec4) Load 208 + 212: 211(bvec4) SLessThan 209 210 + 213: 6(int) Load 8(invocation) + 214: 211(bvec4) GroupNonUniformShuffle 35 212 213 + 216: 20(ivec4) Select 214 215 210 + 217: 77(ptr) AccessChain 27(data) 207 39 + Store 217 216 + 218: 6(int) Load 8(invocation) + 219: 31(ptr) AccessChain 27(data) 29 29 30 + 220: 17(float) Load 219 + 221: 6(int) Load 8(invocation) + 222: 17(float) GroupNonUniformShuffleXor 35 220 221 + 223: 31(ptr) AccessChain 27(data) 218 29 30 + Store 223 222 + 224: 6(int) Load 8(invocation) + 225: 41(ptr) AccessChain 27(data) 39 29 + 226: 18(fvec4) Load 225 + 227: 40(fvec2) VectorShuffle 226 226 0 1 + 228: 6(int) Load 8(invocation) + 229: 40(fvec2) GroupNonUniformShuffleXor 35 227 228 + 230: 41(ptr) AccessChain 27(data) 224 29 + 231: 18(fvec4) Load 230 + 232: 18(fvec4) VectorShuffle 231 229 4 5 2 3 + Store 230 232 + 233: 6(int) Load 8(invocation) + 234: 41(ptr) AccessChain 27(data) 51 29 + 235: 18(fvec4) Load 234 + 236: 52(fvec3) VectorShuffle 235 235 0 1 2 + 237: 6(int) Load 8(invocation) + 238: 52(fvec3) GroupNonUniformShuffleXor 35 236 237 + 239: 41(ptr) AccessChain 27(data) 233 29 + 240: 18(fvec4) Load 239 + 241: 18(fvec4) VectorShuffle 240 238 4 5 6 3 + Store 239 241 + 242: 6(int) Load 8(invocation) + 243: 41(ptr) AccessChain 27(data) 62 29 + 244: 18(fvec4) Load 243 + 245: 6(int) Load 8(invocation) + 246: 18(fvec4) GroupNonUniformShuffleXor 35 244 245 + 247: 41(ptr) AccessChain 27(data) 242 29 + Store 247 246 + 248: 6(int) Load 8(invocation) + 249: 69(ptr) AccessChain 27(data) 29 39 30 + 250: 19(int) Load 249 + 251: 6(int) Load 8(invocation) + 252: 19(int) GroupNonUniformShuffleXor 35 250 251 + 253: 69(ptr) AccessChain 27(data) 248 39 30 + Store 253 252 + 254: 6(int) Load 8(invocation) + 255: 77(ptr) AccessChain 27(data) 39 39 + 256: 20(ivec4) Load 255 + 257: 76(ivec2) VectorShuffle 256 256 0 1 + 258: 6(int) Load 8(invocation) + 259: 76(ivec2) GroupNonUniformShuffleXor 35 257 258 + 260: 77(ptr) AccessChain 27(data) 254 39 + 261: 20(ivec4) Load 260 + 262: 20(ivec4) VectorShuffle 261 259 4 5 2 3 + Store 260 262 + 263: 6(int) Load 8(invocation) + 264: 77(ptr) AccessChain 27(data) 51 39 + 265: 20(ivec4) Load 264 + 266: 87(ivec3) VectorShuffle 265 265 0 1 2 + 267: 6(int) Load 8(invocation) + 268: 87(ivec3) GroupNonUniformShuffleXor 35 266 267 + 269: 77(ptr) AccessChain 27(data) 263 39 + 270: 20(ivec4) Load 269 + 271: 20(ivec4) VectorShuffle 270 268 4 5 6 3 + Store 269 271 + 272: 6(int) Load 8(invocation) + 273: 77(ptr) AccessChain 27(data) 62 39 + 274: 20(ivec4) Load 273 + 275: 6(int) Load 8(invocation) + 276: 20(ivec4) GroupNonUniformShuffleXor 35 274 275 + 277: 77(ptr) AccessChain 27(data) 272 39 + Store 277 276 + 278: 6(int) Load 8(invocation) + 279: 103(ptr) AccessChain 27(data) 29 51 30 + 280: 6(int) Load 279 + 281: 6(int) Load 8(invocation) + 282: 6(int) GroupNonUniformShuffleXor 35 280 281 + 283: 103(ptr) AccessChain 27(data) 278 51 30 + Store 283 282 + 284: 6(int) Load 8(invocation) + 285: 111(ptr) AccessChain 27(data) 39 51 + 286: 21(ivec4) Load 285 + 287: 110(ivec2) VectorShuffle 286 286 0 1 + 288: 6(int) Load 8(invocation) + 289: 110(ivec2) GroupNonUniformShuffleXor 35 287 288 + 290: 111(ptr) AccessChain 27(data) 284 51 + 291: 21(ivec4) Load 290 + 292: 21(ivec4) VectorShuffle 291 289 4 5 2 3 + Store 290 292 + 293: 6(int) Load 8(invocation) + 294: 111(ptr) AccessChain 27(data) 51 51 + 295: 21(ivec4) Load 294 + 296: 121(ivec3) VectorShuffle 295 295 0 1 2 + 297: 6(int) Load 8(invocation) + 298: 121(ivec3) GroupNonUniformShuffleXor 35 296 297 + 299: 111(ptr) AccessChain 27(data) 293 51 + 300: 21(ivec4) Load 299 + 301: 21(ivec4) VectorShuffle 300 298 4 5 6 3 + Store 299 301 + 302: 6(int) Load 8(invocation) + 303: 111(ptr) AccessChain 27(data) 62 51 + 304: 21(ivec4) Load 303 + 305: 6(int) Load 8(invocation) + 306: 21(ivec4) GroupNonUniformShuffleXor 35 304 305 + 307: 111(ptr) AccessChain 27(data) 302 51 + Store 307 306 + 308: 6(int) Load 8(invocation) + 309: 137(ptr) AccessChain 27(data) 29 62 30 + 310:22(float64_t) Load 309 + 311: 6(int) Load 8(invocation) + 312:22(float64_t) GroupNonUniformShuffleXor 35 310 311 + 313: 137(ptr) AccessChain 27(data) 308 62 30 + Store 313 312 + 314: 6(int) Load 8(invocation) + 315: 145(ptr) AccessChain 27(data) 39 62 + 316: 23(f64vec4) Load 315 + 317:144(f64vec2) VectorShuffle 316 316 0 1 + 318: 6(int) Load 8(invocation) + 319:144(f64vec2) GroupNonUniformShuffleXor 35 317 318 + 320: 145(ptr) AccessChain 27(data) 314 62 + 321: 23(f64vec4) Load 320 + 322: 23(f64vec4) VectorShuffle 321 319 4 5 2 3 + Store 320 322 + 323: 6(int) Load 8(invocation) + 324: 145(ptr) AccessChain 27(data) 51 62 + 325: 23(f64vec4) Load 324 + 326:155(f64vec3) VectorShuffle 325 325 0 1 2 + 327: 6(int) Load 8(invocation) + 328:155(f64vec3) GroupNonUniformShuffleXor 35 326 327 + 329: 145(ptr) AccessChain 27(data) 323 62 + 330: 23(f64vec4) Load 329 + 331: 23(f64vec4) VectorShuffle 330 328 4 5 6 3 + Store 329 331 + 332: 6(int) Load 8(invocation) + 333: 145(ptr) AccessChain 27(data) 62 62 + 334: 23(f64vec4) Load 333 + 335: 6(int) Load 8(invocation) + 336: 23(f64vec4) GroupNonUniformShuffleXor 35 334 335 + 337: 145(ptr) AccessChain 27(data) 332 62 + Store 337 336 + 338: 6(int) Load 8(invocation) + 339: 69(ptr) AccessChain 27(data) 29 39 30 + 340: 19(int) Load 339 + 341: 173(bool) SLessThan 340 29 + 342: 6(int) Load 8(invocation) + 343: 173(bool) GroupNonUniformShuffleXor 35 341 342 + 344: 19(int) Select 343 39 29 + 345: 69(ptr) AccessChain 27(data) 338 39 30 + Store 345 344 + 346: 6(int) Load 8(invocation) + 347: 77(ptr) AccessChain 27(data) 39 39 + 348: 20(ivec4) Load 347 + 349: 76(ivec2) VectorShuffle 348 348 0 1 + 350: 184(bvec2) SLessThan 349 183 + 351: 6(int) Load 8(invocation) + 352: 184(bvec2) GroupNonUniformShuffleXor 35 350 351 + 353: 76(ivec2) Select 352 188 183 + 354: 77(ptr) AccessChain 27(data) 346 39 + 355: 20(ivec4) Load 354 + 356: 20(ivec4) VectorShuffle 355 353 4 5 2 3 + Store 354 356 + 357: 6(int) Load 8(invocation) + 358: 77(ptr) AccessChain 27(data) 39 39 + 359: 20(ivec4) Load 358 + 360: 87(ivec3) VectorShuffle 359 359 0 1 2 + 361: 198(bvec3) SLessThan 360 197 + 362: 6(int) Load 8(invocation) + 363: 198(bvec3) GroupNonUniformShuffleXor 35 361 362 + 364: 87(ivec3) Select 363 202 197 + 365: 77(ptr) AccessChain 27(data) 357 39 + 366: 20(ivec4) Load 365 + 367: 20(ivec4) VectorShuffle 366 364 4 5 6 3 + Store 365 367 + 368: 6(int) Load 8(invocation) + 369: 77(ptr) AccessChain 27(data) 39 39 + 370: 20(ivec4) Load 369 + 371: 211(bvec4) SLessThan 370 210 + 372: 6(int) Load 8(invocation) + 373: 211(bvec4) GroupNonUniformShuffleXor 35 371 372 + 374: 20(ivec4) Select 373 215 210 + 375: 77(ptr) AccessChain 27(data) 368 39 + Store 375 374 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupShuffleRelative.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupShuffleRelative.comp.out new file mode 100644 index 00000000000..3aad7605b07 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupShuffleRelative.comp.out @@ -0,0 +1,462 @@ +spv.subgroupShuffleRelative.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 379 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformShuffleRelative + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 8 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_KHR_shader_subgroup_shuffle_relative" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 24 "Buffers" + MemberName 24(Buffers) 0 "f4" + MemberName 24(Buffers) 1 "i4" + MemberName 24(Buffers) 2 "u4" + MemberName 24(Buffers) 3 "d4" + Name 27 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 24(Buffers) 0 Offset 0 + MemberDecorate 24(Buffers) 1 Offset 16 + MemberDecorate 24(Buffers) 2 Offset 32 + MemberDecorate 24(Buffers) 3 Offset 64 + Decorate 24(Buffers) Block + Decorate 27(data) DescriptorSet 0 + Decorate 27(data) Binding 0 + Decorate 378 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeFloat 32 + 18: TypeVector 17(float) 4 + 19: TypeInt 32 1 + 20: TypeVector 19(int) 4 + 21: TypeVector 6(int) 4 + 22: TypeFloat 64 + 23: TypeVector 22(float64_t) 4 + 24(Buffers): TypeStruct 18(fvec4) 20(ivec4) 21(ivec4) 23(f64vec4) + 25: TypeArray 24(Buffers) 15 + 26: TypePointer StorageBuffer 25 + 27(data): 26(ptr) Variable StorageBuffer + 29: 19(int) Constant 0 + 30: 6(int) Constant 0 + 31: TypePointer StorageBuffer 17(float) + 35: 6(int) Constant 3 + 39: 19(int) Constant 1 + 40: TypeVector 17(float) 2 + 41: TypePointer StorageBuffer 18(fvec4) + 51: 19(int) Constant 2 + 52: TypeVector 17(float) 3 + 62: 19(int) Constant 3 + 69: TypePointer StorageBuffer 19(int) + 76: TypeVector 19(int) 2 + 77: TypePointer StorageBuffer 20(ivec4) + 87: TypeVector 19(int) 3 + 103: TypePointer StorageBuffer 6(int) + 110: TypeVector 6(int) 2 + 111: TypePointer StorageBuffer 21(ivec4) + 121: TypeVector 6(int) 3 + 137: TypePointer StorageBuffer 22(float64_t) + 144: TypeVector 22(float64_t) 2 + 145: TypePointer StorageBuffer 23(f64vec4) + 155: TypeVector 22(float64_t) 3 + 173: TypeBool + 183: 76(ivec2) ConstantComposite 29 29 + 184: TypeVector 173(bool) 2 + 188: 76(ivec2) ConstantComposite 39 39 + 197: 87(ivec3) ConstantComposite 29 29 29 + 198: TypeVector 173(bool) 3 + 202: 87(ivec3) ConstantComposite 39 39 39 + 210: 20(ivec4) ConstantComposite 29 29 29 29 + 211: TypeVector 173(bool) 4 + 215: 20(ivec4) ConstantComposite 39 39 39 39 + 376: 6(int) Constant 8 + 377: 6(int) Constant 1 + 378: 121(ivec3) ConstantComposite 376 376 377 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 28: 6(int) Load 8(invocation) + 32: 31(ptr) AccessChain 27(data) 29 29 30 + 33: 17(float) Load 32 + 34: 6(int) Load 8(invocation) + 36: 17(float) GroupNonUniformShuffleUp 35 33 34 + 37: 31(ptr) AccessChain 27(data) 28 29 30 + Store 37 36 + 38: 6(int) Load 8(invocation) + 42: 41(ptr) AccessChain 27(data) 39 29 + 43: 18(fvec4) Load 42 + 44: 40(fvec2) VectorShuffle 43 43 0 1 + 45: 6(int) Load 8(invocation) + 46: 40(fvec2) GroupNonUniformShuffleUp 35 44 45 + 47: 41(ptr) AccessChain 27(data) 38 29 + 48: 18(fvec4) Load 47 + 49: 18(fvec4) VectorShuffle 48 46 4 5 2 3 + Store 47 49 + 50: 6(int) Load 8(invocation) + 53: 41(ptr) AccessChain 27(data) 51 29 + 54: 18(fvec4) Load 53 + 55: 52(fvec3) VectorShuffle 54 54 0 1 2 + 56: 6(int) Load 8(invocation) + 57: 52(fvec3) GroupNonUniformShuffleUp 35 55 56 + 58: 41(ptr) AccessChain 27(data) 50 29 + 59: 18(fvec4) Load 58 + 60: 18(fvec4) VectorShuffle 59 57 4 5 6 3 + Store 58 60 + 61: 6(int) Load 8(invocation) + 63: 41(ptr) AccessChain 27(data) 62 29 + 64: 18(fvec4) Load 63 + 65: 6(int) Load 8(invocation) + 66: 18(fvec4) GroupNonUniformShuffleUp 35 64 65 + 67: 41(ptr) AccessChain 27(data) 61 29 + Store 67 66 + 68: 6(int) Load 8(invocation) + 70: 69(ptr) AccessChain 27(data) 29 39 30 + 71: 19(int) Load 70 + 72: 6(int) Load 8(invocation) + 73: 19(int) GroupNonUniformShuffleUp 35 71 72 + 74: 69(ptr) AccessChain 27(data) 68 39 30 + Store 74 73 + 75: 6(int) Load 8(invocation) + 78: 77(ptr) AccessChain 27(data) 39 39 + 79: 20(ivec4) Load 78 + 80: 76(ivec2) VectorShuffle 79 79 0 1 + 81: 6(int) Load 8(invocation) + 82: 76(ivec2) GroupNonUniformShuffleUp 35 80 81 + 83: 77(ptr) AccessChain 27(data) 75 39 + 84: 20(ivec4) Load 83 + 85: 20(ivec4) VectorShuffle 84 82 4 5 2 3 + Store 83 85 + 86: 6(int) Load 8(invocation) + 88: 77(ptr) AccessChain 27(data) 51 39 + 89: 20(ivec4) Load 88 + 90: 87(ivec3) VectorShuffle 89 89 0 1 2 + 91: 6(int) Load 8(invocation) + 92: 87(ivec3) GroupNonUniformShuffleUp 35 90 91 + 93: 77(ptr) AccessChain 27(data) 86 39 + 94: 20(ivec4) Load 93 + 95: 20(ivec4) VectorShuffle 94 92 4 5 6 3 + Store 93 95 + 96: 6(int) Load 8(invocation) + 97: 77(ptr) AccessChain 27(data) 62 39 + 98: 20(ivec4) Load 97 + 99: 6(int) Load 8(invocation) + 100: 20(ivec4) GroupNonUniformShuffleUp 35 98 99 + 101: 77(ptr) AccessChain 27(data) 96 39 + Store 101 100 + 102: 6(int) Load 8(invocation) + 104: 103(ptr) AccessChain 27(data) 29 51 30 + 105: 6(int) Load 104 + 106: 6(int) Load 8(invocation) + 107: 6(int) GroupNonUniformShuffleUp 35 105 106 + 108: 103(ptr) AccessChain 27(data) 102 51 30 + Store 108 107 + 109: 6(int) Load 8(invocation) + 112: 111(ptr) AccessChain 27(data) 39 51 + 113: 21(ivec4) Load 112 + 114: 110(ivec2) VectorShuffle 113 113 0 1 + 115: 6(int) Load 8(invocation) + 116: 110(ivec2) GroupNonUniformShuffleUp 35 114 115 + 117: 111(ptr) AccessChain 27(data) 109 51 + 118: 21(ivec4) Load 117 + 119: 21(ivec4) VectorShuffle 118 116 4 5 2 3 + Store 117 119 + 120: 6(int) Load 8(invocation) + 122: 111(ptr) AccessChain 27(data) 51 51 + 123: 21(ivec4) Load 122 + 124: 121(ivec3) VectorShuffle 123 123 0 1 2 + 125: 6(int) Load 8(invocation) + 126: 121(ivec3) GroupNonUniformShuffleUp 35 124 125 + 127: 111(ptr) AccessChain 27(data) 120 51 + 128: 21(ivec4) Load 127 + 129: 21(ivec4) VectorShuffle 128 126 4 5 6 3 + Store 127 129 + 130: 6(int) Load 8(invocation) + 131: 111(ptr) AccessChain 27(data) 62 51 + 132: 21(ivec4) Load 131 + 133: 6(int) Load 8(invocation) + 134: 21(ivec4) GroupNonUniformShuffleUp 35 132 133 + 135: 111(ptr) AccessChain 27(data) 130 51 + Store 135 134 + 136: 6(int) Load 8(invocation) + 138: 137(ptr) AccessChain 27(data) 29 62 30 + 139:22(float64_t) Load 138 + 140: 6(int) Load 8(invocation) + 141:22(float64_t) GroupNonUniformShuffleUp 35 139 140 + 142: 137(ptr) AccessChain 27(data) 136 62 30 + Store 142 141 + 143: 6(int) Load 8(invocation) + 146: 145(ptr) AccessChain 27(data) 39 62 + 147: 23(f64vec4) Load 146 + 148:144(f64vec2) VectorShuffle 147 147 0 1 + 149: 6(int) Load 8(invocation) + 150:144(f64vec2) GroupNonUniformShuffleUp 35 148 149 + 151: 145(ptr) AccessChain 27(data) 143 62 + 152: 23(f64vec4) Load 151 + 153: 23(f64vec4) VectorShuffle 152 150 4 5 2 3 + Store 151 153 + 154: 6(int) Load 8(invocation) + 156: 145(ptr) AccessChain 27(data) 51 62 + 157: 23(f64vec4) Load 156 + 158:155(f64vec3) VectorShuffle 157 157 0 1 2 + 159: 6(int) Load 8(invocation) + 160:155(f64vec3) GroupNonUniformShuffleUp 35 158 159 + 161: 145(ptr) AccessChain 27(data) 154 62 + 162: 23(f64vec4) Load 161 + 163: 23(f64vec4) VectorShuffle 162 160 4 5 6 3 + Store 161 163 + 164: 6(int) Load 8(invocation) + 165: 145(ptr) AccessChain 27(data) 62 62 + 166: 23(f64vec4) Load 165 + 167: 6(int) Load 8(invocation) + 168: 23(f64vec4) GroupNonUniformShuffleUp 35 166 167 + 169: 145(ptr) AccessChain 27(data) 164 62 + Store 169 168 + 170: 6(int) Load 8(invocation) + 171: 69(ptr) AccessChain 27(data) 29 39 30 + 172: 19(int) Load 171 + 174: 173(bool) SLessThan 172 29 + 175: 6(int) Load 8(invocation) + 176: 173(bool) GroupNonUniformShuffleUp 35 174 175 + 177: 19(int) Select 176 39 29 + 178: 69(ptr) AccessChain 27(data) 170 39 30 + Store 178 177 + 179: 6(int) Load 8(invocation) + 180: 77(ptr) AccessChain 27(data) 39 39 + 181: 20(ivec4) Load 180 + 182: 76(ivec2) VectorShuffle 181 181 0 1 + 185: 184(bvec2) SLessThan 182 183 + 186: 6(int) Load 8(invocation) + 187: 184(bvec2) GroupNonUniformShuffleUp 35 185 186 + 189: 76(ivec2) Select 187 188 183 + 190: 77(ptr) AccessChain 27(data) 179 39 + 191: 20(ivec4) Load 190 + 192: 20(ivec4) VectorShuffle 191 189 4 5 2 3 + Store 190 192 + 193: 6(int) Load 8(invocation) + 194: 77(ptr) AccessChain 27(data) 39 39 + 195: 20(ivec4) Load 194 + 196: 87(ivec3) VectorShuffle 195 195 0 1 2 + 199: 198(bvec3) SLessThan 196 197 + 200: 6(int) Load 8(invocation) + 201: 198(bvec3) GroupNonUniformShuffleUp 35 199 200 + 203: 87(ivec3) Select 201 202 197 + 204: 77(ptr) AccessChain 27(data) 193 39 + 205: 20(ivec4) Load 204 + 206: 20(ivec4) VectorShuffle 205 203 4 5 6 3 + Store 204 206 + 207: 6(int) Load 8(invocation) + 208: 77(ptr) AccessChain 27(data) 39 39 + 209: 20(ivec4) Load 208 + 212: 211(bvec4) SLessThan 209 210 + 213: 6(int) Load 8(invocation) + 214: 211(bvec4) GroupNonUniformShuffleUp 35 212 213 + 216: 20(ivec4) Select 214 215 210 + 217: 77(ptr) AccessChain 27(data) 207 39 + Store 217 216 + 218: 6(int) Load 8(invocation) + 219: 31(ptr) AccessChain 27(data) 29 29 30 + 220: 17(float) Load 219 + 221: 6(int) Load 8(invocation) + 222: 17(float) GroupNonUniformShuffleDown 35 220 221 + 223: 31(ptr) AccessChain 27(data) 218 29 30 + Store 223 222 + 224: 6(int) Load 8(invocation) + 225: 41(ptr) AccessChain 27(data) 39 29 + 226: 18(fvec4) Load 225 + 227: 40(fvec2) VectorShuffle 226 226 0 1 + 228: 6(int) Load 8(invocation) + 229: 40(fvec2) GroupNonUniformShuffleDown 35 227 228 + 230: 41(ptr) AccessChain 27(data) 224 29 + 231: 18(fvec4) Load 230 + 232: 18(fvec4) VectorShuffle 231 229 4 5 2 3 + Store 230 232 + 233: 6(int) Load 8(invocation) + 234: 41(ptr) AccessChain 27(data) 51 29 + 235: 18(fvec4) Load 234 + 236: 52(fvec3) VectorShuffle 235 235 0 1 2 + 237: 6(int) Load 8(invocation) + 238: 52(fvec3) GroupNonUniformShuffleDown 35 236 237 + 239: 41(ptr) AccessChain 27(data) 233 29 + 240: 18(fvec4) Load 239 + 241: 18(fvec4) VectorShuffle 240 238 4 5 6 3 + Store 239 241 + 242: 6(int) Load 8(invocation) + 243: 41(ptr) AccessChain 27(data) 62 29 + 244: 18(fvec4) Load 243 + 245: 6(int) Load 8(invocation) + 246: 18(fvec4) GroupNonUniformShuffleDown 35 244 245 + 247: 41(ptr) AccessChain 27(data) 242 29 + Store 247 246 + 248: 6(int) Load 8(invocation) + 249: 69(ptr) AccessChain 27(data) 29 39 30 + 250: 19(int) Load 249 + 251: 6(int) Load 8(invocation) + 252: 19(int) GroupNonUniformShuffleDown 35 250 251 + 253: 69(ptr) AccessChain 27(data) 248 39 30 + Store 253 252 + 254: 6(int) Load 8(invocation) + 255: 77(ptr) AccessChain 27(data) 39 39 + 256: 20(ivec4) Load 255 + 257: 76(ivec2) VectorShuffle 256 256 0 1 + 258: 6(int) Load 8(invocation) + 259: 76(ivec2) GroupNonUniformShuffleDown 35 257 258 + 260: 77(ptr) AccessChain 27(data) 254 39 + 261: 20(ivec4) Load 260 + 262: 20(ivec4) VectorShuffle 261 259 4 5 2 3 + Store 260 262 + 263: 6(int) Load 8(invocation) + 264: 77(ptr) AccessChain 27(data) 51 39 + 265: 20(ivec4) Load 264 + 266: 87(ivec3) VectorShuffle 265 265 0 1 2 + 267: 6(int) Load 8(invocation) + 268: 87(ivec3) GroupNonUniformShuffleDown 35 266 267 + 269: 77(ptr) AccessChain 27(data) 263 39 + 270: 20(ivec4) Load 269 + 271: 20(ivec4) VectorShuffle 270 268 4 5 6 3 + Store 269 271 + 272: 6(int) Load 8(invocation) + 273: 77(ptr) AccessChain 27(data) 62 39 + 274: 20(ivec4) Load 273 + 275: 6(int) Load 8(invocation) + 276: 20(ivec4) GroupNonUniformShuffleDown 35 274 275 + 277: 77(ptr) AccessChain 27(data) 272 39 + Store 277 276 + 278: 6(int) Load 8(invocation) + 279: 103(ptr) AccessChain 27(data) 29 51 30 + 280: 6(int) Load 279 + 281: 6(int) Load 8(invocation) + 282: 6(int) GroupNonUniformShuffleDown 35 280 281 + 283: 103(ptr) AccessChain 27(data) 278 51 30 + Store 283 282 + 284: 6(int) Load 8(invocation) + 285: 111(ptr) AccessChain 27(data) 39 51 + 286: 21(ivec4) Load 285 + 287: 110(ivec2) VectorShuffle 286 286 0 1 + 288: 6(int) Load 8(invocation) + 289: 110(ivec2) GroupNonUniformShuffleDown 35 287 288 + 290: 111(ptr) AccessChain 27(data) 284 51 + 291: 21(ivec4) Load 290 + 292: 21(ivec4) VectorShuffle 291 289 4 5 2 3 + Store 290 292 + 293: 6(int) Load 8(invocation) + 294: 111(ptr) AccessChain 27(data) 51 51 + 295: 21(ivec4) Load 294 + 296: 121(ivec3) VectorShuffle 295 295 0 1 2 + 297: 6(int) Load 8(invocation) + 298: 121(ivec3) GroupNonUniformShuffleDown 35 296 297 + 299: 111(ptr) AccessChain 27(data) 293 51 + 300: 21(ivec4) Load 299 + 301: 21(ivec4) VectorShuffle 300 298 4 5 6 3 + Store 299 301 + 302: 6(int) Load 8(invocation) + 303: 111(ptr) AccessChain 27(data) 62 51 + 304: 21(ivec4) Load 303 + 305: 6(int) Load 8(invocation) + 306: 21(ivec4) GroupNonUniformShuffleDown 35 304 305 + 307: 111(ptr) AccessChain 27(data) 302 51 + Store 307 306 + 308: 6(int) Load 8(invocation) + 309: 137(ptr) AccessChain 27(data) 29 62 30 + 310:22(float64_t) Load 309 + 311: 6(int) Load 8(invocation) + 312:22(float64_t) GroupNonUniformShuffleDown 35 310 311 + 313: 137(ptr) AccessChain 27(data) 308 62 30 + Store 313 312 + 314: 6(int) Load 8(invocation) + 315: 145(ptr) AccessChain 27(data) 39 62 + 316: 23(f64vec4) Load 315 + 317:144(f64vec2) VectorShuffle 316 316 0 1 + 318: 6(int) Load 8(invocation) + 319:144(f64vec2) GroupNonUniformShuffleDown 35 317 318 + 320: 145(ptr) AccessChain 27(data) 314 62 + 321: 23(f64vec4) Load 320 + 322: 23(f64vec4) VectorShuffle 321 319 4 5 2 3 + Store 320 322 + 323: 6(int) Load 8(invocation) + 324: 145(ptr) AccessChain 27(data) 51 62 + 325: 23(f64vec4) Load 324 + 326:155(f64vec3) VectorShuffle 325 325 0 1 2 + 327: 6(int) Load 8(invocation) + 328:155(f64vec3) GroupNonUniformShuffleDown 35 326 327 + 329: 145(ptr) AccessChain 27(data) 323 62 + 330: 23(f64vec4) Load 329 + 331: 23(f64vec4) VectorShuffle 330 328 4 5 6 3 + Store 329 331 + 332: 6(int) Load 8(invocation) + 333: 145(ptr) AccessChain 27(data) 62 62 + 334: 23(f64vec4) Load 333 + 335: 6(int) Load 8(invocation) + 336: 23(f64vec4) GroupNonUniformShuffleDown 35 334 335 + 337: 145(ptr) AccessChain 27(data) 332 62 + Store 337 336 + 338: 6(int) Load 8(invocation) + 339: 69(ptr) AccessChain 27(data) 29 39 30 + 340: 19(int) Load 339 + 341: 173(bool) SLessThan 340 29 + 342: 6(int) Load 8(invocation) + 343: 173(bool) GroupNonUniformShuffleDown 35 341 342 + 344: 19(int) Select 343 39 29 + 345: 69(ptr) AccessChain 27(data) 338 39 30 + Store 345 344 + 346: 6(int) Load 8(invocation) + 347: 77(ptr) AccessChain 27(data) 39 39 + 348: 20(ivec4) Load 347 + 349: 76(ivec2) VectorShuffle 348 348 0 1 + 350: 184(bvec2) SLessThan 349 183 + 351: 6(int) Load 8(invocation) + 352: 184(bvec2) GroupNonUniformShuffleDown 35 350 351 + 353: 76(ivec2) Select 352 188 183 + 354: 77(ptr) AccessChain 27(data) 346 39 + 355: 20(ivec4) Load 354 + 356: 20(ivec4) VectorShuffle 355 353 4 5 2 3 + Store 354 356 + 357: 6(int) Load 8(invocation) + 358: 77(ptr) AccessChain 27(data) 39 39 + 359: 20(ivec4) Load 358 + 360: 87(ivec3) VectorShuffle 359 359 0 1 2 + 361: 198(bvec3) SLessThan 360 197 + 362: 6(int) Load 8(invocation) + 363: 198(bvec3) GroupNonUniformShuffleDown 35 361 362 + 364: 87(ivec3) Select 363 202 197 + 365: 77(ptr) AccessChain 27(data) 357 39 + 366: 20(ivec4) Load 365 + 367: 20(ivec4) VectorShuffle 366 364 4 5 6 3 + Store 365 367 + 368: 6(int) Load 8(invocation) + 369: 77(ptr) AccessChain 27(data) 39 39 + 370: 20(ivec4) Load 369 + 371: 211(bvec4) SLessThan 370 210 + 372: 6(int) Load 8(invocation) + 373: 211(bvec4) GroupNonUniformShuffleDown 35 371 372 + 374: 20(ivec4) Select 373 215 210 + 375: 77(ptr) AccessChain 27(data) 368 39 + Store 375 374 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupVote.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupVote.comp.out new file mode 100644 index 00000000000..4fdbb0be037 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subgroupVote.comp.out @@ -0,0 +1,288 @@ +spv.subgroupVote.comp +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 216 + + Capability Shader + Capability Float64 + Capability GroupNonUniform + Capability GroupNonUniformVote + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint GLCompute 4 "main" 10 12 + ExecutionMode 4 LocalSize 8 8 1 + Source GLSL 450 + SourceExtension "GL_KHR_shader_subgroup_basic" + SourceExtension "GL_KHR_shader_subgroup_vote" + Name 4 "main" + Name 8 "invocation" + Name 10 "gl_SubgroupInvocationID" + Name 12 "gl_SubgroupSize" + Name 24 "Buffers" + MemberName 24(Buffers) 0 "f4" + MemberName 24(Buffers) 1 "i4" + MemberName 24(Buffers) 2 "u4" + MemberName 24(Buffers) 3 "d4" + MemberName 24(Buffers) 4 "r" + Name 27 "data" + Decorate 10(gl_SubgroupInvocationID) RelaxedPrecision + Decorate 10(gl_SubgroupInvocationID) BuiltIn SubgroupLocalInvocationId + Decorate 11 RelaxedPrecision + Decorate 12(gl_SubgroupSize) RelaxedPrecision + Decorate 12(gl_SubgroupSize) BuiltIn SubgroupSize + Decorate 13 RelaxedPrecision + Decorate 14 RelaxedPrecision + Decorate 16 RelaxedPrecision + MemberDecorate 24(Buffers) 0 Offset 0 + MemberDecorate 24(Buffers) 1 Offset 16 + MemberDecorate 24(Buffers) 2 Offset 32 + MemberDecorate 24(Buffers) 3 Offset 64 + MemberDecorate 24(Buffers) 4 Offset 96 + Decorate 24(Buffers) Block + Decorate 27(data) DescriptorSet 0 + Decorate 27(data) Binding 0 + Decorate 215 BuiltIn WorkgroupSize + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 0 + 7: TypePointer Function 6(int) + 9: TypePointer Input 6(int) +10(gl_SubgroupInvocationID): 9(ptr) Variable Input +12(gl_SubgroupSize): 9(ptr) Variable Input + 15: 6(int) Constant 4 + 17: TypeFloat 32 + 18: TypeVector 17(float) 4 + 19: TypeInt 32 1 + 20: TypeVector 19(int) 4 + 21: TypeVector 6(int) 4 + 22: TypeFloat 64 + 23: TypeVector 22(float64_t) 4 + 24(Buffers): TypeStruct 18(fvec4) 20(ivec4) 21(ivec4) 23(f64vec4) 19(int) + 25: TypeArray 24(Buffers) 15 + 26: TypePointer StorageBuffer 25 + 27(data): 26(ptr) Variable StorageBuffer + 29: 19(int) Constant 4 + 30: TypePointer StorageBuffer 19(int) + 33: 19(int) Constant 0 + 34: TypeBool + 36: 6(int) Constant 3 + 41: 6(int) Constant 0 + 42: TypePointer StorageBuffer 17(float) + 46: 19(int) Constant 1 + 50: TypeVector 17(float) 2 + 51: TypePointer StorageBuffer 18(fvec4) + 59: 19(int) Constant 2 + 60: TypeVector 17(float) 3 + 68: 19(int) Constant 3 + 81: TypeVector 19(int) 2 + 82: TypePointer StorageBuffer 20(ivec4) + 90: TypeVector 19(int) 3 + 104: TypePointer StorageBuffer 6(int) + 111: TypeVector 6(int) 2 + 112: TypePointer StorageBuffer 21(ivec4) + 120: TypeVector 6(int) 3 + 142: TypePointer StorageBuffer 22(float64_t) + 149: TypeVector 22(float64_t) 2 + 150: TypePointer StorageBuffer 23(f64vec4) + 158: TypeVector 22(float64_t) 3 + 182: 81(ivec2) ConstantComposite 33 33 + 183: TypeVector 34(bool) 2 + 194: 90(ivec3) ConstantComposite 33 33 33 + 195: TypeVector 34(bool) 3 + 205: 20(ivec4) ConstantComposite 33 33 33 33 + 206: TypeVector 34(bool) 4 + 213: 6(int) Constant 8 + 214: 6(int) Constant 1 + 215: 120(ivec3) ConstantComposite 213 213 214 + 4(main): 2 Function None 3 + 5: Label + 8(invocation): 7(ptr) Variable Function + 11: 6(int) Load 10(gl_SubgroupInvocationID) + 13: 6(int) Load 12(gl_SubgroupSize) + 14: 6(int) IAdd 11 13 + 16: 6(int) UMod 14 15 + Store 8(invocation) 16 + 28: 6(int) Load 8(invocation) + 31: 30(ptr) AccessChain 27(data) 28 29 + 32: 19(int) Load 31 + 35: 34(bool) SLessThan 32 33 + 37: 34(bool) GroupNonUniformAll 36 35 + SelectionMerge 39 None + BranchConditional 37 38 133 + 38: Label + 40: 6(int) Load 8(invocation) + 43: 42(ptr) AccessChain 27(data) 33 33 41 + 44: 17(float) Load 43 + 45: 34(bool) GroupNonUniformAllEqual 36 44 + 47: 19(int) Select 45 46 33 + 48: 30(ptr) AccessChain 27(data) 40 29 + Store 48 47 + 49: 6(int) Load 8(invocation) + 52: 51(ptr) AccessChain 27(data) 46 33 + 53: 18(fvec4) Load 52 + 54: 50(fvec2) VectorShuffle 53 53 0 1 + 55: 34(bool) GroupNonUniformAllEqual 36 54 + 56: 19(int) Select 55 46 33 + 57: 30(ptr) AccessChain 27(data) 49 29 + Store 57 56 + 58: 6(int) Load 8(invocation) + 61: 51(ptr) AccessChain 27(data) 59 33 + 62: 18(fvec4) Load 61 + 63: 60(fvec3) VectorShuffle 62 62 0 1 2 + 64: 34(bool) GroupNonUniformAllEqual 36 63 + 65: 19(int) Select 64 46 33 + 66: 30(ptr) AccessChain 27(data) 58 29 + Store 66 65 + 67: 6(int) Load 8(invocation) + 69: 51(ptr) AccessChain 27(data) 68 33 + 70: 18(fvec4) Load 69 + 71: 34(bool) GroupNonUniformAllEqual 36 70 + 72: 19(int) Select 71 46 33 + 73: 30(ptr) AccessChain 27(data) 67 29 + Store 73 72 + 74: 6(int) Load 8(invocation) + 75: 30(ptr) AccessChain 27(data) 33 46 41 + 76: 19(int) Load 75 + 77: 34(bool) GroupNonUniformAllEqual 36 76 + 78: 19(int) Select 77 46 33 + 79: 30(ptr) AccessChain 27(data) 74 29 + Store 79 78 + 80: 6(int) Load 8(invocation) + 83: 82(ptr) AccessChain 27(data) 46 46 + 84: 20(ivec4) Load 83 + 85: 81(ivec2) VectorShuffle 84 84 0 1 + 86: 34(bool) GroupNonUniformAllEqual 36 85 + 87: 19(int) Select 86 46 33 + 88: 30(ptr) AccessChain 27(data) 80 29 + Store 88 87 + 89: 6(int) Load 8(invocation) + 91: 82(ptr) AccessChain 27(data) 59 46 + 92: 20(ivec4) Load 91 + 93: 90(ivec3) VectorShuffle 92 92 0 1 2 + 94: 34(bool) GroupNonUniformAllEqual 36 93 + 95: 19(int) Select 94 46 33 + 96: 30(ptr) AccessChain 27(data) 89 29 + Store 96 95 + 97: 6(int) Load 8(invocation) + 98: 82(ptr) AccessChain 27(data) 68 46 + 99: 20(ivec4) Load 98 + 100: 34(bool) GroupNonUniformAllEqual 36 99 + 101: 19(int) Select 100 46 33 + 102: 30(ptr) AccessChain 27(data) 97 29 + Store 102 101 + 103: 6(int) Load 8(invocation) + 105: 104(ptr) AccessChain 27(data) 33 59 41 + 106: 6(int) Load 105 + 107: 34(bool) GroupNonUniformAllEqual 36 106 + 108: 19(int) Select 107 46 33 + 109: 30(ptr) AccessChain 27(data) 103 29 + Store 109 108 + 110: 6(int) Load 8(invocation) + 113: 112(ptr) AccessChain 27(data) 46 59 + 114: 21(ivec4) Load 113 + 115: 111(ivec2) VectorShuffle 114 114 0 1 + 116: 34(bool) GroupNonUniformAllEqual 36 115 + 117: 19(int) Select 116 46 33 + 118: 30(ptr) AccessChain 27(data) 110 29 + Store 118 117 + 119: 6(int) Load 8(invocation) + 121: 112(ptr) AccessChain 27(data) 59 59 + 122: 21(ivec4) Load 121 + 123: 120(ivec3) VectorShuffle 122 122 0 1 2 + 124: 34(bool) GroupNonUniformAllEqual 36 123 + 125: 19(int) Select 124 46 33 + 126: 30(ptr) AccessChain 27(data) 119 29 + Store 126 125 + 127: 6(int) Load 8(invocation) + 128: 112(ptr) AccessChain 27(data) 68 59 + 129: 21(ivec4) Load 128 + 130: 34(bool) GroupNonUniformAllEqual 36 129 + 131: 19(int) Select 130 46 33 + 132: 30(ptr) AccessChain 27(data) 127 29 + Store 132 131 + Branch 39 + 133: Label + 134: 6(int) Load 8(invocation) + 135: 30(ptr) AccessChain 27(data) 134 29 + 136: 19(int) Load 135 + 137: 34(bool) SLessThan 136 33 + 138: 34(bool) GroupNonUniformAny 36 137 + SelectionMerge 140 None + BranchConditional 138 139 140 + 139: Label + 141: 6(int) Load 8(invocation) + 143: 142(ptr) AccessChain 27(data) 33 68 41 + 144:22(float64_t) Load 143 + 145: 34(bool) GroupNonUniformAllEqual 36 144 + 146: 19(int) Select 145 46 33 + 147: 30(ptr) AccessChain 27(data) 141 29 + Store 147 146 + 148: 6(int) Load 8(invocation) + 151: 150(ptr) AccessChain 27(data) 46 68 + 152: 23(f64vec4) Load 151 + 153:149(f64vec2) VectorShuffle 152 152 0 1 + 154: 34(bool) GroupNonUniformAllEqual 36 153 + 155: 19(int) Select 154 46 33 + 156: 30(ptr) AccessChain 27(data) 148 29 + Store 156 155 + 157: 6(int) Load 8(invocation) + 159: 150(ptr) AccessChain 27(data) 59 68 + 160: 23(f64vec4) Load 159 + 161:158(f64vec3) VectorShuffle 160 160 0 1 2 + 162: 34(bool) GroupNonUniformAllEqual 36 161 + 163: 19(int) Select 162 46 33 + 164: 30(ptr) AccessChain 27(data) 157 29 + Store 164 163 + 165: 6(int) Load 8(invocation) + 166: 150(ptr) AccessChain 27(data) 68 68 + 167: 23(f64vec4) Load 166 + 168: 34(bool) GroupNonUniformAllEqual 36 167 + 169: 19(int) Select 168 46 33 + 170: 30(ptr) AccessChain 27(data) 165 29 + Store 170 169 + 171: 6(int) Load 8(invocation) + 172: 30(ptr) AccessChain 27(data) 33 46 41 + 173: 19(int) Load 172 + 174: 34(bool) SLessThan 173 33 + 175: 34(bool) GroupNonUniformAllEqual 36 174 + 176: 19(int) Select 175 46 33 + 177: 30(ptr) AccessChain 27(data) 171 29 + Store 177 176 + 178: 6(int) Load 8(invocation) + 179: 82(ptr) AccessChain 27(data) 46 46 + 180: 20(ivec4) Load 179 + 181: 81(ivec2) VectorShuffle 180 180 0 1 + 184: 183(bvec2) SLessThan 181 182 + 185: 34(bool) GroupNonUniformAllEqual 36 184 + 186: 19(int) Select 185 46 33 + 187: 81(ivec2) CompositeConstruct 186 186 + 188: 19(int) CompositeExtract 187 0 + 189: 30(ptr) AccessChain 27(data) 178 29 + Store 189 188 + 190: 6(int) Load 8(invocation) + 191: 82(ptr) AccessChain 27(data) 46 46 + 192: 20(ivec4) Load 191 + 193: 90(ivec3) VectorShuffle 192 192 0 1 2 + 196: 195(bvec3) SLessThan 193 194 + 197: 34(bool) GroupNonUniformAllEqual 36 196 + 198: 19(int) Select 197 46 33 + 199: 90(ivec3) CompositeConstruct 198 198 198 + 200: 19(int) CompositeExtract 199 0 + 201: 30(ptr) AccessChain 27(data) 190 29 + Store 201 200 + 202: 6(int) Load 8(invocation) + 203: 82(ptr) AccessChain 27(data) 46 46 + 204: 20(ivec4) Load 203 + 207: 206(bvec4) SLessThan 204 205 + 208: 34(bool) GroupNonUniformAllEqual 36 207 + 209: 19(int) Select 208 46 33 + 210: 20(ivec4) CompositeConstruct 209 209 209 209 + 211: 19(int) CompositeExtract 210 0 + 212: 30(ptr) AccessChain 27(data) 202 29 + Store 212 211 + Branch 140 + 140: Label + Branch 39 + 39: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subpass.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subpass.frag.out index 76248982cdb..044243e21f9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subpass.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.subpass.frag.out @@ -1,6 +1,6 @@ spv.subpass.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 67 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.switch.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.switch.frag.out index 0a35155533f..47cc5d4c12f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.switch.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.switch.frag.out @@ -4,7 +4,7 @@ WARNING: 0:134: 'switch' : last case/default label not followed by statements WARNING: 0:139: 'switch' : last case/default label not followed by statements // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 269 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzle.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzle.frag.out index b194d272117..2a132d5824f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzle.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzle.frag.out @@ -1,6 +1,6 @@ spv.swizzle.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 108 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzleInversion.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzleInversion.frag.out index dd910f7cbb5..0aee7ae7294 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzleInversion.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.swizzleInversion.frag.out @@ -1,6 +1,6 @@ spv.swizzleInversion.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 46 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.frag.out index e61785ce0e5..b5fccc32a52 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.frag.out @@ -1,6 +1,6 @@ spv.test.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 55 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.vert.out index 5f3d41edd4e..3303c88b542 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.test.vert.out @@ -2,7 +2,7 @@ spv.test.vert WARNING: 0:5: attribute deprecated in version 130; may be removed in future release // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 24 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.frag.out index 99bb381aecf..e685018f09c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.frag.out @@ -4,7 +4,7 @@ WARNING: 0:11: varying deprecated in version 130; may be removed in future relea WARNING: 0:12: varying deprecated in version 130; may be removed in future release // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 305 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out index 6af2b4fb728..ef8bbf6ac23 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.sampler.transform.frag.out @@ -1,6 +1,6 @@ spv.texture.sampler.transform.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 20 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.vert.out index c704f9fa033..0c1b7a14bcf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.texture.vert.out @@ -1,6 +1,6 @@ spv.texture.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 150 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureBuffer.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureBuffer.vert.out index 2a9432dc37f..e327cb487dc 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureBuffer.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureBuffer.vert.out @@ -1,6 +1,6 @@ spv.textureBuffer.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 42 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out index 3a416687df1..d01515dc5f1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.textureGatherBiasLod.frag.out @@ -1,9 +1,14 @@ spv.textureGatherBiasLod.frag +error: SPIRV-Tools Validation Errors +error: Image Operand Bias can only be used with ImplicitLod opcodes + %27 = OpImageGather %v4float %17 %21 %int_0 Bias %26 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 298 Capability Shader + Capability ImageGatherExtended Capability SparseResidency Capability SampledCubeArray Capability ImageGatherBiasLodAMD diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.types.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.types.frag.out index 87264868b78..e6fd3e0c206 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.types.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.types.frag.out @@ -1,12 +1,12 @@ spv.types.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 260 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 91 93 100 102 109 111 118 120 127 129 136 138 145 147 154 156 160 + EntryPoint Fragment 4 "main" 96 98 105 107 114 116 123 125 132 134 141 143 150 152 159 161 165 ExecutionMode 4 OriginUpperLeft Source GLSL 140 Name 4 "main" @@ -15,47 +15,47 @@ spv.types.frag Name 12 "i_b" Name 17 "b2" Name 19 "u_b2" - Name 22 "i_b2" - Name 35 "b3" - Name 37 "u_b3" - Name 40 "i_b3" - Name 59 "b4" - Name 61 "u_b4" - Name 64 "i_b4" - Name 89 "i" - Name 91 "u_i" - Name 93 "i_i" - Name 98 "i2" - Name 100 "u_i2" - Name 102 "i_i2" - Name 107 "i3" - Name 109 "u_i3" - Name 111 "i_i3" - Name 116 "i4" - Name 118 "u_i4" - Name 120 "i_i4" - Name 125 "f" - Name 127 "u_f" - Name 129 "i_f" - Name 134 "f2" - Name 136 "u_f2" - Name 138 "i_f2" - Name 143 "f3" - Name 145 "u_f3" - Name 147 "i_f3" - Name 152 "f4" - Name 154 "u_f4" - Name 156 "i_f4" - Name 160 "gl_FragColor" - Decorate 91(u_i) Flat - Decorate 93(i_i) Flat - Decorate 100(u_i2) Flat - Decorate 102(i_i2) Flat - Decorate 109(u_i3) Flat - Decorate 111(i_i3) Flat - Decorate 118(u_i4) Flat - Decorate 120(i_i4) Flat - Decorate 160(gl_FragColor) Location 0 + Name 24 "i_b2" + Name 38 "b3" + Name 40 "u_b3" + Name 43 "i_b3" + Name 63 "b4" + Name 65 "u_b4" + Name 68 "i_b4" + Name 94 "i" + Name 96 "u_i" + Name 98 "i_i" + Name 103 "i2" + Name 105 "u_i2" + Name 107 "i_i2" + Name 112 "i3" + Name 114 "u_i3" + Name 116 "i_i3" + Name 121 "i4" + Name 123 "u_i4" + Name 125 "i_i4" + Name 130 "f" + Name 132 "u_f" + Name 134 "i_f" + Name 139 "f2" + Name 141 "u_f2" + Name 143 "i_f2" + Name 148 "f3" + Name 150 "u_f3" + Name 152 "i_f3" + Name 157 "f4" + Name 159 "u_f4" + Name 161 "i_f4" + Name 165 "gl_FragColor" + Decorate 96(u_i) Flat + Decorate 98(i_i) Flat + Decorate 105(u_i2) Flat + Decorate 107(i_i2) Flat + Decorate 114(u_i3) Flat + Decorate 116(i_i3) Flat + Decorate 123(u_i4) Flat + Decorate 125(i_i4) Flat + Decorate 165(gl_FragColor) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeBool @@ -67,271 +67,271 @@ spv.types.frag 16: TypePointer Function 15(bvec2) 18: TypePointer Private 15(bvec2) 19(u_b2): 18(ptr) Variable Private - 22(i_b2): 18(ptr) Variable Private - 33: TypeVector 6(bool) 3 - 34: TypePointer Function 33(bvec3) - 36: TypePointer Private 33(bvec3) - 37(u_b3): 36(ptr) Variable Private - 40(i_b3): 36(ptr) Variable Private - 57: TypeVector 6(bool) 4 - 58: TypePointer Function 57(bvec4) - 60: TypePointer Private 57(bvec4) - 61(u_b4): 60(ptr) Variable Private - 64(i_b4): 60(ptr) Variable Private - 87: TypeInt 32 1 - 88: TypePointer Function 87(int) - 90: TypePointer Input 87(int) - 91(u_i): 90(ptr) Variable Input - 93(i_i): 90(ptr) Variable Input - 96: TypeVector 87(int) 2 - 97: TypePointer Function 96(ivec2) - 99: TypePointer Input 96(ivec2) - 100(u_i2): 99(ptr) Variable Input - 102(i_i2): 99(ptr) Variable Input - 105: TypeVector 87(int) 3 - 106: TypePointer Function 105(ivec3) - 108: TypePointer Input 105(ivec3) - 109(u_i3): 108(ptr) Variable Input - 111(i_i3): 108(ptr) Variable Input - 114: TypeVector 87(int) 4 - 115: TypePointer Function 114(ivec4) - 117: TypePointer Input 114(ivec4) - 118(u_i4): 117(ptr) Variable Input - 120(i_i4): 117(ptr) Variable Input - 123: TypeFloat 32 - 124: TypePointer Function 123(float) - 126: TypePointer Input 123(float) - 127(u_f): 126(ptr) Variable Input - 129(i_f): 126(ptr) Variable Input - 132: TypeVector 123(float) 2 - 133: TypePointer Function 132(fvec2) - 135: TypePointer Input 132(fvec2) - 136(u_f2): 135(ptr) Variable Input - 138(i_f2): 135(ptr) Variable Input - 141: TypeVector 123(float) 3 - 142: TypePointer Function 141(fvec3) - 144: TypePointer Input 141(fvec3) - 145(u_f3): 144(ptr) Variable Input - 147(i_f3): 144(ptr) Variable Input - 150: TypeVector 123(float) 4 - 151: TypePointer Function 150(fvec4) - 153: TypePointer Input 150(fvec4) - 154(u_f4): 153(ptr) Variable Input - 156(i_f4): 153(ptr) Variable Input - 159: TypePointer Output 150(fvec4) -160(gl_FragColor): 159(ptr) Variable Output - 193: TypeInt 32 0 - 194: 193(int) Constant 0 - 198: 193(int) Constant 1 - 208: 193(int) Constant 2 - 221: 193(int) Constant 3 - 257: 123(float) Constant 1065353216 - 258: 150(fvec4) ConstantComposite 257 257 257 257 + 20: TypeInt 32 0 + 21: 20(int) Constant 0 + 24(i_b2): 18(ptr) Variable Private + 28: 20(int) Constant 1 + 36: TypeVector 6(bool) 3 + 37: TypePointer Function 36(bvec3) + 39: TypePointer Private 36(bvec3) + 40(u_b3): 39(ptr) Variable Private + 43(i_b3): 39(ptr) Variable Private + 53: 20(int) Constant 2 + 61: TypeVector 6(bool) 4 + 62: TypePointer Function 61(bvec4) + 64: TypePointer Private 61(bvec4) + 65(u_b4): 64(ptr) Variable Private + 68(i_b4): 64(ptr) Variable Private + 84: 20(int) Constant 3 + 92: TypeInt 32 1 + 93: TypePointer Function 92(int) + 95: TypePointer Input 92(int) + 96(u_i): 95(ptr) Variable Input + 98(i_i): 95(ptr) Variable Input + 101: TypeVector 92(int) 2 + 102: TypePointer Function 101(ivec2) + 104: TypePointer Input 101(ivec2) + 105(u_i2): 104(ptr) Variable Input + 107(i_i2): 104(ptr) Variable Input + 110: TypeVector 92(int) 3 + 111: TypePointer Function 110(ivec3) + 113: TypePointer Input 110(ivec3) + 114(u_i3): 113(ptr) Variable Input + 116(i_i3): 113(ptr) Variable Input + 119: TypeVector 92(int) 4 + 120: TypePointer Function 119(ivec4) + 122: TypePointer Input 119(ivec4) + 123(u_i4): 122(ptr) Variable Input + 125(i_i4): 122(ptr) Variable Input + 128: TypeFloat 32 + 129: TypePointer Function 128(float) + 131: TypePointer Input 128(float) + 132(u_f): 131(ptr) Variable Input + 134(i_f): 131(ptr) Variable Input + 137: TypeVector 128(float) 2 + 138: TypePointer Function 137(fvec2) + 140: TypePointer Input 137(fvec2) + 141(u_f2): 140(ptr) Variable Input + 143(i_f2): 140(ptr) Variable Input + 146: TypeVector 128(float) 3 + 147: TypePointer Function 146(fvec3) + 149: TypePointer Input 146(fvec3) + 150(u_f3): 149(ptr) Variable Input + 152(i_f3): 149(ptr) Variable Input + 155: TypeVector 128(float) 4 + 156: TypePointer Function 155(fvec4) + 158: TypePointer Input 155(fvec4) + 159(u_f4): 158(ptr) Variable Input + 161(i_f4): 158(ptr) Variable Input + 164: TypePointer Output 155(fvec4) +165(gl_FragColor): 164(ptr) Variable Output + 257: 128(float) Constant 1065353216 + 258: 155(fvec4) ConstantComposite 257 257 257 257 4(main): 2 Function None 3 5: Label 8(b): 7(ptr) Variable Function 17(b2): 16(ptr) Variable Function - 35(b3): 34(ptr) Variable Function - 59(b4): 58(ptr) Variable Function - 89(i): 88(ptr) Variable Function - 98(i2): 97(ptr) Variable Function - 107(i3): 106(ptr) Variable Function - 116(i4): 115(ptr) Variable Function - 125(f): 124(ptr) Variable Function - 134(f2): 133(ptr) Variable Function - 143(f3): 142(ptr) Variable Function - 152(f4): 151(ptr) Variable Function - 161: 151(ptr) Variable Function + 38(b3): 37(ptr) Variable Function + 63(b4): 62(ptr) Variable Function + 94(i): 93(ptr) Variable Function + 103(i2): 102(ptr) Variable Function + 112(i3): 111(ptr) Variable Function + 121(i4): 120(ptr) Variable Function + 130(f): 129(ptr) Variable Function + 139(f2): 138(ptr) Variable Function + 148(f3): 147(ptr) Variable Function + 157(f4): 156(ptr) Variable Function + 194: 156(ptr) Variable Function 11: 6(bool) Load 10(u_b) 13: 6(bool) Load 12(i_b) 14: 6(bool) LogicalAnd 11 13 Store 8(b) 14 - 20: 15(bvec2) Load 19(u_b2) - 21: 6(bool) CompositeExtract 20 0 - 23: 15(bvec2) Load 22(i_b2) - 24: 6(bool) CompositeExtract 23 0 - 25: 6(bool) LogicalAnd 21 24 - 26: 15(bvec2) Load 19(u_b2) - 27: 6(bool) CompositeExtract 26 1 - 28: 6(bool) LogicalAnd 25 27 - 29: 15(bvec2) Load 22(i_b2) - 30: 6(bool) CompositeExtract 29 1 - 31: 6(bool) LogicalAnd 28 30 - 32: 15(bvec2) CompositeConstruct 31 31 - Store 17(b2) 32 - 38: 33(bvec3) Load 37(u_b3) - 39: 6(bool) CompositeExtract 38 0 - 41: 33(bvec3) Load 40(i_b3) - 42: 6(bool) CompositeExtract 41 0 - 43: 6(bool) LogicalAnd 39 42 - 44: 33(bvec3) Load 37(u_b3) - 45: 6(bool) CompositeExtract 44 1 - 46: 6(bool) LogicalAnd 43 45 - 47: 33(bvec3) Load 40(i_b3) - 48: 6(bool) CompositeExtract 47 1 + 22: 9(ptr) AccessChain 19(u_b2) 21 + 23: 6(bool) Load 22 + 25: 9(ptr) AccessChain 24(i_b2) 21 + 26: 6(bool) Load 25 + 27: 6(bool) LogicalAnd 23 26 + 29: 9(ptr) AccessChain 19(u_b2) 28 + 30: 6(bool) Load 29 + 31: 6(bool) LogicalAnd 27 30 + 32: 9(ptr) AccessChain 24(i_b2) 28 + 33: 6(bool) Load 32 + 34: 6(bool) LogicalAnd 31 33 + 35: 15(bvec2) CompositeConstruct 34 34 + Store 17(b2) 35 + 41: 9(ptr) AccessChain 40(u_b3) 21 + 42: 6(bool) Load 41 + 44: 9(ptr) AccessChain 43(i_b3) 21 + 45: 6(bool) Load 44 + 46: 6(bool) LogicalAnd 42 45 + 47: 9(ptr) AccessChain 40(u_b3) 28 + 48: 6(bool) Load 47 49: 6(bool) LogicalAnd 46 48 - 50: 33(bvec3) Load 37(u_b3) - 51: 6(bool) CompositeExtract 50 2 + 50: 9(ptr) AccessChain 43(i_b3) 28 + 51: 6(bool) Load 50 52: 6(bool) LogicalAnd 49 51 - 53: 33(bvec3) Load 40(i_b3) - 54: 6(bool) CompositeExtract 53 2 - 55: 6(bool) LogicalAnd 52 54 - 56: 33(bvec3) CompositeConstruct 55 55 55 - Store 35(b3) 56 - 62: 57(bvec4) Load 61(u_b4) - 63: 6(bool) CompositeExtract 62 0 - 65: 57(bvec4) Load 64(i_b4) - 66: 6(bool) CompositeExtract 65 0 - 67: 6(bool) LogicalAnd 63 66 - 68: 57(bvec4) Load 61(u_b4) - 69: 6(bool) CompositeExtract 68 1 - 70: 6(bool) LogicalAnd 67 69 - 71: 57(bvec4) Load 64(i_b4) - 72: 6(bool) CompositeExtract 71 1 - 73: 6(bool) LogicalAnd 70 72 - 74: 57(bvec4) Load 61(u_b4) - 75: 6(bool) CompositeExtract 74 2 - 76: 6(bool) LogicalAnd 73 75 - 77: 57(bvec4) Load 64(i_b4) - 78: 6(bool) CompositeExtract 77 2 - 79: 6(bool) LogicalAnd 76 78 - 80: 57(bvec4) Load 61(u_b4) - 81: 6(bool) CompositeExtract 80 3 - 82: 6(bool) LogicalAnd 79 81 - 83: 57(bvec4) Load 64(i_b4) - 84: 6(bool) CompositeExtract 83 3 - 85: 6(bool) LogicalAnd 82 84 - 86: 57(bvec4) CompositeConstruct 85 85 85 85 - Store 59(b4) 86 - 92: 87(int) Load 91(u_i) - 94: 87(int) Load 93(i_i) - 95: 87(int) IAdd 92 94 - Store 89(i) 95 - 101: 96(ivec2) Load 100(u_i2) - 103: 96(ivec2) Load 102(i_i2) - 104: 96(ivec2) IAdd 101 103 - Store 98(i2) 104 - 110: 105(ivec3) Load 109(u_i3) - 112: 105(ivec3) Load 111(i_i3) - 113: 105(ivec3) IAdd 110 112 - Store 107(i3) 113 - 119: 114(ivec4) Load 118(u_i4) - 121: 114(ivec4) Load 120(i_i4) - 122: 114(ivec4) IAdd 119 121 - Store 116(i4) 122 - 128: 123(float) Load 127(u_f) - 130: 123(float) Load 129(i_f) - 131: 123(float) FAdd 128 130 - Store 125(f) 131 - 137: 132(fvec2) Load 136(u_f2) - 139: 132(fvec2) Load 138(i_f2) - 140: 132(fvec2) FAdd 137 139 - Store 134(f2) 140 - 146: 141(fvec3) Load 145(u_f3) - 148: 141(fvec3) Load 147(i_f3) - 149: 141(fvec3) FAdd 146 148 - Store 143(f3) 149 - 155: 150(fvec4) Load 154(u_f4) - 157: 150(fvec4) Load 156(i_f4) - 158: 150(fvec4) FAdd 155 157 - Store 152(f4) 158 - 162: 6(bool) Load 8(b) - 163: 15(bvec2) Load 17(b2) - 164: 6(bool) CompositeExtract 163 0 - 165: 6(bool) LogicalOr 162 164 - 166: 15(bvec2) Load 17(b2) - 167: 6(bool) CompositeExtract 166 1 - 168: 6(bool) LogicalOr 165 167 - 169: 33(bvec3) Load 35(b3) - 170: 6(bool) CompositeExtract 169 0 - 171: 6(bool) LogicalOr 168 170 - 172: 33(bvec3) Load 35(b3) - 173: 6(bool) CompositeExtract 172 1 - 174: 6(bool) LogicalOr 171 173 - 175: 33(bvec3) Load 35(b3) - 176: 6(bool) CompositeExtract 175 2 - 177: 6(bool) LogicalOr 174 176 - 178: 57(bvec4) Load 59(b4) - 179: 6(bool) CompositeExtract 178 0 - 180: 6(bool) LogicalOr 177 179 - 181: 57(bvec4) Load 59(b4) - 182: 6(bool) CompositeExtract 181 1 - 183: 6(bool) LogicalOr 180 182 - 184: 57(bvec4) Load 59(b4) - 185: 6(bool) CompositeExtract 184 2 - 186: 6(bool) LogicalOr 183 185 - 187: 57(bvec4) Load 59(b4) - 188: 6(bool) CompositeExtract 187 3 - 189: 6(bool) LogicalOr 186 188 - SelectionMerge 191 None - BranchConditional 189 190 256 - 190: Label - 192: 87(int) Load 89(i) - 195: 88(ptr) AccessChain 98(i2) 194 - 196: 87(int) Load 195 - 197: 87(int) IAdd 192 196 - 199: 88(ptr) AccessChain 98(i2) 198 - 200: 87(int) Load 199 - 201: 87(int) IAdd 197 200 - 202: 88(ptr) AccessChain 107(i3) 194 - 203: 87(int) Load 202 - 204: 87(int) IAdd 201 203 - 205: 88(ptr) AccessChain 107(i3) 198 - 206: 87(int) Load 205 - 207: 87(int) IAdd 204 206 - 209: 88(ptr) AccessChain 107(i3) 208 - 210: 87(int) Load 209 - 211: 87(int) IAdd 207 210 - 212: 88(ptr) AccessChain 116(i4) 194 - 213: 87(int) Load 212 - 214: 87(int) IAdd 211 213 - 215: 88(ptr) AccessChain 116(i4) 198 - 216: 87(int) Load 215 - 217: 87(int) IAdd 214 216 - 218: 88(ptr) AccessChain 116(i4) 208 - 219: 87(int) Load 218 - 220: 87(int) IAdd 217 219 - 222: 88(ptr) AccessChain 116(i4) 221 - 223: 87(int) Load 222 - 224: 87(int) IAdd 220 223 - 225: 123(float) ConvertSToF 224 - 226: 123(float) Load 125(f) - 227: 123(float) FAdd 225 226 - 228: 124(ptr) AccessChain 134(f2) 194 - 229: 123(float) Load 228 - 230: 123(float) FAdd 227 229 - 231: 124(ptr) AccessChain 134(f2) 198 - 232: 123(float) Load 231 - 233: 123(float) FAdd 230 232 - 234: 124(ptr) AccessChain 143(f3) 194 - 235: 123(float) Load 234 - 236: 123(float) FAdd 233 235 - 237: 124(ptr) AccessChain 143(f3) 198 - 238: 123(float) Load 237 - 239: 123(float) FAdd 236 238 - 240: 124(ptr) AccessChain 143(f3) 208 - 241: 123(float) Load 240 - 242: 123(float) FAdd 239 241 - 243: 124(ptr) AccessChain 152(f4) 194 - 244: 123(float) Load 243 - 245: 123(float) FAdd 242 244 - 246: 124(ptr) AccessChain 152(f4) 198 - 247: 123(float) Load 246 - 248: 123(float) FAdd 245 247 - 249: 124(ptr) AccessChain 152(f4) 208 - 250: 123(float) Load 249 - 251: 123(float) FAdd 248 250 - 252: 124(ptr) AccessChain 152(f4) 221 - 253: 123(float) Load 252 - 254: 123(float) FAdd 251 253 - 255: 150(fvec4) CompositeConstruct 254 254 254 254 - Store 161 255 - Branch 191 + 54: 9(ptr) AccessChain 40(u_b3) 53 + 55: 6(bool) Load 54 + 56: 6(bool) LogicalAnd 52 55 + 57: 9(ptr) AccessChain 43(i_b3) 53 + 58: 6(bool) Load 57 + 59: 6(bool) LogicalAnd 56 58 + 60: 36(bvec3) CompositeConstruct 59 59 59 + Store 38(b3) 60 + 66: 9(ptr) AccessChain 65(u_b4) 21 + 67: 6(bool) Load 66 + 69: 9(ptr) AccessChain 68(i_b4) 21 + 70: 6(bool) Load 69 + 71: 6(bool) LogicalAnd 67 70 + 72: 9(ptr) AccessChain 65(u_b4) 28 + 73: 6(bool) Load 72 + 74: 6(bool) LogicalAnd 71 73 + 75: 9(ptr) AccessChain 68(i_b4) 28 + 76: 6(bool) Load 75 + 77: 6(bool) LogicalAnd 74 76 + 78: 9(ptr) AccessChain 65(u_b4) 53 + 79: 6(bool) Load 78 + 80: 6(bool) LogicalAnd 77 79 + 81: 9(ptr) AccessChain 68(i_b4) 53 + 82: 6(bool) Load 81 + 83: 6(bool) LogicalAnd 80 82 + 85: 9(ptr) AccessChain 65(u_b4) 84 + 86: 6(bool) Load 85 + 87: 6(bool) LogicalAnd 83 86 + 88: 9(ptr) AccessChain 68(i_b4) 84 + 89: 6(bool) Load 88 + 90: 6(bool) LogicalAnd 87 89 + 91: 61(bvec4) CompositeConstruct 90 90 90 90 + Store 63(b4) 91 + 97: 92(int) Load 96(u_i) + 99: 92(int) Load 98(i_i) + 100: 92(int) IAdd 97 99 + Store 94(i) 100 + 106: 101(ivec2) Load 105(u_i2) + 108: 101(ivec2) Load 107(i_i2) + 109: 101(ivec2) IAdd 106 108 + Store 103(i2) 109 + 115: 110(ivec3) Load 114(u_i3) + 117: 110(ivec3) Load 116(i_i3) + 118: 110(ivec3) IAdd 115 117 + Store 112(i3) 118 + 124: 119(ivec4) Load 123(u_i4) + 126: 119(ivec4) Load 125(i_i4) + 127: 119(ivec4) IAdd 124 126 + Store 121(i4) 127 + 133: 128(float) Load 132(u_f) + 135: 128(float) Load 134(i_f) + 136: 128(float) FAdd 133 135 + Store 130(f) 136 + 142: 137(fvec2) Load 141(u_f2) + 144: 137(fvec2) Load 143(i_f2) + 145: 137(fvec2) FAdd 142 144 + Store 139(f2) 145 + 151: 146(fvec3) Load 150(u_f3) + 153: 146(fvec3) Load 152(i_f3) + 154: 146(fvec3) FAdd 151 153 + Store 148(f3) 154 + 160: 155(fvec4) Load 159(u_f4) + 162: 155(fvec4) Load 161(i_f4) + 163: 155(fvec4) FAdd 160 162 + Store 157(f4) 163 + 166: 6(bool) Load 8(b) + 167: 7(ptr) AccessChain 17(b2) 21 + 168: 6(bool) Load 167 + 169: 6(bool) LogicalOr 166 168 + 170: 7(ptr) AccessChain 17(b2) 28 + 171: 6(bool) Load 170 + 172: 6(bool) LogicalOr 169 171 + 173: 7(ptr) AccessChain 38(b3) 21 + 174: 6(bool) Load 173 + 175: 6(bool) LogicalOr 172 174 + 176: 7(ptr) AccessChain 38(b3) 28 + 177: 6(bool) Load 176 + 178: 6(bool) LogicalOr 175 177 + 179: 7(ptr) AccessChain 38(b3) 53 + 180: 6(bool) Load 179 + 181: 6(bool) LogicalOr 178 180 + 182: 7(ptr) AccessChain 63(b4) 21 + 183: 6(bool) Load 182 + 184: 6(bool) LogicalOr 181 183 + 185: 7(ptr) AccessChain 63(b4) 28 + 186: 6(bool) Load 185 + 187: 6(bool) LogicalOr 184 186 + 188: 7(ptr) AccessChain 63(b4) 53 + 189: 6(bool) Load 188 + 190: 6(bool) LogicalOr 187 189 + 191: 7(ptr) AccessChain 63(b4) 84 + 192: 6(bool) Load 191 + 193: 6(bool) LogicalOr 190 192 + SelectionMerge 196 None + BranchConditional 193 195 256 + 195: Label + 197: 92(int) Load 94(i) + 198: 93(ptr) AccessChain 103(i2) 21 + 199: 92(int) Load 198 + 200: 92(int) IAdd 197 199 + 201: 93(ptr) AccessChain 103(i2) 28 + 202: 92(int) Load 201 + 203: 92(int) IAdd 200 202 + 204: 93(ptr) AccessChain 112(i3) 21 + 205: 92(int) Load 204 + 206: 92(int) IAdd 203 205 + 207: 93(ptr) AccessChain 112(i3) 28 + 208: 92(int) Load 207 + 209: 92(int) IAdd 206 208 + 210: 93(ptr) AccessChain 112(i3) 53 + 211: 92(int) Load 210 + 212: 92(int) IAdd 209 211 + 213: 93(ptr) AccessChain 121(i4) 21 + 214: 92(int) Load 213 + 215: 92(int) IAdd 212 214 + 216: 93(ptr) AccessChain 121(i4) 28 + 217: 92(int) Load 216 + 218: 92(int) IAdd 215 217 + 219: 93(ptr) AccessChain 121(i4) 53 + 220: 92(int) Load 219 + 221: 92(int) IAdd 218 220 + 222: 93(ptr) AccessChain 121(i4) 84 + 223: 92(int) Load 222 + 224: 92(int) IAdd 221 223 + 225: 128(float) ConvertSToF 224 + 226: 128(float) Load 130(f) + 227: 128(float) FAdd 225 226 + 228: 129(ptr) AccessChain 139(f2) 21 + 229: 128(float) Load 228 + 230: 128(float) FAdd 227 229 + 231: 129(ptr) AccessChain 139(f2) 28 + 232: 128(float) Load 231 + 233: 128(float) FAdd 230 232 + 234: 129(ptr) AccessChain 148(f3) 21 + 235: 128(float) Load 234 + 236: 128(float) FAdd 233 235 + 237: 129(ptr) AccessChain 148(f3) 28 + 238: 128(float) Load 237 + 239: 128(float) FAdd 236 238 + 240: 129(ptr) AccessChain 148(f3) 53 + 241: 128(float) Load 240 + 242: 128(float) FAdd 239 241 + 243: 129(ptr) AccessChain 157(f4) 21 + 244: 128(float) Load 243 + 245: 128(float) FAdd 242 244 + 246: 129(ptr) AccessChain 157(f4) 28 + 247: 128(float) Load 246 + 248: 128(float) FAdd 245 247 + 249: 129(ptr) AccessChain 157(f4) 53 + 250: 128(float) Load 249 + 251: 128(float) FAdd 248 250 + 252: 129(ptr) AccessChain 157(f4) 84 + 253: 128(float) Load 252 + 254: 128(float) FAdd 251 253 + 255: 155(fvec4) CompositeConstruct 254 254 254 254 + Store 194 255 + Branch 196 256: Label - Store 161 258 - Branch 191 - 191: Label - 259: 150(fvec4) Load 161 - Store 160(gl_FragColor) 259 + Store 194 258 + Branch 196 + 196: Label + 259: 155(fvec4) Load 194 + Store 165(gl_FragColor) 259 Return FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uint.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uint.frag.out index 92c4ce7ba1b..af0ad85a377 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uint.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uint.frag.out @@ -1,6 +1,6 @@ spv.uint.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 213 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uniformArray.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uniformArray.frag.out index 87aa2f26b2f..ff5855c1067 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uniformArray.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.uniformArray.frag.out @@ -1,6 +1,6 @@ spv.uniformArray.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 53 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.unit1.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.unit1.frag.out new file mode 100644 index 00000000000..d64d437fc1c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.unit1.frag.out @@ -0,0 +1,298 @@ +spv.unit1.frag +Shader version: 460 +gl_FragCoord origin is upper left +0:? Sequence +0:10 Function Definition: main( ( global void) +0:10 Function Parameters: +0:12 Sequence +0:12 move second child to first child ( temp highp float) +0:12 'f' ( global highp float) +0:12 Constant: +0:12 10.000000 +0:13 Sequence +0:13 move second child to first child ( temp highp float) +0:13 'g' ( temp highp float) +0:13 Function Call: foo( ( global highp float) +0:14 add second child into first child ( temp highp float) +0:14 'f' ( global highp float) +0:14 'g' ( temp highp float) +0:15 add second child into first child ( temp highp float) +0:15 'f' ( global highp float) +0:15 direct index ( temp highp float) +0:15 'gl_FragCoord' ( gl_FragCoord highp 4-component vector of float FragCoord) +0:15 Constant: +0:15 1 (const int) +0:? Linker Objects +0:? 'f' ( global highp float) +0:? 'a1' ( global highp float) +0:? 'cout' ( out highp float) + +spv.unit2.frag +Shader version: 410 +gl_FragCoord origin is upper left +0:? Sequence +0:12 Function Definition: foo( ( global highp float) +0:12 Function Parameters: +0:14 Sequence +0:14 Sequence +0:14 move second child to first child ( temp highp float) +0:14 'h2' ( temp highp float) +0:14 add ( temp highp float) +0:14 component-wise multiply ( temp highp float) +0:14 Constant: +0:14 2.000000 +0:14 'f' ( global highp float) +0:14 'cin' ( smooth in highp float) +0:15 Sequence +0:15 move second child to first child ( temp highp float) +0:15 'g2' ( temp highp float) +0:15 Function Call: bar( ( global highp float) +0:16 Branch: Return with expression +0:16 add ( temp highp float) +0:16 add ( temp highp float) +0:16 'h2' ( temp highp float) +0:16 'g2' ( temp highp float) +0:16 direct index ( temp highp float) +0:16 'gl_FragCoord' ( gl_FragCoord highp 4-component vector of float FragCoord) +0:16 Constant: +0:16 1 (const int) +0:? Linker Objects +0:? 'a2' ( global highp float) +0:? 'f' ( global highp float) +0:? 'cout' ( out highp float) +0:? 'cin' ( smooth in highp float) + +spv.unit3.frag +Shader version: 460 +gl_FragCoord origin is upper left +0:? Sequence +0:4 Sequence +0:4 move second child to first child ( temp highp float) +0:4 'h3' ( global highp float) +0:4 Constant: +0:4 3.000000 +0:9 Function Definition: bar( ( global highp float) +0:9 Function Parameters: +0:11 Sequence +0:11 multiply second child into first child ( temp highp float) +0:11 'h3' ( global highp float) +0:11 'f' ( global highp float) +0:12 Sequence +0:12 move second child to first child ( temp highp float) +0:12 'g3' ( temp highp float) +0:12 component-wise multiply ( temp highp float) +0:12 Constant: +0:12 2.000000 +0:12 'h3' ( global highp float) +0:13 move second child to first child ( temp highp float) +0:13 'cout' ( out highp float) +0:13 'g3' ( temp highp float) +0:14 Branch: Return with expression +0:14 add ( temp highp float) +0:14 add ( temp highp float) +0:14 'h3' ( global highp float) +0:14 'g3' ( temp highp float) +0:14 direct index ( temp highp float) +0:14 'gl_FragCoord' ( gl_FragCoord highp 4-component vector of float FragCoord) +0:14 Constant: +0:14 1 (const int) +0:? Linker Objects +0:? 'f' ( global highp float) +0:? 'h3' ( global highp float) +0:? 'cout' ( out highp float) +0:? 'cin' ( smooth in highp float) + + +Linked fragment stage: + + +Shader version: 460 +gl_FragCoord origin is upper left +0:? Sequence +0:10 Function Definition: main( ( global void) +0:10 Function Parameters: +0:12 Sequence +0:12 move second child to first child ( temp highp float) +0:12 'f' ( global highp float) +0:12 Constant: +0:12 10.000000 +0:13 Sequence +0:13 move second child to first child ( temp highp float) +0:13 'g' ( temp highp float) +0:13 Function Call: foo( ( global highp float) +0:14 add second child into first child ( temp highp float) +0:14 'f' ( global highp float) +0:14 'g' ( temp highp float) +0:15 add second child into first child ( temp highp float) +0:15 'f' ( global highp float) +0:15 direct index ( temp highp float) +0:15 'gl_FragCoord' ( gl_FragCoord highp 4-component vector of float FragCoord) +0:15 Constant: +0:15 1 (const int) +0:12 Function Definition: foo( ( global highp float) +0:12 Function Parameters: +0:14 Sequence +0:14 Sequence +0:14 move second child to first child ( temp highp float) +0:14 'h2' ( temp highp float) +0:14 add ( temp highp float) +0:14 component-wise multiply ( temp highp float) +0:14 Constant: +0:14 2.000000 +0:14 'f' ( global highp float) +0:14 'cin' ( smooth in highp float) +0:15 Sequence +0:15 move second child to first child ( temp highp float) +0:15 'g2' ( temp highp float) +0:15 Function Call: bar( ( global highp float) +0:16 Branch: Return with expression +0:16 add ( temp highp float) +0:16 add ( temp highp float) +0:16 'h2' ( temp highp float) +0:16 'g2' ( temp highp float) +0:16 direct index ( temp highp float) +0:16 'gl_FragCoord' ( gl_FragCoord highp 4-component vector of float FragCoord) +0:16 Constant: +0:16 1 (const int) +0:4 Sequence +0:4 move second child to first child ( temp highp float) +0:4 'h3' ( global highp float) +0:4 Constant: +0:4 3.000000 +0:9 Function Definition: bar( ( global highp float) +0:9 Function Parameters: +0:11 Sequence +0:11 multiply second child into first child ( temp highp float) +0:11 'h3' ( global highp float) +0:11 'f' ( global highp float) +0:12 Sequence +0:12 move second child to first child ( temp highp float) +0:12 'g3' ( temp highp float) +0:12 component-wise multiply ( temp highp float) +0:12 Constant: +0:12 2.000000 +0:12 'h3' ( global highp float) +0:13 move second child to first child ( temp highp float) +0:13 'cout' ( out highp float) +0:13 'g3' ( temp highp float) +0:14 Branch: Return with expression +0:14 add ( temp highp float) +0:14 add ( temp highp float) +0:14 'h3' ( global highp float) +0:14 'g3' ( temp highp float) +0:14 direct index ( temp highp float) +0:14 'gl_FragCoord' ( gl_FragCoord highp 4-component vector of float FragCoord) +0:14 Constant: +0:14 1 (const int) +0:? Linker Objects +0:? 'f' ( global highp float) +0:? 'a1' ( global highp float) +0:? 'cout' ( out highp float) +0:? 'a2' ( global highp float) +0:? 'cin' ( smooth in highp float) +0:? 'h3' ( global highp float) + +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 69 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 25 37 57 + ExecutionMode 4 OriginUpperLeft + Source GLSL 460 + Name 4 "main" + Name 8 "foo(" + Name 10 "bar(" + Name 13 "h3" + Name 15 "f" + Name 18 "g" + Name 25 "gl_FragCoord" + Name 33 "h2" + Name 37 "cin" + Name 40 "g2" + Name 53 "g3" + Name 57 "cout" + Name 67 "a1" + Name 68 "a2" + Decorate 25(gl_FragCoord) BuiltIn FragCoord + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeFunction 6(float) + 12: TypePointer Private 6(float) + 13(h3): 12(ptr) Variable Private + 14: 6(float) Constant 1077936128 + 15(f): 12(ptr) Variable Private + 16: 6(float) Constant 1092616192 + 17: TypePointer Function 6(float) + 23: TypeVector 6(float) 4 + 24: TypePointer Input 23(fvec4) +25(gl_FragCoord): 24(ptr) Variable Input + 26: TypeInt 32 0 + 27: 26(int) Constant 1 + 28: TypePointer Input 6(float) + 34: 6(float) Constant 1073741824 + 37(cin): 28(ptr) Variable Input + 56: TypePointer Output 6(float) + 57(cout): 56(ptr) Variable Output + 67(a1): 12(ptr) Variable Private + 68(a2): 12(ptr) Variable Private + 4(main): 2 Function None 3 + 5: Label + 18(g): 17(ptr) Variable Function + Store 13(h3) 14 + Store 15(f) 16 + 19: 6(float) FunctionCall 8(foo() + Store 18(g) 19 + 20: 6(float) Load 18(g) + 21: 6(float) Load 15(f) + 22: 6(float) FAdd 21 20 + Store 15(f) 22 + 29: 28(ptr) AccessChain 25(gl_FragCoord) 27 + 30: 6(float) Load 29 + 31: 6(float) Load 15(f) + 32: 6(float) FAdd 31 30 + Store 15(f) 32 + Return + FunctionEnd + 8(foo(): 6(float) Function None 7 + 9: Label + 33(h2): 17(ptr) Variable Function + 40(g2): 17(ptr) Variable Function + 35: 6(float) Load 15(f) + 36: 6(float) FMul 34 35 + 38: 6(float) Load 37(cin) + 39: 6(float) FAdd 36 38 + Store 33(h2) 39 + 41: 6(float) FunctionCall 10(bar() + Store 40(g2) 41 + 42: 6(float) Load 33(h2) + 43: 6(float) Load 40(g2) + 44: 6(float) FAdd 42 43 + 45: 28(ptr) AccessChain 25(gl_FragCoord) 27 + 46: 6(float) Load 45 + 47: 6(float) FAdd 44 46 + ReturnValue 47 + FunctionEnd + 10(bar(): 6(float) Function None 7 + 11: Label + 53(g3): 17(ptr) Variable Function + 50: 6(float) Load 15(f) + 51: 6(float) Load 13(h3) + 52: 6(float) FMul 51 50 + Store 13(h3) 52 + 54: 6(float) Load 13(h3) + 55: 6(float) FMul 34 54 + Store 53(g3) 55 + 58: 6(float) Load 53(g3) + Store 57(cout) 58 + 59: 6(float) Load 13(h3) + 60: 6(float) Load 53(g3) + 61: 6(float) FAdd 59 60 + 62: 28(ptr) AccessChain 25(gl_FragCoord) 27 + 63: 6(float) Load 62 + 64: 6(float) FAdd 61 63 + ReturnValue 64 + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.variableArrayIndex.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.variableArrayIndex.frag.out index fa682cd928f..e0010dfcde3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.variableArrayIndex.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.variableArrayIndex.frag.out @@ -1,6 +1,6 @@ spv.variableArrayIndex.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 93 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArray.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArray.frag.out index 22748ac5aa5..0acfdd92767 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArray.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArray.frag.out @@ -1,6 +1,6 @@ spv.varyingArray.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 61 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArrayIndirect.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArrayIndirect.frag.out index 701f9d198d3..ffe785914cd 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArrayIndirect.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.varyingArrayIndirect.frag.out @@ -1,6 +1,6 @@ spv.varyingArrayIndirect.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 70 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vecMatConstruct.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vecMatConstruct.frag.out new file mode 100644 index 00000000000..57ecd67ed11 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vecMatConstruct.frag.out @@ -0,0 +1,87 @@ +spv.vecMatConstruct.frag +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 62 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + Name 4 "main" + Name 9 "v2" + Name 13 "m" + Name 19 "v3" + Name 27 "v4" + Name 37 "iv2" + Name 45 "iv3" + Name 54 "iv4" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 2 + 8: TypePointer Function 7(fvec2) + 10: TypeVector 6(float) 3 + 11: TypeMatrix 10(fvec3) 4 + 12: TypePointer Function 11 + 18: TypePointer Function 10(fvec3) + 25: TypeVector 6(float) 4 + 26: TypePointer Function 25(fvec4) + 34: TypeInt 32 1 + 35: TypeVector 34(int) 2 + 36: TypePointer Function 35(ivec2) + 43: TypeVector 34(int) 3 + 44: TypePointer Function 43(ivec3) + 52: TypeVector 34(int) 4 + 53: TypePointer Function 52(ivec4) + 4(main): 2 Function None 3 + 5: Label + 9(v2): 8(ptr) Variable Function + 13(m): 12(ptr) Variable Function + 19(v3): 18(ptr) Variable Function + 27(v4): 26(ptr) Variable Function + 37(iv2): 36(ptr) Variable Function + 45(iv3): 44(ptr) Variable Function + 54(iv4): 53(ptr) Variable Function + 14: 11 Load 13(m) + 15: 6(float) CompositeExtract 14 0 0 + 16: 6(float) CompositeExtract 14 0 1 + 17: 7(fvec2) CompositeConstruct 15 16 + Store 9(v2) 17 + 20: 11 Load 13(m) + 21: 6(float) CompositeExtract 20 0 0 + 22: 6(float) CompositeExtract 20 0 1 + 23: 6(float) CompositeExtract 20 0 2 + 24: 10(fvec3) CompositeConstruct 21 22 23 + Store 19(v3) 24 + 28: 11 Load 13(m) + 29: 6(float) CompositeExtract 28 0 0 + 30: 6(float) CompositeExtract 28 0 1 + 31: 6(float) CompositeExtract 28 0 2 + 32: 6(float) CompositeExtract 28 1 0 + 33: 25(fvec4) CompositeConstruct 29 30 31 32 + Store 27(v4) 33 + 38: 11 Load 13(m) + 39: 6(float) CompositeExtract 38 0 0 + 40: 6(float) CompositeExtract 38 0 1 + 41: 7(fvec2) CompositeConstruct 39 40 + 42: 35(ivec2) ConvertFToS 41 + Store 37(iv2) 42 + 46: 11 Load 13(m) + 47: 6(float) CompositeExtract 46 0 0 + 48: 6(float) CompositeExtract 46 0 1 + 49: 6(float) CompositeExtract 46 0 2 + 50: 10(fvec3) CompositeConstruct 47 48 49 + 51: 43(ivec3) ConvertFToS 50 + Store 45(iv3) 51 + 55: 11 Load 13(m) + 56: 6(float) CompositeExtract 55 0 0 + 57: 6(float) CompositeExtract 55 0 1 + 58: 6(float) CompositeExtract 55 0 2 + 59: 6(float) CompositeExtract 55 1 0 + 60: 25(fvec4) CompositeConstruct 56 57 58 59 + 61: 52(ivec4) ConvertFToS 60 + Store 54(iv4) 61 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.tesc.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.tesc.out index d62455cbd8d..b14179ecebd 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.tesc.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.tesc.out @@ -1,6 +1,10 @@ spv.viewportArray2.tesc +error: SPIRV-Tools Validation Errors +error: Vulkan spec allows BuiltIn ViewportIndex to be used only with Vertex, TessellationEvaluation, Geometry, or Fragment execution models. ID <0> (OpStore) is referencing ID <22> (OpVariable) which is decorated with BuiltIn ViewportIndex in function <4> called with execution model TessellationControl. + OpStore %gl_ViewportIndex %int_2 + // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 25 Capability Geometry diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.vert.out index b627b4680c7..df116cfce54 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.viewportArray2.vert.out @@ -1,6 +1,6 @@ spv.viewportArray2.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 19 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.voidFunction.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.voidFunction.frag.out index 1fbd69f9209..fbaee8784ff 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.voidFunction.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.voidFunction.frag.out @@ -1,6 +1,6 @@ spv.voidFunction.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 43 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan100.subgroupArithmetic.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan100.subgroupArithmetic.comp.out new file mode 100644 index 00000000000..9955053d3cf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan100.subgroupArithmetic.comp.out @@ -0,0 +1,305 @@ +spv.vulkan100.subgroupArithmetic.comp +ERROR: 0:19: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:20: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:21: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:22: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:24: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:25: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:26: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:27: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:29: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:30: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:31: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:32: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:34: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:35: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:36: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:37: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:39: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:40: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:41: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:42: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:44: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:45: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:46: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:47: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:49: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:50: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:51: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:52: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:54: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:55: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:56: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:57: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:59: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:60: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:61: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:62: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:64: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:65: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:66: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:67: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:69: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:70: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:71: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:72: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:74: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:75: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:76: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:77: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:79: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:80: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:81: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:82: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:84: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:85: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:86: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:87: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:89: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:90: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:91: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:92: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:94: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:95: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:96: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:97: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:99: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:100: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:101: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:102: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:104: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:105: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:106: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:107: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:109: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:110: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:111: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:112: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:114: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:115: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:116: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:117: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:119: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:120: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:121: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:122: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:124: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:125: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:126: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:127: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:129: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:130: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:131: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:132: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:134: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:135: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:136: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:137: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:139: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:140: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:141: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:142: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:144: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:145: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:146: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:147: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:149: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:150: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:151: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:152: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:154: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:155: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:156: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:157: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:159: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:160: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:161: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:162: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:164: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:165: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:166: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:167: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:169: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:170: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:171: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:172: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:174: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:175: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:176: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:177: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:179: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:180: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:181: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:182: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:184: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:185: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:186: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:187: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:189: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:190: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:191: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:192: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:194: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:195: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:196: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:197: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:199: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:200: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:201: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:202: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:204: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:205: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:206: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:207: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:209: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:210: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:211: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:212: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:214: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:215: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:216: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:217: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:219: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:220: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:221: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:222: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:224: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:225: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:226: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:227: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:229: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:230: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:231: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:232: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:234: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:235: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:236: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:237: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:239: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:240: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:241: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:242: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:244: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:245: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:246: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:247: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:249: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:250: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:251: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:252: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:254: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:255: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:256: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:257: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:259: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:260: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:261: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:262: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:264: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:265: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:266: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:267: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:269: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:270: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:271: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:272: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:274: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:275: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:276: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:277: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:279: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:280: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:281: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:282: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:284: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:285: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:286: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:287: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:289: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:290: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:291: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:292: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:294: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:295: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:296: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:297: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:299: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:300: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:301: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:302: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:304: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:305: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:306: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:307: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:309: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:310: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:311: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:312: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:314: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:315: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:316: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:317: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:319: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:320: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:321: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:322: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:324: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:325: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:326: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:327: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:329: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:330: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:331: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:332: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:334: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:335: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:336: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:337: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:339: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:340: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:341: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:342: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:344: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:345: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:346: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:347: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:349: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:350: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:351: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:352: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:354: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:355: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:356: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:357: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:359: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:360: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:361: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:362: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:364: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:365: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:366: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:367: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:369: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:370: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:371: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:372: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:374: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:375: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:376: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:377: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:379: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:380: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:381: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:382: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:384: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:385: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:386: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:387: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:389: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:390: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:391: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:392: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 300 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan100.subgroupPartitioned.comp.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan100.subgroupPartitioned.comp.out new file mode 100644 index 00000000000..3116ac11069 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan100.subgroupPartitioned.comp.out @@ -0,0 +1,326 @@ +spv.vulkan100.subgroupPartitioned.comp +ERROR: 0:19: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:21: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:22: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:23: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:24: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:26: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:27: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:28: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:29: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:31: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:32: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:33: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:34: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:36: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:37: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:38: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:39: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:41: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:42: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:43: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:44: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:46: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:47: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:48: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:49: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:51: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:52: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:53: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:54: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:56: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:57: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:58: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:59: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:61: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:62: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:63: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:64: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:66: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:67: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:68: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:69: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:71: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:72: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:73: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:74: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:76: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:77: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:78: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:79: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:81: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:82: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:83: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:84: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:86: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:87: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:88: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:89: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:91: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:92: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:93: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:94: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:96: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:97: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:98: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:99: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:101: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:102: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:103: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:104: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:106: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:107: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:108: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:109: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:111: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:112: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:113: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:114: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:116: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:117: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:118: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:119: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:121: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:122: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:123: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:124: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:126: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:127: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:128: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:129: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:131: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:132: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:133: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:134: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:136: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:137: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:138: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:139: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:141: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:142: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:143: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:144: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:146: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:147: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:148: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:149: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:151: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:152: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:153: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:154: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:156: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:157: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:158: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:159: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:161: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:162: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:163: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:164: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:166: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:167: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:168: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:169: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:171: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:172: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:173: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:174: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:176: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:177: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:178: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:179: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:181: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:182: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:183: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:184: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:186: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:187: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:188: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:189: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:191: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:192: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:193: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:194: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:196: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:197: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:198: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:199: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:201: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:202: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:203: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:204: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:206: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:207: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:208: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:209: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:211: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:212: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:213: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:214: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:216: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:217: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:218: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:219: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:221: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:222: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:223: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:224: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:226: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:227: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:228: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:229: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:231: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:232: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:233: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:234: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:236: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:237: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:238: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:239: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:241: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:242: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:243: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:244: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:246: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:247: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:248: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:249: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:251: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:252: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:253: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:254: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:256: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:257: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:258: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:259: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:261: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:262: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:263: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:264: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:266: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:267: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:268: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:269: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:271: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:272: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:273: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:274: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:276: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:277: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:278: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:279: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:281: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:282: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:283: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:284: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:286: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:287: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:288: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:289: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:291: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:292: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:293: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:294: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:296: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:297: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:298: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:299: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:301: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:302: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:303: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:304: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:306: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:307: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:308: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:309: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:311: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:312: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:313: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:314: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:316: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:317: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:318: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:319: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:321: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:322: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:323: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:324: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:326: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:327: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:328: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:329: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:331: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:332: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:333: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:334: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:336: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:337: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:338: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:339: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:341: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:342: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:343: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:344: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:346: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:347: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:348: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:349: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:351: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:352: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:353: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:354: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:356: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:357: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:358: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:359: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:361: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:362: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:363: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:364: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:366: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:367: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:368: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:369: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:371: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:372: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:373: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:374: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:376: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:377: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:378: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:379: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:381: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:382: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:383: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:384: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:386: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:387: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:388: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:389: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:391: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:392: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:393: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:394: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:396: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:397: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:398: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:399: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:401: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:402: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:403: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:404: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:406: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:407: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:408: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:409: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:411: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:412: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:413: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:414: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:416: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:417: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:418: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 0:419: 'subgroup op' : requires SPIR-V 1.3 +ERROR: 321 compilation errors. No code generated. + + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan110.int16.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan110.int16.frag.out new file mode 100644 index 00000000000..9141e4ec4e7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan110.int16.frag.out @@ -0,0 +1,745 @@ +spv.vulkan110.int16.frag +error: SPIRV-Tools Validation Errors +error: Capability Float16 is not allowed by Vulkan 1.1 specification (or requires extension) + OpCapability Float16 + +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 523 + + Capability Shader + Capability Float16 + Capability Float64 + Capability Int64 + Capability Int16 + Capability Int8 + Capability StorageUniform16 + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_KHX_shader_explicit_arithmetic_types" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_float64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int16" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int32" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int64" + SourceExtension "GL_KHX_shader_explicit_arithmetic_types_int8" + Name 4 "main" + Name 6 "literal(" + Name 8 "typeCast16(" + Name 10 "operators(" + Name 12 "builtinFuncs(" + Name 16 "i16" + Name 24 "Uniforms" + MemberName 24(Uniforms) 0 "index" + Name 26 "" + Name 33 "indexable" + Name 38 "u16" + Name 46 "indexable" + Name 51 "i32v" + Name 54 "i16v" + Name 59 "u16v" + Name 67 "u32v" + Name 74 "i64v" + Name 80 "u64v" + Name 94 "f16v" + Name 100 "f32v" + Name 106 "f64v" + Name 154 "i8v" + Name 163 "u8v" + Name 176 "bv" + Name 195 "u16v" + Name 200 "i16" + Name 220 "i" + Name 227 "uv" + Name 243 "i64" + Name 281 "b" + Name 343 "i16v" + Name 346 "i16" + Name 356 "u16v" + Name 358 "u16" + Name 428 "i32" + Name 431 "i64" + Name 434 "i16v4" + Name 437 "u32" + Name 438 "u16v2" + Name 442 "u64" + Name 445 "u16v4" + Name 457 "bv" + Name 518 "Block" + MemberName 518(Block) 0 "i16" + MemberName 518(Block) 1 "i16v2" + MemberName 518(Block) 2 "i16v3" + MemberName 518(Block) 3 "i16v4" + MemberName 518(Block) 4 "u16" + MemberName 518(Block) 5 "u16v2" + MemberName 518(Block) 6 "u16v3" + MemberName 518(Block) 7 "u16v4" + Name 520 "block" + Name 521 "si16" + Name 522 "su16" + MemberDecorate 24(Uniforms) 0 Offset 0 + Decorate 24(Uniforms) Block + Decorate 26 DescriptorSet 0 + Decorate 26 Binding 0 + MemberDecorate 518(Block) 0 Offset 0 + MemberDecorate 518(Block) 1 Offset 4 + MemberDecorate 518(Block) 2 Offset 8 + MemberDecorate 518(Block) 3 Offset 16 + MemberDecorate 518(Block) 4 Offset 24 + MemberDecorate 518(Block) 5 Offset 28 + MemberDecorate 518(Block) 6 Offset 32 + MemberDecorate 518(Block) 7 Offset 40 + Decorate 518(Block) Block + Decorate 520(block) DescriptorSet 0 + Decorate 520(block) Binding 1 + Decorate 521(si16) SpecId 100 + Decorate 522(su16) SpecId 101 + 2: TypeVoid + 3: TypeFunction 2 + 14: TypeInt 16 1 + 15: TypePointer Function 14(int16_t) + 17: TypeInt 32 0 + 18: 17(int) Constant 3 + 19: TypeArray 14(int16_t) 18 + 20: 14(int16_t) Constant 4294962927 + 21: 14(int16_t) Constant 4294967295 + 22: 14(int16_t) Constant 16384 + 23: 19 ConstantComposite 20 21 22 + 24(Uniforms): TypeStruct 17(int) + 25: TypePointer Uniform 24(Uniforms) + 26: 25(ptr) Variable Uniform + 27: TypeInt 32 1 + 28: 27(int) Constant 0 + 29: TypePointer Uniform 17(int) + 32: TypePointer Function 19 + 36: TypeInt 16 0 + 37: TypePointer Function 36(int16_t) + 39: TypeArray 36(int16_t) 18 + 40: 36(int16_t) Constant 65535 + 41: 36(int16_t) Constant 32767 + 42: 39 ConstantComposite 40 40 41 + 45: TypePointer Function 39 + 49: TypeVector 27(int) 2 + 50: TypePointer Function 49(ivec2) + 52: TypeVector 14(int16_t) 2 + 53: TypePointer Function 52(i16vec2) + 57: TypeVector 36(int16_t) 2 + 58: TypePointer Function 57(i16vec2) + 61: TypeVector 17(int) 2 + 66: TypePointer Function 61(ivec2) + 71: TypeInt 64 1 + 72: TypeVector 71(int64_t) 2 + 73: TypePointer Function 72(i64vec2) + 77: TypeInt 64 0 + 78: TypeVector 77(int64_t) 2 + 79: TypePointer Function 78(i64vec2) + 91: TypeFloat 16 + 92: TypeVector 91(float16_t) 2 + 93: TypePointer Function 92(f16vec2) + 97: TypeFloat 32 + 98: TypeVector 97(float) 2 + 99: TypePointer Function 98(fvec2) + 103: TypeFloat 64 + 104: TypeVector 103(float64_t) 2 + 105: TypePointer Function 104(f64vec2) + 151: TypeInt 8 1 + 152: TypeVector 151(int8_t) 2 + 153: TypePointer Function 152(i8vec2) + 158: TypeInt 8 0 + 159: TypeVector 158(int8_t) 2 + 162: TypePointer Function 159(i8vec2) + 173: TypeBool + 174: TypeVector 173(bool) 2 + 175: TypePointer Function 174(bvec2) + 178: 14(int16_t) Constant 0 + 179: 14(int16_t) Constant 1 + 180: 52(i16vec2) ConstantComposite 178 178 + 181: 52(i16vec2) ConstantComposite 179 179 + 184: 36(int16_t) Constant 0 + 185: 36(int16_t) Constant 1 + 186: 57(i16vec2) ConstantComposite 184 184 + 187: 57(i16vec2) ConstantComposite 185 185 + 193: TypeVector 36(int16_t) 3 + 194: TypePointer Function 193(i16vec3) + 197: TypeVector 14(int16_t) 3 + 219: TypePointer Function 27(int) + 225: TypeVector 17(int) 3 + 226: TypePointer Function 225(ivec3) + 242: TypePointer Function 71(int64_t) + 264: 17(int) Constant 1 + 270: 17(int) Constant 2 + 276: TypeVector 27(int) 3 + 280: TypePointer Function 173(bool) + 282: 17(int) Constant 0 + 296: TypePointer Function 17(int) + 354: 52(i16vec2) ConstantComposite 21 21 + 363:193(i16vec3) ConstantComposite 184 184 184 + 405: 173(bool) ConstantTrue + 412: 173(bool) ConstantFalse + 413: 174(bvec2) ConstantComposite 412 412 + 425: TypeVector 173(bool) 3 + 426: 425(bvec3) ConstantComposite 412 412 412 + 432: TypeVector 14(int16_t) 4 + 433: TypePointer Function 432(i16vec4) + 441: TypePointer Function 77(int64_t) + 443: TypeVector 36(int16_t) 4 + 444: TypePointer Function 443(i16vec4) + 456: TypePointer Function 425(bvec3) + 518(Block): TypeStruct 14(int16_t) 52(i16vec2) 197(i16vec3) 432(i16vec4) 36(int16_t) 57(i16vec2) 193(i16vec3) 443(i16vec4) + 519: TypePointer Uniform 518(Block) + 520(block): 519(ptr) Variable Uniform + 521(si16): 14(int16_t) SpecConstant 4294967286 + 522(su16): 36(int16_t) SpecConstant 20 + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd + 6(literal(): 2 Function None 3 + 7: Label + 16(i16): 15(ptr) Variable Function + 33(indexable): 32(ptr) Variable Function + 38(u16): 37(ptr) Variable Function + 46(indexable): 45(ptr) Variable Function + 30: 29(ptr) AccessChain 26 28 + 31: 17(int) Load 30 + Store 33(indexable) 23 + 34: 15(ptr) AccessChain 33(indexable) 31 + 35: 14(int16_t) Load 34 + Store 16(i16) 35 + 43: 29(ptr) AccessChain 26 28 + 44: 17(int) Load 43 + Store 46(indexable) 42 + 47: 37(ptr) AccessChain 46(indexable) 44 + 48: 36(int16_t) Load 47 + Store 38(u16) 48 + Return + FunctionEnd + 8(typeCast16(): 2 Function None 3 + 9: Label + 51(i32v): 50(ptr) Variable Function + 54(i16v): 53(ptr) Variable Function + 59(u16v): 58(ptr) Variable Function + 67(u32v): 66(ptr) Variable Function + 74(i64v): 73(ptr) Variable Function + 80(u64v): 79(ptr) Variable Function + 94(f16v): 93(ptr) Variable Function + 100(f32v): 99(ptr) Variable Function + 106(f64v): 105(ptr) Variable Function + 154(i8v): 153(ptr) Variable Function + 163(u8v): 162(ptr) Variable Function + 176(bv): 175(ptr) Variable Function + 55: 52(i16vec2) Load 54(i16v) + 56: 49(ivec2) SConvert 55 + Store 51(i32v) 56 + 60: 57(i16vec2) Load 59(u16v) + 62: 61(ivec2) UConvert 60 + 63: 49(ivec2) Bitcast 62 + Store 51(i32v) 63 + 64: 52(i16vec2) Load 54(i16v) + 65: 57(i16vec2) Bitcast 64 + Store 59(u16v) 65 + 68: 52(i16vec2) Load 54(i16v) + 69: 49(ivec2) SConvert 68 + 70: 61(ivec2) Bitcast 69 + Store 67(u32v) 70 + 75: 52(i16vec2) Load 54(i16v) + 76: 72(i64vec2) SConvert 75 + Store 74(i64v) 76 + 81: 52(i16vec2) Load 54(i16v) + 82: 72(i64vec2) SConvert 81 + 83: 78(i64vec2) Bitcast 82 + Store 80(u64v) 83 + 84: 57(i16vec2) Load 59(u16v) + 85: 61(ivec2) UConvert 84 + Store 67(u32v) 85 + 86: 57(i16vec2) Load 59(u16v) + 87: 78(i64vec2) UConvert 86 + 88: 72(i64vec2) Bitcast 87 + Store 74(i64v) 88 + 89: 57(i16vec2) Load 59(u16v) + 90: 78(i64vec2) UConvert 89 + Store 80(u64v) 90 + 95: 52(i16vec2) Load 54(i16v) + 96: 92(f16vec2) ConvertSToF 95 + Store 94(f16v) 96 + 101: 52(i16vec2) Load 54(i16v) + 102: 98(fvec2) ConvertSToF 101 + Store 100(f32v) 102 + 107: 52(i16vec2) Load 54(i16v) + 108:104(f64vec2) ConvertSToF 107 + Store 106(f64v) 108 + 109: 57(i16vec2) Load 59(u16v) + 110: 92(f16vec2) ConvertUToF 109 + Store 94(f16v) 110 + 111: 57(i16vec2) Load 59(u16v) + 112: 98(fvec2) ConvertUToF 111 + Store 100(f32v) 112 + 113: 57(i16vec2) Load 59(u16v) + 114:104(f64vec2) ConvertUToF 113 + Store 106(f64v) 114 + 115: 52(i16vec2) Load 54(i16v) + 116: 49(ivec2) SConvert 115 + Store 51(i32v) 116 + 117: 57(i16vec2) Load 59(u16v) + 118: 61(ivec2) UConvert 117 + 119: 49(ivec2) Bitcast 118 + Store 51(i32v) 119 + 120: 52(i16vec2) Load 54(i16v) + 121: 57(i16vec2) Bitcast 120 + Store 59(u16v) 121 + 122: 52(i16vec2) Load 54(i16v) + 123: 49(ivec2) SConvert 122 + 124: 61(ivec2) Bitcast 123 + Store 67(u32v) 124 + 125: 52(i16vec2) Load 54(i16v) + 126: 72(i64vec2) SConvert 125 + Store 74(i64v) 126 + 127: 52(i16vec2) Load 54(i16v) + 128: 72(i64vec2) SConvert 127 + 129: 78(i64vec2) Bitcast 128 + Store 80(u64v) 129 + 130: 57(i16vec2) Load 59(u16v) + 131: 61(ivec2) UConvert 130 + Store 67(u32v) 131 + 132: 57(i16vec2) Load 59(u16v) + 133: 78(i64vec2) UConvert 132 + 134: 72(i64vec2) Bitcast 133 + Store 74(i64v) 134 + 135: 57(i16vec2) Load 59(u16v) + 136: 78(i64vec2) UConvert 135 + 137: 72(i64vec2) Bitcast 136 + 138: 78(i64vec2) Bitcast 137 + Store 80(u64v) 138 + 139: 52(i16vec2) Load 54(i16v) + 140: 92(f16vec2) ConvertSToF 139 + Store 94(f16v) 140 + 141: 52(i16vec2) Load 54(i16v) + 142: 98(fvec2) ConvertSToF 141 + Store 100(f32v) 142 + 143: 52(i16vec2) Load 54(i16v) + 144:104(f64vec2) ConvertSToF 143 + Store 106(f64v) 144 + 145: 57(i16vec2) Load 59(u16v) + 146: 92(f16vec2) ConvertUToF 145 + Store 94(f16v) 146 + 147: 57(i16vec2) Load 59(u16v) + 148: 98(fvec2) ConvertUToF 147 + Store 100(f32v) 148 + 149: 57(i16vec2) Load 59(u16v) + 150:104(f64vec2) ConvertUToF 149 + Store 106(f64v) 150 + 155: 52(i16vec2) Load 54(i16v) + 156: 152(i8vec2) SConvert 155 + Store 154(i8v) 156 + 157: 57(i16vec2) Load 59(u16v) + 160: 159(i8vec2) UConvert 157 + 161: 152(i8vec2) Bitcast 160 + Store 154(i8v) 161 + 164: 52(i16vec2) Load 54(i16v) + 165: 152(i8vec2) SConvert 164 + 166: 159(i8vec2) Bitcast 165 + Store 163(u8v) 166 + 167: 57(i16vec2) Load 59(u16v) + 168: 159(i8vec2) UConvert 167 + Store 163(u8v) 168 + 169: 57(i16vec2) Load 59(u16v) + 170: 159(i8vec2) UConvert 169 + 171: 57(i16vec2) UConvert 170 + 172: 52(i16vec2) Bitcast 171 + Store 54(i16v) 172 + 177: 174(bvec2) Load 176(bv) + 182: 52(i16vec2) Select 177 181 180 + Store 54(i16v) 182 + 183: 174(bvec2) Load 176(bv) + 188: 57(i16vec2) Select 183 187 186 + Store 59(u16v) 188 + 189: 52(i16vec2) Load 54(i16v) + 190: 174(bvec2) INotEqual 189 186 + Store 176(bv) 190 + 191: 57(i16vec2) Load 59(u16v) + 192: 174(bvec2) INotEqual 191 186 + Store 176(bv) 192 + Return + FunctionEnd + 10(operators(): 2 Function None 3 + 11: Label + 195(u16v): 194(ptr) Variable Function + 200(i16): 15(ptr) Variable Function + 220(i): 219(ptr) Variable Function + 227(uv): 226(ptr) Variable Function + 243(i64): 242(ptr) Variable Function + 281(b): 280(ptr) Variable Function + 196:193(i16vec3) Load 195(u16v) + 198:197(i16vec3) CompositeConstruct 179 179 179 + 199:193(i16vec3) IAdd 196 198 + Store 195(u16v) 199 + 201: 14(int16_t) Load 200(i16) + 202: 14(int16_t) ISub 201 179 + Store 200(i16) 202 + 203: 14(int16_t) Load 200(i16) + 204: 14(int16_t) IAdd 203 179 + Store 200(i16) 204 + 205:193(i16vec3) Load 195(u16v) + 206:197(i16vec3) CompositeConstruct 179 179 179 + 207:193(i16vec3) ISub 205 206 + Store 195(u16v) 207 + 208:193(i16vec3) Load 195(u16v) + 209:193(i16vec3) Not 208 + Store 195(u16v) 209 + 210: 14(int16_t) Load 200(i16) + Store 200(i16) 210 + 211:193(i16vec3) Load 195(u16v) + 212:193(i16vec3) SNegate 211 + Store 195(u16v) 212 + 213: 14(int16_t) Load 200(i16) + 214: 14(int16_t) Load 200(i16) + 215: 14(int16_t) IAdd 214 213 + Store 200(i16) 215 + 216:193(i16vec3) Load 195(u16v) + 217:193(i16vec3) Load 195(u16v) + 218:193(i16vec3) ISub 217 216 + Store 195(u16v) 218 + 221: 14(int16_t) Load 200(i16) + 222: 27(int) SConvert 221 + 223: 27(int) Load 220(i) + 224: 27(int) IMul 223 222 + Store 220(i) 224 + 228:193(i16vec3) Load 195(u16v) + 229: 225(ivec3) UConvert 228 + 230: 225(ivec3) Load 227(uv) + 231: 225(ivec3) UDiv 230 229 + Store 227(uv) 231 + 232: 14(int16_t) Load 200(i16) + 233: 27(int) SConvert 232 + 234: 17(int) Bitcast 233 + 235: 225(ivec3) Load 227(uv) + 236: 225(ivec3) CompositeConstruct 234 234 234 + 237: 225(ivec3) UMod 235 236 + Store 227(uv) 237 + 238:193(i16vec3) Load 195(u16v) + 239: 225(ivec3) UConvert 238 + 240: 225(ivec3) Load 227(uv) + 241: 225(ivec3) IAdd 239 240 + Store 227(uv) 241 + 244: 14(int16_t) Load 200(i16) + 245: 71(int64_t) SConvert 244 + 246: 71(int64_t) Load 243(i64) + 247: 71(int64_t) ISub 245 246 + Store 243(i64) 247 + 248:193(i16vec3) Load 195(u16v) + 249: 225(ivec3) UConvert 248 + 250: 225(ivec3) Load 227(uv) + 251: 225(ivec3) IMul 249 250 + Store 227(uv) 251 + 252: 14(int16_t) Load 200(i16) + 253: 71(int64_t) SConvert 252 + 254: 71(int64_t) Load 243(i64) + 255: 71(int64_t) IMul 253 254 + Store 243(i64) 255 + 256: 14(int16_t) Load 200(i16) + 257: 27(int) SConvert 256 + 258: 27(int) Load 220(i) + 259: 27(int) SMod 257 258 + Store 220(i) 259 + 260: 14(int16_t) Load 200(i16) + 261:193(i16vec3) Load 195(u16v) + 262:197(i16vec3) CompositeConstruct 260 260 260 + 263:193(i16vec3) ShiftLeftLogical 261 262 + Store 195(u16v) 263 + 265: 37(ptr) AccessChain 195(u16v) 264 + 266: 36(int16_t) Load 265 + 267: 14(int16_t) Load 200(i16) + 268: 14(int16_t) ShiftRightArithmetic 267 266 + Store 200(i16) 268 + 269: 14(int16_t) Load 200(i16) + 271: 37(ptr) AccessChain 195(u16v) 270 + 272: 36(int16_t) Load 271 + 273: 14(int16_t) ShiftLeftLogical 269 272 + Store 200(i16) 273 + 274:193(i16vec3) Load 195(u16v) + 275: 27(int) Load 220(i) + 277: 276(ivec3) CompositeConstruct 275 275 275 + 278:193(i16vec3) ShiftLeftLogical 274 277 + 279: 225(ivec3) UConvert 278 + Store 227(uv) 279 + 283: 37(ptr) AccessChain 195(u16v) 282 + 284: 36(int16_t) Load 283 + 285: 14(int16_t) Load 200(i16) + 286: 36(int16_t) Bitcast 285 + 287: 173(bool) INotEqual 284 286 + Store 281(b) 287 + 288: 14(int16_t) Load 200(i16) + 289: 36(int16_t) Bitcast 288 + 290: 37(ptr) AccessChain 195(u16v) 282 + 291: 36(int16_t) Load 290 + 292: 173(bool) IEqual 289 291 + Store 281(b) 292 + 293: 37(ptr) AccessChain 195(u16v) 282 + 294: 36(int16_t) Load 293 + 295: 17(int) UConvert 294 + 297: 296(ptr) AccessChain 227(uv) 264 + 298: 17(int) Load 297 + 299: 173(bool) UGreaterThan 295 298 + Store 281(b) 299 + 300: 14(int16_t) Load 200(i16) + 301: 27(int) SConvert 300 + 302: 27(int) Load 220(i) + 303: 173(bool) SLessThan 301 302 + Store 281(b) 303 + 304: 37(ptr) AccessChain 195(u16v) 264 + 305: 36(int16_t) Load 304 + 306: 17(int) UConvert 305 + 307: 296(ptr) AccessChain 227(uv) 282 + 308: 17(int) Load 307 + 309: 173(bool) UGreaterThanEqual 306 308 + Store 281(b) 309 + 310: 14(int16_t) Load 200(i16) + 311: 27(int) SConvert 310 + 312: 27(int) Load 220(i) + 313: 173(bool) SLessThanEqual 311 312 + Store 281(b) 313 + 314: 14(int16_t) Load 200(i16) + 315: 27(int) SConvert 314 + 316: 17(int) Bitcast 315 + 317: 225(ivec3) Load 227(uv) + 318: 225(ivec3) CompositeConstruct 316 316 316 + 319: 225(ivec3) BitwiseOr 317 318 + Store 227(uv) 319 + 320: 14(int16_t) Load 200(i16) + 321: 27(int) SConvert 320 + 322: 27(int) Load 220(i) + 323: 27(int) BitwiseOr 321 322 + Store 220(i) 323 + 324: 14(int16_t) Load 200(i16) + 325: 71(int64_t) SConvert 324 + 326: 71(int64_t) Load 243(i64) + 327: 71(int64_t) BitwiseAnd 326 325 + Store 243(i64) 327 + 328:193(i16vec3) Load 195(u16v) + 329: 225(ivec3) UConvert 328 + 330: 225(ivec3) Load 227(uv) + 331: 225(ivec3) BitwiseAnd 329 330 + Store 227(uv) 331 + 332: 14(int16_t) Load 200(i16) + 333: 27(int) SConvert 332 + 334: 17(int) Bitcast 333 + 335: 225(ivec3) Load 227(uv) + 336: 225(ivec3) CompositeConstruct 334 334 334 + 337: 225(ivec3) BitwiseXor 335 336 + Store 227(uv) 337 + 338:193(i16vec3) Load 195(u16v) + 339: 14(int16_t) Load 200(i16) + 340: 36(int16_t) Bitcast 339 + 341:193(i16vec3) CompositeConstruct 340 340 340 + 342:193(i16vec3) BitwiseXor 338 341 + Store 195(u16v) 342 + Return + FunctionEnd +12(builtinFuncs(): 2 Function None 3 + 13: Label + 343(i16v): 53(ptr) Variable Function + 346(i16): 15(ptr) Variable Function + 356(u16v): 194(ptr) Variable Function + 358(u16): 37(ptr) Variable Function + 428(i32): 219(ptr) Variable Function + 431(i64): 242(ptr) Variable Function + 434(i16v4): 433(ptr) Variable Function + 437(u32): 296(ptr) Variable Function + 438(u16v2): 58(ptr) Variable Function + 442(u64): 441(ptr) Variable Function + 445(u16v4): 444(ptr) Variable Function + 457(bv): 456(ptr) Variable Function + 344: 52(i16vec2) Load 343(i16v) + 345: 52(i16vec2) ExtInst 1(GLSL.std.450) 5(SAbs) 344 + Store 343(i16v) 345 + 347: 14(int16_t) Load 346(i16) + 348: 14(int16_t) ExtInst 1(GLSL.std.450) 7(SSign) 347 + Store 346(i16) 348 + 349: 52(i16vec2) Load 343(i16v) + 350: 14(int16_t) Load 346(i16) + 351: 52(i16vec2) CompositeConstruct 350 350 + 352: 52(i16vec2) ExtInst 1(GLSL.std.450) 39(SMin) 349 351 + Store 343(i16v) 352 + 353: 52(i16vec2) Load 343(i16v) + 355: 52(i16vec2) ExtInst 1(GLSL.std.450) 39(SMin) 353 354 + Store 343(i16v) 355 + 357:193(i16vec3) Load 356(u16v) + 359: 36(int16_t) Load 358(u16) + 360:193(i16vec3) CompositeConstruct 359 359 359 + 361:193(i16vec3) ExtInst 1(GLSL.std.450) 38(UMin) 357 360 + Store 356(u16v) 361 + 362:193(i16vec3) Load 356(u16v) + 364:193(i16vec3) ExtInst 1(GLSL.std.450) 38(UMin) 362 363 + Store 356(u16v) 364 + 365: 52(i16vec2) Load 343(i16v) + 366: 14(int16_t) Load 346(i16) + 367: 52(i16vec2) CompositeConstruct 366 366 + 368: 52(i16vec2) ExtInst 1(GLSL.std.450) 42(SMax) 365 367 + Store 343(i16v) 368 + 369: 52(i16vec2) Load 343(i16v) + 370: 52(i16vec2) ExtInst 1(GLSL.std.450) 42(SMax) 369 354 + Store 343(i16v) 370 + 371:193(i16vec3) Load 356(u16v) + 372: 36(int16_t) Load 358(u16) + 373:193(i16vec3) CompositeConstruct 372 372 372 + 374:193(i16vec3) ExtInst 1(GLSL.std.450) 41(UMax) 371 373 + Store 356(u16v) 374 + 375:193(i16vec3) Load 356(u16v) + 376:193(i16vec3) ExtInst 1(GLSL.std.450) 41(UMax) 375 363 + Store 356(u16v) 376 + 377: 52(i16vec2) Load 343(i16v) + 378: 14(int16_t) Load 346(i16) + 379: 14(int16_t) SNegate 378 + 380: 14(int16_t) Load 346(i16) + 381: 52(i16vec2) CompositeConstruct 379 379 + 382: 52(i16vec2) CompositeConstruct 380 380 + 383: 52(i16vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 377 381 382 + Store 343(i16v) 383 + 384: 52(i16vec2) Load 343(i16v) + 385: 52(i16vec2) Load 343(i16v) + 386: 52(i16vec2) SNegate 385 + 387: 52(i16vec2) Load 343(i16v) + 388: 52(i16vec2) ExtInst 1(GLSL.std.450) 45(SClamp) 384 386 387 + Store 343(i16v) 388 + 389:193(i16vec3) Load 356(u16v) + 390: 36(int16_t) Load 358(u16) + 391: 36(int16_t) SNegate 390 + 392: 36(int16_t) Load 358(u16) + 393:193(i16vec3) CompositeConstruct 391 391 391 + 394:193(i16vec3) CompositeConstruct 392 392 392 + 395:193(i16vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 389 393 394 + Store 356(u16v) 395 + 396:193(i16vec3) Load 356(u16v) + 397:193(i16vec3) Load 356(u16v) + 398:193(i16vec3) SNegate 397 + 399:193(i16vec3) Load 356(u16v) + 400:193(i16vec3) ExtInst 1(GLSL.std.450) 44(UClamp) 396 398 399 + Store 356(u16v) 400 + 401: 15(ptr) AccessChain 343(i16v) 282 + 402: 14(int16_t) Load 401 + 403: 15(ptr) AccessChain 343(i16v) 264 + 404: 14(int16_t) Load 403 + 406: 14(int16_t) Select 405 404 402 + Store 346(i16) 406 + 407: 14(int16_t) Load 346(i16) + 408: 52(i16vec2) CompositeConstruct 407 407 + 409: 14(int16_t) Load 346(i16) + 410: 14(int16_t) SNegate 409 + 411: 52(i16vec2) CompositeConstruct 410 410 + 414: 52(i16vec2) Select 413 411 408 + Store 343(i16v) 414 + 415: 37(ptr) AccessChain 356(u16v) 282 + 416: 36(int16_t) Load 415 + 417: 37(ptr) AccessChain 356(u16v) 264 + 418: 36(int16_t) Load 417 + 419: 36(int16_t) Select 405 418 416 + Store 358(u16) 419 + 420: 36(int16_t) Load 358(u16) + 421:193(i16vec3) CompositeConstruct 420 420 420 + 422: 36(int16_t) Load 358(u16) + 423: 36(int16_t) SNegate 422 + 424:193(i16vec3) CompositeConstruct 423 423 423 + 427:193(i16vec3) Select 426 424 421 + Store 356(u16v) 427 + 429: 52(i16vec2) Load 343(i16v) + 430: 27(int) Bitcast 429 + Store 428(i32) 430 + 435:432(i16vec4) Load 434(i16v4) + 436: 71(int64_t) Bitcast 435 + Store 431(i64) 436 + 439: 57(i16vec2) Load 438(u16v2) + 440: 17(int) Bitcast 439 + Store 437(u32) 440 + 446:443(i16vec4) Load 445(u16v4) + 447: 77(int64_t) Bitcast 446 + Store 442(u64) 447 + 448: 27(int) Load 428(i32) + 449: 52(i16vec2) Bitcast 448 + Store 343(i16v) 449 + 450: 71(int64_t) Load 431(i64) + 451:432(i16vec4) Bitcast 450 + Store 434(i16v4) 451 + 452: 17(int) Load 437(u32) + 453: 57(i16vec2) Bitcast 452 + Store 438(u16v2) 453 + 454: 77(int64_t) Load 442(u64) + 455:443(i16vec4) Bitcast 454 + Store 445(u16v4) 455 + 458:193(i16vec3) Load 356(u16v) + 459: 36(int16_t) Load 358(u16) + 460:193(i16vec3) CompositeConstruct 459 459 459 + 461: 425(bvec3) ULessThan 458 460 + Store 457(bv) 461 + 462: 52(i16vec2) Load 343(i16v) + 463: 14(int16_t) Load 346(i16) + 464: 52(i16vec2) CompositeConstruct 463 463 + 465: 174(bvec2) SLessThan 462 464 + 466: 425(bvec3) Load 457(bv) + 467: 425(bvec3) VectorShuffle 466 465 3 4 2 + Store 457(bv) 467 + 468:193(i16vec3) Load 356(u16v) + 469: 36(int16_t) Load 358(u16) + 470:193(i16vec3) CompositeConstruct 469 469 469 + 471: 425(bvec3) ULessThanEqual 468 470 + Store 457(bv) 471 + 472: 52(i16vec2) Load 343(i16v) + 473: 14(int16_t) Load 346(i16) + 474: 52(i16vec2) CompositeConstruct 473 473 + 475: 174(bvec2) SLessThanEqual 472 474 + 476: 425(bvec3) Load 457(bv) + 477: 425(bvec3) VectorShuffle 476 475 3 4 2 + Store 457(bv) 477 + 478:193(i16vec3) Load 356(u16v) + 479: 36(int16_t) Load 358(u16) + 480:193(i16vec3) CompositeConstruct 479 479 479 + 481: 425(bvec3) UGreaterThan 478 480 + Store 457(bv) 481 + 482: 52(i16vec2) Load 343(i16v) + 483: 14(int16_t) Load 346(i16) + 484: 52(i16vec2) CompositeConstruct 483 483 + 485: 174(bvec2) SGreaterThan 482 484 + 486: 425(bvec3) Load 457(bv) + 487: 425(bvec3) VectorShuffle 486 485 3 4 2 + Store 457(bv) 487 + 488:193(i16vec3) Load 356(u16v) + 489: 36(int16_t) Load 358(u16) + 490:193(i16vec3) CompositeConstruct 489 489 489 + 491: 425(bvec3) UGreaterThanEqual 488 490 + Store 457(bv) 491 + 492: 52(i16vec2) Load 343(i16v) + 493: 14(int16_t) Load 346(i16) + 494: 52(i16vec2) CompositeConstruct 493 493 + 495: 174(bvec2) SGreaterThanEqual 492 494 + 496: 425(bvec3) Load 457(bv) + 497: 425(bvec3) VectorShuffle 496 495 3 4 2 + Store 457(bv) 497 + 498:193(i16vec3) Load 356(u16v) + 499: 36(int16_t) Load 358(u16) + 500:193(i16vec3) CompositeConstruct 499 499 499 + 501: 425(bvec3) IEqual 498 500 + Store 457(bv) 501 + 502: 52(i16vec2) Load 343(i16v) + 503: 14(int16_t) Load 346(i16) + 504: 52(i16vec2) CompositeConstruct 503 503 + 505: 174(bvec2) IEqual 502 504 + 506: 425(bvec3) Load 457(bv) + 507: 425(bvec3) VectorShuffle 506 505 3 4 2 + Store 457(bv) 507 + 508:193(i16vec3) Load 356(u16v) + 509: 36(int16_t) Load 358(u16) + 510:193(i16vec3) CompositeConstruct 509 509 509 + 511: 425(bvec3) INotEqual 508 510 + Store 457(bv) 511 + 512: 52(i16vec2) Load 343(i16v) + 513: 14(int16_t) Load 346(i16) + 514: 52(i16vec2) CompositeConstruct 513 513 + 515: 174(bvec2) INotEqual 512 514 + 516: 425(bvec3) Load 457(bv) + 517: 425(bvec3) VectorShuffle 516 515 3 4 2 + Store 457(bv) 517 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan110.storageBuffer.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan110.storageBuffer.vert.out new file mode 100644 index 00000000000..77eafc242e0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.vulkan110.storageBuffer.vert.out @@ -0,0 +1,66 @@ +spv.vulkan110.storageBuffer.vert +// Module Version 10300 +// Generated by (magic number): 80007 +// Id's are bound by 31 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 13 + Source GLSL 450 + Name 4 "main" + Name 11 "gl_PerVertex" + MemberName 11(gl_PerVertex) 0 "gl_Position" + MemberName 11(gl_PerVertex) 1 "gl_PointSize" + MemberName 11(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 11(gl_PerVertex) 3 "gl_CullDistance" + Name 13 "" + Name 16 "ub" + MemberName 16(ub) 0 "a" + Name 18 "ubi" + Name 22 "bb" + MemberName 22(bb) 0 "b" + Name 24 "bbi" + MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 11(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 11(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 11(gl_PerVertex) Block + MemberDecorate 16(ub) 0 Offset 0 + Decorate 16(ub) Block + Decorate 18(ubi) DescriptorSet 0 + MemberDecorate 22(bb) 0 Offset 0 + Decorate 22(bb) Block + Decorate 24(bbi) DescriptorSet 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeInt 32 0 + 9: 8(int) Constant 1 + 10: TypeArray 6(float) 9 +11(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 10 10 + 12: TypePointer Output 11(gl_PerVertex) + 13: 12(ptr) Variable Output + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16(ub): TypeStruct 7(fvec4) + 17: TypePointer Uniform 16(ub) + 18(ubi): 17(ptr) Variable Uniform + 19: TypePointer Uniform 7(fvec4) + 22(bb): TypeStruct 7(fvec4) + 23: TypePointer StorageBuffer 22(bb) + 24(bbi): 23(ptr) Variable StorageBuffer + 25: TypePointer StorageBuffer 7(fvec4) + 29: TypePointer Output 7(fvec4) + 4(main): 2 Function None 3 + 5: Label + 20: 19(ptr) AccessChain 18(ubi) 15 + 21: 7(fvec4) Load 20 + 26: 25(ptr) AccessChain 24(bbi) 15 + 27: 7(fvec4) Load 26 + 28: 7(fvec4) FAdd 21 27 + 30: 29(ptr) AccessChain 13 15 + Store 30 28 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-continue-break.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-continue-break.vert.out index 1d343ed2627..d49bca09b1d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-continue-break.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-continue-break.vert.out @@ -1,6 +1,6 @@ spv.while-continue-break.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 41 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-simple.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-simple.vert.out index d956c6c3f41..b507da3ed03 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-simple.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.while-simple.vert.out @@ -1,6 +1,6 @@ spv.while-simple.vert // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 22 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.whileLoop.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.whileLoop.frag.out index e58fb043c80..e29497235e9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.whileLoop.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.whileLoop.frag.out @@ -1,6 +1,6 @@ spv.whileLoop.frag // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 35 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb.vert.out new file mode 100644 index 00000000000..3cd93d50019 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb.vert.out @@ -0,0 +1,55 @@ +spv.xfb.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 16 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 8 11 14 15 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "out1" + Name 9 "outXfb" + MemberName 9(outXfb) 0 "out2" + Name 11 "" + Name 12 "outXfb2" + MemberName 12(outXfb2) 0 "out3" + Name 14 "" + Name 15 "out4" + Decorate 8(out1) Location 0 + Decorate 8(out1) XfbBuffer 3 + Decorate 8(out1) XfbStride 48 + Decorate 8(out1) Offset 12 + MemberDecorate 9(outXfb) 0 Offset 8 + Decorate 9(outXfb) Block + Decorate 11 Location 1 + Decorate 11 XfbBuffer 2 + Decorate 11 XfbStride 32 + MemberDecorate 12(outXfb2) 0 Offset 60 + Decorate 12(outXfb2) Block + Decorate 14 Location 3 + Decorate 14 XfbBuffer 1 + Decorate 14 XfbStride 64 + Decorate 15(out4) Location 4 + Decorate 15(out4) XfbBuffer 0 + Decorate 15(out4) XfbStride 8 + Decorate 15(out4) Offset 4 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Output 6(float) + 8(out1): 7(ptr) Variable Output + 9(outXfb): TypeStruct 6(float) + 10: TypePointer Output 9(outXfb) + 11: 10(ptr) Variable Output + 12(outXfb2): TypeStruct 6(float) + 13: TypePointer Output 12(outXfb2) + 14: 13(ptr) Variable Output + 15(out4): 7(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb2.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb2.vert.out new file mode 100644 index 00000000000..a8551a1a70e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb2.vert.out @@ -0,0 +1,68 @@ +spv.xfb2.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 35 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 14 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "gl_PerVertex" + MemberName 8(gl_PerVertex) 0 "gl_Position" + Name 10 "" + Name 14 "position" + Name 17 "ComponentsBlock" + MemberName 17(ComponentsBlock) 0 "c1" + MemberName 17(ComponentsBlock) 1 "c2" + Name 19 "components" + MemberDecorate 8(gl_PerVertex) 0 Offset 16 + MemberDecorate 8(gl_PerVertex) 0 BuiltIn Position + Decorate 8(gl_PerVertex) Block + Decorate 10 XfbBuffer 3 + Decorate 10 XfbStride 32 + Decorate 14(position) Location 0 + MemberDecorate 17(ComponentsBlock) 0 Offset 0 + MemberDecorate 17(ComponentsBlock) 1 Offset 16 + Decorate 17(ComponentsBlock) Block + Decorate 19(components) DescriptorSet 0 + Decorate 19(components) Binding 5 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(gl_PerVertex): TypeStruct 7(fvec4) + 9: TypePointer Output 8(gl_PerVertex) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: TypePointer Input 7(fvec4) + 14(position): 13(ptr) Variable Input + 16: TypeVector 6(float) 2 +17(ComponentsBlock): TypeStruct 7(fvec4) 16(fvec2) + 18: TypePointer Uniform 17(ComponentsBlock) + 19(components): 18(ptr) Variable Uniform + 20: TypePointer Uniform 7(fvec4) + 24: 11(int) Constant 1 + 25: TypePointer Uniform 16(fvec2) + 28: 6(float) Constant 0 + 33: TypePointer Output 7(fvec4) + 4(main): 2 Function None 3 + 5: Label + 15: 7(fvec4) Load 14(position) + 21: 20(ptr) AccessChain 19(components) 12 + 22: 7(fvec4) Load 21 + 23: 7(fvec4) FAdd 15 22 + 26: 25(ptr) AccessChain 19(components) 24 + 27: 16(fvec2) Load 26 + 29: 6(float) CompositeExtract 27 0 + 30: 6(float) CompositeExtract 27 1 + 31: 7(fvec4) CompositeConstruct 29 30 28 28 + 32: 7(fvec4) FAdd 23 31 + 34: 33(ptr) AccessChain 10 12 + Store 34 32 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb3.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb3.vert.out new file mode 100644 index 00000000000..0218847e3ee --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfb3.vert.out @@ -0,0 +1,68 @@ +spv.xfb3.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 35 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 14 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "gl_PerVertex" + MemberName 8(gl_PerVertex) 0 "gl_Position" + Name 10 "" + Name 14 "position" + Name 17 "ComponentsBlock" + MemberName 17(ComponentsBlock) 0 "c1" + MemberName 17(ComponentsBlock) 1 "c2" + Name 19 "components" + MemberDecorate 8(gl_PerVertex) 0 Offset 16 + MemberDecorate 8(gl_PerVertex) 0 BuiltIn Position + Decorate 8(gl_PerVertex) Block + Decorate 10 XfbBuffer 3 + Decorate 10 XfbStride 80 + Decorate 14(position) Location 0 + MemberDecorate 17(ComponentsBlock) 0 Offset 0 + MemberDecorate 17(ComponentsBlock) 1 Offset 16 + Decorate 17(ComponentsBlock) Block + Decorate 19(components) DescriptorSet 0 + Decorate 19(components) Binding 5 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(gl_PerVertex): TypeStruct 7(fvec4) + 9: TypePointer Output 8(gl_PerVertex) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: TypePointer Input 7(fvec4) + 14(position): 13(ptr) Variable Input + 16: TypeVector 6(float) 2 +17(ComponentsBlock): TypeStruct 7(fvec4) 16(fvec2) + 18: TypePointer Uniform 17(ComponentsBlock) + 19(components): 18(ptr) Variable Uniform + 20: TypePointer Uniform 7(fvec4) + 24: 11(int) Constant 1 + 25: TypePointer Uniform 16(fvec2) + 28: 6(float) Constant 0 + 33: TypePointer Output 7(fvec4) + 4(main): 2 Function None 3 + 5: Label + 15: 7(fvec4) Load 14(position) + 21: 20(ptr) AccessChain 19(components) 12 + 22: 7(fvec4) Load 21 + 23: 7(fvec4) FAdd 15 22 + 26: 25(ptr) AccessChain 19(components) 24 + 27: 16(fvec2) Load 26 + 29: 6(float) CompositeExtract 27 0 + 30: 6(float) CompositeExtract 27 1 + 31: 7(fvec4) CompositeConstruct 29 30 28 28 + 32: 7(fvec4) FAdd 23 31 + 34: 33(ptr) AccessChain 10 12 + Store 34 32 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOffsetOnBlockMembersAssignment.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOffsetOnBlockMembersAssignment.vert.out new file mode 100644 index 00000000000..066aa3a0872 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOffsetOnBlockMembersAssignment.vert.out @@ -0,0 +1,76 @@ +spv.xfbOffsetOnBlockMembersAssignment.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 33 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 27 31 32 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "block2" + MemberName 8(block2) 0 "y1_out" + MemberName 8(block2) 1 "y2_out" + Name 10 "" + Name 25 "gl_PerVertex" + MemberName 25(gl_PerVertex) 0 "gl_Position" + MemberName 25(gl_PerVertex) 1 "gl_PointSize" + MemberName 25(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 25(gl_PerVertex) 3 "gl_CullDistance" + Name 27 "" + Name 31 "gl_VertexID" + Name 32 "gl_InstanceID" + MemberDecorate 8(block2) 0 Offset 0 + MemberDecorate 8(block2) 1 Offset 4 + Decorate 8(block2) Block + Decorate 10 Location 5 + Decorate 10 XfbBuffer 2 + Decorate 10 XfbStride 20 + MemberDecorate 25(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 25(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 25(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 25(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 25(gl_PerVertex) Block + Decorate 27 XfbBuffer 0 + Decorate 27 XfbStride 0 + Decorate 31(gl_VertexID) BuiltIn VertexId + Decorate 32(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(block2): TypeStruct 6(float) 7(fvec4) + 9: TypePointer Output 8(block2) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: 6(float) Constant 1088421888 + 14: TypePointer Output 6(float) + 16: 11(int) Constant 1 + 17: 6(float) Constant 1065353216 + 18: 6(float) Constant 0 + 19: 7(fvec4) ConstantComposite 17 18 18 17 + 20: TypePointer Output 7(fvec4) + 22: TypeInt 32 0 + 23: 22(int) Constant 1 + 24: TypeArray 6(float) 23 +25(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 24 24 + 26: TypePointer Output 25(gl_PerVertex) + 27: 26(ptr) Variable Output + 28: 7(fvec4) ConstantComposite 18 18 18 18 + 30: TypePointer Input 11(int) + 31(gl_VertexID): 30(ptr) Variable Input +32(gl_InstanceID): 30(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 15: 14(ptr) AccessChain 10 12 + Store 15 13 + 21: 20(ptr) AccessChain 10 16 + Store 21 19 + 29: 20(ptr) AccessChain 27 12 + Store 29 28 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOffsetOnStructMembersAssignment.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOffsetOnStructMembersAssignment.vert.out new file mode 100644 index 00000000000..7eb4593426c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOffsetOnStructMembersAssignment.vert.out @@ -0,0 +1,93 @@ +spv.xfbOffsetOnStructMembersAssignment.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 40 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 9 21 34 38 39 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 7 "S" + MemberName 7(S) 0 "x1_out" + MemberName 7(S) 1 "x2_out" + Name 9 "s1" + Name 19 "S2" + MemberName 19(S2) 0 "y1_out" + MemberName 19(S2) 1 "y2_out" + Name 21 "s2" + Name 32 "gl_PerVertex" + MemberName 32(gl_PerVertex) 0 "gl_Position" + MemberName 32(gl_PerVertex) 1 "gl_PointSize" + MemberName 32(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 32(gl_PerVertex) 3 "gl_CullDistance" + Name 34 "" + Name 38 "gl_VertexID" + Name 39 "gl_InstanceID" + MemberDecorate 7(S) 0 Offset 16 + MemberDecorate 7(S) 1 Offset 20 + Decorate 9(s1) Location 0 + Decorate 9(s1) XfbBuffer 2 + Decorate 9(s1) XfbStride 24 + MemberDecorate 19(S2) 0 Offset 8 + MemberDecorate 19(S2) 1 Offset 12 + Decorate 21(s2) Location 5 + Decorate 21(s2) XfbBuffer 1 + Decorate 21(s2) XfbStride 28 + MemberDecorate 32(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 32(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 32(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 32(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 32(gl_PerVertex) Block + Decorate 34 XfbBuffer 0 + Decorate 34 XfbStride 0 + Decorate 38(gl_VertexID) BuiltIn VertexId + Decorate 39(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7(S): TypeStruct 6(float) 6(float) + 8: TypePointer Output 7(S) + 9(s1): 8(ptr) Variable Output + 10: TypeInt 32 1 + 11: 10(int) Constant 0 + 12: 6(float) Constant 1084227584 + 13: TypePointer Output 6(float) + 15: 10(int) Constant 1 + 16: 6(float) Constant 1086324736 + 18: TypeVector 6(float) 4 + 19(S2): TypeStruct 6(float) 18(fvec4) + 20: TypePointer Output 19(S2) + 21(s2): 20(ptr) Variable Output + 22: 6(float) Constant 1088421888 + 24: 6(float) Constant 1065353216 + 25: 6(float) Constant 0 + 26: 18(fvec4) ConstantComposite 24 25 25 24 + 27: TypePointer Output 18(fvec4) + 29: TypeInt 32 0 + 30: 29(int) Constant 1 + 31: TypeArray 6(float) 30 +32(gl_PerVertex): TypeStruct 18(fvec4) 6(float) 31 31 + 33: TypePointer Output 32(gl_PerVertex) + 34: 33(ptr) Variable Output + 35: 18(fvec4) ConstantComposite 25 25 25 25 + 37: TypePointer Input 10(int) + 38(gl_VertexID): 37(ptr) Variable Input +39(gl_InstanceID): 37(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 14: 13(ptr) AccessChain 9(s1) 11 + Store 14 12 + 17: 13(ptr) AccessChain 9(s1) 15 + Store 17 16 + 23: 13(ptr) AccessChain 21(s2) 11 + Store 23 22 + 28: 27(ptr) AccessChain 21(s2) 15 + Store 28 26 + 36: 27(ptr) AccessChain 34 11 + Store 36 35 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOverlapOffsetCheckWithBlockAndMember.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOverlapOffsetCheckWithBlockAndMember.vert.out new file mode 100644 index 00000000000..ebc496299b9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbOverlapOffsetCheckWithBlockAndMember.vert.out @@ -0,0 +1,88 @@ +spv.xfbOverlapOffsetCheckWithBlockAndMember.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 39 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 33 37 38 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "block2" + MemberName 8(block2) 0 "v" + MemberName 8(block2) 1 "u" + MemberName 8(block2) 2 "w" + MemberName 8(block2) 3 "x" + Name 10 "" + Name 31 "gl_PerVertex" + MemberName 31(gl_PerVertex) 0 "gl_Position" + MemberName 31(gl_PerVertex) 1 "gl_PointSize" + MemberName 31(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 31(gl_PerVertex) 3 "gl_CullDistance" + Name 33 "" + Name 37 "gl_VertexID" + Name 38 "gl_InstanceID" + MemberDecorate 8(block2) 0 Offset 12 + MemberDecorate 8(block2) 1 Offset 28 + MemberDecorate 8(block2) 2 Offset 40 + MemberDecorate 8(block2) 3 Offset 56 + Decorate 8(block2) Block + Decorate 10 Location 5 + Decorate 10 XfbBuffer 3 + Decorate 10 XfbStride 72 + MemberDecorate 31(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 31(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 31(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 31(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 31(gl_PerVertex) Block + Decorate 33 XfbBuffer 0 + Decorate 33 XfbStride 0 + Decorate 37(gl_VertexID) BuiltIn VertexId + Decorate 38(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(block2): TypeStruct 7(fvec4) 6(float) 7(fvec4) 7(fvec4) + 9: TypePointer Output 8(block2) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: 6(float) Constant 1065353216 + 14: 6(float) Constant 0 + 15: 7(fvec4) ConstantComposite 13 14 13 14 + 16: TypePointer Output 7(fvec4) + 18: 11(int) Constant 1 + 19: 6(float) Constant 1084227584 + 20: TypePointer Output 6(float) + 22: 11(int) Constant 2 + 23: 7(fvec4) ConstantComposite 13 14 14 13 + 25: 11(int) Constant 3 + 26: 7(fvec4) ConstantComposite 19 14 14 14 + 28: TypeInt 32 0 + 29: 28(int) Constant 1 + 30: TypeArray 6(float) 29 +31(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 30 30 + 32: TypePointer Output 31(gl_PerVertex) + 33: 32(ptr) Variable Output + 34: 7(fvec4) ConstantComposite 14 14 14 14 + 36: TypePointer Input 11(int) + 37(gl_VertexID): 36(ptr) Variable Input +38(gl_InstanceID): 36(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 17: 16(ptr) AccessChain 10 12 + Store 17 15 + 21: 20(ptr) AccessChain 10 18 + Store 21 19 + 24: 16(ptr) AccessChain 10 22 + Store 24 23 + 27: 16(ptr) AccessChain 10 25 + Store 27 26 + 35: 16(ptr) AccessChain 33 12 + Store 35 34 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbStrideJustOnce.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbStrideJustOnce.vert.out new file mode 100644 index 00000000000..9b459b503e0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/spv.xfbStrideJustOnce.vert.out @@ -0,0 +1,74 @@ +spv.xfbStrideJustOnce.vert +// Module Version 10000 +// Generated by (magic number): 80007 +// Id's are bound by 33 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 27 31 32 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "block" + MemberName 8(block) 0 "y1_out" + MemberName 8(block) 1 "y2_out" + Name 10 "" + Name 25 "gl_PerVertex" + MemberName 25(gl_PerVertex) 0 "gl_Position" + MemberName 25(gl_PerVertex) 1 "gl_PointSize" + MemberName 25(gl_PerVertex) 2 "gl_ClipDistance" + MemberName 25(gl_PerVertex) 3 "gl_CullDistance" + Name 27 "" + Name 31 "gl_VertexID" + Name 32 "gl_InstanceID" + Decorate 8(block) Block + Decorate 10 Location 5 + Decorate 10 XfbBuffer 2 + Decorate 10 XfbStride 20 + MemberDecorate 25(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 25(gl_PerVertex) 1 BuiltIn PointSize + MemberDecorate 25(gl_PerVertex) 2 BuiltIn ClipDistance + MemberDecorate 25(gl_PerVertex) 3 BuiltIn CullDistance + Decorate 25(gl_PerVertex) Block + Decorate 27 XfbBuffer 0 + Decorate 27 XfbStride 0 + Decorate 31(gl_VertexID) BuiltIn VertexId + Decorate 32(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(block): TypeStruct 6(float) 7(fvec4) + 9: TypePointer Output 8(block) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: 6(float) Constant 1088421888 + 14: TypePointer Output 6(float) + 16: 11(int) Constant 1 + 17: 6(float) Constant 1065353216 + 18: 6(float) Constant 0 + 19: 7(fvec4) ConstantComposite 17 18 18 17 + 20: TypePointer Output 7(fvec4) + 22: TypeInt 32 0 + 23: 22(int) Constant 1 + 24: TypeArray 6(float) 23 +25(gl_PerVertex): TypeStruct 7(fvec4) 6(float) 24 24 + 26: TypePointer Output 25(gl_PerVertex) + 27: 26(ptr) Variable Output + 28: 7(fvec4) ConstantComposite 18 18 18 18 + 30: TypePointer Input 11(int) + 31(gl_VertexID): 30(ptr) Variable Input +32(gl_InstanceID): 30(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 15: 14(ptr) AccessChain 10 12 + Store 15 13 + 21: 20(ptr) AccessChain 10 16 + Store 21 19 + 29: 20(ptr) AccessChain 27 12 + Store 29 28 + Return + FunctionEnd diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/stringToDouble.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/stringToDouble.vert.out new file mode 100644 index 00000000000..a799d0a42f5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/stringToDouble.vert.out @@ -0,0 +1,1045 @@ +stringToDouble.vert +Shader version: 460 +Requested GL_KHX_shader_explicit_arithmetic_types_float16 +0:? Sequence +0:3 Function Definition: main( ( global void) +0:3 Function Parameters: +0:5 Sequence +0:5 Sequence +0:5 move second child to first child ( temp float) +0:5 'w1' ( temp float) +0:5 Constant: +0:5 0.000000 +0:6 Sequence +0:6 move second child to first child ( temp float) +0:6 'w2' ( temp float) +0:6 Constant: +0:6 1.000000 +0:7 Sequence +0:7 move second child to first child ( temp float) +0:7 'w3' ( temp float) +0:7 Constant: +0:7 7.000000 +0:8 Sequence +0:8 move second child to first child ( temp float) +0:8 'w4' ( temp float) +0:8 Constant: +0:8 130000.000000 +0:9 Sequence +0:9 move second child to first child ( temp float) +0:9 'w5' ( temp float) +0:9 Constant: +0:9 123456789.000000 +0:10 Sequence +0:10 move second child to first child ( temp double) +0:10 'w6' ( temp double) +0:10 Constant: +0:10 1.2345678901235e+15 +0:11 Sequence +0:11 move second child to first child ( temp double) +0:11 'w7' ( temp double) +0:11 Constant: +0:11 1.2345678901235e+16 +0:12 Sequence +0:12 move second child to first child ( temp double) +0:12 'w8' ( temp double) +0:12 Constant: +0:12 1.2345678901235e+17 +0:13 Sequence +0:13 move second child to first child ( temp double) +0:13 'w9' ( temp double) +0:13 Constant: +0:13 1.2345678901235e+19 +0:14 Sequence +0:14 move second child to first child ( temp double) +0:14 'w10' ( temp double) +0:14 Constant: +0:14 1.2345678901235e+24 +0:16 Sequence +0:16 move second child to first child ( temp float) +0:16 'e1' ( temp float) +0:16 Constant: +0:16 0.000000 +0:17 Sequence +0:17 move second child to first child ( temp float) +0:17 'e2' ( temp float) +0:17 Constant: +0:17 1.000000 +0:18 Sequence +0:18 move second child to first child ( temp float) +0:18 'e3' ( temp float) +0:18 Constant: +0:18 0.000000 +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'e4' ( temp float) +0:19 Constant: +0:19 1.0000000000000e+15 +0:20 Sequence +0:20 move second child to first child ( temp float) +0:20 'e5' ( temp float) +0:20 Constant: +0:20 1.0000000000000e+16 +0:21 Sequence +0:21 move second child to first child ( temp float) +0:21 'e6' ( temp float) +0:21 Constant: +0:21 0.000000 +0:22 Sequence +0:22 move second child to first child ( temp float) +0:22 'e7' ( temp float) +0:22 Constant: +0:22 1.0000000000000e-15 +0:23 Sequence +0:23 move second child to first child ( temp float) +0:23 'e8' ( temp float) +0:23 Constant: +0:23 1.0000000000000e-16 +0:24 Sequence +0:24 move second child to first child ( temp double) +0:24 'e9' ( temp double) +0:24 Constant: +0:24 1.0000000000000e+100 +0:25 Sequence +0:25 move second child to first child ( temp double) +0:25 'e10' ( temp double) +0:25 Constant: +0:25 1.0000000000000e+308 +0:26 Sequence +0:26 move second child to first child ( temp double) +0:26 'e11' ( temp double) +0:26 Constant: +0:26 1.0000000000000e-307 +0:27 Sequence +0:27 move second child to first child ( temp double) +0:27 'e12' ( temp double) +0:27 Constant: +0:27 +1.#INF +0:28 Sequence +0:28 move second child to first child ( temp double) +0:28 'e13' ( temp double) +0:28 Constant: +0:28 0.000000 +0:29 Sequence +0:29 move second child to first child ( temp double) +0:29 'e24' ( temp double) +0:29 Constant: +0:29 +1.#INF +0:30 Sequence +0:30 move second child to first child ( temp double) +0:30 'e25' ( temp double) +0:30 Constant: +0:30 0.000000 +0:32 Sequence +0:32 move second child to first child ( temp double) +0:32 'f1' ( temp double) +0:32 Constant: +0:32 0.500000 +0:33 Sequence +0:33 move second child to first child ( temp double) +0:33 'f2' ( temp double) +0:33 Constant: +0:33 0.125000 +0:34 Sequence +0:34 move second child to first child ( temp double) +0:34 'f31' ( temp double) +0:34 Constant: +0:34 0.100000 +0:35 Sequence +0:35 move second child to first child ( temp double) +0:35 'f32' ( temp double) +0:35 Constant: +0:35 0.200000 +0:36 Sequence +0:36 move second child to first child ( temp double) +0:36 'f33' ( temp double) +0:36 Constant: +0:36 0.300000 +0:37 Sequence +0:37 move second child to first child ( temp double) +0:37 'f34' ( temp double) +0:37 Constant: +0:37 0.400000 +0:38 Sequence +0:38 move second child to first child ( temp double) +0:38 'f35' ( temp double) +0:38 Constant: +0:38 0.500000 +0:39 Sequence +0:39 move second child to first child ( temp double) +0:39 'f36' ( temp double) +0:39 Constant: +0:39 0.600000 +0:40 Sequence +0:40 move second child to first child ( temp double) +0:40 'f37' ( temp double) +0:40 Constant: +0:40 0.700000 +0:41 Sequence +0:41 move second child to first child ( temp double) +0:41 'f38' ( temp double) +0:41 Constant: +0:41 0.800000 +0:42 Sequence +0:42 move second child to first child ( temp double) +0:42 'f39' ( temp double) +0:42 Constant: +0:42 0.900000 +0:43 Sequence +0:43 move second child to first child ( temp double) +0:43 'f4' ( temp double) +0:43 Constant: +0:43 0.333333 +0:44 Sequence +0:44 move second child to first child ( temp double) +0:44 'f51' ( temp double) +0:44 Constant: +0:44 7.8347500000000e-37 +0:45 Sequence +0:45 move second child to first child ( temp double) +0:45 'f52' ( temp double) +0:45 Constant: +0:45 7.8347500000000e-37 +0:46 Sequence +0:46 move second child to first child ( temp double) +0:46 'f53' ( temp double) +0:46 Constant: +0:46 7.8347500000000e-37 +0:47 Sequence +0:47 move second child to first child ( temp double) +0:47 'f54' ( temp double) +0:47 Constant: +0:47 7.8347500000000e-37 +0:48 Sequence +0:48 move second child to first child ( temp double) +0:48 'f61' ( temp double) +0:48 Constant: +0:48 4.000000 +0:49 Sequence +0:49 move second child to first child ( temp double) +0:49 'f62' ( temp double) +0:49 Constant: +0:49 40.000000 +0:50 Sequence +0:50 move second child to first child ( temp double) +0:50 'f63' ( temp double) +0:50 Constant: +0:50 0.000000 +0:51 Sequence +0:51 move second child to first child ( temp double) +0:51 'f64' ( temp double) +0:51 Constant: +0:51 4.000000 +0:52 Sequence +0:52 move second child to first child ( temp double) +0:52 'f65' ( temp double) +0:52 Constant: +0:52 0.000000 +0:53 Sequence +0:53 move second child to first child ( temp double) +0:53 'f66' ( temp double) +0:53 Constant: +0:53 0.004000 +0:54 Sequence +0:54 move second child to first child ( temp double) +0:54 'f67' ( temp double) +0:54 Constant: +0:54 0.400000 +0:55 Sequence +0:55 move second child to first child ( temp double) +0:55 'f68' ( temp double) +0:55 Constant: +0:55 0.040000 +0:57 Sequence +0:57 move second child to first child ( temp double) +0:57 'c1' ( temp double) +0:57 Constant: +0:57 0.000810 +0:58 Sequence +0:58 move second child to first child ( temp double) +0:58 'c2' ( temp double) +0:58 Constant: +0:58 7.300000 +0:59 Sequence +0:59 move second child to first child ( temp double) +0:59 'c3' ( temp double) +0:59 Constant: +0:59 3.450000 +0:60 Sequence +0:60 move second child to first child ( temp double) +0:60 'c4' ( temp double) +0:60 Constant: +0:60 0.003570 +0:61 Sequence +0:61 move second child to first child ( temp double) +0:61 'c5' ( temp double) +0:61 Constant: +0:61 439.000000 +0:62 Sequence +0:62 move second child to first child ( temp double) +0:62 'c6' ( temp double) +0:62 Constant: +0:62 522000.000000 +0:63 Sequence +0:63 move second child to first child ( temp double) +0:63 'c7' ( temp double) +0:63 Constant: +0:63 61000000.000000 +0:64 Sequence +0:64 move second child to first child ( temp double) +0:64 'c8' ( temp double) +0:64 Constant: +0:64 0.610000 +0:65 Sequence +0:65 move second child to first child ( temp double) +0:65 'c9' ( temp double) +0:65 Constant: +0:65 1.2345678901235e+18 +0:66 Sequence +0:66 move second child to first child ( temp double) +0:66 'c10' ( temp double) +0:66 Constant: +0:66 1.0000000000000e+21 +0:67 Sequence +0:67 move second child to first child ( temp double) +0:67 'c11' ( temp double) +0:67 Constant: +0:67 1230000.004560 +0:68 Sequence +0:68 move second child to first child ( temp double) +0:68 'c12' ( temp double) +0:68 Constant: +0:68 1230.000004 +0:69 Sequence +0:69 move second child to first child ( temp double) +0:69 'c13' ( temp double) +0:69 Constant: +0:69 123.000000 +0:70 Sequence +0:70 move second child to first child ( temp double) +0:70 'c14' ( temp double) +0:70 Constant: +0:70 102.300000 +0:71 Sequence +0:71 move second child to first child ( temp double) +0:71 'c15' ( temp double) +0:71 Constant: +0:71 1.2003000000456e+12 +0:72 Sequence +0:72 move second child to first child ( temp double) +0:72 'c16' ( temp double) +0:72 Constant: +0:72 123000000456.000000 +0:73 Sequence +0:73 move second child to first child ( temp double) +0:73 'c17' ( temp double) +0:73 Constant: +0:73 1.2300000045600e+12 +0:74 Sequence +0:74 move second child to first child ( temp double) +0:74 'c18' ( temp double) +0:74 Constant: +0:74 1.2300000045601e+12 +0:76 Sequence +0:76 move second child to first child ( temp double) +0:76 'b11' ( temp double) +0:76 Constant: +0:76 7.2057594037928e+16 +0:77 Sequence +0:77 move second child to first child ( temp double) +0:77 'b12' ( temp double) +0:77 Constant: +0:77 7.2057594037928e+16 +0:78 Sequence +0:78 move second child to first child ( temp double) +0:78 'b13' ( temp double) +0:78 Constant: +0:78 7.2057594037928e+16 +0:79 Sequence +0:79 move second child to first child ( temp double) +0:79 'b14' ( temp double) +0:79 Constant: +0:79 7.2057594037928e+16 +0:80 Sequence +0:80 move second child to first child ( temp double) +0:80 'b15' ( temp double) +0:80 Constant: +0:80 7.2057594037928e+16 +0:81 Sequence +0:81 move second child to first child ( temp double) +0:81 'b21' ( temp double) +0:81 Constant: +0:81 9.2233720368548e+18 +0:82 Sequence +0:82 move second child to first child ( temp double) +0:82 'b22' ( temp double) +0:82 Constant: +0:82 9.2233720368548e+18 +0:83 Sequence +0:83 move second child to first child ( temp double) +0:83 'b23' ( temp double) +0:83 Constant: +0:83 9.2233720368548e+18 +0:84 Sequence +0:84 move second child to first child ( temp double) +0:84 'b24' ( temp double) +0:84 Constant: +0:84 9.2233720368548e+18 +0:85 Sequence +0:85 move second child to first child ( temp double) +0:85 'b25' ( temp double) +0:85 Constant: +0:85 9.2233720368548e+18 +0:86 Sequence +0:86 move second child to first child ( temp double) +0:86 'b31' ( temp double) +0:86 Constant: +0:86 1.0141204801826e+31 +0:87 Sequence +0:87 move second child to first child ( temp double) +0:87 'b32' ( temp double) +0:87 Constant: +0:87 1.0141204801826e+31 +0:88 Sequence +0:88 move second child to first child ( temp double) +0:88 'b33' ( temp double) +0:88 Constant: +0:88 1.0141204801826e+31 +0:89 Sequence +0:89 move second child to first child ( temp double) +0:89 'b34' ( temp double) +0:89 Constant: +0:89 1.0141204801826e+31 +0:90 Sequence +0:90 move second child to first child ( temp double) +0:90 'b35' ( temp double) +0:90 Constant: +0:90 1.0141204801826e+31 +0:91 Sequence +0:91 move second child to first child ( temp double) +0:91 'b41' ( temp double) +0:91 Constant: +0:91 5.7089907708238e+45 +0:92 Sequence +0:92 move second child to first child ( temp double) +0:92 'b42' ( temp double) +0:92 Constant: +0:92 5.7089907708238e+45 +0:93 Sequence +0:93 move second child to first child ( temp double) +0:93 'b43' ( temp double) +0:93 Constant: +0:93 5.7089907708238e+45 +0:94 Sequence +0:94 move second child to first child ( temp double) +0:94 'b44' ( temp double) +0:94 Constant: +0:94 5.7089907708238e+45 +0:95 Sequence +0:95 move second child to first child ( temp double) +0:95 'b45' ( temp double) +0:95 Constant: +0:95 5.7089907708238e+45 +0:97 Sequence +0:97 move second child to first child ( temp float) +0:97 'pi1' ( temp float) +0:97 Constant: +0:97 3.141593 +0:98 Sequence +0:98 move second child to first child ( temp float) +0:98 'pi2' ( temp float) +0:98 Constant: +0:98 3.141593 +0:99 Sequence +0:99 move second child to first child ( temp float) +0:99 'pi3' ( temp float) +0:99 Constant: +0:99 3.141593 +0:101 Sequence +0:101 move second child to first child ( temp double) +0:101 'dpi1' ( temp double) +0:101 Constant: +0:101 3.141593 +0:102 Sequence +0:102 move second child to first child ( temp double) +0:102 'dpi2' ( temp double) +0:102 Constant: +0:102 3.141593 +0:103 Sequence +0:103 move second child to first child ( temp double) +0:103 'dpi3' ( temp double) +0:103 Constant: +0:103 3.141593 +0:105 Sequence +0:105 move second child to first child ( temp float) +0:105 'dfpi1' ( temp float) +0:105 Constant: +0:105 3.141593 +0:106 Sequence +0:106 move second child to first child ( temp float) +0:106 'dfpi2' ( temp float) +0:106 Constant: +0:106 3.141593 +0:107 Sequence +0:107 move second child to first child ( temp float) +0:107 'dfpi3' ( temp float) +0:107 Constant: +0:107 3.141593 +0:109 Sequence +0:109 move second child to first child ( temp double) +0:109 'lfpi1' ( temp double) +0:109 Constant: +0:109 3.141593 +0:110 Sequence +0:110 move second child to first child ( temp double) +0:110 'lfpi2' ( temp double) +0:110 Constant: +0:110 3.141593 +0:111 Sequence +0:111 move second child to first child ( temp double) +0:111 'lfpi3' ( temp double) +0:111 Constant: +0:111 3.141593 +0:113 Sequence +0:113 move second child to first child ( temp double) +0:113 'hfpi1' ( temp double) +0:113 Constant: +0:113 3.141593 +0:114 Sequence +0:114 move second child to first child ( temp double) +0:114 'hfpi2' ( temp double) +0:114 Constant: +0:114 3.141593 +0:115 Sequence +0:115 move second child to first child ( temp double) +0:115 'hfpi3' ( temp double) +0:115 Constant: +0:115 3.141593 +0:? Linker Objects +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + + +Linked vertex stage: + + +Shader version: 460 +Requested GL_KHX_shader_explicit_arithmetic_types_float16 +0:? Sequence +0:3 Function Definition: main( ( global void) +0:3 Function Parameters: +0:5 Sequence +0:5 Sequence +0:5 move second child to first child ( temp float) +0:5 'w1' ( temp float) +0:5 Constant: +0:5 0.000000 +0:6 Sequence +0:6 move second child to first child ( temp float) +0:6 'w2' ( temp float) +0:6 Constant: +0:6 1.000000 +0:7 Sequence +0:7 move second child to first child ( temp float) +0:7 'w3' ( temp float) +0:7 Constant: +0:7 7.000000 +0:8 Sequence +0:8 move second child to first child ( temp float) +0:8 'w4' ( temp float) +0:8 Constant: +0:8 130000.000000 +0:9 Sequence +0:9 move second child to first child ( temp float) +0:9 'w5' ( temp float) +0:9 Constant: +0:9 123456789.000000 +0:10 Sequence +0:10 move second child to first child ( temp double) +0:10 'w6' ( temp double) +0:10 Constant: +0:10 1.2345678901235e+15 +0:11 Sequence +0:11 move second child to first child ( temp double) +0:11 'w7' ( temp double) +0:11 Constant: +0:11 1.2345678901235e+16 +0:12 Sequence +0:12 move second child to first child ( temp double) +0:12 'w8' ( temp double) +0:12 Constant: +0:12 1.2345678901235e+17 +0:13 Sequence +0:13 move second child to first child ( temp double) +0:13 'w9' ( temp double) +0:13 Constant: +0:13 1.2345678901235e+19 +0:14 Sequence +0:14 move second child to first child ( temp double) +0:14 'w10' ( temp double) +0:14 Constant: +0:14 1.2345678901235e+24 +0:16 Sequence +0:16 move second child to first child ( temp float) +0:16 'e1' ( temp float) +0:16 Constant: +0:16 0.000000 +0:17 Sequence +0:17 move second child to first child ( temp float) +0:17 'e2' ( temp float) +0:17 Constant: +0:17 1.000000 +0:18 Sequence +0:18 move second child to first child ( temp float) +0:18 'e3' ( temp float) +0:18 Constant: +0:18 0.000000 +0:19 Sequence +0:19 move second child to first child ( temp float) +0:19 'e4' ( temp float) +0:19 Constant: +0:19 1.0000000000000e+15 +0:20 Sequence +0:20 move second child to first child ( temp float) +0:20 'e5' ( temp float) +0:20 Constant: +0:20 1.0000000000000e+16 +0:21 Sequence +0:21 move second child to first child ( temp float) +0:21 'e6' ( temp float) +0:21 Constant: +0:21 0.000000 +0:22 Sequence +0:22 move second child to first child ( temp float) +0:22 'e7' ( temp float) +0:22 Constant: +0:22 1.0000000000000e-15 +0:23 Sequence +0:23 move second child to first child ( temp float) +0:23 'e8' ( temp float) +0:23 Constant: +0:23 1.0000000000000e-16 +0:24 Sequence +0:24 move second child to first child ( temp double) +0:24 'e9' ( temp double) +0:24 Constant: +0:24 1.0000000000000e+100 +0:25 Sequence +0:25 move second child to first child ( temp double) +0:25 'e10' ( temp double) +0:25 Constant: +0:25 1.0000000000000e+308 +0:26 Sequence +0:26 move second child to first child ( temp double) +0:26 'e11' ( temp double) +0:26 Constant: +0:26 1.0000000000000e-307 +0:27 Sequence +0:27 move second child to first child ( temp double) +0:27 'e12' ( temp double) +0:27 Constant: +0:27 +1.#INF +0:28 Sequence +0:28 move second child to first child ( temp double) +0:28 'e13' ( temp double) +0:28 Constant: +0:28 0.000000 +0:29 Sequence +0:29 move second child to first child ( temp double) +0:29 'e24' ( temp double) +0:29 Constant: +0:29 +1.#INF +0:30 Sequence +0:30 move second child to first child ( temp double) +0:30 'e25' ( temp double) +0:30 Constant: +0:30 0.000000 +0:32 Sequence +0:32 move second child to first child ( temp double) +0:32 'f1' ( temp double) +0:32 Constant: +0:32 0.500000 +0:33 Sequence +0:33 move second child to first child ( temp double) +0:33 'f2' ( temp double) +0:33 Constant: +0:33 0.125000 +0:34 Sequence +0:34 move second child to first child ( temp double) +0:34 'f31' ( temp double) +0:34 Constant: +0:34 0.100000 +0:35 Sequence +0:35 move second child to first child ( temp double) +0:35 'f32' ( temp double) +0:35 Constant: +0:35 0.200000 +0:36 Sequence +0:36 move second child to first child ( temp double) +0:36 'f33' ( temp double) +0:36 Constant: +0:36 0.300000 +0:37 Sequence +0:37 move second child to first child ( temp double) +0:37 'f34' ( temp double) +0:37 Constant: +0:37 0.400000 +0:38 Sequence +0:38 move second child to first child ( temp double) +0:38 'f35' ( temp double) +0:38 Constant: +0:38 0.500000 +0:39 Sequence +0:39 move second child to first child ( temp double) +0:39 'f36' ( temp double) +0:39 Constant: +0:39 0.600000 +0:40 Sequence +0:40 move second child to first child ( temp double) +0:40 'f37' ( temp double) +0:40 Constant: +0:40 0.700000 +0:41 Sequence +0:41 move second child to first child ( temp double) +0:41 'f38' ( temp double) +0:41 Constant: +0:41 0.800000 +0:42 Sequence +0:42 move second child to first child ( temp double) +0:42 'f39' ( temp double) +0:42 Constant: +0:42 0.900000 +0:43 Sequence +0:43 move second child to first child ( temp double) +0:43 'f4' ( temp double) +0:43 Constant: +0:43 0.333333 +0:44 Sequence +0:44 move second child to first child ( temp double) +0:44 'f51' ( temp double) +0:44 Constant: +0:44 7.8347500000000e-37 +0:45 Sequence +0:45 move second child to first child ( temp double) +0:45 'f52' ( temp double) +0:45 Constant: +0:45 7.8347500000000e-37 +0:46 Sequence +0:46 move second child to first child ( temp double) +0:46 'f53' ( temp double) +0:46 Constant: +0:46 7.8347500000000e-37 +0:47 Sequence +0:47 move second child to first child ( temp double) +0:47 'f54' ( temp double) +0:47 Constant: +0:47 7.8347500000000e-37 +0:48 Sequence +0:48 move second child to first child ( temp double) +0:48 'f61' ( temp double) +0:48 Constant: +0:48 4.000000 +0:49 Sequence +0:49 move second child to first child ( temp double) +0:49 'f62' ( temp double) +0:49 Constant: +0:49 40.000000 +0:50 Sequence +0:50 move second child to first child ( temp double) +0:50 'f63' ( temp double) +0:50 Constant: +0:50 0.000000 +0:51 Sequence +0:51 move second child to first child ( temp double) +0:51 'f64' ( temp double) +0:51 Constant: +0:51 4.000000 +0:52 Sequence +0:52 move second child to first child ( temp double) +0:52 'f65' ( temp double) +0:52 Constant: +0:52 0.000000 +0:53 Sequence +0:53 move second child to first child ( temp double) +0:53 'f66' ( temp double) +0:53 Constant: +0:53 0.004000 +0:54 Sequence +0:54 move second child to first child ( temp double) +0:54 'f67' ( temp double) +0:54 Constant: +0:54 0.400000 +0:55 Sequence +0:55 move second child to first child ( temp double) +0:55 'f68' ( temp double) +0:55 Constant: +0:55 0.040000 +0:57 Sequence +0:57 move second child to first child ( temp double) +0:57 'c1' ( temp double) +0:57 Constant: +0:57 0.000810 +0:58 Sequence +0:58 move second child to first child ( temp double) +0:58 'c2' ( temp double) +0:58 Constant: +0:58 7.300000 +0:59 Sequence +0:59 move second child to first child ( temp double) +0:59 'c3' ( temp double) +0:59 Constant: +0:59 3.450000 +0:60 Sequence +0:60 move second child to first child ( temp double) +0:60 'c4' ( temp double) +0:60 Constant: +0:60 0.003570 +0:61 Sequence +0:61 move second child to first child ( temp double) +0:61 'c5' ( temp double) +0:61 Constant: +0:61 439.000000 +0:62 Sequence +0:62 move second child to first child ( temp double) +0:62 'c6' ( temp double) +0:62 Constant: +0:62 522000.000000 +0:63 Sequence +0:63 move second child to first child ( temp double) +0:63 'c7' ( temp double) +0:63 Constant: +0:63 61000000.000000 +0:64 Sequence +0:64 move second child to first child ( temp double) +0:64 'c8' ( temp double) +0:64 Constant: +0:64 0.610000 +0:65 Sequence +0:65 move second child to first child ( temp double) +0:65 'c9' ( temp double) +0:65 Constant: +0:65 1.2345678901235e+18 +0:66 Sequence +0:66 move second child to first child ( temp double) +0:66 'c10' ( temp double) +0:66 Constant: +0:66 1.0000000000000e+21 +0:67 Sequence +0:67 move second child to first child ( temp double) +0:67 'c11' ( temp double) +0:67 Constant: +0:67 1230000.004560 +0:68 Sequence +0:68 move second child to first child ( temp double) +0:68 'c12' ( temp double) +0:68 Constant: +0:68 1230.000004 +0:69 Sequence +0:69 move second child to first child ( temp double) +0:69 'c13' ( temp double) +0:69 Constant: +0:69 123.000000 +0:70 Sequence +0:70 move second child to first child ( temp double) +0:70 'c14' ( temp double) +0:70 Constant: +0:70 102.300000 +0:71 Sequence +0:71 move second child to first child ( temp double) +0:71 'c15' ( temp double) +0:71 Constant: +0:71 1.2003000000456e+12 +0:72 Sequence +0:72 move second child to first child ( temp double) +0:72 'c16' ( temp double) +0:72 Constant: +0:72 123000000456.000000 +0:73 Sequence +0:73 move second child to first child ( temp double) +0:73 'c17' ( temp double) +0:73 Constant: +0:73 1.2300000045600e+12 +0:74 Sequence +0:74 move second child to first child ( temp double) +0:74 'c18' ( temp double) +0:74 Constant: +0:74 1.2300000045601e+12 +0:76 Sequence +0:76 move second child to first child ( temp double) +0:76 'b11' ( temp double) +0:76 Constant: +0:76 7.2057594037928e+16 +0:77 Sequence +0:77 move second child to first child ( temp double) +0:77 'b12' ( temp double) +0:77 Constant: +0:77 7.2057594037928e+16 +0:78 Sequence +0:78 move second child to first child ( temp double) +0:78 'b13' ( temp double) +0:78 Constant: +0:78 7.2057594037928e+16 +0:79 Sequence +0:79 move second child to first child ( temp double) +0:79 'b14' ( temp double) +0:79 Constant: +0:79 7.2057594037928e+16 +0:80 Sequence +0:80 move second child to first child ( temp double) +0:80 'b15' ( temp double) +0:80 Constant: +0:80 7.2057594037928e+16 +0:81 Sequence +0:81 move second child to first child ( temp double) +0:81 'b21' ( temp double) +0:81 Constant: +0:81 9.2233720368548e+18 +0:82 Sequence +0:82 move second child to first child ( temp double) +0:82 'b22' ( temp double) +0:82 Constant: +0:82 9.2233720368548e+18 +0:83 Sequence +0:83 move second child to first child ( temp double) +0:83 'b23' ( temp double) +0:83 Constant: +0:83 9.2233720368548e+18 +0:84 Sequence +0:84 move second child to first child ( temp double) +0:84 'b24' ( temp double) +0:84 Constant: +0:84 9.2233720368548e+18 +0:85 Sequence +0:85 move second child to first child ( temp double) +0:85 'b25' ( temp double) +0:85 Constant: +0:85 9.2233720368548e+18 +0:86 Sequence +0:86 move second child to first child ( temp double) +0:86 'b31' ( temp double) +0:86 Constant: +0:86 1.0141204801826e+31 +0:87 Sequence +0:87 move second child to first child ( temp double) +0:87 'b32' ( temp double) +0:87 Constant: +0:87 1.0141204801826e+31 +0:88 Sequence +0:88 move second child to first child ( temp double) +0:88 'b33' ( temp double) +0:88 Constant: +0:88 1.0141204801826e+31 +0:89 Sequence +0:89 move second child to first child ( temp double) +0:89 'b34' ( temp double) +0:89 Constant: +0:89 1.0141204801826e+31 +0:90 Sequence +0:90 move second child to first child ( temp double) +0:90 'b35' ( temp double) +0:90 Constant: +0:90 1.0141204801826e+31 +0:91 Sequence +0:91 move second child to first child ( temp double) +0:91 'b41' ( temp double) +0:91 Constant: +0:91 5.7089907708238e+45 +0:92 Sequence +0:92 move second child to first child ( temp double) +0:92 'b42' ( temp double) +0:92 Constant: +0:92 5.7089907708238e+45 +0:93 Sequence +0:93 move second child to first child ( temp double) +0:93 'b43' ( temp double) +0:93 Constant: +0:93 5.7089907708238e+45 +0:94 Sequence +0:94 move second child to first child ( temp double) +0:94 'b44' ( temp double) +0:94 Constant: +0:94 5.7089907708238e+45 +0:95 Sequence +0:95 move second child to first child ( temp double) +0:95 'b45' ( temp double) +0:95 Constant: +0:95 5.7089907708238e+45 +0:97 Sequence +0:97 move second child to first child ( temp float) +0:97 'pi1' ( temp float) +0:97 Constant: +0:97 3.141593 +0:98 Sequence +0:98 move second child to first child ( temp float) +0:98 'pi2' ( temp float) +0:98 Constant: +0:98 3.141593 +0:99 Sequence +0:99 move second child to first child ( temp float) +0:99 'pi3' ( temp float) +0:99 Constant: +0:99 3.141593 +0:101 Sequence +0:101 move second child to first child ( temp double) +0:101 'dpi1' ( temp double) +0:101 Constant: +0:101 3.141593 +0:102 Sequence +0:102 move second child to first child ( temp double) +0:102 'dpi2' ( temp double) +0:102 Constant: +0:102 3.141593 +0:103 Sequence +0:103 move second child to first child ( temp double) +0:103 'dpi3' ( temp double) +0:103 Constant: +0:103 3.141593 +0:105 Sequence +0:105 move second child to first child ( temp float) +0:105 'dfpi1' ( temp float) +0:105 Constant: +0:105 3.141593 +0:106 Sequence +0:106 move second child to first child ( temp float) +0:106 'dfpi2' ( temp float) +0:106 Constant: +0:106 3.141593 +0:107 Sequence +0:107 move second child to first child ( temp float) +0:107 'dfpi3' ( temp float) +0:107 Constant: +0:107 3.141593 +0:109 Sequence +0:109 move second child to first child ( temp double) +0:109 'lfpi1' ( temp double) +0:109 Constant: +0:109 3.141593 +0:110 Sequence +0:110 move second child to first child ( temp double) +0:110 'lfpi2' ( temp double) +0:110 Constant: +0:110 3.141593 +0:111 Sequence +0:111 move second child to first child ( temp double) +0:111 'lfpi3' ( temp double) +0:111 Constant: +0:111 3.141593 +0:113 Sequence +0:113 move second child to first child ( temp double) +0:113 'hfpi1' ( temp double) +0:113 Constant: +0:113 3.141593 +0:114 Sequence +0:114 move second child to first child ( temp double) +0:114 'hfpi2' ( temp double) +0:114 Constant: +0:114 3.141593 +0:115 Sequence +0:115 move second child to first child ( temp double) +0:115 'hfpi3' ( temp double) +0:115 Constant: +0:115 3.141593 +0:? Linker Objects +0:? 'gl_VertexID' ( gl_VertexId int VertexId) +0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/test.conf b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/test.conf index f156c5c6d5c..cff77168ab2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/test.conf +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/test.conf @@ -81,6 +81,15 @@ MaxTransformFeedbackInterleavedComponents 64 MaxCullDistances 8 MaxCombinedClipAndCullDistances 8 MaxSamples 4 +MaxMeshOutputVerticesNV 256 +MaxMeshOutputPrimitivesNV 512 +MaxMeshWorkGroupSizeX_NV 32 +MaxMeshWorkGroupSizeY_NV 1 +MaxMeshWorkGroupSizeZ_NV 1 +MaxTaskWorkGroupSizeX_NV 32 +MaxTaskWorkGroupSizeY_NV 1 +MaxTaskWorkGroupSizeZ_NV 1 +MaxMeshViewCountNV 4 nonInductiveForLoops 1 whileLoops 1 doWhileLoops 1 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/tokenLength.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/tokenLength.vert.out index c4738585c5b..8c31da9212a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/tokenLength.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/tokenLength.vert.out @@ -51,7 +51,7 @@ ERROR: node is still EOpNull! 0:13 move second child to first child ( temp highp int) 0:13 'OE' ( global highp int) 0:13 Constant: -0:13 1073741823 (const int) +0:13 -1 (const int) 0:14 Sequence 0:14 move second child to first child ( temp highp int) 0:14 'HE' ( global highp int) @@ -92,7 +92,7 @@ ERROR: node is still EOpNull! 0:34 move second child to first child ( temp highp int) 0:34 'superO' ( global highp int) 0:34 Constant: -0:34 1073741823 (const int) +0:34 -1 (const int) 0:35 Sequence 0:35 move second child to first child ( temp highp int) 0:35 'superI' ( global highp int) @@ -147,7 +147,7 @@ ERROR: node is still EOpNull! 0:13 move second child to first child ( temp highp int) 0:13 'OE' ( global highp int) 0:13 Constant: -0:13 1073741823 (const int) +0:13 -1 (const int) 0:14 Sequence 0:14 move second child to first child ( temp highp int) 0:14 'HE' ( global highp int) @@ -188,7 +188,7 @@ ERROR: node is still EOpNull! 0:34 move second child to first child ( temp highp int) 0:34 'superO' ( global highp int) 0:34 Constant: -0:34 1073741823 (const int) +0:34 -1 (const int) 0:35 Sequence 0:35 move second child to first child ( temp highp int) 0:35 'superI' ( global highp int) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsClean.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsClean.vert.out index eb2e07b36fb..4b098be72da 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsClean.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsClean.vert.out @@ -6,7 +6,7 @@ Shader version: 420 0:42 Sequence 0:42 move second child to first child ( temp 4-component vector of float) 0:42 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -0:42 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:42 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:42 Constant: 0:42 0 (const uint) 0:42 Construct vec4 ( temp 4-component vector of float) @@ -16,7 +16,7 @@ Shader version: 420 0:? Linker Objects 0:? 'color' ( in 3-component vector of float) 0:? 'foo' ( uniform sampler2DRect) -0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsErrors.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsErrors.vert.out index f11e0114f67..6551364e9af 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsErrors.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/versionsErrors.vert.out @@ -13,7 +13,7 @@ ERROR: node is still EOpNull! 0:44 Sequence 0:44 move second child to first child ( temp 4-component vector of float) 0:44 gl_Position: direct index for structure ( gl_Position 4-component vector of float Position) -0:44 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:44 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:44 Constant: 0:44 0 (const uint) 0:44 Construct vec4 ( temp 4-component vector of float) @@ -24,7 +24,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects 0:? 'color' ( in 3-component vector of float) 0:? 'foo' ( uniform sampler2DRect) -0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out implicitly-sized array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out implicitly-sized array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) +0:? 'anon@0' ( out block{ gl_Position 4-component vector of float Position gl_Position, gl_PointSize float PointSize gl_PointSize, out unsized 1-element array of float ClipDistance gl_ClipDistance, gl_ClipVertex 4-component vector of float ClipVertex gl_ClipVertex, out 4-component vector of float FrontColor gl_FrontColor, out 4-component vector of float BackColor gl_BackColor, out 4-component vector of float FrontSecondaryColor gl_FrontSecondaryColor, out 4-component vector of float BackSecondaryColor gl_BackSecondaryColor, out unsized 1-element array of 4-component vector of float TexCoord gl_TexCoord, out float FogFragCoord gl_FogFragCoord}) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out index 0712e07106b..72a45705eec 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out @@ -258,7 +258,7 @@ Shader version: 450 0:? 2 (const int) // Module Version 10000 -// Generated by (magic number): 80002 +// Generated by (magic number): 80007 // Id's are bound by 50 Capability Shader diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.frag.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.frag.out index 0440cf494d3..c81ed25a612 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.frag.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.frag.out @@ -1,4 +1,11 @@ vulkan.frag +ERROR: 0:3: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:4: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:5: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:6: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:8: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:9: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:10: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:14: 'sampler2D' : sampler-constructor requires two arguments ERROR: 0:15: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type ERROR: 0:16: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type @@ -8,19 +15,23 @@ ERROR: 0:19: 'sampler2D' : sampler-constructor second argument must be a scalar ERROR: 0:21: 'sampler3D' : sampler-constructor cannot make an array of samplers ERROR: 0:22: 'sampler2D' : sampler-constructor first argument must be a scalar textureXXX type ERROR: 0:23: 'sampler2D' : sampler-constructor first argument must match type and dimensionality of constructor type -ERROR: 0:24: 'sampler2D' : sampler-constructor second argument presence of shadow must match constructor presence of shadow -ERROR: 0:25: 'sampler2DShadow' : sampler-constructor second argument presence of shadow must match constructor presence of shadow ERROR: 0:28: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: s2D ERROR: 0:29: 'sampler3D' : sampler-constructor cannot make an array of samplers ERROR: 0:29: 'sampler3D' : sampler/image types can only be used in uniform variables or function parameters: s3d ERROR: 0:29: '=' : cannot convert from ' const float' to ' global 4-element array of highp sampler3D' +ERROR: 0:31: 'location' : SPIR-V requires location for user input/output ERROR: 0:39: 'push_constant' : can only be used with a uniform ERROR: 0:43: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan ERROR: 0:43: 'push_constant' : can only be used with a block ERROR: 0:45: 'push_constant' : cannot declare a default, can only be used on a block +ERROR: 0:51: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:52: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:52: 'input_attachment_index' : can only be used with a subpass +ERROR: 0:53: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:53: 'input_attachment_index' : can only be used with a subpass +ERROR: 0:54: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:54: 'subpass' : requires an input_attachment_index layout qualifier +ERROR: 0:55: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:60: 'subpassLoadMS' : no matching overloaded function found ERROR: 0:61: 'subpassLoad' : no matching overloaded function found ERROR: 0:63: 'subpassLoadMS' : no matching overloaded function found @@ -43,7 +54,7 @@ ERROR: 0:101: 'noise1' : no matching overloaded function found ERROR: 0:102: 'noise2' : no matching overloaded function found ERROR: 0:103: 'noise3' : no matching overloaded function found ERROR: 0:104: 'noise4' : no matching overloaded function found -ERROR: 42 compilation errors. No code generated. +ERROR: 53 compilation errors. No code generated. ERROR: Linking fragment stage: Only one push_constant block is allowed per stage diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.vert.out b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.vert.out index 0b2ea5309c5..19fdade554f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.vert.out +++ b/3rdparty/bgfx/3rdparty/glslang/Test/baseResults/vulkan.vert.out @@ -1,12 +1,20 @@ vulkan.vert ERROR: 0:3: 'subpass input' : not supported in this stage: vertex +ERROR: 0:3: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:4: 'subpass input' : not supported in this stage: vertex +ERROR: 0:4: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:5: 'subpass input' : not supported in this stage: vertex +ERROR: 0:5: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:6: 'subpass input' : not supported in this stage: vertex +ERROR: 0:6: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:7: 'subpass input' : not supported in this stage: vertex +ERROR: 0:7: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:8: 'subpass input' : not supported in this stage: vertex +ERROR: 0:8: 'binding' : sampler/texture/image requires layout(binding=X) +ERROR: 0:10: 'location' : SPIR-V requires location for user input/output ERROR: 0:12: 'constant_id' : can only be applied to a scalar ERROR: 0:13: 'constant_id' : specialization-constant id already used +ERROR: 0:13: 'binding' : sampler/texture/image requires layout(binding=X) ERROR: 0:13: 'constant_id' : can only be applied to 'const'-qualified scalar ERROR: 0:13: 'constant_id' : cannot be applied to this type ERROR: 0:14: 'constant_id' : specialization-constant id is too large @@ -26,7 +34,10 @@ ERROR: 0:49: '[]' : only outermost dimension of an array of arrays can be a spec ERROR: 0:50: '[]' : only outermost dimension of an array of arrays can be a specialization constant ERROR: 0:51: '[]' : only outermost dimension of an array of arrays can be a specialization constant ERROR: 0:54: '[]' : only outermost dimension of an array of arrays can be a specialization constant -ERROR: 27 compilation errors. No code generated. +ERROR: 0:54: 'location' : SPIR-V requires location for user input/output +ERROR: 0:58: 'location' : SPIR-V requires location for user input/output +ERROR: 0:65: 'location' : overlapping use of location 10 +ERROR: 38 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/bump b/3rdparty/bgfx/3rdparty/glslang/Test/bump index f23be33b627..03df6327b73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/bump +++ b/3rdparty/bgfx/3rdparty/glslang/Test/bump @@ -1,2 +1,3 @@ +#!/usr/bin/env bash cp localResults/* baseResults/ diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/compoundsuffix.frag.hlsl b/3rdparty/bgfx/3rdparty/glslang/Test/compoundsuffix.frag.hlsl new file mode 100644 index 00000000000..59322acda08 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/compoundsuffix.frag.hlsl @@ -0,0 +1,6 @@ +void main(out float4 fragColor : SV_TARGET0) +{ + fragColor = 1; +} + + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/compoundsuffix.vert.glsl b/3rdparty/bgfx/3rdparty/glslang/Test/compoundsuffix.vert.glsl new file mode 100644 index 00000000000..26862fff150 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/compoundsuffix.vert.glsl @@ -0,0 +1,4 @@ +void main() +{ + gl_Position = vec4(1.0); +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/constFold.frag b/3rdparty/bgfx/3rdparty/glslang/Test/constFold.frag index 730607885cc..daecaa2af7b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/constFold.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/constFold.frag @@ -81,7 +81,7 @@ void foo() a[0] = s.m[1].z; // 7.0 b % 0; // int b / 0; - e / 0; + e / 0; -e / 0; 0.0 / 0.0; const uint ua = 5; const uvec2 ub = uvec2(6, 7); const uint uc = 8; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/constantUnaryConversion.comp b/3rdparty/bgfx/3rdparty/glslang/Test/constantUnaryConversion.comp new file mode 100644 index 00000000000..467b6f6c25b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/constantUnaryConversion.comp @@ -0,0 +1,48 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types : require + +const bool bool_init = true; +const int8_t int8_t_init = int8_t(-1); +const int16_t int16_t_init = int16_t(-2); +const int32_t int32_t_init = int32_t(-3); +const int64_t int64_t_init = int64_t(-4); +const uint8_t uint8_t_init = uint8_t(1); +const uint16_t uint16_t_init = uint16_t(2); +const uint32_t uint32_t_init = uint32_t(3); +const uint64_t uint64_t_init = uint64_t(4); +const float16_t float16_t_init = float16_t(42.0); +const float32_t float32_t_init = float32_t(13.0); +const float64_t float64_t_init = float64_t(-4.0); + +#define TYPE_TO_TYPE(x, y) \ + const x y##_to_##x = x(y##_init) + +#define TYPE_TO(x) \ + TYPE_TO_TYPE(x, bool); \ + TYPE_TO_TYPE(x, int8_t); \ + TYPE_TO_TYPE(x, int16_t); \ + TYPE_TO_TYPE(x, int32_t); \ + TYPE_TO_TYPE(x, int64_t); \ + TYPE_TO_TYPE(x, uint8_t); \ + TYPE_TO_TYPE(x, uint16_t); \ + TYPE_TO_TYPE(x, uint32_t); \ + TYPE_TO_TYPE(x, uint64_t); \ + TYPE_TO_TYPE(x, float16_t); \ + TYPE_TO_TYPE(x, float32_t); \ + TYPE_TO_TYPE(x, float64_t) + +TYPE_TO(bool); +TYPE_TO(int8_t); +TYPE_TO(int16_t); +TYPE_TO(int32_t); +TYPE_TO(int64_t); +TYPE_TO(uint8_t); +TYPE_TO(uint16_t); +TYPE_TO(uint32_t); +TYPE_TO(uint64_t); +TYPE_TO(float16_t); +TYPE_TO(float32_t); +TYPE_TO(float64_t); + +void main() {} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/cppBad.vert b/3rdparty/bgfx/3rdparty/glslang/Test/cppBad.vert index 49600f91670..0044c44fce0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/cppBad.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/cppBad.vert @@ -1,5 +1,5 @@ #define m#0# #if m - +#endif #define n() int n" \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/cppPassMacroName.frag b/3rdparty/bgfx/3rdparty/glslang/Test/cppPassMacroName.frag index f42d9de6d5b..046629f2c6c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/cppPassMacroName.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/cppPassMacroName.frag @@ -2,6 +2,10 @@ #define I2(f, n) f(n) + f(n+1) #define I3(f, n) I2(f, n) + f(n+2) +#define FL_f1(i) ((i)*(i)) +#define FL_I2(f, n) f(n) + f(n+0.2) +#define FL_I3(f, n) FL_I2(f, n) + f(n+0.5) + void main() { int f1 = 4; @@ -9,4 +13,18 @@ void main() int f3 = f1(3); int f4 = I2(f1, 0); int f5 = I3(f1, 0); + + highp float fl_f5 = FL_I3(FL_f1, 0.1); } + +// f5 = I3(f1, 0) +// = I2(f1, 0) + f1(0 + 2) +// = f1(0) + f1(0+1) + f1(0+2) +// = 0*0 + 1*1 + 2*2 +// = 5 + +// fl_f5 = FL_I3(FL_f1, 0.1) +// = FL_I2(FL_f1, 0.1) + FL_f1(0.1 + 0.5) +// = FL_f1(0.1) + FL_f1(0.1 + 0.2) + FL_f1(0.1 + 0.5) +// = 0.1*0.1 + 0.3*0.3 + 0.6*0.6 +// = 0.46 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/cppRelaxSkipTokensErrors.vert b/3rdparty/bgfx/3rdparty/glslang/Test/cppRelaxSkipTokensErrors.vert new file mode 100644 index 00000000000..b30af0c9f96 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/cppRelaxSkipTokensErrors.vert @@ -0,0 +1,14 @@ +#version 110 + +#if 0 +3.5L +3.5h +2034h +1.#INF +0x1234567812345L +12323394203923879234L +0123s; +123s; +0123456712345671234L +"string" +#endif diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/cppSimple.vert b/3rdparty/bgfx/3rdparty/glslang/Test/cppSimple.vert index fdd14221b63..2f7de30f7a3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/cppSimple.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/cppSimple.vert @@ -170,7 +170,7 @@ int a = length("aoenatuh"); // ERROR // ERROR #define m4(b) -#define m4 (b) +#define m4 // ERROR #define m5 (b) @@ -178,7 +178,7 @@ int a = length("aoenatuh"); // ERROR // ERROR #define m6(a) -#define m6 +#define m6(a,b) // ERROR (whitespace) #define m7 (a) diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/findFunction.frag b/3rdparty/bgfx/3rdparty/glslang/Test/findFunction.frag new file mode 100644 index 00000000000..7e180650b00 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/findFunction.frag @@ -0,0 +1,46 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable + +int64_t func(int8_t a, int16_t b, int16_t c) +{ + return int64_t(a | b + c); +} + +int64_t func(int8_t a, int16_t b, int32_t c) +{ + return int64_t(a | b - c); +} + +int64_t func(int32_t a, int32_t b, int32_t c) +{ + return int64_t(a / b + c); +} + +int64_t func(float16_t a, float16_t b, float32_t c) +{ + return int64_t(a - b * c); +} + +int64_t func(float16_t a, int16_t b, float32_t c) +{ + return int64_t(a - b * c); +} + +void main() +{ + int8_t x; + int16_t y; + int32_t z; + int64_t w; + float16_t f16; + float64_t f64; + int64_t b1 = func(x, y, z); + int64_t b2 = func(y, y, z); // tie + int64_t b3 = func(y, y, w); // No match + int64_t b4 = func(y, z, f16); // No match + int64_t b5 = func(y, y, f16); + int64_t b7 = func(f16, f16, y); + int64_t b8 = func(f16, f16, f64); // No match + int64_t b9 = func(f16, x, f16); // tie +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/glspv.frag b/3rdparty/bgfx/3rdparty/glslang/Test/glspv.frag index 86c9f6aba64..7a73cb8d9a4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/glspv.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/glspv.frag @@ -11,10 +11,10 @@ void main() { } -uniform float f; // ERROR, no location +uniform float f; // ERROR, no location layout(location = 2) uniform float g; -uniform sampler2D s1; -layout(location = 3) uniform sampler2D s2; +uniform sampler2D s1; // ERROR, no binding +layout(location = 3) uniform sampler2D s2; // ERROR, no binding void noise() { @@ -24,4 +24,5 @@ void noise() noise4(1); } +uniform atomic_uint atomic; // ERROR, no binding layout(input_attachment_index = 1) uniform subpassInput sub; // ERROR, no inputs diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/glspv.vert b/3rdparty/bgfx/3rdparty/glslang/Test/glspv.vert index d2724ca2835..b44814653a0 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/glspv.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/glspv.vert @@ -5,8 +5,8 @@ layout(push_constant) uniform Material { int a; } mat; // ERROR, can' layout(set = 0, binding = 0, std140) uniform Bt1 { int a; } bt1; layout(set = 1, binding = 0, std140) uniform Bt2 { int a; } bt2; // ERROR, set has to be 0 -layout(shared) uniform Bt3 { int a; } bt3; // ERROR, no shared -layout(packed) uniform Bt4 { int a; } bt4; // ERROR, no shared +layout(shared) uniform Bt3 { int a; } bt3; // ERROR, no shared, no binding +layout(packed) uniform Bt4 { int a; } bt4; // ERROR, no shared, no binding void main() { diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.PointSize.geom b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.PointSize.geom new file mode 100644 index 00000000000..ef66fc89143 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.PointSize.geom @@ -0,0 +1,11 @@ +struct S { + [[vk::builtin("PointSize")]] float ps : PSIZE; +}; + +[maxvertexcount(4)] +void main([[vk::builtin("PointSize")]] triangle in uint ps[3], + inout LineStream OutputStream) +{ + S s; + OutputStream.Append(s); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.PointSize.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.PointSize.vert new file mode 100644 index 00000000000..4b357e073fe --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.PointSize.vert @@ -0,0 +1,4 @@ +[[vk::builtin("PointSize")]] float main() +{ + return 2.3; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.attributeC11.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.attributeC11.frag index 4fe663a2a4f..336511f9283 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.attributeC11.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.attributeC11.frag @@ -11,8 +11,12 @@ StructuredBuffer buffer3; [[vk::input_attachment_index(4)]] Texture2D attach; +[[vk::constant_id(13)]] const int ci = 11; + +[[vk::push_constant]] cbuffer pcBuf { int a; }; + [[vk::location(7)]] float4 main([[vk::location(8)]] float4 input: A) : B { - return input + attach.Load(float2(0.5)); + return input + attach.Load(float2(0.5));// * a; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.boolConv.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.boolConv.vert index 7efe20b0ae5..6182b296411 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.boolConv.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.boolConv.vert @@ -1,20 +1,20 @@ -static bool a, b = true; -float4 main() : SV_Position -{ - int r = 0; - - r += a + b; - r += a - b; - r += a * b; - r += a / b; - r += a % b; - - r += a & b; - r += a | b; - r += a ^ b; - - r += a << b; - r += a >> b; - - return r; -} \ No newline at end of file +static bool a, b = true; +float4 main() : SV_Position +{ + int r = 0; + + r += a + b; + r += a - b; + r += a * b; + r += a / b; + r += a % b; + + r += a & b; + r += a | b; + r += a ^ b; + + r += a << b; + r += a >> b; + + return r; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.buffer.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.buffer.frag index 520de09e855..73f42e8f01e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.buffer.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.buffer.frag @@ -31,7 +31,17 @@ float foo() // float looks like identifier, but can't be part of tbuffer return 1.0; } -float4 PixelShaderFunction(float4 input : SV_POSITION) : SV_TARGET0 -{ - return (input + v1 + v2 + v3 + v4) * foo(); +struct id { + float4 a; +}; + +cbuffer cbufName2 { + float4 v24; +} + +id PixelShaderFunction(float4 input : SV_POSITION) : SV_TARGET0 // id looks like id for cbuffer name, but can't be +{ + id ret; + ret.a = v24 + (input + v1 + v2 + v3 + v4) * foo(); + return ret; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.cbuffer-identifier.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.cbuffer-identifier.vert new file mode 100644 index 00000000000..8362f5cace8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.cbuffer-identifier.vert @@ -0,0 +1,32 @@ + +cbuffer ConstantBuffer : register( b0 ) +{ + matrix World; + matrix View; + matrix Projection; +}; + +struct VS_INPUT +{ + float4 Pos : POSITION; + float3 Norm : NORMAL; +}; + +struct PS_INPUT +{ + float4 Pos : SV_POSITION; + float3 Norm : TEXCOORD0; +}; + +PS_INPUT main( VS_INPUT input ) +{ + int ConstantBuffer = 42; // test ConstantBuffer as an identifier + + PS_INPUT output = (PS_INPUT)0; + output.Pos = mul( input.Pos, World ); + output.Pos = mul( output.Pos, View ); + output.Pos = mul( output.Pos, Projection ); + output.Norm = mul( input.Norm, World ); // Work when output.Norm = mul( input.Norm, (float3x3)World ); + + return output; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.color.hull.tesc b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.color.hull.tesc new file mode 100644 index 00000000000..73d9ad0340f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.color.hull.tesc @@ -0,0 +1,74 @@ +///////////// +// GLOBALS // +///////////// +cbuffer TessellationBuffer : register(b0) +{ + float tessellationAmount; + float3 padding; +}; + + +////////////// +// TYPEDEFS // +////////////// +struct HullInputType +{ + float3 position : POSITION; + float4 color : COLOR; +}; + +struct ConstantOutputType +{ + float edges[3] : SV_TessFactor; + float inside : SV_InsideTessFactor; +}; + +struct HullOutputType +{ + float3 position : POSITION; + float4 color : COLOR; +}; + + +//////////////////////////////////////////////////////////////////////////////// +// Patch Constant Function +//////////////////////////////////////////////////////////////////////////////// +ConstantOutputType ColorPatchConstantFunction(InputPatch inputPatch, uint patchId : SV_PrimitiveID) +{ + ConstantOutputType output; + + + // Set the tessellation factors for the three edges of the triangle. + output.edges[0] = tessellationAmount; + output.edges[1] = tessellationAmount; + output.edges[2] = tessellationAmount; + + // Set the tessellation factor for tessallating inside the triangle. + output.inside = tessellationAmount; + + return output; +} + + +//////////////////////////////////////////////////////////////////////////////// +// Hull Shader +//////////////////////////////////////////////////////////////////////////////// +[domain("tri")] +[partitioning("integer")] +[outputtopology("triangle_cw")] +[outputcontrolpoints(3)] +[patchconstantfunc("ColorPatchConstantFunction")] + +HullOutputType main(InputPatch patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID) +{ + HullOutputType output; + + // Set the position for this control point as the output position. + output.position = patch[pointId].position; + + // Set the input color as the output color. + output.color = patch[pointId].color; + + return output; +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.coverage.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.coverage.frag new file mode 100644 index 00000000000..c6cd0194de3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.coverage.frag @@ -0,0 +1,20 @@ + +// Verify that coverage mask is an array, as required by SPIR-V. + +struct PS_INPUT +{ +}; + +struct PS_OUTPUT +{ + float4 vColor : SV_Target0; + uint nCoverageMask : SV_Coverage; +}; + +PS_OUTPUT main( PS_INPUT i ) +{ + PS_OUTPUT o; + o.vColor = float4(1.0, 0.0, 0.0, 1.0); + o.nCoverageMask = 0; + return o; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert index bcf39ceb697..9ed8bc7a2c1 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert @@ -17,7 +17,11 @@ FxaaTex fillOpaque() float4 main() : SV_TARGET0 { FxaaTex tex1 = { g_tInputTexture_sampler, g_tInputTexture }; + float4 res = lookUp(tex1); FxaaTex tex2 = fillOpaque(); + res += lookUp(tex2); FxaaTex tex3 = tex1; - return lookUp(tex3); + res += lookUp(tex3); + + return res; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.groupid.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.groupid.comp new file mode 100644 index 00000000000..e5b0de4260c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.groupid.comp @@ -0,0 +1,9 @@ +RWTexture2D < float4 > OutputTexture; + +// Test conversion between SPIR-V required uint3 group id, and sub-vec3 shader declaration. + +[ numthreads ( 8 , 8 , 1 ) ] +void main ( uint2 vGroupId : SV_GroupID ) +{ + OutputTexture[ vGroupId . xy ] = float4(1.0, 0.0, 0.0, 1.0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.imagefetch-subvec4.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.imagefetch-subvec4.comp new file mode 100644 index 00000000000..2a83dd27ca6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.imagefetch-subvec4.comp @@ -0,0 +1,8 @@ +Texture3D IN: register(t0); +RWTexture3D OUT: register(u1); + +[numthreads(8,8,8)] +void main(uint3 tid: SV_DispatchThreadID) +{ + OUT[tid] = IN[tid]; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.int.dot.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.int.dot.frag new file mode 100644 index 00000000000..c293dc14b8e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.int.dot.frag @@ -0,0 +1,14 @@ +float4 main() : SV_Target { + int i = 1; + int1 i2 = 2; + int2 i3 = 3; + int3 i4 = 4; + int4 i5 = 5; + + i = dot(i, i); + i2 = dot(i2, i2); + i3 = dot(i3, i3); + i4 = dot(i4, i4); + i5 = dot(i5, i5); + return i + i2.xxxx + i3.xyxy + i4.xyzx + i5; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.intrinsics.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.intrinsics.frag index 9343f6d8cfe..ffa3c254362 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.intrinsics.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.intrinsics.frag @@ -13,7 +13,7 @@ groupshared uint4 gs_ua4; groupshared uint4 gs_ub4; groupshared uint4 gs_uc4; -float PixelShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint inU1) +float PixelShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, int inU1) { uint out_u1; @@ -23,7 +23,7 @@ float PixelShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint i bool r003 = any(inF0); float r004 = asin(inF0); int r005 = asint(inF0); - uint r006 = asuint(inF0); + uint r006 = asuint(inU1); float r007 = asfloat(inU0); // asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics float r009 = atan(inF0); @@ -42,6 +42,7 @@ float PixelShaderFunctionS(float inF0, float inF1, float inF2, uint inU0, uint i float r021 = ddy_coarse(inF0); float r022 = ddy_fine(inF0); float r023 = degrees(inF0); + float r024 = distance(inF0, inF1); // EvaluateAttributeAtCentroid(inF0); // EvaluateAttributeAtSample(inF0, 0); // TODO: EvaluateAttributeSnapped(inF0, int2(1,2)); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layout.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layout.frag index 4c2f7cef854..a4fa5af258a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layout.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layout.frag @@ -14,5 +14,6 @@ tbuffer tbufName2 : layout(set=4,binding=7) { float4 PixelShaderFunction(float4 input) : COLOR0 { - return input + v1 + v5 + v1PostLayout; + float4 layout = 2.0; + return input + v1 + v5 + v1PostLayout * layout; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layoutOverride.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layoutOverride.vert new file mode 100644 index 00000000000..4c006018bca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.layoutOverride.vert @@ -0,0 +1,7 @@ +layout(set=2,binding=0) Texture2D tex : register(t16); +SamplerState samp; + +float4 main() : SV_Position +{ + return tex.Sample(samp, float2(0.2, 0.3)); +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.mul-truncate.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.mul-truncate.frag new file mode 100644 index 00000000000..7ce2c22dbff --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.mul-truncate.frag @@ -0,0 +1,38 @@ + +// Test v*v, v*m, m*v, and m*m argument clamping. + +cbuffer Matrix +{ + float4x4 m44; + float4x3 m43; + float3x4 m34; + float3x3 m33; + float2x4 m24; + float4x2 m42; + float4 v4; + float3 v3; + float2 v2; +} + +float4 main() : SV_Target0 +{ + // v*v: + float r00 = mul(v2, v3); // float = float2*float3; // clamp to float2 dot product + float r01 = mul(v4, v2); // float = float4*float2; // clamp to float2 dot product + + // v*m + float4 r10 = mul(v3, m44); // float4 = float3 * float4x4; // clamp mat to float3x4; + float4 r11 = mul(v4, m34); // truncate vector to vec3 + + // m*v + float4 r20 = mul(m44, v3); // float4 = float4x4 * float3; // clamp mat to float4x3; + float4 r21 = mul(m43, v4); // truncate vector to vec3 + + // m*m + float2x3 r30 = mul(m24, m33); // float2x3 = float2x4 * float3x3; + float3x4 r31 = mul(m33, m24); // float3x4 = float3x3 * float2x4; + float3x2 r32 = mul(m33, m42); // float3x2 = float3x3 * float4x2; + float4x3 r33 = mul(m42, m33); // float4x3 = float4x2 * float3x3; + + return r10 + r11 + r20 + r21 + r00 + r01 + r30[0].x + r31[0] + r32[0].x + transpose(r33)[0]; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.noSemantic.functionality1.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.noSemantic.functionality1.comp new file mode 100644 index 00000000000..ac9a7a9321f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.noSemantic.functionality1.comp @@ -0,0 +1,7 @@ +AppendStructuredBuffer Buf : register(u0); + +[numthreads(1, 1, 1)] +void main() +{ + Buf.Append(1.0f.xxxx); +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.numthreads.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.numthreads.comp index fcc97f37985..0871d3f7468 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.numthreads.comp +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.numthreads.comp @@ -4,11 +4,8 @@ void main(uint3 tid : SV_DispatchThreadID ) { } -[numTHreaDs(4,4,2)] // case insensitive -void main_aux1(uint3 tid : SV_DispatchThreadID ) +[numthreads(1,4,8)] +void main_aux2(uint3 tid : SV_DispatchThreadID ) { } -[numthreads(1,4,8)] -void main_aux2(uint3 tid : SV_DispatchThreadID ); - diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.pp.expand.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.pp.expand.frag new file mode 100644 index 00000000000..d5318a0277a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.pp.expand.frag @@ -0,0 +1,18 @@ +#define EMP1(a) +#define EMP2(a, b) + +#define EXP1(a) = a +#define EXP2(a, b) = a, b + +struct A +{ + float4 a EMP1({1,2,3,4}); // No PP arg errors + float4 b EMP2({({{(({1,2,3,4}))}})}, {{1,2,3,4}}); // No PP arg errors + float4 c EXP1({1,2,3,4}); // ERROR: No PP arg errors, but init error + float4 d EXP2({({{(({1,2,3,4}))}})}, {{1,2,3,4}}); // ERROR: No PP arg errors, but init error +}; + +void main() +{ + "a string" +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.self_cast.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.self_cast.frag new file mode 100644 index 00000000000..8ef402708f1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.self_cast.frag @@ -0,0 +1,25 @@ +struct Test0 {}; +struct Test1 { float f; }; + +void main() +{ + { + Test0 a; + Test0 b = (Test0)a; + } + + { + Test1 a; + Test1 b = (Test1)a; + } + + { + Test0 a[2]; + Test0 b[2] = (Test0[2])a; + } + + { + Test1 a[2]; + Test1 b[2] = (Test1[2])a; + } +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.shift.per-set.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.shift.per-set.frag index 9c29f9d96cc..d7c0243e81e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.shift.per-set.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.shift.per-set.frag @@ -6,7 +6,7 @@ SamplerComparisonState s2 : register(s2, space2); Texture1D t1 : register(t1, space1); Texture2D t2 : register(t2, space1); Texture3D t3 : register(t1, space2); - +Texture3D ts6 : register(t1, space6); StructuredBuffer t4 : register(t1, space3); ByteAddressBuffer t5 : register(t2, space3); @@ -54,6 +54,7 @@ float4 main() : SV_Target0 cb1; tb1; + ts6; return 0; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.staticFuncInit.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.staticFuncInit.frag new file mode 100644 index 00000000000..f61c5661a1e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.staticFuncInit.frag @@ -0,0 +1,20 @@ +static float x = 1.0; + +float f1() +{ + static float x = 2.0; + x += 10.0; + return x; +} + +float f2(float p) +{ + static float x = 7.0; + x += p; + return x; +} + +float4 main() : SV_TARGET +{ + return x + f1() + f1() + f2(5.0) + f2(x); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.store.rwbyteaddressbuffer.type.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.store.rwbyteaddressbuffer.type.comp new file mode 100644 index 00000000000..5400d81f0b8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.store.rwbyteaddressbuffer.type.comp @@ -0,0 +1,8 @@ +RWByteAddressBuffer buffer; + +[numthreads(64, 1, 1)] +void main( uint3 dispatchThreadID : SV_DispatchThreadID) +{ + if(dispatchThreadID.x == 0) + buffer.Store(0, 2); +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.structbuffer.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.structbuffer.frag index 4eb6912bf42..dd522a69770 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.structbuffer.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.structbuffer.frag @@ -5,7 +5,7 @@ struct sb_t bool test2; }; // stride = 20 -StructuredBuffer sbuf : register(c10); +StructuredBuffer sbuf : register(t10); StructuredBuffer sbuf2; float4 main(uint pos : FOO) : SV_Target0 diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.tristream-append.geom b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.tristream-append.geom new file mode 100644 index 00000000000..208607d372f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.tristream-append.geom @@ -0,0 +1,18 @@ +struct GSPS_INPUT +{ +}; + +// Test Append() method appearing before declaration of entry point's stream output. + +void EmitVertex(in GSPS_INPUT output, inout TriangleStream TriStream) +{ + TriStream.Append( output ); +} + +[maxvertexcount(3)] +void main( triangle GSPS_INPUT input[3], inout TriangleStream TriStream ) +{ + EmitVertex(input[0], TriStream); + EmitVertex(input[1], TriStream); + EmitVertex(input[2], TriStream); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.type.type.conversion.all.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.type.type.conversion.all.frag new file mode 100644 index 00000000000..1883b018713 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.type.type.conversion.all.frag @@ -0,0 +1,190 @@ +#define zeros 0 +#define zeros1 0 +#define zeros2 0, 0 +#define zeros3 0, 0, 0 +#define zeros4 0, 0, 0, 0 +#define zeros5 0, 0, 0, 0, 0 +#define zeros6 0, 0, 0, 0, 0, 0 +#define zeros7 0, 0, 0, 0, 0, 0, 0 +#define zeros8 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros9 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros12 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros13 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros14 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros15 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +float4 main() : SV_Target { + float var0 = float(zeros1); + float2 var13 = float(zeros1); + float2 var14 = float2(zeros2); + float3 var26 = float(zeros1); + float3 var28 = float3(zeros3); + float4 var39 = float(zeros1); + float4 var42 = float4(zeros4); + float4 var43 = float2x2(zeros4); + float2x2 var52 = float(zeros1); + float2x2 var55 = float4(zeros4); + float2x2 var56 = float2x2(zeros4); + float2x3 var65 = float(zeros1); + float2x3 var70 = float2x3(zeros6); + float2x4 var78 = float(zeros1); + float2x4 var84 = float2x4(zeros8); + float3x2 var91 = float(zeros1); + float3x2 var98 = float3x2(zeros6); + float3x3 var104 = float(zeros1); + float3x3 var112 = float3x3(zeros9); + float3x4 var117 = float(zeros1); + float3x4 var126 = float3x4(zeros12); + float4x2 var130 = float(zeros1); + float4x2 var140 = float4x2(zeros8); + float4x3 var143 = float(zeros1); + float4x3 var154 = float4x3(zeros12); + float4x4 var156 = float(zeros1); + float4x4 var168 = float4x4(zeros16); + float var1 = float2(zeros2);// warning X3206: implicit truncation of vector type + float var2 = float3(zeros3);// warning X3206: implicit truncation of vector type + float var3 = float4(zeros4);// warning X3206: implicit truncation of vector type + float var4 = float2x2(zeros4);// warning X3206: implicit truncation of vector type + float var5 = float2x3(zeros6);// warning X3206: implicit truncation of vector type + float var6 = float2x4(zeros8);// warning X3206: implicit truncation of vector type + float var7 = float3x2(zeros6);// warning X3206: implicit truncation of vector type + float var8 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float var9 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float var10 = float4x2(zeros8);// warning X3206: implicit truncation of vector type + float var11 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float var12 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2 var15 = float3(zeros3);// warning X3206: implicit truncation of vector type + float2 var16 = float4(zeros4);// warning X3206: implicit truncation of vector type + float3 var29 = float4(zeros4);// warning X3206: implicit truncation of vector type + float2x2 var57 = float2x3(zeros6);// warning X3206: implicit truncation of vector type + float2x2 var58 = float2x4(zeros8);// warning X3206: implicit truncation of vector type + float2x2 var59 = float3x2(zeros6);// warning X3206: implicit truncation of vector type + float2x2 var60 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float2x2 var61 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float2x2 var62 = float4x2(zeros8);// warning X3206: implicit truncation of vector type + float2x2 var63 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float2x2 var64 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2x3 var71 = float2x4(zeros8);// warning X3206: implicit truncation of vector type + float2x3 var73 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float2x3 var74 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float2x3 var76 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float2x3 var77 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2x4 var87 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float2x4 var90 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float3x2 var99 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float3x2 var100 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float3x2 var101 = float4x2(zeros8);// warning X3206: implicit truncation of vector type + float3x2 var102 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float3x2 var103 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float3x3 var113 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float3x3 var115 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float3x3 var116 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float3x4 var129 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float4x2 var141 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float4x2 var142 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float4x3 var155 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2 var17 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float2' + float2 var18 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float2' + float2 var19 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float2' + float2 var20 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float2' + float2 var21 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float2' + float2 var22 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float2' + float2 var23 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float2' + float2 var24 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float2' + float2 var25 = float4x4(zeros16);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x4' to 'float2' + float3 var27 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3' + float3 var30 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3' + float3 var31 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3' + float3 var32 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3' + float3 var33 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float3' + float3 var34 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float3' + float3 var35 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float3' + float3 var36 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float3' + float3 var37 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float3' + float3 var38 = float4x4(zeros16);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x4' to 'float3' + float4 var40 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4' + float4 var41 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4' + float4 var44 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4' + float4 var45 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4' + float4 var46 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4' + float4 var47 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4' + float4 var48 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4' + float4 var49 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float4' + float4 var50 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float4' + float4 var51 = float4x4(zeros16);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x4' to 'float4' + float2x2 var53 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float2x2' + float2x2 var54 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float2x2' + float2x3 var66 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float2x3' + float2x3 var67 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float2x3' + float2x3 var68 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float2x3' + float2x3 var69 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float2x3' + float2x3 var72 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float2x3' + float2x3 var75 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float2x3' + float2x4 var79 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float2x4' + float2x4 var80 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float2x4' + float2x4 var81 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float2x4' + float2x4 var82 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float2x4' + float2x4 var83 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float2x4' + float2x4 var85 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float2x4' + float2x4 var86 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float2x4' + float2x4 var88 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float2x4' + float2x4 var89 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float2x4' + float3x2 var92 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3x2' + float3x2 var93 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float3x2' + float3x2 var94 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float3x2' + float3x2 var95 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3x2' + float3x2 var96 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3x2' + float3x2 var97 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3x2' + float3x3 var105 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3x3' + float3x3 var106 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float3x3' + float3x3 var107 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float3x3' + float3x3 var108 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3x3' + float3x3 var109 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3x3' + float3x3 var110 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3x3' + float3x3 var111 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float3x3' + float3x3 var114 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float3x3' + float3x4 var118 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float3x4' + float3x4 var119 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float3x4' + float3x4 var120 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float3x4' + float3x4 var121 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float3x4' + float3x4 var122 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float3x4' + float3x4 var123 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float3x4' + float3x4 var124 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float3x4' + float3x4 var125 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float3x4' + float3x4 var127 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float3x4' + float3x4 var128 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float3x4' + float4x2 var131 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4x2' + float4x2 var132 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4x2' + float4x2 var133 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float4x2' + float4x2 var134 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float4x2' + float4x2 var135 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4x2' + float4x2 var136 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4x2' + float4x2 var137 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4x2' + float4x2 var138 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4x2' + float4x2 var139 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4x2' + float4x3 var144 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4x3' + float4x3 var145 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4x3' + float4x3 var146 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float4x3' + float4x3 var147 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float4x3' + float4x3 var148 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4x3' + float4x3 var149 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4x3' + float4x3 var150 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4x3' + float4x3 var151 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4x3' + float4x3 var152 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4x3' + float4x3 var153 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float4x3' + float4x4 var157 = float2(zeros2);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2' to 'float4x4' + float4x4 var158 = float3(zeros3);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3' to 'float4x4' + float4x4 var159 = float4(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4' to 'float4x4' + float4x4 var160 = float2x2(zeros4);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x2' to 'float4x4' + float4x4 var161 = float2x3(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x3' to 'float4x4' + float4x4 var162 = float2x4(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float2x4' to 'float4x4' + float4x4 var163 = float3x2(zeros6);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x2' to 'float4x4' + float4x4 var164 = float3x3(zeros9);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x3' to 'float4x4' + float4x4 var165 = float3x4(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float3x4' to 'float4x4' + float4x4 var166 = float4x2(zeros8);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x2' to 'float4x4' + float4x4 var167 = float4x3(zeros12);// Compilation failed because: error X3017: cannot implicitly convert from 'const float4x3' to 'float4x4' + return 0; +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.type.type.conversion.valid.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.type.type.conversion.valid.frag new file mode 100644 index 00000000000..114edbccaf3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.type.type.conversion.valid.frag @@ -0,0 +1,90 @@ +#define zeros 0 +#define zeros1 0 +#define zeros2 0, 0 +#define zeros3 0, 0, 0 +#define zeros4 0, 0, 0, 0 +#define zeros5 0, 0, 0, 0, 0 +#define zeros6 0, 0, 0, 0, 0, 0 +#define zeros7 0, 0, 0, 0, 0, 0, 0 +#define zeros8 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros9 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros12 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros13 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros14 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros15 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +#define zeros16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +float4 main() : SV_Target { + float var0 = float(zeros1); + float2 var13 = float(zeros1); + float2 var14 = float2(zeros2); + float3 var26 = float(zeros1); + float3 var28 = float3(zeros3); + float4 var39 = float(zeros1); + float4 var42 = float4(zeros4); + float4 var43 = float2x2(zeros4); + float2x2 var52 = float(zeros1); + float2x2 var55 = float4(zeros4); + float2x2 var56 = float2x2(zeros4); + float2x3 var65 = float(zeros1); + float2x3 var70 = float2x3(zeros6); + float2x4 var78 = float(zeros1); + float2x4 var84 = float2x4(zeros8); + float3x2 var91 = float(zeros1); + float3x2 var98 = float3x2(zeros6); + float3x3 var104 = float(zeros1); + float3x3 var112 = float3x3(zeros9); + float3x4 var117 = float(zeros1); + float3x4 var126 = float3x4(zeros12); + float4x2 var130 = float(zeros1); + float4x2 var140 = float4x2(zeros8); + float4x3 var143 = float(zeros1); + float4x3 var154 = float4x3(zeros12); + float4x4 var156 = float(zeros1); + float4x4 var168 = float4x4(zeros16); + float var1 = float2(zeros2);// warning X3206: implicit truncation of vector type + float var2 = float3(zeros3);// warning X3206: implicit truncation of vector type + float var3 = float4(zeros4);// warning X3206: implicit truncation of vector type + float var4 = float2x2(zeros4);// warning X3206: implicit truncation of vector type + float var5 = float2x3(zeros6);// warning X3206: implicit truncation of vector type + float var6 = float2x4(zeros8);// warning X3206: implicit truncation of vector type + float var7 = float3x2(zeros6);// warning X3206: implicit truncation of vector type + float var8 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float var9 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float var10 = float4x2(zeros8);// warning X3206: implicit truncation of vector type + float var11 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float var12 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2 var15 = float3(zeros3);// warning X3206: implicit truncation of vector type + float2 var16 = float4(zeros4);// warning X3206: implicit truncation of vector type + float3 var29 = float4(zeros4);// warning X3206: implicit truncation of vector type + float2x2 var57 = float2x3(zeros6);// warning X3206: implicit truncation of vector type + float2x2 var58 = float2x4(zeros8);// warning X3206: implicit truncation of vector type + float2x2 var59 = float3x2(zeros6);// warning X3206: implicit truncation of vector type + float2x2 var60 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float2x2 var61 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float2x2 var62 = float4x2(zeros8);// warning X3206: implicit truncation of vector type + float2x2 var63 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float2x2 var64 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2x3 var71 = float2x4(zeros8);// warning X3206: implicit truncation of vector type + float2x3 var73 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float2x3 var74 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float2x3 var76 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float2x3 var77 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float2x4 var87 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float2x4 var90 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float3x2 var99 = float3x3(zeros9);// warning X3206: implicit truncation of vector type + float3x2 var100 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float3x2 var101 = float4x2(zeros8);// warning X3206: implicit truncation of vector type + float3x2 var102 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float3x2 var103 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float3x3 var113 = float3x4(zeros12);// warning X3206: implicit truncation of vector type + float3x3 var115 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float3x3 var116 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float3x4 var129 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float4x2 var141 = float4x3(zeros12);// warning X3206: implicit truncation of vector type + float4x2 var142 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + float4x3 var155 = float4x4(zeros16);// warning X3206: implicit truncation of vector type + return 0; +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavebroadcast.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavebroadcast.comp new file mode 100644 index 00000000000..4498305ca02 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavebroadcast.comp @@ -0,0 +1,53 @@ +struct Types +{ + uint4 u; + int4 i; + float4 f; + double4 d; +}; + +RWStructuredBuffer data; + +[numthreads(32, 16, 1)] +void CSMain(uint3 dti : SV_DispatchThreadID) +{ + data[dti.x].u = WaveReadLaneAt(data[dti.x].u, 13); + data[dti.x].u.x = WaveReadLaneAt(data[dti.x].u.x, 13); + data[dti.x].u.xy = WaveReadLaneAt(data[dti.x].u.xy, 13); + data[dti.x].u.xyz = WaveReadLaneAt(data[dti.x].u.xyz, 13); + + data[dti.x].i = WaveReadLaneAt(data[dti.x].i, 13); + data[dti.x].i.x = WaveReadLaneAt(data[dti.x].i.x, 13); + data[dti.x].i.xy = WaveReadLaneAt(data[dti.x].i.xy, 13); + data[dti.x].i.xyz = WaveReadLaneAt(data[dti.x].i.xyz, 13); + + data[dti.x].f = WaveReadLaneAt(data[dti.x].f, 13); + data[dti.x].f.x = WaveReadLaneAt(data[dti.x].f.x, 13); + data[dti.x].f.xy = WaveReadLaneAt(data[dti.x].f.xy, 13); + data[dti.x].f.xyz = WaveReadLaneAt(data[dti.x].f.xyz, 13); + + data[dti.x].d = WaveReadLaneFirst(data[dti.x].d); + data[dti.x].d.x = WaveReadLaneFirst(data[dti.x].d.x); + data[dti.x].d.xy = WaveReadLaneFirst(data[dti.x].d.xy); + data[dti.x].d.xyz = WaveReadLaneFirst(data[dti.x].d.xyz); + + data[dti.x].u = WaveReadLaneFirst(data[dti.x].u); + data[dti.x].u.x = WaveReadLaneFirst(data[dti.x].u.x); + data[dti.x].u.xy = WaveReadLaneFirst(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveReadLaneFirst(data[dti.x].u.xyz); + + data[dti.x].i = WaveReadLaneFirst(data[dti.x].i); + data[dti.x].i.x = WaveReadLaneFirst(data[dti.x].i.x); + data[dti.x].i.xy = WaveReadLaneFirst(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveReadLaneFirst(data[dti.x].i.xyz); + + data[dti.x].f = WaveReadLaneFirst(data[dti.x].f); + data[dti.x].f.x = WaveReadLaneFirst(data[dti.x].f.x); + data[dti.x].f.xy = WaveReadLaneFirst(data[dti.x].f.xy); + data[dti.x].f.xyz = WaveReadLaneFirst(data[dti.x].f.xyz); + + data[dti.x].d = WaveReadLaneFirst(data[dti.x].d); + data[dti.x].d.x = WaveReadLaneFirst(data[dti.x].d.x); + data[dti.x].d.xy = WaveReadLaneFirst(data[dti.x].d.xy); + data[dti.x].d.xyz = WaveReadLaneFirst(data[dti.x].d.xyz); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.waveprefix.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.waveprefix.comp new file mode 100644 index 00000000000..e4b4367d99d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.waveprefix.comp @@ -0,0 +1,55 @@ +struct Types +{ + uint4 u; + int4 i; + float4 f; + double4 d; +}; + +RWStructuredBuffer data; + +[numthreads(32, 16, 1)] +void CSMain(uint3 dti : SV_DispatchThreadID) +{ + data[dti.x].u = WavePrefixSum(data[dti.x].u); + data[dti.x].u.x = WavePrefixSum(data[dti.x].u.x); + data[dti.x].u.xy = WavePrefixSum(data[dti.x].u.xy); + data[dti.x].u.xyz = WavePrefixSum(data[dti.x].u.xyz); + + data[dti.x].i = WavePrefixSum(data[dti.x].i); + data[dti.x].i.x = WavePrefixSum(data[dti.x].i.x); + data[dti.x].i.xy = WavePrefixSum(data[dti.x].i.xy); + data[dti.x].i.xyz = WavePrefixSum(data[dti.x].i.xyz); + + data[dti.x].f = WavePrefixSum(data[dti.x].f); + data[dti.x].f.x = WavePrefixSum(data[dti.x].f.x); + data[dti.x].f.xy = WavePrefixSum(data[dti.x].f.xy); + data[dti.x].f.xyz = WavePrefixSum(data[dti.x].f.xyz); + + data[dti.x].d = WavePrefixSum(data[dti.x].d); + data[dti.x].d.x = WavePrefixSum(data[dti.x].d.x); + data[dti.x].d.xy = WavePrefixSum(data[dti.x].d.xy); + data[dti.x].d.xyz = WavePrefixSum(data[dti.x].d.xyz); + + data[dti.x].u = WavePrefixProduct(data[dti.x].u); + data[dti.x].u.x = WavePrefixProduct(data[dti.x].u.x); + data[dti.x].u.xy = WavePrefixProduct(data[dti.x].u.xy); + data[dti.x].u.xyz = WavePrefixProduct(data[dti.x].u.xyz); + + data[dti.x].i = WavePrefixProduct(data[dti.x].i); + data[dti.x].i.x = WavePrefixProduct(data[dti.x].i.x); + data[dti.x].i.xy = WavePrefixProduct(data[dti.x].i.xy); + data[dti.x].i.xyz = WavePrefixProduct(data[dti.x].i.xyz); + + data[dti.x].f = WavePrefixProduct(data[dti.x].f); + data[dti.x].f.x = WavePrefixProduct(data[dti.x].f.x); + data[dti.x].f.xy = WavePrefixProduct(data[dti.x].f.xy); + data[dti.x].f.xyz = WavePrefixProduct(data[dti.x].f.xyz); + + data[dti.x].d = WavePrefixProduct(data[dti.x].d); + data[dti.x].d.x = WavePrefixProduct(data[dti.x].d.x); + data[dti.x].d.xy = WavePrefixProduct(data[dti.x].d.xy); + data[dti.x].d.xyz = WavePrefixProduct(data[dti.x].d.xyz); + + data[dti.x].u.x = WavePrefixCountBits(data[dti.x].u.x == 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequad.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequad.comp new file mode 100644 index 00000000000..34e8b7828b3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequad.comp @@ -0,0 +1,153 @@ +struct Types +{ + uint4 u; + int4 i; + float4 f; + double4 d; +}; + +RWStructuredBuffer data; + +[numthreads(32, 16, 1)] +void CSMain(uint3 dti : SV_DispatchThreadID) +{ + data[dti.x].u = QuadReadLaneAt(data[dti.x].u, 0); + data[dti.x].u.x = QuadReadLaneAt(data[dti.x].u.x, 0); + data[dti.x].u.xy = QuadReadLaneAt(data[dti.x].u.xy, 0); + data[dti.x].u.xyz = QuadReadLaneAt(data[dti.x].u.xyz, 0); + + data[dti.x].i = QuadReadLaneAt(data[dti.x].i, 0); + data[dti.x].i.x = QuadReadLaneAt(data[dti.x].i.x, 0); + data[dti.x].i.xy = QuadReadLaneAt(data[dti.x].i.xy, 0); + data[dti.x].i.xyz = QuadReadLaneAt(data[dti.x].i.xyz, 0); + + data[dti.x].f = QuadReadLaneAt(data[dti.x].f, 0); + data[dti.x].f.x = QuadReadLaneAt(data[dti.x].f.x, 0); + data[dti.x].f.xy = QuadReadLaneAt(data[dti.x].f.xy, 0); + data[dti.x].f.xyz = QuadReadLaneAt(data[dti.x].f.xyz, 0); + + data[dti.x].d = QuadReadLaneAt(data[dti.x].d, 0); + data[dti.x].d.x = QuadReadLaneAt(data[dti.x].d.x, 0); + data[dti.x].d.xy = QuadReadLaneAt(data[dti.x].d.xy, 0); + data[dti.x].d.xyz = QuadReadLaneAt(data[dti.x].d.xyz, 0); + + data[dti.x].u = QuadReadLaneAt(data[dti.x].u, 1); + data[dti.x].u.x = QuadReadLaneAt(data[dti.x].u.x, 1); + data[dti.x].u.xy = QuadReadLaneAt(data[dti.x].u.xy, 1); + data[dti.x].u.xyz = QuadReadLaneAt(data[dti.x].u.xyz, 1); + + data[dti.x].i = QuadReadLaneAt(data[dti.x].i, 1); + data[dti.x].i.x = QuadReadLaneAt(data[dti.x].i.x, 1); + data[dti.x].i.xy = QuadReadLaneAt(data[dti.x].i.xy, 1); + data[dti.x].i.xyz = QuadReadLaneAt(data[dti.x].i.xyz, 1); + + data[dti.x].f = QuadReadLaneAt(data[dti.x].f, 1); + data[dti.x].f.x = QuadReadLaneAt(data[dti.x].f.x, 1); + data[dti.x].f.xy = QuadReadLaneAt(data[dti.x].f.xy, 1); + data[dti.x].f.xyz = QuadReadLaneAt(data[dti.x].f.xyz, 1); + + data[dti.x].d = QuadReadLaneAt(data[dti.x].d, 1); + data[dti.x].d.x = QuadReadLaneAt(data[dti.x].d.x, 1); + data[dti.x].d.xy = QuadReadLaneAt(data[dti.x].d.xy, 1); + data[dti.x].d.xyz = QuadReadLaneAt(data[dti.x].d.xyz, 1); + + data[dti.x].u = QuadReadLaneAt(data[dti.x].u, 2); + data[dti.x].u.x = QuadReadLaneAt(data[dti.x].u.x, 2); + data[dti.x].u.xy = QuadReadLaneAt(data[dti.x].u.xy, 2); + data[dti.x].u.xyz = QuadReadLaneAt(data[dti.x].u.xyz, 2); + + data[dti.x].i = QuadReadLaneAt(data[dti.x].i, 2); + data[dti.x].i.x = QuadReadLaneAt(data[dti.x].i.x, 2); + data[dti.x].i.xy = QuadReadLaneAt(data[dti.x].i.xy, 2); + data[dti.x].i.xyz = QuadReadLaneAt(data[dti.x].i.xyz, 2); + + data[dti.x].f = QuadReadLaneAt(data[dti.x].f, 2); + data[dti.x].f.x = QuadReadLaneAt(data[dti.x].f.x, 2); + data[dti.x].f.xy = QuadReadLaneAt(data[dti.x].f.xy, 2); + data[dti.x].f.xyz = QuadReadLaneAt(data[dti.x].f.xyz, 2); + + data[dti.x].d = QuadReadLaneAt(data[dti.x].d, 2); + data[dti.x].d.x = QuadReadLaneAt(data[dti.x].d.x, 2); + data[dti.x].d.xy = QuadReadLaneAt(data[dti.x].d.xy, 2); + data[dti.x].d.xyz = QuadReadLaneAt(data[dti.x].d.xyz, 2); + + data[dti.x].u = QuadReadLaneAt(data[dti.x].u, 3); + data[dti.x].u.x = QuadReadLaneAt(data[dti.x].u.x, 3); + data[dti.x].u.xy = QuadReadLaneAt(data[dti.x].u.xy, 3); + data[dti.x].u.xyz = QuadReadLaneAt(data[dti.x].u.xyz, 3); + + data[dti.x].i = QuadReadLaneAt(data[dti.x].i, 3); + data[dti.x].i.x = QuadReadLaneAt(data[dti.x].i.x, 3); + data[dti.x].i.xy = QuadReadLaneAt(data[dti.x].i.xy, 3); + data[dti.x].i.xyz = QuadReadLaneAt(data[dti.x].i.xyz, 3); + + data[dti.x].f = QuadReadLaneAt(data[dti.x].f, 3); + data[dti.x].f.x = QuadReadLaneAt(data[dti.x].f.x, 3); + data[dti.x].f.xy = QuadReadLaneAt(data[dti.x].f.xy, 3); + data[dti.x].f.xyz = QuadReadLaneAt(data[dti.x].f.xyz, 3); + + data[dti.x].d = QuadReadLaneAt(data[dti.x].d, 3); + data[dti.x].d.x = QuadReadLaneAt(data[dti.x].d.x, 3); + data[dti.x].d.xy = QuadReadLaneAt(data[dti.x].d.xy, 3); + data[dti.x].d.xyz = QuadReadLaneAt(data[dti.x].d.xyz, 3); + + data[dti.x].u = QuadReadAcrossX(data[dti.x].u); + data[dti.x].u.x = QuadReadAcrossX(data[dti.x].u.x); + data[dti.x].u.xy = QuadReadAcrossX(data[dti.x].u.xy); + data[dti.x].u.xyz = QuadReadAcrossX(data[dti.x].u.xyz); + + data[dti.x].i = QuadReadAcrossX(data[dti.x].i); + data[dti.x].i.x = QuadReadAcrossX(data[dti.x].i.x); + data[dti.x].i.xy = QuadReadAcrossX(data[dti.x].i.xy); + data[dti.x].i.xyz = QuadReadAcrossX(data[dti.x].i.xyz); + + data[dti.x].f = QuadReadAcrossX(data[dti.x].f); + data[dti.x].f.x = QuadReadAcrossX(data[dti.x].f.x); + data[dti.x].f.xy = QuadReadAcrossX(data[dti.x].f.xy); + data[dti.x].f.xyz = QuadReadAcrossX(data[dti.x].f.xyz); + + data[dti.x].d = QuadReadAcrossX(data[dti.x].d); + data[dti.x].d.x = QuadReadAcrossX(data[dti.x].d.x); + data[dti.x].d.xy = QuadReadAcrossX(data[dti.x].d.xy); + data[dti.x].d.xyz = QuadReadAcrossX(data[dti.x].d.xyz); + + data[dti.x].u = QuadReadAcrossY(data[dti.x].u); + data[dti.x].u.x = QuadReadAcrossY(data[dti.x].u.x); + data[dti.x].u.xy = QuadReadAcrossY(data[dti.x].u.xy); + data[dti.x].u.xyz = QuadReadAcrossY(data[dti.x].u.xyz); + + data[dti.x].i = QuadReadAcrossY(data[dti.x].i); + data[dti.x].i.x = QuadReadAcrossY(data[dti.x].i.x); + data[dti.x].i.xy = QuadReadAcrossY(data[dti.x].i.xy); + data[dti.x].i.xyz = QuadReadAcrossY(data[dti.x].i.xyz); + + data[dti.x].f = QuadReadAcrossY(data[dti.x].f); + data[dti.x].f.x = QuadReadAcrossY(data[dti.x].f.x); + data[dti.x].f.xy = QuadReadAcrossY(data[dti.x].f.xy); + data[dti.x].f.xyz = QuadReadAcrossY(data[dti.x].f.xyz); + + data[dti.x].d = QuadReadAcrossY(data[dti.x].d); + data[dti.x].d.x = QuadReadAcrossY(data[dti.x].d.x); + data[dti.x].d.xy = QuadReadAcrossY(data[dti.x].d.xy); + data[dti.x].d.xyz = QuadReadAcrossY(data[dti.x].d.xyz); + + data[dti.x].u = QuadReadAcrossDiagonal(data[dti.x].u); + data[dti.x].u.x = QuadReadAcrossDiagonal(data[dti.x].u.x); + data[dti.x].u.xy = QuadReadAcrossDiagonal(data[dti.x].u.xy); + data[dti.x].u.xyz = QuadReadAcrossDiagonal(data[dti.x].u.xyz); + + data[dti.x].i = QuadReadAcrossDiagonal(data[dti.x].i); + data[dti.x].i.x = QuadReadAcrossDiagonal(data[dti.x].i.x); + data[dti.x].i.xy = QuadReadAcrossDiagonal(data[dti.x].i.xy); + data[dti.x].i.xyz = QuadReadAcrossDiagonal(data[dti.x].i.xyz); + + data[dti.x].f = QuadReadAcrossDiagonal(data[dti.x].f); + data[dti.x].f.x = QuadReadAcrossDiagonal(data[dti.x].f.x); + data[dti.x].f.xy = QuadReadAcrossDiagonal(data[dti.x].f.xy); + data[dti.x].f.xyz = QuadReadAcrossDiagonal(data[dti.x].f.xyz); + + data[dti.x].d = QuadReadAcrossDiagonal(data[dti.x].d); + data[dti.x].d.x = QuadReadAcrossDiagonal(data[dti.x].d.x); + data[dti.x].d.xy = QuadReadAcrossDiagonal(data[dti.x].d.xy); + data[dti.x].d.xyz = QuadReadAcrossDiagonal(data[dti.x].d.xyz); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequery.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequery.comp new file mode 100644 index 00000000000..a689e119750 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequery.comp @@ -0,0 +1,7 @@ +RWStructuredBuffer data; + +[numthreads(32, 16, 1)] +void CSMain() +{ + data[WaveGetLaneIndex()] = (WaveIsFirstLane()) ? WaveGetLaneCount() : 0; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequery.frag b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequery.frag new file mode 100644 index 00000000000..d1437f06452 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavequery.frag @@ -0,0 +1,11 @@ +float4 PixelShaderFunction() : COLOR0 +{ + if (WaveIsFirstLane()) + { + return float4(1, 2, 3, 4); + } + else + { + return float4(4, 3, 2, 1); + } +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavereduction.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavereduction.comp new file mode 100644 index 00000000000..b7604ad9ad7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavereduction.comp @@ -0,0 +1,125 @@ +struct Types +{ + uint4 u; + int4 i; + float4 f; + double4 d; +}; + +RWStructuredBuffer data; + +[numthreads(32, 16, 1)] +void CSMain(uint3 dti : SV_DispatchThreadID) +{ + data[dti.x].u = WaveActiveSum(data[dti.x].u); + data[dti.x].u.x = WaveActiveSum(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveSum(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveSum(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveSum(data[dti.x].i); + data[dti.x].i.x = WaveActiveSum(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveSum(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveSum(data[dti.x].i.xyz); + + data[dti.x].f = WaveActiveSum(data[dti.x].f); + data[dti.x].f.x = WaveActiveSum(data[dti.x].f.x); + data[dti.x].f.xy = WaveActiveSum(data[dti.x].f.xy); + data[dti.x].f.xyz = WaveActiveSum(data[dti.x].f.xyz); + + data[dti.x].d = WaveActiveSum(data[dti.x].d); + data[dti.x].d.x = WaveActiveSum(data[dti.x].d.x); + data[dti.x].d.xy = WaveActiveSum(data[dti.x].d.xy); + data[dti.x].d.xyz = WaveActiveSum(data[dti.x].d.xyz); + + data[dti.x].u = WaveActiveProduct(data[dti.x].u); + data[dti.x].u.x = WaveActiveProduct(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveProduct(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveProduct(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveProduct(data[dti.x].i); + data[dti.x].i.x = WaveActiveProduct(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveProduct(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveProduct(data[dti.x].i.xyz); + + data[dti.x].f = WaveActiveProduct(data[dti.x].f); + data[dti.x].f.x = WaveActiveProduct(data[dti.x].f.x); + data[dti.x].f.xy = WaveActiveProduct(data[dti.x].f.xy); + data[dti.x].f.xyz = WaveActiveProduct(data[dti.x].f.xyz); + + data[dti.x].d = WaveActiveProduct(data[dti.x].d); + data[dti.x].d.x = WaveActiveProduct(data[dti.x].d.x); + data[dti.x].d.xy = WaveActiveProduct(data[dti.x].d.xy); + data[dti.x].d.xyz = WaveActiveProduct(data[dti.x].d.xyz); + + data[dti.x].u = WaveActiveMin(data[dti.x].u); + data[dti.x].u.x = WaveActiveMin(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveMin(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveMin(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveMin(data[dti.x].i); + data[dti.x].i.x = WaveActiveMin(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveMin(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveMin(data[dti.x].i.xyz); + + data[dti.x].f = WaveActiveMin(data[dti.x].f); + data[dti.x].f.x = WaveActiveMin(data[dti.x].f.x); + data[dti.x].f.xy = WaveActiveMin(data[dti.x].f.xy); + data[dti.x].f.xyz = WaveActiveMin(data[dti.x].f.xyz); + + data[dti.x].d = WaveActiveMin(data[dti.x].d); + data[dti.x].d.x = WaveActiveMin(data[dti.x].d.x); + data[dti.x].d.xy = WaveActiveMin(data[dti.x].d.xy); + data[dti.x].d.xyz = WaveActiveMin(data[dti.x].d.xyz); + + data[dti.x].u = WaveActiveMax(data[dti.x].u); + data[dti.x].u.x = WaveActiveMax(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveMax(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveMax(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveMax(data[dti.x].i); + data[dti.x].i.x = WaveActiveMax(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveMax(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveMax(data[dti.x].i.xyz); + + data[dti.x].f = WaveActiveMax(data[dti.x].f); + data[dti.x].f.x = WaveActiveMax(data[dti.x].f.x); + data[dti.x].f.xy = WaveActiveMax(data[dti.x].f.xy); + data[dti.x].f.xyz = WaveActiveMax(data[dti.x].f.xyz); + + data[dti.x].d = WaveActiveMax(data[dti.x].d); + data[dti.x].d.x = WaveActiveMax(data[dti.x].d.x); + data[dti.x].d.xy = WaveActiveMax(data[dti.x].d.xy); + data[dti.x].d.xyz = WaveActiveMax(data[dti.x].d.xyz); + + data[dti.x].u = WaveActiveBitAnd(data[dti.x].u); + data[dti.x].u.x = WaveActiveBitAnd(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveBitAnd(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveBitAnd(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveBitAnd(data[dti.x].i); + data[dti.x].i.x = WaveActiveBitAnd(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveBitAnd(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveBitAnd(data[dti.x].i.xyz); + + data[dti.x].u = WaveActiveBitOr(data[dti.x].u); + data[dti.x].u.x = WaveActiveBitOr(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveBitOr(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveBitOr(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveBitOr(data[dti.x].i); + data[dti.x].i.x = WaveActiveBitOr(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveBitOr(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveBitOr(data[dti.x].i.xyz); + + data[dti.x].u = WaveActiveBitXor(data[dti.x].u); + data[dti.x].u.x = WaveActiveBitXor(data[dti.x].u.x); + data[dti.x].u.xy = WaveActiveBitXor(data[dti.x].u.xy); + data[dti.x].u.xyz = WaveActiveBitXor(data[dti.x].u.xyz); + + data[dti.x].i = WaveActiveBitXor(data[dti.x].i); + data[dti.x].i.x = WaveActiveBitXor(data[dti.x].i.x); + data[dti.x].i.xy = WaveActiveBitXor(data[dti.x].i.xy); + data[dti.x].i.xyz = WaveActiveBitXor(data[dti.x].i.xyz); + + data[dti.x].u.x = WaveActiveCountBits(data[dti.x].u.x == 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavevote.comp b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavevote.comp new file mode 100644 index 00000000000..0370e69b7da --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.wavevote.comp @@ -0,0 +1,10 @@ +RWStructuredBuffer data; + +[numthreads(32, 16, 1)] +void CSMain(uint3 dti : SV_DispatchThreadID) +{ + data[dti.x] = WaveActiveBallot(WaveActiveAnyTrue(dti.x == 0)); + data[dti.y] = WaveActiveBallot(WaveActiveAllTrue(dti.y == 0)); + data[dti.z] = WaveActiveBallot(WaveActiveAllEqualBool(dti.z == 0)); + data[dti.z] = WaveActiveBallot(WaveActiveAllEqual(dti.z)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-1.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-1.vert new file mode 100644 index 00000000000..ee62ec24b70 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-1.vert @@ -0,0 +1,9 @@ + +// Test Y negation from entry point return + +float4 pos; + +float4 main() : SV_Position +{ + return pos; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-2.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-2.vert new file mode 100644 index 00000000000..01fa6ce71e1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-2.vert @@ -0,0 +1,8 @@ +// Test Y negation from entry point out parameter + +float4 pos; + +void main(out float4 position : SV_Position) +{ + position = pos; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-3.vert b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-3.vert new file mode 100644 index 00000000000..a0c4a8d6393 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/hlsl.y-negate-3.vert @@ -0,0 +1,18 @@ +// Test Y negation from entry point out parameter + +float4 position; + +struct VS_OUT { + float4 pos : SV_Position; + int somethingelse; +}; + +VS_OUT main() +{ + VS_OUT vsout; + + vsout.pos = position; + vsout.somethingelse = 42; + + return vsout; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/link1.vk.frag b/3rdparty/bgfx/3rdparty/glslang/Test/link1.vk.frag index 443a32052c1..167e78ee75b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/link1.vk.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/link1.vk.frag @@ -2,9 +2,23 @@ vec4 getColor(); -out vec4 color; +layout(location=0) out vec4 color; + +int a1[]; // max size from link1 +int a2[]; // max size from link2 +int b[5]; +int c[]; +int i; + +buffer bnameRuntime { float r[]; }; +buffer bnameImplicit { float m[]; }; void main() { color = getColor(); + + a1[8] = 1; + a2[1] = 1; + b[i] = 1; + c[3] = 1; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/link2.vk.frag b/3rdparty/bgfx/3rdparty/glslang/Test/link2.vk.frag index b1630cb58e9..b80402ca554 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/link2.vk.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/link2.vk.frag @@ -1,8 +1,23 @@ #version 450 -uniform sampler2D s2D; +layout(binding=1) uniform sampler2D s2D; + +int a1[]; // max size from link1 +int a2[]; // max size from link2 +int b[]; +int c[7]; +int i; + +buffer bnameRuntime { float r[]; }; +buffer bnameImplicit { float m[4]; }; vec4 getColor() { - return texture(s2D, vec2(0.5)); + a1[2] = 1; + a2[9] = 1; + b[2] = 1; + c[3] = 1; + c[i] = 1; + + return texture(s2D, vec2(0.5)); } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/matrix2.frag b/3rdparty/bgfx/3rdparty/glslang/Test/matrix2.frag index eb2c53c2ece..df658044018 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/matrix2.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/matrix2.frag @@ -47,4 +47,5 @@ void main() FragColor *= inv4; FragColor = vec4(FragColor * matrixCompMult(un34, un34), FragColor.w); + m34 *= colorTransform; } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/matrixError.vert b/3rdparty/bgfx/3rdparty/glslang/Test/matrixError.vert index 3c8cc11fec5..0ad145b255f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/matrixError.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/matrixError.vert @@ -19,4 +19,6 @@ void main() m23.xy; // ERROR, can't use . gl_Position = vec4(m23 * m32 * v3, m24[2][4]); // ERROR, 2 and 4 are out of range + m23 *= m23; // ERROR, right side needs to be square + m23 *= m32; // ERROR, left columns must match right rows } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/mixedArrayDecls.frag b/3rdparty/bgfx/3rdparty/glslang/Test/mixedArrayDecls.frag new file mode 100644 index 00000000000..aff4f78a562 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/mixedArrayDecls.frag @@ -0,0 +1,30 @@ +#version 450 + +struct S { + int[3] a[2], b[5]; +}; + +S s; + +int[5] c[4], d[8]; +int[9] e[], f[]; +int e[11][9]; +int f[13][9]; + +int[14] g[], h[]; + +int [14][15][6] foo(int[6] p[14][15]) { return p; } + +void main() +{ + g[3]; + h[2]; +} + +float[4][3][2] bar() { float[3][2] a[4]; return a; } + +in inbname { + float[7] f[8][9]; +} inbinst[4][5][6]; + +float[3][2] barm[4]() { float[3][2] a[4]; return a; } // ERROR diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/nonuniform.frag b/3rdparty/bgfx/3rdparty/glslang/Test/nonuniform.frag new file mode 100644 index 00000000000..3f3dd67a711 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/nonuniform.frag @@ -0,0 +1,33 @@ +#version 450 + +int nonuniformEXT; + +#extension GL_EXT_nonuniform_qualifier : enable + +nonuniformEXT in vec4 nu_inv4; +nonuniformEXT float nu_gf; + +nonuniformEXT out vec4 nu_outv4; // ERROR, out +nonuniformEXT uniform vec4 nu_uv4; // ERROR, uniform +nonuniformEXT const float nu_constf = 1.0; // ERROR, const + +nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f) +{ + return nupi; +} + +void main() +{ + nonuniformEXT int nu_li; + nonuniformEXT const int nu_ci = 2; // ERROR, const + + foo(nu_li, nu_li); + + int a; + nu_li = nonuniformEXT(a) + nonuniformEXT(a * 2); + nu_li = nonuniformEXT(a, a); // ERROR, too many arguments + nu_li = nonuniformEXT(); // ERROR, no arguments +} + +layout(location=1) in struct S { float a; nonuniformEXT float b; } ins; // ERROR, not on member +layout(location=3) in inbName { float a; nonuniformEXT float b; } inb; // ERROR, not on member diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/nvShaderNoperspectiveInterpolation.frag b/3rdparty/bgfx/3rdparty/glslang/Test/nvShaderNoperspectiveInterpolation.frag new file mode 100644 index 00000000000..15c191d039d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/nvShaderNoperspectiveInterpolation.frag @@ -0,0 +1,15 @@ +#version 300 es + +precision mediump float; + +noperspective in vec4 bad; // ERROR + +#extension GL_NV_shader_noperspective_interpolation : enable + +noperspective in vec4 color; + +out vec4 fragColor; + +void main() { + fragColor = color; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.bad_arg.vert b/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.bad_arg.vert new file mode 100644 index 00000000000..344fc4b1e99 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.bad_arg.vert @@ -0,0 +1,8 @@ +#define M(a) a +int M(aou + = 2) // Okay, one argument, split across newline + ; + +// end of file during an argument +#define EXP2(a, b) +EXP2(((((1,2,3,4))), ); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.pragma.vert b/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.pragma.vert index 79f5600a8db..0ae7ee21240 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.pragma.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.pragma.vert @@ -7,5 +7,7 @@ #pragma undefined_pragma(x, 4) +#pragma once + int main() { } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.simple.vert b/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.simple.vert index 352227192bf..788df76ce54 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.simple.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/preprocessor.simple.vert @@ -27,3 +27,39 @@ int main() { += -= *= /= %= <<= >>= &= |= ^= 1.2 2E10 5u -5lf } + +struct S { + int member1; + float member2; + vec4 member3; +}; + +#define xyz xxyz +#define yzy() yyz + +#define FUN_MAC() \ + vec3 a = vec3(0); \ + vec3 b = a.zxyz; \ + vec3 b = a.xyz; \ + vec3 b = a.yzy(); \ + vec3 b = a.xyz(); \ + vec3 b = a.yzy; \ + vec3 b = a.z; + +void foo() +{ + S s; + s.member2 + s.member1; + s.member3.zyx; + s.member2.xyz; + s.member2.yzy(); + s.member2.xyz(); + s.member2.yzy; + FUN_MAC() + yzy + + (); + yzy + + +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/runtests b/3rdparty/bgfx/3rdparty/glslang/Test/runtests index 814210ba4a7..8cc8b7a8095 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/runtests +++ b/3rdparty/bgfx/3rdparty/glslang/Test/runtests @@ -32,11 +32,11 @@ diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASER echo Running reflection... $EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1 -$EXE -D -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out +$EXE -D -Od -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1 -$EXE -D -e main -l -q -C -V -Od hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out +$EXE -D -Od -e main -l -q -C -V -Od hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1 -$EXE -D -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main -Od hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out +$EXE -D -Od -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main -Od hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1 # @@ -56,14 +56,14 @@ fi # entry point renaming tests # echo Running entry-point renaming tests -$EXE -i -H -V -D -e main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out +$EXE -i -H -V -D -Od --entry-point main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1 # # Testing ill-defined uncalled function # echo Running ill-defined uncalled function -$EXE -D -e main -H -Od hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out +$EXE -D -Od -e main -H -Od hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out diff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1 if [ $HASERROR -eq 0 ] @@ -74,11 +74,15 @@ else fi # -# Testing -S +# Testing -S and compound suffixes # -echo Running explicit stage test -$EXE -i -S vert nosuffix > $TARGETDIR/nosuffix.out +echo Running explicit stage test and compound suffix tests +$EXE -Od -i -S vert nosuffix > $TARGETDIR/nosuffix.out diff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1 +$EXE -Od -i compoundsuffix.vert.glsl > $TARGETDIR/compoundsuffix.vert.glsl +diff -b $BASEDIR/compoundsuffix.vert.glsl $TARGETDIR/compoundsuffix.vert.glsl || HASERROR=1 +$EXE -Od -e main -H compoundsuffix.frag.hlsl > $TARGETDIR/compoundsuffix.frag.hlsl +diff -b $BASEDIR/compoundsuffix.frag.hlsl $TARGETDIR/compoundsuffix.frag.hlsl || HASERROR=1 # # Testing --hlsl-offsets @@ -88,27 +92,27 @@ $EXE -i --hlsl-offsets -H spv.hlslOffsets.vert > $TARGETDIR/spv.hlslOffsets.vert diff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1 echo Running hlsl offsets -$EXE -i --hlsl-offsets -D -e main -H -Od hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out +$EXE -i --hlsl-offsets -D -Od -e main -H -Od hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out diff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1 # # Testing --resource-set-binding # echo Configuring HLSL descriptor set and binding number manually -$EXE -V -D -e main -H -Od hlsl.multiDescriptorSet.frag --rsb frag t0 0 0 t1 1 0 s0 0 1 s1 1 1 b0 2 0 b1 2 1 b2 2 2 > $TARGETDIR/hlsl.multiDescriptorSet.frag.out +$EXE -V -D -Od -e main -H -Od hlsl.multiDescriptorSet.frag --rsb frag t0 0 0 t1 1 0 s0 0 1 s1 1 1 b0 2 0 b1 2 1 b2 2 2 > $TARGETDIR/hlsl.multiDescriptorSet.frag.out diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1 -$EXE -V -D -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out +$EXE -V -D -Od -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDescriptorSet.frag.out || HASERROR=1 -$EXE -V -D -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out +$EXE -V -D -Od -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1 # # Testing per-descriptor-set IO map shift # echo 'Testing per-descriptor-set IO map shift' -$EXE -e main --hlsl-iomap --ssb 10 1 15 2 --stb 20 --stb 25 2 --suavb 30 --suavb 40 2 --sub 50 6 -i -q -D -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1 +$EXE -e main --hlsl-iomap --ssb 10 1 15 2 --stb 20 --stb 25 2 --stb 70 6 --suavb 30 --suavb 40 2 --sub 50 6 -i -q -D -Od -V hlsl.shift.per-set.frag > $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1 diff -b $BASEDIR/hlsl.shift.per-set.frag.out $TARGETDIR/hlsl.shift.per-set.frag.out || HASERROR=1 # @@ -126,10 +130,13 @@ diff -b $BASEDIR/spv.looseUniformNoLoc.vert.out $TARGETDIR/spv.looseUniformNoLoc # Testing debug information # echo Testing SPV Debug Information -$EXE -g --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf \ +$EXE -g --relaxed-errors --suppress-warnings --aml --amb --hlsl-offsets --nsf --spirv-val \ -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1 -$EXE -g -D -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \ +$EXE -g -Od --target-env vulkan1.1 --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf --spirv-val \ + -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.1.1.frag.out +diff -b $BASEDIR/spv.debugInfo.1.1.frag.out $TARGETDIR/spv.debugInfo.1.1.frag.out || HASERROR=1 +$EXE -g -D -Od -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --spirv-val --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \ --sep origMain -H -Od spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out diff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.out || HASERROR=1 @@ -137,13 +144,13 @@ diff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.ou # Testing Includer # echo Testing Includer -$EXE -D -e main -H -Od ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out +$EXE -D -Od -e main -H -Od ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out diff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1 -$EXE -D -e main -H -Od hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out +$EXE -D -Od -e main -H -Od hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out diff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1 $EXE -l -i include.vert > $TARGETDIR/include.vert.out diff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1 -$EXE -D -e main -H -Od -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out +$EXE -D -Od -e main -H -Od -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1 # @@ -152,19 +159,21 @@ diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR= echo "Testing -D and -U" $EXE -DUNDEFED -UIN_SHADER -DFOO=200 -i -l -UUNDEFED -DMUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1 -$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED -Od hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out +$EXE -D -Od -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED -Od hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1 # # Test --client and --target-env # echo "Testing --client and --target-env" -$EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1 -$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1 -$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1 -$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1 -$EXE -V100 spv.targetVulkan.vert || HASERROR=1 -$EXE -G100 spv.targetOpenGL.vert || HASERROR=1 +$EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1 +$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1 +$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1 +$EXE --target-env vulkan1.1 spv.targetVulkan.vert || HASERROR=1 +$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1 +$EXE -V100 spv.targetVulkan.vert || HASERROR=1 +$EXE -G100 spv.targetOpenGL.vert || HASERROR=1 +$EXE --target-env spirv1.2 -V spv.targetVulkan.vert || HASERROR=1 # # Testing GLSL entry point rename @@ -186,6 +195,36 @@ diff -b $BASEDIR/remap.invalid-spirv-1.out $TARGETDIR/remap.invalid-spirv-1.out $REMAPEXE --do-everything -i remap.invalid-spirv-2.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-2.out && HASERROR=1 diff -b $BASEDIR/remap.invalid-spirv-2.out $TARGETDIR/remap.invalid-spirv-2.out || HASERROR=1 +# +# Testing position Y inversion +# +echo "Testing position Y inversion" +$EXE -H -e main -V -D -Od -H -i --iy hlsl.y-negate-1.vert > $TARGETDIR/hlsl.y-negate-1.vert.out +diff -b $BASEDIR/hlsl.y-negate-1.vert.out $TARGETDIR/hlsl.y-negate-1.vert.out || HASERROR=1 +$EXE -H -e main -V -D -Od -H -i --invert-y hlsl.y-negate-2.vert > $TARGETDIR/hlsl.y-negate-2.vert.out +diff -b $BASEDIR/hlsl.y-negate-2.vert.out $TARGETDIR/hlsl.y-negate-2.vert.out || HASERROR=1 +$EXE -H -e main -V -D -Od -H -i --invert-y hlsl.y-negate-3.vert > $TARGETDIR/hlsl.y-negate-3.vert.out +diff -b $BASEDIR/hlsl.y-negate-3.vert.out $TARGETDIR/hlsl.y-negate-3.vert.out || HASERROR=1 + +# +# Testing hlsl_functionality1 +# +echo "Testing hlsl_functionality1" +$EXE -H -e main -D -Od -fhlsl_functionality1 hlsl.structbuffer.incdec.frag > \ + $TARGETDIR/hlsl.structbuffer.incdec.frag.hlslfun1.out +diff -b $BASEDIR/hlsl.structbuffer.incdec.frag.hlslfun1.out $TARGETDIR/hlsl.structbuffer.incdec.frag.hlslfun1.out || HASERROR=1 +$EXE -H -e main -D -Od -fhlsl_functionality1 hlsl.noSemantic.functionality1.comp > \ + $TARGETDIR/hlsl.noSemantic.functionality1.comp.out +diff -b $BASEDIR/hlsl.noSemantic.functionality1.comp.out $TARGETDIR/hlsl.noSemantic.functionality1.comp.out || HASERROR=1 + +# +# Testing HLSL-specific PP feature expansion +# +echo "Testing HLSL-specific PP feature expansion" +$EXE -D -E hlsl.pp.expand.frag > $TARGETDIR/hlsl.pp.expand.frag.out 2> $TARGETDIR/hlsl.pp.expand.frag.err +diff -b $BASEDIR/hlsl.pp.expand.frag.out $TARGETDIR/hlsl.pp.expand.frag.out || HASERROR=1 +diff -b $BASEDIR/hlsl.pp.expand.frag.err $TARGETDIR/hlsl.pp.expand.frag.err || HASERROR=1 + # # Final checking # diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/runtimeArray.vert b/3rdparty/bgfx/3rdparty/glslang/Test/runtimeArray.vert new file mode 100644 index 00000000000..a5da4f41917 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/runtimeArray.vert @@ -0,0 +1,110 @@ +#version 450 core + +buffer bn { + int a[]; + float b[]; +} buf; + +uniform un { + int a[]; + float b[]; +} ubuf; + +buffer bna { + int a[]; + float b[]; +} bufa[4]; + +uniform una { + int a[]; + float b[]; +} ubufa[4]; + +buffer abn { + int aba[]; + float abb[]; +}; + +uniform aun { + int aua[]; + float aub[]; +}; + +layout(binding=1) uniform samplerBuffer uniformTexelBufferDyn[]; +layout(binding=2, r32f) uniform imageBuffer storageTexelBufferDyn[]; +layout(binding=3) uniform uname { float a; } uniformBuffer[]; +layout(binding=4) buffer bname { float b; } storageBuffer[]; +layout(binding=5) uniform sampler2D sampledImage[]; +layout(binding=6, r32f) uniform image2D storageImage[]; +layout(binding=8) uniform samplerBuffer uniformTexelBuffer[]; +layout(binding=9, r32f) uniform imageBuffer storageTexelBuffer[]; + +int i; + +void main() +{ + ubuf.a[3]; + ubuf.b[3]; + buf.a[3]; + buf.b[3]; + + ubufa[3].a[3]; + ubufa[3].b[3]; + bufa[3].a[3]; + bufa[3].b[3]; + + aua[3]; + aub[3]; + aba[3]; + abb[3]; + + ubuf.a[i]; // ERROR + ubuf.b[i]; // ERROR + buf.a[i]; // ERROR + buf.b[i]; + + ubuf.a.length(); // ERROR + ubuf.b.length(); // ERROR + buf.a.length(); // ERROR + buf.b.length(); + + ubufa[1].a[i]; // ERROR + ubufa[1].b[i]; // ERROR + bufa[1].a[i]; // ERROR + bufa[1].b[i]; + + ubufa[1].a.length(); // ERROR + ubufa[1].b.length(); // ERROR + bufa[1].a.length(); // ERROR + bufa[1].b.length(); + + aua[i]; // ERROR + aub[i]; // ERROR + aba[i]; // ERROR + abb[i]; + + aua.length(); // ERROR + aub.length(); // ERROR + aba.length(); // ERROR + abb.length(); + + uniformTexelBufferDyn[1]; + storageTexelBufferDyn[1]; + uniformBuffer[1]; + storageBuffer[1]; + sampledImage[1]; + storageImage[1]; + uniformTexelBuffer[1]; + storageTexelBuffer[1]; + + uniformTexelBufferDyn[i]; // ERROR, need extension + storageTexelBufferDyn[i]; // ERROR, need extension + uniformBuffer[i]; // ERROR, need extension + storageBuffer[i]; // ERROR, need extension + sampledImage[i]; // ERROR, need extension + storageImage[i]; // ERROR, need extension + uniformTexelBuffer[i]; // ERROR, need extension + storageTexelBuffer[i]; // ERROR, need extension + + float local[] = ubuf.b; // ERROR, can initialize with runtime-sized array +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/samplerlessTextureFunctions.frag b/3rdparty/bgfx/3rdparty/glslang/Test/samplerlessTextureFunctions.frag new file mode 100644 index 00000000000..0926850309d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/samplerlessTextureFunctions.frag @@ -0,0 +1,46 @@ +#version 450 core + +layout(binding = 1) uniform texture2D tex2D; +layout(binding = 1) uniform texture2DMS texMS; +layout(binding = 0) uniform textureBuffer buf; + +void testBad() +{ + vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0); + vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0); + + // Allowed by KHR_vulkan_glsl without the extension. All others should + // error. + vec4 bufFetch = texelFetch(buf, 0); + + vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0)); + + ivec2 tex2DSize = textureSize(tex2D, 0); + ivec2 texMSSize = textureSize(texMS); + int bufSize = textureSize(buf); + + int tex2DLevels = textureQueryLevels(tex2D); + + int texMSSamples = textureSamples(texMS); +} + +#extension GL_EXT_samplerless_texture_functions : enable + +void main() +{ + // These should all succeed. + + vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0); + vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0); + vec4 bufFetch = texelFetch(buf, 0); + + vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0)); + + ivec2 tex2DSize = textureSize(tex2D, 0); + ivec2 texMSSize = textureSize(texMS); + int bufSize = textureSize(buf); + + int tex2DLevels = textureQueryLevels(tex2D); + + int texMSSamples = textureSamples(texMS); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.1.3.8bitstorage-ssbo.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.1.3.8bitstorage-ssbo.vert new file mode 100644 index 00000000000..61ba7bf1523 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.1.3.8bitstorage-ssbo.vert @@ -0,0 +1,15 @@ +#version 450 + +#extension GL_EXT_shader_8bit_storage: require + +layout(binding = 0) readonly buffer Vertices +{ + uint8_t vertices[]; +}; + +layout(location = 0) out vec4 color; + +void main() +{ + color = vec4(int(vertices[gl_VertexIndex])); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.1.3.8bitstorage-ubo.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.1.3.8bitstorage-ubo.vert new file mode 100644 index 00000000000..5c49a243424 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.1.3.8bitstorage-ubo.vert @@ -0,0 +1,15 @@ +#version 450 + +#extension GL_EXT_shader_8bit_storage: require + +layout(binding = 0) readonly uniform Vertices +{ + uint8_t vertices[512]; +}; + +layout(location = 0) out vec4 color; + +void main() +{ + color = vec4(int(vertices[gl_VertexIndex])); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage-int.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage-int.frag new file mode 100644 index 00000000000..57be67ee956 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage-int.frag @@ -0,0 +1,90 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage : enable + +struct S +{ + int16_t x; + i16vec2 y; + i16vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + int16_t a; + i16vec2 b; + i16vec3 c; + int16_t d[2]; + S g; + S h[2]; + int j; +} b1; + +layout(row_major, std430) buffer B2 +{ + int16_t o; + i16vec2 p; + i16vec3 q; + int16_t r[2]; + S u; + S v[2]; + i16vec2 x[100]; + int16_t w[]; +} b2; + +layout(row_major, std140) uniform B5 +{ + int16_t o; + i16vec2 p; + i16vec3 q; + int16_t r[2]; + S u; + S v[2]; + i16vec2 x[100]; + int16_t w[100]; +} b5; + +struct S2 { + mat4x4 x; + int16_t y; + int z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; + S3 y; +} b4; + +void main() +{ + b2.o = b1.a; + b2.p = i16vec2(ivec3(b2.q).xy); + b2.p = i16vec2(ivec3(b5.q).xy); + b2.r[0] = b2.r[0]; + b2.r[1] = b5.r[1]; + b2.p = b2.p; + int x0 = int(b1.a); + ivec4 x1 = ivec4(b1.a, b2.p, 1); + b4.x.x = b3.x.x; + b2.o = int16_t(ivec2(b2.p).x); + b2.p = b2.v[1].y; + ivec3 v3 = ivec3(b2.w[b1.j], b2.w[b1.j+1], b2.w[b1.j+2]); + ivec3 u3 = ivec3(b5.w[b1.j], b5.w[b1.j+1], b5.w[b1.j+2]); + b2.x[0] = b2.x[0]; + b2.x[1] = b5.x[1]; + b2.p.x = b1.a; + b2.o = b2.p.x; + b2.p = i16vec2(ivec2(1, 2)); + b2.o = int16_t(3); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage-uint.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage-uint.frag new file mode 100644 index 00000000000..aeecd0419c1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage-uint.frag @@ -0,0 +1,90 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage : enable + +struct S +{ + uint16_t x; + u16vec2 y; + u16vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + uint16_t a; + u16vec2 b; + u16vec3 c; + uint16_t d[2]; + S g; + S h[2]; + uint j; +} b1; + +layout(row_major, std430) buffer B2 +{ + uint16_t o; + u16vec2 p; + u16vec3 q; + uint16_t r[2]; + S u; + S v[2]; + u16vec2 x[100]; + uint16_t w[]; +} b2; + +layout(row_major, std140) uniform B5 +{ + uint16_t o; + u16vec2 p; + u16vec3 q; + uint16_t r[2]; + S u; + S v[2]; + u16vec2 x[100]; + uint16_t w[100]; +} b5; + +struct S2 { + mat4x4 x; + uint16_t y; + uint z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; + S3 y; +} b4; + +void main() +{ + b2.o = b1.a; + b2.p = u16vec2(uvec3(b2.q).xy); + b2.p = u16vec2(uvec3(b5.q).xy); + b2.r[0] = b2.r[0]; + b2.r[1] = b5.r[1]; + b2.p = b2.p; + uint x0 = uint(b1.a); + uvec4 x1 = uvec4(b1.a, b2.p, 1); + b4.x.x = b3.x.x; + b2.o = uint16_t(uvec2(b2.p).x); + b2.p = b2.v[1].y; + uvec3 v3 = uvec3(b2.w[b1.j], b2.w[b1.j+1], b2.w[b1.j+2]); + uvec3 u3 = uvec3(b5.w[b1.j], b5.w[b1.j+1], b5.w[b1.j+2]); + b2.x[0] = b2.x[0]; + b2.x[1] = b5.x[1]; + b2.p.x = b1.a; + b2.o = b2.p.x; + b2.p = u16vec2(uvec2(1, 2)); + b2.o = uint16_t(3u); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage.frag new file mode 100644 index 00000000000..b821be1e1a5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage.frag @@ -0,0 +1,90 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage : enable + +struct S +{ + float16_t x; + f16vec2 y; + f16vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + float16_t a; + f16vec2 b; + f16vec3 c; + float16_t d[2]; + S g; + S h[2]; + int j; +} b1; + +layout(row_major, std430) buffer B2 +{ + float16_t o; + f16vec2 p; + f16vec3 q; + float16_t r[2]; + S u; + S v[2]; + f16vec2 x[100]; + float16_t w[]; +} b2; + +layout(row_major, std140) uniform B5 +{ + float16_t o; + f16vec2 p; + f16vec3 q; + float16_t r[2]; + S u; + S v[2]; + f16vec2 x[100]; + float16_t w[100]; +} b5; + +struct S2 { + mat4x4 x; + float16_t y; + float z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; + S3 y; +} b4; + +void main() +{ + b2.o = b1.a; + b2.p = f16vec2(vec3(b2.q).xy); + b2.p = f16vec2(vec3(b5.q).xy); + b2.r[0] = b2.r[0]; + b2.r[1] = b5.r[1]; + b2.p = b2.p; + float x0 = float(b1.a); + vec4 x1 = vec4(b1.a, b2.p, 1.0); + b4.x.x = b3.x.x; + b2.o = float16_t(vec2(b2.p).x); + b2.p = b2.v[1].y; + vec3 v3 = vec3(b2.w[b1.j], b2.w[b1.j+1], b2.w[b1.j+2]); + vec3 u3 = vec3(b5.w[b1.j], b5.w[b1.j+1], b5.w[b1.j+2]); + b2.x[0] = b2.x[0]; + b2.x[1] = b5.x[1]; + b2.p.x = b1.a; + b2.o = b2.p.x; + b2.p = f16vec2(vec2(1.0, 2.0)); + b2.o = float16_t(3.0); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error-int.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error-int.frag new file mode 100644 index 00000000000..1897b026c6b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error-int.frag @@ -0,0 +1,101 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage : enable + +struct S +{ + int16_t x; + i16vec2 y; + i16vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + int16_t a; + i16vec2 b; + i16vec3 c; + int16_t d[2]; + S g; + S h[2]; + int j; +} b1; + +layout(row_major, std430) buffer B2 +{ + int16_t o; + i16vec2 p; + i16vec3 q; + int16_t r[2]; + S u; + S v[2]; + int16_t w[]; +} b2; + +struct S2 { + mat4x4 x; + int16_t y; + int z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; +} b4; + +void func3(S2 x) { +} + +S2 func4() { + return b4.x; +} + +int func(int16_t a) { + return 0; +} + +struct S4 { + int x; + int16_t y; +}; + +int func2(int a) { return 0; } + +void main() +{ + b2.o = b2.q[1]; + b2.p = b2.q.xy; + b2.o = max(b1.a, b1.a); + bvec2 bv = lessThan(b2.p, b2.p); + b2.o = b1.a + b1.a; + b2.o = -b1.a; + b2.o = b1.a + 1; + b2.p = b2.p.yx; + b4.x = b3.x; + int16_t f0; + S2 f1; + S3 f2; + if (b1.a == b1.a) {} + b2.r = b2.r; + b2.p = i16vec2(3, 4); + i16vec2[2](i16vec2(ivec2(1,2)), i16vec2(ivec2(3,4))); + // NOT ERRORING YET + b3.x; + S4(0, int16_t(0)); + func2(b1.a); +} + + +layout(column_major, std140) uniform B6 +{ + i16mat2x3 e; +} b6; + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error-uint.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error-uint.frag new file mode 100644 index 00000000000..5f32a3b7f95 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error-uint.frag @@ -0,0 +1,101 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage : enable + +struct S +{ + uint16_t x; + u16vec2 y; + u16vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + uint16_t a; + u16vec2 b; + u16vec3 c; + uint16_t d[2]; + S g; + S h[2]; + uint j; +} b1; + +layout(row_major, std430) buffer B2 +{ + uint16_t o; + u16vec2 p; + u16vec3 q; + uint16_t r[2]; + S u; + S v[2]; + uint16_t w[]; +} b2; + +struct S2 { + mat4x4 x; + uint16_t y; + uint z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; +} b4; + +void func3(S2 x) { +} + +S2 func4() { + return b4.x; +} + +uint func(uint16_t a) { + return 0; +} + +struct S4 { + uint x; + uint16_t y; +}; + +uint func2(uint a) { return 0; } + +void main() +{ + b2.o = b2.q[1]; + b2.p = b2.q.xy; + b2.o = max(b1.a, b1.a); + bvec2 bv = lessThan(b2.p, b2.p); + b2.o = b1.a + b1.a; + b2.o = -b1.a; + b2.o = b1.a + 1; + b2.p = b2.p.yx; + b4.x = b3.x; + uint16_t f0; + S2 f1; + S3 f2; + if (b1.a == b1.a) {} + b2.r = b2.r; + b2.p = u16vec2(3, 4); + u16vec2[2](u16vec2(uvec2(1,2)), u16vec2(uvec2(3,4))); + // NOT ERRORING YET + b3.x; + S4(0u, uint16_t(0u)); + func2(b1.a); +} + + +layout(column_major, std140) uniform B6 +{ + u16mat2x3 e; +} b6; + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error.frag new file mode 100644 index 00000000000..7a61a97ff86 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.16bitstorage_Error.frag @@ -0,0 +1,102 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage : enable + +struct S +{ + float16_t x; + f16vec2 y; + f16vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + float16_t a; + f16vec2 b; + f16vec3 c; + float16_t d[2]; + S g; + S h[2]; + int j; +} b1; + +layout(row_major, std430) buffer B2 +{ + float16_t o; + f16vec2 p; + f16vec3 q; + float16_t r[2]; + S u; + S v[2]; + float16_t w[]; +} b2; + +struct S2 { + mat4x4 x; + float16_t y; + float z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; +} b4; + +void func3(S2 x) { +} + +S2 func4() { + return b4.x; +} + +float func(float16_t a) { + return 0.0; +} + +struct S4 { + float x; + float16_t y; +}; + +float func2(float a) { return 0.0; } + +void main() +{ + b2.o = b2.q[1]; + b2.p = b2.q.xy; + b2.o = max(b1.a, b1.a); + bvec2 bv = lessThan(b2.p, b2.p); + b2.o = b1.a + b1.a; + b2.o = -b1.a; + b2.o = b1.a + 1.0; + b2.p = b2.p.yx; + b4.x = b3.x; + float16_t f0; + S2 f1; + S3 f2; + if (b1.a == b1.a) {} + b2.r = b2.r; + b2.o = 1.0HF; + b2.p = f16vec2(3.0, 4.0); + f16vec2[2](f16vec2(vec2(1.0,2.0)), f16vec2(vec2(3.0,4.0))); + // NOT ERRORING YET + b3.x; + S4(0.0, float16_t(0.0)); + func2(b1.a); +} + + +layout(column_major, std140) uniform B6 +{ + f16mat2x3 e; +} b6; + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.310.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.310.comp index 6cbb0430f94..53117dd9775 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.310.comp +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.310.comp @@ -37,4 +37,6 @@ void main() outnames.va[gl_LocalInvocationID.x] = vec4(s); outnames.s = outbname.uns.length(); gl_DeviceIndex; + memoryBarrierShared(); + groupMemoryBarrier(); } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.320.meshShaderUserDefined.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.320.meshShaderUserDefined.mesh new file mode 100644 index 00000000000..60a145290eb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.320.meshShaderUserDefined.mesh @@ -0,0 +1,59 @@ +#version 320 es + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of user defined interface out blocks: + +// per-primitive block +perprimitiveNV layout(location=0) out myblock { + float f; + float fArr[4]; + vec3 pos; + vec4 posArr[4]; + mat4 m; + mat3 mArr[2]; +} blk[]; + +// per-vertex block +layout(location=20) out myblock2 { + float f; + vec4 pos; + mat4 m; +} blk2[]; + +void main() +{ + int iid = int(gl_LocalInvocationID.x); + int gid = int(gl_WorkGroupID.x); + + blk[iid].f = 11.0; + blk[iid+1].fArr[gid] = blk[iid].f; + blk[iid/2].pos.yzx = vec3(14.0, 15.0, 13.0); + blk[iid*2].posArr[1].yzw = blk[iid/2].pos; + blk[iid/4].m[2].wzyx = vec4(13.0, 14.0, 15.0, 16.0); + blk[iid].mArr[0][1][1] = blk[iid/4].m[2].w; + blk[iid*4].mArr[1][gid] = vec3(17.0, 18.0, 19.0); + + BARRIER(); + + blk2[iid].f = blk2[iid-1].f + 20.0; + blk2[iid].pos = vec4(21.0, 22.0, 23.0, 24.0); + blk2[iid+1].m[gid] = blk2[iid].pos; + blk2[iid+1].m[gid][2] = 29.0; + blk2[iid+2].m[3] = blk2[iid+1].m[gid]; + + BARRIER(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-int.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-int.frag new file mode 100644 index 00000000000..93203c36cd8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-int.frag @@ -0,0 +1,90 @@ +#version 450 core + +#extension GL_EXT_shader_8bit_storage : enable + +struct S +{ + int8_t x; + i8vec2 y; + i8vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + int8_t a; + i8vec2 b; + i8vec3 c; + int8_t d[2]; + S g; + S h[2]; + int j; +} b1; + +layout(row_major, std430) buffer B2 +{ + int8_t o; + i8vec2 p; + i8vec3 q; + int8_t r[2]; + S u; + S v[2]; + i8vec2 x[100]; + int8_t w[]; +} b2; + +layout(row_major, std140) uniform B5 +{ + int8_t o; + i8vec2 p; + i8vec3 q; + int8_t r[2]; + S u; + S v[2]; + i8vec2 x[100]; + int8_t w[100]; +} b5; + +struct S2 { + mat4x4 x; + int8_t y; + int z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; + S3 y; +} b4; + +void main() +{ + b2.o = b1.a; + b2.p = i8vec2(ivec3(b2.q).xy); + b2.p = i8vec2(ivec3(b5.q).xy); + b2.r[0] = b2.r[0]; + b2.r[1] = b5.r[1]; + b2.p = b2.p; + int x0 = int(b1.a); + ivec4 x1 = ivec4(b1.a, b2.p, 1); + b4.x.x = b3.x.x; + b2.o = int8_t(ivec2(b2.p).x); + b2.p = b2.v[1].y; + ivec3 v3 = ivec3(b2.w[b1.j], b2.w[b1.j+1], b2.w[b1.j+2]); + ivec3 u3 = ivec3(b5.w[b1.j], b5.w[b1.j+1], b5.w[b1.j+2]); + b2.x[0] = b2.x[0]; + b2.x[1] = b5.x[1]; + b2.p.x = b1.a; + b2.o = b2.p.x; + b2.p = i8vec2(ivec2(1, 2)); + b2.o = int8_t(3); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-ssbo.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-ssbo.vert new file mode 100644 index 00000000000..61ba7bf1523 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-ssbo.vert @@ -0,0 +1,15 @@ +#version 450 + +#extension GL_EXT_shader_8bit_storage: require + +layout(binding = 0) readonly buffer Vertices +{ + uint8_t vertices[]; +}; + +layout(location = 0) out vec4 color; + +void main() +{ + color = vec4(int(vertices[gl_VertexIndex])); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-ubo.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-ubo.vert new file mode 100644 index 00000000000..5c49a243424 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-ubo.vert @@ -0,0 +1,15 @@ +#version 450 + +#extension GL_EXT_shader_8bit_storage: require + +layout(binding = 0) readonly uniform Vertices +{ + uint8_t vertices[512]; +}; + +layout(location = 0) out vec4 color; + +void main() +{ + color = vec4(int(vertices[gl_VertexIndex])); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-uint.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-uint.frag new file mode 100644 index 00000000000..574d088edc5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage-uint.frag @@ -0,0 +1,90 @@ +#version 450 core + +#extension GL_EXT_shader_8bit_storage : enable + +struct S +{ + uint8_t x; + u8vec2 y; + u8vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + uint8_t a; + u8vec2 b; + u8vec3 c; + uint8_t d[2]; + S g; + S h[2]; + uint j; +} b1; + +layout(row_major, std430) buffer B2 +{ + uint8_t o; + u8vec2 p; + u8vec3 q; + uint8_t r[2]; + S u; + S v[2]; + u8vec2 x[100]; + uint8_t w[]; +} b2; + +layout(row_major, std140) uniform B5 +{ + uint8_t o; + u8vec2 p; + u8vec3 q; + uint8_t r[2]; + S u; + S v[2]; + u8vec2 x[100]; + uint8_t w[100]; +} b5; + +struct S2 { + mat4x4 x; + uint8_t y; + uint z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; + S3 y; +} b4; + +void main() +{ + b2.o = b1.a; + b2.p = u8vec2(uvec3(b2.q).xy); + b2.p = u8vec2(uvec3(b5.q).xy); + b2.r[0] = b2.r[0]; + b2.r[1] = b5.r[1]; + b2.p = b2.p; + uint x0 = uint(b1.a); + uvec4 x1 = uvec4(b1.a, b2.p, 1); + b4.x.x = b3.x.x; + b2.o = uint8_t(uvec2(b2.p).x); + b2.p = b2.v[1].y; + uvec3 v3 = uvec3(b2.w[b1.j], b2.w[b1.j+1], b2.w[b1.j+2]); + uvec3 u3 = uvec3(b5.w[b1.j], b5.w[b1.j+1], b5.w[b1.j+2]); + b2.x[0] = b2.x[0]; + b2.x[1] = b5.x[1]; + b2.p.x = b1.a; + b2.o = b2.p.x; + b2.p = u8vec2(uvec2(1, 2)); + b2.o = uint8_t(3u); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage_Error-int.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage_Error-int.frag new file mode 100644 index 00000000000..35fe182671e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage_Error-int.frag @@ -0,0 +1,101 @@ +#version 450 core + +#extension GL_EXT_shader_8bit_storage : enable + +struct S +{ + int8_t x; + i8vec2 y; + i8vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + int8_t a; + i8vec2 b; + i8vec3 c; + int8_t d[2]; + S g; + S h[2]; + int j; +} b1; + +layout(row_major, std430) buffer B2 +{ + int8_t o; + i8vec2 p; + i8vec3 q; + int8_t r[2]; + S u; + S v[2]; + int8_t w[]; +} b2; + +struct S2 { + mat4x4 x; + int8_t y; + int z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; +} b4; + +void func3(S2 x) { +} + +S2 func4() { + return b4.x; +} + +int func(int8_t a) { + return 0; +} + +struct S4 { + int x; + int8_t y; +}; + +int func2(int a) { return 0; } + +void main() +{ + b2.o = b2.q[1]; + b2.p = b2.q.xy; + b2.o = max(b1.a, b1.a); + bvec2 bv = lessThan(b2.p, b2.p); + b2.o = b1.a + b1.a; + b2.o = -b1.a; + b2.o = b1.a + 1; + b2.p = b2.p.yx; + b4.x = b3.x; + int8_t f0; + S2 f1; + S3 f2; + if (b1.a == b1.a) {} + b2.r = b2.r; + b2.p = i8vec2(3, 4); + i8vec2[2](i8vec2(ivec2(1,2)), i8vec2(ivec2(3,4))); + // NOT ERRORING YET + b3.x; + S4(0, int8_t(0)); + func2(b1.a); +} + + +layout(column_major, std140) uniform B6 +{ + i8mat2x3 e; +} b6; + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage_Error-uint.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage_Error-uint.frag new file mode 100644 index 00000000000..5d0209f0cb7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.8bitstorage_Error-uint.frag @@ -0,0 +1,101 @@ +#version 450 core + +#extension GL_EXT_shader_8bit_storage : enable + +struct S +{ + uint8_t x; + u8vec2 y; + u8vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + uint8_t a; + u8vec2 b; + u8vec3 c; + uint8_t d[2]; + S g; + S h[2]; + uint j; +} b1; + +layout(row_major, std430) buffer B2 +{ + uint8_t o; + u8vec2 p; + u8vec3 q; + uint8_t r[2]; + S u; + S v[2]; + uint8_t w[]; +} b2; + +struct S2 { + mat4x4 x; + uint8_t y; + uint z; +}; + +struct S3 { + S2 x; +}; + +layout(row_major, std430) buffer B3 +{ + S2 x; +} b3; + +layout(column_major, std430) buffer B4 +{ + S2 x; +} b4; + +void func3(S2 x) { +} + +S2 func4() { + return b4.x; +} + +uint func(uint8_t a) { + return 0; +} + +struct S4 { + uint x; + uint8_t y; +}; + +uint func2(uint a) { return 0; } + +void main() +{ + b2.o = b2.q[1]; + b2.p = b2.q.xy; + b2.o = max(b1.a, b1.a); + bvec2 bv = lessThan(b2.p, b2.p); + b2.o = b1.a + b1.a; + b2.o = -b1.a; + b2.o = b1.a + 1; + b2.p = b2.p.yx; + b4.x = b3.x; + uint8_t f0; + S2 f1; + S3 f2; + if (b1.a == b1.a) {} + b2.r = b2.r; + b2.p = u8vec2(3, 4); + u8vec2[2](u8vec2(uvec2(1,2)), u8vec2(uvec2(3,4))); + // NOT ERRORING YET + b3.x; + S4(0u, uint8_t(0u)); + func2(b1.a); +} + + +layout(column_major, std140) uniform B6 +{ + u8mat2x3 e; +} b6; + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.AnyHitShader.rahit b/3rdparty/bgfx/3rdparty/glslang/Test/spv.AnyHitShader.rahit new file mode 100644 index 00000000000..c03cc2f7852 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.AnyHitShader.rahit @@ -0,0 +1,26 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +layout(location = 1) rayPayloadInNV vec4 incomingPayload; +void main() +{ + uvec3 v0 = gl_LaunchIDNV; + uvec3 v1 = gl_LaunchSizeNV; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexNV; + vec3 v5 = gl_WorldRayOriginNV; + vec3 v6 = gl_WorldRayDirectionNV; + vec3 v7 = gl_ObjectRayOriginNV; + vec3 v8 = gl_ObjectRayDirectionNV; + float v9 = gl_RayTminNV; + float v10 = gl_RayTmaxNV; + float v11 = gl_HitTNV; + uint v12 = gl_HitKindNV; + mat4x3 v13 = gl_ObjectToWorldNV; + mat4x3 v14 = gl_WorldToObjectNV; + incomingPayload = vec4(0.5f); + if (v2 == 1) + ignoreIntersectionNV(); + else + terminateRayNV(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.AnyHitShader_Errors.rahit b/3rdparty/bgfx/3rdparty/glslang/Test/spv.AnyHitShader_Errors.rahit new file mode 100644 index 00000000000..952461eec9a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.AnyHitShader_Errors.rahit @@ -0,0 +1,11 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +hitAttributeNV vec4 payload; +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV; + +void main() +{ + payload.x = 1.0f; // ERROR, cannot write to hitattributeNV in stage + reportIntersectionNV(1.0, 1U); // ERROR, unsupported builtin in stage + traceNV(accNV, 0, 0, 1, 1, 0, vec3(0.0f), 0.5f, vec3(1.0f), 0.75f, 0); // ERROR, unsupported builtin in stage +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.ClosestHitShader.rchit b/3rdparty/bgfx/3rdparty/glslang/Test/spv.ClosestHitShader.rchit new file mode 100644 index 00000000000..7a09b804939 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.ClosestHitShader.rchit @@ -0,0 +1,24 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV; +layout(location = 0) rayPayloadNV vec4 localPayload; +layout(location = 1) rayPayloadInNV vec4 incomingPayload; +void main() +{ + uvec3 v0 = gl_LaunchIDNV; + uvec3 v1 = gl_LaunchSizeNV; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexNV; + vec3 v5 = gl_WorldRayOriginNV; + vec3 v6 = gl_WorldRayDirectionNV; + vec3 v7 = gl_ObjectRayOriginNV; + vec3 v8 = gl_ObjectRayDirectionNV; + float v9 = gl_RayTminNV; + float v10 = gl_RayTmaxNV; + float v11 = gl_HitTNV; + uint v12 = gl_HitKindNV; + mat4x3 v13 = gl_ObjectToWorldNV; + mat4x3 v14 = gl_WorldToObjectNV; + traceNV(accNV, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.ClosestHitShader_Errors.rchit b/3rdparty/bgfx/3rdparty/glslang/Test/spv.ClosestHitShader_Errors.rchit new file mode 100644 index 00000000000..b7b421ec14e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.ClosestHitShader_Errors.rchit @@ -0,0 +1,12 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +hitAttributeNV vec4 payload; +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV; + +void main() +{ + payload.x = 1.0f; // ERROR, cannot write to hitattributeNV in stage + reportIntersectionNV(1.0, 1U); // ERROR, unsupported builtin in stage + terminateRayNV(); + ignoreIntersectionNV(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.IntersectShader.rint b/3rdparty/bgfx/3rdparty/glslang/Test/spv.IntersectShader.rint new file mode 100644 index 00000000000..85ec3199234 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.IntersectShader.rint @@ -0,0 +1,21 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +hitAttributeNV vec4 iAttr; +void main() +{ + uvec3 v0 = gl_LaunchIDNV; + uvec3 v1 = gl_LaunchSizeNV; + int v2 = gl_PrimitiveID; + int v3 = gl_InstanceID; + int v4 = gl_InstanceCustomIndexNV; + vec3 v5 = gl_WorldRayOriginNV; + vec3 v6 = gl_WorldRayDirectionNV; + vec3 v7 = gl_ObjectRayOriginNV; + vec3 v8 = gl_ObjectRayDirectionNV; + float v9 = gl_RayTminNV; + float v10 = gl_RayTmaxNV; + mat4x3 v11 = gl_ObjectToWorldNV; + mat4x3 v12 = gl_WorldToObjectNV; + iAttr = vec4(0.5f,0.5f,0.0f,1.0f); + reportIntersectionNV(0.5, 1U); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.IntersectShader_Errors.rint b/3rdparty/bgfx/3rdparty/glslang/Test/spv.IntersectShader_Errors.rint new file mode 100644 index 00000000000..fbc68465479 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.IntersectShader_Errors.rint @@ -0,0 +1,11 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +rayPayloadInNV vec4 payloadIn; // ERROR, rayPayloadIn unsupported in this stage +rayPayloadNV vec4 payload; // ERROR, rayPayload unsuppoted in this stage +uniform accelerationStructureNV accNV; +void main() +{ + float e12 = gl_HitTNV; // ERROR, unsupported builtin in stage + float e13 = gl_HitKindNV; // ERROR, unsupported builtin in stage + traceNV(accNV, 0, 0, 1, 1, 0, vec3(0.0f), 0.5f, vec3(1.0f), 0.75f, 0); // ERROR, unsupported +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.MissShader.rmiss b/3rdparty/bgfx/3rdparty/glslang/Test/spv.MissShader.rmiss new file mode 100644 index 00000000000..06113debc68 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.MissShader.rmiss @@ -0,0 +1,17 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV; +layout(location = 0) rayPayloadNV vec4 localPayload; +layout(location = 1) rayPayloadInNV vec4 incomingPayload; +void main() +{ + uvec3 v0 = gl_LaunchIDNV; + uvec3 v1 = gl_LaunchSizeNV; + vec3 v2 = gl_WorldRayOriginNV; + vec3 v3 = gl_WorldRayDirectionNV; + vec3 v4 = gl_ObjectRayOriginNV; + vec3 v5 = gl_ObjectRayDirectionNV; + float v6 = gl_RayTminNV; + float v7 = gl_RayTmaxNV; + traceNV(accNV, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.MissShader_Errors.rmiss b/3rdparty/bgfx/3rdparty/glslang/Test/spv.MissShader_Errors.rmiss new file mode 100644 index 00000000000..a7f7c59c3e9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.MissShader_Errors.rmiss @@ -0,0 +1,16 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +hitAttributeNV vec4 payload; // ERROR, hitattributeNV unsupported in this stage +void main() +{ + int e0 = gl_PrimitiveID; // ERROR, unsupported builtin in stage + int e1 = gl_InstanceID; // ERROR, unsupported builtin in stage + int e3 = gl_InstanceCustomIndexNV; // ERROR, unsupported builtin in stage + mat4x3 e10 = gl_ObjectToWorldNV; // ERROR, unsupported builtin in stage + mat4x3 e11 = gl_WorldToObjectNV; // ERROR, unsupported builtin in stage + float e12 = gl_HitTNV; // ERROR, unsupported builtin in stage + float e13 = gl_HitKindNV; // ERROR, unsupported builtin in stage + reportIntersectionNV(1.0, 1U); // ERROR, unsupported builtin in stage + ignoreIntersectionNV(); // ERROR, unsupported builtin in stage + terminateRayNV(); // ERROR, unsupported builtin in stage +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayCallable.rcall b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayCallable.rcall new file mode 100644 index 00000000000..12f2884552f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayCallable.rcall @@ -0,0 +1,15 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +layout(location = 0) callableDataNV vec4 data0; +layout(location = 1) callableDataInNV dataBlock { + uint data1; +}; +void main() +{ + uvec3 id = gl_LaunchIDNV; + uvec3 size = gl_LaunchSizeNV; + uint curFlags = gl_IncomingRayFlagsNV; + curFlags = curFlags & gl_RayFlagsOpaqueNV; + data1 = 256U; + executeCallableNV(2,1); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayCallable_Errors.rcall b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayCallable_Errors.rcall new file mode 100644 index 00000000000..73396825202 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayCallable_Errors.rcall @@ -0,0 +1,25 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +hitAttributeNV vec4 hitattr; // ERROR, hitattributeNV unsupported in this stage +rayPayloadNV vec4 payload; // ERROR, rayPayloadNV unsupported in this stage +rayPayloadInNV vec4 payloadIn; // ERROR, rayPayloadInNV unsupported in this stage + +void main() +{ + int e0 = gl_PrimitiveID; // ERROR, unsupported builtin in stage + int e1 = gl_InstanceID; // ERROR, unsupported builtin in stage + int e3 = gl_InstanceCustomIndexNV; // ERROR, unsupported builtin in stage + vec3 e4 = gl_WorldRayOriginNV; // ERROR, unsupported builtin in stage + vec3 e5 = gl_WorldRayDirectionNV; // ERROR, unsupported builtin in stage + vec3 e6 = gl_ObjectRayOriginNV; // ERROR, unsupported builtin in stage + vec3 e7 = gl_ObjectRayDirectionNV; // ERROR, unsupported builtin in stage + float e8 = gl_RayTminNV; // ERROR, unsupported builtin in stage + float e9 = gl_RayTmaxNV; // ERROR, unsupported builtin in stage + mat4x3 e10 = gl_ObjectToWorldNV; // ERROR, unsupported builtin in stage + mat4x3 e11 = gl_WorldToObjectNV; // ERROR, unsupported builtin in stage + float e12 = gl_HitTNV; // ERROR, unsupported builtin in stage + float e13 = gl_HitKindNV; // ERROR, unsupported builtin in stage + reportIntersectionNV(1.0, 1U); // ERROR, unsupported builtin in stage + ignoreIntersectionNV(); // ERROR, unsupported builtin in stage + terminateRayNV(); // ERROR, unsupported builtin in stage +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayConstants.rgen b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayConstants.rgen new file mode 100644 index 00000000000..b8ff5d5f948 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayConstants.rgen @@ -0,0 +1,15 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV; +layout(location = 0) rayPayloadNV vec4 payload; +void main() +{ + const uint rayFlags = gl_RayFlagsNoneNV | gl_RayFlagsOpaqueNV | + gl_RayFlagsNoOpaqueNV | gl_RayFlagsTerminateOnFirstHitNV | + gl_RayFlagsSkipClosestHitShaderNV | gl_RayFlagsCullBackFacingTrianglesNV | + gl_RayFlagsCullFrontFacingTrianglesNV | gl_RayFlagsCullOpaqueNV | + gl_RayFlagsCullNoOpaqueNV; + + const int payloadId = 1; + traceNV(accNV, rayFlags, 0, 1, 1, 0, vec3(0.0f), 0.5f, vec3(1.0f), 0.75f, payloadId); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayGenShader.rgen b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayGenShader.rgen new file mode 100644 index 00000000000..68f92b22d05 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayGenShader.rgen @@ -0,0 +1,19 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +layout(binding = 0, set = 0) uniform accelerationStructureNV accNV; +layout(location = 0) rayPayloadNV vec4 payload; +layout(shaderRecordNV) buffer block +{ + float arr[4]; + vec4 pad; +}; +void main() +{ + uint lx = gl_LaunchIDNV.x; + uint ly = gl_LaunchIDNV.y; + uint sx = gl_LaunchSizeNV.x; + uint sy = gl_LaunchSizeNV.y; + traceNV(accNV, lx, ly, sx, sy, 0u, vec3(0.0f), 0.5f, vec3(1.0f), 0.75f, 1); + arr[3] = 1.0f; + pad = payload; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayGenShader_Errors.rgen b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayGenShader_Errors.rgen new file mode 100644 index 00000000000..d61ac21cc88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.RayGenShader_Errors.rgen @@ -0,0 +1,40 @@ +#version 460 +#extension GL_NV_ray_tracing : enable +hitAttributeNV vec4 payload; // ERROR, hitattributeNV unsupported in this stage +rayPayloadInNV vec4 payloadIn; // ERROR, rayPayloadIn unsupported in this stage +layout(shaderRecordNV) uniform ublock // ERROR, shaderRecordNV unsupported on uniform blocks +{ + float a; +}; +layout(binding = 0, shaderRecordNV) buffer bblock { // ERROR, binding unsupported on shaderRecordNV blocks + float b; +}; +layout(set = 0, shaderRecordNV) buffer bblock2 { // ERROR, set unsupported on shaderRecordNV blocks + float c; +}; +layout(shaderRecordNV) buffer bblock3 { + float d; +}; +layout(shaderRecordNV) buffer bblock4 { // ERROR, cannot have more than one shaderRecordNVX block + float e; +}; +void main() +{ + accelerationStructureNV a = 0; + int e0 = gl_PrimitiveID; // ERROR, unsupported builtin in stage + int e1 = gl_InstanceID; // ERROR, unsupported builtin in stage + int e3 = gl_InstanceCustomIndexNV; // ERROR, unsupported builtin in stage + vec3 e4 = gl_WorldRayOriginNV; // ERROR, unsupported builtin in stage + vec3 e5 = gl_WorldRayDirectionNV; // ERROR, unsupported builtin in stage + vec3 e6 = gl_ObjectRayOriginNV; // ERROR, unsupported builtin in stage + vec3 e7 = gl_ObjectRayDirectionNV; // ERROR, unsupported builtin in stage + float e8 = gl_RayTminNV; // ERROR, unsupported builtin in stage + float e9 = gl_RayTmaxNV; // ERROR, unsupported builtin in stage + mat4x3 e10 = gl_ObjectToWorldNV; // ERROR, unsupported builtin in stage + mat4x3 e11 = gl_WorldToObjectNV; // ERROR, unsupported builtin in stage + float e12 = gl_HitTNV; // ERROR, unsupported builtin in stage + float e13 = gl_HitKindNV; // ERROR, unsupported builtin in stage + reportIntersectionNV(1.0, 1U); // ERROR, unsupported builtin in stage + ignoreIntersectionNV(); // ERROR, unsupported builtin in stage + terminateRayNV(); // ERROR, unsupported builtin in stage +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.accessChain.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.accessChain.frag index c7f805b577a..3f4929b652f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.accessChain.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.accessChain.frag @@ -74,6 +74,11 @@ void GetColor13(const S i, int comp) OutColor.zy[comp] += i.color.x; } +void GetColor14(const S i, int comp) +{ + OutColor.zyx[comp] = i.color.x; +} + void main() { S s; @@ -91,4 +96,5 @@ void main() GetColor11(s, u); GetColor12(s, u); GetColor13(s, u); + GetColor14(s, u); } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.atomicInt64.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.atomicInt64.comp index a56c7ec0300..baca4cefe8c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.atomicInt64.comp +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.atomicInt64.comp @@ -22,7 +22,7 @@ shared Struct s; void main() { const int64_t i64c = -24; - const uint64_t u64c = 0xF00000000F; + const uint64_t u64c = 0xF00000000Ful; // Test shader storage block int64_t i64 = 0; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.barrier.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.barrier.vert new file mode 100644 index 00000000000..c7828ce7b56 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.barrier.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(location=0) out vec4 c0; +layout(location=1) out vec4 c1; + +void main() +{ + c0 = vec4(1.0); + memoryBarrier(); + c1 = vec4(1.0); + memoryBarrierBuffer(); + ++c0; + memoryBarrierImage(); + ++c0; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.builtInXFB.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.builtInXFB.vert new file mode 100644 index 00000000000..619bc1e2fd0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.builtInXFB.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(xfb_buffer = 1, xfb_stride = 64) out; + +layout (xfb_buffer = 1, xfb_offset = 16) out gl_PerVertex +{ + float gl_PointSize; + vec4 gl_Position; +}; + +void main() +{ + gl_Position = vec4(1.0); + gl_PointSize = 2.0; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.computeShaderDerivatives.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.computeShaderDerivatives.comp new file mode 100644 index 00000000000..884f14d585b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.computeShaderDerivatives.comp @@ -0,0 +1,106 @@ +#version 450 +#extension GL_NV_compute_shader_derivatives : require + +layout (local_size_x = 2, local_size_y = 4) in; +layout(derivative_group_quadsNV) in; + +buffer block { + float fDerivativeX; + float fDerivativeY; + float fDerivativeWidth; + float fCoarseDerivativeX; + float fCoarseDerivativeY; + float fCoarseDerivativeWidth; + float fFineDerivativeX; + float fFineDerivativeY; + float fFineDerivativeWidth; + + float fX; + float fY; + + + vec2 v2DerivativeX; + vec2 v2DerivativeY; + vec2 v2DerivativeWidth; + vec2 v2CoarseDerivativeX; + vec2 v2CoarseDerivativeY; + vec2 v2CoarseDerivativeWidth; + vec2 v2FineDerivativeX; + vec2 v2FineDerivativeY; + vec2 v2FineDerivativeWidth; + + vec2 v2X; + vec2 v2Y; + + + vec3 v3DerivativeX; + vec3 v3DerivativeY; + vec3 v3DerivativeWidth; + vec3 v3CoarseDerivativeX; + vec3 v3CoarseDerivativeY; + vec3 v3CoarseDerivativeWidth; + vec3 v3FineDerivativeX; + vec3 v3FineDerivativeY; + vec3 v3FineDerivativeWidth; + + vec3 v3X; + vec3 v3Y; + + + vec4 v4DerivativeX; + vec4 v4DerivativeY; + vec4 v4DerivativeWidth; + vec4 v4CoarseDerivativeX; + vec4 v4CoarseDerivativeY; + vec4 v4CoarseDerivativeWidth; + vec4 v4FineDerivativeX; + vec4 v4FineDerivativeY; + vec4 v4FineDerivativeWidth; + + vec4 v4X; + vec4 v4Y; +}; + +void main(){ + fDerivativeX = dFdx(fX); + fDerivativeY = dFdy(fY); + fDerivativeWidth = fwidth(fX); + fCoarseDerivativeX = dFdxCoarse(fX); + fCoarseDerivativeY = dFdyCoarse(fY); + fCoarseDerivativeWidth = fwidthCoarse(fX); + fFineDerivativeX = dFdxFine(fX); + fFineDerivativeY = dFdyFine(fY); + fFineDerivativeWidth = fwidthFine(fX); + + v2DerivativeX = dFdx(v2X); + v2DerivativeY = dFdy(v2Y); + v2DerivativeWidth = fwidth(v2X); + v2CoarseDerivativeX = dFdxCoarse(v2X); + v2CoarseDerivativeY = dFdyCoarse(v2Y); + v2CoarseDerivativeWidth = fwidthCoarse(v2X); + v2FineDerivativeX = dFdxFine(v2X); + v2FineDerivativeY = dFdyFine(v2Y); + v2FineDerivativeWidth = fwidthFine(v2X); + + + v3DerivativeX = dFdx(v3X); + v3DerivativeY = dFdy(v3Y); + v3DerivativeWidth = fwidth(v3X); + v3CoarseDerivativeX = dFdxCoarse(v3X); + v3CoarseDerivativeY = dFdyCoarse(v3Y); + v3CoarseDerivativeWidth = fwidthCoarse(v3X); + v3FineDerivativeX = dFdxFine(v3X); + v3FineDerivativeY = dFdyFine(v3Y); + v3FineDerivativeWidth = fwidthFine(v3X); + + + v4DerivativeX = dFdx(v4X); + v4DerivativeY = dFdy(v4Y); + v4DerivativeWidth = fwidth(v4X); + v4CoarseDerivativeX = dFdxCoarse(v4X); + v4CoarseDerivativeY = dFdyCoarse(v4Y); + v4CoarseDerivativeWidth = fwidthCoarse(v4X); + v4FineDerivativeX = dFdxFine(v4X); + v4FineDerivativeY = dFdyFine(v4Y); + v4FineDerivativeWidth = fwidthFine(v4X); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.computeShaderDerivatives2.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.computeShaderDerivatives2.comp new file mode 100644 index 00000000000..f964fdd1e03 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.computeShaderDerivatives2.comp @@ -0,0 +1,106 @@ +#version 320 es +#extension GL_NV_compute_shader_derivatives : require + +layout (local_size_x = 2, local_size_y = 4) in; +layout(derivative_group_linearNV) in; + +buffer block { + float fDerivativeX; + float fDerivativeY; + float fDerivativeWidth; + float fCoarseDerivativeX; + float fCoarseDerivativeY; + float fCoarseDerivativeWidth; + float fFineDerivativeX; + float fFineDerivativeY; + float fFineDerivativeWidth; + + float fX; + float fY; + + + vec2 v2DerivativeX; + vec2 v2DerivativeY; + vec2 v2DerivativeWidth; + vec2 v2CoarseDerivativeX; + vec2 v2CoarseDerivativeY; + vec2 v2CoarseDerivativeWidth; + vec2 v2FineDerivativeX; + vec2 v2FineDerivativeY; + vec2 v2FineDerivativeWidth; + + vec2 v2X; + vec2 v2Y; + + + vec3 v3DerivativeX; + vec3 v3DerivativeY; + vec3 v3DerivativeWidth; + vec3 v3CoarseDerivativeX; + vec3 v3CoarseDerivativeY; + vec3 v3CoarseDerivativeWidth; + vec3 v3FineDerivativeX; + vec3 v3FineDerivativeY; + vec3 v3FineDerivativeWidth; + + vec3 v3X; + vec3 v3Y; + + + vec4 v4DerivativeX; + vec4 v4DerivativeY; + vec4 v4DerivativeWidth; + vec4 v4CoarseDerivativeX; + vec4 v4CoarseDerivativeY; + vec4 v4CoarseDerivativeWidth; + vec4 v4FineDerivativeX; + vec4 v4FineDerivativeY; + vec4 v4FineDerivativeWidth; + + vec4 v4X; + vec4 v4Y; +}; + +void main(){ + fDerivativeX = dFdx(fX); + fDerivativeY = dFdy(fY); + fDerivativeWidth = fwidth(fX); + fCoarseDerivativeX = dFdxCoarse(fX); + fCoarseDerivativeY = dFdyCoarse(fY); + fCoarseDerivativeWidth = fwidthCoarse(fX); + fFineDerivativeX = dFdxFine(fX); + fFineDerivativeY = dFdyFine(fY); + fFineDerivativeWidth = fwidthFine(fX); + + v2DerivativeX = dFdx(v2X); + v2DerivativeY = dFdy(v2Y); + v2DerivativeWidth = fwidth(v2X); + v2CoarseDerivativeX = dFdxCoarse(v2X); + v2CoarseDerivativeY = dFdyCoarse(v2Y); + v2CoarseDerivativeWidth = fwidthCoarse(v2X); + v2FineDerivativeX = dFdxFine(v2X); + v2FineDerivativeY = dFdyFine(v2Y); + v2FineDerivativeWidth = fwidthFine(v2X); + + + v3DerivativeX = dFdx(v3X); + v3DerivativeY = dFdy(v3Y); + v3DerivativeWidth = fwidth(v3X); + v3CoarseDerivativeX = dFdxCoarse(v3X); + v3CoarseDerivativeY = dFdyCoarse(v3Y); + v3CoarseDerivativeWidth = fwidthCoarse(v3X); + v3FineDerivativeX = dFdxFine(v3X); + v3FineDerivativeY = dFdyFine(v3Y); + v3FineDerivativeWidth = fwidthFine(v3X); + + + v4DerivativeX = dFdx(v4X); + v4DerivativeY = dFdy(v4Y); + v4DerivativeWidth = fwidth(v4X); + v4CoarseDerivativeX = dFdxCoarse(v4X); + v4CoarseDerivativeY = dFdyCoarse(v4Y); + v4CoarseDerivativeWidth = fwidthCoarse(v4X); + v4FineDerivativeX = dFdxFine(v4X); + v4FineDerivativeY = dFdyFine(v4Y); + v4FineDerivativeWidth = fwidthFine(v4X); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.constStruct.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.constStruct.vert new file mode 100644 index 00000000000..d5dd8da9752 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.constStruct.vert @@ -0,0 +1,22 @@ +#version 450 + +precision highp float; + +struct U { + mat2 m; +}; + +struct T { + mat2 m; +}; + +struct S { + T t; + U u; +}; + +void main() +{ + S s1 = S(T(mat2(1.0)), U(mat2(1.0))); + S s2 = S(T(mat2(1.0)), U(mat2(1.0))); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.controlFlowAttributes.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.controlFlowAttributes.frag new file mode 100644 index 00000000000..6d90c0db2c1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.controlFlowAttributes.frag @@ -0,0 +1,39 @@ +#version 450 + +#extension GL_EXT_control_flow_attributes : enable + +bool cond; + +void main() +{ + [[unroll]] for (int i = 0; i < 8; ++i) { } + [[loop]] for (;;) { } + [[dont_unroll]] while(true) { } + [[dependency_infinite]] do { } while(true); + [[dependency_length(1+3)]] for (int i = 0; i < 8; ++i) { } + [[flatten]] if (cond) { } else { } + [[branch]] if (cond) cond = false; + [[dont_flatten]] switch(3) { } // dropped + [[dont_flatten]] switch(3) { case 3: break; } + + // warnings on all these + [[unroll(2)]] for (int i = 0; i < 8; ++i) { } + [[dont_unroll(-2)]] while(true) { } + [[dependency_infinite(3)]] do { } while(true); + [[dependency_length]] for (int i = 0; i < 8; ++i) { } + [[flatten(3)]] if (cond) { } else { } + [[branch(5.2)]] if (cond) cond = false; + [[dont_flatten(3 + 7)]] switch(3) { case 3: break; } + + // other valid uses + [[ unroll, dont_unroll, dependency_length(2) ]] while(cond) { } + [ [ dont_flatten , branch ] ] switch(3) { case 3: break; } + [ + // attribute + [ + // here + flatten + ] + ] if (cond) { } else { } + [[ dependency_length(2), dependency_infinite ]] while(cond) { } +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.explicittypes.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.explicittypes.frag new file mode 100644 index 00000000000..18c070a7f33 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.explicittypes.frag @@ -0,0 +1,334 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +layout(binding = 0) uniform Uniforms +{ + uint index; +}; + +layout(std140, binding = 1) uniform Block +{ + int16_t i16; + i16vec2 i16v2; + i16vec3 i16v3; + i16vec4 i16v4; + uint16_t u16; + u16vec2 u16v2; + u16vec3 u16v3; + u16vec4 u16v4; + + int32_t i32; + i32vec2 i32v2; + i32vec3 i32v3; + i32vec4 i32v4; + uint32_t u32; + u32vec2 u32v2; + u32vec3 u32v3; + u32vec4 u32v4; +} block; + +void main() +{ +} + +void literal() +{ + const int64_t i64Const[3] = + { + -0x1111111111111111l, // Hex + -1l, // Dec + 040000000000l, // Oct + }; + + int64_t i64 = i64Const[index]; + + const uint64_t u64Const[] = + { + 0xFFFFFFFFFFFFFFFFul, // Hex + 4294967296UL, // Dec + 077777777777ul, // Oct + }; + + uint64_t u64 = u64Const[index]; + + const int32_t i32Const[3] = + { + -0x11111111, // Hex + -1, // Dec + 04000000000, // Oct + }; + + int32_t i32 = i32Const[index]; + + const uint32_t u32Const[] = + { + 0xFFFFFFFF, // Hex + 4294967295, // Dec + 017777777777, // Oct + }; + + uint32_t u32 = u32Const[index]; + + const int16_t i16Const[3] = + { + int16_t(-0x1111), // Hex + int16_t(-1), // Dec + int16_t(040000), // Oct + }; + + int16_t i16 = i16Const[index]; + + const uint16_t u16Const[] = + { + uint16_t(0xFFFF), // Hex + uint16_t(65535), // Dec + uint16_t(077777), // Oct + }; + + uint16_t u16 = u16Const[index]; + + const int8_t i8Const[3] = + { + int8_t(-0x11), // Hex + int8_t(-1), // Dec + int8_t(0400), // Oct + }; + + int8_t i8 = i8Const[index]; + + const uint8_t u8Const[] = + { + uint8_t(0xFF), // Hex + uint8_t(255), // Dec + uint8_t(0177), // Oct + }; + + uint8_t u8 = u8Const[index]; +} + +void typeCast8() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + u8v = i8v; // int8_t -> uint8_t + i16v = i8v; // int8_t -> int16_t + i16v = u8v; // uint8_t -> int16_t + i32v = i8v; // int8_t -> int32_t + i32v = u8v; // uint8_t -> int32_t + u32v = i8v; // int8_t -> uint32_t + i64v = i8v; // int8_t -> int64_t + u64v = i8v; // int8_t -> uint64_t + u32v = u8v; // uint8_t -> uint32_t + i64v = u8v; // uint8_t -> int64_t + u64v = u8v; // uint8_t -> uint64_t + f16v = i8v; // int8_t -> float16_t + f32v = i8v; // int8_t -> float32_t + f64v = i8v; // int8_t -> float64_t + f16v = u8v; // uint8_t -> float16_t + f32v = u8v; // uint8_t -> float32_t + f64v = u8v; // uint8_t -> float64_t + + i8v = i8vec2(u8v); // uint8_t -> int8_t + i16v = i16vec2(i8v); // int8_t -> int16_t + i16v = i16vec2(u8v); // uint8_t -> int16_t + i32v = i32vec2(i8v); // int8_t -> int32_t + i32v = i32vec2(u8v); // uint8_t -> int32_t + i64v = i64vec2(i8v); // int8_t -> int64_t + u64v = i64vec2(i8v); // int8_t -> uint64_t + u16v = u16vec2(i8v); // int8_t -> uint16_t + u16v = u16vec2(u8v); // uint8_t -> uint16_t + u32v = u32vec2(u8v); // uint8_t -> uint32_t + i64v = i64vec2(u8v); // uint8_t -> int64_t + u64v = i64vec2(u8v); // uint8_t -> uint64_t + f16v = f16vec2(i8v); // int8_t -> float16_t + f32v = f32vec2(i8v); // int8_t -> float32_t + f64v = f64vec2(i8v); // int8_t -> float64_t + f16v = f16vec2(u8v); // uint8_t -> float16_t + f32v = f32vec2(u8v); // uint8_t -> float32_t + f64v = f64vec2(u8v); // uint8_t -> float64_t + + i8v = i8vec2(bv); // bool -> int8 + u8v = u8vec2(bv); // bool -> uint8 + bv = bvec2(i8v); // int8 -> bool + bv = bvec2(u8v); // uint8 -> bool +} + +void typeCast16() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + i32v = i16v; // int16_t -> int32_t + i32v = u16v; // uint16_t -> int32_t + u16v = i16v; // int16_t -> uint16_t + u32v = i16v; // int16_t -> uint32_t + i64v = i16v; // int16_t -> int64_t + u64v = i16v; // int16_t -> uint64_t + u32v = u16v; // uint16_t -> uint32_t + i64v = u16v; // uint16_t -> int64_t + u64v = u16v; // uint16_t -> uint64_t + f16v = i16v; // int16_t -> float16_t + f32v = i16v; // int16_t -> float32_t + f64v = i16v; // int16_t -> float64_t + f16v = u16v; // uint16_t -> float16_t + f32v = u16v; // uint16_t -> float32_t + f64v = u16v; // uint16_t -> float64_t + + i32v = i32vec2(i16v); // int16_t -> int32_t + i32v = i32vec2(u16v); // uint16_t -> int32_t + u16v = u16vec2(i16v); // int16_t -> uint16_t + u32v = u32vec2(i16v); // int16_t -> uint32_t + i64v = i64vec2(i16v); // int16_t -> int64_t + u64v = i64vec2(i16v); // int16_t -> uint64_t + u32v = u32vec2(u16v); // uint16_t -> uint32_t + i64v = i64vec2(u16v); // uint16_t -> int64_t + u64v = i64vec2(u16v); // uint16_t -> uint64_t + f16v = f16vec2(i16v); // int16_t -> float16_t + f32v = f32vec2(i16v); // int16_t -> float32_t + f64v = f64vec2(i16v); // int16_t -> float64_t + f16v = f16vec2(u16v); // uint16_t -> float16_t + f32v = f32vec2(u16v); // uint16_t -> float32_t + f64v = f64vec2(u16v); // uint16_t -> float64_t + + i8v = i8vec2(i16v); // int16_t -> int8_t + i8v = i8vec2(u16v); // uint16_t -> int8_t + u8v = u8vec2(i16v); // int16_t -> uint8_t + u8v = u8vec2(u16v); // uint16_t -> uint8_t + i16v = u8vec2(u16v); // uint16_t -> int16_t + i16v = i16vec2(bv); // bool -> int16 + u16v = u16vec2(bv); // bool -> uint16 + bv = bvec2(i16v); // int16 -> bool + bv = bvec2(u16v); // uint16 -> bool +} + +void typeCast32() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + u32v = i32v; // int32_t -> uint32_t + i64v = i32v; // int32_t -> int64_t + u64v = i32v; // int32_t -> uint64_t + i64v = u32v; // uint32_t -> int64_t + u64v = u32v; // uint32_t -> uint64_t + f32v = i32v; // int32_t -> float32_t + f64v = i32v; // int32_t -> float64_t + f32v = u32v; // uint32_t -> float32_t + f64v = u32v; // uint32_t -> float64_t + + i8v = i8vec2(i32v); // int32_t -> int8_t + i8v = i8vec2(u32v); // uint32_t -> int8_t + i16v = i16vec2(i32v); // int32_t -> int16_t + i16v = i16vec2(u32v); // uint32_t -> int16_t + i32v = i32vec2(i32v); // int32_t -> int32_t + i32v = i32vec2(u32v); // uint32_t -> int32_t + i64v = i64vec2(i32v); // int32_t -> int64_t + i64v = i64vec2(u32v); // uint32_t -> int64_t + u8v = u8vec2(i32v); // int32_t -> uint8_t + u8v = u8vec2(u32v); // uint32_t -> uint8_t + u16v = u16vec2(i32v); // int32_t -> uint16_t + u16v = u16vec2(u32v); // uint32_t -> uint16_t + u32v = u32vec2(i32v); // int32_t -> uint32_t + u32v = u32vec2(u32v); // uint32_t -> uint32_t + u64v = u64vec2(i32v); // int32_t -> uint64_t + u64v = u64vec2(u32v); // uint32_t -> uint64_t + + f16v = f16vec2(i32v); // int32_t -> float16_t + f32v = f32vec2(i32v); // int32_t -> float32_t + f64v = f64vec2(i32v); // int32_t -> float64_t + f16v = f16vec2(u32v); // uint32_t -> float16_t + f32v = f32vec2(u32v); // uint32_t -> float32_t + f64v = f64vec2(u32v); // uint32_t -> float64_t + + i32v = i32vec2(bv); // bool -> int32 + u32v = u32vec2(bv); // bool -> uint32 + bv = bvec2(i32v); // int32 -> bool + bv = bvec2(u32v); // uint32 -> bool +} + +void typeCast64() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + u64v = i64v; // int64_t -> uint64_t + f64v = i64v; // int64_t -> float64_t + f64v = u64v; // uint64_t -> float64_t + + i8v = i8vec2(i64v); // int64_t -> int8_t + i8v = i8vec2(u64v); // uint64_t -> int8_t + i16v = i16vec2(i64v); // int64_t -> int16_t + i16v = i16vec2(u64v); // uint64_t -> int16_t + i32v = i32vec2(i64v); // int64_t -> int32_t + i32v = i32vec2(u64v); // uint64_t -> int32_t + i64v = i64vec2(u64v); // uint64_t -> int64_t + u8v = u8vec2(i64v); // int64_t -> uint8_t + u8v = u8vec2(u64v); // uint64_t -> uint8_t + u16v = u16vec2(i64v); // int64_t -> uint16_t + u16v = u16vec2(u64v); // uint64_t -> uint16_t + u32v = u32vec2(i64v); // int64_t -> uint32_t + u32v = u32vec2(u64v); // uint64_t -> uint32_t + u64v = u64vec2(i64v); // int64_t -> uint64_t + u64v = u64vec2(u64v); // uint64_t -> uint64_t + + f16v = f16vec2(i64v); // int64_t -> float16_t + f32v = f32vec2(i64v); // int64_t -> float32_t + f64v = f64vec2(i64v); // int64_t -> float64_t + f16v = f16vec2(u64v); // uint64_t -> float16_t + f32v = f32vec2(u64v); // uint64_t -> float32_t + f64v = f64vec2(u64v); // uint64_t -> float64_t + + i64v = i64vec2(bv); // bool -> int64 + u64v = u64vec2(bv); // bool -> uint64 + bv = bvec2(i64v); // int64 -> bool + bv = bvec2(u64v); // uint64 -> bool +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.float16Fetch.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.float16Fetch.frag new file mode 100644 index 00000000000..b1ba98c8a88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.float16Fetch.frag @@ -0,0 +1,1273 @@ +#version 450 core + +#extension GL_ARB_sparse_texture2: enable +#extension GL_ARB_sparse_texture_clamp: enable +#extension GL_AMD_gpu_shader_half_float: enable +#extension GL_AMD_gpu_shader_half_float_fetch: enable +#extension GL_AMD_texture_gather_bias_lod: enable + +layout(set = 0, binding = 0) uniform f16sampler1D s1D; +layout(set = 0, binding = 1) uniform f16sampler2D s2D; +layout(set = 0, binding = 2) uniform f16sampler3D s3D; +layout(set = 0, binding = 3) uniform f16sampler2DRect s2DRect; +layout(set = 0, binding = 4) uniform f16samplerCube sCube; +layout(set = 0, binding = 5) uniform f16samplerBuffer sBuffer; +layout(set = 0, binding = 6) uniform f16sampler2DMS s2DMS; +layout(set = 0, binding = 7) uniform f16sampler1DArray s1DArray; +layout(set = 0, binding = 8) uniform f16sampler2DArray s2DArray; +layout(set = 0, binding = 9) uniform f16samplerCubeArray sCubeArray; +layout(set = 0, binding = 10) uniform f16sampler2DMSArray s2DMSArray; + +layout(set = 0, binding = 11) uniform f16sampler1DShadow s1DShadow; +layout(set = 0, binding = 12) uniform f16sampler2DShadow s2DShadow; +layout(set = 0, binding = 13) uniform f16sampler2DRectShadow s2DRectShadow; +layout(set = 0, binding = 14) uniform f16samplerCubeShadow sCubeShadow; +layout(set = 0, binding = 15) uniform f16sampler1DArrayShadow s1DArrayShadow; +layout(set = 0, binding = 16) uniform f16sampler2DArrayShadow s2DArrayShadow; +layout(set = 0, binding = 17) uniform f16samplerCubeArrayShadow sCubeArrayShadow; + +layout(set = 1, binding = 0) layout(rgba16f) uniform f16image1D i1D; +layout(set = 1, binding = 1) layout(rgba16f) uniform f16image2D i2D; +layout(set = 1, binding = 2) layout(rgba16f) uniform f16image3D i3D; +layout(set = 1, binding = 3) layout(rgba16f) uniform f16image2DRect i2DRect; +layout(set = 1, binding = 4) layout(rgba16f) uniform f16imageCube iCube; +layout(set = 1, binding = 5) layout(rgba16f) uniform f16image1DArray i1DArray; +layout(set = 1, binding = 6) layout(rgba16f) uniform f16image2DArray i2DArray; +layout(set = 1, binding = 7) layout(rgba16f) uniform f16imageCubeArray iCubeArray; +layout(set = 1, binding = 8) layout(rgba16f) uniform f16imageBuffer iBuffer; +layout(set = 1, binding = 9) layout(rgba16f) uniform f16image2DMS i2DMS; +layout(set = 1, binding = 10) layout(rgba16f) uniform f16image2DMSArray i2DMSArray; + +layout(set = 2, binding = 0) uniform f16texture1D t1D; +layout(set = 2, binding = 1) uniform f16texture2D t2D; +layout(set = 2, binding = 2) uniform f16texture3D t3D; +layout(set = 2, binding = 3) uniform f16texture2DRect t2DRect; +layout(set = 2, binding = 4) uniform f16textureCube tCube; +layout(set = 2, binding = 5) uniform f16texture1DArray t1DArray; +layout(set = 2, binding = 6) uniform f16texture2DArray t2DArray; +layout(set = 2, binding = 7) uniform f16textureCubeArray tCubeArray; +layout(set = 2, binding = 8) uniform f16textureBuffer tBuffer; +layout(set = 2, binding = 9) uniform f16texture2DMS t2DMS; +layout(set = 2, binding = 10) uniform f16texture2DMSArray t2DMSArray; + +layout(set = 2, binding = 11) uniform sampler s; +layout(set = 2, binding = 12) uniform samplerShadow sShadow; + +layout(set = 3, binding = 0, input_attachment_index = 0) uniform f16subpassInput subpass; +layout(set = 3, binding = 1, input_attachment_index = 0) uniform f16subpassInputMS subpassMS; + +layout(location = 0) in float c1; +layout(location = 1) in vec2 c2; +layout(location = 2) in vec3 c3; +layout(location = 3) in vec4 c4; + +layout(location = 4) in float compare; +layout(location = 5) in float lod; +layout(location = 6) in float bias; +layout(location = 7) in float lodClamp; + +layout(location = 8) in float dPdxy1; +layout(location = 9) in vec2 dPdxy2; +layout(location = 10) in vec3 dPdxy3; + +layout(location = 11) in float16_t f16c1; +layout(location = 12) in f16vec2 f16c2; +layout(location = 13) in f16vec3 f16c3; +layout(location = 14) in f16vec4 f16c4; + +layout(location = 15) in float16_t f16lod; +layout(location = 16) in float16_t f16bias; +layout(location = 17) in float16_t f16lodClamp; + +layout(location = 18) in float16_t f16dPdxy1; +layout(location = 19) in f16vec2 f16dPdxy2; +layout(location = 20) in f16vec3 f16dPdxy3; + +const int offset1 = 1; +const ivec2 offset2 = ivec2(1); +const ivec3 offset3 = ivec3(1); +const ivec2 offsets[4] = { offset2, offset2, offset2, offset2 }; + +layout(location = 0) out vec4 fragColor; + +f16vec4 testTexture() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += texture(s1D, c1); + texel += texture(s1D, f16c1, f16bias); + texel += texture(s2D, c2); + texel += texture(s2D, f16c2, f16bias); + texel += texture(s3D, c3); + texel += texture(s3D, f16c3, f16bias); + texel += texture(sCube, c3); + texel += texture(sCube, f16c3, f16bias); + texel.x += texture(s1DShadow, c3); + texel.x += texture(s1DShadow, f16c2, compare, f16bias); + texel.x += texture(s2DShadow, c3); + texel.x += texture(s2DShadow, f16c2, compare, f16bias); + texel.x += texture(sCubeShadow, c4); + texel.x += texture(sCubeShadow, f16c3, compare, f16bias); + texel += texture(s1DArray, c2); + texel += texture(s1DArray, f16c2, f16bias); + texel += texture(s2DArray, c3); + texel += texture(s2DArray, f16c3, f16bias); + texel += texture(sCubeArray, c4); + texel += texture(sCubeArray, f16c4, f16bias); + texel.x += texture(s1DArrayShadow, c3); + texel.x += texture(s1DArrayShadow, f16c2, compare, f16bias); + texel.x += texture(s2DArrayShadow, c4); + texel.x += texture(s2DArrayShadow, f16c3, compare); + texel += texture(s2DRect, c2); + texel += texture(s2DRect, f16c2); + texel.x += texture(s2DRectShadow, c3); + texel.x += texture(s2DRectShadow, f16c2, compare); + texel.x += texture(sCubeArrayShadow, c4, compare); + texel.x += texture(sCubeArrayShadow, f16c4, compare); + + return texel; +} + +f16vec4 testTextureProj() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureProj(s1D, c2); + texel += textureProj(s1D, f16c2, f16bias); + texel += textureProj(s1D, c4); + texel += textureProj(s1D, f16c4, f16bias); + texel += textureProj(s2D, c3); + texel += textureProj(s2D, f16c3, f16bias); + texel += textureProj(s2D, c4); + texel += textureProj(s2D, f16c4, f16bias); + texel += textureProj(s3D, c4); + texel += textureProj(s3D, f16c4, f16bias); + texel.x += textureProj(s1DShadow, c4); + texel.x += textureProj(s1DShadow, f16c3, compare, f16bias); + texel.x += textureProj(s2DShadow, c4); + texel.x += textureProj(s2DShadow, f16c3, compare, f16bias); + texel += textureProj(s2DRect, c3); + texel += textureProj(s2DRect, f16c3); + texel += textureProj(s2DRect, c4); + texel += textureProj(s2DRect, f16c4); + texel.x += textureProj(s2DRectShadow, c4); + texel.x += textureProj(s2DRectShadow, f16c3, compare); + + return texel; +} + +f16vec4 testTextureLod() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureLod(s1D, c1, lod); + texel += textureLod(s1D, f16c1, f16lod); + texel += textureLod(s2D, c2, lod); + texel += textureLod(s2D, f16c2, f16lod); + texel += textureLod(s3D, c3, lod); + texel += textureLod(s3D, f16c3, f16lod); + texel += textureLod(sCube, c3, lod); + texel += textureLod(sCube, f16c3, f16lod); + texel.x += textureLod(s1DShadow, c3, lod); + texel.x += textureLod(s1DShadow, f16c2, compare, f16lod); + texel.x += textureLod(s2DShadow, c3, lod); + texel.x += textureLod(s2DShadow, f16c2, compare, f16lod); + texel += textureLod(s1DArray, c2, lod); + texel += textureLod(s1DArray, f16c2, f16lod); + texel += textureLod(s2DArray, c3, lod); + texel += textureLod(s2DArray, f16c3, f16lod); + texel.x += textureLod(s1DArrayShadow, c3, lod); + texel.x += textureLod(s1DArrayShadow, f16c2, compare, f16lod); + texel += textureLod(sCubeArray, c4, lod); + texel += textureLod(sCubeArray, f16c4, f16lod); + + return texel; +} + +f16vec4 testTextureOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureOffset(s1D, c1, offset1); + texel += textureOffset(s1D, f16c1, offset1, f16bias); + texel += textureOffset(s2D, c2, offset2); + texel += textureOffset(s2D, f16c2, offset2, f16bias); + texel += textureOffset(s3D, c3, offset3); + texel += textureOffset(s3D, f16c3, offset3, f16bias); + texel += textureOffset(s2DRect, c2, offset2); + texel += textureOffset(s2DRect, f16c2, offset2); + texel.x += textureOffset(s2DRectShadow, c3, offset2); + texel.x += textureOffset(s2DRectShadow, f16c2, compare, offset2); + texel.x += textureOffset(s1DShadow, c3, offset1); + texel.x += textureOffset(s1DShadow, f16c2, compare, offset1, f16bias); + texel.x += textureOffset(s2DShadow, c3, offset2); + texel.x += textureOffset(s2DShadow, f16c2, compare, offset2, f16bias); + texel += textureOffset(s1DArray, c2, offset1); + texel += textureOffset(s1DArray, f16c2, offset1, f16bias); + texel += textureOffset(s2DArray, c3, offset2); + texel += textureOffset(s2DArray, f16c3, offset2, f16bias); + texel.x += textureOffset(s1DArrayShadow, c3, offset1); + texel.x += textureOffset(s1DArrayShadow, f16c2, compare, offset1, f16bias); + texel.x += textureOffset(s2DArrayShadow, c4, offset2); + texel.x += textureOffset(s2DArrayShadow, f16c3, compare, offset2); + + return texel; +} + +f16vec4 testTextureProjOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureProjOffset(s1D, c2, offset1); + texel += textureProjOffset(s1D, f16c2, offset1, f16bias); + texel += textureProjOffset(s1D, c4, offset1); + texel += textureProjOffset(s1D, f16c4, offset1, f16bias); + texel += textureProjOffset(s2D, c3, offset2); + texel += textureProjOffset(s2D, f16c3, offset2, f16bias); + texel += textureProjOffset(s2D, c4, offset2); + texel += textureProjOffset(s2D, f16c4, offset2, f16bias); + texel += textureProjOffset(s3D, c4, offset3); + texel += textureProjOffset(s3D, f16c4, offset3, f16bias); + texel += textureProjOffset(s2DRect, c3, offset2); + texel += textureProjOffset(s2DRect, f16c3, offset2); + texel += textureProjOffset(s2DRect, c4, offset2); + texel += textureProjOffset(s2DRect, f16c4, offset2); + texel.x += textureProjOffset(s2DRectShadow, c4, offset2); + texel.x += textureProjOffset(s2DRectShadow, f16c3, compare, offset2); + texel.x += textureProjOffset(s1DShadow, c4, offset1); + texel.x += textureProjOffset(s1DShadow, f16c3, compare, offset1, f16bias); + texel.x += textureProjOffset(s2DShadow, c4, offset2); + texel.x += textureProjOffset(s2DShadow, f16c3, compare, offset2, f16bias); + + return texel; +} + +f16vec4 testTextureLodOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureLodOffset(s1D, c1, lod, offset1); + texel += textureLodOffset(s1D, f16c1, f16lod, offset1); + texel += textureLodOffset(s2D, c2, lod, offset2); + texel += textureLodOffset(s2D, f16c2, f16lod, offset2); + texel += textureLodOffset(s3D, c3, lod, offset3); + texel += textureLodOffset(s3D, f16c3, f16lod, offset3); + texel.x += textureLodOffset(s1DShadow, c3, lod, offset1); + texel.x += textureLodOffset(s1DShadow, f16c2, compare, f16lod, offset1); + texel.x += textureLodOffset(s2DShadow, c3, lod, offset2); + texel.x += textureLodOffset(s2DShadow, f16c2, compare, f16lod, offset2); + texel += textureLodOffset(s1DArray, c2, lod, offset1); + texel += textureLodOffset(s1DArray, f16c2, f16lod, offset1); + texel += textureLodOffset(s2DArray, c3, lod, offset2); + texel += textureLodOffset(s2DArray, f16c3, f16lod, offset2); + texel.x += textureLodOffset(s1DArrayShadow, c3, lod, offset1); + texel.x += textureLodOffset(s1DArrayShadow, f16c2, compare, f16lod, offset1); + + return texel; +} + +f16vec4 testTextureProjLodOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureProjLodOffset(s1D, c2, lod, offset1); + texel += textureProjLodOffset(s1D, f16c2, f16lod, offset1); + texel += textureProjLodOffset(s1D, c4, lod, offset1); + texel += textureProjLodOffset(s1D, f16c4, f16lod, offset1); + texel += textureProjLodOffset(s2D, c3, lod, offset2); + texel += textureProjLodOffset(s2D, f16c3, f16lod, offset2); + texel += textureProjLodOffset(s2D, c4, lod, offset2); + texel += textureProjLodOffset(s2D, f16c4, f16lod, offset2); + texel += textureProjLodOffset(s3D, c4, lod, offset3); + texel += textureProjLodOffset(s3D, f16c4, f16lod, offset3); + texel.x += textureProjLodOffset(s1DShadow, c4, lod, offset1); + texel.x += textureProjLodOffset(s1DShadow, f16c3, compare, f16lod, offset1); + texel.x += textureProjLodOffset(s2DShadow, c4, lod, offset2); + texel.x += textureProjLodOffset(s2DShadow, f16c3, compare, f16lod, offset2); + + return texel; +} + +f16vec4 testTexelFetch() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += texelFetch(s1D, int(c1), int(lod)); + texel += texelFetch(s2D, ivec2(c2), int(lod)); + texel += texelFetch(s3D, ivec3(c3), int(lod)); + texel += texelFetch(s2DRect, ivec2(c2)); + texel += texelFetch(s1DArray, ivec2(c2), int(lod)); + texel += texelFetch(s2DArray, ivec3(c3), int(lod)); + texel += texelFetch(sBuffer, int(c1)); + texel += texelFetch(s2DMS, ivec2(c2), 1); + texel += texelFetch(s2DMSArray, ivec3(c3), 2); + + return texel; +} + +f16vec4 testTexelFetchOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += texelFetchOffset(s1D, int(c1), int(lod), offset1); + texel += texelFetchOffset(s2D, ivec2(c2), int(lod), offset2); + texel += texelFetchOffset(s3D, ivec3(c3), int(lod), offset3); + texel += texelFetchOffset(s2DRect, ivec2(c2), offset2); + texel += texelFetchOffset(s1DArray, ivec2(c2), int(lod), offset1); + texel += texelFetchOffset(s2DArray, ivec3(c3), int(lod), offset2); + + return texel; +} + +f16vec4 testTextureGrad() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGrad(s1D, c1, dPdxy1, dPdxy1); + texel += textureGrad(s1D, f16c1, f16dPdxy1, f16dPdxy1); + texel += textureGrad(s2D, c2, dPdxy2, dPdxy2); + texel += textureGrad(s2D, f16c2, f16dPdxy2, f16dPdxy2); + texel += textureGrad(s3D, c3, dPdxy3, dPdxy3); + texel += textureGrad(s3D, f16c3, f16dPdxy3, f16dPdxy3); + texel += textureGrad(sCube, c3, dPdxy3, dPdxy3); + texel += textureGrad(sCube, f16c3, f16dPdxy3, f16dPdxy3); + texel += textureGrad(s2DRect, c2, dPdxy2, dPdxy2); + texel += textureGrad(s2DRect, f16c2, f16dPdxy2, f16dPdxy2); + texel.x += textureGrad(s2DRectShadow, c3, dPdxy2, dPdxy2); + texel.x += textureGrad(s2DRectShadow, f16c2, compare, f16dPdxy2, f16dPdxy2); + texel.x += textureGrad(s1DShadow, c3, dPdxy1, dPdxy1); + texel.x += textureGrad(s1DShadow, f16c2, compare, f16dPdxy1, f16dPdxy1); + texel.x += textureGrad(s2DShadow, c3, dPdxy2, dPdxy2); + texel.x += textureGrad(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2); + texel.x += textureGrad(sCubeShadow, c4, dPdxy3, dPdxy3); + texel.x += textureGrad(sCubeShadow, f16c3, compare, f16dPdxy3, f16dPdxy3); + texel += textureGrad(s1DArray, c2, dPdxy1, dPdxy1); + texel += textureGrad(s1DArray, f16c2, f16dPdxy1, f16dPdxy1); + texel += textureGrad(s2DArray, c3, dPdxy2, dPdxy2); + texel += textureGrad(s2DArray, f16c3, f16dPdxy2, f16dPdxy2); + texel.x += textureGrad(s1DArrayShadow, c3, dPdxy1, dPdxy1); + texel.x += textureGrad(s1DArrayShadow, f16c2, compare, f16dPdxy1, f16dPdxy1); + texel.x += textureGrad(s2DArrayShadow, c4, dPdxy2, dPdxy2); + texel.x += textureGrad(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2); + texel += textureGrad(sCubeArray, c4, dPdxy3, dPdxy3); + texel += textureGrad(sCubeArray, f16c4, f16dPdxy3, f16dPdxy3); + + return texel; +} + +f16vec4 testTextureGradOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGradOffset(s1D, c1, dPdxy1, dPdxy1, offset1); + texel += textureGradOffset(s1D, f16c1, f16dPdxy1, f16dPdxy1, offset1); + texel += textureGradOffset(s2D, c2, dPdxy2, dPdxy2, offset2); + texel += textureGradOffset(s2D, f16c2, f16dPdxy2, f16dPdxy2, offset2); + texel += textureGradOffset(s3D, c3, dPdxy3, dPdxy3, offset3); + texel += textureGradOffset(s3D, f16c3, f16dPdxy3, f16dPdxy3, offset3); + texel += textureGradOffset(s2DRect, c2, dPdxy2, dPdxy2, offset2); + texel += textureGradOffset(s2DRect, f16c2, f16dPdxy2, f16dPdxy2, offset2); + texel.x += textureGradOffset(s2DRectShadow, c3, dPdxy2, dPdxy2, offset2); + texel.x += textureGradOffset(s2DRectShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, offset2); + texel.x += textureGradOffset(s1DShadow, c3, dPdxy1, dPdxy1, offset1); + texel.x += textureGradOffset(s1DShadow, f16c2, compare, f16dPdxy1, f16dPdxy1, offset1); + texel.x += textureGradOffset(s2DShadow, c3, dPdxy2, dPdxy2, offset2); + texel.x += textureGradOffset(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, offset2); + texel += textureGradOffset(s1DArray, c2, dPdxy1, dPdxy1, offset1); + texel += textureGradOffset(s1DArray, f16c2, f16dPdxy1, f16dPdxy1, offset1); + texel += textureGradOffset(s2DArray, c3, dPdxy2, dPdxy2, offset2); + texel += textureGradOffset(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, offset2); + texel.x += textureGradOffset(s1DArrayShadow, c3, dPdxy1, dPdxy1, offset1); + texel.x += textureGradOffset(s1DArrayShadow, f16c2, compare, f16dPdxy1, f16dPdxy1, offset1); + texel.x += textureGradOffset(s2DArrayShadow, c4, dPdxy2, dPdxy2, offset2); + texel.x += textureGradOffset(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, offset2); + + return texel; +} + +f16vec4 testTextureProjGrad() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureProjGrad(s1D, c2, dPdxy1, dPdxy1); + texel += textureProjGrad(s1D, f16c2, f16dPdxy1, f16dPdxy1); + texel += textureProjGrad(s1D, c4, dPdxy1, dPdxy1); + texel += textureProjGrad(s1D, f16c4, f16dPdxy1, f16dPdxy1); + texel += textureProjGrad(s2D, c3, dPdxy2, dPdxy2); + texel += textureProjGrad(s2D, f16c3, f16dPdxy2, f16dPdxy2); + texel += textureProjGrad(s2D, c4, dPdxy2, dPdxy2); + texel += textureProjGrad(s2D, f16c4, f16dPdxy2, f16dPdxy2); + texel += textureProjGrad(s3D, c4, dPdxy3, dPdxy3); + texel += textureProjGrad(s3D, f16c4, f16dPdxy3, f16dPdxy3); + texel += textureProjGrad(s2DRect, c3, dPdxy2, dPdxy2); + texel += textureProjGrad(s2DRect, f16c3, f16dPdxy2, f16dPdxy2); + texel += textureProjGrad(s2DRect, c4, dPdxy2, dPdxy2); + texel += textureProjGrad(s2DRect, f16c4, f16dPdxy2, f16dPdxy2); + texel.x += textureProjGrad(s2DRectShadow, c4, dPdxy2, dPdxy2); + texel.x += textureProjGrad(s2DRectShadow, f16c3, compare, f16dPdxy2, f16dPdxy2); + texel.x += textureProjGrad(s1DShadow, c4, dPdxy1, dPdxy1); + texel.x += textureProjGrad(s1DShadow, f16c3, compare, f16dPdxy1, f16dPdxy1); + texel.x += textureProjGrad(s2DShadow, c4, dPdxy2, dPdxy2); + texel.x += textureProjGrad(s2DShadow, f16c3, compare, f16dPdxy2, f16dPdxy2); + + return texel; +} + +f16vec4 testTextureProjGradoffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureProjGradOffset(s1D, c2, dPdxy1, dPdxy1, offset1); + texel += textureProjGradOffset(s1D, f16c2, f16dPdxy1, f16dPdxy1, offset1); + texel += textureProjGradOffset(s1D, c4, dPdxy1, dPdxy1, offset1); + texel += textureProjGradOffset(s1D, f16c4, f16dPdxy1, f16dPdxy1, offset1); + texel += textureProjGradOffset(s2D, c3, dPdxy2, dPdxy2, offset2); + texel += textureProjGradOffset(s2D, f16c3, f16dPdxy2, f16dPdxy2, offset2); + texel += textureProjGradOffset(s2D, c4, dPdxy2, dPdxy2, offset2); + texel += textureProjGradOffset(s2D, f16c4, f16dPdxy2, f16dPdxy2, offset2); + texel += textureProjGradOffset(s2DRect, c3, dPdxy2, dPdxy2, offset2); + texel += textureProjGradOffset(s2DRect, f16c3, f16dPdxy2, f16dPdxy2, offset2); + texel += textureProjGradOffset(s2DRect, c4, dPdxy2, dPdxy2, offset2); + texel += textureProjGradOffset(s2DRect, f16c4, f16dPdxy2, f16dPdxy2, offset2); + texel.x += textureProjGradOffset(s2DRectShadow, c4, dPdxy2, dPdxy2, offset2); + texel.x += textureProjGradOffset(s2DRectShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, offset2); + texel += textureProjGradOffset(s3D, c4, dPdxy3, dPdxy3, offset3); + texel += textureProjGradOffset(s3D, f16c4, f16dPdxy3, f16dPdxy3, offset3); + texel.x += textureProjGradOffset(s1DShadow, c4, dPdxy1, dPdxy1, offset1); + texel.x += textureProjGradOffset(s1DShadow, f16c3, compare, f16dPdxy1, f16dPdxy1, offset1); + texel.x += textureProjGradOffset(s2DShadow, c4, dPdxy2, dPdxy2, offset2); + texel.x += textureProjGradOffset(s2DShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, offset2); + + return texel; +} + +f16vec4 testTextureGather() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGather(s2D, c2, 0); + texel += textureGather(s2D, f16c2, 0, f16bias); + texel += textureGather(s2DArray, c3, 0); + texel += textureGather(s2DArray, f16c3, 0, f16bias); + texel += textureGather(sCube, c3, 0); + texel += textureGather(sCube, f16c3, 0, f16bias); + texel += textureGather(sCubeArray, c4, 0); + texel += textureGather(sCubeArray, f16c4, 0, f16bias); + texel += textureGather(s2DRect, c2, 0); + texel += textureGather(s2DRect, f16c2, 0); + texel += textureGather(s2DShadow, c2, compare); + texel += textureGather(s2DShadow, f16c2, compare); + texel += textureGather(s2DArrayShadow, c3, compare); + texel += textureGather(s2DArrayShadow, f16c3, compare); + texel += textureGather(sCubeShadow, c3, compare); + texel += textureGather(sCubeShadow, f16c3, compare); + texel += textureGather(sCubeArrayShadow, c4, compare); + texel += textureGather(sCubeArrayShadow, f16c4, compare); + texel += textureGather(s2DRectShadow, c2, compare); + texel += textureGather(s2DRectShadow, f16c2, compare); + + return texel; +} + +f16vec4 testTextureGatherOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGatherOffset(s2D, c2, offset2, 0); + texel += textureGatherOffset(s2D, f16c2, offset2, 0, f16bias); + texel += textureGatherOffset(s2DArray, c3, offset2, 0); + texel += textureGatherOffset(s2DArray, f16c3, offset2, 0, f16bias); + texel += textureGatherOffset(s2DRect, c2, offset2, 0); + texel += textureGatherOffset(s2DRect, f16c2, offset2, 0); + texel += textureGatherOffset(s2DShadow, c2, compare, offset2); + texel += textureGatherOffset(s2DShadow, f16c2, compare, offset2); + texel += textureGatherOffset(s2DArrayShadow, c3, compare, offset2); + texel += textureGatherOffset(s2DArrayShadow, f16c3, compare, offset2); + texel += textureGatherOffset(s2DRectShadow, c2, compare, offset2); + texel += textureGatherOffset(s2DRectShadow, f16c2, compare, offset2); + + return texel; +} + +f16vec4 testTextureGatherOffsets() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGatherOffsets(s2D, c2, offsets, 0); + texel += textureGatherOffsets(s2D, f16c2, offsets, 0, f16bias); + texel += textureGatherOffsets(s2DArray, c3, offsets, 0); + texel += textureGatherOffsets(s2DArray, f16c3, offsets, 0, f16bias); + texel += textureGatherOffsets(s2DRect, c2, offsets, 0); + texel += textureGatherOffsets(s2DRect, f16c2, offsets, 0); + texel += textureGatherOffsets(s2DShadow, c2, compare, offsets); + texel += textureGatherOffsets(s2DShadow, f16c2, compare, offsets); + texel += textureGatherOffsets(s2DArrayShadow, c3, compare, offsets); + texel += textureGatherOffsets(s2DArrayShadow, f16c3, compare, offsets); + texel += textureGatherOffsets(s2DRectShadow, c2, compare, offsets); + texel += textureGatherOffsets(s2DRectShadow, f16c2, compare, offsets); + + return texel; +} + +f16vec4 testTextureGatherLod() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGatherLodAMD(s2D, c2, lod, 0); + texel += textureGatherLodAMD(s2D, f16c2, f16lod, 0); + texel += textureGatherLodAMD(s2DArray, c3, lod, 0); + texel += textureGatherLodAMD(s2DArray, f16c3, f16lod, 0); + texel += textureGatherLodAMD(sCube, c3, lod, 0); + texel += textureGatherLodAMD(sCube, f16c3, f16lod, 0); + texel += textureGatherLodAMD(sCubeArray, c4, lod, 0); + texel += textureGatherLodAMD(sCubeArray, f16c4, f16lod, 0); + + return texel; +} + +f16vec4 testTextureGatherLodOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGatherLodOffsetAMD(s2D, c2, lod, offset2, 0); + texel += textureGatherLodOffsetAMD(s2D, f16c2, f16lod, offset2, 0); + texel += textureGatherLodOffsetAMD(s2DArray, c3, lod, offset2, 0); + texel += textureGatherLodOffsetAMD(s2DArray, f16c3, f16lod, offset2, 0); + + return texel; +} + +f16vec4 testTextureGatherLodOffsets() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGatherLodOffsetsAMD(s2D, c2, lod, offsets, 0); + texel += textureGatherLodOffsetsAMD(s2D, f16c2, f16lod, offsets, 0); + texel += textureGatherLodOffsetsAMD(s2DArray, c3, lod, offsets, 0); + texel += textureGatherLodOffsetsAMD(s2DArray, f16c3, f16lod, offsets, 0); + + return texel; +} + +ivec4 testTextureSize() +{ + ivec4 size = ivec4(0); + + size.x += textureSize(s1D, int(lod)); + size.xy += textureSize(s2D, int(lod)); + size.xyz += textureSize(s3D, int(lod)); + size.xy += textureSize(sCube, int(lod)); + size.x += textureSize(s1DShadow, int(lod)); + size.xy += textureSize(s2DShadow, int(lod)); + size.xy += textureSize(sCubeShadow, int(lod)); + size.xyz += textureSize(sCubeArray, int(lod)); + size.xyz += textureSize(sCubeArrayShadow, int(lod)); + size.xy += textureSize(s2DRect); + size.xy += textureSize(s2DRectShadow); + size.xy += textureSize(s1DArray, int(lod)); + size.xyz += textureSize(s2DArray, int(lod)); + size.xy += textureSize(s1DArrayShadow, int(lod)); + size.xyz += textureSize(s2DArrayShadow, int(lod)); + size.x += textureSize(sBuffer); + size.xy += textureSize(s2DMS); + size.xyz += textureSize(s2DMSArray); + + return size; +} + +vec2 testTextureQueryLod() +{ + vec2 lod = vec2(0.0); + + lod += textureQueryLod(s1D, c1); + lod += textureQueryLod(s1D, f16c1); + lod += textureQueryLod(s2D, c2); + lod += textureQueryLod(s2D, f16c2); + lod += textureQueryLod(s3D, c3); + lod += textureQueryLod(s3D, f16c3); + lod += textureQueryLod(sCube, c3); + lod += textureQueryLod(sCube, f16c3); + lod += textureQueryLod(s1DArray, c1); + lod += textureQueryLod(s1DArray, f16c1); + lod += textureQueryLod(s2DArray, c2); + lod += textureQueryLod(s2DArray, f16c2); + lod += textureQueryLod(sCubeArray, c3); + lod += textureQueryLod(sCubeArray, f16c3); + lod += textureQueryLod(s1DShadow, c1); + lod += textureQueryLod(s1DShadow, f16c1); + lod += textureQueryLod(s2DShadow, c2); + lod += textureQueryLod(s2DShadow, f16c2); + lod += textureQueryLod(sCubeArrayShadow, c3); + lod += textureQueryLod(sCubeArrayShadow, f16c3); + lod += textureQueryLod(s1DArrayShadow, c1); + lod += textureQueryLod(s1DArrayShadow, f16c1); + lod += textureQueryLod(s2DArrayShadow, c2); + lod += textureQueryLod(s2DArrayShadow, f16c2); + lod += textureQueryLod(sCubeArrayShadow, c3); + lod += textureQueryLod(sCubeArrayShadow, f16c3); + + return lod; +} + +int testTextureQueryLevels() +{ + int levels = 0; + + levels += textureQueryLevels(s1D); + levels += textureQueryLevels(s2D); + levels += textureQueryLevels(s3D); + levels += textureQueryLevels(sCube); + levels += textureQueryLevels(s1DShadow); + levels += textureQueryLevels(s2DShadow); + levels += textureQueryLevels(sCubeShadow); + levels += textureQueryLevels(sCubeArray); + levels += textureQueryLevels(sCubeArrayShadow); + levels += textureQueryLevels(s1DArray); + levels += textureQueryLevels(s2DArray); + levels += textureQueryLevels(s1DArrayShadow); + levels += textureQueryLevels(s2DArrayShadow); + + return levels; +} + +int testTextureSamples() +{ + int samples = 0; + + samples += textureSamples(s2DMS); + samples += textureSamples(s2DMSArray); + + return samples; +} + +f16vec4 testImageLoad() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += imageLoad(i1D, int(c1)); + texel += imageLoad(i2D, ivec2(c2)); + texel += imageLoad(i3D, ivec3(c3)); + texel += imageLoad(i2DRect, ivec2(c2)); + texel += imageLoad(iCube, ivec3(c3)); + texel += imageLoad(iBuffer, int(c1)); + texel += imageLoad(i1DArray, ivec2(c2)); + texel += imageLoad(i2DArray, ivec3(c3)); + texel += imageLoad(iCubeArray, ivec3(c3)); + texel += imageLoad(i2DMS, ivec2(c2), 1); + texel += imageLoad(i2DMSArray, ivec3(c3), 1); + + return texel; +} + +void testImageStore(f16vec4 data) +{ + imageStore(i1D, int(c1), data); + imageStore(i2D, ivec2(c2), data); + imageStore(i3D, ivec3(c3), data); + imageStore(i2DRect, ivec2(c2), data); + imageStore(iCube, ivec3(c3), data); + imageStore(iBuffer, int(c1), data); + imageStore(i1DArray, ivec2(c2), data); + imageStore(i2DArray, ivec3(c3), data); + imageStore(iCubeArray, ivec3(c3), data); + imageStore(i2DMS, ivec2(c2), 1, data); + imageStore(i2DMSArray, ivec3(c3), 1, data); +} + +f16vec4 testSparseTexture() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureARB(s2D, c2, texel); + sparseTextureARB(s2D, f16c2, texel, f16bias); + sparseTextureARB(s3D, c3, texel); + sparseTextureARB(s3D, f16c3, texel, f16bias); + sparseTextureARB(sCube, c3, texel); + sparseTextureARB(sCube, f16c3, texel, f16bias); + sparseTextureARB(s2DShadow, c3, texel.x); + sparseTextureARB(s2DShadow, f16c2, compare, texel.x, f16bias); + sparseTextureARB(sCubeShadow, c4, texel.x); + sparseTextureARB(sCubeShadow, f16c3, compare, texel.x, f16bias); + sparseTextureARB(s2DArray, c3, texel); + sparseTextureARB(s2DArray, f16c3, texel, f16bias); + sparseTextureARB(sCubeArray, c4, texel); + sparseTextureARB(sCubeArray, f16c4, texel, f16bias); + sparseTextureARB(s2DArrayShadow, c4, texel.x); + sparseTextureARB(s2DArrayShadow, f16c3, compare, texel.x); + sparseTextureARB(s2DRect, c2, texel); + sparseTextureARB(s2DRect, f16c2, texel); + sparseTextureARB(s2DRectShadow, c3, texel.x); + sparseTextureARB(s2DRectShadow, f16c2, compare, texel.x); + sparseTextureARB(sCubeArrayShadow, c4, compare, texel.x); + sparseTextureARB(sCubeArrayShadow, f16c4, compare, texel.x); + + return texel; +} + +f16vec4 testSparseTextureLod() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureLodARB(s2D, c2, lod, texel); + sparseTextureLodARB(s2D, f16c2, f16lod, texel); + sparseTextureLodARB(s3D, c3, lod, texel); + sparseTextureLodARB(s3D, f16c3, f16lod, texel); + sparseTextureLodARB(sCube, c3, lod, texel); + sparseTextureLodARB(sCube, f16c3, f16lod, texel); + sparseTextureLodARB(s2DShadow, c3, lod, texel.x); + sparseTextureLodARB(s2DShadow, f16c2, compare, f16lod, texel.x); + sparseTextureLodARB(s2DArray, c3, lod, texel); + sparseTextureLodARB(s2DArray, f16c3, f16lod, texel); + sparseTextureLodARB(sCubeArray, c4, lod, texel); + sparseTextureLodARB(sCubeArray, f16c4, f16lod, texel); + + return texel; +} + +f16vec4 testSparseTextureOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureOffsetARB(s2D, c2, offset2, texel); + sparseTextureOffsetARB(s2D, f16c2, offset2, texel, f16bias); + sparseTextureOffsetARB(s3D, c3, offset3, texel); + sparseTextureOffsetARB(s3D, f16c3, offset3, texel, f16bias); + sparseTextureOffsetARB(s2DRect, c2, offset2, texel); + sparseTextureOffsetARB(s2DRect, f16c2, offset2, texel); + sparseTextureOffsetARB(s2DRectShadow, c3, offset2, texel.x); + sparseTextureOffsetARB(s2DRectShadow, f16c2, compare, offset2, texel.x); + sparseTextureOffsetARB(s2DShadow, c3, offset2, texel.x); + sparseTextureOffsetARB(s2DShadow, f16c2, compare, offset2, texel.x, f16bias); + sparseTextureOffsetARB(s2DArray, c3, offset2, texel); + sparseTextureOffsetARB(s2DArray, f16c3, offset2, texel, f16bias); + sparseTextureOffsetARB(s2DArrayShadow, c4, offset2, texel.x); + sparseTextureOffsetARB(s2DArrayShadow, f16c3, compare, offset2, texel.x); + + return texel; +} + +f16vec4 testSparseTextureLodOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureLodOffsetARB(s2D, c2, lod, offset2, texel); + sparseTextureLodOffsetARB(s2D, f16c2, f16lod, offset2, texel); + sparseTextureLodOffsetARB(s3D, c3, lod, offset3, texel); + sparseTextureLodOffsetARB(s3D, f16c3, f16lod, offset3, texel); + sparseTextureLodOffsetARB(s2DShadow, c3, lod, offset2, texel.x); + sparseTextureLodOffsetARB(s2DShadow, f16c2, compare, f16lod, offset2, texel.x); + sparseTextureLodOffsetARB(s2DArray, c3, lod, offset2, texel); + sparseTextureLodOffsetARB(s2DArray, f16c3, f16lod, offset2, texel); + + return texel; +} + +f16vec4 testSparseTextureGrad() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGradARB(s2D, c2, dPdxy2, dPdxy2, texel); + sparseTextureGradARB(s2D, f16c2, f16dPdxy2, f16dPdxy2, texel); + sparseTextureGradARB(s3D, c3, dPdxy3, dPdxy3, texel); + sparseTextureGradARB(s3D, f16c3, f16dPdxy3, f16dPdxy3, texel); + sparseTextureGradARB(sCube, c3, dPdxy3, dPdxy3, texel); + sparseTextureGradARB(sCube, f16c3, f16dPdxy3, f16dPdxy3, texel); + sparseTextureGradARB(s2DRect, c2, dPdxy2, dPdxy2, texel); + sparseTextureGradARB(s2DRect, f16c2, f16dPdxy2, f16dPdxy2, texel); + sparseTextureGradARB(s2DRectShadow, c3, dPdxy2, dPdxy2, texel.x); + sparseTextureGradARB(s2DRectShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, texel.x); + sparseTextureGradARB(s2DShadow, c3, dPdxy2, dPdxy2, texel.x); + sparseTextureGradARB(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, texel.x); + sparseTextureGradARB(sCubeShadow, c4, dPdxy3, dPdxy3, texel.x); + sparseTextureGradARB(sCubeShadow, f16c3, compare, f16dPdxy3, f16dPdxy3, texel.x); + sparseTextureGradARB(s2DArray, c3, dPdxy2, dPdxy2, texel); + sparseTextureGradARB(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, texel); + sparseTextureGradARB(s2DArrayShadow, c4, dPdxy2, dPdxy2, texel.x); + sparseTextureGradARB(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, texel.x); + sparseTextureGradARB(sCubeArray, c4, dPdxy3, dPdxy3, texel); + sparseTextureGradARB(sCubeArray, f16c4, f16dPdxy3, f16dPdxy3, texel); + + return texel; +} + +f16vec4 testSparseTextureGradOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGradOffsetARB(s2D, c2, dPdxy2, dPdxy2, offset2, texel); + sparseTextureGradOffsetARB(s2D, f16c2, f16dPdxy2, f16dPdxy2, offset2, texel); + sparseTextureGradOffsetARB(s3D, c3, dPdxy3, dPdxy3, offset3, texel); + sparseTextureGradOffsetARB(s3D, f16c3, f16dPdxy3, f16dPdxy3, offset3, texel); + sparseTextureGradOffsetARB(s2DRect, c2, dPdxy2, dPdxy2, offset2, texel); + sparseTextureGradOffsetARB(s2DRect, f16c2, f16dPdxy2, f16dPdxy2, offset2, texel); + sparseTextureGradOffsetARB(s2DRectShadow, c3, dPdxy2, dPdxy2, offset2, texel.x); + sparseTextureGradOffsetARB(s2DRectShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, offset2, texel.x); + sparseTextureGradOffsetARB(s2DShadow, c3, dPdxy2, dPdxy2, offset2, texel.x); + sparseTextureGradOffsetARB(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, offset2, texel.x); + sparseTextureGradOffsetARB(s2DArray, c3, dPdxy2, dPdxy2, offset2, texel); + sparseTextureGradOffsetARB(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, offset2, texel); + sparseTextureGradOffsetARB(s2DArrayShadow, c4, dPdxy2, dPdxy2, offset2, texel.x); + sparseTextureGradOffsetARB(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, offset2, texel.x); + + return texel; +} + +f16vec4 testSparseTexelFetch() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTexelFetchARB(s2D, ivec2(c2), int(lod), texel); + sparseTexelFetchARB(s3D, ivec3(c3), int(lod), texel); + sparseTexelFetchARB(s2DRect, ivec2(c2), texel); + sparseTexelFetchARB(s2DArray, ivec3(c3), int(lod), texel); + sparseTexelFetchARB(s2DMS, ivec2(c2), 1, texel); + sparseTexelFetchARB(s2DMSArray, ivec3(c3), 2, texel); + + return texel; +} + +f16vec4 testSparseTexelFetchOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTexelFetchOffsetARB(s2D, ivec2(c2), int(lod), offset2, texel); + sparseTexelFetchOffsetARB(s3D, ivec3(c3), int(lod), offset3, texel); + sparseTexelFetchOffsetARB(s2DRect, ivec2(c2), offset2, texel); + sparseTexelFetchOffsetARB(s2DArray, ivec3(c3), int(lod), offset2, texel); + + return texel; +} + +f16vec4 testSparseTextureGather() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGatherARB(s2D, c2, texel, 0); + sparseTextureGatherARB(s2D, f16c2, texel, 0, f16bias); + sparseTextureGatherARB(s2DArray, c3, texel, 0); + sparseTextureGatherARB(s2DArray, f16c3, texel, 0, f16bias); + sparseTextureGatherARB(sCube, c3, texel, 0); + sparseTextureGatherARB(sCube, f16c3, texel, 0, f16bias); + sparseTextureGatherARB(sCubeArray, c4, texel, 0); + sparseTextureGatherARB(sCubeArray, f16c4, texel, 0, f16bias); + sparseTextureGatherARB(s2DRect, c2, texel, 0); + sparseTextureGatherARB(s2DRect, f16c2, texel, 0); + sparseTextureGatherARB(s2DShadow, c2, compare, texel); + sparseTextureGatherARB(s2DShadow, f16c2, compare, texel); + sparseTextureGatherARB(s2DArrayShadow, c3, compare, texel); + sparseTextureGatherARB(s2DArrayShadow, f16c3, compare, texel); + sparseTextureGatherARB(sCubeShadow, c3, compare, texel); + sparseTextureGatherARB(sCubeShadow, f16c3, compare, texel); + sparseTextureGatherARB(sCubeArrayShadow, c4, compare, texel); + sparseTextureGatherARB(sCubeArrayShadow, f16c4, compare, texel); + sparseTextureGatherARB(s2DRectShadow, c2, compare, texel); + sparseTextureGatherARB(s2DRectShadow, f16c2, compare, texel); + + return texel; +} + +f16vec4 testSparseTextureGatherOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGatherOffsetARB(s2D, c2, offset2, texel, 0); + sparseTextureGatherOffsetARB(s2D, f16c2, offset2, texel, 0, f16bias); + sparseTextureGatherOffsetARB(s2DArray, c3, offset2, texel, 0); + sparseTextureGatherOffsetARB(s2DArray, f16c3, offset2, texel, 0, f16bias); + sparseTextureGatherOffsetARB(s2DRect, c2, offset2, texel, 0); + sparseTextureGatherOffsetARB(s2DRect, f16c2, offset2, texel, 0); + sparseTextureGatherOffsetARB(s2DShadow, c2, compare, offset2, texel); + sparseTextureGatherOffsetARB(s2DShadow, f16c2, compare, offset2, texel); + sparseTextureGatherOffsetARB(s2DArrayShadow, c3, compare, offset2, texel); + sparseTextureGatherOffsetARB(s2DArrayShadow, f16c3, compare, offset2, texel); + sparseTextureGatherOffsetARB(s2DRectShadow, c2, compare, offset2, texel); + sparseTextureGatherOffsetARB(s2DRectShadow, f16c2, compare, offset2, texel); + + return texel; +} + +f16vec4 testSparseTextureGatherOffsets() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGatherOffsetsARB(s2D, c2, offsets, texel, 0); + sparseTextureGatherOffsetsARB(s2D, f16c2, offsets, texel, 0, f16bias); + sparseTextureGatherOffsetsARB(s2DArray, c3, offsets, texel, 0); + sparseTextureGatherOffsetsARB(s2DArray, f16c3, offsets, texel, 0, f16bias); + sparseTextureGatherOffsetsARB(s2DRect, c2, offsets, texel, 0); + sparseTextureGatherOffsetsARB(s2DRect, f16c2, offsets, texel, 0); + sparseTextureGatherOffsetsARB(s2DShadow, c2, compare, offsets, texel); + sparseTextureGatherOffsetsARB(s2DShadow, f16c2, compare, offsets, texel); + sparseTextureGatherOffsetsARB(s2DArrayShadow, c3, compare, offsets, texel); + sparseTextureGatherOffsetsARB(s2DArrayShadow, f16c3, compare, offsets, texel); + sparseTextureGatherOffsetsARB(s2DRectShadow, c2, compare, offsets, texel); + sparseTextureGatherOffsetsARB(s2DRectShadow, f16c2, compare, offsets, texel); + + return texel; +} + +f16vec4 testSparseTextureGatherLod() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGatherLodAMD(s2D, c2, lod, texel, 0); + sparseTextureGatherLodAMD(s2D, f16c2, f16lod, texel, 0); + sparseTextureGatherLodAMD(s2DArray, c3, lod, texel, 0); + sparseTextureGatherLodAMD(s2DArray, f16c3, f16lod, texel, 0); + sparseTextureGatherLodAMD(sCube, c3, lod, texel, 0); + sparseTextureGatherLodAMD(sCube, f16c3, f16lod, texel, 0); + sparseTextureGatherLodAMD(sCubeArray, c4, lod, texel, 0); + sparseTextureGatherLodAMD(sCubeArray, f16c4, f16lod, texel, 0); + + return texel; +} + +f16vec4 testSparseTextureGatherLodOffset() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGatherLodOffsetAMD(s2D, c2, lod, offset2, texel, 0); + sparseTextureGatherLodOffsetAMD(s2D, f16c2, f16lod, offset2, texel, 0); + sparseTextureGatherLodOffsetAMD(s2DArray, c3, lod, offset2, texel, 0); + sparseTextureGatherLodOffsetAMD(s2DArray, f16c3, f16lod, offset2, texel, 0); + + return texel; +} + +f16vec4 testSparseTextureGatherLodOffsets() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGatherLodOffsetsAMD(s2D, c2, lod, offsets, texel, 0); + sparseTextureGatherLodOffsetsAMD(s2D, f16c2, f16lod, offsets, texel, 0); + sparseTextureGatherLodOffsetsAMD(s2DArray, c3, lod, offsets, texel, 0); + sparseTextureGatherLodOffsetsAMD(s2DArray, f16c3, f16lod, offsets, texel, 0); + + return texel; +} + +f16vec4 testSparseImageLoad() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseImageLoadARB(i2D, ivec2(c2), texel); + sparseImageLoadARB(i3D, ivec3(c3), texel); + sparseImageLoadARB(i2DRect, ivec2(c2), texel); + sparseImageLoadARB(iCube, ivec3(c3), texel); + sparseImageLoadARB(i2DArray, ivec3(c3), texel); + sparseImageLoadARB(iCubeArray, ivec3(c3), texel); + sparseImageLoadARB(i2DMS, ivec2(c2), 1, texel); + sparseImageLoadARB(i2DMSArray, ivec3(c3), 2, texel); + + return texel; +} + +f16vec4 testSparseTextureClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureClampARB(s2D, c2, lodClamp, texel); + sparseTextureClampARB(s2D, f16c2, f16lodClamp, texel, f16bias); + sparseTextureClampARB(s3D, c3, lodClamp, texel); + sparseTextureClampARB(s3D, f16c3, f16lodClamp, texel, f16bias); + sparseTextureClampARB(sCube, c3, lodClamp, texel); + sparseTextureClampARB(sCube, f16c3, f16lodClamp, texel, f16bias); + sparseTextureClampARB(s2DShadow, c3, lodClamp, texel.x); + sparseTextureClampARB(s2DShadow, f16c2, compare, f16lodClamp, texel.x, f16bias); + sparseTextureClampARB(sCubeShadow, c4, lodClamp, texel.x); + sparseTextureClampARB(sCubeShadow, f16c3, compare, f16lodClamp, texel.x, f16bias); + sparseTextureClampARB(s2DArray, c3, lodClamp, texel); + sparseTextureClampARB(s2DArray, f16c3, f16lodClamp, texel, f16bias); + sparseTextureClampARB(sCubeArray, c4, lodClamp, texel); + sparseTextureClampARB(sCubeArray, f16c4, f16lodClamp, texel, f16bias); + sparseTextureClampARB(s2DArrayShadow, c4, lodClamp, texel.x); + sparseTextureClampARB(s2DArrayShadow, f16c3, compare, f16lodClamp, texel.x); + sparseTextureClampARB(sCubeArrayShadow, c4, compare, lodClamp, texel.x); + sparseTextureClampARB(sCubeArrayShadow, f16c4, compare, f16lodClamp, texel.x); + + return texel; +} + +f16vec4 testTextureClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureClampARB(s1D, c1, lodClamp); + texel += textureClampARB(s1D, f16c1, f16lodClamp, f16bias); + texel += textureClampARB(s2D, c2, lodClamp); + texel += textureClampARB(s2D, f16c2, f16lodClamp, f16bias); + texel += textureClampARB(s3D, c3, lodClamp); + texel += textureClampARB(s3D, f16c3, f16lodClamp, f16bias); + texel += textureClampARB(sCube, c3, lodClamp); + texel += textureClampARB(sCube, f16c3, f16lodClamp, f16bias); + texel.x += textureClampARB(s1DShadow, c3, lodClamp); + texel.x += textureClampARB(s1DShadow, f16c2, compare, f16lodClamp, f16bias); + texel.x += textureClampARB(s2DShadow, c3, lodClamp); + texel.x += textureClampARB(s2DShadow, f16c2, compare, f16lodClamp, f16bias); + texel.x += textureClampARB(sCubeShadow, c4, lodClamp); + texel.x += textureClampARB(sCubeShadow, f16c3, compare, f16lodClamp, f16bias); + texel += textureClampARB(s1DArray, c2, lodClamp); + texel += textureClampARB(s1DArray, f16c2, f16lodClamp, f16bias); + texel += textureClampARB(s2DArray, c3, lodClamp); + texel += textureClampARB(s2DArray, f16c3, f16lodClamp, f16bias); + texel += textureClampARB(sCubeArray, c4, lodClamp); + texel += textureClampARB(sCubeArray, f16c4, f16lodClamp, f16bias); + texel.x += textureClampARB(s1DArrayShadow, c3, lodClamp); + texel.x += textureClampARB(s1DArrayShadow, f16c2, compare, f16lodClamp, f16bias); + texel.x += textureClampARB(s2DArrayShadow, c4, lodClamp); + texel.x += textureClampARB(s2DArrayShadow, f16c3, compare, f16lodClamp); + texel.x += textureClampARB(sCubeArrayShadow, c4, compare, lodClamp); + texel.x += textureClampARB(sCubeArrayShadow, f16c4, compare, f16lodClamp); + + return texel; +} + +f16vec4 testSparseTextureOffsetClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureOffsetClampARB(s2D, c2, offset2, lodClamp, texel); + sparseTextureOffsetClampARB(s2D, f16c2, offset2, f16lodClamp, texel, f16bias); + sparseTextureOffsetClampARB(s3D, c3, offset3, lodClamp, texel); + sparseTextureOffsetClampARB(s3D, f16c3, offset3, f16lodClamp, texel, f16bias); + sparseTextureOffsetClampARB(s2DShadow, c3, offset2, lodClamp, texel.x); + sparseTextureOffsetClampARB(s2DShadow, f16c2, compare, offset2, f16lodClamp, texel.x, f16bias); + sparseTextureOffsetClampARB(s2DArray, c3, offset2, lodClamp, texel); + sparseTextureOffsetClampARB(s2DArray, f16c3, offset2, f16lodClamp, texel, f16bias); + sparseTextureOffsetClampARB(s2DArrayShadow, c4, offset2, lodClamp, texel.x); + sparseTextureOffsetClampARB(s2DArrayShadow, f16c3, compare, offset2, f16lodClamp, texel.x); + + return texel; +} + +f16vec4 testTextureOffsetClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureOffsetClampARB(s1D, c1, offset1, lodClamp); + texel += textureOffsetClampARB(s1D, f16c1, offset1, f16lodClamp, f16bias); + texel += textureOffsetClampARB(s2D, c2, offset2, lodClamp); + texel += textureOffsetClampARB(s2D, f16c2, offset2, f16lodClamp, f16bias); + texel += textureOffsetClampARB(s3D, c3, offset3, lodClamp); + texel += textureOffsetClampARB(s3D, f16c3, offset3, f16lodClamp, f16bias); + texel.x += textureOffsetClampARB(s1DShadow, c3, offset1, lodClamp); + texel.x += textureOffsetClampARB(s1DShadow, f16c2, compare, offset1, f16lodClamp, f16bias); + texel.x += textureOffsetClampARB(s2DShadow, c3, offset2, lodClamp); + texel.x += textureOffsetClampARB(s2DShadow, f16c2, compare, offset2, f16lodClamp, f16bias); + texel += textureOffsetClampARB(s1DArray, c2, offset1, lodClamp); + texel += textureOffsetClampARB(s1DArray, f16c2, offset1, f16lodClamp, f16bias); + texel += textureOffsetClampARB(s2DArray, c3, offset2, lodClamp); + texel += textureOffsetClampARB(s2DArray, f16c3, offset2, f16lodClamp, f16bias); + texel.x += textureOffsetClampARB(s1DArrayShadow, c3, offset1, lodClamp); + texel.x += textureOffsetClampARB(s1DArrayShadow, f16c2, compare, offset1, f16lodClamp, f16bias); + texel.x += textureOffsetClampARB(s2DArrayShadow, c4, offset2, lodClamp); + texel.x += textureOffsetClampARB(s2DArrayShadow, f16c3, compare, offset2, f16lodClamp); + + return texel; +} + +f16vec4 testSparseTextureGradClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGradClampARB(s2D, c2, dPdxy2, dPdxy2, lodClamp, texel); + sparseTextureGradClampARB(s2D, f16c2, f16dPdxy2, f16dPdxy2, f16lodClamp, texel); + sparseTextureGradClampARB(s3D, c3, dPdxy3, dPdxy3, lodClamp, texel); + sparseTextureGradClampARB(s3D, f16c3, f16dPdxy3, f16dPdxy3, f16lodClamp, texel); + sparseTextureGradClampARB(sCube, c3, dPdxy3, dPdxy3, lodClamp, texel); + sparseTextureGradClampARB(sCube, f16c3, f16dPdxy3, f16dPdxy3, f16lodClamp, texel); + sparseTextureGradClampARB(s2DShadow, c3, dPdxy2, dPdxy2, lodClamp, texel.x); + sparseTextureGradClampARB(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, f16lodClamp, texel.x); + sparseTextureGradClampARB(sCubeShadow, c4, dPdxy3, dPdxy3, lodClamp, texel.x); + sparseTextureGradClampARB(sCubeShadow, f16c3, compare, f16dPdxy3, f16dPdxy3, f16lodClamp, texel.x); + sparseTextureGradClampARB(s2DArray, c3, dPdxy2, dPdxy2, lodClamp, texel); + sparseTextureGradClampARB(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, f16lodClamp, texel); + sparseTextureGradClampARB(s2DArrayShadow, c4, dPdxy2, dPdxy2, lodClamp, texel.x); + sparseTextureGradClampARB(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, f16lodClamp, texel.x); + sparseTextureGradClampARB(sCubeArray, c4, dPdxy3, dPdxy3, lodClamp, texel); + sparseTextureGradClampARB(sCubeArray, f16c4, f16dPdxy3, f16dPdxy3, f16lodClamp, texel); + + return texel; +} + +f16vec4 testTextureGradClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGradClampARB(s1D, c1, dPdxy1, dPdxy1, lodClamp); + texel += textureGradClampARB(s1D, f16c1, f16dPdxy1, f16dPdxy1, f16lodClamp); + texel += textureGradClampARB(s2D, c2, dPdxy2, dPdxy2, lodClamp); + texel += textureGradClampARB(s2D, f16c2, f16dPdxy2, f16dPdxy2, f16lodClamp); + texel += textureGradClampARB(s3D, c3, dPdxy3, dPdxy3, lodClamp); + texel += textureGradClampARB(s3D, f16c3, f16dPdxy3, f16dPdxy3, f16lodClamp); + texel += textureGradClampARB(sCube, c3, dPdxy3, dPdxy3, lodClamp); + texel += textureGradClampARB(sCube, f16c3, f16dPdxy3, f16dPdxy3, f16lodClamp); + texel.x += textureGradClampARB(s1DShadow, c3, dPdxy1, dPdxy1, lodClamp); + texel.x += textureGradClampARB(s1DShadow, f16c2, compare, f16dPdxy1, f16dPdxy1, f16lodClamp); + texel.x += textureGradClampARB(s2DShadow, c3, dPdxy2, dPdxy2, lodClamp); + texel.x += textureGradClampARB(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, f16lodClamp); + texel.x += textureGradClampARB(sCubeShadow, c4, dPdxy3, dPdxy3, lodClamp); + texel.x += textureGradClampARB(sCubeShadow, f16c3, compare, f16dPdxy3, f16dPdxy3, f16lodClamp); + texel += textureGradClampARB(s1DArray, c2, dPdxy1, dPdxy1, lodClamp); + texel += textureGradClampARB(s1DArray, f16c2, f16dPdxy1, f16dPdxy1, f16lodClamp); + texel += textureGradClampARB(s2DArray, c3, dPdxy2, dPdxy2, lodClamp); + texel += textureGradClampARB(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, f16lodClamp); + texel.x += textureGradClampARB(s1DArrayShadow, c3, dPdxy1, dPdxy1, lodClamp); + texel.x += textureGradClampARB(s1DArrayShadow, f16c2, compare, f16dPdxy1, f16dPdxy1, f16lodClamp); + texel.x += textureGradClampARB(s2DArrayShadow, c4, dPdxy2, dPdxy2, lodClamp); + texel.x += textureGradClampARB(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, f16lodClamp); + texel += textureGradClampARB(sCubeArray, c4, dPdxy3, dPdxy3, lodClamp); + texel += textureGradClampARB(sCubeArray, f16c4, f16dPdxy3, f16dPdxy3, f16lodClamp); + + return texel; +} + +f16vec4 testSparseTextureGradOffsetClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + sparseTextureGradOffsetClampARB(s2D, c2, dPdxy2, dPdxy2, offset2, lodClamp, texel); + sparseTextureGradOffsetClampARB(s2D, f16c2, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp, texel); + sparseTextureGradOffsetClampARB(s3D, c3, dPdxy3, dPdxy3, offset3, lodClamp, texel); + sparseTextureGradOffsetClampARB(s3D, f16c3, f16dPdxy3, f16dPdxy3, offset3, f16lodClamp, texel); + sparseTextureGradOffsetClampARB(s2DShadow, c3, dPdxy2, dPdxy2, offset2, lodClamp, texel.x); + sparseTextureGradOffsetClampARB(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp, texel.x); + sparseTextureGradOffsetClampARB(s2DArray, c3, dPdxy2, dPdxy2, offset2, lodClamp, texel); + sparseTextureGradOffsetClampARB(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp, texel); + sparseTextureGradOffsetClampARB(s2DArrayShadow, c4, dPdxy2, dPdxy2, offset2, lodClamp, texel.x); + sparseTextureGradOffsetClampARB(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp, texel.x); + + return texel; +} + +f16vec4 testTextureGradOffsetClamp() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += textureGradOffsetClampARB(s1D, c1, dPdxy1, dPdxy1, offset1, lodClamp); + texel += textureGradOffsetClampARB(s1D, f16c1, f16dPdxy1, f16dPdxy1, offset1, f16lodClamp); + texel += textureGradOffsetClampARB(s2D, c2, dPdxy2, dPdxy2, offset2, lodClamp); + texel += textureGradOffsetClampARB(s2D, f16c2, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp); + texel += textureGradOffsetClampARB(s3D, c3, dPdxy3, dPdxy3, offset3, lodClamp); + texel += textureGradOffsetClampARB(s3D, f16c3, f16dPdxy3, f16dPdxy3, offset3, f16lodClamp); + texel.x += textureGradOffsetClampARB(s1DShadow, c3, dPdxy1, dPdxy1, offset1, lodClamp); + texel.x += textureGradOffsetClampARB(s1DShadow, f16c2, compare, f16dPdxy1, f16dPdxy1, offset1, f16lodClamp); + texel.x += textureGradOffsetClampARB(s2DShadow, c3, dPdxy2, dPdxy2, offset2, lodClamp); + texel.x += textureGradOffsetClampARB(s2DShadow, f16c2, compare, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp); + texel += textureGradOffsetClampARB(s1DArray, c2, dPdxy1, dPdxy1, offset1, lodClamp); + texel += textureGradOffsetClampARB(s1DArray, f16c2, f16dPdxy1, f16dPdxy1, offset1, f16lodClamp); + texel += textureGradOffsetClampARB(s2DArray, c3, dPdxy2, dPdxy2, offset2, lodClamp); + texel += textureGradOffsetClampARB(s2DArray, f16c3, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp); + texel.x += textureGradOffsetClampARB(s1DArrayShadow, c3, dPdxy1, dPdxy1, offset1, lodClamp); + texel.x += textureGradOffsetClampARB(s1DArrayShadow, f16c2, compare, f16dPdxy1, f16dPdxy1, offset1, f16lodClamp); + texel.x += textureGradOffsetClampARB(s2DArrayShadow, c4, dPdxy2, dPdxy2, offset2, lodClamp); + texel.x += textureGradOffsetClampARB(s2DArrayShadow, f16c3, compare, f16dPdxy2, f16dPdxy2, offset2, f16lodClamp); + + return texel; +} + +f16vec4 testCombinedTextureSampler() +{ + f16vec4 texel = f16vec4(0.0hf); + + texel += texture(f16sampler1D(t1D, s), c1); + texel += texture(f16sampler1D(t1D, s), f16c1, f16bias); + texel += texture(f16sampler2D(t2D, s), c2); + texel += texture(f16sampler2D(t2D, s), f16c2, f16bias); + texel += texture(f16sampler3D(t3D, s), c3); + texel += texture(f16sampler3D(t3D, s), f16c3, f16bias); + texel += texture(f16samplerCube(tCube, s), c3); + texel += texture(f16samplerCube(tCube, s), f16c3, f16bias); + texel.x += texture(f16sampler1DShadow(t1D, sShadow), c3); + texel.x += texture(f16sampler1DShadow(t1D, sShadow), f16c2, compare, f16bias); + texel.x += texture(f16sampler2DShadow(t2D, sShadow), c3); + texel.x += texture(f16sampler2DShadow(t2D, sShadow), f16c2, compare, f16bias); + texel.x += texture(f16samplerCubeShadow(tCube, sShadow), c4); + texel.x += texture(f16samplerCubeShadow(tCube, sShadow), f16c3, compare, f16bias); + texel += texture(f16sampler1DArray(t1DArray, s), c2); + texel += texture(f16sampler1DArray(t1DArray, s), f16c2, f16bias); + texel += texture(f16sampler2DArray(t2DArray, s), c3); + texel += texture(f16sampler2DArray(t2DArray, s), f16c3, f16bias); + texel += texture(f16samplerCubeArray(tCubeArray, s), c4); + texel += texture(f16samplerCubeArray(tCubeArray, s), f16c4, f16bias); + texel.x += texture(f16sampler1DArrayShadow(t1DArray, sShadow), c3); + texel.x += texture(f16sampler1DArrayShadow(t1DArray, sShadow), f16c2, compare, f16bias); + texel.x += texture(f16sampler2DArrayShadow(t2DArray, sShadow), c4); + texel.x += texture(f16sampler2DArrayShadow(t2DArray, sShadow), f16c3, compare); + texel += texture(f16sampler2DRect(t2DRect, s), c2); + texel += texture(f16sampler2DRect(t2DRect, s), f16c2); + texel.x += texture(f16sampler2DRectShadow(t2DRect, sShadow), c3); + texel.x += texture(f16sampler2DRectShadow(t2DRect, sShadow), f16c2, compare); + texel.x += texture(f16samplerCubeArrayShadow(tCubeArray, sShadow), c4, compare); + texel.x += texture(f16samplerCubeArrayShadow(tCubeArray, sShadow), f16c4, compare); + + return texel; +} + +f16vec4 testSubpassLoad() +{ + return subpassLoad(subpass) + subpassLoad(subpassMS, 2); +} + +void main() +{ + f16vec4 result = f16vec4(0.0hf); + + result += testTexture(); + result += testTextureProj(); + result += testTextureLod(); + result += testTextureOffset(); + result += testTextureLodOffset(); + result += testTextureProjLodOffset(); + result += testTexelFetch(); + result += testTexelFetchOffset(); + result += testTextureGrad(); + result += testTextureGradOffset(); + result += testTextureProjGrad(); + result += testTextureProjGradoffset(); + result += testTextureGather(); + result += testTextureGatherOffset(); + result += testTextureGatherOffsets(); + result += testTextureGatherLod(); + result += testTextureGatherLodOffset(); + result += testTextureGatherLodOffsets(); + + result += f16vec4(testTextureSize()); + result.xy += f16vec2(testTextureQueryLod()); + result.x += float16_t(testTextureQueryLevels()); + result.x += float16_t(testTextureSamples()); + + result += testImageLoad(); + testImageStore(result); + + result += testSparseTexture(); + result += testSparseTextureLod(); + result += testSparseTextureOffset(); + result += testSparseTextureLodOffset(); + result += testSparseTextureGrad(); + result += testSparseTextureGradOffset(); + result += testSparseTexelFetch(); + result += testSparseTexelFetchOffset(); + result += testSparseTextureGather(); + result += testSparseTextureGatherOffset(); + result += testSparseTextureGatherOffsets(); + result += testSparseTextureGatherLod(); + result += testSparseTextureGatherLodOffset(); + result += testSparseTextureGatherLodOffsets(); + + result += testSparseImageLoad(); + + result += testSparseTextureClamp(); + result += testTextureClamp(); + result += testSparseTextureOffsetClamp(); + result += testTextureOffsetClamp(); + result += testSparseTextureGrad(); + result += testTextureGrad(); + result += testSparseTextureGradOffsetClamp(); + result += testTextureGradOffsetClamp(); + + result += testCombinedTextureSampler(); + result += testSubpassLoad(); + + fragColor = result; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.float32.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.float32.frag new file mode 100644 index 00000000000..471f6b3b72a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.float32.frag @@ -0,0 +1,277 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +void main() +{ +} + +// Single float literals +void literal() +{ + const float32_t f32c = 0.000001f; + const f32vec2 f32cv = f32vec2(-0.25F, 0.03f); + + f32vec2 f32v; + f32v.x = f32c; + f32v += f32cv; +} + +// Block memory layout +struct S +{ + float32_t x; + f32vec2 y; + f32vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + float32_t a; + f32vec2 b; + f32vec3 c; + float32_t d[2]; + f32mat2x3 e; + f32mat2x3 f[2]; + S g; + S h[2]; +}; + +// Specialization constant +layout(constant_id = 100) const float16_t sf16 = 0.125hf; +layout(constant_id = 101) const float32_t sf = 0.25; +layout(constant_id = 102) const float64_t sd = 0.5lf; + +const float f16_to_f = float(sf16); +const double f16_to_d = float(sf16); + +const float16_t f_to_f16 = float16_t(sf); +const float16_t d_to_f16 = float16_t(sd); + +void operators() +{ + float32_t f32; + f32vec2 f32v; + f32mat2x2 f32m; + bool b; + + // Arithmetic + f32v += f32v; + f32v -= f32v; + f32v *= f32v; + f32v /= f32v; + f32v++; + f32v--; + ++f32m; + --f32m; + f32v = -f32v; + f32m = -f32m; + + f32 = f32v.x + f32v.y; + f32 = f32v.x - f32v.y; + f32 = f32v.x * f32v.y; + f32 = f32v.x / f32v.y; + + // Relational + b = (f32v.x != f32); + b = (f32v.y == f32); + b = (f32v.x > f32); + b = (f32v.y < f32); + b = (f32v.x >= f32); + b = (f32v.y <= f32); + + // Vector/matrix operations + f32v = f32v * f32; + f32m = f32m * f32; + f32v = f32m * f32v; + f32v = f32v * f32m; + f32m = f32m * f32m; +} + +void typeCast() +{ + bvec3 bv; + f32vec3 f32v; + f64vec3 f64v; + i8vec3 i8v; + u8vec3 u8v; + i16vec3 i16v; + u16vec3 u16v; + i32vec3 i32v; + u32vec3 u32v; + i64vec3 i64v; + u64vec3 u64v; + f16vec3 f16v; + + f64v = f32v; // float32_t -> float64_t + + f32v = f32vec3(bv); // bool -> float32 + bv = bvec3(f32v); // float32 -> bool + + f32v = f32vec3(f64v); // double -> float32 + f64v = f64vec3(f32v); // float32 -> double + + f32v = f32vec3(f16v); // float16 -> float32 + f16v = f16vec3(f32v); // float32 -> float16 + + i8v = i8vec3(f32v); // float32 -> int8 + i16v = i16vec3(f32v); // float32 -> int16 + i32v = i32vec3(f32v); // float32 -> int32 + i64v = i64vec3(f32v); // float32 -> int64 + + u8v = u8vec3(f32v); // float32 -> uint8 + u16v = u16vec3(f32v); // float32 -> uint16 + u32v = u32vec3(f32v); // float32 -> uint32 + u64v = u64vec3(f32v); // float32 -> uint64 +} + +void builtinAngleTrigFuncs() +{ + f32vec4 f32v1, f32v2; + + f32v2 = radians(f32v1); + f32v2 = degrees(f32v1); + f32v2 = sin(f32v1); + f32v2 = cos(f32v1); + f32v2 = tan(f32v1); + f32v2 = asin(f32v1); + f32v2 = acos(f32v1); + f32v2 = atan(f32v1, f32v2); + f32v2 = atan(f32v1); + f32v2 = sinh(f32v1); + f32v2 = cosh(f32v1); + f32v2 = tanh(f32v1); + f32v2 = asinh(f32v1); + f32v2 = acosh(f32v1); + f32v2 = atanh(f32v1); +} + +void builtinExpFuncs() +{ + f32vec2 f32v1, f32v2; + + f32v2 = pow(f32v1, f32v2); + f32v2 = exp(f32v1); + f32v2 = log(f32v1); + f32v2 = exp2(f32v1); + f32v2 = log2(f32v1); + f32v2 = sqrt(f32v1); + f32v2 = inversesqrt(f32v1); +} + +void builtinCommonFuncs() +{ + f32vec3 f32v1, f32v2, f32v3; + float32_t f32; + bool b; + bvec3 bv; + ivec3 iv; + + f32v2 = abs(f32v1); + f32v2 = sign(f32v1); + f32v2 = floor(f32v1); + f32v2 = trunc(f32v1); + f32v2 = round(f32v1); + f32v2 = roundEven(f32v1); + f32v2 = ceil(f32v1); + f32v2 = fract(f32v1); + f32v2 = mod(f32v1, f32v2); + f32v2 = mod(f32v1, f32); + f32v3 = modf(f32v1, f32v2); + f32v3 = min(f32v1, f32v2); + f32v3 = min(f32v1, f32); + f32v3 = max(f32v1, f32v2); + f32v3 = max(f32v1, f32); + f32v3 = clamp(f32v1, f32, f32v2.x); + f32v3 = clamp(f32v1, f32v2, f32vec3(f32)); + f32v3 = mix(f32v1, f32v2, f32); + f32v3 = mix(f32v1, f32v2, f32v3); + f32v3 = mix(f32v1, f32v2, bv); + f32v3 = step(f32v1, f32v2); + f32v3 = step(f32, f32v3); + f32v3 = smoothstep(f32v1, f32v2, f32v3); + f32v3 = smoothstep(f32, f32v1.x, f32v2); + b = isnan(f32); + bv = isinf(f32v1); + f32v3 = fma(f32v1, f32v2, f32v3); + f32v2 = frexp(f32v1, iv); + f32v2 = ldexp(f32v1, iv); +} + +void builtinGeometryFuncs() +{ + float32_t f32; + f32vec3 f32v1, f32v2, f32v3; + + f32 = length(f32v1); + f32 = distance(f32v1, f32v2); + f32 = dot(f32v1, f32v2); + f32v3 = cross(f32v1, f32v2); + f32v2 = normalize(f32v1); + f32v3 = faceforward(f32v1, f32v2, f32v3); + f32v3 = reflect(f32v1, f32v2); + f32v3 = refract(f32v1, f32v2, f32); +} + +void builtinMatrixFuncs() +{ + f32mat2x3 f32m1, f32m2, f32m3; + f32mat3x2 f32m4; + f32mat3 f32m5; + f32mat4 f32m6, f32m7; + + f32vec3 f32v1; + f32vec2 f32v2; + + float32_t f32; + + f32m3 = matrixCompMult(f32m1, f32m2); + f32m1 = outerProduct(f32v1, f32v2); + f32m4 = transpose(f32m1); + f32 = determinant(f32m5); + f32m6 = inverse(f32m7); +} + +void builtinVecRelFuncs() +{ + f32vec3 f32v1, f32v2; + bvec3 bv; + + bv = lessThan(f32v1, f32v2); + bv = lessThanEqual(f32v1, f32v2); + bv = greaterThan(f32v1, f32v2); + bv = greaterThanEqual(f32v1, f32v2); + bv = equal(f32v1, f32v2); + bv = notEqual(f32v1, f32v2); +} + +in f32vec3 if32v; + +void builtinFragProcFuncs() +{ + f32vec3 f32v; + + // Derivative + f32v.x = dFdx(if32v.x); + f32v.y = dFdy(if32v.y); + f32v.xy = dFdxFine(if32v.xy); + f32v.xy = dFdyFine(if32v.xy); + f32v = dFdxCoarse(if32v); + f32v = dFdxCoarse(if32v); + + f32v.x = fwidth(if32v.x); + f32v.xy = fwidthFine(if32v.xy); + f32v = fwidthCoarse(if32v); + + // Interpolation + f32v.x = interpolateAtCentroid(if32v.x); + f32v.xy = interpolateAtSample(if32v.xy, 1); + f32v = interpolateAtOffset(if32v, f32vec2(0.5f)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.float64.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.float64.frag new file mode 100644 index 00000000000..efbec77d92a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.float64.frag @@ -0,0 +1,272 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +void main() +{ +} + +// Single float literals +void literal() +{ + const float64_t f64c = 0.000001LF; + const f64vec2 f64cv = f64vec2(-0.25lF, 0.03Lf); + + f64vec2 f64v; + f64v.x = f64c; + f64v += f64cv; +} + +// Block memory layout +struct S +{ + float64_t x; + f64vec2 y; + f64vec3 z; +}; + +layout(column_major, std140) uniform B1 +{ + float64_t a; + f64vec2 b; + f64vec3 c; + float64_t d[2]; + f64mat2x3 e; + f64mat2x3 f[2]; + S g; + S h[2]; +}; + +// Specialization constant +layout(constant_id = 100) const float16_t sf16 = 0.125hf; +layout(constant_id = 101) const float32_t sf = 0.25; +layout(constant_id = 102) const float64_t sd = 0.5lf; + +const float f16_to_f = float(sf16); +const double f16_to_d = float(sf16); + +const float16_t f_to_f16 = float16_t(sf); +const float16_t d_to_f16 = float16_t(sd); + +void operators() +{ + float64_t f64; + f64vec2 f64v; + f64mat2x2 f64m; + bool b; + + // Arithmetic + f64v += f64v; + f64v -= f64v; + f64v *= f64v; + f64v /= f64v; + f64v++; + f64v--; + ++f64m; + --f64m; + f64v = -f64v; + f64m = -f64m; + + f64 = f64v.x + f64v.y; + f64 = f64v.x - f64v.y; + f64 = f64v.x * f64v.y; + f64 = f64v.x / f64v.y; + + // Relational + b = (f64v.x != f64); + b = (f64v.y == f64); + b = (f64v.x > f64); + b = (f64v.y < f64); + b = (f64v.x >= f64); + b = (f64v.y <= f64); + + // Vector/matrix operations + f64v = f64v * f64; + f64m = f64m * f64; + f64v = f64m * f64v; + f64v = f64v * f64m; + f64m = f64m * f64m; +} + +void typeCast() +{ + bvec3 bv; + f32vec3 f32v; + f64vec3 f64v; + i8vec3 i8v; + u8vec3 u8v; + i16vec3 i16v; + u16vec3 u16v; + i32vec3 i32v; + u32vec3 u32v; + i64vec3 i64v; + u64vec3 u64v; + f16vec3 f16v; + + f64v = f64vec3(bv); // bool -> float64 + bv = bvec3(f64v); // float64 -> bool + + f64v = f64vec3(f16v); // float16 -> float64 + f16v = f16vec3(f64v); // float64 -> float16 + + i8v = i8vec3(f64v); // float64 -> int8 + i16v = i16vec3(f64v); // float64 -> int16 + i32v = i32vec3(f64v); // float64 -> int32 + i64v = i64vec3(f64v); // float64 -> int64 + + u8v = u8vec3(f64v); // float64 -> uint8 + u16v = u16vec3(f64v); // float64 -> uint16 + u32v = u32vec3(f64v); // float64 -> uint32 + u64v = u64vec3(f64v); // float64 -> uint64 +} + +void builtinAngleTrigFuncs() +{ + f64vec4 f64v1, f64v2; + + f64v2 = radians(f64v1); + f64v2 = degrees(f64v1); + f64v2 = sin(f64v1); + f64v2 = cos(f64v1); + f64v2 = tan(f64v1); + f64v2 = asin(f64v1); + f64v2 = acos(f64v1); + f64v2 = atan(f64v1, f64v2); + f64v2 = atan(f64v1); + f64v2 = sinh(f64v1); + f64v2 = cosh(f64v1); + f64v2 = tanh(f64v1); + f64v2 = asinh(f64v1); + f64v2 = acosh(f64v1); + f64v2 = atanh(f64v1); +} + +void builtinExpFuncs() +{ + f64vec2 f64v1, f64v2; + + f64v2 = pow(f64v1, f64v2); + f64v2 = exp(f64v1); + f64v2 = log(f64v1); + f64v2 = exp2(f64v1); + f64v2 = log2(f64v1); + f64v2 = sqrt(f64v1); + f64v2 = inversesqrt(f64v1); +} + +void builtinCommonFuncs() +{ + f64vec3 f64v1, f64v2, f64v3; + float64_t f64; + bool b; + bvec3 bv; + ivec3 iv; + + f64v2 = abs(f64v1); + f64v2 = sign(f64v1); + f64v2 = floor(f64v1); + f64v2 = trunc(f64v1); + f64v2 = round(f64v1); + f64v2 = roundEven(f64v1); + f64v2 = ceil(f64v1); + f64v2 = fract(f64v1); + f64v2 = mod(f64v1, f64v2); + f64v2 = mod(f64v1, f64); + f64v3 = modf(f64v1, f64v2); + f64v3 = min(f64v1, f64v2); + f64v3 = min(f64v1, f64); + f64v3 = max(f64v1, f64v2); + f64v3 = max(f64v1, f64); + f64v3 = clamp(f64v1, f64, f64v2.x); + f64v3 = clamp(f64v1, f64v2, f64vec3(f64)); + f64v3 = mix(f64v1, f64v2, f64); + f64v3 = mix(f64v1, f64v2, f64v3); + f64v3 = mix(f64v1, f64v2, bv); + f64v3 = step(f64v1, f64v2); + f64v3 = step(f64, f64v3); + f64v3 = smoothstep(f64v1, f64v2, f64v3); + f64v3 = smoothstep(f64, f64v1.x, f64v2); + b = isnan(f64); + bv = isinf(f64v1); + f64v3 = fma(f64v1, f64v2, f64v3); + f64v2 = frexp(f64v1, iv); + f64v2 = ldexp(f64v1, iv); +} + +void builtinGeometryFuncs() +{ + float64_t f64; + f64vec3 f64v1, f64v2, f64v3; + + f64 = length(f64v1); + f64 = distance(f64v1, f64v2); + f64 = dot(f64v1, f64v2); + f64v3 = cross(f64v1, f64v2); + f64v2 = normalize(f64v1); + f64v3 = faceforward(f64v1, f64v2, f64v3); + f64v3 = reflect(f64v1, f64v2); + f64v3 = refract(f64v1, f64v2, f64); +} + +void builtinMatrixFuncs() +{ + f64mat2x3 f64m1, f64m2, f64m3; + f64mat3x2 f64m4; + f64mat3 f64m5; + f64mat4 f64m6, f64m7; + + f64vec3 f64v1; + f64vec2 f64v2; + + float64_t f64; + + f64m3 = matrixCompMult(f64m1, f64m2); + f64m1 = outerProduct(f64v1, f64v2); + f64m4 = transpose(f64m1); + f64 = determinant(f64m5); + f64m6 = inverse(f64m7); +} + +void builtinVecRelFuncs() +{ + f64vec3 f64v1, f64v2; + bvec3 bv; + + bv = lessThan(f64v1, f64v2); + bv = lessThanEqual(f64v1, f64v2); + bv = greaterThan(f64v1, f64v2); + bv = greaterThanEqual(f64v1, f64v2); + bv = equal(f64v1, f64v2); + bv = notEqual(f64v1, f64v2); +} + +in flat f64vec3 if64v; + +void builtinFragProcFuncs() +{ + f64vec3 f64v; + + // Derivative + f64v.x = dFdx(if64v.x); + f64v.y = dFdy(if64v.y); + f64v.xy = dFdxFine(if64v.xy); + f64v.xy = dFdyFine(if64v.xy); + f64v = dFdxCoarse(if64v); + f64v = dFdxCoarse(if64v); + + f64v.x = fwidth(if64v.x); + f64v.xy = fwidthFine(if64v.xy); + f64v = fwidthCoarse(if64v); + + // Interpolation + f64v.x = interpolateAtCentroid(if64v.x); + f64v.xy = interpolateAtSample(if64v.xy, 1); + f64v = interpolateAtOffset(if64v, f64vec2(0.5f)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity-es.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity-es.frag new file mode 100644 index 00000000000..35fb96e74d8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity-es.frag @@ -0,0 +1,11 @@ +#version 310 es + +#extension GL_EXT_fragment_invocation_density : require + +layout (location = 0) out highp ivec2 FragSize; +layout (location = 2) out highp int FragInvocationCount; + +void main () { + FragSize = gl_FragSizeEXT; + FragInvocationCount = gl_FragInvocationCountEXT; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity-neg.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity-neg.frag new file mode 100644 index 00000000000..68e736cd584 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity-neg.frag @@ -0,0 +1,12 @@ +#version 450 + +//make sure the builtins don't exist if the extension isn't enabled. +//#extension GL_EXT_fragment_invocation_density : require + +layout (location = 0) out vec2 FragSize; +layout (location = 2) out int FragInvocationCount; + +void main () { + FragSize = gl_FragSizeEXT; + FragInvocationCount = gl_FragInvocationCountEXT; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity.frag new file mode 100644 index 00000000000..9b37ba4ca15 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity.frag @@ -0,0 +1,11 @@ +#version 450 + +#extension GL_EXT_fragment_invocation_density : require + +layout (location = 0) out vec2 FragSize; +layout (location = 2) out int FragInvocationCount; + +void main () { + FragSize = gl_FragSizeEXT; + FragInvocationCount = gl_FragInvocationCountEXT; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity.vert new file mode 100644 index 00000000000..eaef72d7abf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentDensity.vert @@ -0,0 +1,12 @@ +#version 450 + +// try using a fragment-only extension in a vertex shader +#extension GL_EXT_fragment_invocation_density : require + +layout (location = 0) out uvec2 FragSize; +layout (location = 2) out int FragInvocationCount; + +void main () { + FragSize = gl_FragSizeEXT; + FragInvocationCount = gl_FragInvocationCountEXT; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentShaderBarycentric.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentShaderBarycentric.frag new file mode 100644 index 00000000000..c923aca08e2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentShaderBarycentric.frag @@ -0,0 +1,15 @@ +#version 450 +#extension GL_NV_fragment_shader_barycentric : require + +layout(location = 0) pervertexNV in vertices { + float attrib; + } v[]; + +layout(location = 1) out float value; + +void main () { + value = (gl_BaryCoordNV.x * v[0].attrib + + gl_BaryCoordNV.y * v[1].attrib + + gl_BaryCoordNV.z * v[2].attrib); + +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentShaderBarycentric2.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentShaderBarycentric2.frag new file mode 100644 index 00000000000..4682e4ef434 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fragmentShaderBarycentric2.frag @@ -0,0 +1,15 @@ +#version 320 es +#extension GL_NV_fragment_shader_barycentric : require + +precision highp float; + +layout(location = 0) pervertexNV in float vertexIDs[3]; + +layout(location = 1) out float value; + +void main () { + value = (gl_BaryCoordNoPerspNV.x * vertexIDs[0] + + gl_BaryCoordNoPerspNV.y * vertexIDs[1] + + gl_BaryCoordNoPerspNV.z * vertexIDs[2]); + +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.fullyCovered.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fullyCovered.frag new file mode 100644 index 00000000000..c7f30853d4c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.fullyCovered.frag @@ -0,0 +1,9 @@ +#version 450 + +#extension GL_NV_conservative_raster_underestimation : enable + +out vec4 color; + +void main() { + color = vec4(gl_FragFullyCoveredNV, 0, 0, 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.glsl.register.noautoassign.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.glsl.register.noautoassign.frag index f754d8aad92..c385fbb9a0c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.glsl.register.noautoassign.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.glsl.register.noautoassign.frag @@ -1,23 +1,23 @@ #version 450 uniform layout(binding=0) sampler g_sSamp1; -uniform sampler g_sSamp2; +uniform layout(binding=1) sampler g_sSamp2; uniform layout(binding=2) sampler g_sSamp3[2]; -uniform sampler g_sSamp4[3]; -uniform sampler g_sSamp5; +uniform layout(binding=3) sampler g_sSamp4[3]; +uniform layout(binding=4) sampler g_sSamp5; -uniform sampler g_sSamp_unused1; -uniform sampler g_sSamp_unused2; +uniform layout(binding=5) sampler g_sSamp_unused1; +uniform layout(binding=6) sampler g_sSamp_unused2; -uniform layout(binding=1) texture1D g_tTex1; -uniform texture1D g_tTex2; -uniform layout(binding=3) texture1D g_tTex3[2]; -uniform texture1D g_tTex4[3]; -uniform texture1D g_tTex5; +uniform layout(binding=7) texture1D g_tTex1; +uniform layout(binding=8) texture1D g_tTex2; +uniform layout(binding=9) texture1D g_tTex3[2]; +uniform layout(binding=10) texture1D g_tTex4[3]; +uniform layout(binding=11) texture1D g_tTex5; -uniform layout(binding=0) texture1D g_tTex_unused1; -uniform layout(binding=2) texture1D g_tTex_unused2; -uniform texture1D g_tTex_unused3; +uniform layout(binding=12) texture1D g_tTex_unused1; +uniform layout(binding=13) texture1D g_tTex_unused2; +uniform layout(binding=14) texture1D g_tTex_unused3; struct MyStruct_t { int a; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.image.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.image.frag index 30b339ce1a4..d9305ef2e8d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.image.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.image.frag @@ -14,6 +14,8 @@ layout(rgba32f, binding = 10) uniform image2DMSArray i2DMSArray; layout(r32i, binding = 11) uniform iimage1D ii1D; layout(r32ui, binding = 12) uniform uimage2D ui2D; +layout(r32i, binding = 13) uniform iimage2DMS ii2DMS; +layout(r32ui, binding = 14) uniform uimage2DMSArray ui2DMSArray; flat in int ic1D; flat in ivec2 ic2D; @@ -85,6 +87,8 @@ void main() ui += imageAtomicExchange(ui2D, ic2D, value); iv.x += imageAtomicCompSwap(ii1D, ic1D, 18, 17); ui += imageAtomicCompSwap(ui2D, ic2D, 19u, value); + iv.x += imageAtomicCompSwap(ii2DMS, ic2D, 2, 18, 17); + ui += imageAtomicCompSwap(ui2DMSArray, ic3D, 3, 19u, value); imageStore(wo2D, ic2D, v); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.amd.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.amd.frag new file mode 100644 index 00000000000..818e6d83d31 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.amd.frag @@ -0,0 +1,314 @@ +#version 450 core + +#extension GL_ARB_gpu_shader_int64: enable +#extension GL_AMD_gpu_shader_half_float: enable +#extension GL_AMD_gpu_shader_int16: enable + +layout(binding = 0) uniform Uniforms +{ + uint i; +}; + +// int16/uint16 in block +layout(std140, binding = 1) uniform Block +{ + i16vec3 i16v; + uint16_t u16; +} block; + +// int16/uint16 for input +layout(location = 0) in flat u16vec3 iu16v; +layout(location = 1) in flat int16_t ii16; + +void literal() +{ + const int16_t i16c[3] = + { + 0x111S, // Hex + -2s, // Dec + 0400s, // Oct + }; + + const uint16_t u16c[] = + { + 0xFFFFus, // Hex + 65535US, // Dec + 0177777us, // Oct + }; + + uint16_t u16 = i16c[i] + u16c[i]; +} + +void operators() +{ + u16vec3 u16v; + int16_t i16; + uint16_t u16; + int i; + uint u; + bool b; + + // Unary + u16v++; + i16--; + ++i16; + --u16v; + + u16v = ~u16v; + + i16 = +i16; + u16v = -u16v; + + // Arithmetic + u16 += i16; + u16v -= u16v; + i16 *= i16; + u16v /= u16v; + u16v %= i16; + + u16v = u16v + u16v; + u16 = i16 - u16; + u16v = u16v * i16; + i16 = i16 * i16; + i16 = i16 % i16; + + // Shift + u16v <<= i16; + i16 >>= u16v.y; + + i16 = i16 << u16v.z; + u16v = u16v << i16; + + // Relational + b = (u16v.x != i16); + b = (i16 == u16v.x); + b = (u16v.x > u16v.y); + b = (i16 < u); + b = (u16v.y >= u16v.x); + b = (i16 <= i); + + // Bitwise + u16v |= i16; + u16 = i16 | u16; + i16 &= i16; + u16v = u16v & u16v; + u16v ^= i16; + u16v = u16v ^ i16; +} + +void typeCast() +{ + bvec2 bv; + ivec2 iv; + uvec2 uv; + vec2 fv; + dvec2 dv; + + f16vec2 f16v; + i64vec2 i64v; + u64vec2 u64v; + i16vec2 i16v; + u16vec2 u16v; + + i16v = i16vec2(bv); // bool -> int16 + u16v = u16vec2(bv); // bool -> uint16 + bv = bvec2(i16v); // int16 -> bool + bv = bvec2(u16v); // uint16 -> bool + + i16v = i16vec2(iv); // int -> int16 + u16v = u16vec2(iv); // int -> uint16 + iv = i16v; // int16 -> int + iv = ivec2(u16v); // uint16 -> int + + i16v = i16vec2(uv); // uint -> int16 + u16v = u16vec2(uv); // uint -> uint16 + uv = i16v; // int16 -> uint + uv = u16v; // uint16 -> uint + + i16v = i16vec2(fv); // float -> int16 + u16v = u16vec2(fv); // float -> uint16 + fv = i16v; // int16 -> float + fv = u16v; // uint16 -> float + + i16v = i16vec2(dv); // double -> int16 + u16v = u16vec2(dv); // double -> uint16 + dv = i16v; // int16 -> double + dv = u16v; // uint16 -> double + + i16v = i16vec2(f16v); // float16 -> int16 + u16v = u16vec2(f16v); // float16 -> uint16 + f16v = i16v; // int16 -> float16 + f16v = u16v; // uint16 -> float16 + + i16v = i16vec2(i64v); // int64 -> int16 + u16v = u16vec2(i64v); // int64 -> uint16 + i64v = i16v; // int16 -> int64 + i64v = i64vec2(u16v); // uint16 -> int64 + + i16v = i16vec2(u64v); // uint64 -> int16 + u16v = u16vec2(u64v); // uint64 -> uint16 + u64v = i16v; // int16 -> uint64 + u64v = u16v; // uint16 -> uint64 + + i16v = i16vec2(u16v); // uint16 -> int16 + u16v = i16v; // int16 -> uint16 +} + +void builtinFuncs() +{ + i16vec2 i16v; + u16vec3 u16v; + f16vec3 f16v; + bvec3 bv; + + int16_t i16; + uint16_t u16; + + // abs() + i16v = abs(i16v); + + // sign() + i16v = sign(i16v); + + // min() + i16v = min(i16v, i16); + i16v = min(i16v, i16vec2(-1s)); + u16v = min(u16v, u16); + u16v = min(u16v, u16vec3(0us)); + + // max() + i16v = max(i16v, i16); + i16v = max(i16v, i16vec2(-1s)); + u16v = max(u16v, u16); + u16v = max(u16v, u16vec3(0us)); + + // clamp() + i16v = clamp(i16v, -i16, i16); + i16v = clamp(i16v, -i16v, i16v); + u16v = clamp(u16v, -u16, u16); + u16v = clamp(u16v, -u16v, u16v); + + // mix() + i16 = mix(i16v.x, i16v.y, true); + i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false)); + u16 = mix(u16v.x, u16v.y, true); + u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false)); + + // frexp() + i16vec3 exp; + f16v = frexp(f16v, exp); + + // ldexp() + f16v = ldexp(f16v, exp); + + // float16BitsToInt16() + i16v = float16BitsToInt16(f16v.xy); + + // float16BitsToUint16() + u16v.x = float16BitsToUint16(f16v.z); + + // int16BitsToFloat16() + f16v.xy = int16BitsToFloat16(i16v); + + // uint16BitsToFloat16() + f16v = uint16BitsToFloat16(u16v); + + // packInt2x16() + int packi = packInt2x16(i16v); + + // unpackInt2x16() + i16v = unpackInt2x16(packi); + + // packUint2x16() + uint packu = packUint2x16(u16v.xy); + + // unpackUint2x16() + u16v.xy = unpackUint2x16(packu); + + // packInt4x16() + int64_t packi64 = packInt4x16(i16vec4(i16)); + + // unpackInt4x16() + i16v = unpackInt4x16(packi64).xy; + + // packUint4x16() + uint64_t packu64 = packUint4x16(u16vec4(u16)); + + // unpackUint4x16() + u16v = unpackUint4x16(packu64).xyz; + + // lessThan() + bv = lessThan(u16v, u16vec3(u16)); + bv.xy = lessThan(i16v, i16vec2(i16)); + + // lessThanEqual() + bv = lessThanEqual(u16v, u16vec3(u16)); + bv.xy = lessThanEqual(i16v, i16vec2(i16)); + + // greaterThan() + bv = greaterThan(u16v, u16vec3(u16)); + bv.xy = greaterThan(i16v, i16vec2(i16)); + + // greaterThanEqual() + bv = greaterThanEqual(u16v, u16vec3(u16)); + bv.xy = greaterThanEqual(i16v, i16vec2(i16)); + + // equal() + bv = equal(u16v, u16vec3(u16)); + bv.xy = equal(i16v, i16vec2(i16)); + + // notEqual() + bv = notEqual(u16v, u16vec3(u16)); + bv.xy = notEqual(i16v, i16vec2(i16)); +} + +// Type conversion for specialization constant +layout(constant_id = 100) const int64_t si64 = -10L; +layout(constant_id = 101) const uint64_t su64 = 20UL; +layout(constant_id = 102) const int si = -5; +layout(constant_id = 103) const uint su = 4; +layout(constant_id = 104) const bool sb = true; +layout(constant_id = 105) const int16_t si16 = -5S; +layout(constant_id = 106) const uint16_t su16 = 4US; + +// bool <-> int16/uint16 +const bool i16_to_b = bool(si16); +const bool u16_to_b = bool(su16); +const int16_t b_to_i16 = int16_t(sb); +const uint16_t b_to_u16 = uint16_t(sb); + +// int <-> int16/uint16 +const int i16_to_i = int(si16); +const int u16_to_i = int(su16); +const int16_t i_to_i16 = int16_t(si); +const uint16_t i_to_u16 = uint16_t(si); + +// uint <-> int16/uint16 +const uint i16_to_u = uint(si16); +const uint u16_to_u = uint(su16); +const int16_t u_to_i16 = int16_t(su); +const uint16_t u_to_u16 = uint16_t(su); + +// int64 <-> int16/uint16 +const int64_t i16_to_i64 = int64_t(si16); +const int64_t u16_to_i64 = int64_t(su16); +const int16_t i64_to_i16 = int16_t(si64); +const uint16_t i64_to_u16 = uint16_t(si64); + +// uint64 <-> int16/uint16 +const uint64_t i16_to_u64 = uint64_t(si16); +const uint64_t u16_to_u64 = uint64_t(su16); +const int16_t u64_to_i16 = int16_t(su64); +const uint16_t u64_to_u16 = uint16_t(su64); + +// int16 <-> uint16 +const uint16_t i16_to_u16 = uint16_t(si16); +const int16_t u16_to_i16 = int16_t(su16); + +void main() +{ + literal(); + operators(); + typeCast(); + builtinFuncs(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.frag index 9dd9090c855..d29894b8404 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int16.frag @@ -1,314 +1,251 @@ -#version 450 core - -#extension GL_ARB_gpu_shader_int64: enable -#extension GL_AMD_gpu_shader_half_float: enable -#extension GL_AMD_gpu_shader_int16: enable - -layout(binding = 0) uniform Uniforms -{ - uint i; -}; - -// int16/uint16 in block -layout(std140, binding = 1) uniform Block -{ - i16vec3 i16v; - uint16_t u16; -} block; - -// int16/uint16 for input -layout(location = 0) in flat u16vec3 iu16v; -layout(location = 1) in flat int16_t ii16; - -void literal() -{ - const int16_t i16c[3] = - { - 0x111S, // Hex - -2s, // Dec - 0400s, // Oct - }; - - const uint16_t u16c[] = - { - 0xFFFFus, // Hex - 65535US, // Dec - 0177777us, // Oct - }; - - uint16_t u16 = i16c[i] + u16c[i]; -} - -void operators() -{ - u16vec3 u16v; - int16_t i16; - uint16_t u16; - int i; - uint u; - bool b; - - // Unary - u16v++; - i16--; - ++i16; - --u16v; - - u16v = ~u16v; - - i16 = +i16; - u16v = -u16v; - - // Arithmetic - u16 += i16; - u16v -= u16v; - i16 *= i16; - u16v /= u16v; - u16v %= i16; - - u16v = u16v + u16v; - u16 = i16 - u16; - u16v = u16v * i16; - i16 = i16 * i16; - i16 = i16 % i16; - - // Shift - u16v <<= i; - i16 >>= u16v.y; - - i16 = i16 << u16v.z; - u16v = u16v << i16; - - // Relational - b = (u16v.x != i16); - b = (i16 == u16v.x); - b = (u16v.x > u16v.y); - b = (i16 < u); - b = (u16v.y >= u16v.x); - b = (i16 <= i); - - // Bitwise - u16v |= i16; - u16 = i16 | u16; - i16 &= i16; - u16v = u16v & u16v; - u16v ^= i16; - u16v = u16v ^ i16; -} - -void typeCast() -{ - bvec2 bv; - ivec2 iv; - uvec2 uv; - vec2 fv; - dvec2 dv; - - f16vec2 f16v; - i64vec2 i64v; - u64vec2 u64v; - i16vec2 i16v; - u16vec2 u16v; - - i16v = i16vec2(bv); // bool -> int16 - u16v = u16vec2(bv); // bool -> uint16 - bv = bvec2(i16v); // int16 -> bool - bv = bvec2(u16v); // uint16 -> bool - - i16v = i16vec2(iv); // int -> int16 - u16v = u16vec2(iv); // int -> uint16 - iv = i16v; // int16 -> int - iv = ivec2(u16v); // uint16 -> int - - i16v = i16vec2(uv); // uint -> int16 - u16v = u16vec2(uv); // uint -> uint16 - uv = i16v; // int16 -> uint - uv = u16v; // uint16 -> uint - - i16v = i16vec2(fv); // float -> int16 - u16v = u16vec2(fv); // float -> uint16 - fv = i16v; // int16 -> float - fv = u16v; // uint16 -> float - - i16v = i16vec2(dv); // double -> int16 - u16v = u16vec2(dv); // double -> uint16 - dv = i16v; // int16 -> double - dv = u16v; // uint16 -> double - - i16v = i16vec2(f16v); // float16 -> int16 - u16v = u16vec2(f16v); // float16 -> uint16 - f16v = i16v; // int16 -> float16 - f16v = u16v; // uint16 -> float16 - - i16v = i16vec2(i64v); // int64 -> int16 - u16v = u16vec2(i64v); // int64 -> uint16 - i64v = i16v; // int16 -> int64 - i64v = i64vec2(u16v); // uint16 -> int64 - - i16v = i16vec2(u64v); // uint64 -> int16 - u16v = u16vec2(u64v); // uint64 -> uint16 - u64v = i16v; // int16 -> uint64 - u64v = u16v; // uint16 -> uint64 - - i16v = i16vec2(u16v); // uint16 -> int16 - u16v = i16v; // int16 -> uint16 -} - -void builtinFuncs() -{ - i16vec2 i16v; - u16vec3 u16v; - f16vec3 f16v; - bvec3 bv; - - int16_t i16; - uint16_t u16; - - // abs() - i16v = abs(i16v); - - // sign() - i16v = sign(i16v); - - // min() - i16v = min(i16v, i16); - i16v = min(i16v, i16vec2(-1s)); - u16v = min(u16v, u16); - u16v = min(u16v, u16vec3(0us)); - - // max() - i16v = max(i16v, i16); - i16v = max(i16v, i16vec2(-1s)); - u16v = max(u16v, u16); - u16v = max(u16v, u16vec3(0us)); - - // clamp() - i16v = clamp(i16v, -i16, i16); - i16v = clamp(i16v, -i16v, i16v); - u16v = clamp(u16v, -u16, u16); - u16v = clamp(u16v, -u16v, u16v); - - // mix() - i16 = mix(i16v.x, i16v.y, true); - i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false)); - u16 = mix(u16v.x, u16v.y, true); - u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false)); - - // frexp() - i16vec3 exp; - f16v = frexp(f16v, exp); - - // ldexp() - f16v = ldexp(f16v, exp); - - // float16BitsToInt16() - i16v = float16BitsToInt16(f16v.xy); - - // float16BitsToUint16() - u16v.x = float16BitsToUint16(f16v.z); - - // int16BitsToFloat16() - f16v.xy = int16BitsToFloat16(i16v); - - // uint16BitsToFloat16() - f16v = uint16BitsToFloat16(u16v); - - // packInt2x16() - int packi = packInt2x16(i16v); - - // unpackInt2x16() - i16v = unpackInt2x16(packi); - - // packUint2x16() - uint packu = packUint2x16(u16v.xy); - - // unpackUint2x16() - u16v.xy = unpackUint2x16(packu); - - // packInt4x16() - int64_t packi64 = packInt4x16(i16vec4(i16)); - - // unpackInt4x16() - i16v = unpackInt4x16(packi64).xy; - - // packUint4x16() - uint64_t packu64 = packUint4x16(u16vec4(u16)); - - // unpackUint4x16() - u16v = unpackUint4x16(packu64).xyz; - - // lessThan() - bv = lessThan(u16v, u16vec3(u16)); - bv.xy = lessThan(i16v, i16vec2(i16)); - - // lessThanEqual() - bv = lessThanEqual(u16v, u16vec3(u16)); - bv.xy = lessThanEqual(i16v, i16vec2(i16)); - - // greaterThan() - bv = greaterThan(u16v, u16vec3(u16)); - bv.xy = greaterThan(i16v, i16vec2(i16)); - - // greaterThanEqual() - bv = greaterThanEqual(u16v, u16vec3(u16)); - bv.xy = greaterThanEqual(i16v, i16vec2(i16)); - - // equal() - bv = equal(u16v, u16vec3(u16)); - bv.xy = equal(i16v, i16vec2(i16)); - - // notEqual() - bv = notEqual(u16v, u16vec3(u16)); - bv.xy = notEqual(i16v, i16vec2(i16)); -} - -// Type conversion for specialization constant -layout(constant_id = 100) const int64_t si64 = -10L; -layout(constant_id = 101) const uint64_t su64 = 20UL; -layout(constant_id = 102) const int si = -5; -layout(constant_id = 103) const uint su = 4; -layout(constant_id = 104) const bool sb = true; -layout(constant_id = 105) const int16_t si16 = -5S; -layout(constant_id = 106) const uint16_t su16 = 4US; - -// bool <-> int16/uint16 -const bool i16_to_b = bool(si16); -const bool u16_to_b = bool(su16); -const int16_t b_to_i16 = int16_t(sb); -const uint16_t b_to_u16 = uint16_t(sb); - -// int <-> int16/uint16 -const int i16_to_i = int(si16); -const int u16_to_i = int(su16); -const int16_t i_to_i16 = int16_t(si); -const uint16_t i_to_u16 = uint16_t(si); - -// uint <-> int16/uint16 -const uint i16_to_u = uint(si16); -const uint u16_to_u = uint(su16); -const int16_t u_to_i16 = int16_t(su); -const uint16_t u_to_u16 = uint16_t(su); - -// int64 <-> int16/uint16 -const int64_t i16_to_i64 = int64_t(si16); -const int64_t u16_to_i64 = int64_t(su16); -const int16_t i64_to_i16 = int16_t(si64); -const uint16_t i64_to_u16 = uint16_t(si64); - -// uint64 <-> int16/uint16 -const uint64_t i16_to_u64 = uint64_t(si16); -const uint64_t u16_to_u64 = uint64_t(su16); -const int16_t u64_to_i16 = int16_t(su64); -const uint16_t u64_to_u16 = uint16_t(su64); - -// int16 <-> uint16 -const uint16_t i16_to_u16 = uint16_t(si16); -const int16_t u16_to_i16 = int16_t(su16); - -void main() -{ - literal(); - operators(); - typeCast(); - builtinFuncs(); -} +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +layout(binding = 0) uniform Uniforms +{ + uint index; +}; + +layout(std140, binding = 1) uniform Block +{ + int16_t i16; + i16vec2 i16v2; + i16vec3 i16v3; + i16vec4 i16v4; + uint16_t u16; + u16vec2 u16v2; + u16vec3 u16v3; + u16vec4 u16v4; +} block; + +void main() +{ +} + +void literal() +{ + const int16_t i16Const[3] = + { + int16_t(-0x1111), // Hex + int16_t(-1), // Dec + int16_t(040000), // Oct + }; + + int16_t i16 = i16Const[index]; + + const uint16_t u16Const[] = + { + uint16_t(0xFFFF), // Hex + uint16_t(65535), // Dec + uint16_t(077777), // Oct + }; + + uint16_t u16 = u16Const[index]; +} + +void typeCast16() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + i32v = i16v; // int16_t -> int32_t + i32v = u16v; // uint16_t -> int32_t + u16v = i16v; // int16_t -> uint16_t + u32v = i16v; // int16_t -> uint32_t + i64v = i16v; // int16_t -> int64_t + u64v = i16v; // int16_t -> uint64_t + u32v = u16v; // uint16_t -> uint32_t + i64v = u16v; // uint16_t -> int64_t + u64v = u16v; // uint16_t -> uint64_t + f16v = i16v; // int16_t -> float16_t + f32v = i16v; // int16_t -> float32_t + f64v = i16v; // int16_t -> float64_t + f16v = u16v; // uint16_t -> float16_t + f32v = u16v; // uint16_t -> float32_t + f64v = u16v; // uint16_t -> float64_t + + i32v = i32vec2(i16v); // int16_t -> int32_t + i32v = i32vec2(u16v); // uint16_t -> int32_t + u16v = u16vec2(i16v); // int16_t -> uint16_t + u32v = u32vec2(i16v); // int16_t -> uint32_t + i64v = i64vec2(i16v); // int16_t -> int64_t + u64v = i64vec2(i16v); // int16_t -> uint64_t + u32v = u32vec2(u16v); // uint16_t -> uint32_t + i64v = i64vec2(u16v); // uint16_t -> int64_t + u64v = i64vec2(u16v); // uint16_t -> uint64_t + f16v = f16vec2(i16v); // int16_t -> float16_t + f32v = f32vec2(i16v); // int16_t -> float32_t + f64v = f64vec2(i16v); // int16_t -> float64_t + f16v = f16vec2(u16v); // uint16_t -> float16_t + f32v = f32vec2(u16v); // uint16_t -> float32_t + f64v = f64vec2(u16v); // uint16_t -> float64_t + + i8v = i8vec2(i16v); // int16_t -> int8_t + i8v = i8vec2(u16v); // uint16_t -> int8_t + u8v = u8vec2(i16v); // int16_t -> uint8_t + u8v = u8vec2(u16v); // uint16_t -> uint8_t + i16v = u8vec2(u16v); // uint16_t -> int16_t + i16v = i16vec2(bv); // bool -> int16 + u16v = u16vec2(bv); // bool -> uint16 + bv = bvec2(i16v); // int16 -> bool + bv = bvec2(u16v); // uint16 -> bool +} +void operators() +{ + u16vec3 u16v; + int16_t i16; + uvec3 uv; + int32_t i; + int64_t i64; + bool b; + + // Unary + u16v++; + i16--; + ++i16; + --u16v; + + u16v = ~u16v; + + i16 = +i16; + u16v = -u16v; + + // Arithmetic + i16 += i16; + u16v -= u16v; + i *= i16; + uv /= u16v; + uv %= i16; + + uv = u16v + uv; + i64 = i16 - i64; + uv = u16v * uv; + i64 = i16 * i64; + i = i16 % i; + + // Shift + u16v <<= i16; + i16 >>= u16v.y; + + i16 = i16 << u16v.z; + uv = u16v << i; + + // Relational + b = (u16v.x != i16); + b = (i16 == u16v.x); + b = (u16v.x > uv.y); + b = (i16 < i); + b = (u16v.y >= uv.x); + b = (i16 <= i); + + // Bitwise + uv |= i16; + i = i16 | i; + i64 &= i16; + uv = u16v & uv; + uv ^= i16; + u16v = u16v ^ i16; +} + +void builtinFuncs() +{ + i16vec2 i16v; + i16vec4 i16v4; + u16vec3 u16v; + u16vec2 u16v2; + u16vec4 u16v4; + bvec3 bv; + int16_t i16; + uint16_t u16; + int32_t i32; + uint32_t u32; + int64_t i64; + uint64_t u64; + + // abs() + i16v = abs(i16v); + + // sign() + i16 = sign(i16); + + // min() + i16v = min(i16v, i16); + i16v = min(i16v, i16vec2(-1)); + u16v = min(u16v, u16); + u16v = min(u16v, u16vec3(0)); + + // max() + i16v = max(i16v, i16); + i16v = max(i16v, i16vec2(-1)); + u16v = max(u16v, u16); + u16v = max(u16v, u16vec3(0)); + + // clamp() + i16v = clamp(i16v, -i16, i16); + i16v = clamp(i16v, -i16v, i16v); + u16v = clamp(u16v, -u16, u16); + u16v = clamp(u16v, -u16v, u16v); + + // mix() + i16 = mix(i16v.x, i16v.y, true); + i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false)); + u16 = mix(u16v.x, u16v.y, true); + u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false)); + + //pack + i32 = pack32(i16v); + i64 = pack64(i16v4); + u32 = pack32(u16v2); + u64 = pack64(u16v4); + + i16v = unpack16(i32); + i16v4 = unpack16(i64); + u16v2 = unpack16(u32); + u16v4 = unpack16(u64); + + // lessThan() + bv = lessThan(u16v, u16vec3(u16)); + bv.xy = lessThan(i16v, i16vec2(i16)); + + // lessThanEqual() + bv = lessThanEqual(u16v, u16vec3(u16)); + bv.xy = lessThanEqual(i16v, i16vec2(i16)); + + // greaterThan() + bv = greaterThan(u16v, u16vec3(u16)); + bv.xy = greaterThan(i16v, i16vec2(i16)); + + // greaterThanEqual() + bv = greaterThanEqual(u16v, u16vec3(u16)); + bv.xy = greaterThanEqual(i16v, i16vec2(i16)); + + // equal() + bv = equal(u16v, u16vec3(u16)); + bv.xy = equal(i16v, i16vec2(i16)); + + // notEqual() + bv = notEqual(u16v, u16vec3(u16)); + bv.xy = notEqual(i16v, i16vec2(i16)); +} + +// Type conversion for specialization constant +layout(constant_id = 100) const int16_t si16 = int16_t(-10); +layout(constant_id = 101) const uint16_t su16 = uint16_t(20); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int32.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int32.frag new file mode 100644 index 00000000000..3a33c67c4cc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int32.frag @@ -0,0 +1,256 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +layout(binding = 0) uniform Uniforms +{ + uint index; +}; + +layout(std140, binding = 1) uniform Block +{ + int32_t i32; + i32vec2 i32v2; + i32vec3 i32v3; + i32vec4 i32v4; + uint32_t u32; + u32vec2 u32v2; + u32vec3 u32v3; + u32vec4 u32v4; +} block; + +void main() +{ +} + +void literal() +{ + + const int32_t i32Const[3] = + { + -0x11111111, // Hex + -1, // Dec + 04000000000, // Oct + }; + + int32_t i32 = i32Const[index]; + + const uint32_t u32Const[] = + { + 0xFFFFFFFF, // Hex + 4294967295, // Dec + 017777777777, // Oct + }; + + uint32_t u32 = u32Const[index]; +} + +void typeCast32() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + u32v = i32v; // int32_t -> uint32_t + i64v = i32v; // int32_t -> int64_t + u64v = i32v; // int32_t -> uint64_t + i64v = u32v; // uint32_t -> int64_t + u64v = u32v; // uint32_t -> uint64_t + f32v = i32v; // int32_t -> float32_t + f64v = i32v; // int32_t -> float64_t + f32v = u32v; // uint32_t -> float32_t + f64v = u32v; // uint32_t -> float64_t + + i8v = i8vec2(i32v); // int32_t -> int8_t + i8v = i8vec2(u32v); // uint32_t -> int8_t + i16v = i16vec2(i32v); // int32_t -> int16_t + i16v = i16vec2(u32v); // uint32_t -> int16_t + i32v = i32vec2(i32v); // int32_t -> int32_t + i32v = i32vec2(u32v); // uint32_t -> int32_t + i64v = i64vec2(i32v); // int32_t -> int64_t + i64v = i64vec2(u32v); // uint32_t -> int64_t + u8v = u8vec2(i32v); // int32_t -> uint8_t + u8v = u8vec2(u32v); // uint32_t -> uint8_t + u16v = u16vec2(i32v); // int32_t -> uint16_t + u16v = u16vec2(u32v); // uint32_t -> uint16_t + u32v = u32vec2(i32v); // int32_t -> uint32_t + u32v = u32vec2(u32v); // uint32_t -> uint32_t + u64v = u64vec2(i32v); // int32_t -> uint64_t + u64v = u64vec2(u32v); // uint32_t -> uint64_t + + f16v = f16vec2(i32v); // int32_t -> float16_t + f32v = f32vec2(i32v); // int32_t -> float32_t + f64v = f64vec2(i32v); // int32_t -> float64_t + f16v = f16vec2(u32v); // uint32_t -> float16_t + f32v = f32vec2(u32v); // uint32_t -> float32_t + f64v = f64vec2(u32v); // uint32_t -> float64_t + + i32v = i32vec2(bv); // bool -> int32 + u32v = u32vec2(bv); // bool -> uint32 + bv = bvec2(i32v); // int32 -> bool + bv = bvec2(u32v); // uint32 -> bool +} + +void operators() +{ + u32vec3 u32v; + int32_t i32; + uvec3 uv; + int32_t i; + int64_t i64; + bool b; + + // Unary + u32v++; + i32--; + ++i32; + --u32v; + + u32v = ~u32v; + + i32 = +i32; + u32v = -u32v; + + // Arithmetic + i32 += i32; + u32v -= u32v; + i *= i32; + uv /= u32v; + uv %= i32; + + uv = u32v + uv; + i64 = i32 - i64; + uv = u32v * uv; + i64 = i32 * i64; + i = i32 % i; + + // Shift + u32v <<= i32; + i32 >>= u32v.y; + + i64 = i64 << u32v.z; + uv = u32v << i; + + // Relational + b = (u32v.x != i32); + b = (i32 == u32v.x); + b = (u32v.x > uv.y); + b = (i32 < i); + b = (u32v.y >= uv.x); + b = (i32 <= i); + + // Bitwise + uv |= i32; + i = i32 | i; + i64 &= i32; + uv = u32v & uv; + uv ^= i32; + u32v = u32v ^ i32; +} + +void builtinFuncs() +{ + i32vec2 i32v; + i32vec4 i32v4; + u32vec3 u32v; + u32vec2 u32v2; + u32vec4 u32v4; + bvec3 bv; + int32_t i32; + uint32_t u32; + int64_t i64; + uint64_t u64; + i8vec4 i8v4; + u8vec4 u8v4; + i16vec2 i16v2; + u16vec2 u16v2; + + // abs() + i32v = abs(i32v); + + // sign() + i32 = sign(i32); + + // min() + i32v = min(i32v, i32); + i32v = min(i32v, i32vec2(-1)); + u32v = min(u32v, u32); + u32v = min(u32v, u32vec3(0)); + + // max() + i32v = max(i32v, i32); + i32v = max(i32v, i32vec2(-1)); + u32v = max(u32v, u32); + u32v = max(u32v, u32vec3(0)); + + // clamp() + i32v = clamp(i32v, -i32, i32); + i32v = clamp(i32v, -i32v, i32v); + u32v = clamp(u32v, -u32, u32); + u32v = clamp(u32v, -u32v, u32v); + + // mix() + i32 = mix(i32v.x, i32v.y, true); + i32v = mix(i32vec2(i32), i32vec2(-i32), bvec2(false)); + u32 = mix(u32v.x, u32v.y, true); + u32v = mix(u32vec3(u32), u32vec3(-u32), bvec3(false)); + + //pack + i32 = pack32(i8v4); + i32 = pack32(i16v2); + u32 = pack32(u8v4); + u32 = pack32(u16v2); + + i32v = unpack32(i64); + u32v2 = unpack32(u64); + + // lessThan() + bv = lessThan(u32v, u32vec3(u32)); + bv.xy = lessThan(i32v, i32vec2(i32)); + + // lessThanEqual() + bv = lessThanEqual(u32v, u32vec3(u32)); + bv.xy = lessThanEqual(i32v, i32vec2(i32)); + + // greaterThan() + bv = greaterThan(u32v, u32vec3(u32)); + bv.xy = greaterThan(i32v, i32vec2(i32)); + + // greaterThanEqual() + bv = greaterThanEqual(u32v, u32vec3(u32)); + bv.xy = greaterThanEqual(i32v, i32vec2(i32)); + + // equal() + bv = equal(u32v, u32vec3(u32)); + bv.xy = equal(i32v, i32vec2(i32)); + + // notEqual() + bv = notEqual(u32v, u32vec3(u32)); + bv.xy = notEqual(i32v, i32vec2(i32)); +} + +// Type conversion for specialization constant +layout(constant_id = 100) const int32_t si32 = -10; +layout(constant_id = 101) const uint32_t su32 = 20U; +layout(constant_id = 102) const int si = -5; +layout(constant_id = 103) const uint su = 4; +layout(constant_id = 104) const bool sb = true; + +#define UINT32_MAX 4294967295u +uint32_t u32Max = UINT32_MAX; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int64.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int64.frag index 8021b7e90fa..4ec04cd8e19 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int64.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int64.frag @@ -1,6 +1,7 @@ #version 450 #extension GL_ARB_gpu_shader_int64: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require layout(binding = 0) uniform Uniforms { @@ -115,6 +116,8 @@ void operators() i64 = i64 % i; // Shift + u64v = u64v << i; + i64 = i64 >> uv.y; u64v <<= i; i64 >>= uv.y; @@ -233,6 +236,7 @@ layout(constant_id = 101) const uint64_t su64 = 20UL; layout(constant_id = 102) const int si = -5; layout(constant_id = 103) const uint su = 4; layout(constant_id = 104) const bool sb = true; +layout(constant_id = 105) const uint64_t su64inc = su64 + 1UL; // bool <-> int64/uint64 const bool i64_to_b = bool(si64); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.int8.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int8.frag new file mode 100644 index 00000000000..f41c62f548a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.int8.frag @@ -0,0 +1,253 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +layout(binding = 0) uniform Uniforms +{ + uint index; +}; + +layout(std140, binding = 1) uniform Block +{ + int8_t i8; + i8vec2 i8v2; + i8vec3 i8v3; + i8vec4 i8v4; + uint8_t u8; + u8vec2 u8v2; + u8vec3 u8v3; + u8vec4 u8v4; +} block; + +void main() +{ +} + +void literal() +{ + const int8_t i8Const[3] = + { + int8_t(-0x11), // Hex + int8_t(-1), // Dec + int8_t(0400), // Oct + }; + + int8_t i8 = i8Const[index]; + + const uint8_t u8Const[] = + { + uint8_t(0xFF), // Hex + uint8_t(255), // Dec + uint8_t(0177), // Oct + }; + + uint8_t u8 = u8Const[index]; +} + +void typeCast8() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + u8v = i8v; // int8_t -> uint8_t + i16v = i8v; // int8_t -> int16_t + i16v = u8v; // uint8_t -> int16_t + i32v = i8v; // int8_t -> int32_t + i32v = u8v; // uint8_t -> int32_t + u32v = i8v; // int8_t -> uint32_t + i64v = i8v; // int8_t -> int64_t + u64v = i8v; // int8_t -> uint64_t + u32v = u8v; // uint8_t -> uint32_t + i64v = u8v; // uint8_t -> int64_t + u64v = u8v; // uint8_t -> uint64_t + f16v = i8v; // int8_t -> float16_t + f32v = i8v; // int8_t -> float32_t + f64v = i8v; // int8_t -> float64_t + f16v = u8v; // uint8_t -> float16_t + f32v = u8v; // uint8_t -> float32_t + f64v = u8v; // uint8_t -> float64_t + + i8v = i8vec2(u8v); // uint8_t -> int8_t + i16v = i16vec2(i8v); // int8_t -> int16_t + i16v = i16vec2(u8v); // uint8_t -> int16_t + i32v = i32vec2(i8v); // int8_t -> int32_t + i32v = i32vec2(u8v); // uint8_t -> int32_t + i64v = i64vec2(i8v); // int8_t -> int64_t + u64v = i64vec2(i8v); // int8_t -> uint64_t + u16v = u16vec2(i8v); // int8_t -> uint16_t + u16v = u16vec2(u8v); // uint8_t -> uint16_t + u32v = u32vec2(u8v); // uint8_t -> uint32_t + i64v = i64vec2(u8v); // uint8_t -> int64_t + u64v = i64vec2(u8v); // uint8_t -> uint64_t + f16v = f16vec2(i8v); // int8_t -> float16_t + f32v = f32vec2(i8v); // int8_t -> float32_t + f64v = f64vec2(i8v); // int8_t -> float64_t + f16v = f16vec2(u8v); // uint8_t -> float16_t + f32v = f32vec2(u8v); // uint8_t -> float32_t + f64v = f64vec2(u8v); // uint8_t -> float64_t + + i8v = i8vec2(bv); // bool -> int8 + u8v = u8vec2(bv); // bool -> uint8 + bv = bvec2(i8v); // int8 -> bool + bv = bvec2(u8v); // uint8 -> bool +} + +void operators() +{ + u8vec3 u8v; + int8_t i8; + uvec3 uv; + int32_t i; + int16_t i16; + bool b; + + // Unary + u8v++; + i8--; + ++i8; + --u8v; + + u8v = ~u8v; + + i8 = +i8; + u8v = -u8v; + + // Arithmetic + i8 += i8; + u8v -= u8v; + i *= i8; + uv /= u8v; + uv %= i8; + + uv = u8v + uv; + i16 = i8 - i16; + uv = u8v * uv; + i16 = i8 * i16; + i = i8 % i; + + // Shift + u8v <<= i8; + i8 >>= u8v.y; + + i8 = i8 << u8v.z; + u8v = u8v << i8; + + // Relational + b = (u8v.x != i8); + b = (i8 == u8v.x); + b = (u8v.x > uv.y); + b = (i8 < i); + b = (u8v.y >= uv.x); + b = (i8 <= i); + + // Bitwise + uv |= i8; + i = i8 | i; + i16 &= i8; + uv = u8v & uv; + uv ^= i8; + u8v = u8v ^ i8; +} + +void builtinFuncs() +{ + i8vec2 i8v; + i8vec4 i8v4; + u8vec3 u8v; + u8vec2 u8v2; + u8vec4 u8v4; + bvec3 bv; + int16_t i16; + int32_t i32; + uint16_t u16; + uint32_t u32; + + int8_t i8; + uint8_t u8; + + // abs() + i8v = abs(i8v); + + // sign() + i8 = sign(i8); + + // min() + i8v = min(i8v, i8); + i8v = min(i8v, i8vec2(-1)); + u8v = min(u8v, u8); + u8v = min(u8v, u8vec3(0)); + + // max() + i8v = max(i8v, i8); + i8v = max(i8v, i8vec2(-1)); + u8v = max(u8v, u8); + u8v = max(u8v, u8vec3(0)); + + // clamp() + i8v = clamp(i8v, -i8, i8); + i8v = clamp(i8v, -i8v, i8v); + u8v = clamp(u8v, -u8, u8); + u8v = clamp(u8v, -u8v, u8v); + + // mix() + i8 = mix(i8v.x, i8v.y, true); + i8v = mix(i8vec2(i8), i8vec2(-i8), bvec2(false)); + u8 = mix(u8v.x, u8v.y, true); + u8v = mix(u8vec3(u8), u8vec3(-u8), bvec3(false)); + + //pack + i16 = pack16(i8v); + i32 = pack32(i8v4); + u16 = pack16(u8v2); + u32 = pack32(u8v4); + + i8v = unpack8(i16); + i8v4 = unpack8(i32); + u8v2 = unpack8(u16); + u8v4 = unpack8(u32); + + // lessThan() + bv = lessThan(u8v, u8vec3(u8)); + bv.xy = lessThan(i8v, i8vec2(i8)); + + // lessThanEqual() + bv = lessThanEqual(u8v, u8vec3(u8)); + bv.xy = lessThanEqual(i8v, i8vec2(i8)); + + // greaterThan() + bv = greaterThan(u8v, u8vec3(u8)); + bv.xy = greaterThan(i8v, i8vec2(i8)); + + // greaterThanEqual() + bv = greaterThanEqual(u8v, u8vec3(u8)); + bv.xy = greaterThanEqual(i8v, i8vec2(i8)); + + // equal() + bv = equal(u8v, u8vec3(u8)); + bv.xy = equal(i8v, i8vec2(i8)); + + // notEqual() + bv = notEqual(u8v, u8vec3(u8)); + bv.xy = notEqual(i8v, i8vec2(i8)); +} + +// Type conversion for specialization constant +layout(constant_id = 100) const int8_t si8 = int8_t(-10); +layout(constant_id = 101) const uint8_t su8 = uint8_t(20); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.memoryScopeSemantics.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.memoryScopeSemantics.comp new file mode 100644 index 00000000000..c03c1239415 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.memoryScopeSemantics.comp @@ -0,0 +1,61 @@ +#version 450 +#extension GL_KHR_memory_scope_semantics : require +#extension GL_ARB_gpu_shader_int64 : require + +#pragma use_vulkan_memory_model + +shared uint value; +shared int atomi; +shared uint atomu; +layout(binding = 0, r32ui) workgroupcoherent uniform uimage2D imageu; +layout(binding = 1, r32i) volatile coherent uniform iimage2D imagei; +layout(binding = 5, r32i) nonprivate uniform iimage2D imagej[2]; +layout (binding = 2) buffer BufferU { workgroupcoherent uint x; } bufferu; +layout (binding = 3) coherent buffer BufferI { uint x; } bufferi; +struct A { uint x[2]; }; +layout (binding = 4) volatile buffer BufferJ { subgroupcoherent A a; } bufferj[2]; +layout (binding = 6) nonprivate uniform sampler2D samp[2]; +layout (binding = 7) nonprivate uniform BufferK { uint x; } bufferk; +shared uint64_t atomu64; +shared int64_t atomi64; + + +void main() +{ + int origi = atomicAdd(atomi, 3, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); + uint origu = atomicAnd(atomu, value); + origi = atomicLoad(atomi, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + origu = imageAtomicAdd(imageu, ivec2(0,0), 3u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + imageAtomicStore(imageu, ivec2(0,0), 4u, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + origu = atomicOr(atomu, 7u, gl_ScopeDevice, 0, 0); + origu = atomicXor(atomu, 7u, gl_ScopeDevice, 0, 0); + origu = atomicMin(atomu, value, gl_ScopeDevice, 0, 0); + origi = atomicMax(atomi, 7, gl_ScopeDevice, 0, 0); + origi = atomicExchange(atomi, origi, gl_ScopeDevice, 0, 0); + origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); + atomicAdd(bufferu.x, 1, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); + controlBarrier(gl_ScopeWorkgroup, gl_ScopeWorkgroup, 0, 0); + + uint y; + y = bufferu.x; + bufferu.x = y; + y = bufferi.x; + y = bufferj[0].a.x[1]; + bufferi.x = y; + bufferj[0].a.x[1] = y; + bufferj[0].a = bufferj[1].a; + bufferi.x = bufferk.x; + + imageLoad(imagei, ivec2(0,0)); + imageLoad(imagej[0], ivec2(0,0)); + imageStore(imagej[1], ivec2(0,0), ivec4(0,0,0,0)); + texture(samp[0], vec2(0,0)); + + atomu64 = atomicMax(atomu64, uint64_t(7), gl_ScopeDevice, 0, 0); + atomicCompSwap(atomi64, int64_t(10), int64_t(atomu64), gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.memoryScopeSemantics_Error.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.memoryScopeSemantics_Error.comp new file mode 100644 index 00000000000..4e18b2e08ca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.memoryScopeSemantics_Error.comp @@ -0,0 +1,28 @@ +#version 450 +#extension GL_KHR_memory_scope_semantics : require + + +shared uint value; +shared int atomi; +shared uint atomu; +layout(binding = 0, r32ui) workgroupcoherent uniform uimage2D imageu; +layout(binding = 1, r32i) coherent uniform iimage2D imagei; +layout (binding = 2) buffer BufferU { workgroupcoherent uint x; } bufferu; +layout (binding = 3) subgroupcoherent buffer BufferI { uint x; } bufferi; + +void main() +{ + atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquire); + int origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease); + atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease); + atomicStore(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_StorageSemanticsBuffer); + origi = imageAtomicLoad(imagei, ivec2(0,0), gl_ScopeDevice, gl_SemanticsAcquire, gl_SemanticsAcquire); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, 0); + memoryBarrier(gl_ScopeWorkgroup, 0, gl_SemanticsRelease); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsRelease | gl_SemanticsAcquire); + atomicAdd(atomu, value, gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsAcquire); + uint origu = atomicCompSwap(atomu, 10u, value, gl_ScopeDevice, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquire, gl_StorageSemanticsBuffer | gl_StorageSemanticsShared, gl_SemanticsAcquireRelease); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsRelease | gl_SemanticsMakeVisible); + memoryBarrier(gl_ScopeWorkgroup, gl_StorageSemanticsBuffer, gl_SemanticsAcquire | gl_SemanticsMakeAvailable); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh new file mode 100644 index 00000000000..8adff3d8243 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh @@ -0,0 +1,63 @@ +#version 460 + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of builtins in mesh shaders: + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint gid = gl_WorkGroupID.x; + + gl_MeshVerticesNV[iid].gl_Position = vec4(1.0); + gl_MeshVerticesNV[iid].gl_PointSize = 2.0; + gl_MeshVerticesNV[iid].gl_ClipDistance[3] = 3.0; + gl_MeshVerticesNV[iid].gl_CullDistance[2] = 4.0; + + BARRIER(); + + gl_MeshVerticesNV[iid+1].gl_Position = gl_MeshVerticesNV[iid].gl_Position; + gl_MeshVerticesNV[iid+1].gl_PointSize = gl_MeshVerticesNV[iid].gl_PointSize; + gl_MeshVerticesNV[iid+1].gl_ClipDistance[3] = gl_MeshVerticesNV[iid].gl_ClipDistance[3]; + gl_MeshVerticesNV[iid+1].gl_CullDistance[2] = gl_MeshVerticesNV[iid].gl_CullDistance[2]; + + BARRIER(); + + gl_MeshPrimitivesNV[iid].gl_PrimitiveID = 6; + gl_MeshPrimitivesNV[iid].gl_Layer = 7; + gl_MeshPrimitivesNV[iid].gl_ViewportIndex = 8; + gl_MeshPrimitivesNV[iid].gl_ViewportMask[0] = 9; + + BARRIER(); + + gl_MeshPrimitivesNV[iid+1].gl_PrimitiveID = gl_MeshPrimitivesNV[iid].gl_PrimitiveID; + gl_MeshPrimitivesNV[iid+1].gl_Layer = gl_MeshPrimitivesNV[iid].gl_Layer; + gl_MeshPrimitivesNV[iid+1].gl_ViewportIndex = gl_MeshPrimitivesNV[iid].gl_ViewportIndex; + gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0]; + + BARRIER(); + + // should truncate 257 -> 1 + gl_PrimitiveIndicesNV[0] = 257; + gl_PrimitiveIndicesNV[gid] = gl_PrimitiveIndicesNV[gid-1]; + + // writes 4 indices at offset gl_DrawID + writePackedPrimitiveIndices4x8NV(gl_DrawID, 0x01020304); + + gl_PrimitiveCountNV = MAX_PRIM * 3; + + BARRIER(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderPerViewBuiltins.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderPerViewBuiltins.mesh new file mode 100644 index 00000000000..54fb7440885 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderPerViewBuiltins.mesh @@ -0,0 +1,42 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 +#define MAX_VIEWS gl_MaxMeshViewCountNV + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of per-view builtin attributes + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS]; + + gl_MeshVerticesNV[iid].gl_PositionPerViewNV[viewID] = vec4(1.0, 2.0, 3.0, 4.0); + gl_MeshVerticesNV[iid].gl_ClipDistancePerViewNV[viewID][2] = 5.0; + gl_MeshVerticesNV[iid].gl_CullDistancePerViewNV[viewID][3] = 6.0; + gl_MeshPrimitivesNV[iid].gl_LayerPerViewNV[viewID] = 7; + gl_MeshPrimitivesNV[iid].gl_ViewportMaskPerViewNV[viewID][0] = 8; + + BARRIER(); + + gl_MeshVerticesNV[iid+1].gl_PositionPerViewNV[viewID] = gl_MeshVerticesNV[iid].gl_PositionPerViewNV[viewID]; + gl_MeshVerticesNV[iid+1].gl_ClipDistancePerViewNV[viewID][2] = gl_MeshVerticesNV[iid].gl_ClipDistancePerViewNV[viewID][2]; + gl_MeshVerticesNV[iid+1].gl_CullDistancePerViewNV[viewID][3] = gl_MeshVerticesNV[iid].gl_CullDistancePerViewNV[viewID][3]; + gl_MeshPrimitivesNV[iid+1].gl_LayerPerViewNV[viewID] = gl_MeshPrimitivesNV[iid].gl_LayerPerViewNV[viewID]; + gl_MeshPrimitivesNV[iid+1].gl_ViewportMaskPerViewNV[viewID][0] = gl_MeshPrimitivesNV[iid].gl_ViewportMaskPerViewNV[viewID][0]; + + BARRIER(); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderPerViewUserDefined.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderPerViewUserDefined.mesh new file mode 100644 index 00000000000..4a316eb24b7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderPerViewUserDefined.mesh @@ -0,0 +1,56 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 +#define MAX_VIEWS gl_MaxMeshViewCountNV + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of user-defined per-view attributes + +// mix of single-view and per-view attributes +layout(location=0) out block { + perprimitiveNV perviewNV vec4 color1[][3]; // Implicitly sized + perprimitiveNV vec4 color2[3]; + perviewNV vec4 color3[MAX_VIEWS][3]; // Explicitly sized + vec4 color4; +} b[]; + +// per-view block +perviewNV layout(location=10) out perviewBlock { + perprimitiveNV vec4 color5[]; // Implicitly sized + perprimitiveNV vec4 color6[MAX_VIEWS][3]; // Explicitly sized + vec4 color7[][3]; // Implicitly sized + vec4 color8[MAX_VIEWS]; // Explicitly sized +} b2[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS]; + + b[iid].color1[viewID][2] = vec4(1.0); + b[iid].color2[1] = vec4(2.0); + b[iid].color3[viewID][2] = vec4(3.0); + b[iid].color4 = vec4(4.0); + + BARRIER(); + + b2[iid].color5[viewID] = vec4(5.0); + b2[iid].color6[viewID][1] = vec4(6.0); + b2[iid].color7[viewID][2] = vec4(7.0); + b2[iid].color8[viewID] = vec4(8.0); + + BARRIER(); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh new file mode 100644 index 00000000000..38107b295a6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh @@ -0,0 +1,66 @@ +#version 460 + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of redeclared single-view builtins in mesh shaders: + +out gl_MeshPerVertexNV { + vec4 gl_Position; + float gl_PointSize; + float gl_ClipDistance[4]; + float gl_CullDistance[4]; +} gl_MeshVerticesNV[]; + +perprimitiveNV out gl_MeshPerPrimitiveNV { + int gl_PrimitiveID; + int gl_Layer; + int gl_ViewportIndex; + int gl_ViewportMask[]; +} gl_MeshPrimitivesNV[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint gid = gl_WorkGroupID.x; + + gl_MeshVerticesNV[iid].gl_Position = vec4(1.0); + gl_MeshVerticesNV[iid].gl_PointSize = 2.0; + gl_MeshVerticesNV[iid].gl_ClipDistance[3] = 3.0; + gl_MeshVerticesNV[iid].gl_CullDistance[2] = 4.0; + + BARRIER(); + + gl_MeshVerticesNV[iid+1].gl_Position = gl_MeshVerticesNV[iid].gl_Position; + gl_MeshVerticesNV[iid+1].gl_PointSize = gl_MeshVerticesNV[iid].gl_PointSize; + gl_MeshVerticesNV[iid+1].gl_ClipDistance[3] = gl_MeshVerticesNV[iid].gl_ClipDistance[3]; + gl_MeshVerticesNV[iid+1].gl_CullDistance[2] = gl_MeshVerticesNV[iid].gl_CullDistance[2]; + + BARRIER(); + + gl_MeshPrimitivesNV[iid].gl_PrimitiveID = 6; + gl_MeshPrimitivesNV[iid].gl_Layer = 7; + gl_MeshPrimitivesNV[iid].gl_ViewportIndex = 8; + gl_MeshPrimitivesNV[iid].gl_ViewportMask[0] = 9; + + BARRIER(); + + gl_MeshPrimitivesNV[iid+1].gl_PrimitiveID = gl_MeshPrimitivesNV[iid].gl_PrimitiveID; + gl_MeshPrimitivesNV[iid+1].gl_Layer = gl_MeshPrimitivesNV[iid].gl_Layer; + gl_MeshPrimitivesNV[iid+1].gl_ViewportIndex = gl_MeshPrimitivesNV[iid].gl_ViewportIndex; + gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0]; + + BARRIER(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderRedeclPerViewBuiltins.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderRedeclPerViewBuiltins.mesh new file mode 100644 index 00000000000..3b75b5583a4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderRedeclPerViewBuiltins.mesh @@ -0,0 +1,53 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 +#define MAX_VIEWS gl_MaxMeshViewCountNV + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of redeclared per-view builtin attributes + +out gl_MeshPerVertexNV { + perviewNV vec4 gl_PositionPerViewNV[MAX_VIEWS]; // explicitly sized view dim + perviewNV float gl_ClipDistancePerViewNV[MAX_VIEWS][4]; // explicitly sized view dim + perviewNV float gl_CullDistancePerViewNV[MAX_VIEWS][4]; // explicitly sized view dim +} gl_MeshVerticesNV[]; + +perprimitiveNV out gl_MeshPerPrimitiveNV { + perviewNV int gl_LayerPerViewNV[]; // implicitly sized view dim + perviewNV int gl_ViewportMaskPerViewNV[][1]; // implicitly sized view dim +} gl_MeshPrimitivesNV[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS]; + + gl_MeshVerticesNV[iid].gl_PositionPerViewNV[viewID] = vec4(1.0, 2.0, 3.0, 4.0); + gl_MeshVerticesNV[iid].gl_ClipDistancePerViewNV[viewID][2] = 5.0; + gl_MeshVerticesNV[iid].gl_CullDistancePerViewNV[viewID][3] = 6.0; + gl_MeshPrimitivesNV[iid].gl_LayerPerViewNV[viewID] = 7; + gl_MeshPrimitivesNV[iid].gl_ViewportMaskPerViewNV[viewID][0] = 8; + + BARRIER(); + + gl_MeshVerticesNV[iid+1].gl_PositionPerViewNV[viewID] = gl_MeshVerticesNV[iid].gl_PositionPerViewNV[viewID]; + gl_MeshVerticesNV[iid+1].gl_ClipDistancePerViewNV[viewID][2] = gl_MeshVerticesNV[iid].gl_ClipDistancePerViewNV[viewID][2]; + gl_MeshVerticesNV[iid+1].gl_CullDistancePerViewNV[viewID][3] = gl_MeshVerticesNV[iid].gl_CullDistancePerViewNV[viewID][3]; + gl_MeshPrimitivesNV[iid+1].gl_LayerPerViewNV[viewID] = gl_MeshPrimitivesNV[iid].gl_LayerPerViewNV[viewID]; + gl_MeshPrimitivesNV[iid+1].gl_ViewportMaskPerViewNV[viewID][0] = gl_MeshPrimitivesNV[iid].gl_ViewportMaskPerViewNV[viewID][0]; + + BARRIER(); +} + diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderSharedMem.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderSharedMem.mesh new file mode 100644 index 00000000000..b9d2f6d7ed7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderSharedMem.mesh @@ -0,0 +1,39 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of shared memory in mesh shaders: + +writeonly uniform image2D uni_image; +uniform block0 { + uint uni_value; +}; + +shared vec4 mem[10]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint gid = gl_WorkGroupID.x; + + for (uint i = 0; i < 10; ++i) { + mem[i] = vec4(i+uni_value); + } + imageStore(uni_image, ivec2(iid), mem[gid]); + imageStore(uni_image, ivec2(iid), mem[gid+1]); + + BARRIER(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderTaskMem.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderTaskMem.mesh new file mode 100644 index 00000000000..5ce5beddccf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderTaskMem.mesh @@ -0,0 +1,41 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of task memory in mesh shaders: + +taskNV in taskBlock { + float gid1[2]; + vec4 gid2; +} mytask; + +buffer bufferBlock { + float gid3[2]; + vec4 gid4; +} mybuf; + +layout(location=0) out outBlock { + float gid5; + vec4 gid6; +} myblk[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + + myblk[iid].gid5 = mytask.gid1[1] + mybuf.gid3[1]; + myblk[iid].gid6 = mytask.gid2 + mybuf.gid4; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderUserDefined.mesh b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderUserDefined.mesh new file mode 100644 index 00000000000..8b0937dbcc2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshShaderUserDefined.mesh @@ -0,0 +1,59 @@ +#version 450 + +#define MAX_VER 81 +#define MAX_PRIM 32 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +layout(max_vertices=MAX_VER) out; +layout(max_primitives=MAX_PRIM) out; +layout(triangles) out; + +// test use of user defined interface out blocks: + +// per-primitive block +perprimitiveNV layout(location=0) out myblock { + float f; + float fArr[4]; + vec3 pos; + vec4 posArr[4]; + mat4 m; + mat3 mArr[2]; +} blk[]; + +// per-vertex block +layout(location=20) out myblock2 { + float f; + vec4 pos; + mat4 m; +} blk2[]; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint gid = gl_WorkGroupID.x; + + blk[iid].f = 11.0; + blk[iid+1].fArr[gid] = blk[iid].f; + blk[iid/2].pos.yzx = vec3(14.0, 15.0, 13.0); + blk[iid*2].posArr[1].yzw = blk[iid/2].pos; + blk[iid/4].m[2].wzyx = vec4(13.0, 14.0, 15.0, 16.0); + blk[iid].mArr[0][1][1] = blk[iid/4].m[2].w; + blk[iid*4].mArr[1][gid] = vec3(17.0, 18.0, 19.0); + + BARRIER(); + + blk2[iid].f = blk2[iid-1].f + 20.0; + blk2[iid].pos = vec4(21.0, 22.0, 23.0, 24.0); + blk2[iid+1].m[gid] = blk2[iid].pos; + blk2[iid+1].m[gid][2] = 29.0; + blk2[iid+2].m[3] = blk2[iid+1].m[gid]; + + BARRIER(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshTaskShader.task b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshTaskShader.task new file mode 100644 index 00000000000..c12b3bdd19e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.meshTaskShader.task @@ -0,0 +1,49 @@ +#version 450 + +#define BARRIER() \ + memoryBarrierShared(); \ + barrier(); + +#extension GL_NV_mesh_shader : enable + +layout(local_size_x = 32) in; + +// test use of shared memory in task shaders: +layout(binding=0) writeonly uniform image2D uni_image; +uniform block0 { + uint uni_value; +}; +shared vec4 mem[10]; + +// test use of task memory in task shaders: +taskNV out Task { + vec2 dummy; + vec2 submesh[3]; +} mytask; + +void main() +{ + uint iid = gl_LocalInvocationID.x; + uint gid = gl_WorkGroupID.x; + + // 1. shared memory load and stores + for (uint i = 0; i < 10; ++i) { + mem[i] = vec4(i + uni_value); + } + imageStore(uni_image, ivec2(iid), mem[gid]); + imageStore(uni_image, ivec2(iid), mem[gid+1]); + + BARRIER(); + + // 2. task memory stores + + mytask.dummy = vec2(30.0, 31.0); + mytask.submesh[0] = vec2(32.0, 33.0); + mytask.submesh[1] = vec2(34.0, 35.0); + mytask.submesh[2] = mytask.submesh[gid%2]; + + BARRIER(); + + // 3. set task count + gl_TaskCountNV = 3; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.noBuiltInLoc.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.noBuiltInLoc.vert index 5fbe25219e3..4087ab363b2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.noBuiltInLoc.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.noBuiltInLoc.vert @@ -10,6 +10,8 @@ uniform vec4 uv1; uniform float uv2; uniform vec3 uv3; +layout(binding = 0) uniform atomic_uint a_uint; + void main() { bar = foo; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.nonuniform.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.nonuniform.frag new file mode 100644 index 00000000000..d3b05a5ac92 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.nonuniform.frag @@ -0,0 +1,55 @@ +#version 450 + +#extension GL_EXT_nonuniform_qualifier : enable + +layout(location=0) nonuniformEXT in vec4 nu_inv4; +nonuniformEXT float nu_gf; +layout(location=1) in nonuniformEXT flat int nu_ii; + +layout(binding=0, input_attachment_index = 0) uniform subpassInput inputAttachmentDyn[]; +layout(binding=1) uniform samplerBuffer uniformTexelBufferDyn[]; +layout(binding=2, r32f) uniform imageBuffer storageTexelBufferDyn[]; +layout(binding=3) uniform uname { float a; } uniformBuffer[]; +layout(binding=4) buffer bname { float b; } storageBuffer[]; +layout(binding=5) uniform sampler2D sampledImage[]; +layout(binding=6, r32f) uniform image2D storageImage[]; +layout(binding=7, input_attachment_index = 1) uniform subpassInput inputAttachment[]; +layout(binding=8) uniform samplerBuffer uniformTexelBuffer[]; +layout(binding=9, r32f) uniform imageBuffer storageTexelBuffer[]; + +nonuniformEXT int foo(nonuniformEXT int nupi, nonuniformEXT out int f) +{ + return nupi; +} + +void main() +{ + nonuniformEXT int nu_li; + int dyn_i; + + int a = foo(nu_li, nu_li); + nu_li = nonuniformEXT(a) + nonuniformEXT(a * 2); + + float b; + b = nu_inv4.x * nu_gf; + b += subpassLoad(inputAttachmentDyn[dyn_i]).x; + b += texelFetch(uniformTexelBufferDyn[dyn_i], 1).x; + b += imageLoad(storageTexelBufferDyn[dyn_i], 1).x; + b += uniformBuffer[nu_ii].a; + b += storageBuffer[nu_ii].b; + b += texture(sampledImage[nu_ii], vec2(0.5)).x; + b += imageLoad(storageImage[nu_ii], ivec2(1)).x; + b += subpassLoad(inputAttachment[nu_ii]).x; + b += texelFetch(uniformTexelBuffer[nu_ii], 1).x; + b += imageLoad(storageTexelBuffer[nu_ii], 1).x; + + nonuniformEXT ivec4 v; + nonuniformEXT mat4 m; + nonuniformEXT struct S { int a; } s; + ivec4 uv; + b += uniformBuffer[v.y].a; + b += uniformBuffer[v[2]].a; + b += uniformBuffer[uv[nu_ii]].a; + b += uniformBuffer[int(m[2].z)].a; + b += uniformBuffer[s.a].a; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.perprimitiveNV.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.perprimitiveNV.frag new file mode 100644 index 00000000000..56e00f54667 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.perprimitiveNV.frag @@ -0,0 +1,21 @@ +#version 460 + +#extension GL_NV_mesh_shader: require + +layout(location=0) +in B { + perprimitiveNV float f; +}; + +layout(location=4) +in C { + flat centroid float h; +}; + +layout(location=8) +out float g; + +void main() +{ + g = f + h; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.rankShift.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.rankShift.comp new file mode 100644 index 00000000000..1761ad1f52a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.rankShift.comp @@ -0,0 +1,15 @@ +#version 450 +#extension GL_ARB_gpu_shader_int64 : require + +layout(local_size_x = 54) in; + +layout(location=4) uniform int64_t arg0; +layout(location=5) uniform uint arg1; + +void main() +{ + uint64_t result = arg0 << arg1; + result = arg0 >> arg1; + result <<= arg1; + result >>= arg1; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.samplerlessTextureFunctions.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.samplerlessTextureFunctions.frag new file mode 100644 index 00000000000..3043b39df21 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.samplerlessTextureFunctions.frag @@ -0,0 +1,23 @@ +#version 450 core +#extension GL_EXT_samplerless_texture_functions : enable + +layout(binding = 1) uniform texture2D tex2D; +layout(binding = 1) uniform texture2DMS texMS; +layout(binding = 0) uniform textureBuffer buf; + +void main() +{ + vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0); + vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0); + vec4 bufFetch = texelFetch(buf, 0); + + vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0)); + + ivec2 tex2DSize = textureSize(tex2D, 0); + ivec2 texMSSize = textureSize(texMS); + int bufSize = textureSize(buf); + + int tex2DLevels = textureQueryLevels(tex2D); + + int texMSSamples = textureSamples(texMS); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.scalarlayout.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.scalarlayout.frag new file mode 100644 index 00000000000..c7ecf5025be --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.scalarlayout.frag @@ -0,0 +1,32 @@ +#version 450 core + +#extension GL_EXT_scalar_block_layout : enable + +// Block memory layout +struct S +{ + float a; // offset 0 + vec2 b; // offset 4 + double c; // offset 16 + float d; // offset 24 + vec3 e; // offset 28 + float f; // offset 40 + // size = 44, align = 8 +}; + +layout(column_major, scalar) uniform B1 +{ + float a; // offset = 0 + vec2 b; // offset = 4 + vec3 c; // offset = 12 + float d[2]; // offset = 24 + mat2x3 e; // offset = 32, takes 24 bytes, matrixstride = 12 + mat2x3 f[2]; // offset = 56, takes 48 bytes, matrixstride = 12, arraystride = 24 + float g; // offset = 104 + S h; // offset = 112 (aligned to multiple of 8) + S i[2]; // offset = 160 (aligned to multiple of 8) stride = 48 +}; + +void main() +{ +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.scalarlayoutfloat16.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.scalarlayoutfloat16.frag new file mode 100644 index 00000000000..ff8709737ac --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.scalarlayoutfloat16.frag @@ -0,0 +1,31 @@ +#version 450 core + +#extension GL_EXT_shader_16bit_storage: enable +#extension GL_EXT_scalar_block_layout : enable + +// Block memory layout +struct S +{ + float16_t a; // offset 0 + f16vec2 b; // offset 2 + double c; // offset 8 + float16_t d; // offset 16 + f16vec3 e; // offset 18 + float16_t f; // offset 24 + // size = 26, align = 8 +}; + +layout(column_major, scalar) uniform B1 +{ + float16_t a; // offset = 0 + f16vec2 b; // offset = 2 + f16vec3 c; // offset = 6 + float16_t d[2]; // offset = 12 stride = 2 + float16_t g; // offset = 16 + S h; // offset = 24 (aligned to multiple of 8) + S i[2]; // offset = 56 (aligned to multiple of 8) stride = 32 +}; + +void main() +{ +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderBallotAMD.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderBallotAMD.comp index d6d370aea72..9cf9546e44b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderBallotAMD.comp +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderBallotAMD.comp @@ -2,6 +2,7 @@ #extension GL_ARB_gpu_shader_int64: enable #extension GL_AMD_gpu_shader_half_float: enable +#extension GL_AMD_gpu_shader_int16: enable #extension GL_AMD_shader_ballot: enable layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; @@ -15,17 +16,21 @@ layout(binding = 0) buffer Buffers int64_t i64; u64vec2 u64v; f16vec3 f16v; + i16vec4 i16v; + uint16_t u16; }; void main() { - i = minInvocationsAMD(i); + i = minInvocationsAMD(i); uv = minInvocationsAMD(uv); fv = minInvocationsAMD(fv); dv = minInvocationsAMD(dv); i64 = minInvocationsAMD(i64); u64v = minInvocationsAMD(u64v); f16v = minInvocationsAMD(f16v); + i16v = minInvocationsAMD(i16v); + u16 = minInvocationsAMD(u16); i = maxInvocationsAMD(i); uv = maxInvocationsAMD(uv); @@ -34,6 +39,8 @@ void main() i64 = maxInvocationsAMD(i64); u64v = maxInvocationsAMD(u64v); f16v = maxInvocationsAMD(f16v); + i16v = maxInvocationsAMD(i16v); + u16 = maxInvocationsAMD(u16); i = addInvocationsAMD(i); uv = addInvocationsAMD(uv); @@ -42,6 +49,8 @@ void main() i64 = addInvocationsAMD(i64); u64v = addInvocationsAMD(u64v); f16v = addInvocationsAMD(f16v); + i16v = addInvocationsAMD(i16v); + u16 = addInvocationsAMD(u16); i = minInvocationsNonUniformAMD(i); uv = minInvocationsNonUniformAMD(uv); @@ -50,6 +59,8 @@ void main() i64 = minInvocationsNonUniformAMD(i64); u64v = minInvocationsNonUniformAMD(u64v); f16v = minInvocationsNonUniformAMD(f16v); + i16v = minInvocationsNonUniformAMD(i16v); + u16 = minInvocationsNonUniformAMD(u16); i = maxInvocationsNonUniformAMD(i); uv = maxInvocationsNonUniformAMD(uv); @@ -58,6 +69,8 @@ void main() i64 = maxInvocationsNonUniformAMD(i64); u64v = maxInvocationsNonUniformAMD(u64v); f16v = maxInvocationsNonUniformAMD(f16v); + i16v = maxInvocationsNonUniformAMD(i16v); + u16 = maxInvocationsNonUniformAMD(u16); i = addInvocationsNonUniformAMD(i); uv = addInvocationsNonUniformAMD(uv); @@ -66,6 +79,8 @@ void main() i64 = addInvocationsNonUniformAMD(i64); u64v = addInvocationsNonUniformAMD(u64v); f16v = addInvocationsNonUniformAMD(f16v); + i16v = addInvocationsNonUniformAMD(i16v); + u16 = addInvocationsNonUniformAMD(u16); i = minInvocationsInclusiveScanAMD(i); uv = minInvocationsInclusiveScanAMD(uv); @@ -74,6 +89,8 @@ void main() i64 = minInvocationsInclusiveScanAMD(i64); u64v = minInvocationsInclusiveScanAMD(u64v); f16v = minInvocationsInclusiveScanAMD(f16v); + i16v = minInvocationsInclusiveScanAMD(i16v); + u16 = minInvocationsInclusiveScanAMD(u16); i = maxInvocationsInclusiveScanAMD(i); uv = maxInvocationsInclusiveScanAMD(uv); @@ -82,6 +99,8 @@ void main() i64 = maxInvocationsInclusiveScanAMD(i64); u64v = maxInvocationsInclusiveScanAMD(u64v); f16v = maxInvocationsInclusiveScanAMD(f16v); + i16v = maxInvocationsInclusiveScanAMD(i16v); + u16 = maxInvocationsInclusiveScanAMD(u16); i = addInvocationsInclusiveScanAMD(i); uv = addInvocationsInclusiveScanAMD(uv); @@ -90,6 +109,8 @@ void main() i64 = addInvocationsInclusiveScanAMD(i64); u64v = addInvocationsInclusiveScanAMD(u64v); f16v = addInvocationsInclusiveScanAMD(f16v); + i16v = addInvocationsInclusiveScanAMD(i16v); + u16 = addInvocationsInclusiveScanAMD(u16); i = minInvocationsExclusiveScanAMD(i); uv = minInvocationsExclusiveScanAMD(uv); @@ -98,6 +119,8 @@ void main() i64 = minInvocationsExclusiveScanAMD(i64); u64v = minInvocationsExclusiveScanAMD(u64v); f16v = minInvocationsExclusiveScanAMD(f16v); + i16v = minInvocationsExclusiveScanAMD(i16v); + u16 = minInvocationsExclusiveScanAMD(u16); i = maxInvocationsExclusiveScanAMD(i); uv = maxInvocationsExclusiveScanAMD(uv); @@ -106,6 +129,8 @@ void main() i64 = maxInvocationsExclusiveScanAMD(i64); u64v = maxInvocationsExclusiveScanAMD(u64v); f16v = maxInvocationsExclusiveScanAMD(f16v); + i16v = maxInvocationsExclusiveScanAMD(i16v); + u16 = maxInvocationsExclusiveScanAMD(u16); i = addInvocationsExclusiveScanAMD(i); uv = addInvocationsExclusiveScanAMD(uv); @@ -114,6 +139,8 @@ void main() i64 = addInvocationsExclusiveScanAMD(i64); u64v = addInvocationsExclusiveScanAMD(u64v); f16v = addInvocationsExclusiveScanAMD(f16v); + i16v = addInvocationsExclusiveScanAMD(i16v); + u16 = addInvocationsExclusiveScanAMD(u16); i = minInvocationsInclusiveScanNonUniformAMD(i); uv = minInvocationsInclusiveScanNonUniformAMD(uv); @@ -122,6 +149,8 @@ void main() i64 = minInvocationsInclusiveScanNonUniformAMD(i64); u64v = minInvocationsInclusiveScanNonUniformAMD(u64v); f16v = minInvocationsInclusiveScanNonUniformAMD(f16v); + i16v = minInvocationsInclusiveScanNonUniformAMD(i16v); + u16 = minInvocationsInclusiveScanNonUniformAMD(u16); i = maxInvocationsInclusiveScanNonUniformAMD(i); uv = maxInvocationsInclusiveScanNonUniformAMD(uv); @@ -130,6 +159,8 @@ void main() i64 = maxInvocationsInclusiveScanNonUniformAMD(i64); u64v = maxInvocationsInclusiveScanNonUniformAMD(u64v); f16v = maxInvocationsInclusiveScanNonUniformAMD(f16v); + i16v = maxInvocationsInclusiveScanNonUniformAMD(i16v); + u16 = maxInvocationsInclusiveScanNonUniformAMD(u16); i = addInvocationsInclusiveScanNonUniformAMD(i); uv = addInvocationsInclusiveScanNonUniformAMD(uv); @@ -138,6 +169,8 @@ void main() i64 = addInvocationsInclusiveScanNonUniformAMD(i64); u64v = addInvocationsInclusiveScanNonUniformAMD(u64v); f16v = addInvocationsInclusiveScanNonUniformAMD(f16v); + i16v = addInvocationsInclusiveScanNonUniformAMD(i16v); + u16 = addInvocationsInclusiveScanNonUniformAMD(u16); i = minInvocationsExclusiveScanNonUniformAMD(i); uv = minInvocationsExclusiveScanNonUniformAMD(uv); @@ -146,6 +179,8 @@ void main() i64 = minInvocationsExclusiveScanNonUniformAMD(i64); u64v = minInvocationsExclusiveScanNonUniformAMD(u64v); f16v = minInvocationsExclusiveScanNonUniformAMD(f16v); + i16v = minInvocationsExclusiveScanNonUniformAMD(i16v); + u16 = minInvocationsExclusiveScanNonUniformAMD(u16); i = maxInvocationsExclusiveScanNonUniformAMD(i); uv = maxInvocationsExclusiveScanNonUniformAMD(uv); @@ -154,6 +189,8 @@ void main() i64 = maxInvocationsExclusiveScanNonUniformAMD(i64); u64v = maxInvocationsExclusiveScanNonUniformAMD(u64v); f16v = maxInvocationsExclusiveScanNonUniformAMD(f16v); + i16v = maxInvocationsExclusiveScanNonUniformAMD(i16v); + u16 = maxInvocationsExclusiveScanNonUniformAMD(u16); i = addInvocationsExclusiveScanNonUniformAMD(i); uv = addInvocationsExclusiveScanNonUniformAMD(uv); @@ -162,4 +199,6 @@ void main() i64 = addInvocationsExclusiveScanNonUniformAMD(i64); u64v = addInvocationsExclusiveScanNonUniformAMD(u64v); f16v = addInvocationsExclusiveScanNonUniformAMD(f16v); + i16v = addInvocationsExclusiveScanNonUniformAMD(i16v); + u16 = addInvocationsExclusiveScanNonUniformAMD(u16); } diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderImageFootprint.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderImageFootprint.frag new file mode 100644 index 00000000000..efde3704d01 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderImageFootprint.frag @@ -0,0 +1,123 @@ +#version 450 + +#extension GL_NV_shader_texture_footprint : require + + +layout (location = 0) in vec2 P2; +layout (location = 2) in vec3 P3; +layout (location = 3) in flat int granularity; +layout (location = 4) in float lodClamp; +layout (location = 5) in float lod; +layout (location = 6) in vec2 dx; +layout (location = 8) in vec2 dy; +layout (location = 9) in float bias; + +uniform sampler2D sample2D; +uniform sampler3D sample3D; + +buffer result2D { + bool ret2D; + uvec2 anchor2D; + uvec2 offset2D; + uvec2 mask2D; + uint lod2D; + uint granularity2D; +}; + +buffer result3D { + bool ret3D; + uvec3 anchor3D; + uvec3 offset3D; + uvec2 mask3D; + uint lod3D; + uint granularity3D; +}; + +void main() { + gl_TextureFootprint2DNV fp2D; + gl_TextureFootprint3DNV fp3D; + + ret2D = textureFootprintNV(sample2D, P2, granularity, true, fp2D); + anchor2D = fp2D.anchor; + offset2D = fp2D.offset; + mask2D = fp2D.mask; + lod2D = fp2D.lod; + granularity2D = fp2D.granularity; + + ret2D = textureFootprintNV(sample2D, P2, granularity, true, fp2D, bias); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintClampNV(sample2D, P2, lodClamp, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintClampNV(sample2D, P2, lodClamp, granularity, true, fp2D, bias); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintLodNV(sample2D, P2, lod, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintGradNV(sample2D, P2, dx, dy, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret2D = textureFootprintGradClampNV(sample2D, P2, dx, dy, lodClamp, granularity, true, fp2D); + anchor2D += fp2D.anchor; + offset2D += fp2D.offset; + mask2D += fp2D.mask; + lod2D += fp2D.lod; + granularity2D += fp2D.granularity; + + ret3D = textureFootprintNV(sample3D, P3, granularity, true, fp3D); + anchor3D = fp3D.anchor; + offset3D = fp3D.offset; + mask3D = fp3D.mask; + lod3D = fp3D.lod; + granularity3D = fp3D.granularity; + + ret3D = textureFootprintNV(sample3D, P3, granularity, true, fp3D, bias); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; + + ret3D = textureFootprintClampNV(sample3D, P3, lodClamp, granularity, true, fp3D); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; + + ret3D = textureFootprintClampNV(sample3D, P3, lodClamp, granularity, true, fp3D, bias); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; + + ret3D = textureFootprintLodNV(sample3D, P3, lod, granularity, true, fp3D); + anchor3D += fp3D.anchor; + offset3D += fp3D.offset; + mask3D += fp3D.mask; + lod3D += fp3D.lod; + granularity3D += fp3D.granularity; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderStencilExport.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderStencilExport.frag index 62e0f573ab5..e3ad4d67f73 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderStencilExport.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shaderStencilExport.frag @@ -2,6 +2,8 @@ #extension GL_ARB_shader_stencil_export: enable +out int gl_FragStencilRefARB; + void main() { gl_FragStencilRefARB = 100; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.shadingRate.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shadingRate.frag new file mode 100644 index 00000000000..8fbd4baf010 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.shadingRate.frag @@ -0,0 +1,11 @@ +#version 450 + +#extension GL_NV_shading_rate_image : require + +layout (location = 0) out vec2 FragmentSize; +layout (location = 2) out int InvocationsPerPixel; + +void main () { + FragmentSize = gl_FragmentSizeNV; + InvocationsPerPixel = gl_InvocationsPerPixelNV; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.frag new file mode 100644 index 00000000000..520052faac0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.frag @@ -0,0 +1,7 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic: enable +layout(location = 0) out uvec4 data; +void main (void) +{ + data = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.geom b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.geom new file mode 100644 index 00000000000..70e9dd4893f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.geom @@ -0,0 +1,13 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic: enable +layout(points) in; +layout(points, max_vertices = 1) out; +layout(set = 0, binding = 0, std430) buffer Output +{ + uvec4 result[]; +}; + +void main (void) +{ + result[gl_PrimitiveIDIn] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.tesc b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.tesc new file mode 100644 index 00000000000..63bf5e55926 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.tesc @@ -0,0 +1,12 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic: enable +layout(vertices=1) out; +layout(set = 0, binding = 0, std430) buffer Output +{ + uvec4 result[]; +}; + +void main (void) +{ + result[gl_PrimitiveID] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.tese b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.tese new file mode 100644 index 00000000000..e504df79adf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.tese @@ -0,0 +1,12 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic: enable +layout(isolines) in; +layout(set = 0, binding = 0, std430) buffer Output +{ + uvec4 result[]; +}; + +void main (void) +{ + result[gl_PrimitiveID] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.vert new file mode 100644 index 00000000000..779b7584c12 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroup.vert @@ -0,0 +1,11 @@ +#version 450 +#extension GL_KHR_shader_subgroup_basic: enable +layout(set = 0, binding = 0, std430) buffer Output +{ + uvec4 result[]; +}; + +void main (void) +{ + result[gl_VertexIndex] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupArithmetic.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupArithmetic.comp new file mode 100644 index 00000000000..6cc9337b68b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupArithmetic.comp @@ -0,0 +1,393 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_arithmetic: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.x = subgroupAdd(data[0].f4.x); + data[invocation].f4.xy = subgroupAdd(data[1].f4.xy); + data[invocation].f4.xyz = subgroupAdd(data[2].f4.xyz); + data[invocation].f4 = subgroupAdd(data[3].f4); + + data[invocation].i4.x = subgroupAdd(data[0].i4.x); + data[invocation].i4.xy = subgroupAdd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupAdd(data[2].i4.xyz); + data[invocation].i4 = subgroupAdd(data[3].i4); + + data[invocation].u4.x = subgroupAdd(data[0].u4.x); + data[invocation].u4.xy = subgroupAdd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupAdd(data[2].u4.xyz); + data[invocation].u4 = subgroupAdd(data[3].u4); + + data[invocation].d4.x = subgroupAdd(data[0].d4.x); + data[invocation].d4.xy = subgroupAdd(data[1].d4.xy); + data[invocation].d4.xyz = subgroupAdd(data[2].d4.xyz); + data[invocation].d4 = subgroupAdd(data[3].d4); + + data[invocation].f4.x = subgroupMul(data[0].f4.x); + data[invocation].f4.xy = subgroupMul(data[1].f4.xy); + data[invocation].f4.xyz = subgroupMul(data[2].f4.xyz); + data[invocation].f4 = subgroupMul(data[3].f4); + + data[invocation].i4.x = subgroupMul(data[0].i4.x); + data[invocation].i4.xy = subgroupMul(data[1].i4.xy); + data[invocation].i4.xyz = subgroupMul(data[2].i4.xyz); + data[invocation].i4 = subgroupMul(data[3].i4); + + data[invocation].u4.x = subgroupMul(data[0].u4.x); + data[invocation].u4.xy = subgroupMul(data[1].u4.xy); + data[invocation].u4.xyz = subgroupMul(data[2].u4.xyz); + data[invocation].u4 = subgroupMul(data[3].u4); + + data[invocation].d4.x = subgroupMul(data[0].d4.x); + data[invocation].d4.xy = subgroupMul(data[1].d4.xy); + data[invocation].d4.xyz = subgroupMul(data[2].d4.xyz); + data[invocation].d4 = subgroupMul(data[3].d4); + + data[invocation].f4.x = subgroupMin(data[0].f4.x); + data[invocation].f4.xy = subgroupMin(data[1].f4.xy); + data[invocation].f4.xyz = subgroupMin(data[2].f4.xyz); + data[invocation].f4 = subgroupMin(data[3].f4); + + data[invocation].i4.x = subgroupMin(data[0].i4.x); + data[invocation].i4.xy = subgroupMin(data[1].i4.xy); + data[invocation].i4.xyz = subgroupMin(data[2].i4.xyz); + data[invocation].i4 = subgroupMin(data[3].i4); + + data[invocation].u4.x = subgroupMin(data[0].u4.x); + data[invocation].u4.xy = subgroupMin(data[1].u4.xy); + data[invocation].u4.xyz = subgroupMin(data[2].u4.xyz); + data[invocation].u4 = subgroupMin(data[3].u4); + + data[invocation].d4.x = subgroupMin(data[0].d4.x); + data[invocation].d4.xy = subgroupMin(data[1].d4.xy); + data[invocation].d4.xyz = subgroupMin(data[2].d4.xyz); + data[invocation].d4 = subgroupMin(data[3].d4); + + data[invocation].f4.x = subgroupMax(data[0].f4.x); + data[invocation].f4.xy = subgroupMax(data[1].f4.xy); + data[invocation].f4.xyz = subgroupMax(data[2].f4.xyz); + data[invocation].f4 = subgroupMax(data[3].f4); + + data[invocation].i4.x = subgroupMax(data[0].i4.x); + data[invocation].i4.xy = subgroupMax(data[1].i4.xy); + data[invocation].i4.xyz = subgroupMax(data[2].i4.xyz); + data[invocation].i4 = subgroupMax(data[3].i4); + + data[invocation].u4.x = subgroupMax(data[0].u4.x); + data[invocation].u4.xy = subgroupMax(data[1].u4.xy); + data[invocation].u4.xyz = subgroupMax(data[2].u4.xyz); + data[invocation].u4 = subgroupMax(data[3].u4); + + data[invocation].d4.x = subgroupMax(data[0].d4.x); + data[invocation].d4.xy = subgroupMax(data[1].d4.xy); + data[invocation].d4.xyz = subgroupMax(data[2].d4.xyz); + data[invocation].d4 = subgroupMax(data[3].d4); + + data[invocation].i4.x = subgroupAnd(data[0].i4.x); + data[invocation].i4.xy = subgroupAnd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupAnd(data[2].i4.xyz); + data[invocation].i4 = subgroupAnd(data[3].i4); + + data[invocation].u4.x = subgroupAnd(data[0].u4.x); + data[invocation].u4.xy = subgroupAnd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupAnd(data[2].u4.xyz); + data[invocation].u4 = subgroupAnd(data[3].u4); + + data[invocation].i4.x = int(subgroupAnd(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupAnd(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupAnd(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupAnd(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupOr(data[0].i4.x); + data[invocation].i4.xy = subgroupOr(data[1].i4.xy); + data[invocation].i4.xyz = subgroupOr(data[2].i4.xyz); + data[invocation].i4 = subgroupOr(data[3].i4); + + data[invocation].u4.x = subgroupOr(data[0].u4.x); + data[invocation].u4.xy = subgroupOr(data[1].u4.xy); + data[invocation].u4.xyz = subgroupOr(data[2].u4.xyz); + data[invocation].u4 = subgroupOr(data[3].u4); + + data[invocation].i4.x = int(subgroupOr(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupOr(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupOr(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupOr(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupXor(data[0].i4.x); + data[invocation].i4.xy = subgroupXor(data[1].i4.xy); + data[invocation].i4.xyz = subgroupXor(data[2].i4.xyz); + data[invocation].i4 = subgroupXor(data[3].i4); + + data[invocation].u4.x = subgroupXor(data[0].u4.x); + data[invocation].u4.xy = subgroupXor(data[1].u4.xy); + data[invocation].u4.xyz = subgroupXor(data[2].u4.xyz); + data[invocation].u4 = subgroupXor(data[3].u4); + + data[invocation].i4.x = int(subgroupXor(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupXor(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupXor(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupXor(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].f4.x = subgroupInclusiveAdd(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveAdd(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveAdd(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveAdd(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveAdd(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveAdd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveAdd(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveAdd(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveAdd(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveAdd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveAdd(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveAdd(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveAdd(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveAdd(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveAdd(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveAdd(data[3].d4); + + data[invocation].f4.x = subgroupInclusiveMul(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveMul(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveMul(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveMul(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveMul(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveMul(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveMul(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveMul(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveMul(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveMul(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveMul(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveMul(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveMul(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveMul(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveMul(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveMul(data[3].d4); + + data[invocation].f4.x = subgroupInclusiveMin(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveMin(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveMin(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveMin(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveMin(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveMin(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveMin(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveMin(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveMin(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveMin(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveMin(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveMin(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveMin(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveMin(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveMin(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveMin(data[3].d4); + + data[invocation].f4.x = subgroupInclusiveMax(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveMax(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveMax(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveMax(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveMax(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveMax(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveMax(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveMax(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveMax(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveMax(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveMax(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveMax(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveMax(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveMax(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveMax(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveMax(data[3].d4); + + data[invocation].i4.x = subgroupInclusiveAnd(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveAnd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveAnd(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveAnd(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveAnd(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveAnd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveAnd(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveAnd(data[3].u4); + + data[invocation].i4.x = int(subgroupInclusiveAnd(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupInclusiveAnd(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupInclusiveAnd(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupInclusiveAnd(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupInclusiveOr(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveOr(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveOr(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveOr(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveOr(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveOr(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveOr(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveOr(data[3].u4); + + data[invocation].i4.x = int(subgroupInclusiveOr(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupInclusiveOr(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupInclusiveOr(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupInclusiveOr(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupInclusiveXor(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveXor(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveXor(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveXor(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveXor(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveXor(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveXor(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveXor(data[3].u4); + + data[invocation].i4.x = int(subgroupInclusiveXor(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupInclusiveXor(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupInclusiveXor(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupInclusiveXor(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].f4.x = subgroupExclusiveAdd(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveAdd(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveAdd(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveAdd(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveAdd(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveAdd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveAdd(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveAdd(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveAdd(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveAdd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveAdd(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveAdd(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveAdd(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveAdd(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveAdd(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveAdd(data[3].d4); + + data[invocation].f4.x = subgroupExclusiveMul(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveMul(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveMul(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveMul(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveMul(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveMul(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveMul(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveMul(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveMul(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveMul(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveMul(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveMul(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveMul(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveMul(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveMul(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveMul(data[3].d4); + + data[invocation].f4.x = subgroupExclusiveMin(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveMin(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveMin(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveMin(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveMin(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveMin(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveMin(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveMin(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveMin(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveMin(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveMin(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveMin(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveMin(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveMin(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveMin(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveMin(data[3].d4); + + data[invocation].f4.x = subgroupExclusiveMax(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveMax(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveMax(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveMax(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveMax(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveMax(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveMax(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveMax(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveMax(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveMax(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveMax(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveMax(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveMax(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveMax(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveMax(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveMax(data[3].d4); + + data[invocation].i4.x = subgroupExclusiveAnd(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveAnd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveAnd(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveAnd(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveAnd(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveAnd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveAnd(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveAnd(data[3].u4); + + data[invocation].i4.x = int(subgroupExclusiveAnd(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupExclusiveAnd(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupExclusiveAnd(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupExclusiveAnd(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupExclusiveOr(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveOr(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveOr(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveOr(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveOr(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveOr(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveOr(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveOr(data[3].u4); + + data[invocation].i4.x = int(subgroupExclusiveOr(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupExclusiveOr(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupExclusiveOr(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupExclusiveOr(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupExclusiveXor(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveXor(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveXor(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveXor(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveXor(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveXor(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveXor(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveXor(data[3].u4); + + data[invocation].i4.x = int(subgroupExclusiveXor(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupExclusiveXor(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupExclusiveXor(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupExclusiveXor(lessThan(data[1].i4, ivec4(0)))); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBallot.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBallot.comp new file mode 100644 index 00000000000..bb9dc3e4dc8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBallot.comp @@ -0,0 +1,86 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_ballot: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + uvec4 relMask = gl_SubgroupEqMask + + gl_SubgroupGeMask + + gl_SubgroupGtMask + + gl_SubgroupLeMask + + gl_SubgroupLtMask; + + uvec4 result = subgroupBallot(true); + + data[invocation].u4.x = subgroupBallotBitCount(result); + data[invocation].u4.y = subgroupBallotBitExtract(result, 0) ? 1 : 0; + data[invocation].u4.z = subgroupBallotInclusiveBitCount(result) + subgroupBallotExclusiveBitCount(result); + data[invocation].u4.w = subgroupBallotFindLSB(result) + subgroupBallotFindMSB(result); + + if ((relMask == result) && subgroupInverseBallot(data[0].u4)) + { + data[invocation].f4.x = subgroupBroadcast(data[0].f4.x, 3); + data[invocation].f4.xy = subgroupBroadcast(data[1].f4.xy, 3); + data[invocation].f4.xyz = subgroupBroadcast(data[2].f4.xyz, 3); + data[invocation].f4 = subgroupBroadcast(data[3].f4, 3); + + data[invocation].i4.x = subgroupBroadcast(data[0].i4.x, 2); + data[invocation].i4.xy = subgroupBroadcast(data[1].i4.xy, 2); + data[invocation].i4.xyz = subgroupBroadcast(data[2].i4.xyz, 2); + data[invocation].i4 = subgroupBroadcast(data[3].i4, 2); + + data[invocation].u4.x = subgroupBroadcast(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupBroadcast(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupBroadcast(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupBroadcast(data[3].u4, 1); + + data[invocation].d4.x = subgroupBroadcast(data[0].d4.x, 0); + data[invocation].d4.xy = subgroupBroadcast(data[1].d4.xy, 0); + data[invocation].d4.xyz = subgroupBroadcast(data[2].d4.xyz, 0); + data[invocation].d4 = subgroupBroadcast(data[3].d4, 0); + + data[invocation].i4.x = int(subgroupBroadcast(data[0].i4.x < 0, 1)); + data[invocation].i4.xy = ivec2(subgroupBroadcast(lessThan(data[1].i4.xy, ivec2(0)), 1)); + data[invocation].i4.xyz = ivec3(subgroupBroadcast(lessThan(data[1].i4.xyz, ivec3(0)), 1)); + data[invocation].i4 = ivec4(subgroupBroadcast(lessThan(data[1].i4, ivec4(0)), 1)); + } + else + { + data[invocation].f4.x = subgroupBroadcastFirst(data[0].f4.x); + data[invocation].f4.xy = subgroupBroadcastFirst(data[1].f4.xy); + data[invocation].f4.xyz = subgroupBroadcastFirst(data[2].f4.xyz); + data[invocation].f4 = subgroupBroadcastFirst(data[3].f4); + + data[invocation].i4.x = subgroupBroadcastFirst(data[0].i4.x); + data[invocation].i4.xy = subgroupBroadcastFirst(data[1].i4.xy); + data[invocation].i4.xyz = subgroupBroadcastFirst(data[2].i4.xyz); + data[invocation].i4 = subgroupBroadcastFirst(data[3].i4); + + data[invocation].u4.x = subgroupBroadcastFirst(data[0].u4.x); + data[invocation].u4.xy = subgroupBroadcastFirst(data[1].u4.xy); + data[invocation].u4.xyz = subgroupBroadcastFirst(data[2].u4.xyz); + data[invocation].u4 = subgroupBroadcastFirst(data[3].u4); + + data[invocation].d4.x = subgroupBroadcastFirst(data[0].d4.x); + data[invocation].d4.xy = subgroupBroadcastFirst(data[1].d4.xy); + data[invocation].d4.xyz = subgroupBroadcastFirst(data[2].d4.xyz); + data[invocation].d4 = subgroupBroadcastFirst(data[3].d4); + + data[invocation].i4.x = int(subgroupBroadcastFirst(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupBroadcastFirst(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupBroadcastFirst(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupBroadcastFirst(lessThan(data[1].i4, ivec4(0)))); + } +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBallotNeg.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBallotNeg.comp new file mode 100644 index 00000000000..4020adf1152 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBallotNeg.comp @@ -0,0 +1,33 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_ballot: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + uvec4 relMask = gl_SubgroupEqMask + + gl_SubgroupGeMask + + gl_SubgroupGtMask + + gl_SubgroupLeMask + + gl_SubgroupLtMask; + + uvec4 result = subgroupBallot(true); + + data[invocation].u4.x = subgroupBallotBitCount(result); + data[invocation].u4.y = subgroupBallotBitExtract(result, 0) ? 1 : 0; + data[invocation].u4.z = subgroupBallotInclusiveBitCount(result) + subgroupBallotExclusiveBitCount(result); + data[invocation].u4.w = subgroupBallotFindLSB(result) + subgroupBallotFindMSB(result); + + data[invocation].f4.x = subgroupBroadcast(data[0].f4.x, invocation); // ERROR: not constant +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBasic.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBasic.comp new file mode 100644 index 00000000000..4801c10707f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupBasic.comp @@ -0,0 +1,23 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_basic: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffer +{ + int a[]; +} data; + +void main() +{ + data.a[gl_SubgroupSize] = 1; + data.a[gl_SubgroupInvocationID] = 1; + data.a[gl_NumSubgroups] = 1; + data.a[gl_SubgroupID] = (subgroupElect()) ? 1 : 0; + subgroupBarrier(); + subgroupMemoryBarrier(); + subgroupMemoryBarrierBuffer(); + subgroupMemoryBarrierShared(); + subgroupMemoryBarrierImage(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupClustered.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupClustered.comp new file mode 100644 index 00000000000..128a24c88e6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupClustered.comp @@ -0,0 +1,143 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_clustered: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.x = subgroupClusteredAdd(data[0].f4.x, 1); + data[invocation].f4.xy = subgroupClusteredAdd(data[1].f4.xy, 1); + data[invocation].f4.xyz = subgroupClusteredAdd(data[2].f4.xyz, 1); + data[invocation].f4 = subgroupClusteredAdd(data[3].f4, 1); + + data[invocation].i4.x = subgroupClusteredAdd(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredAdd(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredAdd(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredAdd(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredAdd(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredAdd(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredAdd(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredAdd(data[3].u4, 1); + + data[invocation].d4.x = subgroupClusteredAdd(data[0].d4.x, 1); + data[invocation].d4.xy = subgroupClusteredAdd(data[1].d4.xy, 1); + data[invocation].d4.xyz = subgroupClusteredAdd(data[2].d4.xyz, 1); + data[invocation].d4 = subgroupClusteredAdd(data[3].d4, 1); + + data[invocation].f4.x = subgroupClusteredMul(data[0].f4.x, 1); + data[invocation].f4.xy = subgroupClusteredMul(data[1].f4.xy, 1); + data[invocation].f4.xyz = subgroupClusteredMul(data[2].f4.xyz, 1); + data[invocation].f4 = subgroupClusteredMul(data[3].f4, 1); + + data[invocation].i4.x = subgroupClusteredMul(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredMul(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredMul(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredMul(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredMul(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredMul(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredMul(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredMul(data[3].u4, 1); + + data[invocation].d4.x = subgroupClusteredMul(data[0].d4.x, 1); + data[invocation].d4.xy = subgroupClusteredMul(data[1].d4.xy, 1); + data[invocation].d4.xyz = subgroupClusteredMul(data[2].d4.xyz, 1); + data[invocation].d4 = subgroupClusteredMul(data[3].d4, 1); + + data[invocation].f4.x = subgroupClusteredMin(data[0].f4.x, 1); + data[invocation].f4.xy = subgroupClusteredMin(data[1].f4.xy, 1); + data[invocation].f4.xyz = subgroupClusteredMin(data[2].f4.xyz, 1); + data[invocation].f4 = subgroupClusteredMin(data[3].f4, 1); + + data[invocation].i4.x = subgroupClusteredMin(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredMin(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredMin(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredMin(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredMin(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredMin(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredMin(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredMin(data[3].u4, 1); + + data[invocation].d4.x = subgroupClusteredMin(data[0].d4.x, 1); + data[invocation].d4.xy = subgroupClusteredMin(data[1].d4.xy, 1); + data[invocation].d4.xyz = subgroupClusteredMin(data[2].d4.xyz, 1); + data[invocation].d4 = subgroupClusteredMin(data[3].d4, 1); + + data[invocation].f4.x = subgroupClusteredMax(data[0].f4.x, 1); + data[invocation].f4.xy = subgroupClusteredMax(data[1].f4.xy, 1); + data[invocation].f4.xyz = subgroupClusteredMax(data[2].f4.xyz, 1); + data[invocation].f4 = subgroupClusteredMax(data[3].f4, 1); + + data[invocation].i4.x = subgroupClusteredMax(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredMax(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredMax(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredMax(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredMax(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredMax(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredMax(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredMax(data[3].u4, 1); + + data[invocation].d4.x = subgroupClusteredMax(data[0].d4.x, 1); + data[invocation].d4.xy = subgroupClusteredMax(data[1].d4.xy, 1); + data[invocation].d4.xyz = subgroupClusteredMax(data[2].d4.xyz, 1); + data[invocation].d4 = subgroupClusteredMax(data[3].d4, 1); + + data[invocation].i4.x = subgroupClusteredAnd(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredAnd(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredAnd(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredAnd(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredAnd(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredAnd(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredAnd(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredAnd(data[3].u4, 1); + + data[invocation].i4.x = int(subgroupClusteredAnd(data[0].i4.x < 0, 1)); + data[invocation].i4.xy = ivec2(subgroupClusteredAnd(lessThan(data[1].i4.xy, ivec2(0)), 1)); + data[invocation].i4.xyz = ivec3(subgroupClusteredAnd(lessThan(data[1].i4.xyz, ivec3(0)), 1)); + data[invocation].i4 = ivec4(subgroupClusteredAnd(lessThan(data[1].i4, ivec4(0)), 1)); + + data[invocation].i4.x = subgroupClusteredOr(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredOr(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredOr(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredOr(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredOr(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredOr(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredOr(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredOr(data[3].u4, 1); + + data[invocation].i4.x = int(subgroupClusteredOr(data[0].i4.x < 0, 1)); + data[invocation].i4.xy = ivec2(subgroupClusteredOr(lessThan(data[1].i4.xy, ivec2(0)), 1)); + data[invocation].i4.xyz = ivec3(subgroupClusteredOr(lessThan(data[1].i4.xyz, ivec3(0)), 1)); + data[invocation].i4 = ivec4(subgroupClusteredOr(lessThan(data[1].i4, ivec4(0)), 1)); + + data[invocation].i4.x = subgroupClusteredXor(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupClusteredXor(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupClusteredXor(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupClusteredXor(data[3].i4, 1); + + data[invocation].u4.x = subgroupClusteredXor(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupClusteredXor(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupClusteredXor(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupClusteredXor(data[3].u4, 1); + + data[invocation].i4.x = int(subgroupClusteredXor(data[0].i4.x < 0, 1)); + data[invocation].i4.xy = ivec2(subgroupClusteredXor(lessThan(data[1].i4.xy, ivec2(0)), 1)); + data[invocation].i4.xyz = ivec3(subgroupClusteredXor(lessThan(data[1].i4.xyz, ivec3(0)), 1)); + data[invocation].i4 = ivec4(subgroupClusteredXor(lessThan(data[1].i4, ivec4(0)), 1)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupClusteredNeg.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupClusteredNeg.comp new file mode 100644 index 00000000000..ec15413e3d9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupClusteredNeg.comp @@ -0,0 +1,39 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_clustered: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + int a = 1; + const int aConst = 1; + + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.xy = subgroupClusteredAdd(data[1].f4.xy, 0); // ERROR, less than 1 + + data[invocation].f4.x = subgroupClusteredMul(data[0].f4.x, 3); // ERROR, not a power of 2 + + data[invocation].i4.xy = subgroupClusteredMin(data[1].i4.xy, 8); + data[invocation].i4.xyz = subgroupClusteredMin(data[2].i4.xyz, 6); // ERROR, not a power of 2 + + data[invocation].f4.x = subgroupClusteredMax(data[0].f4.x, -1); // ERROR, less than 1 + + data[invocation].i4 = subgroupClusteredAnd(data[3].i4, -3); // ERROR, less than 1 + + data[invocation].i4.x = subgroupClusteredOr(data[0].i4.x, a); // ERROR, not constant + data[invocation].i4.xy = subgroupClusteredOr(data[1].i4.xy, aConst); + + data[invocation].i4.x = subgroupClusteredXor(data[0].i4.x, 1 + a); // ERROR, not constant + data[invocation].i4.xy = subgroupClusteredXor(data[1].i4.xy, aConst + a); // ERROR, not constant + data[invocation].i4.xyz = subgroupClusteredXor(data[2].i4.xyz, 1 + aConst); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupPartitioned.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupPartitioned.comp new file mode 100644 index 00000000000..604833e0569 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupPartitioned.comp @@ -0,0 +1,420 @@ +#version 450 + +#extension GL_NV_shader_subgroup_partitioned: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + uvec4 ballot = subgroupPartitionNV(invocation); + + data[invocation].u4 = subgroupPartitionNV(data[0].f4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].f4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].f4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].f4); + + data[invocation].u4 = subgroupPartitionNV(data[0].i4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].i4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].i4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].i4); + + data[invocation].u4 = subgroupPartitionNV(data[0].u4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].u4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].u4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].u4); + + data[invocation].u4 = subgroupPartitionNV(data[0].d4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].d4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].d4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].d4); + + data[invocation].u4 = subgroupPartitionNV(bool(data[0].i4.x)); + data[invocation].u4 = subgroupPartitionNV(bvec2(data[0].i4.xy)); + data[invocation].u4 = subgroupPartitionNV(bvec3(data[0].i4.xyz)); + data[invocation].u4 = subgroupPartitionNV(bvec4(data[0].i4)); + + data[invocation].f4.x = subgroupPartitionedAddNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedAddNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedAddNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedAddNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedAddNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedAddNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedAddNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedAddNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedAddNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedAddNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedAddNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedAddNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedAddNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedAddNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedAddNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedAddNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedMulNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedMulNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedMulNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedMulNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedMulNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedMulNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedMulNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedMulNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedMulNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedMulNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedMulNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedMulNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedMulNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedMulNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedMulNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedMulNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedMinNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedMinNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedMinNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedMinNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedMinNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedMinNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedMinNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedMinNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedMinNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedMinNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedMinNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedMinNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedMinNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedMinNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedMinNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedMinNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedMaxNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedMaxNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedMaxNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedMaxNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedMaxNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedMaxNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedMaxNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedMaxNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedMaxNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedMaxNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedMaxNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedMaxNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedMaxNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedMaxNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedMaxNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedMaxNV(data[3].d4, ballot); + + data[invocation].i4.x = subgroupPartitionedAndNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedAndNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedAndNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedAndNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedAndNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedAndNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedAndNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedAndNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedAndNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedAndNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedAndNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedAndNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedOrNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedOrNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedOrNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedOrNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedOrNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedOrNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedOrNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedOrNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedOrNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedOrNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedOrNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedOrNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedXorNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedXorNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedXorNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedXorNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedXorNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedXorNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedXorNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedXorNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedXorNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedXorNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedXorNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedXorNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].f4.x = subgroupPartitionedInclusiveAddNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveAddNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveAddNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveAddNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveAddNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveAddNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveAddNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveAddNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveAddNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveAddNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveAddNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveAddNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveAddNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveAddNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveAddNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveAddNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedInclusiveMulNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveMulNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveMulNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveMulNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveMulNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveMulNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveMulNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveMulNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveMulNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveMulNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveMulNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveMulNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveMulNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveMulNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveMulNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveMulNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedInclusiveMinNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveMinNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveMinNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveMinNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveMinNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveMinNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveMinNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveMinNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveMinNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveMinNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveMinNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveMinNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveMinNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveMinNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveMinNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveMinNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedInclusiveMaxNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveMaxNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveMaxNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveMaxNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveMaxNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveMaxNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveMaxNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveMaxNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveMaxNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveMaxNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveMaxNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveMaxNV(data[3].d4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveAndNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveAndNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveAndNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveAndNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveAndNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveAndNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveAndNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveAndNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedInclusiveAndNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedInclusiveAndNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedInclusiveAndNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedInclusiveAndNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedInclusiveOrNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveOrNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveOrNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveOrNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveOrNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveOrNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveOrNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveOrNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedInclusiveOrNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedInclusiveOrNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedInclusiveOrNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedInclusiveOrNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedInclusiveXorNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveXorNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveXorNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveXorNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveXorNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveXorNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveXorNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveXorNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedInclusiveXorNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedInclusiveXorNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedInclusiveXorNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedInclusiveXorNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].f4.x = subgroupPartitionedExclusiveAddNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveAddNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveAddNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveAddNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveAddNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveAddNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveAddNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveAddNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveAddNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveAddNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveAddNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveAddNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveAddNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveAddNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveAddNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveAddNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedExclusiveMulNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveMulNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveMulNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveMulNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveMulNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveMulNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveMulNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveMulNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveMulNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveMulNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveMulNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveMulNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveMulNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveMulNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveMulNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveMulNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedExclusiveMinNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveMinNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveMinNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveMinNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveMinNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveMinNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveMinNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveMinNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveMinNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveMinNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveMinNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveMinNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveMinNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveMinNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveMinNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveMinNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedExclusiveMaxNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveMaxNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveMaxNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveMaxNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveMaxNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveMaxNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveMaxNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveMaxNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveMaxNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveMaxNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveMaxNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveMaxNV(data[3].d4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveAndNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveAndNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveAndNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveAndNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveAndNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveAndNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveAndNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveAndNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedExclusiveAndNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedExclusiveAndNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedExclusiveAndNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedExclusiveAndNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedExclusiveOrNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveOrNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveOrNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveOrNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveOrNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveOrNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveOrNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveOrNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedExclusiveOrNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedExclusiveOrNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedExclusiveOrNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedExclusiveOrNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedExclusiveXorNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveXorNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveXorNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveXorNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveXorNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveXorNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveXorNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveXorNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedExclusiveXorNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedExclusiveXorNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedExclusiveXorNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedExclusiveXorNV(lessThan(data[1].i4, ivec4(0)), ballot)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupQuad.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupQuad.comp new file mode 100644 index 00000000000..223a7cdacc2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupQuad.comp @@ -0,0 +1,118 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_quad: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.x = subgroupQuadBroadcast(data[0].f4.x, 1); + data[invocation].f4.xy = subgroupQuadBroadcast(data[1].f4.xy, 1); + data[invocation].f4.xyz = subgroupQuadBroadcast(data[2].f4.xyz, 1); + data[invocation].f4 = subgroupQuadBroadcast(data[3].f4, 1); + + data[invocation].i4.x = subgroupQuadBroadcast(data[0].i4.x, 1); + data[invocation].i4.xy = subgroupQuadBroadcast(data[1].i4.xy, 1); + data[invocation].i4.xyz = subgroupQuadBroadcast(data[2].i4.xyz, 1); + data[invocation].i4 = subgroupQuadBroadcast(data[3].i4, 1); + + data[invocation].u4.x = subgroupQuadBroadcast(data[0].u4.x, 1); + data[invocation].u4.xy = subgroupQuadBroadcast(data[1].u4.xy, 1); + data[invocation].u4.xyz = subgroupQuadBroadcast(data[2].u4.xyz, 1); + data[invocation].u4 = subgroupQuadBroadcast(data[3].u4, 1); + + data[invocation].d4.x = subgroupQuadBroadcast(data[0].d4.x, 1); + data[invocation].d4.xy = subgroupQuadBroadcast(data[1].d4.xy, 1); + data[invocation].d4.xyz = subgroupQuadBroadcast(data[2].d4.xyz, 1); + data[invocation].d4 = subgroupQuadBroadcast(data[3].d4, 1); + + data[invocation].i4.x = int(subgroupQuadBroadcast(data[0].i4.x < 0, 1)); + data[invocation].i4.xy = ivec2(subgroupQuadBroadcast(lessThan(data[1].i4.xy, ivec2(0)), 1)); + data[invocation].i4.xyz = ivec3(subgroupQuadBroadcast(lessThan(data[1].i4.xyz, ivec3(0)), 1)); + data[invocation].i4 = ivec4(subgroupQuadBroadcast(lessThan(data[1].i4, ivec4(0)), 1)); + + data[invocation].f4.x = subgroupQuadSwapHorizontal(data[0].f4.x); + data[invocation].f4.xy = subgroupQuadSwapHorizontal(data[1].f4.xy); + data[invocation].f4.xyz = subgroupQuadSwapHorizontal(data[2].f4.xyz); + data[invocation].f4 = subgroupQuadSwapHorizontal(data[3].f4); + + data[invocation].i4.x = subgroupQuadSwapHorizontal(data[0].i4.x); + data[invocation].i4.xy = subgroupQuadSwapHorizontal(data[1].i4.xy); + data[invocation].i4.xyz = subgroupQuadSwapHorizontal(data[2].i4.xyz); + data[invocation].i4 = subgroupQuadSwapHorizontal(data[3].i4); + + data[invocation].u4.x = subgroupQuadSwapHorizontal(data[0].u4.x); + data[invocation].u4.xy = subgroupQuadSwapHorizontal(data[1].u4.xy); + data[invocation].u4.xyz = subgroupQuadSwapHorizontal(data[2].u4.xyz); + data[invocation].u4 = subgroupQuadSwapHorizontal(data[3].u4); + + data[invocation].d4.x = subgroupQuadSwapHorizontal(data[0].d4.x); + data[invocation].d4.xy = subgroupQuadSwapHorizontal(data[1].d4.xy); + data[invocation].d4.xyz = subgroupQuadSwapHorizontal(data[2].d4.xyz); + data[invocation].d4 = subgroupQuadSwapHorizontal(data[3].d4); + + data[invocation].i4.x = int(subgroupQuadSwapHorizontal(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupQuadSwapHorizontal(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupQuadSwapHorizontal(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupQuadSwapHorizontal(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].f4.x = subgroupQuadSwapVertical(data[0].f4.x); + data[invocation].f4.xy = subgroupQuadSwapVertical(data[1].f4.xy); + data[invocation].f4.xyz = subgroupQuadSwapVertical(data[2].f4.xyz); + data[invocation].f4 = subgroupQuadSwapVertical(data[3].f4); + + data[invocation].i4.x = subgroupQuadSwapVertical(data[0].i4.x); + data[invocation].i4.xy = subgroupQuadSwapVertical(data[1].i4.xy); + data[invocation].i4.xyz = subgroupQuadSwapVertical(data[2].i4.xyz); + data[invocation].i4 = subgroupQuadSwapVertical(data[3].i4); + + data[invocation].u4.x = subgroupQuadSwapVertical(data[0].u4.x); + data[invocation].u4.xy = subgroupQuadSwapVertical(data[1].u4.xy); + data[invocation].u4.xyz = subgroupQuadSwapVertical(data[2].u4.xyz); + data[invocation].u4 = subgroupQuadSwapVertical(data[3].u4); + + data[invocation].d4.x = subgroupQuadSwapVertical(data[0].d4.x); + data[invocation].d4.xy = subgroupQuadSwapVertical(data[1].d4.xy); + data[invocation].d4.xyz = subgroupQuadSwapVertical(data[2].d4.xyz); + data[invocation].d4 = subgroupQuadSwapVertical(data[3].d4); + + data[invocation].i4.x = int(subgroupQuadSwapVertical(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupQuadSwapVertical(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupQuadSwapVertical(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupQuadSwapVertical(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].f4.x = subgroupQuadSwapDiagonal(data[0].f4.x); + data[invocation].f4.xy = subgroupQuadSwapDiagonal(data[1].f4.xy); + data[invocation].f4.xyz = subgroupQuadSwapDiagonal(data[2].f4.xyz); + data[invocation].f4 = subgroupQuadSwapDiagonal(data[3].f4); + + data[invocation].i4.x = subgroupQuadSwapDiagonal(data[0].i4.x); + data[invocation].i4.xy = subgroupQuadSwapDiagonal(data[1].i4.xy); + data[invocation].i4.xyz = subgroupQuadSwapDiagonal(data[2].i4.xyz); + data[invocation].i4 = subgroupQuadSwapDiagonal(data[3].i4); + + data[invocation].u4.x = subgroupQuadSwapDiagonal(data[0].u4.x); + data[invocation].u4.xy = subgroupQuadSwapDiagonal(data[1].u4.xy); + data[invocation].u4.xyz = subgroupQuadSwapDiagonal(data[2].u4.xyz); + data[invocation].u4 = subgroupQuadSwapDiagonal(data[3].u4); + + data[invocation].d4.x = subgroupQuadSwapDiagonal(data[0].d4.x); + data[invocation].d4.xy = subgroupQuadSwapDiagonal(data[1].d4.xy); + data[invocation].d4.xyz = subgroupQuadSwapDiagonal(data[2].d4.xyz); + data[invocation].d4 = subgroupQuadSwapDiagonal(data[3].d4); + + data[invocation].i4.x = int(subgroupQuadSwapDiagonal(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupQuadSwapDiagonal(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupQuadSwapDiagonal(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupQuadSwapDiagonal(lessThan(data[1].i4, ivec4(0)))); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupShuffle.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupShuffle.comp new file mode 100644 index 00000000000..6d264882ac2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupShuffle.comp @@ -0,0 +1,68 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_shuffle: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.x = subgroupShuffle(data[0].f4.x, invocation); + data[invocation].f4.xy = subgroupShuffle(data[1].f4.xy, invocation); + data[invocation].f4.xyz = subgroupShuffle(data[2].f4.xyz, invocation); + data[invocation].f4 = subgroupShuffle(data[3].f4, invocation); + + data[invocation].i4.x = subgroupShuffle(data[0].i4.x, invocation); + data[invocation].i4.xy = subgroupShuffle(data[1].i4.xy, invocation); + data[invocation].i4.xyz = subgroupShuffle(data[2].i4.xyz, invocation); + data[invocation].i4 = subgroupShuffle(data[3].i4, invocation); + + data[invocation].u4.x = subgroupShuffle(data[0].u4.x, invocation); + data[invocation].u4.xy = subgroupShuffle(data[1].u4.xy, invocation); + data[invocation].u4.xyz = subgroupShuffle(data[2].u4.xyz, invocation); + data[invocation].u4 = subgroupShuffle(data[3].u4, invocation); + + data[invocation].d4.x = subgroupShuffle(data[0].d4.x, invocation); + data[invocation].d4.xy = subgroupShuffle(data[1].d4.xy, invocation); + data[invocation].d4.xyz = subgroupShuffle(data[2].d4.xyz, invocation); + data[invocation].d4 = subgroupShuffle(data[3].d4, invocation); + + data[invocation].i4.x = int(subgroupShuffle(data[0].i4.x < 0, invocation)); + data[invocation].i4.xy = ivec2(subgroupShuffle(lessThan(data[1].i4.xy, ivec2(0)), invocation)); + data[invocation].i4.xyz = ivec3(subgroupShuffle(lessThan(data[1].i4.xyz, ivec3(0)), invocation)); + data[invocation].i4 = ivec4(subgroupShuffle(lessThan(data[1].i4, ivec4(0)), invocation)); + + data[invocation].f4.x = subgroupShuffleXor(data[0].f4.x, invocation); + data[invocation].f4.xy = subgroupShuffleXor(data[1].f4.xy, invocation); + data[invocation].f4.xyz = subgroupShuffleXor(data[2].f4.xyz, invocation); + data[invocation].f4 = subgroupShuffleXor(data[3].f4, invocation); + + data[invocation].i4.x = subgroupShuffleXor(data[0].i4.x, invocation); + data[invocation].i4.xy = subgroupShuffleXor(data[1].i4.xy, invocation); + data[invocation].i4.xyz = subgroupShuffleXor(data[2].i4.xyz, invocation); + data[invocation].i4 = subgroupShuffleXor(data[3].i4, invocation); + + data[invocation].u4.x = subgroupShuffleXor(data[0].u4.x, invocation); + data[invocation].u4.xy = subgroupShuffleXor(data[1].u4.xy, invocation); + data[invocation].u4.xyz = subgroupShuffleXor(data[2].u4.xyz, invocation); + data[invocation].u4 = subgroupShuffleXor(data[3].u4, invocation); + + data[invocation].d4.x = subgroupShuffleXor(data[0].d4.x, invocation); + data[invocation].d4.xy = subgroupShuffleXor(data[1].d4.xy, invocation); + data[invocation].d4.xyz = subgroupShuffleXor(data[2].d4.xyz, invocation); + data[invocation].d4 = subgroupShuffleXor(data[3].d4, invocation); + + data[invocation].i4.x = int(subgroupShuffleXor(data[0].i4.x < 0, invocation)); + data[invocation].i4.xy = ivec2(subgroupShuffleXor(lessThan(data[1].i4.xy, ivec2(0)), invocation)); + data[invocation].i4.xyz = ivec3(subgroupShuffleXor(lessThan(data[1].i4.xyz, ivec3(0)), invocation)); + data[invocation].i4 = ivec4(subgroupShuffleXor(lessThan(data[1].i4, ivec4(0)), invocation)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupShuffleRelative.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupShuffleRelative.comp new file mode 100644 index 00000000000..1864de10afc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupShuffleRelative.comp @@ -0,0 +1,68 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_shuffle_relative: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.x = subgroupShuffleUp(data[0].f4.x, invocation); + data[invocation].f4.xy = subgroupShuffleUp(data[1].f4.xy, invocation); + data[invocation].f4.xyz = subgroupShuffleUp(data[2].f4.xyz, invocation); + data[invocation].f4 = subgroupShuffleUp(data[3].f4, invocation); + + data[invocation].i4.x = subgroupShuffleUp(data[0].i4.x, invocation); + data[invocation].i4.xy = subgroupShuffleUp(data[1].i4.xy, invocation); + data[invocation].i4.xyz = subgroupShuffleUp(data[2].i4.xyz, invocation); + data[invocation].i4 = subgroupShuffleUp(data[3].i4, invocation); + + data[invocation].u4.x = subgroupShuffleUp(data[0].u4.x, invocation); + data[invocation].u4.xy = subgroupShuffleUp(data[1].u4.xy, invocation); + data[invocation].u4.xyz = subgroupShuffleUp(data[2].u4.xyz, invocation); + data[invocation].u4 = subgroupShuffleUp(data[3].u4, invocation); + + data[invocation].d4.x = subgroupShuffleUp(data[0].d4.x, invocation); + data[invocation].d4.xy = subgroupShuffleUp(data[1].d4.xy, invocation); + data[invocation].d4.xyz = subgroupShuffleUp(data[2].d4.xyz, invocation); + data[invocation].d4 = subgroupShuffleUp(data[3].d4, invocation); + + data[invocation].i4.x = int(subgroupShuffleUp(data[0].i4.x < 0, invocation)); + data[invocation].i4.xy = ivec2(subgroupShuffleUp(lessThan(data[1].i4.xy, ivec2(0)), invocation)); + data[invocation].i4.xyz = ivec3(subgroupShuffleUp(lessThan(data[1].i4.xyz, ivec3(0)), invocation)); + data[invocation].i4 = ivec4(subgroupShuffleUp(lessThan(data[1].i4, ivec4(0)), invocation)); + + data[invocation].f4.x = subgroupShuffleDown(data[0].f4.x, invocation); + data[invocation].f4.xy = subgroupShuffleDown(data[1].f4.xy, invocation); + data[invocation].f4.xyz = subgroupShuffleDown(data[2].f4.xyz, invocation); + data[invocation].f4 = subgroupShuffleDown(data[3].f4, invocation); + + data[invocation].i4.x = subgroupShuffleDown(data[0].i4.x, invocation); + data[invocation].i4.xy = subgroupShuffleDown(data[1].i4.xy, invocation); + data[invocation].i4.xyz = subgroupShuffleDown(data[2].i4.xyz, invocation); + data[invocation].i4 = subgroupShuffleDown(data[3].i4, invocation); + + data[invocation].u4.x = subgroupShuffleDown(data[0].u4.x, invocation); + data[invocation].u4.xy = subgroupShuffleDown(data[1].u4.xy, invocation); + data[invocation].u4.xyz = subgroupShuffleDown(data[2].u4.xyz, invocation); + data[invocation].u4 = subgroupShuffleDown(data[3].u4, invocation); + + data[invocation].d4.x = subgroupShuffleDown(data[0].d4.x, invocation); + data[invocation].d4.xy = subgroupShuffleDown(data[1].d4.xy, invocation); + data[invocation].d4.xyz = subgroupShuffleDown(data[2].d4.xyz, invocation); + data[invocation].d4 = subgroupShuffleDown(data[3].d4, invocation); + + data[invocation].i4.x = int(subgroupShuffleDown(data[0].i4.x < 0, invocation)); + data[invocation].i4.xy = ivec2(subgroupShuffleDown(lessThan(data[1].i4.xy, ivec2(0)), invocation)); + data[invocation].i4.xyz = ivec3(subgroupShuffleDown(lessThan(data[1].i4.xyz, ivec3(0)), invocation)); + data[invocation].i4 = ivec4(subgroupShuffleDown(lessThan(data[1].i4, ivec4(0)), invocation)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupVote.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupVote.comp new file mode 100644 index 00000000000..c1c877af3ba --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.subgroupVote.comp @@ -0,0 +1,49 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_vote: enable + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; + int r; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + if (subgroupAll(data[invocation].r < 0)) + { + data[invocation].r = int(subgroupAllEqual(data[0].f4.x)); + data[invocation].r = int(subgroupAllEqual(data[1].f4.xy)); + data[invocation].r = int(subgroupAllEqual(data[2].f4.xyz)); + data[invocation].r = int(subgroupAllEqual(data[3].f4)); + + data[invocation].r = int(subgroupAllEqual(data[0].i4.x)); + data[invocation].r = int(subgroupAllEqual(data[1].i4.xy)); + data[invocation].r = int(subgroupAllEqual(data[2].i4.xyz)); + data[invocation].r = int(subgroupAllEqual(data[3].i4)); + + data[invocation].r = int(subgroupAllEqual(data[0].u4.x)); + data[invocation].r = int(subgroupAllEqual(data[1].u4.xy)); + data[invocation].r = int(subgroupAllEqual(data[2].u4.xyz)); + data[invocation].r = int(subgroupAllEqual(data[3].u4)); + } + else if (subgroupAny(data[invocation].r < 0)) + { + data[invocation].r = int(subgroupAllEqual(data[0].d4.x)); + data[invocation].r = int(subgroupAllEqual(data[1].d4.xy)); + data[invocation].r = int(subgroupAllEqual(data[2].d4.xyz)); + data[invocation].r = int(subgroupAllEqual(data[3].d4)); + + data[invocation].r = int(int(subgroupAllEqual(data[0].i4.x < 0))); + data[invocation].r = int(ivec2(subgroupAllEqual(lessThan(data[1].i4.xy, ivec2(0))))); + data[invocation].r = int(ivec3(subgroupAllEqual(lessThan(data[1].i4.xyz, ivec3(0))))); + data[invocation].r = int(ivec4(subgroupAllEqual(lessThan(data[1].i4, ivec4(0))))); + } +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.targetOpenGL.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.targetOpenGL.vert index 6d68a339121..501a3e56479 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/spv.targetOpenGL.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.targetOpenGL.vert @@ -2,8 +2,8 @@ layout(constant_id = 3) const int a = 2; layout(location = 2) uniform float f; -layout(location = 4) uniform sampler2D s1; -uniform sampler2D s2; +layout(location = 4, binding = 1) uniform sampler2D s1; +layout(binding = 2) uniform sampler2D s2; void main() { diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit1.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit1.frag new file mode 100644 index 00000000000..d84f821e93b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit1.frag @@ -0,0 +1,16 @@ +#version 460 + +float f; +float a1; + +float foo(); + +out float cout; + +void main() +{ + f = 10; + float g = foo(); + f += g; + f += gl_FragCoord.y; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit2.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit2.frag new file mode 100644 index 00000000000..d17e7e7ba0e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit2.frag @@ -0,0 +1,17 @@ +#version 410 +// a different version number makes different id's for the same shared symbol + +float a2; +float f; + +float bar(); + +out float cout; +in float cin; + +float foo() +{ + float h2 = 2 * f + cin; + float g2 = bar(); + return h2 + g2 + gl_FragCoord.y; +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit3.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit3.frag new file mode 100644 index 00000000000..4c965975f22 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.unit3.frag @@ -0,0 +1,15 @@ +#version 460 + +float f; +float h3 = 3.0; + +out float cout; +in float cin; + +float bar() +{ + h3 *= f; + float g3 = 2 * h3; + cout = g3; + return h3 + g3 + gl_FragCoord.y; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.vecMatConstruct.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vecMatConstruct.frag new file mode 100644 index 00000000000..54a001707df --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vecMatConstruct.frag @@ -0,0 +1,14 @@ +#version 450 + +void main() +{ + mat4x3 m; + + vec2 v2 = vec2(m); + vec3 v3 = vec3(m); + vec4 v4 = vec4(m); + + ivec2 iv2 = ivec2(m); + ivec3 iv3 = ivec3(m); + ivec4 iv4 = ivec4(m); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan100.subgroupArithmetic.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan100.subgroupArithmetic.comp new file mode 100644 index 00000000000..6cc9337b68b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan100.subgroupArithmetic.comp @@ -0,0 +1,393 @@ +#version 450 + +#extension GL_KHR_shader_subgroup_arithmetic: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + data[invocation].f4.x = subgroupAdd(data[0].f4.x); + data[invocation].f4.xy = subgroupAdd(data[1].f4.xy); + data[invocation].f4.xyz = subgroupAdd(data[2].f4.xyz); + data[invocation].f4 = subgroupAdd(data[3].f4); + + data[invocation].i4.x = subgroupAdd(data[0].i4.x); + data[invocation].i4.xy = subgroupAdd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupAdd(data[2].i4.xyz); + data[invocation].i4 = subgroupAdd(data[3].i4); + + data[invocation].u4.x = subgroupAdd(data[0].u4.x); + data[invocation].u4.xy = subgroupAdd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupAdd(data[2].u4.xyz); + data[invocation].u4 = subgroupAdd(data[3].u4); + + data[invocation].d4.x = subgroupAdd(data[0].d4.x); + data[invocation].d4.xy = subgroupAdd(data[1].d4.xy); + data[invocation].d4.xyz = subgroupAdd(data[2].d4.xyz); + data[invocation].d4 = subgroupAdd(data[3].d4); + + data[invocation].f4.x = subgroupMul(data[0].f4.x); + data[invocation].f4.xy = subgroupMul(data[1].f4.xy); + data[invocation].f4.xyz = subgroupMul(data[2].f4.xyz); + data[invocation].f4 = subgroupMul(data[3].f4); + + data[invocation].i4.x = subgroupMul(data[0].i4.x); + data[invocation].i4.xy = subgroupMul(data[1].i4.xy); + data[invocation].i4.xyz = subgroupMul(data[2].i4.xyz); + data[invocation].i4 = subgroupMul(data[3].i4); + + data[invocation].u4.x = subgroupMul(data[0].u4.x); + data[invocation].u4.xy = subgroupMul(data[1].u4.xy); + data[invocation].u4.xyz = subgroupMul(data[2].u4.xyz); + data[invocation].u4 = subgroupMul(data[3].u4); + + data[invocation].d4.x = subgroupMul(data[0].d4.x); + data[invocation].d4.xy = subgroupMul(data[1].d4.xy); + data[invocation].d4.xyz = subgroupMul(data[2].d4.xyz); + data[invocation].d4 = subgroupMul(data[3].d4); + + data[invocation].f4.x = subgroupMin(data[0].f4.x); + data[invocation].f4.xy = subgroupMin(data[1].f4.xy); + data[invocation].f4.xyz = subgroupMin(data[2].f4.xyz); + data[invocation].f4 = subgroupMin(data[3].f4); + + data[invocation].i4.x = subgroupMin(data[0].i4.x); + data[invocation].i4.xy = subgroupMin(data[1].i4.xy); + data[invocation].i4.xyz = subgroupMin(data[2].i4.xyz); + data[invocation].i4 = subgroupMin(data[3].i4); + + data[invocation].u4.x = subgroupMin(data[0].u4.x); + data[invocation].u4.xy = subgroupMin(data[1].u4.xy); + data[invocation].u4.xyz = subgroupMin(data[2].u4.xyz); + data[invocation].u4 = subgroupMin(data[3].u4); + + data[invocation].d4.x = subgroupMin(data[0].d4.x); + data[invocation].d4.xy = subgroupMin(data[1].d4.xy); + data[invocation].d4.xyz = subgroupMin(data[2].d4.xyz); + data[invocation].d4 = subgroupMin(data[3].d4); + + data[invocation].f4.x = subgroupMax(data[0].f4.x); + data[invocation].f4.xy = subgroupMax(data[1].f4.xy); + data[invocation].f4.xyz = subgroupMax(data[2].f4.xyz); + data[invocation].f4 = subgroupMax(data[3].f4); + + data[invocation].i4.x = subgroupMax(data[0].i4.x); + data[invocation].i4.xy = subgroupMax(data[1].i4.xy); + data[invocation].i4.xyz = subgroupMax(data[2].i4.xyz); + data[invocation].i4 = subgroupMax(data[3].i4); + + data[invocation].u4.x = subgroupMax(data[0].u4.x); + data[invocation].u4.xy = subgroupMax(data[1].u4.xy); + data[invocation].u4.xyz = subgroupMax(data[2].u4.xyz); + data[invocation].u4 = subgroupMax(data[3].u4); + + data[invocation].d4.x = subgroupMax(data[0].d4.x); + data[invocation].d4.xy = subgroupMax(data[1].d4.xy); + data[invocation].d4.xyz = subgroupMax(data[2].d4.xyz); + data[invocation].d4 = subgroupMax(data[3].d4); + + data[invocation].i4.x = subgroupAnd(data[0].i4.x); + data[invocation].i4.xy = subgroupAnd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupAnd(data[2].i4.xyz); + data[invocation].i4 = subgroupAnd(data[3].i4); + + data[invocation].u4.x = subgroupAnd(data[0].u4.x); + data[invocation].u4.xy = subgroupAnd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupAnd(data[2].u4.xyz); + data[invocation].u4 = subgroupAnd(data[3].u4); + + data[invocation].i4.x = int(subgroupAnd(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupAnd(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupAnd(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupAnd(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupOr(data[0].i4.x); + data[invocation].i4.xy = subgroupOr(data[1].i4.xy); + data[invocation].i4.xyz = subgroupOr(data[2].i4.xyz); + data[invocation].i4 = subgroupOr(data[3].i4); + + data[invocation].u4.x = subgroupOr(data[0].u4.x); + data[invocation].u4.xy = subgroupOr(data[1].u4.xy); + data[invocation].u4.xyz = subgroupOr(data[2].u4.xyz); + data[invocation].u4 = subgroupOr(data[3].u4); + + data[invocation].i4.x = int(subgroupOr(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupOr(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupOr(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupOr(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupXor(data[0].i4.x); + data[invocation].i4.xy = subgroupXor(data[1].i4.xy); + data[invocation].i4.xyz = subgroupXor(data[2].i4.xyz); + data[invocation].i4 = subgroupXor(data[3].i4); + + data[invocation].u4.x = subgroupXor(data[0].u4.x); + data[invocation].u4.xy = subgroupXor(data[1].u4.xy); + data[invocation].u4.xyz = subgroupXor(data[2].u4.xyz); + data[invocation].u4 = subgroupXor(data[3].u4); + + data[invocation].i4.x = int(subgroupXor(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupXor(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupXor(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupXor(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].f4.x = subgroupInclusiveAdd(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveAdd(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveAdd(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveAdd(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveAdd(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveAdd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveAdd(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveAdd(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveAdd(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveAdd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveAdd(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveAdd(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveAdd(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveAdd(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveAdd(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveAdd(data[3].d4); + + data[invocation].f4.x = subgroupInclusiveMul(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveMul(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveMul(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveMul(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveMul(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveMul(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveMul(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveMul(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveMul(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveMul(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveMul(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveMul(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveMul(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveMul(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveMul(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveMul(data[3].d4); + + data[invocation].f4.x = subgroupInclusiveMin(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveMin(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveMin(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveMin(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveMin(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveMin(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveMin(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveMin(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveMin(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveMin(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveMin(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveMin(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveMin(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveMin(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveMin(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveMin(data[3].d4); + + data[invocation].f4.x = subgroupInclusiveMax(data[0].f4.x); + data[invocation].f4.xy = subgroupInclusiveMax(data[1].f4.xy); + data[invocation].f4.xyz = subgroupInclusiveMax(data[2].f4.xyz); + data[invocation].f4 = subgroupInclusiveMax(data[3].f4); + + data[invocation].i4.x = subgroupInclusiveMax(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveMax(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveMax(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveMax(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveMax(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveMax(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveMax(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveMax(data[3].u4); + + data[invocation].d4.x = subgroupInclusiveMax(data[0].d4.x); + data[invocation].d4.xy = subgroupInclusiveMax(data[1].d4.xy); + data[invocation].d4.xyz = subgroupInclusiveMax(data[2].d4.xyz); + data[invocation].d4 = subgroupInclusiveMax(data[3].d4); + + data[invocation].i4.x = subgroupInclusiveAnd(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveAnd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveAnd(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveAnd(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveAnd(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveAnd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveAnd(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveAnd(data[3].u4); + + data[invocation].i4.x = int(subgroupInclusiveAnd(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupInclusiveAnd(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupInclusiveAnd(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupInclusiveAnd(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupInclusiveOr(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveOr(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveOr(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveOr(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveOr(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveOr(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveOr(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveOr(data[3].u4); + + data[invocation].i4.x = int(subgroupInclusiveOr(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupInclusiveOr(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupInclusiveOr(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupInclusiveOr(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupInclusiveXor(data[0].i4.x); + data[invocation].i4.xy = subgroupInclusiveXor(data[1].i4.xy); + data[invocation].i4.xyz = subgroupInclusiveXor(data[2].i4.xyz); + data[invocation].i4 = subgroupInclusiveXor(data[3].i4); + + data[invocation].u4.x = subgroupInclusiveXor(data[0].u4.x); + data[invocation].u4.xy = subgroupInclusiveXor(data[1].u4.xy); + data[invocation].u4.xyz = subgroupInclusiveXor(data[2].u4.xyz); + data[invocation].u4 = subgroupInclusiveXor(data[3].u4); + + data[invocation].i4.x = int(subgroupInclusiveXor(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupInclusiveXor(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupInclusiveXor(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupInclusiveXor(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].f4.x = subgroupExclusiveAdd(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveAdd(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveAdd(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveAdd(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveAdd(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveAdd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveAdd(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveAdd(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveAdd(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveAdd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveAdd(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveAdd(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveAdd(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveAdd(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveAdd(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveAdd(data[3].d4); + + data[invocation].f4.x = subgroupExclusiveMul(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveMul(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveMul(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveMul(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveMul(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveMul(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveMul(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveMul(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveMul(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveMul(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveMul(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveMul(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveMul(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveMul(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveMul(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveMul(data[3].d4); + + data[invocation].f4.x = subgroupExclusiveMin(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveMin(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveMin(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveMin(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveMin(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveMin(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveMin(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveMin(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveMin(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveMin(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveMin(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveMin(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveMin(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveMin(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveMin(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveMin(data[3].d4); + + data[invocation].f4.x = subgroupExclusiveMax(data[0].f4.x); + data[invocation].f4.xy = subgroupExclusiveMax(data[1].f4.xy); + data[invocation].f4.xyz = subgroupExclusiveMax(data[2].f4.xyz); + data[invocation].f4 = subgroupExclusiveMax(data[3].f4); + + data[invocation].i4.x = subgroupExclusiveMax(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveMax(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveMax(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveMax(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveMax(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveMax(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveMax(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveMax(data[3].u4); + + data[invocation].d4.x = subgroupExclusiveMax(data[0].d4.x); + data[invocation].d4.xy = subgroupExclusiveMax(data[1].d4.xy); + data[invocation].d4.xyz = subgroupExclusiveMax(data[2].d4.xyz); + data[invocation].d4 = subgroupExclusiveMax(data[3].d4); + + data[invocation].i4.x = subgroupExclusiveAnd(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveAnd(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveAnd(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveAnd(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveAnd(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveAnd(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveAnd(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveAnd(data[3].u4); + + data[invocation].i4.x = int(subgroupExclusiveAnd(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupExclusiveAnd(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupExclusiveAnd(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupExclusiveAnd(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupExclusiveOr(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveOr(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveOr(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveOr(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveOr(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveOr(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveOr(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveOr(data[3].u4); + + data[invocation].i4.x = int(subgroupExclusiveOr(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupExclusiveOr(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupExclusiveOr(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupExclusiveOr(lessThan(data[1].i4, ivec4(0)))); + + data[invocation].i4.x = subgroupExclusiveXor(data[0].i4.x); + data[invocation].i4.xy = subgroupExclusiveXor(data[1].i4.xy); + data[invocation].i4.xyz = subgroupExclusiveXor(data[2].i4.xyz); + data[invocation].i4 = subgroupExclusiveXor(data[3].i4); + + data[invocation].u4.x = subgroupExclusiveXor(data[0].u4.x); + data[invocation].u4.xy = subgroupExclusiveXor(data[1].u4.xy); + data[invocation].u4.xyz = subgroupExclusiveXor(data[2].u4.xyz); + data[invocation].u4 = subgroupExclusiveXor(data[3].u4); + + data[invocation].i4.x = int(subgroupExclusiveXor(data[0].i4.x < 0)); + data[invocation].i4.xy = ivec2(subgroupExclusiveXor(lessThan(data[1].i4.xy, ivec2(0)))); + data[invocation].i4.xyz = ivec3(subgroupExclusiveXor(lessThan(data[1].i4.xyz, ivec3(0)))); + data[invocation].i4 = ivec4(subgroupExclusiveXor(lessThan(data[1].i4, ivec4(0)))); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan100.subgroupPartitioned.comp b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan100.subgroupPartitioned.comp new file mode 100644 index 00000000000..604833e0569 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan100.subgroupPartitioned.comp @@ -0,0 +1,420 @@ +#version 450 + +#extension GL_NV_shader_subgroup_partitioned: enable + +layout (local_size_x = 8) in; + +layout(binding = 0) buffer Buffers +{ + vec4 f4; + ivec4 i4; + uvec4 u4; + dvec4 d4; +} data[4]; + +void main() +{ + uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; + + uvec4 ballot = subgroupPartitionNV(invocation); + + data[invocation].u4 = subgroupPartitionNV(data[0].f4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].f4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].f4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].f4); + + data[invocation].u4 = subgroupPartitionNV(data[0].i4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].i4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].i4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].i4); + + data[invocation].u4 = subgroupPartitionNV(data[0].u4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].u4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].u4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].u4); + + data[invocation].u4 = subgroupPartitionNV(data[0].d4.x); + data[invocation].u4 = subgroupPartitionNV(data[0].d4.xy); + data[invocation].u4 = subgroupPartitionNV(data[0].d4.xyz); + data[invocation].u4 = subgroupPartitionNV(data[0].d4); + + data[invocation].u4 = subgroupPartitionNV(bool(data[0].i4.x)); + data[invocation].u4 = subgroupPartitionNV(bvec2(data[0].i4.xy)); + data[invocation].u4 = subgroupPartitionNV(bvec3(data[0].i4.xyz)); + data[invocation].u4 = subgroupPartitionNV(bvec4(data[0].i4)); + + data[invocation].f4.x = subgroupPartitionedAddNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedAddNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedAddNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedAddNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedAddNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedAddNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedAddNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedAddNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedAddNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedAddNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedAddNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedAddNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedAddNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedAddNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedAddNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedAddNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedMulNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedMulNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedMulNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedMulNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedMulNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedMulNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedMulNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedMulNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedMulNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedMulNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedMulNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedMulNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedMulNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedMulNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedMulNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedMulNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedMinNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedMinNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedMinNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedMinNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedMinNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedMinNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedMinNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedMinNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedMinNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedMinNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedMinNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedMinNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedMinNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedMinNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedMinNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedMinNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedMaxNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedMaxNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedMaxNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedMaxNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedMaxNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedMaxNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedMaxNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedMaxNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedMaxNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedMaxNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedMaxNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedMaxNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedMaxNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedMaxNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedMaxNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedMaxNV(data[3].d4, ballot); + + data[invocation].i4.x = subgroupPartitionedAndNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedAndNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedAndNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedAndNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedAndNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedAndNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedAndNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedAndNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedAndNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedAndNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedAndNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedAndNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedOrNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedOrNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedOrNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedOrNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedOrNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedOrNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedOrNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedOrNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedOrNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedOrNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedOrNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedOrNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedXorNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedXorNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedXorNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedXorNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedXorNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedXorNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedXorNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedXorNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedXorNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedXorNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedXorNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedXorNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].f4.x = subgroupPartitionedInclusiveAddNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveAddNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveAddNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveAddNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveAddNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveAddNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveAddNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveAddNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveAddNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveAddNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveAddNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveAddNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveAddNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveAddNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveAddNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveAddNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedInclusiveMulNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveMulNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveMulNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveMulNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveMulNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveMulNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveMulNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveMulNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveMulNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveMulNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveMulNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveMulNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveMulNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveMulNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveMulNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveMulNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedInclusiveMinNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveMinNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveMinNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveMinNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveMinNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveMinNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveMinNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveMinNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveMinNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveMinNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveMinNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveMinNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveMinNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveMinNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveMinNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveMinNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedInclusiveMaxNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedInclusiveMaxNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedInclusiveMaxNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveMaxNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveMaxNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveMaxNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveMaxNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveMaxNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveMaxNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedInclusiveMaxNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedInclusiveMaxNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedInclusiveMaxNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedInclusiveMaxNV(data[3].d4, ballot); + + data[invocation].i4.x = subgroupPartitionedInclusiveAndNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveAndNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveAndNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveAndNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveAndNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveAndNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveAndNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveAndNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedInclusiveAndNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedInclusiveAndNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedInclusiveAndNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedInclusiveAndNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedInclusiveOrNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveOrNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveOrNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveOrNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveOrNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveOrNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveOrNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveOrNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedInclusiveOrNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedInclusiveOrNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedInclusiveOrNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedInclusiveOrNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedInclusiveXorNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedInclusiveXorNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedInclusiveXorNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedInclusiveXorNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedInclusiveXorNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedInclusiveXorNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedInclusiveXorNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedInclusiveXorNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedInclusiveXorNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedInclusiveXorNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedInclusiveXorNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedInclusiveXorNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].f4.x = subgroupPartitionedExclusiveAddNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveAddNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveAddNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveAddNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveAddNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveAddNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveAddNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveAddNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveAddNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveAddNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveAddNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveAddNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveAddNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveAddNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveAddNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveAddNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedExclusiveMulNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveMulNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveMulNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveMulNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveMulNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveMulNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveMulNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveMulNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveMulNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveMulNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveMulNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveMulNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveMulNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveMulNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveMulNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveMulNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedExclusiveMinNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveMinNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveMinNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveMinNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveMinNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveMinNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveMinNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveMinNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveMinNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveMinNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveMinNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveMinNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveMinNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveMinNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveMinNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveMinNV(data[3].d4, ballot); + + data[invocation].f4.x = subgroupPartitionedExclusiveMaxNV(data[0].f4.x, ballot); + data[invocation].f4.xy = subgroupPartitionedExclusiveMaxNV(data[1].f4.xy, ballot); + data[invocation].f4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].f4.xyz, ballot); + data[invocation].f4 = subgroupPartitionedExclusiveMaxNV(data[3].f4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveMaxNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveMaxNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveMaxNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveMaxNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveMaxNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveMaxNV(data[3].u4, ballot); + + data[invocation].d4.x = subgroupPartitionedExclusiveMaxNV(data[0].d4.x, ballot); + data[invocation].d4.xy = subgroupPartitionedExclusiveMaxNV(data[1].d4.xy, ballot); + data[invocation].d4.xyz = subgroupPartitionedExclusiveMaxNV(data[2].d4.xyz, ballot); + data[invocation].d4 = subgroupPartitionedExclusiveMaxNV(data[3].d4, ballot); + + data[invocation].i4.x = subgroupPartitionedExclusiveAndNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveAndNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveAndNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveAndNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveAndNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveAndNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveAndNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveAndNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedExclusiveAndNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedExclusiveAndNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedExclusiveAndNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedExclusiveAndNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedExclusiveOrNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveOrNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveOrNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveOrNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveOrNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveOrNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveOrNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveOrNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedExclusiveOrNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedExclusiveOrNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedExclusiveOrNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedExclusiveOrNV(lessThan(data[1].i4, ivec4(0)), ballot)); + + data[invocation].i4.x = subgroupPartitionedExclusiveXorNV(data[0].i4.x, ballot); + data[invocation].i4.xy = subgroupPartitionedExclusiveXorNV(data[1].i4.xy, ballot); + data[invocation].i4.xyz = subgroupPartitionedExclusiveXorNV(data[2].i4.xyz, ballot); + data[invocation].i4 = subgroupPartitionedExclusiveXorNV(data[3].i4, ballot); + + data[invocation].u4.x = subgroupPartitionedExclusiveXorNV(data[0].u4.x, ballot); + data[invocation].u4.xy = subgroupPartitionedExclusiveXorNV(data[1].u4.xy, ballot); + data[invocation].u4.xyz = subgroupPartitionedExclusiveXorNV(data[2].u4.xyz, ballot); + data[invocation].u4 = subgroupPartitionedExclusiveXorNV(data[3].u4, ballot); + + data[invocation].i4.x = int(subgroupPartitionedExclusiveXorNV(data[0].i4.x < 0, ballot)); + data[invocation].i4.xy = ivec2(subgroupPartitionedExclusiveXorNV(lessThan(data[1].i4.xy, ivec2(0)), ballot)); + data[invocation].i4.xyz = ivec3(subgroupPartitionedExclusiveXorNV(lessThan(data[1].i4.xyz, ivec3(0)), ballot)); + data[invocation].i4 = ivec4(subgroupPartitionedExclusiveXorNV(lessThan(data[1].i4, ivec4(0)), ballot)); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan110.int16.frag b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan110.int16.frag new file mode 100644 index 00000000000..d29894b8404 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan110.int16.frag @@ -0,0 +1,251 @@ +#version 450 + +#extension GL_KHX_shader_explicit_arithmetic_types: enable +#extension GL_KHX_shader_explicit_arithmetic_types_int8: require +#extension GL_KHX_shader_explicit_arithmetic_types_int16: require +#extension GL_KHX_shader_explicit_arithmetic_types_int32: require +#extension GL_KHX_shader_explicit_arithmetic_types_int64: require +#extension GL_KHX_shader_explicit_arithmetic_types_float16: require +#extension GL_KHX_shader_explicit_arithmetic_types_float32: require +#extension GL_KHX_shader_explicit_arithmetic_types_float64: require + +layout(binding = 0) uniform Uniforms +{ + uint index; +}; + +layout(std140, binding = 1) uniform Block +{ + int16_t i16; + i16vec2 i16v2; + i16vec3 i16v3; + i16vec4 i16v4; + uint16_t u16; + u16vec2 u16v2; + u16vec3 u16v3; + u16vec4 u16v4; +} block; + +void main() +{ +} + +void literal() +{ + const int16_t i16Const[3] = + { + int16_t(-0x1111), // Hex + int16_t(-1), // Dec + int16_t(040000), // Oct + }; + + int16_t i16 = i16Const[index]; + + const uint16_t u16Const[] = + { + uint16_t(0xFFFF), // Hex + uint16_t(65535), // Dec + uint16_t(077777), // Oct + }; + + uint16_t u16 = u16Const[index]; +} + +void typeCast16() +{ + i8vec2 i8v; + u8vec2 u8v; + i16vec2 i16v; + u16vec2 u16v; + i32vec2 i32v; + u32vec2 u32v; + i64vec2 i64v; + u64vec2 u64v; + f16vec2 f16v; + f32vec2 f32v; + f64vec2 f64v; + bvec2 bv; + + i32v = i16v; // int16_t -> int32_t + i32v = u16v; // uint16_t -> int32_t + u16v = i16v; // int16_t -> uint16_t + u32v = i16v; // int16_t -> uint32_t + i64v = i16v; // int16_t -> int64_t + u64v = i16v; // int16_t -> uint64_t + u32v = u16v; // uint16_t -> uint32_t + i64v = u16v; // uint16_t -> int64_t + u64v = u16v; // uint16_t -> uint64_t + f16v = i16v; // int16_t -> float16_t + f32v = i16v; // int16_t -> float32_t + f64v = i16v; // int16_t -> float64_t + f16v = u16v; // uint16_t -> float16_t + f32v = u16v; // uint16_t -> float32_t + f64v = u16v; // uint16_t -> float64_t + + i32v = i32vec2(i16v); // int16_t -> int32_t + i32v = i32vec2(u16v); // uint16_t -> int32_t + u16v = u16vec2(i16v); // int16_t -> uint16_t + u32v = u32vec2(i16v); // int16_t -> uint32_t + i64v = i64vec2(i16v); // int16_t -> int64_t + u64v = i64vec2(i16v); // int16_t -> uint64_t + u32v = u32vec2(u16v); // uint16_t -> uint32_t + i64v = i64vec2(u16v); // uint16_t -> int64_t + u64v = i64vec2(u16v); // uint16_t -> uint64_t + f16v = f16vec2(i16v); // int16_t -> float16_t + f32v = f32vec2(i16v); // int16_t -> float32_t + f64v = f64vec2(i16v); // int16_t -> float64_t + f16v = f16vec2(u16v); // uint16_t -> float16_t + f32v = f32vec2(u16v); // uint16_t -> float32_t + f64v = f64vec2(u16v); // uint16_t -> float64_t + + i8v = i8vec2(i16v); // int16_t -> int8_t + i8v = i8vec2(u16v); // uint16_t -> int8_t + u8v = u8vec2(i16v); // int16_t -> uint8_t + u8v = u8vec2(u16v); // uint16_t -> uint8_t + i16v = u8vec2(u16v); // uint16_t -> int16_t + i16v = i16vec2(bv); // bool -> int16 + u16v = u16vec2(bv); // bool -> uint16 + bv = bvec2(i16v); // int16 -> bool + bv = bvec2(u16v); // uint16 -> bool +} +void operators() +{ + u16vec3 u16v; + int16_t i16; + uvec3 uv; + int32_t i; + int64_t i64; + bool b; + + // Unary + u16v++; + i16--; + ++i16; + --u16v; + + u16v = ~u16v; + + i16 = +i16; + u16v = -u16v; + + // Arithmetic + i16 += i16; + u16v -= u16v; + i *= i16; + uv /= u16v; + uv %= i16; + + uv = u16v + uv; + i64 = i16 - i64; + uv = u16v * uv; + i64 = i16 * i64; + i = i16 % i; + + // Shift + u16v <<= i16; + i16 >>= u16v.y; + + i16 = i16 << u16v.z; + uv = u16v << i; + + // Relational + b = (u16v.x != i16); + b = (i16 == u16v.x); + b = (u16v.x > uv.y); + b = (i16 < i); + b = (u16v.y >= uv.x); + b = (i16 <= i); + + // Bitwise + uv |= i16; + i = i16 | i; + i64 &= i16; + uv = u16v & uv; + uv ^= i16; + u16v = u16v ^ i16; +} + +void builtinFuncs() +{ + i16vec2 i16v; + i16vec4 i16v4; + u16vec3 u16v; + u16vec2 u16v2; + u16vec4 u16v4; + bvec3 bv; + int16_t i16; + uint16_t u16; + int32_t i32; + uint32_t u32; + int64_t i64; + uint64_t u64; + + // abs() + i16v = abs(i16v); + + // sign() + i16 = sign(i16); + + // min() + i16v = min(i16v, i16); + i16v = min(i16v, i16vec2(-1)); + u16v = min(u16v, u16); + u16v = min(u16v, u16vec3(0)); + + // max() + i16v = max(i16v, i16); + i16v = max(i16v, i16vec2(-1)); + u16v = max(u16v, u16); + u16v = max(u16v, u16vec3(0)); + + // clamp() + i16v = clamp(i16v, -i16, i16); + i16v = clamp(i16v, -i16v, i16v); + u16v = clamp(u16v, -u16, u16); + u16v = clamp(u16v, -u16v, u16v); + + // mix() + i16 = mix(i16v.x, i16v.y, true); + i16v = mix(i16vec2(i16), i16vec2(-i16), bvec2(false)); + u16 = mix(u16v.x, u16v.y, true); + u16v = mix(u16vec3(u16), u16vec3(-u16), bvec3(false)); + + //pack + i32 = pack32(i16v); + i64 = pack64(i16v4); + u32 = pack32(u16v2); + u64 = pack64(u16v4); + + i16v = unpack16(i32); + i16v4 = unpack16(i64); + u16v2 = unpack16(u32); + u16v4 = unpack16(u64); + + // lessThan() + bv = lessThan(u16v, u16vec3(u16)); + bv.xy = lessThan(i16v, i16vec2(i16)); + + // lessThanEqual() + bv = lessThanEqual(u16v, u16vec3(u16)); + bv.xy = lessThanEqual(i16v, i16vec2(i16)); + + // greaterThan() + bv = greaterThan(u16v, u16vec3(u16)); + bv.xy = greaterThan(i16v, i16vec2(i16)); + + // greaterThanEqual() + bv = greaterThanEqual(u16v, u16vec3(u16)); + bv.xy = greaterThanEqual(i16v, i16vec2(i16)); + + // equal() + bv = equal(u16v, u16vec3(u16)); + bv.xy = equal(i16v, i16vec2(i16)); + + // notEqual() + bv = notEqual(u16v, u16vec3(u16)); + bv.xy = notEqual(i16v, i16vec2(i16)); +} + +// Type conversion for specialization constant +layout(constant_id = 100) const int16_t si16 = int16_t(-10); +layout(constant_id = 101) const uint16_t su16 = uint16_t(20); diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan110.storageBuffer.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan110.storageBuffer.vert new file mode 100644 index 00000000000..6dd629e8135 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.vulkan110.storageBuffer.vert @@ -0,0 +1,16 @@ +#version 450 + +#pragma use_storage_buffer + +uniform ub { + vec4 a; +} ubi; + +buffer bb { + vec4 b; +} bbi; + +void main() +{ + gl_Position = ubi.a + bbi.b; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb.vert new file mode 100644 index 00000000000..ad762bc2149 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb.vert @@ -0,0 +1,20 @@ +#version 450 + +layout(xfb_buffer = 3) out; +layout(xfb_stride = 48) out; +layout(xfb_offset = 12, location = 0) out float out1; + +layout(xfb_buffer = 2) out; +layout(location=1) out outXfb { + layout(xfb_buffer = 2, xfb_stride = 32, xfb_offset = 8) float out2; +}; + +layout(xfb_buffer = 1, location=3) out outXfb2 { + layout(xfb_stride = 64, xfb_offset = 60) float out3; +}; + +layout(location = 4, xfb_buffer = 0, xfb_offset = 4) out float out4; + +void main() +{ +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb2.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb2.vert new file mode 100644 index 00000000000..895666d9ff6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb2.vert @@ -0,0 +1,18 @@ +#version 450 + +layout (location = 0) in vec4 position; +layout (binding = 5) uniform ComponentsBlock +{ + vec4 c1; + vec2 c2; +} components; + +layout (xfb_buffer = 3, xfb_offset = 16) out gl_PerVertex +{ + vec4 gl_Position; +}; + +void main() +{ + gl_Position = position + components.c1 + vec4(components.c2, 0.0, 0.0); +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb3.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb3.vert new file mode 100644 index 00000000000..2eae7c9eb9f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfb3.vert @@ -0,0 +1,18 @@ +#version 450 + +layout (location = 0) in vec4 position; +layout (binding = 5) uniform ComponentsBlock +{ + vec4 c1; + vec2 c2; +} components; + +layout (xfb_buffer = 3, xfb_offset = 16) out gl_PerVertex +{ + layout(xfb_stride = 80) vec4 gl_Position; +}; + +void main() +{ + gl_Position = position + components.c1 + vec4(components.c2, 0.0, 0.0); +} \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOffsetOnBlockMembersAssignment.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOffsetOnBlockMembersAssignment.vert new file mode 100644 index 00000000000..40943f77a9d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOffsetOnBlockMembersAssignment.vert @@ -0,0 +1,13 @@ +#version 450 + +layout(xfb_buffer=2) out; +layout(location=5, xfb_offset=0) out block2 { + float y1_out; + vec4 y2_out; +}; + +void main() { + y1_out = 7.0; + y2_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_Position = vec4(0.0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOffsetOnStructMembersAssignment.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOffsetOnStructMembersAssignment.vert new file mode 100644 index 00000000000..e6619c582b1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOffsetOnStructMembersAssignment.vert @@ -0,0 +1,23 @@ +#version 450 + +layout(xfb_buffer=2) out; + +struct S { + float x1_out; + float x2_out; +}; + +layout(location=0, xfb_offset = 16) out S s1; + +layout(location=5, xfb_buffer=1, xfb_offset=8) out struct S2 { + float y1_out; + vec4 y2_out; +}s2; + +void main() { + s1.x1_out = 5.0; + s1.x2_out = 6.0; + s2.y1_out = 7.0; + s2.y2_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_Position = vec4(0.0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOverlapOffsetCheckWithBlockAndMember.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOverlapOffsetCheckWithBlockAndMember.vert new file mode 100644 index 00000000000..3f493dc11f0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbOverlapOffsetCheckWithBlockAndMember.vert @@ -0,0 +1,19 @@ +#version 450 + +/* block definition from GLSL spec 4.60, section 4.4.2, Output Layout Qualifiers */ + +layout(location=5, xfb_buffer = 3, xfb_offset = 12) out block2 { + vec4 v; // v will be written to byte offsets 12 through 27 of buffer + float u; // u will be written to offset 28 + layout(xfb_offset = 40) vec4 w; + vec4 x; // x will be written to offset 56, the next available offset +}; + +void main() { + v = vec4(1.0, 0.0, 1.0, 0.0); + u = 5.0; + w = vec4(1.0, 0.0, 0.0, 1.0); + x = vec4(5.0, 0.0, 0.0, 0.0); + + gl_Position = vec4(0.0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbStrideJustOnce.vert b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbStrideJustOnce.vert new file mode 100644 index 00000000000..2798c6a8ef2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/spv.xfbStrideJustOnce.vert @@ -0,0 +1,14 @@ +#version 450 + +layout(xfb_buffer=2) out; + +layout(location=5, xfb_stride=20) out block { + float y1_out; + vec4 y2_out; +}; + +void main() { + y1_out = 7.0; + y2_out = vec4(1.0, 0.0, 0.0, 1.0); + gl_Position = vec4(0.0); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/stringToDouble.vert b/3rdparty/bgfx/3rdparty/glslang/Test/stringToDouble.vert new file mode 100644 index 00000000000..5a7024dafd5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/Test/stringToDouble.vert @@ -0,0 +1,116 @@ +#version 460 +#extension GL_KHX_shader_explicit_arithmetic_types_float16 : enable +void main() +{ + float w1 = 00000.000; + float w2 = 1.0; + float w3 = 007.00; + float w4 = 000130000.0; + float w5 = 123456789.0000; + double w6 = 1234567890123456.0; + double w7 = 12345678901234567.0; + double w8 = 123456789012345678.0; + double w9 = 12345678901234567893.0; + double w10 = 1234567890123456789012345.0; + + float e1 = 0e0; + float e2 = 1e0; + float e3 = 0e14; + float e4 = 1e15; + float e5 = 1e16; + float e6 = 0e-14; + float e7 = 1e-15; + float e8 = 1e-16; + double e9 = 1e100; + double e10 = 1e+308; + double e11 = 1e-307; // Was 1e-323, but that's flushed to zero sometimes. 1e-308 can be flushed to 0. + double e12 = 1e+309; + double e13 = 1e-324; + double e24 = 1e+999; + double e25 = 1e-999; + + double f1 = 0.5; + double f2 = 0.125; + double f31 = 0.1; + double f32 = 0.2; + double f33 = 0.3; + double f34 = 0.4; + double f35 = 0.5; + double f36 = 0.6; + double f37 = 0.7; + double f38 = 0.8; + double f39 = 0.9; + double f4 = 0.33333333333333333333333333333333333333333333333333333333333333333333333333333; + double f51 = 0.000000000000000000000000000000000000783475; + double f52 = 0.0000000000000000000000000000000000007834750; + double f53 = .00000000000000000000000000000000000078347500; + double f54 = 0.000000000000000000000000000000000000783475000000; + double f61 = 4.; + double f62 = 40.; + double f63 = 0.; + double f64 = 04.; + double f65 = .0; + double f66 = .004; + double f67 = .400; + double f68 = .04000; + + double c1 = .081e-2; + double c2 = .073e2; + double c3 = 34.5e-1; + double c4 = 35.7e-4; + double c5 = 43.9e1; + double c6 = 52.2e4; + double c7 = 000610000e2; + double c8 = 000610000e-6; + double c9 = 000001234567890123450000.0; + double c10 = 000999999999999999999000.0; + double c11 = 0001230000.0045600000; + double c12 = 0001230000.00405600000e-3; + double c13 = 0001230000.004500600000e-4; + double c14 = 00010230000.0045600000e-5; + double c15 = 000120030000.0045600000e4; + double c16 = 0001230000.0045600000e5; + double c17 = 0001230000.0045600000e6; + double c18 = 0001230000.00456007e6; + + double b11 = 72057594037927928.0; + double b12 = 72057594037927936.0; + double b13 = 72057594037927932.0; + double b14 = 7205759403792793199999e-5; + double b15 = 7205759403792793200001e-5; + double b21 = 9223372036854774784.0; + double b22 = 9223372036854775808.0; + double b23 = 9223372036854775296.0; + double b24 = 922337203685477529599999e-5; + double b25 = 922337203685477529600001e-5; + double b31 = 10141204801825834086073718800384.0; + double b32 = 10141204801825835211973625643008.0; + double b33 = 10141204801825834649023672221696.0; + double b34 = 1014120480182583464902367222169599999e-5; + double b35 = 1014120480182583464902367222169600001e-5; + double b41 = 5708990770823838890407843763683279797179383808.0; + double b42 = 5708990770823839524233143877797980545530986496.0; + double b43 = 5708990770823839207320493820740630171355185152.0; + double b44 = 5708990770823839207320493820740630171355185151999e-3; + double b45 = 5708990770823839207320493820740630171355185152001e-3; + + float pi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679f; + float pi2 = 3.14159265358979f; + float pi3 = 3.141592653589793f; + + double dpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679; + double dpi2 = 3.14159265358979; + double dpi3 = 3.141592653589793; + + float dfpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679f; + float dfpi2 = 3.14159265358979f; + float dfpi3 = 3.141592653589793f; + + double lfpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679LF; + double lfpi2 = 3.14159265358979Lf; + double lfpi3 = 3.141592653589793lF; + + double hfpi1 = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679hF; + double hfpi2 = 3.14159265358979hF; + double hfpi3 = 3.141592653589793hf; +} diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/tokenLength.vert b/3rdparty/bgfx/3rdparty/glslang/Test/tokenLength.vert index 691b104234b..21d446fae43 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/tokenLength.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/tokenLength.vert @@ -1,5 +1,5 @@ #version 300 es - +//#pragma glslang_binary_double_output // 1023 characters in float BCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789; diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/validate-shaders.sh b/3rdparty/bgfx/3rdparty/glslang/Test/validate-shaders.sh index 9211106225e..89dc95566ba 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/validate-shaders.sh +++ b/3rdparty/bgfx/3rdparty/glslang/Test/validate-shaders.sh @@ -7,7 +7,7 @@ declare -r EXE='../build/install/bin/glslangValidator' # search common locations for spirv-tools: keep first one -for toolsdir in '../External/spirv-tools/build/tools' '../../SPIRV-Tools/build/tools' '/usr/local/bin'; do +for toolsdir in '../External/spirv-tools/build/tools' '../../SPIRV-Tools/build/tools/bin' '/usr/local/bin'; do [[ -z "$VAL" && -x "${toolsdir}/spirv-val" ]] && declare -r VAL="${toolsdir}/spirv-val" [[ -z "$DIS" && -x "${toolsdir}/spirv-dis" ]] && declare -r DIS="${toolsdir}/spirv-dis" done diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.frag b/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.frag index 14c0c30168d..46c14f314c3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.frag +++ b/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.frag @@ -1,9 +1,9 @@ #version 450 -uniform sampler s; -uniform sampler sA[4]; -uniform texture2D t2d; -uniform texture3D t3d[4]; +uniform sampler s; // ERROR, no binding +uniform sampler sA[4]; // ERROR, no binding +uniform texture2D t2d; // ERROR, no binding +uniform texture3D t3d[4]; // ERROR, no binding int i; uniform samplerShadow sShadow; uniform texture3D t3d5[5]; @@ -21,14 +21,14 @@ void badConst() sampler3D[4](t3d5, sA[2]); // ERROR, can't make array sampler2D(i2d, s); // ERROR, image instead of texture sampler2D(t3d[1], s); // ERROR, 3D not 2D - sampler2D(t2d, sShadow); // ERROR, shadow mismatch - sampler2DShadow(t2d, s); // ERROR, shadow mismatch + sampler2D(t2d, sShadow); + sampler2DShadow(t2d, s); } sampler2D s2D = sampler2D(t2d, s); // ERROR, no sampler constructor sampler3D s3d[4] = sampler3D[4](t3d, sA[2]); // ERROR, no sampler constructor -out vec4 color; +out vec4 color; // ERROR, no location void main() { diff --git a/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.vert b/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.vert index e670e958d0e..a6af2d57da8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.vert +++ b/3rdparty/bgfx/3rdparty/glslang/Test/vulkan.vert @@ -61,3 +61,5 @@ out ban2 { layout(binding = 3000) uniform sampler2D s3000; layout(binding = 3001) uniform b3001 { int a; }; +layout(location = 10) in vec4 in1; +layout(location = 10) in vec4 in2; // ERROR, no location aliasing diff --git a/3rdparty/bgfx/3rdparty/glslang/build_overrides/glslang.gni b/3rdparty/bgfx/3rdparty/glslang/build_overrides/glslang.gni new file mode 100644 index 00000000000..500578ccd7c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/build_overrides/glslang.gni @@ -0,0 +1,37 @@ +# Copyright (C) 2018 Google, Inc. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +# These are variables that are overridable by projects that include glslang. + +# The path to glslang dependencies. +glslang_spirv_tools_dir = "//Externals/spirv-tools" diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/CMakeLists.txt b/3rdparty/bgfx/3rdparty/glslang/glslang/CMakeLists.txt index ac3973373ae..5f51476ba5d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/CMakeLists.txt +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/CMakeLists.txt @@ -9,6 +9,7 @@ endif(WIN32) set(SOURCES MachineIndependent/glslang.y MachineIndependent/glslang_tab.cpp + MachineIndependent/attribute.cpp MachineIndependent/Constant.cpp MachineIndependent/iomapper.cpp MachineIndependent/InfoSink.cpp @@ -51,6 +52,7 @@ set(HEADERS Include/revision.h Include/ShHandle.h Include/Types.h + MachineIndependent/attribute.h MachineIndependent/glslang_tab.cpp.h MachineIndependent/gl_types.h MachineIndependent/Initialize.h @@ -78,10 +80,18 @@ set(HEADERS # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) # set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp) -add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) +glslang_pch(SOURCES MachineIndependent/pch.cpp) + +add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) set_property(TARGET glslang PROPERTY FOLDER glslang) set_property(TARGET glslang PROPERTY POSITION_INDEPENDENT_CODE ON) target_link_libraries(glslang OGLCompiler OSDependent) +target_include_directories(glslang PUBLIC ..) + +if(WIN32 AND BUILD_SHARED_LIBS) + set_target_properties(glslang PROPERTIES PREFIX "") +endif() + if(ENABLE_HLSL) target_link_libraries(glslang HLSL) endif() @@ -95,8 +105,14 @@ if(WIN32) endif(WIN32) if(ENABLE_GLSLANG_INSTALL) - install(TARGETS glslang - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if(BUILD_SHARED_LIBS) + install(TARGETS glslang + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + else() + install(TARGETS glslang + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() endif(ENABLE_GLSLANG_INSTALL) if(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h index 0a46a7c0f06..fabd6135d77 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/BaseTypes.h @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -46,23 +47,25 @@ enum TBasicType { EbtVoid, EbtFloat, EbtDouble, -#ifdef AMD_EXTENSIONS EbtFloat16, -#endif + EbtInt8, + EbtUint8, + EbtInt16, + EbtUint16, EbtInt, EbtUint, EbtInt64, EbtUint64, -#ifdef AMD_EXTENSIONS - EbtInt16, - EbtUint16, -#endif EbtBool, EbtAtomicUint, EbtSampler, EbtStruct, EbtBlock, +#ifdef NV_EXTENSIONS + EbtAccStructNV, +#endif + // HLSL types that live only temporarily. EbtString, @@ -89,6 +92,14 @@ enum TStorageQualifier { EvqBuffer, // read/write, shared with app EvqShared, // compute shader's read/write 'shared' qualifier +#ifdef NV_EXTENSIONS + EvqPayloadNV, + EvqPayloadInNV, + EvqHitAttrNV, + EvqCallableDataNV, + EvqCallableDataInNV, +#endif + // parameters EvqIn, // also, for 'in' in the grammar before we know if it's a pipeline input or an 'in' parameter EvqOut, // also, for 'out' in the grammar before we know if it's a pipeline output or an 'out' parameter @@ -141,6 +152,8 @@ enum TBuiltInVariable { EbvLocalInvocationId, EbvGlobalInvocationId, EbvLocalInvocationIndex, + EbvNumSubgroups, + EbvSubgroupID, EbvSubGroupSize, EbvSubGroupInvocation, EbvSubGroupEqMask, @@ -148,6 +161,13 @@ enum TBuiltInVariable { EbvSubGroupGtMask, EbvSubGroupLeMask, EbvSubGroupLtMask, + EbvSubgroupSize2, + EbvSubgroupInvocation2, + EbvSubgroupEqMask2, + EbvSubgroupGeMask2, + EbvSubgroupGtMask2, + EbvSubgroupLeMask2, + EbvSubgroupLtMask2, EbvVertexId, EbvInstanceId, EbvVertexIndex, @@ -212,12 +232,43 @@ enum TBuiltInVariable { EbvViewIndex, EbvDeviceIndex, + EbvFragSizeEXT, + EbvFragInvocationCountEXT, + #ifdef NV_EXTENSIONS EbvViewportMaskNV, EbvSecondaryPositionNV, EbvSecondaryViewportMaskNV, EbvPositionPerViewNV, EbvViewportMaskPerViewNV, + EbvFragFullyCoveredNV, + EbvFragmentSizeNV, + EbvInvocationsPerPixelNV, + // raytracing + EbvLaunchIdNV, + EbvLaunchSizeNV, + EbvInstanceCustomIndexNV, + EbvWorldRayOriginNV, + EbvWorldRayDirectionNV, + EbvObjectRayOriginNV, + EbvObjectRayDirectionNV, + EbvRayTminNV, + EbvRayTmaxNV, + EbvHitTNV, + EbvHitKindNV, + EbvObjectToWorldNV, + EbvWorldToObjectNV, + EbvIncomingRayFlagsNV, + EbvBaryCoordNV, + EbvBaryCoordNoPerspNV, + EbvTaskCountNV, + EbvPrimitiveCountNV, + EbvPrimitiveIndicesNV, + EbvClipDistancePerViewNV, + EbvCullDistancePerViewNV, + EbvLayerPerViewNV, + EbvMeshViewCountNV, + EbvMeshViewIndicesNV, #endif // HLSL built-ins that live only temporarily, until they get remapped @@ -264,6 +315,13 @@ __inline const char* GetStorageQualifierString(TStorageQualifier q) case EvqPointCoord: return "gl_PointCoord"; break; case EvqFragColor: return "fragColor"; break; case EvqFragDepth: return "gl_FragDepth"; break; +#ifdef NV_EXTENSIONS + case EvqPayloadNV: return "rayPayloadNV"; break; + case EvqPayloadInNV: return "rayPayloadInNV"; break; + case EvqHitAttrNV: return "hitAttributeNV"; break; + case EvqCallableDataNV: return "callableDataNV"; break; + case EvqCallableDataInNV: return "callableDataInNV"; break; +#endif default: return "unknown qualifier"; } } @@ -349,12 +407,43 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvViewIndex: return "ViewIndex"; case EbvDeviceIndex: return "DeviceIndex"; + case EbvFragSizeEXT: return "FragSizeEXT"; + case EbvFragInvocationCountEXT: return "FragInvocationCountEXT"; + #ifdef NV_EXTENSIONS case EbvViewportMaskNV: return "ViewportMaskNV"; case EbvSecondaryPositionNV: return "SecondaryPositionNV"; case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; case EbvPositionPerViewNV: return "PositionPerViewNV"; case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV"; + case EbvFragFullyCoveredNV: return "FragFullyCoveredNV"; + case EbvFragmentSizeNV: return "FragmentSizeNV"; + case EbvInvocationsPerPixelNV: return "InvocationsPerPixelNV"; + case EbvLaunchIdNV: return "LaunchIdNV"; + case EbvLaunchSizeNV: return "LaunchSizeNV"; + case EbvInstanceCustomIndexNV: return "InstanceCustomIndexNV"; + case EbvWorldRayOriginNV: return "WorldRayOriginNV"; + case EbvWorldRayDirectionNV: return "WorldRayDirectionNV"; + case EbvObjectRayOriginNV: return "ObjectRayOriginNV"; + case EbvObjectRayDirectionNV: return "ObjectRayDirectionNV"; + case EbvRayTminNV: return "ObjectRayTminNV"; + case EbvRayTmaxNV: return "ObjectRayTmaxNV"; + case EbvHitTNV: return "HitTNV"; + case EbvHitKindNV: return "HitKindNV"; + case EbvIncomingRayFlagsNV: return "IncomingRayFlagsNV"; + case EbvObjectToWorldNV: return "ObjectToWorldNV"; + case EbvWorldToObjectNV: return "WorldToObjectNV"; + + case EbvBaryCoordNV: return "BaryCoordNV"; + case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspNV"; + case EbvTaskCountNV: return "TaskCountNV"; + case EbvPrimitiveCountNV: return "PrimitiveCountNV"; + case EbvPrimitiveIndicesNV: return "PrimitiveIndicesNV"; + case EbvClipDistancePerViewNV: return "ClipDistancePerViewNV"; + case EbvCullDistancePerViewNV: return "CullDistancePerViewNV"; + case EbvLayerPerViewNV: return "LayerPerViewNV"; + case EbvMeshViewCountNV: return "MeshViewCountNV"; + case EbvMeshViewIndicesNV: return "MeshViewIndicesNV"; #endif default: return "unknown built-in variable"; } @@ -371,7 +460,7 @@ enum TPrecisionQualifier { __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) { - switch(p) { + switch (p) { case EpqNone: return ""; break; case EpqLow: return "lowp"; break; case EpqMedium: return "mediump"; break; @@ -380,6 +469,75 @@ __inline const char* GetPrecisionQualifierString(TPrecisionQualifier p) } } +__inline bool isTypeSignedInt(TBasicType type) +{ + switch (type) { + case EbtInt8: + case EbtInt16: + case EbtInt: + case EbtInt64: + return true; + default: + return false; + } +} + +__inline bool isTypeUnsignedInt(TBasicType type) +{ + switch (type) { + case EbtUint8: + case EbtUint16: + case EbtUint: + case EbtUint64: + return true; + default: + return false; + } +} + +__inline bool isTypeInt(TBasicType type) +{ + return isTypeSignedInt(type) || isTypeUnsignedInt(type); +} + +__inline bool isTypeFloat(TBasicType type) +{ + switch (type) { + case EbtFloat: + case EbtDouble: + case EbtFloat16: + return true; + default: + return false; + } +} + +__inline int getTypeRank(TBasicType type) { + int res = -1; + switch(type) { + case EbtInt8: + case EbtUint8: + res = 0; + break; + case EbtInt16: + case EbtUint16: + res = 1; + break; + case EbtInt: + case EbtUint: + res = 2; + break; + case EbtInt64: + case EbtUint64: + res = 3; + break; + default: + assert(false); + break; + } + return res; +} + } // end namespace glslang #endif // _BASICTYPES_INCLUDED_ diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Common.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Common.h index c3814f0bf97..1402842c1f9 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Common.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Common.h @@ -37,9 +37,24 @@ #ifndef _COMMON_INCLUDED_ #define _COMMON_INCLUDED_ -#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) // || defined MINGW_HAS_SECURE_API +#include + +#if defined(__ANDROID__) +namespace std { +template +std::string to_string(const T& val) { + std::ostringstream os; + os << val; + return os.str(); +} +} +#endif + +#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API #include + #ifndef snprintf #define snprintf sprintf_s + #endif #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args)) #elif defined (solaris) #define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args)) @@ -51,31 +66,20 @@ #define UINT_PTR uintptr_t #endif -#if defined(__ANDROID__) || _MSC_VER < 1700 -#include -namespace std { -template -std::string to_string(const T& val) { - std::ostringstream os; - os << val; - return os.str(); -} -} -#endif - #if defined(_MSC_VER) && _MSC_VER < 1800 -inline long long int strtoll (const char* str, char** endptr, int base) -{ - return _strtoi64(str, endptr, base); -} -inline unsigned long long int strtoull (const char* str, char** endptr, int base) -{ - return _strtoui64(str, endptr, base); -} -inline long long int atoll (const char* str) -{ - return strtoll(str, NULL, 10); -} + #include + inline long long int strtoll (const char* str, char** endptr, int base) + { + return _strtoi64(str, endptr, base); + } + inline unsigned long long int strtoull (const char* str, char** endptr, int base) + { + return _strtoui64(str, endptr, base); + } + inline long long int atoll (const char* str) + { + return strtoll(str, NULL, 10); + } #endif #if defined(_MSC_VER) @@ -155,7 +159,7 @@ inline TString* NewPoolTString(const char* s) return new(memory) TString(s); } -template inline T* NewPoolObject(T) +template inline T* NewPoolObject(T*) { return new(GetThreadPoolAllocator().allocate(sizeof(T))) T; } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h index f66a7ff5192..3e933401518 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ConstantUnion.h @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -37,6 +38,9 @@ #ifndef _CONSTANT_UNION_INCLUDED_ #define _CONSTANT_UNION_INCLUDED_ +#include "../Include/Common.h" +#include "../Include/BaseTypes.h" + namespace glslang { class TConstUnion { @@ -45,6 +49,30 @@ public: TConstUnion() : iConst(0), type(EbtInt) { } + void setI8Const(signed char i) + { + i8Const = i; + type = EbtInt8; + } + + void setU8Const(unsigned char u) + { + u8Const = u; + type = EbtUint8; + } + + void setI16Const(signed short i) + { + i16Const = i; + type = EbtInt16; + } + + void setU16Const(unsigned short u) + { + u16Const = u; + type = EbtUint16; + } + void setIConst(int i) { iConst = i; @@ -87,6 +115,10 @@ public: type = EbtString; } + signed char getI8Const() const { return i8Const; } + unsigned char getU8Const() const { return u8Const; } + signed short getI16Const() const { return i16Const; } + unsigned short getU16Const() const { return u16Const; } int getIConst() const { return iConst; } unsigned int getUConst() const { return uConst; } long long getI64Const() const { return i64Const; } @@ -95,6 +127,38 @@ public: bool getBConst() const { return bConst; } const TString* getSConst() const { return sConst; } + bool operator==(const signed char i) const + { + if (i == i8Const) + return true; + + return false; + } + + bool operator==(const unsigned char u) const + { + if (u == u8Const) + return true; + + return false; + } + + bool operator==(const signed short i) const + { + if (i == i16Const) + return true; + + return false; + } + + bool operator==(const unsigned short u) const + { + if (u == u16Const) + return true; + + return false; + } + bool operator==(const int i) const { if (i == iConst) @@ -149,6 +213,26 @@ public: return false; switch (type) { + case EbtInt16: + if (constant.i16Const == i16Const) + return true; + + break; + case EbtUint16: + if (constant.u16Const == u16Const) + return true; + + break; + case EbtInt8: + if (constant.i8Const == i8Const) + return true; + + break; + case EbtUint8: + if (constant.u8Const == u8Const) + return true; + + break; case EbtInt: if (constant.iConst == iConst) return true; @@ -186,6 +270,26 @@ public: return false; } + bool operator!=(const signed char i) const + { + return !operator==(i); + } + + bool operator!=(const unsigned char u) const + { + return !operator==(u); + } + + bool operator!=(const signed short i) const + { + return !operator==(i); + } + + bool operator!=(const unsigned short u) const + { + return !operator==(u); + } + bool operator!=(const int i) const { return !operator==(i); @@ -225,6 +329,26 @@ public: { assert(type == constant.type); switch (type) { + case EbtInt8: + if (i8Const > constant.i8Const) + return true; + + return false; + case EbtUint8: + if (u8Const > constant.u8Const) + return true; + + return false; + case EbtInt16: + if (i16Const > constant.i16Const) + return true; + + return false; + case EbtUint16: + if (u16Const > constant.u16Const) + return true; + + return false; case EbtInt: if (iConst > constant.iConst) return true; @@ -260,6 +384,26 @@ public: { assert(type == constant.type); switch (type) { + case EbtInt8: + if (i8Const < constant.i8Const) + return true; + + return false; + case EbtUint8: + if (u8Const < constant.u8Const) + return true; + + return false; + case EbtInt16: + if (i16Const < constant.i16Const) + return true; + + return false; + case EbtUint16: + if (u16Const < constant.u16Const) + return true; + + return false; case EbtInt: if (iConst < constant.iConst) return true; @@ -296,9 +440,13 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const + constant.i8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const + constant.i16Const); break; + case EbtInt: returnValue.setIConst(iConst + constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const + constant.i64Const); break; + case EbtUint8: returnValue.setU8Const(u8Const + constant.u8Const); break; + case EbtUint16: returnValue.setU16Const(u16Const + constant.u16Const); break; + case EbtUint: returnValue.setUConst(uConst + constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const + constant.u64Const); break; case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break; default: assert(false && "Default missing"); @@ -312,9 +460,13 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const - constant.i8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const - constant.i16Const); break; + case EbtInt: returnValue.setIConst(iConst - constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const - constant.i64Const); break; + case EbtUint8: returnValue.setU8Const(u8Const - constant.u8Const); break; + case EbtUint16: returnValue.setU16Const(u16Const - constant.u16Const); break; + case EbtUint: returnValue.setUConst(uConst - constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const - constant.u64Const); break; case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break; default: assert(false && "Default missing"); @@ -328,9 +480,13 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const * constant.i8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const * constant.i16Const); break; + case EbtInt: returnValue.setIConst(iConst * constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const * constant.i64Const); break; + case EbtUint8: returnValue.setU8Const(u8Const * constant.u8Const); break; + case EbtUint16: returnValue.setU16Const(u16Const * constant.u16Const); break; + case EbtUint: returnValue.setUConst(uConst * constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const * constant.u64Const); break; case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break; default: assert(false && "Default missing"); @@ -344,9 +500,13 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; - case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; - case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const % constant.i8Const); break; + case EbtInt16: returnValue.setI8Const(i8Const % constant.i16Const); break; + case EbtInt: returnValue.setIConst(iConst % constant.iConst); break; + case EbtInt64: returnValue.setI64Const(i64Const % constant.i64Const); break; + case EbtUint8: returnValue.setU8Const(u8Const % constant.u8Const); break; + case EbtUint16: returnValue.setU16Const(u16Const % constant.u16Const); break; + case EbtUint: returnValue.setUConst(uConst % constant.uConst); break; case EbtUint64: returnValue.setU64Const(u64Const % constant.u64Const); break; default: assert(false && "Default missing"); } @@ -358,8 +518,64 @@ public: { TConstUnion returnValue; switch (type) { + case EbtInt8: + switch (constant.type) { + case EbtInt8: returnValue.setI8Const(i8Const >> constant.i8Const); break; + case EbtUint8: returnValue.setI8Const(i8Const >> constant.u8Const); break; + case EbtInt16: returnValue.setI8Const(i8Const >> constant.i16Const); break; + case EbtUint16: returnValue.setI8Const(i8Const >> constant.u16Const); break; + case EbtInt: returnValue.setI8Const(i8Const >> constant.iConst); break; + case EbtUint: returnValue.setI8Const(i8Const >> constant.uConst); break; + case EbtInt64: returnValue.setI8Const(i8Const >> constant.i64Const); break; + case EbtUint64: returnValue.setI8Const(i8Const >> constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtUint8: + switch (constant.type) { + case EbtInt8: returnValue.setU8Const(u8Const >> constant.i8Const); break; + case EbtUint8: returnValue.setU8Const(u8Const >> constant.u8Const); break; + case EbtInt16: returnValue.setU8Const(u8Const >> constant.i16Const); break; + case EbtUint16: returnValue.setU8Const(u8Const >> constant.u16Const); break; + case EbtInt: returnValue.setU8Const(u8Const >> constant.iConst); break; + case EbtUint: returnValue.setU8Const(u8Const >> constant.uConst); break; + case EbtInt64: returnValue.setU8Const(u8Const >> constant.i64Const); break; + case EbtUint64: returnValue.setU8Const(u8Const >> constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtInt16: + switch (constant.type) { + case EbtInt8: returnValue.setI16Const(i16Const >> constant.i8Const); break; + case EbtUint8: returnValue.setI16Const(i16Const >> constant.u8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const >> constant.i16Const); break; + case EbtUint16: returnValue.setI16Const(i16Const >> constant.u16Const); break; + case EbtInt: returnValue.setI16Const(i16Const >> constant.iConst); break; + case EbtUint: returnValue.setI16Const(i16Const >> constant.uConst); break; + case EbtInt64: returnValue.setI16Const(i16Const >> constant.i64Const); break; + case EbtUint64: returnValue.setI16Const(i16Const >> constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtUint16: + switch (constant.type) { + case EbtInt8: returnValue.setU16Const(u16Const >> constant.i8Const); break; + case EbtUint8: returnValue.setU16Const(u16Const >> constant.u8Const); break; + case EbtInt16: returnValue.setU16Const(u16Const >> constant.i16Const); break; + case EbtUint16: returnValue.setU16Const(u16Const >> constant.u16Const); break; + case EbtInt: returnValue.setU16Const(u16Const >> constant.iConst); break; + case EbtUint: returnValue.setU16Const(u16Const >> constant.uConst); break; + case EbtInt64: returnValue.setU16Const(u16Const >> constant.i64Const); break; + case EbtUint64: returnValue.setU16Const(u16Const >> constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; case EbtInt: switch (constant.type) { + case EbtInt8: returnValue.setIConst(iConst >> constant.i8Const); break; + case EbtUint8: returnValue.setIConst(iConst >> constant.u8Const); break; + case EbtInt16: returnValue.setIConst(iConst >> constant.i16Const); break; + case EbtUint16: returnValue.setIConst(iConst >> constant.u16Const); break; case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break; case EbtUint: returnValue.setIConst(iConst >> constant.uConst); break; case EbtInt64: returnValue.setIConst(iConst >> constant.i64Const); break; @@ -369,6 +585,10 @@ public: break; case EbtUint: switch (constant.type) { + case EbtInt8: returnValue.setUConst(uConst >> constant.i8Const); break; + case EbtUint8: returnValue.setUConst(uConst >> constant.u8Const); break; + case EbtInt16: returnValue.setUConst(uConst >> constant.i16Const); break; + case EbtUint16: returnValue.setUConst(uConst >> constant.u16Const); break; case EbtInt: returnValue.setUConst(uConst >> constant.iConst); break; case EbtUint: returnValue.setUConst(uConst >> constant.uConst); break; case EbtInt64: returnValue.setUConst(uConst >> constant.i64Const); break; @@ -378,6 +598,10 @@ public: break; case EbtInt64: switch (constant.type) { + case EbtInt8: returnValue.setI64Const(i64Const >> constant.i8Const); break; + case EbtUint8: returnValue.setI64Const(i64Const >> constant.u8Const); break; + case EbtInt16: returnValue.setI64Const(i64Const >> constant.i16Const); break; + case EbtUint16: returnValue.setI64Const(i64Const >> constant.u16Const); break; case EbtInt: returnValue.setI64Const(i64Const >> constant.iConst); break; case EbtUint: returnValue.setI64Const(i64Const >> constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const >> constant.i64Const); break; @@ -387,6 +611,10 @@ public: break; case EbtUint64: switch (constant.type) { + case EbtInt8: returnValue.setU64Const(u64Const >> constant.i8Const); break; + case EbtUint8: returnValue.setU64Const(u64Const >> constant.u8Const); break; + case EbtInt16: returnValue.setU64Const(u64Const >> constant.i16Const); break; + case EbtUint16: returnValue.setU64Const(u64Const >> constant.u16Const); break; case EbtInt: returnValue.setU64Const(u64Const >> constant.iConst); break; case EbtUint: returnValue.setU64Const(u64Const >> constant.uConst); break; case EbtInt64: returnValue.setU64Const(u64Const >> constant.i64Const); break; @@ -404,8 +632,64 @@ public: { TConstUnion returnValue; switch (type) { + case EbtInt8: + switch (constant.type) { + case EbtInt8: returnValue.setI8Const(i8Const << constant.i8Const); break; + case EbtUint8: returnValue.setI8Const(i8Const << constant.u8Const); break; + case EbtInt16: returnValue.setI8Const(i8Const << constant.i16Const); break; + case EbtUint16: returnValue.setI8Const(i8Const << constant.u16Const); break; + case EbtInt: returnValue.setI8Const(i8Const << constant.iConst); break; + case EbtUint: returnValue.setI8Const(i8Const << constant.uConst); break; + case EbtInt64: returnValue.setI8Const(i8Const << constant.i64Const); break; + case EbtUint64: returnValue.setI8Const(i8Const << constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtUint8: + switch (constant.type) { + case EbtInt8: returnValue.setU8Const(u8Const << constant.i8Const); break; + case EbtUint8: returnValue.setU8Const(u8Const << constant.u8Const); break; + case EbtInt16: returnValue.setU8Const(u8Const << constant.i16Const); break; + case EbtUint16: returnValue.setU8Const(u8Const << constant.u16Const); break; + case EbtInt: returnValue.setU8Const(u8Const << constant.iConst); break; + case EbtUint: returnValue.setU8Const(u8Const << constant.uConst); break; + case EbtInt64: returnValue.setU8Const(u8Const << constant.i64Const); break; + case EbtUint64: returnValue.setU8Const(u8Const << constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtInt16: + switch (constant.type) { + case EbtInt8: returnValue.setI16Const(i16Const << constant.i8Const); break; + case EbtUint8: returnValue.setI16Const(i16Const << constant.u8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const << constant.i16Const); break; + case EbtUint16: returnValue.setI16Const(i16Const << constant.u16Const); break; + case EbtInt: returnValue.setI16Const(i16Const << constant.iConst); break; + case EbtUint: returnValue.setI16Const(i16Const << constant.uConst); break; + case EbtInt64: returnValue.setI16Const(i16Const << constant.i64Const); break; + case EbtUint64: returnValue.setI16Const(i16Const << constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; + case EbtUint16: + switch (constant.type) { + case EbtInt8: returnValue.setU16Const(u16Const << constant.i8Const); break; + case EbtUint8: returnValue.setU16Const(u16Const << constant.u8Const); break; + case EbtInt16: returnValue.setU16Const(u16Const << constant.i16Const); break; + case EbtUint16: returnValue.setU16Const(u16Const << constant.u16Const); break; + case EbtInt: returnValue.setU16Const(u16Const << constant.iConst); break; + case EbtUint: returnValue.setU16Const(u16Const << constant.uConst); break; + case EbtInt64: returnValue.setU16Const(u16Const << constant.i64Const); break; + case EbtUint64: returnValue.setU16Const(u16Const << constant.u64Const); break; + default: assert(false && "Default missing"); + } + break; case EbtInt: switch (constant.type) { + case EbtInt8: returnValue.setIConst(iConst << constant.i8Const); break; + case EbtUint8: returnValue.setIConst(iConst << constant.u8Const); break; + case EbtInt16: returnValue.setIConst(iConst << constant.i16Const); break; + case EbtUint16: returnValue.setIConst(iConst << constant.u16Const); break; case EbtInt: returnValue.setIConst(iConst << constant.iConst); break; case EbtUint: returnValue.setIConst(iConst << constant.uConst); break; case EbtInt64: returnValue.setIConst(iConst << constant.i64Const); break; @@ -415,6 +699,10 @@ public: break; case EbtUint: switch (constant.type) { + case EbtInt8: returnValue.setUConst(uConst << constant.i8Const); break; + case EbtUint8: returnValue.setUConst(uConst << constant.u8Const); break; + case EbtInt16: returnValue.setUConst(uConst << constant.i16Const); break; + case EbtUint16: returnValue.setUConst(uConst << constant.u16Const); break; case EbtInt: returnValue.setUConst(uConst << constant.iConst); break; case EbtUint: returnValue.setUConst(uConst << constant.uConst); break; case EbtInt64: returnValue.setUConst(uConst << constant.i64Const); break; @@ -422,8 +710,12 @@ public: default: assert(false && "Default missing"); } break; - case EbtInt64: + case EbtInt64: switch (constant.type) { + case EbtInt8: returnValue.setI64Const(i64Const << constant.i8Const); break; + case EbtUint8: returnValue.setI64Const(i64Const << constant.u8Const); break; + case EbtInt16: returnValue.setI64Const(i64Const << constant.i16Const); break; + case EbtUint16: returnValue.setI64Const(i64Const << constant.u16Const); break; case EbtInt: returnValue.setI64Const(i64Const << constant.iConst); break; case EbtUint: returnValue.setI64Const(i64Const << constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const << constant.i64Const); break; @@ -433,6 +725,10 @@ public: break; case EbtUint64: switch (constant.type) { + case EbtInt8: returnValue.setU64Const(u64Const << constant.i8Const); break; + case EbtUint8: returnValue.setU64Const(u64Const << constant.u8Const); break; + case EbtInt16: returnValue.setU64Const(u64Const << constant.i16Const); break; + case EbtUint16: returnValue.setU64Const(u64Const << constant.u16Const); break; case EbtInt: returnValue.setU64Const(u64Const << constant.iConst); break; case EbtUint: returnValue.setU64Const(u64Const << constant.uConst); break; case EbtInt64: returnValue.setU64Const(u64Const << constant.i64Const); break; @@ -451,8 +747,12 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const & constant.i8Const); break; + case EbtUint8: returnValue.setU8Const(u8Const & constant.u8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const & constant.i16Const); break; + case EbtUint16: returnValue.setU16Const(u16Const & constant.u16Const); break; + case EbtInt: returnValue.setIConst(iConst & constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst & constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const & constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const & constant.u64Const); break; default: assert(false && "Default missing"); @@ -466,8 +766,12 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const | constant.i8Const); break; + case EbtUint8: returnValue.setU8Const(u8Const | constant.u8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const | constant.i16Const); break; + case EbtUint16: returnValue.setU16Const(u16Const | constant.u16Const); break; + case EbtInt: returnValue.setIConst(iConst | constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst | constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const | constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const | constant.u64Const); break; default: assert(false && "Default missing"); @@ -481,8 +785,12 @@ public: TConstUnion returnValue; assert(type == constant.type); switch (type) { - case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; - case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; + case EbtInt8: returnValue.setI8Const(i8Const ^ constant.i8Const); break; + case EbtUint8: returnValue.setU8Const(u8Const ^ constant.u8Const); break; + case EbtInt16: returnValue.setI16Const(i16Const ^ constant.i16Const); break; + case EbtUint16: returnValue.setU16Const(u16Const ^ constant.u16Const); break; + case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break; + case EbtUint: returnValue.setUConst(uConst ^ constant.uConst); break; case EbtInt64: returnValue.setI64Const(i64Const ^ constant.i64Const); break; case EbtUint64: returnValue.setU64Const(u64Const ^ constant.u64Const); break; default: assert(false && "Default missing"); @@ -495,8 +803,12 @@ public: { TConstUnion returnValue; switch (type) { - case EbtInt: returnValue.setIConst(~iConst); break; - case EbtUint: returnValue.setUConst(~uConst); break; + case EbtInt8: returnValue.setI8Const(~i8Const); break; + case EbtUint8: returnValue.setU8Const(~u8Const); break; + case EbtInt16: returnValue.setI16Const(~i16Const); break; + case EbtUint16: returnValue.setU16Const(~u16Const); break; + case EbtInt: returnValue.setIConst(~iConst); break; + case EbtUint: returnValue.setUConst(~uConst); break; case EbtInt64: returnValue.setI64Const(~i64Const); break; case EbtUint64: returnValue.setU64Const(~u64Const); break; default: assert(false && "Default missing"); @@ -533,6 +845,10 @@ public: private: union { + signed char i8Const; // used for i8vec, scalar int8s + unsigned char u8Const; // used for u8vec, scalar uint8s + signed short i16Const; // used for i16vec, scalar int16s + unsigned short u16Const; // used for u16vec, scalar uint16s int iConst; // used for ivec, scalar ints unsigned int uConst; // used for uvec, scalar uints long long i64Const; // used for i64vec, scalar int64s @@ -595,9 +911,6 @@ public: if (! unionArray || ! rhs.unionArray) return false; - if (! unionArray || ! rhs.unionArray) - return false; - return *unionArray == *rhs.unionArray; } bool operator!=(const TConstUnionArray& rhs) const { return ! operator==(rhs); } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ResourceLimits.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ResourceLimits.h index 0d07b8c841f..106b21d9ca8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ResourceLimits.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/ResourceLimits.h @@ -133,6 +133,15 @@ struct TBuiltInResource { int maxCullDistances; int maxCombinedClipAndCullDistances; int maxSamples; + int maxMeshOutputVerticesNV; + int maxMeshOutputPrimitivesNV; + int maxMeshWorkGroupSizeX_NV; + int maxMeshWorkGroupSizeY_NV; + int maxMeshWorkGroupSizeZ_NV; + int maxTaskWorkGroupSizeX_NV; + int maxTaskWorkGroupSizeY_NV; + int maxTaskWorkGroupSizeZ_NV; + int maxMeshViewCountNV; TLimits limits; }; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Types.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Types.h index b5b91f527ea..30fc8ce16ad 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Types.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/Types.h @@ -2,6 +2,7 @@ // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2016 LunarG, Inc. // Copyright (C) 2015-2016 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -204,9 +205,18 @@ struct TSampler { // misnomer now; includes images, textures without sampler, } switch (type) { - case EbtFloat: break; - case EbtInt: s.append("i"); break; - case EbtUint: s.append("u"); break; + case EbtFloat: break; +#ifdef AMD_EXTENSIONS + case EbtFloat16: s.append("f16"); break; +#endif + case EbtInt8: s.append("i8"); break; + case EbtUint16: s.append("u8"); break; + case EbtInt16: s.append("i16"); break; + case EbtUint8: s.append("u16"); break; + case EbtInt: s.append("i"); break; + case EbtUint: s.append("u"); break; + case EbtInt64: s.append("i64"); break; + case EbtUint64: s.append("u64"); break; default: break; // some compilers want this } if (image) { @@ -267,6 +277,7 @@ enum TLayoutPacking { ElpStd140, ElpStd430, ElpPacked, + ElpScalar, ElpCount // If expanding, see bitfield width below }; @@ -427,6 +438,7 @@ public: clearInterstage(); clearMemory(); specConstant = false; + nonUniform = false; clearLayout(); } @@ -445,12 +457,23 @@ public: nopersp = false; #ifdef AMD_EXTENSIONS explicitInterp = false; +#endif +#ifdef NV_EXTENSIONS + pervertexNV = false; + perPrimitiveNV = false; + perViewNV = false; + perTaskNV = false; #endif } void clearMemory() { coherent = false; + devicecoherent = false; + queuefamilycoherent = false; + workgroupcoherent = false; + subgroupcoherent = false; + nonprivate = false; volatil = false; restrict = false; readonly = false; @@ -460,7 +483,7 @@ public: // Drop just the storage qualification, which perhaps should // never be done, as it is fundamentally inconsistent, but need to // explore what downstream consumers need. - // E.g., in a deference, it is an inconsistency between: + // E.g., in a dereference, it is an inconsistency between: // A) partially dereferenced resource is still in the storage class it started in // B) partially dereferenced resource is a new temporary object // If A, then nothing should change, if B, then everything should change, but this is half way. @@ -468,6 +491,7 @@ public: { storage = EvqTemporary; specConstant = false; + nonUniform = false; } const char* semanticName; @@ -483,20 +507,37 @@ public: bool nopersp : 1; #ifdef AMD_EXTENSIONS bool explicitInterp : 1; +#endif +#ifdef NV_EXTENSIONS + bool pervertexNV : 1; + bool perPrimitiveNV : 1; + bool perViewNV : 1; + bool perTaskNV : 1; #endif bool patch : 1; bool sample : 1; bool coherent : 1; + bool devicecoherent : 1; + bool queuefamilycoherent : 1; + bool workgroupcoherent : 1; + bool subgroupcoherent : 1; + bool nonprivate : 1; bool volatil : 1; bool restrict : 1; bool readonly : 1; bool writeonly : 1; bool specConstant : 1; // having a constant_id is not sufficient: expressions have no id, but are still specConstant + bool nonUniform : 1; bool isMemory() const { - return coherent || volatil || restrict || readonly || writeonly; + return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly || nonprivate; } + bool isMemoryQualifierImageAndSSBOOnly() const + { + return subgroupcoherent || workgroupcoherent || queuefamilycoherent || devicecoherent || coherent || volatil || restrict || readonly || writeonly; + } + bool isInterpolation() const { #ifdef AMD_EXTENSIONS @@ -505,9 +546,21 @@ public: return flat || smooth || nopersp; #endif } + +#ifdef AMD_EXTENSIONS + bool isExplicitInterpolation() const + { + return explicitInterp; + } +#endif + bool isAuxiliary() const { +#ifdef NV_EXTENSIONS + return centroid || patch || sample || pervertexNV; +#else return centroid || patch || sample; +#endif } bool isPipeInput() const @@ -574,6 +627,33 @@ public: } } + bool isPerPrimitive() const + { +#ifdef NV_EXTENSIONS + return perPrimitiveNV; +#else + return false; +#endif + } + + bool isPerView() const + { +#ifdef NV_EXTENSIONS + return perViewNV; +#else + return false; +#endif + } + + bool isTaskMemory() const + { +#ifdef NV_EXTENSIONS + return perTaskNV; +#else + return false; +#endif + } + bool isIo() const { switch (storage) { @@ -597,6 +677,22 @@ public: } } + // non-built-in symbols that might link between compilation units + bool isLinkable() const + { + switch (storage) { + case EvqGlobal: + case EvqVaryingIn: + case EvqVaryingOut: + case EvqUniform: + case EvqBuffer: + case EvqShared: + return true; + default: + return false; + } + } + // True if this type of IO is supposed to be arrayed with extra level for per-vertex data bool isArrayedIo(EShLanguage language) const { @@ -607,6 +703,13 @@ public: return ! patch && (isPipeInput() || isPipeOutput()); case EShLangTessEvaluation: return ! patch && isPipeInput(); +#ifdef NV_EXTENSIONS + case EShLangFragment: + return pervertexNV && isPipeInput(); + case EShLangMeshNV: + return ! perTaskNV && isPipeOutput(); +#endif + default: return false; } @@ -623,6 +726,7 @@ public: layoutViewportRelative = false; // -2048 as the default value indicating layoutSecondaryViewportRelative is not set layoutSecondaryViewportRelativeOffset = -2048; + layoutShaderRecordNV = false; #endif clearInterstageLayout(); @@ -650,54 +754,61 @@ public: layoutXfbOffset = layoutXfbOffsetEnd; } - bool hasLayout() const + bool hasNonXfbLayout() const { return hasUniformLayout() || hasAnyLocation() || hasStream() || - hasXfb() || hasFormat() || +#ifdef NV_EXTENSIONS + layoutShaderRecordNV || +#endif layoutPushConstant; } + bool hasLayout() const + { + return hasNonXfbLayout() || + hasXfb(); + } TLayoutMatrix layoutMatrix : 3; TLayoutPacking layoutPacking : 4; int layoutOffset; int layoutAlign; - unsigned int layoutLocation :12; - static const unsigned int layoutLocationEnd = 0xFFF; + unsigned int layoutLocation : 12; + static const unsigned int layoutLocationEnd = 0xFFF; - unsigned int layoutComponent : 3; - static const unsigned int layoutComponentEnd = 4; + unsigned int layoutComponent : 3; + static const unsigned int layoutComponentEnd = 4; - unsigned int layoutSet : 7; - static const unsigned int layoutSetEnd = 0x3F; + unsigned int layoutSet : 7; + static const unsigned int layoutSetEnd = 0x3F; - unsigned int layoutBinding : 16; - static const unsigned int layoutBindingEnd = 0xFFFF; + unsigned int layoutBinding : 16; + static const unsigned int layoutBindingEnd = 0xFFFF; - unsigned int layoutIndex : 8; - static const unsigned int layoutIndexEnd = 0xFF; + unsigned int layoutIndex : 8; + static const unsigned int layoutIndexEnd = 0xFF; - unsigned int layoutStream : 8; - static const unsigned int layoutStreamEnd = 0xFF; + unsigned int layoutStream : 8; + static const unsigned int layoutStreamEnd = 0xFF; - unsigned int layoutXfbBuffer : 4; - static const unsigned int layoutXfbBufferEnd = 0xF; + unsigned int layoutXfbBuffer : 4; + static const unsigned int layoutXfbBufferEnd = 0xF; - unsigned int layoutXfbStride : 10; - static const unsigned int layoutXfbStrideEnd = 0x3FF; + unsigned int layoutXfbStride : 14; + static const unsigned int layoutXfbStrideEnd = 0x3FFF; - unsigned int layoutXfbOffset : 10; - static const unsigned int layoutXfbOffsetEnd = 0x3FF; + unsigned int layoutXfbOffset : 13; + static const unsigned int layoutXfbOffsetEnd = 0x1FFF; - unsigned int layoutAttachment : 8; // for input_attachment_index - static const unsigned int layoutAttachmentEnd = 0XFF; + unsigned int layoutAttachment : 8; // for input_attachment_index + static const unsigned int layoutAttachmentEnd = 0XFF; unsigned int layoutSpecConstantId : 11; static const unsigned int layoutSpecConstantIdEnd = 0x7FF; - TLayoutFormat layoutFormat : 8; + TLayoutFormat layoutFormat : 8; bool layoutPushConstant; @@ -705,6 +816,7 @@ public: bool layoutPassthrough; bool layoutViewportRelative; int layoutSecondaryViewportRelativeOffset; + bool layoutShaderRecordNV; #endif bool hasUniformLayout() const @@ -813,6 +925,10 @@ public: // true front-end constant. return specConstant; } + bool isNonUniform() const + { + return nonUniform; + } bool isFrontEndConstant() const { // True if the front-end knows the final constant value. @@ -836,6 +952,7 @@ public: case ElpShared: return "shared"; case ElpStd140: return "std140"; case ElpStd430: return "std430"; + case ElpScalar: return "scalar"; default: return "none"; } } @@ -978,7 +1095,7 @@ struct TShaderQualifiers { bool pixelCenterInteger; // fragment shader bool originUpperLeft; // fragment shader int invocations; - int vertices; // both for tessellation "vertices" and geometry "max_vertices" + int vertices; // for tessellation "vertices", geometry & mesh "max_vertices" TVertexSpacing spacing; TVertexOrder order; bool pointMode; @@ -991,7 +1108,10 @@ struct TShaderQualifiers { int numViews; // multiview extenstions #ifdef NV_EXTENSIONS - bool layoutOverrideCoverage; // true if layout override_coverage set + bool layoutOverrideCoverage; // true if layout override_coverage set + bool layoutDerivativeGroupQuads; // true if layout derivative_group_quadsNV set + bool layoutDerivativeGroupLinear; // true if layout derivative_group_linearNV set + int primitives; // mesh shader "max_primitives"DerivativeGroupLinear; // true if layout derivative_group_linearNV set #endif void init() @@ -1016,7 +1136,10 @@ struct TShaderQualifiers { blendEquation = false; numViews = TQualifier::layoutNotSet; #ifdef NV_EXTENSIONS - layoutOverrideCoverage = false; + layoutOverrideCoverage = false; + layoutDerivativeGroupQuads = false; + layoutDerivativeGroupLinear = false; + primitives = TQualifier::layoutNotSet; #endif } @@ -1061,6 +1184,12 @@ struct TShaderQualifiers { #ifdef NV_EXTENSIONS if (src.layoutOverrideCoverage) layoutOverrideCoverage = src.layoutOverrideCoverage; + if (src.layoutDerivativeGroupQuads) + layoutDerivativeGroupQuads = src.layoutDerivativeGroupQuads; + if (src.layoutDerivativeGroupLinear) + layoutDerivativeGroupLinear = src.layoutDerivativeGroupLinear; + if (src.primitives != TQualifier::layoutNotSet) + primitives = src.primitives; #endif } }; @@ -1152,6 +1281,7 @@ public: sampler.clear(); qualifier.clear(); qualifier.storage = q; + assert(!(isMatrix() && vectorSize != 0)); // prevent vectorSize != 0 on matrices } // for explicit precision qualifier TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0, @@ -1164,6 +1294,7 @@ public: qualifier.storage = q; qualifier.precision = p; assert(p >= EpqNone && p <= EpqHigh); + assert(!(isMatrix() && vectorSize != 0)); // prevent vectorSize != 0 on matrices } // for turning a TPublicType into a TType, using a shallow copy explicit TType(const TPublicType& p) : @@ -1293,31 +1424,9 @@ public: void makeVector() { vector1 = true; } - // Merge type from parent, where a parentType is at the beginning of a declaration, - // establishing some characteristics for all subsequent names, while this type - // is on the individual names. - void mergeType(const TPublicType& parentType) - { - // arrayness is currently the only child aspect that has to be preserved - basicType = parentType.basicType; - vectorSize = parentType.vectorSize; - matrixCols = parentType.matrixCols; - matrixRows = parentType.matrixRows; - vector1 = false; // TPublicType is only GLSL which so far has no vec1 - qualifier = parentType.qualifier; - sampler = parentType.sampler; - if (parentType.arraySizes) - newArraySizes(*parentType.arraySizes); - if (parentType.userDef) { - structure = parentType.userDef->getWritableStruct(); - setTypeName(parentType.userDef->getTypeName()); - } - } - virtual void hideMember() { basicType = EbtVoid; vectorSize = 1; } virtual bool hiddenMember() const { return basicType == EbtVoid; } - virtual void setTypeName(const TString& n) { typeName = NewPoolTString(n.c_str()); } virtual void setFieldName(const TString& n) { fieldName = NewPoolTString(n.c_str()); } virtual const TString& getTypeName() const { @@ -1347,33 +1456,31 @@ public: virtual bool isArrayOfArrays() const { return arraySizes != nullptr && arraySizes->getNumDims() > 1; } virtual int getImplicitArraySize() const { return arraySizes->getImplicitSize(); } virtual const TArraySizes* getArraySizes() const { return arraySizes; } - virtual TArraySizes& getArraySizes() { assert(arraySizes != nullptr); return *arraySizes; } + virtual TArraySizes* getArraySizes() { return arraySizes; } virtual bool isScalar() const { return ! isVector() && ! isMatrix() && ! isStruct() && ! isArray(); } virtual bool isScalarOrVec1() const { return isScalar() || vector1; } virtual bool isVector() const { return vectorSize > 1 || vector1; } virtual bool isMatrix() const { return matrixCols ? true : false; } virtual bool isArray() const { return arraySizes != nullptr; } - virtual bool isExplicitlySizedArray() const { return isArray() && getOuterArraySize() != UnsizedArraySize; } - virtual bool isImplicitlySizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage != EvqBuffer; } - virtual bool isRuntimeSizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage == EvqBuffer; } + virtual bool isSizedArray() const { return isArray() && arraySizes->isSized(); } + virtual bool isUnsizedArray() const { return isArray() && !arraySizes->isSized(); } + virtual bool isArrayVariablyIndexed() const { assert(isArray()); return arraySizes->isVariablyIndexed(); } + virtual void setArrayVariablyIndexed() { assert(isArray()); arraySizes->setVariablyIndexed(); } + virtual void updateImplicitArraySize(int size) { assert(isArray()); arraySizes->updateImplicitSize(size); } virtual bool isStruct() const { return structure != nullptr; } -#ifdef AMD_EXTENSIONS virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble || basicType == EbtFloat16; } -#else - virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble; } -#endif virtual bool isIntegerDomain() const { switch (basicType) { + case EbtInt8: + case EbtUint8: + case EbtInt16: + case EbtUint16: case EbtInt: case EbtUint: case EbtInt64: case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif case EbtAtomicUint: return true; default: @@ -1381,15 +1488,20 @@ public: } return false; } - virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint; } + virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint +#ifdef NV_EXTENSIONS + || basicType == EbtAccStructNV +#endif + ; } virtual bool isBuiltIn() const { return getQualifier().builtIn != EbvNone; } // "Image" is a superset of "Subpass" - virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } + virtual bool isImage() const { return basicType == EbtSampler && getSampler().isImage(); } virtual bool isSubpass() const { return basicType == EbtSampler && getSampler().isSubpass(); } + virtual bool isTexture() const { return basicType == EbtSampler && getSampler().isTexture(); } // return true if this type contains any subtype which satisfies the given predicate. - template + template bool contains(P predicate) const { if (predicate(this)) @@ -1418,10 +1530,10 @@ public: return contains([this](const TType* t) { return t != this && t->isStruct(); } ); } - // Recursively check the structure for any implicitly-sized arrays, needed for triggering a copyUp(). - virtual bool containsImplicitlySizedArray() const + // Recursively check the structure for any unsized arrays, needed for triggering a copyUp(). + virtual bool containsUnsizedArray() const { - return contains([](const TType* t) { return t->isImplicitlySizedArray(); } ); + return contains([](const TType* t) { return t->isUnsizedArray(); } ); } virtual bool containsOpaque() const @@ -1442,17 +1554,15 @@ public: case EbtVoid: case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif + case EbtInt8: + case EbtUint8: + case EbtInt16: + case EbtUint16: case EbtInt: case EbtUint: case EbtInt64: case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif case EbtBool: return true; default: @@ -1468,6 +1578,16 @@ public: return contains([](const TType* t) { return t->isArray() && t->arraySizes->isOuterSpecialization(); } ); } + virtual bool contains16BitInt() const + { + return containsBasicType(EbtInt16) || containsBasicType(EbtUint16); + } + + virtual bool contains8BitInt() const + { + return containsBasicType(EbtInt8) || containsBasicType(EbtUint8); + } + // Array editing methods. Array descriptors can be shared across // type instances. This allows all uses of the same array // to be updated at once. E.g., all nodes can be explicitly sized @@ -1487,34 +1607,56 @@ public: assert(type.arraySizes != nullptr); *arraySizes = *type.arraySizes; } - void newArraySizes(const TArraySizes& s) + void copyArraySizes(const TArraySizes& s) { // For setting a fresh new set of array sizes, not yet worrying about sharing. arraySizes = new TArraySizes; *arraySizes = s; } + void transferArraySizes(TArraySizes* s) + { + // For setting an already allocated set of sizes that this type can use + // (no copy made). + arraySizes = s; + } void clearArraySizes() { - arraySizes = 0; + arraySizes = nullptr; } - void addArrayOuterSizes(const TArraySizes& s) + + // Add inner array sizes, to any existing sizes, via copy; the + // sizes passed in can still be reused for other purposes. + void copyArrayInnerSizes(const TArraySizes* s) { - if (arraySizes == nullptr) - newArraySizes(s); - else - arraySizes->addOuterSizes(s); + if (s != nullptr) { + if (arraySizes == nullptr) + copyArraySizes(*s); + else + arraySizes->addInnerSizes(*s); + } } void changeOuterArraySize(int s) { arraySizes->changeOuterSize(s); } - void setImplicitArraySize(int s) { arraySizes->setImplicitSize(s); } - // Recursively make the implicit array size the explicit array size, through the type tree. - void adoptImplicitArraySizes() + // Recursively make the implicit array size the explicit array size. + // Expicit arrays are compile-time or link-time sized, never run-time sized. + // Sometimes, policy calls for an array to be run-time sized even if it was + // never variably indexed: Don't turn a 'skipNonvariablyIndexed' array into + // an explicit array. + void adoptImplicitArraySizes(bool skipNonvariablyIndexed) { - if (isImplicitlySizedArray()) + if (isUnsizedArray() && !(skipNonvariablyIndexed || isArrayVariablyIndexed())) changeOuterArraySize(getImplicitArraySize()); - if (isStruct()) { - for (int i = 0; i < (int)structure->size(); ++i) - (*structure)[i].type->adoptImplicitArraySizes(); +#ifdef NV_EXTENSIONS + // For multi-dim per-view arrays, set unsized inner dimension size to 1 + if (qualifier.isPerView() && arraySizes && arraySizes->isInnerUnsized()) + arraySizes->clearInnerUnsized(); +#endif + if (isStruct() && structure->size() > 0) { + int lastMember = (int)structure->size() - 1; + for (int i = 0; i < lastMember; ++i) + (*structure)[i].type->adoptImplicitArraySizes(false); + // implement the "last member of an SSBO" policy + (*structure)[lastMember].type->adoptImplicitArraySizes(getQualifier().storage == EvqBuffer); } } @@ -1529,22 +1671,23 @@ public: case EbtVoid: return "void"; case EbtFloat: return "float"; case EbtDouble: return "double"; -#ifdef AMD_EXTENSIONS case EbtFloat16: return "float16_t"; -#endif + case EbtInt8: return "int8_t"; + case EbtUint8: return "uint8_t"; + case EbtInt16: return "int16_t"; + case EbtUint16: return "uint16_t"; case EbtInt: return "int"; case EbtUint: return "uint"; case EbtInt64: return "int64_t"; case EbtUint64: return "uint64_t"; -#ifdef AMD_EXTENSIONS - case EbtInt16: return "int16_t"; - case EbtUint16: return "uint16_t"; -#endif case EbtBool: return "bool"; case EbtAtomicUint: return "atomic_uint"; case EbtSampler: return "sampler/image"; case EbtStruct: return "structure"; case EbtBlock: return "block"; +#ifdef NV_EXTENSIONS + case EbtAccStructNV: return "accelerationStructureNV"; +#endif default: return "unknown type"; } } @@ -1640,6 +1783,8 @@ public: appendStr(" layoutSecondaryViewportRelativeOffset="); appendInt(qualifier.layoutSecondaryViewportRelativeOffset); } + if (qualifier.layoutShaderRecordNV) + appendStr(" shaderRecordNV"); #endif appendStr(")"); @@ -1661,6 +1806,16 @@ public: #ifdef AMD_EXTENSIONS if (qualifier.explicitInterp) appendStr(" __explicitInterpAMD"); +#endif +#ifdef NV_EXTENSIONS + if (qualifier.pervertexNV) + appendStr(" pervertexNV"); + if (qualifier.perPrimitiveNV) + appendStr(" perprimitiveNV"); + if (qualifier.perViewNV) + appendStr(" perviewNV"); + if (qualifier.perTaskNV) + appendStr(" taskNV"); #endif if (qualifier.patch) appendStr(" patch"); @@ -1668,6 +1823,16 @@ public: appendStr(" sample"); if (qualifier.coherent) appendStr(" coherent"); + if (qualifier.devicecoherent) + appendStr(" devicecoherent"); + if (qualifier.queuefamilycoherent) + appendStr(" queuefamilycoherent"); + if (qualifier.workgroupcoherent) + appendStr(" workgroupcoherent"); + if (qualifier.subgroupcoherent) + appendStr(" subgroupcoherent"); + if (qualifier.nonprivate) + appendStr(" nonprivate"); if (qualifier.volatil) appendStr(" volatile"); if (qualifier.restrict) @@ -1678,16 +1843,26 @@ public: appendStr(" writeonly"); if (qualifier.specConstant) appendStr(" specialization-constant"); + if (qualifier.nonUniform) + appendStr(" nonuniform"); appendStr(" "); appendStr(getStorageQualifierString()); if (isArray()) { for(int i = 0; i < (int)arraySizes->getNumDims(); ++i) { int size = arraySizes->getDimSize(i); - if (size == 0) - appendStr(" implicitly-sized array of"); + if (size == UnsizedArraySize && i == 0 && arraySizes->isVariablyIndexed()) + appendStr(" runtime-sized array of"); else { - appendStr(" "); - appendInt(arraySizes->getDimSize(i)); + if (size == UnsizedArraySize) { + appendStr(" unsized"); + if (i == 0) { + appendStr(" "); + appendInt(arraySizes->getImplicitSize()); + } + } else { + appendStr(" "); + appendInt(arraySizes->getDimSize(i)); + } appendStr("-element array of"); } } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/arrays.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/arrays.h index 1660a99f9c2..af8f560b3b2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/arrays.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/arrays.h @@ -41,6 +41,8 @@ #ifndef _ARRAYS_INCLUDED #define _ARRAYS_INCLUDED +#include + namespace glslang { // This is used to mean there is no size yet (unsized), it is waiting to get a size from somewhere else. @@ -130,10 +132,10 @@ struct TSmallArrayVector { sizes->push_back(pair); } - void push_front(const TSmallArrayVector& newDims) + void push_back(const TSmallArrayVector& newDims) { alloc(); - sizes->insert(sizes->begin(), newDims.sizes->begin(), newDims.sizes->end()); + sizes->insert(sizes->end(), newDims.sizes->begin(), newDims.sizes->end()); } void pop_front() @@ -220,12 +222,13 @@ protected: struct TArraySizes { POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) - TArraySizes() : implicitArraySize(1) { } + TArraySizes() : implicitArraySize(1), variablyIndexed(false) { } // For breaking into two non-shared copies, independently modifiable. TArraySizes& operator=(const TArraySizes& from) { implicitArraySize = from.implicitArraySize; + variablyIndexed = from.variablyIndexed; sizes = from.sizes; return *this; @@ -252,10 +255,11 @@ struct TArraySizes { void addInnerSize(int s) { addInnerSize((unsigned)s, nullptr); } void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); } void addInnerSize(TArraySize pair) { sizes.push_back(pair.size, pair.node); } + void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); } void changeOuterSize(int s) { sizes.changeFront((unsigned)s); } - int getImplicitSize() const { return (int)implicitArraySize; } - void setImplicitSize(int s) { implicitArraySize = s; } - bool isInnerImplicit() const + int getImplicitSize() const { return implicitArraySize; } + void updateImplicitSize(int s) { implicitArraySize = std::max(implicitArraySize, s); } + bool isInnerUnsized() const { for (int d = 1; d < sizes.size(); ++d) { if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize) @@ -264,7 +268,7 @@ struct TArraySizes { return false; } - bool clearInnerImplicit() + bool clearInnerUnsized() { for (int d = 1; d < sizes.size(); ++d) { if (sizes.getDimSize(d) == (unsigned)UnsizedArraySize) @@ -287,8 +291,8 @@ struct TArraySizes { return sizes.getDimNode(0) != nullptr; } - bool isImplicit() const { return getOuterSize() == UnsizedArraySize || isInnerImplicit(); } - void addOuterSizes(const TArraySizes& s) { sizes.push_front(s.sizes); } + bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); } + bool isSized() const { return getOuterSize() != UnsizedArraySize; } void dereference() { sizes.pop_front(); } void copyDereferenced(const TArraySizes& rhs) { @@ -311,6 +315,9 @@ struct TArraySizes { return true; } + void setVariablyIndexed() { variablyIndexed = true; } + bool isVariablyIndexed() const { return variablyIndexed; } + bool operator==(const TArraySizes& rhs) { return sizes == rhs.sizes; } bool operator!=(const TArraySizes& rhs) { return sizes != rhs.sizes; } @@ -319,9 +326,12 @@ protected: TArraySizes(const TArraySizes&); - // for tracking maximum referenced index, before an explicit size is given - // applies only to the outer-most dimension + // For tracking maximum referenced compile-time constant index. + // Applies only to the outer-most dimension. Potentially becomes + // the implicit size of the array, if not variably indexed and + // otherwise legal. int implicitArraySize; + bool variablyIndexed; // true if array is indexed with a non compile-time constant }; } // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/intermediate.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/intermediate.h index 4a28e35672d..27250070c25 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/intermediate.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/intermediate.h @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2016 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -46,7 +47,7 @@ #ifndef __INTERMEDIATE_H #define __INTERMEDIATE_H -#if _MSC_VER >= 1900 +#if defined(_MSC_VER) && _MSC_VER >= 1900 #pragma warning(disable : 4464) // relative include path contains '..' #pragma warning(disable : 5026) // 'glslang::TIntermUnary': move constructor was implicitly defined as deleted #endif @@ -84,100 +85,189 @@ enum TOperator { EOpPreIncrement, EOpPreDecrement, + // (u)int* -> bool + EOpConvInt8ToBool, + EOpConvUint8ToBool, + EOpConvInt16ToBool, + EOpConvUint16ToBool, EOpConvIntToBool, EOpConvUintToBool, - EOpConvFloatToBool, - EOpConvDoubleToBool, EOpConvInt64ToBool, EOpConvUint64ToBool, - EOpConvBoolToFloat, - EOpConvIntToFloat, - EOpConvUintToFloat, - EOpConvDoubleToFloat, - EOpConvInt64ToFloat, - EOpConvUint64ToFloat, - EOpConvUintToInt, - EOpConvFloatToInt, - EOpConvBoolToInt, - EOpConvDoubleToInt, - EOpConvInt64ToInt, - EOpConvUint64ToInt, - EOpConvIntToUint, - EOpConvFloatToUint, - EOpConvBoolToUint, - EOpConvDoubleToUint, - EOpConvInt64ToUint, - EOpConvUint64ToUint, - EOpConvIntToDouble, - EOpConvUintToDouble, - EOpConvFloatToDouble, - EOpConvBoolToDouble, - EOpConvInt64ToDouble, - EOpConvUint64ToDouble, - EOpConvBoolToInt64, - EOpConvIntToInt64, - EOpConvUintToInt64, - EOpConvFloatToInt64, - EOpConvDoubleToInt64, - EOpConvUint64ToInt64, - EOpConvBoolToUint64, - EOpConvIntToUint64, - EOpConvUintToUint64, - EOpConvFloatToUint64, - EOpConvDoubleToUint64, - EOpConvInt64ToUint64, -#ifdef AMD_EXTENSIONS - EOpConvBoolToFloat16, - EOpConvIntToFloat16, - EOpConvUintToFloat16, - EOpConvFloatToFloat16, - EOpConvDoubleToFloat16, - EOpConvInt64ToFloat16, - EOpConvUint64ToFloat16, - EOpConvFloat16ToBool, - EOpConvFloat16ToInt, - EOpConvFloat16ToUint, - EOpConvFloat16ToFloat, - EOpConvFloat16ToDouble, - EOpConvFloat16ToInt64, - EOpConvFloat16ToUint64, + // float* -> bool + EOpConvFloat16ToBool, + EOpConvFloatToBool, + EOpConvDoubleToBool, + + // bool -> (u)int* + EOpConvBoolToInt8, + EOpConvBoolToUint8, EOpConvBoolToInt16, - EOpConvIntToInt16, - EOpConvUintToInt16, - EOpConvFloatToInt16, - EOpConvDoubleToInt16, - EOpConvFloat16ToInt16, - EOpConvInt64ToInt16, - EOpConvUint64ToInt16, - EOpConvUint16ToInt16, - EOpConvInt16ToBool, + EOpConvBoolToUint16, + EOpConvBoolToInt, + EOpConvBoolToUint, + EOpConvBoolToInt64, + EOpConvBoolToUint64, + + // bool -> float* + EOpConvBoolToFloat16, + EOpConvBoolToFloat, + EOpConvBoolToDouble, + + // int8_t -> (u)int* + EOpConvInt8ToInt16, + EOpConvInt8ToInt, + EOpConvInt8ToInt64, + EOpConvInt8ToUint8, + EOpConvInt8ToUint16, + EOpConvInt8ToUint, + EOpConvInt8ToUint64, + + // uint8_t -> (u)int* + EOpConvUint8ToInt8, + EOpConvUint8ToInt16, + EOpConvUint8ToInt, + EOpConvUint8ToInt64, + EOpConvUint8ToUint16, + EOpConvUint8ToUint, + EOpConvUint8ToUint64, + + // int8_t -> float* + EOpConvInt8ToFloat16, + EOpConvInt8ToFloat, + EOpConvInt8ToDouble, + + // uint8_t -> float* + EOpConvUint8ToFloat16, + EOpConvUint8ToFloat, + EOpConvUint8ToDouble, + + // int16_t -> (u)int* + EOpConvInt16ToInt8, EOpConvInt16ToInt, - EOpConvInt16ToUint, - EOpConvInt16ToFloat, - EOpConvInt16ToDouble, - EOpConvInt16ToFloat16, EOpConvInt16ToInt64, + EOpConvInt16ToUint8, + EOpConvInt16ToUint16, + EOpConvInt16ToUint, EOpConvInt16ToUint64, - EOpConvBoolToUint16, - EOpConvIntToUint16, - EOpConvUintToUint16, - EOpConvFloatToUint16, - EOpConvDoubleToUint16, - EOpConvFloat16ToUint16, - EOpConvInt64ToUint16, - EOpConvUint64ToUint16, - EOpConvInt16ToUint16, - EOpConvUint16ToBool, + // uint16_t -> (u)int* + EOpConvUint16ToInt8, + EOpConvUint16ToInt16, EOpConvUint16ToInt, + EOpConvUint16ToInt64, + EOpConvUint16ToUint8, EOpConvUint16ToUint, + EOpConvUint16ToUint64, + + // int16_t -> float* + EOpConvInt16ToFloat16, + EOpConvInt16ToFloat, + EOpConvInt16ToDouble, + + // uint16_t -> float* + EOpConvUint16ToFloat16, EOpConvUint16ToFloat, EOpConvUint16ToDouble, - EOpConvUint16ToFloat16, - EOpConvUint16ToInt64, - EOpConvUint16ToUint64, -#endif + + // int32_t -> (u)int* + EOpConvIntToInt8, + EOpConvIntToInt16, + EOpConvIntToInt64, + EOpConvIntToUint8, + EOpConvIntToUint16, + EOpConvIntToUint, + EOpConvIntToUint64, + + // uint32_t -> (u)int* + EOpConvUintToInt8, + EOpConvUintToInt16, + EOpConvUintToInt, + EOpConvUintToInt64, + EOpConvUintToUint8, + EOpConvUintToUint16, + EOpConvUintToUint64, + + // int32_t -> float* + EOpConvIntToFloat16, + EOpConvIntToFloat, + EOpConvIntToDouble, + + // uint32_t -> float* + EOpConvUintToFloat16, + EOpConvUintToFloat, + EOpConvUintToDouble, + + // int64_t -> (u)int* + EOpConvInt64ToInt8, + EOpConvInt64ToInt16, + EOpConvInt64ToInt, + EOpConvInt64ToUint8, + EOpConvInt64ToUint16, + EOpConvInt64ToUint, + EOpConvInt64ToUint64, + + // uint64_t -> (u)int* + EOpConvUint64ToInt8, + EOpConvUint64ToInt16, + EOpConvUint64ToInt, + EOpConvUint64ToInt64, + EOpConvUint64ToUint8, + EOpConvUint64ToUint16, + EOpConvUint64ToUint, + + // int64_t -> float* + EOpConvInt64ToFloat16, + EOpConvInt64ToFloat, + EOpConvInt64ToDouble, + + // uint64_t -> float* + EOpConvUint64ToFloat16, + EOpConvUint64ToFloat, + EOpConvUint64ToDouble, + + // float16_t -> (u)int* + EOpConvFloat16ToInt8, + EOpConvFloat16ToInt16, + EOpConvFloat16ToInt, + EOpConvFloat16ToInt64, + EOpConvFloat16ToUint8, + EOpConvFloat16ToUint16, + EOpConvFloat16ToUint, + EOpConvFloat16ToUint64, + + // float16_t -> float* + EOpConvFloat16ToFloat, + EOpConvFloat16ToDouble, + + // float -> (u)int* + EOpConvFloatToInt8, + EOpConvFloatToInt16, + EOpConvFloatToInt, + EOpConvFloatToInt64, + EOpConvFloatToUint8, + EOpConvFloatToUint16, + EOpConvFloatToUint, + EOpConvFloatToUint64, + + // float -> float* + EOpConvFloatToFloat16, + EOpConvFloatToDouble, + + // float64 _t-> (u)int* + EOpConvDoubleToInt8, + EOpConvDoubleToInt16, + EOpConvDoubleToInt, + EOpConvDoubleToInt64, + EOpConvDoubleToUint8, + EOpConvDoubleToUint16, + EOpConvDoubleToUint, + EOpConvDoubleToUint64, + + // float64_t -> float* + EOpConvDoubleToFloat16, + EOpConvDoubleToFloat, // // binary operations @@ -280,12 +370,10 @@ enum TOperator { EOpDoubleBitsToUint64, EOpInt64BitsToDouble, EOpUint64BitsToDouble, -#ifdef AMD_EXTENSIONS EOpFloat16BitsToInt16, EOpFloat16BitsToUint16, EOpInt16BitsToFloat16, EOpUint16BitsToFloat16, -#endif EOpPackSnorm2x16, EOpUnpackSnorm2x16, EOpPackUnorm2x16, @@ -302,7 +390,6 @@ enum TOperator { EOpUnpackInt2x32, EOpPackUint2x32, EOpUnpackUint2x32, -#ifdef AMD_EXTENSIONS EOpPackFloat2x16, EOpUnpackFloat2x16, EOpPackInt2x16, @@ -313,7 +400,12 @@ enum TOperator { EOpUnpackInt4x16, EOpPackUint4x16, EOpUnpackUint4x16, -#endif + EOpPack16, + EOpPack32, + EOpPack64, + EOpUnpack32, + EOpUnpack16, + EOpUnpack8, EOpLength, EOpDistance, @@ -379,6 +471,90 @@ enum TOperator { EOpAllInvocations, EOpAllInvocationsEqual, + EOpSubgroupGuardStart, + EOpSubgroupBarrier, + EOpSubgroupMemoryBarrier, + EOpSubgroupMemoryBarrierBuffer, + EOpSubgroupMemoryBarrierImage, + EOpSubgroupMemoryBarrierShared, // compute only + EOpSubgroupElect, + EOpSubgroupAll, + EOpSubgroupAny, + EOpSubgroupAllEqual, + EOpSubgroupBroadcast, + EOpSubgroupBroadcastFirst, + EOpSubgroupBallot, + EOpSubgroupInverseBallot, + EOpSubgroupBallotBitExtract, + EOpSubgroupBallotBitCount, + EOpSubgroupBallotInclusiveBitCount, + EOpSubgroupBallotExclusiveBitCount, + EOpSubgroupBallotFindLSB, + EOpSubgroupBallotFindMSB, + EOpSubgroupShuffle, + EOpSubgroupShuffleXor, + EOpSubgroupShuffleUp, + EOpSubgroupShuffleDown, + EOpSubgroupAdd, + EOpSubgroupMul, + EOpSubgroupMin, + EOpSubgroupMax, + EOpSubgroupAnd, + EOpSubgroupOr, + EOpSubgroupXor, + EOpSubgroupInclusiveAdd, + EOpSubgroupInclusiveMul, + EOpSubgroupInclusiveMin, + EOpSubgroupInclusiveMax, + EOpSubgroupInclusiveAnd, + EOpSubgroupInclusiveOr, + EOpSubgroupInclusiveXor, + EOpSubgroupExclusiveAdd, + EOpSubgroupExclusiveMul, + EOpSubgroupExclusiveMin, + EOpSubgroupExclusiveMax, + EOpSubgroupExclusiveAnd, + EOpSubgroupExclusiveOr, + EOpSubgroupExclusiveXor, + EOpSubgroupClusteredAdd, + EOpSubgroupClusteredMul, + EOpSubgroupClusteredMin, + EOpSubgroupClusteredMax, + EOpSubgroupClusteredAnd, + EOpSubgroupClusteredOr, + EOpSubgroupClusteredXor, + EOpSubgroupQuadBroadcast, + EOpSubgroupQuadSwapHorizontal, + EOpSubgroupQuadSwapVertical, + EOpSubgroupQuadSwapDiagonal, + +#ifdef NV_EXTENSIONS + EOpSubgroupPartition, + EOpSubgroupPartitionedAdd, + EOpSubgroupPartitionedMul, + EOpSubgroupPartitionedMin, + EOpSubgroupPartitionedMax, + EOpSubgroupPartitionedAnd, + EOpSubgroupPartitionedOr, + EOpSubgroupPartitionedXor, + EOpSubgroupPartitionedInclusiveAdd, + EOpSubgroupPartitionedInclusiveMul, + EOpSubgroupPartitionedInclusiveMin, + EOpSubgroupPartitionedInclusiveMax, + EOpSubgroupPartitionedInclusiveAnd, + EOpSubgroupPartitionedInclusiveOr, + EOpSubgroupPartitionedInclusiveXor, + EOpSubgroupPartitionedExclusiveAdd, + EOpSubgroupPartitionedExclusiveMul, + EOpSubgroupPartitionedExclusiveMin, + EOpSubgroupPartitionedExclusiveMax, + EOpSubgroupPartitionedExclusiveAnd, + EOpSubgroupPartitionedExclusiveOr, + EOpSubgroupPartitionedExclusiveXor, +#endif + + EOpSubgroupGuardStop, + #ifdef AMD_EXTENSIONS EOpMinInvocations, EOpMaxInvocations, @@ -416,6 +592,8 @@ enum TOperator { EOpAtomicXor, EOpAtomicExchange, EOpAtomicCompSwap, + EOpAtomicLoad, + EOpAtomicStore, EOpAtomicCounterIncrement, // results in pre-increment value EOpAtomicCounterDecrement, // results in post-decrement value @@ -451,32 +629,36 @@ enum TOperator { EOpConstructGuardStart, EOpConstructInt, // these first scalar forms also identify what implicit conversion is needed EOpConstructUint, - EOpConstructInt64, - EOpConstructUint64, -#ifdef AMD_EXTENSIONS + EOpConstructInt8, + EOpConstructUint8, EOpConstructInt16, EOpConstructUint16, -#endif + EOpConstructInt64, + EOpConstructUint64, EOpConstructBool, EOpConstructFloat, EOpConstructDouble, -#ifdef AMD_EXTENSIONS - EOpConstructFloat16, -#endif EOpConstructVec2, EOpConstructVec3, EOpConstructVec4, EOpConstructDVec2, EOpConstructDVec3, EOpConstructDVec4, -#ifdef AMD_EXTENSIONS - EOpConstructF16Vec2, - EOpConstructF16Vec3, - EOpConstructF16Vec4, -#endif EOpConstructBVec2, EOpConstructBVec3, EOpConstructBVec4, + EOpConstructI8Vec2, + EOpConstructI8Vec3, + EOpConstructI8Vec4, + EOpConstructU8Vec2, + EOpConstructU8Vec3, + EOpConstructU8Vec4, + EOpConstructI16Vec2, + EOpConstructI16Vec3, + EOpConstructI16Vec4, + EOpConstructU16Vec2, + EOpConstructU16Vec3, + EOpConstructU16Vec4, EOpConstructIVec2, EOpConstructIVec3, EOpConstructIVec4, @@ -489,14 +671,6 @@ enum TOperator { EOpConstructU64Vec2, EOpConstructU64Vec3, EOpConstructU64Vec4, -#ifdef AMD_EXTENSIONS - EOpConstructI16Vec2, - EOpConstructI16Vec3, - EOpConstructI16Vec4, - EOpConstructU16Vec2, - EOpConstructU16Vec3, - EOpConstructU16Vec4, -#endif EOpConstructMat2x2, EOpConstructMat2x3, EOpConstructMat2x4, @@ -542,7 +716,10 @@ enum TOperator { EOpConstructBMat4x2, EOpConstructBMat4x3, EOpConstructBMat4x4, -#ifdef AMD_EXTENSIONS + EOpConstructFloat16, + EOpConstructF16Vec2, + EOpConstructF16Vec3, + EOpConstructF16Vec4, EOpConstructF16Mat2x2, EOpConstructF16Mat2x3, EOpConstructF16Mat2x4, @@ -552,9 +729,9 @@ enum TOperator { EOpConstructF16Mat4x2, EOpConstructF16Mat4x3, EOpConstructF16Mat4x4, -#endif EOpConstructStruct, EOpConstructTextureSampler, + EOpConstructNonuniform, // expected to be transformed away, not present in final AST EOpConstructGuardEnd, // @@ -581,7 +758,11 @@ enum TOperator { // Array operators // - EOpArrayLength, // "Array" distinguishes from length(v) built-in function, but it applies to vectors and matrices as well. + // Can apply to arrays, vectors, or matrices. + // Can be decomposed to a constant at compile time, but this does not always happen, + // due to link-time effects. So, consumer can expect either a link-time sized or + // run-time sized array. + EOpArrayLength, // // Image operations @@ -605,6 +786,8 @@ enum TOperator { EOpImageAtomicXor, EOpImageAtomicExchange, EOpImageAtomicCompSwap, + EOpImageAtomicLoad, + EOpImageAtomicStore, EOpSubpassLoad, EOpSubpassLoadMS, @@ -682,6 +865,16 @@ enum TOperator { #endif EOpSparseTextureGuardEnd, + +#ifdef NV_EXTENSIONS + EOpImageFootprintGuardBegin, + EOpImageSampleFootprintNV, + EOpImageSampleFootprintClampNV, + EOpImageSampleFootprintLodNV, + EOpImageSampleFootprintGradNV, + EOpImageSampleFootprintGradClampNV, + EOpImageFootprintGuardEnd, +#endif EOpSamplingGuardEnd, EOpTextureGuardEnd, @@ -700,6 +893,14 @@ enum TOperator { EOpFindLSB, EOpFindMSB, +#ifdef NV_EXTENSIONS + EOpTraceNV, + EOpReportIntersectionNV, + EOpIgnoreIntersectionNV, + EOpTerminateRayNV, + EOpExecuteCallableNV, + EOpWritePackedPrimitiveIndices4x8NV, +#endif // // HLSL operations // @@ -722,7 +923,8 @@ enum TOperator { EOpInterlockedOr, // ... EOpInterlockedXor, // ... EOpAllMemoryBarrierWithGroupSync, // memory barriers without non-hlsl AST equivalents - EOpGroupMemoryBarrierWithGroupSync, // ... + EOpDeviceMemoryBarrier, // ... + EOpDeviceMemoryBarrierWithGroupSync, // ... EOpWorkgroupMemoryBarrier, // ... EOpWorkgroupMemoryBarrierWithGroupSync, // ... EOpEvaluateAttributeSnapped, // InterpolateAtOffset with int position on 16x16 grid @@ -776,6 +978,12 @@ enum TOperator { // matrix EOpMatrixSwizzle, // select multiple matrix components (non-column) + + // SM6 wave ops + EOpWaveGetLaneCount, // Will decompose to gl_SubgroupSize. + EOpWaveGetLaneIndex, // Will decompose to gl_SubgroupInvocationID. + EOpWaveActiveCountBits, // Will decompose to subgroupBallotBitCount(subgroupBallot()). + EOpWavePrefixCountBits, // Will decompose to subgroupBallotInclusiveBitCount(subgroupBallot()). }; class TIntermTraverser; @@ -818,7 +1026,7 @@ public: virtual glslang::TIntermMethod* getAsMethodNode() { return 0; } virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; } virtual glslang::TIntermBranch* getAsBranchNode() { return 0; } - virtual glslang::TIntermLoop* getAsLoopNode() { return 0; } + virtual glslang::TIntermLoop* getAsLoopNode() { return 0; } virtual const glslang::TIntermTyped* getAsTyped() const { return 0; } virtual const glslang::TIntermOperator* getAsOperator() const { return 0; } @@ -831,7 +1039,7 @@ public: virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; } virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; } virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; } - virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; } + virtual const glslang::TIntermLoop* getAsLoopNode() const { return 0; } virtual ~TIntermNode() { } protected: @@ -884,24 +1092,6 @@ protected: TType type; }; -// -// Selection control hints -// -enum TSelectionControl { - ESelectionControlNone, - ESelectionControlFlatten, - ESelectionControlDontFlatten, -}; - -// -// Loop control hints -// -enum TLoopControl { - ELoopControlNone, - ELoopControlUnroll, - ELoopControlDontUnroll, -}; - // // Handle for, do-while, and while loops. // @@ -912,26 +1102,36 @@ public: test(aTest), terminal(aTerminal), first(testFirst), - control(ELoopControlNone) + unroll(false), + dontUnroll(false), + dependency(0) { } - virtual TIntermLoop* getAsLoopNode() { return this; } - virtual const TIntermLoop* getAsLoopNode() const { return this; } + virtual TIntermLoop* getAsLoopNode() { return this; } + virtual const TIntermLoop* getAsLoopNode() const { return this; } virtual void traverse(TIntermTraverser*); TIntermNode* getBody() const { return body; } TIntermTyped* getTest() const { return test; } TIntermTyped* getTerminal() const { return terminal; } bool testFirst() const { return first; } - void setLoopControl(TLoopControl c) { control = c; } - TLoopControl getLoopControl() const { return control; } + void setUnroll() { unroll = true; } + void setDontUnroll() { dontUnroll = true; } + bool getUnroll() const { return unroll; } + bool getDontUnroll() const { return dontUnroll; } + + static const unsigned int dependencyInfinite = 0xFFFFFFFF; + void setLoopDependency(int d) { dependency = d; } + int getLoopDependency() const { return dependency; } protected: TIntermNode* body; // code to loop over TIntermTyped* test; // exit condition associated with loop, could be 0 for 'for' loops TIntermTyped* terminal; // exists for for-loops bool first; // true for while and for, not for do-while - TLoopControl control; // loop control hint + bool unroll; // true if unroll requested + bool dontUnroll; // true if request to not unroll + unsigned int dependency; // loop dependency hint; 0 means not set or unknown }; // @@ -986,6 +1186,7 @@ public: constSubtree(nullptr) { name = n; } virtual int getId() const { return id; } + virtual void changeId(int i) { id = i; } virtual const TString& getName() const { return name; } virtual void traverse(TIntermTraverser*); virtual TIntermSymbol* getAsSymbolNode() { return this; } @@ -1065,6 +1266,9 @@ public: bool isSampling() const { return op > EOpSamplingGuardBegin && op < EOpSamplingGuardEnd; } bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; } bool isSparseTexture() const { return op > EOpSparseTextureGuardBegin && op < EOpSparseTextureGuardEnd; } +#ifdef NV_EXTENSIONS + bool isImageFootprint() const { return op > EOpImageFootprintGuardBegin && op < EOpImageFootprintGuardEnd; } +#endif bool isSparseImage() const { return op == EOpSparseImageLoad; } void setOperationPrecision(TPrecisionQualifier p) { operationPrecision = p; } @@ -1237,6 +1441,23 @@ public: cracked.subpass = sampler.dim == EsdSubpass; cracked.fragMask = true; break; +#endif +#ifdef NV_EXTENSIONS + case EOpImageSampleFootprintNV: + break; + case EOpImageSampleFootprintClampNV: + cracked.lodClamp = true; + break; + case EOpImageSampleFootprintLodNV: + cracked.lod = true; + break; + case EOpImageSampleFootprintGradNV: + cracked.grad = true; + break; + case EOpImageSampleFootprintGradClampNV: + cracked.lodClamp = true; + cracked.grad = true; + break; #endif case EOpSubpassLoad: case EOpSubpassLoadMS: @@ -1342,22 +1563,35 @@ protected: class TIntermSelection : public TIntermTyped { public: TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) : - TIntermTyped(EbtVoid), condition(cond), trueBlock(trueB), falseBlock(falseB), control(ESelectionControlNone) {} + TIntermTyped(EbtVoid), condition(cond), trueBlock(trueB), falseBlock(falseB), + shortCircuit(true), + flatten(false), dontFlatten(false) {} TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) : - TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB), control(ESelectionControlNone) {} + TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB), + shortCircuit(true), + flatten(false), dontFlatten(false) {} virtual void traverse(TIntermTraverser*); virtual TIntermTyped* getCondition() const { return condition; } virtual TIntermNode* getTrueBlock() const { return trueBlock; } virtual TIntermNode* getFalseBlock() const { return falseBlock; } virtual TIntermSelection* getAsSelectionNode() { return this; } virtual const TIntermSelection* getAsSelectionNode() const { return this; } - void setSelectionControl(TSelectionControl c) { control = c; } - TSelectionControl getSelectionControl() const { return control; } + + void setNoShortCircuit() { shortCircuit = false; } + bool getShortCircuit() const { return shortCircuit; } + + void setFlatten() { flatten = true; } + void setDontFlatten() { dontFlatten = true; } + bool getFlatten() const { return flatten; } + bool getDontFlatten() const { return dontFlatten; } + protected: TIntermTyped* condition; TIntermNode* trueBlock; TIntermNode* falseBlock; - TSelectionControl control; // selection control hint + bool shortCircuit; // normally all if-then-else and all GLSL ?: short-circuit, but HLSL ?: does not + bool flatten; // true if flatten requested + bool dontFlatten; // true if requested to not flatten }; // @@ -1368,18 +1602,24 @@ protected: // class TIntermSwitch : public TIntermNode { public: - TIntermSwitch(TIntermTyped* cond, TIntermAggregate* b) : condition(cond), body(b), control(ESelectionControlNone) { } + TIntermSwitch(TIntermTyped* cond, TIntermAggregate* b) : condition(cond), body(b), + flatten(false), dontFlatten(false) {} virtual void traverse(TIntermTraverser*); virtual TIntermNode* getCondition() const { return condition; } virtual TIntermAggregate* getBody() const { return body; } virtual TIntermSwitch* getAsSwitchNode() { return this; } virtual const TIntermSwitch* getAsSwitchNode() const { return this; } - void setSelectionControl(TSelectionControl c) { control = c; } - TSelectionControl getSelectionControl() const { return control; } + + void setFlatten() { flatten = true; } + void setDontFlatten() { dontFlatten = true; } + bool getFlatten() const { return flatten; } + bool getDontFlatten() const { return dontFlatten; } + protected: TIntermTyped* condition; TIntermAggregate* body; - TSelectionControl control; // selection control hint + bool flatten; // true if flatten requested + bool dontFlatten; // true if requested to not flatten }; enum TVisit diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/revision.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/revision.h index 218f8b67f51..e0c42c83afb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Include/revision.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Include/revision.h @@ -1,6 +1,3 @@ // This header is generated by the make-revision script. -// For the version, it uses the latest git tag followed by the number of commits. -// For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.2000" -#define GLSLANG_DATE "12-Apr-2017" +#define GLSLANG_PATCH_LEVEL 3009 diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp index 1b73d969f17..8d4987b7549 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Constant.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -177,60 +178,79 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* right switch (getType().getBasicType()) { case EbtDouble: case EbtFloat: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif - newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst()); + if (rightUnionArray[i].getDConst() != 0.0) + newConstArray[i].setDConst(leftUnionArray[i].getDConst() / rightUnionArray[i].getDConst()); + else if (leftUnionArray[i].getDConst() > 0.0) + newConstArray[i].setDConst((double)INFINITY); + else if (leftUnionArray[i].getDConst() < 0.0) + newConstArray[i].setDConst(-(double)INFINITY); + else + newConstArray[i].setDConst((double)NAN); + break; + case EbtInt8: + if (rightUnionArray[i] == (signed char)0) + newConstArray[i].setI8Const((signed char)0x7F); + else if (rightUnionArray[i].getI8Const() == (signed char)-1 && leftUnionArray[i].getI8Const() == (signed char)-0x80) + newConstArray[i].setI8Const((signed char)-0x80); + else + newConstArray[i].setI8Const(leftUnionArray[i].getI8Const() / rightUnionArray[i].getI8Const()); + break; + + case EbtUint8: + if (rightUnionArray[i] == (unsigned char)0u) + newConstArray[i].setU8Const((unsigned char)0xFFu); + else + newConstArray[i].setU8Const(leftUnionArray[i].getU8Const() / rightUnionArray[i].getU8Const()); + break; + + case EbtInt16: + if (rightUnionArray[i] == (signed short)0) + newConstArray[i].setI16Const((signed short)0x7FFF); + else if (rightUnionArray[i].getI16Const() == (signed short)-1 && leftUnionArray[i].getI16Const() == (signed short)-0x8000) + newConstArray[i].setI16Const((signed short)-0x8000); + else + newConstArray[i].setI16Const(leftUnionArray[i].getI16Const() / rightUnionArray[i].getI16Const()); + break; + + case EbtUint16: + if (rightUnionArray[i] == (unsigned short)0u) + newConstArray[i].setU16Const((unsigned short)0xFFFFu); + else + newConstArray[i].setU16Const(leftUnionArray[i].getU16Const() / rightUnionArray[i].getU16Const()); break; case EbtInt: if (rightUnionArray[i] == 0) newConstArray[i].setIConst(0x7FFFFFFF); - else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x80000000) - newConstArray[i].setIConst(0x80000000); + else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)-0x80000000ll) + newConstArray[i].setIConst((int)-0x80000000ll); else newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); break; case EbtUint: - if (rightUnionArray[i] == 0) { + if (rightUnionArray[i] == 0u) newConstArray[i].setUConst(0xFFFFFFFFu); - } else + else newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); break; case EbtInt64: - if (rightUnionArray[i] == 0) + if (rightUnionArray[i] == 0ll) newConstArray[i].setI64Const(0x7FFFFFFFFFFFFFFFll); - else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)0x8000000000000000) - newConstArray[i].setI64Const(0x8000000000000000); + else if (rightUnionArray[i].getI64Const() == -1 && leftUnionArray[i].getI64Const() == (long long)-0x8000000000000000ll) + newConstArray[i].setI64Const((long long)-0x8000000000000000ll); else newConstArray[i].setI64Const(leftUnionArray[i].getI64Const() / rightUnionArray[i].getI64Const()); break; case EbtUint64: - if (rightUnionArray[i] == 0) { + if (rightUnionArray[i] == 0ull) newConstArray[i].setU64Const(0xFFFFFFFFFFFFFFFFull); - } else + else newConstArray[i].setU64Const(leftUnionArray[i].getU64Const() / rightUnionArray[i].getU64Const()); break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - if (rightUnionArray[i] == 0) - newConstArray[i].setIConst(0x7FFF); - else if (rightUnionArray[i].getIConst() == -1 && leftUnionArray[i].getIConst() == (int)0x8000) - newConstArray[i].setIConst(0x8000); - else - newConstArray[i].setIConst(leftUnionArray[i].getIConst() / rightUnionArray[i].getIConst()); - break; - - case EbtUint16: - if (rightUnionArray[i] == 0) { - newConstArray[i].setUConst(0xFFFFu); - } else - newConstArray[i].setUConst(leftUnionArray[i].getUConst() / rightUnionArray[i].getUConst()); - break; -#endif default: return 0; } @@ -411,6 +431,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) resultSize = 2; break; + case EOpPack16: + case EOpPack32: + case EOpPack64: + case EOpUnpack32: + case EOpUnpack16: + case EOpUnpack8: case EOpNormalize: componentWise = false; resultSize = objectSize; @@ -469,6 +495,12 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpPackSnorm2x16: case EOpPackUnorm2x16: case EOpPackHalf2x16: + case EOpPack16: + case EOpPack32: + case EOpPack64: + case EOpUnpack32: + case EOpUnpack16: + case EOpUnpack8: case EOpUnpackSnorm2x16: case EOpUnpackUnorm2x16: @@ -494,17 +526,13 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpNegative: switch (getType().getBasicType()) { case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break; -#ifdef AMD_EXTENSIONS - case EbtInt16: -#endif + case EbtInt8: newConstArray[i].setI8Const(-unionArray[i].getI8Const()); break; + case EbtUint8: newConstArray[i].setU8Const(static_cast(-static_cast(unionArray[i].getU8Const()))); break; + case EbtInt16: newConstArray[i].setI16Const(-unionArray[i].getI16Const()); break; + case EbtUint16:newConstArray[i].setU16Const(static_cast(-static_cast(unionArray[i].getU16Const()))); break; case EbtInt: newConstArray[i].setIConst(-unionArray[i].getIConst()); break; -#ifdef AMD_EXTENSIONS - case EbtUint16: -#endif case EbtUint: newConstArray[i].setUConst(static_cast(-static_cast(unionArray[i].getUConst()))); break; case EbtInt64: newConstArray[i].setI64Const(-unionArray[i].getI64Const()); break; case EbtUint64: newConstArray[i].setU64Const(static_cast(-static_cast(unionArray[i].getU64Const()))); break; @@ -642,6 +670,279 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) break; } + case EOpConvInt8ToBool: + newConstArray[i].setBConst(unionArray[i].getI8Const() != 0); break; + case EOpConvUint8ToBool: + newConstArray[i].setBConst(unionArray[i].getU8Const() != 0); break; + case EOpConvInt16ToBool: + newConstArray[i].setBConst(unionArray[i].getI16Const() != 0); break; + case EOpConvUint16ToBool: + newConstArray[i].setBConst(unionArray[i].getU16Const() != 0); break; + case EOpConvIntToBool: + newConstArray[i].setBConst(unionArray[i].getIConst() != 0); break; + case EOpConvUintToBool: + newConstArray[i].setBConst(unionArray[i].getUConst() != 0); break; + case EOpConvInt64ToBool: + newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break; + case EOpConvUint64ToBool: + newConstArray[i].setBConst(unionArray[i].getI64Const() != 0); break; + case EOpConvFloat16ToBool: + newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; + case EOpConvFloatToBool: + newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; + case EOpConvDoubleToBool: + newConstArray[i].setBConst(unionArray[i].getDConst() != 0); break; + + case EOpConvBoolToInt8: + newConstArray[i].setI8Const(unionArray[i].getBConst()); break; + case EOpConvBoolToUint8: + newConstArray[i].setU8Const(unionArray[i].getBConst()); break; + case EOpConvBoolToInt16: + newConstArray[i].setI16Const(unionArray[i].getBConst()); break; + case EOpConvBoolToUint16: + newConstArray[i].setU16Const(unionArray[i].getBConst()); break; + case EOpConvBoolToInt: + newConstArray[i].setIConst(unionArray[i].getBConst()); break; + case EOpConvBoolToUint: + newConstArray[i].setUConst(unionArray[i].getBConst()); break; + case EOpConvBoolToInt64: + newConstArray[i].setI64Const(unionArray[i].getBConst()); break; + case EOpConvBoolToUint64: + newConstArray[i].setU64Const(unionArray[i].getBConst()); break; + case EOpConvBoolToFloat16: + newConstArray[i].setDConst(unionArray[i].getBConst()); break; + case EOpConvBoolToFloat: + newConstArray[i].setDConst(unionArray[i].getBConst()); break; + case EOpConvBoolToDouble: + newConstArray[i].setDConst(unionArray[i].getBConst()); break; + + case EOpConvInt8ToInt16: + newConstArray[i].setI16Const(unionArray[i].getI8Const()); break; + case EOpConvInt8ToInt: + newConstArray[i].setIConst(unionArray[i].getI8Const()); break; + case EOpConvInt8ToInt64: + newConstArray[i].setI64Const(unionArray[i].getI8Const()); break; + case EOpConvInt8ToUint8: + newConstArray[i].setU8Const(unionArray[i].getI8Const()); break; + case EOpConvInt8ToUint16: + newConstArray[i].setU16Const(unionArray[i].getI8Const()); break; + case EOpConvInt8ToUint: + newConstArray[i].setUConst(unionArray[i].getI8Const()); break; + case EOpConvInt8ToUint64: + newConstArray[i].setU64Const(unionArray[i].getI8Const()); break; + case EOpConvUint8ToInt8: + newConstArray[i].setI8Const(unionArray[i].getU8Const()); break; + case EOpConvUint8ToInt16: + newConstArray[i].setI16Const(unionArray[i].getU8Const()); break; + case EOpConvUint8ToInt: + newConstArray[i].setIConst(unionArray[i].getU8Const()); break; + case EOpConvUint8ToInt64: + newConstArray[i].setI64Const(unionArray[i].getU8Const()); break; + case EOpConvUint8ToUint16: + newConstArray[i].setU16Const(unionArray[i].getU8Const()); break; + case EOpConvUint8ToUint: + newConstArray[i].setUConst(unionArray[i].getU8Const()); break; + case EOpConvUint8ToUint64: + newConstArray[i].setU64Const(unionArray[i].getU8Const()); break; + case EOpConvInt8ToFloat16: + newConstArray[i].setDConst(unionArray[i].getI8Const()); break; + case EOpConvInt8ToFloat: + newConstArray[i].setDConst(unionArray[i].getI8Const()); break; + case EOpConvInt8ToDouble: + newConstArray[i].setDConst(unionArray[i].getI8Const()); break; + case EOpConvUint8ToFloat16: + newConstArray[i].setDConst(unionArray[i].getU8Const()); break; + case EOpConvUint8ToFloat: + newConstArray[i].setDConst(unionArray[i].getU8Const()); break; + case EOpConvUint8ToDouble: + newConstArray[i].setDConst(unionArray[i].getU8Const()); break; + + case EOpConvInt16ToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getI16Const())); break; + case EOpConvInt16ToInt: + newConstArray[i].setIConst(unionArray[i].getI16Const()); break; + case EOpConvInt16ToInt64: + newConstArray[i].setI64Const(unionArray[i].getI16Const()); break; + case EOpConvInt16ToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getI16Const())); break; + case EOpConvInt16ToUint16: + newConstArray[i].setU16Const(unionArray[i].getI16Const()); break; + case EOpConvInt16ToUint: + newConstArray[i].setUConst(unionArray[i].getI16Const()); break; + case EOpConvInt16ToUint64: + newConstArray[i].setU64Const(unionArray[i].getI16Const()); break; + case EOpConvUint16ToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getU16Const())); break; + case EOpConvUint16ToInt16: + newConstArray[i].setI16Const(unionArray[i].getU16Const()); break; + case EOpConvUint16ToInt: + newConstArray[i].setIConst(unionArray[i].getU16Const()); break; + case EOpConvUint16ToInt64: + newConstArray[i].setI64Const(unionArray[i].getU16Const()); break; + case EOpConvUint16ToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getU16Const())); break; + + case EOpConvUint16ToUint: + newConstArray[i].setUConst(unionArray[i].getU16Const()); break; + case EOpConvUint16ToUint64: + newConstArray[i].setU64Const(unionArray[i].getU16Const()); break; + case EOpConvInt16ToFloat16: + newConstArray[i].setDConst(unionArray[i].getI16Const()); break; + case EOpConvInt16ToFloat: + newConstArray[i].setDConst(unionArray[i].getI16Const()); break; + case EOpConvInt16ToDouble: + newConstArray[i].setDConst(unionArray[i].getI16Const()); break; + case EOpConvUint16ToFloat16: + newConstArray[i].setDConst(unionArray[i].getU16Const()); break; + case EOpConvUint16ToFloat: + newConstArray[i].setDConst(unionArray[i].getU16Const()); break; + case EOpConvUint16ToDouble: + newConstArray[i].setDConst(unionArray[i].getU16Const()); break; + + case EOpConvIntToInt8: + newConstArray[i].setI8Const(unionArray[i].getIConst()); break; + case EOpConvIntToInt16: + newConstArray[i].setI16Const(unionArray[i].getIConst()); break; + case EOpConvIntToInt64: + newConstArray[i].setI64Const(unionArray[i].getIConst()); break; + case EOpConvIntToUint8: + newConstArray[i].setU8Const(unionArray[i].getIConst()); break; + case EOpConvIntToUint16: + newConstArray[i].setU16Const(unionArray[i].getIConst()); break; + case EOpConvIntToUint: + newConstArray[i].setUConst(unionArray[i].getIConst()); break; + case EOpConvIntToUint64: + newConstArray[i].setU64Const(unionArray[i].getIConst()); break; + + case EOpConvUintToInt8: + newConstArray[i].setI8Const(unionArray[i].getUConst()); break; + case EOpConvUintToInt16: + newConstArray[i].setI16Const(unionArray[i].getUConst()); break; + case EOpConvUintToInt: + newConstArray[i].setIConst(unionArray[i].getUConst()); break; + case EOpConvUintToInt64: + newConstArray[i].setI64Const(unionArray[i].getUConst()); break; + case EOpConvUintToUint8: + newConstArray[i].setU8Const(unionArray[i].getUConst()); break; + case EOpConvUintToUint16: + newConstArray[i].setU16Const(unionArray[i].getUConst()); break; + case EOpConvUintToUint64: + newConstArray[i].setU64Const(unionArray[i].getUConst()); break; + case EOpConvIntToFloat16: + newConstArray[i].setDConst(unionArray[i].getIConst()); break; + case EOpConvIntToFloat: + newConstArray[i].setDConst(unionArray[i].getIConst()); break; + case EOpConvIntToDouble: + newConstArray[i].setDConst(unionArray[i].getIConst()); break; + case EOpConvUintToFloat16: + newConstArray[i].setDConst(unionArray[i].getUConst()); break; + case EOpConvUintToFloat: + newConstArray[i].setDConst(unionArray[i].getUConst()); break; + case EOpConvUintToDouble: + newConstArray[i].setDConst(unionArray[i].getUConst()); break; + case EOpConvInt64ToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToInt16: + newConstArray[i].setI16Const(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToInt: + newConstArray[i].setIConst(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToUint16: + newConstArray[i].setU16Const(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToUint: + newConstArray[i].setUConst(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToUint64: + newConstArray[i].setU64Const(unionArray[i].getI64Const()); break; + case EOpConvUint64ToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToInt16: + newConstArray[i].setI16Const(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToInt: + newConstArray[i].setIConst(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToInt64: + newConstArray[i].setI64Const(unionArray[i].getU64Const()); break; + case EOpConvUint64ToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToUint16: + newConstArray[i].setU16Const(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToUint: + newConstArray[i].setUConst(static_cast(unionArray[i].getU64Const())); break; + case EOpConvInt64ToFloat16: + newConstArray[i].setDConst(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToFloat: + newConstArray[i].setDConst(static_cast(unionArray[i].getI64Const())); break; + case EOpConvInt64ToDouble: + newConstArray[i].setDConst(static_cast(unionArray[i].getI64Const())); break; + case EOpConvUint64ToFloat16: + newConstArray[i].setDConst(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToFloat: + newConstArray[i].setDConst(static_cast(unionArray[i].getU64Const())); break; + case EOpConvUint64ToDouble: + newConstArray[i].setDConst(static_cast(unionArray[i].getU64Const())); break; + case EOpConvFloat16ToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToInt16: + newConstArray[i].setI16Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToInt: + newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToInt64: + newConstArray[i].setI64Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToUint16: + newConstArray[i].setU16Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToUint: + newConstArray[i].setUConst(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToUint64: + newConstArray[i].setU64Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloat16ToFloat: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + case EOpConvFloat16ToDouble: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + case EOpConvFloatToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToInt16: + newConstArray[i].setI16Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToInt: + newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToInt64: + newConstArray[i].setI64Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToUint16: + newConstArray[i].setU16Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToUint: + newConstArray[i].setUConst(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToUint64: + newConstArray[i].setU64Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvFloatToFloat16: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + case EOpConvFloatToDouble: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + case EOpConvDoubleToInt8: + newConstArray[i].setI8Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToInt16: + newConstArray[i].setI16Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToInt: + newConstArray[i].setIConst(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToInt64: + newConstArray[i].setI64Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToUint8: + newConstArray[i].setU8Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToUint16: + newConstArray[i].setU16Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToUint: + newConstArray[i].setUConst(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToUint64: + newConstArray[i].setU64Const(static_cast(unionArray[i].getDConst())); break; + case EOpConvDoubleToFloat16: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + case EOpConvDoubleToFloat: + newConstArray[i].setDConst(unionArray[i].getDConst()); break; + + + // TODO: 3.0 Functionality: unary constant folding: the rest of the ops have to be fleshed out case EOpSinh: @@ -659,13 +960,10 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) case EOpDoubleBitsToUint64: case EOpInt64BitsToDouble: case EOpUint64BitsToDouble: -#ifdef AMD_EXTENSIONS case EOpFloat16BitsToInt16: case EOpFloat16BitsToUint16: case EOpInt16BitsToFloat16: case EOpUint16BitsToFloat16: -#endif - default: return 0; } @@ -749,20 +1047,6 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) for (unsigned int arg = 0; arg < children.size(); ++arg) childConstUnions.push_back(children[arg]->getAsConstantUnion()->getConstArray()); - // Second, do the actual folding - - bool isFloatingPoint = children[0]->getAsTyped()->getBasicType() == EbtFloat || -#ifdef AMD_EXTENSIONS - children[0]->getAsTyped()->getBasicType() == EbtFloat16 || -#endif - children[0]->getAsTyped()->getBasicType() == EbtDouble; - bool isSigned = children[0]->getAsTyped()->getBasicType() == EbtInt || -#ifdef AMD_EXTENSIONS - children[0]->getAsTyped()->getBasicType() == EbtInt16 || -#endif - children[0]->getAsTyped()->getBasicType() == EbtInt64; - bool isInt64 = children[0]->getAsTyped()->getBasicType() == EbtInt64 || - children[0]->getAsTyped()->getBasicType() == EbtUint64; if (componentwise) { for (int comp = 0; comp < objectSize; comp++) { @@ -783,53 +1067,114 @@ TIntermTyped* TIntermediate::fold(TIntermAggregate* aggrNode) newConstArray[comp].setDConst(pow(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); break; case EOpMin: - if (isFloatingPoint) + switch(children[0]->getAsTyped()->getBasicType()) { + case EbtFloat16: + case EbtFloat: + case EbtDouble: newConstArray[comp].setDConst(std::min(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - else if (isSigned) { - if (isInt64) - newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); - else - newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - } else { - if (isInt64) - newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); - else - newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + break; + case EbtInt8: + newConstArray[comp].setI8Const(std::min(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); + break; + case EbtUint8: + newConstArray[comp].setU8Const(std::min(childConstUnions[0][arg0comp].getU8Const(), childConstUnions[1][arg1comp].getU8Const())); + break; + case EbtInt16: + newConstArray[comp].setI16Const(std::min(childConstUnions[0][arg0comp].getI16Const(), childConstUnions[1][arg1comp].getI16Const())); + break; + case EbtUint16: + newConstArray[comp].setU16Const(std::min(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const())); + break; + case EbtInt: + newConstArray[comp].setIConst(std::min(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); + break; + case EbtUint: + newConstArray[comp].setUConst(std::min(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + break; + case EbtInt64: + newConstArray[comp].setI64Const(std::min(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); + break; + case EbtUint64: + newConstArray[comp].setU64Const(std::min(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); + break; + default: assert(false && "Default missing"); } break; case EOpMax: - if (isFloatingPoint) + switch(children[0]->getAsTyped()->getBasicType()) { + case EbtFloat16: + case EbtFloat: + case EbtDouble: newConstArray[comp].setDConst(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst())); - else if (isSigned) { - if (isInt64) - newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); - else - newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); - } else { - if (isInt64) - newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); - else - newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + break; + case EbtInt8: + newConstArray[comp].setI8Const(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const())); + break; + case EbtUint8: + newConstArray[comp].setU8Const(std::max(childConstUnions[0][arg0comp].getU8Const(), childConstUnions[1][arg1comp].getU8Const())); + break; + case EbtInt16: + newConstArray[comp].setI16Const(std::max(childConstUnions[0][arg0comp].getI16Const(), childConstUnions[1][arg1comp].getI16Const())); + break; + case EbtUint16: + newConstArray[comp].setU16Const(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const())); + break; + case EbtInt: + newConstArray[comp].setIConst(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst())); + break; + case EbtUint: + newConstArray[comp].setUConst(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst())); + break; + case EbtInt64: + newConstArray[comp].setI64Const(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const())); + break; + case EbtUint64: + newConstArray[comp].setU64Const(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const())); + break; + default: assert(false && "Default missing"); } break; case EOpClamp: - if (isFloatingPoint) + switch(children[0]->getAsTyped()->getBasicType()) { + case EbtFloat16: + case EbtFloat: + case EbtDouble: newConstArray[comp].setDConst(std::min(std::max(childConstUnions[0][arg0comp].getDConst(), childConstUnions[1][arg1comp].getDConst()), childConstUnions[2][arg2comp].getDConst())); - else if (isSigned) { - if (isInt64) - newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()), - childConstUnions[2][arg2comp].getI64Const())); - else - newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), + break; + case EbtInt8: + newConstArray[comp].setI8Const(std::min(std::max(childConstUnions[0][arg0comp].getI8Const(), childConstUnions[1][arg1comp].getI8Const()), + childConstUnions[2][arg2comp].getI8Const())); + break; + case EbtUint8: + newConstArray[comp].setU8Const(std::min(std::max(childConstUnions[0][arg0comp].getU8Const(), childConstUnions[1][arg1comp].getU8Const()), + childConstUnions[2][arg2comp].getU8Const())); + break; + case EbtInt16: + newConstArray[comp].setI16Const(std::min(std::max(childConstUnions[0][arg0comp].getI16Const(), childConstUnions[1][arg1comp].getI16Const()), + childConstUnions[2][arg2comp].getI16Const())); + break; + case EbtUint16: + newConstArray[comp].setU16Const(std::min(std::max(childConstUnions[0][arg0comp].getU16Const(), childConstUnions[1][arg1comp].getU16Const()), + childConstUnions[2][arg2comp].getU16Const())); + break; + case EbtInt: + newConstArray[comp].setIConst(std::min(std::max(childConstUnions[0][arg0comp].getIConst(), childConstUnions[1][arg1comp].getIConst()), childConstUnions[2][arg2comp].getIConst())); - } else { - if (isInt64) - newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), - childConstUnions[2][arg2comp].getU64Const())); - else - newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), + break; + case EbtUint: + newConstArray[comp].setUConst(std::min(std::max(childConstUnions[0][arg0comp].getUConst(), childConstUnions[1][arg1comp].getUConst()), childConstUnions[2][arg2comp].getUConst())); + break; + case EbtInt64: + newConstArray[comp].setI64Const(std::min(std::max(childConstUnions[0][arg0comp].getI64Const(), childConstUnions[1][arg1comp].getI64Const()), + childConstUnions[2][arg2comp].getI64Const())); + break; + case EbtUint64: + newConstArray[comp].setU64Const(std::min(std::max(childConstUnions[0][arg0comp].getU64Const(), childConstUnions[1][arg1comp].getU64Const()), + childConstUnions[2][arg2comp].getU64Const())); + break; + default: assert(false && "Default missing"); } break; case EOpLessThan: diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp index 40f46b3532b..7118d065cf8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp @@ -2,6 +2,7 @@ // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2016 LunarG, Inc. // Copyright (C) 2015-2017 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -83,6 +84,13 @@ TBuiltIns::TBuiltIns() // Set up textual representations for making all the permutations // of texturing/imaging functions. prefixes[EbtFloat] = ""; +#ifdef AMD_EXTENSIONS + prefixes[EbtFloat16] = "f16"; +#endif + prefixes[EbtInt8] = "i8"; + prefixes[EbtUint8] = "u8"; + prefixes[EbtInt16] = "i16"; + prefixes[EbtUint16] = "u16"; prefixes[EbtInt] = "i"; prefixes[EbtUint] = "u"; postfixes[2] = "2"; @@ -114,6 +122,158 @@ TBuiltIns::~TBuiltIns() // void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion) { + //============================================================================ + // + // Prototypes for built-in functions used repeatly by different shaders + // + //============================================================================ + + // + // Derivatives Functions. + // + TString derivatives ( + "float dFdx(float p);" + "vec2 dFdx(vec2 p);" + "vec3 dFdx(vec3 p);" + "vec4 dFdx(vec4 p);" + + "float dFdy(float p);" + "vec2 dFdy(vec2 p);" + "vec3 dFdy(vec3 p);" + "vec4 dFdy(vec4 p);" + + "float fwidth(float p);" + "vec2 fwidth(vec2 p);" + "vec3 fwidth(vec3 p);" + "vec4 fwidth(vec4 p);" + ); + + TString derivativeControls ( + "float dFdxFine(float p);" + "vec2 dFdxFine(vec2 p);" + "vec3 dFdxFine(vec3 p);" + "vec4 dFdxFine(vec4 p);" + + "float dFdyFine(float p);" + "vec2 dFdyFine(vec2 p);" + "vec3 dFdyFine(vec3 p);" + "vec4 dFdyFine(vec4 p);" + + "float fwidthFine(float p);" + "vec2 fwidthFine(vec2 p);" + "vec3 fwidthFine(vec3 p);" + "vec4 fwidthFine(vec4 p);" + + "float dFdxCoarse(float p);" + "vec2 dFdxCoarse(vec2 p);" + "vec3 dFdxCoarse(vec3 p);" + "vec4 dFdxCoarse(vec4 p);" + + "float dFdyCoarse(float p);" + "vec2 dFdyCoarse(vec2 p);" + "vec3 dFdyCoarse(vec3 p);" + "vec4 dFdyCoarse(vec4 p);" + + "float fwidthCoarse(float p);" + "vec2 fwidthCoarse(vec2 p);" + "vec3 fwidthCoarse(vec3 p);" + "vec4 fwidthCoarse(vec4 p);" + ); + + TString derivativesAndControl16bits ( + "float16_t dFdx(float16_t);" + "f16vec2 dFdx(f16vec2);" + "f16vec3 dFdx(f16vec3);" + "f16vec4 dFdx(f16vec4);" + + "float16_t dFdy(float16_t);" + "f16vec2 dFdy(f16vec2);" + "f16vec3 dFdy(f16vec3);" + "f16vec4 dFdy(f16vec4);" + + "float16_t dFdxFine(float16_t);" + "f16vec2 dFdxFine(f16vec2);" + "f16vec3 dFdxFine(f16vec3);" + "f16vec4 dFdxFine(f16vec4);" + + "float16_t dFdyFine(float16_t);" + "f16vec2 dFdyFine(f16vec2);" + "f16vec3 dFdyFine(f16vec3);" + "f16vec4 dFdyFine(f16vec4);" + + "float16_t dFdxCoarse(float16_t);" + "f16vec2 dFdxCoarse(f16vec2);" + "f16vec3 dFdxCoarse(f16vec3);" + "f16vec4 dFdxCoarse(f16vec4);" + + "float16_t dFdyCoarse(float16_t);" + "f16vec2 dFdyCoarse(f16vec2);" + "f16vec3 dFdyCoarse(f16vec3);" + "f16vec4 dFdyCoarse(f16vec4);" + + "float16_t fwidth(float16_t);" + "f16vec2 fwidth(f16vec2);" + "f16vec3 fwidth(f16vec3);" + "f16vec4 fwidth(f16vec4);" + + "float16_t fwidthFine(float16_t);" + "f16vec2 fwidthFine(f16vec2);" + "f16vec3 fwidthFine(f16vec3);" + "f16vec4 fwidthFine(f16vec4);" + + "float16_t fwidthCoarse(float16_t);" + "f16vec2 fwidthCoarse(f16vec2);" + "f16vec3 fwidthCoarse(f16vec3);" + "f16vec4 fwidthCoarse(f16vec4);" + ); + + TString derivativesAndControl64bits ( + "float64_t dFdx(float64_t);" + "f64vec2 dFdx(f64vec2);" + "f64vec3 dFdx(f64vec3);" + "f64vec4 dFdx(f64vec4);" + + "float64_t dFdy(float64_t);" + "f64vec2 dFdy(f64vec2);" + "f64vec3 dFdy(f64vec3);" + "f64vec4 dFdy(f64vec4);" + + "float64_t dFdxFine(float64_t);" + "f64vec2 dFdxFine(f64vec2);" + "f64vec3 dFdxFine(f64vec3);" + "f64vec4 dFdxFine(f64vec4);" + + "float64_t dFdyFine(float64_t);" + "f64vec2 dFdyFine(f64vec2);" + "f64vec3 dFdyFine(f64vec3);" + "f64vec4 dFdyFine(f64vec4);" + + "float64_t dFdxCoarse(float64_t);" + "f64vec2 dFdxCoarse(f64vec2);" + "f64vec3 dFdxCoarse(f64vec3);" + "f64vec4 dFdxCoarse(f64vec4);" + + "float64_t dFdyCoarse(float64_t);" + "f64vec2 dFdyCoarse(f64vec2);" + "f64vec3 dFdyCoarse(f64vec3);" + "f64vec4 dFdyCoarse(f64vec4);" + + "float64_t fwidth(float64_t);" + "f64vec2 fwidth(f64vec2);" + "f64vec3 fwidth(f64vec3);" + "f64vec4 fwidth(f64vec4);" + + "float64_t fwidthFine(float64_t);" + "f64vec2 fwidthFine(f64vec2);" + "f64vec3 fwidthFine(f64vec3);" + "f64vec4 fwidthFine(f64vec4);" + + "float64_t fwidthCoarse(float64_t);" + "f64vec2 fwidthCoarse(f64vec2);" + "f64vec3 fwidthCoarse(f64vec3);" + "f64vec4 fwidthCoarse(f64vec4);" + ); + //============================================================================ // // Prototypes for built-in functions seen by both vertex and fragment shaders. @@ -799,7 +959,6 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bvec3 notEqual(u64vec3, u64vec3);" "bvec4 notEqual(u64vec4, u64vec4);" -#ifdef AMD_EXTENSIONS "int findLSB(int64_t);" "ivec2 findLSB(i64vec2);" "ivec3 findLSB(i64vec3);" @@ -819,7 +978,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "ivec2 findMSB(u64vec2);" "ivec3 findMSB(u64vec3);" "ivec4 findMSB(u64vec4);" -#endif + "\n" ); } @@ -888,6 +1047,36 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 mid3(f16vec3, f16vec3, f16vec3);" "f16vec4 mid3(f16vec4, f16vec4, f16vec4);" + "int16_t min3(int16_t, int16_t, int16_t);" + "i16vec2 min3(i16vec2, i16vec2, i16vec2);" + "i16vec3 min3(i16vec3, i16vec3, i16vec3);" + "i16vec4 min3(i16vec4, i16vec4, i16vec4);" + + "int16_t max3(int16_t, int16_t, int16_t);" + "i16vec2 max3(i16vec2, i16vec2, i16vec2);" + "i16vec3 max3(i16vec3, i16vec3, i16vec3);" + "i16vec4 max3(i16vec4, i16vec4, i16vec4);" + + "int16_t mid3(int16_t, int16_t, int16_t);" + "i16vec2 mid3(i16vec2, i16vec2, i16vec2);" + "i16vec3 mid3(i16vec3, i16vec3, i16vec3);" + "i16vec4 mid3(i16vec4, i16vec4, i16vec4);" + + "uint16_t min3(uint16_t, uint16_t, uint16_t);" + "u16vec2 min3(u16vec2, u16vec2, u16vec2);" + "u16vec3 min3(u16vec3, u16vec3, u16vec3);" + "u16vec4 min3(u16vec4, u16vec4, u16vec4);" + + "uint16_t max3(uint16_t, uint16_t, uint16_t);" + "u16vec2 max3(u16vec2, u16vec2, u16vec2);" + "u16vec3 max3(u16vec3, u16vec3, u16vec3);" + "u16vec4 max3(u16vec4, u16vec4, u16vec4);" + + "uint16_t mid3(uint16_t, uint16_t, uint16_t);" + "u16vec2 mid3(u16vec2, u16vec2, u16vec2);" + "u16vec3 mid3(u16vec3, u16vec3, u16vec3);" + "u16vec4 mid3(u16vec4, u16vec4, u16vec4);" + "\n" ); } @@ -898,56 +1087,102 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV commonBuiltins.append( "uint atomicAdd(coherent volatile inout uint, uint);" " int atomicAdd(coherent volatile inout int, int);" + "uint atomicAdd(coherent volatile inout uint, uint, int, int, int);" + " int atomicAdd(coherent volatile inout int, int, int, int, int);" "uint atomicMin(coherent volatile inout uint, uint);" " int atomicMin(coherent volatile inout int, int);" + "uint atomicMin(coherent volatile inout uint, uint, int, int, int);" + " int atomicMin(coherent volatile inout int, int, int, int, int);" "uint atomicMax(coherent volatile inout uint, uint);" " int atomicMax(coherent volatile inout int, int);" + "uint atomicMax(coherent volatile inout uint, uint, int, int, int);" + " int atomicMax(coherent volatile inout int, int, int, int, int);" "uint atomicAnd(coherent volatile inout uint, uint);" " int atomicAnd(coherent volatile inout int, int);" + "uint atomicAnd(coherent volatile inout uint, uint, int, int, int);" + " int atomicAnd(coherent volatile inout int, int, int, int, int);" "uint atomicOr (coherent volatile inout uint, uint);" " int atomicOr (coherent volatile inout int, int);" + "uint atomicOr (coherent volatile inout uint, uint, int, int, int);" + " int atomicOr (coherent volatile inout int, int, int, int, int);" "uint atomicXor(coherent volatile inout uint, uint);" " int atomicXor(coherent volatile inout int, int);" + "uint atomicXor(coherent volatile inout uint, uint, int, int, int);" + " int atomicXor(coherent volatile inout int, int, int, int, int);" "uint atomicExchange(coherent volatile inout uint, uint);" " int atomicExchange(coherent volatile inout int, int);" + "uint atomicExchange(coherent volatile inout uint, uint, int, int, int);" + " int atomicExchange(coherent volatile inout int, int, int, int, int);" "uint atomicCompSwap(coherent volatile inout uint, uint, uint);" " int atomicCompSwap(coherent volatile inout int, int, int);" + "uint atomicCompSwap(coherent volatile inout uint, uint, uint, int, int, int, int, int);" + " int atomicCompSwap(coherent volatile inout int, int, int, int, int, int, int, int);" + + "uint atomicLoad(coherent volatile in uint, int, int, int);" + " int atomicLoad(coherent volatile in int, int, int, int);" + + "void atomicStore(coherent volatile out uint, uint, int, int, int);" + "void atomicStore(coherent volatile out int, int, int, int, int);" "\n"); } -#ifdef NV_EXTENSIONS if (profile != EEsProfile && version >= 440) { commonBuiltins.append( "uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);" " int64_t atomicMin(coherent volatile inout int64_t, int64_t);" + "uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicMin(coherent volatile inout int64_t, int64_t, int, int, int);" "uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t);" " int64_t atomicMax(coherent volatile inout int64_t, int64_t);" + "uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicMax(coherent volatile inout int64_t, int64_t, int, int, int);" "uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t);" " int64_t atomicAnd(coherent volatile inout int64_t, int64_t);" + "uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicAnd(coherent volatile inout int64_t, int64_t, int, int, int);" "uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t);" " int64_t atomicOr (coherent volatile inout int64_t, int64_t);" + "uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicOr (coherent volatile inout int64_t, int64_t, int, int, int);" "uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t);" " int64_t atomicXor(coherent volatile inout int64_t, int64_t);" + "uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicXor(coherent volatile inout int64_t, int64_t, int, int, int);" - " int64_t atomicAdd(coherent volatile inout int64_t, int64_t);" - " int64_t atomicExchange(coherent volatile inout int64_t, int64_t);" - " int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);" + "uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t);" + " int64_t atomicAdd(coherent volatile inout int64_t, int64_t);" + "uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicAdd(coherent volatile inout int64_t, int64_t, int, int, int);" + "uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t);" + " int64_t atomicExchange(coherent volatile inout int64_t, int64_t);" + "uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t, int, int, int);" + " int64_t atomicExchange(coherent volatile inout int64_t, int64_t, int, int, int);" + + "uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t);" + " int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);" + "uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t, int, int, int, int, int);" + " int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t, int, int, int, int, int);" + + "uint64_t atomicLoad(coherent volatile in uint64_t, int, int, int);" + " int64_t atomicLoad(coherent volatile in int64_t, int, int, int);" + + "void atomicStore(coherent volatile out uint64_t, uint64_t, int, int, int);" + "void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);" "\n"); } -#endif if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 450)) { @@ -1627,6 +1862,1097 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + commonBuiltins.append( + "void subgroupBarrier();" + "void subgroupMemoryBarrier();" + "void subgroupMemoryBarrierBuffer();" + "void subgroupMemoryBarrierImage();" + "bool subgroupElect();" + + "bool subgroupAll(bool);\n" + "bool subgroupAny(bool);\n" + + "bool subgroupAllEqual(float);\n" + "bool subgroupAllEqual(vec2);\n" + "bool subgroupAllEqual(vec3);\n" + "bool subgroupAllEqual(vec4);\n" + "bool subgroupAllEqual(int);\n" + "bool subgroupAllEqual(ivec2);\n" + "bool subgroupAllEqual(ivec3);\n" + "bool subgroupAllEqual(ivec4);\n" + "bool subgroupAllEqual(uint);\n" + "bool subgroupAllEqual(uvec2);\n" + "bool subgroupAllEqual(uvec3);\n" + "bool subgroupAllEqual(uvec4);\n" + "bool subgroupAllEqual(bool);\n" + "bool subgroupAllEqual(bvec2);\n" + "bool subgroupAllEqual(bvec3);\n" + "bool subgroupAllEqual(bvec4);\n" + + "float subgroupBroadcast(float, uint);\n" + "vec2 subgroupBroadcast(vec2, uint);\n" + "vec3 subgroupBroadcast(vec3, uint);\n" + "vec4 subgroupBroadcast(vec4, uint);\n" + "int subgroupBroadcast(int, uint);\n" + "ivec2 subgroupBroadcast(ivec2, uint);\n" + "ivec3 subgroupBroadcast(ivec3, uint);\n" + "ivec4 subgroupBroadcast(ivec4, uint);\n" + "uint subgroupBroadcast(uint, uint);\n" + "uvec2 subgroupBroadcast(uvec2, uint);\n" + "uvec3 subgroupBroadcast(uvec3, uint);\n" + "uvec4 subgroupBroadcast(uvec4, uint);\n" + "bool subgroupBroadcast(bool, uint);\n" + "bvec2 subgroupBroadcast(bvec2, uint);\n" + "bvec3 subgroupBroadcast(bvec3, uint);\n" + "bvec4 subgroupBroadcast(bvec4, uint);\n" + + "float subgroupBroadcastFirst(float);\n" + "vec2 subgroupBroadcastFirst(vec2);\n" + "vec3 subgroupBroadcastFirst(vec3);\n" + "vec4 subgroupBroadcastFirst(vec4);\n" + "int subgroupBroadcastFirst(int);\n" + "ivec2 subgroupBroadcastFirst(ivec2);\n" + "ivec3 subgroupBroadcastFirst(ivec3);\n" + "ivec4 subgroupBroadcastFirst(ivec4);\n" + "uint subgroupBroadcastFirst(uint);\n" + "uvec2 subgroupBroadcastFirst(uvec2);\n" + "uvec3 subgroupBroadcastFirst(uvec3);\n" + "uvec4 subgroupBroadcastFirst(uvec4);\n" + "bool subgroupBroadcastFirst(bool);\n" + "bvec2 subgroupBroadcastFirst(bvec2);\n" + "bvec3 subgroupBroadcastFirst(bvec3);\n" + "bvec4 subgroupBroadcastFirst(bvec4);\n" + + "uvec4 subgroupBallot(bool);\n" + "bool subgroupInverseBallot(uvec4);\n" + "bool subgroupBallotBitExtract(uvec4, uint);\n" + "uint subgroupBallotBitCount(uvec4);\n" + "uint subgroupBallotInclusiveBitCount(uvec4);\n" + "uint subgroupBallotExclusiveBitCount(uvec4);\n" + "uint subgroupBallotFindLSB(uvec4);\n" + "uint subgroupBallotFindMSB(uvec4);\n" + + "float subgroupShuffle(float, uint);\n" + "vec2 subgroupShuffle(vec2, uint);\n" + "vec3 subgroupShuffle(vec3, uint);\n" + "vec4 subgroupShuffle(vec4, uint);\n" + "int subgroupShuffle(int, uint);\n" + "ivec2 subgroupShuffle(ivec2, uint);\n" + "ivec3 subgroupShuffle(ivec3, uint);\n" + "ivec4 subgroupShuffle(ivec4, uint);\n" + "uint subgroupShuffle(uint, uint);\n" + "uvec2 subgroupShuffle(uvec2, uint);\n" + "uvec3 subgroupShuffle(uvec3, uint);\n" + "uvec4 subgroupShuffle(uvec4, uint);\n" + "bool subgroupShuffle(bool, uint);\n" + "bvec2 subgroupShuffle(bvec2, uint);\n" + "bvec3 subgroupShuffle(bvec3, uint);\n" + "bvec4 subgroupShuffle(bvec4, uint);\n" + + "float subgroupShuffleXor(float, uint);\n" + "vec2 subgroupShuffleXor(vec2, uint);\n" + "vec3 subgroupShuffleXor(vec3, uint);\n" + "vec4 subgroupShuffleXor(vec4, uint);\n" + "int subgroupShuffleXor(int, uint);\n" + "ivec2 subgroupShuffleXor(ivec2, uint);\n" + "ivec3 subgroupShuffleXor(ivec3, uint);\n" + "ivec4 subgroupShuffleXor(ivec4, uint);\n" + "uint subgroupShuffleXor(uint, uint);\n" + "uvec2 subgroupShuffleXor(uvec2, uint);\n" + "uvec3 subgroupShuffleXor(uvec3, uint);\n" + "uvec4 subgroupShuffleXor(uvec4, uint);\n" + "bool subgroupShuffleXor(bool, uint);\n" + "bvec2 subgroupShuffleXor(bvec2, uint);\n" + "bvec3 subgroupShuffleXor(bvec3, uint);\n" + "bvec4 subgroupShuffleXor(bvec4, uint);\n" + + "float subgroupShuffleUp(float, uint delta);\n" + "vec2 subgroupShuffleUp(vec2, uint delta);\n" + "vec3 subgroupShuffleUp(vec3, uint delta);\n" + "vec4 subgroupShuffleUp(vec4, uint delta);\n" + "int subgroupShuffleUp(int, uint delta);\n" + "ivec2 subgroupShuffleUp(ivec2, uint delta);\n" + "ivec3 subgroupShuffleUp(ivec3, uint delta);\n" + "ivec4 subgroupShuffleUp(ivec4, uint delta);\n" + "uint subgroupShuffleUp(uint, uint delta);\n" + "uvec2 subgroupShuffleUp(uvec2, uint delta);\n" + "uvec3 subgroupShuffleUp(uvec3, uint delta);\n" + "uvec4 subgroupShuffleUp(uvec4, uint delta);\n" + "bool subgroupShuffleUp(bool, uint delta);\n" + "bvec2 subgroupShuffleUp(bvec2, uint delta);\n" + "bvec3 subgroupShuffleUp(bvec3, uint delta);\n" + "bvec4 subgroupShuffleUp(bvec4, uint delta);\n" + + "float subgroupShuffleDown(float, uint delta);\n" + "vec2 subgroupShuffleDown(vec2, uint delta);\n" + "vec3 subgroupShuffleDown(vec3, uint delta);\n" + "vec4 subgroupShuffleDown(vec4, uint delta);\n" + "int subgroupShuffleDown(int, uint delta);\n" + "ivec2 subgroupShuffleDown(ivec2, uint delta);\n" + "ivec3 subgroupShuffleDown(ivec3, uint delta);\n" + "ivec4 subgroupShuffleDown(ivec4, uint delta);\n" + "uint subgroupShuffleDown(uint, uint delta);\n" + "uvec2 subgroupShuffleDown(uvec2, uint delta);\n" + "uvec3 subgroupShuffleDown(uvec3, uint delta);\n" + "uvec4 subgroupShuffleDown(uvec4, uint delta);\n" + "bool subgroupShuffleDown(bool, uint delta);\n" + "bvec2 subgroupShuffleDown(bvec2, uint delta);\n" + "bvec3 subgroupShuffleDown(bvec3, uint delta);\n" + "bvec4 subgroupShuffleDown(bvec4, uint delta);\n" + + "float subgroupAdd(float);\n" + "vec2 subgroupAdd(vec2);\n" + "vec3 subgroupAdd(vec3);\n" + "vec4 subgroupAdd(vec4);\n" + "int subgroupAdd(int);\n" + "ivec2 subgroupAdd(ivec2);\n" + "ivec3 subgroupAdd(ivec3);\n" + "ivec4 subgroupAdd(ivec4);\n" + "uint subgroupAdd(uint);\n" + "uvec2 subgroupAdd(uvec2);\n" + "uvec3 subgroupAdd(uvec3);\n" + "uvec4 subgroupAdd(uvec4);\n" + + "float subgroupMul(float);\n" + "vec2 subgroupMul(vec2);\n" + "vec3 subgroupMul(vec3);\n" + "vec4 subgroupMul(vec4);\n" + "int subgroupMul(int);\n" + "ivec2 subgroupMul(ivec2);\n" + "ivec3 subgroupMul(ivec3);\n" + "ivec4 subgroupMul(ivec4);\n" + "uint subgroupMul(uint);\n" + "uvec2 subgroupMul(uvec2);\n" + "uvec3 subgroupMul(uvec3);\n" + "uvec4 subgroupMul(uvec4);\n" + + "float subgroupMin(float);\n" + "vec2 subgroupMin(vec2);\n" + "vec3 subgroupMin(vec3);\n" + "vec4 subgroupMin(vec4);\n" + "int subgroupMin(int);\n" + "ivec2 subgroupMin(ivec2);\n" + "ivec3 subgroupMin(ivec3);\n" + "ivec4 subgroupMin(ivec4);\n" + "uint subgroupMin(uint);\n" + "uvec2 subgroupMin(uvec2);\n" + "uvec3 subgroupMin(uvec3);\n" + "uvec4 subgroupMin(uvec4);\n" + + "float subgroupMax(float);\n" + "vec2 subgroupMax(vec2);\n" + "vec3 subgroupMax(vec3);\n" + "vec4 subgroupMax(vec4);\n" + "int subgroupMax(int);\n" + "ivec2 subgroupMax(ivec2);\n" + "ivec3 subgroupMax(ivec3);\n" + "ivec4 subgroupMax(ivec4);\n" + "uint subgroupMax(uint);\n" + "uvec2 subgroupMax(uvec2);\n" + "uvec3 subgroupMax(uvec3);\n" + "uvec4 subgroupMax(uvec4);\n" + + "int subgroupAnd(int);\n" + "ivec2 subgroupAnd(ivec2);\n" + "ivec3 subgroupAnd(ivec3);\n" + "ivec4 subgroupAnd(ivec4);\n" + "uint subgroupAnd(uint);\n" + "uvec2 subgroupAnd(uvec2);\n" + "uvec3 subgroupAnd(uvec3);\n" + "uvec4 subgroupAnd(uvec4);\n" + "bool subgroupAnd(bool);\n" + "bvec2 subgroupAnd(bvec2);\n" + "bvec3 subgroupAnd(bvec3);\n" + "bvec4 subgroupAnd(bvec4);\n" + + "int subgroupOr(int);\n" + "ivec2 subgroupOr(ivec2);\n" + "ivec3 subgroupOr(ivec3);\n" + "ivec4 subgroupOr(ivec4);\n" + "uint subgroupOr(uint);\n" + "uvec2 subgroupOr(uvec2);\n" + "uvec3 subgroupOr(uvec3);\n" + "uvec4 subgroupOr(uvec4);\n" + "bool subgroupOr(bool);\n" + "bvec2 subgroupOr(bvec2);\n" + "bvec3 subgroupOr(bvec3);\n" + "bvec4 subgroupOr(bvec4);\n" + + "int subgroupXor(int);\n" + "ivec2 subgroupXor(ivec2);\n" + "ivec3 subgroupXor(ivec3);\n" + "ivec4 subgroupXor(ivec4);\n" + "uint subgroupXor(uint);\n" + "uvec2 subgroupXor(uvec2);\n" + "uvec3 subgroupXor(uvec3);\n" + "uvec4 subgroupXor(uvec4);\n" + "bool subgroupXor(bool);\n" + "bvec2 subgroupXor(bvec2);\n" + "bvec3 subgroupXor(bvec3);\n" + "bvec4 subgroupXor(bvec4);\n" + + "float subgroupInclusiveAdd(float);\n" + "vec2 subgroupInclusiveAdd(vec2);\n" + "vec3 subgroupInclusiveAdd(vec3);\n" + "vec4 subgroupInclusiveAdd(vec4);\n" + "int subgroupInclusiveAdd(int);\n" + "ivec2 subgroupInclusiveAdd(ivec2);\n" + "ivec3 subgroupInclusiveAdd(ivec3);\n" + "ivec4 subgroupInclusiveAdd(ivec4);\n" + "uint subgroupInclusiveAdd(uint);\n" + "uvec2 subgroupInclusiveAdd(uvec2);\n" + "uvec3 subgroupInclusiveAdd(uvec3);\n" + "uvec4 subgroupInclusiveAdd(uvec4);\n" + + "float subgroupInclusiveMul(float);\n" + "vec2 subgroupInclusiveMul(vec2);\n" + "vec3 subgroupInclusiveMul(vec3);\n" + "vec4 subgroupInclusiveMul(vec4);\n" + "int subgroupInclusiveMul(int);\n" + "ivec2 subgroupInclusiveMul(ivec2);\n" + "ivec3 subgroupInclusiveMul(ivec3);\n" + "ivec4 subgroupInclusiveMul(ivec4);\n" + "uint subgroupInclusiveMul(uint);\n" + "uvec2 subgroupInclusiveMul(uvec2);\n" + "uvec3 subgroupInclusiveMul(uvec3);\n" + "uvec4 subgroupInclusiveMul(uvec4);\n" + + "float subgroupInclusiveMin(float);\n" + "vec2 subgroupInclusiveMin(vec2);\n" + "vec3 subgroupInclusiveMin(vec3);\n" + "vec4 subgroupInclusiveMin(vec4);\n" + "int subgroupInclusiveMin(int);\n" + "ivec2 subgroupInclusiveMin(ivec2);\n" + "ivec3 subgroupInclusiveMin(ivec3);\n" + "ivec4 subgroupInclusiveMin(ivec4);\n" + "uint subgroupInclusiveMin(uint);\n" + "uvec2 subgroupInclusiveMin(uvec2);\n" + "uvec3 subgroupInclusiveMin(uvec3);\n" + "uvec4 subgroupInclusiveMin(uvec4);\n" + + "float subgroupInclusiveMax(float);\n" + "vec2 subgroupInclusiveMax(vec2);\n" + "vec3 subgroupInclusiveMax(vec3);\n" + "vec4 subgroupInclusiveMax(vec4);\n" + "int subgroupInclusiveMax(int);\n" + "ivec2 subgroupInclusiveMax(ivec2);\n" + "ivec3 subgroupInclusiveMax(ivec3);\n" + "ivec4 subgroupInclusiveMax(ivec4);\n" + "uint subgroupInclusiveMax(uint);\n" + "uvec2 subgroupInclusiveMax(uvec2);\n" + "uvec3 subgroupInclusiveMax(uvec3);\n" + "uvec4 subgroupInclusiveMax(uvec4);\n" + + "int subgroupInclusiveAnd(int);\n" + "ivec2 subgroupInclusiveAnd(ivec2);\n" + "ivec3 subgroupInclusiveAnd(ivec3);\n" + "ivec4 subgroupInclusiveAnd(ivec4);\n" + "uint subgroupInclusiveAnd(uint);\n" + "uvec2 subgroupInclusiveAnd(uvec2);\n" + "uvec3 subgroupInclusiveAnd(uvec3);\n" + "uvec4 subgroupInclusiveAnd(uvec4);\n" + "bool subgroupInclusiveAnd(bool);\n" + "bvec2 subgroupInclusiveAnd(bvec2);\n" + "bvec3 subgroupInclusiveAnd(bvec3);\n" + "bvec4 subgroupInclusiveAnd(bvec4);\n" + + "int subgroupInclusiveOr(int);\n" + "ivec2 subgroupInclusiveOr(ivec2);\n" + "ivec3 subgroupInclusiveOr(ivec3);\n" + "ivec4 subgroupInclusiveOr(ivec4);\n" + "uint subgroupInclusiveOr(uint);\n" + "uvec2 subgroupInclusiveOr(uvec2);\n" + "uvec3 subgroupInclusiveOr(uvec3);\n" + "uvec4 subgroupInclusiveOr(uvec4);\n" + "bool subgroupInclusiveOr(bool);\n" + "bvec2 subgroupInclusiveOr(bvec2);\n" + "bvec3 subgroupInclusiveOr(bvec3);\n" + "bvec4 subgroupInclusiveOr(bvec4);\n" + + "int subgroupInclusiveXor(int);\n" + "ivec2 subgroupInclusiveXor(ivec2);\n" + "ivec3 subgroupInclusiveXor(ivec3);\n" + "ivec4 subgroupInclusiveXor(ivec4);\n" + "uint subgroupInclusiveXor(uint);\n" + "uvec2 subgroupInclusiveXor(uvec2);\n" + "uvec3 subgroupInclusiveXor(uvec3);\n" + "uvec4 subgroupInclusiveXor(uvec4);\n" + "bool subgroupInclusiveXor(bool);\n" + "bvec2 subgroupInclusiveXor(bvec2);\n" + "bvec3 subgroupInclusiveXor(bvec3);\n" + "bvec4 subgroupInclusiveXor(bvec4);\n" + + "float subgroupExclusiveAdd(float);\n" + "vec2 subgroupExclusiveAdd(vec2);\n" + "vec3 subgroupExclusiveAdd(vec3);\n" + "vec4 subgroupExclusiveAdd(vec4);\n" + "int subgroupExclusiveAdd(int);\n" + "ivec2 subgroupExclusiveAdd(ivec2);\n" + "ivec3 subgroupExclusiveAdd(ivec3);\n" + "ivec4 subgroupExclusiveAdd(ivec4);\n" + "uint subgroupExclusiveAdd(uint);\n" + "uvec2 subgroupExclusiveAdd(uvec2);\n" + "uvec3 subgroupExclusiveAdd(uvec3);\n" + "uvec4 subgroupExclusiveAdd(uvec4);\n" + + "float subgroupExclusiveMul(float);\n" + "vec2 subgroupExclusiveMul(vec2);\n" + "vec3 subgroupExclusiveMul(vec3);\n" + "vec4 subgroupExclusiveMul(vec4);\n" + "int subgroupExclusiveMul(int);\n" + "ivec2 subgroupExclusiveMul(ivec2);\n" + "ivec3 subgroupExclusiveMul(ivec3);\n" + "ivec4 subgroupExclusiveMul(ivec4);\n" + "uint subgroupExclusiveMul(uint);\n" + "uvec2 subgroupExclusiveMul(uvec2);\n" + "uvec3 subgroupExclusiveMul(uvec3);\n" + "uvec4 subgroupExclusiveMul(uvec4);\n" + + "float subgroupExclusiveMin(float);\n" + "vec2 subgroupExclusiveMin(vec2);\n" + "vec3 subgroupExclusiveMin(vec3);\n" + "vec4 subgroupExclusiveMin(vec4);\n" + "int subgroupExclusiveMin(int);\n" + "ivec2 subgroupExclusiveMin(ivec2);\n" + "ivec3 subgroupExclusiveMin(ivec3);\n" + "ivec4 subgroupExclusiveMin(ivec4);\n" + "uint subgroupExclusiveMin(uint);\n" + "uvec2 subgroupExclusiveMin(uvec2);\n" + "uvec3 subgroupExclusiveMin(uvec3);\n" + "uvec4 subgroupExclusiveMin(uvec4);\n" + + "float subgroupExclusiveMax(float);\n" + "vec2 subgroupExclusiveMax(vec2);\n" + "vec3 subgroupExclusiveMax(vec3);\n" + "vec4 subgroupExclusiveMax(vec4);\n" + "int subgroupExclusiveMax(int);\n" + "ivec2 subgroupExclusiveMax(ivec2);\n" + "ivec3 subgroupExclusiveMax(ivec3);\n" + "ivec4 subgroupExclusiveMax(ivec4);\n" + "uint subgroupExclusiveMax(uint);\n" + "uvec2 subgroupExclusiveMax(uvec2);\n" + "uvec3 subgroupExclusiveMax(uvec3);\n" + "uvec4 subgroupExclusiveMax(uvec4);\n" + + "int subgroupExclusiveAnd(int);\n" + "ivec2 subgroupExclusiveAnd(ivec2);\n" + "ivec3 subgroupExclusiveAnd(ivec3);\n" + "ivec4 subgroupExclusiveAnd(ivec4);\n" + "uint subgroupExclusiveAnd(uint);\n" + "uvec2 subgroupExclusiveAnd(uvec2);\n" + "uvec3 subgroupExclusiveAnd(uvec3);\n" + "uvec4 subgroupExclusiveAnd(uvec4);\n" + "bool subgroupExclusiveAnd(bool);\n" + "bvec2 subgroupExclusiveAnd(bvec2);\n" + "bvec3 subgroupExclusiveAnd(bvec3);\n" + "bvec4 subgroupExclusiveAnd(bvec4);\n" + + "int subgroupExclusiveOr(int);\n" + "ivec2 subgroupExclusiveOr(ivec2);\n" + "ivec3 subgroupExclusiveOr(ivec3);\n" + "ivec4 subgroupExclusiveOr(ivec4);\n" + "uint subgroupExclusiveOr(uint);\n" + "uvec2 subgroupExclusiveOr(uvec2);\n" + "uvec3 subgroupExclusiveOr(uvec3);\n" + "uvec4 subgroupExclusiveOr(uvec4);\n" + "bool subgroupExclusiveOr(bool);\n" + "bvec2 subgroupExclusiveOr(bvec2);\n" + "bvec3 subgroupExclusiveOr(bvec3);\n" + "bvec4 subgroupExclusiveOr(bvec4);\n" + + "int subgroupExclusiveXor(int);\n" + "ivec2 subgroupExclusiveXor(ivec2);\n" + "ivec3 subgroupExclusiveXor(ivec3);\n" + "ivec4 subgroupExclusiveXor(ivec4);\n" + "uint subgroupExclusiveXor(uint);\n" + "uvec2 subgroupExclusiveXor(uvec2);\n" + "uvec3 subgroupExclusiveXor(uvec3);\n" + "uvec4 subgroupExclusiveXor(uvec4);\n" + "bool subgroupExclusiveXor(bool);\n" + "bvec2 subgroupExclusiveXor(bvec2);\n" + "bvec3 subgroupExclusiveXor(bvec3);\n" + "bvec4 subgroupExclusiveXor(bvec4);\n" + + "float subgroupClusteredAdd(float, uint);\n" + "vec2 subgroupClusteredAdd(vec2, uint);\n" + "vec3 subgroupClusteredAdd(vec3, uint);\n" + "vec4 subgroupClusteredAdd(vec4, uint);\n" + "int subgroupClusteredAdd(int, uint);\n" + "ivec2 subgroupClusteredAdd(ivec2, uint);\n" + "ivec3 subgroupClusteredAdd(ivec3, uint);\n" + "ivec4 subgroupClusteredAdd(ivec4, uint);\n" + "uint subgroupClusteredAdd(uint, uint);\n" + "uvec2 subgroupClusteredAdd(uvec2, uint);\n" + "uvec3 subgroupClusteredAdd(uvec3, uint);\n" + "uvec4 subgroupClusteredAdd(uvec4, uint);\n" + + "float subgroupClusteredMul(float, uint);\n" + "vec2 subgroupClusteredMul(vec2, uint);\n" + "vec3 subgroupClusteredMul(vec3, uint);\n" + "vec4 subgroupClusteredMul(vec4, uint);\n" + "int subgroupClusteredMul(int, uint);\n" + "ivec2 subgroupClusteredMul(ivec2, uint);\n" + "ivec3 subgroupClusteredMul(ivec3, uint);\n" + "ivec4 subgroupClusteredMul(ivec4, uint);\n" + "uint subgroupClusteredMul(uint, uint);\n" + "uvec2 subgroupClusteredMul(uvec2, uint);\n" + "uvec3 subgroupClusteredMul(uvec3, uint);\n" + "uvec4 subgroupClusteredMul(uvec4, uint);\n" + + "float subgroupClusteredMin(float, uint);\n" + "vec2 subgroupClusteredMin(vec2, uint);\n" + "vec3 subgroupClusteredMin(vec3, uint);\n" + "vec4 subgroupClusteredMin(vec4, uint);\n" + "int subgroupClusteredMin(int, uint);\n" + "ivec2 subgroupClusteredMin(ivec2, uint);\n" + "ivec3 subgroupClusteredMin(ivec3, uint);\n" + "ivec4 subgroupClusteredMin(ivec4, uint);\n" + "uint subgroupClusteredMin(uint, uint);\n" + "uvec2 subgroupClusteredMin(uvec2, uint);\n" + "uvec3 subgroupClusteredMin(uvec3, uint);\n" + "uvec4 subgroupClusteredMin(uvec4, uint);\n" + + "float subgroupClusteredMax(float, uint);\n" + "vec2 subgroupClusteredMax(vec2, uint);\n" + "vec3 subgroupClusteredMax(vec3, uint);\n" + "vec4 subgroupClusteredMax(vec4, uint);\n" + "int subgroupClusteredMax(int, uint);\n" + "ivec2 subgroupClusteredMax(ivec2, uint);\n" + "ivec3 subgroupClusteredMax(ivec3, uint);\n" + "ivec4 subgroupClusteredMax(ivec4, uint);\n" + "uint subgroupClusteredMax(uint, uint);\n" + "uvec2 subgroupClusteredMax(uvec2, uint);\n" + "uvec3 subgroupClusteredMax(uvec3, uint);\n" + "uvec4 subgroupClusteredMax(uvec4, uint);\n" + + "int subgroupClusteredAnd(int, uint);\n" + "ivec2 subgroupClusteredAnd(ivec2, uint);\n" + "ivec3 subgroupClusteredAnd(ivec3, uint);\n" + "ivec4 subgroupClusteredAnd(ivec4, uint);\n" + "uint subgroupClusteredAnd(uint, uint);\n" + "uvec2 subgroupClusteredAnd(uvec2, uint);\n" + "uvec3 subgroupClusteredAnd(uvec3, uint);\n" + "uvec4 subgroupClusteredAnd(uvec4, uint);\n" + "bool subgroupClusteredAnd(bool, uint);\n" + "bvec2 subgroupClusteredAnd(bvec2, uint);\n" + "bvec3 subgroupClusteredAnd(bvec3, uint);\n" + "bvec4 subgroupClusteredAnd(bvec4, uint);\n" + + "int subgroupClusteredOr(int, uint);\n" + "ivec2 subgroupClusteredOr(ivec2, uint);\n" + "ivec3 subgroupClusteredOr(ivec3, uint);\n" + "ivec4 subgroupClusteredOr(ivec4, uint);\n" + "uint subgroupClusteredOr(uint, uint);\n" + "uvec2 subgroupClusteredOr(uvec2, uint);\n" + "uvec3 subgroupClusteredOr(uvec3, uint);\n" + "uvec4 subgroupClusteredOr(uvec4, uint);\n" + "bool subgroupClusteredOr(bool, uint);\n" + "bvec2 subgroupClusteredOr(bvec2, uint);\n" + "bvec3 subgroupClusteredOr(bvec3, uint);\n" + "bvec4 subgroupClusteredOr(bvec4, uint);\n" + + "int subgroupClusteredXor(int, uint);\n" + "ivec2 subgroupClusteredXor(ivec2, uint);\n" + "ivec3 subgroupClusteredXor(ivec3, uint);\n" + "ivec4 subgroupClusteredXor(ivec4, uint);\n" + "uint subgroupClusteredXor(uint, uint);\n" + "uvec2 subgroupClusteredXor(uvec2, uint);\n" + "uvec3 subgroupClusteredXor(uvec3, uint);\n" + "uvec4 subgroupClusteredXor(uvec4, uint);\n" + "bool subgroupClusteredXor(bool, uint);\n" + "bvec2 subgroupClusteredXor(bvec2, uint);\n" + "bvec3 subgroupClusteredXor(bvec3, uint);\n" + "bvec4 subgroupClusteredXor(bvec4, uint);\n" + + "float subgroupQuadBroadcast(float, uint);\n" + "vec2 subgroupQuadBroadcast(vec2, uint);\n" + "vec3 subgroupQuadBroadcast(vec3, uint);\n" + "vec4 subgroupQuadBroadcast(vec4, uint);\n" + "int subgroupQuadBroadcast(int, uint);\n" + "ivec2 subgroupQuadBroadcast(ivec2, uint);\n" + "ivec3 subgroupQuadBroadcast(ivec3, uint);\n" + "ivec4 subgroupQuadBroadcast(ivec4, uint);\n" + "uint subgroupQuadBroadcast(uint, uint);\n" + "uvec2 subgroupQuadBroadcast(uvec2, uint);\n" + "uvec3 subgroupQuadBroadcast(uvec3, uint);\n" + "uvec4 subgroupQuadBroadcast(uvec4, uint);\n" + "bool subgroupQuadBroadcast(bool, uint);\n" + "bvec2 subgroupQuadBroadcast(bvec2, uint);\n" + "bvec3 subgroupQuadBroadcast(bvec3, uint);\n" + "bvec4 subgroupQuadBroadcast(bvec4, uint);\n" + + "float subgroupQuadSwapHorizontal(float);\n" + "vec2 subgroupQuadSwapHorizontal(vec2);\n" + "vec3 subgroupQuadSwapHorizontal(vec3);\n" + "vec4 subgroupQuadSwapHorizontal(vec4);\n" + "int subgroupQuadSwapHorizontal(int);\n" + "ivec2 subgroupQuadSwapHorizontal(ivec2);\n" + "ivec3 subgroupQuadSwapHorizontal(ivec3);\n" + "ivec4 subgroupQuadSwapHorizontal(ivec4);\n" + "uint subgroupQuadSwapHorizontal(uint);\n" + "uvec2 subgroupQuadSwapHorizontal(uvec2);\n" + "uvec3 subgroupQuadSwapHorizontal(uvec3);\n" + "uvec4 subgroupQuadSwapHorizontal(uvec4);\n" + "bool subgroupQuadSwapHorizontal(bool);\n" + "bvec2 subgroupQuadSwapHorizontal(bvec2);\n" + "bvec3 subgroupQuadSwapHorizontal(bvec3);\n" + "bvec4 subgroupQuadSwapHorizontal(bvec4);\n" + + "float subgroupQuadSwapVertical(float);\n" + "vec2 subgroupQuadSwapVertical(vec2);\n" + "vec3 subgroupQuadSwapVertical(vec3);\n" + "vec4 subgroupQuadSwapVertical(vec4);\n" + "int subgroupQuadSwapVertical(int);\n" + "ivec2 subgroupQuadSwapVertical(ivec2);\n" + "ivec3 subgroupQuadSwapVertical(ivec3);\n" + "ivec4 subgroupQuadSwapVertical(ivec4);\n" + "uint subgroupQuadSwapVertical(uint);\n" + "uvec2 subgroupQuadSwapVertical(uvec2);\n" + "uvec3 subgroupQuadSwapVertical(uvec3);\n" + "uvec4 subgroupQuadSwapVertical(uvec4);\n" + "bool subgroupQuadSwapVertical(bool);\n" + "bvec2 subgroupQuadSwapVertical(bvec2);\n" + "bvec3 subgroupQuadSwapVertical(bvec3);\n" + "bvec4 subgroupQuadSwapVertical(bvec4);\n" + + "float subgroupQuadSwapDiagonal(float);\n" + "vec2 subgroupQuadSwapDiagonal(vec2);\n" + "vec3 subgroupQuadSwapDiagonal(vec3);\n" + "vec4 subgroupQuadSwapDiagonal(vec4);\n" + "int subgroupQuadSwapDiagonal(int);\n" + "ivec2 subgroupQuadSwapDiagonal(ivec2);\n" + "ivec3 subgroupQuadSwapDiagonal(ivec3);\n" + "ivec4 subgroupQuadSwapDiagonal(ivec4);\n" + "uint subgroupQuadSwapDiagonal(uint);\n" + "uvec2 subgroupQuadSwapDiagonal(uvec2);\n" + "uvec3 subgroupQuadSwapDiagonal(uvec3);\n" + "uvec4 subgroupQuadSwapDiagonal(uvec4);\n" + "bool subgroupQuadSwapDiagonal(bool);\n" + "bvec2 subgroupQuadSwapDiagonal(bvec2);\n" + "bvec3 subgroupQuadSwapDiagonal(bvec3);\n" + "bvec4 subgroupQuadSwapDiagonal(bvec4);\n" + +#ifdef NV_EXTENSIONS + "uvec4 subgroupPartitionNV(float);\n" + "uvec4 subgroupPartitionNV(vec2);\n" + "uvec4 subgroupPartitionNV(vec3);\n" + "uvec4 subgroupPartitionNV(vec4);\n" + "uvec4 subgroupPartitionNV(int);\n" + "uvec4 subgroupPartitionNV(ivec2);\n" + "uvec4 subgroupPartitionNV(ivec3);\n" + "uvec4 subgroupPartitionNV(ivec4);\n" + "uvec4 subgroupPartitionNV(uint);\n" + "uvec4 subgroupPartitionNV(uvec2);\n" + "uvec4 subgroupPartitionNV(uvec3);\n" + "uvec4 subgroupPartitionNV(uvec4);\n" + "uvec4 subgroupPartitionNV(bool);\n" + "uvec4 subgroupPartitionNV(bvec2);\n" + "uvec4 subgroupPartitionNV(bvec3);\n" + "uvec4 subgroupPartitionNV(bvec4);\n" + + "float subgroupPartitionedAddNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedAddNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedAddNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedAddNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedAddNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedAddNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedAddNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedAddNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedAddNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedAddNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedAddNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedAddNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedMulNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedMulNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedMulNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedMulNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedMulNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedMulNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedMulNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedMulNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedMulNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedMulNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedMulNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedMulNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedMinNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedMinNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedMinNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedMinNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedMinNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedMinNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedMinNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedMinNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedMinNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedMinNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedMinNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedMinNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedMaxNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedMaxNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedMaxNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedMaxNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedMaxNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedMaxNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedMaxNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedMaxNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedMaxNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedMaxNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedMaxNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedMaxNV(uvec4, uvec4 ballot);\n" + + "int subgroupPartitionedAndNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedAndNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedAndNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedAndNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedAndNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedAndNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedAndNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedAndNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedAndNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedAndNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedAndNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedAndNV(bvec4, uvec4 ballot);\n" + + "int subgroupPartitionedOrNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedOrNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedOrNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedOrNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedOrNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedOrNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedOrNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedOrNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedOrNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedOrNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedOrNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedOrNV(bvec4, uvec4 ballot);\n" + + "int subgroupPartitionedXorNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedXorNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedXorNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedXorNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedXorNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedXorNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedXorNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedXorNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedXorNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedXorNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedXorNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedXorNV(bvec4, uvec4 ballot);\n" + + "float subgroupPartitionedInclusiveAddNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedInclusiveAddNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedInclusiveAddNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedInclusiveAddNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedInclusiveAddNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveAddNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveAddNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveAddNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveAddNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveAddNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveAddNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveAddNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedInclusiveMulNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedInclusiveMulNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedInclusiveMulNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedInclusiveMulNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedInclusiveMulNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveMulNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveMulNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveMulNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveMulNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveMulNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveMulNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveMulNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedInclusiveMinNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedInclusiveMinNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedInclusiveMinNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedInclusiveMinNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedInclusiveMinNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveMinNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveMinNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveMinNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveMinNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveMinNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveMinNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveMinNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedInclusiveMaxNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedInclusiveMaxNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedInclusiveMaxNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedInclusiveMaxNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedInclusiveMaxNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveMaxNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveMaxNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveMaxNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveMaxNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveMaxNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveMaxNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveMaxNV(uvec4, uvec4 ballot);\n" + + "int subgroupPartitionedInclusiveAndNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveAndNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveAndNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveAndNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveAndNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveAndNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveAndNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveAndNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedInclusiveAndNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedInclusiveAndNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedInclusiveAndNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedInclusiveAndNV(bvec4, uvec4 ballot);\n" + + "int subgroupPartitionedInclusiveOrNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveOrNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveOrNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveOrNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveOrNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveOrNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveOrNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveOrNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedInclusiveOrNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedInclusiveOrNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedInclusiveOrNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedInclusiveOrNV(bvec4, uvec4 ballot);\n" + + "int subgroupPartitionedInclusiveXorNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedInclusiveXorNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedInclusiveXorNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedInclusiveXorNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedInclusiveXorNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedInclusiveXorNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedInclusiveXorNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedInclusiveXorNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedInclusiveXorNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedInclusiveXorNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedInclusiveXorNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedInclusiveXorNV(bvec4, uvec4 ballot);\n" + + "float subgroupPartitionedExclusiveAddNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedExclusiveAddNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedExclusiveAddNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedExclusiveAddNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedExclusiveAddNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveAddNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveAddNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveAddNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveAddNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveAddNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveAddNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveAddNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedExclusiveMulNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedExclusiveMulNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedExclusiveMulNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedExclusiveMulNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedExclusiveMulNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveMulNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveMulNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveMulNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveMulNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveMulNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveMulNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveMulNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedExclusiveMinNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedExclusiveMinNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedExclusiveMinNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedExclusiveMinNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedExclusiveMinNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveMinNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveMinNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveMinNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveMinNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveMinNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveMinNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveMinNV(uvec4, uvec4 ballot);\n" + + "float subgroupPartitionedExclusiveMaxNV(float, uvec4 ballot);\n" + "vec2 subgroupPartitionedExclusiveMaxNV(vec2, uvec4 ballot);\n" + "vec3 subgroupPartitionedExclusiveMaxNV(vec3, uvec4 ballot);\n" + "vec4 subgroupPartitionedExclusiveMaxNV(vec4, uvec4 ballot);\n" + "int subgroupPartitionedExclusiveMaxNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveMaxNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveMaxNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveMaxNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveMaxNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveMaxNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveMaxNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveMaxNV(uvec4, uvec4 ballot);\n" + + "int subgroupPartitionedExclusiveAndNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveAndNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveAndNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveAndNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveAndNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveAndNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveAndNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveAndNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedExclusiveAndNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedExclusiveAndNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedExclusiveAndNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedExclusiveAndNV(bvec4, uvec4 ballot);\n" + + "int subgroupPartitionedExclusiveOrNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveOrNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveOrNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveOrNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveOrNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveOrNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveOrNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveOrNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedExclusiveOrNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedExclusiveOrNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedExclusiveOrNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedExclusiveOrNV(bvec4, uvec4 ballot);\n" + + "int subgroupPartitionedExclusiveXorNV(int, uvec4 ballot);\n" + "ivec2 subgroupPartitionedExclusiveXorNV(ivec2, uvec4 ballot);\n" + "ivec3 subgroupPartitionedExclusiveXorNV(ivec3, uvec4 ballot);\n" + "ivec4 subgroupPartitionedExclusiveXorNV(ivec4, uvec4 ballot);\n" + "uint subgroupPartitionedExclusiveXorNV(uint, uvec4 ballot);\n" + "uvec2 subgroupPartitionedExclusiveXorNV(uvec2, uvec4 ballot);\n" + "uvec3 subgroupPartitionedExclusiveXorNV(uvec3, uvec4 ballot);\n" + "uvec4 subgroupPartitionedExclusiveXorNV(uvec4, uvec4 ballot);\n" + "bool subgroupPartitionedExclusiveXorNV(bool, uvec4 ballot);\n" + "bvec2 subgroupPartitionedExclusiveXorNV(bvec2, uvec4 ballot);\n" + "bvec3 subgroupPartitionedExclusiveXorNV(bvec3, uvec4 ballot);\n" + "bvec4 subgroupPartitionedExclusiveXorNV(bvec4, uvec4 ballot);\n" +#endif + + "\n"); + + if (profile != EEsProfile && version >= 400) { + commonBuiltins.append( + "bool subgroupAllEqual(double);\n" + "bool subgroupAllEqual(dvec2);\n" + "bool subgroupAllEqual(dvec3);\n" + "bool subgroupAllEqual(dvec4);\n" + + "double subgroupBroadcast(double, uint);\n" + "dvec2 subgroupBroadcast(dvec2, uint);\n" + "dvec3 subgroupBroadcast(dvec3, uint);\n" + "dvec4 subgroupBroadcast(dvec4, uint);\n" + + "double subgroupBroadcastFirst(double);\n" + "dvec2 subgroupBroadcastFirst(dvec2);\n" + "dvec3 subgroupBroadcastFirst(dvec3);\n" + "dvec4 subgroupBroadcastFirst(dvec4);\n" + + "double subgroupShuffle(double, uint);\n" + "dvec2 subgroupShuffle(dvec2, uint);\n" + "dvec3 subgroupShuffle(dvec3, uint);\n" + "dvec4 subgroupShuffle(dvec4, uint);\n" + + "double subgroupShuffleXor(double, uint);\n" + "dvec2 subgroupShuffleXor(dvec2, uint);\n" + "dvec3 subgroupShuffleXor(dvec3, uint);\n" + "dvec4 subgroupShuffleXor(dvec4, uint);\n" + + "double subgroupShuffleUp(double, uint delta);\n" + "dvec2 subgroupShuffleUp(dvec2, uint delta);\n" + "dvec3 subgroupShuffleUp(dvec3, uint delta);\n" + "dvec4 subgroupShuffleUp(dvec4, uint delta);\n" + + "double subgroupShuffleDown(double, uint delta);\n" + "dvec2 subgroupShuffleDown(dvec2, uint delta);\n" + "dvec3 subgroupShuffleDown(dvec3, uint delta);\n" + "dvec4 subgroupShuffleDown(dvec4, uint delta);\n" + + "double subgroupAdd(double);\n" + "dvec2 subgroupAdd(dvec2);\n" + "dvec3 subgroupAdd(dvec3);\n" + "dvec4 subgroupAdd(dvec4);\n" + + "double subgroupMul(double);\n" + "dvec2 subgroupMul(dvec2);\n" + "dvec3 subgroupMul(dvec3);\n" + "dvec4 subgroupMul(dvec4);\n" + + "double subgroupMin(double);\n" + "dvec2 subgroupMin(dvec2);\n" + "dvec3 subgroupMin(dvec3);\n" + "dvec4 subgroupMin(dvec4);\n" + + "double subgroupMax(double);\n" + "dvec2 subgroupMax(dvec2);\n" + "dvec3 subgroupMax(dvec3);\n" + "dvec4 subgroupMax(dvec4);\n" + + "double subgroupInclusiveAdd(double);\n" + "dvec2 subgroupInclusiveAdd(dvec2);\n" + "dvec3 subgroupInclusiveAdd(dvec3);\n" + "dvec4 subgroupInclusiveAdd(dvec4);\n" + + "double subgroupInclusiveMul(double);\n" + "dvec2 subgroupInclusiveMul(dvec2);\n" + "dvec3 subgroupInclusiveMul(dvec3);\n" + "dvec4 subgroupInclusiveMul(dvec4);\n" + + "double subgroupInclusiveMin(double);\n" + "dvec2 subgroupInclusiveMin(dvec2);\n" + "dvec3 subgroupInclusiveMin(dvec3);\n" + "dvec4 subgroupInclusiveMin(dvec4);\n" + + "double subgroupInclusiveMax(double);\n" + "dvec2 subgroupInclusiveMax(dvec2);\n" + "dvec3 subgroupInclusiveMax(dvec3);\n" + "dvec4 subgroupInclusiveMax(dvec4);\n" + + "double subgroupExclusiveAdd(double);\n" + "dvec2 subgroupExclusiveAdd(dvec2);\n" + "dvec3 subgroupExclusiveAdd(dvec3);\n" + "dvec4 subgroupExclusiveAdd(dvec4);\n" + + "double subgroupExclusiveMul(double);\n" + "dvec2 subgroupExclusiveMul(dvec2);\n" + "dvec3 subgroupExclusiveMul(dvec3);\n" + "dvec4 subgroupExclusiveMul(dvec4);\n" + + "double subgroupExclusiveMin(double);\n" + "dvec2 subgroupExclusiveMin(dvec2);\n" + "dvec3 subgroupExclusiveMin(dvec3);\n" + "dvec4 subgroupExclusiveMin(dvec4);\n" + + "double subgroupExclusiveMax(double);\n" + "dvec2 subgroupExclusiveMax(dvec2);\n" + "dvec3 subgroupExclusiveMax(dvec3);\n" + "dvec4 subgroupExclusiveMax(dvec4);\n" + + "double subgroupClusteredAdd(double, uint);\n" + "dvec2 subgroupClusteredAdd(dvec2, uint);\n" + "dvec3 subgroupClusteredAdd(dvec3, uint);\n" + "dvec4 subgroupClusteredAdd(dvec4, uint);\n" + + "double subgroupClusteredMul(double, uint);\n" + "dvec2 subgroupClusteredMul(dvec2, uint);\n" + "dvec3 subgroupClusteredMul(dvec3, uint);\n" + "dvec4 subgroupClusteredMul(dvec4, uint);\n" + + "double subgroupClusteredMin(double, uint);\n" + "dvec2 subgroupClusteredMin(dvec2, uint);\n" + "dvec3 subgroupClusteredMin(dvec3, uint);\n" + "dvec4 subgroupClusteredMin(dvec4, uint);\n" + + "double subgroupClusteredMax(double, uint);\n" + "dvec2 subgroupClusteredMax(dvec2, uint);\n" + "dvec3 subgroupClusteredMax(dvec3, uint);\n" + "dvec4 subgroupClusteredMax(dvec4, uint);\n" + + "double subgroupQuadBroadcast(double, uint);\n" + "dvec2 subgroupQuadBroadcast(dvec2, uint);\n" + "dvec3 subgroupQuadBroadcast(dvec3, uint);\n" + "dvec4 subgroupQuadBroadcast(dvec4, uint);\n" + + "double subgroupQuadSwapHorizontal(double);\n" + "dvec2 subgroupQuadSwapHorizontal(dvec2);\n" + "dvec3 subgroupQuadSwapHorizontal(dvec3);\n" + "dvec4 subgroupQuadSwapHorizontal(dvec4);\n" + + "double subgroupQuadSwapVertical(double);\n" + "dvec2 subgroupQuadSwapVertical(dvec2);\n" + "dvec3 subgroupQuadSwapVertical(dvec3);\n" + "dvec4 subgroupQuadSwapVertical(dvec4);\n" + + "double subgroupQuadSwapDiagonal(double);\n" + "dvec2 subgroupQuadSwapDiagonal(dvec2);\n" + "dvec3 subgroupQuadSwapDiagonal(dvec3);\n" + "dvec4 subgroupQuadSwapDiagonal(dvec4);\n" + + +#ifdef NV_EXTENSIONS + "uvec4 subgroupPartitionNV(double);\n" + "uvec4 subgroupPartitionNV(dvec2);\n" + "uvec4 subgroupPartitionNV(dvec3);\n" + "uvec4 subgroupPartitionNV(dvec4);\n" + + "double subgroupPartitionedAddNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedAddNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedAddNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedAddNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedMulNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedMulNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedMulNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedMulNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedMinNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedMinNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedMinNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedMinNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedMaxNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedMaxNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedMaxNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedMaxNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedInclusiveAddNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedInclusiveAddNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedInclusiveAddNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedInclusiveAddNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedInclusiveMulNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedInclusiveMulNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedInclusiveMulNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedInclusiveMulNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedInclusiveMinNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedInclusiveMinNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedInclusiveMinNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedInclusiveMinNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedInclusiveMaxNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedInclusiveMaxNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedInclusiveMaxNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedInclusiveMaxNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedExclusiveAddNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedExclusiveAddNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedExclusiveAddNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedExclusiveAddNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedExclusiveMulNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedExclusiveMulNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedExclusiveMulNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedExclusiveMulNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedExclusiveMinNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedExclusiveMinNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedExclusiveMinNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedExclusiveMinNV(dvec4, uvec4 ballot);\n" + + "double subgroupPartitionedExclusiveMaxNV(double, uvec4 ballot);\n" + "dvec2 subgroupPartitionedExclusiveMaxNV(dvec2, uvec4 ballot);\n" + "dvec3 subgroupPartitionedExclusiveMaxNV(dvec3, uvec4 ballot);\n" + "dvec4 subgroupPartitionedExclusiveMaxNV(dvec4, uvec4 ballot);\n" +#endif + + "\n"); + } + + stageBuiltins[EShLangCompute].append( + "void subgroupMemoryBarrierShared();" + + "\n" + ); +#ifdef NV_EXTENSIONS + stageBuiltins[EShLangMeshNV].append( + "void subgroupMemoryBarrierShared();" + "\n" + ); + stageBuiltins[EShLangTaskNV].append( + "void subgroupMemoryBarrierShared();" + "\n" + ); +#endif + } + if (profile != EEsProfile && version >= 460) { commonBuiltins.append( "bool anyInvocation(bool);" @@ -1675,6 +3001,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 minInvocationsAMD(f16vec3);" "f16vec4 minInvocationsAMD(f16vec4);" + "int16_t minInvocationsAMD(int16_t);" + "i16vec2 minInvocationsAMD(i16vec2);" + "i16vec3 minInvocationsAMD(i16vec3);" + "i16vec4 minInvocationsAMD(i16vec4);" + + "uint16_t minInvocationsAMD(uint16_t);" + "u16vec2 minInvocationsAMD(u16vec2);" + "u16vec3 minInvocationsAMD(u16vec3);" + "u16vec4 minInvocationsAMD(u16vec4);" + "float minInvocationsInclusiveScanAMD(float);" "vec2 minInvocationsInclusiveScanAMD(vec2);" "vec3 minInvocationsInclusiveScanAMD(vec3);" @@ -1710,6 +3046,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 minInvocationsInclusiveScanAMD(f16vec3);" "f16vec4 minInvocationsInclusiveScanAMD(f16vec4);" + "int16_t minInvocationsInclusiveScanAMD(int16_t);" + "i16vec2 minInvocationsInclusiveScanAMD(i16vec2);" + "i16vec3 minInvocationsInclusiveScanAMD(i16vec3);" + "i16vec4 minInvocationsInclusiveScanAMD(i16vec4);" + + "uint16_t minInvocationsInclusiveScanAMD(uint16_t);" + "u16vec2 minInvocationsInclusiveScanAMD(u16vec2);" + "u16vec3 minInvocationsInclusiveScanAMD(u16vec3);" + "u16vec4 minInvocationsInclusiveScanAMD(u16vec4);" + "float minInvocationsExclusiveScanAMD(float);" "vec2 minInvocationsExclusiveScanAMD(vec2);" "vec3 minInvocationsExclusiveScanAMD(vec3);" @@ -1745,6 +3091,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 minInvocationsExclusiveScanAMD(f16vec3);" "f16vec4 minInvocationsExclusiveScanAMD(f16vec4);" + "int16_t minInvocationsExclusiveScanAMD(int16_t);" + "i16vec2 minInvocationsExclusiveScanAMD(i16vec2);" + "i16vec3 minInvocationsExclusiveScanAMD(i16vec3);" + "i16vec4 minInvocationsExclusiveScanAMD(i16vec4);" + + "uint16_t minInvocationsExclusiveScanAMD(uint16_t);" + "u16vec2 minInvocationsExclusiveScanAMD(u16vec2);" + "u16vec3 minInvocationsExclusiveScanAMD(u16vec3);" + "u16vec4 minInvocationsExclusiveScanAMD(u16vec4);" + "float maxInvocationsAMD(float);" "vec2 maxInvocationsAMD(vec2);" "vec3 maxInvocationsAMD(vec3);" @@ -1780,6 +3136,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 maxInvocationsAMD(f16vec3);" "f16vec4 maxInvocationsAMD(f16vec4);" + "int16_t maxInvocationsAMD(int16_t);" + "i16vec2 maxInvocationsAMD(i16vec2);" + "i16vec3 maxInvocationsAMD(i16vec3);" + "i16vec4 maxInvocationsAMD(i16vec4);" + + "uint16_t maxInvocationsAMD(uint16_t);" + "u16vec2 maxInvocationsAMD(u16vec2);" + "u16vec3 maxInvocationsAMD(u16vec3);" + "u16vec4 maxInvocationsAMD(u16vec4);" + "float maxInvocationsInclusiveScanAMD(float);" "vec2 maxInvocationsInclusiveScanAMD(vec2);" "vec3 maxInvocationsInclusiveScanAMD(vec3);" @@ -1815,6 +3181,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 maxInvocationsInclusiveScanAMD(f16vec3);" "f16vec4 maxInvocationsInclusiveScanAMD(f16vec4);" + "int16_t maxInvocationsInclusiveScanAMD(int16_t);" + "i16vec2 maxInvocationsInclusiveScanAMD(i16vec2);" + "i16vec3 maxInvocationsInclusiveScanAMD(i16vec3);" + "i16vec4 maxInvocationsInclusiveScanAMD(i16vec4);" + + "uint16_t maxInvocationsInclusiveScanAMD(uint16_t);" + "u16vec2 maxInvocationsInclusiveScanAMD(u16vec2);" + "u16vec3 maxInvocationsInclusiveScanAMD(u16vec3);" + "u16vec4 maxInvocationsInclusiveScanAMD(u16vec4);" + "float maxInvocationsExclusiveScanAMD(float);" "vec2 maxInvocationsExclusiveScanAMD(vec2);" "vec3 maxInvocationsExclusiveScanAMD(vec3);" @@ -1850,6 +3226,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 maxInvocationsExclusiveScanAMD(f16vec3);" "f16vec4 maxInvocationsExclusiveScanAMD(f16vec4);" + "int16_t maxInvocationsExclusiveScanAMD(int16_t);" + "i16vec2 maxInvocationsExclusiveScanAMD(i16vec2);" + "i16vec3 maxInvocationsExclusiveScanAMD(i16vec3);" + "i16vec4 maxInvocationsExclusiveScanAMD(i16vec4);" + + "uint16_t maxInvocationsExclusiveScanAMD(uint16_t);" + "u16vec2 maxInvocationsExclusiveScanAMD(u16vec2);" + "u16vec3 maxInvocationsExclusiveScanAMD(u16vec3);" + "u16vec4 maxInvocationsExclusiveScanAMD(u16vec4);" + "float addInvocationsAMD(float);" "vec2 addInvocationsAMD(vec2);" "vec3 addInvocationsAMD(vec3);" @@ -1885,6 +3271,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 addInvocationsAMD(f16vec3);" "f16vec4 addInvocationsAMD(f16vec4);" + "int16_t addInvocationsAMD(int16_t);" + "i16vec2 addInvocationsAMD(i16vec2);" + "i16vec3 addInvocationsAMD(i16vec3);" + "i16vec4 addInvocationsAMD(i16vec4);" + + "uint16_t addInvocationsAMD(uint16_t);" + "u16vec2 addInvocationsAMD(u16vec2);" + "u16vec3 addInvocationsAMD(u16vec3);" + "u16vec4 addInvocationsAMD(u16vec4);" + "float addInvocationsInclusiveScanAMD(float);" "vec2 addInvocationsInclusiveScanAMD(vec2);" "vec3 addInvocationsInclusiveScanAMD(vec3);" @@ -1920,6 +3316,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 addInvocationsInclusiveScanAMD(f16vec3);" "f16vec4 addInvocationsInclusiveScanAMD(f16vec4);" + "int16_t addInvocationsInclusiveScanAMD(int16_t);" + "i16vec2 addInvocationsInclusiveScanAMD(i16vec2);" + "i16vec3 addInvocationsInclusiveScanAMD(i16vec3);" + "i16vec4 addInvocationsInclusiveScanAMD(i16vec4);" + + "uint16_t addInvocationsInclusiveScanAMD(uint16_t);" + "u16vec2 addInvocationsInclusiveScanAMD(u16vec2);" + "u16vec3 addInvocationsInclusiveScanAMD(u16vec3);" + "u16vec4 addInvocationsInclusiveScanAMD(u16vec4);" + "float addInvocationsExclusiveScanAMD(float);" "vec2 addInvocationsExclusiveScanAMD(vec2);" "vec3 addInvocationsExclusiveScanAMD(vec3);" @@ -1955,6 +3361,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 addInvocationsExclusiveScanAMD(f16vec3);" "f16vec4 addInvocationsExclusiveScanAMD(f16vec4);" + "int16_t addInvocationsExclusiveScanAMD(int16_t);" + "i16vec2 addInvocationsExclusiveScanAMD(i16vec2);" + "i16vec3 addInvocationsExclusiveScanAMD(i16vec3);" + "i16vec4 addInvocationsExclusiveScanAMD(i16vec4);" + + "uint16_t addInvocationsExclusiveScanAMD(uint16_t);" + "u16vec2 addInvocationsExclusiveScanAMD(u16vec2);" + "u16vec3 addInvocationsExclusiveScanAMD(u16vec3);" + "u16vec4 addInvocationsExclusiveScanAMD(u16vec4);" + "float minInvocationsNonUniformAMD(float);" "vec2 minInvocationsNonUniformAMD(vec2);" "vec3 minInvocationsNonUniformAMD(vec3);" @@ -1990,6 +3406,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 minInvocationsNonUniformAMD(f16vec3);" "f16vec4 minInvocationsNonUniformAMD(f16vec4);" + "int16_t minInvocationsNonUniformAMD(int16_t);" + "i16vec2 minInvocationsNonUniformAMD(i16vec2);" + "i16vec3 minInvocationsNonUniformAMD(i16vec3);" + "i16vec4 minInvocationsNonUniformAMD(i16vec4);" + + "uint16_t minInvocationsNonUniformAMD(uint16_t);" + "u16vec2 minInvocationsNonUniformAMD(u16vec2);" + "u16vec3 minInvocationsNonUniformAMD(u16vec3);" + "u16vec4 minInvocationsNonUniformAMD(u16vec4);" + "float minInvocationsInclusiveScanNonUniformAMD(float);" "vec2 minInvocationsInclusiveScanNonUniformAMD(vec2);" "vec3 minInvocationsInclusiveScanNonUniformAMD(vec3);" @@ -2025,6 +3451,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 minInvocationsInclusiveScanNonUniformAMD(f16vec3);" "f16vec4 minInvocationsInclusiveScanNonUniformAMD(f16vec4);" + "int16_t minInvocationsInclusiveScanNonUniformAMD(int16_t);" + "i16vec2 minInvocationsInclusiveScanNonUniformAMD(i16vec2);" + "i16vec3 minInvocationsInclusiveScanNonUniformAMD(i16vec3);" + "i16vec4 minInvocationsInclusiveScanNonUniformAMD(i16vec4);" + + "uint16_t minInvocationsInclusiveScanNonUniformAMD(uint16_t);" + "u16vec2 minInvocationsInclusiveScanNonUniformAMD(u16vec2);" + "u16vec3 minInvocationsInclusiveScanNonUniformAMD(u16vec3);" + "u16vec4 minInvocationsInclusiveScanNonUniformAMD(u16vec4);" + "float minInvocationsExclusiveScanNonUniformAMD(float);" "vec2 minInvocationsExclusiveScanNonUniformAMD(vec2);" "vec3 minInvocationsExclusiveScanNonUniformAMD(vec3);" @@ -2060,6 +3496,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 minInvocationsExclusiveScanNonUniformAMD(f16vec3);" "f16vec4 minInvocationsExclusiveScanNonUniformAMD(f16vec4);" + "int16_t minInvocationsExclusiveScanNonUniformAMD(int16_t);" + "i16vec2 minInvocationsExclusiveScanNonUniformAMD(i16vec2);" + "i16vec3 minInvocationsExclusiveScanNonUniformAMD(i16vec3);" + "i16vec4 minInvocationsExclusiveScanNonUniformAMD(i16vec4);" + + "uint16_t minInvocationsExclusiveScanNonUniformAMD(uint16_t);" + "u16vec2 minInvocationsExclusiveScanNonUniformAMD(u16vec2);" + "u16vec3 minInvocationsExclusiveScanNonUniformAMD(u16vec3);" + "u16vec4 minInvocationsExclusiveScanNonUniformAMD(u16vec4);" + "float maxInvocationsNonUniformAMD(float);" "vec2 maxInvocationsNonUniformAMD(vec2);" "vec3 maxInvocationsNonUniformAMD(vec3);" @@ -2095,6 +3541,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 maxInvocationsNonUniformAMD(f16vec3);" "f16vec4 maxInvocationsNonUniformAMD(f16vec4);" + "int16_t maxInvocationsNonUniformAMD(int16_t);" + "i16vec2 maxInvocationsNonUniformAMD(i16vec2);" + "i16vec3 maxInvocationsNonUniformAMD(i16vec3);" + "i16vec4 maxInvocationsNonUniformAMD(i16vec4);" + + "uint16_t maxInvocationsNonUniformAMD(uint16_t);" + "u16vec2 maxInvocationsNonUniformAMD(u16vec2);" + "u16vec3 maxInvocationsNonUniformAMD(u16vec3);" + "u16vec4 maxInvocationsNonUniformAMD(u16vec4);" + "float maxInvocationsInclusiveScanNonUniformAMD(float);" "vec2 maxInvocationsInclusiveScanNonUniformAMD(vec2);" "vec3 maxInvocationsInclusiveScanNonUniformAMD(vec3);" @@ -2130,6 +3586,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 maxInvocationsInclusiveScanNonUniformAMD(f16vec3);" "f16vec4 maxInvocationsInclusiveScanNonUniformAMD(f16vec4);" + "int16_t maxInvocationsInclusiveScanNonUniformAMD(int16_t);" + "i16vec2 maxInvocationsInclusiveScanNonUniformAMD(i16vec2);" + "i16vec3 maxInvocationsInclusiveScanNonUniformAMD(i16vec3);" + "i16vec4 maxInvocationsInclusiveScanNonUniformAMD(i16vec4);" + + "uint16_t maxInvocationsInclusiveScanNonUniformAMD(uint16_t);" + "u16vec2 maxInvocationsInclusiveScanNonUniformAMD(u16vec2);" + "u16vec3 maxInvocationsInclusiveScanNonUniformAMD(u16vec3);" + "u16vec4 maxInvocationsInclusiveScanNonUniformAMD(u16vec4);" + "float maxInvocationsExclusiveScanNonUniformAMD(float);" "vec2 maxInvocationsExclusiveScanNonUniformAMD(vec2);" "vec3 maxInvocationsExclusiveScanNonUniformAMD(vec3);" @@ -2165,6 +3631,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 maxInvocationsExclusiveScanNonUniformAMD(f16vec3);" "f16vec4 maxInvocationsExclusiveScanNonUniformAMD(f16vec4);" + "int16_t maxInvocationsExclusiveScanNonUniformAMD(int16_t);" + "i16vec2 maxInvocationsExclusiveScanNonUniformAMD(i16vec2);" + "i16vec3 maxInvocationsExclusiveScanNonUniformAMD(i16vec3);" + "i16vec4 maxInvocationsExclusiveScanNonUniformAMD(i16vec4);" + + "uint16_t maxInvocationsExclusiveScanNonUniformAMD(uint16_t);" + "u16vec2 maxInvocationsExclusiveScanNonUniformAMD(u16vec2);" + "u16vec3 maxInvocationsExclusiveScanNonUniformAMD(u16vec3);" + "u16vec4 maxInvocationsExclusiveScanNonUniformAMD(u16vec4);" + "float addInvocationsNonUniformAMD(float);" "vec2 addInvocationsNonUniformAMD(vec2);" "vec3 addInvocationsNonUniformAMD(vec3);" @@ -2200,6 +3676,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 addInvocationsNonUniformAMD(f16vec3);" "f16vec4 addInvocationsNonUniformAMD(f16vec4);" + "int16_t addInvocationsNonUniformAMD(int16_t);" + "i16vec2 addInvocationsNonUniformAMD(i16vec2);" + "i16vec3 addInvocationsNonUniformAMD(i16vec3);" + "i16vec4 addInvocationsNonUniformAMD(i16vec4);" + + "uint16_t addInvocationsNonUniformAMD(uint16_t);" + "u16vec2 addInvocationsNonUniformAMD(u16vec2);" + "u16vec3 addInvocationsNonUniformAMD(u16vec3);" + "u16vec4 addInvocationsNonUniformAMD(u16vec4);" + "float addInvocationsInclusiveScanNonUniformAMD(float);" "vec2 addInvocationsInclusiveScanNonUniformAMD(vec2);" "vec3 addInvocationsInclusiveScanNonUniformAMD(vec3);" @@ -2235,6 +3721,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 addInvocationsInclusiveScanNonUniformAMD(f16vec3);" "f16vec4 addInvocationsInclusiveScanNonUniformAMD(f16vec4);" + "int16_t addInvocationsInclusiveScanNonUniformAMD(int16_t);" + "i16vec2 addInvocationsInclusiveScanNonUniformAMD(i16vec2);" + "i16vec3 addInvocationsInclusiveScanNonUniformAMD(i16vec3);" + "i16vec4 addInvocationsInclusiveScanNonUniformAMD(i16vec4);" + + "uint16_t addInvocationsInclusiveScanNonUniformAMD(uint16_t);" + "u16vec2 addInvocationsInclusiveScanNonUniformAMD(u16vec2);" + "u16vec3 addInvocationsInclusiveScanNonUniformAMD(u16vec3);" + "u16vec4 addInvocationsInclusiveScanNonUniformAMD(u16vec4);" + "float addInvocationsExclusiveScanNonUniformAMD(float);" "vec2 addInvocationsExclusiveScanNonUniformAMD(vec2);" "vec3 addInvocationsExclusiveScanNonUniformAMD(vec3);" @@ -2270,6 +3766,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 addInvocationsExclusiveScanNonUniformAMD(f16vec3);" "f16vec4 addInvocationsExclusiveScanNonUniformAMD(f16vec4);" + "int16_t addInvocationsExclusiveScanNonUniformAMD(int16_t);" + "i16vec2 addInvocationsExclusiveScanNonUniformAMD(i16vec2);" + "i16vec3 addInvocationsExclusiveScanNonUniformAMD(i16vec3);" + "i16vec4 addInvocationsExclusiveScanNonUniformAMD(i16vec4);" + + "uint16_t addInvocationsExclusiveScanNonUniformAMD(uint16_t);" + "u16vec2 addInvocationsExclusiveScanNonUniformAMD(u16vec2);" + "u16vec3 addInvocationsExclusiveScanNonUniformAMD(u16vec3);" + "u16vec4 addInvocationsExclusiveScanNonUniformAMD(u16vec4);" + "float swizzleInvocationsAMD(float, uvec4);" "vec2 swizzleInvocationsAMD(vec2, uvec4);" "vec3 swizzleInvocationsAMD(vec3, uvec4);" @@ -2330,7 +3836,67 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } - // GL_AMD_gpu_shader_half_float + // GL_AMD_shader_fragment_mask + if (profile != EEsProfile && version >= 450) { + commonBuiltins.append( + "uint fragmentMaskFetchAMD(sampler2DMS, ivec2);" + "uint fragmentMaskFetchAMD(isampler2DMS, ivec2);" + "uint fragmentMaskFetchAMD(usampler2DMS, ivec2);" + + "uint fragmentMaskFetchAMD(sampler2DMSArray, ivec3);" + "uint fragmentMaskFetchAMD(isampler2DMSArray, ivec3);" + "uint fragmentMaskFetchAMD(usampler2DMSArray, ivec3);" + + "vec4 fragmentFetchAMD(sampler2DMS, ivec2, uint);" + "ivec4 fragmentFetchAMD(isampler2DMS, ivec2, uint);" + "uvec4 fragmentFetchAMD(usampler2DMS, ivec2, uint);" + + "vec4 fragmentFetchAMD(sampler2DMSArray, ivec3, uint);" + "ivec4 fragmentFetchAMD(isampler2DMSArray, ivec3, uint);" + "uvec4 fragmentFetchAMD(usampler2DMSArray, ivec3, uint);" + + "\n"); + } + +#endif // AMD_EXTENSIONS + + +#ifdef NV_EXTENSIONS + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) { + commonBuiltins.append( + "struct gl_TextureFootprint2DNV {" + "uvec2 anchor;" + "uvec2 offset;" + "uvec2 mask;" + "uint lod;" + "uint granularity;" + "};" + + "struct gl_TextureFootprint3DNV {" + "uvec3 anchor;" + "uvec3 offset;" + "uvec2 mask;" + "uint lod;" + "uint granularity;" + "};" + "bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV);" + "bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV, float);" + "bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV, float);" + "bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);" + "bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV, float);" + "bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV, float);" + "bool textureFootprintLodNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintLodNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);" + "bool textureFootprintGradNV(sampler2D, vec2, vec2, vec2, int, bool, out gl_TextureFootprint2DNV);" + "bool textureFootprintGradClampNV(sampler2D, vec2, vec2, vec2, float, int, bool, out gl_TextureFootprint2DNV);" + "\n"); + } + +#endif // NV_EXTENSIONS + // GL_AMD_gpu_shader_half_float/Explicit types if (profile != EEsProfile && version >= 450) { commonBuiltins.append( "float16_t radians(float16_t);" @@ -2678,9 +4244,168 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } - // GL_AMD_gpu_shader_int16 + // Explicit types if (profile != EEsProfile && version >= 450) { commonBuiltins.append( + "int8_t abs(int8_t);" + "i8vec2 abs(i8vec2);" + "i8vec3 abs(i8vec3);" + "i8vec4 abs(i8vec4);" + + "int8_t sign(int8_t);" + "i8vec2 sign(i8vec2);" + "i8vec3 sign(i8vec3);" + "i8vec4 sign(i8vec4);" + + "int8_t min(int8_t x, int8_t y);" + "i8vec2 min(i8vec2 x, int8_t y);" + "i8vec3 min(i8vec3 x, int8_t y);" + "i8vec4 min(i8vec4 x, int8_t y);" + "i8vec2 min(i8vec2 x, i8vec2 y);" + "i8vec3 min(i8vec3 x, i8vec3 y);" + "i8vec4 min(i8vec4 x, i8vec4 y);" + + "uint8_t min(uint8_t x, uint8_t y);" + "u8vec2 min(u8vec2 x, uint8_t y);" + "u8vec3 min(u8vec3 x, uint8_t y);" + "u8vec4 min(u8vec4 x, uint8_t y);" + "u8vec2 min(u8vec2 x, u8vec2 y);" + "u8vec3 min(u8vec3 x, u8vec3 y);" + "u8vec4 min(u8vec4 x, u8vec4 y);" + + "int8_t max(int8_t x, int8_t y);" + "i8vec2 max(i8vec2 x, int8_t y);" + "i8vec3 max(i8vec3 x, int8_t y);" + "i8vec4 max(i8vec4 x, int8_t y);" + "i8vec2 max(i8vec2 x, i8vec2 y);" + "i8vec3 max(i8vec3 x, i8vec3 y);" + "i8vec4 max(i8vec4 x, i8vec4 y);" + + "uint8_t max(uint8_t x, uint8_t y);" + "u8vec2 max(u8vec2 x, uint8_t y);" + "u8vec3 max(u8vec3 x, uint8_t y);" + "u8vec4 max(u8vec4 x, uint8_t y);" + "u8vec2 max(u8vec2 x, u8vec2 y);" + "u8vec3 max(u8vec3 x, u8vec3 y);" + "u8vec4 max(u8vec4 x, u8vec4 y);" + + "int8_t clamp(int8_t x, int8_t minVal, int8_t maxVal);" + "i8vec2 clamp(i8vec2 x, int8_t minVal, int8_t maxVal);" + "i8vec3 clamp(i8vec3 x, int8_t minVal, int8_t maxVal);" + "i8vec4 clamp(i8vec4 x, int8_t minVal, int8_t maxVal);" + "i8vec2 clamp(i8vec2 x, i8vec2 minVal, i8vec2 maxVal);" + "i8vec3 clamp(i8vec3 x, i8vec3 minVal, i8vec3 maxVal);" + "i8vec4 clamp(i8vec4 x, i8vec4 minVal, i8vec4 maxVal);" + + "uint8_t clamp(uint8_t x, uint8_t minVal, uint8_t maxVal);" + "u8vec2 clamp(u8vec2 x, uint8_t minVal, uint8_t maxVal);" + "u8vec3 clamp(u8vec3 x, uint8_t minVal, uint8_t maxVal);" + "u8vec4 clamp(u8vec4 x, uint8_t minVal, uint8_t maxVal);" + "u8vec2 clamp(u8vec2 x, u8vec2 minVal, u8vec2 maxVal);" + "u8vec3 clamp(u8vec3 x, u8vec3 minVal, u8vec3 maxVal);" + "u8vec4 clamp(u8vec4 x, u8vec4 minVal, u8vec4 maxVal);" + + "int8_t mix(int8_t, int8_t, bool);" + "i8vec2 mix(i8vec2, i8vec2, bvec2);" + "i8vec3 mix(i8vec3, i8vec3, bvec3);" + "i8vec4 mix(i8vec4, i8vec4, bvec4);" + "uint8_t mix(uint8_t, uint8_t, bool);" + "u8vec2 mix(u8vec2, u8vec2, bvec2);" + "u8vec3 mix(u8vec3, u8vec3, bvec3);" + "u8vec4 mix(u8vec4, u8vec4, bvec4);" + + "bvec2 lessThan(i8vec2, i8vec2);" + "bvec3 lessThan(i8vec3, i8vec3);" + "bvec4 lessThan(i8vec4, i8vec4);" + "bvec2 lessThan(u8vec2, u8vec2);" + "bvec3 lessThan(u8vec3, u8vec3);" + "bvec4 lessThan(u8vec4, u8vec4);" + + "bvec2 lessThanEqual(i8vec2, i8vec2);" + "bvec3 lessThanEqual(i8vec3, i8vec3);" + "bvec4 lessThanEqual(i8vec4, i8vec4);" + "bvec2 lessThanEqual(u8vec2, u8vec2);" + "bvec3 lessThanEqual(u8vec3, u8vec3);" + "bvec4 lessThanEqual(u8vec4, u8vec4);" + + "bvec2 greaterThan(i8vec2, i8vec2);" + "bvec3 greaterThan(i8vec3, i8vec3);" + "bvec4 greaterThan(i8vec4, i8vec4);" + "bvec2 greaterThan(u8vec2, u8vec2);" + "bvec3 greaterThan(u8vec3, u8vec3);" + "bvec4 greaterThan(u8vec4, u8vec4);" + + "bvec2 greaterThanEqual(i8vec2, i8vec2);" + "bvec3 greaterThanEqual(i8vec3, i8vec3);" + "bvec4 greaterThanEqual(i8vec4, i8vec4);" + "bvec2 greaterThanEqual(u8vec2, u8vec2);" + "bvec3 greaterThanEqual(u8vec3, u8vec3);" + "bvec4 greaterThanEqual(u8vec4, u8vec4);" + + "bvec2 equal(i8vec2, i8vec2);" + "bvec3 equal(i8vec3, i8vec3);" + "bvec4 equal(i8vec4, i8vec4);" + "bvec2 equal(u8vec2, u8vec2);" + "bvec3 equal(u8vec3, u8vec3);" + "bvec4 equal(u8vec4, u8vec4);" + + "bvec2 notEqual(i8vec2, i8vec2);" + "bvec3 notEqual(i8vec3, i8vec3);" + "bvec4 notEqual(i8vec4, i8vec4);" + "bvec2 notEqual(u8vec2, u8vec2);" + "bvec3 notEqual(u8vec3, u8vec3);" + "bvec4 notEqual(u8vec4, u8vec4);" + + " int8_t bitfieldExtract( int8_t, int8_t, int8_t);" + "i8vec2 bitfieldExtract(i8vec2, int8_t, int8_t);" + "i8vec3 bitfieldExtract(i8vec3, int8_t, int8_t);" + "i8vec4 bitfieldExtract(i8vec4, int8_t, int8_t);" + + " uint8_t bitfieldExtract( uint8_t, int8_t, int8_t);" + "u8vec2 bitfieldExtract(u8vec2, int8_t, int8_t);" + "u8vec3 bitfieldExtract(u8vec3, int8_t, int8_t);" + "u8vec4 bitfieldExtract(u8vec4, int8_t, int8_t);" + + " int8_t bitfieldInsert( int8_t base, int8_t, int8_t, int8_t);" + "i8vec2 bitfieldInsert(i8vec2 base, i8vec2, int8_t, int8_t);" + "i8vec3 bitfieldInsert(i8vec3 base, i8vec3, int8_t, int8_t);" + "i8vec4 bitfieldInsert(i8vec4 base, i8vec4, int8_t, int8_t);" + + " uint8_t bitfieldInsert( uint8_t base, uint8_t, int8_t, int8_t);" + "u8vec2 bitfieldInsert(u8vec2 base, u8vec2, int8_t, int8_t);" + "u8vec3 bitfieldInsert(u8vec3 base, u8vec3, int8_t, int8_t);" + "u8vec4 bitfieldInsert(u8vec4 base, u8vec4, int8_t, int8_t);" + + " int8_t bitCount( int8_t);" + "i8vec2 bitCount(i8vec2);" + "i8vec3 bitCount(i8vec3);" + "i8vec4 bitCount(i8vec4);" + + " int8_t bitCount( uint8_t);" + "i8vec2 bitCount(u8vec2);" + "i8vec3 bitCount(u8vec3);" + "i8vec4 bitCount(u8vec4);" + + " int8_t findLSB( int8_t);" + "i8vec2 findLSB(i8vec2);" + "i8vec3 findLSB(i8vec3);" + "i8vec4 findLSB(i8vec4);" + + " int8_t findLSB( uint8_t);" + "i8vec2 findLSB(u8vec2);" + "i8vec3 findLSB(u8vec3);" + "i8vec4 findLSB(u8vec4);" + + " int8_t findMSB( int8_t);" + "i8vec2 findMSB(i8vec2);" + "i8vec3 findMSB(i8vec3);" + "i8vec4 findMSB(i8vec4);" + + " int8_t findMSB( uint8_t);" + "i8vec2 findMSB(u8vec2);" + "i8vec3 findMSB(u8vec3);" + "i8vec4 findMSB(u8vec4);" + "int16_t abs(int16_t);" "i16vec2 abs(i16vec2);" "i16vec3 abs(i16vec3);" @@ -2691,50 +4416,53 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "i16vec3 sign(i16vec3);" "i16vec4 sign(i16vec4);" - "int16_t min(int16_t, int16_t);" - "i16vec2 min(i16vec2, int16_t);" - "i16vec3 min(i16vec3, int16_t);" - "i16vec4 min(i16vec4, int16_t);" - "i16vec2 min(i16vec2, i16vec2);" - "i16vec3 min(i16vec3, i16vec3);" - "i16vec4 min(i16vec4, i16vec4);" - "uint16_t min(uint16_t, uint16_t);" - "u16vec2 min(u16vec2, uint16_t);" - "u16vec3 min(u16vec3, uint16_t);" - "u16vec4 min(u16vec4, uint16_t);" - "u16vec2 min(u16vec2, u16vec2);" - "u16vec3 min(u16vec3, u16vec3);" - "u16vec4 min(u16vec4, u16vec4);" + "int16_t min(int16_t x, int16_t y);" + "i16vec2 min(i16vec2 x, int16_t y);" + "i16vec3 min(i16vec3 x, int16_t y);" + "i16vec4 min(i16vec4 x, int16_t y);" + "i16vec2 min(i16vec2 x, i16vec2 y);" + "i16vec3 min(i16vec3 x, i16vec3 y);" + "i16vec4 min(i16vec4 x, i16vec4 y);" - "int16_t max(int16_t, int16_t);" - "i16vec2 max(i16vec2, int16_t);" - "i16vec3 max(i16vec3, int16_t);" - "i16vec4 max(i16vec4, int16_t);" - "i16vec2 max(i16vec2, i16vec2);" - "i16vec3 max(i16vec3, i16vec3);" - "i16vec4 max(i16vec4, i16vec4);" - "uint16_t max(uint16_t, uint16_t);" - "u16vec2 max(u16vec2, uint16_t);" - "u16vec3 max(u16vec3, uint16_t);" - "u16vec4 max(u16vec4, uint16_t);" - "u16vec2 max(u16vec2, u16vec2);" - "u16vec3 max(u16vec3, u16vec3);" - "u16vec4 max(u16vec4, u16vec4);" + "uint16_t min(uint16_t x, uint16_t y);" + "u16vec2 min(u16vec2 x, uint16_t y);" + "u16vec3 min(u16vec3 x, uint16_t y);" + "u16vec4 min(u16vec4 x, uint16_t y);" + "u16vec2 min(u16vec2 x, u16vec2 y);" + "u16vec3 min(u16vec3 x, u16vec3 y);" + "u16vec4 min(u16vec4 x, u16vec4 y);" - "int16_t clamp(int16_t, int16_t, int16_t);" - "i16vec2 clamp(i16vec2, int16_t, int16_t);" - "i16vec3 clamp(i16vec3, int16_t, int16_t);" - "i16vec4 clamp(i16vec4, int16_t, int16_t);" - "i16vec2 clamp(i16vec2, i16vec2, i16vec2);" - "i16vec3 clamp(i16vec3, i16vec3, i16vec3);" - "i16vec4 clamp(i16vec4, i16vec4, i16vec4);" - "uint16_t clamp(uint16_t, uint16_t, uint16_t);" - "u16vec2 clamp(u16vec2, uint16_t, uint16_t);" - "u16vec3 clamp(u16vec3, uint16_t, uint16_t);" - "u16vec4 clamp(u16vec4, uint16_t, uint16_t);" - "u16vec2 clamp(u16vec2, u16vec2, u16vec2);" - "u16vec3 clamp(u16vec3, u16vec3, u16vec3);" - "u16vec4 clamp(u16vec4, u16vec4, u16vec4);" + "int16_t max(int16_t x, int16_t y);" + "i16vec2 max(i16vec2 x, int16_t y);" + "i16vec3 max(i16vec3 x, int16_t y);" + "i16vec4 max(i16vec4 x, int16_t y);" + "i16vec2 max(i16vec2 x, i16vec2 y);" + "i16vec3 max(i16vec3 x, i16vec3 y);" + "i16vec4 max(i16vec4 x, i16vec4 y);" + + "uint16_t max(uint16_t x, uint16_t y);" + "u16vec2 max(u16vec2 x, uint16_t y);" + "u16vec3 max(u16vec3 x, uint16_t y);" + "u16vec4 max(u16vec4 x, uint16_t y);" + "u16vec2 max(u16vec2 x, u16vec2 y);" + "u16vec3 max(u16vec3 x, u16vec3 y);" + "u16vec4 max(u16vec4 x, u16vec4 y);" + + "int16_t clamp(int16_t x, int16_t minVal, int16_t maxVal);" + "i16vec2 clamp(i16vec2 x, int16_t minVal, int16_t maxVal);" + "i16vec3 clamp(i16vec3 x, int16_t minVal, int16_t maxVal);" + "i16vec4 clamp(i16vec4 x, int16_t minVal, int16_t maxVal);" + "i16vec2 clamp(i16vec2 x, i16vec2 minVal, i16vec2 maxVal);" + "i16vec3 clamp(i16vec3 x, i16vec3 minVal, i16vec3 maxVal);" + "i16vec4 clamp(i16vec4 x, i16vec4 minVal, i16vec4 maxVal);" + + "uint16_t clamp(uint16_t x, uint16_t minVal, uint16_t maxVal);" + "u16vec2 clamp(u16vec2 x, uint16_t minVal, uint16_t maxVal);" + "u16vec3 clamp(u16vec3 x, uint16_t minVal, uint16_t maxVal);" + "u16vec4 clamp(u16vec4 x, uint16_t minVal, uint16_t maxVal);" + "u16vec2 clamp(u16vec2 x, u16vec2 minVal, u16vec2 maxVal);" + "u16vec3 clamp(u16vec3 x, u16vec3 minVal, u16vec3 maxVal);" + "u16vec4 clamp(u16vec4 x, u16vec4 minVal, u16vec4 maxVal);" "int16_t mix(int16_t, int16_t, bool);" "i16vec2 mix(i16vec2, i16vec2, bvec2);" @@ -2755,6 +4483,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 ldexp(f16vec3, i16vec3);" "f16vec4 ldexp(f16vec4, i16vec4);" + "int16_t halfBitsToInt16(float16_t);" + "i16vec2 halfBitsToInt16(f16vec2);" + "i16vec3 halhBitsToInt16(f16vec3);" + "i16vec4 halfBitsToInt16(f16vec4);" + + "uint16_t halfBitsToUint16(float16_t);" + "u16vec2 halfBitsToUint16(f16vec2);" + "u16vec3 halfBitsToUint16(f16vec3);" + "u16vec4 halfBitsToUint16(f16vec4);" + "int16_t float16BitsToInt16(float16_t);" "i16vec2 float16BitsToInt16(f16vec2);" "i16vec3 float16BitsToInt16(f16vec3);" @@ -2775,6 +4513,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "f16vec3 uint16BitsToFloat16(u16vec3);" "f16vec4 uint16BitsToFloat16(u16vec4);" + "float16_t int16BitsToHalf(int16_t);" + "f16vec2 int16BitsToHalf(i16vec2);" + "f16vec3 int16BitsToHalf(i16vec3);" + "f16vec4 int16BitsToHalf(i16vec4);" + + "float16_t uint16BitsToHalf(uint16_t);" + "f16vec2 uint16BitsToHalf(u16vec2);" + "f16vec3 uint16BitsToHalf(u16vec3);" + "f16vec4 uint16BitsToHalf(u16vec4);" + "int packInt2x16(i16vec2);" "uint packUint2x16(u16vec2);" "int64_t packInt4x16(i16vec4);" @@ -2826,33 +4574,201 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bvec3 notEqual(u16vec3, u16vec3);" "bvec4 notEqual(u16vec4, u16vec4);" + " int16_t bitfieldExtract( int16_t, int16_t, int16_t);" + "i16vec2 bitfieldExtract(i16vec2, int16_t, int16_t);" + "i16vec3 bitfieldExtract(i16vec3, int16_t, int16_t);" + "i16vec4 bitfieldExtract(i16vec4, int16_t, int16_t);" + + " uint16_t bitfieldExtract( uint16_t, int16_t, int16_t);" + "u16vec2 bitfieldExtract(u16vec2, int16_t, int16_t);" + "u16vec3 bitfieldExtract(u16vec3, int16_t, int16_t);" + "u16vec4 bitfieldExtract(u16vec4, int16_t, int16_t);" + + " int16_t bitfieldInsert( int16_t base, int16_t, int16_t, int16_t);" + "i16vec2 bitfieldInsert(i16vec2 base, i16vec2, int16_t, int16_t);" + "i16vec3 bitfieldInsert(i16vec3 base, i16vec3, int16_t, int16_t);" + "i16vec4 bitfieldInsert(i16vec4 base, i16vec4, int16_t, int16_t);" + + " uint16_t bitfieldInsert( uint16_t base, uint16_t, int16_t, int16_t);" + "u16vec2 bitfieldInsert(u16vec2 base, u16vec2, int16_t, int16_t);" + "u16vec3 bitfieldInsert(u16vec3 base, u16vec3, int16_t, int16_t);" + "u16vec4 bitfieldInsert(u16vec4 base, u16vec4, int16_t, int16_t);" + + " int16_t bitCount( int16_t);" + "i16vec2 bitCount(i16vec2);" + "i16vec3 bitCount(i16vec3);" + "i16vec4 bitCount(i16vec4);" + + " int16_t bitCount( uint16_t);" + "i16vec2 bitCount(u16vec2);" + "i16vec3 bitCount(u16vec3);" + "i16vec4 bitCount(u16vec4);" + + " int16_t findLSB( int16_t);" + "i16vec2 findLSB(i16vec2);" + "i16vec3 findLSB(i16vec3);" + "i16vec4 findLSB(i16vec4);" + + " int16_t findLSB( uint16_t);" + "i16vec2 findLSB(u16vec2);" + "i16vec3 findLSB(u16vec3);" + "i16vec4 findLSB(u16vec4);" + + " int16_t findMSB( int16_t);" + "i16vec2 findMSB(i16vec2);" + "i16vec3 findMSB(i16vec3);" + "i16vec4 findMSB(i16vec4);" + + " int16_t findMSB( uint16_t);" + "i16vec2 findMSB(u16vec2);" + "i16vec3 findMSB(u16vec3);" + "i16vec4 findMSB(u16vec4);" + + "int16_t pack16(i8vec2);" + "uint16_t pack16(u8vec2);" + "int32_t pack32(i8vec4);" + "uint32_t pack32(u8vec4);" + "int32_t pack32(i16vec2);" + "uint32_t pack32(u16vec2);" + "int64_t pack64(i16vec4);" + "uint64_t pack64(u16vec4);" + "int64_t pack64(i32vec2);" + "uint64_t pack64(u32vec2);" + + "i8vec2 unpack8(int16_t);" + "u8vec2 unpack8(uint16_t);" + "i8vec4 unpack8(int32_t);" + "u8vec4 unpack8(uint32_t);" + "i16vec2 unpack16(int32_t);" + "u16vec2 unpack16(uint32_t);" + "i16vec4 unpack16(int64_t);" + "u16vec4 unpack16(uint64_t);" + "i32vec2 unpack32(int64_t);" + "u32vec2 unpack32(uint64_t);" + + "float64_t radians(float64_t);" + "f64vec2 radians(f64vec2);" + "f64vec3 radians(f64vec3);" + "f64vec4 radians(f64vec4);" + + "float64_t degrees(float64_t);" + "f64vec2 degrees(f64vec2);" + "f64vec3 degrees(f64vec3);" + "f64vec4 degrees(f64vec4);" + + "float64_t sin(float64_t);" + "f64vec2 sin(f64vec2);" + "f64vec3 sin(f64vec3);" + "f64vec4 sin(f64vec4);" + + "float64_t cos(float64_t);" + "f64vec2 cos(f64vec2);" + "f64vec3 cos(f64vec3);" + "f64vec4 cos(f64vec4);" + + "float64_t tan(float64_t);" + "f64vec2 tan(f64vec2);" + "f64vec3 tan(f64vec3);" + "f64vec4 tan(f64vec4);" + + "float64_t asin(float64_t);" + "f64vec2 asin(f64vec2);" + "f64vec3 asin(f64vec3);" + "f64vec4 asin(f64vec4);" + + "float64_t acos(float64_t);" + "f64vec2 acos(f64vec2);" + "f64vec3 acos(f64vec3);" + "f64vec4 acos(f64vec4);" + + "float64_t atan(float64_t, float64_t);" + "f64vec2 atan(f64vec2, f64vec2);" + "f64vec3 atan(f64vec3, f64vec3);" + "f64vec4 atan(f64vec4, f64vec4);" + + "float64_t atan(float64_t);" + "f64vec2 atan(f64vec2);" + "f64vec3 atan(f64vec3);" + "f64vec4 atan(f64vec4);" + + "float64_t sinh(float64_t);" + "f64vec2 sinh(f64vec2);" + "f64vec3 sinh(f64vec3);" + "f64vec4 sinh(f64vec4);" + + "float64_t cosh(float64_t);" + "f64vec2 cosh(f64vec2);" + "f64vec3 cosh(f64vec3);" + "f64vec4 cosh(f64vec4);" + + "float64_t tanh(float64_t);" + "f64vec2 tanh(f64vec2);" + "f64vec3 tanh(f64vec3);" + "f64vec4 tanh(f64vec4);" + + "float64_t asinh(float64_t);" + "f64vec2 asinh(f64vec2);" + "f64vec3 asinh(f64vec3);" + "f64vec4 asinh(f64vec4);" + + "float64_t acosh(float64_t);" + "f64vec2 acosh(f64vec2);" + "f64vec3 acosh(f64vec3);" + "f64vec4 acosh(f64vec4);" + + "float64_t atanh(float64_t);" + "f64vec2 atanh(f64vec2);" + "f64vec3 atanh(f64vec3);" + "f64vec4 atanh(f64vec4);" + + "float64_t pow(float64_t, float64_t);" + "f64vec2 pow(f64vec2, f64vec2);" + "f64vec3 pow(f64vec3, f64vec3);" + "f64vec4 pow(f64vec4, f64vec4);" + + "float64_t exp(float64_t);" + "f64vec2 exp(f64vec2);" + "f64vec3 exp(f64vec3);" + "f64vec4 exp(f64vec4);" + + "float64_t log(float64_t);" + "f64vec2 log(f64vec2);" + "f64vec3 log(f64vec3);" + "f64vec4 log(f64vec4);" + + "float64_t exp2(float64_t);" + "f64vec2 exp2(f64vec2);" + "f64vec3 exp2(f64vec3);" + "f64vec4 exp2(f64vec4);" + + "float64_t log2(float64_t);" + "f64vec2 log2(f64vec2);" + "f64vec3 log2(f64vec3);" + "f64vec4 log2(f64vec4);" "\n"); + } + if (profile != EEsProfile && version >= 450) { + stageBuiltins[EShLangFragment].append(derivativesAndControl64bits); + stageBuiltins[EShLangFragment].append( + "float64_t interpolateAtCentroid(float64_t);" + "f64vec2 interpolateAtCentroid(f64vec2);" + "f64vec3 interpolateAtCentroid(f64vec3);" + "f64vec4 interpolateAtCentroid(f64vec4);" + + "float64_t interpolateAtSample(float64_t, int);" + "f64vec2 interpolateAtSample(f64vec2, int);" + "f64vec3 interpolateAtSample(f64vec3, int);" + "f64vec4 interpolateAtSample(f64vec4, int);" + + "float64_t interpolateAtOffset(float64_t, f64vec2);" + "f64vec2 interpolateAtOffset(f64vec2, f64vec2);" + "f64vec3 interpolateAtOffset(f64vec3, f64vec2);" + "f64vec4 interpolateAtOffset(f64vec4, f64vec2);" + + "\n"); + } - // GL_AMD_shader_fragment_mask - if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( - "uint fragmentMaskFetchAMD(sampler2DMS, ivec2);" - "uint fragmentMaskFetchAMD(isampler2DMS, ivec2);" - "uint fragmentMaskFetchAMD(usampler2DMS, ivec2);" - - "uint fragmentMaskFetchAMD(sampler2DMSArray, ivec3);" - "uint fragmentMaskFetchAMD(isampler2DMSArray, ivec3);" - "uint fragmentMaskFetchAMD(usampler2DMSArray, ivec3);" - - "vec4 fragmentFetchAMD(sampler2DMS, ivec2, uint);" - "ivec4 fragmentFetchAMD(isampler2DMS, ivec2, uint);" - "uvec4 fragmentFetchAMD(usampler2DMS, ivec2, uint);" - - "vec4 fragmentFetchAMD(sampler2DMSArray, ivec3, uint);" - "ivec4 fragmentFetchAMD(isampler2DMSArray, ivec3, uint);" - "uvec4 fragmentFetchAMD(usampler2DMSArray, ivec3, uint);" - - "\n"); - } - -#endif - //============================================================================ // // Prototypes for built-in functions seen by vertex shaders only. @@ -2961,6 +4877,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangCompute].append( "void barrier();" ); +#ifdef NV_EXTENSIONS + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + stageBuiltins[EShLangMeshNV].append( + "void barrier();" + ); + stageBuiltins[EShLangTaskNV].append( + "void barrier();" + ); + } +#endif if ((profile != EEsProfile && version >= 130) || esBarrier) commonBuiltins.append( "void memoryBarrier();" @@ -2976,6 +4902,21 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "void groupMemoryBarrier();" ); } +#ifdef NV_EXTENSIONS + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + stageBuiltins[EShLangMeshNV].append( + "void memoryBarrierShared();" + "void groupMemoryBarrier();" + ); + stageBuiltins[EShLangTaskNV].append( + "void memoryBarrierShared();" + "void groupMemoryBarrier();" + ); + } +#endif + + commonBuiltins.append("void controlBarrier(int, int, int, int);\n" + "void memoryBarrier(int, int, int);\n"); //============================================================================ // @@ -3019,61 +4960,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } - stageBuiltins[EShLangFragment].append( - "float dFdx(float p);" - "vec2 dFdx(vec2 p);" - "vec3 dFdx(vec3 p);" - "vec4 dFdx(vec4 p);" - - "float dFdy(float p);" - "vec2 dFdy(vec2 p);" - "vec3 dFdy(vec3 p);" - "vec4 dFdy(vec4 p);" - - "float fwidth(float p);" - "vec2 fwidth(vec2 p);" - "vec3 fwidth(vec3 p);" - "vec4 fwidth(vec4 p);" - - "\n"); + stageBuiltins[EShLangFragment].append(derivatives); + stageBuiltins[EShLangFragment].append("\n"); // GL_ARB_derivative_control if (profile != EEsProfile && version >= 400) { - stageBuiltins[EShLangFragment].append( - "float dFdxFine(float p);" - "vec2 dFdxFine(vec2 p);" - "vec3 dFdxFine(vec3 p);" - "vec4 dFdxFine(vec4 p);" - - "float dFdyFine(float p);" - "vec2 dFdyFine(vec2 p);" - "vec3 dFdyFine(vec3 p);" - "vec4 dFdyFine(vec4 p);" - - "float fwidthFine(float p);" - "vec2 fwidthFine(vec2 p);" - "vec3 fwidthFine(vec3 p);" - "vec4 fwidthFine(vec4 p);" - - "\n"); - - stageBuiltins[EShLangFragment].append( - "float dFdxCoarse(float p);" - "vec2 dFdxCoarse(vec2 p);" - "vec3 dFdxCoarse(vec3 p);" - "vec4 dFdxCoarse(vec4 p);" - - "float dFdyCoarse(float p);" - "vec2 dFdyCoarse(vec2 p);" - "vec3 dFdyCoarse(vec3 p);" - "vec4 dFdyCoarse(vec4 p);" - - "float fwidthCoarse(float p);" - "vec2 fwidthCoarse(vec2 p);" - "vec3 fwidthCoarse(vec3 p);" - "vec4 fwidthCoarse(vec4 p);" - - "\n"); + stageBuiltins[EShLangFragment].append(derivativeControls); + stageBuiltins[EShLangFragment].append("\n"); } // GL_OES_shader_multisample_interpolation @@ -3127,52 +5020,10 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV // GL_AMD_gpu_shader_half_float if (profile != EEsProfile && version >= 450) { + stageBuiltins[EShLangFragment].append(derivativesAndControl16bits); + stageBuiltins[EShLangFragment].append("\n"); + stageBuiltins[EShLangFragment].append( - "float16_t dFdx(float16_t);" - "f16vec2 dFdx(f16vec2);" - "f16vec3 dFdx(f16vec3);" - "f16vec4 dFdx(f16vec4);" - - "float16_t dFdy(float16_t);" - "f16vec2 dFdy(f16vec2);" - "f16vec3 dFdy(f16vec3);" - "f16vec4 dFdy(f16vec4);" - - "float16_t dFdxFine(float16_t);" - "f16vec2 dFdxFine(f16vec2);" - "f16vec3 dFdxFine(f16vec3);" - "f16vec4 dFdxFine(f16vec4);" - - "float16_t dFdyFine(float16_t);" - "f16vec2 dFdyFine(f16vec2);" - "f16vec3 dFdyFine(f16vec3);" - "f16vec4 dFdyFine(f16vec4);" - - "float16_t dFdxCoarse(float16_t);" - "f16vec2 dFdxCoarse(f16vec2);" - "f16vec3 dFdxCoarse(f16vec3);" - "f16vec4 dFdxCoarse(f16vec4);" - - "float16_t dFdyCoarse(float16_t);" - "f16vec2 dFdyCoarse(f16vec2);" - "f16vec3 dFdyCoarse(f16vec3);" - "f16vec4 dFdyCoarse(f16vec4);" - - "float16_t fwidth(float16_t);" - "f16vec2 fwidth(f16vec2);" - "f16vec3 fwidth(f16vec3);" - "f16vec4 fwidth(f16vec4);" - - "float16_t fwidthFine(float16_t);" - "f16vec2 fwidthFine(f16vec2);" - "f16vec3 fwidthFine(f16vec3);" - "f16vec4 fwidthFine(f16vec4);" - - "float16_t fwidthCoarse(float16_t);" - "f16vec2 fwidthCoarse(f16vec2);" - "f16vec3 fwidthCoarse(f16vec3);" - "f16vec4 fwidthCoarse(f16vec4);" - "float16_t interpolateAtCentroid(float16_t);" "f16vec2 interpolateAtCentroid(f16vec2);" "f16vec3 interpolateAtCentroid(f16vec3);" @@ -3192,7 +5043,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } // GL_AMD_shader_fragment_mask - if (profile != EEsProfile && version >= 450 && spvVersion.vulkan >= 100) { + if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) { stageBuiltins[EShLangFragment].append( "uint fragmentMaskFetchAMD(subpassInputMS);" "uint fragmentMaskFetchAMD(isubpassInputMS);" @@ -3206,6 +5057,56 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV } #endif +#ifdef NV_EXTENSIONS + + // Builtins for GL_NV_ray_tracing + if (profile != EEsProfile && version >= 460) { + stageBuiltins[EShLangRayGenNV].append( + "void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void executeCallableNV(uint, int);" + "\n"); + stageBuiltins[EShLangIntersectNV].append( + "bool reportIntersectionNV(float, uint);" + "\n"); + stageBuiltins[EShLangAnyHitNV].append( + "void ignoreIntersectionNV();" + "void terminateRayNV();" + "\n"); + stageBuiltins[EShLangClosestHitNV].append( + "void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void executeCallableNV(uint, int);" + "\n"); + stageBuiltins[EShLangMissNV].append( + "void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);" + "void executeCallableNV(uint, int);" + "\n"); + stageBuiltins[EShLangCallableNV].append( + "void executeCallableNV(uint, int);" + "\n"); + } + + //E_SPV_NV_compute_shader_derivatives + + stageBuiltins[EShLangCompute].append(derivatives); + stageBuiltins[EShLangCompute].append(derivativeControls); + stageBuiltins[EShLangCompute].append("\n"); + + + if (profile != EEsProfile && version >= 450) { + + stageBuiltins[EShLangCompute].append(derivativesAndControl16bits); + stageBuiltins[EShLangCompute].append(derivativesAndControl64bits); + stageBuiltins[EShLangCompute].append("\n"); + } + + // Builtins for GL_NV_mesh_shader + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + stageBuiltins[EShLangMeshNV].append( + "void writePackedPrimitiveIndices4x8NV(uint, uint);" + "\n"); + } +#endif + //============================================================================ // // Standard Uniforms @@ -3385,6 +5286,93 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } +#ifdef NV_EXTENSIONS + //============================================================================ + // + // Define the interface to the mesh/task shader. + // + //============================================================================ + + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + // per-vertex attributes + stageBuiltins[EShLangMeshNV].append( + "out gl_MeshPerVertexNV {" + "vec4 gl_Position;" + "float gl_PointSize;" + "float gl_ClipDistance[];" + "float gl_CullDistance[];" + "perviewNV vec4 gl_PositionPerViewNV[];" + "perviewNV float gl_ClipDistancePerViewNV[][];" + "perviewNV float gl_CullDistancePerViewNV[][];" + "} gl_MeshVerticesNV[];" + ); + + // per-primitive attributes + stageBuiltins[EShLangMeshNV].append( + "perprimitiveNV out gl_MeshPerPrimitiveNV {" + "int gl_PrimitiveID;" + "int gl_Layer;" + "int gl_ViewportIndex;" + "int gl_ViewportMask[];" + "perviewNV int gl_LayerPerViewNV[];" + "perviewNV int gl_ViewportMaskPerViewNV[][];" + "} gl_MeshPrimitivesNV[];" + ); + + stageBuiltins[EShLangMeshNV].append( + "out uint gl_PrimitiveCountNV;" + "out uint gl_PrimitiveIndicesNV[];" + + "in uint gl_MeshViewCountNV;" + "in uint gl_MeshViewIndicesNV[4];" + + "const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);" + + "in highp uvec3 gl_WorkGroupID;" + "in highp uvec3 gl_LocalInvocationID;" + + "in highp uvec3 gl_GlobalInvocationID;" + "in highp uint gl_LocalInvocationIndex;" + + "\n"); + + stageBuiltins[EShLangTaskNV].append( + "out uint gl_TaskCountNV;" + + "const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);" + + "in highp uvec3 gl_WorkGroupID;" + "in highp uvec3 gl_LocalInvocationID;" + + "in highp uvec3 gl_GlobalInvocationID;" + "in highp uint gl_LocalInvocationIndex;" + + "\n"); + } + + if (profile != EEsProfile && version >= 450) { + stageBuiltins[EShLangMeshNV].append( + "in highp int gl_DeviceIndex;" // GL_EXT_device_group + "in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters + "\n"); + + stageBuiltins[EShLangTaskNV].append( + "in highp int gl_DeviceIndex;" // GL_EXT_device_group + "in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters + "\n"); + + if (version >= 460) { + stageBuiltins[EShLangMeshNV].append( + "in int gl_DrawID;" + "\n"); + + stageBuiltins[EShLangTaskNV].append( + "in int gl_DrawID;" + "\n"); + } + } +#endif + //============================================================================ // // Define the interface to the vertex shader. @@ -3491,7 +5479,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangVertex].append( "int gl_InstanceID;" // needs qualifier fixed later ); - if (spvVersion.vulkan >= 100 && version >= 140) + if (spvVersion.vulkan > 0 && version >= 140) stageBuiltins[EShLangVertex].append( "in int gl_VertexIndex;" "in int gl_InstanceIndex;" @@ -3541,7 +5529,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in highp int gl_VertexID;" // needs qualifier fixed later "in highp int gl_InstanceID;" // needs qualifier fixed later ); - if (spvVersion.vulkan >= 100) + if (spvVersion.vulkan > 0) stageBuiltins[EShLangVertex].append( "in highp int gl_VertexIndex;" "in highp int gl_InstanceIndex;" @@ -3951,6 +5939,12 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "bool gl_HelperInvocation;" // needs qualifier fixed later ); + if (version >= 450) + stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density + "flat in ivec2 gl_FragSizeEXT;" + "flat in int gl_FragInvocationCountEXT;" + ); + #ifdef AMD_EXTENSIONS if (version >= 450) stageBuiltins[EShLangFragment].append( @@ -3962,6 +5956,21 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec2 gl_BaryCoordSmoothSampleAMD;" "in vec3 gl_BaryCoordPullModelAMD;" ); +#endif + +#ifdef NV_EXTENSIONS + if (version >= 430) + stageBuiltins[EShLangFragment].append( + "in bool gl_FragFullyCoveredNV;" + ); + if (version >= 450) + stageBuiltins[EShLangFragment].append( + "flat in ivec2 gl_FragmentSizeNV;" // GL_NV_shading_rate_image + "flat in int gl_InvocationsPerPixelNV;" + "in vec3 gl_BaryCoordNV;" // GL_NV_fragment_shader_barycentric + "in vec3 gl_BaryCoordNoPerspNV;" + ); + #endif } else { // ES profile @@ -4003,6 +6012,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV stageBuiltins[EShLangFragment].append( "highp float gl_FragDepthEXT;" // GL_EXT_frag_depth ); + + if (version >= 310) + stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density + "flat in ivec2 gl_FragSizeEXT;" + "flat in int gl_FragInvocationCountEXT;" + ); +#ifdef NV_EXTENSIONS + if (version >= 320) + stageBuiltins[EShLangFragment].append( // GL_NV_shading_rate_image + "flat in ivec2 gl_FragmentSizeNV;" + "flat in int gl_InvocationsPerPixelNV;" + ); + if (version >= 320) + stageBuiltins[EShLangFragment].append( + "in vec3 gl_BaryCoordNV;" + "in vec3 gl_BaryCoordNoPerspNV;" + ); +#endif + } stageBuiltins[EShLangFragment].append("\n"); @@ -4011,17 +6039,34 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV // GL_ARB_shader_ballot if (profile != EEsProfile && version >= 450) { - commonBuiltins.append( + const char* ballotDecls = "uniform uint gl_SubGroupSizeARB;" - "in uint gl_SubGroupInvocationARB;" "in uint64_t gl_SubGroupEqMaskARB;" "in uint64_t gl_SubGroupGeMaskARB;" "in uint64_t gl_SubGroupGtMaskARB;" "in uint64_t gl_SubGroupLeMaskARB;" "in uint64_t gl_SubGroupLtMaskARB;" - - "\n"); + "\n"; + const char* fragmentBallotDecls = + "uniform uint gl_SubGroupSizeARB;" + "flat in uint gl_SubGroupInvocationARB;" + "flat in uint64_t gl_SubGroupEqMaskARB;" + "flat in uint64_t gl_SubGroupGeMaskARB;" + "flat in uint64_t gl_SubGroupGtMaskARB;" + "flat in uint64_t gl_SubGroupLeMaskARB;" + "flat in uint64_t gl_SubGroupLtMaskARB;" + "\n"; + stageBuiltins[EShLangVertex] .append(ballotDecls); + stageBuiltins[EShLangTessControl] .append(ballotDecls); + stageBuiltins[EShLangTessEvaluation].append(ballotDecls); + stageBuiltins[EShLangGeometry] .append(ballotDecls); + stageBuiltins[EShLangCompute] .append(ballotDecls); + stageBuiltins[EShLangFragment] .append(fragmentBallotDecls); +#ifdef NV_EXTENSIONS + stageBuiltins[EShLangMeshNV] .append(ballotDecls); + stageBuiltins[EShLangTaskNV] .append(ballotDecls); +#endif } if ((profile != EEsProfile && version >= 140) || @@ -4032,12 +6077,184 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "\n"); } + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + const char* ballotDecls = + "in mediump uint gl_SubgroupSize;" + "in mediump uint gl_SubgroupInvocationID;" + "in highp uvec4 gl_SubgroupEqMask;" + "in highp uvec4 gl_SubgroupGeMask;" + "in highp uvec4 gl_SubgroupGtMask;" + "in highp uvec4 gl_SubgroupLeMask;" + "in highp uvec4 gl_SubgroupLtMask;" + "\n"; + const char* fragmentBallotDecls = + "flat in mediump uint gl_SubgroupSize;" + "flat in mediump uint gl_SubgroupInvocationID;" + "flat in highp uvec4 gl_SubgroupEqMask;" + "flat in highp uvec4 gl_SubgroupGeMask;" + "flat in highp uvec4 gl_SubgroupGtMask;" + "flat in highp uvec4 gl_SubgroupLeMask;" + "flat in highp uvec4 gl_SubgroupLtMask;" + "\n"; + stageBuiltins[EShLangVertex] .append(ballotDecls); + stageBuiltins[EShLangTessControl] .append(ballotDecls); + stageBuiltins[EShLangTessEvaluation].append(ballotDecls); + stageBuiltins[EShLangGeometry] .append(ballotDecls); + stageBuiltins[EShLangCompute] .append(ballotDecls); + stageBuiltins[EShLangFragment] .append(fragmentBallotDecls); +#ifdef NV_EXTENSIONS + stageBuiltins[EShLangMeshNV] .append(ballotDecls); + stageBuiltins[EShLangTaskNV] .append(ballotDecls); +#endif + + stageBuiltins[EShLangCompute].append( + "highp in uint gl_NumSubgroups;" + "highp in uint gl_SubgroupID;" + "\n"); +#ifdef NV_EXTENSIONS + stageBuiltins[EShLangMeshNV].append( + "highp in uint gl_NumSubgroups;" + "highp in uint gl_SubgroupID;" + "\n"); + stageBuiltins[EShLangTaskNV].append( + "highp in uint gl_NumSubgroups;" + "highp in uint gl_SubgroupID;" + "\n"); +#endif + } + +#ifdef NV_EXTENSIONS + // GL_NV_ray_tracing + if (profile != EEsProfile && version >= 460) { + + const char *constRayFlags = + "const uint gl_RayFlagsNoneNV = 0U;" + "const uint gl_RayFlagsOpaqueNV = 1U;" + "const uint gl_RayFlagsNoOpaqueNV = 2U;" + "const uint gl_RayFlagsTerminateOnFirstHitNV = 4U;" + "const uint gl_RayFlagsSkipClosestHitShaderNV = 8U;" + "const uint gl_RayFlagsCullBackFacingTrianglesNV = 16U;" + "const uint gl_RayFlagsCullFrontFacingTrianglesNV = 32U;" + "const uint gl_RayFlagsCullOpaqueNV = 64U;" + "const uint gl_RayFlagsCullNoOpaqueNV = 128U;" + "\n"; + const char *rayGenDecls = + "in uvec3 gl_LaunchIDNV;" + "in uvec3 gl_LaunchSizeNV;" + "\n"; + const char *intersectDecls = + "in uvec3 gl_LaunchIDNV;" + "in uvec3 gl_LaunchSizeNV;" + "in int gl_PrimitiveID;" + "in int gl_InstanceID;" + "in int gl_InstanceCustomIndexNV;" + "in vec3 gl_WorldRayOriginNV;" + "in vec3 gl_WorldRayDirectionNV;" + "in vec3 gl_ObjectRayOriginNV;" + "in vec3 gl_ObjectRayDirectionNV;" + "in float gl_RayTminNV;" + "in float gl_RayTmaxNV;" + "in mat4x3 gl_ObjectToWorldNV;" + "in mat4x3 gl_WorldToObjectNV;" + "in uint gl_IncomingRayFlagsNV;" + "\n"; + const char *hitDecls = + "in uvec3 gl_LaunchIDNV;" + "in uvec3 gl_LaunchSizeNV;" + "in int gl_PrimitiveID;" + "in int gl_InstanceID;" + "in int gl_InstanceCustomIndexNV;" + "in vec3 gl_WorldRayOriginNV;" + "in vec3 gl_WorldRayDirectionNV;" + "in vec3 gl_ObjectRayOriginNV;" + "in vec3 gl_ObjectRayDirectionNV;" + "in float gl_RayTminNV;" + "in float gl_RayTmaxNV;" + "in float gl_HitTNV;" + "in uint gl_HitKindNV;" + "in mat4x3 gl_ObjectToWorldNV;" + "in mat4x3 gl_WorldToObjectNV;" + "in uint gl_IncomingRayFlagsNV;" + "\n"; + const char *missDecls = + "in uvec3 gl_LaunchIDNV;" + "in uvec3 gl_LaunchSizeNV;" + "in vec3 gl_WorldRayOriginNV;" + "in vec3 gl_WorldRayDirectionNV;" + "in vec3 gl_ObjectRayOriginNV;" + "in vec3 gl_ObjectRayDirectionNV;" + "in float gl_RayTminNV;" + "in float gl_RayTmaxNV;" + "in uint gl_IncomingRayFlagsNV;" + "\n"; + + const char *callableDecls = + "in uvec3 gl_LaunchIDNV;" + "in uvec3 gl_LaunchSizeNV;" + "in uint gl_IncomingRayFlagsNV;" + "\n"; + + stageBuiltins[EShLangRayGenNV].append(rayGenDecls); + stageBuiltins[EShLangRayGenNV].append(constRayFlags); + + stageBuiltins[EShLangIntersectNV].append(intersectDecls); + stageBuiltins[EShLangIntersectNV].append(constRayFlags); + + stageBuiltins[EShLangAnyHitNV].append(hitDecls); + stageBuiltins[EShLangAnyHitNV].append(constRayFlags); + + stageBuiltins[EShLangClosestHitNV].append(hitDecls); + stageBuiltins[EShLangClosestHitNV].append(constRayFlags); + + stageBuiltins[EShLangMissNV].append(missDecls); + stageBuiltins[EShLangMissNV].append(constRayFlags); + + stageBuiltins[EShLangCallableNV].append(callableDecls); + stageBuiltins[EShLangCallableNV].append(constRayFlags); + + } + if ((profile != EEsProfile && version >= 140)) { + const char *deviceIndex = + "in highp int gl_DeviceIndex;" // GL_EXT_device_group + "\n"; + + stageBuiltins[EShLangRayGenNV].append(deviceIndex); + stageBuiltins[EShLangIntersectNV].append(deviceIndex); + stageBuiltins[EShLangAnyHitNV].append(deviceIndex); + stageBuiltins[EShLangClosestHitNV].append(deviceIndex); + stageBuiltins[EShLangMissNV].append(deviceIndex); + } +#endif + if (version >= 300 /* both ES and non-ES */) { stageBuiltins[EShLangFragment].append( "flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2 "\n"); } + if ((profile != EEsProfile && version >= 420) || + (profile == EEsProfile && version >= 310)) { + commonBuiltins.append("const int gl_ScopeDevice = 1;\n"); + commonBuiltins.append("const int gl_ScopeWorkgroup = 2;\n"); + commonBuiltins.append("const int gl_ScopeSubgroup = 3;\n"); + commonBuiltins.append("const int gl_ScopeInvocation = 4;\n"); + commonBuiltins.append("const int gl_ScopeQueueFamily = 5;\n"); + + commonBuiltins.append("const int gl_SemanticsRelaxed = 0x0;\n"); + commonBuiltins.append("const int gl_SemanticsAcquire = 0x2;\n"); + commonBuiltins.append("const int gl_SemanticsRelease = 0x4;\n"); + commonBuiltins.append("const int gl_SemanticsAcquireRelease = 0x8;\n"); + commonBuiltins.append("const int gl_SemanticsMakeAvailable = 0x2000;\n"); + commonBuiltins.append("const int gl_SemanticsMakeVisible = 0x4000;\n"); + + commonBuiltins.append("const int gl_StorageSemanticsNone = 0x0;\n"); + commonBuiltins.append("const int gl_StorageSemanticsBuffer = 0x40;\n"); + commonBuiltins.append("const int gl_StorageSemanticsShared = 0x100;\n"); + commonBuiltins.append("const int gl_StorageSemanticsImage = 0x800;\n"); + commonBuiltins.append("const int gl_StorageSemanticsOutput = 0x1000;\n"); + } + // printf("%s\n", commonBuiltins.c_str()); // printf("%s\n", stageBuiltins[EShLangFragment].c_str()); } @@ -4052,8 +6269,11 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c // In this function proper, enumerate the types, then calls the next set of functions // to enumerate all the uses for that type. // - +#ifdef AMD_EXTENSIONS + TBasicType bTypes[4] = { EbtFloat, EbtFloat16, EbtInt, EbtUint }; +#else TBasicType bTypes[3] = { EbtFloat, EbtInt, EbtUint }; +#endif bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140); bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130); @@ -4093,12 +6313,20 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c continue; if (ms && arrayed && profile == EEsProfile && version < 310) continue; +#ifdef AMD_EXTENSIONS + for (int bType = 0; bType < 4; ++bType) { // float, float16, int, uint results + if (shadow && bType > 1) + continue; + + if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile ||version < 450)) + continue; +#else for (int bType = 0; bType < 3; ++bType) { // float, int, uint results if (shadow && bType > 0) continue; - +#endif if (dim == EsdRect && version < 140 && bType > 0) continue; @@ -4134,15 +6362,19 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c addSamplingFunctions(sampler, typeName, version, profile); addGatherFunctions(sampler, typeName, version, profile); - if (spvVersion.vulkan > 0 && sampler.dim == EsdBuffer && sampler.isCombined()) { - // Vulkan wants a textureBuffer to allow texelFetch() -- - // a sampled image with no sampler. - // So, add sampling functions for both the - // samplerBuffer and textureBuffer types. + if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) { + // Base Vulkan allows texelFetch() for + // textureBuffer (i.e. without sampler). + // + // GL_EXT_samplerless_texture_functions + // allows texelFetch() and query functions + // (other than textureQueryLod()) for all + // texture types. sampler.setTexture(sampler.type, sampler.dim, sampler.arrayed, sampler.shadow, sampler.ms); TString textureTypeName = sampler.getString(); addSamplingFunctions(sampler, textureTypeName, version, profile); + addQueryFunctions(sampler, textureTypeName, version, profile); } } } @@ -4215,16 +6447,50 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int // textureQueryLod(), fragment stage only // - if (profile != EEsProfile && version >= 400 && ! sampler.image && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { - stageBuiltins[EShLangFragment].append("vec2 textureQueryLod("); - stageBuiltins[EShLangFragment].append(typeName); - if (dimMap[sampler.dim] == 1) - stageBuiltins[EShLangFragment].append(", float"); - else { - stageBuiltins[EShLangFragment].append(", vec"); - stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]); + if (profile != EEsProfile && version >= 400 && sampler.combined && sampler.dim != EsdRect && ! sampler.ms && sampler.dim != EsdBuffer) { +#ifdef AMD_EXTENSIONS + for (int f16TexAddr = 0; f16TexAddr < 2; ++f16TexAddr) { + if (f16TexAddr && sampler.type != EbtFloat16) + continue; +#endif + stageBuiltins[EShLangFragment].append("vec2 textureQueryLod("); + stageBuiltins[EShLangFragment].append(typeName); + if (dimMap[sampler.dim] == 1) +#ifdef AMD_EXTENSIONS + if (f16TexAddr) + stageBuiltins[EShLangFragment].append(", float16_t"); + else + stageBuiltins[EShLangFragment].append(", float"); +#else + stageBuiltins[EShLangFragment].append(", float"); +#endif + else { +#ifdef AMD_EXTENSIONS + if (f16TexAddr) + stageBuiltins[EShLangFragment].append(", f16vec"); + else + stageBuiltins[EShLangFragment].append(", vec"); +#else + stageBuiltins[EShLangFragment].append(", vec"); +#endif + stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]); + } + stageBuiltins[EShLangFragment].append(");\n"); +#ifdef AMD_EXTENSIONS } - stageBuiltins[EShLangFragment].append(");\n"); +#endif + +#ifdef NV_EXTENSIONS + stageBuiltins[EShLangCompute].append("vec2 textureQueryLod("); + stageBuiltins[EShLangCompute].append(typeName); + if (dimMap[sampler.dim] == 1) + stageBuiltins[EShLangCompute].append(", float"); + else { + stageBuiltins[EShLangCompute].append(", vec"); + stageBuiltins[EShLangCompute].append(postfixes[dimMap[sampler.dim]]); + } + stageBuiltins[EShLangCompute].append(");\n"); +#endif } // @@ -4300,23 +6566,44 @@ void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int " imageAtomicExchange(volatile coherent " }; - for (size_t i = 0; i < numBuiltins; ++i) { + // Loop twice to add prototypes with/without scope/semantics + for (int j = 0; j < 2; ++j) { + for (size_t i = 0; i < numBuiltins; ++i) { + commonBuiltins.append(dataType); + commonBuiltins.append(atomicFunc[i]); + commonBuiltins.append(imageParams); + commonBuiltins.append(", "); + commonBuiltins.append(dataType); + if (j == 1) { + commonBuiltins.append(", int, int, int"); + } + commonBuiltins.append(");\n"); + } + commonBuiltins.append(dataType); - commonBuiltins.append(atomicFunc[i]); + commonBuiltins.append(" imageAtomicCompSwap(volatile coherent "); commonBuiltins.append(imageParams); commonBuiltins.append(", "); commonBuiltins.append(dataType); + commonBuiltins.append(", "); + commonBuiltins.append(dataType); + if (j == 1) { + commonBuiltins.append(", int, int, int, int, int"); + } commonBuiltins.append(");\n"); } commonBuiltins.append(dataType); - commonBuiltins.append(" imageAtomicCompSwap(volatile coherent "); + commonBuiltins.append(" imageAtomicLoad(volatile coherent "); + commonBuiltins.append(imageParams); + commonBuiltins.append(", int, int, int);\n"); + + commonBuiltins.append("void imageAtomicStore(volatile coherent "); commonBuiltins.append(imageParams); commonBuiltins.append(", "); commonBuiltins.append(dataType); - commonBuiltins.append(", "); - commonBuiltins.append(dataType); - commonBuiltins.append(");\n"); + commonBuiltins.append(", int, int, int);\n"); + } else { // not int or uint // GL_ARB_ES3_1_compatibility @@ -4398,12 +6685,12 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, // for (int proj = 0; proj <= 1; ++proj) { // loop over "bool" projective or not - if (proj && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.arrayed || sampler.ms)) + if (proj && (sampler.dim == EsdCube || sampler.dim == EsdBuffer || sampler.arrayed || sampler.ms || !sampler.combined)) continue; for (int lod = 0; lod <= 1; ++lod) { - if (lod && (sampler.dim == EsdBuffer || sampler.dim == EsdRect || sampler.ms)) + if (lod && (sampler.dim == EsdBuffer || sampler.dim == EsdRect || sampler.ms || !sampler.combined)) continue; if (lod && sampler.dim == Esd2D && sampler.arrayed && sampler.shadow) continue; @@ -4412,9 +6699,9 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, for (int bias = 0; bias <= 1; ++bias) { - if (bias && (lod || sampler.ms)) + if (bias && (lod || sampler.ms || !sampler.combined)) continue; - if (bias && sampler.dim == Esd2D && sampler.shadow && sampler.arrayed) + if (bias && (sampler.dim == Esd2D || sampler.dim == EsdCube) && sampler.shadow && sampler.arrayed) continue; if (bias && (sampler.dim == EsdRect || sampler.dim == EsdBuffer)) continue; @@ -4434,12 +6721,12 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, continue; if (fetch && (sampler.shadow || sampler.dim == EsdCube)) continue; - if (fetch == 0 && (sampler.ms || sampler.dim == EsdBuffer)) + if (fetch == 0 && (sampler.ms || sampler.dim == EsdBuffer || !sampler.combined)) continue; for (int grad = 0; grad <= 1; ++grad) { // loop over "bool" grad or not - if (grad && (lod || bias || sampler.ms)) + if (grad && (lod || bias || sampler.ms || !sampler.combined)) continue; if (grad && sampler.dim == EsdBuffer) continue; @@ -4461,151 +6748,242 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, if (extraProj && ! proj) continue; - if (extraProj && (sampler.dim == Esd3D || sampler.shadow)) + if (extraProj && (sampler.dim == Esd3D || sampler.shadow || !sampler.combined)) continue; +#ifdef AMD_EXTENSIONS + for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing - for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) { // loop over "bool" lod clamp - - if (lodClamp && (profile == EEsProfile || version < 450)) + if (f16TexAddr && sampler.type != EbtFloat16) continue; - if (lodClamp && (proj || lod || fetch)) - continue; - - for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not - - if (sparse && (profile == EEsProfile || version < 450)) - continue; - // Sparse sampling is not for 1D/1D array texture, buffer texture, and projective texture - if (sparse && (sampler.dim == Esd1D || sampler.dim == EsdBuffer || proj)) - continue; - - TString s; - - // return type - if (sparse) - s.append("int "); - else { - if (sampler.shadow) - s.append("float "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - } - - // name - if (sparse) { - if (fetch) - s.append("sparseTexel"); - else - s.append("sparseTexture"); - } else { - if (fetch) - s.append("texel"); - else - s.append("texture"); - } - if (proj) - s.append("Proj"); - if (lod) - s.append("Lod"); - if (grad) - s.append("Grad"); - if (fetch) - s.append("Fetch"); - if (offset) - s.append("Offset"); - if (lodClamp) - s.append("Clamp"); - if (lodClamp || sparse) - s.append("ARB"); - s.append("("); - - // sampler type - s.append(typeName); - - // P coordinate - if (extraProj) - s.append(",vec4"); - else { - s.append(","); - TBasicType t = fetch ? EbtInt : EbtFloat; - if (totalDims == 1) - s.append(TType::getBasicString(t)); - else { - s.append(prefixes[t]); - s.append("vec"); - s.append(postfixes[totalDims]); - } - } - - if (bias && compare) - continue; - - // non-optional lod argument (lod that's not driven by lod loop) or sample - if ((fetch && sampler.dim != EsdBuffer && sampler.dim != EsdRect && !sampler.ms) || - (sampler.ms && fetch)) - s.append(",int"); - - // non-optional lod - if (lod) - s.append(",float"); - - // gradient arguments - if (grad) { - if (dimMap[sampler.dim] == 1) - s.append(",float,float"); - else { - s.append(",vec"); - s.append(postfixes[dimMap[sampler.dim]]); - s.append(",vec"); - s.append(postfixes[dimMap[sampler.dim]]); - } - } - - // offset - if (offset) { - if (dimMap[sampler.dim] == 1) - s.append(",int"); - else { - s.append(",ivec"); - s.append(postfixes[dimMap[sampler.dim]]); - } - } - - // non-optional compare - if (compare) - s.append(",float"); - - // lod clamp - if (lodClamp) - s.append(",float"); - - // texel out (for sparse texture) - if (sparse) { - s.append(",out "); - if (sampler.shadow) - s.append("float "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - } - - // optional bias - if (bias) - s.append(",float"); - - s.append(");\n"); - - // Add to the per-language set of built-ins - - if (bias || lodClamp) - stageBuiltins[EShLangFragment].append(s); - else - commonBuiltins.append(s); + if (f16TexAddr && sampler.shadow && ! compare) { + compare = true; // compare argument is always present + totalDims--; } +#endif + for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp) { // loop over "bool" lod clamp + + if (lodClamp && (profile == EEsProfile || version < 450)) + continue; + if (lodClamp && (proj || lod || fetch)) + continue; + + for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not + + if (sparse && (profile == EEsProfile || version < 450)) + continue; + // Sparse sampling is not for 1D/1D array texture, buffer texture, and projective texture + if (sparse && (sampler.dim == Esd1D || sampler.dim == EsdBuffer || proj)) + continue; + + TString s; + + // return type + if (sparse) + s.append("int "); + else { + if (sampler.shadow) +#ifdef AMD_EXTENSIONS + if (sampler.type == EbtFloat16) + s.append("float16_t "); + else + s.append("float "); +#else + s.append("float "); +#endif + else { + s.append(prefixes[sampler.type]); + s.append("vec4 "); + } + } + + // name + if (sparse) { + if (fetch) + s.append("sparseTexel"); + else + s.append("sparseTexture"); + } + else { + if (fetch) + s.append("texel"); + else + s.append("texture"); + } + if (proj) + s.append("Proj"); + if (lod) + s.append("Lod"); + if (grad) + s.append("Grad"); + if (fetch) + s.append("Fetch"); + if (offset) + s.append("Offset"); + if (lodClamp) + s.append("Clamp"); + if (lodClamp || sparse) + s.append("ARB"); + s.append("("); + + // sampler type + s.append(typeName); +#ifdef AMD_EXTENSIONS + // P coordinate + if (extraProj) { + if (f16TexAddr) + s.append(",f16vec4"); + else + s.append(",vec4"); + } else { + s.append(","); + TBasicType t = fetch ? EbtInt : (f16TexAddr ? EbtFloat16 : EbtFloat); + if (totalDims == 1) + s.append(TType::getBasicString(t)); + else { + s.append(prefixes[t]); + s.append("vec"); + s.append(postfixes[totalDims]); + } + } +#else + // P coordinate + if (extraProj) + s.append(",vec4"); + else { + s.append(","); + TBasicType t = fetch ? EbtInt : EbtFloat; + if (totalDims == 1) + s.append(TType::getBasicString(t)); + else { + s.append(prefixes[t]); + s.append("vec"); + s.append(postfixes[totalDims]); + } + } +#endif + // non-optional compare + if (compare) + s.append(",float"); + + // non-optional lod argument (lod that's not driven by lod loop) or sample + if ((fetch && sampler.dim != EsdBuffer && sampler.dim != EsdRect && !sampler.ms) || + (sampler.ms && fetch)) + s.append(",int"); +#ifdef AMD_EXTENSIONS + // non-optional lod + if (lod) { + if (f16TexAddr) + s.append(",float16_t"); + else + s.append(",float"); + } + + // gradient arguments + if (grad) { + if (dimMap[sampler.dim] == 1) { + if (f16TexAddr) + s.append(",float16_t,float16_t"); + else + s.append(",float,float"); + } else { + if (f16TexAddr) + s.append(",f16vec"); + else + s.append(",vec"); + s.append(postfixes[dimMap[sampler.dim]]); + if (f16TexAddr) + s.append(",f16vec"); + else + s.append(",vec"); + s.append(postfixes[dimMap[sampler.dim]]); + } + } +#else + // non-optional lod + if (lod) + s.append(",float"); + + // gradient arguments + if (grad) { + if (dimMap[sampler.dim] == 1) + s.append(",float,float"); + else { + s.append(",vec"); + s.append(postfixes[dimMap[sampler.dim]]); + s.append(",vec"); + s.append(postfixes[dimMap[sampler.dim]]); + } + } +#endif + // offset + if (offset) { + if (dimMap[sampler.dim] == 1) + s.append(",int"); + else { + s.append(",ivec"); + s.append(postfixes[dimMap[sampler.dim]]); + } + } + +#ifdef AMD_EXTENSIONS + // lod clamp + if (lodClamp) { + if (f16TexAddr) + s.append(",float16_t"); + else + s.append(",float"); + } +#else + // lod clamp + if (lodClamp) + s.append(",float"); +#endif + // texel out (for sparse texture) + if (sparse) { + s.append(",out "); + if (sampler.shadow) +#ifdef AMD_EXTENSIONS + if (sampler.type == EbtFloat16) + s.append("float16_t"); + else + s.append("float"); +#else + s.append("float"); +#endif + else { + s.append(prefixes[sampler.type]); + s.append("vec4"); + } + } +#ifdef AMD_EXTENSIONS + // optional bias + if (bias) { + if (f16TexAddr) + s.append(",float16_t"); + else + s.append(",float"); + } +#else + // optional bias + if (bias) + s.append(",float"); +#endif + s.append(");\n"); + + // Add to the per-language set of built-ins + if (bias || lodClamp) { + stageBuiltins[EShLangFragment].append(s); +#ifdef NV_EXTENSIONS + stageBuiltins[EShLangCompute].append(s); +#endif + } else + commonBuiltins.append(s); + + } + } +#ifdef AMD_EXTENSIONS } +#endif } } } @@ -4638,81 +7016,97 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat) return; - for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets +#ifdef AMD_EXTENSIONS + for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing - for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument + if (f16TexAddr && sampler.type != EbtFloat16) + continue; +#endif + for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets - if (comp > 0 && sampler.shadow) - continue; + for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument - if (offset > 0 && sampler.dim == EsdCube) - continue; - - for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not - if (sparse && (profile == EEsProfile || version < 450)) + if (comp > 0 && sampler.shadow) continue; - TString s; + if (offset > 0 && sampler.dim == EsdCube) + continue; - // return type - if (sparse) - s.append("int "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); + for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not + if (sparse && (profile == EEsProfile || version < 450)) + continue; + + TString s; + + // return type + if (sparse) + s.append("int "); + else { + s.append(prefixes[sampler.type]); + s.append("vec4 "); + } + + // name + if (sparse) + s.append("sparseTextureGather"); + else + s.append("textureGather"); + switch (offset) { + case 1: + s.append("Offset"); + break; + case 2: + s.append("Offsets"); + break; + default: + break; + } + if (sparse) + s.append("ARB"); + s.append("("); + + // sampler type argument + s.append(typeName); + + // P coordinate argument +#ifdef AMD_EXTENSIONS + if (f16TexAddr) + s.append(",f16vec"); + else + s.append(",vec"); +#else + s.append(",vec"); +#endif + int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); + s.append(postfixes[totalDims]); + + // refZ argument + if (sampler.shadow) + s.append(",float"); + + // offset argument + if (offset > 0) { + s.append(",ivec2"); + if (offset == 2) + s.append("[4]"); + } + + // texel out (for sparse texture) + if (sparse) { + s.append(",out "); + s.append(prefixes[sampler.type]); + s.append("vec4 "); + } + + // comp argument + if (comp) + s.append(",int"); + + s.append(");\n"); + commonBuiltins.append(s); +#ifdef AMD_EXTENSIONS } - - // name - if (sparse) - s.append("sparseTextureGather"); - else - s.append("textureGather"); - switch (offset) { - case 1: - s.append("Offset"); - break; - case 2: - s.append("Offsets"); - default: - break; - } - - if (sparse) - s.append("ARB"); - s.append("("); - - // sampler type argument - s.append(typeName); - - // P coordinate argument - s.append(",vec"); - int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); - s.append(postfixes[totalDims]); - - // refZ argument - if (sampler.shadow) - s.append(",float"); - - // offset argument - if (offset > 0) { - s.append(",ivec2"); - if (offset == 2) - s.append("[4]"); - } - - // texel out (for sparse texture) - if (sparse) { - s.append(",out "); - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - - // comp argument - if (comp) - s.append(",int"); - - s.append(");\n"); - commonBuiltins.append(s); +#endif } } } @@ -4731,95 +7125,113 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in if ((lod && bias) || (lod == 0 && bias == 0)) continue; - for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets + for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing - for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument + if (f16TexAddr && sampler.type != EbtFloat16) + continue; - if (comp == 0 && bias) - continue; + for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets - if (offset > 0 && sampler.dim == EsdCube) - continue; + for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument - for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not - if (sparse && (profile == EEsProfile || version < 450)) + if (comp == 0 && bias) continue; - TString s; + if (offset > 0 && sampler.dim == EsdCube) + continue; - // return type - if (sparse) - s.append("int "); - else { - s.append(prefixes[sampler.type]); - s.append("vec4 "); + for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not + if (sparse && (profile == EEsProfile || version < 450)) + continue; + + TString s; + + // return type + if (sparse) + s.append("int "); + else { + s.append(prefixes[sampler.type]); + s.append("vec4 "); + } + + // name + if (sparse) + s.append("sparseTextureGather"); + else + s.append("textureGather"); + + if (lod) + s.append("Lod"); + + switch (offset) { + case 1: + s.append("Offset"); + break; + case 2: + s.append("Offsets"); + break; + default: + break; + } + + if (lod) + s.append("AMD"); + else if (sparse) + s.append("ARB"); + + s.append("("); + + // sampler type argument + s.append(typeName); + + // P coordinate argument + if (f16TexAddr) + s.append(",f16vec"); + else + s.append(",vec"); + int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); + s.append(postfixes[totalDims]); + + // lod argument + if (lod) { + if (f16TexAddr) + s.append(",float16_t"); + else + s.append(",float"); + } + + // offset argument + if (offset > 0) { + s.append(",ivec2"); + if (offset == 2) + s.append("[4]"); + } + + // texel out (for sparse texture) + if (sparse) { + s.append(",out "); + s.append(prefixes[sampler.type]); + s.append("vec4 "); + } + + // comp argument + if (comp) + s.append(",int"); + + // bias argument + if (bias) { + if (f16TexAddr) + s.append(",float16_t"); + else + s.append(",float"); + } + + s.append(");\n"); + if (bias) + stageBuiltins[EShLangFragment].append(s); + else + commonBuiltins.append(s); } - - // name - if (sparse) - s.append("sparseTextureGather"); - else - s.append("textureGather"); - - if (lod) - s.append("Lod"); - - switch (offset) { - case 1: - s.append("Offset"); - break; - case 2: - s.append("Offsets"); - default: - break; - } - - if (lod) - s.append("AMD"); - else if (sparse) - s.append("ARB"); - - s.append("("); - - // sampler type argument - s.append(typeName); - - // P coordinate argument - s.append(",vec"); - int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0); - s.append(postfixes[totalDims]); - - // lod argument - if (lod) - s.append(",float"); - - // offset argument - if (offset > 0) { - s.append(",ivec2"); - if (offset == 2) - s.append("[4]"); - } - - // texel out (for sparse texture) - if (sparse) { - s.append(",out "); - s.append(prefixes[sampler.type]); - s.append("vec4 "); - } - - // comp argument - if (comp) - s.append(",int"); - - // bias argument - if (bias) - s.append(",float"); - - s.append(");\n"); - if (bias) - stageBuiltins[EShLangFragment].append(s); - else - commonBuiltins.append(s); } } } @@ -5281,6 +7693,31 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf } #endif +#ifdef NV_EXTENSIONS + // SPV_NV_mesh_shader + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV); + s.append(builtInConstant); + + snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputPrimitivesNV = %d;", resources.maxMeshOutputPrimitivesNV); + s.append(builtInConstant); + + snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxMeshWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxMeshWorkGroupSizeX_NV, + resources.maxMeshWorkGroupSizeY_NV, + resources.maxMeshWorkGroupSizeZ_NV); + s.append(builtInConstant); + snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxTaskWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxTaskWorkGroupSizeX_NV, + resources.maxTaskWorkGroupSizeY_NV, + resources.maxTaskWorkGroupSizeZ_NV); + s.append(builtInConstant); + + snprintf(builtInConstant, maxSize, "const int gl_MaxMeshViewCountNV = %d;", resources.maxMeshViewCountNV); + s.append(builtInConstant); + + s.append("\n"); + } +#endif + s.append("\n"); } @@ -5406,9 +7843,11 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); - if (spvVersion.vulkan >= 100) + if (spvVersion.vulkan > 0) // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); if (version >= 430) { symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote); @@ -5462,6 +7901,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } #endif +#ifdef NV_EXTENSIONS + symbolTable.setFunctionExtensions("textureFootprintNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintClampNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintLodNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintGradNV", 1, &E_GL_NV_shader_texture_footprint); + symbolTable.setFunctionExtensions("textureFootprintGradClampNV", 1, &E_GL_NV_shader_texture_footprint); +#endif // Compatibility variables, vertex only if (spvVersion.spv == 0) { BuiltInVariable("gl_Color", EbvColor, symbolTable); @@ -5507,7 +7953,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); } - if (spvVersion.vulkan >= 100) { + if (spvVersion.vulkan > 0) { BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable); BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); } @@ -5647,6 +8093,25 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview); BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); } + + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + + BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable); + BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable); + BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable); + BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable); + BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); + BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); + BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); + } break; @@ -5858,6 +8323,45 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } #endif +#ifdef NV_EXTENSIONS + if (profile != EEsProfile && version >= 430) { + symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation); + BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable); + } + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) { + symbolTable.setVariableExtensions("gl_FragmentSizeNV", 1, &E_GL_NV_shading_rate_image); + symbolTable.setVariableExtensions("gl_InvocationsPerPixelNV", 1, &E_GL_NV_shading_rate_image); + BuiltInVariable("gl_FragmentSizeNV", EbvFragmentSizeNV, symbolTable); + BuiltInVariable("gl_InvocationsPerPixelNV", EbvInvocationsPerPixelNV, symbolTable); + symbolTable.setVariableExtensions("gl_BaryCoordNV", 1, &E_GL_NV_fragment_shader_barycentric); + symbolTable.setVariableExtensions("gl_BaryCoordNoPerspNV", 1, &E_GL_NV_fragment_shader_barycentric); + BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable); + BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable); + } + if (((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) && + language == EShLangCompute) { + symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives); + symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives); + } +#endif + + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 310)) { + symbolTable.setVariableExtensions("gl_FragSizeEXT", 1, &E_GL_EXT_fragment_invocation_density); + symbolTable.setVariableExtensions("gl_FragInvocationCountEXT", 1, &E_GL_EXT_fragment_invocation_density); + BuiltInVariable("gl_FragSizeEXT", EbvFragSizeEXT, symbolTable); + BuiltInVariable("gl_FragInvocationCountEXT", EbvFragInvocationCountEXT, symbolTable); + } + symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth); if (profile == EEsProfile && version < 320) { @@ -5885,10 +8389,154 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable); } + // GL_ARB_shader_ballot + if (profile != EEsProfile) { + symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); + + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + + if (spvVersion.vulkan > 0) + // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan + SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + } + + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + + BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable); + BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable); + BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable); + BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable); + BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); + BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); + BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); + + symbolTable.setFunctionExtensions("subgroupBarrier", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setFunctionExtensions("subgroupMemoryBarrier", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setFunctionExtensions("subgroupMemoryBarrierBuffer", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setFunctionExtensions("subgroupMemoryBarrierImage", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setFunctionExtensions("subgroupElect", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setFunctionExtensions("subgroupAll", 1, &E_GL_KHR_shader_subgroup_vote); + symbolTable.setFunctionExtensions("subgroupAny", 1, &E_GL_KHR_shader_subgroup_vote); + symbolTable.setFunctionExtensions("subgroupAllEqual", 1, &E_GL_KHR_shader_subgroup_vote); + symbolTable.setFunctionExtensions("subgroupBroadcast", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBroadcastFirst", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallot", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupInverseBallot", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallotBitExtract", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallotBitCount", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallotInclusiveBitCount", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallotExclusiveBitCount", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallotFindLSB", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupBallotFindMSB", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setFunctionExtensions("subgroupShuffle", 1, &E_GL_KHR_shader_subgroup_shuffle); + symbolTable.setFunctionExtensions("subgroupShuffleXor", 1, &E_GL_KHR_shader_subgroup_shuffle); + symbolTable.setFunctionExtensions("subgroupShuffleUp", 1, &E_GL_KHR_shader_subgroup_shuffle_relative); + symbolTable.setFunctionExtensions("subgroupShuffleDown", 1, &E_GL_KHR_shader_subgroup_shuffle_relative); + symbolTable.setFunctionExtensions("subgroupAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupMul", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupMin", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupMax", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupOr", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupXor", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveMul", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveMin", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveMax", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveOr", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupInclusiveXor", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveMul", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveMin", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveMax", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveOr", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupExclusiveXor", 1, &E_GL_KHR_shader_subgroup_arithmetic); + symbolTable.setFunctionExtensions("subgroupClusteredAdd", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupClusteredMul", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupClusteredMin", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupClusteredMax", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupClusteredAnd", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupClusteredOr", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupClusteredXor", 1, &E_GL_KHR_shader_subgroup_clustered); + symbolTable.setFunctionExtensions("subgroupQuadBroadcast", 1, &E_GL_KHR_shader_subgroup_quad); + symbolTable.setFunctionExtensions("subgroupQuadSwapHorizontal", 1, &E_GL_KHR_shader_subgroup_quad); + symbolTable.setFunctionExtensions("subgroupQuadSwapVertical", 1, &E_GL_KHR_shader_subgroup_quad); + symbolTable.setFunctionExtensions("subgroupQuadSwapDiagonal", 1, &E_GL_KHR_shader_subgroup_quad); + +#ifdef NV_EXTENSIONS + symbolTable.setFunctionExtensions("subgroupPartitionNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedAddNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedMulNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedMinNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedAndNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedOrNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedXorNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveAddNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMulNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMinNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAddNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMulNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMinNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned); + symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned); +#endif + + } + if (profile == EEsProfile) { symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers); symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers); } + + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_ScopeDevice", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_ScopeWorkgroup", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_ScopeSubgroup", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_ScopeInvocation", 1, &E_GL_KHR_memory_scope_semantics); + + symbolTable.setVariableExtensions("gl_SemanticsRelaxed", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_SemanticsAcquire", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_SemanticsRelease", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_SemanticsAcquireRelease", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_SemanticsMakeAvailable", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_SemanticsMakeVisible", 1, &E_GL_KHR_memory_scope_semantics); + + symbolTable.setVariableExtensions("gl_StorageSemanticsNone", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_StorageSemanticsBuffer", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_StorageSemanticsShared", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_StorageSemanticsImage", 1, &E_GL_KHR_memory_scope_semantics); + symbolTable.setVariableExtensions("gl_StorageSemanticsOutput", 1, &E_GL_KHR_memory_scope_semantics); + } break; case EShLangCompute: @@ -5923,6 +8571,51 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader); } + symbolTable.setFunctionExtensions("controlBarrier", 1, &E_GL_KHR_memory_scope_semantics); + + // GL_ARB_shader_ballot + if (profile != EEsProfile) { + symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); + + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + + if (spvVersion.vulkan > 0) + // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan + SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + } + + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + + BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable); + BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable); + BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable); + BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable); + BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); + BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); + BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); + } + if ((profile != EEsProfile && version >= 140) || (profile == EEsProfile && version >= 310)) { symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); @@ -5931,7 +8624,259 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable); } + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic); + + BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable); + BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable); + + symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic); + } break; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: + case EShLangIntersectNV: + case EShLangAnyHitNV: + case EShLangClosestHitNV: + case EShLangMissNV: + case EShLangCallableNV: + if (profile != EEsProfile && version >= 460) { + symbolTable.setVariableExtensions("gl_LaunchIDNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_LaunchSizeNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_PrimitiveID", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_InstanceID", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_InstanceCustomIndexNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_WorldRayOriginNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_WorldRayDirectionNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_ObjectRayOriginNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_ObjectRayDirectionNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_RayTminNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_RayTmaxNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_HitTNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_HitKindNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_ObjectToWorldNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_WorldToObjectNV", 1, &E_GL_NV_ray_tracing); + symbolTable.setVariableExtensions("gl_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing); + + symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); + + BuiltInVariable("gl_LaunchIDNV", EbvLaunchIdNV, symbolTable); + BuiltInVariable("gl_LaunchSizeNV", EbvLaunchSizeNV, symbolTable); + BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable); + BuiltInVariable("gl_InstanceID", EbvInstanceId, symbolTable); + BuiltInVariable("gl_InstanceCustomIndexNV", EbvInstanceCustomIndexNV,symbolTable); + BuiltInVariable("gl_WorldRayOriginNV", EbvWorldRayOriginNV, symbolTable); + BuiltInVariable("gl_WorldRayDirectionNV", EbvWorldRayDirectionNV, symbolTable); + BuiltInVariable("gl_ObjectRayOriginNV", EbvObjectRayOriginNV, symbolTable); + BuiltInVariable("gl_ObjectRayDirectionNV", EbvObjectRayDirectionNV, symbolTable); + BuiltInVariable("gl_RayTminNV", EbvRayTminNV, symbolTable); + BuiltInVariable("gl_RayTmaxNV", EbvRayTmaxNV, symbolTable); + BuiltInVariable("gl_HitTNV", EbvHitTNV, symbolTable); + BuiltInVariable("gl_HitKindNV", EbvHitKindNV, symbolTable); + BuiltInVariable("gl_ObjectToWorldNV", EbvObjectToWorldNV, symbolTable); + BuiltInVariable("gl_WorldToObjectNV", EbvWorldToObjectNV, symbolTable); + BuiltInVariable("gl_IncomingRayFlagsNV", EbvIncomingRayFlagsNV, symbolTable); + BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); + } + break; + case EShLangMeshNV: + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + // Per-vertex builtins + BuiltInVariable("gl_MeshVerticesNV", "gl_Position", EbvPosition, symbolTable); + BuiltInVariable("gl_MeshVerticesNV", "gl_PointSize", EbvPointSize, symbolTable); + BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistance", EbvClipDistance, symbolTable); + BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistance", EbvCullDistance, symbolTable); + // Per-view builtins + BuiltInVariable("gl_MeshVerticesNV", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable); + BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistancePerViewNV", EbvClipDistancePerViewNV, symbolTable); + BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistancePerViewNV", EbvCullDistancePerViewNV, symbolTable); + + // Per-primitive builtins + BuiltInVariable("gl_MeshPrimitivesNV", "gl_PrimitiveID", EbvPrimitiveId, symbolTable); + BuiltInVariable("gl_MeshPrimitivesNV", "gl_Layer", EbvLayer, symbolTable); + BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportIndex", EbvViewportIndex, symbolTable); + BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMask", EbvViewportMaskNV, symbolTable); + // Per-view builtins + BuiltInVariable("gl_MeshPrimitivesNV", "gl_LayerPerViewNV", EbvLayerPerViewNV, symbolTable); + BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable); + + symbolTable.setVariableExtensions("gl_PrimitiveCountNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_PrimitiveIndicesNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader); + + BuiltInVariable("gl_PrimitiveCountNV", EbvPrimitiveCountNV, symbolTable); + BuiltInVariable("gl_PrimitiveIndicesNV", EbvPrimitiveIndicesNV, symbolTable); + BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable); + BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable); + BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable); + BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable); + BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable); + BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable); + BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable); + + symbolTable.setVariableExtensions("gl_MaxMeshOutputVerticesNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_MaxMeshOutputPrimitivesNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_MaxMeshWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader); + + symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader); + symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader); + symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader); + } + + if (profile != EEsProfile && version >= 450) { + // GL_EXT_device_group + symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); + BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); + + // GL_ARB_shader_draw_parameters + symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters); + BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable); + if (version >= 460) { + BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable); + } + + // GL_ARB_shader_ballot + symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); + + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + + if (spvVersion.vulkan > 0) + // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan + SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + } + + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + + BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable); + BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable); + BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable); + BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable); + BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable); + BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable); + BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); + BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); + BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); + + symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic); + } + break; + + case EShLangTaskNV: + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + symbolTable.setVariableExtensions("gl_TaskCountNV", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader); + symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader); + + BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable); + BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable); + BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable); + BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable); + BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable); + BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable); + + symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader); + + symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader); + symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader); + symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader); + } + + if (profile != EEsProfile && version >= 450) { + // GL_EXT_device_group + symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group); + BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable); + + // GL_ARB_shader_draw_parameters + symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters); + BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable); + if (version >= 460) { + BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable); + } + + // GL_ARB_shader_ballot + symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot); + symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot); + + BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable); + BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable); + BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable); + BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable); + BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); + BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable); + + if (spvVersion.vulkan > 0) + // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan + SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); + else + BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable); + } + + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic); + symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot); + symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot); + + BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable); + BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable); + BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable); + BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable); + BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable); + BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable); + BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable); + BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable); + BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable); + + symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic); + } + break; +#endif default: assert(false && "Language not supported"); @@ -6016,12 +8961,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64); symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble); symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble); -#ifdef AMD_EXTENSIONS + symbolTable.relateToOperator("halfBitsToInt16", EOpFloat16BitsToInt16); + symbolTable.relateToOperator("halfBitsToUint16", EOpFloat16BitsToUint16); symbolTable.relateToOperator("float16BitsToInt16", EOpFloat16BitsToInt16); symbolTable.relateToOperator("float16BitsToUint16", EOpFloat16BitsToUint16); symbolTable.relateToOperator("int16BitsToFloat16", EOpInt16BitsToFloat16); symbolTable.relateToOperator("uint16BitsToFloat16", EOpUint16BitsToFloat16); -#endif + + symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16); + symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16); symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16); symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16); @@ -6044,7 +8992,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32); symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32); -#ifdef AMD_EXTENSIONS symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16); symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16); symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16); @@ -6054,10 +9001,16 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("unpackInt4x16", EOpUnpackInt4x16); symbolTable.relateToOperator("packUint4x16", EOpPackUint4x16); symbolTable.relateToOperator("unpackUint4x16", EOpUnpackUint4x16); - symbolTable.relateToOperator("packFloat2x16", EOpPackFloat2x16); symbolTable.relateToOperator("unpackFloat2x16", EOpUnpackFloat2x16); -#endif + + symbolTable.relateToOperator("pack16", EOpPack16); + symbolTable.relateToOperator("pack32", EOpPack32); + symbolTable.relateToOperator("pack64", EOpPack64); + + symbolTable.relateToOperator("unpack32", EOpUnpack32); + symbolTable.relateToOperator("unpack16", EOpUnpack16); + symbolTable.relateToOperator("unpack8", EOpUnpack8); symbolTable.relateToOperator("length", EOpLength); symbolTable.relateToOperator("distance", EOpDistance); @@ -6072,6 +9025,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("all", EOpAll); symbolTable.relateToOperator("barrier", EOpBarrier); + symbolTable.relateToOperator("controlBarrier", EOpBarrier); symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier); symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter); symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer); @@ -6085,6 +9039,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("atomicXor", EOpAtomicXor); symbolTable.relateToOperator("atomicExchange", EOpAtomicExchange); symbolTable.relateToOperator("atomicCompSwap", EOpAtomicCompSwap); + symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad); + symbolTable.relateToOperator("atomicStore", EOpAtomicStore); symbolTable.relateToOperator("atomicCounterIncrement", EOpAtomicCounterIncrement); symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement); @@ -6129,6 +9085,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("imageAtomicXor", EOpImageAtomicXor); symbolTable.relateToOperator("imageAtomicExchange", EOpImageAtomicExchange); symbolTable.relateToOperator("imageAtomicCompSwap", EOpImageAtomicCompSwap); + symbolTable.relateToOperator("imageAtomicLoad", EOpImageAtomicLoad); + symbolTable.relateToOperator("imageAtomicStore", EOpImageAtomicStore); symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad); symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS); @@ -6160,6 +9118,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("noise3", EOpNoise); symbolTable.relateToOperator("noise4", EOpNoise); +#ifdef NV_EXTENSIONS + symbolTable.relateToOperator("textureFootprintNV", EOpImageSampleFootprintNV); + symbolTable.relateToOperator("textureFootprintClampNV", EOpImageSampleFootprintClampNV); + symbolTable.relateToOperator("textureFootprintLodNV", EOpImageSampleFootprintLodNV); + symbolTable.relateToOperator("textureFootprintGradNV", EOpImageSampleFootprintGradNV); + symbolTable.relateToOperator("textureFootprintGradClampNV", EOpImageSampleFootprintGradClampNV); +#endif + if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) || (profile == EEsProfile && version == 100))) { symbolTable.relateToOperator("ftransform", EOpFtransform); @@ -6301,6 +9267,90 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion symbolTable.relateToOperator("fragmentFetchAMD", EOpFragmentFetch); #endif } + + // GL_KHR_shader_subgroup + if (spvVersion.vulkan > 0) { + symbolTable.relateToOperator("subgroupBarrier", EOpSubgroupBarrier); + symbolTable.relateToOperator("subgroupMemoryBarrier", EOpSubgroupMemoryBarrier); + symbolTable.relateToOperator("subgroupMemoryBarrierBuffer", EOpSubgroupMemoryBarrierBuffer); + symbolTable.relateToOperator("subgroupMemoryBarrierImage", EOpSubgroupMemoryBarrierImage); + symbolTable.relateToOperator("subgroupElect", EOpSubgroupElect); + symbolTable.relateToOperator("subgroupAll", EOpSubgroupAll); + symbolTable.relateToOperator("subgroupAny", EOpSubgroupAny); + symbolTable.relateToOperator("subgroupAllEqual", EOpSubgroupAllEqual); + symbolTable.relateToOperator("subgroupBroadcast", EOpSubgroupBroadcast); + symbolTable.relateToOperator("subgroupBroadcastFirst", EOpSubgroupBroadcastFirst); + symbolTable.relateToOperator("subgroupBallot", EOpSubgroupBallot); + symbolTable.relateToOperator("subgroupInverseBallot", EOpSubgroupInverseBallot); + symbolTable.relateToOperator("subgroupBallotBitExtract", EOpSubgroupBallotBitExtract); + symbolTable.relateToOperator("subgroupBallotBitCount", EOpSubgroupBallotBitCount); + symbolTable.relateToOperator("subgroupBallotInclusiveBitCount", EOpSubgroupBallotInclusiveBitCount); + symbolTable.relateToOperator("subgroupBallotExclusiveBitCount", EOpSubgroupBallotExclusiveBitCount); + symbolTable.relateToOperator("subgroupBallotFindLSB", EOpSubgroupBallotFindLSB); + symbolTable.relateToOperator("subgroupBallotFindMSB", EOpSubgroupBallotFindMSB); + symbolTable.relateToOperator("subgroupShuffle", EOpSubgroupShuffle); + symbolTable.relateToOperator("subgroupShuffleXor", EOpSubgroupShuffleXor); + symbolTable.relateToOperator("subgroupShuffleUp", EOpSubgroupShuffleUp); + symbolTable.relateToOperator("subgroupShuffleDown", EOpSubgroupShuffleDown); + symbolTable.relateToOperator("subgroupAdd", EOpSubgroupAdd); + symbolTable.relateToOperator("subgroupMul", EOpSubgroupMul); + symbolTable.relateToOperator("subgroupMin", EOpSubgroupMin); + symbolTable.relateToOperator("subgroupMax", EOpSubgroupMax); + symbolTable.relateToOperator("subgroupAnd", EOpSubgroupAnd); + symbolTable.relateToOperator("subgroupOr", EOpSubgroupOr); + symbolTable.relateToOperator("subgroupXor", EOpSubgroupXor); + symbolTable.relateToOperator("subgroupInclusiveAdd", EOpSubgroupInclusiveAdd); + symbolTable.relateToOperator("subgroupInclusiveMul", EOpSubgroupInclusiveMul); + symbolTable.relateToOperator("subgroupInclusiveMin", EOpSubgroupInclusiveMin); + symbolTable.relateToOperator("subgroupInclusiveMax", EOpSubgroupInclusiveMax); + symbolTable.relateToOperator("subgroupInclusiveAnd", EOpSubgroupInclusiveAnd); + symbolTable.relateToOperator("subgroupInclusiveOr", EOpSubgroupInclusiveOr); + symbolTable.relateToOperator("subgroupInclusiveXor", EOpSubgroupInclusiveXor); + symbolTable.relateToOperator("subgroupExclusiveAdd", EOpSubgroupExclusiveAdd); + symbolTable.relateToOperator("subgroupExclusiveMul", EOpSubgroupExclusiveMul); + symbolTable.relateToOperator("subgroupExclusiveMin", EOpSubgroupExclusiveMin); + symbolTable.relateToOperator("subgroupExclusiveMax", EOpSubgroupExclusiveMax); + symbolTable.relateToOperator("subgroupExclusiveAnd", EOpSubgroupExclusiveAnd); + symbolTable.relateToOperator("subgroupExclusiveOr", EOpSubgroupExclusiveOr); + symbolTable.relateToOperator("subgroupExclusiveXor", EOpSubgroupExclusiveXor); + symbolTable.relateToOperator("subgroupClusteredAdd", EOpSubgroupClusteredAdd); + symbolTable.relateToOperator("subgroupClusteredMul", EOpSubgroupClusteredMul); + symbolTable.relateToOperator("subgroupClusteredMin", EOpSubgroupClusteredMin); + symbolTable.relateToOperator("subgroupClusteredMax", EOpSubgroupClusteredMax); + symbolTable.relateToOperator("subgroupClusteredAnd", EOpSubgroupClusteredAnd); + symbolTable.relateToOperator("subgroupClusteredOr", EOpSubgroupClusteredOr); + symbolTable.relateToOperator("subgroupClusteredXor", EOpSubgroupClusteredXor); + symbolTable.relateToOperator("subgroupQuadBroadcast", EOpSubgroupQuadBroadcast); + symbolTable.relateToOperator("subgroupQuadSwapHorizontal", EOpSubgroupQuadSwapHorizontal); + symbolTable.relateToOperator("subgroupQuadSwapVertical", EOpSubgroupQuadSwapVertical); + symbolTable.relateToOperator("subgroupQuadSwapDiagonal", EOpSubgroupQuadSwapDiagonal); + +#ifdef NV_EXTENSIONS + symbolTable.relateToOperator("subgroupPartitionNV", EOpSubgroupPartition); + symbolTable.relateToOperator("subgroupPartitionedAddNV", EOpSubgroupPartitionedAdd); + symbolTable.relateToOperator("subgroupPartitionedMulNV", EOpSubgroupPartitionedMul); + symbolTable.relateToOperator("subgroupPartitionedMinNV", EOpSubgroupPartitionedMin); + symbolTable.relateToOperator("subgroupPartitionedMaxNV", EOpSubgroupPartitionedMax); + symbolTable.relateToOperator("subgroupPartitionedAndNV", EOpSubgroupPartitionedAnd); + symbolTable.relateToOperator("subgroupPartitionedOrNV", EOpSubgroupPartitionedOr); + symbolTable.relateToOperator("subgroupPartitionedXorNV", EOpSubgroupPartitionedXor); + symbolTable.relateToOperator("subgroupPartitionedInclusiveAddNV", EOpSubgroupPartitionedInclusiveAdd); + symbolTable.relateToOperator("subgroupPartitionedInclusiveMulNV", EOpSubgroupPartitionedInclusiveMul); + symbolTable.relateToOperator("subgroupPartitionedInclusiveMinNV", EOpSubgroupPartitionedInclusiveMin); + symbolTable.relateToOperator("subgroupPartitionedInclusiveMaxNV", EOpSubgroupPartitionedInclusiveMax); + symbolTable.relateToOperator("subgroupPartitionedInclusiveAndNV", EOpSubgroupPartitionedInclusiveAnd); + symbolTable.relateToOperator("subgroupPartitionedInclusiveOrNV", EOpSubgroupPartitionedInclusiveOr); + symbolTable.relateToOperator("subgroupPartitionedInclusiveXorNV", EOpSubgroupPartitionedInclusiveXor); + symbolTable.relateToOperator("subgroupPartitionedExclusiveAddNV", EOpSubgroupPartitionedExclusiveAdd); + symbolTable.relateToOperator("subgroupPartitionedExclusiveMulNV", EOpSubgroupPartitionedExclusiveMul); + symbolTable.relateToOperator("subgroupPartitionedExclusiveMinNV", EOpSubgroupPartitionedExclusiveMin); + symbolTable.relateToOperator("subgroupPartitionedExclusiveMaxNV", EOpSubgroupPartitionedExclusiveMax); + symbolTable.relateToOperator("subgroupPartitionedExclusiveAndNV", EOpSubgroupPartitionedExclusiveAnd); + symbolTable.relateToOperator("subgroupPartitionedExclusiveOrNV", EOpSubgroupPartitionedExclusiveOr); + symbolTable.relateToOperator("subgroupPartitionedExclusiveXorNV", EOpSubgroupPartitionedExclusiveXor); +#endif + } + if (profile == EEsProfile) { symbolTable.relateToOperator("shadow2DEXT", EOpTexture); symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj); @@ -6341,14 +9391,66 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion #ifdef AMD_EXTENSIONS if (profile != EEsProfile) symbolTable.relateToOperator("interpolateAtVertexAMD", EOpInterpolateAtVertex); - break; #endif + break; case EShLangCompute: - symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); - symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); + symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); + symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); + symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared); +#ifdef NV_EXTENSIONS + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) { + symbolTable.relateToOperator("dFdx", EOpDPdx); + symbolTable.relateToOperator("dFdy", EOpDPdy); + symbolTable.relateToOperator("fwidth", EOpFwidth); + symbolTable.relateToOperator("dFdxFine", EOpDPdxFine); + symbolTable.relateToOperator("dFdyFine", EOpDPdyFine); + symbolTable.relateToOperator("fwidthFine", EOpFwidthFine); + symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse); + symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse); + symbolTable.relateToOperator("fwidthCoarse",EOpFwidthCoarse); + } +#endif break; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: + case EShLangClosestHitNV: + case EShLangMissNV: + if (profile != EEsProfile && version >= 460) { + symbolTable.relateToOperator("traceNV", EOpTraceNV); + symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV); + } + break; + case EShLangIntersectNV: + if (profile != EEsProfile && version >= 460) + symbolTable.relateToOperator("reportIntersectionNV", EOpReportIntersectionNV); + break; + case EShLangAnyHitNV: + if (profile != EEsProfile && version >= 460) { + symbolTable.relateToOperator("ignoreIntersectionNV", EOpIgnoreIntersectionNV); + symbolTable.relateToOperator("terminateRayNV", EOpTerminateRayNV); + } + break; + case EShLangCallableNV: + if (profile != EEsProfile && version >= 460) { + symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV); + } + break; + case EShLangMeshNV: + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + symbolTable.relateToOperator("writePackedPrimitiveIndices4x8NV", EOpWritePackedPrimitiveIndices4x8NV); + } + // fall through + case EShLangTaskNV: + if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) { + symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared); + symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier); + } + break; +#endif + default: assert(false && "Language not supported"); } @@ -6382,9 +9484,9 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion if (version == 100 || IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) { TPrecisionQualifier pq = profile == EEsProfile ? EpqMedium : EpqNone; TType fragData(EbtFloat, EvqFragColor, pq, 4); - TArraySizes& arraySizes = *new TArraySizes; - arraySizes.addInnerSize(resources.maxDrawBuffers); - fragData.newArraySizes(arraySizes); + TArraySizes* arraySizes = new TArraySizes; + arraySizes->addInnerSize(resources.maxDrawBuffers); + fragData.transferArraySizes(arraySizes); symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData)); SpecialQualifier("gl_FragData", EvqFragColor, EbvFragData, symbolTable); } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h index 6b54c4da623..b5de3242332 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.h @@ -67,7 +67,6 @@ public: virtual const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; } virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) = 0; - virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) = 0; protected: @@ -89,7 +88,6 @@ public: void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage); void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable); - void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources); protected: diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 2fa0d8a85e4..46d481283cb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -2,6 +2,7 @@ // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2015 LunarG, Inc. // Copyright (C) 2015-2016 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -46,6 +47,7 @@ #include #include +#include namespace glslang { @@ -118,16 +120,12 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn return nullptr; // Try converting the children's base types to compatible types. - TIntermTyped* child = addConversion(op, left->getType(), right); - if (child) - right = child; - else { - child = addConversion(op, right->getType(), left); - if (child) - left = child; - else - return nullptr; - } + auto children = addConversion(op, left, right); + left = std::get<0>(children); + right = std::get<1>(children); + + if (left == nullptr || right == nullptr) + return nullptr; // Convert the children's type shape to be compatible. addBiShapeConversion(op, left, right); @@ -161,6 +159,11 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn if (specConstantPropagates(*node->getLeft(), *node->getRight()) && isSpecializationOperation(*node)) node->getWritableType().getQualifier().makeSpecConstant(); + // If must propagate nonuniform, make a nonuniform. + if ((node->getLeft()->getQualifier().nonUniform || node->getRight()->getQualifier().nonUniform) && + isNonuniformPropagating(node->getOp())) + node->getWritableType().getQualifier().nonUniform = true; + return node; } @@ -304,20 +307,18 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo // TBasicType newType = EbtVoid; switch (op) { + case EOpConstructInt8: newType = EbtInt8; break; + case EOpConstructUint8: newType = EbtUint8; break; + case EOpConstructInt16: newType = EbtInt16; break; + case EOpConstructUint16: newType = EbtUint16; break; case EOpConstructInt: newType = EbtInt; break; case EOpConstructUint: newType = EbtUint; break; case EOpConstructInt64: newType = EbtInt64; break; case EOpConstructUint64: newType = EbtUint64; break; -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: newType = EbtInt16; break; - case EOpConstructUint16: newType = EbtUint16; break; -#endif case EOpConstructBool: newType = EbtBool; break; case EOpConstructFloat: newType = EbtFloat; break; case EOpConstructDouble: newType = EbtDouble; break; -#ifdef AMD_EXTENSIONS case EOpConstructFloat16: newType = EbtFloat16; break; -#endif default: break; // some compilers want this } @@ -336,20 +337,18 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo // TODO: but, did this bypass constant folding? // switch (op) { + case EOpConstructInt8: + case EOpConstructUint8: + case EOpConstructInt16: + case EOpConstructUint16: case EOpConstructInt: case EOpConstructUint: case EOpConstructInt64: case EOpConstructUint64: -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: - case EOpConstructUint16: -#endif case EOpConstructBool: case EOpConstructFloat: case EOpConstructDouble: -#ifdef AMD_EXTENSIONS case EOpConstructFloat16: -#endif return child; default: break; // some compilers want this } @@ -373,10 +372,15 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo if (node->getOperand()->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*node)) node->getWritableType().getQualifier().makeSpecConstant(); + // If must propagate nonuniform, make a nonuniform. + if (node->getOperand()->getQualifier().nonUniform && isNonuniformPropagating(node->getOp())) + node->getWritableType().getQualifier().nonUniform = true; + return node; } -TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOperator op, bool unary, TIntermNode* childNode, const TType& returnType) +TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOperator op, bool unary, + TIntermNode* childNode, const TType& returnType) { if (unary) { // @@ -420,7 +424,7 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o // // Make sure we have an aggregate. If not turn it into one. // - if (node) { + if (node != nullptr) { aggNode = node->getAsAggregate(); if (aggNode == nullptr || aggNode->getOp() != EOpNull) { // @@ -446,29 +450,19 @@ TIntermTyped* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator o return fold(aggNode); } -// -// Convert the node's type to the given type, as allowed by the operation involved: 'op'. -// For implicit conversions, 'op' is not the requested conversion, it is the explicit -// operation requiring the implicit conversion. -// -// Returns a node representing the conversion, which could be the same -// node passed in if no conversion was needed. -// -// Generally, this is focused on basic type conversion, not shape conversion. -// See addShapeConversion(). -// -// Return nullptr if a conversion can't be done. -// -TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node) const +bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const { // // Does the base type even allow the operation? // switch (node->getBasicType()) { case EbtVoid: - return nullptr; + return false; case EbtAtomicUint: case EbtSampler: +#ifdef NV_EXTENSIONS + case EbtAccStructNV: +#endif // opaque types can be passed to functions if (op == EOpFunction) break; @@ -484,67 +478,284 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt break; // otherwise, opaque types can't even be operated on, let alone converted - return nullptr; + return false; default: break; } - // Otherwise, if types are identical, no problem - if (type == node->getType()) - return node; + return true; +} - // If one's a structure, then no conversions. - if (type.isStruct() || node->isStruct()) +// This is 'mechanism' here, it does any conversion told. +// It is about basic type, not about shape. +// The policy comes from the shader or the calling code. +TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped* node) const +{ + // + // Add a new newNode for the conversion. + // + TIntermUnary* newNode = nullptr; + + TOperator newOp = EOpNull; + + switch (convertTo) { + case EbtDouble: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToDouble; break; + case EbtUint8: newOp = EOpConvUint8ToDouble; break; + case EbtInt16: newOp = EOpConvInt16ToDouble; break; + case EbtUint16: newOp = EOpConvUint16ToDouble; break; + case EbtInt: newOp = EOpConvIntToDouble; break; + case EbtUint: newOp = EOpConvUintToDouble; break; + case EbtBool: newOp = EOpConvBoolToDouble; break; + case EbtFloat: newOp = EOpConvFloatToDouble; break; + case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; + case EbtInt64: newOp = EOpConvInt64ToDouble; break; + case EbtUint64: newOp = EOpConvUint64ToDouble; break; + default: + return nullptr; + } + break; + case EbtFloat: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToFloat; break; + case EbtUint8: newOp = EOpConvUint8ToFloat; break; + case EbtInt16: newOp = EOpConvInt16ToFloat; break; + case EbtUint16: newOp = EOpConvUint16ToFloat; break; + case EbtInt: newOp = EOpConvIntToFloat; break; + case EbtUint: newOp = EOpConvUintToFloat; break; + case EbtBool: newOp = EOpConvBoolToFloat; break; + case EbtDouble: newOp = EOpConvDoubleToFloat; break; + case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; + case EbtInt64: newOp = EOpConvInt64ToFloat; break; + case EbtUint64: newOp = EOpConvUint64ToFloat; break; + default: + return nullptr; + } + break; + case EbtFloat16: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToFloat16; break; + case EbtUint8: newOp = EOpConvUint8ToFloat16; break; + case EbtInt16: newOp = EOpConvInt16ToFloat16; break; + case EbtUint16: newOp = EOpConvUint16ToFloat16; break; + case EbtInt: newOp = EOpConvIntToFloat16; break; + case EbtUint: newOp = EOpConvUintToFloat16; break; + case EbtBool: newOp = EOpConvBoolToFloat16; break; + case EbtFloat: newOp = EOpConvFloatToFloat16; break; + case EbtDouble: newOp = EOpConvDoubleToFloat16; break; + case EbtInt64: newOp = EOpConvInt64ToFloat16; break; + case EbtUint64: newOp = EOpConvUint64ToFloat16; break; + default: + return nullptr; + } + break; + case EbtBool: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToBool; break; + case EbtUint8: newOp = EOpConvUint8ToBool; break; + case EbtInt16: newOp = EOpConvInt16ToBool; break; + case EbtUint16: newOp = EOpConvUint16ToBool; break; + case EbtInt: newOp = EOpConvIntToBool; break; + case EbtUint: newOp = EOpConvUintToBool; break; + case EbtFloat: newOp = EOpConvFloatToBool; break; + case EbtDouble: newOp = EOpConvDoubleToBool; break; + case EbtFloat16: newOp = EOpConvFloat16ToBool; break; + case EbtInt64: newOp = EOpConvInt64ToBool; break; + case EbtUint64: newOp = EOpConvUint64ToBool; break; + default: + return nullptr; + } + break; + case EbtInt8: + switch (node->getBasicType()) { + case EbtUint8: newOp = EOpConvUint8ToInt8; break; + case EbtInt16: newOp = EOpConvInt16ToInt8; break; + case EbtUint16: newOp = EOpConvUint16ToInt8; break; + case EbtInt: newOp = EOpConvIntToInt8; break; + case EbtUint: newOp = EOpConvUintToInt8; break; + case EbtInt64: newOp = EOpConvInt64ToInt8; break; + case EbtUint64: newOp = EOpConvUint64ToInt8; break; + case EbtBool: newOp = EOpConvBoolToInt8; break; + case EbtFloat: newOp = EOpConvFloatToInt8; break; + case EbtDouble: newOp = EOpConvDoubleToInt8; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt8; break; + default: + return nullptr; + } + break; + case EbtUint8: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToUint8; break; + case EbtInt16: newOp = EOpConvInt16ToUint8; break; + case EbtUint16: newOp = EOpConvUint16ToUint8; break; + case EbtInt: newOp = EOpConvIntToUint8; break; + case EbtUint: newOp = EOpConvUintToUint8; break; + case EbtInt64: newOp = EOpConvInt64ToUint8; break; + case EbtUint64: newOp = EOpConvUint64ToUint8; break; + case EbtBool: newOp = EOpConvBoolToUint8; break; + case EbtFloat: newOp = EOpConvFloatToUint8; break; + case EbtDouble: newOp = EOpConvDoubleToUint8; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint8; break; + default: + return nullptr; + } + break; + + case EbtInt16: + switch (node->getBasicType()) { + case EbtUint8: newOp = EOpConvUint8ToInt16; break; + case EbtInt8: newOp = EOpConvInt8ToInt16; break; + case EbtUint16: newOp = EOpConvUint16ToInt16; break; + case EbtInt: newOp = EOpConvIntToInt16; break; + case EbtUint: newOp = EOpConvUintToInt16; break; + case EbtInt64: newOp = EOpConvInt64ToInt16; break; + case EbtUint64: newOp = EOpConvUint64ToInt16; break; + case EbtBool: newOp = EOpConvBoolToInt16; break; + case EbtFloat: newOp = EOpConvFloatToInt16; break; + case EbtDouble: newOp = EOpConvDoubleToInt16; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt16; break; + default: + return nullptr; + } + break; + case EbtUint16: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToUint16; break; + case EbtUint8: newOp = EOpConvUint8ToUint16; break; + case EbtInt16: newOp = EOpConvInt16ToUint16; break; + case EbtInt: newOp = EOpConvIntToUint16; break; + case EbtUint: newOp = EOpConvUintToUint16; break; + case EbtInt64: newOp = EOpConvInt64ToUint16; break; + case EbtUint64: newOp = EOpConvUint64ToUint16; break; + case EbtBool: newOp = EOpConvBoolToUint16; break; + case EbtFloat: newOp = EOpConvFloatToUint16; break; + case EbtDouble: newOp = EOpConvDoubleToUint16; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint16; break; + default: + return nullptr; + } + break; + + case EbtInt: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToInt; break; + case EbtUint8: newOp = EOpConvUint8ToInt; break; + case EbtInt16: newOp = EOpConvInt16ToInt; break; + case EbtUint16: newOp = EOpConvUint16ToInt; break; + case EbtUint: newOp = EOpConvUintToInt; break; + case EbtBool: newOp = EOpConvBoolToInt; break; + case EbtFloat: newOp = EOpConvFloatToInt; break; + case EbtDouble: newOp = EOpConvDoubleToInt; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt; break; + case EbtInt64: newOp = EOpConvInt64ToInt; break; + case EbtUint64: newOp = EOpConvUint64ToInt; break; + default: + return nullptr; + } + break; + case EbtUint: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToUint; break; + case EbtUint8: newOp = EOpConvUint8ToUint; break; + case EbtInt16: newOp = EOpConvInt16ToUint; break; + case EbtUint16: newOp = EOpConvUint16ToUint; break; + case EbtInt: newOp = EOpConvIntToUint; break; + case EbtBool: newOp = EOpConvBoolToUint; break; + case EbtFloat: newOp = EOpConvFloatToUint; break; + case EbtDouble: newOp = EOpConvDoubleToUint; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint; break; + case EbtInt64: newOp = EOpConvInt64ToUint; break; + case EbtUint64: newOp = EOpConvUint64ToUint; break; + default: + return nullptr; + } + break; + case EbtInt64: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToInt64; break; + case EbtUint8: newOp = EOpConvUint8ToInt64; break; + case EbtInt16: newOp = EOpConvInt16ToInt64; break; + case EbtUint16: newOp = EOpConvUint16ToInt64; break; + case EbtInt: newOp = EOpConvIntToInt64; break; + case EbtUint: newOp = EOpConvUintToInt64; break; + case EbtBool: newOp = EOpConvBoolToInt64; break; + case EbtFloat: newOp = EOpConvFloatToInt64; break; + case EbtDouble: newOp = EOpConvDoubleToInt64; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt64; break; + case EbtUint64: newOp = EOpConvUint64ToInt64; break; + default: + return nullptr; + } + break; + case EbtUint64: + switch (node->getBasicType()) { + case EbtInt8: newOp = EOpConvInt8ToUint64; break; + case EbtUint8: newOp = EOpConvUint8ToUint64; break; + case EbtInt16: newOp = EOpConvInt16ToUint64; break; + case EbtUint16: newOp = EOpConvUint16ToUint64; break; + case EbtInt: newOp = EOpConvIntToUint64; break; + case EbtUint: newOp = EOpConvUintToUint64; break; + case EbtBool: newOp = EOpConvBoolToUint64; break; + case EbtFloat: newOp = EOpConvFloatToUint64; break; + case EbtDouble: newOp = EOpConvDoubleToUint64; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint64; break; + case EbtInt64: newOp = EOpConvInt64ToUint64; break; + default: + return nullptr; + } + break; + default: return nullptr; + } - // If one's an array, then no conversions. - if (type.isArray() || node->getType().isArray()) - return nullptr; + TType newType(convertTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows()); + newNode = addUnaryNode(newOp, node, node->getLoc(), newType); - // Note: callers are responsible for other aspects of shape, - // like vector and matrix sizes. + if (node->getAsConstantUnion()) { + TIntermTyped* folded = node->getAsConstantUnion()->fold(newOp, newType); + if (folded) + return folded; + } - TBasicType promoteTo; + // Propagate specialization-constant-ness, if allowed + if (node->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*newNode)) + newNode->getWritableType().getQualifier().makeSpecConstant(); + + return newNode; +} + +// For converting a pair of operands to a binary operation to compatible +// types with each other, relative to the operation in 'op'. +// This does not cover assignment operations, which is asymmetric in that the +// left type is not changeable. +// See addConversion(op, type, node) for assignments and unary operation +// conversions. +// +// Generally, this is focused on basic type conversion, not shape conversion. +// See addShapeConversion() for shape conversions. +// +// Returns the converted pair of nodes. +// Returns when there is no conversion. +std::tuple +TIntermediate::addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1) const +{ + if (!isConversionAllowed(op, node0) || !isConversionAllowed(op, node1)) + return std::make_tuple(nullptr, nullptr); + + if (node0->getType() != node1->getType()) { + // If differing structure, then no conversions. + if (node0->isStruct() || node1->isStruct()) + return std::make_tuple(nullptr, nullptr); + + // If differing arrays, then no conversions. + if (node0->getType().isArray() || node1->getType().isArray()) + return std::make_tuple(nullptr, nullptr); + } + + auto promoteTo = std::make_tuple(EbtNumTypes, EbtNumTypes); switch (op) { - // - // Explicit conversions (unary operations) - // - case EOpConstructBool: - promoteTo = EbtBool; - break; - case EOpConstructFloat: - promoteTo = EbtFloat; - break; - case EOpConstructDouble: - promoteTo = EbtDouble; - break; -#ifdef AMD_EXTENSIONS - case EOpConstructFloat16: - promoteTo = EbtFloat16; - break; -#endif - case EOpConstructInt: - promoteTo = EbtInt; - break; - case EOpConstructUint: - promoteTo = EbtUint; - break; - case EOpConstructInt64: - promoteTo = EbtInt64; - break; - case EOpConstructUint64: - promoteTo = EbtUint64; - break; -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: - promoteTo = EbtInt16; - break; - case EOpConstructUint16: - promoteTo = EbtUint16; - break; -#endif - // // List all the binary ops that can implicitly convert one operand to the other's type; // This implements the 'policy' for implicit type conversion. @@ -570,15 +781,172 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpAnd: case EOpInclusiveOr: case EOpExclusiveOr: - case EOpAndAssign: - case EOpInclusiveOrAssign: - case EOpExclusiveOrAssign: - case EOpLogicalNot: + + case EOpSequence: // used by ?: + + if (node0->getBasicType() == node1->getBasicType()) + return std::make_tuple(node0, node1); + + promoteTo = getConversionDestinatonType(node0->getBasicType(), node1->getBasicType(), op); + if (std::get<0>(promoteTo) == EbtNumTypes || std::get<1>(promoteTo) == EbtNumTypes) + return std::make_tuple(nullptr, nullptr); + + break; + case EOpLogicalAnd: case EOpLogicalOr: case EOpLogicalXor: + if (source == EShSourceHlsl) + promoteTo = std::make_tuple(EbtBool, EbtBool); + else + return std::make_tuple(node0, node1); + break; + + // There are no conversions needed for GLSL; the shift amount just needs to be an + // integer type, as does the base. + // HLSL can promote bools to ints to make this work. + case EOpLeftShift: + case EOpRightShift: + if (source == EShSourceHlsl) { + TBasicType node0BasicType = node0->getBasicType(); + if (node0BasicType == EbtBool) + node0BasicType = EbtInt; + if (node1->getBasicType() == EbtBool) + promoteTo = std::make_tuple(node0BasicType, EbtInt); + else + promoteTo = std::make_tuple(node0BasicType, node1->getBasicType()); + } else { + if (isTypeInt(node0->getBasicType()) && isTypeInt(node1->getBasicType())) + return std::make_tuple(node0, node1); + else + return std::make_tuple(nullptr, nullptr); + } + break; + + default: + if (node0->getType() == node1->getType()) + return std::make_tuple(node0, node1); + + return std::make_tuple(nullptr, nullptr); + } + + TIntermTyped* newNode0; + TIntermTyped* newNode1; + + if (std::get<0>(promoteTo) != node0->getType().getBasicType()) { + if (node0->getAsConstantUnion()) + newNode0 = promoteConstantUnion(std::get<0>(promoteTo), node0->getAsConstantUnion()); + else + newNode0 = createConversion(std::get<0>(promoteTo), node0); + } else + newNode0 = node0; + + if (std::get<1>(promoteTo) != node1->getType().getBasicType()) { + if (node1->getAsConstantUnion()) + newNode1 = promoteConstantUnion(std::get<1>(promoteTo), node1->getAsConstantUnion()); + else + newNode1 = createConversion(std::get<1>(promoteTo), node1); + } else + newNode1 = node1; + + return std::make_tuple(newNode0, newNode1); +} + +// +// Convert the node's type to the given type, as allowed by the operation involved: 'op'. +// For implicit conversions, 'op' is not the requested conversion, it is the explicit +// operation requiring the implicit conversion. +// +// Binary operation conversions should be handled by addConversion(op, node, node), not here. +// +// Returns a node representing the conversion, which could be the same +// node passed in if no conversion was needed. +// +// Generally, this is focused on basic type conversion, not shape conversion. +// See addShapeConversion() for shape conversions. +// +// Return nullptr if a conversion can't be done. +// +TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node) const +{ + if (!isConversionAllowed(op, node)) + return nullptr; + + // Otherwise, if types are identical, no problem + if (type == node->getType()) + return node; + + // If one's a structure, then no conversions. + if (type.isStruct() || node->isStruct()) + return nullptr; + + // If one's an array, then no conversions. + if (type.isArray() || node->getType().isArray()) + return nullptr; + + // Note: callers are responsible for other aspects of shape, + // like vector and matrix sizes. + + TBasicType promoteTo; + // GL_EXT_shader_16bit_storage can't do OpConstantComposite with + // 16-bit types, so disable promotion for those types. + bool canPromoteConstant = true; + + switch (op) { + // + // Explicit conversions (unary operations) + // + case EOpConstructBool: + promoteTo = EbtBool; + break; + case EOpConstructFloat: + promoteTo = EbtFloat; + break; + case EOpConstructDouble: + promoteTo = EbtDouble; + break; + case EOpConstructFloat16: + promoteTo = EbtFloat16; + canPromoteConstant = extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_float16); + break; + case EOpConstructInt8: + promoteTo = EbtInt8; + canPromoteConstant = extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int8); + break; + case EOpConstructUint8: + promoteTo = EbtUint8; + canPromoteConstant = extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int8); + break; + case EOpConstructInt16: + promoteTo = EbtInt16; + canPromoteConstant = extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int16); + break; + case EOpConstructUint16: + promoteTo = EbtUint16; + canPromoteConstant = extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int16); + break; + case EOpConstructInt: + promoteTo = EbtInt; + break; + case EOpConstructUint: + promoteTo = EbtUint; + break; + case EOpConstructInt64: + promoteTo = EbtInt64; + break; + case EOpConstructUint64: + promoteTo = EbtUint64; + break; + + case EOpLogicalNot: case EOpFunctionCall: + case EOpReturn: case EOpAssign: case EOpAddAssign: @@ -588,6 +956,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt case EOpMatrixTimesScalarAssign: case EOpDivAssign: case EOpModAssign: + case EOpAndAssign: + case EOpInclusiveOrAssign: + case EOpExclusiveOrAssign: case EOpAtan: case EOpClamp: @@ -616,43 +987,28 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt if (type.getBasicType() == node->getType().getBasicType()) return node; - if (canImplicitlyPromote(node->getType().getBasicType(), type.getBasicType(), op)) + if (canImplicitlyPromote(node->getBasicType(), type.getBasicType(), op)) promoteTo = type.getBasicType(); else - return nullptr; - + return nullptr; break; - // Shifts can have mixed types as long as they are integer, without converting. - // It's the left operand's type that determines the resulting type, so no issue - // with assign shift ops either. - case EOpLeftShift: - case EOpRightShift: + // For GLSL, there are no conversions needed; the shift amount just needs to be an + // integer type, as do the base/result. + // HLSL can convert the shift from a bool to an int. case EOpLeftShiftAssign: case EOpRightShiftAssign: - if ((type.getBasicType() == EbtInt || - type.getBasicType() == EbtUint || -#ifdef AMD_EXTENSIONS - type.getBasicType() == EbtInt16 || - type.getBasicType() == EbtUint16 || -#endif - type.getBasicType() == EbtInt64 || - type.getBasicType() == EbtUint64) && - (node->getType().getBasicType() == EbtInt || - node->getType().getBasicType() == EbtUint || -#ifdef AMD_EXTENSIONS - node->getType().getBasicType() == EbtInt16 || - node->getType().getBasicType() == EbtUint16 || -#endif - node->getType().getBasicType() == EbtInt64 || - node->getType().getBasicType() == EbtUint64)) - - return node; - else if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool) { + { + if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool) promoteTo = type.getBasicType(); - break; - } else - return nullptr; + else { + if (isTypeInt(type.getBasicType()) && isTypeInt(node->getBasicType())) + return node; + else + return nullptr; + } + break; + } default: // default is to require a match; all exceptions should have case statements above @@ -663,213 +1019,13 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt return nullptr; } - if (node->getAsConstantUnion()) + if (canPromoteConstant && node->getAsConstantUnion()) return promoteConstantUnion(promoteTo, node->getAsConstantUnion()); // // Add a new newNode for the conversion. // - TIntermUnary* newNode = nullptr; - - TOperator newOp = EOpNull; - - // This is 'mechanism' here, it does any conversion told. The policy comes - // from the shader or the above code. - switch (promoteTo) { - case EbtDouble: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToDouble; break; - case EbtUint: newOp = EOpConvUintToDouble; break; - case EbtBool: newOp = EOpConvBoolToDouble; break; - case EbtFloat: newOp = EOpConvFloatToDouble; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToDouble; break; - case EbtUint64: newOp = EOpConvUint64ToDouble; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToDouble; break; - case EbtUint16: newOp = EOpConvUint16ToDouble; break; -#endif - default: - return nullptr; - } - break; - case EbtFloat: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToFloat; break; - case EbtUint: newOp = EOpConvUintToFloat; break; - case EbtBool: newOp = EOpConvBoolToFloat; break; - case EbtDouble: newOp = EOpConvDoubleToFloat; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToFloat; break; - case EbtUint64: newOp = EOpConvUint64ToFloat; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToFloat; break; - case EbtUint16: newOp = EOpConvUint16ToFloat; break; -#endif - default: - return nullptr; - } - break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToFloat16; break; - case EbtUint: newOp = EOpConvUintToFloat16; break; - case EbtBool: newOp = EOpConvBoolToFloat16; break; - case EbtFloat: newOp = EOpConvFloatToFloat16; break; - case EbtDouble: newOp = EOpConvDoubleToFloat16; break; - case EbtInt64: newOp = EOpConvInt64ToFloat16; break; - case EbtUint64: newOp = EOpConvUint64ToFloat16; break; - case EbtInt16: newOp = EOpConvInt16ToFloat16; break; - case EbtUint16: newOp = EOpConvUint16ToFloat16; break; - default: - return nullptr; - } - break; -#endif - case EbtBool: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToBool; break; - case EbtUint: newOp = EOpConvUintToBool; break; - case EbtFloat: newOp = EOpConvFloatToBool; break; - case EbtDouble: newOp = EOpConvDoubleToBool; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToBool; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToBool; break; - case EbtUint64: newOp = EOpConvUint64ToBool; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToBool; break; - case EbtUint16: newOp = EOpConvUint16ToBool; break; -#endif - default: - return nullptr; - } - break; - case EbtInt: - switch (node->getBasicType()) { - case EbtUint: newOp = EOpConvUintToInt; break; - case EbtBool: newOp = EOpConvBoolToInt; break; - case EbtFloat: newOp = EOpConvFloatToInt; break; - case EbtDouble: newOp = EOpConvDoubleToInt; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToInt; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToInt; break; - case EbtUint64: newOp = EOpConvUint64ToInt; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToInt; break; - case EbtUint16: newOp = EOpConvUint16ToInt; break; -#endif - default: - return nullptr; - } - break; - case EbtUint: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint; break; - case EbtBool: newOp = EOpConvBoolToUint; break; - case EbtFloat: newOp = EOpConvFloatToUint; break; - case EbtDouble: newOp = EOpConvDoubleToUint; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToUint; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToUint; break; - case EbtUint64: newOp = EOpConvUint64ToUint; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToUint; break; - case EbtUint16: newOp = EOpConvUint16ToUint; break; -#endif - default: - return nullptr; - } - break; - case EbtInt64: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToInt64; break; - case EbtUint: newOp = EOpConvUintToInt64; break; - case EbtBool: newOp = EOpConvBoolToInt64; break; - case EbtFloat: newOp = EOpConvFloatToInt64; break; - case EbtDouble: newOp = EOpConvDoubleToInt64; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToInt64; break; -#endif - case EbtUint64: newOp = EOpConvUint64ToInt64; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToInt64; break; - case EbtUint16: newOp = EOpConvUint16ToInt64; break; -#endif - default: - return nullptr; - } - break; - case EbtUint64: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint64; break; - case EbtUint: newOp = EOpConvUintToUint64; break; - case EbtBool: newOp = EOpConvBoolToUint64; break; - case EbtFloat: newOp = EOpConvFloatToUint64; break; - case EbtDouble: newOp = EOpConvDoubleToUint64; break; -#ifdef AMD_EXTENSIONS - case EbtFloat16: newOp = EOpConvFloat16ToUint64; break; -#endif - case EbtInt64: newOp = EOpConvInt64ToUint64; break; -#ifdef AMD_EXTENSIONS - case EbtInt16: newOp = EOpConvInt16ToUint64; break; - case EbtUint16: newOp = EOpConvUint16ToUint64; break; -#endif - default: - return nullptr; - } - break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToInt16; break; - case EbtUint: newOp = EOpConvUintToInt16; break; - case EbtBool: newOp = EOpConvBoolToInt16; break; - case EbtFloat: newOp = EOpConvFloatToInt16; break; - case EbtDouble: newOp = EOpConvDoubleToInt16; break; - case EbtFloat16: newOp = EOpConvFloat16ToInt16; break; - case EbtInt64: newOp = EOpConvInt64ToInt16; break; - case EbtUint64: newOp = EOpConvUint64ToInt16; break; - case EbtUint16: newOp = EOpConvUint16ToInt16; break; - default: - return nullptr; - } - break; - case EbtUint16: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint16; break; - case EbtUint: newOp = EOpConvUintToUint16; break; - case EbtBool: newOp = EOpConvBoolToUint16; break; - case EbtFloat: newOp = EOpConvFloatToUint16; break; - case EbtDouble: newOp = EOpConvDoubleToUint16; break; - case EbtFloat16: newOp = EOpConvFloat16ToUint16; break; - case EbtInt64: newOp = EOpConvInt64ToUint16; break; - case EbtUint64: newOp = EOpConvUint64ToUint16; break; - case EbtInt16: newOp = EOpConvInt16ToUint16; break; - default: - return nullptr; - } - break; -#endif - default: - return nullptr; - } - - TType newType(promoteTo, EvqTemporary, node->getVectorSize(), node->getMatrixCols(), node->getMatrixRows()); - newNode = addUnaryNode(newOp, node, node->getLoc(), newType); - - // TODO: it seems that some unary folding operations should occur here, but are not - - // Propagate specialization-constant-ness, if allowed - if (node->getType().getQualifier().isSpecConstant() && isSpecializationOperation(*newNode)) - newNode->getWritableType().getQualifier().makeSpecConstant(); + TIntermTyped* newNode = createConversion(promoteTo, node); return newNode; } @@ -967,9 +1123,12 @@ void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, T rhsNode = addUniShapeConversion(op, lhsNode->getType(), rhsNode); return; + case EOpMul: + // matrix multiply does not change shapes + if (lhsNode->isMatrix() && rhsNode->isMatrix()) + return; case EOpAdd: case EOpSub: - case EOpMul: case EOpDiv: // want to support vector * scalar native ops in AST and lower, not smear, similarly for // matrix * vector, etc. @@ -1019,12 +1178,11 @@ void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, T rhsNode = addShapeConversion(lhsNode->getType(), rhsNode); } -// Convert the node's shape of type for the given type. It's not necessarily -// an error if they are different and not converted, as some operations accept -// mixed types. Promotion will do final shape checking. +// Convert the node's shape of type for the given type, as allowed by the +// operation involved: 'op'. // -// If there is a chance of two nodes, with conversions possible in each direction, -// the policy for what to ask for must be in the caller; this will do what is asked. +// Generally, the AST represents allowed GLSL shapes, so this isn't needed +// for GLSL. Bad shapes are caught in conversion or promotion. // // Return 'node' if no conversion was done. Promotion handles final shape // checking. @@ -1043,9 +1201,19 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* // The new node that handles the conversion TOperator constructorOp = mapTypeToConstructorOp(type); - // HLSL has custom semantics for scalar->mat shape conversions. if (source == EShSourceHlsl) { - if (node->getType().isScalarOrVec1() && type.isMatrix()) { + // HLSL rules for scalar, vector and matrix conversions: + // 1) scalar can become anything, initializing every component with its value + // 2) vector and matrix can become scalar, first element is used (warning: truncation) + // 3) matrix can become matrix with less rows and/or columns (warning: truncation) + // 4) vector can become vector with less rows size (warning: truncation) + // 5a) vector 4 can become 2x2 matrix (special case) (same packing layout, its a reinterpret) + // 5b) 2x2 matrix can become vector 4 (special case) (same packing layout, its a reinterpret) + + const TType &sourceType = node->getType(); + + // rule 1 for scalar to matrix is special + if (sourceType.isScalarOrVec1() && type.isMatrix()) { // HLSL semantics: the scalar (or vec1) is replicated to every component of the matrix. Left to its // own devices, the constructor from a scalar would populate the diagonal. This forces replication @@ -1053,7 +1221,7 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* // Note that if the node is complex (e.g, a function call), we don't want to duplicate it here // repeatedly, so we copy it to a temp, then use the temp. - const int matSize = type.getMatrixRows() * type.getMatrixCols(); + const int matSize = type.computeNumComponents(); TIntermAggregate* rhsAggregate = new TIntermAggregate(); const bool isSimple = (node->getAsSymbolNode() != nullptr) || (node->getAsConstantUnion() != nullptr); @@ -1061,12 +1229,44 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* if (!isSimple) { assert(0); // TODO: use node replicator service when available. } - - for (int x=0; xgetSequence().push_back(node); return setAggregateOperator(rhsAggregate, constructorOp, type, node->getLoc()); } + + // rule 1 and 2 + if ((sourceType.isScalar() && !type.isScalar()) || (!sourceType.isScalar() && type.isScalar())) + return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc()); + + // rule 3 and 5b + if (sourceType.isMatrix()) { + // rule 3 + if (type.isMatrix()) { + if ((sourceType.getMatrixCols() != type.getMatrixCols() || sourceType.getMatrixRows() != type.getMatrixRows()) && + sourceType.getMatrixCols() >= type.getMatrixCols() && sourceType.getMatrixRows() >= type.getMatrixRows()) + return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc()); + // rule 5b + } else if (type.isVector()) { + if (type.getVectorSize() == 4 && sourceType.getMatrixCols() == 2 && sourceType.getMatrixRows() == 2) + return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc()); + } + } + + // rule 4 and 5a + if (sourceType.isVector()) { + // rule 4 + if (type.isVector()) + { + if (sourceType.getVectorSize() > type.getVectorSize()) + return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc()); + // rule 5a + } else if (type.isMatrix()) { + if (sourceType.getVectorSize() == 4 && type.getMatrixCols() == 2 && type.getMatrixRows() == 2) + return setAggregateOperator(makeAggregate(node), constructorOp, type, node->getLoc()); + } + } } // scalar -> vector or vec1 -> vector or @@ -1080,6 +1280,166 @@ TIntermTyped* TIntermediate::addShapeConversion(const TType& type, TIntermTyped* return node; } +bool TIntermediate::isIntegralPromotion(TBasicType from, TBasicType to) const +{ + // integral promotions + if (to == EbtInt) { + switch(from) { + case EbtInt8: + case EbtInt16: + case EbtUint8: + case EbtUint16: + return true; + default: + break; + } + } + return false; +} + +bool TIntermediate::isFPPromotion(TBasicType from, TBasicType to) const +{ + // floating-point promotions + if (to == EbtDouble) { + switch(from) { + case EbtFloat16: + case EbtFloat: + return true; + default: + break; + } + } + return false; +} + +bool TIntermediate::isIntegralConversion(TBasicType from, TBasicType to) const +{ + switch (from) { + case EbtInt8: + switch (to) { + case EbtUint8: + case EbtInt16: + case EbtUint16: + case EbtUint: + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtUint8: + switch (to) { + case EbtInt16: + case EbtUint16: + case EbtUint: + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtInt16: + switch(to) { + case EbtUint16: + case EbtUint: + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtUint16: + switch(to) { + case EbtUint: + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtInt: + switch(to) { + case EbtUint: + return version >= 400 || (source == EShSourceHlsl); + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtUint: + switch(to) { + case EbtInt64: + case EbtUint64: + return true; + default: + break; + } + break; + case EbtInt64: + if (to == EbtUint64) { + return true; + } + break; + default: + break; + } + return false; +} + +bool TIntermediate::isFPConversion(TBasicType from, TBasicType to) const +{ + if (to == EbtFloat && from == EbtFloat16) { + return true; + } else { + return false; + } +} + +bool TIntermediate::isFPIntegralConversion(TBasicType from, TBasicType to) const +{ + switch (from) { + case EbtInt8: + case EbtUint8: + case EbtInt16: + case EbtUint16: + switch (to) { + case EbtFloat16: + case EbtFloat: + case EbtDouble: + return true; + default: + break; + } + break; + case EbtInt: + case EbtUint: + switch(to) { + case EbtFloat: + case EbtDouble: + return true; + default: + break; + } + break; + case EbtInt64: + case EbtUint64: + if (to == EbtDouble) { + return true; + } + break; + + default: + break; + } + return false; +} + // // See if the 'from' type is allowed to be implicitly converted to the // 'to' type. This is not about vector/array/struct, only about basic type. @@ -1125,120 +1485,350 @@ bool TIntermediate::canImplicitlyPromote(TBasicType from, TBasicType to, TOperat } } - switch (to) { - case EbtDouble: - switch (from) { - case EbtInt: - case EbtUint: - case EbtInt64: - case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif - case EbtFloat: + bool explicitTypesEnabled = extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int8) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int16) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int32) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_int64) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_float16) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_float32) || + extensionRequested(E_GL_KHX_shader_explicit_arithmetic_types_float64); + + if (explicitTypesEnabled) { + // integral promotions + if (isIntegralPromotion(from, to)) { + return true; + } + + // floating-point promotions + if (isFPPromotion(from, to)) { + return true; + } + + // integral conversions + if (isIntegralConversion(from, to)) { + return true; + } + + // floating-point conversions + if (isFPConversion(from, to)) { + return true; + } + + // floating-integral conversions + if (isFPIntegralConversion(from, to)) { + return true; + } + + // hlsl supported conversions + if (source == EShSourceHlsl) { + if (from == EbtBool && (to == EbtInt || to == EbtUint || to == EbtFloat)) + return true; + } + } else { + switch (to) { case EbtDouble: + switch (from) { + case EbtInt: + case EbtUint: + case EbtInt64: + case EbtUint64: + case EbtFloat: + case EbtDouble: + return true; #ifdef AMD_EXTENSIONS - case EbtFloat16: -#endif - return true; - default: - return false; - } - case EbtFloat: - switch (from) { - case EbtInt: - case EbtUint: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: + case EbtInt16: + case EbtUint16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); + case EbtFloat16: + return extensionRequested(E_GL_AMD_gpu_shader_half_float); #endif + default: + return false; + } case EbtFloat: + switch (from) { + case EbtInt: + case EbtUint: + case EbtFloat: + return true; + case EbtBool: + return (source == EShSourceHlsl); #ifdef AMD_EXTENSIONS - case EbtFloat16: + case EbtInt16: + case EbtUint16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); #endif - return true; - case EbtBool: - return (source == EShSourceHlsl); - default: - return false; - } - case EbtUint: - switch (from) { - case EbtInt: - return version >= 400 || (source == EShSourceHlsl); + case EbtFloat16: + return +#ifdef AMD_EXTENSIONS + extensionRequested(E_GL_AMD_gpu_shader_half_float) || +#endif + (source == EShSourceHlsl); + default: + return false; + } case EbtUint: + switch (from) { + case EbtInt: + return version >= 400 || (source == EShSourceHlsl); + case EbtUint: + return true; + case EbtBool: + return (source == EShSourceHlsl); #ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: + case EbtInt16: + case EbtUint16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); #endif - return true; - case EbtBool: - return (source == EShSourceHlsl); - default: - return false; - } - case EbtInt: - switch (from) { + default: + return false; + } case EbtInt: + switch (from) { + case EbtInt: + return true; + case EbtBool: + return (source == EShSourceHlsl); #ifdef AMD_EXTENSIONS - case EbtInt16: + case EbtInt16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); #endif - return true; - case EbtBool: - return (source == EShSourceHlsl); - default: - return false; - } - case EbtUint64: - switch (from) { - case EbtInt: - case EbtUint: - case EbtInt64: + default: + return false; + } case EbtUint64: + switch (from) { + case EbtInt: + case EbtUint: + case EbtInt64: + case EbtUint64: + return true; #ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: + case EbtInt16: + case EbtUint16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); #endif - return true; - default: - return false; - } - case EbtInt64: - switch (from) { - case EbtInt: + default: + return false; + } case EbtInt64: + switch (from) { + case EbtInt: + case EbtInt64: + return true; #ifdef AMD_EXTENSIONS - case EbtInt16: + case EbtInt16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); #endif - return true; - default: - return false; - } -#ifdef AMD_EXTENSIONS - case EbtFloat16: - switch (from) { - case EbtInt16: - case EbtUint16: + default: + return false; + } case EbtFloat16: - return true; +#ifdef AMD_EXTENSIONS + switch (from) { + case EbtInt16: + case EbtUint16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); + case EbtFloat16: + return extensionRequested(E_GL_AMD_gpu_shader_half_float); + default: + break; + } +#endif + return false; + case EbtUint16: +#ifdef AMD_EXTENSIONS + switch (from) { + case EbtInt16: + case EbtUint16: + return extensionRequested(E_GL_AMD_gpu_shader_int16); + default: + break; + } +#endif + return false; default: return false; } - case EbtUint16: - switch (from) { - case EbtInt16: + } + + return false; +} + +static bool canSignedIntTypeRepresentAllUnsignedValues(TBasicType sintType, TBasicType uintType) { + switch(sintType) { + case EbtInt8: + switch(uintType) { + case EbtUint8: + case EbtUint16: + case EbtUint: + case EbtUint64: + return false; + default: + assert(false); + return false; + } + break; + case EbtInt16: + switch(uintType) { + case EbtUint8: + return true; + case EbtUint16: + case EbtUint: + case EbtUint64: + return false; + default: + assert(false); + return false; + } + break; + case EbtInt: + switch(uintType) { + case EbtUint8: case EbtUint16: return true; + case EbtUint: + return false; default: + assert(false); return false; } -#endif + break; + case EbtInt64: + switch(uintType) { + case EbtUint8: + case EbtUint16: + case EbtUint: + return true; + case EbtUint64: + return false; + default: + assert(false); + return false; + } + break; default: + assert(false); return false; } } + +static TBasicType getCorrespondingUnsignedType(TBasicType type) { + switch(type) { + case EbtInt8: + return EbtUint8; + case EbtInt16: + return EbtUint16; + case EbtInt: + return EbtUint; + case EbtInt64: + return EbtUint64; + default: + assert(false); + return EbtNumTypes; + } +} + +// Implements the following rules +// - If either operand has type float64_t or derived from float64_t, +// the other shall be converted to float64_t or derived type. +// - Otherwise, if either operand has type float32_t or derived from +// float32_t, the other shall be converted to float32_t or derived type. +// - Otherwise, if either operand has type float16_t or derived from +// float16_t, the other shall be converted to float16_t or derived type. +// - Otherwise, if both operands have integer types the following rules +// shall be applied to the operands: +// - If both operands have the same type, no further conversion +// is needed. +// - Otherwise, if both operands have signed integer types or both +// have unsigned integer types, the operand with the type of lesser +// integer conversion rank shall be converted to the type of the +// operand with greater rank. +// - Otherwise, if the operand that has unsigned integer type has rank +// greater than or equal to the rank of the type of the other +// operand, the operand with signed integer type shall be converted +// to the type of the operand with unsigned integer type. +// - Otherwise, if the type of the operand with signed integer type can +// represent all of the values of the type of the operand with +// unsigned integer type, the operand with unsigned integer type +// shall be converted to the type of the operand with signed +// integer type. +// - Otherwise, both operands shall be converted to the unsigned +// integer type corresponding to the type of the operand with signed +// integer type. + +std::tuple TIntermediate::getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const +{ + TBasicType res0 = EbtNumTypes; + TBasicType res1 = EbtNumTypes; + + if (profile == EEsProfile || version == 110) + return std::make_tuple(res0, res1);; + + if (source == EShSourceHlsl) { + if (canImplicitlyPromote(type1, type0, op)) { + res0 = type0; + res1 = type0; + } else if (canImplicitlyPromote(type0, type1, op)) { + res0 = type1; + res1 = type1; + } + return std::make_tuple(res0, res1); + } + + if ((type0 == EbtDouble && canImplicitlyPromote(type1, EbtDouble, op)) || + (type1 == EbtDouble && canImplicitlyPromote(type0, EbtDouble, op)) ) { + res0 = EbtDouble; + res1 = EbtDouble; + } else if ((type0 == EbtFloat && canImplicitlyPromote(type1, EbtFloat, op)) || + (type1 == EbtFloat && canImplicitlyPromote(type0, EbtFloat, op)) ) { + res0 = EbtFloat; + res1 = EbtFloat; + } else if ((type0 == EbtFloat16 && canImplicitlyPromote(type1, EbtFloat16, op)) || + (type1 == EbtFloat16 && canImplicitlyPromote(type0, EbtFloat16, op)) ) { + res0 = EbtFloat16; + res1 = EbtFloat16; + } else if (isTypeInt(type0) && isTypeInt(type1) && + (canImplicitlyPromote(type0, type1, op) || canImplicitlyPromote(type1, type0, op))) { + if ((isTypeSignedInt(type0) && isTypeSignedInt(type1)) || + (isTypeUnsignedInt(type0) && isTypeUnsignedInt(type1))) { + if (getTypeRank(type0) < getTypeRank(type1)) { + res0 = type1; + res1 = type1; + } else { + res0 = type0; + res1 = type0; + } + } else if (isTypeUnsignedInt(type0) && (getTypeRank(type0) > getTypeRank(type1))) { + res0 = type0; + res1 = type0; + } else if (isTypeUnsignedInt(type1) && (getTypeRank(type1) > getTypeRank(type0))) { + res0 = type1; + res1 = type1; + } else if (isTypeSignedInt(type0)) { + if (canSignedIntTypeRepresentAllUnsignedValues(type0, type1)) { + res0 = type0; + res1 = type0; + } else { + res0 = getCorrespondingUnsignedType(type0); + res1 = getCorrespondingUnsignedType(type0); + } + } else if (isTypeSignedInt(type1)) { + if (canSignedIntTypeRepresentAllUnsignedValues(type1, type0)) { + res0 = type1; + res1 = type1; + } else { + res0 = getCorrespondingUnsignedType(type1); + res1 = getCorrespondingUnsignedType(type1); + } + } + } + + return std::make_tuple(res0, res1); +} + // // Given a type, find what operation would fully construct it. // @@ -1246,6 +1836,9 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const { TOperator op = EOpNull; + if (type.getQualifier().nonUniform) + return EOpConstructNonuniform; + switch (type.getBasicType()) { case EbtStruct: op = EOpConstructStruct; @@ -1331,7 +1924,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const } } break; -#ifdef AMD_EXTENSIONS case EbtFloat16: if (type.getMatrixCols()) { switch (type.getMatrixCols()) { @@ -1371,7 +1963,42 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const } } break; -#endif + case EbtInt8: + switch(type.getVectorSize()) { + case 1: op = EOpConstructInt8; break; + case 2: op = EOpConstructI8Vec2; break; + case 3: op = EOpConstructI8Vec3; break; + case 4: op = EOpConstructI8Vec4; break; + default: break; // some compilers want this + } + break; + case EbtUint8: + switch(type.getVectorSize()) { + case 1: op = EOpConstructUint8; break; + case 2: op = EOpConstructU8Vec2; break; + case 3: op = EOpConstructU8Vec3; break; + case 4: op = EOpConstructU8Vec4; break; + default: break; // some compilers want this + } + break; + case EbtInt16: + switch(type.getVectorSize()) { + case 1: op = EOpConstructInt16; break; + case 2: op = EOpConstructI16Vec2; break; + case 3: op = EOpConstructI16Vec3; break; + case 4: op = EOpConstructI16Vec4; break; + default: break; // some compilers want this + } + break; + case EbtUint16: + switch(type.getVectorSize()) { + case 1: op = EOpConstructUint16; break; + case 2: op = EOpConstructU16Vec2; break; + case 3: op = EOpConstructU16Vec3; break; + case 4: op = EOpConstructU16Vec4; break; + default: break; // some compilers want this + } + break; case EbtInt: if (type.getMatrixCols()) { switch (type.getMatrixCols()) { @@ -1466,26 +2093,6 @@ TOperator TIntermediate::mapTypeToConstructorOp(const TType& type) const default: break; // some compilers want this } break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - switch(type.getVectorSize()) { - case 1: op = EOpConstructInt16; break; - case 2: op = EOpConstructI16Vec2; break; - case 3: op = EOpConstructI16Vec3; break; - case 4: op = EOpConstructI16Vec4; break; - default: break; // some compilers want this - } - break; - case EbtUint16: - switch(type.getVectorSize()) { - case 1: op = EOpConstructUint16; break; - case 2: op = EOpConstructU16Vec2; break; - case 3: op = EOpConstructU16Vec3; break; - case 4: op = EOpConstructU16Vec4; break; - default: break; // some compilers want this - } - break; -#endif case EbtBool: if (type.getMatrixCols()) { switch (type.getMatrixCols()) { @@ -1614,7 +2221,7 @@ TIntermAggregate* TIntermediate::makeAggregate(const TSourceLoc& loc) // // Returns the selection node created. // -TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc, TSelectionControl control) +TIntermSelection* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc) { // // Don't prune the false path for compile-time constants; it's needed @@ -1623,7 +2230,6 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair no TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2); node->setLoc(loc); - node->setSelectionControl(control); return node; } @@ -1666,27 +2272,28 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type, // // Returns the selection node created, or nullptr if one could not be. // -TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& loc, TSelectionControl control) +TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, + const TSourceLoc& loc) { // If it's void, go to the if-then-else selection() if (trueBlock->getBasicType() == EbtVoid && falseBlock->getBasicType() == EbtVoid) { TIntermNodePair pair = { trueBlock, falseBlock }; - return addSelection(cond, pair, loc, control); + TIntermSelection* selection = addSelection(cond, pair, loc); + if (getSource() == EShSourceHlsl) + selection->setNoShortCircuit(); + + return selection; } // // Get compatible types. // - TIntermTyped* child = addConversion(EOpSequence, trueBlock->getType(), falseBlock); - if (child) - falseBlock = child; - else { - child = addConversion(EOpSequence, falseBlock->getType(), trueBlock); - if (child) - trueBlock = child; - else - return nullptr; - } + auto children = addConversion(EOpSequence, trueBlock, falseBlock); + trueBlock = std::get<0>(children); + falseBlock = std::get<1>(children); + + if (trueBlock == nullptr || falseBlock == nullptr) + return nullptr; // Handle a vector condition as a mix if (!cond->getType().isScalarOrVec1()) { @@ -1742,6 +2349,9 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true else node->getQualifier().makeTemporary(); + if (getSource() == EShSourceHlsl) + node->setNoShortCircuit(); + return node; } @@ -1761,6 +2371,37 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(const TConstUnionArray& un return node; } +TIntermConstantUnion* TIntermediate::addConstantUnion(signed char i8, const TSourceLoc& loc, bool literal) const +{ + TConstUnionArray unionArray(1); + unionArray[0].setI8Const(i8); + + return addConstantUnion(unionArray, TType(EbtInt8, EvqConst), loc, literal); +} + +TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned char u8, const TSourceLoc& loc, bool literal) const +{ + TConstUnionArray unionArray(1); + unionArray[0].setUConst(u8); + + return addConstantUnion(unionArray, TType(EbtUint8, EvqConst), loc, literal); +} + +TIntermConstantUnion* TIntermediate::addConstantUnion(signed short i16, const TSourceLoc& loc, bool literal) const +{ + TConstUnionArray unionArray(1); + unionArray[0].setI16Const(i16); + + return addConstantUnion(unionArray, TType(EbtInt16, EvqConst), loc, literal); +} + +TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned short u16, const TSourceLoc& loc, bool literal) const +{ + TConstUnionArray unionArray(1); + unionArray[0].setU16Const(u16); + + return addConstantUnion(unionArray, TType(EbtUint16, EvqConst), loc, literal); +} TIntermConstantUnion* TIntermediate::addConstantUnion(int i, const TSourceLoc& loc, bool literal) const { @@ -1794,24 +2435,6 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned long long u64, co return addConstantUnion(unionArray, TType(EbtUint64, EvqConst), loc, literal); } -#ifdef AMD_EXTENSIONS -TIntermConstantUnion* TIntermediate::addConstantUnion(short i16, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setIConst(i16); - - return addConstantUnion(unionArray, TType(EbtInt16, EvqConst), loc, literal); -} - -TIntermConstantUnion* TIntermediate::addConstantUnion(unsigned short u16, const TSourceLoc& loc, bool literal) const -{ - TConstUnionArray unionArray(1); - unionArray[0].setUConst(u16); - - return addConstantUnion(unionArray, TType(EbtUint16, EvqConst), loc, literal); -} -#endif - TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc& loc, bool literal) const { TConstUnionArray unionArray(1); @@ -1822,11 +2445,7 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(bool b, const TSourceLoc& TIntermConstantUnion* TIntermediate::addConstantUnion(double d, TBasicType baseType, const TSourceLoc& loc, bool literal) const { -#ifdef AMD_EXTENSIONS assert(baseType == EbtFloat || baseType == EbtDouble || baseType == EbtFloat16); -#else - assert(baseType == EbtFloat || baseType == EbtDouble); -#endif TConstUnionArray unionArray(1); unionArray[0].setDConst(d); @@ -1909,11 +2528,11 @@ const TIntermTyped* TIntermediate::findLValueBase(const TIntermTyped* node, bool // // Create while and do-while loop nodes. // -TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TLoopControl control) +TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, + const TSourceLoc& loc) { TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst); node->setLoc(loc); - node->setLoopControl(control); return node; } @@ -1921,11 +2540,11 @@ TIntermLoop* TIntermediate::addLoop(TIntermNode* body, TIntermTyped* test, TInte // // Create a for-loop sequence. // -TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TLoopControl control) +TIntermAggregate* TIntermediate::addForLoop(TIntermNode* body, TIntermNode* initializer, TIntermTyped* test, + TIntermTyped* terminal, bool testFirst, const TSourceLoc& loc, TIntermLoop*& node) { - TIntermLoop* node = new TIntermLoop(body, test, terminal, testFirst); + node = new TIntermLoop(body, test, terminal, testFirst); node->setLoc(loc); - node->setLoopControl(control); // make a sequence of the initializer and statement, but try to reuse the // aggregate already created for whatever is in the initializer, if there is one @@ -2121,12 +2740,10 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const case EOpVectorSwizzle: case EOpConvFloatToDouble: case EOpConvDoubleToFloat: -#ifdef AMD_EXTENSIONS case EOpConvFloat16ToFloat: case EOpConvFloatToFloat16: case EOpConvFloat16ToDouble: case EOpConvDoubleToFloat16: -#endif return true; default: return false; @@ -2150,51 +2767,97 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const case EOpIndexDirectStruct: case EOpVectorSwizzle: - // conversion constructors - case EOpConvIntToBool: - case EOpConvUintToBool: - case EOpConvUintToInt: - case EOpConvBoolToInt: - case EOpConvIntToUint: - case EOpConvBoolToUint: - case EOpConvInt64ToBool: - case EOpConvBoolToInt64: - case EOpConvUint64ToBool: - case EOpConvBoolToUint64: - case EOpConvInt64ToInt: - case EOpConvIntToInt64: - case EOpConvUint64ToUint: - case EOpConvUintToUint64: - case EOpConvInt64ToUint64: - case EOpConvUint64ToInt64: - case EOpConvInt64ToUint: - case EOpConvUintToInt64: - case EOpConvUint64ToInt: - case EOpConvIntToUint64: -#ifdef AMD_EXTENSIONS + // (u)int* -> bool + case EOpConvInt8ToBool: case EOpConvInt16ToBool: - case EOpConvBoolToInt16: - case EOpConvInt16ToInt: - case EOpConvIntToInt16: - case EOpConvInt16ToUint: - case EOpConvUintToInt16: - case EOpConvInt16ToInt64: - case EOpConvInt64ToInt16: - case EOpConvInt16ToUint64: - case EOpConvUint64ToInt16: + case EOpConvIntToBool: + case EOpConvInt64ToBool: + case EOpConvUint8ToBool: case EOpConvUint16ToBool: + case EOpConvUintToBool: + case EOpConvUint64ToBool: + + // bool -> (u)int* + case EOpConvBoolToInt8: + case EOpConvBoolToInt16: + case EOpConvBoolToInt: + case EOpConvBoolToInt64: + case EOpConvBoolToUint8: case EOpConvBoolToUint16: - case EOpConvUint16ToInt: - case EOpConvIntToUint16: - case EOpConvUint16ToUint: - case EOpConvUintToUint16: - case EOpConvUint16ToInt64: - case EOpConvInt64ToUint16: - case EOpConvUint16ToUint64: - case EOpConvUint64ToUint16: + case EOpConvBoolToUint: + case EOpConvBoolToUint64: + + // int8_t -> (u)int* + case EOpConvInt8ToInt16: + case EOpConvInt8ToInt: + case EOpConvInt8ToInt64: + case EOpConvInt8ToUint8: + case EOpConvInt8ToUint16: + case EOpConvInt8ToUint: + case EOpConvInt8ToUint64: + + // int16_t -> (u)int* + case EOpConvInt16ToInt8: + case EOpConvInt16ToInt: + case EOpConvInt16ToInt64: + case EOpConvInt16ToUint8: case EOpConvInt16ToUint16: + case EOpConvInt16ToUint: + case EOpConvInt16ToUint64: + + // int32_t -> (u)int* + case EOpConvIntToInt8: + case EOpConvIntToInt16: + case EOpConvIntToInt64: + case EOpConvIntToUint8: + case EOpConvIntToUint16: + case EOpConvIntToUint: + case EOpConvIntToUint64: + + // int64_t -> (u)int* + case EOpConvInt64ToInt8: + case EOpConvInt64ToInt16: + case EOpConvInt64ToInt: + case EOpConvInt64ToUint8: + case EOpConvInt64ToUint16: + case EOpConvInt64ToUint: + case EOpConvInt64ToUint64: + + // uint8_t -> (u)int* + case EOpConvUint8ToInt8: + case EOpConvUint8ToInt16: + case EOpConvUint8ToInt: + case EOpConvUint8ToInt64: + case EOpConvUint8ToUint16: + case EOpConvUint8ToUint: + case EOpConvUint8ToUint64: + + // uint16_t -> (u)int* + case EOpConvUint16ToInt8: case EOpConvUint16ToInt16: -#endif + case EOpConvUint16ToInt: + case EOpConvUint16ToInt64: + case EOpConvUint16ToUint8: + case EOpConvUint16ToUint: + case EOpConvUint16ToUint64: + + // uint32_t -> (u)int* + case EOpConvUintToInt8: + case EOpConvUintToInt16: + case EOpConvUintToInt: + case EOpConvUintToInt64: + case EOpConvUintToUint8: + case EOpConvUintToUint16: + case EOpConvUintToUint64: + + // uint64_t -> (u)int* + case EOpConvUint64ToInt8: + case EOpConvUint64ToInt16: + case EOpConvUint64ToInt: + case EOpConvUint64ToInt64: + case EOpConvUint64ToUint8: + case EOpConvUint64ToUint16: + case EOpConvUint64ToUint: // unary operations case EOpNegative: @@ -2228,6 +2891,64 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const } } +// Is the operation one that must propagate nonuniform? +bool TIntermediate::isNonuniformPropagating(TOperator op) const +{ + // "* All Operators in Section 5.1 (Operators), except for assignment, + // arithmetic assignment, and sequence + // * Component selection in Section 5.5 + // * Matrix components in Section 5.6 + // * Structure and Array Operations in Section 5.7, except for the length + // method." + switch (op) { + case EOpPostIncrement: + case EOpPostDecrement: + case EOpPreIncrement: + case EOpPreDecrement: + + case EOpNegative: + case EOpLogicalNot: + case EOpVectorLogicalNot: + case EOpBitwiseNot: + + case EOpAdd: + case EOpSub: + case EOpMul: + case EOpDiv: + case EOpMod: + case EOpRightShift: + case EOpLeftShift: + case EOpAnd: + case EOpInclusiveOr: + case EOpExclusiveOr: + case EOpEqual: + case EOpNotEqual: + case EOpLessThan: + case EOpGreaterThan: + case EOpLessThanEqual: + case EOpGreaterThanEqual: + case EOpVectorTimesScalar: + case EOpVectorTimesMatrix: + case EOpMatrixTimesVector: + case EOpMatrixTimesScalar: + + case EOpLogicalOr: + case EOpLogicalXor: + case EOpLogicalAnd: + + case EOpIndexDirect: + case EOpIndexIndirect: + case EOpIndexDirectStruct: + case EOpVectorSwizzle: + return true; + + default: + break; + } + + return false; +} + //////////////////////////////////////////////////////////////// // // Member functions of the nodes used for building the tree. @@ -2312,7 +3033,7 @@ bool TIntermediate::promoteUnary(TIntermUnary& node) // Convert operand to a boolean type if (operand->getBasicType() != EbtBool) { // Add constructor to boolean type. If that fails, we can't do it, so return false. - TIntermTyped* converted = convertToBasicType(op, EbtBool, operand); + TIntermTyped* converted = addConversion(op, TType(EbtBool), operand); if (converted == nullptr) return false; @@ -2321,15 +3042,7 @@ bool TIntermediate::promoteUnary(TIntermUnary& node) } break; case EOpBitwiseNot: - if (operand->getBasicType() != EbtInt && - operand->getBasicType() != EbtUint && -#ifdef AMD_EXTENSIONS - operand->getBasicType() != EbtInt16 && - operand->getBasicType() != EbtUint16 && -#endif - operand->getBasicType() != EbtInt64 && - operand->getBasicType() != EbtUint64) - + if (!isTypeInt(operand->getBasicType())) return false; break; case EOpNegative: @@ -2337,18 +3050,9 @@ bool TIntermediate::promoteUnary(TIntermUnary& node) case EOpPostDecrement: case EOpPreIncrement: case EOpPreDecrement: - if (operand->getBasicType() != EbtInt && - operand->getBasicType() != EbtUint && - operand->getBasicType() != EbtInt64 && - operand->getBasicType() != EbtUint64 && -#ifdef AMD_EXTENSIONS - operand->getBasicType() != EbtInt16 && - operand->getBasicType() != EbtUint16 && -#endif + if (!isTypeInt(operand->getBasicType()) && operand->getBasicType() != EbtFloat && -#ifdef AMD_EXTENSIONS operand->getBasicType() != EbtFloat16 && -#endif operand->getBasicType() != EbtDouble) return false; @@ -2368,34 +3072,12 @@ bool TIntermediate::promoteUnary(TIntermUnary& node) void TIntermUnary::updatePrecision() { -#ifdef AMD_EXTENSIONS if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat || getBasicType() == EbtFloat16) { -#else - if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) { -#endif if (operand->getQualifier().precision > getQualifier().precision) getQualifier().precision = operand->getQualifier().precision; } } -// If it is not already, convert this node to the given basic type. -TIntermTyped* TIntermediate::convertToBasicType(TOperator op, TBasicType basicType, TIntermTyped* node) const -{ - if (node == nullptr) - return nullptr; - - // It's already this basic type: nothing needs to be done, so use the node directly. - if (node->getBasicType() == basicType) - return node; - - const TType& type = node->getType(); - const TType newType(basicType, type.getQualifier().storage, - type.getVectorSize(), type.getMatrixCols(), type.getMatrixRows(), type.isVector()); - - // Add constructor to the right vectorness of the right type. If that fails, we can't do it, so return nullptr. - return addConversion(op, newType, node); -} - // // See TIntermediate::promote // @@ -2468,12 +3150,19 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) case EOpSub: case EOpDiv: case EOpMul: - left = addConversion(op, TType(EbtInt, EvqTemporary, left->getVectorSize()), left); - right = addConversion(op, TType(EbtInt, EvqTemporary, right->getVectorSize()), right); + if (left->getBasicType() == EbtBool) + left = createConversion(EbtInt, left); + if (right->getBasicType() == EbtBool) + right = createConversion(EbtInt, right); if (left == nullptr || right == nullptr) return false; node.setLeft(left); node.setRight(right); + + // Update the original base assumption on result type.. + node.setType(left->getType()); + node.getWritableType().getQualifier().clear(); + break; default: @@ -2515,21 +3204,17 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) case EOpLogicalAnd: case EOpLogicalOr: case EOpLogicalXor: - if (getSource() == EShSourceHlsl) { - TIntermTyped* convertedL = convertToBasicType(op, EbtBool, left); - TIntermTyped* convertedR = convertToBasicType(op, EbtBool, right); - if (convertedL == nullptr || convertedR == nullptr) + // logical ops operate only on Booleans or vectors of Booleans. + if (left->getBasicType() != EbtBool || left->isMatrix()) return false; - node.setLeft(left = convertedL); // also updates stack variable - node.setRight(right = convertedR); // also updates stack variable - } else { + + if (getSource() == EShSourceGlsl) { // logical ops operate only on scalar Booleans and will promote to scalar Boolean. - if (left->getBasicType() != EbtBool || left->isVector() || left->isMatrix()) + if (left->isVector()) return false; } node.setType(TType(EbtBool, EvqTemporary, left->getVectorSize())); - break; case EOpRightShift: @@ -2550,16 +3235,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) break; // Check for integer-only operands. - if ((left->getBasicType() != EbtInt && left->getBasicType() != EbtUint && -#ifdef AMD_EXTENSIONS - left->getBasicType() != EbtInt16 && left->getBasicType() != EbtUint16 && -#endif - left->getBasicType() != EbtInt64 && left->getBasicType() != EbtUint64) || - (right->getBasicType() != EbtInt && right->getBasicType() != EbtUint && -#ifdef AMD_EXTENSIONS - right->getBasicType() != EbtInt16 && right->getBasicType() != EbtUint16 && -#endif - right->getBasicType() != EbtInt64 && right->getBasicType() != EbtUint64)) + if (!isTypeInt(left->getBasicType()) && !isTypeInt(right->getBasicType())) return false; if (left->isMatrix() || right->isMatrix()) return false; @@ -2700,7 +3376,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node) node.setOp(op = EOpMatrixTimesScalarAssign); } } else if (left->isMatrix() && right->isMatrix()) { - if (left->getMatrixCols() != left->getMatrixRows() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows()) + if (left->getMatrixCols() != right->getMatrixCols() || left->getMatrixCols() != right->getMatrixRows()) return false; node.setOp(op = EOpMatrixTimesMatrixAssign); } else if (!left->isMatrix() && !right->isMatrix()) { @@ -2860,11 +3536,7 @@ bool TIntermediate::promoteAggregate(TIntermAggregate& node) void TIntermBinary::updatePrecision() { -#ifdef AMD_EXTENSIONS if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat || getBasicType() == EbtFloat16) { -#else - if (getBasicType() == EbtInt || getBasicType() == EbtUint || getBasicType() == EbtFloat) { -#endif getQualifier().precision = std::max(right->getQualifier().precision, left->getQualifier().precision); if (getQualifier().precision != EpqNone) { left->propagatePrecision(getQualifier().precision); @@ -2875,11 +3547,7 @@ void TIntermBinary::updatePrecision() void TIntermTyped::propagatePrecision(TPrecisionQualifier newPrecision) { -#ifdef AMD_EXTENSIONS if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat && getBasicType() != EbtFloat16)) -#else - if (getQualifier().precision != EpqNone || (getBasicType() != EbtInt && getBasicType() != EbtUint && getBasicType() != EbtFloat)) -#endif return; getQualifier().precision = newPrecision; @@ -2954,9 +3622,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i] = rightUnionArray[i]; break; default: @@ -2982,16 +3648,13 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i] = rightUnionArray[i]; break; default: return node; } break; -#ifdef AMD_EXTENSIONS case EbtFloat16: switch (node->getType().getBasicType()) { case EbtInt: @@ -3018,7 +3681,6 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC return node; } break; -#endif case EbtInt: switch (node->getType().getBasicType()) { case EbtInt: @@ -3038,9 +3700,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i].setIConst(static_cast(rightUnionArray[i].getDConst())); break; default: @@ -3066,9 +3726,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i].setUConst(static_cast(rightUnionArray[i].getDConst())); break; default: @@ -3094,9 +3752,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i].setBConst(rightUnionArray[i].getDConst() != 0.0); break; default: @@ -3122,9 +3778,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i].setI64Const(static_cast(rightUnionArray[i].getDConst())); break; default: @@ -3150,9 +3804,7 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif leftUnionArray[i].setU64Const(static_cast(rightUnionArray[i].getDConst())); break; default: @@ -3195,23 +3847,39 @@ struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser { bool visitAggregate(TVisit, TIntermAggregate* ag) override { using namespace std; TIntermSequence& seq = ag->getSequence(); - // remove pure sampler variables - TIntermSequence::iterator newEnd = remove_if(seq.begin(), seq.end(), [](TIntermNode* node) { - TIntermSymbol* symbol = node->getAsSymbolNode(); - if (!symbol) - return false; + TQualifierList& qual = ag->getQualifierList(); - return (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isPureSampler()); - }); - seq.erase(newEnd, seq.end()); - // replace constructors with sampler/textures - for_each(seq.begin(), seq.end(), [](TIntermNode*& node) { - TIntermAggregate *constructor = node->getAsAggregate(); + // qual and seq are indexed using the same indices, so we have to modify both in lock-step + assert(seq.size() == qual.size() || qual.empty()); + + size_t write = 0; + for (size_t i = 0; i < seq.size(); ++i) { + TIntermSymbol* symbol = seq[i]->getAsSymbolNode(); + if (symbol && symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isPureSampler()) { + // remove pure sampler variables + continue; + } + + TIntermNode* result = seq[i]; + + // replace constructors with sampler/textures + TIntermAggregate *constructor = seq[i]->getAsAggregate(); if (constructor && constructor->getOp() == EOpConstructTextureSampler) { if (!constructor->getSequence().empty()) - node = constructor->getSequence()[0]; + result = constructor->getSequence()[0]; } - }); + + // write new node & qualifier + seq[write] = result; + if (!qual.empty()) + qual[write] = qual[i]; + write++; + } + + seq.resize(write); + if (!qual.empty()) + qual.resize(write); + return true; } }; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp index bbc3cac085f..7a968ce50cf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseContextBase.cpp @@ -153,6 +153,12 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, if (node->getQualifier().readonly) message = "can't modify a readonly buffer"; break; +#ifdef NV_EXTENSIONS + case EvqHitAttrNV: + if (language != EShLangIntersectNV) + message = "cannot modify hitAttributeNV in this stage"; + break; +#endif default: // @@ -168,6 +174,11 @@ bool TParseContextBase::lValueErrorCheck(const TSourceLoc& loc, const char* op, case EbtVoid: message = "can't modify void"; break; +#ifdef NV_EXTENSIONS + case EbtAccStructNV: + message = "can't modify accelerationStructureNV"; + break; +#endif default: break; } @@ -228,6 +239,7 @@ void TParseContextBase::rValueErrorCheck(const TSourceLoc& loc, const char* op, // must still be valid. // It is okay if the symbol's type will be subsequently edited; // the modifications will be tracked. +// Order is preserved, to avoid creating novel forward references. void TParseContextBase::trackLinkage(TSymbol& symbol) { if (!parsingBuiltins) @@ -242,7 +254,7 @@ void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int error(loc, "", "[", "index out of range '%d'", index); index = 0; } else if (type.isArray()) { - if (type.isExplicitlySizedArray() && index >= type.getOuterArraySize()) { + if (type.isSizedArray() && index >= type.getOuterArraySize()) { error(loc, "", "[", "array index out of range '%d'", index); index = type.getOuterArraySize() - 1; } @@ -602,7 +614,7 @@ void TParseContextBase::finish() if (parsingBuiltins) return; - // Transfer the linkage symbols to AST nodes + // Transfer the linkage symbols to AST nodes, preserving order. TIntermAggregate* linkage = new TIntermAggregate; for (auto i = linkageSymbols.begin(); i != linkageSymbols.end(); ++i) intermediate.addSymbolLinkageNode(linkage, **i); diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 733b74dab1b..67a861f5b52 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -2,6 +2,7 @@ // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2015 LunarG, Inc. // Copyright (C) 2015-2016 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -75,6 +76,10 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b globalBufferDefaults.layoutMatrix = ElmColumnMajor; globalBufferDefaults.layoutPacking = spvVersion.spv != 0 ? ElpStd430 : ElpShared; + // use storage buffer on SPIR-V 1.3 and up + if (spvVersion.spv >= EShTargetSpv_1_3) + intermediate.setUseStorageBuffer(); + globalInputDefaults.clear(); globalOutputDefaults.clear(); @@ -266,7 +271,14 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& if (tokens.size() != 1) error(loc, "extra tokens", "#pragma", ""); intermediate.setUseStorageBuffer(); - } + } else if (spvVersion.spv > 0 && tokens[0].compare("use_vulkan_memory_model") == 0) { + if (tokens.size() != 1) + error(loc, "extra tokens", "#pragma", ""); + intermediate.setUseVulkanMemoryModel(); + } else if (tokens[0].compare("once") == 0) { + warn(loc, "not implemented", "#pragma once", ""); + } else if (tokens[0].compare("glslang_binary_double_output") == 0) + intermediate.setBinaryDoubleOutput(); } // @@ -281,17 +293,17 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str()); if (symbol && symbol->isReadOnly()) { - // All shared things containing an implicitly sized array must be copied up + // All shared things containing an unsized array must be copied up // on first use, so that all future references will share its array structure, // so that editing the implicit size will effect all nodes consuming it, // and so that editing the implicit size won't change the shared one. // // If this is a variable or a block, check it and all it contains, but if this // is a member of an anonymous block, check the whole block, as the whole block - // will need to be copied up if it contains an implicitly-sized array. - if (symbol->getType().containsImplicitlySizedArray() || + // will need to be copied up if it contains an unsized array. + if (symbol->getType().containsUnsizedArray() || (symbol->getAsAnonMember() && - symbol->getAsAnonMember()->getAnonContainer().getType().containsImplicitlySizedArray())) + symbol->getAsAnonMember()->getAnonContainer().getType().containsUnsizedArray())) makeEditable(symbol); } @@ -350,84 +362,118 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb // TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIntermTyped* base, TIntermTyped* index) { - TIntermTyped* result = nullptr; - int indexValue = 0; if (index->getQualifier().isFrontEndConstant()) indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst(); + // basic type checks... variableCheck(base); + if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) { if (base->getAsSymbolNode()) error(loc, " left of '[' is not of type array, matrix, or vector ", base->getAsSymbolNode()->getName().c_str(), ""); else error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", ""); - } else if (base->getType().getQualifier().isFrontEndConstant() && index->getQualifier().isFrontEndConstant()) { + + // Insert dummy error-recovery result + return intermediate.addConstantUnion(0.0, EbtFloat, loc); + } + + if (!base->isArray() && base->isVector()) { + if (base->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, "[", "does not operate on types containing float16"); + if (base->getType().contains16BitInt()) + requireInt16Arithmetic(loc, "[", "does not operate on types containing (u)int16"); + if (base->getType().contains8BitInt()) + requireInt8Arithmetic(loc, "[", "does not operate on types containing (u)int8"); + } + + // check for constant folding + if (base->getType().getQualifier().isFrontEndConstant() && index->getQualifier().isFrontEndConstant()) { // both base and index are front-end constants checkIndex(loc, base->getType(), indexValue); return intermediate.foldDereference(base, indexValue, loc); - } else { - // at least one of base and index is not a front-end constant variable... + } - if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) - handleIoResizeArrayAccess(loc, base); + // at least one of base and index is not a front-end constant variable... + TIntermTyped* result = nullptr; + if (index->getQualifier().isFrontEndConstant()) + checkIndex(loc, base->getType(), indexValue); - if (index->getQualifier().isFrontEndConstant()) { - if (base->getType().isImplicitlySizedArray()) - updateImplicitArraySize(loc, base, indexValue); - else - checkIndex(loc, base->getType(), indexValue); - result = intermediate.addIndex(EOpIndexDirect, base, index, loc); - } else { - if (base->getType().isImplicitlySizedArray()) { - if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) - error(loc, "", "[", "array must be sized by a redeclaration or layout qualifier before being indexed with a variable"); - else - error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); - } - if (base->getBasicType() == EbtBlock) { - if (base->getQualifier().storage == EvqBuffer) - requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); - else if (base->getQualifier().storage == EvqUniform) - profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, - "variable indexing uniform block array"); - else { - // input/output blocks either don't exist or can be variable indexed + if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) + handleIoResizeArrayAccess(loc, base); + + if (index->getQualifier().isFrontEndConstant()) { + if (base->getType().isUnsizedArray()) { + base->getWritableType().updateImplicitArraySize(indexValue + 1); +#ifdef NV_EXTENSIONS + // For 2D per-view builtin arrays, update the inner dimension size in parent type + if (base->getQualifier().isPerView() && base->getQualifier().builtIn != EbvNone) { + TIntermBinary* binaryNode = base->getAsBinaryNode(); + if (binaryNode) { + TType& leftType = binaryNode->getLeft()->getWritableType(); + TArraySizes& arraySizes = *leftType.getArraySizes(); + assert(arraySizes.getNumDims() == 2); + arraySizes.setDimSize(1, std::max(arraySizes.getDimSize(1), indexValue + 1)); } - } else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) - requireProfile(base->getLoc(), ~EEsProfile, "variable indexing fragment shader output array"); - else if (base->getBasicType() == EbtSampler && version >= 130) { - const char* explanation = "variable indexing sampler array"; - requireProfile(base->getLoc(), EEsProfile | ECoreProfile | ECompatibilityProfile, explanation); - profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, explanation); - profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation); } - - result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); - } - } - - if (result == nullptr) { - // Insert dummy error-recovery result - result = intermediate.addConstantUnion(0.0, EbtFloat, loc); +#endif + } else + checkIndex(loc, base->getType(), indexValue); + result = intermediate.addIndex(EOpIndexDirect, base, index, loc); } else { - // Insert valid dereferenced result - TType newType(base->getType(), 0); // dereferenced type - if (base->getType().getQualifier().isConstant() && index->getQualifier().isConstant()) { - newType.getQualifier().storage = EvqConst; - // If base or index is a specialization constant, the result should also be a specialization constant. - if (base->getType().getQualifier().isSpecConstant() || index->getQualifier().isSpecConstant()) { - newType.getQualifier().makeSpecConstant(); + if (base->getType().isUnsizedArray()) { + // we have a variable index into an unsized array, which is okay, + // depending on the situation + if (base->getAsSymbolNode() && isIoResizeArray(base->getType())) + error(loc, "", "[", "array must be sized by a redeclaration or layout qualifier before being indexed with a variable"); + else { + // it is okay for a run-time sized array + checkRuntimeSizable(loc, *base); } - } else { - newType.getQualifier().makePartialTemporary(); + base->getWritableType().setArrayVariablyIndexed(); + } + if (base->getBasicType() == EbtBlock) { + if (base->getQualifier().storage == EvqBuffer) + requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); + else if (base->getQualifier().storage == EvqUniform) + profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, + "variable indexing uniform block array"); + else { + // input/output blocks either don't exist or can be variable indexed + } + } else if (language == EShLangFragment && base->getQualifier().isPipeOutput()) + requireProfile(base->getLoc(), ~EEsProfile, "variable indexing fragment shader output array"); + else if (base->getBasicType() == EbtSampler && version >= 130) { + const char* explanation = "variable indexing sampler array"; + requireProfile(base->getLoc(), EEsProfile | ECoreProfile | ECompatibilityProfile, explanation); + profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, explanation); + profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation); } - result->setType(newType); - if (anyIndexLimits) - handleIndexLimits(loc, base, index); + result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); } + // Insert valid dereferenced result + TType newType(base->getType(), 0); // dereferenced type + if (base->getType().getQualifier().isConstant() && index->getQualifier().isConstant()) { + newType.getQualifier().storage = EvqConst; + // If base or index is a specialization constant, the result should also be a specialization constant. + if (base->getType().getQualifier().isSpecConstant() || index->getQualifier().isSpecConstant()) { + newType.getQualifier().makeSpecConstant(); + } + } else { + newType.getQualifier().makePartialTemporary(); + } + result->setType(newType); + + // Propagate nonuniform + if (base->getQualifier().isNonUniform() || index->getQualifier().isNonUniform()) + result->getWritableType().getQualifier().nonUniform = true; + + if (anyIndexLimits) + handleIndexLimits(loc, base, index); + return result; } @@ -461,12 +507,20 @@ void TParseContext::makeEditable(TSymbol*& symbol) ioArraySymbolResizeList.push_back(symbol); } -// Return true if this is a geometry shader input array or tessellation control output array. +// Return true if this is a geometry shader input array or tessellation control output array +// or mesh shader output array. bool TParseContext::isIoResizeArray(const TType& type) const { return type.isArray() && ((language == EShLangGeometry && type.getQualifier().storage == EvqVaryingIn) || - (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && ! type.getQualifier().patch)); + (language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut && ! type.getQualifier().patch) +#ifdef NV_EXTENSIONS + || + (language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn && type.getQualifier().pervertexNV) || + (language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut && !type.getQualifier().perTaskNV) + +#endif + ); } // If an array is not isIoResizeArray() but is an io array, make sure it has the right size @@ -482,7 +536,7 @@ void TParseContext::fixIoArraySize(const TSourceLoc& loc, TType& type) if (language == EShLangTessControl || language == EShLangTessEvaluation) { if (type.getOuterArraySize() != resources.maxPatchVertices) { - if (type.isExplicitlySizedArray()) + if (type.isSizedArray()) error(loc, "tessellation input array size must be gl_MaxPatchVertices or implicitly sized", "[]", ""); type.changeOuterArraySize(resources.maxPatchVertices); } @@ -515,8 +569,8 @@ void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TInterm return; // fix array size, if it can be fixed and needs to be fixed (will allow variable indexing) - if (symbolNode->getType().isImplicitlySizedArray()) { - int newSize = getIoArrayImplicitSize(); + if (symbolNode->getType().isUnsizedArray()) { + int newSize = getIoArrayImplicitSize(symbolNode->getType().getQualifier().isPerPrimitive()); if (newSize > 0) symbolNode->getWritableType().changeOuterArraySize(newSize); } @@ -530,17 +584,27 @@ void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TInterm // Types without an array size will be given one. // Types already having a size that is wrong will get an error. // -void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly) +void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly, bool isPerPrimitive) { - int requiredSize = getIoArrayImplicitSize(); + int requiredSize = getIoArrayImplicitSize(isPerPrimitive); if (requiredSize == 0) return; const char* feature; if (language == EShLangGeometry) feature = TQualifier::getGeometryString(intermediate.getInputPrimitive()); - else if (language == EShLangTessControl) + else if (language == EShLangTessControl +#ifdef NV_EXTENSIONS + || language == EShLangFragment +#endif + ) + feature = "vertices"; +#ifdef NV_EXTENSIONS + else if (language == EShLangMeshNV) { + feature = isPerPrimitive ? "max_primitives" : "max_vertices"; + } +#endif else feature = "unknown"; @@ -553,25 +617,45 @@ void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnl checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList[i]->getWritableType(), ioArraySymbolResizeList[i]->getName()); } -int TParseContext::getIoArrayImplicitSize() const +int TParseContext::getIoArrayImplicitSize(bool isPerPrimitive) const { if (language == EShLangGeometry) return TQualifier::mapGeometryToSize(intermediate.getInputPrimitive()); else if (language == EShLangTessControl) return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; +#ifdef NV_EXTENSIONS + else if (language == EShLangFragment) + return 3; //Number of vertices for Fragment shader is always three. + else if (language == EShLangMeshNV) { + if (isPerPrimitive) { + return intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0; + } else { + return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; + } + } +#endif + else return 0; } void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredSize, const char* feature, TType& type, const TString& name) { - if (type.isImplicitlySizedArray()) + if (type.isUnsizedArray()) type.changeOuterArraySize(requiredSize); else if (type.getOuterArraySize() != requiredSize) { if (language == EShLangGeometry) error(loc, "inconsistent input primitive for array size of", feature, name.c_str()); else if (language == EShLangTessControl) error(loc, "inconsistent output number of vertices for array size of", feature, name.c_str()); +#ifdef NV_EXTENSIONS + else if (language == EShLangFragment) { + if (type.getOuterArraySize() > requiredSize) + error(loc, " cannot be greater than 3 for pervertexNV", feature, name.c_str()); + } + else if (language == EShLangMeshNV) + error(loc, "inconsistent output array size of", feature, name.c_str()); +#endif else assert(0); } @@ -599,6 +683,12 @@ TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* break; } + if (((left->getType().containsBasicType(EbtFloat16) || right->getType().containsBasicType(EbtFloat16)) && !float16Arithmetic()) || + ((left->getType().contains16BitInt() || right->getType().contains16BitInt()) && !int16Arithmetic()) || + ((left->getType().contains8BitInt() || right->getType().contains8BitInt()) && !int8Arithmetic())) { + allowed = false; + } + TIntermTyped* result = nullptr; if (allowed) result = intermediate.addBinaryMath(op, left, right, loc); @@ -614,7 +704,17 @@ TIntermTyped* TParseContext::handleUnaryMath(const TSourceLoc& loc, const char* { rValueErrorCheck(loc, str, childNode); - TIntermTyped* result = intermediate.addUnaryMath(op, childNode, loc); + bool allowed = true; + if ((childNode->getType().containsBasicType(EbtFloat16) && !float16Arithmetic()) || + (childNode->getType().contains16BitInt() && !int16Arithmetic()) || + (childNode->getType().contains8BitInt() && !int8Arithmetic())) { + allowed = false; + } + + TIntermTyped* result = nullptr; + + if (allowed) + result = intermediate.addUnaryMath(op, childNode, loc); if (result) return result; @@ -676,6 +776,13 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm TSwizzleSelectors selectors; parseSwizzleSelector(loc, field, base->getVectorSize(), selectors); + if (base->isVector() && selectors.size() != 1 && base->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, ".", "can't swizzle types containing float16"); + if (base->isVector() && selectors.size() != 1 && base->getType().contains16BitInt()) + requireInt16Arithmetic(loc, ".", "can't swizzle types containing (u)int16"); + if (base->isVector() && selectors.size() != 1 && base->getType().contains8BitInt()) + requireInt8Arithmetic(loc, ".", "can't swizzle types containing (u)int8"); + if (base->isScalar()) { if (selectors.size() == 1) return result; @@ -722,6 +829,8 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm TIntermTyped* index = intermediate.addConstantUnion(member, loc); result = intermediate.addIndex(EOpIndexDirectStruct, base, index, loc); result->setType(*(*fields)[member].type); + if ((*fields)[member].type->getQualifier().isIo()) + intermediate.addIoAccessed(field); } } else error(loc, "no such field in structure", field.c_str(), ""); @@ -732,6 +841,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm if (base->getQualifier().noContraction) result->getWritableType().getQualifier().noContraction = true; + // Propagate nonuniform + if (base->getQualifier().isNonUniform()) + result->getWritableType().getQualifier().nonUniform = true; + return result; } @@ -776,7 +889,7 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct if (prevDec->isPrototyped() && prototype) profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function"); if (prevDec->getType() != function.getType()) - error(loc, "overloaded functions must have the same return type", function.getType().getBasicTypeString().c_str(), ""); + error(loc, "overloaded functions must have the same return type", function.getName().c_str(), ""); for (int i = 0; i < prevDec->getParamCount(); ++i) { if ((*prevDec)[i].type->getQualifier().storage != function[i].type->getQualifier().storage) error(loc, "overloaded functions must have the same parameter storage qualifiers for argument", function[i].type->getStorageQualifierString(), "%d", i+1); @@ -950,7 +1063,14 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (builtIn && fnCandidate->getNumExtensions()) requireExtensions(loc, fnCandidate->getNumExtensions(), fnCandidate->getExtensions(), fnCandidate->getName().c_str()); - if (arguments) { + if (builtIn && fnCandidate->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, "built-in function", "float16 types can only be in uniform block or buffer storage"); + if (builtIn && fnCandidate->getType().contains16BitInt()) + requireInt16Arithmetic(loc, "built-in function", "(u)int16 types can only be in uniform block or buffer storage"); + if (builtIn && fnCandidate->getType().contains8BitInt()) + requireInt8Arithmetic(loc, "built-in function", "(u)int8 types can only be in uniform block or buffer storage"); + + if (arguments != nullptr) { // Make sure qualifications work for these arguments. TIntermAggregate* aggregate = arguments->getAsAggregate(); for (int i = 0; i < fnCandidate->getParamCount(); ++i) { @@ -968,13 +1088,29 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction const char* message = "argument cannot drop memory qualifier when passed to formal parameter"; if (argQualifier.volatil && ! formalQualifier.volatil) error(arguments->getLoc(), message, "volatile", ""); - if (argQualifier.coherent && ! formalQualifier.coherent) + if (argQualifier.coherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent)) error(arguments->getLoc(), message, "coherent", ""); + if (argQualifier.devicecoherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent)) + error(arguments->getLoc(), message, "devicecoherent", ""); + if (argQualifier.queuefamilycoherent && ! (formalQualifier.queuefamilycoherent || formalQualifier.devicecoherent || formalQualifier.coherent)) + error(arguments->getLoc(), message, "queuefamilycoherent", ""); + if (argQualifier.workgroupcoherent && ! (formalQualifier.workgroupcoherent || formalQualifier.queuefamilycoherent || formalQualifier.devicecoherent || formalQualifier.coherent)) + error(arguments->getLoc(), message, "workgroupcoherent", ""); + if (argQualifier.subgroupcoherent && ! (formalQualifier.subgroupcoherent || formalQualifier.workgroupcoherent || formalQualifier.queuefamilycoherent || formalQualifier.devicecoherent || formalQualifier.coherent)) + error(arguments->getLoc(), message, "subgroupcoherent", ""); if (argQualifier.readonly && ! formalQualifier.readonly) error(arguments->getLoc(), message, "readonly", ""); if (argQualifier.writeonly && ! formalQualifier.writeonly) error(arguments->getLoc(), message, "writeonly", ""); } + + if (builtIn && arg->getAsTyped()->getType().containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(arguments->getLoc(), "built-in function", "float16 types can only be in uniform block or buffer storage"); + if (builtIn && arg->getAsTyped()->getType().contains16BitInt()) + requireInt16Arithmetic(arguments->getLoc(), "built-in function", "(u)int16 types can only be in uniform block or buffer storage"); + if (builtIn && arg->getAsTyped()->getType().contains8BitInt()) + requireInt8Arithmetic(arguments->getLoc(), "built-in function", "(u)int8 types can only be in uniform block or buffer storage"); + // TODO 4.5 functionality: A shader will fail to compile // if the value passed to the memargument of an atomic memory function does not correspond to a buffer or // shared variable. It is acceptable to pass an element of an array or a single component of a vector to the @@ -988,7 +1124,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction if (builtIn && fnCandidate->getBuiltInOp() != EOpNull) { // A function call mapped to a built-in operation. - result = handleBuiltInFunctionCall(loc, *arguments, *fnCandidate); + result = handleBuiltInFunctionCall(loc, arguments, *fnCandidate); } else { // This is a function call not mapped to built-in operator. // It could still be a built-in function, but only if PureOperatorBuiltins == false. @@ -1036,20 +1172,24 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction return result; } -TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNode& arguments, +TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNode* arguments, const TFunction& function) { checkLocation(loc, function.getBuiltInOp()); TIntermTyped *result = intermediate.addBuiltInFunctionCall(loc, function.getBuiltInOp(), function.getParamCount() == 1, - &arguments, function.getType()); + arguments, function.getType()); if (obeyPrecisionQualifiers()) computeBuiltinPrecisions(*result, function); - if (result == nullptr) { - error(arguments.getLoc(), " wrong operand type", "Internal Error", - "built in unary operator function. Type: %s", - static_cast(&arguments)->getCompleteString().c_str()); + if (result == nullptr) { + if (arguments == nullptr) + error(loc, " wrong operand type", "Internal Error", + "built in unary operator function. Type: %s", ""); + else + error(arguments->getLoc(), " wrong operand type", "Internal Error", + "built in unary operator function. Type: %s", + static_cast(arguments)->getCompleteString().c_str()); } else if (result->getAsOperator()) builtInOpCheck(loc, function, *result->getAsOperator()); @@ -1155,6 +1295,8 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value) { + storage16BitAssignmentCheck(loc, value->getType(), "return"); + functionReturnsValue = true; if (currentFunctionType->getBasicType() == EbtVoid) { error(loc, "void function cannot return a value", "return", ""); @@ -1208,23 +1350,30 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction else { const TType& type = intermNode->getAsTyped()->getType(); if (type.isArray()) { - if (type.isRuntimeSizedArray()) { - // Create a unary op and let the back end handle it - return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); - } else if (type.isImplicitlySizedArray()) { + if (type.isUnsizedArray()) { if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) { // We could be between a layout declaration that gives a built-in io array implicit size and // a user redeclaration of that array, meaning we have to substitute its implicit size here // without actually redeclaring the array. (It is an error to use a member before the // redeclaration, but not an error to use the array name itself.) const TString& name = intermNode->getAsSymbolNode()->getName(); - if (name == "gl_in" || name == "gl_out") - length = getIoArrayImplicitSize(); + if (name == "gl_in" || name == "gl_out" +#ifdef NV_EXTENSIONS + || name == "gl_MeshVerticesNV" + || name == "gl_MeshPrimitivesNV" +#endif + ) + { + length = getIoArrayImplicitSize(type.getQualifier().isPerPrimitive()); + } } if (length == 0) { if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier"); - else + else if (isRuntimeLength(*intermNode->getAsTyped())) { + // Create a unary op and let the back end handle it + return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); + } else error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method"); } } else if (type.getOuterArrayNode()) { @@ -1354,6 +1503,161 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct return conversionTree; } +void TParseContext::memorySemanticsCheck(const TSourceLoc& loc, const TFunction& fnCandidate, const TIntermOperator& callNode) +{ + const TIntermSequence* argp = &callNode.getAsAggregate()->getSequence(); + + //const int gl_SemanticsRelaxed = 0x0; + const int gl_SemanticsAcquire = 0x2; + const int gl_SemanticsRelease = 0x4; + const int gl_SemanticsAcquireRelease = 0x8; + const int gl_SemanticsMakeAvailable = 0x2000; + const int gl_SemanticsMakeVisible = 0x4000; + + //const int gl_StorageSemanticsNone = 0x0; + const int gl_StorageSemanticsBuffer = 0x40; + const int gl_StorageSemanticsShared = 0x100; + const int gl_StorageSemanticsImage = 0x800; + const int gl_StorageSemanticsOutput = 0x1000; + + + unsigned int semantics = 0, storageClassSemantics = 0; + unsigned int semantics2 = 0, storageClassSemantics2 = 0; + + // Grab the semantics and storage class semantics from the operands, based on opcode + switch (callNode.getOp()) { + case EOpAtomicAdd: + case EOpAtomicMin: + case EOpAtomicMax: + case EOpAtomicAnd: + case EOpAtomicOr: + case EOpAtomicXor: + case EOpAtomicExchange: + case EOpAtomicStore: + storageClassSemantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + case EOpAtomicLoad: + storageClassSemantics = (*argp)[2]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + case EOpAtomicCompSwap: + storageClassSemantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst(); + storageClassSemantics2 = (*argp)[6]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics2 = (*argp)[7]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + + case EOpImageAtomicAdd: + case EOpImageAtomicMin: + case EOpImageAtomicMax: + case EOpImageAtomicAnd: + case EOpImageAtomicOr: + case EOpImageAtomicXor: + case EOpImageAtomicExchange: + case EOpImageAtomicStore: + storageClassSemantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + case EOpImageAtomicLoad: + storageClassSemantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[4]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + case EOpImageAtomicCompSwap: + storageClassSemantics = (*argp)[5]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[6]->getAsConstantUnion()->getConstArray()[0].getIConst(); + storageClassSemantics2 = (*argp)[7]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics2 = (*argp)[8]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + + case EOpBarrier: + storageClassSemantics = (*argp)[2]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[3]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + case EOpMemoryBarrier: + storageClassSemantics = (*argp)[1]->getAsConstantUnion()->getConstArray()[0].getIConst(); + semantics = (*argp)[2]->getAsConstantUnion()->getConstArray()[0].getIConst(); + break; + default: + break; + } + + if ((semantics & gl_SemanticsAcquire) && + (callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore)) { + error(loc, "gl_SemanticsAcquire must not be used with (image) atomic store", + fnCandidate.getName().c_str(), ""); + } + if ((semantics & gl_SemanticsRelease) && + (callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad)) { + error(loc, "gl_SemanticsRelease must not be used with (image) atomic load", + fnCandidate.getName().c_str(), ""); + } + if ((semantics & gl_SemanticsAcquireRelease) && + (callNode.getOp() == EOpAtomicStore || callNode.getOp() == EOpImageAtomicStore || + callNode.getOp() == EOpAtomicLoad || callNode.getOp() == EOpImageAtomicLoad)) { + error(loc, "gl_SemanticsAcquireRelease must not be used with (image) atomic load/store", + fnCandidate.getName().c_str(), ""); + } + if (((semantics | semantics2) & ~(gl_SemanticsAcquire | + gl_SemanticsRelease | + gl_SemanticsAcquireRelease | + gl_SemanticsMakeAvailable | + gl_SemanticsMakeVisible))) { + error(loc, "Invalid semantics value", fnCandidate.getName().c_str(), ""); + } + if (((storageClassSemantics | storageClassSemantics2) & ~(gl_StorageSemanticsBuffer | + gl_StorageSemanticsShared | + gl_StorageSemanticsImage | + gl_StorageSemanticsOutput))) { + error(loc, "Invalid storage class semantics value", fnCandidate.getName().c_str(), ""); + } + + if (callNode.getOp() == EOpMemoryBarrier) { + if (!IsPow2(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + error(loc, "Semantics must include exactly one of gl_SemanticsRelease, gl_SemanticsAcquire, or " + "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); + } + } else { + if (semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease)) { + if (!IsPow2(semantics & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + error(loc, "Semantics must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or " + "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); + } + } + if (semantics2 & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease)) { + if (!IsPow2(semantics2 & (gl_SemanticsAcquire | gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + error(loc, "semUnequal must not include multiple of gl_SemanticsRelease, gl_SemanticsAcquire, or " + "gl_SemanticsAcquireRelease", fnCandidate.getName().c_str(), ""); + } + } + } + if (callNode.getOp() == EOpMemoryBarrier) { + if (storageClassSemantics == 0) { + error(loc, "Storage class semantics must not be zero", fnCandidate.getName().c_str(), ""); + } + } + if (callNode.getOp() == EOpBarrier && semantics != 0 && storageClassSemantics == 0) { + error(loc, "Storage class semantics must not be zero", fnCandidate.getName().c_str(), ""); + } + if ((callNode.getOp() == EOpAtomicCompSwap || callNode.getOp() == EOpImageAtomicCompSwap) && + (semantics2 & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + error(loc, "semUnequal must not be gl_SemanticsRelease or gl_SemanticsAcquireRelease", + fnCandidate.getName().c_str(), ""); + } + if ((semantics & gl_SemanticsMakeAvailable) && + !(semantics & (gl_SemanticsRelease | gl_SemanticsAcquireRelease))) { + error(loc, "gl_SemanticsMakeAvailable requires gl_SemanticsRelease or gl_SemanticsAcquireRelease", + fnCandidate.getName().c_str(), ""); + } + if ((semantics & gl_SemanticsMakeVisible) && + !(semantics & (gl_SemanticsAcquire | gl_SemanticsAcquireRelease))) { + error(loc, "gl_SemanticsMakeVisible requires gl_SemanticsAcquire or gl_SemanticsAcquireRelease", + fnCandidate.getName().c_str(), ""); + } + +} + + // // Do additional checking of built-in function calls that is not caught // by normal semantic checks on argument type, extension tagging, etc. @@ -1378,6 +1682,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan arg0 = unaryArg; } + TString featureString; + const char* feature = nullptr; switch (callNode.getOp()) { case EOpTextureGather: case EOpTextureGatherOffset: @@ -1386,8 +1692,9 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan // Figure out which variants are allowed by what extensions, // and what arguments must be constant for which situations. - TString featureString = fnCandidate.getName() + "(...)"; - const char* feature = featureString.c_str(); + featureString = fnCandidate.getName(); + featureString += "(...)"; + feature = featureString.c_str(); profileRequires(loc, EEsProfile, 310, nullptr, feature); int compArg = -1; // track which argument, if any, is the constant component argument switch (callNode.getOp()) { @@ -1443,8 +1750,9 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan bias = fnCandidate.getParamCount() > 4; if (bias) { - TString biasFeatureString = fnCandidate.getName() + "with bias argument"; - const char* feature = biasFeatureString.c_str(); + featureString = fnCandidate.getName(); + featureString += "with bias argument"; + feature = featureString.c_str(); profileRequires(loc, ~EEsProfile, 450, nullptr, feature); requireExtensions(loc, 1, &E_GL_AMD_texture_gather_bias_lod, feature); } @@ -1466,8 +1774,9 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan bias = fnCandidate.getParamCount() > 5; if (bias) { - TString featureString = fnCandidate.getName() + "with bias argument"; - const char* feature = featureString.c_str(); + featureString = fnCandidate.getName(); + featureString += "with bias argument"; + feature = featureString.c_str(); profileRequires(loc, ~EEsProfile, 450, nullptr, feature); requireExtensions(loc, 1, &E_GL_AMD_texture_gather_bias_lod, feature); } @@ -1482,6 +1791,39 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan requireExtensions(loc, 1, &E_GL_ARB_sparse_texture2, fnCandidate.getName().c_str()); break; } + + case EOpSwizzleInvocations: + { + if (! (*argp)[1]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "offset", ""); + else { + unsigned offset[4] = {}; + offset[0] = (*argp)[1]->getAsConstantUnion()->getConstArray()[0].getUConst(); + offset[1] = (*argp)[1]->getAsConstantUnion()->getConstArray()[1].getUConst(); + offset[2] = (*argp)[1]->getAsConstantUnion()->getConstArray()[2].getUConst(); + offset[3] = (*argp)[1]->getAsConstantUnion()->getConstArray()[3].getUConst(); + if (offset[0] > 3 || offset[1] > 3 || offset[2] > 3 || offset[3] > 3) + error(loc, "components must be in the range [0, 3]", "offset", ""); + } + + break; + } + + case EOpSwizzleInvocationsMasked: + { + if (! (*argp)[1]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "mask", ""); + else { + unsigned mask[3] = {}; + mask[0] = (*argp)[1]->getAsConstantUnion()->getConstArray()[0].getUConst(); + mask[1] = (*argp)[1]->getAsConstantUnion()->getConstArray()[1].getUConst(); + mask[2] = (*argp)[1]->getAsConstantUnion()->getConstArray()[2].getUConst(); + if (mask[0] > 31 || mask[1] > 31 || mask[2] > 31) + error(loc, "components must be in the range [0, 31]", "mask", ""); + } + + break; + } #endif case EOpTextureOffset: @@ -1509,6 +1851,12 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan } if (arg > 0) { + +#ifdef AMD_EXTENSIONS + bool f16ShadowCompare = (*argp)[1]->getAsTyped()->getBasicType() == EbtFloat16 && arg0->getType().getSampler().shadow; + if (f16ShadowCompare) + ++arg; +#endif if (! (*argp)[arg]->getAsConstantUnion()) error(loc, "argument must be compile-time constant", "texel offset", ""); else { @@ -1524,6 +1872,17 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan break; } +#ifdef NV_EXTENSIONS + case EOpTraceNV: + if (!(*argp)[10]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "payload number", ""); + break; + case EOpExecuteCallableNV: + if (!(*argp)[1]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "callable data number", ""); + break; +#endif + case EOpTextureQuerySamples: case EOpImageQuerySamples: // GL_ARB_shader_texture_image_samples @@ -1538,6 +1897,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan case EOpImageAtomicXor: case EOpImageAtomicExchange: case EOpImageAtomicCompSwap: + case EOpImageAtomicLoad: + case EOpImageAtomicStore: { // Make sure the image types have the correct layout() format and correct argument types const TType& imageType = arg0->getType(); @@ -1551,10 +1912,15 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan error(loc, "only supported on image with format r32f", fnCandidate.getName().c_str(), ""); } + const size_t maxArgs = imageType.getSampler().isMultiSample() ? 5 : 4; + if (argp->size() > maxArgs) { + requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str()); + memorySemanticsCheck(loc, fnCandidate, callNode); + } + break; } -#ifdef NV_EXTENSIONS case EOpAtomicAdd: case EOpAtomicMin: case EOpAtomicMax: @@ -1563,17 +1929,30 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan case EOpAtomicXor: case EOpAtomicExchange: case EOpAtomicCompSwap: + case EOpAtomicLoad: + case EOpAtomicStore: { - if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) - requireExtensions(loc, 1, &E_GL_NV_shader_atomic_int64, fnCandidate.getName().c_str()); - + if (argp->size() > 3) { + requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str()); + memorySemanticsCheck(loc, fnCandidate, callNode); + } else if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64) { +#ifdef NV_EXTENSIONS + const char* const extensions[2] = { E_GL_NV_shader_atomic_int64, + E_GL_EXT_shader_atomic_int64 }; + requireExtensions(loc, 2, extensions, fnCandidate.getName().c_str()); +#else + requireExtensions(loc, 1, &E_GL_EXT_shader_atomic_int64, fnCandidate.getName().c_str()); +#endif + } break; } -#endif case EOpInterpolateAtCentroid: case EOpInterpolateAtSample: case EOpInterpolateAtOffset: +#ifdef AMD_EXTENSIONS + case EOpInterpolateAtVertex: +#endif // Make sure the first argument is an interpolant, or an array element of an interpolant if (arg0->getType().getQualifier().storage != EvqVaryingIn) { // It might still be an array element. @@ -1588,6 +1967,23 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan if (base == nullptr || base->getType().getQualifier().storage != EvqVaryingIn) error(loc, "first argument must be an interpolant, or interpolant-array element", fnCandidate.getName().c_str(), ""); } + +#ifdef AMD_EXTENSIONS + if (callNode.getOp() == EOpInterpolateAtVertex) { + if (!arg0->getType().getQualifier().isExplicitInterpolation()) + error(loc, "argument must be qualified as __explicitInterpAMD in", "interpolant", ""); + else { + if (! (*argp)[1]->getAsConstantUnion()) + error(loc, "argument must be compile-time constant", "vertex index", ""); + else { + unsigned vertexIdx = (*argp)[1]->getAsConstantUnion()->getConstArray()[0].getUConst(); + if (vertexIdx > 2) + error(loc, "must be in the range [0, 2]", "vertex index", ""); + } + } + } +#endif + break; case EOpEmitStreamVertex: @@ -1595,9 +1991,76 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan intermediate.setMultiStream(); break; + case EOpSubgroupClusteredAdd: + case EOpSubgroupClusteredMul: + case EOpSubgroupClusteredMin: + case EOpSubgroupClusteredMax: + case EOpSubgroupClusteredAnd: + case EOpSubgroupClusteredOr: + case EOpSubgroupClusteredXor: + // The as used in the subgroupClustered() operations must be: + // - An integral constant expression. + // - At least 1. + // - A power of 2. + if ((*argp)[1]->getAsConstantUnion() == nullptr) + error(loc, "argument must be compile-time constant", "cluster size", ""); + else { + int size = (*argp)[1]->getAsConstantUnion()->getConstArray()[0].getIConst(); + if (size < 1) + error(loc, "argument must be at least 1", "cluster size", ""); + else if (!IsPow2(size)) + error(loc, "argument must be a power of 2", "cluster size", ""); + } + break; + + case EOpSubgroupBroadcast: + // must be an integral constant expression. + if ((*argp)[1]->getAsConstantUnion() == nullptr) + error(loc, "argument must be compile-time constant", "id", ""); + break; + + case EOpBarrier: + case EOpMemoryBarrier: + if (argp->size() > 0) { + requireExtensions(loc, 1, &E_GL_KHR_memory_scope_semantics, fnCandidate.getName().c_str()); + memorySemanticsCheck(loc, fnCandidate, callNode); + } + break; + default: break; } + + // Texture operations on texture objects (aside from texelFetch on a + // textureBuffer) require EXT_samplerless_texture_functions. + switch (callNode.getOp()) { + case EOpTextureQuerySize: + case EOpTextureQueryLevels: + case EOpTextureQuerySamples: + case EOpTextureFetch: + case EOpTextureFetchOffset: + { + const TSampler& sampler = fnCandidate[0].type->getSampler(); + + const bool isTexture = sampler.isTexture() && !sampler.isCombined(); + const bool isBuffer = sampler.dim == EsdBuffer; + const bool isFetch = callNode.getOp() == EOpTextureFetch || callNode.getOp() == EOpTextureFetchOffset; + + if (isTexture && (!isBuffer || !isFetch)) + requireExtensions(loc, 1, &E_GL_EXT_samplerless_texture_functions, fnCandidate.getName().c_str()); + + break; + } + + default: + break; + } + + if (callNode.getOp() > EOpSubgroupGuardStart && callNode.getOp() < EOpSubgroupGuardStop) { + // these require SPIR-V 1.3 + if (spvVersion.spv > 0 && spvVersion.spv < EShTargetSpv_1_3) + error(loc, "requires SPIR-V 1.3", "subgroup op", ""); + } } extern bool PureOperatorBuiltins; @@ -2159,7 +2622,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructDMat4x2: case EOpConstructDMat4x3: case EOpConstructDMat4x4: -#ifdef AMD_EXTENSIONS case EOpConstructF16Mat2x2: case EOpConstructF16Mat2x3: case EOpConstructF16Mat2x4: @@ -2169,7 +2631,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructF16Mat4x2: case EOpConstructF16Mat4x3: case EOpConstructF16Mat4x4: -#endif constructingMatrix = true; break; default: @@ -2190,7 +2651,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T bool floatArgument = false; for (int arg = 0; arg < function.getParamCount(); ++arg) { if (function[arg].type->isArray()) { - if (! function[arg].type->isExplicitlySizedArray()) { + if (function[arg].type->isUnsizedArray()) { // Can't construct from an unsized array. error(loc, "array argument must be sized", "constructor", ""); return true; @@ -2218,6 +2679,59 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T specConstType = true; if (function[arg].type->isFloatingDomain()) floatArgument = true; + if (type.isStruct()) { + if (function[arg].type->containsBasicType(EbtFloat16)) { + requireFloat16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); + } + if (function[arg].type->containsBasicType(EbtUint16) || + function[arg].type->containsBasicType(EbtInt16)) { + requireInt16Arithmetic(loc, "constructor", "can't construct structure containing 16-bit type"); + } + if (function[arg].type->containsBasicType(EbtUint8) || + function[arg].type->containsBasicType(EbtInt8)) { + requireInt8Arithmetic(loc, "constructor", "can't construct structure containing 8-bit type"); + } + } + } + + switch (op) { + case EOpConstructFloat16: + case EOpConstructF16Vec2: + case EOpConstructF16Vec3: + case EOpConstructF16Vec4: + if (type.isArray()) + requireFloat16Arithmetic(loc, "constructor", "16-bit arrays not supported"); + if (type.isVector() && function.getParamCount() != 1) + requireFloat16Arithmetic(loc, "constructor", "16-bit vectors only take vector types"); + break; + case EOpConstructUint16: + case EOpConstructU16Vec2: + case EOpConstructU16Vec3: + case EOpConstructU16Vec4: + case EOpConstructInt16: + case EOpConstructI16Vec2: + case EOpConstructI16Vec3: + case EOpConstructI16Vec4: + if (type.isArray()) + requireInt16Arithmetic(loc, "constructor", "16-bit arrays not supported"); + if (type.isVector() && function.getParamCount() != 1) + requireInt16Arithmetic(loc, "constructor", "16-bit vectors only take vector types"); + break; + case EOpConstructUint8: + case EOpConstructU8Vec2: + case EOpConstructU8Vec3: + case EOpConstructU8Vec4: + case EOpConstructInt8: + case EOpConstructI8Vec2: + case EOpConstructI8Vec3: + case EOpConstructI8Vec4: + if (type.isArray()) + requireInt8Arithmetic(loc, "constructor", "8-bit arrays not supported"); + if (type.isVector() && function.getParamCount() != 1) + requireInt8Arithmetic(loc, "constructor", "8-bit vectors only take vector types"); + break; + default: + break; } // inherit constness from children @@ -2226,18 +2740,30 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T // Finish pinning down spec-const semantics if (specConstType) { switch (op) { + case EOpConstructInt8: + case EOpConstructUint8: + case EOpConstructInt16: + case EOpConstructUint16: case EOpConstructInt: case EOpConstructUint: case EOpConstructInt64: case EOpConstructUint64: -#ifdef AMD_EXTENSIONS - case EOpConstructInt16: - case EOpConstructUint16: -#endif case EOpConstructBool: case EOpConstructBVec2: case EOpConstructBVec3: case EOpConstructBVec4: + case EOpConstructI8Vec2: + case EOpConstructI8Vec3: + case EOpConstructI8Vec4: + case EOpConstructU8Vec2: + case EOpConstructU8Vec3: + case EOpConstructU8Vec4: + case EOpConstructI16Vec2: + case EOpConstructI16Vec3: + case EOpConstructI16Vec4: + case EOpConstructU16Vec2: + case EOpConstructU16Vec3: + case EOpConstructU16Vec4: case EOpConstructIVec2: case EOpConstructIVec3: case EOpConstructIVec4: @@ -2250,14 +2776,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T case EOpConstructU64Vec2: case EOpConstructU64Vec3: case EOpConstructU64Vec4: -#ifdef AMD_EXTENSIONS - case EOpConstructI16Vec2: - case EOpConstructI16Vec3: - case EOpConstructI16Vec4: - case EOpConstructU16Vec2: - case EOpConstructU16Vec3: - case EOpConstructU16Vec4: -#endif // This was the list of valid ones, if they aren't converting from float // and aren't making an array. makeSpecConst = ! floatArgument && ! type.isArray(); @@ -2284,7 +2802,7 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T return true; } - if (type.isImplicitlySizedArray()) { + if (type.isUnsizedArray()) { // auto adapt the constructor type to the number of arguments type.changeOuterArraySize(function.getParamCount()); } else if (type.getOuterArraySize() != function.getParamCount()) { @@ -2296,20 +2814,21 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T // Types have to match, but we're still making the type. // Finish making the type, and the comparison is done later // when checking for conversion. - TArraySizes& arraySizes = type.getArraySizes(); + TArraySizes& arraySizes = *type.getArraySizes(); // At least the dimensionalities have to match. - if (! function[0].type->isArray() || arraySizes.getNumDims() != function[0].type->getArraySizes().getNumDims() + 1) { + if (! function[0].type->isArray() || + arraySizes.getNumDims() != function[0].type->getArraySizes()->getNumDims() + 1) { error(loc, "array constructor argument not correct type to construct array element", "constructor", ""); return true; } - if (arraySizes.isInnerImplicit()) { + if (arraySizes.isInnerUnsized()) { // "Arrays of arrays ..., and the size for any dimension is optional" // That means we need to adopt (from the first argument) the other array sizes into the type. for (int d = 1; d < arraySizes.getNumDims(); ++d) { if (arraySizes.getDimSize(d) == UnsizedArraySize) { - arraySizes.setDimSize(d, function[0].type->getArraySizes().getDimSize(d - 1)); + arraySizes.setDimSize(d, function[0].type->getArraySizes()->getDimSize(d - 1)); } } } @@ -2412,18 +2931,12 @@ bool TParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const // second argument // * the constructor's second argument must be a scalar of type // *sampler* or *samplerShadow* - // * the presence or absence of depth comparison (Shadow) must match - // between the constructed sampler type and the type of the second argument if ( function[1].type->getBasicType() != EbtSampler || ! function[1].type->getSampler().isPureSampler() || function[1].type->isArray()) { error(loc, "sampler-constructor second argument must be a scalar type 'sampler'", token, ""); return true; } - if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) { - error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", token, ""); - return true; - } return false; } @@ -2491,6 +3004,20 @@ void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, co else if (type.getBasicType() == EbtAtomicUint && type.getQualifier().storage != EvqUniform) error(loc, "atomic_uints can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str()); } +#ifdef NV_EXTENSIONS +void TParseContext::accStructNVCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) +{ + if (type.getQualifier().storage == EvqUniform) + return; + + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtAccStructNV)) + error(loc, "non-uniform struct contains an accelerationStructureNV:", type.getBasicTypeString().c_str(), identifier.c_str()); + else if (type.getBasicType() == EbtAccStructNV && type.getQualifier().storage != EvqUniform) + error(loc, "accelerationStructureNV can only be used in uniform variables or function parameters:", + type.getBasicTypeString().c_str(), identifier.c_str()); + +} +#endif void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& type, const TString& identifier) { @@ -2510,17 +3037,33 @@ void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& t } } +// +// Qualifier checks knowing the qualifier and that it is a member of a struct/block. +// +void TParseContext::memberQualifierCheck(glslang::TPublicType& publicType) +{ + globalQualifierFixCheck(publicType.loc, publicType.qualifier); + checkNoShaderLayouts(publicType.loc, publicType.shaderQualifiers); + if (publicType.qualifier.isNonUniform()) { + error(publicType.loc, "not allowed on block or structure members", "nonuniformEXT", ""); + publicType.qualifier.nonUniform = false; + } +} + // // Check/fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level. // void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& qualifier) { + bool nonuniformOkay = false; + // move from parameter/unknown qualifiers to pipeline in/out qualifiers switch (qualifier.storage) { case EvqIn: profileRequires(loc, ENoProfile, 130, nullptr, "in for stage inputs"); profileRequires(loc, EEsProfile, 300, nullptr, "in for stage inputs"); qualifier.storage = EvqVaryingIn; + nonuniformOkay = true; break; case EvqOut: profileRequires(loc, ENoProfile, 130, nullptr, "out for stage outputs"); @@ -2531,10 +3074,17 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q qualifier.storage = EvqVaryingIn; error(loc, "cannot use 'inout' at global scope", "", ""); break; + case EvqGlobal: + case EvqTemporary: + nonuniformOkay = true; + break; default: break; } + if (!nonuniformOkay && qualifier.nonUniform) + error(loc, "for non-parameter, can only apply to 'in' or no storage qualifier", "nonuniformEXT", ""); + invariantCheck(loc, qualifier); } @@ -2546,8 +3096,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (! symbolTable.atGlobalLevel()) return; - if (qualifier.isMemory() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer) + if (qualifier.isMemoryQualifierImageAndSSBOOnly() && ! publicType.isImage() && publicType.qualifier.storage != EvqBuffer) { error(loc, "memory qualifiers cannot be used on this type", "", ""); + } else if (qualifier.isMemory() && (publicType.basicType != EbtSampler) && !publicType.qualifier.isUniformOrBuffer()) { + error(loc, "memory qualifiers cannot be used on this type", "", ""); + } if (qualifier.storage == EvqBuffer && publicType.basicType != EbtBlock) error(loc, "buffers can be declared only as blocks", "buffer", ""); @@ -2560,31 +3113,29 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali // now, knowing it is a shader in/out, do all the in/out semantic checks - if (publicType.basicType == EbtBool) { + if (publicType.basicType == EbtBool && !parsingBuiltins) { error(loc, "cannot be bool", GetStorageQualifierString(qualifier.storage), ""); return; } - if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || -#ifdef AMD_EXTENSIONS - publicType.basicType == EbtInt16 || publicType.basicType == EbtUint16 || -#endif - publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 || - publicType.basicType == EbtDouble) + if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble) profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output"); + if (!qualifier.flat #ifdef AMD_EXTENSIONS - if (! qualifier.flat && ! qualifier.explicitInterp) { -#else - if (!qualifier.flat) { + && !qualifier.explicitInterp #endif - if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || -#ifdef AMD_EXTENSIONS - publicType.basicType == EbtInt16 || publicType.basicType == EbtUint16 || +#ifdef NV_EXTENSIONS + && !qualifier.pervertexNV #endif - publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64 || + ) { + if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble || - (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt) || + (publicType.userDef && (publicType.userDef->containsBasicType(EbtInt8) || + publicType.userDef->containsBasicType(EbtUint8) || + publicType.userDef->containsBasicType(EbtInt16) || + publicType.userDef->containsBasicType(EbtUint16) || + publicType.userDef->containsBasicType(EbtInt) || publicType.userDef->containsBasicType(EbtUint) || publicType.userDef->containsBasicType(EbtInt64) || publicType.userDef->containsBasicType(EbtUint64) || @@ -2599,6 +3150,11 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali if (qualifier.patch && qualifier.isInterpolation()) error(loc, "cannot use interpolation qualifiers with patch", "patch", ""); +#ifdef NV_EXTENSIONS + if (qualifier.perTaskNV && publicType.basicType != EbtBlock) + error(loc, "taskNV variables can be declared only as blocks", "taskNV", ""); +#endif + if (qualifier.storage == EvqVaryingIn) { switch (language) { case EShLangVertex: @@ -2686,8 +3242,8 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali error(loc, "can't use auxiliary qualifier on a fragment output", "centroid/sample/patch", ""); if (qualifier.isInterpolation()) error(loc, "can't use interpolation qualifier on a fragment output", "flat/smooth/noperspective", ""); - if (publicType.basicType == EbtDouble) - error(loc, "cannot contain a double", GetStorageQualifierString(qualifier.storage), ""); + if (publicType.basicType == EbtDouble || publicType.basicType == EbtInt64 || publicType.basicType == EbtUint64) + error(loc, "cannot contain a double, int64, or uint64", GetStorageQualifierString(qualifier.storage), ""); break; case EShLangCompute: @@ -2765,6 +3321,13 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons if (dst.precision == EpqNone || (force && src.precision != EpqNone)) dst.precision = src.precision; + if (!force && ((src.coherent && (dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || + (src.devicecoherent && (dst.coherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || + (src.queuefamilycoherent && (dst.coherent || dst.devicecoherent || dst.workgroupcoherent || dst.subgroupcoherent)) || + (src.workgroupcoherent && (dst.coherent || dst.devicecoherent || dst.queuefamilycoherent || dst.subgroupcoherent)) || + (src.subgroupcoherent && (dst.coherent || dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent)))) { + error(loc, "only one coherent/devicecoherent/queuefamilycoherent/workgroupcoherent/subgroupcoherent qualifier allowed", GetPrecisionQualifierString(src.precision), ""); + } // Layout qualifiers mergeObjectLayoutQualifiers(dst, src, false); @@ -2779,15 +3342,26 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons MERGE_SINGLETON(nopersp); #ifdef AMD_EXTENSIONS MERGE_SINGLETON(explicitInterp); +#endif +#ifdef NV_EXTENSIONS + MERGE_SINGLETON(perPrimitiveNV); + MERGE_SINGLETON(perViewNV); + MERGE_SINGLETON(perTaskNV); #endif MERGE_SINGLETON(patch); MERGE_SINGLETON(sample); MERGE_SINGLETON(coherent); + MERGE_SINGLETON(devicecoherent); + MERGE_SINGLETON(queuefamilycoherent); + MERGE_SINGLETON(workgroupcoherent); + MERGE_SINGLETON(subgroupcoherent); + MERGE_SINGLETON(nonprivate); MERGE_SINGLETON(volatil); MERGE_SINGLETON(restrict); MERGE_SINGLETON(readonly); MERGE_SINGLETON(writeonly); MERGE_SINGLETON(specConstant); + MERGE_SINGLETON(nonUniform); if (repeated) error(loc, "replicated qualifiers", "", ""); @@ -2878,6 +3452,13 @@ void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier { if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque()) error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), ""); + + if (!parsingBuiltins && type.containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, type.getBasicTypeString().c_str(), "float16 types can only be in uniform block or buffer storage"); + if (!parsingBuiltins && type.contains16BitInt()) + requireInt16Arithmetic(loc, type.getBasicTypeString().c_str(), "(u)int16 types can only be in uniform block or buffer storage"); + if (!parsingBuiltins && type.contains8BitInt()) + requireInt8Arithmetic(loc, type.getBasicTypeString().c_str(), "(u)int8 types can only be in uniform block or buffer storage"); } bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType basicType) @@ -2988,7 +3569,7 @@ bool TParseContext::arrayError(const TSourceLoc& loc, const TType& type) // void TParseContext::arraySizeRequiredCheck(const TSourceLoc& loc, const TArraySizes& arraySizes) { - if (arraySizes.isImplicit()) + if (arraySizes.hasUnsized()) error(loc, "array size required", "", ""); } @@ -3002,7 +3583,8 @@ void TParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& typ } } -void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qualifier, TArraySizes* arraySizes, bool initializer, bool lastMember) +void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qualifier, TArraySizes* arraySizes, + const TIntermTyped* initializer, bool lastMember) { assert(arraySizes); @@ -3010,14 +3592,18 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua if (parsingBuiltins) return; - // always allow an initializer to set any unknown array sizes - if (initializer) + // initializer must be a sized array, in which case + // allow the initializer to set any unknown array sizes + if (initializer != nullptr) { + if (initializer->getType().isUnsizedArray()) + error(loc, "array initializer must be sized", "[]", ""); return; + } // No environment allows any non-outer-dimension to be implicitly sized - if (arraySizes->isInnerImplicit()) { + if (arraySizes->isInnerUnsized()) { error(loc, "only outermost dimension of an array of arrays can be implicitly sized", "[]", ""); - arraySizes->clearInnerImplicit(); + arraySizes->clearInnerUnsized(); } if (arraySizes->isInnerSpecialization()) @@ -3056,6 +3642,14 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) return; break; +#ifdef NV_EXTENSIONS + case EShLangMeshNV: + if (qualifier.storage == EvqVaryingOut) + if ((profile == EEsProfile && version >= 320) || + extensionTurnedOn(E_GL_NV_mesh_shader)) + return; + break; +#endif default: break; } @@ -3063,8 +3657,11 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua arraySizeRequiredCheck(loc, *arraySizes); } -void TParseContext::arrayOfArrayVersionCheck(const TSourceLoc& loc) +void TParseContext::arrayOfArrayVersionCheck(const TSourceLoc& loc, const TArraySizes* sizes) { + if (sizes == nullptr || sizes->getNumDims() == 1) + return; + const char* feature = "arrays of arrays"; requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); @@ -3072,36 +3669,6 @@ void TParseContext::arrayOfArrayVersionCheck(const TSourceLoc& loc) profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, nullptr, feature); } -void TParseContext::arrayDimCheck(const TSourceLoc& loc, const TArraySizes* sizes1, const TArraySizes* sizes2) -{ - if ((sizes1 && sizes2) || - (sizes1 && sizes1->getNumDims() > 1) || - (sizes2 && sizes2->getNumDims() > 1)) - arrayOfArrayVersionCheck(loc); -} - -void TParseContext::arrayDimCheck(const TSourceLoc& loc, const TType* type, const TArraySizes* sizes2) -{ - // skip checking for multiple dimensions on the type; it was caught earlier - if ((type && type->isArray() && sizes2) || - (sizes2 && sizes2->getNumDims() > 1)) - arrayOfArrayVersionCheck(loc); -} - -// Merge array dimensions listed in 'sizes' onto the type's array dimensions. -// -// From the spec: "vec4[2] a[3]; // size-3 array of size-2 array of vec4" -// -// That means, the 'sizes' go in front of the 'type' as outermost sizes. -// 'type' is the type part of the declaration (to the left) -// 'sizes' is the arrayness tagged on the identifier (to the right) -// -void TParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes) -{ - if (sizes) - type.addArrayOuterSizes(*sizes); -} - // // Do all the semantic checking for declaring or redeclaring an array, with and // without a size, and make the right changes to the symbol table. @@ -3130,7 +3697,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie if (! symbolTable.atBuiltInLevel()) { if (isIoResizeArray(type)) { ioArraySymbolResizeList.push_back(symbol); - checkIoArraysConsistency(loc, true); + checkIoArraysConsistency(loc, true, type.getQualifier().isPerPrimitive()); } else fixIoArraySize(loc, symbol->getWritableType()); } @@ -3171,7 +3738,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie return; } - if (existingType.isExplicitlySizedArray()) { + if (existingType.isSizedArray()) { // be more leniant for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size if (! (isIoResizeArray(type) && existingType.getOuterArraySize() == type.getOuterArraySize())) error(loc, "redeclaration of array with size", identifier.c_str(), ""); @@ -3183,69 +3750,64 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie existingType.updateArraySizes(type); if (isIoResizeArray(type)) - checkIoArraysConsistency(loc); + checkIoArraysConsistency(loc, false, type.getQualifier().isPerPrimitive()); } -void TParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode *node, int index) +// Policy and error check for needing a runtime sized array. +void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermTyped& base) { - // maybe there is nothing to do... - TIntermTyped* typedNode = node->getAsTyped(); - if (typedNode->getType().getImplicitArraySize() > index) + // runtime length implies runtime sizeable, so no problem + if (isRuntimeLength(base)) return; - // something to do... - - // Figure out what symbol to lookup, as we will use its type to edit for the size change, - // as that type will be shared through shallow copies for future references. - TSymbol* symbol = nullptr; - int blockIndex = -1; - const TString* lookupName = nullptr; - if (node->getAsSymbolNode()) - lookupName = &node->getAsSymbolNode()->getName(); - else if (node->getAsBinaryNode()) { - const TIntermBinary* deref = node->getAsBinaryNode(); - // This has to be the result of a block dereference, unless it's bad shader code - // If it's a uniform block, then an error will be issued elsewhere, but - // return early now to avoid crashing later in this function. - if (deref->getLeft()->getBasicType() != EbtBlock || - deref->getLeft()->getType().getQualifier().storage == EvqUniform || - deref->getRight()->getAsConstantUnion() == nullptr) - return; - - const TIntermTyped* left = deref->getLeft(); - const TIntermTyped* right = deref->getRight(); - - if (left->getAsBinaryNode()) { - left = left->getAsBinaryNode()->getLeft(); // Block array access - assert(left->isArray()); - } - - if (! left->getAsSymbolNode()) - return; - - blockIndex = right->getAsConstantUnion()->getConstArray()[0].getIConst(); - - lookupName = &left->getAsSymbolNode()->getName(); - if (IsAnonymous(*lookupName)) - lookupName = &(*left->getType().getStruct())[blockIndex].type->getFieldName(); - } - - // Lookup the symbol, should only fail if shader code is incorrect - symbol = symbolTable.find(*lookupName); - if (symbol == nullptr) - return; - - if (symbol->getAsFunction()) { - error(loc, "array variable name expected", symbol->getName().c_str(), ""); - return; - } - - if (symbol->getType().isStruct() && blockIndex != -1) - (*symbol->getWritableType().getStruct())[blockIndex].type->setImplicitArraySize(index + 1); + // check for additional things allowed by GL_EXT_nonuniform_qualifier + if (base.getBasicType() == EbtSampler || + (base.getBasicType() == EbtBlock && base.getType().getQualifier().isUniformOrBuffer())) + requireExtensions(loc, 1, &E_GL_EXT_nonuniform_qualifier, "variable index"); else - symbol->getWritableType().setImplicitArraySize(index + 1); + error(loc, "", "[", "array must be redeclared with a size before being indexed with a variable"); } +// Policy decision for whether a run-time .length() is allowed. +bool TParseContext::isRuntimeLength(const TIntermTyped& base) const +{ + if (base.getType().getQualifier().storage == EvqBuffer) { + // in a buffer block + const TIntermBinary* binary = base.getAsBinaryNode(); + if (binary != nullptr && binary->getOp() == EOpIndexDirectStruct) { + // is it the last member? + const int index = binary->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); + const int memberCount = (int)binary->getLeft()->getType().getStruct()->size(); + if (index == memberCount - 1) + return true; + } + } + + return false; +} + +#ifdef NV_EXTENSIONS +// Fix mesh view output array dimension +void TParseContext::resizeMeshViewDimension(const TSourceLoc& loc, TType& type) +{ + // see if member is a per-view attribute + if (type.getQualifier().isPerView()) { + // since we don't have the maxMeshViewCountNV set during parsing builtins, we hardcode the value + int maxViewCount = parsingBuiltins ? 4 : resources.maxMeshViewCountNV; + + if (! type.isArray()) { + error(loc, "requires an view array dimension", "perviewNV", ""); + } + else if (!type.isUnsizedArray() && type.getOuterArraySize() != maxViewCount) { + error(loc, "mesh view output array size must be gl_MaxMeshViewCountNV or implicitly sized", "[]", ""); + } + else if (type.isUnsizedArray()) { + type.changeOuterArraySize(maxViewCount); + } + } +} +#endif + // Returns true if the first argument to the #line directive is the line number for the next line. // // Desktop, pre-version 3.30: "After processing this directive @@ -3320,6 +3882,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS identifier == "gl_BackSecondaryColor" || identifier == "gl_SecondaryColor" || (identifier == "gl_Color" && language == EShLangFragment) || + (identifier == "gl_FragStencilRefARB" && (nonEsRedecls && version >= 140) + && language == EShLangFragment) || #ifdef NV_EXTENSIONS identifier == "gl_SampleMask" || identifier == "gl_Layer" || @@ -3402,6 +3966,12 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS error(loc, "all redeclarations must use the same depth layout on", "redeclaration", symbol->getName().c_str()); } } + else if (identifier == "gl_FragStencilRefARB") { + if (qualifier.hasLayout()) + error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str()); + if (qualifier.storage != EvqVaryingOut) + error(loc, "cannot change output storage qualification of", "redeclaration", symbol->getName().c_str()); + } #ifdef NV_EXTENSIONS else if (identifier == "gl_SampleMask") { if (!publicType.layoutOverrideCoverage) { @@ -3429,13 +3999,19 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS // Either redeclare the requested block, or give an error message why it can't be done. // // TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size -void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes) +void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, + const TString* instanceName, TArraySizes* arraySizes) { const char* feature = "built-in block redeclaration"; profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); - if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") { + if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment" +#ifdef NV_EXTENSIONS + && blockName != "gl_MeshPerVertexNV" && blockName != "gl_MeshPerPrimitiveNV" +#endif + ) + { error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str()); return; } @@ -3478,17 +4054,25 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT return; } + // Fix XFB stuff up, it applies to the order of the redeclaration, not + // the order of the original members. + if (currentBlockQualifier.storage == EvqVaryingOut && globalOutputDefaults.hasXfbBuffer()) { + if (!currentBlockQualifier.hasXfbBuffer()) + currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; + fixXfbOffsets(currentBlockQualifier, newTypeList); + } + // Edit and error check the container against the redeclaration // - remove unused members // - ensure remaining qualifiers/types match + TType& type = block->getWritableType(); #ifdef NV_EXTENSIONS // if gl_PerVertex is redeclared for the purpose of passing through "gl_Position" - // for passthrough purpose, the redclared block should have the same qualifers as + // for passthrough purpose, the redeclared block should have the same qualifers as // the current one - if (currentBlockQualifier.layoutPassthrough) - { + if (currentBlockQualifier.layoutPassthrough) { type.getQualifier().layoutPassthrough = currentBlockQualifier.layoutPassthrough; type.getQualifier().storage = currentBlockQualifier.storage; type.getQualifier().layoutStream = currentBlockQualifier.layoutStream; @@ -3523,16 +4107,40 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT error(memberLoc, "cannot redeclare block member with a different type", member->type->getFieldName().c_str(), ""); if (oldType.isArray() != newType.isArray()) error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), ""); - else if (! oldType.sameArrayness(newType) && oldType.isExplicitlySizedArray()) + else if (! oldType.getQualifier().isPerView() && ! oldType.sameArrayness(newType) && oldType.isSizedArray()) error(memberLoc, "cannot change array size of redeclared block member", member->type->getFieldName().c_str(), ""); - else if (newType.isArray()) + else if (! oldType.getQualifier().isPerView() && newType.isArray()) arrayLimitCheck(loc, member->type->getFieldName(), newType.getOuterArraySize()); +#ifdef NV_EXTENSIONS + if (oldType.getQualifier().isPerView() && ! newType.getQualifier().isPerView()) + error(memberLoc, "missing perviewNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! oldType.getQualifier().isPerView() && newType.getQualifier().isPerView()) + error(memberLoc, "cannot add perviewNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + else if (newType.getQualifier().isPerView()) { + if (oldType.getArraySizes()->getNumDims() != newType.getArraySizes()->getNumDims()) + error(memberLoc, "cannot change arrayness of redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! newType.isUnsizedArray() && newType.getOuterArraySize() != resources.maxMeshViewCountNV) + error(loc, "mesh view output array size must be gl_MaxMeshViewCountNV or implicitly sized", "[]", ""); + else if (newType.getArraySizes()->getNumDims() == 2) { + int innerDimSize = newType.getArraySizes()->getDimSize(1); + arrayLimitCheck(memberLoc, member->type->getFieldName(), innerDimSize); + oldType.getArraySizes()->setDimSize(1, innerDimSize); + } + } + if (oldType.getQualifier().isPerPrimitive() && ! newType.getQualifier().isPerPrimitive()) + error(memberLoc, "missing perprimitiveNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); + else if (! oldType.getQualifier().isPerPrimitive() && newType.getQualifier().isPerPrimitive()) + error(memberLoc, "cannot add perprimitiveNV qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); +#endif if (newType.getQualifier().isMemory()) error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); - if (newType.getQualifier().hasLayout()) - error(memberLoc, "cannot add layout to redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().hasNonXfbLayout()) + error(memberLoc, "cannot add non-XFB layout to redeclared block member", member->type->getFieldName().c_str(), ""); if (newType.getQualifier().patch) error(memberLoc, "cannot add patch to redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().hasXfbBuffer() && + newType.getQualifier().layoutXfbBuffer != currentBlockQualifier.layoutXfbBuffer) + error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); oldType.getQualifier().centroid = newType.getQualifier().centroid; oldType.getQualifier().sample = newType.getQualifier().sample; oldType.getQualifier().invariant = newType.getQualifier().invariant; @@ -3540,10 +4148,21 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT oldType.getQualifier().smooth = newType.getQualifier().smooth; oldType.getQualifier().flat = newType.getQualifier().flat; oldType.getQualifier().nopersp = newType.getQualifier().nopersp; - - if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray()) + oldType.getQualifier().layoutXfbOffset = newType.getQualifier().layoutXfbOffset; + oldType.getQualifier().layoutXfbBuffer = newType.getQualifier().layoutXfbBuffer; + oldType.getQualifier().layoutXfbStride = newType.getQualifier().layoutXfbStride; + if (oldType.getQualifier().layoutXfbOffset != TQualifier::layoutXfbBufferEnd) { + // if any member as an xfb_offset, then the block's xfb_buffer inherents current xfb_buffer, + // and for xfb processing, the member needs it as well, along with xfb_stride + type.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer; + oldType.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer; + } + if (oldType.isUnsizedArray() && newType.isSizedArray()) oldType.changeOuterArraySize(newType.getOuterArraySize()); + // check and process the member's type, which will include managing xfb information + layoutTypeCheck(loc, oldType); + // go to next member ++member; } else { @@ -3561,15 +4180,24 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT if (numOriginalMembersFound < newTypeList.size()) error(loc, "block redeclaration has extra members", blockName.c_str(), ""); - if (type.isArray() != (arraySizes != nullptr)) + if (type.isArray() != (arraySizes != nullptr) || + (type.isArray() && arraySizes != nullptr && type.getArraySizes()->getNumDims() != arraySizes->getNumDims())) error(loc, "cannot change arrayness of redeclared block", blockName.c_str(), ""); else if (type.isArray()) { - if (type.isExplicitlySizedArray() && arraySizes->getOuterSize() == UnsizedArraySize) - error(loc, "block already declared with size, can't redeclare as implicitly-sized", blockName.c_str(), ""); - else if (type.isExplicitlySizedArray() && type.getArraySizes() != *arraySizes) - error(loc, "cannot change array size of redeclared block", blockName.c_str(), ""); - else if (type.isImplicitlySizedArray() && arraySizes->getOuterSize() != UnsizedArraySize) + // At this point, we know both are arrays and both have the same number of dimensions. + + // It is okay for a built-in block redeclaration to be unsized, and keep the size of the + // original block declaration. + if (!arraySizes->isSized() && type.isSizedArray()) + arraySizes->changeOuterSize(type.getOuterArraySize()); + + // And, okay to be giving a size to the array, by the redeclaration + if (!type.isSizedArray() && arraySizes->isSized()) type.changeOuterArraySize(arraySizes->getOuterSize()); + + // Now, they must match in all dimensions. + if (type.isSizedArray() && *type.getArraySizes() != *arraySizes) + error(loc, "cannot change array size of redeclared block", blockName.c_str(), ""); } symbolTable.insert(*block); @@ -3580,7 +4208,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT // Tracking for implicit sizing of array if (isIoResizeArray(block->getType())) { ioArraySymbolResizeList.push_back(block); - checkIoArraysConsistency(loc, true); + checkIoArraysConsistency(loc, true, block->getType().getQualifier().isPerPrimitive()); } else if (block->getType().isArray()) fixIoArraySize(loc, block->getWritableType()); @@ -3588,7 +4216,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT trackLinkage(*block); } -void TParseContext::paramCheckFix(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type) +void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type) { switch (qualifier) { case EvqConst: @@ -3616,6 +4244,11 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali if (qualifier.isMemory()) { type.getQualifier().volatil = qualifier.volatil; type.getQualifier().coherent = qualifier.coherent; + type.getQualifier().devicecoherent = qualifier.devicecoherent ; + type.getQualifier().queuefamilycoherent = qualifier.queuefamilycoherent; + type.getQualifier().workgroupcoherent = qualifier.workgroupcoherent; + type.getQualifier().subgroupcoherent = qualifier.subgroupcoherent; + type.getQualifier().nonprivate = qualifier.nonprivate; type.getQualifier().readonly = qualifier.readonly; type.getQualifier().writeonly = qualifier.writeonly; type.getQualifier().restrict = qualifier.restrict; @@ -3634,8 +4267,10 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali else warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); } + if (qualifier.isNonUniform()) + type.getQualifier().nonUniform = qualifier.nonUniform; - paramCheckFix(loc, qualifier.storage, type); + paramCheckFixStorage(loc, qualifier.storage, type); } void TParseContext::nestedBlockCheck(const TSourceLoc& loc) @@ -3667,6 +4302,39 @@ void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const error(loc, "can't use with samplers or structs containing samplers", op, ""); } +void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TType& type, const char* op) +{ + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtFloat16)) + requireFloat16Arithmetic(loc, op, "can't use with structs containing float16"); + + if (type.isArray() && type.getBasicType() == EbtFloat16) + requireFloat16Arithmetic(loc, op, "can't use with arrays containing float16"); + + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtInt16)) + requireInt16Arithmetic(loc, op, "can't use with structs containing int16"); + + if (type.isArray() && type.getBasicType() == EbtInt16) + requireInt16Arithmetic(loc, op, "can't use with arrays containing int16"); + + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtUint16)) + requireInt16Arithmetic(loc, op, "can't use with structs containing uint16"); + + if (type.isArray() && type.getBasicType() == EbtUint16) + requireInt16Arithmetic(loc, op, "can't use with arrays containing uint16"); + + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtInt8)) + requireInt8Arithmetic(loc, op, "can't use with structs containing int8"); + + if (type.isArray() && type.getBasicType() == EbtInt8) + requireInt8Arithmetic(loc, op, "can't use with arrays containing int8"); + + if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtUint8)) + requireInt8Arithmetic(loc, op, "can't use with structs containing uint8"); + + if (type.isArray() && type.getBasicType() == EbtUint8) + requireInt8Arithmetic(loc, op, "can't use with arrays containing uint8"); +} + void TParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op) { if (type.containsSpecializationSize()) @@ -3822,6 +4490,12 @@ void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identi limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistance array size"); else if (identifier.compare("gl_CullDistance") == 0) limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistance array size"); +#ifdef NV_EXTENSIONS + else if (identifier.compare("gl_ClipDistancePerViewNV") == 0) + limitCheck(loc, size, "gl_MaxClipDistances", "gl_ClipDistancePerViewNV array size"); + else if (identifier.compare("gl_CullDistancePerViewNV") == 0) + limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistancePerViewNV array size"); +#endif } // See if the provided value is less than or equal to the symbol indicated by limit, @@ -3871,9 +4545,39 @@ void TParseContext::finish() if (profile != EEsProfile && version < 430) requireExtensions(getCurrentLoc(), 1, &E_GL_ARB_compute_shader, "compute shaders"); break; +#ifdef NV_EXTENSIONS + case EShLangTaskNV: + requireExtensions(getCurrentLoc(), 1, &E_GL_NV_mesh_shader, "task shaders"); + break; + case EShLangMeshNV: + requireExtensions(getCurrentLoc(), 1, &E_GL_NV_mesh_shader, "mesh shaders"); + break; +#endif default: break; } + +#ifdef NV_EXTENSIONS + // Set default outputs for GL_NV_geometry_shader_passthrough + if (language == EShLangGeometry && extensionTurnedOn(E_SPV_NV_geometry_shader_passthrough)) { + if (intermediate.getOutputPrimitive() == ElgNone) { + switch (intermediate.getInputPrimitive()) { + case ElgPoints: intermediate.setOutputPrimitive(ElgPoints); break; + case ElgLines: intermediate.setOutputPrimitive(ElgLineStrip); break; + case ElgTriangles: intermediate.setOutputPrimitive(ElgTriangleStrip); break; + default: break; + } + } + if (intermediate.getVertices() == TQualifier::layoutNotSet) { + switch (intermediate.getInputPrimitive()) { + case ElgPoints: intermediate.setVertices(1); break; + case ElgLines: intermediate.setVertices(2); break; + case ElgTriangles: intermediate.setVertices(3); break; + default: break; + } + } + } +#endif } // @@ -3917,6 +4621,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.qualifier.layoutPacking = ElpStd430; return; } + if (id == TQualifier::getLayoutPackingString(ElpScalar)) { + requireVulkan(loc, "scalar"); + requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "scalar block layout"); + publicType.qualifier.layoutPacking = ElpScalar; + return; + } // TODO: compile-time performance: may need to stop doing linear searches for (TLayoutFormat format = (TLayoutFormat)(ElfNone + 1); format < ElfCount; format = (TLayoutFormat)(format + 1)) { if (id == TQualifier::getLayoutFormatString(format)) { @@ -3935,44 +4645,57 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.qualifier.layoutPushConstant = true; return; } - if (language == EShLangGeometry || language == EShLangTessEvaluation) { + if (language == EShLangGeometry || language == EShLangTessEvaluation +#ifdef NV_EXTENSIONS + || language == EShLangMeshNV +#endif + ) { if (id == TQualifier::getGeometryString(ElgTriangles)) { publicType.shaderQualifiers.geometry = ElgTriangles; return; } - if (language == EShLangGeometry) { + if (language == EShLangGeometry +#ifdef NV_EXTENSIONS + || language == EShLangMeshNV +#endif + ) { if (id == TQualifier::getGeometryString(ElgPoints)) { publicType.shaderQualifiers.geometry = ElgPoints; return; } - if (id == TQualifier::getGeometryString(ElgLineStrip)) { - publicType.shaderQualifiers.geometry = ElgLineStrip; - return; - } if (id == TQualifier::getGeometryString(ElgLines)) { publicType.shaderQualifiers.geometry = ElgLines; return; } - if (id == TQualifier::getGeometryString(ElgLinesAdjacency)) { - publicType.shaderQualifiers.geometry = ElgLinesAdjacency; - return; - } - if (id == TQualifier::getGeometryString(ElgTrianglesAdjacency)) { - publicType.shaderQualifiers.geometry = ElgTrianglesAdjacency; - return; - } - if (id == TQualifier::getGeometryString(ElgTriangleStrip)) { - publicType.shaderQualifiers.geometry = ElgTriangleStrip; - return; - } #ifdef NV_EXTENSIONS - if (id == "passthrough") { - requireExtensions(loc, 1, &E_SPV_NV_geometry_shader_passthrough, "geometry shader passthrough"); - publicType.qualifier.layoutPassthrough = true; - intermediate.setGeoPassthroughEXT(); - return; - } + if (language == EShLangGeometry) #endif + { + if (id == TQualifier::getGeometryString(ElgLineStrip)) { + publicType.shaderQualifiers.geometry = ElgLineStrip; + return; + } + if (id == TQualifier::getGeometryString(ElgLinesAdjacency)) { + publicType.shaderQualifiers.geometry = ElgLinesAdjacency; + return; + } + if (id == TQualifier::getGeometryString(ElgTrianglesAdjacency)) { + publicType.shaderQualifiers.geometry = ElgTrianglesAdjacency; + return; + } + if (id == TQualifier::getGeometryString(ElgTriangleStrip)) { + publicType.shaderQualifiers.geometry = ElgTriangleStrip; + return; + } +#ifdef NV_EXTENSIONS + if (id == "passthrough") { + requireExtensions(loc, 1, &E_SPV_NV_geometry_shader_passthrough, "geometry shader passthrough"); + publicType.qualifier.layoutPassthrough = true; + intermediate.setGeoPassthroughEXT(); + return; + } +#endif + } } else { assert(language == EShLangTessEvaluation); @@ -4086,6 +4809,27 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi publicType.qualifier.layoutViewportRelative = true; return; } + } else { + if (language == EShLangRayGenNV || language == EShLangIntersectNV || + language == EShLangAnyHitNV || language == EShLangClosestHitNV || + language == EShLangMissNV || language == EShLangCallableNV) { + if (id == "shaderrecordnv") { + publicType.qualifier.layoutShaderRecordNV = true; + return; + } + } + } + if (language == EShLangCompute) { + if (id.compare(0, 17, "derivative_group_") == 0) { + requireExtensions(loc, 1, &E_GL_NV_compute_shader_derivatives, "compute shader derivatives"); + if (id == "derivative_group_quadsnv") { + publicType.shaderQualifiers.layoutDerivativeGroupQuads = true; + return; + } else if (id == "derivative_group_linearnv") { + publicType.shaderQualifiers.layoutDerivativeGroupLinear = true; + return; + } + } } #else } @@ -4208,11 +4952,13 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } else if (id == "xfb_stride") { // "The resulting stride (implicit or explicit), when divided by 4, must be less than or equal to the // implementation-dependent constant gl_MaxTransformFeedbackInterleavedComponents." - if (value > 4 * resources.maxTransformFeedbackInterleavedComponents) - error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", resources.maxTransformFeedbackInterleavedComponents); - else if (value >= (int)TQualifier::layoutXfbStrideEnd) + if (value > 4 * resources.maxTransformFeedbackInterleavedComponents) { + error(loc, "1/4 stride is too large:", id.c_str(), "gl_MaxTransformFeedbackInterleavedComponents is %d", + resources.maxTransformFeedbackInterleavedComponents); + } + if (value >= (int)TQualifier::layoutXfbStrideEnd) error(loc, "stride is too large:", id.c_str(), "internal max is %d", TQualifier::layoutXfbStrideEnd-1); - if (value < (int)TQualifier::layoutXfbStrideEnd) + else publicType.qualifier.layoutXfbStride = value; return; } @@ -4315,10 +5061,39 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi } break; +#ifdef NV_EXTENSIONS + case EShLangMeshNV: + if (id == "max_vertices") { + requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "max_vertices"); + publicType.shaderQualifiers.vertices = value; + if (value > resources.maxMeshOutputVerticesNV) + error(loc, "too large, must be less than gl_MaxMeshOutputVerticesNV", "max_vertices", ""); + return; + } + if (id == "max_primitives") { + requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "max_primitives"); + publicType.shaderQualifiers.primitives = value; + if (value > resources.maxMeshOutputPrimitivesNV) + error(loc, "too large, must be less than gl_MaxMeshOutputPrimitivesNV", "max_primitives", ""); + return; + } + // Fall through + + case EShLangTaskNV: + // Fall through +#endif case EShLangCompute: if (id.compare(0, 11, "local_size_") == 0) { - profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); - profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); +#ifdef NV_EXTENSIONS + if (language == EShLangMeshNV || language == EShLangTaskNV) { + requireExtensions(loc, 1, &E_GL_NV_mesh_shader, "gl_WorkGroupSize"); + } + else +#endif + { + profileRequires(loc, EEsProfile, 310, 0, "gl_WorkGroupSize"); + profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize"); + } if (id.size() == 12 && value == 0) { error(loc, "must be at least 1", id.c_str(), ""); return; @@ -4427,6 +5202,10 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie dst.layoutViewportRelative = true; if (src.layoutSecondaryViewportRelativeOffset != -2048) dst.layoutSecondaryViewportRelativeOffset = src.layoutSecondaryViewportRelativeOffset; + if (src.layoutShaderRecordNV) + dst.layoutShaderRecordNV = true; + if (src.pervertexNV) + dst.pervertexNV = true; #endif } } @@ -4463,9 +5242,10 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb switch (qualifier.storage) { case EvqVaryingIn: case EvqVaryingOut: - if (type.getBasicType() != EbtBlock || - (!(*type.getStruct())[0].type->getQualifier().hasLocation() && - (*type.getStruct())[0].type->getQualifier().builtIn == EbvNone)) + if (!type.getQualifier().isTaskMemory() && + (type.getBasicType() != EbtBlock || + (!(*type.getStruct())[0].type->getQualifier().hasLocation() && + (*type.getStruct())[0].type->getQualifier().builtIn == EbvNone))) error(loc, "SPIR-V requires location for user input/output", "location", ""); break; default: @@ -4491,6 +5271,10 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb error(loc, "cannot specify on a variable declaration", "align", ""); if (qualifier.layoutPushConstant) error(loc, "can only specify on a uniform block", "push_constant", ""); +#ifdef NV_EXTENSIONS + if (qualifier.layoutShaderRecordNV) + error(loc, "can only specify on a buffer block", "shaderRecordNV", ""); +#endif } break; default: @@ -4507,7 +5291,8 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb // they are not allowed on block members. For arrayed interfaces (those generally having an // extra level of arrayness due to interface expansion), the outer array is stripped before // applying this rule." -void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool memberWithLocation, TArraySizes* arraySizes) +void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool memberWithLocation, + TArraySizes* arraySizes) { if (memberWithLocation && arraySizes != nullptr) { if (arraySizes->getNumDims() > (currentBlockQualifier.isArrayedIo(language) ? 1 : 0)) @@ -4553,10 +5338,24 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) case EvqVaryingOut: if (type.getBasicType() == EbtBlock) profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "location qualifier on in/out block"); +#ifdef NV_EXTENSIONS + if (type.getQualifier().isTaskMemory()) + error(loc, "cannot apply to taskNV in/out blocks", "location", ""); +#endif break; case EvqUniform: case EvqBuffer: + if (type.getBasicType() == EbtBlock) + error(loc, "cannot apply to uniform or buffer block", "location", ""); break; +#ifdef NV_EXTENSIONS + case EvqPayloadNV: + case EvqPayloadInNV: + case EvqHitAttrNV: + case EvqCallableDataNV: + case EvqCallableDataInNV: + break; +#endif default: error(loc, "can only apply to uniform, buffer, in, or out storage qualifiers", "location", ""); break; @@ -4582,11 +5381,9 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // containing a double, the offset must also be a multiple of 8..." if (type.containsBasicType(EbtDouble) && ! IsMultipleOfPow2(qualifier.layoutXfbOffset, 8)) error(loc, "type contains double; xfb_offset must be a multiple of 8", "xfb_offset", ""); -#ifdef AMD_EXTENSIONS // ..., if applied to an aggregate containing a float16_t, the offset must also be a multiple of 2..." else if (type.containsBasicType(EbtFloat16) && !IsMultipleOfPow2(qualifier.layoutXfbOffset, 2)) error(loc, "type contains half float; xfb_offset must be a multiple of 2", "xfb_offset", ""); -#endif else if (! IsMultipleOfPow2(qualifier.layoutXfbOffset, 4)) error(loc, "must be a multiple of size of first component", "xfb_offset", ""); } @@ -4610,11 +5407,17 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) if (type.getBasicType() == EbtSampler) { int lastBinding = qualifier.layoutBinding; if (type.isArray()) { - if (type.isImplicitlySizedArray()) { + if (spvVersion.vulkan > 0) lastBinding += 1; - warn(loc, "assuming array size of one for compile-time checking of binding numbers for implicitly-sized array", "[]", ""); - } else - lastBinding += type.getCumulativeArraySize(); + else { + if (type.isSizedArray()) + lastBinding += type.getCumulativeArraySize(); + else { + lastBinding += 1; + if (spvVersion.vulkan == 0) + warn(loc, "assuming binding count of one for compile-time checking of binding numbers for unsized array", "[]", ""); + } + } } if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits) error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : ""); @@ -4625,12 +5428,34 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) return; } } + } else if (!intermediate.getAutoMapBindings()) { + // some types require bindings + + // atomic_uint + if (type.getBasicType() == EbtAtomicUint) + error(loc, "layout(binding=X) is required", "atomic_uint", ""); + + // SPIR-V + if (spvVersion.spv > 0) { + if (qualifier.isUniformOrBuffer()) { + if (type.getBasicType() == EbtBlock && !qualifier.layoutPushConstant && +#ifdef NV_EXTENSIONS + !qualifier.layoutShaderRecordNV && +#endif + !qualifier.layoutAttachment) + error(loc, "uniform/buffer blocks require layout(binding=X)", "binding", ""); + else if (spvVersion.vulkan > 0 && type.getBasicType() == EbtSampler) + error(loc, "sampler/texture/image requires layout(binding=X)", "binding", ""); + } + } } - // atomic_uint - if (type.getBasicType() == EbtAtomicUint) { - if (! type.getQualifier().hasBinding()) - error(loc, "layout(binding=X) is required", "atomic_uint", ""); + // some things can't have arrays of arrays + if (type.isArrayOfArrays()) { + if (spvVersion.vulkan > 0) { + if (type.isOpaque() || (type.getQualifier().isUniformOrBuffer() && type.getBasicType() == EbtBlock)) + warn(loc, "Generating SPIR-V array-of-arrays, but Vulkan only supports single array level for this resource", "[][]", ""); + } } // "The offset qualifier can only be used on block members of blocks..." @@ -4669,6 +5494,11 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) if (qualifier.layoutPushConstant && type.getBasicType() != EbtBlock) error(loc, "can only be used with a block", "push_constant", ""); +#ifdef NV_EXTENSIONS + if (qualifier.layoutShaderRecordNV && type.getBasicType() != EbtBlock) + error(loc, "can only be used with a block", "shaderRecordNV", ""); +#endif + // input attachment if (type.isSubpass()) { if (! qualifier.hasAttachment()) @@ -4686,20 +5516,18 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) error(loc, "can only be applied to a scalar", "constant_id", ""); switch (type.getBasicType()) { + case EbtInt8: + case EbtUint8: + case EbtInt16: + case EbtUint16: case EbtInt: case EbtUint: case EbtInt64: case EbtUint64: -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: -#endif case EbtBool: case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif break; default: error(loc, "cannot be applied to this type", "constant_id", ""); @@ -4781,19 +5609,19 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier } if (qualifier.hasBinding()) { - if (! qualifier.isUniformOrBuffer()) + if (! qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory()) error(loc, "requires uniform or buffer storage qualifier", "binding", ""); } if (qualifier.hasStream()) { - if (qualifier.storage != EvqVaryingOut) + if (!qualifier.isPipeOutput()) error(loc, "can only be used on an output", "stream", ""); } if (qualifier.hasXfb()) { - if (qualifier.storage != EvqVaryingOut) + if (!qualifier.isPipeOutput()) error(loc, "can only be used on an output", "xfb layout qualifier", ""); } if (qualifier.hasUniformLayout()) { - if (! qualifier.isUniformOrBuffer()) { + if (! qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory()) { if (qualifier.hasMatrix() || qualifier.hasPacking()) error(loc, "matrix or packing qualifiers can only be used on a uniform or buffer", "layout", ""); if (qualifier.hasOffset() || qualifier.hasAlign()) @@ -4806,6 +5634,20 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier if (qualifier.hasSet()) error(loc, "cannot be used with push_constant", "set", ""); } +#ifdef NV_EXTENSIONS + if (qualifier.layoutShaderRecordNV) { + if (qualifier.storage != EvqBuffer) + error(loc, "can only be used with a buffer", "shaderRecordNV", ""); + if (qualifier.hasBinding()) + error(loc, "cannot be used with shaderRecordNV", "binding", ""); + if (qualifier.hasSet()) + error(loc, "cannot be used with shaderRecordNV", "set", ""); + + } + if (qualifier.storage == EvqHitAttrNV && qualifier.hasLayout()) { + error(loc, "cannot apply layout qualifiers to hitAttributeNV variable", "hitAttributeNV", ""); + } +#endif } // For places that can't have shader-level layout qualifiers @@ -4834,13 +5676,25 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua error(loc, message, "local_size id", ""); } if (shaderQualifiers.vertices != TQualifier::layoutNotSet) { - if (language == EShLangGeometry) + if (language == EShLangGeometry +#ifdef NV_EXTENSIONS + || language == EShLangMeshNV +#endif + ) error(loc, message, "max_vertices", ""); else if (language == EShLangTessControl) error(loc, message, "vertices", ""); else assert(0); } +#ifdef NV_EXTENSIONS + if (shaderQualifiers.primitives != TQualifier::layoutNotSet) { + if (language == EShLangMeshNV) + error(loc, message, "max_primitives", ""); + else + assert(0); + } +#endif if (shaderQualifiers.blendEquation) error(loc, message, "blend equation", ""); if (shaderQualifiers.numViews != TQualifier::layoutNotSet) @@ -4865,7 +5719,7 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol) // Check for overlap int numOffsets = 4; if (symbol.getType().isArray()) { - if (symbol.getType().isExplicitlySizedArray() && ! symbol.getType().getArraySizes()->isInnerImplicit()) + if (symbol.getType().isSizedArray() && !symbol.getType().getArraySizes()->isInnerUnsized()) numOffsets *= symbol.getType().getCumulativeArraySize(); else { // "It is a compile-time error to declare an unsized array of atomic_uint." @@ -4896,10 +5750,21 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunct return nullptr; } + bool explicitTypesEnabled = extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int8) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int16) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int32) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int64) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float16) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float32) || + extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float64); + if (profile == EEsProfile || version < 120) function = findFunctionExact(loc, call, builtIn); else if (version < 400) function = findFunction120(loc, call, builtIn); + else if (explicitTypesEnabled) + function = findFunctionExplicitTypes(loc, call, builtIn); else function = findFunction400(loc, call, builtIn); @@ -5084,6 +5949,85 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu return bestMatch; } +// "To determine whether the conversion for a single argument in one match +// is better than that for another match, the conversion is assigned of the +// three ranks ordered from best to worst: +// 1. Exact match: no conversion. +// 2. Promotion: integral or floating-point promotion. +// 3. Conversion: integral conversion, floating-point conversion, +// floating-integral conversion. +// A conversion C1 is better than a conversion C2 if the rank of C1 is +// better than the rank of C2." +const TFunction* TParseContext::findFunctionExplicitTypes(const TSourceLoc& loc, const TFunction& call, bool& builtIn) +{ + // first, look for an exact match + TSymbol* symbol = symbolTable.find(call.getMangledName(), &builtIn); + if (symbol) + return symbol->getAsFunction(); + + // no exact match, use the generic selector, parameterized by the GLSL rules + + // create list of candidates to send + TVector candidateList; + symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn); + + // can 'from' convert to 'to'? + const auto convertible = [this](const TType& from, const TType& to, TOperator, int) -> bool { + if (from == to) + return true; + if (from.isArray() || to.isArray() || ! from.sameElementShape(to)) + return false; + return intermediate.canImplicitlyPromote(from.getBasicType(), to.getBasicType()); + }; + + // Is 'to2' a better conversion than 'to1'? + // Ties should not be considered as better. + // Assumes 'convertible' already said true. + const auto better = [this](const TType& from, const TType& to1, const TType& to2) -> bool { + // 1. exact match + if (from == to2) + return from != to1; + if (from == to1) + return false; + + // 2. Promotion (integral, floating-point) is better + TBasicType from_type = from.getBasicType(); + TBasicType to1_type = to1.getBasicType(); + TBasicType to2_type = to2.getBasicType(); + bool isPromotion1 = (intermediate.isIntegralPromotion(from_type, to1_type) || + intermediate.isFPPromotion(from_type, to1_type)); + bool isPromotion2 = (intermediate.isIntegralPromotion(from_type, to2_type) || + intermediate.isFPPromotion(from_type, to2_type)); + if (isPromotion2) + return !isPromotion1; + if(isPromotion1) + return false; + + // 3. Conversion (integral, floating-point , floating-integral) + bool isConversion1 = (intermediate.isIntegralConversion(from_type, to1_type) || + intermediate.isFPConversion(from_type, to1_type) || + intermediate.isFPIntegralConversion(from_type, to1_type)); + bool isConversion2 = (intermediate.isIntegralConversion(from_type, to2_type) || + intermediate.isFPConversion(from_type, to2_type) || + intermediate.isFPIntegralConversion(from_type, to2_type)); + + return isConversion2 && !isConversion1; + }; + + // for ambiguity reporting + bool tie = false; + + // send to the generic selector + const TFunction* bestMatch = selectFunction(candidateList, call, convertible, better, tie); + + if (bestMatch == nullptr) + error(loc, "no matching overloaded function found", call.getName().c_str(), ""); + else if (tie) + error(loc, "ambiguous best function under implicit type conversion", call.getName().c_str(), ""); + + return bestMatch; +} + // When a declaration includes a type, but not a variable name, it can be // to establish defaults. void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType) @@ -5112,15 +6056,15 @@ void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType // 'publicType' is the type part of the declaration (to the left) // 'arraySizes' is the arrayness tagged on the identifier (to the right) // -TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, const TPublicType& publicType, TArraySizes* arraySizes, TIntermTyped* initializer) +TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, const TPublicType& publicType, + TArraySizes* arraySizes, TIntermTyped* initializer) { - TType type(publicType); // shallow copy; 'type' shares the arrayness and structure definition with 'publicType' - if (type.isImplicitlySizedArray()) { - // Because "int[] a = int[2](...), b = int[3](...)" makes two arrays a and b - // of different sizes, for this case sharing the shallow copy of arrayness - // with the publicType oversubscribes it, so get a deep copy of the arrayness. - type.newArraySizes(*publicType.arraySizes); - } + // Make a fresh type that combines the characteristics from the individual + // identifier syntax and the declaration-type syntax. + TType type(publicType); + type.transferArraySizes(arraySizes); + type.copyArrayInnerSizes(publicType.arraySizes); + arrayOfArrayVersionCheck(loc, type.getArraySizes()); if (voidErrorCheck(loc, identifier, type.getBasicType())) return nullptr; @@ -5133,6 +6077,18 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden samplerCheck(loc, type, identifier, initializer); atomicUintCheck(loc, type, identifier); transparentOpaqueCheck(loc, type, identifier); +#ifdef NV_EXTENSIONS + accStructNVCheck(loc, type, identifier); +#endif + + if (type.getQualifier().storage != EvqUniform && type.getQualifier().storage != EvqBuffer) { + if (type.containsBasicType(EbtFloat16)) + requireFloat16Arithmetic(loc, "qualifier", "float16 types can only be in uniform block or buffer storage"); + if (type.contains16BitInt()) + requireInt16Arithmetic(loc, "qualifier", "(u)int16 types can only be in uniform block or buffer storage"); + if (type.contains8BitInt()) + requireInt8Arithmetic(loc, "qualifier", "(u)int8 types can only be in uniform block or buffer storage"); + } if (identifier != "gl_FragCoord" && (publicType.shaderQualifiers.originUpperLeft || publicType.shaderQualifiers.pixelCenterInteger)) error(loc, "can only apply origin_upper_left and pixel_center_origin to gl_FragCoord", "layout qualifier", ""); @@ -5147,15 +6103,9 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden inheritGlobalDefaults(type.getQualifier()); // Declare the variable - if (arraySizes || type.isArray()) { - // Arrayness is potentially coming both from the type and from the - // variable: "int[] a[];" or just one or the other. - // Merge it all to the type, so all arrayness is part of the type. - arrayDimCheck(loc, &type, arraySizes); - arrayDimMerge(type, arraySizes); - + if (type.isArray()) { // Check that implicit sizing is only where allowed. - arraySizesCheck(loc, type.getQualifier(), &type.getArraySizes(), initializer != nullptr, false); + arraySizesCheck(loc, type.getQualifier(), type.getArraySizes(), initializer, false); if (! arrayQualifierError(loc, type.getQualifier()) && ! arrayError(loc, type)) declareArray(loc, identifier, type, symbol); @@ -5192,6 +6142,11 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden // fix up fixOffset(loc, *symbol); + if (symbol->getType().getBasicType() == EbtStruct) { + fixXfbOffsets(symbol->getWritableType().getQualifier(), + *(symbol->getWritableType().getWritableStruct())); + } + return initNode; } @@ -5286,8 +6241,7 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp } // Fix outer arrayness if variable is unsized, getting size from the initializer - if (initializer->getType().isExplicitlySizedArray() && - variable->getType().isImplicitlySizedArray()) + if (initializer->getType().isSizedArray() && variable->getType().isUnsizedArray()) variable->getWritableType().changeOuterArraySize(initializer->getType().getOuterArraySize()); // Inner arrayness can also get set by an initializer @@ -5296,8 +6250,10 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp variable->getType().getArraySizes()->getNumDims()) { // adopt unsized sizes from the initializer's sizes for (int d = 1; d < variable->getType().getArraySizes()->getNumDims(); ++d) { - if (variable->getType().getArraySizes()->getDimSize(d) == UnsizedArraySize) - variable->getWritableType().getArraySizes().setDimSize(d, initializer->getType().getArraySizes()->getDimSize(d)); + if (variable->getType().getArraySizes()->getDimSize(d) == UnsizedArraySize) { + variable->getWritableType().getArraySizes()->setDimSize(d, + initializer->getType().getArraySizes()->getDimSize(d)); + } } } @@ -5408,16 +6364,16 @@ TIntermTyped* TParseContext::convertInitializerList(const TSourceLoc& loc, const // Later on, initializer execution code will deal with array size logic. TType arrayType; arrayType.shallowCopy(type); // sharing struct stuff is fine - arrayType.newArraySizes(*type.getArraySizes()); // but get a fresh copy of the array information, to edit below + arrayType.copyArraySizes(*type.getArraySizes()); // but get a fresh copy of the array information, to edit below // edit array sizes to fill in unsized dimensions arrayType.changeOuterArraySize((int)initList->getSequence().size()); TIntermTyped* firstInit = initList->getSequence()[0]->getAsTyped(); if (arrayType.isArrayOfArrays() && firstInit->getType().isArray() && - arrayType.getArraySizes().getNumDims() == firstInit->getType().getArraySizes()->getNumDims() + 1) { - for (int d = 1; d < arrayType.getArraySizes().getNumDims(); ++d) { - if (arrayType.getArraySizes().getDimSize(d) == UnsizedArraySize) - arrayType.getArraySizes().setDimSize(d, firstInit->getType().getArraySizes()->getDimSize(d - 1)); + arrayType.getArraySizes()->getNumDims() == firstInit->getType().getArraySizes()->getNumDims() + 1) { + for (int d = 1; d < arrayType.getArraySizes()->getNumDims(); ++d) { + if (arrayType.getArraySizes()->getDimSize(d) == UnsizedArraySize) + arrayType.getArraySizes()->setDimSize(d, firstInit->getType().getArraySizes()->getDimSize(d - 1)); } } @@ -5490,8 +6446,14 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* // Combined texture-sampler constructors are completely semantic checked // in constructorTextureSamplerError() - if (op == EOpConstructTextureSampler) + if (op == EOpConstructTextureSampler) { + if (aggrNode->getSequence()[1]->getAsTyped()->getType().getSampler().shadow) { + // Transfer depth into the texture (SPIR-V image) type, as a hint + // for tools to know this texture/image is a depth image. + aggrNode->getSequence()[0]->getAsTyped()->getWritableType().getSampler().shadow = true; + } return intermediate.setAggregateOperator(aggrNode, op, type, loc); + } TTypeList::const_iterator memberTypes; if (op == EOpConstructStruct) @@ -5567,8 +6529,22 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode* // // Returns nullptr for an error or the constructed node. // -TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc, bool subset) +TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc, + bool subset) { + // If we are changing a matrix in both domain of basic type and to a non matrix, + // do the shape change first (by default, below, basic type is changed before shape). + // This avoids requesting a matrix of a new type that is going to be discarded anyway. + // TODO: This could be generalized to more type combinations, but that would require + // more extensive testing and full algorithm rework. For now, the need to do two changes makes + // the recursive call work, and avoids the most aggregious case of creating integer matrices. + if (node->getType().isMatrix() && (type.isScalar() || type.isVector()) && + type.isFloatingDomain() != node->getType().isFloatingDomain()) { + TType transitionType(node->getBasicType(), glslang::EvqTemporary, type.getVectorSize(), 0, 0, node->isVector()); + TOperator transitionOp = intermediate.mapTypeToConstructorOp(transitionType); + node = constructBuiltIn(transitionType, transitionOp, node, loc, false); + } + TIntermTyped* newNode; TOperator basicOp; @@ -5608,7 +6584,6 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T basicOp = EOpConstructDouble; break; -#ifdef AMD_EXTENSIONS case EOpConstructF16Vec2: case EOpConstructF16Vec3: case EOpConstructF16Vec4: @@ -5624,7 +6599,34 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructFloat16: basicOp = EOpConstructFloat16; break; -#endif + + case EOpConstructI8Vec2: + case EOpConstructI8Vec3: + case EOpConstructI8Vec4: + case EOpConstructInt8: + basicOp = EOpConstructInt8; + break; + + case EOpConstructU8Vec2: + case EOpConstructU8Vec3: + case EOpConstructU8Vec4: + case EOpConstructUint8: + basicOp = EOpConstructUint8; + break; + + case EOpConstructI16Vec2: + case EOpConstructI16Vec3: + case EOpConstructI16Vec4: + case EOpConstructInt16: + basicOp = EOpConstructInt16; + break; + + case EOpConstructU16Vec2: + case EOpConstructU16Vec3: + case EOpConstructU16Vec4: + case EOpConstructUint16: + basicOp = EOpConstructUint16; + break; case EOpConstructIVec2: case EOpConstructIVec3: @@ -5654,22 +6656,6 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T basicOp = EOpConstructUint64; break; -#ifdef AMD_EXTENSIONS - case EOpConstructI16Vec2: - case EOpConstructI16Vec3: - case EOpConstructI16Vec4: - case EOpConstructInt16: - basicOp = EOpConstructInt16; - break; - - case EOpConstructU16Vec2: - case EOpConstructU16Vec3: - case EOpConstructU16Vec4: - case EOpConstructUint16: - basicOp = EOpConstructUint16; - break; -#endif - case EOpConstructBVec2: case EOpConstructBVec3: case EOpConstructBVec4: @@ -5677,6 +6663,11 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T basicOp = EOpConstructBool; break; + case EOpConstructNonuniform: + node->getWritableType().getQualifier().nonUniform = true; + return node; + break; + default: error(loc, "unsupported construction", "", ""); @@ -5721,13 +6712,14 @@ TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType& // // Do everything needed to add an interface block. // -void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, const TString* instanceName, TArraySizes* arraySizes) +void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, const TString* instanceName, + TArraySizes* arraySizes) { blockStageIoCheck(loc, currentBlockQualifier); blockQualifierCheck(loc, currentBlockQualifier, instanceName != nullptr); - if (arraySizes) { - arraySizesCheck(loc, currentBlockQualifier, arraySizes, false, false); - arrayDimCheck(loc, arraySizes, 0); + if (arraySizes != nullptr) { + arraySizesCheck(loc, currentBlockQualifier, arraySizes, nullptr, false); + arrayOfArrayVersionCheck(loc, arraySizes); if (arraySizes->getNumDims() > 1) requireProfile(loc, ~EEsProfile, "array-of-array of block"); } @@ -5741,10 +6733,18 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con if (memberQualifier.storage != EvqTemporary && memberQualifier.storage != EvqGlobal && memberQualifier.storage != currentBlockQualifier.storage) error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), ""); memberQualifier.storage = currentBlockQualifier.storage; +#ifdef NV_EXTENSIONS + if (currentBlockQualifier.perPrimitiveNV) + memberQualifier.perPrimitiveNV = currentBlockQualifier.perPrimitiveNV; + if (currentBlockQualifier.perViewNV) + memberQualifier.perViewNV = currentBlockQualifier.perViewNV; + if (currentBlockQualifier.perTaskNV) + memberQualifier.perTaskNV = currentBlockQualifier.perTaskNV; +#endif if ((currentBlockQualifier.storage == EvqUniform || currentBlockQualifier.storage == EvqBuffer) && (memberQualifier.isInterpolation() || memberQualifier.isAuxiliary())) error(memberLoc, "member of uniform or buffer block cannot have an auxiliary or interpolation qualifier", memberType.getFieldName().c_str(), ""); if (memberType.isArray()) - arraySizesCheck(memberLoc, currentBlockQualifier, &memberType.getArraySizes(), false, member == typeList.size() - 1); + arraySizesCheck(memberLoc, currentBlockQualifier, memberType.getArraySizes(), nullptr, member == typeList.size() - 1); if (memberQualifier.hasOffset()) { if (spvVersion.spv == 0) { requireProfile(memberLoc, ~EEsProfile, "offset on block member"); @@ -5783,23 +6783,38 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // Special case for "push_constant uniform", which has a default of std430, // contrary to normal uniform defaults, and can't have a default tracked for it. - if (currentBlockQualifier.layoutPushConstant && !currentBlockQualifier.hasPacking()) + if ((currentBlockQualifier.layoutPushConstant && !currentBlockQualifier.hasPacking()) +#ifdef NV_EXTENSIONS + || (currentBlockQualifier.layoutShaderRecordNV && !currentBlockQualifier.hasPacking()) +#endif + ) currentBlockQualifier.layoutPacking = ElpStd430; +#ifdef NV_EXTENSIONS + // Special case for "taskNV in/out", which has a default of std430, + if (currentBlockQualifier.perTaskNV && !currentBlockQualifier.hasPacking()) + currentBlockQualifier.layoutPacking = ElpStd430; +#endif + // fix and check for member layout qualifiers mergeObjectLayoutQualifiers(defaultQualification, currentBlockQualifier, true); // "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts." if (currentBlockQualifier.hasAlign()) { - if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) { - error(loc, "can only be used with std140 or std430 layout packing", "align", ""); + if (defaultQualification.layoutPacking != ElpStd140 && + defaultQualification.layoutPacking != ElpStd430 && + defaultQualification.layoutPacking != ElpScalar) { + error(loc, "can only be used with std140, std430, or scalar layout packing", "align", ""); defaultQualification.layoutAlign = -1; } } bool memberWithLocation = false; bool memberWithoutLocation = false; +#ifdef NV_EXTENSIONS + bool memberWithPerViewQualifier = false; +#endif for (unsigned int member = 0; member < typeList.size(); ++member) { TQualifier& memberQualifier = typeList[member].type->getQualifier(); const TSourceLoc& memberLoc = typeList[member].loc; @@ -5839,10 +6854,18 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // "The offset qualifier can only be used on block members of blocks declared with std140 or std430 layouts." // "The align qualifier can only be used on blocks or block members, and only for blocks declared with std140 or std430 layouts." if (memberQualifier.hasAlign() || memberQualifier.hasOffset()) { - if (defaultQualification.layoutPacking != ElpStd140 && defaultQualification.layoutPacking != ElpStd430) - error(memberLoc, "can only be used with std140 or std430 layout packing", "offset/align", ""); + if (defaultQualification.layoutPacking != ElpStd140 && + defaultQualification.layoutPacking != ElpStd430 && + defaultQualification.layoutPacking != ElpScalar) + error(memberLoc, "can only be used with std140, std430, or scalar layout packing", "offset/align", ""); } +#ifdef NV_EXTENSIONS + if (memberQualifier.isPerView()) { + memberWithPerViewQualifier = true; + } +#endif + TQualifier newMemberQualification = defaultQualification; mergeQualifiers(memberLoc, newMemberQualification, memberQualifier, false); memberQualifier = newMemberQualification; @@ -5850,13 +6873,31 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con layoutMemberLocationArrayCheck(loc, memberWithLocation, arraySizes); + // Ensure that the block has an XfbBuffer assigned. This is needed + // because if the block has a XfbOffset assigned, then it is + // assumed that it has implicitly assigned the current global + // XfbBuffer, and because it's members need to be assigned a + // XfbOffset if they lack it. + if (currentBlockQualifier.storage == EvqVaryingOut && globalOutputDefaults.hasXfbBuffer()) { + if (!currentBlockQualifier.hasXfbBuffer() && currentBlockQualifier.hasXfbOffset()) + currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; + } + // Process the members fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation); - fixBlockXfbOffsets(currentBlockQualifier, typeList); + fixXfbOffsets(currentBlockQualifier, typeList); fixBlockUniformOffsets(currentBlockQualifier, typeList); for (unsigned int member = 0; member < typeList.size(); ++member) layoutTypeCheck(typeList[member].loc, *typeList[member].type); +#ifdef NV_EXTENSIONS + if (memberWithPerViewQualifier) { + for (unsigned int member = 0; member < typeList.size(); ++member) { + resizeMeshViewDimension(typeList[member].loc, *typeList[member].type); + } + } +#endif + // reverse merge, so that currentBlockQualifier now has all layout information // (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers) mergeObjectLayoutQualifiers(currentBlockQualifier, defaultQualification, true); @@ -5866,8 +6907,8 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // TType blockType(&typeList, *blockName, currentBlockQualifier); - if (arraySizes) - blockType.newArraySizes(*arraySizes); + if (arraySizes != nullptr) + blockType.transferArraySizes(arraySizes); else ioArrayCheck(loc, blockType, instanceName ? *instanceName : *blockName); @@ -5920,7 +6961,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // fix up if (isIoResizeArray(blockType)) { ioArraySymbolResizeList.push_back(&variable); - checkIoArraysConsistency(loc, true); + checkIoArraysConsistency(loc, true, blockType.getQualifier().isPerPrimitive()); } else fixIoArraySize(loc, variable.getWritableType()); @@ -5937,7 +6978,7 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q profileRequires(loc, EEsProfile, 300, nullptr, "uniform block"); profileRequires(loc, ENoProfile, 140, nullptr, "uniform block"); if (currentBlockQualifier.layoutPacking == ElpStd430 && ! currentBlockQualifier.layoutPushConstant) - error(loc, "requires the 'buffer' storage qualifier", "std430", ""); + requireExtensions(loc, 1, &E_GL_EXT_scalar_block_layout, "std430 requires the buffer storage qualifier"); break; case EvqBuffer: requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "buffer block"); @@ -5948,17 +6989,65 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "input block"); // It is a compile-time error to have an input block in a vertex shader or an output block in a fragment shader // "Compute shaders do not permit user-defined input variables..." - requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block"); - if (language == EShLangFragment) + requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask +#ifdef NV_EXTENSIONS + |EShLangMeshNVMask +#endif + ), "input block"); + if (language == EShLangFragment) { profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block"); + } +#ifdef NV_EXTENSIONS + else if (language == EShLangMeshNV && ! qualifier.isTaskMemory()) { + error(loc, "input blocks cannot be used in a mesh shader", "out", ""); + } +#endif break; case EvqVaryingOut: profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "output block"); - requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block"); + requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask +#ifdef NV_EXTENSIONS + |EShLangMeshNVMask|EShLangTaskNVMask +#endif + ), "output block"); // ES 310 can have a block before shader_io is turned on, so skip this test for built-ins - if (language == EShLangVertex && ! parsingBuiltins) + if (language == EShLangVertex && ! parsingBuiltins) { profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block"); + } +#ifdef NV_EXTENSIONS + else if (language == EShLangMeshNV && qualifier.isTaskMemory()) { + error(loc, "can only use on input blocks in mesh shader", "taskNV", ""); + } + else if (language == EShLangTaskNV && ! qualifier.isTaskMemory()) { + error(loc, "output blocks cannot be used in a task shader", "out", ""); + } +#endif break; +#ifdef NV_EXTENSIONS + case EvqPayloadNV: + profileRequires(loc, ~EEsProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV block"); + requireStage(loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangAnyHitNVMask | EShLangClosestHitNVMask | EShLangMissNVMask), + "rayPayloadNV block"); + break; + case EvqPayloadInNV: + profileRequires(loc, ~EEsProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV block"); + requireStage(loc, (EShLanguageMask)(EShLangAnyHitNVMask | EShLangClosestHitNVMask | EShLangMissNVMask), + "rayPayloadInNV block"); + break; + case EvqHitAttrNV: + profileRequires(loc, ~EEsProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV block"); + requireStage(loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangAnyHitNVMask | EShLangClosestHitNVMask), "hitAttributeNV block"); + break; + case EvqCallableDataNV: + profileRequires(loc, ~EEsProfile, 460, E_GL_NV_ray_tracing, "callableDataNV block"); + requireStage(loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), + "callableDataNV block"); + break; + case EvqCallableDataInNV: + profileRequires(loc, ~EEsProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV block"); + requireStage(loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV block"); + break; +#endif default: error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), ""); break; @@ -5995,6 +7084,12 @@ void TParseContext::blockQualifierCheck(const TSourceLoc& loc, const TQualifier& error(loc, "cannot use invariant qualifier on an interface block", "invariant", ""); if (qualifier.layoutPushConstant) intermediate.addPushConstantCount(); +#ifdef NV_EXTENSIONS + if (qualifier.layoutShaderRecordNV) + intermediate.addShaderRecordNVCount(); + if (qualifier.perTaskNV) + intermediate.addTaskNVCount(); +#endif } // @@ -6034,13 +7129,14 @@ void TParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifi memberQualifier.layoutLocation = nextLocation; memberQualifier.layoutComponent = TQualifier::layoutComponentEnd; } - nextLocation = memberQualifier.layoutLocation + intermediate.computeTypeLocationSize(*typeList[member].type); + nextLocation = memberQualifier.layoutLocation + intermediate.computeTypeLocationSize( + *typeList[member].type, language); } } } } -void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList) +void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) { // "If a block is qualified with xfb_offset, all its // members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any @@ -6079,9 +7175,9 @@ void TParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeLis // void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typeList) { - if (! qualifier.isUniformOrBuffer()) + if (!qualifier.isUniformOrBuffer() && !qualifier.isTaskMemory()) return; - if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430) + if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430 && qualifier.layoutPacking != ElpScalar) return; int offset = 0; @@ -6095,8 +7191,8 @@ void TParseContext::fixBlockUniformOffsets(TQualifier& qualifier, TTypeList& typ // modify just the children's view of matrix layout, if there is one for this member TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix; int dummyStride; - int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride, qualifier.layoutPacking == ElpStd140, - subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : qualifier.layoutMatrix == ElmRowMajor); + int memberAlignment = intermediate.getMemberAlignment(*typeList[member].type, memberSize, dummyStride, qualifier.layoutPacking, + subMatrixLayout != ElmNone ? subMatrixLayout == ElmRowMajor : qualifier.layoutMatrix == ElmRowMajor); if (memberQualifier.hasOffset()) { // "The specified offset must be a multiple // of the base alignment of the type of the block member it qualifies, or a compile-time error results." @@ -6211,7 +7307,11 @@ void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qual void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType) { if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) { +#ifdef NV_EXTENSIONS + assert(language == EShLangTessControl || language == EShLangGeometry || language == EShLangMeshNV); +#else assert(language == EShLangTessControl || language == EShLangGeometry); +#endif const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices"; if (publicType.qualifier.storage != EvqVaryingOut) @@ -6222,6 +7322,17 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con if (language == EShLangTessControl) checkIoArraysConsistency(loc); } +#ifdef NV_EXTENSIONS + if (publicType.shaderQualifiers.primitives != TQualifier::layoutNotSet) { + assert(language == EShLangMeshNV); + const char* id = "max_primitives"; + + if (publicType.qualifier.storage != EvqVaryingOut) + error(loc, "can only apply to 'out'", id, ""); + if (! intermediate.setPrimitives(publicType.shaderQualifiers.primitives)) + error(loc, "cannot change previously set layout value", id, ""); + } +#endif if (publicType.shaderQualifiers.invocations != TQualifier::layoutNotSet) { if (publicType.qualifier.storage != EvqVaryingIn) error(loc, "can only apply to 'in'", "invocations", ""); @@ -6238,6 +7349,12 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con case ElgTrianglesAdjacency: case ElgQuads: case ElgIsolines: +#ifdef NV_EXTENSIONS + if (language == EShLangMeshNV) { + error(loc, "cannot apply to input", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); + break; + } +#endif if (intermediate.setInputPrimitive(publicType.shaderQualifiers.geometry)) { if (language == EShLangGeometry) checkIoArraysConsistency(loc); @@ -6249,6 +7366,15 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con } } else if (publicType.qualifier.storage == EvqVaryingOut) { switch (publicType.shaderQualifiers.geometry) { +#ifdef NV_EXTENSIONS + case ElgLines: + case ElgTriangles: + if (language != EShLangMeshNV) { + error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), ""); + break; + } +#endif + // Fall through case ElgPoints: case ElgLineStrip: case ElgTriangleStrip: @@ -6288,14 +7414,41 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con error(loc, "cannot change previously set size", "local_size", ""); else { int max = 0; - switch (i) { - case 0: max = resources.maxComputeWorkGroupSizeX; break; - case 1: max = resources.maxComputeWorkGroupSizeY; break; - case 2: max = resources.maxComputeWorkGroupSizeZ; break; - default: break; + if (language == EShLangCompute) { + switch (i) { + case 0: max = resources.maxComputeWorkGroupSizeX; break; + case 1: max = resources.maxComputeWorkGroupSizeY; break; + case 2: max = resources.maxComputeWorkGroupSizeZ; break; + default: break; + } + if (intermediate.getLocalSize(i) > (unsigned int)max) + error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); + } +#ifdef NV_EXTENSIONS + else if (language == EShLangMeshNV) { + switch (i) { + case 0: max = resources.maxMeshWorkGroupSizeX_NV; break; + case 1: max = resources.maxMeshWorkGroupSizeY_NV; break; + case 2: max = resources.maxMeshWorkGroupSizeZ_NV; break; + default: break; + } + if (intermediate.getLocalSize(i) > (unsigned int)max) + error(loc, "too large; see gl_MaxMeshWorkGroupSizeNV", "local_size", ""); + } + else if (language == EShLangTaskNV) { + switch (i) { + case 0: max = resources.maxTaskWorkGroupSizeX_NV; break; + case 1: max = resources.maxTaskWorkGroupSizeY_NV; break; + case 2: max = resources.maxTaskWorkGroupSizeZ_NV; break; + default: break; + } + if (intermediate.getLocalSize(i) > (unsigned int)max) + error(loc, "too large; see gl_MaxTaskWorkGroupSizeNV", "local_size", ""); + } +#endif + else { + assert(0); } - if (intermediate.getLocalSize(i) > (unsigned int)max) - error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", ""); // Fix the existing constant gl_WorkGroupSize with this new information. TVariable* workGroupSize = getEditableVariable("gl_WorkGroupSize"); @@ -6334,6 +7487,36 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con error(loc, "can only apply to 'out'", "blend equation", ""); } +#ifdef NV_EXTENSIONS + if (publicType.shaderQualifiers.layoutDerivativeGroupQuads && + publicType.shaderQualifiers.layoutDerivativeGroupLinear) { + error(loc, "cannot be both specified", "derivative_group_quadsNV and derivative_group_linearNV", ""); + } + + if (publicType.shaderQualifiers.layoutDerivativeGroupQuads) { + if (publicType.qualifier.storage == EvqVaryingIn) { + if ((intermediate.getLocalSize(0) & 1) || + (intermediate.getLocalSize(1) & 1)) + error(loc, "requires local_size_x and local_size_y to be multiple of two", "derivative_group_quadsNV", ""); + else + intermediate.setLayoutDerivativeMode(LayoutDerivativeGroupQuads); + } + else + error(loc, "can only apply to 'in'", "derivative_group_quadsNV", ""); + } + if (publicType.shaderQualifiers.layoutDerivativeGroupLinear) { + if (publicType.qualifier.storage == EvqVaryingIn) { + if((intermediate.getLocalSize(0) * + intermediate.getLocalSize(1) * + intermediate.getLocalSize(2)) % 4 != 0) + error(loc, "requires total group size to be multiple of four", "derivative_group_linearNV", ""); + else + intermediate.setLayoutDerivativeMode(LayoutDerivativeGroupLinear); + } + else + error(loc, "can only apply to 'in'", "derivative_group_linearNV", ""); + } +#endif const TQualifier& qualifier = publicType.qualifier; if (qualifier.isAuxiliary() || @@ -6389,6 +7572,10 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con error(loc, "cannot declare a default, can only be used on a block", "push_constant", ""); if (qualifier.hasSpecConstantId()) error(loc, "cannot declare a default, can only be used on a scalar", "constant_id", ""); +#ifdef NV_EXTENSIONS + if (qualifier.layoutShaderRecordNV) + error(loc, "cannot declare a default, can only be used on a block", "shaderRecordNV", ""); +#endif } // diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h index 0d929789345..14421a267b8 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h @@ -44,13 +44,15 @@ #ifndef _PARSER_HELPER_INCLUDED_ #define _PARSER_HELPER_INCLUDED_ +#include +#include + #include "parseVersions.h" #include "../Include/ShHandle.h" #include "SymbolTable.h" #include "localintermediate.h" #include "Scan.h" -#include -#include +#include "attribute.h" namespace glslang { @@ -185,7 +187,7 @@ protected: TParseContextBase& operator=(TParseContextBase&); const bool parsingBuiltins; // true if parsing built-in symbols/functions - TVector linkageSymbols; // these need to be transferred to 'linkage', after all editing is done + TVector linkageSymbols; // will be transferred to 'linkage', after all editing is done, order preserving TScanContext* scanContext; TPpContext* ppContext; TBuiltInResource resources; @@ -296,8 +298,8 @@ public: void fixIoArraySize(const TSourceLoc&, TType&); void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); - void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false); - int getIoArrayImplicitSize() const; + void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false, bool isPerPrimitive = false); + int getIoArrayImplicitSize(bool isPerPrimitive = false) const; void checkIoArrayConsistency(const TSourceLoc&, int requiredSize, const char* feature, TType&, const TString&); TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right); @@ -307,7 +309,7 @@ public: TFunction* handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&); TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*); - TIntermTyped* handleBuiltInFunctionCall(TSourceLoc, TIntermNode& arguments, const TFunction& function); + TIntermTyped* handleBuiltInFunctionCall(TSourceLoc, TIntermNode* arguments, const TFunction& function); void computeBuiltinPrecisions(TIntermTyped&, const TFunction&); TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*); void checkLocation(const TSourceLoc&, TOperator); @@ -321,6 +323,7 @@ public: TFunction* handleConstructorCall(const TSourceLoc&, const TPublicType&); void handlePrecisionQualifier(const TSourceLoc&, TQualifier&, TPrecisionQualifier); void checkPrecisionQualifier(const TSourceLoc&, TPrecisionQualifier); + void memorySemanticsCheck(const TSourceLoc&, const TFunction&, const TIntermOperator& callNode); void assignError(const TSourceLoc&, const char* op, TString left, TString right); void unaryOpError(const TSourceLoc&, const char* op, TString operand); @@ -338,17 +341,16 @@ public: bool arrayError(const TSourceLoc&, const TType&); void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); void structArrayCheck(const TSourceLoc&, const TType& structure); - void arraySizesCheck(const TSourceLoc&, const TQualifier&, TArraySizes*, bool initializer, bool lastMember); - void arrayOfArrayVersionCheck(const TSourceLoc&); - void arrayDimCheck(const TSourceLoc&, const TArraySizes* sizes1, const TArraySizes* sizes2); - void arrayDimCheck(const TSourceLoc&, const TType*, const TArraySizes*); - void arrayDimMerge(TType& type, const TArraySizes* sizes); + void arraySizesCheck(const TSourceLoc&, const TQualifier&, TArraySizes*, const TIntermTyped* initializer, bool lastMember); + void arrayOfArrayVersionCheck(const TSourceLoc&, const TArraySizes*); bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); void boolCheck(const TSourceLoc&, const TIntermTyped*); void boolCheck(const TSourceLoc&, const TPublicType&); void samplerCheck(const TSourceLoc&, const TType&, const TString& identifier, TIntermTyped* initializer); void atomicUintCheck(const TSourceLoc&, const TType&, const TString& identifier); + void accStructNVCheck(const TSourceLoc & loc, const TType & type, const TString & identifier); void transparentOpaqueCheck(const TSourceLoc&, const TType&, const TString& identifier); + void memberQualifierCheck(glslang::TPublicType&); void globalQualifierFixCheck(const TSourceLoc&, TQualifier&); void globalQualifierTypeCheck(const TSourceLoc&, const TQualifier&, const TPublicType&); bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); @@ -361,12 +363,13 @@ public: bool containsFieldWithBasicType(const TType& type ,TBasicType basicType); TSymbol* redeclareBuiltinVariable(const TSourceLoc&, const TString&, const TQualifier&, const TShaderQualifiers&); void redeclareBuiltinBlock(const TSourceLoc&, TTypeList& typeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes); - void paramCheckFix(const TSourceLoc&, const TStorageQualifier&, TType& type); + void paramCheckFixStorage(const TSourceLoc&, const TStorageQualifier&, TType& type); void paramCheckFix(const TSourceLoc&, const TQualifier&, TType& type); void nestedBlockCheck(const TSourceLoc&); void nestedStructCheck(const TSourceLoc&); void arrayObjectCheck(const TSourceLoc&, const TType&, const char* op); void opaqueCheck(const TSourceLoc&, const TType&, const char* op); + void storage16BitAssignmentCheck(const TSourceLoc&, const TType&, const char* op); void specializationCheck(const TSourceLoc&, const TType&, const char* op); void structTypeCheck(const TSourceLoc&, TPublicType&); void inductiveLoopCheck(const TSourceLoc&, TIntermNode* init, TIntermLoop* loop); @@ -390,6 +393,7 @@ public: const TFunction* findFunctionExact(const TSourceLoc& loc, const TFunction& call, bool& builtIn); const TFunction* findFunction120(const TSourceLoc& loc, const TFunction& call, bool& builtIn); const TFunction* findFunction400(const TSourceLoc& loc, const TFunction& call, bool& builtIn); + const TFunction* findFunctionExplicitTypes(const TSourceLoc& loc, const TFunction& call, bool& builtIn); void declareTypeDefaults(const TSourceLoc&, const TPublicType&); TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, const TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); TIntermTyped* addConstructor(const TSourceLoc&, TIntermNode*, const TType&); @@ -399,7 +403,7 @@ public: void blockStageIoCheck(const TSourceLoc&, const TQualifier&); void blockQualifierCheck(const TSourceLoc&, const TQualifier&, bool instanceName); void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); - void fixBlockXfbOffsets(TQualifier&, TTypeList&); + void fixXfbOffsets(TQualifier&, TTypeList&); void fixBlockUniformOffsets(TQualifier&, TTypeList&); void addQualifierToExisting(const TSourceLoc&, TQualifier, const TString& identifier); void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&); @@ -408,7 +412,19 @@ public: void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body); - void updateImplicitArraySize(const TSourceLoc&, TIntermNode*, int index); + TAttributeType attributeFromName(const TString& name) const; + TAttributes* makeAttributes(const TString& identifier) const; + TAttributes* makeAttributes(const TString& identifier, TIntermNode* node) const; + TAttributes* mergeAttributes(TAttributes*, TAttributes*) const; + + // Determine selection control from attributes + void handleSelectionAttributes(const TAttributes& attributes, TIntermNode*); + void handleSwitchAttributes(const TAttributes& attributes, TIntermNode*); + + // Determine loop control from attributes + void handleLoopAttributes(const TAttributes& attributes, TIntermNode*); + + void resizeMeshViewDimension(const TSourceLoc&, TType&); protected: void nonInitConstCheck(const TSourceLoc&, TString& identifier, TType& type); @@ -416,6 +432,8 @@ protected: TVariable* makeInternalVariable(const char* name, const TType&) const; TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&); void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&); + void checkRuntimeSizable(const TSourceLoc&, const TIntermTyped&); + bool isRuntimeLength(const TIntermTyped&) const; TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable); TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer); void finish() override; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp index 68d1500b4ad..4d2db385704 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Scan.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -45,6 +46,7 @@ #include "../Include/Types.h" #include "SymbolTable.h" #include "ParseHelper.h" +#include "attribute.h" #include "glslang_tab.cpp.h" #include "ScanContext.h" #include "Scan.h" @@ -339,6 +341,7 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["const"] = CONST; (*KeywordMap)["uniform"] = UNIFORM; + (*KeywordMap)["nonuniformEXT"] = NONUNIFORM; (*KeywordMap)["in"] = IN; (*KeywordMap)["out"] = OUT; (*KeywordMap)["inout"] = INOUT; @@ -377,6 +380,11 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["varying"] = VARYING; (*KeywordMap)["buffer"] = BUFFER; (*KeywordMap)["coherent"] = COHERENT; + (*KeywordMap)["devicecoherent"] = DEVICECOHERENT; + (*KeywordMap)["queuefamilycoherent"] = QUEUEFAMILYCOHERENT; + (*KeywordMap)["workgroupcoherent"] = WORKGROUPCOHERENT; + (*KeywordMap)["subgroupcoherent"] = SUBGROUPCOHERENT; + (*KeywordMap)["nonprivate"] = NONPRIVATE; (*KeywordMap)["restrict"] = RESTRICT; (*KeywordMap)["readonly"] = READONLY; (*KeywordMap)["writeonly"] = WRITEONLY; @@ -463,16 +471,34 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["u64vec3"] = U64VEC3; (*KeywordMap)["u64vec4"] = U64VEC4; -#ifdef AMD_EXTENSIONS + // GL_KHX_shader_explicit_arithmetic_types + (*KeywordMap)["int8_t"] = INT8_T; + (*KeywordMap)["i8vec2"] = I8VEC2; + (*KeywordMap)["i8vec3"] = I8VEC3; + (*KeywordMap)["i8vec4"] = I8VEC4; + (*KeywordMap)["uint8_t"] = UINT8_T; + (*KeywordMap)["u8vec2"] = U8VEC2; + (*KeywordMap)["u8vec3"] = U8VEC3; + (*KeywordMap)["u8vec4"] = U8VEC4; + (*KeywordMap)["int16_t"] = INT16_T; - (*KeywordMap)["uint16_t"] = UINT16_T; (*KeywordMap)["i16vec2"] = I16VEC2; (*KeywordMap)["i16vec3"] = I16VEC3; (*KeywordMap)["i16vec4"] = I16VEC4; + (*KeywordMap)["uint16_t"] = UINT16_T; (*KeywordMap)["u16vec2"] = U16VEC2; (*KeywordMap)["u16vec3"] = U16VEC3; (*KeywordMap)["u16vec4"] = U16VEC4; + (*KeywordMap)["int32_t"] = INT32_T; + (*KeywordMap)["i32vec2"] = I32VEC2; + (*KeywordMap)["i32vec3"] = I32VEC3; + (*KeywordMap)["i32vec4"] = I32VEC4; + (*KeywordMap)["uint32_t"] = UINT32_T; + (*KeywordMap)["u32vec2"] = U32VEC2; + (*KeywordMap)["u32vec3"] = U32VEC3; + (*KeywordMap)["u32vec4"] = U32VEC4; + (*KeywordMap)["float16_t"] = FLOAT16_T; (*KeywordMap)["f16vec2"] = F16VEC2; (*KeywordMap)["f16vec3"] = F16VEC3; @@ -489,7 +515,39 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["f16mat4x2"] = F16MAT4X2; (*KeywordMap)["f16mat4x3"] = F16MAT4X3; (*KeywordMap)["f16mat4x4"] = F16MAT4X4; -#endif + + (*KeywordMap)["float32_t"] = FLOAT32_T; + (*KeywordMap)["f32vec2"] = F32VEC2; + (*KeywordMap)["f32vec3"] = F32VEC3; + (*KeywordMap)["f32vec4"] = F32VEC4; + (*KeywordMap)["f32mat2"] = F32MAT2; + (*KeywordMap)["f32mat3"] = F32MAT3; + (*KeywordMap)["f32mat4"] = F32MAT4; + (*KeywordMap)["f32mat2x2"] = F32MAT2X2; + (*KeywordMap)["f32mat2x3"] = F32MAT2X3; + (*KeywordMap)["f32mat2x4"] = F32MAT2X4; + (*KeywordMap)["f32mat3x2"] = F32MAT3X2; + (*KeywordMap)["f32mat3x3"] = F32MAT3X3; + (*KeywordMap)["f32mat3x4"] = F32MAT3X4; + (*KeywordMap)["f32mat4x2"] = F32MAT4X2; + (*KeywordMap)["f32mat4x3"] = F32MAT4X3; + (*KeywordMap)["f32mat4x4"] = F32MAT4X4; + (*KeywordMap)["float64_t"] = FLOAT64_T; + (*KeywordMap)["f64vec2"] = F64VEC2; + (*KeywordMap)["f64vec3"] = F64VEC3; + (*KeywordMap)["f64vec4"] = F64VEC4; + (*KeywordMap)["f64mat2"] = F64MAT2; + (*KeywordMap)["f64mat3"] = F64MAT3; + (*KeywordMap)["f64mat4"] = F64MAT4; + (*KeywordMap)["f64mat2x2"] = F64MAT2X2; + (*KeywordMap)["f64mat2x3"] = F64MAT2X3; + (*KeywordMap)["f64mat2x4"] = F64MAT2X4; + (*KeywordMap)["f64mat3x2"] = F64MAT3X2; + (*KeywordMap)["f64mat3x3"] = F64MAT3X3; + (*KeywordMap)["f64mat3x4"] = F64MAT3X4; + (*KeywordMap)["f64mat4x2"] = F64MAT4X2; + (*KeywordMap)["f64mat4x3"] = F64MAT4X3; + (*KeywordMap)["f64mat4x4"] = F64MAT4X4; (*KeywordMap)["sampler2D"] = SAMPLER2D; (*KeywordMap)["samplerCube"] = SAMPLERCUBE; @@ -578,19 +636,82 @@ void TScanContext::fillInKeywordMap() (*KeywordMap)["usubpassInput"] = USUBPASSINPUT; (*KeywordMap)["usubpassInputMS"] = USUBPASSINPUTMS; +#ifdef AMD_EXTENSIONS + (*KeywordMap)["f16sampler1D"] = F16SAMPLER1D; + (*KeywordMap)["f16sampler2D"] = F16SAMPLER2D; + (*KeywordMap)["f16sampler3D"] = F16SAMPLER3D; + (*KeywordMap)["f16sampler2DRect"] = F16SAMPLER2DRECT; + (*KeywordMap)["f16samplerCube"] = F16SAMPLERCUBE; + (*KeywordMap)["f16sampler1DArray"] = F16SAMPLER1DARRAY; + (*KeywordMap)["f16sampler2DArray"] = F16SAMPLER2DARRAY; + (*KeywordMap)["f16samplerCubeArray"] = F16SAMPLERCUBEARRAY; + (*KeywordMap)["f16samplerBuffer"] = F16SAMPLERBUFFER; + (*KeywordMap)["f16sampler2DMS"] = F16SAMPLER2DMS; + (*KeywordMap)["f16sampler2DMSArray"] = F16SAMPLER2DMSARRAY; + (*KeywordMap)["f16sampler1DShadow"] = F16SAMPLER1DSHADOW; + (*KeywordMap)["f16sampler2DShadow"] = F16SAMPLER2DSHADOW; + (*KeywordMap)["f16sampler2DRectShadow"] = F16SAMPLER2DRECTSHADOW; + (*KeywordMap)["f16samplerCubeShadow"] = F16SAMPLERCUBESHADOW; + (*KeywordMap)["f16sampler1DArrayShadow"] = F16SAMPLER1DARRAYSHADOW; + (*KeywordMap)["f16sampler2DArrayShadow"] = F16SAMPLER2DARRAYSHADOW; + (*KeywordMap)["f16samplerCubeArrayShadow"] = F16SAMPLERCUBEARRAYSHADOW; + + (*KeywordMap)["f16image1D"] = F16IMAGE1D; + (*KeywordMap)["f16image2D"] = F16IMAGE2D; + (*KeywordMap)["f16image3D"] = F16IMAGE3D; + (*KeywordMap)["f16image2DRect"] = F16IMAGE2DRECT; + (*KeywordMap)["f16imageCube"] = F16IMAGECUBE; + (*KeywordMap)["f16image1DArray"] = F16IMAGE1DARRAY; + (*KeywordMap)["f16image2DArray"] = F16IMAGE2DARRAY; + (*KeywordMap)["f16imageCubeArray"] = F16IMAGECUBEARRAY; + (*KeywordMap)["f16imageBuffer"] = F16IMAGEBUFFER; + (*KeywordMap)["f16image2DMS"] = F16IMAGE2DMS; + (*KeywordMap)["f16image2DMSArray"] = F16IMAGE2DMSARRAY; + + (*KeywordMap)["f16texture1D"] = F16TEXTURE1D; + (*KeywordMap)["f16texture2D"] = F16TEXTURE2D; + (*KeywordMap)["f16texture3D"] = F16TEXTURE3D; + (*KeywordMap)["f16texture2DRect"] = F16TEXTURE2DRECT; + (*KeywordMap)["f16textureCube"] = F16TEXTURECUBE; + (*KeywordMap)["f16texture1DArray"] = F16TEXTURE1DARRAY; + (*KeywordMap)["f16texture2DArray"] = F16TEXTURE2DARRAY; + (*KeywordMap)["f16textureCubeArray"] = F16TEXTURECUBEARRAY; + (*KeywordMap)["f16textureBuffer"] = F16TEXTUREBUFFER; + (*KeywordMap)["f16texture2DMS"] = F16TEXTURE2DMS; + (*KeywordMap)["f16texture2DMSArray"] = F16TEXTURE2DMSARRAY; + + (*KeywordMap)["f16subpassInput"] = F16SUBPASSINPUT; + (*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS; +#endif + (*KeywordMap)["noperspective"] = NOPERSPECTIVE; (*KeywordMap)["smooth"] = SMOOTH; (*KeywordMap)["flat"] = FLAT; #ifdef AMD_EXTENSIONS - (*KeywordMap)["__explicitInterpAMD"] = __EXPLICITINTERPAMD; + (*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD; #endif (*KeywordMap)["centroid"] = CENTROID; +#ifdef NV_EXTENSIONS + (*KeywordMap)["pervertexNV"] = PERVERTEXNV; +#endif (*KeywordMap)["precise"] = PRECISE; (*KeywordMap)["invariant"] = INVARIANT; (*KeywordMap)["packed"] = PACKED; (*KeywordMap)["resource"] = RESOURCE; (*KeywordMap)["superp"] = SUPERP; +#ifdef NV_EXTENSIONS + (*KeywordMap)["rayPayloadNV"] = PAYLOADNV; + (*KeywordMap)["rayPayloadInNV"] = PAYLOADINNV; + (*KeywordMap)["hitAttributeNV"] = HITATTRNV; + (*KeywordMap)["callableDataNV"] = CALLDATANV; + (*KeywordMap)["callableDataInNV"] = CALLDATAINNV; + (*KeywordMap)["accelerationStructureNV"] = ACCSTRUCTNV; + (*KeywordMap)["perprimitiveNV"] = PERPRIMITIVENV; + (*KeywordMap)["perviewNV"] = PERVIEWNV; + (*KeywordMap)["taskNV"] = PERTASKNV; +#endif + ReservedSet = new std::unordered_set; ReservedSet->insert("common"); @@ -677,7 +798,7 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) case '?': return QUESTION; case '[': return LEFT_BRACKET; case ']': return RIGHT_BRACKET; - case '{': return LEFT_BRACE; + case '{': afterStruct = false; return LEFT_BRACE; case '}': return RIGHT_BRACE; case '\\': parseContext.error(loc, "illegal use of escape character", "\\", ""); @@ -714,19 +835,15 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) parseContext.error(loc, "not supported", "::", ""); break; - case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; - case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; - case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; - case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; - case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; -#endif - case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; - case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; -#endif + case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; + case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; + case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; + case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; + case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; + case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; + case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; + case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; + case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; case PpAtomIdentifier: { int token = tokenizeIdentifier(); @@ -764,7 +881,6 @@ int TScanContext::tokenizeIdentifier() case IN: case OUT: case INOUT: - case STRUCT: case BREAK: case CONTINUE: case DO: @@ -777,6 +893,16 @@ int TScanContext::tokenizeIdentifier() case CASE: return keyword; + case STRUCT: + afterStruct = true; + return keyword; + + case NONUNIFORM: + if (parseContext.extensionTurnedOn(E_GL_EXT_nonuniform_qualifier)) + return keyword; + else + return identifierOrType(); + case SWITCH: case DEFAULT: if ((parseContext.profile == EEsProfile && parseContext.version < 300) || @@ -824,6 +950,20 @@ int TScanContext::tokenizeIdentifier() return identifierOrType(); return keyword; +#ifdef NV_EXTENSIONS + case PAYLOADNV: + case PAYLOADINNV: + case HITATTRNV: + case CALLDATANV: + case CALLDATAINNV: + case ACCSTRUCTNV: + if (parseContext.symbolTable.atBuiltInLevel() || + (parseContext.profile != EEsProfile && parseContext.version >= 460 + && parseContext.extensionTurnedOn(E_GL_NV_ray_tracing))) + return keyword; + return identifierOrType(); +#endif + case ATOMIC_UINT: if ((parseContext.profile == EEsProfile && parseContext.version >= 310) || parseContext.extensionTurnedOn(E_GL_ARB_shader_atomic_counters)) @@ -831,6 +971,11 @@ int TScanContext::tokenizeIdentifier() return es30ReservedFromGLSL(420); case COHERENT: + case DEVICECOHERENT: + case QUEUEFAMILYCOHERENT: + case WORKGROUPCOHERENT: + case SUBGROUPCOHERENT: + case NONPRIVATE: case RESTRICT: case READONLY: case WRITEONLY: @@ -841,7 +986,8 @@ int TScanContext::tokenizeIdentifier() case VOLATILE: if (parseContext.profile == EEsProfile && parseContext.version >= 310) return keyword; - if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) + if (! parseContext.symbolTable.atBuiltInLevel() && (parseContext.profile == EEsProfile || + (parseContext.version < 420 && ! parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store)))) reservedWord(); return keyword; @@ -865,7 +1011,7 @@ int TScanContext::tokenizeIdentifier() case PATCH: if (parseContext.symbolTable.atBuiltInLevel() || (parseContext.profile == EEsProfile && - (parseContext.version >= 320 || + (parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) || (parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) return keyword; @@ -985,12 +1131,30 @@ int TScanContext::tokenizeIdentifier() case U64VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) + (parseContext.profile != EEsProfile && parseContext.version >= 450 && + (parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int64)))) + return keyword; + return identifierOrType(); + + case INT8_T: + case UINT8_T: + case I8VEC2: + case I8VEC3: + case I8VEC4: + case U8VEC2: + case U8VEC3: + case U8VEC4: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + ((parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_EXT_shader_8bit_storage) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int8)) && + parseContext.profile != EEsProfile && parseContext.version >= 450)) return keyword; return identifierOrType(); -#ifdef AMD_EXTENSIONS case INT16_T: case UINT16_T: case I16VEC2: @@ -1001,15 +1165,97 @@ int TScanContext::tokenizeIdentifier() case U16VEC4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) && + (parseContext.profile != EEsProfile && parseContext.version >= 450 && + ( +#ifdef AMD_EXTENSIONS + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16) || +#endif + parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int16)))) + return keyword; + return identifierOrType(); + case INT32_T: + case UINT32_T: + case I32VEC2: + case I32VEC3: + case I32VEC4: + case U32VEC2: + case U32VEC3: + case U32VEC4: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + ((parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_int32)) && parseContext.profile != EEsProfile && parseContext.version >= 450)) return keyword; return identifierOrType(); + case FLOAT32_T: + case F32VEC2: + case F32VEC3: + case F32VEC4: + case F32MAT2: + case F32MAT3: + case F32MAT4: + case F32MAT2X2: + case F32MAT2X3: + case F32MAT2X4: + case F32MAT3X2: + case F32MAT3X3: + case F32MAT3X4: + case F32MAT4X2: + case F32MAT4X3: + case F32MAT4X4: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + ((parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float32)) && + parseContext.profile != EEsProfile && parseContext.version >= 450)) + return keyword; + return identifierOrType(); + + case FLOAT64_T: + case F64VEC2: + case F64VEC3: + case F64VEC4: + case F64MAT2: + case F64MAT3: + case F64MAT4: + case F64MAT2X2: + case F64MAT2X3: + case F64MAT2X4: + case F64MAT3X2: + case F64MAT3X3: + case F64MAT3X4: + case F64MAT4X2: + case F64MAT4X3: + case F64MAT4X4: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + ((parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float64)) && + parseContext.profile != EEsProfile && parseContext.version >= 450)) + return keyword; + return identifierOrType(); case FLOAT16_T: case F16VEC2: case F16VEC3: case F16VEC4: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + (parseContext.profile != EEsProfile && parseContext.version >= 450 && + ( +#ifdef AMD_EXTENSIONS + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || +#endif + parseContext.extensionTurnedOn(E_GL_EXT_shader_16bit_storage) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float16)))) + return keyword; + + return identifierOrType(); + case F16MAT2: case F16MAT3: case F16MAT4: @@ -1024,11 +1270,16 @@ int TScanContext::tokenizeIdentifier() case F16MAT4X4: afterType = true; if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) && - parseContext.profile != EEsProfile && parseContext.version >= 450)) - return keyword; - return identifierOrType(); + (parseContext.profile != EEsProfile && parseContext.version >= 450 && + ( +#ifdef AMD_EXTENSIONS + parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float) || #endif + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types) || + parseContext.extensionTurnedOn(E_GL_KHX_shader_explicit_arithmetic_types_float16)))) + return keyword; + + return identifierOrType(); case SAMPLERCUBEARRAY: case SAMPLERCUBEARRAYSHADOW: @@ -1115,7 +1366,7 @@ int TScanContext::tokenizeIdentifier() case SAMPLER3D: afterType = true; if (parseContext.profile == EEsProfile && parseContext.version < 300) { - if (! parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) + if (!parseContext.extensionTurnedOn(E_GL_OES_texture_3D)) reservedWord(); } return keyword; @@ -1193,7 +1444,7 @@ int TScanContext::tokenizeIdentifier() case TEXTURE1DARRAY: case SAMPLER: case SAMPLERSHADOW: - if (parseContext.spvVersion.vulkan >= 100) + if (parseContext.spvVersion.vulkan > 0) return keyword; else return identifierOrType(); @@ -1204,12 +1455,71 @@ int TScanContext::tokenizeIdentifier() case ISUBPASSINPUTMS: case USUBPASSINPUT: case USUBPASSINPUTMS: - if (parseContext.spvVersion.vulkan >= 100) + if (parseContext.spvVersion.vulkan > 0) return keyword; else return identifierOrType(); +#ifdef AMD_EXTENSIONS + case F16SAMPLER1D: + case F16SAMPLER2D: + case F16SAMPLER3D: + case F16SAMPLER2DRECT: + case F16SAMPLERCUBE: + case F16SAMPLER1DARRAY: + case F16SAMPLER2DARRAY: + case F16SAMPLERCUBEARRAY: + case F16SAMPLERBUFFER: + case F16SAMPLER2DMS: + case F16SAMPLER2DMSARRAY: + case F16SAMPLER1DSHADOW: + case F16SAMPLER2DSHADOW: + case F16SAMPLER1DARRAYSHADOW: + case F16SAMPLER2DARRAYSHADOW: + case F16SAMPLER2DRECTSHADOW: + case F16SAMPLERCUBESHADOW: + case F16SAMPLERCUBEARRAYSHADOW: + + case F16IMAGE1D: + case F16IMAGE2D: + case F16IMAGE3D: + case F16IMAGE2DRECT: + case F16IMAGECUBE: + case F16IMAGE1DARRAY: + case F16IMAGE2DARRAY: + case F16IMAGECUBEARRAY: + case F16IMAGEBUFFER: + case F16IMAGE2DMS: + case F16IMAGE2DMSARRAY: + + case F16TEXTURE1D: + case F16TEXTURE2D: + case F16TEXTURE3D: + case F16TEXTURE2DRECT: + case F16TEXTURECUBE: + case F16TEXTURE1DARRAY: + case F16TEXTURE2DARRAY: + case F16TEXTURECUBEARRAY: + case F16TEXTUREBUFFER: + case F16TEXTURE2DMS: + case F16TEXTURE2DMSARRAY: + + case F16SUBPASSINPUT: + case F16SUBPASSINPUTMS: + afterType = true; + if (parseContext.symbolTable.atBuiltInLevel() || + (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float_fetch) && + parseContext.profile != EEsProfile && parseContext.version >= 450)) + return keyword; + return identifierOrType(); +#endif + case NOPERSPECTIVE: +#ifdef NV_EXTENSIONS + if (parseContext.profile == EEsProfile && parseContext.version >= 300 && + parseContext.extensionTurnedOn(E_GL_NV_shader_noperspective_interpolation)) + return keyword; +#endif return es30ReservedFromGLSL(130); case SMOOTH: @@ -1219,13 +1529,22 @@ int TScanContext::tokenizeIdentifier() return keyword; #ifdef AMD_EXTENSIONS - case __EXPLICITINTERPAMD: + case EXPLICITINTERPAMD: if (parseContext.profile != EEsProfile && parseContext.version >= 450 && parseContext.extensionTurnedOn(E_GL_AMD_shader_explicit_vertex_parameter)) return keyword; return identifierOrType(); #endif +#ifdef NV_EXTENSIONS + case PERVERTEXNV: + if (((parseContext.profile != EEsProfile && parseContext.version >= 450) || + (parseContext.profile == EEsProfile && parseContext.version >= 320)) && + parseContext.extensionTurnedOn(E_GL_NV_fragment_shader_barycentric)) + return keyword; + return identifierOrType(); +#endif + case FLAT: if (parseContext.profile == EEsProfile && parseContext.version < 300) reservedWord(); @@ -1272,6 +1591,17 @@ int TScanContext::tokenizeIdentifier() return identifierOrReserved(reserved); } +#ifdef NV_EXTENSIONS + case PERPRIMITIVENV: + case PERVIEWNV: + case PERTASKNV: + if ((parseContext.profile != EEsProfile && parseContext.version >= 450) || + (parseContext.profile == EEsProfile && parseContext.version >= 320) || + parseContext.extensionTurnedOn(E_GL_NV_mesh_shader)) + return keyword; + return identifierOrType(); +#endif + default: parseContext.infoSink.info.message(EPrefixInternalError, "Unknown glslang keyword", loc); return 0; @@ -1285,7 +1615,7 @@ int TScanContext::identifierOrType() return IDENTIFIER; parserToken->sType.lex.symbol = parseContext.symbolTable.find(*parserToken->sType.lex.string); - if (afterType == false && parserToken->sType.lex.symbol) { + if ((afterType == false && afterStruct == false) && parserToken->sType.lex.symbol != nullptr) { if (const TVariable* variable = parserToken->sType.lex.symbol->getAsVariable()) { if (variable->isUserType()) { afterType = true; @@ -1403,7 +1733,8 @@ int TScanContext::dMat() int TScanContext::firstGenerationImage(bool inEs310) { if (parseContext.symbolTable.atBuiltInLevel() || - (parseContext.profile != EEsProfile && (parseContext.version >= 420 || parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) || + (parseContext.profile != EEsProfile && (parseContext.version >= 420 || + parseContext.extensionTurnedOn(E_GL_ARB_shader_image_load_store))) || (inEs310 && parseContext.profile == EEsProfile && parseContext.version >= 310)) return keyword; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ScanContext.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ScanContext.h index 608ae067e07..0cc7ea0a9eb 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ScanContext.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ScanContext.h @@ -50,7 +50,10 @@ class TParserToken; class TScanContext { public: - explicit TScanContext(TParseContextBase& pc) : parseContext(pc), afterType(false), field(false) { } + explicit TScanContext(TParseContextBase& pc) : + parseContext(pc), + afterType(false), afterStruct(false), + field(false) { } virtual ~TScanContext() { } static void fillInKeywordMap(); @@ -76,6 +79,7 @@ protected: TParseContextBase& parseContext; bool afterType; // true if we've recognized a type, so can only be looking for an identifier + bool afterStruct; // true if we've recognized the STRUCT keyword, so can only be looking for an identifier bool field; // true if we're on a field, right after a '.' TSourceLoc loc; TParserToken* parserToken; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index 62e079e5567..3c847d238f3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -67,6 +67,11 @@ #include "iomapper.h" #include "Initialize.h" +// TODO: this really shouldn't be here, it is only because of the trial addition +// of printing pre-processed tokens, which requires knowing the string literal +// token to print ", but none of that seems appropriate for this file. +#include "preprocessor/PpTokens.h" + namespace { // anonymous namespace for file-local functions and symbols // Total number of successful initializers of glslang: a refcount @@ -342,6 +347,36 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCompute, source, infoSink, commonTable, symbolTables); +#ifdef NV_EXTENSIONS + // check for ray tracing stages + if (profile != EEsProfile && version >= 450) { + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangRayGenNV, source, + infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangIntersectNV, source, + infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangAnyHitNV, source, + infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangClosestHitNV, source, + infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMissNV, source, + infoSink, commonTable, symbolTables); + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangCallableNV, source, + infoSink, commonTable, symbolTables); + } + + // check for mesh + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangMeshNV, source, + infoSink, commonTable, symbolTables); + + // check for task + if ((profile != EEsProfile && version >= 450) || + (profile == EEsProfile && version >= 320)) + InitializeStageSymbolTable(*builtInParseables, version, profile, spvVersion, EShLangTaskNV, source, + infoSink, commonTable, symbolTables); +#endif + return true; } @@ -565,6 +600,28 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo version = profile == EEsProfile ? 310 : 420; } break; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: + case EShLangIntersectNV: + case EShLangAnyHitNV: + case EShLangClosestHitNV: + case EShLangMissNV: + case EShLangCallableNV: + if (profile == EEsProfile || version < 460) { + correct = false; + infoSink.info.message(EPrefixError, "#version: ray tracing shaders require non-es profile with version 460 or above"); + version = 460; + } + break; + case EShLangMeshNV: + case EShLangTaskNV: + if ((profile == EEsProfile && version < 320) || + (profile != EEsProfile && version < 450)) { + correct = false; + infoSink.info.message(EPrefixError, "#version: mesh/task shaders require es profile with version 320 or above, or non-es profile with version 450 or above"); + version = profile == EEsProfile ? 320 : 450; + } +#endif default: break; } @@ -578,7 +635,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo if (spvVersion.spv != 0) { switch (profile) { case EEsProfile: - if (spvVersion.vulkan >= 100 && version < 310) { + if (spvVersion.vulkan > 0 && version < 310) { correct = false; infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); version = 310; @@ -593,7 +650,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile"); break; default: - if (spvVersion.vulkan >= 100 && version < 140) { + if (spvVersion.vulkan > 0 && version < 140) { correct = false; infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher"); version = 140; @@ -619,9 +676,9 @@ void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages { // Set up environmental defaults, first ignoring 'environment'. if (messages & EShMsgSpvRules) - spvVersion.spv = 0x00010000; + spvVersion.spv = EShTargetSpv_1_0; if (messages & EShMsgVulkanRules) { - spvVersion.vulkan = 100; + spvVersion.vulkan = EShTargetVulkan_1_0; spvVersion.vulkanGlsl = 100; } else if (spvVersion.spv != 0) spvVersion.openGl = 100; @@ -744,9 +801,9 @@ bool ProcessDeferred( const int numPre = 2; const int numPost = requireNonempty? 1 : 0; const int numTotal = numPre + numStrings + numPost; - size_t* lengths = new size_t[numTotal]; - const char** strings = new const char*[numTotal]; - const char** names = new const char*[numTotal]; + std::unique_ptr lengths(new size_t[numTotal]); + std::unique_ptr strings(new const char*[numTotal]); + std::unique_ptr names(new const char*[numTotal]); for (int s = 0; s < numStrings; ++s) { strings[s + numPre] = shaderStrings[s]; if (inputLengths == nullptr || inputLengths[s] < 0) @@ -768,6 +825,8 @@ bool ProcessDeferred( SpvVersion spvVersion; EShLanguage stage = compiler->getLanguage(); TranslateEnvironment(environment, messages, source, stage, spvVersion); + if (environment != nullptr && environment->target.hlslFunctionality1) + intermediate.setHlslFunctionality1(); // First, without using the preprocessor or parser, find the #version, so we know what // symbol tables, processing rules, etc. to set up. This does not need the extra strings @@ -814,7 +873,7 @@ bool ProcessDeferred( intermediate.setProfile(profile); intermediate.setSpv(spvVersion); RecordProcesses(intermediate, messages, sourceEntryPointName); - if (spvVersion.vulkan >= 100) + if (spvVersion.vulkan > 0) intermediate.setOriginUpperLeft(); if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) intermediate.setHlslOffsets(); @@ -832,25 +891,24 @@ bool ProcessDeferred( [stage]; // Dynamically allocate the symbol table so we can control when it is deallocated WRT the pool. - TSymbolTable* symbolTableMemory = new TSymbolTable; - TSymbolTable& symbolTable = *symbolTableMemory; + std::unique_ptr symbolTable(new TSymbolTable); if (cachedTable) - symbolTable.adoptLevels(*cachedTable); + symbolTable->adoptLevels(*cachedTable); // Add built-in symbols that are potentially context dependent; // they get popped again further down. - if (! AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spvVersion, - stage, source)) + if (! AddContextSpecificSymbols(resources, compiler->infoSink, *symbolTable, version, profile, spvVersion, + stage, source)) { return false; + } // // Now we can process the full shader under proper symbols and rules. // - TParseContextBase* parseContext = CreateParseContext(symbolTable, intermediate, version, profile, source, - stage, compiler->infoSink, - spvVersion, forwardCompatible, messages, false, sourceEntryPointName); - + std::unique_ptr parseContext(CreateParseContext(*symbolTable, intermediate, version, profile, source, + stage, compiler->infoSink, + spvVersion, forwardCompatible, messages, false, sourceEntryPointName)); TPpContext ppContext(*parseContext, names[numPre] ? names[numPre] : "", includer); // only GLSL (bison triggered, really) needs an externally set scan context @@ -886,23 +944,14 @@ bool ProcessDeferred( lengths[postIndex] = strlen(strings[numStrings + numPre]); names[postIndex] = nullptr; } - TInputScanner fullInput(numStrings + numPre + numPost, strings, lengths, names, numPre, numPost); + TInputScanner fullInput(numStrings + numPre + numPost, strings.get(), lengths.get(), names.get(), numPre, numPost); // Push a new symbol allocation scope that will get used for the shader's globals. - symbolTable.push(); + symbolTable->push(); bool success = processingContext(*parseContext, ppContext, fullInput, - versionWillBeError, symbolTable, + versionWillBeError, *symbolTable, intermediate, optLevel, messages); - - // Clean up the symbol table. The AST is self-sufficient now. - delete symbolTableMemory; - - delete parseContext; - delete [] lengths; - delete [] strings; - delete [] names; - return success; } @@ -912,7 +961,7 @@ bool ProcessDeferred( class SourceLineSynchronizer { public: SourceLineSynchronizer(const std::function& lastSourceIndex, - std::stringstream* output) + std::string* output) : getLastSourceIndex(lastSourceIndex), output(output), lastSource(-1), lastLine(0) {} // SourceLineSynchronizer(const SourceLineSynchronizer&) = delete; // SourceLineSynchronizer& operator=(const SourceLineSynchronizer&) = delete; @@ -927,7 +976,7 @@ public: // used. We also need to output a newline to separate the output // from the previous source string (if there is one). if (lastSource != -1 || lastLine != 0) - *output << std::endl; + *output += '\n'; lastSource = getLastSourceIndex(); lastLine = -1; return true; @@ -942,7 +991,7 @@ public: syncToMostRecentString(); const bool newLineStarted = lastLine < tokenLine; for (; lastLine < tokenLine; ++lastLine) { - if (lastLine > 0) *output << std::endl; + if (lastLine > 0) *output += '\n'; } return newLineStarted; } @@ -956,8 +1005,8 @@ private: // A function for getting the index of the last valid source string we've // read tokens from. const std::function getLastSourceIndex; - // output stream for newlines. - std::stringstream* output; + // output string for newlines. + std::string* output; // lastSource is the source string index (starting from 0) of the last token // processed. It is tracked in order for newlines to be inserted when a new // source string starts. -1 means we haven't started processing any source @@ -973,6 +1022,8 @@ private: // DoPreprocessing is a valid ProcessingContext template argument, // which only performs the preprocessing step of compilation. // It places the result in the "string" argument to its constructor. +// +// This is not an officially supported or fully working path. struct DoPreprocessing { explicit DoPreprocessing(std::string* string): outputString(string) {} bool operator()(TParseContextBase& parseContext, TPpContext& ppContext, @@ -988,27 +1039,33 @@ struct DoPreprocessing { parseContext.setScanner(&input); ppContext.setInput(input, versionWillBeError); - std::stringstream outputStream; + std::string outputBuffer; SourceLineSynchronizer lineSync( - std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputStream); + std::bind(&TInputScanner::getLastValidSourceIndex, &input), &outputBuffer); - parseContext.setExtensionCallback([&lineSync, &outputStream]( + parseContext.setExtensionCallback([&lineSync, &outputBuffer]( int line, const char* extension, const char* behavior) { lineSync.syncToLine(line); - outputStream << "#extension " << extension << " : " << behavior; + outputBuffer += "#extension "; + outputBuffer += extension; + outputBuffer += " : "; + outputBuffer += behavior; }); - parseContext.setLineCallback([&lineSync, &outputStream, &parseContext]( + parseContext.setLineCallback([&lineSync, &outputBuffer, &parseContext]( int curLineNum, int newLineNum, bool hasSource, int sourceNum, const char* sourceName) { // SourceNum is the number of the source-string that is being parsed. lineSync.syncToLine(curLineNum); - outputStream << "#line " << newLineNum; + outputBuffer += "#line "; + outputBuffer += std::to_string(newLineNum); if (hasSource) { - outputStream << " "; + outputBuffer += ' '; if (sourceName != nullptr) { - outputStream << "\"" << sourceName << "\""; + outputBuffer += '\"'; + outputBuffer += sourceName; + outputBuffer += '\"'; } else { - outputStream << sourceNum; + outputBuffer += std::to_string(sourceNum); } } if (parseContext.lineDirectiveShouldSetNextLine()) { @@ -1016,33 +1073,36 @@ struct DoPreprocessing { // directive. So the new line number for the current line is newLineNum -= 1; } - outputStream << std::endl; + outputBuffer += '\n'; // And we are at the next line of the #line directive now. lineSync.setLineNum(newLineNum + 1); }); parseContext.setVersionCallback( - [&lineSync, &outputStream](int line, int version, const char* str) { + [&lineSync, &outputBuffer](int line, int version, const char* str) { lineSync.syncToLine(line); - outputStream << "#version " << version; + outputBuffer += "#version "; + outputBuffer += std::to_string(version); if (str) { - outputStream << " " << str; + outputBuffer += ' '; + outputBuffer += str; } }); - parseContext.setPragmaCallback([&lineSync, &outputStream]( + parseContext.setPragmaCallback([&lineSync, &outputBuffer]( int line, const glslang::TVector& ops) { lineSync.syncToLine(line); - outputStream << "#pragma "; + outputBuffer += "#pragma "; for(size_t i = 0; i < ops.size(); ++i) { - outputStream << ops[i]; + outputBuffer += ops[i].c_str(); } }); - parseContext.setErrorCallback([&lineSync, &outputStream]( + parseContext.setErrorCallback([&lineSync, &outputBuffer]( int line, const char* errorMessage) { lineSync.syncToLine(line); - outputStream << "#error " << errorMessage; + outputBuffer += "#error "; + outputBuffer += errorMessage; }); int lastToken = EndOfInput; // lastToken records the last token processed. @@ -1058,7 +1118,7 @@ struct DoPreprocessing { // Don't emit whitespace onto empty lines. // Copy any whitespace characters at the start of a line // from the input to the output. - outputStream << std::string(ppToken.loc.column - 1, ' '); + outputBuffer += std::string(ppToken.loc.column - 1, ' '); } // Output a space in between tokens, but not at the start of a line, @@ -1068,13 +1128,17 @@ struct DoPreprocessing { (unNeededSpaceTokens.find((char)token) == std::string::npos) && (unNeededSpaceTokens.find((char)lastToken) == std::string::npos) && (noSpaceBeforeTokens.find((char)token) == std::string::npos)) { - outputStream << " "; + outputBuffer += ' '; } lastToken = token; - outputStream << ppToken.name; + if (token == PpAtomConstString) + outputBuffer += "\""; + outputBuffer += ppToken.name; + if (token == PpAtomConstString) + outputBuffer += "\""; } while (true); - outputStream << std::endl; - *outputString = outputStream.str(); + outputBuffer += '\n'; + *outputString = std::move(outputBuffer); bool success = true; if (parseContext.getNumErrors() > 0) { @@ -1121,6 +1185,9 @@ struct DoFullParse{ // Return: True if there were no issues found in preprocessing, // False if during preprocessing any unknown version, pragmas or // extensions were found. +// +// NOTE: Doing just preprocessing to obtain a correct preprocessed shader string +// is not an officially supported or fully working path. bool PreprocessDeferred( TCompiler* compiler, const char* const shaderStrings[], @@ -1568,14 +1635,17 @@ namespace glslang { #include "../Include/revision.h" +#define QUOTE(s) #s +#define STR(n) QUOTE(n) + const char* GetEsslVersionString() { - return "OpenGL ES GLSL 3.20 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE; + return "OpenGL ES GLSL 3.20 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL); } const char* GetGlslVersionString() { - return "4.60 glslang Khronos." GLSLANG_REVISION " " GLSLANG_DATE; + return "4.60 glslang Khronos. " STR(GLSLANG_MINOR_VERSION) "." STR(GLSLANG_PATCH_LEVEL); } int GetKhronosToolId() @@ -1612,6 +1682,7 @@ TShader::TShader(EShLanguage s) environment.input.dialect = EShClientNone; environment.client.client = EShClientNone; environment.target.language = EShTargetNone; + environment.target.hlslFunctionality1 = false; } TShader::~TShader() @@ -1686,8 +1757,18 @@ void TShader::setShiftUavBinding(unsigned int base) { setShiftBinding(EResUa void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSsbo, base); } // Enables binding automapping using TIoMapper void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); } +// Enables position.Y output negation in vertex shader +void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); } // Fragile: currently within one stage: simple auto-assignment of location void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); } +void TShader::addUniformLocationOverride(const char* name, int loc) +{ + intermediate->addUniformLocationOverride(name, loc); +} +void TShader::setUniformLocationBase(int base) +{ + intermediate->setUniformLocationBase(base); +} // See comment above TDefaultHlslIoMapper in iomapper.cpp: void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); } void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); } @@ -1719,6 +1800,9 @@ bool TShader::parse(const TBuiltInResource* builtInResources, int defaultVersion // Fill in a string with the result of preprocessing ShaderStrings // Returns true if all extensions, pragmas and version strings were valid. +// +// NOTE: Doing just preprocessing to obtain a correct preprocessed shader string +// is not an officially supported or fully working path. bool TShader::preprocess(const TBuiltInResource* builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, @@ -1903,6 +1987,8 @@ const char* TProgram::getUniformBlockName(int index) const { return reflection int TProgram::getUniformBlockSize(int index) const { return reflection->getUniformBlock(index).size; } int TProgram::getUniformIndex(const char* name) const { return reflection->getIndex(name); } int TProgram::getUniformBinding(int index) const { return reflection->getUniform(index).getBinding(); } +EShLanguageMask TProgram::getUniformStages(int index) const { return reflection->getUniform(index).stages; } +int TProgram::getUniformBlockBinding(int index) const { return reflection->getUniformBlock(index).getBinding(); } int TProgram::getUniformBlockIndex(int index) const { return reflection->getUniform(index).index; } int TProgram::getUniformBlockCounterIndex(int index) const { return reflection->getUniformBlock(index).counterIndex; } int TProgram::getUniformType(int index) const { return reflection->getUniform(index).glDefineType; } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp index 233033e7846..bd7d5aa069f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -60,21 +61,25 @@ void TType::buildMangledName(TString& mangledName) const switch (basicType) { case EbtFloat: mangledName += 'f'; break; case EbtDouble: mangledName += 'd'; break; -#ifdef AMD_EXTENSIONS case EbtFloat16: mangledName += "f16"; break; -#endif case EbtInt: mangledName += 'i'; break; case EbtUint: mangledName += 'u'; break; - case EbtInt64: mangledName += "i64"; break; - case EbtUint64: mangledName += "u64"; break; -#ifdef AMD_EXTENSIONS + case EbtInt8: mangledName += "i8"; break; + case EbtUint8: mangledName += "u8"; break; case EbtInt16: mangledName += "i16"; break; case EbtUint16: mangledName += "u16"; break; -#endif + case EbtInt64: mangledName += "i64"; break; + case EbtUint64: mangledName += "u64"; break; case EbtBool: mangledName += 'b'; break; case EbtAtomicUint: mangledName += "au"; break; +#ifdef NV_EXTENSIONS + case EbtAccStructNV: mangledName += "asnv"; break; +#endif case EbtSampler: switch (sampler.type) { +#ifdef AMD_EXTENSIONS + case EbtFloat16: mangledName += "f16"; break; +#endif case EbtInt: mangledName += "i"; break; case EbtUint: mangledName += "u"; break; default: break; // some compilers want this diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp index b1893b37ea0..16265a30d6c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -185,9 +186,29 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_ARB_post_depth_coverage] = EBhDisable; extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_arithmetic] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_ballot] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_shuffle] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_shuffle_relative] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_clustered] = EBhDisable; + extensionBehavior[E_GL_KHR_shader_subgroup_quad] = EBhDisable; + extensionBehavior[E_GL_KHR_memory_scope_semantics] = EBhDisable; + + extensionBehavior[E_GL_EXT_shader_atomic_int64] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_non_constant_global_initializers] = EBhDisable; extensionBehavior[E_GL_EXT_shader_image_load_formatted] = EBhDisable; extensionBehavior[E_GL_EXT_post_depth_coverage] = EBhDisable; + extensionBehavior[E_GL_EXT_control_flow_attributes] = EBhDisable; + extensionBehavior[E_GL_EXT_nonuniform_qualifier] = EBhDisable; + extensionBehavior[E_GL_EXT_samplerless_texture_functions] = EBhDisable; + extensionBehavior[E_GL_EXT_scalar_block_layout] = EBhDisable; + extensionBehavior[E_GL_EXT_fragment_invocation_density] = EBhDisable; + + extensionBehavior[E_GL_EXT_shader_16bit_storage] = EBhDisable; + extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable; // #line and #include extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable; @@ -203,6 +224,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_AMD_gpu_shader_int16] = EBhDisable; extensionBehavior[E_GL_AMD_shader_image_load_store_lod] = EBhDisable; extensionBehavior[E_GL_AMD_shader_fragment_mask] = EBhDisable; + extensionBehavior[E_GL_AMD_gpu_shader_half_float_fetch] = EBhDisable; #endif #ifdef NV_EXTENSIONS @@ -212,6 +234,15 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_stereo_view_rendering] = EBhDisable; extensionBehavior[E_GL_NVX_multiview_per_view_attributes] = EBhDisable; extensionBehavior[E_GL_NV_shader_atomic_int64] = EBhDisable; + extensionBehavior[E_GL_NV_conservative_raster_underestimation] = EBhDisable; + extensionBehavior[E_GL_NV_shader_noperspective_interpolation] = EBhDisable; + extensionBehavior[E_GL_NV_shader_subgroup_partitioned] = EBhDisable; + extensionBehavior[E_GL_NV_shading_rate_image] = EBhDisable; + extensionBehavior[E_GL_NV_ray_tracing] = EBhDisable; + extensionBehavior[E_GL_NV_fragment_shader_barycentric] = EBhDisable; + extensionBehavior[E_GL_NV_compute_shader_derivatives] = EBhDisable; + extensionBehavior[E_GL_NV_shader_texture_footprint] = EBhDisable; + extensionBehavior[E_GL_NV_mesh_shader] = EBhDisable; #endif // AEP @@ -249,6 +280,16 @@ void TParseVersions::initializeExtensionBehavior() // OVR extensions extensionBehavior[E_GL_OVR_multiview] = EBhDisable; extensionBehavior[E_GL_OVR_multiview2] = EBhDisable; + + // explicit types + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_int8] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_int16] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_int32] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_int64] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_float16] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_float32] = EBhDisable; + extensionBehavior[E_GL_KHX_shader_explicit_arithmetic_types_float64] = EBhDisable; } // Get code that is not part of a shared symbol table, is specific to this shader, @@ -296,6 +337,13 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_OES_texture_cube_map_array 1\n" "#define GL_EXT_shader_non_constant_global_initializers 1\n" ; + +#ifdef NV_EXTENSIONS + if (profile == EEsProfile && version >= 300) { + preamble += "#define GL_NV_shader_noperspective_interpolation 1\n"; + } +#endif + } else { preamble = "#define GL_FRAGMENT_PRECISION_HIGH 1\n" @@ -327,6 +375,25 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_EXT_shader_non_constant_global_initializers 1\n" "#define GL_EXT_shader_image_load_formatted 1\n" "#define GL_EXT_post_depth_coverage 1\n" + "#define GL_EXT_control_flow_attributes 1\n" + "#define GL_EXT_nonuniform_qualifier 1\n" + "#define GL_EXT_shader_16bit_storage 1\n" + "#define GL_EXT_shader_8bit_storage 1\n" + "#define GL_EXT_samplerless_texture_functions 1\n" + "#define GL_EXT_scalar_block_layout 1\n" + "#define GL_EXT_fragment_invocation_density 1\n" + + // GL_KHR_shader_subgroup + "#define GL_KHR_shader_subgroup_basic 1\n" + "#define GL_KHR_shader_subgroup_vote 1\n" + "#define GL_KHR_shader_subgroup_arithmetic 1\n" + "#define GL_KHR_shader_subgroup_ballot 1\n" + "#define GL_KHR_shader_subgroup_shuffle 1\n" + "#define GL_KHR_shader_subgroup_shuffle_relative 1\n" + "#define GL_KHR_shader_subgroup_clustered 1\n" + "#define GL_KHR_shader_subgroup_quad 1\n" + + "#define E_GL_EXT_shader_atomic_int64 1\n" #ifdef AMD_EXTENSIONS "#define GL_AMD_shader_ballot 1\n" @@ -338,6 +405,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_AMD_gpu_shader_int16 1\n" "#define GL_AMD_shader_image_load_store_lod 1\n" "#define GL_AMD_shader_fragment_mask 1\n" + "#define GL_AMD_gpu_shader_half_float_fetch 1\n" #endif #ifdef NV_EXTENSIONS @@ -345,7 +413,23 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_geometry_shader_passthrough 1\n" "#define GL_NV_viewport_array2 1\n" "#define GL_NV_shader_atomic_int64 1\n" + "#define GL_NV_conservative_raster_underestimation 1\n" + "#define GL_NV_shader_subgroup_partitioned 1\n" + "#define GL_NV_shading_rate_image 1\n" + "#define GL_NV_ray_tracing 1\n" + "#define GL_NV_fragment_shader_barycentric 1\n" + "#define GL_NV_compute_shader_derivatives 1\n" + "#define GL_NV_shader_texture_footprint 1\n" + "#define GL_NV_mesh_shader 1\n" #endif + "#define GL_KHX_shader_explicit_arithmetic_types 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_int8 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_int16 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_int32 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_int64 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_float16 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_float32 1\n" + "#define GL_KHX_shader_explicit_arithmetic_types_float64 1\n" ; if (version >= 150) { @@ -424,6 +508,16 @@ const char* StageName(EShLanguage stage) case EShLangGeometry: return "geometry"; case EShLangFragment: return "fragment"; case EShLangCompute: return "compute"; +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: return "ray-generation"; + case EShLangIntersectNV: return "intersection"; + case EShLangAnyHitNV: return "any-hit"; + case EShLangClosestHitNV: return "closest-hit"; + case EShLangMissNV: return "miss"; + case EShLangCallableNV: return "callable"; + case EShLangMeshNV: return "mesh"; + case EShLangTaskNV: return "task"; +#endif default: return "unknown stage"; } } @@ -568,7 +662,8 @@ bool TParseVersions::checkExtensionsRequested(const TSourceLoc& loc, int numExte // void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) { - if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return; + if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) + return; // If we get this far, give errors explaining what extensions are needed if (numExtensions == 1) @@ -586,7 +681,8 @@ void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, // void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtensions, const char* const extensions[], const char* featureDesc) { - if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) return; + if (checkExtensionsRequested(loc, numExtensions, extensions, featureDesc)) + return; // If we get this far, give errors explaining what extensions are needed if (numExtensions == 1) @@ -624,7 +720,8 @@ bool TParseVersions::extensionTurnedOn(const char* const extension) bool TParseVersions::extensionsTurnedOn(int numExtensions, const char* const extensions[]) { for (int i = 0; i < numExtensions; ++i) { - if (extensionTurnedOn(extensions[i])) return true; + if (extensionTurnedOn(extensions[i])) + return true; } return false; } @@ -649,6 +746,9 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co return; } + // check if extension is used with correct shader stage + checkExtensionStage(getCurrentLoc(), extension); + // update the requested extension updateExtensionBehavior(extension, behavior); @@ -680,6 +780,25 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co updateExtensionBehavior(line, "GL_OES_shader_io_blocks", behaviorString); else if (strcmp(extension, "GL_GOOGLE_include_directive") == 0) updateExtensionBehavior(line, "GL_GOOGLE_cpp_style_line_directive", behaviorString); + // subgroup_* to subgroup_basic + else if (strcmp(extension, "GL_KHR_shader_subgroup_vote") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); + else if (strcmp(extension, "GL_KHR_shader_subgroup_arithmetic") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); + else if (strcmp(extension, "GL_KHR_shader_subgroup_ballot") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); + else if (strcmp(extension, "GL_KHR_shader_subgroup_shuffle") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); + else if (strcmp(extension, "GL_KHR_shader_subgroup_shuffle_relative") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); + else if (strcmp(extension, "GL_KHR_shader_subgroup_clustered") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); + else if (strcmp(extension, "GL_KHR_shader_subgroup_quad") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); +#ifdef NV_EXTENSIONS + else if (strcmp(extension, "GL_NV_shader_subgroup_partitioned") == 0) + updateExtensionBehavior(line, "GL_KHR_shader_subgroup_basic", behaviorString); +#endif } void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBehavior behavior) @@ -722,6 +841,20 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe } } +// Check if extension is used with correct shader stage. +void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * const extension) +{ +#ifdef NV_EXTENSIONS + // GL_NV_mesh_shader extension is only allowed in task/mesh shaders + if (strcmp(extension, "GL_NV_mesh_shader") == 0) { + requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask | EShLangFragmentMask), + "#extension GL_NV_mesh_shader"); + profileRequires(loc, ECoreProfile, 450, 0, "#extension GL_NV_mesh_shader"); + profileRequires(loc, EEsProfile, 320, 0, "#extension GL_NV_mesh_shader"); + } +#endif +} + // Call for any operation needing full GLSL integer data-type support. void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op) { @@ -733,42 +866,215 @@ void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op) void TParseVersions::doubleCheck(const TSourceLoc& loc, const char* op) { requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 400, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 400, nullptr, op); -} - -#ifdef AMD_EXTENSIONS -// Call for any operation needing GLSL 16-bit integer data-type support. -void TParseVersions::int16Check(const TSourceLoc& loc, const char* op, bool builtIn) -{ - if (! builtIn) { - requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_int16, "shader int16"); - requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 450, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); - } + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); } // Call for any operation needing GLSL float16 data-type support. void TParseVersions::float16Check(const TSourceLoc& loc, const char* op, bool builtIn) { - if (! builtIn) { - requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float, "shader half float"); + if (!builtIn) { + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_half_float, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_float16}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} + +bool TParseVersions::float16Arithmetic() +{ + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_half_float, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_float16}; + return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions); +} + +bool TParseVersions::int16Arithmetic() +{ + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_int16, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int16}; + return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions); +} + +bool TParseVersions::int8Arithmetic() +{ + const char* const extensions[] = { + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int8}; + return extensionsTurnedOn(sizeof(extensions)/sizeof(extensions[0]), extensions); +} + +void TParseVersions::requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) +{ + TString combined; + combined = op; + combined += ": "; + combined += featureDesc; + + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_half_float, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_float16}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); +} + +void TParseVersions::requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) +{ + TString combined; + combined = op; + combined += ": "; + combined += featureDesc; + + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_int16, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int16}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); +} + +void TParseVersions::requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc) +{ + TString combined; + combined = op; + combined += ": "; + combined += featureDesc; + + const char* const extensions[] = { + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int8}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, combined.c_str()); +} + +void TParseVersions::float16ScalarVectorCheck(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (!builtIn) { + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_half_float, +#endif + E_GL_EXT_shader_16bit_storage, + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_float16}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} + +// Call for any operation needing GLSL float32 data-type support. +void TParseVersions::explicitFloat32Check(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (!builtIn) { + const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_float32}; + requireExtensions(loc, 2, extensions, op); + } +} + +// Call for any operation needing GLSL float64 data-type support. +void TParseVersions::explicitFloat64Check(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (!builtIn) { + const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_float64}; + requireExtensions(loc, 2, extensions, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 450, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); + } +} + +// Call for any operation needing GLSL explicit int8 data-type support. +void TParseVersions::explicitInt8Check(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int8}; + requireExtensions(loc, 2, extensions, op); + } +} + +#ifdef AMD_EXTENSIONS +// Call for any operation needing GLSL float16 opaque-type support +void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + requireExtensions(loc, 1, &E_GL_AMD_gpu_shader_half_float_fetch, op); + requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); } } #endif +// Call for any operation needing GLSL explicit int16 data-type support. +void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_int16, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int16}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} + +void TParseVersions::int16ScalarVectorCheck(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + const char* const extensions[] = { +#if AMD_EXTENSIONS + E_GL_AMD_gpu_shader_int16, +#endif + E_GL_EXT_shader_16bit_storage, + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int16}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} + +void TParseVersions::int8ScalarVectorCheck(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + const char* const extensions[] = { + E_GL_EXT_shader_8bit_storage, + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int8}; + requireExtensions(loc, sizeof(extensions)/sizeof(extensions[0]), extensions, op); + } +} + +// Call for any operation needing GLSL explicit int32 data-type support. +void TParseVersions::explicitInt32Check(const TSourceLoc& loc, const char* op, bool builtIn) +{ + if (! builtIn) { + const char* const extensions[2] = {E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int32}; + requireExtensions(loc, 2, extensions, op); + } +} + // Call for any operation needing GLSL 64-bit integer data-type support. void TParseVersions::int64Check(const TSourceLoc& loc, const char* op, bool builtIn) { if (! builtIn) { - requireExtensions(loc, 1, &E_GL_ARB_gpu_shader_int64, "shader int64"); + const char* const extensions[3] = {E_GL_ARB_gpu_shader_int64, + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int64}; + requireExtensions(loc, 3, extensions, op); requireProfile(loc, ECoreProfile | ECompatibilityProfile, op); - profileRequires(loc, ECoreProfile, 450, nullptr, op); - profileRequires(loc, ECompatibilityProfile, 450, nullptr, op); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 400, nullptr, op); } } @@ -782,7 +1088,7 @@ void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op) // Call for any operation removed because Vulkan SPIR-V is being generated. void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) { - if (spvVersion.vulkan >= 100) + if (spvVersion.vulkan > 0) error(loc, "not allowed when using GLSL for Vulkan", op, ""); } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h index bd57103afea..6b513b43ef4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Versions.h @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -83,7 +84,7 @@ struct SpvVersion { SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {} unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX" - int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use (100 means 1.0) + int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX" }; @@ -139,13 +140,34 @@ const char* const E_GL_ARB_shader_stencil_export = "GL_ARB_shader_stencil const char* const E_GL_ARB_post_depth_coverage = "GL_ARB_post_depth_coverage"; const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewport_layer_array"; +const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic"; +const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote"; +const char* const E_GL_KHR_shader_subgroup_arithmetic = "GL_KHR_shader_subgroup_arithmetic"; +const char* const E_GL_KHR_shader_subgroup_ballot = "GL_KHR_shader_subgroup_ballot"; +const char* const E_GL_KHR_shader_subgroup_shuffle = "GL_KHR_shader_subgroup_shuffle"; +const char* const E_GL_KHR_shader_subgroup_shuffle_relative = "GL_KHR_shader_subgroup_shuffle_relative"; +const char* const E_GL_KHR_shader_subgroup_clustered = "GL_KHR_shader_subgroup_clustered"; +const char* const E_GL_KHR_shader_subgroup_quad = "GL_KHR_shader_subgroup_quad"; +const char* const E_GL_KHR_memory_scope_semantics = "GL_KHR_memory_scope_semantics"; + +const char* const E_GL_EXT_shader_atomic_int64 = "GL_EXT_shader_atomic_int64"; + const char* const E_GL_EXT_shader_non_constant_global_initializers = "GL_EXT_shader_non_constant_global_initializers"; const char* const E_GL_EXT_shader_image_load_formatted = "GL_EXT_shader_image_load_formatted"; +const char* const E_GL_EXT_shader_16bit_storage = "GL_EXT_shader_16bit_storage"; +const char* const E_GL_EXT_shader_8bit_storage = "GL_EXT_shader_8bit_storage"; + + // EXT extensions -const char* const E_GL_EXT_device_group = "GL_EXT_device_group"; -const char* const E_GL_EXT_multiview = "GL_EXT_multiview"; -const char* const E_GL_EXT_post_depth_coverage = "GL_EXT_post_depth_coverage"; +const char* const E_GL_EXT_device_group = "GL_EXT_device_group"; +const char* const E_GL_EXT_multiview = "GL_EXT_multiview"; +const char* const E_GL_EXT_post_depth_coverage = "GL_EXT_post_depth_coverage"; +const char* const E_GL_EXT_control_flow_attributes = "GL_EXT_control_flow_attributes"; +const char* const E_GL_EXT_nonuniform_qualifier = "GL_EXT_nonuniform_qualifier"; +const char* const E_GL_EXT_samplerless_texture_functions = "GL_EXT_samplerless_texture_functions"; +const char* const E_GL_EXT_scalar_block_layout = "GL_EXT_scalar_block_layout"; +const char* const E_GL_EXT_fragment_invocation_density = "GL_EXT_fragment_invocation_density"; // Arrays of extensions for the above viewportEXTs duplications @@ -173,6 +195,7 @@ const char* const E_GL_AMD_texture_gather_bias_lod = "GL_AMD_textur const char* const E_GL_AMD_gpu_shader_int16 = "GL_AMD_gpu_shader_int16"; const char* const E_GL_AMD_shader_image_load_store_lod = "GL_AMD_shader_image_load_store_lod"; const char* const E_GL_AMD_shader_fragment_mask = "GL_AMD_shader_fragment_mask"; +const char* const E_GL_AMD_gpu_shader_half_float_fetch = "GL_AMD_gpu_shader_half_float_fetch"; #endif #ifdef NV_EXTENSIONS @@ -183,6 +206,15 @@ const char* const E_GL_NV_viewport_array2 = "GL_NV_viewpor const char* const E_GL_NV_stereo_view_rendering = "GL_NV_stereo_view_rendering"; const char* const E_GL_NVX_multiview_per_view_attributes = "GL_NVX_multiview_per_view_attributes"; const char* const E_GL_NV_shader_atomic_int64 = "GL_NV_shader_atomic_int64"; +const char* const E_GL_NV_conservative_raster_underestimation = "GL_NV_conservative_raster_underestimation"; +const char* const E_GL_NV_shader_noperspective_interpolation = "GL_NV_shader_noperspective_interpolation"; +const char* const E_GL_NV_shader_subgroup_partitioned = "GL_NV_shader_subgroup_partitioned"; +const char* const E_GL_NV_shading_rate_image = "GL_NV_shading_rate_image"; +const char* const E_GL_NV_ray_tracing = "GL_NV_ray_tracing"; +const char* const E_GL_NV_fragment_shader_barycentric = "GL_NV_fragment_shader_barycentric"; +const char* const E_GL_NV_compute_shader_derivatives = "GL_NV_compute_shader_derivatives"; +const char* const E_GL_NV_shader_texture_footprint = "GL_NV_shader_texture_footprint"; +const char* const E_GL_NV_mesh_shader = "GL_NV_mesh_shader"; // Arrays of extensions for the above viewportEXTs duplications @@ -218,6 +250,16 @@ const char* const E_GL_OES_tessellation_point_size = "GL_OES_tessel const char* const E_GL_OES_texture_buffer = "GL_OES_texture_buffer"; const char* const E_GL_OES_texture_cube_map_array = "GL_OES_texture_cube_map_array"; +// KHX +const char* const E_GL_KHX_shader_explicit_arithmetic_types = "GL_KHX_shader_explicit_arithmetic_types"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_int8 = "GL_KHX_shader_explicit_arithmetic_types_int8"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_int16 = "GL_KHX_shader_explicit_arithmetic_types_int16"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_int32 = "GL_KHX_shader_explicit_arithmetic_types_int32"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_int64 = "GL_KHX_shader_explicit_arithmetic_types_int64"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_float16 = "GL_KHX_shader_explicit_arithmetic_types_float16"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_float32 = "GL_KHX_shader_explicit_arithmetic_types_float32"; +const char* const E_GL_KHX_shader_explicit_arithmetic_types_float64 = "GL_KHX_shader_explicit_arithmetic_types_float64"; + // Arrays of extensions for the above AEP duplications const char* const AEP_geometry_shader[] = { E_GL_EXT_geometry_shader, E_GL_OES_geometry_shader }; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp new file mode 100644 index 00000000000..73b665d8082 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.cpp @@ -0,0 +1,257 @@ +// +// Copyright (C) 2017 LunarG, Inc. +// Copyright (C) 2018 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of Google, Inc., nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "attribute.h" +#include "../Include/intermediate.h" +#include "ParseHelper.h" + +namespace glslang { + +// extract integers out of attribute arguments stored in attribute aggregate +bool TAttributeArgs::getInt(int& value, int argNum) const +{ + const TConstUnion* intConst = getConstUnion(EbtInt, argNum); + + if (intConst == nullptr) + return false; + + value = intConst->getIConst(); + return true; +} + +// extract strings out of attribute arguments stored in attribute aggregate. +// convert to lower case if converToLower is true (for case-insensitive compare convenience) +bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower) const +{ + const TConstUnion* stringConst = getConstUnion(EbtString, argNum); + + if (stringConst == nullptr) + return false; + + value = *stringConst->getSConst(); + + // Convenience. + if (convertToLower) + std::transform(value.begin(), value.end(), value.begin(), ::tolower); + + return true; +} + +// How many arguments were supplied? +int TAttributeArgs::size() const +{ + return args == nullptr ? 0 : (int)args->getSequence().size(); +} + +// Helper to get attribute const union. Returns nullptr on failure. +const TConstUnion* TAttributeArgs::getConstUnion(TBasicType basicType, int argNum) const +{ + if (args == nullptr) + return nullptr; + + if (argNum >= (int)args->getSequence().size()) + return nullptr; + + const TConstUnion* constVal = &args->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0]; + if (constVal == nullptr || constVal->getType() != basicType) + return nullptr; + + return constVal; +} + +// Implementation of TParseContext parts of attributes +TAttributeType TParseContext::attributeFromName(const TString& name) const +{ + if (name == "branch" || name == "dont_flatten") + return EatBranch; + else if (name == "flatten") + return EatFlatten; + else if (name == "unroll") + return EatUnroll; + else if (name == "loop" || name == "dont_unroll") + return EatLoop; + else if (name == "dependency_infinite") + return EatDependencyInfinite; + else if (name == "dependency_length") + return EatDependencyLength; + else + return EatNone; +} + +// Make an initial leaf for the grammar from a no-argument attribute +TAttributes* TParseContext::makeAttributes(const TString& identifier) const +{ + TAttributes *attributes = nullptr; + attributes = NewPoolObject(attributes); + TAttributeArgs args = { attributeFromName(identifier), nullptr }; + attributes->push_back(args); + return attributes; +} + +// Make an initial leaf for the grammar from a one-argument attribute +TAttributes* TParseContext::makeAttributes(const TString& identifier, TIntermNode* node) const +{ + TAttributes *attributes = nullptr; + attributes = NewPoolObject(attributes); + + // for now, node is always a simple single expression, but other code expects + // a list, so make it so + TIntermAggregate* agg = intermediate.makeAggregate(node); + TAttributeArgs args = { attributeFromName(identifier), agg }; + attributes->push_back(args); + return attributes; +} + +// Merge two sets of attributes into a single set. +// The second argument is destructively consumed. +TAttributes* TParseContext::mergeAttributes(TAttributes* attr1, TAttributes* attr2) const +{ + attr1->splice(attr1->end(), *attr2); + return attr1; +} + +// +// Selection attributes +// +void TParseContext::handleSelectionAttributes(const TAttributes& attributes, TIntermNode* node) +{ + TIntermSelection* selection = node->getAsSelectionNode(); + if (selection == nullptr) + return; + + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + if (it->size() > 0) { + warn(node->getLoc(), "attribute with arguments not recognized, skipping", "", ""); + continue; + } + + switch (it->name) { + case EatFlatten: + selection->setFlatten(); + break; + case EatBranch: + selection->setDontFlatten(); + break; + default: + warn(node->getLoc(), "attribute does not apply to a selection", "", ""); + break; + } + } +} + +// +// Switch attributes +// +void TParseContext::handleSwitchAttributes(const TAttributes& attributes, TIntermNode* node) +{ + TIntermSwitch* selection = node->getAsSwitchNode(); + if (selection == nullptr) + return; + + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + if (it->size() > 0) { + warn(node->getLoc(), "attribute with arguments not recognized, skipping", "", ""); + continue; + } + + switch (it->name) { + case EatFlatten: + selection->setFlatten(); + break; + case EatBranch: + selection->setDontFlatten(); + break; + default: + warn(node->getLoc(), "attribute does not apply to a switch", "", ""); + break; + } + } +} + +// +// Loop attributes +// +void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermNode* node) +{ + TIntermLoop* loop = node->getAsLoopNode(); + if (loop == nullptr) { + // the actual loop might be part of a sequence + TIntermAggregate* agg = node->getAsAggregate(); + if (agg == nullptr) + return; + for (auto it = agg->getSequence().begin(); it != agg->getSequence().end(); ++it) { + loop = (*it)->getAsLoopNode(); + if (loop != nullptr) + break; + } + if (loop == nullptr) + return; + } + + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + if (it->name != EatDependencyLength && it->size() > 0) { + warn(node->getLoc(), "attribute with arguments not recognized, skipping", "", ""); + continue; + } + + int value; + switch (it->name) { + case EatUnroll: + loop->setUnroll(); + break; + case EatLoop: + loop->setDontUnroll(); + break; + case EatDependencyInfinite: + loop->setLoopDependency(TIntermLoop::dependencyInfinite); + break; + case EatDependencyLength: + if (it->size() == 1 && it->getInt(value)) { + if (value <= 0) + error(node->getLoc(), "must be positive", "dependency_length", ""); + loop->setLoopDependency(value); + } else + warn(node->getLoc(), "expected a single integer argument", "dependency_length", ""); + break; + default: + warn(node->getLoc(), "attribute does not apply to a loop", "", ""); + break; + } + } +} + + +} // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.h new file mode 100644 index 00000000000..8d0c5bcafbf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/attribute.h @@ -0,0 +1,102 @@ +// +// Copyright (C) 2017 LunarG, Inc. +// Copyright (C) 2018 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#ifndef _ATTRIBUTE_INCLUDED_ +#define _ATTRIBUTE_INCLUDED_ + +#include "../Include/Common.h" +#include "../Include/ConstantUnion.h" + +namespace glslang { + + enum TAttributeType { + EatNone, + EatAllow_uav_condition, + EatBranch, + EatCall, + EatDomain, + EatEarlyDepthStencil, + EatFastOpt, + EatFlatten, + EatForceCase, + EatInstance, + EatMaxTessFactor, + EatNumThreads, + EatMaxVertexCount, + EatOutputControlPoints, + EatOutputTopology, + EatPartitioning, + EatPatchConstantFunc, + EatPatchSize, + EatUnroll, + EatLoop, + EatBinding, + EatGlobalBinding, + EatLocation, + EatInputAttachment, + EatBuiltIn, + EatPushConstant, + EatConstantId, + EatDependencyInfinite, + EatDependencyLength + }; + + class TIntermAggregate; + + struct TAttributeArgs { + TAttributeType name; + const TIntermAggregate* args; + + // Obtain attribute as integer + // Return false if it cannot be obtained + bool getInt(int& value, int argNum = 0) const; + + // Obtain attribute as string, with optional to-lower transform + // Return false if it cannot be obtained + bool getString(TString& value, int argNum = 0, bool convertToLower = true) const; + + // How many arguments were provided to the attribute? + int size() const; + + protected: + const TConstUnion* getConstUnion(TBasicType basicType, int argNum) const; + }; + + typedef TList TAttributes; + +} // end namespace glslang + +#endif // _ATTRIBUTE_INCLUDED_ diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/gl_types.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/gl_types.h index ae00ae57ecf..c9fee9ecce6 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/gl_types.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/gl_types.h @@ -117,6 +117,40 @@ #define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#ifdef AMD_EXTENSIONS +#define GL_FLOAT16_SAMPLER_1D_AMD 0x91CE +#define GL_FLOAT16_SAMPLER_2D_AMD 0x91CF +#define GL_FLOAT16_SAMPLER_3D_AMD 0x91D0 +#define GL_FLOAT16_SAMPLER_CUBE_AMD 0x91D1 +#define GL_FLOAT16_SAMPLER_2D_RECT_AMD 0x91D2 +#define GL_FLOAT16_SAMPLER_1D_ARRAY_AMD 0x91D3 +#define GL_FLOAT16_SAMPLER_2D_ARRAY_AMD 0x91D4 +#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD 0x91D5 +#define GL_FLOAT16_SAMPLER_BUFFER_AMD 0x91D6 +#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD 0x91D7 +#define GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD 0x91D8 + +#define GL_FLOAT16_SAMPLER_1D_SHADOW_AMD 0x91D9 +#define GL_FLOAT16_SAMPLER_2D_SHADOW_AMD 0x91DA +#define GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD 0x91DB +#define GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD 0x91DC +#define GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD 0x91DD +#define GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD 0x91DE +#define GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD 0x91DF + +#define GL_FLOAT16_IMAGE_1D_AMD 0x91E0 +#define GL_FLOAT16_IMAGE_2D_AMD 0x91E1 +#define GL_FLOAT16_IMAGE_3D_AMD 0x91E2 +#define GL_FLOAT16_IMAGE_2D_RECT_AMD 0x91E3 +#define GL_FLOAT16_IMAGE_CUBE_AMD 0x91E4 +#define GL_FLOAT16_IMAGE_1D_ARRAY_AMD 0x91E5 +#define GL_FLOAT16_IMAGE_2D_ARRAY_AMD 0x91E6 +#define GL_FLOAT16_IMAGE_CUBE_MAP_ARRAY_AMD 0x91E7 +#define GL_FLOAT16_IMAGE_BUFFER_AMD 0x91E8 +#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD 0x91E9 +#define GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD 0x91EA +#endif + #define GL_INT_SAMPLER_1D 0x8DC9 #define GL_INT_SAMPLER_2D 0x8DCA #define GL_INT_SAMPLER_3D 0x8DCB diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y index 52358c7d209..3634f16fb28 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang.y @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -58,6 +59,7 @@ Jutta Degener, 1995 #include "SymbolTable.h" #include "ParseHelper.h" #include "../Public/ShaderLang.h" +#include "attribute.h" using namespace glslang; @@ -86,6 +88,7 @@ using namespace glslang; TIntermNode* intermNode; glslang::TIntermNodePair nodePair; glslang::TIntermTyped* intermTypedNode; + glslang::TAttributes* attributes; }; union { glslang::TPublicType type; @@ -121,16 +124,29 @@ extern int yylex(YYSTYPE*, TParseContext&); %expect 1 // One shift reduce conflict because of if | else %token ATTRIBUTE VARYING -%token CONST BOOL FLOAT DOUBLE INT UINT INT64_T UINT64_T INT16_T UINT16_T FLOAT16_T +%token FLOAT16_T FLOAT FLOAT32_T DOUBLE FLOAT64_T +%token CONST BOOL INT UINT INT64_T UINT64_T INT32_T UINT32_T INT16_T UINT16_T INT8_T UINT8_T %token BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT SUBROUTINE -%token BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 I64VEC2 I64VEC3 I64VEC4 UVEC2 UVEC3 UVEC4 U64VEC2 U64VEC3 U64VEC4 VEC2 VEC3 VEC4 +%token BVEC2 BVEC3 BVEC4 +%token IVEC2 IVEC3 IVEC4 +%token UVEC2 UVEC3 UVEC4 +%token I64VEC2 I64VEC3 I64VEC4 +%token U64VEC2 U64VEC3 U64VEC4 +%token I32VEC2 I32VEC3 I32VEC4 +%token U32VEC2 U32VEC3 U32VEC4 +%token I16VEC2 I16VEC3 I16VEC4 +%token U16VEC2 U16VEC3 U16VEC4 +%token I8VEC2 I8VEC3 I8VEC4 +%token U8VEC2 U8VEC3 U8VEC4 +%token VEC2 VEC3 VEC4 %token MAT2 MAT3 MAT4 CENTROID IN OUT INOUT -%token UNIFORM PATCH SAMPLE BUFFER SHARED -%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY +%token UNIFORM PATCH SAMPLE BUFFER SHARED NONUNIFORM PAYLOADNV PAYLOADINNV HITATTRNV CALLDATANV CALLDATAINNV +%token COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT SUBGROUPCOHERENT NONPRIVATE %token DVEC2 DVEC3 DVEC4 DMAT2 DMAT3 DMAT4 %token F16VEC2 F16VEC3 F16VEC4 F16MAT2 F16MAT3 F16MAT4 -%token I16VEC2 I16VEC3 I16VEC4 U16VEC2 U16VEC3 U16VEC4 -%token NOPERSPECTIVE FLAT SMOOTH LAYOUT __EXPLICITINTERPAMD +%token F32VEC2 F32VEC3 F32VEC4 F32MAT2 F32MAT3 F32MAT4 +%token F64VEC2 F64VEC3 F64VEC4 F64MAT2 F64MAT3 F64MAT4 +%token NOPERSPECTIVE FLAT SMOOTH LAYOUT EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV %token MAT2X2 MAT2X3 MAT2X4 %token MAT3X2 MAT3X3 MAT3X4 @@ -141,7 +157,14 @@ extern int yylex(YYSTYPE*, TParseContext&); %token F16MAT2X2 F16MAT2X3 F16MAT2X4 %token F16MAT3X2 F16MAT3X3 F16MAT3X4 %token F16MAT4X2 F16MAT4X3 F16MAT4X4 +%token F32MAT2X2 F32MAT2X3 F32MAT2X4 +%token F32MAT3X2 F32MAT3X3 F32MAT3X4 +%token F32MAT4X2 F32MAT4X3 F32MAT4X4 +%token F64MAT2X2 F64MAT2X3 F64MAT2X4 +%token F64MAT3X2 F64MAT3X3 F64MAT3X4 +%token F64MAT4X2 F64MAT4X3 F64MAT4X4 %token ATOMIC_UINT +%token ACCSTRUCTNV // combined image/sampler %token SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW @@ -157,6 +180,12 @@ extern int yylex(YYSTYPE*, TParseContext&); %token SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY %token SAMPLEREXTERNALOES +%token F16SAMPLER1D F16SAMPLER2D F16SAMPLER3D F16SAMPLER2DRECT F16SAMPLERCUBE +%token F16SAMPLER1DARRAY F16SAMPLER2DARRAY F16SAMPLERCUBEARRAY +%token F16SAMPLERBUFFER F16SAMPLER2DMS F16SAMPLER2DMSARRAY +%token F16SAMPLER1DSHADOW F16SAMPLER2DSHADOW F16SAMPLER1DARRAYSHADOW F16SAMPLER2DARRAYSHADOW +%token F16SAMPLER2DRECTSHADOW F16SAMPLERCUBESHADOW F16SAMPLERCUBEARRAYSHADOW + // pure sampler %token SAMPLER SAMPLERSHADOW @@ -172,8 +201,13 @@ extern int yylex(YYSTYPE*, TParseContext&); %token TEXTURE2DMS ITEXTURE2DMS UTEXTURE2DMS %token TEXTURE2DMSARRAY ITEXTURE2DMSARRAY UTEXTURE2DMSARRAY +%token F16TEXTURE1D F16TEXTURE2D F16TEXTURE3D F16TEXTURE2DRECT F16TEXTURECUBE +%token F16TEXTURE1DARRAY F16TEXTURE2DARRAY F16TEXTURECUBEARRAY +%token F16TEXTUREBUFFER F16TEXTURE2DMS F16TEXTURE2DMSARRAY + // input attachments %token SUBPASSINPUT SUBPASSINPUTMS ISUBPASSINPUT ISUBPASSINPUTMS USUBPASSINPUT USUBPASSINPUTMS +%token F16SUBPASSINPUT F16SUBPASSINPUTMS %token IMAGE1D IIMAGE1D UIMAGE1D IMAGE2D IIMAGE2D %token UIMAGE2D IMAGE3D IIMAGE3D UIMAGE3D @@ -186,10 +220,14 @@ extern int yylex(YYSTYPE*, TParseContext&); %token IMAGE2DMS IIMAGE2DMS UIMAGE2DMS %token IMAGE2DMSARRAY IIMAGE2DMSARRAY UIMAGE2DMSARRAY +%token F16IMAGE1D F16IMAGE2D F16IMAGE3D F16IMAGE2DRECT +%token F16IMAGECUBE F16IMAGE1DARRAY F16IMAGE2DARRAY F16IMAGECUBEARRAY +%token F16IMAGEBUFFER F16IMAGE2DMS F16IMAGE2DMSARRAY + %token STRUCT VOID WHILE %token IDENTIFIER TYPE_NAME -%token FLOATCONSTANT DOUBLECONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT INT16CONSTANT UINT16CONSTANT BOOLCONSTANT FLOAT16CONSTANT +%token FLOATCONSTANT DOUBLECONSTANT INT16CONSTANT UINT16CONSTANT INT32CONSTANT UINT32CONSTANT INTCONSTANT UINTCONSTANT INT64CONSTANT UINT64CONSTANT BOOLCONSTANT FLOAT16CONSTANT %token LEFT_OP RIGHT_OP %token INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP %token AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN @@ -218,12 +256,12 @@ extern int yylex(YYSTYPE*, TParseContext&); %type translation_unit function_definition %type statement simple_statement %type statement_list switch_statement_list compound_statement -%type declaration_statement selection_statement expression_statement -%type switch_statement case_label +%type declaration_statement selection_statement selection_statement_nonattributed expression_statement +%type switch_statement switch_statement_nonattributed case_label %type declaration external_declaration %type for_init_statement compound_statement_no_new_scope %type selection_rest_statement for_rest_statement -%type iteration_statement jump_statement statement_no_new_scope statement_scoped +%type iteration_statement iteration_statement_nonattributed jump_statement statement_no_new_scope statement_scoped %type single_declaration init_declarator_list %type parameter_declaration parameter_declarator parameter_type_specifier @@ -231,6 +269,7 @@ extern int yylex(YYSTYPE*, TParseContext&); %type array_specifier %type precise_qualifier invariant_qualifier interpolation_qualifier storage_qualifier precision_qualifier %type layout_qualifier layout_qualifier_id_list layout_qualifier_id +%type non_uniform_qualifier %type type_qualifier fully_specified_type type_specifier %type single_type_qualifier @@ -246,6 +285,8 @@ extern int yylex(YYSTYPE*, TParseContext&); %type identifier_list +%type attribute attribute_list single_attribute + %start translation_unit %% @@ -259,6 +300,14 @@ primary_expression : variable_identifier { $$ = $1; } + | INT32CONSTANT { + parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); + $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); + } + | UINT32CONSTANT { + parseContext.explicitInt32Check($1.loc, "32-bit signed literal"); + $$ = parseContext.intermediate.addConstantUnion($1.u, $1.loc, true); + } | INTCONSTANT { $$ = parseContext.intermediate.addConstantUnion($1.i, $1.loc, true); } @@ -275,16 +324,12 @@ primary_expression $$ = parseContext.intermediate.addConstantUnion($1.u64, $1.loc, true); } | INT16CONSTANT { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit integer literal"); + parseContext.explicitInt16Check($1.loc, "16-bit integer literal"); $$ = parseContext.intermediate.addConstantUnion((short)$1.i, $1.loc, true); -#endif } | UINT16CONSTANT { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit unsigned integer literal"); + parseContext.explicitInt16Check($1.loc, "16-bit unsigned integer literal"); $$ = parseContext.intermediate.addConstantUnion((unsigned short)$1.u, $1.loc, true); -#endif } | FLOATCONSTANT { $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat, $1.loc, true); @@ -294,10 +339,8 @@ primary_expression $$ = parseContext.intermediate.addConstantUnion($1.d, EbtDouble, $1.loc, true); } | FLOAT16CONSTANT { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float literal"); $$ = parseContext.intermediate.addConstantUnion($1.d, EbtFloat16, $1.loc, true); -#endif } | BOOLCONSTANT { $$ = parseContext.intermediate.addConstantUnion($1.b, $1.loc, true); @@ -432,6 +475,11 @@ function_identifier $$.function = new TFunction(&empty, TType(EbtVoid), EOpNull); } } + | non_uniform_qualifier { + // Constructor + $$.intermNode = 0; + $$.function = parseContext.handleConstructorCall($1.loc, $1); + } ; unary_expression @@ -652,6 +700,7 @@ assignment_expression | unary_expression assignment_operator assignment_expression { parseContext.arrayObjectCheck($2.loc, $1->getType(), "array assignment"); parseContext.opaqueCheck($2.loc, $1->getType(), "="); + parseContext.storage16BitAssignmentCheck($2.loc, $1->getType(), "="); parseContext.specializationCheck($2.loc, $1->getType(), "="); parseContext.lValueErrorCheck($2.loc, "assign", $1); parseContext.rValueErrorCheck($2.loc, "assign", $3); @@ -893,14 +942,16 @@ parameter_declarator parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type"); parseContext.arraySizeRequiredCheck($1.loc, *$1.arraySizes); } - parseContext.arrayDimCheck($2.loc, $1.arraySizes, $3.arraySizes); + TType* type = new TType($1); + type->transferArraySizes($3.arraySizes); + type->copyArrayInnerSizes($1.arraySizes); + parseContext.arrayOfArrayVersionCheck($2.loc, type->getArraySizes()); parseContext.arraySizeRequiredCheck($3.loc, *$3.arraySizes); parseContext.reservedErrorCheck($2.loc, *$2.string); - $1.arraySizes = $3.arraySizes; + TParameter param = { $2.string, type }; - TParameter param = { $2.string, new TType($1)}; $$.loc = $2.loc; $$.param = param; } @@ -925,7 +976,7 @@ parameter_declaration $$ = $1; parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); - parseContext.paramCheckFix($1.loc, EvqTemporary, *$$.param.type); + parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); } // @@ -945,7 +996,7 @@ parameter_declaration $$ = $1; parseContext.parameterTypeCheck($1.loc, EvqIn, *$1.param.type); - parseContext.paramCheckFix($1.loc, EvqTemporary, *$$.param.type); + parseContext.paramCheckFixStorage($1.loc, EvqTemporary, *$$.param.type); parseContext.precisionQualifierCheck($$.loc, $$.param.type->getBasicType(), $$.param.type->getQualifier()); } ; @@ -1034,7 +1085,7 @@ fully_specified_type } if ($2.arraySizes && parseContext.arrayQualifierError($2.loc, $1.qualifier)) - $2.arraySizes = 0; + $2.arraySizes = nullptr; parseContext.checkNoShaderLayouts($2.loc, $1.shaderQualifiers); $2.shaderQualifiers.merge($1.shaderQualifiers); @@ -1076,18 +1127,62 @@ interpolation_qualifier } | NOPERSPECTIVE { parseContext.globalCheck($1.loc, "noperspective"); +#ifdef NV_EXTENSIONS + parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); +#else parseContext.requireProfile($1.loc, ~EEsProfile, "noperspective"); +#endif parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "noperspective"); $$.init($1.loc); $$.qualifier.nopersp = true; } - | __EXPLICITINTERPAMD { + | EXPLICITINTERPAMD { #ifdef AMD_EXTENSIONS parseContext.globalCheck($1.loc, "__explicitInterpAMD"); parseContext.profileRequires($1.loc, ECoreProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); parseContext.profileRequires($1.loc, ECompatibilityProfile, 450, E_GL_AMD_shader_explicit_vertex_parameter, "explicit interpolation"); $$.init($1.loc); $$.qualifier.explicitInterp = true; +#endif + } + | PERVERTEXNV { +#ifdef NV_EXTENSIONS + parseContext.globalCheck($1.loc, "pervertexNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); + parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); + parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); + $$.init($1.loc); + $$.qualifier.pervertexNV = true; +#endif + } + | PERPRIMITIVENV { +#ifdef NV_EXTENSIONS + // No need for profile version or extension check. Shader stage already checks both. + parseContext.globalCheck($1.loc, "perprimitiveNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV"); + // Fragment shader stage doesn't check for extension. So we explicitly add below extension check. + if (parseContext.language == EShLangFragment) + parseContext.requireExtensions($1.loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); + $$.init($1.loc); + $$.qualifier.perPrimitiveNV = true; +#endif + } + | PERVIEWNV { +#ifdef NV_EXTENSIONS + // No need for profile version or extension check. Shader stage already checks both. + parseContext.globalCheck($1.loc, "perviewNV"); + parseContext.requireStage($1.loc, EShLangMeshNV, "perviewNV"); + $$.init($1.loc); + $$.qualifier.perViewNV = true; +#endif + } + | PERTASKNV { +#ifdef NV_EXTENSIONS + // No need for profile version or extension check. Shader stage already checks both. + parseContext.globalCheck($1.loc, "taskNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV"); + $$.init($1.loc); + $$.qualifier.perTaskNV = true; #endif } ; @@ -1170,6 +1265,9 @@ single_type_qualifier // allow inheritance of storage qualifier from block declaration $$ = $1; } + | non_uniform_qualifier { + $$ = $1; + } ; storage_qualifier @@ -1248,11 +1346,64 @@ storage_qualifier $$.init($1.loc); $$.qualifier.storage = EvqBuffer; } + | HITATTRNV { +#ifdef NV_EXTENSIONS + parseContext.globalCheck($1.loc, "hitAttributeNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask + | EShLangAnyHitNVMask), "hitAttributeNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV"); + $$.init($1.loc); + $$.qualifier.storage = EvqHitAttrNV; +#endif + } + | PAYLOADNV { +#ifdef NV_EXTENSIONS + parseContext.globalCheck($1.loc, "rayPayloadNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | + EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV"); + $$.init($1.loc); + $$.qualifier.storage = EvqPayloadNV; +#endif + } + | PAYLOADINNV { +#ifdef NV_EXTENSIONS + parseContext.globalCheck($1.loc, "rayPayloadInNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangClosestHitNVMask | + EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV"); + $$.init($1.loc); + $$.qualifier.storage = EvqPayloadInNV; +#endif + } + | CALLDATANV { +#ifdef NV_EXTENSIONS + parseContext.globalCheck($1.loc, "callableDataNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangRayGenNVMask | + EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), "callableDataNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV"); + $$.init($1.loc); + $$.qualifier.storage = EvqCallableDataNV; +#endif + } + | CALLDATAINNV { +#ifdef NV_EXTENSIONS + parseContext.globalCheck($1.loc, "callableDataInNV"); + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV"); + parseContext.profileRequires($1.loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV"); + $$.init($1.loc); + $$.qualifier.storage = EvqCallableDataInNV; +#endif + } | SHARED { parseContext.globalCheck($1.loc, "shared"); parseContext.profileRequires($1.loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); parseContext.profileRequires($1.loc, EEsProfile, 310, 0, "shared"); +#ifdef NV_EXTENSIONS + parseContext.requireStage($1.loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); +#else parseContext.requireStage($1.loc, EShLangCompute, "shared"); +#endif $$.init($1.loc); $$.qualifier.storage = EvqShared; } @@ -1260,6 +1411,31 @@ storage_qualifier $$.init($1.loc); $$.qualifier.coherent = true; } + | DEVICECOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); + $$.qualifier.devicecoherent = true; + } + | QUEUEFAMILYCOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); + $$.qualifier.queuefamilycoherent = true; + } + | WORKGROUPCOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); + $$.qualifier.workgroupcoherent = true; + } + | SUBGROUPCOHERENT { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); + $$.qualifier.subgroupcoherent = true; + } + | NONPRIVATE { + $$.init($1.loc); + parseContext.requireExtensions($1.loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); + $$.qualifier.nonprivate = true; + } | VOLATILE { $$.init($1.loc); $$.qualifier.volatil = true; @@ -1290,6 +1466,13 @@ storage_qualifier } ; +non_uniform_qualifier + : NONUNIFORM { + $$.init($1.loc); + $$.qualifier.nonUniform = true; + } + ; + type_name_list : IDENTIFIER { // TODO @@ -1307,7 +1490,7 @@ type_specifier $$.qualifier.precision = parseContext.getDefaultPrecision($$); } | type_specifier_nonarray array_specifier { - parseContext.arrayDimCheck($2.loc, $2.arraySizes, 0); + parseContext.arrayOfArrayVersionCheck($2.loc, $2.arraySizes); $$ = $1; $$.qualifier.precision = parseContext.getDefaultPrecision($$); $$.arraySizes = $2.arraySizes; @@ -1356,11 +1539,19 @@ type_specifier_nonarray $$.basicType = EbtDouble; } | FLOAT16_T { -#ifdef AMD_EXTENSIONS - parseContext.float16Check($1.loc, "half float", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck($1.loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; -#endif + } + | FLOAT32_T { + parseContext.explicitFloat32Check($1.loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + } + | FLOAT64_T { + parseContext.explicitFloat64Check($1.loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; } | INT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1371,6 +1562,36 @@ type_specifier_nonarray $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtUint; } + | INT8_T { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + } + | UINT8_T { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + } + | INT16_T { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + } + | UINT16_T { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + } + | INT32_T { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + } + | UINT32_T { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + } | INT64_T { parseContext.int64Check($1.loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1381,20 +1602,6 @@ type_specifier_nonarray $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtUint64; } - | INT16_T { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; -#endif - } - | UINT16_T { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; -#endif - } | BOOL { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtBool; @@ -1433,28 +1640,58 @@ type_specifier_nonarray $$.setVector(4); } | F16VEC2 { -#ifdef AMD_EXTENSIONS - parseContext.float16Check($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setVector(2); -#endif } | F16VEC3 { -#ifdef AMD_EXTENSIONS - parseContext.float16Check($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setVector(3); -#endif } | F16VEC4 { -#ifdef AMD_EXTENSIONS - parseContext.float16Check($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck($1.loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setVector(4); -#endif + } + | F32VEC2 { + parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(2); + } + | F32VEC3 { + parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(3); + } + | F32VEC4 { + parseContext.explicitFloat32Check($1.loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setVector(4); + } + | F64VEC2 { + parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(2); + } + | F64VEC3 { + parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(3); + } + | F64VEC4 { + parseContext.explicitFloat64Check($1.loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setVector(4); } | BVEC2 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1486,6 +1723,60 @@ type_specifier_nonarray $$.basicType = EbtInt; $$.setVector(4); } + | I8VEC2 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + $$.setVector(2); + } + | I8VEC3 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + $$.setVector(3); + } + | I8VEC4 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt8; + $$.setVector(4); + } + | I16VEC2 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + $$.setVector(2); + } + | I16VEC3 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + $$.setVector(3); + } + | I16VEC4 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt16; + $$.setVector(4); + } + | I32VEC2 { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(2); + } + | I32VEC3 { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(3); + } + | I32VEC4 { + parseContext.explicitInt32Check($1.loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtInt; + $$.setVector(4); + } | I64VEC2 { parseContext.int64Check($1.loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1504,30 +1795,6 @@ type_specifier_nonarray $$.basicType = EbtInt64; $$.setVector(4); } - | I16VEC2 { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - $$.setVector(2); -#endif - } - | I16VEC3 { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - $$.setVector(3); -#endif - } - | I16VEC4 { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtInt16; - $$.setVector(4); -#endif - } | UVEC2 { parseContext.fullIntegerCheck($1.loc, "unsigned integer vector"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1546,6 +1813,60 @@ type_specifier_nonarray $$.basicType = EbtUint; $$.setVector(4); } + | U8VEC2 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + $$.setVector(2); + } + | U8VEC3 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + $$.setVector(3); + } + | U8VEC4 { + parseContext.int8ScalarVectorCheck($1.loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint8; + $$.setVector(4); + } + | U16VEC2 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + $$.setVector(2); + } + | U16VEC3 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + $$.setVector(3); + } + | U16VEC4 { + parseContext.int16ScalarVectorCheck($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint16; + $$.setVector(4); + } + | U32VEC2 { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(2); + } + | U32VEC3 { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(3); + } + | U32VEC4 { + parseContext.explicitInt32Check($1.loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtUint; + $$.setVector(4); + } | U64VEC2 { parseContext.int64Check($1.loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -1564,30 +1885,6 @@ type_specifier_nonarray $$.basicType = EbtUint64; $$.setVector(4); } - | U16VEC2 { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - $$.setVector(2); -#endif - } - | U16VEC3 { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - $$.setVector(3); -#endif - } - | U16VEC4 { -#ifdef AMD_EXTENSIONS - parseContext.int16Check($1.loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); - $$.basicType = EbtUint16; - $$.setVector(4); -#endif - } | MAT2 { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat; @@ -1721,99 +2018,225 @@ type_specifier_nonarray $$.setMatrix(4, 4); } | F16MAT2 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(2, 2); -#endif } | F16MAT3 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(3, 3); -#endif } | F16MAT4 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(4, 4); -#endif } | F16MAT2X2 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(2, 2); -#endif } | F16MAT2X3 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(2, 3); -#endif } | F16MAT2X4 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(2, 4); -#endif } | F16MAT3X2 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(3, 2); -#endif } | F16MAT3X3 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(3, 3); -#endif } | F16MAT3X4 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(3, 4); -#endif } | F16MAT4X2 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(4, 2); -#endif } | F16MAT4X3 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(4, 3); -#endif } | F16MAT4X4 { -#ifdef AMD_EXTENSIONS parseContext.float16Check($1.loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtFloat16; $$.setMatrix(4, 4); + } + | F32MAT2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 2); + } + | F32MAT3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 3); + } + | F32MAT4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 4); + } + | F32MAT2X2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 2); + } + | F32MAT2X3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 3); + } + | F32MAT2X4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(2, 4); + } + | F32MAT3X2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 2); + } + | F32MAT3X3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 3); + } + | F32MAT3X4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(3, 4); + } + | F32MAT4X2 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 2); + } + | F32MAT4X3 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 3); + } + | F32MAT4X4 { + parseContext.explicitFloat32Check($1.loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtFloat; + $$.setMatrix(4, 4); + } + | F64MAT2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 2); + } + | F64MAT3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 3); + } + | F64MAT4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 4); + } + | F64MAT2X2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 2); + } + | F64MAT2X3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 3); + } + | F64MAT2X4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(2, 4); + } + | F64MAT3X2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 2); + } + | F64MAT3X3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 3); + } + | F64MAT3X4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(3, 4); + } + | F64MAT4X2 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 2); + } + | F64MAT4X3 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 3); + } + | F64MAT4X4 { + parseContext.explicitFloat64Check($1.loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtDouble; + $$.setMatrix(4, 4); + } + | ACCSTRUCTNV { +#ifdef NV_EXTENSIONS + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtAccStructNV; #endif } | ATOMIC_UINT { @@ -1886,6 +2309,110 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, EsdCube, true, true); } + | F16SAMPLER1D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D); +#endif + } + | F16SAMPLER2D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D); +#endif + } + | F16SAMPLER3D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd3D); +#endif + } + | F16SAMPLERCUBE { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube); +#endif + } + | F16SAMPLER1DSHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D, false, true); +#endif + } + | F16SAMPLER2DSHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, false, true); +#endif + } + | F16SAMPLERCUBESHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube, false, true); +#endif + } + | F16SAMPLER1DARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D, true); +#endif + } + | F16SAMPLER2DARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, true); +#endif + } + | F16SAMPLER1DARRAYSHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd1D, true, true); +#endif + } + | F16SAMPLER2DARRAYSHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, true, true); +#endif + } + | F16SAMPLERCUBEARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube, true); +#endif + } + | F16SAMPLERCUBEARRAYSHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdCube, true, true); +#endif + } | ISAMPLER1D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -1966,6 +2493,22 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, EsdRect, false, true); } + | F16SAMPLER2DRECT { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdRect); +#endif + } + | F16SAMPLER2DRECTSHADOW { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdRect, false, true); +#endif + } | ISAMPLER2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -1981,6 +2524,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, EsdBuffer); } + | F16SAMPLERBUFFER { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, EsdBuffer); +#endif + } | ISAMPLERBUFFER { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -1996,6 +2547,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd2D, false, false, true); } + | F16SAMPLER2DMS { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, false, false, true); +#endif + } | ISAMPLER2DMS { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2011,6 +2570,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.set(EbtFloat, Esd2D, true, false, true); } + | F16SAMPLER2DMSARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.set(EbtFloat16, Esd2D, true, false, true); +#endif + } | ISAMPLER2DMSARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2036,36 +2603,92 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd1D); } + | F16TEXTURE1D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd1D); +#endif + } | TEXTURE2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd2D); } + | F16TEXTURE2D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd2D); +#endif + } | TEXTURE3D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd3D); } + | F16TEXTURE3D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd3D); +#endif + } | TEXTURECUBE { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, EsdCube); } + | F16TEXTURECUBE { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdCube); +#endif + } | TEXTURE1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd1D, true); } + | F16TEXTURE1DARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd1D, true); +#endif + } | TEXTURE2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd2D, true); } + | F16TEXTURE2DARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd2D, true); +#endif + } | TEXTURECUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, EsdCube, true); } + | F16TEXTURECUBEARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdCube, true); +#endif + } | ITEXTURE1D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2141,6 +2764,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, EsdRect); } + | F16TEXTURE2DRECT { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdRect); +#endif + } | ITEXTURE2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2156,6 +2787,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, EsdBuffer); } + | F16TEXTUREBUFFER { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, EsdBuffer); +#endif + } | ITEXTUREBUFFER { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2171,6 +2810,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd2D, false, false, true); } + | F16TEXTURE2DMS { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd2D, false, false, true); +#endif + } | ITEXTURE2DMS { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2186,6 +2833,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setTexture(EbtFloat, Esd2D, true, false, true); } + | F16TEXTURE2DMSARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setTexture(EbtFloat16, Esd2D, true, false, true); +#endif + } | ITEXTURE2DMSARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2201,6 +2856,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd1D); } + | F16IMAGE1D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd1D); +#endif + } | IIMAGE1D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2216,6 +2879,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd2D); } + | F16IMAGE2D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd2D); +#endif + } | IIMAGE2D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2231,6 +2902,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd3D); } + | F16IMAGE3D { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd3D); +#endif + } | IIMAGE3D { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2246,6 +2925,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, EsdRect); } + | F16IMAGE2DRECT { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdRect); +#endif + } | IIMAGE2DRECT { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2261,6 +2948,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, EsdCube); } + | F16IMAGECUBE { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdCube); +#endif + } | IIMAGECUBE { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2276,6 +2971,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, EsdBuffer); } + | F16IMAGEBUFFER { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdBuffer); +#endif + } | IIMAGEBUFFER { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2291,6 +2994,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd1D, true); } + | F16IMAGE1DARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd1D, true); +#endif + } | IIMAGE1DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2306,6 +3017,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd2D, true); } + | F16IMAGE2DARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd2D, true); +#endif + } | IIMAGE2DARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2321,6 +3040,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, EsdCube, true); } + | F16IMAGECUBEARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, EsdCube, true); +#endif + } | IIMAGECUBEARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2336,6 +3063,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd2D, false, false, true); } + | F16IMAGE2DMS { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd2D, false, false, true); +#endif + } | IIMAGE2DMS { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2351,6 +3086,14 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setImage(EbtFloat, Esd2D, true, false, true); } + | F16IMAGE2DMSARRAY { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setImage(EbtFloat16, Esd2D, true, false, true); +#endif + } | IIMAGE2DMSARRAY { $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); $$.basicType = EbtSampler; @@ -2379,6 +3122,24 @@ type_specifier_nonarray $$.basicType = EbtSampler; $$.sampler.setSubpass(EbtFloat, true); } + | F16SUBPASSINPUT { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtFloat16); +#endif + } + | F16SUBPASSINPUTMS { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck($1.loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); + $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); + $$.basicType = EbtSampler; + $$.sampler.setSubpass(EbtFloat16, true); +#endif + } | ISUBPASSINPUT { parseContext.requireStage($1.loc, EShLangFragment, "subpass input"); $$.init($1.loc, parseContext.symbolTable.atGlobalLevel()); @@ -2493,12 +3254,15 @@ struct_declaration parseContext.precisionQualifierCheck($1.loc, $1.basicType, $1.qualifier); for (unsigned int i = 0; i < $$->size(); ++i) { - parseContext.arrayDimCheck($1.loc, (*$$)[i].type, $1.arraySizes); - (*$$)[i].type->mergeType($1); + TType type($1); + type.setFieldName((*$$)[i].type->getFieldName()); + type.transferArraySizes((*$$)[i].type->getArraySizes()); + type.copyArrayInnerSizes($1.arraySizes); + parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); + (*$$)[i].type->shallowCopy(type); } } | type_qualifier type_specifier struct_declarator_list SEMICOLON { - parseContext.globalQualifierFixCheck($1.loc, $1.qualifier); if ($2.arraySizes) { parseContext.profileRequires($2.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires($2.loc, EEsProfile, 300, 0, "arrayed type"); @@ -2508,14 +3272,18 @@ struct_declaration $$ = $3; - parseContext.checkNoShaderLayouts($1.loc, $1.shaderQualifiers); + parseContext.memberQualifierCheck($1); parseContext.voidErrorCheck($2.loc, (*$3)[0].type->getFieldName(), $2.basicType); parseContext.mergeQualifiers($2.loc, $2.qualifier, $1.qualifier, true); parseContext.precisionQualifierCheck($2.loc, $2.basicType, $2.qualifier); for (unsigned int i = 0; i < $$->size(); ++i) { - parseContext.arrayDimCheck($1.loc, (*$$)[i].type, $2.arraySizes); - (*$$)[i].type->mergeType($2); + TType type($2); + type.setFieldName((*$$)[i].type->getFieldName()); + type.transferArraySizes((*$$)[i].type->getArraySizes()); + type.copyArrayInnerSizes($2.arraySizes); + parseContext.arrayOfArrayVersionCheck((*$$)[i].loc, type.getArraySizes()); + (*$$)[i].type->shallowCopy(type); } } ; @@ -2537,12 +3305,12 @@ struct_declarator $$.type->setFieldName(*$1.string); } | IDENTIFIER array_specifier { - parseContext.arrayDimCheck($1.loc, $2.arraySizes, 0); + parseContext.arrayOfArrayVersionCheck($1.loc, $2.arraySizes); $$.type = new TType(EbtVoid); $$.loc = $1.loc; $$.type->setFieldName(*$1.string); - $$.type->newArraySizes(*$2.arraySizes); + $$.type->transferArraySizes($2.arraySizes); } ; @@ -2673,6 +3441,15 @@ expression_statement ; selection_statement + : selection_statement_nonattributed { + $$ = $1; + } + | attribute selection_statement_nonattributed { + parseContext.handleSelectionAttributes(*$1, $2); + $$ = $2; + } + +selection_statement_nonattributed : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement { parseContext.boolCheck($1.loc, $3); $$ = parseContext.intermediate.addSelection($3, $5, $1.loc); @@ -2709,6 +3486,15 @@ condition ; switch_statement + : switch_statement_nonattributed { + $$ = $1; + } + | attribute switch_statement_nonattributed { + parseContext.handleSwitchAttributes(*$1, $2); + $$ = $2; + } + +switch_statement_nonattributed : SWITCH LEFT_PAREN expression RIGHT_PAREN { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -2762,6 +3548,15 @@ case_label ; iteration_statement + : iteration_statement_nonattributed { + $$ = $1; + } + | attribute iteration_statement_nonattributed { + parseContext.handleLoopAttributes(*$1, $2); + $$ = $2; + } + +iteration_statement_nonattributed : WHILE LEFT_PAREN { if (! parseContext.limits.whileLoops) parseContext.error($1.loc, "while loops not available", "limitation", ""); @@ -2920,4 +3715,26 @@ function_definition } ; +attribute + : LEFT_BRACKET LEFT_BRACKET attribute_list RIGHT_BRACKET RIGHT_BRACKET { + $$ = $3; + parseContext.requireExtensions($1.loc, 1, &E_GL_EXT_control_flow_attributes, "attribute"); + } + +attribute_list + : single_attribute { + $$ = $1; + } + | attribute_list COMMA single_attribute { + $$ = parseContext.mergeAttributes($1, $3); + } + +single_attribute + : IDENTIFIER { + $$ = parseContext.makeAttributes(*$1.string); + } + | IDENTIFIER LEFT_PAREN constant_expression RIGHT_PAREN { + $$ = parseContext.makeAttributes(*$1.string, $3); + } + %% diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp index 72415681bd2..e57edb573a2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -62,7 +62,7 @@ /* Copy the first part of user declarations. */ -#line 41 "MachineIndependent/glslang.y" /* yacc.c:339 */ +#line 42 "MachineIndependent/glslang.y" /* yacc.c:339 */ /* Based on: @@ -83,17 +83,18 @@ Jutta Degener, 1995 #include "SymbolTable.h" #include "ParseHelper.h" #include "../Public/ShaderLang.h" +#include "attribute.h" using namespace glslang; -#line 91 "MachineIndependent/glslang_tab.cpp" /* yacc.c:339 */ +#line 92 "MachineIndependent/glslang_tab.cpp" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -124,308 +125,416 @@ extern int yydebug; { ATTRIBUTE = 258, VARYING = 259, - CONST = 260, - BOOL = 261, - FLOAT = 262, + FLOAT16_T = 260, + FLOAT = 261, + FLOAT32_T = 262, DOUBLE = 263, - INT = 264, - UINT = 265, - INT64_T = 266, - UINT64_T = 267, - INT16_T = 268, - UINT16_T = 269, - FLOAT16_T = 270, - BREAK = 271, - CONTINUE = 272, - DO = 273, - ELSE = 274, - FOR = 275, - IF = 276, - DISCARD = 277, - RETURN = 278, - SWITCH = 279, - CASE = 280, - DEFAULT = 281, - SUBROUTINE = 282, - BVEC2 = 283, - BVEC3 = 284, - BVEC4 = 285, - IVEC2 = 286, - IVEC3 = 287, - IVEC4 = 288, - I64VEC2 = 289, - I64VEC3 = 290, - I64VEC4 = 291, - UVEC2 = 292, - UVEC3 = 293, - UVEC4 = 294, - U64VEC2 = 295, - U64VEC3 = 296, - U64VEC4 = 297, - VEC2 = 298, - VEC3 = 299, - VEC4 = 300, - MAT2 = 301, - MAT3 = 302, - MAT4 = 303, - CENTROID = 304, - IN = 305, - OUT = 306, - INOUT = 307, - UNIFORM = 308, - PATCH = 309, - SAMPLE = 310, - BUFFER = 311, - SHARED = 312, - COHERENT = 313, - VOLATILE = 314, - RESTRICT = 315, - READONLY = 316, - WRITEONLY = 317, - DVEC2 = 318, - DVEC3 = 319, - DVEC4 = 320, - DMAT2 = 321, - DMAT3 = 322, - DMAT4 = 323, - F16VEC2 = 324, - F16VEC3 = 325, - F16VEC4 = 326, - F16MAT2 = 327, - F16MAT3 = 328, - F16MAT4 = 329, - I16VEC2 = 330, - I16VEC3 = 331, - I16VEC4 = 332, - U16VEC2 = 333, - U16VEC3 = 334, - U16VEC4 = 335, - NOPERSPECTIVE = 336, - FLAT = 337, - SMOOTH = 338, - LAYOUT = 339, - __EXPLICITINTERPAMD = 340, - MAT2X2 = 341, - MAT2X3 = 342, - MAT2X4 = 343, - MAT3X2 = 344, - MAT3X3 = 345, - MAT3X4 = 346, - MAT4X2 = 347, - MAT4X3 = 348, - MAT4X4 = 349, - DMAT2X2 = 350, - DMAT2X3 = 351, - DMAT2X4 = 352, - DMAT3X2 = 353, - DMAT3X3 = 354, - DMAT3X4 = 355, - DMAT4X2 = 356, - DMAT4X3 = 357, - DMAT4X4 = 358, - F16MAT2X2 = 359, - F16MAT2X3 = 360, - F16MAT2X4 = 361, - F16MAT3X2 = 362, - F16MAT3X3 = 363, - F16MAT3X4 = 364, - F16MAT4X2 = 365, - F16MAT4X3 = 366, - F16MAT4X4 = 367, - ATOMIC_UINT = 368, - SAMPLER1D = 369, - SAMPLER2D = 370, - SAMPLER3D = 371, - SAMPLERCUBE = 372, - SAMPLER1DSHADOW = 373, - SAMPLER2DSHADOW = 374, - SAMPLERCUBESHADOW = 375, - SAMPLER1DARRAY = 376, - SAMPLER2DARRAY = 377, - SAMPLER1DARRAYSHADOW = 378, - SAMPLER2DARRAYSHADOW = 379, - ISAMPLER1D = 380, - ISAMPLER2D = 381, - ISAMPLER3D = 382, - ISAMPLERCUBE = 383, - ISAMPLER1DARRAY = 384, - ISAMPLER2DARRAY = 385, - USAMPLER1D = 386, - USAMPLER2D = 387, - USAMPLER3D = 388, - USAMPLERCUBE = 389, - USAMPLER1DARRAY = 390, - USAMPLER2DARRAY = 391, - SAMPLER2DRECT = 392, - SAMPLER2DRECTSHADOW = 393, - ISAMPLER2DRECT = 394, - USAMPLER2DRECT = 395, - SAMPLERBUFFER = 396, - ISAMPLERBUFFER = 397, - USAMPLERBUFFER = 398, - SAMPLERCUBEARRAY = 399, - SAMPLERCUBEARRAYSHADOW = 400, - ISAMPLERCUBEARRAY = 401, - USAMPLERCUBEARRAY = 402, - SAMPLER2DMS = 403, - ISAMPLER2DMS = 404, - USAMPLER2DMS = 405, - SAMPLER2DMSARRAY = 406, - ISAMPLER2DMSARRAY = 407, - USAMPLER2DMSARRAY = 408, - SAMPLEREXTERNALOES = 409, - SAMPLER = 410, - SAMPLERSHADOW = 411, - TEXTURE1D = 412, - TEXTURE2D = 413, - TEXTURE3D = 414, - TEXTURECUBE = 415, - TEXTURE1DARRAY = 416, - TEXTURE2DARRAY = 417, - ITEXTURE1D = 418, - ITEXTURE2D = 419, - ITEXTURE3D = 420, - ITEXTURECUBE = 421, - ITEXTURE1DARRAY = 422, - ITEXTURE2DARRAY = 423, - UTEXTURE1D = 424, - UTEXTURE2D = 425, - UTEXTURE3D = 426, - UTEXTURECUBE = 427, - UTEXTURE1DARRAY = 428, - UTEXTURE2DARRAY = 429, - TEXTURE2DRECT = 430, - ITEXTURE2DRECT = 431, - UTEXTURE2DRECT = 432, - TEXTUREBUFFER = 433, - ITEXTUREBUFFER = 434, - UTEXTUREBUFFER = 435, - TEXTURECUBEARRAY = 436, - ITEXTURECUBEARRAY = 437, - UTEXTURECUBEARRAY = 438, - TEXTURE2DMS = 439, - ITEXTURE2DMS = 440, - UTEXTURE2DMS = 441, - TEXTURE2DMSARRAY = 442, - ITEXTURE2DMSARRAY = 443, - UTEXTURE2DMSARRAY = 444, - SUBPASSINPUT = 445, - SUBPASSINPUTMS = 446, - ISUBPASSINPUT = 447, - ISUBPASSINPUTMS = 448, - USUBPASSINPUT = 449, - USUBPASSINPUTMS = 450, - IMAGE1D = 451, - IIMAGE1D = 452, - UIMAGE1D = 453, - IMAGE2D = 454, - IIMAGE2D = 455, - UIMAGE2D = 456, - IMAGE3D = 457, - IIMAGE3D = 458, - UIMAGE3D = 459, - IMAGE2DRECT = 460, - IIMAGE2DRECT = 461, - UIMAGE2DRECT = 462, - IMAGECUBE = 463, - IIMAGECUBE = 464, - UIMAGECUBE = 465, - IMAGEBUFFER = 466, - IIMAGEBUFFER = 467, - UIMAGEBUFFER = 468, - IMAGE1DARRAY = 469, - IIMAGE1DARRAY = 470, - UIMAGE1DARRAY = 471, - IMAGE2DARRAY = 472, - IIMAGE2DARRAY = 473, - UIMAGE2DARRAY = 474, - IMAGECUBEARRAY = 475, - IIMAGECUBEARRAY = 476, - UIMAGECUBEARRAY = 477, - IMAGE2DMS = 478, - IIMAGE2DMS = 479, - UIMAGE2DMS = 480, - IMAGE2DMSARRAY = 481, - IIMAGE2DMSARRAY = 482, - UIMAGE2DMSARRAY = 483, - STRUCT = 484, - VOID = 485, - WHILE = 486, - IDENTIFIER = 487, - TYPE_NAME = 488, - FLOATCONSTANT = 489, - DOUBLECONSTANT = 490, - INTCONSTANT = 491, - UINTCONSTANT = 492, - INT64CONSTANT = 493, - UINT64CONSTANT = 494, - INT16CONSTANT = 495, - UINT16CONSTANT = 496, - BOOLCONSTANT = 497, - FLOAT16CONSTANT = 498, - LEFT_OP = 499, - RIGHT_OP = 500, - INC_OP = 501, - DEC_OP = 502, - LE_OP = 503, - GE_OP = 504, - EQ_OP = 505, - NE_OP = 506, - AND_OP = 507, - OR_OP = 508, - XOR_OP = 509, - MUL_ASSIGN = 510, - DIV_ASSIGN = 511, - ADD_ASSIGN = 512, - MOD_ASSIGN = 513, - LEFT_ASSIGN = 514, - RIGHT_ASSIGN = 515, - AND_ASSIGN = 516, - XOR_ASSIGN = 517, - OR_ASSIGN = 518, - SUB_ASSIGN = 519, - LEFT_PAREN = 520, - RIGHT_PAREN = 521, - LEFT_BRACKET = 522, - RIGHT_BRACKET = 523, - LEFT_BRACE = 524, - RIGHT_BRACE = 525, - DOT = 526, - COMMA = 527, - COLON = 528, - EQUAL = 529, - SEMICOLON = 530, - BANG = 531, - DASH = 532, - TILDE = 533, - PLUS = 534, - STAR = 535, - SLASH = 536, - PERCENT = 537, - LEFT_ANGLE = 538, - RIGHT_ANGLE = 539, - VERTICAL_BAR = 540, - CARET = 541, - AMPERSAND = 542, - QUESTION = 543, - INVARIANT = 544, - PRECISE = 545, - HIGH_PRECISION = 546, - MEDIUM_PRECISION = 547, - LOW_PRECISION = 548, - PRECISION = 549, - PACKED = 550, - RESOURCE = 551, - SUPERP = 552 + FLOAT64_T = 264, + CONST = 265, + BOOL = 266, + INT = 267, + UINT = 268, + INT64_T = 269, + UINT64_T = 270, + INT32_T = 271, + UINT32_T = 272, + INT16_T = 273, + UINT16_T = 274, + INT8_T = 275, + UINT8_T = 276, + BREAK = 277, + CONTINUE = 278, + DO = 279, + ELSE = 280, + FOR = 281, + IF = 282, + DISCARD = 283, + RETURN = 284, + SWITCH = 285, + CASE = 286, + DEFAULT = 287, + SUBROUTINE = 288, + BVEC2 = 289, + BVEC3 = 290, + BVEC4 = 291, + IVEC2 = 292, + IVEC3 = 293, + IVEC4 = 294, + UVEC2 = 295, + UVEC3 = 296, + UVEC4 = 297, + I64VEC2 = 298, + I64VEC3 = 299, + I64VEC4 = 300, + U64VEC2 = 301, + U64VEC3 = 302, + U64VEC4 = 303, + I32VEC2 = 304, + I32VEC3 = 305, + I32VEC4 = 306, + U32VEC2 = 307, + U32VEC3 = 308, + U32VEC4 = 309, + I16VEC2 = 310, + I16VEC3 = 311, + I16VEC4 = 312, + U16VEC2 = 313, + U16VEC3 = 314, + U16VEC4 = 315, + I8VEC2 = 316, + I8VEC3 = 317, + I8VEC4 = 318, + U8VEC2 = 319, + U8VEC3 = 320, + U8VEC4 = 321, + VEC2 = 322, + VEC3 = 323, + VEC4 = 324, + MAT2 = 325, + MAT3 = 326, + MAT4 = 327, + CENTROID = 328, + IN = 329, + OUT = 330, + INOUT = 331, + UNIFORM = 332, + PATCH = 333, + SAMPLE = 334, + BUFFER = 335, + SHARED = 336, + NONUNIFORM = 337, + PAYLOADNV = 338, + PAYLOADINNV = 339, + HITATTRNV = 340, + CALLDATANV = 341, + CALLDATAINNV = 342, + COHERENT = 343, + VOLATILE = 344, + RESTRICT = 345, + READONLY = 346, + WRITEONLY = 347, + DEVICECOHERENT = 348, + QUEUEFAMILYCOHERENT = 349, + WORKGROUPCOHERENT = 350, + SUBGROUPCOHERENT = 351, + NONPRIVATE = 352, + DVEC2 = 353, + DVEC3 = 354, + DVEC4 = 355, + DMAT2 = 356, + DMAT3 = 357, + DMAT4 = 358, + F16VEC2 = 359, + F16VEC3 = 360, + F16VEC4 = 361, + F16MAT2 = 362, + F16MAT3 = 363, + F16MAT4 = 364, + F32VEC2 = 365, + F32VEC3 = 366, + F32VEC4 = 367, + F32MAT2 = 368, + F32MAT3 = 369, + F32MAT4 = 370, + F64VEC2 = 371, + F64VEC3 = 372, + F64VEC4 = 373, + F64MAT2 = 374, + F64MAT3 = 375, + F64MAT4 = 376, + NOPERSPECTIVE = 377, + FLAT = 378, + SMOOTH = 379, + LAYOUT = 380, + EXPLICITINTERPAMD = 381, + PERVERTEXNV = 382, + PERPRIMITIVENV = 383, + PERVIEWNV = 384, + PERTASKNV = 385, + MAT2X2 = 386, + MAT2X3 = 387, + MAT2X4 = 388, + MAT3X2 = 389, + MAT3X3 = 390, + MAT3X4 = 391, + MAT4X2 = 392, + MAT4X3 = 393, + MAT4X4 = 394, + DMAT2X2 = 395, + DMAT2X3 = 396, + DMAT2X4 = 397, + DMAT3X2 = 398, + DMAT3X3 = 399, + DMAT3X4 = 400, + DMAT4X2 = 401, + DMAT4X3 = 402, + DMAT4X4 = 403, + F16MAT2X2 = 404, + F16MAT2X3 = 405, + F16MAT2X4 = 406, + F16MAT3X2 = 407, + F16MAT3X3 = 408, + F16MAT3X4 = 409, + F16MAT4X2 = 410, + F16MAT4X3 = 411, + F16MAT4X4 = 412, + F32MAT2X2 = 413, + F32MAT2X3 = 414, + F32MAT2X4 = 415, + F32MAT3X2 = 416, + F32MAT3X3 = 417, + F32MAT3X4 = 418, + F32MAT4X2 = 419, + F32MAT4X3 = 420, + F32MAT4X4 = 421, + F64MAT2X2 = 422, + F64MAT2X3 = 423, + F64MAT2X4 = 424, + F64MAT3X2 = 425, + F64MAT3X3 = 426, + F64MAT3X4 = 427, + F64MAT4X2 = 428, + F64MAT4X3 = 429, + F64MAT4X4 = 430, + ATOMIC_UINT = 431, + ACCSTRUCTNV = 432, + SAMPLER1D = 433, + SAMPLER2D = 434, + SAMPLER3D = 435, + SAMPLERCUBE = 436, + SAMPLER1DSHADOW = 437, + SAMPLER2DSHADOW = 438, + SAMPLERCUBESHADOW = 439, + SAMPLER1DARRAY = 440, + SAMPLER2DARRAY = 441, + SAMPLER1DARRAYSHADOW = 442, + SAMPLER2DARRAYSHADOW = 443, + ISAMPLER1D = 444, + ISAMPLER2D = 445, + ISAMPLER3D = 446, + ISAMPLERCUBE = 447, + ISAMPLER1DARRAY = 448, + ISAMPLER2DARRAY = 449, + USAMPLER1D = 450, + USAMPLER2D = 451, + USAMPLER3D = 452, + USAMPLERCUBE = 453, + USAMPLER1DARRAY = 454, + USAMPLER2DARRAY = 455, + SAMPLER2DRECT = 456, + SAMPLER2DRECTSHADOW = 457, + ISAMPLER2DRECT = 458, + USAMPLER2DRECT = 459, + SAMPLERBUFFER = 460, + ISAMPLERBUFFER = 461, + USAMPLERBUFFER = 462, + SAMPLERCUBEARRAY = 463, + SAMPLERCUBEARRAYSHADOW = 464, + ISAMPLERCUBEARRAY = 465, + USAMPLERCUBEARRAY = 466, + SAMPLER2DMS = 467, + ISAMPLER2DMS = 468, + USAMPLER2DMS = 469, + SAMPLER2DMSARRAY = 470, + ISAMPLER2DMSARRAY = 471, + USAMPLER2DMSARRAY = 472, + SAMPLEREXTERNALOES = 473, + F16SAMPLER1D = 474, + F16SAMPLER2D = 475, + F16SAMPLER3D = 476, + F16SAMPLER2DRECT = 477, + F16SAMPLERCUBE = 478, + F16SAMPLER1DARRAY = 479, + F16SAMPLER2DARRAY = 480, + F16SAMPLERCUBEARRAY = 481, + F16SAMPLERBUFFER = 482, + F16SAMPLER2DMS = 483, + F16SAMPLER2DMSARRAY = 484, + F16SAMPLER1DSHADOW = 485, + F16SAMPLER2DSHADOW = 486, + F16SAMPLER1DARRAYSHADOW = 487, + F16SAMPLER2DARRAYSHADOW = 488, + F16SAMPLER2DRECTSHADOW = 489, + F16SAMPLERCUBESHADOW = 490, + F16SAMPLERCUBEARRAYSHADOW = 491, + SAMPLER = 492, + SAMPLERSHADOW = 493, + TEXTURE1D = 494, + TEXTURE2D = 495, + TEXTURE3D = 496, + TEXTURECUBE = 497, + TEXTURE1DARRAY = 498, + TEXTURE2DARRAY = 499, + ITEXTURE1D = 500, + ITEXTURE2D = 501, + ITEXTURE3D = 502, + ITEXTURECUBE = 503, + ITEXTURE1DARRAY = 504, + ITEXTURE2DARRAY = 505, + UTEXTURE1D = 506, + UTEXTURE2D = 507, + UTEXTURE3D = 508, + UTEXTURECUBE = 509, + UTEXTURE1DARRAY = 510, + UTEXTURE2DARRAY = 511, + TEXTURE2DRECT = 512, + ITEXTURE2DRECT = 513, + UTEXTURE2DRECT = 514, + TEXTUREBUFFER = 515, + ITEXTUREBUFFER = 516, + UTEXTUREBUFFER = 517, + TEXTURECUBEARRAY = 518, + ITEXTURECUBEARRAY = 519, + UTEXTURECUBEARRAY = 520, + TEXTURE2DMS = 521, + ITEXTURE2DMS = 522, + UTEXTURE2DMS = 523, + TEXTURE2DMSARRAY = 524, + ITEXTURE2DMSARRAY = 525, + UTEXTURE2DMSARRAY = 526, + F16TEXTURE1D = 527, + F16TEXTURE2D = 528, + F16TEXTURE3D = 529, + F16TEXTURE2DRECT = 530, + F16TEXTURECUBE = 531, + F16TEXTURE1DARRAY = 532, + F16TEXTURE2DARRAY = 533, + F16TEXTURECUBEARRAY = 534, + F16TEXTUREBUFFER = 535, + F16TEXTURE2DMS = 536, + F16TEXTURE2DMSARRAY = 537, + SUBPASSINPUT = 538, + SUBPASSINPUTMS = 539, + ISUBPASSINPUT = 540, + ISUBPASSINPUTMS = 541, + USUBPASSINPUT = 542, + USUBPASSINPUTMS = 543, + F16SUBPASSINPUT = 544, + F16SUBPASSINPUTMS = 545, + IMAGE1D = 546, + IIMAGE1D = 547, + UIMAGE1D = 548, + IMAGE2D = 549, + IIMAGE2D = 550, + UIMAGE2D = 551, + IMAGE3D = 552, + IIMAGE3D = 553, + UIMAGE3D = 554, + IMAGE2DRECT = 555, + IIMAGE2DRECT = 556, + UIMAGE2DRECT = 557, + IMAGECUBE = 558, + IIMAGECUBE = 559, + UIMAGECUBE = 560, + IMAGEBUFFER = 561, + IIMAGEBUFFER = 562, + UIMAGEBUFFER = 563, + IMAGE1DARRAY = 564, + IIMAGE1DARRAY = 565, + UIMAGE1DARRAY = 566, + IMAGE2DARRAY = 567, + IIMAGE2DARRAY = 568, + UIMAGE2DARRAY = 569, + IMAGECUBEARRAY = 570, + IIMAGECUBEARRAY = 571, + UIMAGECUBEARRAY = 572, + IMAGE2DMS = 573, + IIMAGE2DMS = 574, + UIMAGE2DMS = 575, + IMAGE2DMSARRAY = 576, + IIMAGE2DMSARRAY = 577, + UIMAGE2DMSARRAY = 578, + F16IMAGE1D = 579, + F16IMAGE2D = 580, + F16IMAGE3D = 581, + F16IMAGE2DRECT = 582, + F16IMAGECUBE = 583, + F16IMAGE1DARRAY = 584, + F16IMAGE2DARRAY = 585, + F16IMAGECUBEARRAY = 586, + F16IMAGEBUFFER = 587, + F16IMAGE2DMS = 588, + F16IMAGE2DMSARRAY = 589, + STRUCT = 590, + VOID = 591, + WHILE = 592, + IDENTIFIER = 593, + TYPE_NAME = 594, + FLOATCONSTANT = 595, + DOUBLECONSTANT = 596, + INT16CONSTANT = 597, + UINT16CONSTANT = 598, + INT32CONSTANT = 599, + UINT32CONSTANT = 600, + INTCONSTANT = 601, + UINTCONSTANT = 602, + INT64CONSTANT = 603, + UINT64CONSTANT = 604, + BOOLCONSTANT = 605, + FLOAT16CONSTANT = 606, + LEFT_OP = 607, + RIGHT_OP = 608, + INC_OP = 609, + DEC_OP = 610, + LE_OP = 611, + GE_OP = 612, + EQ_OP = 613, + NE_OP = 614, + AND_OP = 615, + OR_OP = 616, + XOR_OP = 617, + MUL_ASSIGN = 618, + DIV_ASSIGN = 619, + ADD_ASSIGN = 620, + MOD_ASSIGN = 621, + LEFT_ASSIGN = 622, + RIGHT_ASSIGN = 623, + AND_ASSIGN = 624, + XOR_ASSIGN = 625, + OR_ASSIGN = 626, + SUB_ASSIGN = 627, + LEFT_PAREN = 628, + RIGHT_PAREN = 629, + LEFT_BRACKET = 630, + RIGHT_BRACKET = 631, + LEFT_BRACE = 632, + RIGHT_BRACE = 633, + DOT = 634, + COMMA = 635, + COLON = 636, + EQUAL = 637, + SEMICOLON = 638, + BANG = 639, + DASH = 640, + TILDE = 641, + PLUS = 642, + STAR = 643, + SLASH = 644, + PERCENT = 645, + LEFT_ANGLE = 646, + RIGHT_ANGLE = 647, + VERTICAL_BAR = 648, + CARET = 649, + AMPERSAND = 650, + QUESTION = 651, + INVARIANT = 652, + PRECISE = 653, + HIGH_PRECISION = 654, + MEDIUM_PRECISION = 655, + LOW_PRECISION = 656, + PRECISION = 657, + PACKED = 658, + RESOURCE = 659, + SUPERP = 660 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 68 "MachineIndependent/glslang.y" /* yacc.c:355 */ +#line 70 "MachineIndependent/glslang.y" /* yacc.c:355 */ struct { glslang::TSourceLoc loc; @@ -447,6 +556,7 @@ union YYSTYPE TIntermNode* intermNode; glslang::TIntermNodePair nodePair; glslang::TIntermTyped* intermTypedNode; + glslang::TAttributes* attributes; }; union { glslang::TPublicType type; @@ -459,8 +569,10 @@ union YYSTYPE }; } interm; -#line 463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ +#line 573 "MachineIndependent/glslang_tab.cpp" /* yacc.c:355 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif @@ -472,7 +584,7 @@ int yyparse (glslang::TParseContext* pParseContext); #endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */ /* Copy the second part of user declarations. */ -#line 102 "MachineIndependent/glslang.y" /* yacc.c:358 */ +#line 105 "MachineIndependent/glslang.y" /* yacc.c:358 */ /* windows only pragma */ @@ -488,7 +600,7 @@ int yyparse (glslang::TParseContext* pParseContext); extern int yylex(YYSTYPE*, TParseContext&); -#line 492 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ +#line 604 "MachineIndependent/glslang_tab.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -545,11 +657,30 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif @@ -709,23 +840,23 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 274 +#define YYFINAL 381 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 6614 +#define YYLAST 9294 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 298 +#define YYNTOKENS 406 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 100 +#define YYNNTS 107 /* YYNRULES -- Number of rules. */ -#define YYNRULES 450 +#define YYNRULES 571 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 582 +#define YYNSTATES 712 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 552 +#define YYMAXUTOK 660 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -789,59 +920,82 @@ static const yytype_uint16 yytranslate[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297 + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 253, 253, 259, 262, 265, 269, 273, 277, 283, - 289, 292, 296, 302, 305, 313, 316, 319, 322, 325, - 330, 338, 345, 352, 358, 362, 369, 372, 378, 385, - 395, 403, 408, 438, 444, 448, 452, 472, 473, 474, - 475, 481, 482, 487, 492, 501, 502, 507, 515, 516, - 522, 531, 532, 537, 542, 547, 555, 556, 564, 575, - 576, 585, 586, 595, 596, 605, 606, 614, 615, 623, - 624, 632, 633, 633, 651, 652, 667, 671, 675, 679, - 684, 688, 692, 696, 700, 704, 708, 715, 718, 729, - 736, 741, 746, 754, 758, 762, 766, 771, 776, 785, - 785, 796, 800, 807, 814, 817, 824, 832, 852, 875, - 890, 913, 924, 934, 944, 954, 963, 966, 970, 974, - 979, 987, 992, 997, 1002, 1007, 1016, 1027, 1054, 1063, - 1070, 1077, 1084, 1096, 1102, 1105, 1112, 1116, 1120, 1128, - 1137, 1140, 1151, 1154, 1157, 1161, 1165, 1169, 1176, 1180, - 1192, 1206, 1211, 1217, 1223, 1230, 1236, 1241, 1246, 1251, - 1259, 1263, 1267, 1271, 1275, 1279, 1285, 1294, 1297, 1305, - 1309, 1318, 1323, 1331, 1335, 1345, 1349, 1353, 1358, 1365, - 1369, 1374, 1379, 1384, 1391, 1398, 1402, 1407, 1412, 1417, - 1423, 1429, 1435, 1443, 1451, 1459, 1464, 1469, 1474, 1479, - 1484, 1489, 1495, 1501, 1507, 1515, 1523, 1531, 1537, 1543, - 1549, 1555, 1561, 1567, 1575, 1583, 1591, 1596, 1601, 1606, - 1611, 1616, 1621, 1626, 1631, 1636, 1641, 1646, 1651, 1657, - 1663, 1669, 1675, 1681, 1687, 1693, 1699, 1705, 1711, 1717, - 1723, 1731, 1739, 1747, 1755, 1763, 1771, 1779, 1787, 1795, - 1803, 1811, 1819, 1824, 1829, 1834, 1839, 1844, 1849, 1854, - 1859, 1864, 1869, 1874, 1879, 1884, 1889, 1894, 1899, 1904, - 1909, 1914, 1919, 1924, 1929, 1934, 1939, 1944, 1949, 1954, - 1959, 1964, 1969, 1974, 1979, 1984, 1989, 1994, 1999, 2004, - 2009, 2014, 2019, 2024, 2029, 2034, 2039, 2044, 2049, 2054, - 2059, 2064, 2069, 2074, 2079, 2084, 2089, 2094, 2099, 2104, - 2109, 2114, 2119, 2124, 2129, 2134, 2139, 2144, 2149, 2154, - 2159, 2164, 2169, 2174, 2179, 2184, 2189, 2194, 2199, 2204, - 2209, 2214, 2219, 2224, 2229, 2234, 2239, 2244, 2249, 2254, - 2259, 2264, 2269, 2274, 2279, 2284, 2289, 2294, 2299, 2304, - 2309, 2314, 2319, 2324, 2329, 2334, 2339, 2344, 2349, 2354, - 2359, 2364, 2370, 2376, 2382, 2388, 2394, 2400, 2406, 2411, - 2427, 2432, 2437, 2445, 2445, 2456, 2456, 2466, 2469, 2482, - 2500, 2524, 2528, 2534, 2539, 2550, 2553, 2559, 2568, 2571, - 2577, 2581, 2582, 2588, 2589, 2590, 2591, 2592, 2593, 2594, - 2598, 2599, 2603, 2599, 2615, 2616, 2620, 2620, 2627, 2627, - 2641, 2644, 2652, 2660, 2671, 2672, 2676, 2683, 2687, 2695, - 2699, 2712, 2712, 2732, 2735, 2741, 2753, 2765, 2765, 2780, - 2780, 2796, 2796, 2817, 2820, 2826, 2829, 2835, 2839, 2846, - 2851, 2856, 2863, 2866, 2875, 2879, 2888, 2891, 2894, 2902, - 2902 + 0, 294, 294, 300, 303, 307, 311, 314, 318, 322, + 326, 330, 334, 337, 341, 345, 348, 356, 359, 362, + 365, 368, 373, 381, 388, 395, 401, 405, 412, 415, + 421, 428, 438, 446, 451, 478, 486, 492, 496, 500, + 520, 521, 522, 523, 529, 530, 535, 540, 549, 550, + 555, 563, 564, 570, 579, 580, 585, 590, 595, 603, + 604, 612, 623, 624, 633, 634, 643, 644, 653, 654, + 662, 663, 671, 672, 680, 681, 681, 699, 700, 716, + 720, 724, 728, 733, 737, 741, 745, 749, 753, 757, + 764, 767, 778, 785, 790, 795, 803, 807, 811, 815, + 820, 825, 834, 834, 845, 849, 856, 863, 866, 873, + 881, 901, 924, 939, 964, 975, 985, 995, 1005, 1014, + 1017, 1021, 1025, 1030, 1038, 1043, 1048, 1053, 1058, 1067, + 1078, 1105, 1114, 1121, 1128, 1139, 1148, 1158, 1170, 1179, + 1191, 1197, 1200, 1207, 1211, 1215, 1223, 1232, 1235, 1246, + 1249, 1252, 1256, 1260, 1264, 1268, 1274, 1278, 1290, 1304, + 1309, 1315, 1321, 1328, 1334, 1339, 1344, 1349, 1359, 1369, + 1379, 1389, 1398, 1410, 1414, 1419, 1424, 1429, 1434, 1439, + 1443, 1447, 1451, 1455, 1461, 1470, 1477, 1480, 1488, 1492, + 1501, 1506, 1514, 1518, 1528, 1532, 1536, 1541, 1546, 1551, + 1556, 1560, 1565, 1570, 1575, 1580, 1585, 1590, 1595, 1600, + 1605, 1609, 1614, 1619, 1624, 1630, 1636, 1642, 1648, 1654, + 1660, 1666, 1672, 1678, 1684, 1690, 1696, 1701, 1706, 1711, + 1716, 1721, 1726, 1732, 1738, 1744, 1750, 1756, 1762, 1768, + 1774, 1780, 1786, 1792, 1798, 1804, 1810, 1816, 1822, 1828, + 1834, 1840, 1846, 1852, 1858, 1864, 1870, 1876, 1882, 1888, + 1893, 1898, 1903, 1908, 1913, 1918, 1923, 1928, 1933, 1938, + 1943, 1948, 1954, 1960, 1966, 1972, 1978, 1984, 1990, 1996, + 2002, 2008, 2014, 2020, 2026, 2032, 2038, 2044, 2050, 2056, + 2062, 2068, 2074, 2080, 2086, 2092, 2098, 2104, 2110, 2116, + 2122, 2128, 2134, 2140, 2146, 2152, 2158, 2164, 2170, 2176, + 2182, 2188, 2194, 2200, 2206, 2212, 2218, 2224, 2230, 2236, + 2242, 2247, 2252, 2257, 2262, 2267, 2272, 2277, 2282, 2287, + 2292, 2297, 2302, 2307, 2312, 2320, 2328, 2336, 2344, 2352, + 2360, 2368, 2376, 2384, 2392, 2400, 2408, 2416, 2421, 2426, + 2431, 2436, 2441, 2446, 2451, 2456, 2461, 2466, 2471, 2476, + 2481, 2486, 2491, 2496, 2504, 2512, 2517, 2522, 2527, 2535, + 2540, 2545, 2550, 2558, 2563, 2568, 2573, 2581, 2586, 2591, + 2596, 2601, 2606, 2614, 2619, 2627, 2632, 2640, 2645, 2653, + 2658, 2666, 2671, 2679, 2684, 2692, 2697, 2702, 2707, 2712, + 2717, 2722, 2727, 2732, 2737, 2742, 2747, 2752, 2757, 2762, + 2767, 2775, 2780, 2785, 2790, 2798, 2803, 2808, 2813, 2821, + 2826, 2831, 2836, 2844, 2849, 2854, 2859, 2867, 2872, 2877, + 2882, 2890, 2895, 2900, 2905, 2913, 2918, 2923, 2928, 2936, + 2941, 2946, 2951, 2959, 2964, 2969, 2974, 2982, 2987, 2992, + 2997, 3005, 3010, 3015, 3020, 3028, 3033, 3038, 3043, 3051, + 3056, 3061, 3066, 3074, 3079, 3084, 3089, 3097, 3102, 3107, + 3113, 3119, 3125, 3134, 3143, 3149, 3155, 3161, 3167, 3172, + 3188, 3193, 3198, 3206, 3206, 3217, 3217, 3227, 3230, 3243, + 3265, 3292, 3296, 3302, 3307, 3318, 3321, 3327, 3336, 3339, + 3345, 3349, 3350, 3356, 3357, 3358, 3359, 3360, 3361, 3362, + 3366, 3367, 3371, 3367, 3383, 3384, 3388, 3388, 3395, 3395, + 3409, 3412, 3420, 3428, 3439, 3440, 3444, 3447, 3453, 3460, + 3464, 3472, 3476, 3489, 3492, 3498, 3498, 3518, 3521, 3527, + 3539, 3551, 3554, 3560, 3560, 3575, 3575, 3591, 3591, 3612, + 3615, 3621, 3624, 3630, 3634, 3641, 3646, 3651, 3658, 3661, + 3670, 3674, 3683, 3686, 3689, 3697, 3697, 3719, 3725, 3728, + 3733, 3736 }; #endif @@ -850,55 +1004,82 @@ static const yytype_uint16 yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - "$end", "error", "$undefined", "ATTRIBUTE", "VARYING", "CONST", "BOOL", - "FLOAT", "DOUBLE", "INT", "UINT", "INT64_T", "UINT64_T", "INT16_T", - "UINT16_T", "FLOAT16_T", "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", - "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", "SUBROUTINE", "BVEC2", - "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", "I64VEC2", "I64VEC3", - "I64VEC4", "UVEC2", "UVEC3", "UVEC4", "U64VEC2", "U64VEC3", "U64VEC4", - "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "CENTROID", "IN", "OUT", - "INOUT", "UNIFORM", "PATCH", "SAMPLE", "BUFFER", "SHARED", "COHERENT", - "VOLATILE", "RESTRICT", "READONLY", "WRITEONLY", "DVEC2", "DVEC3", + "$end", "error", "$undefined", "ATTRIBUTE", "VARYING", "FLOAT16_T", + "FLOAT", "FLOAT32_T", "DOUBLE", "FLOAT64_T", "CONST", "BOOL", "INT", + "UINT", "INT64_T", "UINT64_T", "INT32_T", "UINT32_T", "INT16_T", + "UINT16_T", "INT8_T", "UINT8_T", "BREAK", "CONTINUE", "DO", "ELSE", + "FOR", "IF", "DISCARD", "RETURN", "SWITCH", "CASE", "DEFAULT", + "SUBROUTINE", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3", "IVEC4", + "UVEC2", "UVEC3", "UVEC4", "I64VEC2", "I64VEC3", "I64VEC4", "U64VEC2", + "U64VEC3", "U64VEC4", "I32VEC2", "I32VEC3", "I32VEC4", "U32VEC2", + "U32VEC3", "U32VEC4", "I16VEC2", "I16VEC3", "I16VEC4", "U16VEC2", + "U16VEC3", "U16VEC4", "I8VEC2", "I8VEC3", "I8VEC4", "U8VEC2", "U8VEC3", + "U8VEC4", "VEC2", "VEC3", "VEC4", "MAT2", "MAT3", "MAT4", "CENTROID", + "IN", "OUT", "INOUT", "UNIFORM", "PATCH", "SAMPLE", "BUFFER", "SHARED", + "NONUNIFORM", "PAYLOADNV", "PAYLOADINNV", "HITATTRNV", "CALLDATANV", + "CALLDATAINNV", "COHERENT", "VOLATILE", "RESTRICT", "READONLY", + "WRITEONLY", "DEVICECOHERENT", "QUEUEFAMILYCOHERENT", + "WORKGROUPCOHERENT", "SUBGROUPCOHERENT", "NONPRIVATE", "DVEC2", "DVEC3", "DVEC4", "DMAT2", "DMAT3", "DMAT4", "F16VEC2", "F16VEC3", "F16VEC4", - "F16MAT2", "F16MAT3", "F16MAT4", "I16VEC2", "I16VEC3", "I16VEC4", - "U16VEC2", "U16VEC3", "U16VEC4", "NOPERSPECTIVE", "FLAT", "SMOOTH", - "LAYOUT", "__EXPLICITINTERPAMD", "MAT2X2", "MAT2X3", "MAT2X4", "MAT3X2", + "F16MAT2", "F16MAT3", "F16MAT4", "F32VEC2", "F32VEC3", "F32VEC4", + "F32MAT2", "F32MAT3", "F32MAT4", "F64VEC2", "F64VEC3", "F64VEC4", + "F64MAT2", "F64MAT3", "F64MAT4", "NOPERSPECTIVE", "FLAT", "SMOOTH", + "LAYOUT", "EXPLICITINTERPAMD", "PERVERTEXNV", "PERPRIMITIVENV", + "PERVIEWNV", "PERTASKNV", "MAT2X2", "MAT2X3", "MAT2X4", "MAT3X2", "MAT3X3", "MAT3X4", "MAT4X2", "MAT4X3", "MAT4X4", "DMAT2X2", "DMAT2X3", "DMAT2X4", "DMAT3X2", "DMAT3X3", "DMAT3X4", "DMAT4X2", "DMAT4X3", "DMAT4X4", "F16MAT2X2", "F16MAT2X3", "F16MAT2X4", "F16MAT3X2", "F16MAT3X3", "F16MAT3X4", "F16MAT4X2", "F16MAT4X3", "F16MAT4X4", - "ATOMIC_UINT", "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", - "SAMPLER1DSHADOW", "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", - "SAMPLER1DARRAY", "SAMPLER2DARRAY", "SAMPLER1DARRAYSHADOW", - "SAMPLER2DARRAYSHADOW", "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", - "ISAMPLERCUBE", "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", - "USAMPLER2D", "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", - "USAMPLER2DARRAY", "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", - "ISAMPLER2DRECT", "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", - "USAMPLERBUFFER", "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", - "ISAMPLERCUBEARRAY", "USAMPLERCUBEARRAY", "SAMPLER2DMS", "ISAMPLER2DMS", - "USAMPLER2DMS", "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", - "USAMPLER2DMSARRAY", "SAMPLEREXTERNALOES", "SAMPLER", "SAMPLERSHADOW", - "TEXTURE1D", "TEXTURE2D", "TEXTURE3D", "TEXTURECUBE", "TEXTURE1DARRAY", - "TEXTURE2DARRAY", "ITEXTURE1D", "ITEXTURE2D", "ITEXTURE3D", - "ITEXTURECUBE", "ITEXTURE1DARRAY", "ITEXTURE2DARRAY", "UTEXTURE1D", - "UTEXTURE2D", "UTEXTURE3D", "UTEXTURECUBE", "UTEXTURE1DARRAY", - "UTEXTURE2DARRAY", "TEXTURE2DRECT", "ITEXTURE2DRECT", "UTEXTURE2DRECT", - "TEXTUREBUFFER", "ITEXTUREBUFFER", "UTEXTUREBUFFER", "TEXTURECUBEARRAY", - "ITEXTURECUBEARRAY", "UTEXTURECUBEARRAY", "TEXTURE2DMS", "ITEXTURE2DMS", - "UTEXTURE2DMS", "TEXTURE2DMSARRAY", "ITEXTURE2DMSARRAY", - "UTEXTURE2DMSARRAY", "SUBPASSINPUT", "SUBPASSINPUTMS", "ISUBPASSINPUT", - "ISUBPASSINPUTMS", "USUBPASSINPUT", "USUBPASSINPUTMS", "IMAGE1D", - "IIMAGE1D", "UIMAGE1D", "IMAGE2D", "IIMAGE2D", "UIMAGE2D", "IMAGE3D", - "IIMAGE3D", "UIMAGE3D", "IMAGE2DRECT", "IIMAGE2DRECT", "UIMAGE2DRECT", - "IMAGECUBE", "IIMAGECUBE", "UIMAGECUBE", "IMAGEBUFFER", "IIMAGEBUFFER", - "UIMAGEBUFFER", "IMAGE1DARRAY", "IIMAGE1DARRAY", "UIMAGE1DARRAY", - "IMAGE2DARRAY", "IIMAGE2DARRAY", "UIMAGE2DARRAY", "IMAGECUBEARRAY", - "IIMAGECUBEARRAY", "UIMAGECUBEARRAY", "IMAGE2DMS", "IIMAGE2DMS", - "UIMAGE2DMS", "IMAGE2DMSARRAY", "IIMAGE2DMSARRAY", "UIMAGE2DMSARRAY", - "STRUCT", "VOID", "WHILE", "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", - "DOUBLECONSTANT", "INTCONSTANT", "UINTCONSTANT", "INT64CONSTANT", - "UINT64CONSTANT", "INT16CONSTANT", "UINT16CONSTANT", "BOOLCONSTANT", + "F32MAT2X2", "F32MAT2X3", "F32MAT2X4", "F32MAT3X2", "F32MAT3X3", + "F32MAT3X4", "F32MAT4X2", "F32MAT4X3", "F32MAT4X4", "F64MAT2X2", + "F64MAT2X3", "F64MAT2X4", "F64MAT3X2", "F64MAT3X3", "F64MAT3X4", + "F64MAT4X2", "F64MAT4X3", "F64MAT4X4", "ATOMIC_UINT", "ACCSTRUCTNV", + "SAMPLER1D", "SAMPLER2D", "SAMPLER3D", "SAMPLERCUBE", "SAMPLER1DSHADOW", + "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", "SAMPLER1DARRAY", + "SAMPLER2DARRAY", "SAMPLER1DARRAYSHADOW", "SAMPLER2DARRAYSHADOW", + "ISAMPLER1D", "ISAMPLER2D", "ISAMPLER3D", "ISAMPLERCUBE", + "ISAMPLER1DARRAY", "ISAMPLER2DARRAY", "USAMPLER1D", "USAMPLER2D", + "USAMPLER3D", "USAMPLERCUBE", "USAMPLER1DARRAY", "USAMPLER2DARRAY", + "SAMPLER2DRECT", "SAMPLER2DRECTSHADOW", "ISAMPLER2DRECT", + "USAMPLER2DRECT", "SAMPLERBUFFER", "ISAMPLERBUFFER", "USAMPLERBUFFER", + "SAMPLERCUBEARRAY", "SAMPLERCUBEARRAYSHADOW", "ISAMPLERCUBEARRAY", + "USAMPLERCUBEARRAY", "SAMPLER2DMS", "ISAMPLER2DMS", "USAMPLER2DMS", + "SAMPLER2DMSARRAY", "ISAMPLER2DMSARRAY", "USAMPLER2DMSARRAY", + "SAMPLEREXTERNALOES", "F16SAMPLER1D", "F16SAMPLER2D", "F16SAMPLER3D", + "F16SAMPLER2DRECT", "F16SAMPLERCUBE", "F16SAMPLER1DARRAY", + "F16SAMPLER2DARRAY", "F16SAMPLERCUBEARRAY", "F16SAMPLERBUFFER", + "F16SAMPLER2DMS", "F16SAMPLER2DMSARRAY", "F16SAMPLER1DSHADOW", + "F16SAMPLER2DSHADOW", "F16SAMPLER1DARRAYSHADOW", + "F16SAMPLER2DARRAYSHADOW", "F16SAMPLER2DRECTSHADOW", + "F16SAMPLERCUBESHADOW", "F16SAMPLERCUBEARRAYSHADOW", "SAMPLER", + "SAMPLERSHADOW", "TEXTURE1D", "TEXTURE2D", "TEXTURE3D", "TEXTURECUBE", + "TEXTURE1DARRAY", "TEXTURE2DARRAY", "ITEXTURE1D", "ITEXTURE2D", + "ITEXTURE3D", "ITEXTURECUBE", "ITEXTURE1DARRAY", "ITEXTURE2DARRAY", + "UTEXTURE1D", "UTEXTURE2D", "UTEXTURE3D", "UTEXTURECUBE", + "UTEXTURE1DARRAY", "UTEXTURE2DARRAY", "TEXTURE2DRECT", "ITEXTURE2DRECT", + "UTEXTURE2DRECT", "TEXTUREBUFFER", "ITEXTUREBUFFER", "UTEXTUREBUFFER", + "TEXTURECUBEARRAY", "ITEXTURECUBEARRAY", "UTEXTURECUBEARRAY", + "TEXTURE2DMS", "ITEXTURE2DMS", "UTEXTURE2DMS", "TEXTURE2DMSARRAY", + "ITEXTURE2DMSARRAY", "UTEXTURE2DMSARRAY", "F16TEXTURE1D", "F16TEXTURE2D", + "F16TEXTURE3D", "F16TEXTURE2DRECT", "F16TEXTURECUBE", + "F16TEXTURE1DARRAY", "F16TEXTURE2DARRAY", "F16TEXTURECUBEARRAY", + "F16TEXTUREBUFFER", "F16TEXTURE2DMS", "F16TEXTURE2DMSARRAY", + "SUBPASSINPUT", "SUBPASSINPUTMS", "ISUBPASSINPUT", "ISUBPASSINPUTMS", + "USUBPASSINPUT", "USUBPASSINPUTMS", "F16SUBPASSINPUT", + "F16SUBPASSINPUTMS", "IMAGE1D", "IIMAGE1D", "UIMAGE1D", "IMAGE2D", + "IIMAGE2D", "UIMAGE2D", "IMAGE3D", "IIMAGE3D", "UIMAGE3D", "IMAGE2DRECT", + "IIMAGE2DRECT", "UIMAGE2DRECT", "IMAGECUBE", "IIMAGECUBE", "UIMAGECUBE", + "IMAGEBUFFER", "IIMAGEBUFFER", "UIMAGEBUFFER", "IMAGE1DARRAY", + "IIMAGE1DARRAY", "UIMAGE1DARRAY", "IMAGE2DARRAY", "IIMAGE2DARRAY", + "UIMAGE2DARRAY", "IMAGECUBEARRAY", "IIMAGECUBEARRAY", "UIMAGECUBEARRAY", + "IMAGE2DMS", "IIMAGE2DMS", "UIMAGE2DMS", "IMAGE2DMSARRAY", + "IIMAGE2DMSARRAY", "UIMAGE2DMSARRAY", "F16IMAGE1D", "F16IMAGE2D", + "F16IMAGE3D", "F16IMAGE2DRECT", "F16IMAGECUBE", "F16IMAGE1DARRAY", + "F16IMAGE2DARRAY", "F16IMAGECUBEARRAY", "F16IMAGEBUFFER", "F16IMAGE2DMS", + "F16IMAGE2DMSARRAY", "STRUCT", "VOID", "WHILE", "IDENTIFIER", + "TYPE_NAME", "FLOATCONSTANT", "DOUBLECONSTANT", "INT16CONSTANT", + "UINT16CONSTANT", "INT32CONSTANT", "UINT32CONSTANT", "INTCONSTANT", + "UINTCONSTANT", "INT64CONSTANT", "UINT64CONSTANT", "BOOLCONSTANT", "FLOAT16CONSTANT", "LEFT_OP", "RIGHT_OP", "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN", "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", @@ -928,20 +1109,24 @@ static const char *const yytname[] = "fully_specified_type", "invariant_qualifier", "interpolation_qualifier", "layout_qualifier", "layout_qualifier_id_list", "layout_qualifier_id", "precise_qualifier", "type_qualifier", "single_type_qualifier", - "storage_qualifier", "type_name_list", "type_specifier", - "array_specifier", "type_specifier_nonarray", "precision_qualifier", - "struct_specifier", "$@3", "$@4", "struct_declaration_list", - "struct_declaration", "struct_declarator_list", "struct_declarator", - "initializer", "initializer_list", "declaration_statement", "statement", + "storage_qualifier", "non_uniform_qualifier", "type_name_list", + "type_specifier", "array_specifier", "type_specifier_nonarray", + "precision_qualifier", "struct_specifier", "$@3", "$@4", + "struct_declaration_list", "struct_declaration", + "struct_declarator_list", "struct_declarator", "initializer", + "initializer_list", "declaration_statement", "statement", "simple_statement", "compound_statement", "$@5", "$@6", "statement_no_new_scope", "statement_scoped", "$@7", "$@8", "compound_statement_no_new_scope", "statement_list", "expression_statement", "selection_statement", - "selection_rest_statement", "condition", "switch_statement", "$@9", - "switch_statement_list", "case_label", "iteration_statement", "$@10", - "$@11", "$@12", "for_init_statement", "conditionopt", - "for_rest_statement", "jump_statement", "translation_unit", - "external_declaration", "function_definition", "$@13", YY_NULL + "selection_statement_nonattributed", "selection_rest_statement", + "condition", "switch_statement", "switch_statement_nonattributed", "$@9", + "switch_statement_list", "case_label", "iteration_statement", + "iteration_statement_nonattributed", "$@10", "$@11", "$@12", + "for_init_statement", "conditionopt", "for_rest_statement", + "jump_statement", "translation_unit", "external_declaration", + "function_definition", "$@13", "attribute", "attribute_list", + "single_attribute", YY_NULLPTR }; #endif @@ -979,16 +1164,27 @@ static const yytype_uint16 yytoknum[] = 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, - 545, 546, 547, 548, 549, 550, 551, 552 + 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, + 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, + 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, + 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, + 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, + 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, + 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, + 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, + 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, + 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, + 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, + 655, 656, 657, 658, 659, 660 }; # endif -#define YYPACT_NINF -525 +#define YYPACT_NINF -649 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-525))) + (!!((Yystate) == (-649))) -#define YYTABLE_NINF -407 +#define YYTABLE_NINF -517 #define yytable_value_is_error(Yytable_value) \ 0 @@ -997,65 +1193,78 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - 2619, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -243, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -228, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -215, -525, -525, -525, - -525, -525, -525, -525, -525, -157, -525, -216, -218, -205, - -141, 4260, -165, -525, -94, -525, -525, -525, -525, 3183, - -525, -525, -525, -117, -525, -525, 575, -525, -525, -80, - -48, -114, -525, 6381, -242, -525, -525, -113, -525, 4260, - -525, -525, -525, 4260, -75, -74, -525, -235, -190, -525, - -525, -525, 4765, -108, -525, -525, -525, -186, -525, -112, - -178, -525, -525, 4260, -115, -525, -226, 867, -525, -525, - -525, -525, -117, -229, -525, 5039, -224, -525, -71, -525, - -158, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, 5861, 5861, 5861, -525, -525, -525, -525, -525, - -525, -525, -223, -525, -525, -525, -102, -177, 6121, -100, - -525, 5861, -204, -171, -132, -221, -199, -124, -120, -111, - -84, -83, -233, -98, -525, 5313, -525, -60, 5861, -525, - -48, 4260, 4260, -59, 3456, -525, -525, -525, -99, -97, - -525, -90, -88, -96, 5587, -85, 5861, -92, -79, -81, - -525, -525, -191, -525, -525, -153, -525, -218, -78, -525, - -525, -525, -525, 1159, -525, -525, -525, -525, -525, -525, - -108, 5039, -193, 5039, -525, -525, 5039, 4260, -525, -47, - -525, -525, -525, -176, -525, -525, 5861, -42, -525, -525, - 5861, -73, -525, -525, -525, 5861, 5861, 5861, 5861, 5861, - 5861, 5861, 5861, 5861, 5861, 5861, 5861, 5861, 5861, 5861, - 5861, 5861, 5861, 5861, -525, -525, -525, -76, -525, -525, - -525, -525, 3724, -59, -117, -152, -525, -525, -525, -525, - -525, 1451, -525, 5861, -525, -525, -143, 5861, -180, -525, - -525, -525, 1451, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, 5861, 5861, -525, -525, -525, -525, - 5039, -525, -133, -525, 3992, -525, -525, -72, -77, -525, - -525, -525, -525, -525, -204, -204, -171, -171, -132, -132, - -132, -132, -221, -221, -199, -124, -120, -111, -84, -83, - 5861, -525, -525, -142, -108, -59, -525, -37, 2327, -175, - -525, -163, -525, 2892, 1451, -525, -525, -525, -525, 4491, - -525, -525, -129, -525, -525, -68, -525, -525, 2892, -70, - -525, -77, -32, 4260, -63, -66, -525, -525, 5861, 5861, - -525, -69, -61, 188, -58, 2035, -525, -56, -57, 1743, - -525, -525, -161, 5861, 1743, -70, -525, -525, 1451, 5039, - -525, -525, -525, -67, -77, -525, -525, 1451, -54, -525, - -525, -525 + 3511, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -326, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -310, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -316, -649, -649, -649, -649, -649, -649, -649, + -649, -256, -649, -317, -357, -305, -269, 5906, -315, -649, + -225, -649, -649, -649, -649, 4310, -649, -649, -649, -649, + -234, -649, -649, 711, -649, -649, -204, -69, -222, -649, + 8955, -335, -649, -649, -218, -649, 5906, -649, -649, -649, + 5906, -170, -169, -649, -339, -303, -649, -649, -649, 6657, + -205, -649, -649, -649, -307, -649, -211, -302, -649, -649, + 5906, -210, -649, -321, 1111, -649, -649, -649, -649, -234, + -340, -649, 7040, -325, -649, -166, -649, -292, -649, -649, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, 8189, 8189, 8189, -649, -649, -649, -649, -649, -649, + -649, -324, -649, -649, -649, -200, -298, 8572, -198, -649, + 8189, -242, -278, -314, -333, -209, -219, -217, -215, -180, + -181, -336, -194, -649, -649, 7423, -649, -155, 8189, -649, + -69, 5906, 5906, -154, 4709, -649, -649, -649, -197, -195, + -649, -188, -184, -193, 7806, -179, 8189, -189, -178, -182, + -177, -649, -649, -267, -649, -649, -252, -649, -357, -176, + -173, -649, -649, -649, -649, 1511, -649, -649, -649, -649, + -649, -649, -649, -649, -649, -19, -205, 7040, -311, 7040, + -649, -649, 7040, 5906, -649, -142, -649, -649, -649, -293, + -649, -649, 8189, -136, -649, -649, 8189, -171, -649, -649, + -649, 8189, 8189, 8189, 8189, 8189, 8189, 8189, 8189, 8189, + 8189, 8189, 8189, 8189, 8189, 8189, 8189, 8189, 8189, 8189, + -649, -649, -649, -172, -649, -649, -649, -649, 5108, -154, + -234, -251, -649, -649, -649, -649, -649, 1911, -649, 8189, + -649, -649, -245, 8189, -228, -649, -649, -133, -649, 1911, + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, 8189, 8189, -649, -649, -649, -649, -649, -649, -649, + 7040, -649, -285, -649, 5507, -649, -649, -168, -165, -649, + -649, -649, -649, -649, -242, -242, -278, -278, -314, -314, + -314, -314, -333, -333, -209, -219, -217, -215, -180, -181, + 8189, -649, -649, -241, -205, -154, -649, -128, 3111, -290, + -649, -268, -649, 3911, -163, -297, -649, 1911, -649, -649, + -649, -649, 6274, -649, -649, -223, -649, -649, -162, -649, + -649, 3911, -161, -649, -165, -126, 5906, -160, 8189, -159, + -133, -158, -649, -649, 8189, 8189, -649, -164, -156, 196, + -151, 2711, -649, -131, -135, 2311, -152, -649, -649, -649, + -649, -254, 8189, 2311, -161, -649, -649, 1911, 7040, -649, + -649, -649, -649, -134, -165, -649, -649, 1911, -127, -649, + -649, -649 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1063,95 +1272,110 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 149, 150, 148, 185, 176, 177, 179, 180, 181, - 182, 183, 184, 178, 165, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 207, 208, 209, 210, 211, 212, - 186, 187, 188, 216, 217, 218, 154, 152, 153, 151, - 157, 155, 156, 158, 159, 160, 161, 162, 163, 164, - 189, 190, 191, 228, 229, 230, 192, 193, 194, 240, - 241, 242, 204, 205, 206, 213, 214, 215, 131, 130, - 129, 0, 132, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 266, 267, 268, 269, 270, 271, 273, 274, - 275, 276, 277, 278, 280, 281, 282, 283, 284, 285, - 286, 264, 265, 272, 279, 287, 288, 289, 290, 291, - 292, 361, 293, 294, 295, 296, 297, 298, 299, 300, - 302, 303, 304, 305, 306, 307, 309, 310, 311, 312, - 313, 314, 316, 317, 318, 319, 320, 321, 301, 308, - 315, 322, 323, 324, 325, 326, 327, 362, 363, 364, - 365, 366, 367, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 175, 369, 448, - 128, 139, 370, 371, 372, 0, 447, 0, 449, 0, - 105, 104, 0, 116, 121, 146, 145, 143, 147, 0, - 140, 142, 126, 169, 144, 368, 0, 444, 446, 0, - 0, 0, 375, 0, 0, 93, 90, 0, 103, 0, - 112, 106, 114, 0, 115, 0, 91, 122, 0, 96, - 141, 127, 0, 170, 1, 445, 167, 0, 138, 136, - 0, 134, 373, 0, 0, 94, 0, 0, 450, 107, - 111, 113, 109, 117, 108, 0, 123, 99, 0, 97, - 0, 2, 10, 11, 4, 5, 6, 7, 8, 9, - 13, 12, 0, 0, 0, 171, 39, 38, 40, 37, - 3, 15, 33, 17, 22, 23, 0, 0, 27, 0, - 41, 0, 45, 48, 51, 56, 59, 61, 63, 65, - 67, 69, 71, 0, 31, 0, 166, 0, 0, 133, - 0, 0, 0, 0, 0, 377, 92, 95, 0, 0, - 429, 0, 0, 0, 0, 0, 0, 0, 0, 401, - 410, 414, 41, 74, 87, 0, 390, 0, 126, 393, - 412, 392, 391, 0, 394, 395, 396, 397, 398, 399, - 110, 0, 118, 0, 385, 125, 0, 0, 101, 0, - 98, 34, 35, 0, 19, 20, 0, 0, 25, 24, - 0, 175, 28, 30, 36, 0, 0, 0, 0, 0, + 0, 157, 158, 197, 195, 198, 196, 199, 156, 210, + 200, 201, 208, 209, 206, 207, 204, 205, 202, 203, + 183, 226, 227, 228, 229, 230, 231, 244, 245, 246, + 241, 242, 243, 256, 257, 258, 238, 239, 240, 253, + 254, 255, 235, 236, 237, 250, 251, 252, 232, 233, + 234, 247, 248, 249, 211, 212, 213, 259, 260, 261, + 162, 160, 161, 159, 165, 163, 164, 166, 172, 185, + 168, 169, 167, 170, 171, 173, 179, 180, 181, 182, + 174, 175, 176, 177, 178, 214, 215, 216, 271, 272, + 273, 217, 218, 219, 283, 284, 285, 220, 221, 222, + 295, 296, 297, 223, 224, 225, 307, 308, 309, 134, + 133, 132, 0, 135, 136, 137, 138, 139, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 320, 319, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 347, 348, 349, 350, + 351, 352, 354, 355, 356, 357, 358, 359, 361, 362, + 365, 366, 367, 369, 370, 332, 333, 353, 360, 371, + 373, 374, 375, 377, 378, 469, 334, 335, 336, 363, + 337, 341, 342, 345, 368, 372, 376, 338, 339, 343, + 344, 364, 340, 346, 379, 380, 381, 383, 385, 387, + 389, 391, 395, 396, 397, 398, 399, 400, 402, 403, + 404, 405, 406, 407, 409, 411, 412, 413, 415, 416, + 393, 401, 408, 417, 419, 420, 421, 423, 424, 382, + 384, 386, 410, 388, 390, 392, 394, 414, 418, 422, + 470, 471, 474, 475, 476, 477, 472, 473, 425, 427, + 428, 429, 431, 432, 433, 435, 436, 437, 439, 440, + 441, 443, 444, 445, 447, 448, 449, 451, 452, 453, + 455, 456, 457, 459, 460, 461, 463, 464, 465, 467, + 468, 426, 430, 434, 438, 442, 450, 454, 458, 446, + 462, 466, 0, 194, 479, 564, 131, 146, 480, 481, + 482, 0, 563, 0, 565, 0, 108, 107, 0, 119, + 124, 153, 152, 150, 154, 0, 147, 149, 155, 129, + 188, 151, 478, 0, 560, 562, 0, 0, 0, 485, + 0, 0, 96, 93, 0, 106, 0, 115, 109, 117, + 0, 118, 0, 94, 125, 0, 99, 148, 130, 0, + 189, 1, 561, 186, 0, 145, 143, 0, 141, 483, + 0, 0, 97, 0, 0, 566, 110, 114, 116, 112, + 120, 111, 0, 126, 102, 0, 100, 0, 2, 12, + 13, 10, 11, 4, 5, 6, 7, 8, 9, 15, + 14, 0, 0, 0, 190, 42, 41, 43, 40, 3, + 17, 36, 19, 24, 25, 0, 0, 29, 0, 44, + 0, 48, 51, 54, 59, 62, 64, 66, 68, 70, + 72, 74, 0, 35, 33, 0, 184, 0, 0, 140, + 0, 0, 0, 0, 0, 487, 95, 98, 0, 0, + 545, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 511, 520, 524, 44, 77, 90, 0, 500, 0, 155, + 129, 503, 522, 502, 501, 0, 504, 505, 526, 506, + 533, 507, 508, 541, 509, 0, 113, 0, 121, 0, + 495, 128, 0, 0, 104, 0, 101, 37, 38, 0, + 21, 22, 0, 0, 27, 26, 0, 194, 30, 32, + 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 72, 172, 173, 0, 168, 89, - 137, 135, 0, 0, 383, 0, 381, 376, 378, 440, - 439, 0, 431, 0, 443, 441, 0, 0, 0, 426, - 427, 400, 0, 77, 78, 80, 79, 82, 83, 84, - 85, 86, 81, 76, 0, 0, 415, 411, 413, 120, - 0, 388, 0, 124, 0, 102, 14, 0, 21, 18, - 29, 42, 43, 44, 47, 46, 49, 50, 54, 55, - 52, 53, 57, 58, 60, 62, 64, 66, 68, 70, - 0, 174, 374, 0, 384, 0, 379, 0, 0, 0, - 442, 0, 425, 0, 402, 75, 88, 119, 386, 0, - 100, 16, 0, 380, 382, 0, 434, 433, 436, 408, - 421, 419, 0, 0, 0, 0, 387, 389, 0, 0, - 435, 0, 0, 418, 0, 0, 416, 0, 0, 0, - 403, 73, 0, 437, 0, 408, 407, 409, 423, 0, - 405, 428, 404, 0, 438, 432, 417, 424, 0, 420, - 430, 422 + 75, 191, 192, 0, 187, 92, 144, 142, 0, 0, + 493, 0, 491, 486, 488, 556, 555, 0, 547, 0, + 559, 557, 0, 0, 0, 540, 543, 0, 510, 0, + 80, 81, 83, 82, 85, 86, 87, 88, 89, 84, + 79, 0, 0, 525, 521, 523, 527, 534, 542, 123, + 0, 498, 0, 127, 0, 105, 16, 0, 23, 20, + 31, 45, 46, 47, 50, 49, 52, 53, 57, 58, + 55, 56, 60, 61, 63, 65, 67, 69, 71, 73, + 0, 193, 484, 0, 494, 0, 489, 0, 0, 0, + 558, 0, 539, 0, 570, 0, 568, 512, 78, 91, + 122, 496, 0, 103, 18, 0, 490, 492, 0, 550, + 549, 552, 518, 535, 531, 0, 0, 0, 0, 0, + 0, 0, 497, 499, 0, 0, 551, 0, 0, 530, + 0, 0, 528, 0, 0, 0, 0, 567, 569, 513, + 76, 0, 553, 0, 518, 517, 519, 537, 0, 515, + 544, 514, 571, 0, 554, 548, 529, 538, 0, 532, + 546, 536 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -525, -525, -525, -525, -525, -525, -525, -525, -525, -525, - -525, -525, -103, -525, -278, -274, -297, -273, -214, -211, - -210, -212, -209, -208, -525, -261, -525, -292, -525, -308, - -525, 4, -525, -525, -525, 5, -525, -525, -525, -41, - -38, -39, -525, -525, -504, -525, -525, -525, -525, -123, - -525, -230, -237, -525, -525, 0, -246, -525, 1, -525, - -525, -525, -337, -342, -207, -286, -378, -525, -285, -376, - -524, -322, -525, -525, -330, -327, -525, -525, -22, -452, - -275, -525, -525, -298, -525, -525, -525, -525, -525, -525, - -525, -525, -525, -525, -525, -525, -525, -2, -525, -525 + -649, -649, -649, -649, -649, -649, -649, -649, -649, -649, + -649, -649, -304, -649, -373, -370, -416, -379, -294, -322, + -291, -295, -288, -296, -649, -369, -649, -393, -649, -382, + -414, 1, -649, -649, -649, 2, -649, -649, -649, -114, + -109, -112, -649, -649, -615, -649, -649, -649, -649, -196, + -649, -334, -341, -649, 6, -649, 0, -347, -649, -68, + -649, -649, -649, -443, -448, -287, -368, -492, -649, -376, + -482, -648, -415, -649, -649, -427, -426, -649, -649, -93, + -560, -365, -649, -231, -649, -386, -649, -229, -649, -649, + -649, -649, -227, -649, -649, -649, -649, -649, -649, -649, + -649, -76, -649, -649, -649, -649, -390 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 320, 321, 322, 487, 323, 324, 325, 326, 327, - 328, 329, 372, 331, 332, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 373, 510, 374, 474, 375, - 440, 376, 227, 397, 300, 377, 229, 230, 231, 260, - 261, 262, 232, 233, 234, 235, 236, 237, 280, 281, - 238, 239, 240, 241, 277, 344, 273, 243, 244, 245, - 351, 283, 354, 355, 445, 446, 395, 482, 379, 380, - 381, 382, 462, 545, 571, 553, 554, 555, 572, 383, - 384, 385, 556, 544, 386, 557, 578, 387, 388, 523, - 451, 518, 538, 551, 552, 389, 246, 247, 248, 257 + -1, 429, 430, 431, 607, 432, 433, 434, 435, 436, + 437, 438, 483, 440, 441, 442, 443, 444, 445, 446, + 447, 448, 449, 450, 451, 484, 630, 485, 591, 486, + 556, 487, 333, 513, 407, 488, 335, 336, 337, 367, + 368, 369, 338, 339, 340, 341, 342, 343, 387, 388, + 344, 345, 346, 347, 453, 384, 454, 380, 350, 351, + 352, 461, 390, 464, 465, 561, 562, 511, 602, 491, + 492, 493, 494, 579, 671, 700, 679, 680, 681, 701, + 495, 496, 497, 498, 682, 667, 499, 500, 683, 708, + 501, 502, 503, 643, 567, 638, 661, 677, 678, 504, + 353, 354, 355, 364, 505, 645, 646 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1159,155 +1383,81 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 242, 263, 270, 394, 226, 228, 403, 478, 286, 278, - 524, 343, 448, 479, 442, 481, 254, 251, 483, 542, - 433, 296, 249, 404, 405, 272, 270, 422, 423, 263, - 294, 567, 272, 285, 542, 570, 412, 250, 272, 295, - 570, 345, -32, 345, 406, 391, 390, 392, 407, 357, - 396, 426, 427, 352, 252, 434, 456, 256, 458, 255, - 484, 258, 424, 425, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 345, 517, 415, 416, 417, 297, - 346, 480, 298, 473, 437, 299, 347, 439, 349, 409, - 486, 539, 475, 522, 350, 410, 475, 475, 488, 394, - 448, 394, 527, 540, 394, 573, 418, 265, 419, 475, - 266, 475, 420, 421, 399, 270, 577, 400, 490, 475, - 515, 352, 476, 516, 352, 498, 499, 500, 501, 475, - 515, 259, 520, 533, 222, 223, 224, 528, 267, 529, - 494, 495, 448, 475, 548, 519, 496, 497, 478, 521, - 272, 547, 276, 502, 503, 282, 287, 292, 293, 345, - 356, 398, 348, 428, 408, 413, 429, 352, 431, 330, - 435, 432, 438, 444, 430, 452, 449, 453, 450, 454, - 457, 459, 525, 526, 279, 485, 460, -31, 394, 461, - 489, 579, 511, -26, 535, 475, 531, 549, 514, -406, - 558, 478, 532, 559, 560, 564, 563, 565, 580, 401, - 402, 369, 352, 568, 504, 541, 581, 569, 505, 507, - 506, 289, 290, 508, 291, 509, 253, 441, 414, 534, - 541, 264, 566, 536, 575, 288, 513, 394, 576, 271, - 550, 562, 330, 537, 275, 330, 242, 0, 0, 0, - 226, 228, 0, 284, 352, 574, 561, 0, 0, 264, - 0, 0, 0, 264, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 394, 0, 0, - 0, 0, 0, 353, 0, 0, 0, 378, 0, 0, - 0, 0, 0, 543, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 270, 0, 543, 0, - 0, 0, 491, 492, 493, 330, 330, 330, 330, 330, - 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, - 330, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 349, 332, 334, 370, 377, 470, 348, 471, 472, 510, + 452, 475, 385, 595, 393, 599, 564, 601, 558, 647, + 603, 361, 358, 538, 539, 549, 363, 403, 665, 377, + 520, 521, 370, 696, 401, 379, 379, 699, 536, 537, + 379, 519, 507, 402, 528, 699, 665, 356, 392, -34, + 455, 522, 506, 508, 455, 523, 462, 512, 540, 541, + 550, 359, 467, 357, 455, 372, 362, 456, 373, 365, + 604, 600, 459, 457, 404, 439, 525, 405, 460, 669, + 406, 606, 526, 670, 662, 637, 553, 592, 515, 555, + 592, 516, 572, 651, 574, 652, 580, 581, 582, 583, + 584, 585, 586, 587, 588, 589, 663, 534, 650, 535, + 564, 366, 592, 374, 510, 590, 510, 517, 518, 510, + 703, 377, 618, 619, 620, 621, 592, 462, 592, 635, + 462, 593, 636, 610, 383, 592, 530, 707, 640, 635, + 608, 379, 656, 328, 329, 330, 531, 532, 533, 542, + 543, 439, 592, 642, 439, 389, 564, 592, 674, 394, + 673, 614, 615, 622, 623, 595, 616, 617, 399, 400, + 455, 458, 514, 466, 524, 529, 544, 545, 546, 462, + 547, 548, 551, 554, 560, 568, 565, 639, 566, 569, + 570, 641, 575, 577, 573, 576, 605, -35, 648, 649, + -33, 578, 609, -28, 631, 644, 709, 510, 654, 658, + 668, 675, 684, 634, 685, 592, -516, 687, 693, 692, + 689, 694, 702, 625, 462, 595, 480, 611, 612, 613, + 439, 439, 439, 439, 439, 439, 439, 439, 439, 439, + 439, 439, 439, 439, 439, 439, 697, 698, 655, 710, + 624, 711, 627, 629, 686, 626, 397, 396, 398, 510, + 628, 664, 659, 360, 557, 695, 705, 657, 706, 386, + 462, 395, 633, 660, 596, 676, 597, 382, 598, 664, + 688, 690, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 691, 0, 0, 0, 0, 0, 555, + 0, 0, 0, 0, 0, 510, 0, 0, 0, 666, + 704, 0, 0, 0, 0, 0, 0, 0, 478, 0, + 0, 0, 0, 0, 0, 377, 0, 666, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 371, 0, 0, + 0, 0, 0, 348, 0, 378, 0, 0, 0, 0, + 0, 348, 0, 349, 332, 334, 0, 0, 0, 348, + 391, 0, 0, 0, 439, 0, 371, 0, 0, 0, + 371, 0, 348, 0, 0, 0, 348, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 353, 443, 0, 353, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 378, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 353, 0, 0, + 463, 0, 0, 0, 490, 0, 348, 0, 0, 0, + 489, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 353, 0, 0, 0, 0, 0, 0, 0, - 0, 378, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 378, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 353, 0, 0, 0, 0, 0, + 0, 463, 559, 0, 463, 0, 0, 348, 348, 0, + 348, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 378, 0, - 0, 0, 0, 378, 378, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 378, 0, - 0, 0, 0, 271, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 378, 0, 0, 0, 378, - 0, 0, 0, 0, 378, 0, 0, 0, 378, 0, - 0, 0, 0, 0, 0, 274, 0, 378, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 0, 0, 218, 0, + 0, 0, 0, 0, 0, 490, 0, 0, 0, 0, + 0, 489, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 463, 0, 0, 0, 0, 0, 348, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 463, 0, + 0, 0, 0, 0, 348, 0, 0, 490, 0, 0, + 0, 0, 0, 489, 0, 0, 0, 0, 0, 490, + 0, 0, 0, 0, 0, 489, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 219, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 220, 221, 222, 223, 224, 225, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 358, 359, 360, 0, 361, 362, 363, - 364, 365, 366, 367, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 368, 301, - 218, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 463, 0, 0, 0, 0, 0, + 348, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 314, 0, 0, 0, 369, 370, 0, 0, - 0, 0, 371, 316, 317, 318, 319, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 220, 221, 222, 223, - 224, 225, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 358, 359, 360, 0, 361, - 362, 363, 364, 365, 366, 367, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 368, 301, 218, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 0, 0, 312, 313, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 314, 0, 0, 0, 369, 477, - 0, 0, 0, 0, 371, 316, 317, 318, 319, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 220, 221, - 222, 223, 224, 225, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 358, 359, 360, - 0, 361, 362, 363, 364, 365, 366, 367, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 490, 0, + 0, 0, 0, 490, 489, 0, 0, 490, 0, 489, + 0, 0, 0, 489, 0, 0, 0, 0, 0, 0, + 0, 490, 0, 0, 0, 0, 378, 489, 0, 0, + 0, 0, 348, 0, 0, 0, 0, 0, 0, 0, + 0, 490, 0, 0, 0, 490, 0, 489, 0, 0, + 0, 489, 0, 490, 0, 0, 0, 490, 0, 489, + 0, 0, 0, 489, 0, 0, 0, 490, 0, 0, + 0, 381, 0, 489, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, @@ -1327,268 +1477,347 @@ static const yytype_int16 yytable[] = 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 368, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 0, 0, 0, - 369, 0, 0, 0, 0, 0, 371, 316, 317, 318, - 319, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 220, 221, 222, 223, 224, 225, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 358, - 359, 360, 0, 361, 362, 363, 364, 365, 366, 367, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 368, 301, 218, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 0, 0, 312, - 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, - 0, 0, 287, 0, 0, 0, 0, 0, 371, 316, - 317, 318, 319, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 220, 221, 222, 223, 224, 225, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 358, 359, 360, 0, 361, 362, 363, 364, 365, - 366, 367, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 368, 301, 218, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 0, - 0, 312, 313, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 314, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 371, 316, 317, 318, 319, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 220, 221, 222, 223, 224, 225, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 0, 301, - 218, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 314, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 371, 316, 317, 318, 319, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 220, 221, 222, 223, - 224, 225, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 0, 218, 0, 0, 0, 0, 0, 0, 0, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 0, 0, + 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 219, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 220, 221, - 222, 223, 224, 225, 0, 0, 0, 0, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 0, 301, 218, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 0, 0, 312, 313, + 0, 0, 0, 0, 325, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 468, 469, 470, 0, 471, 472, 473, + 474, 475, 476, 477, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 478, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 314, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 316, 317, - 318, 319, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 220, 221, 222, 223, 224, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, + 0, 0, 0, 0, 423, 0, 479, 0, 480, 481, + 0, 0, 0, 0, 482, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 468, 469, 470, 0, 471, 472, 473, + 474, 475, 476, 477, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 478, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 0, 268, 218, 0, 0, 0, + 0, 0, 0, 0, 423, 0, 479, 0, 480, 594, + 0, 0, 0, 0, 482, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 468, 469, 470, 0, 471, 472, 473, + 474, 475, 476, 477, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 478, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 423, 0, 479, 0, 480, 0, + 0, 0, 0, 0, 482, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 468, 469, 470, 0, 471, 472, 473, + 474, 475, 476, 477, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 478, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 423, 0, 479, 0, 394, 0, + 0, 0, 0, 0, 482, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 468, 469, 470, 0, 471, 472, 473, + 474, 475, 476, 477, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 478, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 423, 0, 479, 0, 0, 0, + 0, 0, 0, 0, 482, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 0, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 423, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 482, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 0, 0, + 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 269, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 220, 221, 222, 223, 224, 0, 0, 0, - 0, 0, 0, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 0, 0, 218, + 0, 0, 0, 0, 325, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 331, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 0, 408, + 324, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 0, 0, 421, 422, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 447, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 0, 0, 0, 0, 0, 220, 221, 222, 223, 224, - 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 0, 0, 218, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 512, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, - 0, 0, 0, 220, 221, 222, 223, 224, 0, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 0, 0, 218, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 530, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, - 0, 220, 221, 222, 223, 224, 0, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 0, 0, 0, 0, 423, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 425, 426, 427, 428, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 326, 327, + 328, 329, 330, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, @@ -1608,70 +1837,32 @@ static const yytype_int16 yytable[] = 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 0, 0, 218, 0, 0, 0, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, - 221, 222, 223, 224, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 0, 375, 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 0, 0, 0, - 393, 546, 0, 0, 0, 0, 0, 316, 317, 318, - 319, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, - 0, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 0, 301, 218, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 0, - 0, 312, 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 314, 0, 0, 315, 0, 0, 0, 0, 0, 0, - 0, 316, 317, 318, 319, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 376, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 326, 327, 328, + 329, 330, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 0, 0, 0, 0, 0, 73, 74, 75, 76, 77, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, @@ -1686,47 +1877,72 @@ static const yytype_int16 yytable[] = 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 0, 301, 218, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 0, 0, 312, 313, 0, 0, 0, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 0, 0, 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 314, 0, 0, 0, 393, 0, - 0, 0, 0, 0, 0, 316, 317, 318, 319, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 0, 0, 0, 0, 0, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 0, 301, 218, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 0, 0, 312, - 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 314, 0, - 0, 436, 0, 0, 0, 0, 0, 0, 0, 316, - 317, 318, 319, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 15, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 563, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 326, 327, 328, 329, + 330, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 0, 0, 324, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 632, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 326, 327, 328, 329, 330, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 0, 0, - 0, 0, 0, 73, 74, 75, 76, 77, 78, 79, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, @@ -1740,209 +1956,27 @@ static const yytype_int16 yytable[] = 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 0, 301, - 218, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 0, 0, 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 314, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 455, 316, 317, 318, 319, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 316, 317, 318, - 319, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 0, 0, 0, 0, 0, 653, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 411, 0, 301, 218, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 0, 0, 312, 313, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 314, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 316, 317, 318, - 319, 0, 0, 0, 0, 0, 0, 0, 0, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 0, 0, 0, 0, 0, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 0, 0, 218 -}; - -static const yytype_int16 yycheck[] = -{ - 0, 231, 239, 295, 0, 0, 314, 383, 254, 57, - 462, 272, 354, 391, 351, 393, 232, 232, 396, 523, - 253, 267, 265, 246, 247, 267, 263, 248, 249, 259, - 265, 555, 267, 275, 538, 559, 328, 265, 267, 274, - 564, 267, 265, 267, 267, 274, 292, 293, 271, 275, - 274, 250, 251, 283, 269, 288, 364, 275, 366, 275, - 397, 266, 283, 284, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 267, 451, 280, 281, 282, 269, - 266, 274, 272, 274, 345, 275, 272, 348, 266, 266, - 266, 266, 272, 273, 272, 272, 272, 272, 406, 391, - 442, 393, 480, 266, 396, 266, 277, 272, 279, 272, - 275, 272, 244, 245, 272, 352, 568, 275, 410, 272, - 272, 351, 275, 275, 354, 422, 423, 424, 425, 272, - 272, 272, 275, 275, 291, 292, 293, 270, 232, 272, - 418, 419, 484, 272, 273, 453, 420, 421, 524, 457, - 267, 529, 232, 426, 427, 269, 269, 232, 232, 267, - 275, 232, 274, 287, 266, 265, 286, 397, 252, 272, - 268, 254, 232, 232, 285, 265, 275, 265, 275, 275, - 265, 273, 474, 475, 232, 232, 265, 265, 480, 270, - 232, 569, 268, 266, 231, 272, 268, 265, 444, 269, - 232, 577, 510, 266, 270, 266, 275, 19, 275, 312, - 313, 269, 442, 269, 428, 523, 270, 274, 429, 431, - 430, 259, 263, 432, 263, 433, 225, 350, 331, 515, - 538, 231, 554, 518, 564, 257, 443, 529, 565, 239, - 538, 549, 345, 518, 246, 348, 246, -1, -1, -1, - 246, 246, -1, 253, 484, 563, 548, -1, -1, 259, - -1, -1, -1, 263, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 569, -1, -1, - -1, -1, -1, 283, -1, -1, -1, 287, -1, -1, - -1, -1, -1, 523, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 543, -1, 538, -1, - -1, -1, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, - 433, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 351, 352, -1, 354, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 383, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 397, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 442, -1, -1, -1, -1, -1, -1, -1, - -1, 451, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 462, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 484, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 518, -1, - -1, -1, -1, 523, 524, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 538, -1, - -1, -1, -1, 543, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 555, -1, -1, -1, 559, - -1, -1, -1, -1, 564, -1, -1, -1, 568, -1, - -1, -1, -1, -1, -1, 0, -1, 577, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, -1, -1, 233, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 275, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, -1, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 265, -1, -1, -1, 269, 270, -1, -1, - -1, -1, 275, 276, 277, 278, 279, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, -1, 20, + 0, 0, 0, 0, 326, 327, 328, 329, 330, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, @@ -1965,14 +1999,438 @@ static const yytype_int16 yycheck[] = 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, -1, -1, 246, 247, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 265, -1, -1, -1, 269, 270, - -1, -1, -1, -1, 275, 276, 277, 278, 279, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 289, 290, - 291, 292, 293, 294, 3, 4, 5, 6, 7, 8, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 0, 0, 324, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, + 4, 5, 6, 7, 0, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, + 0, 0, 0, 326, 327, 328, 329, 330, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 0, 408, 324, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 0, 0, 421, 422, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 423, 0, 0, + 0, 509, 672, 0, 0, 0, 0, 0, 425, 426, + 427, 428, 3, 4, 5, 6, 7, 0, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 0, 408, 324, 409, 410, 411, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 0, + 0, 421, 422, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 423, 0, 0, 424, 0, 0, 0, 0, 0, 0, + 0, 425, 426, 427, 428, 3, 4, 5, 6, 7, + 0, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 0, 408, 324, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 0, 0, 421, 422, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 423, 0, 0, 0, 509, 0, 0, + 0, 0, 0, 0, 425, 426, 427, 428, 3, 4, + 5, 6, 7, 0, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 0, 408, 324, 409, 410, 411, 412, 413, 414, 415, + 416, 417, 418, 419, 420, 0, 0, 421, 422, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 423, 0, 0, 552, + 0, 0, 0, 0, 0, 0, 0, 425, 426, 427, + 428, 3, 4, 5, 6, 7, 0, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, + 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 0, 408, 324, 409, 410, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 0, 0, + 421, 422, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 423, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 571, + 425, 426, 427, 428, 3, 4, 5, 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 0, 408, 324, 409, + 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 0, 0, 421, 422, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 423, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 425, 426, 427, 428, 3, 4, 5, + 6, 7, 0, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 527, 0, + 408, 324, 409, 410, 411, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 0, 0, 421, 422, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 423, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 425, 426, 427, 428, + 3, 4, 5, 6, 7, 0, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 0, 0, 324 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 0, 0, 337, 345, 24, 0, 26, 27, 402, + 379, 30, 81, 495, 361, 507, 464, 509, 461, 579, + 512, 338, 338, 356, 357, 361, 383, 374, 643, 370, + 354, 355, 366, 681, 373, 375, 375, 685, 352, 353, + 375, 423, 382, 382, 437, 693, 661, 373, 383, 373, + 375, 375, 399, 400, 375, 379, 390, 382, 391, 392, + 396, 377, 383, 373, 375, 380, 383, 374, 383, 374, + 513, 382, 374, 380, 377, 379, 374, 380, 380, 376, + 383, 374, 380, 380, 374, 567, 455, 380, 380, 458, + 380, 383, 474, 378, 476, 380, 363, 364, 365, 366, + 367, 368, 369, 370, 371, 372, 374, 385, 600, 387, + 558, 380, 380, 338, 507, 382, 509, 421, 422, 512, + 374, 462, 538, 539, 540, 541, 380, 461, 380, 380, + 464, 383, 383, 526, 338, 380, 440, 697, 383, 380, + 522, 375, 383, 399, 400, 401, 388, 389, 390, 358, + 359, 455, 380, 381, 458, 377, 604, 380, 381, 377, + 652, 534, 535, 542, 543, 647, 536, 537, 338, 338, + 375, 382, 338, 383, 374, 373, 395, 394, 393, 513, + 360, 362, 376, 338, 338, 373, 383, 569, 383, 373, + 383, 573, 381, 375, 373, 373, 338, 373, 591, 592, + 373, 378, 338, 374, 376, 338, 698, 600, 376, 337, + 373, 373, 338, 560, 374, 380, 377, 376, 374, 383, + 378, 25, 374, 545, 558, 707, 377, 531, 532, 533, + 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, + 544, 545, 546, 547, 548, 549, 377, 382, 630, 383, + 544, 378, 547, 549, 668, 546, 370, 366, 370, 652, + 548, 643, 638, 331, 460, 680, 693, 635, 694, 338, + 604, 364, 559, 638, 505, 661, 505, 353, 505, 661, + 670, 674, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 675, -1, -1, -1, -1, -1, 668, + -1, -1, -1, -1, -1, 698, -1, -1, -1, 643, + 692, -1, -1, -1, -1, -1, -1, -1, 337, -1, + -1, -1, -1, -1, -1, 666, -1, 661, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 337, -1, -1, + -1, -1, -1, 337, -1, 345, -1, -1, -1, -1, + -1, 345, -1, 353, 353, 353, -1, -1, -1, 353, + 360, -1, -1, -1, 668, -1, 366, -1, -1, -1, + 370, -1, 366, -1, -1, -1, 370, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 390, -1, -1, -1, 394, -1, 390, -1, -1, -1, + 394, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 461, 462, -1, 464, -1, -1, 461, 462, -1, + 464, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 495, -1, -1, -1, -1, + -1, 495, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 513, -1, -1, -1, -1, -1, 513, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 558, -1, + -1, -1, -1, -1, 558, -1, -1, 567, -1, -1, + -1, -1, -1, 567, -1, -1, -1, -1, -1, 579, + -1, -1, -1, -1, -1, 579, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 604, -1, -1, -1, -1, -1, + 604, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 638, -1, + -1, -1, -1, 643, 638, -1, -1, 647, -1, 643, + -1, -1, -1, 647, -1, -1, -1, -1, -1, -1, + -1, 661, -1, -1, -1, -1, 666, 661, -1, -1, + -1, -1, 666, -1, -1, -1, -1, -1, -1, -1, + -1, 681, -1, -1, -1, 685, -1, 681, -1, -1, + -1, 685, -1, 693, -1, -1, -1, 697, -1, 693, + -1, -1, -1, 697, -1, -1, -1, 707, -1, -1, + -1, 0, -1, 707, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, -1, -1, + 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, @@ -1994,267 +2452,306 @@ static const yytype_int16 yycheck[] = 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, - 269, -1, -1, -1, -1, -1, 275, 276, 277, 278, - 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 289, 290, 291, 292, 293, 294, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, -1, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, -1, -1, 246, - 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, - -1, -1, 269, -1, -1, -1, -1, -1, 275, 276, - 277, 278, 279, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 289, 290, 291, 292, 293, 294, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, -1, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, -1, - -1, 246, 247, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, -1, 375, -1, 377, 378, + -1, -1, -1, -1, 383, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, -1, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 265, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 275, 276, 277, 278, 279, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 289, 290, 291, 292, 293, 294, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, -1, 375, -1, 377, 378, + -1, -1, -1, -1, 383, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, -1, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 275, 276, 277, 278, 279, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 289, 290, 291, 292, - 293, 294, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - -1, -1, 233, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, -1, 375, -1, 377, -1, + -1, -1, -1, -1, 383, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, -1, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, -1, 375, -1, 377, -1, + -1, -1, -1, -1, 383, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, -1, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, -1, 375, -1, -1, -1, + -1, -1, -1, -1, 383, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, -1, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 383, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, -1, -1, + 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 275, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 289, 290, - 291, 292, 293, 294, -1, -1, -1, -1, -1, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, -1, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, -1, -1, 246, 247, + -1, -1, -1, -1, 383, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 402, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, -1, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 276, 277, - 278, 279, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 289, 290, 291, 292, 293, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, -1, 232, 233, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 275, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 289, 290, 291, 292, 293, -1, -1, -1, - -1, -1, -1, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, -1, -1, 233, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 270, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - -1, -1, -1, -1, -1, 289, 290, 291, 292, 293, - -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, -1, -1, 233, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 270, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, -1, -1, - -1, -1, -1, 289, 290, 291, 292, 293, -1, 27, - 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, -1, -1, 233, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 270, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, - -1, 289, 290, 291, 292, 293, -1, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 384, 385, 386, 387, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 397, 398, + 399, 400, 401, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, @@ -2274,70 +2771,32 @@ static const yytype_int16 yycheck[] = 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, -1, -1, 233, -1, -1, -1, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 289, - 290, 291, 292, 293, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, -1, 338, 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, - 269, 270, -1, -1, -1, -1, -1, 276, 277, 278, - 279, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, -1, -1, -1, -1, - -1, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, -1, - -1, 246, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 265, -1, -1, 268, -1, -1, -1, -1, -1, -1, - -1, 276, 277, 278, 279, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 63, 64, 65, 66, 67, 68, 69, 70, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 383, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 397, 398, 399, + 400, 401, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - -1, -1, -1, -1, -1, 86, 87, 88, 89, 90, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, @@ -2352,149 +2811,66 @@ static const yytype_int16 yycheck[] = 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - -1, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, -1, -1, 246, 247, -1, -1, -1, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 336, -1, -1, 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 265, -1, -1, -1, 269, -1, - -1, -1, -1, -1, -1, 276, 277, 278, 279, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, -1, -1, -1, -1, -1, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, -1, -1, 246, - 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, - -1, 268, -1, -1, -1, -1, -1, -1, -1, 276, - 277, 278, 279, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, -1, -1, - -1, -1, -1, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 378, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 275, 276, 277, 278, 279, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, -1, -1, -1, -1, -1, 397, 398, 399, 400, + 401, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, + -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, + 332, 333, 334, 335, 336, -1, -1, 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 276, 277, 278, - 279, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, -1, -1, 246, 247, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 265, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 276, 277, 278, - 279, -1, -1, -1, -1, -1, -1, -1, -1, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, -1, -1, -1, -1, -1, 378, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 397, 398, 399, 400, 401, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, -1, -1, -1, -1, -1, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, -1, -1, 233 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint16 yystos[] = -{ - 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, @@ -2514,118 +2890,538 @@ static const yytype_uint16 yystos[] = 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 233, 275, - 289, 290, 291, 292, 293, 294, 329, 330, 333, 334, - 335, 336, 340, 341, 342, 343, 344, 345, 348, 349, - 350, 351, 353, 355, 356, 357, 394, 395, 396, 265, - 265, 232, 269, 356, 232, 275, 275, 397, 266, 272, - 337, 338, 339, 349, 353, 272, 275, 232, 232, 275, - 350, 353, 267, 354, 0, 395, 232, 352, 57, 232, - 346, 347, 269, 359, 353, 275, 354, 269, 376, 338, - 337, 339, 232, 232, 265, 274, 354, 269, 272, 275, - 332, 232, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 246, 247, 265, 268, 276, 277, 278, 279, - 299, 300, 301, 303, 304, 305, 306, 307, 308, 309, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 336, -1, -1, 339, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 378, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 397, 398, 399, 400, 401, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, -1, -1, 339, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 7, 8, 9, -1, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, + -1, -1, -1, 397, 398, 399, 400, 401, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, + 336, -1, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, 348, 349, 350, 351, -1, -1, 354, 355, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 373, -1, -1, + -1, 377, 378, -1, -1, -1, -1, -1, 384, 385, + 386, 387, 5, 6, 7, 8, 9, -1, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 336, -1, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, 348, 349, 350, 351, -1, + -1, 354, 355, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 373, -1, -1, 376, -1, -1, -1, -1, -1, -1, + -1, 384, 385, 386, 387, 5, 6, 7, 8, 9, + -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 353, 267, 266, 272, 274, 266, - 272, 358, 349, 353, 360, 361, 275, 275, 16, 17, - 18, 20, 21, 22, 23, 24, 25, 26, 231, 269, - 270, 275, 310, 323, 325, 327, 329, 333, 353, 366, - 367, 368, 369, 377, 378, 379, 382, 385, 386, 393, - 354, 274, 354, 269, 325, 364, 274, 331, 232, 272, - 275, 310, 310, 327, 246, 247, 267, 271, 266, 266, - 272, 230, 325, 265, 310, 280, 281, 282, 277, 279, - 244, 245, 248, 249, 283, 284, 250, 251, 287, 286, - 285, 252, 254, 253, 288, 268, 268, 323, 232, 323, - 328, 347, 360, 353, 232, 362, 363, 270, 361, 275, - 275, 388, 265, 265, 275, 275, 327, 265, 327, 273, - 265, 270, 370, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 274, 326, 272, 275, 270, 367, 364, - 274, 364, 365, 364, 360, 232, 266, 302, 327, 232, - 325, 310, 310, 310, 312, 312, 313, 313, 314, 314, - 314, 314, 315, 315, 316, 317, 318, 319, 320, 321, - 324, 268, 270, 362, 354, 272, 275, 367, 389, 327, - 275, 327, 273, 387, 377, 325, 325, 364, 270, 272, - 270, 268, 327, 275, 363, 231, 366, 378, 390, 266, - 266, 327, 342, 349, 381, 371, 270, 364, 273, 265, - 381, 391, 392, 373, 374, 375, 380, 383, 232, 266, - 270, 325, 327, 275, 266, 19, 369, 368, 269, 274, - 368, 372, 376, 266, 327, 372, 373, 377, 384, 364, - 275, 270 + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, -1, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, + 350, 351, -1, -1, 354, 355, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 373, -1, -1, -1, 377, -1, -1, + -1, -1, -1, -1, 384, 385, 386, 387, 5, 6, + 7, 8, 9, -1, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + -1, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, 348, 349, 350, 351, -1, -1, 354, 355, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 373, -1, -1, 376, + -1, -1, -1, -1, -1, -1, -1, 384, 385, 386, + 387, 5, 6, 7, 8, 9, -1, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, + 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, -1, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, 351, -1, -1, + 354, 355, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 373, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 383, + 384, 385, 386, 387, 5, 6, 7, 8, 9, -1, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, + 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 336, -1, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, + 351, -1, -1, 354, 355, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 384, 385, 386, 387, 5, 6, 7, + 8, 9, -1, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, -1, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + 348, 349, 350, 351, -1, -1, 354, 355, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 384, 385, 386, 387, + 5, 6, 7, 8, 9, -1, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, -1, -1, 339 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 339, 383, 397, 398, 399, 400, + 401, 402, 437, 438, 441, 442, 443, 444, 448, 449, + 450, 451, 452, 453, 456, 457, 458, 459, 460, 462, + 464, 465, 466, 506, 507, 508, 373, 373, 338, 377, + 465, 338, 383, 383, 509, 374, 380, 445, 446, 447, + 457, 462, 380, 383, 338, 338, 383, 458, 462, 375, + 463, 0, 507, 338, 461, 81, 338, 454, 455, 377, + 468, 462, 383, 463, 377, 485, 446, 445, 447, 338, + 338, 373, 382, 463, 377, 380, 383, 440, 338, 340, + 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, + 351, 354, 355, 373, 376, 384, 385, 386, 387, 407, + 408, 409, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + 429, 430, 431, 460, 462, 375, 374, 380, 382, 374, + 380, 467, 457, 462, 469, 470, 383, 383, 22, 23, + 24, 26, 27, 28, 29, 30, 31, 32, 337, 375, + 377, 378, 383, 418, 431, 433, 435, 437, 441, 460, + 462, 475, 476, 477, 478, 486, 487, 488, 489, 492, + 493, 496, 497, 498, 505, 510, 463, 382, 463, 377, + 433, 473, 382, 439, 338, 380, 383, 418, 418, 435, + 354, 355, 375, 379, 374, 374, 380, 336, 433, 373, + 418, 388, 389, 390, 385, 387, 352, 353, 356, 357, + 391, 392, 358, 359, 395, 394, 393, 360, 362, 361, + 396, 376, 376, 431, 338, 431, 436, 455, 469, 462, + 338, 471, 472, 378, 470, 383, 383, 500, 373, 373, + 383, 383, 435, 373, 435, 381, 373, 375, 378, 479, + 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, + 382, 434, 380, 383, 378, 476, 489, 493, 498, 473, + 382, 473, 474, 473, 469, 338, 374, 410, 435, 338, + 433, 418, 418, 418, 420, 420, 421, 421, 422, 422, + 422, 422, 423, 423, 424, 425, 426, 427, 428, 429, + 432, 376, 378, 471, 463, 380, 383, 476, 501, 435, + 383, 435, 381, 499, 338, 511, 512, 486, 433, 433, + 473, 378, 380, 378, 376, 435, 383, 472, 337, 475, + 487, 502, 374, 374, 435, 450, 457, 491, 373, 376, + 380, 480, 378, 473, 381, 373, 491, 503, 504, 482, + 483, 484, 490, 494, 338, 374, 436, 376, 512, 378, + 433, 435, 383, 374, 25, 478, 477, 377, 382, 477, + 481, 485, 374, 374, 435, 481, 482, 486, 495, 473, + 383, 378 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 298, 299, 300, 300, 300, 300, 300, 300, 300, - 300, 300, 300, 300, 300, 301, 301, 301, 301, 301, - 301, 302, 303, 304, 305, 305, 306, 306, 307, 307, - 308, 309, 309, 310, 310, 310, 310, 311, 311, 311, - 311, 312, 312, 312, 312, 313, 313, 313, 314, 314, - 314, 315, 315, 315, 315, 315, 316, 316, 316, 317, - 317, 318, 318, 319, 319, 320, 320, 321, 321, 322, - 322, 323, 324, 323, 325, 325, 326, 326, 326, 326, - 326, 326, 326, 326, 326, 326, 326, 327, 327, 328, - 329, 329, 329, 329, 329, 329, 329, 329, 329, 331, - 330, 332, 332, 333, 334, 334, 335, 335, 336, 337, - 337, 338, 338, 338, 338, 339, 340, 340, 340, 340, - 340, 341, 341, 341, 341, 341, 342, 342, 343, 344, - 344, 344, 344, 345, 346, 346, 347, 347, 347, 348, - 349, 349, 350, 350, 350, 350, 350, 350, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 352, 352, 353, - 353, 354, 354, 354, 354, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 355, 355, 355, 355, 355, 355, 355, 355, 355, 355, - 356, 356, 356, 358, 357, 359, 357, 360, 360, 361, - 361, 362, 362, 363, 363, 364, 364, 364, 365, 365, - 366, 367, 367, 368, 368, 368, 368, 368, 368, 368, - 369, 370, 371, 369, 372, 372, 374, 373, 375, 373, - 376, 376, 377, 377, 378, 378, 379, 380, 380, 381, - 381, 383, 382, 384, 384, 385, 385, 387, 386, 388, - 386, 389, 386, 390, 390, 391, 391, 392, 392, 393, - 393, 393, 393, 393, 394, 394, 395, 395, 395, 397, - 396 + 0, 406, 407, 408, 408, 408, 408, 408, 408, 408, + 408, 408, 408, 408, 408, 408, 408, 409, 409, 409, + 409, 409, 409, 410, 411, 412, 413, 413, 414, 414, + 415, 415, 416, 417, 417, 417, 418, 418, 418, 418, + 419, 419, 419, 419, 420, 420, 420, 420, 421, 421, + 421, 422, 422, 422, 423, 423, 423, 423, 423, 424, + 424, 424, 425, 425, 426, 426, 427, 427, 428, 428, + 429, 429, 430, 430, 431, 432, 431, 433, 433, 434, + 434, 434, 434, 434, 434, 434, 434, 434, 434, 434, + 435, 435, 436, 437, 437, 437, 437, 437, 437, 437, + 437, 437, 439, 438, 440, 440, 441, 442, 442, 443, + 443, 444, 445, 445, 446, 446, 446, 446, 447, 448, + 448, 448, 448, 448, 449, 449, 449, 449, 449, 450, + 450, 451, 452, 452, 452, 452, 452, 452, 452, 452, + 453, 454, 454, 455, 455, 455, 456, 457, 457, 458, + 458, 458, 458, 458, 458, 458, 459, 459, 459, 459, + 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, + 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, + 459, 459, 459, 459, 459, 460, 461, 461, 462, 462, + 463, 463, 463, 463, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 464, 464, 464, 464, 464, 464, 464, 464, 464, 464, + 465, 465, 465, 467, 466, 468, 466, 469, 469, 470, + 470, 471, 471, 472, 472, 473, 473, 473, 474, 474, + 475, 476, 476, 477, 477, 477, 477, 477, 477, 477, + 478, 479, 480, 478, 481, 481, 483, 482, 484, 482, + 485, 485, 486, 486, 487, 487, 488, 488, 489, 490, + 490, 491, 491, 492, 492, 494, 493, 495, 495, 496, + 496, 497, 497, 499, 498, 500, 498, 501, 498, 502, + 502, 503, 503, 504, 504, 505, 505, 505, 505, 505, + 506, 506, 507, 507, 507, 509, 508, 510, 511, 511, + 512, 512 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 4, 1, 3, 2, - 2, 1, 1, 1, 2, 2, 2, 1, 2, 3, - 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, - 1, 1, 3, 3, 3, 1, 3, 3, 1, 3, - 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, - 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, - 3, 1, 0, 6, 1, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, - 2, 2, 4, 2, 3, 4, 2, 3, 4, 0, - 6, 2, 3, 2, 1, 1, 2, 3, 3, 2, - 3, 2, 1, 2, 1, 1, 1, 3, 4, 6, - 5, 1, 2, 3, 5, 4, 1, 2, 1, 1, - 1, 1, 1, 4, 1, 3, 1, 3, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 1, 4, 1, + 3, 2, 2, 1, 1, 1, 2, 2, 2, 1, + 2, 3, 2, 1, 1, 1, 1, 2, 2, 2, + 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, + 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, + 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 3, 1, 0, 6, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 1, 2, 2, 4, 2, 3, 4, 2, + 3, 4, 0, 6, 2, 3, 2, 1, 1, 2, + 3, 3, 2, 3, 2, 1, 2, 1, 1, 1, + 3, 4, 6, 5, 1, 2, 3, 5, 4, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 4, 1, 3, 1, 3, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 4, 1, 1, 3, 1, 2, + 2, 3, 3, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 3, 1, - 2, 2, 3, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -2649,11 +3445,12 @@ static const yytype_uint8 yyr2[] = 4, 1, 3, 1, 2, 1, 3, 4, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 5, 1, 1, 0, 2, 0, 2, - 2, 3, 1, 2, 1, 2, 5, 3, 1, 1, - 4, 0, 8, 0, 1, 3, 2, 0, 6, 0, - 8, 0, 7, 1, 1, 1, 0, 2, 3, 2, - 2, 2, 3, 2, 1, 2, 1, 1, 1, 0, - 3 + 2, 3, 1, 2, 1, 2, 1, 2, 5, 3, + 1, 1, 4, 1, 2, 0, 8, 0, 1, 3, + 2, 1, 2, 0, 6, 0, 8, 0, 7, 1, + 1, 1, 0, 2, 3, 2, 2, 2, 3, 2, + 1, 2, 1, 1, 1, 0, 3, 5, 1, 3, + 1, 4 }; @@ -2938,11 +3735,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -2999,7 +3796,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -3336,238 +4133,250 @@ yyreduce: switch (yyn) { case 2: -#line 253 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 294 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleVariable((yyvsp[0].lex).loc, (yyvsp[0].lex).symbol, (yyvsp[0].lex).string); } -#line 3344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4141 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 3: -#line 259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 300 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3352 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4149 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 4: -#line 262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 303 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 3360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4158 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 5: -#line 265 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 307 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); + } +#line 4167 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 6: +#line 311 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); + } +#line 4175 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 7: +#line 314 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); } -#line 3369 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4184 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 6: -#line 269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 8: +#line 318 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).i64, (yyvsp[0].lex).loc, true); } -#line 3378 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4193 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 7: -#line 273 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 9: +#line 322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).u64, (yyvsp[0].lex).loc, true); } -#line 3387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 8: -#line 277 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); -#endif - } -#line 3398 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 9: -#line 283 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); -#endif - } -#line 3409 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4202 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 10: -#line 289 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 326 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); + parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((short)(yyvsp[0].lex).i, (yyvsp[0].lex).loc, true); } -#line 3417 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 11: -#line 292 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 330 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt16Check((yyvsp[0].lex).loc, "16-bit unsigned integer literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((unsigned short)(yyvsp[0].lex).u, (yyvsp[0].lex).loc, true); + } +#line 4220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 12: +#line 334 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat, (yyvsp[0].lex).loc, true); + } +#line 4228 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 13: +#line 337 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double literal"); (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtDouble, (yyvsp[0].lex).loc, true); } -#line 3426 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 12: -#line 296 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); -#endif - } -#line 3437 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 13: -#line 302 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); - } -#line 3445 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4237 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 14: -#line 305 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 341 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.float16Check((yyvsp[0].lex).loc, "half float literal"); + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).d, EbtFloat16, (yyvsp[0].lex).loc, true); + } +#line 4246 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 15: +#line 345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion((yyvsp[0].lex).b, (yyvsp[0].lex).loc, true); + } +#line 4254 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 16: +#line 348 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); if ((yyval.interm.intermTypedNode)->getAsConstantUnion()) (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } -#line 3455 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 15: -#line 313 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); - } -#line 3463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 16: -#line 316 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); - } -#line 3471 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4264 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 17: -#line 319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 356 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3479 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4272 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 18: -#line 322 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); + (yyval.interm.intermTypedNode) = parseContext.handleBracketDereference((yyvsp[-2].lex).loc, (yyvsp[-3].interm.intermTypedNode), (yyvsp[-1].interm.intermTypedNode)); } -#line 3487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4280 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 19: -#line 325 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); + } +#line 4288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 20: +#line 365 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermTypedNode) = parseContext.handleDotDereference((yyvsp[0].lex).loc, (yyvsp[-2].interm.intermTypedNode), *(yyvsp[0].lex).string); + } +#line 4296 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 21: +#line 368 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "++", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "++", EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 3497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4306 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 20: -#line 330 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 22: +#line 373 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.variableCheck((yyvsp[-1].interm.intermTypedNode)); parseContext.lValueErrorCheck((yyvsp[0].lex).loc, "--", (yyvsp[-1].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[0].lex).loc, "--", EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode)); } -#line 3507 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4316 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 21: -#line 338 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 23: +#line 381 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.integerCheck((yyvsp[0].interm.intermTypedNode), "[]"); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4325 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 22: -#line 345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 24: +#line 388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleFunctionCall((yyvsp[0].interm).loc, (yyvsp[0].interm).function, (yyvsp[0].interm).intermNode); delete (yyvsp[0].interm).function; } -#line 3525 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 23: -#line 352 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[0].interm); - } -#line 3533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 24: -#line 358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-1].interm); - (yyval.interm).loc = (yyvsp[0].lex).loc; - } -#line 3542 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4334 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 25: -#line 362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm) = (yyvsp[0].interm); + } +#line 4342 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 26: +#line 401 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-1].interm); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 3551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 26: -#line 369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm) = (yyvsp[-1].interm); - } -#line 3559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4351 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 27: -#line 372 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 405 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - (yyval.interm) = (yyvsp[0].interm); + (yyval.interm) = (yyvsp[-1].interm); + (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 3567 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 28: -#line 378 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 412 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm) = (yyvsp[-1].interm); + } +#line 4368 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 29: +#line 415 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm) = (yyvsp[0].interm); + } +#line 4376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 30: +#line 421 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); @@ -3575,11 +4384,11 @@ yyreduce: (yyval.interm).function = (yyvsp[-1].interm).function; (yyval.interm).intermNode = (yyvsp[0].interm.intermTypedNode); } -#line 3579 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4388 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 29: -#line 385 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 31: +#line 428 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType }; param.type->shallowCopy((yyvsp[0].interm.intermTypedNode)->getType()); @@ -3587,29 +4396,29 @@ yyreduce: (yyval.interm).function = (yyvsp[-2].interm).function; (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); } -#line 3591 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4400 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 30: -#line 395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 32: +#line 438 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-1].interm); } -#line 3599 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4408 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 31: -#line 403 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 33: +#line 446 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Constructor (yyval.interm).intermNode = 0; (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); } -#line 3609 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4418 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 32: -#line 408 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 34: +#line 451 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // Should be a method or subroutine call, but we haven't recognized the arguments yet. @@ -3637,40 +4446,50 @@ yyreduce: (yyval.interm).function = new TFunction(&empty, TType(EbtVoid), EOpNull); } } -#line 3641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4450 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 33: -#line 438 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 35: +#line 478 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + // Constructor + (yyval.interm).intermNode = 0; + (yyval.interm).function = parseContext.handleConstructorCall((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type)); + } +#line 4460 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 36: +#line 486 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.variableCheck((yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); if (TIntermMethod* method = (yyvsp[0].interm.intermTypedNode)->getAsMethodNode()) parseContext.error((yyvsp[0].interm.intermTypedNode)->getLoc(), "incomplete method syntax", method->getMethodName().c_str(), ""); } -#line 3652 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4471 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 34: -#line 444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 37: +#line 492 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "++", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "++", EOpPreIncrement, (yyvsp[0].interm.intermTypedNode)); } -#line 3661 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4480 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 35: -#line 448 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 38: +#line 496 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.lValueErrorCheck((yyvsp[-1].lex).loc, "--", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.handleUnaryMath((yyvsp[-1].lex).loc, "--", EOpPreDecrement, (yyvsp[0].interm.intermTypedNode)); } -#line 3670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 36: -#line 452 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 39: +#line 500 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm).op != EOpNull) { char errorOp[2] = {0, 0}; @@ -3687,179 +4506,179 @@ yyreduce: (yyval.interm.intermTypedNode)->getAsConstantUnion()->setExpression(); } } -#line 3691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 37: -#line 472 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } -#line 3697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 38: -#line 473 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } -#line 3703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 39: -#line 474 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } -#line 3709 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4510 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 40: -#line 475 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpBitwiseNot; - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise not"); } -#line 3716 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 520 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNull; } +#line 4516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 41: -#line 481 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3722 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 521 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpNegative; } +#line 4522 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 42: -#line 482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLogicalNot; } +#line 4528 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 43: +#line 523 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpBitwiseNot; + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise not"); } +#line 4535 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 44: +#line 529 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } +#line 4541 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 45: +#line 530 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "*", EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 43: -#line 487 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 46: +#line 535 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "/", EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3742 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4561 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 44: -#line 492 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 47: +#line 540 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "%"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "%", EOpMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 45: -#line 501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 48: +#line 549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3759 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 46: -#line 502 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 49: +#line 550 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "+", EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4588 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 47: -#line 507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 50: +#line 555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "-", EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4598 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 48: -#line 515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 51: +#line 563 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3785 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4604 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 49: -#line 516 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 52: +#line 564 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift left"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<<", EOpLeftShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3796 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4615 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 50: -#line 522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 53: +#line 570 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bit shift right"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">>", EOpRightShift, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3807 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 51: -#line 531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 54: +#line 579 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4632 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 52: -#line 532 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 55: +#line 580 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<", EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4642 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 53: -#line 537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 56: +#line 585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">", EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4652 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 54: -#line 542 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 57: +#line 590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "<=", EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4662 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 55: -#line 547 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 58: +#line 595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, ">=", EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4672 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 56: -#line 555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 59: +#line 603 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3859 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4678 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 57: -#line 556 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 60: +#line 604 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "=="); @@ -3868,11 +4687,11 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3872 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 58: -#line 564 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 61: +#line 612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayObjectCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array comparison"); parseContext.opaqueCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "!="); @@ -3881,124 +4700,124 @@ yyreduce: if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4704 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 59: -#line 575 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 62: +#line 623 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3891 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 60: -#line 576 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 63: +#line 624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise and"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&", EOpAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4721 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 61: -#line 585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 64: +#line 633 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3908 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4727 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 62: -#line 586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 65: +#line 634 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise exclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^", EOpExclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3919 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4738 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 63: -#line 595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 66: +#line 643 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3925 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4744 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 64: -#line 596 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 67: +#line 644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[-1].lex).loc, "bitwise inclusive or"); (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "|", EOpInclusiveOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 3936 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4755 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 65: -#line 605 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 68: +#line 653 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4761 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 66: -#line 606 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 69: +#line 654 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "&&", EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3952 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 67: -#line 614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 70: +#line 662 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3958 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4777 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 68: -#line 615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 71: +#line 663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "^^", EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3968 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4787 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 69: -#line 623 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 72: +#line 671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3974 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4793 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 70: -#line 624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 73: +#line 672 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.handleBinaryMath((yyvsp[-1].lex).loc, "||", EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); if ((yyval.interm.intermTypedNode) == 0) (yyval.interm.intermTypedNode) = parseContext.intermediate.addConstantUnion(false, (yyvsp[-1].lex).loc); } -#line 3984 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4803 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 71: -#line 632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 74: +#line 680 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 3990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4809 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 72: -#line 633 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 75: +#line 681 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } -#line 3998 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4817 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 73: -#line 636 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 76: +#line 684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-5].interm.intermTypedNode)); @@ -4011,20 +4830,21 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 4015 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4834 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 74: -#line 651 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 77: +#line 699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4840 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 75: -#line 652 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 78: +#line 700 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.arrayObjectCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "array assignment"); parseContext.opaqueCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); + parseContext.storage16BitAssignmentCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); parseContext.specializationCheck((yyvsp[-1].interm).loc, (yyvsp[-2].interm.intermTypedNode)->getType(), "="); parseContext.lValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[-2].interm.intermTypedNode)); parseContext.rValueErrorCheck((yyvsp[-1].interm).loc, "assign", (yyvsp[0].interm.intermTypedNode)); @@ -4034,119 +4854,119 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } } -#line 4038 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4858 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 76: -#line 667 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 79: +#line 716 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAssign; } -#line 4047 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4867 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 77: -#line 671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 80: +#line 720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpMulAssign; } -#line 4056 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4876 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 78: -#line 675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 81: +#line 724 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpDivAssign; } -#line 4065 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 79: -#line 679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 82: +#line 728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "%="); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpModAssign; } -#line 4075 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4895 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 80: -#line 684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 83: +#line 733 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAddAssign; } -#line 4084 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4904 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 81: -#line 688 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 84: +#line 737 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpSubAssign; } -#line 4093 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4913 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 82: -#line 692 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 85: +#line 741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift left assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpLeftShiftAssign; } -#line 4102 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4922 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 83: -#line 696 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 86: +#line 745 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bit-shift right assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpRightShiftAssign; } -#line 4111 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4931 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 84: -#line 700 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 87: +#line 749 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-and assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpAndAssign; } -#line 4120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4940 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 85: -#line 704 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 88: +#line 753 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-xor assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpExclusiveOrAssign; } -#line 4129 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4949 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 86: -#line 708 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 89: +#line 757 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "bitwise-or assign"); (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).op = EOpInclusiveOrAssign; } -#line 4138 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4958 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 87: -#line 715 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 90: +#line 764 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4146 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4966 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 88: -#line 718 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 91: +#line 767 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.samplerConstructorLocationCheck((yyvsp[-1].lex).loc, ",", (yyvsp[0].interm.intermTypedNode)); (yyval.interm.intermTypedNode) = parseContext.intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yyvsp[-1].lex).loc); @@ -4155,40 +4975,40 @@ yyreduce: (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } } -#line 4159 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 89: -#line 729 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 92: +#line 778 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.constantValueCheck((yyvsp[0].interm.intermTypedNode), ""); (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 4168 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4988 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 90: -#line 736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 93: +#line 785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.handleFunctionDeclarator((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).function, true /* prototype */); (yyval.interm.intermNode) = 0; // TODO: 4.0 functionality: subroutines: make the identifier a user type for this signature } -#line 4178 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 4998 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 91: -#line 741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 94: +#line 790 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm).intermNode && (yyvsp[-1].interm).intermNode->getAsAggregate()) (yyvsp[-1].interm).intermNode->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm).intermNode; } -#line 4188 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 92: -#line 746 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 95: +#line 795 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[-3].lex).loc, ENoProfile, 130, 0, "precision statement"); @@ -4197,75 +5017,75 @@ yyreduce: parseContext.setDefaultPrecision((yyvsp[-3].lex).loc, (yyvsp[-1].interm.type), (yyvsp[-2].interm.type).qualifier.precision); (yyval.interm.intermNode) = 0; } -#line 4201 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 93: -#line 754 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 96: +#line 803 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.declareBlock((yyvsp[-1].interm).loc, *(yyvsp[-1].interm).typeList); (yyval.interm.intermNode) = 0; } -#line 4210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 94: -#line 758 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 97: +#line 807 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.declareBlock((yyvsp[-2].interm).loc, *(yyvsp[-2].interm).typeList, (yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } -#line 4219 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5039 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 95: -#line 762 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 98: +#line 811 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.declareBlock((yyvsp[-3].interm).loc, *(yyvsp[-3].interm).typeList, (yyvsp[-2].lex).string, (yyvsp[-1].interm).arraySizes); (yyval.interm.intermNode) = 0; } -#line 4228 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5048 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 96: -#line 766 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 99: +#line 815 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.updateStandaloneQualifierDefaults((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type)); (yyval.interm.intermNode) = 0; } -#line 4238 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5058 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 97: -#line 771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 100: +#line 820 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkNoShaderLayouts((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).shaderQualifiers); parseContext.addQualifierToExisting((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, *(yyvsp[-1].lex).string); (yyval.interm.intermNode) = 0; } -#line 4248 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5068 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 98: -#line 776 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 101: +#line 825 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); (yyvsp[-1].interm.identifierList)->push_back((yyvsp[-2].lex).string); parseContext.addQualifierToExisting((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier, *(yyvsp[-1].interm.identifierList)); (yyval.interm.intermNode) = 0; } -#line 4259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5079 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 99: -#line 785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 102: +#line 834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedBlockCheck((yyvsp[-2].interm.type).loc); } -#line 4265 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5085 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 100: -#line 785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 103: +#line 834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.structNestingLevel; parseContext.blockName = (yyvsp[-4].lex).string; @@ -4275,54 +5095,54 @@ yyreduce: (yyval.interm).loc = (yyvsp[-5].interm.type).loc; (yyval.interm).typeList = (yyvsp[-1].interm.typeList); } -#line 4279 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5099 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 101: -#line 796 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 104: +#line 845 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.identifierList) = new TIdentifierList; (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 4288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5108 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 102: -#line 800 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 105: +#line 849 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.identifierList) = (yyvsp[-2].interm.identifierList); (yyval.interm.identifierList)->push_back((yyvsp[0].lex).string); } -#line 4297 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5117 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 103: -#line 807 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 106: +#line 856 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).function = (yyvsp[-1].interm.function); (yyval.interm).loc = (yyvsp[0].lex).loc; } -#line 4306 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5126 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 104: -#line 814 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 107: +#line 863 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 4314 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5134 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 105: -#line 817 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 108: +#line 866 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.function) = (yyvsp[0].interm.function); } -#line 4322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5142 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 106: -#line 824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 109: +#line 873 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // Add the parameter (yyval.interm.function) = (yyvsp[-1].interm.function); @@ -4331,11 +5151,11 @@ yyreduce: else delete (yyvsp[0].interm).param.type; } -#line 4335 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5155 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 107: -#line 832 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 110: +#line 881 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // Only first parameter of one-parameter functions can be void @@ -4353,11 +5173,11 @@ yyreduce: (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param); } } -#line 4357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5177 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 108: -#line 852 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 111: +#line 901 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).qualifier.storage != EvqGlobal && (yyvsp[-2].interm.type).qualifier.storage != EvqTemporary) { parseContext.error((yyvsp[-1].lex).loc, "no qualifiers allowed for function return", @@ -4377,11 +5197,11 @@ yyreduce: function = new TFunction((yyvsp[-1].lex).string, type); (yyval.interm.function) = function; } -#line 4381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5201 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 109: -#line 875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 112: +#line 924 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-1].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -4397,33 +5217,35 @@ yyreduce: (yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).param = param; } -#line 4401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 110: -#line 890 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 113: +#line 939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); parseContext.arraySizeRequiredCheck((yyvsp[-2].interm.type).loc, *(yyvsp[-2].interm.type).arraySizes); } - parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[-2].interm.type).arraySizes, (yyvsp[0].interm).arraySizes); + TType* type = new TType((yyvsp[-2].interm.type)); + type->transferArraySizes((yyvsp[0].interm).arraySizes); + type->copyArrayInnerSizes((yyvsp[-2].interm.type).arraySizes); + parseContext.arrayOfArrayVersionCheck((yyvsp[-1].lex).loc, type->getArraySizes()); parseContext.arraySizeRequiredCheck((yyvsp[0].interm).loc, *(yyvsp[0].interm).arraySizes); parseContext.reservedErrorCheck((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string); - (yyvsp[-2].interm.type).arraySizes = (yyvsp[0].interm).arraySizes; + TParameter param = { (yyvsp[-1].lex).string, type }; - TParameter param = { (yyvsp[-1].lex).string, new TType((yyvsp[-2].interm.type))}; (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).param = param; } -#line 4423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5245 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 111: -#line 913 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 114: +#line 964 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) @@ -4435,23 +5257,23 @@ yyreduce: parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 4439 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5261 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 112: -#line 924 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 115: +#line 975 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); - parseContext.paramCheckFix((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); + parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); } -#line 4451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5273 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 113: -#line 934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 116: +#line 985 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); if ((yyvsp[-1].interm.type).qualifier.precision != EpqNone) @@ -4462,130 +5284,130 @@ yyreduce: parseContext.parameterTypeCheck((yyvsp[0].interm).loc, (yyvsp[-1].interm.type).qualifier.storage, *(yyval.interm).param.type); parseContext.paramCheckFix((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, *(yyval.interm).param.type); } -#line 4466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5288 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 114: -#line 944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 117: +#line 995 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); parseContext.parameterTypeCheck((yyvsp[0].interm).loc, EvqIn, *(yyvsp[0].interm).param.type); - parseContext.paramCheckFix((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); + parseContext.paramCheckFixStorage((yyvsp[0].interm).loc, EvqTemporary, *(yyval.interm).param.type); parseContext.precisionQualifierCheck((yyval.interm).loc, (yyval.interm).param.type->getBasicType(), (yyval.interm).param.type->getQualifier()); } -#line 4478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5300 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 115: -#line 954 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 118: +#line 1005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TParameter param = { 0, new TType((yyvsp[0].interm.type)) }; (yyval.interm).param = param; if ((yyvsp[0].interm.type).arraySizes) parseContext.arraySizeRequiredCheck((yyvsp[0].interm.type).loc, *(yyvsp[0].interm.type).arraySizes); } -#line 4489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5311 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 116: -#line 963 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 119: +#line 1014 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[0].interm); } -#line 4497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5319 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 117: -#line 966 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 120: +#line 1017 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-2].interm); parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-2].interm).type); } -#line 4506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5328 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 118: -#line 970 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 121: +#line 1021 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-3].interm); parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-3].interm).type, (yyvsp[0].interm).arraySizes); } -#line 4515 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5337 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 119: -#line 974 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 122: +#line 1025 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-5].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-5].interm).type, (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-5].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } -#line 4525 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5347 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 120: -#line 979 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 123: +#line 1030 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-4].interm).type; TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-4].interm).type, 0, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate((yyvsp[-4].interm).intermNode, initNode, (yyvsp[-1].lex).loc); } -#line 4535 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 121: -#line 987 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 124: +#line 1038 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[0].interm.type); (yyval.interm).intermNode = 0; parseContext.declareTypeDefaults((yyval.interm).loc, (yyval.interm).type); } -#line 4545 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5367 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 122: -#line 992 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 125: +#line 1043 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-1].interm.type); (yyval.interm).intermNode = 0; parseContext.declareVariable((yyvsp[0].lex).loc, *(yyvsp[0].lex).string, (yyvsp[-1].interm.type)); } -#line 4555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5377 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 123: -#line 997 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 126: +#line 1048 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-2].interm.type); (yyval.interm).intermNode = 0; parseContext.declareVariable((yyvsp[-1].lex).loc, *(yyvsp[-1].lex).string, (yyvsp[-2].interm.type), (yyvsp[0].interm).arraySizes); } -#line 4565 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 124: -#line 1002 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 127: +#line 1053 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-4].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-3].lex).loc, *(yyvsp[-3].lex).string, (yyvsp[-4].interm.type), (yyvsp[-2].interm).arraySizes, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); } -#line 4575 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5397 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 125: -#line 1007 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 128: +#line 1058 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).type = (yyvsp[-3].interm.type); TIntermNode* initNode = parseContext.declareVariable((yyvsp[-2].lex).loc, *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), 0, (yyvsp[0].interm.intermTypedNode)); (yyval.interm).intermNode = parseContext.intermediate.growAggregate(0, initNode, (yyvsp[-1].lex).loc); } -#line 4585 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5407 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 126: -#line 1016 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 129: +#line 1067 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); @@ -4597,11 +5419,11 @@ yyreduce: parseContext.precisionQualifierCheck((yyval.interm.type).loc, (yyval.interm.type).basicType, (yyval.interm.type).qualifier); } -#line 4601 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5423 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 127: -#line 1027 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 130: +#line 1078 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalQualifierFixCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier); parseContext.globalQualifierTypeCheck((yyvsp[-1].interm.type).loc, (yyvsp[-1].interm.type).qualifier, (yyvsp[0].interm.type)); @@ -4612,7 +5434,7 @@ yyreduce: } if ((yyvsp[0].interm.type).arraySizes && parseContext.arrayQualifierError((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).qualifier)) - (yyvsp[0].interm.type).arraySizes = 0; + (yyvsp[0].interm.type).arraySizes = nullptr; parseContext.checkNoShaderLayouts((yyvsp[0].interm.type).loc, (yyvsp[-1].interm.type).shaderQualifiers); (yyvsp[0].interm.type).shaderQualifiers.merge((yyvsp[-1].interm.type).shaderQualifiers); @@ -4626,22 +5448,22 @@ yyreduce: (parseContext.language == EShLangFragment && (yyval.interm.type).qualifier.storage == EvqVaryingIn))) (yyval.interm.type).qualifier.smooth = true; } -#line 4630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5452 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 128: -#line 1054 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 131: +#line 1105 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "invariant"); parseContext.profileRequires((yyval.interm.type).loc, ENoProfile, 120, 0, "invariant"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.invariant = true; } -#line 4641 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 129: -#line 1063 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 132: +#line 1114 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "smooth"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "smooth"); @@ -4649,11 +5471,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.smooth = true; } -#line 4653 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5475 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 130: -#line 1070 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 133: +#line 1121 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "flat"); parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "flat"); @@ -4661,23 +5483,27 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.flat = true; } -#line 4665 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 131: -#line 1077 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 134: +#line 1128 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "noperspective"); +#ifdef NV_EXTENSIONS + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_shader_noperspective_interpolation, "noperspective"); +#else parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "noperspective"); +#endif parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "noperspective"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.nopersp = true; } -#line 4677 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 132: -#line 1084 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 135: +#line 1139 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { #ifdef AMD_EXTENSIONS parseContext.globalCheck((yyvsp[0].lex).loc, "__explicitInterpAMD"); @@ -4687,84 +5513,144 @@ yyreduce: (yyval.interm.type).qualifier.explicitInterp = true; #endif } -#line 4691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5517 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 133: -#line 1096 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 136: +#line 1148 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + parseContext.globalCheck((yyvsp[0].lex).loc, "pervertexNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECompatibilityProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); + parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 0, E_GL_NV_fragment_shader_barycentric, "fragment shader barycentric"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.pervertexNV = true; +#endif + } +#line 5532 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 137: +#line 1158 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + // No need for profile version or extension check. Shader stage already checks both. + parseContext.globalCheck((yyvsp[0].lex).loc, "perprimitiveNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangFragmentMask | EShLangMeshNVMask), "perprimitiveNV"); + // Fragment shader stage doesn't check for extension. So we explicitly add below extension check. + if (parseContext.language == EShLangFragment) + parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_NV_mesh_shader, "perprimitiveNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.perPrimitiveNV = true; +#endif + } +#line 5549 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 138: +#line 1170 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + // No need for profile version or extension check. Shader stage already checks both. + parseContext.globalCheck((yyvsp[0].lex).loc, "perviewNV"); + parseContext.requireStage((yyvsp[0].lex).loc, EShLangMeshNV, "perviewNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.perViewNV = true; +#endif + } +#line 5563 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 139: +#line 1179 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + // No need for profile version or extension check. Shader stage already checks both. + parseContext.globalCheck((yyvsp[0].lex).loc, "taskNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask), "taskNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.perTaskNV = true; +#endif + } +#line 5577 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 140: +#line 1191 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-1].interm.type); } -#line 4699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5585 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 134: -#line 1102 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 141: +#line 1197 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4707 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5593 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 135: -#line 1105 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 142: +#line 1200 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-2].interm.type); (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeObjectLayoutQualifiers((yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 4717 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 136: -#line 1112 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 143: +#line 1207 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), *(yyvsp[0].lex).string); } -#line 4726 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 137: -#line 1116 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 144: +#line 1211 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[-2].lex).loc); parseContext.setLayoutQualifier((yyvsp[-2].lex).loc, (yyval.interm.type), *(yyvsp[-2].lex).string, (yyvsp[0].interm.intermTypedNode)); } -#line 4735 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5621 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 138: -#line 1120 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 145: +#line 1215 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // because "shared" is both an identifier and a keyword (yyval.interm.type).init((yyvsp[0].lex).loc); TString strShared("shared"); parseContext.setLayoutQualifier((yyvsp[0].lex).loc, (yyval.interm.type), strShared); } -#line 4745 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5631 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 139: -#line 1128 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 146: +#line 1223 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyval.interm.type).loc, ECoreProfile | ECompatibilityProfile, 400, E_GL_ARB_gpu_shader5, "precise"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, "precise"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.noContraction = true; } -#line 4756 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5642 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 140: -#line 1137 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 147: +#line 1232 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4764 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 141: -#line 1140 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 148: +#line 1235 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[-1].interm.type); if ((yyval.interm.type).basicType == EbtVoid) @@ -4773,72 +5659,80 @@ yyreduce: (yyval.interm.type).shaderQualifiers.merge((yyvsp[0].interm.type).shaderQualifiers); parseContext.mergeQualifiers((yyval.interm.type).loc, (yyval.interm.type).qualifier, (yyvsp[0].interm.type).qualifier, false); } -#line 4777 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5663 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 142: -#line 1151 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 149: +#line 1246 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4785 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5671 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 143: -#line 1154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 150: +#line 1249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4793 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5679 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 144: -#line 1157 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 151: +#line 1252 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkPrecisionQualifier((yyvsp[0].interm.type).loc, (yyvsp[0].interm.type).qualifier.precision); (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5688 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 145: -#line 1161 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 152: +#line 1256 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4811 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 146: -#line 1165 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 153: +#line 1260 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5706 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 147: -#line 1169 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 154: +#line 1264 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // allow inheritance of storage qualifier from block declaration (yyval.interm.type) = (yyvsp[0].interm.type); } -#line 4829 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5715 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 148: -#line 1176 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 155: +#line 1268 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type) = (yyvsp[0].interm.type); + } +#line 5723 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 156: +#line 1274 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqConst; // will later turn into EvqConstReadOnly, if the initializer is not constant } -#line 4838 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5732 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 149: -#line 1180 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 157: +#line 1278 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangVertex, "attribute"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "attribute"); @@ -4851,11 +5745,11 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 4855 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5749 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 150: -#line 1192 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 158: +#line 1290 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.checkDeprecated((yyvsp[0].lex).loc, ENoProfile, 130, "varying"); parseContext.checkDeprecated((yyvsp[0].lex).loc, ECoreProfile, 130, "varying"); @@ -4870,43 +5764,43 @@ yyreduce: else (yyval.interm.type).qualifier.storage = EvqVaryingIn; } -#line 4874 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5768 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 151: -#line 1206 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 159: +#line 1304 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "inout"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqInOut; } -#line 4884 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5778 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 152: -#line 1211 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 160: +#line 1309 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "in"); (yyval.interm.type).init((yyvsp[0].lex).loc); // whether this is a parameter "in" or a pipeline "in" will get sorted out a bit later (yyval.interm.type).qualifier.storage = EvqIn; } -#line 4895 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5789 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 153: -#line 1217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 161: +#line 1315 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "out"); (yyval.interm.type).init((yyvsp[0].lex).loc); // whether this is a parameter "out" or a pipeline "out" will get sorted out a bit later (yyval.interm.type).qualifier.storage = EvqOut; } -#line 4906 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 154: -#line 1223 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 162: +#line 1321 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 120, 0, "centroid"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 300, 0, "centroid"); @@ -4914,180 +5808,317 @@ yyreduce: (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.centroid = true; } -#line 4918 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5812 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 155: -#line 1230 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 163: +#line 1328 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "patch"); parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangTessControlMask | EShLangTessEvaluationMask), "patch"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.patch = true; } -#line 4929 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 156: -#line 1236 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 164: +#line 1334 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "sample"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.sample = true; } -#line 4939 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 157: -#line 1241 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 165: +#line 1339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "uniform"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqUniform; } -#line 4949 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5843 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 158: -#line 1246 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 166: +#line 1344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "buffer"); (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqBuffer; } -#line 4959 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5853 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 159: -#line 1251 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 167: +#line 1349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + parseContext.globalCheck((yyvsp[0].lex).loc, "hitAttributeNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangIntersectNVMask | EShLangClosestHitNVMask + | EShLangAnyHitNVMask), "hitAttributeNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "hitAttributeNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqHitAttrNV; +#endif + } +#line 5868 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 168: +#line 1359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenNVMask | EShLangClosestHitNVMask | + EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqPayloadNV; +#endif + } +#line 5883 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 169: +#line 1369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + parseContext.globalCheck((yyvsp[0].lex).loc, "rayPayloadInNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangClosestHitNVMask | + EShLangAnyHitNVMask | EShLangMissNVMask), "rayPayloadInNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "rayPayloadInNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqPayloadInNV; +#endif + } +#line 5898 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 170: +#line 1379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangRayGenNVMask | + EShLangClosestHitNVMask | EShLangMissNVMask | EShLangCallableNVMask), "callableDataNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqCallableDataNV; +#endif + } +#line 5913 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 171: +#line 1389 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + parseContext.globalCheck((yyvsp[0].lex).loc, "callableDataInNV"); + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangCallableNVMask), "callableDataInNV"); + parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile, 460, E_GL_NV_ray_tracing, "callableDataInNV"); + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.storage = EvqCallableDataInNV; +#endif + } +#line 5927 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 172: +#line 1398 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.globalCheck((yyvsp[0].lex).loc, "shared"); parseContext.profileRequires((yyvsp[0].lex).loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_compute_shader, "shared"); parseContext.profileRequires((yyvsp[0].lex).loc, EEsProfile, 310, 0, "shared"); +#ifdef NV_EXTENSIONS + parseContext.requireStage((yyvsp[0].lex).loc, (EShLanguageMask)(EShLangComputeMask | EShLangMeshNVMask | EShLangTaskNVMask), "shared"); +#else parseContext.requireStage((yyvsp[0].lex).loc, EShLangCompute, "shared"); +#endif (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.storage = EvqShared; } -#line 4972 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5944 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 160: -#line 1259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 173: +#line 1410 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.coherent = true; } -#line 4981 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 5953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 161: -#line 1263 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 174: +#line 1414 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc); + parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "devicecoherent"); + (yyval.interm.type).qualifier.devicecoherent = true; + } +#line 5963 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 175: +#line 1419 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc); + parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "queuefamilycoherent"); + (yyval.interm.type).qualifier.queuefamilycoherent = true; + } +#line 5973 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 176: +#line 1424 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc); + parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "workgroupcoherent"); + (yyval.interm.type).qualifier.workgroupcoherent = true; + } +#line 5983 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 177: +#line 1429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc); + parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "subgroupcoherent"); + (yyval.interm.type).qualifier.subgroupcoherent = true; + } +#line 5993 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 178: +#line 1434 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc); + parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_KHR_memory_scope_semantics, "nonprivate"); + (yyval.interm.type).qualifier.nonprivate = true; + } +#line 6003 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 179: +#line 1439 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.volatil = true; } -#line 4990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6012 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 162: -#line 1267 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 180: +#line 1443 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.restrict = true; } -#line 4999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 163: -#line 1271 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 181: +#line 1447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.readonly = true; } -#line 5008 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 164: -#line 1275 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 182: +#line 1451 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc); (yyval.interm.type).qualifier.writeonly = true; } -#line 5017 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6039 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 165: -#line 1279 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 183: +#line 1455 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.spvRemoved((yyvsp[0].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[0].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[0].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[0].lex).loc); } -#line 5028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 166: -#line 1285 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 184: +#line 1461 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.spvRemoved((yyvsp[-3].lex).loc, "subroutine"); parseContext.globalCheck((yyvsp[-3].lex).loc, "subroutine"); parseContext.unimplemented((yyvsp[-3].lex).loc, "subroutine"); (yyval.interm.type).init((yyvsp[-3].lex).loc); } -#line 5039 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6061 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 167: -#line 1294 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 185: +#line 1470 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc); + (yyval.interm.type).qualifier.nonUniform = true; + } +#line 6070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 186: +#line 1477 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // TODO } -#line 5047 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6078 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 168: -#line 1297 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 187: +#line 1480 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // TODO: 4.0 semantics: subroutines // 1) make sure each identifier is a type declared earlier with SUBROUTINE // 2) save all of the identifiers for future comparison with the declared function } -#line 5057 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6088 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 169: -#line 1305 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 188: +#line 1488 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); } -#line 5066 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6097 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 170: -#line 1309 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 189: +#line 1492 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayDimCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes, 0); + parseContext.arrayOfArrayVersionCheck((yyvsp[0].interm).loc, (yyvsp[0].interm).arraySizes); (yyval.interm.type) = (yyvsp[-1].interm.type); (yyval.interm.type).qualifier.precision = parseContext.getDefaultPrecision((yyval.interm.type)); (yyval.interm.type).arraySizes = (yyvsp[0].interm).arraySizes; } -#line 5077 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6108 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 171: -#line 1318 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 190: +#line 1501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).arraySizes = new TArraySizes; (yyval.interm).arraySizes->addInnerSize(); } -#line 5087 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6118 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 172: -#line 1323 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 191: +#line 1506 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm).loc = (yyvsp[-2].lex).loc; (yyval.interm).arraySizes = new TArraySizes; @@ -5096,20 +6127,20 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); (yyval.interm).arraySizes->addInnerSize(size); } -#line 5100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6131 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 173: -#line 1331 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 192: +#line 1514 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-2].interm); (yyval.interm).arraySizes->addInnerSize(); } -#line 5109 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 174: -#line 1335 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 193: +#line 1518 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm) = (yyvsp[-3].interm); @@ -5117,2047 +6148,3080 @@ yyreduce: parseContext.arraySizeCheck((yyvsp[-1].interm.intermTypedNode)->getLoc(), (yyvsp[-1].interm.intermTypedNode), size); (yyval.interm).arraySizes->addInnerSize(size); } -#line 5121 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6152 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 175: -#line 1345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 194: +#line 1528 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtVoid; } -#line 5130 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6161 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 176: -#line 1349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 195: +#line 1532 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; } -#line 5139 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 177: -#line 1353 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 196: +#line 1536 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; } -#line 5149 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 178: -#line 1358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 197: +#line 1541 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float", parseContext.symbolTable.atBuiltInLevel()); + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "float16_t", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; -#endif } -#line 5161 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 179: -#line 1365 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 198: +#line 1546 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + } +#line 6200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 199: +#line 1551 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + } +#line 6210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 200: +#line 1556 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt; } -#line 5170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6219 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 180: -#line 1369 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 201: +#line 1560 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint; } -#line 5180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6229 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 181: -#line 1374 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 202: +#line 1565 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt8; + } +#line 6239 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 203: +#line 1570 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint8; + } +#line 6249 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 204: +#line 1575 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt16; + } +#line 6259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 205: +#line 1580 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint16; + } +#line 6269 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 206: +#line 1585 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + } +#line 6279 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 207: +#line 1590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + } +#line 6289 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 208: +#line 1595 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtInt64; } -#line 5190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6299 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 182: -#line 1379 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 209: +#line 1600 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; } -#line 5200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 183: -#line 1384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; -#endif - } -#line 5212 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 184: -#line 1391 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; -#endif - } -#line 5224 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 185: -#line 1398 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - } -#line 5233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 186: -#line 1402 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(2); - } -#line 5243 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 187: -#line 1407 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(3); - } -#line 5253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 188: -#line 1412 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat; - (yyval.interm.type).setVector(4); - } -#line 5263 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 189: -#line 1417 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(2); - } -#line 5274 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 190: -#line 1423 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(3); - } -#line 5285 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 191: -#line 1429 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtDouble; - (yyval.interm.type).setVector(4); - } -#line 5296 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 192: -#line 1435 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(2); -#endif - } -#line 5309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 193: -#line 1443 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(3); -#endif - } -#line 5322 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 194: -#line 1451 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.float16Check((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtFloat16; - (yyval.interm.type).setVector(4); -#endif - } -#line 5335 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 195: -#line 1459 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(2); - } -#line 5345 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 196: -#line 1464 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(3); - } -#line 5355 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 197: -#line 1469 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtBool; - (yyval.interm.type).setVector(4); - } -#line 5365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 198: -#line 1474 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(2); - } -#line 5375 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 199: -#line 1479 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(3); - } -#line 5385 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 200: -#line 1484 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt; - (yyval.interm.type).setVector(4); - } -#line 5395 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 201: -#line 1489 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - (yyval.interm.type).setVector(2); - } -#line 5406 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 202: -#line 1495 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - (yyval.interm.type).setVector(3); - } -#line 5417 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 203: -#line 1501 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt64; - (yyval.interm.type).setVector(4); - } -#line 5428 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 204: -#line 1507 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; - (yyval.interm.type).setVector(2); -#endif - } -#line 5441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 205: -#line 1515 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; - (yyval.interm.type).setVector(3); -#endif - } -#line 5454 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 206: -#line 1523 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtInt16; - (yyval.interm.type).setVector(4); -#endif - } -#line 5467 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 207: -#line 1531 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(2); - } -#line 5478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 208: -#line 1537 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(3); - } -#line 5489 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 209: -#line 1543 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { - parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint; - (yyval.interm.type).setVector(4); - } -#line 5500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 210: -#line 1549 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1605 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(2); + (yyval.interm.type).basicType = EbtBool; } -#line 5511 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6318 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 211: -#line 1555 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1609 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint64; - (yyval.interm.type).setVector(3); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(2); } -#line 5522 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6328 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; case 212: -#line 1561 "MachineIndependent/glslang.y" /* yacc.c:1646 */ +#line 1614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(3); + } +#line 6338 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 213: +#line 1619 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(4); + } +#line 6348 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 214: +#line 1624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(2); + } +#line 6359 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 215: +#line 1630 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(3); + } +#line 6370 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 216: +#line 1636 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.doubleCheck((yyvsp[0].lex).loc, "double vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(4); + } +#line 6381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 217: +#line 1642 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setVector(2); + } +#line 6392 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 218: +#line 1648 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setVector(3); + } +#line 6403 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 219: +#line 1654 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.float16ScalarVectorCheck((yyvsp[0].lex).loc, "half float vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat16; + (yyval.interm.type).setVector(4); + } +#line 6414 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 220: +#line 1660 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(2); + } +#line 6425 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 221: +#line 1666 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(3); + } +#line 6436 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 222: +#line 1672 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setVector(4); + } +#line 6447 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 223: +#line 1678 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(2); + } +#line 6458 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 224: +#line 1684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(3); + } +#line 6469 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 225: +#line 1690 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setVector(4); + } +#line 6480 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 226: +#line 1696 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(2); + } +#line 6490 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 227: +#line 1701 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(3); + } +#line 6500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 228: +#line 1706 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtBool; + (yyval.interm.type).setVector(4); + } +#line 6510 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 229: +#line 1711 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(2); + } +#line 6520 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 230: +#line 1716 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(3); + } +#line 6530 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 231: +#line 1721 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(4); + } +#line 6540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 232: +#line 1726 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt8; + (yyval.interm.type).setVector(2); + } +#line 6551 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 233: +#line 1732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt8; + (yyval.interm.type).setVector(3); + } +#line 6562 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 234: +#line 1738 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt8; + (yyval.interm.type).setVector(4); + } +#line 6573 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 235: +#line 1744 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).setVector(2); + } +#line 6584 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 236: +#line 1750 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).setVector(3); + } +#line 6595 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 237: +#line 1756 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt16; + (yyval.interm.type).setVector(4); + } +#line 6606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 238: +#line 1762 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(2); + } +#line 6617 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 239: +#line 1768 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(3); + } +#line 6628 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 240: +#line 1774 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit signed integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt; + (yyval.interm.type).setVector(4); + } +#line 6639 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 241: +#line 1780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).setVector(2); + } +#line 6650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 242: +#line 1786 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).setVector(3); + } +#line 6661 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 243: +#line 1792 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtInt64; + (yyval.interm.type).setVector(4); + } +#line 6672 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 244: +#line 1798 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(2); + } +#line 6683 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 245: +#line 1804 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(3); + } +#line 6694 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 246: +#line 1810 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.fullIntegerCheck((yyvsp[0].lex).loc, "unsigned integer vector"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(4); + } +#line 6705 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 247: +#line 1816 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).setVector(2); + } +#line 6716 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 248: +#line 1822 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).setVector(3); + } +#line 6727 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 249: +#line 1828 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int8ScalarVectorCheck((yyvsp[0].lex).loc, "8-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint8; + (yyval.interm.type).setVector(4); + } +#line 6738 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 250: +#line 1834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).setVector(2); + } +#line 6749 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 251: +#line 1840 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).setVector(3); + } +#line 6760 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 252: +#line 1846 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int16ScalarVectorCheck((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint16; + (yyval.interm.type).setVector(4); + } +#line 6771 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 253: +#line 1852 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(2); + } +#line 6782 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 254: +#line 1858 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(3); + } +#line 6793 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 255: +#line 1864 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitInt32Check((yyvsp[0].lex).loc, "32-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint; + (yyval.interm.type).setVector(4); + } +#line 6804 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 256: +#line 1870 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(2); + } +#line 6815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 257: +#line 1876 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtUint64; + (yyval.interm.type).setVector(3); + } +#line 6826 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 258: +#line 1882 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.int64Check((yyvsp[0].lex).loc, "64-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtUint64; (yyval.interm.type).setVector(4); } -#line 5533 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6837 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 213: -#line 1567 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; - (yyval.interm.type).setVector(2); -#endif - } -#line 5546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 214: -#line 1575 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; - (yyval.interm.type).setVector(3); -#endif - } -#line 5559 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 215: -#line 1583 "MachineIndependent/glslang.y" /* yacc.c:1646 */ - { -#ifdef AMD_EXTENSIONS - parseContext.int16Check((yyvsp[0].lex).loc, "16-bit unsigned integer vector", parseContext.symbolTable.atBuiltInLevel()); - (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); - (yyval.interm.type).basicType = EbtUint16; - (yyval.interm.type).setVector(4); -#endif - } -#line 5572 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ - break; - - case 216: -#line 1591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 259: +#line 1888 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 5582 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6847 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 217: -#line 1596 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 260: +#line 1893 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 5592 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6857 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 218: -#line 1601 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 261: +#line 1898 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 5602 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6867 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 219: -#line 1606 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 262: +#line 1903 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 2); } -#line 5612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6877 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 220: -#line 1611 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 263: +#line 1908 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 3); } -#line 5622 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6887 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 221: -#line 1616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 264: +#line 1913 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(2, 4); } -#line 5632 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6897 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 222: -#line 1621 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 265: +#line 1918 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 2); } -#line 5642 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6907 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 223: -#line 1626 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 266: +#line 1923 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 3); } -#line 5652 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6917 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 224: -#line 1631 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 267: +#line 1928 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(3, 4); } -#line 5662 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6927 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 225: -#line 1636 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 268: +#line 1933 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 2); } -#line 5672 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6937 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 226: -#line 1641 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 269: +#line 1938 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 3); } -#line 5682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6947 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 227: -#line 1646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 270: +#line 1943 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat; (yyval.interm.type).setMatrix(4, 4); } -#line 5692 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6957 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 228: -#line 1651 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 271: +#line 1948 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 5703 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6968 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 229: -#line 1657 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 272: +#line 1954 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 5714 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 230: -#line 1663 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 273: +#line 1960 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 5725 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 6990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 231: -#line 1669 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 274: +#line 1966 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 2); } -#line 5736 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7001 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 232: -#line 1675 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 275: +#line 1972 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 3); } -#line 5747 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7012 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 233: -#line 1681 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 276: +#line 1978 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(2, 4); } -#line 5758 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7023 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 234: -#line 1687 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 277: +#line 1984 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 2); } -#line 5769 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7034 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 235: -#line 1693 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 278: +#line 1990 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 3); } -#line 5780 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7045 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 236: -#line 1699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 279: +#line 1996 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(3, 4); } -#line 5791 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7056 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 237: -#line 1705 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 280: +#line 2002 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 2); } -#line 5802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7067 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 238: -#line 1711 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 281: +#line 2008 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 3); } -#line 5813 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7078 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 239: -#line 1717 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 282: +#line 2014 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.doubleCheck((yyvsp[0].lex).loc, "double matrix"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtDouble; (yyval.interm.type).setMatrix(4, 4); } -#line 5824 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7089 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 240: -#line 1723 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 283: +#line 2020 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 2); -#endif } -#line 5837 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 241: -#line 1731 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 284: +#line 2026 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); -#endif } -#line 5850 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7111 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 242: -#line 1739 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 285: +#line 2032 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); -#endif } -#line 5863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7122 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 243: -#line 1747 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 286: +#line 2038 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 2); -#endif } -#line 5876 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7133 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 244: -#line 1755 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 287: +#line 2044 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 3); -#endif } -#line 5889 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7144 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 245: -#line 1763 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 288: +#line 2050 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(2, 4); -#endif } -#line 5902 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7155 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 246: -#line 1771 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 289: +#line 2056 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 2); -#endif } -#line 5915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7166 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 247: -#line 1779 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 290: +#line 2062 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 3); -#endif } -#line 5928 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7177 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 248: -#line 1787 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 291: +#line 2068 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(3, 4); -#endif } -#line 5941 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7188 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 249: -#line 1795 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 292: +#line 2074 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 2); -#endif } -#line 5954 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7199 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 250: -#line 1803 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 293: +#line 2080 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 3); -#endif } -#line 5967 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 251: -#line 1811 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 294: +#line 2086 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { -#ifdef AMD_EXTENSIONS parseContext.float16Check((yyvsp[0].lex).loc, "half float matrix", parseContext.symbolTable.atBuiltInLevel()); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtFloat16; (yyval.interm.type).setMatrix(4, 4); -#endif } -#line 5980 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 252: -#line 1819 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 295: +#line 2092 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 2); + } +#line 7232 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 296: +#line 2098 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 3); + } +#line 7243 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 297: +#line 2104 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 4); + } +#line 7254 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 298: +#line 2110 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 2); + } +#line 7265 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 299: +#line 2116 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 3); + } +#line 7276 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 300: +#line 2122 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(2, 4); + } +#line 7287 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 301: +#line 2128 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 2); + } +#line 7298 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 302: +#line 2134 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 3); + } +#line 7309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 303: +#line 2140 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(3, 4); + } +#line 7320 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 304: +#line 2146 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 2); + } +#line 7331 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 305: +#line 2152 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 3); + } +#line 7342 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 306: +#line 2158 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat32Check((yyvsp[0].lex).loc, "float32_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtFloat; + (yyval.interm.type).setMatrix(4, 4); + } +#line 7353 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 307: +#line 2164 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(2, 2); + } +#line 7364 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 308: +#line 2170 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(3, 3); + } +#line 7375 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 309: +#line 2176 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(4, 4); + } +#line 7386 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 310: +#line 2182 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(2, 2); + } +#line 7397 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 311: +#line 2188 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(2, 3); + } +#line 7408 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 312: +#line 2194 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(2, 4); + } +#line 7419 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 313: +#line 2200 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(3, 2); + } +#line 7430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 314: +#line 2206 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(3, 3); + } +#line 7441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 315: +#line 2212 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(3, 4); + } +#line 7452 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 316: +#line 2218 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(4, 2); + } +#line 7463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 317: +#line 2224 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(4, 3); + } +#line 7474 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 318: +#line 2230 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.explicitFloat64Check((yyvsp[0].lex).loc, "float64_t matrix", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtDouble; + (yyval.interm.type).setMatrix(4, 4); + } +#line 7485 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 319: +#line 2236 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef NV_EXTENSIONS + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtAccStructNV; +#endif + } +#line 7496 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 320: +#line 2242 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.vulkanRemoved((yyvsp[0].lex).loc, "atomic counter types"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtAtomicUint; } -#line 5990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7506 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 253: -#line 1824 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 321: +#line 2247 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D); } -#line 6000 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 254: -#line 1829 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 322: +#line 2252 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); } -#line 6010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 255: -#line 1834 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 323: +#line 2257 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd3D); } -#line 6020 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 256: -#line 1839 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 324: +#line 2262 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube); } -#line 6030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7546 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 257: -#line 1844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 325: +#line 2267 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, false, true); } -#line 6040 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7556 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 258: -#line 1849 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 326: +#line 2272 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, true); } -#line 6050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7566 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 259: -#line 1854 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 327: +#line 2277 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, false, true); } -#line 6060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7576 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 260: -#line 1859 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 328: +#line 2282 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true); } -#line 6070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7586 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 261: -#line 1864 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 329: +#line 2287 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true); } -#line 6080 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7596 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 262: -#line 1869 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 330: +#line 2292 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd1D, true, true); } -#line 6090 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7606 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 263: -#line 1874 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 331: +#line 2297 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, true); } -#line 6100 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7616 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 264: -#line 1879 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 332: +#line 2302 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true); } -#line 6110 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 265: -#line 1884 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 333: +#line 2307 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdCube, true, true); } -#line 6120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7636 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 266: -#line 1889 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 334: +#line 2312 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd1D); +#endif + } +#line 7649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 335: +#line 2320 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D); +#endif + } +#line 7662 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 336: +#line 2328 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd3D); +#endif + } +#line 7675 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 337: +#line 2336 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdCube); +#endif + } +#line 7688 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 338: +#line 2344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, false, true); +#endif + } +#line 7701 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 339: +#line 2352 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, true); +#endif + } +#line 7714 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 340: +#line 2360 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, false, true); +#endif + } +#line 7727 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 341: +#line 2368 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true); +#endif + } +#line 7740 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 342: +#line 2376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true); +#endif + } +#line 7753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 343: +#line 2384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd1D, true, true); +#endif + } +#line 7766 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 344: +#line 2392 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, true); +#endif + } +#line 7779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 345: +#line 2400 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true); +#endif + } +#line 7792 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 346: +#line 2408 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdCube, true, true); +#endif + } +#line 7805 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 347: +#line 2416 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D); } -#line 6130 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 267: -#line 1894 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 348: +#line 2421 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D); } -#line 6140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7825 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 268: -#line 1899 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 349: +#line 2426 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd3D); } -#line 6150 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7835 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 269: -#line 1904 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 350: +#line 2431 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube); } -#line 6160 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7845 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 270: -#line 1909 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 351: +#line 2436 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd1D, true); } -#line 6170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7855 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 271: -#line 1914 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 352: +#line 2441 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, true); } -#line 6180 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7865 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 272: -#line 1919 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 353: +#line 2446 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdCube, true); } -#line 6190 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 273: -#line 1924 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 354: +#line 2451 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D); } -#line 6200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 274: -#line 1929 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 355: +#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D); } -#line 6210 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7895 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 275: -#line 1934 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 356: +#line 2461 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd3D); } -#line 6220 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7905 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 276: -#line 1939 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 357: +#line 2466 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube); } -#line 6230 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 277: -#line 1944 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 358: +#line 2471 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd1D, true); } -#line 6240 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7925 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 278: -#line 1949 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 359: +#line 2476 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, true); } -#line 6250 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7935 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 279: -#line 1954 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 360: +#line 2481 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdCube, true); } -#line 6260 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7945 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 280: -#line 1959 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 361: +#line 2486 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect); } -#line 6270 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7955 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 281: -#line 1964 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 362: +#line 2491 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdRect, false, true); } -#line 6280 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 7965 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 282: -#line 1969 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 363: +#line 2496 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdRect); +#endif + } +#line 7978 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 364: +#line 2504 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdRect, false, true); +#endif + } +#line 7991 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 365: +#line 2512 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdRect); } -#line 6290 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8001 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 283: -#line 1974 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 366: +#line 2517 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdRect); } -#line 6300 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8011 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 284: -#line 1979 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 367: +#line 2522 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, EsdBuffer); } -#line 6310 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8021 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 285: -#line 1984 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 368: +#line 2527 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, EsdBuffer); +#endif + } +#line 8034 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 369: +#line 2535 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, EsdBuffer); } -#line 6320 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8044 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 286: -#line 1989 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 370: +#line 2540 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, EsdBuffer); } -#line 6330 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8054 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 287: -#line 1994 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 371: +#line 2545 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, false, false, true); } -#line 6340 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8064 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 288: -#line 1999 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 372: +#line 2550 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, false, false, true); +#endif + } +#line 8077 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 373: +#line 2558 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, false, false, true); } -#line 6350 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8087 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 289: -#line 2004 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 374: +#line 2563 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, false, false, true); } -#line 6360 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8097 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 290: -#line 2009 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 375: +#line 2568 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D, true, false, true); } -#line 6370 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8107 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 291: -#line 2014 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 376: +#line 2573 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float sampler", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.set(EbtFloat16, Esd2D, true, false, true); +#endif + } +#line 8120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 377: +#line 2581 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtInt, Esd2D, true, false, true); } -#line 6380 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8130 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 292: -#line 2019 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 378: +#line 2586 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtUint, Esd2D, true, false, true); } -#line 6390 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8140 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 293: -#line 2024 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 379: +#line 2591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(false); } -#line 6400 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8150 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 294: -#line 2029 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 380: +#line 2596 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setPureSampler(true); } -#line 6410 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8160 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 295: -#line 2034 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 381: +#line 2601 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D); } -#line 6420 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8170 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 296: -#line 2039 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 382: +#line 2606 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D); +#endif + } +#line 8183 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 383: +#line 2614 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D); } -#line 6430 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8193 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 297: -#line 2044 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 384: +#line 2619 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D); +#endif + } +#line 8206 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 385: +#line 2627 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd3D); } -#line 6440 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8216 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 298: -#line 2049 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 386: +#line 2632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd3D); +#endif + } +#line 8229 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 387: +#line 2640 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube); } -#line 6450 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8239 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 299: -#line 2054 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 388: +#line 2645 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube); +#endif + } +#line 8252 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 389: +#line 2653 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd1D, true); } -#line 6460 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8262 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 300: -#line 2059 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 390: +#line 2658 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd1D, true); +#endif + } +#line 8275 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 391: +#line 2666 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true); } -#line 6470 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8285 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 301: -#line 2064 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 392: +#line 2671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true); +#endif + } +#line 8298 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 393: +#line 2679 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdCube, true); } -#line 6480 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8308 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 302: -#line 2069 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 394: +#line 2684 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdCube, true); +#endif + } +#line 8321 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 395: +#line 2692 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D); } -#line 6490 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8331 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 303: -#line 2074 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 396: +#line 2697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D); } -#line 6500 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8341 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 304: -#line 2079 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 397: +#line 2702 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd3D); } -#line 6510 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8351 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 305: -#line 2084 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 398: +#line 2707 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube); } -#line 6520 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8361 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 306: -#line 2089 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 399: +#line 2712 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd1D, true); } -#line 6530 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8371 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 307: -#line 2094 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 400: +#line 2717 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true); } -#line 6540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8381 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 308: -#line 2099 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 401: +#line 2722 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdCube, true); } -#line 6550 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8391 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 309: -#line 2104 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 402: +#line 2727 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D); } -#line 6560 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8401 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 310: -#line 2109 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 403: +#line 2732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D); } -#line 6570 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8411 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 311: -#line 2114 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 404: +#line 2737 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd3D); } -#line 6580 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 312: -#line 2119 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 405: +#line 2742 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube); } -#line 6590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8431 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 313: -#line 2124 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 406: +#line 2747 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd1D, true); } -#line 6600 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8441 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 314: -#line 2129 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 407: +#line 2752 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true); } -#line 6610 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 315: -#line 2134 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 408: +#line 2757 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdCube, true); } -#line 6620 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8461 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 316: -#line 2139 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 409: +#line 2762 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdRect); } -#line 6630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8471 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 317: -#line 2144 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 410: +#line 2767 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdRect); +#endif + } +#line 8484 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 411: +#line 2775 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdRect); } -#line 6640 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8494 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 318: -#line 2149 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 412: +#line 2780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdRect); } -#line 6650 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8504 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 319: -#line 2154 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 413: +#line 2785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, EsdBuffer); } -#line 6660 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8514 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 320: -#line 2159 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 414: +#line 2790 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, EsdBuffer); +#endif + } +#line 8527 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 415: +#line 2798 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, EsdBuffer); } -#line 6670 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8537 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 321: -#line 2164 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 416: +#line 2803 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, EsdBuffer); } -#line 6680 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8547 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 322: -#line 2169 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 417: +#line 2808 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, false, false, true); } -#line 6690 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8557 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 323: -#line 2174 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 418: +#line 2813 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, false, false, true); +#endif + } +#line 8570 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 419: +#line 2821 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, false, false, true); } -#line 6700 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8580 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 324: -#line 2179 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 420: +#line 2826 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, false, false, true); } -#line 6710 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8590 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 325: -#line 2184 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 421: +#line 2831 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtFloat, Esd2D, true, false, true); } -#line 6720 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8600 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 326: -#line 2189 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 422: +#line 2836 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float texture", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setTexture(EbtFloat16, Esd2D, true, false, true); +#endif + } +#line 8613 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 423: +#line 2844 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtInt, Esd2D, true, false, true); } -#line 6730 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8623 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 327: -#line 2194 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 424: +#line 2849 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setTexture(EbtUint, Esd2D, true, false, true); } -#line 6740 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8633 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 328: -#line 2199 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 425: +#line 2854 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D); } -#line 6750 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8643 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 329: -#line 2204 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 426: +#line 2859 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D); +#endif + } +#line 8656 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 427: +#line 2867 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D); } -#line 6760 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8666 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 330: -#line 2209 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 428: +#line 2872 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D); } -#line 6770 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8676 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 331: -#line 2214 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 429: +#line 2877 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D); } -#line 6780 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8686 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 332: -#line 2219 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 430: +#line 2882 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D); +#endif + } +#line 8699 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 431: +#line 2890 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D); } -#line 6790 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8709 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 333: -#line 2224 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 432: +#line 2895 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D); } -#line 6800 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8719 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 334: -#line 2229 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 433: +#line 2900 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd3D); } -#line 6810 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8729 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 335: -#line 2234 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 434: +#line 2905 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd3D); +#endif + } +#line 8742 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 435: +#line 2913 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd3D); } -#line 6820 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8752 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 336: -#line 2239 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 436: +#line 2918 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd3D); } -#line 6830 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8762 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 337: -#line 2244 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 437: +#line 2923 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdRect); } -#line 6840 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8772 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 338: -#line 2249 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 438: +#line 2928 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, EsdRect); +#endif + } +#line 8785 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 439: +#line 2936 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdRect); } -#line 6850 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8795 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 339: -#line 2254 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 440: +#line 2941 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdRect); } -#line 6860 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8805 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 340: -#line 2259 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 441: +#line 2946 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube); } -#line 6870 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 341: -#line 2264 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 442: +#line 2951 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube); +#endif + } +#line 8828 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 443: +#line 2959 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube); } -#line 6880 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8838 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 342: -#line 2269 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 444: +#line 2964 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube); } -#line 6890 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8848 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 343: -#line 2274 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 445: +#line 2969 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdBuffer); } -#line 6900 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8858 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 344: -#line 2279 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 446: +#line 2974 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, EsdBuffer); +#endif + } +#line 8871 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 447: +#line 2982 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdBuffer); } -#line 6910 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8881 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 345: -#line 2284 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 448: +#line 2987 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdBuffer); } -#line 6920 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8891 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 346: -#line 2289 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 449: +#line 2992 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd1D, true); } -#line 6930 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8901 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 347: -#line 2294 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 450: +#line 2997 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd1D, true); +#endif + } +#line 8914 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 451: +#line 3005 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd1D, true); } -#line 6940 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8924 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 348: -#line 2299 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 452: +#line 3010 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd1D, true); } -#line 6950 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8934 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 349: -#line 2304 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 453: +#line 3015 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true); } -#line 6960 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8944 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 350: -#line 2309 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 454: +#line 3020 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true); +#endif + } +#line 8957 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 455: +#line 3028 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true); } -#line 6970 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8967 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 351: -#line 2314 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 456: +#line 3033 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true); } -#line 6980 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8977 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 352: -#line 2319 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 457: +#line 3038 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, EsdCube, true); } -#line 6990 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 8987 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 353: -#line 2324 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 458: +#line 3043 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, EsdCube, true); +#endif + } +#line 9000 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 459: +#line 3051 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, EsdCube, true); } -#line 7000 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 354: -#line 2329 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 460: +#line 3056 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, EsdCube, true); } -#line 7010 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9020 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 355: -#line 2334 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 461: +#line 3061 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, false, false, true); } -#line 7020 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 356: -#line 2339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 462: +#line 3066 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, false, false, true); +#endif + } +#line 9043 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 463: +#line 3074 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, false, false, true); } -#line 7030 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9053 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 357: -#line 2344 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 464: +#line 3079 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, false, false, true); } -#line 7040 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9063 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 358: -#line 2349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 465: +#line 3084 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtFloat, Esd2D, true, false, true); } -#line 7050 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9073 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 359: -#line 2354 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 466: +#line 3089 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float image", parseContext.symbolTable.atBuiltInLevel()); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setImage(EbtFloat16, Esd2D, true, false, true); +#endif + } +#line 9086 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 467: +#line 3097 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtInt, Esd2D, true, false, true); } -#line 7060 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9096 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 360: -#line 2359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 468: +#line 3102 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setImage(EbtUint, Esd2D, true, false, true); } -#line 7070 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9106 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 361: -#line 2364 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 469: +#line 3107 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // GL_OES_EGL_image_external (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.set(EbtFloat, Esd2D); (yyval.interm.type).sampler.external = true; } -#line 7081 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9117 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 362: -#line 2370 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 470: +#line 3113 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat); } -#line 7092 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9128 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 363: -#line 2376 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 471: +#line 3119 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtFloat, true); } -#line 7103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9139 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 364: -#line 2382 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 472: +#line 3125 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setSubpass(EbtFloat16); +#endif + } +#line 9153 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 473: +#line 3134 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { +#ifdef AMD_EXTENSIONS + parseContext.float16OpaqueCheck((yyvsp[0].lex).loc, "half float subpass input", parseContext.symbolTable.atBuiltInLevel()); + parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); + (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); + (yyval.interm.type).basicType = EbtSampler; + (yyval.interm.type).sampler.setSubpass(EbtFloat16, true); +#endif + } +#line 9167 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 474: +#line 3143 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt); } -#line 7114 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9178 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 365: -#line 2388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 475: +#line 3149 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtInt, true); } -#line 7125 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9189 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 366: -#line 2394 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 476: +#line 3155 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint); } -#line 7136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9200 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 367: -#line 2400 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 477: +#line 3161 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[0].lex).loc, EShLangFragment, "subpass input"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); (yyval.interm.type).basicType = EbtSampler; (yyval.interm.type).sampler.setSubpass(EbtUint, true); } -#line 7147 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 368: -#line 2406 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 478: +#line 3167 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.type) = (yyvsp[0].interm.type); (yyval.interm.type).qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; parseContext.structTypeCheck((yyval.interm.type).loc, (yyval.interm.type)); } -#line 7157 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9221 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 369: -#line 2411 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 479: +#line 3172 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // // This is for user defined type names. The lexical phase looked up the @@ -7171,47 +9235,47 @@ yyreduce: } else parseContext.error((yyvsp[0].lex).loc, "expected type name", (yyvsp[0].lex).string->c_str(), ""); } -#line 7175 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9239 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 370: -#line 2427 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 480: +#line 3188 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "highp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqHigh); } -#line 7185 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9249 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 371: -#line 2432 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 481: +#line 3193 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "mediump precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqMedium); } -#line 7195 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9259 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 372: -#line 2437 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 482: +#line 3198 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.profileRequires((yyvsp[0].lex).loc, ENoProfile, 130, 0, "lowp precision qualifier"); (yyval.interm.type).init((yyvsp[0].lex).loc, parseContext.symbolTable.atGlobalLevel()); parseContext.handlePrecisionQualifier((yyvsp[0].lex).loc, (yyval.interm.type).qualifier, EpqLow); } -#line 7205 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9269 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 373: -#line 2445 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 483: +#line 3206 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-2].lex).loc); } -#line 7211 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9275 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 374: -#line 2445 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 484: +#line 3206 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TType* structure = new TType((yyvsp[-1].interm.typeList), *(yyvsp[-4].lex).string); parseContext.structArrayCheck((yyvsp[-4].lex).loc, *structure); @@ -7223,17 +9287,17 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 7227 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9291 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 375: -#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 485: +#line 3217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.nestedStructCheck((yyvsp[-1].lex).loc); } -#line 7233 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9297 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 376: -#line 2456 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 486: +#line 3217 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { TType* structure = new TType((yyvsp[-1].interm.typeList), TString("")); (yyval.interm.type).init((yyvsp[-4].lex).loc); @@ -7241,19 +9305,19 @@ yyreduce: (yyval.interm.type).userDef = structure; --parseContext.structNestingLevel; } -#line 7245 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9309 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 377: -#line 2466 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 487: +#line 3227 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = (yyvsp[0].interm.typeList); } -#line 7253 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9317 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 378: -#line 2469 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 488: +#line 3230 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); for (unsigned int i = 0; i < (yyvsp[0].interm.typeList)->size(); ++i) { @@ -7264,11 +9328,11 @@ yyreduce: (yyval.interm.typeList)->push_back((*(yyvsp[0].interm.typeList))[i]); } } -#line 7268 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9332 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 379: -#line 2482 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 489: +#line 3243 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); @@ -7283,17 +9347,20 @@ yyreduce: parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { - parseContext.arrayDimCheck((yyvsp[-2].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[-2].interm.type).arraySizes); - (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); + TType type((yyvsp[-2].interm.type)); + type.setFieldName((*(yyval.interm.typeList))[i].type->getFieldName()); + type.transferArraySizes((*(yyval.interm.typeList))[i].type->getArraySizes()); + type.copyArrayInnerSizes((yyvsp[-2].interm.type).arraySizes); + parseContext.arrayOfArrayVersionCheck((*(yyval.interm.typeList))[i].loc, type.getArraySizes()); + (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 7291 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9359 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 380: -#line 2500 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 490: +#line 3265 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.globalQualifierFixCheck((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).qualifier); if ((yyvsp[-2].interm.type).arraySizes) { parseContext.profileRequires((yyvsp[-2].interm.type).loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type"); parseContext.profileRequires((yyvsp[-2].interm.type).loc, EEsProfile, 300, 0, "arrayed type"); @@ -7303,269 +9370,273 @@ yyreduce: (yyval.interm.typeList) = (yyvsp[-1].interm.typeList); - parseContext.checkNoShaderLayouts((yyvsp[-3].interm.type).loc, (yyvsp[-3].interm.type).shaderQualifiers); + parseContext.memberQualifierCheck((yyvsp[-3].interm.type)); parseContext.voidErrorCheck((yyvsp[-2].interm.type).loc, (*(yyvsp[-1].interm.typeList))[0].type->getFieldName(), (yyvsp[-2].interm.type).basicType); parseContext.mergeQualifiers((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).qualifier, (yyvsp[-3].interm.type).qualifier, true); parseContext.precisionQualifierCheck((yyvsp[-2].interm.type).loc, (yyvsp[-2].interm.type).basicType, (yyvsp[-2].interm.type).qualifier); for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) { - parseContext.arrayDimCheck((yyvsp[-3].interm.type).loc, (*(yyval.interm.typeList))[i].type, (yyvsp[-2].interm.type).arraySizes); - (*(yyval.interm.typeList))[i].type->mergeType((yyvsp[-2].interm.type)); + TType type((yyvsp[-2].interm.type)); + type.setFieldName((*(yyval.interm.typeList))[i].type->getFieldName()); + type.transferArraySizes((*(yyval.interm.typeList))[i].type->getArraySizes()); + type.copyArrayInnerSizes((yyvsp[-2].interm.type).arraySizes); + parseContext.arrayOfArrayVersionCheck((*(yyval.interm.typeList))[i].loc, type.getArraySizes()); + (*(yyval.interm.typeList))[i].type->shallowCopy(type); } } -#line 7317 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9388 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 381: -#line 2524 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 491: +#line 3292 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList) = new TTypeList; (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 7326 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9397 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 382: -#line 2528 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 492: +#line 3296 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeList)->push_back((yyvsp[0].interm.typeLine)); } -#line 7334 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9405 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 383: -#line 2534 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 493: +#line 3302 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.typeLine).type = new TType(EbtVoid); (yyval.interm.typeLine).loc = (yyvsp[0].lex).loc; (yyval.interm.typeLine).type->setFieldName(*(yyvsp[0].lex).string); } -#line 7344 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9415 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 384: -#line 2539 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 494: +#line 3307 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { - parseContext.arrayDimCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes, 0); + parseContext.arrayOfArrayVersionCheck((yyvsp[-1].lex).loc, (yyvsp[0].interm).arraySizes); (yyval.interm.typeLine).type = new TType(EbtVoid); (yyval.interm.typeLine).loc = (yyvsp[-1].lex).loc; (yyval.interm.typeLine).type->setFieldName(*(yyvsp[-1].lex).string); - (yyval.interm.typeLine).type->newArraySizes(*(yyvsp[0].interm).arraySizes); + (yyval.interm.typeLine).type->transferArraySizes((yyvsp[0].interm).arraySizes); } -#line 7357 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9428 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 385: -#line 2550 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 495: +#line 3318 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 7365 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9436 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 386: -#line 2553 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 496: +#line 3321 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-2].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-2].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode); } -#line 7376 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9447 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 387: -#line 2559 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 497: +#line 3327 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { const char* initFeature = "{ } style initializers"; parseContext.requireProfile((yyvsp[-3].lex).loc, ~EEsProfile, initFeature); parseContext.profileRequires((yyvsp[-3].lex).loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature); (yyval.interm.intermTypedNode) = (yyvsp[-2].interm.intermTypedNode); } -#line 7387 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9458 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 388: -#line 2568 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 498: +#line 3336 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate(0, (yyvsp[0].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)->getLoc()); } -#line 7395 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9466 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 389: -#line 2571 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 499: +#line 3339 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = parseContext.intermediate.growAggregate((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode)); } -#line 7403 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9474 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 390: -#line 2577 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 500: +#line 3345 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7409 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9480 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 391: -#line 2581 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 501: +#line 3349 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7415 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9486 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 392: -#line 2582 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 502: +#line 3350 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7421 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9492 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 393: -#line 2588 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 503: +#line 3356 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7427 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9498 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 394: -#line 2589 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 504: +#line 3357 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7433 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9504 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 395: -#line 2590 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 505: +#line 3358 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7439 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9510 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 396: -#line 2591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 506: +#line 3359 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7445 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9516 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 397: -#line 2592 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 507: +#line 3360 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7451 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9522 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 398: -#line 2593 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 508: +#line 3361 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7457 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9528 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 399: -#line 2594 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 509: +#line 3362 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7463 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9534 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 400: -#line 2598 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 510: +#line 3366 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7469 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9540 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 401: -#line 2599 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 511: +#line 3367 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; } -#line 7478 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9549 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 402: -#line 2603 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 512: +#line 3371 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; } -#line 7487 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9558 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 403: -#line 2607 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 513: +#line 3375 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-2].interm.intermNode) && (yyvsp[-2].interm.intermNode)->getAsAggregate()) (yyvsp[-2].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-2].interm.intermNode); } -#line 7497 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9568 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 404: -#line 2615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 514: +#line 3383 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7503 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9574 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 405: -#line 2616 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 515: +#line 3384 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7509 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9580 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 406: -#line 2620 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 516: +#line 3388 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.controlFlowNestingLevel; } -#line 7517 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9588 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 407: -#line 2623 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 517: +#line 3391 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7526 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 408: -#line 2627 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 518: +#line 3395 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7536 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9607 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 409: -#line 2632 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 519: +#line 3400 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7547 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9618 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 410: -#line 2641 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 520: +#line 3409 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7555 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9626 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 411: -#line 2644 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 521: +#line 3412 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[-1].interm.intermNode) && (yyvsp[-1].interm.intermNode)->getAsAggregate()) (yyvsp[-1].interm.intermNode)->getAsAggregate()->setOperator(EOpSequence); (yyval.interm.intermNode) = (yyvsp[-1].interm.intermNode); } -#line 7565 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9636 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 412: -#line 2652 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 522: +#line 3420 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[0].interm.intermNode)); if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || @@ -7574,11 +9645,11 @@ yyreduce: (yyval.interm.intermNode) = 0; // start a fresh subsequence for what's after this case } } -#line 7578 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9649 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 413: -#line 2660 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 523: +#line 3428 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[0].interm.intermNode) && (yyvsp[0].interm.intermNode)->getAsBranchNode() && ((yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpCase || (yyvsp[0].interm.intermNode)->getAsBranchNode()->getFlowOp() == EOpDefault)) { @@ -7587,59 +9658,76 @@ yyreduce: } else (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); } -#line 7591 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9662 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 414: -#line 2671 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 524: +#line 3439 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7597 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9668 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 415: -#line 2672 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 525: +#line 3440 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = static_cast((yyvsp[-1].interm.intermTypedNode)); } -#line 7603 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9674 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 416: -#line 2676 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 526: +#line 3444 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9682 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 527: +#line 3447 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.handleSelectionAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9691 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 528: +#line 3453 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.boolCheck((yyvsp[-4].lex).loc, (yyvsp[-2].interm.intermTypedNode)); (yyval.interm.intermNode) = parseContext.intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yyvsp[-4].lex).loc); } -#line 7612 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9700 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 417: -#line 2683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 529: +#line 3460 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode); } -#line 7621 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9709 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 418: -#line 2687 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 530: +#line 3464 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode); (yyval.interm.nodePair).node2 = 0; } -#line 7630 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9718 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 419: -#line 2695 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 531: +#line 3472 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); parseContext.boolCheck((yyvsp[0].interm.intermTypedNode)->getLoc(), (yyvsp[0].interm.intermTypedNode)); } -#line 7639 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9727 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 420: -#line 2699 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 532: +#line 3476 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.boolCheck((yyvsp[-2].lex).loc, (yyvsp[-3].interm.type)); @@ -7650,11 +9738,28 @@ yyreduce: else (yyval.interm.intermTypedNode) = 0; } -#line 7654 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9742 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 421: -#line 2712 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 533: +#line 3489 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9750 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 534: +#line 3492 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.handleSwitchAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9759 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 535: +#line 3498 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // start new switch sequence on the switch stack ++parseContext.controlFlowNestingLevel; @@ -7663,11 +9768,11 @@ yyreduce: parseContext.switchLevel.push_back(parseContext.statementNestingLevel); parseContext.symbolTable.push(); } -#line 7667 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9772 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 422: -#line 2720 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 536: +#line 3506 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.addSwitch((yyvsp[-7].lex).loc, (yyvsp[-5].interm.intermTypedNode), (yyvsp[-1].interm.intermNode) ? (yyvsp[-1].interm.intermNode)->getAsAggregate() : 0); delete parseContext.switchSequenceStack.back(); @@ -7677,27 +9782,27 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7681 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9786 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 423: -#line 2732 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 537: +#line 3518 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; } -#line 7689 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9794 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 424: -#line 2735 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 538: +#line 3521 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7697 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9802 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 425: -#line 2741 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 539: +#line 3527 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -7710,11 +9815,11 @@ yyreduce: (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpCase, (yyvsp[-1].interm.intermTypedNode), (yyvsp[-2].lex).loc); } } -#line 7714 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9819 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 426: -#line 2753 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 540: +#line 3539 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = 0; if (parseContext.switchLevel.size() == 0) @@ -7724,11 +9829,28 @@ yyreduce: else (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpDefault, (yyvsp[-1].lex).loc); } -#line 7728 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9833 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 427: -#line 2765 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 541: +#line 3551 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9841 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 542: +#line 3554 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + parseContext.handleLoopAttributes(*(yyvsp[-1].interm.attributes), (yyvsp[0].interm.intermNode)); + (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); + } +#line 9850 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 543: +#line 3560 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-1].lex).loc, "while loops not available", "limitation", ""); @@ -7737,11 +9859,11 @@ yyreduce: ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7741 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9863 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 428: -#line 2773 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 544: +#line 3568 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.addLoop((yyvsp[0].interm.intermNode), (yyvsp[-2].interm.intermTypedNode), 0, true, (yyvsp[-5].lex).loc); @@ -7749,21 +9871,21 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7753 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9875 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 429: -#line 2780 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 545: +#line 3575 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7763 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9885 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 430: -#line 2785 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 546: +#line 3580 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (! parseContext.limits.whileLoops) parseContext.error((yyvsp[-7].lex).loc, "do-while loops not available", "limitation", ""); @@ -7775,22 +9897,22 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7779 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9901 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 431: -#line 2796 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 547: +#line 3591 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.push(); ++parseContext.loopNestingLevel; ++parseContext.statementNestingLevel; ++parseContext.controlFlowNestingLevel; } -#line 7790 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9912 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 432: -#line 2802 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 548: +#line 3597 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); (yyval.interm.intermNode) = parseContext.intermediate.makeAggregate((yyvsp[-3].interm.intermNode), (yyvsp[-5].lex).loc); @@ -7803,81 +9925,81 @@ yyreduce: --parseContext.statementNestingLevel; --parseContext.controlFlowNestingLevel; } -#line 7807 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9929 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 433: -#line 2817 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 549: +#line 3612 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7815 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9937 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 434: -#line 2820 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 550: +#line 3615 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7823 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9945 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 435: -#line 2826 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 551: +#line 3621 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); } -#line 7831 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9953 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 436: -#line 2829 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 552: +#line 3624 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermTypedNode) = 0; } -#line 7839 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9961 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 437: -#line 2835 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 553: +#line 3630 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode); (yyval.interm.nodePair).node2 = 0; } -#line 7848 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9970 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 438: -#line 2839 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 554: +#line 3634 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode); (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode); } -#line 7857 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9979 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 439: -#line 2846 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 555: +#line 3641 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (parseContext.loopNestingLevel <= 0) parseContext.error((yyvsp[-1].lex).loc, "continue statement only allowed in loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpContinue, (yyvsp[-1].lex).loc); } -#line 7867 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9989 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 440: -#line 2851 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 556: +#line 3646 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if (parseContext.loopNestingLevel + parseContext.switchSequenceStack.size() <= 0) parseContext.error((yyvsp[-1].lex).loc, "break statement only allowed in switch and loops", "", ""); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpBreak, (yyvsp[-1].lex).loc); } -#line 7877 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 9999 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 441: -#line 2856 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 557: +#line 3651 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpReturn, (yyvsp[-1].lex).loc); if (parseContext.currentFunctionType->getBasicType() != EbtVoid) @@ -7885,83 +10007,83 @@ yyreduce: if (parseContext.inMain) parseContext.postEntryPointReturn = true; } -#line 7889 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10011 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 442: -#line 2863 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 558: +#line 3658 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = parseContext.handleReturnValue((yyvsp[-2].lex).loc, (yyvsp[-1].interm.intermTypedNode)); } -#line 7897 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10019 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 443: -#line 2866 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 559: +#line 3661 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireStage((yyvsp[-1].lex).loc, EShLangFragment, "discard"); (yyval.interm.intermNode) = parseContext.intermediate.addBranch(EOpKill, (yyvsp[-1].lex).loc); } -#line 7906 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10028 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 444: -#line 2875 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 560: +#line 3670 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } -#line 7915 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10037 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 445: -#line 2879 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 561: +#line 3674 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { if ((yyvsp[0].interm.intermNode) != nullptr) { (yyval.interm.intermNode) = parseContext.intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode)); parseContext.intermediate.setTreeRoot((yyval.interm.intermNode)); } } -#line 7926 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10048 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 446: -#line 2888 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 562: +#line 3683 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7934 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10056 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 447: -#line 2891 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 563: +#line 3686 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); } -#line 7942 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10064 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 448: -#line 2894 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 564: +#line 3689 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { parseContext.requireProfile((yyvsp[0].lex).loc, ~EEsProfile, "extraneous semicolon"); parseContext.profileRequires((yyvsp[0].lex).loc, ~EEsProfile, 460, nullptr, "extraneous semicolon"); (yyval.interm.intermNode) = nullptr; } -#line 7952 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10074 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 449: -#line 2902 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 565: +#line 3697 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { (yyvsp[0].interm).function = parseContext.handleFunctionDeclarator((yyvsp[0].interm).loc, *(yyvsp[0].interm).function, false /* not prototype */); (yyvsp[0].interm).intermNode = parseContext.handleFunctionDefinition((yyvsp[0].interm).loc, *(yyvsp[0].interm).function); } -#line 7961 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10083 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; - case 450: -#line 2906 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + case 566: +#line 3701 "MachineIndependent/glslang.y" /* yacc.c:1646 */ { // May be best done as post process phase on intermediate code if (parseContext.currentFunctionType->getBasicType() != EbtVoid && ! parseContext.functionReturnsValue) @@ -7977,11 +10099,52 @@ yyreduce: (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug); (yyval.interm.intermNode)->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable); } -#line 7981 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10103 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 567: +#line 3719 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = (yyvsp[-2].interm.attributes); + parseContext.requireExtensions((yyvsp[-4].lex).loc, 1, &E_GL_EXT_control_flow_attributes, "attribute"); + } +#line 10112 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 568: +#line 3725 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = (yyvsp[0].interm.attributes); + } +#line 10120 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 569: +#line 3728 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = parseContext.mergeAttributes((yyvsp[-2].interm.attributes), (yyvsp[0].interm.attributes)); + } +#line 10128 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 570: +#line 3733 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[0].lex).string); + } +#line 10136 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ + break; + + case 571: +#line 3736 "MachineIndependent/glslang.y" /* yacc.c:1646 */ + { + (yyval.interm.attributes) = parseContext.makeAttributes(*(yyvsp[-3].lex).string, (yyvsp[-1].interm.intermTypedNode)); + } +#line 10144 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ break; -#line 7985 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ +#line 10148 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -8209,5 +10372,5 @@ yyreturn: #endif return yyresult; } -#line 2923 "MachineIndependent/glslang.y" /* yacc.c:1906 */ +#line 3740 "MachineIndependent/glslang.y" /* yacc.c:1906 */ diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h index b2e00632d9a..50bbcfcba59 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/glslang_tab.cpp.h @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,308 +47,416 @@ extern int yydebug; { ATTRIBUTE = 258, VARYING = 259, - CONST = 260, - BOOL = 261, - FLOAT = 262, + FLOAT16_T = 260, + FLOAT = 261, + FLOAT32_T = 262, DOUBLE = 263, - INT = 264, - UINT = 265, - INT64_T = 266, - UINT64_T = 267, - INT16_T = 268, - UINT16_T = 269, - FLOAT16_T = 270, - BREAK = 271, - CONTINUE = 272, - DO = 273, - ELSE = 274, - FOR = 275, - IF = 276, - DISCARD = 277, - RETURN = 278, - SWITCH = 279, - CASE = 280, - DEFAULT = 281, - SUBROUTINE = 282, - BVEC2 = 283, - BVEC3 = 284, - BVEC4 = 285, - IVEC2 = 286, - IVEC3 = 287, - IVEC4 = 288, - I64VEC2 = 289, - I64VEC3 = 290, - I64VEC4 = 291, - UVEC2 = 292, - UVEC3 = 293, - UVEC4 = 294, - U64VEC2 = 295, - U64VEC3 = 296, - U64VEC4 = 297, - VEC2 = 298, - VEC3 = 299, - VEC4 = 300, - MAT2 = 301, - MAT3 = 302, - MAT4 = 303, - CENTROID = 304, - IN = 305, - OUT = 306, - INOUT = 307, - UNIFORM = 308, - PATCH = 309, - SAMPLE = 310, - BUFFER = 311, - SHARED = 312, - COHERENT = 313, - VOLATILE = 314, - RESTRICT = 315, - READONLY = 316, - WRITEONLY = 317, - DVEC2 = 318, - DVEC3 = 319, - DVEC4 = 320, - DMAT2 = 321, - DMAT3 = 322, - DMAT4 = 323, - F16VEC2 = 324, - F16VEC3 = 325, - F16VEC4 = 326, - F16MAT2 = 327, - F16MAT3 = 328, - F16MAT4 = 329, - I16VEC2 = 330, - I16VEC3 = 331, - I16VEC4 = 332, - U16VEC2 = 333, - U16VEC3 = 334, - U16VEC4 = 335, - NOPERSPECTIVE = 336, - FLAT = 337, - SMOOTH = 338, - LAYOUT = 339, - __EXPLICITINTERPAMD = 340, - MAT2X2 = 341, - MAT2X3 = 342, - MAT2X4 = 343, - MAT3X2 = 344, - MAT3X3 = 345, - MAT3X4 = 346, - MAT4X2 = 347, - MAT4X3 = 348, - MAT4X4 = 349, - DMAT2X2 = 350, - DMAT2X3 = 351, - DMAT2X4 = 352, - DMAT3X2 = 353, - DMAT3X3 = 354, - DMAT3X4 = 355, - DMAT4X2 = 356, - DMAT4X3 = 357, - DMAT4X4 = 358, - F16MAT2X2 = 359, - F16MAT2X3 = 360, - F16MAT2X4 = 361, - F16MAT3X2 = 362, - F16MAT3X3 = 363, - F16MAT3X4 = 364, - F16MAT4X2 = 365, - F16MAT4X3 = 366, - F16MAT4X4 = 367, - ATOMIC_UINT = 368, - SAMPLER1D = 369, - SAMPLER2D = 370, - SAMPLER3D = 371, - SAMPLERCUBE = 372, - SAMPLER1DSHADOW = 373, - SAMPLER2DSHADOW = 374, - SAMPLERCUBESHADOW = 375, - SAMPLER1DARRAY = 376, - SAMPLER2DARRAY = 377, - SAMPLER1DARRAYSHADOW = 378, - SAMPLER2DARRAYSHADOW = 379, - ISAMPLER1D = 380, - ISAMPLER2D = 381, - ISAMPLER3D = 382, - ISAMPLERCUBE = 383, - ISAMPLER1DARRAY = 384, - ISAMPLER2DARRAY = 385, - USAMPLER1D = 386, - USAMPLER2D = 387, - USAMPLER3D = 388, - USAMPLERCUBE = 389, - USAMPLER1DARRAY = 390, - USAMPLER2DARRAY = 391, - SAMPLER2DRECT = 392, - SAMPLER2DRECTSHADOW = 393, - ISAMPLER2DRECT = 394, - USAMPLER2DRECT = 395, - SAMPLERBUFFER = 396, - ISAMPLERBUFFER = 397, - USAMPLERBUFFER = 398, - SAMPLERCUBEARRAY = 399, - SAMPLERCUBEARRAYSHADOW = 400, - ISAMPLERCUBEARRAY = 401, - USAMPLERCUBEARRAY = 402, - SAMPLER2DMS = 403, - ISAMPLER2DMS = 404, - USAMPLER2DMS = 405, - SAMPLER2DMSARRAY = 406, - ISAMPLER2DMSARRAY = 407, - USAMPLER2DMSARRAY = 408, - SAMPLEREXTERNALOES = 409, - SAMPLER = 410, - SAMPLERSHADOW = 411, - TEXTURE1D = 412, - TEXTURE2D = 413, - TEXTURE3D = 414, - TEXTURECUBE = 415, - TEXTURE1DARRAY = 416, - TEXTURE2DARRAY = 417, - ITEXTURE1D = 418, - ITEXTURE2D = 419, - ITEXTURE3D = 420, - ITEXTURECUBE = 421, - ITEXTURE1DARRAY = 422, - ITEXTURE2DARRAY = 423, - UTEXTURE1D = 424, - UTEXTURE2D = 425, - UTEXTURE3D = 426, - UTEXTURECUBE = 427, - UTEXTURE1DARRAY = 428, - UTEXTURE2DARRAY = 429, - TEXTURE2DRECT = 430, - ITEXTURE2DRECT = 431, - UTEXTURE2DRECT = 432, - TEXTUREBUFFER = 433, - ITEXTUREBUFFER = 434, - UTEXTUREBUFFER = 435, - TEXTURECUBEARRAY = 436, - ITEXTURECUBEARRAY = 437, - UTEXTURECUBEARRAY = 438, - TEXTURE2DMS = 439, - ITEXTURE2DMS = 440, - UTEXTURE2DMS = 441, - TEXTURE2DMSARRAY = 442, - ITEXTURE2DMSARRAY = 443, - UTEXTURE2DMSARRAY = 444, - SUBPASSINPUT = 445, - SUBPASSINPUTMS = 446, - ISUBPASSINPUT = 447, - ISUBPASSINPUTMS = 448, - USUBPASSINPUT = 449, - USUBPASSINPUTMS = 450, - IMAGE1D = 451, - IIMAGE1D = 452, - UIMAGE1D = 453, - IMAGE2D = 454, - IIMAGE2D = 455, - UIMAGE2D = 456, - IMAGE3D = 457, - IIMAGE3D = 458, - UIMAGE3D = 459, - IMAGE2DRECT = 460, - IIMAGE2DRECT = 461, - UIMAGE2DRECT = 462, - IMAGECUBE = 463, - IIMAGECUBE = 464, - UIMAGECUBE = 465, - IMAGEBUFFER = 466, - IIMAGEBUFFER = 467, - UIMAGEBUFFER = 468, - IMAGE1DARRAY = 469, - IIMAGE1DARRAY = 470, - UIMAGE1DARRAY = 471, - IMAGE2DARRAY = 472, - IIMAGE2DARRAY = 473, - UIMAGE2DARRAY = 474, - IMAGECUBEARRAY = 475, - IIMAGECUBEARRAY = 476, - UIMAGECUBEARRAY = 477, - IMAGE2DMS = 478, - IIMAGE2DMS = 479, - UIMAGE2DMS = 480, - IMAGE2DMSARRAY = 481, - IIMAGE2DMSARRAY = 482, - UIMAGE2DMSARRAY = 483, - STRUCT = 484, - VOID = 485, - WHILE = 486, - IDENTIFIER = 487, - TYPE_NAME = 488, - FLOATCONSTANT = 489, - DOUBLECONSTANT = 490, - INTCONSTANT = 491, - UINTCONSTANT = 492, - INT64CONSTANT = 493, - UINT64CONSTANT = 494, - INT16CONSTANT = 495, - UINT16CONSTANT = 496, - BOOLCONSTANT = 497, - FLOAT16CONSTANT = 498, - LEFT_OP = 499, - RIGHT_OP = 500, - INC_OP = 501, - DEC_OP = 502, - LE_OP = 503, - GE_OP = 504, - EQ_OP = 505, - NE_OP = 506, - AND_OP = 507, - OR_OP = 508, - XOR_OP = 509, - MUL_ASSIGN = 510, - DIV_ASSIGN = 511, - ADD_ASSIGN = 512, - MOD_ASSIGN = 513, - LEFT_ASSIGN = 514, - RIGHT_ASSIGN = 515, - AND_ASSIGN = 516, - XOR_ASSIGN = 517, - OR_ASSIGN = 518, - SUB_ASSIGN = 519, - LEFT_PAREN = 520, - RIGHT_PAREN = 521, - LEFT_BRACKET = 522, - RIGHT_BRACKET = 523, - LEFT_BRACE = 524, - RIGHT_BRACE = 525, - DOT = 526, - COMMA = 527, - COLON = 528, - EQUAL = 529, - SEMICOLON = 530, - BANG = 531, - DASH = 532, - TILDE = 533, - PLUS = 534, - STAR = 535, - SLASH = 536, - PERCENT = 537, - LEFT_ANGLE = 538, - RIGHT_ANGLE = 539, - VERTICAL_BAR = 540, - CARET = 541, - AMPERSAND = 542, - QUESTION = 543, - INVARIANT = 544, - PRECISE = 545, - HIGH_PRECISION = 546, - MEDIUM_PRECISION = 547, - LOW_PRECISION = 548, - PRECISION = 549, - PACKED = 550, - RESOURCE = 551, - SUPERP = 552 + FLOAT64_T = 264, + CONST = 265, + BOOL = 266, + INT = 267, + UINT = 268, + INT64_T = 269, + UINT64_T = 270, + INT32_T = 271, + UINT32_T = 272, + INT16_T = 273, + UINT16_T = 274, + INT8_T = 275, + UINT8_T = 276, + BREAK = 277, + CONTINUE = 278, + DO = 279, + ELSE = 280, + FOR = 281, + IF = 282, + DISCARD = 283, + RETURN = 284, + SWITCH = 285, + CASE = 286, + DEFAULT = 287, + SUBROUTINE = 288, + BVEC2 = 289, + BVEC3 = 290, + BVEC4 = 291, + IVEC2 = 292, + IVEC3 = 293, + IVEC4 = 294, + UVEC2 = 295, + UVEC3 = 296, + UVEC4 = 297, + I64VEC2 = 298, + I64VEC3 = 299, + I64VEC4 = 300, + U64VEC2 = 301, + U64VEC3 = 302, + U64VEC4 = 303, + I32VEC2 = 304, + I32VEC3 = 305, + I32VEC4 = 306, + U32VEC2 = 307, + U32VEC3 = 308, + U32VEC4 = 309, + I16VEC2 = 310, + I16VEC3 = 311, + I16VEC4 = 312, + U16VEC2 = 313, + U16VEC3 = 314, + U16VEC4 = 315, + I8VEC2 = 316, + I8VEC3 = 317, + I8VEC4 = 318, + U8VEC2 = 319, + U8VEC3 = 320, + U8VEC4 = 321, + VEC2 = 322, + VEC3 = 323, + VEC4 = 324, + MAT2 = 325, + MAT3 = 326, + MAT4 = 327, + CENTROID = 328, + IN = 329, + OUT = 330, + INOUT = 331, + UNIFORM = 332, + PATCH = 333, + SAMPLE = 334, + BUFFER = 335, + SHARED = 336, + NONUNIFORM = 337, + PAYLOADNV = 338, + PAYLOADINNV = 339, + HITATTRNV = 340, + CALLDATANV = 341, + CALLDATAINNV = 342, + COHERENT = 343, + VOLATILE = 344, + RESTRICT = 345, + READONLY = 346, + WRITEONLY = 347, + DEVICECOHERENT = 348, + QUEUEFAMILYCOHERENT = 349, + WORKGROUPCOHERENT = 350, + SUBGROUPCOHERENT = 351, + NONPRIVATE = 352, + DVEC2 = 353, + DVEC3 = 354, + DVEC4 = 355, + DMAT2 = 356, + DMAT3 = 357, + DMAT4 = 358, + F16VEC2 = 359, + F16VEC3 = 360, + F16VEC4 = 361, + F16MAT2 = 362, + F16MAT3 = 363, + F16MAT4 = 364, + F32VEC2 = 365, + F32VEC3 = 366, + F32VEC4 = 367, + F32MAT2 = 368, + F32MAT3 = 369, + F32MAT4 = 370, + F64VEC2 = 371, + F64VEC3 = 372, + F64VEC4 = 373, + F64MAT2 = 374, + F64MAT3 = 375, + F64MAT4 = 376, + NOPERSPECTIVE = 377, + FLAT = 378, + SMOOTH = 379, + LAYOUT = 380, + EXPLICITINTERPAMD = 381, + PERVERTEXNV = 382, + PERPRIMITIVENV = 383, + PERVIEWNV = 384, + PERTASKNV = 385, + MAT2X2 = 386, + MAT2X3 = 387, + MAT2X4 = 388, + MAT3X2 = 389, + MAT3X3 = 390, + MAT3X4 = 391, + MAT4X2 = 392, + MAT4X3 = 393, + MAT4X4 = 394, + DMAT2X2 = 395, + DMAT2X3 = 396, + DMAT2X4 = 397, + DMAT3X2 = 398, + DMAT3X3 = 399, + DMAT3X4 = 400, + DMAT4X2 = 401, + DMAT4X3 = 402, + DMAT4X4 = 403, + F16MAT2X2 = 404, + F16MAT2X3 = 405, + F16MAT2X4 = 406, + F16MAT3X2 = 407, + F16MAT3X3 = 408, + F16MAT3X4 = 409, + F16MAT4X2 = 410, + F16MAT4X3 = 411, + F16MAT4X4 = 412, + F32MAT2X2 = 413, + F32MAT2X3 = 414, + F32MAT2X4 = 415, + F32MAT3X2 = 416, + F32MAT3X3 = 417, + F32MAT3X4 = 418, + F32MAT4X2 = 419, + F32MAT4X3 = 420, + F32MAT4X4 = 421, + F64MAT2X2 = 422, + F64MAT2X3 = 423, + F64MAT2X4 = 424, + F64MAT3X2 = 425, + F64MAT3X3 = 426, + F64MAT3X4 = 427, + F64MAT4X2 = 428, + F64MAT4X3 = 429, + F64MAT4X4 = 430, + ATOMIC_UINT = 431, + ACCSTRUCTNV = 432, + SAMPLER1D = 433, + SAMPLER2D = 434, + SAMPLER3D = 435, + SAMPLERCUBE = 436, + SAMPLER1DSHADOW = 437, + SAMPLER2DSHADOW = 438, + SAMPLERCUBESHADOW = 439, + SAMPLER1DARRAY = 440, + SAMPLER2DARRAY = 441, + SAMPLER1DARRAYSHADOW = 442, + SAMPLER2DARRAYSHADOW = 443, + ISAMPLER1D = 444, + ISAMPLER2D = 445, + ISAMPLER3D = 446, + ISAMPLERCUBE = 447, + ISAMPLER1DARRAY = 448, + ISAMPLER2DARRAY = 449, + USAMPLER1D = 450, + USAMPLER2D = 451, + USAMPLER3D = 452, + USAMPLERCUBE = 453, + USAMPLER1DARRAY = 454, + USAMPLER2DARRAY = 455, + SAMPLER2DRECT = 456, + SAMPLER2DRECTSHADOW = 457, + ISAMPLER2DRECT = 458, + USAMPLER2DRECT = 459, + SAMPLERBUFFER = 460, + ISAMPLERBUFFER = 461, + USAMPLERBUFFER = 462, + SAMPLERCUBEARRAY = 463, + SAMPLERCUBEARRAYSHADOW = 464, + ISAMPLERCUBEARRAY = 465, + USAMPLERCUBEARRAY = 466, + SAMPLER2DMS = 467, + ISAMPLER2DMS = 468, + USAMPLER2DMS = 469, + SAMPLER2DMSARRAY = 470, + ISAMPLER2DMSARRAY = 471, + USAMPLER2DMSARRAY = 472, + SAMPLEREXTERNALOES = 473, + F16SAMPLER1D = 474, + F16SAMPLER2D = 475, + F16SAMPLER3D = 476, + F16SAMPLER2DRECT = 477, + F16SAMPLERCUBE = 478, + F16SAMPLER1DARRAY = 479, + F16SAMPLER2DARRAY = 480, + F16SAMPLERCUBEARRAY = 481, + F16SAMPLERBUFFER = 482, + F16SAMPLER2DMS = 483, + F16SAMPLER2DMSARRAY = 484, + F16SAMPLER1DSHADOW = 485, + F16SAMPLER2DSHADOW = 486, + F16SAMPLER1DARRAYSHADOW = 487, + F16SAMPLER2DARRAYSHADOW = 488, + F16SAMPLER2DRECTSHADOW = 489, + F16SAMPLERCUBESHADOW = 490, + F16SAMPLERCUBEARRAYSHADOW = 491, + SAMPLER = 492, + SAMPLERSHADOW = 493, + TEXTURE1D = 494, + TEXTURE2D = 495, + TEXTURE3D = 496, + TEXTURECUBE = 497, + TEXTURE1DARRAY = 498, + TEXTURE2DARRAY = 499, + ITEXTURE1D = 500, + ITEXTURE2D = 501, + ITEXTURE3D = 502, + ITEXTURECUBE = 503, + ITEXTURE1DARRAY = 504, + ITEXTURE2DARRAY = 505, + UTEXTURE1D = 506, + UTEXTURE2D = 507, + UTEXTURE3D = 508, + UTEXTURECUBE = 509, + UTEXTURE1DARRAY = 510, + UTEXTURE2DARRAY = 511, + TEXTURE2DRECT = 512, + ITEXTURE2DRECT = 513, + UTEXTURE2DRECT = 514, + TEXTUREBUFFER = 515, + ITEXTUREBUFFER = 516, + UTEXTUREBUFFER = 517, + TEXTURECUBEARRAY = 518, + ITEXTURECUBEARRAY = 519, + UTEXTURECUBEARRAY = 520, + TEXTURE2DMS = 521, + ITEXTURE2DMS = 522, + UTEXTURE2DMS = 523, + TEXTURE2DMSARRAY = 524, + ITEXTURE2DMSARRAY = 525, + UTEXTURE2DMSARRAY = 526, + F16TEXTURE1D = 527, + F16TEXTURE2D = 528, + F16TEXTURE3D = 529, + F16TEXTURE2DRECT = 530, + F16TEXTURECUBE = 531, + F16TEXTURE1DARRAY = 532, + F16TEXTURE2DARRAY = 533, + F16TEXTURECUBEARRAY = 534, + F16TEXTUREBUFFER = 535, + F16TEXTURE2DMS = 536, + F16TEXTURE2DMSARRAY = 537, + SUBPASSINPUT = 538, + SUBPASSINPUTMS = 539, + ISUBPASSINPUT = 540, + ISUBPASSINPUTMS = 541, + USUBPASSINPUT = 542, + USUBPASSINPUTMS = 543, + F16SUBPASSINPUT = 544, + F16SUBPASSINPUTMS = 545, + IMAGE1D = 546, + IIMAGE1D = 547, + UIMAGE1D = 548, + IMAGE2D = 549, + IIMAGE2D = 550, + UIMAGE2D = 551, + IMAGE3D = 552, + IIMAGE3D = 553, + UIMAGE3D = 554, + IMAGE2DRECT = 555, + IIMAGE2DRECT = 556, + UIMAGE2DRECT = 557, + IMAGECUBE = 558, + IIMAGECUBE = 559, + UIMAGECUBE = 560, + IMAGEBUFFER = 561, + IIMAGEBUFFER = 562, + UIMAGEBUFFER = 563, + IMAGE1DARRAY = 564, + IIMAGE1DARRAY = 565, + UIMAGE1DARRAY = 566, + IMAGE2DARRAY = 567, + IIMAGE2DARRAY = 568, + UIMAGE2DARRAY = 569, + IMAGECUBEARRAY = 570, + IIMAGECUBEARRAY = 571, + UIMAGECUBEARRAY = 572, + IMAGE2DMS = 573, + IIMAGE2DMS = 574, + UIMAGE2DMS = 575, + IMAGE2DMSARRAY = 576, + IIMAGE2DMSARRAY = 577, + UIMAGE2DMSARRAY = 578, + F16IMAGE1D = 579, + F16IMAGE2D = 580, + F16IMAGE3D = 581, + F16IMAGE2DRECT = 582, + F16IMAGECUBE = 583, + F16IMAGE1DARRAY = 584, + F16IMAGE2DARRAY = 585, + F16IMAGECUBEARRAY = 586, + F16IMAGEBUFFER = 587, + F16IMAGE2DMS = 588, + F16IMAGE2DMSARRAY = 589, + STRUCT = 590, + VOID = 591, + WHILE = 592, + IDENTIFIER = 593, + TYPE_NAME = 594, + FLOATCONSTANT = 595, + DOUBLECONSTANT = 596, + INT16CONSTANT = 597, + UINT16CONSTANT = 598, + INT32CONSTANT = 599, + UINT32CONSTANT = 600, + INTCONSTANT = 601, + UINTCONSTANT = 602, + INT64CONSTANT = 603, + UINT64CONSTANT = 604, + BOOLCONSTANT = 605, + FLOAT16CONSTANT = 606, + LEFT_OP = 607, + RIGHT_OP = 608, + INC_OP = 609, + DEC_OP = 610, + LE_OP = 611, + GE_OP = 612, + EQ_OP = 613, + NE_OP = 614, + AND_OP = 615, + OR_OP = 616, + XOR_OP = 617, + MUL_ASSIGN = 618, + DIV_ASSIGN = 619, + ADD_ASSIGN = 620, + MOD_ASSIGN = 621, + LEFT_ASSIGN = 622, + RIGHT_ASSIGN = 623, + AND_ASSIGN = 624, + XOR_ASSIGN = 625, + OR_ASSIGN = 626, + SUB_ASSIGN = 627, + LEFT_PAREN = 628, + RIGHT_PAREN = 629, + LEFT_BRACKET = 630, + RIGHT_BRACKET = 631, + LEFT_BRACE = 632, + RIGHT_BRACE = 633, + DOT = 634, + COMMA = 635, + COLON = 636, + EQUAL = 637, + SEMICOLON = 638, + BANG = 639, + DASH = 640, + TILDE = 641, + PLUS = 642, + STAR = 643, + SLASH = 644, + PERCENT = 645, + LEFT_ANGLE = 646, + RIGHT_ANGLE = 647, + VERTICAL_BAR = 648, + CARET = 649, + AMPERSAND = 650, + QUESTION = 651, + INVARIANT = 652, + PRECISE = 653, + HIGH_PRECISION = 654, + MEDIUM_PRECISION = 655, + LOW_PRECISION = 656, + PRECISION = 657, + PACKED = 658, + RESOURCE = 659, + SUPERP = 660 }; #endif /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; + union YYSTYPE { -#line 68 "MachineIndependent/glslang.y" /* yacc.c:1909 */ +#line 70 "MachineIndependent/glslang.y" /* yacc.c:1909 */ struct { glslang::TSourceLoc loc; @@ -370,6 +478,7 @@ union YYSTYPE TIntermNode* intermNode; glslang::TIntermNodePair nodePair; glslang::TIntermTyped* intermTypedNode; + glslang::TAttributes* attributes; }; union { glslang::TPublicType type; @@ -382,8 +491,10 @@ union YYSTYPE }; } interm; -#line 386 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ +#line 495 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */ }; + +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 #endif diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp index 7e15392da68..5ad67906643 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2012-2016 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -92,7 +93,13 @@ namespace glslang { // class TOutputTraverser : public TIntermTraverser { public: - TOutputTraverser(TInfoSink& i) : infoSink(i) { } + TOutputTraverser(TInfoSink& i) : infoSink(i), extraOutput(NoExtraOutput) { } + + enum EExtraOutput { + NoExtraOutput, + BinaryDoubleOutput + }; + void setDoubleOutput(EExtraOutput extra) { extraOutput = extra; } virtual bool visitBinary(TVisit, TIntermBinary* node); virtual bool visitUnary(TVisit, TIntermUnary* node); @@ -108,6 +115,8 @@ public: protected: TOutputTraverser(TOutputTraverser&); TOutputTraverser& operator=(TOutputTraverser&); + + EExtraOutput extraOutput; }; // @@ -224,48 +233,192 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpPreIncrement: out.debug << "Pre-Increment"; break; case EOpPreDecrement: out.debug << "Pre-Decrement"; break; + // * -> bool + case EOpConvInt8ToBool: out.debug << "Convert int8_t to bool"; break; + case EOpConvUint8ToBool: out.debug << "Convert uint8_t to bool"; break; + case EOpConvInt16ToBool: out.debug << "Convert int16_t to bool"; break; + case EOpConvUint16ToBool: out.debug << "Convert uint16_t to bool";break; case EOpConvIntToBool: out.debug << "Convert int to bool"; break; case EOpConvUintToBool: out.debug << "Convert uint to bool"; break; - case EOpConvFloatToBool: out.debug << "Convert float to bool"; break; - case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break; case EOpConvInt64ToBool: out.debug << "Convert int64 to bool"; break; case EOpConvUint64ToBool: out.debug << "Convert uint64 to bool"; break; - case EOpConvIntToFloat: out.debug << "Convert int to float"; break; - case EOpConvUintToFloat: out.debug << "Convert uint to float"; break; - case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break; - case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break; - case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break; - case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break; - case EOpConvUintToInt: out.debug << "Convert uint to int"; break; - case EOpConvFloatToInt: out.debug << "Convert float to int"; break; - case EOpConvDoubleToInt: out.debug << "Convert double to int"; break; - case EOpConvBoolToInt: out.debug << "Convert bool to int"; break; - case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break; - case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break; - case EOpConvIntToUint: out.debug << "Convert int to uint"; break; - case EOpConvFloatToUint: out.debug << "Convert float to uint"; break; - case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break; + case EOpConvFloat16ToBool: out.debug << "Convert float16_t to bool"; break; + case EOpConvFloatToBool: out.debug << "Convert float to bool"; break; + case EOpConvDoubleToBool: out.debug << "Convert double to bool"; break; + + // bool -> * + case EOpConvBoolToInt8: out.debug << "Convert bool to int8_t"; break; + case EOpConvBoolToUint8: out.debug << "Convert bool to uint8_t"; break; + case EOpConvBoolToInt16: out.debug << "Convert bool to in16t_t"; break; + case EOpConvBoolToUint16: out.debug << "Convert bool to uint16_t";break; + case EOpConvBoolToInt: out.debug << "Convert bool to int" ; break; case EOpConvBoolToUint: out.debug << "Convert bool to uint"; break; - case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break; - case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break; + case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break; + case EOpConvBoolToUint64: out.debug << "Convert bool to uint64";break; + case EOpConvBoolToFloat16: out.debug << "Convert bool to float16_t"; break; + case EOpConvBoolToFloat: out.debug << "Convert bool to float"; break; + case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break; + + // int8_t -> (u)int* + case EOpConvInt8ToInt16: out.debug << "Convert int8_t to int16_t";break; + case EOpConvInt8ToInt: out.debug << "Convert int8_t to int"; break; + case EOpConvInt8ToInt64: out.debug << "Convert int8_t to int64"; break; + case EOpConvInt8ToUint8: out.debug << "Convert int8_t to uint8_t";break; + case EOpConvInt8ToUint16: out.debug << "Convert int8_t to uint16_t";break; + case EOpConvInt8ToUint: out.debug << "Convert int8_t to uint"; break; + case EOpConvInt8ToUint64: out.debug << "Convert int8_t to uint64"; break; + + // uint8_t -> (u)int* + case EOpConvUint8ToInt8: out.debug << "Convert uint8_t to int8_t";break; + case EOpConvUint8ToInt16: out.debug << "Convert uint8_t to int16_t";break; + case EOpConvUint8ToInt: out.debug << "Convert uint8_t to int"; break; + case EOpConvUint8ToInt64: out.debug << "Convert uint8_t to int64"; break; + case EOpConvUint8ToUint16: out.debug << "Convert uint8_t to uint16_t";break; + case EOpConvUint8ToUint: out.debug << "Convert uint8_t to uint"; break; + case EOpConvUint8ToUint64: out.debug << "Convert uint8_t to uint64"; break; + + // int8_t -> float* + case EOpConvInt8ToFloat16: out.debug << "Convert int8_t to float16_t";break; + case EOpConvInt8ToFloat: out.debug << "Convert int8_t to float"; break; + case EOpConvInt8ToDouble: out.debug << "Convert int8_t to double"; break; + + // uint8_t -> float* + case EOpConvUint8ToFloat16: out.debug << "Convert uint8_t to float16_t";break; + case EOpConvUint8ToFloat: out.debug << "Convert uint8_t to float"; break; + case EOpConvUint8ToDouble: out.debug << "Convert uint8_t to double"; break; + + // int16_t -> (u)int* + case EOpConvInt16ToInt8: out.debug << "Convert int16_t to int8_t";break; + case EOpConvInt16ToInt: out.debug << "Convert int16_t to int"; break; + case EOpConvInt16ToInt64: out.debug << "Convert int16_t to int64"; break; + case EOpConvInt16ToUint8: out.debug << "Convert int16_t to uint8_t";break; + case EOpConvInt16ToUint16: out.debug << "Convert int16_t to uint16_t";break; + case EOpConvInt16ToUint: out.debug << "Convert int16_t to uint"; break; + case EOpConvInt16ToUint64: out.debug << "Convert int16_t to uint64"; break; + + // int16_t -> float* + case EOpConvInt16ToFloat16: out.debug << "Convert int16_t to float16_t";break; + case EOpConvInt16ToFloat: out.debug << "Convert int16_t to float"; break; + case EOpConvInt16ToDouble: out.debug << "Convert int16_t to double"; break; + + // uint16_t -> (u)int* + case EOpConvUint16ToInt8: out.debug << "Convert uint16_t to int8_t";break; + case EOpConvUint16ToInt16: out.debug << "Convert uint16_t to int16_t";break; + case EOpConvUint16ToInt: out.debug << "Convert uint16_t to int"; break; + case EOpConvUint16ToInt64: out.debug << "Convert uint16_t to int64"; break; + case EOpConvUint16ToUint8: out.debug << "Convert uint16_t to uint8_t";break; + case EOpConvUint16ToUint: out.debug << "Convert uint16_t to uint"; break; + case EOpConvUint16ToUint64: out.debug << "Convert uint16_t to uint64"; break; + + // uint16_t -> float* + case EOpConvUint16ToFloat16: out.debug << "Convert uint16_t to float16_t";break; + case EOpConvUint16ToFloat: out.debug << "Convert uint16_t to float"; break; + case EOpConvUint16ToDouble: out.debug << "Convert uint16_t to double"; break; + + // int32_t -> (u)int* + case EOpConvIntToInt8: out.debug << "Convert int to int8_t";break; + case EOpConvIntToInt16: out.debug << "Convert int to int16_t";break; + case EOpConvIntToInt64: out.debug << "Convert int to int64"; break; + case EOpConvIntToUint8: out.debug << "Convert int to uint8_t";break; + case EOpConvIntToUint16: out.debug << "Convert int to uint16_t";break; + case EOpConvIntToUint: out.debug << "Convert int to uint"; break; + case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break; + + // int32_t -> float* + case EOpConvIntToFloat16: out.debug << "Convert int to float16_t";break; + case EOpConvIntToFloat: out.debug << "Convert int to float"; break; case EOpConvIntToDouble: out.debug << "Convert int to double"; break; - case EOpConvUintToDouble: out.debug << "Convert uint to double"; break; - case EOpConvFloatToDouble: out.debug << "Convert float to double"; break; - case EOpConvBoolToDouble: out.debug << "Convert bool to double"; break; - case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break; - case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break; - case EOpConvBoolToInt64: out.debug << "Convert bool to int64"; break; - case EOpConvIntToInt64: out.debug << "Convert int to int64"; break; + + // uint32_t -> (u)int* + case EOpConvUintToInt8: out.debug << "Convert uint to int8_t";break; + case EOpConvUintToInt16: out.debug << "Convert uint to int16_t";break; + case EOpConvUintToInt: out.debug << "Convert uint to int";break; case EOpConvUintToInt64: out.debug << "Convert uint to int64"; break; - case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break; - case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break; - case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break; - case EOpConvBoolToUint64: out.debug << "Convert bool to uint64"; break; - case EOpConvIntToUint64: out.debug << "Convert int to uint64"; break; - case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break; + case EOpConvUintToUint8: out.debug << "Convert uint to uint8_t";break; + case EOpConvUintToUint16: out.debug << "Convert uint to uint16_t";break; + case EOpConvUintToUint64: out.debug << "Convert uint to uint64"; break; + + // uint32_t -> float* + case EOpConvUintToFloat16: out.debug << "Convert uint to float16_t";break; + case EOpConvUintToFloat: out.debug << "Convert uint to float"; break; + case EOpConvUintToDouble: out.debug << "Convert uint to double"; break; + + // int64 -> (u)int* + case EOpConvInt64ToInt8: out.debug << "Convert int64 to int8_t"; break; + case EOpConvInt64ToInt16: out.debug << "Convert int64 to int16_t"; break; + case EOpConvInt64ToInt: out.debug << "Convert int64 to int"; break; + case EOpConvInt64ToUint8: out.debug << "Convert int64 to uint8_t";break; + case EOpConvInt64ToUint16: out.debug << "Convert int64 to uint16_t";break; + case EOpConvInt64ToUint: out.debug << "Convert int64 to uint"; break; + case EOpConvInt64ToUint64: out.debug << "Convert int64 to uint64"; break; + + // int64 -> float* + case EOpConvInt64ToFloat16: out.debug << "Convert int64 to float16_t";break; + case EOpConvInt64ToFloat: out.debug << "Convert int64 to float"; break; + case EOpConvInt64ToDouble: out.debug << "Convert int64 to double"; break; + + // uint64 -> (u)int* + case EOpConvUint64ToInt8: out.debug << "Convert uint64 to int8_t";break; + case EOpConvUint64ToInt16: out.debug << "Convert uint64 to int16_t";break; + case EOpConvUint64ToInt: out.debug << "Convert uint64 to int"; break; + case EOpConvUint64ToInt64: out.debug << "Convert uint64 to int64"; break; + case EOpConvUint64ToUint8: out.debug << "Convert uint64 to uint8_t";break; + case EOpConvUint64ToUint16: out.debug << "Convert uint64 to uint16"; break; + case EOpConvUint64ToUint: out.debug << "Convert uint64 to uint"; break; + + // uint64 -> float* + case EOpConvUint64ToFloat16: out.debug << "Convert uint64 to float16_t";break; + case EOpConvUint64ToFloat: out.debug << "Convert uint64 to float"; break; + case EOpConvUint64ToDouble: out.debug << "Convert uint64 to double"; break; + + // float16_t -> int* + case EOpConvFloat16ToInt8: out.debug << "Convert float16_t to int8_t"; break; + case EOpConvFloat16ToInt16: out.debug << "Convert float16_t to int16_t"; break; + case EOpConvFloat16ToInt: out.debug << "Convert float16_t to int"; break; + case EOpConvFloat16ToInt64: out.debug << "Convert float16_t to int64"; break; + + // float16_t -> uint* + case EOpConvFloat16ToUint8: out.debug << "Convert float16_t to uint8_t"; break; + case EOpConvFloat16ToUint16: out.debug << "Convert float16_t to uint16_t"; break; + case EOpConvFloat16ToUint: out.debug << "Convert float16_t to uint"; break; + case EOpConvFloat16ToUint64: out.debug << "Convert float16_t to uint64"; break; + + // float16_t -> float* + case EOpConvFloat16ToFloat: out.debug << "Convert float16_t to float"; break; + case EOpConvFloat16ToDouble: out.debug << "Convert float16_t to double"; break; + + // float32 -> float* + case EOpConvFloatToFloat16: out.debug << "Convert float to float16_t"; break; + case EOpConvFloatToDouble: out.debug << "Convert float to double"; break; + + // float32_t -> int* + case EOpConvFloatToInt8: out.debug << "Convert float to int8_t"; break; + case EOpConvFloatToInt16: out.debug << "Convert float to int16_t"; break; + case EOpConvFloatToInt: out.debug << "Convert float to int"; break; + case EOpConvFloatToInt64: out.debug << "Convert float to int64"; break; + + // float32_t -> uint* + case EOpConvFloatToUint8: out.debug << "Convert float to uint8_t"; break; + case EOpConvFloatToUint16: out.debug << "Convert float to uint16_t"; break; + case EOpConvFloatToUint: out.debug << "Convert float to uint"; break; case EOpConvFloatToUint64: out.debug << "Convert float to uint64"; break; + + // double -> float* + case EOpConvDoubleToFloat16: out.debug << "Convert double to float16_t"; break; + case EOpConvDoubleToFloat: out.debug << "Convert double to float"; break; + + // double -> int* + case EOpConvDoubleToInt8: out.debug << "Convert double to int8_t"; break; + case EOpConvDoubleToInt16: out.debug << "Convert double to int16_t"; break; + case EOpConvDoubleToInt: out.debug << "Convert double to int"; break; + case EOpConvDoubleToInt64: out.debug << "Convert double to int64"; break; + + // float32_t -> uint* + case EOpConvDoubleToUint8: out.debug << "Convert double to uint8_t"; break; + case EOpConvDoubleToUint16: out.debug << "Convert double to uint16_t"; break; + case EOpConvDoubleToUint: out.debug << "Convert double to uint"; break; case EOpConvDoubleToUint64: out.debug << "Convert double to uint64"; break; - case EOpConvInt64ToUint64: out.debug << "Convert uint64 to uint64"; break; + case EOpRadians: out.debug << "radians"; break; case EOpDegrees: out.debug << "degrees"; break; @@ -309,12 +462,10 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpDoubleBitsToUint64: out.debug << "doubleBitsToUint64"; break; case EOpInt64BitsToDouble: out.debug << "int64BitsToDouble"; break; case EOpUint64BitsToDouble: out.debug << "uint64BitsToDouble"; break; -#ifdef AMD_EXTENSIONS case EOpFloat16BitsToInt16: out.debug << "float16BitsToInt16"; break; case EOpFloat16BitsToUint16: out.debug << "float16BitsToUint16"; break; case EOpInt16BitsToFloat16: out.debug << "int16BitsToFloat16"; break; case EOpUint16BitsToFloat16: out.debug << "uint16BitsToFloat16"; break; -#endif case EOpPackSnorm2x16: out.debug << "packSnorm2x16"; break; case EOpUnpackSnorm2x16:out.debug << "unpackSnorm2x16"; break; @@ -322,6 +473,12 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpUnpackUnorm2x16:out.debug << "unpackUnorm2x16"; break; case EOpPackHalf2x16: out.debug << "packHalf2x16"; break; case EOpUnpackHalf2x16: out.debug << "unpackHalf2x16"; break; + case EOpPack16: out.debug << "pack16"; break; + case EOpPack32: out.debug << "pack32"; break; + case EOpPack64: out.debug << "pack64"; break; + case EOpUnpack32: out.debug << "unpack32"; break; + case EOpUnpack16: out.debug << "unpack16"; break; + case EOpUnpack8: out.debug << "unpack8"; break; case EOpPackSnorm4x8: out.debug << "PackSnorm4x8"; break; case EOpUnpackSnorm4x8: out.debug << "UnpackSnorm4x8"; break; @@ -335,7 +492,6 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpPackUint2x32: out.debug << "packUint2x32"; break; case EOpUnpackUint2x32: out.debug << "unpackUint2x32"; break; -#ifdef AMD_EXTENSIONS case EOpPackInt2x16: out.debug << "packInt2x16"; break; case EOpUnpackInt2x16: out.debug << "unpackInt2x16"; break; case EOpPackUint2x16: out.debug << "packUint2x16"; break; @@ -345,10 +501,8 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpUnpackInt4x16: out.debug << "unpackInt4x16"; break; case EOpPackUint4x16: out.debug << "packUint4x16"; break; case EOpUnpackUint4x16: out.debug << "unpackUint4x16"; break; - case EOpPackFloat2x16: out.debug << "packFloat2x16"; break; case EOpUnpackFloat2x16: out.debug << "unpackFloat2x16"; break; -#endif case EOpLength: out.debug << "length"; break; case EOpNormalize: out.debug << "normalize"; break; @@ -402,6 +556,82 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpAllInvocations: out.debug << "allInvocations"; break; case EOpAllInvocationsEqual: out.debug << "allInvocationsEqual"; break; + case EOpSubgroupElect: out.debug << "subgroupElect"; break; + case EOpSubgroupAll: out.debug << "subgroupAll"; break; + case EOpSubgroupAny: out.debug << "subgroupAny"; break; + case EOpSubgroupAllEqual: out.debug << "subgroupAllEqual"; break; + case EOpSubgroupBroadcast: out.debug << "subgroupBroadcast"; break; + case EOpSubgroupBroadcastFirst: out.debug << "subgroupBroadcastFirst"; break; + case EOpSubgroupBallot: out.debug << "subgroupBallot"; break; + case EOpSubgroupInverseBallot: out.debug << "subgroupInverseBallot"; break; + case EOpSubgroupBallotBitExtract: out.debug << "subgroupBallotBitExtract"; break; + case EOpSubgroupBallotBitCount: out.debug << "subgroupBallotBitCount"; break; + case EOpSubgroupBallotInclusiveBitCount: out.debug << "subgroupBallotInclusiveBitCount"; break; + case EOpSubgroupBallotExclusiveBitCount: out.debug << "subgroupBallotExclusiveBitCount"; break; + case EOpSubgroupBallotFindLSB: out.debug << "subgroupBallotFindLSB"; break; + case EOpSubgroupBallotFindMSB: out.debug << "subgroupBallotFindMSB"; break; + case EOpSubgroupShuffle: out.debug << "subgroupShuffle"; break; + case EOpSubgroupShuffleXor: out.debug << "subgroupShuffleXor"; break; + case EOpSubgroupShuffleUp: out.debug << "subgroupShuffleUp"; break; + case EOpSubgroupShuffleDown: out.debug << "subgroupShuffleDown"; break; + case EOpSubgroupAdd: out.debug << "subgroupAdd"; break; + case EOpSubgroupMul: out.debug << "subgroupMul"; break; + case EOpSubgroupMin: out.debug << "subgroupMin"; break; + case EOpSubgroupMax: out.debug << "subgroupMax"; break; + case EOpSubgroupAnd: out.debug << "subgroupAnd"; break; + case EOpSubgroupOr: out.debug << "subgroupOr"; break; + case EOpSubgroupXor: out.debug << "subgroupXor"; break; + case EOpSubgroupInclusiveAdd: out.debug << "subgroupInclusiveAdd"; break; + case EOpSubgroupInclusiveMul: out.debug << "subgroupInclusiveMul"; break; + case EOpSubgroupInclusiveMin: out.debug << "subgroupInclusiveMin"; break; + case EOpSubgroupInclusiveMax: out.debug << "subgroupInclusiveMax"; break; + case EOpSubgroupInclusiveAnd: out.debug << "subgroupInclusiveAnd"; break; + case EOpSubgroupInclusiveOr: out.debug << "subgroupInclusiveOr"; break; + case EOpSubgroupInclusiveXor: out.debug << "subgroupInclusiveXor"; break; + case EOpSubgroupExclusiveAdd: out.debug << "subgroupExclusiveAdd"; break; + case EOpSubgroupExclusiveMul: out.debug << "subgroupExclusiveMul"; break; + case EOpSubgroupExclusiveMin: out.debug << "subgroupExclusiveMin"; break; + case EOpSubgroupExclusiveMax: out.debug << "subgroupExclusiveMax"; break; + case EOpSubgroupExclusiveAnd: out.debug << "subgroupExclusiveAnd"; break; + case EOpSubgroupExclusiveOr: out.debug << "subgroupExclusiveOr"; break; + case EOpSubgroupExclusiveXor: out.debug << "subgroupExclusiveXor"; break; + case EOpSubgroupClusteredAdd: out.debug << "subgroupClusteredAdd"; break; + case EOpSubgroupClusteredMul: out.debug << "subgroupClusteredMul"; break; + case EOpSubgroupClusteredMin: out.debug << "subgroupClusteredMin"; break; + case EOpSubgroupClusteredMax: out.debug << "subgroupClusteredMax"; break; + case EOpSubgroupClusteredAnd: out.debug << "subgroupClusteredAnd"; break; + case EOpSubgroupClusteredOr: out.debug << "subgroupClusteredOr"; break; + case EOpSubgroupClusteredXor: out.debug << "subgroupClusteredXor"; break; + case EOpSubgroupQuadBroadcast: out.debug << "subgroupQuadBroadcast"; break; + case EOpSubgroupQuadSwapHorizontal: out.debug << "subgroupQuadSwapHorizontal"; break; + case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break; + case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break; + +#ifdef NV_EXTENSIONS + case EOpSubgroupPartition: out.debug << "subgroupPartitionNV"; break; + case EOpSubgroupPartitionedAdd: out.debug << "subgroupPartitionedAddNV"; break; + case EOpSubgroupPartitionedMul: out.debug << "subgroupPartitionedMulNV"; break; + case EOpSubgroupPartitionedMin: out.debug << "subgroupPartitionedMinNV"; break; + case EOpSubgroupPartitionedMax: out.debug << "subgroupPartitionedMaxNV"; break; + case EOpSubgroupPartitionedAnd: out.debug << "subgroupPartitionedAndNV"; break; + case EOpSubgroupPartitionedOr: out.debug << "subgroupPartitionedOrNV"; break; + case EOpSubgroupPartitionedXor: out.debug << "subgroupPartitionedXorNV"; break; + case EOpSubgroupPartitionedInclusiveAdd: out.debug << "subgroupPartitionedInclusiveAddNV"; break; + case EOpSubgroupPartitionedInclusiveMul: out.debug << "subgroupPartitionedInclusiveMulNV"; break; + case EOpSubgroupPartitionedInclusiveMin: out.debug << "subgroupPartitionedInclusiveMinNV"; break; + case EOpSubgroupPartitionedInclusiveMax: out.debug << "subgroupPartitionedInclusiveMaxNV"; break; + case EOpSubgroupPartitionedInclusiveAnd: out.debug << "subgroupPartitionedInclusiveAndNV"; break; + case EOpSubgroupPartitionedInclusiveOr: out.debug << "subgroupPartitionedInclusiveOrNV"; break; + case EOpSubgroupPartitionedInclusiveXor: out.debug << "subgroupPartitionedInclusiveXorNV"; break; + case EOpSubgroupPartitionedExclusiveAdd: out.debug << "subgroupPartitionedExclusiveAddNV"; break; + case EOpSubgroupPartitionedExclusiveMul: out.debug << "subgroupPartitionedExclusiveMulNV"; break; + case EOpSubgroupPartitionedExclusiveMin: out.debug << "subgroupPartitionedExclusiveMinNV"; break; + case EOpSubgroupPartitionedExclusiveMax: out.debug << "subgroupPartitionedExclusiveMaxNV"; break; + case EOpSubgroupPartitionedExclusiveAnd: out.debug << "subgroupPartitionedExclusiveAndNV"; break; + case EOpSubgroupPartitionedExclusiveOr: out.debug << "subgroupPartitionedExclusiveOrNV"; break; + case EOpSubgroupPartitionedExclusiveXor: out.debug << "subgroupPartitionedExclusiveXorNV"; break; +#endif + case EOpClip: out.debug << "clip"; break; case EOpIsFinite: out.debug << "isfinite"; break; case EOpLog10: out.debug << "log10"; break; @@ -434,62 +664,11 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpMbcnt: out.debug << "mbcnt"; break; - case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break; - case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break; - case EOpFragmentMaskFetch: out.debug << "fragmentMaskFetchAMD"; break; case EOpFragmentFetch: out.debug << "fragmentFetchAMD"; break; - case EOpConvBoolToFloat16: out.debug << "Convert bool to float16"; break; - case EOpConvIntToFloat16: out.debug << "Convert int to float16"; break; - case EOpConvUintToFloat16: out.debug << "Convert uint to float16"; break; - case EOpConvFloatToFloat16: out.debug << "Convert float to float16"; break; - case EOpConvDoubleToFloat16: out.debug << "Convert double to float16"; break; - case EOpConvInt64ToFloat16: out.debug << "Convert int64 to float16"; break; - case EOpConvUint64ToFloat16: out.debug << "Convert uint64 to float16"; break; - case EOpConvFloat16ToBool: out.debug << "Convert float16 to bool"; break; - case EOpConvFloat16ToInt: out.debug << "Convert float16 to int"; break; - case EOpConvFloat16ToUint: out.debug << "Convert float16 to uint"; break; - case EOpConvFloat16ToFloat: out.debug << "Convert float16 to float"; break; - case EOpConvFloat16ToDouble: out.debug << "Convert float16 to double"; break; - case EOpConvFloat16ToInt64: out.debug << "Convert float16 to int64"; break; - case EOpConvFloat16ToUint64: out.debug << "Convert float16 to uint64"; break; - - case EOpConvBoolToInt16: out.debug << "Convert bool to int16"; break; - case EOpConvIntToInt16: out.debug << "Convert int to int16"; break; - case EOpConvUintToInt16: out.debug << "Convert uint to int16"; break; - case EOpConvFloatToInt16: out.debug << "Convert float to int16"; break; - case EOpConvDoubleToInt16: out.debug << "Convert double to int16"; break; - case EOpConvFloat16ToInt16: out.debug << "Convert float16 to int16"; break; - case EOpConvInt64ToInt16: out.debug << "Convert int64 to int16"; break; - case EOpConvUint64ToInt16: out.debug << "Convert uint64 to int16"; break; - case EOpConvUint16ToInt16: out.debug << "Convert uint16 to int16"; break; - case EOpConvInt16ToBool: out.debug << "Convert int16 to bool"; break; - case EOpConvInt16ToInt: out.debug << "Convert int16 to int"; break; - case EOpConvInt16ToUint: out.debug << "Convert int16 to uint"; break; - case EOpConvInt16ToFloat: out.debug << "Convert int16 to float"; break; - case EOpConvInt16ToDouble: out.debug << "Convert int16 to double"; break; - case EOpConvInt16ToFloat16: out.debug << "Convert int16 to float16"; break; - case EOpConvInt16ToInt64: out.debug << "Convert int16 to int64"; break; - case EOpConvInt16ToUint64: out.debug << "Convert int16 to uint64"; break; - - case EOpConvBoolToUint16: out.debug << "Convert bool to uint16"; break; - case EOpConvIntToUint16: out.debug << "Convert int to uint16"; break; - case EOpConvUintToUint16: out.debug << "Convert uint to uint16"; break; - case EOpConvFloatToUint16: out.debug << "Convert float to uint16"; break; - case EOpConvDoubleToUint16: out.debug << "Convert double to uint16"; break; - case EOpConvFloat16ToUint16: out.debug << "Convert float16 to uint16"; break; - case EOpConvInt64ToUint16: out.debug << "Convert int64 to uint16"; break; - case EOpConvUint64ToUint16: out.debug << "Convert uint64 to uint16"; break; - case EOpConvInt16ToUint16: out.debug << "Convert int16 to uint16"; break; - case EOpConvUint16ToBool: out.debug << "Convert uint16 to bool"; break; - case EOpConvUint16ToInt: out.debug << "Convert uint16 to int"; break; - case EOpConvUint16ToUint: out.debug << "Convert uint16 to uint"; break; - case EOpConvUint16ToFloat: out.debug << "Convert uint16 to float"; break; - case EOpConvUint16ToDouble: out.debug << "Convert uint16 to double"; break; - case EOpConvUint16ToFloat16: out.debug << "Convert uint16 to float16"; break; - case EOpConvUint16ToInt64: out.debug << "Convert uint16 to int64"; break; - case EOpConvUint16ToUint64: out.debug << "Convert uint16 to uint64"; break; + case EOpCubeFaceIndex: out.debug << "cubeFaceIndex"; break; + case EOpCubeFaceCoord: out.debug << "cubeFaceCoord"; break; #endif case EOpSubpassLoad: out.debug << "subpassLoad"; break; @@ -537,23 +716,30 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructBVec2: out.debug << "Construct bvec2"; break; case EOpConstructBVec3: out.debug << "Construct bvec3"; break; case EOpConstructBVec4: out.debug << "Construct bvec4"; break; + case EOpConstructInt8: out.debug << "Construct int8_t"; break; + case EOpConstructI8Vec2: out.debug << "Construct i8vec2"; break; + case EOpConstructI8Vec3: out.debug << "Construct i8vec3"; break; + case EOpConstructI8Vec4: out.debug << "Construct i8vec4"; break; case EOpConstructInt: out.debug << "Construct int"; break; case EOpConstructIVec2: out.debug << "Construct ivec2"; break; case EOpConstructIVec3: out.debug << "Construct ivec3"; break; case EOpConstructIVec4: out.debug << "Construct ivec4"; break; + case EOpConstructUint8: out.debug << "Construct uint8_t"; break; + case EOpConstructU8Vec2: out.debug << "Construct u8vec2"; break; + case EOpConstructU8Vec3: out.debug << "Construct u8vec3"; break; + case EOpConstructU8Vec4: out.debug << "Construct u8vec4"; break; case EOpConstructUint: out.debug << "Construct uint"; break; case EOpConstructUVec2: out.debug << "Construct uvec2"; break; case EOpConstructUVec3: out.debug << "Construct uvec3"; break; case EOpConstructUVec4: out.debug << "Construct uvec4"; break; - case EOpConstructInt64: out.debug << "Construct int64_t"; break; + case EOpConstructInt64: out.debug << "Construct int64"; break; case EOpConstructI64Vec2: out.debug << "Construct i64vec2"; break; case EOpConstructI64Vec3: out.debug << "Construct i64vec3"; break; case EOpConstructI64Vec4: out.debug << "Construct i64vec4"; break; - case EOpConstructUint64: out.debug << "Construct uint64_t"; break; + case EOpConstructUint64: out.debug << "Construct uint64"; break; case EOpConstructU64Vec2: out.debug << "Construct u64vec2"; break; case EOpConstructU64Vec3: out.debug << "Construct u64vec3"; break; case EOpConstructU64Vec4: out.debug << "Construct u64vec4"; break; -#ifdef AMD_EXTENSIONS case EOpConstructInt16: out.debug << "Construct int16_t"; break; case EOpConstructI16Vec2: out.debug << "Construct i16vec2"; break; case EOpConstructI16Vec3: out.debug << "Construct i16vec3"; break; @@ -562,7 +748,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructU16Vec2: out.debug << "Construct u16vec2"; break; case EOpConstructU16Vec3: out.debug << "Construct u16vec3"; break; case EOpConstructU16Vec4: out.debug << "Construct u16vec4"; break; -#endif case EOpConstructMat2x2: out.debug << "Construct mat2"; break; case EOpConstructMat2x3: out.debug << "Construct mat2x3"; break; case EOpConstructMat2x4: out.debug << "Construct mat2x4"; break; @@ -608,7 +793,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructBMat4x2: out.debug << "Construct bmat4x2"; break; case EOpConstructBMat4x3: out.debug << "Construct bmat4x3"; break; case EOpConstructBMat4x4: out.debug << "Construct bmat4"; break; -#ifdef AMD_EXTENSIONS case EOpConstructFloat16: out.debug << "Construct float16_t"; break; case EOpConstructF16Vec2: out.debug << "Construct f16vec2"; break; case EOpConstructF16Vec3: out.debug << "Construct f16vec3"; break; @@ -622,7 +806,6 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpConstructF16Mat4x2: out.debug << "Construct f16mat4x2"; break; case EOpConstructF16Mat4x3: out.debug << "Construct f16mat4x3"; break; case EOpConstructF16Mat4x4: out.debug << "Construct f16mat4"; break; -#endif case EOpConstructStruct: out.debug << "Construct structure"; break; case EOpConstructTextureSampler: out.debug << "Construct combined texture-sampler"; break; @@ -688,6 +871,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpAtomicXor: out.debug << "AtomicXor"; break; case EOpAtomicExchange: out.debug << "AtomicExchange"; break; case EOpAtomicCompSwap: out.debug << "AtomicCompSwap"; break; + case EOpAtomicLoad: out.debug << "AtomicLoad"; break; + case EOpAtomicStore: out.debug << "AtomicStore"; break; case EOpAtomicCounterAdd: out.debug << "AtomicCounterAdd"; break; case EOpAtomicCounterSubtract: out.debug << "AtomicCounterSubtract"; break; @@ -711,6 +896,8 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpImageAtomicXor: out.debug << "imageAtomicXor"; break; case EOpImageAtomicExchange: out.debug << "imageAtomicExchange"; break; case EOpImageAtomicCompSwap: out.debug << "imageAtomicCompSwap"; break; + case EOpImageAtomicLoad: out.debug << "imageAtomicLoad"; break; + case EOpImageAtomicStore: out.debug << "imageAtomicStore"; break; #ifdef AMD_EXTENSIONS case EOpImageLoadLod: out.debug << "imageLoadLod"; break; case EOpImageStoreLod: out.debug << "imageStoreLod"; break; @@ -769,7 +956,13 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSparseTextureGatherLodOffsets: out.debug << "sparseTextureGatherLodOffsets"; break; case EOpSparseImageLoadLod: out.debug << "sparseImageLoadLod"; break; #endif - +#ifdef NV_EXTENSIONS + case EOpImageSampleFootprintNV: out.debug << "imageSampleFootprintNV"; break; + case EOpImageSampleFootprintClampNV: out.debug << "imageSampleFootprintClampNV"; break; + case EOpImageSampleFootprintLodNV: out.debug << "imageSampleFootprintLodNV"; break; + case EOpImageSampleFootprintGradNV: out.debug << "imageSampleFootprintGradNV"; break; + case EOpImageSampleFootprintGradClampNV: out.debug << "mageSampleFootprintGradClampNV"; break; +#endif case EOpAddCarry: out.debug << "addCarry"; break; case EOpSubBorrow: out.debug << "subBorrow"; break; case EOpUMulExtended: out.debug << "uMulExtended"; break; @@ -791,13 +984,79 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpGenMul: out.debug << "mul"; break; case EOpAllMemoryBarrierWithGroupSync: out.debug << "AllMemoryBarrierWithGroupSync"; break; - case EOpGroupMemoryBarrierWithGroupSync: out.debug << "GroupMemoryBarrierWithGroupSync"; break; + case EOpDeviceMemoryBarrier: out.debug << "DeviceMemoryBarrier"; break; + case EOpDeviceMemoryBarrierWithGroupSync: out.debug << "DeviceMemoryBarrierWithGroupSync"; break; case EOpWorkgroupMemoryBarrier: out.debug << "WorkgroupMemoryBarrier"; break; case EOpWorkgroupMemoryBarrierWithGroupSync: out.debug << "WorkgroupMemoryBarrierWithGroupSync"; break; + case EOpSubgroupBarrier: out.debug << "subgroupBarrier"; break; + case EOpSubgroupMemoryBarrier: out.debug << "subgroupMemoryBarrier"; break; + case EOpSubgroupMemoryBarrierBuffer: out.debug << "subgroupMemoryBarrierBuffer"; break; + case EOpSubgroupMemoryBarrierImage: out.debug << "subgroupMemoryBarrierImage"; break; + case EOpSubgroupMemoryBarrierShared: out.debug << "subgroupMemoryBarrierShared"; break; + case EOpSubgroupElect: out.debug << "subgroupElect"; break; + case EOpSubgroupAll: out.debug << "subgroupAll"; break; + case EOpSubgroupAny: out.debug << "subgroupAny"; break; + case EOpSubgroupAllEqual: out.debug << "subgroupAllEqual"; break; + case EOpSubgroupBroadcast: out.debug << "subgroupBroadcast"; break; + case EOpSubgroupBroadcastFirst: out.debug << "subgroupBroadcastFirst"; break; + case EOpSubgroupBallot: out.debug << "subgroupBallot"; break; + case EOpSubgroupInverseBallot: out.debug << "subgroupInverseBallot"; break; + case EOpSubgroupBallotBitExtract: out.debug << "subgroupBallotBitExtract"; break; + case EOpSubgroupBallotBitCount: out.debug << "subgroupBallotBitCount"; break; + case EOpSubgroupBallotInclusiveBitCount: out.debug << "subgroupBallotInclusiveBitCount"; break; + case EOpSubgroupBallotExclusiveBitCount: out.debug << "subgroupBallotExclusiveBitCount"; break; + case EOpSubgroupBallotFindLSB: out.debug << "subgroupBallotFindLSB"; break; + case EOpSubgroupBallotFindMSB: out.debug << "subgroupBallotFindMSB"; break; + case EOpSubgroupShuffle: out.debug << "subgroupShuffle"; break; + case EOpSubgroupShuffleXor: out.debug << "subgroupShuffleXor"; break; + case EOpSubgroupShuffleUp: out.debug << "subgroupShuffleUp"; break; + case EOpSubgroupShuffleDown: out.debug << "subgroupShuffleDown"; break; + case EOpSubgroupAdd: out.debug << "subgroupAdd"; break; + case EOpSubgroupMul: out.debug << "subgroupMul"; break; + case EOpSubgroupMin: out.debug << "subgroupMin"; break; + case EOpSubgroupMax: out.debug << "subgroupMax"; break; + case EOpSubgroupAnd: out.debug << "subgroupAnd"; break; + case EOpSubgroupOr: out.debug << "subgroupOr"; break; + case EOpSubgroupXor: out.debug << "subgroupXor"; break; + case EOpSubgroupInclusiveAdd: out.debug << "subgroupInclusiveAdd"; break; + case EOpSubgroupInclusiveMul: out.debug << "subgroupInclusiveMul"; break; + case EOpSubgroupInclusiveMin: out.debug << "subgroupInclusiveMin"; break; + case EOpSubgroupInclusiveMax: out.debug << "subgroupInclusiveMax"; break; + case EOpSubgroupInclusiveAnd: out.debug << "subgroupInclusiveAnd"; break; + case EOpSubgroupInclusiveOr: out.debug << "subgroupInclusiveOr"; break; + case EOpSubgroupInclusiveXor: out.debug << "subgroupInclusiveXor"; break; + case EOpSubgroupExclusiveAdd: out.debug << "subgroupExclusiveAdd"; break; + case EOpSubgroupExclusiveMul: out.debug << "subgroupExclusiveMul"; break; + case EOpSubgroupExclusiveMin: out.debug << "subgroupExclusiveMin"; break; + case EOpSubgroupExclusiveMax: out.debug << "subgroupExclusiveMax"; break; + case EOpSubgroupExclusiveAnd: out.debug << "subgroupExclusiveAnd"; break; + case EOpSubgroupExclusiveOr: out.debug << "subgroupExclusiveOr"; break; + case EOpSubgroupExclusiveXor: out.debug << "subgroupExclusiveXor"; break; + case EOpSubgroupClusteredAdd: out.debug << "subgroupClusteredAdd"; break; + case EOpSubgroupClusteredMul: out.debug << "subgroupClusteredMul"; break; + case EOpSubgroupClusteredMin: out.debug << "subgroupClusteredMin"; break; + case EOpSubgroupClusteredMax: out.debug << "subgroupClusteredMax"; break; + case EOpSubgroupClusteredAnd: out.debug << "subgroupClusteredAnd"; break; + case EOpSubgroupClusteredOr: out.debug << "subgroupClusteredOr"; break; + case EOpSubgroupClusteredXor: out.debug << "subgroupClusteredXor"; break; + case EOpSubgroupQuadBroadcast: out.debug << "subgroupQuadBroadcast"; break; + case EOpSubgroupQuadSwapHorizontal: out.debug << "subgroupQuadSwapHorizontal"; break; + case EOpSubgroupQuadSwapVertical: out.debug << "subgroupQuadSwapVertical"; break; + case EOpSubgroupQuadSwapDiagonal: out.debug << "subgroupQuadSwapDiagonal"; break; + case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; +#ifdef NV_EXTENSIONS + case EOpTraceNV: out.debug << "traceNV"; break; + case EOpReportIntersectionNV: out.debug << "reportIntersectionNV"; break; + case EOpIgnoreIntersectionNV: out.debug << "ignoreIntersectionNV"; break; + case EOpTerminateRayNV: out.debug << "terminateRayNV"; break; + case EOpExecuteCallableNV: out.debug << "executeCallableNV"; break; + case EOpWritePackedPrimitiveIndices4x8NV: out.debug << "writePackedPrimitiveIndices4x8NV"; break; +#endif + default: out.debug.message(EPrefixError, "Bad aggregation op"); } @@ -816,7 +1075,15 @@ bool TOutputTraverser::visitSelection(TVisit /* visit */, TIntermSelection* node OutputTreeText(out, node, depth); out.debug << "Test condition and select"; - out.debug << " (" << node->getCompleteString() << ")\n"; + out.debug << " (" << node->getCompleteString() << ")"; + + if (node->getShortCircuit() == false) + out.debug << ": no shortcircuit"; + if (node->getFlatten()) + out.debug << ": Flatten"; + if (node->getDontFlatten()) + out.debug << ": DontFlatten"; + out.debug << "\n"; ++depth; @@ -842,7 +1109,61 @@ bool TOutputTraverser::visitSelection(TVisit /* visit */, TIntermSelection* node return false; } -static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, int depth) +// Print infinities and NaNs, and numbers in a portable way. +// Goals: +// - portable (across IEEE 754 platforms) +// - shows all possible IEEE values +// - shows simple numbers in a simple way, e.g., no leading/trailing 0s +// - shows all digits, no premature rounding +static void OutputDouble(TInfoSink& out, double value, TOutputTraverser::EExtraOutput extra) +{ + if (IsInfinity(value)) { + if (value < 0) + out.debug << "-1.#INF"; + else + out.debug << "+1.#INF"; + } else if (IsNan(value)) + out.debug << "1.#IND"; + else { + const int maxSize = 340; + char buf[maxSize]; + const char* format = "%f"; + if (fabs(value) > 0.0 && (fabs(value) < 1e-5 || fabs(value) > 1e12)) + format = "%-.13e"; + int len = snprintf(buf, maxSize, format, value); + assert(len < maxSize); + + // remove a leading zero in the 100s slot in exponent; it is not portable + // pattern: XX...XXXe+0XX or XX...XXXe-0XX + if (len > 5) { + if (buf[len-5] == 'e' && (buf[len-4] == '+' || buf[len-4] == '-') && buf[len-3] == '0') { + buf[len-3] = buf[len-2]; + buf[len-2] = buf[len-1]; + buf[len-1] = '\0'; + } + } + + out.debug << buf; + + switch (extra) { + case TOutputTraverser::BinaryDoubleOutput: + { + out.debug << " : "; + long long b = *reinterpret_cast(&value); + for (size_t i = 0; i < 8 * sizeof(value); ++i, ++b) { + out.debug << ((b & 0x8000000000000000) != 0 ? "1" : "0"); + b <<= 1; + } + break; + } + default: + break; + } + } +} + +static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const TConstUnionArray& constUnion, + TOutputTraverser::EExtraOutput extra, int depth) { int size = node->getType().computeNumComponents(); @@ -861,26 +1182,44 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const break; case EbtFloat: case EbtDouble: -#ifdef AMD_EXTENSIONS case EbtFloat16: -#endif + OutputDouble(out, constUnion[i].getDConst(), extra); + out.debug << "\n"; + break; + case EbtInt8: { - const double value = constUnion[i].getDConst(); - // Print infinities and NaNs in a portable way. - if (IsInfinity(value)) { - if (value < 0) - out.debug << "-1.#INF\n"; - else - out.debug << "+1.#INF\n"; - } else if (IsNan(value)) - out.debug << "1.#IND\n"; - else { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%f", value); + const int maxSize = 300; + char buf[maxSize]; + snprintf(buf, maxSize, "%d (%s)", constUnion[i].getI8Const(), "const int8_t"); - out.debug << buf << "\n"; - } + out.debug << buf << "\n"; + } + break; + case EbtUint8: + { + const int maxSize = 300; + char buf[maxSize]; + snprintf(buf, maxSize, "%u (%s)", constUnion[i].getU8Const(), "const uint8_t"); + + out.debug << buf << "\n"; + } + break; + case EbtInt16: + { + const int maxSize = 300; + char buf[maxSize]; + snprintf(buf, maxSize, "%d (%s)", constUnion[i].getI16Const(), "const int16_t"); + + out.debug << buf << "\n"; + } + break; + case EbtUint16: + { + const int maxSize = 300; + char buf[maxSize]; + snprintf(buf, maxSize, "%u (%s)", constUnion[i].getU16Const(), "const uint16_t"); + + out.debug << buf << "\n"; } break; case EbtInt: @@ -919,26 +1258,6 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const out.debug << buf << "\n"; } break; -#ifdef AMD_EXTENSIONS - case EbtInt16: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%d (%s)", constUnion[i].getIConst(), "const int16_t"); - - out.debug << buf << "\n"; - } - break; - case EbtUint16: - { - const int maxSize = 300; - char buf[maxSize]; - snprintf(buf, maxSize, "%u (%s)", constUnion[i].getUConst(), "const uint16_t"); - - out.debug << buf << "\n"; - } - break; -#endif default: out.info.message(EPrefixInternalError, "Unknown constant", node->getLoc()); break; @@ -951,7 +1270,7 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node) OutputTreeText(infoSink, node, depth); infoSink.debug << "Constant:\n"; - OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1); + OutputConstantUnion(infoSink, node, node->getConstArray(), extraOutput, depth + 1); } void TOutputTraverser::visitSymbol(TIntermSymbol* node) @@ -961,7 +1280,7 @@ void TOutputTraverser::visitSymbol(TIntermSymbol* node) infoSink.debug << "'" << node->getName() << "' (" << node->getCompleteString() << ")\n"; if (! node->getConstArray().empty()) - OutputConstantUnion(infoSink, node, node->getConstArray(), depth + 1); + OutputConstantUnion(infoSink, node, node->getConstArray(), extraOutput, depth + 1); else if (node->getConstSubtree()) { incrementDepth(node); node->getConstSubtree()->traverse(this); @@ -978,7 +1297,17 @@ bool TOutputTraverser::visitLoop(TVisit /* visit */, TIntermLoop* node) out.debug << "Loop with condition "; if (! node->testFirst()) out.debug << "not "; - out.debug << "tested first\n"; + out.debug << "tested first"; + + if (node->getUnroll()) + out.debug << ": Unroll"; + if (node->getDontUnroll()) + out.debug << ": DontUnroll"; + if (node->getLoopDependency()) { + out.debug << ": Dependency "; + out.debug << node->getLoopDependency(); + } + out.debug << "\n"; ++depth; @@ -1039,7 +1368,13 @@ bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node) TInfoSink& out = infoSink; OutputTreeText(out, node, depth); - out.debug << "switch\n"; + out.debug << "switch"; + + if (node->getFlatten()) + out.debug << ": Flatten"; + if (node->getDontFlatten()) + out.debug << ": DontFlatten"; + out.debug << "\n"; OutputTreeText(out, node, depth); out.debug << "condition\n"; @@ -1125,6 +1460,16 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) } break; +#ifdef NV_EXTENSIONS + case EShLangMeshNV: + infoSink.debug << "max_vertices = " << vertices << "\n"; + infoSink.debug << "max_primitives = " << primitives << "\n"; + infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n"; + // Fall through + + case EShLangTaskNV: + // Fall through +#endif case EShLangCompute: infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n"; { @@ -1147,7 +1492,8 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree) return; TOutputTraverser it(infoSink); - + if (getBinaryDoubleOutput()) + it.setDoubleOutput(TOutputTraverser::BinaryDoubleOutput); treeRoot->traverse(&it); } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp index a7d9d91d19c..46c75583785 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp @@ -132,7 +132,7 @@ public: target = &inputList; else if (base->getQualifier().storage == EvqVaryingOut) target = &outputList; - else if (base->getQualifier().isUniformOrBuffer()) + else if (base->getQualifier().isUniformOrBuffer() && !base->getQualifier().layoutPushConstant) target = &uniformList; if (target) { @@ -331,8 +331,14 @@ struct TResolverInOutAdaptor ent.symbol->getType(), ent.live); } else { - TString errorMsg = "Invalid shader In/Out variable semantic: "; - errorMsg += ent.symbol->getType().getQualifier().semanticName; + TString errorMsg; + if (ent.symbol->getType().getQualifier().semanticName != nullptr) { + errorMsg = "Invalid shader In/Out variable semantic: "; + errorMsg += ent.symbol->getType().getQualifier().semanticName; + } else { + errorMsg = "Invalid shader In/Out variable: "; + errorMsg += ent.symbol->getName(); + } infoSink.info.message(EPrefixInternalError, errorMsg.c_str()); error = true; } @@ -353,7 +359,9 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver { TDefaultIoResolverBase(const TIntermediate &intermediate) : intermediate(intermediate), - nextUniformLocation(0) + nextUniformLocation(intermediate.getUniformLocationBase()), + nextInputLocation(0), + nextOutputLocation(0) { } int getBaseBinding(TResourceType res, unsigned int set) const { @@ -381,29 +389,34 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver return !(at != slots[set].end() && *at == slot); } - int reserveSlot(int set, int slot) + int reserveSlot(int set, int slot, int size = 1) { TSlotSet::iterator at = findSlot(set, slot); // tolerate aliasing, by not double-recording aliases // (policy about appropriateness of the alias is higher up) - if (at == slots[set].end() || *at != slot) - slots[set].insert(at, slot); + for (int i = 0; i < size; i++) { + if (at == slots[set].end() || *at != slot + i) + at = slots[set].insert(at, slot + i); + ++at; + } return slot; } - int getFreeSlot(int set, int base) + int getFreeSlot(int set, int base, int size = 1) { TSlotSet::iterator at = findSlot(set, base); if (at == slots[set].end()) - return reserveSlot(set, base); + return reserveSlot(set, base, size); - // look in locksteps, if they not match, then there is a free slot - for (; at != slots[set].end(); ++at, ++base) - if (*at != base) + // look for a big enough gap + for (; at != slots[set].end(); ++at) { + if (*at - base >= size) break; - return reserveSlot(set, base); + base = *at + 1; + } + return reserveSlot(set, base, size); } virtual bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override = 0; @@ -421,7 +434,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver return 0; } - int resolveUniformLocation(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override + int resolveUniformLocation(EShLanguage /*stage*/, const char* name, const glslang::TType& type, bool /*is_live*/) override { // kick out of not doing this if (!doAutoLocationMapping()) @@ -429,7 +442,9 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver // no locations added if already present, a built-in variable, a block, or an opaque if (type.getQualifier().hasLocation() || type.isBuiltIn() || - type.getBasicType() == EbtBlock || type.containsOpaque()) + type.getBasicType() == EbtBlock || + type.getBasicType() == EbtAtomicUint || + (type.containsOpaque() && intermediate.getSpv().openGl == 0)) return -1; // no locations on blocks of built-in variables @@ -440,13 +455,21 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver return -1; } - return nextUniformLocation++; + int location = intermediate.getUniformLocationOverride(name); + if (location != -1) + return location; + + location = nextUniformLocation; + + nextUniformLocation += TIntermediate::computeTypeUniformLocationSize(type); + + return location; } bool validateInOut(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override { return true; } - int resolveInOutLocation(EShLanguage /*stage*/, const char* /*name*/, const TType& type, bool /*is_live*/) override + int resolveInOutLocation(EShLanguage stage, const char* /*name*/, const TType& type, bool /*is_live*/) override { // kick out of not doing this if (!doAutoLocationMapping()) @@ -464,14 +487,24 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver return -1; } - // Placeholder. - // TODO: It would be nice to flesh this out using - // intermediate->computeTypeLocationSize(type), or functions that call it like - // intermediate->addUsedLocation() - // These in turn would want the intermediate, which is not available here, but - // is available in many places, and a lot of copying from it could be saved if - // it were just available. - return 0; + // point to the right input or output location counter + int& nextLocation = type.getQualifier().isPipeInput() ? nextInputLocation : nextOutputLocation; + + // Placeholder. This does not do proper cross-stage lining up, nor + // work with mixed location/no-location declarations. + int location = nextLocation; + int typeLocationSize; + // Don’t take into account the outer-most array if the stage’s + // interface is automatically an array. + if (type.getQualifier().isArrayedIo(stage)) { + TType elementType(type, 0); + typeLocationSize = TIntermediate::computeTypeLocationSize(elementType, stage); + } else { + typeLocationSize = TIntermediate::computeTypeLocationSize(type, stage); + } + nextLocation += typeLocationSize; + + return location; } int resolveInOutComponent(EShLanguage /*stage*/, const char* /*name*/, const TType& /*type*/, bool /*is_live*/) override { @@ -490,8 +523,13 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver void endResolve(EShLanguage) override {} protected: + TDefaultIoResolverBase(TDefaultIoResolverBase&); + TDefaultIoResolverBase& operator=(TDefaultIoResolverBase&); + const TIntermediate &intermediate; int nextUniformLocation; + int nextInputLocation; + int nextOutputLocation; // Return descriptor set specific base if there is one, and the generic base otherwise. int selectBaseBinding(int base, int descriptorSetBase) const { @@ -541,40 +579,42 @@ struct TDefaultIoResolver : public TDefaultIoResolverBase int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override { const int set = getLayoutSet(type); + // On OpenGL arrays of opaque types take a seperate binding for each element + int numBindings = intermediate.getSpv().openGl != 0 && type.isSizedArray() ? type.getCumulativeArraySize() : 1; if (type.getQualifier().hasBinding()) { if (isImageType(type)) - return reserveSlot(set, getBaseBinding(EResImage, set) + type.getQualifier().layoutBinding); + return reserveSlot(set, getBaseBinding(EResImage, set) + type.getQualifier().layoutBinding, numBindings); if (isTextureType(type)) - return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding); + return reserveSlot(set, getBaseBinding(EResTexture, set) + type.getQualifier().layoutBinding, numBindings); if (isSsboType(type)) - return reserveSlot(set, getBaseBinding(EResSsbo, set) + type.getQualifier().layoutBinding); + return reserveSlot(set, getBaseBinding(EResSsbo, set) + type.getQualifier().layoutBinding, numBindings); if (isSamplerType(type)) - return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding); + return reserveSlot(set, getBaseBinding(EResSampler, set) + type.getQualifier().layoutBinding, numBindings); if (isUboType(type)) - return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding); + return reserveSlot(set, getBaseBinding(EResUbo, set) + type.getQualifier().layoutBinding, numBindings); } else if (is_live && doAutoBindingMapping()) { // find free slot, the caller did make sure it passes all vars with binding // first and now all are passed that do not have a binding and needs one if (isImageType(type)) - return getFreeSlot(set, getBaseBinding(EResImage, set)); + return getFreeSlot(set, getBaseBinding(EResImage, set), numBindings); if (isTextureType(type)) - return getFreeSlot(set, getBaseBinding(EResTexture, set)); + return getFreeSlot(set, getBaseBinding(EResTexture, set), numBindings); if (isSsboType(type)) - return getFreeSlot(set, getBaseBinding(EResSsbo, set)); + return getFreeSlot(set, getBaseBinding(EResSsbo, set), numBindings); if (isSamplerType(type)) - return getFreeSlot(set, getBaseBinding(EResSampler, set)); + return getFreeSlot(set, getBaseBinding(EResSampler, set), numBindings); if (isUboType(type)) - return getFreeSlot(set, getBaseBinding(EResUbo, set)); + return getFreeSlot(set, getBaseBinding(EResUbo, set), numBindings); } return -1; @@ -593,7 +633,7 @@ protected: /******************************************************************************** The following IO resolver maps types in HLSL register space, as follows: -t – for shader resource views (SRV) +t - for shader resource views (SRV) TEXTURE1D TEXTURE1DARRAY TEXTURE2D @@ -608,7 +648,7 @@ t – for shader resource views (SRV) BUFFER TBUFFER -s – for samplers +s - for samplers SAMPLER SAMPLER1D SAMPLER2D @@ -617,7 +657,7 @@ s – for samplers SAMPLERSTATE SAMPLERCOMPARISONSTATE -u – for unordered access views (UAV) +u - for unordered access views (UAV) RWBYTEADDRESSBUFFER RWSTRUCTUREDBUFFER APPENDSTRUCTUREDBUFFER @@ -629,7 +669,7 @@ u – for unordered access views (UAV) RWTEXTURE2DARRAY RWTEXTURE3D -b – for constant buffer views (CBV) +b - for constant buffer views (CBV) CBUFFER CONSTANTBUFFER ********************************************************************************/ diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp index 9ca1557b50e..82e7c6e7e14 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp @@ -1,5 +1,6 @@ // // Copyright (C) 2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -76,12 +77,13 @@ void TIntermediate::warn(TInfoSink& infoSink, const char* message) // void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) { - if (source == EShSourceNone) - source = unit.source; - - if (source != unit.source) - error(infoSink, "can't link compilation units from different source languages"); + mergeCallGraphs(infoSink, unit); + mergeModes(infoSink, unit); + mergeTrees(infoSink, unit); +} +void TIntermediate::mergeCallGraphs(TInfoSink& infoSink, TIntermediate& unit) +{ if (unit.getNumEntryPoints() > 0) { if (getNumEntryPoints() > 0) error(infoSink, "can't handle multiple entry points per stage"); @@ -91,25 +93,75 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) } } numEntryPoints += unit.getNumEntryPoints(); + + callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end()); +} + +#define MERGE_MAX(member) member = std::max(member, unit.member) +#define MERGE_TRUE(member) if (unit.member) member = unit.member; + +void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit) +{ + if (language != unit.language) + error(infoSink, "stages must match when linking into a single stage"); + + if (source == EShSourceNone) + source = unit.source; + if (source != unit.source) + error(infoSink, "can't link compilation units from different source languages"); + + if (treeRoot == nullptr) { + profile = unit.profile; + version = unit.version; + requestedExtensions = unit.requestedExtensions; + } else { + if ((profile == EEsProfile) != (unit.profile == EEsProfile)) + error(infoSink, "Cannot cross link ES and desktop profiles"); + else if (unit.profile == ECompatibilityProfile) + profile = ECompatibilityProfile; + version = std::max(version, unit.version); + requestedExtensions.insert(unit.requestedExtensions.begin(), unit.requestedExtensions.end()); + } + + MERGE_MAX(spvVersion.spv); + MERGE_MAX(spvVersion.vulkanGlsl); + MERGE_MAX(spvVersion.vulkan); + MERGE_MAX(spvVersion.openGl); + numErrors += unit.getNumErrors(); numPushConstants += unit.numPushConstants; - callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end()); - if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger) - error(infoSink, "gl_FragCoord redeclarations must match across shaders"); + if (unit.invocations != TQualifier::layoutNotSet) { + if (invocations == TQualifier::layoutNotSet) + invocations = unit.invocations; + else if (invocations != unit.invocations) + error(infoSink, "number of invocations must match between compilation units"); + } - if (! earlyFragmentTests) - earlyFragmentTests = unit.earlyFragmentTests; - - if (!postDepthCoverage) - postDepthCoverage = unit.postDepthCoverage; - - if (depthLayout == EldNone) - depthLayout = unit.depthLayout; - else if (depthLayout != unit.depthLayout) - error(infoSink, "Contradictory depth layouts"); - - blendEquations |= unit.blendEquations; + if (vertices == TQualifier::layoutNotSet) + vertices = unit.vertices; + else if (vertices != unit.vertices) { + if (language == EShLangGeometry +#ifdef NV_EXTENSIONS + || language == EShLangMeshNV +#endif + ) + error(infoSink, "Contradictory layout max_vertices values"); + else if (language == EShLangTessControl) + error(infoSink, "Contradictory layout vertices values"); + else + assert(0); + } +#ifdef NV_EXTENSIONS + if (primitives == TQualifier::layoutNotSet) + primitives = unit.primitives; + else if (primitives != unit.primitives) { + if (language == EShLangMeshNV) + error(infoSink, "Contradictory layout max_primitives values"); + else + assert(0); + } +#endif if (inputPrimitive == ElgNone) inputPrimitive = unit.inputPrimitive; @@ -121,16 +173,8 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) else if (outputPrimitive != unit.outputPrimitive) error(infoSink, "Contradictory output layout primitives"); - if (vertices == TQualifier::layoutNotSet) - vertices = unit.vertices; - else if (vertices != unit.vertices) { - if (language == EShLangGeometry) - error(infoSink, "Contradictory layout max_vertices values"); - else if (language == EShLangTessControl) - error(infoSink, "Contradictory layout vertices values"); - else - assert(0); - } + if (originUpperLeft != unit.originUpperLeft || pixelCenterInteger != unit.pixelCenterInteger) + error(infoSink, "gl_FragCoord redeclarations must match across shaders"); if (vertexSpacing == EvsNone) vertexSpacing = unit.vertexSpacing; @@ -142,8 +186,7 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) else if (vertexOrder != unit.vertexOrder) error(infoSink, "Contradictory triangle ordering"); - if (unit.pointMode) - pointMode = true; + MERGE_TRUE(pointMode); for (int i = 0; i < 3; ++i) { if (localSize[i] > 1) @@ -157,8 +200,21 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) error(infoSink, "Contradictory local size specialization ids"); } - if (unit.xfbMode) - xfbMode = true; + MERGE_TRUE(earlyFragmentTests); + MERGE_TRUE(postDepthCoverage); + + if (depthLayout == EldNone) + depthLayout = unit.depthLayout; + else if (depthLayout != unit.depthLayout) + error(infoSink, "Contradictory depth layouts"); + + MERGE_TRUE(depthReplacing); + MERGE_TRUE(hlslFunctionality1); + + blendEquations |= unit.blendEquations; + + MERGE_TRUE(xfbMode); + for (size_t b = 0; b < xfbBuffers.size(); ++b) { if (xfbBuffers[b].stride == TQualifier::layoutXfbStrideEnd) xfbBuffers[b].stride = unit.xfbBuffers[b].stride; @@ -170,35 +226,181 @@ void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit) // TODO: 4.4 link: enhanced layouts: compare ranges } - if (unit.treeRoot == 0) + MERGE_TRUE(multiStream); + +#ifdef NV_EXTENSIONS + MERGE_TRUE(layoutOverrideCoverage); + MERGE_TRUE(geoPassthroughEXT); +#endif + + for (unsigned int i = 0; i < unit.shiftBinding.size(); ++i) { + if (unit.shiftBinding[i] > 0) + setShiftBinding((TResourceType)i, unit.shiftBinding[i]); + } + + for (unsigned int i = 0; i < unit.shiftBindingForSet.size(); ++i) { + for (auto it = unit.shiftBindingForSet[i].begin(); it != unit.shiftBindingForSet[i].end(); ++it) + setShiftBindingForSet((TResourceType)i, it->second, it->first); + } + + resourceSetBinding.insert(resourceSetBinding.end(), unit.resourceSetBinding.begin(), unit.resourceSetBinding.end()); + + MERGE_TRUE(autoMapBindings); + MERGE_TRUE(autoMapLocations); + MERGE_TRUE(invertY); + MERGE_TRUE(flattenUniformArrays); + MERGE_TRUE(useUnknownFormat); + MERGE_TRUE(hlslOffsets); + MERGE_TRUE(useStorageBuffer); + MERGE_TRUE(hlslIoMapping); + + // TODO: sourceFile + // TODO: sourceText + // TODO: processes + + MERGE_TRUE(needToLegalize); + MERGE_TRUE(binaryDoubleOutput); +} + +// +// Merge the 'unit' AST into 'this' AST. +// That includes rationalizing the unique IDs, which were set up independently, +// and might have overlaps that are not the same symbol, or might have different +// IDs for what should be the same shared symbol. +// +void TIntermediate::mergeTrees(TInfoSink& infoSink, TIntermediate& unit) +{ + if (unit.treeRoot == nullptr) return; - if (treeRoot == 0) { + if (treeRoot == nullptr) { treeRoot = unit.treeRoot; - version = unit.version; - requestedExtensions = unit.requestedExtensions; return; } // Getting this far means we have two existing trees to merge... +#ifdef NV_EXTENSIONS + numShaderRecordNVBlocks += unit.numShaderRecordNVBlocks; +#endif - version = std::max(version, unit.version); - requestedExtensions.insert(unit.requestedExtensions.begin(), unit.requestedExtensions.end()); +#ifdef NV_EXTENSIONS + numTaskNVBlocks += unit.numTaskNVBlocks; +#endif // Get the top-level globals of each unit TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence(); TIntermSequence& unitGlobals = unit.treeRoot->getAsAggregate()->getSequence(); // Get the linker-object lists - TIntermSequence& linkerObjects = findLinkerObjects(); - TIntermSequence& unitLinkerObjects = unit.findLinkerObjects(); + TIntermSequence& linkerObjects = findLinkerObjects()->getSequence(); + const TIntermSequence& unitLinkerObjects = unit.findLinkerObjects()->getSequence(); + + // Map by global name to unique ID to rationalize the same object having + // differing IDs in different trees. + TMap idMap; + int maxId; + seedIdMap(idMap, maxId); + remapIds(idMap, maxId + 1, unit); mergeBodies(infoSink, globals, unitGlobals); mergeLinkerObjects(infoSink, linkerObjects, unitLinkerObjects); - ioAccessed.insert(unit.ioAccessed.begin(), unit.ioAccessed.end()); } +// Traverser that seeds an ID map with all built-ins, and tracks the +// maximum ID used. +// (It would be nice to put this in a function, but that causes warnings +// on having no bodies for the copy-constructor/operator=.) +class TBuiltInIdTraverser : public TIntermTraverser { +public: + TBuiltInIdTraverser(TMap& idMap) : idMap(idMap), maxId(0) { } + // If it's a built in, add it to the map. + // Track the max ID. + virtual void visitSymbol(TIntermSymbol* symbol) + { + const TQualifier& qualifier = symbol->getType().getQualifier(); + if (qualifier.builtIn != EbvNone) + idMap[symbol->getName()] = symbol->getId(); + maxId = std::max(maxId, symbol->getId()); + } + int getMaxId() const { return maxId; } +protected: + TBuiltInIdTraverser(TBuiltInIdTraverser&); + TBuiltInIdTraverser& operator=(TBuiltInIdTraverser&); + TMap& idMap; + int maxId; +}; + +// Traverser that seeds an ID map with non-builtins. +// (It would be nice to put this in a function, but that causes warnings +// on having no bodies for the copy-constructor/operator=.) +class TUserIdTraverser : public TIntermTraverser { +public: + TUserIdTraverser(TMap& idMap) : idMap(idMap) { } + // If its a non-built-in global, add it to the map. + virtual void visitSymbol(TIntermSymbol* symbol) + { + const TQualifier& qualifier = symbol->getType().getQualifier(); + if (qualifier.builtIn == EbvNone) + idMap[symbol->getName()] = symbol->getId(); + } + +protected: + TUserIdTraverser(TUserIdTraverser&); + TUserIdTraverser& operator=(TUserIdTraverser&); + TMap& idMap; // over biggest id +}; + +// Initialize the the ID map with what we know of 'this' AST. +void TIntermediate::seedIdMap(TMap& idMap, int& maxId) +{ + // all built-ins everywhere need to align on IDs and contribute to the max ID + TBuiltInIdTraverser builtInIdTraverser(idMap); + treeRoot->traverse(&builtInIdTraverser); + maxId = builtInIdTraverser.getMaxId(); + + // user variables in the linker object list need to align on ids + TUserIdTraverser userIdTraverser(idMap); + findLinkerObjects()->traverse(&userIdTraverser); +} + +// Traverser to map an AST ID to what was known from the seeding AST. +// (It would be nice to put this in a function, but that causes warnings +// on having no bodies for the copy-constructor/operator=.) +class TRemapIdTraverser : public TIntermTraverser { +public: + TRemapIdTraverser(const TMap& idMap, int idShift) : idMap(idMap), idShift(idShift) { } + // Do the mapping: + // - if the same symbol, adopt the 'this' ID + // - otherwise, ensure a unique ID by shifting to a new space + virtual void visitSymbol(TIntermSymbol* symbol) + { + const TQualifier& qualifier = symbol->getType().getQualifier(); + bool remapped = false; + if (qualifier.isLinkable() || qualifier.builtIn != EbvNone) { + auto it = idMap.find(symbol->getName()); + if (it != idMap.end()) { + symbol->changeId(it->second); + remapped = true; + } + } + if (!remapped) + symbol->changeId(symbol->getId() + idShift); + } +protected: + TRemapIdTraverser(TRemapIdTraverser&); + TRemapIdTraverser& operator=(TRemapIdTraverser&); + const TMap& idMap; + int idShift; +}; + +void TIntermediate::remapIds(const TMap& idMap, int idShift, TIntermediate& unit) +{ + // Remap all IDs to either share or be unique, as dictated by the idMap and idShift. + TRemapIdTraverser idTraverser(idMap, idShift); + unit.getTreeRoot()->traverse(&idTraverser); +} + // // Merge the function bodies and global-level initializers from unitGlobals into globals. // Will error check duplication of function bodies for the same signature. @@ -267,10 +469,13 @@ void TIntermediate::mergeLinkerObjects(TInfoSink& infoSink, TIntermSequence& lin // Recursively merge the implicit array sizes through the objects' respective type trees. void TIntermediate::mergeImplicitArraySizes(TType& type, const TType& unitType) { - if (type.isImplicitlySizedArray() && unitType.isArray()) { - int newImplicitArraySize = unitType.isImplicitlySizedArray() ? unitType.getImplicitArraySize() : unitType.getOuterArraySize(); - if (newImplicitArraySize > type.getImplicitArraySize ()) - type.setImplicitArraySize(newImplicitArraySize); + if (type.isUnsizedArray()) { + if (unitType.isUnsizedArray()) { + type.updateImplicitArraySize(unitType.getImplicitArraySize()); + if (unitType.isArrayVariablyIndexed()) + type.setArrayVariablyIndexed(); + } else if (unitType.isSizedArray()) + type.changeOuterArraySize(unitType.getOuterArraySize()); } // Type mismatches are caught and reported after this, just be careful for now. @@ -293,8 +498,13 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy // Types have to match if (symbol.getType() != unitSymbol.getType()) { - error(infoSink, "Types must match:"); - writeTypeComparison = true; + // but, we make an exception if one is an implicit array and the other is sized + if (! (symbol.getType().isArray() && unitSymbol.getType().isArray() && + symbol.getType().sameElementType(unitSymbol.getType()) && + (symbol.getType().isUnsizedArray() || unitSymbol.getType().isUnsizedArray()))) { + error(infoSink, "Types must match:"); + writeTypeComparison = true; + } } // Qualifiers have to (almost) match @@ -335,11 +545,16 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy } // Memory... - if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent || - symbol.getQualifier().volatil != unitSymbol.getQualifier().volatil || - symbol.getQualifier().restrict != unitSymbol.getQualifier().restrict || - symbol.getQualifier().readonly != unitSymbol.getQualifier().readonly || - symbol.getQualifier().writeonly != unitSymbol.getQualifier().writeonly) { + if (symbol.getQualifier().coherent != unitSymbol.getQualifier().coherent || + symbol.getQualifier().devicecoherent != unitSymbol.getQualifier().devicecoherent || + symbol.getQualifier().queuefamilycoherent != unitSymbol.getQualifier().queuefamilycoherent || + symbol.getQualifier().workgroupcoherent != unitSymbol.getQualifier().workgroupcoherent || + symbol.getQualifier().subgroupcoherent != unitSymbol.getQualifier().subgroupcoherent || + symbol.getQualifier().nonprivate != unitSymbol.getQualifier().nonprivate || + symbol.getQualifier().volatil != unitSymbol.getQualifier().volatil || + symbol.getQualifier().restrict != unitSymbol.getQualifier().restrict || + symbol.getQualifier().readonly != unitSymbol.getQualifier().readonly || + symbol.getQualifier().writeonly != unitSymbol.getQualifier().writeonly) { error(infoSink, "Memory qualifiers must match:"); writeTypeComparison = true; } @@ -474,17 +689,9 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) case EShLangGeometry: if (inputPrimitive == ElgNone) error(infoSink, "At least one shader must specify an input layout primitive"); - if (outputPrimitive == ElgNone -#ifdef NV_EXTENSIONS - && !getGeoPassthroughEXT() -#endif - ) + if (outputPrimitive == ElgNone) error(infoSink, "At least one shader must specify an output layout primitive"); - if (vertices == TQualifier::layoutNotSet -#ifdef NV_EXTENSIONS - && !getGeoPassthroughEXT() -#endif - ) + if (vertices == TQualifier::layoutNotSet) error(infoSink, "At least one shader must specify a layout(max_vertices = value)"); break; case EShLangFragment: @@ -496,6 +703,42 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) break; case EShLangCompute: break; + +#ifdef NV_EXTENSIONS + case EShLangRayGenNV: + case EShLangIntersectNV: + case EShLangAnyHitNV: + case EShLangClosestHitNV: + case EShLangMissNV: + case EShLangCallableNV: + if (numShaderRecordNVBlocks > 1) + error(infoSink, "Only one shaderRecordNV buffer block is allowed per stage"); + break; + case EShLangMeshNV: + // NV_mesh_shader doesn't allow use of both single-view and per-view builtins. + if (inIoAccessed("gl_Position") && inIoAccessed("gl_PositionPerViewNV")) + error(infoSink, "Can only use one of gl_Position or gl_PositionPerViewNV"); + if (inIoAccessed("gl_ClipDistance") && inIoAccessed("gl_ClipDistancePerViewNV")) + error(infoSink, "Can only use one of gl_ClipDistance or gl_ClipDistancePerViewNV"); + if (inIoAccessed("gl_CullDistance") && inIoAccessed("gl_CullDistancePerViewNV")) + error(infoSink, "Can only use one of gl_CullDistance or gl_CullDistancePerViewNV"); + if (inIoAccessed("gl_Layer") && inIoAccessed("gl_LayerPerViewNV")) + error(infoSink, "Can only use one of gl_Layer or gl_LayerPerViewNV"); + if (inIoAccessed("gl_ViewportMask") && inIoAccessed("gl_ViewportMaskPerViewNV")) + error(infoSink, "Can only use one of gl_ViewportMask or gl_ViewportMaskPerViewNV"); + if (outputPrimitive == ElgNone) + error(infoSink, "At least one shader must specify an output layout primitive"); + if (vertices == TQualifier::layoutNotSet) + error(infoSink, "At least one shader must specify a layout(max_vertices = value)"); + if (primitives == TQualifier::layoutNotSet) + error(infoSink, "At least one shader must specify a layout(max_primitives = value)"); + // fall through + case EShLangTaskNV: + if (numTaskNVBlocks > 1) + error(infoSink, "Only one taskNV interface block is allowed per shader"); + break; +#endif + default: error(infoSink, "Unknown Stage."); break; @@ -510,7 +753,9 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled) virtual void visitSymbol(TIntermSymbol* symbol) { // Implicitly size arrays. - symbol->getWritableType().adoptImplicitArraySizes(); + // If an unsized array is left as unsized, it effectively + // becomes run-time sized. + symbol->getWritableType().adoptImplicitArraySizes(false); } } finalLinkTraverser; @@ -688,7 +933,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink) // TODO: linker functionality: location collision checking - TIntermSequence& linkObjects = findLinkerObjects(); + TIntermSequence& linkObjects = findLinkerObjects()->getSequence(); for (size_t i = 0; i < linkObjects.size(); ++i) { const TType& type = linkObjects[i]->getAsTyped()->getType(); const TQualifier& qualifier = type.getQualifier(); @@ -707,7 +952,7 @@ void TIntermediate::inOutLocationCheck(TInfoSink& infoSink) } } -TIntermSequence& TIntermediate::findLinkerObjects() const +TIntermAggregate* TIntermediate::findLinkerObjects() const { // Get the top-level globals TIntermSequence& globals = treeRoot->getAsAggregate()->getSequence(); @@ -715,7 +960,7 @@ TIntermSequence& TIntermediate::findLinkerObjects() const // Get the last member of the sequences, expected to be the linker-object lists assert(globals.back()->getAsAggregate()->getOp() == EOpLinkerObjects); - return globals.back()->getAsAggregate()->getSequence(); + return globals.back()->getAsAggregate(); } // See if a variable was both a user-declared output and used. @@ -723,7 +968,7 @@ TIntermSequence& TIntermediate::findLinkerObjects() const // is more useful, and perhaps the spec should be changed to reflect that. bool TIntermediate::userOutputUsed() const { - const TIntermSequence& linkerObjects = findLinkerObjects(); + const TIntermSequence& linkerObjects = findLinkerObjects()->getSequence(); bool found = false; for (size_t i = 0; i < linkerObjects.size(); ++i) { @@ -764,8 +1009,8 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ return -1; int size; - if (qualifier.isUniformOrBuffer()) { - if (type.isExplicitlySizedArray()) + if (qualifier.isUniformOrBuffer() || qualifier.isTaskMemory()) { + if (type.isSizedArray()) size = type.getCumulativeArraySize(); else size = 1; @@ -773,9 +1018,9 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ // Strip off the outer array dimension for those having an extra one. if (type.isArray() && qualifier.isArrayedIo(language)) { TType elementType(type, 0); - size = computeTypeLocationSize(elementType); + size = computeTypeLocationSize(elementType, language); } else - size = computeTypeLocationSize(type); + size = computeTypeLocationSize(type, language); } // Locations, and components within locations. @@ -836,8 +1081,8 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ // combine location and component ranges TIoRange range(locationRange, componentRange, type.getBasicType(), qualifier.hasIndex() ? qualifier.layoutIndex : 0); - // check for collisions, except for vertex inputs on desktop - if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput())) + // check for collisions, except for vertex inputs on desktop targeting OpenGL + if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput()) || spvVersion.vulkan > 0) collision = checkLocationRange(set, range, type, typeCollision); if (collision < 0) @@ -907,18 +1152,27 @@ bool TIntermediate::addUsedConstantId(int id) // Recursively figure out how many locations are used up by an input or output type. // Return the size of type, as measured by "locations". -int TIntermediate::computeTypeLocationSize(const TType& type) const +int TIntermediate::computeTypeLocationSize(const TType& type, EShLanguage stage) { // "If the declared input is an array of size n and each element takes m locations, it will be assigned m * n // consecutive locations..." if (type.isArray()) { // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness + // TODO: are there valid cases of having an unsized array with a location? If so, running this code too early. TType elementType(type, 0); - if (type.isImplicitlySizedArray()) { - // TODO: are there valid cases of having an implicitly-sized array with a location? If so, running this code too early. - return computeTypeLocationSize(elementType); - } else - return type.getOuterArraySize() * computeTypeLocationSize(elementType); + if (type.isSizedArray() +#ifdef NV_EXTENSIONS + && !type.getQualifier().isPerView() +#endif + ) + return type.getOuterArraySize() * computeTypeLocationSize(elementType, stage); + else { +#ifdef NV_EXTENSIONS + // unset perViewNV attributes for arrayed per-view outputs: "perviewNV vec4 v[MAX_VIEWS][3];" + elementType.getQualifier().perViewNV = false; +#endif + return computeTypeLocationSize(elementType, stage); + } } // "The locations consumed by block and structure members are determined by applying the rules above @@ -927,7 +1181,7 @@ int TIntermediate::computeTypeLocationSize(const TType& type) const int size = 0; for (int member = 0; member < (int)type.getStruct()->size(); ++member) { TType memberType(type, member); - size += computeTypeLocationSize(memberType); + size += computeTypeLocationSize(memberType, stage); } return size; } @@ -941,7 +1195,7 @@ int TIntermediate::computeTypeLocationSize(const TType& type) const if (type.isScalar()) return 1; if (type.isVector()) { - if (language == EShLangVertex && type.getQualifier().isPipeInput()) + if (stage == EShLangVertex && type.getQualifier().isPipeInput()) return 1; if (type.getBasicType() == EbtDouble && type.getVectorSize() > 2) return 2; @@ -954,13 +1208,44 @@ int TIntermediate::computeTypeLocationSize(const TType& type) const // for an n-element array of m-component vectors..." if (type.isMatrix()) { TType columnType(type, 0); - return type.getMatrixCols() * computeTypeLocationSize(columnType); + return type.getMatrixCols() * computeTypeLocationSize(columnType, stage); } assert(0); return 1; } +// Same as computeTypeLocationSize but for uniforms +int TIntermediate::computeTypeUniformLocationSize(const TType& type) +{ + // "Individual elements of a uniform array are assigned + // consecutive locations with the first element taking location + // location." + if (type.isArray()) { + // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness + TType elementType(type, 0); + if (type.isSizedArray()) { + return type.getOuterArraySize() * computeTypeUniformLocationSize(elementType); + } else { + // TODO: are there valid cases of having an implicitly-sized array with a location? If so, running this code too early. + return computeTypeUniformLocationSize(elementType); + } + } + + // "Each subsequent inner-most member or element gets incremental + // locations for the entire structure or array." + if (type.isStruct()) { + int size = 0; + for (int member = 0; member < (int)type.getStruct()->size(); ++member) { + TType memberType(type, member); + size += computeTypeUniformLocationSize(memberType); + } + return size; + } + + return 1; +} + // Accumulate xfb buffer ranges and check for collisions as the accumulation is done. // // Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value. @@ -1005,7 +1290,7 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains if (type.isArray()) { // TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness - assert(type.isExplicitlySizedArray()); + assert(type.isSizedArray()); TType elementType(type, 0); return type.getOuterArraySize() * computeTypeXfbSize(elementType, containsDouble); } @@ -1064,11 +1349,11 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) case EbtInt64: case EbtUint64: case EbtDouble: size = 8; return 8; -#ifdef AMD_EXTENSIONS - case EbtInt16: - case EbtUint16: case EbtFloat16: size = 2; return 2; -#endif + case EbtInt8: + case EbtUint8: size = 1; return 1; + case EbtInt16: + case EbtUint16: size = 2; return 2; default: size = 4; return 4; } } @@ -1087,10 +1372,11 @@ int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size) // stride comes from the flattening down to vectors. // // Return value is the alignment of the type. -int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, bool std140, bool rowMajor) +int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor) { int alignment; + bool std140 = layoutPacking == glslang::ElpStd140; // When using the std140 storage layout, structures will be laid out in buffer // storage with its members stored in monotonically increasing order based on their // location in the declaration. A structure and each structure member have a base @@ -1154,7 +1440,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b if (type.isArray()) { // TODO: perf: this might be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness TType derefType(type, 0); - alignment = getBaseAlignment(derefType, size, dummyStride, std140, rowMajor); + alignment = getBaseAlignment(derefType, size, dummyStride, layoutPacking, rowMajor); if (std140) alignment = std::max(baseAlignmentVec4Std140, alignment); RoundToPow2(size, alignment); @@ -1174,7 +1460,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b int memberSize; // modify just the children's view of matrix layout, if there is one for this member TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix; - int memberAlignment = getBaseAlignment(*memberList[m].type, memberSize, dummyStride, std140, + int memberAlignment = getBaseAlignment(*memberList[m].type, memberSize, dummyStride, layoutPacking, (subMatrixLayout != ElmNone) ? (subMatrixLayout == ElmRowMajor) : rowMajor); maxAlignment = std::max(maxAlignment, memberAlignment); RoundToPow2(size, memberAlignment); @@ -1197,6 +1483,8 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b if (type.isVector()) { int scalarAlign = getBaseAlignmentScalar(type, size); switch (type.getVectorSize()) { + case 1: // HLSL has this, GLSL does not + return scalarAlign; case 2: size *= 2; return 2 * scalarAlign; @@ -1211,7 +1499,7 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b // rule 5: deref to row, not to column, meaning the size of vector is num columns instead of num rows TType derefType(type, 0, rowMajor); - alignment = getBaseAlignment(derefType, size, dummyStride, std140, rowMajor); + alignment = getBaseAlignment(derefType, size, dummyStride, layoutPacking, rowMajor); if (std140) alignment = std::max(baseAlignmentVec4Std140, alignment); RoundToPow2(size, alignment); @@ -1239,4 +1527,79 @@ bool TIntermediate::improperStraddle(const TType& type, int size, int offset) : offset % 16 != 0; } +int TIntermediate::getScalarAlignment(const TType& type, int& size, int& stride, bool rowMajor) +{ + int alignment; + + stride = 0; + int dummyStride; + + if (type.isArray()) { + TType derefType(type, 0); + alignment = getScalarAlignment(derefType, size, dummyStride, rowMajor); + + stride = size; + RoundToPow2(stride, alignment); + + size = stride * (type.getOuterArraySize() - 1) + size; + return alignment; + } + + if (type.getBasicType() == EbtStruct) { + const TTypeList& memberList = *type.getStruct(); + + size = 0; + int maxAlignment = 0; + for (size_t m = 0; m < memberList.size(); ++m) { + int memberSize; + // modify just the children's view of matrix layout, if there is one for this member + TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix; + int memberAlignment = getScalarAlignment(*memberList[m].type, memberSize, dummyStride, + (subMatrixLayout != ElmNone) ? (subMatrixLayout == ElmRowMajor) : rowMajor); + maxAlignment = std::max(maxAlignment, memberAlignment); + RoundToPow2(size, memberAlignment); + size += memberSize; + } + + return maxAlignment; + } + + if (type.isScalar()) + return getBaseAlignmentScalar(type, size); + + if (type.isVector()) { + int scalarAlign = getBaseAlignmentScalar(type, size); + + size *= type.getVectorSize(); + return scalarAlign; + } + + if (type.isMatrix()) { + TType derefType(type, 0, rowMajor); + + alignment = getScalarAlignment(derefType, size, dummyStride, rowMajor); + + stride = size; // use intra-matrix stride for stride of a just a matrix + if (rowMajor) + size = stride * type.getMatrixRows(); + else + size = stride * type.getMatrixCols(); + + return alignment; + } + + assert(0); // all cases should be covered above + size = 1; + return 1; +} + +int TIntermediate::getMemberAlignment(const TType& type, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor) +{ + if (layoutPacking == glslang::ElpScalar) { + return getScalarAlignment(type, size, stride, rowMajor); + } else { + return getBaseAlignment(type, size, stride, layoutPacking, rowMajor); + } +} + } // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h index 062eb1b0895..ff28c0e35db 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2016 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -40,6 +41,8 @@ #include "../Public/ShaderLang.h" #include "Versions.h" +#include +#include #include #include #include @@ -78,7 +81,7 @@ public: assert(i < MaxSwizzleSelectors); return components[i]; } - + private: int size_; selectorType components[MaxSwizzleSelectors]; @@ -203,13 +206,24 @@ class TSymbolTable; class TSymbol; class TVariable; +#ifdef NV_EXTENSIONS +// +// Texture and Sampler transformation mode. +// +enum ComputeDerivativeMode { + LayoutDerivativeNone, // default layout as SPV_NV_compute_shader_derivatives not enabled + LayoutDerivativeGroupQuads, // derivative_group_quadsNV + LayoutDerivativeGroupLinear, // derivative_group_linearNV +}; +#endif + // // Set of helper functions to help parse and build the tree. // class TIntermediate { public: explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : - implicitThisName("@this"), + implicitThisName("@this"), implicitCounterName("@count"), language(l), source(EShSourceNone), profile(p), version(v), treeRoot(0), numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false), invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), @@ -217,20 +231,29 @@ public: pixelCenterInteger(false), originUpperLeft(false), vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false), + hlslFunctionality1(false), blendEquations(0), xfbMode(false), multiStream(false), #ifdef NV_EXTENSIONS layoutOverrideCoverage(false), geoPassthroughEXT(false), + numShaderRecordNVBlocks(0), + computeDerivativeMode(LayoutDerivativeNone), + primitives(TQualifier::layoutNotSet), + numTaskNVBlocks(0), #endif autoMapBindings(false), autoMapLocations(false), + invertY(false), flattenUniformArrays(false), useUnknownFormat(false), hlslOffsets(false), useStorageBuffer(false), + useVulkanMemoryModel(false), hlslIoMapping(false), textureSamplerTransformMode(EShTexSampTransKeep), - needToLegalize(false) + needToLegalize(false), + binaryDoubleOutput(false), + uniformLocationBase(0) { localSize[0] = 1; localSize[1] = 1; @@ -317,6 +340,14 @@ public: processes.addProcess("auto-map-locations"); } bool getAutoMapLocations() const { return autoMapLocations; } + void setInvertY(bool invert) + { + invertY = invert; + if (invertY) + processes.addProcess("invert-y"); + } + bool getInvertY() const { return invertY; } + void setFlattenUniformArrays(bool flatten) { flattenUniformArrays = flatten; @@ -337,7 +368,7 @@ public: if (hlslOffsets) processes.addProcess("hlsl-offsets"); } - bool usingHlslOFfsets() const { return hlslOffsets; } + bool usingHlslOffsets() const { return hlslOffsets; } void setUseStorageBuffer() { useStorageBuffer = true; @@ -351,6 +382,19 @@ public: processes.addProcess("hlsl-iomap"); } bool usingHlslIoMapping() { return hlslIoMapping; } + void setUseVulkanMemoryModel() + { + useVulkanMemoryModel = true; + processes.addProcess("use-vulkan-memory-model"); + } + bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; } + + template T addCounterBufferName(const T& name) const { return name + implicitCounterName; } + bool hasCounterBufferName(const TString& name) const { + size_t len = strlen(implicitCounterName); + return name.size() > len && + name.compare(name.size() - len, len, implicitCounterName) == 0; + } void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; } @@ -369,7 +413,7 @@ public: processes.addProcess("client opengl100"); // target-environment processes - if (spvVersion.vulkan == 100) + if (spvVersion.vulkan > 0) processes.addProcess("target-env vulkan1.0"); else if (spvVersion.vulkan > 0) processes.addProcess("target-env vulkanUnknown"); @@ -387,6 +431,11 @@ public: int getNumEntryPoints() const { return numEntryPoints; } int getNumErrors() const { return numErrors; } void addPushConstantCount() { ++numPushConstants; } +#ifdef NV_EXTENSIONS + void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; } + void addTaskNVCount() { ++numTaskNVBlocks; } +#endif + bool isRecursive() const { return recursive; } TIntermSymbol* addSymbol(const TVariable&); @@ -394,6 +443,7 @@ public: TIntermSymbol* addSymbol(const TType&, const TSourceLoc&); TIntermSymbol* addSymbol(const TIntermSymbol&); TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*) const; + std::tuple addConversion(TOperator op, TIntermTyped* node0, TIntermTyped* node1) const; TIntermTyped* addUniShapeConversion(TOperator, const TType&, TIntermTyped*); void addBiShapeConversion(TOperator, TIntermTyped*& lhsNode, TIntermTyped*& rhsNode); TIntermTyped* addShapeConversion(const TType&, TIntermTyped*); @@ -403,6 +453,11 @@ public: TIntermTyped* addUnaryMath(TOperator, TIntermTyped* child, TSourceLoc); TIntermTyped* addBuiltInFunctionCall(const TSourceLoc& line, TOperator, bool unary, TIntermNode*, const TType& returnType); bool canImplicitlyPromote(TBasicType from, TBasicType to, TOperator op = EOpNull) const; + bool isIntegralPromotion(TBasicType from, TBasicType to) const; + bool isFPPromotion(TBasicType from, TBasicType to) const; + bool isIntegralConversion(TBasicType from, TBasicType to) const; + bool isFPConversion(TBasicType from, TBasicType to) const; + bool isFPIntegralConversion(TBasicType from, TBasicType to) const; TOperator mapTypeToConstructorOp(const TType&) const; TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right); TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&); @@ -411,27 +466,27 @@ public: TIntermAggregate* makeAggregate(const TSourceLoc&); TIntermTyped* setAggregateOperator(TIntermNode*, TOperator, const TType& type, TSourceLoc); bool areAllChildConst(TIntermAggregate* aggrNode); - TIntermTyped* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&, TSelectionControl = ESelectionControlNone); - TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&, TSelectionControl = ESelectionControlNone); + TIntermSelection* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&); + TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&); TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); TIntermTyped* addMethod(TIntermTyped*, const TType&, const TString*, const TSourceLoc&); TIntermConstantUnion* addConstantUnion(const TConstUnionArray&, const TType&, const TSourceLoc&, bool literal = false) const; + TIntermConstantUnion* addConstantUnion(signed char, const TSourceLoc&, bool literal = false) const; + TIntermConstantUnion* addConstantUnion(unsigned char, const TSourceLoc&, bool literal = false) const; + TIntermConstantUnion* addConstantUnion(signed short, const TSourceLoc&, bool literal = false) const; + TIntermConstantUnion* addConstantUnion(unsigned short, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(int, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(unsigned int, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(long long, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(unsigned long long, const TSourceLoc&, bool literal = false) const; -#ifdef AMD_EXTENSIONS - TIntermConstantUnion* addConstantUnion(short, const TSourceLoc&, bool literal = false) const; - TIntermConstantUnion* addConstantUnion(unsigned short, const TSourceLoc&, bool literal = false) const; - -#endif TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const; TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const; bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false); - TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&, TLoopControl = ELoopControlNone); - TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&, TLoopControl = ELoopControlNone); + TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&); + TIntermAggregate* addForLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, + const TSourceLoc&, TIntermLoop*&); TIntermBranch* addBranch(TOperator, const TSourceLoc&); TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&); template TIntermTyped* addSwizzle(TSwizzleSelectors&, const TSourceLoc&); @@ -443,9 +498,6 @@ public: TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc) const; TIntermUnary* addUnaryNode(TOperator op, TIntermTyped* child, TSourceLoc, const TType&) const; - // Add conversion from node's type to given basic type. - TIntermTyped* convertToBasicType(TOperator op, TBasicType basicType, TIntermTyped* node) const; - // Constant folding (in Constant.cpp) TIntermTyped* fold(TIntermAggregate* aggrNode); TIntermTyped* foldConstructor(TIntermAggregate* aggrNode); @@ -551,6 +603,9 @@ public: void setDepthReplacing() { depthReplacing = true; } bool isDepthReplacing() const { return depthReplacing; } + void setHlslFunctionality1() { hlslFunctionality1 = true; } + bool getHlslFunctionality1() const { return hlslFunctionality1; } + void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); } unsigned int getBlendEquations() const { return blendEquations; } @@ -565,7 +620,8 @@ public: int checkLocationRange(int set, const TIoRange& range, const TType&, bool& typeCollision); int addUsedOffsets(int binding, int offset, int numOffsets); bool addUsedConstantId(int id); - int computeTypeLocationSize(const TType&) const; + static int computeTypeLocationSize(const TType&, EShLanguage); + static int computeTypeUniformLocationSize(const TType&); bool setXfbBufferStride(int buffer, unsigned stride) { @@ -574,10 +630,13 @@ public: xfbBuffers[buffer].stride = stride; return true; } + unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; } int addXfbBufferOffset(const TType&); unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const; static int getBaseAlignmentScalar(const TType&, int& size); - static int getBaseAlignment(const TType&, int& size, int& stride, bool std140, bool rowMajor); + static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); + static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor); + static int getMemberAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor); static bool improperStraddle(const TType& type, int size, int offset); bool promote(TIntermOperator*); @@ -586,6 +645,16 @@ public: bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; } void setGeoPassthroughEXT() { geoPassthroughEXT = true; } bool getGeoPassthroughEXT() const { return geoPassthroughEXT; } + void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; } + ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; } + bool setPrimitives(int m) + { + if (primitives != TQualifier::layoutNotSet) + return primitives == m; + primitives = m; + return true; + } + int getPrimitives() const { return primitives; } #endif const char* addSemanticName(const TString& name) @@ -593,11 +662,12 @@ public: return semanticNameSet.insert(name).first->c_str(); } - void setSourceFile(const char* file) { sourceFile = file; } + void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; } const std::string& getSourceFile() const { return sourceFile; } void addSourceText(const char* text) { sourceText = sourceText + text; } const std::string& getSourceText() const { return sourceText; } - void addProcesses(const std::vector& p) { + void addProcesses(const std::vector& p) + { for (int i = 0; i < (int)p.size(); ++i) processes.addProcess(p[i]); } @@ -605,15 +675,43 @@ public: void addProcessArgument(const std::string& arg) { processes.addArgument(arg); } const std::vector& getProcesses() const { return processes.getProcesses(); } + void addUniformLocationOverride(const char* nameStr, int location) + { + std::string name = nameStr; + uniformLocationOverrides[name] = location; + } + + int getUniformLocationOverride(const char* nameStr) const + { + std::string name = nameStr; + auto pos = uniformLocationOverrides.find(name); + if (pos == uniformLocationOverrides.end()) + return -1; + else + return pos->second; + } + + void setUniformLocationBase(int base) { uniformLocationBase = base; } + int getUniformLocationBase() const { return uniformLocationBase; } + void setNeedsLegalization() { needToLegalize = true; } bool needsLegalization() const { return needToLegalize; } + void setBinaryDoubleOutput() { binaryDoubleOutput = true; } + bool getBinaryDoubleOutput() { return binaryDoubleOutput; } + const char* const implicitThisName; + const char* const implicitCounterName; protected: TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TConstUnionArray&, TIntermTyped* subtree, const TSourceLoc&); void error(TInfoSink& infoSink, const char*); void warn(TInfoSink& infoSink, const char*); + void mergeCallGraphs(TInfoSink&, TIntermediate&); + void mergeModes(TInfoSink&, TIntermediate&); + void mergeTrees(TInfoSink&, TIntermediate&); + void seedIdMap(TMap& idMap, int& maxId); + void remapIds(const TMap& idMap, int idShift, TIntermediate&); void mergeBodies(TInfoSink&, TIntermSequence& globals, const TIntermSequence& unitGlobals); void mergeLinkerObjects(TInfoSink&, TIntermSequence& linkerObjects, const TIntermSequence& unitLinkerObjects); void mergeImplicitArraySizes(TType&, const TType&); @@ -621,9 +719,10 @@ protected: void checkCallGraphCycles(TInfoSink&); void checkCallGraphBodies(TInfoSink&, bool keepUncalled); void inOutLocationCheck(TInfoSink&); - TIntermSequence& findLinkerObjects() const; + TIntermAggregate* findLinkerObjects() const; bool userOutputUsed() const; bool isSpecializationOperation(const TIntermOperator&) const; + bool isNonuniformPropagating(TOperator) const; bool promoteUnary(TIntermUnary&); bool promoteBinary(TIntermBinary&); void addSymbolLinkageNode(TIntermAggregate*& linkage, TSymbolTable&, const TString&); @@ -632,15 +731,21 @@ protected: void pushSelector(TIntermSequence&, const TMatrixSelector&, const TSourceLoc&); bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&); void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root); + bool isConversionAllowed(TOperator op, TIntermTyped* node) const; + TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; + std::tuple getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const; + bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();} static const char* getResourceName(TResourceType); const EShLanguage language; // stage, known at construction time EShSource source; // source language, known a bit later std::string entryPointName; std::string entryPointMangledName; + typedef std::list TGraph; + TGraph callGraph; - EProfile profile; - int version; + EProfile profile; // source profile + int version; // source version SpvVersion spvVersion; TIntermNode* treeRoot; std::set requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them @@ -664,37 +769,41 @@ protected: bool postDepthCoverage; TLayoutDepth depthLayout; bool depthReplacing; + bool hlslFunctionality1; int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift bool xfbMode; + std::vector xfbBuffers; // all the data we need to track per xfb buffer bool multiStream; #ifdef NV_EXTENSIONS bool layoutOverrideCoverage; bool geoPassthroughEXT; + int numShaderRecordNVBlocks; + ComputeDerivativeMode computeDerivativeMode; + int primitives; + int numTaskNVBlocks; #endif // Base shift values std::array shiftBinding; // Per-descriptor-set shift values - std::array, EResCount> shiftBindingForSet; + std::array, EResCount> shiftBindingForSet; std::vector resourceSetBinding; bool autoMapBindings; bool autoMapLocations; + bool invertY; bool flattenUniformArrays; bool useUnknownFormat; bool hlslOffsets; bool useStorageBuffer; + bool useVulkanMemoryModel; bool hlslIoMapping; - typedef std::list TGraph; - TGraph callGraph; - std::set ioAccessed; // set of names of statically read/written I/O that might need extra checking std::vector usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers std::vector usedAtomics; // sets of bindings used by atomic counters - std::vector xfbBuffers; // all the data we need to track per xfb buffer std::unordered_set usedConstantId; // specialization constant ids used std::set semanticNameSet; @@ -708,6 +817,10 @@ protected: TProcesses processes; bool needToLegalize; + bool binaryDoubleOutput; + + std::unordered_map uniformLocationOverrides; + int uniformLocationBase; private: void operator=(TIntermediate&); // prevent assignments diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h index 5f26b4371d9..be468da5337 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/parseVersions.h @@ -1,5 +1,6 @@ // // Copyright (C) 2016 Google, Inc. +// Copyright (C) 2017 ARM Limited. // // All rights reserved. // @@ -77,17 +78,32 @@ public: virtual void updateExtensionBehavior(int line, const char* const extension, const char* behavior); virtual void fullIntegerCheck(const TSourceLoc&, const char* op); virtual void doubleCheck(const TSourceLoc&, const char* op); -#ifdef AMD_EXTENSIONS - virtual void int16Check(const TSourceLoc& loc, const char* op, bool builtIn = false); virtual void float16Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void float16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); + virtual bool float16Arithmetic(); + virtual void requireFloat16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); + virtual void int16ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); + virtual bool int16Arithmetic(); + virtual void requireInt16Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); + virtual void int8ScalarVectorCheck(const TSourceLoc&, const char* op, bool builtIn = false); + virtual bool int8Arithmetic(); + virtual void requireInt8Arithmetic(const TSourceLoc& loc, const char* op, const char* featureDesc); +#ifdef AMD_EXTENSIONS + virtual void float16OpaqueCheck(const TSourceLoc&, const char* op, bool builtIn = false); #endif virtual void int64Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void explicitInt8Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void explicitInt16Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void explicitInt32Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void explicitFloat32Check(const TSourceLoc&, const char* op, bool builtIn = false); + virtual void explicitFloat64Check(const TSourceLoc&, const char* op, bool builtIn = false); virtual void spvRemoved(const TSourceLoc&, const char* op); virtual void vulkanRemoved(const TSourceLoc&, const char* op); virtual void requireVulkan(const TSourceLoc&, const char* op); virtual void requireSpv(const TSourceLoc&, const char* op); virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc); virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior); + virtual void checkExtensionStage(const TSourceLoc&, const char* const extension); virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken, const char* szExtraInfoFormat, ...) = 0; @@ -113,6 +129,7 @@ public: bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; } bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; } bool isReadingHLSL() const { return (messages & EShMsgReadHlsl) == EShMsgReadHlsl; } + bool hlslEnable16BitTypes() const { return (messages & EShMsgHlslEnable16BitTypes) != 0; } TInfoSink& infoSink; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/pch.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/pch.cpp new file mode 100644 index 00000000000..b7a08654a54 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/pch.cpp @@ -0,0 +1,35 @@ +// +// Copyright (C) 2018 The Khronos Group Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "pch.h" diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/pch.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/pch.h new file mode 100644 index 00000000000..6ea3761ea1a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/pch.h @@ -0,0 +1,49 @@ +#ifndef _PCH_H +#define _PCH_H +// +// Copyright (C) 2018 The Khronos Group Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +#include +#include +#include +#include +#include +#include +#include +#include +#include "SymbolTable.h" +#include "ParseHelper.h" +#include "Scan.h" +#include "ScanContext.h" + +#endif /* _PCH_H */ diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index 3ae711c86c1..2000b777483 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -109,11 +109,12 @@ int TPpContext::CPPdefine(TPpToken* ppToken) // save the macro name const int defAtom = atomStrings.getAddAtom(ppToken->name); + TSourceLoc defineLoc = ppToken->loc; // because ppToken might go to the next line before we report errors // gather parameters to the macro, between (...) token = scanToken(ppToken); - if (token == '(' && ! ppToken->space) { - mac.emptyArgs = 1; + if (token == '(' && !ppToken->space) { + mac.functionLike = 1; do { token = scanToken(ppToken); if (mac.args.size() == 0 && token == ')') @@ -123,7 +124,6 @@ int TPpContext::CPPdefine(TPpToken* ppToken) return token; } - mac.emptyArgs = 0; const int argAtom = atomStrings.getAddAtom(ppToken->name); // check for duplication of parameter name @@ -149,7 +149,6 @@ int TPpContext::CPPdefine(TPpToken* ppToken) } // record the definition of the macro - TSourceLoc defineLoc = ppToken->loc; // because ppToken is going to go to the next line before we report errors while (token != '\n' && token != EndOfInput) { mac.body.putToken(token, ppToken); token = scanToken(ppToken); @@ -164,7 +163,9 @@ int TPpContext::CPPdefine(TPpToken* ppToken) // Already defined -- need to make sure they are identical: // "Two replacement lists are identical if and only if the preprocessing tokens in both have the same number, // ordering, spelling, and white-space separation, where all white-space separations are considered identical." - if (existing->args.size() != mac.args.size() || existing->emptyArgs != mac.emptyArgs) + if (existing->functionLike != mac.functionLike) + parseContext.ppError(defineLoc, "Macro redefined; function-like versus object-like:", "#define", atomStrings.getString(defAtom)); + else if (existing->args.size() != mac.args.size()) parseContext.ppError(defineLoc, "Macro redefined; different number of arguments:", "#define", atomStrings.getString(defAtom)); else { if (existing->args != mac.args) @@ -515,15 +516,16 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken* ppToken) { while (token == PpAtomIdentifier && strcmp("defined", ppToken->name) != 0) { - int macroReturn = MacroExpand(ppToken, true, false); - if (macroReturn == 0) { + switch (MacroExpand(ppToken, true, false)) { + case MacroExpandNotStarted: + case MacroExpandError: parseContext.ppError(ppToken->loc, "can't evaluate expression", "preprocessor evaluation", ""); err = true; res = 0; - token = scanToken(ppToken); break; - } - if (macroReturn == -1) { + case MacroExpandStarted: + break; + case MacroExpandUndef: if (! shortCircuit && parseContext.profile == EEsProfile) { const char* message = "undefined macro in expression not allowed in es profile"; if (parseContext.relaxedErrors()) @@ -531,8 +533,11 @@ int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, T else parseContext.ppError(ppToken->loc, message, "preprocessor evaluation", ppToken->name); } + break; } token = scanToken(ppToken); + if (err) + break; } return token; @@ -731,12 +736,10 @@ int TPpContext::CPPerror(TPpToken* ppToken) TSourceLoc loc = ppToken->loc; while (token != '\n' && token != EndOfInput) { - if (token == PpAtomConstInt || token == PpAtomConstUint || + if (token == PpAtomConstInt16 || token == PpAtomConstUint16 || + token == PpAtomConstInt || token == PpAtomConstUint || token == PpAtomConstInt64 || token == PpAtomConstUint64 || -#ifdef AMD_EXTENSIONS - token == PpAtomConstInt16 || token == PpAtomConstUint16 || token == PpAtomConstFloat16 || -#endif token == PpAtomConstFloat || token == PpAtomConstDouble) { message.append(ppToken->name); } else if (token == PpAtomIdentifier || token == PpAtomConstString) { @@ -775,9 +778,7 @@ int TPpContext::CPPpragma(TPpToken* ppToken) #endif case PpAtomConstFloat: case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS case PpAtomConstFloat16: -#endif tokens.push_back(ppToken->name); break; default: @@ -1015,15 +1016,25 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream& arg, TPpToken* int token; while ((token = scanToken(ppToken)) != tMarkerInput::marker && token != EndOfInput) { token = tokenPaste(token, *ppToken); + if (token == PpAtomIdentifier) { + switch (MacroExpand(ppToken, false, newLineOkay)) { + case MacroExpandNotStarted: + break; + case MacroExpandError: + token = EndOfInput; + break; + case MacroExpandStarted: + case MacroExpandUndef: + continue; + } + } if (token == tMarkerInput::marker || token == EndOfInput) break; - if (token == PpAtomIdentifier && MacroExpand(ppToken, false, newLineOkay) != 0) - continue; expandedArg->putToken(token, ppToken); } if (token == EndOfInput) { - // MacroExpand ate the marker, so had bad input, recover + // Error, or MacroExpand ate the marker, so had bad input, recover delete expandedArg; expandedArg = nullptr; } else { @@ -1119,14 +1130,18 @@ int TPpContext::tZeroInput::scan(TPpToken* ppToken) } // -// Check a token to see if it is a macro that should be expanded. -// If it is, and defined, push a tInput that will produce the appropriate expansion -// and return 1. -// If it is, but undefined, and expandUndef is requested, push a tInput that will -// expand to 0 and return -1. -// Otherwise, return 0 to indicate no expansion, which is not necessarily an error. +// Check a token to see if it is a macro that should be expanded: +// - If it is, and defined, push a tInput that will produce the appropriate +// expansion and return MacroExpandStarted. +// - If it is, but undefined, and expandUndef is requested, push a tInput +// that will expand to 0 and return MacroExpandUndef. +// - Otherwise, there is no expansion, and there are two cases: +// * It might be okay there is no expansion, and no specific error was +// detected. Returns MacroExpandNotStarted. +// * The expansion was started, but could not be completed, due to an error +// that cannot be recovered from. Returns MacroExpandError. // -int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay) +MacroExpandResult TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay) { ppToken->space = false; int macroAtom = atomStrings.getAtom(ppToken->name); @@ -1135,7 +1150,7 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka ppToken->ival = parseContext.getCurrentLoc().line; snprintf(ppToken->name, sizeof(ppToken->name), "%d", ppToken->ival); UngetToken(PpAtomConstInt, ppToken); - return 1; + return MacroExpandStarted; case PpAtomFileMacro: { if (parseContext.getCurrentLoc().name) @@ -1143,50 +1158,55 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka ppToken->ival = parseContext.getCurrentLoc().string; snprintf(ppToken->name, sizeof(ppToken->name), "%s", ppToken->loc.getStringNameOrNum().c_str()); UngetToken(PpAtomConstInt, ppToken); - return 1; + return MacroExpandStarted; } case PpAtomVersionMacro: ppToken->ival = parseContext.version; snprintf(ppToken->name, sizeof(ppToken->name), "%d", ppToken->ival); UngetToken(PpAtomConstInt, ppToken); - return 1; + return MacroExpandStarted; default: break; } MacroSymbol* macro = macroAtom == 0 ? nullptr : lookupMacroDef(macroAtom); - int depth = 0; // no recursive expansions if (macro != nullptr && macro->busy) - return 0; + return MacroExpandNotStarted; // not expanding undefined macros if ((macro == nullptr || macro->undef) && ! expandUndef) - return 0; + return MacroExpandNotStarted; // 0 is the value of an undefined macro if ((macro == nullptr || macro->undef) && expandUndef) { pushInput(new tZeroInput(this)); - return -1; + return MacroExpandUndef; } tMacroInput *in = new tMacroInput(this); TSourceLoc loc = ppToken->loc; // in case we go to the next line before discovering the error in->mac = macro; - if (macro->args.size() > 0 || macro->emptyArgs) { - int token = scanToken(ppToken); + if (macro->functionLike) { + // We don't know yet if this will be a successful call of a + // function-like macro; need to look for a '(', but without trashing + // the passed in ppToken, until we know we are no longer speculative. + TPpToken parenToken; + int token = scanToken(&parenToken); if (newLineOkay) { while (token == '\n') - token = scanToken(ppToken); + token = scanToken(&parenToken); } if (token != '(') { - UngetToken(token, ppToken); + // Function-like macro called with object-like syntax: okay, don't expand. + // (We ate exactly one token that might not be white space; put it back. + UngetToken(token, &parenToken); delete in; - return 0; + return MacroExpandNotStarted; } in->args.resize(in->mac->args.size()); for (size_t i = 0; i < in->mac->args.size(); i++) @@ -1197,39 +1217,44 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka size_t arg = 0; bool tokenRecorded = false; do { - depth = 0; - while (1) { + TVector nestStack; + while (true) { token = scanToken(ppToken); if (token == EndOfInput || token == tMarkerInput::marker) { parseContext.ppError(loc, "End of input in macro", "macro expansion", atomStrings.getString(macroAtom)); delete in; - return 0; + return MacroExpandError; } if (token == '\n') { if (! newLineOkay) { parseContext.ppError(loc, "End of line in macro substitution:", "macro expansion", atomStrings.getString(macroAtom)); delete in; - return 0; + return MacroExpandError; } continue; } if (token == '#') { parseContext.ppError(ppToken->loc, "unexpected '#'", "macro expansion", atomStrings.getString(macroAtom)); delete in; - return 0; + return MacroExpandError; } if (in->mac->args.size() == 0 && token != ')') break; - if (depth == 0 && (token == ',' || token == ')')) + if (nestStack.size() == 0 && (token == ',' || token == ')')) break; if (token == '(') - depth++; - if (token == ')') - depth--; + nestStack.push_back(')'); + else if (token == '{' && parseContext.isReadingHLSL()) + nestStack.push_back('}'); + else if (nestStack.size() > 0 && token == nestStack.back()) + nestStack.pop_back(); in->args[arg]->putToken(token, ppToken); tokenRecorded = true; } + // end of single argument scan + if (token == ')') { + // closing paren of call if (in->mac->args.size() == 1 && tokenRecorded == 0) break; arg++; @@ -1237,23 +1262,25 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka } arg++; } while (arg < in->mac->args.size()); + // end of all arguments scan if (arg < in->mac->args.size()) parseContext.ppError(loc, "Too few args in Macro", "macro expansion", atomStrings.getString(macroAtom)); else if (token != ')') { - depth=0; + // Error recover code; find end of call, if possible + int depth = 0; while (token != EndOfInput && (depth > 0 || token != ')')) { - if (token == ')') + if (token == ')' || token == '}') depth--; token = scanToken(ppToken); - if (token == '(') + if (token == '(' || token == '{') depth++; } if (token == EndOfInput) { parseContext.ppError(loc, "End of input in macro", "macro expansion", atomStrings.getString(macroAtom)); delete in; - return 0; + return MacroExpandError; } parseContext.ppError(loc, "Too many args in macro", "macro expansion", atomStrings.getString(macroAtom)); } @@ -1268,7 +1295,7 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka macro->busy = 1; macro->body.reset(); - return 1; + return MacroExpandStarted; } } // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp index 6a2e05fefa4..c89b37688ac 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp @@ -77,6 +77,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \****************************************************************************/ #include +#include #include "PpContext.h" @@ -91,6 +92,8 @@ TPpContext::TPpContext(TParseContextBase& pc, const std::string& rootFileName, T for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++) elseSeen[elsetracker] = false; elsetracker = 0; + + strtodStream.imbue(std::locale::classic()); } TPpContext::~TPpContext() diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h index 854bbbad206..64681fc3312 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h @@ -80,6 +80,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include #include "../ParseHelper.h" @@ -92,13 +93,16 @@ namespace glslang { class TPpToken { public: - TPpToken() : space(false), i64val(0) + TPpToken() { clear(); } + void clear() { + space = false; + i64val = 0; loc.init(); name[0] = 0; } - // This is used for comparing macro definitions, so checks what is relevant for that. + // Used for comparing macro definitions, so checks what is relevant for that. bool operator==(const TPpToken& right) { return space == right.space && @@ -108,15 +112,17 @@ public: bool operator!=(const TPpToken& right) { return ! operator==(right); } TSourceLoc loc; - bool space; // true if a space (for white space or a removed comment) should also be recognized, in front of the token returned - + // True if a space (for white space or a removed comment) should also be + // recognized, in front of the token returned: + bool space; + // Numeric value of the token: union { int ival; double dval; long long i64val; }; - - char name[MaxTokenLength + 1]; + // Text string of the token: + char name[MaxTokenLength + 1]; }; class TStringAtomMap { @@ -177,6 +183,13 @@ protected: class TInputScanner; +enum MacroExpandResult { + MacroExpandNotStarted, // macro not expanded, which might not be an error + MacroExpandError, // a clear error occurred while expanding, no expansion + MacroExpandStarted, // macro expansion process has started + MacroExpandUndef // macro is undefined and will be expanded +}; + // This class is the result of turning a huge pile of C code communicating through globals // into a class. This was done to allowing instancing to attain thread safety. // Don't expect too much in terms of OO design. @@ -254,12 +267,12 @@ public: // struct MacroSymbol { - MacroSymbol() : emptyArgs(0), busy(0), undef(0) { } + MacroSymbol() : functionLike(0), busy(0), undef(0) { } TVector args; TokenStream body; - unsigned emptyArgs : 1; - unsigned busy : 1; - unsigned undef : 1; + unsigned functionLike : 1; // 0 means object-like, 1 means function-like + unsigned busy : 1; + unsigned undef : 1; }; typedef TMap TSymbolMap; @@ -394,7 +407,7 @@ protected: int readCPPline(TPpToken * ppToken); int scanHeaderName(TPpToken* ppToken, char delimit); TokenStream* PrescanMacroArg(TokenStream&, TPpToken*, bool newLineOkay); - int MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay); + MacroExpandResult MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay); // // From PpTokens.cpp @@ -615,6 +628,8 @@ protected: std::string rootFileName; std::stack includeStack; std::string currentSourceFile; + + std::istringstream strtodStream; }; } // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index b58bbeeab9d..1faa01803af 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -1,6 +1,7 @@ // // Copyright (C) 2002-2005 3Dlabs Inc. Ltd. // Copyright (C) 2013 LunarG, Inc. +// Copyright (C) 2017 ARM Limited. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -101,34 +102,39 @@ namespace glslang { int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) { - bool HasDecimalOrExponent = false; - int isDouble = 0; - bool generateFloat16 = false; - bool acceptFloat16 = parseContext.intermediate.getSource() == EShSourceHlsl; - bool isFloat16 = false; - bool requireHF = false; -#ifdef AMD_EXTENSIONS - if (parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float)) { - acceptFloat16 = true; - generateFloat16 = true; - requireHF = true; - } -#endif - const auto saveName = [&](int ch) { if (len <= MaxTokenLength) ppToken->name[len++] = static_cast(ch); }; - // Decimal: + // find the range of non-zero digits before the decimal point + int startNonZero = 0; + while (startNonZero < len && ppToken->name[startNonZero] == '0') + ++startNonZero; + int endNonZero = len; + while (endNonZero > startNonZero && ppToken->name[endNonZero-1] == '0') + --endNonZero; + int numWholeNumberDigits = endNonZero - startNonZero; + // accumulate the range's value + bool fastPath = numWholeNumberDigits <= 15; // when the number gets too complex, set to false + unsigned long long wholeNumber = 0; + if (fastPath) { + for (int i = startNonZero; i < endNonZero; ++i) + wholeNumber = wholeNumber * 10 + (ppToken->name[i] - '0'); + } + int decimalShift = len - endNonZero; + + // Decimal point: + bool hasDecimalOrExponent = false; if (ch == '.') { - HasDecimalOrExponent = true; + hasDecimalOrExponent = true; saveName(ch); ch = getChar(); + int firstDecimal = len; // 1.#INF or -1.#INF - if (parseContext.intermediate.getSource() == EShSourceHlsl && ch == '#') { + if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) { if ((len < 2) || (len == 2 && ppToken->name[0] != '1') || (len == 3 && ppToken->name[1] != '1' && !(ppToken->name[0] == '-' || ppToken->name[0] == '+')) || @@ -155,55 +161,99 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) } } - while (ch >= '0' && ch <= '9') { + // Consume leading-zero digits after the decimal point + while (ch == '0') { saveName(ch); ch = getChar(); } + int startNonZeroDecimal = len; + int endNonZeroDecimal = len; + + // Consume remaining digits, up to the exponent + while (ch >= '0' && ch <= '9') { + saveName(ch); + if (ch != '0') + endNonZeroDecimal = len; + ch = getChar(); + } + + // Compute accumulation up to the last non-zero digit + if (endNonZeroDecimal > startNonZeroDecimal) { + numWholeNumberDigits += endNonZeroDecimal - endNonZero - 1; // don't include the "." + if (numWholeNumberDigits > 15) + fastPath = false; + if (fastPath) { + for (int i = endNonZero; i < endNonZeroDecimal; ++i) { + if (ppToken->name[i] != '.') + wholeNumber = wholeNumber * 10 + (ppToken->name[i] - '0'); + } + } + decimalShift = firstDecimal - endNonZeroDecimal; + } } // Exponent: - - if (ch == 'e' || ch == 'E') { - HasDecimalOrExponent = true; - saveName(ch); - ch = getChar(); - if (ch == '+' || ch == '-') { + bool negativeExponent = false; + double exponentValue = 0.0; + int exponent = 0; + { + if (ch == 'e' || ch == 'E') { + hasDecimalOrExponent = true; saveName(ch); ch = getChar(); - } - if (ch >= '0' && ch <= '9') { - while (ch >= '0' && ch <= '9') { + if (ch == '+' || ch == '-') { + negativeExponent = ch == '-'; saveName(ch); ch = getChar(); } - } else { - parseContext.ppError(ppToken->loc, "bad character in float exponent", "", ""); + if (ch >= '0' && ch <= '9') { + while (ch >= '0' && ch <= '9') { + exponent = exponent * 10 + (ch - '0'); + saveName(ch); + ch = getChar(); + } + } else { + parseContext.ppError(ppToken->loc, "bad character in float exponent", "", ""); + } + } + + // Compensate for location of decimal + if (negativeExponent) + exponent -= decimalShift; + else { + exponent += decimalShift; + if (exponent < 0) { + negativeExponent = true; + exponent = -exponent; + } + } + if (exponent > 22) + fastPath = false; + + if (fastPath) { + // Compute the floating-point value of the exponent + exponentValue = 1.0; + if (exponent > 0) { + double expFactor = 10; + while (exponent > 0) { + if (exponent & 0x1) + exponentValue *= expFactor; + expFactor *= expFactor; + exponent >>= 1; + } + } } } // Suffix: - + bool isDouble = false; + bool isFloat16 = false; if (ch == 'l' || ch == 'L') { - parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); - if (! HasDecimalOrExponent) + if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl) + parseContext.doubleCheck(ppToken->loc, "double floating-point suffix"); + if (ifdepth == 0 && !hasDecimalOrExponent) parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); - int ch2 = getChar(); - if (ch2 != 'f' && ch2 != 'F') { - ungetChar(); - ungetChar(); - } else { - saveName(ch); - saveName(ch2); - isDouble = 1; - } - } else if (acceptFloat16 && (ch == 'h' || ch == 'H')) { -#ifdef AMD_EXTENSIONS - if (generateFloat16) - parseContext.float16Check(ppToken->loc, "half floating-point suffix"); -#endif - if (!HasDecimalOrExponent) - parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); - if (requireHF) { + if (parseContext.intermediate.getSource() == EShSourceGlsl) { int ch2 = getChar(); if (ch2 != 'f' && ch2 != 'F') { ungetChar(); @@ -211,23 +261,43 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) } else { saveName(ch); saveName(ch2); - isFloat16 = generateFloat16; + isDouble = true; } - } else { + } else if (parseContext.intermediate.getSource() == EShSourceHlsl) { saveName(ch); - isFloat16 = generateFloat16; + isDouble = true; + } + } else if (ch == 'h' || ch == 'H') { + if (ifdepth == 0 && parseContext.intermediate.getSource() == EShSourceGlsl) + parseContext.float16Check(ppToken->loc, "half floating-point suffix"); + if (ifdepth == 0 && !hasDecimalOrExponent) + parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); + if (parseContext.intermediate.getSource() == EShSourceGlsl) { + int ch2 = getChar(); + if (ch2 != 'f' && ch2 != 'F') { + ungetChar(); + ungetChar(); + } else { + saveName(ch); + saveName(ch2); + isFloat16 = true; + } + } else if (parseContext.intermediate.getSource() == EShSourceHlsl) { + saveName(ch); + isFloat16 = true; } } else if (ch == 'f' || ch == 'F') { - parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); - if (! parseContext.relaxedErrors()) + if (ifdepth == 0) + parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix"); + if (ifdepth == 0 && !parseContext.relaxedErrors()) parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix"); - if (! HasDecimalOrExponent) + if (ifdepth == 0 && !hasDecimalOrExponent) parseContext.ppError(ppToken->loc, "float literal needs a decimal point or exponent", "", ""); saveName(ch); } else ungetChar(); - // Patch up the name, length, etc. + // Patch up the name and length for overflow if (len > MaxTokenLength) { len = MaxTokenLength; @@ -235,8 +305,45 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken) } ppToken->name[len] = '\0'; - // Get the numerical value - ppToken->dval = strtod(ppToken->name, nullptr); + // Compute the numerical value + if (fastPath) { + // compute the floating-point value of the exponent + if (exponentValue == 0.0) + ppToken->dval = (double)wholeNumber; + else if (negativeExponent) + ppToken->dval = (double)wholeNumber / exponentValue; + else + ppToken->dval = (double)wholeNumber * exponentValue; + } else { + // slow path + ppToken->dval = 0.0; + + // remove suffix + TString numstr(ppToken->name); + if (numstr.back() == 'f' || numstr.back() == 'F') + numstr.pop_back(); + if (numstr.back() == 'h' || numstr.back() == 'H') + numstr.pop_back(); + if (numstr.back() == 'l' || numstr.back() == 'L') + numstr.pop_back(); + + // use platform library + strtodStream.clear(); + strtodStream.str(numstr.c_str()); + strtodStream >> ppToken->dval; + if (strtodStream.fail()) { + // Assume failure combined with a large exponent was overflow, in + // an attempt to set INF. + if (!negativeExponent && exponent + numWholeNumberDigits > 300) + ppToken->i64val = 0x7ff0000000000000; // +Infinity + // Assume failure combined with a small exponent was overflow. + if (negativeExponent && exponent + numWholeNumberDigits > 300) + ppToken->dval = 0.0; + // Unknown reason for failure. Theory is that either + // - the 0.0 is still there, or + // - something reasonable was written that is better than 0.0 + } + } // Return the right token type if (isDouble) @@ -333,19 +440,23 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) int ch = 0; int ii = 0; unsigned long long ival = 0; - bool enableInt64 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_ARB_gpu_shader_int64); -#ifdef AMD_EXTENSIONS - bool enableInt16 = pp->parseContext.version >= 450 && pp->parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_int16); -#endif - bool acceptHalf = pp->parseContext.intermediate.getSource() == EShSourceHlsl; -#ifdef AMD_EXTENSIONS - if (pp->parseContext.extensionTurnedOn(E_GL_AMD_gpu_shader_half_float)) - acceptHalf = true; -#endif - const auto floatingPointChar = [&](int ch) { return ch == '.' || ch == 'e' || ch == 'E' || ch == 'f' || ch == 'F' || - (acceptHalf && (ch == 'h' || ch == 'H')); }; + ch == 'h' || ch == 'H'; }; + + static const char* const Int64_Extensions[] = { + E_GL_ARB_gpu_shader_int64, + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int64 }; + static const int Num_Int64_Extensions = sizeof(Int64_Extensions) / sizeof(Int64_Extensions[0]); + + static const char* const Int16_Extensions[] = { +#ifdef AMD_EXTENSIONS + E_GL_AMD_gpu_shader_int16, +#endif + E_GL_KHX_shader_explicit_arithmetic_types, + E_GL_KHX_shader_explicit_arithmetic_types_int16 }; + static const int Num_Int16_Extensions = sizeof(Int16_Extensions) / sizeof(Int16_Extensions[0]); ppToken->ival = 0; ppToken->i64val = 0; @@ -409,9 +520,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) bool isUnsigned = false; bool isInt64 = false; -#ifdef AMD_EXTENSIONS bool isInt16 = false; -#endif ppToken->name[len++] = (char)ch; ch = getch(); if ((ch >= '0' && ch <= '9') || @@ -420,7 +529,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ival = 0; do { - if (len < MaxTokenLength && (ival <= 0x0fffffffu || (enableInt64 && ival <= 0x0fffffffffffffffull))) { + if (len < MaxTokenLength && ival <= 0x0fffffffffffffffull) { ppToken->name[len++] = (char)ch; if (ch >= '0' && ch <= '9') { ii = ch - '0'; @@ -453,33 +562,31 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; - if (enableInt64) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt64 = true; - } else - ungetch(); - } + int nextCh = getch(); + if (nextCh == 'l' || nextCh == 'L') { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); #ifdef AMD_EXTENSIONS - if (enableInt16) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt16 = true; - } else - ungetch(); - } + nextCh = getch(); + if ((nextCh == 's' || nextCh == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt16 = true; + } else + ungetch(); #endif - } else if (enableInt64 && (ch == 'l' || ch == 'L')) { + } else if (ch == 'l' || ch == 'L') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt64 = true; #ifdef AMD_EXTENSIONS - } else if (enableInt16 && (ch == 's' || ch == 'S')) { + } else if ((ch == 's' || ch == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt16 = true; @@ -488,15 +595,29 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ungetch(); ppToken->name[len] = '\0'; - if (isInt64) { + if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (pp->ifdepth == 0) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "64-bit hexadecimal literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int64_Extensions, Int64_Extensions, "64-bit hexadecimal literal"); + } ppToken->i64val = ival; return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; -#ifdef AMD_EXTENSIONS } else if (isInt16) { + if (pp->ifdepth == 0) { + if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "16-bit hexadecimal literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int16_Extensions, Int16_Extensions, "16-bit hexadecimal literal"); + } + } ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; -#endif } else { + if (ival > 0xffffffffu && !AlreadyComplained) + pp->parseContext.ppError(ppToken->loc, "hexadecimal literal too big", "", ""); ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint : PpAtomConstInt; } @@ -505,9 +626,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) bool isUnsigned = false; bool isInt64 = false; -#ifdef AMD_EXTENSIONS bool isInt16 = false; -#endif bool octalOverflow = false; bool nonOctal = false; ival = 0; @@ -520,7 +639,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) pp->parseContext.ppError(ppToken->loc, "numeric literal too long", "", ""); AlreadyComplained = 1; } - if (ival <= 0x1fffffffu || (enableInt64 && ival <= 0x1fffffffffffffffull)) { + if (ival <= 0x1fffffffffffffffull) { ii = ch - '0'; ival = (ival << 3) | ii; } else @@ -553,33 +672,31 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ppToken->name[len++] = (char)ch; isUnsigned = true; - if (enableInt64) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt64 = true; - } else - ungetch(); - } + int nextCh = getch(); + if (nextCh == 'l' || nextCh == 'L') { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); #ifdef AMD_EXTENSIONS - if (enableInt16) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt16 = true; - } else - ungetch(); - } + nextCh = getch(); + if ((nextCh == 's' || nextCh == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt16 = true; + } else + ungetch(); #endif - } else if (enableInt64 && (ch == 'l' || ch == 'L')) { + } else if (ch == 'l' || ch == 'L') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt64 = true; #ifdef AMD_EXTENSIONS - } else if (enableInt16 && (ch == 's' || ch == 'S')) { + } else if ((ch == 's' || ch == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt16 = true; @@ -588,17 +705,32 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ungetch(); ppToken->name[len] = '\0'; + if (!isInt64 && ival > 0xffffffffu) + octalOverflow = true; + if (octalOverflow) pp->parseContext.ppError(ppToken->loc, "octal literal too big", "", ""); - if (isInt64) { + if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (pp->ifdepth == 0) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "64-bit octal literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int64_Extensions, Int64_Extensions, "64-bit octal literal"); + } ppToken->i64val = ival; return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; -#ifdef AMD_EXTENSIONS } else if (isInt16) { + if (pp->ifdepth == 0) { + if (pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "16-bit octal literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int16_Extensions, Int16_Extensions, "16-bit octal literal"); + } + } ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; -#endif } else { ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint : PpAtomConstInt; @@ -625,41 +757,37 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) int numericLen = len; bool isUnsigned = false; bool isInt64 = false; -#ifdef AMD_EXTENSIONS bool isInt16 = false; -#endif if (ch == 'u' || ch == 'U') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isUnsigned = true; - if (enableInt64) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 'l') || (ch == 'U' && nextCh == 'L')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt64 = true; - } else - ungetch(); - } + int nextCh = getch(); + if (nextCh == 'l' || nextCh == 'L') { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt64 = true; + } else + ungetch(); #ifdef AMD_EXTENSIONS - if (enableInt16) { - int nextCh = getch(); - if ((ch == 'u' && nextCh == 's') || (ch == 'U' && nextCh == 'S')) { - if (len < MaxTokenLength) - ppToken->name[len++] = (char)nextCh; - isInt16 = true; - } else - ungetch(); - } + nextCh = getch(); + if ((nextCh == 's' || nextCh == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (len < MaxTokenLength) + ppToken->name[len++] = (char)nextCh; + isInt16 = true; + } else + ungetch(); #endif - } else if (enableInt64 && (ch == 'l' || ch == 'L')) { + } else if (ch == 'l' || ch == 'L') { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt64 = true; #ifdef AMD_EXTENSIONS - } else if (enableInt16 && (ch == 's' || ch == 'S')) { + } else if ((ch == 's' || ch == 'S') && + pp->parseContext.intermediate.getSource() == EShSourceGlsl) { if (len < MaxTokenLength) ppToken->name[len++] = (char)ch; isInt16 = true; @@ -673,19 +801,15 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) const unsigned remainderMaxInt = 0xFFFFFFFFu - 10 * oneTenthMaxInt; const unsigned long long oneTenthMaxInt64 = 0xFFFFFFFFFFFFFFFFull / 10; const unsigned long long remainderMaxInt64 = 0xFFFFFFFFFFFFFFFFull - 10 * oneTenthMaxInt64; -#ifdef AMD_EXTENSIONS const unsigned short oneTenthMaxInt16 = 0xFFFFu / 10; const unsigned short remainderMaxInt16 = 0xFFFFu - 10 * oneTenthMaxInt16; -#endif for (int i = 0; i < numericLen; i++) { ch = ppToken->name[i] - '0'; bool overflow = false; if (isInt64) overflow = (ival > oneTenthMaxInt64 || (ival == oneTenthMaxInt64 && (unsigned long long)ch > remainderMaxInt64)); -#ifdef AMD_EXTENSIONS else if (isInt16) overflow = (ival > oneTenthMaxInt16 || (ival == oneTenthMaxInt16 && (unsigned short)ch > remainderMaxInt16)); -#endif else overflow = (ival > oneTenthMaxInt || (ival == oneTenthMaxInt && (unsigned)ch > remainderMaxInt)); if (overflow) { @@ -696,14 +820,24 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken) ival = ival * 10 + ch; } - if (isInt64) { + if (isInt64 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + if (pp->ifdepth == 0) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "64-bit literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int64_Extensions, Int64_Extensions, "64-bit literal"); + } ppToken->i64val = ival; return isUnsigned ? PpAtomConstUint64 : PpAtomConstInt64; -#ifdef AMD_EXTENSIONS } else if (isInt16) { + if (pp->ifdepth == 0 && pp->parseContext.intermediate.getSource() == EShSourceGlsl) { + pp->parseContext.requireProfile(ppToken->loc, ~EEsProfile, + "16-bit literal"); + pp->parseContext.profileRequires(ppToken->loc, ~EEsProfile, 0, + Num_Int16_Extensions, Int16_Extensions, "16-bit literal"); + } ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint16 : PpAtomConstInt16; -#endif } else { ppToken->ival = (int)ival; return isUnsigned ? PpAtomConstUint : PpAtomConstInt; @@ -943,8 +1077,17 @@ int TPpContext::tokenize(TPpToken& ppToken) continue; // expand macros - if (token == PpAtomIdentifier && MacroExpand(&ppToken, false, true) != 0) - continue; + if (token == PpAtomIdentifier) { + switch (MacroExpand(&ppToken, false, true)) { + case MacroExpandNotStarted: + break; + case MacroExpandError: + return EndOfInput; + case MacroExpandStarted: + case MacroExpandUndef: + continue; + } + } switch (token) { case PpAtomIdentifier: @@ -953,19 +1096,15 @@ int TPpContext::tokenize(TPpToken& ppToken) case PpAtomConstFloat: case PpAtomConstInt64: case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS case PpAtomConstInt16: case PpAtomConstUint16: -#endif case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS case PpAtomConstFloat16: -#endif if (ppToken.name[0] == '\0') continue; break; case PpAtomConstString: - if (parseContext.intermediate.getSource() != EShSourceHlsl) { + if (ifdepth == 0 && parseContext.intermediate.getSource() != EShSourceHlsl) { // HLSL allows string literals. parseContext.ppError(ppToken.loc, "string literals not supported", "\"\"", ""); continue; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp index bc145e251fc..f4f1bd04a79 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp @@ -97,6 +97,56 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace glslang { + +namespace { + + // When recording (and playing back) should the backing name string + // be saved (restored)? + bool SaveName(int atom) + { + switch (atom) { + case PpAtomIdentifier: + case PpAtomConstString: + case PpAtomConstInt: + case PpAtomConstUint: + case PpAtomConstInt64: + case PpAtomConstUint64: + #ifdef AMD_EXTENSIONS + case PpAtomConstInt16: + case PpAtomConstUint16: + #endif + case PpAtomConstFloat: + case PpAtomConstDouble: + case PpAtomConstFloat16: + return true; + default: + return false; + } + } + + // When recording (and playing back) should the numeric value + // be saved (restored)? + bool SaveValue(int atom) + { + switch (atom) { + case PpAtomConstInt: + case PpAtomConstUint: + case PpAtomConstInt64: + case PpAtomConstUint64: + #ifdef AMD_EXTENSIONS + case PpAtomConstInt16: + case PpAtomConstUint16: + #endif + case PpAtomConstFloat: + case PpAtomConstDouble: + case PpAtomConstFloat16: + return true; + default: + return false; + } + } +} + // push onto back of stream void TPpContext::TokenStream::putSubtoken(char subtoken) { @@ -121,44 +171,25 @@ void TPpContext::TokenStream::ungetSubtoken() // Add a complete token (including backing string) to the end of a list // for later playback. -void TPpContext::TokenStream::putToken(int token, TPpToken* ppToken) +void TPpContext::TokenStream::putToken(int atom, TPpToken* ppToken) { - const char* s; - char* str = NULL; + // save the atom + assert((atom & ~0xff) == 0); + putSubtoken(static_cast(atom)); - assert((token & ~0xff) == 0); - putSubtoken(static_cast(token)); - - switch (token) { - case PpAtomIdentifier: - case PpAtomConstString: - s = ppToken->name; + // save the backing name string + if (SaveName(atom)) { + const char* s = ppToken->name; while (*s) putSubtoken(*s++); putSubtoken(0); - break; - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstInt64: - case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: - case PpAtomConstUint16: -#endif - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - str = ppToken->name; - while (*str) { - putSubtoken(*str); - str++; - } - putSubtoken(0); - break; - default: - break; + } + + // save the numeric value + if (SaveValue(atom)) { + const char* n = reinterpret_cast(&ppToken->i64val); + for (size_t i = 0; i < sizeof(ppToken->i64val); ++i) + putSubtoken(*n++); } } @@ -166,40 +197,19 @@ void TPpContext::TokenStream::putToken(int token, TPpToken* ppToken) // (Not the source stream, but a stream used to hold a tokenized macro). int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken *ppToken) { - int len; - int ch; + // get the atom + int atom = getSubtoken(); + if (atom == EndOfInput) + return atom; - int subtoken = getSubtoken(); + // init the token + ppToken->clear(); ppToken->loc = parseContext.getCurrentLoc(); - switch (subtoken) { - case '#': - // Check for ##, unless the current # is the last character - if (current < data.size()) { - if (getSubtoken() == '#') { - parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); - parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)"); - subtoken = PpAtomPaste; - } else - ungetSubtoken(); - } - break; - case PpAtomConstString: - case PpAtomIdentifier: - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - case PpAtomConstInt: - case PpAtomConstUint: - case PpAtomConstInt64: - case PpAtomConstUint64: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: - case PpAtomConstUint16: -#endif - len = 0; - ch = getSubtoken(); + + // get the backing name string + if (SaveName(atom)) { + int ch = getSubtoken(); + int len = 0; while (ch != 0 && ch != EndOfInput) { if (len < MaxTokenLength) { ppToken->name[len] = (char)ch; @@ -211,65 +221,28 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken } } ppToken->name[len] = 0; + } - switch (subtoken) { - case PpAtomIdentifier: - break; - case PpAtomConstString: - break; - case PpAtomConstFloat: - case PpAtomConstDouble: -#ifdef AMD_EXTENSIONS - case PpAtomConstFloat16: -#endif - ppToken->dval = atof(ppToken->name); - break; - case PpAtomConstInt: -#ifdef AMD_EXTENSIONS - case PpAtomConstInt16: -#endif - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->ival = (int)strtol(ppToken->name, 0, 16); - else - ppToken->ival = (int)strtol(ppToken->name, 0, 8); + // Check for ##, unless the current # is the last character + if (atom == '#') { + if (current < data.size()) { + if (getSubtoken() == '#') { + parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)"); + parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)"); + atom = PpAtomPaste; } else - ppToken->ival = atoi(ppToken->name); - break; - case PpAtomConstUint: -#ifdef AMD_EXTENSIONS - case PpAtomConstUint16: -#endif - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->ival = (int)strtoul(ppToken->name, 0, 16); - else - ppToken->ival = (int)strtoul(ppToken->name, 0, 8); - } else - ppToken->ival = (int)strtoul(ppToken->name, 0, 10); - break; - case PpAtomConstInt64: - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->i64val = strtoll(ppToken->name, nullptr, 16); - else - ppToken->i64val = strtoll(ppToken->name, nullptr, 8); - } else - ppToken->i64val = atoll(ppToken->name); - break; - case PpAtomConstUint64: - if (len > 0 && ppToken->name[0] == '0') { - if (len > 1 && (ppToken->name[1] == 'x' || ppToken->name[1] == 'X')) - ppToken->i64val = (long long)strtoull(ppToken->name, nullptr, 16); - else - ppToken->i64val = (long long)strtoull(ppToken->name, nullptr, 8); - } else - ppToken->i64val = (long long)strtoull(ppToken->name, 0, 10); - break; + ungetSubtoken(); } } - return subtoken; + // get the numeric value + if (SaveValue(atom)) { + char* n = reinterpret_cast(&ppToken->i64val); + for (size_t i = 0; i < sizeof(ppToken->i64val); ++i) + *n++ = (char)getSubtoken(); + } + + return atom; } // We are pasting if diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h index d56df576541..7b0f815500c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h @@ -127,10 +127,8 @@ enum EFixedAtoms { PpAtomConstUint, PpAtomConstInt64, PpAtomConstUint64, -#ifdef AMD_EXTENSIONS PpAtomConstInt16, PpAtomConstUint16, -#endif PpAtomConstFloat, PpAtomConstDouble, PpAtomConstFloat16, diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp index 50fb602789e..8cfc2acb866 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp @@ -131,11 +131,11 @@ public: for (int m = 0; m <= index; ++m) { // modify just the children's view of matrix layout, if there is one for this member TLayoutMatrix subMatrixLayout = memberList[m].type->getQualifier().layoutMatrix; - int memberAlignment = intermediate.getBaseAlignment(*memberList[m].type, memberSize, dummyStride, - type.getQualifier().layoutPacking == ElpStd140, - subMatrixLayout != ElmNone - ? subMatrixLayout == ElmRowMajor - : type.getQualifier().layoutMatrix == ElmRowMajor); + int memberAlignment = intermediate.getMemberAlignment(*memberList[m].type, memberSize, dummyStride, + type.getQualifier().layoutPacking, + subMatrixLayout != ElmNone + ? subMatrixLayout == ElmRowMajor + : type.getQualifier().layoutMatrix == ElmRowMajor); RoundToPow2(offset, memberAlignment); if (m < index) offset += memberSize; @@ -154,9 +154,9 @@ public: int lastMemberSize; int dummyStride; - intermediate.getBaseAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride, - blockType.getQualifier().layoutPacking == ElpStd140, - blockType.getQualifier().layoutMatrix == ElmRowMajor); + intermediate.getMemberAlignment(*memberList[lastIndex].type, lastMemberSize, dummyStride, + blockType.getQualifier().layoutPacking, + blockType.getQualifier().layoutMatrix == ElmRowMajor); return lastOffset + lastMemberSize; } @@ -415,6 +415,36 @@ public: case EsdBuffer: return GL_SAMPLER_BUFFER; } +#ifdef AMD_EXTENSIONS + case EbtFloat16: + switch ((int)sampler.dim) { + case Esd1D: + switch ((int)sampler.shadow) { + case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_AMD : GL_FLOAT16_SAMPLER_1D_AMD; + case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_1D_SHADOW_AMD; + } + case Esd2D: + switch ((int)sampler.ms) { + case false: + switch ((int)sampler.shadow) { + case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_AMD; + case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_SHADOW_AMD; + } + case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD; + } + case Esd3D: + return GL_FLOAT16_SAMPLER_3D_AMD; + case EsdCube: + switch ((int)sampler.shadow) { + case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_SAMPLER_CUBE_AMD; + case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD; + } + case EsdRect: + return sampler.shadow ? GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_RECT_AMD; + case EsdBuffer: + return GL_FLOAT16_SAMPLER_BUFFER_AMD; + } +#endif case EbtInt: switch ((int)sampler.dim) { case Esd1D: @@ -477,6 +507,26 @@ public: case EsdBuffer: return GL_IMAGE_BUFFER; } +#ifdef AMD_EXTENSIONS + case EbtFloat16: + switch ((int)sampler.dim) { + case Esd1D: + return sampler.arrayed ? GL_FLOAT16_IMAGE_1D_ARRAY_AMD : GL_FLOAT16_IMAGE_1D_AMD; + case Esd2D: + switch ((int)sampler.ms) { + case false: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_AMD; + case true: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD; + } + case Esd3D: + return GL_FLOAT16_IMAGE_3D_AMD; + case EsdCube: + return sampler.arrayed ? GL_FLOAT16_IMAGE_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_IMAGE_CUBE_AMD; + case EsdRect: + return GL_FLOAT16_IMAGE_2D_RECT_AMD; + case EsdBuffer: + return GL_FLOAT16_IMAGE_BUFFER_AMD; + } +#endif case EbtInt: switch ((int)sampler.dim) { case Esd1D: @@ -716,11 +766,11 @@ void TReflection::buildAttributeReflection(EShLanguage stage, const TIntermediat } // build counter block index associations for buffers -void TReflection::buildCounterIndices() +void TReflection::buildCounterIndices(const TIntermediate& intermediate) { // search for ones that have counters for (int i = 0; i < int(indexToUniformBlock.size()); ++i) { - const TString counterName(indexToUniformBlock[i].name + "@count"); + const TString counterName(intermediate.addCounterBufferName(indexToUniformBlock[i].name)); const int index = getIndex(counterName); if (index >= 0) @@ -728,6 +778,14 @@ void TReflection::buildCounterIndices() } } +// build Shader Stages mask for all uniforms +void TReflection::buildUniformStageMask(const TIntermediate& intermediate) +{ + for (int i = 0; i < int(indexToUniform.size()); ++i) { + indexToUniform[i].stages = static_cast(indexToUniform[i].stages | 1 << intermediate.getStage()); + } +} + // Merge live symbols from 'intermediate' into the existing reflection database. // // Returns false if the input is too malformed to do this. @@ -752,7 +810,8 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate) function->traverse(&it); } - buildCounterIndices(); + buildCounterIndices(intermediate); + buildUniformStageMask(intermediate); return true; } diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h index fedfbe8d4a0..49282c30e31 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/reflection.h @@ -57,9 +57,9 @@ class TObjectReflection { public: TObjectReflection(const TString& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex) : name(pName), offset(pOffset), - glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), type(pType.clone()) { } + glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), stages(EShLanguageMask(0)), type(pType.clone()) { } - const TType* const getType() const { return type; } + const TType* getType() const { return type; } int getBinding() const { if (type == nullptr || !type->getQualifier().hasBinding()) @@ -68,8 +68,8 @@ public: } void dump() const { - printf("%s: offset %d, type %x, size %d, index %d, binding %d", - name.c_str(), offset, glDefineType, size, index, getBinding() ); + printf("%s: offset %d, type %x, size %d, index %d, binding %d, stages %d", + name.c_str(), offset, glDefineType, size, index, getBinding(), stages ); if (counterIndex != -1) printf(", counter %d", counterIndex); @@ -84,6 +84,7 @@ public: int size; // data size in bytes for a block, array size for a (non-block) object that's an array int index; int counterIndex; + EShLanguageMask stages; protected: TObjectReflection() : offset(-1), glDefineType(-1), size(-1), index(-1), type(nullptr) { } @@ -156,7 +157,8 @@ public: protected: friend class glslang::TReflectionTraverser; - void buildCounterIndices(); + void buildCounterIndices(const TIntermediate&); + void buildUniformStageMask(const TIntermediate& intermediate); void buildAttributeReflection(EShLanguage, const TIntermediate&); // Need a TString hash: typedef std::unordered_map TNameToIndex; diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h index 6e22bdd727a..c5eca4e1275 100644 --- a/3rdparty/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/bgfx/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -67,6 +67,11 @@ extern "C" { #endif +// This should always increase, as some paths to do not consume +// a more major number. +// It should increment by one when new functionality is added. +#define GLSLANG_MINOR_VERSION 11 + // // Call before doing any other compiler/linker operations. // @@ -89,6 +94,14 @@ typedef enum { EShLangGeometry, EShLangFragment, EShLangCompute, + EShLangRayGenNV, + EShLangIntersectNV, + EShLangAnyHitNV, + EShLangClosestHitNV, + EShLangMissNV, + EShLangCallableNV, + EShLangTaskNV, + EShLangMeshNV, EShLangCount, } EShLanguage; // would be better as stage, but this is ancient now @@ -99,6 +112,14 @@ typedef enum { EShLangGeometryMask = (1 << EShLangGeometry), EShLangFragmentMask = (1 << EShLangFragment), EShLangComputeMask = (1 << EShLangCompute), + EShLangRayGenNVMask = (1 << EShLangRayGenNV), + EShLangIntersectNVMask = (1 << EShLangIntersectNV), + EShLangAnyHitNVMask = (1 << EShLangAnyHitNV), + EShLangClosestHitNVMask = (1 << EShLangClosestHitNV), + EShLangMissNVMask = (1 << EShLangMissNV), + EShLangCallableNVMask = (1 << EShLangCallableNV), + EShLangTaskNVMask = (1 << EShLangTaskNV), + EShLangMeshNVMask = (1 << EShLangMeshNV), } EShLanguageMask; namespace glslang { @@ -119,9 +140,26 @@ typedef enum { typedef enum { EShTargetNone, - EshTargetSpv, + EShTargetSpv, // preferred spelling + EshTargetSpv = EShTargetSpv, // legacy spelling } EShTargetLanguage; +typedef enum { + EShTargetVulkan_1_0 = (1 << 22), + EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), + EShTargetOpenGL_450 = 450, +} EShTargetClientVersion; + +typedef EShTargetClientVersion EshTargetClientVersion; + +typedef enum { + EShTargetSpv_1_0 = (1 << 16), + EShTargetSpv_1_1 = (1 << 16) | (1 << 8), + EShTargetSpv_1_2 = (1 << 16) | (2 << 8), + EShTargetSpv_1_3 = (1 << 16) | (3 << 8), + EShTargetSpv_1_4 = (1 << 16) | (4 << 8), +} EShTargetLanguageVersion; + struct TInputLanguage { EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone @@ -131,12 +169,13 @@ struct TInputLanguage { struct TClient { EShClient client; - int version; // version of client itself (not the client's input dialect) + EShTargetClientVersion version; // version of client itself (not the client's input dialect) }; struct TTarget { EShTargetLanguage language; - unsigned int version; // the version to target, if SPIR-V, defined by "word 1" of the SPIR-V binary header + EShTargetLanguageVersion version; // version to target, if SPIR-V, defined by "word 1" of the SPIR-V header + bool hlslFunctionality1; // can target hlsl_functionality1 extension(s) }; // All source/client/target versions and settings. @@ -194,6 +233,8 @@ enum EShMessages { EShMsgKeepUncalled = (1 << 8), // for testing, don't eliminate uncalled functions EShMsgHlslOffsets = (1 << 9), // allow block offsets to follow HLSL rules instead of GLSL rules EShMsgDebugInfo = (1 << 10), // save debug information + EShMsgHlslEnable16BitTypes = (1 << 11), // enable use of 16-bit types in SPIR-V for HLSL + EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages }; // @@ -334,11 +375,15 @@ enum TResourceType { EResCount }; -// Make one TShader per shader that you will link into a program. Then provide -// the shader through setStrings() or setStringsWithLengths(), then call parse(), -// then query the info logs. -// Optionally use setPreamble() to set a special shader string that will be -// processed before all others but won't affect the validity of #version. +// Make one TShader per shader that you will link into a program. Then +// - provide the shader through setStrings() or setStringsWithLengths() +// - optionally call setEnv*(), see below for more detail +// - optionally use setPreamble() to set a special shader string that will be +// processed before all others but won't affect the validity of #version +// - call parse(): source language and target environment must be selected +// either by correct setting of EShMessages sent to parse(), or by +// explicitly calling setEnv*() +// - query the info logs // // N.B.: Does not yet support having the same TShader instance being linked into // multiple programs. @@ -371,12 +416,18 @@ public: void setResourceSetBinding(const std::vector& base); void setAutoMapBindings(bool map); void setAutoMapLocations(bool map); + void addUniformLocationOverride(const char* name, int loc); + void setUniformLocationBase(int base); + void setInvertY(bool invert); void setHlslIoMapping(bool hlslIoMap); void setFlattenUniformArrays(bool flatten); void setNoStorageFormat(bool useUnknownFormat); void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode); - // For setting up the environment (initialized in the constructor): + // For setting up the environment (cleared to nothingness in the constructor). + // These must be called so that parsing is done for the right source language and + // target environment, either indirectly through TranslateEnvironment() based on + // EShMessages et. al., or directly by the user. void setEnvInput(EShSource lang, EShLanguage envStage, EShClient client, int version) { environment.input.languageFamily = lang; @@ -384,16 +435,18 @@ public: environment.input.dialect = client; environment.input.dialectVersion = version; } - void setEnvClient(EShClient client, int version) + void setEnvClient(EShClient client, EShTargetClientVersion version) { environment.client.client = client; environment.client.version = version; } - void setEnvTarget(EShTargetLanguage lang, unsigned int version) + void setEnvTarget(EShTargetLanguage lang, EShTargetLanguageVersion version) { environment.target.language = lang; environment.target.version = version; } + void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; } + bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; } // Interface to #include handlers. // @@ -500,6 +553,8 @@ public: return parse(builtInResources, defaultVersion, ENoProfile, false, forwardCompatible, messages, includer); } + // NOTE: Doing just preprocessing to obtain a correct preprocessed shader string + // is not an officially supported or fully working path. bool preprocess(const TBuiltInResource* builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, bool forwardCompatible, EShMessages message, std::string* outputString, @@ -639,6 +694,8 @@ public: int getUniformBlockSize(int blockIndex) const; // can be used for glGetActiveUniformBlockiv(UNIFORM_BLOCK_DATA_SIZE) int getUniformIndex(const char* name) const; // can be used for glGetUniformIndices() int getUniformBinding(int index) const; // returns the binding number + EShLanguageMask getUniformStages(int index) const; // returns Shaders Stages where a Uniform is present + int getUniformBlockBinding(int index) const; // returns the block binding number int getUniformBlockIndex(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_BLOCK_INDEX) int getUniformBlockCounterIndex(int index) const; // returns block index of associated counter. int getUniformType(int index) const; // can be used for glGetActiveUniformsiv(GL_UNIFORM_TYPE) diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/AST.FromFile.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/AST.FromFile.cpp index 5f6de4f6d50..00bb4333fd7 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/AST.FromFile.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/AST.FromFile.cpp @@ -41,13 +41,27 @@ namespace { using CompileToAstTest = GlslangTest<::testing::TestWithParam>; +#ifdef NV_EXTENSIONS +using CompileToAstTestNV = GlslangTest<::testing::TestWithParam>; +#endif + TEST_P(CompileToAstTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::OpenGL, + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, Target::AST); } +#ifdef NV_EXTENSIONS +// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled). +TEST_P(CompileToAstTestNV, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, + Target::AST); +} +#endif + // clang-format off INSTANTIATE_TEST_CASE_P( Glsl, CompileToAstTest, @@ -85,6 +99,7 @@ INSTANTIATE_TEST_CASE_P( "cppComplexExpr.vert", "cppDeepNest.frag", "cppPassMacroName.frag", + "cppRelaxSkipTokensErrors.vert", "badChars.frag", "pointCoord.frag", "array.frag", @@ -106,6 +121,7 @@ INSTANTIATE_TEST_CASE_P( "310.tese", "310implicitSizeArrayError.vert", "310AofA.vert", + "310runtimeArray.vert", "320.comp", "320.vert", "320.geom", @@ -184,11 +200,15 @@ INSTANTIATE_TEST_CASE_P( "loopsArtificial.frag", "matrix.frag", "matrix2.frag", + "mixedArrayDecls.frag", + "nonuniform.frag", "newTexture.frag", "Operations.frag", "overlongLiteral.frag", "prepost.frag", + "runtimeArray.vert", "simpleFunctionCall.frag", + "stringToDouble.vert", "structAssignment.frag", "structDeref.frag", "structure.frag", @@ -210,9 +230,21 @@ INSTANTIATE_TEST_CASE_P( "precise.tesc", "precise_struct_block.vert", "maxClipDistances.vert", + "findFunction.frag", + "constantUnaryConversion.comp" })), FileNameAsCustomTestSuffix ); + +#ifdef NV_EXTENSIONS +INSTANTIATE_TEST_CASE_P( + Glsl, CompileToAstTestNV, + ::testing::ValuesIn(std::vector({ + "nvShaderNoperspectiveInterpolation.frag", + })), + FileNameAsCustomTestSuffix +); +#endif // clang-format on } // anonymous namespace diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/CMakeLists.txt b/3rdparty/bgfx/3rdparty/glslang/gtests/CMakeLists.txt index 15b73f4bde9..f678cb6ea5c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/CMakeLists.txt +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/CMakeLists.txt @@ -25,6 +25,8 @@ if(BUILD_TESTING) # -- Remapper tests ${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp) + glslang_pch(TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/pch.cpp) + add_executable(glslangtests ${TEST_SOURCES}) set_property(TARGET glslangtests PROPERTY FOLDER tests) glslang_set_link_args(glslangtests) diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/Config.FromFile.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/Config.FromFile.cpp index a6e93dcfa9b..f3a27724d1f 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/Config.FromFile.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/Config.FromFile.cpp @@ -97,7 +97,7 @@ TEST_P(ConfigTest, FromFile) INSTANTIATE_TEST_CASE_P( Glsl, ConfigTest, ::testing::ValuesIn(std::vector({ - {"specExamples.vert", "baseResults/test.conf", "specExamples.vert.out", (EShMessages)(EShMsgAST | EShMsgCascadingErrors)}, + {"specExamples.vert", "baseResults/test.conf", "specExamplesConf.vert.out", (EShMessages)(EShMsgAST | EShMsgCascadingErrors)}, {"100Limits.vert", "100.conf", "100LimitsConf.vert.out", EShMsgCascadingErrors}, })), ); diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/Hlsl.FromFile.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/Hlsl.FromFile.cpp index 2e4b146d647..809e525796a 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/Hlsl.FromFile.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/Hlsl.FromFile.cpp @@ -58,6 +58,7 @@ std::string FileNameAsCustomTestSuffix( } using HlslCompileTest = GlslangTest<::testing::TestWithParam>; +using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam>; using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam>; using HlslLegalizeTest = GlslangTest<::testing::TestWithParam>; @@ -66,8 +67,15 @@ using HlslLegalizeTest = GlslangTest<::testing::TestWithParam{ + {"hlsl.wavebroadcast.comp", "CSMain"}, + {"hlsl.waveprefix.comp", "CSMain"}, + {"hlsl.wavequad.comp", "CSMain"}, + {"hlsl.wavequery.comp", "CSMain"}, + {"hlsl.wavequery.frag", "PixelShaderFunction"}, + {"hlsl.wavereduction.comp", "CSMain"}, + {"hlsl.wavevote.comp", "CSMain"}, + { "hlsl.type.type.conversion.valid.frag", "main" }, + {"hlsl.int.dot.frag", "main"} }), FileNameAsCustomTestSuffix ); @@ -378,7 +418,7 @@ INSTANTIATE_TEST_CASE_P( ); // clang-format on -#ifdef ENABLE_OPT +#if ENABLE_OPT // clang-format off INSTANTIATE_TEST_CASE_P( ToSpirv, HlslLegalizeTest, diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp index 6e1969a2eb3..22892f0b45e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp @@ -52,6 +52,7 @@ TEST_P(LinkTestVulkan, FromFile) GlslangResult result; // Compile each input shader file. + bool success = true; std::vector> shaders; for (size_t i = 0; i < fileCount; ++i) { std::string contents; @@ -61,7 +62,7 @@ TEST_P(LinkTestVulkan, FromFile) new glslang::TShader(GetShaderStage(GetSuffix(fileNames[i])))); auto* shader = shaders.back().get(); shader->setAutoMapLocations(true); - compile(shader, contents, "", controls); + success &= compile(shader, contents, "", controls); result.shaderResults.push_back( {fileNames[i], shader->getInfoLog(), shader->getInfoDebugLog()}); } @@ -69,10 +70,26 @@ TEST_P(LinkTestVulkan, FromFile) // Link all of them. glslang::TProgram program; for (const auto& shader : shaders) program.addShader(shader.get()); - program.link(controls); + success &= program.link(controls); result.linkingOutput = program.getInfoLog(); result.linkingError = program.getInfoDebugLog(); + if (success && (controls & EShMsgSpvRules)) { + spv::SpvBuildLogger logger; + std::vector spirv_binary; + glslang::SpvOptions options; + options.disableOptimizer = true; + options.validate = true; + glslang::GlslangToSpv(*program.getIntermediate(shaders.front()->getStage()), + spirv_binary, &logger, &options); + + std::ostringstream disassembly_stream; + spv::Parameterize(); + spv::Disassemble(disassembly_stream, spirv_binary); + result.spirvWarningsErrors = logger.getAllMessages(); + result.spirv = disassembly_stream.str(); + } + std::ostringstream stream; outputResultToStream(&stream, result, controls); @@ -90,6 +107,7 @@ INSTANTIATE_TEST_CASE_P( Glsl, LinkTestVulkan, ::testing::ValuesIn(std::vector>({ {"link1.vk.frag", "link2.vk.frag"}, + {"spv.unit1.frag", "spv.unit2.frag", "spv.unit3.frag"}, })), ); // clang-format on diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/Pp.FromFile.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/Pp.FromFile.cpp index 13daac0d671..1bea8775dcf 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/Pp.FromFile.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/Pp.FromFile.cpp @@ -50,6 +50,7 @@ TEST_P(PreprocessingTest, FromFile) INSTANTIATE_TEST_CASE_P( Glsl, PreprocessingTest, ::testing::ValuesIn(std::vector({ + "preprocessor.bad_arg.vert", "preprocessor.cpp_style_line_directive.vert", "preprocessor.cpp_style___FILE__.vert", "preprocessor.edge_cases.vert", diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp index 4a396273dd1..1e17736fc4d 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/Spv.FromFile.cpp @@ -63,6 +63,7 @@ std::string FileNameAsCustomTestSuffixIoMap( } using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam>; +using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam>; using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam>; using VulkanSemantics = GlslangTest<::testing::TestWithParam>; using OpenGLSemantics = GlslangTest<::testing::TestWithParam>; @@ -82,7 +83,14 @@ using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::t TEST_P(CompileVulkanToSpirvTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Target::Spv); +} + +TEST_P(CompileVulkan1_1ToSpirvTest, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1, Target::Spv); } @@ -91,7 +99,7 @@ TEST_P(CompileVulkanToSpirvTest, FromFile) TEST_P(CompileOpenGLToSpirvTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::OpenGL, + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, Target::Spv); } @@ -100,8 +108,8 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile) TEST_P(VulkanSemantics, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, - Target::Spv); + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Target::Spv, false); } // GLSL-level Vulkan semantics test. Expected to error out before generating @@ -109,15 +117,15 @@ TEST_P(VulkanSemantics, FromFile) TEST_P(OpenGLSemantics, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::OpenGL, - Target::Spv); + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, + Target::Spv, false); } // GLSL-level Vulkan semantics test that need to see the AST for validation. TEST_P(VulkanAstSemantics, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, Target::AST); } @@ -157,19 +165,19 @@ TEST_P(GlslIoMap, FromFile) TEST_P(CompileVulkanToSpirvTestAMD, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, Target::Spv); } #endif #ifdef NV_EXTENSIONS -// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled). +// Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestNV, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), - Source::GLSL, Semantics::Vulkan, - Target::Spv); + Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, + Target::Spv); } #endif @@ -189,6 +197,7 @@ INSTANTIATE_TEST_CASE_P( // Test looping constructs. // No tests yet for making sure break and continue from a nested loop // goes to the innermost target. + "spv.barrier.vert", "spv.do-simple.vert", "spv.do-while-continue-break.vert", "spv.for-complex-condition.vert", @@ -206,6 +215,12 @@ INSTANTIATE_TEST_CASE_P( "spv.140.frag", "spv.150.geom", "spv.150.vert", + "spv.16bitstorage.frag", + "spv.16bitstorage_Error.frag", + "spv.16bitstorage-int.frag", + "spv.16bitstorage_Error-int.frag", + "spv.16bitstorage-uint.frag", + "spv.16bitstorage_Error-uint.frag", "spv.300BuiltIns.vert", "spv.300layout.frag", "spv.300layout.vert", @@ -222,6 +237,12 @@ INSTANTIATE_TEST_CASE_P( "spv.450.tesc", "spv.450.geom", "spv.450.noRedecl.tesc", + "spv.8bitstorage-int.frag", + "spv.8bitstorage_Error-int.frag", + "spv.8bitstorage-uint.frag", + "spv.8bitstorage_Error-uint.frag", + "spv.8bitstorage-ubo.vert", + "spv.8bitstorage-ssbo.vert", "spv.accessChain.frag", "spv.aggOps.frag", "spv.always-discard.frag", @@ -232,16 +253,17 @@ INSTANTIATE_TEST_CASE_P( "spv.bool.vert", "spv.boolInBlock.frag", "spv.branch-return.vert", + "spv.builtInXFB.vert", "spv.conditionalDiscard.frag", + "spv.constStruct.vert", + "spv.controlFlowAttributes.frag", "spv.conversion.frag", "spv.dataOut.frag", "spv.dataOutIndirect.frag", "spv.dataOutIndirect.vert", "spv.deepRvalue.frag", "spv.depthOut.frag", - "spv.deviceGroup.frag", "spv.discard-dce.frag", - "spv.drawParams.vert", "spv.doWhileLoop.frag", "spv.earlyReturnDiscard.frag", "spv.extPostDepthCoverage.frag", @@ -249,6 +271,11 @@ INSTANTIATE_TEST_CASE_P( "spv.flowControl.frag", "spv.forLoop.frag", "spv.forwardFun.frag", + "spv.fragmentDensity.frag", + "spv.fragmentDensity.vert", + "spv.fragmentDensity-es.frag", + "spv.fragmentDensity-neg.frag", + "spv.fullyCovered.frag", "spv.functionCall.frag", "spv.functionNestedOpaque.vert", "spv.functionSemantics.frag", @@ -265,13 +292,15 @@ INSTANTIATE_TEST_CASE_P( "spv.matrix.frag", "spv.matrix2.frag", "spv.memoryQualifier.frag", + "spv.memoryScopeSemantics.comp", + "spv.memoryScopeSemantics_Error.comp", "spv.merge-unreachable.frag", "spv.multiStruct.comp", "spv.multiStructFuncall.frag", - "spv.multiView.frag", "spv.newTexture.frag", "spv.noDeadDecorations.vert", "spv.nonSquare.vert", + "spv.nonuniform.frag", "spv.noWorkgroup.comp", "spv.offsets.frag", "spv.Operations.frag", @@ -284,6 +313,8 @@ INSTANTIATE_TEST_CASE_P( "spv.sampleId.frag", "spv.samplePosition.frag", "spv.sampleMaskOverrideCoverage.frag", + "spv.scalarlayout.frag", + "spv.scalarlayoutfloat16.frag", "spv.shaderBallot.comp", "spv.shaderDrawParams.vert", "spv.shaderGroupVote.comp", @@ -311,6 +342,7 @@ INSTANTIATE_TEST_CASE_P( "spv.variableArrayIndex.frag", "spv.varyingArray.frag", "spv.varyingArrayIndirect.frag", + "spv.vecMatConstruct.frag", "spv.voidFunction.frag", "spv.whileLoop.frag", "spv.AofA.frag", @@ -327,6 +359,48 @@ INSTANTIATE_TEST_CASE_P( "spv.storageBuffer.vert", "spv.precise.tese", "spv.precise.tesc", + "spv.vulkan100.subgroupArithmetic.comp", + "spv.vulkan100.subgroupPartitioned.comp", + "spv.xfb.vert", + "spv.xfb2.vert", + "spv.xfb3.vert", + "spv.samplerlessTextureFunctions.frag", + })), + FileNameAsCustomTestSuffix +); + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, CompileVulkan1_1ToSpirvTest, + ::testing::ValuesIn(std::vector({ + "spv.1.3.8bitstorage-ubo.vert", + "spv.1.3.8bitstorage-ssbo.vert", + "spv.deviceGroup.frag", + "spv.drawParams.vert", + "spv.int8.frag", + "spv.vulkan110.int16.frag", + "spv.int32.frag", + "spv.explicittypes.frag", + "spv.float32.frag", + "spv.float64.frag", + "spv.multiView.frag", + "spv.subgroup.frag", + "spv.subgroup.geom", + "spv.subgroup.tesc", + "spv.subgroup.tese", + "spv.subgroup.vert", + "spv.subgroupArithmetic.comp", + "spv.subgroupBasic.comp", + "spv.subgroupBallot.comp", + "spv.subgroupBallotNeg.comp", + "spv.subgroupClustered.comp", + "spv.subgroupClusteredNeg.comp", + "spv.subgroupPartitioned.comp", + "spv.subgroupShuffle.comp", + "spv.subgroupShuffleRelative.comp", + "spv.subgroupQuad.comp", + "spv.subgroupVote.comp", + "spv.vulkan110.storageBuffer.vert", })), FileNameAsCustomTestSuffix ); @@ -370,8 +444,13 @@ INSTANTIATE_TEST_CASE_P( "spv.460.comp", "spv.atomic.comp", "spv.glFragColor.frag", + "spv.rankShift.comp", "spv.specConst.vert", "spv.OVR_multiview.vert", + "spv.xfbOffsetOnBlockMembersAssignment.vert", + "spv.xfbOffsetOnStructMembersAssignment.vert", + "spv.xfbOverlapOffsetCheckWithBlockAndMember.vert", + "spv.xfbStrideJustOnce.vert", })), FileNameAsCustomTestSuffix ); @@ -382,6 +461,7 @@ INSTANTIATE_TEST_CASE_P( "vulkan.frag", "vulkan.vert", "vulkan.comp", + "samplerlessTextureFunctions.frag", })), FileNameAsCustomTestSuffix ); @@ -411,8 +491,10 @@ INSTANTIATE_TEST_CASE_P( Glsl, CompileVulkanToSpirvTestAMD, ::testing::ValuesIn(std::vector({ "spv.float16.frag", + "spv.float16Fetch.frag", "spv.imageLoadStoreLod.frag", "spv.int16.frag", + "spv.int16.amd.frag", "spv.shaderBallotAMD.comp", "spv.shaderFragMaskAMD.frag", "spv.textureGatherBiasLod.frag", @@ -434,6 +516,36 @@ INSTANTIATE_TEST_CASE_P( "spv.multiviewPerViewAttributes.vert", "spv.multiviewPerViewAttributes.tesc", "spv.atomicInt64.comp", + "spv.shadingRate.frag", + "spv.RayGenShader.rgen", + "spv.RayGenShader_Errors.rgen", + "spv.RayConstants.rgen", + "spv.IntersectShader.rint", + "spv.IntersectShader_Errors.rint", + "spv.AnyHitShader.rahit", + "spv.AnyHitShader_Errors.rahit", + "spv.ClosestHitShader.rchit", + "spv.ClosestHitShader_Errors.rchit", + "spv.MissShader.rmiss", + "spv.MissShader_Errors.rmiss", + "spv.RayCallable.rcall", + "spv.RayCallable_Errors.rcall", + "spv.fragmentShaderBarycentric.frag", + "spv.fragmentShaderBarycentric2.frag", + "spv.computeShaderDerivatives.comp", + "spv.computeShaderDerivatives2.comp", + "spv.shaderImageFootprint.frag", + "spv.meshShaderBuiltins.mesh", + "spv.meshShaderUserDefined.mesh", + "spv.meshShaderPerViewBuiltins.mesh", + "spv.meshShaderPerViewUserDefined.mesh", + "spv.meshShaderSharedMem.mesh", + "spv.meshShaderTaskMem.mesh", + "spv.320.meshShaderUserDefined.mesh", + "spv.meshShaderRedeclBuiltins.mesh", + "spv.meshShaderRedeclPerViewBuiltins.mesh", + "spv.meshTaskShader.task", + "spv.perprimitiveNV.frag", })), FileNameAsCustomTestSuffix ); diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.cpp index db2b81d1a05..d899c780e59 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.cpp @@ -60,6 +60,24 @@ EShLanguage GetShaderStage(const std::string& stage) return EShLangFragment; } else if (stage == "comp") { return EShLangCompute; +#ifdef NV_EXTENSIONS + } else if (stage == "rgen") { + return EShLangRayGenNV; + } else if (stage == "rint") { + return EShLangIntersectNV; + } else if (stage == "rahit") { + return EShLangAnyHitNV; + } else if (stage == "rchit") { + return EShLangClosestHitNV; + } else if (stage == "rmiss") { + return EShLangMissNV; + } else if (stage == "rcall") { + return EShLangCallableNV; + } else if (stage == "task") { + return EShLangTaskNV; + } else if (stage == "mesh") { + return EShLangMeshNV; +#endif } else { assert(0 && "Unknown shader stage"); return EShLangCount; @@ -100,6 +118,8 @@ EShMessages DeriveOptions(Source source, Semantics semantics, Target target) break; } + result = static_cast(result | EShMsgHlslLegalization); + return result; } diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.h b/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.h index 2dac99bca24..3329fa3c21b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.h +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/TestFixture.h @@ -70,7 +70,7 @@ enum class Source { // Enum for shader compilation semantics. enum class Semantics { OpenGL, - Vulkan, + Vulkan }; // Enum for compilation target. @@ -197,17 +197,40 @@ public: GlslangResult compileAndLink( const std::string shaderName, const std::string& code, const std::string& entryPointName, EShMessages controls, + glslang::EShTargetClientVersion clientTargetVersion, bool flattenUniformArrays = false, EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep, - bool disableOptimizer = true) + bool enableOptimizer = false, + bool automap = true) { - const EShLanguage kind = GetShaderStage(GetSuffix(shaderName)); + const EShLanguage stage = GetShaderStage(GetSuffix(shaderName)); - glslang::TShader shader(kind); - shader.setAutoMapLocations(true); + glslang::TShader shader(stage); + if (automap) { + shader.setAutoMapLocations(true); + shader.setAutoMapBindings(true); + } shader.setTextureSamplerTransformMode(texSampTransMode); shader.setFlattenUniformArrays(flattenUniformArrays); + if (controls & EShMsgSpvRules) { + if (controls & EShMsgVulkanRules) { + shader.setEnvInput((controls & EShMsgReadHlsl) ? glslang::EShSourceHlsl + : glslang::EShSourceGlsl, + stage, glslang::EShClientVulkan, 100); + shader.setEnvClient(glslang::EShClientVulkan, clientTargetVersion); + shader.setEnvTarget(glslang::EShTargetSpv, + clientTargetVersion == glslang::EShTargetVulkan_1_1 ? glslang::EShTargetSpv_1_3 + : glslang::EShTargetSpv_1_0); + } else { + shader.setEnvInput((controls & EShMsgReadHlsl) ? glslang::EShSourceHlsl + : glslang::EShSourceGlsl, + stage, glslang::EShClientOpenGL, 100); + shader.setEnvClient(glslang::EShClientOpenGL, clientTargetVersion); + shader.setEnvTarget(glslang::EshTargetSpv, glslang::EShTargetSpv_1_0); + } + } + bool success = compile(&shader, code, entryPointName, controls); glslang::TProgram program; @@ -219,8 +242,9 @@ public: if (success && (controls & EShMsgSpvRules)) { std::vector spirv_binary; glslang::SpvOptions options; - options.disableOptimizer = disableOptimizer; - glslang::GlslangToSpv(*program.getIntermediate(kind), + options.disableOptimizer = !enableOptimizer; + options.validate = true; + glslang::GlslangToSpv(*program.getIntermediate(stage), spirv_binary, &logger, &options); std::ostringstream disassembly_stream; @@ -251,9 +275,9 @@ public: bool autoMapBindings, bool flattenUniformArrays) { - const EShLanguage kind = GetShaderStage(GetSuffix(shaderName)); + const EShLanguage stage = GetShaderStage(GetSuffix(shaderName)); - glslang::TShader shader(kind); + glslang::TShader shader(stage); shader.setShiftSamplerBinding(baseSamplerBinding); shader.setShiftTextureBinding(baseTextureBinding); shader.setShiftImageBinding(baseImageBinding); @@ -275,8 +299,10 @@ public: if (success && (controls & EShMsgSpvRules)) { std::vector spirv_binary; - glslang::GlslangToSpv(*program.getIntermediate(kind), - spirv_binary, &logger); + glslang::SpvOptions options; + options.validate = true; + glslang::GlslangToSpv(*program.getIntermediate(stage), + spirv_binary, &logger, &options); std::ostringstream disassembly_stream; spv::Parameterize(); @@ -299,9 +325,10 @@ public: const std::string& entryPointName, EShMessages controls, const unsigned int remapOptions = spv::spirvbin_t::NONE) { - const EShLanguage kind = GetShaderStage(GetSuffix(shaderName)); + const EShLanguage stage = GetShaderStage(GetSuffix(shaderName)); - glslang::TShader shader(kind); + glslang::TShader shader(stage); + shader.setAutoMapBindings(true); shader.setAutoMapLocations(true); bool success = compile(&shader, code, entryPointName, controls); @@ -314,8 +341,10 @@ public: if (success && (controls & EShMsgSpvRules)) { std::vector spirv_binary; - glslang::GlslangToSpv(*program.getIntermediate(kind), - spirv_binary, &logger); + glslang::SpvOptions options; + options.validate = true; + glslang::GlslangToSpv(*program.getIntermediate(stage), + spirv_binary, &logger, &options); spv::spirvbin_t(0 /*verbosity*/).remap(spirv_binary, remapOptions); @@ -383,10 +412,12 @@ public: const std::string& testName, Source source, Semantics semantics, + glslang::EShTargetClientVersion clientTargetVersion, Target target, + bool automap = true, const std::string& entryPointName="", const std::string& baseDir="/baseResults/", - const bool disableOptimizer = true) + const bool enableOptimizer = false) { const std::string inputFname = testDir + "/" + testName; const std::string expectedOutputFname = @@ -396,8 +427,11 @@ public: tryLoadFile(inputFname, "input", &input); tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); - const EShMessages controls = DeriveOptions(source, semantics, target); - GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransKeep, disableOptimizer); + EShMessages controls = DeriveOptions(source, semantics, target); + if (enableOptimizer) + controls = static_cast(controls & ~EShMsgHlslLegalization); + GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false, + EShTexSampTransKeep, enableOptimizer, automap); // Generate the hybrid output in the way of glslangValidator. std::ostringstream stream; @@ -423,7 +457,8 @@ public: tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); const EShMessages controls = DeriveOptions(source, semantics, target); - GlslangResult result = compileAndLink(testName, input, entryPointName, controls, true); + GlslangResult result = compileAndLink(testName, input, entryPointName, controls, + glslang::EShTargetVulkan_1_0, true); // Generate the hybrid output in the way of glslangValidator. std::ostringstream stream; @@ -592,7 +627,9 @@ public: tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); const EShMessages controls = DeriveOptions(source, semantics, target); - GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransUpgradeTextureRemoveSampler); + GlslangResult result = compileAndLink(testName, input, entryPointName, controls, + glslang::EShTargetVulkan_1_0, false, + EShTexSampTransUpgradeTextureRemoveSampler); // Generate the hybrid output in the way of glslangValidator. std::ostringstream stream; diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/main.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/main.cpp index 35f30db9cfa..9cd06d1d4fd 100644 --- a/3rdparty/bgfx/3rdparty/glslang/gtests/main.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char** argv) glslangtest::GlobalTestSettings.updateMode = true; } if (std::string("--test-root") == argv[i]) { - // Allow the user set the tets root directory. This is useful + // Allow the user set the test root directory. This is useful // for testing with files from another source tree. if (i + 1 < argc) { glslangtest::GlobalTestSettings.testRoot = argv[i + 1]; @@ -64,6 +64,11 @@ int main(int argc, char** argv) return 1; } } + if (std::string("--help") == argv[i]) { + printf("\nExtra options:\n\n"); + printf(" --update-mode\n Update the golden results for the tests.\n"); + printf(" --test-root \n Specify the test root directory (useful for testing with\n files from another source tree).\n"); + } } const int result = RUN_ALL_TESTS(); diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/pch.cpp b/3rdparty/bgfx/3rdparty/glslang/gtests/pch.cpp new file mode 100644 index 00000000000..b7a08654a54 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/pch.cpp @@ -0,0 +1,35 @@ +// +// Copyright (C) 2018 The Khronos Group Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "pch.h" diff --git a/3rdparty/bgfx/3rdparty/glslang/gtests/pch.h b/3rdparty/bgfx/3rdparty/glslang/gtests/pch.h new file mode 100644 index 00000000000..94e95b1eb21 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/gtests/pch.h @@ -0,0 +1,39 @@ +#ifndef _PCH_H +#define _PCH_H +// +// Copyright (C) 2018 The Khronos Group Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "TestFixture.h" + +#endif /* _PCH_H */ diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/CMakeLists.txt b/3rdparty/bgfx/3rdparty/glslang/hlsl/CMakeLists.txt index 98dfad7c963..f918d7a13d4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/CMakeLists.txt +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/CMakeLists.txt @@ -17,15 +17,27 @@ set(HEADERS hlslGrammar.h hlslParseables.h) -add_library(HLSL STATIC ${SOURCES} ${HEADERS}) +glslang_pch(SOURCES pch.cpp) + +add_library(HLSL ${LIB_TYPE} ${SOURCES} ${HEADERS}) set_property(TARGET HLSL PROPERTY FOLDER hlsl) set_property(TARGET HLSL PROPERTY POSITION_INDEPENDENT_CODE ON) +if(WIN32 AND BUILD_SHARED_LIBS) + set_target_properties(HLSL PROPERTIES PREFIX "") +endif() + if(WIN32) source_group("Source" FILES ${SOURCES} ${HEADERS}) endif(WIN32) if(ENABLE_GLSLANG_INSTALL) - install(TARGETS HLSL - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + if(BUILD_SHARED_LIBS) + install(TARGETS HLSL + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + else() + install(TARGETS HLSL + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() endif(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.cpp b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.cpp index fccf6c18775..261cec346f2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.cpp @@ -34,151 +34,73 @@ // #include "hlslAttributes.h" -#include -#include -#include +#include "hlslParseHelper.h" namespace glslang { // Map the given string to an attribute enum from TAttributeType, // or EatNone if invalid. - TAttributeType TAttributeMap::attributeFromName(const TString& nameSpace, const TString& name) + TAttributeType HlslParseContext::attributeFromName(const TString& nameSpace, const TString& name) const { - // These are case insensitive. - TString lowername(name); - std::transform(lowername.begin(), lowername.end(), lowername.begin(), ::tolower); - TString lowernameSpace(nameSpace); - std::transform(lowernameSpace.begin(), lowernameSpace.end(), lowernameSpace.begin(), ::tolower); - // handle names within a namespace - if (lowernameSpace == "vk") { - if (lowername == "input_attachment_index") + if (nameSpace == "vk") { + if (name == "input_attachment_index") return EatInputAttachment; - else if (lowername == "location") + else if (name == "location") return EatLocation; - else if (lowername == "binding") + else if (name == "binding") return EatBinding; - else if (lowername == "global_cbuffer_binding") + else if (name == "global_cbuffer_binding") return EatGlobalBinding; - } else if (lowernameSpace.size() > 0) + else if (name == "builtin") + return EatBuiltIn; + else if (name == "constant_id") + return EatConstantId; + else if (name == "push_constant") + return EatPushConstant; + } else if (nameSpace.size() > 0) return EatNone; // handle names with no namespace - if (lowername == "allow_uav_condition") + if (name == "allow_uav_condition") return EatAllow_uav_condition; - else if (lowername == "branch") + else if (name == "branch") return EatBranch; - else if (lowername == "call") + else if (name == "call") return EatCall; - else if (lowername == "domain") + else if (name == "domain") return EatDomain; - else if (lowername == "earlydepthstencil") + else if (name == "earlydepthstencil") return EatEarlyDepthStencil; - else if (lowername == "fastopt") + else if (name == "fastopt") return EatFastOpt; - else if (lowername == "flatten") + else if (name == "flatten") return EatFlatten; - else if (lowername == "forcecase") + else if (name == "forcecase") return EatForceCase; - else if (lowername == "instance") + else if (name == "instance") return EatInstance; - else if (lowername == "maxtessfactor") + else if (name == "maxtessfactor") return EatMaxTessFactor; - else if (lowername == "maxvertexcount") + else if (name == "maxvertexcount") return EatMaxVertexCount; - else if (lowername == "numthreads") + else if (name == "numthreads") return EatNumThreads; - else if (lowername == "outputcontrolpoints") + else if (name == "outputcontrolpoints") return EatOutputControlPoints; - else if (lowername == "outputtopology") + else if (name == "outputtopology") return EatOutputTopology; - else if (lowername == "partitioning") + else if (name == "partitioning") return EatPartitioning; - else if (lowername == "patchconstantfunc") + else if (name == "patchconstantfunc") return EatPatchConstantFunc; - else if (lowername == "unroll") + else if (name == "unroll") return EatUnroll; - else if (lowername == "loop") + else if (name == "loop") return EatLoop; else return EatNone; } - // Look up entry, inserting if it's not there, and if name is a valid attribute name - // as known by attributeFromName. - TAttributeType TAttributeMap::setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value) - { - if (name == nullptr) - return EatNone; - - const TAttributeType attr = attributeFromName(nameSpace, *name); - - if (attr != EatNone) - attributes[attr] = value; - - return attr; - } - - // Look up entry (const version), and return aggregate node. This cannot change the map. - const TIntermAggregate* TAttributeMap::operator[](TAttributeType attr) const - { - const auto entry = attributes.find(attr); - - return (entry == attributes.end()) ? nullptr : entry->second; - } - - // True if entry exists in map (even if value is nullptr) - bool TAttributeMap::contains(TAttributeType attr) const - { - return attributes.find(attr) != attributes.end(); - } - - // extract integers out of attribute arguments stored in attribute aggregate - bool TAttributeMap::getInt(TAttributeType attr, int& value, int argNum) const - { - const TConstUnion* intConst = getConstUnion(attr, EbtInt, argNum); - - if (intConst == nullptr) - return false; - - value = intConst->getIConst(); - return true; - }; - - // extract strings out of attribute arguments stored in attribute aggregate. - // convert to lower case if converToLower is true (for case-insensitive compare convenience) - bool TAttributeMap::getString(TAttributeType attr, TString& value, int argNum, bool convertToLower) const - { - const TConstUnion* stringConst = getConstUnion(attr, EbtString, argNum); - - if (stringConst == nullptr) - return false; - - value = *stringConst->getSConst(); - - // Convenience. - if (convertToLower) - std::transform(value.begin(), value.end(), value.begin(), ::tolower); - - return true; - }; - - // Helper to get attribute const union. Returns nullptr on failure. - const TConstUnion* TAttributeMap::getConstUnion(TAttributeType attr, TBasicType basicType, int argNum) const - { - const TIntermAggregate* attrAgg = (*this)[attr]; - if (attrAgg == nullptr) - return nullptr; - - if (argNum >= int(attrAgg->getSequence().size())) - return nullptr; - - const TConstUnion* constVal = &attrAgg->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0]; - if (constVal == nullptr || constVal->getType() != basicType) - return nullptr; - - return constVal; - } - } // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.h b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.h index 1fdb4ba0453..b1cc0372e5e 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.h +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslAttributes.h @@ -38,88 +38,22 @@ #include #include + +#include "../glslang/MachineIndependent/attribute.h" +#include "../glslang/MachineIndependent/SymbolTable.h" #include "hlslScanContext.h" -#include "../glslang/Include/Common.h" namespace glslang { - enum TAttributeType { - EatNone, - EatAllow_uav_condition, - EatBranch, - EatCall, - EatDomain, - EatEarlyDepthStencil, - EatFastOpt, - EatFlatten, - EatForceCase, - EatInstance, - EatMaxTessFactor, - EatNumThreads, - EatMaxVertexCount, - EatOutputControlPoints, - EatOutputTopology, - EatPartitioning, - EatPatchConstantFunc, - EatPatchSize, - EatUnroll, - EatLoop, - EatBinding, - EatGlobalBinding, - EatLocation, - EatInputAttachment - }; -} - -namespace std { - // Allow use of TAttributeType enum in hash_map without calling code having to cast. - template <> struct hash { - std::size_t operator()(glslang::TAttributeType attr) const { - return std::hash()(int(attr)); - } - }; -} // end namespace std - -namespace glslang { - class TIntermAggregate; - - class TAttributeMap { - public: - // Search for and potentially add the attribute into the map. Return the - // attribute type enum for it, if found, else EatNone. - TAttributeType setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value); - - // Const lookup: search for (but do not modify) the attribute in the map. - const TIntermAggregate* operator[](TAttributeType) const; - - // True if entry exists in map (even if value is nullptr) - bool contains(TAttributeType) const; - - // Obtain attribute as integer - bool getInt(TAttributeType attr, int& value, int argNum = 0) const; - - // Obtain attribute as string, with optional to-lower transform - bool getString(TAttributeType attr, TString& value, int argNum = 0, bool convertToLower = true) const; - - protected: - // Helper to get attribute const union - const TConstUnion* getConstUnion(TAttributeType attr, TBasicType, int argNum) const; - - // Find an attribute enum given its name. - static TAttributeType attributeFromName(const TString& nameSpace, const TString& name); - - std::unordered_map attributes; - }; class TFunctionDeclarator { public: TFunctionDeclarator() : function(nullptr), body(nullptr) { } TSourceLoc loc; TFunction* function; - TAttributeMap attributes; + TAttributes attributes; TVector* body; }; } // end namespace glslang - #endif // HLSLATTRIBUTES_H_ diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.cpp b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.cpp index cf0bf0512c7..6acaccbf77b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.cpp @@ -126,8 +126,6 @@ bool HlslGrammar::acceptIdentifier(HlslToken& idToken) // bool HlslGrammar::acceptCompilationUnit() { - TIntermNode* unitNode = nullptr; - if (! acceptDeclarationList(unitNode)) return false; @@ -324,7 +322,7 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/) // node for all the initializers. Each function created is a top-level node to grow // into the passed-in nodeList. // -// If 'nodeList' is passed in as non-null, it must an aggregate to extend for +// If 'nodeList' is passed in as non-null, it must be an aggregate to extend for // each top-level node the declaration creates. Otherwise, if only one top-level // node in generated here, that is want is returned in nodeList. // @@ -376,11 +374,9 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) bool forbidDeclarators = (peekTokenClass(EHTokCBuffer) || peekTokenClass(EHTokTBuffer)); // fully_specified_type - if (! acceptFullySpecifiedType(declaredType, nodeList)) + if (! acceptFullySpecifiedType(declaredType, nodeList, declarator.attributes, forbidDeclarators)) return false; - parseContext.transferTypeAttributes(declarator.attributes, declaredType); - // cbuffer and tbuffer end with the closing '}'. // No semicolon is included. if (forbidDeclarators) @@ -398,6 +394,9 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) if (peekTokenClass(EHTokLeftParen)) { // looks like function parameters + // merge in the attributes into the return type + parseContext.transferTypeAttributes(token.loc, declarator.attributes, declaredType, true); + // Potentially rename shader entry point function. No-op most of the time. parseContext.renameShaderFunction(fullName); @@ -425,32 +424,30 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) parseContext.handleFunctionDeclarator(declarator.loc, *declarator.function, true); } } else { - // A variable declaration. Fix the storage qualifier if it's a global. + // A variable declaration. + + // merge in the attributes, the first time around, into the shared type + if (! declarator_list) + parseContext.transferTypeAttributes(token.loc, declarator.attributes, declaredType); + + // Fix the storage qualifier if it's a global. if (declaredType.getQualifier().storage == EvqTemporary && parseContext.symbolTable.atGlobalLevel()) declaredType.getQualifier().storage = EvqUniform; + // recognize array_specifier + TArraySizes* arraySizes = nullptr; + acceptArraySpecifier(arraySizes); + // We can handle multiple variables per type declaration, so // the number of types can expand when arrayness is different. TType variableType; variableType.shallowCopy(declaredType); - // recognize array_specifier - TArraySizes* arraySizes = nullptr; - acceptArraySpecifier(arraySizes); - - // Fix arrayness in the variableType - if (declaredType.isImplicitlySizedArray()) { - // Because "int[] a = int[2](...), b = int[3](...)" makes two arrays a and b - // of different sizes, for this case sharing the shallow copy of arrayness - // with the parseType oversubscribes it, so get a deep copy of the arrayness. - variableType.newArraySizes(declaredType.getArraySizes()); - } - if (arraySizes || variableType.isArray()) { - // In the most general case, arrayness is potentially coming both from the - // declared type and from the variable: "int[] a[];" or just one or the other. - // Merge it all to the variableType, so all arrayness is part of the variableType. - parseContext.arrayDimMerge(variableType, arraySizes); - } + // In the most general case, arrayness is potentially coming both from the + // declared type and from the variable: "int[] a[];" or just one or the other. + // Merge it all to the variableType, so all arrayness is part of the variableType. + variableType.transferArraySizes(arraySizes); + variableType.copyArrayInnerSizes(declaredType.getArraySizes()); // samplers accept immediate sampler state if (variableType.getBasicType() == EbtSampler) { @@ -478,8 +475,9 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) if (typedefDecl) parseContext.declareTypedef(idToken.loc, *fullName, variableType); else if (variableType.getBasicType() == EbtBlock) { - parseContext.declareBlock(idToken.loc, variableType, fullName, - variableType.isArray() ? &variableType.getArraySizes() : nullptr); + if (expressionNode) + parseContext.error(idToken.loc, "buffer aliasing not yet supported", "block initializer", ""); + parseContext.declareBlock(idToken.loc, variableType, fullName); parseContext.declareStructBufferCounter(idToken.loc, variableType, *fullName); } else { if (variableType.getQualifier().storage == EvqUniform && ! variableType.containsOpaque()) { @@ -489,7 +487,7 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) // Declare the variable and add any initializer code to the AST. // The top-level node is always made into an aggregate, as that's // historically how the AST has been. - initializers = intermediate.growAggregate(initializers, + initializers = intermediate.growAggregate(initializers, parseContext.declareVariable(idToken.loc, *fullName, variableType, expressionNode), idToken.loc); } @@ -506,11 +504,16 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) if (initializers != nullptr) initializers->setOperator(EOpSequence); - // Add the initializers' aggregate to the nodeList we were handed. - if (nodeList) - nodeList = intermediate.growAggregate(nodeList, initializers); - else - nodeList = initializers; + // if we have a locally scoped static, it needs a globally scoped initializer + if (declaredType.getQualifier().storage == EvqGlobal && !parseContext.symbolTable.atGlobalLevel()) { + unitNode = intermediate.growAggregate(unitNode, initializers, idToken.loc); + } else { + // Add the initializers' aggregate to the nodeList we were handed. + if (nodeList) + nodeList = intermediate.growAggregate(nodeList, initializers); + else + nodeList = initializers; + } // SEMICOLON if (! acceptTokenClass(EHTokSemicolon)) { @@ -518,13 +521,11 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) // was actually an assignment such as "float = 4", where "float" is an identifier. // We put the token back to let further parsing happen for cases where that may // happen. This errors on the side of caution, and mostly triggers the error. - if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma) { + if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma) recedeToken(); - return false; - } else { + else expected(";"); - return false; - } + return false; } return true; @@ -536,12 +537,16 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList) bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node) { node = nullptr; + TAttributes attributes; // fully_specified_type TType type; - if (! acceptFullySpecifiedType(type)) + if (! acceptFullySpecifiedType(type, attributes)) return false; + if (attributes.size() > 0) + parseContext.warn(token.loc, "attributes don't apply to control declaration", "", ""); + // filter out type casts if (peekTokenClass(EHTokLeftParen)) { recedeToken(); @@ -577,12 +582,12 @@ bool HlslGrammar::acceptControlDeclaration(TIntermNode*& node) // : type_specifier // | type_qualifier type_specifier // -bool HlslGrammar::acceptFullySpecifiedType(TType& type) +bool HlslGrammar::acceptFullySpecifiedType(TType& type, const TAttributes& attributes) { TIntermNode* nodeList = nullptr; - return acceptFullySpecifiedType(type, nodeList); + return acceptFullySpecifiedType(type, nodeList, attributes); } -bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList) +bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList, const TAttributes& attributes, bool forbidDeclarators) { // type_qualifier TQualifier qualifier; @@ -601,11 +606,18 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList) return false; } + if (type.getBasicType() == EbtBlock) { // the type was a block, which set some parts of the qualifier parseContext.mergeQualifiers(type.getQualifier(), qualifier); + + // merge in the attributes + parseContext.transferTypeAttributes(token.loc, attributes, type); + // further, it can create an anonymous instance of the block - if (peek() != EHTokIdentifier) + // (cbuffer and tbuffer don't consume the next identifier, and + // should set forbidDeclarators) + if (forbidDeclarators || peek() != EHTokIdentifier) parseContext.declareBlock(loc, type); } else { // Some qualifiers are set when parsing the type. Merge those with @@ -624,7 +636,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList) if (type.isBuiltIn()) qualifier.builtIn = type.getQualifier().builtIn; - type.getQualifier() = qualifier; + type.getQualifier() = qualifier; } return true; @@ -640,7 +652,7 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier) do { switch (peek()) { case EHTokStatic: - qualifier.storage = parseContext.symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; + qualifier.storage = EvqGlobal; break; case EHTokExtern: // TODO: no meaning in glslang? @@ -1016,7 +1028,7 @@ bool HlslGrammar::acceptTessellationPatchTemplateType(TType& type) TArraySizes* arraySizes = new TArraySizes; arraySizes->addInnerSize(size->getAsConstantUnion()->getConstArray()[0].getIConst()); - type.newArraySizes(*arraySizes); + type.transferArraySizes(arraySizes); type.getQualifier().builtIn = patchType; if (! acceptTokenClass(EHTokRightAngle)) { @@ -1357,14 +1369,15 @@ bool HlslGrammar::acceptType(TType& type) } bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList) { - // Basic types for min* types, broken out here in case of future - // changes, e.g, to use native halfs. - static const TBasicType min16float_bt = EbtFloat; - static const TBasicType min10float_bt = EbtFloat; - static const TBasicType half_bt = EbtFloat; - static const TBasicType min16int_bt = EbtInt; - static const TBasicType min12int_bt = EbtInt; - static const TBasicType min16uint_bt = EbtUint; + // Basic types for min* types, use native halfs if the option allows them. + bool enable16BitTypes = parseContext.hlslEnable16BitTypes(); + + const TBasicType min16float_bt = enable16BitTypes ? EbtFloat16 : EbtFloat; + const TBasicType min10float_bt = enable16BitTypes ? EbtFloat16 : EbtFloat; + const TBasicType half_bt = enable16BitTypes ? EbtFloat16 : EbtFloat; + const TBasicType min16int_bt = enable16BitTypes ? EbtInt16 : EbtInt; + const TBasicType min12int_bt = enable16BitTypes ? EbtInt16 : EbtInt; + const TBasicType min16uint_bt = enable16BitTypes ? EbtUint16 : EbtUint; // Some types might have turned into identifiers. Take the hit for checking // when this has happened. @@ -1570,6 +1583,10 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList) new(&type) TType(EbtUint, EvqTemporary, 4); break; + case EHTokUint64: + new(&type) TType(EbtUint64); + break; + case EHTokBool: new(&type) TType(EbtBool); break; @@ -2029,10 +2046,18 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList) // Now known to be one of CBUFFER, TBUFFER, CLASS, or STRUCT - // IDENTIFIER + + // IDENTIFIER. It might also be a keyword which can double as an identifier. + // For example: 'cbuffer ConstantBuffer' or 'struct ConstantBuffer' is legal. + // 'cbuffer int' is also legal, and 'struct int' appears rejected only because + // it attempts to redefine the 'int' type. + const char* idString = getTypeString(peek()); TString structName = ""; - if (peekTokenClass(EHTokIdentifier)) { - structName = *token.string; + if (peekTokenClass(EHTokIdentifier) || idString != nullptr) { + if (idString != nullptr) + structName = *idString; + else + structName = *token.string; advanceToken(); } @@ -2262,9 +2287,9 @@ bool HlslGrammar::acceptStructBufferType(TType& type) // Create an unsized array out of that type. // TODO: does this work if it's already an array type? - TArraySizes unsizedArray; - unsizedArray.addInnerSize(UnsizedArraySize); - templateType->newArraySizes(unsizedArray); + TArraySizes* unsizedArray = new TArraySizes; + unsizedArray->addInnerSize(UnsizedArraySize); + templateType->transferArraySizes(unsizedArray); templateType->getQualifier().storage = storage; // field name is canonical for all structbuffers @@ -2294,8 +2319,8 @@ bool HlslGrammar::acceptStructBufferType(TType& type) // : struct_declaration SEMI_COLON struct_declaration SEMI_COLON ... // // struct_declaration -// : fully_specified_type struct_declarator COMMA struct_declarator ... -// | fully_specified_type IDENTIFIER function_parameters post_decls compound_statement // member-function definition +// : attributes fully_specified_type struct_declarator COMMA struct_declarator ... +// | attributes fully_specified_type IDENTIFIER function_parameters post_decls compound_statement // member-function definition // // struct_declarator // : IDENTIFIER post_decls @@ -2314,15 +2339,22 @@ bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList, TIntermNode* break; // struct_declaration - + + // attributes + TAttributes attributes; + acceptAttributes(attributes); + bool declarator_list = false; // fully_specified_type TType memberType; - if (! acceptFullySpecifiedType(memberType, nodeList)) { + if (! acceptFullySpecifiedType(memberType, nodeList, attributes)) { expected("member type"); return false; } + + // merge in the attributes + parseContext.transferTypeAttributes(token.loc, attributes, memberType); // struct_declarator COMMA struct_declarator ... bool functionDefinitionAccepted = false; @@ -2355,7 +2387,7 @@ bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList, TIntermNode* TArraySizes* arraySizes = nullptr; acceptArraySpecifier(arraySizes); if (arraySizes) - typeList->back().type->newArraySizes(*arraySizes); + typeList->back().type->transferArraySizes(arraySizes); acceptPostDecls(member.type->getQualifier()); @@ -2519,15 +2551,16 @@ bool HlslGrammar::acceptDefaultParameterDeclaration(const TType& type, TIntermTy bool HlslGrammar::acceptParameterDeclaration(TFunction& function) { // attributes - TAttributeMap attributes; + TAttributes attributes; acceptAttributes(attributes); // fully_specified_type TType* type = new TType; - if (! acceptFullySpecifiedType(*type)) + if (! acceptFullySpecifiedType(*type, attributes)) return false; - parseContext.transferTypeAttributes(attributes, *type); + // merge in the attributes + parseContext.transferTypeAttributes(token.loc, attributes, *type); // identifier HlslToken idToken; @@ -2537,12 +2570,12 @@ bool HlslGrammar::acceptParameterDeclaration(TFunction& function) TArraySizes* arraySizes = nullptr; acceptArraySpecifier(arraySizes); if (arraySizes) { - if (arraySizes->isImplicit()) { - parseContext.error(token.loc, "function parameter array cannot be implicitly sized", "", ""); + if (arraySizes->hasUnsized()) { + parseContext.error(token.loc, "function parameter requires array size", "[]", ""); return false; } - type->newArraySizes(*arraySizes); + type->transferArraySizes(arraySizes); } // post_decls @@ -2618,6 +2651,8 @@ bool HlslGrammar::acceptFunctionBody(TFunctionDeclarator& declarator, TIntermNod // bool HlslGrammar::acceptParenExpression(TIntermTyped*& expression) { + expression = nullptr; + // LEFT_PAREN if (! acceptTokenClass(EHTokLeftParen)) expected("("); @@ -2911,7 +2946,7 @@ bool HlslGrammar::acceptUnaryExpression(TIntermTyped*& node) TArraySizes* arraySizes = nullptr; acceptArraySpecifier(arraySizes); if (arraySizes != nullptr) - castType.newArraySizes(*arraySizes); + castType.transferArraySizes(arraySizes); TSourceLoc loc = token.loc; if (acceptTokenClass(EHTokRightParen)) { // We've matched "(type)" now, get the expression to cast @@ -3028,6 +3063,8 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) } if (! peekTokenClass(EHTokLeftParen)) { node = parseContext.handleVariable(idToken.loc, fullName); + if (node == nullptr) + return false; } else if (acceptFunctionCall(idToken.loc, *fullName, node, nullptr)) { // function_call (nothing else to do yet) } else { @@ -3238,6 +3275,9 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) case EHTokUintConstant: node = intermediate.addConstantUnion(token.u, token.loc, true); break; + case EHTokFloat16Constant: + node = intermediate.addConstantUnion(token.d, EbtFloat16, token.loc, true); + break; case EHTokFloatConstant: node = intermediate.addConstantUnion(token.d, EbtFloat, token.loc, true); break; @@ -3361,7 +3401,7 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement) statement = nullptr; // attributes - TAttributeMap attributes; + TAttributes attributes; acceptAttributes(attributes); // attributed_statement @@ -3433,7 +3473,7 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement) // | PATCHCONSTANTFUNC // | NUMTHREADS LEFT_PAREN x_size, y_size,z z_size RIGHT_PAREN // -void HlslGrammar::acceptAttributes(TAttributeMap& attributes) +void HlslGrammar::acceptAttributes(TAttributes& attributes) { // For now, accept the [ XXX(X) ] syntax, but drop all but // numthreads, which is used to set the CS local size. @@ -3504,9 +3544,16 @@ void HlslGrammar::acceptAttributes(TAttributeMap& attributes) return; } - // Add any values we found into the attribute map. This accepts - // (and ignores) values not mapping to a known TAttributeType; - attributes.setAttribute(nameSpace, attributeToken.string, expressions); + // Add any values we found into the attribute map. + if (attributeToken.string != nullptr) { + TAttributeType attributeType = parseContext.attributeFromName(nameSpace, *attributeToken.string); + if (attributeType == EatNone) + parseContext.warn(attributeToken.loc, "unrecognized attribute", attributeToken.string->c_str(), ""); + else { + TAttributeArgs attributeArgs = { attributeType, expressions }; + attributes.push_back(attributeArgs); + } + } } while (true); } @@ -3514,12 +3561,10 @@ void HlslGrammar::acceptAttributes(TAttributeMap& attributes) // : IF LEFT_PAREN expression RIGHT_PAREN statement // : IF LEFT_PAREN expression RIGHT_PAREN statement ELSE statement // -bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement, const TAttributeMap& attributes) +bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement, const TAttributes& attributes) { TSourceLoc loc = token.loc; - const TSelectionControl control = parseContext.handleSelectionControl(attributes); - // IF if (! acceptTokenClass(EHTokIf)) return false; @@ -3557,7 +3602,9 @@ bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement, const TAttri } // Put the pieces together - statement = intermediate.addSelection(condition, thenElse, loc, control); + statement = intermediate.addSelection(condition, thenElse, loc); + parseContext.handleSelectionAttributes(loc, statement->getAsSelectionNode(), attributes); + parseContext.popScope(); --parseContext.controlFlowNestingLevel; @@ -3567,13 +3614,11 @@ bool HlslGrammar::acceptSelectionStatement(TIntermNode*& statement, const TAttri // switch_statement // : SWITCH LEFT_PAREN expression RIGHT_PAREN compound_statement // -bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement, const TAttributeMap& attributes) +bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement, const TAttributes& attributes) { // SWITCH TSourceLoc loc = token.loc; - const TSelectionControl control = parseContext.handleSelectionControl(attributes); - if (! acceptTokenClass(EHTokSwitch)) return false; @@ -3593,7 +3638,8 @@ bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement, const TAttribut --parseContext.controlFlowNestingLevel; if (statementOkay) - statement = parseContext.addSwitch(loc, switchExpression, statement ? statement->getAsAggregate() : nullptr, control); + statement = parseContext.addSwitch(loc, switchExpression, statement ? statement->getAsAggregate() : nullptr, + attributes); parseContext.popSwitchSequence(); parseContext.popScope(); @@ -3607,7 +3653,7 @@ bool HlslGrammar::acceptSwitchStatement(TIntermNode*& statement, const TAttribut // | FOR LEFT_PAREN for_init_statement for_rest_statement RIGHT_PAREN statement // // Non-speculative, only call if it needs to be found; WHILE or DO or FOR already seen. -bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttributeMap& attributes) +bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttributes& attributes) { TSourceLoc loc = token.loc; TIntermTyped* condition = nullptr; @@ -3617,9 +3663,8 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri // WHILE or DO or FOR advanceToken(); - - const TLoopControl control = parseContext.handleLoopControl(attributes); + TIntermLoop* loopNode = nullptr; switch (loop) { case EHTokWhile: // so that something declared in the condition is scoped to the lifetime @@ -3645,9 +3690,9 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri parseContext.popScope(); --parseContext.controlFlowNestingLevel; - statement = intermediate.addLoop(statement, condition, nullptr, true, loc, control); - - return true; + loopNode = intermediate.addLoop(statement, condition, nullptr, true, loc); + statement = loopNode; + break; case EHTokDo: parseContext.nestLooping(); // this only needs to work right if no errors @@ -3666,7 +3711,6 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri } // LEFT_PAREN condition RIGHT_PAREN - TIntermTyped* condition; if (! acceptParenExpression(condition)) return false; condition = parseContext.convertConditionalExpression(loc, condition); @@ -3679,9 +3723,9 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri parseContext.unnestLooping(); --parseContext.controlFlowNestingLevel; - statement = intermediate.addLoop(statement, condition, 0, false, loc, control); - - return true; + loopNode = intermediate.addLoop(statement, condition, 0, false, loc); + statement = loopNode; + break; case EHTokFor: { @@ -3723,18 +3767,21 @@ bool HlslGrammar::acceptIterationStatement(TIntermNode*& statement, const TAttri return false; } - statement = intermediate.addForLoop(statement, initNode, condition, iterator, true, loc, control); + statement = intermediate.addForLoop(statement, initNode, condition, iterator, true, loc, loopNode); parseContext.popScope(); parseContext.unnestLooping(); --parseContext.controlFlowNestingLevel; - return true; + break; } default: return false; } + + parseContext.handleLoopAttributes(loc, loopNode, attributes); + return true; } // jump_statement @@ -3762,9 +3809,17 @@ bool HlslGrammar::acceptJumpStatement(TIntermNode*& statement) switch (jump) { case EHTokContinue: statement = intermediate.addBranch(EOpContinue, token.loc); + if (parseContext.loopNestingLevel == 0) { + expected("loop"); + return false; + } break; case EHTokBreak: statement = intermediate.addBranch(EOpBreak, token.loc); + if (parseContext.loopNestingLevel == 0 && parseContext.switchSequenceStack.size() == 0) { + expected("loop or switch"); + return false; + } break; case EHTokDiscard: statement = intermediate.addBranch(EOpKill, token.loc); @@ -4056,6 +4111,8 @@ const char* HlslGrammar::getTypeString(EHlslTokenClass tokenClass) const case EHTokMin10float: return "min10float"; case EHTokMin16int: return "min16int"; case EHTokMin12int: return "min12int"; + case EHTokConstantBuffer: return "ConstantBuffer"; + case EHTokLayout: return "layout"; default: return nullptr; } diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.h b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.h index 9d5380c1031..323f3b13f6b 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.h +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslGrammar.h @@ -43,7 +43,6 @@ namespace glslang { - class TAttributeMap; class TFunctionDeclarator; // Should just be the grammar aspect of HLSL. @@ -53,7 +52,7 @@ namespace glslang { public: HlslGrammar(HlslScanContext& scanner, HlslParseContext& parseContext) : HlslTokenStream(scanner), parseContext(parseContext), intermediate(parseContext.intermediate), - typeIdentifiers(false) { } + typeIdentifiers(false), unitNode(nullptr) { } virtual ~HlslGrammar() { } bool parse(); @@ -71,8 +70,8 @@ namespace glslang { bool acceptControlDeclaration(TIntermNode*& node); bool acceptSamplerDeclarationDX9(TType&); bool acceptSamplerState(); - bool acceptFullySpecifiedType(TType&); - bool acceptFullySpecifiedType(TType&, TIntermNode*& nodeList); + bool acceptFullySpecifiedType(TType&, const TAttributes&); + bool acceptFullySpecifiedType(TType&, TIntermNode*& nodeList, const TAttributes&, bool forbidDeclarators = false); bool acceptQualifier(TQualifier&); bool acceptLayoutQualifierList(TQualifier&); bool acceptType(TType&); @@ -117,10 +116,10 @@ namespace glslang { bool acceptScopedCompoundStatement(TIntermNode*&); bool acceptStatement(TIntermNode*&); bool acceptNestedStatement(TIntermNode*&); - void acceptAttributes(TAttributeMap&); - bool acceptSelectionStatement(TIntermNode*&, const TAttributeMap&); - bool acceptSwitchStatement(TIntermNode*&, const TAttributeMap&); - bool acceptIterationStatement(TIntermNode*&, const TAttributeMap&); + void acceptAttributes(TAttributes&); + bool acceptSelectionStatement(TIntermNode*&, const TAttributes&); + bool acceptSwitchStatement(TIntermNode*&, const TAttributes&); + bool acceptIterationStatement(TIntermNode*&, const TAttributes&); bool acceptJumpStatement(TIntermNode*&); bool acceptCaseLabel(TIntermNode*&); bool acceptDefaultLabel(TIntermNode*&); @@ -134,6 +133,7 @@ namespace glslang { HlslParseContext& parseContext; // state of parsing and helper functions for building the intermediate TIntermediate& intermediate; // the final product, the intermediate representation, includes the AST bool typeIdentifiers; // shader uses some types as identifiers + TIntermNode* unitNode; }; } // end namespace glslang diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.cpp b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.cpp index adb955f7cc9..b536cc9dd13 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.cpp @@ -65,10 +65,10 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int entryPointFunction(nullptr), entryPointFunctionBody(nullptr), gsStreamOutput(nullptr), - clipDistanceInput(nullptr), - cullDistanceInput(nullptr), clipDistanceOutput(nullptr), - cullDistanceOutput(nullptr) + cullDistanceOutput(nullptr), + clipDistanceInput(nullptr), + cullDistanceInput(nullptr) { globalUniformDefaults.clear(); globalUniformDefaults.layoutMatrix = ElmRowMajor; @@ -97,9 +97,6 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int if (language == EShLangGeometry) globalOutputDefaults.layoutStream = 0; - - if (spvVersion.spv == 0 || spvVersion.vulkan == 0) - infoSink.info << "ERROR: HLSL currently only supported when requesting SPIR-V for Vulkan.\n"; } HlslParseContext::~HlslParseContext() @@ -550,6 +547,13 @@ void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVectorgetAsSymbolNode() && wasFlattened(base)) { + if (index->getQualifier().isFrontEndConstant()) + checkIndex(loc, base->getType(), indexValue); + + if (base->getType().isScalarOrVec1()) + result = base; + else if (base->getAsSymbolNode() && wasFlattened(base)) { if (index->getQualifier().storage != EvqConst) error(loc, "Invalid variable index to flattened array", base->getAsSymbolNode()->getName().c_str(), ""); @@ -830,14 +839,13 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc, flattened = (result != base); } else { if (index->getQualifier().isFrontEndConstant()) { - if (base->getType().isImplicitlySizedArray()) - updateImplicitArraySize(loc, base, indexValue); + if (base->getType().isUnsizedArray()) + base->getWritableType().updateImplicitArraySize(indexValue + 1); else checkIndex(loc, base->getType(), indexValue); result = intermediate.addIndex(EOpIndexDirect, base, index, loc); - } else { + } else result = intermediate.addIndex(EOpIndexIndirect, base, index, loc); - } } } @@ -1096,7 +1104,7 @@ void HlslParseContext::splitBuiltIn(const TString& baseName, const TType& member TVariable* ioVar = makeInternalVariable(baseName + "." + memberType.getFieldName(), memberType); if (arraySizes != nullptr && !memberType.isArray()) - ioVar->getWritableType().newArraySizes(*arraySizes); + ioVar->getWritableType().copyArraySizes(*arraySizes); splitBuiltIns[tInterstageIoData(memberType.getQualifier().builtIn, outerQualifier.storage)] = ioVar; if (!isClipOrCullDistance(ioVar->getType())) @@ -1160,7 +1168,7 @@ bool HlslParseContext::shouldFlatten(const TType& type, TStorageQualifier qualif return (type.isArray() && intermediate.getFlattenUniformArrays() && topLevel) || (type.isStruct() && type.containsOpaque()); default: - return type.isStruct() && type.containsOpaque(); + return false; }; } @@ -1247,7 +1255,7 @@ int HlslParseContext::addFlattenedMember(const TVariable& variable, const TType& // inherited locations must be auto bumped, not replicated if (flattenData.nextLocation != TQualifier::layoutLocationEnd) { memberVariable->getWritableType().getQualifier().layoutLocation = flattenData.nextLocation; - flattenData.nextLocation += intermediate.computeTypeLocationSize(memberVariable->getType()); + flattenData.nextLocation += intermediate.computeTypeLocationSize(memberVariable->getType(), language); nextOutLocation = std::max(nextOutLocation, flattenData.nextLocation); } } @@ -1292,7 +1300,7 @@ int HlslParseContext::flattenStruct(const TVariable& variable, const TType& type name + "." + dereferencedType.getFieldName(), linkage, outerQualifier, builtInArraySizes == nullptr && dereferencedType.isArray() - ? &dereferencedType.getArraySizes() + ? dereferencedType.getArraySizes() : builtInArraySizes); flattenData.offsets[pos++] = mpos; } @@ -1309,7 +1317,7 @@ int HlslParseContext::flattenArray(const TVariable& variable, const TType& type, TFlattenData& flattenData, TString name, bool linkage, const TQualifier& outerQualifier) { - assert(type.isArray() && !type.isImplicitlySizedArray()); + assert(type.isSizedArray()); const int size = type.getOuterArraySize(); const TType dereferencedType(type, 0); @@ -1464,22 +1472,25 @@ bool HlslParseContext::isClipOrCullDistance(TBuiltInVariable builtIn) void HlslParseContext::fixBuiltInIoType(TType& type) { int requiredArraySize = 0; + int requiredVectorSize = 0; switch (type.getQualifier().builtIn) { case EbvTessLevelOuter: requiredArraySize = 4; break; case EbvTessLevelInner: requiredArraySize = 2; break; - case EbvTessCoord: + case EbvSampleMask: { - // tesscoord is always a vec3 for the IO variable, no matter the shader's - // declared vector size. - TType tessCoordType(type.getBasicType(), type.getQualifier().storage, 3); - - tessCoordType.getQualifier() = type.getQualifier(); - type.shallowCopy(tessCoordType); - + // Promote scalar to array of size 1. Leave existing arrays alone. + if (!type.isArray()) + requiredArraySize = 1; break; } + + case EbvWorkGroupId: requiredVectorSize = 3; break; + case EbvGlobalInvocationId: requiredVectorSize = 3; break; + case EbvLocalInvocationId: requiredVectorSize = 3; break; + case EbvTessCoord: requiredVectorSize = 3; break; + default: if (isClipOrCullDistance(type)) { const int loc = type.getQualifier().layoutLocation; @@ -1500,12 +1511,20 @@ void HlslParseContext::fixBuiltInIoType(TType& type) return; } + // Alter or set vector size as needed. + if (requiredVectorSize > 0) { + TType newType(type.getBasicType(), type.getQualifier().storage, requiredVectorSize); + newType.getQualifier() = type.getQualifier(); + + type.shallowCopy(newType); + } + // Alter or set array size as needed. if (requiredArraySize > 0) { if (!type.isArray() || type.getOuterArraySize() != requiredArraySize) { - TArraySizes arraySizes; - arraySizes.addInnerSize(requiredArraySize); - type.newArraySizes(arraySizes); + TArraySizes* arraySizes = new TArraySizes; + arraySizes->addInnerSize(requiredArraySize); + type.transferArraySizes(arraySizes); } } } @@ -1527,9 +1546,9 @@ void HlslParseContext::assignToInterface(TVariable& variable) int size; if (type.isArray() && qualifier.isArrayedIo(language)) { TType elementType(type, 0); - size = intermediate.computeTypeLocationSize(elementType); + size = intermediate.computeTypeLocationSize(elementType, language); } else - size = intermediate.computeTypeLocationSize(type); + size = intermediate.computeTypeLocationSize(type, language); if (qualifier.storage == EvqVaryingIn) { variable.getWritableType().getQualifier().layoutLocation = nextInLocation; @@ -1599,7 +1618,7 @@ void HlslParseContext::addStructBufferHiddenCounterParam(const TSourceLoc& loc, if (! hasStructBuffCounter(*param.type)) return; - const TString counterBlockName(getStructBuffCounterName(*param.name)); + const TString counterBlockName(intermediate.addCounterBufferName(*param.name)); TType counterType; counterBufferType(loc, counterType); @@ -1620,7 +1639,7 @@ void HlslParseContext::addStructBufferHiddenCounterParam(const TSourceLoc& loc, // Returns an aggregate of parameter-symbol nodes. // TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& loc, TFunction& function, - const TAttributeMap& attributes, + const TAttributes& attributes, TIntermNode*& entryPointTree) { currentCaller = function.getMangledName(); @@ -1717,169 +1736,218 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l } // Handle all [attrib] attribute for the shader entry point -void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const TAttributeMap& attributes) +void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const TAttributes& attributes) { - // Handle entry-point function attributes - const TIntermAggregate* numThreads = attributes[EatNumThreads]; - if (numThreads != nullptr) { - const TIntermSequence& sequence = numThreads->getSequence(); - - for (int lid = 0; lid < int(sequence.size()); ++lid) - intermediate.setLocalSize(lid, sequence[lid]->getAsConstantUnion()->getConstArray()[0].getIConst()); - } - - // MaxVertexCount - if (attributes.contains(EatMaxVertexCount)) { - int maxVertexCount; - - if (! attributes.getInt(EatMaxVertexCount, maxVertexCount)) { - error(loc, "invalid maxvertexcount", "", ""); - } else { - if (! intermediate.setVertices(maxVertexCount)) - error(loc, "cannot change previously set maxvertexcount attribute", "", ""); + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + switch (it->name) { + case EatNumThreads: + { + const TIntermSequence& sequence = it->args->getSequence(); + for (int lid = 0; lid < int(sequence.size()); ++lid) + intermediate.setLocalSize(lid, sequence[lid]->getAsConstantUnion()->getConstArray()[0].getIConst()); + break; } - } + case EatMaxVertexCount: + { + int maxVertexCount; - // Handle [patchconstantfunction("...")] - if (attributes.contains(EatPatchConstantFunc)) { - TString pcfName; - if (! attributes.getString(EatPatchConstantFunc, pcfName, 0, false)) { - error(loc, "invalid patch constant function", "", ""); - } else { - patchConstantFunctionName = pcfName; + if (! it->getInt(maxVertexCount)) { + error(loc, "invalid maxvertexcount", "", ""); + } else { + if (! intermediate.setVertices(maxVertexCount)) + error(loc, "cannot change previously set maxvertexcount attribute", "", ""); + } + break; } - } - - // Handle [domain("...")] - if (attributes.contains(EatDomain)) { - TString domainStr; - if (! attributes.getString(EatDomain, domainStr)) { - error(loc, "invalid domain", "", ""); - } else { - TLayoutGeometry domain = ElgNone; - - if (domainStr == "tri") { - domain = ElgTriangles; - } else if (domainStr == "quad") { - domain = ElgQuads; - } else if (domainStr == "isoline") { - domain = ElgIsolines; + case EatPatchConstantFunc: + { + TString pcfName; + if (! it->getString(pcfName, 0, false)) { + error(loc, "invalid patch constant function", "", ""); } else { - error(loc, "unsupported domain type", domainStr.c_str(), ""); - } - - if (language == EShLangTessEvaluation) { - if (! intermediate.setInputPrimitive(domain)) - error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), ""); - } else { - if (! intermediate.setOutputPrimitive(domain)) - error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), ""); + patchConstantFunctionName = pcfName; } + break; } - } - - // Handle [outputtopology("...")] - if (attributes.contains(EatOutputTopology)) { - TString topologyStr; - if (! attributes.getString(EatOutputTopology, topologyStr)) { - error(loc, "invalid outputtopology", "", ""); - } else { - TVertexOrder vertexOrder = EvoNone; - TLayoutGeometry primitive = ElgNone; - - if (topologyStr == "point") { - intermediate.setPointMode(); - } else if (topologyStr == "line") { - primitive = ElgIsolines; - } else if (topologyStr == "triangle_cw") { - vertexOrder = EvoCw; - primitive = ElgTriangles; - } else if (topologyStr == "triangle_ccw") { - vertexOrder = EvoCcw; - primitive = ElgTriangles; + case EatDomain: + { + // Handle [domain("...")] + TString domainStr; + if (! it->getString(domainStr)) { + error(loc, "invalid domain", "", ""); } else { - error(loc, "unsupported outputtopology type", topologyStr.c_str(), ""); - } + TLayoutGeometry domain = ElgNone; - if (vertexOrder != EvoNone) { - if (! intermediate.setVertexOrder(vertexOrder)) { - error(loc, "cannot change previously set outputtopology", - TQualifier::getVertexOrderString(vertexOrder), ""); + if (domainStr == "tri") { + domain = ElgTriangles; + } else if (domainStr == "quad") { + domain = ElgQuads; + } else if (domainStr == "isoline") { + domain = ElgIsolines; + } else { + error(loc, "unsupported domain type", domainStr.c_str(), ""); + } + + if (language == EShLangTessEvaluation) { + if (! intermediate.setInputPrimitive(domain)) + error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), ""); + } else { + if (! intermediate.setOutputPrimitive(domain)) + error(loc, "cannot change previously set domain", TQualifier::getGeometryString(domain), ""); } } - if (primitive != ElgNone) - intermediate.setOutputPrimitive(primitive); + break; } - } - - // Handle [partitioning("...")] - if (attributes.contains(EatPartitioning)) { - TString partitionStr; - if (! attributes.getString(EatPartitioning, partitionStr)) { - error(loc, "invalid partitioning", "", ""); - } else { - TVertexSpacing partitioning = EvsNone; - - if (partitionStr == "integer") { - partitioning = EvsEqual; - } else if (partitionStr == "fractional_even") { - partitioning = EvsFractionalEven; - } else if (partitionStr == "fractional_odd") { - partitioning = EvsFractionalOdd; - //} else if (partition == "pow2") { // TODO: currently nothing to map this to. + case EatOutputTopology: + { + // Handle [outputtopology("...")] + TString topologyStr; + if (! it->getString(topologyStr)) { + error(loc, "invalid outputtopology", "", ""); } else { - error(loc, "unsupported partitioning type", partitionStr.c_str(), ""); - } + TVertexOrder vertexOrder = EvoNone; + TLayoutGeometry primitive = ElgNone; - if (! intermediate.setVertexSpacing(partitioning)) - error(loc, "cannot change previously set partitioning", - TQualifier::getVertexSpacingString(partitioning), ""); + if (topologyStr == "point") { + intermediate.setPointMode(); + } else if (topologyStr == "line") { + primitive = ElgIsolines; + } else if (topologyStr == "triangle_cw") { + vertexOrder = EvoCw; + primitive = ElgTriangles; + } else if (topologyStr == "triangle_ccw") { + vertexOrder = EvoCcw; + primitive = ElgTriangles; + } else { + error(loc, "unsupported outputtopology type", topologyStr.c_str(), ""); + } + + if (vertexOrder != EvoNone) { + if (! intermediate.setVertexOrder(vertexOrder)) { + error(loc, "cannot change previously set outputtopology", + TQualifier::getVertexOrderString(vertexOrder), ""); + } + } + if (primitive != ElgNone) + intermediate.setOutputPrimitive(primitive); + } + break; } - } + case EatPartitioning: + { + // Handle [partitioning("...")] + TString partitionStr; + if (! it->getString(partitionStr)) { + error(loc, "invalid partitioning", "", ""); + } else { + TVertexSpacing partitioning = EvsNone; + + if (partitionStr == "integer") { + partitioning = EvsEqual; + } else if (partitionStr == "fractional_even") { + partitioning = EvsFractionalEven; + } else if (partitionStr == "fractional_odd") { + partitioning = EvsFractionalOdd; + //} else if (partition == "pow2") { // TODO: currently nothing to map this to. + } else { + error(loc, "unsupported partitioning type", partitionStr.c_str(), ""); + } - // Handle [outputcontrolpoints("...")] - if (attributes.contains(EatOutputControlPoints)) { - int ctrlPoints; - if (! attributes.getInt(EatOutputControlPoints, ctrlPoints)) { - error(loc, "invalid outputcontrolpoints", "", ""); - } else { - if (! intermediate.setVertices(ctrlPoints)) { - error(loc, "cannot change previously set outputcontrolpoints attribute", "", ""); + if (! intermediate.setVertexSpacing(partitioning)) + error(loc, "cannot change previously set partitioning", + TQualifier::getVertexSpacingString(partitioning), ""); } + break; + } + case EatOutputControlPoints: + { + // Handle [outputcontrolpoints("...")] + int ctrlPoints; + if (! it->getInt(ctrlPoints)) { + error(loc, "invalid outputcontrolpoints", "", ""); + } else { + if (! intermediate.setVertices(ctrlPoints)) { + error(loc, "cannot change previously set outputcontrolpoints attribute", "", ""); + } + } + break; + } + case EatBuiltIn: + case EatLocation: + // tolerate these because of dual use of entrypoint and type attributes + break; + default: + warn(loc, "attribute does not apply to entry point", "", ""); + break; } } } // Update the given type with any type-like attribute information in the // attributes. -void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, TType& type) +void HlslParseContext::transferTypeAttributes(const TSourceLoc& loc, const TAttributes& attributes, TType& type, + bool allowEntry) { - // location + if (attributes.size() == 0) + return; + int value; - if (attributes.getInt(EatLocation, value)) - type.getQualifier().layoutLocation = value; - - // binding - if (attributes.getInt(EatBinding, value)) { - type.getQualifier().layoutBinding = value; - type.getQualifier().layoutSet = 0; + TString builtInString; + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + switch (it->name) { + case EatLocation: + // location + if (it->getInt(value)) + type.getQualifier().layoutLocation = value; + break; + case EatBinding: + // binding + if (it->getInt(value)) { + type.getQualifier().layoutBinding = value; + type.getQualifier().layoutSet = 0; + } + // set + if (it->getInt(value, 1)) + type.getQualifier().layoutSet = value; + break; + case EatGlobalBinding: + // global cbuffer binding + if (it->getInt(value)) + globalUniformBinding = value; + // global cbuffer binding + if (it->getInt(value, 1)) + globalUniformSet = value; + break; + case EatInputAttachment: + // input attachment + if (it->getInt(value)) + type.getQualifier().layoutAttachment = value; + break; + case EatBuiltIn: + // PointSize built-in + if (it->getString(builtInString, 0, false)) { + if (builtInString == "PointSize") + type.getQualifier().builtIn = EbvPointSize; + } + break; + case EatPushConstant: + // push_constant + type.getQualifier().layoutPushConstant = true; + break; + case EatConstantId: + // specialization constant + if (it->getInt(value)) { + TSourceLoc loc; + loc.init(); + setSpecConstantId(loc, type.getQualifier(), value); + } + break; + default: + if (! allowEntry) + warn(loc, "attribute does not apply to a type", "", ""); + break; + } } - - // set - if (attributes.getInt(EatBinding, value, 1)) - type.getQualifier().layoutSet = value; - - // global cbuffer binding - if (attributes.getInt(EatGlobalBinding, value)) - globalUniformBinding = value; - - // global cbuffer binding - if (attributes.getInt(EatGlobalBinding, value, 1)) - globalUniformSet = value; - - // input attachment - if (attributes.getInt(EatInputAttachment, value)) - type.getQualifier().layoutAttachment = value; } // @@ -1915,7 +1983,7 @@ void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, T // a subtree that creates the entry point. // TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunction& userFunction, - const TAttributeMap& attributes) + const TAttributes& attributes) { // Return true if this is a tessellation patch constant function input to a domain shader. const auto isDsPcfInput = [this](const TType& type) { @@ -2215,9 +2283,9 @@ void HlslParseContext::remapEntryPointIO(TFunction& function, TVariable*& return outputType.shallowCopy(function.getType()); // vertices has necessarily already been set when handling entry point attributes. - TArraySizes arraySizes; - arraySizes.addInnerSize(intermediate.getVertices()); - outputType.newArraySizes(arraySizes); + TArraySizes* arraySizes = new TArraySizes; + arraySizes->addInnerSize(intermediate.getVertices()); + outputType.transferArraySizes(arraySizes); clearUniformInputOutput(function.getWritableType().getQualifier()); returnValue = makeIoVariable("@entryPointOutput", outputType, EvqVaryingOut); @@ -2291,6 +2359,63 @@ void HlslParseContext::handleFunctionArgument(TFunction* function, arguments = newArg; } +// Position may require special handling: we can optionally invert Y. +// See: https://github.com/KhronosGroup/glslang/issues/1173 +// https://github.com/KhronosGroup/glslang/issues/494 +TIntermTyped* HlslParseContext::assignPosition(const TSourceLoc& loc, TOperator op, + TIntermTyped* left, TIntermTyped* right) +{ + // If we are not asked for Y inversion, use a plain old assign. + if (!intermediate.getInvertY()) + return intermediate.addAssign(op, left, right, loc); + + // If we get here, we should invert Y. + TIntermAggregate* assignList = nullptr; + + // If this is a complex rvalue, we don't want to dereference it many times. Create a temporary. + TVariable* rhsTempVar = nullptr; + rhsTempVar = makeInternalVariable("@position", right->getType()); + rhsTempVar->getWritableType().getQualifier().makeTemporary(); + + { + TIntermTyped* rhsTempSym = intermediate.addSymbol(*rhsTempVar, loc); + assignList = intermediate.growAggregate(assignList, + intermediate.addAssign(EOpAssign, rhsTempSym, right, loc), loc); + } + + // pos.y = -pos.y + { + const int Y = 1; + + TIntermTyped* tempSymL = intermediate.addSymbol(*rhsTempVar, loc); + TIntermTyped* tempSymR = intermediate.addSymbol(*rhsTempVar, loc); + TIntermTyped* index = intermediate.addConstantUnion(Y, loc); + + TIntermTyped* lhsElement = intermediate.addIndex(EOpIndexDirect, tempSymL, index, loc); + TIntermTyped* rhsElement = intermediate.addIndex(EOpIndexDirect, tempSymR, index, loc); + + const TType derefType(right->getType(), 0); + + lhsElement->setType(derefType); + rhsElement->setType(derefType); + + TIntermTyped* yNeg = intermediate.addUnaryMath(EOpNegative, rhsElement, loc); + + assignList = intermediate.growAggregate(assignList, intermediate.addAssign(EOpAssign, lhsElement, yNeg, loc)); + } + + // Assign the rhs temp (now with Y inversion) to the final output + { + TIntermTyped* rhsTempSym = intermediate.addSymbol(*rhsTempVar, loc); + assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, left, rhsTempSym, loc)); + } + + assert(assignList != nullptr); + assignList->setOperator(EOpSequence); + + return assignList; +} + // Clip and cull distance require special handling due to a semantic mismatch. In HLSL, // these can be float scalar, float vector, or arrays of float scalar or float vector. // In SPIR-V, they are arrays of scalar floats in all cases. We must copy individual components @@ -2397,11 +2522,11 @@ TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc clipCullType.getQualifier() = clipCullNode->getType().getQualifier(); // Create required array dimension - TArraySizes arraySizes; + TArraySizes* arraySizes = new TArraySizes; if (isImplicitlyArrayed) - arraySizes.addInnerSize(requiredOuterArraySize); - arraySizes.addInnerSize(requiredInnerArraySize); - clipCullType.newArraySizes(arraySizes); + arraySizes->addInnerSize(requiredOuterArraySize); + arraySizes->addInnerSize(requiredInnerArraySize); + clipCullType.transferArraySizes(arraySizes); // Obtain symbol name: we'll use that for the symbol we introduce. TIntermSymbol* sym = clipCullNode->getAsSymbolNode(); @@ -2556,6 +2681,12 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op wasSplit(binaryNode->getLeft()); }; + // Return true if this stage assigns clip position with potentially inverted Y + const auto assignsClipPos = [this](const TIntermTyped* node) -> bool { + return node->getType().getQualifier().builtIn == EbvPosition && + (language == EShLangVertex || language == EShLangGeometry || language == EShLangTessEvaluation); + }; + const bool isSplitLeft = wasSplit(left) || indexesSplit(left); const bool isSplitRight = wasSplit(right) || indexesSplit(right); @@ -2571,6 +2702,18 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op const int semanticId = (isOutput ? left : right)->getType().getQualifier().layoutLocation; return assignClipCullDistance(loc, op, semanticId, left, right); + } else if (assignsClipPos(left)) { + // Position can require special handling: see comment above assignPosition + return assignPosition(loc, op, left, right); + } else if (left->getQualifier().builtIn == EbvSampleMask) { + // Certain builtins are required to be arrayed outputs in SPIR-V, but may internally be scalars + // in the shader. Copy the scalar RHS into the LHS array element zero, if that happens. + if (left->isArray() && !right->isArray()) { + const TType derefType(left->getType(), 0); + left = intermediate.addIndex(EOpIndexDirect, left, intermediate.addConstantUnion(0, loc), loc); + left->setType(derefType); + // Fall through to add assign. + } } return intermediate.addAssign(op, left, right, loc); @@ -2655,13 +2798,23 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op // copy from interstage IO built-in if needed subTree = intermediate.addSymbol(*builtInVar); - // Arrayness of builtIn symbols isn't handled by the normal recursion: - // it's been extracted and moved to the built-in. - if (subTree->getType().isArray() && !arrayElement.empty()) { - const TType splitDerefType(subTree->getType(), arrayElement.back()); - subTree = intermediate.addIndex(EOpIndexDirect, subTree, - intermediate.addConstantUnion(arrayElement.back(), loc), loc); - subTree->setType(splitDerefType); + if (subTree->getType().isArray()) { + // Arrayness of builtIn symbols isn't handled by the normal recursion: + // it's been extracted and moved to the built-in. + if (!arrayElement.empty()) { + const TType splitDerefType(subTree->getType(), arrayElement.back()); + subTree = intermediate.addIndex(EOpIndexDirect, subTree, + intermediate.addConstantUnion(arrayElement.back(), loc), loc); + subTree->setType(splitDerefType); + } else if (splitNode->getAsOperator() != nullptr && (splitNode->getAsOperator()->getOp() == EOpIndexIndirect)) { + // This might also be a stage with arrayed outputs, in which case there's an index + // operation we should transfer to the output builtin. + + const TType splitDerefType(subTree->getType(), 0); + subTree = intermediate.addIndex(splitNode->getAsOperator()->getOp(), subTree, + splitNode->getAsBinaryNode()->getRight(), loc); + subTree->setType(splitDerefType); + } } } else if (flattened && !shouldFlatten(derefType, isLeft ? leftStorage : rightStorage, false)) { if (isLeft) @@ -2782,7 +2935,10 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op subSplitLeft, subSplitRight); assignList = intermediate.growAggregate(assignList, clipCullAssign, loc); - + } else if (assignsClipPos(subSplitLeft)) { + // Position can require special handling: see comment above assignPosition + TIntermTyped* positionAssign = assignPosition(loc, op, subSplitLeft, subSplitRight); + assignList = intermediate.growAggregate(assignList, positionAssign, loc); } else if (!shouldFlattenSubsetLeft && !shouldFlattenSubsetRight && !typeL.containsBuiltIn() && !typeR.containsBuiltIn()) { // If this is the final flattening (no nested types below to flatten) @@ -3025,8 +3181,8 @@ bool HlslParseContext::hasStructBuffCounter(const TType& type) const void HlslParseContext::counterBufferType(const TSourceLoc& loc, TType& type) { // Counter type - TType* counterType = new TType(EbtInt, EvqBuffer); - counterType->setFieldName("@count"); + TType* counterType = new TType(EbtUint, EvqBuffer); + counterType->setFieldName(intermediate.implicitCounterName); TTypeList* blockStruct = new TTypeList; TTypeLoc member = { counterType, loc }; @@ -3039,12 +3195,6 @@ void HlslParseContext::counterBufferType(const TSourceLoc& loc, TType& type) shareStructBufferType(type); } -// knowledge of how to construct block name, in one place instead of N places. -TString HlslParseContext::getStructBuffCounterName(const TString& blockName) const -{ - return blockName + "@count"; -} - // declare counter for a structured buffer type void HlslParseContext::declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name) { @@ -3058,9 +3208,9 @@ void HlslParseContext::declareStructBufferCounter(const TSourceLoc& loc, const T TType blockType; counterBufferType(loc, blockType); - TString* blockName = new TString(getStructBuffCounterName(name)); + TString* blockName = new TString(intermediate.addCounterBufferName(name)); - // Counter buffer does not have its own counter buffer. TODO: there should be a better way to track this. + // Counter buffer is not yet in use structBufferCounter[*blockName] = false; shareStructBufferType(blockType); @@ -3074,7 +3224,7 @@ TIntermTyped* HlslParseContext::getStructBufferCounter(const TSourceLoc& loc, TI if (buffer == nullptr || ! isStructBufferType(buffer->getType())) return nullptr; - const TString counterBlockName(getStructBuffCounterName(buffer->getAsSymbolNode()->getName())); + const TString counterBlockName(intermediate.addCounterBufferName(buffer->getAsSymbolNode()->getName())); // Mark the counter as being used structBufferCounter[counterBlockName] = true; @@ -3083,11 +3233,10 @@ TIntermTyped* HlslParseContext::getStructBufferCounter(const TSourceLoc& loc, TI TIntermTyped* index = intermediate.addConstantUnion(0, loc); // index to counter inside block struct TIntermTyped* counterMember = intermediate.addIndex(EOpIndexDirectStruct, counterVar, index, loc); - counterMember->setType(TType(EbtInt)); + counterMember->setType(TType(EbtUint)); return counterMember; } - // // Decompose structure buffer methods into AST // @@ -3117,7 +3266,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte // Some methods require a hidden internal counter, obtained via getStructBufferCounter(). // This lambda adds something to it and returns the old value. const auto incDecCounter = [&](int incval) -> TIntermTyped* { - TIntermTyped* incrementValue = intermediate.addConstantUnion(incval, loc, true); + TIntermTyped* incrementValue = intermediate.addConstantUnion(static_cast(incval), loc, true); TIntermTyped* counter = getStructBufferCounter(loc, bufferObj); // obtain the counter member if (counter == nullptr) @@ -3213,7 +3362,13 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte const TOperator idxOp = (offsetIdx->getQualifier().storage == EvqConst) ? EOpIndexDirect : EOpIndexIndirect; - vec = intermediate.growAggregate(vec, intermediate.addIndex(idxOp, argArray, offsetIdx, loc)); + TIntermTyped* indexVal = intermediate.addIndex(idxOp, argArray, offsetIdx, loc); + + TType derefType(argArray->getType(), 0); + derefType.getQualifier().makeTemporary(); + indexVal->setType(derefType); + + vec = intermediate.growAggregate(vec, indexVal); } vec->setType(TType(argArray->getBasicType(), EvqTemporary, size)); @@ -3238,7 +3393,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte // Index into the array to find the item being loaded. // Byte address buffers index in bytes (only multiples of 4 permitted... not so much a byte address - // buffer then, but that's what it calls itself. + // buffer then, but that's what it calls itself). int size = 0; @@ -3274,8 +3429,17 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte : EOpIndexIndirect; TIntermTyped* lValue = intermediate.addIndex(idxOp, argArray, offsetIdx, loc); - TIntermTyped* rValue = (size == 1) ? argValue : - intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc); + const TType derefType(argArray->getType(), 0); + lValue->setType(derefType); + + TIntermTyped* rValue; + if (size == 1) { + rValue = argValue; + } else { + rValue = intermediate.addIndex(EOpIndexDirect, argValue, idxConst, loc); + const TType indexType(argValue->getType(), 0); + rValue->setType(indexType); + } TIntermTyped* assign = intermediate.addAssign(EOpAssign, lValue, rValue, loc); @@ -3297,24 +3461,24 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte TIntermAggregate* body = nullptr; // Length output: - if (argArray->getType().isRuntimeSizedArray()) { - TIntermTyped* lengthCall = intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, argArray, - argNumItems->getType()); - TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems, lengthCall, loc); - body = intermediate.growAggregate(body, assign, loc); - } else { + if (argArray->getType().isSizedArray()) { const int length = argArray->getType().getOuterArraySize(); TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems, intermediate.addConstantUnion(length, loc, true), loc); body = intermediate.growAggregate(body, assign, loc); + } else { + TIntermTyped* lengthCall = intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, argArray, + argNumItems->getType()); + TIntermTyped* assign = intermediate.addAssign(EOpAssign, argNumItems, lengthCall, loc); + body = intermediate.growAggregate(body, assign, loc); } // Stride output: if (argStride != nullptr) { int size; int stride; - intermediate.getBaseAlignment(argArray->getType(), size, stride, false, - argArray->getType().getQualifier().layoutMatrix == ElmRowMajor); + intermediate.getMemberAlignment(argArray->getType(), size, stride, argArray->getType().getQualifier().layoutPacking, + argArray->getType().getQualifier().layoutMatrix == ElmRowMajor); TIntermTyped* assign = intermediate.addAssign(EOpAssign, argStride, intermediate.addConstantUnion(stride, loc, true), loc); @@ -3467,9 +3631,9 @@ TIntermConstantUnion* HlslParseContext::getSamplePosArray(int count) TType retType(EbtFloat, EvqConst, 2); if (numSamples != 1) { - TArraySizes arraySizes; - arraySizes.addInnerSize(numSamples); - retType.newArraySizes(arraySizes); + TArraySizes* arraySizes = new TArraySizes; + arraySizes->addInnerSize(numSamples); + retType.transferArraySizes(arraySizes); } return new TIntermConstantUnion(*values, retType); @@ -4166,9 +4330,9 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType // we construct an array from the separate args. if (hasOffset4) { TType arrayType(EbtInt, EvqTemporary, 2); - TArraySizes arraySizes; - arraySizes.addInnerSize(4); - arrayType.newArraySizes(arraySizes); + TArraySizes* arraySizes = new TArraySizes; + arraySizes->addInnerSize(4); + arrayType.transferArraySizes(arraySizes); TIntermAggregate* initList = new TIntermAggregate(EOpNull); @@ -4210,16 +4374,13 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType txquerylod->getSequence().push_back(txcombine); txquerylod->getSequence().push_back(argCoord); - TIntermTyped* lodComponent = intermediate.addConstantUnion(0, loc, true); + TIntermTyped* lodComponent = intermediate.addConstantUnion( + op == EOpMethodCalculateLevelOfDetail ? 0 : 1, + loc, true); TIntermTyped* lodComponentIdx = intermediate.addIndex(EOpIndexDirect, txquerylod, lodComponent, loc); lodComponentIdx->setType(TType(EbtFloat, EvqTemporary, 1)); - node = lodComponentIdx; - // We cannot currently obtain the unclamped LOD - if (op == EOpMethodCalculateLevelOfDetailUnclamped) - error(loc, "unimplemented: CalculateLevelOfDetailUnclamped", "", ""); - break; } @@ -4340,23 +4501,18 @@ void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTy emit->setLoc(loc); emit->setType(TType(EbtVoid)); - // find the matching output - if (gsStreamOutput == nullptr) { - error(loc, "unable to find output symbol for Append()", "", ""); - return; - } - - sequence = intermediate.growAggregate(sequence, - handleAssign(loc, EOpAssign, - intermediate.addSymbol(*gsStreamOutput, loc), - argAggregate->getSequence()[1]->getAsTyped()), - loc); + TIntermTyped* data = argAggregate->getSequence()[1]->getAsTyped(); + // This will be patched in finalization during finalizeAppendMethods() + sequence = intermediate.growAggregate(sequence, data, loc); sequence = intermediate.growAggregate(sequence, emit); sequence->setOperator(EOpSequence); sequence->setLoc(loc); sequence->setType(TType(EbtVoid)); + + gsAppends.push_back({sequence, loc}); + node = sequence; } break; @@ -4407,6 +4563,22 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*& return imageAggregate != nullptr && imageAggregate->getOp() == EOpImageLoad; }; + const auto lookupBuiltinVariable = [&](const char* name, TBuiltInVariable builtin, TType& type) -> TIntermTyped* { + TSymbol* symbol = symbolTable.find(name); + if (nullptr == symbol) { + type.getQualifier().builtIn = builtin; + + TVariable* variable = new TVariable(new TString(name), type); + + symbolTable.insert(*variable); + + symbol = symbolTable.find(name); + assert(symbol && "Inserted symbol could not be found!"); + } + + return intermediate.addSymbol(*(symbol->getAsVariable()), loc); + }; + // HLSL intrinsics can be pass through to native AST opcodes, or decomposed here to existing AST // opcodes for compatibility with existing software stacks. static const bool decomposeHlslIntrinsics = true; @@ -4652,6 +4824,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*& } else { // Set the matching operator. Since output is absent, this is all we need to do. node->getAsAggregate()->setOperator(atomicOp); + node->setType(atomic->getType()); } } @@ -4963,7 +5136,65 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*& break; } - + case EOpWaveGetLaneCount: + { + // Mapped to gl_SubgroupSize builtin (We preprend @ to the symbol + // so that it inhabits the symbol table, but has a user-invalid name + // in-case some source HLSL defined the symbol also). + TType type(EbtUint, EvqVaryingIn); + node = lookupBuiltinVariable("@gl_SubgroupSize", EbvSubgroupSize2, type); + break; + } + case EOpWaveGetLaneIndex: + { + // Mapped to gl_SubgroupInvocationID builtin (We preprend @ to the + // symbol so that it inhabits the symbol table, but has a + // user-invalid name in-case some source HLSL defined the symbol + // also). + TType type(EbtUint, EvqVaryingIn); + node = lookupBuiltinVariable("@gl_SubgroupInvocationID", EbvSubgroupInvocation2, type); + break; + } + case EOpWaveActiveCountBits: + { + // Mapped to subgroupBallotBitCount(subgroupBallot()) builtin + + // uvec4 type. + TType uvec4Type(EbtUint, EvqTemporary, 4); + + // Get the uvec4 return from subgroupBallot(). + TIntermTyped* res = intermediate.addBuiltInFunctionCall(loc, + EOpSubgroupBallot, true, arguments, uvec4Type); + + // uint type. + TType uintType(EbtUint, EvqTemporary); + + node = intermediate.addBuiltInFunctionCall(loc, + EOpSubgroupBallotBitCount, true, res, uintType); + + break; + } + case EOpWavePrefixCountBits: + { + // Mapped to subgroupBallotInclusiveBitCount(subgroupBallot()) + // builtin + + // uvec4 type. + TType uvec4Type(EbtUint, EvqTemporary, 4); + + // Get the uvec4 return from subgroupBallot(). + TIntermTyped* res = intermediate.addBuiltInFunctionCall(loc, + EOpSubgroupBallot, true, arguments, uvec4Type); + + // uint type. + TType uintType(EbtUint, EvqTemporary); + + node = intermediate.addBuiltInFunctionCall(loc, + EOpSubgroupBallotInclusiveBitCount, true, res, uintType); + + break; + } + default: break; // most pass through unchanged } @@ -5008,6 +5239,12 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct bool builtIn = false; int thisDepth = 0; + // For mat mul, the situation is unusual: we have to compare vector sizes to mat row or col sizes, + // and clamp the opposite arg. Since that's complex, we farm it off to a separate method. + // It doesn't naturally fall out of processing an argument at a time in isolation. + if (function->getName() == "mul") + addGenMulArgumentConversion(loc, *function, arguments); + TIntermAggregate* aggregate = arguments ? arguments->getAsAggregate() : nullptr; // TODO: this needs improvement: there's no way at present to look up a signature in @@ -5169,6 +5406,83 @@ void HlslParseContext::pushFrontArguments(TIntermTyped* front, TIntermTyped*& ar arguments = intermediate.growAggregate(front, arguments); } +// +// HLSL allows mismatched dimensions on vec*mat, mat*vec, vec*vec, and mat*mat. This is a +// situation not well suited to resolution in intrinsic selection, but we can do so here, since we +// can look at both arguments insert explicit shape changes if required. +// +void HlslParseContext::addGenMulArgumentConversion(const TSourceLoc& loc, TFunction& call, TIntermTyped*& args) +{ + TIntermAggregate* argAggregate = args ? args->getAsAggregate() : nullptr; + + if (argAggregate == nullptr || argAggregate->getSequence().size() != 2) { + // It really ought to have two arguments. + error(loc, "expected: mul arguments", "", ""); + return; + } + + TIntermTyped* arg0 = argAggregate->getSequence()[0]->getAsTyped(); + TIntermTyped* arg1 = argAggregate->getSequence()[1]->getAsTyped(); + + if (arg0->isVector() && arg1->isVector()) { + // For: + // vec * vec: it's handled during intrinsic selection, so while we could do it here, + // we can also ignore it, which is easier. + } else if (arg0->isVector() && arg1->isMatrix()) { + // vec * mat: we clamp the vec if the mat col is smaller, else clamp the mat col. + if (arg0->getVectorSize() < arg1->getMatrixCols()) { + // vec is smaller, so truncate larger mat dimension + const TType truncType(arg1->getBasicType(), arg1->getQualifier().storage, arg1->getQualifier().precision, + 0, arg0->getVectorSize(), arg1->getMatrixRows()); + arg1 = addConstructor(loc, arg1, truncType); + } else if (arg0->getVectorSize() > arg1->getMatrixCols()) { + // vec is larger, so truncate vec to mat size + const TType truncType(arg0->getBasicType(), arg0->getQualifier().storage, arg0->getQualifier().precision, + arg1->getMatrixCols()); + arg0 = addConstructor(loc, arg0, truncType); + } + } else if (arg0->isMatrix() && arg1->isVector()) { + // mat * vec: we clamp the vec if the mat col is smaller, else clamp the mat col. + if (arg1->getVectorSize() < arg0->getMatrixRows()) { + // vec is smaller, so truncate larger mat dimension + const TType truncType(arg0->getBasicType(), arg0->getQualifier().storage, arg0->getQualifier().precision, + 0, arg0->getMatrixCols(), arg1->getVectorSize()); + arg0 = addConstructor(loc, arg0, truncType); + } else if (arg1->getVectorSize() > arg0->getMatrixRows()) { + // vec is larger, so truncate vec to mat size + const TType truncType(arg1->getBasicType(), arg1->getQualifier().storage, arg1->getQualifier().precision, + arg0->getMatrixRows()); + arg1 = addConstructor(loc, arg1, truncType); + } + } else if (arg0->isMatrix() && arg1->isMatrix()) { + // mat * mat: we clamp the smaller inner dimension to match the other matrix size. + // Remember, HLSL Mrc = GLSL/SPIRV Mcr. + if (arg0->getMatrixRows() > arg1->getMatrixCols()) { + const TType truncType(arg0->getBasicType(), arg0->getQualifier().storage, arg0->getQualifier().precision, + 0, arg0->getMatrixCols(), arg1->getMatrixCols()); + arg0 = addConstructor(loc, arg0, truncType); + } else if (arg0->getMatrixRows() < arg1->getMatrixCols()) { + const TType truncType(arg1->getBasicType(), arg1->getQualifier().storage, arg1->getQualifier().precision, + 0, arg0->getMatrixRows(), arg1->getMatrixRows()); + arg1 = addConstructor(loc, arg1, truncType); + } + } else { + // It's something with scalars: we'll just leave it alone. Function selection will handle it + // downstream. + } + + // Warn if we altered one of the arguments + if (arg0 != argAggregate->getSequence()[0] || arg1 != argAggregate->getSequence()[1]) + warn(loc, "mul() matrix size mismatch", "", ""); + + // Put arguments back. (They might be unchanged, in which case this is harmless). + argAggregate->getSequence()[0] = arg0; + argAggregate->getSequence()[1] = arg1; + + call[0].type = &arg0->getWritableType(); + call[1].type = &arg1->getWritableType(); +} + // // Add any needed implicit conversions for function-call arguments to input parameters. // @@ -5434,12 +5748,11 @@ void HlslParseContext::addStructBuffArguments(const TSourceLoc& loc, TIntermAggr TType counterType; counterBufferType(loc, counterType); - const TString counterBlockName(getStructBuffCounterName(blockSym->getName())); + const TString counterBlockName(intermediate.addCounterBufferName(blockSym->getName())); TVariable* variable = makeInternalVariable(counterBlockName, counterType); - // Mark this buffer as requiring a counter block. TODO: there should be a better - // way to track it. + // Mark this buffer's counter block as being in use structBufferCounter[counterBlockName] = true; TIntermSymbol* sym = intermediate.addSymbol(*variable, loc); @@ -5681,7 +5994,8 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu break; } - qualifier.builtIn = builtIn; + if (qualifier.builtIn == EbvNone) + qualifier.builtIn = builtIn; qualifier.semanticName = intermediate.addSemanticName(upperCase); } @@ -5752,15 +6066,27 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi } } - // TODO: learn what all these really mean and how they interact with regNumber and subComponent + // more information about register types see + // https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-variable-register const std::vector& resourceInfo = intermediate.getResourceSetBinding(); switch (std::tolower(desc[0])) { - case 'b': - case 't': case 'c': + // c register is the register slot in the global const buffer + // each slot is a vector of 4 32 bit components + qualifier.layoutOffset = regNumber * 4 * 4; + break; + // const buffer register slot + case 'b': + // textrues and structured buffers + case 't': + // samplers case 's': + // uav resources case 'u': - qualifier.layoutBinding = regNumber + subComponent; + // if nothing else has set the binding, do so now + // (other mechanisms override this one) + if (!qualifier.hasBinding()) + qualifier.layoutBinding = regNumber + subComponent; // This handles per-register layout sets numbers. For the global mode which sets // every symbol to the same value, see setLinkageLayoutSets(). @@ -5794,7 +6120,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi return true; }; - if (spaceDesc) { + // if nothing else has set the set, do so now + // (other mechanisms override this one) + if (spaceDesc && !qualifier.hasSet()) { if (! crackSpace()) { error(loc, "expected spaceN", "register", ""); return; @@ -5924,7 +6252,8 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node bool constructingMatrix = false; switch (op) { case EOpConstructTextureSampler: - return constructorTextureSamplerError(loc, function); + error(loc, "unhandled texture constructor", "constructor", ""); + return true; case EOpConstructMat2x2: case EOpConstructMat2x3: case EOpConstructMat2x4: @@ -5988,7 +6317,7 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node bool arrayArg = false; for (int arg = 0; arg < function.getParamCount(); ++arg) { if (function[arg].type->isArray()) { - if (! function[arg].type->isExplicitlySizedArray()) { + if (function[arg].type->isUnsizedArray()) { // Can't construct from an unsized array. error(loc, "array argument must be sized", "constructor", ""); return true; @@ -6023,11 +6352,10 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node return true; } - if (type.isImplicitlySizedArray()) { + if (type.isUnsizedArray()) { // auto adapt the constructor type to the number of arguments type.changeOuterArraySize(function.getParamCount()); - } else if (type.getOuterArraySize() != function.getParamCount() && - type.computeNumComponents() > size) { + } else if (type.getOuterArraySize() != function.getParamCount() && type.computeNumComponents() > size) { error(loc, "array constructor needs one argument per array element", "constructor", ""); return true; } @@ -6036,21 +6364,21 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node // Types have to match, but we're still making the type. // Finish making the type, and the comparison is done later // when checking for conversion. - TArraySizes& arraySizes = type.getArraySizes(); + TArraySizes& arraySizes = *type.getArraySizes(); // At least the dimensionalities have to match. if (! function[0].type->isArray() || - arraySizes.getNumDims() != function[0].type->getArraySizes().getNumDims() + 1) { + arraySizes.getNumDims() != function[0].type->getArraySizes()->getNumDims() + 1) { error(loc, "array constructor argument not correct type to construct array element", "constructor", ""); return true; } - if (arraySizes.isInnerImplicit()) { + if (arraySizes.isInnerUnsized()) { // "Arrays of arrays ..., and the size for any dimension is optional" // That means we need to adopt (from the first argument) the other array sizes into the type. for (int d = 1; d < arraySizes.getNumDims(); ++d) { if (arraySizes.getDimSize(d) == UnsizedArraySize) { - arraySizes.setDimSize(d, function[0].type->getArraySizes().getDimSize(d - 1)); + arraySizes.setDimSize(d, function[0].type->getArraySizes()->getDimSize(d - 1)); } } } @@ -6077,12 +6405,18 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node return true; } - if (op == EOpConstructStruct && ! type.isArray() && isScalarConstructor(node)) - return false; + if (op == EOpConstructStruct && ! type.isArray()) { + if (isScalarConstructor(node)) + return false; - if (op == EOpConstructStruct && ! type.isArray() && (int)type.getStruct()->size() != function.getParamCount()) { - error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", ""); - return true; + // Self-type construction: e.g, we can construct a struct from a single identically typed object. + if (function.getParamCount() == 1 && type == *function[0].type) + return false; + + if ((int)type.getStruct()->size() != function.getParamCount()) { + error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", ""); + return true; + } } if ((op != EOpConstructStruct && size != 1 && size < type.computeNumComponents()) || @@ -6111,67 +6445,6 @@ bool HlslParseContext::isScalarConstructor(const TIntermNode* node) (node->getAsAggregate() == nullptr || node->getAsAggregate()->getOp() != EOpNull); } -// Verify all the correct semantics for constructing a combined texture/sampler. -// Return true if the semantics are incorrect. -bool HlslParseContext::constructorTextureSamplerError(const TSourceLoc& loc, const TFunction& function) -{ - TString constructorName = function.getType().getBasicTypeString(); // TODO: performance: should not be making copy; interface needs to change - const char* token = constructorName.c_str(); - - // exactly two arguments needed - if (function.getParamCount() != 2) { - error(loc, "sampler-constructor requires two arguments", token, ""); - return true; - } - - // For now, not allowing arrayed constructors, the rest of this function - // is set up to allow them, if this test is removed: - if (function.getType().isArray()) { - error(loc, "sampler-constructor cannot make an array of samplers", token, ""); - return true; - } - - // first argument - // * the constructor's first argument must be a texture type - // * the dimensionality (1D, 2D, 3D, Cube, Rect, Buffer, MS, and Array) - // of the texture type must match that of the constructed sampler type - // (that is, the suffixes of the type of the first argument and the - // type of the constructor will be spelled the same way) - if (function[0].type->getBasicType() != EbtSampler || - ! function[0].type->getSampler().isTexture() || - function[0].type->isArray()) { - error(loc, "sampler-constructor first argument must be a scalar textureXXX type", token, ""); - return true; - } - // simulate the first argument's impact on the result type, so it can be compared with the encapsulated operator!=() - TSampler texture = function.getType().getSampler(); - texture.combined = false; - texture.shadow = false; - if (texture != function[0].type->getSampler()) { - error(loc, "sampler-constructor first argument must match type and dimensionality of constructor type", token, ""); - return true; - } - - // second argument - // * the constructor's second argument must be a scalar of type - // *sampler* or *samplerShadow* - // * the presence or absence of depth comparison (Shadow) must match - // between the constructed sampler type and the type of the second argument - if (function[1].type->getBasicType() != EbtSampler || - ! function[1].type->getSampler().isPureSampler() || - function[1].type->isArray()) { - error(loc, "sampler-constructor second argument must be a scalar type 'sampler'", token, ""); - return true; - } - if (function.getType().getSampler().shadow != function[1].type->getSampler().shadow) { - error(loc, "sampler-constructor second argument presence of shadow must match constructor presence of shadow", - token, ""); - return true; - } - - return false; -} - // Checks to see if a void variable has been declared and raise an error message for such a case // // returns true in case of an error @@ -6245,6 +6518,7 @@ void HlslParseContext::mergeQualifiers(TQualifier& dst, const TQualifier& src) MERGE_SINGLETON(readonly); MERGE_SINGLETON(writeonly); MERGE_SINGLETON(specConstant); + MERGE_SINGLETON(nonUniform); } // used to flatten the sampler type space into a single dimension @@ -6300,7 +6574,7 @@ void HlslParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, // void HlslParseContext::arraySizeRequiredCheck(const TSourceLoc& loc, const TArraySizes& arraySizes) { - if (arraySizes.isImplicit()) + if (arraySizes.hasUnsized()) error(loc, "array size required", "", ""); } @@ -6314,20 +6588,6 @@ void HlslParseContext::structArrayCheck(const TSourceLoc& /*loc*/, const TType& } } -// Merge array dimensions listed in 'sizes' onto the type's array dimensions. -// -// From the spec: "vec4[2] a[3]; // size-3 array of size-2 array of vec4" -// -// That means, the 'sizes' go in front of the 'type' as outermost sizes. -// 'type' is the type part of the declaration (to the left) -// 'sizes' is the arrayness tagged on the identifier (to the right) -// -void HlslParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes) -{ - if (sizes) - type.addArrayOuterSizes(*sizes); -} - // // Do all the semantic checking for declaring or redeclaring an array, with and // without a size, and make the right changes to the symbol table. @@ -6374,7 +6634,7 @@ void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identi // redeclareBuiltinVariable() should have already done the copyUp() TType& existingType = symbol->getWritableType(); - if (existingType.isExplicitlySizedArray()) { + if (existingType.isSizedArray()) { // be more lenient for input arrays to geometry shaders and tessellation control outputs, // where the redeclaration is the same size return; @@ -6383,52 +6643,6 @@ void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identi existingType.updateArraySizes(type); } -void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNode *node, int index) -{ - // maybe there is nothing to do... - TIntermTyped* typedNode = node->getAsTyped(); - if (typedNode->getType().getImplicitArraySize() > index) - return; - - // something to do... - - // Figure out what symbol to lookup, as we will use its type to edit for the size change, - // as that type will be shared through shallow copies for future references. - TSymbol* symbol = nullptr; - int blockIndex = -1; - const TString* lookupName = nullptr; - if (node->getAsSymbolNode()) - lookupName = &node->getAsSymbolNode()->getName(); - else if (node->getAsBinaryNode()) { - const TIntermBinary* deref = node->getAsBinaryNode(); - // This has to be the result of a block dereference, unless it's bad shader code - // If it's a uniform block, then an error will be issued elsewhere, but - // return early now to avoid crashing later in this function. - if (! deref->getLeft()->getAsSymbolNode() || deref->getLeft()->getBasicType() != EbtBlock || - deref->getLeft()->getType().getQualifier().storage == EvqUniform || - deref->getRight()->getAsConstantUnion() == nullptr) - return; - - blockIndex = deref->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst(); - - lookupName = &deref->getLeft()->getAsSymbolNode()->getName(); - if (IsAnonymous(*lookupName)) - lookupName = &(*deref->getLeft()->getType().getStruct())[blockIndex].type->getFieldName(); - } - - // Lookup the symbol, should only fail if shader code is incorrect - symbol = symbolTable.find(*lookupName); - if (symbol == nullptr) - return; - - if (symbol->getAsFunction()) { - error(loc, "array variable name expected", symbol->getName().c_str(), ""); - return; - } - - symbol->getWritableType().setImplicitArraySize(index + 1); -} - // // Enforce non-initializer type/qualifier rules. // @@ -6492,7 +6706,7 @@ TIntermTyped* HlslParseContext::indexStructBufferContent(const TSourceLoc& loc, // TType* HlslParseContext::getStructBufferContentType(const TType& type) const { - if (type.getBasicType() != EbtBlock) + if (type.getBasicType() != EbtBlock || type.getQualifier().storage != EvqBuffer) return nullptr; const int memberCount = (int)type.getStruct()->size(); @@ -6500,7 +6714,7 @@ TType* HlslParseContext::getStructBufferContentType(const TType& type) const TType* contentType = (*type.getStruct())[memberCount-1].type; - return contentType->isRuntimeSizedArray() ? contentType : nullptr; + return contentType->isUnsizedArray() ? contentType : nullptr; } // @@ -6848,15 +7062,7 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua return; } if (id == "constant_id") { - requireSpv(loc, "constant_id"); - if (value >= (int)TQualifier::layoutSpecConstantIdEnd) { - error(loc, "specialization-constant id is too large", id.c_str(), ""); - } else { - qualifier.layoutSpecConstantId = value; - qualifier.specConstant = true; - if (! intermediate.addUsedConstantId(value)) - error(loc, "specialization-constant id already used", id.c_str(), ""); - } + setSpecConstantId(loc, qualifier, value); return; } @@ -6951,6 +7157,19 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TQualifier& qua error(loc, "there is no such layout identifier for this stage taking an assigned value", id.c_str(), ""); } +void HlslParseContext::setSpecConstantId(const TSourceLoc& loc, TQualifier& qualifier, int value) +{ + if (value >= (int)TQualifier::layoutSpecConstantIdEnd) { + error(loc, "specialization-constant id is too large", "constant_id", ""); + } else { + qualifier.layoutSpecConstantId = value; + qualifier.specConstant = true; + if (! intermediate.addUsedConstantId(value)) + error(loc, "specialization-constant id already used", "constant_id", ""); + } + return; +} + // Merge any layout qualifier information from src into dst, leaving everything else in dst alone // // "More than one layout qualifier may appear in a single declaration. @@ -7015,6 +7234,7 @@ void HlslParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQuali } } + // // Look up a function name in the symbol table, and make sure it is a function. // @@ -7199,8 +7419,8 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction } }; - return std::abs(linearize(to2.getBasicType()) - linearize(from.getBasicType())) < - std::abs(linearize(to1.getBasicType()) - linearize(from.getBasicType())); + return abs(linearize(to2.getBasicType()) - linearize(from.getBasicType())) < + abs(linearize(to1.getBasicType()) - linearize(from.getBasicType())); }; // for ambiguity reporting @@ -7592,6 +7812,8 @@ TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TStrin // Returning nullptr just means there is no code to execute to handle the // initializer, which will, for example, be the case for constant initializers. // +// Returns a subtree that accomplished the initialization. +// TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable) { // @@ -7623,8 +7845,7 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm } // Fix outer arrayness if variable is unsized, getting size from the initializer - if (initializer->getType().isExplicitlySizedArray() && - variable->getType().isImplicitlySizedArray()) + if (initializer->getType().isSizedArray() && variable->getType().isUnsizedArray()) variable->getWritableType().changeOuterArraySize(initializer->getType().getOuterArraySize()); // Inner arrayness can also get set by an initializer @@ -7633,8 +7854,10 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm variable->getType().getArraySizes()->getNumDims()) { // adopt unsized sizes from the initializer's sizes for (int d = 1; d < variable->getType().getArraySizes()->getNumDims(); ++d) { - if (variable->getType().getArraySizes()->getDimSize(d) == UnsizedArraySize) - variable->getWritableType().getArraySizes().setDimSize(d, initializer->getType().getArraySizes()->getDimSize(d)); + if (variable->getType().getArraySizes()->getDimSize(d) == UnsizedArraySize) { + variable->getWritableType().getArraySizes()->setDimSize(d, + initializer->getType().getArraySizes()->getDimSize(d)); + } } } @@ -7721,20 +7944,20 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co // Later on, initializer execution code will deal with array size logic. TType arrayType; arrayType.shallowCopy(type); // sharing struct stuff is fine - arrayType.newArraySizes(*type.getArraySizes()); // but get a fresh copy of the array information, to edit below + arrayType.copyArraySizes(*type.getArraySizes()); // but get a fresh copy of the array information, to edit below // edit array sizes to fill in unsized dimensions - if (type.isImplicitlySizedArray()) + if (type.isUnsizedArray()) arrayType.changeOuterArraySize((int)initList->getSequence().size()); // set unsized array dimensions that can be derived from the initializer's first element if (arrayType.isArrayOfArrays() && initList->getSequence().size() > 0) { TIntermTyped* firstInit = initList->getSequence()[0]->getAsTyped(); if (firstInit->getType().isArray() && - arrayType.getArraySizes().getNumDims() == firstInit->getType().getArraySizes()->getNumDims() + 1) { - for (int d = 1; d < arrayType.getArraySizes().getNumDims(); ++d) { - if (arrayType.getArraySizes().getDimSize(d) == UnsizedArraySize) - arrayType.getArraySizes().setDimSize(d, firstInit->getType().getArraySizes()->getDimSize(d - 1)); + arrayType.getArraySizes()->getNumDims() == firstInit->getType().getArraySizes()->getNumDims() + 1) { + for (int d = 1; d < arrayType.getArraySizes()->getNumDims(); ++d) { + if (arrayType.getArraySizes()->getDimSize(d) == UnsizedArraySize) + arrayType.getArraySizes()->setDimSize(d, firstInit->getType().getArraySizes()->getDimSize(d - 1)); } } } @@ -7860,6 +8083,10 @@ TIntermTyped* HlslParseContext::handleConstructor(const TSourceLoc& loc, TInterm if (node == nullptr) return nullptr; + // Construct identical type + if (type == node->getType()) + return node; + // Handle the idiom "(struct type)" if (type.isStruct() && isScalarConstructor(node)) { // 'node' will almost always get used multiple times, so should not be used directly, @@ -7894,8 +8121,6 @@ TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyp TIntermAggregate* aggrNode = node->getAsAggregate(); TOperator op = intermediate.mapTypeToConstructorOp(type); - // Combined texture-sampler constructors are completely semantic checked - // in constructorTextureSamplerError() if (op == EOpConstructTextureSampler) return intermediate.setAggregateOperator(aggrNode, op, type, loc); @@ -7999,6 +8224,22 @@ TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op // First, convert types as needed. // switch (op) { + case EOpConstructF16Vec2: + case EOpConstructF16Vec3: + case EOpConstructF16Vec4: + case EOpConstructF16Mat2x2: + case EOpConstructF16Mat2x3: + case EOpConstructF16Mat2x4: + case EOpConstructF16Mat3x2: + case EOpConstructF16Mat3x3: + case EOpConstructF16Mat3x4: + case EOpConstructF16Mat4x2: + case EOpConstructF16Mat4x3: + case EOpConstructF16Mat4x4: + case EOpConstructFloat16: + basicOp = EOpConstructFloat16; + break; + case EOpConstructVec2: case EOpConstructVec3: case EOpConstructVec4: @@ -8031,6 +8272,13 @@ TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op basicOp = EOpConstructDouble; break; + case EOpConstructI16Vec2: + case EOpConstructI16Vec3: + case EOpConstructI16Vec4: + case EOpConstructInt16: + basicOp = EOpConstructInt16; + break; + case EOpConstructIVec2: case EOpConstructIVec3: case EOpConstructIVec4: @@ -8047,6 +8295,13 @@ TIntermTyped* HlslParseContext::constructBuiltIn(const TType& type, TOperator op basicOp = EOpConstructInt; break; + case EOpConstructU16Vec2: + case EOpConstructU16Vec3: + case EOpConstructU16Vec4: + case EOpConstructUint16: + basicOp = EOpConstructUint16; + break; + case EOpConstructUVec2: case EOpConstructUVec3: case EOpConstructUVec4: @@ -8196,7 +8451,7 @@ TIntermTyped* HlslParseContext::constructAggregate(TIntermNode* node, const TTyp // // Do everything needed to add an interface block. // -void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TString* instanceName, TArraySizes* arraySizes) +void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TString* instanceName) { assert(type.getWritableStruct() != nullptr); @@ -8309,7 +8564,7 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS // Process the members fixBlockLocations(loc, type.getQualifier(), typeList, memberWithLocation, memberWithoutLocation); - fixBlockXfbOffsets(type.getQualifier(), typeList); + fixXfbOffsets(type.getQualifier(), typeList); fixBlockUniformOffsets(type.getQualifier(), typeList); // reverse merge, so that currentBlockQualifier now has all layout information @@ -8324,8 +8579,8 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS const TString& interfaceName = (instanceName && !instanceName->empty()) ? *instanceName : type.getTypeName(); TType blockType(&typeList, interfaceName, type.getQualifier()); - if (arraySizes) - blockType.newArraySizes(*arraySizes); + if (type.isArray()) + blockType.transferArraySizes(type.getArraySizes()); // Add the variable, as anonymous or named instanceName. // Make an anonymous variable if no name was provided. @@ -8343,7 +8598,7 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS return; } - // Save it in the AST for linker use. + // Save it in the AST for linker use. if (symbolTable.atGlobalLevel()) trackLinkage(variable); } @@ -8386,13 +8641,13 @@ void HlslParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qual memberQualifier.layoutComponent = 0; } nextLocation = memberQualifier.layoutLocation + - intermediate.computeTypeLocationSize(*typeList[member].type); + intermediate.computeTypeLocationSize(*typeList[member].type, language); } } } } -void HlslParseContext::fixBlockXfbOffsets(TQualifier& qualifier, TTypeList& typeList) +void HlslParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList) { // "If a block is qualified with xfb_offset, all its // members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any @@ -8433,7 +8688,7 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType { if (! qualifier.isUniformOrBuffer()) return; - if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430) + if (qualifier.layoutPacking != ElpStd140 && qualifier.layoutPacking != ElpStd430 && qualifier.layoutPacking != ElpScalar) return; int offset = 0; @@ -8447,11 +8702,11 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType // modify just the children's view of matrix layout, if there is one for this member TLayoutMatrix subMatrixLayout = typeList[member].type->getQualifier().layoutMatrix; int dummyStride; - int memberAlignment = intermediate.getBaseAlignment(*typeList[member].type, memberSize, dummyStride, - qualifier.layoutPacking == ElpStd140, - subMatrixLayout != ElmNone - ? subMatrixLayout == ElmRowMajor - : qualifier.layoutMatrix == ElmRowMajor); + int memberAlignment = intermediate.getMemberAlignment(*typeList[member].type, memberSize, dummyStride, + qualifier.layoutPacking, + subMatrixLayout != ElmNone + ? subMatrixLayout == ElmRowMajor + : qualifier.layoutMatrix == ElmRowMajor); if (memberQualifier.hasOffset()) { // "The specified offset must be a multiple // of the base alignment of the type of the block member it qualifies, or a compile-time error results." @@ -8582,29 +8837,75 @@ bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayout } // -// Selection hints +// Selection attributes // -TSelectionControl HlslParseContext::handleSelectionControl(const TAttributeMap& attributes) const +void HlslParseContext::handleSelectionAttributes(const TSourceLoc& loc, TIntermSelection* selection, + const TAttributes& attributes) { - if (attributes.contains(EatFlatten)) - return ESelectionControlFlatten; - else if (attributes.contains(EatBranch)) - return ESelectionControlDontFlatten; - else - return ESelectionControlNone; + if (selection == nullptr) + return; + + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + switch (it->name) { + case EatFlatten: + selection->setFlatten(); + break; + case EatBranch: + selection->setDontFlatten(); + break; + default: + warn(loc, "attribute does not apply to a selection", "", ""); + break; + } + } } // -// Loop hints +// Switch attributes // -TLoopControl HlslParseContext::handleLoopControl(const TAttributeMap& attributes) const +void HlslParseContext::handleSwitchAttributes(const TSourceLoc& loc, TIntermSwitch* selection, + const TAttributes& attributes) { - if (attributes.contains(EatUnroll)) - return ELoopControlUnroll; - else if (attributes.contains(EatLoop)) - return ELoopControlDontUnroll; - else - return ELoopControlNone; + if (selection == nullptr) + return; + + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + switch (it->name) { + case EatFlatten: + selection->setFlatten(); + break; + case EatBranch: + selection->setDontFlatten(); + break; + default: + warn(loc, "attribute does not apply to a switch", "", ""); + break; + } + } +} + +// +// Loop attributes +// +void HlslParseContext::handleLoopAttributes(const TSourceLoc& loc, TIntermLoop* loop, + const TAttributes& attributes) +{ + if (loop == nullptr) + return; + + for (auto it = attributes.begin(); it != attributes.end(); ++it) { + switch (it->name) { + case EatUnroll: + loop->setUnroll(); + break; + case EatLoop: + loop->setDontUnroll(); + break; + default: + warn(loc, "attribute does not apply to a loop", "", ""); + break; + } + } } // @@ -8749,7 +9050,7 @@ void HlslParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TIn // into a switch node. // TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression, - TIntermAggregate* lastStatements, TSelectionControl control) + TIntermAggregate* lastStatements, const TAttributes& attributes) { wrapupSwitchSubsequence(lastStatements, nullptr); @@ -8776,7 +9077,7 @@ TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* ex TIntermSwitch* switchNode = new TIntermSwitch(expression, body); switchNode->setLoc(loc); - switchNode->setSelectionControl(control); + handleSwitchAttributes(loc, switchNode, attributes); return switchNode; } @@ -8898,7 +9199,7 @@ bool HlslParseContext::isInputBuiltIn(const TQualifier& qualifier) const case EbvVertexIndex: return language == EShLangVertex; case EbvPrimitiveId: - return language == EShLangGeometry || language == EShLangFragment; + return language == EShLangGeometry || language == EShLangFragment || language == EShLangTessControl; case EbvTessLevelInner: case EbvTessLevelOuter: return language == EShLangTessEvaluation; @@ -8944,9 +9245,9 @@ bool HlslParseContext::isOutputBuiltIn(const TQualifier& qualifier) const return language == EShLangFragment; case EbvLayer: case EbvViewportIndex: - return language == EShLangGeometry; + return language == EShLangGeometry || language == EShLangVertex; case EbvPrimitiveId: - return language == EShLangGeometry || language == EShLangTessControl || language == EShLangTessEvaluation; + return language == EShLangGeometry; case EbvTessLevelInner: case EbvTessLevelOuter: return language == EShLangTessControl; @@ -9010,11 +9311,17 @@ void HlslParseContext::correctOutput(TQualifier& qualifier) qualifier.patch = false; switch (qualifier.builtIn) { + case EbvFragDepth: + intermediate.setDepthReplacing(); + intermediate.setDepth(EldAny); + break; case EbvFragDepthGreater: + intermediate.setDepthReplacing(); intermediate.setDepth(EldGreater); qualifier.builtIn = EbvFragDepth; break; case EbvFragDepthLesser: + intermediate.setDepthReplacing(); intermediate.setDepth(EldLess); qualifier.builtIn = EbvFragDepth; break; @@ -9244,7 +9551,7 @@ void HlslParseContext::addPatchConstantInvocation() const TType& type = *patchConstantFunction[param].type; const TBuiltInVariable biType = patchConstantFunction[param].getDeclaredBuiltIn(); - return type.isArray() && !type.isRuntimeSizedArray() && biType == EbvOutputPatch; + return type.isSizedArray() && biType == EbvOutputPatch; }; // We will perform these steps. Each is in a scoped block for separation: they could @@ -9547,7 +9854,8 @@ void HlslParseContext::addPatchConstantInvocation() } // Finalization step: remove unused buffer blocks from linkage (we don't know until the -// shader is entirely compiled) +// shader is entirely compiled). +// Preserve order of remaining symbols. void HlslParseContext::removeUnusedStructBufferCounters() { const auto endIt = std::remove_if(linkageSymbols.begin(), linkageSymbols.end(), @@ -9579,6 +9887,31 @@ void HlslParseContext::fixTextureShadowModes() } } +// Finalization step: patch append methods to use proper stream output, which isn't known until +// main is parsed, which could happen after the append method is parsed. +void HlslParseContext::finalizeAppendMethods() +{ + TSourceLoc loc; + loc.init(); + + // Nothing to do: bypass test for valid stream output. + if (gsAppends.empty()) + return; + + if (gsStreamOutput == nullptr) { + error(loc, "unable to find output symbol for Append()", "", ""); + return; + } + + // Patch append sequences, now that we know the stream output symbol. + for (auto append = gsAppends.begin(); append != gsAppends.end(); ++append) { + append->node->getSequence()[0] = + handleAssign(append->loc, EOpAssign, + intermediate.addSymbol(*gsStreamOutput, append->loc), + append->node->getSequence()[0]->getAsTyped()); + } +} + // post-processing void HlslParseContext::finish() { @@ -9591,10 +9924,11 @@ void HlslParseContext::finish() removeUnusedStructBufferCounters(); addPatchConstantInvocation(); fixTextureShadowModes(); + finalizeAppendMethods(); // Communicate out (esp. for command line) that we formed AST that will make // illegal AST SPIR-V and it needs transforms to legalize it. - if (intermediate.needsLegalization()) + if (intermediate.needsLegalization() && (messages & EShMsgHlslLegalization)) infoSink.info << "WARNING: AST will form illegal SPIR-V; need to transform to legalize"; TParseContextBase::finish(); diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.h b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.h index c1752f12919..f99d5c73fc3 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.h +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseHelper.h @@ -38,12 +38,12 @@ #include "../glslang/MachineIndependent/parseVersions.h" #include "../glslang/MachineIndependent/ParseHelper.h" +#include "../glslang/MachineIndependent/attribute.h" #include namespace glslang { -class TAttributeMap; // forward declare class TFunctionDeclarator; class HlslParseContext : public TParseContextBase { @@ -80,10 +80,10 @@ public: bool isBuiltInMethod(const TSourceLoc&, TIntermTyped* base, const TString& field); void assignToInterface(TVariable& variable); void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype); - TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree); - TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&); - void handleEntryPointAttributes(const TSourceLoc&, const TAttributeMap&); - void transferTypeAttributes(const TAttributeMap&, TType&); + TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributes&, TIntermNode*& entryPointTree); + TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributes&); + void handleEntryPointAttributes(const TSourceLoc&, const TAttributes&); + void transferTypeAttributes(const TSourceLoc&, const TAttributes&, TType&, bool allowEntry = false); void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node); void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector& inputs, TVector& outputs); void remapNonEntryPointIO(TFunction& function); @@ -93,6 +93,7 @@ public: TIntermTyped* handleAssignToMatrixSwizzle(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermTyped*); TIntermAggregate* assignClipCullDistance(const TSourceLoc&, TOperator, int semanticId, TIntermTyped* left, TIntermTyped* right); + TIntermTyped* assignPosition(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); void decomposeIntrinsic(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); @@ -121,11 +122,9 @@ public: void integerCheck(const TIntermTyped* node, const char* token); void globalCheck(const TSourceLoc&, const char* token); bool constructorError(const TSourceLoc&, TIntermNode*, TFunction&, TOperator, TType&); - bool constructorTextureSamplerError(const TSourceLoc&, const TFunction&); void arraySizeCheck(const TSourceLoc&, TIntermTyped* expr, TArraySize&); void arraySizeRequiredCheck(const TSourceLoc&, const TArraySizes&); void structArrayCheck(const TSourceLoc&, const TType& structure); - void arrayDimMerge(TType& type, const TArraySizes* sizes); bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType); void globalQualifierFix(const TSourceLoc&, TQualifier&); bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType); @@ -137,10 +136,12 @@ public: void setLayoutQualifier(const TSourceLoc&, TQualifier&, TString&); void setLayoutQualifier(const TSourceLoc&, TQualifier&, TString&, const TIntermTyped*); + void setSpecConstantId(const TSourceLoc&, TQualifier&, int value); void mergeObjectLayoutQualifiers(TQualifier& dest, const TQualifier& src, bool inheritOnly); void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, int& thisDepth, TIntermTyped*& args); + void addGenMulArgumentConversion(const TSourceLoc& loc, TFunction& call, TIntermTyped*& args); void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&); void declareStruct(const TSourceLoc&, TString& structName, TType&); TSymbol* lookupUserType(const TString&, TType&); @@ -151,18 +152,16 @@ public: TIntermTyped* convertArray(TIntermTyped*, const TType&); TIntermTyped* constructAggregate(TIntermNode*, const TType&, int, const TSourceLoc&); TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermTyped*, const TSourceLoc&, bool subset); - void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = 0, TArraySizes* arraySizes = 0); + void declareBlock(const TSourceLoc&, TType&, const TString* instanceName = 0); void declareStructBufferCounter(const TSourceLoc& loc, const TType& bufferType, const TString& name); void fixBlockLocations(const TSourceLoc&, TQualifier&, TTypeList&, bool memberWithLocation, bool memberWithoutLocation); - void fixBlockXfbOffsets(TQualifier&, TTypeList&); + void fixXfbOffsets(TQualifier&, TTypeList&); void fixBlockUniformOffsets(const TQualifier&, TTypeList&); void addQualifierToExisting(const TSourceLoc&, TQualifier, const TString& identifier); void addQualifierToExisting(const TSourceLoc&, TQualifier, TIdentifierList&); void updateStandaloneQualifierDefaults(const TSourceLoc&, const TPublicType&); void wrapupSwitchSubsequence(TIntermAggregate* statements, TIntermNode* branchNode); - TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body, TSelectionControl control); - - void updateImplicitArraySize(const TSourceLoc&, TIntermNode*, int index); + TIntermNode* addSwitch(const TSourceLoc&, TIntermTyped* expression, TIntermAggregate* body, const TAttributes&); void nestLooping() { ++loopNestingLevel; } void unnestLooping() { --loopNestingLevel; } @@ -200,10 +199,11 @@ public: bool handleInputGeometry(const TSourceLoc&, const TLayoutGeometry& geometry); // Determine selection control from attributes - TSelectionControl handleSelectionControl(const TAttributeMap& attributes) const; + void handleSelectionAttributes(const TSourceLoc& loc, TIntermSelection*, const TAttributes& attributes); + void handleSwitchAttributes(const TSourceLoc& loc, TIntermSwitch*, const TAttributes& attributes); // Determine loop control from attributes - TLoopControl handleLoopControl(const TAttributeMap& attributes) const; + void handleLoopAttributes(const TSourceLoc& loc, TIntermLoop*, const TAttributes& attributes); // Share struct buffer deep types void shareStructBufferType(TType&); @@ -214,6 +214,8 @@ public: // Obtain the sampler return type of the given sampler in retType. void getTextureReturnType(const TSampler& sampler, TType& retType) const; + TAttributeType attributeFromName(const TString& nameSpace, const TString& name) const; + protected: struct TFlattenData { TFlattenData() : nextBinding(TQualifier::layoutBindingEnd), @@ -263,6 +265,7 @@ protected: TVariable* getSplitNonIoVar(int id) const; void addPatchConstantInvocation(); void fixTextureShadowModes(); + void finalizeAppendMethods(); TIntermTyped* makeIntegerIndex(TIntermTyped*); void fixBuiltInIoType(TType&); @@ -399,7 +402,7 @@ protected: // may fit in TSampler::structReturnIndex. TVector textureReturnStruct; - TMap structBufferCounter; + TMap structBufferCounter; // true if counter buffer is in use // The built-in interstage IO map considers e.g, EvqPosition on input and output separately, so that we // can build the linkage correctly if position appears on both sides. Otherwise, multiple positions @@ -457,6 +460,17 @@ protected: TVector mipsOperatorMipArg; + // The geometry output stream is not copied out from the entry point as a typical output variable + // is. It's written via EmitVertex (hlsl=Append), which may happen in arbitrary control flow. + // For this we need the real output symbol. Since it may not be known at the time and Append() + // method is parsed, the sequence will be patched during finalization. + struct tGsAppendData { + TIntermAggregate* node; + TSourceLoc loc; + }; + + TVector gsAppends; + // A texture object may be used with shadow and non-shadow samplers, but both may not be // alive post-DCE in the same shader. We do not know at compilation time which are alive: that's // only known post-DCE. If a texture is used both ways, we create two textures, and diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseables.cpp b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseables.cpp index bae9e6e8c64..65000912cf4 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseables.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslParseables.cpp @@ -259,6 +259,8 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons case 'D': s += "double"; break; case 'I': s += "int"; break; case 'U': s += "uint"; break; + case 'L': s += "int64_t"; break; + case 'M': s += "uint64_t"; break; case 'B': s += "bool"; break; case 'S': s += "sampler"; break; case 's': s += "SamplerComparisonState"; break; @@ -544,7 +546,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c // orderKey can be: // S = scalar, V = vector, M = matrix, - = void // typekey can be: - // D = double, F = float, U = uint, I = int, B = bool, S = sampler, s = shadowSampler + // D = double, F = float, U = uint, I = int, B = bool, S = sampler, s = shadowSampler, M = uint64_t, L = int64_t // An empty order or type key repeats the first one. E.g: SVM,, means 3 args each of SVM. // '>' as first letter of order creates an output parameter // '<' as first letter of order creates an input parameter @@ -580,8 +582,8 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c { "asdouble", "V2", "D", "V2,", "UI,", EShLangAll, false }, { "asfloat", nullptr, "F", "SVM", "BFIU", EShLangAll, false }, { "asin", nullptr, nullptr, "SVM", "F", EShLangAll, false }, - { "asint", nullptr, "I", "SVM", "FU", EShLangAll, false }, - { "asuint", nullptr, "U", "SVM", "FU", EShLangAll, false }, + { "asint", nullptr, "I", "SVM", "FIU", EShLangAll, false }, + { "asuint", nullptr, "U", "SVM", "FIU", EShLangAll, false }, { "atan", nullptr, nullptr, "SVM", "F", EShLangAll, false }, { "atan2", nullptr, nullptr, "SVM,", "F,", EShLangAll, false }, { "ceil", nullptr, nullptr, "SVM", "F", EShLangAll, false }, @@ -603,7 +605,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c { "determinant", "S", "F", "M", "F", EShLangAll, false }, { "DeviceMemoryBarrier", nullptr, nullptr, "-", "-", EShLangPSCS, false }, { "DeviceMemoryBarrierWithGroupSync", nullptr, nullptr, "-", "-", EShLangCS, false }, - { "distance", "S", "F", "V,", "F,", EShLangAll, false }, + { "distance", "S", "F", "SV,", "F,", EShLangAll, false }, { "dot", "S", nullptr, "SV,", "FI,", EShLangAll, false }, { "dst", nullptr, nullptr, "V4,", "F,", EShLangAll, false }, // { "errorf", "-", "-", "", "", EShLangAll, false }, TODO: varargs @@ -902,6 +904,35 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c { "DecrementCounter", nullptr, nullptr, "-", "-", EShLangAll, true }, { "Consume", nullptr, nullptr, "-", "-", EShLangAll, true }, + // SM 6.0 + + { "WaveIsFirstLane", "S", "B", "-", "-", EShLangPSCS, false}, + { "WaveGetLaneCount", "S", "U", "-", "-", EShLangPSCS, false}, + { "WaveGetLaneIndex", "S", "U", "-", "-", EShLangPSCS, false}, + { "WaveActiveAnyTrue", "S", "B", "S", "B", EShLangPSCS, false}, + { "WaveActiveAllTrue", "S", "B", "S", "B", EShLangPSCS, false}, + { "WaveActiveBallot", "V4", "U", "S", "B", EShLangPSCS, false}, + { "WaveReadLaneAt", nullptr, nullptr, "SV,S", "DFUI,U", EShLangPSCS, false}, + { "WaveReadLaneFirst", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveAllEqual", "S", "B", "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveAllEqualBool", "S", "B", "S", "B", EShLangPSCS, false}, + { "WaveActiveCountBits", "S", "U", "S", "B", EShLangPSCS, false}, + + { "WaveActiveSum", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveProduct", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveBitAnd", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveBitOr", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveBitXor", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveMin", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WaveActiveMax", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WavePrefixSum", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WavePrefixProduct", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "WavePrefixCountBits", "S", "U", "S", "B", EShLangPSCS, false}, + { "QuadReadAcrossX", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "QuadReadAcrossY", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "QuadReadAcrossDiagonal", nullptr, nullptr, "SV", "DFUI", EShLangPSCS, false}, + { "QuadReadLaneAt", nullptr, nullptr, "SV,S", "DFUI,U", EShLangPSCS, false}, + // Methods for subpass input objects { "SubpassLoad", "V4", nullptr, "[", "FIU", EShLangPS, true }, { "SubpassLoad", "V4", nullptr, "],S", "FIU,I", EShLangPS, true }, @@ -1087,8 +1118,8 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil symbolTable.relateToOperator("ddy_fine", EOpDPdyFine); symbolTable.relateToOperator("degrees", EOpDegrees); symbolTable.relateToOperator("determinant", EOpDeterminant); - symbolTable.relateToOperator("DeviceMemoryBarrier", EOpGroupMemoryBarrier); - symbolTable.relateToOperator("DeviceMemoryBarrierWithGroupSync", EOpGroupMemoryBarrierWithGroupSync); // ... + symbolTable.relateToOperator("DeviceMemoryBarrier", EOpDeviceMemoryBarrier); + symbolTable.relateToOperator("DeviceMemoryBarrierWithGroupSync", EOpDeviceMemoryBarrierWithGroupSync); symbolTable.relateToOperator("distance", EOpDistance); symbolTable.relateToOperator("dot", EOpDot); symbolTable.relateToOperator("dst", EOpDst); @@ -1244,6 +1275,33 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil symbolTable.relateToOperator(BUILTIN_PREFIX "Append", EOpMethodAppend); symbolTable.relateToOperator(BUILTIN_PREFIX "RestartStrip", EOpMethodRestartStrip); + // Wave ops + symbolTable.relateToOperator("WaveIsFirstLane", EOpSubgroupElect); + symbolTable.relateToOperator("WaveGetLaneCount", EOpWaveGetLaneCount); + symbolTable.relateToOperator("WaveGetLaneIndex", EOpWaveGetLaneIndex); + symbolTable.relateToOperator("WaveActiveAnyTrue", EOpSubgroupAny); + symbolTable.relateToOperator("WaveActiveAllTrue", EOpSubgroupAll); + symbolTable.relateToOperator("WaveActiveBallot", EOpSubgroupBallot); + symbolTable.relateToOperator("WaveReadLaneFirst", EOpSubgroupBroadcastFirst); + symbolTable.relateToOperator("WaveReadLaneAt", EOpSubgroupShuffle); + symbolTable.relateToOperator("WaveActiveAllEqual", EOpSubgroupAllEqual); + symbolTable.relateToOperator("WaveActiveAllEqualBool", EOpSubgroupAllEqual); + symbolTable.relateToOperator("WaveActiveCountBits", EOpWaveActiveCountBits); + symbolTable.relateToOperator("WaveActiveSum", EOpSubgroupAdd); + symbolTable.relateToOperator("WaveActiveProduct", EOpSubgroupMul); + symbolTable.relateToOperator("WaveActiveBitAnd", EOpSubgroupAnd); + symbolTable.relateToOperator("WaveActiveBitOr", EOpSubgroupOr); + symbolTable.relateToOperator("WaveActiveBitXor", EOpSubgroupXor); + symbolTable.relateToOperator("WaveActiveMin", EOpSubgroupMin); + symbolTable.relateToOperator("WaveActiveMax", EOpSubgroupMax); + symbolTable.relateToOperator("WavePrefixSum", EOpSubgroupInclusiveAdd); + symbolTable.relateToOperator("WavePrefixProduct", EOpSubgroupInclusiveMul); + symbolTable.relateToOperator("WavePrefixCountBits", EOpWavePrefixCountBits); + symbolTable.relateToOperator("QuadReadAcrossX", EOpSubgroupQuadSwapHorizontal); + symbolTable.relateToOperator("QuadReadAcrossY", EOpSubgroupQuadSwapVertical); + symbolTable.relateToOperator("QuadReadAcrossDiagonal", EOpSubgroupQuadSwapDiagonal); + symbolTable.relateToOperator("QuadReadLaneAt", EOpSubgroupQuadBroadcast); + // Subpass input methods symbolTable.relateToOperator(BUILTIN_PREFIX "SubpassLoad", EOpSubpassLoad); symbolTable.relateToOperator(BUILTIN_PREFIX "SubpassLoadMS", EOpSubpassLoadMS); diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslScanContext.cpp b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslScanContext.cpp index d1e0be6e136..28a66bb47d2 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslScanContext.cpp +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslScanContext.cpp @@ -143,6 +143,7 @@ void HlslScanContext::fillInKeywordMap() (*KeywordMap)["bool"] = EHTokBool; (*KeywordMap)["int"] = EHTokInt; (*KeywordMap)["uint"] = EHTokUint; + (*KeywordMap)["uint64_t"] = EHTokUint64; (*KeywordMap)["dword"] = EHTokDword; (*KeywordMap)["half"] = EHTokHalf; (*KeywordMap)["float"] = EHTokFloat; @@ -549,6 +550,7 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) case PpAtomConstInt: parserToken->i = ppToken.ival; return EHTokIntConstant; case PpAtomConstUint: parserToken->i = ppToken.ival; return EHTokUintConstant; + case PpAtomConstFloat16: parserToken->d = ppToken.dval; return EHTokFloat16Constant; case PpAtomConstFloat: parserToken->d = ppToken.dval; return EHTokFloatConstant; case PpAtomConstDouble: parserToken->d = ppToken.dval; return EHTokDoubleConstant; case PpAtomIdentifier: @@ -565,10 +567,15 @@ EHlslTokenClass HlslScanContext::tokenizeClass(HlslToken& token) case EndOfInput: return EHTokNone; default: - char buf[2]; - buf[0] = (char)token; - buf[1] = 0; - parseContext.error(loc, "unexpected token", buf, ""); + if (token < PpAtomMaxSingle) { + char buf[2]; + buf[0] = (char)token; + buf[1] = 0; + parseContext.error(loc, "unexpected token", buf, ""); + } else if (tokenText[0] != 0) + parseContext.error(loc, "unexpected token", tokenText, ""); + else + parseContext.error(loc, "unexpected token", "", ""); break; } } while (true); @@ -645,6 +652,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier() case EHTokBool: case EHTokInt: case EHTokUint: + case EHTokUint64: case EHTokDword: case EHTokHalf: case EHTokFloat: diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslTokens.h b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslTokens.h index 98450c9a0e2..4426bccecb5 100644 --- a/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslTokens.h +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/hlslTokens.h @@ -95,6 +95,7 @@ enum EHlslTokenClass { EHTokBool, EHTokInt, EHTokUint, + EHTokUint64, EHTokDword, EHTokHalf, EHTokFloat, @@ -297,6 +298,7 @@ enum EHlslTokenClass { EHTokConstantBuffer, // constant + EHTokFloat16Constant, EHTokFloatConstant, EHTokDoubleConstant, EHTokIntConstant, diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/pch.cpp b/3rdparty/bgfx/3rdparty/glslang/hlsl/pch.cpp new file mode 100644 index 00000000000..b7a08654a54 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/pch.cpp @@ -0,0 +1,35 @@ +// +// Copyright (C) 2018 The Khronos Group Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "pch.h" diff --git a/3rdparty/bgfx/3rdparty/glslang/hlsl/pch.h b/3rdparty/bgfx/3rdparty/glslang/hlsl/pch.h new file mode 100644 index 00000000000..e0bc4917812 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/hlsl/pch.h @@ -0,0 +1,54 @@ +#ifndef _PCH_H +#define _PCH_H +// +// Copyright (C) 2018 The Khronos Group Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of 3Dlabs Inc. Ltd. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// + +#include "hlslParseHelper.h" +#include "hlslScanContext.h" +#include "hlslGrammar.h" +#include "hlslAttributes.h" + +#include "../glslang/MachineIndependent/Scan.h" +#include "../glslang/MachineIndependent/preprocessor/PpContext.h" + +#include "../glslang/OSDependent/osinclude.h" + +#include +#include +#include +#include +#include + + +#endif /* _PCH_H */ diff --git a/3rdparty/bgfx/3rdparty/glslang/known_good.json b/3rdparty/bgfx/3rdparty/glslang/known_good.json index d318235ff24..837255d5c7c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/known_good.json +++ b/3rdparty/bgfx/3rdparty/glslang/known_good.json @@ -5,14 +5,14 @@ "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Tools", "subdir" : "External/spirv-tools", - "commit" : "ac04b2faeabc15811e8c542a5d7a36dbdba243b8" + "commit" : "d543f7dfed9ba02910996121375e57fff92c3c93" }, { "name" : "spirv-tools/external/spirv-headers", "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Headers", "subdir" : "External/spirv-tools/external/spirv-headers", - "commit" : "061097878467b8e040fbf153a837d844ef9f9f96" + "commit" : "282879ca34563020dbe73fd8f7d45bed6755626a" } ] } diff --git a/3rdparty/bgfx/3rdparty/glslang/known_good_khr.json b/3rdparty/bgfx/3rdparty/glslang/known_good_khr.json new file mode 100644 index 00000000000..a64198a81fe --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/known_good_khr.json @@ -0,0 +1,18 @@ +{ + "commits" : [ + { + "name" : "spirv-tools", + "site" : "gitlab", + "subrepo" : "spirv/spirv-tools", + "subdir" : "External/spirv-tools", + "commit" : "d4e2c2eaa6fd2e9f9cd218ea9add9b0c8ae759ba" + }, + { + "name" : "spirv-tools/external/spirv-headers", + "site" : "gitlab", + "subrepo" : "spirv/SPIRV-Headers", + "subdir" : "External/spirv-tools/external/spirv-headers", + "commit" : "gitlab-prelim-rc4" + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/glslang/make-revision b/3rdparty/bgfx/3rdparty/glslang/make-revision index 492e437562a..a89ff08772c 100644 --- a/3rdparty/bgfx/3rdparty/glslang/make-revision +++ b/3rdparty/bgfx/3rdparty/glslang/make-revision @@ -1,10 +1,6 @@ #!/bin/sh ( echo "// This header is generated by the make-revision script." -echo "// For the version, it uses the latest git tag followed by the number of commits." -echo "// For the date, it uses the current date (when then script is run)." - echo -echo \#define GLSLANG_REVISION \"`git describe --tags --abbrev=0`.`git log --oneline | wc -l`\" -echo \#define GLSLANG_DATE \"`date +%d-%b-%Y`\" +echo \#define GLSLANG_PATCH_LEVEL `git log --oneline | wc -l` ) > glslang/Include/revision.h diff --git a/3rdparty/bgfx/3rdparty/glslang/ndk_test/Android.mk b/3rdparty/bgfx/3rdparty/glslang/ndk_test/Android.mk new file mode 100644 index 00000000000..bcf82dd2e9c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/ndk_test/Android.mk @@ -0,0 +1,12 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_CPP_EXTENSION := .cc .cpp .cxx +LOCAL_SRC_FILES:=test.cpp +LOCAL_MODULE:=glslang_ndk_test +LOCAL_LDLIBS:=-landroid +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror +LOCAL_STATIC_LIBRARIES:=glslang SPIRV HLSL +include $(BUILD_SHARED_LIBRARY) + +include $(LOCAL_PATH)/../Android.mk diff --git a/3rdparty/bgfx/3rdparty/glslang/ndk_test/jni/Application.mk b/3rdparty/bgfx/3rdparty/glslang/ndk_test/jni/Application.mk new file mode 100644 index 00000000000..d7ccd349add --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/ndk_test/jni/Application.mk @@ -0,0 +1,5 @@ +APP_ABI := all +APP_BUILD_SCRIPT := Android.mk +APP_STL := gnustl_static +APP_PLATFORM := android-9 +NDK_TOOLCHAIN_VERSION := 4.9 diff --git a/3rdparty/bgfx/3rdparty/glslang/ndk_test/test.cpp b/3rdparty/bgfx/3rdparty/glslang/ndk_test/test.cpp new file mode 100644 index 00000000000..dec53d01f53 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/glslang/ndk_test/test.cpp @@ -0,0 +1,19 @@ +// Copyright 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "SPIRV/GlslangToSpv.h" + +void android_main(struct android_app* state) { + int version = glslang::GetSpirvGeneratorVersion(); +} diff --git a/3rdparty/bgfx/3rdparty/glslang/update_glslang_sources.py b/3rdparty/bgfx/3rdparty/glslang/update_glslang_sources.py index 331a30116c6..65be2f6a2ce 100644 --- a/3rdparty/bgfx/3rdparty/glslang/update_glslang_sources.py +++ b/3rdparty/bgfx/3rdparty/glslang/update_glslang_sources.py @@ -28,8 +28,12 @@ import sys KNOWN_GOOD_FILE = 'known_good.json' +SITE_TO_KNOWN_GOOD_FILE = { 'github' : 'known_good.json', + 'gitlab' : 'known_good_khr.json' } + # Maps a site name to its hostname. -SITE_TO_HOST = { 'github' : 'github.com' } +SITE_TO_HOST = { 'github' : 'https://github.com/', + 'gitlab' : 'git@gitlab.khronos.org:' } VERBOSE = True @@ -62,7 +66,7 @@ def command_retval(cmd, directory): p = subprocess.Popen(cmd, cwd=directory, stdout=subprocess.PIPE) - (stdout, _) = p.communicate() + p.communicate() return p.returncode @@ -82,20 +86,17 @@ class GoodCommit(object): self.subdir = json['subdir'] if ('subdir' in json) else '.' self.commit = json['commit'] - def GetUrl(self, style='https'): + def GetUrl(self): """Returns the URL for the repository.""" host = SITE_TO_HOST[self.site] - sep = '/' if (style is 'https') else ':' - return '{style}://{host}{sep}{subrepo}'.format( - style=style, + return '{host}{subrepo}'.format( host=host, - sep=sep, subrepo=self.subrepo) def AddRemote(self): """Add the remote 'known-good' if it does not exist.""" - print('Ignore "fatal" errors for missing known-good remote:') - if command_retval(['git', 'remote', 'show', 'known-good'], self.subdir) != 0: + remotes = command_output(['git', 'remote'], self.subdir).splitlines() + if b'known-good' not in remotes: command_output(['git', 'remote', 'add', 'known-good', self.GetUrl()], self.subdir) def HasCommit(self): @@ -120,9 +121,10 @@ class GoodCommit(object): command_output(['git', 'checkout', self.commit], self.subdir) -def GetGoodCommits(): +def GetGoodCommits(site): """Returns the latest list of GoodCommit objects.""" - with open(KNOWN_GOOD_FILE) as known_good: + known_good_file = SITE_TO_KNOWN_GOOD_FILE[site] + with open(known_good_file) as known_good: return [GoodCommit(c) for c in json.loads(known_good.read())['commits']] @@ -130,10 +132,12 @@ def main(): parser = argparse.ArgumentParser(description='Get Glslang source dependencies at a known-good commit') parser.add_argument('--dir', dest='dir', default='.', help="Set target directory for Glslang source root. Default is \'.\'.") + parser.add_argument('--site', dest='site', default='github', + help="Set git server site. Default is github.") args = parser.parse_args() - commits = GetGoodCommits() + commits = GetGoodCommits(args.site) distutils.dir_util.mkpath(args.dir) print('Change directory to {d}'.format(d=args.dir)) diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py b/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py index fe7fe8e95e2..69e8f5e82ec 100644 --- a/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/GenerateIconFontCppHeaders.py @@ -1,66 +1,72 @@ -# Convert Font Awesome, Google Material Design and Kenney Game icon font -# parameters to C++11, C89 and None compatible formats. +# Convert Font Awesome, Fork Awesome, Google Material Design, Material Design Icons, Kenney Game and Ionicons +# icon font parameters to C89, C++11 and C# compatible formats. # #------------------------------------------------------------------------------ # 1 - Source material # # 1.1 - Font Awesome -# https://github.com/FortAwesome/Font-Awesome/blob/master/fonts/fontawesome-webfont.ttf -# https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml -# 1.2 - Material Design -# https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf +# 1.1.1 - version 4 +# https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/src/icons.yml +# https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf +# 1.1.2 - version 5 +# https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/advanced-options/metadata/icons.yml +# https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-brands-400.ttf +# https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-regular-400.ttf +# https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-solid-900.ttf +# 1.2 - Fork Awesome +# https://raw.githubusercontent.com/ForkAwesome/Fork-Awesome/master/src/icons/icons.yml +# https://github.com/ForkAwesome/Fork-Awesome/blob/master/fonts/forkawesome-webfont.ttf +# 1.3 - Google Material Design # https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints -# 1.3 - Kenney icons -# https://github.com/SamBrishes/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf -# https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css +# https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf +# 1.4 - Material Design Icons +# https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css +# https://github.com/Templarian/MaterialDesign-Webfont/blob/master/fonts/materialdesignicons-webfont.ttf +# 1.5 - Kenney Game icons +# https://raw.githubusercontent.com/nicodinh/kenney-icon-font/master/css/kenney-icons.css +# https://github.com/nicodinh/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf +# 1.6 - Ionicons +# https://raw.githubusercontent.com/ionic-team/ionicons/master/src/docs/archived/v2/css/ionicons.css +# https://github.com/ionic-team/ionicons/blob/master/src/docs/archived/v2/fonts/ionicons.ttf # #------------------------------------------------------------------------------ -# 2 - Data samples +# 2 - Data sample # -# 2.1 - Font Awesome -# - input: - name: Music -# id: music -# unicode: f001 -# created: 1.0 -# filter: -# - note -# - sound -# categories: -# - Web Application Icons +# Font Awesome example: +# - input: music: +# changes: +# - '1' +# - 5.0.0 +# label: Music +# search: +# terms: +# - note +# - sound +# styles: +# - solid +# unicode: f001 # - output C++11: #define ICON_FA_MUSIC u8"\uf001" # - output C89: #define ICON_FA_MUSIC "\xEF\x80\x81" -# - output None: var icon-fa-music "" +# - output C#: public const string Music = "\uf001"; # -# 2.2 - Google Material Design icons -# - input: 3d_rotation e84d -# - output C++11: #define ICON_MD_3D_ROTATION u8"\ue84d" -# - output C89: #define ICON_MD_3D_ROTATION "\xEE\xA1\x8D" -# - output None: var icon-md-3d_rotation "" -# -# 2.3 - Kenney Game icons -# - input: .ki-home:before{ content: "\e900"; } -# - output C++11: #define ICON_KI_HOME u8"\ue900" -# - output C89: #define ICON_KI_HOME "\xEE\xA4\x80" -# - output None: var icon-ki-home "" -# -# 2.4 - All fonts -# - computed min and max unicode fonts ICON_MIN and ICON_MAX +# All fonts have computed min and max unicode fonts ICON_MIN and ICON_MAX # - output C89, C++11: #define ICON_MIN_FA 0xf000 -# #define ICON_MAX_FA 0xf295 -# - output None: var icon-min-fa 0xf000 -# var icon-max-fa 0xf2b2 +# #define ICON_MAX_FA 0xf2e0 +# - output C#: public const int IconMin = 0xf000; +# public const int IconMax = 0xf2e0; # #------------------------------------------------------------------------------ # 3 - Script dependencies # -# 3.1 - Python 2.7 - https://www.python.org/download/releases/2.7/ -# 3.2 - Requests - http://docs.python-requests.org/ -# 3.3 - PyYAML - http://pyyaml.org/ +# 3.1 - Fonts source material online +# 3.2 - Python 2.7 - https://www.python.org/download/releases/2.7/ +# 3.3 - Requests - http://docs.python-requests.org/ +# 3.4 - PyYAML - http://pyyaml.org/ # #------------------------------------------------------------------------------ # 4 - References # -# None language: https://bitbucket.org/duangle/nonelang/src +# GitHub repository: https://github.com/juliettef/IconFontCppHeaders/ # #------------------------------------------------------------------------------ @@ -72,10 +78,11 @@ import yaml # Fonts class Font: - font_tff = '[ ERROR - missing tff file info ]' - font_url = '[ ERROR - missing font data url ]' font_name = '[ ERROR - missing font name ]' font_abbr = '[ ERROR - missing font abbreviation ]' + font_url_data = '[ ERROR - missing font data url ]' + font_url_ttf = '[ ERROR - missing ttf file url ]' + font_file_name_ttf = '[ ERROR - missing ttf file name ]' @classmethod def get_icons( cls, input ): @@ -90,13 +97,12 @@ class Font: @classmethod def download( cls ): input_raw = '' - try : - response = requests.get( cls.font_url, timeout = 2 ) - if response.status_code == 200: - input_raw = response.content - print( 'Downloaded - ' + cls.font_name ) - except Exception as e : - print( '[ ERROR - {!s}: {!s} ]'.format( cls.font_name, e )) + response = requests.get( cls.font_url_data, timeout = 2 ) + if response.status_code == 200: + input_raw = response.content + print( 'Downloaded - ' + cls.font_name ) + else: + raise Exception( 'Download failed - ' + cls.font_name ) return input_raw @classmethod @@ -106,45 +112,113 @@ class Font: if input_raw: icons_data = cls.get_icons( input_raw ) font_ir.update( icons_data ) - font_ir.update({ 'font_tff' : cls.font_tff, - 'font_url' : cls.font_url, + font_ir.update({ 'font_url_ttf' : cls.font_url_ttf, + 'font_url_data' : cls.font_url_data, + 'font_file_name_ttf' : cls.font_file_name_ttf, 'font_name' : cls.font_name, 'font_abbr' : cls.font_abbr }) print( 'Generated intermediate data - ' + cls.font_name ) return font_ir -class FontFA( Font ): - font_tff = 'https://github.com/FortAwesome/Font-Awesome/blob/master/fonts/fontawesome-webfont.ttf' - font_url = 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml' - font_name = 'font_awesome' +class FontFA4( Font ): # legacy Font Awesome version 4 + font_name = 'Font Awesome 4' font_abbr = 'FA' + font_url_data = 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/src/icons.yml' + font_url_ttf = 'https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf' + font_file_name_ttf = [[ font_abbr, font_url_ttf[ font_url_ttf.rfind('/')+1: ]]] @classmethod def get_icons( self, input ): - icons_data = {} - data = yaml.safe_load( input ) + icons_data = { } + data = yaml.safe_load(input) + font_min = 'ffff' + font_max = '0' + icons = [] + for item in data[ 'icons' ]: + if item[ 'unicode' ] < font_min: + font_min = item[ 'unicode' ] + if item[ 'unicode' ] >= font_max: + font_max = item[ 'unicode' ] + icons.append([ item[ 'id' ], item[ 'unicode' ]]) + icons_data.update({ 'font_min' : font_min, + 'font_max' : font_max, + 'icons' : icons }) + return icons_data + + +class FontFK( FontFA4 ): # Fork Awesome, based on Font Awesome 4 + font_name = 'Fork Awesome' + font_abbr = 'FK' + font_url_data = 'https://raw.githubusercontent.com/ForkAwesome/Fork-Awesome/master/src/icons/icons.yml' + font_url_ttf = 'https://github.com/ForkAwesome/Fork-Awesome/blob/master/fonts/forkawesome-webfont.ttf' + + +class FontFA5( Font ): # Font Awesome version 5. Solid and Regular styles (Regular is a subset of Solid). + font_name = 'Font Awesome 5' + font_abbr = 'FA' + font_url_data = 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/advanced-options/metadata/icons.yml' + font_url_ttf = 'https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-solid-900.ttf, ' +\ + 'https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-regular-400.ttf, ' + font_file_name_ttf = [[ 'FAS', 'fa-solid-900.ttf' ], [ 'FAR', 'fa-regular-400.ttf' ]] + font_fa_style = [ 'solid', 'regular' ] + + @classmethod + def get_icons( self, input ): + icons_data = { } + data = yaml.safe_load(input) if data: font_min = 'ffff' font_max = '0' icons = [] - for item in data[ 'icons' ]: - if item[ 'unicode' ] < font_min: - font_min = item[ 'unicode' ] - if item[ 'unicode' ] >= font_max: - font_max = item[ 'unicode' ] - icons.append([ item[ 'id' ], item[ 'unicode' ]]) - icons_data.update({ 'font_min' : font_min, - 'font_max' : font_max, - 'icons' : icons }) + for key in data: + item = data[ key ] + for style in item[ 'styles' ]: + if style in self.font_fa_style: + if [ key, item[ 'unicode' ]] not in icons: + if item[ 'unicode' ] < font_min: + font_min = item[ 'unicode' ] + if item[ 'unicode' ] >= font_max: + font_max = item[ 'unicode' ] + icons.append([ key, item[ 'unicode' ] ]) + icons_data.update({ 'font_min':font_min, 'font_max':font_max, 'icons':icons }) return icons_data -class FontMD( Font ): - font_tff = 'https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf' - font_url = 'https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints' - font_name = 'material_design' +class FontFA5Brands( FontFA5 ): # Font Awesome version 5, Brand styles. + font_name = 'Font Awesome 5 Brands' + font_abbr = 'FAB' + font_url_ttf = 'https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-brands-400.ttf' + font_file_name_ttf = [[ font_abbr, font_url_ttf[ font_url_ttf.rfind('/') + 1: ]]] + font_fa_style = [ 'brands' ] + + @classmethod + def get_icons( self, input ): + icons_data = { } + data = yaml.safe_load(input) + if data: + font_min = 'ffff' + font_max = '0' + icons = [ ] + for key in data: + item = data[ key ] + for style in item[ 'styles' ]: + if style in self.font_fa_style: + if item[ 'unicode' ] < font_min: + font_min = item[ 'unicode' ] + if item[ 'unicode' ] >= font_max: + font_max = item[ 'unicode' ] + icons.append([ key, item[ 'unicode' ]]) + icons_data.update({ 'font_min':font_min, 'font_max':font_max, 'icons':icons }) + return icons_data + + +class FontMD( Font ): # Material Design + font_name = 'Material Design' font_abbr = 'MD' + font_url_data = 'https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints' + font_url_ttf = 'https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf' + font_file_name_ttf = [[ font_abbr, font_url_ttf[ font_url_ttf.rfind('/')+1: ]]] @classmethod def get_icons( self, input ): @@ -162,17 +236,51 @@ class FontMD( Font ): if words[ 1 ] >= font_max: font_max = words[ 1 ] icons.append( words ) + icons_data.update({ 'font_min' : font_min, + 'font_max' : font_max, + 'icons' : icons }) + return icons_data + + +class FontMDI( Font ): # Material Design Icons + font_name = 'Material Design Icons' + font_abbr = 'MDI' + font_url_data = 'https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css' + font_url_ttf = 'https://github.com/Templarian/MaterialDesign-Webfont/blob/master/fonts/materialdesignicons-webfont.ttf' + font_file_name_ttf = [[ font_abbr, font_url_ttf[ font_url_ttf.rfind('/')+1: ]]] + + @classmethod + def get_icons( self, input ): + icons_data = {} + input_trimmed = input[ input.find( '-moz-osx-font-smoothing: grayscale;\n}\n\n' ) + len( '-moz-osx-font-smoothing: grayscale;\n}\n\n' ) : input.find( '.mdi-18px.mdi-set,' )] + lines = str.split( input_trimmed, '}\n\n' ) + if lines: + font_min = 'ffff' + font_max = '0' + icons = [] + for line in lines : + if '.mdi-' in line: + words = str.split(line) + if words and '.mdi-' in words[ 0 ]: + font_id = words[ 0 ].partition( '.mdi-' )[2].partition( ':before' )[0] + font_code = words[ 3 ].partition( '"\\' )[2].partition( '";' )[0] + if font_code < font_min: + font_min = font_code + if font_code >= font_max: + font_max = font_code + icons.append([ font_id, font_code ]) icons_data.update({ 'font_min' : font_min, 'font_max' : font_max, 'icons' : icons }) return icons_data -class FontKI( Font ): - font_tff = 'https://github.com/SamBrishes/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf' - font_url = 'https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css' - font_name = 'kenney' +class FontKI( Font ): # Kenney Game icons + font_name = 'Kenney' font_abbr = 'KI' + font_url_data = 'https://raw.githubusercontent.com/nicodinh/kenney-icon-font/master/css/kenney-icons.css' + font_url_ttf = 'https://github.com/nicodinh/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf' + font_file_name_ttf = [[ font_abbr, font_url_ttf[ font_url_ttf.rfind('/')+1: ]]] @classmethod def get_icons( self, input ): @@ -199,6 +307,38 @@ class FontKI( Font ): return icons_data +class FontII( Font ): # Ionicons + font_name = 'Ionicons' + font_abbr = 'II' + font_url_data = 'https://raw.githubusercontent.com/ionic-team/ionicons/master/src/docs/archived/v2/css/ionicons.css' + font_url_ttf = 'https://github.com/ionic-team/ionicons/blob/master/src/docs/archived/v2/fonts/ionicons.ttf' + font_file_name_ttf = [[ font_abbr, font_url_ttf[ font_url_ttf.rfind('/') + 1: ]]] + + @classmethod + def get_icons( self, input ): + icons_data = {} + lines = str.split( input, '\n' ) + if lines: + font_min = 'ffff' + font_max = '0' + icons = [] + for line in lines : + if ( '.ion-' and 'content:' ) in line: + words = str.split(line) + if words and '.ion-' in words[ 0 ]: + font_id = words[ 0 ].partition( '.ion-' )[2].partition( ':before' )[0] + font_code = words[ 3 ].partition( '"\\' )[2].partition( '";' )[0] + if font_code < font_min: + font_min = font_code + if font_code >= font_max: + font_max = font_code + icons.append([ font_id, font_code ]) + icons_data.update({ 'font_min' : font_min, + 'font_max' : font_max, + 'icons' : icons }) + return icons_data + + # Languages @@ -212,13 +352,13 @@ class Language: @classmethod def prelude( cls ): - print('[ ERROR - missing implementation of class method prelude for {!s} ]'.format(cls.language_name)) + print('[ ERROR - missing implementation of class method prelude for {!s} ]'.format( cls.language_name )) result = '[ ERROR - missing prelude ]' return result @classmethod def lines_minmax( cls ): - print('[ ERROR - missing implementation of class method lines_minmax for {!s} ]'.format(cls.language_name)) + print('[ ERROR - missing implementation of class method lines_minmax for {!s} ]'.format( cls.language_name )) result = '[ ERROR - missing min and max ]' return result @@ -228,18 +368,23 @@ class Language: result = '[ ERROR - missing icon line ]' return result + @classmethod + def epilogue( cls ): + return '' + @classmethod def convert( cls ): result = cls.prelude() + cls.lines_minmax() for icon in cls.intermediate.get( 'icons' ): line_icon = cls.line_icon( icon ) result += line_icon - print ( 'Converted - {!s} for {!s}' ).format( cls.intermediate.get( 'font_name' ), cls.language_name) + result += cls.epilogue() + print ( 'Converted - {!s} for {!s}' ).format( cls.intermediate.get( 'font_name' ), cls.language_name ) return result @classmethod def save_to_file( cls ): - filename = cls.file_name.format( name = str(cls.intermediate.get( 'font_name' )).replace( ' ', '' )) + filename = cls.file_name.format( name = str.lower(cls.intermediate.get( 'font_name' )).replace( ' ', '_' )) converted = cls.convert() with open( filename, 'w' ) as f: f.write( converted ) @@ -252,24 +397,28 @@ class LanguageC89( Language ): @classmethod def prelude( cls ): - tmpl_prelude = '// Generated by GenerateIconFontCppHeaders.py for language {lang}\n' + \ - '// from {url}\n' + \ - '// for use with {tff}\n' + \ - '#pragma once\n\n' + tmpl_prelude = '// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language {lang}\n' + \ + '// from {url_data}\n' + \ + '// for use with {url_ttf}\n' + \ + '#pragma once\n\n' result = tmpl_prelude.format(lang = cls.language_name, - url = cls.intermediate.get('font_url'), - tff = cls.intermediate.get('font_tff')) - return result + url_data = cls.intermediate.get( 'font_url_data' ), + url_ttf = cls.intermediate.get( 'font_url_ttf' )) + tmpl_prelude_define_file_name = '#define FONT_ICON_FILE_NAME_{font_abbr} "{file_name_ttf}"\n' + file_names_ttf = cls.intermediate.get( 'font_file_name_ttf' ) + for file_name_ttf in file_names_ttf: + result += tmpl_prelude_define_file_name.format( font_abbr = file_name_ttf[ 0 ], file_name_ttf = file_name_ttf[ 1 ]) + return result + '\n' @classmethod def lines_minmax( cls ): tmpl_line_minmax = '#define ICON_{minmax}_{abbr} 0x{val}\n' result = tmpl_line_minmax.format(minmax = 'MIN', - abbr = cls.intermediate.get('font_abbr'), - val = cls.intermediate.get('font_min')) + \ + abbr = cls.intermediate.get( 'font_abbr' ), + val = cls.intermediate.get( 'font_min' )) + \ tmpl_line_minmax.format(minmax = 'MAX', - abbr = cls.intermediate.get('font_abbr'), - val = cls.intermediate.get('font_max')) + abbr = cls.intermediate.get( 'font_abbr' ), + val = cls.intermediate.get( 'font_max' )) return result @classmethod @@ -293,58 +442,90 @@ class LanguageCpp11( LanguageC89 ): tmpl_line_icon = '#define ICON_{abbr}_{icon} u8"\u{code}"\n' icon_name = str.upper( icon[ 0 ]).replace( '-', '_' ) icon_code = icon[ 1 ] - result = tmpl_line_icon.format( abbr = cls.intermediate.get('font_abbr'), + result = tmpl_line_icon.format( abbr = cls.intermediate.get( 'font_abbr' ), icon = icon_name, code = icon_code) return result -class LanguageNone( Language ): - language_name = 'None' - file_name = 'Icons{name}.n' +class LanguageCSharp( Language ): + language_name = "C#" + file_name = 'Icons{name}.cs' @classmethod def prelude( cls ): - tmpl_prelude = 'none\n' + \ - '; Generated by GenerateIconFontCppHeaders.py for language {lang}\n' + \ - '; from {url}\n' + \ - '; for use with {tff}\n' + \ - '\n$\n' - result = tmpl_prelude.format( lang = cls.language_name, - url = cls.intermediate.get( 'font_url' ), - tff = cls.intermediate.get( 'font_tff' )) - return result + tmpl_prelude = '// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language {lang}\n' + \ + '// from {url_data}\n' + \ + '// for use with {url_ttf}\n' + \ + 'namespace IconFonts\n' + \ + '{{\n' + \ + ' public class {font_name}\n' + \ + ' {{\n' + + result = tmpl_prelude.format(lang = cls.language_name, + url_data = cls.intermediate.get( 'font_url_data' ), + url_ttf = cls.intermediate.get( 'font_url_ttf' ), + font_name = cls.intermediate.get( 'font_name' ).replace( ' ', '' ) + ) + tmpl_prelude_define_file_name = ' public const string FontIconFileName = "{file_name_ttf}";\n' + file_names_ttf = cls.intermediate.get( 'font_file_name_ttf' ) + for file_name_ttf in file_names_ttf: + result += tmpl_prelude_define_file_name.format( file_name_ttf = file_name_ttf[ 1 ]) + return result + '\n' + + @classmethod + def epilogue( cls ): + return ' }\n' + \ + '}\n' @classmethod def lines_minmax( cls ): - tmpl_line_minmax = ' var icon-{minmax}-{abbr} 0x{val}\n' - result = tmpl_line_minmax.format( minmax = 'min', - abbr = cls.intermediate.get( 'font_abbr' ).lower(), - val = cls.intermediate.get( 'font_min' )) + \ - tmpl_line_minmax.format( minmax = 'max', - abbr = cls.intermediate.get( 'font_abbr' ).lower(), - val = cls.intermediate.get( 'font_max' )) + tmpl_line_minmax = ' public const int Icon{minmax} = 0x{val};\n' + result = tmpl_line_minmax.format(minmax = 'Min', + val = cls.intermediate.get( 'font_min' )) + \ + tmpl_line_minmax.format(minmax = 'Max', + val = cls.intermediate.get( 'font_max' )) return result @classmethod def line_icon( cls, icon ): - tmpl_line_icon = ' var icon-{abbr}-{icon} "{code}"\n' - icon_name = str.upper( icon[ 0 ]).replace( '-', '_' ).lower() - icon_code = unichr( int( icon[ 1 ], 16 )).encode( 'utf-8' ) - result = tmpl_line_icon.format( abbr = cls.intermediate.get( 'font_abbr' ).lower(), - icon = icon_name, - code = icon_code ) + + tmpl_line_icon = ' public const string {icon} = "\u{code}";\n' + icon_name = cls.to_camelcase(icon[ 0 ]) + icon_code = icon[ 1 ] + + if icon_name[ 0 ].isdigit(): + # Variable may not start with a digit + icon_name = 'The' + icon_name + + if icon_name == cls.intermediate.get( 'font_name' ).replace( ' ', '' ): + # Member may not have same name as enclosing class + icon_name += 'Icon' + + result = tmpl_line_icon.format( icon = icon_name, + code = icon_code) return result + @classmethod + def to_camelcase( cls, text ): + parts = text.split( '-' ) + for i in range( len( parts ) ): + p = parts[i] + parts[ i ] = p[ 0 ].upper() + p[ 1: ].lower() + return ''.join( parts ) + # Main - -fonts = [ FontKI , FontMD, FontFA ] +fonts = [ FontFA4, FontFA5, FontFA5Brands, FontFK, FontMD, FontMDI, FontKI, FontII ] languages = [ LanguageC89 ] intermediates = [] for font in fonts: - intermediates.append( font.get_intermediate_representation()) + try: + font_intermediate = font.get_intermediate_representation() + intermediates.append( font_intermediate ) + except Exception as e: + print( '[ ERROR: {!s} ]'.format( e )) for interm in intermediates: Language.intermediate = interm for lang in languages: diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_4.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_4.h new file mode 100644 index 00000000000..e03b905f71a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_4.h @@ -0,0 +1,684 @@ +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/FortAwesome/Font-Awesome/fa-4/src/icons.yml +// for use with https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf +#pragma once + +#define FONT_ICON_FILE_NAME_FA "fontawesome-webfont.ttf" + +#define ICON_MIN_FA 0xf000 +#define ICON_MAX_FA 0xf2e0 +#define ICON_FA_GLASS "\xEF\x80\x80" +#define ICON_FA_MUSIC "\xEF\x80\x81" +#define ICON_FA_SEARCH "\xEF\x80\x82" +#define ICON_FA_ENVELOPE_O "\xEF\x80\x83" +#define ICON_FA_HEART "\xEF\x80\x84" +#define ICON_FA_STAR "\xEF\x80\x85" +#define ICON_FA_STAR_O "\xEF\x80\x86" +#define ICON_FA_USER "\xEF\x80\x87" +#define ICON_FA_FILM "\xEF\x80\x88" +#define ICON_FA_TH_LARGE "\xEF\x80\x89" +#define ICON_FA_TH "\xEF\x80\x8A" +#define ICON_FA_TH_LIST "\xEF\x80\x8B" +#define ICON_FA_CHECK "\xEF\x80\x8C" +#define ICON_FA_TIMES "\xEF\x80\x8D" +#define ICON_FA_SEARCH_PLUS "\xEF\x80\x8E" +#define ICON_FA_SEARCH_MINUS "\xEF\x80\x90" +#define ICON_FA_POWER_OFF "\xEF\x80\x91" +#define ICON_FA_SIGNAL "\xEF\x80\x92" +#define ICON_FA_COG "\xEF\x80\x93" +#define ICON_FA_TRASH_O "\xEF\x80\x94" +#define ICON_FA_HOME "\xEF\x80\x95" +#define ICON_FA_FILE_O "\xEF\x80\x96" +#define ICON_FA_CLOCK_O "\xEF\x80\x97" +#define ICON_FA_ROAD "\xEF\x80\x98" +#define ICON_FA_DOWNLOAD "\xEF\x80\x99" +#define ICON_FA_ARROW_CIRCLE_O_DOWN "\xEF\x80\x9A" +#define ICON_FA_ARROW_CIRCLE_O_UP "\xEF\x80\x9B" +#define ICON_FA_INBOX "\xEF\x80\x9C" +#define ICON_FA_PLAY_CIRCLE_O "\xEF\x80\x9D" +#define ICON_FA_REPEAT "\xEF\x80\x9E" +#define ICON_FA_REFRESH "\xEF\x80\xA1" +#define ICON_FA_LIST_ALT "\xEF\x80\xA2" +#define ICON_FA_LOCK "\xEF\x80\xA3" +#define ICON_FA_FLAG "\xEF\x80\xA4" +#define ICON_FA_HEADPHONES "\xEF\x80\xA5" +#define ICON_FA_VOLUME_OFF "\xEF\x80\xA6" +#define ICON_FA_VOLUME_DOWN "\xEF\x80\xA7" +#define ICON_FA_VOLUME_UP "\xEF\x80\xA8" +#define ICON_FA_QRCODE "\xEF\x80\xA9" +#define ICON_FA_BARCODE "\xEF\x80\xAA" +#define ICON_FA_TAG "\xEF\x80\xAB" +#define ICON_FA_TAGS "\xEF\x80\xAC" +#define ICON_FA_BOOK "\xEF\x80\xAD" +#define ICON_FA_BOOKMARK "\xEF\x80\xAE" +#define ICON_FA_PRINT "\xEF\x80\xAF" +#define ICON_FA_CAMERA "\xEF\x80\xB0" +#define ICON_FA_FONT "\xEF\x80\xB1" +#define ICON_FA_BOLD "\xEF\x80\xB2" +#define ICON_FA_ITALIC "\xEF\x80\xB3" +#define ICON_FA_TEXT_HEIGHT "\xEF\x80\xB4" +#define ICON_FA_TEXT_WIDTH "\xEF\x80\xB5" +#define ICON_FA_ALIGN_LEFT "\xEF\x80\xB6" +#define ICON_FA_ALIGN_CENTER "\xEF\x80\xB7" +#define ICON_FA_ALIGN_RIGHT "\xEF\x80\xB8" +#define ICON_FA_ALIGN_JUSTIFY "\xEF\x80\xB9" +#define ICON_FA_LIST "\xEF\x80\xBA" +#define ICON_FA_OUTDENT "\xEF\x80\xBB" +#define ICON_FA_INDENT "\xEF\x80\xBC" +#define ICON_FA_VIDEO_CAMERA "\xEF\x80\xBD" +#define ICON_FA_PICTURE_O "\xEF\x80\xBE" +#define ICON_FA_PENCIL "\xEF\x81\x80" +#define ICON_FA_MAP_MARKER "\xEF\x81\x81" +#define ICON_FA_ADJUST "\xEF\x81\x82" +#define ICON_FA_TINT "\xEF\x81\x83" +#define ICON_FA_PENCIL_SQUARE_O "\xEF\x81\x84" +#define ICON_FA_SHARE_SQUARE_O "\xEF\x81\x85" +#define ICON_FA_CHECK_SQUARE_O "\xEF\x81\x86" +#define ICON_FA_ARROWS "\xEF\x81\x87" +#define ICON_FA_STEP_BACKWARD "\xEF\x81\x88" +#define ICON_FA_FAST_BACKWARD "\xEF\x81\x89" +#define ICON_FA_BACKWARD "\xEF\x81\x8A" +#define ICON_FA_PLAY "\xEF\x81\x8B" +#define ICON_FA_PAUSE "\xEF\x81\x8C" +#define ICON_FA_STOP "\xEF\x81\x8D" +#define ICON_FA_FORWARD "\xEF\x81\x8E" +#define ICON_FA_FAST_FORWARD "\xEF\x81\x90" +#define ICON_FA_STEP_FORWARD "\xEF\x81\x91" +#define ICON_FA_EJECT "\xEF\x81\x92" +#define ICON_FA_CHEVRON_LEFT "\xEF\x81\x93" +#define ICON_FA_CHEVRON_RIGHT "\xEF\x81\x94" +#define ICON_FA_PLUS_CIRCLE "\xEF\x81\x95" +#define ICON_FA_MINUS_CIRCLE "\xEF\x81\x96" +#define ICON_FA_TIMES_CIRCLE "\xEF\x81\x97" +#define ICON_FA_CHECK_CIRCLE "\xEF\x81\x98" +#define ICON_FA_QUESTION_CIRCLE "\xEF\x81\x99" +#define ICON_FA_INFO_CIRCLE "\xEF\x81\x9A" +#define ICON_FA_CROSSHAIRS "\xEF\x81\x9B" +#define ICON_FA_TIMES_CIRCLE_O "\xEF\x81\x9C" +#define ICON_FA_CHECK_CIRCLE_O "\xEF\x81\x9D" +#define ICON_FA_BAN "\xEF\x81\x9E" +#define ICON_FA_ARROW_LEFT "\xEF\x81\xA0" +#define ICON_FA_ARROW_RIGHT "\xEF\x81\xA1" +#define ICON_FA_ARROW_UP "\xEF\x81\xA2" +#define ICON_FA_ARROW_DOWN "\xEF\x81\xA3" +#define ICON_FA_SHARE "\xEF\x81\xA4" +#define ICON_FA_EXPAND "\xEF\x81\xA5" +#define ICON_FA_COMPRESS "\xEF\x81\xA6" +#define ICON_FA_PLUS "\xEF\x81\xA7" +#define ICON_FA_MINUS "\xEF\x81\xA8" +#define ICON_FA_ASTERISK "\xEF\x81\xA9" +#define ICON_FA_EXCLAMATION_CIRCLE "\xEF\x81\xAA" +#define ICON_FA_GIFT "\xEF\x81\xAB" +#define ICON_FA_LEAF "\xEF\x81\xAC" +#define ICON_FA_FIRE "\xEF\x81\xAD" +#define ICON_FA_EYE "\xEF\x81\xAE" +#define ICON_FA_EYE_SLASH "\xEF\x81\xB0" +#define ICON_FA_EXCLAMATION_TRIANGLE "\xEF\x81\xB1" +#define ICON_FA_PLANE "\xEF\x81\xB2" +#define ICON_FA_CALENDAR "\xEF\x81\xB3" +#define ICON_FA_RANDOM "\xEF\x81\xB4" +#define ICON_FA_COMMENT "\xEF\x81\xB5" +#define ICON_FA_MAGNET "\xEF\x81\xB6" +#define ICON_FA_CHEVRON_UP "\xEF\x81\xB7" +#define ICON_FA_CHEVRON_DOWN "\xEF\x81\xB8" +#define ICON_FA_RETWEET "\xEF\x81\xB9" +#define ICON_FA_SHOPPING_CART "\xEF\x81\xBA" +#define ICON_FA_FOLDER "\xEF\x81\xBB" +#define ICON_FA_FOLDER_OPEN "\xEF\x81\xBC" +#define ICON_FA_ARROWS_V "\xEF\x81\xBD" +#define ICON_FA_ARROWS_H "\xEF\x81\xBE" +#define ICON_FA_BAR_CHART "\xEF\x82\x80" +#define ICON_FA_TWITTER_SQUARE "\xEF\x82\x81" +#define ICON_FA_FACEBOOK_SQUARE "\xEF\x82\x82" +#define ICON_FA_CAMERA_RETRO "\xEF\x82\x83" +#define ICON_FA_KEY "\xEF\x82\x84" +#define ICON_FA_COGS "\xEF\x82\x85" +#define ICON_FA_COMMENTS "\xEF\x82\x86" +#define ICON_FA_THUMBS_O_UP "\xEF\x82\x87" +#define ICON_FA_THUMBS_O_DOWN "\xEF\x82\x88" +#define ICON_FA_STAR_HALF "\xEF\x82\x89" +#define ICON_FA_HEART_O "\xEF\x82\x8A" +#define ICON_FA_SIGN_OUT "\xEF\x82\x8B" +#define ICON_FA_LINKEDIN_SQUARE "\xEF\x82\x8C" +#define ICON_FA_THUMB_TACK "\xEF\x82\x8D" +#define ICON_FA_EXTERNAL_LINK "\xEF\x82\x8E" +#define ICON_FA_SIGN_IN "\xEF\x82\x90" +#define ICON_FA_TROPHY "\xEF\x82\x91" +#define ICON_FA_GITHUB_SQUARE "\xEF\x82\x92" +#define ICON_FA_UPLOAD "\xEF\x82\x93" +#define ICON_FA_LEMON_O "\xEF\x82\x94" +#define ICON_FA_PHONE "\xEF\x82\x95" +#define ICON_FA_SQUARE_O "\xEF\x82\x96" +#define ICON_FA_BOOKMARK_O "\xEF\x82\x97" +#define ICON_FA_PHONE_SQUARE "\xEF\x82\x98" +#define ICON_FA_TWITTER "\xEF\x82\x99" +#define ICON_FA_FACEBOOK "\xEF\x82\x9A" +#define ICON_FA_GITHUB "\xEF\x82\x9B" +#define ICON_FA_UNLOCK "\xEF\x82\x9C" +#define ICON_FA_CREDIT_CARD "\xEF\x82\x9D" +#define ICON_FA_RSS "\xEF\x82\x9E" +#define ICON_FA_HDD_O "\xEF\x82\xA0" +#define ICON_FA_BULLHORN "\xEF\x82\xA1" +#define ICON_FA_BELL "\xEF\x83\xB3" +#define ICON_FA_CERTIFICATE "\xEF\x82\xA3" +#define ICON_FA_HAND_O_RIGHT "\xEF\x82\xA4" +#define ICON_FA_HAND_O_LEFT "\xEF\x82\xA5" +#define ICON_FA_HAND_O_UP "\xEF\x82\xA6" +#define ICON_FA_HAND_O_DOWN "\xEF\x82\xA7" +#define ICON_FA_ARROW_CIRCLE_LEFT "\xEF\x82\xA8" +#define ICON_FA_ARROW_CIRCLE_RIGHT "\xEF\x82\xA9" +#define ICON_FA_ARROW_CIRCLE_UP "\xEF\x82\xAA" +#define ICON_FA_ARROW_CIRCLE_DOWN "\xEF\x82\xAB" +#define ICON_FA_GLOBE "\xEF\x82\xAC" +#define ICON_FA_WRENCH "\xEF\x82\xAD" +#define ICON_FA_TASKS "\xEF\x82\xAE" +#define ICON_FA_FILTER "\xEF\x82\xB0" +#define ICON_FA_BRIEFCASE "\xEF\x82\xB1" +#define ICON_FA_ARROWS_ALT "\xEF\x82\xB2" +#define ICON_FA_USERS "\xEF\x83\x80" +#define ICON_FA_LINK "\xEF\x83\x81" +#define ICON_FA_CLOUD "\xEF\x83\x82" +#define ICON_FA_FLASK "\xEF\x83\x83" +#define ICON_FA_SCISSORS "\xEF\x83\x84" +#define ICON_FA_FILES_O "\xEF\x83\x85" +#define ICON_FA_PAPERCLIP "\xEF\x83\x86" +#define ICON_FA_FLOPPY_O "\xEF\x83\x87" +#define ICON_FA_SQUARE "\xEF\x83\x88" +#define ICON_FA_BARS "\xEF\x83\x89" +#define ICON_FA_LIST_UL "\xEF\x83\x8A" +#define ICON_FA_LIST_OL "\xEF\x83\x8B" +#define ICON_FA_STRIKETHROUGH "\xEF\x83\x8C" +#define ICON_FA_UNDERLINE "\xEF\x83\x8D" +#define ICON_FA_TABLE "\xEF\x83\x8E" +#define ICON_FA_MAGIC "\xEF\x83\x90" +#define ICON_FA_TRUCK "\xEF\x83\x91" +#define ICON_FA_PINTEREST "\xEF\x83\x92" +#define ICON_FA_PINTEREST_SQUARE "\xEF\x83\x93" +#define ICON_FA_GOOGLE_PLUS_SQUARE "\xEF\x83\x94" +#define ICON_FA_GOOGLE_PLUS "\xEF\x83\x95" +#define ICON_FA_MONEY "\xEF\x83\x96" +#define ICON_FA_CARET_DOWN "\xEF\x83\x97" +#define ICON_FA_CARET_UP "\xEF\x83\x98" +#define ICON_FA_CARET_LEFT "\xEF\x83\x99" +#define ICON_FA_CARET_RIGHT "\xEF\x83\x9A" +#define ICON_FA_COLUMNS "\xEF\x83\x9B" +#define ICON_FA_SORT "\xEF\x83\x9C" +#define ICON_FA_SORT_DESC "\xEF\x83\x9D" +#define ICON_FA_SORT_ASC "\xEF\x83\x9E" +#define ICON_FA_ENVELOPE "\xEF\x83\xA0" +#define ICON_FA_LINKEDIN "\xEF\x83\xA1" +#define ICON_FA_UNDO "\xEF\x83\xA2" +#define ICON_FA_GAVEL "\xEF\x83\xA3" +#define ICON_FA_TACHOMETER "\xEF\x83\xA4" +#define ICON_FA_COMMENT_O "\xEF\x83\xA5" +#define ICON_FA_COMMENTS_O "\xEF\x83\xA6" +#define ICON_FA_BOLT "\xEF\x83\xA7" +#define ICON_FA_SITEMAP "\xEF\x83\xA8" +#define ICON_FA_UMBRELLA "\xEF\x83\xA9" +#define ICON_FA_CLIPBOARD "\xEF\x83\xAA" +#define ICON_FA_LIGHTBULB_O "\xEF\x83\xAB" +#define ICON_FA_EXCHANGE "\xEF\x83\xAC" +#define ICON_FA_CLOUD_DOWNLOAD "\xEF\x83\xAD" +#define ICON_FA_CLOUD_UPLOAD "\xEF\x83\xAE" +#define ICON_FA_USER_MD "\xEF\x83\xB0" +#define ICON_FA_STETHOSCOPE "\xEF\x83\xB1" +#define ICON_FA_SUITCASE "\xEF\x83\xB2" +#define ICON_FA_BELL_O "\xEF\x82\xA2" +#define ICON_FA_COFFEE "\xEF\x83\xB4" +#define ICON_FA_CUTLERY "\xEF\x83\xB5" +#define ICON_FA_FILE_TEXT_O "\xEF\x83\xB6" +#define ICON_FA_BUILDING_O "\xEF\x83\xB7" +#define ICON_FA_HOSPITAL_O "\xEF\x83\xB8" +#define ICON_FA_AMBULANCE "\xEF\x83\xB9" +#define ICON_FA_MEDKIT "\xEF\x83\xBA" +#define ICON_FA_FIGHTER_JET "\xEF\x83\xBB" +#define ICON_FA_BEER "\xEF\x83\xBC" +#define ICON_FA_H_SQUARE "\xEF\x83\xBD" +#define ICON_FA_PLUS_SQUARE "\xEF\x83\xBE" +#define ICON_FA_ANGLE_DOUBLE_LEFT "\xEF\x84\x80" +#define ICON_FA_ANGLE_DOUBLE_RIGHT "\xEF\x84\x81" +#define ICON_FA_ANGLE_DOUBLE_UP "\xEF\x84\x82" +#define ICON_FA_ANGLE_DOUBLE_DOWN "\xEF\x84\x83" +#define ICON_FA_ANGLE_LEFT "\xEF\x84\x84" +#define ICON_FA_ANGLE_RIGHT "\xEF\x84\x85" +#define ICON_FA_ANGLE_UP "\xEF\x84\x86" +#define ICON_FA_ANGLE_DOWN "\xEF\x84\x87" +#define ICON_FA_DESKTOP "\xEF\x84\x88" +#define ICON_FA_LAPTOP "\xEF\x84\x89" +#define ICON_FA_TABLET "\xEF\x84\x8A" +#define ICON_FA_MOBILE "\xEF\x84\x8B" +#define ICON_FA_CIRCLE_O "\xEF\x84\x8C" +#define ICON_FA_QUOTE_LEFT "\xEF\x84\x8D" +#define ICON_FA_QUOTE_RIGHT "\xEF\x84\x8E" +#define ICON_FA_SPINNER "\xEF\x84\x90" +#define ICON_FA_CIRCLE "\xEF\x84\x91" +#define ICON_FA_REPLY "\xEF\x84\x92" +#define ICON_FA_GITHUB_ALT "\xEF\x84\x93" +#define ICON_FA_FOLDER_O "\xEF\x84\x94" +#define ICON_FA_FOLDER_OPEN_O "\xEF\x84\x95" +#define ICON_FA_SMILE_O "\xEF\x84\x98" +#define ICON_FA_FROWN_O "\xEF\x84\x99" +#define ICON_FA_MEH_O "\xEF\x84\x9A" +#define ICON_FA_GAMEPAD "\xEF\x84\x9B" +#define ICON_FA_KEYBOARD_O "\xEF\x84\x9C" +#define ICON_FA_FLAG_O "\xEF\x84\x9D" +#define ICON_FA_FLAG_CHECKERED "\xEF\x84\x9E" +#define ICON_FA_TERMINAL "\xEF\x84\xA0" +#define ICON_FA_CODE "\xEF\x84\xA1" +#define ICON_FA_REPLY_ALL "\xEF\x84\xA2" +#define ICON_FA_STAR_HALF_O "\xEF\x84\xA3" +#define ICON_FA_LOCATION_ARROW "\xEF\x84\xA4" +#define ICON_FA_CROP "\xEF\x84\xA5" +#define ICON_FA_CODE_FORK "\xEF\x84\xA6" +#define ICON_FA_CHAIN_BROKEN "\xEF\x84\xA7" +#define ICON_FA_QUESTION "\xEF\x84\xA8" +#define ICON_FA_INFO "\xEF\x84\xA9" +#define ICON_FA_EXCLAMATION "\xEF\x84\xAA" +#define ICON_FA_SUPERSCRIPT "\xEF\x84\xAB" +#define ICON_FA_SUBSCRIPT "\xEF\x84\xAC" +#define ICON_FA_ERASER "\xEF\x84\xAD" +#define ICON_FA_PUZZLE_PIECE "\xEF\x84\xAE" +#define ICON_FA_MICROPHONE "\xEF\x84\xB0" +#define ICON_FA_MICROPHONE_SLASH "\xEF\x84\xB1" +#define ICON_FA_SHIELD "\xEF\x84\xB2" +#define ICON_FA_CALENDAR_O "\xEF\x84\xB3" +#define ICON_FA_FIRE_EXTINGUISHER "\xEF\x84\xB4" +#define ICON_FA_ROCKET "\xEF\x84\xB5" +#define ICON_FA_MAXCDN "\xEF\x84\xB6" +#define ICON_FA_CHEVRON_CIRCLE_LEFT "\xEF\x84\xB7" +#define ICON_FA_CHEVRON_CIRCLE_RIGHT "\xEF\x84\xB8" +#define ICON_FA_CHEVRON_CIRCLE_UP "\xEF\x84\xB9" +#define ICON_FA_CHEVRON_CIRCLE_DOWN "\xEF\x84\xBA" +#define ICON_FA_HTML5 "\xEF\x84\xBB" +#define ICON_FA_CSS3 "\xEF\x84\xBC" +#define ICON_FA_ANCHOR "\xEF\x84\xBD" +#define ICON_FA_UNLOCK_ALT "\xEF\x84\xBE" +#define ICON_FA_BULLSEYE "\xEF\x85\x80" +#define ICON_FA_ELLIPSIS_H "\xEF\x85\x81" +#define ICON_FA_ELLIPSIS_V "\xEF\x85\x82" +#define ICON_FA_RSS_SQUARE "\xEF\x85\x83" +#define ICON_FA_PLAY_CIRCLE "\xEF\x85\x84" +#define ICON_FA_TICKET "\xEF\x85\x85" +#define ICON_FA_MINUS_SQUARE "\xEF\x85\x86" +#define ICON_FA_MINUS_SQUARE_O "\xEF\x85\x87" +#define ICON_FA_LEVEL_UP "\xEF\x85\x88" +#define ICON_FA_LEVEL_DOWN "\xEF\x85\x89" +#define ICON_FA_CHECK_SQUARE "\xEF\x85\x8A" +#define ICON_FA_PENCIL_SQUARE "\xEF\x85\x8B" +#define ICON_FA_EXTERNAL_LINK_SQUARE "\xEF\x85\x8C" +#define ICON_FA_SHARE_SQUARE "\xEF\x85\x8D" +#define ICON_FA_COMPASS "\xEF\x85\x8E" +#define ICON_FA_CARET_SQUARE_O_DOWN "\xEF\x85\x90" +#define ICON_FA_CARET_SQUARE_O_UP "\xEF\x85\x91" +#define ICON_FA_CARET_SQUARE_O_RIGHT "\xEF\x85\x92" +#define ICON_FA_EUR "\xEF\x85\x93" +#define ICON_FA_GBP "\xEF\x85\x94" +#define ICON_FA_USD "\xEF\x85\x95" +#define ICON_FA_INR "\xEF\x85\x96" +#define ICON_FA_JPY "\xEF\x85\x97" +#define ICON_FA_RUB "\xEF\x85\x98" +#define ICON_FA_KRW "\xEF\x85\x99" +#define ICON_FA_BTC "\xEF\x85\x9A" +#define ICON_FA_FILE "\xEF\x85\x9B" +#define ICON_FA_FILE_TEXT "\xEF\x85\x9C" +#define ICON_FA_SORT_ALPHA_ASC "\xEF\x85\x9D" +#define ICON_FA_SORT_ALPHA_DESC "\xEF\x85\x9E" +#define ICON_FA_SORT_AMOUNT_ASC "\xEF\x85\xA0" +#define ICON_FA_SORT_AMOUNT_DESC "\xEF\x85\xA1" +#define ICON_FA_SORT_NUMERIC_ASC "\xEF\x85\xA2" +#define ICON_FA_SORT_NUMERIC_DESC "\xEF\x85\xA3" +#define ICON_FA_THUMBS_UP "\xEF\x85\xA4" +#define ICON_FA_THUMBS_DOWN "\xEF\x85\xA5" +#define ICON_FA_YOUTUBE_SQUARE "\xEF\x85\xA6" +#define ICON_FA_YOUTUBE "\xEF\x85\xA7" +#define ICON_FA_XING "\xEF\x85\xA8" +#define ICON_FA_XING_SQUARE "\xEF\x85\xA9" +#define ICON_FA_YOUTUBE_PLAY "\xEF\x85\xAA" +#define ICON_FA_DROPBOX "\xEF\x85\xAB" +#define ICON_FA_STACK_OVERFLOW "\xEF\x85\xAC" +#define ICON_FA_INSTAGRAM "\xEF\x85\xAD" +#define ICON_FA_FLICKR "\xEF\x85\xAE" +#define ICON_FA_ADN "\xEF\x85\xB0" +#define ICON_FA_BITBUCKET "\xEF\x85\xB1" +#define ICON_FA_BITBUCKET_SQUARE "\xEF\x85\xB2" +#define ICON_FA_TUMBLR "\xEF\x85\xB3" +#define ICON_FA_TUMBLR_SQUARE "\xEF\x85\xB4" +#define ICON_FA_LONG_ARROW_DOWN "\xEF\x85\xB5" +#define ICON_FA_LONG_ARROW_UP "\xEF\x85\xB6" +#define ICON_FA_LONG_ARROW_LEFT "\xEF\x85\xB7" +#define ICON_FA_LONG_ARROW_RIGHT "\xEF\x85\xB8" +#define ICON_FA_APPLE "\xEF\x85\xB9" +#define ICON_FA_WINDOWS "\xEF\x85\xBA" +#define ICON_FA_ANDROID "\xEF\x85\xBB" +#define ICON_FA_LINUX "\xEF\x85\xBC" +#define ICON_FA_DRIBBBLE "\xEF\x85\xBD" +#define ICON_FA_SKYPE "\xEF\x85\xBE" +#define ICON_FA_FOURSQUARE "\xEF\x86\x80" +#define ICON_FA_TRELLO "\xEF\x86\x81" +#define ICON_FA_FEMALE "\xEF\x86\x82" +#define ICON_FA_MALE "\xEF\x86\x83" +#define ICON_FA_GRATIPAY "\xEF\x86\x84" +#define ICON_FA_SUN_O "\xEF\x86\x85" +#define ICON_FA_MOON_O "\xEF\x86\x86" +#define ICON_FA_ARCHIVE "\xEF\x86\x87" +#define ICON_FA_BUG "\xEF\x86\x88" +#define ICON_FA_VK "\xEF\x86\x89" +#define ICON_FA_WEIBO "\xEF\x86\x8A" +#define ICON_FA_RENREN "\xEF\x86\x8B" +#define ICON_FA_PAGELINES "\xEF\x86\x8C" +#define ICON_FA_STACK_EXCHANGE "\xEF\x86\x8D" +#define ICON_FA_ARROW_CIRCLE_O_RIGHT "\xEF\x86\x8E" +#define ICON_FA_ARROW_CIRCLE_O_LEFT "\xEF\x86\x90" +#define ICON_FA_CARET_SQUARE_O_LEFT "\xEF\x86\x91" +#define ICON_FA_DOT_CIRCLE_O "\xEF\x86\x92" +#define ICON_FA_WHEELCHAIR "\xEF\x86\x93" +#define ICON_FA_VIMEO_SQUARE "\xEF\x86\x94" +#define ICON_FA_TRY "\xEF\x86\x95" +#define ICON_FA_PLUS_SQUARE_O "\xEF\x86\x96" +#define ICON_FA_SPACE_SHUTTLE "\xEF\x86\x97" +#define ICON_FA_SLACK "\xEF\x86\x98" +#define ICON_FA_ENVELOPE_SQUARE "\xEF\x86\x99" +#define ICON_FA_WORDPRESS "\xEF\x86\x9A" +#define ICON_FA_OPENID "\xEF\x86\x9B" +#define ICON_FA_UNIVERSITY "\xEF\x86\x9C" +#define ICON_FA_GRADUATION_CAP "\xEF\x86\x9D" +#define ICON_FA_YAHOO "\xEF\x86\x9E" +#define ICON_FA_GOOGLE "\xEF\x86\xA0" +#define ICON_FA_REDDIT "\xEF\x86\xA1" +#define ICON_FA_REDDIT_SQUARE "\xEF\x86\xA2" +#define ICON_FA_STUMBLEUPON_CIRCLE "\xEF\x86\xA3" +#define ICON_FA_STUMBLEUPON "\xEF\x86\xA4" +#define ICON_FA_DELICIOUS "\xEF\x86\xA5" +#define ICON_FA_DIGG "\xEF\x86\xA6" +#define ICON_FA_PIED_PIPER_PP "\xEF\x86\xA7" +#define ICON_FA_PIED_PIPER_ALT "\xEF\x86\xA8" +#define ICON_FA_DRUPAL "\xEF\x86\xA9" +#define ICON_FA_JOOMLA "\xEF\x86\xAA" +#define ICON_FA_LANGUAGE "\xEF\x86\xAB" +#define ICON_FA_FAX "\xEF\x86\xAC" +#define ICON_FA_BUILDING "\xEF\x86\xAD" +#define ICON_FA_CHILD "\xEF\x86\xAE" +#define ICON_FA_PAW "\xEF\x86\xB0" +#define ICON_FA_SPOON "\xEF\x86\xB1" +#define ICON_FA_CUBE "\xEF\x86\xB2" +#define ICON_FA_CUBES "\xEF\x86\xB3" +#define ICON_FA_BEHANCE "\xEF\x86\xB4" +#define ICON_FA_BEHANCE_SQUARE "\xEF\x86\xB5" +#define ICON_FA_STEAM "\xEF\x86\xB6" +#define ICON_FA_STEAM_SQUARE "\xEF\x86\xB7" +#define ICON_FA_RECYCLE "\xEF\x86\xB8" +#define ICON_FA_CAR "\xEF\x86\xB9" +#define ICON_FA_TAXI "\xEF\x86\xBA" +#define ICON_FA_TREE "\xEF\x86\xBB" +#define ICON_FA_SPOTIFY "\xEF\x86\xBC" +#define ICON_FA_DEVIANTART "\xEF\x86\xBD" +#define ICON_FA_SOUNDCLOUD "\xEF\x86\xBE" +#define ICON_FA_DATABASE "\xEF\x87\x80" +#define ICON_FA_FILE_PDF_O "\xEF\x87\x81" +#define ICON_FA_FILE_WORD_O "\xEF\x87\x82" +#define ICON_FA_FILE_EXCEL_O "\xEF\x87\x83" +#define ICON_FA_FILE_POWERPOINT_O "\xEF\x87\x84" +#define ICON_FA_FILE_IMAGE_O "\xEF\x87\x85" +#define ICON_FA_FILE_ARCHIVE_O "\xEF\x87\x86" +#define ICON_FA_FILE_AUDIO_O "\xEF\x87\x87" +#define ICON_FA_FILE_VIDEO_O "\xEF\x87\x88" +#define ICON_FA_FILE_CODE_O "\xEF\x87\x89" +#define ICON_FA_VINE "\xEF\x87\x8A" +#define ICON_FA_CODEPEN "\xEF\x87\x8B" +#define ICON_FA_JSFIDDLE "\xEF\x87\x8C" +#define ICON_FA_LIFE_RING "\xEF\x87\x8D" +#define ICON_FA_CIRCLE_O_NOTCH "\xEF\x87\x8E" +#define ICON_FA_REBEL "\xEF\x87\x90" +#define ICON_FA_EMPIRE "\xEF\x87\x91" +#define ICON_FA_GIT_SQUARE "\xEF\x87\x92" +#define ICON_FA_GIT "\xEF\x87\x93" +#define ICON_FA_HACKER_NEWS "\xEF\x87\x94" +#define ICON_FA_TENCENT_WEIBO "\xEF\x87\x95" +#define ICON_FA_QQ "\xEF\x87\x96" +#define ICON_FA_WEIXIN "\xEF\x87\x97" +#define ICON_FA_PAPER_PLANE "\xEF\x87\x98" +#define ICON_FA_PAPER_PLANE_O "\xEF\x87\x99" +#define ICON_FA_HISTORY "\xEF\x87\x9A" +#define ICON_FA_CIRCLE_THIN "\xEF\x87\x9B" +#define ICON_FA_HEADER "\xEF\x87\x9C" +#define ICON_FA_PARAGRAPH "\xEF\x87\x9D" +#define ICON_FA_SLIDERS "\xEF\x87\x9E" +#define ICON_FA_SHARE_ALT "\xEF\x87\xA0" +#define ICON_FA_SHARE_ALT_SQUARE "\xEF\x87\xA1" +#define ICON_FA_BOMB "\xEF\x87\xA2" +#define ICON_FA_FUTBOL_O "\xEF\x87\xA3" +#define ICON_FA_TTY "\xEF\x87\xA4" +#define ICON_FA_BINOCULARS "\xEF\x87\xA5" +#define ICON_FA_PLUG "\xEF\x87\xA6" +#define ICON_FA_SLIDESHARE "\xEF\x87\xA7" +#define ICON_FA_TWITCH "\xEF\x87\xA8" +#define ICON_FA_YELP "\xEF\x87\xA9" +#define ICON_FA_NEWSPAPER_O "\xEF\x87\xAA" +#define ICON_FA_WIFI "\xEF\x87\xAB" +#define ICON_FA_CALCULATOR "\xEF\x87\xAC" +#define ICON_FA_PAYPAL "\xEF\x87\xAD" +#define ICON_FA_GOOGLE_WALLET "\xEF\x87\xAE" +#define ICON_FA_CC_VISA "\xEF\x87\xB0" +#define ICON_FA_CC_MASTERCARD "\xEF\x87\xB1" +#define ICON_FA_CC_DISCOVER "\xEF\x87\xB2" +#define ICON_FA_CC_AMEX "\xEF\x87\xB3" +#define ICON_FA_CC_PAYPAL "\xEF\x87\xB4" +#define ICON_FA_CC_STRIPE "\xEF\x87\xB5" +#define ICON_FA_BELL_SLASH "\xEF\x87\xB6" +#define ICON_FA_BELL_SLASH_O "\xEF\x87\xB7" +#define ICON_FA_TRASH "\xEF\x87\xB8" +#define ICON_FA_COPYRIGHT "\xEF\x87\xB9" +#define ICON_FA_AT "\xEF\x87\xBA" +#define ICON_FA_EYEDROPPER "\xEF\x87\xBB" +#define ICON_FA_PAINT_BRUSH "\xEF\x87\xBC" +#define ICON_FA_BIRTHDAY_CAKE "\xEF\x87\xBD" +#define ICON_FA_AREA_CHART "\xEF\x87\xBE" +#define ICON_FA_PIE_CHART "\xEF\x88\x80" +#define ICON_FA_LINE_CHART "\xEF\x88\x81" +#define ICON_FA_LASTFM "\xEF\x88\x82" +#define ICON_FA_LASTFM_SQUARE "\xEF\x88\x83" +#define ICON_FA_TOGGLE_OFF "\xEF\x88\x84" +#define ICON_FA_TOGGLE_ON "\xEF\x88\x85" +#define ICON_FA_BICYCLE "\xEF\x88\x86" +#define ICON_FA_BUS "\xEF\x88\x87" +#define ICON_FA_IOXHOST "\xEF\x88\x88" +#define ICON_FA_ANGELLIST "\xEF\x88\x89" +#define ICON_FA_CC "\xEF\x88\x8A" +#define ICON_FA_ILS "\xEF\x88\x8B" +#define ICON_FA_MEANPATH "\xEF\x88\x8C" +#define ICON_FA_BUYSELLADS "\xEF\x88\x8D" +#define ICON_FA_CONNECTDEVELOP "\xEF\x88\x8E" +#define ICON_FA_DASHCUBE "\xEF\x88\x90" +#define ICON_FA_FORUMBEE "\xEF\x88\x91" +#define ICON_FA_LEANPUB "\xEF\x88\x92" +#define ICON_FA_SELLSY "\xEF\x88\x93" +#define ICON_FA_SHIRTSINBULK "\xEF\x88\x94" +#define ICON_FA_SIMPLYBUILT "\xEF\x88\x95" +#define ICON_FA_SKYATLAS "\xEF\x88\x96" +#define ICON_FA_CART_PLUS "\xEF\x88\x97" +#define ICON_FA_CART_ARROW_DOWN "\xEF\x88\x98" +#define ICON_FA_DIAMOND "\xEF\x88\x99" +#define ICON_FA_SHIP "\xEF\x88\x9A" +#define ICON_FA_USER_SECRET "\xEF\x88\x9B" +#define ICON_FA_MOTORCYCLE "\xEF\x88\x9C" +#define ICON_FA_STREET_VIEW "\xEF\x88\x9D" +#define ICON_FA_HEARTBEAT "\xEF\x88\x9E" +#define ICON_FA_VENUS "\xEF\x88\xA1" +#define ICON_FA_MARS "\xEF\x88\xA2" +#define ICON_FA_MERCURY "\xEF\x88\xA3" +#define ICON_FA_TRANSGENDER "\xEF\x88\xA4" +#define ICON_FA_TRANSGENDER_ALT "\xEF\x88\xA5" +#define ICON_FA_VENUS_DOUBLE "\xEF\x88\xA6" +#define ICON_FA_MARS_DOUBLE "\xEF\x88\xA7" +#define ICON_FA_VENUS_MARS "\xEF\x88\xA8" +#define ICON_FA_MARS_STROKE "\xEF\x88\xA9" +#define ICON_FA_MARS_STROKE_V "\xEF\x88\xAA" +#define ICON_FA_MARS_STROKE_H "\xEF\x88\xAB" +#define ICON_FA_NEUTER "\xEF\x88\xAC" +#define ICON_FA_GENDERLESS "\xEF\x88\xAD" +#define ICON_FA_FACEBOOK_OFFICIAL "\xEF\x88\xB0" +#define ICON_FA_PINTEREST_P "\xEF\x88\xB1" +#define ICON_FA_WHATSAPP "\xEF\x88\xB2" +#define ICON_FA_SERVER "\xEF\x88\xB3" +#define ICON_FA_USER_PLUS "\xEF\x88\xB4" +#define ICON_FA_USER_TIMES "\xEF\x88\xB5" +#define ICON_FA_BED "\xEF\x88\xB6" +#define ICON_FA_VIACOIN "\xEF\x88\xB7" +#define ICON_FA_TRAIN "\xEF\x88\xB8" +#define ICON_FA_SUBWAY "\xEF\x88\xB9" +#define ICON_FA_MEDIUM "\xEF\x88\xBA" +#define ICON_FA_Y_COMBINATOR "\xEF\x88\xBB" +#define ICON_FA_OPTIN_MONSTER "\xEF\x88\xBC" +#define ICON_FA_OPENCART "\xEF\x88\xBD" +#define ICON_FA_EXPEDITEDSSL "\xEF\x88\xBE" +#define ICON_FA_BATTERY_FULL "\xEF\x89\x80" +#define ICON_FA_BATTERY_THREE_QUARTERS "\xEF\x89\x81" +#define ICON_FA_BATTERY_HALF "\xEF\x89\x82" +#define ICON_FA_BATTERY_QUARTER "\xEF\x89\x83" +#define ICON_FA_BATTERY_EMPTY "\xEF\x89\x84" +#define ICON_FA_MOUSE_POINTER "\xEF\x89\x85" +#define ICON_FA_I_CURSOR "\xEF\x89\x86" +#define ICON_FA_OBJECT_GROUP "\xEF\x89\x87" +#define ICON_FA_OBJECT_UNGROUP "\xEF\x89\x88" +#define ICON_FA_STICKY_NOTE "\xEF\x89\x89" +#define ICON_FA_STICKY_NOTE_O "\xEF\x89\x8A" +#define ICON_FA_CC_JCB "\xEF\x89\x8B" +#define ICON_FA_CC_DINERS_CLUB "\xEF\x89\x8C" +#define ICON_FA_CLONE "\xEF\x89\x8D" +#define ICON_FA_BALANCE_SCALE "\xEF\x89\x8E" +#define ICON_FA_HOURGLASS_O "\xEF\x89\x90" +#define ICON_FA_HOURGLASS_START "\xEF\x89\x91" +#define ICON_FA_HOURGLASS_HALF "\xEF\x89\x92" +#define ICON_FA_HOURGLASS_END "\xEF\x89\x93" +#define ICON_FA_HOURGLASS "\xEF\x89\x94" +#define ICON_FA_HAND_ROCK_O "\xEF\x89\x95" +#define ICON_FA_HAND_PAPER_O "\xEF\x89\x96" +#define ICON_FA_HAND_SCISSORS_O "\xEF\x89\x97" +#define ICON_FA_HAND_LIZARD_O "\xEF\x89\x98" +#define ICON_FA_HAND_SPOCK_O "\xEF\x89\x99" +#define ICON_FA_HAND_POINTER_O "\xEF\x89\x9A" +#define ICON_FA_HAND_PEACE_O "\xEF\x89\x9B" +#define ICON_FA_TRADEMARK "\xEF\x89\x9C" +#define ICON_FA_REGISTERED "\xEF\x89\x9D" +#define ICON_FA_CREATIVE_COMMONS "\xEF\x89\x9E" +#define ICON_FA_GG "\xEF\x89\xA0" +#define ICON_FA_GG_CIRCLE "\xEF\x89\xA1" +#define ICON_FA_TRIPADVISOR "\xEF\x89\xA2" +#define ICON_FA_ODNOKLASSNIKI "\xEF\x89\xA3" +#define ICON_FA_ODNOKLASSNIKI_SQUARE "\xEF\x89\xA4" +#define ICON_FA_GET_POCKET "\xEF\x89\xA5" +#define ICON_FA_WIKIPEDIA_W "\xEF\x89\xA6" +#define ICON_FA_SAFARI "\xEF\x89\xA7" +#define ICON_FA_CHROME "\xEF\x89\xA8" +#define ICON_FA_FIREFOX "\xEF\x89\xA9" +#define ICON_FA_OPERA "\xEF\x89\xAA" +#define ICON_FA_INTERNET_EXPLORER "\xEF\x89\xAB" +#define ICON_FA_TELEVISION "\xEF\x89\xAC" +#define ICON_FA_CONTAO "\xEF\x89\xAD" +#define ICON_FA_500PX "\xEF\x89\xAE" +#define ICON_FA_AMAZON "\xEF\x89\xB0" +#define ICON_FA_CALENDAR_PLUS_O "\xEF\x89\xB1" +#define ICON_FA_CALENDAR_MINUS_O "\xEF\x89\xB2" +#define ICON_FA_CALENDAR_TIMES_O "\xEF\x89\xB3" +#define ICON_FA_CALENDAR_CHECK_O "\xEF\x89\xB4" +#define ICON_FA_INDUSTRY "\xEF\x89\xB5" +#define ICON_FA_MAP_PIN "\xEF\x89\xB6" +#define ICON_FA_MAP_SIGNS "\xEF\x89\xB7" +#define ICON_FA_MAP_O "\xEF\x89\xB8" +#define ICON_FA_MAP "\xEF\x89\xB9" +#define ICON_FA_COMMENTING "\xEF\x89\xBA" +#define ICON_FA_COMMENTING_O "\xEF\x89\xBB" +#define ICON_FA_HOUZZ "\xEF\x89\xBC" +#define ICON_FA_VIMEO "\xEF\x89\xBD" +#define ICON_FA_BLACK_TIE "\xEF\x89\xBE" +#define ICON_FA_FONTICONS "\xEF\x8A\x80" +#define ICON_FA_REDDIT_ALIEN "\xEF\x8A\x81" +#define ICON_FA_EDGE "\xEF\x8A\x82" +#define ICON_FA_CREDIT_CARD_ALT "\xEF\x8A\x83" +#define ICON_FA_CODIEPIE "\xEF\x8A\x84" +#define ICON_FA_MODX "\xEF\x8A\x85" +#define ICON_FA_FORT_AWESOME "\xEF\x8A\x86" +#define ICON_FA_USB "\xEF\x8A\x87" +#define ICON_FA_PRODUCT_HUNT "\xEF\x8A\x88" +#define ICON_FA_MIXCLOUD "\xEF\x8A\x89" +#define ICON_FA_SCRIBD "\xEF\x8A\x8A" +#define ICON_FA_PAUSE_CIRCLE "\xEF\x8A\x8B" +#define ICON_FA_PAUSE_CIRCLE_O "\xEF\x8A\x8C" +#define ICON_FA_STOP_CIRCLE "\xEF\x8A\x8D" +#define ICON_FA_STOP_CIRCLE_O "\xEF\x8A\x8E" +#define ICON_FA_SHOPPING_BAG "\xEF\x8A\x90" +#define ICON_FA_SHOPPING_BASKET "\xEF\x8A\x91" +#define ICON_FA_HASHTAG "\xEF\x8A\x92" +#define ICON_FA_BLUETOOTH "\xEF\x8A\x93" +#define ICON_FA_BLUETOOTH_B "\xEF\x8A\x94" +#define ICON_FA_PERCENT "\xEF\x8A\x95" +#define ICON_FA_GITLAB "\xEF\x8A\x96" +#define ICON_FA_WPBEGINNER "\xEF\x8A\x97" +#define ICON_FA_WPFORMS "\xEF\x8A\x98" +#define ICON_FA_ENVIRA "\xEF\x8A\x99" +#define ICON_FA_UNIVERSAL_ACCESS "\xEF\x8A\x9A" +#define ICON_FA_WHEELCHAIR_ALT "\xEF\x8A\x9B" +#define ICON_FA_QUESTION_CIRCLE_O "\xEF\x8A\x9C" +#define ICON_FA_BLIND "\xEF\x8A\x9D" +#define ICON_FA_AUDIO_DESCRIPTION "\xEF\x8A\x9E" +#define ICON_FA_VOLUME_CONTROL_PHONE "\xEF\x8A\xA0" +#define ICON_FA_BRAILLE "\xEF\x8A\xA1" +#define ICON_FA_ASSISTIVE_LISTENING_SYSTEMS "\xEF\x8A\xA2" +#define ICON_FA_AMERICAN_SIGN_LANGUAGE_INTERPRETING "\xEF\x8A\xA3" +#define ICON_FA_DEAF "\xEF\x8A\xA4" +#define ICON_FA_GLIDE "\xEF\x8A\xA5" +#define ICON_FA_GLIDE_G "\xEF\x8A\xA6" +#define ICON_FA_SIGN_LANGUAGE "\xEF\x8A\xA7" +#define ICON_FA_LOW_VISION "\xEF\x8A\xA8" +#define ICON_FA_VIADEO "\xEF\x8A\xA9" +#define ICON_FA_VIADEO_SQUARE "\xEF\x8A\xAA" +#define ICON_FA_SNAPCHAT "\xEF\x8A\xAB" +#define ICON_FA_SNAPCHAT_GHOST "\xEF\x8A\xAC" +#define ICON_FA_SNAPCHAT_SQUARE "\xEF\x8A\xAD" +#define ICON_FA_PIED_PIPER "\xEF\x8A\xAE" +#define ICON_FA_FIRST_ORDER "\xEF\x8A\xB0" +#define ICON_FA_YOAST "\xEF\x8A\xB1" +#define ICON_FA_THEMEISLE "\xEF\x8A\xB2" +#define ICON_FA_GOOGLE_PLUS_OFFICIAL "\xEF\x8A\xB3" +#define ICON_FA_FONT_AWESOME "\xEF\x8A\xB4" +#define ICON_FA_HANDSHAKE_O "\xEF\x8A\xB5" +#define ICON_FA_ENVELOPE_OPEN "\xEF\x8A\xB6" +#define ICON_FA_ENVELOPE_OPEN_O "\xEF\x8A\xB7" +#define ICON_FA_LINODE "\xEF\x8A\xB8" +#define ICON_FA_ADDRESS_BOOK "\xEF\x8A\xB9" +#define ICON_FA_ADDRESS_BOOK_O "\xEF\x8A\xBA" +#define ICON_FA_ADDRESS_CARD "\xEF\x8A\xBB" +#define ICON_FA_ADDRESS_CARD_O "\xEF\x8A\xBC" +#define ICON_FA_USER_CIRCLE "\xEF\x8A\xBD" +#define ICON_FA_USER_CIRCLE_O "\xEF\x8A\xBE" +#define ICON_FA_USER_O "\xEF\x8B\x80" +#define ICON_FA_ID_BADGE "\xEF\x8B\x81" +#define ICON_FA_ID_CARD "\xEF\x8B\x82" +#define ICON_FA_ID_CARD_O "\xEF\x8B\x83" +#define ICON_FA_QUORA "\xEF\x8B\x84" +#define ICON_FA_FREE_CODE_CAMP "\xEF\x8B\x85" +#define ICON_FA_TELEGRAM "\xEF\x8B\x86" +#define ICON_FA_THERMOMETER_FULL "\xEF\x8B\x87" +#define ICON_FA_THERMOMETER_THREE_QUARTERS "\xEF\x8B\x88" +#define ICON_FA_THERMOMETER_HALF "\xEF\x8B\x89" +#define ICON_FA_THERMOMETER_QUARTER "\xEF\x8B\x8A" +#define ICON_FA_THERMOMETER_EMPTY "\xEF\x8B\x8B" +#define ICON_FA_SHOWER "\xEF\x8B\x8C" +#define ICON_FA_BATH "\xEF\x8B\x8D" +#define ICON_FA_PODCAST "\xEF\x8B\x8E" +#define ICON_FA_WINDOW_MAXIMIZE "\xEF\x8B\x90" +#define ICON_FA_WINDOW_MINIMIZE "\xEF\x8B\x91" +#define ICON_FA_WINDOW_RESTORE "\xEF\x8B\x92" +#define ICON_FA_WINDOW_CLOSE "\xEF\x8B\x93" +#define ICON_FA_WINDOW_CLOSE_O "\xEF\x8B\x94" +#define ICON_FA_BANDCAMP "\xEF\x8B\x95" +#define ICON_FA_GRAV "\xEF\x8B\x96" +#define ICON_FA_ETSY "\xEF\x8B\x97" +#define ICON_FA_IMDB "\xEF\x8B\x98" +#define ICON_FA_RAVELRY "\xEF\x8B\x99" +#define ICON_FA_EERCAST "\xEF\x8B\x9A" +#define ICON_FA_MICROCHIP "\xEF\x8B\x9B" +#define ICON_FA_SNOWFLAKE_O "\xEF\x8B\x9C" +#define ICON_FA_SUPERPOWERS "\xEF\x8B\x9D" +#define ICON_FA_WPEXPLORER "\xEF\x8B\x9E" +#define ICON_FA_MEETUP "\xEF\x8B\xA0" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_5.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_5.h new file mode 100644 index 00000000000..14f7b6832ae --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_5.h @@ -0,0 +1,750 @@ +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/advanced-options/metadata/icons.yml +// for use with https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-solid-900.ttf, https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-regular-400.ttf, +#pragma once + +#define FONT_ICON_FILE_NAME_FAS "fa-solid-900.ttf" +#define FONT_ICON_FILE_NAME_FAR "fa-regular-400.ttf" + +#define ICON_MIN_FA 0xf000 +#define ICON_MAX_FA 0xf5ce +#define ICON_FA_CHEVRON_CIRCLE_RIGHT "\xEF\x84\xB8" +#define ICON_FA_CROSSHAIRS "\xEF\x81\x9B" +#define ICON_FA_BROADCAST_TOWER "\xEF\x94\x99" +#define ICON_FA_EXTERNAL_LINK_SQUARE_ALT "\xEF\x8D\xA0" +#define ICON_FA_KISS_BEAM "\xEF\x96\x97" +#define ICON_FA_CHESS_BISHOP "\xEF\x90\xBA" +#define ICON_FA_TV "\xEF\x89\xAC" +#define ICON_FA_CROP_ALT "\xEF\x95\xA5" +#define ICON_FA_TH "\xEF\x80\x8A" +#define ICON_FA_RECYCLE "\xEF\x86\xB8" +#define ICON_FA_SMILE "\xEF\x84\x98" +#define ICON_FA_FAX "\xEF\x86\xAC" +#define ICON_FA_DRAFTING_COMPASS "\xEF\x95\xA8" +#define ICON_FA_SCREWDRIVER "\xEF\x95\x8A" +#define ICON_FA_PRINT "\xEF\x80\xAF" +#define ICON_FA_CARET_UP "\xEF\x83\x98" +#define ICON_FA_SCHOOL "\xEF\x95\x89" +#define ICON_FA_FILE_PDF "\xEF\x87\x81" +#define ICON_FA_USERS_COG "\xEF\x94\x89" +#define ICON_FA_LIST "\xEF\x80\xBA" +#define ICON_FA_UPLOAD "\xEF\x82\x93" +#define ICON_FA_ADJUST "\xEF\x81\x82" +#define ICON_FA_VENUS "\xEF\x88\xA1" +#define ICON_FA_HEADING "\xEF\x87\x9C" +#define ICON_FA_ARROW_DOWN "\xEF\x81\xA3" +#define ICON_FA_BICYCLE "\xEF\x88\x86" +#define ICON_FA_TIRED "\xEF\x97\x88" +#define ICON_FA_SYNC "\xEF\x80\xA1" +#define ICON_FA_PAPER_PLANE "\xEF\x87\x98" +#define ICON_FA_VOLLEYBALL_BALL "\xEF\x91\x9F" +#define ICON_FA_RIBBON "\xEF\x93\x96" +#define ICON_FA_HAND_LIZARD "\xEF\x89\x98" +#define ICON_FA_CLOCK "\xEF\x80\x97" +#define ICON_FA_SUN "\xEF\x86\x85" +#define ICON_FA_FILE_POWERPOINT "\xEF\x87\x84" +#define ICON_FA_MICROCHIP "\xEF\x8B\x9B" +#define ICON_FA_GRADUATION_CAP "\xEF\x86\x9D" +#define ICON_FA_ANGLE_DOUBLE_DOWN "\xEF\x84\x83" +#define ICON_FA_INFO_CIRCLE "\xEF\x81\x9A" +#define ICON_FA_TAGS "\xEF\x80\xAC" +#define ICON_FA_FILE_ALT "\xEF\x85\x9C" +#define ICON_FA_EQUALS "\xEF\x94\xAC" +#define ICON_FA_FILE_INVOICE "\xEF\x95\xB0" +#define ICON_FA_SEARCH "\xEF\x80\x82" +#define ICON_FA_FLASK "\xEF\x83\x83" +#define ICON_FA_CALENDAR_TIMES "\xEF\x89\xB3" +#define ICON_FA_DIVIDE "\xEF\x94\xA9" +#define ICON_FA_GREATER_THAN_EQUAL "\xEF\x94\xB2" +#define ICON_FA_SLIDERS_H "\xEF\x87\x9E" +#define ICON_FA_EYE_SLASH "\xEF\x81\xB0" +#define ICON_FA_FEATHER_ALT "\xEF\x95\xAB" +#define ICON_FA_EYE "\xEF\x81\xAE" +#define ICON_FA_BASEBALL_BALL "\xEF\x90\xB3" +#define ICON_FA_HOSPITAL "\xEF\x83\xB8" +#define ICON_FA_COINS "\xEF\x94\x9E" +#define ICON_FA_FONT_AWESOME_LOGO_FULL "\xEF\x93\xA6" +#define ICON_FA_PASSPORT "\xEF\x96\xAB" +#define ICON_FA_SHOPPING_CART "\xEF\x81\xBA" +#define ICON_FA_AWARD "\xEF\x95\x99" +#define ICON_FA_WINDOW_RESTORE "\xEF\x8B\x92" +#define ICON_FA_PHONE "\xEF\x82\x95" +#define ICON_FA_FLAG "\xEF\x80\xA4" +#define ICON_FA_STETHOSCOPE "\xEF\x83\xB1" +#define ICON_FA_OUTDENT "\xEF\x80\xBB" +#define ICON_FA_LONG_ARROW_ALT_RIGHT "\xEF\x8C\x8B" +#define ICON_FA_ADDRESS_CARD "\xEF\x8A\xBB" +#define ICON_FA_CARET_SQUARE_UP "\xEF\x85\x91" +#define ICON_FA_PARAGRAPH "\xEF\x87\x9D" +#define ICON_FA_MALE "\xEF\x86\x83" +#define ICON_FA_HISTORY "\xEF\x87\x9A" +#define ICON_FA_USER_TIE "\xEF\x94\x88" +#define ICON_FA_SEARCH_PLUS "\xEF\x80\x8E" +#define ICON_FA_LIFE_RING "\xEF\x87\x8D" +#define ICON_FA_SHARE "\xEF\x81\xA4" +#define ICON_FA_ALIGN_JUSTIFY "\xEF\x80\xB9" +#define ICON_FA_BATTERY_THREE_QUARTERS "\xEF\x89\x81" +#define ICON_FA_OBJECT_UNGROUP "\xEF\x89\x88" +#define ICON_FA_BRIEFCASE "\xEF\x82\xB1" +#define ICON_FA_THERMOMETER_FULL "\xEF\x8B\x87" +#define ICON_FA_PLANE "\xEF\x81\xB2" +#define ICON_FA_UNLINK "\xEF\x84\xA7" +#define ICON_FA_WINDOW_MAXIMIZE "\xEF\x8B\x90" +#define ICON_FA_STEP_BACKWARD "\xEF\x81\x88" +#define ICON_FA_MICROPHONE_SLASH "\xEF\x84\xB1" +#define ICON_FA_USER_PLUS "\xEF\x88\xB4" +#define ICON_FA_WRENCH "\xEF\x82\xAD" +#define ICON_FA_AMBULANCE "\xEF\x83\xB9" +#define ICON_FA_UNIVERSAL_ACCESS "\xEF\x8A\x9A" +#define ICON_FA_DICE_ONE "\xEF\x94\xA5" +#define ICON_FA_KEYBOARD "\xEF\x84\x9C" +#define ICON_FA_CHECK_DOUBLE "\xEF\x95\xA0" +#define ICON_FA_HEADPHONES_ALT "\xEF\x96\x8F" +#define ICON_FA_BATTERY_HALF "\xEF\x89\x82" +#define ICON_FA_PROJECT_DIAGRAM "\xEF\x95\x82" +#define ICON_FA_PHONE_VOLUME "\xEF\x8A\xA0" +#define ICON_FA_DOLLY "\xEF\x91\xB2" +#define ICON_FA_GRIN_TEARS "\xEF\x96\x88" +#define ICON_FA_SORT_AMOUNT_UP "\xEF\x85\xA1" +#define ICON_FA_COFFEE "\xEF\x83\xB4" +#define ICON_FA_TABLET_ALT "\xEF\x8F\xBA" +#define ICON_FA_GRIN_BEAM_SWEAT "\xEF\x96\x83" +#define ICON_FA_HAND_POINT_RIGHT "\xEF\x82\xA4" +#define ICON_FA_MAGIC "\xEF\x83\x90" +#define ICON_FA_VOLUME_OFF "\xEF\x80\xA6" +#define ICON_FA_SAD_TEAR "\xEF\x96\xB4" +#define ICON_FA_CARET_RIGHT "\xEF\x83\x9A" +#define ICON_FA_BONG "\xEF\x95\x9C" +#define ICON_FA_ELLIPSIS_V "\xEF\x85\x82" +#define ICON_FA_BALANCE_SCALE "\xEF\x89\x8E" +#define ICON_FA_FISH "\xEF\x95\xB8" +#define ICON_FA_ELLIPSIS_H "\xEF\x85\x81" +#define ICON_FA_RUPEE_SIGN "\xEF\x85\x96" +#define ICON_FA_ASSISTIVE_LISTENING_SYSTEMS "\xEF\x8A\xA2" +#define ICON_FA_POUND_SIGN "\xEF\x85\x94" +#define ICON_FA_BATTERY_QUARTER "\xEF\x89\x83" +#define ICON_FA_HAND_PEACE "\xEF\x89\x9B" +#define ICON_FA_SURPRISE "\xEF\x97\x82" +#define ICON_FA_SORT_NUMERIC_UP "\xEF\x85\xA3" +#define ICON_FA_VIDEO_SLASH "\xEF\x93\xA2" +#define ICON_FA_SUBWAY "\xEF\x88\xB9" +#define ICON_FA_COOKIE "\xEF\x95\xA3" +#define ICON_FA_MONEY_BILL "\xEF\x83\x96" +#define ICON_FA_CHEVRON_DOWN "\xEF\x81\xB8" +#define ICON_FA_FILTER "\xEF\x82\xB0" +#define ICON_FA_BOOKMARK "\xEF\x80\xAE" +#define ICON_FA_FOLDER_OPEN "\xEF\x81\xBC" +#define ICON_FA_SIGNATURE "\xEF\x96\xB7" +#define ICON_FA_HEARTBEAT "\xEF\x88\x9E" +#define ICON_FA_THUMBTACK "\xEF\x82\x8D" +#define ICON_FA_LAUGH_WINK "\xEF\x96\x9C" +#define ICON_FA_TEXT_HEIGHT "\xEF\x80\xB4" +#define ICON_FA_GRIN_TONGUE "\xEF\x96\x89" +#define ICON_FA_QRCODE "\xEF\x80\xA9" +#define ICON_FA_MERCURY "\xEF\x88\xA3" +#define ICON_FA_USER_ASTRONAUT "\xEF\x93\xBB" +#define ICON_FA_SORT_AMOUNT_DOWN "\xEF\x85\xA0" +#define ICON_FA_SORT_DOWN "\xEF\x83\x9D" +#define ICON_FA_COMPACT_DISC "\xEF\x94\x9F" +#define ICON_FA_PERCENTAGE "\xEF\x95\x81" +#define ICON_FA_STORE "\xEF\x95\x8E" +#define ICON_FA_COMMENT_DOTS "\xEF\x92\xAD" +#define ICON_FA_SMILE_WINK "\xEF\x93\x9A" +#define ICON_FA_HOTEL "\xEF\x96\x94" +#define ICON_FA_GLOBE_ASIA "\xEF\x95\xBE" +#define ICON_FA_VIAL "\xEF\x92\x92" +#define ICON_FA_STROOPWAFEL "\xEF\x95\x91" +#define ICON_FA_DATABASE "\xEF\x87\x80" +#define ICON_FA_TREE "\xEF\x86\xBB" +#define ICON_FA_SHOWER "\xEF\x8B\x8C" +#define ICON_FA_DRUM_STEELPAN "\xEF\x95\xAA" +#define ICON_FA_FILE_UPLOAD "\xEF\x95\xB4" +#define ICON_FA_MEDKIT "\xEF\x83\xBA" +#define ICON_FA_MINUS "\xEF\x81\xA8" +#define ICON_FA_SHEKEL_SIGN "\xEF\x88\x8B" +#define ICON_FA_BELL_SLASH "\xEF\x87\xB6" +#define ICON_FA_COUCH "\xEF\x92\xB8" +#define ICON_FA_CHESS "\xEF\x90\xB9" +#define ICON_FA_FILE_EXPORT "\xEF\x95\xAE" +#define ICON_FA_SIGN_LANGUAGE "\xEF\x8A\xA7" +#define ICON_FA_SNOWFLAKE "\xEF\x8B\x9C" +#define ICON_FA_PLAY "\xEF\x81\x8B" +#define ICON_FA_HEADSET "\xEF\x96\x90" +#define ICON_FA_CHART_AREA "\xEF\x87\xBE" +#define ICON_FA_EURO_SIGN "\xEF\x85\x93" +#define ICON_FA_CHESS_KING "\xEF\x90\xBF" +#define ICON_FA_MOBILE "\xEF\x84\x8B" +#define ICON_FA_BOX_OPEN "\xEF\x92\x9E" +#define ICON_FA_FUTBOL "\xEF\x87\xA3" +#define ICON_FA_BULLSEYE "\xEF\x85\x80" +#define ICON_FA_LIGHTBULB "\xEF\x83\xAB" +#define ICON_FA_BOMB "\xEF\x87\xA2" +#define ICON_FA_ARROWS_ALT_H "\xEF\x8C\xB7" +#define ICON_FA_CHESS_ROOK "\xEF\x91\x87" +#define ICON_FA_FIRE_EXTINGUISHER "\xEF\x84\xB4" +#define ICON_FA_ARROWS_ALT_V "\xEF\x8C\xB8" +#define ICON_FA_EYE_DROPPER "\xEF\x87\xBB" +#define ICON_FA_FONT "\xEF\x80\xB1" +#define ICON_FA_CAMERA_RETRO "\xEF\x82\x83" +#define ICON_FA_BLENDER "\xEF\x94\x97" +#define ICON_FA_COPY "\xEF\x83\x85" +#define ICON_FA_COPYRIGHT "\xEF\x87\xB9" +#define ICON_FA_HOCKEY_PUCK "\xEF\x91\x93" +#define ICON_FA_STOP_CIRCLE "\xEF\x8A\x8D" +#define ICON_FA_BEZIER_CURVE "\xEF\x95\x9B" +#define ICON_FA_FOLDER "\xEF\x81\xBB" +#define ICON_FA_RSS "\xEF\x82\x9E" +#define ICON_FA_COLUMNS "\xEF\x83\x9B" +#define ICON_FA_GRIN_WINK "\xEF\x96\x8C" +#define ICON_FA_STOP "\xEF\x81\x8D" +#define ICON_FA_MONEY_CHECK_ALT "\xEF\x94\xBD" +#define ICON_FA_COMPASS "\xEF\x85\x8E" +#define ICON_FA_TOOLBOX "\xEF\x95\x92" +#define ICON_FA_LIST_OL "\xEF\x83\x8B" +#define ICON_FA_WINE_GLASS "\xEF\x93\xA3" +#define ICON_FA_USER_ALT_SLASH "\xEF\x93\xBA" +#define ICON_FA_USER_TAG "\xEF\x94\x87" +#define ICON_FA_BRUSH "\xEF\x95\x9D" +#define ICON_FA_BAN "\xEF\x81\x9E" +#define ICON_FA_BARS "\xEF\x83\x89" +#define ICON_FA_ARROW_ALT_CIRCLE_DOWN "\xEF\x8D\x98" +#define ICON_FA_MONEY_BILL_ALT "\xEF\x8F\x91" +#define ICON_FA_CHALKBOARD_TEACHER "\xEF\x94\x9C" +#define ICON_FA_PORTRAIT "\xEF\x8F\xA0" +#define ICON_FA_RETWEET "\xEF\x81\xB9" +#define ICON_FA_HOURGLASS "\xEF\x89\x94" +#define ICON_FA_HAND_PAPER "\xEF\x89\x96" +#define ICON_FA_SUBSCRIPT "\xEF\x84\xAC" +#define ICON_FA_DONATE "\xEF\x92\xB9" +#define ICON_FA_GLASS_MARTINI_ALT "\xEF\x95\xBB" +#define ICON_FA_CODE_BRANCH "\xEF\x84\xA6" +#define ICON_FA_MEH "\xEF\x84\x9A" +#define ICON_FA_LIST_ALT "\xEF\x80\xA2" +#define ICON_FA_CUBES "\xEF\x86\xB3" +#define ICON_FA_PRESCRIPTION "\xEF\x96\xB1" +#define ICON_FA_TABLET "\xEF\x84\x8A" +#define ICON_FA_PENCIL_RULER "\xEF\x96\xAE" +#define ICON_FA_CREDIT_CARD "\xEF\x82\x9D" +#define ICON_FA_ARCHWAY "\xEF\x95\x97" +#define ICON_FA_COG "\xEF\x80\x93" +#define ICON_FA_SHUTTLE_VAN "\xEF\x96\xB6" +#define ICON_FA_MONEY_CHECK "\xEF\x94\xBC" +#define ICON_FA_BELL "\xEF\x83\xB3" +#define ICON_FA_TINT_SLASH "\xEF\x97\x87" +#define ICON_FA_PLANE_DEPARTURE "\xEF\x96\xB0" +#define ICON_FA_USER_CHECK "\xEF\x93\xBC" +#define ICON_FA_CHURCH "\xEF\x94\x9D" +#define ICON_FA_PALLET "\xEF\x92\x82" +#define ICON_FA_TINT "\xEF\x81\x83" +#define ICON_FA_STAMP "\xEF\x96\xBF" +#define ICON_FA_ALIGN_RIGHT "\xEF\x80\xB8" +#define ICON_FA_QUOTE_RIGHT "\xEF\x84\x8E" +#define ICON_FA_BEER "\xEF\x83\xBC" +#define ICON_FA_GRIN_ALT "\xEF\x96\x81" +#define ICON_FA_SORT_NUMERIC_DOWN "\xEF\x85\xA2" +#define ICON_FA_FIRE "\xEF\x81\xAD" +#define ICON_FA_FAST_FORWARD "\xEF\x81\x90" +#define ICON_FA_MAP_MARKED_ALT "\xEF\x96\xA0" +#define ICON_FA_CHILD "\xEF\x86\xAE" +#define ICON_FA_PENCIL_ALT "\xEF\x8C\x83" +#define ICON_FA_TRUCK_LOADING "\xEF\x93\x9E" +#define ICON_FA_EXPAND_ARROWS_ALT "\xEF\x8C\x9E" +#define ICON_FA_CARET_SQUARE_DOWN "\xEF\x85\x90" +#define ICON_FA_OBJECT_GROUP "\xEF\x89\x87" +#define ICON_FA_ANCHOR "\xEF\x84\xBD" +#define ICON_FA_HAND_POINT_LEFT "\xEF\x82\xA5" +#define ICON_FA_USER_TIMES "\xEF\x88\xB5" +#define ICON_FA_CALCULATOR "\xEF\x87\xAC" +#define ICON_FA_DIZZY "\xEF\x95\xA7" +#define ICON_FA_KISS_WINK_HEART "\xEF\x96\x98" +#define ICON_FA_FILE_MEDICAL "\xEF\x91\xB7" +#define ICON_FA_SWIMMING_POOL "\xEF\x97\x85" +#define ICON_FA_WEIGHT_HANGING "\xEF\x97\x8D" +#define ICON_FA_FAST_BACKWARD "\xEF\x81\x89" +#define ICON_FA_USER "\xEF\x80\x87" +#define ICON_FA_MINUS_CIRCLE "\xEF\x81\x96" +#define ICON_FA_CHESS_PAWN "\xEF\x91\x83" +#define ICON_FA_CALENDAR_MINUS "\xEF\x89\xB2" +#define ICON_FA_CHESS_BOARD "\xEF\x90\xBC" +#define ICON_FA_SWATCHBOOK "\xEF\x97\x83" +#define ICON_FA_LAPTOP "\xEF\x84\x89" +#define ICON_FA_FROWN_OPEN "\xEF\x95\xBA" +#define ICON_FA_USER_LOCK "\xEF\x94\x82" +#define ICON_FA_USER_CIRCLE "\xEF\x8A\xBD" +#define ICON_FA_HANDSHAKE "\xEF\x8A\xB5" +#define ICON_FA_CUT "\xEF\x83\x84" +#define ICON_FA_GAMEPAD "\xEF\x84\x9B" +#define ICON_FA_STREET_VIEW "\xEF\x88\x9D" +#define ICON_FA_GREATER_THAN "\xEF\x94\xB1" +#define ICON_FA_MINUS_SQUARE "\xEF\x85\x86" +#define ICON_FA_SAVE "\xEF\x83\x87" +#define ICON_FA_TRASH_ALT "\xEF\x8B\xAD" +#define ICON_FA_PUZZLE_PIECE "\xEF\x84\xAE" +#define ICON_FA_USER_FRIENDS "\xEF\x94\x80" +#define ICON_FA_USER_EDIT "\xEF\x93\xBF" +#define ICON_FA_FILE_MEDICAL_ALT "\xEF\x91\xB8" +#define ICON_FA_ARROW_LEFT "\xEF\x81\xA0" +#define ICON_FA_BOXES "\xEF\x91\xA8" +#define ICON_FA_THERMOMETER_EMPTY "\xEF\x8B\x8B" +#define ICON_FA_EXCLAMATION_TRIANGLE "\xEF\x81\xB1" +#define ICON_FA_GIFT "\xEF\x81\xAB" +#define ICON_FA_COGS "\xEF\x82\x85" +#define ICON_FA_SIGNAL "\xEF\x80\x92" +#define ICON_FA_LESS_THAN_EQUAL "\xEF\x94\xB7" +#define ICON_FA_CHEVRON_CIRCLE_LEFT "\xEF\x84\xB7" +#define ICON_FA_MORTAR_PESTLE "\xEF\x96\xA7" +#define ICON_FA_SITEMAP "\xEF\x83\xA8" +#define ICON_FA_BUS_ALT "\xEF\x95\x9E" +#define ICON_FA_ID_BADGE "\xEF\x8B\x81" +#define ICON_FA_FILE_CODE "\xEF\x87\x89" +#define ICON_FA_BATTERY_FULL "\xEF\x89\x80" +#define ICON_FA_DEAF "\xEF\x8A\xA4" +#define ICON_FA_EXCHANGE_ALT "\xEF\x8D\xA2" +#define ICON_FA_REDO "\xEF\x80\x9E" +#define ICON_FA_EXCLAMATION_CIRCLE "\xEF\x81\xAA" +#define ICON_FA_COMMENTS "\xEF\x82\x86" +#define ICON_FA_BRIEFCASE_MEDICAL "\xEF\x91\xA9" +#define ICON_FA_CARET_SQUARE_RIGHT "\xEF\x85\x92" +#define ICON_FA_PEN "\xEF\x8C\x84" +#define ICON_FA_BACKSPACE "\xEF\x95\x9A" +#define ICON_FA_HOT_TUB "\xEF\x96\x93" +#define ICON_FA_SUITCASE_ROLLING "\xEF\x97\x81" +#define ICON_FA_BOLD "\xEF\x80\xB2" +#define ICON_FA_GLOBE_AFRICA "\xEF\x95\xBC" +#define ICON_FA_BARCODE "\xEF\x80\xAA" +#define ICON_FA_BOLT "\xEF\x83\xA7" +#define ICON_FA_THERMOMETER_QUARTER "\xEF\x8B\x8A" +#define ICON_FA_DNA "\xEF\x91\xB1" +#define ICON_FA_TROPHY "\xEF\x82\x91" +#define ICON_FA_USER_ALT "\xEF\x90\x86" +#define ICON_FA_BRAILLE "\xEF\x8A\xA1" +#define ICON_FA_PLUS "\xEF\x81\xA7" +#define ICON_FA_LIST_UL "\xEF\x83\x8A" +#define ICON_FA_SMOKING_BAN "\xEF\x95\x8D" +#define ICON_FA_VOLUME_DOWN "\xEF\x80\xA7" +#define ICON_FA_QUESTION_CIRCLE "\xEF\x81\x99" +#define ICON_FA_BATH "\xEF\x8B\x8D" +#define ICON_FA_GAVEL "\xEF\x83\xA3" +#define ICON_FA_CARET_SQUARE_LEFT "\xEF\x86\x91" +#define ICON_FA_PLANE_ARRIVAL "\xEF\x96\xAF" +#define ICON_FA_SHARE_SQUARE "\xEF\x85\x8D" +#define ICON_FA_THERMOMETER_HALF "\xEF\x8B\x89" +#define ICON_FA_QUESTION "\xEF\x84\xA8" +#define ICON_FA_DOOR_CLOSED "\xEF\x94\xAA" +#define ICON_FA_LEAF "\xEF\x81\xAC" +#define ICON_FA_USER_MINUS "\xEF\x94\x83" +#define ICON_FA_MUSIC "\xEF\x80\x81" +#define ICON_FA_CHEVRON_RIGHT "\xEF\x81\x94" +#define ICON_FA_GRIP_HORIZONTAL "\xEF\x96\x8D" +#define ICON_FA_DICE_FOUR "\xEF\x94\xA4" +#define ICON_FA_CROWN "\xEF\x94\xA1" +#define ICON_FA_REGISTERED "\xEF\x89\x9D" +#define ICON_FA_WINDOW_CLOSE "\xEF\x90\x90" +#define ICON_FA_LINK "\xEF\x83\x81" +#define ICON_FA_LESS_THAN "\xEF\x94\xB6" +#define ICON_FA_INFO "\xEF\x84\xA9" +#define ICON_FA_CLIPBOARD_CHECK "\xEF\x91\xAC" +#define ICON_FA_SKULL "\xEF\x95\x8C" +#define ICON_FA_PAINT_BRUSH "\xEF\x87\xBC" +#define ICON_FA_HOSPITAL_SYMBOL "\xEF\x91\xBE" +#define ICON_FA_X_RAY "\xEF\x92\x97" +#define ICON_FA_ARROW_UP "\xEF\x81\xA2" +#define ICON_FA_MONEY_BILL_WAVE "\xEF\x94\xBA" +#define ICON_FA_DOT_CIRCLE "\xEF\x86\x92" +#define ICON_FA_PAUSE_CIRCLE "\xEF\x8A\x8B" +#define ICON_FA_IMAGES "\xEF\x8C\x82" +#define ICON_FA_STAR_HALF "\xEF\x82\x89" +#define ICON_FA_SPLOTCH "\xEF\x96\xBC" +#define ICON_FA_STAR_HALF_ALT "\xEF\x97\x80" +#define ICON_FA_SHIP "\xEF\x88\x9A" +#define ICON_FA_CHECK "\xEF\x80\x8C" +#define ICON_FA_POWER_OFF "\xEF\x80\x91" +#define ICON_FA_LEMON "\xEF\x82\x94" +#define ICON_FA_GLOBE_AMERICAS "\xEF\x95\xBD" +#define ICON_FA_THERMOMETER_THREE_QUARTERS "\xEF\x8B\x88" +#define ICON_FA_WAREHOUSE "\xEF\x92\x94" +#define ICON_FA_TRANSGENDER "\xEF\x88\xA4" +#define ICON_FA_PLUS_SQUARE "\xEF\x83\xBE" +#define ICON_FA_LIRA_SIGN "\xEF\x86\x95" +#define ICON_FA_COOKIE_BITE "\xEF\x95\xA4" +#define ICON_FA_USERS "\xEF\x83\x80" +#define ICON_FA_TRANSGENDER_ALT "\xEF\x88\xA5" +#define ICON_FA_ASTERISK "\xEF\x81\xA9" +#define ICON_FA_PLUS_CIRCLE "\xEF\x81\x95" +#define ICON_FA_CART_ARROW_DOWN "\xEF\x88\x98" +#define ICON_FA_FLUSHED "\xEF\x95\xB9" +#define ICON_FA_STORE_ALT "\xEF\x95\x8F" +#define ICON_FA_PEOPLE_CARRY "\xEF\x93\x8E" +#define ICON_FA_LONG_ARROW_ALT_DOWN "\xEF\x8C\x89" +#define ICON_FA_SAD_CRY "\xEF\x96\xB3" +#define ICON_FA_DIGITAL_TACHOGRAPH "\xEF\x95\xA6" +#define ICON_FA_FILE_EXCEL "\xEF\x87\x83" +#define ICON_FA_HAND_SCISSORS "\xEF\x89\x97" +#define ICON_FA_FILE_INVOICE_DOLLAR "\xEF\x95\xB1" +#define ICON_FA_BACKWARD "\xEF\x81\x8A" +#define ICON_FA_NOTES_MEDICAL "\xEF\x92\x81" +#define ICON_FA_CODE "\xEF\x84\xA1" +#define ICON_FA_NOT_EQUAL "\xEF\x94\xBE" +#define ICON_FA_DUMBBELL "\xEF\x91\x8B" +#define ICON_FA_ANGLE_DOUBLE_UP "\xEF\x84\x82" +#define ICON_FA_ANGLE_DOUBLE_LEFT "\xEF\x84\x80" +#define ICON_FA_FILE_PRESCRIPTION "\xEF\x95\xB2" +#define ICON_FA_ANGLE_LEFT "\xEF\x84\x84" +#define ICON_FA_ATLAS "\xEF\x95\x98" +#define ICON_FA_PIGGY_BANK "\xEF\x93\x93" +#define ICON_FA_DOLLY_FLATBED "\xEF\x91\xB4" +#define ICON_FA_RANDOM "\xEF\x81\xB4" +#define ICON_FA_PEN_ALT "\xEF\x8C\x85" +#define ICON_FA_VOLUME_UP "\xEF\x80\xA8" +#define ICON_FA_CLIPBOARD_LIST "\xEF\x91\xAD" +#define ICON_FA_GRIN_STARS "\xEF\x96\x87" +#define ICON_FA_MAGNET "\xEF\x81\xB6" +#define ICON_FA_GRIMACE "\xEF\x95\xBF" +#define ICON_FA_CHECK_CIRCLE "\xEF\x81\x98" +#define ICON_FA_LONG_ARROW_ALT_LEFT "\xEF\x8C\x8A" +#define ICON_FA_CROW "\xEF\x94\xA0" +#define ICON_FA_CROP "\xEF\x84\xA5" +#define ICON_FA_SIGN "\xEF\x93\x99" +#define ICON_FA_ARROW_CIRCLE_DOWN "\xEF\x82\xAB" +#define ICON_FA_VIDEO "\xEF\x80\xBD" +#define ICON_FA_DOWNLOAD "\xEF\x80\x99" +#define ICON_FA_CARET_DOWN "\xEF\x83\x97" +#define ICON_FA_CHEVRON_LEFT "\xEF\x81\x93" +#define ICON_FA_CART_PLUS "\xEF\x88\x97" +#define ICON_FA_CLIPBOARD "\xEF\x8C\xA8" +#define ICON_FA_SHOE_PRINTS "\xEF\x95\x8B" +#define ICON_FA_PHONE_SLASH "\xEF\x8F\x9D" +#define ICON_FA_REPLY "\xEF\x8F\xA5" +#define ICON_FA_HOURGLASS_HALF "\xEF\x89\x92" +#define ICON_FA_LONG_ARROW_ALT_UP "\xEF\x8C\x8C" +#define ICON_FA_CHESS_KNIGHT "\xEF\x91\x81" +#define ICON_FA_BURN "\xEF\x91\xAA" +#define ICON_FA_PAUSE "\xEF\x81\x8C" +#define ICON_FA_WINE_GLASS_ALT "\xEF\x97\x8E" +#define ICON_FA_BOX "\xEF\x91\xA6" +#define ICON_FA_DIAGNOSES "\xEF\x91\xB0" +#define ICON_FA_FILE_IMAGE "\xEF\x87\x85" +#define ICON_FA_ARROW_CIRCLE_RIGHT "\xEF\x82\xA9" +#define ICON_FA_TASKS "\xEF\x82\xAE" +#define ICON_FA_VECTOR_SQUARE "\xEF\x97\x8B" +#define ICON_FA_QUOTE_LEFT "\xEF\x84\x8D" +#define ICON_FA_MOBILE_ALT "\xEF\x8F\x8D" +#define ICON_FA_USER_SHIELD "\xEF\x94\x85" +#define ICON_FA_MARKER "\xEF\x96\xA1" +#define ICON_FA_UTENSIL_SPOON "\xEF\x8B\xA5" +#define ICON_FA_CLOUD "\xEF\x83\x82" +#define ICON_FA_HAND_HOLDING_USD "\xEF\x93\x80" +#define ICON_FA_CERTIFICATE "\xEF\x82\xA3" +#define ICON_FA_CLOUD_DOWNLOAD_ALT "\xEF\x8E\x81" +#define ICON_FA_ANGRY "\xEF\x95\x96" +#define ICON_FA_FROG "\xEF\x94\xAE" +#define ICON_FA_CAMERA "\xEF\x80\xB0" +#define ICON_FA_DICE_THREE "\xEF\x94\xA7" +#define ICON_FA_MEMORY "\xEF\x94\xB8" +#define ICON_FA_PEN_SQUARE "\xEF\x85\x8B" +#define ICON_FA_SORT "\xEF\x83\x9C" +#define ICON_FA_PLUG "\xEF\x87\xA6" +#define ICON_FA_MOUSE_POINTER "\xEF\x89\x85" +#define ICON_FA_ENVELOPE "\xEF\x83\xA0" +#define ICON_FA_TRAIN "\xEF\x88\xB8" +#define ICON_FA_BULLHORN "\xEF\x82\xA1" +#define ICON_FA_CONCIERGE_BELL "\xEF\x95\xA2" +#define ICON_FA_CIRCLE "\xEF\x84\x91" +#define ICON_FA_I_CURSOR "\xEF\x89\x86" +#define ICON_FA_CAR "\xEF\x86\xB9" +#define ICON_FA_WALLET "\xEF\x95\x95" +#define ICON_FA_H_SQUARE "\xEF\x83\xBD" +#define ICON_FA_HEART "\xEF\x80\x84" +#define ICON_FA_LOCK_OPEN "\xEF\x8F\x81" +#define ICON_FA_STREAM "\xEF\x95\x90" +#define ICON_FA_LOCK "\xEF\x80\xA3" +#define ICON_FA_TAG "\xEF\x80\xAB" +#define ICON_FA_SMILE_BEAM "\xEF\x96\xB8" +#define ICON_FA_MICROPHONE_ALT "\xEF\x8F\x89" +#define ICON_FA_SPA "\xEF\x96\xBB" +#define ICON_FA_CHEVRON_CIRCLE_DOWN "\xEF\x84\xBA" +#define ICON_FA_TICKET_ALT "\xEF\x8F\xBF" +#define ICON_FA_BOOK_OPEN "\xEF\x94\x98" +#define ICON_FA_MAP "\xEF\x89\xB9" +#define ICON_FA_COCKTAIL "\xEF\x95\xA1" +#define ICON_FA_CLONE "\xEF\x89\x8D" +#define ICON_FA_ID_CARD_ALT "\xEF\x91\xBF" +#define ICON_FA_CHECK_SQUARE "\xEF\x85\x8A" +#define ICON_FA_CHART_LINE "\xEF\x88\x81" +#define ICON_FA_DOVE "\xEF\x92\xBA" +#define ICON_FA_MARS_STROKE "\xEF\x88\xA9" +#define ICON_FA_ENVELOPE_OPEN "\xEF\x8A\xB6" +#define ICON_FA_WHEELCHAIR "\xEF\x86\x93" +#define ICON_FA_ROBOT "\xEF\x95\x84" +#define ICON_FA_UNDO_ALT "\xEF\x8B\xAA" +#define ICON_FA_TRUCK "\xEF\x83\x91" +#define ICON_FA_WON_SIGN "\xEF\x85\x99" +#define ICON_FA_SUPERSCRIPT "\xEF\x84\xAB" +#define ICON_FA_TTY "\xEF\x87\xA4" +#define ICON_FA_USER_MD "\xEF\x83\xB0" +#define ICON_FA_ALIGN_LEFT "\xEF\x80\xB6" +#define ICON_FA_TABLETS "\xEF\x92\x90" +#define ICON_FA_MOTORCYCLE "\xEF\x88\x9C" +#define ICON_FA_ANGLE_UP "\xEF\x84\x86" +#define ICON_FA_BROOM "\xEF\x94\x9A" +#define ICON_FA_LEVEL_DOWN_ALT "\xEF\x8E\xBE" +#define ICON_FA_PAPERCLIP "\xEF\x83\x86" +#define ICON_FA_USER_CLOCK "\xEF\x93\xBD" +#define ICON_FA_SORT_ALPHA_UP "\xEF\x85\x9E" +#define ICON_FA_AUDIO_DESCRIPTION "\xEF\x8A\x9E" +#define ICON_FA_FILE_DOWNLOAD "\xEF\x95\xAD" +#define ICON_FA_SYNC_ALT "\xEF\x8B\xB1" +#define ICON_FA_KISS "\xEF\x96\x96" +#define ICON_FA_HANDS "\xEF\x93\x82" +#define ICON_FA_EDIT "\xEF\x81\x84" +#define ICON_FA_UNIVERSITY "\xEF\x86\x9C" +#define ICON_FA_GLASSES "\xEF\x94\xB0" +#define ICON_FA_SQUARE "\xEF\x83\x88" +#define ICON_FA_GRIN_SQUINT "\xEF\x96\x85" +#define ICON_FA_GLOBE "\xEF\x82\xAC" +#define ICON_FA_RECEIPT "\xEF\x95\x83" +#define ICON_FA_STRIKETHROUGH "\xEF\x83\x8C" +#define ICON_FA_UNLOCK "\xEF\x82\x9C" +#define ICON_FA_DICE_SIX "\xEF\x94\xA6" +#define ICON_FA_GRIP_VERTICAL "\xEF\x96\x8E" +#define ICON_FA_PILLS "\xEF\x92\x84" +#define ICON_FA_EXCLAMATION "\xEF\x84\xAA" +#define ICON_FA_CALENDAR_PLUS "\xEF\x89\xB1" +#define ICON_FA_LOCATION_ARROW "\xEF\x84\xA4" +#define ICON_FA_UMBRELLA "\xEF\x83\xA9" +#define ICON_FA_UNDO "\xEF\x83\xA2" +#define ICON_FA_INDENT "\xEF\x80\xBC" +#define ICON_FA_LANGUAGE "\xEF\x86\xAB" +#define ICON_FA_ARROW_ALT_CIRCLE_UP "\xEF\x8D\x9B" +#define ICON_FA_HEADPHONES "\xEF\x80\xA5" +#define ICON_FA_TIMES "\xEF\x80\x8D" +#define ICON_FA_LEVEL_UP_ALT "\xEF\x8E\xBF" +#define ICON_FA_BLIND "\xEF\x8A\x9D" +#define ICON_FA_PHONE_SQUARE "\xEF\x82\x98" +#define ICON_FA_SHOPPING_BASKET "\xEF\x8A\x91" +#define ICON_FA_TEXT_WIDTH "\xEF\x80\xB5" +#define ICON_FA_RSS_SQUARE "\xEF\x85\x83" +#define ICON_FA_PARACHUTE_BOX "\xEF\x93\x8D" +#define ICON_FA_CLOUD_UPLOAD_ALT "\xEF\x8E\x82" +#define ICON_FA_SORT_UP "\xEF\x83\x9E" +#define ICON_FA_SIGN_OUT_ALT "\xEF\x8B\xB5" +#define ICON_FA_USER_NINJA "\xEF\x94\x84" +#define ICON_FA_SIGN_IN_ALT "\xEF\x8B\xB6" +#define ICON_FA_FORWARD "\xEF\x81\x8E" +#define ICON_FA_SHARE_ALT "\xEF\x87\xA0" +#define ICON_FA_CALENDAR_CHECK "\xEF\x89\xB4" +#define ICON_FA_PEN_FANCY "\xEF\x96\xAC" +#define ICON_FA_BED "\xEF\x88\xB6" +#define ICON_FA_FILE_SIGNATURE "\xEF\x95\xB3" +#define ICON_FA_TOGGLE_OFF "\xEF\x88\x84" +#define ICON_FA_MAP_MARKER_ALT "\xEF\x8F\x85" +#define ICON_FA_MEH_ROLLING_EYES "\xEF\x96\xA5" +#define ICON_FA_RULER_HORIZONTAL "\xEF\x95\x87" +#define ICON_FA_PAINT_ROLLER "\xEF\x96\xAA" +#define ICON_FA_CALENDAR "\xEF\x84\xB3" +#define ICON_FA_MICROPHONE "\xEF\x84\xB0" +#define ICON_FA_FOOTBALL_BALL "\xEF\x91\x8E" +#define ICON_FA_ALLERGIES "\xEF\x91\xA1" +#define ICON_FA_ID_CARD "\xEF\x8B\x82" +#define ICON_FA_REDO_ALT "\xEF\x8B\xB9" +#define ICON_FA_PLAY_CIRCLE "\xEF\x85\x84" +#define ICON_FA_THERMOMETER "\xEF\x92\x91" +#define ICON_FA_DOLLAR_SIGN "\xEF\x85\x95" +#define ICON_FA_COMPRESS "\xEF\x81\xA6" +#define ICON_FA_PALETTE "\xEF\x94\xBF" +#define ICON_FA_ANGLE_RIGHT "\xEF\x84\x85" +#define ICON_FA_CHESS_QUEEN "\xEF\x91\x85" +#define ICON_FA_MEDAL "\xEF\x96\xA2" +#define ICON_FA_MEH_BLANK "\xEF\x96\xA4" +#define ICON_FA_EJECT "\xEF\x81\x92" +#define ICON_FA_HOURGLASS_END "\xEF\x89\x93" +#define ICON_FA_TOOTH "\xEF\x97\x89" +#define ICON_FA_GRIN_TONGUE_SQUINT "\xEF\x96\x8A" +#define ICON_FA_WALKING "\xEF\x95\x94" +#define ICON_FA_SHIPPING_FAST "\xEF\x92\x8B" +#define ICON_FA_CARET_LEFT "\xEF\x83\x99" +#define ICON_FA_DICE "\xEF\x94\xA2" +#define ICON_FA_RUBLE_SIGN "\xEF\x85\x98" +#define ICON_FA_RULER_VERTICAL "\xEF\x95\x88" +#define ICON_FA_HAND_POINTER "\xEF\x89\x9A" +#define ICON_FA_TAPE "\xEF\x93\x9B" +#define ICON_FA_SHOPPING_BAG "\xEF\x8A\x90" +#define ICON_FA_DICE_TWO "\xEF\x94\xA8" +#define ICON_FA_CUBE "\xEF\x86\xB2" +#define ICON_FA_CAPSULES "\xEF\x91\xAB" +#define ICON_FA_KIWI_BIRD "\xEF\x94\xB5" +#define ICON_FA_CHEVRON_CIRCLE_UP "\xEF\x84\xB9" +#define ICON_FA_MARS_STROKE_V "\xEF\x88\xAA" +#define ICON_FA_FILE_ARCHIVE "\xEF\x87\x86" +#define ICON_FA_JOINT "\xEF\x96\x95" +#define ICON_FA_MARS_STROKE_H "\xEF\x88\xAB" +#define ICON_FA_ADDRESS_BOOK "\xEF\x8A\xB9" +#define ICON_FA_PROCEDURES "\xEF\x92\x87" +#define ICON_FA_GEM "\xEF\x8E\xA5" +#define ICON_FA_RULER_COMBINED "\xEF\x95\x86" +#define ICON_FA_FIGHTER_JET "\xEF\x83\xBB" +#define ICON_FA_SPACE_SHUTTLE "\xEF\x86\x97" +#define ICON_FA_MAP_PIN "\xEF\x89\xB6" +#define ICON_FA_ALIGN_CENTER "\xEF\x80\xB7" +#define ICON_FA_SORT_ALPHA_DOWN "\xEF\x85\x9D" +#define ICON_FA_PARKING "\xEF\x95\x80" +#define ICON_FA_MAP_SIGNS "\xEF\x89\xB7" +#define ICON_FA_YEN_SIGN "\xEF\x85\x97" +#define ICON_FA_GLASS_MARTINI "\xEF\x80\x80" +#define ICON_FA_TIMES_CIRCLE "\xEF\x81\x97" +#define ICON_FA_MONUMENT "\xEF\x96\xA6" +#define ICON_FA_GRIN_BEAM "\xEF\x96\x82" +#define ICON_FA_KEY "\xEF\x82\x84" +#define ICON_FA_TH_LIST "\xEF\x80\x8B" +#define ICON_FA_SHARE_ALT_SQUARE "\xEF\x87\xA1" +#define ICON_FA_DRUM "\xEF\x95\xA9" +#define ICON_FA_FILE_CONTRACT "\xEF\x95\xAC" +#define ICON_FA_UNLOCK_ALT "\xEF\x84\xBE" +#define ICON_FA_MICROPHONE_ALT_SLASH "\xEF\x94\xB9" +#define ICON_FA_USER_SECRET "\xEF\x88\x9B" +#define ICON_FA_ARROW_RIGHT "\xEF\x81\xA1" +#define ICON_FA_FILE_VIDEO "\xEF\x87\x88" +#define ICON_FA_ARROW_ALT_CIRCLE_RIGHT "\xEF\x8D\x9A" +#define ICON_FA_COMMENT "\xEF\x81\xB5" +#define ICON_FA_USER_GRADUATE "\xEF\x94\x81" +#define ICON_FA_POO "\xEF\x8B\xBE" +#define ICON_FA_LAUGH "\xEF\x96\x99" +#define ICON_FA_TABLE "\xEF\x83\x8E" +#define ICON_FA_THUMBS_UP "\xEF\x85\xA4" +#define ICON_FA_TRADEMARK "\xEF\x89\x9C" +#define ICON_FA_VIALS "\xEF\x92\x93" +#define ICON_FA_FIRST_AID "\xEF\x91\xB9" +#define ICON_FA_ERASER "\xEF\x84\xAD" +#define ICON_FA_MARS "\xEF\x88\xA2" +#define ICON_FA_HELICOPTER "\xEF\x94\xB3" +#define ICON_FA_FEATHER "\xEF\x94\xAD" +#define ICON_FA_SQUARE_FULL "\xEF\x91\x9C" +#define ICON_FA_HOURGLASS_START "\xEF\x89\x91" +#define ICON_FA_GRIN_HEARTS "\xEF\x96\x84" +#define ICON_FA_USER_COG "\xEF\x93\xBE" +#define ICON_FA_HASHTAG "\xEF\x8A\x92" +#define ICON_FA_SMOKING "\xEF\x92\x8D" +#define ICON_FA_SEEDLING "\xEF\x93\x98" +#define ICON_FA_TSHIRT "\xEF\x95\x93" +#define ICON_FA_LAUGH_SQUINT "\xEF\x96\x9B" +#define ICON_FA_HDD "\xEF\x82\xA0" +#define ICON_FA_NEWSPAPER "\xEF\x87\xAA" +#define ICON_FA_HOSPITAL_ALT "\xEF\x91\xBD" +#define ICON_FA_USER_SLASH "\xEF\x94\x86" +#define ICON_FA_FILE_WORD "\xEF\x87\x82" +#define ICON_FA_ENVELOPE_SQUARE "\xEF\x86\x99" +#define ICON_FA_GENDERLESS "\xEF\x88\xAD" +#define ICON_FA_DICE_FIVE "\xEF\x94\xA3" +#define ICON_FA_PAW "\xEF\x86\xB0" +#define ICON_FA_HAND_HOLDING_HEART "\xEF\x92\xBE" +#define ICON_FA_ARCHIVE "\xEF\x86\x87" +#define ICON_FA_SOLAR_PANEL "\xEF\x96\xBA" +#define ICON_FA_INFINITY "\xEF\x94\xB4" +#define ICON_FA_HAND_POINT_DOWN "\xEF\x82\xA7" +#define ICON_FA_MAP_MARKER "\xEF\x81\x81" +#define ICON_FA_CALENDAR_ALT "\xEF\x81\xB3" +#define ICON_FA_AMERICAN_SIGN_LANGUAGE_INTERPRETING "\xEF\x8A\xA3" +#define ICON_FA_BINOCULARS "\xEF\x87\xA5" +#define ICON_FA_STICKY_NOTE "\xEF\x89\x89" +#define ICON_FA_PEN_NIB "\xEF\x96\xAD" +#define ICON_FA_MAP_MARKED "\xEF\x96\x9F" +#define ICON_FA_EXPAND "\xEF\x81\xA5" +#define ICON_FA_PRESCRIPTION_BOTTLE "\xEF\x92\x85" +#define ICON_FA_BIRTHDAY_CAKE "\xEF\x87\xBD" +#define ICON_FA_GOLF_BALL "\xEF\x91\x90" +#define ICON_FA_CHART_BAR "\xEF\x82\x80" +#define ICON_FA_TAXI "\xEF\x86\xBA" +#define ICON_FA_ROCKET "\xEF\x84\xB5" +#define ICON_FA_FINGERPRINT "\xEF\x95\xB7" +#define ICON_FA_ARROWS_ALT "\xEF\x82\xB2" +#define ICON_FA_UNDERLINE "\xEF\x83\x8D" +#define ICON_FA_ARROW_CIRCLE_UP "\xEF\x82\xAA" +#define ICON_FA_BASKETBALL_BALL "\xEF\x90\xB4" +#define ICON_FA_DESKTOP "\xEF\x84\x88" +#define ICON_FA_SPINNER "\xEF\x84\x90" +#define ICON_FA_TOGGLE_ON "\xEF\x88\x85" +#define ICON_FA_STOPWATCH "\xEF\x8B\xB2" +#define ICON_FA_ARROW_ALT_CIRCLE_LEFT "\xEF\x8D\x99" +#define ICON_FA_GAS_PUMP "\xEF\x94\xAF" +#define ICON_FA_EXTERNAL_LINK_ALT "\xEF\x8D\x9D" +#define ICON_FA_FROWN "\xEF\x84\x99" +#define ICON_FA_RULER "\xEF\x95\x85" +#define ICON_FA_GRIN "\xEF\x96\x80" +#define ICON_FA_ARROW_CIRCLE_LEFT "\xEF\x82\xA8" +#define ICON_FA_HIGHLIGHTER "\xEF\x96\x91" +#define ICON_FA_SERVER "\xEF\x88\xB3" +#define ICON_FA_BATTERY_EMPTY "\xEF\x89\x84" +#define ICON_FA_SPRAY_CAN "\xEF\x96\xBD" +#define ICON_FA_BOWLING_BALL "\xEF\x90\xB6" +#define ICON_FA_TERMINAL "\xEF\x84\xA0" +#define ICON_FA_WINDOW_MINIMIZE "\xEF\x8B\x91" +#define ICON_FA_MARS_DOUBLE "\xEF\x88\xA7" +#define ICON_FA_HOME "\xEF\x80\x95" +#define ICON_FA_COMMENT_ALT "\xEF\x89\xBA" +#define ICON_FA_SEARCH_MINUS "\xEF\x80\x90" +#define ICON_FA_QUIDDITCH "\xEF\x91\x98" +#define ICON_FA_UMBRELLA_BEACH "\xEF\x97\x8A" +#define ICON_FA_MOON "\xEF\x86\x86" +#define ICON_FA_CANNABIS "\xEF\x95\x9F" +#define ICON_FA_LAUGH_BEAM "\xEF\x96\x9A" +#define ICON_FA_CHART_PIE "\xEF\x88\x80" +#define ICON_FA_HANDS_HELPING "\xEF\x93\x84" +#define ICON_FA_PASTE "\xEF\x83\xAA" +#define ICON_FA_LUGGAGE_CART "\xEF\x96\x9D" +#define ICON_FA_INDUSTRY "\xEF\x89\xB5" +#define ICON_FA_SWIMMER "\xEF\x97\x84" +#define ICON_FA_ROAD "\xEF\x80\x98" +#define ICON_FA_IMAGE "\xEF\x80\xBE" +#define ICON_FA_ANGLE_DOUBLE_RIGHT "\xEF\x84\x81" +#define ICON_FA_DOOR_OPEN "\xEF\x94\xAB" +#define ICON_FA_GRIN_TONGUE_WINK "\xEF\x96\x8B" +#define ICON_FA_REPLY_ALL "\xEF\x84\xA2" +#define ICON_FA_INBOX "\xEF\x80\x9C" +#define ICON_FA_FEMALE "\xEF\x86\x82" +#define ICON_FA_SYRINGE "\xEF\x92\x8E" +#define ICON_FA_CIRCLE_NOTCH "\xEF\x87\x8E" +#define ICON_FA_WEIGHT "\xEF\x92\x96" +#define ICON_FA_TABLE_TENNIS "\xEF\x91\x9D" +#define ICON_FA_LOW_VISION "\xEF\x8A\xA8" +#define ICON_FA_FILE_IMPORT "\xEF\x95\xAF" +#define ICON_FA_ITALIC "\xEF\x80\xB3" +#define ICON_FA_CLOSED_CAPTIONING "\xEF\x88\x8A" +#define ICON_FA_CHALKBOARD "\xEF\x94\x9B" +#define ICON_FA_THUMBS_DOWN "\xEF\x85\xA5" +#define ICON_FA_TACHOMETER_ALT "\xEF\x8F\xBD" +#define ICON_FA_BUS "\xEF\x88\x87" +#define ICON_FA_ANGLE_DOWN "\xEF\x84\x87" +#define ICON_FA_HAND_ROCK "\xEF\x89\x95" +#define ICON_FA_PODCAST "\xEF\x8B\x8E" +#define ICON_FA_TRUCK_MOVING "\xEF\x93\x9F" +#define ICON_FA_BUG "\xEF\x86\x88" +#define ICON_FA_SHIELD_ALT "\xEF\x8F\xAD" +#define ICON_FA_FILL_DRIP "\xEF\x95\xB6" +#define ICON_FA_COMMENT_SLASH "\xEF\x92\xB3" +#define ICON_FA_SUITCASE "\xEF\x83\xB2" +#define ICON_FA_HAND_HOLDING "\xEF\x92\xBD" +#define ICON_FA_VENUS_MARS "\xEF\x88\xA8" +#define ICON_FA_UTENSILS "\xEF\x8B\xA7" +#define ICON_FA_TH_LARGE "\xEF\x80\x89" +#define ICON_FA_AT "\xEF\x87\xBA" +#define ICON_FA_FILE "\xEF\x85\x9B" +#define ICON_FA_FLAG_CHECKERED "\xEF\x84\x9E" +#define ICON_FA_FILM "\xEF\x80\x88" +#define ICON_FA_FILL "\xEF\x95\xB5" +#define ICON_FA_GRIN_SQUINT_TEARS "\xEF\x96\x86" +#define ICON_FA_PERCENT "\xEF\x8A\x95" +#define ICON_FA_BOOK "\xEF\x80\xAD" +#define ICON_FA_TRASH "\xEF\x87\xB8" +#define ICON_FA_FILE_AUDIO "\xEF\x87\x87" +#define ICON_FA_STAR "\xEF\x80\x85" +#define ICON_FA_STEP_FORWARD "\xEF\x81\x91" +#define ICON_FA_BUILDING "\xEF\x86\xAD" +#define ICON_FA_PRESCRIPTION_BOTTLE_ALT "\xEF\x92\x86" +#define ICON_FA_MONEY_BILL_WAVE_ALT "\xEF\x94\xBB" +#define ICON_FA_NEUTER "\xEF\x88\xAC" +#define ICON_FA_BAND_AID "\xEF\x91\xA2" +#define ICON_FA_WIFI "\xEF\x87\xAB" +#define ICON_FA_VENUS_DOUBLE "\xEF\x88\xA6" +#define ICON_FA_CHEVRON_UP "\xEF\x81\xB7" +#define ICON_FA_HAND_SPOCK "\xEF\x89\x99" +#define ICON_FA_HAND_POINT_UP "\xEF\x82\xA6" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_5_brands.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_5_brands.h new file mode 100644 index 00000000000..69eac334e20 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_font_awesome_5_brands.h @@ -0,0 +1,382 @@ +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/advanced-options/metadata/icons.yml +// for use with https://github.com/FortAwesome/Font-Awesome/blob/master/web-fonts-with-css/webfonts/fa-brands-400.ttf +#pragma once + +#define FONT_ICON_FILE_NAME_FAB "fa-brands-400.ttf" + +#define ICON_MIN_FAB 0xf081 +#define ICON_MAX_FAB 0xf5cf +#define ICON_FAB_LINKEDIN_IN "\xEF\x83\xA1" +#define ICON_FAB_TELEGRAM_PLANE "\xEF\x8F\xBE" +#define ICON_FAB_WPFORMS "\xEF\x8A\x98" +#define ICON_FAB_INSTAGRAM "\xEF\x85\xAD" +#define ICON_FAB_CREATIVE_COMMONS "\xEF\x89\x9E" +#define ICON_FAB_ANGRYCREATIVE "\xEF\x8D\xAE" +#define ICON_FAB_ITUNES "\xEF\x8E\xB4" +#define ICON_FAB_CC_STRIPE "\xEF\x87\xB5" +#define ICON_FAB_500PX "\xEF\x89\xAE" +#define ICON_FAB_SISTRIX "\xEF\x8F\xAE" +#define ICON_FAB_PHOENIX_SQUADRON "\xEF\x94\x91" +#define ICON_FAB_STEAM_SQUARE "\xEF\x86\xB7" +#define ICON_FAB_FONT_AWESOME_LOGO_FULL "\xEF\x93\xA6" +#define ICON_FAB_BLOGGER_B "\xEF\x8D\xBD" +#define ICON_FAB_STRIPE_S "\xEF\x90\xAA" +#define ICON_FAB_AMAZON_PAY "\xEF\x90\xAC" +#define ICON_FAB_YAHOO "\xEF\x86\x9E" +#define ICON_FAB_REPLYD "\xEF\x8F\xA6" +#define ICON_FAB_GITKRAKEN "\xEF\x8E\xA6" +#define ICON_FAB_PUSHED "\xEF\x8F\xA1" +#define ICON_FAB_MAGENTO "\xEF\x8F\x84" +#define ICON_FAB_HUBSPOT "\xEF\x8E\xB2" +#define ICON_FAB_LASTFM "\xEF\x88\x82" +#define ICON_FAB_VAADIN "\xEF\x90\x88" +#define ICON_FAB_GOODREADS "\xEF\x8E\xA8" +#define ICON_FAB_CREATIVE_COMMONS_PD "\xEF\x93\xAC" +#define ICON_FAB_WORDPRESS_SIMPLE "\xEF\x90\x91" +#define ICON_FAB_HOOLI "\xEF\x90\xA7" +#define ICON_FAB_GITHUB "\xEF\x82\x9B" +#define ICON_FAB_MASTODON "\xEF\x93\xB6" +#define ICON_FAB_YOAST "\xEF\x8A\xB1" +#define ICON_FAB_YANDEX_INTERNATIONAL "\xEF\x90\x94" +#define ICON_FAB_JOGET "\xEF\x8E\xB7" +#define ICON_FAB_YANDEX "\xEF\x90\x93" +#define ICON_FAB_FACEBOOK_MESSENGER "\xEF\x8E\x9F" +#define ICON_FAB_GLIDE "\xEF\x8A\xA5" +#define ICON_FAB_WHATSAPP_SQUARE "\xEF\x90\x8C" +#define ICON_FAB_ERLANG "\xEF\x8E\x9D" +#define ICON_FAB_INTERNET_EXPLORER "\xEF\x89\xAB" +#define ICON_FAB_CREATIVE_COMMONS_BY "\xEF\x93\xA7" +#define ICON_FAB_FORT_AWESOME_ALT "\xEF\x8E\xA3" +#define ICON_FAB_SCRIBD "\xEF\x8A\x8A" +#define ICON_FAB_D_AND_D "\xEF\x8E\x8D" +#define ICON_FAB_BUROMOBELEXPERTE "\xEF\x8D\xBF" +#define ICON_FAB_QUINSCAPE "\xEF\x91\x99" +#define ICON_FAB_HOUZZ "\xEF\x89\xBC" +#define ICON_FAB_CC_DINERS_CLUB "\xEF\x89\x8C" +#define ICON_FAB_SOUNDCLOUD "\xEF\x86\xBE" +#define ICON_FAB_DRUPAL "\xEF\x86\xA9" +#define ICON_FAB_RED_RIVER "\xEF\x8F\xA3" +#define ICON_FAB_FONTICONS "\xEF\x8A\x80" +#define ICON_FAB_STRIPE "\xEF\x90\xA9" +#define ICON_FAB_DELICIOUS "\xEF\x86\xA5" +#define ICON_FAB_HIRE_A_HELPER "\xEF\x8E\xB0" +#define ICON_FAB_BITCOIN "\xEF\x8D\xB9" +#define ICON_FAB_WPBEGINNER "\xEF\x8A\x97" +#define ICON_FAB_STICKER_MULE "\xEF\x8F\xB7" +#define ICON_FAB_DIGG "\xEF\x86\xA6" +#define ICON_FAB_HOTJAR "\xEF\x8E\xB1" +#define ICON_FAB_EBAY "\xEF\x93\xB4" +#define ICON_FAB_ASYMMETRIK "\xEF\x8D\xB2" +#define ICON_FAB_CREATIVE_COMMONS_SA "\xEF\x93\xAF" +#define ICON_FAB_TENCENT_WEIBO "\xEF\x87\x95" +#define ICON_FAB_SNAPCHAT_SQUARE "\xEF\x8A\xAD" +#define ICON_FAB_WOLF_PACK_BATTALION "\xEF\x94\x94" +#define ICON_FAB_FIRST_ORDER "\xEF\x8A\xB0" +#define ICON_FAB_STEAM_SYMBOL "\xEF\x8F\xB6" +#define ICON_FAB_CREATIVE_COMMONS_SHARE "\xEF\x93\xB2" +#define ICON_FAB_CC_JCB "\xEF\x89\x8B" +#define ICON_FAB_GOOGLE_PLUS_SQUARE "\xEF\x83\x94" +#define ICON_FAB_VNV "\xEF\x90\x8B" +#define ICON_FAB_DOCKER "\xEF\x8E\x95" +#define ICON_FAB_PINTEREST "\xEF\x83\x92" +#define ICON_FAB_FIRST_ORDER_ALT "\xEF\x94\x8A" +#define ICON_FAB_CC_DISCOVER "\xEF\x87\xB2" +#define ICON_FAB_HIPS "\xEF\x91\x92" +#define ICON_FAB_SQUARESPACE "\xEF\x96\xBE" +#define ICON_FAB_VIACOIN "\xEF\x88\xB7" +#define ICON_FAB_TYPO3 "\xEF\x90\xAB" +#define ICON_FAB_PRODUCT_HUNT "\xEF\x8A\x88" +#define ICON_FAB_DISCORD "\xEF\x8E\x92" +#define ICON_FAB_TWITTER_SQUARE "\xEF\x82\x81" +#define ICON_FAB_GOOGLE_PLAY "\xEF\x8E\xAB" +#define ICON_FAB_AMAZON "\xEF\x89\xB0" +#define ICON_FAB_DRAFT2DIGITAL "\xEF\x8E\x96" +#define ICON_FAB_STEAM "\xEF\x86\xB6" +#define ICON_FAB_PLAYSTATION "\xEF\x8F\x9F" +#define ICON_FAB_VINE "\xEF\x87\x8A" +#define ICON_FAB_README "\xEF\x93\x95" +#define ICON_FAB_ITUNES_NOTE "\xEF\x8E\xB5" +#define ICON_FAB_REDDIT "\xEF\x86\xA1" +#define ICON_FAB_PINTEREST_P "\xEF\x88\xB1" +#define ICON_FAB_HTML5 "\xEF\x84\xBB" +#define ICON_FAB_VIBER "\xEF\x90\x89" +#define ICON_FAB_PERISCOPE "\xEF\x8F\x9A" +#define ICON_FAB_TRADE_FEDERATION "\xEF\x94\x93" +#define ICON_FAB_SUPPLE "\xEF\x8F\xB9" +#define ICON_FAB_JAVA "\xEF\x93\xA4" +#define ICON_FAB_MIZUNI "\xEF\x8F\x8C" +#define ICON_FAB_NODE_JS "\xEF\x8F\x93" +#define ICON_FAB_CODEPEN "\xEF\x87\x8B" +#define ICON_FAB_GITTER "\xEF\x90\xA6" +#define ICON_FAB_SUPERPOWERS "\xEF\x8B\x9D" +#define ICON_FAB_SELLSY "\xEF\x88\x93" +#define ICON_FAB_ADN "\xEF\x85\xB0" +#define ICON_FAB_CLOUDSMITH "\xEF\x8E\x84" +#define ICON_FAB_RAVELRY "\xEF\x8B\x99" +#define ICON_FAB_DIGITAL_OCEAN "\xEF\x8E\x91" +#define ICON_FAB_MANDALORIAN "\xEF\x94\x8F" +#define ICON_FAB_SKYPE "\xEF\x85\xBE" +#define ICON_FAB_ALGOLIA "\xEF\x8D\xAC" +#define ICON_FAB_DEPLOYDOG "\xEF\x8E\x8E" +#define ICON_FAB_DASHCUBE "\xEF\x88\x90" +#define ICON_FAB_MEETUP "\xEF\x8B\xA0" +#define ICON_FAB_DISCOURSE "\xEF\x8E\x93" +#define ICON_FAB_STACK_OVERFLOW "\xEF\x85\xAC" +#define ICON_FAB_STACK_EXCHANGE "\xEF\x86\x8D" +#define ICON_FAB_CREATIVE_COMMONS_SAMPLING_PLUS "\xEF\x93\xB1" +#define ICON_FAB_ACCUSOFT "\xEF\x8D\xA9" +#define ICON_FAB_GRATIPAY "\xEF\x86\x84" +#define ICON_FAB_IOXHOST "\xEF\x88\x88" +#define ICON_FAB_EDGE "\xEF\x8A\x82" +#define ICON_FAB_ETSY "\xEF\x8B\x97" +#define ICON_FAB_THEMECO "\xEF\x97\x86" +#define ICON_FAB_WHMCS "\xEF\x90\x8D" +#define ICON_FAB_EMPIRE "\xEF\x87\x91" +#define ICON_FAB_TELEGRAM "\xEF\x8B\x86" +#define ICON_FAB_CC_APPLE_PAY "\xEF\x90\x96" +#define ICON_FAB_AVIANEX "\xEF\x8D\xB4" +#define ICON_FAB_GOOGLE_PLUS "\xEF\x8A\xB3" +#define ICON_FAB_WHATSAPP "\xEF\x88\xB2" +#define ICON_FAB_NINTENDO_SWITCH "\xEF\x90\x98" +#define ICON_FAB_FIRSTDRAFT "\xEF\x8E\xA1" +#define ICON_FAB_XBOX "\xEF\x90\x92" +#define ICON_FAB_VIADEO "\xEF\x8A\xA9" +#define ICON_FAB_APP_STORE "\xEF\x8D\xAF" +#define ICON_FAB_GOOGLE "\xEF\x86\xA0" +#define ICON_FAB_MAXCDN "\xEF\x84\xB6" +#define ICON_FAB_HACKER_NEWS_SQUARE "\xEF\x8E\xAF" +#define ICON_FAB_SPEAKAP "\xEF\x8F\xB3" +#define ICON_FAB_AWS "\xEF\x8D\xB5" +#define ICON_FAB_OPENCART "\xEF\x88\xBD" +#define ICON_FAB_UNTAPPD "\xEF\x90\x85" +#define ICON_FAB_REACT "\xEF\x90\x9B" +#define ICON_FAB_THEMEISLE "\xEF\x8A\xB2" +#define ICON_FAB_JOOMLA "\xEF\x86\xAA" +#define ICON_FAB_TWITCH "\xEF\x87\xA8" +#define ICON_FAB_PATREON "\xEF\x8F\x99" +#define ICON_FAB_USSUNNAH "\xEF\x90\x87" +#define ICON_FAB_JSFIDDLE "\xEF\x87\x8C" +#define ICON_FAB_WORDPRESS "\xEF\x86\x9A" +#define ICON_FAB_GOOGLE_PLUS_G "\xEF\x83\x95" +#define ICON_FAB_MEDIUM "\xEF\x88\xBA" +#define ICON_FAB_PAYPAL "\xEF\x87\xAD" +#define ICON_FAB_NS8 "\xEF\x8F\x95" +#define ICON_FAB_LINE "\xEF\x8F\x80" +#define ICON_FAB_ANGELLIST "\xEF\x88\x89" +#define ICON_FAB_TUMBLR "\xEF\x85\xB3" +#define ICON_FAB_SIMPLYBUILT "\xEF\x88\x95" +#define ICON_FAB_SHOPWARE "\xEF\x96\xB5" +#define ICON_FAB_WINDOWS "\xEF\x85\xBA" +#define ICON_FAB_GG_CIRCLE "\xEF\x89\xA1" +#define ICON_FAB_UBER "\xEF\x90\x82" +#define ICON_FAB_BIMOBJECT "\xEF\x8D\xB8" +#define ICON_FAB_DRIBBBLE_SQUARE "\xEF\x8E\x97" +#define ICON_FAB_JENKINS "\xEF\x8E\xB6" +#define ICON_FAB_PALFED "\xEF\x8F\x98" +#define ICON_FAB_NODE "\xEF\x90\x99" +#define ICON_FAB_GALACTIC_SENATE "\xEF\x94\x8D" +#define ICON_FAB_XING "\xEF\x85\xA8" +#define ICON_FAB_CUTTLEFISH "\xEF\x8E\x8C" +#define ICON_FAB_BITBUCKET "\xEF\x85\xB1" +#define ICON_FAB_BEHANCE_SQUARE "\xEF\x86\xB5" +#define ICON_FAB_YOUTUBE "\xEF\x85\xA7" +#define ICON_FAB_MICROSOFT "\xEF\x8F\x8A" +#define ICON_FAB_FONTICONS_FI "\xEF\x8E\xA2" +#define ICON_FAB_WIKIPEDIA_W "\xEF\x89\xA6" +#define ICON_FAB_APPLE_PAY "\xEF\x90\x95" +#define ICON_FAB_SNAPCHAT_GHOST "\xEF\x8A\xAC" +#define ICON_FAB_FULCRUM "\xEF\x94\x8B" +#define ICON_FAB_GG "\xEF\x89\xA0" +#define ICON_FAB_PIED_PIPER_PP "\xEF\x86\xA7" +#define ICON_FAB_GOOGLE_DRIVE "\xEF\x8E\xAA" +#define ICON_FAB_FOURSQUARE "\xEF\x86\x80" +#define ICON_FAB_QUORA "\xEF\x8B\x84" +#define ICON_FAB_FACEBOOK "\xEF\x82\x9A" +#define ICON_FAB_GLIDE_G "\xEF\x8A\xA6" +#define ICON_FAB_CODIEPIE "\xEF\x8A\x84" +#define ICON_FAB_FACEBOOK_F "\xEF\x8E\x9E" +#define ICON_FAB_FONT_AWESOME "\xEF\x8A\xB4" +#define ICON_FAB_GOFORE "\xEF\x8E\xA7" +#define ICON_FAB_NIMBLR "\xEF\x96\xA8" +#define ICON_FAB_GITHUB_SQUARE "\xEF\x82\x92" +#define ICON_FAB_UIKIT "\xEF\x90\x83" +#define ICON_FAB_MIXCLOUD "\xEF\x8A\x89" +#define ICON_FAB_PINTEREST_SQUARE "\xEF\x83\x93" +#define ICON_FAB_FIREFOX "\xEF\x89\xA9" +#define ICON_FAB_APPLE "\xEF\x85\xB9" +#define ICON_FAB_DYALOG "\xEF\x8E\x99" +#define ICON_FAB_DRIBBBLE "\xEF\x85\xBD" +#define ICON_FAB_WIX "\xEF\x97\x8F" +#define ICON_FAB_NUTRITIONIX "\xEF\x8F\x96" +#define ICON_FAB_GULP "\xEF\x8E\xAE" +#define ICON_FAB_USB "\xEF\x8A\x87" +#define ICON_FAB_WPEXPLORER "\xEF\x8B\x9E" +#define ICON_FAB_RENDACT "\xEF\x8F\xA4" +#define ICON_FAB_AVIATO "\xEF\x90\xA1" +#define ICON_FAB_PYTHON "\xEF\x8F\xA2" +#define ICON_FAB_APPER "\xEF\x8D\xB1" +#define ICON_FAB_CREATIVE_COMMONS_PD_ALT "\xEF\x93\xAD" +#define ICON_FAB_FLY "\xEF\x90\x97" +#define ICON_FAB_STUMBLEUPON "\xEF\x86\xA4" +#define ICON_FAB_FONT_AWESOME_ALT "\xEF\x8D\x9C" +#define ICON_FAB_MEDRT "\xEF\x8F\x88" +#define ICON_FAB_Y_COMBINATOR "\xEF\x88\xBB" +#define ICON_FAB_SCHLIX "\xEF\x8F\xAA" +#define ICON_FAB_GIT_SQUARE "\xEF\x87\x92" +#define ICON_FAB_ODNOKLASSNIKI_SQUARE "\xEF\x89\xA4" +#define ICON_FAB_SELLCAST "\xEF\x8B\x9A" +#define ICON_FAB_PAGELINES "\xEF\x86\x8C" +#define ICON_FAB_MONERO "\xEF\x8F\x90" +#define ICON_FAB_NPM "\xEF\x8F\x94" +#define ICON_FAB_KICKSTARTER "\xEF\x8E\xBB" +#define ICON_FAB_ADVERSAL "\xEF\x8D\xAA" +#define ICON_FAB_FREEBSD "\xEF\x8E\xA4" +#define ICON_FAB_CC_VISA "\xEF\x87\xB0" +#define ICON_FAB_APP_STORE_IOS "\xEF\x8D\xB0" +#define ICON_FAB_ACCESSIBLE_ICON "\xEF\x8D\xA8" +#define ICON_FAB_SPOTIFY "\xEF\x86\xBC" +#define ICON_FAB_FACEBOOK_SQUARE "\xEF\x82\x82" +#define ICON_FAB_STAYLINKED "\xEF\x8F\xB5" +#define ICON_FAB_DEVIANTART "\xEF\x86\xBD" +#define ICON_FAB_ODNOKLASSNIKI "\xEF\x89\xA3" +#define ICON_FAB_GRIPFIRE "\xEF\x8E\xAC" +#define ICON_FAB_SNAPCHAT "\xEF\x8A\xAB" +#define ICON_FAB_BLACK_TIE "\xEF\x89\xBE" +#define ICON_FAB_REDDIT_ALIEN "\xEF\x8A\x81" +#define ICON_FAB_BLUETOOTH "\xEF\x8A\x93" +#define ICON_FAB_CPANEL "\xEF\x8E\x88" +#define ICON_FAB_REV "\xEF\x96\xB2" +#define ICON_FAB_MEDAPPS "\xEF\x8F\x86" +#define ICON_FAB_GIT "\xEF\x87\x93" +#define ICON_FAB_REBEL "\xEF\x87\x90" +#define ICON_FAB_LARAVEL "\xEF\x8E\xBD" +#define ICON_FAB_CC_MASTERCARD "\xEF\x87\xB1" +#define ICON_FAB_BUYSELLADS "\xEF\x88\x8D" +#define ICON_FAB_BLOGGER "\xEF\x8D\xBC" +#define ICON_FAB_ANGULAR "\xEF\x90\xA0" +#define ICON_FAB_BEHANCE "\xEF\x86\xB4" +#define ICON_FAB_BITY "\xEF\x8D\xBA" +#define ICON_FAB_ELEMENTOR "\xEF\x90\xB0" +#define ICON_FAB_EARLYBIRDS "\xEF\x8E\x9A" +#define ICON_FAB_SHIRTSINBULK "\xEF\x88\x94" +#define ICON_FAB_OLD_REPUBLIC "\xEF\x94\x90" +#define ICON_FAB_GRUNT "\xEF\x8E\xAD" +#define ICON_FAB_SLACK "\xEF\x86\x98" +#define ICON_FAB_IMDB "\xEF\x8B\x98" +#define ICON_FAB_EXPEDITEDSSL "\xEF\x88\xBE" +#define ICON_FAB_PAGE4 "\xEF\x8F\x97" +#define ICON_FAB_CREATIVE_COMMONS_REMIX "\xEF\x93\xAE" +#define ICON_FAB_MIX "\xEF\x8F\x8B" +#define ICON_FAB_HORNBILL "\xEF\x96\x92" +#define ICON_FAB_PIED_PIPER_HAT "\xEF\x93\xA5" +#define ICON_FAB_SERVICESTACK "\xEF\x8F\xAC" +#define ICON_FAB_KEYBASE "\xEF\x93\xB5" +#define ICON_FAB_FLIPBOARD "\xEF\x91\x8D" +#define ICON_FAB_FORUMBEE "\xEF\x88\x91" +#define ICON_FAB_MEGAPORT "\xEF\x96\xA3" +#define ICON_FAB_AUTOPREFIXER "\xEF\x90\x9C" +#define ICON_FAB_JS_SQUARE "\xEF\x8E\xB9" +#define ICON_FAB_R_PROJECT "\xEF\x93\xB7" +#define ICON_FAB_XING_SQUARE "\xEF\x85\xA9" +#define ICON_FAB_ROCKETCHAT "\xEF\x8F\xA8" +#define ICON_FAB_REDDIT_SQUARE "\xEF\x86\xA2" +#define ICON_FAB_PHOENIX_FRAMEWORK "\xEF\x8F\x9C" +#define ICON_FAB_SLACK_HASH "\xEF\x8F\xAF" +#define ICON_FAB_ROCKRMS "\xEF\x8F\xA9" +#define ICON_FAB_STUMBLEUPON_CIRCLE "\xEF\x86\xA3" +#define ICON_FAB_QQ "\xEF\x87\x96" +#define ICON_FAB_KORVUE "\xEF\x90\xAF" +#define ICON_FAB_PIED_PIPER "\xEF\x8A\xAE" +#define ICON_FAB_LYFT "\xEF\x8F\x83" +#define ICON_FAB_CONTAO "\xEF\x89\xAD" +#define ICON_FAB_BTC "\xEF\x85\x9A" +#define ICON_FAB_WEIBO "\xEF\x86\x8A" +#define ICON_FAB_VIADEO_SQUARE "\xEF\x8A\xAA" +#define ICON_FAB_STUDIOVINARI "\xEF\x8F\xB8" +#define ICON_FAB_FLICKR "\xEF\x85\xAE" +#define ICON_FAB_AMILIA "\xEF\x8D\xAD" +#define ICON_FAB_CC_AMEX "\xEF\x87\xB3" +#define ICON_FAB_TRIPADVISOR "\xEF\x89\xA2" +#define ICON_FAB_RENREN "\xEF\x86\x8B" +#define ICON_FAB_JS "\xEF\x8E\xB8" +#define ICON_FAB_FORT_AWESOME "\xEF\x8A\x86" +#define ICON_FAB_CREATIVE_COMMONS_SAMPLING "\xEF\x93\xB0" +#define ICON_FAB_GOODREADS_G "\xEF\x8E\xA9" +#define ICON_FAB_GET_POCKET "\xEF\x89\xA5" +#define ICON_FAB_KICKSTARTER_K "\xEF\x8E\xBC" +#define ICON_FAB_CONNECTDEVELOP "\xEF\x88\x8E" +#define ICON_FAB_BANDCAMP "\xEF\x8B\x95" +#define ICON_FAB_OSI "\xEF\x90\x9A" +#define ICON_FAB_CREATIVE_COMMONS_ND "\xEF\x93\xAB" +#define ICON_FAB_CREATIVE_COMMONS_NC "\xEF\x93\xA8" +#define ICON_FAB_WEEBLY "\xEF\x97\x8C" +#define ICON_FAB_JEDI_ORDER "\xEF\x94\x8E" +#define ICON_FAB_VIMEO "\xEF\x90\x8A" +#define ICON_FAB_SITH "\xEF\x94\x92" +#define ICON_FAB_TRELLO "\xEF\x86\x81" +#define ICON_FAB_VK "\xEF\x86\x89" +#define ICON_FAB_LINKEDIN "\xEF\x82\x8C" +#define ICON_FAB_DESKPRO "\xEF\x8E\x8F" +#define ICON_FAB_GALACTIC_REPUBLIC "\xEF\x94\x8C" +#define ICON_FAB_OPTIN_MONSTER "\xEF\x88\xBC" +#define ICON_FAB_LINODE "\xEF\x8A\xB8" +#define ICON_FAB_WEIXIN "\xEF\x87\x97" +#define ICON_FAB_CREATIVE_COMMONS_NC_EU "\xEF\x93\xA9" +#define ICON_FAB_ANDROID "\xEF\x85\xBB" +#define ICON_FAB_FONT_AWESOME_FLAG "\xEF\x90\xA5" +#define ICON_FAB_SLIDESHARE "\xEF\x87\xA7" +#define ICON_FAB_MAILCHIMP "\xEF\x96\x9E" +#define ICON_FAB_AFFILIATETHEME "\xEF\x8D\xAB" +#define ICON_FAB_PHP "\xEF\x91\x97" +#define ICON_FAB_HACKER_NEWS "\xEF\x87\x94" +#define ICON_FAB_YOUTUBE_SQUARE "\xEF\x90\xB1" +#define ICON_FAB_SAFARI "\xEF\x89\xA7" +#define ICON_FAB_LESS "\xEF\x90\x9D" +#define ICON_FAB_MODX "\xEF\x8A\x85" +#define ICON_FAB_VIMEO_V "\xEF\x89\xBD" +#define ICON_FAB_SEARCHENGIN "\xEF\x8F\xAB" +#define ICON_FAB_CSS3 "\xEF\x84\xBC" +#define ICON_FAB_STRAVA "\xEF\x90\xA8" +#define ICON_FAB_SKYATLAS "\xEF\x88\x96" +#define ICON_FAB_TEAMSPEAK "\xEF\x93\xB9" +#define ICON_FAB_CENTERCODE "\xEF\x8E\x80" +#define ICON_FAB_GITHUB_ALT "\xEF\x84\x93" +#define ICON_FAB_LEANPUB "\xEF\x88\x92" +#define ICON_FAB_OPERA "\xEF\x89\xAA" +#define ICON_FAB_BLACKBERRY "\xEF\x8D\xBB" +#define ICON_FAB_BLUETOOTH_B "\xEF\x8A\x94" +#define ICON_FAB_AUDIBLE "\xEF\x8D\xB3" +#define ICON_FAB_GITLAB "\xEF\x8A\x96" +#define ICON_FAB_TWITTER "\xEF\x82\x99" +#define ICON_FAB_LINUX "\xEF\x85\xBC" +#define ICON_FAB_ENVIRA "\xEF\x8A\x99" +#define ICON_FAB_LASTFM_SQUARE "\xEF\x88\x83" +#define ICON_FAB_PIED_PIPER_ALT "\xEF\x86\xA8" +#define ICON_FAB_KEYCDN "\xEF\x8E\xBA" +#define ICON_FAB_DOCHUB "\xEF\x8E\x94" +#define ICON_FAB_CSS3_ALT "\xEF\x8E\x8B" +#define ICON_FAB_TUMBLR_SQUARE "\xEF\x85\xB4" +#define ICON_FAB_GRAV "\xEF\x8B\x96" +#define ICON_FAB_VIMEO_SQUARE "\xEF\x86\x94" +#define ICON_FAB_CHROME "\xEF\x89\xA8" +#define ICON_FAB_ETHEREUM "\xEF\x90\xAE" +#define ICON_FAB_PHABRICATOR "\xEF\x8F\x9B" +#define ICON_FAB_CC_AMAZON_PAY "\xEF\x90\xAD" +#define ICON_FAB_NAPSTER "\xEF\x8F\x92" +#define ICON_FAB_SASS "\xEF\x90\x9E" +#define ICON_FAB_EMBER "\xEF\x90\xA3" +#define ICON_FAB_RESOLVING "\xEF\x8F\xA7" +#define ICON_FAB_FREE_CODE_CAMP "\xEF\x8B\x85" +#define ICON_FAB_RESEARCHGATE "\xEF\x93\xB8" +#define ICON_FAB_CC_PAYPAL "\xEF\x87\xB4" +#define ICON_FAB_MEDIUM_M "\xEF\x8F\x87" +#define ICON_FAB_CLOUDSCALE "\xEF\x8E\x83" +#define ICON_FAB_GOOGLE_WALLET "\xEF\x87\xAE" +#define ICON_FAB_CLOUDVERSIFY "\xEF\x8E\x85" +#define ICON_FAB_OPENID "\xEF\x86\x9B" +#define ICON_FAB_UNIREGISTRY "\xEF\x90\x84" +#define ICON_FAB_DROPBOX "\xEF\x85\xAB" +#define ICON_FAB_CREATIVE_COMMONS_NC_JP "\xEF\x93\xAA" +#define ICON_FAB_YELP "\xEF\x87\xA9" +#define ICON_FAB_VUEJS "\xEF\x90\x9F" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_fork_awesome.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_fork_awesome.h new file mode 100644 index 00000000000..95c7c4808cc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_fork_awesome.h @@ -0,0 +1,727 @@ +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/ForkAwesome/Fork-Awesome/master/src/icons/icons.yml +// for use with https://github.com/ForkAwesome/Fork-Awesome/blob/master/fonts/forkawesome-webfont.ttf +#pragma once + +#define FONT_ICON_FILE_NAME_FA "fontawesome-webfont.ttf" + +#define ICON_MIN_FK 0xf000 +#define ICON_MAX_FK 0xf310 +#define ICON_FK_GLASS "\xEF\x80\x80" +#define ICON_FK_MUSIC "\xEF\x80\x81" +#define ICON_FK_SEARCH "\xEF\x80\x82" +#define ICON_FK_ENVELOPE_O "\xEF\x80\x83" +#define ICON_FK_HEART "\xEF\x80\x84" +#define ICON_FK_STAR "\xEF\x80\x85" +#define ICON_FK_STAR_O "\xEF\x80\x86" +#define ICON_FK_USER "\xEF\x80\x87" +#define ICON_FK_FILM "\xEF\x80\x88" +#define ICON_FK_TH_LARGE "\xEF\x80\x89" +#define ICON_FK_TH "\xEF\x80\x8A" +#define ICON_FK_TH_LIST "\xEF\x80\x8B" +#define ICON_FK_CHECK "\xEF\x80\x8C" +#define ICON_FK_TIMES "\xEF\x80\x8D" +#define ICON_FK_SEARCH_PLUS "\xEF\x80\x8E" +#define ICON_FK_SEARCH_MINUS "\xEF\x80\x90" +#define ICON_FK_POWER_OFF "\xEF\x80\x91" +#define ICON_FK_SIGNAL "\xEF\x80\x92" +#define ICON_FK_COG "\xEF\x80\x93" +#define ICON_FK_TRASH_O "\xEF\x80\x94" +#define ICON_FK_HOME "\xEF\x80\x95" +#define ICON_FK_FILE_O "\xEF\x80\x96" +#define ICON_FK_CLOCK_O "\xEF\x80\x97" +#define ICON_FK_ROAD "\xEF\x80\x98" +#define ICON_FK_DOWNLOAD "\xEF\x80\x99" +#define ICON_FK_ARROW_CIRCLE_O_DOWN "\xEF\x80\x9A" +#define ICON_FK_ARROW_CIRCLE_O_UP "\xEF\x80\x9B" +#define ICON_FK_INBOX "\xEF\x80\x9C" +#define ICON_FK_PLAY_CIRCLE_O "\xEF\x80\x9D" +#define ICON_FK_REPEAT "\xEF\x80\x9E" +#define ICON_FK_REFRESH "\xEF\x80\xA1" +#define ICON_FK_LIST_ALT "\xEF\x80\xA2" +#define ICON_FK_LOCK "\xEF\x80\xA3" +#define ICON_FK_FLAG "\xEF\x80\xA4" +#define ICON_FK_HEADPHONES "\xEF\x80\xA5" +#define ICON_FK_VOLUME_OFF "\xEF\x80\xA6" +#define ICON_FK_VOLUME_DOWN "\xEF\x80\xA7" +#define ICON_FK_VOLUME_UP "\xEF\x80\xA8" +#define ICON_FK_QRCODE "\xEF\x80\xA9" +#define ICON_FK_BARCODE "\xEF\x80\xAA" +#define ICON_FK_TAG "\xEF\x80\xAB" +#define ICON_FK_TAGS "\xEF\x80\xAC" +#define ICON_FK_BOOK "\xEF\x80\xAD" +#define ICON_FK_BOOKMARK "\xEF\x80\xAE" +#define ICON_FK_PRINT "\xEF\x80\xAF" +#define ICON_FK_CAMERA "\xEF\x80\xB0" +#define ICON_FK_FONT "\xEF\x80\xB1" +#define ICON_FK_BOLD "\xEF\x80\xB2" +#define ICON_FK_ITALIC "\xEF\x80\xB3" +#define ICON_FK_TEXT_HEIGHT "\xEF\x80\xB4" +#define ICON_FK_TEXT_WIDTH "\xEF\x80\xB5" +#define ICON_FK_ALIGN_LEFT "\xEF\x80\xB6" +#define ICON_FK_ALIGN_CENTER "\xEF\x80\xB7" +#define ICON_FK_ALIGN_RIGHT "\xEF\x80\xB8" +#define ICON_FK_ALIGN_JUSTIFY "\xEF\x80\xB9" +#define ICON_FK_LIST "\xEF\x80\xBA" +#define ICON_FK_OUTDENT "\xEF\x80\xBB" +#define ICON_FK_INDENT "\xEF\x80\xBC" +#define ICON_FK_VIDEO_CAMERA "\xEF\x80\xBD" +#define ICON_FK_PICTURE_O "\xEF\x80\xBE" +#define ICON_FK_PENCIL "\xEF\x81\x80" +#define ICON_FK_MAP_MARKER "\xEF\x81\x81" +#define ICON_FK_ADJUST "\xEF\x81\x82" +#define ICON_FK_TINT "\xEF\x81\x83" +#define ICON_FK_PENCIL_SQUARE_O "\xEF\x81\x84" +#define ICON_FK_SHARE_SQUARE_O "\xEF\x81\x85" +#define ICON_FK_CHECK_SQUARE_O "\xEF\x81\x86" +#define ICON_FK_ARROWS "\xEF\x81\x87" +#define ICON_FK_STEP_BACKWARD "\xEF\x81\x88" +#define ICON_FK_FAST_BACKWARD "\xEF\x81\x89" +#define ICON_FK_BACKWARD "\xEF\x81\x8A" +#define ICON_FK_PLAY "\xEF\x81\x8B" +#define ICON_FK_PAUSE "\xEF\x81\x8C" +#define ICON_FK_STOP "\xEF\x81\x8D" +#define ICON_FK_FORWARD "\xEF\x81\x8E" +#define ICON_FK_FAST_FORWARD "\xEF\x81\x90" +#define ICON_FK_STEP_FORWARD "\xEF\x81\x91" +#define ICON_FK_EJECT "\xEF\x81\x92" +#define ICON_FK_CHEVRON_LEFT "\xEF\x81\x93" +#define ICON_FK_CHEVRON_RIGHT "\xEF\x81\x94" +#define ICON_FK_PLUS_CIRCLE "\xEF\x81\x95" +#define ICON_FK_MINUS_CIRCLE "\xEF\x81\x96" +#define ICON_FK_TIMES_CIRCLE "\xEF\x81\x97" +#define ICON_FK_CHECK_CIRCLE "\xEF\x81\x98" +#define ICON_FK_QUESTION_CIRCLE "\xEF\x81\x99" +#define ICON_FK_INFO_CIRCLE "\xEF\x81\x9A" +#define ICON_FK_CROSSHAIRS "\xEF\x81\x9B" +#define ICON_FK_TIMES_CIRCLE_O "\xEF\x81\x9C" +#define ICON_FK_CHECK_CIRCLE_O "\xEF\x81\x9D" +#define ICON_FK_BAN "\xEF\x81\x9E" +#define ICON_FK_ARROW_LEFT "\xEF\x81\xA0" +#define ICON_FK_ARROW_RIGHT "\xEF\x81\xA1" +#define ICON_FK_ARROW_UP "\xEF\x81\xA2" +#define ICON_FK_ARROW_DOWN "\xEF\x81\xA3" +#define ICON_FK_SHARE "\xEF\x81\xA4" +#define ICON_FK_EXPAND "\xEF\x81\xA5" +#define ICON_FK_COMPRESS "\xEF\x81\xA6" +#define ICON_FK_PLUS "\xEF\x81\xA7" +#define ICON_FK_MINUS "\xEF\x81\xA8" +#define ICON_FK_ASTERISK "\xEF\x81\xA9" +#define ICON_FK_EXCLAMATION_CIRCLE "\xEF\x81\xAA" +#define ICON_FK_GIFT "\xEF\x81\xAB" +#define ICON_FK_LEAF "\xEF\x81\xAC" +#define ICON_FK_FIRE "\xEF\x81\xAD" +#define ICON_FK_EYE "\xEF\x81\xAE" +#define ICON_FK_EYE_SLASH "\xEF\x81\xB0" +#define ICON_FK_EXCLAMATION_TRIANGLE "\xEF\x81\xB1" +#define ICON_FK_PLANE "\xEF\x81\xB2" +#define ICON_FK_CALENDAR "\xEF\x81\xB3" +#define ICON_FK_RANDOM "\xEF\x81\xB4" +#define ICON_FK_COMMENT "\xEF\x81\xB5" +#define ICON_FK_MAGNET "\xEF\x81\xB6" +#define ICON_FK_CHEVRON_UP "\xEF\x81\xB7" +#define ICON_FK_CHEVRON_DOWN "\xEF\x81\xB8" +#define ICON_FK_RETWEET "\xEF\x81\xB9" +#define ICON_FK_SHOPPING_CART "\xEF\x81\xBA" +#define ICON_FK_FOLDER "\xEF\x81\xBB" +#define ICON_FK_FOLDER_OPEN "\xEF\x81\xBC" +#define ICON_FK_ARROWS_V "\xEF\x81\xBD" +#define ICON_FK_ARROWS_H "\xEF\x81\xBE" +#define ICON_FK_BAR_CHART "\xEF\x82\x80" +#define ICON_FK_TWITTER_SQUARE "\xEF\x82\x81" +#define ICON_FK_FACEBOOK_SQUARE "\xEF\x82\x82" +#define ICON_FK_CAMERA_RETRO "\xEF\x82\x83" +#define ICON_FK_KEY "\xEF\x82\x84" +#define ICON_FK_COGS "\xEF\x82\x85" +#define ICON_FK_COMMENTS "\xEF\x82\x86" +#define ICON_FK_THUMBS_O_UP "\xEF\x82\x87" +#define ICON_FK_THUMBS_O_DOWN "\xEF\x82\x88" +#define ICON_FK_STAR_HALF "\xEF\x82\x89" +#define ICON_FK_HEART_O "\xEF\x82\x8A" +#define ICON_FK_SIGN_OUT "\xEF\x82\x8B" +#define ICON_FK_LINKEDIN_SQUARE "\xEF\x82\x8C" +#define ICON_FK_THUMB_TACK "\xEF\x82\x8D" +#define ICON_FK_EXTERNAL_LINK "\xEF\x82\x8E" +#define ICON_FK_SIGN_IN "\xEF\x82\x90" +#define ICON_FK_TROPHY "\xEF\x82\x91" +#define ICON_FK_GITHUB_SQUARE "\xEF\x82\x92" +#define ICON_FK_UPLOAD "\xEF\x82\x93" +#define ICON_FK_LEMON_O "\xEF\x82\x94" +#define ICON_FK_PHONE "\xEF\x82\x95" +#define ICON_FK_SQUARE_O "\xEF\x82\x96" +#define ICON_FK_BOOKMARK_O "\xEF\x82\x97" +#define ICON_FK_PHONE_SQUARE "\xEF\x82\x98" +#define ICON_FK_TWITTER "\xEF\x82\x99" +#define ICON_FK_FACEBOOK "\xEF\x82\x9A" +#define ICON_FK_GITHUB "\xEF\x82\x9B" +#define ICON_FK_UNLOCK "\xEF\x82\x9C" +#define ICON_FK_CREDIT_CARD "\xEF\x82\x9D" +#define ICON_FK_RSS "\xEF\x82\x9E" +#define ICON_FK_HDD_O "\xEF\x82\xA0" +#define ICON_FK_BULLHORN "\xEF\x82\xA1" +#define ICON_FK_BELL "\xEF\x83\xB3" +#define ICON_FK_CERTIFICATE "\xEF\x82\xA3" +#define ICON_FK_HAND_O_RIGHT "\xEF\x82\xA4" +#define ICON_FK_HAND_O_LEFT "\xEF\x82\xA5" +#define ICON_FK_HAND_O_UP "\xEF\x82\xA6" +#define ICON_FK_HAND_O_DOWN "\xEF\x82\xA7" +#define ICON_FK_ARROW_CIRCLE_LEFT "\xEF\x82\xA8" +#define ICON_FK_ARROW_CIRCLE_RIGHT "\xEF\x82\xA9" +#define ICON_FK_ARROW_CIRCLE_UP "\xEF\x82\xAA" +#define ICON_FK_ARROW_CIRCLE_DOWN "\xEF\x82\xAB" +#define ICON_FK_GLOBE "\xEF\x82\xAC" +#define ICON_FK_GLOBE_E "\xEF\x8C\x84" +#define ICON_FK_GLOBE_W "\xEF\x8C\x85" +#define ICON_FK_WRENCH "\xEF\x82\xAD" +#define ICON_FK_TASKS "\xEF\x82\xAE" +#define ICON_FK_FILTER "\xEF\x82\xB0" +#define ICON_FK_BRIEFCASE "\xEF\x82\xB1" +#define ICON_FK_ARROWS_ALT "\xEF\x82\xB2" +#define ICON_FK_USERS "\xEF\x83\x80" +#define ICON_FK_LINK "\xEF\x83\x81" +#define ICON_FK_CLOUD "\xEF\x83\x82" +#define ICON_FK_FLASK "\xEF\x83\x83" +#define ICON_FK_SCISSORS "\xEF\x83\x84" +#define ICON_FK_FILES_O "\xEF\x83\x85" +#define ICON_FK_PAPERCLIP "\xEF\x83\x86" +#define ICON_FK_FLOPPY_O "\xEF\x83\x87" +#define ICON_FK_SQUARE "\xEF\x83\x88" +#define ICON_FK_BARS "\xEF\x83\x89" +#define ICON_FK_LIST_UL "\xEF\x83\x8A" +#define ICON_FK_LIST_OL "\xEF\x83\x8B" +#define ICON_FK_STRIKETHROUGH "\xEF\x83\x8C" +#define ICON_FK_UNDERLINE "\xEF\x83\x8D" +#define ICON_FK_TABLE "\xEF\x83\x8E" +#define ICON_FK_MAGIC "\xEF\x83\x90" +#define ICON_FK_TRUCK "\xEF\x83\x91" +#define ICON_FK_PINTEREST "\xEF\x83\x92" +#define ICON_FK_PINTEREST_SQUARE "\xEF\x83\x93" +#define ICON_FK_GOOGLE_PLUS_SQUARE "\xEF\x83\x94" +#define ICON_FK_GOOGLE_PLUS "\xEF\x83\x95" +#define ICON_FK_MONEY "\xEF\x83\x96" +#define ICON_FK_CARET_DOWN "\xEF\x83\x97" +#define ICON_FK_CARET_UP "\xEF\x83\x98" +#define ICON_FK_CARET_LEFT "\xEF\x83\x99" +#define ICON_FK_CARET_RIGHT "\xEF\x83\x9A" +#define ICON_FK_COLUMNS "\xEF\x83\x9B" +#define ICON_FK_SORT "\xEF\x83\x9C" +#define ICON_FK_SORT_DESC "\xEF\x83\x9D" +#define ICON_FK_SORT_ASC "\xEF\x83\x9E" +#define ICON_FK_ENVELOPE "\xEF\x83\xA0" +#define ICON_FK_LINKEDIN "\xEF\x83\xA1" +#define ICON_FK_UNDO "\xEF\x83\xA2" +#define ICON_FK_GAVEL "\xEF\x83\xA3" +#define ICON_FK_TACHOMETER "\xEF\x83\xA4" +#define ICON_FK_COMMENT_O "\xEF\x83\xA5" +#define ICON_FK_COMMENTS_O "\xEF\x83\xA6" +#define ICON_FK_BOLT "\xEF\x83\xA7" +#define ICON_FK_SITEMAP "\xEF\x83\xA8" +#define ICON_FK_UMBRELLA "\xEF\x83\xA9" +#define ICON_FK_CLIPBOARD "\xEF\x83\xAA" +#define ICON_FK_LIGHTBULB_O "\xEF\x83\xAB" +#define ICON_FK_EXCHANGE "\xEF\x83\xAC" +#define ICON_FK_CLOUD_DOWNLOAD "\xEF\x83\xAD" +#define ICON_FK_CLOUD_UPLOAD "\xEF\x83\xAE" +#define ICON_FK_USER_MD "\xEF\x83\xB0" +#define ICON_FK_STETHOSCOPE "\xEF\x83\xB1" +#define ICON_FK_SUITCASE "\xEF\x83\xB2" +#define ICON_FK_BELL_O "\xEF\x82\xA2" +#define ICON_FK_COFFEE "\xEF\x83\xB4" +#define ICON_FK_CUTLERY "\xEF\x83\xB5" +#define ICON_FK_FILE_TEXT_O "\xEF\x83\xB6" +#define ICON_FK_BUILDING_O "\xEF\x83\xB7" +#define ICON_FK_HOSPITAL_O "\xEF\x83\xB8" +#define ICON_FK_AMBULANCE "\xEF\x83\xB9" +#define ICON_FK_MEDKIT "\xEF\x83\xBA" +#define ICON_FK_FIGHTER_JET "\xEF\x83\xBB" +#define ICON_FK_BEER "\xEF\x83\xBC" +#define ICON_FK_H_SQUARE "\xEF\x83\xBD" +#define ICON_FK_PLUS_SQUARE "\xEF\x83\xBE" +#define ICON_FK_ANGLE_DOUBLE_LEFT "\xEF\x84\x80" +#define ICON_FK_ANGLE_DOUBLE_RIGHT "\xEF\x84\x81" +#define ICON_FK_ANGLE_DOUBLE_UP "\xEF\x84\x82" +#define ICON_FK_ANGLE_DOUBLE_DOWN "\xEF\x84\x83" +#define ICON_FK_ANGLE_LEFT "\xEF\x84\x84" +#define ICON_FK_ANGLE_RIGHT "\xEF\x84\x85" +#define ICON_FK_ANGLE_UP "\xEF\x84\x86" +#define ICON_FK_ANGLE_DOWN "\xEF\x84\x87" +#define ICON_FK_DESKTOP "\xEF\x84\x88" +#define ICON_FK_LAPTOP "\xEF\x84\x89" +#define ICON_FK_TABLET "\xEF\x84\x8A" +#define ICON_FK_MOBILE "\xEF\x84\x8B" +#define ICON_FK_CIRCLE_O "\xEF\x84\x8C" +#define ICON_FK_QUOTE_LEFT "\xEF\x84\x8D" +#define ICON_FK_QUOTE_RIGHT "\xEF\x84\x8E" +#define ICON_FK_SPINNER "\xEF\x84\x90" +#define ICON_FK_CIRCLE "\xEF\x84\x91" +#define ICON_FK_REPLY "\xEF\x84\x92" +#define ICON_FK_GITHUB_ALT "\xEF\x84\x93" +#define ICON_FK_FOLDER_O "\xEF\x84\x94" +#define ICON_FK_FOLDER_OPEN_O "\xEF\x84\x95" +#define ICON_FK_SMILE_O "\xEF\x84\x98" +#define ICON_FK_FROWN_O "\xEF\x84\x99" +#define ICON_FK_MEH_O "\xEF\x84\x9A" +#define ICON_FK_GAMEPAD "\xEF\x84\x9B" +#define ICON_FK_KEYBOARD_O "\xEF\x84\x9C" +#define ICON_FK_FLAG_O "\xEF\x84\x9D" +#define ICON_FK_FLAG_CHECKERED "\xEF\x84\x9E" +#define ICON_FK_TERMINAL "\xEF\x84\xA0" +#define ICON_FK_CODE "\xEF\x84\xA1" +#define ICON_FK_REPLY_ALL "\xEF\x84\xA2" +#define ICON_FK_STAR_HALF_O "\xEF\x84\xA3" +#define ICON_FK_LOCATION_ARROW "\xEF\x84\xA4" +#define ICON_FK_CROP "\xEF\x84\xA5" +#define ICON_FK_CODE_FORK "\xEF\x84\xA6" +#define ICON_FK_CHAIN_BROKEN "\xEF\x84\xA7" +#define ICON_FK_QUESTION "\xEF\x84\xA8" +#define ICON_FK_INFO "\xEF\x84\xA9" +#define ICON_FK_EXCLAMATION "\xEF\x84\xAA" +#define ICON_FK_SUPERSCRIPT "\xEF\x84\xAB" +#define ICON_FK_SUBSCRIPT "\xEF\x84\xAC" +#define ICON_FK_ERASER "\xEF\x84\xAD" +#define ICON_FK_PUZZLE_PIECE "\xEF\x84\xAE" +#define ICON_FK_MICROPHONE "\xEF\x84\xB0" +#define ICON_FK_MICROPHONE_SLASH "\xEF\x84\xB1" +#define ICON_FK_SHIELD "\xEF\x84\xB2" +#define ICON_FK_CALENDAR_O "\xEF\x84\xB3" +#define ICON_FK_FIRE_EXTINGUISHER "\xEF\x84\xB4" +#define ICON_FK_ROCKET "\xEF\x84\xB5" +#define ICON_FK_MAXCDN "\xEF\x84\xB6" +#define ICON_FK_CHEVRON_CIRCLE_LEFT "\xEF\x84\xB7" +#define ICON_FK_CHEVRON_CIRCLE_RIGHT "\xEF\x84\xB8" +#define ICON_FK_CHEVRON_CIRCLE_UP "\xEF\x84\xB9" +#define ICON_FK_CHEVRON_CIRCLE_DOWN "\xEF\x84\xBA" +#define ICON_FK_HTML5 "\xEF\x84\xBB" +#define ICON_FK_CSS3 "\xEF\x84\xBC" +#define ICON_FK_ANCHOR "\xEF\x84\xBD" +#define ICON_FK_UNLOCK_ALT "\xEF\x84\xBE" +#define ICON_FK_BULLSEYE "\xEF\x85\x80" +#define ICON_FK_ELLIPSIS_H "\xEF\x85\x81" +#define ICON_FK_ELLIPSIS_V "\xEF\x85\x82" +#define ICON_FK_RSS_SQUARE "\xEF\x85\x83" +#define ICON_FK_PLAY_CIRCLE "\xEF\x85\x84" +#define ICON_FK_TICKET "\xEF\x85\x85" +#define ICON_FK_MINUS_SQUARE "\xEF\x85\x86" +#define ICON_FK_MINUS_SQUARE_O "\xEF\x85\x87" +#define ICON_FK_LEVEL_UP "\xEF\x85\x88" +#define ICON_FK_LEVEL_DOWN "\xEF\x85\x89" +#define ICON_FK_CHECK_SQUARE "\xEF\x85\x8A" +#define ICON_FK_PENCIL_SQUARE "\xEF\x85\x8B" +#define ICON_FK_EXTERNAL_LINK_SQUARE "\xEF\x85\x8C" +#define ICON_FK_SHARE_SQUARE "\xEF\x85\x8D" +#define ICON_FK_COMPASS "\xEF\x85\x8E" +#define ICON_FK_CARET_SQUARE_O_DOWN "\xEF\x85\x90" +#define ICON_FK_CARET_SQUARE_O_UP "\xEF\x85\x91" +#define ICON_FK_CARET_SQUARE_O_RIGHT "\xEF\x85\x92" +#define ICON_FK_EUR "\xEF\x85\x93" +#define ICON_FK_GBP "\xEF\x85\x94" +#define ICON_FK_USD "\xEF\x85\x95" +#define ICON_FK_INR "\xEF\x85\x96" +#define ICON_FK_JPY "\xEF\x85\x97" +#define ICON_FK_RUB "\xEF\x85\x98" +#define ICON_FK_KRW "\xEF\x85\x99" +#define ICON_FK_BTC "\xEF\x85\x9A" +#define ICON_FK_FILE "\xEF\x85\x9B" +#define ICON_FK_FILE_TEXT "\xEF\x85\x9C" +#define ICON_FK_SORT_ALPHA_ASC "\xEF\x85\x9D" +#define ICON_FK_SORT_ALPHA_DESC "\xEF\x85\x9E" +#define ICON_FK_SORT_AMOUNT_ASC "\xEF\x85\xA0" +#define ICON_FK_SORT_AMOUNT_DESC "\xEF\x85\xA1" +#define ICON_FK_SORT_NUMERIC_ASC "\xEF\x85\xA2" +#define ICON_FK_SORT_NUMERIC_DESC "\xEF\x85\xA3" +#define ICON_FK_THUMBS_UP "\xEF\x85\xA4" +#define ICON_FK_THUMBS_DOWN "\xEF\x85\xA5" +#define ICON_FK_YOUTUBE_SQUARE "\xEF\x85\xA6" +#define ICON_FK_YOUTUBE "\xEF\x85\xA7" +#define ICON_FK_XING "\xEF\x85\xA8" +#define ICON_FK_XING_SQUARE "\xEF\x85\xA9" +#define ICON_FK_YOUTUBE_PLAY "\xEF\x85\xAA" +#define ICON_FK_DROPBOX "\xEF\x85\xAB" +#define ICON_FK_STACK_OVERFLOW "\xEF\x85\xAC" +#define ICON_FK_INSTAGRAM "\xEF\x85\xAD" +#define ICON_FK_FLICKR "\xEF\x85\xAE" +#define ICON_FK_ADN "\xEF\x85\xB0" +#define ICON_FK_BITBUCKET "\xEF\x85\xB1" +#define ICON_FK_BITBUCKET_SQUARE "\xEF\x85\xB2" +#define ICON_FK_TUMBLR "\xEF\x85\xB3" +#define ICON_FK_TUMBLR_SQUARE "\xEF\x85\xB4" +#define ICON_FK_LONG_ARROW_DOWN "\xEF\x85\xB5" +#define ICON_FK_LONG_ARROW_UP "\xEF\x85\xB6" +#define ICON_FK_LONG_ARROW_LEFT "\xEF\x85\xB7" +#define ICON_FK_LONG_ARROW_RIGHT "\xEF\x85\xB8" +#define ICON_FK_APPLE "\xEF\x85\xB9" +#define ICON_FK_WINDOWS "\xEF\x85\xBA" +#define ICON_FK_ANDROID "\xEF\x85\xBB" +#define ICON_FK_LINUX "\xEF\x85\xBC" +#define ICON_FK_DRIBBBLE "\xEF\x85\xBD" +#define ICON_FK_SKYPE "\xEF\x85\xBE" +#define ICON_FK_FOURSQUARE "\xEF\x86\x80" +#define ICON_FK_TRELLO "\xEF\x86\x81" +#define ICON_FK_FEMALE "\xEF\x86\x82" +#define ICON_FK_MALE "\xEF\x86\x83" +#define ICON_FK_GRATIPAY "\xEF\x86\x84" +#define ICON_FK_SUN_O "\xEF\x86\x85" +#define ICON_FK_MOON_O "\xEF\x86\x86" +#define ICON_FK_ARCHIVE "\xEF\x86\x87" +#define ICON_FK_BUG "\xEF\x86\x88" +#define ICON_FK_VK "\xEF\x86\x89" +#define ICON_FK_WEIBO "\xEF\x86\x8A" +#define ICON_FK_RENREN "\xEF\x86\x8B" +#define ICON_FK_PAGELINES "\xEF\x86\x8C" +#define ICON_FK_STACK_EXCHANGE "\xEF\x86\x8D" +#define ICON_FK_ARROW_CIRCLE_O_RIGHT "\xEF\x86\x8E" +#define ICON_FK_ARROW_CIRCLE_O_LEFT "\xEF\x86\x90" +#define ICON_FK_CARET_SQUARE_O_LEFT "\xEF\x86\x91" +#define ICON_FK_DOT_CIRCLE_O "\xEF\x86\x92" +#define ICON_FK_WHEELCHAIR "\xEF\x86\x93" +#define ICON_FK_VIMEO_SQUARE "\xEF\x86\x94" +#define ICON_FK_TRY "\xEF\x86\x95" +#define ICON_FK_PLUS_SQUARE_O "\xEF\x86\x96" +#define ICON_FK_SPACE_SHUTTLE "\xEF\x86\x97" +#define ICON_FK_SLACK "\xEF\x86\x98" +#define ICON_FK_ENVELOPE_SQUARE "\xEF\x86\x99" +#define ICON_FK_WORDPRESS "\xEF\x86\x9A" +#define ICON_FK_OPENID "\xEF\x86\x9B" +#define ICON_FK_UNIVERSITY "\xEF\x86\x9C" +#define ICON_FK_GRADUATION_CAP "\xEF\x86\x9D" +#define ICON_FK_YAHOO "\xEF\x86\x9E" +#define ICON_FK_GOOGLE "\xEF\x86\xA0" +#define ICON_FK_REDDIT "\xEF\x86\xA1" +#define ICON_FK_REDDIT_SQUARE "\xEF\x86\xA2" +#define ICON_FK_STUMBLEUPON_CIRCLE "\xEF\x86\xA3" +#define ICON_FK_STUMBLEUPON "\xEF\x86\xA4" +#define ICON_FK_DELICIOUS "\xEF\x86\xA5" +#define ICON_FK_DIGG "\xEF\x86\xA6" +#define ICON_FK_DRUPAL "\xEF\x86\xA9" +#define ICON_FK_JOOMLA "\xEF\x86\xAA" +#define ICON_FK_LANGUAGE "\xEF\x86\xAB" +#define ICON_FK_FAX "\xEF\x86\xAC" +#define ICON_FK_BUILDING "\xEF\x86\xAD" +#define ICON_FK_CHILD "\xEF\x86\xAE" +#define ICON_FK_PAW "\xEF\x86\xB0" +#define ICON_FK_SPOON "\xEF\x86\xB1" +#define ICON_FK_CUBE "\xEF\x86\xB2" +#define ICON_FK_CUBES "\xEF\x86\xB3" +#define ICON_FK_BEHANCE "\xEF\x86\xB4" +#define ICON_FK_BEHANCE_SQUARE "\xEF\x86\xB5" +#define ICON_FK_STEAM "\xEF\x86\xB6" +#define ICON_FK_STEAM_SQUARE "\xEF\x86\xB7" +#define ICON_FK_RECYCLE "\xEF\x86\xB8" +#define ICON_FK_CAR "\xEF\x86\xB9" +#define ICON_FK_TAXI "\xEF\x86\xBA" +#define ICON_FK_TREE "\xEF\x86\xBB" +#define ICON_FK_SPOTIFY "\xEF\x86\xBC" +#define ICON_FK_DEVIANTART "\xEF\x86\xBD" +#define ICON_FK_SOUNDCLOUD "\xEF\x86\xBE" +#define ICON_FK_DATABASE "\xEF\x87\x80" +#define ICON_FK_FILE_PDF_O "\xEF\x87\x81" +#define ICON_FK_FILE_WORD_O "\xEF\x87\x82" +#define ICON_FK_FILE_EXCEL_O "\xEF\x87\x83" +#define ICON_FK_FILE_POWERPOINT_O "\xEF\x87\x84" +#define ICON_FK_FILE_IMAGE_O "\xEF\x87\x85" +#define ICON_FK_FILE_ARCHIVE_O "\xEF\x87\x86" +#define ICON_FK_FILE_AUDIO_O "\xEF\x87\x87" +#define ICON_FK_FILE_VIDEO_O "\xEF\x87\x88" +#define ICON_FK_FILE_CODE_O "\xEF\x87\x89" +#define ICON_FK_VINE "\xEF\x87\x8A" +#define ICON_FK_CODEPEN "\xEF\x87\x8B" +#define ICON_FK_JSFIDDLE "\xEF\x87\x8C" +#define ICON_FK_LIFE_RING "\xEF\x87\x8D" +#define ICON_FK_CIRCLE_O_NOTCH "\xEF\x87\x8E" +#define ICON_FK_REBEL "\xEF\x87\x90" +#define ICON_FK_EMPIRE "\xEF\x87\x91" +#define ICON_FK_GIT_SQUARE "\xEF\x87\x92" +#define ICON_FK_GIT "\xEF\x87\x93" +#define ICON_FK_HACKER_NEWS "\xEF\x87\x94" +#define ICON_FK_TENCENT_WEIBO "\xEF\x87\x95" +#define ICON_FK_QQ "\xEF\x87\x96" +#define ICON_FK_WEIXIN "\xEF\x87\x97" +#define ICON_FK_PAPER_PLANE "\xEF\x87\x98" +#define ICON_FK_PAPER_PLANE_O "\xEF\x87\x99" +#define ICON_FK_HISTORY "\xEF\x87\x9A" +#define ICON_FK_CIRCLE_THIN "\xEF\x87\x9B" +#define ICON_FK_HEADER "\xEF\x87\x9C" +#define ICON_FK_PARAGRAPH "\xEF\x87\x9D" +#define ICON_FK_SLIDERS "\xEF\x87\x9E" +#define ICON_FK_SHARE_ALT "\xEF\x87\xA0" +#define ICON_FK_SHARE_ALT_SQUARE "\xEF\x87\xA1" +#define ICON_FK_BOMB "\xEF\x87\xA2" +#define ICON_FK_FUTBOL_O "\xEF\x87\xA3" +#define ICON_FK_TTY "\xEF\x87\xA4" +#define ICON_FK_BINOCULARS "\xEF\x87\xA5" +#define ICON_FK_PLUG "\xEF\x87\xA6" +#define ICON_FK_SLIDESHARE "\xEF\x87\xA7" +#define ICON_FK_TWITCH "\xEF\x87\xA8" +#define ICON_FK_YELP "\xEF\x87\xA9" +#define ICON_FK_NEWSPAPER_O "\xEF\x87\xAA" +#define ICON_FK_WIFI "\xEF\x87\xAB" +#define ICON_FK_CALCULATOR "\xEF\x87\xAC" +#define ICON_FK_PAYPAL "\xEF\x87\xAD" +#define ICON_FK_GOOGLE_WALLET "\xEF\x87\xAE" +#define ICON_FK_CC_VISA "\xEF\x87\xB0" +#define ICON_FK_CC_MASTERCARD "\xEF\x87\xB1" +#define ICON_FK_CC_DISCOVER "\xEF\x87\xB2" +#define ICON_FK_CC_AMEX "\xEF\x87\xB3" +#define ICON_FK_CC_PAYPAL "\xEF\x87\xB4" +#define ICON_FK_CC_STRIPE "\xEF\x87\xB5" +#define ICON_FK_BELL_SLASH "\xEF\x87\xB6" +#define ICON_FK_BELL_SLASH_O "\xEF\x87\xB7" +#define ICON_FK_TRASH "\xEF\x87\xB8" +#define ICON_FK_COPYRIGHT "\xEF\x87\xB9" +#define ICON_FK_AT "\xEF\x87\xBA" +#define ICON_FK_EYEDROPPER "\xEF\x87\xBB" +#define ICON_FK_PAINT_BRUSH "\xEF\x87\xBC" +#define ICON_FK_BIRTHDAY_CAKE "\xEF\x87\xBD" +#define ICON_FK_AREA_CHART "\xEF\x87\xBE" +#define ICON_FK_PIE_CHART "\xEF\x88\x80" +#define ICON_FK_LINE_CHART "\xEF\x88\x81" +#define ICON_FK_LASTFM "\xEF\x88\x82" +#define ICON_FK_LASTFM_SQUARE "\xEF\x88\x83" +#define ICON_FK_TOGGLE_OFF "\xEF\x88\x84" +#define ICON_FK_TOGGLE_ON "\xEF\x88\x85" +#define ICON_FK_BICYCLE "\xEF\x88\x86" +#define ICON_FK_BUS "\xEF\x88\x87" +#define ICON_FK_IOXHOST "\xEF\x88\x88" +#define ICON_FK_ANGELLIST "\xEF\x88\x89" +#define ICON_FK_CC "\xEF\x88\x8A" +#define ICON_FK_ILS "\xEF\x88\x8B" +#define ICON_FK_MEANPATH "\xEF\x88\x8C" +#define ICON_FK_BUYSELLADS "\xEF\x88\x8D" +#define ICON_FK_CONNECTDEVELOP "\xEF\x88\x8E" +#define ICON_FK_DASHCUBE "\xEF\x88\x90" +#define ICON_FK_FORUMBEE "\xEF\x88\x91" +#define ICON_FK_LEANPUB "\xEF\x88\x92" +#define ICON_FK_SELLSY "\xEF\x88\x93" +#define ICON_FK_SHIRTSINBULK "\xEF\x88\x94" +#define ICON_FK_SIMPLYBUILT "\xEF\x88\x95" +#define ICON_FK_SKYATLAS "\xEF\x88\x96" +#define ICON_FK_CART_PLUS "\xEF\x88\x97" +#define ICON_FK_CART_ARROW_DOWN "\xEF\x88\x98" +#define ICON_FK_DIAMOND "\xEF\x88\x99" +#define ICON_FK_SHIP "\xEF\x88\x9A" +#define ICON_FK_USER_SECRET "\xEF\x88\x9B" +#define ICON_FK_MOTORCYCLE "\xEF\x88\x9C" +#define ICON_FK_STREET_VIEW "\xEF\x88\x9D" +#define ICON_FK_HEARTBEAT "\xEF\x88\x9E" +#define ICON_FK_VENUS "\xEF\x88\xA1" +#define ICON_FK_MARS "\xEF\x88\xA2" +#define ICON_FK_MERCURY "\xEF\x88\xA3" +#define ICON_FK_TRANSGENDER "\xEF\x88\xA4" +#define ICON_FK_TRANSGENDER_ALT "\xEF\x88\xA5" +#define ICON_FK_VENUS_DOUBLE "\xEF\x88\xA6" +#define ICON_FK_MARS_DOUBLE "\xEF\x88\xA7" +#define ICON_FK_VENUS_MARS "\xEF\x88\xA8" +#define ICON_FK_MARS_STROKE "\xEF\x88\xA9" +#define ICON_FK_MARS_STROKE_V "\xEF\x88\xAA" +#define ICON_FK_MARS_STROKE_H "\xEF\x88\xAB" +#define ICON_FK_NEUTER "\xEF\x88\xAC" +#define ICON_FK_GENDERLESS "\xEF\x88\xAD" +#define ICON_FK_FACEBOOK_OFFICIAL "\xEF\x88\xB0" +#define ICON_FK_PINTEREST_P "\xEF\x88\xB1" +#define ICON_FK_WHATSAPP "\xEF\x88\xB2" +#define ICON_FK_SERVER "\xEF\x88\xB3" +#define ICON_FK_USER_PLUS "\xEF\x88\xB4" +#define ICON_FK_USER_TIMES "\xEF\x88\xB5" +#define ICON_FK_BED "\xEF\x88\xB6" +#define ICON_FK_VIACOIN "\xEF\x88\xB7" +#define ICON_FK_TRAIN "\xEF\x88\xB8" +#define ICON_FK_SUBWAY "\xEF\x88\xB9" +#define ICON_FK_MEDIUM "\xEF\x88\xBA" +#define ICON_FK_MEDIUM_SQUARE "\xEF\x8B\xB8" +#define ICON_FK_Y_COMBINATOR "\xEF\x88\xBB" +#define ICON_FK_OPTIN_MONSTER "\xEF\x88\xBC" +#define ICON_FK_OPENCART "\xEF\x88\xBD" +#define ICON_FK_EXPEDITEDSSL "\xEF\x88\xBE" +#define ICON_FK_BATTERY_FULL "\xEF\x89\x80" +#define ICON_FK_BATTERY_THREE_QUARTERS "\xEF\x89\x81" +#define ICON_FK_BATTERY_HALF "\xEF\x89\x82" +#define ICON_FK_BATTERY_QUARTER "\xEF\x89\x83" +#define ICON_FK_BATTERY_EMPTY "\xEF\x89\x84" +#define ICON_FK_MOUSE_POINTER "\xEF\x89\x85" +#define ICON_FK_I_CURSOR "\xEF\x89\x86" +#define ICON_FK_OBJECT_GROUP "\xEF\x89\x87" +#define ICON_FK_OBJECT_UNGROUP "\xEF\x89\x88" +#define ICON_FK_STICKY_NOTE "\xEF\x89\x89" +#define ICON_FK_STICKY_NOTE_O "\xEF\x89\x8A" +#define ICON_FK_CC_JCB "\xEF\x89\x8B" +#define ICON_FK_CC_DINERS_CLUB "\xEF\x89\x8C" +#define ICON_FK_CLONE "\xEF\x89\x8D" +#define ICON_FK_BALANCE_SCALE "\xEF\x89\x8E" +#define ICON_FK_HOURGLASS_O "\xEF\x89\x90" +#define ICON_FK_HOURGLASS_START "\xEF\x89\x91" +#define ICON_FK_HOURGLASS_HALF "\xEF\x89\x92" +#define ICON_FK_HOURGLASS_END "\xEF\x89\x93" +#define ICON_FK_HOURGLASS "\xEF\x89\x94" +#define ICON_FK_HAND_ROCK_O "\xEF\x89\x95" +#define ICON_FK_HAND_PAPER_O "\xEF\x89\x96" +#define ICON_FK_HAND_SCISSORS_O "\xEF\x89\x97" +#define ICON_FK_HAND_LIZARD_O "\xEF\x89\x98" +#define ICON_FK_HAND_SPOCK_O "\xEF\x89\x99" +#define ICON_FK_HAND_POINTER_O "\xEF\x89\x9A" +#define ICON_FK_HAND_PEACE_O "\xEF\x89\x9B" +#define ICON_FK_TRADEMARK "\xEF\x89\x9C" +#define ICON_FK_REGISTERED "\xEF\x89\x9D" +#define ICON_FK_CREATIVE_COMMONS "\xEF\x89\x9E" +#define ICON_FK_GG "\xEF\x89\xA0" +#define ICON_FK_GG_CIRCLE "\xEF\x89\xA1" +#define ICON_FK_TRIPADVISOR "\xEF\x89\xA2" +#define ICON_FK_ODNOKLASSNIKI "\xEF\x89\xA3" +#define ICON_FK_ODNOKLASSNIKI_SQUARE "\xEF\x89\xA4" +#define ICON_FK_GET_POCKET "\xEF\x89\xA5" +#define ICON_FK_WIKIPEDIA_W "\xEF\x89\xA6" +#define ICON_FK_SAFARI "\xEF\x89\xA7" +#define ICON_FK_CHROME "\xEF\x89\xA8" +#define ICON_FK_FIREFOX "\xEF\x89\xA9" +#define ICON_FK_OPERA "\xEF\x89\xAA" +#define ICON_FK_INTERNET_EXPLORER "\xEF\x89\xAB" +#define ICON_FK_TELEVISION "\xEF\x89\xAC" +#define ICON_FK_CONTAO "\xEF\x89\xAD" +#define ICON_FK_500PX "\xEF\x89\xAE" +#define ICON_FK_AMAZON "\xEF\x89\xB0" +#define ICON_FK_CALENDAR_PLUS_O "\xEF\x89\xB1" +#define ICON_FK_CALENDAR_MINUS_O "\xEF\x89\xB2" +#define ICON_FK_CALENDAR_TIMES_O "\xEF\x89\xB3" +#define ICON_FK_CALENDAR_CHECK_O "\xEF\x89\xB4" +#define ICON_FK_INDUSTRY "\xEF\x89\xB5" +#define ICON_FK_MAP_PIN "\xEF\x89\xB6" +#define ICON_FK_MAP_SIGNS "\xEF\x89\xB7" +#define ICON_FK_MAP_O "\xEF\x89\xB8" +#define ICON_FK_MAP "\xEF\x89\xB9" +#define ICON_FK_COMMENTING "\xEF\x89\xBA" +#define ICON_FK_COMMENTING_O "\xEF\x89\xBB" +#define ICON_FK_HOUZZ "\xEF\x89\xBC" +#define ICON_FK_VIMEO "\xEF\x89\xBD" +#define ICON_FK_BLACK_TIE "\xEF\x89\xBE" +#define ICON_FK_FONTICONS "\xEF\x8A\x80" +#define ICON_FK_REDDIT_ALIEN "\xEF\x8A\x81" +#define ICON_FK_EDGE "\xEF\x8A\x82" +#define ICON_FK_CREDIT_CARD_ALT "\xEF\x8A\x83" +#define ICON_FK_CODIEPIE "\xEF\x8A\x84" +#define ICON_FK_MODX "\xEF\x8A\x85" +#define ICON_FK_FORT_AWESOME "\xEF\x8A\x86" +#define ICON_FK_USB "\xEF\x8A\x87" +#define ICON_FK_PRODUCT_HUNT "\xEF\x8A\x88" +#define ICON_FK_MIXCLOUD "\xEF\x8A\x89" +#define ICON_FK_SCRIBD "\xEF\x8A\x8A" +#define ICON_FK_PAUSE_CIRCLE "\xEF\x8A\x8B" +#define ICON_FK_PAUSE_CIRCLE_O "\xEF\x8A\x8C" +#define ICON_FK_STOP_CIRCLE "\xEF\x8A\x8D" +#define ICON_FK_STOP_CIRCLE_O "\xEF\x8A\x8E" +#define ICON_FK_SHOPPING_BAG "\xEF\x8A\x90" +#define ICON_FK_SHOPPING_BASKET "\xEF\x8A\x91" +#define ICON_FK_HASHTAG "\xEF\x8A\x92" +#define ICON_FK_BLUETOOTH "\xEF\x8A\x93" +#define ICON_FK_BLUETOOTH_B "\xEF\x8A\x94" +#define ICON_FK_PERCENT "\xEF\x8A\x95" +#define ICON_FK_GITLAB "\xEF\x8A\x96" +#define ICON_FK_WPBEGINNER "\xEF\x8A\x97" +#define ICON_FK_WPFORMS "\xEF\x8A\x98" +#define ICON_FK_ENVIRA "\xEF\x8A\x99" +#define ICON_FK_UNIVERSAL_ACCESS "\xEF\x8A\x9A" +#define ICON_FK_WHEELCHAIR_ALT "\xEF\x8A\x9B" +#define ICON_FK_QUESTION_CIRCLE_O "\xEF\x8A\x9C" +#define ICON_FK_BLIND "\xEF\x8A\x9D" +#define ICON_FK_AUDIO_DESCRIPTION "\xEF\x8A\x9E" +#define ICON_FK_VOLUME_CONTROL_PHONE "\xEF\x8A\xA0" +#define ICON_FK_BRAILLE "\xEF\x8A\xA1" +#define ICON_FK_ASSISTIVE_LISTENING_SYSTEMS "\xEF\x8A\xA2" +#define ICON_FK_AMERICAN_SIGN_LANGUAGE_INTERPRETING "\xEF\x8A\xA3" +#define ICON_FK_DEAF "\xEF\x8A\xA4" +#define ICON_FK_GLIDE "\xEF\x8A\xA5" +#define ICON_FK_GLIDE_G "\xEF\x8A\xA6" +#define ICON_FK_SIGN_LANGUAGE "\xEF\x8A\xA7" +#define ICON_FK_LOW_VISION "\xEF\x8A\xA8" +#define ICON_FK_VIADEO "\xEF\x8A\xA9" +#define ICON_FK_VIADEO_SQUARE "\xEF\x8A\xAA" +#define ICON_FK_SNAPCHAT "\xEF\x8A\xAB" +#define ICON_FK_SNAPCHAT_GHOST "\xEF\x8A\xAC" +#define ICON_FK_SNAPCHAT_SQUARE "\xEF\x8A\xAD" +#define ICON_FK_FIRST_ORDER "\xEF\x8A\xB0" +#define ICON_FK_YOAST "\xEF\x8A\xB1" +#define ICON_FK_THEMEISLE "\xEF\x8A\xB2" +#define ICON_FK_GOOGLE_PLUS_OFFICIAL "\xEF\x8A\xB3" +#define ICON_FK_FONT_AWESOME "\xEF\x8A\xB4" +#define ICON_FK_HANDSHAKE_O "\xEF\x8A\xB5" +#define ICON_FK_ENVELOPE_OPEN "\xEF\x8A\xB6" +#define ICON_FK_ENVELOPE_OPEN_O "\xEF\x8A\xB7" +#define ICON_FK_LINODE "\xEF\x8A\xB8" +#define ICON_FK_ADDRESS_BOOK "\xEF\x8A\xB9" +#define ICON_FK_ADDRESS_BOOK_O "\xEF\x8A\xBA" +#define ICON_FK_ADDRESS_CARD "\xEF\x8A\xBB" +#define ICON_FK_ADDRESS_CARD_O "\xEF\x8A\xBC" +#define ICON_FK_USER_CIRCLE "\xEF\x8A\xBD" +#define ICON_FK_USER_CIRCLE_O "\xEF\x8A\xBE" +#define ICON_FK_USER_O "\xEF\x8B\x80" +#define ICON_FK_ID_BADGE "\xEF\x8B\x81" +#define ICON_FK_ID_CARD "\xEF\x8B\x82" +#define ICON_FK_ID_CARD_O "\xEF\x8B\x83" +#define ICON_FK_QUORA "\xEF\x8B\x84" +#define ICON_FK_FREE_CODE_CAMP "\xEF\x8B\x85" +#define ICON_FK_TELEGRAM "\xEF\x8B\x86" +#define ICON_FK_THERMOMETER_FULL "\xEF\x8B\x87" +#define ICON_FK_THERMOMETER_THREE_QUARTERS "\xEF\x8B\x88" +#define ICON_FK_THERMOMETER_HALF "\xEF\x8B\x89" +#define ICON_FK_THERMOMETER_QUARTER "\xEF\x8B\x8A" +#define ICON_FK_THERMOMETER_EMPTY "\xEF\x8B\x8B" +#define ICON_FK_SHOWER "\xEF\x8B\x8C" +#define ICON_FK_BATH "\xEF\x8B\x8D" +#define ICON_FK_PODCAST "\xEF\x8B\x8E" +#define ICON_FK_WINDOW_MAXIMIZE "\xEF\x8B\x90" +#define ICON_FK_WINDOW_MINIMIZE "\xEF\x8B\x91" +#define ICON_FK_WINDOW_RESTORE "\xEF\x8B\x92" +#define ICON_FK_WINDOW_CLOSE "\xEF\x8B\x93" +#define ICON_FK_WINDOW_CLOSE_O "\xEF\x8B\x94" +#define ICON_FK_BANDCAMP "\xEF\x8B\x95" +#define ICON_FK_GRAV "\xEF\x8B\x96" +#define ICON_FK_ETSY "\xEF\x8B\x97" +#define ICON_FK_IMDB "\xEF\x8B\x98" +#define ICON_FK_RAVELRY "\xEF\x8B\x99" +#define ICON_FK_EERCAST "\xEF\x8B\x9A" +#define ICON_FK_MICROCHIP "\xEF\x8B\x9B" +#define ICON_FK_SNOWFLAKE_O "\xEF\x8B\x9C" +#define ICON_FK_SUPERPOWERS "\xEF\x8B\x9D" +#define ICON_FK_WPEXPLORER "\xEF\x8B\x9E" +#define ICON_FK_MEETUP "\xEF\x8B\xA0" +#define ICON_FK_MASTODON "\xEF\x8B\xA1" +#define ICON_FK_MASTODON_ALT "\xEF\x8B\xA2" +#define ICON_FK_FORK_AWESOME "\xEF\x8B\xA3" +#define ICON_FK_PEERTUBE "\xEF\x8B\xA4" +#define ICON_FK_DIASPORA "\xEF\x8B\xA5" +#define ICON_FK_FRIENDICA "\xEF\x8B\xA6" +#define ICON_FK_GNU_SOCIAL "\xEF\x8B\xA7" +#define ICON_FK_LIBERAPAY_SQUARE "\xEF\x8B\xA8" +#define ICON_FK_LIBERAPAY "\xEF\x8B\xA9" +#define ICON_FK_SCUTTLEBUTT "\xEF\x8B\xAA" +#define ICON_FK_HUBZILLA "\xEF\x8B\xAB" +#define ICON_FK_SOCIAL_HOME "\xEF\x8B\xAC" +#define ICON_FK_ARTSTATION "\xEF\x8B\xAD" +#define ICON_FK_DISCORD "\xEF\x8B\xAE" +#define ICON_FK_DISCORD_ALT "\xEF\x8B\xAF" +#define ICON_FK_PATREON "\xEF\x8B\xB0" +#define ICON_FK_SNOWDRIFT "\xEF\x8B\xB1" +#define ICON_FK_ACTIVITYPUB "\xEF\x8B\xB2" +#define ICON_FK_ETHEREUM "\xEF\x8B\xB3" +#define ICON_FK_KEYBASE "\xEF\x8B\xB4" +#define ICON_FK_SHAARLI "\xEF\x8B\xB5" +#define ICON_FK_SHAARLI_O "\xEF\x8B\xB6" +#define ICON_FK_KEY_MODERN "\xEF\x8B\xB7" +#define ICON_FK_XMPP "\xEF\x8B\xB9" +#define ICON_FK_ARCHIVE_ORG "\xEF\x8B\xBC" +#define ICON_FK_FREEDOMBOX "\xEF\x8B\xBD" +#define ICON_FK_FACEBOOK_MESSENGER "\xEF\x8B\xBE" +#define ICON_FK_DEBIAN "\xEF\x8B\xBF" +#define ICON_FK_MASTODON_SQUARE "\xEF\x8C\x80" +#define ICON_FK_TIPEEE "\xEF\x8C\x81" +#define ICON_FK_REACT "\xEF\x8C\x82" +#define ICON_FK_DOGMAZIC "\xEF\x8C\x83" +#define ICON_FK_ZOTERO "\xEF\x8C\x89" +#define ICON_FK_NODEJS "\xEF\x8C\x88" +#define ICON_FK_NEXTCLOUD "\xEF\x8C\x86" +#define ICON_FK_NEXTCLOUD_SQUARE "\xEF\x8C\x87" +#define ICON_FK_HACKADAY "\xEF\x8C\x8A" +#define ICON_FK_LARAVEL "\xEF\x8C\x8B" +#define ICON_FK_SIGNALAPP "\xEF\x8C\x8C" +#define ICON_FK_GNUPG "\xEF\x8C\x8D" +#define ICON_FK_PHP "\xEF\x8C\x8E" +#define ICON_FK_FFMPEG "\xEF\x8C\x8F" +#define ICON_FK_JOPLIN "\xEF\x8C\x90" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_ionicons.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_ionicons.h new file mode 100644 index 00000000000..4656a73dd32 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_ionicons.h @@ -0,0 +1,742 @@ +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/ionic-team/ionicons/master/src/docs/archived/v2/css/ionicons.css +// for use with https://github.com/ionic-team/ionicons/blob/master/src/docs/archived/v2/fonts/ionicons.ttf +#pragma once + +#define FONT_ICON_FILE_NAME_II "ionicons.ttf" + +#define ICON_MIN_II 0xf100 +#define ICON_MAX_II 0xf4f7 +#define ICON_II_ALERT "\xEF\x84\x81" +#define ICON_II_ALERT_CIRCLED "\xEF\x84\x80" +#define ICON_II_ANDROID_ADD "\xEF\x8B\x87" +#define ICON_II_ANDROID_ADD_CIRCLE "\xEF\x8D\x99" +#define ICON_II_ANDROID_ALARM_CLOCK "\xEF\x8D\x9A" +#define ICON_II_ANDROID_ALERT "\xEF\x8D\x9B" +#define ICON_II_ANDROID_APPS "\xEF\x8D\x9C" +#define ICON_II_ANDROID_ARCHIVE "\xEF\x8B\x89" +#define ICON_II_ANDROID_ARROW_BACK "\xEF\x8B\x8A" +#define ICON_II_ANDROID_ARROW_DOWN "\xEF\x8D\x9D" +#define ICON_II_ANDROID_ARROW_DROPDOWN "\xEF\x8D\x9F" +#define ICON_II_ANDROID_ARROW_DROPDOWN_CIRCLE "\xEF\x8D\x9E" +#define ICON_II_ANDROID_ARROW_DROPLEFT "\xEF\x8D\xA1" +#define ICON_II_ANDROID_ARROW_DROPLEFT_CIRCLE "\xEF\x8D\xA0" +#define ICON_II_ANDROID_ARROW_DROPRIGHT "\xEF\x8D\xA3" +#define ICON_II_ANDROID_ARROW_DROPRIGHT_CIRCLE "\xEF\x8D\xA2" +#define ICON_II_ANDROID_ARROW_DROPUP "\xEF\x8D\xA5" +#define ICON_II_ANDROID_ARROW_DROPUP_CIRCLE "\xEF\x8D\xA4" +#define ICON_II_ANDROID_ARROW_FORWARD "\xEF\x8C\x8F" +#define ICON_II_ANDROID_ARROW_UP "\xEF\x8D\xA6" +#define ICON_II_ANDROID_ATTACH "\xEF\x8D\xA7" +#define ICON_II_ANDROID_BAR "\xEF\x8D\xA8" +#define ICON_II_ANDROID_BICYCLE "\xEF\x8D\xA9" +#define ICON_II_ANDROID_BOAT "\xEF\x8D\xAA" +#define ICON_II_ANDROID_BOOKMARK "\xEF\x8D\xAB" +#define ICON_II_ANDROID_BULB "\xEF\x8D\xAC" +#define ICON_II_ANDROID_BUS "\xEF\x8D\xAD" +#define ICON_II_ANDROID_CALENDAR "\xEF\x8B\x91" +#define ICON_II_ANDROID_CALL "\xEF\x8B\x92" +#define ICON_II_ANDROID_CAMERA "\xEF\x8B\x93" +#define ICON_II_ANDROID_CANCEL "\xEF\x8D\xAE" +#define ICON_II_ANDROID_CAR "\xEF\x8D\xAF" +#define ICON_II_ANDROID_CART "\xEF\x8D\xB0" +#define ICON_II_ANDROID_CHAT "\xEF\x8B\x94" +#define ICON_II_ANDROID_CHECKBOX "\xEF\x8D\xB4" +#define ICON_II_ANDROID_CHECKBOX_BLANK "\xEF\x8D\xB1" +#define ICON_II_ANDROID_CHECKBOX_OUTLINE "\xEF\x8D\xB3" +#define ICON_II_ANDROID_CHECKBOX_OUTLINE_BLANK "\xEF\x8D\xB2" +#define ICON_II_ANDROID_CHECKMARK_CIRCLE "\xEF\x8D\xB5" +#define ICON_II_ANDROID_CLIPBOARD "\xEF\x8D\xB6" +#define ICON_II_ANDROID_CLOSE "\xEF\x8B\x97" +#define ICON_II_ANDROID_CLOUD "\xEF\x8D\xBA" +#define ICON_II_ANDROID_CLOUD_CIRCLE "\xEF\x8D\xB7" +#define ICON_II_ANDROID_CLOUD_DONE "\xEF\x8D\xB8" +#define ICON_II_ANDROID_CLOUD_OUTLINE "\xEF\x8D\xB9" +#define ICON_II_ANDROID_COLOR_PALETTE "\xEF\x8D\xBB" +#define ICON_II_ANDROID_COMPASS "\xEF\x8D\xBC" +#define ICON_II_ANDROID_CONTACT "\xEF\x8B\x98" +#define ICON_II_ANDROID_CONTACTS "\xEF\x8B\x99" +#define ICON_II_ANDROID_CONTRACT "\xEF\x8D\xBD" +#define ICON_II_ANDROID_CREATE "\xEF\x8D\xBE" +#define ICON_II_ANDROID_DELETE "\xEF\x8D\xBF" +#define ICON_II_ANDROID_DESKTOP "\xEF\x8E\x80" +#define ICON_II_ANDROID_DOCUMENT "\xEF\x8E\x81" +#define ICON_II_ANDROID_DONE "\xEF\x8E\x83" +#define ICON_II_ANDROID_DONE_ALL "\xEF\x8E\x82" +#define ICON_II_ANDROID_DOWNLOAD "\xEF\x8B\x9D" +#define ICON_II_ANDROID_DRAFTS "\xEF\x8E\x84" +#define ICON_II_ANDROID_EXIT "\xEF\x8E\x85" +#define ICON_II_ANDROID_EXPAND "\xEF\x8E\x86" +#define ICON_II_ANDROID_FAVORITE "\xEF\x8E\x88" +#define ICON_II_ANDROID_FAVORITE_OUTLINE "\xEF\x8E\x87" +#define ICON_II_ANDROID_FILM "\xEF\x8E\x89" +#define ICON_II_ANDROID_FOLDER "\xEF\x8B\xA0" +#define ICON_II_ANDROID_FOLDER_OPEN "\xEF\x8E\x8A" +#define ICON_II_ANDROID_FUNNEL "\xEF\x8E\x8B" +#define ICON_II_ANDROID_GLOBE "\xEF\x8E\x8C" +#define ICON_II_ANDROID_HAND "\xEF\x8B\xA3" +#define ICON_II_ANDROID_HANGOUT "\xEF\x8E\x8D" +#define ICON_II_ANDROID_HAPPY "\xEF\x8E\x8E" +#define ICON_II_ANDROID_HOME "\xEF\x8E\x8F" +#define ICON_II_ANDROID_IMAGE "\xEF\x8B\xA4" +#define ICON_II_ANDROID_LAPTOP "\xEF\x8E\x90" +#define ICON_II_ANDROID_LIST "\xEF\x8E\x91" +#define ICON_II_ANDROID_LOCATE "\xEF\x8B\xA9" +#define ICON_II_ANDROID_LOCK "\xEF\x8E\x92" +#define ICON_II_ANDROID_MAIL "\xEF\x8B\xAB" +#define ICON_II_ANDROID_MAP "\xEF\x8E\x93" +#define ICON_II_ANDROID_MENU "\xEF\x8E\x94" +#define ICON_II_ANDROID_MICROPHONE "\xEF\x8B\xAC" +#define ICON_II_ANDROID_MICROPHONE_OFF "\xEF\x8E\x95" +#define ICON_II_ANDROID_MORE_HORIZONTAL "\xEF\x8E\x96" +#define ICON_II_ANDROID_MORE_VERTICAL "\xEF\x8E\x97" +#define ICON_II_ANDROID_NAVIGATE "\xEF\x8E\x98" +#define ICON_II_ANDROID_NOTIFICATIONS "\xEF\x8E\x9B" +#define ICON_II_ANDROID_NOTIFICATIONS_NONE "\xEF\x8E\x99" +#define ICON_II_ANDROID_NOTIFICATIONS_OFF "\xEF\x8E\x9A" +#define ICON_II_ANDROID_OPEN "\xEF\x8E\x9C" +#define ICON_II_ANDROID_OPTIONS "\xEF\x8E\x9D" +#define ICON_II_ANDROID_PEOPLE "\xEF\x8E\x9E" +#define ICON_II_ANDROID_PERSON "\xEF\x8E\xA0" +#define ICON_II_ANDROID_PERSON_ADD "\xEF\x8E\x9F" +#define ICON_II_ANDROID_PHONE_LANDSCAPE "\xEF\x8E\xA1" +#define ICON_II_ANDROID_PHONE_PORTRAIT "\xEF\x8E\xA2" +#define ICON_II_ANDROID_PIN "\xEF\x8E\xA3" +#define ICON_II_ANDROID_PLANE "\xEF\x8E\xA4" +#define ICON_II_ANDROID_PLAYSTORE "\xEF\x8B\xB0" +#define ICON_II_ANDROID_PRINT "\xEF\x8E\xA5" +#define ICON_II_ANDROID_RADIO_BUTTON_OFF "\xEF\x8E\xA6" +#define ICON_II_ANDROID_RADIO_BUTTON_ON "\xEF\x8E\xA7" +#define ICON_II_ANDROID_REFRESH "\xEF\x8E\xA8" +#define ICON_II_ANDROID_REMOVE "\xEF\x8B\xB4" +#define ICON_II_ANDROID_REMOVE_CIRCLE "\xEF\x8E\xA9" +#define ICON_II_ANDROID_RESTAURANT "\xEF\x8E\xAA" +#define ICON_II_ANDROID_SAD "\xEF\x8E\xAB" +#define ICON_II_ANDROID_SEARCH "\xEF\x8B\xB5" +#define ICON_II_ANDROID_SEND "\xEF\x8B\xB6" +#define ICON_II_ANDROID_SETTINGS "\xEF\x8B\xB7" +#define ICON_II_ANDROID_SHARE "\xEF\x8B\xB8" +#define ICON_II_ANDROID_SHARE_ALT "\xEF\x8E\xAC" +#define ICON_II_ANDROID_STAR "\xEF\x8B\xBC" +#define ICON_II_ANDROID_STAR_HALF "\xEF\x8E\xAD" +#define ICON_II_ANDROID_STAR_OUTLINE "\xEF\x8E\xAE" +#define ICON_II_ANDROID_STOPWATCH "\xEF\x8B\xBD" +#define ICON_II_ANDROID_SUBWAY "\xEF\x8E\xAF" +#define ICON_II_ANDROID_SUNNY "\xEF\x8E\xB0" +#define ICON_II_ANDROID_SYNC "\xEF\x8E\xB1" +#define ICON_II_ANDROID_TEXTSMS "\xEF\x8E\xB2" +#define ICON_II_ANDROID_TIME "\xEF\x8E\xB3" +#define ICON_II_ANDROID_TRAIN "\xEF\x8E\xB4" +#define ICON_II_ANDROID_UNLOCK "\xEF\x8E\xB5" +#define ICON_II_ANDROID_UPLOAD "\xEF\x8E\xB6" +#define ICON_II_ANDROID_VOLUME_DOWN "\xEF\x8E\xB7" +#define ICON_II_ANDROID_VOLUME_MUTE "\xEF\x8E\xB8" +#define ICON_II_ANDROID_VOLUME_OFF "\xEF\x8E\xB9" +#define ICON_II_ANDROID_VOLUME_UP "\xEF\x8E\xBA" +#define ICON_II_ANDROID_WALK "\xEF\x8E\xBB" +#define ICON_II_ANDROID_WARNING "\xEF\x8E\xBC" +#define ICON_II_ANDROID_WATCH "\xEF\x8E\xBD" +#define ICON_II_ANDROID_WIFI "\xEF\x8C\x85" +#define ICON_II_APERTURE "\xEF\x8C\x93" +#define ICON_II_ARCHIVE "\xEF\x84\x82" +#define ICON_II_ARROW_DOWN_A "\xEF\x84\x83" +#define ICON_II_ARROW_DOWN_B "\xEF\x84\x84" +#define ICON_II_ARROW_DOWN_C "\xEF\x84\x85" +#define ICON_II_ARROW_EXPAND "\xEF\x89\x9E" +#define ICON_II_ARROW_GRAPH_DOWN_LEFT "\xEF\x89\x9F" +#define ICON_II_ARROW_GRAPH_DOWN_RIGHT "\xEF\x89\xA0" +#define ICON_II_ARROW_GRAPH_UP_LEFT "\xEF\x89\xA1" +#define ICON_II_ARROW_GRAPH_UP_RIGHT "\xEF\x89\xA2" +#define ICON_II_ARROW_LEFT_A "\xEF\x84\x86" +#define ICON_II_ARROW_LEFT_B "\xEF\x84\x87" +#define ICON_II_ARROW_LEFT_C "\xEF\x84\x88" +#define ICON_II_ARROW_MOVE "\xEF\x89\xA3" +#define ICON_II_ARROW_RESIZE "\xEF\x89\xA4" +#define ICON_II_ARROW_RETURN_LEFT "\xEF\x89\xA5" +#define ICON_II_ARROW_RETURN_RIGHT "\xEF\x89\xA6" +#define ICON_II_ARROW_RIGHT_A "\xEF\x84\x89" +#define ICON_II_ARROW_RIGHT_B "\xEF\x84\x8A" +#define ICON_II_ARROW_RIGHT_C "\xEF\x84\x8B" +#define ICON_II_ARROW_SHRINK "\xEF\x89\xA7" +#define ICON_II_ARROW_SWAP "\xEF\x89\xA8" +#define ICON_II_ARROW_UP_A "\xEF\x84\x8C" +#define ICON_II_ARROW_UP_B "\xEF\x84\x8D" +#define ICON_II_ARROW_UP_C "\xEF\x84\x8E" +#define ICON_II_ASTERISK "\xEF\x8C\x94" +#define ICON_II_AT "\xEF\x84\x8F" +#define ICON_II_BACKSPACE "\xEF\x8E\xBF" +#define ICON_II_BACKSPACE_OUTLINE "\xEF\x8E\xBE" +#define ICON_II_BAG "\xEF\x84\x90" +#define ICON_II_BATTERY_CHARGING "\xEF\x84\x91" +#define ICON_II_BATTERY_EMPTY "\xEF\x84\x92" +#define ICON_II_BATTERY_FULL "\xEF\x84\x93" +#define ICON_II_BATTERY_HALF "\xEF\x84\x94" +#define ICON_II_BATTERY_LOW "\xEF\x84\x95" +#define ICON_II_BEAKER "\xEF\x89\xA9" +#define ICON_II_BEER "\xEF\x89\xAA" +#define ICON_II_BLUETOOTH "\xEF\x84\x96" +#define ICON_II_BONFIRE "\xEF\x8C\x95" +#define ICON_II_BOOKMARK "\xEF\x89\xAB" +#define ICON_II_BOWTIE "\xEF\x8F\x80" +#define ICON_II_BRIEFCASE "\xEF\x89\xAC" +#define ICON_II_BUG "\xEF\x8A\xBE" +#define ICON_II_CALCULATOR "\xEF\x89\xAD" +#define ICON_II_CALENDAR "\xEF\x84\x97" +#define ICON_II_CAMERA "\xEF\x84\x98" +#define ICON_II_CARD "\xEF\x84\x99" +#define ICON_II_CASH "\xEF\x8C\x96" +#define ICON_II_CHATBOX "\xEF\x84\x9B" +#define ICON_II_CHATBOX_WORKING "\xEF\x84\x9A" +#define ICON_II_CHATBOXES "\xEF\x84\x9C" +#define ICON_II_CHATBUBBLE "\xEF\x84\x9E" +#define ICON_II_CHATBUBBLE_WORKING "\xEF\x84\x9D" +#define ICON_II_CHATBUBBLES "\xEF\x84\x9F" +#define ICON_II_CHECKMARK "\xEF\x84\xA2" +#define ICON_II_CHECKMARK_CIRCLED "\xEF\x84\xA0" +#define ICON_II_CHECKMARK_ROUND "\xEF\x84\xA1" +#define ICON_II_CHEVRON_DOWN "\xEF\x84\xA3" +#define ICON_II_CHEVRON_LEFT "\xEF\x84\xA4" +#define ICON_II_CHEVRON_RIGHT "\xEF\x84\xA5" +#define ICON_II_CHEVRON_UP "\xEF\x84\xA6" +#define ICON_II_CLIPBOARD "\xEF\x84\xA7" +#define ICON_II_CLOCK "\xEF\x89\xAE" +#define ICON_II_CLOSE "\xEF\x84\xAA" +#define ICON_II_CLOSE_CIRCLED "\xEF\x84\xA8" +#define ICON_II_CLOSE_ROUND "\xEF\x84\xA9" +#define ICON_II_CLOSED_CAPTIONING "\xEF\x8C\x97" +#define ICON_II_CLOUD "\xEF\x84\xAB" +#define ICON_II_CODE "\xEF\x89\xB1" +#define ICON_II_CODE_DOWNLOAD "\xEF\x89\xAF" +#define ICON_II_CODE_WORKING "\xEF\x89\xB0" +#define ICON_II_COFFEE "\xEF\x89\xB2" +#define ICON_II_COMPASS "\xEF\x89\xB3" +#define ICON_II_COMPOSE "\xEF\x84\xAC" +#define ICON_II_CONNECTION_BARS "\xEF\x89\xB4" +#define ICON_II_CONTRAST "\xEF\x89\xB5" +#define ICON_II_CROP "\xEF\x8F\x81" +#define ICON_II_CUBE "\xEF\x8C\x98" +#define ICON_II_DISC "\xEF\x84\xAD" +#define ICON_II_DOCUMENT "\xEF\x84\xAF" +#define ICON_II_DOCUMENT_TEXT "\xEF\x84\xAE" +#define ICON_II_DRAG "\xEF\x84\xB0" +#define ICON_II_EARTH "\xEF\x89\xB6" +#define ICON_II_EASEL "\xEF\x8F\x82" +#define ICON_II_EDIT "\xEF\x8A\xBF" +#define ICON_II_EGG "\xEF\x89\xB7" +#define ICON_II_EJECT "\xEF\x84\xB1" +#define ICON_II_EMAIL "\xEF\x84\xB2" +#define ICON_II_EMAIL_UNREAD "\xEF\x8F\x83" +#define ICON_II_ERLENMEYER_FLASK "\xEF\x8F\x85" +#define ICON_II_ERLENMEYER_FLASK_BUBBLES "\xEF\x8F\x84" +#define ICON_II_EYE "\xEF\x84\xB3" +#define ICON_II_EYE_DISABLED "\xEF\x8C\x86" +#define ICON_II_FEMALE "\xEF\x89\xB8" +#define ICON_II_FILING "\xEF\x84\xB4" +#define ICON_II_FILM_MARKER "\xEF\x84\xB5" +#define ICON_II_FIREBALL "\xEF\x8C\x99" +#define ICON_II_FLAG "\xEF\x89\xB9" +#define ICON_II_FLAME "\xEF\x8C\x9A" +#define ICON_II_FLASH "\xEF\x84\xB7" +#define ICON_II_FLASH_OFF "\xEF\x84\xB6" +#define ICON_II_FOLDER "\xEF\x84\xB9" +#define ICON_II_FORK "\xEF\x89\xBA" +#define ICON_II_FORK_REPO "\xEF\x8B\x80" +#define ICON_II_FORWARD "\xEF\x84\xBA" +#define ICON_II_FUNNEL "\xEF\x8C\x9B" +#define ICON_II_GEAR_A "\xEF\x84\xBD" +#define ICON_II_GEAR_B "\xEF\x84\xBE" +#define ICON_II_GRID "\xEF\x84\xBF" +#define ICON_II_HAMMER "\xEF\x89\xBB" +#define ICON_II_HAPPY "\xEF\x8C\x9C" +#define ICON_II_HAPPY_OUTLINE "\xEF\x8F\x86" +#define ICON_II_HEADPHONE "\xEF\x85\x80" +#define ICON_II_HEART "\xEF\x85\x81" +#define ICON_II_HEART_BROKEN "\xEF\x8C\x9D" +#define ICON_II_HELP "\xEF\x85\x83" +#define ICON_II_HELP_BUOY "\xEF\x89\xBC" +#define ICON_II_HELP_CIRCLED "\xEF\x85\x82" +#define ICON_II_HOME "\xEF\x85\x84" +#define ICON_II_ICECREAM "\xEF\x89\xBD" +#define ICON_II_IMAGE "\xEF\x85\x87" +#define ICON_II_IMAGES "\xEF\x85\x88" +#define ICON_II_INFORMATION "\xEF\x85\x8A" +#define ICON_II_INFORMATION_CIRCLED "\xEF\x85\x89" +#define ICON_II_IONIC "\xEF\x85\x8B" +#define ICON_II_IOS_ALARM "\xEF\x8F\x88" +#define ICON_II_IOS_ALARM_OUTLINE "\xEF\x8F\x87" +#define ICON_II_IOS_ALBUMS "\xEF\x8F\x8A" +#define ICON_II_IOS_ALBUMS_OUTLINE "\xEF\x8F\x89" +#define ICON_II_IOS_AMERICANFOOTBALL "\xEF\x8F\x8C" +#define ICON_II_IOS_AMERICANFOOTBALL_OUTLINE "\xEF\x8F\x8B" +#define ICON_II_IOS_ANALYTICS "\xEF\x8F\x8E" +#define ICON_II_IOS_ANALYTICS_OUTLINE "\xEF\x8F\x8D" +#define ICON_II_IOS_ARROW_BACK "\xEF\x8F\x8F" +#define ICON_II_IOS_ARROW_DOWN "\xEF\x8F\x90" +#define ICON_II_IOS_ARROW_FORWARD "\xEF\x8F\x91" +#define ICON_II_IOS_ARROW_LEFT "\xEF\x8F\x92" +#define ICON_II_IOS_ARROW_RIGHT "\xEF\x8F\x93" +#define ICON_II_IOS_ARROW_THIN_DOWN "\xEF\x8F\x94" +#define ICON_II_IOS_ARROW_THIN_LEFT "\xEF\x8F\x95" +#define ICON_II_IOS_ARROW_THIN_RIGHT "\xEF\x8F\x96" +#define ICON_II_IOS_ARROW_THIN_UP "\xEF\x8F\x97" +#define ICON_II_IOS_ARROW_UP "\xEF\x8F\x98" +#define ICON_II_IOS_AT "\xEF\x8F\x9A" +#define ICON_II_IOS_AT_OUTLINE "\xEF\x8F\x99" +#define ICON_II_IOS_BARCODE "\xEF\x8F\x9C" +#define ICON_II_IOS_BARCODE_OUTLINE "\xEF\x8F\x9B" +#define ICON_II_IOS_BASEBALL "\xEF\x8F\x9E" +#define ICON_II_IOS_BASEBALL_OUTLINE "\xEF\x8F\x9D" +#define ICON_II_IOS_BASKETBALL "\xEF\x8F\xA0" +#define ICON_II_IOS_BASKETBALL_OUTLINE "\xEF\x8F\x9F" +#define ICON_II_IOS_BELL "\xEF\x8F\xA2" +#define ICON_II_IOS_BELL_OUTLINE "\xEF\x8F\xA1" +#define ICON_II_IOS_BODY "\xEF\x8F\xA4" +#define ICON_II_IOS_BODY_OUTLINE "\xEF\x8F\xA3" +#define ICON_II_IOS_BOLT "\xEF\x8F\xA6" +#define ICON_II_IOS_BOLT_OUTLINE "\xEF\x8F\xA5" +#define ICON_II_IOS_BOOK "\xEF\x8F\xA8" +#define ICON_II_IOS_BOOK_OUTLINE "\xEF\x8F\xA7" +#define ICON_II_IOS_BOOKMARKS "\xEF\x8F\xAA" +#define ICON_II_IOS_BOOKMARKS_OUTLINE "\xEF\x8F\xA9" +#define ICON_II_IOS_BOX "\xEF\x8F\xAC" +#define ICON_II_IOS_BOX_OUTLINE "\xEF\x8F\xAB" +#define ICON_II_IOS_BRIEFCASE "\xEF\x8F\xAE" +#define ICON_II_IOS_BRIEFCASE_OUTLINE "\xEF\x8F\xAD" +#define ICON_II_IOS_BROWSERS "\xEF\x8F\xB0" +#define ICON_II_IOS_BROWSERS_OUTLINE "\xEF\x8F\xAF" +#define ICON_II_IOS_CALCULATOR "\xEF\x8F\xB2" +#define ICON_II_IOS_CALCULATOR_OUTLINE "\xEF\x8F\xB1" +#define ICON_II_IOS_CALENDAR "\xEF\x8F\xB4" +#define ICON_II_IOS_CALENDAR_OUTLINE "\xEF\x8F\xB3" +#define ICON_II_IOS_CAMERA "\xEF\x8F\xB6" +#define ICON_II_IOS_CAMERA_OUTLINE "\xEF\x8F\xB5" +#define ICON_II_IOS_CART "\xEF\x8F\xB8" +#define ICON_II_IOS_CART_OUTLINE "\xEF\x8F\xB7" +#define ICON_II_IOS_CHATBOXES "\xEF\x8F\xBA" +#define ICON_II_IOS_CHATBOXES_OUTLINE "\xEF\x8F\xB9" +#define ICON_II_IOS_CHATBUBBLE "\xEF\x8F\xBC" +#define ICON_II_IOS_CHATBUBBLE_OUTLINE "\xEF\x8F\xBB" +#define ICON_II_IOS_CHECKMARK "\xEF\x8F\xBF" +#define ICON_II_IOS_CHECKMARK_EMPTY "\xEF\x8F\xBD" +#define ICON_II_IOS_CHECKMARK_OUTLINE "\xEF\x8F\xBE" +#define ICON_II_IOS_CIRCLE_FILLED "\xEF\x90\x80" +#define ICON_II_IOS_CIRCLE_OUTLINE "\xEF\x90\x81" +#define ICON_II_IOS_CLOCK "\xEF\x90\x83" +#define ICON_II_IOS_CLOCK_OUTLINE "\xEF\x90\x82" +#define ICON_II_IOS_CLOSE "\xEF\x90\x86" +#define ICON_II_IOS_CLOSE_EMPTY "\xEF\x90\x84" +#define ICON_II_IOS_CLOSE_OUTLINE "\xEF\x90\x85" +#define ICON_II_IOS_CLOUD "\xEF\x90\x8C" +#define ICON_II_IOS_CLOUD_DOWNLOAD "\xEF\x90\x88" +#define ICON_II_IOS_CLOUD_DOWNLOAD_OUTLINE "\xEF\x90\x87" +#define ICON_II_IOS_CLOUD_OUTLINE "\xEF\x90\x89" +#define ICON_II_IOS_CLOUD_UPLOAD "\xEF\x90\x8B" +#define ICON_II_IOS_CLOUD_UPLOAD_OUTLINE "\xEF\x90\x8A" +#define ICON_II_IOS_CLOUDY "\xEF\x90\x90" +#define ICON_II_IOS_CLOUDY_NIGHT "\xEF\x90\x8E" +#define ICON_II_IOS_CLOUDY_NIGHT_OUTLINE "\xEF\x90\x8D" +#define ICON_II_IOS_CLOUDY_OUTLINE "\xEF\x90\x8F" +#define ICON_II_IOS_COG "\xEF\x90\x92" +#define ICON_II_IOS_COG_OUTLINE "\xEF\x90\x91" +#define ICON_II_IOS_COLOR_FILTER "\xEF\x90\x94" +#define ICON_II_IOS_COLOR_FILTER_OUTLINE "\xEF\x90\x93" +#define ICON_II_IOS_COLOR_WAND "\xEF\x90\x96" +#define ICON_II_IOS_COLOR_WAND_OUTLINE "\xEF\x90\x95" +#define ICON_II_IOS_COMPOSE "\xEF\x90\x98" +#define ICON_II_IOS_COMPOSE_OUTLINE "\xEF\x90\x97" +#define ICON_II_IOS_CONTACT "\xEF\x90\x9A" +#define ICON_II_IOS_CONTACT_OUTLINE "\xEF\x90\x99" +#define ICON_II_IOS_COPY "\xEF\x90\x9C" +#define ICON_II_IOS_COPY_OUTLINE "\xEF\x90\x9B" +#define ICON_II_IOS_CROP "\xEF\x90\x9E" +#define ICON_II_IOS_CROP_STRONG "\xEF\x90\x9D" +#define ICON_II_IOS_DOWNLOAD "\xEF\x90\xA0" +#define ICON_II_IOS_DOWNLOAD_OUTLINE "\xEF\x90\x9F" +#define ICON_II_IOS_DRAG "\xEF\x90\xA1" +#define ICON_II_IOS_EMAIL "\xEF\x90\xA3" +#define ICON_II_IOS_EMAIL_OUTLINE "\xEF\x90\xA2" +#define ICON_II_IOS_EYE "\xEF\x90\xA5" +#define ICON_II_IOS_EYE_OUTLINE "\xEF\x90\xA4" +#define ICON_II_IOS_FASTFORWARD "\xEF\x90\xA7" +#define ICON_II_IOS_FASTFORWARD_OUTLINE "\xEF\x90\xA6" +#define ICON_II_IOS_FILING "\xEF\x90\xA9" +#define ICON_II_IOS_FILING_OUTLINE "\xEF\x90\xA8" +#define ICON_II_IOS_FILM "\xEF\x90\xAB" +#define ICON_II_IOS_FILM_OUTLINE "\xEF\x90\xAA" +#define ICON_II_IOS_FLAG "\xEF\x90\xAD" +#define ICON_II_IOS_FLAG_OUTLINE "\xEF\x90\xAC" +#define ICON_II_IOS_FLAME "\xEF\x90\xAF" +#define ICON_II_IOS_FLAME_OUTLINE "\xEF\x90\xAE" +#define ICON_II_IOS_FLASK "\xEF\x90\xB1" +#define ICON_II_IOS_FLASK_OUTLINE "\xEF\x90\xB0" +#define ICON_II_IOS_FLOWER "\xEF\x90\xB3" +#define ICON_II_IOS_FLOWER_OUTLINE "\xEF\x90\xB2" +#define ICON_II_IOS_FOLDER "\xEF\x90\xB5" +#define ICON_II_IOS_FOLDER_OUTLINE "\xEF\x90\xB4" +#define ICON_II_IOS_FOOTBALL "\xEF\x90\xB7" +#define ICON_II_IOS_FOOTBALL_OUTLINE "\xEF\x90\xB6" +#define ICON_II_IOS_GAME_CONTROLLER_A "\xEF\x90\xB9" +#define ICON_II_IOS_GAME_CONTROLLER_A_OUTLINE "\xEF\x90\xB8" +#define ICON_II_IOS_GAME_CONTROLLER_B "\xEF\x90\xBB" +#define ICON_II_IOS_GAME_CONTROLLER_B_OUTLINE "\xEF\x90\xBA" +#define ICON_II_IOS_GEAR "\xEF\x90\xBD" +#define ICON_II_IOS_GEAR_OUTLINE "\xEF\x90\xBC" +#define ICON_II_IOS_GLASSES "\xEF\x90\xBF" +#define ICON_II_IOS_GLASSES_OUTLINE "\xEF\x90\xBE" +#define ICON_II_IOS_GRID_VIEW "\xEF\x91\x81" +#define ICON_II_IOS_GRID_VIEW_OUTLINE "\xEF\x91\x80" +#define ICON_II_IOS_HEART "\xEF\x91\x83" +#define ICON_II_IOS_HEART_OUTLINE "\xEF\x91\x82" +#define ICON_II_IOS_HELP "\xEF\x91\x86" +#define ICON_II_IOS_HELP_EMPTY "\xEF\x91\x84" +#define ICON_II_IOS_HELP_OUTLINE "\xEF\x91\x85" +#define ICON_II_IOS_HOME "\xEF\x91\x88" +#define ICON_II_IOS_HOME_OUTLINE "\xEF\x91\x87" +#define ICON_II_IOS_INFINITE "\xEF\x91\x8A" +#define ICON_II_IOS_INFINITE_OUTLINE "\xEF\x91\x89" +#define ICON_II_IOS_INFORMATION "\xEF\x91\x8D" +#define ICON_II_IOS_INFORMATION_EMPTY "\xEF\x91\x8B" +#define ICON_II_IOS_INFORMATION_OUTLINE "\xEF\x91\x8C" +#define ICON_II_IOS_IONIC_OUTLINE "\xEF\x91\x8E" +#define ICON_II_IOS_KEYPAD "\xEF\x91\x90" +#define ICON_II_IOS_KEYPAD_OUTLINE "\xEF\x91\x8F" +#define ICON_II_IOS_LIGHTBULB "\xEF\x91\x92" +#define ICON_II_IOS_LIGHTBULB_OUTLINE "\xEF\x91\x91" +#define ICON_II_IOS_LIST "\xEF\x91\x94" +#define ICON_II_IOS_LIST_OUTLINE "\xEF\x91\x93" +#define ICON_II_IOS_LOCATION "\xEF\x91\x96" +#define ICON_II_IOS_LOCATION_OUTLINE "\xEF\x91\x95" +#define ICON_II_IOS_LOCKED "\xEF\x91\x98" +#define ICON_II_IOS_LOCKED_OUTLINE "\xEF\x91\x97" +#define ICON_II_IOS_LOOP "\xEF\x91\x9A" +#define ICON_II_IOS_LOOP_STRONG "\xEF\x91\x99" +#define ICON_II_IOS_MEDICAL "\xEF\x91\x9C" +#define ICON_II_IOS_MEDICAL_OUTLINE "\xEF\x91\x9B" +#define ICON_II_IOS_MEDKIT "\xEF\x91\x9E" +#define ICON_II_IOS_MEDKIT_OUTLINE "\xEF\x91\x9D" +#define ICON_II_IOS_MIC "\xEF\x91\xA1" +#define ICON_II_IOS_MIC_OFF "\xEF\x91\x9F" +#define ICON_II_IOS_MIC_OUTLINE "\xEF\x91\xA0" +#define ICON_II_IOS_MINUS "\xEF\x91\xA4" +#define ICON_II_IOS_MINUS_EMPTY "\xEF\x91\xA2" +#define ICON_II_IOS_MINUS_OUTLINE "\xEF\x91\xA3" +#define ICON_II_IOS_MONITOR "\xEF\x91\xA6" +#define ICON_II_IOS_MONITOR_OUTLINE "\xEF\x91\xA5" +#define ICON_II_IOS_MOON "\xEF\x91\xA8" +#define ICON_II_IOS_MOON_OUTLINE "\xEF\x91\xA7" +#define ICON_II_IOS_MORE "\xEF\x91\xAA" +#define ICON_II_IOS_MORE_OUTLINE "\xEF\x91\xA9" +#define ICON_II_IOS_MUSICAL_NOTE "\xEF\x91\xAB" +#define ICON_II_IOS_MUSICAL_NOTES "\xEF\x91\xAC" +#define ICON_II_IOS_NAVIGATE "\xEF\x91\xAE" +#define ICON_II_IOS_NAVIGATE_OUTLINE "\xEF\x91\xAD" +#define ICON_II_IOS_NUTRITION "\xEF\x91\xB0" +#define ICON_II_IOS_NUTRITION_OUTLINE "\xEF\x91\xAF" +#define ICON_II_IOS_PAPER "\xEF\x91\xB2" +#define ICON_II_IOS_PAPER_OUTLINE "\xEF\x91\xB1" +#define ICON_II_IOS_PAPERPLANE "\xEF\x91\xB4" +#define ICON_II_IOS_PAPERPLANE_OUTLINE "\xEF\x91\xB3" +#define ICON_II_IOS_PARTLYSUNNY "\xEF\x91\xB6" +#define ICON_II_IOS_PARTLYSUNNY_OUTLINE "\xEF\x91\xB5" +#define ICON_II_IOS_PAUSE "\xEF\x91\xB8" +#define ICON_II_IOS_PAUSE_OUTLINE "\xEF\x91\xB7" +#define ICON_II_IOS_PAW "\xEF\x91\xBA" +#define ICON_II_IOS_PAW_OUTLINE "\xEF\x91\xB9" +#define ICON_II_IOS_PEOPLE "\xEF\x91\xBC" +#define ICON_II_IOS_PEOPLE_OUTLINE "\xEF\x91\xBB" +#define ICON_II_IOS_PERSON "\xEF\x91\xBE" +#define ICON_II_IOS_PERSON_OUTLINE "\xEF\x91\xBD" +#define ICON_II_IOS_PERSONADD "\xEF\x92\x80" +#define ICON_II_IOS_PERSONADD_OUTLINE "\xEF\x91\xBF" +#define ICON_II_IOS_PHOTOS "\xEF\x92\x82" +#define ICON_II_IOS_PHOTOS_OUTLINE "\xEF\x92\x81" +#define ICON_II_IOS_PIE "\xEF\x92\x84" +#define ICON_II_IOS_PIE_OUTLINE "\xEF\x92\x83" +#define ICON_II_IOS_PINT "\xEF\x92\x86" +#define ICON_II_IOS_PINT_OUTLINE "\xEF\x92\x85" +#define ICON_II_IOS_PLAY "\xEF\x92\x88" +#define ICON_II_IOS_PLAY_OUTLINE "\xEF\x92\x87" +#define ICON_II_IOS_PLUS "\xEF\x92\x8B" +#define ICON_II_IOS_PLUS_EMPTY "\xEF\x92\x89" +#define ICON_II_IOS_PLUS_OUTLINE "\xEF\x92\x8A" +#define ICON_II_IOS_PRICETAG "\xEF\x92\x8D" +#define ICON_II_IOS_PRICETAG_OUTLINE "\xEF\x92\x8C" +#define ICON_II_IOS_PRICETAGS "\xEF\x92\x8F" +#define ICON_II_IOS_PRICETAGS_OUTLINE "\xEF\x92\x8E" +#define ICON_II_IOS_PRINTER "\xEF\x92\x91" +#define ICON_II_IOS_PRINTER_OUTLINE "\xEF\x92\x90" +#define ICON_II_IOS_PULSE "\xEF\x92\x93" +#define ICON_II_IOS_PULSE_STRONG "\xEF\x92\x92" +#define ICON_II_IOS_RAINY "\xEF\x92\x95" +#define ICON_II_IOS_RAINY_OUTLINE "\xEF\x92\x94" +#define ICON_II_IOS_RECORDING "\xEF\x92\x97" +#define ICON_II_IOS_RECORDING_OUTLINE "\xEF\x92\x96" +#define ICON_II_IOS_REDO "\xEF\x92\x99" +#define ICON_II_IOS_REDO_OUTLINE "\xEF\x92\x98" +#define ICON_II_IOS_REFRESH "\xEF\x92\x9C" +#define ICON_II_IOS_REFRESH_EMPTY "\xEF\x92\x9A" +#define ICON_II_IOS_REFRESH_OUTLINE "\xEF\x92\x9B" +#define ICON_II_IOS_RELOAD "\xEF\x92\x9D" +#define ICON_II_IOS_REVERSE_CAMERA "\xEF\x92\x9F" +#define ICON_II_IOS_REVERSE_CAMERA_OUTLINE "\xEF\x92\x9E" +#define ICON_II_IOS_REWIND "\xEF\x92\xA1" +#define ICON_II_IOS_REWIND_OUTLINE "\xEF\x92\xA0" +#define ICON_II_IOS_ROSE "\xEF\x92\xA3" +#define ICON_II_IOS_ROSE_OUTLINE "\xEF\x92\xA2" +#define ICON_II_IOS_SEARCH "\xEF\x92\xA5" +#define ICON_II_IOS_SEARCH_STRONG "\xEF\x92\xA4" +#define ICON_II_IOS_SETTINGS "\xEF\x92\xA7" +#define ICON_II_IOS_SETTINGS_STRONG "\xEF\x92\xA6" +#define ICON_II_IOS_SHUFFLE "\xEF\x92\xA9" +#define ICON_II_IOS_SHUFFLE_STRONG "\xEF\x92\xA8" +#define ICON_II_IOS_SKIPBACKWARD "\xEF\x92\xAB" +#define ICON_II_IOS_SKIPBACKWARD_OUTLINE "\xEF\x92\xAA" +#define ICON_II_IOS_SKIPFORWARD "\xEF\x92\xAD" +#define ICON_II_IOS_SKIPFORWARD_OUTLINE "\xEF\x92\xAC" +#define ICON_II_IOS_SNOWY "\xEF\x92\xAE" +#define ICON_II_IOS_SPEEDOMETER "\xEF\x92\xB0" +#define ICON_II_IOS_SPEEDOMETER_OUTLINE "\xEF\x92\xAF" +#define ICON_II_IOS_STAR "\xEF\x92\xB3" +#define ICON_II_IOS_STAR_HALF "\xEF\x92\xB1" +#define ICON_II_IOS_STAR_OUTLINE "\xEF\x92\xB2" +#define ICON_II_IOS_STOPWATCH "\xEF\x92\xB5" +#define ICON_II_IOS_STOPWATCH_OUTLINE "\xEF\x92\xB4" +#define ICON_II_IOS_SUNNY "\xEF\x92\xB7" +#define ICON_II_IOS_SUNNY_OUTLINE "\xEF\x92\xB6" +#define ICON_II_IOS_TELEPHONE "\xEF\x92\xB9" +#define ICON_II_IOS_TELEPHONE_OUTLINE "\xEF\x92\xB8" +#define ICON_II_IOS_TENNISBALL "\xEF\x92\xBB" +#define ICON_II_IOS_TENNISBALL_OUTLINE "\xEF\x92\xBA" +#define ICON_II_IOS_THUNDERSTORM "\xEF\x92\xBD" +#define ICON_II_IOS_THUNDERSTORM_OUTLINE "\xEF\x92\xBC" +#define ICON_II_IOS_TIME "\xEF\x92\xBF" +#define ICON_II_IOS_TIME_OUTLINE "\xEF\x92\xBE" +#define ICON_II_IOS_TIMER "\xEF\x93\x81" +#define ICON_II_IOS_TIMER_OUTLINE "\xEF\x93\x80" +#define ICON_II_IOS_TOGGLE "\xEF\x93\x83" +#define ICON_II_IOS_TOGGLE_OUTLINE "\xEF\x93\x82" +#define ICON_II_IOS_TRASH "\xEF\x93\x85" +#define ICON_II_IOS_TRASH_OUTLINE "\xEF\x93\x84" +#define ICON_II_IOS_UNDO "\xEF\x93\x87" +#define ICON_II_IOS_UNDO_OUTLINE "\xEF\x93\x86" +#define ICON_II_IOS_UNLOCKED "\xEF\x93\x89" +#define ICON_II_IOS_UNLOCKED_OUTLINE "\xEF\x93\x88" +#define ICON_II_IOS_UPLOAD "\xEF\x93\x8B" +#define ICON_II_IOS_UPLOAD_OUTLINE "\xEF\x93\x8A" +#define ICON_II_IOS_VIDEOCAM "\xEF\x93\x8D" +#define ICON_II_IOS_VIDEOCAM_OUTLINE "\xEF\x93\x8C" +#define ICON_II_IOS_VOLUME_HIGH "\xEF\x93\x8E" +#define ICON_II_IOS_VOLUME_LOW "\xEF\x93\x8F" +#define ICON_II_IOS_WINEGLASS "\xEF\x93\x91" +#define ICON_II_IOS_WINEGLASS_OUTLINE "\xEF\x93\x90" +#define ICON_II_IOS_WORLD "\xEF\x93\x93" +#define ICON_II_IOS_WORLD_OUTLINE "\xEF\x93\x92" +#define ICON_II_IPAD "\xEF\x87\xB9" +#define ICON_II_IPHONE "\xEF\x87\xBA" +#define ICON_II_IPOD "\xEF\x87\xBB" +#define ICON_II_JET "\xEF\x8A\x95" +#define ICON_II_KEY "\xEF\x8A\x96" +#define ICON_II_KNIFE "\xEF\x8A\x97" +#define ICON_II_LAPTOP "\xEF\x87\xBC" +#define ICON_II_LEAF "\xEF\x87\xBD" +#define ICON_II_LEVELS "\xEF\x8A\x98" +#define ICON_II_LIGHTBULB "\xEF\x8A\x99" +#define ICON_II_LINK "\xEF\x87\xBE" +#define ICON_II_LOAD_A "\xEF\x8A\x9A" +#define ICON_II_LOAD_B "\xEF\x8A\x9B" +#define ICON_II_LOAD_C "\xEF\x8A\x9C" +#define ICON_II_LOAD_D "\xEF\x8A\x9D" +#define ICON_II_LOCATION "\xEF\x87\xBF" +#define ICON_II_LOCK_COMBINATION "\xEF\x93\x94" +#define ICON_II_LOCKED "\xEF\x88\x80" +#define ICON_II_LOG_IN "\xEF\x8A\x9E" +#define ICON_II_LOG_OUT "\xEF\x8A\x9F" +#define ICON_II_LOOP "\xEF\x88\x81" +#define ICON_II_MAGNET "\xEF\x8A\xA0" +#define ICON_II_MALE "\xEF\x8A\xA1" +#define ICON_II_MAN "\xEF\x88\x82" +#define ICON_II_MAP "\xEF\x88\x83" +#define ICON_II_MEDKIT "\xEF\x8A\xA2" +#define ICON_II_MERGE "\xEF\x8C\xBF" +#define ICON_II_MIC_A "\xEF\x88\x84" +#define ICON_II_MIC_B "\xEF\x88\x85" +#define ICON_II_MIC_C "\xEF\x88\x86" +#define ICON_II_MINUS "\xEF\x88\x89" +#define ICON_II_MINUS_CIRCLED "\xEF\x88\x87" +#define ICON_II_MINUS_ROUND "\xEF\x88\x88" +#define ICON_II_MODEL_S "\xEF\x8B\x81" +#define ICON_II_MONITOR "\xEF\x88\x8A" +#define ICON_II_MORE "\xEF\x88\x8B" +#define ICON_II_MOUSE "\xEF\x8D\x80" +#define ICON_II_MUSIC_NOTE "\xEF\x88\x8C" +#define ICON_II_NAVICON "\xEF\x88\x8E" +#define ICON_II_NAVICON_ROUND "\xEF\x88\x8D" +#define ICON_II_NAVIGATE "\xEF\x8A\xA3" +#define ICON_II_NETWORK "\xEF\x8D\x81" +#define ICON_II_NO_SMOKING "\xEF\x8B\x82" +#define ICON_II_NUCLEAR "\xEF\x8A\xA4" +#define ICON_II_OUTLET "\xEF\x8D\x82" +#define ICON_II_PAINTBRUSH "\xEF\x93\x95" +#define ICON_II_PAINTBUCKET "\xEF\x93\x96" +#define ICON_II_PAPER_AIRPLANE "\xEF\x8B\x83" +#define ICON_II_PAPERCLIP "\xEF\x88\x8F" +#define ICON_II_PAUSE "\xEF\x88\x90" +#define ICON_II_PERSON "\xEF\x88\x93" +#define ICON_II_PERSON_ADD "\xEF\x88\x91" +#define ICON_II_PERSON_STALKER "\xEF\x88\x92" +#define ICON_II_PIE_GRAPH "\xEF\x8A\xA5" +#define ICON_II_PIN "\xEF\x8A\xA6" +#define ICON_II_PINPOINT "\xEF\x8A\xA7" +#define ICON_II_PIZZA "\xEF\x8A\xA8" +#define ICON_II_PLANE "\xEF\x88\x94" +#define ICON_II_PLANET "\xEF\x8D\x83" +#define ICON_II_PLAY "\xEF\x88\x95" +#define ICON_II_PLAYSTATION "\xEF\x8C\x8A" +#define ICON_II_PLUS "\xEF\x88\x98" +#define ICON_II_PLUS_CIRCLED "\xEF\x88\x96" +#define ICON_II_PLUS_ROUND "\xEF\x88\x97" +#define ICON_II_PODIUM "\xEF\x8D\x84" +#define ICON_II_POUND "\xEF\x88\x99" +#define ICON_II_POWER "\xEF\x8A\xA9" +#define ICON_II_PRICETAG "\xEF\x8A\xAA" +#define ICON_II_PRICETAGS "\xEF\x8A\xAB" +#define ICON_II_PRINTER "\xEF\x88\x9A" +#define ICON_II_PULL_REQUEST "\xEF\x8D\x85" +#define ICON_II_QR_SCANNER "\xEF\x8D\x86" +#define ICON_II_QUOTE "\xEF\x8D\x87" +#define ICON_II_RADIO_WAVES "\xEF\x8A\xAC" +#define ICON_II_RECORD "\xEF\x88\x9B" +#define ICON_II_REFRESH "\xEF\x88\x9C" +#define ICON_II_REPLY "\xEF\x88\x9E" +#define ICON_II_REPLY_ALL "\xEF\x88\x9D" +#define ICON_II_RIBBON_A "\xEF\x8D\x88" +#define ICON_II_RIBBON_B "\xEF\x8D\x89" +#define ICON_II_SAD "\xEF\x8D\x8A" +#define ICON_II_SAD_OUTLINE "\xEF\x93\x97" +#define ICON_II_SCISSORS "\xEF\x8D\x8B" +#define ICON_II_SEARCH "\xEF\x88\x9F" +#define ICON_II_SETTINGS "\xEF\x8A\xAD" +#define ICON_II_SHARE "\xEF\x88\xA0" +#define ICON_II_SHUFFLE "\xEF\x88\xA1" +#define ICON_II_SKIP_BACKWARD "\xEF\x88\xA2" +#define ICON_II_SKIP_FORWARD "\xEF\x88\xA3" +#define ICON_II_SOCIAL_ANDROID "\xEF\x88\xA5" +#define ICON_II_SOCIAL_ANDROID_OUTLINE "\xEF\x88\xA4" +#define ICON_II_SOCIAL_ANGULAR "\xEF\x93\x99" +#define ICON_II_SOCIAL_ANGULAR_OUTLINE "\xEF\x93\x98" +#define ICON_II_SOCIAL_APPLE "\xEF\x88\xA7" +#define ICON_II_SOCIAL_APPLE_OUTLINE "\xEF\x88\xA6" +#define ICON_II_SOCIAL_BITCOIN "\xEF\x8A\xAF" +#define ICON_II_SOCIAL_BITCOIN_OUTLINE "\xEF\x8A\xAE" +#define ICON_II_SOCIAL_BUFFER "\xEF\x88\xA9" +#define ICON_II_SOCIAL_BUFFER_OUTLINE "\xEF\x88\xA8" +#define ICON_II_SOCIAL_CHROME "\xEF\x93\x9B" +#define ICON_II_SOCIAL_CHROME_OUTLINE "\xEF\x93\x9A" +#define ICON_II_SOCIAL_CODEPEN "\xEF\x93\x9D" +#define ICON_II_SOCIAL_CODEPEN_OUTLINE "\xEF\x93\x9C" +#define ICON_II_SOCIAL_CSS3 "\xEF\x93\x9F" +#define ICON_II_SOCIAL_CSS3_OUTLINE "\xEF\x93\x9E" +#define ICON_II_SOCIAL_DESIGNERNEWS "\xEF\x88\xAB" +#define ICON_II_SOCIAL_DESIGNERNEWS_OUTLINE "\xEF\x88\xAA" +#define ICON_II_SOCIAL_DRIBBBLE "\xEF\x88\xAD" +#define ICON_II_SOCIAL_DRIBBBLE_OUTLINE "\xEF\x88\xAC" +#define ICON_II_SOCIAL_DROPBOX "\xEF\x88\xAF" +#define ICON_II_SOCIAL_DROPBOX_OUTLINE "\xEF\x88\xAE" +#define ICON_II_SOCIAL_EURO "\xEF\x93\xA1" +#define ICON_II_SOCIAL_EURO_OUTLINE "\xEF\x93\xA0" +#define ICON_II_SOCIAL_FACEBOOK "\xEF\x88\xB1" +#define ICON_II_SOCIAL_FACEBOOK_OUTLINE "\xEF\x88\xB0" +#define ICON_II_SOCIAL_FOURSQUARE "\xEF\x8D\x8D" +#define ICON_II_SOCIAL_FOURSQUARE_OUTLINE "\xEF\x8D\x8C" +#define ICON_II_SOCIAL_FREEBSD_DEVIL "\xEF\x8B\x84" +#define ICON_II_SOCIAL_GITHUB "\xEF\x88\xB3" +#define ICON_II_SOCIAL_GITHUB_OUTLINE "\xEF\x88\xB2" +#define ICON_II_SOCIAL_GOOGLE "\xEF\x8D\x8F" +#define ICON_II_SOCIAL_GOOGLE_OUTLINE "\xEF\x8D\x8E" +#define ICON_II_SOCIAL_GOOGLEPLUS "\xEF\x88\xB5" +#define ICON_II_SOCIAL_GOOGLEPLUS_OUTLINE "\xEF\x88\xB4" +#define ICON_II_SOCIAL_HACKERNEWS "\xEF\x88\xB7" +#define ICON_II_SOCIAL_HACKERNEWS_OUTLINE "\xEF\x88\xB6" +#define ICON_II_SOCIAL_HTML5 "\xEF\x93\xA3" +#define ICON_II_SOCIAL_HTML5_OUTLINE "\xEF\x93\xA2" +#define ICON_II_SOCIAL_INSTAGRAM "\xEF\x8D\x91" +#define ICON_II_SOCIAL_INSTAGRAM_OUTLINE "\xEF\x8D\x90" +#define ICON_II_SOCIAL_JAVASCRIPT "\xEF\x93\xA5" +#define ICON_II_SOCIAL_JAVASCRIPT_OUTLINE "\xEF\x93\xA4" +#define ICON_II_SOCIAL_LINKEDIN "\xEF\x88\xB9" +#define ICON_II_SOCIAL_LINKEDIN_OUTLINE "\xEF\x88\xB8" +#define ICON_II_SOCIAL_MARKDOWN "\xEF\x93\xA6" +#define ICON_II_SOCIAL_NODEJS "\xEF\x93\xA7" +#define ICON_II_SOCIAL_OCTOCAT "\xEF\x93\xA8" +#define ICON_II_SOCIAL_PINTEREST "\xEF\x8A\xB1" +#define ICON_II_SOCIAL_PINTEREST_OUTLINE "\xEF\x8A\xB0" +#define ICON_II_SOCIAL_PYTHON "\xEF\x93\xA9" +#define ICON_II_SOCIAL_REDDIT "\xEF\x88\xBB" +#define ICON_II_SOCIAL_REDDIT_OUTLINE "\xEF\x88\xBA" +#define ICON_II_SOCIAL_RSS "\xEF\x88\xBD" +#define ICON_II_SOCIAL_RSS_OUTLINE "\xEF\x88\xBC" +#define ICON_II_SOCIAL_SASS "\xEF\x93\xAA" +#define ICON_II_SOCIAL_SKYPE "\xEF\x88\xBF" +#define ICON_II_SOCIAL_SKYPE_OUTLINE "\xEF\x88\xBE" +#define ICON_II_SOCIAL_SNAPCHAT "\xEF\x93\xAC" +#define ICON_II_SOCIAL_SNAPCHAT_OUTLINE "\xEF\x93\xAB" +#define ICON_II_SOCIAL_TUMBLR "\xEF\x89\x81" +#define ICON_II_SOCIAL_TUMBLR_OUTLINE "\xEF\x89\x80" +#define ICON_II_SOCIAL_TUX "\xEF\x8B\x85" +#define ICON_II_SOCIAL_TWITCH "\xEF\x93\xAE" +#define ICON_II_SOCIAL_TWITCH_OUTLINE "\xEF\x93\xAD" +#define ICON_II_SOCIAL_TWITTER "\xEF\x89\x83" +#define ICON_II_SOCIAL_TWITTER_OUTLINE "\xEF\x89\x82" +#define ICON_II_SOCIAL_USD "\xEF\x8D\x93" +#define ICON_II_SOCIAL_USD_OUTLINE "\xEF\x8D\x92" +#define ICON_II_SOCIAL_VIMEO "\xEF\x89\x85" +#define ICON_II_SOCIAL_VIMEO_OUTLINE "\xEF\x89\x84" +#define ICON_II_SOCIAL_WHATSAPP "\xEF\x93\xB0" +#define ICON_II_SOCIAL_WHATSAPP_OUTLINE "\xEF\x93\xAF" +#define ICON_II_SOCIAL_WINDOWS "\xEF\x89\x87" +#define ICON_II_SOCIAL_WINDOWS_OUTLINE "\xEF\x89\x86" +#define ICON_II_SOCIAL_WORDPRESS "\xEF\x89\x89" +#define ICON_II_SOCIAL_WORDPRESS_OUTLINE "\xEF\x89\x88" +#define ICON_II_SOCIAL_YAHOO "\xEF\x89\x8B" +#define ICON_II_SOCIAL_YAHOO_OUTLINE "\xEF\x89\x8A" +#define ICON_II_SOCIAL_YEN "\xEF\x93\xB2" +#define ICON_II_SOCIAL_YEN_OUTLINE "\xEF\x93\xB1" +#define ICON_II_SOCIAL_YOUTUBE "\xEF\x89\x8D" +#define ICON_II_SOCIAL_YOUTUBE_OUTLINE "\xEF\x89\x8C" +#define ICON_II_SOUP_CAN "\xEF\x93\xB4" +#define ICON_II_SOUP_CAN_OUTLINE "\xEF\x93\xB3" +#define ICON_II_SPEAKERPHONE "\xEF\x8A\xB2" +#define ICON_II_SPEEDOMETER "\xEF\x8A\xB3" +#define ICON_II_SPOON "\xEF\x8A\xB4" +#define ICON_II_STAR "\xEF\x89\x8E" +#define ICON_II_STATS_BARS "\xEF\x8A\xB5" +#define ICON_II_STEAM "\xEF\x8C\x8B" +#define ICON_II_STOP "\xEF\x89\x8F" +#define ICON_II_THERMOMETER "\xEF\x8A\xB6" +#define ICON_II_THUMBSDOWN "\xEF\x89\x90" +#define ICON_II_THUMBSUP "\xEF\x89\x91" +#define ICON_II_TOGGLE "\xEF\x8D\x95" +#define ICON_II_TOGGLE_FILLED "\xEF\x8D\x94" +#define ICON_II_TRANSGENDER "\xEF\x93\xB5" +#define ICON_II_TRASH_A "\xEF\x89\x92" +#define ICON_II_TRASH_B "\xEF\x89\x93" +#define ICON_II_TROPHY "\xEF\x8D\x96" +#define ICON_II_TSHIRT "\xEF\x93\xB7" +#define ICON_II_TSHIRT_OUTLINE "\xEF\x93\xB6" +#define ICON_II_UMBRELLA "\xEF\x8A\xB7" +#define ICON_II_UNIVERSITY "\xEF\x8D\x97" +#define ICON_II_UNLOCKED "\xEF\x89\x94" +#define ICON_II_UPLOAD "\xEF\x89\x95" +#define ICON_II_USB "\xEF\x8A\xB8" +#define ICON_II_VIDEOCAMERA "\xEF\x89\x96" +#define ICON_II_VOLUME_HIGH "\xEF\x89\x97" +#define ICON_II_VOLUME_LOW "\xEF\x89\x98" +#define ICON_II_VOLUME_MEDIUM "\xEF\x89\x99" +#define ICON_II_VOLUME_MUTE "\xEF\x89\x9A" +#define ICON_II_WAND "\xEF\x8D\x98" +#define ICON_II_WATERDROP "\xEF\x89\x9B" +#define ICON_II_WIFI "\xEF\x89\x9C" +#define ICON_II_WINEGLASS "\xEF\x8A\xB9" +#define ICON_II_WOMAN "\xEF\x89\x9D" +#define ICON_II_WRENCH "\xEF\x8A\xBA" +#define ICON_II_XBOX "\xEF\x8C\x8C" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h index 0d9d313dae3..4001c110511 100644 --- a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_kenney.h @@ -1,8 +1,10 @@ -// Generated by GenerateIconFontCppHeaders.py for language C89 -// from https://raw.githubusercontent.com/SamBrishes/kenney-icon-font/master/css/kenney-icons.css -// for use with https://github.com/SamBrishes/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/nicodinh/kenney-icon-font/master/css/kenney-icons.css +// for use with https://github.com/nicodinh/kenney-icon-font/blob/master/fonts/kenney-icon-font.ttf #pragma once +#define FONT_ICON_FILE_NAME_KI "kenney-icon-font.ttf" + #define ICON_MIN_KI 0xe900 #define ICON_MAX_KI 0xe9e3 #define ICON_KI_HOME "\xEE\xA4\x80" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h index 68213f6f389..dc1a98d16e9 100644 --- a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design.h @@ -1,8 +1,10 @@ -// Generated by GenerateIconFontCppHeaders.py for language C89 +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 // from https://raw.githubusercontent.com/google/material-design-icons/master/iconfont/codepoints // for use with https://github.com/google/material-design-icons/blob/master/iconfont/MaterialIcons-Regular.ttf #pragma once +#define FONT_ICON_FILE_NAME_MD "MaterialIcons-Regular.ttf" + #define ICON_MIN_MD 0xe000 #define ICON_MAX_MD 0xeb4c #define ICON_MD_3D_ROTATION "\xEE\xA1\x8D" diff --git a/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design_icons.h b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design_icons.h new file mode 100644 index 00000000000..9d0816a773d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/iconfontheaders/icons_material_design_icons.h @@ -0,0 +1,2604 @@ +// Generated by https://github.com/juliettef/IconFontCppHeaders script GenerateIconFontCppHeaders.py for language C89 +// from https://raw.githubusercontent.com/Templarian/MaterialDesign-Webfont/master/css/materialdesignicons.css +// for use with https://github.com/Templarian/MaterialDesign-Webfont/blob/master/fonts/materialdesignicons-webfont.ttf +#pragma once + +#define FONT_ICON_FILE_NAME_MDI "materialdesignicons-webfont.ttf" + +#define ICON_MIN_MDI 0xF001 +#define ICON_MAX_MDI 0xFA22 +#define ICON_MDI_ACCESS_POINT "\xEF\x80\x82" +#define ICON_MDI_ACCESS_POINT_NETWORK "\xEF\x80\x83" +#define ICON_MDI_ACCOUNT "\xEF\x80\x84" +#define ICON_MDI_ACCOUNT_ALERT "\xEF\x80\x85" +#define ICON_MDI_ACCOUNT_BOX "\xEF\x80\x86" +#define ICON_MDI_ACCOUNT_BOX_MULTIPLE "\xEF\xA4\xB3" +#define ICON_MDI_ACCOUNT_BOX_OUTLINE "\xEF\x80\x87" +#define ICON_MDI_ACCOUNT_CARD_DETAILS "\xEF\x97\x92" +#define ICON_MDI_ACCOUNT_CHECK "\xEF\x80\x88" +#define ICON_MDI_ACCOUNT_CIRCLE "\xEF\x80\x89" +#define ICON_MDI_ACCOUNT_CONVERT "\xEF\x80\x8A" +#define ICON_MDI_ACCOUNT_EDIT "\xEF\x9A\xBB" +#define ICON_MDI_ACCOUNT_GROUP "\xEF\xA1\x88" +#define ICON_MDI_ACCOUNT_HEART "\xEF\xA2\x98" +#define ICON_MDI_ACCOUNT_KEY "\xEF\x80\x8B" +#define ICON_MDI_ACCOUNT_LOCATION "\xEF\x80\x8C" +#define ICON_MDI_ACCOUNT_MINUS "\xEF\x80\x8D" +#define ICON_MDI_ACCOUNT_MULTIPLE "\xEF\x80\x8E" +#define ICON_MDI_ACCOUNT_MULTIPLE_CHECK "\xEF\xA3\x84" +#define ICON_MDI_ACCOUNT_MULTIPLE_MINUS "\xEF\x97\x93" +#define ICON_MDI_ACCOUNT_MULTIPLE_OUTLINE "\xEF\x80\x8F" +#define ICON_MDI_ACCOUNT_MULTIPLE_PLUS "\xEF\x80\x90" +#define ICON_MDI_ACCOUNT_MULTIPLE_PLUS_OUTLINE "\xEF\x9F\xBF" +#define ICON_MDI_ACCOUNT_NETWORK "\xEF\x80\x91" +#define ICON_MDI_ACCOUNT_OFF "\xEF\x80\x92" +#define ICON_MDI_ACCOUNT_OUTLINE "\xEF\x80\x93" +#define ICON_MDI_ACCOUNT_PLUS "\xEF\x80\x94" +#define ICON_MDI_ACCOUNT_PLUS_OUTLINE "\xEF\xA0\x80" +#define ICON_MDI_ACCOUNT_REMOVE "\xEF\x80\x95" +#define ICON_MDI_ACCOUNT_SEARCH "\xEF\x80\x96" +#define ICON_MDI_ACCOUNT_SEARCH_OUTLINE "\xEF\xA4\xB4" +#define ICON_MDI_ACCOUNT_SETTINGS "\xEF\x98\xB0" +#define ICON_MDI_ACCOUNT_SETTINGS_VARIANT "\xEF\x98\xB1" +#define ICON_MDI_ACCOUNT_STAR "\xEF\x80\x97" +#define ICON_MDI_ACCOUNT_SWITCH "\xEF\x80\x99" +#define ICON_MDI_ACCUSOFT "\xEF\xA1\x89" +#define ICON_MDI_ADJUST "\xEF\x80\x9A" +#define ICON_MDI_ADOBE "\xEF\xA4\xB5" +#define ICON_MDI_AIR_CONDITIONER "\xEF\x80\x9B" +#define ICON_MDI_AIRBALLOON "\xEF\x80\x9C" +#define ICON_MDI_AIRPLANE "\xEF\x80\x9D" +#define ICON_MDI_AIRPLANE_LANDING "\xEF\x97\x94" +#define ICON_MDI_AIRPLANE_OFF "\xEF\x80\x9E" +#define ICON_MDI_AIRPLANE_TAKEOFF "\xEF\x97\x95" +#define ICON_MDI_AIRPLAY "\xEF\x80\x9F" +#define ICON_MDI_AIRPORT "\xEF\xA1\x8A" +#define ICON_MDI_ALARM "\xEF\x80\xA0" +#define ICON_MDI_ALARM_BELL "\xEF\x9E\x8D" +#define ICON_MDI_ALARM_CHECK "\xEF\x80\xA1" +#define ICON_MDI_ALARM_LIGHT "\xEF\x9E\x8E" +#define ICON_MDI_ALARM_MULTIPLE "\xEF\x80\xA2" +#define ICON_MDI_ALARM_OFF "\xEF\x80\xA3" +#define ICON_MDI_ALARM_PLUS "\xEF\x80\xA4" +#define ICON_MDI_ALARM_SNOOZE "\xEF\x9A\x8D" +#define ICON_MDI_ALBUM "\xEF\x80\xA5" +#define ICON_MDI_ALERT "\xEF\x80\xA6" +#define ICON_MDI_ALERT_BOX "\xEF\x80\xA7" +#define ICON_MDI_ALERT_CIRCLE "\xEF\x80\xA8" +#define ICON_MDI_ALERT_CIRCLE_OUTLINE "\xEF\x97\x96" +#define ICON_MDI_ALERT_DECAGRAM "\xEF\x9A\xBC" +#define ICON_MDI_ALERT_OCTAGON "\xEF\x80\xA9" +#define ICON_MDI_ALERT_OCTAGRAM "\xEF\x9D\xA6" +#define ICON_MDI_ALERT_OUTLINE "\xEF\x80\xAA" +#define ICON_MDI_ALIEN "\xEF\xA2\x99" +#define ICON_MDI_ALL_INCLUSIVE "\xEF\x9A\xBD" +#define ICON_MDI_ALPHA "\xEF\x80\xAB" +#define ICON_MDI_ALPHABETICAL "\xEF\x80\xAC" +#define ICON_MDI_ALTIMETER "\xEF\x97\x97" +#define ICON_MDI_AMAZON "\xEF\x80\xAD" +#define ICON_MDI_AMAZON_ALEXA "\xEF\xA3\x85" +#define ICON_MDI_AMAZON_DRIVE "\xEF\x80\xAE" +#define ICON_MDI_AMBULANCE "\xEF\x80\xAF" +#define ICON_MDI_AMPLIFIER "\xEF\x80\xB0" +#define ICON_MDI_ANCHOR "\xEF\x80\xB1" +#define ICON_MDI_ANDROID "\xEF\x80\xB2" +#define ICON_MDI_ANDROID_DEBUG_BRIDGE "\xEF\x80\xB3" +#define ICON_MDI_ANDROID_HEAD "\xEF\x9E\x8F" +#define ICON_MDI_ANDROID_STUDIO "\xEF\x80\xB4" +#define ICON_MDI_ANGLE_ACUTE "\xEF\xA4\xB6" +#define ICON_MDI_ANGLE_OBTUSE "\xEF\xA4\xB7" +#define ICON_MDI_ANGLE_RIGHT "\xEF\xA4\xB8" +#define ICON_MDI_ANGULAR "\xEF\x9A\xB1" +#define ICON_MDI_ANGULARJS "\xEF\x9A\xBE" +#define ICON_MDI_ANIMATION "\xEF\x97\x98" +#define ICON_MDI_ANIMATION_PLAY "\xEF\xA4\xB9" +#define ICON_MDI_ANVIL "\xEF\xA2\x9A" +#define ICON_MDI_APPLE "\xEF\x80\xB5" +#define ICON_MDI_APPLE_FINDER "\xEF\x80\xB6" +#define ICON_MDI_APPLE_ICLOUD "\xEF\x80\xB8" +#define ICON_MDI_APPLE_IOS "\xEF\x80\xB7" +#define ICON_MDI_APPLE_KEYBOARD_CAPS "\xEF\x98\xB2" +#define ICON_MDI_APPLE_KEYBOARD_COMMAND "\xEF\x98\xB3" +#define ICON_MDI_APPLE_KEYBOARD_CONTROL "\xEF\x98\xB4" +#define ICON_MDI_APPLE_KEYBOARD_OPTION "\xEF\x98\xB5" +#define ICON_MDI_APPLE_KEYBOARD_SHIFT "\xEF\x98\xB6" +#define ICON_MDI_APPLE_SAFARI "\xEF\x80\xB9" +#define ICON_MDI_APPLICATION "\xEF\x98\x94" +#define ICON_MDI_APPROVAL "\xEF\x9E\x90" +#define ICON_MDI_APPS "\xEF\x80\xBB" +#define ICON_MDI_ARCH "\xEF\xA3\x86" +#define ICON_MDI_ARCHIVE "\xEF\x80\xBC" +#define ICON_MDI_ARRANGE_BRING_FORWARD "\xEF\x80\xBD" +#define ICON_MDI_ARRANGE_BRING_TO_FRONT "\xEF\x80\xBE" +#define ICON_MDI_ARRANGE_SEND_BACKWARD "\xEF\x80\xBF" +#define ICON_MDI_ARRANGE_SEND_TO_BACK "\xEF\x81\x80" +#define ICON_MDI_ARROW_ALL "\xEF\x81\x81" +#define ICON_MDI_ARROW_BOTTOM_LEFT "\xEF\x81\x82" +#define ICON_MDI_ARROW_BOTTOM_LEFT_BOLD_OUTLINE "\xEF\xA6\xB6" +#define ICON_MDI_ARROW_BOTTOM_LEFT_THICK "\xEF\xA6\xB7" +#define ICON_MDI_ARROW_BOTTOM_RIGHT "\xEF\x81\x83" +#define ICON_MDI_ARROW_BOTTOM_RIGHT_BOLD_OUTLINE "\xEF\xA6\xB8" +#define ICON_MDI_ARROW_BOTTOM_RIGHT_THICK "\xEF\xA6\xB9" +#define ICON_MDI_ARROW_COLLAPSE "\xEF\x98\x95" +#define ICON_MDI_ARROW_COLLAPSE_ALL "\xEF\x81\x84" +#define ICON_MDI_ARROW_COLLAPSE_DOWN "\xEF\x9E\x91" +#define ICON_MDI_ARROW_COLLAPSE_HORIZONTAL "\xEF\xA1\x8B" +#define ICON_MDI_ARROW_COLLAPSE_LEFT "\xEF\x9E\x92" +#define ICON_MDI_ARROW_COLLAPSE_RIGHT "\xEF\x9E\x93" +#define ICON_MDI_ARROW_COLLAPSE_UP "\xEF\x9E\x94" +#define ICON_MDI_ARROW_COLLAPSE_VERTICAL "\xEF\xA1\x8C" +#define ICON_MDI_ARROW_DECISION "\xEF\xA6\xBA" +#define ICON_MDI_ARROW_DECISION_AUTO "\xEF\xA6\xBB" +#define ICON_MDI_ARROW_DECISION_AUTO_OUTLINE "\xEF\xA6\xBC" +#define ICON_MDI_ARROW_DECISION_OUTLINE "\xEF\xA6\xBD" +#define ICON_MDI_ARROW_DOWN "\xEF\x81\x85" +#define ICON_MDI_ARROW_DOWN_BOLD "\xEF\x9C\xAD" +#define ICON_MDI_ARROW_DOWN_BOLD_BOX "\xEF\x9C\xAE" +#define ICON_MDI_ARROW_DOWN_BOLD_BOX_OUTLINE "\xEF\x9C\xAF" +#define ICON_MDI_ARROW_DOWN_BOLD_CIRCLE "\xEF\x81\x87" +#define ICON_MDI_ARROW_DOWN_BOLD_CIRCLE_OUTLINE "\xEF\x81\x88" +#define ICON_MDI_ARROW_DOWN_BOLD_HEXAGON_OUTLINE "\xEF\x81\x89" +#define ICON_MDI_ARROW_DOWN_BOLD_OUTLINE "\xEF\xA6\xBE" +#define ICON_MDI_ARROW_DOWN_BOX "\xEF\x9A\xBF" +#define ICON_MDI_ARROW_DOWN_DROP_CIRCLE "\xEF\x81\x8A" +#define ICON_MDI_ARROW_DOWN_DROP_CIRCLE_OUTLINE "\xEF\x81\x8B" +#define ICON_MDI_ARROW_DOWN_THICK "\xEF\x81\x86" +#define ICON_MDI_ARROW_EXPAND "\xEF\x98\x96" +#define ICON_MDI_ARROW_EXPAND_ALL "\xEF\x81\x8C" +#define ICON_MDI_ARROW_EXPAND_DOWN "\xEF\x9E\x95" +#define ICON_MDI_ARROW_EXPAND_HORIZONTAL "\xEF\xA1\x8D" +#define ICON_MDI_ARROW_EXPAND_LEFT "\xEF\x9E\x96" +#define ICON_MDI_ARROW_EXPAND_RIGHT "\xEF\x9E\x97" +#define ICON_MDI_ARROW_EXPAND_UP "\xEF\x9E\x98" +#define ICON_MDI_ARROW_EXPAND_VERTICAL "\xEF\xA1\x8E" +#define ICON_MDI_ARROW_LEFT "\xEF\x81\x8D" +#define ICON_MDI_ARROW_LEFT_BOLD "\xEF\x9C\xB0" +#define ICON_MDI_ARROW_LEFT_BOLD_BOX "\xEF\x9C\xB1" +#define ICON_MDI_ARROW_LEFT_BOLD_BOX_OUTLINE "\xEF\x9C\xB2" +#define ICON_MDI_ARROW_LEFT_BOLD_CIRCLE "\xEF\x81\x8F" +#define ICON_MDI_ARROW_LEFT_BOLD_CIRCLE_OUTLINE "\xEF\x81\x90" +#define ICON_MDI_ARROW_LEFT_BOLD_HEXAGON_OUTLINE "\xEF\x81\x91" +#define ICON_MDI_ARROW_LEFT_BOLD_OUTLINE "\xEF\xA6\xBF" +#define ICON_MDI_ARROW_LEFT_BOX "\xEF\x9B\x80" +#define ICON_MDI_ARROW_LEFT_DROP_CIRCLE "\xEF\x81\x92" +#define ICON_MDI_ARROW_LEFT_DROP_CIRCLE_OUTLINE "\xEF\x81\x93" +#define ICON_MDI_ARROW_LEFT_RIGHT_BOLD_OUTLINE "\xEF\xA7\x80" +#define ICON_MDI_ARROW_LEFT_THICK "\xEF\x81\x8E" +#define ICON_MDI_ARROW_RIGHT "\xEF\x81\x94" +#define ICON_MDI_ARROW_RIGHT_BOLD "\xEF\x9C\xB3" +#define ICON_MDI_ARROW_RIGHT_BOLD_BOX "\xEF\x9C\xB4" +#define ICON_MDI_ARROW_RIGHT_BOLD_BOX_OUTLINE "\xEF\x9C\xB5" +#define ICON_MDI_ARROW_RIGHT_BOLD_CIRCLE "\xEF\x81\x96" +#define ICON_MDI_ARROW_RIGHT_BOLD_CIRCLE_OUTLINE "\xEF\x81\x97" +#define ICON_MDI_ARROW_RIGHT_BOLD_HEXAGON_OUTLINE "\xEF\x81\x98" +#define ICON_MDI_ARROW_RIGHT_BOLD_OUTLINE "\xEF\xA7\x81" +#define ICON_MDI_ARROW_RIGHT_BOX "\xEF\x9B\x81" +#define ICON_MDI_ARROW_RIGHT_DROP_CIRCLE "\xEF\x81\x99" +#define ICON_MDI_ARROW_RIGHT_DROP_CIRCLE_OUTLINE "\xEF\x81\x9A" +#define ICON_MDI_ARROW_RIGHT_THICK "\xEF\x81\x95" +#define ICON_MDI_ARROW_SPLIT_HORIZONTAL "\xEF\xA4\xBA" +#define ICON_MDI_ARROW_SPLIT_VERTICAL "\xEF\xA4\xBB" +#define ICON_MDI_ARROW_TOP_LEFT "\xEF\x81\x9B" +#define ICON_MDI_ARROW_TOP_LEFT_BOLD_OUTLINE "\xEF\xA7\x82" +#define ICON_MDI_ARROW_TOP_LEFT_THICK "\xEF\xA7\x83" +#define ICON_MDI_ARROW_TOP_RIGHT "\xEF\x81\x9C" +#define ICON_MDI_ARROW_TOP_RIGHT_BOLD_OUTLINE "\xEF\xA7\x84" +#define ICON_MDI_ARROW_TOP_RIGHT_THICK "\xEF\xA7\x85" +#define ICON_MDI_ARROW_UP "\xEF\x81\x9D" +#define ICON_MDI_ARROW_UP_BOLD "\xEF\x9C\xB6" +#define ICON_MDI_ARROW_UP_BOLD_BOX "\xEF\x9C\xB7" +#define ICON_MDI_ARROW_UP_BOLD_BOX_OUTLINE "\xEF\x9C\xB8" +#define ICON_MDI_ARROW_UP_BOLD_CIRCLE "\xEF\x81\x9F" +#define ICON_MDI_ARROW_UP_BOLD_CIRCLE_OUTLINE "\xEF\x81\xA0" +#define ICON_MDI_ARROW_UP_BOLD_HEXAGON_OUTLINE "\xEF\x81\xA1" +#define ICON_MDI_ARROW_UP_BOLD_OUTLINE "\xEF\xA7\x86" +#define ICON_MDI_ARROW_UP_BOX "\xEF\x9B\x82" +#define ICON_MDI_ARROW_UP_DOWN_BOLD_OUTLINE "\xEF\xA7\x87" +#define ICON_MDI_ARROW_UP_DROP_CIRCLE "\xEF\x81\xA2" +#define ICON_MDI_ARROW_UP_DROP_CIRCLE_OUTLINE "\xEF\x81\xA3" +#define ICON_MDI_ARROW_UP_THICK "\xEF\x81\x9E" +#define ICON_MDI_ARTIST "\xEF\xA0\x82" +#define ICON_MDI_ASSISTANT "\xEF\x81\xA4" +#define ICON_MDI_ASTERISK "\xEF\x9B\x83" +#define ICON_MDI_AT "\xEF\x81\xA5" +#define ICON_MDI_ATLASSIAN "\xEF\xA0\x83" +#define ICON_MDI_ATOM "\xEF\x9D\xA7" +#define ICON_MDI_ATTACHMENT "\xEF\x81\xA6" +#define ICON_MDI_AUDIO_VIDEO "\xEF\xA4\xBC" +#define ICON_MDI_AUDIOBOOK "\xEF\x81\xA7" +#define ICON_MDI_AUGMENTED_REALITY "\xEF\xA1\x8F" +#define ICON_MDI_AUTO_FIX "\xEF\x81\xA8" +#define ICON_MDI_AUTO_UPLOAD "\xEF\x81\xA9" +#define ICON_MDI_AUTORENEW "\xEF\x81\xAA" +#define ICON_MDI_AV_TIMER "\xEF\x81\xAB" +#define ICON_MDI_AXE "\xEF\xA3\x87" +#define ICON_MDI_AZURE "\xEF\xA0\x84" +#define ICON_MDI_BABY "\xEF\x81\xAC" +#define ICON_MDI_BABY_BUGGY "\xEF\x9A\x8E" +#define ICON_MDI_BACKBURGER "\xEF\x81\xAD" +#define ICON_MDI_BACKSPACE "\xEF\x81\xAE" +#define ICON_MDI_BACKUP_RESTORE "\xEF\x81\xAF" +#define ICON_MDI_BADMINTON "\xEF\xA1\x90" +#define ICON_MDI_BALLOT "\xEF\xA7\x88" +#define ICON_MDI_BALLOT_OUTLINE "\xEF\xA7\x89" +#define ICON_MDI_BANDCAMP "\xEF\x99\xB4" +#define ICON_MDI_BANK "\xEF\x81\xB0" +#define ICON_MDI_BARCODE "\xEF\x81\xB1" +#define ICON_MDI_BARCODE_SCAN "\xEF\x81\xB2" +#define ICON_MDI_BARLEY "\xEF\x81\xB3" +#define ICON_MDI_BARREL "\xEF\x81\xB4" +#define ICON_MDI_BASEBALL "\xEF\xA1\x91" +#define ICON_MDI_BASEBALL_BAT "\xEF\xA1\x92" +#define ICON_MDI_BASECAMP "\xEF\x81\xB5" +#define ICON_MDI_BASKET "\xEF\x81\xB6" +#define ICON_MDI_BASKET_FILL "\xEF\x81\xB7" +#define ICON_MDI_BASKET_UNFILL "\xEF\x81\xB8" +#define ICON_MDI_BASKETBALL "\xEF\xA0\x85" +#define ICON_MDI_BATTERY "\xEF\x81\xB9" +#define ICON_MDI_BATTERY_10 "\xEF\x81\xBA" +#define ICON_MDI_BATTERY_10_BLUETOOTH "\xEF\xA4\xBD" +#define ICON_MDI_BATTERY_20 "\xEF\x81\xBB" +#define ICON_MDI_BATTERY_20_BLUETOOTH "\xEF\xA4\xBE" +#define ICON_MDI_BATTERY_30 "\xEF\x81\xBC" +#define ICON_MDI_BATTERY_30_BLUETOOTH "\xEF\xA4\xBF" +#define ICON_MDI_BATTERY_40 "\xEF\x81\xBD" +#define ICON_MDI_BATTERY_40_BLUETOOTH "\xEF\xA5\x80" +#define ICON_MDI_BATTERY_50 "\xEF\x81\xBE" +#define ICON_MDI_BATTERY_50_BLUETOOTH "\xEF\xA5\x81" +#define ICON_MDI_BATTERY_60 "\xEF\x81\xBF" +#define ICON_MDI_BATTERY_60_BLUETOOTH "\xEF\xA5\x82" +#define ICON_MDI_BATTERY_70 "\xEF\x82\x80" +#define ICON_MDI_BATTERY_70_BLUETOOTH "\xEF\xA5\x83" +#define ICON_MDI_BATTERY_80 "\xEF\x82\x81" +#define ICON_MDI_BATTERY_80_BLUETOOTH "\xEF\xA5\x84" +#define ICON_MDI_BATTERY_90 "\xEF\x82\x82" +#define ICON_MDI_BATTERY_90_BLUETOOTH "\xEF\xA5\x85" +#define ICON_MDI_BATTERY_ALERT "\xEF\x82\x83" +#define ICON_MDI_BATTERY_ALERT_BLUETOOTH "\xEF\xA5\x86" +#define ICON_MDI_BATTERY_BLUETOOTH "\xEF\xA5\x87" +#define ICON_MDI_BATTERY_BLUETOOTH_VARIANT "\xEF\xA5\x88" +#define ICON_MDI_BATTERY_CHARGING "\xEF\x82\x84" +#define ICON_MDI_BATTERY_CHARGING_10 "\xEF\xA2\x9B" +#define ICON_MDI_BATTERY_CHARGING_100 "\xEF\x82\x85" +#define ICON_MDI_BATTERY_CHARGING_20 "\xEF\x82\x86" +#define ICON_MDI_BATTERY_CHARGING_30 "\xEF\x82\x87" +#define ICON_MDI_BATTERY_CHARGING_40 "\xEF\x82\x88" +#define ICON_MDI_BATTERY_CHARGING_50 "\xEF\xA2\x9C" +#define ICON_MDI_BATTERY_CHARGING_60 "\xEF\x82\x89" +#define ICON_MDI_BATTERY_CHARGING_70 "\xEF\xA2\x9D" +#define ICON_MDI_BATTERY_CHARGING_80 "\xEF\x82\x8A" +#define ICON_MDI_BATTERY_CHARGING_90 "\xEF\x82\x8B" +#define ICON_MDI_BATTERY_CHARGING_OUTLINE "\xEF\xA2\x9E" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS "\xEF\xA0\x86" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_10 "\xEF\xA0\x87" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_20 "\xEF\xA0\x88" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_30 "\xEF\xA0\x89" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_40 "\xEF\xA0\x8A" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_50 "\xEF\xA0\x8B" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_60 "\xEF\xA0\x8C" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_70 "\xEF\xA0\x8D" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_80 "\xEF\xA0\x8E" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_90 "\xEF\xA0\x8F" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_ALERT "\xEF\xA0\x90" +#define ICON_MDI_BATTERY_CHARGING_WIRELESS_OUTLINE "\xEF\xA0\x91" +#define ICON_MDI_BATTERY_MINUS "\xEF\x82\x8C" +#define ICON_MDI_BATTERY_NEGATIVE "\xEF\x82\x8D" +#define ICON_MDI_BATTERY_OUTLINE "\xEF\x82\x8E" +#define ICON_MDI_BATTERY_PLUS "\xEF\x82\x8F" +#define ICON_MDI_BATTERY_POSITIVE "\xEF\x82\x90" +#define ICON_MDI_BATTERY_UNKNOWN "\xEF\x82\x91" +#define ICON_MDI_BATTERY_UNKNOWN_BLUETOOTH "\xEF\xA5\x89" +#define ICON_MDI_BEACH "\xEF\x82\x92" +#define ICON_MDI_BEAKER "\xEF\x9A\x8F" +#define ICON_MDI_BEATS "\xEF\x82\x97" +#define ICON_MDI_BED_EMPTY "\xEF\xA2\x9F" +#define ICON_MDI_BEER "\xEF\x82\x98" +#define ICON_MDI_BEHANCE "\xEF\x82\x99" +#define ICON_MDI_BELL "\xEF\x82\x9A" +#define ICON_MDI_BELL_OFF "\xEF\x82\x9B" +#define ICON_MDI_BELL_OUTLINE "\xEF\x82\x9C" +#define ICON_MDI_BELL_PLUS "\xEF\x82\x9D" +#define ICON_MDI_BELL_RING "\xEF\x82\x9E" +#define ICON_MDI_BELL_RING_OUTLINE "\xEF\x82\x9F" +#define ICON_MDI_BELL_SLEEP "\xEF\x82\xA0" +#define ICON_MDI_BETA "\xEF\x82\xA1" +#define ICON_MDI_BETAMAX "\xEF\xA7\x8A" +#define ICON_MDI_BIBLE "\xEF\x82\xA2" +#define ICON_MDI_BIKE "\xEF\x82\xA3" +#define ICON_MDI_BING "\xEF\x82\xA4" +#define ICON_MDI_BINOCULARS "\xEF\x82\xA5" +#define ICON_MDI_BIO "\xEF\x82\xA6" +#define ICON_MDI_BIOHAZARD "\xEF\x82\xA7" +#define ICON_MDI_BITBUCKET "\xEF\x82\xA8" +#define ICON_MDI_BITCOIN "\xEF\xA0\x92" +#define ICON_MDI_BLACK_MESA "\xEF\x82\xA9" +#define ICON_MDI_BLACKBERRY "\xEF\x82\xAA" +#define ICON_MDI_BLENDER "\xEF\x82\xAB" +#define ICON_MDI_BLINDS "\xEF\x82\xAC" +#define ICON_MDI_BLOCK_HELPER "\xEF\x82\xAD" +#define ICON_MDI_BLOGGER "\xEF\x82\xAE" +#define ICON_MDI_BLUETOOTH "\xEF\x82\xAF" +#define ICON_MDI_BLUETOOTH_AUDIO "\xEF\x82\xB0" +#define ICON_MDI_BLUETOOTH_CONNECT "\xEF\x82\xB1" +#define ICON_MDI_BLUETOOTH_OFF "\xEF\x82\xB2" +#define ICON_MDI_BLUETOOTH_SETTINGS "\xEF\x82\xB3" +#define ICON_MDI_BLUETOOTH_TRANSFER "\xEF\x82\xB4" +#define ICON_MDI_BLUR "\xEF\x82\xB5" +#define ICON_MDI_BLUR_LINEAR "\xEF\x82\xB6" +#define ICON_MDI_BLUR_OFF "\xEF\x82\xB7" +#define ICON_MDI_BLUR_RADIAL "\xEF\x82\xB8" +#define ICON_MDI_BOMB "\xEF\x9A\x90" +#define ICON_MDI_BOMB_OFF "\xEF\x9B\x84" +#define ICON_MDI_BONE "\xEF\x82\xB9" +#define ICON_MDI_BOOK "\xEF\x82\xBA" +#define ICON_MDI_BOOK_MINUS "\xEF\x97\x99" +#define ICON_MDI_BOOK_MULTIPLE "\xEF\x82\xBB" +#define ICON_MDI_BOOK_MULTIPLE_VARIANT "\xEF\x82\xBC" +#define ICON_MDI_BOOK_OPEN "\xEF\x82\xBD" +#define ICON_MDI_BOOK_OPEN_PAGE_VARIANT "\xEF\x97\x9A" +#define ICON_MDI_BOOK_OPEN_VARIANT "\xEF\x82\xBE" +#define ICON_MDI_BOOK_PLUS "\xEF\x97\x9B" +#define ICON_MDI_BOOK_SECURE "\xEF\x9E\x99" +#define ICON_MDI_BOOK_UNSECURE "\xEF\x9E\x9A" +#define ICON_MDI_BOOK_VARIANT "\xEF\x82\xBF" +#define ICON_MDI_BOOKMARK "\xEF\x83\x80" +#define ICON_MDI_BOOKMARK_CHECK "\xEF\x83\x81" +#define ICON_MDI_BOOKMARK_MINUS "\xEF\xA7\x8B" +#define ICON_MDI_BOOKMARK_MINUS_OUTLINE "\xEF\xA7\x8C" +#define ICON_MDI_BOOKMARK_MUSIC "\xEF\x83\x82" +#define ICON_MDI_BOOKMARK_OFF "\xEF\xA7\x8D" +#define ICON_MDI_BOOKMARK_OFF_OUTLINE "\xEF\xA7\x8E" +#define ICON_MDI_BOOKMARK_OUTLINE "\xEF\x83\x83" +#define ICON_MDI_BOOKMARK_PLUS "\xEF\x83\x85" +#define ICON_MDI_BOOKMARK_PLUS_OUTLINE "\xEF\x83\x84" +#define ICON_MDI_BOOKMARK_REMOVE "\xEF\x83\x86" +#define ICON_MDI_BOOMBOX "\xEF\x97\x9C" +#define ICON_MDI_BOOTSTRAP "\xEF\x9B\x85" +#define ICON_MDI_BORDER_ALL "\xEF\x83\x87" +#define ICON_MDI_BORDER_ALL_VARIANT "\xEF\xA2\xA0" +#define ICON_MDI_BORDER_BOTTOM "\xEF\x83\x88" +#define ICON_MDI_BORDER_BOTTOM_VARIANT "\xEF\xA2\xA1" +#define ICON_MDI_BORDER_COLOR "\xEF\x83\x89" +#define ICON_MDI_BORDER_HORIZONTAL "\xEF\x83\x8A" +#define ICON_MDI_BORDER_INSIDE "\xEF\x83\x8B" +#define ICON_MDI_BORDER_LEFT "\xEF\x83\x8C" +#define ICON_MDI_BORDER_LEFT_VARIANT "\xEF\xA2\xA2" +#define ICON_MDI_BORDER_NONE "\xEF\x83\x8D" +#define ICON_MDI_BORDER_NONE_VARIANT "\xEF\xA2\xA3" +#define ICON_MDI_BORDER_OUTSIDE "\xEF\x83\x8E" +#define ICON_MDI_BORDER_RIGHT "\xEF\x83\x8F" +#define ICON_MDI_BORDER_RIGHT_VARIANT "\xEF\xA2\xA4" +#define ICON_MDI_BORDER_STYLE "\xEF\x83\x90" +#define ICON_MDI_BORDER_TOP "\xEF\x83\x91" +#define ICON_MDI_BORDER_TOP_VARIANT "\xEF\xA2\xA5" +#define ICON_MDI_BORDER_VERTICAL "\xEF\x83\x92" +#define ICON_MDI_BOTTLE_WINE "\xEF\xA1\x93" +#define ICON_MDI_BOW_TIE "\xEF\x99\xB7" +#define ICON_MDI_BOWL "\xEF\x98\x97" +#define ICON_MDI_BOWLING "\xEF\x83\x93" +#define ICON_MDI_BOX "\xEF\x83\x94" +#define ICON_MDI_BOX_CUTTER "\xEF\x83\x95" +#define ICON_MDI_BOX_SHADOW "\xEF\x98\xB7" +#define ICON_MDI_BRAILLE "\xEF\xA7\x8F" +#define ICON_MDI_BRAIN "\xEF\xA7\x90" +#define ICON_MDI_BRIDGE "\xEF\x98\x98" +#define ICON_MDI_BRIEFCASE "\xEF\x83\x96" +#define ICON_MDI_BRIEFCASE_CHECK "\xEF\x83\x97" +#define ICON_MDI_BRIEFCASE_DOWNLOAD "\xEF\x83\x98" +#define ICON_MDI_BRIEFCASE_OUTLINE "\xEF\xA0\x93" +#define ICON_MDI_BRIEFCASE_UPLOAD "\xEF\x83\x99" +#define ICON_MDI_BRIGHTNESS_1 "\xEF\x83\x9A" +#define ICON_MDI_BRIGHTNESS_2 "\xEF\x83\x9B" +#define ICON_MDI_BRIGHTNESS_3 "\xEF\x83\x9C" +#define ICON_MDI_BRIGHTNESS_4 "\xEF\x83\x9D" +#define ICON_MDI_BRIGHTNESS_5 "\xEF\x83\x9E" +#define ICON_MDI_BRIGHTNESS_6 "\xEF\x83\x9F" +#define ICON_MDI_BRIGHTNESS_7 "\xEF\x83\xA0" +#define ICON_MDI_BRIGHTNESS_AUTO "\xEF\x83\xA1" +#define ICON_MDI_BROOM "\xEF\x83\xA2" +#define ICON_MDI_BRUSH "\xEF\x83\xA3" +#define ICON_MDI_BUDDHISM "\xEF\xA5\x8A" +#define ICON_MDI_BUFFER "\xEF\x98\x99" +#define ICON_MDI_BUG "\xEF\x83\xA4" +#define ICON_MDI_BULLETIN_BOARD "\xEF\x83\xA5" +#define ICON_MDI_BULLHORN "\xEF\x83\xA6" +#define ICON_MDI_BULLSEYE "\xEF\x97\x9D" +#define ICON_MDI_BULLSEYE_ARROW "\xEF\xA3\x88" +#define ICON_MDI_BUS "\xEF\x83\xA7" +#define ICON_MDI_BUS_ARTICULATED_END "\xEF\x9E\x9B" +#define ICON_MDI_BUS_ARTICULATED_FRONT "\xEF\x9E\x9C" +#define ICON_MDI_BUS_CLOCK "\xEF\xA3\x89" +#define ICON_MDI_BUS_DOUBLE_DECKER "\xEF\x9E\x9D" +#define ICON_MDI_BUS_SCHOOL "\xEF\x9E\x9E" +#define ICON_MDI_BUS_SIDE "\xEF\x9E\x9F" +#define ICON_MDI_CACHED "\xEF\x83\xA8" +#define ICON_MDI_CAKE "\xEF\x83\xA9" +#define ICON_MDI_CAKE_LAYERED "\xEF\x83\xAA" +#define ICON_MDI_CAKE_VARIANT "\xEF\x83\xAB" +#define ICON_MDI_CALCULATOR "\xEF\x83\xAC" +#define ICON_MDI_CALENDAR "\xEF\x83\xAD" +#define ICON_MDI_CALENDAR_BLANK "\xEF\x83\xAE" +#define ICON_MDI_CALENDAR_CHECK "\xEF\x83\xAF" +#define ICON_MDI_CALENDAR_CLOCK "\xEF\x83\xB0" +#define ICON_MDI_CALENDAR_EDIT "\xEF\xA2\xA6" +#define ICON_MDI_CALENDAR_HEART "\xEF\xA7\x91" +#define ICON_MDI_CALENDAR_MULTIPLE "\xEF\x83\xB1" +#define ICON_MDI_CALENDAR_MULTIPLE_CHECK "\xEF\x83\xB2" +#define ICON_MDI_CALENDAR_PLUS "\xEF\x83\xB3" +#define ICON_MDI_CALENDAR_QUESTION "\xEF\x9A\x91" +#define ICON_MDI_CALENDAR_RANGE "\xEF\x99\xB8" +#define ICON_MDI_CALENDAR_REMOVE "\xEF\x83\xB4" +#define ICON_MDI_CALENDAR_SEARCH "\xEF\xA5\x8B" +#define ICON_MDI_CALENDAR_STAR "\xEF\xA7\x92" +#define ICON_MDI_CALENDAR_TEXT "\xEF\x83\xB5" +#define ICON_MDI_CALENDAR_TODAY "\xEF\x83\xB6" +#define ICON_MDI_CALL_MADE "\xEF\x83\xB7" +#define ICON_MDI_CALL_MERGE "\xEF\x83\xB8" +#define ICON_MDI_CALL_MISSED "\xEF\x83\xB9" +#define ICON_MDI_CALL_RECEIVED "\xEF\x83\xBA" +#define ICON_MDI_CALL_SPLIT "\xEF\x83\xBB" +#define ICON_MDI_CAMCORDER "\xEF\x83\xBC" +#define ICON_MDI_CAMCORDER_BOX "\xEF\x83\xBD" +#define ICON_MDI_CAMCORDER_BOX_OFF "\xEF\x83\xBE" +#define ICON_MDI_CAMCORDER_OFF "\xEF\x83\xBF" +#define ICON_MDI_CAMERA "\xEF\x84\x80" +#define ICON_MDI_CAMERA_ACCOUNT "\xEF\xA3\x8A" +#define ICON_MDI_CAMERA_BURST "\xEF\x9A\x92" +#define ICON_MDI_CAMERA_ENHANCE "\xEF\x84\x81" +#define ICON_MDI_CAMERA_FRONT "\xEF\x84\x82" +#define ICON_MDI_CAMERA_FRONT_VARIANT "\xEF\x84\x83" +#define ICON_MDI_CAMERA_GOPRO "\xEF\x9E\xA0" +#define ICON_MDI_CAMERA_IMAGE "\xEF\xA3\x8B" +#define ICON_MDI_CAMERA_IRIS "\xEF\x84\x84" +#define ICON_MDI_CAMERA_METERING_CENTER "\xEF\x9E\xA1" +#define ICON_MDI_CAMERA_METERING_MATRIX "\xEF\x9E\xA2" +#define ICON_MDI_CAMERA_METERING_PARTIAL "\xEF\x9E\xA3" +#define ICON_MDI_CAMERA_METERING_SPOT "\xEF\x9E\xA4" +#define ICON_MDI_CAMERA_OFF "\xEF\x97\x9F" +#define ICON_MDI_CAMERA_PARTY_MODE "\xEF\x84\x85" +#define ICON_MDI_CAMERA_REAR "\xEF\x84\x86" +#define ICON_MDI_CAMERA_REAR_VARIANT "\xEF\x84\x87" +#define ICON_MDI_CAMERA_SWITCH "\xEF\x84\x88" +#define ICON_MDI_CAMERA_TIMER "\xEF\x84\x89" +#define ICON_MDI_CANCEL "\xEF\x9C\xB9" +#define ICON_MDI_CANDLE "\xEF\x97\xA2" +#define ICON_MDI_CANDYCANE "\xEF\x84\x8A" +#define ICON_MDI_CANNABIS "\xEF\x9E\xA5" +#define ICON_MDI_CAR "\xEF\x84\x8B" +#define ICON_MDI_CAR_BATTERY "\xEF\x84\x8C" +#define ICON_MDI_CAR_CONNECTED "\xEF\x84\x8D" +#define ICON_MDI_CAR_CONVERTIBLE "\xEF\x9E\xA6" +#define ICON_MDI_CAR_ESTATE "\xEF\x9E\xA7" +#define ICON_MDI_CAR_HATCHBACK "\xEF\x9E\xA8" +#define ICON_MDI_CAR_LIMOUSINE "\xEF\xA3\x8C" +#define ICON_MDI_CAR_PICKUP "\xEF\x9E\xA9" +#define ICON_MDI_CAR_SIDE "\xEF\x9E\xAA" +#define ICON_MDI_CAR_SPORTS "\xEF\x9E\xAB" +#define ICON_MDI_CAR_WASH "\xEF\x84\x8E" +#define ICON_MDI_CARAVAN "\xEF\x9E\xAC" +#define ICON_MDI_CARDS "\xEF\x98\xB8" +#define ICON_MDI_CARDS_CLUB "\xEF\xA3\x8D" +#define ICON_MDI_CARDS_DIAMOND "\xEF\xA3\x8E" +#define ICON_MDI_CARDS_HEART "\xEF\xA3\x8F" +#define ICON_MDI_CARDS_OUTLINE "\xEF\x98\xB9" +#define ICON_MDI_CARDS_PLAYING_OUTLINE "\xEF\x98\xBA" +#define ICON_MDI_CARDS_SPADE "\xEF\xA3\x90" +#define ICON_MDI_CARDS_VARIANT "\xEF\x9B\x86" +#define ICON_MDI_CARROT "\xEF\x84\x8F" +#define ICON_MDI_CART "\xEF\x84\x90" +#define ICON_MDI_CART_OFF "\xEF\x99\xAB" +#define ICON_MDI_CART_OUTLINE "\xEF\x84\x91" +#define ICON_MDI_CART_PLUS "\xEF\x84\x92" +#define ICON_MDI_CASE_SENSITIVE_ALT "\xEF\x84\x93" +#define ICON_MDI_CASH "\xEF\x84\x94" +#define ICON_MDI_CASH_100 "\xEF\x84\x95" +#define ICON_MDI_CASH_MULTIPLE "\xEF\x84\x96" +#define ICON_MDI_CASH_USD "\xEF\x84\x97" +#define ICON_MDI_CASSETTE "\xEF\xA7\x93" +#define ICON_MDI_CAST "\xEF\x84\x98" +#define ICON_MDI_CAST_CONNECTED "\xEF\x84\x99" +#define ICON_MDI_CAST_OFF "\xEF\x9E\x89" +#define ICON_MDI_CASTLE "\xEF\x84\x9A" +#define ICON_MDI_CAT "\xEF\x84\x9B" +#define ICON_MDI_CCTV "\xEF\x9E\xAD" +#define ICON_MDI_CEILING_LIGHT "\xEF\x9D\xA8" +#define ICON_MDI_CELLPHONE "\xEF\x84\x9C" +#define ICON_MDI_CELLPHONE_ANDROID "\xEF\x84\x9D" +#define ICON_MDI_CELLPHONE_ARROW_DOWN "\xEF\xA7\x94" +#define ICON_MDI_CELLPHONE_BASIC "\xEF\x84\x9E" +#define ICON_MDI_CELLPHONE_DOCK "\xEF\x84\x9F" +#define ICON_MDI_CELLPHONE_ERASE "\xEF\xA5\x8C" +#define ICON_MDI_CELLPHONE_IPHONE "\xEF\x84\xA0" +#define ICON_MDI_CELLPHONE_KEY "\xEF\xA5\x8D" +#define ICON_MDI_CELLPHONE_LINK "\xEF\x84\xA1" +#define ICON_MDI_CELLPHONE_LINK_OFF "\xEF\x84\xA2" +#define ICON_MDI_CELLPHONE_LOCK "\xEF\xA5\x8E" +#define ICON_MDI_CELLPHONE_MESSAGE "\xEF\xA3\x92" +#define ICON_MDI_CELLPHONE_OFF "\xEF\xA5\x8F" +#define ICON_MDI_CELLPHONE_SETTINGS "\xEF\x84\xA3" +#define ICON_MDI_CELLPHONE_SETTINGS_VARIANT "\xEF\xA5\x90" +#define ICON_MDI_CELLPHONE_SOUND "\xEF\xA5\x91" +#define ICON_MDI_CELLPHONE_TEXT "\xEF\xA3\x91" +#define ICON_MDI_CELLPHONE_WIRELESS "\xEF\xA0\x94" +#define ICON_MDI_CERTIFICATE "\xEF\x84\xA4" +#define ICON_MDI_CHAIR_SCHOOL "\xEF\x84\xA5" +#define ICON_MDI_CHART_ARC "\xEF\x84\xA6" +#define ICON_MDI_CHART_AREASPLINE "\xEF\x84\xA7" +#define ICON_MDI_CHART_BAR "\xEF\x84\xA8" +#define ICON_MDI_CHART_BAR_STACKED "\xEF\x9D\xA9" +#define ICON_MDI_CHART_BUBBLE "\xEF\x97\xA3" +#define ICON_MDI_CHART_DONUT "\xEF\x9E\xAE" +#define ICON_MDI_CHART_DONUT_VARIANT "\xEF\x9E\xAF" +#define ICON_MDI_CHART_GANTT "\xEF\x99\xAC" +#define ICON_MDI_CHART_HISTOGRAM "\xEF\x84\xA9" +#define ICON_MDI_CHART_LINE "\xEF\x84\xAA" +#define ICON_MDI_CHART_LINE_STACKED "\xEF\x9D\xAA" +#define ICON_MDI_CHART_LINE_VARIANT "\xEF\x9E\xB0" +#define ICON_MDI_CHART_MULTILINE "\xEF\xA3\x93" +#define ICON_MDI_CHART_PIE "\xEF\x84\xAB" +#define ICON_MDI_CHART_SCATTERPLOT_HEXBIN "\xEF\x99\xAD" +#define ICON_MDI_CHART_TIMELINE "\xEF\x99\xAE" +#define ICON_MDI_CHECK "\xEF\x84\xAC" +#define ICON_MDI_CHECK_ALL "\xEF\x84\xAD" +#define ICON_MDI_CHECK_CIRCLE "\xEF\x97\xA0" +#define ICON_MDI_CHECK_CIRCLE_OUTLINE "\xEF\x97\xA1" +#define ICON_MDI_CHECK_OUTLINE "\xEF\xA1\x94" +#define ICON_MDI_CHECKBOX_BLANK "\xEF\x84\xAE" +#define ICON_MDI_CHECKBOX_BLANK_CIRCLE "\xEF\x84\xAF" +#define ICON_MDI_CHECKBOX_BLANK_CIRCLE_OUTLINE "\xEF\x84\xB0" +#define ICON_MDI_CHECKBOX_BLANK_OUTLINE "\xEF\x84\xB1" +#define ICON_MDI_CHECKBOX_INTERMEDIATE "\xEF\xA1\x95" +#define ICON_MDI_CHECKBOX_MARKED "\xEF\x84\xB2" +#define ICON_MDI_CHECKBOX_MARKED_CIRCLE "\xEF\x84\xB3" +#define ICON_MDI_CHECKBOX_MARKED_CIRCLE_OUTLINE "\xEF\x84\xB4" +#define ICON_MDI_CHECKBOX_MARKED_OUTLINE "\xEF\x84\xB5" +#define ICON_MDI_CHECKBOX_MULTIPLE_BLANK "\xEF\x84\xB6" +#define ICON_MDI_CHECKBOX_MULTIPLE_BLANK_CIRCLE "\xEF\x98\xBB" +#define ICON_MDI_CHECKBOX_MULTIPLE_BLANK_CIRCLE_OUTLINE "\xEF\x98\xBC" +#define ICON_MDI_CHECKBOX_MULTIPLE_BLANK_OUTLINE "\xEF\x84\xB7" +#define ICON_MDI_CHECKBOX_MULTIPLE_MARKED "\xEF\x84\xB8" +#define ICON_MDI_CHECKBOX_MULTIPLE_MARKED_CIRCLE "\xEF\x98\xBD" +#define ICON_MDI_CHECKBOX_MULTIPLE_MARKED_CIRCLE_OUTLINE "\xEF\x98\xBE" +#define ICON_MDI_CHECKBOX_MULTIPLE_MARKED_OUTLINE "\xEF\x84\xB9" +#define ICON_MDI_CHECKERBOARD "\xEF\x84\xBA" +#define ICON_MDI_CHEMICAL_WEAPON "\xEF\x84\xBB" +#define ICON_MDI_CHESS_BISHOP "\xEF\xA1\x9B" +#define ICON_MDI_CHESS_KING "\xEF\xA1\x96" +#define ICON_MDI_CHESS_KNIGHT "\xEF\xA1\x97" +#define ICON_MDI_CHESS_PAWN "\xEF\xA1\x98" +#define ICON_MDI_CHESS_QUEEN "\xEF\xA1\x99" +#define ICON_MDI_CHESS_ROOK "\xEF\xA1\x9A" +#define ICON_MDI_CHEVRON_DOUBLE_DOWN "\xEF\x84\xBC" +#define ICON_MDI_CHEVRON_DOUBLE_LEFT "\xEF\x84\xBD" +#define ICON_MDI_CHEVRON_DOUBLE_RIGHT "\xEF\x84\xBE" +#define ICON_MDI_CHEVRON_DOUBLE_UP "\xEF\x84\xBF" +#define ICON_MDI_CHEVRON_DOWN "\xEF\x85\x80" +#define ICON_MDI_CHEVRON_DOWN_BOX "\xEF\xA7\x95" +#define ICON_MDI_CHEVRON_DOWN_BOX_OUTLINE "\xEF\xA7\x96" +#define ICON_MDI_CHEVRON_LEFT "\xEF\x85\x81" +#define ICON_MDI_CHEVRON_LEFT_BOX "\xEF\xA7\x97" +#define ICON_MDI_CHEVRON_LEFT_BOX_OUTLINE "\xEF\xA7\x98" +#define ICON_MDI_CHEVRON_RIGHT "\xEF\x85\x82" +#define ICON_MDI_CHEVRON_RIGHT_BOX "\xEF\xA7\x99" +#define ICON_MDI_CHEVRON_RIGHT_BOX_OUTLINE "\xEF\xA7\x9A" +#define ICON_MDI_CHEVRON_UP "\xEF\x85\x83" +#define ICON_MDI_CHEVRON_UP_BOX "\xEF\xA7\x9B" +#define ICON_MDI_CHEVRON_UP_BOX_OUTLINE "\xEF\xA7\x9C" +#define ICON_MDI_CHILI_HOT "\xEF\x9E\xB1" +#define ICON_MDI_CHILI_MEDIUM "\xEF\x9E\xB2" +#define ICON_MDI_CHILI_MILD "\xEF\x9E\xB3" +#define ICON_MDI_CHIP "\xEF\x98\x9A" +#define ICON_MDI_CHRISTIANITY "\xEF\xA5\x92" +#define ICON_MDI_CHURCH "\xEF\x85\x84" +#define ICON_MDI_CIRCLE "\xEF\x9D\xA4" +#define ICON_MDI_CIRCLE_EDIT_OUTLINE "\xEF\xA3\x94" +#define ICON_MDI_CIRCLE_MEDIUM "\xEF\xA7\x9D" +#define ICON_MDI_CIRCLE_OUTLINE "\xEF\x9D\xA5" +#define ICON_MDI_CIRCLE_SMALL "\xEF\xA7\x9E" +#define ICON_MDI_CISCO_WEBEX "\xEF\x85\x85" +#define ICON_MDI_CITY "\xEF\x85\x86" +#define ICON_MDI_CLIPBOARD "\xEF\x85\x87" +#define ICON_MDI_CLIPBOARD_ACCOUNT "\xEF\x85\x88" +#define ICON_MDI_CLIPBOARD_ALERT "\xEF\x85\x89" +#define ICON_MDI_CLIPBOARD_ARROW_DOWN "\xEF\x85\x8A" +#define ICON_MDI_CLIPBOARD_ARROW_LEFT "\xEF\x85\x8B" +#define ICON_MDI_CLIPBOARD_CHECK "\xEF\x85\x8C" +#define ICON_MDI_CLIPBOARD_CHECK_OUTLINE "\xEF\xA2\xA7" +#define ICON_MDI_CLIPBOARD_FLOW "\xEF\x9B\x87" +#define ICON_MDI_CLIPBOARD_OUTLINE "\xEF\x85\x8D" +#define ICON_MDI_CLIPBOARD_PLUS "\xEF\x9D\x90" +#define ICON_MDI_CLIPBOARD_PULSE "\xEF\xA1\x9C" +#define ICON_MDI_CLIPBOARD_PULSE_OUTLINE "\xEF\xA1\x9D" +#define ICON_MDI_CLIPBOARD_TEXT "\xEF\x85\x8E" +#define ICON_MDI_CLIPPY "\xEF\x85\x8F" +#define ICON_MDI_CLOCK "\xEF\xA5\x93" +#define ICON_MDI_CLOCK_ALERT "\xEF\xA5\x94" +#define ICON_MDI_CLOCK_ALERT_OUTLINE "\xEF\x97\x8E" +#define ICON_MDI_CLOCK_END "\xEF\x85\x91" +#define ICON_MDI_CLOCK_FAST "\xEF\x85\x92" +#define ICON_MDI_CLOCK_IN "\xEF\x85\x93" +#define ICON_MDI_CLOCK_OUT "\xEF\x85\x94" +#define ICON_MDI_CLOCK_OUTLINE "\xEF\x85\x90" +#define ICON_MDI_CLOCK_START "\xEF\x85\x95" +#define ICON_MDI_CLOSE "\xEF\x85\x96" +#define ICON_MDI_CLOSE_BOX "\xEF\x85\x97" +#define ICON_MDI_CLOSE_BOX_OUTLINE "\xEF\x85\x98" +#define ICON_MDI_CLOSE_CIRCLE "\xEF\x85\x99" +#define ICON_MDI_CLOSE_CIRCLE_OUTLINE "\xEF\x85\x9A" +#define ICON_MDI_CLOSE_NETWORK "\xEF\x85\x9B" +#define ICON_MDI_CLOSE_OCTAGON "\xEF\x85\x9C" +#define ICON_MDI_CLOSE_OCTAGON_OUTLINE "\xEF\x85\x9D" +#define ICON_MDI_CLOSE_OUTLINE "\xEF\x9B\x88" +#define ICON_MDI_CLOSED_CAPTION "\xEF\x85\x9E" +#define ICON_MDI_CLOUD "\xEF\x85\x9F" +#define ICON_MDI_CLOUD_ALERT "\xEF\xA7\x9F" +#define ICON_MDI_CLOUD_BRACES "\xEF\x9E\xB4" +#define ICON_MDI_CLOUD_CHECK "\xEF\x85\xA0" +#define ICON_MDI_CLOUD_CIRCLE "\xEF\x85\xA1" +#define ICON_MDI_CLOUD_DOWNLOAD "\xEF\x85\xA2" +#define ICON_MDI_CLOUD_OFF_OUTLINE "\xEF\x85\xA4" +#define ICON_MDI_CLOUD_OUTLINE "\xEF\x85\xA3" +#define ICON_MDI_CLOUD_PRINT "\xEF\x85\xA5" +#define ICON_MDI_CLOUD_PRINT_OUTLINE "\xEF\x85\xA6" +#define ICON_MDI_CLOUD_SEARCH "\xEF\xA5\x95" +#define ICON_MDI_CLOUD_SEARCH_OUTLINE "\xEF\xA5\x96" +#define ICON_MDI_CLOUD_SYNC "\xEF\x98\xBF" +#define ICON_MDI_CLOUD_TAGS "\xEF\x9E\xB5" +#define ICON_MDI_CLOUD_UPLOAD "\xEF\x85\xA7" +#define ICON_MDI_CLOVER "\xEF\xA0\x95" +#define ICON_MDI_CODE_ARRAY "\xEF\x85\xA8" +#define ICON_MDI_CODE_BRACES "\xEF\x85\xA9" +#define ICON_MDI_CODE_BRACKETS "\xEF\x85\xAA" +#define ICON_MDI_CODE_EQUAL "\xEF\x85\xAB" +#define ICON_MDI_CODE_GREATER_THAN "\xEF\x85\xAC" +#define ICON_MDI_CODE_GREATER_THAN_OR_EQUAL "\xEF\x85\xAD" +#define ICON_MDI_CODE_LESS_THAN "\xEF\x85\xAE" +#define ICON_MDI_CODE_LESS_THAN_OR_EQUAL "\xEF\x85\xAF" +#define ICON_MDI_CODE_NOT_EQUAL "\xEF\x85\xB0" +#define ICON_MDI_CODE_NOT_EQUAL_VARIANT "\xEF\x85\xB1" +#define ICON_MDI_CODE_PARENTHESES "\xEF\x85\xB2" +#define ICON_MDI_CODE_STRING "\xEF\x85\xB3" +#define ICON_MDI_CODE_TAGS "\xEF\x85\xB4" +#define ICON_MDI_CODE_TAGS_CHECK "\xEF\x9A\x93" +#define ICON_MDI_CODEPEN "\xEF\x85\xB5" +#define ICON_MDI_COFFEE "\xEF\x85\xB6" +#define ICON_MDI_COFFEE_OUTLINE "\xEF\x9B\x89" +#define ICON_MDI_COFFEE_TO_GO "\xEF\x85\xB7" +#define ICON_MDI_COGS "\xEF\xA3\x95" +#define ICON_MDI_COIN "\xEF\x85\xB8" +#define ICON_MDI_COINS "\xEF\x9A\x94" +#define ICON_MDI_COLLAGE "\xEF\x99\x80" +#define ICON_MDI_COLOR_HELPER "\xEF\x85\xB9" +#define ICON_MDI_COMMENT "\xEF\x85\xBA" +#define ICON_MDI_COMMENT_ACCOUNT "\xEF\x85\xBB" +#define ICON_MDI_COMMENT_ACCOUNT_OUTLINE "\xEF\x85\xBC" +#define ICON_MDI_COMMENT_ALERT "\xEF\x85\xBD" +#define ICON_MDI_COMMENT_ALERT_OUTLINE "\xEF\x85\xBE" +#define ICON_MDI_COMMENT_ARROW_LEFT "\xEF\xA7\xA0" +#define ICON_MDI_COMMENT_ARROW_LEFT_OUTLINE "\xEF\xA7\xA1" +#define ICON_MDI_COMMENT_ARROW_RIGHT "\xEF\xA7\xA2" +#define ICON_MDI_COMMENT_ARROW_RIGHT_OUTLINE "\xEF\xA7\xA3" +#define ICON_MDI_COMMENT_CHECK "\xEF\x85\xBF" +#define ICON_MDI_COMMENT_CHECK_OUTLINE "\xEF\x86\x80" +#define ICON_MDI_COMMENT_MULTIPLE "\xEF\xA1\x9E" +#define ICON_MDI_COMMENT_MULTIPLE_OUTLINE "\xEF\x86\x81" +#define ICON_MDI_COMMENT_OUTLINE "\xEF\x86\x82" +#define ICON_MDI_COMMENT_PLUS "\xEF\xA7\xA4" +#define ICON_MDI_COMMENT_PLUS_OUTLINE "\xEF\x86\x83" +#define ICON_MDI_COMMENT_PROCESSING "\xEF\x86\x84" +#define ICON_MDI_COMMENT_PROCESSING_OUTLINE "\xEF\x86\x85" +#define ICON_MDI_COMMENT_QUESTION "\xEF\xA0\x96" +#define ICON_MDI_COMMENT_QUESTION_OUTLINE "\xEF\x86\x86" +#define ICON_MDI_COMMENT_REMOVE "\xEF\x97\x9E" +#define ICON_MDI_COMMENT_REMOVE_OUTLINE "\xEF\x86\x87" +#define ICON_MDI_COMMENT_TEXT "\xEF\x86\x88" +#define ICON_MDI_COMMENT_TEXT_MULTIPLE "\xEF\xA1\x9F" +#define ICON_MDI_COMMENT_TEXT_MULTIPLE_OUTLINE "\xEF\xA1\xA0" +#define ICON_MDI_COMMENT_TEXT_OUTLINE "\xEF\x86\x89" +#define ICON_MDI_COMPARE "\xEF\x86\x8A" +#define ICON_MDI_COMPASS "\xEF\x86\x8B" +#define ICON_MDI_COMPASS_OUTLINE "\xEF\x86\x8C" +#define ICON_MDI_CONSOLE "\xEF\x86\x8D" +#define ICON_MDI_CONSOLE_LINE "\xEF\x9E\xB6" +#define ICON_MDI_CONSOLE_NETWORK "\xEF\xA2\xA8" +#define ICON_MDI_CONTACT_MAIL "\xEF\x86\x8E" +#define ICON_MDI_CONTACTS "\xEF\x9B\x8A" +#define ICON_MDI_CONTENT_COPY "\xEF\x86\x8F" +#define ICON_MDI_CONTENT_CUT "\xEF\x86\x90" +#define ICON_MDI_CONTENT_DUPLICATE "\xEF\x86\x91" +#define ICON_MDI_CONTENT_PASTE "\xEF\x86\x92" +#define ICON_MDI_CONTENT_SAVE "\xEF\x86\x93" +#define ICON_MDI_CONTENT_SAVE_ALL "\xEF\x86\x94" +#define ICON_MDI_CONTENT_SAVE_OUTLINE "\xEF\xA0\x97" +#define ICON_MDI_CONTENT_SAVE_SETTINGS "\xEF\x98\x9B" +#define ICON_MDI_CONTRAST "\xEF\x86\x95" +#define ICON_MDI_CONTRAST_BOX "\xEF\x86\x96" +#define ICON_MDI_CONTRAST_CIRCLE "\xEF\x86\x97" +#define ICON_MDI_COOKIE "\xEF\x86\x98" +#define ICON_MDI_COPYRIGHT "\xEF\x97\xA6" +#define ICON_MDI_CORDOVA "\xEF\xA5\x97" +#define ICON_MDI_CORN "\xEF\x9E\xB7" +#define ICON_MDI_COUNTER "\xEF\x86\x99" +#define ICON_MDI_COW "\xEF\x86\x9A" +#define ICON_MDI_CRANE "\xEF\xA1\xA1" +#define ICON_MDI_CREATION "\xEF\x87\x89" +#define ICON_MDI_CREDIT_CARD "\xEF\x86\x9B" +#define ICON_MDI_CREDIT_CARD_MULTIPLE "\xEF\x86\x9C" +#define ICON_MDI_CREDIT_CARD_OFF "\xEF\x97\xA4" +#define ICON_MDI_CREDIT_CARD_PLUS "\xEF\x99\xB5" +#define ICON_MDI_CREDIT_CARD_SCAN "\xEF\x86\x9D" +#define ICON_MDI_CREDIT_CARD_SETTINGS "\xEF\xA3\x96" +#define ICON_MDI_CROP "\xEF\x86\x9E" +#define ICON_MDI_CROP_FREE "\xEF\x86\x9F" +#define ICON_MDI_CROP_LANDSCAPE "\xEF\x86\xA0" +#define ICON_MDI_CROP_PORTRAIT "\xEF\x86\xA1" +#define ICON_MDI_CROP_ROTATE "\xEF\x9A\x95" +#define ICON_MDI_CROP_SQUARE "\xEF\x86\xA2" +#define ICON_MDI_CROSSHAIRS "\xEF\x86\xA3" +#define ICON_MDI_CROSSHAIRS_GPS "\xEF\x86\xA4" +#define ICON_MDI_CROWN "\xEF\x86\xA5" +#define ICON_MDI_CRYENGINE "\xEF\xA5\x98" +#define ICON_MDI_CUBE "\xEF\x86\xA6" +#define ICON_MDI_CUBE_OUTLINE "\xEF\x86\xA7" +#define ICON_MDI_CUBE_SEND "\xEF\x86\xA8" +#define ICON_MDI_CUBE_UNFOLDED "\xEF\x86\xA9" +#define ICON_MDI_CUP "\xEF\x86\xAA" +#define ICON_MDI_CUP_OFF "\xEF\x97\xA5" +#define ICON_MDI_CUP_WATER "\xEF\x86\xAB" +#define ICON_MDI_CUPCAKE "\xEF\xA5\x99" +#define ICON_MDI_CURLING "\xEF\xA1\xA2" +#define ICON_MDI_CURRENCY_BDT "\xEF\xA1\xA3" +#define ICON_MDI_CURRENCY_BTC "\xEF\x86\xAC" +#define ICON_MDI_CURRENCY_CHF "\xEF\x9E\xB8" +#define ICON_MDI_CURRENCY_CNY "\xEF\x9E\xB9" +#define ICON_MDI_CURRENCY_ETH "\xEF\x9E\xBA" +#define ICON_MDI_CURRENCY_EUR "\xEF\x86\xAD" +#define ICON_MDI_CURRENCY_GBP "\xEF\x86\xAE" +#define ICON_MDI_CURRENCY_INR "\xEF\x86\xAF" +#define ICON_MDI_CURRENCY_JPY "\xEF\x9E\xBB" +#define ICON_MDI_CURRENCY_KRW "\xEF\x9E\xBC" +#define ICON_MDI_CURRENCY_KZT "\xEF\xA1\xA4" +#define ICON_MDI_CURRENCY_NGN "\xEF\x86\xB0" +#define ICON_MDI_CURRENCY_PHP "\xEF\xA7\xA5" +#define ICON_MDI_CURRENCY_RUB "\xEF\x86\xB1" +#define ICON_MDI_CURRENCY_SIGN "\xEF\x9E\xBD" +#define ICON_MDI_CURRENCY_TRY "\xEF\x86\xB2" +#define ICON_MDI_CURRENCY_TWD "\xEF\x9E\xBE" +#define ICON_MDI_CURRENCY_USD "\xEF\x86\xB3" +#define ICON_MDI_CURRENCY_USD_OFF "\xEF\x99\xB9" +#define ICON_MDI_CURRENT_AC "\xEF\xA5\x9A" +#define ICON_MDI_CURRENT_DC "\xEF\xA5\x9B" +#define ICON_MDI_CURSOR_DEFAULT "\xEF\x86\xB4" +#define ICON_MDI_CURSOR_DEFAULT_OUTLINE "\xEF\x86\xB5" +#define ICON_MDI_CURSOR_MOVE "\xEF\x86\xB6" +#define ICON_MDI_CURSOR_POINTER "\xEF\x86\xB7" +#define ICON_MDI_CURSOR_TEXT "\xEF\x97\xA7" +#define ICON_MDI_DATABASE "\xEF\x86\xB8" +#define ICON_MDI_DATABASE_EXPORT "\xEF\xA5\x9D" +#define ICON_MDI_DATABASE_IMPORT "\xEF\xA5\x9C" +#define ICON_MDI_DATABASE_MINUS "\xEF\x86\xB9" +#define ICON_MDI_DATABASE_PLUS "\xEF\x86\xBA" +#define ICON_MDI_DATABASE_SEARCH "\xEF\xA1\xA5" +#define ICON_MDI_DEATH_STAR "\xEF\xA3\x97" +#define ICON_MDI_DEATH_STAR_VARIANT "\xEF\xA3\x98" +#define ICON_MDI_DEBIAN "\xEF\xA3\x99" +#define ICON_MDI_DEBUG_STEP_INTO "\xEF\x86\xBB" +#define ICON_MDI_DEBUG_STEP_OUT "\xEF\x86\xBC" +#define ICON_MDI_DEBUG_STEP_OVER "\xEF\x86\xBD" +#define ICON_MDI_DECAGRAM "\xEF\x9D\xAB" +#define ICON_MDI_DECAGRAM_OUTLINE "\xEF\x9D\xAC" +#define ICON_MDI_DECIMAL_DECREASE "\xEF\x86\xBE" +#define ICON_MDI_DECIMAL_INCREASE "\xEF\x86\xBF" +#define ICON_MDI_DELETE "\xEF\x87\x80" +#define ICON_MDI_DELETE_CIRCLE "\xEF\x9A\x82" +#define ICON_MDI_DELETE_EMPTY "\xEF\x9B\x8B" +#define ICON_MDI_DELETE_FOREVER "\xEF\x97\xA8" +#define ICON_MDI_DELETE_OUTLINE "\xEF\xA7\xA6" +#define ICON_MDI_DELETE_RESTORE "\xEF\xA0\x98" +#define ICON_MDI_DELETE_SWEEP "\xEF\x97\xA9" +#define ICON_MDI_DELETE_VARIANT "\xEF\x87\x81" +#define ICON_MDI_DELTA "\xEF\x87\x82" +#define ICON_MDI_DESK_LAMP "\xEF\xA5\x9E" +#define ICON_MDI_DESKPHONE "\xEF\x87\x83" +#define ICON_MDI_DESKTOP_CLASSIC "\xEF\x9E\xBF" +#define ICON_MDI_DESKTOP_MAC "\xEF\x87\x84" +#define ICON_MDI_DESKTOP_MAC_DASHBOARD "\xEF\xA7\xA7" +#define ICON_MDI_DESKTOP_TOWER "\xEF\x87\x85" +#define ICON_MDI_DETAILS "\xEF\x87\x86" +#define ICON_MDI_DEVELOPER_BOARD "\xEF\x9A\x96" +#define ICON_MDI_DEVIANTART "\xEF\x87\x87" +#define ICON_MDI_DIALPAD "\xEF\x98\x9C" +#define ICON_MDI_DIAMOND "\xEF\x87\x88" +#define ICON_MDI_DICE_1 "\xEF\x87\x8A" +#define ICON_MDI_DICE_2 "\xEF\x87\x8B" +#define ICON_MDI_DICE_3 "\xEF\x87\x8C" +#define ICON_MDI_DICE_4 "\xEF\x87\x8D" +#define ICON_MDI_DICE_5 "\xEF\x87\x8E" +#define ICON_MDI_DICE_6 "\xEF\x87\x8F" +#define ICON_MDI_DICE_D10 "\xEF\x9D\xAE" +#define ICON_MDI_DICE_D12 "\xEF\xA1\xA6" +#define ICON_MDI_DICE_D20 "\xEF\x97\xAA" +#define ICON_MDI_DICE_D4 "\xEF\x97\xAB" +#define ICON_MDI_DICE_D6 "\xEF\x97\xAC" +#define ICON_MDI_DICE_D8 "\xEF\x97\xAD" +#define ICON_MDI_DICE_MULTIPLE "\xEF\x9D\xAD" +#define ICON_MDI_DICTIONARY "\xEF\x98\x9D" +#define ICON_MDI_DIP_SWITCH "\xEF\x9F\x80" +#define ICON_MDI_DIRECTIONS "\xEF\x87\x90" +#define ICON_MDI_DIRECTIONS_FORK "\xEF\x99\x81" +#define ICON_MDI_DISC "\xEF\x97\xAE" +#define ICON_MDI_DISC_ALERT "\xEF\x87\x91" +#define ICON_MDI_DISC_PLAYER "\xEF\xA5\x9F" +#define ICON_MDI_DISCORD "\xEF\x99\xAF" +#define ICON_MDI_DISQUS "\xEF\x87\x92" +#define ICON_MDI_DISQUS_OUTLINE "\xEF\x87\x93" +#define ICON_MDI_DIVISION "\xEF\x87\x94" +#define ICON_MDI_DIVISION_BOX "\xEF\x87\x95" +#define ICON_MDI_DNA "\xEF\x9A\x83" +#define ICON_MDI_DNS "\xEF\x87\x96" +#define ICON_MDI_DO_NOT_DISTURB "\xEF\x9A\x97" +#define ICON_MDI_DO_NOT_DISTURB_OFF "\xEF\x9A\x98" +#define ICON_MDI_DOCKER "\xEF\xA1\xA7" +#define ICON_MDI_DOLBY "\xEF\x9A\xB2" +#define ICON_MDI_DOMAIN "\xEF\x87\x97" +#define ICON_MDI_DONKEY "\xEF\x9F\x81" +#define ICON_MDI_DOOR "\xEF\xA0\x99" +#define ICON_MDI_DOOR_CLOSED "\xEF\xA0\x9A" +#define ICON_MDI_DOOR_OPEN "\xEF\xA0\x9B" +#define ICON_MDI_DOORBELL_VIDEO "\xEF\xA1\xA8" +#define ICON_MDI_DOTS_HORIZONTAL "\xEF\x87\x98" +#define ICON_MDI_DOTS_HORIZONTAL_CIRCLE "\xEF\x9F\x82" +#define ICON_MDI_DOTS_VERTICAL "\xEF\x87\x99" +#define ICON_MDI_DOTS_VERTICAL_CIRCLE "\xEF\x9F\x83" +#define ICON_MDI_DOUBAN "\xEF\x9A\x99" +#define ICON_MDI_DOWNLOAD "\xEF\x87\x9A" +#define ICON_MDI_DOWNLOAD_MULTIPLE "\xEF\xA7\xA8" +#define ICON_MDI_DOWNLOAD_NETWORK "\xEF\x9B\xB3" +#define ICON_MDI_DRAG "\xEF\x87\x9B" +#define ICON_MDI_DRAG_HORIZONTAL "\xEF\x87\x9C" +#define ICON_MDI_DRAG_VERTICAL "\xEF\x87\x9D" +#define ICON_MDI_DRAWING "\xEF\x87\x9E" +#define ICON_MDI_DRAWING_BOX "\xEF\x87\x9F" +#define ICON_MDI_DRIBBBLE "\xEF\x87\xA0" +#define ICON_MDI_DRIBBBLE_BOX "\xEF\x87\xA1" +#define ICON_MDI_DRONE "\xEF\x87\xA2" +#define ICON_MDI_DROPBOX "\xEF\x87\xA3" +#define ICON_MDI_DRUPAL "\xEF\x87\xA4" +#define ICON_MDI_DUCK "\xEF\x87\xA5" +#define ICON_MDI_DUMBBELL "\xEF\x87\xA6" +#define ICON_MDI_EAR_HEARING "\xEF\x9F\x84" +#define ICON_MDI_EARTH "\xEF\x87\xA7" +#define ICON_MDI_EARTH_BOX "\xEF\x9B\x8C" +#define ICON_MDI_EARTH_BOX_OFF "\xEF\x9B\x8D" +#define ICON_MDI_EARTH_OFF "\xEF\x87\xA8" +#define ICON_MDI_EDGE "\xEF\x87\xA9" +#define ICON_MDI_EIGHT_TRACK "\xEF\xA7\xA9" +#define ICON_MDI_EJECT "\xEF\x87\xAA" +#define ICON_MDI_ELEPHANT "\xEF\x9F\x85" +#define ICON_MDI_ELEVATION_DECLINE "\xEF\x87\xAB" +#define ICON_MDI_ELEVATION_RISE "\xEF\x87\xAC" +#define ICON_MDI_ELEVATOR "\xEF\x87\xAD" +#define ICON_MDI_EMAIL "\xEF\x87\xAE" +#define ICON_MDI_EMAIL_ALERT "\xEF\x9B\x8E" +#define ICON_MDI_EMAIL_OPEN "\xEF\x87\xAF" +#define ICON_MDI_EMAIL_OPEN_OUTLINE "\xEF\x97\xAF" +#define ICON_MDI_EMAIL_OUTLINE "\xEF\x87\xB0" +#define ICON_MDI_EMAIL_PLUS "\xEF\xA7\xAA" +#define ICON_MDI_EMAIL_PLUS_OUTLINE "\xEF\xA7\xAB" +#define ICON_MDI_EMAIL_SEARCH "\xEF\xA5\xA0" +#define ICON_MDI_EMAIL_SEARCH_OUTLINE "\xEF\xA5\xA1" +#define ICON_MDI_EMAIL_SECURE "\xEF\x87\xB1" +#define ICON_MDI_EMAIL_VARIANT "\xEF\x97\xB0" +#define ICON_MDI_EMBY "\xEF\x9A\xB3" +#define ICON_MDI_EMOTICON "\xEF\x87\xB2" +#define ICON_MDI_EMOTICON_COOL "\xEF\x87\xB3" +#define ICON_MDI_EMOTICON_DEAD "\xEF\x9A\x9A" +#define ICON_MDI_EMOTICON_DEVIL "\xEF\x87\xB4" +#define ICON_MDI_EMOTICON_EXCITED "\xEF\x9A\x9B" +#define ICON_MDI_EMOTICON_HAPPY "\xEF\x87\xB5" +#define ICON_MDI_EMOTICON_NEUTRAL "\xEF\x87\xB6" +#define ICON_MDI_EMOTICON_POOP "\xEF\x87\xB7" +#define ICON_MDI_EMOTICON_SAD "\xEF\x87\xB8" +#define ICON_MDI_EMOTICON_TONGUE "\xEF\x87\xB9" +#define ICON_MDI_ENGINE "\xEF\x87\xBA" +#define ICON_MDI_ENGINE_OUTLINE "\xEF\x87\xBB" +#define ICON_MDI_EQUAL "\xEF\x87\xBC" +#define ICON_MDI_EQUAL_BOX "\xEF\x87\xBD" +#define ICON_MDI_ERASER "\xEF\x87\xBE" +#define ICON_MDI_ERASER_VARIANT "\xEF\x99\x82" +#define ICON_MDI_ESCALATOR "\xEF\x87\xBF" +#define ICON_MDI_ETHEREUM "\xEF\xA1\xA9" +#define ICON_MDI_ETHERNET "\xEF\x88\x80" +#define ICON_MDI_ETHERNET_CABLE "\xEF\x88\x81" +#define ICON_MDI_ETHERNET_CABLE_OFF "\xEF\x88\x82" +#define ICON_MDI_ETSY "\xEF\x88\x83" +#define ICON_MDI_EV_STATION "\xEF\x97\xB1" +#define ICON_MDI_EVENTBRITE "\xEF\x9F\x86" +#define ICON_MDI_EVERNOTE "\xEF\x88\x84" +#define ICON_MDI_EXCLAMATION "\xEF\x88\x85" +#define ICON_MDI_EXIT_TO_APP "\xEF\x88\x86" +#define ICON_MDI_EXPONENT "\xEF\xA5\xA2" +#define ICON_MDI_EXPONENT_BOX "\xEF\xA5\xA3" +#define ICON_MDI_EXPORT "\xEF\x88\x87" +#define ICON_MDI_EYE "\xEF\x88\x88" +#define ICON_MDI_EYE_OFF "\xEF\x88\x89" +#define ICON_MDI_EYE_OFF_OUTLINE "\xEF\x9B\x90" +#define ICON_MDI_EYE_OUTLINE "\xEF\x9B\x8F" +#define ICON_MDI_EYE_PLUS "\xEF\xA1\xAA" +#define ICON_MDI_EYE_PLUS_OUTLINE "\xEF\xA1\xAB" +#define ICON_MDI_EYE_SETTINGS "\xEF\xA1\xAC" +#define ICON_MDI_EYE_SETTINGS_OUTLINE "\xEF\xA1\xAD" +#define ICON_MDI_EYEDROPPER "\xEF\x88\x8A" +#define ICON_MDI_EYEDROPPER_VARIANT "\xEF\x88\x8B" +#define ICON_MDI_FACE "\xEF\x99\x83" +#define ICON_MDI_FACE_PROFILE "\xEF\x99\x84" +#define ICON_MDI_FACEBOOK "\xEF\x88\x8C" +#define ICON_MDI_FACEBOOK_BOX "\xEF\x88\x8D" +#define ICON_MDI_FACEBOOK_MESSENGER "\xEF\x88\x8E" +#define ICON_MDI_FACTORY "\xEF\x88\x8F" +#define ICON_MDI_FAN "\xEF\x88\x90" +#define ICON_MDI_FAN_OFF "\xEF\xA0\x9C" +#define ICON_MDI_FAST_FORWARD "\xEF\x88\x91" +#define ICON_MDI_FAST_FORWARD_OUTLINE "\xEF\x9B\x91" +#define ICON_MDI_FAX "\xEF\x88\x92" +#define ICON_MDI_FEATHER "\xEF\x9B\x92" +#define ICON_MDI_FEDORA "\xEF\xA3\x9A" +#define ICON_MDI_FERRY "\xEF\x88\x93" +#define ICON_MDI_FILE "\xEF\x88\x94" +#define ICON_MDI_FILE_ACCOUNT "\xEF\x9C\xBA" +#define ICON_MDI_FILE_CHART "\xEF\x88\x95" +#define ICON_MDI_FILE_CHECK "\xEF\x88\x96" +#define ICON_MDI_FILE_CLOUD "\xEF\x88\x97" +#define ICON_MDI_FILE_COMPARE "\xEF\xA2\xA9" +#define ICON_MDI_FILE_DELIMITED "\xEF\x88\x98" +#define ICON_MDI_FILE_DOCUMENT "\xEF\x88\x99" +#define ICON_MDI_FILE_DOCUMENT_BOX "\xEF\x88\x9A" +#define ICON_MDI_FILE_DOCUMENT_BOX_OUTLINE "\xEF\xA7\xAC" +#define ICON_MDI_FILE_DOCUMENT_OUTLINE "\xEF\xA7\xAD" +#define ICON_MDI_FILE_DOWNLOAD "\xEF\xA5\xA4" +#define ICON_MDI_FILE_DOWNLOAD_OUTLINE "\xEF\xA5\xA5" +#define ICON_MDI_FILE_EXCEL "\xEF\x88\x9B" +#define ICON_MDI_FILE_EXCEL_BOX "\xEF\x88\x9C" +#define ICON_MDI_FILE_EXPORT "\xEF\x88\x9D" +#define ICON_MDI_FILE_FIND "\xEF\x88\x9E" +#define ICON_MDI_FILE_HIDDEN "\xEF\x98\x93" +#define ICON_MDI_FILE_IMAGE "\xEF\x88\x9F" +#define ICON_MDI_FILE_IMPORT "\xEF\x88\xA0" +#define ICON_MDI_FILE_LOCK "\xEF\x88\xA1" +#define ICON_MDI_FILE_MULTIPLE "\xEF\x88\xA2" +#define ICON_MDI_FILE_MUSIC "\xEF\x88\xA3" +#define ICON_MDI_FILE_OUTLINE "\xEF\x88\xA4" +#define ICON_MDI_FILE_PDF "\xEF\x88\xA5" +#define ICON_MDI_FILE_PDF_BOX "\xEF\x88\xA6" +#define ICON_MDI_FILE_PERCENT "\xEF\xA0\x9D" +#define ICON_MDI_FILE_PLUS "\xEF\x9D\x91" +#define ICON_MDI_FILE_POWERPOINT "\xEF\x88\xA7" +#define ICON_MDI_FILE_POWERPOINT_BOX "\xEF\x88\xA8" +#define ICON_MDI_FILE_PRESENTATION_BOX "\xEF\x88\xA9" +#define ICON_MDI_FILE_QUESTION "\xEF\xA1\xAE" +#define ICON_MDI_FILE_RESTORE "\xEF\x99\xB0" +#define ICON_MDI_FILE_SEND "\xEF\x88\xAA" +#define ICON_MDI_FILE_TREE "\xEF\x99\x85" +#define ICON_MDI_FILE_UNDO "\xEF\xA3\x9B" +#define ICON_MDI_FILE_VIDEO "\xEF\x88\xAB" +#define ICON_MDI_FILE_WORD "\xEF\x88\xAC" +#define ICON_MDI_FILE_WORD_BOX "\xEF\x88\xAD" +#define ICON_MDI_FILE_XML "\xEF\x88\xAE" +#define ICON_MDI_FILM "\xEF\x88\xAF" +#define ICON_MDI_FILMSTRIP "\xEF\x88\xB0" +#define ICON_MDI_FILMSTRIP_OFF "\xEF\x88\xB1" +#define ICON_MDI_FILTER "\xEF\x88\xB2" +#define ICON_MDI_FILTER_OUTLINE "\xEF\x88\xB3" +#define ICON_MDI_FILTER_REMOVE "\xEF\x88\xB4" +#define ICON_MDI_FILTER_REMOVE_OUTLINE "\xEF\x88\xB5" +#define ICON_MDI_FILTER_VARIANT "\xEF\x88\xB6" +#define ICON_MDI_FINANCE "\xEF\xA0\x9E" +#define ICON_MDI_FIND_REPLACE "\xEF\x9B\x93" +#define ICON_MDI_FINGERPRINT "\xEF\x88\xB7" +#define ICON_MDI_FIRE "\xEF\x88\xB8" +#define ICON_MDI_FIRE_TRUCK "\xEF\xA2\xAA" +#define ICON_MDI_FIREBASE "\xEF\xA5\xA6" +#define ICON_MDI_FIREFOX "\xEF\x88\xB9" +#define ICON_MDI_FISH "\xEF\x88\xBA" +#define ICON_MDI_FLAG "\xEF\x88\xBB" +#define ICON_MDI_FLAG_CHECKERED "\xEF\x88\xBC" +#define ICON_MDI_FLAG_OUTLINE "\xEF\x88\xBD" +#define ICON_MDI_FLAG_TRIANGLE "\xEF\x88\xBF" +#define ICON_MDI_FLAG_VARIANT "\xEF\x89\x80" +#define ICON_MDI_FLAG_VARIANT_OUTLINE "\xEF\x88\xBE" +#define ICON_MDI_FLASH "\xEF\x89\x81" +#define ICON_MDI_FLASH_AUTO "\xEF\x89\x82" +#define ICON_MDI_FLASH_CIRCLE "\xEF\xA0\x9F" +#define ICON_MDI_FLASH_OFF "\xEF\x89\x83" +#define ICON_MDI_FLASH_OUTLINE "\xEF\x9B\x94" +#define ICON_MDI_FLASH_RED_EYE "\xEF\x99\xBA" +#define ICON_MDI_FLASHLIGHT "\xEF\x89\x84" +#define ICON_MDI_FLASHLIGHT_OFF "\xEF\x89\x85" +#define ICON_MDI_FLASK "\xEF\x82\x93" +#define ICON_MDI_FLASK_EMPTY "\xEF\x82\x94" +#define ICON_MDI_FLASK_EMPTY_OUTLINE "\xEF\x82\x95" +#define ICON_MDI_FLASK_OUTLINE "\xEF\x82\x96" +#define ICON_MDI_FLATTR "\xEF\x89\x86" +#define ICON_MDI_FLIP_TO_BACK "\xEF\x89\x87" +#define ICON_MDI_FLIP_TO_FRONT "\xEF\x89\x88" +#define ICON_MDI_FLOOR_LAMP "\xEF\xA3\x9C" +#define ICON_MDI_FLOOR_PLAN "\xEF\xA0\xA0" +#define ICON_MDI_FLOPPY "\xEF\x89\x89" +#define ICON_MDI_FLOPPY_VARIANT "\xEF\xA7\xAE" +#define ICON_MDI_FLOWER "\xEF\x89\x8A" +#define ICON_MDI_FLOWER_OUTLINE "\xEF\xA7\xAF" +#define ICON_MDI_FLOWER_TULIP "\xEF\xA7\xB0" +#define ICON_MDI_FLOWER_TULIP_OUTLINE "\xEF\xA7\xB1" +#define ICON_MDI_FOLDER "\xEF\x89\x8B" +#define ICON_MDI_FOLDER_ACCOUNT "\xEF\x89\x8C" +#define ICON_MDI_FOLDER_DOWNLOAD "\xEF\x89\x8D" +#define ICON_MDI_FOLDER_EDIT "\xEF\xA3\x9D" +#define ICON_MDI_FOLDER_GOOGLE_DRIVE "\xEF\x89\x8E" +#define ICON_MDI_FOLDER_IMAGE "\xEF\x89\x8F" +#define ICON_MDI_FOLDER_KEY "\xEF\xA2\xAB" +#define ICON_MDI_FOLDER_KEY_NETWORK "\xEF\xA2\xAC" +#define ICON_MDI_FOLDER_LOCK "\xEF\x89\x90" +#define ICON_MDI_FOLDER_LOCK_OPEN "\xEF\x89\x91" +#define ICON_MDI_FOLDER_MOVE "\xEF\x89\x92" +#define ICON_MDI_FOLDER_MULTIPLE "\xEF\x89\x93" +#define ICON_MDI_FOLDER_MULTIPLE_IMAGE "\xEF\x89\x94" +#define ICON_MDI_FOLDER_MULTIPLE_OUTLINE "\xEF\x89\x95" +#define ICON_MDI_FOLDER_NETWORK "\xEF\xA1\xAF" +#define ICON_MDI_FOLDER_OPEN "\xEF\x9D\xAF" +#define ICON_MDI_FOLDER_OUTLINE "\xEF\x89\x96" +#define ICON_MDI_FOLDER_PLUS "\xEF\x89\x97" +#define ICON_MDI_FOLDER_REMOVE "\xEF\x89\x98" +#define ICON_MDI_FOLDER_SEARCH "\xEF\xA5\xA7" +#define ICON_MDI_FOLDER_SEARCH_OUTLINE "\xEF\xA5\xA8" +#define ICON_MDI_FOLDER_STAR "\xEF\x9A\x9C" +#define ICON_MDI_FOLDER_UPLOAD "\xEF\x89\x99" +#define ICON_MDI_FONT_AWESOME "\xEF\x80\xBA" +#define ICON_MDI_FOOD "\xEF\x89\x9A" +#define ICON_MDI_FOOD_APPLE "\xEF\x89\x9B" +#define ICON_MDI_FOOD_CROISSANT "\xEF\x9F\x87" +#define ICON_MDI_FOOD_FORK_DRINK "\xEF\x97\xB2" +#define ICON_MDI_FOOD_OFF "\xEF\x97\xB3" +#define ICON_MDI_FOOD_VARIANT "\xEF\x89\x9C" +#define ICON_MDI_FOOTBALL "\xEF\x89\x9D" +#define ICON_MDI_FOOTBALL_AUSTRALIAN "\xEF\x89\x9E" +#define ICON_MDI_FOOTBALL_HELMET "\xEF\x89\x9F" +#define ICON_MDI_FORKLIFT "\xEF\x9F\x88" +#define ICON_MDI_FORMAT_ALIGN_BOTTOM "\xEF\x9D\x92" +#define ICON_MDI_FORMAT_ALIGN_CENTER "\xEF\x89\xA0" +#define ICON_MDI_FORMAT_ALIGN_JUSTIFY "\xEF\x89\xA1" +#define ICON_MDI_FORMAT_ALIGN_LEFT "\xEF\x89\xA2" +#define ICON_MDI_FORMAT_ALIGN_MIDDLE "\xEF\x9D\x93" +#define ICON_MDI_FORMAT_ALIGN_RIGHT "\xEF\x89\xA3" +#define ICON_MDI_FORMAT_ALIGN_TOP "\xEF\x9D\x94" +#define ICON_MDI_FORMAT_ANNOTATION_PLUS "\xEF\x99\x86" +#define ICON_MDI_FORMAT_BOLD "\xEF\x89\xA4" +#define ICON_MDI_FORMAT_CLEAR "\xEF\x89\xA5" +#define ICON_MDI_FORMAT_COLOR_FILL "\xEF\x89\xA6" +#define ICON_MDI_FORMAT_COLOR_TEXT "\xEF\x9A\x9D" +#define ICON_MDI_FORMAT_COLUMNS "\xEF\xA3\x9E" +#define ICON_MDI_FORMAT_FLOAT_CENTER "\xEF\x89\xA7" +#define ICON_MDI_FORMAT_FLOAT_LEFT "\xEF\x89\xA8" +#define ICON_MDI_FORMAT_FLOAT_NONE "\xEF\x89\xA9" +#define ICON_MDI_FORMAT_FLOAT_RIGHT "\xEF\x89\xAA" +#define ICON_MDI_FORMAT_FONT "\xEF\x9B\x95" +#define ICON_MDI_FORMAT_FONT_SIZE_DECREASE "\xEF\xA7\xB2" +#define ICON_MDI_FORMAT_FONT_SIZE_INCREASE "\xEF\xA7\xB3" +#define ICON_MDI_FORMAT_HEADER_1 "\xEF\x89\xAB" +#define ICON_MDI_FORMAT_HEADER_2 "\xEF\x89\xAC" +#define ICON_MDI_FORMAT_HEADER_3 "\xEF\x89\xAD" +#define ICON_MDI_FORMAT_HEADER_4 "\xEF\x89\xAE" +#define ICON_MDI_FORMAT_HEADER_5 "\xEF\x89\xAF" +#define ICON_MDI_FORMAT_HEADER_6 "\xEF\x89\xB0" +#define ICON_MDI_FORMAT_HEADER_DECREASE "\xEF\x89\xB1" +#define ICON_MDI_FORMAT_HEADER_EQUAL "\xEF\x89\xB2" +#define ICON_MDI_FORMAT_HEADER_INCREASE "\xEF\x89\xB3" +#define ICON_MDI_FORMAT_HEADER_POUND "\xEF\x89\xB4" +#define ICON_MDI_FORMAT_HORIZONTAL_ALIGN_CENTER "\xEF\x98\x9E" +#define ICON_MDI_FORMAT_HORIZONTAL_ALIGN_LEFT "\xEF\x98\x9F" +#define ICON_MDI_FORMAT_HORIZONTAL_ALIGN_RIGHT "\xEF\x98\xA0" +#define ICON_MDI_FORMAT_INDENT_DECREASE "\xEF\x89\xB5" +#define ICON_MDI_FORMAT_INDENT_INCREASE "\xEF\x89\xB6" +#define ICON_MDI_FORMAT_ITALIC "\xEF\x89\xB7" +#define ICON_MDI_FORMAT_LINE_SPACING "\xEF\x89\xB8" +#define ICON_MDI_FORMAT_LINE_STYLE "\xEF\x97\x88" +#define ICON_MDI_FORMAT_LINE_WEIGHT "\xEF\x97\x89" +#define ICON_MDI_FORMAT_LIST_BULLETED "\xEF\x89\xB9" +#define ICON_MDI_FORMAT_LIST_BULLETED_TYPE "\xEF\x89\xBA" +#define ICON_MDI_FORMAT_LIST_CHECKBOX "\xEF\xA5\xA9" +#define ICON_MDI_FORMAT_LIST_CHECKS "\xEF\x9D\x95" +#define ICON_MDI_FORMAT_LIST_NUMBERS "\xEF\x89\xBB" +#define ICON_MDI_FORMAT_PAGE_BREAK "\xEF\x9B\x96" +#define ICON_MDI_FORMAT_PAINT "\xEF\x89\xBC" +#define ICON_MDI_FORMAT_PARAGRAPH "\xEF\x89\xBD" +#define ICON_MDI_FORMAT_PILCROW "\xEF\x9B\x97" +#define ICON_MDI_FORMAT_QUOTE_CLOSE "\xEF\x89\xBE" +#define ICON_MDI_FORMAT_QUOTE_OPEN "\xEF\x9D\x96" +#define ICON_MDI_FORMAT_ROTATE_90 "\xEF\x9A\xA9" +#define ICON_MDI_FORMAT_SECTION "\xEF\x9A\x9E" +#define ICON_MDI_FORMAT_SIZE "\xEF\x89\xBF" +#define ICON_MDI_FORMAT_STRIKETHROUGH "\xEF\x8A\x80" +#define ICON_MDI_FORMAT_STRIKETHROUGH_VARIANT "\xEF\x8A\x81" +#define ICON_MDI_FORMAT_SUBSCRIPT "\xEF\x8A\x82" +#define ICON_MDI_FORMAT_SUPERSCRIPT "\xEF\x8A\x83" +#define ICON_MDI_FORMAT_TEXT "\xEF\x8A\x84" +#define ICON_MDI_FORMAT_TEXTDIRECTION_L_TO_R "\xEF\x8A\x85" +#define ICON_MDI_FORMAT_TEXTDIRECTION_R_TO_L "\xEF\x8A\x86" +#define ICON_MDI_FORMAT_TITLE "\xEF\x97\xB4" +#define ICON_MDI_FORMAT_UNDERLINE "\xEF\x8A\x87" +#define ICON_MDI_FORMAT_VERTICAL_ALIGN_BOTTOM "\xEF\x98\xA1" +#define ICON_MDI_FORMAT_VERTICAL_ALIGN_CENTER "\xEF\x98\xA2" +#define ICON_MDI_FORMAT_VERTICAL_ALIGN_TOP "\xEF\x98\xA3" +#define ICON_MDI_FORMAT_WRAP_INLINE "\xEF\x8A\x88" +#define ICON_MDI_FORMAT_WRAP_SQUARE "\xEF\x8A\x89" +#define ICON_MDI_FORMAT_WRAP_TIGHT "\xEF\x8A\x8A" +#define ICON_MDI_FORMAT_WRAP_TOP_BOTTOM "\xEF\x8A\x8B" +#define ICON_MDI_FORUM "\xEF\x8A\x8C" +#define ICON_MDI_FORUM_OUTLINE "\xEF\xA0\xA1" +#define ICON_MDI_FORWARD "\xEF\x8A\x8D" +#define ICON_MDI_FOUNTAIN "\xEF\xA5\xAA" +#define ICON_MDI_FOURSQUARE "\xEF\x8A\x8E" +#define ICON_MDI_FREEBSD "\xEF\xA3\x9F" +#define ICON_MDI_FRIDGE "\xEF\x8A\x8F" +#define ICON_MDI_FRIDGE_FILLED "\xEF\x8A\x90" +#define ICON_MDI_FRIDGE_FILLED_BOTTOM "\xEF\x8A\x91" +#define ICON_MDI_FRIDGE_FILLED_TOP "\xEF\x8A\x92" +#define ICON_MDI_FUEL "\xEF\x9F\x89" +#define ICON_MDI_FULLSCREEN "\xEF\x8A\x93" +#define ICON_MDI_FULLSCREEN_EXIT "\xEF\x8A\x94" +#define ICON_MDI_FUNCTION "\xEF\x8A\x95" +#define ICON_MDI_FUNCTION_VARIANT "\xEF\xA1\xB0" +#define ICON_MDI_GAMEPAD "\xEF\x8A\x96" +#define ICON_MDI_GAMEPAD_VARIANT "\xEF\x8A\x97" +#define ICON_MDI_GARAGE "\xEF\x9B\x98" +#define ICON_MDI_GARAGE_ALERT "\xEF\xA1\xB1" +#define ICON_MDI_GARAGE_OPEN "\xEF\x9B\x99" +#define ICON_MDI_GAS_CYLINDER "\xEF\x99\x87" +#define ICON_MDI_GAS_STATION "\xEF\x8A\x98" +#define ICON_MDI_GATE "\xEF\x8A\x99" +#define ICON_MDI_GATE_AND "\xEF\xA3\xA0" +#define ICON_MDI_GATE_NAND "\xEF\xA3\xA1" +#define ICON_MDI_GATE_NOR "\xEF\xA3\xA2" +#define ICON_MDI_GATE_NOT "\xEF\xA3\xA3" +#define ICON_MDI_GATE_OR "\xEF\xA3\xA4" +#define ICON_MDI_GATE_XNOR "\xEF\xA3\xA5" +#define ICON_MDI_GATE_XOR "\xEF\xA3\xA6" +#define ICON_MDI_GAUGE "\xEF\x8A\x9A" +#define ICON_MDI_GAUGE_EMPTY "\xEF\xA1\xB2" +#define ICON_MDI_GAUGE_FULL "\xEF\xA1\xB3" +#define ICON_MDI_GAUGE_LOW "\xEF\xA1\xB4" +#define ICON_MDI_GAVEL "\xEF\x8A\x9B" +#define ICON_MDI_GENDER_FEMALE "\xEF\x8A\x9C" +#define ICON_MDI_GENDER_MALE "\xEF\x8A\x9D" +#define ICON_MDI_GENDER_MALE_FEMALE "\xEF\x8A\x9E" +#define ICON_MDI_GENDER_TRANSGENDER "\xEF\x8A\x9F" +#define ICON_MDI_GENTOO "\xEF\xA3\xA7" +#define ICON_MDI_GESTURE "\xEF\x9F\x8A" +#define ICON_MDI_GESTURE_DOUBLE_TAP "\xEF\x9C\xBB" +#define ICON_MDI_GESTURE_SWIPE_DOWN "\xEF\x9C\xBC" +#define ICON_MDI_GESTURE_SWIPE_LEFT "\xEF\x9C\xBD" +#define ICON_MDI_GESTURE_SWIPE_RIGHT "\xEF\x9C\xBE" +#define ICON_MDI_GESTURE_SWIPE_UP "\xEF\x9C\xBF" +#define ICON_MDI_GESTURE_TAP "\xEF\x9D\x80" +#define ICON_MDI_GESTURE_TWO_DOUBLE_TAP "\xEF\x9D\x81" +#define ICON_MDI_GESTURE_TWO_TAP "\xEF\x9D\x82" +#define ICON_MDI_GHOST "\xEF\x8A\xA0" +#define ICON_MDI_GHOST_OFF "\xEF\xA7\xB4" +#define ICON_MDI_GIFT "\xEF\x8A\xA1" +#define ICON_MDI_GIT "\xEF\x8A\xA2" +#define ICON_MDI_GITHUB_BOX "\xEF\x8A\xA3" +#define ICON_MDI_GITHUB_CIRCLE "\xEF\x8A\xA4" +#define ICON_MDI_GITHUB_FACE "\xEF\x9B\x9A" +#define ICON_MDI_GLASS_COCKTAIL "\xEF\x8D\x96" +#define ICON_MDI_GLASS_FLUTE "\xEF\x8A\xA5" +#define ICON_MDI_GLASS_MUG "\xEF\x8A\xA6" +#define ICON_MDI_GLASS_STANGE "\xEF\x8A\xA7" +#define ICON_MDI_GLASS_TULIP "\xEF\x8A\xA8" +#define ICON_MDI_GLASS_WINE "\xEF\xA1\xB5" +#define ICON_MDI_GLASSDOOR "\xEF\x8A\xA9" +#define ICON_MDI_GLASSES "\xEF\x8A\xAA" +#define ICON_MDI_GLOBE_MODEL "\xEF\xA3\xA8" +#define ICON_MDI_GMAIL "\xEF\x8A\xAB" +#define ICON_MDI_GNOME "\xEF\x8A\xAC" +#define ICON_MDI_GOLF "\xEF\xA0\xA2" +#define ICON_MDI_GONDOLA "\xEF\x9A\x85" +#define ICON_MDI_GOOGLE "\xEF\x8A\xAD" +#define ICON_MDI_GOOGLE_ALLO "\xEF\xA0\x81" +#define ICON_MDI_GOOGLE_ANALYTICS "\xEF\x9F\x8B" +#define ICON_MDI_GOOGLE_ASSISTANT "\xEF\x9F\x8C" +#define ICON_MDI_GOOGLE_CARDBOARD "\xEF\x8A\xAE" +#define ICON_MDI_GOOGLE_CHROME "\xEF\x8A\xAF" +#define ICON_MDI_GOOGLE_CIRCLES "\xEF\x8A\xB0" +#define ICON_MDI_GOOGLE_CIRCLES_COMMUNITIES "\xEF\x8A\xB1" +#define ICON_MDI_GOOGLE_CIRCLES_EXTENDED "\xEF\x8A\xB2" +#define ICON_MDI_GOOGLE_CIRCLES_GROUP "\xEF\x8A\xB3" +#define ICON_MDI_GOOGLE_CONTROLLER "\xEF\x8A\xB4" +#define ICON_MDI_GOOGLE_CONTROLLER_OFF "\xEF\x8A\xB5" +#define ICON_MDI_GOOGLE_DRIVE "\xEF\x8A\xB6" +#define ICON_MDI_GOOGLE_EARTH "\xEF\x8A\xB7" +#define ICON_MDI_GOOGLE_FIT "\xEF\xA5\xAB" +#define ICON_MDI_GOOGLE_GLASS "\xEF\x8A\xB8" +#define ICON_MDI_GOOGLE_HANGOUTS "\xEF\x8B\x89" +#define ICON_MDI_GOOGLE_HOME "\xEF\xA0\xA3" +#define ICON_MDI_GOOGLE_KEEP "\xEF\x9B\x9B" +#define ICON_MDI_GOOGLE_LENS "\xEF\xA7\xB5" +#define ICON_MDI_GOOGLE_MAPS "\xEF\x97\xB5" +#define ICON_MDI_GOOGLE_NEARBY "\xEF\x8A\xB9" +#define ICON_MDI_GOOGLE_PAGES "\xEF\x8A\xBA" +#define ICON_MDI_GOOGLE_PHOTOS "\xEF\x9B\x9C" +#define ICON_MDI_GOOGLE_PHYSICAL_WEB "\xEF\x8A\xBB" +#define ICON_MDI_GOOGLE_PLAY "\xEF\x8A\xBC" +#define ICON_MDI_GOOGLE_PLUS "\xEF\x8A\xBD" +#define ICON_MDI_GOOGLE_PLUS_BOX "\xEF\x8A\xBE" +#define ICON_MDI_GOOGLE_SPREADSHEET "\xEF\xA7\xB6" +#define ICON_MDI_GOOGLE_TRANSLATE "\xEF\x8A\xBF" +#define ICON_MDI_GOOGLE_WALLET "\xEF\x8B\x80" +#define ICON_MDI_GPU "\xEF\xA2\xAD" +#define ICON_MDI_GRADIENT "\xEF\x9A\x9F" +#define ICON_MDI_GRAPHQL "\xEF\xA1\xB6" +#define ICON_MDI_GREASE_PENCIL "\xEF\x99\x88" +#define ICON_MDI_GREATER_THAN "\xEF\xA5\xAC" +#define ICON_MDI_GREATER_THAN_OR_EQUAL "\xEF\xA5\xAD" +#define ICON_MDI_GRID "\xEF\x8B\x81" +#define ICON_MDI_GRID_LARGE "\xEF\x9D\x97" +#define ICON_MDI_GRID_OFF "\xEF\x8B\x82" +#define ICON_MDI_GROUP "\xEF\x8B\x83" +#define ICON_MDI_GUITAR_ACOUSTIC "\xEF\x9D\xB0" +#define ICON_MDI_GUITAR_ELECTRIC "\xEF\x8B\x84" +#define ICON_MDI_GUITAR_PICK "\xEF\x8B\x85" +#define ICON_MDI_GUITAR_PICK_OUTLINE "\xEF\x8B\x86" +#define ICON_MDI_GUY_FAWKES_MASK "\xEF\xA0\xA4" +#define ICON_MDI_HACKERNEWS "\xEF\x98\xA4" +#define ICON_MDI_HAMBURGER "\xEF\x9A\x84" +#define ICON_MDI_HAMMER "\xEF\xA3\xA9" +#define ICON_MDI_HAND_POINTING_RIGHT "\xEF\x8B\x87" +#define ICON_MDI_HANGER "\xEF\x8B\x88" +#define ICON_MDI_HARD_HAT "\xEF\xA5\xAE" +#define ICON_MDI_HARDDISK "\xEF\x8B\x8A" +#define ICON_MDI_HEADPHONES "\xEF\x8B\x8B" +#define ICON_MDI_HEADPHONES_BLUETOOTH "\xEF\xA5\xAF" +#define ICON_MDI_HEADPHONES_BOX "\xEF\x8B\x8C" +#define ICON_MDI_HEADPHONES_OFF "\xEF\x9F\x8D" +#define ICON_MDI_HEADPHONES_SETTINGS "\xEF\x8B\x8D" +#define ICON_MDI_HEADSET "\xEF\x8B\x8E" +#define ICON_MDI_HEADSET_DOCK "\xEF\x8B\x8F" +#define ICON_MDI_HEADSET_OFF "\xEF\x8B\x90" +#define ICON_MDI_HEART "\xEF\x8B\x91" +#define ICON_MDI_HEART_BOX "\xEF\x8B\x92" +#define ICON_MDI_HEART_BOX_OUTLINE "\xEF\x8B\x93" +#define ICON_MDI_HEART_BROKEN "\xEF\x8B\x94" +#define ICON_MDI_HEART_CIRCLE "\xEF\xA5\xB0" +#define ICON_MDI_HEART_CIRCLE_OUTLINE "\xEF\xA5\xB1" +#define ICON_MDI_HEART_HALF "\xEF\x9B\x9E" +#define ICON_MDI_HEART_HALF_FULL "\xEF\x9B\x9D" +#define ICON_MDI_HEART_HALF_OUTLINE "\xEF\x9B\x9F" +#define ICON_MDI_HEART_OFF "\xEF\x9D\x98" +#define ICON_MDI_HEART_OUTLINE "\xEF\x8B\x95" +#define ICON_MDI_HEART_PULSE "\xEF\x97\xB6" +#define ICON_MDI_HELP "\xEF\x8B\x96" +#define ICON_MDI_HELP_BOX "\xEF\x9E\x8A" +#define ICON_MDI_HELP_CIRCLE "\xEF\x8B\x97" +#define ICON_MDI_HELP_CIRCLE_OUTLINE "\xEF\x98\xA5" +#define ICON_MDI_HELP_NETWORK "\xEF\x9B\xB4" +#define ICON_MDI_HEXAGON "\xEF\x8B\x98" +#define ICON_MDI_HEXAGON_MULTIPLE "\xEF\x9B\xA0" +#define ICON_MDI_HEXAGON_OUTLINE "\xEF\x8B\x99" +#define ICON_MDI_HIGH_DEFINITION "\xEF\x9F\x8E" +#define ICON_MDI_HIGH_DEFINITION_BOX "\xEF\xA1\xB7" +#define ICON_MDI_HIGHWAY "\xEF\x97\xB7" +#define ICON_MDI_HINDUISM "\xEF\xA5\xB2" +#define ICON_MDI_HISTORY "\xEF\x8B\x9A" +#define ICON_MDI_HOCKEY_PUCK "\xEF\xA1\xB8" +#define ICON_MDI_HOCKEY_STICKS "\xEF\xA1\xB9" +#define ICON_MDI_HOLOLENS "\xEF\x8B\x9B" +#define ICON_MDI_HOME "\xEF\x8B\x9C" +#define ICON_MDI_HOME_ACCOUNT "\xEF\xA0\xA5" +#define ICON_MDI_HOME_ALERT "\xEF\xA1\xBA" +#define ICON_MDI_HOME_ASSISTANT "\xEF\x9F\x8F" +#define ICON_MDI_HOME_AUTOMATION "\xEF\x9F\x90" +#define ICON_MDI_HOME_CIRCLE "\xEF\x9F\x91" +#define ICON_MDI_HOME_CURRENCY_USD "\xEF\xA2\xAE" +#define ICON_MDI_HOME_HEART "\xEF\xA0\xA6" +#define ICON_MDI_HOME_LOCK "\xEF\xA3\xAA" +#define ICON_MDI_HOME_LOCK_OPEN "\xEF\xA3\xAB" +#define ICON_MDI_HOME_MAP_MARKER "\xEF\x97\xB8" +#define ICON_MDI_HOME_MINUS "\xEF\xA5\xB3" +#define ICON_MDI_HOME_MODERN "\xEF\x8B\x9D" +#define ICON_MDI_HOME_OUTLINE "\xEF\x9A\xA0" +#define ICON_MDI_HOME_PLUS "\xEF\xA5\xB4" +#define ICON_MDI_HOME_VARIANT "\xEF\x8B\x9E" +#define ICON_MDI_HOOK "\xEF\x9B\xA1" +#define ICON_MDI_HOOK_OFF "\xEF\x9B\xA2" +#define ICON_MDI_HOPS "\xEF\x8B\x9F" +#define ICON_MDI_HOSPITAL "\xEF\x8B\xA0" +#define ICON_MDI_HOSPITAL_BUILDING "\xEF\x8B\xA1" +#define ICON_MDI_HOSPITAL_MARKER "\xEF\x8B\xA2" +#define ICON_MDI_HOT_TUB "\xEF\xA0\xA7" +#define ICON_MDI_HOTEL "\xEF\x8B\xA3" +#define ICON_MDI_HOUZZ "\xEF\x8B\xA4" +#define ICON_MDI_HOUZZ_BOX "\xEF\x8B\xA5" +#define ICON_MDI_HULU "\xEF\xA0\xA8" +#define ICON_MDI_HUMAN "\xEF\x8B\xA6" +#define ICON_MDI_HUMAN_CHILD "\xEF\x8B\xA7" +#define ICON_MDI_HUMAN_FEMALE "\xEF\x99\x89" +#define ICON_MDI_HUMAN_GREETING "\xEF\x99\x8A" +#define ICON_MDI_HUMAN_HANDSDOWN "\xEF\x99\x8B" +#define ICON_MDI_HUMAN_HANDSUP "\xEF\x99\x8C" +#define ICON_MDI_HUMAN_MALE "\xEF\x99\x8D" +#define ICON_MDI_HUMAN_MALE_FEMALE "\xEF\x8B\xA8" +#define ICON_MDI_HUMAN_PREGNANT "\xEF\x97\x8F" +#define ICON_MDI_HUMBLE_BUNDLE "\xEF\x9D\x83" +#define ICON_MDI_ICE_CREAM "\xEF\xA0\xA9" +#define ICON_MDI_IMAGE "\xEF\x8B\xA9" +#define ICON_MDI_IMAGE_ALBUM "\xEF\x8B\xAA" +#define ICON_MDI_IMAGE_AREA "\xEF\x8B\xAB" +#define ICON_MDI_IMAGE_AREA_CLOSE "\xEF\x8B\xAC" +#define ICON_MDI_IMAGE_BROKEN "\xEF\x8B\xAD" +#define ICON_MDI_IMAGE_BROKEN_VARIANT "\xEF\x8B\xAE" +#define ICON_MDI_IMAGE_FILTER "\xEF\x8B\xAF" +#define ICON_MDI_IMAGE_FILTER_BLACK_WHITE "\xEF\x8B\xB0" +#define ICON_MDI_IMAGE_FILTER_CENTER_FOCUS "\xEF\x8B\xB1" +#define ICON_MDI_IMAGE_FILTER_CENTER_FOCUS_WEAK "\xEF\x8B\xB2" +#define ICON_MDI_IMAGE_FILTER_DRAMA "\xEF\x8B\xB3" +#define ICON_MDI_IMAGE_FILTER_FRAMES "\xEF\x8B\xB4" +#define ICON_MDI_IMAGE_FILTER_HDR "\xEF\x8B\xB5" +#define ICON_MDI_IMAGE_FILTER_NONE "\xEF\x8B\xB6" +#define ICON_MDI_IMAGE_FILTER_TILT_SHIFT "\xEF\x8B\xB7" +#define ICON_MDI_IMAGE_FILTER_VINTAGE "\xEF\x8B\xB8" +#define ICON_MDI_IMAGE_MOVE "\xEF\xA7\xB7" +#define ICON_MDI_IMAGE_MULTIPLE "\xEF\x8B\xB9" +#define ICON_MDI_IMAGE_OFF "\xEF\xA0\xAA" +#define ICON_MDI_IMAGE_OUTLINE "\xEF\xA5\xB5" +#define ICON_MDI_IMAGE_PLUS "\xEF\xA1\xBB" +#define ICON_MDI_IMAGE_SEARCH "\xEF\xA5\xB6" +#define ICON_MDI_IMAGE_SEARCH_OUTLINE "\xEF\xA5\xB7" +#define ICON_MDI_IMPORT "\xEF\x8B\xBA" +#define ICON_MDI_INBOX "\xEF\x9A\x86" +#define ICON_MDI_INBOX_ARROW_DOWN "\xEF\x8B\xBB" +#define ICON_MDI_INBOX_ARROW_UP "\xEF\x8F\x91" +#define ICON_MDI_INBOX_MULTIPLE "\xEF\xA2\xAF" +#define ICON_MDI_INCOGNITO "\xEF\x97\xB9" +#define ICON_MDI_INFINITY "\xEF\x9B\xA3" +#define ICON_MDI_INFORMATION "\xEF\x8B\xBC" +#define ICON_MDI_INFORMATION_OUTLINE "\xEF\x8B\xBD" +#define ICON_MDI_INFORMATION_VARIANT "\xEF\x99\x8E" +#define ICON_MDI_INSTAGRAM "\xEF\x8B\xBE" +#define ICON_MDI_INSTAPAPER "\xEF\x8B\xBF" +#define ICON_MDI_INTERNET_EXPLORER "\xEF\x8C\x80" +#define ICON_MDI_INVERT_COLORS "\xEF\x8C\x81" +#define ICON_MDI_ISLAM "\xEF\xA5\xB8" +#define ICON_MDI_ITUNES "\xEF\x99\xB6" +#define ICON_MDI_JEEPNEY "\xEF\x8C\x82" +#define ICON_MDI_JIRA "\xEF\x8C\x83" +#define ICON_MDI_JQUERY "\xEF\xA1\xBC" +#define ICON_MDI_JSFIDDLE "\xEF\x8C\x84" +#define ICON_MDI_JSON "\xEF\x98\xA6" +#define ICON_MDI_JUDAISM "\xEF\xA5\xB9" +#define ICON_MDI_KARATE "\xEF\xA0\xAB" +#define ICON_MDI_KEG "\xEF\x8C\x85" +#define ICON_MDI_KETTLE "\xEF\x97\xBA" +#define ICON_MDI_KEY "\xEF\x8C\x86" +#define ICON_MDI_KEY_CHANGE "\xEF\x8C\x87" +#define ICON_MDI_KEY_MINUS "\xEF\x8C\x88" +#define ICON_MDI_KEY_PLUS "\xEF\x8C\x89" +#define ICON_MDI_KEY_REMOVE "\xEF\x8C\x8A" +#define ICON_MDI_KEY_VARIANT "\xEF\x8C\x8B" +#define ICON_MDI_KEYBOARD "\xEF\x8C\x8C" +#define ICON_MDI_KEYBOARD_BACKSPACE "\xEF\x8C\x8D" +#define ICON_MDI_KEYBOARD_CAPS "\xEF\x8C\x8E" +#define ICON_MDI_KEYBOARD_CLOSE "\xEF\x8C\x8F" +#define ICON_MDI_KEYBOARD_OFF "\xEF\x8C\x90" +#define ICON_MDI_KEYBOARD_OUTLINE "\xEF\xA5\xBA" +#define ICON_MDI_KEYBOARD_RETURN "\xEF\x8C\x91" +#define ICON_MDI_KEYBOARD_SETTINGS "\xEF\xA7\xB8" +#define ICON_MDI_KEYBOARD_SETTINGS_OUTLINE "\xEF\xA7\xB9" +#define ICON_MDI_KEYBOARD_TAB "\xEF\x8C\x92" +#define ICON_MDI_KEYBOARD_VARIANT "\xEF\x8C\x93" +#define ICON_MDI_KICKSTARTER "\xEF\x9D\x84" +#define ICON_MDI_KNIFE "\xEF\xA7\xBA" +#define ICON_MDI_KNIFE_MILITARY "\xEF\xA7\xBB" +#define ICON_MDI_KODI "\xEF\x8C\x94" +#define ICON_MDI_LABEL "\xEF\x8C\x95" +#define ICON_MDI_LABEL_OUTLINE "\xEF\x8C\x96" +#define ICON_MDI_LADYBUG "\xEF\xA0\xAC" +#define ICON_MDI_LAMBDA "\xEF\x98\xA7" +#define ICON_MDI_LAMP "\xEF\x9A\xB4" +#define ICON_MDI_LAN "\xEF\x8C\x97" +#define ICON_MDI_LAN_CONNECT "\xEF\x8C\x98" +#define ICON_MDI_LAN_DISCONNECT "\xEF\x8C\x99" +#define ICON_MDI_LAN_PENDING "\xEF\x8C\x9A" +#define ICON_MDI_LANGUAGE_C "\xEF\x99\xB1" +#define ICON_MDI_LANGUAGE_CPP "\xEF\x99\xB2" +#define ICON_MDI_LANGUAGE_CSHARP "\xEF\x8C\x9B" +#define ICON_MDI_LANGUAGE_CSS3 "\xEF\x8C\x9C" +#define ICON_MDI_LANGUAGE_GO "\xEF\x9F\x92" +#define ICON_MDI_LANGUAGE_HTML5 "\xEF\x8C\x9D" +#define ICON_MDI_LANGUAGE_JAVASCRIPT "\xEF\x8C\x9E" +#define ICON_MDI_LANGUAGE_LUA "\xEF\xA2\xB0" +#define ICON_MDI_LANGUAGE_PHP "\xEF\x8C\x9F" +#define ICON_MDI_LANGUAGE_PYTHON "\xEF\x8C\xA0" +#define ICON_MDI_LANGUAGE_PYTHON_TEXT "\xEF\x8C\xA1" +#define ICON_MDI_LANGUAGE_R "\xEF\x9F\x93" +#define ICON_MDI_LANGUAGE_SWIFT "\xEF\x9B\xA4" +#define ICON_MDI_LANGUAGE_TYPESCRIPT "\xEF\x9B\xA5" +#define ICON_MDI_LAPTOP "\xEF\x8C\xA2" +#define ICON_MDI_LAPTOP_CHROMEBOOK "\xEF\x8C\xA3" +#define ICON_MDI_LAPTOP_MAC "\xEF\x8C\xA4" +#define ICON_MDI_LAPTOP_OFF "\xEF\x9B\xA6" +#define ICON_MDI_LAPTOP_WINDOWS "\xEF\x8C\xA5" +#define ICON_MDI_LASTFM "\xEF\x8C\xA6" +#define ICON_MDI_LASTPASS "\xEF\x91\x86" +#define ICON_MDI_LAUNCH "\xEF\x8C\xA7" +#define ICON_MDI_LAVA_LAMP "\xEF\x9F\x94" +#define ICON_MDI_LAYERS "\xEF\x8C\xA8" +#define ICON_MDI_LAYERS_OFF "\xEF\x8C\xA9" +#define ICON_MDI_LAYERS_OFF_OUTLINE "\xEF\xA7\xBC" +#define ICON_MDI_LAYERS_OUTLINE "\xEF\xA7\xBD" +#define ICON_MDI_LEAD_PENCIL "\xEF\x99\x8F" +#define ICON_MDI_LEAF "\xEF\x8C\xAA" +#define ICON_MDI_LED_OFF "\xEF\x8C\xAB" +#define ICON_MDI_LED_ON "\xEF\x8C\xAC" +#define ICON_MDI_LED_OUTLINE "\xEF\x8C\xAD" +#define ICON_MDI_LED_STRIP "\xEF\x9F\x95" +#define ICON_MDI_LED_VARIANT_OFF "\xEF\x8C\xAE" +#define ICON_MDI_LED_VARIANT_ON "\xEF\x8C\xAF" +#define ICON_MDI_LED_VARIANT_OUTLINE "\xEF\x8C\xB0" +#define ICON_MDI_LESS_THAN "\xEF\xA5\xBB" +#define ICON_MDI_LESS_THAN_OR_EQUAL "\xEF\xA5\xBC" +#define ICON_MDI_LIBRARY "\xEF\x8C\xB1" +#define ICON_MDI_LIBRARY_BOOKS "\xEF\x8C\xB2" +#define ICON_MDI_LIBRARY_MUSIC "\xEF\x8C\xB3" +#define ICON_MDI_LIBRARY_PLUS "\xEF\x8C\xB4" +#define ICON_MDI_LIFEBUOY "\xEF\xA1\xBD" +#define ICON_MDI_LIGHT_SWITCH "\xEF\xA5\xBD" +#define ICON_MDI_LIGHTBULB "\xEF\x8C\xB5" +#define ICON_MDI_LIGHTBULB_ON "\xEF\x9B\xA7" +#define ICON_MDI_LIGHTBULB_ON_OUTLINE "\xEF\x9B\xA8" +#define ICON_MDI_LIGHTBULB_OUTLINE "\xEF\x8C\xB6" +#define ICON_MDI_LIGHTHOUSE "\xEF\xA7\xBE" +#define ICON_MDI_LIGHTHOUSE_ON "\xEF\xA7\xBF" +#define ICON_MDI_LINK "\xEF\x8C\xB7" +#define ICON_MDI_LINK_OFF "\xEF\x8C\xB8" +#define ICON_MDI_LINK_VARIANT "\xEF\x8C\xB9" +#define ICON_MDI_LINK_VARIANT_OFF "\xEF\x8C\xBA" +#define ICON_MDI_LINKEDIN "\xEF\x8C\xBB" +#define ICON_MDI_LINKEDIN_BOX "\xEF\x8C\xBC" +#define ICON_MDI_LINUX "\xEF\x8C\xBD" +#define ICON_MDI_LINUX_MINT "\xEF\xA3\xAC" +#define ICON_MDI_LOADING "\xEF\x9D\xB1" +#define ICON_MDI_LOCK "\xEF\x8C\xBE" +#define ICON_MDI_LOCK_ALERT "\xEF\xA3\xAD" +#define ICON_MDI_LOCK_CLOCK "\xEF\xA5\xBE" +#define ICON_MDI_LOCK_OPEN "\xEF\x8C\xBF" +#define ICON_MDI_LOCK_OPEN_OUTLINE "\xEF\x8D\x80" +#define ICON_MDI_LOCK_OUTLINE "\xEF\x8D\x81" +#define ICON_MDI_LOCK_PATTERN "\xEF\x9B\xA9" +#define ICON_MDI_LOCK_PLUS "\xEF\x97\xBB" +#define ICON_MDI_LOCK_QUESTION "\xEF\xA3\xAE" +#define ICON_MDI_LOCK_RESET "\xEF\x9D\xB2" +#define ICON_MDI_LOCK_SMART "\xEF\xA2\xB1" +#define ICON_MDI_LOCKER "\xEF\x9F\x96" +#define ICON_MDI_LOCKER_MULTIPLE "\xEF\x9F\x97" +#define ICON_MDI_LOGIN "\xEF\x8D\x82" +#define ICON_MDI_LOGIN_VARIANT "\xEF\x97\xBC" +#define ICON_MDI_LOGOUT "\xEF\x8D\x83" +#define ICON_MDI_LOGOUT_VARIANT "\xEF\x97\xBD" +#define ICON_MDI_LOOKS "\xEF\x8D\x84" +#define ICON_MDI_LOOP "\xEF\x9B\xAA" +#define ICON_MDI_LOUPE "\xEF\x8D\x85" +#define ICON_MDI_LUMX "\xEF\x8D\x86" +#define ICON_MDI_MAGNET "\xEF\x8D\x87" +#define ICON_MDI_MAGNET_ON "\xEF\x8D\x88" +#define ICON_MDI_MAGNIFY "\xEF\x8D\x89" +#define ICON_MDI_MAGNIFY_CLOSE "\xEF\xA5\xBF" +#define ICON_MDI_MAGNIFY_MINUS "\xEF\x8D\x8A" +#define ICON_MDI_MAGNIFY_MINUS_OUTLINE "\xEF\x9B\xAB" +#define ICON_MDI_MAGNIFY_PLUS "\xEF\x8D\x8B" +#define ICON_MDI_MAGNIFY_PLUS_OUTLINE "\xEF\x9B\xAC" +#define ICON_MDI_MAIL_RU "\xEF\x8D\x8C" +#define ICON_MDI_MAILBOX "\xEF\x9B\xAD" +#define ICON_MDI_MAP "\xEF\x8D\x8D" +#define ICON_MDI_MAP_LEGEND "\xEF\xA8\x80" +#define ICON_MDI_MAP_MARKER "\xEF\x8D\x8E" +#define ICON_MDI_MAP_MARKER_CIRCLE "\xEF\x8D\x8F" +#define ICON_MDI_MAP_MARKER_DISTANCE "\xEF\xA3\xAF" +#define ICON_MDI_MAP_MARKER_MINUS "\xEF\x99\x90" +#define ICON_MDI_MAP_MARKER_MULTIPLE "\xEF\x8D\x90" +#define ICON_MDI_MAP_MARKER_OFF "\xEF\x8D\x91" +#define ICON_MDI_MAP_MARKER_OUTLINE "\xEF\x9F\x98" +#define ICON_MDI_MAP_MARKER_PLUS "\xEF\x99\x91" +#define ICON_MDI_MAP_MARKER_RADIUS "\xEF\x8D\x92" +#define ICON_MDI_MAP_MINUS "\xEF\xA6\x80" +#define ICON_MDI_MAP_OUTLINE "\xEF\xA6\x81" +#define ICON_MDI_MAP_PLUS "\xEF\xA6\x82" +#define ICON_MDI_MAP_SEARCH "\xEF\xA6\x83" +#define ICON_MDI_MAP_SEARCH_OUTLINE "\xEF\xA6\x84" +#define ICON_MDI_MARGIN "\xEF\x8D\x93" +#define ICON_MDI_MARKDOWN "\xEF\x8D\x94" +#define ICON_MDI_MARKER "\xEF\x99\x92" +#define ICON_MDI_MARKER_CHECK "\xEF\x8D\x95" +#define ICON_MDI_MATERIAL_DESIGN "\xEF\xA6\x85" +#define ICON_MDI_MATERIAL_UI "\xEF\x8D\x97" +#define ICON_MDI_MATH_COMPASS "\xEF\x8D\x98" +#define ICON_MDI_MATRIX "\xEF\x98\xA8" +#define ICON_MDI_MAXCDN "\xEF\x8D\x99" +#define ICON_MDI_MEDAL "\xEF\xA6\x86" +#define ICON_MDI_MEDICAL_BAG "\xEF\x9B\xAE" +#define ICON_MDI_MEDIUM "\xEF\x8D\x9A" +#define ICON_MDI_MEMORY "\xEF\x8D\x9B" +#define ICON_MDI_MENU "\xEF\x8D\x9C" +#define ICON_MDI_MENU_DOWN "\xEF\x8D\x9D" +#define ICON_MDI_MENU_DOWN_OUTLINE "\xEF\x9A\xB5" +#define ICON_MDI_MENU_LEFT "\xEF\x8D\x9E" +#define ICON_MDI_MENU_LEFT_OUTLINE "\xEF\xA8\x81" +#define ICON_MDI_MENU_RIGHT "\xEF\x8D\x9F" +#define ICON_MDI_MENU_RIGHT_OUTLINE "\xEF\xA8\x82" +#define ICON_MDI_MENU_UP "\xEF\x8D\xA0" +#define ICON_MDI_MENU_UP_OUTLINE "\xEF\x9A\xB6" +#define ICON_MDI_MESSAGE "\xEF\x8D\xA1" +#define ICON_MDI_MESSAGE_ALERT "\xEF\x8D\xA2" +#define ICON_MDI_MESSAGE_ALERT_OUTLINE "\xEF\xA8\x83" +#define ICON_MDI_MESSAGE_BULLETED "\xEF\x9A\xA1" +#define ICON_MDI_MESSAGE_BULLETED_OFF "\xEF\x9A\xA2" +#define ICON_MDI_MESSAGE_DRAW "\xEF\x8D\xA3" +#define ICON_MDI_MESSAGE_IMAGE "\xEF\x8D\xA4" +#define ICON_MDI_MESSAGE_OUTLINE "\xEF\x8D\xA5" +#define ICON_MDI_MESSAGE_PLUS "\xEF\x99\x93" +#define ICON_MDI_MESSAGE_PROCESSING "\xEF\x8D\xA6" +#define ICON_MDI_MESSAGE_REPLY "\xEF\x8D\xA7" +#define ICON_MDI_MESSAGE_REPLY_TEXT "\xEF\x8D\xA8" +#define ICON_MDI_MESSAGE_SETTINGS "\xEF\x9B\xAF" +#define ICON_MDI_MESSAGE_SETTINGS_VARIANT "\xEF\x9B\xB0" +#define ICON_MDI_MESSAGE_TEXT "\xEF\x8D\xA9" +#define ICON_MDI_MESSAGE_TEXT_OUTLINE "\xEF\x8D\xAA" +#define ICON_MDI_MESSAGE_VIDEO "\xEF\x8D\xAB" +#define ICON_MDI_METEOR "\xEF\x98\xA9" +#define ICON_MDI_METRONOME "\xEF\x9F\x99" +#define ICON_MDI_METRONOME_TICK "\xEF\x9F\x9A" +#define ICON_MDI_MICRO_SD "\xEF\x9F\x9B" +#define ICON_MDI_MICROPHONE "\xEF\x8D\xAC" +#define ICON_MDI_MICROPHONE_MINUS "\xEF\xA2\xB2" +#define ICON_MDI_MICROPHONE_OFF "\xEF\x8D\xAD" +#define ICON_MDI_MICROPHONE_OUTLINE "\xEF\x8D\xAE" +#define ICON_MDI_MICROPHONE_PLUS "\xEF\xA2\xB3" +#define ICON_MDI_MICROPHONE_SETTINGS "\xEF\x8D\xAF" +#define ICON_MDI_MICROPHONE_VARIANT "\xEF\x8D\xB0" +#define ICON_MDI_MICROPHONE_VARIANT_OFF "\xEF\x8D\xB1" +#define ICON_MDI_MICROSCOPE "\xEF\x99\x94" +#define ICON_MDI_MICROSOFT "\xEF\x8D\xB2" +#define ICON_MDI_MICROSOFT_DYNAMICS "\xEF\xA6\x87" +#define ICON_MDI_MIDI "\xEF\xA3\xB0" +#define ICON_MDI_MIDI_PORT "\xEF\xA3\xB1" +#define ICON_MDI_MINECRAFT "\xEF\x8D\xB3" +#define ICON_MDI_MINI_SD "\xEF\xA8\x84" +#define ICON_MDI_MINIDISC "\xEF\xA8\x85" +#define ICON_MDI_MINUS "\xEF\x8D\xB4" +#define ICON_MDI_MINUS_BOX "\xEF\x8D\xB5" +#define ICON_MDI_MINUS_BOX_OUTLINE "\xEF\x9B\xB1" +#define ICON_MDI_MINUS_CIRCLE "\xEF\x8D\xB6" +#define ICON_MDI_MINUS_CIRCLE_OUTLINE "\xEF\x8D\xB7" +#define ICON_MDI_MINUS_NETWORK "\xEF\x8D\xB8" +#define ICON_MDI_MIXCLOUD "\xEF\x98\xAA" +#define ICON_MDI_MIXED_REALITY "\xEF\xA1\xBE" +#define ICON_MDI_MIXER "\xEF\x9F\x9C" +#define ICON_MDI_MONITOR "\xEF\x8D\xB9" +#define ICON_MDI_MONITOR_CELLPHONE "\xEF\xA6\x88" +#define ICON_MDI_MONITOR_CELLPHONE_STAR "\xEF\xA6\x89" +#define ICON_MDI_MONITOR_DASHBOARD "\xEF\xA8\x86" +#define ICON_MDI_MONITOR_MULTIPLE "\xEF\x8D\xBA" +#define ICON_MDI_MORE "\xEF\x8D\xBB" +#define ICON_MDI_MOTORBIKE "\xEF\x8D\xBC" +#define ICON_MDI_MOUSE "\xEF\x8D\xBD" +#define ICON_MDI_MOUSE_BLUETOOTH "\xEF\xA6\x8A" +#define ICON_MDI_MOUSE_OFF "\xEF\x8D\xBE" +#define ICON_MDI_MOUSE_VARIANT "\xEF\x8D\xBF" +#define ICON_MDI_MOUSE_VARIANT_OFF "\xEF\x8E\x80" +#define ICON_MDI_MOVE_RESIZE "\xEF\x99\x95" +#define ICON_MDI_MOVE_RESIZE_VARIANT "\xEF\x99\x96" +#define ICON_MDI_MOVIE "\xEF\x8E\x81" +#define ICON_MDI_MOVIE_ROLL "\xEF\x9F\x9D" +#define ICON_MDI_MUFFIN "\xEF\xA6\x8B" +#define ICON_MDI_MULTIPLICATION "\xEF\x8E\x82" +#define ICON_MDI_MULTIPLICATION_BOX "\xEF\x8E\x83" +#define ICON_MDI_MUSHROOM "\xEF\x9F\x9E" +#define ICON_MDI_MUSHROOM_OUTLINE "\xEF\x9F\x9F" +#define ICON_MDI_MUSIC "\xEF\x9D\x99" +#define ICON_MDI_MUSIC_BOX "\xEF\x8E\x84" +#define ICON_MDI_MUSIC_BOX_OUTLINE "\xEF\x8E\x85" +#define ICON_MDI_MUSIC_CIRCLE "\xEF\x8E\x86" +#define ICON_MDI_MUSIC_NOTE "\xEF\x8E\x87" +#define ICON_MDI_MUSIC_NOTE_BLUETOOTH "\xEF\x97\xBE" +#define ICON_MDI_MUSIC_NOTE_BLUETOOTH_OFF "\xEF\x97\xBF" +#define ICON_MDI_MUSIC_NOTE_EIGHTH "\xEF\x8E\x88" +#define ICON_MDI_MUSIC_NOTE_HALF "\xEF\x8E\x89" +#define ICON_MDI_MUSIC_NOTE_OFF "\xEF\x8E\x8A" +#define ICON_MDI_MUSIC_NOTE_QUARTER "\xEF\x8E\x8B" +#define ICON_MDI_MUSIC_NOTE_SIXTEENTH "\xEF\x8E\x8C" +#define ICON_MDI_MUSIC_NOTE_WHOLE "\xEF\x8E\x8D" +#define ICON_MDI_MUSIC_OFF "\xEF\x9D\x9A" +#define ICON_MDI_NAS "\xEF\xA3\xB2" +#define ICON_MDI_NATIVESCRIPT "\xEF\xA1\xBF" +#define ICON_MDI_NATURE "\xEF\x8E\x8E" +#define ICON_MDI_NATURE_PEOPLE "\xEF\x8E\x8F" +#define ICON_MDI_NAVIGATION "\xEF\x8E\x90" +#define ICON_MDI_NEAR_ME "\xEF\x97\x8D" +#define ICON_MDI_NEEDLE "\xEF\x8E\x91" +#define ICON_MDI_NETFLIX "\xEF\x9D\x85" +#define ICON_MDI_NETWORK "\xEF\x9B\xB2" +#define ICON_MDI_NETWORK_STRENGTH_1 "\xEF\xA3\xB3" +#define ICON_MDI_NETWORK_STRENGTH_1_ALERT "\xEF\xA3\xB4" +#define ICON_MDI_NETWORK_STRENGTH_2 "\xEF\xA3\xB5" +#define ICON_MDI_NETWORK_STRENGTH_2_ALERT "\xEF\xA3\xB6" +#define ICON_MDI_NETWORK_STRENGTH_3 "\xEF\xA3\xB7" +#define ICON_MDI_NETWORK_STRENGTH_3_ALERT "\xEF\xA3\xB8" +#define ICON_MDI_NETWORK_STRENGTH_4 "\xEF\xA3\xB9" +#define ICON_MDI_NETWORK_STRENGTH_4_ALERT "\xEF\xA3\xBA" +#define ICON_MDI_NETWORK_STRENGTH_OFF "\xEF\xA3\xBB" +#define ICON_MDI_NETWORK_STRENGTH_OFF_OUTLINE "\xEF\xA3\xBC" +#define ICON_MDI_NETWORK_STRENGTH_OUTLINE "\xEF\xA3\xBD" +#define ICON_MDI_NEW_BOX "\xEF\x8E\x94" +#define ICON_MDI_NEWSPAPER "\xEF\x8E\x95" +#define ICON_MDI_NFC "\xEF\x8E\x96" +#define ICON_MDI_NFC_TAP "\xEF\x8E\x97" +#define ICON_MDI_NFC_VARIANT "\xEF\x8E\x98" +#define ICON_MDI_NINJA "\xEF\x9D\xB3" +#define ICON_MDI_NINTENDO_SWITCH "\xEF\x9F\xA0" +#define ICON_MDI_NODEJS "\xEF\x8E\x99" +#define ICON_MDI_NOT_EQUAL "\xEF\xA6\x8C" +#define ICON_MDI_NOT_EQUAL_VARIANT "\xEF\xA6\x8D" +#define ICON_MDI_NOTE "\xEF\x8E\x9A" +#define ICON_MDI_NOTE_MULTIPLE "\xEF\x9A\xB7" +#define ICON_MDI_NOTE_MULTIPLE_OUTLINE "\xEF\x9A\xB8" +#define ICON_MDI_NOTE_OUTLINE "\xEF\x8E\x9B" +#define ICON_MDI_NOTE_PLUS "\xEF\x8E\x9C" +#define ICON_MDI_NOTE_PLUS_OUTLINE "\xEF\x8E\x9D" +#define ICON_MDI_NOTE_TEXT "\xEF\x8E\x9E" +#define ICON_MDI_NOTEBOOK "\xEF\xA0\xAD" +#define ICON_MDI_NOTIFICATION_CLEAR_ALL "\xEF\x8E\x9F" +#define ICON_MDI_NPM "\xEF\x9B\xB6" +#define ICON_MDI_NPM_VARIANT "\xEF\xA6\x8E" +#define ICON_MDI_NPM_VARIANT_OUTLINE "\xEF\xA6\x8F" +#define ICON_MDI_NUKE "\xEF\x9A\xA3" +#define ICON_MDI_NULL "\xEF\x9F\xA1" +#define ICON_MDI_NUMERIC "\xEF\x8E\xA0" +#define ICON_MDI_NUMERIC_0_BOX "\xEF\x8E\xA1" +#define ICON_MDI_NUMERIC_0_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xA2" +#define ICON_MDI_NUMERIC_0_BOX_OUTLINE "\xEF\x8E\xA3" +#define ICON_MDI_NUMERIC_1_BOX "\xEF\x8E\xA4" +#define ICON_MDI_NUMERIC_1_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xA5" +#define ICON_MDI_NUMERIC_1_BOX_OUTLINE "\xEF\x8E\xA6" +#define ICON_MDI_NUMERIC_2_BOX "\xEF\x8E\xA7" +#define ICON_MDI_NUMERIC_2_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xA8" +#define ICON_MDI_NUMERIC_2_BOX_OUTLINE "\xEF\x8E\xA9" +#define ICON_MDI_NUMERIC_3_BOX "\xEF\x8E\xAA" +#define ICON_MDI_NUMERIC_3_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xAB" +#define ICON_MDI_NUMERIC_3_BOX_OUTLINE "\xEF\x8E\xAC" +#define ICON_MDI_NUMERIC_4_BOX "\xEF\x8E\xAD" +#define ICON_MDI_NUMERIC_4_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xAE" +#define ICON_MDI_NUMERIC_4_BOX_OUTLINE "\xEF\x8E\xAF" +#define ICON_MDI_NUMERIC_5_BOX "\xEF\x8E\xB0" +#define ICON_MDI_NUMERIC_5_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xB1" +#define ICON_MDI_NUMERIC_5_BOX_OUTLINE "\xEF\x8E\xB2" +#define ICON_MDI_NUMERIC_6_BOX "\xEF\x8E\xB3" +#define ICON_MDI_NUMERIC_6_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xB4" +#define ICON_MDI_NUMERIC_6_BOX_OUTLINE "\xEF\x8E\xB5" +#define ICON_MDI_NUMERIC_7_BOX "\xEF\x8E\xB6" +#define ICON_MDI_NUMERIC_7_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xB7" +#define ICON_MDI_NUMERIC_7_BOX_OUTLINE "\xEF\x8E\xB8" +#define ICON_MDI_NUMERIC_8_BOX "\xEF\x8E\xB9" +#define ICON_MDI_NUMERIC_8_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xBA" +#define ICON_MDI_NUMERIC_8_BOX_OUTLINE "\xEF\x8E\xBB" +#define ICON_MDI_NUMERIC_9_BOX "\xEF\x8E\xBC" +#define ICON_MDI_NUMERIC_9_BOX_MULTIPLE_OUTLINE "\xEF\x8E\xBD" +#define ICON_MDI_NUMERIC_9_BOX_OUTLINE "\xEF\x8E\xBE" +#define ICON_MDI_NUMERIC_9_PLUS_BOX "\xEF\x8E\xBF" +#define ICON_MDI_NUMERIC_9_PLUS_BOX_MULTIPLE_OUTLINE "\xEF\x8F\x80" +#define ICON_MDI_NUMERIC_9_PLUS_BOX_OUTLINE "\xEF\x8F\x81" +#define ICON_MDI_NUT "\xEF\x9B\xB7" +#define ICON_MDI_NUTRITION "\xEF\x8F\x82" +#define ICON_MDI_OAR "\xEF\x99\xBB" +#define ICON_MDI_OCTAGON "\xEF\x8F\x83" +#define ICON_MDI_OCTAGON_OUTLINE "\xEF\x8F\x84" +#define ICON_MDI_OCTAGRAM "\xEF\x9B\xB8" +#define ICON_MDI_OCTAGRAM_OUTLINE "\xEF\x9D\xB4" +#define ICON_MDI_ODNOKLASSNIKI "\xEF\x8F\x85" +#define ICON_MDI_OFFICE "\xEF\x8F\x86" +#define ICON_MDI_OFFICE_BUILDING "\xEF\xA6\x90" +#define ICON_MDI_OIL "\xEF\x8F\x87" +#define ICON_MDI_OIL_TEMPERATURE "\xEF\x8F\x88" +#define ICON_MDI_OMEGA "\xEF\x8F\x89" +#define ICON_MDI_ONEDRIVE "\xEF\x8F\x8A" +#define ICON_MDI_ONENOTE "\xEF\x9D\x86" +#define ICON_MDI_ONEPASSWORD "\xEF\xA2\x80" +#define ICON_MDI_OPACITY "\xEF\x97\x8C" +#define ICON_MDI_OPEN_IN_APP "\xEF\x8F\x8B" +#define ICON_MDI_OPEN_IN_NEW "\xEF\x8F\x8C" +#define ICON_MDI_OPENID "\xEF\x8F\x8D" +#define ICON_MDI_OPERA "\xEF\x8F\x8E" +#define ICON_MDI_ORBIT "\xEF\x80\x98" +#define ICON_MDI_ORNAMENT "\xEF\x8F\x8F" +#define ICON_MDI_ORNAMENT_VARIANT "\xEF\x8F\x90" +#define ICON_MDI_OWL "\xEF\x8F\x92" +#define ICON_MDI_PACKAGE "\xEF\x8F\x93" +#define ICON_MDI_PACKAGE_DOWN "\xEF\x8F\x94" +#define ICON_MDI_PACKAGE_UP "\xEF\x8F\x95" +#define ICON_MDI_PACKAGE_VARIANT "\xEF\x8F\x96" +#define ICON_MDI_PACKAGE_VARIANT_CLOSED "\xEF\x8F\x97" +#define ICON_MDI_PAGE_FIRST "\xEF\x98\x80" +#define ICON_MDI_PAGE_LAST "\xEF\x98\x81" +#define ICON_MDI_PAGE_LAYOUT_BODY "\xEF\x9B\xB9" +#define ICON_MDI_PAGE_LAYOUT_FOOTER "\xEF\x9B\xBA" +#define ICON_MDI_PAGE_LAYOUT_HEADER "\xEF\x9B\xBB" +#define ICON_MDI_PAGE_LAYOUT_SIDEBAR_LEFT "\xEF\x9B\xBC" +#define ICON_MDI_PAGE_LAYOUT_SIDEBAR_RIGHT "\xEF\x9B\xBD" +#define ICON_MDI_PALETTE "\xEF\x8F\x98" +#define ICON_MDI_PALETTE_ADVANCED "\xEF\x8F\x99" +#define ICON_MDI_PALETTE_SWATCH "\xEF\xA2\xB4" +#define ICON_MDI_PANDA "\xEF\x8F\x9A" +#define ICON_MDI_PANDORA "\xEF\x8F\x9B" +#define ICON_MDI_PANORAMA "\xEF\x8F\x9C" +#define ICON_MDI_PANORAMA_FISHEYE "\xEF\x8F\x9D" +#define ICON_MDI_PANORAMA_HORIZONTAL "\xEF\x8F\x9E" +#define ICON_MDI_PANORAMA_VERTICAL "\xEF\x8F\x9F" +#define ICON_MDI_PANORAMA_WIDE_ANGLE "\xEF\x8F\xA0" +#define ICON_MDI_PAPER_CUT_VERTICAL "\xEF\x8F\xA1" +#define ICON_MDI_PAPERCLIP "\xEF\x8F\xA2" +#define ICON_MDI_PARKING "\xEF\x8F\xA3" +#define ICON_MDI_PASSPORT "\xEF\x9F\xA2" +#define ICON_MDI_PATREON "\xEF\xA2\x81" +#define ICON_MDI_PAUSE "\xEF\x8F\xA4" +#define ICON_MDI_PAUSE_CIRCLE "\xEF\x8F\xA5" +#define ICON_MDI_PAUSE_CIRCLE_OUTLINE "\xEF\x8F\xA6" +#define ICON_MDI_PAUSE_OCTAGON "\xEF\x8F\xA7" +#define ICON_MDI_PAUSE_OCTAGON_OUTLINE "\xEF\x8F\xA8" +#define ICON_MDI_PAW "\xEF\x8F\xA9" +#define ICON_MDI_PAW_OFF "\xEF\x99\x97" +#define ICON_MDI_PAYPAL "\xEF\xA2\x82" +#define ICON_MDI_PEACE "\xEF\xA2\x83" +#define ICON_MDI_PEN "\xEF\x8F\xAA" +#define ICON_MDI_PENCIL "\xEF\x8F\xAB" +#define ICON_MDI_PENCIL_BOX "\xEF\x8F\xAC" +#define ICON_MDI_PENCIL_BOX_OUTLINE "\xEF\x8F\xAD" +#define ICON_MDI_PENCIL_CIRCLE "\xEF\x9B\xBE" +#define ICON_MDI_PENCIL_CIRCLE_OUTLINE "\xEF\x9D\xB5" +#define ICON_MDI_PENCIL_LOCK "\xEF\x8F\xAE" +#define ICON_MDI_PENCIL_OFF "\xEF\x8F\xAF" +#define ICON_MDI_PENTAGON "\xEF\x9B\xBF" +#define ICON_MDI_PENTAGON_OUTLINE "\xEF\x9C\x80" +#define ICON_MDI_PERCENT "\xEF\x8F\xB0" +#define ICON_MDI_PERIODIC_TABLE "\xEF\xA2\xB5" +#define ICON_MDI_PERIODIC_TABLE_CO2 "\xEF\x9F\xA3" +#define ICON_MDI_PERISCOPE "\xEF\x9D\x87" +#define ICON_MDI_PHARMACY "\xEF\x8F\xB1" +#define ICON_MDI_PHONE "\xEF\x8F\xB2" +#define ICON_MDI_PHONE_BLUETOOTH "\xEF\x8F\xB3" +#define ICON_MDI_PHONE_CLASSIC "\xEF\x98\x82" +#define ICON_MDI_PHONE_FORWARD "\xEF\x8F\xB4" +#define ICON_MDI_PHONE_HANGUP "\xEF\x8F\xB5" +#define ICON_MDI_PHONE_IN_TALK "\xEF\x8F\xB6" +#define ICON_MDI_PHONE_INCOMING "\xEF\x8F\xB7" +#define ICON_MDI_PHONE_LOCKED "\xEF\x8F\xB8" +#define ICON_MDI_PHONE_LOG "\xEF\x8F\xB9" +#define ICON_MDI_PHONE_MINUS "\xEF\x99\x98" +#define ICON_MDI_PHONE_MISSED "\xEF\x8F\xBA" +#define ICON_MDI_PHONE_OUTGOING "\xEF\x8F\xBB" +#define ICON_MDI_PHONE_PAUSED "\xEF\x8F\xBC" +#define ICON_MDI_PHONE_PLUS "\xEF\x99\x99" +#define ICON_MDI_PHONE_RETURN "\xEF\xA0\xAE" +#define ICON_MDI_PHONE_ROTATE_LANDSCAPE "\xEF\xA2\x84" +#define ICON_MDI_PHONE_ROTATE_PORTRAIT "\xEF\xA2\x85" +#define ICON_MDI_PHONE_SETTINGS "\xEF\x8F\xBD" +#define ICON_MDI_PHONE_VOIP "\xEF\x8F\xBE" +#define ICON_MDI_PI "\xEF\x8F\xBF" +#define ICON_MDI_PI_BOX "\xEF\x90\x80" +#define ICON_MDI_PIANO "\xEF\x99\xBC" +#define ICON_MDI_PICKAXE "\xEF\xA2\xB6" +#define ICON_MDI_PIER "\xEF\xA2\x86" +#define ICON_MDI_PIER_CRANE "\xEF\xA2\x87" +#define ICON_MDI_PIG "\xEF\x90\x81" +#define ICON_MDI_PILL "\xEF\x90\x82" +#define ICON_MDI_PILLAR "\xEF\x9C\x81" +#define ICON_MDI_PIN "\xEF\x90\x83" +#define ICON_MDI_PIN_OFF "\xEF\x90\x84" +#define ICON_MDI_PIN_OFF_OUTLINE "\xEF\xA4\xAF" +#define ICON_MDI_PIN_OUTLINE "\xEF\xA4\xB0" +#define ICON_MDI_PINE_TREE "\xEF\x90\x85" +#define ICON_MDI_PINE_TREE_BOX "\xEF\x90\x86" +#define ICON_MDI_PINTEREST "\xEF\x90\x87" +#define ICON_MDI_PINTEREST_BOX "\xEF\x90\x88" +#define ICON_MDI_PIPE "\xEF\x9F\xA4" +#define ICON_MDI_PIPE_DISCONNECTED "\xEF\x9F\xA5" +#define ICON_MDI_PIPE_LEAK "\xEF\xA2\x88" +#define ICON_MDI_PIRATE "\xEF\xA8\x87" +#define ICON_MDI_PISTOL "\xEF\x9C\x82" +#define ICON_MDI_PISTON "\xEF\xA2\x89" +#define ICON_MDI_PIZZA "\xEF\x90\x89" +#define ICON_MDI_PLANE_SHIELD "\xEF\x9A\xBA" +#define ICON_MDI_PLAY "\xEF\x90\x8A" +#define ICON_MDI_PLAY_BOX_OUTLINE "\xEF\x90\x8B" +#define ICON_MDI_PLAY_CIRCLE "\xEF\x90\x8C" +#define ICON_MDI_PLAY_CIRCLE_OUTLINE "\xEF\x90\x8D" +#define ICON_MDI_PLAY_NETWORK "\xEF\xA2\x8A" +#define ICON_MDI_PLAY_PAUSE "\xEF\x90\x8E" +#define ICON_MDI_PLAY_PROTECTED_CONTENT "\xEF\x90\x8F" +#define ICON_MDI_PLAY_SPEED "\xEF\xA3\xBE" +#define ICON_MDI_PLAYLIST_CHECK "\xEF\x97\x87" +#define ICON_MDI_PLAYLIST_EDIT "\xEF\xA3\xBF" +#define ICON_MDI_PLAYLIST_MINUS "\xEF\x90\x90" +#define ICON_MDI_PLAYLIST_PLAY "\xEF\x90\x91" +#define ICON_MDI_PLAYLIST_PLUS "\xEF\x90\x92" +#define ICON_MDI_PLAYLIST_REMOVE "\xEF\x90\x93" +#define ICON_MDI_PLAYSTATION "\xEF\x90\x94" +#define ICON_MDI_PLEX "\xEF\x9A\xB9" +#define ICON_MDI_PLUS "\xEF\x90\x95" +#define ICON_MDI_PLUS_BOX "\xEF\x90\x96" +#define ICON_MDI_PLUS_BOX_OUTLINE "\xEF\x9C\x83" +#define ICON_MDI_PLUS_CIRCLE "\xEF\x90\x97" +#define ICON_MDI_PLUS_CIRCLE_MULTIPLE_OUTLINE "\xEF\x90\x98" +#define ICON_MDI_PLUS_CIRCLE_OUTLINE "\xEF\x90\x99" +#define ICON_MDI_PLUS_MINUS "\xEF\xA6\x91" +#define ICON_MDI_PLUS_MINUS_BOX "\xEF\xA6\x92" +#define ICON_MDI_PLUS_NETWORK "\xEF\x90\x9A" +#define ICON_MDI_PLUS_ONE "\xEF\x90\x9B" +#define ICON_MDI_PLUS_OUTLINE "\xEF\x9C\x84" +#define ICON_MDI_POCKET "\xEF\x90\x9C" +#define ICON_MDI_PODCAST "\xEF\xA6\x93" +#define ICON_MDI_POKEBALL "\xEF\x90\x9D" +#define ICON_MDI_POKEMON_GO "\xEF\xA8\x88" +#define ICON_MDI_POKER_CHIP "\xEF\xA0\xAF" +#define ICON_MDI_POLAROID "\xEF\x90\x9E" +#define ICON_MDI_POLL "\xEF\x90\x9F" +#define ICON_MDI_POLL_BOX "\xEF\x90\xA0" +#define ICON_MDI_POLYMER "\xEF\x90\xA1" +#define ICON_MDI_POOL "\xEF\x98\x86" +#define ICON_MDI_POPCORN "\xEF\x90\xA2" +#define ICON_MDI_POT "\xEF\x99\x9A" +#define ICON_MDI_POT_MIX "\xEF\x99\x9B" +#define ICON_MDI_POUND "\xEF\x90\xA3" +#define ICON_MDI_POUND_BOX "\xEF\x90\xA4" +#define ICON_MDI_POWER "\xEF\x90\xA5" +#define ICON_MDI_POWER_CYCLE "\xEF\xA4\x80" +#define ICON_MDI_POWER_OFF "\xEF\xA4\x81" +#define ICON_MDI_POWER_ON "\xEF\xA4\x82" +#define ICON_MDI_POWER_PLUG "\xEF\x9A\xA4" +#define ICON_MDI_POWER_PLUG_OFF "\xEF\x9A\xA5" +#define ICON_MDI_POWER_SETTINGS "\xEF\x90\xA6" +#define ICON_MDI_POWER_SLEEP "\xEF\xA4\x83" +#define ICON_MDI_POWER_SOCKET "\xEF\x90\xA7" +#define ICON_MDI_POWER_SOCKET_AU "\xEF\xA4\x84" +#define ICON_MDI_POWER_SOCKET_EU "\xEF\x9F\xA6" +#define ICON_MDI_POWER_SOCKET_UK "\xEF\x9F\xA7" +#define ICON_MDI_POWER_SOCKET_US "\xEF\x9F\xA8" +#define ICON_MDI_POWER_STANDBY "\xEF\xA4\x85" +#define ICON_MDI_POWERSHELL "\xEF\xA8\x89" +#define ICON_MDI_PRESCRIPTION "\xEF\x9C\x85" +#define ICON_MDI_PRESENTATION "\xEF\x90\xA8" +#define ICON_MDI_PRESENTATION_PLAY "\xEF\x90\xA9" +#define ICON_MDI_PRINTER "\xEF\x90\xAA" +#define ICON_MDI_PRINTER_3D "\xEF\x90\xAB" +#define ICON_MDI_PRINTER_ALERT "\xEF\x90\xAC" +#define ICON_MDI_PRINTER_SETTINGS "\xEF\x9C\x86" +#define ICON_MDI_PRINTER_WIRELESS "\xEF\xA8\x8A" +#define ICON_MDI_PRIORITY_HIGH "\xEF\x98\x83" +#define ICON_MDI_PRIORITY_LOW "\xEF\x98\x84" +#define ICON_MDI_PROFESSIONAL_HEXAGON "\xEF\x90\xAD" +#define ICON_MDI_PROGRESS_CHECK "\xEF\xA6\x94" +#define ICON_MDI_PROGRESS_CLOCK "\xEF\xA6\x95" +#define ICON_MDI_PROGRESS_DOWNLOAD "\xEF\xA6\x96" +#define ICON_MDI_PROGRESS_UPLOAD "\xEF\xA6\x97" +#define ICON_MDI_PROJECTOR "\xEF\x90\xAE" +#define ICON_MDI_PROJECTOR_SCREEN "\xEF\x90\xAF" +#define ICON_MDI_PUBLISH "\xEF\x9A\xA6" +#define ICON_MDI_PULSE "\xEF\x90\xB0" +#define ICON_MDI_PUZZLE "\xEF\x90\xB1" +#define ICON_MDI_QI "\xEF\xA6\x98" +#define ICON_MDI_QQCHAT "\xEF\x98\x85" +#define ICON_MDI_QRCODE "\xEF\x90\xB2" +#define ICON_MDI_QRCODE_EDIT "\xEF\xA2\xB7" +#define ICON_MDI_QRCODE_SCAN "\xEF\x90\xB3" +#define ICON_MDI_QUADCOPTER "\xEF\x90\xB4" +#define ICON_MDI_QUALITY_HIGH "\xEF\x90\xB5" +#define ICON_MDI_QUALITY_LOW "\xEF\xA8\x8B" +#define ICON_MDI_QUALITY_MEDIUM "\xEF\xA8\x8C" +#define ICON_MDI_QUICKTIME "\xEF\x90\xB6" +#define ICON_MDI_RABBIT "\xEF\xA4\x86" +#define ICON_MDI_RADAR "\xEF\x90\xB7" +#define ICON_MDI_RADIATOR "\xEF\x90\xB8" +#define ICON_MDI_RADIO "\xEF\x90\xB9" +#define ICON_MDI_RADIO_HANDHELD "\xEF\x90\xBA" +#define ICON_MDI_RADIO_TOWER "\xEF\x90\xBB" +#define ICON_MDI_RADIOACTIVE "\xEF\x90\xBC" +#define ICON_MDI_RADIOBOX_BLANK "\xEF\x90\xBD" +#define ICON_MDI_RADIOBOX_MARKED "\xEF\x90\xBE" +#define ICON_MDI_RASPBERRYPI "\xEF\x90\xBF" +#define ICON_MDI_RAY_END "\xEF\x91\x80" +#define ICON_MDI_RAY_END_ARROW "\xEF\x91\x81" +#define ICON_MDI_RAY_START "\xEF\x91\x82" +#define ICON_MDI_RAY_START_ARROW "\xEF\x91\x83" +#define ICON_MDI_RAY_START_END "\xEF\x91\x84" +#define ICON_MDI_RAY_VERTEX "\xEF\x91\x85" +#define ICON_MDI_REACT "\xEF\x9C\x87" +#define ICON_MDI_READ "\xEF\x91\x87" +#define ICON_MDI_RECEIPT "\xEF\x91\x89" +#define ICON_MDI_RECORD "\xEF\x91\x8A" +#define ICON_MDI_RECORD_PLAYER "\xEF\xA6\x99" +#define ICON_MDI_RECORD_REC "\xEF\x91\x8B" +#define ICON_MDI_RECYCLE "\xEF\x91\x8C" +#define ICON_MDI_REDDIT "\xEF\x91\x8D" +#define ICON_MDI_REDO "\xEF\x91\x8E" +#define ICON_MDI_REDO_VARIANT "\xEF\x91\x8F" +#define ICON_MDI_REFLECT_HORIZONTAL "\xEF\xA8\x8D" +#define ICON_MDI_REFLECT_VERTICAL "\xEF\xA8\x8E" +#define ICON_MDI_REFRESH "\xEF\x91\x90" +#define ICON_MDI_REGEX "\xEF\x91\x91" +#define ICON_MDI_RELATIVE_SCALE "\xEF\x91\x92" +#define ICON_MDI_RELOAD "\xEF\x91\x93" +#define ICON_MDI_REMINDER "\xEF\xA2\x8B" +#define ICON_MDI_REMOTE "\xEF\x91\x94" +#define ICON_MDI_REMOTE_DESKTOP "\xEF\xA2\xB8" +#define ICON_MDI_RENAME_BOX "\xEF\x91\x95" +#define ICON_MDI_REORDER_HORIZONTAL "\xEF\x9A\x87" +#define ICON_MDI_REORDER_VERTICAL "\xEF\x9A\x88" +#define ICON_MDI_REPEAT "\xEF\x91\x96" +#define ICON_MDI_REPEAT_OFF "\xEF\x91\x97" +#define ICON_MDI_REPEAT_ONCE "\xEF\x91\x98" +#define ICON_MDI_REPLAY "\xEF\x91\x99" +#define ICON_MDI_REPLY "\xEF\x91\x9A" +#define ICON_MDI_REPLY_ALL "\xEF\x91\x9B" +#define ICON_MDI_REPRODUCTION "\xEF\x91\x9C" +#define ICON_MDI_RESIZE_BOTTOM_RIGHT "\xEF\x91\x9D" +#define ICON_MDI_RESPONSIVE "\xEF\x91\x9E" +#define ICON_MDI_RESTART "\xEF\x9C\x88" +#define ICON_MDI_RESTORE "\xEF\xA6\x9A" +#define ICON_MDI_RESTORE_CLOCK "\xEF\x9A\xA7" +#define ICON_MDI_REWIND "\xEF\x91\x9F" +#define ICON_MDI_REWIND_OUTLINE "\xEF\x9C\x89" +#define ICON_MDI_RHOMBUS "\xEF\x9C\x8A" +#define ICON_MDI_RHOMBUS_MEDIUM "\xEF\xA8\x8F" +#define ICON_MDI_RHOMBUS_OUTLINE "\xEF\x9C\x8B" +#define ICON_MDI_RHOMBUS_SPLIT "\xEF\xA8\x90" +#define ICON_MDI_RIBBON "\xEF\x91\xA0" +#define ICON_MDI_RICE "\xEF\x9F\xA9" +#define ICON_MDI_RING "\xEF\x9F\xAA" +#define ICON_MDI_ROAD "\xEF\x91\xA1" +#define ICON_MDI_ROAD_VARIANT "\xEF\x91\xA2" +#define ICON_MDI_ROBOT "\xEF\x9A\xA8" +#define ICON_MDI_ROBOT_VACUUM "\xEF\x9C\x8C" +#define ICON_MDI_ROBOT_VACUUM_VARIANT "\xEF\xA4\x87" +#define ICON_MDI_ROCKET "\xEF\x91\xA3" +#define ICON_MDI_ROOM_SERVICE "\xEF\xA2\x8C" +#define ICON_MDI_ROTATE_3D "\xEF\x91\xA4" +#define ICON_MDI_ROTATE_LEFT "\xEF\x91\xA5" +#define ICON_MDI_ROTATE_LEFT_VARIANT "\xEF\x91\xA6" +#define ICON_MDI_ROTATE_RIGHT "\xEF\x91\xA7" +#define ICON_MDI_ROTATE_RIGHT_VARIANT "\xEF\x91\xA8" +#define ICON_MDI_ROUNDED_CORNER "\xEF\x98\x87" +#define ICON_MDI_ROUTER_WIRELESS "\xEF\x91\xA9" +#define ICON_MDI_ROUTES "\xEF\x91\xAA" +#define ICON_MDI_ROWING "\xEF\x98\x88" +#define ICON_MDI_RSS "\xEF\x91\xAB" +#define ICON_MDI_RSS_BOX "\xEF\x91\xAC" +#define ICON_MDI_RULER "\xEF\x91\xAD" +#define ICON_MDI_RUN "\xEF\x9C\x8D" +#define ICON_MDI_RUN_FAST "\xEF\x91\xAE" +#define ICON_MDI_SALE "\xEF\x91\xAF" +#define ICON_MDI_SALESFORCE "\xEF\xA2\x8D" +#define ICON_MDI_SASS "\xEF\x9F\xAB" +#define ICON_MDI_SATELLITE "\xEF\x91\xB0" +#define ICON_MDI_SATELLITE_UPLINK "\xEF\xA4\x88" +#define ICON_MDI_SATELLITE_VARIANT "\xEF\x91\xB1" +#define ICON_MDI_SAUSAGE "\xEF\xA2\xB9" +#define ICON_MDI_SAXOPHONE "\xEF\x98\x89" +#define ICON_MDI_SCALE "\xEF\x91\xB2" +#define ICON_MDI_SCALE_BALANCE "\xEF\x97\x91" +#define ICON_MDI_SCALE_BATHROOM "\xEF\x91\xB3" +#define ICON_MDI_SCANNER "\xEF\x9A\xAA" +#define ICON_MDI_SCANNER_OFF "\xEF\xA4\x89" +#define ICON_MDI_SCHOOL "\xEF\x91\xB4" +#define ICON_MDI_SCREEN_ROTATION "\xEF\x91\xB5" +#define ICON_MDI_SCREEN_ROTATION_LOCK "\xEF\x91\xB6" +#define ICON_MDI_SCREWDRIVER "\xEF\x91\xB7" +#define ICON_MDI_SCRIPT "\xEF\x91\xB8" +#define ICON_MDI_SD "\xEF\x91\xB9" +#define ICON_MDI_SEAL "\xEF\x91\xBA" +#define ICON_MDI_SEARCH_WEB "\xEF\x9C\x8E" +#define ICON_MDI_SEAT_FLAT "\xEF\x91\xBB" +#define ICON_MDI_SEAT_FLAT_ANGLED "\xEF\x91\xBC" +#define ICON_MDI_SEAT_INDIVIDUAL_SUITE "\xEF\x91\xBD" +#define ICON_MDI_SEAT_LEGROOM_EXTRA "\xEF\x91\xBE" +#define ICON_MDI_SEAT_LEGROOM_NORMAL "\xEF\x91\xBF" +#define ICON_MDI_SEAT_LEGROOM_REDUCED "\xEF\x92\x80" +#define ICON_MDI_SEAT_RECLINE_EXTRA "\xEF\x92\x81" +#define ICON_MDI_SEAT_RECLINE_NORMAL "\xEF\x92\x82" +#define ICON_MDI_SECURITY "\xEF\x92\x83" +#define ICON_MDI_SECURITY_ACCOUNT "\xEF\xA2\x8E" +#define ICON_MDI_SECURITY_ACCOUNT_OUTLINE "\xEF\xA8\x91" +#define ICON_MDI_SECURITY_CLOSE "\xEF\xA6\x9B" +#define ICON_MDI_SECURITY_HOME "\xEF\x9A\x89" +#define ICON_MDI_SECURITY_LOCK "\xEF\xA6\x9C" +#define ICON_MDI_SECURITY_NETWORK "\xEF\x92\x84" +#define ICON_MDI_SECURITY_OFF "\xEF\xA6\x9D" +#define ICON_MDI_SELECT "\xEF\x92\x85" +#define ICON_MDI_SELECT_ALL "\xEF\x92\x86" +#define ICON_MDI_SELECT_INVERSE "\xEF\x92\x87" +#define ICON_MDI_SELECT_OFF "\xEF\x92\x88" +#define ICON_MDI_SELECTION "\xEF\x92\x89" +#define ICON_MDI_SELECTION_OFF "\xEF\x9D\xB6" +#define ICON_MDI_SEND "\xEF\x92\x8A" +#define ICON_MDI_SEND_SECURE "\xEF\x9F\xAC" +#define ICON_MDI_SERIAL_PORT "\xEF\x99\x9C" +#define ICON_MDI_SERVER "\xEF\x92\x8B" +#define ICON_MDI_SERVER_MINUS "\xEF\x92\x8C" +#define ICON_MDI_SERVER_NETWORK "\xEF\x92\x8D" +#define ICON_MDI_SERVER_NETWORK_OFF "\xEF\x92\x8E" +#define ICON_MDI_SERVER_OFF "\xEF\x92\x8F" +#define ICON_MDI_SERVER_PLUS "\xEF\x92\x90" +#define ICON_MDI_SERVER_REMOVE "\xEF\x92\x91" +#define ICON_MDI_SERVER_SECURITY "\xEF\x92\x92" +#define ICON_MDI_SET_ALL "\xEF\x9D\xB7" +#define ICON_MDI_SET_CENTER "\xEF\x9D\xB8" +#define ICON_MDI_SET_CENTER_RIGHT "\xEF\x9D\xB9" +#define ICON_MDI_SET_LEFT "\xEF\x9D\xBA" +#define ICON_MDI_SET_LEFT_CENTER "\xEF\x9D\xBB" +#define ICON_MDI_SET_LEFT_RIGHT "\xEF\x9D\xBC" +#define ICON_MDI_SET_NONE "\xEF\x9D\xBD" +#define ICON_MDI_SET_RIGHT "\xEF\x9D\xBE" +#define ICON_MDI_SET_TOP_BOX "\xEF\xA6\x9E" +#define ICON_MDI_SETTINGS "\xEF\x92\x93" +#define ICON_MDI_SETTINGS_BOX "\xEF\x92\x94" +#define ICON_MDI_SETTINGS_OUTLINE "\xEF\xA2\xBA" +#define ICON_MDI_SHAPE "\xEF\xA0\xB0" +#define ICON_MDI_SHAPE_CIRCLE_PLUS "\xEF\x99\x9D" +#define ICON_MDI_SHAPE_OUTLINE "\xEF\xA0\xB1" +#define ICON_MDI_SHAPE_PLUS "\xEF\x92\x95" +#define ICON_MDI_SHAPE_POLYGON_PLUS "\xEF\x99\x9E" +#define ICON_MDI_SHAPE_RECTANGLE_PLUS "\xEF\x99\x9F" +#define ICON_MDI_SHAPE_SQUARE_PLUS "\xEF\x99\xA0" +#define ICON_MDI_SHARE "\xEF\x92\x96" +#define ICON_MDI_SHARE_OUTLINE "\xEF\xA4\xB1" +#define ICON_MDI_SHARE_VARIANT "\xEF\x92\x97" +#define ICON_MDI_SHIELD "\xEF\x92\x98" +#define ICON_MDI_SHIELD_HALF_FULL "\xEF\x9D\xBF" +#define ICON_MDI_SHIELD_OUTLINE "\xEF\x92\x99" +#define ICON_MDI_SHIP_WHEEL "\xEF\xA0\xB2" +#define ICON_MDI_SHOPPING "\xEF\x92\x9A" +#define ICON_MDI_SHOPPING_MUSIC "\xEF\x92\x9B" +#define ICON_MDI_SHOVEL "\xEF\x9C\x8F" +#define ICON_MDI_SHOVEL_OFF "\xEF\x9C\x90" +#define ICON_MDI_SHOWER "\xEF\xA6\x9F" +#define ICON_MDI_SHOWER_HEAD "\xEF\xA6\xA0" +#define ICON_MDI_SHREDDER "\xEF\x92\x9C" +#define ICON_MDI_SHUFFLE "\xEF\x92\x9D" +#define ICON_MDI_SHUFFLE_DISABLED "\xEF\x92\x9E" +#define ICON_MDI_SHUFFLE_VARIANT "\xEF\x92\x9F" +#define ICON_MDI_SIGMA "\xEF\x92\xA0" +#define ICON_MDI_SIGMA_LOWER "\xEF\x98\xAB" +#define ICON_MDI_SIGN_CAUTION "\xEF\x92\xA1" +#define ICON_MDI_SIGN_DIRECTION "\xEF\x9E\x80" +#define ICON_MDI_SIGN_TEXT "\xEF\x9E\x81" +#define ICON_MDI_SIGNAL "\xEF\x92\xA2" +#define ICON_MDI_SIGNAL_2G "\xEF\x9C\x91" +#define ICON_MDI_SIGNAL_3G "\xEF\x9C\x92" +#define ICON_MDI_SIGNAL_4G "\xEF\x9C\x93" +#define ICON_MDI_SIGNAL_CELLULAR_1 "\xEF\xA2\xBB" +#define ICON_MDI_SIGNAL_CELLULAR_2 "\xEF\xA2\xBC" +#define ICON_MDI_SIGNAL_CELLULAR_3 "\xEF\xA2\xBD" +#define ICON_MDI_SIGNAL_CELLULAR_OUTLINE "\xEF\xA2\xBE" +#define ICON_MDI_SIGNAL_HSPA "\xEF\x9C\x94" +#define ICON_MDI_SIGNAL_HSPA_PLUS "\xEF\x9C\x95" +#define ICON_MDI_SIGNAL_OFF "\xEF\x9E\x82" +#define ICON_MDI_SIGNAL_VARIANT "\xEF\x98\x8A" +#define ICON_MDI_SILVERWARE "\xEF\x92\xA3" +#define ICON_MDI_SILVERWARE_FORK "\xEF\x92\xA4" +#define ICON_MDI_SILVERWARE_SPOON "\xEF\x92\xA5" +#define ICON_MDI_SILVERWARE_VARIANT "\xEF\x92\xA6" +#define ICON_MDI_SIM "\xEF\x92\xA7" +#define ICON_MDI_SIM_ALERT "\xEF\x92\xA8" +#define ICON_MDI_SIM_OFF "\xEF\x92\xA9" +#define ICON_MDI_SITEMAP "\xEF\x92\xAA" +#define ICON_MDI_SKIP_BACKWARD "\xEF\x92\xAB" +#define ICON_MDI_SKIP_FORWARD "\xEF\x92\xAC" +#define ICON_MDI_SKIP_NEXT "\xEF\x92\xAD" +#define ICON_MDI_SKIP_NEXT_CIRCLE "\xEF\x99\xA1" +#define ICON_MDI_SKIP_NEXT_CIRCLE_OUTLINE "\xEF\x99\xA2" +#define ICON_MDI_SKIP_PREVIOUS "\xEF\x92\xAE" +#define ICON_MDI_SKIP_PREVIOUS_CIRCLE "\xEF\x99\xA3" +#define ICON_MDI_SKIP_PREVIOUS_CIRCLE_OUTLINE "\xEF\x99\xA4" +#define ICON_MDI_SKULL "\xEF\x9A\x8B" +#define ICON_MDI_SKYPE "\xEF\x92\xAF" +#define ICON_MDI_SKYPE_BUSINESS "\xEF\x92\xB0" +#define ICON_MDI_SLACK "\xEF\x92\xB1" +#define ICON_MDI_SLACKWARE "\xEF\xA4\x8A" +#define ICON_MDI_SLEEP "\xEF\x92\xB2" +#define ICON_MDI_SLEEP_OFF "\xEF\x92\xB3" +#define ICON_MDI_SMOKE_DETECTOR "\xEF\x8E\x92" +#define ICON_MDI_SMOKING "\xEF\x92\xB4" +#define ICON_MDI_SMOKING_OFF "\xEF\x92\xB5" +#define ICON_MDI_SNAPCHAT "\xEF\x92\xB6" +#define ICON_MDI_SNOWFLAKE "\xEF\x9C\x96" +#define ICON_MDI_SNOWMAN "\xEF\x92\xB7" +#define ICON_MDI_SOCCER "\xEF\x92\xB8" +#define ICON_MDI_SOCCER_FIELD "\xEF\xA0\xB3" +#define ICON_MDI_SOFA "\xEF\x92\xB9" +#define ICON_MDI_SOLID "\xEF\x9A\x8C" +#define ICON_MDI_SORT "\xEF\x92\xBA" +#define ICON_MDI_SORT_ALPHABETICAL "\xEF\x92\xBB" +#define ICON_MDI_SORT_ASCENDING "\xEF\x92\xBC" +#define ICON_MDI_SORT_DESCENDING "\xEF\x92\xBD" +#define ICON_MDI_SORT_NUMERIC "\xEF\x92\xBE" +#define ICON_MDI_SORT_VARIANT "\xEF\x92\xBF" +#define ICON_MDI_SOUNDCLOUD "\xEF\x93\x80" +#define ICON_MDI_SOURCE_BRANCH "\xEF\x98\xAC" +#define ICON_MDI_SOURCE_COMMIT "\xEF\x9C\x97" +#define ICON_MDI_SOURCE_COMMIT_END "\xEF\x9C\x98" +#define ICON_MDI_SOURCE_COMMIT_END_LOCAL "\xEF\x9C\x99" +#define ICON_MDI_SOURCE_COMMIT_LOCAL "\xEF\x9C\x9A" +#define ICON_MDI_SOURCE_COMMIT_NEXT_LOCAL "\xEF\x9C\x9B" +#define ICON_MDI_SOURCE_COMMIT_START "\xEF\x9C\x9C" +#define ICON_MDI_SOURCE_COMMIT_START_NEXT_LOCAL "\xEF\x9C\x9D" +#define ICON_MDI_SOURCE_FORK "\xEF\x93\x81" +#define ICON_MDI_SOURCE_MERGE "\xEF\x98\xAD" +#define ICON_MDI_SOURCE_PULL "\xEF\x93\x82" +#define ICON_MDI_SOY_SAUCE "\xEF\x9F\xAD" +#define ICON_MDI_SPEAKER "\xEF\x93\x83" +#define ICON_MDI_SPEAKER_BLUETOOTH "\xEF\xA6\xA1" +#define ICON_MDI_SPEAKER_OFF "\xEF\x93\x84" +#define ICON_MDI_SPEAKER_WIRELESS "\xEF\x9C\x9E" +#define ICON_MDI_SPEEDOMETER "\xEF\x93\x85" +#define ICON_MDI_SPELLCHECK "\xEF\x93\x86" +#define ICON_MDI_SPOTIFY "\xEF\x93\x87" +#define ICON_MDI_SPOTLIGHT "\xEF\x93\x88" +#define ICON_MDI_SPOTLIGHT_BEAM "\xEF\x93\x89" +#define ICON_MDI_SPRAY "\xEF\x99\xA5" +#define ICON_MDI_SQUARE "\xEF\x9D\xA3" +#define ICON_MDI_SQUARE_EDIT_OUTLINE "\xEF\xA4\x8B" +#define ICON_MDI_SQUARE_INC "\xEF\x93\x8A" +#define ICON_MDI_SQUARE_INC_CASH "\xEF\x93\x8B" +#define ICON_MDI_SQUARE_MEDIUM "\xEF\xA8\x92" +#define ICON_MDI_SQUARE_MEDIUM_OUTLINE "\xEF\xA8\x93" +#define ICON_MDI_SQUARE_OUTLINE "\xEF\x9D\xA2" +#define ICON_MDI_SQUARE_ROOT "\xEF\x9E\x83" +#define ICON_MDI_SQUARE_ROOT_BOX "\xEF\xA6\xA2" +#define ICON_MDI_SQUARE_SMALL "\xEF\xA8\x94" +#define ICON_MDI_SSH "\xEF\xA2\xBF" +#define ICON_MDI_STACK_EXCHANGE "\xEF\x98\x8B" +#define ICON_MDI_STACK_OVERFLOW "\xEF\x93\x8C" +#define ICON_MDI_STADIUM "\xEF\x9C\x9F" +#define ICON_MDI_STAIRS "\xEF\x93\x8D" +#define ICON_MDI_STANDARD_DEFINITION "\xEF\x9F\xAE" +#define ICON_MDI_STAR "\xEF\x93\x8E" +#define ICON_MDI_STAR_CIRCLE "\xEF\x93\x8F" +#define ICON_MDI_STAR_CIRCLE_OUTLINE "\xEF\xA6\xA3" +#define ICON_MDI_STAR_FACE "\xEF\xA6\xA4" +#define ICON_MDI_STAR_HALF "\xEF\x93\x90" +#define ICON_MDI_STAR_OFF "\xEF\x93\x91" +#define ICON_MDI_STAR_OUTLINE "\xEF\x93\x92" +#define ICON_MDI_STEAM "\xEF\x93\x93" +#define ICON_MDI_STEAM_BOX "\xEF\xA4\x8C" +#define ICON_MDI_STEERING "\xEF\x93\x94" +#define ICON_MDI_STEERING_OFF "\xEF\xA4\x8D" +#define ICON_MDI_STEP_BACKWARD "\xEF\x93\x95" +#define ICON_MDI_STEP_BACKWARD_2 "\xEF\x93\x96" +#define ICON_MDI_STEP_FORWARD "\xEF\x93\x97" +#define ICON_MDI_STEP_FORWARD_2 "\xEF\x93\x98" +#define ICON_MDI_STETHOSCOPE "\xEF\x93\x99" +#define ICON_MDI_STICKER "\xEF\x97\x90" +#define ICON_MDI_STICKER_EMOJI "\xEF\x9E\x84" +#define ICON_MDI_STOCKING "\xEF\x93\x9A" +#define ICON_MDI_STOP "\xEF\x93\x9B" +#define ICON_MDI_STOP_CIRCLE "\xEF\x99\xA6" +#define ICON_MDI_STOP_CIRCLE_OUTLINE "\xEF\x99\xA7" +#define ICON_MDI_STORE "\xEF\x93\x9C" +#define ICON_MDI_STORE_24_HOUR "\xEF\x93\x9D" +#define ICON_MDI_STOVE "\xEF\x93\x9E" +#define ICON_MDI_SUBDIRECTORY_ARROW_LEFT "\xEF\x98\x8C" +#define ICON_MDI_SUBDIRECTORY_ARROW_RIGHT "\xEF\x98\x8D" +#define ICON_MDI_SUBTITLES "\xEF\xA8\x95" +#define ICON_MDI_SUBTITLES_OUTLINE "\xEF\xA8\x96" +#define ICON_MDI_SUBWAY "\xEF\x9A\xAB" +#define ICON_MDI_SUBWAY_VARIANT "\xEF\x93\x9F" +#define ICON_MDI_SUMMIT "\xEF\x9E\x85" +#define ICON_MDI_SUNGLASSES "\xEF\x93\xA0" +#define ICON_MDI_SURROUND_SOUND "\xEF\x97\x85" +#define ICON_MDI_SURROUND_SOUND_2_0 "\xEF\x9F\xAF" +#define ICON_MDI_SURROUND_SOUND_3_1 "\xEF\x9F\xB0" +#define ICON_MDI_SURROUND_SOUND_5_1 "\xEF\x9F\xB1" +#define ICON_MDI_SURROUND_SOUND_7_1 "\xEF\x9F\xB2" +#define ICON_MDI_SVG "\xEF\x9C\xA0" +#define ICON_MDI_SWAP_HORIZONTAL "\xEF\x93\xA1" +#define ICON_MDI_SWAP_HORIZONTAL_VARIANT "\xEF\xA3\x80" +#define ICON_MDI_SWAP_VERTICAL "\xEF\x93\xA2" +#define ICON_MDI_SWAP_VERTICAL_VARIANT "\xEF\xA3\x81" +#define ICON_MDI_SWIM "\xEF\x93\xA3" +#define ICON_MDI_SWITCH "\xEF\x93\xA4" +#define ICON_MDI_SWORD "\xEF\x93\xA5" +#define ICON_MDI_SWORD_CROSS "\xEF\x9E\x86" +#define ICON_MDI_SYNC "\xEF\x93\xA6" +#define ICON_MDI_SYNC_ALERT "\xEF\x93\xA7" +#define ICON_MDI_SYNC_OFF "\xEF\x93\xA8" +#define ICON_MDI_TAB "\xEF\x93\xA9" +#define ICON_MDI_TAB_PLUS "\xEF\x9D\x9B" +#define ICON_MDI_TAB_UNSELECTED "\xEF\x93\xAA" +#define ICON_MDI_TABLE "\xEF\x93\xAB" +#define ICON_MDI_TABLE_BORDER "\xEF\xA8\x97" +#define ICON_MDI_TABLE_COLUMN "\xEF\xA0\xB4" +#define ICON_MDI_TABLE_COLUMN_PLUS_AFTER "\xEF\x93\xAC" +#define ICON_MDI_TABLE_COLUMN_PLUS_BEFORE "\xEF\x93\xAD" +#define ICON_MDI_TABLE_COLUMN_REMOVE "\xEF\x93\xAE" +#define ICON_MDI_TABLE_COLUMN_WIDTH "\xEF\x93\xAF" +#define ICON_MDI_TABLE_EDIT "\xEF\x93\xB0" +#define ICON_MDI_TABLE_LARGE "\xEF\x93\xB1" +#define ICON_MDI_TABLE_MERGE_CELLS "\xEF\xA6\xA5" +#define ICON_MDI_TABLE_OF_CONTENTS "\xEF\xA0\xB5" +#define ICON_MDI_TABLE_ROW "\xEF\xA0\xB6" +#define ICON_MDI_TABLE_ROW_HEIGHT "\xEF\x93\xB2" +#define ICON_MDI_TABLE_ROW_PLUS_AFTER "\xEF\x93\xB3" +#define ICON_MDI_TABLE_ROW_PLUS_BEFORE "\xEF\x93\xB4" +#define ICON_MDI_TABLE_ROW_REMOVE "\xEF\x93\xB5" +#define ICON_MDI_TABLE_SEARCH "\xEF\xA4\x8E" +#define ICON_MDI_TABLE_SETTINGS "\xEF\xA0\xB7" +#define ICON_MDI_TABLET "\xEF\x93\xB6" +#define ICON_MDI_TABLET_ANDROID "\xEF\x93\xB7" +#define ICON_MDI_TABLET_CELLPHONE "\xEF\xA6\xA6" +#define ICON_MDI_TABLET_IPAD "\xEF\x93\xB8" +#define ICON_MDI_TACO "\xEF\x9D\xA1" +#define ICON_MDI_TAG "\xEF\x93\xB9" +#define ICON_MDI_TAG_FACES "\xEF\x93\xBA" +#define ICON_MDI_TAG_HEART "\xEF\x9A\x8A" +#define ICON_MDI_TAG_MINUS "\xEF\xA4\x8F" +#define ICON_MDI_TAG_MULTIPLE "\xEF\x93\xBB" +#define ICON_MDI_TAG_OUTLINE "\xEF\x93\xBC" +#define ICON_MDI_TAG_PLUS "\xEF\x9C\xA1" +#define ICON_MDI_TAG_REMOVE "\xEF\x9C\xA2" +#define ICON_MDI_TAG_TEXT_OUTLINE "\xEF\x93\xBD" +#define ICON_MDI_TARGET "\xEF\x93\xBE" +#define ICON_MDI_TAXI "\xEF\x93\xBF" +#define ICON_MDI_TEACH "\xEF\xA2\x8F" +#define ICON_MDI_TEAMVIEWER "\xEF\x94\x80" +#define ICON_MDI_TELEGRAM "\xEF\x94\x81" +#define ICON_MDI_TELEVISION "\xEF\x94\x82" +#define ICON_MDI_TELEVISION_BOX "\xEF\xA0\xB8" +#define ICON_MDI_TELEVISION_CLASSIC "\xEF\x9F\xB3" +#define ICON_MDI_TELEVISION_CLASSIC_OFF "\xEF\xA0\xB9" +#define ICON_MDI_TELEVISION_GUIDE "\xEF\x94\x83" +#define ICON_MDI_TELEVISION_OFF "\xEF\xA0\xBA" +#define ICON_MDI_TEMPERATURE_CELSIUS "\xEF\x94\x84" +#define ICON_MDI_TEMPERATURE_FAHRENHEIT "\xEF\x94\x85" +#define ICON_MDI_TEMPERATURE_KELVIN "\xEF\x94\x86" +#define ICON_MDI_TENNIS "\xEF\x94\x87" +#define ICON_MDI_TENT "\xEF\x94\x88" +#define ICON_MDI_TERRAIN "\xEF\x94\x89" +#define ICON_MDI_TEST_TUBE "\xEF\x99\xA8" +#define ICON_MDI_TEST_TUBE_EMPTY "\xEF\xA4\x90" +#define ICON_MDI_TEST_TUBE_OFF "\xEF\xA4\x91" +#define ICON_MDI_TEXT "\xEF\xA6\xA7" +#define ICON_MDI_TEXT_SHADOW "\xEF\x99\xA9" +#define ICON_MDI_TEXT_SHORT "\xEF\xA6\xA8" +#define ICON_MDI_TEXT_SUBJECT "\xEF\xA6\xA9" +#define ICON_MDI_TEXT_TO_SPEECH "\xEF\x94\x8A" +#define ICON_MDI_TEXT_TO_SPEECH_OFF "\xEF\x94\x8B" +#define ICON_MDI_TEXTBOX "\xEF\x98\x8E" +#define ICON_MDI_TEXTBOX_PASSWORD "\xEF\x9F\xB4" +#define ICON_MDI_TEXTURE "\xEF\x94\x8C" +#define ICON_MDI_THEATER "\xEF\x94\x8D" +#define ICON_MDI_THEME_LIGHT_DARK "\xEF\x94\x8E" +#define ICON_MDI_THERMOMETER "\xEF\x94\x8F" +#define ICON_MDI_THERMOMETER_LINES "\xEF\x94\x90" +#define ICON_MDI_THERMOSTAT "\xEF\x8E\x93" +#define ICON_MDI_THERMOSTAT_BOX "\xEF\xA2\x90" +#define ICON_MDI_THOUGHT_BUBBLE "\xEF\x9F\xB5" +#define ICON_MDI_THOUGHT_BUBBLE_OUTLINE "\xEF\x9F\xB6" +#define ICON_MDI_THUMB_DOWN "\xEF\x94\x91" +#define ICON_MDI_THUMB_DOWN_OUTLINE "\xEF\x94\x92" +#define ICON_MDI_THUMB_UP "\xEF\x94\x93" +#define ICON_MDI_THUMB_UP_OUTLINE "\xEF\x94\x94" +#define ICON_MDI_THUMBS_UP_DOWN "\xEF\x94\x95" +#define ICON_MDI_TICKET "\xEF\x94\x96" +#define ICON_MDI_TICKET_ACCOUNT "\xEF\x94\x97" +#define ICON_MDI_TICKET_CONFIRMATION "\xEF\x94\x98" +#define ICON_MDI_TICKET_OUTLINE "\xEF\xA4\x92" +#define ICON_MDI_TICKET_PERCENT "\xEF\x9C\xA3" +#define ICON_MDI_TIE "\xEF\x94\x99" +#define ICON_MDI_TILDE "\xEF\x9C\xA4" +#define ICON_MDI_TIMELAPSE "\xEF\x94\x9A" +#define ICON_MDI_TIMER "\xEF\x94\x9B" +#define ICON_MDI_TIMER_10 "\xEF\x94\x9C" +#define ICON_MDI_TIMER_3 "\xEF\x94\x9D" +#define ICON_MDI_TIMER_OFF "\xEF\x94\x9E" +#define ICON_MDI_TIMER_SAND "\xEF\x94\x9F" +#define ICON_MDI_TIMER_SAND_EMPTY "\xEF\x9A\xAC" +#define ICON_MDI_TIMER_SAND_FULL "\xEF\x9E\x8B" +#define ICON_MDI_TIMETABLE "\xEF\x94\xA0" +#define ICON_MDI_TOGGLE_SWITCH "\xEF\x94\xA1" +#define ICON_MDI_TOGGLE_SWITCH_OFF "\xEF\x94\xA2" +#define ICON_MDI_TOGGLE_SWITCH_OFF_OUTLINE "\xEF\xA8\x98" +#define ICON_MDI_TOGGLE_SWITCH_OUTLINE "\xEF\xA8\x99" +#define ICON_MDI_TOILET "\xEF\xA6\xAA" +#define ICON_MDI_TOOLBOX "\xEF\xA6\xAB" +#define ICON_MDI_TOOLBOX_OUTLINE "\xEF\xA6\xAC" +#define ICON_MDI_TOOLTIP "\xEF\x94\xA3" +#define ICON_MDI_TOOLTIP_EDIT "\xEF\x94\xA4" +#define ICON_MDI_TOOLTIP_IMAGE "\xEF\x94\xA5" +#define ICON_MDI_TOOLTIP_OUTLINE "\xEF\x94\xA6" +#define ICON_MDI_TOOLTIP_OUTLINE_PLUS "\xEF\x94\xA7" +#define ICON_MDI_TOOLTIP_TEXT "\xEF\x94\xA8" +#define ICON_MDI_TOOTH "\xEF\xA3\x82" +#define ICON_MDI_TOOTH_OUTLINE "\xEF\x94\xA9" +#define ICON_MDI_TOR "\xEF\x94\xAA" +#define ICON_MDI_TOURNAMENT "\xEF\xA6\xAD" +#define ICON_MDI_TOWER_BEACH "\xEF\x9A\x80" +#define ICON_MDI_TOWER_FIRE "\xEF\x9A\x81" +#define ICON_MDI_TOWING "\xEF\xA0\xBB" +#define ICON_MDI_TRACK_LIGHT "\xEF\xA4\x93" +#define ICON_MDI_TRACKPAD "\xEF\x9F\xB7" +#define ICON_MDI_TRACKPAD_LOCK "\xEF\xA4\xB2" +#define ICON_MDI_TRACTOR "\xEF\xA2\x91" +#define ICON_MDI_TRAFFIC_LIGHT "\xEF\x94\xAB" +#define ICON_MDI_TRAIN "\xEF\x94\xAC" +#define ICON_MDI_TRAIN_VARIANT "\xEF\xA3\x83" +#define ICON_MDI_TRAM "\xEF\x94\xAD" +#define ICON_MDI_TRANSCRIBE "\xEF\x94\xAE" +#define ICON_MDI_TRANSCRIBE_CLOSE "\xEF\x94\xAF" +#define ICON_MDI_TRANSFER "\xEF\x94\xB0" +#define ICON_MDI_TRANSIT_TRANSFER "\xEF\x9A\xAD" +#define ICON_MDI_TRANSITION "\xEF\xA4\x94" +#define ICON_MDI_TRANSITION_MASKED "\xEF\xA4\x95" +#define ICON_MDI_TRANSLATE "\xEF\x97\x8A" +#define ICON_MDI_TREASURE_CHEST "\xEF\x9C\xA5" +#define ICON_MDI_TREE "\xEF\x94\xB1" +#define ICON_MDI_TRELLO "\xEF\x94\xB2" +#define ICON_MDI_TRENDING_DOWN "\xEF\x94\xB3" +#define ICON_MDI_TRENDING_NEUTRAL "\xEF\x94\xB4" +#define ICON_MDI_TRENDING_UP "\xEF\x94\xB5" +#define ICON_MDI_TRIANGLE "\xEF\x94\xB6" +#define ICON_MDI_TRIANGLE_OUTLINE "\xEF\x94\xB7" +#define ICON_MDI_TROPHY "\xEF\x94\xB8" +#define ICON_MDI_TROPHY_AWARD "\xEF\x94\xB9" +#define ICON_MDI_TROPHY_OUTLINE "\xEF\x94\xBA" +#define ICON_MDI_TROPHY_VARIANT "\xEF\x94\xBB" +#define ICON_MDI_TROPHY_VARIANT_OUTLINE "\xEF\x94\xBC" +#define ICON_MDI_TRUCK "\xEF\x94\xBD" +#define ICON_MDI_TRUCK_DELIVERY "\xEF\x94\xBE" +#define ICON_MDI_TRUCK_FAST "\xEF\x9E\x87" +#define ICON_MDI_TRUCK_TRAILER "\xEF\x9C\xA6" +#define ICON_MDI_TSHIRT_CREW "\xEF\x94\xBF" +#define ICON_MDI_TSHIRT_V "\xEF\x95\x80" +#define ICON_MDI_TUMBLE_DRYER "\xEF\xA4\x96" +#define ICON_MDI_TUMBLR "\xEF\x95\x81" +#define ICON_MDI_TUMBLR_BOX "\xEF\xA4\x97" +#define ICON_MDI_TUMBLR_REBLOG "\xEF\x95\x82" +#define ICON_MDI_TUNE "\xEF\x98\xAE" +#define ICON_MDI_TUNE_VERTICAL "\xEF\x99\xAA" +#define ICON_MDI_TWITCH "\xEF\x95\x83" +#define ICON_MDI_TWITTER "\xEF\x95\x84" +#define ICON_MDI_TWITTER_BOX "\xEF\x95\x85" +#define ICON_MDI_TWITTER_CIRCLE "\xEF\x95\x86" +#define ICON_MDI_TWITTER_RETWEET "\xEF\x95\x87" +#define ICON_MDI_TWO_FACTOR_AUTHENTICATION "\xEF\xA6\xAE" +#define ICON_MDI_UBER "\xEF\x9D\x88" +#define ICON_MDI_UBUNTU "\xEF\x95\x88" +#define ICON_MDI_ULTRA_HIGH_DEFINITION "\xEF\x9F\xB8" +#define ICON_MDI_UMBRACO "\xEF\x95\x89" +#define ICON_MDI_UMBRELLA "\xEF\x95\x8A" +#define ICON_MDI_UMBRELLA_CLOSED "\xEF\xA6\xAF" +#define ICON_MDI_UMBRELLA_OUTLINE "\xEF\x95\x8B" +#define ICON_MDI_UNDO "\xEF\x95\x8C" +#define ICON_MDI_UNDO_VARIANT "\xEF\x95\x8D" +#define ICON_MDI_UNFOLD_LESS_HORIZONTAL "\xEF\x95\x8E" +#define ICON_MDI_UNFOLD_LESS_VERTICAL "\xEF\x9D\x9F" +#define ICON_MDI_UNFOLD_MORE_HORIZONTAL "\xEF\x95\x8F" +#define ICON_MDI_UNFOLD_MORE_VERTICAL "\xEF\x9D\xA0" +#define ICON_MDI_UNGROUP "\xEF\x95\x90" +#define ICON_MDI_UNITY "\xEF\x9A\xAE" +#define ICON_MDI_UNREAL "\xEF\xA6\xB0" +#define ICON_MDI_UNTAPPD "\xEF\x95\x91" +#define ICON_MDI_UPDATE "\xEF\x9A\xAF" +#define ICON_MDI_UPLOAD "\xEF\x95\x92" +#define ICON_MDI_UPLOAD_MULTIPLE "\xEF\xA0\xBC" +#define ICON_MDI_UPLOAD_NETWORK "\xEF\x9B\xB5" +#define ICON_MDI_USB "\xEF\x95\x93" +#define ICON_MDI_VAN_PASSENGER "\xEF\x9F\xB9" +#define ICON_MDI_VAN_UTILITY "\xEF\x9F\xBA" +#define ICON_MDI_VANISH "\xEF\x9F\xBB" +#define ICON_MDI_VECTOR_ARRANGE_ABOVE "\xEF\x95\x94" +#define ICON_MDI_VECTOR_ARRANGE_BELOW "\xEF\x95\x95" +#define ICON_MDI_VECTOR_CIRCLE "\xEF\x95\x96" +#define ICON_MDI_VECTOR_CIRCLE_VARIANT "\xEF\x95\x97" +#define ICON_MDI_VECTOR_COMBINE "\xEF\x95\x98" +#define ICON_MDI_VECTOR_CURVE "\xEF\x95\x99" +#define ICON_MDI_VECTOR_DIFFERENCE "\xEF\x95\x9A" +#define ICON_MDI_VECTOR_DIFFERENCE_AB "\xEF\x95\x9B" +#define ICON_MDI_VECTOR_DIFFERENCE_BA "\xEF\x95\x9C" +#define ICON_MDI_VECTOR_ELLIPSE "\xEF\xA2\x92" +#define ICON_MDI_VECTOR_INTERSECTION "\xEF\x95\x9D" +#define ICON_MDI_VECTOR_LINE "\xEF\x95\x9E" +#define ICON_MDI_VECTOR_POINT "\xEF\x95\x9F" +#define ICON_MDI_VECTOR_POLYGON "\xEF\x95\xA0" +#define ICON_MDI_VECTOR_POLYLINE "\xEF\x95\xA1" +#define ICON_MDI_VECTOR_RADIUS "\xEF\x9D\x89" +#define ICON_MDI_VECTOR_RECTANGLE "\xEF\x97\x86" +#define ICON_MDI_VECTOR_SELECTION "\xEF\x95\xA2" +#define ICON_MDI_VECTOR_SQUARE "\xEF\x80\x81" +#define ICON_MDI_VECTOR_TRIANGLE "\xEF\x95\xA3" +#define ICON_MDI_VECTOR_UNION "\xEF\x95\xA4" +#define ICON_MDI_VENMO "\xEF\x95\xB8" +#define ICON_MDI_VERIFIED "\xEF\x95\xA5" +#define ICON_MDI_VHS "\xEF\xA8\x9A" +#define ICON_MDI_VIBRATE "\xEF\x95\xA6" +#define ICON_MDI_VIDEO "\xEF\x95\xA7" +#define ICON_MDI_VIDEO_3D "\xEF\x9F\xBC" +#define ICON_MDI_VIDEO_4K_BOX "\xEF\xA0\xBD" +#define ICON_MDI_VIDEO_ACCOUNT "\xEF\xA4\x98" +#define ICON_MDI_VIDEO_IMAGE "\xEF\xA4\x99" +#define ICON_MDI_VIDEO_INPUT_ANTENNA "\xEF\xA0\xBE" +#define ICON_MDI_VIDEO_INPUT_COMPONENT "\xEF\xA0\xBF" +#define ICON_MDI_VIDEO_INPUT_HDMI "\xEF\xA1\x80" +#define ICON_MDI_VIDEO_INPUT_SVIDEO "\xEF\xA1\x81" +#define ICON_MDI_VIDEO_MINUS "\xEF\xA6\xB1" +#define ICON_MDI_VIDEO_OFF "\xEF\x95\xA8" +#define ICON_MDI_VIDEO_PLUS "\xEF\xA6\xB2" +#define ICON_MDI_VIDEO_STABILIZATION "\xEF\xA4\x9A" +#define ICON_MDI_VIDEO_SWITCH "\xEF\x95\xA9" +#define ICON_MDI_VIDEO_VINTAGE "\xEF\xA8\x9B" +#define ICON_MDI_VIEW_AGENDA "\xEF\x95\xAA" +#define ICON_MDI_VIEW_ARRAY "\xEF\x95\xAB" +#define ICON_MDI_VIEW_CAROUSEL "\xEF\x95\xAC" +#define ICON_MDI_VIEW_COLUMN "\xEF\x95\xAD" +#define ICON_MDI_VIEW_DASHBOARD "\xEF\x95\xAE" +#define ICON_MDI_VIEW_DASHBOARD_OUTLINE "\xEF\xA8\x9C" +#define ICON_MDI_VIEW_DASHBOARD_VARIANT "\xEF\xA1\x82" +#define ICON_MDI_VIEW_DAY "\xEF\x95\xAF" +#define ICON_MDI_VIEW_GRID "\xEF\x95\xB0" +#define ICON_MDI_VIEW_HEADLINE "\xEF\x95\xB1" +#define ICON_MDI_VIEW_LIST "\xEF\x95\xB2" +#define ICON_MDI_VIEW_MODULE "\xEF\x95\xB3" +#define ICON_MDI_VIEW_PARALLEL "\xEF\x9C\xA7" +#define ICON_MDI_VIEW_QUILT "\xEF\x95\xB4" +#define ICON_MDI_VIEW_SEQUENTIAL "\xEF\x9C\xA8" +#define ICON_MDI_VIEW_STREAM "\xEF\x95\xB5" +#define ICON_MDI_VIEW_WEEK "\xEF\x95\xB6" +#define ICON_MDI_VIMEO "\xEF\x95\xB7" +#define ICON_MDI_VIOLIN "\xEF\x98\x8F" +#define ICON_MDI_VIRTUAL_REALITY "\xEF\xA2\x93" +#define ICON_MDI_VISUAL_STUDIO "\xEF\x98\x90" +#define ICON_MDI_VISUAL_STUDIO_CODE "\xEF\xA8\x9D" +#define ICON_MDI_VK "\xEF\x95\xB9" +#define ICON_MDI_VK_BOX "\xEF\x95\xBA" +#define ICON_MDI_VK_CIRCLE "\xEF\x95\xBB" +#define ICON_MDI_VLC "\xEF\x95\xBC" +#define ICON_MDI_VOICE "\xEF\x97\x8B" +#define ICON_MDI_VOICEMAIL "\xEF\x95\xBD" +#define ICON_MDI_VOLLEYBALL "\xEF\xA6\xB3" +#define ICON_MDI_VOLUME_HIGH "\xEF\x95\xBE" +#define ICON_MDI_VOLUME_LOW "\xEF\x95\xBF" +#define ICON_MDI_VOLUME_MEDIUM "\xEF\x96\x80" +#define ICON_MDI_VOLUME_MINUS "\xEF\x9D\x9D" +#define ICON_MDI_VOLUME_MUTE "\xEF\x9D\x9E" +#define ICON_MDI_VOLUME_OFF "\xEF\x96\x81" +#define ICON_MDI_VOLUME_PLUS "\xEF\x9D\x9C" +#define ICON_MDI_VOTE "\xEF\xA8\x9E" +#define ICON_MDI_VOTE_OUTLINE "\xEF\xA8\x9F" +#define ICON_MDI_VPN "\xEF\x96\x82" +#define ICON_MDI_VUEJS "\xEF\xA1\x83" +#define ICON_MDI_WALK "\xEF\x96\x83" +#define ICON_MDI_WALL "\xEF\x9F\xBD" +#define ICON_MDI_WALL_SCONCE "\xEF\xA4\x9B" +#define ICON_MDI_WALL_SCONCE_FLAT "\xEF\xA4\x9C" +#define ICON_MDI_WALL_SCONCE_VARIANT "\xEF\xA4\x9D" +#define ICON_MDI_WALLET "\xEF\x96\x84" +#define ICON_MDI_WALLET_GIFTCARD "\xEF\x96\x85" +#define ICON_MDI_WALLET_MEMBERSHIP "\xEF\x96\x86" +#define ICON_MDI_WALLET_TRAVEL "\xEF\x96\x87" +#define ICON_MDI_WAN "\xEF\x96\x88" +#define ICON_MDI_WASHING_MACHINE "\xEF\x9C\xA9" +#define ICON_MDI_WATCH "\xEF\x96\x89" +#define ICON_MDI_WATCH_EXPORT "\xEF\x96\x8A" +#define ICON_MDI_WATCH_EXPORT_VARIANT "\xEF\xA2\x94" +#define ICON_MDI_WATCH_IMPORT "\xEF\x96\x8B" +#define ICON_MDI_WATCH_IMPORT_VARIANT "\xEF\xA2\x95" +#define ICON_MDI_WATCH_VARIANT "\xEF\xA2\x96" +#define ICON_MDI_WATCH_VIBRATE "\xEF\x9A\xB0" +#define ICON_MDI_WATER "\xEF\x96\x8C" +#define ICON_MDI_WATER_OFF "\xEF\x96\x8D" +#define ICON_MDI_WATER_PERCENT "\xEF\x96\x8E" +#define ICON_MDI_WATER_PUMP "\xEF\x96\x8F" +#define ICON_MDI_WATERMARK "\xEF\x98\x92" +#define ICON_MDI_WAVES "\xEF\x9E\x8C" +#define ICON_MDI_WEATHER_CLOUDY "\xEF\x96\x90" +#define ICON_MDI_WEATHER_FOG "\xEF\x96\x91" +#define ICON_MDI_WEATHER_HAIL "\xEF\x96\x92" +#define ICON_MDI_WEATHER_HURRICANE "\xEF\xA2\x97" +#define ICON_MDI_WEATHER_LIGHTNING "\xEF\x96\x93" +#define ICON_MDI_WEATHER_LIGHTNING_RAINY "\xEF\x99\xBD" +#define ICON_MDI_WEATHER_NIGHT "\xEF\x96\x94" +#define ICON_MDI_WEATHER_PARTLYCLOUDY "\xEF\x96\x95" +#define ICON_MDI_WEATHER_POURING "\xEF\x96\x96" +#define ICON_MDI_WEATHER_RAINY "\xEF\x96\x97" +#define ICON_MDI_WEATHER_SNOWY "\xEF\x96\x98" +#define ICON_MDI_WEATHER_SNOWY_RAINY "\xEF\x99\xBE" +#define ICON_MDI_WEATHER_SUNNY "\xEF\x96\x99" +#define ICON_MDI_WEATHER_SUNSET "\xEF\x96\x9A" +#define ICON_MDI_WEATHER_SUNSET_DOWN "\xEF\x96\x9B" +#define ICON_MDI_WEATHER_SUNSET_UP "\xEF\x96\x9C" +#define ICON_MDI_WEATHER_WINDY "\xEF\x96\x9D" +#define ICON_MDI_WEATHER_WINDY_VARIANT "\xEF\x96\x9E" +#define ICON_MDI_WEB "\xEF\x96\x9F" +#define ICON_MDI_WEBCAM "\xEF\x96\xA0" +#define ICON_MDI_WEBHOOK "\xEF\x98\xAF" +#define ICON_MDI_WEBPACK "\xEF\x9C\xAA" +#define ICON_MDI_WECHAT "\xEF\x98\x91" +#define ICON_MDI_WEIGHT "\xEF\x96\xA1" +#define ICON_MDI_WEIGHT_KILOGRAM "\xEF\x96\xA2" +#define ICON_MDI_WEIGHT_POUND "\xEF\xA6\xB4" +#define ICON_MDI_WHATSAPP "\xEF\x96\xA3" +#define ICON_MDI_WHEELCHAIR_ACCESSIBILITY "\xEF\x96\xA4" +#define ICON_MDI_WHISTLE "\xEF\xA6\xB5" +#define ICON_MDI_WHITE_BALANCE_AUTO "\xEF\x96\xA5" +#define ICON_MDI_WHITE_BALANCE_INCANDESCENT "\xEF\x96\xA6" +#define ICON_MDI_WHITE_BALANCE_IRIDESCENT "\xEF\x96\xA7" +#define ICON_MDI_WHITE_BALANCE_SUNNY "\xEF\x96\xA8" +#define ICON_MDI_WIDGETS "\xEF\x9C\xAB" +#define ICON_MDI_WIFI "\xEF\x96\xA9" +#define ICON_MDI_WIFI_OFF "\xEF\x96\xAA" +#define ICON_MDI_WIFI_STRENGTH_1 "\xEF\xA4\x9E" +#define ICON_MDI_WIFI_STRENGTH_1_ALERT "\xEF\xA4\x9F" +#define ICON_MDI_WIFI_STRENGTH_1_LOCK "\xEF\xA4\xA0" +#define ICON_MDI_WIFI_STRENGTH_2 "\xEF\xA4\xA1" +#define ICON_MDI_WIFI_STRENGTH_2_ALERT "\xEF\xA4\xA2" +#define ICON_MDI_WIFI_STRENGTH_2_LOCK "\xEF\xA4\xA3" +#define ICON_MDI_WIFI_STRENGTH_3 "\xEF\xA4\xA4" +#define ICON_MDI_WIFI_STRENGTH_3_ALERT "\xEF\xA4\xA5" +#define ICON_MDI_WIFI_STRENGTH_3_LOCK "\xEF\xA4\xA6" +#define ICON_MDI_WIFI_STRENGTH_4 "\xEF\xA4\xA7" +#define ICON_MDI_WIFI_STRENGTH_4_ALERT "\xEF\xA4\xA8" +#define ICON_MDI_WIFI_STRENGTH_4_LOCK "\xEF\xA4\xA9" +#define ICON_MDI_WIFI_STRENGTH_ALERT_OUTLINE "\xEF\xA4\xAA" +#define ICON_MDI_WIFI_STRENGTH_LOCK_OUTLINE "\xEF\xA4\xAB" +#define ICON_MDI_WIFI_STRENGTH_OFF "\xEF\xA4\xAC" +#define ICON_MDI_WIFI_STRENGTH_OFF_OUTLINE "\xEF\xA4\xAD" +#define ICON_MDI_WIFI_STRENGTH_OUTLINE "\xEF\xA4\xAE" +#define ICON_MDI_WII "\xEF\x96\xAB" +#define ICON_MDI_WIIU "\xEF\x9C\xAC" +#define ICON_MDI_WIKIPEDIA "\xEF\x96\xAC" +#define ICON_MDI_WINDOW_CLOSE "\xEF\x96\xAD" +#define ICON_MDI_WINDOW_CLOSED "\xEF\x96\xAE" +#define ICON_MDI_WINDOW_MAXIMIZE "\xEF\x96\xAF" +#define ICON_MDI_WINDOW_MINIMIZE "\xEF\x96\xB0" +#define ICON_MDI_WINDOW_OPEN "\xEF\x96\xB1" +#define ICON_MDI_WINDOW_RESTORE "\xEF\x96\xB2" +#define ICON_MDI_WINDOWS "\xEF\x96\xB3" +#define ICON_MDI_WINDOWS_CLASSIC "\xEF\xA8\xA0" +#define ICON_MDI_WORDPRESS "\xEF\x96\xB4" +#define ICON_MDI_WORKER "\xEF\x96\xB5" +#define ICON_MDI_WRAP "\xEF\x96\xB6" +#define ICON_MDI_WRENCH "\xEF\x96\xB7" +#define ICON_MDI_WUNDERLIST "\xEF\x96\xB8" +#define ICON_MDI_XAMARIN "\xEF\xA1\x84" +#define ICON_MDI_XAMARIN_OUTLINE "\xEF\xA1\x85" +#define ICON_MDI_XAML "\xEF\x99\xB3" +#define ICON_MDI_XBOX "\xEF\x96\xB9" +#define ICON_MDI_XBOX_CONTROLLER "\xEF\x96\xBA" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_ALERT "\xEF\x9D\x8A" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_CHARGING "\xEF\xA8\xA1" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_EMPTY "\xEF\x9D\x8B" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_FULL "\xEF\x9D\x8C" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_LOW "\xEF\x9D\x8D" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_MEDIUM "\xEF\x9D\x8E" +#define ICON_MDI_XBOX_CONTROLLER_BATTERY_UNKNOWN "\xEF\x9D\x8F" +#define ICON_MDI_XBOX_CONTROLLER_OFF "\xEF\x96\xBB" +#define ICON_MDI_XDA "\xEF\x96\xBC" +#define ICON_MDI_XING "\xEF\x96\xBD" +#define ICON_MDI_XING_BOX "\xEF\x96\xBE" +#define ICON_MDI_XING_CIRCLE "\xEF\x96\xBF" +#define ICON_MDI_XML "\xEF\x97\x80" +#define ICON_MDI_XMPP "\xEF\x9F\xBE" +#define ICON_MDI_YAMMER "\xEF\x9E\x88" +#define ICON_MDI_YEAST "\xEF\x97\x81" +#define ICON_MDI_YELP "\xEF\x97\x82" +#define ICON_MDI_YIN_YANG "\xEF\x99\xBF" +#define ICON_MDI_YOUTUBE "\xEF\x97\x83" +#define ICON_MDI_YOUTUBE_CREATOR_STUDIO "\xEF\xA1\x86" +#define ICON_MDI_YOUTUBE_GAMING "\xEF\xA1\x87" +#define ICON_MDI_YOUTUBE_TV "\xEF\x91\x88" +#define ICON_MDI_ZIP_BOX "\xEF\x97\x84" +#define ICON_MDI_ZIP_DISK "\xEF\xA8\xA2" +#define ICON_MDI_BLANK "\xEF\x9A\x8C" diff --git a/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h b/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h index ef0c2467803..d3e2e246cf3 100644 --- a/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h +++ b/3rdparty/bgfx/3rdparty/khronos/vulkan/vulkan.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2015-2017 The Khronos Group Inc. +** Copyright (c) 2015-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. @@ -34,16 +34,16 @@ extern "C" { (((major) << 22) | ((minor) << 12) | (patch)) // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. -//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) +//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 // Vulkan 1.0 version number -#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0) +#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)// Patch version should always be set to 0 #define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) // Version of this file -#define VK_HEADER_VERSION 46 +#define VK_HEADER_VERSION 68 #define VK_NULL_HANDLE 0 @@ -146,7 +146,8 @@ typedef enum VkResult { VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_ERROR_INVALID_SHADER_NV = -1000012000, VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000, - VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX = -1000072003, + VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = -1000072003, + VK_ERROR_NOT_PERMITTED_EXT = -1000174001, VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL, VK_RESULT_END_RANGE = VK_INCOMPLETE, VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FRAGMENTED_POOL + 1), @@ -222,6 +223,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, + VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHX = 1000053000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHX = 1000053001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX = 1000053002, @@ -240,47 +242,49 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008, VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHX = 1000060000, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX = 1000060001, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX = 1000060002, VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHX = 1000060003, VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHX = 1000060004, VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHX = 1000060005, VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHX = 1000060006, + VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX = 1000060010, + VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHX = 1000060013, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHX = 1000060014, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHX = 1000060007, VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHX = 1000060008, VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHX = 1000060009, - VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX = 1000060010, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHX = 1000060011, VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHX = 1000060012, VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX = 1000070000, VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX = 1000070001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHX = 1000071000, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHX = 1000071001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHX = 1000071002, - VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHX = 1000071003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHX = 1000071004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHX = 1000071005, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHX = 1000071006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHX = 1000071007, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHX = 1000072000, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHX = 1000072001, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHX = 1000072002, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHX = 1000073000, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHX = 1000073001, - VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHX = 1000073002, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHX = 1000074000, - VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHX = 1000074001, - VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHX = 1000075000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHX = 1000076000, - VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHX = 1000076001, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHX = 1000077000, - VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHX = 1000078000, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHX = 1000078001, - VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHX = 1000078002, - VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHX = 1000079000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000, + VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002, + VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = 1000072000, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = 1000072001, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = 1000072002, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, + VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, + VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, + VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, + VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000, + VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = 1000077000, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, + VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000, VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = 1000085000, VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000, @@ -290,7 +294,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004, VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT = 1000090000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, @@ -300,9 +304,62 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT = 1000101000, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT = 1000101001, VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, + VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000, + VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001, + VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = 1000113000, + VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, + VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, + VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, + VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, + VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR = 1000117000, + VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR = 1000117001, + VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = 1000117002, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = 1000117003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, + VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000, VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000, + VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = 1000130001, + VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, + VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, + VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT = 1000143003, + VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT = 1000143004, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146000, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146001, + VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146002, + VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = 1000146003, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = 1000146004, + VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR = 1000147000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, + VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR = 1000156000, + VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR = 1000156001, + VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR = 1000156002, + VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR = 1000156003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR = 1000156004, + VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = 1000156005, + VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = 1000157000, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = 1000157001, + VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160000, + VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160001, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, + VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), @@ -523,6 +580,40 @@ typedef enum VkFormat { VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, + VK_FORMAT_G8B8G8R8_422_UNORM_KHR = 1000156000, + VK_FORMAT_B8G8R8G8_422_UNORM_KHR = 1000156001, + VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = 1000156002, + VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR = 1000156003, + VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR = 1000156004, + VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR = 1000156005, + VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR = 1000156006, + VK_FORMAT_R10X6_UNORM_PACK16_KHR = 1000156007, + VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR = 1000156008, + VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR = 1000156009, + VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR = 1000156010, + VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR = 1000156011, + VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR = 1000156012, + VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR = 1000156013, + VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR = 1000156014, + VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR = 1000156015, + VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR = 1000156016, + VK_FORMAT_R12X4_UNORM_PACK16_KHR = 1000156017, + VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR = 1000156018, + VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR = 1000156019, + VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR = 1000156020, + VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR = 1000156021, + VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR = 1000156022, + VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR = 1000156023, + VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR = 1000156024, + VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR = 1000156025, + VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR = 1000156026, + VK_FORMAT_G16B16G16R16_422_UNORM_KHR = 1000156027, + VK_FORMAT_B16G16R16G16_422_UNORM_KHR = 1000156028, + VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR = 1000156029, + VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = 1000156030, + VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = 1000156031, + VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = 1000156032, + VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = 1000156033, VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED, VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK, VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1), @@ -590,6 +681,9 @@ typedef enum VkImageLayout { VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, VK_IMAGE_LAYOUT_PREINITIALIZED = 8, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, + VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = 1000117000, + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = 1000117001, VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED, VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1), @@ -655,6 +749,7 @@ typedef enum VkPolygonMode { VK_POLYGON_MODE_FILL = 0, VK_POLYGON_MODE_LINE = 1, VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL, VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT, VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1), @@ -755,6 +850,52 @@ typedef enum VkBlendOp { VK_BLEND_OP_REVERSE_SUBTRACT = 2, VK_BLEND_OP_MIN = 3, VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_ZERO_EXT = 1000148000, + VK_BLEND_OP_SRC_EXT = 1000148001, + VK_BLEND_OP_DST_EXT = 1000148002, + VK_BLEND_OP_SRC_OVER_EXT = 1000148003, + VK_BLEND_OP_DST_OVER_EXT = 1000148004, + VK_BLEND_OP_SRC_IN_EXT = 1000148005, + VK_BLEND_OP_DST_IN_EXT = 1000148006, + VK_BLEND_OP_SRC_OUT_EXT = 1000148007, + VK_BLEND_OP_DST_OUT_EXT = 1000148008, + VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, + VK_BLEND_OP_DST_ATOP_EXT = 1000148010, + VK_BLEND_OP_XOR_EXT = 1000148011, + VK_BLEND_OP_MULTIPLY_EXT = 1000148012, + VK_BLEND_OP_SCREEN_EXT = 1000148013, + VK_BLEND_OP_OVERLAY_EXT = 1000148014, + VK_BLEND_OP_DARKEN_EXT = 1000148015, + VK_BLEND_OP_LIGHTEN_EXT = 1000148016, + VK_BLEND_OP_COLORDODGE_EXT = 1000148017, + VK_BLEND_OP_COLORBURN_EXT = 1000148018, + VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, + VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, + VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, + VK_BLEND_OP_EXCLUSION_EXT = 1000148022, + VK_BLEND_OP_INVERT_EXT = 1000148023, + VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, + VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, + VK_BLEND_OP_LINEARBURN_EXT = 1000148026, + VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, + VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, + VK_BLEND_OP_PINLIGHT_EXT = 1000148029, + VK_BLEND_OP_HARDMIX_EXT = 1000148030, + VK_BLEND_OP_HSL_HUE_EXT = 1000148031, + VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, + VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, + VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, + VK_BLEND_OP_PLUS_EXT = 1000148035, + VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, + VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, + VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, + VK_BLEND_OP_MINUS_EXT = 1000148039, + VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, + VK_BLEND_OP_CONTRAST_EXT = 1000148041, + VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, + VK_BLEND_OP_RED_EXT = 1000148043, + VK_BLEND_OP_GREEN_EXT = 1000148044, + VK_BLEND_OP_BLUE_EXT = 1000148045, VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD, VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX, VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1), @@ -773,6 +914,7 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, + VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE, VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1), @@ -896,6 +1038,49 @@ typedef enum VkSubpassContents { VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF } VkSubpassContents; +typedef enum VkObjectType { + VK_OBJECT_TYPE_UNKNOWN = 0, + VK_OBJECT_TYPE_INSTANCE = 1, + VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, + VK_OBJECT_TYPE_DEVICE = 3, + VK_OBJECT_TYPE_QUEUE = 4, + VK_OBJECT_TYPE_SEMAPHORE = 5, + VK_OBJECT_TYPE_COMMAND_BUFFER = 6, + VK_OBJECT_TYPE_FENCE = 7, + VK_OBJECT_TYPE_DEVICE_MEMORY = 8, + VK_OBJECT_TYPE_BUFFER = 9, + VK_OBJECT_TYPE_IMAGE = 10, + VK_OBJECT_TYPE_EVENT = 11, + VK_OBJECT_TYPE_QUERY_POOL = 12, + VK_OBJECT_TYPE_BUFFER_VIEW = 13, + VK_OBJECT_TYPE_IMAGE_VIEW = 14, + VK_OBJECT_TYPE_SHADER_MODULE = 15, + VK_OBJECT_TYPE_PIPELINE_CACHE = 16, + VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, + VK_OBJECT_TYPE_RENDER_PASS = 18, + VK_OBJECT_TYPE_PIPELINE = 19, + VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, + VK_OBJECT_TYPE_SAMPLER = 21, + VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, + VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, + VK_OBJECT_TYPE_FRAMEBUFFER = 24, + VK_OBJECT_TYPE_COMMAND_POOL = 25, + VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, + VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, + VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, + VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, + VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, + VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, + VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = 1000156000, + VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000, + VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN, + VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_COMMAND_POOL, + VK_OBJECT_TYPE_RANGE_SIZE = (VK_OBJECT_TYPE_COMMAND_POOL - VK_OBJECT_TYPE_UNKNOWN + 1), + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkObjectType; + typedef VkFlags VkInstanceCreateFlags; typedef enum VkFormatFeatureFlagBits { @@ -915,6 +1100,14 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 0x00010000, + VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = 0x00020000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = 0x00040000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = 0x00080000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = 0x00100000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = 0x00200000, + VK_FORMAT_FEATURE_DISJOINT_BIT_KHR = 0x00400000, + VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR = 0x00800000, VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFormatFeatureFlagBits; typedef VkFlags VkFormatFeatureFlags; @@ -940,6 +1133,11 @@ typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, VK_IMAGE_CREATE_BIND_SFR_BIT_KHX = 0x00000040, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 0x00000020, + VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = 0x00000080, + VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR = 0x00000100, + VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000, + VK_IMAGE_CREATE_DISJOINT_BIT_KHR = 0x00000200, + VK_IMAGE_CREATE_ALIAS_BIT_KHR = 0x00000400, VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageCreateFlagBits; typedef VkFlags VkImageCreateFlags; @@ -1013,6 +1211,9 @@ typedef enum VkImageAspectFlagBits { VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, + VK_IMAGE_ASPECT_PLANE_0_BIT_KHR = 0x00000010, + VK_IMAGE_ASPECT_PLANE_1_BIT_KHR = 0x00000020, + VK_IMAGE_ASPECT_PLANE_2_BIT_KHR = 0x00000040, VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageAspectFlagBits; typedef VkFlags VkImageAspectFlags; @@ -1192,6 +1393,7 @@ typedef enum VkAccessFlagBits { VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000, VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000, + VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000, VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkAccessFlagBits; typedef VkFlags VkAccessFlags; @@ -1245,6 +1447,27 @@ typedef enum VkStencilFaceFlagBits { } VkStencilFaceFlagBits; typedef VkFlags VkStencilFaceFlags; +typedef struct VkApplicationInfo { + VkStructureType sType; + const void* pNext; + const char* pApplicationName; + uint32_t applicationVersion; + const char* pEngineName; + uint32_t engineVersion; + uint32_t apiVersion; +} VkApplicationInfo; + +typedef struct VkInstanceCreateInfo { + VkStructureType sType; + const void* pNext; + VkInstanceCreateFlags flags; + const VkApplicationInfo* pApplicationInfo; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; +} VkInstanceCreateInfo; + typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( void* pUserData, size_t size, @@ -1274,29 +1497,6 @@ typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); -typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); - -typedef struct VkApplicationInfo { - VkStructureType sType; - const void* pNext; - const char* pApplicationName; - uint32_t applicationVersion; - const char* pEngineName; - uint32_t engineVersion; - uint32_t apiVersion; -} VkApplicationInfo; - -typedef struct VkInstanceCreateInfo { - VkStructureType sType; - const void* pNext; - VkInstanceCreateFlags flags; - const VkApplicationInfo* pApplicationInfo; - uint32_t enabledLayerCount; - const char* const* ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char* const* ppEnabledExtensionNames; -} VkInstanceCreateInfo; - typedef struct VkAllocationCallbacks { void* pUserData; PFN_vkAllocationFunction pfnAllocation; @@ -1537,6 +1737,7 @@ typedef struct VkPhysicalDeviceMemoryProperties { VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; } VkPhysicalDeviceMemoryProperties; +typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); typedef struct VkDeviceQueueCreateInfo { VkStructureType sType; const void* pNext; @@ -3312,6 +3513,7 @@ typedef enum VkColorSpaceKHR { VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, + VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1), @@ -3323,6 +3525,8 @@ typedef enum VkPresentModeKHR { VK_PRESENT_MODE_MAILBOX_KHR = 1, VK_PRESENT_MODE_FIFO_KHR = 2, VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, + VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR, VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1), @@ -3817,7 +4021,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( #define VK_KHR_win32_surface 1 #include -#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5 +#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 #define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" typedef VkFlags VkWin32SurfaceCreateFlagsKHR; @@ -3982,6 +4186,380 @@ VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( VkCommandPoolTrimFlagsKHR flags); #endif +#define VK_KHR_external_memory_capabilities 1 +#define VK_LUID_SIZE_KHR 8 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsKHR { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT = 0x00000200, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = 0x00000080, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR; + +typedef enum VkExternalMemoryFeatureFlagBitsKHR { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsKHR; +typedef VkFlags VkExternalMemoryFeatureFlagsKHR; + +typedef struct VkExternalMemoryPropertiesKHR { + VkExternalMemoryFeatureFlagsKHR externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsKHR compatibleHandleTypes; +} VkExternalMemoryPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalImageFormatInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalImageFormatInfoKHR; + +typedef struct VkExternalImageFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalImageFormatPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalBufferInfoKHR { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkBufferUsageFlags usage; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalBufferInfoKHR; + +typedef struct VkExternalBufferPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalBufferPropertiesKHR; + +typedef struct VkPhysicalDeviceIDPropertiesKHR { + VkStructureType sType; + void* pNext; + uint8_t deviceUUID[VK_UUID_SIZE]; + uint8_t driverUUID[VK_UUID_SIZE]; + uint8_t deviceLUID[VK_LUID_SIZE_KHR]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; +} VkPhysicalDeviceIDPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, VkExternalBufferPropertiesKHR* pExternalBufferProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, + VkExternalBufferPropertiesKHR* pExternalBufferProperties); +#endif + +#define VK_KHR_external_memory 1 +#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" +#define VK_QUEUE_FAMILY_EXTERNAL_KHR (~0U-1) + +typedef struct VkExternalMemoryImageCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryImageCreateInfoKHR; + +typedef struct VkExternalMemoryBufferCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryBufferCreateInfoKHR; + +typedef struct VkExportMemoryAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExportMemoryAllocateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_memory_win32 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportMemoryWin32HandleInfoKHR; + +typedef struct VkExportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportMemoryWin32HandleInfoKHR; + +typedef struct VkMemoryWin32HandlePropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryWin32HandlePropertiesKHR; + +typedef struct VkMemoryGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR( + VkDevice device, + const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + HANDLE handle, + VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_memory_fd 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" + +typedef struct VkImportMemoryFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportMemoryFdInfoKHR; + +typedef struct VkMemoryFdPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryFdPropertiesKHR; + +typedef struct VkMemoryGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHR)(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR( + VkDevice device, + const VkMemoryGetFdInfoKHR* pGetFdInfo, + int* pFd); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + int fd, + VkMemoryFdPropertiesKHR* pMemoryFdProperties); +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_keyed_mutex 1 +#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeouts; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoKHR; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_capabilities 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" + + +typedef enum VkExternalSemaphoreHandleTypeFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 0x00000008, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000010, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHR; + +typedef enum VkExternalSemaphoreFeatureFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreFeatureFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalSemaphoreInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalSemaphoreInfoKHR; + +typedef struct VkExternalSemaphorePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalSemaphoreHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalSemaphoreFeatureFlagsKHR externalSemaphoreFeatures; +} VkExternalSemaphorePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, + VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); +#endif + +#define VK_KHR_external_semaphore 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" + + +typedef enum VkSemaphoreImportFlagBitsKHR { + VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSemaphoreImportFlagBitsKHR; +typedef VkFlags VkSemaphoreImportFlagsKHR; + +typedef struct VkExportSemaphoreCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR handleTypes; +} VkExportSemaphoreCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_semaphore_win32 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" + +typedef struct VkImportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportSemaphoreWin32HandleInfoKHR; + +typedef struct VkExportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportSemaphoreWin32HandleInfoKHR; + +typedef struct VkD3D12FenceSubmitInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreValuesCount; + const uint64_t* pWaitSemaphoreValues; + uint32_t signalSemaphoreValuesCount; + const uint64_t* pSignalSemaphoreValues; +} VkD3D12FenceSubmitInfoKHR; + +typedef struct VkSemaphoreGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR( + VkDevice device, + const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( + VkDevice device, + const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_fd 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" + +typedef struct VkImportSemaphoreFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportSemaphoreFdInfoKHR; + +typedef struct VkSemaphoreGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHR)(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHR)(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR( + VkDevice device, + const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( + VkDevice device, + const VkSemaphoreGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + #define VK_KHR_push_descriptor 1 #define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 1 #define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" @@ -4005,6 +4583,21 @@ VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR( const VkWriteDescriptorSet* pDescriptorWrites); #endif +#define VK_KHR_16bit_storage 1 +#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 +#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" + +typedef struct VkPhysicalDevice16BitStorageFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 storageBuffer16BitAccess; + VkBool32 uniformAndStorageBuffer16BitAccess; + VkBool32 storagePushConstant16; + VkBool32 storageInputOutput16; +} VkPhysicalDevice16BitStorageFeaturesKHR; + + + #define VK_KHR_incremental_present 1 #define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1 #define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" @@ -4101,12 +4694,518 @@ VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( const void* pData); #endif +#define VK_KHR_shared_presentable_image 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" + +typedef struct VkSharedPresentSurfaceCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkImageUsageFlags sharedPresentSupportedUsageFlags; +} VkSharedPresentSurfaceCapabilitiesKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( + VkDevice device, + VkSwapchainKHR swapchain); +#endif + +#define VK_KHR_external_fence_capabilities 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" + + +typedef enum VkExternalFenceHandleTypeFlagBitsKHR { + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000008, + VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalFenceHandleTypeFlagsKHR; + +typedef enum VkExternalFenceFeatureFlagBitsKHR { + VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceFeatureFlagBitsKHR; +typedef VkFlags VkExternalFenceFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalFenceInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalFenceInfoKHR; + +typedef struct VkExternalFencePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalFenceHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalFenceHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalFenceFeatureFlagsKHR externalFenceFeatures; +} VkExternalFencePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, VkExternalFencePropertiesKHR* pExternalFenceProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, + VkExternalFencePropertiesKHR* pExternalFenceProperties); +#endif + +#define VK_KHR_external_fence 1 +#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" + + +typedef enum VkFenceImportFlagBitsKHR { + VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkFenceImportFlagBitsKHR; +typedef VkFlags VkFenceImportFlagsKHR; + +typedef struct VkExportFenceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagsKHR handleTypes; +} VkExportFenceCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_fence_win32 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" + +typedef struct VkImportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportFenceWin32HandleInfoKHR; + +typedef struct VkExportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportFenceWin32HandleInfoKHR; + +typedef struct VkFenceGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR( + VkDevice device, + const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( + VkDevice device, + const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_fence_fd 1 +#define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" + +typedef struct VkImportFenceFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportFenceFdInfoKHR; + +typedef struct VkFenceGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceFdKHR)(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceFdKHR)(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR( + VkDevice device, + const VkImportFenceFdInfoKHR* pImportFenceFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( + VkDevice device, + const VkFenceGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_maintenance2 1 +#define VK_KHR_MAINTENANCE2_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE2_EXTENSION_NAME "VK_KHR_maintenance2" + + +typedef enum VkPointClippingBehaviorKHR { + VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = 0, + VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = 1, + VK_POINT_CLIPPING_BEHAVIOR_BEGIN_RANGE_KHR = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR, + VK_POINT_CLIPPING_BEHAVIOR_END_RANGE_KHR = VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR, + VK_POINT_CLIPPING_BEHAVIOR_RANGE_SIZE_KHR = (VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR - VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR + 1), + VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPointClippingBehaviorKHR; + +typedef enum VkTessellationDomainOriginKHR { + VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR = 0, + VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR = 1, + VK_TESSELLATION_DOMAIN_ORIGIN_BEGIN_RANGE_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR, + VK_TESSELLATION_DOMAIN_ORIGIN_END_RANGE_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR, + VK_TESSELLATION_DOMAIN_ORIGIN_RANGE_SIZE_KHR = (VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR - VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR + 1), + VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM_KHR = 0x7FFFFFFF +} VkTessellationDomainOriginKHR; + +typedef struct VkPhysicalDevicePointClippingPropertiesKHR { + VkStructureType sType; + void* pNext; + VkPointClippingBehaviorKHR pointClippingBehavior; +} VkPhysicalDevicePointClippingPropertiesKHR; + +typedef struct VkInputAttachmentAspectReferenceKHR { + uint32_t subpass; + uint32_t inputAttachmentIndex; + VkImageAspectFlags aspectMask; +} VkInputAttachmentAspectReferenceKHR; + +typedef struct VkRenderPassInputAttachmentAspectCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t aspectReferenceCount; + const VkInputAttachmentAspectReferenceKHR* pAspectReferences; +} VkRenderPassInputAttachmentAspectCreateInfoKHR; + +typedef struct VkImageViewUsageCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageUsageFlags usage; +} VkImageViewUsageCreateInfoKHR; + +typedef struct VkPipelineTessellationDomainOriginStateCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkTessellationDomainOriginKHR domainOrigin; +} VkPipelineTessellationDomainOriginStateCreateInfoKHR; + + + +#define VK_KHR_get_surface_capabilities2 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" + +typedef struct VkPhysicalDeviceSurfaceInfo2KHR { + VkStructureType sType; + const void* pNext; + VkSurfaceKHR surface; +} VkPhysicalDeviceSurfaceInfo2KHR; + +typedef struct VkSurfaceCapabilities2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceCapabilitiesKHR surfaceCapabilities; +} VkSurfaceCapabilities2KHR; + +typedef struct VkSurfaceFormat2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceFormatKHR surfaceFormat; +} VkSurfaceFormat2KHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + VkSurfaceCapabilities2KHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormat2KHR* pSurfaceFormats); +#endif + +#define VK_KHR_variable_pointers 1 +#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 +#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" + +typedef struct VkPhysicalDeviceVariablePointerFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 variablePointersStorageBuffer; + VkBool32 variablePointers; +} VkPhysicalDeviceVariablePointerFeaturesKHR; + + + +#define VK_KHR_dedicated_allocation 1 +#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 +#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" + +typedef struct VkMemoryDedicatedRequirementsKHR { + VkStructureType sType; + void* pNext; + VkBool32 prefersDedicatedAllocation; + VkBool32 requiresDedicatedAllocation; +} VkMemoryDedicatedRequirementsKHR; + +typedef struct VkMemoryDedicatedAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkMemoryDedicatedAllocateInfoKHR; + + + +#define VK_KHR_storage_buffer_storage_class 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" + + +#define VK_KHR_relaxed_block_layout 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" + + +#define VK_KHR_get_memory_requirements2 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" + +typedef struct VkBufferMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; +} VkBufferMemoryRequirementsInfo2KHR; + +typedef struct VkImageMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageMemoryRequirementsInfo2KHR; + +typedef struct VkImageSparseMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageSparseMemoryRequirementsInfo2KHR; + +typedef struct VkMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkMemoryRequirements memoryRequirements; +} VkMemoryRequirements2KHR; + +typedef struct VkSparseImageMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageMemoryRequirements memoryRequirements; +} VkSparseImageMemoryRequirements2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice device, const VkImageMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice device, const VkBufferMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR( + VkDevice device, + const VkImageMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR( + VkDevice device, + const VkBufferMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( + VkDevice device, + const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); +#endif + +#define VK_KHR_image_format_list 1 +#define VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION 1 +#define VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME "VK_KHR_image_format_list" + +typedef struct VkImageFormatListCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t viewFormatCount; + const VkFormat* pViewFormats; +} VkImageFormatListCreateInfoKHR; + + + +#define VK_KHR_sampler_ycbcr_conversion 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversionKHR) + +#define VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION 1 +#define VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME "VK_KHR_sampler_ycbcr_conversion" + + +typedef enum VkSamplerYcbcrModelConversionKHR { + VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR = 0, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR = 1, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR = 2, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR = 3, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR = 4, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_BEGIN_RANGE_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_END_RANGE_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_RANGE_SIZE_KHR = (VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR - VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR + 1), + VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSamplerYcbcrModelConversionKHR; + +typedef enum VkSamplerYcbcrRangeKHR { + VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR = 0, + VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR = 1, + VK_SAMPLER_YCBCR_RANGE_BEGIN_RANGE_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR, + VK_SAMPLER_YCBCR_RANGE_END_RANGE_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR, + VK_SAMPLER_YCBCR_RANGE_RANGE_SIZE_KHR = (VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR - VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR + 1), + VK_SAMPLER_YCBCR_RANGE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSamplerYcbcrRangeKHR; + +typedef enum VkChromaLocationKHR { + VK_CHROMA_LOCATION_COSITED_EVEN_KHR = 0, + VK_CHROMA_LOCATION_MIDPOINT_KHR = 1, + VK_CHROMA_LOCATION_BEGIN_RANGE_KHR = VK_CHROMA_LOCATION_COSITED_EVEN_KHR, + VK_CHROMA_LOCATION_END_RANGE_KHR = VK_CHROMA_LOCATION_MIDPOINT_KHR, + VK_CHROMA_LOCATION_RANGE_SIZE_KHR = (VK_CHROMA_LOCATION_MIDPOINT_KHR - VK_CHROMA_LOCATION_COSITED_EVEN_KHR + 1), + VK_CHROMA_LOCATION_MAX_ENUM_KHR = 0x7FFFFFFF +} VkChromaLocationKHR; + +typedef struct VkSamplerYcbcrConversionCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkSamplerYcbcrModelConversionKHR ycbcrModel; + VkSamplerYcbcrRangeKHR ycbcrRange; + VkComponentMapping components; + VkChromaLocationKHR xChromaOffset; + VkChromaLocationKHR yChromaOffset; + VkFilter chromaFilter; + VkBool32 forceExplicitReconstruction; +} VkSamplerYcbcrConversionCreateInfoKHR; + +typedef struct VkSamplerYcbcrConversionInfoKHR { + VkStructureType sType; + const void* pNext; + VkSamplerYcbcrConversionKHR conversion; +} VkSamplerYcbcrConversionInfoKHR; + +typedef struct VkBindImagePlaneMemoryInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageAspectFlagBits planeAspect; +} VkBindImagePlaneMemoryInfoKHR; + +typedef struct VkImagePlaneMemoryRequirementsInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageAspectFlagBits planeAspect; +} VkImagePlaneMemoryRequirementsInfoKHR; + +typedef struct VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 samplerYcbcrConversion; +} VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR; + +typedef struct VkSamplerYcbcrConversionImageFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t combinedImageSamplerDescriptorCount; +} VkSamplerYcbcrConversionImageFormatPropertiesKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSamplerYcbcrConversionKHR)(VkDevice device, const VkSamplerYcbcrConversionCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversionKHR* pYcbcrConversion); +typedef void (VKAPI_PTR *PFN_vkDestroySamplerYcbcrConversionKHR)(VkDevice device, VkSamplerYcbcrConversionKHR ycbcrConversion, const VkAllocationCallbacks* pAllocator); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversionKHR( + VkDevice device, + const VkSamplerYcbcrConversionCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSamplerYcbcrConversionKHR* pYcbcrConversion); + +VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversionKHR( + VkDevice device, + VkSamplerYcbcrConversionKHR ycbcrConversion, + const VkAllocationCallbacks* pAllocator); +#endif + +#define VK_KHR_bind_memory2 1 +#define VK_KHR_BIND_MEMORY_2_SPEC_VERSION 1 +#define VK_KHR_BIND_MEMORY_2_EXTENSION_NAME "VK_KHR_bind_memory2" + +typedef struct VkBindBufferMemoryInfoKHR { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; +} VkBindBufferMemoryInfoKHR; + +typedef struct VkBindImageMemoryInfoKHR { + VkStructureType sType; + const void* pNext; + VkImage image; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; +} VkBindImageMemoryInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHR)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfoKHR* pBindInfos); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHR)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfoKHR* pBindInfos); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHR( + VkDevice device, + uint32_t bindInfoCount, + const VkBindBufferMemoryInfoKHR* pBindInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHR( + VkDevice device, + uint32_t bindInfoCount, + const VkBindImageMemoryInfoKHR* pBindInfos); +#endif + #define VK_EXT_debug_report 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) -#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 6 +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 9 #define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" #define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT +#define VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT typedef enum VkDebugReportObjectTypeEXT { @@ -4138,27 +5237,20 @@ typedef enum VkDebugReportObjectTypeEXT { VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, - VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28, + VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31, VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32, + VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = 1000085000, + VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT = 1000156000, VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1), + VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1), VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF } VkDebugReportObjectTypeEXT; -typedef enum VkDebugReportErrorEXT { - VK_DEBUG_REPORT_ERROR_NONE_EXT = 0, - VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1, - VK_DEBUG_REPORT_ERROR_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_ERROR_NONE_EXT, - VK_DEBUG_REPORT_ERROR_END_RANGE_EXT = VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT, - VK_DEBUG_REPORT_ERROR_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT - VK_DEBUG_REPORT_ERROR_NONE_EXT + 1), - VK_DEBUG_REPORT_ERROR_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDebugReportErrorEXT; - typedef enum VkDebugReportFlagBitsEXT { VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, @@ -4180,7 +5272,6 @@ typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( const char* pMessage, void* pUserData); - typedef struct VkDebugReportCallbackCreateInfoEXT { VkStructureType sType; const void* pNext; @@ -4222,6 +5313,11 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( #define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" +#define VK_EXT_depth_range_unrestricted 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" + + #define VK_IMG_filter_cubic 1 #define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 #define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" @@ -4289,31 +5385,31 @@ typedef struct VkDebugMarkerMarkerInfoEXT { } VkDebugMarkerMarkerInfoEXT; -typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, VkDebugMarkerObjectTagInfoEXT* pTagInfo); -typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, VkDebugMarkerObjectNameInfoEXT* pNameInfo); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo); +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT( VkDevice device, - VkDebugMarkerObjectTagInfoEXT* pTagInfo); + const VkDebugMarkerObjectTagInfoEXT* pTagInfo); VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( VkDevice device, - VkDebugMarkerObjectNameInfoEXT* pNameInfo); + const VkDebugMarkerObjectNameInfoEXT* pNameInfo); VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT( VkCommandBuffer commandBuffer, - VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT( VkCommandBuffer commandBuffer); VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( VkCommandBuffer commandBuffer, - VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); #endif #define VK_AMD_gcn_shader 1 @@ -4388,6 +5484,69 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( #define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" +#define VK_AMD_texture_gather_bias_lod 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" + +typedef struct VkTextureLODGatherFormatPropertiesAMD { + VkStructureType sType; + void* pNext; + VkBool32 supportsTextureGatherLODBiasAMD; +} VkTextureLODGatherFormatPropertiesAMD; + + + +#define VK_AMD_shader_info 1 +#define VK_AMD_SHADER_INFO_SPEC_VERSION 1 +#define VK_AMD_SHADER_INFO_EXTENSION_NAME "VK_AMD_shader_info" + + +typedef enum VkShaderInfoTypeAMD { + VK_SHADER_INFO_TYPE_STATISTICS_AMD = 0, + VK_SHADER_INFO_TYPE_BINARY_AMD = 1, + VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD = 2, + VK_SHADER_INFO_TYPE_BEGIN_RANGE_AMD = VK_SHADER_INFO_TYPE_STATISTICS_AMD, + VK_SHADER_INFO_TYPE_END_RANGE_AMD = VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD, + VK_SHADER_INFO_TYPE_RANGE_SIZE_AMD = (VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD - VK_SHADER_INFO_TYPE_STATISTICS_AMD + 1), + VK_SHADER_INFO_TYPE_MAX_ENUM_AMD = 0x7FFFFFFF +} VkShaderInfoTypeAMD; + +typedef struct VkShaderResourceUsageAMD { + uint32_t numUsedVgprs; + uint32_t numUsedSgprs; + uint32_t ldsSizePerLocalWorkGroup; + size_t ldsUsageSizeInBytes; + size_t scratchMemUsageInBytes; +} VkShaderResourceUsageAMD; + +typedef struct VkShaderStatisticsInfoAMD { + VkShaderStageFlags shaderStageMask; + VkShaderResourceUsageAMD resourceUsage; + uint32_t numPhysicalVgprs; + uint32_t numPhysicalSgprs; + uint32_t numAvailableVgprs; + uint32_t numAvailableSgprs; + uint32_t computeWorkGroupSize[3]; +} VkShaderStatisticsInfoAMD; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetShaderInfoAMD)(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBits shaderStage, VkShaderInfoTypeAMD infoType, size_t* pInfoSize, void* pInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderInfoAMD( + VkDevice device, + VkPipeline pipeline, + VkShaderStageFlagBits shaderStage, + VkShaderInfoTypeAMD infoType, + size_t* pInfoSize, + void* pInfo); +#endif + +#define VK_AMD_shader_image_load_store_lod 1 +#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION 1 +#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod" + + #define VK_KHX_multiview 1 #define VK_KHX_MULTIVIEW_SPEC_VERSION 1 #define VK_KHX_MULTIVIEW_EXTENSION_NAME "VK_KHX_multiview" @@ -4539,9 +5698,9 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { #endif /* VK_USE_PLATFORM_WIN32_KHR */ #define VK_KHX_device_group 1 -#define VK_MAX_DEVICE_GROUP_SIZE_KHX 32 -#define VK_KHX_DEVICE_GROUP_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_SPEC_VERSION 2 #define VK_KHX_DEVICE_GROUP_EXTENSION_NAME "VK_KHX_device_group" +#define VK_MAX_DEVICE_GROUP_SIZE_KHX 32 typedef enum VkPeerMemoryFeatureFlagBitsKHX { @@ -4575,28 +5734,6 @@ typedef struct VkMemoryAllocateFlagsInfoKHX { uint32_t deviceMask; } VkMemoryAllocateFlagsInfoKHX; -typedef struct VkBindBufferMemoryInfoKHX { - VkStructureType sType; - const void* pNext; - VkBuffer buffer; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - uint32_t deviceIndexCount; - const uint32_t* pDeviceIndices; -} VkBindBufferMemoryInfoKHX; - -typedef struct VkBindImageMemoryInfoKHX { - VkStructureType sType; - const void* pNext; - VkImage image; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - uint32_t deviceIndexCount; - const uint32_t* pDeviceIndices; - uint32_t SFRRectCount; - const VkRect2D* pSFRRects; -} VkBindImageMemoryInfoKHX; - typedef struct VkDeviceGroupRenderPassBeginInfoKHX { VkStructureType sType; const void* pNext; @@ -4629,6 +5766,22 @@ typedef struct VkDeviceGroupBindSparseInfoKHX { uint32_t memoryDeviceIndex; } VkDeviceGroupBindSparseInfoKHX; +typedef struct VkBindBufferMemoryDeviceGroupInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; +} VkBindBufferMemoryDeviceGroupInfoKHX; + +typedef struct VkBindImageMemoryDeviceGroupInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; + uint32_t SFRRectCount; + const VkRect2D* pSFRRects; +} VkBindImageMemoryDeviceGroupInfoKHX; + typedef struct VkDeviceGroupPresentCapabilitiesKHX { VkStructureType sType; const void* pNext; @@ -4675,14 +5828,12 @@ typedef struct VkDeviceGroupSwapchainCreateInfoKHX { typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHX)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfoKHX* pBindInfos); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfoKHX* pBindInfos); typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHX)(VkCommandBuffer commandBuffer, uint32_t deviceMask); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHX)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHX)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHX)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHX* pModes); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHX)(VkDevice device, const VkAcquireNextImageInfoKHX* pAcquireInfo, uint32_t* pImageIndex); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHX)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHX)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHX)(VkDevice device, const VkAcquireNextImageInfoKHX* pAcquireInfo, uint32_t* pImageIndex); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHX( @@ -4692,34 +5843,10 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHX( uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); -VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHX( - VkDevice device, - uint32_t bindInfoCount, - const VkBindBufferMemoryInfoKHX* pBindInfos); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHX( - VkDevice device, - uint32_t bindInfoCount, - const VkBindImageMemoryInfoKHX* pBindInfos); - VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHX( VkCommandBuffer commandBuffer, uint32_t deviceMask); -VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHX( - VkDevice device, - VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHX( - VkDevice device, - VkSurfaceKHR surface, - VkDeviceGroupPresentModeFlagsKHX* pModes); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHX( - VkDevice device, - const VkAcquireNextImageInfoKHX* pAcquireInfo, - uint32_t* pImageIndex); - VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHX( VkCommandBuffer commandBuffer, uint32_t baseGroupX, @@ -4729,11 +5856,25 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHX( uint32_t groupCountY, uint32_t groupCountZ); +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHX( + VkDevice device, + VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHX( + VkDevice device, + VkSurfaceKHR surface, + VkDeviceGroupPresentModeFlagsKHX* pModes); + VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHX( VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHX( + VkDevice device, + const VkAcquireNextImageInfoKHX* pAcquireInfo, + uint32_t* pImageIndex); #endif #define VK_EXT_validation_flags 1 @@ -4743,9 +5884,10 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHX( typedef enum VkValidationCheckEXT { VK_VALIDATION_CHECK_ALL_EXT = 0, + VK_VALIDATION_CHECK_SHADERS_EXT = 1, VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT, - VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT, - VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_ALL_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1), + VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_SHADERS_EXT, + VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_SHADERS_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1), VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF } VkValidationCheckEXT; @@ -4823,373 +5965,38 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHX( VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); #endif -#define VK_KHX_external_memory_capabilities 1 -#define VK_LUID_SIZE_KHX 8 -#define VK_KHX_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHX_external_memory_capabilities" - - -typedef enum VkExternalMemoryHandleTypeFlagBitsKHX { - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX = 0x00000001, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHX = 0x00000002, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHX = 0x00000004, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHX = 0x00000008, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHX = 0x00000010, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHX = 0x00000020, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHX = 0x00000040, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF -} VkExternalMemoryHandleTypeFlagBitsKHX; -typedef VkFlags VkExternalMemoryHandleTypeFlagsKHX; - -typedef enum VkExternalMemoryFeatureFlagBitsKHX { - VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHX = 0x00000001, - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHX = 0x00000002, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHX = 0x00000004, - VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF -} VkExternalMemoryFeatureFlagBitsKHX; -typedef VkFlags VkExternalMemoryFeatureFlagsKHX; - -typedef struct VkExternalMemoryPropertiesKHX { - VkExternalMemoryFeatureFlagsKHX externalMemoryFeatures; - VkExternalMemoryHandleTypeFlagsKHX exportFromImportedHandleTypes; - VkExternalMemoryHandleTypeFlagsKHX compatibleHandleTypes; -} VkExternalMemoryPropertiesKHX; - -typedef struct VkPhysicalDeviceExternalImageFormatInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBitsKHX handleType; -} VkPhysicalDeviceExternalImageFormatInfoKHX; - -typedef struct VkExternalImageFormatPropertiesKHX { - VkStructureType sType; - void* pNext; - VkExternalMemoryPropertiesKHX externalMemoryProperties; -} VkExternalImageFormatPropertiesKHX; - -typedef struct VkPhysicalDeviceExternalBufferInfoKHX { - VkStructureType sType; - const void* pNext; - VkBufferCreateFlags flags; - VkBufferUsageFlags usage; - VkExternalMemoryHandleTypeFlagBitsKHX handleType; -} VkPhysicalDeviceExternalBufferInfoKHX; - -typedef struct VkExternalBufferPropertiesKHX { - VkStructureType sType; - void* pNext; - VkExternalMemoryPropertiesKHX externalMemoryProperties; -} VkExternalBufferPropertiesKHX; - -typedef struct VkPhysicalDeviceIDPropertiesKHX { - VkStructureType sType; - void* pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE_KHX]; - VkBool32 deviceLUIDValid; -} VkPhysicalDeviceIDPropertiesKHX; - - -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHX)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHX* pExternalBufferInfo, VkExternalBufferPropertiesKHX* pExternalBufferProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHX( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalBufferInfoKHX* pExternalBufferInfo, - VkExternalBufferPropertiesKHX* pExternalBufferProperties); -#endif - -#define VK_KHX_external_memory 1 -#define VK_KHX_EXTERNAL_MEMORY_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHX_external_memory" -#define VK_QUEUE_FAMILY_EXTERNAL_KHX (~0U-1) - -typedef struct VkExternalMemoryImageCreateInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagsKHX handleTypes; -} VkExternalMemoryImageCreateInfoKHX; - -typedef struct VkExternalMemoryBufferCreateInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagsKHX handleTypes; -} VkExternalMemoryBufferCreateInfoKHX; - -typedef struct VkExportMemoryAllocateInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagsKHX handleTypes; -} VkExportMemoryAllocateInfoKHX; - - - -#ifdef VK_USE_PLATFORM_WIN32_KHX -#define VK_KHX_external_memory_win32 1 -#define VK_KHX_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHX_external_memory_win32" - -typedef struct VkImportMemoryWin32HandleInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBitsKHX handleType; - HANDLE handle; -} VkImportMemoryWin32HandleInfoKHX; - -typedef struct VkExportMemoryWin32HandleInfoKHX { - VkStructureType sType; - const void* pNext; - const SECURITY_ATTRIBUTES* pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportMemoryWin32HandleInfoKHX; - -typedef struct VkMemoryWin32HandlePropertiesKHX { - VkStructureType sType; - void* pNext; - uint32_t memoryTypeBits; -} VkMemoryWin32HandlePropertiesKHX; - - -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHX)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagBitsKHX handleType, HANDLE* pHandle); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHX)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHX* pMemoryWin32HandleProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHX( - VkDevice device, - VkDeviceMemory memory, - VkExternalMemoryHandleTypeFlagBitsKHX handleType, - HANDLE* pHandle); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHX( - VkDevice device, - VkExternalMemoryHandleTypeFlagBitsKHX handleType, - HANDLE handle, - VkMemoryWin32HandlePropertiesKHX* pMemoryWin32HandleProperties); -#endif -#endif /* VK_USE_PLATFORM_WIN32_KHX */ - -#define VK_KHX_external_memory_fd 1 -#define VK_KHX_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHX_external_memory_fd" - -typedef struct VkImportMemoryFdInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBitsKHX handleType; - int fd; -} VkImportMemoryFdInfoKHX; - -typedef struct VkMemoryFdPropertiesKHX { - VkStructureType sType; - void* pNext; - uint32_t memoryTypeBits; -} VkMemoryFdPropertiesKHX; - - -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHX)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagBitsKHX handleType, int* pFd); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHX)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHX handleType, int fd, VkMemoryFdPropertiesKHX* pMemoryFdProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHX( - VkDevice device, - VkDeviceMemory memory, - VkExternalMemoryHandleTypeFlagBitsKHX handleType, - int* pFd); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHX( - VkDevice device, - VkExternalMemoryHandleTypeFlagBitsKHX handleType, - int fd, - VkMemoryFdPropertiesKHX* pMemoryFdProperties); -#endif - -#ifdef VK_USE_PLATFORM_WIN32_KHR -#define VK_KHX_win32_keyed_mutex 1 -#define VK_KHX_WIN32_KEYED_MUTEX_SPEC_VERSION 1 -#define VK_KHX_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHX_win32_keyed_mutex" - -typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHX { - VkStructureType sType; - const void* pNext; - uint32_t acquireCount; - const VkDeviceMemory* pAcquireSyncs; - const uint64_t* pAcquireKeys; - const uint32_t* pAcquireTimeouts; - uint32_t releaseCount; - const VkDeviceMemory* pReleaseSyncs; - const uint64_t* pReleaseKeys; -} VkWin32KeyedMutexAcquireReleaseInfoKHX; - - -#endif /* VK_USE_PLATFORM_WIN32_KHR */ - -#define VK_KHX_external_semaphore_capabilities 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHX_external_semaphore_capabilities" - - -typedef enum VkExternalSemaphoreHandleTypeFlagBitsKHX { - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHX = 0x00000001, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHX = 0x00000002, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHX = 0x00000004, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHX = 0x00000008, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FENCE_FD_BIT_KHX = 0x00000010, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF -} VkExternalSemaphoreHandleTypeFlagBitsKHX; -typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHX; - -typedef enum VkExternalSemaphoreFeatureFlagBitsKHX { - VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHX = 0x00000001, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHX = 0x00000002, - VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF -} VkExternalSemaphoreFeatureFlagBitsKHX; -typedef VkFlags VkExternalSemaphoreFeatureFlagsKHX; - -typedef struct VkPhysicalDeviceExternalSemaphoreInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalSemaphoreHandleTypeFlagBitsKHX handleType; -} VkPhysicalDeviceExternalSemaphoreInfoKHX; - -typedef struct VkExternalSemaphorePropertiesKHX { - VkStructureType sType; - void* pNext; - VkExternalSemaphoreHandleTypeFlagsKHX exportFromImportedHandleTypes; - VkExternalSemaphoreHandleTypeFlagsKHX compatibleHandleTypes; - VkExternalSemaphoreFeatureFlagsKHX externalSemaphoreFeatures; -} VkExternalSemaphorePropertiesKHX; - - -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHX)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHX* pExternalSemaphoreInfo, VkExternalSemaphorePropertiesKHX* pExternalSemaphoreProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHX( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalSemaphoreInfoKHX* pExternalSemaphoreInfo, - VkExternalSemaphorePropertiesKHX* pExternalSemaphoreProperties); -#endif - -#define VK_KHX_external_semaphore 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHX_external_semaphore" - -typedef struct VkExportSemaphoreCreateInfoKHX { - VkStructureType sType; - const void* pNext; - VkExternalSemaphoreHandleTypeFlagsKHX handleTypes; -} VkExportSemaphoreCreateInfoKHX; - - - -#ifdef VK_USE_PLATFORM_WIN32_KHX -#define VK_KHX_external_semaphore_win32 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHX_external_semaphore_win32" - -typedef struct VkImportSemaphoreWin32HandleInfoKHX { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - VkExternalSemaphoreHandleTypeFlagsKHX handleType; - HANDLE handle; -} VkImportSemaphoreWin32HandleInfoKHX; - -typedef struct VkExportSemaphoreWin32HandleInfoKHX { - VkStructureType sType; - const void* pNext; - const SECURITY_ATTRIBUTES* pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportSemaphoreWin32HandleInfoKHX; - -typedef struct VkD3D12FenceSubmitInfoKHX { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreValuesCount; - const uint64_t* pWaitSemaphoreValues; - uint32_t signalSemaphoreValuesCount; - const uint64_t* pSignalSemaphoreValues; -} VkD3D12FenceSubmitInfoKHX; - - -typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHX)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHX* pImportSemaphoreWin32HandleInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHX)(VkDevice device, VkSemaphore semaphore, VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, HANDLE* pHandle); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHX( - VkDevice device, - const VkImportSemaphoreWin32HandleInfoKHX* pImportSemaphoreWin32HandleInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHX( - VkDevice device, - VkSemaphore semaphore, - VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, - HANDLE* pHandle); -#endif -#endif /* VK_USE_PLATFORM_WIN32_KHX */ - -#define VK_KHX_external_semaphore_fd 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 -#define VK_KHX_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHX_external_semaphore_fd" - -typedef struct VkImportSemaphoreFdInfoKHX { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - VkExternalSemaphoreHandleTypeFlagBitsKHX handleType; - int fd; -} VkImportSemaphoreFdInfoKHX; - - -typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHX)(VkDevice device, const VkImportSemaphoreFdInfoKHX* pImportSemaphoreFdInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHX)(VkDevice device, VkSemaphore semaphore, VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, int* pFd); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHX( - VkDevice device, - const VkImportSemaphoreFdInfoKHX* pImportSemaphoreFdInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHX( - VkDevice device, - VkSemaphore semaphore, - VkExternalSemaphoreHandleTypeFlagBitsKHX handleType, - int* pFd); -#endif - #define VK_NVX_device_generated_commands 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkObjectTableNVX) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNVX) -#define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 1 +#define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 #define VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NVX_device_generated_commands" typedef enum VkIndirectCommandsTokenTypeNVX { - VK_INDIRECT_COMMANDS_TOKEN_PIPELINE_NVX = 0, - VK_INDIRECT_COMMANDS_TOKEN_DESCRIPTOR_SET_NVX = 1, - VK_INDIRECT_COMMANDS_TOKEN_INDEX_BUFFER_NVX = 2, - VK_INDIRECT_COMMANDS_TOKEN_VERTEX_BUFFER_NVX = 3, - VK_INDIRECT_COMMANDS_TOKEN_PUSH_CONSTANT_NVX = 4, - VK_INDIRECT_COMMANDS_TOKEN_DRAW_INDEXED_NVX = 5, - VK_INDIRECT_COMMANDS_TOKEN_DRAW_NVX = 6, - VK_INDIRECT_COMMANDS_TOKEN_DISPATCH_NVX = 7, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_PIPELINE_NVX, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_DISPATCH_NVX, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = (VK_INDIRECT_COMMANDS_TOKEN_DISPATCH_NVX - VK_INDIRECT_COMMANDS_TOKEN_PIPELINE_NVX + 1), + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = 0, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = 1, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = 2, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = 3, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = 4, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = 5, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = 6, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = 7, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = (VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX + 1), VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF } VkIndirectCommandsTokenTypeNVX; typedef enum VkObjectEntryTypeNVX { - VK_OBJECT_ENTRY_DESCRIPTOR_SET_NVX = 0, - VK_OBJECT_ENTRY_PIPELINE_NVX = 1, - VK_OBJECT_ENTRY_INDEX_BUFFER_NVX = 2, - VK_OBJECT_ENTRY_VERTEX_BUFFER_NVX = 3, - VK_OBJECT_ENTRY_PUSH_CONSTANT_NVX = 4, - VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = VK_OBJECT_ENTRY_DESCRIPTOR_SET_NVX, - VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = VK_OBJECT_ENTRY_PUSH_CONSTANT_NVX, - VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = (VK_OBJECT_ENTRY_PUSH_CONSTANT_NVX - VK_OBJECT_ENTRY_DESCRIPTOR_SET_NVX + 1), + VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = 0, + VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = 1, + VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = 2, + VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = 3, + VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = 4, + VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX, + VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX, + VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = (VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX - VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX + 1), VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF } VkObjectEntryTypeNVX; @@ -5452,6 +6259,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( #define VK_EXT_display_surface_counter 1 #define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 #define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" +#define VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT typedef enum VkSurfaceCounterFlagBitsEXT { @@ -5726,8 +6534,49 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( const VkRect2D* pDiscardRectangles); #endif +#define VK_EXT_conservative_rasterization 1 +#define VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION 1 +#define VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME "VK_EXT_conservative_rasterization" + + +typedef enum VkConservativeRasterizationModeEXT { + VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = 0, + VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = 1, + VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = 2, + VK_CONSERVATIVE_RASTERIZATION_MODE_BEGIN_RANGE_EXT = VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT, + VK_CONSERVATIVE_RASTERIZATION_MODE_END_RANGE_EXT = VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT, + VK_CONSERVATIVE_RASTERIZATION_MODE_RANGE_SIZE_EXT = (VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT - VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT + 1), + VK_CONSERVATIVE_RASTERIZATION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkConservativeRasterizationModeEXT; + +typedef VkFlags VkPipelineRasterizationConservativeStateCreateFlagsEXT; + +typedef struct VkPhysicalDeviceConservativeRasterizationPropertiesEXT { + VkStructureType sType; + void* pNext; + float primitiveOverestimationSize; + float maxExtraPrimitiveOverestimationSize; + float extraPrimitiveOverestimationSizeGranularity; + VkBool32 primitiveUnderestimation; + VkBool32 conservativePointAndLineRasterization; + VkBool32 degenerateTrianglesRasterized; + VkBool32 degenerateLinesRasterized; + VkBool32 fullyCoveredFragmentShaderInputVariable; + VkBool32 conservativeRasterizationPostDepthCoverage; +} VkPhysicalDeviceConservativeRasterizationPropertiesEXT; + +typedef struct VkPipelineRasterizationConservativeStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkPipelineRasterizationConservativeStateCreateFlagsEXT flags; + VkConservativeRasterizationModeEXT conservativeRasterizationMode; + float extraPrimitiveOverestimationSize; +} VkPipelineRasterizationConservativeStateCreateInfoEXT; + + + #define VK_EXT_swapchain_colorspace 1 -#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 2 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3 #define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" @@ -5816,6 +6665,366 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( #endif #endif /* VK_USE_PLATFORM_MACOS_MVK */ +#define VK_EXT_external_memory_dma_buf 1 +#define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION 1 +#define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME "VK_EXT_external_memory_dma_buf" + + +#define VK_EXT_queue_family_foreign 1 +#define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 +#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign" +#define VK_QUEUE_FAMILY_FOREIGN_EXT (~0U-2) + + +#define VK_EXT_sampler_filter_minmax 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" + + +typedef enum VkSamplerReductionModeEXT { + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = 0, + VK_SAMPLER_REDUCTION_MODE_MIN_EXT = 1, + VK_SAMPLER_REDUCTION_MODE_MAX_EXT = 2, + VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, + VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_MAX_EXT, + VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = (VK_SAMPLER_REDUCTION_MODE_MAX_EXT - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT + 1), + VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSamplerReductionModeEXT; + +typedef struct VkSamplerReductionModeCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSamplerReductionModeEXT reductionMode; +} VkSamplerReductionModeCreateInfoEXT; + +typedef struct VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; +} VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; + + + +#define VK_AMD_gpu_shader_int16 1 +#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" + + +#define VK_AMD_mixed_attachment_samples 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" + + +#define VK_AMD_shader_fragment_mask 1 +#define VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION 1 +#define VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME "VK_AMD_shader_fragment_mask" + + +#define VK_EXT_shader_stencil_export 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" + + +#define VK_EXT_sample_locations 1 +#define VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION 1 +#define VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME "VK_EXT_sample_locations" + +typedef struct VkSampleLocationEXT { + float x; + float y; +} VkSampleLocationEXT; + +typedef struct VkSampleLocationsInfoEXT { + VkStructureType sType; + const void* pNext; + VkSampleCountFlagBits sampleLocationsPerPixel; + VkExtent2D sampleLocationGridSize; + uint32_t sampleLocationsCount; + const VkSampleLocationEXT* pSampleLocations; +} VkSampleLocationsInfoEXT; + +typedef struct VkAttachmentSampleLocationsEXT { + uint32_t attachmentIndex; + VkSampleLocationsInfoEXT sampleLocationsInfo; +} VkAttachmentSampleLocationsEXT; + +typedef struct VkSubpassSampleLocationsEXT { + uint32_t subpassIndex; + VkSampleLocationsInfoEXT sampleLocationsInfo; +} VkSubpassSampleLocationsEXT; + +typedef struct VkRenderPassSampleLocationsBeginInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t attachmentInitialSampleLocationsCount; + const VkAttachmentSampleLocationsEXT* pAttachmentInitialSampleLocations; + uint32_t postSubpassSampleLocationsCount; + const VkSubpassSampleLocationsEXT* pPostSubpassSampleLocations; +} VkRenderPassSampleLocationsBeginInfoEXT; + +typedef struct VkPipelineSampleLocationsStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 sampleLocationsEnable; + VkSampleLocationsInfoEXT sampleLocationsInfo; +} VkPipelineSampleLocationsStateCreateInfoEXT; + +typedef struct VkPhysicalDeviceSampleLocationsPropertiesEXT { + VkStructureType sType; + void* pNext; + VkSampleCountFlags sampleLocationSampleCounts; + VkExtent2D maxSampleLocationGridSize; + float sampleLocationCoordinateRange[2]; + uint32_t sampleLocationSubPixelBits; + VkBool32 variableSampleLocations; +} VkPhysicalDeviceSampleLocationsPropertiesEXT; + +typedef struct VkMultisamplePropertiesEXT { + VkStructureType sType; + void* pNext; + VkExtent2D maxSampleLocationGridSize; +} VkMultisamplePropertiesEXT; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetSampleLocationsEXT)(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT* pSampleLocationsInfo); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT)(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT* pMultisampleProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetSampleLocationsEXT( + VkCommandBuffer commandBuffer, + const VkSampleLocationsInfoEXT* pSampleLocationsInfo); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMultisamplePropertiesEXT( + VkPhysicalDevice physicalDevice, + VkSampleCountFlagBits samples, + VkMultisamplePropertiesEXT* pMultisampleProperties); +#endif + +#define VK_EXT_blend_operation_advanced 1 +#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 +#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" + + +typedef enum VkBlendOverlapEXT { + VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, + VK_BLEND_OVERLAP_DISJOINT_EXT = 1, + VK_BLEND_OVERLAP_CONJOINT_EXT = 2, + VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = VK_BLEND_OVERLAP_UNCORRELATED_EXT, + VK_BLEND_OVERLAP_END_RANGE_EXT = VK_BLEND_OVERLAP_CONJOINT_EXT, + VK_BLEND_OVERLAP_RANGE_SIZE_EXT = (VK_BLEND_OVERLAP_CONJOINT_EXT - VK_BLEND_OVERLAP_UNCORRELATED_EXT + 1), + VK_BLEND_OVERLAP_MAX_ENUM_EXT = 0x7FFFFFFF +} VkBlendOverlapEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 advancedBlendCoherentOperations; +} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t advancedBlendMaxColorAttachments; + VkBool32 advancedBlendIndependentBlend; + VkBool32 advancedBlendNonPremultipliedSrcColor; + VkBool32 advancedBlendNonPremultipliedDstColor; + VkBool32 advancedBlendCorrelatedOverlap; + VkBool32 advancedBlendAllOperations; +} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; + +typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 srcPremultiplied; + VkBool32 dstPremultiplied; + VkBlendOverlapEXT blendOverlap; +} VkPipelineColorBlendAdvancedStateCreateInfoEXT; + + + +#define VK_NV_fragment_coverage_to_color 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" + +typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; + +typedef struct VkPipelineCoverageToColorStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageToColorStateCreateFlagsNV flags; + VkBool32 coverageToColorEnable; + uint32_t coverageToColorLocation; +} VkPipelineCoverageToColorStateCreateInfoNV; + + + +#define VK_NV_framebuffer_mixed_samples 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" + + +typedef enum VkCoverageModulationModeNV { + VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, + VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, + VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, + VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, + VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = VK_COVERAGE_MODULATION_MODE_NONE_NV, + VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = VK_COVERAGE_MODULATION_MODE_RGBA_NV, + VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = (VK_COVERAGE_MODULATION_MODE_RGBA_NV - VK_COVERAGE_MODULATION_MODE_NONE_NV + 1), + VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 0x7FFFFFFF +} VkCoverageModulationModeNV; + +typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; + +typedef struct VkPipelineCoverageModulationStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageModulationStateCreateFlagsNV flags; + VkCoverageModulationModeNV coverageModulationMode; + VkBool32 coverageModulationTableEnable; + uint32_t coverageModulationTableCount; + const float* pCoverageModulationTable; +} VkPipelineCoverageModulationStateCreateInfoNV; + + + +#define VK_NV_fill_rectangle 1 +#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 +#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" + + +#define VK_EXT_post_depth_coverage 1 +#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 +#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" + + +#define VK_EXT_validation_cache 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT) + +#define VK_EXT_VALIDATION_CACHE_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_CACHE_EXTENSION_NAME "VK_EXT_validation_cache" +#define VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT + + +typedef enum VkValidationCacheHeaderVersionEXT { + VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = 1, + VK_VALIDATION_CACHE_HEADER_VERSION_BEGIN_RANGE_EXT = VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT, + VK_VALIDATION_CACHE_HEADER_VERSION_END_RANGE_EXT = VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT, + VK_VALIDATION_CACHE_HEADER_VERSION_RANGE_SIZE_EXT = (VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT - VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT + 1), + VK_VALIDATION_CACHE_HEADER_VERSION_MAX_ENUM_EXT = 0x7FFFFFFF +} VkValidationCacheHeaderVersionEXT; + +typedef VkFlags VkValidationCacheCreateFlagsEXT; + +typedef struct VkValidationCacheCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkValidationCacheCreateFlagsEXT flags; + size_t initialDataSize; + const void* pInitialData; +} VkValidationCacheCreateInfoEXT; + +typedef struct VkShaderModuleValidationCacheCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkValidationCacheEXT validationCache; +} VkShaderModuleValidationCacheCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateValidationCacheEXT)(VkDevice device, const VkValidationCacheCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkValidationCacheEXT* pValidationCache); +typedef void (VKAPI_PTR *PFN_vkDestroyValidationCacheEXT)(VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkMergeValidationCachesEXT)(VkDevice device, VkValidationCacheEXT dstCache, uint32_t srcCacheCount, const VkValidationCacheEXT* pSrcCaches); +typedef VkResult (VKAPI_PTR *PFN_vkGetValidationCacheDataEXT)(VkDevice device, VkValidationCacheEXT validationCache, size_t* pDataSize, void* pData); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateValidationCacheEXT( + VkDevice device, + const VkValidationCacheCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkValidationCacheEXT* pValidationCache); + +VKAPI_ATTR void VKAPI_CALL vkDestroyValidationCacheEXT( + VkDevice device, + VkValidationCacheEXT validationCache, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkMergeValidationCachesEXT( + VkDevice device, + VkValidationCacheEXT dstCache, + uint32_t srcCacheCount, + const VkValidationCacheEXT* pSrcCaches); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetValidationCacheDataEXT( + VkDevice device, + VkValidationCacheEXT validationCache, + size_t* pDataSize, + void* pData); +#endif + +#define VK_EXT_shader_viewport_index_layer 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" + + +#define VK_EXT_global_priority 1 +#define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2 +#define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority" + + +typedef enum VkQueueGlobalPriorityEXT { + VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = 128, + VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT = 256, + VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT = 512, + VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT = 1024, + VK_QUEUE_GLOBAL_PRIORITY_BEGIN_RANGE_EXT = VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT, + VK_QUEUE_GLOBAL_PRIORITY_END_RANGE_EXT = VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT, + VK_QUEUE_GLOBAL_PRIORITY_RANGE_SIZE_EXT = (VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT - VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT + 1), + VK_QUEUE_GLOBAL_PRIORITY_MAX_ENUM_EXT = 0x7FFFFFFF +} VkQueueGlobalPriorityEXT; + +typedef struct VkDeviceQueueGlobalPriorityCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkQueueGlobalPriorityEXT globalPriority; +} VkDeviceQueueGlobalPriorityCreateInfoEXT; + + + +#define VK_EXT_external_memory_host 1 +#define VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION 1 +#define VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME "VK_EXT_external_memory_host" + +typedef struct VkImportMemoryHostPointerInfoEXT { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + void* pHostPointer; +} VkImportMemoryHostPointerInfoEXT; + +typedef struct VkMemoryHostPointerPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryHostPointerPropertiesEXT; + +typedef struct VkPhysicalDeviceExternalMemoryHostPropertiesEXT { + VkStructureType sType; + void* pNext; + VkDeviceSize minImportedHostPointerAlignment; +} VkPhysicalDeviceExternalMemoryHostPropertiesEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryHostPointerPropertiesEXT)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + const void* pHostPointer, + VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties); +#endif + #ifdef __cplusplus } #endif diff --git a/3rdparty/bgfx/3rdparty/mtlpp/LICENSE b/3rdparty/bgfx/3rdparty/mtlpp/LICENSE deleted file mode 100644 index 1b840223120..00000000000 --- a/3rdparty/bgfx/3rdparty/mtlpp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Nikolay Aleksiev - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/3rdparty/bgfx/3rdparty/mtlpp/mtlpp.hpp b/3rdparty/bgfx/3rdparty/mtlpp/mtlpp.hpp deleted file mode 100644 index d7f304b6c0b..00000000000 --- a/3rdparty/bgfx/3rdparty/mtlpp/mtlpp.hpp +++ /dev/null @@ -1,2706 +0,0 @@ -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -#pragma once - -////////////////////////////////////// -// FILE: defines.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -#include -#include -#include - -#ifndef __has_feature -# define __has_feature(x) 0 -#endif - -#ifndef MTLPP_CONFIG_RVALUE_REFERENCES -# define MTLPP_CONFIG_RVALUE_REFERENCES __has_feature(cxx_rvalue_references) -#endif - -#ifndef MTLPP_CONFIG_VALIDATE -# define MTLPP_CONFIG_VALIDATE 1 -#endif - -#ifndef MTLPP_CONFIG_USE_AVAILABILITY -# define MTLPP_CONFIG_USE_AVAILABILITY 0 -#endif - -#if MTLPP_CONFIG_USE_AVAILABILITY -# if __has_feature(attribute_availability_with_version_underscores) || (__has_feature(attribute_availability_with_message) && __clang__ && __clang_major__ >= 7) -# include -# define MTLPP_AVAILABLE(mac, ios) CF_AVAILABLE(mac, ios) -# define MTLPP_AVAILABLE_MAC(mac) CF_AVAILABLE_MAC(mac) -# define MTLPP_AVAILABLE_IOS(ios) CF_AVAILABLE_IOS(ios) -# define MTLPP_AVAILABLE_TVOS(tvos) -# define MTLPP_DEPRECATED(macIntro, macDep, iosIntro, iosDep) CF_DEPRECATED(macIntro, macDep, iosIntro, iosDep) -# define MTLPP_DEPRECATED_MAC(macIntro, macDep) CF_DEPRECATED_MAC(macIntro, macDep) -# define MTLPP_DEPRECATED_IOS(iosIntro, iosDep) CF_DEPRECATED_IOS(iosIntro, iosDep) -# endif -#endif - -#ifndef MTLPP_AVAILABLE -# define MTLPP_AVAILABLE(mac, ios) -# define MTLPP_AVAILABLE_MAC(mac) -# define MTLPP_AVAILABLE_IOS(ios) -# define MTLPP_AVAILABLE_TVOS(tvos) -# define MTLPP_DEPRECATED(macIntro, macDep, iosIntro, iosDep) -# define MTLPP_DEPRECATED_MAC(macIntro, macDep) -# define MTLPP_DEPRECATED_IOS(iosIntro, iosDep) -#endif - -#ifndef __DARWIN_ALIAS_STARTING_MAC___MAC_10_11 -# define __DARWIN_ALIAS_STARTING_MAC___MAC_10_11(x) -#endif -#ifndef __DARWIN_ALIAS_STARTING_MAC___MAC_10_12 -# define __DARWIN_ALIAS_STARTING_MAC___MAC_10_12(x) -#endif -#ifndef __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_0 -# define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_8_0(x) -#endif -#ifndef __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_0 -# define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_9_0(x) -#endif -#ifndef __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_0 -# define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_10_0(x) -#endif - -#define MTLPP_IS_AVAILABLE_MAC(mac) (0 __DARWIN_ALIAS_STARTING_MAC___MAC_##mac( || 1 )) -#define MTLPP_IS_AVAILABLE_IOS(ios) (0 __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_##ios( || 1 )) -#define MTLPP_IS_AVAILABLE(mac, ios) (MTLPP_IS_AVAILABLE_MAC(mac) || MTLPP_IS_AVAILABLE_IOS(ios)) - - -////////////////////////////////////// -// FILE: ns.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" - -namespace ns -{ - struct Handle - { - const void* ptr; - }; - - class Object - { - public: - inline const void* GetPtr() const { return m_ptr; } - - inline operator bool() const { return m_ptr != nullptr; } - - protected: - Object(); - Object(const Handle& handle); - Object(const Object& rhs); -#if MTLPP_CONFIG_RVALUE_REFERENCES - Object(Object&& rhs); -#endif - virtual ~Object(); - - Object& operator=(const Object& rhs); -#if MTLPP_CONFIG_RVALUE_REFERENCES - Object& operator=(Object&& rhs); -#endif - - inline void Validate() const - { -#if MTLPP_CONFIG_VALIDATE - assert(m_ptr); -#endif - } - - const void* m_ptr = nullptr; - }; - - struct Range - { - inline Range(uint32_t location, uint32_t length) : - Location(location), - Length(length) - { } - - uint32_t Location; - uint32_t Length; - }; - - class ArrayBase : public Object - { - public: - ArrayBase() { } - ArrayBase(const Handle& handle) : Object(handle) { } - - const uint32_t GetSize() const; - - protected: - void* GetItem(uint32_t index) const; - }; - - template - class Array : public ArrayBase - { - public: - Array() { } - Array(const Handle& handle) : ArrayBase(handle) { } - - const T operator[](uint32_t index) const - { - return Handle{ GetItem(index) }; - } - - T operator[](uint32_t index) - { - return Handle{ GetItem(index) }; - } - }; - - class DictionaryBase : public Object - { - public: - DictionaryBase() { } - DictionaryBase(const Handle& handle) : Object(handle) { } - - protected: - - }; - - template - class Dictionary : public DictionaryBase - { - public: - Dictionary() { } - Dictionary(const Handle& handle) : DictionaryBase(handle) { } - }; - - class String : public Object - { - public: - String() { } - String(const Handle& handle) : Object(handle) { } - String(const char* cstr); - - const char* GetCStr() const; - uint32_t GetLength() const; - }; - - class Error : public Object - { - public: - Error(); - Error(const Handle& handle) : Object(handle) { } - - String GetDomain() const; - uint32_t GetCode() const; - //@property (readonly, copy) NSDictionary *userInfo; - String GetLocalizedDescription() const; - String GetLocalizedFailureReason() const; - String GetLocalizedRecoverySuggestion() const; - String GetLocalizedRecoveryOptions() const; - //@property (nullable, readonly, strong) id recoveryAttempter; - String GetHelpAnchor() const; - }; -} - -////////////////////////////////////// -// FILE: command_encoder.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - class Device; - - class CommandEncoder : public ns::Object - { - public: - CommandEncoder() { } - CommandEncoder(const ns::Handle& handle) : ns::Object(handle) { } - - Device GetDevice() const; - ns::String GetLabel() const; - - void SetLabel(const ns::String& label); - - void EndEncoding(); - void InsertDebugSignpost(const ns::String& string); - void PushDebugGroup(const ns::String& string); - void PopDebugGroup(); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: pixel_format.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" - -namespace mtlpp -{ - enum class PixelFormat - { - Invalid = 0, - - A8Unorm = 1, - - R8Unorm = 10, - R8Unorm_sRGB MTLPP_AVAILABLE_IOS(8_0) = 11, - - R8Snorm = 12, - R8Uint = 13, - R8Sint = 14, - - R16Unorm = 20, - R16Snorm = 22, - R16Uint = 23, - R16Sint = 24, - R16Float = 25, - - RG8Unorm = 30, - RG8Unorm_sRGB MTLPP_AVAILABLE_IOS(8_0) = 31, - RG8Snorm = 32, - RG8Uint = 33, - RG8Sint = 34, - - B5G6R5Unorm MTLPP_AVAILABLE_IOS(8_0) = 40, - A1BGR5Unorm MTLPP_AVAILABLE_IOS(8_0) = 41, - ABGR4Unorm MTLPP_AVAILABLE_IOS(8_0) = 42, - BGR5A1Unorm MTLPP_AVAILABLE_IOS(8_0) = 43, - - R32Uint = 53, - R32Sint = 54, - R32Float = 55, - - RG16Unorm = 60, - RG16Snorm = 62, - RG16Uint = 63, - RG16Sint = 64, - RG16Float = 65, - - RGBA8Unorm = 70, - RGBA8Unorm_sRGB = 71, - RGBA8Snorm = 72, - RGBA8Uint = 73, - RGBA8Sint = 74, - - BGRA8Unorm = 80, - BGRA8Unorm_sRGB = 81, - - RGB10A2Unorm = 90, - RGB10A2Uint = 91, - - RG11B10Float = 92, - RGB9E5Float = 93, - - BGR10_XR MTLPP_AVAILABLE_IOS(10_0) = 554, - BGR10_XR_sRGB MTLPP_AVAILABLE_IOS(10_0) = 555, - - - RG32Uint = 103, - RG32Sint = 104, - RG32Float = 105, - - RGBA16Unorm = 110, - RGBA16Snorm = 112, - RGBA16Uint = 113, - RGBA16Sint = 114, - RGBA16Float = 115, - - BGRA10_XR MTLPP_AVAILABLE_IOS(10_0) = 552, - BGRA10_XR_sRGB MTLPP_AVAILABLE_IOS(10_0) = 553, - - RGBA32Uint = 123, - RGBA32Sint = 124, - RGBA32Float = 125, - - BC1_RGBA MTLPP_AVAILABLE_MAC(10_11) = 130, - BC1_RGBA_sRGB MTLPP_AVAILABLE_MAC(10_11) = 131, - BC2_RGBA MTLPP_AVAILABLE_MAC(10_11) = 132, - BC2_RGBA_sRGB MTLPP_AVAILABLE_MAC(10_11) = 133, - BC3_RGBA MTLPP_AVAILABLE_MAC(10_11) = 134, - BC3_RGBA_sRGB MTLPP_AVAILABLE_MAC(10_11) = 135, - - BC4_RUnorm MTLPP_AVAILABLE_MAC(10_11) = 140, - BC4_RSnorm MTLPP_AVAILABLE_MAC(10_11) = 141, - BC5_RGUnorm MTLPP_AVAILABLE_MAC(10_11) = 142, - BC5_RGSnorm MTLPP_AVAILABLE_MAC(10_11) = 143, - - BC6H_RGBFloat MTLPP_AVAILABLE_MAC(10_11) = 150, - BC6H_RGBUfloat MTLPP_AVAILABLE_MAC(10_11) = 151, - BC7_RGBAUnorm MTLPP_AVAILABLE_MAC(10_11) = 152, - BC7_RGBAUnorm_sRGB MTLPP_AVAILABLE_MAC(10_11) = 153, - - PVRTC_RGB_2BPP MTLPP_AVAILABLE_IOS(8_0) = 160, - PVRTC_RGB_2BPP_sRGB MTLPP_AVAILABLE_IOS(8_0) = 161, - PVRTC_RGB_4BPP MTLPP_AVAILABLE_IOS(8_0) = 162, - PVRTC_RGB_4BPP_sRGB MTLPP_AVAILABLE_IOS(8_0) = 163, - PVRTC_RGBA_2BPP MTLPP_AVAILABLE_IOS(8_0) = 164, - PVRTC_RGBA_2BPP_sRGB MTLPP_AVAILABLE_IOS(8_0) = 165, - PVRTC_RGBA_4BPP MTLPP_AVAILABLE_IOS(8_0) = 166, - PVRTC_RGBA_4BPP_sRGB MTLPP_AVAILABLE_IOS(8_0) = 167, - - EAC_R11Unorm MTLPP_AVAILABLE_IOS(8_0) = 170, - EAC_R11Snorm MTLPP_AVAILABLE_IOS(8_0) = 172, - EAC_RG11Unorm MTLPP_AVAILABLE_IOS(8_0) = 174, - EAC_RG11Snorm MTLPP_AVAILABLE_IOS(8_0) = 176, - EAC_RGBA8 MTLPP_AVAILABLE_IOS(8_0) = 178, - EAC_RGBA8_sRGB MTLPP_AVAILABLE_IOS(8_0) = 179, - - ETC2_RGB8 MTLPP_AVAILABLE_IOS(8_0) = 180, - ETC2_RGB8_sRGB MTLPP_AVAILABLE_IOS(8_0) = 181, - ETC2_RGB8A1 MTLPP_AVAILABLE_IOS(8_0) = 182, - ETC2_RGB8A1_sRGB MTLPP_AVAILABLE_IOS(8_0) = 183, - - ASTC_4x4_sRGB MTLPP_AVAILABLE_IOS(8_0) = 186, - ASTC_5x4_sRGB MTLPP_AVAILABLE_IOS(8_0) = 187, - ASTC_5x5_sRGB MTLPP_AVAILABLE_IOS(8_0) = 188, - ASTC_6x5_sRGB MTLPP_AVAILABLE_IOS(8_0) = 189, - ASTC_6x6_sRGB MTLPP_AVAILABLE_IOS(8_0) = 190, - ASTC_8x5_sRGB MTLPP_AVAILABLE_IOS(8_0) = 192, - ASTC_8x6_sRGB MTLPP_AVAILABLE_IOS(8_0) = 193, - ASTC_8x8_sRGB MTLPP_AVAILABLE_IOS(8_0) = 194, - ASTC_10x5_sRGB MTLPP_AVAILABLE_IOS(8_0) = 195, - ASTC_10x6_sRGB MTLPP_AVAILABLE_IOS(8_0) = 196, - ASTC_10x8_sRGB MTLPP_AVAILABLE_IOS(8_0) = 197, - ASTC_10x10_sRGB MTLPP_AVAILABLE_IOS(8_0) = 198, - ASTC_12x10_sRGB MTLPP_AVAILABLE_IOS(8_0) = 199, - ASTC_12x12_sRGB MTLPP_AVAILABLE_IOS(8_0) = 200, - - ASTC_4x4_LDR MTLPP_AVAILABLE_IOS(8_0) = 204, - ASTC_5x4_LDR MTLPP_AVAILABLE_IOS(8_0) = 205, - ASTC_5x5_LDR MTLPP_AVAILABLE_IOS(8_0) = 206, - ASTC_6x5_LDR MTLPP_AVAILABLE_IOS(8_0) = 207, - ASTC_6x6_LDR MTLPP_AVAILABLE_IOS(8_0) = 208, - ASTC_8x5_LDR MTLPP_AVAILABLE_IOS(8_0) = 210, - ASTC_8x6_LDR MTLPP_AVAILABLE_IOS(8_0) = 211, - ASTC_8x8_LDR MTLPP_AVAILABLE_IOS(8_0) = 212, - ASTC_10x5_LDR MTLPP_AVAILABLE_IOS(8_0) = 213, - ASTC_10x6_LDR MTLPP_AVAILABLE_IOS(8_0) = 214, - ASTC_10x8_LDR MTLPP_AVAILABLE_IOS(8_0) = 215, - ASTC_10x10_LDR MTLPP_AVAILABLE_IOS(8_0) = 216, - ASTC_12x10_LDR MTLPP_AVAILABLE_IOS(8_0) = 217, - ASTC_12x12_LDR MTLPP_AVAILABLE_IOS(8_0) = 218, - - GBGR422 = 240, - - BGRG422 = 241, - - Depth16Unorm MTLPP_AVAILABLE_MAC(10_12) = 250, - Depth32Float = 252, - - Stencil8 = 253, - - Depth24Unorm_Stencil8 MTLPP_AVAILABLE_MAC(10_11) = 255, - Depth32Float_Stencil8 MTLPP_AVAILABLE(10_11, 9_0) = 260, - - X32_Stencil8 MTLPP_AVAILABLE(10_12, 10_0) = 261, - X24_Stencil8 MTLPP_AVAILABLE_MAC(10_12) = 262, - } - MTLPP_AVAILABLE(10_11, 8_0); -} - - -////////////////////////////////////// -// FILE: resource.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - class Heap; - - static const uint32_t ResourceCpuCacheModeShift = 0; - static const uint32_t ResourceStorageModeShift = 4; - static const uint32_t ResourceHazardTrackingModeShift = 8; - - enum class PurgeableState - { - KeepCurrent = 1, - NonVolatile = 2, - Volatile = 3, - Empty = 4, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class CpuCacheMode - { - DefaultCache = 0, - WriteCombined = 1, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class StorageMode - { - Shared = 0, - Managed MTLPP_AVAILABLE(10_11, NA) = 1, - Private = 2, - Memoryless MTLPP_AVAILABLE(NA, 10_0) = 3, - } - MTLPP_AVAILABLE(10_11, 9_0); - - enum class ResourceOptions - { - CpuCacheModeDefaultCache = uint32_t(CpuCacheMode::DefaultCache) << ResourceCpuCacheModeShift, - CpuCacheModeWriteCombined = uint32_t(CpuCacheMode::WriteCombined) << ResourceCpuCacheModeShift, - - StorageModeShared MTLPP_AVAILABLE(10_11, 9_0) = uint32_t(StorageMode::Shared) << ResourceStorageModeShift, - StorageModeManaged MTLPP_AVAILABLE(10_11, NA) = uint32_t(StorageMode::Managed) << ResourceStorageModeShift, - StorageModePrivate MTLPP_AVAILABLE(10_11, 9_0) = uint32_t(StorageMode::Private) << ResourceStorageModeShift, - StorageModeMemoryless MTLPP_AVAILABLE(NA, 10_0) = uint32_t(StorageMode::Memoryless) << ResourceStorageModeShift, - - HazardTrackingModeUntracked MTLPP_AVAILABLE(NA, 10_0) = 0x1 << ResourceHazardTrackingModeShift, - - OptionCPUCacheModeDefault = CpuCacheModeDefaultCache, - OptionCPUCacheModeWriteCombined = CpuCacheModeWriteCombined, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class Resource : public ns::Object - { - public: - Resource() { } - Resource(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - CpuCacheMode GetCpuCacheMode() const; - StorageMode GetStorageMode() const MTLPP_AVAILABLE(10_11, 9_0); - Heap GetHeap() const MTLPP_AVAILABLE(NA, 10_0); - bool IsAliasable() const MTLPP_AVAILABLE(NA, 10_0); - - void SetLabel(const ns::String& label); - - PurgeableState SetPurgeableState(PurgeableState state); - void MakeAliasable() const MTLPP_AVAILABLE(NA, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: buffer.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "pixel_format.hpp" -// #include "resource.hpp" - -namespace mtlpp -{ - class Texture; - class TextureDescriptor; - - class Buffer : public Resource - { - public: - Buffer() { } - Buffer(const ns::Handle& handle) : Resource(handle) { } - - uint32_t GetLength() const; - void* GetContents(); - void DidModify(const ns::Range& range) MTLPP_AVAILABLE_MAC(10_11); - Texture NewTexture(const TextureDescriptor& descriptor, uint32_t offset, uint32_t bytesPerRow) MTLPP_AVAILABLE_IOS(8_0); - void AddDebugMarker(const ns::String& marker, const ns::Range& range) MTLPP_AVAILABLE(10_12, 10_0); - void RemoveAllDebugMarkers() MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: types.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" - -namespace mtlpp -{ - struct Origin - { - inline Origin(uint32_t x, uint32_t y, uint32_t z) : - X(x), - Y(y), - Z(z) - { } - - uint32_t X; - uint32_t Y; - uint32_t Z; - }; - - struct Size - { - inline Size(uint32_t width, uint32_t height, uint32_t depth) : - Width(width), - Height(height), - Depth(depth) - { } - - uint32_t Width; - uint32_t Height; - uint32_t Depth; - }; - - struct Region - { - inline Region(uint32_t x, uint32_t width) : - Origin(x, 0, 0), - Size(width, 1, 1) - { } - - inline Region(uint32_t x, uint32_t y, uint32_t width, uint32_t height) : - Origin(x, y, 0), - Size(width, height, 1) - { } - - inline Region(uint32_t x, uint32_t y, uint32_t z, uint32_t width, uint32_t height, uint32_t depth) : - Origin(x, y, z), - Size(width, height, depth) - { } - - Origin Origin; - Size Size; - }; -} - -////////////////////////////////////// -// FILE: texture.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "resource.hpp" -// #include "buffer.hpp" -// #include "types.hpp" - -namespace mtlpp -{ - enum class TextureType - { - Texture1D = 0, - Texture1DArray = 1, - Texture2D = 2, - Texture2DArray = 3, - Texture2DMultisample = 4, - TextureCube = 5, - TextureCubeArray MTLPP_AVAILABLE_MAC(10_11) = 6, - Texture3D = 7, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class TextureUsage - { - Unknown = 0x0000, - ShaderRead = 0x0001, - ShaderWrite = 0x0002, - RenderTarget = 0x0004, - PixelFormatView = 0x0010, - } - MTLPP_AVAILABLE(10_11, 9_0); - - - class TextureDescriptor : public ns::Object - { - public: - TextureDescriptor(); - TextureDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - static TextureDescriptor Texture2DDescriptor(PixelFormat pixelFormat, uint32_t width, uint32_t height, bool mipmapped); - static TextureDescriptor TextureCubeDescriptor(PixelFormat pixelFormat, uint32_t size, bool mipmapped); - - TextureType GetTextureType() const; - PixelFormat GetPixelFormat() const; - uint32_t GetWidth() const; - uint32_t GetHeight() const; - uint32_t GetDepth() const; - uint32_t GetMipmapLevelCount() const; - uint32_t GetSampleCount() const; - uint32_t GetArrayLength() const; - ResourceOptions GetResourceOptions() const; - CpuCacheMode GetCpuCacheMode() const MTLPP_AVAILABLE(10_11, 9_0); - StorageMode GetStorageMode() const MTLPP_AVAILABLE(10_11, 9_0); - TextureUsage GetUsage() const MTLPP_AVAILABLE(10_11, 9_0); - - void SetTextureType(TextureType textureType); - void SetPixelFormat(PixelFormat pixelFormat); - void SetWidth(uint32_t width); - void SetHeight(uint32_t height); - void SetDepth(uint32_t depth); - void SetMipmapLevelCount(uint32_t mipmapLevelCount); - void SetSampleCount(uint32_t sampleCount); - void SetArrayLength(uint32_t arrayLength); - void SetResourceOptions(ResourceOptions resourceOptions); - void SetCpuCacheMode(CpuCacheMode cpuCacheMode) MTLPP_AVAILABLE(10_11, 9_0); - void SetStorageMode(StorageMode storageMode) MTLPP_AVAILABLE(10_11, 9_0); - void SetUsage(TextureUsage usage) MTLPP_AVAILABLE(10_11, 9_0); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class Texture : public Resource - { - public: - Texture() { } - Texture(const ns::Handle& handle) : Resource(handle) { } - - Resource GetRootResource() const MTLPP_DEPRECATED(10_11, 10_12, 8_0, 10_0); - Texture GetParentTexture() const MTLPP_AVAILABLE(10_11, 9_0); - uint32_t GetParentRelativeLevel() const MTLPP_AVAILABLE(10_11, 9_0); - uint32_t GetParentRelativeSlice() const MTLPP_AVAILABLE(10_11, 9_0); - Buffer GetBuffer() const MTLPP_AVAILABLE(10_12, 9_0); - uint32_t GetBufferOffset() const MTLPP_AVAILABLE(10_12, 9_0); - uint32_t GetBufferBytesPerRow() const MTLPP_AVAILABLE(10_12, 9_0); - //IOSurfaceRef GetIOSurface() const; - uint32_t GetIOSurfacePlane() const MTLPP_AVAILABLE_MAC(10_11); - TextureType GetTextureType() const; - PixelFormat GetPixelFormat() const; - uint32_t GetWidth() const; - uint32_t GetHeight() const; - uint32_t GetDepth() const; - uint32_t GetMipmapLevelCount() const; - uint32_t GetSampleCount() const; - uint32_t GetArrayLength() const; - TextureUsage GetUsage() const; - bool IsFrameBufferOnly() const; - - void GetBytes(void* pixelBytes, uint32_t bytesPerRow, uint32_t bytesPerImage, const Region& fromRegion, uint32_t mipmapLevel, uint32_t slice); - void Replace(const Region& region, uint32_t mipmapLevel, uint32_t slice, void* pixelBytes, uint32_t bytesPerRow, uint32_t bytesPerImage); - void GetBytes(void* pixelBytes, uint32_t bytesPerRow, const Region& fromRegion, uint32_t mipmapLevel); - void Replace(const Region& region, uint32_t mipmapLevel, void* pixelBytes, uint32_t bytesPerRow); - Texture NewTextureView(PixelFormat pixelFormat); - Texture NewTextureView(PixelFormat pixelFormat, TextureType textureType, const ns::Range& mipmapLevelRange, const ns::Range& sliceRange); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: argument.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "texture.hpp" - -namespace mtlpp -{ - class StructType; - class ArrayType; - - enum class DataType - { - None = 0, - - Struct = 1, - Array = 2, - - Float = 3, - Float2 = 4, - Float3 = 5, - Float4 = 6, - - Float2x2 = 7, - Float2x3 = 8, - Float2x4 = 9, - - Float3x2 = 10, - Float3x3 = 11, - Float3x4 = 12, - - Float4x2 = 13, - Float4x3 = 14, - Float4x4 = 15, - - Half = 16, - Half2 = 17, - Half3 = 18, - Half4 = 19, - - Half2x2 = 20, - Half2x3 = 21, - Half2x4 = 22, - - Half3x2 = 23, - Half3x3 = 24, - Half3x4 = 25, - - Half4x2 = 26, - Half4x3 = 27, - Half4x4 = 28, - - Int = 29, - Int2 = 30, - Int3 = 31, - Int4 = 32, - - UInt = 33, - UInt2 = 34, - UInt3 = 35, - UInt4 = 36, - - Short = 37, - Short2 = 38, - Short3 = 39, - Short4 = 40, - - UShort = 41, - UShort2 = 42, - UShort3 = 43, - UShort4 = 44, - - Char = 45, - Char2 = 46, - Char3 = 47, - Char4 = 48, - - UChar = 49, - UChar2 = 50, - UChar3 = 51, - UChar4 = 52, - - Bool = 53, - Bool2 = 54, - Bool3 = 55, - Bool4 = 56, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class ArgumentType - { - Buffer = 0, - ThreadgroupMemory = 1, - Texture = 2, - Sampler = 3, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class ArgumentAccess - { - ReadOnly = 0, - ReadWrite = 1, - WriteOnly = 2, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class StructMember : public ns::Object - { - public: - StructMember(); - StructMember(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetName() const; - uint32_t GetOffset() const; - DataType GetDataType() const; - - StructType GetStructType() const; - ArrayType GetArrayType() const; - } - MTLPP_AVAILABLE(10_11, 8_0); - - class StructType : public ns::Object - { - public: - StructType(); - StructType(const ns::Handle& handle) : ns::Object(handle) { } - - const ns::Array GetMembers() const; - StructMember GetMember(const ns::String& name) const; - } - MTLPP_AVAILABLE(10_11, 8_0); - - class ArrayType : public ns::Object - { - public: - ArrayType(); - ArrayType(const ns::Handle& handle) : ns::Object(handle) { } - - uint32_t GetArrayLength() const; - DataType GetElementType() const; - uint32_t GetStride() const; - StructType GetElementStructType() const; - ArrayType GetElementArrayType() const; - } - MTLPP_AVAILABLE(10_11, 8_0); - - class Argument : public ns::Object - { - public: - Argument(); - Argument(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetName() const; - ArgumentType GetType() const; - ArgumentAccess GetAccess() const; - uint32_t GetIndex() const; - - bool IsActive() const; - - uint32_t GetBufferAlignment() const; - uint32_t GetBufferDataSize() const; - DataType GetBufferDataType() const; - StructType GetBufferStructType() const; - - uint32_t GetThreadgroupMemoryAlignment() const; - uint32_t GetThreadgroupMemoryDataSize() const; - - TextureType GetTextureType() const; - DataType GetTextureDataType() const; - - bool IsDepthTexture() const MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - - -////////////////////////////////////// -// FILE: library.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "argument.hpp" - -namespace mtlpp -{ - class Device; - class FunctionConstantValues; - - enum class PatchType - { - None = 0, - Triangle = 1, - Quad = 2, - } - MTLPP_AVAILABLE(10_12, 10_0); - - class VertexAttribute : public ns::Object - { - public: - VertexAttribute(); - VertexAttribute(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetName() const; - uint32_t GetAttributeIndex() const; - DataType GetAttributeType() const MTLPP_AVAILABLE(10_11, 8_3); - bool IsActive() const; - bool IsPatchData() const MTLPP_AVAILABLE(10_12, 10_0); - bool IsPatchControlPointData() const MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class Attribute : public ns::Object - { - public: - Attribute(); - Attribute(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetName() const; - uint32_t GetAttributeIndex() const; - DataType GetAttributeType() const MTLPP_AVAILABLE(10_11, 8_3); - bool IsActive() const; - bool IsPatchData() const MTLPP_AVAILABLE(10_12, 10_0); - bool IsPatchControlPointData() const MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_12, 10_0); - - enum class FunctionType - { - TypeVertex = 1, - TypeFragment = 2, - TypeKernel = 3, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class FunctionConstant : public ns::Object - { - public: - FunctionConstant(); - FunctionConstant(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetName() const; - DataType GetType() const; - uint32_t GetIndex() const; - bool IsRequired() const; - } - MTLPP_AVAILABLE(10_12, 10_0); - - class Function : public ns::Object - { - public: - Function(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const MTLPP_AVAILABLE(10_12, 10_0); - Device GetDevice() const; - FunctionType GetFunctionType() const; - PatchType GetPatchType() const MTLPP_AVAILABLE(10_12, 10_0); - int32_t GetPatchControlPointCount() const MTLPP_AVAILABLE(10_12, 10_0); - const ns::Array GetVertexAttributes() const; - const ns::Array GetStageInputAttributes() const MTLPP_AVAILABLE(10_12, 10_0); - ns::String GetName() const; - ns::Dictionary GetFunctionConstants() const MTLPP_AVAILABLE(10_12, 10_0); - - void SetLabel(const ns::String& label) MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class LanguageVersion - { - Version1_0 MTLPP_AVAILABLE(NA, 9_0) = (1 << 16), - Version1_1 MTLPP_AVAILABLE(10_11, 9_0) = (1 << 16) + 1, - Version1_2 MTLPP_AVAILABLE(10_12, 10_0) = (1 << 16) + 2, - } - MTLPP_AVAILABLE(10_11, 9_0); - - class CompileOptions : public ns::Object - { - public: - CompileOptions(); - CompileOptions(const ns::Handle& handle) : ns::Object(handle) { } - - ns::Dictionary GetPreprocessorMacros() const; - bool IsFastMathEnabled() const; - LanguageVersion GetLanguageVersion() const MTLPP_AVAILABLE(10_11, 9_0); - - void SetFastMathEnabled(bool fastMathEnabled); - void SetFastMathEnabled(LanguageVersion languageVersion); - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class LibraryError - { - Unsupported = 1, - Internal = 2, - CompileFailure = 3, - CompileWarning = 4, - FunctionNotFound MTLPP_AVAILABLE(10_12, 10_0) = 5, - FileNotFound MTLPP_AVAILABLE(10_12, 10_0) = 6, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class RenderPipelineError - { - Internal = 1, - Unsupported = 2, - InvalidInput = 3, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class Library : public ns::Object - { - public: - Library() { } - Library(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Device GetDevice() const; - ns::Array GetFunctionNames() const; - - void SetLabel(const ns::String& label); - - Function NewFunction(const ns::String& functionName); - Function NewFunction(const ns::String& functionName, const FunctionConstantValues& constantValues, ns::Error* error) MTLPP_AVAILABLE(10_12, 10_0); - void NewFunction(const ns::String& functionName, const FunctionConstantValues& constantValues, std::function completionHandler) MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: device.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "types.hpp" -// #include "pixel_format.hpp" -// #include "resource.hpp" -// #include "library.hpp" - -namespace mtlpp -{ - class CommandQueue; - class Device; - class Buffer; - class DepthStencilState; - class Function; - class Library; - class Texture; - class SamplerState; - class RenderPipelineState; - class ComputePipelineState; - class Heap; - class Fence; - - class SamplerDescriptor; - class RenderPipelineColorAttachmentDescriptor; - class DepthStencilDescriptor; - class TextureDescriptor; - class CompileOptions; - class RenderPipelineDescriptor; - class RenderPassDescriptor; - class RenderPipelineReflection; - class ComputePipelineDescriptor; - class ComputePipelineReflection; - class CommandQueueDescriptor; - class HeapDescriptor; - - enum class FeatureSet - { - iOS_GPUFamily1_v1 MTLPP_AVAILABLE_IOS(8_0) = 0, - iOS_GPUFamily2_v1 MTLPP_AVAILABLE_IOS(8_0) = 1, - - iOS_GPUFamily1_v2 MTLPP_AVAILABLE_IOS(8_0) = 2, - iOS_GPUFamily2_v2 MTLPP_AVAILABLE_IOS(8_0) = 3, - iOS_GPUFamily3_v1 MTLPP_AVAILABLE_IOS(9_0) = 4, - - iOS_GPUFamily1_v3 MTLPP_AVAILABLE_IOS(10_0) = 5, - iOS_GPUFamily2_v3 MTLPP_AVAILABLE_IOS(10_0) = 6, - iOS_GPUFamily3_v2 MTLPP_AVAILABLE_IOS(10_0) = 7, - - OSX_GPUFamily1_v1 MTLPP_AVAILABLE_MAC(8_0) = 10000, - - OSX_GPUFamily1_v2 MTLPP_AVAILABLE_MAC(10_12) = 10001, - OSX_ReadWriteTextureTier2 MTLPP_AVAILABLE_MAC(10_12) = 10002, - - tvOS_GPUFamily1_v1 MTLPP_AVAILABLE_TVOS(9_0) = 30000, - - tvOS_GPUFamily1_v2 MTLPP_AVAILABLE_TVOS(10_0) = 30001, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class PipelineOption - { - None = 0, - ArgumentInfo = 1 << 0, - BufferTypeInfo = 1 << 1, - } - MTLPP_AVAILABLE(10_11, 8_0); - - struct SizeAndAlign - { - uint32_t Size; - uint32_t Align; - }; - - class Device : public ns::Object - { - public: - Device() { } - Device(const ns::Handle& handle) : ns::Object(handle) { } - - static Device CreateSystemDefaultDevice() MTLPP_AVAILABLE(10_11, 8_0); - static ns::Array CopyAllDevices() MTLPP_AVAILABLE(10_11, NA); - - ns::String GetName() const; - Size GetMaxThreadsPerThreadgroup() const MTLPP_AVAILABLE(10_11, 9_0); - bool IsLowPower() const MTLPP_AVAILABLE_MAC(10_11); - bool IsHeadless() const MTLPP_AVAILABLE_MAC(10_11); - uint64_t GetRecommendedMaxWorkingSetSize() const MTLPP_AVAILABLE_MAC(10_12); - bool IsDepth24Stencil8PixelFormatSupported() const MTLPP_AVAILABLE_MAC(10_11); - - CommandQueue NewCommandQueue(); - CommandQueue NewCommandQueue(uint32_t maxCommandBufferCount); - SizeAndAlign HeapTextureSizeAndAlign(const TextureDescriptor& desc) MTLPP_AVAILABLE(NA, 10_0); - SizeAndAlign HeapBufferSizeAndAlign(uint32_t length, ResourceOptions options) MTLPP_AVAILABLE(NA, 10_0); - Heap NewHeap(const HeapDescriptor& descriptor) MTLPP_AVAILABLE(NA, 10_0); - Buffer NewBuffer(uint32_t length, ResourceOptions options); - Buffer NewBuffer(const void* pointer, uint32_t length, ResourceOptions options); - Buffer NewBuffer(void* pointer, uint32_t length, ResourceOptions options, std::function deallocator); - DepthStencilState NewDepthStencilState(const DepthStencilDescriptor& descriptor); - Texture NewTexture(const TextureDescriptor& descriptor); - //- (id )newTextureWithDescriptor:(MTLTextureDescriptor *)descriptor iosurface:(IOSurfaceRef)iosurface plane:(NSUInteger)plane NS_AVAILABLE_MAC(10_11); - SamplerState NewSamplerState(const SamplerDescriptor& descriptor); - Library NewDefaultLibrary(); - //- (nullable id )newDefaultLibraryWithBundle:(NSBundle *)bundle error:(__autoreleasing NSError **)error NS_AVAILABLE(10_12, 10_0); - Library NewLibrary(const ns::String& filepath, ns::Error* error); - Library NewLibrary(const char* source, const CompileOptions& options, ns::Error* error); - void NewLibrary(const char* source, const CompileOptions& options, std::function completionHandler); - RenderPipelineState NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, ns::Error* error); - RenderPipelineState NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, PipelineOption options, RenderPipelineReflection* outReflection, ns::Error* error); - void NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, std::function completionHandler); - void NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, PipelineOption options, std::function completionHandler); - ComputePipelineState NewComputePipelineState(const Function& computeFunction, ns::Error* error); - ComputePipelineState NewComputePipelineState(const Function& computeFunction, PipelineOption options, ComputePipelineReflection& outReflection, ns::Error* error); - void NewComputePipelineState(const Function& computeFunction, std::function completionHandler); - void NewComputePipelineState(const Function& computeFunction, PipelineOption options, std::function completionHandler); - ComputePipelineState NewComputePipelineState(const ComputePipelineDescriptor& descriptor, PipelineOption options, ComputePipelineReflection* outReflection, ns::Error* error); - void NewComputePipelineState(const ComputePipelineDescriptor& descriptor, PipelineOption options, std::function completionHandler) MTLPP_AVAILABLE(10_11, 9_0); - Fence NewFence() MTLPP_AVAILABLE(NA, 10_0); - bool SupportsFeatureSet(FeatureSet featureSet) const; - bool SupportsTextureSampleCount(uint32_t sampleCount) const MTLPP_AVAILABLE(10_11, 9_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: fence.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "device.hpp" - - -namespace mtlpp -{ - class Fence : public ns::Object - { - public: - Fence(const ns::Handle& handle) : ns::Object(handle) { } - - Texture GetDevice() const; - ns::String GetLabel() const; - - void SetLabel(const ns::String& label); - } - MTLPP_AVAILABLE(NA, 10_0); -} - -////////////////////////////////////// -// FILE: blit_command_encoder.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "command_encoder.hpp" -// #include "buffer.hpp" -// #include "texture.hpp" -// #include "fence.hpp" - -namespace mtlpp -{ - enum class BlitOption - { - None = 0, - DepthFromDepthStencil = 1 << 0, - StencilFromDepthStencil = 1 << 1, - RowLinearPVRTC MTLPP_AVAILABLE_IOS(9_0) = 1 << 2, - } - MTLPP_AVAILABLE(10_11, 9_0); - - class BlitCommandEncoder : public ns::Object - { - public: - BlitCommandEncoder() { } - BlitCommandEncoder(const ns::Handle& handle) : ns::Object(handle) { } - - void Synchronize(const Resource& resource) MTLPP_AVAILABLE_MAC(10_11); - void Synchronize(const Texture& texture, uint32_t slice, uint32_t level) MTLPP_AVAILABLE_MAC(10_11); - void Copy(const Texture& sourceTexture, uint32_t sourceSlice, uint32_t sourceLevel, const Origin& sourceOrigin, const Size& sourceSize, const Texture& destinationTexture, uint32_t destinationSlice, uint32_t destinationLevel, const Origin& destinationOrigin); - void Copy(const Buffer& sourceBuffer, uint32_t sourceOffset, uint32_t sourceBytesPerRow, uint32_t sourceBytesPerImage, const Size& sourceSize, const Texture& destinationTexture, uint32_t destinationSlice, uint32_t destinationLevel, const Origin& destinationOrigin); - void Copy(const Buffer& sourceBuffer, uint32_t sourceOffset, uint32_t sourceBytesPerRow, uint32_t sourceBytesPerImage, const Size& sourceSize, const Texture& destinationTexture, uint32_t destinationSlice, uint32_t destinationLevel, const Origin& destinationOrigin, BlitOption options); - void Copy(const Texture& sourceTexture, uint32_t sourceSlice, uint32_t sourceLevel, const Origin& sourceOrigin, const Size& sourceSize, const Buffer& destinationBuffer, uint32_t destinationOffset, uint32_t destinationBytesPerRow, uint32_t destinationBytesPerImage); - void Copy(const Texture& sourceTexture, uint32_t sourceSlice, uint32_t sourceLevel, const Origin& sourceOrigin, const Size& sourceSize, const Buffer& destinationBuffer, uint32_t destinationOffset, uint32_t destinationBytesPerRow, uint32_t destinationBytesPerImage, BlitOption options); - void Copy(const Buffer& sourceBuffer, uint32_t soruceOffset, const Buffer& destinationBuffer, uint32_t destinationOffset, uint32_t size); - void GenerateMipmaps(const Texture& texture); - void Fill(const Buffer& buffer, const ns::Range& range, uint8_t value); - void UpdateFence(const Fence& fence) MTLPP_AVAILABLE_IOS(10_0); - void WaitForFence(const Fence& fence) MTLPP_AVAILABLE_IOS(10_0); - }; -} - -////////////////////////////////////// -// FILE: command_buffer.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - class Device; - class CommandQueue; - class BlitCommandEncoder; - class RenderCommandEncoder; - class ParallelRenderCommandEncoder; - class ComputeCommandEncoder; - class CommandQueue; - class Drawable; - class RenderPassDescriptor; - - enum class CommandBufferStatus - { - NotEnqueued = 0, - Enqueued = 1, - Committed = 2, - Scheduled = 3, - Completed = 4, - Error = 5, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class CommandBufferError - { - None = 0, - Internal = 1, - Timeout = 2, - PageFault = 3, - Blacklisted = 4, - NotPermitted = 7, - OutOfMemory = 8, - InvalidResource = 9, - Memoryless MTLPP_AVAILABLE_IOS(10_0) = 10, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class CommandBuffer : public ns::Object - { - public: - CommandBuffer() { } - CommandBuffer(const ns::Handle& handle) : ns::Object(handle) { } - - Device GetDevice() const; - CommandQueue GetCommandQueue() const; - bool GetRetainedReferences() const; - ns::String GetLabel() const; - CommandBufferStatus GetStatus() const; - ns::Error GetError() const; - - void SetLabel(const ns::String& label); - - void Enqueue(); - void Commit(); - void AddScheduledHandler(std::function handler); - void AddCompletedHandler(std::function handler); - void Present(const Drawable& drawable); - void Present(const Drawable& drawable, double presentationTime); - void WaitUntilScheduled(); - void WaitUntilCompleted(); - BlitCommandEncoder BlitCommandEncoder(); - RenderCommandEncoder RenderCommandEncoder(const RenderPassDescriptor& renderPassDescriptor); - ComputeCommandEncoder ComputeCommandEncoder(); - ParallelRenderCommandEncoder ParallelRenderCommandEncoder(const RenderPassDescriptor& renderPassDescriptor); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: compute_command_encoder.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "command_encoder.hpp" -// #include "texture.hpp" -// #include "command_buffer.hpp" -// #include "fence.hpp" - -namespace mtlpp -{ - class ComputeCommandEncoder : public CommandEncoder - { - public: - ComputeCommandEncoder() { } - ComputeCommandEncoder(const ns::Handle& handle) : CommandEncoder(handle) { } - - void SetComputePipelineState(const ComputePipelineState& state); - void SetBytes(const void* data, uint32_t length, uint32_t index); - void SetBuffer(const Buffer& buffer, uint32_t offset, uint32_t index); - void SetBufferOffset(uint32_t offset, uint32_t index) MTLPP_AVAILABLE(10_11, 8_3); - void SetBuffers(const Buffer* buffers, const uint32_t* offsets, const ns::Range& range); - void SetTexture(const Texture& texture, uint32_t index); - void SetTextures(const Texture* textures, const ns::Range& range); - void SetSamplerState(const SamplerState& sampler, uint32_t index); - void SetSamplerStates(const SamplerState* samplers, const ns::Range& range); - void SetSamplerState(const SamplerState& sampler, float lodMinClamp, float lodMaxClamp, uint32_t index); - void SetSamplerStates(const SamplerState* samplers, const float* lodMinClamps, const float* lodMaxClamps, const ns::Range& range); - void SetThreadgroupMemory(uint32_t length, uint32_t index); - void SetStageInRegion(const Region& region) MTLPP_AVAILABLE(10_12, 10_0); - void DispatchThreadgroups(const Size& threadgroupsPerGrid, const Size& threadsPerThreadgroup); - void DispatchThreadgroupsWithIndirectBuffer(const Buffer& indirectBuffer, uint32_t indirectBufferOffset, const Size& threadsPerThreadgroup); - void UpdateFence(const Fence& fence) MTLPP_AVAILABLE_IOS(10_0); - void WaitForFence(const Fence& fence) MTLPP_AVAILABLE_IOS(10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: command_queue.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - class Device; - class CommandBuffer; - - class CommandQueue : public ns::Object - { - public: - CommandQueue() { } - CommandQueue(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Device GetDevice() const; - - void SetLabel(const ns::String& label); - - class CommandBuffer CommandBufferWithUnretainedReferences(); - class CommandBuffer CommandBuffer(); - void InsertDebugCaptureBoundary(); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: depth_stencil.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "device.hpp" - -namespace mtlpp -{ - enum class CompareFunction - { - Never = 0, - Less = 1, - Equal = 2, - LessEqual = 3, - Greater = 4, - NotEqual = 5, - GreaterEqual = 6, - Always = 7, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class StencilOperation - { - Keep = 0, - Zero = 1, - Replace = 2, - IncrementClamp = 3, - DecrementClamp = 4, - Invert = 5, - IncrementWrap = 6, - DecrementWrap = 7, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class StencilDescriptor : public ns::Object - { - public: - StencilDescriptor(); - StencilDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - CompareFunction GetStencilCompareFunction() const; - StencilOperation GetStencilFailureOperation() const; - StencilOperation GetDepthFailureOperation() const; - StencilOperation GetDepthStencilPassOperation() const; - uint32_t GetReadMask() const; - uint32_t GetWriteMask() const; - - void SetStencilCompareFunction(CompareFunction stencilCompareFunction); - void SetStencilFailureOperation(StencilOperation stencilFailureOperation); - void SetDepthFailureOperation(StencilOperation depthFailureOperation); - void SetDepthStencilPassOperation(StencilOperation depthStencilPassOperation); - void SetReadMask(uint32_t readMask); - void SetWriteMask(uint32_t writeMask); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class DepthStencilDescriptor : public ns::Object - { - public: - DepthStencilDescriptor(); - DepthStencilDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - CompareFunction GetDepthCompareFunction() const; - bool IsDepthWriteEnabled() const; - StencilDescriptor GetFrontFaceStencil() const; - StencilDescriptor GetBackFaceStencil() const; - ns::String GetLabel() const; - - void SetDepthCompareFunction(CompareFunction depthCompareFunction) const; - void SetDepthWriteEnabled(bool depthWriteEnabled) const; - void SetFrontFaceStencil(const StencilDescriptor& frontFaceStencil) const; - void SetBackFaceStencil(const StencilDescriptor& backFaceStencil) const; - void SetLabel(const ns::String& label) const; - } - MTLPP_AVAILABLE(10_11, 8_0); - - class DepthStencilState : public ns::Object - { - public: - DepthStencilState() { } - DepthStencilState(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Device GetDevice() const; - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: drawable.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - class Drawable : public ns::Object - { - public: - Drawable() { } - Drawable(const ns::Handle& handle) : ns::Object(handle) { } - - void Present(); - void Present(double presentationTime); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - - -////////////////////////////////////// -// FILE: render_pass.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - class Texture; - class Buffer; - - enum class LoadAction - { - DontCare = 0, - Load = 1, - Clear = 2, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class StoreAction - { - DontCare = 0, - Store = 1, - MultisampleResolve = 2, - StoreAndMultisampleResolve MTLPP_AVAILABLE(10_12,10_0) = 3, - Unknown MTLPP_AVAILABLE(10_12,10_0) = 4, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class MultisampleDepthResolveFilter - { - Sample0 = 0, - Min = 1, - Max = 2, - } - MTLPP_AVAILABLE_IOS(9_0); - - struct ClearColor - { - ClearColor(double red, double green, double blue, double alpha) : - Red(red), - Green(green), - Blue(blue), - Alpha(alpha) { } - - double Red; - double Green; - double Blue; - double Alpha; - }; - - class RenderPassAttachmentDescriptor : public ns::Object - { - public: - RenderPassAttachmentDescriptor(); - RenderPassAttachmentDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - Texture GetTexture() const; - uint32_t GetLevel() const; - uint32_t GetSlice() const; - uint32_t GetDepthPlane() const; - Texture GetResolveTexture() const; - uint32_t GetResolveLevel() const; - uint32_t GetResolveSlice() const; - uint32_t GetResolveDepthPlane() const; - LoadAction GetLoadAction() const; - StoreAction GetStoreAction() const; - - void SetTexture(const Texture& texture); - void SetLevel(uint32_t level); - void SetSlice(uint32_t slice); - void SetDepthPlane(uint32_t depthPlane); - void SetResolveTexture(const Texture& texture); - void SetResolveLevel(uint32_t resolveLevel); - void SetResolveSlice(uint32_t resolveSlice); - void SetResolveDepthPlane(uint32_t resolveDepthPlane); - void SetLoadAction(LoadAction loadAction); - void SetStoreAction(StoreAction storeAction); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPassColorAttachmentDescriptor : public RenderPassAttachmentDescriptor - { - public: - RenderPassColorAttachmentDescriptor(); - RenderPassColorAttachmentDescriptor(const ns::Handle& handle) : RenderPassAttachmentDescriptor(handle) { } - - ClearColor GetClearColor() const; - - void SetClearColor(const ClearColor& clearColor); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPassDepthAttachmentDescriptor : public RenderPassAttachmentDescriptor - { - public: - RenderPassDepthAttachmentDescriptor(); - RenderPassDepthAttachmentDescriptor(const ns::Handle& handle) : RenderPassAttachmentDescriptor(handle) { } - - double GetClearDepth() const; - MultisampleDepthResolveFilter GetDepthResolveFilter() const MTLPP_AVAILABLE_IOS(9_0); - - void SetClearDepth(double clearDepth); - void SetDepthResolveFilter(MultisampleDepthResolveFilter depthResolveFilter) MTLPP_AVAILABLE_IOS(9_0); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPassStencilAttachmentDescriptor : public RenderPassAttachmentDescriptor - { - public: - RenderPassStencilAttachmentDescriptor(); - RenderPassStencilAttachmentDescriptor(const ns::Handle& handle) : RenderPassAttachmentDescriptor(handle) { } - - uint32_t GetClearStencil() const; - - void SetClearStencil(uint32_t clearStencil); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPassDescriptor : public ns::Object - { - public: - RenderPassDescriptor(); - RenderPassDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - ns::Array GetColorAttachments() const; - RenderPassDepthAttachmentDescriptor GetDepthAttachment() const; - RenderPassStencilAttachmentDescriptor GetStencilAttachment() const; - Buffer GetVisibilityResultBuffer() const; - uint32_t GetRenderTargetArrayLength() const MTLPP_AVAILABLE_MAC(10_11); - - void SetDepthAttachment(const RenderPassDepthAttachmentDescriptor& depthAttachment); - void SetStencilAttachment(const RenderPassStencilAttachmentDescriptor& stencilAttachment); - void SetVisibilityResultBuffer(const Buffer& visibilityResultBuffer); - void SetRenderTargetArrayLength(uint32_t renderTargetArrayLength) MTLPP_AVAILABLE_MAC(10_11); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: stage_input_output_descriptor.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "device.hpp" - -namespace mtlpp -{ - enum class AttributeFormat - { - Invalid = 0, - - UChar2 = 1, - UChar3 = 2, - UChar4 = 3, - - Char2 = 4, - Char3 = 5, - Char4 = 6, - - UChar2Normalized = 7, - UChar3Normalized = 8, - UChar4Normalized = 9, - - Char2Normalized = 10, - Char3Normalized = 11, - Char4Normalized = 12, - - UShort2 = 13, - UShort3 = 14, - UShort4 = 15, - - Short2 = 16, - Short3 = 17, - Short4 = 18, - - UShort2Normalized = 19, - UShort3Normalized = 20, - UShort4Normalized = 21, - - Short2Normalized = 22, - Short3Normalized = 23, - Short4Normalized = 24, - - Half2 = 25, - Half3 = 26, - Half4 = 27, - - Float = 28, - Float2 = 29, - Float3 = 30, - Float4 = 31, - - Int = 32, - Int2 = 33, - Int3 = 34, - Int4 = 35, - - UInt = 36, - UInt2 = 37, - UInt3 = 38, - UInt4 = 39, - - Int1010102Normalized = 40, - UInt1010102Normalized = 41, - } - MTLPP_AVAILABLE(10_12, 10_0); - - enum class IndexType - { - UInt16 = 0, - UInt32 = 1, - } - MTLPP_AVAILABLE(10_11, 8_0); - - - enum class StepFunction - { - Constant = 0, - - PerVertex = 1, - PerInstance = 2, - PerPatch MTLPP_AVAILABLE(10_12, 10_0) = 3, - PerPatchControlPoint MTLPP_AVAILABLE(10_12, 10_0) = 4, - - ThreadPositionInGridX = 5, - ThreadPositionInGridY = 6, - ThreadPositionInGridXIndexed = 7, - ThreadPositionInGridYIndexed = 8, - } - MTLPP_AVAILABLE(10_12, 10_0); - - class BufferLayoutDescriptor : public ns::Object - { - public: - BufferLayoutDescriptor(); - BufferLayoutDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - uint32_t GetStride() const; - StepFunction GetStepFunction() const; - uint32_t GetStepRate() const; - - void SetStride(uint32_t stride); - void SetStepFunction(StepFunction stepFunction); - void SetStepRate(uint32_t stepRate); - } - MTLPP_AVAILABLE(10_12, 10_0); - - class AttributeDescriptor : public ns::Object - { - public: - AttributeDescriptor(); - AttributeDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - AttributeFormat GetFormat() const; - uint32_t GetOffset() const; - uint32_t GetBufferIndex() const; - - void SetFormat(AttributeFormat format); - void SetOffset(uint32_t offset); - void SetBufferIndex(uint32_t bufferIndex); - } - MTLPP_AVAILABLE(10_12, 10_0); - - class StageInputOutputDescriptor : public ns::Object - { - public: - StageInputOutputDescriptor(); - StageInputOutputDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - - ns::Array GetLayouts() const; - ns::Array GetAttributes() const; - IndexType GetIndexType() const; - uint32_t GetIndexBufferIndex() const; - - void SetIndexType(IndexType indexType); - void SetIndexBufferIndex(uint32_t indexBufferIndex); - - void Reset(); - } - MTLPP_AVAILABLE(10_12, 10_0); -} - -////////////////////////////////////// -// FILE: compute_pipeline.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "device.hpp" -// #include "argument.hpp" -// #include "stage_input_output_descriptor.hpp" - -namespace mtlpp -{ - class ComputePipelineReflection : public ns::Object - { - public: - ComputePipelineReflection(); - ComputePipelineReflection(const ns::Handle& handle) : ns::Object(handle) { } - - ns::Array GetArguments() const; - } - MTLPP_AVAILABLE(10_11, 9_0); - - class ComputePipelineDescriptor : public ns::Object - { - public: - ComputePipelineDescriptor(); - ComputePipelineDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Function GetComputeFunction() const; - bool GetThreadGroupSizeIsMultipleOfThreadExecutionWidth() const; - StageInputOutputDescriptor GetStageInputDescriptor() const MTLPP_AVAILABLE(10_12, 10_0); - - void SetLabel(const ns::String& label); - void SetComputeFunction(const Function& function); - void SetThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool value); - void SetStageInputDescriptor(const StageInputOutputDescriptor& stageInputDescriptor) const MTLPP_AVAILABLE(10_12, 10_0); - - void Reset(); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class ComputePipelineState : public ns::Object - { - public: - ComputePipelineState() { } - ComputePipelineState(const ns::Handle& handle) : ns::Object(handle) { } - - Device GetDevice() const; - uint32_t GetMaxTotalThreadsPerThreadgroup() const; - uint32_t GetThreadExecutionWidth() const; - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: render_command_encoder.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "command_encoder.hpp" -// #include "command_buffer.hpp" -// #include "render_pass.hpp" -// #include "fence.hpp" -// #include "stage_input_output_descriptor.hpp" - -namespace mtlpp -{ - enum class PrimitiveType - { - Point = 0, - Line = 1, - LineStrip = 2, - Triangle = 3, - TriangleStrip = 4, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class VisibilityResultMode - { - Disabled = 0, - Boolean = 1, - Counting MTLPP_AVAILABLE(10_11, 9_0) = 2, - } - MTLPP_AVAILABLE(10_11, 8_0); - - struct ScissorRect - { - uint32_t X; - uint32_t Y; - uint32_t Width; - uint32_t Height; - }; - - struct Viewport - { - double OriginX; - double OriginY; - double Width; - double Height; - double ZNear; - double ZFar; - }; - - enum class CullMode - { - None = 0, - Front = 1, - Back = 2, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class Winding - { - Clockwise = 0, - CounterClockwise = 1, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class DepthClipMode - { - Clip = 0, - Clamp = 1, - } - MTLPP_AVAILABLE(10_11, 9_0); - - enum class TriangleFillMode - { - Fill = 0, - Lines = 1, - } - MTLPP_AVAILABLE(10_11, 8_0); - - struct DrawPrimitivesIndirectArguments - { - uint32_t VertexCount; - uint32_t InstanceCount; - uint32_t VertexStart; - uint32_t BaseInstance; - }; - - struct DrawIndexedPrimitivesIndirectArguments - { - uint32_t IndexCount; - uint32_t InstanceCount; - uint32_t IndexStart; - int32_t BaseVertex; - uint32_t BaseInstance; - }; - - struct DrawPatchIndirectArguments - { - uint32_t PatchCount; - uint32_t InstanceCount; - uint32_t PatchStart; - uint32_t BaseInstance; - }; - - struct QuadTessellationFactorsHalf - { - uint16_t EdgeTessellationFactor[4]; - uint16_t InsideTessellationFactor[2]; - }; - - struct riangleTessellationFactorsHalf - { - uint16_t EdgeTessellationFactor[3]; - uint16_t InsideTessellationFactor; - }; - - enum class RenderStages - { - Vertex = (1 << 0), - Fragment = (1 << 1), - } - MTLPP_AVAILABLE_IOS(10_0); - - - class RenderCommandEncoder : public CommandEncoder - { - public: - RenderCommandEncoder() { } - RenderCommandEncoder(const ns::Handle& handle) : CommandEncoder(handle) { } - - void SetRenderPipelineState(const RenderPipelineState& pipelineState); - void SetVertexData(const void* bytes, uint32_t length, uint32_t index) MTLPP_AVAILABLE(10_11, 8_3); - void SetVertexBuffer(const Buffer& buffer, uint32_t offset, uint32_t index); - void SetVertexBufferOffset(uint32_t offset, uint32_t index) MTLPP_AVAILABLE(10_11, 8_3); - void SetVertexBuffers(const Buffer* buffers, const uint32_t* offsets, const ns::Range& range); - void SetVertexTexture(const Texture& texture, uint32_t index); - void SetVertexTextures(const Texture* textures, const ns::Range& range); - void SetVertexSamplerState(const SamplerState& sampler, uint32_t index); - void SetVertexSamplerStates(const SamplerState* samplers, const ns::Range& range); - void SetVertexSamplerState(const SamplerState& sampler, float lodMinClamp, float lodMaxClamp, uint32_t index); - void SetVertexSamplerStates(const SamplerState* samplers, const float* lodMinClamps, const float* lodMaxClamps, const ns::Range& range); - void SetViewport(const Viewport& viewport); - void SetFrontFacingWinding(Winding frontFacingWinding); - void SetCullMode(CullMode cullMode); - void SetDepthClipMode(DepthClipMode depthClipMode) MTLPP_AVAILABLE(10_11, NA); - void SetDepthBias(float depthBias, float slopeScale, float clamp); - void SetScissorRect(const ScissorRect& rect); - void SetTriangleFillMode(TriangleFillMode fillMode); - void SetFragmentData(const void* bytes, uint32_t length, uint32_t index); - void SetFragmentBuffer(const Buffer& buffer, uint32_t offset, uint32_t index); - void SetFragmentBufferOffset(uint32_t offset, uint32_t index) MTLPP_AVAILABLE(10_11, 8_3); - void SetFragmentBuffers(const Buffer* buffers, const uint32_t* offsets, const ns::Range& range); - void SetFragmentTexture(const Texture& texture, uint32_t index); - void SetFragmentTextures(const Texture* textures, const ns::Range& range); - void SetFragmentSamplerState(const SamplerState& sampler, uint32_t index); - void SetFragmentSamplerStates(const SamplerState* samplers, const ns::Range& range); - void SetFragmentSamplerState(const SamplerState& sampler, float lodMinClamp, float lodMaxClamp, uint32_t index); - void SetFragmentSamplerStates(const SamplerState* samplers, const float* lodMinClamps, const float* lodMaxClamps, const ns::Range& range); - void SetBlendColor(float red, float green, float blue, float alpha); - void SetDepthStencilState(const DepthStencilState& depthStencilState); - void SetStencilReferenceValue(uint32_t referenceValue); - void SetStencilReferenceValue(uint32_t frontReferenceValue, uint32_t backReferenceValue); - void SetVisibilityResultMode(VisibilityResultMode mode, uint32_t offset); - void SetColorStoreAction(StoreAction storeAction, uint32_t colorAttachmentIndex) MTLPP_AVAILABLE(10_12, 10_0); - void SetDepthStoreAction(StoreAction storeAction) MTLPP_AVAILABLE(10_12, 10_0); - void SetStencilStoreAction(StoreAction storeAction) MTLPP_AVAILABLE(10_12, 10_0); - void Draw(PrimitiveType primitiveType, uint32_t vertexStart, uint32_t vertexCount); - void Draw(PrimitiveType primitiveType, uint32_t vertexStart, uint32_t vertexCount, uint32_t instanceCount) MTLPP_AVAILABLE(10_11, 9_0); - void Draw(PrimitiveType primitiveType, uint32_t vertexStart, uint32_t vertexCount, uint32_t instanceCount, uint32_t baseInstance) MTLPP_AVAILABLE(10_11, 9_0); - void Draw(PrimitiveType primitiveType, Buffer indirectBuffer, uint32_t indirectBufferOffset); - void DrawIndexed(PrimitiveType primitiveType, uint32_t indexCount, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset); - void DrawIndexed(PrimitiveType primitiveType, uint32_t indexCount, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset, uint32_t instanceCount) MTLPP_AVAILABLE(10_11, 9_0); - void DrawIndexed(PrimitiveType primitiveType, uint32_t indexCount, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset, uint32_t instanceCount, uint32_t baseVertex, uint32_t baseInstance) MTLPP_AVAILABLE(10_11, 9_0); - void DrawIndexed(PrimitiveType primitiveType, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset, const Buffer& indirectBuffer, uint32_t indirectBufferOffset); - void TextureBarrier() MTLPP_AVAILABLE_MAC(10_11); - void UpdateFence(const Fence& fence, RenderStages afterStages) MTLPP_AVAILABLE_IOS(10_0); - void WaitForFence(const Fence& fence, RenderStages beforeStages) MTLPP_AVAILABLE_IOS(10_0); - void SetTessellationFactorBuffer(const Buffer& buffer, uint32_t offset, uint32_t instanceStride) MTLPP_AVAILABLE(10_12, 10_0); - void SetTessellationFactorScale(float scale) MTLPP_AVAILABLE(10_12, 10_0); - void DrawPatches(uint32_t numberOfPatchControlPoints, uint32_t patchStart, uint32_t patchCount, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, uint32_t instanceCount, uint32_t baseInstance) MTLPP_AVAILABLE(10_12, 10_0); - void DrawPatches(uint32_t numberOfPatchControlPoints, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, const Buffer& indirectBuffer, uint32_t indirectBufferOffset) MTLPP_AVAILABLE(10_12, NA); - void DrawIndexedPatches(uint32_t numberOfPatchControlPoints, uint32_t patchStart, uint32_t patchCount, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, const Buffer& controlPointIndexBuffer, uint32_t controlPointIndexBufferOffset, uint32_t instanceCount, uint32_t baseInstance) MTLPP_AVAILABLE(10_12, 10_0); - void DrawIndexedPatches(uint32_t numberOfPatchControlPoints, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, const Buffer& controlPointIndexBuffer, uint32_t controlPointIndexBufferOffset, const Buffer& indirectBuffer, uint32_t indirectBufferOffset) MTLPP_AVAILABLE(10_12, NA); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - - -////////////////////////////////////// -// FILE: function_constant_values.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "argument.hpp" - -namespace mtlpp -{ - class FunctionConstantValues : public ns::Object - { - public: - FunctionConstantValues(); - FunctionConstantValues(const ns::Handle& handle) : ns::Object(handle) { } - - void SetConstantValue(const void* value, DataType type, uint32_t index); - void SetConstantValue(const void* value, DataType type, const ns::String& name); - void SetConstantValues(const void* value, DataType type, const ns::Range& range); - - void Reset(); - } - MTLPP_AVAILABLE(10_12, 10_0); -} - -////////////////////////////////////// -// FILE: render_pipeline.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "device.hpp" -// #include "render_command_encoder.hpp" -// #include "render_pass.hpp" -// #include "pixel_format.hpp" -// #include "argument.hpp" -// #include "function_constant_values.hpp" - -namespace mtlpp -{ - class VertexDescriptor; - - enum class BlendFactor - { - Zero = 0, - One = 1, - SourceColor = 2, - OneMinusSourceColor = 3, - SourceAlpha = 4, - OneMinusSourceAlpha = 5, - DestinationColor = 6, - OneMinusDestinationColor = 7, - DestinationAlpha = 8, - OneMinusDestinationAlpha = 9, - SourceAlphaSaturated = 10, - BlendColor = 11, - OneMinusBlendColor = 12, - BlendAlpha = 13, - OneMinusBlendAlpha = 14, - Source1Color MTLPP_AVAILABLE_MAC(10_12) = 15, - OneMinusSource1Color MTLPP_AVAILABLE_MAC(10_12) = 16, - Source1Alpha MTLPP_AVAILABLE_MAC(10_12) = 17, - OneMinusSource1Alpha MTLPP_AVAILABLE_MAC(10_12) = 18, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class BlendOperation - { - Add = 0, - Subtract = 1, - ReverseSubtract = 2, - Min = 3, - Max = 4, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class ColorWriteMask - { - None = 0, - Red = 0x1 << 3, - Green = 0x1 << 2, - Blue = 0x1 << 1, - Alpha = 0x1 << 0, - All = 0xf - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class PrimitiveTopologyClass - { - Unspecified = 0, - Point = 1, - Line = 2, - Triangle = 3, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class TessellationPartitionMode - { - ModePow2 = 0, - ModeInteger = 1, - ModeFractionalOdd = 2, - ModeFractionalEven = 3, - } - MTLPP_AVAILABLE(10_12, 10_0); - - enum class TessellationFactorStepFunction - { - Constant = 0, - PerPatch = 1, - PerInstance = 2, - PerPatchAndPerInstance = 3, - } - MTLPP_AVAILABLE(10_12, 10_0); - - enum class TessellationFactorFormat - { - Half = 0, - } - MTLPP_AVAILABLE(10_12, 10_0); - - enum class TessellationControlPointIndexType - { - None = 0, - UInt16 = 1, - UInt32 = 2, - } - MTLPP_AVAILABLE(10_12, 10_0); - - class RenderPipelineColorAttachmentDescriptor : public ns::Object - { - public: - RenderPipelineColorAttachmentDescriptor(); - RenderPipelineColorAttachmentDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - PixelFormat GetPixelFormat() const; - bool IsBlendingEnabled() const; - BlendFactor GetSourceRgbBlendFactor() const; - BlendFactor GetDestinationRgbBlendFactor() const; - BlendOperation GetRgbBlendOperation() const; - BlendFactor GetSourceAlphaBlendFactor() const; - BlendFactor GetDestinationAlphaBlendFactor() const; - BlendOperation GetAlphaBlendOperation() const; - ColorWriteMask GetWriteMask() const; - - void SetPixelFormat(PixelFormat pixelFormat); - void SetBlendingEnabled(bool blendingEnabled); - void SetSourceRgbBlendFactor(BlendFactor sourceRgbBlendFactor); - void SetDestinationRgbBlendFactor(BlendFactor destinationRgbBlendFactor); - void SetRgbBlendOperation(BlendOperation rgbBlendOperation); - void SetSourceAlphaBlendFactor(BlendFactor sourceAlphaBlendFactor); - void SetDestinationAlphaBlendFactor(BlendFactor destinationAlphaBlendFactor); - void SetAlphaBlendOperation(BlendOperation alphaBlendOperation); - void SetWriteMask(ColorWriteMask writeMask); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPipelineReflection : public ns::Object - { - public: - RenderPipelineReflection(); - RenderPipelineReflection(const ns::Handle& handle) : ns::Object(handle) { } - - const ns::Array GetVertexArguments() const; - const ns::Array GetFragmentArguments() const; - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPipelineDescriptor : public ns::Object - { - public: - RenderPipelineDescriptor(); - RenderPipelineDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Function GetVertexFunction() const; - Function GetFragmentFunction() const; - VertexDescriptor GetVertexDescriptor() const; - uint32_t GetSampleCount() const; - bool IsAlphaToCoverageEnabled() const; - bool IsAlphaToOneEnabled() const; - bool IsRasterizationEnabled() const; - ns::Array GetColorAttachments() const; - PixelFormat GetDepthAttachmentPixelFormat() const; - PixelFormat GetStencilAttachmentPixelFormat() const; - PrimitiveTopologyClass GetInputPrimitiveTopology() const MTLPP_AVAILABLE_MAC(10_11); - TessellationPartitionMode GetTessellationPartitionMode() const MTLPP_AVAILABLE(10_12, 10_0); - uint32_t GetMaxTessellationFactor() const MTLPP_AVAILABLE(10_12, 10_0); - bool IsTessellationFactorScaleEnabled() const MTLPP_AVAILABLE(10_12, 10_0); - TessellationFactorFormat GetTessellationFactorFormat() const MTLPP_AVAILABLE(10_12, 10_0); - TessellationControlPointIndexType GetTessellationControlPointIndexType() const MTLPP_AVAILABLE(10_12, 10_0); - TessellationFactorStepFunction GetTessellationFactorStepFunction() const MTLPP_AVAILABLE(10_12, 10_0); - Winding GetTessellationOutputWindingOrder() const MTLPP_AVAILABLE(10_12, 10_0); - - - void SetLabel(const ns::String& label); - void SetVertexFunction(const Function& vertexFunction); - void SetFragmentFunction(const Function& fragmentFunction); - void SetVertexDescriptor(const VertexDescriptor& vertexDescriptor); - void SetSampleCount(uint32_t sampleCount); - void SetAlphaToCoverageEnabled(bool alphaToCoverageEnabled); - void SetAlphaToOneEnabled(bool alphaToOneEnabled); - void SetRasterizationEnabled(bool rasterizationEnabled); - void SetDepthAttachmentPixelFormat(PixelFormat depthAttachmentPixelFormat); - void SetStencilAttachmentPixelFormat(PixelFormat stencilAttachmentPixelFormat); - void SetInputPrimitiveTopology(PrimitiveTopologyClass inputPrimitiveTopology) MTLPP_AVAILABLE_MAC(10_11); - void SetTessellationPartitionMode(TessellationPartitionMode tessellationPartitionMode) MTLPP_AVAILABLE(10_12, 10_0); - void SetMaxTessellationFactor(uint32_t maxTessellationFactor) MTLPP_AVAILABLE(10_12, 10_0); - void SetTessellationFactorScaleEnabled(bool tessellationFactorScaleEnabled) MTLPP_AVAILABLE(10_12, 10_0); - void SetTessellationFactorFormat(TessellationFactorFormat tessellationFactorFormat) MTLPP_AVAILABLE(10_12, 10_0); - void SetTessellationControlPointIndexType(TessellationControlPointIndexType tessellationControlPointIndexType) MTLPP_AVAILABLE(10_12, 10_0); - void SetTessellationFactorStepFunction(TessellationFactorStepFunction tessellationFactorStepFunction) MTLPP_AVAILABLE(10_12, 10_0); - void SetTessellationOutputWindingOrder(Winding tessellationOutputWindingOrder) MTLPP_AVAILABLE(10_12, 10_0); - - void Reset(); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class RenderPipelineState : public ns::Object - { - public: - RenderPipelineState() { } - RenderPipelineState(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Device GetDevice() const; - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: vertex_descriptor.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" - -namespace mtlpp -{ - enum class VertexFormat - { - Invalid = 0, - - UChar2 = 1, - UChar3 = 2, - UChar4 = 3, - - Char2 = 4, - Char3 = 5, - Char4 = 6, - - UChar2Normalized = 7, - UChar3Normalized = 8, - UChar4Normalized = 9, - - Char2Normalized = 10, - Char3Normalized = 11, - Char4Normalized = 12, - - UShort2 = 13, - UShort3 = 14, - UShort4 = 15, - - Short2 = 16, - Short3 = 17, - Short4 = 18, - - UShort2Normalized = 19, - UShort3Normalized = 20, - UShort4Normalized = 21, - - Short2Normalized = 22, - Short3Normalized = 23, - Short4Normalized = 24, - - Half2 = 25, - Half3 = 26, - Half4 = 27, - - Float = 28, - Float2 = 29, - Float3 = 30, - Float4 = 31, - - Int = 32, - Int2 = 33, - Int3 = 34, - Int4 = 35, - - UInt = 36, - UInt2 = 37, - UInt3 = 38, - UInt4 = 39, - - Int1010102Normalized = 40, - UInt1010102Normalized = 41, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class VertexStepFunction - { - Constant = 0, - PerVertex = 1, - PerInstance = 2, - PerPatch MTLPP_AVAILABLE(10_12, 10_0) = 3, - PerPatchControlPoint MTLPP_AVAILABLE(10_12, 10_0) = 4, - } - MTLPP_AVAILABLE(10_11, 8_0); - - class VertexBufferLayoutDescriptor : public ns::Object - { - public: - VertexBufferLayoutDescriptor(); - VertexBufferLayoutDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - uint32_t GetStride() const; - VertexStepFunction GetStepFunction() const; - uint32_t GetStepRate() const; - - void SetStride(uint32_t stride); - void SetStepFunction(VertexStepFunction stepFunction); - void SetStepRate(uint32_t stepRate); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class VertexAttributeDescriptor : public ns::Object - { - public: - VertexAttributeDescriptor(); - VertexAttributeDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - VertexFormat GetFormat() const; - uint32_t GetOffset() const; - uint32_t GetBufferIndex() const; - - void SetFormat(VertexFormat format); - void SetOffset(uint32_t offset); - void SetBufferIndex(uint32_t bufferIndex); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class VertexDescriptor : public ns::Object - { - public: - VertexDescriptor(); - VertexDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - ns::Array GetLayouts() const; - ns::Array GetAttributes() const; - - void Reset(); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - -////////////////////////////////////// -// FILE: parallel_render_command_encoder.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "render_pass.hpp" -// #include "command_encoder.hpp" - -namespace mtlpp -{ - class RenderCommandEncoder; - - class ParallelRenderCommandEncoder : public ns::Object - { - public: - ParallelRenderCommandEncoder() { } - ParallelRenderCommandEncoder(const ns::Handle& handle) : ns::Object(handle) { } - - RenderCommandEncoder GetRenderCommandEncoder(); - - void SetColorStoreAction(StoreAction storeAction, uint32_t colorAttachmentIndex) MTLPP_AVAILABLE(10_12, 10_0); - void SetDepthStoreAction(StoreAction storeAction) MTLPP_AVAILABLE(10_12, 10_0); - void SetStencilStoreAction(StoreAction storeAction) MTLPP_AVAILABLE(10_12, 10_0); - } - MTLPP_AVAILABLE(10_11, 8_0); -} - - -////////////////////////////////////// -// FILE: sampler.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "depth_stencil.hpp" -// #include "device.hpp" - -namespace mtlpp -{ - enum class SamplerMinMagFilter - { - Nearest = 0, - Linear = 1, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class SamplerMipFilter - { - NotMipmapped = 0, - Nearest = 1, - Linear = 2, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class SamplerAddressMode - { - ClampToEdge = 0, - MirrorClampToEdge MTLPP_AVAILABLE_MAC(10_11) = 1, - Repeat = 2, - MirrorRepeat = 3, - ClampToZero = 4, - ClampToBorderColor MTLPP_AVAILABLE_MAC(10_12) = 5, - } - MTLPP_AVAILABLE(10_11, 8_0); - - enum class SamplerBorderColor - { - TransparentBlack = 0, // {0,0,0,0} - OpaqueBlack = 1, // {0,0,0,1} - OpaqueWhite = 2, // {1,1,1,1} - }; - - class SamplerDescriptor : public ns::Object - { - public: - SamplerDescriptor(); - SamplerDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - SamplerMinMagFilter GetMinFilter() const; - SamplerMinMagFilter GetMagFilter() const; - SamplerMipFilter GetMipFilter() const; - uint32_t GetMaxAnisotropy() const; - SamplerAddressMode GetSAddressMode() const; - SamplerAddressMode GetTAddressMode() const; - SamplerAddressMode GetRAddressMode() const; - SamplerBorderColor GetBorderColor() const MTLPP_AVAILABLE_MAC(10_12); - bool IsNormalizedCoordinates() const; - float GetLodMinClamp() const; - float GetLodMaxClamp() const; - CompareFunction GetCompareFunction() const MTLPP_AVAILABLE(10_11, 9_0); - ns::String GetLabel() const; - - void SetMinFilter(SamplerMinMagFilter minFilter); - void SetMagFilter(SamplerMinMagFilter magFilter); - void SetMipFilter(SamplerMipFilter mipFilter); - void SetMaxAnisotropy(uint32_t maxAnisotropy); - void SetSAddressMode(SamplerAddressMode sAddressMode); - void SetTAddressMode(SamplerAddressMode tAddressMode); - void SetRAddressMode(SamplerAddressMode rAddressMode); - void SetBorderColor(SamplerBorderColor borderColor) MTLPP_AVAILABLE_MAC(10_12); - void SetNormalizedCoordinates(bool normalizedCoordinates); - void SetLodMinClamp(float lodMinClamp); - void SetLodMaxClamp(float lodMaxClamp); - void SetCompareFunction(CompareFunction compareFunction) MTLPP_AVAILABLE(10_11, 9_0); - void SetLabel(const ns::String& label); - } - MTLPP_AVAILABLE(10_11, 8_0); - - class SamplerState : public ns::Object - { - public: - SamplerState() { } - SamplerState(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Device GetDevice() const; - } - MTLPP_AVAILABLE(10_11, 8_0); -} - - -////////////////////////////////////// -// FILE: heap.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "ns.hpp" -// #include "device.hpp" -// #include "resource.hpp" -// #include "buffer.hpp" -// #include "texture.hpp" -// #include "types.hpp" - -namespace mtlpp -{ - class HeapDescriptor : public ns::Object - { - public: - HeapDescriptor(const ns::Handle& handle) : ns::Object(handle) { } - - uint32_t GetSize() const; - StorageMode GetStorageMode() const; - CpuCacheMode GetCpuCacheMode() const; - - void SetSize(uint32_t size) const; - void SetStorageMode(StorageMode storageMode) const; - void SetCpuCacheMode(CpuCacheMode cpuCacheMode) const; - } - MTLPP_AVAILABLE(NA, 10_0); - - class Heap : public ns::Object - { - public: - Heap(const ns::Handle& handle) : ns::Object(handle) { } - - ns::String GetLabel() const; - Device GetDevice() const; - StorageMode GetStorageMode() const; - CpuCacheMode GetCpuCacheMode() const; - uint32_t GetSize() const; - uint32_t GetUsedSize() const; - - void SetLabel(const ns::String& label); - - uint32_t MaxAvailableSizeWithAlignment(uint32_t alignment); - Buffer NewBuffer(uint32_t length, ResourceOptions options); - Texture NewTexture(const TextureDescriptor& desc); - PurgeableState SetPurgeableState(PurgeableState state); - } - MTLPP_AVAILABLE(NA, 10_0); -} - -////////////////////////////////////// -// FILE: mtlpp.hpp -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #pragma once - -// #include "defines.hpp" -// #include "blit_command_encoder.hpp" -// #include "buffer.hpp" -// #include "command_buffer.hpp" -// #include "compute_command_encoder.hpp" -// #include "command_queue.hpp" -// #include "device.hpp" -// #include "depth_stencil.hpp" -// #include "drawable.hpp" -// #include "render_pass.hpp" -// #include "compute_pipeline.hpp" -// #include "library.hpp" -// #include "pixel_format.hpp" -// #include "render_pipeline.hpp" -// #include "vertex_descriptor.hpp" -// #include "parallel_render_command_encoder.hpp" -// #include "render_command_encoder.hpp" -// #include "sampler.hpp" -// #include "texture.hpp" -// #include "heap.hpp" - diff --git a/3rdparty/bgfx/3rdparty/mtlpp/mtlpp.mm b/3rdparty/bgfx/3rdparty/mtlpp/mtlpp.mm deleted file mode 100644 index 205a49de5fd..00000000000 --- a/3rdparty/bgfx/3rdparty/mtlpp/mtlpp.mm +++ /dev/null @@ -1,4599 +0,0 @@ -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ -#include "mtlpp.hpp" - -////////////////////////////////////// -// FILE: argument.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "argument.hpp" -#include - -namespace mtlpp -{ - StructMember::StructMember() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLStructMember alloc] init] }) - { - } - - ns::String StructMember::GetName() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLStructMember*)m_ptr name] }; - } - - uint32_t StructMember::GetOffset() const - { - Validate(); - return uint32_t([(__bridge MTLStructMember*)m_ptr offset]); - } - - DataType StructMember::GetDataType() const - { - Validate(); - return DataType([(__bridge MTLStructMember*)m_ptr dataType]); - } - - StructType StructMember::GetStructType() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLStructMember*)m_ptr structType] }; - } - - ArrayType StructMember::GetArrayType() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLStructMember*)m_ptr arrayType] }; - } - - StructType::StructType() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLStructType alloc] init] }) - { - } - - const ns::Array StructType::GetMembers() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLStructType*)m_ptr members] }; - } - - StructMember StructType::GetMember(const ns::String& name) const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLStructType*)m_ptr memberByName:(__bridge NSString*)name.GetPtr()] }; - } - - ArrayType::ArrayType() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLArrayType alloc] init] }) - { - } - - uint32_t ArrayType::GetArrayLength() const - { - Validate(); - return uint32_t([(__bridge MTLArrayType*)m_ptr arrayLength]); - } - - DataType ArrayType::GetElementType() const - { - Validate(); - return DataType([(__bridge MTLArrayType*)m_ptr elementType]); - } - - uint32_t ArrayType::GetStride() const - { - Validate(); - return uint32_t([(__bridge MTLArrayType*)m_ptr stride]); - } - - StructType ArrayType::GetElementStructType() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLArrayType*)m_ptr elementStructType] }; - } - - ArrayType ArrayType::GetElementArrayType() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLArrayType*)m_ptr elementArrayType] }; - } - - Argument::Argument() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLArgument alloc] init] }) - { - } - - ns::String Argument::GetName() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLArgument*)m_ptr name] }; - } - - ArgumentType Argument::GetType() const - { - Validate(); - return ArgumentType([(__bridge MTLArgument*)m_ptr type]); - } - - ArgumentAccess Argument::GetAccess() const - { - Validate(); - return ArgumentAccess([(__bridge MTLArgument*)m_ptr access]); - } - - uint32_t Argument::GetIndex() const - { - Validate(); - return uint32_t([(__bridge MTLArgument*)m_ptr index]); - } - - bool Argument::IsActive() const - { - Validate(); - return [(__bridge MTLArgument*)m_ptr isActive]; - } - - uint32_t Argument::GetBufferAlignment() const - { - Validate(); - return uint32_t([(__bridge MTLArgument*)m_ptr bufferAlignment]); - } - - uint32_t Argument::GetBufferDataSize() const - { - Validate(); - return uint32_t([(__bridge MTLArgument*)m_ptr bufferDataSize]); - } - - DataType Argument::GetBufferDataType() const - { - Validate(); - return DataType([(__bridge MTLArgument*)m_ptr bufferDataType]); - } - - StructType Argument::GetBufferStructType() const - { - Validate(); - return StructType(ns::Handle { (__bridge void*)[(__bridge MTLArgument*)m_ptr bufferStructType] }); - } - - uint32_t Argument::GetThreadgroupMemoryAlignment() const - { - Validate(); - return uint32_t([(__bridge MTLArgument*)m_ptr threadgroupMemoryAlignment]); - } - - uint32_t Argument::GetThreadgroupMemoryDataSize() const - { - Validate(); - return uint32_t([(__bridge MTLArgument*)m_ptr threadgroupMemoryDataSize]); - } - - TextureType Argument::GetTextureType() const - { - Validate(); - return TextureType([(__bridge MTLArgument*)m_ptr textureType]); - } - - DataType Argument::GetTextureDataType() const - { - Validate(); - return DataType([(__bridge MTLArgument*)m_ptr textureDataType]); - } - - bool Argument::IsDepthTexture() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLArgument*)m_ptr isDepthTexture]; -#else - return false; -#endif - } -} - -////////////////////////////////////// -// FILE: blit_command_encoder.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "blit_command_encoder.hpp" -#include - -namespace mtlpp -{ - void BlitCommandEncoder::Synchronize(const Resource& resource) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge id)m_ptr - synchronizeResource:(__bridge id)resource.GetPtr()]; -#endif - } - - void BlitCommandEncoder::Synchronize(const Texture& texture, uint32_t slice, uint32_t level) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge id)m_ptr - synchronizeTexture:(__bridge id)texture.GetPtr() - slice:slice - level:level]; -#endif - } - - void BlitCommandEncoder::Copy(const Texture& sourceTexture, uint32_t sourceSlice, uint32_t sourceLevel, const Origin& sourceOrigin, const Size& sourceSize, const Texture& destinationTexture, uint32_t destinationSlice, uint32_t destinationLevel, const Origin& destinationOrigin) - { - Validate(); - [(__bridge id)m_ptr - copyFromTexture:(__bridge id)sourceTexture.GetPtr() - sourceSlice:sourceSlice - sourceLevel:sourceLevel - sourceOrigin:MTLOriginMake(sourceOrigin.X, sourceOrigin.Y, sourceOrigin.Z) - sourceSize:MTLSizeMake(sourceSize.Width, sourceSize.Height, sourceSize.Depth) - toTexture:(__bridge id)destinationTexture.GetPtr() - destinationSlice:destinationSlice - destinationLevel:destinationLevel - destinationOrigin:MTLOriginMake(destinationOrigin.X, destinationOrigin.Y, destinationOrigin.Z)]; - } - - void BlitCommandEncoder::Copy(const Buffer& sourceBuffer, uint32_t sourceOffset, uint32_t sourceBytesPerRow, uint32_t sourceBytesPerImage, const Size& sourceSize, const Texture& destinationTexture, uint32_t destinationSlice, uint32_t destinationLevel, const Origin& destinationOrigin) - { - Validate(); - [(__bridge id)m_ptr - copyFromBuffer:(__bridge id)sourceBuffer.GetPtr() - sourceOffset:sourceOffset - sourceBytesPerRow:sourceBytesPerRow - sourceBytesPerImage:sourceBytesPerImage - sourceSize:MTLSizeMake(sourceSize.Width, sourceSize.Height, sourceSize.Depth) - toTexture:(__bridge id)destinationTexture.GetPtr() - destinationSlice:destinationSlice - destinationLevel:destinationLevel - destinationOrigin:MTLOriginMake(destinationOrigin.X, destinationOrigin.Y, destinationOrigin.Z)]; - } - - void BlitCommandEncoder::Copy(const Buffer& sourceBuffer, uint32_t sourceOffset, uint32_t sourceBytesPerRow, uint32_t sourceBytesPerImage, const Size& sourceSize, const Texture& destinationTexture, uint32_t destinationSlice, uint32_t destinationLevel, const Origin& destinationOrigin, BlitOption options) - { - Validate(); - [(__bridge id)m_ptr - copyFromBuffer:(__bridge id)sourceBuffer.GetPtr() - sourceOffset:sourceOffset - sourceBytesPerRow:sourceBytesPerRow - sourceBytesPerImage:sourceBytesPerImage - sourceSize:MTLSizeMake(sourceSize.Width, sourceSize.Height, sourceSize.Depth) - toTexture:(__bridge id)destinationTexture.GetPtr() - destinationSlice:destinationSlice - destinationLevel:destinationLevel - destinationOrigin:MTLOriginMake(destinationOrigin.X, destinationOrigin.Y, destinationOrigin.Z) - options:MTLBlitOption(options)]; - } - - void BlitCommandEncoder::Copy(const Texture& sourceTexture, uint32_t sourceSlice, uint32_t sourceLevel, const Origin& sourceOrigin, const Size& sourceSize, const Buffer& destinationBuffer, uint32_t destinationOffset, uint32_t destinationBytesPerRow, uint32_t destinationBytesPerImage) - { - Validate(); - [(__bridge id)m_ptr - copyFromTexture:(__bridge id)sourceTexture.GetPtr() - sourceSlice:sourceSlice - sourceLevel:sourceLevel - sourceOrigin:MTLOriginMake(sourceOrigin.X, sourceOrigin.Y, sourceOrigin.Z) - sourceSize:MTLSizeMake(sourceSize.Width, sourceSize.Height, sourceSize.Depth) - toBuffer:(__bridge id)destinationBuffer.GetPtr() - destinationOffset:destinationOffset - destinationBytesPerRow:destinationBytesPerRow - destinationBytesPerImage:destinationBytesPerImage]; - } - - void BlitCommandEncoder::Copy(const Texture& sourceTexture, uint32_t sourceSlice, uint32_t sourceLevel, const Origin& sourceOrigin, const Size& sourceSize, const Buffer& destinationBuffer, uint32_t destinationOffset, uint32_t destinationBytesPerRow, uint32_t destinationBytesPerImage, BlitOption options) - { - Validate(); - [(__bridge id)m_ptr - copyFromTexture:(__bridge id)sourceTexture.GetPtr() - sourceSlice:sourceSlice - sourceLevel:sourceLevel - sourceOrigin:MTLOriginMake(sourceOrigin.X, sourceOrigin.Y, sourceOrigin.Z) - sourceSize:MTLSizeMake(sourceSize.Width, sourceSize.Height, sourceSize.Depth) - toBuffer:(__bridge id)destinationBuffer.GetPtr() - destinationOffset:destinationOffset - destinationBytesPerRow:destinationBytesPerRow - destinationBytesPerImage:destinationBytesPerImage - options:MTLBlitOption(options)]; - } - - void BlitCommandEncoder::Copy(const Buffer& sourceBuffer, uint32_t sourceOffset, const Buffer& destinationBuffer, uint32_t destinationOffset, uint32_t size) - { - Validate(); - [(__bridge id)m_ptr - copyFromBuffer:(__bridge id)sourceBuffer.GetPtr() - sourceOffset:sourceOffset - toBuffer:(__bridge id)destinationBuffer.GetPtr() - destinationOffset:destinationOffset - size:size]; - } - - void BlitCommandEncoder::GenerateMipmaps(const Texture& texture) - { - Validate(); - [(__bridge id)m_ptr - generateMipmapsForTexture:(__bridge id)texture.GetPtr()]; - } - - void BlitCommandEncoder::Fill(const Buffer& buffer, const ns::Range& range, uint8_t value) - { - Validate(); - [(__bridge id)m_ptr - fillBuffer:(__bridge id)buffer.GetPtr() - range:NSMakeRange(range.Location, range.Length) - value:value]; - } - - void BlitCommandEncoder::UpdateFence(const Fence& fence) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr - updateFence:(__bridge id)fence.GetPtr()]; -#endif - } - - void BlitCommandEncoder::WaitForFence(const Fence& fence) - { -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr - waitForFence:(__bridge id)fence.GetPtr()]; -#endif - } -} - -////////////////////////////////////// -// FILE: buffer.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "buffer.hpp" -// #include "texture.hpp" -#include - -namespace mtlpp -{ - uint32_t Buffer::GetLength() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr length]); - } - - void* Buffer::GetContents() - { - Validate(); - return [(__bridge id)m_ptr contents]; - } - - void Buffer::DidModify(const ns::Range& range) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge id)m_ptr didModifyRange:NSMakeRange(range.Location, range.Length)]; -#endif - } - - Texture Buffer::NewTexture(const TextureDescriptor& descriptor, uint32_t offset, uint32_t bytesPerRow) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(8_0) - MTLTextureDescriptor* mtlTextureDescriptor = (__bridge MTLTextureDescriptor*)descriptor.GetPtr(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newTextureWithDescriptor:mtlTextureDescriptor offset:offset bytesPerRow:bytesPerRow] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - void Buffer::AddDebugMarker(const ns::String& marker, const ns::Range& range) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr addDebugMarker:(__bridge NSString*)marker.GetPtr() range:NSMakeRange(range.Location, range.Length)]; -#endif - } - - void Buffer::RemoveAllDebugMarkers() - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr removeAllDebugMarkers]; -#endif - } -} - -////////////////////////////////////// -// FILE: command_buffer.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "command_buffer.hpp" -// #include "command_queue.hpp" -// #include "drawable.hpp" -// #include "blit_command_encoder.hpp" -// #include "render_command_encoder.hpp" -// #include "compute_command_encoder.hpp" -// #include "parallel_render_command_encoder.hpp" -// #include "render_pass.hpp" - -#include - -namespace mtlpp -{ - Device CommandBuffer::GetDevice() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr device] }; - } - - CommandQueue CommandBuffer::GetCommandQueue() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr commandQueue] }; - } - - bool CommandBuffer::GetRetainedReferences() const - { - Validate(); - return [(__bridge id)m_ptr retainedReferences]; - } - - ns::String CommandBuffer::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - CommandBufferStatus CommandBuffer::GetStatus() const - { - Validate(); - return CommandBufferStatus([(__bridge id)m_ptr status]); - } - - ns::Error CommandBuffer::GetError() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr error] }; - } - - void CommandBuffer::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - void CommandBuffer::Enqueue() - { - Validate(); - [(__bridge id)m_ptr enqueue]; - } - - void CommandBuffer::Commit() - { - Validate(); - [(__bridge id)m_ptr commit]; - } - - void CommandBuffer::AddScheduledHandler(std::function handler) - { - Validate(); - [(__bridge id)m_ptr addScheduledHandler:^(id mtlCommandBuffer){ - CommandBuffer commandBuffer(ns::Handle{ (__bridge void*)mtlCommandBuffer }); - handler(commandBuffer); - }]; - } - - void CommandBuffer::AddCompletedHandler(std::function handler) - { - Validate(); - [(__bridge id)m_ptr addCompletedHandler:^(id mtlCommandBuffer){ - CommandBuffer commandBuffer(ns::Handle{ (__bridge void*)mtlCommandBuffer }); - handler(commandBuffer); - }]; - } - - void CommandBuffer::Present(const Drawable& drawable) - { - Validate(); - [(__bridge id)m_ptr presentDrawable:(__bridge id)drawable.GetPtr()]; - } - - void CommandBuffer::Present(const Drawable& drawable, double presentationTime) - { - Validate(); - [(__bridge id)m_ptr presentDrawable:(__bridge id)drawable.GetPtr() atTime:presentationTime]; - } - - void CommandBuffer::WaitUntilScheduled() - { - Validate(); - [(__bridge id)m_ptr waitUntilScheduled]; - } - - void CommandBuffer::WaitUntilCompleted() - { - Validate(); - [(__bridge id)m_ptr waitUntilCompleted]; - } - - BlitCommandEncoder CommandBuffer::BlitCommandEncoder() - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr blitCommandEncoder] }; - } - - RenderCommandEncoder CommandBuffer::RenderCommandEncoder(const RenderPassDescriptor& renderPassDescriptor) - { - Validate(); - MTLRenderPassDescriptor* mtlRenderPassDescriptor = (__bridge MTLRenderPassDescriptor*)renderPassDescriptor.GetPtr(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr renderCommandEncoderWithDescriptor:mtlRenderPassDescriptor] }; - } - - ComputeCommandEncoder CommandBuffer::ComputeCommandEncoder() - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr computeCommandEncoder] }; - } - - ParallelRenderCommandEncoder CommandBuffer::ParallelRenderCommandEncoder(const RenderPassDescriptor& renderPassDescriptor) - { - Validate(); - MTLRenderPassDescriptor* mtlRenderPassDescriptor = (__bridge MTLRenderPassDescriptor*)renderPassDescriptor.GetPtr(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr parallelRenderCommandEncoderWithDescriptor:mtlRenderPassDescriptor] }; - } -} - -////////////////////////////////////// -// FILE: command_encoder.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "command_encoder.hpp" -// #include "device.hpp" -#include - -namespace mtlpp -{ - Device CommandEncoder::GetDevice() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr device] }; - } - - ns::String CommandEncoder::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - void CommandEncoder::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - void CommandEncoder::EndEncoding() - { - Validate(); - [(__bridge id)m_ptr endEncoding]; - } - - void CommandEncoder::InsertDebugSignpost(const ns::String& string) - { - Validate(); - [(__bridge id)m_ptr insertDebugSignpost:(__bridge NSString*)string.GetPtr()]; - } - - void CommandEncoder::PushDebugGroup(const ns::String& string) - { - Validate(); - [(__bridge id)m_ptr pushDebugGroup:(__bridge NSString*)string.GetPtr()]; - } - - void CommandEncoder::PopDebugGroup() - { - Validate(); - [(__bridge id)m_ptr popDebugGroup]; - } -} - -////////////////////////////////////// -// FILE: command_queue.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "command_queue.hpp" -// #include "command_buffer.hpp" -// #include "device.hpp" -#include - -namespace mtlpp -{ - ns::String CommandQueue::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - Device CommandQueue::GetDevice() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr device] }; - } - - void CommandQueue::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - CommandBuffer CommandQueue::CommandBufferWithUnretainedReferences() - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr commandBufferWithUnretainedReferences] }; - } - - CommandBuffer CommandQueue::CommandBuffer() - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr commandBuffer] }; - } - - void CommandQueue::InsertDebugCaptureBoundary() - { - Validate(); - [(__bridge id)m_ptr insertDebugCaptureBoundary]; - } -} - -////////////////////////////////////// -// FILE: compute_command_encoder.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "compute_command_encoder.hpp" -// #include "buffer.hpp" -// #include "compute_pipeline.hpp" -// #include "sampler.hpp" -#include - -namespace mtlpp -{ - void ComputeCommandEncoder::SetComputePipelineState(const ComputePipelineState& state) - { - Validate(); - [(__bridge id)m_ptr setComputePipelineState:(__bridge id)state.GetPtr()]; - } - - void ComputeCommandEncoder::SetBytes(const void* data, uint32_t length, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setBytes:data length:length atIndex:index]; - } - - void ComputeCommandEncoder::SetBuffer(const Buffer& buffer, uint32_t offset, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setBuffer:(__bridge id)buffer.GetPtr() offset:offset atIndex:index]; - } - - void ComputeCommandEncoder::SetBufferOffset(uint32_t offset, uint32_t index) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 8_3) - [(__bridge id)m_ptr setBufferOffset:offset atIndex:index]; -#endif - } - - void ComputeCommandEncoder::SetBuffers(const Buffer* buffers, const uint32_t* offsets, const ns::Range& range) - { - Validate(); - - const uint32_t maxBuffers = 32; - assert(range.Length <= maxBuffers); - - id mtlBuffers[maxBuffers]; - NSUInteger nsOffsets[maxBuffers]; - for (uint32_t i=0; i)buffers[i].GetPtr(); - nsOffsets[i] = offsets[i]; - } - - [(__bridge id)m_ptr setBuffers:mtlBuffers - offsets:nsOffsets - withRange:NSMakeRange(range.Location, range.Length)]; - } - - void ComputeCommandEncoder::SetTexture(const Texture& texture, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setTexture:(__bridge id)texture.GetPtr() atIndex:index]; - } - - void ComputeCommandEncoder::SetTextures(const Texture* textures, const ns::Range& range) - { - Validate(); - - const uint32_t maxTextures = 32; - assert(range.Length <= maxTextures); - - id mtlTextures[maxTextures]; - for (uint32_t i=0; i)textures[i].GetPtr(); - - [(__bridge id)m_ptr setTextures:mtlTextures - withRange:NSMakeRange(range.Location, range.Length)]; - } - - void ComputeCommandEncoder::SetSamplerState(const SamplerState& sampler, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setSamplerState:(__bridge id)sampler.GetPtr() atIndex:index]; - } - - void ComputeCommandEncoder::SetSamplerStates(const SamplerState* samplers, const ns::Range& range) - { - Validate(); - - const uint32_t maxStates = 32; - assert(range.Length <= maxStates); - - id mtlStates[maxStates]; - for (uint32_t i=0; i)samplers[i].GetPtr(); - - [(__bridge id)m_ptr setSamplerStates:mtlStates - withRange:NSMakeRange(range.Location, range.Length)]; - } - - void ComputeCommandEncoder::SetSamplerState(const SamplerState& sampler, float lodMinClamp, float lodMaxClamp, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setSamplerState:(__bridge id)sampler.GetPtr() - lodMinClamp:lodMinClamp - lodMaxClamp:lodMaxClamp - atIndex:index]; - } - - void ComputeCommandEncoder::SetSamplerStates(const SamplerState* samplers, const float* lodMinClamps, const float* lodMaxClamps, const ns::Range& range) - { - Validate(); - - const uint32_t maxStates = 32; - assert(range.Length <= maxStates); - - id mtlStates[maxStates]; - for (uint32_t i=0; i)samplers[i].GetPtr(); - - [(__bridge id)m_ptr setSamplerStates:mtlStates - lodMinClamps:lodMinClamps - lodMaxClamps:lodMaxClamps - withRange:NSMakeRange(range.Location, range.Length)]; - } - - void ComputeCommandEncoder::SetThreadgroupMemory(uint32_t length, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setThreadgroupMemoryLength:length atIndex:index]; - } - - void ComputeCommandEncoder::SetStageInRegion(const Region& region) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setStageInRegion:MTLRegionMake3D(region.Origin.X, region.Origin.Y, region.Origin.Z, region.Size.Width, region.Size.Height, region.Size.Depth)]; -#endif - } - - void ComputeCommandEncoder::DispatchThreadgroups(const Size& threadgroupsPerGrid, const Size& threadsPerThreadgroup) - { - Validate(); - MTLSize mtlThreadgroupsPerGrid = MTLSizeMake(threadgroupsPerGrid.Width, threadgroupsPerGrid.Height, threadgroupsPerGrid.Depth); - MTLSize mtlThreadsPerThreadgroup = MTLSizeMake(threadsPerThreadgroup.Width, threadsPerThreadgroup.Height, threadsPerThreadgroup.Depth); - [(__bridge id)m_ptr dispatchThreadgroups:mtlThreadgroupsPerGrid threadsPerThreadgroup:mtlThreadsPerThreadgroup]; - } - - void ComputeCommandEncoder::DispatchThreadgroupsWithIndirectBuffer(const Buffer& indirectBuffer, uint32_t indirectBufferOffset, const Size& threadsPerThreadgroup) - { - Validate(); - MTLSize mtlThreadsPerThreadgroup = MTLSizeMake(threadsPerThreadgroup.Width, threadsPerThreadgroup.Height, threadsPerThreadgroup.Depth); - [(__bridge id)m_ptr dispatchThreadgroupsWithIndirectBuffer:(__bridge id)indirectBuffer.GetPtr() - indirectBufferOffset:indirectBufferOffset - threadsPerThreadgroup:mtlThreadsPerThreadgroup]; - } - - void ComputeCommandEncoder::UpdateFence(const Fence& fence) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr updateFence:(__bridge id)fence.GetPtr()]; -#endif - } - - void ComputeCommandEncoder::WaitForFence(const Fence& fence) - { -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr waitForFence:(__bridge id)fence.GetPtr()]; -#endif - } -} - -////////////////////////////////////// -// FILE: compute_pipeline.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "compute_pipeline.hpp" -#include - -namespace mtlpp -{ - ComputePipelineReflection::ComputePipelineReflection() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLComputePipelineReflection alloc] init] }) - { - } - - ComputePipelineDescriptor::ComputePipelineDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLComputePipelineDescriptor alloc] init] }) - { - } - - ns::String ComputePipelineDescriptor::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLComputePipelineDescriptor*)m_ptr label] }; - } - - Function ComputePipelineDescriptor::GetComputeFunction() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge MTLComputePipelineDescriptor*)m_ptr computeFunction] }; - } - - bool ComputePipelineDescriptor::GetThreadGroupSizeIsMultipleOfThreadExecutionWidth() const - { - Validate(); - return [(__bridge MTLComputePipelineDescriptor*)m_ptr threadGroupSizeIsMultipleOfThreadExecutionWidth]; - } - - StageInputOutputDescriptor ComputePipelineDescriptor::GetStageInputDescriptor() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle { (__bridge void*)[(__bridge MTLComputePipelineDescriptor*)m_ptr stageInputDescriptor] }; -#else - return ns::Handle { nullptr }; -#endif - } - - void ComputePipelineDescriptor::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge MTLComputePipelineDescriptor*)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - void ComputePipelineDescriptor::SetComputeFunction(const Function& function) - { - Validate(); - [(__bridge MTLComputePipelineDescriptor*)m_ptr setComputeFunction:(__bridge id)function.GetPtr()]; - } - - void ComputePipelineDescriptor::SetThreadGroupSizeIsMultipleOfThreadExecutionWidth(bool value) - { - Validate(); - [(__bridge MTLComputePipelineDescriptor*)m_ptr setThreadGroupSizeIsMultipleOfThreadExecutionWidth:value]; - } - - void ComputePipelineDescriptor::SetStageInputDescriptor(const StageInputOutputDescriptor& stageInputDescriptor) const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLComputePipelineDescriptor*)m_ptr setStageInputDescriptor:(__bridge MTLStageInputOutputDescriptor*)stageInputDescriptor.GetPtr()]; -#endif - } - - Device ComputePipelineState::GetDevice() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr device] }; - } - - uint32_t ComputePipelineState::GetMaxTotalThreadsPerThreadgroup() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr maxTotalThreadsPerThreadgroup]); - } - - uint32_t ComputePipelineState::GetThreadExecutionWidth() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr threadExecutionWidth]); - } -} - -////////////////////////////////////// -// FILE: depth_stencil.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "depth_stencil.hpp" -#include - -namespace mtlpp -{ - StencilDescriptor::StencilDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLStencilDescriptor alloc] init] }) - { - } - - CompareFunction StencilDescriptor::GetStencilCompareFunction() const - { - Validate(); - return CompareFunction([(__bridge MTLStencilDescriptor*)m_ptr stencilCompareFunction]); - } - - StencilOperation StencilDescriptor::GetStencilFailureOperation() const - { - Validate(); - return StencilOperation([(__bridge MTLStencilDescriptor*)m_ptr stencilFailureOperation]); - } - - StencilOperation StencilDescriptor::GetDepthFailureOperation() const - { - Validate(); - return StencilOperation([(__bridge MTLStencilDescriptor*)m_ptr depthFailureOperation]); - } - - StencilOperation StencilDescriptor::GetDepthStencilPassOperation() const - { - Validate(); - return StencilOperation([(__bridge MTLStencilDescriptor*)m_ptr depthStencilPassOperation]); - } - - uint32_t StencilDescriptor::GetReadMask() const - { - Validate(); - return uint32_t([(__bridge MTLStencilDescriptor*)m_ptr readMask]); - } - - uint32_t StencilDescriptor::GetWriteMask() const - { - Validate(); - return uint32_t([(__bridge MTLStencilDescriptor*)m_ptr writeMask]); - } - - void StencilDescriptor::SetStencilCompareFunction(CompareFunction stencilCompareFunction) - { - Validate(); - [(__bridge MTLStencilDescriptor*)m_ptr setStencilCompareFunction:MTLCompareFunction(stencilCompareFunction)]; - } - - void StencilDescriptor::SetStencilFailureOperation(StencilOperation stencilFailureOperation) - { - Validate(); - [(__bridge MTLStencilDescriptor*)m_ptr setStencilFailureOperation:MTLStencilOperation(stencilFailureOperation)]; - } - - void StencilDescriptor::SetDepthFailureOperation(StencilOperation depthFailureOperation) - { - Validate(); - [(__bridge MTLStencilDescriptor*)m_ptr setDepthFailureOperation:MTLStencilOperation(depthFailureOperation)]; - } - - void StencilDescriptor::SetDepthStencilPassOperation(StencilOperation depthStencilPassOperation) - { - Validate(); - [(__bridge MTLStencilDescriptor*)m_ptr setDepthStencilPassOperation:MTLStencilOperation(depthStencilPassOperation)]; - } - - void StencilDescriptor::SetReadMask(uint32_t readMask) - { - Validate(); - [(__bridge MTLStencilDescriptor*)m_ptr setReadMask:readMask]; - } - - void StencilDescriptor::SetWriteMask(uint32_t writeMask) - { - Validate(); - [(__bridge MTLStencilDescriptor*)m_ptr setWriteMask:writeMask]; - } - - DepthStencilDescriptor::DepthStencilDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLDepthStencilDescriptor alloc] init] }) - { - } - - CompareFunction DepthStencilDescriptor::GetDepthCompareFunction() const - { - Validate(); - return CompareFunction([(__bridge MTLDepthStencilDescriptor*)m_ptr depthCompareFunction]); - } - - bool DepthStencilDescriptor::IsDepthWriteEnabled() const - { - Validate(); - return [(__bridge MTLDepthStencilDescriptor*)m_ptr isDepthWriteEnabled]; - } - - StencilDescriptor DepthStencilDescriptor::GetFrontFaceStencil() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLDepthStencilDescriptor*)m_ptr frontFaceStencil] }; - } - - StencilDescriptor DepthStencilDescriptor::GetBackFaceStencil() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLDepthStencilDescriptor*)m_ptr backFaceStencil] }; - } - - ns::String DepthStencilDescriptor::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLDepthStencilDescriptor*)m_ptr label] }; - } - - void DepthStencilDescriptor::SetDepthCompareFunction(CompareFunction depthCompareFunction) const - { - Validate(); - [(__bridge MTLDepthStencilDescriptor*)m_ptr setDepthCompareFunction:MTLCompareFunction(depthCompareFunction)]; - } - - void DepthStencilDescriptor::SetDepthWriteEnabled(bool depthWriteEnabled) const - { - Validate(); - [(__bridge MTLDepthStencilDescriptor*)m_ptr setDepthWriteEnabled:depthWriteEnabled]; - } - - void DepthStencilDescriptor::SetFrontFaceStencil(const StencilDescriptor& frontFaceStencil) const - { - Validate(); - [(__bridge MTLDepthStencilDescriptor*)m_ptr setFrontFaceStencil:(__bridge MTLStencilDescriptor*)frontFaceStencil.GetPtr()]; - } - - void DepthStencilDescriptor::SetBackFaceStencil(const StencilDescriptor& backFaceStencil) const - { - Validate(); - [(__bridge MTLDepthStencilDescriptor*)m_ptr setBackFaceStencil:(__bridge MTLStencilDescriptor*)backFaceStencil.GetPtr()]; - } - - void DepthStencilDescriptor::SetLabel(const ns::String& label) const - { - Validate(); - [(__bridge MTLDepthStencilDescriptor*)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - ns::String DepthStencilState::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - Device DepthStencilState::GetDevice() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr device] }; - } -} - -////////////////////////////////////// -// FILE: device.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "device.hpp" -// #include "buffer.hpp" -// #include "command_queue.hpp" -// #include "compute_pipeline.hpp" -// #include "depth_stencil.hpp" -// #include "render_pipeline.hpp" -// #include "sampler.hpp" -// #include "texture.hpp" -// #include "heap.hpp" -#include - -namespace mtlpp -{ - CompileOptions::CompileOptions() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLCompileOptions alloc] init] }) - { - } - - Device Device::CreateSystemDefaultDevice() - { - return ns::Handle{ (__bridge void*)MTLCreateSystemDefaultDevice() }; - } - - ns::Array Device::CopyAllDevices() - { -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return ns::Handle{ (__bridge void*)MTLCopyAllDevices() }; -#else - return ns::Handle{ nullptr }; -#endif - } - - ns::String Device::GetName() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr name] }; - } - - Size Device::GetMaxThreadsPerThreadgroup() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - MTLSize mtlSize = [(__bridge id)m_ptr maxThreadsPerThreadgroup]; - return Size(uint32_t(mtlSize.width), uint32_t(mtlSize.height), uint32_t(mtlSize.depth)); -#else - return Size(0, 0, 0); -#endif - } - - bool Device::IsLowPower() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return [(__bridge id)m_ptr isLowPower]; -#else - return false; -#endif - } - - bool Device::IsHeadless() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return [(__bridge id)m_ptr isHeadless]; -#else - return false; -#endif - } - - uint64_t Device::GetRecommendedMaxWorkingSetSize() const - { -#if MTLPP_IS_AVAILABLE_MAC(10_12) - return [(__bridge id)m_ptr recommendedMaxWorkingSetSize]; -#else - return 0; -#endif - } - - bool Device::IsDepth24Stencil8PixelFormatSupported() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return [(__bridge id)m_ptr isDepth24Stencil8PixelFormatSupported]; -#else - return true; -#endif - } - - CommandQueue Device::NewCommandQueue() - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newCommandQueue] }; - } - - CommandQueue Device::NewCommandQueue(uint32_t maxCommandBufferCount) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newCommandQueueWithMaxCommandBufferCount:maxCommandBufferCount] }; - } - - SizeAndAlign Device::HeapTextureSizeAndAlign(const TextureDescriptor& desc) - { -#if MTLPP_IS_AVAILABLE_IOS(10_0) - MTLSizeAndAlign mtlSizeAndAlign = [(__bridge id)m_ptr heapTextureSizeAndAlignWithDescriptor:(__bridge MTLTextureDescriptor*)desc.GetPtr()]; - return SizeAndAlign{ uint32_t(mtlSizeAndAlign.size), uint32_t(mtlSizeAndAlign.align) }; -#else - return SizeAndAlign{0, 0}; -#endif - } - - SizeAndAlign Device::HeapBufferSizeAndAlign(uint32_t length, ResourceOptions options) - { -#if MTLPP_IS_AVAILABLE_IOS(10_0) - MTLSizeAndAlign mtlSizeAndAlign = [(__bridge id)m_ptr heapBufferSizeAndAlignWithLength:length options:MTLResourceOptions(options)]; - return SizeAndAlign{ uint32_t(mtlSizeAndAlign.size), uint32_t(mtlSizeAndAlign.align) }; -#else - return SizeAndAlign{0, 0}; -#endif - } - - Heap Device::NewHeap(const HeapDescriptor& descriptor) - { -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newHeapWithDescriptor:(__bridge MTLHeapDescriptor*)descriptor.GetPtr()] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - Buffer Device::NewBuffer(uint32_t length, ResourceOptions options) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newBufferWithLength:length options:MTLResourceOptions(options)] }; - } - - Buffer Device::NewBuffer(const void* pointer, uint32_t length, ResourceOptions options) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newBufferWithBytes:pointer length:length options:MTLResourceOptions(options)] }; - } - - - Buffer Device::NewBuffer(void* pointer, uint32_t length, ResourceOptions options, std::function deallocator) - { - Validate(); - return ns::Handle{ - (__bridge void*)[(__bridge id)m_ptr newBufferWithBytesNoCopy:pointer - length:length - options:MTLResourceOptions(options) - deallocator:^(void* pointer, NSUInteger length) { deallocator(pointer, uint32_t(length)); }] - }; - } - - DepthStencilState Device::NewDepthStencilState(const DepthStencilDescriptor& descriptor) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newDepthStencilStateWithDescriptor:(__bridge MTLDepthStencilDescriptor*)descriptor.GetPtr()] }; - } - - Texture Device::NewTexture(const TextureDescriptor& descriptor) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newTextureWithDescriptor:(__bridge MTLTextureDescriptor*)descriptor.GetPtr()] }; - } - - //- (id )newTextureWithDescriptor:(MTLTextureDescriptor *)descriptor iosurface:(IOSurfaceRef)iosurface plane:(NSUInteger)plane NS_AVAILABLE_MAC(10_11); - SamplerState Device::NewSamplerState(const SamplerDescriptor& descriptor) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newSamplerStateWithDescriptor:(__bridge MTLSamplerDescriptor*)descriptor.GetPtr()] }; - } - - Library Device::NewDefaultLibrary() - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newDefaultLibrary] }; - } - - Library Device::NewLibrary(const ns::String& filepath, ns::Error* error) - { - Validate(); - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newLibraryWithFile:(__bridge NSString*)filepath.GetPtr() error:&nsError] }; - } - - Library Device::NewLibrary(const char* source, const CompileOptions& options, ns::Error* error) - { - Validate(); - NSString* nsSource = [NSString stringWithUTF8String:source]; - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - return ns::Handle{ - (__bridge void*)[(__bridge id)m_ptr newLibraryWithSource:nsSource - options:(__bridge MTLCompileOptions*)options.GetPtr() - error:&nsError] - }; - } - - void Device::NewLibrary(const char* source, const CompileOptions& options, std::function completionHandler) - { - Validate(); - NSString* nsSource = [NSString stringWithUTF8String:source]; - [(__bridge id)m_ptr newLibraryWithSource:nsSource - options:(__bridge MTLCompileOptions*)options.GetPtr() - completionHandler:^(id library, NSError * error) { - completionHandler( - ns::Handle{ (__bridge void*)library }, - ns::Handle{ (__bridge void*)error }); - }]; - } - - RenderPipelineState Device::NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, ns::Error* error) - { - Validate(); - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - return ns::Handle{ - (__bridge void*)[(__bridge id)m_ptr newRenderPipelineStateWithDescriptor:(__bridge MTLRenderPipelineDescriptor*)descriptor.GetPtr() - error:&nsError] - }; - } - - RenderPipelineState Device::NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, PipelineOption options, RenderPipelineReflection* outReflection, ns::Error* error) - { - Validate(); - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - MTLRenderPipelineReflection* mtlReflection = outReflection ? (__bridge MTLRenderPipelineReflection*)outReflection->GetPtr() : nullptr; - return ns::Handle{ - (__bridge void*)[(__bridge id)m_ptr newRenderPipelineStateWithDescriptor:(__bridge MTLRenderPipelineDescriptor*)descriptor.GetPtr() - options:MTLPipelineOption(options) - reflection:&mtlReflection - error:&nsError] - }; - } - - void Device::NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, std::function completionHandler) - { - Validate(); - [(__bridge id)m_ptr newRenderPipelineStateWithDescriptor:(__bridge MTLRenderPipelineDescriptor*)descriptor.GetPtr() - completionHandler:^(id renderPipelineState, NSError * error) { - completionHandler( - ns::Handle{ (__bridge void*)renderPipelineState }, - ns::Handle{ (__bridge void*)error } - ); - }]; - } - - void Device::NewRenderPipelineState(const RenderPipelineDescriptor& descriptor, PipelineOption options, std::function completionHandler) - { - Validate(); - [(__bridge id)m_ptr newRenderPipelineStateWithDescriptor:(__bridge MTLRenderPipelineDescriptor*)descriptor.GetPtr() - options:MTLPipelineOption(options) - completionHandler:^(id renderPipelineState, MTLRenderPipelineReflection * reflection, NSError * error) { - completionHandler( - ns::Handle{ (__bridge void*)renderPipelineState }, - ns::Handle{ (__bridge void*)reflection }, - ns::Handle{ (__bridge void*)error } - ); - }]; - } - - ComputePipelineState Device::NewComputePipelineState(const Function& computeFunction, ns::Error* error) - { - Validate(); - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - return ns::Handle{ - (__bridge void*)[(__bridge id)m_ptr newComputePipelineStateWithFunction:(__bridge id)computeFunction.GetPtr() - error:&nsError] - }; - } - - ComputePipelineState Device::NewComputePipelineState(const Function& computeFunction, PipelineOption options, ComputePipelineReflection& outReflection, ns::Error* error) - { - Validate(); - return ns::Handle{ nullptr }; - } - - void Device::NewComputePipelineState(const Function& computeFunction, std::function completionHandler) - { - Validate(); - [(__bridge id)m_ptr newComputePipelineStateWithFunction:(__bridge id)computeFunction.GetPtr() - completionHandler:^(id computePipelineState, NSError * error) { - completionHandler( - ns::Handle{ (__bridge void*)computePipelineState }, - ns::Handle{ (__bridge void*)error } - ); - }]; - } - - void Device::NewComputePipelineState(const Function& computeFunction, PipelineOption options, std::function completionHandler) - { - Validate(); - [(__bridge id)m_ptr newComputePipelineStateWithFunction:(__bridge id)computeFunction.GetPtr() - options:MTLPipelineOption(options) - completionHandler:^(id computePipelineState, MTLComputePipelineReflection * reflection, NSError * error) { - completionHandler( - ns::Handle{ (__bridge void*)computePipelineState }, - ns::Handle{ (__bridge void*)reflection }, - ns::Handle{ (__bridge void*)error } - ); - }]; - } - - ComputePipelineState Device::NewComputePipelineState(const ComputePipelineDescriptor& descriptor, PipelineOption options, ComputePipelineReflection* outReflection, ns::Error* error) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - MTLComputePipelineReflection* mtlReflection = outReflection ? (__bridge MTLComputePipelineReflection*)outReflection->GetPtr() : nullptr; - return ns::Handle{ - (__bridge void*)[(__bridge id)m_ptr newComputePipelineStateWithDescriptor:(__bridge MTLComputePipelineDescriptor*)descriptor.GetPtr() - options:MTLPipelineOption(options) - reflection:&mtlReflection - error:&nsError] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - void Device::NewComputePipelineState(const ComputePipelineDescriptor& descriptor, PipelineOption options, std::function completionHandler) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge id)m_ptr newComputePipelineStateWithDescriptor:(__bridge MTLComputePipelineDescriptor*)descriptor.GetPtr() - options:MTLPipelineOption(options) - completionHandler:^(id computePipelineState, MTLComputePipelineReflection * reflection, NSError * error) - { - completionHandler( - ns::Handle{ (__bridge void*)computePipelineState }, - ns::Handle{ (__bridge void*)reflection }, - ns::Handle{ (__bridge void*)error }); - }]; -#endif - } - - Fence Device::NewFence() - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newFence] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - bool Device::SupportsFeatureSet(FeatureSet featureSet) const - { - Validate(); - return [(__bridge id)m_ptr supportsFeatureSet:MTLFeatureSet(featureSet)]; - } - - bool Device::SupportsTextureSampleCount(uint32_t sampleCount) const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return [(__bridge id)m_ptr supportsTextureSampleCount:sampleCount]; -#else - return true; -#endif - } -} - -////////////////////////////////////// -// FILE: drawable.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "drawable.hpp" -#include - -namespace mtlpp -{ - void Drawable::Present() - { - Validate(); - [(__bridge id)m_ptr present]; - } - - void Drawable::Present(double presentationTime) - { - Validate(); - [(__bridge id)m_ptr presentAtTime:presentationTime]; - } -} - -////////////////////////////////////// -// FILE: fence.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "fence.hpp" -#if MTLPP_IS_AVAILABLE_IOS(10_0) -# include -#endif - -namespace mtlpp -{ - Texture Fence::GetDevice() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr device] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - ns::String Fence::GetLabel() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - void Fence::SetLabel(const ns::String& label) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; -#endif - } -} - -////////////////////////////////////// -// FILE: function_constant_values.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "function_constant_values.hpp" -#if MTLPP_IS_AVAILABLE(10_12, 10_0) -# include -#endif - -namespace mtlpp -{ - FunctionConstantValues::FunctionConstantValues() : -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - ns::Object(ns::Handle{ (__bridge void*)[[MTLFunctionConstantValues alloc] init] }) -#else - ns::Object(ns::Handle{ nullptr }) -#endif - { - } - - void FunctionConstantValues::SetConstantValue(const void* value, DataType type, uint32_t index) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLFunctionConstantValues*)m_ptr setConstantValue:value type:MTLDataType(type) atIndex:index]; -#endif - } - - void FunctionConstantValues::SetConstantValue(const void* value, DataType type, const ns::String& name) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLFunctionConstantValues*)m_ptr setConstantValue:value type:MTLDataType(type) withName:(__bridge NSString*)name.GetPtr()]; -#endif - } - - void FunctionConstantValues::SetConstantValues(const void* value, DataType type, const ns::Range& range) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLFunctionConstantValues*)m_ptr setConstantValues:value type:MTLDataType(type) withRange:NSMakeRange(range.Location, range.Length)]; -#endif - } - - void FunctionConstantValues::Reset() - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLFunctionConstantValues*)m_ptr reset]; -#endif - } -} - -////////////////////////////////////// -// FILE: heap.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "heap.hpp" -#if MTLPP_IS_AVAILABLE_IOS(10_0) -# include -#endif - -namespace mtlpp -{ - uint32_t HeapDescriptor::GetSize() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return uint32_t([(__bridge MTLHeapDescriptor*)m_ptr size]); -#else - return 0; -#endif - - } - - StorageMode HeapDescriptor::GetStorageMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return StorageMode([(__bridge MTLHeapDescriptor*)m_ptr storageMode]); -#else - return StorageMode(0); -#endif - - } - - CpuCacheMode HeapDescriptor::GetCpuCacheMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return CpuCacheMode([(__bridge MTLHeapDescriptor*)m_ptr cpuCacheMode]); -#else - return CpuCacheMode(0); -#endif - - } - - void HeapDescriptor::SetSize(uint32_t size) const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge MTLHeapDescriptor*)m_ptr setSize:size]; -#endif - - } - - void HeapDescriptor::SetStorageMode(StorageMode storageMode) const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge MTLHeapDescriptor*)m_ptr setStorageMode:MTLStorageMode(storageMode)]; -#endif - - } - - void HeapDescriptor::SetCpuCacheMode(CpuCacheMode cpuCacheMode) const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge MTLHeapDescriptor*)m_ptr setCpuCacheMode:MTLCPUCacheMode(cpuCacheMode)]; -#endif - - } - - ns::String Heap::GetLabel() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; -#else - return ns::Handle{ nullptr }; -#endif - - } - - Device Heap::GetDevice() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr device] }; -#else - return ns::Handle{ nullptr }; -#endif - - } - - StorageMode Heap::GetStorageMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return StorageMode([(__bridge id)m_ptr storageMode]); -#else - return StorageMode(0); -#endif - - } - - CpuCacheMode Heap::GetCpuCacheMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return CpuCacheMode([(__bridge id)m_ptr cpuCacheMode]); -#else - return CpuCacheMode(0); -#endif - - } - - uint32_t Heap::GetSize() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return uint32_t([(__bridge id)m_ptr size]); -#else - return 0; -#endif - - } - - uint32_t Heap::GetUsedSize() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return uint32_t([(__bridge id)m_ptr usedSize]); -#else - return 0; -#endif - - } - - void Heap::SetLabel(const ns::String& label) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; -#endif - - } - - uint32_t Heap::MaxAvailableSizeWithAlignment(uint32_t alignment) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return uint32_t([(__bridge id)m_ptr maxAvailableSizeWithAlignment:alignment]); -#else - return 0; -#endif - - } - - Buffer Heap::NewBuffer(uint32_t length, ResourceOptions options) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newBufferWithLength:length options:MTLResourceOptions(options)] }; -#else - return ns::Handle{ nullptr }; -#endif - - } - - Texture Heap::NewTexture(const TextureDescriptor& desc) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newTextureWithDescriptor:(__bridge MTLTextureDescriptor*)desc.GetPtr()] }; -#else - return ns::Handle{ nullptr }; -#endif - - } - - PurgeableState Heap::SetPurgeableState(PurgeableState state) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return PurgeableState([(__bridge id)m_ptr setPurgeableState:MTLPurgeableState(state)]); -#else - return PurgeableState(0); -#endif - - } -} - -////////////////////////////////////// -// FILE: library.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "library.hpp" -// #include "device.hpp" -// #include "function_constant_values.hpp" -#include - -namespace mtlpp -{ - VertexAttribute::VertexAttribute() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLVertexAttribute alloc] init] }) - { - } - - ns::String VertexAttribute::GetName() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLVertexAttribute*)m_ptr name] }; - } - - uint32_t VertexAttribute::GetAttributeIndex() const - { - Validate(); - return uint32_t([(__bridge MTLVertexAttribute*)m_ptr attributeIndex]); - } - - DataType VertexAttribute::GetAttributeType() const - { - Validate(); - return DataType([(__bridge MTLVertexAttribute*)m_ptr attributeType]); - } - - bool VertexAttribute::IsActive() const - { - Validate(); - return [(__bridge MTLVertexAttribute*)m_ptr isActive]; - } - - bool VertexAttribute::IsPatchData() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLVertexAttribute*)m_ptr isActive]; -#else - return false; -#endif - } - - bool VertexAttribute::IsPatchControlPointData() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLVertexAttribute*)m_ptr isActive]; -#else - return false; -#endif - } - - Attribute::Attribute() : -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - ns::Object(ns::Handle{ (__bridge void*)[[MTLAttribute alloc] init] }) -#else - ns::Object(ns::Handle{ nullptr }) -#endif - { - } - - ns::String Attribute::GetName() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge MTLAttribute*)m_ptr name] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - uint32_t Attribute::GetAttributeIndex() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLAttribute*)m_ptr attributeIndex]); -#else - return 0; -#endif - } - - DataType Attribute::GetAttributeType() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return DataType([(__bridge MTLAttribute*)m_ptr attributeType]); -#else - return DataType(0); -#endif - } - - bool Attribute::IsActive() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLAttribute*)m_ptr isActive]; -#else - return false; -#endif - } - - bool Attribute::IsPatchData() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLAttribute*)m_ptr isActive]; -#else - return false; -#endif - } - - bool Attribute::IsPatchControlPointData() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLAttribute*)m_ptr isActive]; -#else - return false; -#endif - } - - FunctionConstant::FunctionConstant() : -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - ns::Object(ns::Handle{ (__bridge void*)[[MTLFunctionConstant alloc] init] }) -#else - ns::Object(ns::Handle{ nullptr }) -#endif - { - } - - ns::String FunctionConstant::GetName() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge MTLFunctionConstant*)m_ptr name] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - DataType FunctionConstant::GetType() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return DataType([(__bridge MTLFunctionConstant*)m_ptr type]); -#else - return DataType(0); -#endif - } - - uint32_t FunctionConstant::GetIndex() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLFunctionConstant*)m_ptr index]); -#else - return 0; -#endif - } - - bool FunctionConstant::IsRequired() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLFunctionConstant*)m_ptr required]; -#else - return false; -#endif - } - - ns::String Function::GetLabel() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - Device Function::GetDevice() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr device] }; - } - - FunctionType Function::GetFunctionType() const - { - Validate(); - return FunctionType([(__bridge id)m_ptr functionType]); - } - - PatchType Function::GetPatchType() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return PatchType([(__bridge id)m_ptr patchType]); -#else - return PatchType(0); -#endif - } - - int32_t Function::GetPatchControlPointCount() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return int32_t([(__bridge id)m_ptr patchControlPointCount]); -#else - return 0; -#endif - } - - const ns::Array Function::GetVertexAttributes() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr vertexAttributes] }; - } - - const ns::Array Function::GetStageInputAttributes() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr stageInputAttributes] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - ns::String Function::GetName() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr name] }; - } - - ns::Dictionary Function::GetFunctionConstants() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr functionConstantsDictionary] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - void Function::SetLabel(const ns::String& label) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; -#endif - } - - ns::Dictionary CompileOptions::GetPreprocessorMacros() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLCompileOptions*)m_ptr preprocessorMacros] }; - } - - bool CompileOptions::IsFastMathEnabled() const - { - Validate(); - return [(__bridge MTLCompileOptions*)m_ptr fastMathEnabled]; - } - - LanguageVersion CompileOptions::GetLanguageVersion() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return LanguageVersion([(__bridge MTLCompileOptions*)m_ptr languageVersion]); -#else - return LanguageVersion::Version1_0; -#endif - } - - void CompileOptions::SetFastMathEnabled(bool fastMathEnabled) - { - Validate(); - [(__bridge MTLCompileOptions*)m_ptr setFastMathEnabled:fastMathEnabled]; - } - - void CompileOptions::SetFastMathEnabled(LanguageVersion languageVersion) - { - Validate(); - [(__bridge MTLCompileOptions*)m_ptr setFastMathEnabled:MTLLanguageVersion(languageVersion)]; - } - - ns::String Library::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - void Library::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - ns::Array Library::GetFunctionNames() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr functionNames] }; - } - - Function Library::NewFunction(const ns::String& functionName) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newFunctionWithName:(__bridge NSString*)functionName.GetPtr()] }; - } - - Function Library::NewFunction(const ns::String& functionName, const FunctionConstantValues& constantValues, ns::Error* error) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - NSError* nsError = error ? (__bridge NSError*)error->GetPtr() : nullptr; - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr - newFunctionWithName:(__bridge NSString*)functionName.GetPtr() - constantValues:(__bridge MTLFunctionConstantValues*)constantValues.GetPtr() - error:&nsError] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - void Library::NewFunction(const ns::String& functionName, const FunctionConstantValues& constantValues, std::function completionHandler) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr - newFunctionWithName:(__bridge NSString*)functionName.GetPtr() - constantValues:(__bridge MTLFunctionConstantValues*)constantValues.GetPtr() - completionHandler:^(id mtlFunction, NSError* error){ - completionHandler(ns::Handle{ (__bridge void*)mtlFunction }, ns::Handle{ (__bridge void*)error }); - }]; -#endif - } - -} - -////////////////////////////////////// -// FILE: ns.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "ns.hpp" -#include -#include -#include -#include -#include - -namespace ns -{ - Object::Object() : - m_ptr(nullptr) - { - } - - Object::Object(const Handle& handle) : - m_ptr(handle.ptr) - { - if (m_ptr) - CFRetain(m_ptr); - } - - Object::Object(const Object& rhs) : - m_ptr(rhs.m_ptr) - { - if (m_ptr) - CFRetain(m_ptr); - } - -#if MTLPP_CONFIG_RVALUE_REFERENCES - Object::Object(Object&& rhs) : - m_ptr(rhs.m_ptr) - { - rhs.m_ptr = nullptr; - } -#endif - - Object::~Object() - { - if (m_ptr) - CFRelease(m_ptr); - } - - Object& Object::operator=(const Object& rhs) - { - if (rhs.m_ptr == m_ptr) - return *this; - if (rhs.m_ptr) - CFRetain(rhs.m_ptr); - if (m_ptr) - CFRelease(m_ptr); - m_ptr = rhs.m_ptr; - return *this; - } - -#if MTLPP_CONFIG_RVALUE_REFERENCES - Object& Object::operator=(Object&& rhs) - { - if (rhs.m_ptr == m_ptr) - return *this; - if (m_ptr) - CFRelease(m_ptr); - m_ptr = rhs.m_ptr; - rhs.m_ptr = nullptr; - return *this; - } -#endif - - const uint32_t ArrayBase::GetSize() const - { - Validate(); - return uint32_t([(__bridge NSArray*)m_ptr count]); - } - - void* ArrayBase::GetItem(uint32_t index) const - { - Validate(); - return (__bridge void*)[(__bridge NSArray*)m_ptr objectAtIndexedSubscript:index]; - } - - String::String(const char* cstr) : - Object(Handle{ (__bridge void*)[NSString stringWithUTF8String:cstr] }) - { - } - - const char* String::GetCStr() const - { - Validate(); - return [(__bridge NSString*)m_ptr cStringUsingEncoding:NSUTF8StringEncoding]; - } - - uint32_t String::GetLength() const - { - Validate(); - return uint32_t([(__bridge NSString*)m_ptr length]); - } - - Error::Error() : - Object(Handle{ (__bridge void*)[[NSError alloc] init] }) - { - - } - - String Error::GetDomain() const - { - Validate(); - return Handle{ (__bridge void*)[(__bridge NSError*)m_ptr domain] }; - } - - uint32_t Error::GetCode() const - { - Validate(); - return uint32_t([(__bridge NSError*)m_ptr code]); - } - - //@property (readonly, copy) NSDictionary *userInfo; - - String Error::GetLocalizedDescription() const - { - Validate(); - return Handle{ (__bridge void*)[(__bridge NSError*)m_ptr localizedDescription] }; - } - - String Error::GetLocalizedFailureReason() const - { - Validate(); - return Handle{ (__bridge void*)[(__bridge NSError*)m_ptr localizedFailureReason] }; - } - - String Error::GetLocalizedRecoverySuggestion() const - { - Validate(); - return Handle{ (__bridge void*)[(__bridge NSError*)m_ptr localizedRecoverySuggestion] }; - } - - String Error::GetLocalizedRecoveryOptions() const - { - Validate(); - return Handle{ (__bridge void*)[(__bridge NSError*)m_ptr localizedRecoveryOptions] }; - } - - //@property (nullable, readonly, strong) id recoveryAttempter; - - String Error::GetHelpAnchor() const - { - Validate(); - return Handle{ (__bridge void*)[(__bridge NSError*)m_ptr helpAnchor] }; - } -} - -////////////////////////////////////// -// FILE: parallel_render_command_encoder.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "parallel_render_command_encoder.hpp" -// #include "render_command_encoder.hpp" -#include - -namespace mtlpp -{ - RenderCommandEncoder ParallelRenderCommandEncoder::GetRenderCommandEncoder() - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr renderCommandEncoder] }; - } - - void ParallelRenderCommandEncoder::SetColorStoreAction(StoreAction storeAction, uint32_t colorAttachmentIndex) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setColorStoreAction:MTLStoreAction(storeAction) atIndex:colorAttachmentIndex]; -#endif - } - - void ParallelRenderCommandEncoder::SetDepthStoreAction(StoreAction storeAction) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setDepthStoreAction:MTLStoreAction(storeAction)]; -#endif - } - - void ParallelRenderCommandEncoder::SetStencilStoreAction(StoreAction storeAction) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setStencilStoreAction:MTLStoreAction(storeAction)]; -#endif - } -} - -////////////////////////////////////// -// FILE: render_command_encoder.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "render_command_encoder.hpp" -// #include "buffer.hpp" -// #include "depth_stencil.hpp" -// #include "render_pipeline.hpp" -// #include "sampler.hpp" -// #include "texture.hpp" -#include -#include - -namespace mtlpp -{ - void RenderCommandEncoder::SetRenderPipelineState(const RenderPipelineState& pipelineState) - { - Validate(); - [(__bridge id)m_ptr setRenderPipelineState:(__bridge id)pipelineState.GetPtr()]; - } - - void RenderCommandEncoder::SetVertexData(const void* bytes, uint32_t length, uint32_t index) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 8_3) - [(__bridge id)m_ptr setVertexBytes:bytes length:length atIndex:index]; -#endif - } - - void RenderCommandEncoder::SetVertexBuffer(const Buffer& buffer, uint32_t offset, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setVertexBuffer:(__bridge id)buffer.GetPtr() - offset:offset - atIndex:index]; - } - void RenderCommandEncoder::SetVertexBufferOffset(uint32_t offset, uint32_t index) - { -#if MTLPP_IS_AVAILABLE(10_11, 8_3) - Validate(); - [(__bridge id)m_ptr setVertexBufferOffset:offset atIndex:index]; -#endif - } - - void RenderCommandEncoder::SetVertexBuffers(const Buffer* buffers, const uint32_t* offsets, const ns::Range& range) - { - Validate(); - - const uint32_t maxBuffers = 32; - assert(range.Length <= maxBuffers); - - id mtlBuffers[maxBuffers]; - NSUInteger nsOffsets[maxBuffers]; - for (uint32_t i=0; i)buffers[i].GetPtr(); - nsOffsets[i] = offsets[i]; - } - - [(__bridge id)m_ptr setVertexBuffers:mtlBuffers offsets:nsOffsets withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetVertexTexture(const Texture& texture, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setVertexTexture:(__bridge id)texture.GetPtr() - atIndex:index]; - } - - - void RenderCommandEncoder::SetVertexTextures(const Texture* textures, const ns::Range& range) - { - Validate(); - - const uint32_t maxTextures = 32; - assert(range.Length <= maxTextures); - - id mtlTextures[maxTextures]; - for (uint32_t i=0; i)textures[i].GetPtr(); - - [(__bridge id)m_ptr setVertexTextures:mtlTextures withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetVertexSamplerState(const SamplerState& sampler, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setVertexSamplerState:(__bridge id)sampler.GetPtr() - atIndex:index]; - - } - - void RenderCommandEncoder::SetVertexSamplerStates(const SamplerState* samplers, const ns::Range& range) - { - Validate(); - - const uint32_t maxStates = 32; - assert(range.Length <= maxStates); - - id mtlStates[maxStates]; - for (uint32_t i=0; i)samplers[i].GetPtr(); - - [(__bridge id)m_ptr setVertexSamplerStates:mtlStates withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetVertexSamplerState(const SamplerState& sampler, float lodMinClamp, float lodMaxClamp, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setVertexSamplerState:(__bridge id)sampler.GetPtr() - lodMinClamp:lodMinClamp - lodMaxClamp:lodMaxClamp - atIndex:index]; - } - - void RenderCommandEncoder::SetVertexSamplerStates(const SamplerState* samplers, const float* lodMinClamps, const float* lodMaxClamps, const ns::Range& range) - { - Validate(); - - const uint32_t maxStates = 32; - assert(range.Length <= maxStates); - - id mtlStates[maxStates]; - for (uint32_t i=0; i)samplers[i].GetPtr(); - - [(__bridge id)m_ptr setVertexSamplerStates:mtlStates - lodMinClamps:lodMinClamps - lodMaxClamps:lodMaxClamps - withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetViewport(const Viewport& viewport) - { - Validate(); - MTLViewport mtlViewport = { viewport.OriginX, viewport.OriginY, viewport.Width, viewport.Height, viewport.ZNear, viewport.ZFar }; - [(__bridge id)m_ptr setViewport:mtlViewport]; - } - - void RenderCommandEncoder::SetFrontFacingWinding(Winding frontFacingWinding) - { - Validate(); - [(__bridge id)m_ptr setFrontFacingWinding:MTLWinding(frontFacingWinding)]; - } - - void RenderCommandEncoder::SetCullMode(CullMode cullMode) - { - Validate(); - [(__bridge id)m_ptr setCullMode:MTLCullMode(cullMode)]; - } - - void RenderCommandEncoder::SetDepthClipMode(DepthClipMode depthClipMode) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge id)m_ptr setDepthClipMode:MTLDepthClipMode(depthClipMode)]; -#endif - } - - void RenderCommandEncoder::SetDepthBias(float depthBias, float slopeScale, float clamp) - { - Validate(); - [(__bridge id)m_ptr setDepthBias:depthBias slopeScale:slopeScale clamp:clamp]; - } - - void RenderCommandEncoder::SetScissorRect(const ScissorRect& rect) - { - Validate(); - MTLScissorRect mtlRect { rect.X, rect.Y, rect.Width, rect.Height }; - [(__bridge id)m_ptr setScissorRect:mtlRect]; - } - - void RenderCommandEncoder::SetTriangleFillMode(TriangleFillMode fillMode) - { - Validate(); - [(__bridge id)m_ptr setTriangleFillMode:MTLTriangleFillMode(fillMode)]; - } - - void RenderCommandEncoder::SetFragmentData(const void* bytes, uint32_t length, uint32_t index) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 8_3) - [(__bridge id)m_ptr setFragmentBytes:bytes - length:length - atIndex:index]; -#endif - } - - void RenderCommandEncoder::SetFragmentBuffer(const Buffer& buffer, uint32_t offset, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setFragmentBuffer:(__bridge id)buffer.GetPtr() - offset:offset - atIndex:index]; - } - - void RenderCommandEncoder::SetFragmentBufferOffset(uint32_t offset, uint32_t index) - { -#if MTLPP_IS_AVAILABLE(10_11, 8_3) - Validate(); - [(__bridge id)m_ptr setFragmentBufferOffset:offset atIndex:index]; -#endif - } - - void RenderCommandEncoder::SetFragmentBuffers(const Buffer* buffers, const uint32_t* offsets, const ns::Range& range) - { - Validate(); - - const uint32_t maxBuffers = 32; - assert(range.Length <= maxBuffers); - - id mtlBuffers[maxBuffers]; - NSUInteger nsOffsets[maxBuffers]; - for (uint32_t i=0; i)buffers[i].GetPtr(); - nsOffsets[i] = offsets[i]; - } - - [(__bridge id)m_ptr setFragmentBuffers:mtlBuffers offsets:nsOffsets withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetFragmentTexture(const Texture& texture, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setFragmentTexture:(__bridge id)texture.GetPtr() - atIndex:index]; - } - - void RenderCommandEncoder::SetFragmentTextures(const Texture* textures, const ns::Range& range) - { - Validate(); - - const uint32_t maxTextures = 32; - assert(range.Length <= maxTextures); - - id mtlTextures[maxTextures]; - for (uint32_t i=0; i)textures[i].GetPtr(); - - [(__bridge id)m_ptr setFragmentTextures:mtlTextures withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetFragmentSamplerState(const SamplerState& sampler, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setFragmentSamplerState:(__bridge id)sampler.GetPtr() - atIndex:index]; - } - - void RenderCommandEncoder::SetFragmentSamplerStates(const SamplerState* samplers, const ns::Range& range) - { - Validate(); - - const uint32_t maxStates = 32; - assert(range.Length <= maxStates); - - id mtlStates[maxStates]; - for (uint32_t i=0; i)samplers[i].GetPtr(); - - [(__bridge id)m_ptr setFragmentSamplerStates:mtlStates withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetFragmentSamplerState(const SamplerState& sampler, float lodMinClamp, float lodMaxClamp, uint32_t index) - { - Validate(); - [(__bridge id)m_ptr setFragmentSamplerState:(__bridge id)sampler.GetPtr() - lodMinClamp:lodMinClamp - lodMaxClamp:lodMaxClamp - atIndex:index]; - } - - void RenderCommandEncoder::SetFragmentSamplerStates(const SamplerState* samplers, const float* lodMinClamps, const float* lodMaxClamps, const ns::Range& range) - { - Validate(); - - const uint32_t maxStates = 32; - assert(range.Length <= maxStates); - - id mtlStates[maxStates]; - for (uint32_t i=0; i)samplers[i].GetPtr(); - - [(__bridge id)m_ptr setFragmentSamplerStates:mtlStates - lodMinClamps:lodMinClamps - lodMaxClamps:lodMaxClamps - withRange:NSMakeRange(range.Location, range.Length)]; - } - - void RenderCommandEncoder::SetBlendColor(float red, float green, float blue, float alpha) - { - Validate(); - [(__bridge id)m_ptr setBlendColorRed:red green:green blue:blue alpha:alpha]; - } - - void RenderCommandEncoder::SetDepthStencilState(const DepthStencilState& depthStencilState) - { - Validate(); - [(__bridge id)m_ptr setDepthStencilState:(__bridge id)depthStencilState.GetPtr()]; - } - - void RenderCommandEncoder::SetStencilReferenceValue(uint32_t referenceValue) - { - Validate(); - [(__bridge id)m_ptr setStencilReferenceValue:referenceValue]; - } - - void RenderCommandEncoder::SetStencilReferenceValue(uint32_t frontReferenceValue, uint32_t backReferenceValue) - { - Validate(); - [(__bridge id)m_ptr setStencilFrontReferenceValue:frontReferenceValue backReferenceValue:backReferenceValue]; - } - - void RenderCommandEncoder::SetVisibilityResultMode(VisibilityResultMode mode, uint32_t offset) - { - Validate(); - [(__bridge id)m_ptr setVisibilityResultMode:MTLVisibilityResultMode(mode) offset:offset]; - } - - void RenderCommandEncoder::SetColorStoreAction(StoreAction storeAction, uint32_t colorAttachmentIndex) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setColorStoreAction:MTLStoreAction(storeAction) atIndex:colorAttachmentIndex]; -#endif - } - - void RenderCommandEncoder::SetDepthStoreAction(StoreAction storeAction) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setDepthStoreAction:MTLStoreAction(storeAction)]; -#endif - } - - void RenderCommandEncoder::SetStencilStoreAction(StoreAction storeAction) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setStencilStoreAction:MTLStoreAction(storeAction)]; -#endif - } - - void RenderCommandEncoder::Draw(PrimitiveType primitiveType, uint32_t vertexStart, uint32_t vertexCount) - { - Validate(); - [(__bridge id)m_ptr drawPrimitives:MTLPrimitiveType(primitiveType) - vertexStart:vertexStart - vertexCount:vertexCount]; - } - - void RenderCommandEncoder::Draw(PrimitiveType primitiveType, uint32_t vertexStart, uint32_t vertexCount, uint32_t instanceCount) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge id)m_ptr drawPrimitives:MTLPrimitiveType(primitiveType) - vertexStart:vertexStart - vertexCount:vertexCount - instanceCount:instanceCount]; -#endif - } - - void RenderCommandEncoder::Draw(PrimitiveType primitiveType, uint32_t vertexStart, uint32_t vertexCount, uint32_t instanceCount, uint32_t baseInstance) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge id)m_ptr drawPrimitives:MTLPrimitiveType(primitiveType) - vertexStart:vertexStart - vertexCount:vertexCount - instanceCount:instanceCount - baseInstance:baseInstance]; -#endif - } - - void RenderCommandEncoder::Draw(PrimitiveType primitiveType, Buffer indirectBuffer, uint32_t indirectBufferOffset) - { - Validate(); - [(__bridge id)m_ptr drawPrimitives:MTLPrimitiveType(primitiveType) - indirectBuffer:(__bridge id)indirectBuffer.GetPtr() - indirectBufferOffset:indirectBufferOffset]; - } - - void RenderCommandEncoder::DrawIndexed(PrimitiveType primitiveType, uint32_t indexCount, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset) - { - Validate(); - [(__bridge id)m_ptr drawIndexedPrimitives:MTLPrimitiveType(primitiveType) - indexCount:indexCount - indexType:MTLIndexType(indexType) - indexBuffer:(__bridge id)indexBuffer.GetPtr() - indexBufferOffset:indexBufferOffset]; - } - - void RenderCommandEncoder::DrawIndexed(PrimitiveType primitiveType, uint32_t indexCount, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset, uint32_t instanceCount) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge id)m_ptr drawIndexedPrimitives:MTLPrimitiveType(primitiveType) - indexCount:indexCount indexType:MTLIndexType(indexType) - indexBuffer:(__bridge id)indexBuffer.GetPtr() - indexBufferOffset:indexBufferOffset instanceCount:instanceCount]; -#endif - } - - void RenderCommandEncoder::DrawIndexed(PrimitiveType primitiveType, uint32_t indexCount, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset, uint32_t instanceCount, uint32_t baseVertex, uint32_t baseInstance) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge id)m_ptr drawIndexedPrimitives:MTLPrimitiveType(primitiveType) - indexCount:indexCount - indexType:MTLIndexType(indexType) - indexBuffer:(__bridge id)indexBuffer.GetPtr() - indexBufferOffset:indexBufferOffset - instanceCount:instanceCount - baseVertex:baseVertex - baseInstance:baseInstance]; -#endif - } - - void RenderCommandEncoder::DrawIndexed(PrimitiveType primitiveType, IndexType indexType, const Buffer& indexBuffer, uint32_t indexBufferOffset, const Buffer& indirectBuffer, uint32_t indirectBufferOffset) - { - Validate(); - [(__bridge id)m_ptr drawIndexedPrimitives:MTLPrimitiveType(primitiveType) - indexType:MTLIndexType(indexType) - indexBuffer:(__bridge id)indexBuffer.GetPtr() - indexBufferOffset:indexBufferOffset - indirectBuffer:(__bridge id)indirectBuffer.GetPtr() - indirectBufferOffset:indirectBufferOffset]; - } - - void RenderCommandEncoder::TextureBarrier() - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge id)m_ptr textureBarrier]; -#endif - } - - void RenderCommandEncoder::UpdateFence(const Fence& fence, RenderStages afterStages) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr updateFence:(__bridge id)fence.GetPtr() afterStages:MTLRenderStages(afterStages)]; -#endif - } - - void RenderCommandEncoder::WaitForFence(const Fence& fence, RenderStages beforeStages) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr waitForFence:(__bridge id)fence.GetPtr() beforeStages:MTLRenderStages(beforeStages)]; -#endif - } - - void RenderCommandEncoder::SetTessellationFactorBuffer(const Buffer& buffer, uint32_t offset, uint32_t instanceStride) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setTessellationFactorBuffer:(__bridge id)buffer.GetPtr() offset:offset instanceStride:instanceStride]; -#endif - } - - void RenderCommandEncoder::SetTessellationFactorScale(float scale) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr setTessellationFactorScale:scale]; -#endif - } - - void RenderCommandEncoder::DrawPatches(uint32_t numberOfPatchControlPoints, uint32_t patchStart, uint32_t patchCount, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, uint32_t instanceCount, uint32_t baseInstance) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr drawPatches:numberOfPatchControlPoints - patchStart:patchStart - patchCount:patchCount - patchIndexBuffer:(__bridge id)patchIndexBuffer.GetPtr() - patchIndexBufferOffset:patchIndexBufferOffset - instanceCount:instanceCount - baseInstance:baseInstance]; -#endif - } - - void RenderCommandEncoder::DrawPatches(uint32_t numberOfPatchControlPoints, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, const Buffer& indirectBuffer, uint32_t indirectBufferOffset) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_12) - [(__bridge id)m_ptr drawPatches:numberOfPatchControlPoints - patchIndexBuffer:(__bridge id)patchIndexBuffer.GetPtr() - patchIndexBufferOffset:patchIndexBufferOffset - indirectBuffer:(__bridge id)indirectBuffer.GetPtr() - indirectBufferOffset:indirectBufferOffset]; -#endif - } - - void RenderCommandEncoder::DrawIndexedPatches(uint32_t numberOfPatchControlPoints, uint32_t patchStart, uint32_t patchCount, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, const Buffer& controlPointIndexBuffer, uint32_t controlPointIndexBufferOffset, uint32_t instanceCount, uint32_t baseInstance) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge id)m_ptr drawIndexedPatches:numberOfPatchControlPoints - patchStart:patchStart - patchCount:patchCount - patchIndexBuffer:(__bridge id)patchIndexBuffer.GetPtr() - patchIndexBufferOffset:patchIndexBufferOffset - controlPointIndexBuffer:(__bridge id)controlPointIndexBuffer.GetPtr() - controlPointIndexBufferOffset:controlPointIndexBufferOffset - instanceCount:instanceCount - baseInstance:baseInstance]; -#endif - } - - void RenderCommandEncoder::DrawIndexedPatches(uint32_t numberOfPatchControlPoints, const Buffer& patchIndexBuffer, uint32_t patchIndexBufferOffset, const Buffer& controlPointIndexBuffer, uint32_t controlPointIndexBufferOffset, const Buffer& indirectBuffer, uint32_t indirectBufferOffset) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_12) - [(__bridge id)m_ptr drawIndexedPatches:numberOfPatchControlPoints - patchIndexBuffer:(__bridge id)patchIndexBuffer.GetPtr() - patchIndexBufferOffset:patchIndexBufferOffset - controlPointIndexBuffer:(__bridge id)controlPointIndexBuffer.GetPtr() - controlPointIndexBufferOffset:controlPointIndexBufferOffset - indirectBuffer:(__bridge id)indirectBuffer.GetPtr() - indirectBufferOffset:indirectBufferOffset]; -#endif - } -} - - -////////////////////////////////////// -// FILE: render_pass.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "render_pass.hpp" -// #include "texture.hpp" -#include - -namespace mtlpp -{ - RenderPassAttachmentDescriptor::RenderPassAttachmentDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLRenderPassAttachmentDescriptor alloc] init] }) - { - } - - Texture RenderPassAttachmentDescriptor::GetTexture() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr texture] }; - } - - uint32_t RenderPassAttachmentDescriptor::GetLevel() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr level]); - } - - uint32_t RenderPassAttachmentDescriptor::GetSlice() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr slice]); - } - - uint32_t RenderPassAttachmentDescriptor::GetDepthPlane() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr depthPlane]); - } - - Texture RenderPassAttachmentDescriptor::GetResolveTexture() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr resolveTexture] }; - } - - uint32_t RenderPassAttachmentDescriptor::GetResolveLevel() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr resolveLevel]); - } - - uint32_t RenderPassAttachmentDescriptor::GetResolveSlice() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr resolveSlice]); - } - - uint32_t RenderPassAttachmentDescriptor::GetResolveDepthPlane() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr resolveDepthPlane]); - } - - LoadAction RenderPassAttachmentDescriptor::GetLoadAction() const - { - Validate(); - return LoadAction([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr loadAction]); - } - - StoreAction RenderPassAttachmentDescriptor::GetStoreAction() const - { - Validate(); - return StoreAction([(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr storeAction]); - } - - void RenderPassAttachmentDescriptor::SetTexture(const Texture& texture) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setTexture:(__bridge id)texture.GetPtr()]; - } - - void RenderPassAttachmentDescriptor::SetLevel(uint32_t level) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setLevel:level]; - } - - void RenderPassAttachmentDescriptor::SetSlice(uint32_t slice) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setSlice:slice]; - } - - void RenderPassAttachmentDescriptor::SetDepthPlane(uint32_t depthPlane) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setDepthPlane:depthPlane]; - } - - void RenderPassAttachmentDescriptor::SetResolveTexture(const Texture& texture) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setResolveTexture:(__bridge id)texture.GetPtr()]; - } - - void RenderPassAttachmentDescriptor::SetResolveLevel(uint32_t resolveLevel) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setResolveLevel:resolveLevel]; - } - - void RenderPassAttachmentDescriptor::SetResolveSlice(uint32_t resolveSlice) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setResolveSlice:resolveSlice]; - } - - void RenderPassAttachmentDescriptor::SetResolveDepthPlane(uint32_t resolveDepthPlane) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setResolveDepthPlane:resolveDepthPlane]; - } - - void RenderPassAttachmentDescriptor::SetLoadAction(LoadAction loadAction) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setLoadAction:MTLLoadAction(loadAction)]; - } - - void RenderPassAttachmentDescriptor::SetStoreAction(StoreAction storeAction) - { - Validate(); - [(__bridge MTLRenderPassAttachmentDescriptor*)m_ptr setStoreAction:MTLStoreAction(storeAction)]; - } - - RenderPassColorAttachmentDescriptor::RenderPassColorAttachmentDescriptor() : - RenderPassAttachmentDescriptor(ns::Handle{ (__bridge void*)[[MTLRenderPassColorAttachmentDescriptor alloc] init] }) - { - } - - ClearColor RenderPassColorAttachmentDescriptor::GetClearColor() const - { - Validate(); - MTLClearColor mtlClearColor = [(__bridge MTLRenderPassColorAttachmentDescriptor*)m_ptr clearColor]; - return ClearColor(mtlClearColor.red, mtlClearColor.green, mtlClearColor.blue, mtlClearColor.alpha); - } - - void RenderPassColorAttachmentDescriptor::SetClearColor(const ClearColor& clearColor) - { - Validate(); - MTLClearColor mtlClearColor = { clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha }; - [(__bridge MTLRenderPassColorAttachmentDescriptor*)m_ptr setClearColor:mtlClearColor]; - } - - RenderPassDepthAttachmentDescriptor::RenderPassDepthAttachmentDescriptor() : - RenderPassAttachmentDescriptor(ns::Handle{ (__bridge void*)[[MTLRenderPassDepthAttachmentDescriptor alloc] init] }) - { - } - - double RenderPassDepthAttachmentDescriptor::GetClearDepth() const - { - Validate(); - return [(__bridge MTLRenderPassDepthAttachmentDescriptor*)m_ptr clearDepth]; - } - - MultisampleDepthResolveFilter RenderPassDepthAttachmentDescriptor::GetDepthResolveFilter() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(9_0) - return MultisampleDepthResolveFilter([(__bridge MTLRenderPassDepthAttachmentDescriptor*)m_ptr depthResolveFilter]); -#else - return MultisampleDepthResolveFilter(0); -#endif - } - - void RenderPassDepthAttachmentDescriptor::SetClearDepth(double clearDepth) - { - Validate(); - [(__bridge MTLRenderPassDepthAttachmentDescriptor*)m_ptr setClearDepth:clearDepth]; - } - - void RenderPassDepthAttachmentDescriptor::SetDepthResolveFilter(MultisampleDepthResolveFilter depthResolveFilter) - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(9_0) - [(__bridge MTLRenderPassDepthAttachmentDescriptor*)m_ptr setDepthResolveFilter:MTLMultisampleDepthResolveFilter(depthResolveFilter)]; -#endif - } - - RenderPassStencilAttachmentDescriptor::RenderPassStencilAttachmentDescriptor() : - RenderPassAttachmentDescriptor(ns::Handle{ (__bridge void*)[[MTLRenderPassStencilAttachmentDescriptor alloc] init] }) - { - } - - uint32_t RenderPassStencilAttachmentDescriptor::GetClearStencil() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPassStencilAttachmentDescriptor*)m_ptr clearStencil]); - } - - void RenderPassStencilAttachmentDescriptor::SetClearStencil(uint32_t clearStencil) - { - Validate(); - [(__bridge MTLRenderPassStencilAttachmentDescriptor*)m_ptr setClearStencil:clearStencil]; - } - - RenderPassDescriptor::RenderPassDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLRenderPassDescriptor alloc] init] }) - { - } - - ns::Array RenderPassDescriptor::GetColorAttachments() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPassDescriptor*)m_ptr colorAttachments] }; - } - - RenderPassDepthAttachmentDescriptor RenderPassDescriptor::GetDepthAttachment() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPassDescriptor*)m_ptr depthAttachment] }; - } - - RenderPassStencilAttachmentDescriptor RenderPassDescriptor::GetStencilAttachment() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPassDescriptor*)m_ptr stencilAttachment] }; - } - - Buffer RenderPassDescriptor::GetVisibilityResultBuffer() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPassDescriptor*)m_ptr visibilityResultBuffer] }; - } - - uint32_t RenderPassDescriptor::GetRenderTargetArrayLength() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return uint32_t([(__bridge MTLRenderPassDescriptor*)m_ptr renderTargetArrayLength]); -#else - return 0; -#endif - } - - void RenderPassDescriptor::SetDepthAttachment(const RenderPassDepthAttachmentDescriptor& depthAttachment) - { - Validate(); - [(__bridge MTLRenderPassDescriptor*)m_ptr setDepthAttachment:(__bridge MTLRenderPassDepthAttachmentDescriptor*)depthAttachment.GetPtr()]; - } - - void RenderPassDescriptor::SetStencilAttachment(const RenderPassStencilAttachmentDescriptor& stencilAttachment) - { - Validate(); - [(__bridge MTLRenderPassDescriptor*)m_ptr setStencilAttachment:(__bridge MTLRenderPassStencilAttachmentDescriptor*)stencilAttachment.GetPtr()]; - } - - void RenderPassDescriptor::SetVisibilityResultBuffer(const Buffer& visibilityResultBuffer) - { - Validate(); - [(__bridge MTLRenderPassDescriptor*)m_ptr setVisibilityResultBuffer:(__bridge id)visibilityResultBuffer.GetPtr()]; - } - - void RenderPassDescriptor::SetRenderTargetArrayLength(uint32_t renderTargetArrayLength) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge MTLRenderPassDescriptor*)m_ptr setRenderTargetArrayLength:renderTargetArrayLength]; -#endif - } -} - -////////////////////////////////////// -// FILE: render_pipeline.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "render_pipeline.hpp" -// #include "vertex_descriptor.hpp" -#include - -namespace mtlpp -{ - RenderPipelineColorAttachmentDescriptor::RenderPipelineColorAttachmentDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLRenderPipelineColorAttachmentDescriptor alloc] init] }) - { - } - - PixelFormat RenderPipelineColorAttachmentDescriptor::GetPixelFormat() const - { - Validate(); - return PixelFormat([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr pixelFormat]); - } - - bool RenderPipelineColorAttachmentDescriptor::IsBlendingEnabled() const - { - Validate(); - return [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr isBlendingEnabled]; - } - - BlendFactor RenderPipelineColorAttachmentDescriptor::GetSourceRgbBlendFactor() const - { - Validate(); - return BlendFactor([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr sourceRGBBlendFactor]); - } - - BlendFactor RenderPipelineColorAttachmentDescriptor::GetDestinationRgbBlendFactor() const - { - Validate(); - return BlendFactor([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr destinationRGBBlendFactor]); - } - - BlendOperation RenderPipelineColorAttachmentDescriptor::GetRgbBlendOperation() const - { - Validate(); - return BlendOperation([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr rgbBlendOperation]); - } - - BlendFactor RenderPipelineColorAttachmentDescriptor::GetSourceAlphaBlendFactor() const - { - Validate(); - return BlendFactor([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr sourceAlphaBlendFactor]); - } - - BlendFactor RenderPipelineColorAttachmentDescriptor::GetDestinationAlphaBlendFactor() const - { - Validate(); - return BlendFactor([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr destinationAlphaBlendFactor]); - } - - BlendOperation RenderPipelineColorAttachmentDescriptor::GetAlphaBlendOperation() const - { - Validate(); - return BlendOperation([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr alphaBlendOperation]); - } - - ColorWriteMask RenderPipelineColorAttachmentDescriptor::GetWriteMask() const - { - Validate(); - return ColorWriteMask([(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr writeMask]); - } - - void RenderPipelineColorAttachmentDescriptor::SetPixelFormat(PixelFormat pixelFormat) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setPixelFormat:MTLPixelFormat(pixelFormat)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetBlendingEnabled(bool blendingEnabled) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setBlendingEnabled:blendingEnabled]; - } - - void RenderPipelineColorAttachmentDescriptor::SetSourceRgbBlendFactor(BlendFactor sourceRgbBlendFactor) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setSourceRGBBlendFactor:MTLBlendFactor(sourceRgbBlendFactor)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetDestinationRgbBlendFactor(BlendFactor destinationRgbBlendFactor) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setDestinationRGBBlendFactor:MTLBlendFactor(destinationRgbBlendFactor)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetRgbBlendOperation(BlendOperation rgbBlendOperation) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setRgbBlendOperation:MTLBlendOperation(rgbBlendOperation)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetSourceAlphaBlendFactor(BlendFactor sourceAlphaBlendFactor) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setSourceAlphaBlendFactor:MTLBlendFactor(sourceAlphaBlendFactor)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetDestinationAlphaBlendFactor(BlendFactor destinationAlphaBlendFactor) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setDestinationAlphaBlendFactor:MTLBlendFactor(destinationAlphaBlendFactor)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetAlphaBlendOperation(BlendOperation alphaBlendOperation) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setAlphaBlendOperation:MTLBlendOperation(alphaBlendOperation)]; - } - - void RenderPipelineColorAttachmentDescriptor::SetWriteMask(ColorWriteMask writeMask) - { - Validate(); - [(__bridge MTLRenderPipelineColorAttachmentDescriptor*)m_ptr setWriteMask:MTLColorWriteMask(writeMask)]; - } - - RenderPipelineReflection::RenderPipelineReflection() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLRenderPipelineReflection alloc] init] }) - { - } - - const ns::Array RenderPipelineReflection::GetVertexArguments() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineReflection*)m_ptr vertexArguments] }; - } - - const ns::Array RenderPipelineReflection::GetFragmentArguments() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineReflection*)m_ptr fragmentArguments] }; - } - - RenderPipelineDescriptor::RenderPipelineDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLRenderPipelineDescriptor alloc] init] }) - { - } - - ns::String RenderPipelineDescriptor::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineDescriptor*)m_ptr label] }; - } - - Function RenderPipelineDescriptor::GetVertexFunction() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineDescriptor*)m_ptr vertexFunction] }; - } - - Function RenderPipelineDescriptor::GetFragmentFunction() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineDescriptor*)m_ptr fragmentFunction] }; - } - - VertexDescriptor RenderPipelineDescriptor::GetVertexDescriptor() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineDescriptor*)m_ptr vertexDescriptor] }; - } - - uint32_t RenderPipelineDescriptor::GetSampleCount() const - { - Validate(); - return uint32_t([(__bridge MTLRenderPipelineDescriptor*)m_ptr sampleCount]); - } - - bool RenderPipelineDescriptor::IsAlphaToCoverageEnabled() const - { - Validate(); - return [(__bridge MTLRenderPipelineDescriptor*)m_ptr isAlphaToCoverageEnabled]; - } - - bool RenderPipelineDescriptor::IsAlphaToOneEnabled() const - { - Validate(); - return [(__bridge MTLRenderPipelineDescriptor*)m_ptr isAlphaToOneEnabled]; - } - - bool RenderPipelineDescriptor::IsRasterizationEnabled() const - { - Validate(); - return [(__bridge MTLRenderPipelineDescriptor*)m_ptr isRasterizationEnabled]; - } - - ns::Array RenderPipelineDescriptor::GetColorAttachments() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLRenderPipelineDescriptor*)m_ptr colorAttachments] }; - } - - PixelFormat RenderPipelineDescriptor::GetDepthAttachmentPixelFormat() const - { - Validate(); - return PixelFormat([(__bridge MTLRenderPipelineDescriptor*)m_ptr depthAttachmentPixelFormat]); - } - - PixelFormat RenderPipelineDescriptor::GetStencilAttachmentPixelFormat() const - { - Validate(); - return PixelFormat([(__bridge MTLRenderPipelineDescriptor*)m_ptr stencilAttachmentPixelFormat]); - } - - PrimitiveTopologyClass RenderPipelineDescriptor::GetInputPrimitiveTopology() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return PrimitiveTopologyClass([(__bridge MTLRenderPipelineDescriptor*)m_ptr inputPrimitiveTopology]); -#else - return PrimitiveTopologyClass(0); -#endif - } - - TessellationPartitionMode RenderPipelineDescriptor::GetTessellationPartitionMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return TessellationPartitionMode([(__bridge MTLRenderPipelineDescriptor*)m_ptr tessellationPartitionMode]); -#else - return TessellationPartitionMode(0); -#endif - } - - uint32_t RenderPipelineDescriptor::GetMaxTessellationFactor() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLRenderPipelineDescriptor*)m_ptr maxTessellationFactor]); -#else - return 0; -#endif - } - - bool RenderPipelineDescriptor::IsTessellationFactorScaleEnabled() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return [(__bridge MTLRenderPipelineDescriptor*)m_ptr isTessellationFactorScaleEnabled]; -#else - return false; -#endif - } - - TessellationFactorFormat RenderPipelineDescriptor::GetTessellationFactorFormat() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return TessellationFactorFormat([(__bridge MTLRenderPipelineDescriptor*)m_ptr tessellationFactorFormat]); -#else - return TessellationFactorFormat(0); -#endif - } - - TessellationControlPointIndexType RenderPipelineDescriptor::GetTessellationControlPointIndexType() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return TessellationControlPointIndexType([(__bridge MTLRenderPipelineDescriptor*)m_ptr tessellationControlPointIndexType]); -#else - return TessellationControlPointIndexType(0); -#endif - } - - TessellationFactorStepFunction RenderPipelineDescriptor::GetTessellationFactorStepFunction() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return TessellationFactorStepFunction([(__bridge MTLRenderPipelineDescriptor*)m_ptr tessellationFactorStepFunction]); -#else - return TessellationFactorStepFunction(0); -#endif - } - - Winding RenderPipelineDescriptor::GetTessellationOutputWindingOrder() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return Winding([(__bridge MTLRenderPipelineDescriptor*)m_ptr tessellationOutputWindingOrder]); -#else - return Winding(0); -#endif - } - - void RenderPipelineDescriptor::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - void RenderPipelineDescriptor::SetVertexFunction(const Function& vertexFunction) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setVertexFunction:(__bridge id)vertexFunction.GetPtr()]; - } - - void RenderPipelineDescriptor::SetFragmentFunction(const Function& fragmentFunction) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setFragmentFunction:(__bridge id)fragmentFunction.GetPtr()]; - } - - void RenderPipelineDescriptor::SetVertexDescriptor(const VertexDescriptor& vertexDescriptor) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setVertexDescriptor:(__bridge MTLVertexDescriptor*)vertexDescriptor.GetPtr()]; - } - - void RenderPipelineDescriptor::SetSampleCount(uint32_t sampleCount) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setSampleCount:sampleCount]; - } - - void RenderPipelineDescriptor::SetAlphaToCoverageEnabled(bool alphaToCoverageEnabled) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setAlphaToCoverageEnabled:alphaToCoverageEnabled]; - } - - void RenderPipelineDescriptor::SetAlphaToOneEnabled(bool alphaToOneEnabled) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setAlphaToOneEnabled:alphaToOneEnabled]; - } - - void RenderPipelineDescriptor::SetRasterizationEnabled(bool rasterizationEnabled) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setRasterizationEnabled:rasterizationEnabled]; - } - - void RenderPipelineDescriptor::SetDepthAttachmentPixelFormat(PixelFormat depthAttachmentPixelFormat) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setDepthAttachmentPixelFormat:MTLPixelFormat(depthAttachmentPixelFormat)]; - } - - void RenderPipelineDescriptor::SetStencilAttachmentPixelFormat(PixelFormat depthAttachmentPixelFormat) - { - Validate(); - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setStencilAttachmentPixelFormat:MTLPixelFormat(depthAttachmentPixelFormat)]; - } - - void RenderPipelineDescriptor::SetInputPrimitiveTopology(PrimitiveTopologyClass inputPrimitiveTopology) - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setInputPrimitiveTopology:MTLPrimitiveTopologyClass(inputPrimitiveTopology)]; -#endif - } - - void RenderPipelineDescriptor::SetTessellationPartitionMode(TessellationPartitionMode tessellationPartitionMode) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setTessellationPartitionMode:MTLTessellationPartitionMode(tessellationPartitionMode)]; -#endif - } - - void RenderPipelineDescriptor::SetMaxTessellationFactor(uint32_t maxTessellationFactor) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setMaxTessellationFactor:maxTessellationFactor]; -#endif - } - - void RenderPipelineDescriptor::SetTessellationFactorScaleEnabled(bool tessellationFactorScaleEnabled) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setTessellationFactorScaleEnabled:tessellationFactorScaleEnabled]; -#endif - } - - void RenderPipelineDescriptor::SetTessellationFactorFormat(TessellationFactorFormat tessellationFactorFormat) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setTessellationFactorFormat:MTLTessellationFactorFormat(tessellationFactorFormat)]; -#endif - } - - void RenderPipelineDescriptor::SetTessellationControlPointIndexType(TessellationControlPointIndexType tessellationControlPointIndexType) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setTessellationControlPointIndexType:MTLTessellationControlPointIndexType(tessellationControlPointIndexType)]; -#endif - } - - void RenderPipelineDescriptor::SetTessellationFactorStepFunction(TessellationFactorStepFunction tessellationFactorStepFunction) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setTessellationFactorStepFunction:MTLTessellationFactorStepFunction(tessellationFactorStepFunction)]; -#endif - } - - void RenderPipelineDescriptor::SetTessellationOutputWindingOrder(Winding tessellationOutputWindingOrder) - { -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLRenderPipelineDescriptor*)m_ptr setTessellationOutputWindingOrder:MTLWinding(tessellationOutputWindingOrder)]; -#endif - } - - void RenderPipelineDescriptor::Reset() - { - [(__bridge MTLRenderPipelineDescriptor*)m_ptr reset]; - } - - ns::String RenderPipelineState::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - Device RenderPipelineState::GetDevice() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr device] }; - } -} - -////////////////////////////////////// -// FILE: resource.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "resource.hpp" -// #include "heap.hpp" -#include - -namespace mtlpp -{ - ns::String Resource::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - CpuCacheMode Resource::GetCpuCacheMode() const - { - Validate(); - return CpuCacheMode([(__bridge id)m_ptr cpuCacheMode]); - } - - StorageMode Resource::GetStorageMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return StorageMode([(__bridge id)m_ptr storageMode]); -#else - return StorageMode(0); -#endif - } - - Heap Resource::GetHeap() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr heap] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - bool Resource::IsAliasable() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - return [(__bridge id)m_ptr isAliasable]; -#else - return false; -#endif - } - - void Resource::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge id)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - PurgeableState Resource::SetPurgeableState(PurgeableState state) - { - Validate(); - return PurgeableState([(__bridge id)m_ptr setPurgeableState:MTLPurgeableState(state)]); - } - - void Resource::MakeAliasable() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_IOS(10_0) - [(__bridge id)m_ptr makeAliasable]; -#endif - } -} - -////////////////////////////////////// -// FILE: sampler.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "sampler.hpp" -#include - -namespace mtlpp -{ - SamplerDescriptor::SamplerDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLSamplerDescriptor alloc] init] }) - { - } - - SamplerMinMagFilter SamplerDescriptor::GetMinFilter() const - { - Validate(); - return SamplerMinMagFilter([(__bridge MTLSamplerDescriptor*)m_ptr minFilter]); - } - - SamplerMinMagFilter SamplerDescriptor::GetMagFilter() const - { - Validate(); - return SamplerMinMagFilter([(__bridge MTLSamplerDescriptor*)m_ptr magFilter]); - } - - SamplerMipFilter SamplerDescriptor::GetMipFilter() const - { - Validate(); - return SamplerMipFilter([(__bridge MTLSamplerDescriptor*)m_ptr mipFilter]); - } - - uint32_t SamplerDescriptor::GetMaxAnisotropy() const - { - Validate(); - return uint32_t([(__bridge MTLSamplerDescriptor*)m_ptr maxAnisotropy]); - } - - SamplerAddressMode SamplerDescriptor::GetSAddressMode() const - { - Validate(); - return SamplerAddressMode([(__bridge MTLSamplerDescriptor*)m_ptr sAddressMode]); - } - - SamplerAddressMode SamplerDescriptor::GetTAddressMode() const - { - Validate(); - return SamplerAddressMode([(__bridge MTLSamplerDescriptor*)m_ptr tAddressMode]); - } - - SamplerAddressMode SamplerDescriptor::GetRAddressMode() const - { - Validate(); - return SamplerAddressMode([(__bridge MTLSamplerDescriptor*)m_ptr rAddressMode]); - } - - SamplerBorderColor SamplerDescriptor::GetBorderColor() const - { -#if MTLPP_IS_AVAILABLE_MAC(10_12) - return SamplerBorderColor([(__bridge MTLSamplerDescriptor*)m_ptr borderColor]); -#else - return SamplerBorderColor(0); -#endif - } - - bool SamplerDescriptor::IsNormalizedCoordinates() const - { - Validate(); - return [(__bridge MTLSamplerDescriptor*)m_ptr normalizedCoordinates]; - } - - float SamplerDescriptor::GetLodMinClamp() const - { - Validate(); - return [(__bridge MTLSamplerDescriptor*)m_ptr lodMinClamp]; - } - - float SamplerDescriptor::GetLodMaxClamp() const - { - Validate(); - return [(__bridge MTLSamplerDescriptor*)m_ptr lodMaxClamp]; - } - - CompareFunction SamplerDescriptor::GetCompareFunction() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return CompareFunction([(__bridge MTLSamplerDescriptor*)m_ptr compareFunction]); -#else - return CompareFunction(0); -#endif - } - - ns::String SamplerDescriptor::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLSamplerDescriptor*)m_ptr label] }; - } - - void SamplerDescriptor::SetMinFilter(SamplerMinMagFilter minFilter) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setMinFilter:MTLSamplerMinMagFilter(minFilter)]; - } - - void SamplerDescriptor::SetMagFilter(SamplerMinMagFilter magFilter) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setMagFilter:MTLSamplerMinMagFilter(magFilter)]; - } - - void SamplerDescriptor::SetMipFilter(SamplerMipFilter mipFilter) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setMipFilter:MTLSamplerMipFilter(mipFilter)]; - } - - void SamplerDescriptor::SetMaxAnisotropy(uint32_t maxAnisotropy) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setMaxAnisotropy:maxAnisotropy]; - } - - void SamplerDescriptor::SetSAddressMode(SamplerAddressMode sAddressMode) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setSAddressMode:MTLSamplerAddressMode(sAddressMode)]; - } - - void SamplerDescriptor::SetTAddressMode(SamplerAddressMode tAddressMode) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setTAddressMode:MTLSamplerAddressMode(tAddressMode)]; - } - - void SamplerDescriptor::SetRAddressMode(SamplerAddressMode rAddressMode) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setRAddressMode:MTLSamplerAddressMode(rAddressMode)]; - } - - void SamplerDescriptor::SetBorderColor(SamplerBorderColor borderColor) - { -#if MTLPP_IS_AVAILABLE_MAC(10_12) - [(__bridge MTLSamplerDescriptor*)m_ptr setBorderColor:MTLSamplerBorderColor(borderColor)]; -#endif - } - - void SamplerDescriptor::SetNormalizedCoordinates(bool normalizedCoordinates) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setNormalizedCoordinates:normalizedCoordinates]; - } - - void SamplerDescriptor::SetLodMinClamp(float lodMinClamp) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setLodMinClamp:lodMinClamp]; - } - - void SamplerDescriptor::SetLodMaxClamp(float lodMaxClamp) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setLodMaxClamp:lodMaxClamp]; - } - - void SamplerDescriptor::SetCompareFunction(CompareFunction compareFunction) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge MTLSamplerDescriptor*)m_ptr setCompareFunction:MTLCompareFunction(compareFunction)]; -#endif - } - - void SamplerDescriptor::SetLabel(const ns::String& label) - { - Validate(); - [(__bridge MTLSamplerDescriptor*)m_ptr setLabel:(__bridge NSString*)label.GetPtr()]; - } - - ns::String SamplerState::GetLabel() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr label] }; - } - - Device SamplerState::GetDevice() const - { - Validate(); - return ns::Handle { (__bridge void*)[(__bridge id)m_ptr device] }; - } -} - - -////////////////////////////////////// -// FILE: stage_input_output_descriptor.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "stage_input_output_descriptor.hpp" -#if MTLPP_IS_AVAILABLE(10_12, 10_0) -# include -#endif - -namespace mtlpp -{ - BufferLayoutDescriptor::BufferLayoutDescriptor() : -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - ns::Object(ns::Handle{ (__bridge void*)[[MTLBufferLayoutDescriptor alloc] init] }) -#else - ns::Object(ns::Handle{ nullptr }) -#endif - { - } - - uint32_t BufferLayoutDescriptor::GetStride() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLBufferLayoutDescriptor*)m_ptr stride]); -#else - return 0; -#endif - } - - StepFunction BufferLayoutDescriptor::GetStepFunction() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return StepFunction([(__bridge MTLBufferLayoutDescriptor*)m_ptr stepFunction]); -#else - return StepFunction(0); -#endif - } - - uint32_t BufferLayoutDescriptor::GetStepRate() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLBufferLayoutDescriptor*)m_ptr stepRate]); -#else - return 0; -#endif - } - - void BufferLayoutDescriptor::SetStride(uint32_t stride) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLBufferLayoutDescriptor*)m_ptr setStride:stride]; -#endif - } - - void BufferLayoutDescriptor::SetStepFunction(StepFunction stepFunction) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLBufferLayoutDescriptor*)m_ptr setStepFunction:MTLStepFunction(stepFunction)]; -#endif - } - - void BufferLayoutDescriptor::SetStepRate(uint32_t stepRate) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLBufferLayoutDescriptor*)m_ptr setStepRate:stepRate]; -#endif - } - - AttributeDescriptor::AttributeDescriptor() : -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - ns::Object(ns::Handle{ (__bridge void*)[[MTLAttributeDescriptor alloc] init] }) -#else - ns::Object(ns::Handle{ nullptr }) -#endif - { - } - - AttributeFormat AttributeDescriptor::GetFormat() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return AttributeFormat([(__bridge MTLAttributeDescriptor*)m_ptr format]); -#else - return AttributeFormat(0); -#endif - } - - uint32_t AttributeDescriptor::GetOffset() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLAttributeDescriptor*)m_ptr offset]); -#else - return 0; -#endif - } - - uint32_t AttributeDescriptor::GetBufferIndex() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLAttributeDescriptor*)m_ptr bufferIndex]); -#else - return 0; -#endif - } - - void AttributeDescriptor::SetFormat(AttributeFormat format) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLAttributeDescriptor*)m_ptr setFormat:MTLAttributeFormat(format)]; -#endif - } - - void AttributeDescriptor::SetOffset(uint32_t offset) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLAttributeDescriptor*)m_ptr setOffset:offset]; -#endif - } - - void AttributeDescriptor::SetBufferIndex(uint32_t bufferIndex) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLAttributeDescriptor*)m_ptr setBufferIndex:bufferIndex]; -#endif - } - - StageInputOutputDescriptor::StageInputOutputDescriptor() : -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - ns::Object(ns::Handle{ (__bridge void*)[[MTLStageInputOutputDescriptor alloc] init] }) -#else - ns::Object(ns::Handle{ nullptr }) -#endif - { - } - - ns::Array StageInputOutputDescriptor::GetLayouts() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge MTLStageInputOutputDescriptor*)m_ptr layouts] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - ns::Array StageInputOutputDescriptor::GetAttributes() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ (__bridge void*)[(__bridge MTLStageInputOutputDescriptor*)m_ptr attributes] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - IndexType StageInputOutputDescriptor::GetIndexType() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return IndexType([(__bridge MTLStageInputOutputDescriptor*)m_ptr indexType]); -#else - return IndexType(0); -#endif - } - - uint32_t StageInputOutputDescriptor::GetIndexBufferIndex() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - return uint32_t([(__bridge MTLStageInputOutputDescriptor*)m_ptr indexBufferIndex]); -#else - return 0; -#endif - } - - void StageInputOutputDescriptor::SetIndexType(IndexType indexType) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLStageInputOutputDescriptor*)m_ptr setIndexType:MTLIndexType(indexType)]; -#endif - } - - void StageInputOutputDescriptor::SetIndexBufferIndex(uint32_t indexBufferIndex) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLStageInputOutputDescriptor*)m_ptr setIndexBufferIndex:indexBufferIndex]; -#endif - } - - void StageInputOutputDescriptor::Reset() - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 10_0) - [(__bridge MTLStageInputOutputDescriptor*)m_ptr reset]; -#endif - } -} - - -////////////////////////////////////// -// FILE: texture.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "texture.hpp" -#include - -namespace mtlpp -{ - TextureDescriptor::TextureDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLTextureDescriptor alloc] init] }) - { - } - - TextureDescriptor TextureDescriptor::Texture2DDescriptor(PixelFormat pixelFormat, uint32_t width, uint32_t height, bool mipmapped) - { - return ns::Handle{ (__bridge void*)[MTLTextureDescriptor texture2DDescriptorWithPixelFormat:MTLPixelFormat(pixelFormat) - width:width - height:height - mipmapped:mipmapped] }; - } - - TextureDescriptor TextureDescriptor::TextureCubeDescriptor(PixelFormat pixelFormat, uint32_t size, bool mipmapped) - { - return ns::Handle{ (__bridge void*)[MTLTextureDescriptor textureCubeDescriptorWithPixelFormat:MTLPixelFormat(pixelFormat) - size:size - mipmapped:mipmapped] }; - } - - TextureType TextureDescriptor::GetTextureType() const - { - Validate(); - return TextureType([(__bridge MTLTextureDescriptor*)m_ptr textureType]); - } - - PixelFormat TextureDescriptor::GetPixelFormat() const - { - Validate(); - return PixelFormat([(__bridge MTLTextureDescriptor*)m_ptr pixelFormat]); - } - - uint32_t TextureDescriptor::GetWidth() const - { - Validate(); - return uint32_t([(__bridge MTLTextureDescriptor*)m_ptr width]); - } - - uint32_t TextureDescriptor::GetHeight() const - { - Validate(); - return uint32_t([(__bridge MTLTextureDescriptor*)m_ptr height]); - } - - uint32_t TextureDescriptor::GetDepth() const - { - Validate(); - return uint32_t([(__bridge MTLTextureDescriptor*)m_ptr depth]); - } - - uint32_t TextureDescriptor::GetMipmapLevelCount() const - { - Validate(); - return uint32_t([(__bridge MTLTextureDescriptor*)m_ptr mipmapLevelCount]); - } - - uint32_t TextureDescriptor::GetSampleCount() const - { - Validate(); - return uint32_t([(__bridge MTLTextureDescriptor*)m_ptr sampleCount]); - } - - uint32_t TextureDescriptor::GetArrayLength() const - { - Validate(); - return uint32_t([(__bridge MTLTextureDescriptor*)m_ptr arrayLength]); - } - - ResourceOptions TextureDescriptor::GetResourceOptions() const - { - Validate(); - return ResourceOptions([(__bridge MTLTextureDescriptor*)m_ptr resourceOptions]); - } - - CpuCacheMode TextureDescriptor::GetCpuCacheMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return CpuCacheMode([(__bridge MTLTextureDescriptor*)m_ptr cpuCacheMode]); -#else - return CpuCacheMode(0); -#endif - } - - StorageMode TextureDescriptor::GetStorageMode() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return StorageMode([(__bridge MTLTextureDescriptor*)m_ptr storageMode]); -#else - return StorageMode(0); -#endif - } - - TextureUsage TextureDescriptor::GetUsage() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return TextureUsage([(__bridge MTLTextureDescriptor*)m_ptr usage]); -#else - return TextureUsage(0); -#endif - } - - void TextureDescriptor::SetTextureType(TextureType textureType) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setTextureType:MTLTextureType(textureType)]; - } - - void TextureDescriptor::SetPixelFormat(PixelFormat pixelFormat) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setPixelFormat:MTLPixelFormat(pixelFormat)]; - } - - void TextureDescriptor::SetWidth(uint32_t width) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setWidth:width]; - } - - void TextureDescriptor::SetHeight(uint32_t height) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setHeight:height]; - } - - void TextureDescriptor::SetDepth(uint32_t depth) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setDepth:depth]; - } - - void TextureDescriptor::SetMipmapLevelCount(uint32_t mipmapLevelCount) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setMipmapLevelCount:mipmapLevelCount]; - } - - void TextureDescriptor::SetSampleCount(uint32_t sampleCount) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setSampleCount:sampleCount]; - } - - void TextureDescriptor::SetArrayLength(uint32_t arrayLength) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setArrayLength:arrayLength]; - } - - void TextureDescriptor::SetResourceOptions(ResourceOptions resourceOptions) - { - Validate(); - [(__bridge MTLTextureDescriptor*)m_ptr setResourceOptions:MTLResourceOptions(resourceOptions)]; - } - - void TextureDescriptor::SetCpuCacheMode(CpuCacheMode cpuCacheMode) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge MTLTextureDescriptor*)m_ptr setCpuCacheMode:MTLCPUCacheMode(cpuCacheMode)]; -#endif - } - - void TextureDescriptor::SetStorageMode(StorageMode storageMode) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge MTLTextureDescriptor*)m_ptr setStorageMode:MTLStorageMode(storageMode)]; -#endif - } - - void TextureDescriptor::SetUsage(TextureUsage usage) - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - [(__bridge MTLTextureDescriptor*)m_ptr setUsage:MTLTextureUsage(usage)]; -#endif - } - - Resource Texture::GetRootResource() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 8_0) -# if MTLPP_IS_AVAILABLE(10_12, 10_0) - return ns::Handle{ nullptr }; -# else - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr rootResource] }; -# endif -#else - return ns::Handle{ nullptr }; -#endif - } - - Texture Texture::GetParentTexture() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr parentTexture] }; -#else - return ns::Handle{ nullptr }; -#endif - } - - uint32_t Texture::GetParentRelativeLevel() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return uint32_t([(__bridge id)m_ptr parentRelativeLevel]); -#else - return 0; -#endif - - } - - uint32_t Texture::GetParentRelativeSlice() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_11, 9_0) - return uint32_t([(__bridge id)m_ptr parentRelativeSlice]); -#else - return 0; -#endif - - } - - Buffer Texture::GetBuffer() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 9_0) - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr buffer] }; -#else - return ns::Handle{ nullptr }; -#endif - - } - - uint32_t Texture::GetBufferOffset() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 9_0) - return uint32_t([(__bridge id)m_ptr bufferOffset]); -#else - return 0; -#endif - - } - - uint32_t Texture::GetBufferBytesPerRow() const - { - Validate(); -#if MTLPP_IS_AVAILABLE(10_12, 9_0) - return uint32_t([(__bridge id)m_ptr bufferBytesPerRow]); -#else - return 0; -#endif - - } - - uint32_t Texture::GetIOSurfacePlane() const - { - Validate(); -#if MTLPP_IS_AVAILABLE_MAC(10_11) - return uint32_t([(__bridge id)m_ptr iosurfacePlane]); -#else - return 0; -#endif - } - - TextureType Texture::GetTextureType() const - { - Validate(); - return TextureType([(__bridge id)m_ptr textureType]); - } - - PixelFormat Texture::GetPixelFormat() const - { - Validate(); - return PixelFormat([(__bridge id)m_ptr pixelFormat]); - } - - uint32_t Texture::GetWidth() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr width]); - } - - uint32_t Texture::GetHeight() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr height]); - } - - uint32_t Texture::GetDepth() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr depth]); - } - - uint32_t Texture::GetMipmapLevelCount() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr mipmapLevelCount]); - } - - uint32_t Texture::GetSampleCount() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr sampleCount]); - } - - uint32_t Texture::GetArrayLength() const - { - Validate(); - return uint32_t([(__bridge id)m_ptr arrayLength]); - } - - TextureUsage Texture::GetUsage() const - { - Validate(); - return TextureUsage([(__bridge id)m_ptr usage]); - } - - bool Texture::IsFrameBufferOnly() const - { - Validate(); - return [(__bridge id)m_ptr isFramebufferOnly]; - } - - void Texture::GetBytes(void* pixelBytes, uint32_t bytesPerRow, uint32_t bytesPerImage, const Region& fromRegion, uint32_t mipmapLevel, uint32_t slice) - { - Validate(); - [(__bridge id)m_ptr getBytes:pixelBytes - bytesPerRow:bytesPerRow - bytesPerImage:bytesPerImage - fromRegion:MTLRegionMake3D(fromRegion.Origin.X, fromRegion.Origin.Y, fromRegion.Origin.Z, fromRegion.Size.Width, fromRegion.Size.Height, fromRegion.Size.Depth) - mipmapLevel:mipmapLevel - slice:slice]; - } - - void Texture::Replace(const Region& region, uint32_t mipmapLevel, uint32_t slice, void* pixelBytes, uint32_t bytesPerRow, uint32_t bytesPerImage) - { - Validate(); - [(__bridge id)m_ptr replaceRegion:MTLRegionMake3D(region.Origin.X, region.Origin.Y, region.Origin.Z, region.Size.Width, region.Size.Height, region.Size.Depth) - mipmapLevel:mipmapLevel - slice:slice - withBytes:pixelBytes - bytesPerRow:bytesPerRow - bytesPerImage:bytesPerImage]; - } - - void Texture::GetBytes(void* pixelBytes, uint32_t bytesPerRow, const Region& fromRegion, uint32_t mipmapLevel) - { - Validate(); - [(__bridge id)m_ptr getBytes:pixelBytes - bytesPerRow:bytesPerRow - fromRegion:MTLRegionMake3D(fromRegion.Origin.X, fromRegion.Origin.Y, fromRegion.Origin.Z, fromRegion.Size.Width, fromRegion.Size.Height, fromRegion.Size.Depth) - mipmapLevel:mipmapLevel]; - } - - void Texture::Replace(const Region& region, uint32_t mipmapLevel, void* pixelBytes, uint32_t bytesPerRow) - { - Validate(); - [(__bridge id)m_ptr replaceRegion:MTLRegionMake3D(region.Origin.X, region.Origin.Y, region.Origin.Z, region.Size.Width, region.Size.Height, region.Size.Depth) - mipmapLevel:mipmapLevel - withBytes:pixelBytes - bytesPerRow:bytesPerRow]; - } - - Texture Texture::NewTextureView(PixelFormat pixelFormat) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newTextureViewWithPixelFormat:MTLPixelFormat(pixelFormat)] }; - } - - Texture Texture::NewTextureView(PixelFormat pixelFormat, TextureType textureType, const ns::Range& mipmapLevelRange, const ns::Range& sliceRange) - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge id)m_ptr newTextureViewWithPixelFormat:MTLPixelFormat(pixelFormat) - textureType:MTLTextureType(textureType) - levels:NSMakeRange(mipmapLevelRange.Location, mipmapLevelRange.Length) - slices:NSMakeRange(sliceRange.Location, sliceRange.Length)] }; - } -} - -////////////////////////////////////// -// FILE: vertex_descriptor.mm -////////////////////////////////////// -/* - * Copyright 2016 Nikolay Aleksiev. All rights reserved. - * License: https://github.com/naleksiev/mtlpp/blob/master/LICENSE - */ - -// #include "vertex_descriptor.hpp" -#include - -namespace mtlpp -{ - VertexBufferLayoutDescriptor::VertexBufferLayoutDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLVertexBufferLayoutDescriptor alloc] init] }) - { - } - - uint32_t VertexBufferLayoutDescriptor::GetStride() const - { - Validate(); - return uint32_t([(__bridge MTLVertexBufferLayoutDescriptor*)m_ptr stride]); - } - - uint32_t VertexBufferLayoutDescriptor::GetStepRate() const - { - Validate(); - return uint32_t([(__bridge MTLVertexBufferLayoutDescriptor*)m_ptr stepRate]); - } - - VertexStepFunction VertexBufferLayoutDescriptor::GetStepFunction() const - { - Validate(); - return VertexStepFunction([(__bridge MTLVertexBufferLayoutDescriptor*)m_ptr stepFunction]); - } - - void VertexBufferLayoutDescriptor::SetStride(uint32_t stride) - { - Validate(); - [(__bridge MTLVertexBufferLayoutDescriptor*)m_ptr setStride:stride]; - } - - void VertexBufferLayoutDescriptor::SetStepRate(uint32_t stepRate) - { - Validate(); - [(__bridge MTLVertexBufferLayoutDescriptor*)m_ptr setStepRate:stepRate]; - } - - void VertexBufferLayoutDescriptor::SetStepFunction(VertexStepFunction stepFunction) - { - Validate(); - [(__bridge MTLVertexBufferLayoutDescriptor*)m_ptr setStepFunction:MTLVertexStepFunction(stepFunction)]; - } - - VertexAttributeDescriptor::VertexAttributeDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLVertexAttributeDescriptor alloc] init] }) - { - } - - VertexFormat VertexAttributeDescriptor::GetFormat() const - { - Validate(); - return VertexFormat([(__bridge MTLVertexAttributeDescriptor*)m_ptr format]); - } - - uint32_t VertexAttributeDescriptor::GetOffset() const - { - Validate(); - return uint32_t([(__bridge MTLVertexAttributeDescriptor*)m_ptr offset]); - } - - uint32_t VertexAttributeDescriptor::GetBufferIndex() const - { - Validate(); - return uint32_t([(__bridge MTLVertexAttributeDescriptor*)m_ptr bufferIndex]); - } - - void VertexAttributeDescriptor::SetFormat(VertexFormat format) - { - Validate(); - [(__bridge MTLVertexAttributeDescriptor*)m_ptr setFormat:MTLVertexFormat(format)]; - } - - void VertexAttributeDescriptor::SetOffset(uint32_t offset) - { - Validate(); - [(__bridge MTLVertexAttributeDescriptor*)m_ptr setOffset:offset]; - } - - void VertexAttributeDescriptor::SetBufferIndex(uint32_t bufferIndex) - { - Validate(); - [(__bridge MTLVertexAttributeDescriptor*)m_ptr setBufferIndex:bufferIndex]; - } - - VertexDescriptor::VertexDescriptor() : - ns::Object(ns::Handle{ (__bridge void*)[[MTLVertexDescriptor alloc] init] }) - { - } - - ns::Array VertexDescriptor::GetLayouts() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLVertexDescriptor*)m_ptr layouts] }; - } - - ns::Array VertexDescriptor::GetAttributes() const - { - Validate(); - return ns::Handle{ (__bridge void*)[(__bridge MTLVertexDescriptor*)m_ptr attributes] }; - } - - void VertexDescriptor::Reset() - { - Validate(); - [(__bridge MTLVertexDescriptor*)m_ptr reset]; - } -} - diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp deleted file mode 100644 index 361377f8903..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp +++ /dev/null @@ -1,11108 +0,0 @@ -// dear imgui, v1.53 WIP -// (main code and documentation) - -// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code. -// Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase. -// Get latest version at https://github.com/ocornut/imgui -// Releases change-log at https://github.com/ocornut/imgui/releases -// Gallery (please post your screenshots/video there!): https://github.com/ocornut/imgui/issues/1269 -// Developed by Omar Cornut and every direct or indirect contributors to the GitHub. -// This library is free but I need your support to sustain development and maintenance. -// If you work for a company, please consider financial support, e.g: https://www.patreon.com/imgui - -/* - - Index - - MISSION STATEMENT - - END-USER GUIDE - - PROGRAMMER GUIDE (read me!) - - Read first - - How to update to a newer version of Dear ImGui - - Getting started with integrating Dear ImGui in your code/engine - - API BREAKING CHANGES (read me when you update!) - - ISSUES & TODO LIST - - FREQUENTLY ASKED QUESTIONS (FAQ), TIPS - - How can I help? - - What is ImTextureID and how do I display an image? - - I integrated Dear ImGui in my engine and the text or lines are blurry.. - - I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around.. - - How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on labels/IDs. - - How can I tell when Dear ImGui wants my mouse/keyboard inputs VS when I can pass them to my application? - - How can I load a different font than the default? - - How can I easily use icons in my application? - - How can I load multiple fonts? - - How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic? - - How can I preserve my Dear ImGui context across reloading a DLL? (loss of the global/static variables) - - How can I use the drawing facilities without an ImGui window? (using ImDrawList API) - - ISSUES & TODO-LIST - - CODE - - - MISSION STATEMENT - ================= - - - Easy to use to create code-driven and data-driven tools - - Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools - - Easy to hack and improve - - Minimize screen real-estate usage - - Minimize setup and maintenance - - Minimize state storage on user side - - Portable, minimize dependencies, run on target (consoles, phones, etc.) - - Efficient runtime and memory consumption (NB- we do allocate when "growing" content e.g. creating a window, opening a tree node - for the first time, etc. but a typical frame won't allocate anything) - - Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes: - - Doesn't look fancy, doesn't animate - - Limited layout features, intricate layouts are typically crafted in code - - - END-USER GUIDE - ============== - - - Double-click on title bar to collapse window. - - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin(). - - Click and drag on lower right corner to resize window (double-click to auto fit window to its contents). - - Click and drag on any empty space to move window. - - TAB/SHIFT+TAB to cycle through keyboard editable fields. - - CTRL+Click on a slider or drag box to input value as text. - - Use mouse wheel to scroll. - - Text editor: - - Hold SHIFT or use mouse to select text. - - CTRL+Left/Right to word jump. - - CTRL+Shift+Left/Right to select words. - - CTRL+A our Double-Click to select all. - - CTRL+X,CTRL+C,CTRL+V to use OS clipboard/ - - CTRL+Z,CTRL+Y to undo/redo. - - ESCAPE to revert text to its original value. - - You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!) - - Controls are automatically adjusted for OSX to match standard OSX text editing operations. - - - PROGRAMMER GUIDE - ================ - - READ FIRST - - - Read the FAQ below this section! - - Your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention - on your side, no state duplication, less sync, less bugs. - - Call and read ImGui::ShowTestWindow() for demo code demonstrating most features. - - You can learn about immediate-mode gui principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861 - - HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI - - - Overwrite all the sources files except for imconfig.h (if you have made modification to your copy of imconfig.h) - - Read the "API BREAKING CHANGES" section (below). This is where we list occasional API breaking changes. - If a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed from the public API. - If you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it. - Please report any issue to the GitHub page! - - Try to keep your copy of dear imgui reasonably up to date. - - GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE - - - Add the Dear ImGui source files to your projects, using your preferred build system. - It is recommended you build the .cpp files as part of your project and not as a library. - - You can later customize the imconfig.h file to tweak some compilation time behavior, such as integrating imgui types with your own maths types. - - See examples/ folder for standalone sample applications. - - You may be able to grab and copy a ready made imgui_impl_*** file from the examples/. - - When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them. - - - Init: retrieve the ImGuiIO structure with ImGui::GetIO() and fill the fields marked 'Settings': at minimum you need to set io.DisplaySize - (application resolution). Later on you will fill your keyboard mapping, clipboard handlers, and other advanced features but for a basic - integration you don't need to worry about it all. - - Init: call io.Fonts->GetTexDataAsRGBA32(...), it will build the font atlas texture, then load the texture pixels into graphics memory. - - Every frame: - - In your main loop as early a possible, fill the IO fields marked 'Input' (e.g. mouse position, buttons, keyboard info, etc.) - - Call ImGui::NewFrame() to begin the frame - - You can use any ImGui function you want between NewFrame() and Render() - - Call ImGui::Render() as late as you can to end the frame and finalize render data. it will call your io.RenderDrawListFn handler. - (Even if you don't render, call Render() and ignore the callback, or call EndFrame() instead. Otherwhise some features will break) - - All rendering information are stored into command-lists until ImGui::Render() is called. - - Dear ImGui never touches or knows about your GPU state. the only function that knows about GPU is the RenderDrawListFn handler that you provide. - - Effectively it means you can create widgets at any time in your code, regardless of considerations of being in "update" vs "render" phases - of your own application. - - Refer to the examples applications in the examples/ folder for instruction on how to setup your code. - - A minimal application skeleton may be: - - // Application init - ImGuiIO& io = ImGui::GetIO(); - io.DisplaySize.x = 1920.0f; - io.DisplaySize.y = 1280.0f; - io.RenderDrawListsFn = MyRenderFunction; // Setup a render function, or set to NULL and call GetDrawData() after Render() to access render data. - // TODO: Fill others settings of the io structure later. - - // Load texture atlas (there is a default font so you don't need to care about choosing a font yet) - unsigned char* pixels; - int width, height; - io.Fonts->GetTexDataAsRGBA32(pixels, &width, &height); - // TODO: At this points you've got the texture data and you need to upload that your your graphic system: - MyTexture* texture = MyEngine::CreateTextureFromMemoryPixels(pixels, width, height, TEXTURE_TYPE_RGBA) - // TODO: Store your texture pointer/identifier (whatever your engine uses) in 'io.Fonts->TexID'. This will be passed back to your via the renderer. - io.Fonts->TexID = (void*)texture; - - // Application main loop - while (true) - { - // Setup low-level inputs (e.g. on Win32, GetKeyboardState(), or write to those fields from your Windows message loop handlers, etc.) - ImGuiIO& io = ImGui::GetIO(); - io.DeltaTime = 1.0f/60.0f; - io.MousePos = mouse_pos; - io.MouseDown[0] = mouse_button_0; - io.MouseDown[1] = mouse_button_1; - - // Call NewFrame(), after this point you can use ImGui::* functions anytime - ImGui::NewFrame(); - - // Most of your application code here - MyGameUpdate(); // may use any ImGui functions, e.g. ImGui::Begin("My window"); ImGui::Text("Hello, world!"); ImGui::End(); - MyGameRender(); // may use any ImGui functions as well! - - // Render & swap video buffers - ImGui::Render(); - SwapBuffers(); - } - - - A minimal render function skeleton may be: - - void void MyRenderFunction(ImDrawData* draw_data)(ImDrawData* draw_data) - { - // TODO: Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled - // TODO: Setup viewport, orthographic projection matrix - // TODO: Setup shader: vertex { float2 pos, float2 uv, u32 color }, fragment shader sample color from 1 texture, multiply by vertex color. - for (int n = 0; n < draw_data->CmdListsCount; n++) - { - const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data; // vertex buffer generated by ImGui - const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data; // index buffer generated by ImGui - for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++) - { - const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i]; - if (pcmd->UserCallback) - { - pcmd->UserCallback(cmd_list, pcmd); - } - else - { - // The texture for the draw call is specified by pcmd->TextureId. - // The vast majority of draw calls with use the imgui texture atlas, which value you have set yourself during initialization. - MyEngineBindTexture(pcmd->TextureId); - - // We are using scissoring to clip some objects. All low-level graphics API supports it. - // If your engine doesn't support scissoring yet, you will get some small glitches (some elements outside their bounds) which you can fix later. - MyEngineScissor((int)pcmd->ClipRect.x, (int)pcmd->ClipRect.y, (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y)); - - // Render 'pcmd->ElemCount/3' indexed triangles. - // By default the indices ImDrawIdx are 16-bits, you can change them to 32-bits if your engine doesn't support 16-bits indices. - MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer); - } - idx_buffer += pcmd->ElemCount; - } - } - } - - - The examples/ folders contains many functional implementation of the pseudo-code above. - - When calling NewFrame(), the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'io.WantTextInput' flags are updated. - They tell you if ImGui intends to use your inputs. So for example, if 'io.WantCaptureMouse' is set you would typically want to hide - mouse inputs from the rest of your application. Read the FAQ below for more information about those flags. - - - - API BREAKING CHANGES - ==================== - - Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix. - Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code. - Also read releases logs https://github.com/ocornut/imgui/releases for more details. - - - 2017/11/27 (1.53) - renamed ImGuiTextBuffer::append() helper to appendf(), appendv() to appendfv(). If you copied the 'Log' demo in your code, it uses appendv() so that needs to be renamed. - - 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up. - Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions. - - 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency. - - 2017/11/18 (1.53) - Style: renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg. - - 2017/11/18 (1.53) - Style: renamed style.ChildWindowRounding to style.ChildRounding, ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding. - - 2017/11/02 (1.53) - marked IsRootWindowOrAnyChildHovered() as obsolete is favor of using IsWindowHovered(ImGuiHoveredFlags_FlattenChilds); - - 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency. - - 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it. - - 2017/10/20 (1.52) - marked IsItemHoveredRect()/IsMouseHoveringWindow() as obsolete, in favor of using the newly introduced flags for IsItemHovered() and IsWindowHovered(). See https://github.com/ocornut/imgui/issues/1382 for details. - removed the IsItemRectHovered()/IsWindowRectHovered() names introduced in 1.51 since they were merely more consistent names for the two functions we are now obsoleting. - - 2017/10/17 (1.52) - marked the old 5-parameters version of Begin() as obsolete (still available). Use SetNextWindowSize()+Begin() instead! - - 2017/10/11 (1.52) - renamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete). - - 2017/09/25 (1.52) - removed SetNextWindowPosCenter() because SetNextWindowPos() now has the optional pivot information to do the same and more. Kept redirection function (will obsolete). - - 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your binding if you need to support unavailable mouse, make sure to replace "io.MousePos = ImVec2(-1,-1)" with "io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)". - - 2017/08/22 (1.51) - renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete). -> (1.52) use IsItemHovered(ImGuiHoveredFlags_RectOnly)! - - renamed IsMouseHoveringAnyWindow() to IsAnyWindowHovered() for consistency. Kept inline redirection function (will obsolete). - - renamed IsMouseHoveringWindow() to IsWindowRectHovered() for consistency. Kept inline redirection function (will obsolete). - - 2017/08/20 (1.51) - renamed GetStyleColName() to GetStyleColorName() for consistency. - - 2017/08/20 (1.51) - added PushStyleColor(ImGuiCol idx, ImU32 col) overload, which _might_ cause an "ambiguous call" compilation error if you are using ImColor() with implicit cast. Cast to ImU32 or ImVec4 explicily to fix. - - 2017/08/15 (1.51) - marked the weird IMGUI_ONCE_UPON_A_FRAME helper macro as obsolete. prefer using the more explicit ImGuiOnceUponAFrame. - - 2017/08/15 (1.51) - changed parameter order for BeginPopupContextWindow() from (const char*,int buttons,bool also_over_items) to (const char*,int buttons,bool also_over_items). Note that most calls relied on default parameters completely. - - 2017/08/13 (1.51) - renamed ImGuiCol_Columns*** to ImGuiCol_Separator***. Kept redirection enums (will obsolete). - - 2017/08/11 (1.51) - renamed ImGuiSetCond_*** types and flags to ImGuiCond_***. Kept redirection enums (will obsolete). - - 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton(). - - 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu. - - changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under "Color/Picker Widgets", to understand the various new options. - - changed prototype of rarely used 'ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)' to 'ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0))' - - 2017/07/20 (1.51) - removed IsPosHoveringAnyWindow(ImVec2), which was partly broken and misleading. ASSERT + redirect user to io.WantCaptureMouse - - 2017/05/26 (1.50) - removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset. - - 2017/05/01 (1.50) - renamed ImDrawList::PathFill() (rarely used directly) to ImDrawList::PathFillConvex() for clarity. - - 2016/11/06 (1.50) - BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild(). - - 2016/10/15 (1.50) - avoid 'void* user_data' parameter to io.SetClipboardTextFn/io.GetClipboardTextFn pointers. We pass io.ClipboardUserData to it. - - 2016/09/25 (1.50) - style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc. - - 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal. - - 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore. - If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. - However if your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar. - This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color. - ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col) - { - float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a; - return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a); - } - If this is confusing, pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color. - - 2016/05/07 (1.49) - removed confusing set of GetInternalState(), GetInternalStateSize(), SetInternalState() functions. Now using CreateContext(), DestroyContext(), GetCurrentContext(), SetCurrentContext(). - - 2016/05/02 (1.49) - renamed SetNextTreeNodeOpened() to SetNextTreeNodeOpen(), no redirection. - - 2016/05/01 (1.49) - obsoleted old signature of CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false) as extra parameters were badly designed and rarely used. You can replace the "default_open = true" flag in new API with CollapsingHeader(label, ImGuiTreeNodeFlags_DefaultOpen). - - 2016/04/26 (1.49) - changed ImDrawList::PushClipRect(ImVec4 rect) to ImDraw::PushClipRect(Imvec2 min,ImVec2 max,bool intersect_with_current_clip_rect=false). Note that higher-level ImGui::PushClipRect() is preferable because it will clip at logic/widget level, whereas ImDrawList::PushClipRect() only affect your renderer. - - 2016/04/03 (1.48) - removed style.WindowFillAlphaDefault setting which was redundant. Bake default BG alpha inside style.Colors[ImGuiCol_WindowBg] and all other Bg color values. (ref github issue #337). - - 2016/04/03 (1.48) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg, used by popups/menus and tooltips. popups/menus were previously using ImGuiCol_WindowBg. (ref github issue #337) - - 2016/03/21 (1.48) - renamed GetWindowFont() to GetFont(), GetWindowFontSize() to GetFontSize(). Kept inline redirection function (will obsolete). - - 2016/03/02 (1.48) - InputText() completion/history/always callbacks: if you modify the text buffer manually (without using DeleteChars()/InsertChars() helper) you need to maintain the BufTextLen field. added an assert. - - 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you. - - 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis. - - 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete. - - 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position. - GetCursorPos()/SetCursorPos() functions now include the scrolled amount. It shouldn't affect the majority of users, but take note that SetCursorPosX(100.0f) puts you at +100 from the starting x position which may include scrolling, not at +100 from the window left side. - GetContentRegionMax()/GetWindowContentRegionMin()/GetWindowContentRegionMax() functions allow include the scrolled amount. Typically those were used in cases where no scrolling would happen so it may not be a problem, but watch out! - - 2015/08/29 (1.45) - renamed style.ScrollbarWidth to style.ScrollbarSize - - 2015/08/05 (1.44) - split imgui.cpp into extra files: imgui_demo.cpp imgui_draw.cpp imgui_internal.h that you need to add to your project. - - 2015/07/18 (1.44) - fixed angles in ImDrawList::PathArcTo(), PathArcToFast() (introduced in 1.43) being off by an extra PI for no justifiable reason - - 2015/07/14 (1.43) - add new ImFontAtlas::AddFont() API. For the old AddFont***, moved the 'font_no' parameter of ImFontAtlas::AddFont** functions to the ImFontConfig structure. - you need to render your textured triangles with bilinear filtering to benefit from sub-pixel positioning of text. - - 2015/07/08 (1.43) - switched rendering data to use indexed rendering. this is saving a fair amount of CPU/GPU and enables us to get anti-aliasing for a marginal cost. - this necessary change will break your rendering function! the fix should be very easy. sorry for that :( - - if you are using a vanilla copy of one of the imgui_impl_XXXX.cpp provided in the example, you just need to update your copy and you can ignore the rest. - - the signature of the io.RenderDrawListsFn handler has changed! - ImGui_XXXX_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count) - became: - ImGui_XXXX_RenderDrawLists(ImDrawData* draw_data). - argument 'cmd_lists' -> 'draw_data->CmdLists' - argument 'cmd_lists_count' -> 'draw_data->CmdListsCount' - ImDrawList 'commands' -> 'CmdBuffer' - ImDrawList 'vtx_buffer' -> 'VtxBuffer' - ImDrawList n/a -> 'IdxBuffer' (new) - ImDrawCmd 'vtx_count' -> 'ElemCount' - ImDrawCmd 'clip_rect' -> 'ClipRect' - ImDrawCmd 'user_callback' -> 'UserCallback' - ImDrawCmd 'texture_id' -> 'TextureId' - - each ImDrawList now contains both a vertex buffer and an index buffer. For each command, render ElemCount/3 triangles using indices from the index buffer. - - if you REALLY cannot render indexed primitives, you can call the draw_data->DeIndexAllBuffers() method to de-index the buffers. This is slow and a waste of CPU/GPU. Prefer using indexed rendering! - - refer to code in the examples/ folder or ask on the GitHub if you are unsure of how to upgrade. please upgrade! - - 2015/07/10 (1.43) - changed SameLine() parameters from int to float. - - 2015/07/02 (1.42) - renamed SetScrollPosHere() to SetScrollFromCursorPos(). Kept inline redirection function (will obsolete). - - 2015/07/02 (1.42) - renamed GetScrollPosY() to GetScrollY(). Necessary to reduce confusion along with other scrolling functions, because positions (e.g. cursor position) are not equivalent to scrolling amount. - - 2015/06/14 (1.41) - changed ImageButton() default bg_col parameter from (0,0,0,1) (black) to (0,0,0,0) (transparent) - makes a difference when texture have transparence - - 2015/06/14 (1.41) - changed Selectable() API from (label, selected, size) to (label, selected, flags, size). Size override should have been rarely be used. Sorry! - - 2015/05/31 (1.40) - renamed GetWindowCollapsed() to IsWindowCollapsed() for consistency. Kept inline redirection function (will obsolete). - - 2015/05/31 (1.40) - renamed IsRectClipped() to IsRectVisible() for consistency. Note that return value is opposite! Kept inline redirection function (will obsolete). - - 2015/05/27 (1.40) - removed the third 'repeat_if_held' parameter from Button() - sorry! it was rarely used and inconsistent. Use PushButtonRepeat(true) / PopButtonRepeat() to enable repeat on desired buttons. - - 2015/05/11 (1.40) - changed BeginPopup() API, takes a string identifier instead of a bool. ImGui needs to manage the open/closed state of popups. Call OpenPopup() to actually set the "open" state of a popup. BeginPopup() returns true if the popup is opened. - - 2015/05/03 (1.40) - removed style.AutoFitPadding, using style.WindowPadding makes more sense (the default values were already the same). - - 2015/04/13 (1.38) - renamed IsClipped() to IsRectClipped(). Kept inline redirection function until 1.50. - - 2015/04/09 (1.38) - renamed ImDrawList::AddArc() to ImDrawList::AddArcFast() for compatibility with future API - - 2015/04/03 (1.38) - removed ImGuiCol_CheckHovered, ImGuiCol_CheckActive, replaced with the more general ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive. - - 2014/04/03 (1.38) - removed support for passing -FLT_MAX..+FLT_MAX as the range for a SliderFloat(). Use DragFloat() or Inputfloat() instead. - - 2015/03/17 (1.36) - renamed GetItemBoxMin()/GetItemBoxMax()/IsMouseHoveringBox() to GetItemRectMin()/GetItemRectMax()/IsMouseHoveringRect(). Kept inline redirection function until 1.50. - - 2015/03/15 (1.36) - renamed style.TreeNodeSpacing to style.IndentSpacing, ImGuiStyleVar_TreeNodeSpacing to ImGuiStyleVar_IndentSpacing - - 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function until 1.50. - - 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth (casing) - - 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function until 1.50. - - 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once. - - 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now. - - 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior - - 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing() - - 2015/02/01 (1.31) - removed IO.MemReallocFn (unused) - - 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions. - - 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader. - (1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels. - this sequence: - const void* png_data; - unsigned int png_size; - ImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size); - // - became: - unsigned char* pixels; - int width, height; - io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); - // - io.Fonts->TexID = (your_texture_identifier); - you now have much more flexibility to load multiple TTF fonts and manage the texture buffer for internal needs. - it is now recommended that you sample the font texture with bilinear interpolation. - (1.30) - added texture identifier in ImDrawCmd passed to your render function (we can now render images). make sure to set io.Fonts->TexID. - (1.30) - removed IO.PixelCenterOffset (unnecessary, can be handled in user projection matrix) - (1.30) - removed ImGui::IsItemFocused() in favor of ImGui::IsItemActive() which handles all widgets - - 2014/12/10 (1.18) - removed SetNewWindowDefaultPos() in favor of new generic API SetNextWindowPos(pos, ImGuiSetCondition_FirstUseEver) - - 2014/11/28 (1.17) - moved IO.Font*** options to inside the IO.Font-> structure (FontYOffset, FontTexUvForWhite, FontBaseScale, FontFallbackGlyph) - - 2014/11/26 (1.17) - reworked syntax of IMGUI_ONCE_UPON_A_FRAME helper macro to increase compiler compatibility - - 2014/11/07 (1.15) - renamed IsHovered() to IsItemHovered() - - 2014/10/02 (1.14) - renamed IMGUI_INCLUDE_IMGUI_USER_CPP to IMGUI_INCLUDE_IMGUI_USER_INL and imgui_user.cpp to imgui_user.inl (more IDE friendly) - - 2014/09/25 (1.13) - removed 'text_end' parameter from IO.SetClipboardTextFn (the string is now always zero-terminated for simplicity) - - 2014/09/24 (1.12) - renamed SetFontScale() to SetWindowFontScale() - - 2014/09/24 (1.12) - moved IM_MALLOC/IM_REALLOC/IM_FREE preprocessor defines to IO.MemAllocFn/IO.MemReallocFn/IO.MemFreeFn - - 2014/08/30 (1.09) - removed IO.FontHeight (now computed automatically) - - 2014/08/30 (1.09) - moved IMGUI_FONT_TEX_UV_FOR_WHITE preprocessor define to IO.FontTexUvForWhite - - 2014/08/28 (1.09) - changed the behavior of IO.PixelCenterOffset following various rendering fixes - - - ISSUES & TODO-LIST - ================== - See TODO.txt - - - FREQUENTLY ASKED QUESTIONS (FAQ), TIPS - ====================================== - - Q: How can I help? - A: - If you are experienced enough with Dear ImGui and with C/C++, look at the todo list and see how you want/can help! - - Become a Patron/donate! Convince your company to become a Patron or provide serious funding for development time! See http://www.patreon.com/imgui - - Q: What is ImTextureID and how do I display an image? - A: ImTextureID is a void* used to pass renderer-agnostic texture references around until it hits your render function. - Dear ImGui knows nothing about what those bits represent, it just passes them around. It is up to you to decide what you want the void* to carry! - It could be an identifier to your OpenGL texture (cast GLuint to void*), a pointer to your custom engine material (cast MyMaterial* to void*), etc. - At the end of the chain, your renderer takes this void* to cast it back into whatever it needs to select a current texture to render. - Refer to examples applications, where each renderer (in a imgui_impl_xxxx.cpp file) is treating ImTextureID as a different thing. - (c++ tip: OpenGL uses integers to identify textures. You can safely store an integer into a void*, just cast it to void*, don't take it's address!) - To display a custom image/texture within an ImGui window, you may use ImGui::Image(), ImGui::ImageButton(), ImDrawList::AddImage() functions. - Dear ImGui will generate the geometry and draw calls using the ImTextureID that you passed and which your renderer can use. - It is your responsibility to get textures uploaded to your GPU. - - Q: I integrated Dear ImGui in my engine and the text or lines are blurry.. - A: In your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f). - Also make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension. - - Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around.. - A: You are probably mishandling the clipping rectangles in your render function. - Rectangles provided by ImGui are defined as (x1=left,y1=top,x2=right,y2=bottom) and NOT as (x1,y1,width,height). - - Q: Can I have multiple widgets with the same label? Can I have widget without a label? - A: Yes. A primer on the use of labels/IDs in Dear ImGui.. - - - Elements that are not clickable, such as Text() items don't need an ID. - - - Interactive widgets require state to be carried over multiple frames (most typically Dear ImGui often needs to remember what is - the "active" widget). to do so they need a unique ID. unique ID are typically derived from a string label, an integer index or a pointer. - - Button("OK"); // Label = "OK", ID = hash of "OK" - Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel" - - - ID are uniquely scoped within windows, tree nodes, etc. so no conflict can happen if you have two buttons called "OK" - in two different windows or in two different locations of a tree. - - - If you have a same ID twice in the same location, you'll have a conflict: - - Button("OK"); - Button("OK"); // ID collision! Both buttons will be treated as the same. - - Fear not! this is easy to solve and there are many ways to solve it! - - - When passing a label you can optionally specify extra unique ID information within string itself. - This helps solving the simpler collision cases. Use "##" to pass a complement to the ID that won't be visible to the end-user: - - Button("Play"); // Label = "Play", ID = hash of "Play" - Button("Play##foo1"); // Label = "Play", ID = hash of "Play##foo1" (different from above) - Button("Play##foo2"); // Label = "Play", ID = hash of "Play##foo2" (different from above) - - - If you want to completely hide the label, but still need an ID: - - Checkbox("##On", &b); // Label = "", ID = hash of "##On" (no label!) - - - Occasionally/rarely you might want change a label while preserving a constant ID. This allows you to animate labels. - For example you may want to include varying information in a window title bar (and windows are uniquely identified by their ID.. obviously) - Use "###" to pass a label that isn't part of ID: - - Button("Hello###ID"; // Label = "Hello", ID = hash of "ID" - Button("World###ID"; // Label = "World", ID = hash of "ID" (same as above) - - sprintf(buf, "My game (%f FPS)###MyGame"); - Begin(buf); // Variable label, ID = hash of "MyGame" - - - Use PushID() / PopID() to create scopes and avoid ID conflicts within the same Window. - This is the most convenient way of distinguishing ID if you are iterating and creating many UI elements. - You can push a pointer, a string or an integer value. Remember that ID are formed from the concatenation of everything in the ID stack! - - for (int i = 0; i < 100; i++) - { - PushID(i); - Button("Click"); // Label = "Click", ID = hash of integer + "label" (unique) - PopID(); - } - - for (int i = 0; i < 100; i++) - { - MyObject* obj = Objects[i]; - PushID(obj); - Button("Click"); // Label = "Click", ID = hash of pointer + "label" (unique) - PopID(); - } - - for (int i = 0; i < 100; i++) - { - MyObject* obj = Objects[i]; - PushID(obj->Name); - Button("Click"); // Label = "Click", ID = hash of string + "label" (unique) - PopID(); - } - - - More example showing that you can stack multiple prefixes into the ID stack: - - Button("Click"); // Label = "Click", ID = hash of "Click" - PushID("node"); - Button("Click"); // Label = "Click", ID = hash of "node" + "Click" - PushID(my_ptr); - Button("Click"); // Label = "Click", ID = hash of "node" + ptr + "Click" - PopID(); - PopID(); - - - Tree nodes implicitly creates a scope for you by calling PushID(). - - Button("Click"); // Label = "Click", ID = hash of "Click" - if (TreeNode("node")) - { - Button("Click"); // Label = "Click", ID = hash of "node" + "Click" - TreePop(); - } - - - When working with trees, ID are used to preserve the open/close state of each tree node. - Depending on your use cases you may want to use strings, indices or pointers as ID. - e.g. when displaying a single object that may change over time (dynamic 1-1 relationship), using a static string as ID will preserve your - node open/closed state when the targeted object change. - e.g. when displaying a list of objects, using indices or pointers as ID will preserve the node open/closed state differently. - experiment and see what makes more sense! - - Q: How can I tell when Dear ImGui wants my mouse/keyboard inputs VS when I can pass them to my application? - A: You can read the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'ioWantTextInput' flags from the ImGuiIO structure. - - When 'io.WantCaptureMouse' or 'io.WantCaptureKeyboard' flags are set you may want to discard/hide the inputs from the rest of your application. - - When 'io.WantTextInput' is set to may want to notify your OS to popup an on-screen keyboard, if available (e.g. on a mobile phone, or console OS). - Preferably read the flags after calling ImGui::NewFrame() to avoid them lagging by one frame. But reading those flags before calling NewFrame() is - also generally ok, as the bool toggles fairly rarely and you don't generally expect to interact with either Dear ImGui or your application during - the same frame when that transition occurs. Dear ImGui is tracking dragging and widget activity that may occur outside the boundary of a window, - so 'io.WantCaptureMouse' is more accurate and correct than checking if a window is hovered. - (Advanced note: text input releases focus on Return 'KeyDown', so the following Return 'KeyUp' event that your application receive will typically - have 'io.WantCaptureKeyboard=false'. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs - were for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.) - - Q: How can I load a different font than the default? (default is an embedded version of ProggyClean.ttf, rendered at size 13) - A: Use the font atlas to load the TTF/OTF file you want: - - ImGuiIO& io = ImGui::GetIO(); - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); - io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() - - Q: How can I easily use icons in my application? - A: The most convenient and practical way is to merge an icon font such as FontAwesome inside you main font. Then you can refer to icons within your - strings. Read 'How can I load multiple fonts?' and the file 'extra_fonts/README.txt' for instructions and useful header files. - - Q: How can I load multiple fonts? - A: Use the font atlas to pack them into a single texture: - (Read extra_fonts/README.txt and the code in ImFontAtlas for more details.) - - ImGuiIO& io = ImGui::GetIO(); - ImFont* font0 = io.Fonts->AddFontDefault(); - ImFont* font1 = io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels); - ImFont* font2 = io.Fonts->AddFontFromFileTTF("myfontfile2.ttf", size_in_pixels); - io.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8() - // the first loaded font gets used by default - // use ImGui::PushFont()/ImGui::PopFont() to change the font at runtime - - // Options - ImFontConfig config; - config.OversampleH = 3; - config.OversampleV = 1; - config.GlyphOffset.y -= 2.0f; // Move everything by 2 pixels up - config.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters - io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, &config); - - // Combine multiple fonts into one (e.g. for icon fonts) - ImWchar ranges[] = { 0xf000, 0xf3ff, 0 }; - ImFontConfig config; - config.MergeMode = true; - io.Fonts->AddFontDefault(); - io.Fonts->LoadFromFileTTF("fontawesome-webfont.ttf", 16.0f, &config, ranges); // Merge icon font - io.Fonts->LoadFromFileTTF("myfontfile.ttf", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs - - Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic? - A: When loading a font, pass custom Unicode ranges to specify the glyphs to load. - - // Add default Japanese ranges - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, io.Fonts->GetGlyphRangesJapanese()); - - // Or create your own custom ranges (e.g. for a game you can feed your entire game script and only build the characters the game need) - ImVector ranges; - ImFontAtlas::GlyphRangesBuilder builder; - builder.AddText("Hello world"); // Add a string (here "Hello world" contains 7 unique characters) - builder.AddChar(0x7262); // Add a specific character - builder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges - builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted) - io.Fonts->AddFontFromFileTTF("myfontfile.ttf", size_in_pixels, NULL, ranges.Data); - - All your strings needs to use UTF-8 encoding. In C++11 you can encode a string literal in UTF-8 by using the u8"hello" syntax. - Specifying literal in your source code using a local code page (such as CP-923 for Japanese or CP-1251 for Cyrillic) will NOT work! - Otherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8. - - Text input: it is up to your application to pass the right character code to io.AddInputCharacter(). The applications in examples/ are doing that. - For languages using IME, on Windows you can copy the Hwnd of your application to io.ImeWindowHandle. - The default implementation of io.ImeSetInputScreenPosFn() on Windows will set your IME position correctly. - - Q: How can I preserve my Dear ImGui context across reloading a DLL? (loss of the global/static variables) - A: Create your own context 'ctx = CreateContext()' + 'SetCurrentContext(ctx)' and your own font atlas 'ctx->GetIO().Fonts = new ImFontAtlas()' - so you don't rely on the default globals. - - Q: How can I use the drawing facilities without an ImGui window? (using ImDrawList API) - A: The easiest way is to create a dummy window. Call Begin() with NoTitleBar|NoResize|NoMove|NoScrollbar|NoSavedSettings|NoInputs flag, - zero background alpha, then retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like. - You can also perfectly create a standalone ImDrawList instance _but_ you need ImGui to be initialized because ImDrawList pulls from ImGui - data to retrieve the coordinates of the white pixel. - - - tip: you can call Begin() multiple times with the same name during the same frame, it will keep appending to the same window. - this is also useful to set yourself in the context of another window (to get/set other settings) - - tip: you can create widgets without a Begin()/End() block, they will go in an implicit window called "Debug". - - tip: the ImGuiOnceUponAFrame helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle - of a deep nested inner loop in your code. - - tip: you can call Render() multiple times (e.g for VR renders). - - tip: call and read the ShowTestWindow() code in imgui_demo.cpp for more example of how to use ImGui! - -*/ - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include "imgui.h" -#define IMGUI_DEFINE_MATH_OPERATORS -#define IMGUI_DEFINE_PLACEMENT_NEW -#include "imgui_internal.h" - -#include // toupper, isprint -#include // NULL, malloc, free, qsort, atoi -#include // vsnprintf, sscanf, printf -#include // INT_MIN, INT_MAX -#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier -#include // intptr_t -#else -#include // intptr_t -#endif - -#ifdef _MSC_VER -#pragma warning (disable: 4127) // condition expression is constant -#pragma warning (disable: 4201) // nonstandard extension used: nameless struct/union -#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) -#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen -#endif - -// Clang warnings with -Weverything -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wunknown-pragmas" // warning : unknown warning group '-Wformat-pedantic *' // not all warnings are known by all clang versions.. so ignoring warnings triggers new warnings on some configuration. great! -#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. -#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants (typically 0.0f) is ok. -#pragma clang diagnostic ignored "-Wformat-nonliteral" // warning : format string is not a string literal // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code. -#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. -#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. -#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // -#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning : function xx could be declared with attribute 'noreturn' warning // GetDefaultFontData() asserts which some implementation makes it never return. -#pragma clang diagnostic ignored "-Wdeprecated-declarations"// warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code) -#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' -#pragma clang diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used -#pragma clang diagnostic ignored "-Wformat-pedantic" // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic. -#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' // -#elif defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used -#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size -#pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*' -#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function -#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value -#pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers -#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked -#endif - -//------------------------------------------------------------------------- -// Forward Declarations -//------------------------------------------------------------------------- - -static float GetDraggedColumnOffset(int column_index); - -static bool IsKeyPressedMap(ImGuiKey key, bool repeat = true); - -static ImFont* GetDefaultFont(); -static void SetCurrentFont(ImFont* font); -static void SetCurrentWindow(ImGuiWindow* window); -static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y); -static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond); -static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond); -static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond); -static ImGuiWindow* FindHoveredWindow(ImVec2 pos); -static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags); -static void ClearSetNextWindowData(); -static void CheckStacksSize(ImGuiWindow* window, bool write); -static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window); - -static void AddDrawListToRenderList(ImVector& out_render_list, ImDrawList* draw_list); -static void AddWindowToRenderList(ImVector& out_render_list, ImGuiWindow* window); -static void AddWindowToSortedBuffer(ImVector& out_sorted_windows, ImGuiWindow* window); - -static ImGuiWindowSettings* AddWindowSettings(const char* name); - -static void LoadIniSettingsFromDisk(const char* ini_filename); -static void LoadIniSettingsFromMemory(const char* buf); -static void SaveIniSettingsToDisk(const char* ini_filename); -static void SaveIniSettingsToMemory(ImVector& out_buf); -static void MarkIniSettingsDirty(ImGuiWindow* window); - -static ImRect GetVisibleRect(); - -static void CloseInactivePopups(ImGuiWindow* ref_window); -static void ClosePopupToLevel(int remaining); -static ImGuiWindow* GetFrontMostModalRootWindow(); -static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& rect_to_avoid); - -static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data); -static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end); -static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false); - -static inline void DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, const char* display_format, char* buf, int buf_size); -static inline void DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, int decimal_precision, char* buf, int buf_size); -static void DataTypeApplyOp(ImGuiDataType data_type, int op, void* value1, const void* value2); -static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format); - -namespace ImGui -{ -static void FocusPreviousWindow(); -} - -//----------------------------------------------------------------------------- -// Platform dependent default implementations -//----------------------------------------------------------------------------- - -static const char* GetClipboardTextFn_DefaultImpl(void* user_data); -static void SetClipboardTextFn_DefaultImpl(void* user_data, const char* text); -static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y); - -//----------------------------------------------------------------------------- -// Context -//----------------------------------------------------------------------------- - -// Default font atlas storage. -// New contexts always point by default to this font atlas. It can be changed by reassigning the GetIO().Fonts variable. -static ImFontAtlas GImDefaultFontAtlas; - -// Default context storage + current context pointer. -// Implicitely used by all ImGui functions. Always assumed to be != NULL. Change to a different context by calling ImGui::SetCurrentContext() -// If you are hot-reloading this code in a DLL you will lose the static/global variables. Create your own context+font atlas instead of relying on those default (see FAQ entry "How can I preserve my ImGui context across reloading a DLL?"). -// ImGui is currently not thread-safe because of this variable. If you want thread-safety to allow N threads to access N different contexts, you might work around it by: -// - Having multiple instances of the ImGui code compiled inside different namespace (easiest/safest, if you have a finite number of contexts) -// - or: Changing this variable to be TLS. You may #define GImGui in imconfig.h for further custom hackery. Future development aim to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586 -#ifndef GImGui -static ImGuiContext GImDefaultContext; -ImGuiContext* GImGui = &GImDefaultContext; -#endif - -//----------------------------------------------------------------------------- -// User facing structures -//----------------------------------------------------------------------------- - -ImGuiStyle::ImGuiStyle() -{ - Alpha = 1.0f; // Global alpha applies to everything in ImGui - WindowPadding = ImVec2(8,8); // Padding within a window - WindowRounding = 9.0f; // Radius of window corners rounding. Set to 0.0f to have rectangular windows - WindowBorderSize = 0.0f; // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested. - WindowMinSize = ImVec2(32,32); // Minimum window size - WindowTitleAlign = ImVec2(0.0f,0.5f);// Alignment for title bar text - ChildRounding = 0.0f; // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows - ChildBorderSize = 1.0f; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested. - PopupRounding = 0.0f; // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows - PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested. - FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets) - FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets). - FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested. - ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines - ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label) - TouchExtraPadding = ImVec2(0,0); // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! - IndentSpacing = 21.0f; // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). - ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns - ScrollbarSize = 16.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar - ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar - GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar - GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. - ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text. - DisplayWindowPadding = ImVec2(22,22); // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. - DisplaySafeAreaPadding = ImVec2(4,4); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. - AntiAliasedLines = true; // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU. - AntiAliasedShapes = true; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) - CurveTessellationTol = 1.25f; // Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. - - ImGui::StyleColorsClassic(this); -} - -// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you. -// Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times. -void ImGuiStyle::ScaleAllSizes(float scale_factor) -{ - WindowPadding = ImFloor(WindowPadding * scale_factor); - WindowRounding = ImFloor(WindowRounding * scale_factor); - WindowMinSize = ImFloor(WindowMinSize * scale_factor); - ChildRounding = ImFloor(ChildRounding * scale_factor); - PopupRounding = ImFloor(PopupRounding * scale_factor); - FramePadding = ImFloor(FramePadding * scale_factor); - FrameRounding = ImFloor(FrameRounding * scale_factor); - ItemSpacing = ImFloor(ItemSpacing * scale_factor); - ItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor); - TouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor); - IndentSpacing = ImFloor(IndentSpacing * scale_factor); - ColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor); - ScrollbarSize = ImFloor(ScrollbarSize * scale_factor); - ScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor); - GrabMinSize = ImFloor(GrabMinSize * scale_factor); - GrabRounding = ImFloor(GrabRounding * scale_factor); - DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor); - DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor); -} - -ImGuiIO::ImGuiIO() -{ - // Most fields are initialized with zero - memset(this, 0, sizeof(*this)); - - // Settings - DisplaySize = ImVec2(-1.0f, -1.0f); - DeltaTime = 1.0f/60.0f; - IniSavingRate = 5.0f; - IniFilename = "imgui.ini"; - LogFilename = "imgui_log.txt"; - MouseDoubleClickTime = 0.30f; - MouseDoubleClickMaxDist = 6.0f; - for (int i = 0; i < ImGuiKey_COUNT; i++) - KeyMap[i] = -1; - KeyRepeatDelay = 0.250f; - KeyRepeatRate = 0.050f; - UserData = NULL; - - Fonts = &GImDefaultFontAtlas; - FontGlobalScale = 1.0f; - FontDefault = NULL; - FontAllowUserScaling = false; - DisplayFramebufferScale = ImVec2(1.0f, 1.0f); - DisplayVisibleMin = DisplayVisibleMax = ImVec2(0.0f, 0.0f); - - // Advanced/subtle behaviors -#ifdef __APPLE__ - OptMacOSXBehaviors = true; // Set Mac OS X style defaults based on __APPLE__ compile time flag -#else - OptMacOSXBehaviors = false; -#endif - OptCursorBlink = true; - - // Settings (User Functions) - RenderDrawListsFn = NULL; - MemAllocFn = malloc; - MemFreeFn = free; - GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations - SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; - ClipboardUserData = NULL; - ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl; - ImeWindowHandle = NULL; - - // Input (NB: we already have memset zero the entire structure) - MousePos = ImVec2(-FLT_MAX, -FLT_MAX); - MousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX); - MouseDragThreshold = 6.0f; - for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f; - for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f; -} - -// Pass in translated ASCII characters for text input. -// - with glfw you can get those from the callback set in glfwSetCharCallback() -// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message -void ImGuiIO::AddInputCharacter(ImWchar c) -{ - const int n = ImStrlenW(InputCharacters); - if (n + 1 < IM_ARRAYSIZE(InputCharacters)) - { - InputCharacters[n] = c; - InputCharacters[n+1] = '\0'; - } -} - -void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) -{ - // We can't pass more wchars than ImGuiIO::InputCharacters[] can hold so don't convert more - const int wchars_buf_len = sizeof(ImGuiIO::InputCharacters) / sizeof(ImWchar); - ImWchar wchars[wchars_buf_len]; - ImTextStrFromUtf8(wchars, wchars_buf_len, utf8_chars, NULL); - for (int i = 0; i < wchars_buf_len && wchars[i] != 0; i++) - AddInputCharacter(wchars[i]); -} - -//----------------------------------------------------------------------------- -// HELPERS -//----------------------------------------------------------------------------- - -#define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose -#define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 - -// Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \n. -#ifdef _WIN32 -#define IM_NEWLINE "\r\n" -#else -#define IM_NEWLINE "\n" -#endif - -ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p) -{ - ImVec2 ap = p - a; - ImVec2 ab_dir = b - a; - float ab_len = sqrtf(ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y); - ab_dir *= 1.0f / ab_len; - float dot = ap.x * ab_dir.x + ap.y * ab_dir.y; - if (dot < 0.0f) - return a; - if (dot > ab_len) - return b; - return a + ab_dir * dot; -} - -bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) -{ - bool b1 = ((p.x - b.x) * (a.y - b.y) - (p.y - b.y) * (a.x - b.x)) < 0.0f; - bool b2 = ((p.x - c.x) * (b.y - c.y) - (p.y - c.y) * (b.x - c.x)) < 0.0f; - bool b3 = ((p.x - a.x) * (c.y - a.y) - (p.y - a.y) * (c.x - a.x)) < 0.0f; - return ((b1 == b2) && (b2 == b3)); -} - -void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w) -{ - ImVec2 v0 = b - a; - ImVec2 v1 = c - a; - ImVec2 v2 = p - a; - const float denom = v0.x * v1.y - v1.x * v0.y; - out_v = (v2.x * v1.y - v1.x * v2.y) / denom; - out_w = (v0.x * v2.y - v2.x * v0.y) / denom; - out_u = 1.0f - out_v - out_w; -} - -ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p) -{ - ImVec2 proj_ab = ImLineClosestPoint(a, b, p); - ImVec2 proj_bc = ImLineClosestPoint(b, c, p); - ImVec2 proj_ca = ImLineClosestPoint(c, a, p); - float dist2_ab = ImLengthSqr(p - proj_ab); - float dist2_bc = ImLengthSqr(p - proj_bc); - float dist2_ca = ImLengthSqr(p - proj_ca); - float m = ImMin(dist2_ab, ImMin(dist2_bc, dist2_ca)); - if (m == dist2_ab) - return proj_ab; - if (m == dist2_bc) - return proj_bc; - return proj_ca; -} - -int ImStricmp(const char* str1, const char* str2) -{ - int d; - while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } - return d; -} - -int ImStrnicmp(const char* str1, const char* str2, int count) -{ - int d = 0; - while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; } - return d; -} - -void ImStrncpy(char* dst, const char* src, int count) -{ - if (count < 1) return; - strncpy(dst, src, (size_t)count); - dst[count-1] = 0; -} - -char* ImStrdup(const char *str) -{ - size_t len = strlen(str) + 1; - void* buf = ImGui::MemAlloc(len); - return (char*)memcpy(buf, (const void*)str, len); -} - -char* ImStrchrRange(const char* str, const char* str_end, char c) -{ - for ( ; str < str_end; str++) - if (*str == c) - return (char*)str; - return NULL; -} - -int ImStrlenW(const ImWchar* str) -{ - int n = 0; - while (*str++) n++; - return n; -} - -const ImWchar* ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin) // find beginning-of-line -{ - while (buf_mid_line > buf_begin && buf_mid_line[-1] != '\n') - buf_mid_line--; - return buf_mid_line; -} - -const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end) -{ - if (!needle_end) - needle_end = needle + strlen(needle); - - const char un0 = (char)toupper(*needle); - while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end)) - { - if (toupper(*haystack) == un0) - { - const char* b = needle + 1; - for (const char* a = haystack + 1; b < needle_end; a++, b++) - if (toupper(*a) != toupper(*b)) - break; - if (b == needle_end) - return haystack; - } - haystack++; - } - return NULL; -} - -static const char* ImAtoi(const char* src, int* output) -{ - int negative = 0; - if (*src == '-') { negative = 1; src++; } - if (*src == '+') { src++; } - int v = 0; - while (*src >= '0' && *src <= '9') - v = (v * 10) + (*src++ - '0'); - *output = negative ? -v : v; - return src; -} - -// A) MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size). -// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm. -// B) When buf==NULL vsnprintf() will return the output size. -#ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS -int ImFormatString(char* buf, int buf_size, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - int w = vsnprintf(buf, buf_size, fmt, args); - va_end(args); - if (buf == NULL) - return w; - if (w == -1 || w >= buf_size) - w = buf_size - 1; - buf[w] = 0; - return w; -} - -int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args) -{ - int w = vsnprintf(buf, buf_size, fmt, args); - if (buf == NULL) - return w; - if (w == -1 || w >= buf_size) - w = buf_size - 1; - buf[w] = 0; - return w; -} -#endif // #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS - -// Pass data_size==0 for zero-terminated strings -// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements. -ImU32 ImHash(const void* data, int data_size, ImU32 seed) -{ - static ImU32 crc32_lut[256] = { 0 }; - if (!crc32_lut[1]) - { - const ImU32 polynomial = 0xEDB88320; - for (ImU32 i = 0; i < 256; i++) - { - ImU32 crc = i; - for (ImU32 j = 0; j < 8; j++) - crc = (crc >> 1) ^ (ImU32(-int(crc & 1)) & polynomial); - crc32_lut[i] = crc; - } - } - - seed = ~seed; - ImU32 crc = seed; - const unsigned char* current = (const unsigned char*)data; - - if (data_size > 0) - { - // Known size - while (data_size--) - crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++]; - } - else - { - // Zero-terminated string - while (unsigned char c = *current++) - { - // We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed. - // Because this syntax is rarely used we are optimizing for the common case. - // - If we reach ### in the string we discard the hash so far and reset to the seed. - // - We don't do 'current += 2; continue;' after handling ### to keep the code smaller. - if (c == '#' && current[0] == '#' && current[1] == '#') - crc = seed; - crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c]; - } - } - return ~crc; -} - -//----------------------------------------------------------------------------- -// ImText* helpers -//----------------------------------------------------------------------------- - -// Convert UTF-8 to 32-bits character, process single character input. -// Based on stb_from_utf8() from github.com/nothings/stb/ -// We handle UTF-8 decoding error by skipping forward. -int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end) -{ - unsigned int c = (unsigned int)-1; - const unsigned char* str = (const unsigned char*)in_text; - if (!(*str & 0x80)) - { - c = (unsigned int)(*str++); - *out_char = c; - return 1; - } - if ((*str & 0xe0) == 0xc0) - { - *out_char = 0xFFFD; // will be invalid but not end of string - if (in_text_end && in_text_end - (const char*)str < 2) return 1; - if (*str < 0xc2) return 2; - c = (unsigned int)((*str++ & 0x1f) << 6); - if ((*str & 0xc0) != 0x80) return 2; - c += (*str++ & 0x3f); - *out_char = c; - return 2; - } - if ((*str & 0xf0) == 0xe0) - { - *out_char = 0xFFFD; // will be invalid but not end of string - if (in_text_end && in_text_end - (const char*)str < 3) return 1; - if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3; - if (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below - c = (unsigned int)((*str++ & 0x0f) << 12); - if ((*str & 0xc0) != 0x80) return 3; - c += (unsigned int)((*str++ & 0x3f) << 6); - if ((*str & 0xc0) != 0x80) return 3; - c += (*str++ & 0x3f); - *out_char = c; - return 3; - } - if ((*str & 0xf8) == 0xf0) - { - *out_char = 0xFFFD; // will be invalid but not end of string - if (in_text_end && in_text_end - (const char*)str < 4) return 1; - if (*str > 0xf4) return 4; - if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4; - if (*str == 0xf4 && str[1] > 0x8f) return 4; // str[1] < 0x80 is checked below - c = (unsigned int)((*str++ & 0x07) << 18); - if ((*str & 0xc0) != 0x80) return 4; - c += (unsigned int)((*str++ & 0x3f) << 12); - if ((*str & 0xc0) != 0x80) return 4; - c += (unsigned int)((*str++ & 0x3f) << 6); - if ((*str & 0xc0) != 0x80) return 4; - c += (*str++ & 0x3f); - // utf-8 encodings of values used in surrogate pairs are invalid - if ((c & 0xFFFFF800) == 0xD800) return 4; - *out_char = c; - return 4; - } - *out_char = 0; - return 0; -} - -int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining) -{ - ImWchar* buf_out = buf; - ImWchar* buf_end = buf + buf_size; - while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) - { - unsigned int c; - in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); - if (c == 0) - break; - if (c < 0x10000) // FIXME: Losing characters that don't fit in 2 bytes - *buf_out++ = (ImWchar)c; - } - *buf_out = 0; - if (in_text_remaining) - *in_text_remaining = in_text; - return (int)(buf_out - buf); -} - -int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end) -{ - int char_count = 0; - while ((!in_text_end || in_text < in_text_end) && *in_text) - { - unsigned int c; - in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); - if (c == 0) - break; - if (c < 0x10000) - char_count++; - } - return char_count; -} - -// Based on stb_to_utf8() from github.com/nothings/stb/ -static inline int ImTextCharToUtf8(char* buf, int buf_size, unsigned int c) -{ - if (c < 0x80) - { - buf[0] = (char)c; - return 1; - } - if (c < 0x800) - { - if (buf_size < 2) return 0; - buf[0] = (char)(0xc0 + (c >> 6)); - buf[1] = (char)(0x80 + (c & 0x3f)); - return 2; - } - if (c >= 0xdc00 && c < 0xe000) - { - return 0; - } - if (c >= 0xd800 && c < 0xdc00) - { - if (buf_size < 4) return 0; - buf[0] = (char)(0xf0 + (c >> 18)); - buf[1] = (char)(0x80 + ((c >> 12) & 0x3f)); - buf[2] = (char)(0x80 + ((c >> 6) & 0x3f)); - buf[3] = (char)(0x80 + ((c ) & 0x3f)); - return 4; - } - //else if (c < 0x10000) - { - if (buf_size < 3) return 0; - buf[0] = (char)(0xe0 + (c >> 12)); - buf[1] = (char)(0x80 + ((c>> 6) & 0x3f)); - buf[2] = (char)(0x80 + ((c ) & 0x3f)); - return 3; - } -} - -static inline int ImTextCountUtf8BytesFromChar(unsigned int c) -{ - if (c < 0x80) return 1; - if (c < 0x800) return 2; - if (c >= 0xdc00 && c < 0xe000) return 0; - if (c >= 0xd800 && c < 0xdc00) return 4; - return 3; -} - -int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end) -{ - char* buf_out = buf; - const char* buf_end = buf + buf_size; - while (buf_out < buf_end-1 && (!in_text_end || in_text < in_text_end) && *in_text) - { - unsigned int c = (unsigned int)(*in_text++); - if (c < 0x80) - *buf_out++ = (char)c; - else - buf_out += ImTextCharToUtf8(buf_out, (int)(buf_end-buf_out-1), c); - } - *buf_out = 0; - return (int)(buf_out - buf); -} - -int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end) -{ - int bytes_count = 0; - while ((!in_text_end || in_text < in_text_end) && *in_text) - { - unsigned int c = (unsigned int)(*in_text++); - if (c < 0x80) - bytes_count++; - else - bytes_count += ImTextCountUtf8BytesFromChar(c); - } - return bytes_count; -} - -ImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in) -{ - float s = 1.0f/255.0f; - return ImVec4( - ((in >> IM_COL32_R_SHIFT) & 0xFF) * s, - ((in >> IM_COL32_G_SHIFT) & 0xFF) * s, - ((in >> IM_COL32_B_SHIFT) & 0xFF) * s, - ((in >> IM_COL32_A_SHIFT) & 0xFF) * s); -} - -ImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in) -{ - ImU32 out; - out = ((ImU32)IM_F32_TO_INT8_SAT(in.x)) << IM_COL32_R_SHIFT; - out |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT; - out |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT; - out |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT; - return out; -} - -ImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul) -{ - ImGuiStyle& style = GImGui->Style; - ImVec4 c = style.Colors[idx]; - c.w *= style.Alpha * alpha_mul; - return ColorConvertFloat4ToU32(c); -} - -ImU32 ImGui::GetColorU32(const ImVec4& col) -{ - ImGuiStyle& style = GImGui->Style; - ImVec4 c = col; - c.w *= style.Alpha; - return ColorConvertFloat4ToU32(c); -} - -const ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx) -{ - ImGuiStyle& style = GImGui->Style; - return style.Colors[idx]; -} - -ImU32 ImGui::GetColorU32(ImU32 col) -{ - float style_alpha = GImGui->Style.Alpha; - if (style_alpha >= 1.0f) - return col; - int a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT; - a = (int)(a * style_alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range. - return (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT); -} - -// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592 -// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv -void ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v) -{ - float K = 0.f; - if (g < b) - { - ImSwap(g, b); - K = -1.f; - } - if (r < g) - { - ImSwap(r, g); - K = -2.f / 6.f - K; - } - - const float chroma = r - (g < b ? g : b); - out_h = fabsf(K + (g - b) / (6.f * chroma + 1e-20f)); - out_s = chroma / (r + 1e-20f); - out_v = r; -} - -// Convert hsv floats ([0-1],[0-1],[0-1]) to rgb floats ([0-1],[0-1],[0-1]), from Foley & van Dam p593 -// also http://en.wikipedia.org/wiki/HSL_and_HSV -void ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b) -{ - if (s == 0.0f) - { - // gray - out_r = out_g = out_b = v; - return; - } - - h = fmodf(h, 1.0f) / (60.0f/360.0f); - int i = (int)h; - float f = h - (float)i; - float p = v * (1.0f - s); - float q = v * (1.0f - s * f); - float t = v * (1.0f - s * (1.0f - f)); - - switch (i) - { - case 0: out_r = v; out_g = t; out_b = p; break; - case 1: out_r = q; out_g = v; out_b = p; break; - case 2: out_r = p; out_g = v; out_b = t; break; - case 3: out_r = p; out_g = q; out_b = v; break; - case 4: out_r = t; out_g = p; out_b = v; break; - case 5: default: out_r = v; out_g = p; out_b = q; break; - } -} - -FILE* ImFileOpen(const char* filename, const char* mode) -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - // We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames. Converting both strings from UTF-8 to wchar format (using a single allocation, because we can) - const int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1; - const int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1; - ImVector buf; - buf.resize(filename_wsize + mode_wsize); - ImTextStrFromUtf8(&buf[0], filename_wsize, filename, NULL); - ImTextStrFromUtf8(&buf[filename_wsize], mode_wsize, mode, NULL); - return _wfopen((wchar_t*)&buf[0], (wchar_t*)&buf[filename_wsize]); -#else - return fopen(filename, mode); -#endif -} - -// Load file content into memory -// Memory allocated with ImGui::MemAlloc(), must be freed by user using ImGui::MemFree() -void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size, int padding_bytes) -{ - IM_ASSERT(filename && file_open_mode); - if (out_file_size) - *out_file_size = 0; - - FILE* f; - if ((f = ImFileOpen(filename, file_open_mode)) == NULL) - return NULL; - - long file_size_signed; - if (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET)) - { - fclose(f); - return NULL; - } - - int file_size = (int)file_size_signed; - void* file_data = ImGui::MemAlloc(file_size + padding_bytes); - if (file_data == NULL) - { - fclose(f); - return NULL; - } - if (fread(file_data, 1, (size_t)file_size, f) != (size_t)file_size) - { - fclose(f); - ImGui::MemFree(file_data); - return NULL; - } - if (padding_bytes > 0) - memset((void *)(((char*)file_data) + file_size), 0, padding_bytes); - - fclose(f); - if (out_file_size) - *out_file_size = file_size; - - return file_data; -} - -//----------------------------------------------------------------------------- -// ImGuiStorage -// Helper: Key->value storage -//----------------------------------------------------------------------------- - -// std::lower_bound but without the bullshit -static ImVector::iterator LowerBound(ImVector& data, ImGuiID key) -{ - ImVector::iterator first = data.begin(); - ImVector::iterator last = data.end(); - size_t count = (size_t)(last - first); - while (count > 0) - { - size_t count2 = count >> 1; - ImVector::iterator mid = first + count2; - if (mid->key < key) - { - first = ++mid; - count -= count2 + 1; - } - else - { - count = count2; - } - } - return first; -} - -// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. -void ImGuiStorage::BuildSortByKey() -{ - struct StaticFunc - { - static int PairCompareByID(const void* lhs, const void* rhs) - { - // We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that. - if (((const Pair*)lhs)->key > ((const Pair*)rhs)->key) return +1; - if (((const Pair*)lhs)->key < ((const Pair*)rhs)->key) return -1; - return 0; - } - }; - if (Data.Size > 1) - qsort(Data.Data, (size_t)Data.Size, sizeof(Pair), StaticFunc::PairCompareByID); -} - -int ImGuiStorage::GetInt(ImGuiID key, int default_val) const -{ - ImVector::iterator it = LowerBound(const_cast&>(Data), key); - if (it == Data.end() || it->key != key) - return default_val; - return it->val_i; -} - -bool ImGuiStorage::GetBool(ImGuiID key, bool default_val) const -{ - return GetInt(key, default_val ? 1 : 0) != 0; -} - -float ImGuiStorage::GetFloat(ImGuiID key, float default_val) const -{ - ImVector::iterator it = LowerBound(const_cast&>(Data), key); - if (it == Data.end() || it->key != key) - return default_val; - return it->val_f; -} - -void* ImGuiStorage::GetVoidPtr(ImGuiID key) const -{ - ImVector::iterator it = LowerBound(const_cast&>(Data), key); - if (it == Data.end() || it->key != key) - return NULL; - return it->val_p; -} - -// References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. -int* ImGuiStorage::GetIntRef(ImGuiID key, int default_val) -{ - ImVector::iterator it = LowerBound(Data, key); - if (it == Data.end() || it->key != key) - it = Data.insert(it, Pair(key, default_val)); - return &it->val_i; -} - -bool* ImGuiStorage::GetBoolRef(ImGuiID key, bool default_val) -{ - return (bool*)GetIntRef(key, default_val ? 1 : 0); -} - -float* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val) -{ - ImVector::iterator it = LowerBound(Data, key); - if (it == Data.end() || it->key != key) - it = Data.insert(it, Pair(key, default_val)); - return &it->val_f; -} - -void** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val) -{ - ImVector::iterator it = LowerBound(Data, key); - if (it == Data.end() || it->key != key) - it = Data.insert(it, Pair(key, default_val)); - return &it->val_p; -} - -// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame) -void ImGuiStorage::SetInt(ImGuiID key, int val) -{ - ImVector::iterator it = LowerBound(Data, key); - if (it == Data.end() || it->key != key) - { - Data.insert(it, Pair(key, val)); - return; - } - it->val_i = val; -} - -void ImGuiStorage::SetBool(ImGuiID key, bool val) -{ - SetInt(key, val ? 1 : 0); -} - -void ImGuiStorage::SetFloat(ImGuiID key, float val) -{ - ImVector::iterator it = LowerBound(Data, key); - if (it == Data.end() || it->key != key) - { - Data.insert(it, Pair(key, val)); - return; - } - it->val_f = val; -} - -void ImGuiStorage::SetVoidPtr(ImGuiID key, void* val) -{ - ImVector::iterator it = LowerBound(Data, key); - if (it == Data.end() || it->key != key) - { - Data.insert(it, Pair(key, val)); - return; - } - it->val_p = val; -} - -void ImGuiStorage::SetAllInt(int v) -{ - for (int i = 0; i < Data.Size; i++) - Data[i].val_i = v; -} - -//----------------------------------------------------------------------------- -// ImGuiTextFilter -//----------------------------------------------------------------------------- - -// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" -ImGuiTextFilter::ImGuiTextFilter(const char* default_filter) -{ - if (default_filter) - { - ImStrncpy(InputBuf, default_filter, IM_ARRAYSIZE(InputBuf)); - Build(); - } - else - { - InputBuf[0] = 0; - CountGrep = 0; - } -} - -bool ImGuiTextFilter::Draw(const char* label, float width) -{ - if (width != 0.0f) - ImGui::PushItemWidth(width); - bool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf)); - if (width != 0.0f) - ImGui::PopItemWidth(); - if (value_changed) - Build(); - return value_changed; -} - -void ImGuiTextFilter::TextRange::split(char separator, ImVector& out) -{ - out.resize(0); - const char* wb = b; - const char* we = wb; - while (we < e) - { - if (*we == separator) - { - out.push_back(TextRange(wb, we)); - wb = we + 1; - } - we++; - } - if (wb != we) - out.push_back(TextRange(wb, we)); -} - -void ImGuiTextFilter::Build() -{ - Filters.resize(0); - TextRange input_range(InputBuf, InputBuf+strlen(InputBuf)); - input_range.split(',', Filters); - - CountGrep = 0; - for (int i = 0; i != Filters.Size; i++) - { - Filters[i].trim_blanks(); - if (Filters[i].empty()) - continue; - if (Filters[i].front() != '-') - CountGrep += 1; - } -} - -bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const -{ - if (Filters.empty()) - return true; - - if (text == NULL) - text = ""; - - for (int i = 0; i != Filters.Size; i++) - { - const TextRange& f = Filters[i]; - if (f.empty()) - continue; - if (f.front() == '-') - { - // Subtract - if (ImStristr(text, text_end, f.begin()+1, f.end()) != NULL) - return false; - } - else - { - // Grep - if (ImStristr(text, text_end, f.begin(), f.end()) != NULL) - return true; - } - } - - // Implicit * grep - if (CountGrep == 0) - return true; - - return false; -} - -//----------------------------------------------------------------------------- -// ImGuiTextBuffer -//----------------------------------------------------------------------------- - -// On some platform vsnprintf() takes va_list by reference and modifies it. -// va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it. -#ifndef va_copy -#define va_copy(dest, src) (dest = src) -#endif - -// Helper: Text buffer for logging/accumulating text -void ImGuiTextBuffer::appendfv(const char* fmt, va_list args) -{ - va_list args_copy; - va_copy(args_copy, args); - - int len = ImFormatStringV(NULL, 0, fmt, args); // FIXME-OPT: could do a first pass write attempt, likely successful on first pass. - if (len <= 0) - return; - - const int write_off = Buf.Size; - const int needed_sz = write_off + len; - if (write_off + len >= Buf.Capacity) - { - int double_capacity = Buf.Capacity * 2; - Buf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity); - } - - Buf.resize(needed_sz); - ImFormatStringV(&Buf[write_off - 1], len + 1, fmt, args_copy); -} - -void ImGuiTextBuffer::appendf(const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - appendfv(fmt, args); - va_end(args); -} - -//----------------------------------------------------------------------------- -// ImGuiSimpleColumns (internal use only) -//----------------------------------------------------------------------------- - -ImGuiSimpleColumns::ImGuiSimpleColumns() -{ - Count = 0; - Spacing = Width = NextWidth = 0.0f; - memset(Pos, 0, sizeof(Pos)); - memset(NextWidths, 0, sizeof(NextWidths)); -} - -void ImGuiSimpleColumns::Update(int count, float spacing, bool clear) -{ - IM_ASSERT(Count <= IM_ARRAYSIZE(Pos)); - Count = count; - Width = NextWidth = 0.0f; - Spacing = spacing; - if (clear) memset(NextWidths, 0, sizeof(NextWidths)); - for (int i = 0; i < Count; i++) - { - if (i > 0 && NextWidths[i] > 0.0f) - Width += Spacing; - Pos[i] = (float)(int)Width; - Width += NextWidths[i]; - NextWidths[i] = 0.0f; - } -} - -float ImGuiSimpleColumns::DeclColumns(float w0, float w1, float w2) // not using va_arg because they promote float to double -{ - NextWidth = 0.0f; - NextWidths[0] = ImMax(NextWidths[0], w0); - NextWidths[1] = ImMax(NextWidths[1], w1); - NextWidths[2] = ImMax(NextWidths[2], w2); - for (int i = 0; i < 3; i++) - NextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0f) ? Spacing : 0.0f); - return ImMax(Width, NextWidth); -} - -float ImGuiSimpleColumns::CalcExtraSpace(float avail_w) -{ - return ImMax(0.0f, avail_w - Width); -} - -//----------------------------------------------------------------------------- -// ImGuiListClipper -//----------------------------------------------------------------------------- - -static void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height) -{ - // Set cursor position and a few other things so that SetScrollHere() and Columns() can work when seeking cursor. - // FIXME: It is problematic that we have to do that here, because custom/equivalent end-user code would stumble on the same issue. Consider moving within SetCursorXXX functions? - ImGui::SetCursorPosY(pos_y); - ImGuiWindow* window = ImGui::GetCurrentWindow(); - window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height; // Setting those fields so that SetScrollHere() can properly function after the end of our clipper usage. - window->DC.PrevLineHeight = (line_height - GImGui->Style.ItemSpacing.y); // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list. - if (window->DC.ColumnsCount > 1) - window->DC.ColumnsCellMinY = window->DC.CursorPos.y; // Setting this so that cell Y position are set properly -} - -// Use case A: Begin() called from constructor with items_height<0, then called again from Sync() in StepNo 1 -// Use case B: Begin() called from constructor with items_height>0 -// FIXME-LEGACY: Ideally we should remove the Begin/End functions but they are part of the legacy API we still support. This is why some of the code in Step() calling Begin() and reassign some fields, spaghetti style. -void ImGuiListClipper::Begin(int count, float items_height) -{ - StartPosY = ImGui::GetCursorPosY(); - ItemsHeight = items_height; - ItemsCount = count; - StepNo = 0; - DisplayEnd = DisplayStart = -1; - if (ItemsHeight > 0.0f) - { - ImGui::CalcListClipping(ItemsCount, ItemsHeight, &DisplayStart, &DisplayEnd); // calculate how many to clip/display - if (DisplayStart > 0) - SetCursorPosYAndSetupDummyPrevLine(StartPosY + DisplayStart * ItemsHeight, ItemsHeight); // advance cursor - StepNo = 2; - } -} - -void ImGuiListClipper::End() -{ - if (ItemsCount < 0) - return; - // In theory here we should assert that ImGui::GetCursorPosY() == StartPosY + DisplayEnd * ItemsHeight, but it feels saner to just seek at the end and not assert/crash the user. - if (ItemsCount < INT_MAX) - SetCursorPosYAndSetupDummyPrevLine(StartPosY + ItemsCount * ItemsHeight, ItemsHeight); // advance cursor - ItemsCount = -1; - StepNo = 3; -} - -bool ImGuiListClipper::Step() -{ - if (ItemsCount == 0 || ImGui::GetCurrentWindowRead()->SkipItems) - { - ItemsCount = -1; - return false; - } - if (StepNo == 0) // Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height. - { - DisplayStart = 0; - DisplayEnd = 1; - StartPosY = ImGui::GetCursorPosY(); - StepNo = 1; - return true; - } - if (StepNo == 1) // Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. - { - if (ItemsCount == 1) { ItemsCount = -1; return false; } - float items_height = ImGui::GetCursorPosY() - StartPosY; - IM_ASSERT(items_height > 0.0f); // If this triggers, it means Item 0 hasn't moved the cursor vertically - Begin(ItemsCount-1, items_height); - DisplayStart++; - DisplayEnd++; - StepNo = 3; - return true; - } - if (StepNo == 2) // Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user still call Step(). Does nothing and switch to Step 3. - { - IM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0); - StepNo = 3; - return true; - } - if (StepNo == 3) // Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. - End(); - return false; -} - -//----------------------------------------------------------------------------- -// ImGuiWindow -//----------------------------------------------------------------------------- - -ImGuiWindow::ImGuiWindow(const char* name) -{ - Name = ImStrdup(name); - ID = ImHash(name, 0); - IDStack.push_back(ID); - Flags = 0; - OrderWithinParent = 0; - PosFloat = Pos = ImVec2(0.0f, 0.0f); - Size = SizeFull = ImVec2(0.0f, 0.0f); - SizeContents = SizeContentsExplicit = ImVec2(0.0f, 0.0f); - WindowPadding = ImVec2(0.0f, 0.0f); - WindowRounding = 0.0f; - WindowBorderSize = 0.0f; - MoveId = GetID("#MOVE"); - Scroll = ImVec2(0.0f, 0.0f); - ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); - ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); - ScrollbarX = ScrollbarY = false; - ScrollbarSizes = ImVec2(0.0f, 0.0f); - Active = WasActive = false; - WriteAccessed = false; - Collapsed = false; - SkipItems = false; - Appearing = false; - CloseButton = false; - BeginCount = 0; - PopupId = 0; - AutoFitFramesX = AutoFitFramesY = -1; - AutoFitOnlyGrows = false; - AutoFitChildAxises = 0x00; - AutoPosLastDirection = -1; - HiddenFrames = 0; - SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; - SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); - - LastFrameActive = -1; - ItemWidthDefault = 0.0f; - FontWindowScale = 1.0f; - - DrawList = (ImDrawList*)ImGui::MemAlloc(sizeof(ImDrawList)); - IM_PLACEMENT_NEW(DrawList) ImDrawList(); - DrawList->_OwnerName = Name; - ParentWindow = NULL; - RootWindow = NULL; - RootNonPopupWindow = NULL; - - FocusIdxAllCounter = FocusIdxTabCounter = -1; - FocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX; - FocusIdxAllRequestNext = FocusIdxTabRequestNext = INT_MAX; -} - -ImGuiWindow::~ImGuiWindow() -{ - DrawList->~ImDrawList(); - ImGui::MemFree(DrawList); - DrawList = NULL; - ImGui::MemFree(Name); - Name = NULL; -} - -ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end) -{ - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHash(str, str_end ? (int)(str_end - str) : 0, seed); - ImGui::KeepAliveID(id); - return id; -} - -ImGuiID ImGuiWindow::GetID(const void* ptr) -{ - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHash(&ptr, sizeof(void*), seed); - ImGui::KeepAliveID(id); - return id; -} - -ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end) -{ - ImGuiID seed = IDStack.back(); - return ImHash(str, str_end ? (int)(str_end - str) : 0, seed); -} - -//----------------------------------------------------------------------------- -// Internal API exposed in imgui_internal.h -//----------------------------------------------------------------------------- - -static void SetCurrentWindow(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - g.CurrentWindow = window; - if (window) - g.FontSize = window->CalcFontSize(); -} - -ImGuiWindow* ImGui::GetParentWindow() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.CurrentWindowStack.Size >= 2); - return g.CurrentWindowStack[(unsigned int)g.CurrentWindowStack.Size - 2]; -} - -void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - g.ActiveIdIsJustActivated = (g.ActiveId != id); - if (g.ActiveIdIsJustActivated) - g.ActiveIdTimer = 0.0f; - g.ActiveId = id; - g.ActiveIdAllowOverlap = false; - g.ActiveIdIsAlive |= (id != 0); - g.ActiveIdWindow = window; -} - -void ImGui::ClearActiveID() -{ - SetActiveID(0, NULL); -} - -void ImGui::SetHoveredID(ImGuiID id) -{ - ImGuiContext& g = *GImGui; - g.HoveredId = id; - g.HoveredIdAllowOverlap = false; - g.HoveredIdTimer = (id != 0 && g.HoveredIdPreviousFrame == id) ? (g.HoveredIdTimer + g.IO.DeltaTime) : 0.0f; -} - -void ImGui::KeepAliveID(ImGuiID id) -{ - ImGuiContext& g = *GImGui; - if (g.ActiveId == id) - g.ActiveIdIsAlive = true; -} - -static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) -{ - // An active popup disable hovering on other windows (apart from its own children) - // FIXME-OPT: This could be cached/stored within the window. - ImGuiContext& g = *GImGui; - if (g.NavWindow) - if (ImGuiWindow* focused_root_window = g.NavWindow->RootWindow) - if (focused_root_window->WasActive && focused_root_window != window->RootWindow) - { - // For the purpose of those flags we differentiate "standard popup" from "modal popup" - // NB: The order of those two tests is important because Modal windows are also Popups. - if (focused_root_window->Flags & ImGuiWindowFlags_Modal) - return false; - if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup)) - return false; - } - - return true; -} - -// Advance cursor given item size for layout. -void ImGui::ItemSize(const ImVec2& size, float text_offset_y) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - if (window->SkipItems) - return; - - // Always align ourselves on pixel boundaries - const float line_height = ImMax(window->DC.CurrentLineHeight, size.y); - const float text_base_offset = ImMax(window->DC.CurrentLineTextBaseOffset, text_offset_y); - //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG] - window->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x + size.x, window->DC.CursorPos.y); - window->DC.CursorPos = ImVec2((float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX), (float)(int)(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y)); - window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x); - window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y); - //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG] - - window->DC.PrevLineHeight = line_height; - window->DC.PrevLineTextBaseOffset = text_base_offset; - window->DC.CurrentLineHeight = window->DC.CurrentLineTextBaseOffset = 0.0f; - - // Horizontal layout mode - if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) - SameLine(); -} - -void ImGui::ItemSize(const ImRect& bb, float text_offset_y) -{ - ItemSize(bb.GetSize(), text_offset_y); -} - -// Declare item bounding box for clipping and interaction. -// Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface -// declares their minimum size requirement to ItemSize() and then use a larger region for drawing/interaction, which is passed to ItemAdd(). -bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - const bool is_clipped = IsClippedEx(bb, id, false); - window->DC.LastItemId = id; - window->DC.LastItemRect = bb; - window->DC.LastItemRectHoveredRect = false; - if (is_clipped) - return false; - //if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG] - - // We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them) - window->DC.LastItemRectHoveredRect = IsMouseHoveringRect(bb.Min, bb.Max); - return true; -} - -// This is roughly matching the behavior of internal-facing ItemHoverable() -// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered() -// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId -bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) -{ - ImGuiContext& g = *GImGui; - - ImGuiWindow* window = g.CurrentWindow; - if (!window->DC.LastItemRectHoveredRect) - return false; - IM_ASSERT((flags & ImGuiHoveredFlags_FlattenChilds) == 0); // Flags not supported by this function - - // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable to use IsItemHovered() after EndChild() itself. - // Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was the test that has been running for a long while. - //if (g.HoveredWindow != window) - // return false; - if (g.HoveredRootWindow != window->RootWindow && !(flags & ImGuiHoveredFlags_AllowWhenOverlapped)) - return false; - if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) - if (g.ActiveId != 0 && g.ActiveId != window->DC.LastItemId && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId) - return false; - if (!IsWindowContentHoverable(window, flags)) - return false; - if (window->DC.ItemFlags & ImGuiItemFlags_Disabled) - return false; - // Special handling for the 1st item after Begin() which represent the title bar. When the window is collapsed (SkipItems==true) that last item will never be overwritten. - if (window->DC.LastItemId == window->MoveId && window->WriteAccessed) - return false; - return true; -} - -// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered(). -bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) -{ - ImGuiContext& g = *GImGui; - if (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap) - return false; - - ImGuiWindow* window = g.CurrentWindow; - if (g.HoveredWindow != window) - return false; - if (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap) - return false; - if (!IsMouseHoveringRect(bb.Min, bb.Max)) - return false; - if (!IsWindowContentHoverable(window, ImGuiHoveredFlags_Default)) - return false; - if (window->DC.ItemFlags & ImGuiItemFlags_Disabled) - return false; - - SetHoveredID(id); - return true; -} - -bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - if (!bb.Overlaps(window->ClipRect)) - if (id == 0 || id != g.ActiveId) - if (clip_even_when_logged || !g.LogEnabled) - return true; - return false; -} - -bool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop) -{ - ImGuiContext& g = *GImGui; - - const bool allow_keyboard_focus = (window->DC.ItemFlags & (ImGuiItemFlags_AllowKeyboardFocus | ImGuiItemFlags_Disabled)) == ImGuiItemFlags_AllowKeyboardFocus; - window->FocusIdxAllCounter++; - if (allow_keyboard_focus) - window->FocusIdxTabCounter++; - - // Process keyboard input at this point: TAB/Shift-TAB to tab out of the currently focused item. - // Note that we can always TAB out of a widget that doesn't allow tabbing in. - if (tab_stop && (g.ActiveId == id) && window->FocusIdxAllRequestNext == INT_MAX && window->FocusIdxTabRequestNext == INT_MAX && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab)) - window->FocusIdxTabRequestNext = window->FocusIdxTabCounter + (g.IO.KeyShift ? (allow_keyboard_focus ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items. - - if (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent) - return true; - - if (allow_keyboard_focus) - if (window->FocusIdxTabCounter == window->FocusIdxTabRequestCurrent) - return true; - - return false; -} - -void ImGui::FocusableItemUnregister(ImGuiWindow* window) -{ - window->FocusIdxAllCounter--; - window->FocusIdxTabCounter--; -} - -ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_x, float default_y) -{ - ImGuiContext& g = *GImGui; - ImVec2 content_max; - if (size.x < 0.0f || size.y < 0.0f) - content_max = g.CurrentWindow->Pos + GetContentRegionMax(); - if (size.x <= 0.0f) - size.x = (size.x == 0.0f) ? default_x : ImMax(content_max.x - g.CurrentWindow->DC.CursorPos.x, 4.0f) + size.x; - if (size.y <= 0.0f) - size.y = (size.y == 0.0f) ? default_y : ImMax(content_max.y - g.CurrentWindow->DC.CursorPos.y, 4.0f) + size.y; - return size; -} - -float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x) -{ - if (wrap_pos_x < 0.0f) - return 0.0f; - - ImGuiWindow* window = GetCurrentWindowRead(); - if (wrap_pos_x == 0.0f) - wrap_pos_x = GetContentRegionMax().x + window->Pos.x; - else if (wrap_pos_x > 0.0f) - wrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space - - return ImMax(wrap_pos_x - pos.x, 1.0f); -} - -//----------------------------------------------------------------------------- - -void* ImGui::MemAlloc(size_t sz) -{ - GImGui->IO.MetricsAllocs++; - return GImGui->IO.MemAllocFn(sz); -} - -void ImGui::MemFree(void* ptr) -{ - if (ptr) GImGui->IO.MetricsAllocs--; - return GImGui->IO.MemFreeFn(ptr); -} - -const char* ImGui::GetClipboardText() -{ - return GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn(GImGui->IO.ClipboardUserData) : ""; -} - -void ImGui::SetClipboardText(const char* text) -{ - if (GImGui->IO.SetClipboardTextFn) - GImGui->IO.SetClipboardTextFn(GImGui->IO.ClipboardUserData, text); -} - -const char* ImGui::GetVersion() -{ - return IMGUI_VERSION; -} - -// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself -// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module -ImGuiContext* ImGui::GetCurrentContext() -{ - return GImGui; -} - -void ImGui::SetCurrentContext(ImGuiContext* ctx) -{ -#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC - IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this. -#else - GImGui = ctx; -#endif -} - -ImGuiContext* ImGui::CreateContext(void* (*malloc_fn)(size_t), void (*free_fn)(void*)) -{ - if (!malloc_fn) malloc_fn = malloc; - ImGuiContext* ctx = (ImGuiContext*)malloc_fn(sizeof(ImGuiContext)); - IM_PLACEMENT_NEW(ctx) ImGuiContext(); - ctx->IO.MemAllocFn = malloc_fn; - ctx->IO.MemFreeFn = free_fn ? free_fn : free; - return ctx; -} - -void ImGui::DestroyContext(ImGuiContext* ctx) -{ - void (*free_fn)(void*) = ctx->IO.MemFreeFn; - ctx->~ImGuiContext(); - free_fn(ctx); - if (GImGui == ctx) - SetCurrentContext(NULL); -} - -ImGuiIO& ImGui::GetIO() -{ - return GImGui->IO; -} - -ImGuiStyle& ImGui::GetStyle() -{ - return GImGui->Style; -} - -// Same value as passed to your RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame() -ImDrawData* ImGui::GetDrawData() -{ - return GImGui->RenderDrawData.Valid ? &GImGui->RenderDrawData : NULL; -} - -float ImGui::GetTime() -{ - return GImGui->Time; -} - -int ImGui::GetFrameCount() -{ - return GImGui->FrameCount; -} - -void ImGui::NewFrame() -{ - ImGuiContext& g = *GImGui; - - // Check user data - // (We pass an error message in the assert expression as a trick to get it visible to programmers who are not using a debugger, as most assert handlers display their argument) - IM_ASSERT(g.IO.DeltaTime >= 0.0f && "Need a positive DeltaTime (zero is tolerated but will cause some timing issues)"); - IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value"); - IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?"); - IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?"); - IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting"); - IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)"); - IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?"); - - // Initialize on first frame - if (!g.Initialized) - ImGui::Initialize(); - - SetCurrentFont(GetDefaultFont()); - IM_ASSERT(g.Font->IsLoaded()); - - g.Time += g.IO.DeltaTime; - g.FrameCount += 1; - g.TooltipOverrideCount = 0; - g.OverlayDrawList.Clear(); - g.OverlayDrawList.PushTextureID(g.IO.Fonts->TexID); - g.OverlayDrawList.PushClipRectFullScreen(); - - // Mark rendering data as invalid to prevent user who may have a handle on it to use it - g.RenderDrawData.Valid = false; - g.RenderDrawData.CmdLists = NULL; - g.RenderDrawData.CmdListsCount = g.RenderDrawData.TotalVtxCount = g.RenderDrawData.TotalIdxCount = 0; - - // Clear reference to active widget if the widget isn't alive anymore - if (!g.HoveredIdPreviousFrame) - g.HoveredIdTimer = 0.0f; - g.HoveredIdPreviousFrame = g.HoveredId; - g.HoveredId = 0; - g.HoveredIdAllowOverlap = false; - if (!g.ActiveIdIsAlive && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0) - ClearActiveID(); - if (g.ActiveId) - g.ActiveIdTimer += g.IO.DeltaTime; - g.ActiveIdPreviousFrame = g.ActiveId; - g.ActiveIdIsAlive = false; - g.ActiveIdIsJustActivated = false; - if (g.ScalarAsInputTextId && g.ActiveId != g.ScalarAsInputTextId) - g.ScalarAsInputTextId = 0; - - // Update keyboard input state - memcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration)); - for (int i = 0; i < IM_ARRAYSIZE(g.IO.KeysDown); i++) - g.IO.KeysDownDuration[i] = g.IO.KeysDown[i] ? (g.IO.KeysDownDuration[i] < 0.0f ? 0.0f : g.IO.KeysDownDuration[i] + g.IO.DeltaTime) : -1.0f; - - // Update mouse input state - // If mouse just appeared or disappeared (usually denoted by -FLT_MAX component, but in reality we test for -256000.0f) we cancel out movement in MouseDelta - if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev)) - g.IO.MouseDelta = g.IO.MousePos - g.IO.MousePosPrev; - else - g.IO.MouseDelta = ImVec2(0.0f, 0.0f); - g.IO.MousePosPrev = g.IO.MousePos; - for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++) - { - g.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f; - g.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f; - g.IO.MouseDownDurationPrev[i] = g.IO.MouseDownDuration[i]; - g.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f; - g.IO.MouseDoubleClicked[i] = false; - if (g.IO.MouseClicked[i]) - { - if (g.Time - g.IO.MouseClickedTime[i] < g.IO.MouseDoubleClickTime) - { - if (ImLengthSqr(g.IO.MousePos - g.IO.MouseClickedPos[i]) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist) - g.IO.MouseDoubleClicked[i] = true; - g.IO.MouseClickedTime[i] = -FLT_MAX; // so the third click isn't turned into a double-click - } - else - { - g.IO.MouseClickedTime[i] = g.Time; - } - g.IO.MouseClickedPos[i] = g.IO.MousePos; - g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f); - g.IO.MouseDragMaxDistanceSqr[i] = 0.0f; - } - else if (g.IO.MouseDown[i]) - { - ImVec2 mouse_delta = g.IO.MousePos - g.IO.MouseClickedPos[i]; - g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, mouse_delta.x < 0.0f ? -mouse_delta.x : mouse_delta.x); - g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, mouse_delta.y < 0.0f ? -mouse_delta.y : mouse_delta.y); - g.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(mouse_delta)); - } - } - - // Calculate frame-rate for the user, as a purely luxurious feature - g.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx]; - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime; - g.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame); - g.IO.Framerate = 1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame)); - - // Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows. - if (g.MovingWindowMoveId && g.MovingWindowMoveId == g.ActiveId) - { - KeepAliveID(g.MovingWindowMoveId); - IM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow); - IM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId); - if (g.IO.MouseDown[0]) - { - g.MovingWindow->RootWindow->PosFloat += g.IO.MouseDelta; - if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f) - MarkIniSettingsDirty(g.MovingWindow->RootWindow); - FocusWindow(g.MovingWindow); - } - else - { - ClearActiveID(); - g.MovingWindow = NULL; - g.MovingWindowMoveId = 0; - } - } - else - { - g.MovingWindow = NULL; - g.MovingWindowMoveId = 0; - } - - // Delay saving settings so we don't spam disk too much - if (g.SettingsDirtyTimer > 0.0f) - { - g.SettingsDirtyTimer -= g.IO.DeltaTime; - if (g.SettingsDirtyTimer <= 0.0f) - SaveIniSettingsToDisk(g.IO.IniFilename); - } - - // Find the window we are hovering - // - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow. - // - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point. - // - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms. - g.HoveredWindow = (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoInputs)) ? g.MovingWindow : FindHoveredWindow(g.IO.MousePos); - g.HoveredRootWindow = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL; - - if (ImGuiWindow* modal_window = GetFrontMostModalRootWindow()) - { - g.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f); - ImGuiWindow* window = g.HoveredRootWindow; - while (window && window != modal_window) - window = window->ParentWindow; - if (!window) - g.HoveredRootWindow = g.HoveredWindow = NULL; - } - else - { - g.ModalWindowDarkeningRatio = 0.0f; - } - - // Update the WantCaptureMouse/WantCAptureKeyboard flags, so user can capture/discard the inputs away from the rest of their application. - // When clicking outside of a window we assume the click is owned by the application and won't request capture. We need to track click ownership. - int mouse_earliest_button_down = -1; - bool mouse_any_down = false; - for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++) - { - if (g.IO.MouseClicked[i]) - g.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL) || (!g.OpenPopupStack.empty()); - mouse_any_down |= g.IO.MouseDown[i]; - if (g.IO.MouseDown[i]) - if (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[i] < g.IO.MouseClickedTime[mouse_earliest_button_down]) - mouse_earliest_button_down = i; - } - bool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down]; - if (g.WantCaptureMouseNextFrame != -1) - g.IO.WantCaptureMouse = (g.WantCaptureMouseNextFrame != 0); - else - g.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (!g.OpenPopupStack.empty()); - g.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != -1) ? (g.WantCaptureKeyboardNextFrame != 0) : (g.ActiveId != 0); - g.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : 0; - g.MouseCursor = ImGuiMouseCursor_Arrow; - g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = g.WantTextInputNextFrame = -1; - g.OsImePosRequest = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default - - // If mouse was first clicked outside of ImGui bounds we also cancel out hovering. - // FIXME: For patterns of drag and drop between "application" and "imgui" we may need to rework/remove this test (first committed 311c0ca9 on 2015/02) - if (!mouse_avail_to_imgui) - g.HoveredWindow = g.HoveredRootWindow = NULL; - - // Scale & Scrolling - if (g.HoveredWindow && g.IO.MouseWheel != 0.0f && !g.HoveredWindow->Collapsed) - { - ImGuiWindow* window = g.HoveredWindow; - if (g.IO.KeyCtrl && g.IO.FontAllowUserScaling) - { - // Zoom / Scale window - const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); - const float scale = new_font_scale / window->FontWindowScale; - window->FontWindowScale = new_font_scale; - - const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; - window->Pos += offset; - window->PosFloat += offset; - window->Size *= scale; - window->SizeFull *= scale; - } - else if (!g.IO.KeyCtrl && !(window->Flags & ImGuiWindowFlags_NoScrollWithMouse)) - { - // Scroll - const int scroll_lines = (window->Flags & ImGuiWindowFlags_ComboBox) ? 3 : 5; - SetWindowScrollY(window, window->Scroll.y - g.IO.MouseWheel * window->CalcFontSize() * scroll_lines); - } - } - - // Pressing TAB activate widget focus - if (g.ActiveId == 0 && g.NavWindow != NULL && g.NavWindow->Active && IsKeyPressedMap(ImGuiKey_Tab, false)) - g.NavWindow->FocusIdxTabRequestNext = 0; - - // Mark all windows as not visible - for (int i = 0; i != g.Windows.Size; i++) - { - ImGuiWindow* window = g.Windows[i]; - window->WasActive = window->Active; - window->Active = false; - window->WriteAccessed = false; - } - - // Closing the focused window restore focus to the first active root window in descending z-order - if (g.NavWindow && !g.NavWindow->WasActive) - FocusPreviousWindow(); - - // No window should be open at the beginning of the frame. - // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear. - g.CurrentWindowStack.resize(0); - g.CurrentPopupStack.resize(0); - CloseInactivePopups(g.NavWindow); - - // Create implicit window - we will only render it if the user has added something to it. - // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. - ImGui::SetNextWindowSize(ImVec2(400,400), ImGuiCond_FirstUseEver); - ImGui::Begin("Debug##Default"); -} - -static void* SettingsHandlerWindow_ReadOpen(ImGuiContext&, const char* name) -{ - ImGuiWindowSettings* settings = ImGui::FindWindowSettings(ImHash(name, 0)); - if (!settings) - settings = AddWindowSettings(name); - return (void*)settings; -} - -static void SettingsHandlerWindow_ReadLine(ImGuiContext&, void* entry, const char* line) -{ - ImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry; - float x, y; - int i; - if (sscanf(line, "Pos=%f,%f", &x, &y) == 2) settings->Pos = ImVec2(x, y); - else if (sscanf(line, "Size=%f,%f", &x, &y) == 2) settings->Size = ImMax(ImVec2(x, y), GImGui->Style.WindowMinSize); - else if (sscanf(line, "Collapsed=%d", &i) == 1) settings->Collapsed = (i != 0); -} - -static void SettingsHandlerWindow_WriteAll(ImGuiContext& g, ImGuiTextBuffer* buf) -{ - // Gather data from windows that were active during this session - for (int i = 0; i != g.Windows.Size; i++) - { - ImGuiWindow* window = g.Windows[i]; - if (window->Flags & ImGuiWindowFlags_NoSavedSettings) - continue; - ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID); - if (!settings) - settings = AddWindowSettings(window->Name); - settings->Pos = window->Pos; - settings->Size = window->SizeFull; - settings->Collapsed = window->Collapsed; - } - - // Write a buffer - // If a window wasn't opened in this session we preserve its settings - buf->reserve(buf->size() + g.SettingsWindows.Size * 96); // ballpark reserve - for (int i = 0; i != g.SettingsWindows.Size; i++) - { - const ImGuiWindowSettings* settings = &g.SettingsWindows[i]; - if (settings->Pos.x == FLT_MAX) - continue; - const char* name = settings->Name; - if (const char* p = strstr(name, "###")) // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() - name = p; - buf->appendf("[Window][%s]\n", name); - buf->appendf("Pos=%d,%d\n", (int)settings->Pos.x, (int)settings->Pos.y); - buf->appendf("Size=%d,%d\n", (int)settings->Size.x, (int)settings->Size.y); - buf->appendf("Collapsed=%d\n", settings->Collapsed); - buf->appendf("\n"); - } -} - -void ImGui::Initialize() -{ - ImGuiContext& g = *GImGui; - g.LogClipboard = (ImGuiTextBuffer*)ImGui::MemAlloc(sizeof(ImGuiTextBuffer)); - IM_PLACEMENT_NEW(g.LogClipboard) ImGuiTextBuffer(); - - // Add .ini handle for ImGuiWindow type - ImGuiSettingsHandler ini_handler; - ini_handler.TypeName = "Window"; - ini_handler.TypeHash = ImHash("Window", 0, 0); - ini_handler.ReadOpenFn = SettingsHandlerWindow_ReadOpen; - ini_handler.ReadLineFn = SettingsHandlerWindow_ReadLine; - ini_handler.WriteAllFn = SettingsHandlerWindow_WriteAll; - g.SettingsHandlers.push_front(ini_handler); - - // Load .ini file - IM_ASSERT(g.SettingsWindows.empty()); - LoadIniSettingsFromDisk(g.IO.IniFilename); - g.Initialized = true; -} - -// This function is merely here to free heap allocations. -void ImGui::Shutdown() -{ - ImGuiContext& g = *GImGui; - - // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame) - if (g.IO.Fonts) // Testing for NULL to allow user to NULLify in case of running Shutdown() on multiple contexts. Bit hacky. - g.IO.Fonts->Clear(); - - // Cleanup of other data are conditional on actually having initialize ImGui. - if (!g.Initialized) - return; - - SaveIniSettingsToDisk(g.IO.IniFilename); - - for (int i = 0; i < g.Windows.Size; i++) - { - g.Windows[i]->~ImGuiWindow(); - ImGui::MemFree(g.Windows[i]); - } - g.Windows.clear(); - g.WindowsSortBuffer.clear(); - g.CurrentWindow = NULL; - g.CurrentWindowStack.clear(); - g.WindowsById.Clear(); - g.NavWindow = NULL; - g.HoveredWindow = NULL; - g.HoveredRootWindow = NULL; - g.ActiveIdWindow = NULL; - g.MovingWindow = NULL; - for (int i = 0; i < g.SettingsWindows.Size; i++) - ImGui::MemFree(g.SettingsWindows[i].Name); - g.ColorModifiers.clear(); - g.StyleModifiers.clear(); - g.FontStack.clear(); - g.OpenPopupStack.clear(); - g.CurrentPopupStack.clear(); - g.SetNextWindowSizeConstraintCallback = NULL; - g.SetNextWindowSizeConstraintCallbackUserData = NULL; - for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++) - g.RenderDrawLists[i].clear(); - g.OverlayDrawList.ClearFreeMemory(); - g.PrivateClipboard.clear(); - g.InputTextState.Text.clear(); - g.InputTextState.InitialText.clear(); - g.InputTextState.TempTextBuffer.clear(); - - g.SettingsWindows.clear(); - g.SettingsHandlers.clear(); - - if (g.LogFile && g.LogFile != stdout) - { - fclose(g.LogFile); - g.LogFile = NULL; - } - if (g.LogClipboard) - { - g.LogClipboard->~ImGuiTextBuffer(); - ImGui::MemFree(g.LogClipboard); - } - - g.Initialized = false; -} - -ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id) -{ - ImGuiContext& g = *GImGui; - for (int i = 0; i != g.SettingsWindows.Size; i++) - if (g.SettingsWindows[i].Id == id) - return &g.SettingsWindows[i]; - return NULL; -} - -static ImGuiWindowSettings* AddWindowSettings(const char* name) -{ - ImGuiContext& g = *GImGui; - g.SettingsWindows.push_back(ImGuiWindowSettings()); - ImGuiWindowSettings* settings = &g.SettingsWindows.back(); - settings->Name = ImStrdup(name); - settings->Id = ImHash(name, 0); - return settings; -} - -static void LoadIniSettingsFromDisk(const char* ini_filename) -{ - if (!ini_filename) - return; - char* file_data = (char*)ImFileLoadToMemory(ini_filename, "rb", NULL, +1); - if (!file_data) - return; - LoadIniSettingsFromMemory(file_data); - ImGui::MemFree(file_data); -} - -ImGuiSettingsHandler* ImGui::FindSettingsHandler(ImGuiID type_hash) -{ - ImGuiContext& g = *GImGui; - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - if (g.SettingsHandlers[handler_n].TypeHash == type_hash) - return &g.SettingsHandlers[handler_n]; - return NULL; -} - -// Zero-tolerance, no error reporting, cheap .ini parsing -static void LoadIniSettingsFromMemory(const char* buf_readonly) -{ - // For convenience and to make the code simpler, we'll write zero terminators inside the buffer. So let's create a writable copy. - char* buf = ImStrdup(buf_readonly); - char* buf_end = buf + strlen(buf); - - ImGuiContext& g = *GImGui; - void* entry_data = NULL; - const ImGuiSettingsHandler* entry_handler = NULL; - - char* line_end = NULL; - for (char* line = buf; line < buf_end; line = line_end + 1) - { - // Skip new lines markers, then find end of the line - while (*line == '\n' || *line == '\r') - line++; - line_end = line; - while (line_end < buf_end && *line_end != '\n' && *line_end != '\r') - line_end++; - line_end[0] = 0; - - if (line[0] == '[' && line_end > line && line_end[-1] == ']') - { - // Parse "[Type][Name]". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code. - char* name_end = line_end - 1; - *name_end = 0; - const char* type_start = line + 1; - char* type_end = ImStrchrRange(type_start, name_end, ']'); - const char* name_start = type_end ? ImStrchrRange(type_end + 1, name_end, '[') : NULL; - if (!type_end || !name_start) - { - name_start = type_start; // Import legacy entries that have no type - type_start = "Window"; - } - else - { - *type_end = 0; // Overwrite first ']' - name_start++; // Skip second '[' - } - const ImGuiID type_hash = ImHash(type_start, 0, 0); - entry_handler = ImGui::FindSettingsHandler(type_hash); - entry_data = entry_handler ? entry_handler->ReadOpenFn(g, name_start) : NULL; - } - else if (entry_handler != NULL && entry_data != NULL) - { - // Let type handler parse the line - entry_handler->ReadLineFn(g, entry_data, line); - } - } - ImGui::MemFree(buf); -} - -static void SaveIniSettingsToDisk(const char* ini_filename) -{ - ImGuiContext& g = *GImGui; - g.SettingsDirtyTimer = 0.0f; - if (!ini_filename) - return; - - ImVector buf; - SaveIniSettingsToMemory(buf); - - FILE* f = ImFileOpen(ini_filename, "wt"); - if (!f) - return; - fwrite(buf.Data, sizeof(char), (size_t)buf.Size, f); - fclose(f); -} - -static void SaveIniSettingsToMemory(ImVector& out_buf) -{ - ImGuiContext& g = *GImGui; - g.SettingsDirtyTimer = 0.0f; - - ImGuiTextBuffer buf; - for (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++) - g.SettingsHandlers[handler_n].WriteAllFn(g, &buf); - - buf.Buf.pop_back(); // Remove extra zero-terminator used by ImGuiTextBuffer - out_buf.swap(buf.Buf); -} - -void ImGui::MarkIniSettingsDirty() -{ - ImGuiContext& g = *GImGui; - if (g.SettingsDirtyTimer <= 0.0f) - g.SettingsDirtyTimer = g.IO.IniSavingRate; -} - -static void MarkIniSettingsDirty(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings)) - if (g.SettingsDirtyTimer <= 0.0f) - g.SettingsDirtyTimer = g.IO.IniSavingRate; -} - -// FIXME: Add a more explicit sort order in the window structure. -static int ChildWindowComparer(const void* lhs, const void* rhs) -{ - const ImGuiWindow* a = *(const ImGuiWindow**)lhs; - const ImGuiWindow* b = *(const ImGuiWindow**)rhs; - if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup)) - return d; - if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip)) - return d; - if (int d = (a->Flags & ImGuiWindowFlags_ComboBox) - (b->Flags & ImGuiWindowFlags_ComboBox)) - return d; - return (a->OrderWithinParent - b->OrderWithinParent); -} - -static void AddWindowToSortedBuffer(ImVector& out_sorted_windows, ImGuiWindow* window) -{ - out_sorted_windows.push_back(window); - if (window->Active) - { - int count = window->DC.ChildWindows.Size; - if (count > 1) - qsort(window->DC.ChildWindows.begin(), (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer); - for (int i = 0; i < count; i++) - { - ImGuiWindow* child = window->DC.ChildWindows[i]; - if (child->Active) - AddWindowToSortedBuffer(out_sorted_windows, child); - } - } -} - -static void AddDrawListToRenderList(ImVector& out_render_list, ImDrawList* draw_list) -{ - if (draw_list->CmdBuffer.empty()) - return; - - // Remove trailing command if unused - ImDrawCmd& last_cmd = draw_list->CmdBuffer.back(); - if (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL) - { - draw_list->CmdBuffer.pop_back(); - if (draw_list->CmdBuffer.empty()) - return; - } - - // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. May trigger for you if you are using PrimXXX functions incorrectly. - IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); - IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); - IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); - - // Check that draw_list doesn't use more vertices than indexable in a single draw call (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per window) - // If this assert triggers because you are drawing lots of stuff manually, you can: - // A) Add '#define ImDrawIdx unsigned int' in imconfig.h to set the index size to 4 bytes. You'll need to handle the 4-bytes indices to your renderer. - // For example, the OpenGL example code detect index size at compile-time by doing: - // 'glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);' - // Your own engine or render API may use different parameters or function calls to specify index sizes. 2 and 4 bytes indices are generally supported by most API. - // B) If for some reason you cannot use 4 bytes indices or don't want to, a workaround is to call BeginChild()/EndChild() before reaching the 64K limit to split your draw commands in multiple draw lists. - IM_ASSERT(((ImU64)draw_list->_VtxCurrentIdx >> (sizeof(ImDrawIdx)*8)) == 0); // Too many vertices in same ImDrawList. See comment above. - - out_render_list.push_back(draw_list); - GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size; - GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size; -} - -static void AddWindowToRenderList(ImVector& out_render_list, ImGuiWindow* window) -{ - AddDrawListToRenderList(out_render_list, window->DrawList); - for (int i = 0; i < window->DC.ChildWindows.Size; i++) - { - ImGuiWindow* child = window->DC.ChildWindows[i]; - if (!child->Active) // clipped children may have been marked not active - continue; - if ((child->Flags & ImGuiWindowFlags_Popup) && child->HiddenFrames > 0) - continue; - AddWindowToRenderList(out_render_list, child); - } -} - -static void AddWindowToRenderListSelectLayer(ImGuiWindow* window) -{ - // FIXME: Generalize this with a proper layering system so e.g. user can draw in specific layers, below text, .. - ImGuiContext& g = *GImGui; - g.IO.MetricsActiveWindows++; - if (window->Flags & ImGuiWindowFlags_Popup) - AddWindowToRenderList(g.RenderDrawLists[1], window); - else if (window->Flags & ImGuiWindowFlags_Tooltip) - AddWindowToRenderList(g.RenderDrawLists[2], window); - else - AddWindowToRenderList(g.RenderDrawLists[0], window); -} - -// When using this function it is sane to ensure that float are perfectly rounded to integer values, to that e.g. (int)(max.x-min.x) in user's render produce correct result. -void ImGui::PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DrawList->PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect); - window->ClipRect = window->DrawList->_ClipRectStack.back(); -} - -void ImGui::PopClipRect() -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DrawList->PopClipRect(); - window->ClipRect = window->DrawList->_ClipRectStack.back(); -} - -// This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal. -void ImGui::EndFrame() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame() - if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times. - return; - - // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) - if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.OsImePosRequest - g.OsImePosSet) > 0.0001f) - { - g.IO.ImeSetInputScreenPosFn((int)g.OsImePosRequest.x, (int)g.OsImePosRequest.y); - g.OsImePosSet = g.OsImePosRequest; - } - - // Hide implicit "Debug" window if it hasn't been used - IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls - if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) - g.CurrentWindow->Active = false; - ImGui::End(); - - if (g.ActiveId == 0 && g.HoveredId == 0) - { - if (!g.NavWindow || !g.NavWindow->Appearing) // Unless we just made a window/popup appear - { - // Click to focus window and start moving (after we're done with all our widgets) - if (g.IO.MouseClicked[0]) - { - if (g.HoveredRootWindow != NULL) - { - FocusWindow(g.HoveredWindow); - if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove)) - { - g.MovingWindow = g.HoveredWindow; - g.MovingWindowMoveId = g.MovingWindow->MoveId; - SetActiveID(g.MovingWindowMoveId, g.HoveredRootWindow); - } - } - else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL) - { - // Clicking on void disable focus - FocusWindow(NULL); - } - } - - // With right mouse button we close popups without changing focus - // (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger) - if (g.IO.MouseClicked[1]) - { - // Find the top-most window between HoveredWindow and the front most Modal Window. - // This is where we can trim the popup stack. - ImGuiWindow* modal = GetFrontMostModalRootWindow(); - bool hovered_window_above_modal = false; - if (modal == NULL) - hovered_window_above_modal = true; - for (int i = g.Windows.Size - 1; i >= 0 && hovered_window_above_modal == false; i--) - { - ImGuiWindow* window = g.Windows[i]; - if (window == modal) - break; - if (window == g.HoveredWindow) - hovered_window_above_modal = true; - } - CloseInactivePopups(hovered_window_above_modal ? g.HoveredWindow : modal); - } - } - } - - // Sort the window list so that all child windows are after their parent - // We cannot do that on FocusWindow() because childs may not exist yet - g.WindowsSortBuffer.resize(0); - g.WindowsSortBuffer.reserve(g.Windows.Size); - for (int i = 0; i != g.Windows.Size; i++) - { - ImGuiWindow* window = g.Windows[i]; - if (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow)) // if a child is active its parent will add it - continue; - AddWindowToSortedBuffer(g.WindowsSortBuffer, window); - } - - IM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size); // we done something wrong - g.Windows.swap(g.WindowsSortBuffer); - - // Clear Input data for next frame - g.IO.MouseWheel = 0.0f; - memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); - - g.FrameCountEnded = g.FrameCount; -} - -void ImGui::Render() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame() - - if (g.FrameCountEnded != g.FrameCount) - ImGui::EndFrame(); - g.FrameCountRendered = g.FrameCount; - - // Skip render altogether if alpha is 0.0 - // Note that vertex buffers have been created and are wasted, so it is best practice that you don't create windows in the first place, or consistently respond to Begin() returning false. - if (g.Style.Alpha > 0.0f) - { - // Gather windows to render - g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0; - for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++) - g.RenderDrawLists[i].resize(0); - for (int i = 0; i != g.Windows.Size; i++) - { - ImGuiWindow* window = g.Windows[i]; - if (window->Active && window->HiddenFrames <= 0 && (window->Flags & (ImGuiWindowFlags_ChildWindow)) == 0) - AddWindowToRenderListSelectLayer(window); - } - - // Flatten layers - int n = g.RenderDrawLists[0].Size; - int flattened_size = n; - for (int i = 1; i < IM_ARRAYSIZE(g.RenderDrawLists); i++) - flattened_size += g.RenderDrawLists[i].Size; - g.RenderDrawLists[0].resize(flattened_size); - for (int i = 1; i < IM_ARRAYSIZE(g.RenderDrawLists); i++) - { - ImVector& layer = g.RenderDrawLists[i]; - if (layer.empty()) - continue; - memcpy(&g.RenderDrawLists[0][n], &layer[0], layer.Size * sizeof(ImDrawList*)); - n += layer.Size; - } - - // Draw software mouse cursor if requested - if (g.IO.MouseDrawCursor) - { - const ImGuiMouseCursorData& cursor_data = g.MouseCursorData[g.MouseCursor]; - const ImVec2 pos = g.IO.MousePos - cursor_data.HotOffset; - const ImVec2 size = cursor_data.Size; - const ImTextureID tex_id = g.IO.Fonts->TexID; - g.OverlayDrawList.PushTextureID(tex_id); - g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(1,0), pos+ImVec2(1,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0,0,0,48)); // Shadow - g.OverlayDrawList.AddImage(tex_id, pos+ImVec2(2,0), pos+ImVec2(2,0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0,0,0,48)); // Shadow - g.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0,0,0,255)); // Black border - g.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[0], cursor_data.TexUvMax[0], IM_COL32(255,255,255,255)); // White fill - g.OverlayDrawList.PopTextureID(); - } - if (!g.OverlayDrawList.VtxBuffer.empty()) - AddDrawListToRenderList(g.RenderDrawLists[0], &g.OverlayDrawList); - - // Setup draw data - g.RenderDrawData.Valid = true; - g.RenderDrawData.CmdLists = (g.RenderDrawLists[0].Size > 0) ? &g.RenderDrawLists[0][0] : NULL; - g.RenderDrawData.CmdListsCount = g.RenderDrawLists[0].Size; - g.RenderDrawData.TotalVtxCount = g.IO.MetricsRenderVertices; - g.RenderDrawData.TotalIdxCount = g.IO.MetricsRenderIndices; - - // Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData() - if (g.RenderDrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL) - g.IO.RenderDrawListsFn(&g.RenderDrawData); - } -} - -const char* ImGui::FindRenderedTextEnd(const char* text, const char* text_end) -{ - const char* text_display_end = text; - if (!text_end) - text_end = (const char*)-1; - - while (text_display_end < text_end && *text_display_end != '\0' && (text_display_end[0] != '#' || text_display_end[1] != '#')) - text_display_end++; - return text_display_end; -} - -// Pass text data straight to log (without being displayed) -void ImGui::LogText(const char* fmt, ...) -{ - ImGuiContext& g = *GImGui; - if (!g.LogEnabled) - return; - - va_list args; - va_start(args, fmt); - if (g.LogFile) - { - vfprintf(g.LogFile, fmt, args); - } - else - { - g.LogClipboard->appendfv(fmt, args); - } - va_end(args); -} - -// Internal version that takes a position to decide on newline placement and pad items according to their depth. -// We split text into individual lines to add current tree level padding -static void LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end = NULL) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - if (!text_end) - text_end = ImGui::FindRenderedTextEnd(text, text_end); - - const bool log_new_line = ref_pos && (ref_pos->y > window->DC.LogLinePosY + 1); - if (ref_pos) - window->DC.LogLinePosY = ref_pos->y; - - const char* text_remaining = text; - if (g.LogStartDepth > window->DC.TreeDepth) // Re-adjust padding if we have popped out of our starting depth - g.LogStartDepth = window->DC.TreeDepth; - const int tree_depth = (window->DC.TreeDepth - g.LogStartDepth); - for (;;) - { - // Split the string. Each new line (after a '\n') is followed by spacing corresponding to the current depth of our log entry. - const char* line_end = text_remaining; - while (line_end < text_end) - if (*line_end == '\n') - break; - else - line_end++; - if (line_end >= text_end) - line_end = NULL; - - const bool is_first_line = (text == text_remaining); - bool is_last_line = false; - if (line_end == NULL) - { - is_last_line = true; - line_end = text_end; - } - if (line_end != NULL && !(is_last_line && (line_end - text_remaining)==0)) - { - const int char_count = (int)(line_end - text_remaining); - if (log_new_line || !is_first_line) - ImGui::LogText(IM_NEWLINE "%*s%.*s", tree_depth*4, "", char_count, text_remaining); - else - ImGui::LogText(" %.*s", char_count, text_remaining); - } - - if (is_last_line) - break; - text_remaining = line_end + 1; - } -} - -// Internal ImGui functions to render text -// RenderText***() functions calls ImDrawList::AddText() calls ImBitmapFont::RenderText() -void ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - // Hide anything after a '##' string - const char* text_display_end; - if (hide_text_after_hash) - { - text_display_end = FindRenderedTextEnd(text, text_end); - } - else - { - if (!text_end) - text_end = text + strlen(text); // FIXME-OPT - text_display_end = text_end; - } - - const int text_len = (int)(text_display_end - text); - if (text_len > 0) - { - window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end); - if (g.LogEnabled) - LogRenderedText(&pos, text, text_display_end); - } -} - -void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - if (!text_end) - text_end = text + strlen(text); // FIXME-OPT - - const int text_len = (int)(text_end - text); - if (text_len > 0) - { - window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width); - if (g.LogEnabled) - LogRenderedText(&pos, text, text_end); - } -} - -// Default clip_rect uses (pos_min,pos_max) -// Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges) -void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect) -{ - // Hide anything after a '##' string - const char* text_display_end = FindRenderedTextEnd(text, text_end); - const int text_len = (int)(text_display_end - text); - if (text_len == 0) - return; - - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - // Perform CPU side clipping for single clipped element to avoid using scissor state - ImVec2 pos = pos_min; - const ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f); - - const ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min; - const ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max; - bool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y); - if (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min - need_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y); - - // Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment. - if (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x); - if (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y); - - // Render - if (need_clipping) - { - ImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y); - window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect); - } - else - { - window->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL); - } - if (g.LogEnabled) - LogRenderedText(&pos, text, text_display_end); -} - -// Render a rectangle shaped with optional rounding and borders -void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding); - const float border_size = g.Style.FrameBorderSize; - if (border && border_size > 0.0f) - { - window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size); - window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size); - } -} - -void ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - const float border_size = g.Style.FrameBorderSize; - if (border_size > 0.0f) - { - window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size); - window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size); - } -} - -// Render a triangle to denote expanded/collapsed state -void ImGui::RenderTriangle(ImVec2 p_min, ImGuiDir dir, float scale) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - const float h = g.FontSize * 1.00f; - float r = h * 0.40f * scale; - ImVec2 center = p_min + ImVec2(h * 0.50f, h * 0.50f * scale); - - ImVec2 a, b, c; - switch (dir) - { - case ImGuiDir_Up: - r = -r; // ...fall through, no break! - case ImGuiDir_Down: - center.y -= r * 0.25f; - a = ImVec2(0,1) * r; - b = ImVec2(-0.866f,-0.5f) * r; - c = ImVec2(+0.866f,-0.5f) * r; - break; - case ImGuiDir_Left: - r = -r; // ...fall through, no break! - case ImGuiDir_Right: - center.x -= r * 0.25f; - a = ImVec2(1,0) * r; - b = ImVec2(-0.500f,+0.866f) * r; - c = ImVec2(-0.500f,-0.866f) * r; - break; - default: - IM_ASSERT(0); - break; - } - - window->DrawList->AddTriangleFilled(center + a, center + b, center + c, GetColorU32(ImGuiCol_Text)); -} - -void ImGui::RenderBullet(ImVec2 pos) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - window->DrawList->AddCircleFilled(pos, GImGui->FontSize*0.20f, GetColorU32(ImGuiCol_Text), 8); -} - -void ImGui::RenderCheckMark(ImVec2 pos, ImU32 col, float sz) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - float thickness = ImMax(sz / 5.0f, 1.0f); - sz -= thickness*0.5f; - pos += ImVec2(thickness*0.25f, thickness*0.25f); - - float third = sz / 3.0f; - float bx = pos.x + third; - float by = pos.y + sz - third*0.5f; - window->DrawList->PathLineTo(ImVec2(bx - third, by - third)); - window->DrawList->PathLineTo(ImVec2(bx, by)); - window->DrawList->PathLineTo(ImVec2(bx + third*2, by - third*2)); - window->DrawList->PathStroke(col, false, thickness); -} - -// Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker. -// CalcTextSize("") should return ImVec2(0.0f, GImGui->FontSize) -ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width) -{ - ImGuiContext& g = *GImGui; - - const char* text_display_end; - if (hide_text_after_double_hash) - text_display_end = FindRenderedTextEnd(text, text_end); // Hide anything after a '##' string - else - text_display_end = text_end; - - ImFont* font = g.Font; - const float font_size = g.FontSize; - if (text == text_display_end) - return ImVec2(0.0f, font_size); - ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL); - - // Cancel out character spacing for the last character of a line (it is baked into glyph->AdvanceX field) - const float font_scale = font_size / font->FontSize; - const float character_spacing_x = 1.0f * font_scale; - if (text_size.x > 0.0f) - text_size.x -= character_spacing_x; - text_size.x = (float)(int)(text_size.x + 0.95f); - - return text_size; -} - -// Helper to calculate coarse clipping of large list of evenly sized items. -// NB: Prefer using the ImGuiListClipper higher-level helper if you can! Read comments and instructions there on how those use this sort of pattern. -// NB: 'items_count' is only used to clamp the result, if you don't know your count you can use INT_MAX -void ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - if (g.LogEnabled) - { - // If logging is active, do not perform any clipping - *out_items_display_start = 0; - *out_items_display_end = items_count; - return; - } - if (window->SkipItems) - { - *out_items_display_start = *out_items_display_end = 0; - return; - } - - const ImVec2 pos = window->DC.CursorPos; - int start = (int)((window->ClipRect.Min.y - pos.y) / items_height); - int end = (int)((window->ClipRect.Max.y - pos.y) / items_height); - start = ImClamp(start, 0, items_count); - end = ImClamp(end + 1, start, items_count); - *out_items_display_start = start; - *out_items_display_end = end; -} - -// Find window given position, search front-to-back -// FIXME: Note that we have a lag here because WindowRectClipped is updated in Begin() so windows moved by user via SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window thankfully isn't affected. -static ImGuiWindow* FindHoveredWindow(ImVec2 pos) -{ - ImGuiContext& g = *GImGui; - for (int i = g.Windows.Size-1; i >= 0; i--) - { - ImGuiWindow* window = g.Windows[i]; - if (!window->Active) - continue; - if (window->Flags & ImGuiWindowFlags_NoInputs) - continue; - - // Using the clipped AABB, a child window will typically be clipped by its parent (not always) - ImRect bb(window->WindowRectClipped.Min - g.Style.TouchExtraPadding, window->WindowRectClipped.Max + g.Style.TouchExtraPadding); - if (bb.Contains(pos)) - return window; - } - return NULL; -} - -// Test if mouse cursor is hovering given rectangle -// NB- Rectangle is clipped by our current clip setting -// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding) -bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - // Clip - ImRect rect_clipped(r_min, r_max); - if (clip) - rect_clipped.ClipWith(window->ClipRect); - - // Expand for touch input - const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); - return rect_for_touch.Contains(g.IO.MousePos); -} - -bool ImGui::IsAnyWindowHovered() -{ - ImGuiContext& g = *GImGui; - return g.HoveredWindow != NULL; -} - -static bool IsKeyPressedMap(ImGuiKey key, bool repeat) -{ - const int key_index = GImGui->IO.KeyMap[key]; - return (key_index >= 0) ? ImGui::IsKeyPressed(key_index, repeat) : false; -} - -int ImGui::GetKeyIndex(ImGuiKey imgui_key) -{ - IM_ASSERT(imgui_key >= 0 && imgui_key < ImGuiKey_COUNT); - return GImGui->IO.KeyMap[imgui_key]; -} - -// Note that imgui doesn't know the semantic of each entry of io.KeyDown[]. Use your own indices/enums according to how your backend/engine stored them into KeyDown[]! -bool ImGui::IsKeyDown(int user_key_index) -{ - if (user_key_index < 0) return false; - IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(GImGui->IO.KeysDown)); - return GImGui->IO.KeysDown[user_key_index]; -} - -int ImGui::CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate) -{ - if (t == 0.0f) - return 1; - if (t <= repeat_delay || repeat_rate <= 0.0f) - return 0; - const int count = (int)((t - repeat_delay) / repeat_rate) - (int)((t_prev - repeat_delay) / repeat_rate); - return (count > 0) ? count : 0; -} - -int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate) -{ - ImGuiContext& g = *GImGui; - if (key_index < 0) return false; - IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - const float t = g.IO.KeysDownDuration[key_index]; - return CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, repeat_delay, repeat_rate); -} - -bool ImGui::IsKeyPressed(int user_key_index, bool repeat) -{ - ImGuiContext& g = *GImGui; - if (user_key_index < 0) return false; - IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - const float t = g.IO.KeysDownDuration[user_key_index]; - if (t == 0.0f) - return true; - if (repeat && t > g.IO.KeyRepeatDelay) - return GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0; - return false; -} - -bool ImGui::IsKeyReleased(int user_key_index) -{ - ImGuiContext& g = *GImGui; - if (user_key_index < 0) return false; - IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - if (g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index]) - return true; - return false; -} - -bool ImGui::IsMouseDown(int button) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseDown[button]; -} - -bool ImGui::IsMouseClicked(int button, bool repeat) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - const float t = g.IO.MouseDownDuration[button]; - if (t == 0.0f) - return true; - - if (repeat && t > g.IO.KeyRepeatDelay) - { - float delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate; - if ((fmodf(t - delay, rate) > rate*0.5f) != (fmodf(t - delay - g.IO.DeltaTime, rate) > rate*0.5f)) - return true; - } - - return false; -} - -bool ImGui::IsMouseReleased(int button) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseReleased[button]; -} - -bool ImGui::IsMouseDoubleClicked(int button) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseDoubleClicked[button]; -} - -bool ImGui::IsMouseDragging(int button, float lock_threshold) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (!g.IO.MouseDown[button]) - return false; - if (lock_threshold < 0.0f) - lock_threshold = g.IO.MouseDragThreshold; - return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold; -} - -ImVec2 ImGui::GetMousePos() -{ - return GImGui->IO.MousePos; -} - -// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed! -ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup() -{ - ImGuiContext& g = *GImGui; - if (g.CurrentPopupStack.Size > 0) - return g.OpenPopupStack[g.CurrentPopupStack.Size-1].MousePosOnOpen; - return g.IO.MousePos; -} - -// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position -bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) -{ - if (mouse_pos == NULL) - mouse_pos = &GImGui->IO.MousePos; - const float MOUSE_INVALID = -256000.0f; - return mouse_pos->x >= MOUSE_INVALID && mouse_pos->y >= MOUSE_INVALID; -} - -ImVec2 ImGui::GetMouseDragDelta(int button, float lock_threshold) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (lock_threshold < 0.0f) - lock_threshold = g.IO.MouseDragThreshold; - if (g.IO.MouseDown[button]) - if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold) - return g.IO.MousePos - g.IO.MouseClickedPos[button]; // Assume we can only get active with left-mouse button (at the moment). - return ImVec2(0.0f, 0.0f); -} - -void ImGui::ResetMouseDragDelta(int button) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr - g.IO.MouseClickedPos[button] = g.IO.MousePos; -} - -ImGuiMouseCursor ImGui::GetMouseCursor() -{ - return GImGui->MouseCursor; -} - -void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type) -{ - GImGui->MouseCursor = cursor_type; -} - -void ImGui::CaptureKeyboardFromApp(bool capture) -{ - GImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0; -} - -void ImGui::CaptureMouseFromApp(bool capture) -{ - GImGui->WantCaptureMouseNextFrame = capture ? 1 : 0; -} - -bool ImGui::IsItemActive() -{ - ImGuiContext& g = *GImGui; - if (g.ActiveId) - { - ImGuiWindow* window = g.CurrentWindow; - return g.ActiveId == window->DC.LastItemId; - } - return false; -} - -bool ImGui::IsItemClicked(int mouse_button) -{ - return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_Default); -} - -bool ImGui::IsAnyItemHovered() -{ - return GImGui->HoveredId != 0 || GImGui->HoveredIdPreviousFrame != 0; -} - -bool ImGui::IsAnyItemActive() -{ - return GImGui->ActiveId != 0; -} - -bool ImGui::IsItemVisible() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->ClipRect.Overlaps(window->DC.LastItemRect); -} - -// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority. -void ImGui::SetItemAllowOverlap() -{ - ImGuiContext& g = *GImGui; - if (g.HoveredId == g.CurrentWindow->DC.LastItemId) - g.HoveredIdAllowOverlap = true; - if (g.ActiveId == g.CurrentWindow->DC.LastItemId) - g.ActiveIdAllowOverlap = true; -} - -ImVec2 ImGui::GetItemRectMin() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.LastItemRect.Min; -} - -ImVec2 ImGui::GetItemRectMax() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.LastItemRect.Max; -} - -ImVec2 ImGui::GetItemRectSize() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.LastItemRect.GetSize(); -} - -ImVec2 ImGui::CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge, float outward) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - ImRect rect = window->DC.LastItemRect; - rect.Expand(outward); - return rect.GetClosestPoint(pos, on_edge); -} - -static ImRect GetVisibleRect() -{ - ImGuiContext& g = *GImGui; - if (g.IO.DisplayVisibleMin.x != g.IO.DisplayVisibleMax.x && g.IO.DisplayVisibleMin.y != g.IO.DisplayVisibleMax.y) - return ImRect(g.IO.DisplayVisibleMin, g.IO.DisplayVisibleMax); - return ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y); -} - -// Not exposed publicly as BeginTooltip() because bool parameters are evil. Let's see if other needs arise first. -void ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip) -{ - ImGuiContext& g = *GImGui; - char window_name[16]; - ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip%02d", g.TooltipOverrideCount); - if (override_previous_tooltip) - if (ImGuiWindow* window = ImGui::FindWindowByName(window_name)) - if (window->Active) - { - // Hide previous tooltips. We can't easily "reset" the content of a window so we create a new one. - window->HiddenFrames = 1; - ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip%02d", ++g.TooltipOverrideCount); - } - ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_AlwaysAutoResize; - ImGui::Begin(window_name, NULL, flags | extra_flags); -} - -void ImGui::SetTooltipV(const char* fmt, va_list args) -{ - BeginTooltipEx(0, true); - TextV(fmt, args); - EndTooltip(); -} - -void ImGui::SetTooltip(const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - SetTooltipV(fmt, args); - va_end(args); -} - -void ImGui::BeginTooltip() -{ - BeginTooltipEx(0, false); -} - -void ImGui::EndTooltip() -{ - IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip); // Mismatched BeginTooltip()/EndTooltip() calls - ImGui::End(); -} - -// Mark popup as open (toggle toward open state). -// Popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. -// Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). -// One open popup per level of the popup hierarchy (NB: when assigning we reset the Window member of ImGuiPopupRef to NULL) -void ImGui::OpenPopupEx(ImGuiID id, bool reopen_existing) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - int current_stack_size = g.CurrentPopupStack.Size; - ImGuiPopupRef popup_ref = ImGuiPopupRef(id, window, window->GetID("##menus"), g.IO.MousePos); // Tagged as new ref because constructor sets Window to NULL (we are passing the ParentWindow info here) - if (g.OpenPopupStack.Size < current_stack_size + 1) - g.OpenPopupStack.push_back(popup_ref); - else if (reopen_existing || g.OpenPopupStack[current_stack_size].PopupId != id) - { - g.OpenPopupStack.resize(current_stack_size+1); - g.OpenPopupStack[current_stack_size] = popup_ref; - - // When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by CloseInactivePopups(). - // This is equivalent to what ClosePopupToLevel() does. - if (g.OpenPopupStack[current_stack_size].PopupId == id) - FocusWindow(window); - } -} - -void ImGui::OpenPopup(const char* str_id) -{ - ImGuiContext& g = *GImGui; - OpenPopupEx(g.CurrentWindow->GetID(str_id), false); -} - -static void CloseInactivePopups(ImGuiWindow* ref_window) -{ - ImGuiContext& g = *GImGui; - if (g.OpenPopupStack.empty()) - return; - - // When popups are stacked, clicking on a lower level popups puts focus back to it and close popups above it. - // Don't close our own child popup windows. - int n = 0; - if (ref_window) - { - for (n = 0; n < g.OpenPopupStack.Size; n++) - { - ImGuiPopupRef& popup = g.OpenPopupStack[n]; - if (!popup.Window) - continue; - IM_ASSERT((popup.Window->Flags & ImGuiWindowFlags_Popup) != 0); - if (popup.Window->Flags & ImGuiWindowFlags_ChildWindow) - continue; - - // Trim the stack if popups are not direct descendant of the reference window (which is often the NavWindow) - bool has_focus = false; - for (int m = n; m < g.OpenPopupStack.Size && !has_focus; m++) - has_focus = (g.OpenPopupStack[m].Window && g.OpenPopupStack[m].Window->RootWindow == ref_window->RootWindow); - if (!has_focus) - break; - } - } - if (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the block below - ClosePopupToLevel(n); -} - -static ImGuiWindow* GetFrontMostModalRootWindow() -{ - ImGuiContext& g = *GImGui; - for (int n = g.OpenPopupStack.Size-1; n >= 0; n--) - if (ImGuiWindow* popup = g.OpenPopupStack.Data[n].Window) - if (popup->Flags & ImGuiWindowFlags_Modal) - return popup; - return NULL; -} - -static void ClosePopupToLevel(int remaining) -{ - ImGuiContext& g = *GImGui; - if (remaining > 0) - ImGui::FocusWindow(g.OpenPopupStack[remaining-1].Window); - else - ImGui::FocusWindow(g.OpenPopupStack[0].ParentWindow); - g.OpenPopupStack.resize(remaining); -} - -void ImGui::ClosePopup(ImGuiID id) -{ - if (!IsPopupOpen(id)) - return; - ImGuiContext& g = *GImGui; - ClosePopupToLevel(g.OpenPopupStack.Size - 1); -} - -// Close the popup we have begin-ed into. -void ImGui::CloseCurrentPopup() -{ - ImGuiContext& g = *GImGui; - int popup_idx = g.CurrentPopupStack.Size - 1; - if (popup_idx < 0 || popup_idx >= g.OpenPopupStack.Size || g.CurrentPopupStack[popup_idx].PopupId != g.OpenPopupStack[popup_idx].PopupId) - return; - while (popup_idx > 0 && g.OpenPopupStack[popup_idx].Window && (g.OpenPopupStack[popup_idx].Window->Flags & ImGuiWindowFlags_ChildMenu)) - popup_idx--; - ClosePopupToLevel(popup_idx); -} - -static inline void ClearSetNextWindowData() -{ - // FIXME-OPT - ImGuiContext& g = *GImGui; - g.SetNextWindowPosCond = g.SetNextWindowSizeCond = g.SetNextWindowContentSizeCond = g.SetNextWindowCollapsedCond = 0; - g.SetNextWindowSizeConstraint = g.SetNextWindowFocus = false; -} - -bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags) -{ - ImGuiContext& g = *GImGui; - if (!IsPopupOpen(id)) - { - ClearSetNextWindowData(); // We behave like Begin() and need to consume those values - return false; - } - - ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings; - - char name[20]; - if (flags & ImGuiWindowFlags_ChildMenu) - ImFormatString(name, IM_ARRAYSIZE(name), "##menu_%d", g.CurrentPopupStack.Size); // Recycle windows based on depth - else - ImFormatString(name, IM_ARRAYSIZE(name), "##popup_%08x", id); // Not recycling, so we can close/open during the same frame - - bool is_open = Begin(name, NULL, flags); - if (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display) - EndPopup(); - - return is_open; -} - -bool ImGui::BeginPopup(const char* str_id) -{ - ImGuiContext& g = *GImGui; - if (g.OpenPopupStack.Size <= g.CurrentPopupStack.Size) // Early out for performance - { - ClearSetNextWindowData(); // We behave like Begin() and need to consume those values - return false; - } - return BeginPopupEx(g.CurrentWindow->GetID(str_id), ImGuiWindowFlags_AlwaysAutoResize); -} - -bool ImGui::IsPopupOpen(ImGuiID id) -{ - ImGuiContext& g = *GImGui; - return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id; -} - -bool ImGui::IsPopupOpen(const char* str_id) -{ - ImGuiContext& g = *GImGui; - return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == g.CurrentWindow->GetID(str_id); -} - -bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags extra_flags) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - const ImGuiID id = window->GetID(name); - if (!IsPopupOpen(id)) - { - ClearSetNextWindowData(); // We behave like Begin() and need to consume those values - return false; - } - - // Center modal windows by default - if ((window->SetWindowPosAllowFlags & g.SetNextWindowPosCond) == 0) - SetNextWindowPos(g.IO.DisplaySize * 0.5f, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); - - ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_Modal|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoSavedSettings; - bool is_open = Begin(name, p_open, flags); - if (!is_open || (p_open && !*p_open)) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display) - { - EndPopup(); - if (is_open) - ClosePopup(id); - return false; - } - - return is_open; -} - -void ImGui::EndPopup() -{ - ImGuiContext& g = *GImGui; (void)g; - IM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginPopup()/EndPopup() calls - IM_ASSERT(g.CurrentPopupStack.Size > 0); - End(); -} - -bool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button) -{ - ImGuiWindow* window = GImGui->CurrentWindow; - if (IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) - { - ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! - IM_ASSERT(id != 0); // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item) - OpenPopupEx(id, true); - return true; - } - return false; -} - -// This is a helper to handle the simplest case of associating one named popup to one given widget. -// You may want to handle this on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters). -// You can pass a NULL str_id to use the identifier of the last item. -bool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button) -{ - ImGuiWindow* window = GImGui->CurrentWindow; - ImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict! - IM_ASSERT(id != 0); // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item) - if (IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) - OpenPopupEx(id, true); - return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize); -} - -bool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool also_over_items) -{ - if (!str_id) - str_id = "window_context"; - ImGuiID id = GImGui->CurrentWindow->GetID(str_id); - if (IsMouseClicked(mouse_button)) - if (IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup)) - if (also_over_items || !IsAnyItemHovered()) - OpenPopupEx(id, true); - return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize); -} - -bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button) -{ - if (!str_id) - str_id = "void_context"; - ImGuiID id = GImGui->CurrentWindow->GetID(str_id); - if (!IsAnyWindowHovered() && IsMouseClicked(mouse_button)) - OpenPopupEx(id, true); - return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize); -} - -static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* parent_window = ImGui::GetCurrentWindow(); - ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow; - flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag - - const ImVec2 content_avail = ImGui::GetContentRegionAvail(); - ImVec2 size = ImFloor(size_arg); - const int auto_fit_axises = ((size.x == 0.0f) ? 0x01 : 0x00) | ((size.y == 0.0f) ? 0x02 : 0x00); - if (size.x <= 0.0f) - size.x = ImMax(content_avail.x, 4.0f) - fabsf(size.x); // Arbitrary minimum zero-ish child size of 4.0f (0.0f causing too much issues) - if (size.y <= 0.0f) - size.y = ImMax(content_avail.y, 4.0f) - fabsf(size.y); - - const float backup_border_size = g.Style.ChildBorderSize; - if (!border) - g.Style.ChildBorderSize = 0.0f; - flags |= extra_flags; - - char title[256]; - if (name) - ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s_%08X", parent_window->Name, name, id); - else - ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id); - - ImGui::SetNextWindowSize(size); - bool ret = ImGui::Begin(title, NULL, flags); - ImGuiWindow* child_window = ImGui::GetCurrentWindow(); - child_window->AutoFitChildAxises = auto_fit_axises; - g.Style.ChildBorderSize = backup_border_size; - - return ret; -} - -bool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - return BeginChildEx(str_id, window->GetID(str_id), size_arg, border, extra_flags); -} - -bool ImGui::BeginChild(ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags) -{ - return BeginChildEx(NULL, id, size_arg, border, extra_flags); -} - -void ImGui::EndChild() -{ - ImGuiWindow* window = GetCurrentWindow(); - - IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss - if ((window->Flags & ImGuiWindowFlags_ComboBox) || window->BeginCount > 1) - { - ImGui::End(); - } - else - { - // When using auto-filling child window, we don't provide full width/height to ItemSize so that it doesn't feed back into automatic size-fitting. - ImVec2 sz = GetWindowSize(); - if (window->AutoFitChildAxises & 0x01) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f - sz.x = ImMax(4.0f, sz.x); - if (window->AutoFitChildAxises & 0x02) - sz.y = ImMax(4.0f, sz.y); - ImGui::End(); - - ImGuiWindow* parent_window = GetCurrentWindow(); - ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz); - ItemSize(sz); - ItemAdd(bb, 0); - } -} - -// Helper to create a child window / scrolling region that looks like a normal widget frame. -bool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags) -{ - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]); - PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding); - PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize); - PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding); - return BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags); -} - -void ImGui::EndChildFrame() -{ - EndChild(); - PopStyleVar(3); - PopStyleColor(); -} - -// Save and compare stack sizes on Begin()/End() to detect usage errors -static void CheckStacksSize(ImGuiWindow* window, bool write) -{ - // NOT checking: DC.ItemWidth, DC.AllowKeyboardFocus, DC.ButtonRepeat, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin) - ImGuiContext& g = *GImGui; - int* p_backup = &window->DC.StackSizesBackup[0]; - { int current = window->IDStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushID/PopID or TreeNode/TreePop Mismatch!"); p_backup++; } // Too few or too many PopID()/TreePop() - { int current = window->DC.GroupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "BeginGroup/EndGroup Mismatch!"); p_backup++; } // Too few or too many EndGroup() - { int current = g.CurrentPopupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch"); p_backup++;}// Too few or too many EndMenu()/EndPopup() - { int current = g.ColorModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushStyleColor/PopStyleColor Mismatch!"); p_backup++; } // Too few or too many PopStyleColor() - { int current = g.StyleModifiers.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushStyleVar/PopStyleVar Mismatch!"); p_backup++; } // Too few or too many PopStyleVar() - { int current = g.FontStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && "PushFont/PopFont Mismatch!"); p_backup++; } // Too few or too many PopFont() - IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup)); -} - -static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, int* last_dir, const ImRect& r_inner) -{ - const ImGuiStyle& style = GImGui->Style; - - // Clamp into visible area while not overlapping the cursor. Safety padding is optional if our popup size won't fit without it. - ImVec2 safe_padding = style.DisplaySafeAreaPadding; - ImRect r_outer(GetVisibleRect()); - r_outer.Expand(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x*2) ? -safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y*2) ? -safe_padding.y : 0.0f)); - ImVec2 base_pos_clamped = ImClamp(base_pos, r_outer.Min, r_outer.Max - size); - - for (int n = (*last_dir != -1) ? -1 : 0; n < 4; n++) // Last, Right, down, up, left. (Favor last used direction). - { - const int dir = (n == -1) ? *last_dir : n; - ImRect rect(dir == 0 ? r_inner.Max.x : r_outer.Min.x, dir == 1 ? r_inner.Max.y : r_outer.Min.y, dir == 3 ? r_inner.Min.x : r_outer.Max.x, dir == 2 ? r_inner.Min.y : r_outer.Max.y); - if (rect.GetWidth() < size.x || rect.GetHeight() < size.y) - continue; - *last_dir = dir; - return ImVec2(dir == 0 ? r_inner.Max.x : dir == 3 ? r_inner.Min.x - size.x : base_pos_clamped.x, dir == 1 ? r_inner.Max.y : dir == 2 ? r_inner.Min.y - size.y : base_pos_clamped.y); - } - - // Fallback, try to keep within display - *last_dir = -1; - ImVec2 pos = base_pos; - pos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x); - pos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y); - return pos; -} - -static void SetWindowConditionAllowFlags(ImGuiWindow* window, ImGuiCond flags, bool enabled) -{ - window->SetWindowPosAllowFlags = enabled ? (window->SetWindowPosAllowFlags | flags) : (window->SetWindowPosAllowFlags & ~flags); - window->SetWindowSizeAllowFlags = enabled ? (window->SetWindowSizeAllowFlags | flags) : (window->SetWindowSizeAllowFlags & ~flags); - window->SetWindowCollapsedAllowFlags = enabled ? (window->SetWindowCollapsedAllowFlags | flags) : (window->SetWindowCollapsedAllowFlags & ~flags); -} - -ImGuiWindow* ImGui::FindWindowByName(const char* name) -{ - ImGuiContext& g = *GImGui; - ImGuiID id = ImHash(name, 0); - return (ImGuiWindow*)g.WindowsById.GetVoidPtr(id); -} - -static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags) -{ - ImGuiContext& g = *GImGui; - - // Create window the first time - ImGuiWindow* window = (ImGuiWindow*)ImGui::MemAlloc(sizeof(ImGuiWindow)); - IM_PLACEMENT_NEW(window) ImGuiWindow(name); - window->Flags = flags; - g.WindowsById.SetVoidPtr(window->ID, window); - - if (flags & ImGuiWindowFlags_NoSavedSettings) - { - // User can disable loading and saving of settings. Tooltip and child windows also don't store settings. - window->Size = window->SizeFull = size; - } - else - { - // Retrieve settings from .ini file - // Use SetWindowPos() or SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. - window->PosFloat = ImVec2(60, 60); - window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y); - - if (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID)) - { - SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); - window->PosFloat = settings->Pos; - window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y); - window->Collapsed = settings->Collapsed; - if (ImLengthSqr(settings->Size) > 0.00001f) - size = settings->Size; - } - window->Size = window->SizeFull = size; - } - - if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) - { - window->AutoFitFramesX = window->AutoFitFramesY = 2; - window->AutoFitOnlyGrows = false; - } - else - { - if (window->Size.x <= 0.0f) - window->AutoFitFramesX = 2; - if (window->Size.y <= 0.0f) - window->AutoFitFramesY = 2; - window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); - } - - if (flags & ImGuiWindowFlags_NoBringToFrontOnFocus) - g.Windows.insert(g.Windows.begin(), window); // Quite slow but rare and only once - else - g.Windows.push_back(window); - return window; -} - -static ImVec2 CalcSizeFullWithConstraint(ImGuiWindow* window, ImVec2 new_size) -{ - ImGuiContext& g = *GImGui; - if (g.SetNextWindowSizeConstraint) - { - // Using -1,-1 on either X/Y axis to preserve the current size. - ImRect cr = g.SetNextWindowSizeConstraintRect; - new_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x; - new_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y; - if (g.SetNextWindowSizeConstraintCallback) - { - ImGuiSizeConstraintCallbackData data; - data.UserData = g.SetNextWindowSizeConstraintCallbackUserData; - data.Pos = window->Pos; - data.CurrentSize = window->SizeFull; - data.DesiredSize = new_size; - g.SetNextWindowSizeConstraintCallback(&data); - new_size = data.DesiredSize; - } - } - if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize))) - { - new_size = ImMax(new_size, g.Style.WindowMinSize); - new_size.y = ImMax(new_size.y, window->TitleBarHeight() + window->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows - } - return new_size; -} - -static ImVec2 CalcSizeAutoFit(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - ImGuiStyle& style = g.Style; - ImGuiWindowFlags flags = window->Flags; - ImVec2 size_auto_fit; - if ((flags & ImGuiWindowFlags_Tooltip) != 0) - { - // Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose. - size_auto_fit = window->SizeContents; - } - else - { - // Handling case of auto fit window not fitting on the screen (on either axis): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding. - size_auto_fit = ImClamp(window->SizeContents, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - g.Style.DisplaySafeAreaPadding)); - ImVec2 size_auto_fit_after_constraint = CalcSizeFullWithConstraint(window, size_auto_fit); - if (size_auto_fit_after_constraint.x < window->SizeContents.x && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)) - size_auto_fit.y += style.ScrollbarSize; - if (size_auto_fit_after_constraint.y < window->SizeContents.y && !(flags & ImGuiWindowFlags_NoScrollbar)) - size_auto_fit.x += style.ScrollbarSize; - } - return size_auto_fit; -} - -static float GetScrollMaxX(ImGuiWindow* window) -{ - return ImMax(0.0f, window->SizeContents.x - (window->SizeFull.x - window->ScrollbarSizes.x)); -} - -static float GetScrollMaxY(ImGuiWindow* window) -{ - return ImMax(0.0f, window->SizeContents.y - (window->SizeFull.y - window->ScrollbarSizes.y)); -} - -static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window) -{ - ImVec2 scroll = window->Scroll; - float cr_x = window->ScrollTargetCenterRatio.x; - float cr_y = window->ScrollTargetCenterRatio.y; - if (window->ScrollTarget.x < FLT_MAX) - scroll.x = window->ScrollTarget.x - cr_x * (window->SizeFull.x - window->ScrollbarSizes.x); - if (window->ScrollTarget.y < FLT_MAX) - scroll.y = window->ScrollTarget.y - (1.0f - cr_y) * (window->TitleBarHeight() + window->MenuBarHeight()) - cr_y * (window->SizeFull.y - window->ScrollbarSizes.y); - scroll = ImMax(scroll, ImVec2(0.0f, 0.0f)); - if (!window->Collapsed && !window->SkipItems) - { - scroll.x = ImMin(scroll.x, GetScrollMaxX(window)); - scroll.y = ImMin(scroll.y, GetScrollMaxY(window)); - } - return scroll; -} - -static ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags) -{ - if (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup)) - return ImGuiCol_PopupBg; - if (flags & ImGuiWindowFlags_ChildWindow) - return ImGuiCol_ChildBg; - return ImGuiCol_WindowBg; -} - -// Push a new ImGui window to add widgets to. -// - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair. -// - Begin/End can be called multiple times during the frame with the same window name to append content. -// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file). -// You can use the "##" or "###" markers to use the same label with different id, or same id with different label. See documentation at the top of this file. -// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned. -// - Passing 'bool* p_open' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed. -bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) -{ - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - IM_ASSERT(name != NULL); // Window name required - IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame() - IM_ASSERT(g.FrameCountEnded != g.FrameCount); // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet - - if (flags & ImGuiWindowFlags_NoInputs) - flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; - - // Find or create - bool window_is_new = false; - ImGuiWindow* window = FindWindowByName(name); - if (!window) - { - ImVec2 size_on_first_use = (g.SetNextWindowSizeCond != 0) ? g.SetNextWindowSizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here. - window = CreateNewWindow(name, size_on_first_use, flags); - window_is_new = true; - } - - const int current_frame = g.FrameCount; - const bool first_begin_of_the_frame = (window->LastFrameActive != current_frame); - if (first_begin_of_the_frame) - window->Flags = (ImGuiWindowFlags)flags; - else - flags = window->Flags; - - // Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack - ImGuiWindow* parent_window = first_begin_of_the_frame ? (!g.CurrentWindowStack.empty() ? g.CurrentWindowStack.back() : NULL) : window->ParentWindow; - IM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow)); - - // Add to stack - g.CurrentWindowStack.push_back(window); - SetCurrentWindow(window); - CheckStacksSize(window, true); - - bool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1); // Not using !WasActive because the implicit "Debug" window would always toggle off->on - if (flags & ImGuiWindowFlags_Popup) - { - ImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size]; - window_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed - window_just_activated_by_user |= (window != popup_ref.Window); - popup_ref.Window = window; - g.CurrentPopupStack.push_back(popup_ref); - window->PopupId = popup_ref.PopupId; - } - - const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFrames == 1); - window->Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize); - window->CloseButton = (p_open != NULL); - - // Process SetNextWindow***() calls - if (window->Appearing) - SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true); - bool window_pos_set_by_api = false, window_size_set_by_api = false; - if (g.SetNextWindowPosCond) - { - window_pos_set_by_api = (window->SetWindowPosAllowFlags & g.SetNextWindowPosCond) != 0; - if (window_pos_set_by_api && ImLengthSqr(g.SetNextWindowPosPivot) > 0.00001f) - { - // May be processed on the next frame if this is our first frame and we are measuring size - // FIXME: Look into removing the branch so everything can go through this same code path for consistency. - window->SetWindowPosVal = g.SetNextWindowPosVal; - window->SetWindowPosPivot = g.SetNextWindowPosPivot; - window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); - } - else - { - SetWindowPos(window, g.SetNextWindowPosVal, g.SetNextWindowPosCond); - } - g.SetNextWindowPosCond = 0; - } - if (g.SetNextWindowSizeCond) - { - window_size_set_by_api = (window->SetWindowSizeAllowFlags & g.SetNextWindowSizeCond) != 0; - SetWindowSize(window, g.SetNextWindowSizeVal, g.SetNextWindowSizeCond); - g.SetNextWindowSizeCond = 0; - } - if (g.SetNextWindowContentSizeCond) - { - window->SizeContentsExplicit = g.SetNextWindowContentSizeVal; - g.SetNextWindowContentSizeCond = 0; - } - else if (first_begin_of_the_frame) - { - window->SizeContentsExplicit = ImVec2(0.0f, 0.0f); - } - if (g.SetNextWindowCollapsedCond) - { - SetWindowCollapsed(window, g.SetNextWindowCollapsedVal, g.SetNextWindowCollapsedCond); - g.SetNextWindowCollapsedCond = 0; - } - if (g.SetNextWindowFocus) - { - SetWindowFocus(); - g.SetNextWindowFocus = false; - } - if (window->Appearing) - SetWindowConditionAllowFlags(window, ImGuiCond_Appearing, false); - - // When reusing window again multiple times a frame, just append content (don't need to setup again) - if (first_begin_of_the_frame) - { - // Initialize - window->ParentWindow = parent_window; - window->RootWindow = !(flags & ImGuiWindowFlags_ChildWindow) ? window : parent_window->RootWindow; - window->RootNonPopupWindow = !(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) || (flags & ImGuiWindowFlags_Modal) ? window : parent_window->RootNonPopupWindow; // Used to display TitleBgActive color and for selecting which window to use for NavWindowing - //window->RootNavWindow = window; - //while (window->RootNavWindow->Flags & ImGuiWindowFlags_NavFlattened) - // window->RootNavWindow = window->RootNavWindow->ParentWindow; - - window->Active = true; - window->OrderWithinParent = 0; - window->BeginCount = 0; - window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX); - window->LastFrameActive = current_frame; - window->IDStack.resize(1); - - // Clear draw list, setup texture, outer clipping rectangle - window->DrawList->Clear(); - window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID); - ImRect fullscreen_rect(GetVisibleRect()); - if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_ComboBox|ImGuiWindowFlags_Popup))) - PushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true); - else - PushClipRect(fullscreen_rect.Min, fullscreen_rect.Max, true); - - if (window_just_activated_by_user) - { - // Popup first latch mouse position, will position itself when it appears next frame - window->AutoPosLastDirection = -1; - if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api) - window->PosFloat = g.IO.MousePos; - } - - // Collapse window by double-clicking on title bar - // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing - if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse)) - { - ImRect title_bar_rect = window->TitleBarRect(); - if (g.HoveredWindow == window && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseDoubleClicked[0]) - { - window->Collapsed = !window->Collapsed; - MarkIniSettingsDirty(window); - FocusWindow(window); - } - } - else - { - window->Collapsed = false; - } - - // SIZE - - // Update contents size from last frame for auto-fitting (unless explicitly specified) - window->SizeContents.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.x - window->Pos.x) + window->Scroll.x)); - window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y)); - window->SizeContents += window->WindowPadding; - - // Hide popup/tooltip window when first appearing while we measure size (because we recycle them) - if (window->HiddenFrames > 0) - window->HiddenFrames--; - if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && window_just_activated_by_user) - { - window->HiddenFrames = 1; - if (flags & ImGuiWindowFlags_AlwaysAutoResize) - { - if (!window_size_set_by_api) - window->Size = window->SizeFull = ImVec2(0.f, 0.f); - window->SizeContents = ImVec2(0.f, 0.f); - } - } - - // Lock window rounding, border size and rounding so that altering the border sizes for children doesn't have side-effects. - window->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding; - window->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize; - window->WindowPadding = style.WindowPadding; - if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_ComboBox | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f) - window->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f); - const float window_rounding = window->WindowRounding; - const float window_border_size = window->WindowBorderSize; - - // Calculate auto-fit size, handle automatic resize - const ImVec2 size_auto_fit = CalcSizeAutoFit(window); - if (window->Collapsed) - { - // We still process initial auto-fit on collapsed windows to get a window width, - // But otherwise we don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed. - if (window->AutoFitFramesX > 0) - window->SizeFull.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x; - if (window->AutoFitFramesY > 0) - window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y; - } - else if (!window_size_set_by_api) - { - if (flags & ImGuiWindowFlags_AlwaysAutoResize) - { - window->SizeFull = size_auto_fit; - } - else if (window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) - { - // Auto-fit only grows during the first few frames - if (window->AutoFitFramesX > 0) - window->SizeFull.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x; - if (window->AutoFitFramesY > 0) - window->SizeFull.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y; - MarkIniSettingsDirty(window); - } - } - - // Apply minimum/maximum window size constraints and final size - window->SizeFull = CalcSizeFullWithConstraint(window, window->SizeFull); - window->Size = window->Collapsed ? window->TitleBarRect().GetSize() : window->SizeFull; - if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup)) - { - IM_ASSERT(window_size_set_by_api); // Submitted by BeginChild() - window->Size = window->SizeFull; - } - - // SCROLLBAR STATUS - - // Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). We need to do this before manual resize (below) is effective. - if (!window->Collapsed) - { - window->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > window->SizeFull.y) && !(flags & ImGuiWindowFlags_NoScrollbar)); - window->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > window->SizeFull.x - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar)); - if (window->ScrollbarX && !window->ScrollbarY) - window->ScrollbarY = (window->SizeContents.y > window->SizeFull.y + style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar); - window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); - } - - // POSITION - - // Position child window - if (flags & ImGuiWindowFlags_ChildWindow) - { - window->OrderWithinParent = parent_window->DC.ChildWindows.Size; - parent_window->DC.ChildWindows.push_back(window); - } - if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api) - window->Pos = window->PosFloat = parent_window->DC.CursorPos; - - const bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0); - if (window_pos_with_pivot) - { - // Position given a pivot (e.g. for centering) - SetWindowPos(window, ImMax(style.DisplaySafeAreaPadding, window->SetWindowPosVal - window->SizeFull * window->SetWindowPosPivot), 0); - } - else if (flags & ImGuiWindowFlags_ChildMenu) - { - // Child menus typically request _any_ position within the parent menu item, and then our FindBestPopupWindowPos() function will move the new menu outside the parent bounds. - // This is how we end up with child menus appearing (most-commonly) on the right of the parent menu. - IM_ASSERT(window_pos_set_by_api); - float horizontal_overlap = style.ItemSpacing.x; // We want some overlap to convey the relative depth of each popup (currently the amount of overlap it is hard-coded to style.ItemSpacing.x, may need to introduce another style value). - ImRect rect_to_avoid; - if (parent_window->DC.MenuBarAppending) - rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight()); - else - rect_to_avoid = ImRect(parent_window->Pos.x + horizontal_overlap, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - horizontal_overlap - parent_window->ScrollbarSizes.x, FLT_MAX); - window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid); - } - else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize) - { - ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1); - window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid); - } - - // Position tooltip (always follows mouse) - if ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api) - { - ImVec2 ref_pos = g.IO.MousePos; - ImRect rect_to_avoid(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24, ref_pos.y + 24); // FIXME: Completely hard-coded. Perhaps center on cursor hit-point instead? - window->PosFloat = FindBestPopupWindowPos(ref_pos, window->Size, &window->AutoPosLastDirection, rect_to_avoid); - if (window->AutoPosLastDirection == -1) - window->PosFloat = ref_pos + ImVec2(2,2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible. - } - - // Clamp position so it stays visible - if (!(flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip)) - { - if (!window_pos_set_by_api && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. - { - ImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding); - window->PosFloat = ImMax(window->PosFloat + window->Size, padding) - window->Size; - window->PosFloat = ImMin(window->PosFloat, g.IO.DisplaySize - padding); - } - } - window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y); - - // Default item width. Make it proportional to window size if window manually resizes - if (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize)) - window->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f); - else - window->ItemWidthDefault = (float)(int)(g.FontSize * 16.0f); - - // Prepare for focus requests - window->FocusIdxAllRequestCurrent = (window->FocusIdxAllRequestNext == INT_MAX || window->FocusIdxAllCounter == -1) ? INT_MAX : (window->FocusIdxAllRequestNext + (window->FocusIdxAllCounter+1)) % (window->FocusIdxAllCounter+1); - window->FocusIdxTabRequestCurrent = (window->FocusIdxTabRequestNext == INT_MAX || window->FocusIdxTabCounter == -1) ? INT_MAX : (window->FocusIdxTabRequestNext + (window->FocusIdxTabCounter+1)) % (window->FocusIdxTabCounter+1); - window->FocusIdxAllCounter = window->FocusIdxTabCounter = -1; - window->FocusIdxAllRequestNext = window->FocusIdxTabRequestNext = INT_MAX; - - // Apply scrolling - window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window); - window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); - - // Modal window darkens what is behind them - if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow()) - window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio)); - - // Draw window + handle manual resize - ImRect title_bar_rect = window->TitleBarRect(); - if (window->Collapsed) - { - // Title bar only - float backup_border_size = style.FrameBorderSize; - g.Style.FrameBorderSize = window->WindowBorderSize; - RenderFrame(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(ImGuiCol_TitleBgCollapsed), true, window_rounding); - g.Style.FrameBorderSize = backup_border_size; - } - else - { - ImU32 resize_col = 0; - const float resize_corner_size = ImMax(g.FontSize * 1.35f, window_rounding + 1.0f + g.FontSize * 0.2f); - if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && !(flags & ImGuiWindowFlags_NoResize)) - { - // Manual resize - // Using the FlattenChilds button flag, we make the resize button accessible even if we are hovering over a child window - const ImVec2 br = window->Rect().GetBR(); - const ImRect resize_rect(br - ImFloor(ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f)), br); - const ImGuiID resize_id = window->GetID("#RESIZE"); - bool hovered, held; - ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds); - resize_col = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip); - if (hovered || held) - g.MouseCursor = ImGuiMouseCursor_ResizeNWSE; - - ImVec2 size_target(FLT_MAX,FLT_MAX); - if (g.HoveredWindow == window && held && g.IO.MouseDoubleClicked[0]) - { - // Manual auto-fit when double-clicking - size_target = size_auto_fit; - ClearActiveID(); - } - else if (held) - { - // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position - size_target = (g.IO.MousePos - g.ActiveIdClickOffset - window->Pos) + resize_rect.GetSize(); - } - - if (size_target.x != FLT_MAX && size_target.y != FLT_MAX) - { - window->SizeFull = CalcSizeFullWithConstraint(window, size_target); - MarkIniSettingsDirty(window); - } - window->Size = window->SizeFull; - title_bar_rect = window->TitleBarRect(); - } - - // Window background, Default Alpha - ImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags)); - window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot); - - // Title bar - const bool window_is_focused = g.NavWindow && window->RootNonPopupWindow == g.NavWindow->RootNonPopupWindow; - if (!(flags & ImGuiWindowFlags_NoTitleBar)) - window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImDrawCornerFlags_Top); - - // Menu bar - if (flags & ImGuiWindowFlags_MenuBar) - { - ImRect menu_bar_rect = window->MenuBarRect(); - menu_bar_rect.ClipWith(window->Rect()); // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them. - window->DrawList->AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top); - if (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y) - window->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize); - } - - // Scrollbars - if (window->ScrollbarX) - Scrollbar(ImGuiLayoutType_Horizontal); - if (window->ScrollbarY) - Scrollbar(ImGuiLayoutType_Vertical); - - // Render resize grip - // (after the input handling so we don't have a frame of latency) - if (!(flags & ImGuiWindowFlags_NoResize)) - { - const ImVec2 br = window->Rect().GetBR(); - window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, -window_border_size)); - window->DrawList->PathLineTo(br + ImVec2(-window_border_size, -resize_corner_size)); - window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding - window_border_size, br.y - window_rounding - window_border_size), window_rounding, 0, 3); - window->DrawList->PathFillConvex(resize_col); - } - - // Borders - if (window_border_size > 0.0f) - window->DrawList->AddRect(window->Pos, window->Pos+window->Size, GetColorU32(ImGuiCol_Border), window_rounding, ImDrawCornerFlags_All, window_border_size); - if (style.FrameBorderSize > 0 && !(flags & ImGuiWindowFlags_NoTitleBar)) - window->DrawList->AddLine(title_bar_rect.GetBL()+ImVec2(1,-1), title_bar_rect.GetBR()+ImVec2(-1,-1), GetColorU32(ImGuiCol_Border), style.FrameBorderSize); - } - - // Update ContentsRegionMax. All the variable it depends on are set above in this function. - window->ContentsRegionRect.Min.x = -window->Scroll.x + window->WindowPadding.x; - window->ContentsRegionRect.Min.y = -window->Scroll.y + window->WindowPadding.y + window->TitleBarHeight() + window->MenuBarHeight(); - window->ContentsRegionRect.Max.x = -window->Scroll.x - window->WindowPadding.x + (window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : (window->Size.x - window->ScrollbarSizes.x)); - window->ContentsRegionRect.Max.y = -window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y)); - - // Setup drawing context - // (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.) - window->DC.IndentX = 0.0f + window->WindowPadding.x - window->Scroll.x; - window->DC.GroupOffsetX = 0.0f; - window->DC.ColumnsOffsetX = 0.0f; - window->DC.CursorStartPos = window->Pos + ImVec2(window->DC.IndentX + window->DC.ColumnsOffsetX, window->TitleBarHeight() + window->MenuBarHeight() + window->WindowPadding.y - window->Scroll.y); - window->DC.CursorPos = window->DC.CursorStartPos; - window->DC.CursorPosPrevLine = window->DC.CursorPos; - window->DC.CursorMaxPos = window->DC.CursorStartPos; - window->DC.CurrentLineHeight = window->DC.PrevLineHeight = 0.0f; - window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f; - window->DC.MenuBarAppending = false; - window->DC.MenuBarOffsetX = ImMax(window->WindowPadding.x, style.ItemSpacing.x); - window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; - window->DC.ChildWindows.resize(0); - window->DC.LayoutType = ImGuiLayoutType_Vertical; - window->DC.ItemFlags = ImGuiItemFlags_Default_; - window->DC.ItemWidth = window->ItemWidthDefault; - window->DC.TextWrapPos = -1.0f; // disabled - window->DC.ItemFlagsStack.resize(0); - window->DC.ItemWidthStack.resize(0); - window->DC.TextWrapPosStack.resize(0); - window->DC.ColumnsCurrent = 0; - window->DC.ColumnsCount = 1; - window->DC.ColumnsStartPosY = window->DC.CursorPos.y; - window->DC.ColumnsStartMaxPosX = window->DC.CursorMaxPos.x; - window->DC.ColumnsCellMinY = window->DC.ColumnsCellMaxY = window->DC.ColumnsStartPosY; - window->DC.TreeDepth = 0; - window->DC.StateStorage = &window->StateStorage; - window->DC.GroupStack.resize(0); - window->MenuColumns.Update(3, style.ItemSpacing.x, window_just_activated_by_user); - - if ((flags & ImGuiWindowFlags_ChildWindow) && (window->DC.ItemFlags != parent_window->DC.ItemFlags)) - { - window->DC.ItemFlags = parent_window->DC.ItemFlags; - window->DC.ItemFlagsStack.push_back(window->DC.ItemFlags); - } - - if (window->AutoFitFramesX > 0) - window->AutoFitFramesX--; - if (window->AutoFitFramesY > 0) - window->AutoFitFramesY--; - - // New windows appears in front (we need to do that AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there) - if (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing)) - if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup)) - FocusWindow(window); - - // Title bar - if (!(flags & ImGuiWindowFlags_NoTitleBar)) - { - // Collapse button - if (!(flags & ImGuiWindowFlags_NoCollapse)) - { - RenderTriangle(window->Pos + style.FramePadding, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f); - } - - // Close button - if (p_open != NULL) - { - const float PAD = 2.0f; - const float rad = (window->TitleBarHeight() - PAD*2.0f) * 0.5f; - if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-PAD - rad, PAD + rad), rad)) - *p_open = false; - } - - // Title text (FIXME: refactor text alignment facilities along with RenderText helpers) - const ImVec2 text_size = CalcTextSize(name, NULL, true); - ImVec2 text_min = window->Pos; - ImVec2 text_max = window->Pos + ImVec2(window->Size.x, style.FramePadding.y*2 + text_size.y); - ImRect clip_rect; - clip_rect.Max = ImVec2(window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x), text_max.y); // Match the size of CloseWindowButton() - float pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0 ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x; - float pad_right = (p_open != NULL) ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x; - if (style.WindowTitleAlign.x > 0.0f) pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x); - text_min.x += pad_left; - text_max.x -= pad_right; - clip_rect.Min = ImVec2(text_min.x, window->Pos.y); - RenderTextClipped(text_min, text_max, name, NULL, &text_size, style.WindowTitleAlign, &clip_rect); - } - - // Save clipped aabb so we can access it in constant-time in FindHoveredWindow() - window->WindowRectClipped = window->Rect(); - window->WindowRectClipped.ClipWith(window->ClipRect); - - // Pressing CTRL+C while holding on a window copy its content to the clipboard - // This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope. - // Maybe we can support CTRL+C on every element? - /* - if (g.ActiveId == move_id) - if (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C)) - ImGui::LogToClipboard(); - */ - - // Inner rectangle - // We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame - // Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior. - window->InnerRect.Min.x = title_bar_rect.Min.x; - window->InnerRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight(); - window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x; - window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y; - //window->DrawList->AddRect(window->InnerRect.Min, window->InnerRect.Max, IM_COL32_WHITE); - - // After Begin() we fill the last item / hovered data using the title bar data. Make that a standard behavior (to allow usage of context menus on title bar only, etc.). - window->DC.LastItemId = window->MoveId; - window->DC.LastItemRect = title_bar_rect; - window->DC.LastItemRectHoveredRect = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false); - } - - // Inner clipping rectangle - // Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result. - const float border_size = window->WindowBorderSize; - ImRect clip_rect; - clip_rect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f))); - clip_rect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y + border_size); - clip_rect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(border_size, ImFloor(window->WindowPadding.x*0.5f))); - clip_rect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y - border_size); - PushClipRect(clip_rect.Min, clip_rect.Max, true); - - // Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused) - if (first_begin_of_the_frame) - window->WriteAccessed = false; - - window->BeginCount++; - g.SetNextWindowSizeConstraint = false; - - // Child window can be out of sight and have "negative" clip windows. - // Mark them as collapsed so commands are skipped earlier (we can't manually collapse because they have no title bar). - if (flags & ImGuiWindowFlags_ChildWindow) - { - IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0); - window->Collapsed = parent_window && parent_window->Collapsed; - - if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) - window->Collapsed |= (window->WindowRectClipped.Min.x >= window->WindowRectClipped.Max.x || window->WindowRectClipped.Min.y >= window->WindowRectClipped.Max.y); - - // We also hide the window from rendering because we've already added its border to the command list. - // (we could perform the check earlier in the function but it is simpler at this point) - if (window->Collapsed) - window->Active = false; - } - if (style.Alpha <= 0.0f) - window->Active = false; - - // Return false if we don't intend to display anything to allow user to perform an early out optimization - window->SkipItems = (window->Collapsed || !window->Active) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0; - return !window->SkipItems; -} - -// Old Begin() API with 5 parameters, avoid calling this version directly! Use SetNextWindowSize()+Begin() instead. -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS -bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override, ImGuiWindowFlags flags) -{ - // Old API feature: we could pass the initial window size as a parameter, however this was very misleading because in most cases it would only affect the window when it didn't have storage in the .ini file. - if (size_on_first_use.x != 0.0f || size_on_first_use.y != 0.0f) - SetNextWindowSize(size_on_first_use, ImGuiCond_FirstUseEver); - - // Old API feature: we could override the window background alpha with a parameter. This is actually tricky to reproduce manually because: - // (1) there are multiple variants of WindowBg (popup, tooltip, etc.) and (2) you can't call PushStyleColor before Begin and PopStyleColor just after Begin() because of how CheckStackSizes() behave. - // The user-side solution is to do backup = GetStyleColorVec4(ImGuiCol_xxxBG), PushStyleColor(ImGuiCol_xxxBg), Begin, PushStyleColor(ImGuiCol_xxxBg, backup), [...], PopStyleColor(), End(); PopStyleColor() - which is super awkward. - // The alpha override was rarely used but for now we'll leave the Begin() variant around for a bit. We may either lift the constraint on CheckStackSizes() either add a SetNextWindowBgAlpha() helper that does it magically. - ImGuiContext& g = *GImGui; - const ImGuiCol bg_color_idx = GetWindowBgColorIdxFromFlags(flags); - const ImVec4 bg_color_backup = g.Style.Colors[bg_color_idx]; - if (bg_alpha_override >= 0.0f) - g.Style.Colors[bg_color_idx].w = bg_alpha_override; - - bool ret = Begin(name, p_open, flags); - - if (bg_alpha_override >= 0.0f) - g.Style.Colors[bg_color_idx] = bg_color_backup; - return ret; -} -#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS - -void ImGui::End() -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - if (window->DC.ColumnsCount != 1) // close columns set if any is open - EndColumns(); - PopClipRect(); // inner window clip rectangle - - // Stop logging - if (!(window->Flags & ImGuiWindowFlags_ChildWindow)) // FIXME: add more options for scope of logging - LogFinish(); - - // Pop - // NB: we don't clear 'window->RootWindow'. The pointer is allowed to live until the next call to Begin(). - g.CurrentWindowStack.pop_back(); - if (window->Flags & ImGuiWindowFlags_Popup) - g.CurrentPopupStack.pop_back(); - CheckStacksSize(window, false); - SetCurrentWindow(g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back()); -} - -// Vertical scrollbar -// The entire piece of code below is rather confusing because: -// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab) -// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar -// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal. -void ImGui::Scrollbar(ImGuiLayoutType direction) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - const bool horizontal = (direction == ImGuiLayoutType_Horizontal); - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(horizontal ? "#SCROLLX" : "#SCROLLY"); - - // Render background - bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX); - float other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f; - const ImRect window_rect = window->Rect(); - const float border_size = window->WindowBorderSize; - ImRect bb = horizontal - ? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size) - : ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size); - if (!horizontal) - bb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() : 0.0f); - if (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f) - return; - - int window_rounding_corners; - if (horizontal) - window_rounding_corners = ImDrawCornerFlags_BotLeft | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight); - else - window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0) | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight); - window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, window_rounding_corners); - bb.Expand(ImVec2(-ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f))); - - // V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar) - float scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight(); - float scroll_v = horizontal ? window->Scroll.x : window->Scroll.y; - float win_size_avail_v = (horizontal ? window->SizeFull.x : window->SizeFull.y) - other_scrollbar_size_w; - float win_size_contents_v = horizontal ? window->SizeContents.x : window->SizeContents.y; - - // Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount) - // But we maintain a minimum size in pixel to allow for the user to still aim inside. - IM_ASSERT(ImMax(win_size_contents_v, win_size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers. - const float win_size_v = ImMax(ImMax(win_size_contents_v, win_size_avail_v), 1.0f); - const float grab_h_pixels = ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v); - const float grab_h_norm = grab_h_pixels / scrollbar_size_v; - - // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar(). - bool held = false; - bool hovered = false; - const bool previously_held = (g.ActiveId == id); - ButtonBehavior(bb, id, &hovered, &held); - - float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v); - float scroll_ratio = ImSaturate(scroll_v / scroll_max); - float grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; - if (held && grab_h_norm < 1.0f) - { - float scrollbar_pos_v = horizontal ? bb.Min.x : bb.Min.y; - float mouse_pos_v = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y; - float* click_delta_to_grab_center_v = horizontal ? &g.ScrollbarClickDeltaToGrabCenter.x : &g.ScrollbarClickDeltaToGrabCenter.y; - - // Click position in scrollbar normalized space (0.0f->1.0f) - const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v); - SetHoveredID(id); - - bool seek_absolute = false; - if (!previously_held) - { - // On initial click calculate the distance between mouse and the center of the grab - if (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm) - { - *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f; - } - else - { - seek_absolute = true; - *click_delta_to_grab_center_v = 0.0f; - } - } - - // Apply scroll - // It is ok to modify Scroll here because we are being called in Begin() after the calculation of SizeContents and before setting up our starting position - const float scroll_v_norm = ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm*0.5f) / (1.0f - grab_h_norm)); - scroll_v = (float)(int)(0.5f + scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v)); - if (horizontal) - window->Scroll.x = scroll_v; - else - window->Scroll.y = scroll_v; - - // Update values for rendering - scroll_ratio = ImSaturate(scroll_v / scroll_max); - grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v; - - // Update distance to grab now that we have seeked and saturated - if (seek_absolute) - *click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm*0.5f; - } - - // Render - const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab); - ImRect grab_rect; - if (horizontal) - grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImMin(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, window_rect.Max.x), bb.Max.y); - else - grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImMin(ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels, window_rect.Max.y)); - window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding); -} - -void ImGui::BringWindowToFront(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - if (g.Windows.back() == window) - return; - for (int i = 0; i < g.Windows.Size; i++) - if (g.Windows[i] == window) - { - g.Windows.erase(g.Windows.begin() + i); - g.Windows.push_back(window); - break; - } -} - -void ImGui::BringWindowToBack(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - if (g.Windows[0] == window) - return; - for (int i = 0; i < g.Windows.Size; i++) - if (g.Windows[i] == window) - { - memmove(&g.Windows[1], &g.Windows[0], (size_t)i * sizeof(ImGuiWindow*)); - g.Windows[0] = window; - break; - } -} - -// Moving window to front of display and set focus (which happens to be back of our sorted list) -void ImGui::FocusWindow(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - - // Always mark the window we passed as focused. This is used for keyboard interactions such as tabbing. - g.NavWindow = window; - - // Passing NULL allow to disable keyboard focus - if (!window) - return; - - // Move the root window to the top of the pile - if (window->RootWindow) - window = window->RootWindow; - - // Steal focus on active widgets - if (window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement should be unnecessary. Need further testing before removing it.. - if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != window) - ClearActiveID(); - - // Bring to front - if (!(window->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) - BringWindowToFront(window); -} - -void ImGui::FocusPreviousWindow() -{ - ImGuiContext& g = *GImGui; - for (int i = g.Windows.Size - 1; i >= 0; i--) - if (g.Windows[i]->WasActive && !(g.Windows[i]->Flags & ImGuiWindowFlags_ChildWindow)) - { - FocusWindow(g.Windows[i]); - return; - } -} - -void ImGui::PushItemWidth(float item_width) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.ItemWidth = (item_width == 0.0f ? window->ItemWidthDefault : item_width); - window->DC.ItemWidthStack.push_back(window->DC.ItemWidth); -} - -void ImGui::PushMultiItemsWidths(int components, float w_full) -{ - ImGuiWindow* window = GetCurrentWindow(); - const ImGuiStyle& style = GImGui->Style; - if (w_full <= 0.0f) - w_full = CalcItemWidth(); - const float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.ItemInnerSpacing.x) * (components-1)) / (float)components)); - const float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components-1))); - window->DC.ItemWidthStack.push_back(w_item_last); - for (int i = 0; i < components-1; i++) - window->DC.ItemWidthStack.push_back(w_item_one); - window->DC.ItemWidth = window->DC.ItemWidthStack.back(); -} - -void ImGui::PopItemWidth() -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.ItemWidthStack.pop_back(); - window->DC.ItemWidth = window->DC.ItemWidthStack.empty() ? window->ItemWidthDefault : window->DC.ItemWidthStack.back(); -} - -float ImGui::CalcItemWidth() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - float w = window->DC.ItemWidth; - if (w < 0.0f) - { - // Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well. - float width_to_right_edge = GetContentRegionAvail().x; - w = ImMax(1.0f, width_to_right_edge + w); - } - w = (float)(int)w; - return w; -} - -static ImFont* GetDefaultFont() -{ - ImGuiContext& g = *GImGui; - return g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0]; -} - -static void SetCurrentFont(ImFont* font) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(font && font->IsLoaded()); // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ? - IM_ASSERT(font->Scale > 0.0f); - g.Font = font; - g.FontBaseSize = g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale; - g.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f; - g.FontTexUvWhitePixel = g.Font->ContainerAtlas->TexUvWhitePixel; -} - -void ImGui::PushFont(ImFont* font) -{ - ImGuiContext& g = *GImGui; - if (!font) - font = GetDefaultFont(); - SetCurrentFont(font); - g.FontStack.push_back(font); - g.CurrentWindow->DrawList->PushTextureID(font->ContainerAtlas->TexID); -} - -void ImGui::PopFont() -{ - ImGuiContext& g = *GImGui; - g.CurrentWindow->DrawList->PopTextureID(); - g.FontStack.pop_back(); - SetCurrentFont(g.FontStack.empty() ? GetDefaultFont() : g.FontStack.back()); -} - -void ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (enabled) - window->DC.ItemFlags |= option; - else - window->DC.ItemFlags &= ~option; - window->DC.ItemFlagsStack.push_back(window->DC.ItemFlags); -} - -void ImGui::PopItemFlag() -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.ItemFlagsStack.pop_back(); - window->DC.ItemFlags = window->DC.ItemFlagsStack.empty() ? ImGuiItemFlags_Default_ : window->DC.ItemFlagsStack.back(); -} - -void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus) -{ - PushItemFlag(ImGuiItemFlags_AllowKeyboardFocus, allow_keyboard_focus); -} - -void ImGui::PopAllowKeyboardFocus() -{ - PopItemFlag(); -} - -void ImGui::PushButtonRepeat(bool repeat) -{ - PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); -} - -void ImGui::PopButtonRepeat() -{ - PopItemFlag(); -} - -void ImGui::PushTextWrapPos(float wrap_pos_x) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.TextWrapPos = wrap_pos_x; - window->DC.TextWrapPosStack.push_back(wrap_pos_x); -} - -void ImGui::PopTextWrapPos() -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.TextWrapPosStack.pop_back(); - window->DC.TextWrapPos = window->DC.TextWrapPosStack.empty() ? -1.0f : window->DC.TextWrapPosStack.back(); -} - -// FIXME: This may incur a round-trip (if the end user got their data from a float4) but eventually we aim to store the in-flight colors as ImU32 -void ImGui::PushStyleColor(ImGuiCol idx, ImU32 col) -{ - ImGuiContext& g = *GImGui; - ImGuiColMod backup; - backup.Col = idx; - backup.BackupValue = g.Style.Colors[idx]; - g.ColorModifiers.push_back(backup); - g.Style.Colors[idx] = ColorConvertU32ToFloat4(col); -} - -void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col) -{ - ImGuiContext& g = *GImGui; - ImGuiColMod backup; - backup.Col = idx; - backup.BackupValue = g.Style.Colors[idx]; - g.ColorModifiers.push_back(backup); - g.Style.Colors[idx] = col; -} - -void ImGui::PopStyleColor(int count) -{ - ImGuiContext& g = *GImGui; - while (count > 0) - { - ImGuiColMod& backup = g.ColorModifiers.back(); - g.Style.Colors[backup.Col] = backup.BackupValue; - g.ColorModifiers.pop_back(); - count--; - } -} - -struct ImGuiStyleVarInfo -{ - ImGuiDataType Type; - ImU32 Offset; - void* GetVarPtr(ImGuiStyle* style) const { return (void*)((unsigned char*)style + Offset); } -}; - -static const ImGuiStyleVarInfo GStyleVarInfo[ImGuiStyleVar_Count_] = -{ - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha - { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) }, // ImGuiStyleVar_WindowPadding - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) }, // ImGuiStyleVar_WindowRounding - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowBorderSize) }, // ImGuiStyleVar_WindowBorderSize - { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) }, // ImGuiStyleVar_WindowMinSize - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildRounding) }, // ImGuiStyleVar_ChildRounding - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ChildBorderSize) }, // ImGuiStyleVar_ChildBorderSize - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupRounding) }, // ImGuiStyleVar_PopupRounding - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupBorderSize) }, // ImGuiStyleVar_PopupBorderSize - { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameBorderSize) }, // ImGuiStyleVar_FrameBorderSize - { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing - { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) }, // ImGuiStyleVar_IndentSpacing - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, GrabMinSize) }, // ImGuiStyleVar_GrabMinSize - { ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign - { ImGuiDataType_Float, (ImU32)IM_OFFSETOF(ImGuiStyle, ViewId) }, -}; - -static const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx) -{ - IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_Count_); - return &GStyleVarInfo[idx]; -} - -void ImGui::PushStyleVar(ImGuiStyleVar idx, float val) -{ - const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); - if (var_info->Type == ImGuiDataType_Float) - { - ImGuiContext& g = *GImGui; - float* pvar = (float*)var_info->GetVarPtr(&g.Style); - g.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar)); - *pvar = val; - return; - } - IM_ASSERT(0); // Called function with wrong-type? Variable is not a float. -} - -void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) -{ - const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); - if (var_info->Type == ImGuiDataType_Float2) - { - ImGuiContext& g = *GImGui; - ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style); - g.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar)); - *pvar = val; - return; - } - IM_ASSERT(0); // Called function with wrong-type? Variable is not a ImVec2. -} - -void ImGui::PopStyleVar(int count) -{ - ImGuiContext& g = *GImGui; - while (count > 0) - { - ImGuiStyleMod& backup = g.StyleModifiers.back(); - const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx); - if (info->Type == ImGuiDataType_Float) (*(float*)info->GetVarPtr(&g.Style)) = backup.BackupFloat[0]; - else if (info->Type == ImGuiDataType_Float2) (*(ImVec2*)info->GetVarPtr(&g.Style)) = ImVec2(backup.BackupFloat[0], backup.BackupFloat[1]); - else if (info->Type == ImGuiDataType_Int) (*(int*)info->GetVarPtr(&g.Style)) = backup.BackupInt[0]; - g.StyleModifiers.pop_back(); - count--; - } -} - -const char* ImGui::GetStyleColorName(ImGuiCol idx) -{ - // Create switch-case from enum with regexp: ImGuiCol_{.*}, --> case ImGuiCol_\1: return "\1"; - switch (idx) - { - case ImGuiCol_Text: return "Text"; - case ImGuiCol_TextDisabled: return "TextDisabled"; - case ImGuiCol_WindowBg: return "WindowBg"; - case ImGuiCol_ChildBg: return "ChildBg"; - case ImGuiCol_PopupBg: return "PopupBg"; - case ImGuiCol_Border: return "Border"; - case ImGuiCol_BorderShadow: return "BorderShadow"; - case ImGuiCol_FrameBg: return "FrameBg"; - case ImGuiCol_FrameBgHovered: return "FrameBgHovered"; - case ImGuiCol_FrameBgActive: return "FrameBgActive"; - case ImGuiCol_TitleBg: return "TitleBg"; - case ImGuiCol_TitleBgActive: return "TitleBgActive"; - case ImGuiCol_TitleBgCollapsed: return "TitleBgCollapsed"; - case ImGuiCol_MenuBarBg: return "MenuBarBg"; - case ImGuiCol_ScrollbarBg: return "ScrollbarBg"; - case ImGuiCol_ScrollbarGrab: return "ScrollbarGrab"; - case ImGuiCol_ScrollbarGrabHovered: return "ScrollbarGrabHovered"; - case ImGuiCol_ScrollbarGrabActive: return "ScrollbarGrabActive"; - case ImGuiCol_CheckMark: return "CheckMark"; - case ImGuiCol_SliderGrab: return "SliderGrab"; - case ImGuiCol_SliderGrabActive: return "SliderGrabActive"; - case ImGuiCol_Button: return "Button"; - case ImGuiCol_ButtonHovered: return "ButtonHovered"; - case ImGuiCol_ButtonActive: return "ButtonActive"; - case ImGuiCol_Header: return "Header"; - case ImGuiCol_HeaderHovered: return "HeaderHovered"; - case ImGuiCol_HeaderActive: return "HeaderActive"; - case ImGuiCol_Separator: return "Separator"; - case ImGuiCol_SeparatorHovered: return "SeparatorHovered"; - case ImGuiCol_SeparatorActive: return "SeparatorActive"; - case ImGuiCol_ResizeGrip: return "ResizeGrip"; - case ImGuiCol_ResizeGripHovered: return "ResizeGripHovered"; - case ImGuiCol_ResizeGripActive: return "ResizeGripActive"; - case ImGuiCol_CloseButton: return "CloseButton"; - case ImGuiCol_CloseButtonHovered: return "CloseButtonHovered"; - case ImGuiCol_CloseButtonActive: return "CloseButtonActive"; - case ImGuiCol_PlotLines: return "PlotLines"; - case ImGuiCol_PlotLinesHovered: return "PlotLinesHovered"; - case ImGuiCol_PlotHistogram: return "PlotHistogram"; - case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered"; - case ImGuiCol_TextSelectedBg: return "TextSelectedBg"; - case ImGuiCol_ModalWindowDarkening: return "ModalWindowDarkening"; - } - IM_ASSERT(0); - return "Unknown"; -} - -bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags) -{ - IM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0); // Flags not supported by this function - ImGuiContext& g = *GImGui; - if (flags & ImGuiHoveredFlags_FlattenChilds) - { - if (g.HoveredRootWindow != g.CurrentWindow->RootWindow) - return false; - } - else - { - if (g.HoveredWindow != g.CurrentWindow) - return false; - } - if (!IsWindowContentHoverable(g.HoveredRootWindow, flags)) - return false; - if (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) - if (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != g.HoveredWindow->MoveId) - return false; - return true; -} - -bool ImGui::IsWindowFocused() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.CurrentWindow); // Not inside a Begin()/End() - return g.NavWindow == g.CurrentWindow; -} - -bool ImGui::IsRootWindowFocused() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.CurrentWindow); // Not inside a Begin()/End() - return g.NavWindow == g.CurrentWindow->RootWindow; -} - -bool ImGui::IsRootWindowOrAnyChildFocused() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.CurrentWindow); // Not inside a Begin()/End() - return g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow->RootWindow; -} - -float ImGui::GetWindowWidth() -{ - ImGuiWindow* window = GImGui->CurrentWindow; - return window->Size.x; -} - -float ImGui::GetWindowHeight() -{ - ImGuiWindow* window = GImGui->CurrentWindow; - return window->Size.y; -} - -ImVec2 ImGui::GetWindowPos() -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - return window->Pos; -} - -static void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y) -{ - window->DC.CursorMaxPos.y += window->Scroll.y; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it. - window->Scroll.y = new_scroll_y; - window->DC.CursorMaxPos.y -= window->Scroll.y; -} - -static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond) -{ - // Test condition (NB: bit 0 is always true) and clear flags for next time - if (cond && (window->SetWindowPosAllowFlags & cond) == 0) - return; - window->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); - window->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX); - - // Set - const ImVec2 old_pos = window->Pos; - window->PosFloat = pos; - window->Pos = ImVec2((float)(int)window->PosFloat.x, (float)(int)window->PosFloat.y); - window->DC.CursorPos += (window->Pos - old_pos); // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor - window->DC.CursorMaxPos += (window->Pos - old_pos); // And more importantly we need to adjust this so size calculation doesn't get affected. -} - -void ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - SetWindowPos(window, pos, cond); -} - -void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond) -{ - if (ImGuiWindow* window = FindWindowByName(name)) - SetWindowPos(window, pos, cond); -} - -ImVec2 ImGui::GetWindowSize() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->Size; -} - -static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond) -{ - // Test condition (NB: bit 0 is always true) and clear flags for next time - if (cond && (window->SetWindowSizeAllowFlags & cond) == 0) - return; - window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); - - // Set - if (size.x > 0.0f) - { - window->AutoFitFramesX = 0; - window->SizeFull.x = size.x; - } - else - { - window->AutoFitFramesX = 2; - window->AutoFitOnlyGrows = false; - } - if (size.y > 0.0f) - { - window->AutoFitFramesY = 0; - window->SizeFull.y = size.y; - } - else - { - window->AutoFitFramesY = 2; - window->AutoFitOnlyGrows = false; - } -} - -void ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond) -{ - SetWindowSize(GImGui->CurrentWindow, size, cond); -} - -void ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond) -{ - if (ImGuiWindow* window = FindWindowByName(name)) - SetWindowSize(window, size, cond); -} - -static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond) -{ - // Test condition (NB: bit 0 is always true) and clear flags for next time - if (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0) - return; - window->SetWindowCollapsedAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); - - // Set - window->Collapsed = collapsed; -} - -void ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond) -{ - SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond); -} - -bool ImGui::IsWindowCollapsed() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->Collapsed; -} - -bool ImGui::IsWindowAppearing() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->Appearing; -} - -void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond) -{ - if (ImGuiWindow* window = FindWindowByName(name)) - SetWindowCollapsed(window, collapsed, cond); -} - -void ImGui::SetWindowFocus() -{ - FocusWindow(GImGui->CurrentWindow); -} - -void ImGui::SetWindowFocus(const char* name) -{ - if (name) - { - if (ImGuiWindow* window = FindWindowByName(name)) - FocusWindow(window); - } - else - { - FocusWindow(NULL); - } -} - -void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pivot) -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowPosVal = pos; - g.SetNextWindowPosPivot = pivot; - g.SetNextWindowPosCond = cond ? cond : ImGuiCond_Always; -} - -void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond) -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowSizeVal = size; - g.SetNextWindowSizeCond = cond ? cond : ImGuiCond_Always; -} - -void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback, void* custom_callback_user_data) -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowSizeConstraint = true; - g.SetNextWindowSizeConstraintRect = ImRect(size_min, size_max); - g.SetNextWindowSizeConstraintCallback = custom_callback; - g.SetNextWindowSizeConstraintCallbackUserData = custom_callback_user_data; -} - -void ImGui::SetNextWindowContentSize(const ImVec2& size) -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowContentSizeVal = size; - g.SetNextWindowContentSizeCond = ImGuiCond_Always; -} - -void ImGui::SetNextWindowContentWidth(float width) -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowContentSizeVal = ImVec2(width, g.SetNextWindowContentSizeCond ? g.SetNextWindowContentSizeVal.y : 0.0f); - g.SetNextWindowContentSizeCond = ImGuiCond_Always; -} - -void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond) -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowCollapsedVal = collapsed; - g.SetNextWindowCollapsedCond = cond ? cond : ImGuiCond_Always; -} - -void ImGui::SetNextWindowFocus() -{ - ImGuiContext& g = *GImGui; - g.SetNextWindowFocus = true; -} - -// In window space (not screen space!) -ImVec2 ImGui::GetContentRegionMax() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - ImVec2 mx = window->ContentsRegionRect.Max; - if (window->DC.ColumnsCount != 1) - mx.x = GetColumnOffset(window->DC.ColumnsCurrent + 1) - window->WindowPadding.x; - return mx; -} - -ImVec2 ImGui::GetContentRegionAvail() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return GetContentRegionMax() - (window->DC.CursorPos - window->Pos); -} - -float ImGui::GetContentRegionAvailWidth() -{ - return GetContentRegionAvail().x; -} - -// In window space (not screen space!) -ImVec2 ImGui::GetWindowContentRegionMin() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->ContentsRegionRect.Min; -} - -ImVec2 ImGui::GetWindowContentRegionMax() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->ContentsRegionRect.Max; -} - -float ImGui::GetWindowContentRegionWidth() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->ContentsRegionRect.Max.x - window->ContentsRegionRect.Min.x; -} - -float ImGui::GetTextLineHeight() -{ - ImGuiContext& g = *GImGui; - return g.FontSize; -} - -float ImGui::GetTextLineHeightWithSpacing() -{ - ImGuiContext& g = *GImGui; - return g.FontSize + g.Style.ItemSpacing.y; -} - -float ImGui::GetItemsLineHeightWithSpacing() -{ - ImGuiContext& g = *GImGui; - return g.FontSize + g.Style.FramePadding.y * 2.0f + g.Style.ItemSpacing.y; -} - -ImDrawList* ImGui::GetWindowDrawList() -{ - ImGuiWindow* window = GetCurrentWindow(); - return window->DrawList; -} - -ImFont* ImGui::GetFont() -{ - return GImGui->Font; -} - -float ImGui::GetFontSize() -{ - return GImGui->FontSize; -} - -ImVec2 ImGui::GetFontTexUvWhitePixel() -{ - return GImGui->FontTexUvWhitePixel; -} - -void ImGui::SetWindowFontScale(float scale) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - window->FontWindowScale = scale; - g.FontSize = window->CalcFontSize(); -} - -// User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient. -// Conversion happens as we pass the value to user, but it makes our naming convention confusing because GetCursorPos() == (DC.CursorPos - window.Pos). May want to rename 'DC.CursorPos'. -ImVec2 ImGui::GetCursorPos() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.CursorPos - window->Pos + window->Scroll; -} - -float ImGui::GetCursorPosX() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.CursorPos.x - window->Pos.x + window->Scroll.x; -} - -float ImGui::GetCursorPosY() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.CursorPos.y - window->Pos.y + window->Scroll.y; -} - -void ImGui::SetCursorPos(const ImVec2& local_pos) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.CursorPos = window->Pos - window->Scroll + local_pos; - window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); -} - -void ImGui::SetCursorPosX(float x) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + x; - window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x); -} - -void ImGui::SetCursorPosY(float y) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.CursorPos.y = window->Pos.y - window->Scroll.y + y; - window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y); -} - -ImVec2 ImGui::GetCursorStartPos() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.CursorStartPos - window->Pos; -} - -ImVec2 ImGui::GetCursorScreenPos() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.CursorPos; -} - -void ImGui::SetCursorScreenPos(const ImVec2& screen_pos) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.CursorPos = screen_pos; - window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); -} - -float ImGui::GetScrollX() -{ - return GImGui->CurrentWindow->Scroll.x; -} - -float ImGui::GetScrollY() -{ - return GImGui->CurrentWindow->Scroll.y; -} - -float ImGui::GetScrollMaxX() -{ - return GetScrollMaxX(GImGui->CurrentWindow); -} - -float ImGui::GetScrollMaxY() -{ - return GetScrollMaxY(GImGui->CurrentWindow); -} - -void ImGui::SetScrollX(float scroll_x) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->ScrollTarget.x = scroll_x; - window->ScrollTargetCenterRatio.x = 0.0f; -} - -void ImGui::SetScrollY(float scroll_y) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->ScrollTarget.y = scroll_y + window->TitleBarHeight() + window->MenuBarHeight(); // title bar height canceled out when using ScrollTargetRelY - window->ScrollTargetCenterRatio.y = 0.0f; -} - -void ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio) -{ - // We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size - ImGuiWindow* window = GetCurrentWindow(); - IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f); - window->ScrollTarget.y = (float)(int)(pos_y + window->Scroll.y); - window->ScrollTargetCenterRatio.y = center_y_ratio; - - // Minor hack to to make scrolling to top/bottom of window take account of WindowPadding, it looks more right to the user this way - if (center_y_ratio <= 0.0f && window->ScrollTarget.y <= window->WindowPadding.y) - window->ScrollTarget.y = 0.0f; - else if (center_y_ratio >= 1.0f && window->ScrollTarget.y >= window->SizeContents.y - window->WindowPadding.y + GImGui->Style.ItemSpacing.y) - window->ScrollTarget.y = window->SizeContents.y; -} - -// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item. -void ImGui::SetScrollHere(float center_y_ratio) -{ - ImGuiWindow* window = GetCurrentWindow(); - float target_y = window->DC.CursorPosPrevLine.y - window->Pos.y; // Top of last item, in window space - target_y += (window->DC.PrevLineHeight * center_y_ratio) + (GImGui->Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line. - SetScrollFromPosY(target_y, center_y_ratio); -} - -void ImGui::SetKeyboardFocusHere(int offset) -{ - IM_ASSERT(offset >= -1); // -1 is allowed but not below - ImGuiWindow* window = GetCurrentWindow(); - window->FocusIdxAllRequestNext = window->FocusIdxAllCounter + 1 + offset; - window->FocusIdxTabRequestNext = INT_MAX; -} - -void ImGui::SetStateStorage(ImGuiStorage* tree) -{ - ImGuiWindow* window = GetCurrentWindow(); - window->DC.StateStorage = tree ? tree : &window->StateStorage; -} - -ImGuiStorage* ImGui::GetStateStorage() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.StateStorage; -} - -void ImGui::TextV(const char* fmt, va_list args) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - TextUnformatted(g.TempBuffer, text_end); -} - -void ImGui::Text(const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - TextV(fmt, args); - va_end(args); -} - -void ImGui::TextColoredV(const ImVec4& col, const char* fmt, va_list args) -{ - PushStyleColor(ImGuiCol_Text, col); - TextV(fmt, args); - PopStyleColor(); -} - -void ImGui::TextColored(const ImVec4& col, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - TextColoredV(col, fmt, args); - va_end(args); -} - -void ImGui::TextDisabledV(const char* fmt, va_list args) -{ - PushStyleColor(ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled]); - TextV(fmt, args); - PopStyleColor(); -} - -void ImGui::TextDisabled(const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - TextDisabledV(fmt, args); - va_end(args); -} - -void ImGui::TextWrappedV(const char* fmt, va_list args) -{ - bool need_wrap = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position is one ia already set - if (need_wrap) PushTextWrapPos(0.0f); - TextV(fmt, args); - if (need_wrap) PopTextWrapPos(); -} - -void ImGui::TextWrapped(const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - TextWrappedV(fmt, args); - va_end(args); -} - -void ImGui::TextUnformatted(const char* text, const char* text_end) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - IM_ASSERT(text != NULL); - const char* text_begin = text; - if (text_end == NULL) - text_end = text + strlen(text); // FIXME-OPT - - const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrentLineTextBaseOffset); - const float wrap_pos_x = window->DC.TextWrapPos; - const bool wrap_enabled = wrap_pos_x >= 0.0f; - if (text_end - text > 2000 && !wrap_enabled) - { - // Long text! - // Perform manual coarse clipping to optimize for long multi-line text - // From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled. - // We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line. - const char* line = text; - const float line_height = GetTextLineHeight(); - const ImRect clip_rect = window->ClipRect; - ImVec2 text_size(0,0); - - if (text_pos.y <= clip_rect.Max.y) - { - ImVec2 pos = text_pos; - - // Lines to skip (can't skip when logging text) - if (!g.LogEnabled) - { - int lines_skippable = (int)((clip_rect.Min.y - text_pos.y) / line_height); - if (lines_skippable > 0) - { - int lines_skipped = 0; - while (line < text_end && lines_skipped < lines_skippable) - { - const char* line_end = strchr(line, '\n'); - if (!line_end) - line_end = text_end; - line = line_end + 1; - lines_skipped++; - } - pos.y += lines_skipped * line_height; - } - } - - // Lines to render - if (line < text_end) - { - ImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height)); - while (line < text_end) - { - const char* line_end = strchr(line, '\n'); - if (IsClippedEx(line_rect, 0, false)) - break; - - const ImVec2 line_size = CalcTextSize(line, line_end, false); - text_size.x = ImMax(text_size.x, line_size.x); - RenderText(pos, line, line_end, false); - if (!line_end) - line_end = text_end; - line = line_end + 1; - line_rect.Min.y += line_height; - line_rect.Max.y += line_height; - pos.y += line_height; - } - - // Count remaining lines - int lines_skipped = 0; - while (line < text_end) - { - const char* line_end = strchr(line, '\n'); - if (!line_end) - line_end = text_end; - line = line_end + 1; - lines_skipped++; - } - pos.y += lines_skipped * line_height; - } - - text_size.y += (pos - text_pos).y; - } - - ImRect bb(text_pos, text_pos + text_size); - ItemSize(bb); - ItemAdd(bb, 0); - } - else - { - const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f; - const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width); - - // Account of baseline offset - ImRect bb(text_pos, text_pos + text_size); - ItemSize(text_size); - if (!ItemAdd(bb, 0)) - return; - - // Render (we don't hide text after ## in this end-user function) - RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width); - } -} - -void ImGui::AlignTextToFramePadding() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - window->DC.CurrentLineHeight = ImMax(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y * 2); - window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y); -} - -// Add a label+text combo aligned to other label+value widgets -void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const float w = CalcItemWidth(); - - const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2)); - const ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y*2) + label_size); - ItemSize(total_bb, style.FramePadding.y); - if (!ItemAdd(total_bb, 0)) - return; - - // Render - const char* value_text_begin = &g.TempBuffer[0]; - const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - RenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImVec2(0.0f,0.5f)); - if (label_size.x > 0.0f) - RenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label); -} - -void ImGui::LabelText(const char* label, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - LabelTextV(label, fmt, args); - va_end(args); -} - -bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - - if (flags & ImGuiButtonFlags_Disabled) - { - if (out_hovered) *out_hovered = false; - if (out_held) *out_held = false; - if (g.ActiveId == id) ClearActiveID(); - return false; - } - - // Default behavior requires click+release on same spot - if ((flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick)) == 0) - flags |= ImGuiButtonFlags_PressedOnClickRelease; - - ImGuiWindow* backup_hovered_window = g.HoveredWindow; - if ((flags & ImGuiButtonFlags_FlattenChilds) && g.HoveredRootWindow == window) - g.HoveredWindow = window; - - bool pressed = false; - bool hovered = ItemHoverable(bb, id); - - if ((flags & ImGuiButtonFlags_FlattenChilds) && g.HoveredRootWindow == window) - g.HoveredWindow = backup_hovered_window; - - // AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one. - if (hovered && (flags & ImGuiButtonFlags_AllowOverlapMode) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0)) - hovered = false; - - if (hovered) - { - if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt)) - { - // | CLICKING | HOLDING with ImGuiButtonFlags_Repeat - // PressedOnClickRelease | * | .. (NOT on release) <-- MOST COMMON! (*) only if both click/release were over bounds - // PressedOnClick | | .. - // PressedOnRelease | | .. (NOT on release) - // PressedOnDoubleClick | | .. - if ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0]) - { - SetActiveID(id, window); // Hold on ID - FocusWindow(window); - g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; - } - if (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0])) - { - pressed = true; - if (flags & ImGuiButtonFlags_NoHoldingActiveID) - { - ClearActiveID(); - } - else - { - SetActiveID(id, window); // Hold on ID - g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; - } - FocusWindow(window); - } - if ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0]) - { - if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay)) // Repeat mode trumps - pressed = true; - ClearActiveID(); - } - - // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). - // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings. - if ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && g.IO.MouseDownDuration[0] > 0.0f && IsMouseClicked(0, true)) - pressed = true; - } - } - - bool held = false; - if (g.ActiveId == id) - { - if (g.IO.MouseDown[0]) - { - held = true; - } - else - { - if (hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease)) - if (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay)) // Repeat mode trumps - pressed = true; - ClearActiveID(); - } - } - - if (out_hovered) *out_hovered = hovered; - if (out_held) *out_held = held; - - return pressed; -} - -bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - const ImVec2 label_size = CalcTextSize(label, NULL, true); - - ImVec2 pos = window->DC.CursorPos; - if ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag) - pos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y; - ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f); - - const ImRect bb(pos, pos + size); - ItemSize(bb, style.FramePadding.y); - if (!ItemAdd(bb, id)) - return false; - - if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat) flags |= ImGuiButtonFlags_Repeat; - bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); - - // Render - const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); - RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); - RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb); - - // Automatically close popups - //if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup)) - // CloseCurrentPopup(); - - return pressed; -} - -bool ImGui::Button(const char* label, const ImVec2& size_arg) -{ - return ButtonEx(label, size_arg, 0); -} - -// Small buttons fits within text without additional vertical spacing. -bool ImGui::SmallButton(const char* label) -{ - ImGuiContext& g = *GImGui; - float backup_padding_y = g.Style.FramePadding.y; - g.Style.FramePadding.y = 0.0f; - bool pressed = ButtonEx(label, ImVec2(0,0), ImGuiButtonFlags_AlignTextBaseLine); - g.Style.FramePadding.y = backup_padding_y; - return pressed; -} - -// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack. -// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id) -bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - const ImGuiID id = window->GetID(str_id); - ImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f); - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); - ItemSize(bb); - if (!ItemAdd(bb, id)) - return false; - - bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held); - - return pressed; -} - -// Upper-right button to close a window. -bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius) -{ - ImGuiWindow* window = GetCurrentWindow(); - - const ImRect bb(pos - ImVec2(radius,radius), pos + ImVec2(radius,radius)); - - bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held); - - // Render - const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton); - const ImVec2 center = bb.GetCenter(); - window->DrawList->AddCircleFilled(center, ImMax(2.0f, radius), col, 12); - - const float cross_extent = (radius * 0.7071f) - 1.0f; - if (hovered) - { - window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), GetColorU32(ImGuiCol_Text)); - window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), GetColorU32(ImGuiCol_Text)); - } - - return pressed; -} - -// [Internal] -bool ImGui::ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - if (window->SkipItems) - return false; - - const ImGuiStyle& style = g.Style; - - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + padding.x * 2.0f, g.FontSize + padding.y * 2.0f)); - ItemSize(bb, style.FramePadding.y); - if (!ItemAdd(bb, id)) - return false; - - bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); - - const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); -#ifdef IMGUI_HAS_NAV - RenderNavHighlight(bb, id); -#endif - RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); - RenderTriangle(bb.Min + padding, dir, 1.0f); - - return pressed; -} - -void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); - if (border_col.w > 0.0f) - bb.Max += ImVec2(2,2); - ItemSize(bb); - if (!ItemAdd(bb, 0)) - return; - - if (border_col.w > 0.0f) - { - window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f); - window->DrawList->AddImage(user_texture_id, bb.Min+ImVec2(1,1), bb.Max-ImVec2(1,1), uv0, uv1, GetColorU32(tint_col)); - } - else - { - window->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col)); - } -} - -// frame_padding < 0: uses FramePadding from style (default) -// frame_padding = 0: no framing -// frame_padding > 0: set framing size -// The color used are the button colors. -bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - // Default to using texture ID as ID. User can still push string/integer prefixes. - // We could hash the size/uv to create a unique ID but that would prevent the user from animating UV. - PushID((void *)user_texture_id); - const ImGuiID id = window->GetID("#image"); - PopID(); - - const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : style.FramePadding; - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding*2); - const ImRect image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size); - ItemSize(bb); - if (!ItemAdd(bb, id)) - return false; - - bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held); - - // Render - const ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); - RenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding)); - if (bg_col.w > 0.0f) - window->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, GetColorU32(bg_col)); - window->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, GetColorU32(tint_col)); - - return pressed; -} - -// Start logging ImGui output to TTY -void ImGui::LogToTTY(int max_depth) -{ - ImGuiContext& g = *GImGui; - if (g.LogEnabled) - return; - ImGuiWindow* window = g.CurrentWindow; - - g.LogEnabled = true; - g.LogFile = stdout; - g.LogStartDepth = window->DC.TreeDepth; - if (max_depth >= 0) - g.LogAutoExpandMaxDepth = max_depth; -} - -// Start logging ImGui output to given file -void ImGui::LogToFile(int max_depth, const char* filename) -{ - ImGuiContext& g = *GImGui; - if (g.LogEnabled) - return; - ImGuiWindow* window = g.CurrentWindow; - - if (!filename) - { - filename = g.IO.LogFilename; - if (!filename) - return; - } - - g.LogFile = ImFileOpen(filename, "ab"); - if (!g.LogFile) - { - IM_ASSERT(g.LogFile != NULL); // Consider this an error - return; - } - g.LogEnabled = true; - g.LogStartDepth = window->DC.TreeDepth; - if (max_depth >= 0) - g.LogAutoExpandMaxDepth = max_depth; -} - -// Start logging ImGui output to clipboard -void ImGui::LogToClipboard(int max_depth) -{ - ImGuiContext& g = *GImGui; - if (g.LogEnabled) - return; - ImGuiWindow* window = g.CurrentWindow; - - g.LogEnabled = true; - g.LogFile = NULL; - g.LogStartDepth = window->DC.TreeDepth; - if (max_depth >= 0) - g.LogAutoExpandMaxDepth = max_depth; -} - -void ImGui::LogFinish() -{ - ImGuiContext& g = *GImGui; - if (!g.LogEnabled) - return; - - LogText(IM_NEWLINE); - g.LogEnabled = false; - if (g.LogFile != NULL) - { - if (g.LogFile == stdout) - fflush(g.LogFile); - else - fclose(g.LogFile); - g.LogFile = NULL; - } - if (g.LogClipboard->size() > 1) - { - SetClipboardText(g.LogClipboard->begin()); - g.LogClipboard->clear(); - } -} - -// Helper to display logging buttons -void ImGui::LogButtons() -{ - ImGuiContext& g = *GImGui; - - PushID("LogButtons"); - const bool log_to_tty = Button("Log To TTY"); SameLine(); - const bool log_to_file = Button("Log To File"); SameLine(); - const bool log_to_clipboard = Button("Log To Clipboard"); SameLine(); - PushItemWidth(80.0f); - PushAllowKeyboardFocus(false); - SliderInt("Depth", &g.LogAutoExpandMaxDepth, 0, 9, NULL); - PopAllowKeyboardFocus(); - PopItemWidth(); - PopID(); - - // Start logging at the end of the function so that the buttons don't appear in the log - if (log_to_tty) - LogToTTY(g.LogAutoExpandMaxDepth); - if (log_to_file) - LogToFile(g.LogAutoExpandMaxDepth, g.IO.LogFilename); - if (log_to_clipboard) - LogToClipboard(g.LogAutoExpandMaxDepth); -} - -bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) -{ - if (flags & ImGuiTreeNodeFlags_Leaf) - return true; - - // We only write to the tree storage if the user clicks (or explicitely use SetNextTreeNode*** functions) - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - ImGuiStorage* storage = window->DC.StateStorage; - - bool is_open; - if (g.SetNextTreeNodeOpenCond != 0) - { - if (g.SetNextTreeNodeOpenCond & ImGuiCond_Always) - { - is_open = g.SetNextTreeNodeOpenVal; - storage->SetInt(id, is_open); - } - else - { - // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently. - const int stored_value = storage->GetInt(id, -1); - if (stored_value == -1) - { - is_open = g.SetNextTreeNodeOpenVal; - storage->SetInt(id, is_open); - } - else - { - is_open = stored_value != 0; - } - } - g.SetNextTreeNodeOpenCond = 0; - } - else - { - is_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0; - } - - // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior). - // NB- If we are above max depth we still allow manually opened nodes to be logged. - if (g.LogEnabled && !(flags & ImGuiTreeNodeFlags_NoAutoOpenOnLog) && window->DC.TreeDepth < g.LogAutoExpandMaxDepth) - is_open = true; - - return is_open; -} - -bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const bool display_frame = (flags & ImGuiTreeNodeFlags_Framed) != 0; - const ImVec2 padding = (display_frame || (flags & ImGuiTreeNodeFlags_FramePadding)) ? style.FramePadding : ImVec2(style.FramePadding.x, 0.0f); - - if (!label_end) - label_end = FindRenderedTextEnd(label); - const ImVec2 label_size = CalcTextSize(label, label_end, false); - - // We vertically grow up to current line height up the typical widget height. - const float text_base_offset_y = ImMax(padding.y, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it - const float frame_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + style.FramePadding.y*2), label_size.y + padding.y*2); - ImRect bb = ImRect(window->DC.CursorPos, ImVec2(window->Pos.x + GetContentRegionMax().x, window->DC.CursorPos.y + frame_height)); - if (display_frame) - { - // Framed header expand a little outside the default padding - bb.Min.x -= (float)(int)(window->WindowPadding.x*0.5f) - 1; - bb.Max.x += (float)(int)(window->WindowPadding.x*0.5f) - 1; - } - - const float text_offset_x = (g.FontSize + (display_frame ? padding.x*3 : padding.x*2)); // Collapser arrow width + Spacing - const float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x*2 : 0.0f); // Include collapser - ItemSize(ImVec2(text_width, frame_height), text_base_offset_y); - - // For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing - // (Ideally we'd want to add a flag for the user to specify if we want the hit test to be done up to the right side of the content or not) - const ImRect interact_bb = display_frame ? bb : ImRect(bb.Min.x, bb.Min.y, bb.Min.x + text_width + style.ItemSpacing.x*2, bb.Max.y); - bool is_open = TreeNodeBehaviorIsOpen(id, flags); - if (!ItemAdd(interact_bb, id)) - { - if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) - TreePushRawID(id); - return is_open; - } - - // Flags that affects opening behavior: - // - 0(default) ..................... single-click anywhere to open - // - OpenOnDoubleClick .............. double-click anywhere to open - // - OpenOnArrow .................... single-click on arrow to open - // - OpenOnDoubleClick|OpenOnArrow .. single-click on arrow or double-click anywhere to open - ImGuiButtonFlags button_flags = ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowOverlapMode) ? ImGuiButtonFlags_AllowOverlapMode : 0); - if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) - button_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0); - bool hovered, held, pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags); - if (pressed && !(flags & ImGuiTreeNodeFlags_Leaf)) - { - bool toggled = !(flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)); - if (flags & ImGuiTreeNodeFlags_OpenOnArrow) - toggled |= IsMouseHoveringRect(interact_bb.Min, ImVec2(interact_bb.Min.x + text_offset_x, interact_bb.Max.y)); - if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) - toggled |= g.IO.MouseDoubleClicked[0]; - if (toggled) - { - is_open = !is_open; - window->DC.StateStorage->SetInt(id, is_open); - } - } - if (flags & ImGuiTreeNodeFlags_AllowOverlapMode) - SetItemAllowOverlap(); - - // Render - const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); - const ImVec2 text_pos = bb.Min + ImVec2(text_offset_x, text_base_offset_y); - if (display_frame) - { - // Framed type - RenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding); - RenderTriangle(bb.Min + ImVec2(padding.x, text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f); - if (g.LogEnabled) - { - // NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here. - const char log_prefix[] = "\n##"; - const char log_suffix[] = "##"; - LogRenderedText(&text_pos, log_prefix, log_prefix+3); - RenderTextClipped(text_pos, bb.Max, label, label_end, &label_size); - LogRenderedText(&text_pos, log_suffix+1, log_suffix+3); - } - else - { - RenderTextClipped(text_pos, bb.Max, label, label_end, &label_size); - } - } - else - { - // Unframed typed for tree nodes - if (hovered || (flags & ImGuiTreeNodeFlags_Selected)) - RenderFrame(bb.Min, bb.Max, col, false); - - if (flags & ImGuiTreeNodeFlags_Bullet) - RenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize*0.50f + text_base_offset_y)); - else if (!(flags & ImGuiTreeNodeFlags_Leaf)) - RenderTriangle(bb.Min + ImVec2(padding.x, g.FontSize*0.15f + text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f); - if (g.LogEnabled) - LogRenderedText(&text_pos, ">"); - RenderText(text_pos, label, label_end, false); - } - - if (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) - TreePushRawID(id); - return is_open; -} - -// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag). -// This is basically the same as calling TreeNodeEx(label, ImGuiTreeNodeFlags_CollapsingHeader | ImGuiTreeNodeFlags_NoTreePushOnOpen). You can remove the _NoTreePushOnOpen flag if you want behavior closer to normal TreeNode(). -bool ImGui::CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - return TreeNodeBehavior(window->GetID(label), flags | ImGuiTreeNodeFlags_CollapsingHeader | ImGuiTreeNodeFlags_NoTreePushOnOpen, label); -} - -bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - if (p_open && !*p_open) - return false; - - ImGuiID id = window->GetID(label); - bool is_open = TreeNodeBehavior(id, flags | ImGuiTreeNodeFlags_CollapsingHeader | ImGuiTreeNodeFlags_NoTreePushOnOpen | (p_open ? ImGuiTreeNodeFlags_AllowOverlapMode : 0), label); - if (p_open) - { - // Create a small overlapping close button // FIXME: We can evolve this into user accessible helpers to add extra buttons on title bars, headers, etc. - ImGuiContext& g = *GImGui; - float button_sz = g.FontSize * 0.5f; - ImGuiItemHoveredDataBackup last_item_backup; - last_item_backup.Backup(); - if (CloseButton(window->GetID((void*)(intptr_t)(id+1)), ImVec2(ImMin(window->DC.LastItemRect.Max.x, window->ClipRect.Max.x) - g.Style.FramePadding.x - button_sz, window->DC.LastItemRect.Min.y + g.Style.FramePadding.y + button_sz), button_sz)) - *p_open = false; - last_item_backup.Restore(); - } - - return is_open; -} - -bool ImGui::TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - return TreeNodeBehavior(window->GetID(label), flags, label, NULL); -} - -bool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - return TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end); -} - -bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - return TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end); -} - -bool ImGui::TreeNodeV(const char* str_id, const char* fmt, va_list args) -{ - return TreeNodeExV(str_id, 0, fmt, args); -} - -bool ImGui::TreeNodeV(const void* ptr_id, const char* fmt, va_list args) -{ - return TreeNodeExV(ptr_id, 0, fmt, args); -} - -bool ImGui::TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - bool is_open = TreeNodeExV(str_id, flags, fmt, args); - va_end(args); - return is_open; -} - -bool ImGui::TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - bool is_open = TreeNodeExV(ptr_id, flags, fmt, args); - va_end(args); - return is_open; -} - -bool ImGui::TreeNode(const char* str_id, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - bool is_open = TreeNodeExV(str_id, 0, fmt, args); - va_end(args); - return is_open; -} - -bool ImGui::TreeNode(const void* ptr_id, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - bool is_open = TreeNodeExV(ptr_id, 0, fmt, args); - va_end(args); - return is_open; -} - -bool ImGui::TreeNode(const char* label) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - return TreeNodeBehavior(window->GetID(label), 0, label, NULL); -} - -void ImGui::TreeAdvanceToLabelPos() -{ - ImGuiContext& g = *GImGui; - g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing(); -} - -// Horizontal distance preceding label when using TreeNode() or Bullet() -float ImGui::GetTreeNodeToLabelSpacing() -{ - ImGuiContext& g = *GImGui; - return g.FontSize + (g.Style.FramePadding.x * 2.0f); -} - -void ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiCond cond) -{ - ImGuiContext& g = *GImGui; - if (g.CurrentWindow->SkipItems) - return; - g.SetNextTreeNodeOpenVal = is_open; - g.SetNextTreeNodeOpenCond = cond ? cond : ImGuiCond_Always; -} - -void ImGui::PushID(const char* str_id) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - window->IDStack.push_back(window->GetID(str_id)); -} - -void ImGui::PushID(const char* str_id_begin, const char* str_id_end) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - window->IDStack.push_back(window->GetID(str_id_begin, str_id_end)); -} - -void ImGui::PushID(const void* ptr_id) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - window->IDStack.push_back(window->GetID(ptr_id)); -} - -void ImGui::PushID(int int_id) -{ - const void* ptr_id = (void*)(intptr_t)int_id; - ImGuiWindow* window = GetCurrentWindowRead(); - window->IDStack.push_back(window->GetID(ptr_id)); -} - -void ImGui::PopID() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - window->IDStack.pop_back(); -} - -ImGuiID ImGui::GetID(const char* str_id) -{ - return GImGui->CurrentWindow->GetID(str_id); -} - -ImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end) -{ - return GImGui->CurrentWindow->GetID(str_id_begin, str_id_end); -} - -ImGuiID ImGui::GetID(const void* ptr_id) -{ - return GImGui->CurrentWindow->GetID(ptr_id); -} - -void ImGui::Bullet() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), g.FontSize); - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height)); - ItemSize(bb); - if (!ItemAdd(bb, 0)) - { - SameLine(0, style.FramePadding.x*2); - return; - } - - // Render and stay on same line - RenderBullet(bb.Min + ImVec2(style.FramePadding.x + g.FontSize*0.5f, line_height*0.5f)); - SameLine(0, style.FramePadding.x*2); -} - -// Text with a little bullet aligned to the typical tree node. -void ImGui::BulletTextV(const char* fmt, va_list args) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - const char* text_begin = g.TempBuffer; - const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - const ImVec2 label_size = CalcTextSize(text_begin, text_end, false); - const float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it - const float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y*2), g.FontSize); - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x*2) : 0.0f), ImMax(line_height, label_size.y))); // Empty text doesn't add padding - ItemSize(bb); - if (!ItemAdd(bb, 0)) - return; - - // Render - RenderBullet(bb.Min + ImVec2(style.FramePadding.x + g.FontSize*0.5f, line_height*0.5f)); - RenderText(bb.Min+ImVec2(g.FontSize + style.FramePadding.x*2, text_base_offset_y), text_begin, text_end, false); -} - -void ImGui::BulletText(const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - BulletTextV(fmt, args); - va_end(args); -} - -static inline void DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, const char* display_format, char* buf, int buf_size) -{ - if (data_type == ImGuiDataType_Int) - ImFormatString(buf, buf_size, display_format, *(int*)data_ptr); - else if (data_type == ImGuiDataType_Float) - ImFormatString(buf, buf_size, display_format, *(float*)data_ptr); -} - -static inline void DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, int decimal_precision, char* buf, int buf_size) -{ - if (data_type == ImGuiDataType_Int) - { - if (decimal_precision < 0) - ImFormatString(buf, buf_size, "%d", *(int*)data_ptr); - else - ImFormatString(buf, buf_size, "%.*d", decimal_precision, *(int*)data_ptr); - } - else if (data_type == ImGuiDataType_Float) - { - if (decimal_precision < 0) - ImFormatString(buf, buf_size, "%f", *(float*)data_ptr); // Ideally we'd have a minimum decimal precision of 1 to visually denote that it is a float, while hiding non-significant digits? - else - ImFormatString(buf, buf_size, "%.*f", decimal_precision, *(float*)data_ptr); - } -} - -static void DataTypeApplyOp(ImGuiDataType data_type, int op, void* value1, const void* value2)// Store into value1 -{ - if (data_type == ImGuiDataType_Int) - { - if (op == '+') - *(int*)value1 = *(int*)value1 + *(const int*)value2; - else if (op == '-') - *(int*)value1 = *(int*)value1 - *(const int*)value2; - } - else if (data_type == ImGuiDataType_Float) - { - if (op == '+') - *(float*)value1 = *(float*)value1 + *(const float*)value2; - else if (op == '-') - *(float*)value1 = *(float*)value1 - *(const float*)value2; - } -} - -// User can input math operators (e.g. +100) to edit a numerical values. -static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format) -{ - while (ImCharIsSpace(*buf)) - buf++; - - // We don't support '-' op because it would conflict with inputing negative value. - // Instead you can use +-100 to subtract from an existing value - char op = buf[0]; - if (op == '+' || op == '*' || op == '/') - { - buf++; - while (ImCharIsSpace(*buf)) - buf++; - } - else - { - op = 0; - } - if (!buf[0]) - return false; - - if (data_type == ImGuiDataType_Int) - { - if (!scalar_format) - scalar_format = "%d"; - int* v = (int*)data_ptr; - const int old_v = *v; - int arg0i = *v; - if (op && sscanf(initial_value_buf, scalar_format, &arg0i) < 1) - return false; - - // Store operand in a float so we can use fractional value for multipliers (*1.1), but constant always parsed as integer so we can fit big integers (e.g. 2000000003) past float precision - float arg1f = 0.0f; - if (op == '+') { if (sscanf(buf, "%f", &arg1f) == 1) *v = (int)(arg0i + arg1f); } // Add (use "+-" to subtract) - else if (op == '*') { if (sscanf(buf, "%f", &arg1f) == 1) *v = (int)(arg0i * arg1f); } // Multiply - else if (op == '/') { if (sscanf(buf, "%f", &arg1f) == 1 && arg1f != 0.0f) *v = (int)(arg0i / arg1f); }// Divide - else { if (sscanf(buf, scalar_format, &arg0i) == 1) *v = arg0i; } // Assign constant (read as integer so big values are not lossy) - return (old_v != *v); - } - else if (data_type == ImGuiDataType_Float) - { - // For floats we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in - scalar_format = "%f"; - float* v = (float*)data_ptr; - const float old_v = *v; - float arg0f = *v; - if (op && sscanf(initial_value_buf, scalar_format, &arg0f) < 1) - return false; - - float arg1f = 0.0f; - if (sscanf(buf, scalar_format, &arg1f) < 1) - return false; - if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract) - else if (op == '*') { *v = arg0f * arg1f; } // Multiply - else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide - else { *v = arg1f; } // Assign constant - return (old_v != *v); - } - - return false; -} - -// Create text input in place of a slider (when CTRL+Clicking on slider) -// FIXME: Logic is messy and confusing. -bool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - - // Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen) - // On the first frame, g.ScalarAsInputTextId == 0, then on subsequent frames it becomes == id - SetActiveID(g.ScalarAsInputTextId, window); - SetHoveredID(0); - FocusableItemUnregister(window); - - char buf[32]; - DataTypeFormatString(data_type, data_ptr, decimal_precision, buf, IM_ARRAYSIZE(buf)); - bool text_value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll); - if (g.ScalarAsInputTextId == 0) // First frame we started displaying the InputText widget - { - IM_ASSERT(g.ActiveId == id); // InputText ID expected to match the Slider ID (else we'd need to store them both, which is also possible) - g.ScalarAsInputTextId = g.ActiveId; - SetHoveredID(id); - } - if (text_value_changed) - return DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, NULL); - return false; -} - -// Parse display precision back from the display format string -int ImGui::ParseFormatPrecision(const char* fmt, int default_precision) -{ - int precision = default_precision; - while ((fmt = strchr(fmt, '%')) != NULL) - { - fmt++; - if (fmt[0] == '%') { fmt++; continue; } // Ignore "%%" - while (*fmt >= '0' && *fmt <= '9') - fmt++; - if (*fmt == '.') - { - fmt = ImAtoi(fmt + 1, &precision); - if (precision < 0 || precision > 10) - precision = default_precision; - } - if (*fmt == 'e' || *fmt == 'E') // Maximum precision with scientific notation - precision = -1; - break; - } - return precision; -} - -static float GetMinimumStepAtDecimalPrecision(int decimal_precision) -{ - static const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f }; - return (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : powf(10.0f, (float)-decimal_precision); -} - -float ImGui::RoundScalar(float value, int decimal_precision) -{ - // Round past decimal precision - // So when our value is 1.99999 with a precision of 0.001 we'll end up rounding to 2.0 - // FIXME: Investigate better rounding methods - if (decimal_precision < 0) - return value; - const float min_step = GetMinimumStepAtDecimalPrecision(decimal_precision); - bool negative = value < 0.0f; - value = fabsf(value); - float remainder = fmodf(value, min_step); - if (remainder <= min_step*0.5f) - value -= remainder; - else - value += (min_step - remainder); - return negative ? -value : value; -} - -static inline float SliderBehaviorCalcRatioFromValue(float v, float v_min, float v_max, float power, float linear_zero_pos) -{ - if (v_min == v_max) - return 0.0f; - - const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f); - const float v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min); - if (is_non_linear) - { - if (v_clamped < 0.0f) - { - const float f = 1.0f - (v_clamped - v_min) / (ImMin(0.0f,v_max) - v_min); - return (1.0f - powf(f, 1.0f/power)) * linear_zero_pos; - } - else - { - const float f = (v_clamped - ImMax(0.0f,v_min)) / (v_max - ImMax(0.0f,v_min)); - return linear_zero_pos + powf(f, 1.0f/power) * (1.0f - linear_zero_pos); - } - } - - // Linear slider - return (v_clamped - v_min) / (v_max - v_min); -} - -bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - const ImGuiStyle& style = g.Style; - - // Draw frame - RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); - - const bool is_non_linear = (power < 1.0f-0.00001f) || (power > 1.0f+0.00001f); - const bool is_horizontal = (flags & ImGuiSliderFlags_Vertical) == 0; - - const float grab_padding = 2.0f; - const float slider_sz = is_horizontal ? (frame_bb.GetWidth() - grab_padding * 2.0f) : (frame_bb.GetHeight() - grab_padding * 2.0f); - float grab_sz; - if (decimal_precision != 0) - grab_sz = ImMin(style.GrabMinSize, slider_sz); - else - grab_sz = ImMin(ImMax(1.0f * (slider_sz / ((v_min < v_max ? v_max - v_min : v_min - v_max) + 1.0f)), style.GrabMinSize), slider_sz); // Integer sliders, if possible have the grab size represent 1 unit - const float slider_usable_sz = slider_sz - grab_sz; - const float slider_usable_pos_min = (is_horizontal ? frame_bb.Min.x : frame_bb.Min.y) + grab_padding + grab_sz*0.5f; - const float slider_usable_pos_max = (is_horizontal ? frame_bb.Max.x : frame_bb.Max.y) - grab_padding - grab_sz*0.5f; - - // For logarithmic sliders that cross over sign boundary we want the exponential increase to be symmetric around 0.0f - float linear_zero_pos = 0.0f; // 0.0->1.0f - if (v_min * v_max < 0.0f) - { - // Different sign - const float linear_dist_min_to_0 = powf(fabsf(0.0f - v_min), 1.0f/power); - const float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0f), 1.0f/power); - linear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0+linear_dist_max_to_0); - } - else - { - // Same sign - linear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f; - } - - // Process clicking on the slider - bool value_changed = false; - if (g.ActiveId == id) - { - bool set_new_value = false; - float clicked_t = 0.0f; - if (g.IO.MouseDown[0]) - { - const float mouse_abs_pos = is_horizontal ? g.IO.MousePos.x : g.IO.MousePos.y; - clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f; - if (!is_horizontal) - clicked_t = 1.0f - clicked_t; - set_new_value = true; - } - else - { - ClearActiveID(); - } - - if (set_new_value) - { - float new_value; - if (is_non_linear) - { - // Account for logarithmic scale on both sides of the zero - if (clicked_t < linear_zero_pos) - { - // Negative: rescale to the negative range before powering - float a = 1.0f - (clicked_t / linear_zero_pos); - a = powf(a, power); - new_value = ImLerp(ImMin(v_max,0.0f), v_min, a); - } - else - { - // Positive: rescale to the positive range before powering - float a; - if (fabsf(linear_zero_pos - 1.0f) > 1.e-6f) - a = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos); - else - a = clicked_t; - a = powf(a, power); - new_value = ImLerp(ImMax(v_min,0.0f), v_max, a); - } - } - else - { - // Linear slider - new_value = ImLerp(v_min, v_max, clicked_t); - } - - // Round past decimal precision - new_value = RoundScalar(new_value, decimal_precision); - if (*v != new_value) - { - *v = new_value; - value_changed = true; - } - } - } - - // Draw - float grab_t = SliderBehaviorCalcRatioFromValue(*v, v_min, v_max, power, linear_zero_pos); - if (!is_horizontal) - grab_t = 1.0f - grab_t; - const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t); - ImRect grab_bb; - if (is_horizontal) - grab_bb = ImRect(ImVec2(grab_pos - grab_sz*0.5f, frame_bb.Min.y + grab_padding), ImVec2(grab_pos + grab_sz*0.5f, frame_bb.Max.y - grab_padding)); - else - grab_bb = ImRect(ImVec2(frame_bb.Min.x + grab_padding, grab_pos - grab_sz*0.5f), ImVec2(frame_bb.Max.x - grab_padding, grab_pos + grab_sz*0.5f)); - window->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding); - - return value_changed; -} - -// Use power!=1.0 for logarithmic sliders. -// Adjust display_format to decorate the value with a prefix or a suffix. -// "%.3f" 1.234 -// "%5.2f secs" 01.23 secs -// "Gold: %.0f" Gold: 1 -bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - const float w = CalcItemWidth(); - - const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); - const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); - - // NB- we don't call ItemSize() yet because we may turn into a text edit box below - if (!ItemAdd(total_bb, id)) - { - ItemSize(total_bb, style.FramePadding.y); - return false; - } - const bool hovered = ItemHoverable(frame_bb, id); - - if (!display_format) - display_format = "%.3f"; - int decimal_precision = ParseFormatPrecision(display_format, 3); - - // Tabbing or CTRL-clicking on Slider turns it into an input box - bool start_text_input = false; - const bool tab_focus_requested = FocusableItemRegister(window, id); - if (tab_focus_requested || (hovered && g.IO.MouseClicked[0])) - { - SetActiveID(id, window); - FocusWindow(window); - if (tab_focus_requested || g.IO.KeyCtrl) - { - start_text_input = true; - g.ScalarAsInputTextId = 0; - } - } - if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) - return InputScalarAsWidgetReplacement(frame_bb, label, ImGuiDataType_Float, v, id, decimal_precision); - - // Actual slider behavior + render grab - ItemSize(total_bb, style.FramePadding.y); - const bool value_changed = SliderBehavior(frame_bb, id, v, v_min, v_max, power, decimal_precision); - - // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. - char value_buf[64]; - const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); - RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f)); - - if (label_size.x > 0.0f) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - - return value_changed; -} - -bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - - const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); - const ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); - - ItemSize(bb, style.FramePadding.y); - if (!ItemAdd(frame_bb, id)) - return false; - const bool hovered = ItemHoverable(frame_bb, id); - - if (!display_format) - display_format = "%.3f"; - int decimal_precision = ParseFormatPrecision(display_format, 3); - - if (hovered && g.IO.MouseClicked[0]) - { - SetActiveID(id, window); - FocusWindow(window); - } - - // Actual slider behavior + render grab - bool value_changed = SliderBehavior(frame_bb, id, v, v_min, v_max, power, decimal_precision, ImGuiSliderFlags_Vertical); - - // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. - // For the vertical slider we allow centered text to overlap the frame padding - char value_buf[64]; - char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); - RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.0f)); - if (label_size.x > 0.0f) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - - return value_changed; -} - -bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max) -{ - float v_deg = (*v_rad) * 360.0f / (2*IM_PI); - bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, "%.0f deg", 1.0f); - *v_rad = v_deg * (2*IM_PI) / 360.0f; - return value_changed; -} - -bool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format) -{ - if (!display_format) - display_format = "%.0f"; - float v_f = (float)*v; - bool value_changed = SliderFloat(label, &v_f, (float)v_min, (float)v_max, display_format, 1.0f); - *v = (int)v_f; - return value_changed; -} - -bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format) -{ - if (!display_format) - display_format = "%.0f"; - float v_f = (float)*v; - bool value_changed = VSliderFloat(label, size, &v_f, (float)v_min, (float)v_max, display_format, 1.0f); - *v = (int)v_f; - return value_changed; -} - -// Add multiple sliders on 1 line for compact edition of multiple components -bool ImGui::SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - bool value_changed = false; - BeginGroup(); - PushID(label); - PushMultiItemsWidths(components); - for (int i = 0; i < components; i++) - { - PushID(i); - value_changed |= SliderFloat("##v", &v[i], v_min, v_max, display_format, power); - SameLine(0, g.Style.ItemInnerSpacing.x); - PopID(); - PopItemWidth(); - } - PopID(); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - - return value_changed; -} - -bool ImGui::SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format, float power) -{ - return SliderFloatN(label, v, 2, v_min, v_max, display_format, power); -} - -bool ImGui::SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format, float power) -{ - return SliderFloatN(label, v, 3, v_min, v_max, display_format, power); -} - -bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format, float power) -{ - return SliderFloatN(label, v, 4, v_min, v_max, display_format, power); -} - -bool ImGui::SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - bool value_changed = false; - BeginGroup(); - PushID(label); - PushMultiItemsWidths(components); - for (int i = 0; i < components; i++) - { - PushID(i); - value_changed |= SliderInt("##v", &v[i], v_min, v_max, display_format); - SameLine(0, g.Style.ItemInnerSpacing.x); - PopID(); - PopItemWidth(); - } - PopID(); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - - return value_changed; -} - -bool ImGui::SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format) -{ - return SliderIntN(label, v, 2, v_min, v_max, display_format); -} - -bool ImGui::SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format) -{ - return SliderIntN(label, v, 3, v_min, v_max, display_format); -} - -bool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format) -{ - return SliderIntN(label, v, 4, v_min, v_max, display_format); -} - -bool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power) -{ - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - // Draw frame - const ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg); - RenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding); - - bool value_changed = false; - - // Process clicking on the drag - if (g.ActiveId == id) - { - if (g.IO.MouseDown[0]) - { - if (g.ActiveIdIsJustActivated) - { - // Lock current value on click - g.DragCurrentValue = *v; - g.DragLastMouseDelta = ImVec2(0.f, 0.f); - } - - if (v_speed == 0.0f && (v_max - v_min) != 0.0f && (v_max - v_min) < FLT_MAX) - v_speed = (v_max - v_min) * g.DragSpeedDefaultRatio; - - float v_cur = g.DragCurrentValue; - const ImVec2 mouse_drag_delta = GetMouseDragDelta(0, 1.0f); - float adjust_delta = 0.0f; - //if (g.ActiveIdSource == ImGuiInputSource_Mouse) - { - adjust_delta = mouse_drag_delta.x - g.DragLastMouseDelta.x; - if (g.IO.KeyShift && g.DragSpeedScaleFast >= 0.0f) - adjust_delta *= g.DragSpeedScaleFast; - if (g.IO.KeyAlt && g.DragSpeedScaleSlow >= 0.0f) - adjust_delta *= g.DragSpeedScaleSlow; - } - adjust_delta *= v_speed; - g.DragLastMouseDelta.x = mouse_drag_delta.x; - - if (fabsf(adjust_delta) > 0.0f) - { - if (fabsf(power - 1.0f) > 0.001f) - { - // Logarithmic curve on both side of 0.0 - float v0_abs = v_cur >= 0.0f ? v_cur : -v_cur; - float v0_sign = v_cur >= 0.0f ? 1.0f : -1.0f; - float v1 = powf(v0_abs, 1.0f / power) + (adjust_delta * v0_sign); - float v1_abs = v1 >= 0.0f ? v1 : -v1; - float v1_sign = v1 >= 0.0f ? 1.0f : -1.0f; // Crossed sign line - v_cur = powf(v1_abs, power) * v0_sign * v1_sign; // Reapply sign - } - else - { - v_cur += adjust_delta; - } - - // Clamp - if (v_min < v_max) - v_cur = ImClamp(v_cur, v_min, v_max); - g.DragCurrentValue = v_cur; - } - - // Round to user desired precision, then apply - v_cur = RoundScalar(v_cur, decimal_precision); - if (*v != v_cur) - { - *v = v_cur; - value_changed = true; - } - } - else - { - ClearActiveID(); - } - } - - return value_changed; -} - -bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* display_format, float power) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - const float w = CalcItemWidth(); - - const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); - const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); - const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); - - // NB- we don't call ItemSize() yet because we may turn into a text edit box below - if (!ItemAdd(total_bb, id)) - { - ItemSize(total_bb, style.FramePadding.y); - return false; - } - const bool hovered = ItemHoverable(frame_bb, id); - - if (!display_format) - display_format = "%.3f"; - int decimal_precision = ParseFormatPrecision(display_format, 3); - - // Tabbing or CTRL-clicking on Drag turns it into an input box - bool start_text_input = false; - const bool tab_focus_requested = FocusableItemRegister(window, id); - if (tab_focus_requested || (hovered && (g.IO.MouseClicked[0] || g.IO.MouseDoubleClicked[0]))) - { - SetActiveID(id, window); - FocusWindow(window); - if (tab_focus_requested || g.IO.KeyCtrl || g.IO.MouseDoubleClicked[0]) - { - start_text_input = true; - g.ScalarAsInputTextId = 0; - } - } - if (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id)) - return InputScalarAsWidgetReplacement(frame_bb, label, ImGuiDataType_Float, v, id, decimal_precision); - - // Actual drag behavior - ItemSize(total_bb, style.FramePadding.y); - const bool value_changed = DragBehavior(frame_bb, id, v, v_speed, v_min, v_max, decimal_precision, power); - - // Display value using user-provided display format so user can add prefix/suffix/decorations to the value. - char value_buf[64]; - const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v); - RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f)); - - if (label_size.x > 0.0f) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); - - return value_changed; -} - -bool ImGui::DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - bool value_changed = false; - BeginGroup(); - PushID(label); - PushMultiItemsWidths(components); - for (int i = 0; i < components; i++) - { - PushID(i); - value_changed |= DragFloat("##v", &v[i], v_speed, v_min, v_max, display_format, power); - SameLine(0, g.Style.ItemInnerSpacing.x); - PopID(); - PopItemWidth(); - } - PopID(); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - - return value_changed; -} - -bool ImGui::DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* display_format, float power) -{ - return DragFloatN(label, v, 2, v_speed, v_min, v_max, display_format, power); -} - -bool ImGui::DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* display_format, float power) -{ - return DragFloatN(label, v, 3, v_speed, v_min, v_max, display_format, power); -} - -bool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* display_format, float power) -{ - return DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power); -} - -bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* display_format, const char* display_format_max, float power) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - PushID(label); - BeginGroup(); - PushMultiItemsWidths(2); - - bool value_changed = DragFloat("##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format, power); - PopItemWidth(); - SameLine(0, g.Style.ItemInnerSpacing.x); - value_changed |= DragFloat("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, display_format_max ? display_format_max : display_format, power); - PopItemWidth(); - SameLine(0, g.Style.ItemInnerSpacing.x); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - PopID(); - - return value_changed; -} - -// NB: v_speed is float to allow adjusting the drag speed with more precision -bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* display_format) -{ - if (!display_format) - display_format = "%.0f"; - float v_f = (float)*v; - bool value_changed = DragFloat(label, &v_f, v_speed, (float)v_min, (float)v_max, display_format); - *v = (int)v_f; - return value_changed; -} - -bool ImGui::DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - bool value_changed = false; - BeginGroup(); - PushID(label); - PushMultiItemsWidths(components); - for (int i = 0; i < components; i++) - { - PushID(i); - value_changed |= DragInt("##v", &v[i], v_speed, v_min, v_max, display_format); - SameLine(0, g.Style.ItemInnerSpacing.x); - PopID(); - PopItemWidth(); - } - PopID(); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - - return value_changed; -} - -bool ImGui::DragInt2(const char* label, int v[2], float v_speed, int v_min, int v_max, const char* display_format) -{ - return DragIntN(label, v, 2, v_speed, v_min, v_max, display_format); -} - -bool ImGui::DragInt3(const char* label, int v[3], float v_speed, int v_min, int v_max, const char* display_format) -{ - return DragIntN(label, v, 3, v_speed, v_min, v_max, display_format); -} - -bool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int v_max, const char* display_format) -{ - return DragIntN(label, v, 4, v_speed, v_min, v_max, display_format); -} - -bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* display_format, const char* display_format_max) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - PushID(label); - BeginGroup(); - PushMultiItemsWidths(2); - - bool value_changed = DragInt("##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format); - PopItemWidth(); - SameLine(0, g.Style.ItemInnerSpacing.x); - value_changed |= DragInt("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, display_format_max ? display_format_max : display_format); - PopItemWidth(); - SameLine(0, g.Style.ItemInnerSpacing.x); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - PopID(); - - return value_changed; -} - -void ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - const ImVec2 label_size = CalcTextSize(label, NULL, true); - if (graph_size.x == 0.0f) - graph_size.x = CalcItemWidth(); - if (graph_size.y == 0.0f) - graph_size.y = label_size.y + (style.FramePadding.y * 2); - - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(graph_size.x, graph_size.y)); - const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); - const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0)); - ItemSize(total_bb, style.FramePadding.y); - if (!ItemAdd(total_bb, 0)) - return; - const bool hovered = ItemHoverable(inner_bb, 0); - - // Determine scale from values if not specified - if (scale_min == FLT_MAX || scale_max == FLT_MAX) - { - float v_min = FLT_MAX; - float v_max = -FLT_MAX; - for (int i = 0; i < values_count; i++) - { - const float v = values_getter(data, i); - v_min = ImMin(v_min, v); - v_max = ImMax(v_max, v); - } - if (scale_min == FLT_MAX) - scale_min = v_min; - if (scale_max == FLT_MAX) - scale_max = v_max; - } - - RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); - - if (values_count > 0) - { - int res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); - int item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0); - - // Tooltip on hover - int v_hovered = -1; - if (hovered) - { - const float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f); - const int v_idx = (int)(t * item_count); - IM_ASSERT(v_idx >= 0 && v_idx < values_count); - - const float v0 = values_getter(data, (v_idx + values_offset) % values_count); - const float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count); - if (plot_type == ImGuiPlotType_Lines) - SetTooltip("%d: %8.4g\n%d: %8.4g", v_idx, v0, v_idx+1, v1); - else if (plot_type == ImGuiPlotType_Histogram) - SetTooltip("%d: %8.4g", v_idx, v0); - v_hovered = v_idx; - } - - const float t_step = 1.0f / (float)res_w; - - float v0 = values_getter(data, (0 + values_offset) % values_count); - float t0 = 0.0f; - ImVec2 tp0 = ImVec2( t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)) ); // Point in the normalized space of our target rectangle - float histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min / (scale_max - scale_min)) : (scale_min < 0.0f ? 0.0f : 1.0f); // Where does the zero line stands - - const ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram); - const ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered); - - for (int n = 0; n < res_w; n++) - { - const float t1 = t0 + t_step; - const int v1_idx = (int)(t0 * item_count + 0.5f); - IM_ASSERT(v1_idx >= 0 && v1_idx < values_count); - const float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count); - const ImVec2 tp1 = ImVec2( t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)) ); - - // NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU. - ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0); - ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t)); - if (plot_type == ImGuiPlotType_Lines) - { - window->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); - } - else if (plot_type == ImGuiPlotType_Histogram) - { - if (pos1.x >= pos0.x + 2.0f) - pos1.x -= 1.0f; - window->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base); - } - - t0 = t1; - tp0 = tp1; - } - } - - // Text overlay - if (overlay_text) - RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f,0.0f)); - - if (label_size.x > 0.0f) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label); -} - -struct ImGuiPlotArrayGetterData -{ - const float* Values; - int Stride; - - ImGuiPlotArrayGetterData(const float* values, int stride) { Values = values; Stride = stride; } -}; - -static float Plot_ArrayGetter(void* data, int idx) -{ - ImGuiPlotArrayGetterData* plot_data = (ImGuiPlotArrayGetterData*)data; - const float v = *(float*)(void*)((unsigned char*)plot_data->Values + (size_t)idx * plot_data->Stride); - return v; -} - -void ImGui::PlotLines(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride) -{ - ImGuiPlotArrayGetterData data(values, stride); - PlotEx(ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); -} - -void ImGui::PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) -{ - PlotEx(ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); -} - -void ImGui::PlotHistogram(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride) -{ - ImGuiPlotArrayGetterData data(values, stride); - PlotEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); -} - -void ImGui::PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size) -{ - PlotEx(ImGuiPlotType_Histogram, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size); -} - -// size_arg (for each axis) < 0.0f: align to end, 0.0f: auto, > 0.0f: specified size -void ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* overlay) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - ImVec2 pos = window->DC.CursorPos; - ImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y*2.0f)); - ItemSize(bb, style.FramePadding.y); - if (!ItemAdd(bb, 0)) - return; - - // Render - fraction = ImSaturate(fraction); - RenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); - bb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize)); - const ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y); - RenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding); - - // Default displaying the fraction as percentage string, but user can override it - char overlay_buf[32]; - if (!overlay) - { - ImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), "%.0f%%", fraction*100+0.01f); - overlay = overlay_buf; - } - - ImVec2 overlay_size = CalcTextSize(overlay, NULL); - if (overlay_size.x > 0.0f) - RenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f,0.5f), &bb); -} - -bool ImGui::Checkbox(const char* label, bool* v) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - const ImVec2 label_size = CalcTextSize(label, NULL, true); - - const ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y*2, label_size.y + style.FramePadding.y*2)); // We want a square shape to we use Y twice - ItemSize(check_bb, style.FramePadding.y); - - ImRect total_bb = check_bb; - if (label_size.x > 0) - SameLine(0, style.ItemInnerSpacing.x); - const ImRect text_bb(window->DC.CursorPos + ImVec2(0,style.FramePadding.y), window->DC.CursorPos + ImVec2(0,style.FramePadding.y) + label_size); - if (label_size.x > 0) - { - ItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y); - total_bb = ImRect(ImMin(check_bb.Min, text_bb.Min), ImMax(check_bb.Max, text_bb.Max)); - } - - if (!ItemAdd(total_bb, id)) - return false; - - bool hovered, held; - bool pressed = ButtonBehavior(total_bb, id, &hovered, &held); - if (pressed) - *v = !(*v); - - RenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding); - if (*v) - { - const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight()); - const float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f)); - RenderCheckMark(check_bb.Min + ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), check_bb.GetWidth() - pad*2.0f); - } - - if (g.LogEnabled) - LogRenderedText(&text_bb.Min, *v ? "[x]" : "[ ]"); - if (label_size.x > 0.0f) - RenderText(text_bb.Min, label); - - return pressed; -} - -bool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value) -{ - bool v = ((*flags & flags_value) == flags_value); - bool pressed = Checkbox(label, &v); - if (pressed) - { - if (v) - *flags |= flags_value; - else - *flags &= ~flags_value; - } - - return pressed; -} - -bool ImGui::RadioButton(const char* label, bool active) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - const ImVec2 label_size = CalcTextSize(label, NULL, true); - - const ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y*2-1, label_size.y + style.FramePadding.y*2-1)); - ItemSize(check_bb, style.FramePadding.y); - - ImRect total_bb = check_bb; - if (label_size.x > 0) - SameLine(0, style.ItemInnerSpacing.x); - const ImRect text_bb(window->DC.CursorPos + ImVec2(0, style.FramePadding.y), window->DC.CursorPos + ImVec2(0, style.FramePadding.y) + label_size); - if (label_size.x > 0) - { - ItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y); - total_bb.Add(text_bb); - } - - if (!ItemAdd(total_bb, id)) - return false; - - ImVec2 center = check_bb.GetCenter(); - center.x = (float)(int)center.x + 0.5f; - center.y = (float)(int)center.y + 0.5f; - const float radius = check_bb.GetHeight() * 0.5f; - - bool hovered, held; - bool pressed = ButtonBehavior(total_bb, id, &hovered, &held); - - window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16); - if (active) - { - const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight()); - const float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f)); - window->DrawList->AddCircleFilled(center, radius-pad, GetColorU32(ImGuiCol_CheckMark), 16); - } - - if (style.FrameBorderSize > 0.0f) - { - window->DrawList->AddCircle(center+ImVec2(1,1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize); - window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize); - } - - if (g.LogEnabled) - LogRenderedText(&text_bb.Min, active ? "(x)" : "( )"); - if (label_size.x > 0.0f) - RenderText(text_bb.Min, label); - - return pressed; -} - -bool ImGui::RadioButton(const char* label, int* v, int v_button) -{ - const bool pressed = RadioButton(label, *v == v_button); - if (pressed) - { - *v = v_button; - } - return pressed; -} - -static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end) -{ - int line_count = 0; - const char* s = text_begin; - while (char c = *s++) // We are only matching for \n so we can ignore UTF-8 decoding - if (c == '\n') - line_count++; - s--; - if (s[0] != '\n' && s[0] != '\r') - line_count++; - *out_text_end = s; - return line_count; -} - -static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) -{ - ImFont* font = GImGui->Font; - const float line_height = GImGui->FontSize; - const float scale = line_height / font->FontSize; - - ImVec2 text_size = ImVec2(0,0); - float line_width = 0.0f; - - const ImWchar* s = text_begin; - while (s < text_end) - { - unsigned int c = (unsigned int)(*s++); - if (c == '\n') - { - text_size.x = ImMax(text_size.x, line_width); - text_size.y += line_height; - line_width = 0.0f; - if (stop_on_new_line) - break; - continue; - } - if (c == '\r') - continue; - - const float char_width = font->GetCharAdvance((unsigned short)c) * scale; - line_width += char_width; - } - - if (text_size.x < line_width) - text_size.x = line_width; - - if (out_offset) - *out_offset = ImVec2(line_width, text_size.y + line_height); // offset allow for the possibility of sitting after a trailing \n - - if (line_width > 0 || text_size.y == 0.0f) // whereas size.y will ignore the trailing \n - text_size.y += line_height; - - if (remaining) - *remaining = s; - - return text_size; -} - -// Wrapper for stb_textedit.h to edit text (our wrapper is for: statically sized buffer, single-line, wchar characters. InputText converts between UTF-8 and wchar) -namespace ImGuiStb -{ - -static int STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING* obj) { return obj->CurLenW; } -static ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING* obj, int idx) { return obj->Text[idx]; } -static float STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING* obj, int line_start_idx, int char_idx) { ImWchar c = obj->Text[line_start_idx+char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; return GImGui->Font->GetCharAdvance(c) * (GImGui->FontSize / GImGui->Font->FontSize); } -static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x10000 ? 0 : key; } -static ImWchar STB_TEXTEDIT_NEWLINE = '\n'; -static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* obj, int line_start_idx) -{ - const ImWchar* text = obj->Text.Data; - const ImWchar* text_remaining = NULL; - const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true); - r->x0 = 0.0f; - r->x1 = size.x; - r->baseline_y_delta = size.y; - r->ymin = 0.0f; - r->ymax = size.y; - r->num_chars = (int)(text_remaining - (text + line_start_idx)); -} - -static bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|'; } -static int is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator( obj->Text[idx-1] ) && !is_separator( obj->Text[idx] ) ) : 1; } -static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } -#ifdef __APPLE__ // FIXME: Move setting to IO structure -static int is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator( obj->Text[idx-1] ) && is_separator( obj->Text[idx] ) ) : 1; } -static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } -#else -static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } -#endif -#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h -#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL - -static void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n) -{ - ImWchar* dst = obj->Text.Data + pos; - - // We maintain our buffer length in both UTF-8 and wchar formats - obj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n); - obj->CurLenW -= n; - - // Offset remaining text - const ImWchar* src = obj->Text.Data + pos + n; - while (ImWchar c = *src++) - *dst++ = c; - *dst = '\0'; -} - -static bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const ImWchar* new_text, int new_text_len) -{ - const int text_len = obj->CurLenW; - IM_ASSERT(pos <= text_len); - if (new_text_len + text_len + 1 > obj->Text.Size) - return false; - - const int new_text_len_utf8 = ImTextCountUtf8BytesFromStr(new_text, new_text + new_text_len); - if (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufSizeA) - return false; - - ImWchar* text = obj->Text.Data; - if (pos != text_len) - memmove(text + pos + new_text_len, text + pos, (size_t)(text_len - pos) * sizeof(ImWchar)); - memcpy(text + pos, new_text, (size_t)new_text_len * sizeof(ImWchar)); - - obj->CurLenW += new_text_len; - obj->CurLenA += new_text_len_utf8; - obj->Text[obj->CurLenW] = '\0'; - - return true; -} - -// We don't use an enum so we can build even with conflicting symbols (if another user of stb_textedit.h leak their STB_TEXTEDIT_K_* symbols) -#define STB_TEXTEDIT_K_LEFT 0x10000 // keyboard input to move cursor left -#define STB_TEXTEDIT_K_RIGHT 0x10001 // keyboard input to move cursor right -#define STB_TEXTEDIT_K_UP 0x10002 // keyboard input to move cursor up -#define STB_TEXTEDIT_K_DOWN 0x10003 // keyboard input to move cursor down -#define STB_TEXTEDIT_K_LINESTART 0x10004 // keyboard input to move cursor to start of line -#define STB_TEXTEDIT_K_LINEEND 0x10005 // keyboard input to move cursor to end of line -#define STB_TEXTEDIT_K_TEXTSTART 0x10006 // keyboard input to move cursor to start of text -#define STB_TEXTEDIT_K_TEXTEND 0x10007 // keyboard input to move cursor to end of text -#define STB_TEXTEDIT_K_DELETE 0x10008 // keyboard input to delete selection or character under cursor -#define STB_TEXTEDIT_K_BACKSPACE 0x10009 // keyboard input to delete selection or character left of cursor -#define STB_TEXTEDIT_K_UNDO 0x1000A // keyboard input to perform undo -#define STB_TEXTEDIT_K_REDO 0x1000B // keyboard input to perform redo -#define STB_TEXTEDIT_K_WORDLEFT 0x1000C // keyboard input to move cursor left one word -#define STB_TEXTEDIT_K_WORDRIGHT 0x1000D // keyboard input to move cursor right one word -#define STB_TEXTEDIT_K_SHIFT 0x20000 - -#define STB_TEXTEDIT_IMPLEMENTATION -#include "stb_textedit.h" - -} - -void ImGuiTextEditState::OnKeyPressed(int key) -{ - stb_textedit_key(this, &StbState, key); - CursorFollow = true; - CursorAnimReset(); -} - -// Public API to manipulate UTF-8 text -// We expose UTF-8 to the user (unlike the STB_TEXTEDIT_* functions which are manipulating wchar) -// FIXME: The existence of this rarely exercised code path is a bit of a nuisance. -void ImGuiTextEditCallbackData::DeleteChars(int pos, int bytes_count) -{ - IM_ASSERT(pos + bytes_count <= BufTextLen); - char* dst = Buf + pos; - const char* src = Buf + pos + bytes_count; - while (char c = *src++) - *dst++ = c; - *dst = '\0'; - - if (CursorPos + bytes_count >= pos) - CursorPos -= bytes_count; - else if (CursorPos >= pos) - CursorPos = pos; - SelectionStart = SelectionEnd = CursorPos; - BufDirty = true; - BufTextLen -= bytes_count; -} - -void ImGuiTextEditCallbackData::InsertChars(int pos, const char* new_text, const char* new_text_end) -{ - const int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text); - if (new_text_len + BufTextLen + 1 >= BufSize) - return; - - if (BufTextLen != pos) - memmove(Buf + pos + new_text_len, Buf + pos, (size_t)(BufTextLen - pos)); - memcpy(Buf + pos, new_text, (size_t)new_text_len * sizeof(char)); - Buf[BufTextLen + new_text_len] = '\0'; - - if (CursorPos >= pos) - CursorPos += new_text_len; - SelectionStart = SelectionEnd = CursorPos; - BufDirty = true; - BufTextLen += new_text_len; -} - -// Return false to discard a character. -static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data) -{ - unsigned int c = *p_char; - - if (c < 128 && c != ' ' && !isprint((int)(c & 0xFF))) - { - bool pass = false; - pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline)); - pass |= (c == '\t' && (flags & ImGuiInputTextFlags_AllowTabInput)); - if (!pass) - return false; - } - - if (c >= 0xE000 && c <= 0xF8FF) // Filter private Unicode range. I don't imagine anybody would want to input them. GLFW on OSX seems to send private characters for special keys like arrow keys. - return false; - - if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank)) - { - if (flags & ImGuiInputTextFlags_CharsDecimal) - if (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/')) - return false; - - if (flags & ImGuiInputTextFlags_CharsHexadecimal) - if (!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F')) - return false; - - if (flags & ImGuiInputTextFlags_CharsUppercase) - if (c >= 'a' && c <= 'z') - *p_char = (c += (unsigned int)('A'-'a')); - - if (flags & ImGuiInputTextFlags_CharsNoBlank) - if (ImCharIsSpace(c)) - return false; - } - - if (flags & ImGuiInputTextFlags_CallbackCharFilter) - { - ImGuiTextEditCallbackData callback_data; - memset(&callback_data, 0, sizeof(ImGuiTextEditCallbackData)); - callback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter; - callback_data.EventChar = (ImWchar)c; - callback_data.Flags = flags; - callback_data.UserData = user_data; - if (callback(&callback_data) != 0) - return false; - *p_char = callback_data.EventChar; - if (!callback_data.EventChar) - return false; - } - - return true; -} - -// Edit a string of text -// NB: when active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while active has no effect. -// FIXME: Rather messy function partly because we are doing UTF8 > u16 > UTF8 conversions on the go to more easily handle stb_textedit calls. Ideally we should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188 -bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys) - IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key) - - ImGuiContext& g = *GImGui; - const ImGuiIO& io = g.IO; - const ImGuiStyle& style = g.Style; - - const bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0; - const bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0; - const bool is_password = (flags & ImGuiInputTextFlags_Password) != 0; - - if (is_multiline) // Open group before calling GetID() because groups tracks id created during their spawn - BeginGroup(); - const ImGuiID id = window->GetID(label); - const ImVec2 label_size = CalcTextSize(label, NULL, true); - ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y*2.0f); // Arbitrary default of 8 lines high for multi-line - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); - const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f)); - - ImGuiWindow* draw_window = window; - if (is_multiline) - { - if (!BeginChildFrame(id, frame_bb.GetSize())) - { - EndChildFrame(); - EndGroup(); - return false; - } - draw_window = GetCurrentWindow(); - size.x -= draw_window->ScrollbarSizes.x; - } - else - { - ItemSize(total_bb, style.FramePadding.y); - if (!ItemAdd(total_bb, id)) - return false; - } - const bool hovered = ItemHoverable(frame_bb, id); - if (hovered) - g.MouseCursor = ImGuiMouseCursor_TextInput; - - // Password pushes a temporary font with only a fallback glyph - if (is_password) - { - const ImFontGlyph* glyph = g.Font->FindGlyph('*'); - ImFont* password_font = &g.InputTextPasswordFont; - password_font->FontSize = g.Font->FontSize; - password_font->Scale = g.Font->Scale; - password_font->DisplayOffset = g.Font->DisplayOffset; - password_font->Ascent = g.Font->Ascent; - password_font->Descent = g.Font->Descent; - password_font->ContainerAtlas = g.Font->ContainerAtlas; - password_font->FallbackGlyph = glyph; - password_font->FallbackAdvanceX = glyph->AdvanceX; - IM_ASSERT(password_font->Glyphs.empty() && password_font->IndexAdvanceX.empty() && password_font->IndexLookup.empty()); - PushFont(password_font); - } - - // NB: we are only allowed to access 'edit_state' if we are the active widget. - ImGuiTextEditState& edit_state = g.InputTextState; - - const bool focus_requested = FocusableItemRegister(window, id, (flags & (ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_AllowTabInput)) == 0); // Using completion callback disable keyboard tabbing - const bool focus_requested_by_code = focus_requested && (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent); - const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code; - - const bool user_clicked = hovered && io.MouseClicked[0]; - const bool user_scrolled = is_multiline && g.ActiveId == 0 && edit_state.Id == id && g.ActiveIdPreviousFrame == draw_window->GetIDNoKeepAlive("#SCROLLY"); - - bool clear_active_id = false; - - bool select_all = (g.ActiveId != id) && (flags & ImGuiInputTextFlags_AutoSelectAll) != 0; - if (focus_requested || user_clicked || user_scrolled) - { - if (g.ActiveId != id) - { - // Start edition - // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar) - // From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode) - const int prev_len_w = edit_state.CurLenW; - edit_state.Text.resize(buf_size+1); // wchar count <= UTF-8 count. we use +1 to make sure that .Data isn't NULL so it doesn't crash. - edit_state.InitialText.resize(buf_size+1); // UTF-8. we use +1 to make sure that .Data isn't NULL so it doesn't crash. - ImStrncpy(edit_state.InitialText.Data, buf, edit_state.InitialText.Size); - const char* buf_end = NULL; - edit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text.Data, edit_state.Text.Size, buf, NULL, &buf_end); - edit_state.CurLenA = (int)(buf_end - buf); // We can't get the result from ImFormatString() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. - edit_state.CursorAnimReset(); - - // Preserve cursor position and undo/redo stack if we come back to same widget - // FIXME: We should probably compare the whole buffer to be on the safety side. Comparing buf (utf8) and edit_state.Text (wchar). - const bool recycle_state = (edit_state.Id == id) && (prev_len_w == edit_state.CurLenW); - if (recycle_state) - { - // Recycle existing cursor/selection/undo stack but clamp position - // Note a single mouse click will override the cursor/position immediately by calling stb_textedit_click handler. - edit_state.CursorClamp(); - } - else - { - edit_state.Id = id; - edit_state.ScrollX = 0.0f; - stb_textedit_initialize_state(&edit_state.StbState, !is_multiline); - if (!is_multiline && focus_requested_by_code) - select_all = true; - } - if (flags & ImGuiInputTextFlags_AlwaysInsertMode) - edit_state.StbState.insert_mode = true; - if (!is_multiline && (focus_requested_by_tab || (user_clicked && io.KeyCtrl))) - select_all = true; - } - SetActiveID(id, window); - FocusWindow(window); - } - else if (io.MouseClicked[0]) - { - // Release focus when we click outside - clear_active_id = true; - } - - bool value_changed = false; - bool enter_pressed = false; - - if (g.ActiveId == id) - { - if (!is_editable && !g.ActiveIdIsJustActivated) - { - // When read-only we always use the live data passed to the function - edit_state.Text.resize(buf_size+1); - const char* buf_end = NULL; - edit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text.Data, edit_state.Text.Size, buf, NULL, &buf_end); - edit_state.CurLenA = (int)(buf_end - buf); - edit_state.CursorClamp(); - } - - edit_state.BufSizeA = buf_size; - - // Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget. - // Down the line we should have a cleaner library-wide concept of Selected vs Active. - g.ActiveIdAllowOverlap = !io.MouseDown[0]; - g.WantTextInputNextFrame = 1; - - // Edit in progress - const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX; - const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize*0.5f)); - - const bool osx_double_click_selects_words = io.OptMacOSXBehaviors; // OS X style: Double click selects by word instead of selecting whole text - if (select_all || (hovered && !osx_double_click_selects_words && io.MouseDoubleClicked[0])) - { - edit_state.SelectAll(); - edit_state.SelectedAllMouseLock = true; - } - else if (hovered && osx_double_click_selects_words && io.MouseDoubleClicked[0]) - { - // Select a word only, OS X style (by simulating keystrokes) - edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT); - edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT); - } - else if (io.MouseClicked[0] && !edit_state.SelectedAllMouseLock) - { - stb_textedit_click(&edit_state, &edit_state.StbState, mouse_x, mouse_y); - edit_state.CursorAnimReset(); - } - else if (io.MouseDown[0] && !edit_state.SelectedAllMouseLock && (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f)) - { - stb_textedit_drag(&edit_state, &edit_state.StbState, mouse_x, mouse_y); - edit_state.CursorAnimReset(); - edit_state.CursorFollow = true; - } - if (edit_state.SelectedAllMouseLock && !io.MouseDown[0]) - edit_state.SelectedAllMouseLock = false; - - if (io.InputCharacters[0]) - { - // Process text input (before we check for Return because using some IME will effectively send a Return?) - // We ignore CTRL inputs, but need to allow CTRL+ALT as some keyboards (e.g. German) use AltGR - which is Alt+Ctrl - to input certain characters. - if (!(io.KeyCtrl && !io.KeyAlt) && is_editable) - { - for (int n = 0; n < IM_ARRAYSIZE(io.InputCharacters) && io.InputCharacters[n]; n++) - if (unsigned int c = (unsigned int)io.InputCharacters[n]) - { - // Insert character if they pass filtering - if (!InputTextFilterCharacter(&c, flags, callback, user_data)) - continue; - edit_state.OnKeyPressed((int)c); - } - } - - // Consume characters - memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); - } - } - - bool cancel_edit = false; - if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id) - { - // Handle key-presses - const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0); - const bool is_shortcut_key_only = (io.OptMacOSXBehaviors ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl - const bool is_wordmove_key_down = io.OptMacOSXBehaviors ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl - const bool is_startend_key_down = io.OptMacOSXBehaviors && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End - - if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetWindowScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_DownArrow) && is_multiline) { if (io.KeyCtrl) SetWindowScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_Home)) { edit_state.OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_End)) { edit_state.OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_Delete) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_Backspace) && is_editable) - { - if (!edit_state.HasSelection()) - { - if (is_wordmove_key_down) edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT|STB_TEXTEDIT_K_SHIFT); - else if (io.OptMacOSXBehaviors && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART|STB_TEXTEDIT_K_SHIFT); - } - edit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask); - } - else if (IsKeyPressedMap(ImGuiKey_Enter)) - { - bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0; - if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl)) - { - enter_pressed = clear_active_id = true; - } - else if (is_editable) - { - unsigned int c = '\n'; // Insert new line - if (InputTextFilterCharacter(&c, flags, callback, user_data)) - edit_state.OnKeyPressed((int)c); - } - } - else if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressedMap(ImGuiKey_Tab) && !io.KeyCtrl && !io.KeyShift && !io.KeyAlt && is_editable) - { - unsigned int c = '\t'; // Insert TAB - if (InputTextFilterCharacter(&c, flags, callback, user_data)) - edit_state.OnKeyPressed((int)c); - } - else if (IsKeyPressedMap(ImGuiKey_Escape)) { clear_active_id = cancel_edit = true; } - else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_Z) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); edit_state.ClearSelection(); } - else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_Y) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); edit_state.ClearSelection(); } - else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); edit_state.CursorFollow = true; } - else if (is_shortcut_key_only && !is_password && ((IsKeyPressedMap(ImGuiKey_X) && is_editable) || IsKeyPressedMap(ImGuiKey_C)) && (!is_multiline || edit_state.HasSelection())) - { - // Cut, Copy - const bool cut = IsKeyPressedMap(ImGuiKey_X); - if (cut && !edit_state.HasSelection()) - edit_state.SelectAll(); - - if (io.SetClipboardTextFn) - { - const int ib = edit_state.HasSelection() ? ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end) : 0; - const int ie = edit_state.HasSelection() ? ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end) : edit_state.CurLenW; - edit_state.TempTextBuffer.resize((ie-ib) * 4 + 1); - ImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data+ib, edit_state.Text.Data+ie); - SetClipboardText(edit_state.TempTextBuffer.Data); - } - - if (cut) - { - edit_state.CursorFollow = true; - stb_textedit_cut(&edit_state, &edit_state.StbState); - } - } - else if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_V) && is_editable) - { - // Paste - if (const char* clipboard = GetClipboardText()) - { - // Filter pasted buffer - const int clipboard_len = (int)strlen(clipboard); - ImWchar* clipboard_filtered = (ImWchar*)ImGui::MemAlloc((clipboard_len+1) * sizeof(ImWchar)); - int clipboard_filtered_len = 0; - for (const char* s = clipboard; *s; ) - { - unsigned int c; - s += ImTextCharFromUtf8(&c, s, NULL); - if (c == 0) - break; - if (c >= 0x10000 || !InputTextFilterCharacter(&c, flags, callback, user_data)) - continue; - clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c; - } - clipboard_filtered[clipboard_filtered_len] = 0; - if (clipboard_filtered_len > 0) // If everything was filtered, ignore the pasting operation - { - stb_textedit_paste(&edit_state, &edit_state.StbState, clipboard_filtered, clipboard_filtered_len); - edit_state.CursorFollow = true; - } - ImGui::MemFree(clipboard_filtered); - } - } - } - - if (g.ActiveId == id) - { - if (cancel_edit) - { - // Restore initial value - if (is_editable) - { - ImStrncpy(buf, edit_state.InitialText.Data, buf_size); - value_changed = true; - } - } - - // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame. - // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage. - bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0); - if (apply_edit_back_to_user_buffer) - { - // Apply new value immediately - copy modified buffer back - // Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer - // FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect. - // FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks. - if (is_editable) - { - edit_state.TempTextBuffer.resize(edit_state.Text.Size * 4); - ImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data, NULL); - } - - // User callback - if ((flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory | ImGuiInputTextFlags_CallbackAlways)) != 0) - { - IM_ASSERT(callback != NULL); - - // The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment. - ImGuiInputTextFlags event_flag = 0; - ImGuiKey event_key = ImGuiKey_COUNT; - if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(ImGuiKey_Tab)) - { - event_flag = ImGuiInputTextFlags_CallbackCompletion; - event_key = ImGuiKey_Tab; - } - else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_UpArrow)) - { - event_flag = ImGuiInputTextFlags_CallbackHistory; - event_key = ImGuiKey_UpArrow; - } - else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_DownArrow)) - { - event_flag = ImGuiInputTextFlags_CallbackHistory; - event_key = ImGuiKey_DownArrow; - } - else if (flags & ImGuiInputTextFlags_CallbackAlways) - event_flag = ImGuiInputTextFlags_CallbackAlways; - - if (event_flag) - { - ImGuiTextEditCallbackData callback_data; - memset(&callback_data, 0, sizeof(ImGuiTextEditCallbackData)); - callback_data.EventFlag = event_flag; - callback_data.Flags = flags; - callback_data.UserData = user_data; - callback_data.ReadOnly = !is_editable; - - callback_data.EventKey = event_key; - callback_data.Buf = edit_state.TempTextBuffer.Data; - callback_data.BufTextLen = edit_state.CurLenA; - callback_data.BufSize = edit_state.BufSizeA; - callback_data.BufDirty = false; - - // We have to convert from wchar-positions to UTF-8-positions, which can be pretty slow (an incentive to ditch the ImWchar buffer, see https://github.com/nothings/stb/issues/188) - ImWchar* text = edit_state.Text.Data; - const int utf8_cursor_pos = callback_data.CursorPos = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.cursor); - const int utf8_selection_start = callback_data.SelectionStart = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.select_start); - const int utf8_selection_end = callback_data.SelectionEnd = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.select_end); - - // Call user code - callback(&callback_data); - - // Read back what user may have modified - IM_ASSERT(callback_data.Buf == edit_state.TempTextBuffer.Data); // Invalid to modify those fields - IM_ASSERT(callback_data.BufSize == edit_state.BufSizeA); - IM_ASSERT(callback_data.Flags == flags); - if (callback_data.CursorPos != utf8_cursor_pos) edit_state.StbState.cursor = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.CursorPos); - if (callback_data.SelectionStart != utf8_selection_start) edit_state.StbState.select_start = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionStart); - if (callback_data.SelectionEnd != utf8_selection_end) edit_state.StbState.select_end = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); - if (callback_data.BufDirty) - { - IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text! - edit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text.Data, edit_state.Text.Size, callback_data.Buf, NULL); - edit_state.CurLenA = callback_data.BufTextLen; // Assume correct length and valid UTF-8 from user, saves us an extra strlen() - edit_state.CursorAnimReset(); - } - } - } - - // Copy back to user buffer - if (is_editable && strcmp(edit_state.TempTextBuffer.Data, buf) != 0) - { - ImStrncpy(buf, edit_state.TempTextBuffer.Data, buf_size); - value_changed = true; - } - } - } - - // Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value) - if (clear_active_id && g.ActiveId == id) - ClearActiveID(); - - // Render - // Select which buffer we are going to display. When ImGuiInputTextFlags_NoLiveEdit is set 'buf' might still be the old value. We set buf to NULL to prevent accidental usage from now on. - const char* buf_display = (g.ActiveId == id && is_editable) ? edit_state.TempTextBuffer.Data : buf; buf = NULL; - - if (!is_multiline) - RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); - - const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size - ImVec2 render_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding; - ImVec2 text_size(0.f, 0.f); - const bool is_currently_scrolling = (edit_state.Id == id && is_multiline && g.ActiveId == draw_window->GetIDNoKeepAlive("#SCROLLY")); - if (g.ActiveId == id || is_currently_scrolling) - { - edit_state.CursorAnim += io.DeltaTime; - - // This is going to be messy. We need to: - // - Display the text (this alone can be more easily clipped) - // - Handle scrolling, highlight selection, display cursor (those all requires some form of 1d->2d cursor position calculation) - // - Measure text height (for scrollbar) - // We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort) - // FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8. - const ImWchar* text_begin = edit_state.Text.Data; - ImVec2 cursor_offset, select_start_offset; - - { - // Count lines + find lines numbers straddling 'cursor' and 'select_start' position. - const ImWchar* searches_input_ptr[2]; - searches_input_ptr[0] = text_begin + edit_state.StbState.cursor; - searches_input_ptr[1] = NULL; - int searches_remaining = 1; - int searches_result_line_number[2] = { -1, -999 }; - if (edit_state.StbState.select_start != edit_state.StbState.select_end) - { - searches_input_ptr[1] = text_begin + ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end); - searches_result_line_number[1] = -1; - searches_remaining++; - } - - // Iterate all lines to find our line numbers - // In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter. - searches_remaining += is_multiline ? 1 : 0; - int line_count = 0; - for (const ImWchar* s = text_begin; *s != 0; s++) - if (*s == '\n') - { - line_count++; - if (searches_result_line_number[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count; if (--searches_remaining <= 0) break; } - if (searches_result_line_number[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count; if (--searches_remaining <= 0) break; } - } - line_count++; - if (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count; - if (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count; - - // Calculate 2d position by finding the beginning of the line and measuring distance - cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x; - cursor_offset.y = searches_result_line_number[0] * g.FontSize; - if (searches_result_line_number[1] >= 0) - { - select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x; - select_start_offset.y = searches_result_line_number[1] * g.FontSize; - } - - // Store text height (note that we haven't calculated text width at all, see GitHub issues #383, #1224) - if (is_multiline) - text_size = ImVec2(size.x, line_count * g.FontSize); - } - - // Scroll - if (edit_state.CursorFollow) - { - // Horizontal scroll in chunks of quarter width - if (!(flags & ImGuiInputTextFlags_NoHorizontalScroll)) - { - const float scroll_increment_x = size.x * 0.25f; - if (cursor_offset.x < edit_state.ScrollX) - edit_state.ScrollX = (float)(int)ImMax(0.0f, cursor_offset.x - scroll_increment_x); - else if (cursor_offset.x - size.x >= edit_state.ScrollX) - edit_state.ScrollX = (float)(int)(cursor_offset.x - size.x + scroll_increment_x); - } - else - { - edit_state.ScrollX = 0.0f; - } - - // Vertical scroll - if (is_multiline) - { - float scroll_y = draw_window->Scroll.y; - if (cursor_offset.y - g.FontSize < scroll_y) - scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize); - else if (cursor_offset.y - size.y >= scroll_y) - scroll_y = cursor_offset.y - size.y; - draw_window->DC.CursorPos.y += (draw_window->Scroll.y - scroll_y); // To avoid a frame of lag - draw_window->Scroll.y = scroll_y; - render_pos.y = draw_window->DC.CursorPos.y; - } - } - edit_state.CursorFollow = false; - const ImVec2 render_scroll = ImVec2(edit_state.ScrollX, 0.0f); - - // Draw selection - if (edit_state.StbState.select_start != edit_state.StbState.select_end) - { - const ImWchar* text_selected_begin = text_begin + ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end); - const ImWchar* text_selected_end = text_begin + ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end); - - float bg_offy_up = is_multiline ? 0.0f : -1.0f; // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection. - float bg_offy_dn = is_multiline ? 0.0f : 2.0f; - ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg); - ImVec2 rect_pos = render_pos + select_start_offset - render_scroll; - for (const ImWchar* p = text_selected_begin; p < text_selected_end; ) - { - if (rect_pos.y > clip_rect.w + g.FontSize) - break; - if (rect_pos.y < clip_rect.y) - { - while (p < text_selected_end) - if (*p++ == '\n') - break; - } - else - { - ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); - if (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((unsigned short)' ') * 0.50f); // So we can see selected empty lines - ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos +ImVec2(rect_size.x, bg_offy_dn)); - rect.ClipWith(clip_rect); - if (rect.Overlaps(clip_rect)) - draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color); - } - rect_pos.x = render_pos.x - render_scroll.x; - rect_pos.y += g.FontSize; - } - } - - draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect); - - // Draw blinking cursor - bool cursor_is_visible = (!g.IO.OptCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || fmodf(g.InputTextState.CursorAnim, 1.20f) <= 0.80f; - ImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll; - ImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y-g.FontSize+0.5f, cursor_screen_pos.x+1.0f, cursor_screen_pos.y-1.5f); - if (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect)) - draw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text)); - - // Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.) - if (is_editable) - g.OsImePosRequest = ImVec2(cursor_screen_pos.x - 1, cursor_screen_pos.y - g.FontSize); - } - else - { - // Render text only - const char* buf_end = NULL; - if (is_multiline) - text_size = ImVec2(size.x, InputTextCalcTextLenAndLineCount(buf_display, &buf_end) * g.FontSize); // We don't need width - draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos, GetColorU32(ImGuiCol_Text), buf_display, buf_end, 0.0f, is_multiline ? NULL : &clip_rect); - } - - if (is_multiline) - { - Dummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line - EndChildFrame(); - EndGroup(); - } - - if (is_password) - PopFont(); - - // Log as text - if (g.LogEnabled && !is_password) - LogRenderedText(&render_pos, buf_display, NULL); - - if (label_size.x > 0) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - - if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0) - return enter_pressed; - else - return value_changed; -} - -bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data) -{ - IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline() - return InputTextEx(label, buf, (int)buf_size, ImVec2(0,0), flags, callback, user_data); -} - -bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data) -{ - return InputTextEx(label, buf, (int)buf_size, size, flags | ImGuiInputTextFlags_Multiline, callback, user_data); -} - -static inline float SmallSquareSize() -{ - ImGuiContext& g = *GImGui; - return g.FontSize + g.Style.FramePadding.y * 2.0f; -} - -// NB: scalar_format here must be a simple "%xx" format string with no prefix/suffix (unlike the Drag/Slider functions "display_format" argument) -bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImVec2 label_size = CalcTextSize(label, NULL, true); - - BeginGroup(); - PushID(label); - const ImVec2 button_sz = ImVec2(SmallSquareSize(), SmallSquareSize()); - if (step_ptr) - PushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_sz.x + style.ItemInnerSpacing.x)*2)); - - char buf[64]; - DataTypeFormatString(data_type, data_ptr, scalar_format, buf, IM_ARRAYSIZE(buf)); - - bool value_changed = false; - if (!(extra_flags & ImGuiInputTextFlags_CharsHexadecimal)) - extra_flags |= ImGuiInputTextFlags_CharsDecimal; - extra_flags |= ImGuiInputTextFlags_AutoSelectAll; - if (InputText("", buf, IM_ARRAYSIZE(buf), extra_flags)) // PushId(label) + "" gives us the expected ID from outside point of view - value_changed = DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, scalar_format); - - // Step buttons - if (step_ptr) - { - PopItemWidth(); - SameLine(0, style.ItemInnerSpacing.x); - if (ButtonEx("-", button_sz, ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups)) - { - DataTypeApplyOp(data_type, '-', data_ptr, g.IO.KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr); - value_changed = true; - } - SameLine(0, style.ItemInnerSpacing.x); - if (ButtonEx("+", button_sz, ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups)) - { - DataTypeApplyOp(data_type, '+', data_ptr, g.IO.KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr); - value_changed = true; - } - } - PopID(); - - if (label_size.x > 0) - { - SameLine(0, style.ItemInnerSpacing.x); - RenderText(ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + style.FramePadding.y), label); - ItemSize(label_size, style.FramePadding.y); - } - EndGroup(); - - return value_changed; -} - -bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags) -{ - char display_format[16]; - if (decimal_precision < 0) - strcpy(display_format, "%f"); // Ideally we'd have a minimum decimal precision of 1 to visually denote that this is a float, while hiding non-significant digits? %f doesn't have a minimum of 1 - else - ImFormatString(display_format, IM_ARRAYSIZE(display_format), "%%.%df", decimal_precision); - return InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), display_format, extra_flags); -} - -bool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags extra_flags) -{ - // Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes. - const char* scalar_format = (extra_flags & ImGuiInputTextFlags_CharsHexadecimal) ? "%08X" : "%d"; - return InputScalarEx(label, ImGuiDataType_Int, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), scalar_format, extra_flags); -} - -bool ImGui::InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - bool value_changed = false; - BeginGroup(); - PushID(label); - PushMultiItemsWidths(components); - for (int i = 0; i < components; i++) - { - PushID(i); - value_changed |= InputFloat("##v", &v[i], 0, 0, decimal_precision, extra_flags); - SameLine(0, g.Style.ItemInnerSpacing.x); - PopID(); - PopItemWidth(); - } - PopID(); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - - return value_changed; -} - -bool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags) -{ - return InputFloatN(label, v, 2, decimal_precision, extra_flags); -} - -bool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags) -{ - return InputFloatN(label, v, 3, decimal_precision, extra_flags); -} - -bool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags) -{ - return InputFloatN(label, v, 4, decimal_precision, extra_flags); -} - -bool ImGui::InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - bool value_changed = false; - BeginGroup(); - PushID(label); - PushMultiItemsWidths(components); - for (int i = 0; i < components; i++) - { - PushID(i); - value_changed |= InputInt("##v", &v[i], 0, 0, extra_flags); - SameLine(0, g.Style.ItemInnerSpacing.x); - PopID(); - PopItemWidth(); - } - PopID(); - - TextUnformatted(label, FindRenderedTextEnd(label)); - EndGroup(); - - return value_changed; -} - -bool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags) -{ - return InputIntN(label, v, 2, extra_flags); -} - -bool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags) -{ - return InputIntN(label, v, 3, extra_flags); -} - -bool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags) -{ - return InputIntN(label, v, 4, extra_flags); -} - -static bool Items_ArrayGetter(void* data, int idx, const char** out_text) -{ - const char* const* items = (const char* const*)data; - if (out_text) - *out_text = items[idx]; - return true; -} - -static bool Items_SingleStringGetter(void* data, int idx, const char** out_text) -{ - // FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited. - const char* items_separated_by_zeros = (const char*)data; - int items_count = 0; - const char* p = items_separated_by_zeros; - while (*p) - { - if (idx == items_count) - break; - p += strlen(p) + 1; - items_count++; - } - if (!*p) - return false; - if (out_text) - *out_text = p; - return true; -} - -// Combo box helper allowing to pass an array of strings. -bool ImGui::Combo(const char* label, int* current_item, const char* const* items, int items_count, int height_in_items) -{ - const bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items); - return value_changed; -} - -// Combo box helper allowing to pass all items in a single string. -bool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items) -{ - int items_count = 0; - const char* p = items_separated_by_zeros; // FIXME-OPT: Avoid computing this, or at least only when combo is open - while (*p) - { - p += strlen(p) + 1; - items_count++; - } - bool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items); - return value_changed; -} - -bool ImGui::BeginCombo(const char* label, const char* preview_value, ImVec2 popup_size) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - const float w = CalcItemWidth(); - - const ImVec2 label_size = CalcTextSize(label, NULL, true); - const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y*2.0f)); - const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); - ItemSize(total_bb, style.FramePadding.y); - if (!ItemAdd(total_bb, id)) - return false; - - const float arrow_size = SmallSquareSize(); - - bool hovered, held; - bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held); - - bool popup_open = IsPopupOpen(id); - - const ImRect value_bb(frame_bb.Min, frame_bb.Max - ImVec2(arrow_size, 0.0f)); - RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); - RenderFrame(ImVec2(frame_bb.Max.x-arrow_size, frame_bb.Min.y), frame_bb.Max, GetColorU32(popup_open || hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING - RenderTriangle(ImVec2(frame_bb.Max.x - arrow_size + style.FramePadding.y, frame_bb.Min.y + style.FramePadding.y), ImGuiDir_Down); - - if (preview_value != NULL) - RenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, preview_value, NULL, NULL, ImVec2(0.0f,0.0f)); - - if (label_size.x > 0) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - - if (pressed && !popup_open) - { - OpenPopupEx(id, false); - popup_open = true; - } - - if (!popup_open) - return false; - - if (popup_size.x == 0.0f) - popup_size.x = w; - - float popup_y1 = frame_bb.Max.y; - float popup_y2 = ImClamp(popup_y1 + popup_size.y, popup_y1, g.IO.DisplaySize.y - style.DisplaySafeAreaPadding.y); - if ((popup_y2 - popup_y1) < ImMin(popup_size.y, frame_bb.Min.y - style.DisplaySafeAreaPadding.y)) - { - // Position our combo ABOVE because there's more space to fit! (FIXME: Handle in Begin() or use a shared helper. We have similar code in Begin() for popup placement) - popup_y1 = ImClamp(frame_bb.Min.y - popup_size.y, style.DisplaySafeAreaPadding.y, frame_bb.Min.y); - popup_y2 = frame_bb.Min.y; - SetNextWindowPos(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FrameBorderSize), ImGuiCond_Always, ImVec2(0.0f, 1.0f)); - } - else - { - // Position our combo below - SetNextWindowPos(ImVec2(frame_bb.Min.x, frame_bb.Max.y - style.FrameBorderSize), ImGuiCond_Always, ImVec2(0.0f, 0.0f)); - } - SetNextWindowSize(ImVec2(popup_size.x, popup_y2 - popup_y1), ImGuiCond_Appearing); - PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding); - - if (!BeginPopupEx(id, ImGuiWindowFlags_ComboBox)) - { - IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above - return false; - } - Spacing(); - - return true; -} - -void ImGui::EndCombo() -{ - EndPopup(); - PopStyleVar(); -} - -// Combo box function. -bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items) -{ - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - const char* preview_text = NULL; - if (*current_item >= 0 && *current_item < items_count) - items_getter(data, *current_item, &preview_text); - - // Size default to hold ~7 items - if (height_in_items < 0) - height_in_items = 7; - float popup_height = (g.FontSize + style.ItemSpacing.y) * ImMin(items_count, height_in_items) + (style.FramePadding.y * 3); - - if (!BeginCombo(label, preview_text, ImVec2(0.0f, popup_height))) - return false; - - // Display items - // FIXME-OPT: Use clipper - bool value_changed = false; - for (int i = 0; i < items_count; i++) - { - PushID((void*)(intptr_t)i); - const bool item_selected = (i == *current_item); - const char* item_text; - if (!items_getter(data, i, &item_text)) - item_text = "*Unknown item*"; - if (Selectable(item_text, item_selected)) - { - value_changed = true; - *current_item = i; - } - if (item_selected && IsWindowAppearing()) - SetScrollHere(); - PopID(); - } - - EndCombo(); - return value_changed; -} - -// Tip: pass an empty label (e.g. "##dummy") then you can use the space to draw other text or image. -// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID. -bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - - if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsCount > 1) // FIXME-OPT: Avoid if vertically clipped. - PopClipRect(); - - ImGuiID id = window->GetID(label); - ImVec2 label_size = CalcTextSize(label, NULL, true); - ImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y); - ImVec2 pos = window->DC.CursorPos; - pos.y += window->DC.CurrentLineTextBaseOffset; - ImRect bb(pos, pos + size); - ItemSize(bb); - - // Fill horizontal space. - ImVec2 window_padding = window->WindowPadding; - float max_x = (flags & ImGuiSelectableFlags_SpanAllColumns) ? GetWindowContentRegionMax().x : GetContentRegionMax().x; - float w_draw = ImMax(label_size.x, window->Pos.x + max_x - window_padding.x - window->DC.CursorPos.x); - ImVec2 size_draw((size_arg.x != 0 && !(flags & ImGuiSelectableFlags_DrawFillAvailWidth)) ? size_arg.x : w_draw, size_arg.y != 0.0f ? size_arg.y : size.y); - ImRect bb_with_spacing(pos, pos + size_draw); - if (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth)) - bb_with_spacing.Max.x += window_padding.x; - - // Selectables are tightly packed together, we extend the box to cover spacing between selectable. - float spacing_L = (float)(int)(style.ItemSpacing.x * 0.5f); - float spacing_U = (float)(int)(style.ItemSpacing.y * 0.5f); - float spacing_R = style.ItemSpacing.x - spacing_L; - float spacing_D = style.ItemSpacing.y - spacing_U; - bb_with_spacing.Min.x -= spacing_L; - bb_with_spacing.Min.y -= spacing_U; - bb_with_spacing.Max.x += spacing_R; - bb_with_spacing.Max.y += spacing_D; - if (!ItemAdd(bb_with_spacing, id)) - { - if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsCount > 1) - PushColumnClipRect(); - return false; - } - - ImGuiButtonFlags button_flags = 0; - if (flags & ImGuiSelectableFlags_Menu) button_flags |= ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_NoHoldingActiveID; - if (flags & ImGuiSelectableFlags_MenuItem) button_flags |= ImGuiButtonFlags_PressedOnRelease; - if (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled; - if (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; - bool hovered, held; - bool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, button_flags); - if (flags & ImGuiSelectableFlags_Disabled) - selected = false; - - // Render - if (hovered || selected) - { - const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); - RenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, 0.0f); - } - - if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsCount > 1) - { - PushColumnClipRect(); - bb_with_spacing.Max.x -= (GetContentRegionMax().x - max_x); - } - - if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); - RenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size, ImVec2(0.0f,0.0f)); - if (flags & ImGuiSelectableFlags_Disabled) PopStyleColor(); - - // Automatically close popups - if (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(window->DC.ItemFlags & ImGuiItemFlags_SelectableDontClosePopup)) - CloseCurrentPopup(); - return pressed; -} - -bool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags, const ImVec2& size_arg) -{ - if (Selectable(label, *p_selected, flags, size_arg)) - { - *p_selected = !*p_selected; - return true; - } - return false; -} - -// Helper to calculate the size of a listbox and display a label on the right. -// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an empty label "##empty" -bool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - const ImGuiStyle& style = GetStyle(); - const ImGuiID id = GetID(label); - const ImVec2 label_size = CalcTextSize(label, NULL, true); - - // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar. - ImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y); - ImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y)); - ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size); - ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f)); - window->DC.LastItemRect = bb; - - BeginGroup(); - if (label_size.x > 0) - RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - - BeginChildFrame(id, frame_bb.GetSize()); - return true; -} - -bool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items) -{ - // Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar. - // However we don't add +0.40f if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size. - // I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution. - if (height_in_items < 0) - height_in_items = ImMin(items_count, 7); - float height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f); - - // We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild(). - ImVec2 size; - size.x = 0.0f; - size.y = GetTextLineHeightWithSpacing() * height_in_items_f + GetStyle().ItemSpacing.y; - return ListBoxHeader(label, size); -} - -void ImGui::ListBoxFooter() -{ - ImGuiWindow* parent_window = GetParentWindow(); - const ImRect bb = parent_window->DC.LastItemRect; - const ImGuiStyle& style = GetStyle(); - - EndChildFrame(); - - // Redeclare item size so that it includes the label (we have stored the full size in LastItemRect) - // We call SameLine() to restore DC.CurrentLine* data - SameLine(); - parent_window->DC.CursorPos = bb.Min; - ItemSize(bb, style.FramePadding.y); - EndGroup(); -} - -bool ImGui::ListBox(const char* label, int* current_item, const char* const* items, int items_count, int height_items) -{ - const bool value_changed = ListBox(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_items); - return value_changed; -} - -bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items) -{ - if (!ListBoxHeader(label, items_count, height_in_items)) - return false; - - // Assume all items have even height (= 1 line of text). If you need items of different or variable sizes you can create a custom version of ListBox() in your code without using the clipper. - bool value_changed = false; - ImGuiListClipper clipper(items_count, GetTextLineHeightWithSpacing()); // We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to. - while (clipper.Step()) - for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) - { - const bool item_selected = (i == *current_item); - const char* item_text; - if (!items_getter(data, i, &item_text)) - item_text = "*Unknown item*"; - - PushID(i); - if (Selectable(item_text, item_selected)) - { - *current_item = i; - value_changed = true; - } - PopID(); - } - ListBoxFooter(); - return value_changed; -} - -bool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, bool enabled) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - ImGuiStyle& style = g.Style; - ImVec2 pos = window->DC.CursorPos; - ImVec2 label_size = CalcTextSize(label, NULL, true); - - ImGuiSelectableFlags flags = ImGuiSelectableFlags_MenuItem | (enabled ? 0 : ImGuiSelectableFlags_Disabled); - bool pressed; - if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) - { - // Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful - // Note that in this situation we render neither the shortcut neither the selected tick mark - float w = label_size.x; - window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); - PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f); - pressed = Selectable(label, false, flags, ImVec2(w, 0.0f)); - PopStyleVar(); - window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). - } - else - { - ImVec2 shortcut_size = shortcut ? CalcTextSize(shortcut, NULL) : ImVec2(0.0f, 0.0f); - float w = window->MenuColumns.DeclColumns(label_size.x, shortcut_size.x, (float)(int)(g.FontSize * 1.20f)); // Feedback for next frame - float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w); - pressed = Selectable(label, false, flags | ImGuiSelectableFlags_DrawFillAvailWidth, ImVec2(w, 0.0f)); - if (shortcut_size.x > 0.0f) - { - PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); - RenderText(pos + ImVec2(window->MenuColumns.Pos[1] + extra_w, 0.0f), shortcut, NULL, false); - PopStyleColor(); - } - if (selected) - RenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f); - } - return pressed; -} - -bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled) -{ - if (MenuItem(label, shortcut, p_selected ? *p_selected : false, enabled)) - { - if (p_selected) - *p_selected = !*p_selected; - return true; - } - return false; -} - -bool ImGui::BeginMainMenuBar() -{ - ImGuiContext& g = *GImGui; - SetNextWindowPos(ImVec2(0.0f, 0.0f)); - SetNextWindowSize(ImVec2(g.IO.DisplaySize.x, g.FontBaseSize + g.Style.FramePadding.y * 2.0f)); - PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); - PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0,0)); - if (!Begin("##MainMenuBar", NULL, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_MenuBar) - || !BeginMenuBar()) - { - End(); - PopStyleVar(2); - return false; - } - g.CurrentWindow->DC.MenuBarOffsetX += g.Style.DisplaySafeAreaPadding.x; - return true; -} - -void ImGui::EndMainMenuBar() -{ - EndMenuBar(); - End(); - PopStyleVar(2); -} - -bool ImGui::BeginMenuBar() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - if (!(window->Flags & ImGuiWindowFlags_MenuBar)) - return false; - - IM_ASSERT(!window->DC.MenuBarAppending); - BeginGroup(); // Save position - PushID("##menubar"); - - // We don't clip with regular window clipping rectangle as it is already set to the area below. However we clip with window full rect. - // We remove 1 worth of rounding to Max.x to that text in long menus don't tend to display over the lower-right rounded area, which looks particularly glitchy. - ImRect bar_rect = window->MenuBarRect(); - ImRect clip_rect(ImFloor(bar_rect.Min.x + 0.5f), ImFloor(bar_rect.Min.y + window->WindowBorderSize + 0.5f), ImFloor(ImMax(bar_rect.Min.x, bar_rect.Max.x - window->WindowRounding) + 0.5f), ImFloor(bar_rect.Max.y + 0.5f)); - clip_rect.ClipWith(window->Rect()); - PushClipRect(clip_rect.Min, clip_rect.Max, false); - - window->DC.CursorPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffsetX, bar_rect.Min.y);// + g.Style.FramePadding.y); - window->DC.LayoutType = ImGuiLayoutType_Horizontal; - window->DC.MenuBarAppending = true; - AlignTextToFramePadding(); - return true; -} - -void ImGui::EndMenuBar() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - IM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar); - IM_ASSERT(window->DC.MenuBarAppending); - PopClipRect(); - PopID(); - window->DC.MenuBarOffsetX = window->DC.CursorPos.x - window->MenuBarRect().Min.x; - window->DC.GroupStack.back().AdvanceCursor = false; - EndGroup(); - window->DC.LayoutType = ImGuiLayoutType_Vertical; - window->DC.MenuBarAppending = false; -} - -bool ImGui::BeginMenu(const char* label, bool enabled) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const ImGuiID id = window->GetID(label); - - ImVec2 label_size = CalcTextSize(label, NULL, true); - - bool pressed; - bool menu_is_open = IsPopupOpen(id); - bool menuset_is_open = !(window->Flags & ImGuiWindowFlags_Popup) && (g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].ParentMenuSet == window->GetID("##menus")); - ImGuiWindow* backed_nav_window = g.NavWindow; - if (menuset_is_open) - g.NavWindow = window; // Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent) - - // The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu (using FindBestPopupWindowPos). - ImVec2 popup_pos, pos = window->DC.CursorPos; - if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) - { - // Menu inside an horizontal menu bar - // Selectable extend their highlight by half ItemSpacing in each direction. - // For ChildMenu, the popup position will be overwritten by the call to FindBestPopupWindowPos() in Begin() - popup_pos = ImVec2(pos.x - window->WindowPadding.x, pos.y - style.FramePadding.y + window->MenuBarHeight()); - window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); - PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f); - float w = label_size.x; - pressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f)); - PopStyleVar(); - window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). - } - else - { - // Menu inside a menu - popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y); - float w = window->MenuColumns.DeclColumns(label_size.x, 0.0f, (float)(int)(g.FontSize * 1.20f)); // Feedback to next frame - float extra_w = ImMax(0.0f, GetContentRegionAvail().x - w); - pressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f)); - if (!enabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); - RenderTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.30f, 0.0f), ImGuiDir_Right); - if (!enabled) PopStyleColor(); - } - - const bool hovered = enabled && ItemHoverable(window->DC.LastItemRect, id); - if (menuset_is_open) - g.NavWindow = backed_nav_window; - - bool want_open = false, want_close = false; - if (window->DC.LayoutType != ImGuiLayoutType_Horizontal) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) - { - // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive. - bool moving_within_opened_triangle = false; - if (g.HoveredWindow == window && g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].ParentWindow == window) - { - if (ImGuiWindow* next_window = g.OpenPopupStack[g.CurrentPopupStack.Size].Window) - { - ImRect next_window_rect = next_window->Rect(); - ImVec2 ta = g.IO.MousePos - g.IO.MouseDelta; - ImVec2 tb = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR(); - ImVec2 tc = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR(); - float extra = ImClamp(fabsf(ta.x - tb.x) * 0.30f, 5.0f, 30.0f); // add a bit of extra slack. - ta.x += (window->Pos.x < next_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues - tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale? - tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f); - moving_within_opened_triangle = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos); - //window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); window->DrawList->PopClipRect(); // Debug - } - } - - want_close = (menu_is_open && !hovered && g.HoveredWindow == window && g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrame != id && !moving_within_opened_triangle); - want_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed); - } - else - { - // Menu bar - if (menu_is_open && pressed && menuset_is_open) // Click an open menu again to close it - { - want_close = true; - want_open = menu_is_open = false; - } - else if (pressed || (hovered && menuset_is_open && !menu_is_open)) // First click to open, then hover to open others - { - want_open = true; - } - } - - if (!enabled) // explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu("options", has_object)) { ..use object.. }' - want_close = true; - if (want_close && IsPopupOpen(id)) - ClosePopupToLevel(GImGui->CurrentPopupStack.Size); - - if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.CurrentPopupStack.Size) - { - // Don't recycle same menu level in the same frame, first close the other menu and yield for a frame. - OpenPopup(label); - return false; - } - - menu_is_open |= want_open; - if (want_open) - OpenPopup(label); - - if (menu_is_open) - { - SetNextWindowPos(popup_pos, ImGuiCond_Always); - ImGuiWindowFlags flags = ImGuiWindowFlags_AlwaysAutoResize | ((window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu)) ? ImGuiWindowFlags_ChildMenu|ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu); - menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) - } - - return menu_is_open; -} - -void ImGui::EndMenu() -{ - EndPopup(); -} - -// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. -void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags) -{ - ImGuiContext& g = *GImGui; - - int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]); - BeginTooltipEx(0, true); - - const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text; - if (text_end > text) - { - TextUnformatted(text, text_end); - Separator(); - } - - ImVec2 sz(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2); - ColorButton("##preview", ImVec4(col[0], col[1], col[2], col[3]), (flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)) | ImGuiColorEditFlags_NoTooltip, sz); - SameLine(); - if (flags & ImGuiColorEditFlags_NoAlpha) - Text("#%02X%02X%02X\nR: %d, G: %d, B: %d\n(%.3f, %.3f, %.3f)", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]); - else - Text("#%02X%02X%02X%02X\nR:%d, G:%d, B:%d, A:%d\n(%.3f, %.3f, %.3f, %.3f)", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]); - EndTooltip(); -} - -static inline ImU32 ImAlphaBlendColor(ImU32 col_a, ImU32 col_b) -{ - float t = ((col_b >> IM_COL32_A_SHIFT) & 0xFF) / 255.f; - int r = ImLerp((int)(col_a >> IM_COL32_R_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_R_SHIFT) & 0xFF, t); - int g = ImLerp((int)(col_a >> IM_COL32_G_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_G_SHIFT) & 0xFF, t); - int b = ImLerp((int)(col_a >> IM_COL32_B_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_B_SHIFT) & 0xFF, t); - return IM_COL32(r, g, b, 0xFF); -} - -// NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that. -// I spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding alltogether. -void ImGui::RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 col, float grid_step, ImVec2 grid_off, float rounding, int rounding_corners_flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (((col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT) < 0xFF) - { - ImU32 col_bg1 = GetColorU32(ImAlphaBlendColor(IM_COL32(204,204,204,255), col)); - ImU32 col_bg2 = GetColorU32(ImAlphaBlendColor(IM_COL32(128,128,128,255), col)); - window->DrawList->AddRectFilled(p_min, p_max, col_bg1, rounding, rounding_corners_flags); - - int yi = 0; - for (float y = p_min.y + grid_off.y; y < p_max.y; y += grid_step, yi++) - { - float y1 = ImClamp(y, p_min.y, p_max.y), y2 = ImMin(y + grid_step, p_max.y); - if (y2 <= y1) - continue; - for (float x = p_min.x + grid_off.x + (yi & 1) * grid_step; x < p_max.x; x += grid_step * 2.0f) - { - float x1 = ImClamp(x, p_min.x, p_max.x), x2 = ImMin(x + grid_step, p_max.x); - if (x2 <= x1) - continue; - int rounding_corners_flags_cell = 0; - if (y1 <= p_min.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopRight; } - if (y2 >= p_max.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotRight; } - rounding_corners_flags_cell &= rounding_corners_flags; - window->DrawList->AddRectFilled(ImVec2(x1,y1), ImVec2(x2,y2), col_bg2, rounding_corners_flags_cell ? rounding : 0.0f, rounding_corners_flags_cell); - } - } - } - else - { - window->DrawList->AddRectFilled(p_min, p_max, col, rounding, rounding_corners_flags); - } -} - -void ImGui::SetColorEditOptions(ImGuiColorEditFlags flags) -{ - ImGuiContext& g = *GImGui; - if ((flags & ImGuiColorEditFlags__InputsMask) == 0) - flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__InputsMask; - if ((flags & ImGuiColorEditFlags__DataTypeMask) == 0) - flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__DataTypeMask; - if ((flags & ImGuiColorEditFlags__PickerMask) == 0) - flags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__PickerMask; - IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__InputsMask))); // Check only 1 option is selected - IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__DataTypeMask))); // Check only 1 option is selected - IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask))); // Check only 1 option is selected - g.ColorEditOptions = flags; -} - -// A little colored square. Return true when clicked. -// FIXME: May want to display/ignore the alpha component in the color display? Yet show it in the tooltip. -// 'desc_id' is not called 'label' because we don't display it next to the button, but only in the tooltip. -bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags, ImVec2 size) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiID id = window->GetID(desc_id); - float default_size = SmallSquareSize(); - if (size.x == 0.0f) - size.x = default_size; - if (size.y == 0.0f) - size.y = default_size; - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); - ItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f); - if (!ItemAdd(bb, id)) - return false; - - bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held); - - if (flags & ImGuiColorEditFlags_NoAlpha) - flags &= ~(ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf); - - ImVec4 col_without_alpha(col.x, col.y, col.z, 1.0f); - float grid_step = ImMin(size.x, size.y) / 2.99f; - float rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5f); - ImRect bb_inner = bb; - float off = -0.75f; // The border (using Col_FrameBg) tends to look off when color is near-opaque and rounding is enabled. This offset seemed like a good middle ground to reduce those artifacts. - bb_inner.Expand(off); - if ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col.w < 1.0f) - { - float mid_x = (float)(int)((bb_inner.Min.x + bb_inner.Max.x) * 0.5f + 0.5f); - RenderColorRectWithAlphaCheckerboard(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col), grid_step, ImVec2(-grid_step + off, off), rounding, ImDrawCornerFlags_TopRight| ImDrawCornerFlags_BotRight); - window->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_without_alpha), rounding, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotLeft); - } - else - { - // Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha - ImVec4 col_source = (flags & ImGuiColorEditFlags_AlphaPreview) ? col : col_without_alpha; - if (col_source.w < 1.0f) - RenderColorRectWithAlphaCheckerboard(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding); - else - window->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding, ImDrawCornerFlags_All); - } - if (g.Style.FrameBorderSize > 0.0f) - RenderFrameBorder(bb.Min, bb.Max, rounding); - else - window->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border - - if (hovered && !(flags & ImGuiColorEditFlags_NoTooltip)) - ColorTooltip(desc_id, &col.x, flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)); - - return pressed; -} - -bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags) -{ - return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha); -} - -void ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags) -{ - bool allow_opt_inputs = !(flags & ImGuiColorEditFlags__InputsMask); - bool allow_opt_datatype = !(flags & ImGuiColorEditFlags__DataTypeMask); - if ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup("context")) - return; - ImGuiContext& g = *GImGui; - ImGuiColorEditFlags opts = g.ColorEditOptions; - if (allow_opt_inputs) - { - if (RadioButton("RGB", (opts & ImGuiColorEditFlags_RGB) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_RGB; - if (RadioButton("HSV", (opts & ImGuiColorEditFlags_HSV) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HSV; - if (RadioButton("HEX", (opts & ImGuiColorEditFlags_HEX) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HEX; - } - if (allow_opt_datatype) - { - if (allow_opt_inputs) Separator(); - if (RadioButton("0..255", (opts & ImGuiColorEditFlags_Uint8) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Uint8; - if (RadioButton("0.00..1.00", (opts & ImGuiColorEditFlags_Float) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Float; - } - - if (allow_opt_inputs || allow_opt_datatype) - Separator(); - if (Button("Copy as..", ImVec2(-1,0))) - OpenPopup("Copy"); - if (BeginPopup("Copy")) - { - int cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]); - char buf[64]; - ImFormatString(buf, IM_ARRAYSIZE(buf), "(%.3ff, %.3ff, %.3ff, %.3ff)", col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]); - if (Selectable(buf)) - SetClipboardText(buf); - ImFormatString(buf, IM_ARRAYSIZE(buf), "(%d,%d,%d,%d)", cr, cg, cb, ca); - if (Selectable(buf)) - SetClipboardText(buf); - if (flags & ImGuiColorEditFlags_NoAlpha) - ImFormatString(buf, IM_ARRAYSIZE(buf), "0x%02X%02X%02X", cr, cg, cb); - else - ImFormatString(buf, IM_ARRAYSIZE(buf), "0x%02X%02X%02X%02X", cr, cg, cb, ca); - if (Selectable(buf)) - SetClipboardText(buf); - EndPopup(); - } - - g.ColorEditOptions = opts; - EndPopup(); -} - -static void ColorPickerOptionsPopup(ImGuiColorEditFlags flags, float* ref_col) -{ - bool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask); - bool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar); - if ((!allow_opt_picker && !allow_opt_alpha_bar) || !ImGui::BeginPopup("context")) - return; - ImGuiContext& g = *GImGui; - if (allow_opt_picker) - { - ImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (SmallSquareSize() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function - ImGui::PushItemWidth(picker_size.x); - for (int picker_type = 0; picker_type < 2; picker_type++) - { - // Draw small/thumbnail version of each picker type (over an invisible button for selection) - if (picker_type > 0) ImGui::Separator(); - ImGui::PushID(picker_type); - ImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs|ImGuiColorEditFlags_NoOptions|ImGuiColorEditFlags_NoLabel|ImGuiColorEditFlags_NoSidePreview|(flags & ImGuiColorEditFlags_NoAlpha); - if (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar; - if (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel; - ImVec2 backup_pos = ImGui::GetCursorScreenPos(); - if (ImGui::Selectable("##selectable", false, 0, picker_size)) // By default, Selectable() is closing popup - g.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask); - ImGui::SetCursorScreenPos(backup_pos); - ImVec4 dummy_ref_col; - memcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (picker_flags & ImGuiColorEditFlags_NoAlpha ? 3 : 4)); - ImGui::ColorPicker4("##dummypicker", &dummy_ref_col.x, picker_flags); - ImGui::PopID(); - } - ImGui::PopItemWidth(); - } - if (allow_opt_alpha_bar) - { - if (allow_opt_picker) ImGui::Separator(); - ImGui::CheckboxFlags("Alpha Bar", (unsigned int*)&g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar); - } - ImGui::EndPopup(); -} - -// Edit colors components (each component in 0.0f..1.0f range). -// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. -// With typical options: Left-click on colored square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item. -bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext& g = *GImGui; - const ImGuiStyle& style = g.Style; - const float square_sz = SmallSquareSize(); - const float w_extra = (flags & ImGuiColorEditFlags_NoSmallPreview) ? 0.0f : (square_sz + style.ItemInnerSpacing.x); - const float w_items_all = CalcItemWidth() - w_extra; - const char* label_display_end = FindRenderedTextEnd(label); - - const bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0; - const bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0; - const int components = alpha ? 4 : 3; - const ImGuiColorEditFlags flags_untouched = flags; - - BeginGroup(); - PushID(label); - - // If we're not showing any slider there's no point in doing any HSV conversions - if (flags & ImGuiColorEditFlags_NoInputs) - flags = (flags & (~ImGuiColorEditFlags__InputsMask)) | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_NoOptions; - - // Context menu: display and modify options (before defaults are applied) - if (!(flags & ImGuiColorEditFlags_NoOptions)) - ColorEditOptionsPopup(col, flags); - - // Read stored options - if (!(flags & ImGuiColorEditFlags__InputsMask)) - flags |= (g.ColorEditOptions & ImGuiColorEditFlags__InputsMask); - if (!(flags & ImGuiColorEditFlags__DataTypeMask)) - flags |= (g.ColorEditOptions & ImGuiColorEditFlags__DataTypeMask); - if (!(flags & ImGuiColorEditFlags__PickerMask)) - flags |= (g.ColorEditOptions & ImGuiColorEditFlags__PickerMask); - flags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask)); - - // Convert to the formats we need - float f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f }; - if (flags & ImGuiColorEditFlags_HSV) - ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); - int i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) }; - - bool value_changed = false; - bool value_changed_as_float = false; - - if ((flags & (ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) - { - // RGB/HSV 0..255 Sliders - const float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components-1)) / (float)components)); - const float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.ItemInnerSpacing.x) * (components-1))); - - const bool hide_prefix = (w_item_one <= CalcTextSize((flags & ImGuiColorEditFlags_Float) ? "M:0.000" : "M:000").x); - const char* ids[4] = { "##X", "##Y", "##Z", "##W" }; - const char* fmt_table_int[3][4] = - { - { "%3.0f", "%3.0f", "%3.0f", "%3.0f" }, // Short display - { "R:%3.0f", "G:%3.0f", "B:%3.0f", "A:%3.0f" }, // Long display for RGBA - { "H:%3.0f", "S:%3.0f", "V:%3.0f", "A:%3.0f" } // Long display for HSVA - }; - const char* fmt_table_float[3][4] = - { - { "%0.3f", "%0.3f", "%0.3f", "%0.3f" }, // Short display - { "R:%0.3f", "G:%0.3f", "B:%0.3f", "A:%0.3f" }, // Long display for RGBA - { "H:%0.3f", "S:%0.3f", "V:%0.3f", "A:%0.3f" } // Long display for HSVA - }; - const int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_HSV) ? 2 : 1; - - PushItemWidth(w_item_one); - for (int n = 0; n < components; n++) - { - if (n > 0) - SameLine(0, style.ItemInnerSpacing.x); - if (n + 1 == components) - PushItemWidth(w_item_last); - if (flags & ImGuiColorEditFlags_Float) - value_changed = value_changed_as_float = value_changed | DragFloat(ids[n], &f[n], 1.0f/255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]); - else - value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]); - if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); - } - PopItemWidth(); - PopItemWidth(); - } - else if ((flags & ImGuiColorEditFlags_HEX) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) - { - // RGB Hexadecimal Input - char buf[64]; - if (alpha) - ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255), ImClamp(i[3],0,255)); - else - ImFormatString(buf, IM_ARRAYSIZE(buf), "#%02X%02X%02X", ImClamp(i[0],0,255), ImClamp(i[1],0,255), ImClamp(i[2],0,255)); - PushItemWidth(w_items_all); - if (InputText("##Text", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase)) - { - value_changed = true; - char* p = buf; - while (*p == '#' || ImCharIsSpace(*p)) - p++; - i[0] = i[1] = i[2] = i[3] = 0; - if (alpha) - sscanf(p, "%02X%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned) - else - sscanf(p, "%02X%02X%02X", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]); - } - if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); - PopItemWidth(); - } - - bool picker_active = false; - if (!(flags & ImGuiColorEditFlags_NoSmallPreview)) - { - if (!(flags & ImGuiColorEditFlags_NoInputs)) - SameLine(0, style.ItemInnerSpacing.x); - - const ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f); - if (ColorButton("##ColorButton", col_v4, flags)) - { - if (!(flags & ImGuiColorEditFlags_NoPicker)) - { - // Store current color and open a picker - g.ColorPickerRef = col_v4; - OpenPopup("picker"); - SetNextWindowPos(window->DC.LastItemRect.GetBL() + ImVec2(-1,style.ItemSpacing.y)); - } - } - if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); - - if (BeginPopup("picker")) - { - picker_active = true; - if (label != label_display_end) - { - TextUnformatted(label, label_display_end); - Separator(); - } - ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar; - ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf; - PushItemWidth(square_sz * 12.0f); // Use 256 + bar sizes? - value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x); - PopItemWidth(); - EndPopup(); - } - } - - if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel)) - { - SameLine(0, style.ItemInnerSpacing.x); - TextUnformatted(label, label_display_end); - } - - // Convert back - if (!picker_active) - { - if (!value_changed_as_float) - for (int n = 0; n < 4; n++) - f[n] = i[n] / 255.0f; - if (flags & ImGuiColorEditFlags_HSV) - ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]); - if (value_changed) - { - col[0] = f[0]; - col[1] = f[1]; - col[2] = f[2]; - if (alpha) - col[3] = f[3]; - } - } - - PopID(); - EndGroup(); - - return value_changed; -} - -bool ImGui::ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags) -{ - float col4[4] = { col[0], col[1], col[2], 1.0f }; - if (!ColorPicker4(label, col4, flags | ImGuiColorEditFlags_NoAlpha)) - return false; - col[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2]; - return true; -} - -// 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side. -static void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col) -{ - switch (direction) - { - case ImGuiDir_Left: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return; - case ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return; - case ImGuiDir_Up: draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return; - case ImGuiDir_Down: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return; - default: return; // Fix warning for ImGuiDir_None - } -} - -static void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w) -{ - RenderArrow(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32_BLACK); - RenderArrow(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir_Right, IM_COL32_WHITE); - RenderArrow(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32_BLACK); - RenderArrow(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir_Left, IM_COL32_WHITE); -} - -// ColorPicker -// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set. -// FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..) -bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags, const float* ref_col) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - ImDrawList* draw_list = window->DrawList; - - ImGuiStyle& style = g.Style; - ImGuiIO& io = g.IO; - - PushID(label); - BeginGroup(); - - if (!(flags & ImGuiColorEditFlags_NoSidePreview)) - flags |= ImGuiColorEditFlags_NoSmallPreview; - - // Context menu: display and store options. - if (!(flags & ImGuiColorEditFlags_NoOptions)) - ColorPickerOptionsPopup(flags, col); - - // Read stored options - if (!(flags & ImGuiColorEditFlags__PickerMask)) - flags |= ((g.ColorEditOptions & ImGuiColorEditFlags__PickerMask) ? g.ColorEditOptions : ImGuiColorEditFlags__OptionsDefault) & ImGuiColorEditFlags__PickerMask; - IM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask))); // Check that only 1 is selected - if (!(flags & ImGuiColorEditFlags_NoOptions)) - flags |= (g.ColorEditOptions & ImGuiColorEditFlags_AlphaBar); - - // Setup - bool alpha_bar = (flags & ImGuiColorEditFlags_AlphaBar) && !(flags & ImGuiColorEditFlags_NoAlpha); - ImVec2 picker_pos = window->DC.CursorPos; - float square_sz = SmallSquareSize(); - float bars_width = square_sz; // Arbitrary smallish width of Hue/Alpha picking bars - float sv_picker_size = ImMax(bars_width * 1, CalcItemWidth() - (alpha_bar ? 2 : 1) * (bars_width + style.ItemInnerSpacing.x)); // Saturation/Value picking box - float bar0_pos_x = picker_pos.x + sv_picker_size + style.ItemInnerSpacing.x; - float bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x; - float bars_triangles_half_sz = (float)(int)(bars_width * 0.20f); - - float wheel_thickness = sv_picker_size * 0.08f; - float wheel_r_outer = sv_picker_size * 0.50f; - float wheel_r_inner = wheel_r_outer - wheel_thickness; - ImVec2 wheel_center(picker_pos.x + (sv_picker_size + bars_width)*0.5f, picker_pos.y + sv_picker_size*0.5f); - - // Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic. - float triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027f); - ImVec2 triangle_pa = ImVec2(triangle_r, 0.0f); // Hue point. - ImVec2 triangle_pb = ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f); // Black point. - ImVec2 triangle_pc = ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f); // White point. - - float H,S,V; - ColorConvertRGBtoHSV(col[0], col[1], col[2], H, S, V); - - bool value_changed = false, value_changed_h = false, value_changed_sv = false; - - if (flags & ImGuiColorEditFlags_PickerHueWheel) - { - // Hue wheel + SV triangle logic - InvisibleButton("hsv", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size)); - if (IsItemActive()) - { - ImVec2 initial_off = g.IO.MouseClickedPos[0] - wheel_center; - ImVec2 current_off = g.IO.MousePos - wheel_center; - float initial_dist2 = ImLengthSqr(initial_off); - if (initial_dist2 >= (wheel_r_inner-1)*(wheel_r_inner-1) && initial_dist2 <= (wheel_r_outer+1)*(wheel_r_outer+1)) - { - // Interactive with Hue wheel - H = atan2f(current_off.y, current_off.x) / IM_PI*0.5f; - if (H < 0.0f) - H += 1.0f; - value_changed = value_changed_h = true; - } - float cos_hue_angle = cosf(-H * 2.0f * IM_PI); - float sin_hue_angle = sinf(-H * 2.0f * IM_PI); - if (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle))) - { - // Interacting with SV triangle - ImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle); - if (!ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated)) - current_off_unrotated = ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated); - float uu, vv, ww; - ImTriangleBarycentricCoords(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated, uu, vv, ww); - V = ImClamp(1.0f - vv, 0.0001f, 1.0f); - S = ImClamp(uu / V, 0.0001f, 1.0f); - value_changed = value_changed_sv = true; - } - } - if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); - } - else if (flags & ImGuiColorEditFlags_PickerHueBar) - { - // SV rectangle logic - InvisibleButton("sv", ImVec2(sv_picker_size, sv_picker_size)); - if (IsItemActive()) - { - S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size-1)); - V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size-1)); - value_changed = value_changed_sv = true; - } - if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); - - // Hue bar logic - SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y)); - InvisibleButton("hue", ImVec2(bars_width, sv_picker_size)); - if (IsItemActive()) - { - H = ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size-1)); - value_changed = value_changed_h = true; - } - } - - // Alpha bar logic - if (alpha_bar) - { - SetCursorScreenPos(ImVec2(bar1_pos_x, picker_pos.y)); - InvisibleButton("alpha", ImVec2(bars_width, sv_picker_size)); - if (IsItemActive()) - { - col[3] = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size-1)); - value_changed = true; - } - } - - if (!(flags & ImGuiColorEditFlags_NoSidePreview)) - { - SameLine(0, style.ItemInnerSpacing.x); - BeginGroup(); - } - - if (!(flags & ImGuiColorEditFlags_NoLabel)) - { - const char* label_display_end = FindRenderedTextEnd(label); - if (label != label_display_end) - { - if ((flags & ImGuiColorEditFlags_NoSidePreview)) - SameLine(0, style.ItemInnerSpacing.x); - TextUnformatted(label, label_display_end); - } - } - - if (!(flags & ImGuiColorEditFlags_NoSidePreview)) - { - ImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]); - if ((flags & ImGuiColorEditFlags_NoLabel)) - Text("Current"); - ColorButton("##current", col_v4, (flags & (ImGuiColorEditFlags_HDR|ImGuiColorEditFlags_AlphaPreview|ImGuiColorEditFlags_AlphaPreviewHalf|ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2)); - if (ref_col != NULL) - { - Text("Original"); - ImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]); - if (ColorButton("##original", ref_col_v4, (flags & (ImGuiColorEditFlags_HDR|ImGuiColorEditFlags_AlphaPreview|ImGuiColorEditFlags_AlphaPreviewHalf|ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2))) - { - memcpy(col, ref_col, ((flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4) * sizeof(float)); - value_changed = true; - } - } - EndGroup(); - } - - // Convert back color to RGB - if (value_changed_h || value_changed_sv) - ColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10*1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]); - - // R,G,B and H,S,V slider color editor - if ((flags & ImGuiColorEditFlags_NoInputs) == 0) - { - PushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x); - ImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoSmallPreview | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf; - ImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker; - if (flags & ImGuiColorEditFlags_RGB || (flags & ImGuiColorEditFlags__InputsMask) == 0) - value_changed |= ColorEdit4("##rgb", col, sub_flags | ImGuiColorEditFlags_RGB); - if (flags & ImGuiColorEditFlags_HSV || (flags & ImGuiColorEditFlags__InputsMask) == 0) - value_changed |= ColorEdit4("##hsv", col, sub_flags | ImGuiColorEditFlags_HSV); - if (flags & ImGuiColorEditFlags_HEX || (flags & ImGuiColorEditFlags__InputsMask) == 0) - value_changed |= ColorEdit4("##hex", col, sub_flags | ImGuiColorEditFlags_HEX); - PopItemWidth(); - } - - // Try to cancel hue wrap (after ColorEdit), if any - if (value_changed) - { - float new_H, new_S, new_V; - ColorConvertRGBtoHSV(col[0], col[1], col[2], new_H, new_S, new_V); - if (new_H <= 0 && H > 0) - { - if (new_V <= 0 && V != new_V) - ColorConvertHSVtoRGB(H, S, new_V <= 0 ? V * 0.5f : new_V, col[0], col[1], col[2]); - else if (new_S <= 0) - ColorConvertHSVtoRGB(H, new_S <= 0 ? S * 0.5f : new_S, new_V, col[0], col[1], col[2]); - } - } - - ImVec4 hue_color_f(1, 1, 1, 1); ColorConvertHSVtoRGB(H, 1, 1, hue_color_f.x, hue_color_f.y, hue_color_f.z); - ImU32 hue_color32 = ColorConvertFloat4ToU32(hue_color_f); - ImU32 col32_no_alpha = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 1.0f)); - - const ImU32 hue_colors[6+1] = { IM_COL32(255,0,0,255), IM_COL32(255,255,0,255), IM_COL32(0,255,0,255), IM_COL32(0,255,255,255), IM_COL32(0,0,255,255), IM_COL32(255,0,255,255), IM_COL32(255,0,0,255) }; - ImVec2 sv_cursor_pos; - - if (flags & ImGuiColorEditFlags_PickerHueWheel) - { - // Render Hue Wheel - const float aeps = 1.5f / wheel_r_outer; // Half a pixel arc length in radians (2pi cancels out). - const int segment_per_arc = ImMax(4, (int)wheel_r_outer / 12); - for (int n = 0; n < 6; n++) - { - const float a0 = (n) /6.0f * 2.0f * IM_PI - aeps; - const float a1 = (n+1.0f)/6.0f * 2.0f * IM_PI + aeps; - const int vert_start_idx = draw_list->VtxBuffer.Size; - draw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer)*0.5f, a0, a1, segment_per_arc); - draw_list->PathStroke(IM_COL32_WHITE, false, wheel_thickness); - const int vert_end_idx = draw_list->VtxBuffer.Size; - - // Paint colors over existing vertices - ImVec2 gradient_p0(wheel_center.x + cosf(a0) * wheel_r_inner, wheel_center.y + sinf(a0) * wheel_r_inner); - ImVec2 gradient_p1(wheel_center.x + cosf(a1) * wheel_r_inner, wheel_center.y + sinf(a1) * wheel_r_inner); - ShadeVertsLinearColorGradientKeepAlpha(draw_list->VtxBuffer.Data + vert_start_idx, draw_list->VtxBuffer.Data + vert_end_idx, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n+1]); - } - - // Render Cursor + preview on Hue Wheel - float cos_hue_angle = cosf(H * 2.0f * IM_PI); - float sin_hue_angle = sinf(H * 2.0f * IM_PI); - ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner+wheel_r_outer)*0.5f); - float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f; - int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32); - draw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments); - draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad+1, IM_COL32(128,128,128,255), hue_cursor_segments); - draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, IM_COL32_WHITE, hue_cursor_segments); - - // Render SV triangle (rotated according to hue) - ImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle); - ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle); - ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle); - ImVec2 uv_white = g.FontTexUvWhitePixel; - draw_list->PrimReserve(6, 6); - draw_list->PrimVtx(tra, uv_white, hue_color32); - draw_list->PrimVtx(trb, uv_white, hue_color32); - draw_list->PrimVtx(trc, uv_white, IM_COL32_WHITE); - draw_list->PrimVtx(tra, uv_white, IM_COL32_BLACK_TRANS); - draw_list->PrimVtx(trb, uv_white, IM_COL32_BLACK); - draw_list->PrimVtx(trc, uv_white, IM_COL32_BLACK_TRANS); - draw_list->AddTriangle(tra, trb, trc, IM_COL32(128,128,128,255), 1.5f); - sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V)); - } - else if (flags & ImGuiColorEditFlags_PickerHueBar) - { - // Render SV Square - draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size,sv_picker_size), IM_COL32_WHITE, hue_color32, hue_color32, IM_COL32_WHITE); - draw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size,sv_picker_size), IM_COL32_BLACK_TRANS, IM_COL32_BLACK_TRANS, IM_COL32_BLACK, IM_COL32_BLACK); - RenderFrameBorder(picker_pos, picker_pos + ImVec2(sv_picker_size,sv_picker_size), 0.0f); - sv_cursor_pos.x = ImClamp((float)(int)(picker_pos.x + ImSaturate(S) * sv_picker_size + 0.5f), picker_pos.x + 2, picker_pos.x + sv_picker_size - 2); // Sneakily prevent the circle to stick out too much - sv_cursor_pos.y = ImClamp((float)(int)(picker_pos.y + ImSaturate(1 - V) * sv_picker_size + 0.5f), picker_pos.y + 2, picker_pos.y + sv_picker_size - 2); - - // Render Hue Bar - for (int i = 0; i < 6; ++i) - draw_list->AddRectFilledMultiColor(ImVec2(bar0_pos_x, picker_pos.y + i * (sv_picker_size / 6)), ImVec2(bar0_pos_x + bars_width, picker_pos.y + (i + 1) * (sv_picker_size / 6)), hue_colors[i], hue_colors[i], hue_colors[i + 1], hue_colors[i + 1]); - float bar0_line_y = (float)(int)(picker_pos.y + H * sv_picker_size + 0.5f); - RenderFrameBorder(ImVec2(bar0_pos_x, picker_pos.y), ImVec2(bar0_pos_x + bars_width, picker_pos.y + sv_picker_size), 0.0f); - RenderArrowsForVerticalBar(draw_list, ImVec2(bar0_pos_x - 1, bar0_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f); - } - - // Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range) - float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f; - draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, col32_no_alpha, 12); - draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad+1, IM_COL32(128,128,128,255), 12); - draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, IM_COL32_WHITE, 12); - - // Render alpha bar - if (alpha_bar) - { - float alpha = ImSaturate(col[3]); - ImRect bar1_bb(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size); - RenderColorRectWithAlphaCheckerboard(bar1_bb.Min, bar1_bb.Max, IM_COL32(0,0,0,0), bar1_bb.GetWidth() / 2.0f, ImVec2(0.0f, 0.0f)); - draw_list->AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, col32_no_alpha, col32_no_alpha, col32_no_alpha & ~IM_COL32_A_MASK, col32_no_alpha & ~IM_COL32_A_MASK); - float bar1_line_y = (float)(int)(picker_pos.y + (1.0f - alpha) * sv_picker_size + 0.5f); - RenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0f); - RenderArrowsForVerticalBar(draw_list, ImVec2(bar1_pos_x - 1, bar1_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f); - } - - EndGroup(); - PopID(); - - return value_changed; -} - -// Horizontal separating line. -void ImGui::Separator() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - ImGuiContext& g = *GImGui; - - ImGuiWindowFlags flags = 0; - if ((flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical)) == 0) - flags |= (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal; - IM_ASSERT(ImIsPowerOfTwo((int)(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical)))); // Check that only 1 option is selected - if (flags & ImGuiSeparatorFlags_Vertical) - { - VerticalSeparator(); - return; - } - - // Horizontal Separator - if (window->DC.ColumnsCount > 1) - PopClipRect(); - - float x1 = window->Pos.x; - float x2 = window->Pos.x + window->Size.x; - if (!window->DC.GroupStack.empty()) - x1 += window->DC.IndentX; - - const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y+1.0f)); - ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout. - if (!ItemAdd(bb, 0)) - { - if (window->DC.ColumnsCount > 1) - PushColumnClipRect(); - return; - } - - window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x,bb.Min.y), GetColorU32(ImGuiCol_Separator)); - - if (g.LogEnabled) - LogRenderedText(NULL, IM_NEWLINE "--------------------------------"); - - if (window->DC.ColumnsCount > 1) - { - PushColumnClipRect(); - window->DC.ColumnsCellMinY = window->DC.CursorPos.y; - } -} - -void ImGui::VerticalSeparator() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - ImGuiContext& g = *GImGui; - - float y1 = window->DC.CursorPos.y; - float y2 = window->DC.CursorPos.y + window->DC.CurrentLineHeight; - const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2)); - ItemSize(ImVec2(bb.GetWidth(), 0.0f)); - if (!ItemAdd(bb, 0)) - return; - - window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator)); - if (g.LogEnabled) - LogText(" |"); -} - -bool ImGui::SplitterBehavior(ImGuiID id, const ImRect& bb, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - - const ImGuiItemFlags item_flags_backup = window->DC.ItemFlags; -#ifdef IMGUI_HAS_NAV - window->DC.ItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus; -#endif - bool add = ItemAdd(bb, id); - window->DC.ItemFlags = item_flags_backup; - if (!add) - return false; - - bool hovered, held; - ImRect bb_interact = bb; - bb_interact.Expand(axis == ImGuiAxis_Y ? ImVec2(0.0f, hover_extend) : ImVec2(hover_extend, 0.0f)); - ButtonBehavior(bb_interact, id, &hovered, &held, ImGuiButtonFlags_FlattenChilds | ImGuiButtonFlags_AllowOverlapMode); - if (g.ActiveId != id) - SetItemAllowOverlap(); - - if (held || (g.HoveredId == id && g.HoveredIdPreviousFrame == id)) - SetMouseCursor(axis == ImGuiAxis_Y ? ImGuiMouseCursor_ResizeNS : ImGuiMouseCursor_ResizeEW); - - ImRect bb_render = bb; - if (held) - { - ImVec2 mouse_delta_2d = g.IO.MousePos - g.ActiveIdClickOffset - bb_interact.Min; - float mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x; - - // Minimum pane size - if (mouse_delta < min_size1 - *size1) - mouse_delta = min_size1 - *size1; - if (mouse_delta > *size2 - min_size2) - mouse_delta = *size2 - min_size2; - - // Apply resize - *size1 += mouse_delta; - *size2 -= mouse_delta; - bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta)); - } - - // Render - const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator); - RenderFrame(bb_render.Min, bb_render.Max, col, true, g.Style.FrameRounding); - - return held; -} - -void ImGui::Spacing() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - ItemSize(ImVec2(0,0)); -} - -void ImGui::Dummy(const ImVec2& size) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); - ItemSize(bb); - ItemAdd(bb, 0); -} - -bool ImGui::IsRectVisible(const ImVec2& size) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size)); -} - -bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->ClipRect.Overlaps(ImRect(rect_min, rect_max)); -} - -// Lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) -void ImGui::BeginGroup() -{ - ImGuiWindow* window = GetCurrentWindow(); - - window->DC.GroupStack.resize(window->DC.GroupStack.Size + 1); - ImGuiGroupData& group_data = window->DC.GroupStack.back(); - group_data.BackupCursorPos = window->DC.CursorPos; - group_data.BackupCursorMaxPos = window->DC.CursorMaxPos; - group_data.BackupIndentX = window->DC.IndentX; - group_data.BackupGroupOffsetX = window->DC.GroupOffsetX; - group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight; - group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset; - group_data.BackupLogLinePosY = window->DC.LogLinePosY; - group_data.BackupActiveIdIsAlive = GImGui->ActiveIdIsAlive; - group_data.AdvanceCursor = true; - - window->DC.GroupOffsetX = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffsetX; - window->DC.IndentX = window->DC.GroupOffsetX; - window->DC.CursorMaxPos = window->DC.CursorPos; - window->DC.CurrentLineHeight = 0.0f; - window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; -} - -void ImGui::EndGroup() -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - - IM_ASSERT(!window->DC.GroupStack.empty()); // Mismatched BeginGroup()/EndGroup() calls - - ImGuiGroupData& group_data = window->DC.GroupStack.back(); - - ImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos); - group_bb.Max = ImMax(group_bb.Min, group_bb.Max); - - window->DC.CursorPos = group_data.BackupCursorPos; - window->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos); - window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight; - window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset; - window->DC.IndentX = group_data.BackupIndentX; - window->DC.GroupOffsetX = group_data.BackupGroupOffsetX; - window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; - - if (group_data.AdvanceCursor) - { - window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrentLineTextBaseOffset); // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now. - ItemSize(group_bb.GetSize(), group_data.BackupCurrentLineTextBaseOffset); - ItemAdd(group_bb, 0); - } - - // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will be functional on the entire group. - // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but if you search for LastItemId you'll notice it is only used in that context. - const bool active_id_within_group = (!group_data.BackupActiveIdIsAlive && g.ActiveIdIsAlive && g.ActiveId && g.ActiveIdWindow->RootWindow == window->RootWindow); - if (active_id_within_group) - window->DC.LastItemId = g.ActiveId; - window->DC.LastItemRect = group_bb; - - window->DC.GroupStack.pop_back(); - - //window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255)); // [Debug] -} - -// Gets back to previous line and continue with horizontal layout -// pos_x == 0 : follow right after previous item -// pos_x != 0 : align to specified x position (relative to window/group left) -// spacing_w < 0 : use default spacing if pos_x == 0, no spacing if pos_x != 0 -// spacing_w >= 0 : enforce spacing amount -void ImGui::SameLine(float pos_x, float spacing_w) -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - if (pos_x != 0.0f) - { - if (spacing_w < 0.0f) spacing_w = 0.0f; - window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + pos_x + spacing_w + window->DC.GroupOffsetX + window->DC.ColumnsOffsetX; - window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y; - } - else - { - if (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x; - window->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w; - window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y; - } - window->DC.CurrentLineHeight = window->DC.PrevLineHeight; - window->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset; -} - -void ImGui::NewLine() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems) - return; - - ImGuiContext& g = *GImGui; - const ImGuiLayoutType backup_layout_type = window->DC.LayoutType; - window->DC.LayoutType = ImGuiLayoutType_Vertical; - if (window->DC.CurrentLineHeight > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height. - ItemSize(ImVec2(0,0)); - else - ItemSize(ImVec2(0.0f, g.FontSize)); - window->DC.LayoutType = backup_layout_type; -} - -void ImGui::NextColumn() -{ - ImGuiWindow* window = GetCurrentWindow(); - if (window->SkipItems || window->DC.ColumnsCount <= 1) - return; - - ImGuiContext& g = *GImGui; - PopItemWidth(); - PopClipRect(); - - window->DC.ColumnsCellMaxY = ImMax(window->DC.ColumnsCellMaxY, window->DC.CursorPos.y); - if (++window->DC.ColumnsCurrent < window->DC.ColumnsCount) - { - // Columns 1+ cancel out IndentX - window->DC.ColumnsOffsetX = GetColumnOffset(window->DC.ColumnsCurrent) - window->DC.IndentX + g.Style.ItemSpacing.x; - window->DrawList->ChannelsSetCurrent(window->DC.ColumnsCurrent); - } - else - { - window->DC.ColumnsCurrent = 0; - window->DC.ColumnsOffsetX = 0.0f; - window->DC.ColumnsCellMinY = window->DC.ColumnsCellMaxY; - window->DrawList->ChannelsSetCurrent(0); - } - window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX); - window->DC.CursorPos.y = window->DC.ColumnsCellMinY; - window->DC.CurrentLineHeight = 0.0f; - window->DC.CurrentLineTextBaseOffset = 0.0f; - - PushColumnClipRect(); - PushItemWidth(GetColumnWidth() * 0.65f); // FIXME: Move on columns setup -} - -int ImGui::GetColumnIndex() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.ColumnsCurrent; -} - -int ImGui::GetColumnsCount() -{ - ImGuiWindow* window = GetCurrentWindowRead(); - return window->DC.ColumnsCount; -} - -static float OffsetNormToPixels(ImGuiWindow* window, float offset_norm) -{ - return offset_norm * (window->DC.ColumnsMaxX - window->DC.ColumnsMinX); -} - -static float PixelsToOffsetNorm(ImGuiWindow* window, float offset) -{ - return (offset - window->DC.ColumnsMinX) / (window->DC.ColumnsMaxX - window->DC.ColumnsMinX); -} - -static float GetDraggedColumnOffset(int column_index) -{ - // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing - // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning. - ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - IM_ASSERT(column_index > 0); // We cannot drag column 0. If you get this assert you may have a conflict between the ID of your columns and another widgets. - IM_ASSERT(g.ActiveId == window->DC.ColumnsSetId + ImGuiID(column_index)); - - float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x - window->Pos.x; - x = ImMax(x, ImGui::GetColumnOffset(column_index-1) + g.Style.ColumnsMinSpacing); - if ((window->DC.ColumnsFlags & ImGuiColumnsFlags_NoPreserveWidths)) - x = ImMin(x, ImGui::GetColumnOffset(column_index+1) - g.Style.ColumnsMinSpacing); - - return x; -} - -float ImGui::GetColumnOffset(int column_index) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - if (column_index < 0) - column_index = window->DC.ColumnsCurrent; - - /* - if (g.ActiveId) - { - ImGuiContext& g = *GImGui; - const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index); - if (g.ActiveId == column_id) - return GetDraggedColumnOffset(column_index); - } - */ - - IM_ASSERT(column_index < window->DC.ColumnsData.Size); - const float t = window->DC.ColumnsData[column_index].OffsetNorm; - const float x_offset = ImLerp(window->DC.ColumnsMinX, window->DC.ColumnsMaxX, t); - return x_offset; -} - -void ImGui::SetColumnOffset(int column_index, float offset) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - if (column_index < 0) - column_index = window->DC.ColumnsCurrent; - - IM_ASSERT(column_index < window->DC.ColumnsData.Size); - - const bool preserve_width = !(window->DC.ColumnsFlags & ImGuiColumnsFlags_NoPreserveWidths) && (column_index < window->DC.ColumnsCount-1); - const float width = preserve_width ? GetColumnWidth(column_index) : 0.0f; - - if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_NoForceWithinWindow)) - offset = ImMin(offset, window->DC.ColumnsMaxX - g.Style.ColumnsMinSpacing * (window->DC.ColumnsCount - column_index)); - const float offset_norm = PixelsToOffsetNorm(window, offset); - - const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index); - window->DC.StateStorage->SetFloat(column_id, offset_norm); - window->DC.ColumnsData[column_index].OffsetNorm = offset_norm; - - if (preserve_width) - SetColumnOffset(column_index + 1, offset + ImMax(g.Style.ColumnsMinSpacing, width)); -} - -float ImGui::GetColumnWidth(int column_index) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - if (column_index < 0) - column_index = window->DC.ColumnsCurrent; - - return OffsetNormToPixels(window, window->DC.ColumnsData[column_index+1].OffsetNorm - window->DC.ColumnsData[column_index].OffsetNorm); -} - -void ImGui::SetColumnWidth(int column_index, float width) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - if (column_index < 0) - column_index = window->DC.ColumnsCurrent; - - SetColumnOffset(column_index+1, GetColumnOffset(column_index) + width); -} - -void ImGui::PushColumnClipRect(int column_index) -{ - ImGuiWindow* window = GetCurrentWindowRead(); - if (column_index < 0) - column_index = window->DC.ColumnsCurrent; - - PushClipRect(window->DC.ColumnsData[column_index].ClipRect.Min, window->DC.ColumnsData[column_index].ClipRect.Max, false); -} - -void ImGui::BeginColumns(const char* id, int columns_count, ImGuiColumnsFlags flags) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - - IM_ASSERT(columns_count > 1); - IM_ASSERT(window->DC.ColumnsCount == 1); // Nested columns are currently not supported - - // Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget. - // In addition, when an identifier isn't explicitly provided we include the number of columns in the hash to make it uniquer. - PushID(0x11223347 + (id ? 0 : columns_count)); - window->DC.ColumnsSetId = window->GetID(id ? id : "columns"); - PopID(); - - // Set state for first column - window->DC.ColumnsCurrent = 0; - window->DC.ColumnsCount = columns_count; - window->DC.ColumnsFlags = flags; - - const float content_region_width = (window->SizeContentsExplicit.x != 0.0f) ? (window->SizeContentsExplicit.x) : (window->Size.x -window->ScrollbarSizes.x); - window->DC.ColumnsMinX = window->DC.IndentX - g.Style.ItemSpacing.x; // Lock our horizontal range - //window->DC.ColumnsMaxX = content_region_width - window->Scroll.x -((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarSize);// - window->WindowPadding().x; - window->DC.ColumnsMaxX = content_region_width - window->Scroll.x; - window->DC.ColumnsStartPosY = window->DC.CursorPos.y; - window->DC.ColumnsStartMaxPosX = window->DC.CursorMaxPos.x; - window->DC.ColumnsCellMinY = window->DC.ColumnsCellMaxY = window->DC.CursorPos.y; - window->DC.ColumnsOffsetX = 0.0f; - window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX); - - // Cache column offsets - window->DC.ColumnsData.resize(columns_count + 1); - for (int column_index = 0; column_index < columns_count + 1; column_index++) - { - const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index); - KeepAliveID(column_id); - const float default_t = column_index / (float)window->DC.ColumnsCount; - float t = window->DC.StateStorage->GetFloat(column_id, default_t); - if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_NoForceWithinWindow)) - t = ImMin(t, PixelsToOffsetNorm(window, window->DC.ColumnsMaxX - g.Style.ColumnsMinSpacing * (window->DC.ColumnsCount - column_index))); - window->DC.ColumnsData[column_index].OffsetNorm = t; - } - - // Cache clipping rectangles - for (int column_index = 0; column_index < columns_count; column_index++) - { - float clip_x1 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(column_index) - 1.0f); - float clip_x2 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(column_index + 1) - 1.0f); - window->DC.ColumnsData[column_index].ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX); - window->DC.ColumnsData[column_index].ClipRect.ClipWith(window->ClipRect); - } - - window->DrawList->ChannelsSplit(window->DC.ColumnsCount); - PushColumnClipRect(); - PushItemWidth(GetColumnWidth() * 0.65f); -} - -void ImGui::EndColumns() -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - IM_ASSERT(window->DC.ColumnsCount > 1); - - PopItemWidth(); - PopClipRect(); - window->DrawList->ChannelsMerge(); - - window->DC.ColumnsCellMaxY = ImMax(window->DC.ColumnsCellMaxY, window->DC.CursorPos.y); - window->DC.CursorPos.y = window->DC.ColumnsCellMaxY; - if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_GrowParentContentsSize)) - window->DC.CursorMaxPos.x = ImMax(window->DC.ColumnsStartMaxPosX, window->DC.ColumnsMaxX); // Restore cursor max pos, as columns don't grow parent - - // Draw columns borders and handle resize - if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems) - { - const float y1 = window->DC.ColumnsStartPosY; - const float y2 = window->DC.CursorPos.y; - int dragging_column = -1; - for (int i = 1; i < window->DC.ColumnsCount; i++) - { - float x = window->Pos.x + GetColumnOffset(i); - const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(i); - const float column_hw = 4.0f; // Half-width for interaction - const ImRect column_rect(ImVec2(x - column_hw, y1), ImVec2(x + column_hw, y2)); - if (IsClippedEx(column_rect, column_id, false)) - continue; - - bool hovered = false, held = false; - if (!(window->DC.ColumnsFlags & ImGuiColumnsFlags_NoResize)) - { - ButtonBehavior(column_rect, column_id, &hovered, &held); - if (hovered || held) - g.MouseCursor = ImGuiMouseCursor_ResizeEW; - if (held && g.ActiveIdIsJustActivated) - g.ActiveIdClickOffset.x -= column_hw; // Store from center of column line (we used a 8 wide rect for columns clicking). This is used by GetDraggedColumnOffset(). - if (held) - dragging_column = i; - } - - // Draw column - // We clip the Y boundaries CPU side because very long triangles are mishandled by some GPU drivers. - const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator); - const float xi = (float)(int)x; - window->DrawList->AddLine(ImVec2(xi, ImMax(y1 + 1.0f, window->ClipRect.Min.y)), ImVec2(xi, ImMin(y2, window->ClipRect.Max.y)), col); - } - - // Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame. - if (dragging_column != -1) - { - float x = GetDraggedColumnOffset(dragging_column); - SetColumnOffset(dragging_column, x); - } - } - - window->DC.ColumnsSetId = 0; - window->DC.ColumnsCurrent = 0; - window->DC.ColumnsCount = 1; - window->DC.ColumnsFlags = 0; - window->DC.ColumnsData.resize(0); - window->DC.ColumnsOffsetX = 0.0f; - window->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX); -} - -// [2017/08: This is currently the only public API, while we are working on making BeginColumns/EndColumns user-facing] -void ImGui::Columns(int columns_count, const char* id, bool border) -{ - ImGuiWindow* window = GetCurrentWindow(); - IM_ASSERT(columns_count >= 1); - - if (window->DC.ColumnsCount != columns_count && window->DC.ColumnsCount != 1) - EndColumns(); - - ImGuiColumnsFlags flags = (border ? 0 : ImGuiColumnsFlags_NoBorder); - //flags |= ImGuiColumnsFlags_NoPreserveWidths; // NB: Legacy behavior - if (columns_count != 1) - BeginColumns(id, columns_count, flags); -} - -void ImGui::Indent(float indent_w) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - window->DC.IndentX += (indent_w > 0.0f) ? indent_w : g.Style.IndentSpacing; - window->DC.CursorPos.x = window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX; -} - -void ImGui::Unindent(float indent_w) -{ - ImGuiContext& g = *GImGui; - ImGuiWindow* window = GetCurrentWindow(); - window->DC.IndentX -= (indent_w > 0.0f) ? indent_w : g.Style.IndentSpacing; - window->DC.CursorPos.x = window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX; -} - -void ImGui::TreePush(const char* str_id) -{ - ImGuiWindow* window = GetCurrentWindow(); - Indent(); - window->DC.TreeDepth++; - PushID(str_id ? str_id : "#TreePush"); -} - -void ImGui::TreePush(const void* ptr_id) -{ - ImGuiWindow* window = GetCurrentWindow(); - Indent(); - window->DC.TreeDepth++; - PushID(ptr_id ? ptr_id : (const void*)"#TreePush"); -} - -void ImGui::TreePushRawID(ImGuiID id) -{ - ImGuiWindow* window = GetCurrentWindow(); - Indent(); - window->DC.TreeDepth++; - window->IDStack.push_back(id); -} - -void ImGui::TreePop() -{ - ImGuiWindow* window = GetCurrentWindow(); - Unindent(); - window->DC.TreeDepth--; - PopID(); -} - -void ImGui::Value(const char* prefix, bool b) -{ - Text("%s: %s", prefix, (b ? "true" : "false")); -} - -void ImGui::Value(const char* prefix, int v) -{ - Text("%s: %d", prefix, v); -} - -void ImGui::Value(const char* prefix, unsigned int v) -{ - Text("%s: %d", prefix, v); -} - -void ImGui::Value(const char* prefix, float v, const char* float_format) -{ - if (float_format) - { - char fmt[64]; - ImFormatString(fmt, IM_ARRAYSIZE(fmt), "%%s: %s", float_format); - Text(fmt, prefix, v); - } - else - { - Text("%s: %.3f", prefix, v); - } -} - -//----------------------------------------------------------------------------- -// PLATFORM DEPENDENT HELPERS -//----------------------------------------------------------------------------- - -#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)) -#undef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#include -#endif - -// Win32 API clipboard implementation -#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) - -#ifdef _MSC_VER -#pragma comment(lib, "user32") -#endif - -static const char* GetClipboardTextFn_DefaultImpl(void*) -{ - static ImVector buf_local; - buf_local.clear(); - if (!OpenClipboard(NULL)) - return NULL; - HANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT); - if (wbuf_handle == NULL) - { - CloseClipboard(); - return NULL; - } - if (ImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle)) - { - int buf_len = ImTextCountUtf8BytesFromStr(wbuf_global, NULL) + 1; - buf_local.resize(buf_len); - ImTextStrToUtf8(buf_local.Data, buf_len, wbuf_global, NULL); - } - GlobalUnlock(wbuf_handle); - CloseClipboard(); - return buf_local.Data; -} - -static void SetClipboardTextFn_DefaultImpl(void*, const char* text) -{ - if (!OpenClipboard(NULL)) - return; - const int wbuf_length = ImTextCountCharsFromUtf8(text, NULL) + 1; - HGLOBAL wbuf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length * sizeof(ImWchar)); - if (wbuf_handle == NULL) - { - CloseClipboard(); - return; - } - ImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle); - ImTextStrFromUtf8(wbuf_global, wbuf_length, text, NULL); - GlobalUnlock(wbuf_handle); - EmptyClipboard(); - SetClipboardData(CF_UNICODETEXT, wbuf_handle); - CloseClipboard(); -} - -#else - -// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers -static const char* GetClipboardTextFn_DefaultImpl(void*) -{ - ImGuiContext& g = *GImGui; - return g.PrivateClipboard.empty() ? NULL : g.PrivateClipboard.begin(); -} - -// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers -static void SetClipboardTextFn_DefaultImpl(void*, const char* text) -{ - ImGuiContext& g = *GImGui; - g.PrivateClipboard.clear(); - const char* text_end = text + strlen(text); - g.PrivateClipboard.resize((int)(text_end - text) + 1); - memcpy(&g.PrivateClipboard[0], text, (size_t)(text_end - text)); - g.PrivateClipboard[(int)(text_end - text)] = 0; -} - -#endif - -// Win32 API IME support (for Asian languages, etc.) -#if defined(_WIN32) && !defined(__GNUC__) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS) - -#include -#ifdef _MSC_VER -#pragma comment(lib, "imm32") -#endif - -static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y) -{ - // Notify OS Input Method Editor of text input position - if (HWND hwnd = (HWND)GImGui->IO.ImeWindowHandle) - if (HIMC himc = ImmGetContext(hwnd)) - { - COMPOSITIONFORM cf; - cf.ptCurrentPos.x = x; - cf.ptCurrentPos.y = y; - cf.dwStyle = CFS_FORCE_POSITION; - ImmSetCompositionWindow(himc, &cf); - } -} - -#else - -static void ImeSetInputScreenPosFn_DefaultImpl(int, int) {} - -#endif - -//----------------------------------------------------------------------------- -// HELP -//----------------------------------------------------------------------------- - -void ImGui::ShowMetricsWindow(bool* p_open) -{ - if (ImGui::Begin("ImGui Metrics", p_open)) - { - ImGui::Text("ImGui %s", ImGui::GetVersion()); - ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); - ImGui::Text("%d vertices, %d indices (%d triangles)", ImGui::GetIO().MetricsRenderVertices, ImGui::GetIO().MetricsRenderIndices, ImGui::GetIO().MetricsRenderIndices / 3); - ImGui::Text("%d allocations", ImGui::GetIO().MetricsAllocs); - static bool show_clip_rects = true; - ImGui::Checkbox("Show clipping rectangles when hovering an ImDrawCmd", &show_clip_rects); - ImGui::Separator(); - - struct Funcs - { - static void NodeDrawList(ImDrawList* draw_list, const char* label) - { - bool node_open = ImGui::TreeNode(draw_list, "%s: '%s' %d vtx, %d indices, %d cmds", label, draw_list->_OwnerName ? draw_list->_OwnerName : "", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, draw_list->CmdBuffer.Size); - if (draw_list == ImGui::GetWindowDrawList()) - { - ImGui::SameLine(); - ImGui::TextColored(ImColor(255,100,100), "CURRENTLY APPENDING"); // Can't display stats for active draw list! (we don't have the data double-buffered) - if (node_open) ImGui::TreePop(); - return; - } - if (!node_open) - return; - - ImDrawList* overlay_draw_list = &GImGui->OverlayDrawList; // Render additional visuals into the top-most draw list - overlay_draw_list->PushClipRectFullScreen(); - int elem_offset = 0; - for (const ImDrawCmd* pcmd = draw_list->CmdBuffer.begin(); pcmd < draw_list->CmdBuffer.end(); elem_offset += pcmd->ElemCount, pcmd++) - { - if (pcmd->UserCallback == NULL && pcmd->ElemCount == 0) - continue; - if (pcmd->UserCallback) - { - ImGui::BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData); - continue; - } - ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL; - bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %-4d %s vtx, tex = %p, clip_rect = (%.0f,%.0f)..(%.0f,%.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w); - if (show_clip_rects && ImGui::IsItemHovered()) - { - ImRect clip_rect = pcmd->ClipRect; - ImRect vtxs_rect; - for (int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++) - vtxs_rect.Add(draw_list->VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos); - clip_rect.Floor(); overlay_draw_list->AddRect(clip_rect.Min, clip_rect.Max, IM_COL32(255,255,0,255)); - vtxs_rect.Floor(); overlay_draw_list->AddRect(vtxs_rect.Min, vtxs_rect.Max, IM_COL32(255,0,255,255)); - } - if (!pcmd_node_open) - continue; - ImGuiListClipper clipper(pcmd->ElemCount/3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible. - while (clipper.Step()) - for (int prim = clipper.DisplayStart, vtx_i = elem_offset + clipper.DisplayStart*3; prim < clipper.DisplayEnd; prim++) - { - char buf[300]; - char *buf_p = buf, *buf_end = buf + IM_ARRAYSIZE(buf); - ImVec2 triangles_pos[3]; - for (int n = 0; n < 3; n++, vtx_i++) - { - ImDrawVert& v = draw_list->VtxBuffer[idx_buffer ? idx_buffer[vtx_i] : vtx_i]; - triangles_pos[n] = v.pos; - buf_p += ImFormatString(buf_p, (int)(buf_end - buf_p), "%s %04d { pos = (%8.2f,%8.2f), uv = (%.6f,%.6f), col = %08X }\n", (n == 0) ? "vtx" : " ", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col); - } - ImGui::Selectable(buf, false); - if (ImGui::IsItemHovered()) - overlay_draw_list->AddPolyline(triangles_pos, 3, IM_COL32(255,255,0,255), true, 1.0f, false); // Add triangle without AA, more readable for large-thin triangle - } - ImGui::TreePop(); - } - overlay_draw_list->PopClipRect(); - ImGui::TreePop(); - } - - static void NodeWindows(ImVector& windows, const char* label) - { - if (!ImGui::TreeNode(label, "%s (%d)", label, windows.Size)) - return; - for (int i = 0; i < windows.Size; i++) - Funcs::NodeWindow(windows[i], "Window"); - ImGui::TreePop(); - } - - static void NodeWindow(ImGuiWindow* window, const char* label) - { - if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window)) - return; - NodeDrawList(window->DrawList, "DrawList"); - ImGui::BulletText("Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y); - if (ImGui::IsItemHovered()) - GImGui->OverlayDrawList.AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255,255,0,255)); - ImGui::BulletText("Scroll: (%.2f/%.2f,%.2f/%.2f)", window->Scroll.x, GetScrollMaxX(window), window->Scroll.y, GetScrollMaxY(window)); - ImGui::BulletText("Active: %d, WriteAccessed: %d", window->Active, window->WriteAccessed); - if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow"); - if (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, "ChildWindows"); - ImGui::BulletText("Storage: %d bytes", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair)); - ImGui::TreePop(); - } - }; - - ImGuiContext& g = *GImGui; // Access private state - Funcs::NodeWindows(g.Windows, "Windows"); - if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.RenderDrawLists[0].Size)) - { - for (int layer = 0; layer < IM_ARRAYSIZE(g.RenderDrawLists); layer++) - for (int i = 0; i < g.RenderDrawLists[layer].Size; i++) - Funcs::NodeDrawList(g.RenderDrawLists[0][i], "DrawList"); - ImGui::TreePop(); - } - if (ImGui::TreeNode("Popups", "Open Popups Stack (%d)", g.OpenPopupStack.Size)) - { - for (int i = 0; i < g.OpenPopupStack.Size; i++) - { - ImGuiWindow* window = g.OpenPopupStack[i].Window; - ImGui::BulletText("PopupID: %08x, Window: '%s'%s%s", g.OpenPopupStack[i].PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? " ChildWindow" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? " ChildMenu" : ""); - } - ImGui::TreePop(); - } - if (ImGui::TreeNode("Basic state")) - { - ImGui::Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL"); - ImGui::Text("HoveredRootWindow: '%s'", g.HoveredRootWindow ? g.HoveredRootWindow->Name : "NULL"); - ImGui::Text("HoveredId: 0x%08X/0x%08X (%.2f sec)", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer); // Data is "in-flight" so depending on when the Metrics window is called we may see current frame information or not - ImGui::Text("ActiveId: 0x%08X/0x%08X (%.2f sec)", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer); - ImGui::Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL"); - ImGui::Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL"); - ImGui::TreePop(); - } - } - ImGui::End(); -} - -//----------------------------------------------------------------------------- - -// Include imgui_user.inl at the end of imgui.cpp to access private data/functions that aren't exposed. -// Prefer just including imgui_internal.h from your code rather than using this define. If a declaration is missing from imgui_internal.h add it or request it on the github. -#ifdef IMGUI_INCLUDE_IMGUI_USER_INL -#include "imgui_user.inl" -#endif - -//----------------------------------------------------------------------------- diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h deleted file mode 100644 index 7a1d209af48..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.h +++ /dev/null @@ -1,1580 +0,0 @@ -// dear imgui, v1.53 WIP -// (headers) - -// See imgui.cpp file for documentation. -// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code. -// Read 'Programmer guide' in imgui.cpp for notes on how to setup ImGui in your codebase. -// Get latest version at https://github.com/ocornut/imgui - -#pragma once - -#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) -#include "imconfig.h" // User-editable configuration file -#endif -#include // FLT_MAX -#include // va_list -#include // ptrdiff_t, NULL -#include // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp - -#define IMGUI_VERSION "1.53 WIP" - -// Define attributes of all API symbols declarations, e.g. for DLL under Windows. -#ifndef IMGUI_API -#define IMGUI_API -#endif - -// Define assertion handler. -#ifndef IM_ASSERT -#include -#define IM_ASSERT(_EXPR, ...) assert(_EXPR) -#endif - -// Helpers -// Some compilers support applying printf-style warnings to user functions. -#if 0 // defined(__clang__) || defined(__GNUC__) -#define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) -#define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0))) -#else -#define IM_FMTARGS(FMT) -#define IM_FMTLIST(FMT) -#endif -#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) - -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wold-style-cast" -#endif - -// Forward declarations -struct ImDrawChannel; // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit() -struct ImDrawCmd; // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call) -struct ImDrawData; // All draw command lists required to render the frame -struct ImDrawList; // A single draw command list (generally one per window) -struct ImDrawVert; // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT) -struct ImFont; // Runtime data for a single font within a parent ImFontAtlas -struct ImFontAtlas; // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader -struct ImFontConfig; // Configuration data when adding a font or merging fonts -struct ImColor; // Helper functions to create a color that can be converted to either u32 or float4 -struct ImGuiIO; // Main configuration and I/O between your application and ImGui -struct ImGuiOnceUponAFrame; // Simple helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro -struct ImGuiStorage; // Simple custom key value storage -struct ImGuiStyle; // Runtime data for styling/colors -struct ImGuiTextFilter; // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" -struct ImGuiTextBuffer; // Text buffer for logging/accumulating text -struct ImGuiTextEditCallbackData; // Shared state of ImGui::InputText() when using custom ImGuiTextEditCallback (rare/advanced use) -struct ImGuiSizeConstraintCallbackData;// Structure used to constraint window size in custom ways when using custom ImGuiSizeConstraintCallback (rare/advanced use) -struct ImGuiListClipper; // Helper to manually clip large list of items -struct ImGuiContext; // ImGui context (opaque) - -// Typedefs and Enumerations (declared as int for compatibility and to not pollute the top of this file) -typedef unsigned int ImU32; // 32-bit unsigned integer (typically used to store packed colors) -typedef unsigned int ImGuiID; // unique ID used by widgets (typically hashed from a stack of string) -typedef unsigned short ImWchar; // character for keyboard input/display -typedef void* ImTextureID; // user data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp) -typedef int ImGuiCol; // enum: a color identifier for styling // enum ImGuiCol_ -typedef int ImGuiStyleVar; // enum: a variable identifier for styling // enum ImGuiStyleVar_ -typedef int ImGuiKey; // enum: a key identifier (ImGui-side enum) // enum ImGuiKey_ -typedef int ImGuiMouseCursor; // enum: a mouse cursor identifier // enum ImGuiMouseCursor_ -typedef int ImGuiCond; // enum: a condition for Set*() // enum ImGuiCond_ -typedef int ImDrawCornerFlags; // flags: corner flags for AddRect*() etc. // enum ImDrawCornerFlags_ -typedef int ImGuiColorEditFlags; // flags: color edit flags for Color*() // enum ImGuiColorEditFlags_ -typedef int ImGuiWindowFlags; // flags: window flags for Begin*() // enum ImGuiWindowFlags_ -typedef int ImGuiColumnsFlags; // flags: for *Columns*() // enum ImGuiColumnsFlags_ -typedef int ImGuiInputTextFlags; // flags: for InputText*() // enum ImGuiInputTextFlags_ -typedef int ImGuiSelectableFlags; // flags: for Selectable() // enum ImGuiSelectableFlags_ -typedef int ImGuiTreeNodeFlags; // flags: for TreeNode*(), Collapsing*() // enum ImGuiTreeNodeFlags_ -typedef int ImGuiHoveredFlags; // flags: for IsItemHovered() // enum ImGuiHoveredFlags_ -typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data); -typedef void (*ImGuiSizeConstraintCallback)(ImGuiSizeConstraintCallbackData* data); -#ifdef _MSC_VER -typedef unsigned __int64 ImU64; // 64-bit unsigned integer -#else -typedef unsigned long long ImU64; // 64-bit unsigned integer -#endif - -// Others helpers at bottom of the file: -// class ImVector<> // Lightweight std::vector like class. -// IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times) - -struct ImVec2 -{ - float x, y; - ImVec2() { x = y = 0.0f; } - ImVec2(float _x, float _y) { x = _x; y = _y; } -#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2. - IM_VEC2_CLASS_EXTRA -#endif -}; - -struct ImVec4 -{ - float x, y, z, w; - ImVec4() { x = y = z = w = 0.0f; } - ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } -#ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec4. - IM_VEC4_CLASS_EXTRA -#endif -}; - -// ImGui end-user API -// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types) -namespace ImGui -{ - // Main - IMGUI_API ImGuiIO& GetIO(); - IMGUI_API ImGuiStyle& GetStyle(); - IMGUI_API ImDrawData* GetDrawData(); // same value as passed to your io.RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame() - IMGUI_API void NewFrame(); // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame(). - IMGUI_API void Render(); // ends the ImGui frame, finalize the draw data, then call your io.RenderDrawListsFn() function if set. - IMGUI_API void EndFrame(); // ends the ImGui frame. automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead! - IMGUI_API void Shutdown(); - - // Demo/Debug/Info - IMGUI_API void ShowTestWindow(bool* p_open = NULL); // create demo/test window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! - IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create metrics window. display ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc. - IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) - IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). - - // Window - IMGUI_API bool Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // push window to the stack and start appending to it. see .cpp for details. return false when window is collapsed, so you can early out in your code. 'bool* p_open' creates a widget on the upper-right to close the window (which sets your bool to false). - IMGUI_API void End(); // finish appending to current window, pop it off the window stack. - IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400). - IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // " - IMGUI_API void EndChild(); - IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates - IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos() - IMGUI_API float GetContentRegionAvailWidth(); // - IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates - IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates - IMGUI_API float GetWindowContentRegionWidth(); // - IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives - IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (useful if you want to do your own drawing via the DrawList api) - IMGUI_API ImVec2 GetWindowSize(); // get current window size - IMGUI_API float GetWindowWidth(); - IMGUI_API float GetWindowHeight(); - IMGUI_API bool IsWindowCollapsed(); - IMGUI_API bool IsWindowAppearing(); - IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows - - IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0,0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc. - IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0); // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin() - IMGUI_API void SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeConstraintCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints. - IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (enforce the range of scrollbars). set axis to 0.0f to leave it automatic. call before Begin() - IMGUI_API void SetNextWindowContentWidth(float width); // set next window content width (enforce the range of horizontal scrollbar). call before Begin() - IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin() - IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most. call before Begin() - IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. - IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. - IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed(). - IMGUI_API void SetWindowFocus(); // (not recommended) set current window to be focused / front-most. prefer using SetNextWindowFocus(). - IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0); // set named window position. - IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0); // set named window size. set axis to 0.0f to force an auto-fit on this axis. - IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0); // set named window collapsed state - IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus. - - IMGUI_API float GetScrollX(); // get scrolling amount [0..GetScrollMaxX()] - IMGUI_API float GetScrollY(); // get scrolling amount [0..GetScrollMaxY()] - IMGUI_API float GetScrollMaxX(); // get maximum scrolling amount ~~ ContentSize.X - WindowSize.X - IMGUI_API float GetScrollMaxY(); // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y - IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0..GetScrollMaxX()] - IMGUI_API void SetScrollY(float scroll_y); // set scrolling amount [0..GetScrollMaxY()] - IMGUI_API void SetScrollHere(float center_y_ratio = 0.5f); // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. - IMGUI_API void SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f); // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions. - IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget. - IMGUI_API void SetStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it) - IMGUI_API ImGuiStorage* GetStateStorage(); - - // Parameters stacks (shared) - IMGUI_API void PushFont(ImFont* font); // use NULL as a shortcut to push default font - IMGUI_API void PopFont(); - IMGUI_API void PushStyleColor(ImGuiCol idx, ImU32 col); - IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col); - IMGUI_API void PopStyleColor(int count = 1); - IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); - IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); - IMGUI_API void PopStyleVar(int count = 1); - IMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx); // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwhise use GetColorU32() to get style color + style alpha. - IMGUI_API ImFont* GetFont(); // get current font - IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied - IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API - IMGUI_API ImU32 GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f); // retrieve given style color with style alpha applied and optional extra alpha multiplier - IMGUI_API ImU32 GetColorU32(const ImVec4& col); // retrieve given color with style alpha applied - IMGUI_API ImU32 GetColorU32(ImU32 col); // retrieve given color with style alpha applied - - // Parameters stacks (current window) - IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side) - IMGUI_API void PopItemWidth(); - IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position - IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space - IMGUI_API void PopTextWrapPos(); - IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets - IMGUI_API void PopAllowKeyboardFocus(); - IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. - IMGUI_API void PopButtonRepeat(); - - // Cursor / Layout - IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. - IMGUI_API void SameLine(float pos_x = 0.0f, float spacing_w = -1.0f); // call between widgets or groups to layout them horizontally - IMGUI_API void NewLine(); // undo a SameLine() - IMGUI_API void Spacing(); // add vertical spacing - IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size - IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by style.IndentSpacing or indent_w if >0 - IMGUI_API void Unindent(float indent_w = 0.0f); // move content position back to the left, by style.IndentSpacing or indent_w if >0 - IMGUI_API void BeginGroup(); // lock horizontal starting position + capture group bounding box into one "item" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.) - IMGUI_API void EndGroup(); - IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position - IMGUI_API float GetCursorPosX(); // " - IMGUI_API float GetCursorPosY(); // " - IMGUI_API void SetCursorPos(const ImVec2& local_pos); // " - IMGUI_API void SetCursorPosX(float x); // " - IMGUI_API void SetCursorPosY(float y); // " - IMGUI_API ImVec2 GetCursorStartPos(); // initial cursor position - IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API) - IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates [0..io.DisplaySize] - IMGUI_API void AlignTextToFramePadding(); // vertically align/lower upcoming text to FramePadding.y so that it will aligns to upcoming widgets (call if you have text on a line before regular widgets) - IMGUI_API float GetTextLineHeight(); // height of font == GetWindowFontSize() - IMGUI_API float GetTextLineHeightWithSpacing(); // distance (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y - IMGUI_API float GetItemsLineHeightWithSpacing(); // distance (in pixels) between 2 consecutive lines of standard height widgets == GetWindowFontSize() + GetStyle().FramePadding.y*2 + GetStyle().ItemSpacing.y - - // Columns - // You can also use SameLine(pos_x) for simplified columns. The columns API is still work-in-progress and rather lacking. - IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border = true); - IMGUI_API void NextColumn(); // next column, defaults to current row or next row if the current row is finished - IMGUI_API int GetColumnIndex(); // get current column index - IMGUI_API float GetColumnWidth(int column_index = -1); // get column width (in pixels). pass -1 to use current column - IMGUI_API void SetColumnWidth(int column_index, float width); // set column width (in pixels). pass -1 to use current column - IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f - IMGUI_API void SetColumnOffset(int column_index, float offset_x); // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column - IMGUI_API int GetColumnsCount(); - - // ID scopes - // If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) so ImGui can differentiate them. - // You can also use the "##foobar" syntax within widget label to distinguish them from each others. Read "A primer on the use of labels/IDs" in the FAQ for more details. - IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the entire stack! - IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end); - IMGUI_API void PushID(const void* ptr_id); - IMGUI_API void PushID(int int_id); - IMGUI_API void PopID(); - IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself - IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end); - IMGUI_API ImGuiID GetID(const void* ptr_id); - - // Widgets: Text - IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text. - IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // simple formatted text - IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1); - IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...) IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor(); - IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(2); - IMGUI_API void TextDisabled(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); - IMGUI_API void TextDisabledV(const char* fmt, va_list args) IM_FMTLIST(1); - IMGUI_API void TextWrapped(const char* fmt, ...) IM_FMTARGS(1); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize(). - IMGUI_API void TextWrappedV(const char* fmt, va_list args) IM_FMTLIST(1); - IMGUI_API void LabelText(const char* label, const char* fmt, ...) IM_FMTARGS(2); // display text+label aligned the same way as value+label widgets - IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2); - IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text() - IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1); - IMGUI_API void Bullet(); // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses - - // Widgets: Main - IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0)); // button - IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text - IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size); - IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0)); - IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding - IMGUI_API bool Checkbox(const char* label, bool* v); - IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value); - IMGUI_API bool RadioButton(const char* label, bool active); - IMGUI_API bool RadioButton(const char* label, int* v, int v_button); - IMGUI_API bool Combo(const char* label, int* current_item, const char* const* items, int items_count, int height_in_items = -1); - IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1); // separate items with \0, end item-list with \0\0 - IMGUI_API bool Combo(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1); - IMGUI_API void PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), int stride = sizeof(float)); - IMGUI_API void PlotLines(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0)); - IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), int stride = sizeof(float)); - IMGUI_API void PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0)); - IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1,0), const char* overlay = NULL); - - // Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard. manually input values aren't clamped, can go off-bounds) - // For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x - IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound - IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", const char* display_format_max = NULL, float power = 1.0f); - IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_min >= v_max we have no bound - IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); - IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); - IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); - IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f", const char* display_format_max = NULL); - - // Widgets: Input with Keyboard - IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); - IMGUI_API bool InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0,0), ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); - IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0); - IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0); - - // Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard. manually input values aren't clamped, can go off-bounds) - IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // adjust display_format to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for logarithmic sliders - IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); - IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f"); - IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f"); - IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f"); - IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f"); - IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); - IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f"); - - // Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.) - // Note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can the pass the address of a first float element out of a contiguous structure, e.g. &myvector.x - IMGUI_API bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); - IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0); - IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); - IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL); - IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0)); // display a colored square/button, hover for details, return true when pressed. - IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. - - // Widgets: Trees - IMGUI_API bool TreeNode(const char* label); // if returning 'true' the node is open and the tree id is pushed into the id stack. user is responsible for calling TreePop(). - IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2); // read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet(). - IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2); // " - IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2); - IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2); - IMGUI_API bool TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0); - IMGUI_API bool TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); - IMGUI_API bool TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3); - IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); - IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); - IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call Push/Pop yourself for layout purpose - IMGUI_API void TreePush(const void* ptr_id = NULL); // " - IMGUI_API void TreePop(); // ~ Unindent()+PopId() - IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing() - IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode - IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiCond cond = 0); // set next TreeNode/CollapsingHeader open state. - IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). - IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header - - // Widgets: Selectable / Lists - IMGUI_API bool Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); // size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height - IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); - IMGUI_API bool ListBox(const char* label, int* current_item, const char* const* items, int items_count, int height_in_items = -1); - IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1); - IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0,0)); // use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards. - IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // " - IMGUI_API void ListBoxFooter(); // terminate the scrolling region - - // Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace) - IMGUI_API void Value(const char* prefix, bool b); - IMGUI_API void Value(const char* prefix, int v); - IMGUI_API void Value(const char* prefix, unsigned int v); - IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL); - - // Tooltips - IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set text tooltip under mouse-cursor, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip(). - IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); - IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of contents). - IMGUI_API void EndTooltip(); - - // Menus - IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true! - IMGUI_API void EndMainMenuBar(); - IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window). only call EndMenuBar() if this returns true! - IMGUI_API void EndMenuBar(); - IMGUI_API bool BeginMenu(const char* label, bool enabled = true); // create a sub-menu entry. only call EndMenu() if this returns true! - IMGUI_API void EndMenu(); - IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment - IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL - - // Popups - IMGUI_API void OpenPopup(const char* str_id); // call to mark popup as open (don't call every frame!). popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). - IMGUI_API bool OpenPopupOnItemClick(const char* str_id = NULL, int mouse_button = 1); // helper to open popup when clicked on last item. return true when just opened. - IMGUI_API bool BeginPopup(const char* str_id); // return true if the popup is open, and you can start outputting to it. only call EndPopup() if BeginPopup() returned true! - IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags extra_flags = 0); // modal dialog (block interactions behind the modal window, can't close the modal window by clicking outside) - IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! - IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, int mouse_button = 1, bool also_over_items = true); // helper to open and begin popup when clicked on current window. - IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // helper to open and begin popup when clicked in void (where there are no imgui windows). - IMGUI_API void EndPopup(); - IMGUI_API bool IsPopupOpen(const char* str_id); // return true if the popup is open - IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup. - - // Logging: all text output from interface is redirected to tty/file/clipboard. By default, tree nodes are automatically opened during logging. - IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty - IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file - IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard - IMGUI_API void LogFinish(); // stop logging (close file, etc.) - IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard - IMGUI_API void LogText(const char* fmt, ...) IM_FMTARGS(1); // pass text data straight to log (without being displayed) - - // Clipping - IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect); - IMGUI_API void PopClipRect(); - - // Styles - IMGUI_API void StyleColorsClassic(ImGuiStyle* dst = NULL); - IMGUI_API void StyleColorsDark(ImGuiStyle* dst = NULL); - IMGUI_API void StyleColorsLight(ImGuiStyle* dst = NULL); - - // Utilities - IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered by mouse (and usable)? - IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false) - IMGUI_API bool IsItemClicked(int mouse_button = 0); // is the last item clicked? (e.g. button/node just clicked on) - IMGUI_API bool IsItemVisible(); // is the last item visible? (aka not out of sight due to clipping/scrolling.) - IMGUI_API bool IsAnyItemHovered(); - IMGUI_API bool IsAnyItemActive(); - IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space - IMGUI_API ImVec2 GetItemRectMax(); // " - IMGUI_API ImVec2 GetItemRectSize(); // " - IMGUI_API void SetItemAllowOverlap(); // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area. - IMGUI_API bool IsWindowFocused(); // is current Begin()-ed window focused? - IMGUI_API bool IsWindowHovered(ImGuiHoveredFlags flags = 0); // is current Begin()-ed window hovered (and typically: not blocked by a popup/modal)? - IMGUI_API bool IsRootWindowFocused(); // is current Begin()-ed root window focused (root = top-most parent of a child, otherwise self)? - IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current Begin()-ed root window or any of its child (including current window) focused? - IMGUI_API bool IsAnyWindowHovered(); // is mouse hovering any visible window - IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped. - IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. - IMGUI_API float GetTime(); - IMGUI_API int GetFrameCount(); - IMGUI_API const char* GetStyleColorName(ImGuiCol idx); - IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f); // utility to find the closest point the last item bounding rectangle edge. useful to visually link items - IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f); - IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can. - - IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame - IMGUI_API void EndChildFrame(); - - IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in); - IMGUI_API ImU32 ColorConvertFloat4ToU32(const ImVec4& in); - IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v); - IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b); - - // Inputs - IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key] - IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. note that imgui doesn't know the semantic of each entry of io.KeyDown[]. Use your own indices/enums according to how your backend/engine stored them into KeyDown[]! - IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down). if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate - IMGUI_API bool IsKeyReleased(int user_key_index); // was key released (went from Down to !Down).. - IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate - IMGUI_API bool IsMouseDown(int button); // is mouse button held - IMGUI_API bool IsMouseClicked(int button, bool repeat = false); // did mouse button clicked (went from !Down to Down) - IMGUI_API bool IsMouseDoubleClicked(int button); // did mouse button double-clicked. a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime. - IMGUI_API bool IsMouseReleased(int button); // did mouse button released (went from Down to !Down) - IMGUI_API bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f); // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold - IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true); // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup. - IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // - IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls - IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve backup of mouse positioning at the time of opening popup we have BeginPopup() into - IMGUI_API ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); // dragging amount since clicking. if lock_threshold < -1.0f uses io.MouseDraggingThreshold - IMGUI_API void ResetMouseDragDelta(int button = 0); // - IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you - IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type - IMGUI_API void CaptureKeyboardFromApp(bool capture = true); // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application handle). e.g. force capture keyboard when your widget is being hovered. - IMGUI_API void CaptureMouseFromApp(bool capture = true); // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application handle). - - // Helpers functions to access functions pointers in ImGui::GetIO() - IMGUI_API void* MemAlloc(size_t sz); - IMGUI_API void MemFree(void* ptr); - IMGUI_API const char* GetClipboardText(); - IMGUI_API void SetClipboardText(const char* text); - - // Internal context access - if you want to use multiple context, share context between modules (e.g. DLL). There is a default context created and active by default. - // All contexts share a same ImFontAtlas by default. If you want different font atlas, you can new() them and overwrite the GetIO().Fonts variable of an ImGui context. - IMGUI_API const char* GetVersion(); - IMGUI_API ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void (*free_fn)(void*) = NULL); - IMGUI_API void DestroyContext(ImGuiContext* ctx); - IMGUI_API ImGuiContext* GetCurrentContext(); - IMGUI_API void SetCurrentContext(ImGuiContext* ctx); - -} // namespace ImGui - -// Flags for ImGui::Begin() -enum ImGuiWindowFlags_ -{ - // Default: 0 - ImGuiWindowFlags_NoTitleBar = 1 << 0, // Disable title-bar - ImGuiWindowFlags_NoResize = 1 << 1, // Disable user resizing with the lower-right grip - ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window - ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programatically) - ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel - ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it - ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame - //ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items (OBSOLETE! Use e.g. style.FrameBorderSize=1.0f to enable borders). - ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file - ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs, hovering test with pass through. - ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar - ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. - ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state - ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus) - ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) - ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) - ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) - // [Internal] - ImGuiWindowFlags_ChildWindow = 1 << 22, // Don't use! For internal use by BeginChild() - ImGuiWindowFlags_ComboBox = 1 << 23, // Don't use! For internal use by ComboBox() - ImGuiWindowFlags_Tooltip = 1 << 24, // Don't use! For internal use by BeginTooltip() - ImGuiWindowFlags_Popup = 1 << 25, // Don't use! For internal use by BeginPopup() - ImGuiWindowFlags_Modal = 1 << 26, // Don't use! For internal use by BeginPopupModal() - ImGuiWindowFlags_ChildMenu = 1 << 27 // Don't use! For internal use by BeginMenu() -}; - -// Flags for ImGui::InputText() -enum ImGuiInputTextFlags_ -{ - // Default: 0 - ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/ - ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef - ImGuiInputTextFlags_CharsUppercase = 1 << 2, // Turn a..z into A..Z - ImGuiInputTextFlags_CharsNoBlank = 1 << 3, // Filter out spaces, tabs - ImGuiInputTextFlags_AutoSelectAll = 1 << 4, // Select entire text when first taking mouse focus - ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, // Return 'true' when Enter is pressed (as opposed to when the value was modified) - ImGuiInputTextFlags_CallbackCompletion = 1 << 6, // Call user function on pressing TAB (for completion handling) - ImGuiInputTextFlags_CallbackHistory = 1 << 7, // Call user function on pressing Up/Down arrows (for history handling) - ImGuiInputTextFlags_CallbackAlways = 1 << 8, // Call user function every time. User code may query cursor position, modify text buffer. - ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character. - ImGuiInputTextFlags_AllowTabInput = 1 << 10, // Pressing TAB input a '\t' character into the text field - ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter). - ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, // Disable following the cursor horizontally - ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, // Insert mode - ImGuiInputTextFlags_ReadOnly = 1 << 14, // Read-only mode - ImGuiInputTextFlags_Password = 1 << 15, // Password mode, display all characters as '*' - // [Internal] - ImGuiInputTextFlags_Multiline = 1 << 20 // For internal use by InputTextMultiline() -}; - -// Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() -enum ImGuiTreeNodeFlags_ -{ - ImGuiTreeNodeFlags_Selected = 1 << 0, // Draw as selected - ImGuiTreeNodeFlags_Framed = 1 << 1, // Full colored frame (e.g. for CollapsingHeader) - ImGuiTreeNodeFlags_AllowOverlapMode = 1 << 2, // Hit testing to allow subsequent widgets to overlap this one - ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack - ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes) - ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, // Default node to be open - ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, // Need double-click to open node - ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. - ImGuiTreeNodeFlags_Leaf = 1 << 8, // No collapsing, no arrow (use as a convenience for leaf nodes). - ImGuiTreeNodeFlags_Bullet = 1 << 9, // Display a bullet instead of arrow - ImGuiTreeNodeFlags_FramePadding = 1 << 10, // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding(). - //ImGuITreeNodeFlags_SpanAllAvailWidth = 1 << 11, // FIXME: TODO: Extend hit box horizontally even if not framed - //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 12, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible - ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog -}; - -// Flags for ImGui::Selectable() -enum ImGuiSelectableFlags_ -{ - // Default: 0 - ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window - ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) - ImGuiSelectableFlags_AllowDoubleClick = 1 << 2 // Generate press events on double clicks too -}; - -// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered() -enum ImGuiHoveredFlags_ -{ - ImGuiHoveredFlags_Default = 0, // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them. - ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 0, // Return true even if a popup window is normally blocking access to this item/window - //ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 1, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet. - ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 2, // Return true even if an active item is blocking access to this item/window - ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 3, // Return true even if the position is overlapped by another window - ImGuiHoveredFlags_FlattenChilds = 1 << 4, // Treat all child windows as the same window (for IsWindowHovered()) - ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped -}; - -// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array -enum ImGuiKey_ -{ - ImGuiKey_Tab, // for tabbing through fields - ImGuiKey_LeftArrow, // for text edit - ImGuiKey_RightArrow,// for text edit - ImGuiKey_UpArrow, // for text edit - ImGuiKey_DownArrow, // for text edit - ImGuiKey_PageUp, - ImGuiKey_PageDown, - ImGuiKey_Home, // for text edit - ImGuiKey_End, // for text edit - ImGuiKey_Delete, // for text edit - ImGuiKey_Backspace, // for text edit - ImGuiKey_Enter, // for text edit - ImGuiKey_Escape, // for text edit - ImGuiKey_A, // for text edit CTRL+A: select all - ImGuiKey_C, // for text edit CTRL+C: copy - ImGuiKey_V, // for text edit CTRL+V: paste - ImGuiKey_X, // for text edit CTRL+X: cut - ImGuiKey_Y, // for text edit CTRL+Y: redo - ImGuiKey_Z, // for text edit CTRL+Z: undo - ImGuiKey_COUNT -}; - -// Enumeration for PushStyleColor() / PopStyleColor() -enum ImGuiCol_ -{ - ImGuiCol_Text, - ImGuiCol_TextDisabled, - ImGuiCol_WindowBg, // Background of normal windows - ImGuiCol_ChildBg, // Background of child windows - ImGuiCol_PopupBg, // Background of popups, menus, tooltips windows - ImGuiCol_Border, - ImGuiCol_BorderShadow, - ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input - ImGuiCol_FrameBgHovered, - ImGuiCol_FrameBgActive, - ImGuiCol_TitleBg, - ImGuiCol_TitleBgActive, - ImGuiCol_TitleBgCollapsed, - ImGuiCol_MenuBarBg, - ImGuiCol_ScrollbarBg, - ImGuiCol_ScrollbarGrab, - ImGuiCol_ScrollbarGrabHovered, - ImGuiCol_ScrollbarGrabActive, - ImGuiCol_CheckMark, - ImGuiCol_SliderGrab, - ImGuiCol_SliderGrabActive, - ImGuiCol_Button, - ImGuiCol_ButtonHovered, - ImGuiCol_ButtonActive, - ImGuiCol_Header, - ImGuiCol_HeaderHovered, - ImGuiCol_HeaderActive, - ImGuiCol_Separator, - ImGuiCol_SeparatorHovered, - ImGuiCol_SeparatorActive, - ImGuiCol_ResizeGrip, - ImGuiCol_ResizeGripHovered, - ImGuiCol_ResizeGripActive, - ImGuiCol_CloseButton, - ImGuiCol_CloseButtonHovered, - ImGuiCol_CloseButtonActive, - ImGuiCol_PlotLines, - ImGuiCol_PlotLinesHovered, - ImGuiCol_PlotHistogram, - ImGuiCol_PlotHistogramHovered, - ImGuiCol_TextSelectedBg, - ImGuiCol_ModalWindowDarkening, // darken entire screen when a modal window is active - ImGuiCol_COUNT - - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //, ImGuiCol_ComboBg = ImGuiCol_PopupBg // ComboBg has been merged with PopupBg, so a redirect isn't accurate. - , ImGuiCol_ChildWindowBg = ImGuiCol_ChildBg, ImGuiCol_Column = ImGuiCol_Separator, ImGuiCol_ColumnHovered = ImGuiCol_SeparatorHovered, ImGuiCol_ColumnActive = ImGuiCol_SeparatorActive -#endif -}; - -// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure. -// NB: the enum only refers to fields of ImGuiStyle which makes sense to be pushed/poped inside UI code. During initialization, feel free to just poke into ImGuiStyle directly. -// NB: if changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. -enum ImGuiStyleVar_ -{ - // Enum name ......................// Member in ImGuiStyle structure (see ImGuiStyle for descriptions) - ImGuiStyleVar_Alpha, // float Alpha - ImGuiStyleVar_WindowPadding, // ImVec2 WindowPadding - ImGuiStyleVar_WindowRounding, // float WindowRounding - ImGuiStyleVar_WindowBorderSize, // float WindowBorderSize - ImGuiStyleVar_WindowMinSize, // ImVec2 WindowMinSize - ImGuiStyleVar_ChildRounding, // float ChildRounding - ImGuiStyleVar_ChildBorderSize, // float ChildBorderSize - ImGuiStyleVar_PopupRounding, // float PopupRounding - ImGuiStyleVar_PopupBorderSize, // float PopupBorderSize - ImGuiStyleVar_FramePadding, // ImVec2 FramePadding - ImGuiStyleVar_FrameRounding, // float FrameRounding - ImGuiStyleVar_FrameBorderSize, // float FrameBorderSize - ImGuiStyleVar_ItemSpacing, // ImVec2 ItemSpacing - ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ItemInnerSpacing - ImGuiStyleVar_IndentSpacing, // float IndentSpacing - ImGuiStyleVar_GrabMinSize, // float GrabMinSize - ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign - ImGuiStyleVar_ViewId, // uint8_t - ImGuiStyleVar_Count_ - - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiStyleVar_ChildWindowRounding = ImGuiStyleVar_ChildRounding -#endif -}; - -// Enumeration for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton() -enum ImGuiColorEditFlags_ -{ - ImGuiColorEditFlags_NoAlpha = 1 << 1, // // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer). - ImGuiColorEditFlags_NoPicker = 1 << 2, // // ColorEdit: disable picker when clicking on colored square. - ImGuiColorEditFlags_NoOptions = 1 << 3, // // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview. - ImGuiColorEditFlags_NoSmallPreview = 1 << 4, // // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs) - ImGuiColorEditFlags_NoInputs = 1 << 5, // // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square). - ImGuiColorEditFlags_NoTooltip = 1 << 6, // // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview. - ImGuiColorEditFlags_NoLabel = 1 << 7, // // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker). - ImGuiColorEditFlags_NoSidePreview = 1 << 8, // // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead. - // User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup. - ImGuiColorEditFlags_AlphaBar = 1 << 9, // // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker. - ImGuiColorEditFlags_AlphaPreview = 1 << 10, // // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque. - ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 11, // // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque. - ImGuiColorEditFlags_HDR = 1 << 12, // // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well). - ImGuiColorEditFlags_RGB = 1 << 13, // [Inputs] // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX. - ImGuiColorEditFlags_HSV = 1 << 14, // [Inputs] // " - ImGuiColorEditFlags_HEX = 1 << 15, // [Inputs] // " - ImGuiColorEditFlags_Uint8 = 1 << 16, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. - ImGuiColorEditFlags_Float = 1 << 17, // [DataType] // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers. - ImGuiColorEditFlags_PickerHueBar = 1 << 18, // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value. - ImGuiColorEditFlags_PickerHueWheel = 1 << 19, // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value. - // Internals/Masks - ImGuiColorEditFlags__InputsMask = ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_HSV|ImGuiColorEditFlags_HEX, - ImGuiColorEditFlags__DataTypeMask = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_Float, - ImGuiColorEditFlags__PickerMask = ImGuiColorEditFlags_PickerHueWheel|ImGuiColorEditFlags_PickerHueBar, - ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_RGB|ImGuiColorEditFlags_PickerHueBar // Change application default using SetColorEditOptions() -}; - -// Enumeration for GetMouseCursor() -enum ImGuiMouseCursor_ -{ - ImGuiMouseCursor_None = -1, - ImGuiMouseCursor_Arrow = 0, - ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. - ImGuiMouseCursor_Move, // Unused - ImGuiMouseCursor_ResizeNS, // Unused - ImGuiMouseCursor_ResizeEW, // When hovering over a column - ImGuiMouseCursor_ResizeNESW, // Unused - ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window - ImGuiMouseCursor_Count_ -}; - -// Condition for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions -// All those functions treat 0 as a shortcut to ImGuiCond_Always. From the point of view of the user use this as an enum (don't combine multiple values into flags). -enum ImGuiCond_ -{ - ImGuiCond_Always = 1 << 0, // Set the variable - ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call with succeed) - ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the window has no saved data (if doesn't exist in the .ini file) - ImGuiCond_Appearing = 1 << 3 // Set the variable if the window is appearing after being hidden/inactive (or the first time) - - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiSetCond_Always = ImGuiCond_Always, ImGuiSetCond_Once = ImGuiCond_Once, ImGuiSetCond_FirstUseEver = ImGuiCond_FirstUseEver, ImGuiSetCond_Appearing = ImGuiCond_Appearing -#endif -}; - -struct ImGuiStyle -{ - float Alpha; // Global alpha applies to everything in ImGui - ImVec2 WindowPadding; // Padding within a window - float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows - float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly) - ImVec2 WindowMinSize; // Minimum window size - ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. - float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows. - float ChildBorderSize; // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly) - float PopupRounding; // Radius of popup window corners rounding. - float PopupBorderSize; // Thickness of border around popup windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly) - ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets) - float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets). - float FrameBorderSize; // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly) - ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines - ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label) - ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much! - float IndentSpacing; // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2). - float ColumnsMinSpacing; // Minimum horizontal spacing between two columns - float ScrollbarSize; // Width of the vertical scrollbar, Height of the horizontal scrollbar - float ScrollbarRounding; // Radius of grab corners for scrollbar - float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar - float ViewId; - float GrabRounding; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. - ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered. - ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows. - ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. - bool AntiAliasedLines; // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU. - bool AntiAliasedShapes; // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.) - float CurveTessellationTol; // Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. - ImVec4 Colors[ImGuiCol_COUNT]; - - IMGUI_API ImGuiStyle(); - IMGUI_API void ScaleAllSizes(float scale_factor); -}; - -// This is where your app communicate with ImGui. Access via ImGui::GetIO(). -// Read 'Programmer guide' section in .cpp file for general usage. -struct ImGuiIO -{ - //------------------------------------------------------------------ - // Settings (fill once) // Default value: - //------------------------------------------------------------------ - - ImVec2 DisplaySize; // // Display size, in pixels. For clamping windows positions. - float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. - float IniSavingRate; // = 5.0f // Maximum time between saving positions/sizes to .ini file, in seconds. - const char* IniFilename; // = "imgui.ini" // Path to .ini file. NULL to disable .ini saving. - const char* LogFilename; // = "imgui_log.txt" // Path to .log file (default parameter to ImGui::LogToFile when no file is specified). - float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. - float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. - float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging - int KeyMap[ImGuiKey_COUNT]; // // Map of indices into the KeysDown[512] entries array - float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). - float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds. - void* UserData; // = NULL // Store your own data for retrieval by callbacks. - - ImFontAtlas* Fonts; // // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array. - float FontGlobalScale; // = 1.0f // Global scale all fonts - bool FontAllowUserScaling; // = false // Allow user scaling text of individual window with CTRL+Wheel. - ImFont* FontDefault; // = NULL // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0]. - ImVec2 DisplayFramebufferScale; // = (1.0f,1.0f) // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui. - ImVec2 DisplayVisibleMin; // (0.0f,0.0f) // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area. - ImVec2 DisplayVisibleMax; // (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize - - // Advanced/subtle behaviors - bool OptMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl - bool OptCursorBlink; // = true // Enable blinking cursor, for users who consider it annoying. - - //------------------------------------------------------------------ - // Settings (User Functions) - //------------------------------------------------------------------ - - // Rendering function, will be called in Render(). - // Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer. - // See example applications if you are unsure of how to implement this. - void (*RenderDrawListsFn)(ImDrawData* data); - - // Optional: access OS clipboard - // (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) - const char* (*GetClipboardTextFn)(void* user_data); - void (*SetClipboardTextFn)(void* user_data, const char* text); - void* ClipboardUserData; - - // Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer. - // (default to posix malloc/free) - void* (*MemAllocFn)(size_t sz); - void (*MemFreeFn)(void* ptr); - - // Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows) - // (default to use native imm32 api on Windows) - void (*ImeSetInputScreenPosFn)(int x, int y); - void* ImeWindowHandle; // (Windows) Set this to your HWND to get automatic IME cursor positioning. - - //------------------------------------------------------------------ - // Input - Fill before calling NewFrame() - //------------------------------------------------------------------ - - ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.) - bool MouseDown[5]; // Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. - float MouseWheel; // Mouse wheel: 1 unit scrolls about 5 lines text. - bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). - bool KeyCtrl; // Keyboard modifier pressed: Control - bool KeyShift; // Keyboard modifier pressed: Shift - bool KeyAlt; // Keyboard modifier pressed: Alt - bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows - bool KeysDown[512]; // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data) - ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper. - - // Functions - IMGUI_API void AddInputCharacter(ImWchar c); // Add new character into InputCharacters[] - IMGUI_API void AddInputCharactersUTF8(const char* utf8_chars); // Add new characters into InputCharacters[] from an UTF-8 string - inline void ClearInputCharacters() { InputCharacters[0] = 0; } // Clear the text input buffer manually - - //------------------------------------------------------------------ - // Output - Retrieve after calling NewFrame() - //------------------------------------------------------------------ - - bool WantCaptureMouse; // When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. This is set by ImGui when it wants to use your mouse (e.g. unclicked mouse is hovering a window, or a widget is active). - bool WantCaptureKeyboard; // When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. This is set by ImGui when it wants to use your keyboard inputs. - bool WantTextInput; // Mobile/console: when io.WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). - bool WantMoveMouse; // [BETA-NAV] MousePos has been altered, back-end should reposition mouse on next frame. Set only when 'NavMovesMouse=true'. - float Framerate; // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames - int MetricsAllocs; // Number of active memory allocations - int MetricsRenderVertices; // Vertices output during last call to Render() - int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 - int MetricsActiveWindows; // Number of visible root windows (exclude child windows) - ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. - - //------------------------------------------------------------------ - // [Internal] ImGui will maintain those fields. Forward compatibility not guaranteed! - //------------------------------------------------------------------ - - ImVec2 MousePosPrev; // Previous mouse position temporary storage (nb: not for public use, set to MousePos in NewFrame()) - ImVec2 MouseClickedPos[5]; // Position at time of clicking - float MouseClickedTime[5]; // Time of last click (used to figure out double-click) - bool MouseClicked[5]; // Mouse button went from !Down to Down - bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? - bool MouseReleased[5]; // Mouse button went from Down to !Down - bool MouseDownOwned[5]; // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds. - float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) - float MouseDownDurationPrev[5]; // Previous time the mouse button has been down - ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point - float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point - float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed) - float KeysDownDurationPrev[512]; // Previous duration the key has been down - - IMGUI_API ImGuiIO(); -}; - -//----------------------------------------------------------------------------- -// Obsolete functions (Will be removed! Also see 'API BREAKING CHANGES' section in imgui.cpp) -//----------------------------------------------------------------------------- - -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS -namespace ImGui -{ - static inline bool IsRootWindowOrAnyChildHovered(ImGuiHoveredFlags flags = 0) { return IsItemHovered(flags | ImGuiHoveredFlags_FlattenChilds); } // OBSOLETE 1.53+ use flags directly - bool Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override = -1.0f, ImGuiWindowFlags flags = 0); // OBSOLETE 1.52+. use SetNextWindowSize() instead if you want to set a window size. - static inline void AlignFirstTextHeightToWidgets() { AlignTextToFramePadding(); } // OBSOLETE 1.52+ - static inline void SetNextWindowPosCenter(ImGuiCond cond = 0) { SetNextWindowPos(ImVec2(GetIO().DisplaySize.x * 0.5f, GetIO().DisplaySize.y * 0.5f), cond, ImVec2(0.5f, 0.5f)); } // OBSOLETE 1.52+ - static inline bool IsItemHoveredRect() { return IsItemHovered(ImGuiHoveredFlags_RectOnly); } // OBSOLETE 1.51+ - static inline bool IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // OBSOLETE 1.51+. This was partly broken. You probably wanted to use ImGui::GetIO().WantCaptureMouse instead. - static inline bool IsMouseHoveringAnyWindow() { return IsAnyWindowHovered(); } // OBSOLETE 1.51+ - static inline bool IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETE 1.51+ - static inline bool CollapsingHeader(const char* label, const char* str_id, bool framed = true, bool default_open = false) { (void)str_id; (void)framed; ImGuiTreeNodeFlags default_open_flags = 1 << 5; return CollapsingHeader(label, (default_open ? default_open_flags : 0)); } // OBSOLETE 1.49+ - static inline ImFont* GetWindowFont() { return GetFont(); } // OBSOLETE 1.48+ - static inline float GetWindowFontSize() { return GetFontSize(); } // OBSOLETE 1.48+ - static inline void SetScrollPosHere() { SetScrollHere(); } // OBSOLETE 1.42+ -} -#endif - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug). -// Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code! -template -class ImVector -{ -public: - int Size; - int Capacity; - T* Data; - - typedef T value_type; - typedef value_type* iterator; - typedef const value_type* const_iterator; - - ImVector() { Size = Capacity = 0; Data = NULL; } - ~ImVector() { if (Data) ImGui::MemFree(Data); } - - inline bool empty() const { return Size == 0; } - inline int size() const { return Size; } - inline int capacity() const { return Capacity; } - - inline value_type& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; } - inline const value_type& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; } - - inline void clear() { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } } - inline iterator begin() { return Data; } - inline const_iterator begin() const { return Data; } - inline iterator end() { return Data + Size; } - inline const_iterator end() const { return Data + Size; } - inline value_type& front() { IM_ASSERT(Size > 0); return Data[0]; } - inline const value_type& front() const { IM_ASSERT(Size > 0); return Data[0]; } - inline value_type& back() { IM_ASSERT(Size > 0); return Data[Size-1]; } - inline const value_type& back() const { IM_ASSERT(Size > 0); return Data[Size-1]; } - inline void swap(ImVector& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; } - - inline int _grow_capacity(int sz) const { int new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > sz ? new_capacity : sz; } - - inline void resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; } - inline void resize(int new_size, const T& v){ if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) Data[n] = v; Size = new_size; } - inline void reserve(int new_capacity) - { - if (new_capacity <= Capacity) return; - T* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(T)); - if (Data) - memcpy(new_data, Data, (size_t)Size * sizeof(T)); - ImGui::MemFree(Data); - Data = new_data; - Capacity = new_capacity; - } - - inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size+1)); Data[Size++] = v; } - inline void pop_back() { IM_ASSERT(Size > 0); Size--; } - inline void push_front(const value_type& v) { if (Size == 0) push_back(v); else insert(Data, v); } - - inline iterator erase(const_iterator it) { IM_ASSERT(it >= Data && it < Data+Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; } - inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; } -}; - -// Helper: execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. -// Usage: -// static ImGuiOnceUponAFrame oaf; -// if (oaf) -// ImGui::Text("This will be called only once per frame"); -struct ImGuiOnceUponAFrame -{ - ImGuiOnceUponAFrame() { RefFrame = -1; } - mutable int RefFrame; - operator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; } -}; - -// Helper macro for ImGuiOnceUponAFrame. Attention: The macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces. -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // Will obsolete -#define IMGUI_ONCE_UPON_A_FRAME static ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf) -#endif - -// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" -struct ImGuiTextFilter -{ - struct TextRange - { - const char* b; - const char* e; - - TextRange() { b = e = NULL; } - TextRange(const char* _b, const char* _e) { b = _b; e = _e; } - const char* begin() const { return b; } - const char* end() const { return e; } - bool empty() const { return b == e; } - char front() const { return *b; } - static bool is_blank(char c) { return c == ' ' || c == '\t'; } - void trim_blanks() { while (b < e && is_blank(*b)) b++; while (e > b && is_blank(*(e-1))) e--; } - IMGUI_API void split(char separator, ImVector& out); - }; - - char InputBuf[256]; - ImVector Filters; - int CountGrep; - - IMGUI_API ImGuiTextFilter(const char* default_filter = ""); - IMGUI_API bool Draw(const char* label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build - IMGUI_API bool PassFilter(const char* text, const char* text_end = NULL) const; - IMGUI_API void Build(); - void Clear() { InputBuf[0] = 0; Build(); } - bool IsActive() const { return !Filters.empty(); } -}; - -// Helper: Text buffer for logging/accumulating text -struct ImGuiTextBuffer -{ - ImVector Buf; - - ImGuiTextBuffer() { Buf.push_back(0); } - inline char operator[](int i) { return Buf.Data[i]; } - const char* begin() const { return &Buf.front(); } - const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator - int size() const { return Buf.Size - 1; } - bool empty() { return Buf.Size <= 1; } - void clear() { Buf.clear(); Buf.push_back(0); } - void reserve(int capacity) { Buf.reserve(capacity); } - const char* c_str() const { return Buf.Data; } - IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2); - IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2); -}; - -// Helper: Simple Key->value storage -// Typically you don't have to worry about this since a storage is held within each Window. -// We use it to e.g. store collapse state for a tree (Int 0/1), store color edit options. -// This is optimized for efficient reading (dichotomy into a contiguous buffer), rare writing (typically tied to user interactions) -// You can use it as custom user storage for temporary values. Declare your own storage if, for example: -// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state). -// - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient) -// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types. -struct ImGuiStorage -{ - struct Pair - { - ImGuiID key; - union { int val_i; float val_f; void* val_p; }; - Pair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; } - Pair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; } - Pair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; } - }; - ImVector Data; - - // - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N) - // - Set***() functions find pair, insertion on demand if missing. - // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair. - void Clear() { Data.clear(); } - IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; - IMGUI_API void SetInt(ImGuiID key, int val); - IMGUI_API bool GetBool(ImGuiID key, bool default_val = false) const; - IMGUI_API void SetBool(ImGuiID key, bool val); - IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; - IMGUI_API void SetFloat(ImGuiID key, float val); - IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL - IMGUI_API void SetVoidPtr(ImGuiID key, void* val); - - // - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set. - // - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer. - // - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct) - // float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat("var", pvar, 0, 100.0f); some_var += *pvar; - IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0); - IMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false); - IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f); - IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL); - - // Use on your own storage if you know only integer are being stored (open/close all tree nodes) - IMGUI_API void SetAllInt(int val); - - // For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once. - IMGUI_API void BuildSortByKey(); -}; - -// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used and the corresponding callback is triggered. -struct ImGuiTextEditCallbackData -{ - ImGuiInputTextFlags EventFlag; // One of ImGuiInputTextFlags_Callback* // Read-only - ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only - void* UserData; // What user passed to InputText() // Read-only - bool ReadOnly; // Read-only mode // Read-only - - // CharFilter event: - ImWchar EventChar; // Character input // Read-write (replace character or set to zero) - - // Completion,History,Always events: - // If you modify the buffer contents make sure you update 'BufTextLen' and set 'BufDirty' to true. - ImGuiKey EventKey; // Key pressed (Up/Down/TAB) // Read-only - char* Buf; // Current text buffer // Read-write (pointed data only, can't replace the actual pointer) - int BufTextLen; // Current text length in bytes // Read-write - int BufSize; // Maximum text length in bytes // Read-only - bool BufDirty; // Set if you modify Buf/BufTextLen!! // Write - int CursorPos; // // Read-write - int SelectionStart; // // Read-write (== to SelectionEnd when no selection) - int SelectionEnd; // // Read-write - - // NB: Helper functions for text manipulation. Calling those function loses selection. - IMGUI_API void DeleteChars(int pos, int bytes_count); - IMGUI_API void InsertChars(int pos, const char* text, const char* text_end = NULL); - bool HasSelection() const { return SelectionStart != SelectionEnd; } -}; - -// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin(). -// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. -struct ImGuiSizeConstraintCallbackData -{ - void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints() - ImVec2 Pos; // Read-only. Window position, for reference. - ImVec2 CurrentSize; // Read-only. Current window size. - ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. -}; - -// Helpers macros to generate 32-bits encoded colors -#ifdef IMGUI_USE_BGRA_PACKED_COLOR -#define IM_COL32_R_SHIFT 16 -#define IM_COL32_G_SHIFT 8 -#define IM_COL32_B_SHIFT 0 -#define IM_COL32_A_SHIFT 24 -#define IM_COL32_A_MASK 0xFF000000 -#else -#define IM_COL32_R_SHIFT 0 -#define IM_COL32_G_SHIFT 8 -#define IM_COL32_B_SHIFT 16 -#define IM_COL32_A_SHIFT 24 -#define IM_COL32_A_MASK 0xFF000000 -#endif -#define IM_COL32(R,G,B,A) (((ImU32)(A)<>IM_COL32_R_SHIFT)&0xFF) * sc; Value.y = (float)((rgba>>IM_COL32_G_SHIFT)&0xFF) * sc; Value.z = (float)((rgba>>IM_COL32_B_SHIFT)&0xFF) * sc; Value.w = (float)((rgba>>IM_COL32_A_SHIFT)&0xFF) * sc; } - ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } - ImColor(const ImVec4& col) { Value = col; } - inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } - inline operator ImVec4() const { return Value; } - - // FIXME-OBSOLETE: May need to obsolete/cleanup those helpers. - inline void SetHSV(float h, float s, float v, float a = 1.0f){ ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; } - static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r,g,b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r,g,b,a); } -}; - -// Helper: Manually clip large list of items. -// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all. -// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. -// ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null. -// Usage: -// ImGuiListClipper clipper(1000); // we have 1000 elements, evenly spaced. -// while (clipper.Step()) -// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) -// ImGui::Text("line number %d", i); -// - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor). -// - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element. -// - (Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.) -// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop. -struct ImGuiListClipper -{ - float StartPosY; - float ItemsHeight; - int ItemsCount, StepNo, DisplayStart, DisplayEnd; - - // items_count: Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step). - // items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetItemsLineHeightWithSpacing(). - // If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step(). - ImGuiListClipper(int items_count = -1, float items_height = -1.0f) { Begin(items_count, items_height); } // NB: Begin() initialize every fields (as we allow user to call Begin/End multiple times on a same instance if they want). - ~ImGuiListClipper() { IM_ASSERT(ItemsCount == -1); } // Assert if user forgot to call End() or Step() until false. - - IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items. - IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1. - IMGUI_API void End(); // Automatically called on the last call of Step() that returns false. -}; - -//----------------------------------------------------------------------------- -// Draw List -// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. -//----------------------------------------------------------------------------- - -// Draw callbacks for advanced uses. -// NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that) -// Draw callback may be useful for example, A) Change your GPU render state, B) render a complex 3D scene inside a UI element (without an intermediate texture/render target), etc. -// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) cmd.UserCallback(parent_list, cmd); else RenderTriangles()' -typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); - -// Typically, 1 command = 1 gpu draw call (unless command is a callback) -struct ImDrawCmd -{ - unsigned int ElemCount; // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. - ImVec4 ClipRect; // Clipping rectangle (x1, y1, x2, y2) - ImTextureID TextureId; // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas. - ImDrawCallback UserCallback; // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. - void* UserCallbackData; // The draw callback code can access this. - unsigned char ViewId; - - ImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = -8192.0f; ClipRect.z = ClipRect.w = +8192.0f; TextureId = NULL; UserCallback = NULL; UserCallbackData = NULL; ViewId = 0; } -}; - -// Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h) -#ifndef ImDrawIdx -typedef unsigned short ImDrawIdx; -#endif - -// Vertex layout -#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT -struct ImDrawVert -{ - ImVec2 pos; - ImVec2 uv; - ImU32 col; -}; -#else -// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h -// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. -// The type has to be described within the macro (you can either declare the struct or use a typedef) -// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM. -IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT; -#endif - -// Draw channels are used by the Columns API to "split" the render list into different channels while building, so items of each column can be batched together. -// You can also use them to simulate drawing layers and submit primitives in a different order than how they will be rendered. -struct ImDrawChannel -{ - ImVector CmdBuffer; - ImVector IdxBuffer; -}; - -enum ImDrawCornerFlags_ -{ - ImDrawCornerFlags_TopLeft = 1 << 0, // 0x1 - ImDrawCornerFlags_TopRight = 1 << 1, // 0x2 - ImDrawCornerFlags_BotLeft = 1 << 2, // 0x4 - ImDrawCornerFlags_BotRight = 1 << 3, // 0x8 - ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight, // 0x3 - ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight, // 0xC - ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft, // 0x5 - ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight, // 0xA - ImDrawCornerFlags_All = 0xF // In your function calls you may use ~0 (= all bits sets) instead of ImDrawCornerFlags_All, as a convenience -}; - -// Draw command list -// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering. -// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future. -// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives. -// You can interleave normal ImGui:: calls and adding primitives to the current draw list. -// All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), however you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well) -// Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions). -struct ImDrawList -{ - // This is what you have to render - ImVector CmdBuffer; // Commands. Typically 1 command = 1 GPU draw call. - ImVector IdxBuffer; // Index buffer. Each command consume ImDrawCmd::ElemCount of those - ImVector VtxBuffer; // Vertex buffer. - - // [Internal, used while building lists] - const char* _OwnerName; // Pointer to owner window's name for debugging - unsigned int _VtxCurrentIdx; // [Internal] == VtxBuffer.Size - ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) - ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) - ImVector _ClipRectStack; // [Internal] - ImVector _TextureIdStack; // [Internal] - ImVector _Path; // [Internal] current path building - int _ChannelsCurrent; // [Internal] current channel number (0) - int _ChannelsCount; // [Internal] number of active channels (1+) - ImVector _Channels; // [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size) - - ImDrawList() { _OwnerName = NULL; Clear(); } - ~ImDrawList() { ClearFreeMemory(); } - IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) - IMGUI_API void PushClipRectFullScreen(); - IMGUI_API void PopClipRect(); - IMGUI_API void PushTextureID(const ImTextureID& texture_id); - IMGUI_API void PopTextureID(); - inline ImVec2 GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); } - inline ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); } - - // Primitives - IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f); - IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All, float thickness = 1.0f); // a: upper-left, b: lower-right, rounding_corners_flags: 4-bits corresponding to which corner to round - IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); // a: upper-left, b: lower-right - IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left); - IMGUI_API void AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f); - IMGUI_API void AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col); - IMGUI_API void AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness = 1.0f); - IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col); - IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12, float thickness = 1.0f); - IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12); - IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); - IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL); - IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a = ImVec2(0,0), const ImVec2& uv_b = ImVec2(1,1), ImU32 col = 0xFFFFFFFF); - IMGUI_API void AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a = ImVec2(0,0), const ImVec2& uv_b = ImVec2(1,0), const ImVec2& uv_c = ImVec2(1,1), const ImVec2& uv_d = ImVec2(0,1), ImU32 col = 0xFFFFFFFF); - IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col, float rounding, int rounding_corners = ImDrawCornerFlags_All); - IMGUI_API void AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness, bool anti_aliased); - IMGUI_API void AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col, bool anti_aliased); - IMGUI_API void AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0); - - // Stateful path API, add points then finish with PathFill() or PathStroke() - inline void PathClear() { _Path.resize(0); } - inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); } - inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path[_Path.Size-1], &pos, 8) != 0) _Path.push_back(pos); } - inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col, true); PathClear(); } - inline void PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness, true); PathClear(); } - IMGUI_API void PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10); - IMGUI_API void PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle - IMGUI_API void PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0); - IMGUI_API void PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All); - - // Channels - // - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives) - // - Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end) - IMGUI_API void ChannelsSplit(int channels_count); - IMGUI_API void ChannelsMerge(); - IMGUI_API void ChannelsSetCurrent(int channel_index); - - // Advanced - IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles. - IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible - - // Internal helpers - // NB: all primitives needs to be reserved via PrimReserve() beforehand! - IMGUI_API void Clear(); - IMGUI_API void ClearFreeMemory(); - IMGUI_API void PrimReserve(int idx_count, int vtx_count); - IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) - IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); - IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); - inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; } - inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } - inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } - IMGUI_API void UpdateClipRect(); - IMGUI_API void UpdateTextureID(); -}; - -// All draw data to render an ImGui frame -struct ImDrawData -{ - bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. - ImDrawList** CmdLists; - int CmdListsCount; - int TotalVtxCount; // For convenience, sum of all cmd_lists vtx_buffer.Size - int TotalIdxCount; // For convenience, sum of all cmd_lists idx_buffer.Size - - // Functions - ImDrawData() { Valid = false; CmdLists = NULL; CmdListsCount = TotalVtxCount = TotalIdxCount = 0; } - IMGUI_API void DeIndexAllBuffers(); // For backward compatibility or convenience: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering! - IMGUI_API void ScaleClipRects(const ImVec2& sc); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution. -}; - -struct ImFontConfig -{ - void* FontData; // // TTF/OTF data - int FontDataSize; // // TTF/OTF data size - bool FontDataOwnedByAtlas; // true // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself). - int FontNo; // 0 // Index of font within TTF/OTF file - float SizePixels; // // Size in pixels for rasterizer. - int OversampleH, OversampleV; // 3, 1 // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis. - bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. - ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. - ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input. - const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. - bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. - unsigned int RasterizerFlags; // 0x00 // Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one. - float RasterizerMultiply; // 1.0f // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable. - - // [Internal] - char Name[32]; // Name (strictly to ease debugging) - ImFont* DstFont; - - IMGUI_API ImFontConfig(); -}; - -struct ImFontGlyph -{ - ImWchar Codepoint; // 0x0000..0xFFFF - float AdvanceX; // Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in) - float X0, Y0, X1, Y1; // Glyph corners - float U0, V0, U1, V1; // Texture coordinates -}; - -// Load and rasterize multiple TTF/OTF fonts into a same texture. -// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering. -// We also add custom graphic data into the texture that serves for ImGui. -// 1. (Optional) Call AddFont*** functions. If you don't call any, the default font will be loaded for you. -// 2. Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data. -// 3. Upload the pixels data into a texture within your graphics system. -// 4. Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture. This value will be passed back to you during rendering to identify the texture. -// IMPORTANT: If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the ImFont is build (when calling GetTextData*** or Build()). We only copy the pointer, not the data. -struct ImFontAtlas -{ - IMGUI_API ImFontAtlas(); - IMGUI_API ~ImFontAtlas(); - IMGUI_API ImFont* AddFont(const ImFontConfig* font_cfg); - IMGUI_API ImFont* AddFontDefault(const ImFontConfig* font_cfg = NULL); - IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); - IMGUI_API ImFont* AddFontFromMemoryTTF(void* font_data, int font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after Build(). Set font_cfg->FontDataOwnedByAtlas to false to keep ownership. - IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp. - IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter. - IMGUI_API void ClearTexData(); // Clear the CPU-side texture data. Saves RAM once the texture has been copied to graphics memory. - IMGUI_API void ClearInputData(); // Clear the input TTF data (inc sizes, glyph ranges) - IMGUI_API void ClearFonts(); // Clear the ImGui-side font data (glyphs storage, UV coordinates) - IMGUI_API void Clear(); // Clear all - - // Build atlas, retrieve pixel data. - // User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID(). - // RGBA32 format is provided for convenience and compatibility, but note that unless you use CustomRect to draw color data, the RGB pixels emitted from Fonts will all be white (~75% of waste). - // Pitch = Width * BytesPerPixels - IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions. - IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel - IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel - void SetTexID(ImTextureID id) { TexID = id; } - - //------------------------------------------- - // Glyph Ranges - //------------------------------------------- - - // Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list) - // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. - IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin - IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters - IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs - IMGUI_API const ImWchar* GetGlyphRangesChinese(); // Default + Japanese + full set of about 21000 CJK Unified Ideographs - IMGUI_API const ImWchar* GetGlyphRangesCyrillic(); // Default + about 400 Cyrillic characters - IMGUI_API const ImWchar* GetGlyphRangesThai(); // Default + Thai characters - - // Helpers to build glyph ranges from text data. Feed your application strings/characters to it then call BuildRanges(). - struct GlyphRangesBuilder - { - ImVector UsedChars; // Store 1-bit per Unicode code point (0=unused, 1=used) - GlyphRangesBuilder() { UsedChars.resize(0x10000 / 8); memset(UsedChars.Data, 0, 0x10000 / 8); } - bool GetBit(int n) { return (UsedChars[n >> 3] & (1 << (n & 7))) != 0; } - void SetBit(int n) { UsedChars[n >> 3] |= 1 << (n & 7); } // Set bit 'c' in the array - void AddChar(ImWchar c) { SetBit(c); } // Add character - IMGUI_API void AddText(const char* text, const char* text_end = NULL); // Add string (each character of the UTF-8 string are added) - IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault) to force add all of ASCII/Latin+Ext - IMGUI_API void BuildRanges(ImVector* out_ranges); // Output new ranges - }; - - //------------------------------------------- - // Custom Rectangles/Glyphs API - //------------------------------------------- - - // You can request arbitrary rectangles to be packed into the atlas, for your own purposes. After calling Build(), you can query the rectangle position and render your pixels. - // You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), so you can render e.g. custom colorful icons and use them as regular glyphs. - struct CustomRect - { - unsigned int ID; // Input // User ID. Use <0x10000 to map into a font glyph, >=0x10000 for other/internal/custom texture data. - unsigned short Width, Height; // Input // Desired rectangle dimension - unsigned short X, Y; // Output // Packed position in Atlas - float GlyphAdvanceX; // Input // For custom font glyphs only (ID<0x10000): glyph xadvance - ImVec2 GlyphOffset; // Input // For custom font glyphs only (ID<0x10000): glyph display offset - ImFont* Font; // Input // For custom font glyphs only (ID<0x10000): target font - CustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0,0); Font = NULL; } - bool IsPacked() const { return X != 0xFFFF; } - }; - - IMGUI_API int AddCustomRectRegular(unsigned int id, int width, int height); // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList - IMGUI_API int AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0,0)); // Id needs to be < 0x10000 to register a rectangle to map into a specific font. - IMGUI_API void CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max); - const CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; } - - //------------------------------------------- - // Members - //------------------------------------------- - - ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure. - int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. - int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. - - // [Internal] - // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. - unsigned char* TexPixelsAlpha8; // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight - unsigned int* TexPixelsRGBA32; // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4 - int TexWidth; // Texture width calculated during Build(). - int TexHeight; // Texture height calculated during Build(). - ImVec2 TexUvWhitePixel; // Texture coordinates to a white pixel - ImVector Fonts; // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font. - ImVector CustomRects; // Rectangles for packing custom texture data into the atlas. - ImVector ConfigData; // Internal data - int CustomRectIds[1]; // Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList -}; - -// Font runtime data and rendering -// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32(). -struct ImFont -{ - // Members: Hot ~62/78 bytes - float FontSize; // // Height of characters, set during loading (don't change after loading) - float Scale; // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale() - ImVec2 DisplayOffset; // = (0.f,1.f) // Offset font rendering by xx pixels - ImVector Glyphs; // // All glyphs. - ImVector IndexAdvanceX; // // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI). - ImVector IndexLookup; // // Sparse. Index glyphs by Unicode code-point. - const ImFontGlyph* FallbackGlyph; // == FindGlyph(FontFallbackChar) - float FallbackAdvanceX; // == FallbackGlyph->AdvanceX - ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar() - - // Members: Cold ~18/26 bytes - short ConfigDataCount; // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. - ImFontConfig* ConfigData; // // Pointer within ContainerAtlas->ConfigData - ImFontAtlas* ContainerAtlas; // // What we has been loaded into - float Ascent, Descent; // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] - int MetricsTotalSurface;// // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs) - - // Methods - IMGUI_API ImFont(); - IMGUI_API ~ImFont(); - IMGUI_API void ClearOutputData(); - IMGUI_API void BuildLookupTable(); - IMGUI_API const ImFontGlyph*FindGlyph(ImWchar c) const; - IMGUI_API void SetFallbackChar(ImWchar c); - float GetCharAdvance(ImWchar c) const { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; } - bool IsLoaded() const { return ContainerAtlas != NULL; } - - // 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable. - // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable. - IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8 - IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const; - IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const; - IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const; - - // [Internal] - IMGUI_API void GrowIndex(int new_size); - IMGUI_API void AddGlyph(ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x); - IMGUI_API void AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built. - -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - typedef ImFontGlyph Glyph; // OBSOLETE 1.52+ -#endif -}; - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - -// Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h) -#ifdef IMGUI_INCLUDE_IMGUI_USER_H -#include "imgui_user.h" -#endif diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp deleted file mode 100644 index 6b0fed76931..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_demo.cpp +++ /dev/null @@ -1,2952 +0,0 @@ -// dear imgui, v1.53 WIP -// (demo code) - -// Message to the person tempted to delete this file when integrating ImGui into their code base: -// Don't do it! Do NOT remove this file from your project! It is useful reference code that you and other users will want to refer to. -// Everything in this file will be stripped out by the linker if you don't call ImGui::ShowTestWindow(). -// During development, you can call ImGui::ShowTestWindow() in your code to learn about various features of ImGui. Have it wired in a debug menu! -// Removing this file from your project is hindering access to documentation for everyone in your team, likely leading you to poorer usage of the library. -// Note that you can #define IMGUI_DISABLE_TEST_WINDOWS in imconfig.h for the same effect. -// If you want to link core ImGui in your public builds but not those test windows, #define IMGUI_DISABLE_TEST_WINDOWS in imconfig.h and those functions will be empty. -// For any other case, if you have ImGui available you probably want this to be available for reference and execution. -// Thank you, -// -Your beloved friend, imgui_demo.cpp (that you won't delete) - -// Message to beginner C/C++ programmer about the meaning of 'static': in this demo code, we frequently we use 'static' variables inside functions. -// We do this as a way to gather code and data in the same place, make the demo code faster to read, faster to write, and smaller. A static variable persist across calls, -// so it is essentially like a global variable but declared inside the scope of the function. -// It also happens to be a convenient way of storing simple UI related information as long as your function doesn't need to be reentrant or used in threads. -// This may be a pattern you want to use in your code (simple is beautiful!), but most of the real data you would be editing is likely to be stored outside your function. - -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include "imgui.h" -#include // toupper, isprint -#include // sqrtf, powf, cosf, sinf, floorf, ceilf -#include // vsnprintf, sscanf, printf -#include // NULL, malloc, free, atoi -#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier -#include // intptr_t -#else -#include // intptr_t -#endif - -#ifdef _MSC_VER -#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen -#define snprintf _snprintf -#endif -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse. -#pragma clang diagnostic ignored "-Wdeprecated-declarations" // warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code) -#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' -#pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal -#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. -#if __has_warning("-Wreserved-id-macro") -#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier // -#endif -#elif defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size -#pragma GCC diagnostic ignored "-Wformat-security" // warning : format string is not a string literal (potentially insecure) -#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function -#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value -#if (__GNUC__ >= 6) -#pragma GCC diagnostic ignored "-Wmisleading-indentation" // warning: this 'if' clause does not guard this statement // GCC 6.0+ only. See #883 on github. -#endif -#endif - -// Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \n. -#ifdef _WIN32 -#define IM_NEWLINE "\r\n" -#else -#define IM_NEWLINE "\n" -#endif - -#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR))) -#define IM_MAX(_A,_B) (((_A) >= (_B)) ? (_A) : (_B)) - -//----------------------------------------------------------------------------- -// DEMO CODE -//----------------------------------------------------------------------------- - -#ifndef IMGUI_DISABLE_TEST_WINDOWS - -static void ShowExampleAppConsole(bool* p_open); -static void ShowExampleAppLog(bool* p_open); -static void ShowExampleAppLayout(bool* p_open); -static void ShowExampleAppPropertyEditor(bool* p_open); -static void ShowExampleAppLongText(bool* p_open); -static void ShowExampleAppAutoResize(bool* p_open); -static void ShowExampleAppConstrainedResize(bool* p_open); -static void ShowExampleAppFixedOverlay(bool* p_open); -static void ShowExampleAppManipulatingWindowTitle(bool* p_open); -static void ShowExampleAppCustomRendering(bool* p_open); -static void ShowExampleAppMainMenuBar(); -static void ShowExampleMenuFile(); - -static void ShowHelpMarker(const char* desc) -{ - ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered()) - { - ImGui::BeginTooltip(); - ImGui::PushTextWrapPos(450.0f); - ImGui::TextUnformatted(desc); - ImGui::PopTextWrapPos(); - ImGui::EndTooltip(); - } -} - -void ImGui::ShowUserGuide() -{ - ImGui::BulletText("Double-click on title bar to collapse window."); - ImGui::BulletText("Click and drag on lower right corner to resize window\n(double-click to auto fit window to its contents)."); - ImGui::BulletText("Click and drag on any empty space to move window."); - ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields."); - ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text."); - if (ImGui::GetIO().FontAllowUserScaling) - ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents."); - ImGui::BulletText("Mouse Wheel to scroll."); - ImGui::BulletText("While editing text:\n"); - ImGui::Indent(); - ImGui::BulletText("Hold SHIFT or use mouse to select text."); - ImGui::BulletText("CTRL+Left/Right to word jump."); - ImGui::BulletText("CTRL+A or double-click to select all."); - ImGui::BulletText("CTRL+X,CTRL+C,CTRL+V to use clipboard."); - ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo."); - ImGui::BulletText("ESCAPE to revert."); - ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract."); - ImGui::Unindent(); -} - -// Demonstrate most ImGui features (big function!) -void ImGui::ShowTestWindow(bool* p_open) -{ - // Examples apps - static bool show_app_main_menu_bar = false; - static bool show_app_console = false; - static bool show_app_log = false; - static bool show_app_layout = false; - static bool show_app_property_editor = false; - static bool show_app_long_text = false; - static bool show_app_auto_resize = false; - static bool show_app_constrained_resize = false; - static bool show_app_fixed_overlay = false; - static bool show_app_manipulating_window_title = false; - static bool show_app_custom_rendering = false; - static bool show_app_style_editor = false; - - static bool show_app_metrics = false; - static bool show_app_about = false; - - if (show_app_main_menu_bar) ShowExampleAppMainMenuBar(); - if (show_app_console) ShowExampleAppConsole(&show_app_console); - if (show_app_log) ShowExampleAppLog(&show_app_log); - if (show_app_layout) ShowExampleAppLayout(&show_app_layout); - if (show_app_property_editor) ShowExampleAppPropertyEditor(&show_app_property_editor); - if (show_app_long_text) ShowExampleAppLongText(&show_app_long_text); - if (show_app_auto_resize) ShowExampleAppAutoResize(&show_app_auto_resize); - if (show_app_constrained_resize) ShowExampleAppConstrainedResize(&show_app_constrained_resize); - if (show_app_fixed_overlay) ShowExampleAppFixedOverlay(&show_app_fixed_overlay); - if (show_app_manipulating_window_title) ShowExampleAppManipulatingWindowTitle(&show_app_manipulating_window_title); - if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering); - - if (show_app_metrics) ImGui::ShowMetricsWindow(&show_app_metrics); - if (show_app_style_editor) { ImGui::Begin("Style Editor", &show_app_style_editor); ImGui::ShowStyleEditor(); ImGui::End(); } - if (show_app_about) - { - ImGui::Begin("About ImGui", &show_app_about, ImGuiWindowFlags_AlwaysAutoResize); - ImGui::Text("dear imgui, %s", ImGui::GetVersion()); - ImGui::Separator(); - ImGui::Text("By Omar Cornut and all github contributors."); - ImGui::Text("ImGui is licensed under the MIT License, see LICENSE for more information."); - ImGui::End(); - } - - static bool no_titlebar = false; - static bool no_scrollbar = false; - static bool no_menu = false; - static bool no_move = false; - static bool no_resize = false; - static bool no_collapse = false; - - // Demonstrate the various window flags. Typically you would just use the default. - ImGuiWindowFlags window_flags = 0; - if (no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar; - if (no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar; - if (!no_menu) window_flags |= ImGuiWindowFlags_MenuBar; - if (no_move) window_flags |= ImGuiWindowFlags_NoMove; - if (no_resize) window_flags |= ImGuiWindowFlags_NoResize; - if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse; - ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("ImGui Demo", p_open, window_flags)) - { - // Early out if the window is collapsed, as an optimization. - ImGui::End(); - return; - } - - //ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.65f); // 2/3 of the space for widget and 1/3 for labels - ImGui::PushItemWidth(-140); // Right align, keep 140 pixels for labels - - ImGui::Text("dear imgui says hello. (%s)", IMGUI_VERSION); - - // Menu - if (ImGui::BeginMenuBar()) - { - if (ImGui::BeginMenu("Menu")) - { - ShowExampleMenuFile(); - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("Examples")) - { - ImGui::MenuItem("Main menu bar", NULL, &show_app_main_menu_bar); - ImGui::MenuItem("Console", NULL, &show_app_console); - ImGui::MenuItem("Log", NULL, &show_app_log); - ImGui::MenuItem("Simple layout", NULL, &show_app_layout); - ImGui::MenuItem("Property editor", NULL, &show_app_property_editor); - ImGui::MenuItem("Long text display", NULL, &show_app_long_text); - ImGui::MenuItem("Auto-resizing window", NULL, &show_app_auto_resize); - ImGui::MenuItem("Constrained-resizing window", NULL, &show_app_constrained_resize); - ImGui::MenuItem("Simple overlay", NULL, &show_app_fixed_overlay); - ImGui::MenuItem("Manipulating window title", NULL, &show_app_manipulating_window_title); - ImGui::MenuItem("Custom rendering", NULL, &show_app_custom_rendering); - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("Help")) - { - ImGui::MenuItem("Metrics", NULL, &show_app_metrics); - ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor); - ImGui::MenuItem("About ImGui", NULL, &show_app_about); - ImGui::EndMenu(); - } - ImGui::EndMenuBar(); - } - - ImGui::Spacing(); - if (ImGui::CollapsingHeader("Help")) - { - ImGui::TextWrapped("This window is being created by the ShowTestWindow() function. Please refer to the code in imgui_demo.cpp for reference.\n\n"); - ImGui::Text("USER GUIDE:"); - ImGui::ShowUserGuide(); - } - - if (ImGui::CollapsingHeader("Window options")) - { - ImGui::Checkbox("No titlebar", &no_titlebar); ImGui::SameLine(150); - ImGui::Checkbox("No scrollbar", &no_scrollbar); ImGui::SameLine(300); - ImGui::Checkbox("No menu", &no_menu); - ImGui::Checkbox("No move", &no_move); ImGui::SameLine(150); - ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300); - ImGui::Checkbox("No collapse", &no_collapse); - - if (ImGui::TreeNode("Style")) - { - ImGui::ShowStyleEditor(); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Logging")) - { - ImGui::TextWrapped("The logging API redirects all text output so you can easily capture the content of a window or a block. Tree nodes can be automatically expanded. You can also call ImGui::LogText() to output directly to the log without a visual output."); - ImGui::LogButtons(); - ImGui::TreePop(); - } - } - - if (ImGui::CollapsingHeader("Widgets")) - { - if (ImGui::TreeNode("Basic")) - { - static int clicked = 0; - if (ImGui::Button("Button")) - clicked++; - if (clicked & 1) - { - ImGui::SameLine(); - ImGui::Text("Thanks for clicking me!"); - } - - static bool check = true; - ImGui::Checkbox("checkbox", &check); - - static int e = 0; - ImGui::RadioButton("radio a", &e, 0); ImGui::SameLine(); - ImGui::RadioButton("radio b", &e, 1); ImGui::SameLine(); - ImGui::RadioButton("radio c", &e, 2); - - // Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style. - for (int i = 0; i < 7; i++) - { - if (i > 0) ImGui::SameLine(); - ImGui::PushID(i); - ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.6f)); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.7f)); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(i/7.0f, 0.8f, 0.8f)); - ImGui::Button("Click"); - ImGui::PopStyleColor(3); - ImGui::PopID(); - } - - ImGui::Text("Hover over me"); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("I am a tooltip"); - - ImGui::SameLine(); - ImGui::Text("- or me"); - if (ImGui::IsItemHovered()) - { - ImGui::BeginTooltip(); - ImGui::Text("I am a fancy tooltip"); - static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; - ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr)); - ImGui::EndTooltip(); - } - - // Testing ImGuiOnceUponAFrame helper. - //static ImGuiOnceUponAFrame once; - //for (int i = 0; i < 5; i++) - // if (once) - // ImGui::Text("This will be displayed only once."); - - ImGui::Separator(); - - ImGui::LabelText("label", "Value"); - - static int item = 1; - ImGui::Combo("combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0"); // Combo using values packed in a single constant string (for really quick combo) - - const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK" }; - static int item2 = -1; - ImGui::Combo("combo scroll", &item2, items, IM_ARRAYSIZE(items)); // Combo using proper array. You can also pass a callback to retrieve array value, no need to create/copy an array just for that. - - { - static char str0[128] = "Hello, world!"; - static int i0=123; - static float f0=0.001f; - ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0)); - ImGui::SameLine(); ShowHelpMarker("Hold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n"); - - ImGui::InputInt("input int", &i0); - ImGui::SameLine(); ShowHelpMarker("You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n"); - - ImGui::InputFloat("input float", &f0, 0.01f, 1.0f); - - static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f }; - ImGui::InputFloat3("input float3", vec4a); - } - - { - static int i1=50, i2=42; - ImGui::DragInt("drag int", &i1, 1); - ImGui::SameLine(); ShowHelpMarker("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input value."); - - ImGui::DragInt("drag int 0..100", &i2, 1, 0, 100, "%.0f%%"); - - static float f1=1.00f, f2=0.0067f; - ImGui::DragFloat("drag float", &f1, 0.005f); - ImGui::DragFloat("drag small float", &f2, 0.0001f, 0.0f, 0.0f, "%.06f ns"); - } - - { - static int i1=0; - ImGui::SliderInt("slider int", &i1, -1, 3); - ImGui::SameLine(); ShowHelpMarker("CTRL+click to input value."); - - static float f1=0.123f, f2=0.0f; - ImGui::SliderFloat("slider float", &f1, 0.0f, 1.0f, "ratio = %.3f"); - ImGui::SliderFloat("slider log float", &f2, -10.0f, 10.0f, "%.4f", 3.0f); - static float angle = 0.0f; - ImGui::SliderAngle("slider angle", &angle); - } - - static float col1[3] = { 1.0f,0.0f,0.2f }; - static float col2[4] = { 0.4f,0.7f,0.0f,0.5f }; - ImGui::ColorEdit3("color 1", col1); - ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n"); - - ImGui::ColorEdit4("color 2", col2); - - const char* listbox_items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" }; - static int listbox_item_current = 1; - ImGui::ListBox("listbox\n(single select)", &listbox_item_current, listbox_items, IM_ARRAYSIZE(listbox_items), 4); - - //static int listbox_item_current2 = 2; - //ImGui::PushItemWidth(-1); - //ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4); - //ImGui::PopItemWidth(); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Trees")) - { - if (ImGui::TreeNode("Basic trees")) - { - for (int i = 0; i < 5; i++) - if (ImGui::TreeNode((void*)(intptr_t)i, "Child %d", i)) - { - ImGui::Text("blah blah"); - ImGui::SameLine(); - if (ImGui::SmallButton("print")) printf("Child %d pressed", i); - ImGui::TreePop(); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Advanced, with Selectable nodes")) - { - ShowHelpMarker("This is a more standard looking tree with selectable nodes.\nClick to select, CTRL+Click to toggle, click on arrows or double-click to open."); - static bool align_label_with_current_x_position = false; - ImGui::Checkbox("Align label with current X position)", &align_label_with_current_x_position); - ImGui::Text("Hello!"); - if (align_label_with_current_x_position) - ImGui::Unindent(ImGui::GetTreeNodeToLabelSpacing()); - - static int selection_mask = (1 << 2); // Dumb representation of what may be user-side selection state. You may carry selection state inside or outside your objects in whatever format you see fit. - int node_clicked = -1; // Temporary storage of what node we have clicked to process selection at the end of the loop. May be a pointer to your own node type, etc. - ImGui::PushStyleVar(ImGuiStyleVar_IndentSpacing, ImGui::GetFontSize()*3); // Increase spacing to differentiate leaves from expanded contents. - for (int i = 0; i < 6; i++) - { - // Disable the default open on single-click behavior and pass in Selected flag according to our selection state. - ImGuiTreeNodeFlags node_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ((selection_mask & (1 << i)) ? ImGuiTreeNodeFlags_Selected : 0); - if (i < 3) - { - // Node - bool node_open = ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Node %d", i); - if (ImGui::IsItemClicked()) - node_clicked = i; - if (node_open) - { - ImGui::Text("Blah blah\nBlah Blah"); - ImGui::TreePop(); - } - } - else - { - // Leaf: The only reason we have a TreeNode at all is to allow selection of the leaf. Otherwise we can use BulletText() or TreeAdvanceToLabelPos()+Text(). - node_flags |= ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen; // ImGuiTreeNodeFlags_Bullet - ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Selectable Leaf %d", i); - if (ImGui::IsItemClicked()) - node_clicked = i; - } - } - if (node_clicked != -1) - { - // Update selection state. Process outside of tree loop to avoid visual inconsistencies during the clicking-frame. - if (ImGui::GetIO().KeyCtrl) - selection_mask ^= (1 << node_clicked); // CTRL+click to toggle - else //if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, this commented bit preserve selection when clicking on item that is part of the selection - selection_mask = (1 << node_clicked); // Click to single-select - } - ImGui::PopStyleVar(); - if (align_label_with_current_x_position) - ImGui::Indent(ImGui::GetTreeNodeToLabelSpacing()); - ImGui::TreePop(); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Collapsing Headers")) - { - static bool closable_group = true; - ImGui::Checkbox("Enable extra group", &closable_group); - if (ImGui::CollapsingHeader("Header")) - { - ImGui::Text("IsItemHovered: %d", IsItemHovered()); - for (int i = 0; i < 5; i++) - ImGui::Text("Some content %d", i); - } - if (ImGui::CollapsingHeader("Header with a close button", &closable_group)) - { - ImGui::Text("IsItemHovered: %d", IsItemHovered()); - for (int i = 0; i < 5; i++) - ImGui::Text("More content %d", i); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Bullets")) - { - ImGui::BulletText("Bullet point 1"); - ImGui::BulletText("Bullet point 2\nOn multiple lines"); - ImGui::Bullet(); ImGui::Text("Bullet point 3 (two calls)"); - ImGui::Bullet(); ImGui::SmallButton("Button"); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Text")) - { - if (ImGui::TreeNode("Colored Text")) - { - // Using shortcut. You can use PushStyleColor()/PopStyleColor() for more flexibility. - ImGui::TextColored(ImVec4(1.0f,0.0f,1.0f,1.0f), "Pink"); - ImGui::TextColored(ImVec4(1.0f,1.0f,0.0f,1.0f), "Yellow"); - ImGui::TextDisabled("Disabled"); - ImGui::SameLine(); ShowHelpMarker("The TextDisabled color is stored in ImGuiStyle."); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Word Wrapping")) - { - // Using shortcut. You can use PushTextWrapPos()/PopTextWrapPos() for more flexibility. - ImGui::TextWrapped("This text should automatically wrap on the edge of the window. The current implementation for text wrapping follows simple rules suitable for English and possibly other languages."); - ImGui::Spacing(); - - static float wrap_width = 200.0f; - ImGui::SliderFloat("Wrap width", &wrap_width, -20, 600, "%.0f"); - - ImGui::Text("Test paragraph 1:"); - ImVec2 pos = ImGui::GetCursorScreenPos(); - ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255)); - ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); - ImGui::Text("The lazy dog is a good dog. This paragraph is made to fit within %.0f pixels. Testing a 1 character word. The quick brown fox jumps over the lazy dog.", wrap_width); - ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255)); - ImGui::PopTextWrapPos(); - - ImGui::Text("Test paragraph 2:"); - pos = ImGui::GetCursorScreenPos(); - ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + wrap_width, pos.y), ImVec2(pos.x + wrap_width + 10, pos.y + ImGui::GetTextLineHeight()), IM_COL32(255,0,255,255)); - ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + wrap_width); - ImGui::Text("aaaaaaaa bbbbbbbb, c cccccccc,dddddddd. d eeeeeeee ffffffff. gggggggg!hhhhhhhh"); - ImGui::GetWindowDrawList()->AddRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax(), IM_COL32(255,255,0,255)); - ImGui::PopTextWrapPos(); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("UTF-8 Text")) - { - // UTF-8 test with Japanese characters - // (needs a suitable font, try Arial Unicode or M+ fonts http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/index-en.html) - // - From C++11 you can use the u8"my text" syntax to encode literal strings as UTF-8 - // - For earlier compiler, you may be able to encode your sources as UTF-8 (e.g. Visual Studio save your file as 'UTF-8 without signature') - // - HOWEVER, FOR THIS DEMO FILE, BECAUSE WE WANT TO SUPPORT COMPILER, WE ARE *NOT* INCLUDING RAW UTF-8 CHARACTERS IN THIS SOURCE FILE. - // Instead we are encoding a few string with hexadecimal constants. Don't do this in your application! - // Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application. - ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->LoadFromFileTTF() manually to load extra character ranges."); - ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); - ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)"); - static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"; // "nihongo" - ImGui::InputText("UTF-8 input", buf, IM_ARRAYSIZE(buf)); - ImGui::TreePop(); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Images")) - { - ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!"); - ImGuiIO& io = ImGui::GetIO(); - - // Here we are grabbing the font texture because that's the only one we have access to inside the demo code. - // Remember that ImTextureID is just storage for whatever you want it to be, it is essentially a value that will be passed to the render function inside the ImDrawCmd structure. - // If you use one of the default imgui_impl_XXXX.cpp renderer, they all have comments at the top of their file to specify what they expect to be stored in ImTextureID. - // (for example, the imgui_impl_dx11.cpp renderer expect a 'ID3D11ShaderResourceView*' pointer. The imgui_impl_glfw_gl3.cpp renderer expect a GLuint OpenGL texture identifier etc.) - // If you decided that ImTextureID = MyEngineTexture*, then you can pass your MyEngineTexture* pointers to ImGui::Image(), and gather width/height through your own functions, etc. - // Using ShowMetricsWindow() as a "debugger" to inspect the draw data that are being passed to your render will help you debug issues if you are confused about this. - // Consider using the lower-level ImDrawList::AddImage() API, via ImGui::GetWindowDrawList()->AddImage(). - ImTextureID my_tex_id = io.Fonts->TexID; - float my_tex_w = (float)io.Fonts->TexWidth; - float my_tex_h = (float)io.Fonts->TexHeight; - - ImGui::Text("%.0fx%.0f", my_tex_w, my_tex_h); - ImVec2 pos = ImGui::GetCursorScreenPos(); - ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), ImVec2(0,0), ImVec2(1,1), ImColor(255,255,255,255), ImColor(255,255,255,128)); - if (ImGui::IsItemHovered()) - { - ImGui::BeginTooltip(); - float focus_sz = 32.0f; - float focus_x = io.MousePos.x - pos.x - focus_sz * 0.5f; if (focus_x < 0.0f) focus_x = 0.0f; else if (focus_x > my_tex_w - focus_sz) focus_x = my_tex_w - focus_sz; - float focus_y = io.MousePos.y - pos.y - focus_sz * 0.5f; if (focus_y < 0.0f) focus_y = 0.0f; else if (focus_y > my_tex_h - focus_sz) focus_y = my_tex_h - focus_sz; - ImGui::Text("Min: (%.2f, %.2f)", focus_x, focus_y); - ImGui::Text("Max: (%.2f, %.2f)", focus_x + focus_sz, focus_y + focus_sz); - ImVec2 uv0 = ImVec2((focus_x) / my_tex_w, (focus_y) / my_tex_h); - ImVec2 uv1 = ImVec2((focus_x + focus_sz) / my_tex_w, (focus_y + focus_sz) / my_tex_h); - ImGui::Image(my_tex_id, ImVec2(128,128), uv0, uv1, ImColor(255,255,255,255), ImColor(255,255,255,128)); - ImGui::EndTooltip(); - } - ImGui::TextWrapped("And now some textured buttons.."); - static int pressed_count = 0; - for (int i = 0; i < 8; i++) - { - ImGui::PushID(i); - int frame_padding = -1 + i; // -1 = uses default padding - if (ImGui::ImageButton(my_tex_id, ImVec2(32,32), ImVec2(0,0), ImVec2(32.0f/my_tex_w,32/my_tex_h), frame_padding, ImColor(0,0,0,255))) - pressed_count += 1; - ImGui::PopID(); - ImGui::SameLine(); - } - ImGui::NewLine(); - ImGui::Text("Pressed %d times.", pressed_count); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Selectables")) - { - if (ImGui::TreeNode("Basic")) - { - static bool selected[4] = { false, true, false, false }; - ImGui::Selectable("1. I am selectable", &selected[0]); - ImGui::Selectable("2. I am selectable", &selected[1]); - ImGui::Text("3. I am not selectable"); - ImGui::Selectable("4. I am selectable", &selected[2]); - if (ImGui::Selectable("5. I am double clickable", selected[3], ImGuiSelectableFlags_AllowDoubleClick)) - if (ImGui::IsMouseDoubleClicked(0)) - selected[3] = !selected[3]; - ImGui::TreePop(); - } - if (ImGui::TreeNode("Rendering more text into the same block")) - { - static bool selected[3] = { false, false, false }; - ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes"); - ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes"); - ImGui::Selectable("Hello.h", &selected[2]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes"); - ImGui::TreePop(); - } - if (ImGui::TreeNode("In columns")) - { - ImGui::Columns(3, NULL, false); - static bool selected[16] = { 0 }; - for (int i = 0; i < 16; i++) - { - char label[32]; sprintf(label, "Item %d", i); - if (ImGui::Selectable(label, &selected[i])) {} - ImGui::NextColumn(); - } - ImGui::Columns(1); - ImGui::TreePop(); - } - if (ImGui::TreeNode("Grid")) - { - static bool selected[16] = { true, false, false, false, false, true, false, false, false, false, true, false, false, false, false, true }; - for (int i = 0; i < 16; i++) - { - ImGui::PushID(i); - if (ImGui::Selectable("Sailor", &selected[i], 0, ImVec2(50,50))) - { - int x = i % 4, y = i / 4; - if (x > 0) selected[i - 1] ^= 1; - if (x < 3) selected[i + 1] ^= 1; - if (y > 0) selected[i - 4] ^= 1; - if (y < 3) selected[i + 4] ^= 1; - } - if ((i % 4) < 3) ImGui::SameLine(); - ImGui::PopID(); - } - ImGui::TreePop(); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Filtered Text Input")) - { - static char buf1[64] = ""; ImGui::InputText("default", buf1, 64); - static char buf2[64] = ""; ImGui::InputText("decimal", buf2, 64, ImGuiInputTextFlags_CharsDecimal); - static char buf3[64] = ""; ImGui::InputText("hexadecimal", buf3, 64, ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase); - static char buf4[64] = ""; ImGui::InputText("uppercase", buf4, 64, ImGuiInputTextFlags_CharsUppercase); - static char buf5[64] = ""; ImGui::InputText("no blank", buf5, 64, ImGuiInputTextFlags_CharsNoBlank); - struct TextFilters { static int FilterImGuiLetters(ImGuiTextEditCallbackData* data) { if (data->EventChar < 256 && strchr("imgui", (char)data->EventChar)) return 0; return 1; } }; - static char buf6[64] = ""; ImGui::InputText("\"imgui\" letters", buf6, 64, ImGuiInputTextFlags_CallbackCharFilter, TextFilters::FilterImGuiLetters); - - ImGui::Text("Password input"); - static char bufpass[64] = "password123"; - ImGui::InputText("password", bufpass, 64, ImGuiInputTextFlags_Password | ImGuiInputTextFlags_CharsNoBlank); - ImGui::SameLine(); ShowHelpMarker("Display all characters as '*'.\nDisable clipboard cut and copy.\nDisable logging.\n"); - ImGui::InputText("password (clear)", bufpass, 64, ImGuiInputTextFlags_CharsNoBlank); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Multi-line Text Input")) - { - static bool read_only = false; - static char text[1024*16] = - "/*\n" - " The Pentium F00F bug, shorthand for F0 0F C7 C8,\n" - " the hexadecimal encoding of one offending instruction,\n" - " more formally, the invalid operand with locked CMPXCHG8B\n" - " instruction bug, is a design flaw in the majority of\n" - " Intel Pentium, Pentium MMX, and Pentium OverDrive\n" - " processors (all in the P5 microarchitecture).\n" - "*/\n\n" - "label:\n" - "\tlock cmpxchg8b eax\n"; - - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); - ImGui::Checkbox("Read-only", &read_only); - ImGui::PopStyleVar(); - ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16), ImGuiInputTextFlags_AllowTabInput | (read_only ? ImGuiInputTextFlags_ReadOnly : 0)); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Plots widgets")) - { - static bool animate = true; - ImGui::Checkbox("Animate", &animate); - - static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; - ImGui::PlotLines("Frame Times", arr, IM_ARRAYSIZE(arr)); - - // Create a dummy array of contiguous float values to plot - // Tip: If your float aren't contiguous but part of a structure, you can pass a pointer to your first float and the sizeof() of your structure in the Stride parameter. - static float values[90] = { 0 }; - static int values_offset = 0; - static float refresh_time = 0.0f; - if (!animate || refresh_time == 0.0f) - refresh_time = ImGui::GetTime(); - while (refresh_time < ImGui::GetTime()) // Create dummy data at fixed 60 hz rate for the demo - { - static float phase = 0.0f; - values[values_offset] = cosf(phase); - values_offset = (values_offset+1) % IM_ARRAYSIZE(values); - phase += 0.10f*values_offset; - refresh_time += 1.0f/60.0f; - } - ImGui::PlotLines("Lines", values, IM_ARRAYSIZE(values), values_offset, "avg 0.0", -1.0f, 1.0f, ImVec2(0,80)); - ImGui::PlotHistogram("Histogram", arr, IM_ARRAYSIZE(arr), 0, NULL, 0.0f, 1.0f, ImVec2(0,80)); - - // Use functions to generate output - // FIXME: This is rather awkward because current plot API only pass in indices. We probably want an API passing floats and user provide sample rate/count. - struct Funcs - { - static float Sin(void*, int i) { return sinf(i * 0.1f); } - static float Saw(void*, int i) { return (i & 1) ? 1.0f : -1.0f; } - }; - static int func_type = 0, display_count = 70; - ImGui::Separator(); - ImGui::PushItemWidth(100); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::PopItemWidth(); - ImGui::SameLine(); - ImGui::SliderInt("Sample count", &display_count, 1, 400); - float (*func)(void*, int) = (func_type == 0) ? Funcs::Sin : Funcs::Saw; - ImGui::PlotLines("Lines", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); - ImGui::PlotHistogram("Histogram", func, NULL, display_count, 0, NULL, -1.0f, 1.0f, ImVec2(0,80)); - ImGui::Separator(); - - // Animate a simple progress bar - static float progress = 0.0f, progress_dir = 1.0f; - if (animate) - { - progress += progress_dir * 0.4f * ImGui::GetIO().DeltaTime; - if (progress >= +1.1f) { progress = +1.1f; progress_dir *= -1.0f; } - if (progress <= -0.1f) { progress = -0.1f; progress_dir *= -1.0f; } - } - - // Typically we would use ImVec2(-1.0f,0.0f) to use all available width, or ImVec2(width,0.0f) for a specified width. ImVec2(0.0f,0.0f) uses ItemWidth. - ImGui::ProgressBar(progress, ImVec2(0.0f,0.0f)); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::Text("Progress Bar"); - - float progress_saturated = (progress < 0.0f) ? 0.0f : (progress > 1.0f) ? 1.0f : progress; - char buf[32]; - sprintf(buf, "%d/%d", (int)(progress_saturated*1753), 1753); - ImGui::ProgressBar(progress, ImVec2(0.f,0.f), buf); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Color/Picker Widgets")) - { - static ImVec4 color = ImColor(114, 144, 154, 200); - - static bool hdr = false; - static bool alpha_preview = true; - static bool alpha_half_preview = false; - static bool options_menu = true; - ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets."); - ImGui::Checkbox("With Alpha Preview", &alpha_preview); - ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview); - ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options."); - int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions); - - ImGui::Text("Color widget:"); - ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nCTRL+click on individual component to input value.\n"); - ImGui::ColorEdit3("MyColor##1", (float*)&color, misc_flags); - - ImGui::Text("Color widget HSV with Alpha:"); - ImGui::ColorEdit4("MyColor##2", (float*)&color, ImGuiColorEditFlags_HSV | misc_flags); - - ImGui::Text("Color widget with Float Display:"); - ImGui::ColorEdit4("MyColor##2f", (float*)&color, ImGuiColorEditFlags_Float | misc_flags); - - ImGui::Text("Color button with Picker:"); - ImGui::SameLine(); ShowHelpMarker("With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\nWith the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only be used for the tooltip and picker popup."); - ImGui::ColorEdit4("MyColor##3", (float*)&color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | misc_flags); - - ImGui::Text("Color button with Custom Picker Popup:"); - static bool saved_palette_inited = false; - static ImVec4 saved_palette[32]; - static ImVec4 backup_color; - if (!saved_palette_inited) - for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++) - ImGui::ColorConvertHSVtoRGB(n / 31.0f, 0.8f, 0.8f, saved_palette[n].x, saved_palette[n].y, saved_palette[n].z); - bool open_popup = ImGui::ColorButton("MyColor##3b", color, misc_flags); - ImGui::SameLine(); - open_popup |= ImGui::Button("Palette"); - if (open_popup) - { - ImGui::OpenPopup("mypicker"); - backup_color = color; - } - if (ImGui::BeginPopup("mypicker")) - { - // FIXME: Adding a drag and drop example here would be perfect! - ImGui::Text("MY CUSTOM COLOR PICKER WITH AN AMAZING PALETTE!"); - ImGui::Separator(); - ImGui::ColorPicker4("##picker", (float*)&color, misc_flags | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoSmallPreview); - ImGui::SameLine(); - ImGui::BeginGroup(); - ImGui::Text("Current"); - ImGui::ColorButton("##current", color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60,40)); - ImGui::Text("Previous"); - if (ImGui::ColorButton("##previous", backup_color, ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf, ImVec2(60,40))) - color = backup_color; - ImGui::Separator(); - ImGui::Text("Palette"); - for (int n = 0; n < IM_ARRAYSIZE(saved_palette); n++) - { - ImGui::PushID(n); - if ((n % 8) != 0) - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y); - if (ImGui::ColorButton("##palette", saved_palette[n], ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_NoTooltip, ImVec2(20,20))) - color = ImVec4(saved_palette[n].x, saved_palette[n].y, saved_palette[n].z, color.w); // Preserve alpha! - ImGui::PopID(); - } - ImGui::EndGroup(); - ImGui::EndPopup(); - } - - ImGui::Text("Color button only:"); - ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags, ImVec2(80,80)); - - ImGui::Text("Color picker:"); - static bool alpha = true; - static bool alpha_bar = true; - static bool side_preview = true; - static bool ref_color = false; - static ImVec4 ref_color_v(1.0f,0.0f,1.0f,0.5f); - static int inputs_mode = 2; - static int picker_mode = 0; - ImGui::Checkbox("With Alpha", &alpha); - ImGui::Checkbox("With Alpha Bar", &alpha_bar); - ImGui::Checkbox("With Side Preview", &side_preview); - if (side_preview) - { - ImGui::SameLine(); - ImGui::Checkbox("With Ref Color", &ref_color); - if (ref_color) - { - ImGui::SameLine(); - ImGui::ColorEdit4("##RefColor", &ref_color_v.x, ImGuiColorEditFlags_NoInputs | misc_flags); - } - } - ImGui::Combo("Inputs Mode", &inputs_mode, "All Inputs\0No Inputs\0RGB Input\0HSV Input\0HEX Input\0"); - ImGui::Combo("Picker Mode", &picker_mode, "Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0"); - ImGui::SameLine(); ShowHelpMarker("User can right-click the picker to change mode."); - ImGuiColorEditFlags flags = misc_flags; - if (!alpha) flags |= ImGuiColorEditFlags_NoAlpha; // This is by default if you call ColorPicker3() instead of ColorPicker4() - if (alpha_bar) flags |= ImGuiColorEditFlags_AlphaBar; - if (!side_preview) flags |= ImGuiColorEditFlags_NoSidePreview; - if (picker_mode == 1) flags |= ImGuiColorEditFlags_PickerHueBar; - if (picker_mode == 2) flags |= ImGuiColorEditFlags_PickerHueWheel; - if (inputs_mode == 1) flags |= ImGuiColorEditFlags_NoInputs; - if (inputs_mode == 2) flags |= ImGuiColorEditFlags_RGB; - if (inputs_mode == 3) flags |= ImGuiColorEditFlags_HSV; - if (inputs_mode == 4) flags |= ImGuiColorEditFlags_HEX; - ImGui::ColorPicker4("MyColor##4", (float*)&color, flags, ref_color ? &ref_color_v.x : NULL); - - ImGui::Text("Programmatically set defaults/options:"); - ImGui::SameLine(); ShowHelpMarker("SetColorEditOptions() is designed to allow you to set boot-time default.\nWe don't have Push/Pop functions because you can force options on a per-widget basis if needed, and the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid encouraging you to persistently save values that aren't forward-compatible."); - if (ImGui::Button("Uint8 + HSV")) - ImGui::SetColorEditOptions(ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_HSV); - ImGui::SameLine(); - if (ImGui::Button("Float + HDR")) - ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_RGB); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Range Widgets")) - { - static float begin = 10, end = 90; - static int begin_i = 100, end_i = 1000; - ImGui::DragFloatRange2("range", &begin, &end, 0.25f, 0.0f, 100.0f, "Min: %.1f %%", "Max: %.1f %%"); - ImGui::DragIntRange2("range int (no bounds)", &begin_i, &end_i, 5, 0, 0, "Min: %.0f units", "Max: %.0f units"); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Multi-component Widgets")) - { - static float vec4f[4] = { 0.10f, 0.20f, 0.30f, 0.44f }; - static int vec4i[4] = { 1, 5, 100, 255 }; - - ImGui::InputFloat2("input float2", vec4f); - ImGui::DragFloat2("drag float2", vec4f, 0.01f, 0.0f, 1.0f); - ImGui::SliderFloat2("slider float2", vec4f, 0.0f, 1.0f); - ImGui::DragInt2("drag int2", vec4i, 1, 0, 255); - ImGui::InputInt2("input int2", vec4i); - ImGui::SliderInt2("slider int2", vec4i, 0, 255); - ImGui::Spacing(); - - ImGui::InputFloat3("input float3", vec4f); - ImGui::DragFloat3("drag float3", vec4f, 0.01f, 0.0f, 1.0f); - ImGui::SliderFloat3("slider float3", vec4f, 0.0f, 1.0f); - ImGui::DragInt3("drag int3", vec4i, 1, 0, 255); - ImGui::InputInt3("input int3", vec4i); - ImGui::SliderInt3("slider int3", vec4i, 0, 255); - ImGui::Spacing(); - - ImGui::InputFloat4("input float4", vec4f); - ImGui::DragFloat4("drag float4", vec4f, 0.01f, 0.0f, 1.0f); - ImGui::SliderFloat4("slider float4", vec4f, 0.0f, 1.0f); - ImGui::InputInt4("input int4", vec4i); - ImGui::DragInt4("drag int4", vec4i, 1, 0, 255); - ImGui::SliderInt4("slider int4", vec4i, 0, 255); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Vertical Sliders")) - { - const float spacing = 4; - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(spacing, spacing)); - - static int int_value = 0; - ImGui::VSliderInt("##int", ImVec2(18,160), &int_value, 0, 5); - ImGui::SameLine(); - - static float values[7] = { 0.0f, 0.60f, 0.35f, 0.9f, 0.70f, 0.20f, 0.0f }; - ImGui::PushID("set1"); - for (int i = 0; i < 7; i++) - { - if (i > 0) ImGui::SameLine(); - ImGui::PushID(i); - ImGui::PushStyleColor(ImGuiCol_FrameBg, (ImVec4)ImColor::HSV(i/7.0f, 0.5f, 0.5f)); - ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, (ImVec4)ImColor::HSV(i/7.0f, 0.6f, 0.5f)); - ImGui::PushStyleColor(ImGuiCol_FrameBgActive, (ImVec4)ImColor::HSV(i/7.0f, 0.7f, 0.5f)); - ImGui::PushStyleColor(ImGuiCol_SliderGrab, (ImVec4)ImColor::HSV(i/7.0f, 0.9f, 0.9f)); - ImGui::VSliderFloat("##v", ImVec2(18,160), &values[i], 0.0f, 1.0f, ""); - if (ImGui::IsItemActive() || ImGui::IsItemHovered()) - ImGui::SetTooltip("%.3f", values[i]); - ImGui::PopStyleColor(4); - ImGui::PopID(); - } - ImGui::PopID(); - - ImGui::SameLine(); - ImGui::PushID("set2"); - static float values2[4] = { 0.20f, 0.80f, 0.40f, 0.25f }; - const int rows = 3; - const ImVec2 small_slider_size(18, (160.0f-(rows-1)*spacing)/rows); - for (int nx = 0; nx < 4; nx++) - { - if (nx > 0) ImGui::SameLine(); - ImGui::BeginGroup(); - for (int ny = 0; ny < rows; ny++) - { - ImGui::PushID(nx*rows+ny); - ImGui::VSliderFloat("##v", small_slider_size, &values2[nx], 0.0f, 1.0f, ""); - if (ImGui::IsItemActive() || ImGui::IsItemHovered()) - ImGui::SetTooltip("%.3f", values2[nx]); - ImGui::PopID(); - } - ImGui::EndGroup(); - } - ImGui::PopID(); - - ImGui::SameLine(); - ImGui::PushID("set3"); - for (int i = 0; i < 4; i++) - { - if (i > 0) ImGui::SameLine(); - ImGui::PushID(i); - ImGui::PushStyleVar(ImGuiStyleVar_GrabMinSize, 40); - ImGui::VSliderFloat("##v", ImVec2(40,160), &values[i], 0.0f, 1.0f, "%.2f\nsec"); - ImGui::PopStyleVar(); - ImGui::PopID(); - } - ImGui::PopID(); - ImGui::PopStyleVar(); - ImGui::TreePop(); - } - } - - if (ImGui::CollapsingHeader("Layout")) - { - if (ImGui::TreeNode("Child regions")) - { - ImGui::Text("Without border"); - static int line = 50; - bool goto_line = ImGui::Button("Goto"); - ImGui::SameLine(); - ImGui::PushItemWidth(100); - goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue); - ImGui::PopItemWidth(); - ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f,300), false, ImGuiWindowFlags_HorizontalScrollbar); - for (int i = 0; i < 100; i++) - { - ImGui::Text("%04d: scrollable region", i); - if (goto_line && line == i) - ImGui::SetScrollHere(); - } - if (goto_line && line >= 100) - ImGui::SetScrollHere(); - ImGui::EndChild(); - - ImGui::SameLine(); - - ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); - ImGui::BeginChild("Sub2", ImVec2(0,300), true); - ImGui::Text("With border"); - ImGui::Columns(2); - for (int i = 0; i < 100; i++) - { - if (i == 50) - ImGui::NextColumn(); - char buf[32]; - sprintf(buf, "%08x", i*5731); - ImGui::Button(buf, ImVec2(-1.0f, 0.0f)); - } - ImGui::EndChild(); - ImGui::PopStyleVar(); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Widgets Width")) - { - static float f = 0.0f; - ImGui::Text("PushItemWidth(100)"); - ImGui::SameLine(); ShowHelpMarker("Fixed width."); - ImGui::PushItemWidth(100); - ImGui::DragFloat("float##1", &f); - ImGui::PopItemWidth(); - - ImGui::Text("PushItemWidth(GetWindowWidth() * 0.5f)"); - ImGui::SameLine(); ShowHelpMarker("Half of window width."); - ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f); - ImGui::DragFloat("float##2", &f); - ImGui::PopItemWidth(); - - ImGui::Text("PushItemWidth(GetContentRegionAvailWidth() * 0.5f)"); - ImGui::SameLine(); ShowHelpMarker("Half of available width.\n(~ right-cursor_pos)\n(works within a column set)"); - ImGui::PushItemWidth(ImGui::GetContentRegionAvailWidth() * 0.5f); - ImGui::DragFloat("float##3", &f); - ImGui::PopItemWidth(); - - ImGui::Text("PushItemWidth(-100)"); - ImGui::SameLine(); ShowHelpMarker("Align to right edge minus 100"); - ImGui::PushItemWidth(-100); - ImGui::DragFloat("float##4", &f); - ImGui::PopItemWidth(); - - ImGui::Text("PushItemWidth(-1)"); - ImGui::SameLine(); ShowHelpMarker("Align to right edge"); - ImGui::PushItemWidth(-1); - ImGui::DragFloat("float##5", &f); - ImGui::PopItemWidth(); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Basic Horizontal Layout")) - { - ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceding item)"); - - // Text - ImGui::Text("Two items: Hello"); ImGui::SameLine(); - ImGui::TextColored(ImVec4(1,1,0,1), "Sailor"); - - // Adjust spacing - ImGui::Text("More spacing: Hello"); ImGui::SameLine(0, 20); - ImGui::TextColored(ImVec4(1,1,0,1), "Sailor"); - - // Button - ImGui::AlignTextToFramePadding(); - ImGui::Text("Normal buttons"); ImGui::SameLine(); - ImGui::Button("Banana"); ImGui::SameLine(); - ImGui::Button("Apple"); ImGui::SameLine(); - ImGui::Button("Corniflower"); - - // Button - ImGui::Text("Small buttons"); ImGui::SameLine(); - ImGui::SmallButton("Like this one"); ImGui::SameLine(); - ImGui::Text("can fit within a text block."); - - // Aligned to arbitrary position. Easy/cheap column. - ImGui::Text("Aligned"); - ImGui::SameLine(150); ImGui::Text("x=150"); - ImGui::SameLine(300); ImGui::Text("x=300"); - ImGui::Text("Aligned"); - ImGui::SameLine(150); ImGui::SmallButton("x=150"); - ImGui::SameLine(300); ImGui::SmallButton("x=300"); - - // Checkbox - static bool c1=false,c2=false,c3=false,c4=false; - ImGui::Checkbox("My", &c1); ImGui::SameLine(); - ImGui::Checkbox("Tailor", &c2); ImGui::SameLine(); - ImGui::Checkbox("Is", &c3); ImGui::SameLine(); - ImGui::Checkbox("Rich", &c4); - - // Various - static float f0=1.0f, f1=2.0f, f2=3.0f; - ImGui::PushItemWidth(80); - const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD" }; - static int item = -1; - ImGui::Combo("Combo", &item, items, IM_ARRAYSIZE(items)); ImGui::SameLine(); - ImGui::SliderFloat("X", &f0, 0.0f,5.0f); ImGui::SameLine(); - ImGui::SliderFloat("Y", &f1, 0.0f,5.0f); ImGui::SameLine(); - ImGui::SliderFloat("Z", &f2, 0.0f,5.0f); - ImGui::PopItemWidth(); - - ImGui::PushItemWidth(80); - ImGui::Text("Lists:"); - static int selection[4] = { 0, 1, 2, 3 }; - for (int i = 0; i < 4; i++) - { - if (i > 0) ImGui::SameLine(); - ImGui::PushID(i); - ImGui::ListBox("", &selection[i], items, IM_ARRAYSIZE(items)); - ImGui::PopID(); - //if (ImGui::IsItemHovered()) ImGui::SetTooltip("ListBox %d hovered", i); - } - ImGui::PopItemWidth(); - - // Dummy - ImVec2 sz(30,30); - ImGui::Button("A", sz); ImGui::SameLine(); - ImGui::Dummy(sz); ImGui::SameLine(); - ImGui::Button("B", sz); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Groups")) - { - ImGui::TextWrapped("(Using ImGui::BeginGroup()/EndGroup() to layout items. BeginGroup() basically locks the horizontal position. EndGroup() bundles the whole group so that you can use functions such as IsItemHovered() on it.)"); - ImGui::BeginGroup(); - { - ImGui::BeginGroup(); - ImGui::Button("AAA"); - ImGui::SameLine(); - ImGui::Button("BBB"); - ImGui::SameLine(); - ImGui::BeginGroup(); - ImGui::Button("CCC"); - ImGui::Button("DDD"); - ImGui::EndGroup(); - ImGui::SameLine(); - ImGui::Button("EEE"); - ImGui::EndGroup(); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("First group hovered"); - } - // Capture the group size and create widgets using the same size - ImVec2 size = ImGui::GetItemRectSize(); - const float values[5] = { 0.5f, 0.20f, 0.80f, 0.60f, 0.25f }; - ImGui::PlotHistogram("##values", values, IM_ARRAYSIZE(values), 0, NULL, 0.0f, 1.0f, size); - - ImGui::Button("ACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f,size.y)); - ImGui::SameLine(); - ImGui::Button("REACTION", ImVec2((size.x - ImGui::GetStyle().ItemSpacing.x)*0.5f,size.y)); - ImGui::EndGroup(); - ImGui::SameLine(); - - ImGui::Button("LEVERAGE\nBUZZWORD", size); - ImGui::SameLine(); - - ImGui::ListBoxHeader("List", size); - ImGui::Selectable("Selected", true); - ImGui::Selectable("Not Selected", false); - ImGui::ListBoxFooter(); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Text Baseline Alignment")) - { - ImGui::TextWrapped("(This is testing the vertical alignment that occurs on text to keep it at the same baseline as widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets)"); - - ImGui::Text("One\nTwo\nThree"); ImGui::SameLine(); - ImGui::Text("Hello\nWorld"); ImGui::SameLine(); - ImGui::Text("Banana"); - - ImGui::Text("Banana"); ImGui::SameLine(); - ImGui::Text("Hello\nWorld"); ImGui::SameLine(); - ImGui::Text("One\nTwo\nThree"); - - ImGui::Button("HOP##1"); ImGui::SameLine(); - ImGui::Text("Banana"); ImGui::SameLine(); - ImGui::Text("Hello\nWorld"); ImGui::SameLine(); - ImGui::Text("Banana"); - - ImGui::Button("HOP##2"); ImGui::SameLine(); - ImGui::Text("Hello\nWorld"); ImGui::SameLine(); - ImGui::Text("Banana"); - - ImGui::Button("TEST##1"); ImGui::SameLine(); - ImGui::Text("TEST"); ImGui::SameLine(); - ImGui::SmallButton("TEST##2"); - - ImGui::AlignTextToFramePadding(); // If your line starts with text, call this to align it to upcoming widgets. - ImGui::Text("Text aligned to Widget"); ImGui::SameLine(); - ImGui::Button("Widget##1"); ImGui::SameLine(); - ImGui::Text("Widget"); ImGui::SameLine(); - ImGui::SmallButton("Widget##2"); ImGui::SameLine(); - ImGui::Button("Widget##3"); - - // Tree - const float spacing = ImGui::GetStyle().ItemInnerSpacing.x; - ImGui::Button("Button##1"); - ImGui::SameLine(0.0f, spacing); - if (ImGui::TreeNode("Node##1")) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data - - ImGui::AlignTextToFramePadding(); // Vertically align text node a bit lower so it'll be vertically centered with upcoming widget. Otherwise you can use SmallButton (smaller fit). - bool node_open = ImGui::TreeNode("Node##2"); // Common mistake to avoid: if we want to SameLine after TreeNode we need to do it before we add child content. - ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##2"); - if (node_open) { for (int i = 0; i < 6; i++) ImGui::BulletText("Item %d..", i); ImGui::TreePop(); } // Dummy tree data - - // Bullet - ImGui::Button("Button##3"); - ImGui::SameLine(0.0f, spacing); - ImGui::BulletText("Bullet text"); - - ImGui::AlignTextToFramePadding(); - ImGui::BulletText("Node"); - ImGui::SameLine(0.0f, spacing); ImGui::Button("Button##4"); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Scrolling")) - { - ImGui::TextWrapped("(Use SetScrollHere() or SetScrollFromPosY() to scroll to a given position.)"); - static bool track = true; - static int track_line = 50, scroll_to_px = 200; - ImGui::Checkbox("Track", &track); - ImGui::PushItemWidth(100); - ImGui::SameLine(130); track |= ImGui::DragInt("##line", &track_line, 0.25f, 0, 99, "Line = %.0f"); - bool scroll_to = ImGui::Button("Scroll To Pos"); - ImGui::SameLine(130); scroll_to |= ImGui::DragInt("##pos_y", &scroll_to_px, 1.00f, 0, 9999, "Y = %.0f px"); - ImGui::PopItemWidth(); - if (scroll_to) track = false; - - for (int i = 0; i < 5; i++) - { - if (i > 0) ImGui::SameLine(); - ImGui::BeginGroup(); - ImGui::Text("%s", i == 0 ? "Top" : i == 1 ? "25%" : i == 2 ? "Center" : i == 3 ? "75%" : "Bottom"); - ImGui::BeginChild(ImGui::GetID((void*)(intptr_t)i), ImVec2(ImGui::GetWindowWidth() * 0.17f, 200.0f), true); - if (scroll_to) - ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + scroll_to_px, i * 0.25f); - for (int line = 0; line < 100; line++) - { - if (track && line == track_line) - { - ImGui::TextColored(ImColor(255,255,0), "Line %d", line); - ImGui::SetScrollHere(i * 0.25f); // 0.0f:top, 0.5f:center, 1.0f:bottom - } - else - { - ImGui::Text("Line %d", line); - } - } - float scroll_y = ImGui::GetScrollY(), scroll_max_y = ImGui::GetScrollMaxY(); - ImGui::EndChild(); - ImGui::Text("%.0f/%0.f", scroll_y, scroll_max_y); - ImGui::EndGroup(); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Horizontal Scrolling")) - { - ImGui::Bullet(); ImGui::TextWrapped("Horizontal scrolling for a window has to be enabled explicitly via the ImGuiWindowFlags_HorizontalScrollbar flag."); - ImGui::Bullet(); ImGui::TextWrapped("You may want to explicitly specify content width by calling SetNextWindowContentWidth() before Begin()."); - static int lines = 7; - ImGui::SliderInt("Lines", &lines, 1, 15); - ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2.0f, 1.0f)); - ImGui::BeginChild("scrolling", ImVec2(0, ImGui::GetItemsLineHeightWithSpacing()*7 + 30), true, ImGuiWindowFlags_HorizontalScrollbar); - for (int line = 0; line < lines; line++) - { - // Display random stuff (for the sake of this trivial demo we are using basic Button+SameLine. If you want to create your own time line for a real application you may be better off - // manipulating the cursor position yourself, aka using SetCursorPos/SetCursorScreenPos to position the widgets yourself. You may also want to use the lower-level ImDrawList API) - int num_buttons = 10 + ((line & 1) ? line * 9 : line * 3); - for (int n = 0; n < num_buttons; n++) - { - if (n > 0) ImGui::SameLine(); - ImGui::PushID(n + line * 1000); - char num_buf[16]; - const char* label = (!(n%15)) ? "FizzBuzz" : (!(n%3)) ? "Fizz" : (!(n%5)) ? "Buzz" : (sprintf(num_buf, "%d", n), num_buf); - float hue = n*0.05f; - ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::HSV(hue, 0.6f, 0.6f)); - ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::HSV(hue, 0.7f, 0.7f)); - ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::HSV(hue, 0.8f, 0.8f)); - ImGui::Button(label, ImVec2(40.0f + sinf((float)(line + n)) * 20.0f, 0.0f)); - ImGui::PopStyleColor(3); - ImGui::PopID(); - } - } - float scroll_x = ImGui::GetScrollX(), scroll_max_x = ImGui::GetScrollMaxX(); - ImGui::EndChild(); - ImGui::PopStyleVar(2); - float scroll_x_delta = 0.0f; - ImGui::SmallButton("<<"); if (ImGui::IsItemActive()) scroll_x_delta = -ImGui::GetIO().DeltaTime * 1000.0f; ImGui::SameLine(); - ImGui::Text("Scroll from code"); ImGui::SameLine(); - ImGui::SmallButton(">>"); if (ImGui::IsItemActive()) scroll_x_delta = +ImGui::GetIO().DeltaTime * 1000.0f; ImGui::SameLine(); - ImGui::Text("%.0f/%.0f", scroll_x, scroll_max_x); - if (scroll_x_delta != 0.0f) - { - ImGui::BeginChild("scrolling"); // Demonstrate a trick: you can use Begin to set yourself in the context of another window (here we are already out of your child window) - ImGui::SetScrollX(ImGui::GetScrollX() + scroll_x_delta); - ImGui::End(); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Clipping")) - { - static ImVec2 size(100, 100), offset(50, 20); - ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost."); - ImGui::DragFloat2("size", (float*)&size, 0.5f, 0.0f, 200.0f, "%.0f"); - ImGui::TextWrapped("(Click and drag)"); - ImVec2 pos = ImGui::GetCursorScreenPos(); - ImVec4 clip_rect(pos.x, pos.y, pos.x+size.x, pos.y+size.y); - ImGui::InvisibleButton("##dummy", size); - if (ImGui::IsItemActive() && ImGui::IsMouseDragging()) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; } - ImGui::GetWindowDrawList()->AddRectFilled(pos, ImVec2(pos.x+size.x,pos.y+size.y), ImColor(90,90,120,255)); - ImGui::GetWindowDrawList()->AddText(ImGui::GetFont(), ImGui::GetFontSize()*2.0f, ImVec2(pos.x+offset.x,pos.y+offset.y), ImColor(255,255,255,255), "Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect); - ImGui::TreePop(); - } - } - - if (ImGui::CollapsingHeader("Popups & Modal windows")) - { - if (ImGui::TreeNode("Popups")) - { - ImGui::TextWrapped("When a popup is active, it inhibits interacting with windows that are behind the popup. Clicking outside the popup closes it."); - - static int selected_fish = -1; - const char* names[] = { "Bream", "Haddock", "Mackerel", "Pollock", "Tilefish" }; - static bool toggles[] = { true, false, false, false, false }; - - // Simple selection popup - // (If you want to show the current selection inside the Button itself, you may want to build a string using the "###" operator to preserve a constant ID with a variable label) - if (ImGui::Button("Select..")) - ImGui::OpenPopup("select"); - ImGui::SameLine(); - ImGui::TextUnformatted(selected_fish == -1 ? "" : names[selected_fish]); - if (ImGui::BeginPopup("select")) - { - ImGui::Text("Aquarium"); - ImGui::Separator(); - for (int i = 0; i < IM_ARRAYSIZE(names); i++) - if (ImGui::Selectable(names[i])) - selected_fish = i; - ImGui::EndPopup(); - } - - // Showing a menu with toggles - if (ImGui::Button("Toggle..")) - ImGui::OpenPopup("toggle"); - if (ImGui::BeginPopup("toggle")) - { - for (int i = 0; i < IM_ARRAYSIZE(names); i++) - ImGui::MenuItem(names[i], "", &toggles[i]); - if (ImGui::BeginMenu("Sub-menu")) - { - ImGui::MenuItem("Click me"); - ImGui::EndMenu(); - } - - ImGui::Separator(); - ImGui::Text("Tooltip here"); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("I am a tooltip over a popup"); - - if (ImGui::Button("Stacked Popup")) - ImGui::OpenPopup("another popup"); - if (ImGui::BeginPopup("another popup")) - { - for (int i = 0; i < IM_ARRAYSIZE(names); i++) - ImGui::MenuItem(names[i], "", &toggles[i]); - if (ImGui::BeginMenu("Sub-menu")) - { - ImGui::MenuItem("Click me"); - ImGui::EndMenu(); - } - ImGui::EndPopup(); - } - ImGui::EndPopup(); - } - - if (ImGui::Button("Popup Menu..")) - ImGui::OpenPopup("FilePopup"); - if (ImGui::BeginPopup("FilePopup")) - { - ShowExampleMenuFile(); - ImGui::EndPopup(); - } - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Context menus")) - { - // BeginPopupContextItem() is a helper to provide common/simple popup behavior of essentially doing: - // if (IsItemHovered() && IsMouseClicked(0)) - // OpenPopup(id); - // return BeginPopup(id); - // For more advanced uses you may want to replicate and cuztomize this code. This the comments inside BeginPopupContextItem() implementation. - static float value = 0.5f; - ImGui::Text("Value = %.3f (<-- right-click here)", value); - if (ImGui::BeginPopupContextItem("item context menu")) - { - if (ImGui::Selectable("Set to zero")) value = 0.0f; - if (ImGui::Selectable("Set to PI")) value = 3.1415f; - ImGui::PushItemWidth(-1); - ImGui::DragFloat("##Value", &value, 0.1f, 0.0f, 0.0f); - ImGui::PopItemWidth(); - ImGui::EndPopup(); - } - - static char name[32] = "Label1"; - char buf[64]; sprintf(buf, "Button: %s###Button", name); // ### operator override ID ignoring the preceding label - ImGui::Button(buf); - if (ImGui::BeginPopupContextItem()) // When used after an item that has an ID (here the Button), we can skip providing an ID to BeginPopupContextItem(). - { - ImGui::Text("Edit name:"); - ImGui::InputText("##edit", name, IM_ARRAYSIZE(name)); - if (ImGui::Button("Close")) - ImGui::CloseCurrentPopup(); - ImGui::EndPopup(); - } - ImGui::SameLine(); ImGui::Text("(<-- right-click here)"); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Modals")) - { - ImGui::TextWrapped("Modal windows are like popups but the user cannot close them by clicking outside the window."); - - if (ImGui::Button("Delete..")) - ImGui::OpenPopup("Delete?"); - if (ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize)) - { - ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); - ImGui::Separator(); - - //static int dummy_i = 0; - //ImGui::Combo("Combo", &dummy_i, "Delete\0Delete harder\0"); - - static bool dont_ask_me_next_time = false; - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); - ImGui::Checkbox("Don't ask me next time", &dont_ask_me_next_time); - ImGui::PopStyleVar(); - - if (ImGui::Button("OK", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); } - ImGui::SameLine(); - if (ImGui::Button("Cancel", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); } - ImGui::EndPopup(); - } - - if (ImGui::Button("Stacked modals..")) - ImGui::OpenPopup("Stacked 1"); - if (ImGui::BeginPopupModal("Stacked 1")) - { - ImGui::Text("Hello from Stacked The First\nUsing style.Colors[ImGuiCol_ModalWindowDarkening] for darkening."); - static int item = 1; - ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0"); - static float color[4] = { 0.4f,0.7f,0.0f,0.5f }; - ImGui::ColorEdit4("color", color); // This is to test behavior of stacked regular popups over a modal - - if (ImGui::Button("Add another modal..")) - ImGui::OpenPopup("Stacked 2"); - if (ImGui::BeginPopupModal("Stacked 2")) - { - ImGui::Text("Hello from Stacked The Second"); - if (ImGui::Button("Close")) - ImGui::CloseCurrentPopup(); - ImGui::EndPopup(); - } - - if (ImGui::Button("Close")) - ImGui::CloseCurrentPopup(); - ImGui::EndPopup(); - } - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Menus inside a regular window")) - { - ImGui::TextWrapped("Below we are testing adding menu items to a regular window. It's rather unusual but should work!"); - ImGui::Separator(); - // NB: As a quirk in this very specific example, we want to differentiate the parent of this menu from the parent of the various popup menus above. - // To do so we are encloding the items in a PushID()/PopID() block to make them two different menusets. If we don't, opening any popup above and hovering our menu here - // would open it. This is because once a menu is active, we allow to switch to a sibling menu by just hovering on it, which is the desired behavior for regular menus. - ImGui::PushID("foo"); - ImGui::MenuItem("Menu item", "CTRL+M"); - if (ImGui::BeginMenu("Menu inside a regular window")) - { - ShowExampleMenuFile(); - ImGui::EndMenu(); - } - ImGui::PopID(); - ImGui::Separator(); - ImGui::TreePop(); - } - } - - if (ImGui::CollapsingHeader("Columns")) - { - ImGui::PushID("Columns"); - - // Basic columns - if (ImGui::TreeNode("Basic")) - { - ImGui::Text("Without border:"); - ImGui::Columns(3, "mycolumns3", false); // 3-ways, no border - ImGui::Separator(); - for (int n = 0; n < 14; n++) - { - char label[32]; - sprintf(label, "Item %d", n); - if (ImGui::Selectable(label)) {} - //if (ImGui::Button(label, ImVec2(-1,0))) {} - ImGui::NextColumn(); - } - ImGui::Columns(1); - ImGui::Separator(); - - ImGui::Text("With border:"); - ImGui::Columns(4, "mycolumns"); // 4-ways, with border - ImGui::Separator(); - ImGui::Text("ID"); ImGui::NextColumn(); - ImGui::Text("Name"); ImGui::NextColumn(); - ImGui::Text("Path"); ImGui::NextColumn(); - ImGui::Text("Hovered"); ImGui::NextColumn(); - ImGui::Separator(); - const char* names[3] = { "One", "Two", "Three" }; - const char* paths[3] = { "/path/one", "/path/two", "/path/three" }; - static int selected = -1; - for (int i = 0; i < 3; i++) - { - char label[32]; - sprintf(label, "%04d", i); - if (ImGui::Selectable(label, selected == i, ImGuiSelectableFlags_SpanAllColumns)) - selected = i; - bool hovered = ImGui::IsItemHovered(); - ImGui::NextColumn(); - ImGui::Text(names[i]); ImGui::NextColumn(); - ImGui::Text(paths[i]); ImGui::NextColumn(); - ImGui::Text("%d", hovered); ImGui::NextColumn(); - } - ImGui::Columns(1); - ImGui::Separator(); - ImGui::TreePop(); - } - - // Create multiple items in a same cell before switching to next column - if (ImGui::TreeNode("Mixed items")) - { - ImGui::Columns(3, "mixed"); - ImGui::Separator(); - - ImGui::Text("Hello"); - ImGui::Button("Banana"); - ImGui::NextColumn(); - - ImGui::Text("ImGui"); - ImGui::Button("Apple"); - static float foo = 1.0f; - ImGui::InputFloat("red", &foo, 0.05f, 0, 3); - ImGui::Text("An extra line here."); - ImGui::NextColumn(); - - ImGui::Text("Sailor"); - ImGui::Button("Corniflower"); - static float bar = 1.0f; - ImGui::InputFloat("blue", &bar, 0.05f, 0, 3); - ImGui::NextColumn(); - - if (ImGui::CollapsingHeader("Category A")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); - if (ImGui::CollapsingHeader("Category B")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); - if (ImGui::CollapsingHeader("Category C")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn(); - ImGui::Columns(1); - ImGui::Separator(); - ImGui::TreePop(); - } - - // Word wrapping - if (ImGui::TreeNode("Word-wrapping")) - { - ImGui::Columns(2, "word-wrapping"); - ImGui::Separator(); - ImGui::TextWrapped("The quick brown fox jumps over the lazy dog."); - ImGui::TextWrapped("Hello Left"); - ImGui::NextColumn(); - ImGui::TextWrapped("The quick brown fox jumps over the lazy dog."); - ImGui::TextWrapped("Hello Right"); - ImGui::Columns(1); - ImGui::Separator(); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Borders")) - { - // NB: Future columns API should allow automatic horizontal borders. - static bool h_borders = true; - static bool v_borders = true; - ImGui::Checkbox("horizontal", &h_borders); - ImGui::SameLine(); - ImGui::Checkbox("vertical", &v_borders); - ImGui::Columns(4, NULL, v_borders); - for (int i = 0; i < 4*3; i++) - { - if (h_borders && ImGui::GetColumnIndex() == 0) - ImGui::Separator(); - ImGui::Text("%c%c%c", 'a'+i, 'a'+i, 'a'+i); - ImGui::Text("Width %.2f\nOffset %.2f", ImGui::GetColumnWidth(), ImGui::GetColumnOffset()); - ImGui::NextColumn(); - } - ImGui::Columns(1); - if (h_borders) - ImGui::Separator(); - ImGui::TreePop(); - } - - // Scrolling columns - /* - if (ImGui::TreeNode("Vertical Scrolling")) - { - ImGui::BeginChild("##header", ImVec2(0, ImGui::GetTextLineHeightWithSpacing()+ImGui::GetStyle().ItemSpacing.y)); - ImGui::Columns(3); - ImGui::Text("ID"); ImGui::NextColumn(); - ImGui::Text("Name"); ImGui::NextColumn(); - ImGui::Text("Path"); ImGui::NextColumn(); - ImGui::Columns(1); - ImGui::Separator(); - ImGui::EndChild(); - ImGui::BeginChild("##scrollingregion", ImVec2(0, 60)); - ImGui::Columns(3); - for (int i = 0; i < 10; i++) - { - ImGui::Text("%04d", i); ImGui::NextColumn(); - ImGui::Text("Foobar"); ImGui::NextColumn(); - ImGui::Text("/path/foobar/%04d/", i); ImGui::NextColumn(); - } - ImGui::Columns(1); - ImGui::EndChild(); - ImGui::TreePop(); - } - */ - - if (ImGui::TreeNode("Horizontal Scrolling")) - { - ImGui::SetNextWindowContentWidth(1500); - ImGui::BeginChild("##ScrollingRegion", ImVec2(0, ImGui::GetFontSize() * 20), false, ImGuiWindowFlags_HorizontalScrollbar); - ImGui::Columns(10); - int ITEMS_COUNT = 2000; - ImGuiListClipper clipper(ITEMS_COUNT); // Also demonstrate using the clipper for large list - while (clipper.Step()) - { - for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) - for (int j = 0; j < 10; j++) - { - ImGui::Text("Line %d Column %d...", i, j); - ImGui::NextColumn(); - } - } - ImGui::Columns(1); - ImGui::EndChild(); - ImGui::TreePop(); - } - - bool node_open = ImGui::TreeNode("Tree within single cell"); - ImGui::SameLine(); ShowHelpMarker("NB: Tree node must be poped before ending the cell. There's no storage of state per-cell."); - if (node_open) - { - ImGui::Columns(2, "tree items"); - ImGui::Separator(); - if (ImGui::TreeNode("Hello")) { ImGui::BulletText("Sailor"); ImGui::TreePop(); } ImGui::NextColumn(); - if (ImGui::TreeNode("Bonjour")) { ImGui::BulletText("Marin"); ImGui::TreePop(); } ImGui::NextColumn(); - ImGui::Columns(1); - ImGui::Separator(); - ImGui::TreePop(); - } - ImGui::PopID(); - } - - if (ImGui::CollapsingHeader("Filtering")) - { - static ImGuiTextFilter filter; - ImGui::Text("Filter usage:\n" - " \"\" display all lines\n" - " \"xxx\" display lines containing \"xxx\"\n" - " \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n" - " \"-xxx\" hide lines containing \"xxx\""); - filter.Draw(); - const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }; - for (int i = 0; i < IM_ARRAYSIZE(lines); i++) - if (filter.PassFilter(lines[i])) - ImGui::BulletText("%s", lines[i]); - } - - if (ImGui::CollapsingHeader("Inputs & Focus")) - { - ImGuiIO& io = ImGui::GetIO(); - ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor); - ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via regular GPU rendering will feel more laggy than hardware cursor, but will be more in sync with your other visuals."); - - ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse); - ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard); - ImGui::Text("WantTextInput: %d", io.WantTextInput); - ImGui::Text("WantMoveMouse: %d", io.WantMoveMouse); - - if (ImGui::TreeNode("Keyboard & Mouse State")) - { - ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); - ImGui::Text("Mouse down:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } - ImGui::Text("Mouse clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } - ImGui::Text("Mouse dbl-clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } - ImGui::Text("Mouse released:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } - ImGui::Text("Mouse wheel: %.1f", io.MouseWheel); - - ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (io.KeysDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("%d (%.02f secs)", i, io.KeysDownDuration[i]); } - ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d", i); } - ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); } - ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); - - - ImGui::Button("Hovering me sets the\nkeyboard capture flag"); - if (ImGui::IsItemHovered()) - ImGui::CaptureKeyboardFromApp(true); - ImGui::SameLine(); - ImGui::Button("Holding me clears the\nthe keyboard capture flag"); - if (ImGui::IsItemActive()) - ImGui::CaptureKeyboardFromApp(false); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Tabbing")) - { - ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields."); - static char buf[32] = "dummy"; - ImGui::InputText("1", buf, IM_ARRAYSIZE(buf)); - ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); - ImGui::InputText("3", buf, IM_ARRAYSIZE(buf)); - ImGui::PushAllowKeyboardFocus(false); - ImGui::InputText("4 (tab skip)", buf, IM_ARRAYSIZE(buf)); - //ImGui::SameLine(); ShowHelperMarker("Use ImGui::PushAllowKeyboardFocus(bool)\nto disable tabbing through certain widgets."); - ImGui::PopAllowKeyboardFocus(); - ImGui::InputText("5", buf, IM_ARRAYSIZE(buf)); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Focus from code")) - { - bool focus_1 = ImGui::Button("Focus on 1"); ImGui::SameLine(); - bool focus_2 = ImGui::Button("Focus on 2"); ImGui::SameLine(); - bool focus_3 = ImGui::Button("Focus on 3"); - int has_focus = 0; - static char buf[128] = "click on a button to set focus"; - - if (focus_1) ImGui::SetKeyboardFocusHere(); - ImGui::InputText("1", buf, IM_ARRAYSIZE(buf)); - if (ImGui::IsItemActive()) has_focus = 1; - - if (focus_2) ImGui::SetKeyboardFocusHere(); - ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); - if (ImGui::IsItemActive()) has_focus = 2; - - ImGui::PushAllowKeyboardFocus(false); - if (focus_3) ImGui::SetKeyboardFocusHere(); - ImGui::InputText("3 (tab skip)", buf, IM_ARRAYSIZE(buf)); - if (ImGui::IsItemActive()) has_focus = 3; - ImGui::PopAllowKeyboardFocus(); - if (has_focus) - ImGui::Text("Item with focus: %d", has_focus); - else - ImGui::Text("Item with focus: "); - ImGui::TextWrapped("Cursor & selection are preserved when refocusing last used item in code."); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Hovering")) - { - // Testing IsWindowHovered() function with its various flags (note that the flags can be combined) - ImGui::BulletText( - "IsWindowHovered() = %d\n" - "IsWindowHovered(_AllowWhenBlockedByPopup) = %d\n" - "IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n" - "IsWindowHovered(_FlattenChilds) = %d\n", - ImGui::IsWindowHovered(), - ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup), - ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), - ImGui::IsWindowHovered(ImGuiHoveredFlags_FlattenChilds)); - - // Testing IsItemHovered() function (because BulletText is an item itself and that would affect the output of IsItemHovered, we pass all lines in a single items to shorten the code) - ImGui::Button("ITEM"); - ImGui::BulletText( - "IsItemHovered() = %d\n" - "IsItemHovered(_AllowWhenBlockedByPopup) = %d\n" - "IsItemHovered(_AllowWhenBlockedByActiveItem) = %d\n" - "IsItemHovered(_AllowWhenOverlapped) = %d\n" - "IsItemhovered(_RectOnly) = %d\n", - ImGui::IsItemHovered(), - ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup), - ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), - ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenOverlapped), - ImGui::IsItemHovered(ImGuiHoveredFlags_RectOnly)); - - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Dragging")) - { - ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget."); - ImGui::Button("Drag Me"); - if (ImGui::IsItemActive()) - { - // Draw a line between the button and the mouse cursor - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - draw_list->PushClipRectFullScreen(); - draw_list->AddLine(ImGui::CalcItemRectClosestPoint(io.MousePos, true, -2.0f), io.MousePos, ImColor(ImGui::GetStyle().Colors[ImGuiCol_Button]), 4.0f); - draw_list->PopClipRect(); - ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f); - ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0); - ImVec2 mouse_delta = io.MouseDelta; - ImGui::SameLine(); ImGui::Text("Raw (%.1f, %.1f), WithLockThresold (%.1f, %.1f), MouseDelta (%.1f, %.1f)", value_raw.x, value_raw.y, value_with_lock_threshold.x, value_with_lock_threshold.y, mouse_delta.x, mouse_delta.y); - } - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Mouse cursors")) - { - ImGui::Text("Hover to see mouse cursors:"); - ImGui::SameLine(); ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it."); - for (int i = 0; i < ImGuiMouseCursor_Count_; i++) - { - char label[32]; - sprintf(label, "Mouse cursor %d", i); - ImGui::Bullet(); ImGui::Selectable(label, false); - if (ImGui::IsItemHovered()) - ImGui::SetMouseCursor(i); - } - ImGui::TreePop(); - } - } - - ImGui::End(); -} - -void ImGui::ShowStyleEditor(ImGuiStyle* ref) -{ - // You can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it compares to an internally stored reference) - ImGuiStyle& style = ImGui::GetStyle(); - static ImGuiStyle ref_saved_style; - - // Default to using internal storage as reference - static bool init = true; - if (init && ref == NULL) - ref_saved_style = style; - init = false; - if (ref == NULL) - ref = &ref_saved_style; - - ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f); - - // Default Styles Selector - static int style_idx = 0; - if (ImGui::Combo("Colors##Selector", &style_idx, "Classic\0Dark\0Light\0")) - { - switch (style_idx) - { - case 0: ImGui::StyleColorsClassic(); break; - case 1: ImGui::StyleColorsDark(); break; - case 2: ImGui::StyleColorsLight(); break; - } - ref_saved_style = style; - } - - // Simplified Settings - if (ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f")) - style.GrabRounding = style.FrameRounding; // Make GrabRounding always the same value as FrameRounding - { bool window_border = (style.WindowBorderSize > 0.0f); if (ImGui::Checkbox("WindowBorder", &window_border)) style.WindowBorderSize = window_border ? 1.0f : 0.0f; } - ImGui::SameLine(); - { bool frame_border = (style.FrameBorderSize > 0.0f); if (ImGui::Checkbox("FrameBorder", &frame_border)) style.FrameBorderSize = frame_border ? 1.0f : 0.0f; } - ImGui::SameLine(); - { bool popup_border = (style.PopupBorderSize > 0.0f); if (ImGui::Checkbox("PopupBorder", &popup_border)) style.PopupBorderSize = popup_border ? 1.0f : 0.0f; } - - // Save/Revert button - if (ImGui::Button("Save Ref")) - *ref = ref_saved_style = style; - ImGui::SameLine(); - if (ImGui::Button("Revert Ref")) - style = *ref; - ImGui::SameLine(); - ShowHelpMarker("Save/Revert in local non-persistent storage. Default Colors definition are not affected. Use \"Export Colors\" below to save them somewhere."); - - if (ImGui::TreeNode("Rendering")) - { - ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); ImGui::SameLine(); ShowHelpMarker("When disabling anti-aliasing lines, you'll probably want to disable borders in your style as well."); - ImGui::Checkbox("Anti-aliased shapes", &style.AntiAliasedShapes); - ImGui::PushItemWidth(100); - ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, NULL, 2.0f); - if (style.CurveTessellationTol < 0.0f) style.CurveTessellationTol = 0.10f; - ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero. - ImGui::PopItemWidth(); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Settings")) - { - ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); - ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 16.0f, "%.0f"); - ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); - ImGui::SliderFloat2("ItemSpacing", (float*)&style.ItemSpacing, 0.0f, 20.0f, "%.0f"); - ImGui::SliderFloat2("ItemInnerSpacing", (float*)&style.ItemInnerSpacing, 0.0f, 20.0f, "%.0f"); - ImGui::SliderFloat2("TouchExtraPadding", (float*)&style.TouchExtraPadding, 0.0f, 10.0f, "%.0f"); - ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); - ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); - ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); - ImGui::Text("BorderSize"); - ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui::Text("Rounding"); - ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 14.0f, "%.0f"); - ImGui::SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 16.0f, "%.0f"); - ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"); - ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); - ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f"); - ImGui::Text("Alignment"); - ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f"); - ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); ShowHelpMarker("Alignment applies when a button is larger than its text content."); - ImGui::TreePop(); - } - - if (ImGui::TreeNode("Colors")) - { - static int output_dest = 0; - static bool output_only_modified = true; - if (ImGui::Button("Export Unsaved")) - { - if (output_dest == 0) - ImGui::LogToClipboard(); - else - ImGui::LogToTTY(); - ImGui::LogText("ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE); - for (int i = 0; i < ImGuiCol_COUNT; i++) - { - const ImVec4& col = style.Colors[i]; - const char* name = ImGui::GetStyleColorName(i); - if (!output_only_modified || memcmp(&col, &ref->Colors[i], sizeof(ImVec4)) != 0) - ImGui::LogText("colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, %.2ff);" IM_NEWLINE, name, 23-(int)strlen(name), "", col.x, col.y, col.z, col.w); - } - ImGui::LogFinish(); - } - ImGui::SameLine(); ImGui::PushItemWidth(120); ImGui::Combo("##output_type", &output_dest, "To Clipboard\0To TTY\0"); ImGui::PopItemWidth(); - ImGui::SameLine(); ImGui::Checkbox("Only Modified Colors", &output_only_modified); - - ImGui::Text("Tip: Left-click on colored square to open color picker,\nRight-click to open edit options menu."); - - static ImGuiTextFilter filter; - filter.Draw("Filter colors", 200); - - static ImGuiColorEditFlags alpha_flags = 0; - ImGui::RadioButton("Opaque", &alpha_flags, 0); ImGui::SameLine(); - ImGui::RadioButton("Alpha", &alpha_flags, ImGuiColorEditFlags_AlphaPreview); ImGui::SameLine(); - ImGui::RadioButton("Both", &alpha_flags, ImGuiColorEditFlags_AlphaPreviewHalf); - - ImGui::BeginChild("#colors", ImVec2(0, 300), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar); - ImGui::PushItemWidth(-160); - for (int i = 0; i < ImGuiCol_COUNT; i++) - { - const char* name = ImGui::GetStyleColorName(i); - if (!filter.PassFilter(name)) - continue; - ImGui::PushID(i); - ImGui::ColorEdit4("##color", (float*)&style.Colors[i], ImGuiColorEditFlags_AlphaBar | alpha_flags); - if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0) - { - // Tips: in a real user application, you may want to merge and use an icon font into the main font, so instead of "Save"/"Revert" you'd use icons. - // Read the FAQ and extra_fonts/README.txt about using icon fonts. It's really easy and super convenient! - ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) ref->Colors[i] = style.Colors[i]; - ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) style.Colors[i] = ref->Colors[i]; - } - ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); - ImGui::TextUnformatted(name); - ImGui::PopID(); - } - ImGui::PopItemWidth(); - ImGui::EndChild(); - - ImGui::TreePop(); - } - - bool fonts_opened = ImGui::TreeNode("Fonts", "Fonts (%d)", ImGui::GetIO().Fonts->Fonts.Size); - ImGui::SameLine(); ShowHelpMarker("Tip: Load fonts with io.Fonts->AddFontFromFileTTF()\nbefore calling io.Fonts->GetTex* functions."); - if (fonts_opened) - { - ImFontAtlas* atlas = ImGui::GetIO().Fonts; - if (ImGui::TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) - { - ImGui::Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0,0), ImVec2(1,1), ImColor(255,255,255,255), ImColor(255,255,255,128)); - ImGui::TreePop(); - } - ImGui::PushItemWidth(100); - for (int i = 0; i < atlas->Fonts.Size; i++) - { - ImFont* font = atlas->Fonts[i]; - ImGui::PushID(font); - bool font_details_opened = ImGui::TreeNode(font, "Font %d: \'%s\', %.2f px, %d glyphs", i, font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size); - ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) ImGui::GetIO().FontDefault = font; - if (font_details_opened) - { - ImGui::PushFont(font); - ImGui::Text("The quick brown fox jumps over the lazy dog"); - ImGui::PopFont(); - ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font - ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)"); - ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent); - ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar); - ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)sqrtf((float)font->MetricsTotalSurface), (int)sqrtf((float)font->MetricsTotalSurface)); - for (int config_i = 0; config_i < font->ConfigDataCount; config_i++) - { - ImFontConfig* cfg = &font->ConfigData[config_i]; - ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH); - } - if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size)) - { - // Display all glyphs of the fonts in separate pages of 256 characters - const ImFontGlyph* glyph_fallback = font->FallbackGlyph; // Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior. - font->FallbackGlyph = NULL; - for (int base = 0; base < 0x10000; base += 256) - { - int count = 0; - for (int n = 0; n < 256; n++) - count += font->FindGlyph((ImWchar)(base + n)) ? 1 : 0; - if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ? "glyphs" : "glyph")) - { - float cell_spacing = style.ItemSpacing.y; - ImVec2 cell_size(font->FontSize * 1, font->FontSize * 1); - ImVec2 base_pos = ImGui::GetCursorScreenPos(); - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - for (int n = 0; n < 256; n++) - { - ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size.x + cell_spacing), base_pos.y + (n / 16) * (cell_size.y + cell_spacing)); - ImVec2 cell_p2(cell_p1.x + cell_size.x, cell_p1.y + cell_size.y); - const ImFontGlyph* glyph = font->FindGlyph((ImWchar)(base+n));; - draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255,255,255,100) : IM_COL32(255,255,255,50)); - font->RenderChar(draw_list, cell_size.x, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base+n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string. - if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2)) - { - ImGui::BeginTooltip(); - ImGui::Text("Codepoint: U+%04X", base+n); - ImGui::Separator(); - ImGui::Text("AdvanceX: %.1f", glyph->AdvanceX); - ImGui::Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1); - ImGui::Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1); - ImGui::EndTooltip(); - } - } - ImGui::Dummy(ImVec2((cell_size.x + cell_spacing) * 16, (cell_size.y + cell_spacing) * 16)); - ImGui::TreePop(); - } - } - font->FallbackGlyph = glyph_fallback; - ImGui::TreePop(); - } - ImGui::TreePop(); - } - ImGui::PopID(); - } - static float window_scale = 1.0f; - ImGui::DragFloat("this window scale", &window_scale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale only this window - ImGui::DragFloat("global scale", &ImGui::GetIO().FontGlobalScale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale everything - ImGui::PopItemWidth(); - ImGui::SetWindowFontScale(window_scale); - ImGui::TreePop(); - } - - ImGui::PopItemWidth(); -} - -// Demonstrate creating a fullscreen menu bar and populating it. -static void ShowExampleAppMainMenuBar() -{ - if (ImGui::BeginMainMenuBar()) - { - if (ImGui::BeginMenu("File")) - { - ShowExampleMenuFile(); - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("Edit")) - { - if (ImGui::MenuItem("Undo", "CTRL+Z")) {} - if (ImGui::MenuItem("Redo", "CTRL+Y", false, false)) {} // Disabled item - ImGui::Separator(); - if (ImGui::MenuItem("Cut", "CTRL+X")) {} - if (ImGui::MenuItem("Copy", "CTRL+C")) {} - if (ImGui::MenuItem("Paste", "CTRL+V")) {} - ImGui::EndMenu(); - } - ImGui::EndMainMenuBar(); - } -} - -static void ShowExampleMenuFile() -{ - ImGui::MenuItem("(dummy menu)", NULL, false, false); - if (ImGui::MenuItem("New")) {} - if (ImGui::MenuItem("Open", "Ctrl+O")) {} - if (ImGui::BeginMenu("Open Recent")) - { - ImGui::MenuItem("fish_hat.c"); - ImGui::MenuItem("fish_hat.inl"); - ImGui::MenuItem("fish_hat.h"); - if (ImGui::BeginMenu("More..")) - { - ImGui::MenuItem("Hello"); - ImGui::MenuItem("Sailor"); - if (ImGui::BeginMenu("Recurse..")) - { - ShowExampleMenuFile(); - ImGui::EndMenu(); - } - ImGui::EndMenu(); - } - ImGui::EndMenu(); - } - if (ImGui::MenuItem("Save", "Ctrl+S")) {} - if (ImGui::MenuItem("Save As..")) {} - ImGui::Separator(); - if (ImGui::BeginMenu("Options")) - { - static bool enabled = true; - ImGui::MenuItem("Enabled", "", &enabled); - ImGui::BeginChild("child", ImVec2(0, 60), true); - for (int i = 0; i < 10; i++) - ImGui::Text("Scrolling Text %d", i); - ImGui::EndChild(); - static float f = 0.5f; - static int n = 0; - static bool b = true; - ImGui::SliderFloat("Value", &f, 0.0f, 1.0f); - ImGui::InputFloat("Input", &f, 0.1f); - ImGui::Combo("Combo", &n, "Yes\0No\0Maybe\0\0"); - ImGui::Checkbox("Check", &b); - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("Colors")) - { - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); - for (int i = 0; i < ImGuiCol_COUNT; i++) - { - const char* name = ImGui::GetStyleColorName((ImGuiCol)i); - ImGui::ColorButton(name, ImGui::GetStyleColorVec4((ImGuiCol)i)); - ImGui::SameLine(); - ImGui::MenuItem(name); - } - ImGui::PopStyleVar(); - ImGui::EndMenu(); - } - if (ImGui::BeginMenu("Disabled", false)) // Disabled - { - IM_ASSERT(0); - } - if (ImGui::MenuItem("Checked", NULL, true)) {} - if (ImGui::MenuItem("Quit", "Alt+F4")) {} -} - -// Demonstrate creating a window which gets auto-resized according to its content. -static void ShowExampleAppAutoResize(bool* p_open) -{ - if (!ImGui::Begin("Example: Auto-resizing window", p_open, ImGuiWindowFlags_AlwaysAutoResize)) - { - ImGui::End(); - return; - } - - static int lines = 10; - ImGui::Text("Window will resize every-frame to the size of its content.\nNote that you probably don't want to query the window size to\noutput your content because that would create a feedback loop."); - ImGui::SliderInt("Number of lines", &lines, 1, 20); - for (int i = 0; i < lines; i++) - ImGui::Text("%*sThis is line %d", i*4, "", i); // Pad with space to extend size horizontally - ImGui::End(); -} - -// Demonstrate creating a window with custom resize constraints. -static void ShowExampleAppConstrainedResize(bool* p_open) -{ - struct CustomConstraints // Helper functions to demonstrate programmatic constraints - { - static void Square(ImGuiSizeConstraintCallbackData* data) { data->DesiredSize = ImVec2(IM_MAX(data->DesiredSize.x, data->DesiredSize.y), IM_MAX(data->DesiredSize.x, data->DesiredSize.y)); } - static void Step(ImGuiSizeConstraintCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); } - }; - - static bool auto_resize = false; - static int type = 0; - static int display_lines = 10; - if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only - if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only - if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100 - if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width 400-500 - if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 500)); // Height 400-500 - if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square - if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)100);// Fixed Step - - ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0; - if (ImGui::Begin("Example: Constrained Resize", p_open, flags)) - { - const char* desc[] = - { - "Resize vertical only", - "Resize horizontal only", - "Width > 100, Height > 100", - "Width 400-500", - "Height 400-500", - "Custom: Always Square", - "Custom: Fixed Steps (100)", - }; - if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine(); - if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine(); - if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); } - ImGui::PushItemWidth(200); - ImGui::Combo("Constraint", &type, desc, IM_ARRAYSIZE(desc)); - ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100); - ImGui::PopItemWidth(); - ImGui::Checkbox("Auto-resize", &auto_resize); - for (int i = 0; i < display_lines; i++) - ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, ""); - } - ImGui::End(); -} - -// Demonstrate creating a simple static window with no decoration + a context-menu to choose which corner of the screen to use. -static void ShowExampleAppFixedOverlay(bool* p_open) -{ - const float DISTANCE = 10.0f; - static int corner = 0; - ImVec2 window_pos = ImVec2((corner & 1) ? ImGui::GetIO().DisplaySize.x - DISTANCE : DISTANCE, (corner & 2) ? ImGui::GetIO().DisplaySize.y - DISTANCE : DISTANCE); - ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f); - ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot); - ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.3f)); // Transparent background - if (ImGui::Begin("Example: Fixed Overlay", p_open, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoSavedSettings)) - { - ImGui::Text("Simple overlay\nin the corner of the screen.\n(right-click to change position)"); - ImGui::Separator(); - ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y); - if (ImGui::BeginPopupContextWindow()) - { - if (ImGui::MenuItem("Top-left", NULL, corner == 0)) corner = 0; - if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1; - if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2; - if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3; - ImGui::EndPopup(); - } - ImGui::End(); - } - ImGui::PopStyleColor(); -} - -// Demonstrate using "##" and "###" in identifiers to manipulate ID generation. -// Read section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." about ID. -static void ShowExampleAppManipulatingWindowTitle(bool*) -{ - // By default, Windows are uniquely identified by their title. - // You can use the "##" and "###" markers to manipulate the display/ID. - - // Using "##" to display same title but have unique identifier. - ImGui::SetNextWindowPos(ImVec2(100,100), ImGuiCond_FirstUseEver); - ImGui::Begin("Same title as another window##1"); - ImGui::Text("This is window 1.\nMy title is the same as window 2, but my identifier is unique."); - ImGui::End(); - - ImGui::SetNextWindowPos(ImVec2(100,200), ImGuiCond_FirstUseEver); - ImGui::Begin("Same title as another window##2"); - ImGui::Text("This is window 2.\nMy title is the same as window 1, but my identifier is unique."); - ImGui::End(); - - // Using "###" to display a changing title but keep a static identifier "AnimatedTitle" - char buf[128]; - sprintf(buf, "Animated title %c %d###AnimatedTitle", "|/-\\"[(int)(ImGui::GetTime()/0.25f)&3], rand()); - ImGui::SetNextWindowPos(ImVec2(100,300), ImGuiCond_FirstUseEver); - ImGui::Begin(buf); - ImGui::Text("This window has a changing title."); - ImGui::End(); -} - -// Demonstrate using the low-level ImDrawList to draw custom shapes. -static void ShowExampleAppCustomRendering(bool* p_open) -{ - ImGui::SetNextWindowSize(ImVec2(350,560), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Example: Custom rendering", p_open)) - { - ImGui::End(); - return; - } - - // Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of overloaded operators, etc. - // Define IM_VEC2_CLASS_EXTRA in imconfig.h to create implicit conversions between your types and ImVec2/ImVec4. - // ImGui defines overloaded operators but they are internal to imgui.cpp and not exposed outside (to avoid messing with your types) - // In this example we are not using the maths operators! - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - - // Primitives - ImGui::Text("Primitives"); - static float sz = 36.0f; - static ImVec4 col = ImVec4(1.0f,1.0f,0.4f,1.0f); - ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f"); - ImGui::ColorEdit3("Color", &col.x); - { - const ImVec2 p = ImGui::GetCursorScreenPos(); - const ImU32 col32 = ImColor(col); - float x = p.x + 4.0f, y = p.y + 4.0f, spacing = 8.0f; - for (int n = 0; n < 2; n++) - { - float thickness = (n == 0) ? 1.0f : 4.0f; - draw_list->AddCircle(ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 20, thickness); x += sz+spacing; - draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 0.0f, ImDrawCornerFlags_All, thickness); x += sz+spacing; - draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_All, thickness); x += sz+spacing; - draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotRight, thickness); x += sz+spacing; - draw_list->AddTriangle(ImVec2(x+sz*0.5f, y), ImVec2(x+sz,y+sz-0.5f), ImVec2(x,y+sz-0.5f), col32, thickness); x += sz+spacing; - draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y ), col32, thickness); x += sz+spacing; - draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, thickness); x += sz+spacing; - draw_list->AddLine(ImVec2(x, y), ImVec2(x, y+sz), col32, thickness); x += spacing; - draw_list->AddBezierCurve(ImVec2(x, y), ImVec2(x+sz*1.3f,y+sz*0.3f), ImVec2(x+sz-sz*1.3f,y+sz-sz*0.3f), ImVec2(x+sz, y+sz), col32, thickness); - x = p.x + 4; - y += sz+spacing; - } - draw_list->AddCircleFilled(ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 32); x += sz+spacing; - draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32); x += sz+spacing; - draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f); x += sz+spacing; - draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotRight); x += sz+spacing; - draw_list->AddTriangleFilled(ImVec2(x+sz*0.5f, y), ImVec2(x+sz,y+sz-0.5f), ImVec2(x,y+sz-0.5f), col32); x += sz+spacing; - draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x+sz, y+sz), ImColor(0,0,0), ImColor(255,0,0), ImColor(255,255,0), ImColor(0,255,0)); - ImGui::Dummy(ImVec2((sz+spacing)*8, (sz+spacing)*3)); - } - ImGui::Separator(); - { - static ImVector points; - static bool adding_line = false; - ImGui::Text("Canvas example"); - if (ImGui::Button("Clear")) points.clear(); - if (points.Size >= 2) { ImGui::SameLine(); if (ImGui::Button("Undo")) { points.pop_back(); points.pop_back(); } } - ImGui::Text("Left-click and drag to add lines,\nRight-click to undo"); - - // Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered() - // However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos(). - // If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max). - ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates! - ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available - if (canvas_size.x < 50.0f) canvas_size.x = 50.0f; - if (canvas_size.y < 50.0f) canvas_size.y = 50.0f; - draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(50,50,50), ImColor(50,50,60), ImColor(60,60,70), ImColor(50,50,60)); - draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(255,255,255)); - - bool adding_preview = false; - ImGui::InvisibleButton("canvas", canvas_size); - ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y); - if (adding_line) - { - adding_preview = true; - points.push_back(mouse_pos_in_canvas); - if (!ImGui::GetIO().MouseDown[0]) - adding_line = adding_preview = false; - } - if (ImGui::IsItemHovered()) - { - if (!adding_line && ImGui::IsMouseClicked(0)) - { - points.push_back(mouse_pos_in_canvas); - adding_line = true; - } - if (ImGui::IsMouseClicked(1) && !points.empty()) - { - adding_line = adding_preview = false; - points.pop_back(); - points.pop_back(); - } - } - draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.) - for (int i = 0; i < points.Size - 1; i += 2) - draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f); - draw_list->PopClipRect(); - if (adding_preview) - points.pop_back(); - } - ImGui::End(); -} - -// Demonstrating creating a simple console window, with scrolling, filtering, completion and history. -// For the console example, here we are using a more C++ like approach of declaring a class to hold the data and the functions. -struct ExampleAppConsole -{ - char InputBuf[256]; - ImVector Items; - bool ScrollToBottom; - ImVector History; - int HistoryPos; // -1: new line, 0..History.Size-1 browsing history. - ImVector Commands; - - ExampleAppConsole() - { - ClearLog(); - memset(InputBuf, 0, sizeof(InputBuf)); - HistoryPos = -1; - Commands.push_back("HELP"); - Commands.push_back("HISTORY"); - Commands.push_back("CLEAR"); - Commands.push_back("CLASSIFY"); // "classify" is here to provide an example of "C"+[tab] completing to "CL" and displaying matches. - AddLog("Welcome to ImGui!"); - } - ~ExampleAppConsole() - { - ClearLog(); - for (int i = 0; i < History.Size; i++) - free(History[i]); - } - - // Portable helpers - static int Stricmp(const char* str1, const char* str2) { int d; while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } - static int Strnicmp(const char* str1, const char* str2, int n) { int d = 0; while (n > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; n--; } return d; } - static char* Strdup(const char *str) { size_t len = strlen(str) + 1; void* buff = malloc(len); return (char*)memcpy(buff, (const void*)str, len); } - - void ClearLog() - { - for (int i = 0; i < Items.Size; i++) - free(Items[i]); - Items.clear(); - ScrollToBottom = true; - } - - void AddLog(const char* fmt, ...) IM_FMTARGS(2) - { - // FIXME-OPT - char buf[1024]; - va_list args; - va_start(args, fmt); - vsnprintf(buf, IM_ARRAYSIZE(buf), fmt, args); - buf[IM_ARRAYSIZE(buf)-1] = 0; - va_end(args); - Items.push_back(Strdup(buf)); - ScrollToBottom = true; - } - - void Draw(const char* title, bool* p_open) - { - ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin(title, p_open)) - { - ImGui::End(); - return; - } - - // As a specific feature guaranteed by the library, after calling Begin() the last Item represent the title bar. So e.g. IsItemHovered() will return true when hovering the title bar. - // Here we create a context menu only available from the title bar. - if (ImGui::BeginPopupContextItem()) - { - if (ImGui::MenuItem("Close")) - *p_open = false; - ImGui::EndPopup(); - } - - ImGui::TextWrapped("This example implements a console with basic coloring, completion and history. A more elaborate implementation may want to store entries along with extra data such as timestamp, emitter, etc."); - ImGui::TextWrapped("Enter 'HELP' for help, press TAB to use text completion."); - - // TODO: display items starting from the bottom - - if (ImGui::SmallButton("Add Dummy Text")) { AddLog("%d some text", Items.Size); AddLog("some more text"); AddLog("display very important message here!"); } ImGui::SameLine(); - if (ImGui::SmallButton("Add Dummy Error")) { AddLog("[error] something went wrong"); } ImGui::SameLine(); - if (ImGui::SmallButton("Clear")) { ClearLog(); } ImGui::SameLine(); - bool copy_to_clipboard = ImGui::SmallButton("Copy"); ImGui::SameLine(); - if (ImGui::SmallButton("Scroll to bottom")) ScrollToBottom = true; - //static float t = 0.0f; if (ImGui::GetTime() - t > 0.02f) { t = ImGui::GetTime(); AddLog("Spam %f", t); } - - ImGui::Separator(); - - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0)); - static ImGuiTextFilter filter; - filter.Draw("Filter (\"incl,-excl\") (\"error\")", 180); - ImGui::PopStyleVar(); - ImGui::Separator(); - - ImGui::BeginChild("ScrollingRegion", ImVec2(0, -ImGui::GetStyle().ItemSpacing.y - ImGui::GetItemsLineHeightWithSpacing()), false, ImGuiWindowFlags_HorizontalScrollbar); // Leave room for 1 separator + 1 InputText - if (ImGui::BeginPopupContextWindow()) - { - if (ImGui::Selectable("Clear")) ClearLog(); - ImGui::EndPopup(); - } - - // Display every line as a separate entry so we can change their color or add custom widgets. If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); - // NB- if you have thousands of entries this approach may be too inefficient and may require user-side clipping to only process visible items. - // You can seek and display only the lines that are visible using the ImGuiListClipper helper, if your elements are evenly spaced and you have cheap random access to the elements. - // To use the clipper we could replace the 'for (int i = 0; i < Items.Size; i++)' loop with: - // ImGuiListClipper clipper(Items.Size); - // while (clipper.Step()) - // for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) - // However take note that you can not use this code as is if a filter is active because it breaks the 'cheap random-access' property. We would need random-access on the post-filtered list. - // A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices that passed the filtering test, recomputing this array when user changes the filter, - // and appending newly elements as they are inserted. This is left as a task to the user until we can manage to improve this example code! - // If your items are of variable size you may want to implement code similar to what ImGuiListClipper does. Or split your data into fixed height items to allow random-seeking into your list. - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing - if (copy_to_clipboard) - ImGui::LogToClipboard(); - for (int i = 0; i < Items.Size; i++) - { - const char* item = Items[i]; - if (!filter.PassFilter(item)) - continue; - ImVec4 col = ImVec4(1.0f,1.0f,1.0f,1.0f); // A better implementation may store a type per-item. For the sample let's just parse the text. - if (strstr(item, "[error]")) col = ImColor(1.0f,0.4f,0.4f,1.0f); - else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f); - ImGui::PushStyleColor(ImGuiCol_Text, col); - ImGui::TextUnformatted(item); - ImGui::PopStyleColor(); - } - if (copy_to_clipboard) - ImGui::LogFinish(); - if (ScrollToBottom) - ImGui::SetScrollHere(); - ScrollToBottom = false; - ImGui::PopStyleVar(); - ImGui::EndChild(); - ImGui::Separator(); - - // Command-line - if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this)) - { - char* input_end = InputBuf+strlen(InputBuf); - while (input_end > InputBuf && input_end[-1] == ' ') { input_end--; } *input_end = 0; - if (InputBuf[0]) - ExecCommand(InputBuf); - strcpy(InputBuf, ""); - } - - // Demonstrate keeping auto focus on the input box - if (ImGui::IsItemHovered() || (ImGui::IsRootWindowOrAnyChildFocused() && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0))) - ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget - - ImGui::End(); - } - - void ExecCommand(const char* command_line) - { - AddLog("# %s\n", command_line); - - // Insert into history. First find match and delete it so it can be pushed to the back. This isn't trying to be smart or optimal. - HistoryPos = -1; - for (int i = History.Size-1; i >= 0; i--) - if (Stricmp(History[i], command_line) == 0) - { - free(History[i]); - History.erase(History.begin() + i); - break; - } - History.push_back(Strdup(command_line)); - - // Process command - if (Stricmp(command_line, "CLEAR") == 0) - { - ClearLog(); - } - else if (Stricmp(command_line, "HELP") == 0) - { - AddLog("Commands:"); - for (int i = 0; i < Commands.Size; i++) - AddLog("- %s", Commands[i]); - } - else if (Stricmp(command_line, "HISTORY") == 0) - { - int first = History.Size - 10; - for (int i = first > 0 ? first : 0; i < History.Size; i++) - AddLog("%3d: %s\n", i, History[i]); - } - else - { - AddLog("Unknown command: '%s'\n", command_line); - } - } - - static int TextEditCallbackStub(ImGuiTextEditCallbackData* data) // In C++11 you are better off using lambdas for this sort of forwarding callbacks - { - ExampleAppConsole* console = (ExampleAppConsole*)data->UserData; - return console->TextEditCallback(data); - } - - int TextEditCallback(ImGuiTextEditCallbackData* data) - { - //AddLog("cursor: %d, selection: %d-%d", data->CursorPos, data->SelectionStart, data->SelectionEnd); - switch (data->EventFlag) - { - case ImGuiInputTextFlags_CallbackCompletion: - { - // Example of TEXT COMPLETION - - // Locate beginning of current word - const char* word_end = data->Buf + data->CursorPos; - const char* word_start = word_end; - while (word_start > data->Buf) - { - const char c = word_start[-1]; - if (c == ' ' || c == '\t' || c == ',' || c == ';') - break; - word_start--; - } - - // Build a list of candidates - ImVector candidates; - for (int i = 0; i < Commands.Size; i++) - if (Strnicmp(Commands[i], word_start, (int)(word_end-word_start)) == 0) - candidates.push_back(Commands[i]); - - if (candidates.Size == 0) - { - // No match - AddLog("No match for \"%.*s\"!\n", (int)(word_end-word_start), word_start); - } - else if (candidates.Size == 1) - { - // Single match. Delete the beginning of the word and replace it entirely so we've got nice casing - data->DeleteChars((int)(word_start-data->Buf), (int)(word_end-word_start)); - data->InsertChars(data->CursorPos, candidates[0]); - data->InsertChars(data->CursorPos, " "); - } - else - { - // Multiple matches. Complete as much as we can, so inputing "C" will complete to "CL" and display "CLEAR" and "CLASSIFY" - int match_len = (int)(word_end - word_start); - for (;;) - { - int c = 0; - bool all_candidates_matches = true; - for (int i = 0; i < candidates.Size && all_candidates_matches; i++) - if (i == 0) - c = toupper(candidates[i][match_len]); - else if (c == 0 || c != toupper(candidates[i][match_len])) - all_candidates_matches = false; - if (!all_candidates_matches) - break; - match_len++; - } - - if (match_len > 0) - { - data->DeleteChars((int)(word_start - data->Buf), (int)(word_end-word_start)); - data->InsertChars(data->CursorPos, candidates[0], candidates[0] + match_len); - } - - // List matches - AddLog("Possible matches:\n"); - for (int i = 0; i < candidates.Size; i++) - AddLog("- %s\n", candidates[i]); - } - - break; - } - case ImGuiInputTextFlags_CallbackHistory: - { - // Example of HISTORY - const int prev_history_pos = HistoryPos; - if (data->EventKey == ImGuiKey_UpArrow) - { - if (HistoryPos == -1) - HistoryPos = History.Size - 1; - else if (HistoryPos > 0) - HistoryPos--; - } - else if (data->EventKey == ImGuiKey_DownArrow) - { - if (HistoryPos != -1) - if (++HistoryPos >= History.Size) - HistoryPos = -1; - } - - // A better implementation would preserve the data on the current input line along with cursor position. - if (prev_history_pos != HistoryPos) - { - data->CursorPos = data->SelectionStart = data->SelectionEnd = data->BufTextLen = (int)snprintf(data->Buf, (size_t)data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : ""); - data->BufDirty = true; - } - } - } - return 0; - } -}; - -static void ShowExampleAppConsole(bool* p_open) -{ - static ExampleAppConsole console; - console.Draw("Example: Console", p_open); -} - -// Usage: -// static ExampleAppLog my_log; -// my_log.AddLog("Hello %d world\n", 123); -// my_log.Draw("title"); -struct ExampleAppLog -{ - ImGuiTextBuffer Buf; - ImGuiTextFilter Filter; - ImVector LineOffsets; // Index to lines offset - bool ScrollToBottom; - - void Clear() { Buf.clear(); LineOffsets.clear(); } - - void AddLog(const char* fmt, ...) IM_FMTARGS(2) - { - int old_size = Buf.size(); - va_list args; - va_start(args, fmt); - Buf.appendfv(fmt, args); - va_end(args); - for (int new_size = Buf.size(); old_size < new_size; old_size++) - if (Buf[old_size] == '\n') - LineOffsets.push_back(old_size); - ScrollToBottom = true; - } - - void Draw(const char* title, bool* p_open = NULL) - { - ImGui::SetNextWindowSize(ImVec2(500,400), ImGuiCond_FirstUseEver); - ImGui::Begin(title, p_open); - if (ImGui::Button("Clear")) Clear(); - ImGui::SameLine(); - bool copy = ImGui::Button("Copy"); - ImGui::SameLine(); - Filter.Draw("Filter", -100.0f); - ImGui::Separator(); - ImGui::BeginChild("scrolling", ImVec2(0,0), false, ImGuiWindowFlags_HorizontalScrollbar); - if (copy) ImGui::LogToClipboard(); - - if (Filter.IsActive()) - { - const char* buf_begin = Buf.begin(); - const char* line = buf_begin; - for (int line_no = 0; line != NULL; line_no++) - { - const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL; - if (Filter.PassFilter(line, line_end)) - ImGui::TextUnformatted(line, line_end); - line = line_end && line_end[1] ? line_end + 1 : NULL; - } - } - else - { - ImGui::TextUnformatted(Buf.begin()); - } - - if (ScrollToBottom) - ImGui::SetScrollHere(1.0f); - ScrollToBottom = false; - ImGui::EndChild(); - ImGui::End(); - } -}; - -// Demonstrate creating a simple log window with basic filtering. -static void ShowExampleAppLog(bool* p_open) -{ - static ExampleAppLog log; - - // Demo: add random items (unless Ctrl is held) - static float last_time = -1.0f; - float time = ImGui::GetTime(); - if (time - last_time >= 0.20f && !ImGui::GetIO().KeyCtrl) - { - const char* random_words[] = { "system", "info", "warning", "error", "fatal", "notice", "log" }; - log.AddLog("[%s] Hello, time is %.1f, rand() %d\n", random_words[rand() % IM_ARRAYSIZE(random_words)], time, (int)rand()); - last_time = time; - } - - log.Draw("Example: Log", p_open); -} - -// Demonstrate create a window with multiple child windows. -static void ShowExampleAppLayout(bool* p_open) -{ - ImGui::SetNextWindowSize(ImVec2(500, 440), ImGuiCond_FirstUseEver); - if (ImGui::Begin("Example: Layout", p_open, ImGuiWindowFlags_MenuBar)) - { - if (ImGui::BeginMenuBar()) - { - if (ImGui::BeginMenu("File")) - { - if (ImGui::MenuItem("Close")) *p_open = false; - ImGui::EndMenu(); - } - ImGui::EndMenuBar(); - } - - // left - static int selected = 0; - ImGui::BeginChild("left pane", ImVec2(150, 0), true); - for (int i = 0; i < 100; i++) - { - char label[128]; - sprintf(label, "MyObject %d", i); - if (ImGui::Selectable(label, selected == i)) - selected = i; - } - ImGui::EndChild(); - ImGui::SameLine(); - - // right - ImGui::BeginGroup(); - ImGui::BeginChild("item view", ImVec2(0, -ImGui::GetItemsLineHeightWithSpacing())); // Leave room for 1 line below us - ImGui::Text("MyObject: %d", selected); - ImGui::Separator(); - ImGui::TextWrapped("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. "); - ImGui::EndChild(); - if (ImGui::Button("Revert")) {} - ImGui::SameLine(); - if (ImGui::Button("Save")) {} - ImGui::EndGroup(); - } - ImGui::End(); -} - -// Demonstrate create a simple property editor. -static void ShowExampleAppPropertyEditor(bool* p_open) -{ - ImGui::SetNextWindowSize(ImVec2(430,450), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Example: Property editor", p_open)) - { - ImGui::End(); - return; - } - - ShowHelpMarker("This example shows how you may implement a property editor using two columns.\nAll objects/fields data are dummies here.\nRemember that in many simple cases, you can use ImGui::SameLine(xxx) to position\nyour cursor horizontally instead of using the Columns() API."); - - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2,2)); - ImGui::Columns(2); - ImGui::Separator(); - - struct funcs - { - static void ShowDummyObject(const char* prefix, int uid) - { - ImGui::PushID(uid); // Use object uid as identifier. Most commonly you could also use the object pointer as a base ID. - ImGui::AlignTextToFramePadding(); // Text and Tree nodes are less high than regular widgets, here we add vertical spacing to make the tree lines equal high. - bool node_open = ImGui::TreeNode("Object", "%s_%u", prefix, uid); - ImGui::NextColumn(); - ImGui::AlignTextToFramePadding(); - ImGui::Text("my sailor is rich"); - ImGui::NextColumn(); - if (node_open) - { - static float dummy_members[8] = { 0.0f,0.0f,1.0f,3.1416f,100.0f,999.0f }; - for (int i = 0; i < 8; i++) - { - ImGui::PushID(i); // Use field index as identifier. - if (i < 2) - { - ShowDummyObject("Child", 424242); - } - else - { - ImGui::AlignTextToFramePadding(); - // Here we use a Selectable (instead of Text) to highlight on hover - //ImGui::Text("Field_%d", i); - char label[32]; - sprintf(label, "Field_%d", i); - ImGui::Bullet(); - ImGui::Selectable(label); - ImGui::NextColumn(); - ImGui::PushItemWidth(-1); - if (i >= 5) - ImGui::InputFloat("##value", &dummy_members[i], 1.0f); - else - ImGui::DragFloat("##value", &dummy_members[i], 0.01f); - ImGui::PopItemWidth(); - ImGui::NextColumn(); - } - ImGui::PopID(); - } - ImGui::TreePop(); - } - ImGui::PopID(); - } - }; - - // Iterate dummy objects with dummy members (all the same data) - for (int obj_i = 0; obj_i < 3; obj_i++) - funcs::ShowDummyObject("Object", obj_i); - - ImGui::Columns(1); - ImGui::Separator(); - ImGui::PopStyleVar(); - ImGui::End(); -} - -// Demonstrate/test rendering huge amount of text, and the incidence of clipping. -static void ShowExampleAppLongText(bool* p_open) -{ - ImGui::SetNextWindowSize(ImVec2(520,600), ImGuiCond_FirstUseEver); - if (!ImGui::Begin("Example: Long text display", p_open)) - { - ImGui::End(); - return; - } - - static int test_type = 0; - static ImGuiTextBuffer log; - static int lines = 0; - ImGui::Text("Printing unusually long amount of text."); - ImGui::Combo("Test type", &test_type, "Single call to TextUnformatted()\0Multiple calls to Text(), clipped manually\0Multiple calls to Text(), not clipped (slow)\0"); - ImGui::Text("Buffer contents: %d lines, %d bytes", lines, log.size()); - if (ImGui::Button("Clear")) { log.clear(); lines = 0; } - ImGui::SameLine(); - if (ImGui::Button("Add 1000 lines")) - { - for (int i = 0; i < 1000; i++) - log.appendf("%i The quick brown fox jumps over the lazy dog\n", lines+i); - lines += 1000; - } - ImGui::BeginChild("Log"); - switch (test_type) - { - case 0: - // Single call to TextUnformatted() with a big buffer - ImGui::TextUnformatted(log.begin(), log.end()); - break; - case 1: - { - // Multiple calls to Text(), manually coarsely clipped - demonstrate how to use the ImGuiListClipper helper. - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); - ImGuiListClipper clipper(lines); - while (clipper.Step()) - for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) - ImGui::Text("%i The quick brown fox jumps over the lazy dog", i); - ImGui::PopStyleVar(); - break; - } - case 2: - // Multiple calls to Text(), not clipped (slow) - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0,0)); - for (int i = 0; i < lines; i++) - ImGui::Text("%i The quick brown fox jumps over the lazy dog", i); - ImGui::PopStyleVar(); - break; - } - ImGui::EndChild(); - ImGui::End(); -} - -// End of Demo code -#else - -void ImGui::ShowTestWindow(bool*) {} -void ImGui::ShowUserGuide() {} -void ImGui::ShowStyleEditor(ImGuiStyle*) {} - -#endif diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h deleted file mode 100644 index 80d18ac5fe2..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_internal.h +++ /dev/null @@ -1,916 +0,0 @@ -// dear imgui, v1.53 WIP -// (internals) - -// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! -// Set: -// #define IMGUI_DEFINE_MATH_OPERATORS -// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators) - -#pragma once - -#ifndef IMGUI_VERSION -#error Must include imgui.h before imgui_internal.h -#endif - -#include // FILE* -#include // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf - -#ifdef _MSC_VER -#pragma warning (push) -#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport) -#endif - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" // for stb_textedit.h -#pragma clang diagnostic ignored "-Wmissing-prototypes" // for stb_textedit.h -#pragma clang diagnostic ignored "-Wold-style-cast" -#endif - -//----------------------------------------------------------------------------- -// Forward Declarations -//----------------------------------------------------------------------------- - -struct ImRect; -struct ImGuiColMod; -struct ImGuiStyleMod; -struct ImGuiGroupData; -struct ImGuiSimpleColumns; -struct ImGuiDrawContext; -struct ImGuiTextEditState; -struct ImGuiMouseCursorData; -struct ImGuiPopupRef; -struct ImGuiWindow; -struct ImGuiWindowSettings; - -typedef int ImGuiLayoutType; // enum: horizontal or vertical // enum ImGuiLayoutType_ -typedef int ImGuiButtonFlags; // flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_ -typedef int ImGuiItemFlags; // flags: for PushItemFlag() // enum ImGuiItemFlags_ -typedef int ImGuiSeparatorFlags; // flags: for Separator() - internal // enum ImGuiSeparatorFlags_ -typedef int ImGuiSliderFlags; // flags: for SliderBehavior() // enum ImGuiSliderFlags_ - -//------------------------------------------------------------------------- -// STB libraries -//------------------------------------------------------------------------- - -namespace ImGuiStb -{ - -#undef STB_TEXTEDIT_STRING -#undef STB_TEXTEDIT_CHARTYPE -#define STB_TEXTEDIT_STRING ImGuiTextEditState -#define STB_TEXTEDIT_CHARTYPE ImWchar -#define STB_TEXTEDIT_GETWIDTH_NEWLINE -1.0f -#include "stb_textedit.h" - -} // namespace ImGuiStb - -//----------------------------------------------------------------------------- -// Context -//----------------------------------------------------------------------------- - -#ifndef GImGui -extern IMGUI_API ImGuiContext* GImGui; // Current implicit ImGui context pointer -#endif - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -#define IM_PI 3.14159265358979323846f -#define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM)) - -// Helpers: UTF-8 <> wchar -IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count -IMGUI_API int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); // return input UTF-8 bytes count -IMGUI_API int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL); // return input UTF-8 bytes count -IMGUI_API int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end); // return number of UTF-8 code-points (NOT bytes count) -IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string as UTF-8 code-points - -// Helpers: Misc -IMGUI_API ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0); // Pass data_size==0 for zero-terminated strings -IMGUI_API void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size = NULL, int padding_bytes = 0); -IMGUI_API FILE* ImFileOpen(const char* filename, const char* file_open_mode); -static inline bool ImCharIsSpace(int c) { return c == ' ' || c == '\t' || c == 0x3000; } -static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; } -static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; } - -// Helpers: Geometry -IMGUI_API ImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p); -IMGUI_API bool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p); -IMGUI_API ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p); -IMGUI_API void ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w); - -// Helpers: String -IMGUI_API int ImStricmp(const char* str1, const char* str2); -IMGUI_API int ImStrnicmp(const char* str1, const char* str2, int count); -IMGUI_API void ImStrncpy(char* dst, const char* src, int count); -IMGUI_API char* ImStrdup(const char* str); -IMGUI_API char* ImStrchrRange(const char* str_begin, const char* str_end, char c); -IMGUI_API int ImStrlenW(const ImWchar* str); -IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line -IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end); -IMGUI_API int ImFormatString(char* buf, int buf_size, const char* fmt, ...) IM_FMTARGS(3); -IMGUI_API int ImFormatStringV(char* buf, int buf_size, const char* fmt, va_list args) IM_FMTLIST(3); - -// Helpers: Math -// We are keeping those not leaking to the user by default, in the case the user has implicit cast operators between ImVec2 and its own types (when IM_VEC2_CLASS_EXTRA is defined) -#ifdef IMGUI_DEFINE_MATH_OPERATORS -static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x*rhs, lhs.y*rhs); } -static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x/rhs, lhs.y/rhs); } -static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); } -static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x-rhs.x, lhs.y-rhs.y); } -static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x*rhs.x, lhs.y*rhs.y); } -static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x/rhs.x, lhs.y/rhs.y); } -static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } -static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } -static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } -static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } -static inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x+rhs.x, lhs.y+rhs.y, lhs.z+rhs.z, lhs.w+rhs.w); } -static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x-rhs.x, lhs.y-rhs.y, lhs.z-rhs.z, lhs.w-rhs.w); } -static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z, lhs.w*rhs.w); } -#endif - -static inline int ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; } -static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; } -static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; } -static inline float ImMax(float lhs, float rhs) { return lhs >= rhs ? lhs : rhs; } -static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(ImMin(lhs.x,rhs.x), ImMin(lhs.y,rhs.y)); } -static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(ImMax(lhs.x,rhs.x), ImMax(lhs.y,rhs.y)); } -static inline int ImClamp(int v, int mn, int mx) { return (v < mn) ? mn : (v > mx) ? mx : v; } -static inline float ImClamp(float v, float mn, float mx) { return (v < mn) ? mn : (v > mx) ? mx : v; } -static inline ImVec2 ImClamp(const ImVec2& f, const ImVec2& mn, ImVec2 mx) { return ImVec2(ImClamp(f.x,mn.x,mx.x), ImClamp(f.y,mn.y,mx.y)); } -static inline float ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; } -static inline void ImSwap(int& a, int& b) { int tmp = a; a = b; b = tmp; } -static inline void ImSwap(float& a, float& b) { float tmp = a; a = b; b = tmp; } -static inline int ImLerp(int a, int b, float t) { return (int)(a + (b - a) * t); } -static inline float ImLerp(float a, float b, float t) { return a + (b - a) * t; } -static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); } -static inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); } -static inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); } -static inline float ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; } -static inline float ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; } -static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; } -static inline float ImFloor(float f) { return (float)(int)f; } -static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)v.x, (float)(int)v.y); } -static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; } -static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); } -static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; } -static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } - -// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax. -// Defining a custom placement new() with a dummy parameter allows us to bypass including which on some platforms complains when user has disabled exceptions. -struct ImPlacementNewDummy {}; -inline void* operator new(size_t, ImPlacementNewDummy, void* ptr) { return ptr; } -inline void operator delete(void*, ImPlacementNewDummy, void*) {} -#define IM_PLACEMENT_NEW(_PTR) new(ImPlacementNewDummy(), _PTR) - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -enum ImGuiButtonFlags_ -{ - ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat - ImGuiButtonFlags_PressedOnClickRelease = 1 << 1, // return true on click + release on same item [DEFAULT if no PressedOn* flag is set] - ImGuiButtonFlags_PressedOnClick = 1 << 2, // return true on click (default requires click+release) - ImGuiButtonFlags_PressedOnRelease = 1 << 3, // return true on release (default requires click+release) - ImGuiButtonFlags_PressedOnDoubleClick = 1 << 4, // return true on double-click (default requires click+release) - ImGuiButtonFlags_FlattenChilds = 1 << 5, // allow interactions even if a child window is overlapping - ImGuiButtonFlags_DontClosePopups = 1 << 6, // disable automatically closing parent popup on press // [UNUSED] - ImGuiButtonFlags_Disabled = 1 << 7, // disable interactions - ImGuiButtonFlags_AlignTextBaseLine = 1 << 8, // vertically align button to match text baseline (ButtonEx() only) - ImGuiButtonFlags_NoKeyModifiers = 1 << 9, // disable interaction if a key modifier is held - ImGuiButtonFlags_AllowOverlapMode = 1 << 10, // require previous frame HoveredId to either match id or be null before being usable - ImGuiButtonFlags_NoHoldingActiveID = 1 << 11 // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only) -}; - -enum ImGuiSliderFlags_ -{ - ImGuiSliderFlags_Vertical = 1 << 0 -}; - -enum ImGuiColumnsFlags_ -{ - // Default: 0 - ImGuiColumnsFlags_NoBorder = 1 << 0, // Disable column dividers - ImGuiColumnsFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers - ImGuiColumnsFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns - ImGuiColumnsFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window - ImGuiColumnsFlags_GrowParentContentsSize= 1 << 4, // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove. -}; - -enum ImGuiSelectableFlagsPrivate_ -{ - // NB: need to be in sync with last value of ImGuiSelectableFlags_ - ImGuiSelectableFlags_Menu = 1 << 3, - ImGuiSelectableFlags_MenuItem = 1 << 4, - ImGuiSelectableFlags_Disabled = 1 << 5, - ImGuiSelectableFlags_DrawFillAvailWidth = 1 << 6 -}; - -enum ImGuiSeparatorFlags_ -{ - ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar - ImGuiSeparatorFlags_Vertical = 1 << 1 -}; - -// FIXME: this is in development, not exposed/functional as a generic feature yet. -enum ImGuiLayoutType_ -{ - ImGuiLayoutType_Vertical, - ImGuiLayoutType_Horizontal -}; - -enum ImGuiAxis -{ - ImGuiAxis_None = -1, - ImGuiAxis_X = 0, - ImGuiAxis_Y = 1, -}; - -enum ImGuiPlotType -{ - ImGuiPlotType_Lines, - ImGuiPlotType_Histogram -}; - -enum ImGuiDataType -{ - ImGuiDataType_Int, - ImGuiDataType_Float, - ImGuiDataType_Float2 -}; - -enum ImGuiDir -{ - ImGuiDir_None = -1, - ImGuiDir_Left = 0, - ImGuiDir_Right = 1, - ImGuiDir_Up = 2, - ImGuiDir_Down = 3 -}; - -// 2D axis aligned bounding-box -// NB: we can't rely on ImVec2 math operators being available here -struct IMGUI_API ImRect -{ - ImVec2 Min; // Upper-left - ImVec2 Max; // Lower-right - - ImRect() : Min(FLT_MAX,FLT_MAX), Max(-FLT_MAX,-FLT_MAX) {} - ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {} - ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {} - ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {} - - ImVec2 GetCenter() const { return ImVec2((Min.x+Max.x)*0.5f, (Min.y+Max.y)*0.5f); } - ImVec2 GetSize() const { return ImVec2(Max.x-Min.x, Max.y-Min.y); } - float GetWidth() const { return Max.x-Min.x; } - float GetHeight() const { return Max.y-Min.y; } - ImVec2 GetTL() const { return Min; } // Top-left - ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right - ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left - ImVec2 GetBR() const { return Max; } // Bottom-right - bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; } - bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x < Max.x && r.Max.y < Max.y; } - bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; } - void Add(const ImVec2& rhs) { if (Min.x > rhs.x) Min.x = rhs.x; if (Min.y > rhs.y) Min.y = rhs.y; if (Max.x < rhs.x) Max.x = rhs.x; if (Max.y < rhs.y) Max.y = rhs.y; } - void Add(const ImRect& rhs) { if (Min.x > rhs.Min.x) Min.x = rhs.Min.x; if (Min.y > rhs.Min.y) Min.y = rhs.Min.y; if (Max.x < rhs.Max.x) Max.x = rhs.Max.x; if (Max.y < rhs.Max.y) Max.y = rhs.Max.y; } - void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; } - void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; } - void Translate(const ImVec2& v) { Min.x += v.x; Min.y += v.y; Max.x += v.x; Max.y += v.y; } - void ClipWith(const ImRect& clip) { if (Min.x < clip.Min.x) Min.x = clip.Min.x; if (Min.y < clip.Min.y) Min.y = clip.Min.y; if (Max.x > clip.Max.x) Max.x = clip.Max.x; if (Max.y > clip.Max.y) Max.y = clip.Max.y; } - void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; } - ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const - { - if (!on_edge && Contains(p)) - return p; - if (p.x > Max.x) p.x = Max.x; - else if (p.x < Min.x) p.x = Min.x; - if (p.y > Max.y) p.y = Max.y; - else if (p.y < Min.y) p.y = Min.y; - return p; - } -}; - -// Stacked color modifier, backup of modified data so we can restore it -struct ImGuiColMod -{ - ImGuiCol Col; - ImVec4 BackupValue; -}; - -// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable. -struct ImGuiStyleMod -{ - ImGuiStyleVar VarIdx; - union { int BackupInt[2]; float BackupFloat[2]; }; - ImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; } - ImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; } - ImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; } -}; - -// Stacked data for BeginGroup()/EndGroup() -struct ImGuiGroupData -{ - ImVec2 BackupCursorPos; - ImVec2 BackupCursorMaxPos; - float BackupIndentX; - float BackupGroupOffsetX; - float BackupCurrentLineHeight; - float BackupCurrentLineTextBaseOffset; - float BackupLogLinePosY; - bool BackupActiveIdIsAlive; - bool AdvanceCursor; -}; - -// Per column data for Columns() -struct ImGuiColumnData -{ - float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right) - ImRect ClipRect; - //float IndentX; -}; - -// Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper. -struct IMGUI_API ImGuiSimpleColumns -{ - int Count; - float Spacing; - float Width, NextWidth; - float Pos[8], NextWidths[8]; - - ImGuiSimpleColumns(); - void Update(int count, float spacing, bool clear); - float DeclColumns(float w0, float w1, float w2); - float CalcExtraSpace(float avail_w); -}; - -// Internal state of the currently focused/edited text input box -struct IMGUI_API ImGuiTextEditState -{ - ImGuiID Id; // widget id owning the text state - ImVector Text; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer. - ImVector InitialText; // backup of end-user buffer at the time of focus (in UTF-8, unaltered) - ImVector TempTextBuffer; - int CurLenA, CurLenW; // we need to maintain our buffer length in both UTF-8 and wchar format. - int BufSizeA; // end-user buffer size - float ScrollX; - ImGuiStb::STB_TexteditState StbState; - float CursorAnim; - bool CursorFollow; - bool SelectedAllMouseLock; - - ImGuiTextEditState() { memset(this, 0, sizeof(*this)); } - void CursorAnimReset() { CursorAnim = -0.30f; } // After a user-input the cursor stays on for a while without blinking - void CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); } - bool HasSelection() const { return StbState.select_start != StbState.select_end; } - void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; } - void SelectAll() { StbState.select_start = 0; StbState.select_end = CurLenW; StbState.cursor = StbState.select_end; StbState.has_preferred_x = false; } - void OnKeyPressed(int key); -}; - -// Data saved in imgui.ini file -struct ImGuiWindowSettings -{ - char* Name; - ImGuiID Id; - ImVec2 Pos; - ImVec2 Size; - bool Collapsed; - - ImGuiWindowSettings() { Name = NULL; Id = 0; Pos = Size = ImVec2(0,0); Collapsed = false; } -}; - -struct ImGuiSettingsHandler -{ - const char* TypeName; // Short description stored in .ini file. Disallowed characters: '[' ']' - ImGuiID TypeHash; // == ImHash(TypeName, 0, 0) - void* (*ReadOpenFn)(ImGuiContext& ctx, const char* name); - void (*ReadLineFn)(ImGuiContext& ctx, void* entry, const char* line); - void (*WriteAllFn)(ImGuiContext& ctx, ImGuiTextBuffer* out_buf); -}; - -// Mouse cursor data (used when io.MouseDrawCursor is set) -struct ImGuiMouseCursorData -{ - ImGuiMouseCursor Type; - ImVec2 HotOffset; - ImVec2 Size; - ImVec2 TexUvMin[2]; - ImVec2 TexUvMax[2]; -}; - -// Storage for current popup stack -struct ImGuiPopupRef -{ - ImGuiID PopupId; // Set on OpenPopup() - ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup() - ImGuiWindow* ParentWindow; // Set on OpenPopup() - ImGuiID ParentMenuSet; // Set on OpenPopup() - ImVec2 MousePosOnOpen; // Copy of mouse position at the time of opening popup - - ImGuiPopupRef(ImGuiID id, ImGuiWindow* parent_window, ImGuiID parent_menu_set, const ImVec2& mouse_pos) { PopupId = id; Window = NULL; ParentWindow = parent_window; ParentMenuSet = parent_menu_set; MousePosOnOpen = mouse_pos; } -}; - -// Main state for ImGui -struct ImGuiContext -{ - bool Initialized; - ImGuiIO IO; - ImGuiStyle Style; - ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back() - float FontSize; // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window. - float FontBaseSize; // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height. - ImVec2 FontTexUvWhitePixel; // (Shortcut) == Font->TexUvWhitePixel - - float Time; - int FrameCount; - int FrameCountEnded; - int FrameCountRendered; - ImVector Windows; - ImVector WindowsSortBuffer; - ImVector CurrentWindowStack; - ImGuiStorage WindowsById; - ImGuiWindow* CurrentWindow; // Being drawn into - ImGuiWindow* NavWindow; // Nav/focused window for navigation - ImGuiWindow* HoveredWindow; // Will catch mouse inputs - ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only) - ImGuiID HoveredId; // Hovered widget - bool HoveredIdAllowOverlap; - ImGuiID HoveredIdPreviousFrame; - float HoveredIdTimer; - ImGuiID ActiveId; // Active widget - ImGuiID ActiveIdPreviousFrame; - float ActiveIdTimer; - bool ActiveIdIsAlive; // Active widget has been seen this frame - bool ActiveIdIsJustActivated; // Set at the time of activation for one frame - bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always) - ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior) - ImGuiWindow* ActiveIdWindow; - ImGuiWindow* MovingWindow; // Track the child window we clicked on to move a window. - ImGuiID MovingWindowMoveId; // == MovingWindow->MoveId - ImVector ColorModifiers; // Stack for PushStyleColor()/PopStyleColor() - ImVector StyleModifiers; // Stack for PushStyleVar()/PopStyleVar() - ImVector FontStack; // Stack for PushFont()/PopFont() - ImVector OpenPopupStack; // Which popups are open (persistent) - ImVector CurrentPopupStack; // Which level of BeginPopup() we are in (reset every frame) - - // Storage for SetNexWindow** and SetNextTreeNode*** functions - ImVec2 SetNextWindowPosVal; - ImVec2 SetNextWindowPosPivot; - ImVec2 SetNextWindowSizeVal; - ImVec2 SetNextWindowContentSizeVal; - bool SetNextWindowCollapsedVal; - ImGuiCond SetNextWindowPosCond; - ImGuiCond SetNextWindowSizeCond; - ImGuiCond SetNextWindowContentSizeCond; - ImGuiCond SetNextWindowCollapsedCond; - ImRect SetNextWindowSizeConstraintRect; // Valid if 'SetNextWindowSizeConstraint' is true - ImGuiSizeConstraintCallback SetNextWindowSizeConstraintCallback; - void* SetNextWindowSizeConstraintCallbackUserData; - bool SetNextWindowSizeConstraint; - bool SetNextWindowFocus; - bool SetNextTreeNodeOpenVal; - ImGuiCond SetNextTreeNodeOpenCond; - - // Render - ImDrawData RenderDrawData; // Main ImDrawData instance to pass render information to the user - ImVector RenderDrawLists[3]; - float ModalWindowDarkeningRatio; - ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays - ImGuiMouseCursor MouseCursor; - ImGuiMouseCursorData MouseCursorData[ImGuiMouseCursor_Count_]; - - // Widget state - ImGuiTextEditState InputTextState; - ImFont InputTextPasswordFont; - ImGuiID ScalarAsInputTextId; // Temporary text input when CTRL+clicking on a slider, etc. - ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets - ImVec4 ColorPickerRef; - float DragCurrentValue; // Currently dragged value, always float, not rounded by end-user precision settings - ImVec2 DragLastMouseDelta; - float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio - float DragSpeedScaleSlow; - float DragSpeedScaleFast; - ImVec2 ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage? - int TooltipOverrideCount; - ImVector PrivateClipboard; // If no custom clipboard handler is defined - ImVec2 OsImePosRequest, OsImePosSet; // Cursor position request & last passed to the OS Input Method Editor - - // Settings - float SettingsDirtyTimer; // Save .ini Settings on disk when time reaches zero - ImVector SettingsWindows; // .ini settings for ImGuiWindow - ImVector SettingsHandlers; // List of .ini settings handlers - - // Logging - bool LogEnabled; - FILE* LogFile; // If != NULL log to stdout/ file - ImGuiTextBuffer* LogClipboard; // Else log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators. - int LogStartDepth; - int LogAutoExpandMaxDepth; - - // Misc - float FramerateSecPerFrame[120]; // calculate estimate of framerate for user - int FramerateSecPerFrameIdx; - float FramerateSecPerFrameAccum; - int WantCaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags - int WantCaptureKeyboardNextFrame; - int WantTextInputNextFrame; - char TempBuffer[1024*3+1]; // temporary text buffer - - ImGuiContext() - { - Initialized = false; - Font = NULL; - FontSize = FontBaseSize = 0.0f; - FontTexUvWhitePixel = ImVec2(0.0f, 0.0f); - - Time = 0.0f; - FrameCount = 0; - FrameCountEnded = FrameCountRendered = -1; - CurrentWindow = NULL; - NavWindow = NULL; - HoveredWindow = NULL; - HoveredRootWindow = NULL; - HoveredId = 0; - HoveredIdAllowOverlap = false; - HoveredIdPreviousFrame = 0; - HoveredIdTimer = 0.0f; - ActiveId = 0; - ActiveIdPreviousFrame = 0; - ActiveIdTimer = 0.0f; - ActiveIdIsAlive = false; - ActiveIdIsJustActivated = false; - ActiveIdAllowOverlap = false; - ActiveIdClickOffset = ImVec2(-1,-1); - ActiveIdWindow = NULL; - MovingWindow = NULL; - MovingWindowMoveId = 0; - - SetNextWindowPosVal = ImVec2(0.0f, 0.0f); - SetNextWindowSizeVal = ImVec2(0.0f, 0.0f); - SetNextWindowCollapsedVal = false; - SetNextWindowPosCond = 0; - SetNextWindowSizeCond = 0; - SetNextWindowContentSizeCond = 0; - SetNextWindowCollapsedCond = 0; - SetNextWindowSizeConstraintRect = ImRect(); - SetNextWindowSizeConstraintCallback = NULL; - SetNextWindowSizeConstraintCallbackUserData = NULL; - SetNextWindowSizeConstraint = false; - SetNextWindowFocus = false; - SetNextTreeNodeOpenVal = false; - SetNextTreeNodeOpenCond = 0; - - ScalarAsInputTextId = 0; - ColorEditOptions = ImGuiColorEditFlags__OptionsDefault; - DragCurrentValue = 0.0f; - DragLastMouseDelta = ImVec2(0.0f, 0.0f); - DragSpeedDefaultRatio = 1.0f / 100.0f; - DragSpeedScaleSlow = 1.0f / 100.0f; - DragSpeedScaleFast = 10.0f; - ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f); - TooltipOverrideCount = 0; - OsImePosRequest = OsImePosSet = ImVec2(-1.0f, -1.0f); - - ModalWindowDarkeningRatio = 0.0f; - OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging - MouseCursor = ImGuiMouseCursor_Arrow; - memset(MouseCursorData, 0, sizeof(MouseCursorData)); - - SettingsDirtyTimer = 0.0f; - - LogEnabled = false; - LogFile = NULL; - LogClipboard = NULL; - LogStartDepth = 0; - LogAutoExpandMaxDepth = 2; - - memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame)); - FramerateSecPerFrameIdx = 0; - FramerateSecPerFrameAccum = 0.0f; - WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1; - memset(TempBuffer, 0, sizeof(TempBuffer)); - } -}; - -// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin(). -enum ImGuiItemFlags_ -{ - ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true - ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings. - ImGuiItemFlags_Disabled = 1 << 2, // false // FIXME-WIP: Disable interactions but doesn't affect visuals. Should be: grey out and disable interactions with widgets that affect data + view widgets (WIP) - //ImGuiItemFlags_NoNav = 1 << 3, // false - //ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false - ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window - ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus -}; - -// Transient per-window data, reset at the beginning of the frame -// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiDrawContext is quite tenuous and could be reconsidered. -struct IMGUI_API ImGuiDrawContext -{ - ImVec2 CursorPos; - ImVec2 CursorPosPrevLine; - ImVec2 CursorStartPos; - ImVec2 CursorMaxPos; // Implicitly calculate the size of our contents, always extending. Saved into window->SizeContents at the end of the frame - float CurrentLineHeight; - float CurrentLineTextBaseOffset; - float PrevLineHeight; - float PrevLineTextBaseOffset; - float LogLinePosY; - int TreeDepth; - ImGuiID LastItemId; - ImRect LastItemRect; - bool LastItemRectHoveredRect; - bool MenuBarAppending; - float MenuBarOffsetX; - ImVector ChildWindows; - ImGuiStorage* StateStorage; - ImGuiLayoutType LayoutType; - - // We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings. - ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default] - float ItemWidth; // == ItemWidthStack.back(). 0.0: default, >0.0: width in pixels, <0.0: align xx pixels to the right of window - float TextWrapPos; // == TextWrapPosStack.back() [empty == -1.0f] - ImVectorItemFlagsStack; - ImVector ItemWidthStack; - ImVector TextWrapPosStack; - ImVectorGroupStack; - int StackSizesBackup[6]; // Store size of various stacks for asserting - - float IndentX; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.) - float GroupOffsetX; - float ColumnsOffsetX; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API. - int ColumnsCurrent; - int ColumnsCount; - float ColumnsMinX; - float ColumnsMaxX; - float ColumnsStartPosY; - float ColumnsStartMaxPosX; // Backup of CursorMaxPos - float ColumnsCellMinY; - float ColumnsCellMaxY; - ImGuiColumnsFlags ColumnsFlags; - ImGuiID ColumnsSetId; - ImVector ColumnsData; - - ImGuiDrawContext() - { - CursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f); - CurrentLineHeight = PrevLineHeight = 0.0f; - CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f; - LogLinePosY = -1.0f; - TreeDepth = 0; - LastItemId = 0; - LastItemRect = ImRect(); - LastItemRectHoveredRect = false; - MenuBarAppending = false; - MenuBarOffsetX = 0.0f; - StateStorage = NULL; - LayoutType = ImGuiLayoutType_Vertical; - ItemWidth = 0.0f; - ItemFlags = ImGuiItemFlags_Default_; - TextWrapPos = -1.0f; - memset(StackSizesBackup, 0, sizeof(StackSizesBackup)); - - IndentX = 0.0f; - GroupOffsetX = 0.0f; - ColumnsOffsetX = 0.0f; - ColumnsCurrent = 0; - ColumnsCount = 1; - ColumnsMinX = ColumnsMaxX = 0.0f; - ColumnsStartPosY = 0.0f; - ColumnsStartMaxPosX = 0.0f; - ColumnsCellMinY = ColumnsCellMaxY = 0.0f; - ColumnsFlags = 0; - ColumnsSetId = 0; - } -}; - -// Windows data -struct IMGUI_API ImGuiWindow -{ - char* Name; - ImGuiID ID; // == ImHash(Name) - ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_ - int OrderWithinParent; // Order within immediate parent window, if we are a child window. Otherwise 0. - ImVec2 PosFloat; - ImVec2 Pos; // Position rounded-up to nearest pixel - ImVec2 Size; // Current size (==SizeFull or collapsed title bar size) - ImVec2 SizeFull; // Size when non collapsed - ImVec2 SizeContents; // Size of contents (== extents reach of the drawing cursor) from previous frame - ImVec2 SizeContentsExplicit; // Size of contents explicitly set by the user via SetNextWindowContentSize() - ImRect ContentsRegionRect; // Maximum visible content position in window coordinates. ~~ (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis - ImVec2 WindowPadding; // Window padding at the time of begin. - float WindowRounding; // Window rounding at the time of begin. - float WindowBorderSize; // Window border size at the time of begin. - ImGuiID MoveId; // == window->GetID("#MOVE") - ImVec2 Scroll; - ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change) - ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered - bool ScrollbarX, ScrollbarY; - ImVec2 ScrollbarSizes; - bool Active; // Set to true on Begin() - bool WasActive; - bool WriteAccessed; // Set to true when any widget access the current window - bool Collapsed; // Set when collapsing window to become only title-bar - bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed) - bool Appearing; // Set during the frame where the window is appearing (or re-appearing) - bool CloseButton; // Set when the window has a close button (p_open != NULL) - int BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs) - ImGuiID PopupId; // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling) - int AutoFitFramesX, AutoFitFramesY; - bool AutoFitOnlyGrows; - int AutoFitChildAxises; - int AutoPosLastDirection; - int HiddenFrames; - ImGuiCond SetWindowPosAllowFlags; // store condition flags for next SetWindowPos() call. - ImGuiCond SetWindowSizeAllowFlags; // store condition flags for next SetWindowSize() call. - ImGuiCond SetWindowCollapsedAllowFlags; // store condition flags for next SetWindowCollapsed() call. - ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size) - ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right. - - ImGuiDrawContext DC; // Temporary per-window data, reset at the beginning of the frame - ImVector IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack - ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2. - ImRect WindowRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window. - ImRect InnerRect; - int LastFrameActive; - float ItemWidthDefault; - ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items - ImGuiStorage StateStorage; - float FontWindowScale; // Scale multiplier per-window - ImDrawList* DrawList; - ImGuiWindow* ParentWindow; // Immediate parent in the window stack *regardless* of whether this window is a child window or not) - ImGuiWindow* RootWindow; // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window. - ImGuiWindow* RootNonPopupWindow; // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing - - // Navigation / Focus - int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister() - int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through) - int FocusIdxAllRequestCurrent; // Item being requested for focus - int FocusIdxTabRequestCurrent; // Tab-able item being requested for focus - int FocusIdxAllRequestNext; // Item being requested for focus, for next update (relies on layout to be stable between the frame pressing TAB and the next frame) - int FocusIdxTabRequestNext; // " - -public: - ImGuiWindow(const char* name); - ~ImGuiWindow(); - - ImGuiID GetID(const char* str, const char* str_end = NULL); - ImGuiID GetID(const void* ptr); - ImGuiID GetIDNoKeepAlive(const char* str, const char* str_end = NULL); - - // We don't use g.FontSize because the window may be != g.CurrentWidow. - ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x+Size.x, Pos.y+Size.y); } - float CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; } - float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; } - ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); } - float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; } - ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); } -}; - -// Backup and restore just enough data to be able to use IsItemHovered() on item A after another B in the same window has overwritten the data. -struct ImGuiItemHoveredDataBackup -{ - ImGuiID LastItemId; - ImRect LastItemRect; - bool LastItemRectHoveredRect; - - void Backup() { ImGuiWindow* window = GImGui->CurrentWindow; LastItemId = window->DC.LastItemId; LastItemRect = window->DC.LastItemRect; LastItemRectHoveredRect = window->DC.LastItemRectHoveredRect; } - void Restore() { ImGuiWindow* window = GImGui->CurrentWindow; window->DC.LastItemId = LastItemId; window->DC.LastItemRect = LastItemRect; window->DC.LastItemRectHoveredRect = LastItemRectHoveredRect; } -}; - -//----------------------------------------------------------------------------- -// Internal API -// No guarantee of forward compatibility here. -//----------------------------------------------------------------------------- - -namespace ImGui -{ - // We should always have a CurrentWindow in the stack (there is an implicit "Debug" window) - // If this ever crash because g.CurrentWindow is NULL it means that either - // - ImGui::NewFrame() has never been called, which is illegal. - // - You are calling ImGui functions after ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal. - inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; } - inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; } - IMGUI_API ImGuiWindow* GetParentWindow(); - IMGUI_API ImGuiWindow* FindWindowByName(const char* name); - IMGUI_API void FocusWindow(ImGuiWindow* window); - IMGUI_API void BringWindowToFront(ImGuiWindow* window); - IMGUI_API void BringWindowToBack(ImGuiWindow* window); - - IMGUI_API void Initialize(); - - IMGUI_API void MarkIniSettingsDirty(); - IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(ImGuiID type_id); - IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id); - - IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window); - IMGUI_API void ClearActiveID(); - IMGUI_API void SetHoveredID(ImGuiID id); - IMGUI_API void KeepAliveID(ImGuiID id); - - IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f); - IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f); - IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id); - IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id); - IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged); - IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested - IMGUI_API void FocusableItemUnregister(ImGuiWindow* window); - IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_x, float default_y); - IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x); - IMGUI_API void PushMultiItemsWidths(int components, float width_full = 0.0f); - IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled); - IMGUI_API void PopItemFlag(); - - IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing); - IMGUI_API void ClosePopup(ImGuiID id); - IMGUI_API bool IsPopupOpen(ImGuiID id); - IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); - IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true); - - IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate); - - IMGUI_API void Scrollbar(ImGuiLayoutType direction); - IMGUI_API void VerticalSeparator(); // Vertical separator, for menu bars (use current line height). not exposed because it is misleading what it doesn't have an effect on regular layout. - IMGUI_API bool SplitterBehavior(ImGuiID id, const ImRect& bb, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f); - - // FIXME-WIP: New Columns API - IMGUI_API void BeginColumns(const char* id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns(). - IMGUI_API void EndColumns(); // close columns - IMGUI_API void PushColumnClipRect(int column_index = -1); - - // FIXME-WIP: New Combo API - IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImVec2 popup_size = ImVec2(0.0f,0.0f)); - IMGUI_API void EndCombo(); - - // NB: All position are in absolute pixels coordinates (never using window coordinates internally) - // AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. THOSE FUNCTIONS ARE A MESS. THEIR SIGNATURE AND BEHAVIOR WILL CHANGE, THEY NEED TO BE REFACTORED INTO SOMETHING DECENT. - IMGUI_API void RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true); - IMGUI_API void RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width); - IMGUI_API void RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0,0), const ImRect* clip_rect = NULL); - IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f); - IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f); - IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0); - IMGUI_API void RenderTriangle(ImVec2 pos, ImGuiDir dir, float scale = 1.0f); - IMGUI_API void RenderBullet(ImVec2 pos); - IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz); - IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding); - IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text. - - IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0); - IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0); - IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius); - IMGUI_API bool ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags = 0); - - IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0); - IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power); - IMGUI_API bool SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format); - - IMGUI_API bool DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power); - IMGUI_API bool DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power); - IMGUI_API bool DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format); - - IMGUI_API bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback = NULL, void* user_data = NULL); - IMGUI_API bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags); - IMGUI_API bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags); - IMGUI_API bool InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags); - IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision); - - IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags); - IMGUI_API void ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags); - - IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL); - IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextTreeNodeOpened() data, if any. May return true when logging - IMGUI_API void TreePushRawID(ImGuiID id); - - IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size); - - IMGUI_API int ParseFormatPrecision(const char* fmt, int default_value); - IMGUI_API float RoundScalar(float value, int decimal_precision); - - // Shade functions - IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDrawVert* vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); - IMGUI_API void ShadeVertsLinearAlphaGradientForLeftToRightText(ImDrawVert* vert_start, ImDrawVert* vert_end, float gradient_p0_x, float gradient_p1_x); - IMGUI_API void ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp); - -} // namespace ImGui - -// ImFontAtlas internals -IMGUI_API bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas); -IMGUI_API void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas); -IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); -IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* spc); -IMGUI_API void ImFontAtlasBuildFinish(ImFontAtlas* atlas); -IMGUI_API void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor); -IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#ifdef _MSC_VER -#pragma warning (pop) -#endif diff --git a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_node_graph_test.cpp b/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_node_graph_test.cpp deleted file mode 100644 index 2dac9e12b00..00000000000 --- a/3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_node_graph_test.cpp +++ /dev/null @@ -1,232 +0,0 @@ -// Creating a node graph editor for ImGui -// Quick demo, not production code! -// See https://github.com/ocornut/imgui/issues/306 -// v0.01 -// Animated gif: https://cloud.githubusercontent.com/assets/8225057/9472357/c0263c04-4b4c-11e5-9fdf-2cd4f33f6582.gif - -#include -#include "imgui.h" - -// NB: You can use math functions/operators on ImVec2 if you #define IMGUI_DEFINE_MATH_OPERATORS and #include "imgui_internal.h" -// Here we only declare simple +/- operators so others don't leak into the demo code. -static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); } -static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x-rhs.x, lhs.y-rhs.y); } - -struct Node -{ - int ID; - char Name[32]; - ImVec2 Pos, Size; - float Value; - int InputsCount, OutputsCount; - - Node(int id, const char* name, const ImVec2& pos, float value, int inputs_count, int outputs_count) { ID = id; strncpy(Name, name, 31); Name[31] = 0; Pos = pos; Value = value; InputsCount = inputs_count; OutputsCount = outputs_count; } - - ImVec2 GetInputSlotPos(int slot_no) const { return ImVec2(Pos.x, Pos.y + Size.y * ((float)slot_no+1) / ((float)InputsCount+1)); } - ImVec2 GetOutputSlotPos(int slot_no) const { return ImVec2(Pos.x + Size.x, Pos.y + Size.y * ((float)slot_no+1) / ((float)OutputsCount+1)); } -}; - -struct NodeLink -{ - int InputIdx, InputSlot, OutputIdx, OutputSlot; - - NodeLink(int input_idx, int input_slot, int output_idx, int output_slot) { InputIdx = input_idx; InputSlot = input_slot; OutputIdx = output_idx; OutputSlot = output_slot; } -}; - -// Really dumb data structure provided for the example. -// Note that we storing links are INDICES (not ID) to make example code shorter, obviously a bad idea for any general purpose code. -void ShowExampleAppCustomNodeGraph(bool* opened) -{ - ImGui::SetNextWindowSize(ImVec2(700,600), ImGuiSetCond_FirstUseEver); - if (!ImGui::Begin("Example: Custom Node Graph", opened)) - { - ImGui::End(); - return; - } - - static ImVector nodes; - static ImVector links; - static bool inited = false; - static ImVec2 scrolling = ImVec2(0.0f, 0.0f); - static int node_selected = -1; - if (!inited) - { - nodes.push_back(Node(0, "MainTex", ImVec2(40,50), 0.5f, 1, 1)); - nodes.push_back(Node(1, "BumpMap", ImVec2(40,150), 0.42f, 1, 1)); - nodes.push_back(Node(2, "Combine", ImVec2(270,80), 1.0f, 2, 2)); - links.push_back(NodeLink(0, 0, 2, 0)); - links.push_back(NodeLink(1, 0, 2, 1)); - inited = true; - } - - // Draw a list of nodes on the left side - bool open_context_menu = false; - int node_hovered_in_list = -1; - int node_hovered_in_scene = -1; - ImGui::BeginChild("node_list", ImVec2(100,0)); - ImGui::Text("Nodes"); - ImGui::Separator(); - for (int node_idx = 0; node_idx < nodes.Size; node_idx++) - { - Node* node = &nodes[node_idx]; - ImGui::PushID(node->ID); - if (ImGui::Selectable(node->Name, node->ID == node_selected)) - node_selected = node->ID; - if (ImGui::IsItemHovered()) - { - node_hovered_in_list = node->ID; - open_context_menu |= ImGui::IsMouseClicked(1); - } - ImGui::PopID(); - } - ImGui::EndChild(); - - ImGui::SameLine(); - ImGui::BeginGroup(); - - const float NODE_SLOT_RADIUS = 4.0f; - const ImVec2 NODE_WINDOW_PADDING(8.0f, 8.0f); - - // Create our child canvas - ImGui::Text("Hold middle mouse button to scroll (%.2f,%.2f)", scrolling.x, scrolling.y); - ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(1,1)); - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0,0)); - ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, (ImVec4)ImColor(40,40,40,200)); - ImGui::BeginChild("scrolling_region", ImVec2(0,0), true, ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoMove); - ImGui::PushItemWidth(120.0f); - - ImDrawList* draw_list = ImGui::GetWindowDrawList(); - draw_list->ChannelsSplit(2); - ImVec2 offset = ImGui::GetCursorScreenPos() - scrolling; - - // Display links - draw_list->ChannelsSetCurrent(0); // Background - for (int link_idx = 0; link_idx < links.Size; link_idx++) - { - NodeLink* link = &links[link_idx]; - Node* node_inp = &nodes[link->InputIdx]; - Node* node_out = &nodes[link->OutputIdx]; - -#if 1 - // Hermite spline - // TODO: move to ImDrawList path API - ImVec2 p1 = offset+node_inp->GetOutputSlotPos(link->InputSlot); - ImVec2 t1 = ImVec2(+80.0f, 0.0f); - ImVec2 p2 = offset+node_out->GetInputSlotPos(link->OutputSlot); - ImVec2 t2 = ImVec2(+80.0f, 0.0f); - const int STEPS = 12; - for (int step = 0; step <= STEPS; step++) - { - float t = (float)step / (float)STEPS; - float h1 = +2*t*t*t - 3*t*t + 1.0f; - float h2 = -2*t*t*t + 3*t*t; - float h3 = t*t*t - 2*t*t + t; - float h4 = t*t*t - t*t; - draw_list->PathLineTo(ImVec2(h1*p1.x + h2*p2.x + h3*t1.x + h4*t2.x, h1*p1.y + h2*p2.y + h3*t1.y + h4*t2.y)); - } - draw_list->PathStroke(ImColor(200,200,100), false, 3.0f); -#else - draw_list->AddLine(offset+node_inp->GetOutputSlotPos(link->InputSlot), offset+node_out->GetInputSlotPos(link->OutputSlot), ImColor(200,200,100), 3.0f); -#endif - } - - // Display nodes - for (int node_idx = 0; node_idx < nodes.Size; node_idx++) - { - Node* node = &nodes[node_idx]; - ImGui::PushID(node->ID); - ImVec2 node_rect_min = offset + node->Pos; - - // Display node contents first - draw_list->ChannelsSetCurrent(1); // Foreground - bool old_any_active = ImGui::IsAnyItemActive(); - ImGui::SetCursorScreenPos(node_rect_min + NODE_WINDOW_PADDING); - ImGui::BeginGroup(); // Lock horizontal position - ImGui::Text("%s", node->Name); - ImGui::SliderFloat("##value", &node->Value, 0.0f, 1.0f, "Alpha %.2f"); - float dummy_color[3] = { node->Pos.x / ImGui::GetWindowWidth(), node->Pos.y / ImGui::GetWindowHeight(), fmodf((float)node->ID * 0.5f, 1.0f) }; - ImGui::ColorEdit3("##color", &dummy_color[0]); - ImGui::EndGroup(); - - // Save the size of what we have emitted and weither any of the widgets are being used - bool node_widgets_active = (!old_any_active && ImGui::IsAnyItemActive()); - node->Size = ImGui::GetItemRectSize() + NODE_WINDOW_PADDING + NODE_WINDOW_PADDING; - ImVec2 node_rect_max = node_rect_min + node->Size; - - // Display node box - draw_list->ChannelsSetCurrent(0); // Background - ImGui::SetCursorScreenPos(node_rect_min); - ImGui::InvisibleButton("node", node->Size); - if (ImGui::IsItemHovered()) - { - node_hovered_in_scene = node->ID; - open_context_menu |= ImGui::IsMouseClicked(1); - } - bool node_moving_active = ImGui::IsItemActive(); - if (node_widgets_active || node_moving_active) - node_selected = node->ID; - if (node_moving_active && ImGui::IsMouseDragging(0)) - node->Pos = node->Pos + ImGui::GetIO().MouseDelta; - - ImU32 node_bg_color = (node_hovered_in_list == node->ID || node_hovered_in_scene == node->ID || (node_hovered_in_list == -1 && node_selected == node->ID)) ? ImColor(75,75,75) : ImColor(60,60,60); - draw_list->AddRectFilled(node_rect_min, node_rect_max, node_bg_color, 4.0f); - draw_list->AddRect(node_rect_min, node_rect_max, ImColor(100,100,100), 4.0f); - for (int slot_idx = 0; slot_idx < node->InputsCount; slot_idx++) - draw_list->AddCircleFilled(offset + node->GetInputSlotPos(slot_idx), NODE_SLOT_RADIUS, ImColor(150,150,150,150)); - for (int slot_idx = 0; slot_idx < node->OutputsCount; slot_idx++) - draw_list->AddCircleFilled(offset + node->GetOutputSlotPos(slot_idx), NODE_SLOT_RADIUS, ImColor(150,150,150,150)); - - ImGui::PopID(); - } - draw_list->ChannelsMerge(); - - // Open context menu - if (!ImGui::IsAnyItemHovered() && ImGui::IsMouseHoveringWindow() && ImGui::IsMouseClicked(1)) - { - node_selected = node_hovered_in_list = node_hovered_in_scene = -1; - open_context_menu = true; - } - if (open_context_menu) - { - ImGui::OpenPopup("context_menu"); - if (node_hovered_in_list != -1) - node_selected = node_hovered_in_list; - if (node_hovered_in_scene != -1) - node_selected = node_hovered_in_scene; - } - - // Draw context menu - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8,8)); - if (ImGui::BeginPopup("context_menu")) - { - Node* node = node_selected != -1 ? &nodes[node_selected] : NULL; - ImVec2 scene_pos = ImGui::GetMousePosOnOpeningCurrentPopup() - offset; - if (node) - { - ImGui::Text("Node '%s'", node->Name); - ImGui::Separator(); - if (ImGui::MenuItem("Rename..", NULL, false, false)) {} - if (ImGui::MenuItem("Delete", NULL, false, false)) {} - if (ImGui::MenuItem("Copy", NULL, false, false)) {} - } - else - { - if (ImGui::MenuItem("Add")) { nodes.push_back(Node(nodes.Size, "New node", scene_pos, 0.5f, 2, 2)); } - if (ImGui::MenuItem("Paste", NULL, false, false)) {} - } - ImGui::EndPopup(); - } - ImGui::PopStyleVar(); - - // Scrolling - if (ImGui::IsWindowHovered() && !ImGui::IsAnyItemActive() && ImGui::IsMouseDragging(2, 0.0f)) - scrolling = scrolling - ImGui::GetIO().MouseDelta; - - ImGui::PopItemWidth(); - ImGui::EndChild(); - ImGui::PopStyleColor(); - ImGui::PopStyleVar(2); - ImGui::EndGroup(); - - ImGui::End(); -} diff --git a/3rdparty/bgfx/3rdparty/openvr/openvr_capi.h b/3rdparty/bgfx/3rdparty/openvr/openvr_capi.h deleted file mode 100644 index 230cd3b4513..00000000000 --- a/3rdparty/bgfx/3rdparty/openvr/openvr_capi.h +++ /dev/null @@ -1,1416 +0,0 @@ -//======= Copyright 1996-2016, Valve Corporation, All rights reserved. ======== -// -// Purpose: Header for flatted SteamAPI. Use this for binding to other languages. -// This file is auto-generated, do not edit it. -// -//============================================================================= - -#ifndef __OPENVR_API_FLAT_H__ -#define __OPENVR_API_FLAT_H__ -#if defined( _WIN32 ) || defined( __clang__ ) -#pragma once -#endif - -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C -#endif - -#if defined( _WIN32 ) -# define OPENVR_FNTABLE_CALLTYPE __stdcall -#else -# define OPENVR_FNTABLE_CALLTYPE -#endif // - -// OPENVR API export macro -#if defined( _WIN32 ) && !defined( _X360 ) - #if defined( OPENVR_API_EXPORTS ) - #define S_API EXTERN_C __declspec( dllexport ) - #elif defined( OPENVR_API_NODLL ) - #define S_API EXTERN_C - #else - #define S_API extern "C" __declspec( dllimport ) - #endif // OPENVR_API_EXPORTS -#elif defined( GNUC ) - #if defined( OPENVR_API_EXPORTS ) - #define S_API EXTERN_C __attribute__ ((visibility("default"))) - #else - #define S_API EXTERN_C - #endif // OPENVR_API_EXPORTS -#else // !WIN32 - #if defined( OPENVR_API_EXPORTS ) - #define S_API EXTERN_C - #else - #define S_API EXTERN_C - #endif // OPENVR_API_EXPORTS -#endif - -#include - -// OpenVR Constants - -static const unsigned int k_unTrackingStringSize = 32; -static const unsigned int k_unMaxDriverDebugResponseSize = 32768; -static const unsigned int k_unTrackedDeviceIndex_Hmd = 0; -static const unsigned int k_unMaxTrackedDeviceCount = 16; -static const unsigned int k_unTrackedDeviceIndexInvalid = 4294967295; -static const unsigned int k_unMaxPropertyStringSize = 32768; -static const unsigned int k_unControllerStateAxisCount = 5; -static const unsigned long k_ulOverlayHandleInvalid = 0; -static const char * IVRSystem_Version = "IVRSystem_012"; -static const char * IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; -static const unsigned int k_unMaxApplicationKeyLength = 128; -static const char * IVRApplications_Version = "IVRApplications_005"; -static const char * IVRChaperone_Version = "IVRChaperone_003"; -static const char * IVRChaperoneSetup_Version = "IVRChaperoneSetup_005"; -static const char * IVRCompositor_Version = "IVRCompositor_013"; -static const unsigned int k_unVROverlayMaxKeyLength = 128; -static const unsigned int k_unVROverlayMaxNameLength = 128; -static const unsigned int k_unMaxOverlayCount = 32; -static const char * IVROverlay_Version = "IVROverlay_011"; -static const char * k_pch_Controller_Component_GDC2015 = "gdc2015"; -static const char * k_pch_Controller_Component_Base = "base"; -static const char * k_pch_Controller_Component_Tip = "tip"; -static const char * k_pch_Controller_Component_HandGrip = "handgrip"; -static const char * k_pch_Controller_Component_Status = "status"; -static const char * IVRRenderModels_Version = "IVRRenderModels_005"; -static const unsigned int k_unNotificationTextMaxSize = 256; -static const char * IVRNotifications_Version = "IVRNotifications_002"; -static const unsigned int k_unMaxSettingsKeyLength = 128; -static const char * k_pch_SteamVR_Section = "steamvr"; -static const char * k_pch_SteamVR_RequireHmd_String = "requireHmd"; -static const char * k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; -static const char * k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; -static const char * k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; -static const char * k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; -static const char * k_pch_SteamVR_EnableDistortion_Bool = "enableDistortion"; -static const char * k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; -static const char * k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; -static const char * k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps"; -static const char * k_pch_SteamVR_LogLevel_Int32 = "loglevel"; -static const char * k_pch_SteamVR_IPD_Float = "ipd"; -static const char * k_pch_SteamVR_Background_String = "background"; -static const char * k_pch_SteamVR_GridColor_String = "gridColor"; -static const char * k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; -static const char * k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; -static const char * k_pch_SteamVR_PowerOffOnExit_Bool = "powerOffOnExit"; -static const char * k_pch_SteamVR_StandbyAppRunningTimeout_Float = "standbyAppRunningTimeout"; -static const char * k_pch_SteamVR_StandbyNoAppTimeout_Float = "standbyNoAppTimeout"; -static const char * k_pch_SteamVR_DirectMode_Bool = "directMode"; -static const char * k_pch_SteamVR_DirectModeEdidVid_Int32 = "directModeEdidVid"; -static const char * k_pch_SteamVR_DirectModeEdidPid_Int32 = "directModeEdidPid"; -static const char * k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; -static const char * k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; -static const char * k_pch_SteamVR_BaseStationPowerManagement_Bool = "basestationPowerManagement"; -static const char * k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; -static const char * k_pch_Lighthouse_Section = "driver_lighthouse"; -static const char * k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; -static const char * k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; -static const char * k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; -static const char * k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; -static const char * k_pch_Lighthouse_LighthouseName_String = "lighthousename"; -static const char * k_pch_Lighthouse_MaxIncidenceAngleDegrees_Float = "maxincidenceangledegrees"; -static const char * k_pch_Lighthouse_UseLighthouseDirect_Bool = "uselighthousedirect"; -static const char * k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; -static const char * k_pch_Lighthouse_OriginOffsetX_Float = "originoffsetx"; -static const char * k_pch_Lighthouse_OriginOffsetY_Float = "originoffsety"; -static const char * k_pch_Lighthouse_OriginOffsetZ_Float = "originoffsetz"; -static const char * k_pch_Lighthouse_HeadingOffset_Float = "headingoffset"; -static const char * k_pch_Null_Section = "driver_null"; -static const char * k_pch_Null_EnableNullDriver_Bool = "enable"; -static const char * k_pch_Null_SerialNumber_String = "serialNumber"; -static const char * k_pch_Null_ModelNumber_String = "modelNumber"; -static const char * k_pch_Null_WindowX_Int32 = "windowX"; -static const char * k_pch_Null_WindowY_Int32 = "windowY"; -static const char * k_pch_Null_WindowWidth_Int32 = "windowWidth"; -static const char * k_pch_Null_WindowHeight_Int32 = "windowHeight"; -static const char * k_pch_Null_RenderWidth_Int32 = "renderWidth"; -static const char * k_pch_Null_RenderHeight_Int32 = "renderHeight"; -static const char * k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; -static const char * k_pch_Null_DisplayFrequency_Float = "displayFrequency"; -static const char * k_pch_UserInterface_Section = "userinterface"; -static const char * k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; -static const char * k_pch_Notifications_Section = "notifications"; -static const char * k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; -static const char * k_pch_Keyboard_Section = "keyboard"; -static const char * k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; -static const char * k_pch_Perf_Section = "perfcheck"; -static const char * k_pch_Perf_HeuristicActive_Bool = "heuristicActive"; -static const char * k_pch_Perf_NotifyInHMD_Bool = "warnInHMD"; -static const char * k_pch_Perf_NotifyOnlyOnce_Bool = "warnOnlyOnce"; -static const char * k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; -static const char * k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; -static const char * k_pch_Perf_TestData_Float = "perfTestData"; -static const char * k_pch_Camera_Section = "camera"; -static const char * IVRSettings_Version = "IVRSettings_001"; -static const char * k_pch_audio_Section = "audio"; -static const char * k_pch_audio_OnPlaybackDevice_String = "onPlaybackDevice"; -static const char * k_pch_audio_OnRecordDevice_String = "onRecordDevice"; -static const char * k_pch_audio_OffPlaybackDevice_String = "offPlaybackDevice"; -static const char * k_pch_audio_OffRecordDevice_String = "offRecordDevice"; -static const char * k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; - -// OpenVR Enums - -typedef enum EVREye -{ - EVREye_Eye_Left = 0, - EVREye_Eye_Right = 1, -} EVREye; - -typedef enum EGraphicsAPIConvention -{ - EGraphicsAPIConvention_API_DirectX = 0, - EGraphicsAPIConvention_API_OpenGL = 1, -} EGraphicsAPIConvention; - -typedef enum EColorSpace -{ - EColorSpace_ColorSpace_Auto = 0, - EColorSpace_ColorSpace_Gamma = 1, - EColorSpace_ColorSpace_Linear = 2, -} EColorSpace; - -typedef enum ETrackingResult -{ - ETrackingResult_TrackingResult_Uninitialized = 1, - ETrackingResult_TrackingResult_Calibrating_InProgress = 100, - ETrackingResult_TrackingResult_Calibrating_OutOfRange = 101, - ETrackingResult_TrackingResult_Running_OK = 200, - ETrackingResult_TrackingResult_Running_OutOfRange = 201, -} ETrackingResult; - -typedef enum ETrackedDeviceClass -{ - ETrackedDeviceClass_TrackedDeviceClass_Invalid = 0, - ETrackedDeviceClass_TrackedDeviceClass_HMD = 1, - ETrackedDeviceClass_TrackedDeviceClass_Controller = 2, - ETrackedDeviceClass_TrackedDeviceClass_TrackingReference = 4, - ETrackedDeviceClass_TrackedDeviceClass_Other = 1000, -} ETrackedDeviceClass; - -typedef enum ETrackedControllerRole -{ - ETrackedControllerRole_TrackedControllerRole_Invalid = 0, - ETrackedControllerRole_TrackedControllerRole_LeftHand = 1, - ETrackedControllerRole_TrackedControllerRole_RightHand = 2, -} ETrackedControllerRole; - -typedef enum ETrackingUniverseOrigin -{ - ETrackingUniverseOrigin_TrackingUniverseSeated = 0, - ETrackingUniverseOrigin_TrackingUniverseStanding = 1, - ETrackingUniverseOrigin_TrackingUniverseRawAndUncalibrated = 2, -} ETrackingUniverseOrigin; - -typedef enum ETrackedDeviceProperty -{ - ETrackedDeviceProperty_Prop_TrackingSystemName_String = 1000, - ETrackedDeviceProperty_Prop_ModelNumber_String = 1001, - ETrackedDeviceProperty_Prop_SerialNumber_String = 1002, - ETrackedDeviceProperty_Prop_RenderModelName_String = 1003, - ETrackedDeviceProperty_Prop_WillDriftInYaw_Bool = 1004, - ETrackedDeviceProperty_Prop_ManufacturerName_String = 1005, - ETrackedDeviceProperty_Prop_TrackingFirmwareVersion_String = 1006, - ETrackedDeviceProperty_Prop_HardwareRevision_String = 1007, - ETrackedDeviceProperty_Prop_AllWirelessDongleDescriptions_String = 1008, - ETrackedDeviceProperty_Prop_ConnectedWirelessDongle_String = 1009, - ETrackedDeviceProperty_Prop_DeviceIsWireless_Bool = 1010, - ETrackedDeviceProperty_Prop_DeviceIsCharging_Bool = 1011, - ETrackedDeviceProperty_Prop_DeviceBatteryPercentage_Float = 1012, - ETrackedDeviceProperty_Prop_StatusDisplayTransform_Matrix34 = 1013, - ETrackedDeviceProperty_Prop_Firmware_UpdateAvailable_Bool = 1014, - ETrackedDeviceProperty_Prop_Firmware_ManualUpdate_Bool = 1015, - ETrackedDeviceProperty_Prop_Firmware_ManualUpdateURL_String = 1016, - ETrackedDeviceProperty_Prop_HardwareRevision_Uint64 = 1017, - ETrackedDeviceProperty_Prop_FirmwareVersion_Uint64 = 1018, - ETrackedDeviceProperty_Prop_FPGAVersion_Uint64 = 1019, - ETrackedDeviceProperty_Prop_VRCVersion_Uint64 = 1020, - ETrackedDeviceProperty_Prop_RadioVersion_Uint64 = 1021, - ETrackedDeviceProperty_Prop_DongleVersion_Uint64 = 1022, - ETrackedDeviceProperty_Prop_BlockServerShutdown_Bool = 1023, - ETrackedDeviceProperty_Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, - ETrackedDeviceProperty_Prop_ContainsProximitySensor_Bool = 1025, - ETrackedDeviceProperty_Prop_DeviceProvidesBatteryStatus_Bool = 1026, - ETrackedDeviceProperty_Prop_DeviceCanPowerOff_Bool = 1027, - ETrackedDeviceProperty_Prop_Firmware_ProgrammingTarget_String = 1028, - ETrackedDeviceProperty_Prop_DeviceClass_Int32 = 1029, - ETrackedDeviceProperty_Prop_HasCamera_Bool = 1030, - ETrackedDeviceProperty_Prop_ReportsTimeSinceVSync_Bool = 2000, - ETrackedDeviceProperty_Prop_SecondsFromVsyncToPhotons_Float = 2001, - ETrackedDeviceProperty_Prop_DisplayFrequency_Float = 2002, - ETrackedDeviceProperty_Prop_UserIpdMeters_Float = 2003, - ETrackedDeviceProperty_Prop_CurrentUniverseId_Uint64 = 2004, - ETrackedDeviceProperty_Prop_PreviousUniverseId_Uint64 = 2005, - ETrackedDeviceProperty_Prop_DisplayFirmwareVersion_Uint64 = 2006, - ETrackedDeviceProperty_Prop_IsOnDesktop_Bool = 2007, - ETrackedDeviceProperty_Prop_DisplayMCType_Int32 = 2008, - ETrackedDeviceProperty_Prop_DisplayMCOffset_Float = 2009, - ETrackedDeviceProperty_Prop_DisplayMCScale_Float = 2010, - ETrackedDeviceProperty_Prop_EdidVendorID_Int32 = 2011, - ETrackedDeviceProperty_Prop_DisplayMCImageLeft_String = 2012, - ETrackedDeviceProperty_Prop_DisplayMCImageRight_String = 2013, - ETrackedDeviceProperty_Prop_DisplayGCBlackClamp_Float = 2014, - ETrackedDeviceProperty_Prop_EdidProductID_Int32 = 2015, - ETrackedDeviceProperty_Prop_CameraToHeadTransform_Matrix34 = 2016, - ETrackedDeviceProperty_Prop_DisplayGCType_Int32 = 2017, - ETrackedDeviceProperty_Prop_DisplayGCOffset_Float = 2018, - ETrackedDeviceProperty_Prop_DisplayGCScale_Float = 2019, - ETrackedDeviceProperty_Prop_DisplayGCPrescale_Float = 2020, - ETrackedDeviceProperty_Prop_DisplayGCImage_String = 2021, - ETrackedDeviceProperty_Prop_LensCenterLeftU_Float = 2022, - ETrackedDeviceProperty_Prop_LensCenterLeftV_Float = 2023, - ETrackedDeviceProperty_Prop_LensCenterRightU_Float = 2024, - ETrackedDeviceProperty_Prop_LensCenterRightV_Float = 2025, - ETrackedDeviceProperty_Prop_UserHeadToEyeDepthMeters_Float = 2026, - ETrackedDeviceProperty_Prop_CameraFirmwareVersion_Uint64 = 2027, - ETrackedDeviceProperty_Prop_CameraFirmwareDescription_String = 2028, - ETrackedDeviceProperty_Prop_DisplayFPGAVersion_Uint64 = 2029, - ETrackedDeviceProperty_Prop_DisplayBootloaderVersion_Uint64 = 2030, - ETrackedDeviceProperty_Prop_DisplayHardwareVersion_Uint64 = 2031, - ETrackedDeviceProperty_Prop_AudioFirmwareVersion_Uint64 = 2032, - ETrackedDeviceProperty_Prop_CameraCompatibilityMode_Int32 = 2033, - ETrackedDeviceProperty_Prop_AttachedDeviceId_String = 3000, - ETrackedDeviceProperty_Prop_SupportedButtons_Uint64 = 3001, - ETrackedDeviceProperty_Prop_Axis0Type_Int32 = 3002, - ETrackedDeviceProperty_Prop_Axis1Type_Int32 = 3003, - ETrackedDeviceProperty_Prop_Axis2Type_Int32 = 3004, - ETrackedDeviceProperty_Prop_Axis3Type_Int32 = 3005, - ETrackedDeviceProperty_Prop_Axis4Type_Int32 = 3006, - ETrackedDeviceProperty_Prop_FieldOfViewLeftDegrees_Float = 4000, - ETrackedDeviceProperty_Prop_FieldOfViewRightDegrees_Float = 4001, - ETrackedDeviceProperty_Prop_FieldOfViewTopDegrees_Float = 4002, - ETrackedDeviceProperty_Prop_FieldOfViewBottomDegrees_Float = 4003, - ETrackedDeviceProperty_Prop_TrackingRangeMinimumMeters_Float = 4004, - ETrackedDeviceProperty_Prop_TrackingRangeMaximumMeters_Float = 4005, - ETrackedDeviceProperty_Prop_ModeLabel_String = 4006, - ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_Start = 10000, - ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_End = 10999, -} ETrackedDeviceProperty; - -typedef enum ETrackedPropertyError -{ - ETrackedPropertyError_TrackedProp_Success = 0, - ETrackedPropertyError_TrackedProp_WrongDataType = 1, - ETrackedPropertyError_TrackedProp_WrongDeviceClass = 2, - ETrackedPropertyError_TrackedProp_BufferTooSmall = 3, - ETrackedPropertyError_TrackedProp_UnknownProperty = 4, - ETrackedPropertyError_TrackedProp_InvalidDevice = 5, - ETrackedPropertyError_TrackedProp_CouldNotContactServer = 6, - ETrackedPropertyError_TrackedProp_ValueNotProvidedByDevice = 7, - ETrackedPropertyError_TrackedProp_StringExceedsMaximumLength = 8, - ETrackedPropertyError_TrackedProp_NotYetAvailable = 9, -} ETrackedPropertyError; - -typedef enum EVRSubmitFlags -{ - EVRSubmitFlags_Submit_Default = 0, - EVRSubmitFlags_Submit_LensDistortionAlreadyApplied = 1, - EVRSubmitFlags_Submit_GlRenderBuffer = 2, -} EVRSubmitFlags; - -typedef enum EVRState -{ - EVRState_VRState_Undefined = -1, - EVRState_VRState_Off = 0, - EVRState_VRState_Searching = 1, - EVRState_VRState_Searching_Alert = 2, - EVRState_VRState_Ready = 3, - EVRState_VRState_Ready_Alert = 4, - EVRState_VRState_NotReady = 5, -} EVRState; - -typedef enum EVREventType -{ - EVREventType_VREvent_None = 0, - EVREventType_VREvent_TrackedDeviceActivated = 100, - EVREventType_VREvent_TrackedDeviceDeactivated = 101, - EVREventType_VREvent_TrackedDeviceUpdated = 102, - EVREventType_VREvent_TrackedDeviceUserInteractionStarted = 103, - EVREventType_VREvent_TrackedDeviceUserInteractionEnded = 104, - EVREventType_VREvent_IpdChanged = 105, - EVREventType_VREvent_EnterStandbyMode = 106, - EVREventType_VREvent_LeaveStandbyMode = 107, - EVREventType_VREvent_TrackedDeviceRoleChanged = 108, - EVREventType_VREvent_ButtonPress = 200, - EVREventType_VREvent_ButtonUnpress = 201, - EVREventType_VREvent_ButtonTouch = 202, - EVREventType_VREvent_ButtonUntouch = 203, - EVREventType_VREvent_MouseMove = 300, - EVREventType_VREvent_MouseButtonDown = 301, - EVREventType_VREvent_MouseButtonUp = 302, - EVREventType_VREvent_FocusEnter = 303, - EVREventType_VREvent_FocusLeave = 304, - EVREventType_VREvent_Scroll = 305, - EVREventType_VREvent_TouchPadMove = 306, - EVREventType_VREvent_InputFocusCaptured = 400, - EVREventType_VREvent_InputFocusReleased = 401, - EVREventType_VREvent_SceneFocusLost = 402, - EVREventType_VREvent_SceneFocusGained = 403, - EVREventType_VREvent_SceneApplicationChanged = 404, - EVREventType_VREvent_SceneFocusChanged = 405, - EVREventType_VREvent_HideRenderModels = 410, - EVREventType_VREvent_ShowRenderModels = 411, - EVREventType_VREvent_OverlayShown = 500, - EVREventType_VREvent_OverlayHidden = 501, - EVREventType_VREvent_DashboardActivated = 502, - EVREventType_VREvent_DashboardDeactivated = 503, - EVREventType_VREvent_DashboardThumbSelected = 504, - EVREventType_VREvent_DashboardRequested = 505, - EVREventType_VREvent_ResetDashboard = 506, - EVREventType_VREvent_RenderToast = 507, - EVREventType_VREvent_ImageLoaded = 508, - EVREventType_VREvent_ShowKeyboard = 509, - EVREventType_VREvent_HideKeyboard = 510, - EVREventType_VREvent_OverlayGamepadFocusGained = 511, - EVREventType_VREvent_OverlayGamepadFocusLost = 512, - EVREventType_VREvent_OverlaySharedTextureChanged = 513, - EVREventType_VREvent_Notification_Shown = 600, - EVREventType_VREvent_Notification_Hidden = 601, - EVREventType_VREvent_Notification_BeginInteraction = 602, - EVREventType_VREvent_Notification_Destroyed = 603, - EVREventType_VREvent_Quit = 700, - EVREventType_VREvent_ProcessQuit = 701, - EVREventType_VREvent_QuitAborted_UserPrompt = 702, - EVREventType_VREvent_QuitAcknowledged = 703, - EVREventType_VREvent_ChaperoneDataHasChanged = 800, - EVREventType_VREvent_ChaperoneUniverseHasChanged = 801, - EVREventType_VREvent_ChaperoneTempDataHasChanged = 802, - EVREventType_VREvent_ChaperoneSettingsHaveChanged = 803, - EVREventType_VREvent_SeatedZeroPoseReset = 804, - EVREventType_VREvent_BackgroundSettingHasChanged = 850, - EVREventType_VREvent_CameraSettingsHaveChanged = 851, - EVREventType_VREvent_StatusUpdate = 900, - EVREventType_VREvent_MCImageUpdated = 1000, - EVREventType_VREvent_FirmwareUpdateStarted = 1100, - EVREventType_VREvent_FirmwareUpdateFinished = 1101, - EVREventType_VREvent_KeyboardClosed = 1200, - EVREventType_VREvent_KeyboardCharInput = 1201, - EVREventType_VREvent_KeyboardDone = 1202, - EVREventType_VREvent_ApplicationTransitionStarted = 1300, - EVREventType_VREvent_ApplicationTransitionAborted = 1301, - EVREventType_VREvent_ApplicationTransitionNewAppStarted = 1302, - EVREventType_VREvent_Compositor_MirrorWindowShown = 1400, - EVREventType_VREvent_Compositor_MirrorWindowHidden = 1401, - EVREventType_VREvent_Compositor_ChaperoneBoundsShown = 1410, - EVREventType_VREvent_Compositor_ChaperoneBoundsHidden = 1411, - EVREventType_VREvent_TrackedCamera_StartVideoStream = 1500, - EVREventType_VREvent_TrackedCamera_StopVideoStream = 1501, - EVREventType_VREvent_TrackedCamera_PauseVideoStream = 1502, - EVREventType_VREvent_TrackedCamera_ResumeVideoStream = 1503, - EVREventType_VREvent_PerformanceTest_EnableCapture = 1600, - EVREventType_VREvent_PerformanceTest_DisableCapture = 1601, - EVREventType_VREvent_PerformanceTest_FidelityLevel = 1602, - EVREventType_VREvent_VendorSpecific_Reserved_Start = 10000, - EVREventType_VREvent_VendorSpecific_Reserved_End = 19999, -} EVREventType; - -typedef enum EDeviceActivityLevel -{ - EDeviceActivityLevel_k_EDeviceActivityLevel_Unknown = -1, - EDeviceActivityLevel_k_EDeviceActivityLevel_Idle = 0, - EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction = 1, - EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction_Timeout = 2, - EDeviceActivityLevel_k_EDeviceActivityLevel_Standby = 3, -} EDeviceActivityLevel; - -typedef enum EVRButtonId -{ - EVRButtonId_k_EButton_System = 0, - EVRButtonId_k_EButton_ApplicationMenu = 1, - EVRButtonId_k_EButton_Grip = 2, - EVRButtonId_k_EButton_DPad_Left = 3, - EVRButtonId_k_EButton_DPad_Up = 4, - EVRButtonId_k_EButton_DPad_Right = 5, - EVRButtonId_k_EButton_DPad_Down = 6, - EVRButtonId_k_EButton_A = 7, - EVRButtonId_k_EButton_Axis0 = 32, - EVRButtonId_k_EButton_Axis1 = 33, - EVRButtonId_k_EButton_Axis2 = 34, - EVRButtonId_k_EButton_Axis3 = 35, - EVRButtonId_k_EButton_Axis4 = 36, - EVRButtonId_k_EButton_SteamVR_Touchpad = 32, - EVRButtonId_k_EButton_SteamVR_Trigger = 33, - EVRButtonId_k_EButton_Dashboard_Back = 2, - EVRButtonId_k_EButton_Max = 64, -} EVRButtonId; - -typedef enum EVRMouseButton -{ - EVRMouseButton_VRMouseButton_Left = 1, - EVRMouseButton_VRMouseButton_Right = 2, - EVRMouseButton_VRMouseButton_Middle = 4, -} EVRMouseButton; - -typedef enum EVRControllerAxisType -{ - EVRControllerAxisType_k_eControllerAxis_None = 0, - EVRControllerAxisType_k_eControllerAxis_TrackPad = 1, - EVRControllerAxisType_k_eControllerAxis_Joystick = 2, - EVRControllerAxisType_k_eControllerAxis_Trigger = 3, -} EVRControllerAxisType; - -typedef enum EVRControllerEventOutputType -{ - EVRControllerEventOutputType_ControllerEventOutput_OSEvents = 0, - EVRControllerEventOutputType_ControllerEventOutput_VREvents = 1, -} EVRControllerEventOutputType; - -typedef enum ECollisionBoundsStyle -{ - ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_BEGINNER = 0, - ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_INTERMEDIATE = 1, - ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_SQUARES = 2, - ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_ADVANCED = 3, - ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_NONE = 4, - ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_COUNT = 5, -} ECollisionBoundsStyle; - -typedef enum EVROverlayError -{ - EVROverlayError_VROverlayError_None = 0, - EVROverlayError_VROverlayError_UnknownOverlay = 10, - EVROverlayError_VROverlayError_InvalidHandle = 11, - EVROverlayError_VROverlayError_PermissionDenied = 12, - EVROverlayError_VROverlayError_OverlayLimitExceeded = 13, - EVROverlayError_VROverlayError_WrongVisibilityType = 14, - EVROverlayError_VROverlayError_KeyTooLong = 15, - EVROverlayError_VROverlayError_NameTooLong = 16, - EVROverlayError_VROverlayError_KeyInUse = 17, - EVROverlayError_VROverlayError_WrongTransformType = 18, - EVROverlayError_VROverlayError_InvalidTrackedDevice = 19, - EVROverlayError_VROverlayError_InvalidParameter = 20, - EVROverlayError_VROverlayError_ThumbnailCantBeDestroyed = 21, - EVROverlayError_VROverlayError_ArrayTooSmall = 22, - EVROverlayError_VROverlayError_RequestFailed = 23, - EVROverlayError_VROverlayError_InvalidTexture = 24, - EVROverlayError_VROverlayError_UnableToLoadFile = 25, - EVROverlayError_VROVerlayError_KeyboardAlreadyInUse = 26, - EVROverlayError_VROverlayError_NoNeighbor = 27, -} EVROverlayError; - -typedef enum EVRApplicationType -{ - EVRApplicationType_VRApplication_Other = 0, - EVRApplicationType_VRApplication_Scene = 1, - EVRApplicationType_VRApplication_Overlay = 2, - EVRApplicationType_VRApplication_Background = 3, - EVRApplicationType_VRApplication_Utility = 4, -} EVRApplicationType; - -typedef enum EVRFirmwareError -{ - EVRFirmwareError_VRFirmwareError_None = 0, - EVRFirmwareError_VRFirmwareError_Success = 1, - EVRFirmwareError_VRFirmwareError_Fail = 2, -} EVRFirmwareError; - -typedef enum EVRNotificationError -{ - EVRNotificationError_VRNotificationError_OK = 0, - EVRNotificationError_VRNotificationError_InvalidNotificationId = 100, - EVRNotificationError_VRNotificationError_NotificationQueueFull = 101, - EVRNotificationError_VRNotificationError_InvalidOverlayHandle = 102, -} EVRNotificationError; - -typedef enum EVRInitError -{ - EVRInitError_VRInitError_None = 0, - EVRInitError_VRInitError_Unknown = 1, - EVRInitError_VRInitError_Init_InstallationNotFound = 100, - EVRInitError_VRInitError_Init_InstallationCorrupt = 101, - EVRInitError_VRInitError_Init_VRClientDLLNotFound = 102, - EVRInitError_VRInitError_Init_FileNotFound = 103, - EVRInitError_VRInitError_Init_FactoryNotFound = 104, - EVRInitError_VRInitError_Init_InterfaceNotFound = 105, - EVRInitError_VRInitError_Init_InvalidInterface = 106, - EVRInitError_VRInitError_Init_UserConfigDirectoryInvalid = 107, - EVRInitError_VRInitError_Init_HmdNotFound = 108, - EVRInitError_VRInitError_Init_NotInitialized = 109, - EVRInitError_VRInitError_Init_PathRegistryNotFound = 110, - EVRInitError_VRInitError_Init_NoConfigPath = 111, - EVRInitError_VRInitError_Init_NoLogPath = 112, - EVRInitError_VRInitError_Init_PathRegistryNotWritable = 113, - EVRInitError_VRInitError_Init_AppInfoInitFailed = 114, - EVRInitError_VRInitError_Init_Retry = 115, - EVRInitError_VRInitError_Init_InitCanceledByUser = 116, - EVRInitError_VRInitError_Init_AnotherAppLaunching = 117, - EVRInitError_VRInitError_Init_SettingsInitFailed = 118, - EVRInitError_VRInitError_Init_ShuttingDown = 119, - EVRInitError_VRInitError_Init_TooManyObjects = 120, - EVRInitError_VRInitError_Init_NoServerForBackgroundApp = 121, - EVRInitError_VRInitError_Init_NotSupportedWithCompositor = 122, - EVRInitError_VRInitError_Init_NotAvailableToUtilityApps = 123, - EVRInitError_VRInitError_Driver_Failed = 200, - EVRInitError_VRInitError_Driver_Unknown = 201, - EVRInitError_VRInitError_Driver_HmdUnknown = 202, - EVRInitError_VRInitError_Driver_NotLoaded = 203, - EVRInitError_VRInitError_Driver_RuntimeOutOfDate = 204, - EVRInitError_VRInitError_Driver_HmdInUse = 205, - EVRInitError_VRInitError_Driver_NotCalibrated = 206, - EVRInitError_VRInitError_Driver_CalibrationInvalid = 207, - EVRInitError_VRInitError_Driver_HmdDisplayNotFound = 208, - EVRInitError_VRInitError_IPC_ServerInitFailed = 300, - EVRInitError_VRInitError_IPC_ConnectFailed = 301, - EVRInitError_VRInitError_IPC_SharedStateInitFailed = 302, - EVRInitError_VRInitError_IPC_CompositorInitFailed = 303, - EVRInitError_VRInitError_IPC_MutexInitFailed = 304, - EVRInitError_VRInitError_IPC_Failed = 305, - EVRInitError_VRInitError_Compositor_Failed = 400, - EVRInitError_VRInitError_Compositor_D3D11HardwareRequired = 401, - EVRInitError_VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, - EVRInitError_VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, - EVRInitError_VRInitError_VendorSpecific_HmdFound_NoStoredConfig = 1103, - EVRInitError_VRInitError_VendorSpecific_HmdFound_ConfigTooBig = 1104, - EVRInitError_VRInitError_VendorSpecific_HmdFound_ConfigTooSmall = 1105, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToInitZLib = 1106, - EVRInitError_VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UserDataAddressRange = 1111, - EVRInitError_VRInitError_VendorSpecific_HmdFound_UserDataError = 1112, - EVRInitError_VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, - EVRInitError_VRInitError_Steam_SteamInstallationNotFound = 2000, -} EVRInitError; - -typedef enum EVRApplicationError -{ - EVRApplicationError_VRApplicationError_None = 0, - EVRApplicationError_VRApplicationError_AppKeyAlreadyExists = 100, - EVRApplicationError_VRApplicationError_NoManifest = 101, - EVRApplicationError_VRApplicationError_NoApplication = 102, - EVRApplicationError_VRApplicationError_InvalidIndex = 103, - EVRApplicationError_VRApplicationError_UnknownApplication = 104, - EVRApplicationError_VRApplicationError_IPCFailed = 105, - EVRApplicationError_VRApplicationError_ApplicationAlreadyRunning = 106, - EVRApplicationError_VRApplicationError_InvalidManifest = 107, - EVRApplicationError_VRApplicationError_InvalidApplication = 108, - EVRApplicationError_VRApplicationError_LaunchFailed = 109, - EVRApplicationError_VRApplicationError_ApplicationAlreadyStarting = 110, - EVRApplicationError_VRApplicationError_LaunchInProgress = 111, - EVRApplicationError_VRApplicationError_OldApplicationQuitting = 112, - EVRApplicationError_VRApplicationError_TransitionAborted = 113, - EVRApplicationError_VRApplicationError_IsTemplate = 114, - EVRApplicationError_VRApplicationError_BufferTooSmall = 200, - EVRApplicationError_VRApplicationError_PropertyNotSet = 201, - EVRApplicationError_VRApplicationError_UnknownProperty = 202, -} EVRApplicationError; - -typedef enum EVRApplicationProperty -{ - EVRApplicationProperty_VRApplicationProperty_Name_String = 0, - EVRApplicationProperty_VRApplicationProperty_LaunchType_String = 11, - EVRApplicationProperty_VRApplicationProperty_WorkingDirectory_String = 12, - EVRApplicationProperty_VRApplicationProperty_BinaryPath_String = 13, - EVRApplicationProperty_VRApplicationProperty_Arguments_String = 14, - EVRApplicationProperty_VRApplicationProperty_URL_String = 15, - EVRApplicationProperty_VRApplicationProperty_Description_String = 50, - EVRApplicationProperty_VRApplicationProperty_NewsURL_String = 51, - EVRApplicationProperty_VRApplicationProperty_ImagePath_String = 52, - EVRApplicationProperty_VRApplicationProperty_Source_String = 53, - EVRApplicationProperty_VRApplicationProperty_IsDashboardOverlay_Bool = 60, - EVRApplicationProperty_VRApplicationProperty_IsTemplate_Bool = 61, - EVRApplicationProperty_VRApplicationProperty_IsInstanced_Bool = 62, - EVRApplicationProperty_VRApplicationProperty_LastLaunchTime_Uint64 = 70, -} EVRApplicationProperty; - -typedef enum EVRApplicationTransitionState -{ - EVRApplicationTransitionState_VRApplicationTransition_None = 0, - EVRApplicationTransitionState_VRApplicationTransition_OldAppQuitSent = 10, - EVRApplicationTransitionState_VRApplicationTransition_WaitingForExternalLaunch = 11, - EVRApplicationTransitionState_VRApplicationTransition_NewAppLaunched = 20, -} EVRApplicationTransitionState; - -typedef enum ChaperoneCalibrationState -{ - ChaperoneCalibrationState_OK = 1, - ChaperoneCalibrationState_Warning = 100, - ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101, - ChaperoneCalibrationState_Warning_BaseStationRemoved = 102, - ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103, - ChaperoneCalibrationState_Error = 200, - ChaperoneCalibrationState_Error_BaseStationUninitalized = 201, - ChaperoneCalibrationState_Error_BaseStationConflict = 202, - ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, - ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, -} ChaperoneCalibrationState; - -typedef enum EChaperoneConfigFile -{ - EChaperoneConfigFile_Live = 1, - EChaperoneConfigFile_Temp = 2, -} EChaperoneConfigFile; - -typedef enum EChaperoneImportFlags -{ - EChaperoneImportFlags_EChaperoneImport_BoundsOnly = 1, -} EChaperoneImportFlags; - -typedef enum EVRCompositorError -{ - EVRCompositorError_VRCompositorError_None = 0, - EVRCompositorError_VRCompositorError_IncompatibleVersion = 100, - EVRCompositorError_VRCompositorError_DoNotHaveFocus = 101, - EVRCompositorError_VRCompositorError_InvalidTexture = 102, - EVRCompositorError_VRCompositorError_IsNotSceneApplication = 103, - EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice = 104, - EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat = 105, - EVRCompositorError_VRCompositorError_SharedTexturesNotSupported = 106, - EVRCompositorError_VRCompositorError_IndexOutOfRange = 107, -} EVRCompositorError; - -typedef enum VROverlayInputMethod -{ - VROverlayInputMethod_None = 0, - VROverlayInputMethod_Mouse = 1, -} VROverlayInputMethod; - -typedef enum VROverlayTransformType -{ - VROverlayTransformType_VROverlayTransform_Absolute = 0, - VROverlayTransformType_VROverlayTransform_TrackedDeviceRelative = 1, - VROverlayTransformType_VROverlayTransform_SystemOverlay = 2, - VROverlayTransformType_VROverlayTransform_TrackedComponent = 3, -} VROverlayTransformType; - -typedef enum VROverlayFlags -{ - VROverlayFlags_None = 0, - VROverlayFlags_Curved = 1, - VROverlayFlags_RGSS4X = 2, - VROverlayFlags_NoDashboardTab = 3, - VROverlayFlags_AcceptsGamepadEvents = 4, - VROverlayFlags_ShowGamepadFocus = 5, - VROverlayFlags_SendVRScrollEvents = 6, - VROverlayFlags_SendVRTouchpadEvents = 7, - VROverlayFlags_ShowTouchPadScrollWheel = 8, -} VROverlayFlags; - -typedef enum EGamepadTextInputMode -{ - EGamepadTextInputMode_k_EGamepadTextInputModeNormal = 0, - EGamepadTextInputMode_k_EGamepadTextInputModePassword = 1, - EGamepadTextInputMode_k_EGamepadTextInputModeSubmit = 2, -} EGamepadTextInputMode; - -typedef enum EGamepadTextInputLineMode -{ - EGamepadTextInputLineMode_k_EGamepadTextInputLineModeSingleLine = 0, - EGamepadTextInputLineMode_k_EGamepadTextInputLineModeMultipleLines = 1, -} EGamepadTextInputLineMode; - -typedef enum EOverlayDirection -{ - EOverlayDirection_OverlayDirection_Up = 0, - EOverlayDirection_OverlayDirection_Down = 1, - EOverlayDirection_OverlayDirection_Left = 2, - EOverlayDirection_OverlayDirection_Right = 3, - EOverlayDirection_OverlayDirection_Count = 4, -} EOverlayDirection; - -typedef enum EVRRenderModelError -{ - EVRRenderModelError_VRRenderModelError_None = 0, - EVRRenderModelError_VRRenderModelError_Loading = 100, - EVRRenderModelError_VRRenderModelError_NotSupported = 200, - EVRRenderModelError_VRRenderModelError_InvalidArg = 300, - EVRRenderModelError_VRRenderModelError_InvalidModel = 301, - EVRRenderModelError_VRRenderModelError_NoShapes = 302, - EVRRenderModelError_VRRenderModelError_MultipleShapes = 303, - EVRRenderModelError_VRRenderModelError_TooManyIndices = 304, - EVRRenderModelError_VRRenderModelError_MultipleTextures = 305, - EVRRenderModelError_VRRenderModelError_InvalidTexture = 400, -} EVRRenderModelError; - -typedef enum EVRComponentProperty -{ - EVRComponentProperty_VRComponentProperty_IsStatic = 1, - EVRComponentProperty_VRComponentProperty_IsVisible = 2, - EVRComponentProperty_VRComponentProperty_IsTouched = 4, - EVRComponentProperty_VRComponentProperty_IsPressed = 8, - EVRComponentProperty_VRComponentProperty_IsScrolled = 16, -} EVRComponentProperty; - -typedef enum EVRNotificationType -{ - EVRNotificationType_Transient = 0, - EVRNotificationType_Persistent = 1, -} EVRNotificationType; - -typedef enum EVRNotificationStyle -{ - EVRNotificationStyle_None = 0, - EVRNotificationStyle_Application = 100, - EVRNotificationStyle_Contact_Disabled = 200, - EVRNotificationStyle_Contact_Enabled = 201, - EVRNotificationStyle_Contact_Active = 202, -} EVRNotificationStyle; - -typedef enum EVRSettingsError -{ - EVRSettingsError_VRSettingsError_None = 0, - EVRSettingsError_VRSettingsError_IPCFailed = 1, - EVRSettingsError_VRSettingsError_WriteFailed = 2, - EVRSettingsError_VRSettingsError_ReadFailed = 3, -} EVRSettingsError; - - -// OpenVR typedefs - -typedef uint32_t TrackedDeviceIndex_t; -typedef uint32_t VRNotificationId; -typedef uint64_t VROverlayHandle_t; -typedef void * glSharedTextureHandle_t; -typedef int32_t glInt_t; -typedef uint32_t glUInt_t; -typedef uint32_t TrackedDeviceIndex_t; -typedef uint64_t VROverlayHandle_t; -typedef uint32_t VRComponentProperties; -typedef int32_t TextureID_t; -typedef uint32_t VRNotificationId; -typedef EVRInitError HmdError; -typedef EVREye Hmd_Eye; -typedef EGraphicsAPIConvention GraphicsAPIConvention; -typedef EColorSpace ColorSpace; -typedef ETrackingResult HmdTrackingResult; -typedef ETrackedDeviceClass TrackedDeviceClass; -typedef ETrackingUniverseOrigin TrackingUniverseOrigin; -typedef ETrackedDeviceProperty TrackedDeviceProperty; -typedef ETrackedPropertyError TrackedPropertyError; -typedef EVRSubmitFlags VRSubmitFlags_t; -typedef EVRState VRState_t; -typedef ECollisionBoundsStyle CollisionBoundsStyle_t; -typedef EVROverlayError VROverlayError; -typedef EVRFirmwareError VRFirmwareError; -typedef EVRCompositorError VRCompositorError; - -// OpenVR Structs - -typedef struct HmdMatrix34_t -{ - float m[3][4]; //float[3][4] -} HmdMatrix34_t; - -typedef struct HmdMatrix44_t -{ - float m[4][4]; //float[4][4] -} HmdMatrix44_t; - -typedef struct HmdVector3_t -{ - float v[3]; //float[3] -} HmdVector3_t; - -typedef struct HmdVector4_t -{ - float v[4]; //float[4] -} HmdVector4_t; - -typedef struct HmdVector3d_t -{ - double v[3]; //double[3] -} HmdVector3d_t; - -typedef struct HmdVector2_t -{ - float v[2]; //float[2] -} HmdVector2_t; - -typedef struct HmdQuaternion_t -{ - double w; - double x; - double y; - double z; -} HmdQuaternion_t; - -typedef struct HmdColor_t -{ - float r; - float g; - float b; - float a; -} HmdColor_t; - -typedef struct HmdQuad_t -{ - struct HmdVector3_t vCorners[4]; //struct vr::HmdVector3_t[4] -} HmdQuad_t; - -typedef struct HmdRect2_t -{ - struct HmdVector2_t vTopLeft; - struct HmdVector2_t vBottomRight; -} HmdRect2_t; - -typedef struct DistortionCoordinates_t -{ - float rfRed[2]; //float[2] - float rfGreen[2]; //float[2] - float rfBlue[2]; //float[2] -} DistortionCoordinates_t; - -typedef struct Texture_t -{ - void * handle; // void * - enum EGraphicsAPIConvention eType; - enum EColorSpace eColorSpace; -} Texture_t; - -typedef struct TrackedDevicePose_t -{ - struct HmdMatrix34_t mDeviceToAbsoluteTracking; - struct HmdVector3_t vVelocity; - struct HmdVector3_t vAngularVelocity; - enum ETrackingResult eTrackingResult; - bool bPoseIsValid; - bool bDeviceIsConnected; -} TrackedDevicePose_t; - -typedef struct VRTextureBounds_t -{ - float uMin; - float vMin; - float uMax; - float vMax; -} VRTextureBounds_t; - -typedef struct VREvent_Controller_t -{ - uint32_t button; -} VREvent_Controller_t; - -typedef struct VREvent_Mouse_t -{ - float x; - float y; - uint32_t button; -} VREvent_Mouse_t; - -typedef struct VREvent_Scroll_t -{ - float xdelta; - float ydelta; - uint32_t repeatCount; -} VREvent_Scroll_t; - -typedef struct VREvent_TouchPadMove_t -{ - bool bFingerDown; - float flSecondsFingerDown; - float fValueXFirst; - float fValueYFirst; - float fValueXRaw; - float fValueYRaw; -} VREvent_TouchPadMove_t; - -typedef struct VREvent_Notification_t -{ - uint64_t ulUserValue; - uint32_t notificationId; -} VREvent_Notification_t; - -typedef struct VREvent_Process_t -{ - uint32_t pid; - uint32_t oldPid; - bool bForced; -} VREvent_Process_t; - -typedef struct VREvent_Overlay_t -{ - uint64_t overlayHandle; -} VREvent_Overlay_t; - -typedef struct VREvent_Status_t -{ - uint32_t statusState; -} VREvent_Status_t; - -typedef struct VREvent_Keyboard_t -{ - char * cNewInput[8]; //char[8] - uint64_t uUserValue; -} VREvent_Keyboard_t; - -typedef struct VREvent_Ipd_t -{ - float ipdMeters; -} VREvent_Ipd_t; - -typedef struct VREvent_Chaperone_t -{ - uint64_t m_nPreviousUniverse; - uint64_t m_nCurrentUniverse; -} VREvent_Chaperone_t; - -typedef struct VREvent_Reserved_t -{ - uint64_t reserved0; - uint64_t reserved1; -} VREvent_Reserved_t; - -typedef struct VREvent_PerformanceTest_t -{ - uint32_t m_nFidelityLevel; -} VREvent_PerformanceTest_t; - -typedef struct VREvent_SeatedZeroPoseReset_t -{ - bool bResetBySystemMenu; -} VREvent_SeatedZeroPoseReset_t; - -typedef struct HiddenAreaMesh_t -{ - struct HmdVector2_t * pVertexData; // const struct vr::HmdVector2_t * - uint32_t unTriangleCount; -} HiddenAreaMesh_t; - -typedef struct VRControllerAxis_t -{ - float x; - float y; -} VRControllerAxis_t; - -typedef struct VRControllerState_t -{ - uint32_t unPacketNum; - uint64_t ulButtonPressed; - uint64_t ulButtonTouched; - struct VRControllerAxis_t rAxis[5]; //struct vr::VRControllerAxis_t[5] -} VRControllerState_t; - -typedef struct Compositor_OverlaySettings -{ - uint32_t size; - bool curved; - bool antialias; - float scale; - float distance; - float alpha; - float uOffset; - float vOffset; - float uScale; - float vScale; - float gridDivs; - float gridWidth; - float gridScale; - struct HmdMatrix44_t transform; -} Compositor_OverlaySettings; - -typedef struct AppOverrideKeys_t -{ - char * pchKey; // const char * - char * pchValue; // const char * -} AppOverrideKeys_t; - -typedef struct Compositor_FrameTiming -{ - uint32_t m_nSize; - uint32_t m_nFrameIndex; - uint32_t m_nNumFramePresents; - uint32_t m_nNumDroppedFrames; - double m_flSystemTimeInSeconds; - float m_flSceneRenderGpuMs; - float m_flTotalRenderGpuMs; - float m_flCompositorRenderGpuMs; - float m_flCompositorRenderCpuMs; - float m_flCompositorIdleCpuMs; - float m_flClientFrameIntervalMs; - float m_flPresentCallCpuMs; - float m_flWaitForPresentCpuMs; - float m_flSubmitFrameMs; - float m_flWaitGetPosesCalledMs; - float m_flNewPosesReadyMs; - float m_flNewFrameReadyMs; - float m_flCompositorUpdateStartMs; - float m_flCompositorUpdateEndMs; - float m_flCompositorRenderStartMs; - TrackedDevicePose_t m_HmdPose; - int32_t m_nFidelityLevel; -} Compositor_FrameTiming; - -typedef struct VROverlayIntersectionParams_t -{ - struct HmdVector3_t vSource; - struct HmdVector3_t vDirection; - enum ETrackingUniverseOrigin eOrigin; -} VROverlayIntersectionParams_t; - -typedef struct VROverlayIntersectionResults_t -{ - struct HmdVector3_t vPoint; - struct HmdVector3_t vNormal; - struct HmdVector2_t vUVs; - float fDistance; -} VROverlayIntersectionResults_t; - -typedef struct RenderModel_ComponentState_t -{ - struct HmdMatrix34_t mTrackingToComponentRenderModel; - struct HmdMatrix34_t mTrackingToComponentLocal; - VRComponentProperties uProperties; -} RenderModel_ComponentState_t; - -typedef struct RenderModel_Vertex_t -{ - struct HmdVector3_t vPosition; - struct HmdVector3_t vNormal; - float rfTextureCoord[2]; //float[2] -} RenderModel_Vertex_t; - -typedef struct RenderModel_TextureMap_t -{ - uint16_t unWidth; - uint16_t unHeight; - uint8_t * rubTextureMapData; // const uint8_t * -} RenderModel_TextureMap_t; - -typedef struct RenderModel_t -{ - struct RenderModel_Vertex_t * rVertexData; // const struct vr::RenderModel_Vertex_t * - uint32_t unVertexCount; - uint16_t * rIndexData; // const uint16_t * - uint32_t unTriangleCount; - TextureID_t diffuseTextureId; -} RenderModel_t; - -typedef struct RenderModel_ControllerMode_State_t -{ - bool bScrollWheelVisible; -} RenderModel_ControllerMode_State_t; - -typedef struct NotificationBitmap_t -{ - void * bytes; // void * - int32_t width; - int32_t height; - int32_t depth; -} NotificationBitmap_t; - -typedef struct COpenVRContext -{ - intptr_t m_pVRSystem; // class vr::IVRSystem * - intptr_t m_pVRChaperone; // class vr::IVRChaperone * - intptr_t m_pVRChaperoneSetup; // class vr::IVRChaperoneSetup * - intptr_t m_pVRCompositor; // class vr::IVRCompositor * - intptr_t m_pVROverlay; // class vr::IVROverlay * - intptr_t m_pVRRenderModels; // class vr::IVRRenderModels * - intptr_t m_pVRExtendedDisplay; // class vr::IVRExtendedDisplay * - intptr_t m_pVRSettings; // class vr::IVRSettings * - intptr_t m_pVRApplications; // class vr::IVRApplications * -} COpenVRContext; - - -typedef union -{ - VREvent_Reserved_t reserved; - VREvent_Controller_t controller; - VREvent_Mouse_t mouse; - VREvent_Scroll_t scroll; - VREvent_Process_t process; - VREvent_Notification_t notification; - VREvent_Overlay_t overlay; - VREvent_Status_t status; - VREvent_Keyboard_t keyboard; - VREvent_Ipd_t ipd; - VREvent_Chaperone_t chaperone; - VREvent_PerformanceTest_t performanceTest; - VREvent_TouchPadMove_t touchPadMove; - VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; -} VREvent_Data_t; - -/** An event posted by the server to all running applications */ -struct VREvent_t -{ - uint32_t eventType; // EVREventType enum - TrackedDeviceIndex_t trackedDeviceIndex; - float eventAgeSeconds; - // event data must be the end of the struct as its size is variable - VREvent_Data_t data; -}; - - -// OpenVR Function Pointer Tables - -struct VR_IVRSystem_FnTable -{ - void (OPENVR_FNTABLE_CALLTYPE *GetRecommendedRenderTargetSize)(uint32_t * pnWidth, uint32_t * pnHeight); - struct HmdMatrix44_t (OPENVR_FNTABLE_CALLTYPE *GetProjectionMatrix)(EVREye eEye, float fNearZ, float fFarZ, EGraphicsAPIConvention eProjType); - void (OPENVR_FNTABLE_CALLTYPE *GetProjectionRaw)(EVREye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom); - struct DistortionCoordinates_t (OPENVR_FNTABLE_CALLTYPE *ComputeDistortion)(EVREye eEye, float fU, float fV); - struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetEyeToHeadTransform)(EVREye eEye); - bool (OPENVR_FNTABLE_CALLTYPE *GetTimeSinceLastVsync)(float * pfSecondsSinceLastVsync, uint64_t * pulFrameCounter); - int32_t (OPENVR_FNTABLE_CALLTYPE *GetD3D9AdapterIndex)(); - void (OPENVR_FNTABLE_CALLTYPE *GetDXGIOutputInfo)(int32_t * pnAdapterIndex); - bool (OPENVR_FNTABLE_CALLTYPE *IsDisplayOnDesktop)(); - bool (OPENVR_FNTABLE_CALLTYPE *SetDisplayVisibility)(bool bIsVisibleOnDesktop); - void (OPENVR_FNTABLE_CALLTYPE *GetDeviceToAbsoluteTrackingPose)(ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, struct TrackedDevicePose_t * pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount); - void (OPENVR_FNTABLE_CALLTYPE *ResetSeatedZeroPose)(); - struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetSeatedZeroPoseToStandingAbsoluteTrackingPose)(); - struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetRawZeroPoseToStandingAbsoluteTrackingPose)(); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetSortedTrackedDeviceIndicesOfClass)(ETrackedDeviceClass eTrackedDeviceClass, TrackedDeviceIndex_t * punTrackedDeviceIndexArray, uint32_t unTrackedDeviceIndexArrayCount, TrackedDeviceIndex_t unRelativeToTrackedDeviceIndex); - EDeviceActivityLevel (OPENVR_FNTABLE_CALLTYPE *GetTrackedDeviceActivityLevel)(TrackedDeviceIndex_t unDeviceId); - void (OPENVR_FNTABLE_CALLTYPE *ApplyTransform)(struct TrackedDevicePose_t * pOutputPose, struct TrackedDevicePose_t * pTrackedDevicePose, struct HmdMatrix34_t * pTransform); - TrackedDeviceIndex_t (OPENVR_FNTABLE_CALLTYPE *GetTrackedDeviceIndexForControllerRole)(ETrackedControllerRole unDeviceType); - ETrackedControllerRole (OPENVR_FNTABLE_CALLTYPE *GetControllerRoleForTrackedDeviceIndex)(TrackedDeviceIndex_t unDeviceIndex); - ETrackedDeviceClass (OPENVR_FNTABLE_CALLTYPE *GetTrackedDeviceClass)(TrackedDeviceIndex_t unDeviceIndex); - bool (OPENVR_FNTABLE_CALLTYPE *IsTrackedDeviceConnected)(TrackedDeviceIndex_t unDeviceIndex); - bool (OPENVR_FNTABLE_CALLTYPE *GetBoolTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); - float (OPENVR_FNTABLE_CALLTYPE *GetFloatTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); - int32_t (OPENVR_FNTABLE_CALLTYPE *GetInt32TrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); - uint64_t (OPENVR_FNTABLE_CALLTYPE *GetUint64TrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); - struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetMatrix34TrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetStringTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, char * pchValue, uint32_t unBufferSize, ETrackedPropertyError * pError); - char * (OPENVR_FNTABLE_CALLTYPE *GetPropErrorNameFromEnum)(ETrackedPropertyError error); - bool (OPENVR_FNTABLE_CALLTYPE *PollNextEvent)(struct VREvent_t * pEvent, uint32_t uncbVREvent); - bool (OPENVR_FNTABLE_CALLTYPE *PollNextEventWithPose)(ETrackingUniverseOrigin eOrigin, struct VREvent_t * pEvent, uint32_t uncbVREvent, TrackedDevicePose_t * pTrackedDevicePose); - char * (OPENVR_FNTABLE_CALLTYPE *GetEventTypeNameFromEnum)(EVREventType eType); - struct HiddenAreaMesh_t (OPENVR_FNTABLE_CALLTYPE *GetHiddenAreaMesh)(EVREye eEye); - bool (OPENVR_FNTABLE_CALLTYPE *GetControllerState)(TrackedDeviceIndex_t unControllerDeviceIndex, VRControllerState_t * pControllerState); - bool (OPENVR_FNTABLE_CALLTYPE *GetControllerStateWithPose)(ETrackingUniverseOrigin eOrigin, TrackedDeviceIndex_t unControllerDeviceIndex, VRControllerState_t * pControllerState, struct TrackedDevicePose_t * pTrackedDevicePose); - void (OPENVR_FNTABLE_CALLTYPE *TriggerHapticPulse)(TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec); - char * (OPENVR_FNTABLE_CALLTYPE *GetButtonIdNameFromEnum)(EVRButtonId eButtonId); - char * (OPENVR_FNTABLE_CALLTYPE *GetControllerAxisTypeNameFromEnum)(EVRControllerAxisType eAxisType); - bool (OPENVR_FNTABLE_CALLTYPE *CaptureInputFocus)(); - void (OPENVR_FNTABLE_CALLTYPE *ReleaseInputFocus)(); - bool (OPENVR_FNTABLE_CALLTYPE *IsInputFocusCapturedByAnotherProcess)(); - uint32_t (OPENVR_FNTABLE_CALLTYPE *DriverDebugRequest)(TrackedDeviceIndex_t unDeviceIndex, char * pchRequest, char * pchResponseBuffer, uint32_t unResponseBufferSize); - EVRFirmwareError (OPENVR_FNTABLE_CALLTYPE *PerformFirmwareUpdate)(TrackedDeviceIndex_t unDeviceIndex); - void (OPENVR_FNTABLE_CALLTYPE *AcknowledgeQuit_Exiting)(); - void (OPENVR_FNTABLE_CALLTYPE *AcknowledgeQuit_UserPrompt)(); -}; - -struct VR_IVRExtendedDisplay_FnTable -{ - void (OPENVR_FNTABLE_CALLTYPE *GetWindowBounds)(int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight); - void (OPENVR_FNTABLE_CALLTYPE *GetEyeOutputViewport)(EVREye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight); - void (OPENVR_FNTABLE_CALLTYPE *GetDXGIOutputInfo)(int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex); -}; - -struct VR_IVRApplications_FnTable -{ - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *AddApplicationManifest)(char * pchApplicationManifestFullPath, bool bTemporary); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *RemoveApplicationManifest)(char * pchApplicationManifestFullPath); - bool (OPENVR_FNTABLE_CALLTYPE *IsApplicationInstalled)(char * pchAppKey); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationCount)(); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *GetApplicationKeyByIndex)(uint32_t unApplicationIndex, char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *GetApplicationKeyByProcessId)(uint32_t unProcessId, char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchApplication)(char * pchAppKey); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchTemplateApplication)(char * pchTemplateAppKey, char * pchNewAppKey, struct AppOverrideKeys_t * pKeys, uint32_t unKeys); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchDashboardOverlay)(char * pchAppKey); - bool (OPENVR_FNTABLE_CALLTYPE *CancelApplicationLaunch)(char * pchAppKey); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *IdentifyApplication)(uint32_t unProcessId, char * pchAppKey); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationProcessId)(char * pchAppKey); - char * (OPENVR_FNTABLE_CALLTYPE *GetApplicationsErrorNameFromEnum)(EVRApplicationError error); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationPropertyString)(char * pchAppKey, EVRApplicationProperty eProperty, char * pchPropertyValueBuffer, uint32_t unPropertyValueBufferLen, EVRApplicationError * peError); - bool (OPENVR_FNTABLE_CALLTYPE *GetApplicationPropertyBool)(char * pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError * peError); - uint64_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationPropertyUint64)(char * pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError * peError); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *SetApplicationAutoLaunch)(char * pchAppKey, bool bAutoLaunch); - bool (OPENVR_FNTABLE_CALLTYPE *GetApplicationAutoLaunch)(char * pchAppKey); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *GetStartingApplication)(char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); - EVRApplicationTransitionState (OPENVR_FNTABLE_CALLTYPE *GetTransitionState)(); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *PerformApplicationPrelaunchCheck)(char * pchAppKey); - char * (OPENVR_FNTABLE_CALLTYPE *GetApplicationsTransitionStateNameFromEnum)(EVRApplicationTransitionState state); - bool (OPENVR_FNTABLE_CALLTYPE *IsQuitUserPromptRequested)(); - EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchInternalProcess)(char * pchBinaryPath, char * pchArguments, char * pchWorkingDirectory); -}; - -struct VR_IVRChaperone_FnTable -{ - ChaperoneCalibrationState (OPENVR_FNTABLE_CALLTYPE *GetCalibrationState)(); - bool (OPENVR_FNTABLE_CALLTYPE *GetPlayAreaSize)(float * pSizeX, float * pSizeZ); - bool (OPENVR_FNTABLE_CALLTYPE *GetPlayAreaRect)(struct HmdQuad_t * rect); - void (OPENVR_FNTABLE_CALLTYPE *ReloadInfo)(); - void (OPENVR_FNTABLE_CALLTYPE *SetSceneColor)(struct HmdColor_t color); - void (OPENVR_FNTABLE_CALLTYPE *GetBoundsColor)(struct HmdColor_t * pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, struct HmdColor_t * pOutputCameraColor); - bool (OPENVR_FNTABLE_CALLTYPE *AreBoundsVisible)(); - void (OPENVR_FNTABLE_CALLTYPE *ForceBoundsVisible)(bool bForce); -}; - -struct VR_IVRChaperoneSetup_FnTable -{ - bool (OPENVR_FNTABLE_CALLTYPE *CommitWorkingCopy)(EChaperoneConfigFile configFile); - void (OPENVR_FNTABLE_CALLTYPE *RevertWorkingCopy)(); - bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingPlayAreaSize)(float * pSizeX, float * pSizeZ); - bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingPlayAreaRect)(struct HmdQuad_t * rect); - bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingCollisionBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount); - bool (OPENVR_FNTABLE_CALLTYPE *GetLiveCollisionBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount); - bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingSeatedZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pmatSeatedZeroPoseToRawTrackingPose); - bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingStandingZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pmatStandingZeroPoseToRawTrackingPose); - void (OPENVR_FNTABLE_CALLTYPE *SetWorkingPlayAreaSize)(float sizeX, float sizeZ); - void (OPENVR_FNTABLE_CALLTYPE *SetWorkingCollisionBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t unQuadsCount); - void (OPENVR_FNTABLE_CALLTYPE *SetWorkingSeatedZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pMatSeatedZeroPoseToRawTrackingPose); - void (OPENVR_FNTABLE_CALLTYPE *SetWorkingStandingZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pMatStandingZeroPoseToRawTrackingPose); - void (OPENVR_FNTABLE_CALLTYPE *ReloadFromDisk)(EChaperoneConfigFile configFile); - bool (OPENVR_FNTABLE_CALLTYPE *GetLiveSeatedZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pmatSeatedZeroPoseToRawTrackingPose); - void (OPENVR_FNTABLE_CALLTYPE *SetWorkingCollisionBoundsTagsInfo)(uint8_t * pTagsBuffer, uint32_t unTagCount); - bool (OPENVR_FNTABLE_CALLTYPE *GetLiveCollisionBoundsTagsInfo)(uint8_t * pTagsBuffer, uint32_t * punTagCount); - bool (OPENVR_FNTABLE_CALLTYPE *SetWorkingPhysicalBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t unQuadsCount); - bool (OPENVR_FNTABLE_CALLTYPE *GetLivePhysicalBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount); - bool (OPENVR_FNTABLE_CALLTYPE *ExportLiveToBuffer)(char * pBuffer, uint32_t * pnBufferLength); - bool (OPENVR_FNTABLE_CALLTYPE *ImportFromBufferToWorking)(char * pBuffer, uint32_t nImportFlags); -}; - -struct VR_IVRCompositor_FnTable -{ - void (OPENVR_FNTABLE_CALLTYPE *SetTrackingSpace)(ETrackingUniverseOrigin eOrigin); - ETrackingUniverseOrigin (OPENVR_FNTABLE_CALLTYPE *GetTrackingSpace)(); - EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *WaitGetPoses)(struct TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, struct TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount); - EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetLastPoses)(struct TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, struct TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount); - EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetLastPoseForTrackedDeviceIndex)(TrackedDeviceIndex_t unDeviceIndex, struct TrackedDevicePose_t * pOutputPose, struct TrackedDevicePose_t * pOutputGamePose); - EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *Submit)(EVREye eEye, struct Texture_t * pTexture, struct VRTextureBounds_t * pBounds, EVRSubmitFlags nSubmitFlags); - void (OPENVR_FNTABLE_CALLTYPE *ClearLastSubmittedFrame)(); - void (OPENVR_FNTABLE_CALLTYPE *PostPresentHandoff)(); - bool (OPENVR_FNTABLE_CALLTYPE *GetFrameTiming)(struct Compositor_FrameTiming * pTiming, uint32_t unFramesAgo); - float (OPENVR_FNTABLE_CALLTYPE *GetFrameTimeRemaining)(); - void (OPENVR_FNTABLE_CALLTYPE *FadeToColor)(float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground); - void (OPENVR_FNTABLE_CALLTYPE *FadeGrid)(float fSeconds, bool bFadeIn); - EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *SetSkyboxOverride)(struct Texture_t * pTextures, uint32_t unTextureCount); - void (OPENVR_FNTABLE_CALLTYPE *ClearSkyboxOverride)(); - void (OPENVR_FNTABLE_CALLTYPE *CompositorBringToFront)(); - void (OPENVR_FNTABLE_CALLTYPE *CompositorGoToBack)(); - void (OPENVR_FNTABLE_CALLTYPE *CompositorQuit)(); - bool (OPENVR_FNTABLE_CALLTYPE *IsFullscreen)(); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetCurrentSceneFocusProcess)(); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetLastFrameRenderer)(); - bool (OPENVR_FNTABLE_CALLTYPE *CanRenderScene)(); - void (OPENVR_FNTABLE_CALLTYPE *ShowMirrorWindow)(); - void (OPENVR_FNTABLE_CALLTYPE *HideMirrorWindow)(); - bool (OPENVR_FNTABLE_CALLTYPE *IsMirrorWindowVisible)(); - void (OPENVR_FNTABLE_CALLTYPE *CompositorDumpImages)(); - bool (OPENVR_FNTABLE_CALLTYPE *ShouldAppRenderWithLowResources)(); - void (OPENVR_FNTABLE_CALLTYPE *ForceInterleavedReprojectionOn)(bool bOverride); -}; - -struct VR_IVROverlay_FnTable -{ - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *FindOverlay)(char * pchOverlayKey, VROverlayHandle_t * pOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *CreateOverlay)(char * pchOverlayKey, char * pchOverlayFriendlyName, VROverlayHandle_t * pOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *DestroyOverlay)(VROverlayHandle_t ulOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetHighQualityOverlay)(VROverlayHandle_t ulOverlayHandle); - VROverlayHandle_t (OPENVR_FNTABLE_CALLTYPE *GetHighQualityOverlay)(); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetOverlayKey)(VROverlayHandle_t ulOverlayHandle, char * pchValue, uint32_t unBufferSize, EVROverlayError * pError); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetOverlayName)(VROverlayHandle_t ulOverlayHandle, char * pchValue, uint32_t unBufferSize, EVROverlayError * pError); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayImageData)(VROverlayHandle_t ulOverlayHandle, void * pvBuffer, uint32_t unBufferSize, uint32_t * punWidth, uint32_t * punHeight); - char * (OPENVR_FNTABLE_CALLTYPE *GetOverlayErrorNameFromEnum)(EVROverlayError error); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayRenderingPid)(VROverlayHandle_t ulOverlayHandle, uint32_t unPID); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetOverlayRenderingPid)(VROverlayHandle_t ulOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayFlag)(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayFlag)(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool * pbEnabled); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayColor)(VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayColor)(VROverlayHandle_t ulOverlayHandle, float * pfRed, float * pfGreen, float * pfBlue); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayAlpha)(VROverlayHandle_t ulOverlayHandle, float fAlpha); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayAlpha)(VROverlayHandle_t ulOverlayHandle, float * pfAlpha); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayWidthInMeters)(VROverlayHandle_t ulOverlayHandle, float fWidthInMeters); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayWidthInMeters)(VROverlayHandle_t ulOverlayHandle, float * pfWidthInMeters); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayAutoCurveDistanceRangeInMeters)(VROverlayHandle_t ulOverlayHandle, float fMinDistanceInMeters, float fMaxDistanceInMeters); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayAutoCurveDistanceRangeInMeters)(VROverlayHandle_t ulOverlayHandle, float * pfMinDistanceInMeters, float * pfMaxDistanceInMeters); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTextureColorSpace)(VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTextureColorSpace)(VROverlayHandle_t ulOverlayHandle, EColorSpace * peTextureColorSpace); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTextureBounds)(VROverlayHandle_t ulOverlayHandle, struct VRTextureBounds_t * pOverlayTextureBounds); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTextureBounds)(VROverlayHandle_t ulOverlayHandle, struct VRTextureBounds_t * pOverlayTextureBounds); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformType)(VROverlayHandle_t ulOverlayHandle, VROverlayTransformType * peTransformType); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformAbsolute)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToOverlayTransform); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformAbsolute)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin * peTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToOverlayTransform); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformTrackedDeviceRelative)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, struct HmdMatrix34_t * pmatTrackedDeviceToOverlayTransform); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformTrackedDeviceRelative)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t * punTrackedDevice, struct HmdMatrix34_t * pmatTrackedDeviceToOverlayTransform); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformTrackedDeviceComponent)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, char * pchComponentName); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformTrackedDeviceComponent)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t * punDeviceIndex, char * pchComponentName, uint32_t unComponentNameSize); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ShowOverlay)(VROverlayHandle_t ulOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *HideOverlay)(VROverlayHandle_t ulOverlayHandle); - bool (OPENVR_FNTABLE_CALLTYPE *IsOverlayVisible)(VROverlayHandle_t ulOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetTransformForOverlayCoordinates)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, struct HmdVector2_t coordinatesInOverlay, struct HmdMatrix34_t * pmatTransform); - bool (OPENVR_FNTABLE_CALLTYPE *PollNextOverlayEvent)(VROverlayHandle_t ulOverlayHandle, struct VREvent_t * pEvent, uint32_t uncbVREvent); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayInputMethod)(VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod * peInputMethod); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayInputMethod)(VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayMouseScale)(VROverlayHandle_t ulOverlayHandle, struct HmdVector2_t * pvecMouseScale); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayMouseScale)(VROverlayHandle_t ulOverlayHandle, struct HmdVector2_t * pvecMouseScale); - bool (OPENVR_FNTABLE_CALLTYPE *ComputeOverlayIntersection)(VROverlayHandle_t ulOverlayHandle, struct VROverlayIntersectionParams_t * pParams, struct VROverlayIntersectionResults_t * pResults); - bool (OPENVR_FNTABLE_CALLTYPE *HandleControllerOverlayInteractionAsMouse)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unControllerDeviceIndex); - bool (OPENVR_FNTABLE_CALLTYPE *IsHoverTargetOverlay)(VROverlayHandle_t ulOverlayHandle); - VROverlayHandle_t (OPENVR_FNTABLE_CALLTYPE *GetGamepadFocusOverlay)(); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetGamepadFocusOverlay)(VROverlayHandle_t ulNewFocusOverlay); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayNeighbor)(EOverlayDirection eDirection, VROverlayHandle_t ulFrom, VROverlayHandle_t ulTo); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *MoveGamepadFocusToNeighbor)(EOverlayDirection eDirection, VROverlayHandle_t ulFrom); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTexture)(VROverlayHandle_t ulOverlayHandle, struct Texture_t * pTexture); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ClearOverlayTexture)(VROverlayHandle_t ulOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayRaw)(VROverlayHandle_t ulOverlayHandle, void * pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unDepth); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayFromFile)(VROverlayHandle_t ulOverlayHandle, char * pchFilePath); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTexture)(VROverlayHandle_t ulOverlayHandle, void ** pNativeTextureHandle, void * pNativeTextureRef, uint32_t * pWidth, uint32_t * pHeight, uint32_t * pNativeFormat, EGraphicsAPIConvention * pAPI, EColorSpace * pColorSpace); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ReleaseNativeOverlayHandle)(VROverlayHandle_t ulOverlayHandle, void * pNativeTextureHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *CreateDashboardOverlay)(char * pchOverlayKey, char * pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t * pThumbnailHandle); - bool (OPENVR_FNTABLE_CALLTYPE *IsDashboardVisible)(); - bool (OPENVR_FNTABLE_CALLTYPE *IsActiveDashboardOverlay)(VROverlayHandle_t ulOverlayHandle); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetDashboardOverlaySceneProcess)(VROverlayHandle_t ulOverlayHandle, uint32_t unProcessId); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetDashboardOverlaySceneProcess)(VROverlayHandle_t ulOverlayHandle, uint32_t * punProcessId); - void (OPENVR_FNTABLE_CALLTYPE *ShowDashboard)(char * pchOverlayToShow); - TrackedDeviceIndex_t (OPENVR_FNTABLE_CALLTYPE *GetPrimaryDashboardDevice)(); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ShowKeyboard)(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, char * pchDescription, uint32_t unCharMax, char * pchExistingText, bool bUseMinimalMode, uint64_t uUserValue); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ShowKeyboardForOverlay)(VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, char * pchDescription, uint32_t unCharMax, char * pchExistingText, bool bUseMinimalMode, uint64_t uUserValue); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetKeyboardText)(char * pchText, uint32_t cchText); - void (OPENVR_FNTABLE_CALLTYPE *HideKeyboard)(); - void (OPENVR_FNTABLE_CALLTYPE *SetKeyboardTransformAbsolute)(ETrackingUniverseOrigin eTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToKeyboardTransform); - void (OPENVR_FNTABLE_CALLTYPE *SetKeyboardPositionForOverlay)(VROverlayHandle_t ulOverlayHandle, struct HmdRect2_t avoidRect); -}; - -struct VR_IVRRenderModels_FnTable -{ - EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadRenderModel_Async)(char * pchRenderModelName, struct RenderModel_t ** ppRenderModel); - void (OPENVR_FNTABLE_CALLTYPE *FreeRenderModel)(struct RenderModel_t * pRenderModel); - EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadTexture_Async)(TextureID_t textureId, struct RenderModel_TextureMap_t ** ppTexture); - void (OPENVR_FNTABLE_CALLTYPE *FreeTexture)(struct RenderModel_TextureMap_t * pTexture); - EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadTextureD3D11_Async)(TextureID_t textureId, void * pD3D11Device, void ** ppD3D11Texture2D); - EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadIntoTextureD3D11_Async)(TextureID_t textureId, void * pDstTexture); - void (OPENVR_FNTABLE_CALLTYPE *FreeTextureD3D11)(void * pD3D11Texture2D); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelName)(uint32_t unRenderModelIndex, char * pchRenderModelName, uint32_t unRenderModelNameLen); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelCount)(); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentCount)(char * pchRenderModelName); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentName)(char * pchRenderModelName, uint32_t unComponentIndex, char * pchComponentName, uint32_t unComponentNameLen); - uint64_t (OPENVR_FNTABLE_CALLTYPE *GetComponentButtonMask)(char * pchRenderModelName, char * pchComponentName); - uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentRenderModelName)(char * pchRenderModelName, char * pchComponentName, char * pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen); - bool (OPENVR_FNTABLE_CALLTYPE *GetComponentState)(char * pchRenderModelName, char * pchComponentName, VRControllerState_t * pControllerState, struct RenderModel_ControllerMode_State_t * pState, struct RenderModel_ComponentState_t * pComponentState); - bool (OPENVR_FNTABLE_CALLTYPE *RenderModelHasComponent)(char * pchRenderModelName, char * pchComponentName); -}; - -struct VR_IVRNotifications_FnTable -{ - EVRNotificationError (OPENVR_FNTABLE_CALLTYPE *CreateNotification)(VROverlayHandle_t ulOverlayHandle, uint64_t ulUserValue, EVRNotificationType type, char * pchText, EVRNotificationStyle style, struct NotificationBitmap_t * pImage, VRNotificationId * pNotificationId); - EVRNotificationError (OPENVR_FNTABLE_CALLTYPE *RemoveNotification)(VRNotificationId notificationId); -}; - -struct VR_IVRSettings_FnTable -{ - char * (OPENVR_FNTABLE_CALLTYPE *GetSettingsErrorNameFromEnum)(EVRSettingsError eError); - bool (OPENVR_FNTABLE_CALLTYPE *Sync)(bool bForce, EVRSettingsError * peError); - bool (OPENVR_FNTABLE_CALLTYPE *GetBool)(char * pchSection, char * pchSettingsKey, bool bDefaultValue, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *SetBool)(char * pchSection, char * pchSettingsKey, bool bValue, EVRSettingsError * peError); - int32_t (OPENVR_FNTABLE_CALLTYPE *GetInt32)(char * pchSection, char * pchSettingsKey, int32_t nDefaultValue, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *SetInt32)(char * pchSection, char * pchSettingsKey, int32_t nValue, EVRSettingsError * peError); - float (OPENVR_FNTABLE_CALLTYPE *GetFloat)(char * pchSection, char * pchSettingsKey, float flDefaultValue, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *SetFloat)(char * pchSection, char * pchSettingsKey, float flValue, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *GetString)(char * pchSection, char * pchSettingsKey, char * pchValue, uint32_t unValueLen, char * pchDefaultValue, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *SetString)(char * pchSection, char * pchSettingsKey, char * pchValue, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *RemoveSection)(char * pchSection, EVRSettingsError * peError); - void (OPENVR_FNTABLE_CALLTYPE *RemoveKeyInSection)(char * pchSection, char * pchSettingsKey, EVRSettingsError * peError); -}; - - -#if 0 -// Global entry points -S_API intptr_t VR_InitInternal( EVRInitError *peError, EVRApplicationType eType ); -S_API void VR_ShutdownInternal(); -S_API bool VR_IsHmdPresent(); -S_API intptr_t VR_GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError ); -S_API bool VR_IsRuntimeInstalled(); -S_API const char * VR_GetVRInitErrorAsSymbol( EVRInitError error ); -S_API const char * VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ); -#endif - -#endif // __OPENVR_API_FLAT_H__ - - diff --git a/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h b/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h index 43a1809930d..c2c76f6d9f3 100644 --- a/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h +++ b/3rdparty/bgfx/3rdparty/renderdoc/renderdoc_app.h @@ -1,7 +1,7 @@ /****************************************************************************** * The MIT License (MIT) * - * Copyright (c) 2015-2017 Baldur Karlsson + * Copyright (c) 2015-2018 Baldur Karlsson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -94,7 +94,7 @@ typedef enum { // Default - disabled // // 1 - Enable built-in API debugging features and records the results into - // the capture logfile, which is matched up with events on replay + // the capture, which is matched up with events on replay // 0 - no API debugging is forcibly enabled eRENDERDOC_Option_APIValidation = 2, eRENDERDOC_Option_DebugDeviceMode = 2, // deprecated name of this enum @@ -145,12 +145,12 @@ typedef enum { // 0 - Child processes are not hooked by RenderDoc eRENDERDOC_Option_HookIntoChildren = 7, - // By default RenderDoc only includes resources in the final logfile necessary + // By default RenderDoc only includes resources in the final capture necessary // for that frame, this allows you to override that behaviour. // // Default - disabled // - // 1 - all live resources at the time of capture are included in the log + // 1 - all live resources at the time of capture are included in the capture // and available for inspection // 0 - only the resources referenced by the captured frame are included eRENDERDOC_Option_RefAllResources = 8, @@ -342,9 +342,9 @@ typedef void(RENDERDOC_CC *pRENDERDOC_Shutdown)(); // exceptions will pass to the next handler. typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)(); -// Sets the logfile path template +// Sets the capture file path template // -// logfile is a UTF-8 string that gives a template for how captures will be named +// pathtemplate is a UTF-8 string that gives a template for how captures will be named // and where they will be saved. // // Any extension is stripped off the path, and captures are saved in the directory @@ -355,13 +355,17 @@ typedef void(RENDERDOC_CC *pRENDERDOC_UnloadCrashHandler)(); // // Example: // -// SetLogFilePathTemplate("my_captures/example"); +// SetCaptureFilePathTemplate("my_captures/example"); // // Capture #1 -> my_captures/example_frame123.rdc // Capture #2 -> my_captures/example_frame456.rdc -typedef void(RENDERDOC_CC *pRENDERDOC_SetLogFilePathTemplate)(const char *pathtemplate); +typedef void(RENDERDOC_CC *pRENDERDOC_SetCaptureFilePathTemplate)(const char *pathtemplate); -// returns the current logfile template, see SetLogFileTemplate above, as a UTF-8 string +// returns the current capture path template, see SetCaptureFileTemplate above, as a UTF-8 string +typedef const char *(RENDERDOC_CC *pRENDERDOC_GetCaptureFilePathTemplate)(); + +// DEPRECATED: compatibility for code compiled against pre-1.1.2 headers. +typedef void(RENDERDOC_CC *pRENDERDOC_SetLogFilePathTemplate)(const char *pathtemplate); typedef const char *(RENDERDOC_CC *pRENDERDOC_GetLogFilePathTemplate)(); // returns the number of captures that have been made @@ -370,8 +374,8 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)(); // This function returns the details of a capture, by index. New captures are added // to the end of the list. // -// logfile will be filled with the absolute path to the capture file, as a UTF-8 string -// pathlength will be written with the length in bytes of the logfile string +// filename will be filled with the absolute path to the capture file, as a UTF-8 string +// pathlength will be written with the length in bytes of the filename string // timestamp will be written with the time of the capture, in seconds since the Unix epoch // // Any of the parameters can be NULL and they'll be skipped. @@ -380,16 +384,18 @@ typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetNumCaptures)(); // If the index is invalid, the values will be unchanged // // Note: when captures are deleted in the UI they will remain in this list, so the -// logfile path may not exist anymore. -typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *logfile, +// capture path may not exist anymore. +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_GetCapture)(uint32_t idx, char *filename, uint32_t *pathlength, uint64_t *timestamp); // returns 1 if the RenderDoc UI is connected to this application, 0 otherwise +typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); + +// DEPRECATED: compatibility for code compiled against pre-1.1.1 headers. // This was renamed to IsTargetControlConnected in API 1.1.1, the old typedef is kept here for // backwards compatibility with old code, it is castable either way since it's ABI compatible // as the same function pointer type. typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsRemoteAccessConnected)(); -typedef uint32_t(RENDERDOC_CC *pRENDERDOC_IsTargetControlConnected)(); // This function will launch the Replay UI associated with the RenderDoc library injected // into the running application. @@ -422,6 +428,15 @@ typedef void *RENDERDOC_DevicePointer; // This would be an HWND, GLXDrawable, etc typedef void *RENDERDOC_WindowHandle; +// A helper macro for Vulkan, where the device handle cannot be used directly. +// +// Passing the VkInstance to this macro will return the RENDERDOC_DevicePointer to use. +// +// Specifically, the value needed is the dispatch table pointer, which sits as the first +// pointer-sized object in the memory pointed to by the VkInstance. Thus we cast to a void** and +// indirect once. +#define RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(inst) (*((void **)(inst))) + // This sets the RenderDoc in-app overlay in the API/window pair as 'active' and it will // respond to keypresses. Neither parameter can be NULL typedef void(RENDERDOC_CC *pRENDERDOC_SetActiveWindow)(RENDERDOC_DevicePointer device, @@ -484,6 +499,7 @@ typedef enum { eRENDERDOC_API_Version_1_0_2 = 10002, // RENDERDOC_API_1_0_2 = 1 00 02 eRENDERDOC_API_Version_1_1_0 = 10100, // RENDERDOC_API_1_1_0 = 1 01 00 eRENDERDOC_API_Version_1_1_1 = 10101, // RENDERDOC_API_1_1_1 = 1 01 01 + eRENDERDOC_API_Version_1_1_2 = 10102, // RENDERDOC_API_1_1_2 = 1 01 02 } RENDERDOC_Version; // API version changelog: @@ -496,6 +512,9 @@ typedef enum { // function pointer is added to the end of the struct, the original layout is identical // 1.1.1 - Refactor: Renamed remote access to target control (to better disambiguate from remote // replay/remote server concept in replay UI) +// 1.1.2 - Refactor: Renamed "log file" in function names to just capture, to clarify that these +// are captures and not debug logging files. This is the first API version in the v1.0 +// branch. // eRENDERDOC_API_Version_1_1_0 typedef struct @@ -588,6 +607,50 @@ typedef struct pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture; } RENDERDOC_API_1_1_1; +// similarly to above, we renamed Get/SetLogFilePathTemplate to Get/SetCaptureFilePathTemplate. +// We thus declare a new struct so that code that was referencing the RENDERDOC_API_1_1_1 struct +// can still compile without changes, but new code will use the new struct members + +// eRENDERDOC_API_Version_1_1_2 +typedef struct +{ + pRENDERDOC_GetAPIVersion GetAPIVersion; + + pRENDERDOC_SetCaptureOptionU32 SetCaptureOptionU32; + pRENDERDOC_SetCaptureOptionF32 SetCaptureOptionF32; + + pRENDERDOC_GetCaptureOptionU32 GetCaptureOptionU32; + pRENDERDOC_GetCaptureOptionF32 GetCaptureOptionF32; + + pRENDERDOC_SetFocusToggleKeys SetFocusToggleKeys; + pRENDERDOC_SetCaptureKeys SetCaptureKeys; + + pRENDERDOC_GetOverlayBits GetOverlayBits; + pRENDERDOC_MaskOverlayBits MaskOverlayBits; + + pRENDERDOC_Shutdown Shutdown; + pRENDERDOC_UnloadCrashHandler UnloadCrashHandler; + + pRENDERDOC_SetCaptureFilePathTemplate SetCaptureFilePathTemplate; + pRENDERDOC_GetCaptureFilePathTemplate GetCaptureFilePathTemplate; + + pRENDERDOC_GetNumCaptures GetNumCaptures; + pRENDERDOC_GetCapture GetCapture; + + pRENDERDOC_TriggerCapture TriggerCapture; + + pRENDERDOC_IsTargetControlConnected IsTargetControlConnected; + pRENDERDOC_LaunchReplayUI LaunchReplayUI; + + pRENDERDOC_SetActiveWindow SetActiveWindow; + + pRENDERDOC_StartFrameCapture StartFrameCapture; + pRENDERDOC_IsFrameCapturing IsFrameCapturing; + pRENDERDOC_EndFrameCapture EndFrameCapture; + + pRENDERDOC_TriggerMultiFrameCapture TriggerMultiFrameCapture; +} RENDERDOC_API_1_1_2; + ////////////////////////////////////////////////////////////////////////////////////////////////// // RenderDoc API entry point // diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/Android.mk b/3rdparty/bgfx/3rdparty/spirv-tools/Android.mk new file mode 100644 index 00000000000..cc336a892ac --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/Android.mk @@ -0,0 +1,331 @@ +LOCAL_PATH := $(call my-dir) +SPVTOOLS_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT))) +SPVHEADERS_LOCAL_PATH := $(LOCAL_PATH)/external/spirv-headers + +SPVTOOLS_SRC_FILES := \ + source/assembly_grammar.cpp \ + source/binary.cpp \ + source/diagnostic.cpp \ + source/disassemble.cpp \ + source/ext_inst.cpp \ + source/enum_string_mapping.cpp \ + source/extensions.cpp \ + source/id_descriptor.cpp \ + source/libspirv.cpp \ + source/name_mapper.cpp \ + source/opcode.cpp \ + source/operand.cpp \ + source/parsed_operand.cpp \ + source/print.cpp \ + source/software_version.cpp \ + source/spirv_endian.cpp \ + source/spirv_target_env.cpp \ + source/spirv_validator_options.cpp \ + source/table.cpp \ + source/text.cpp \ + source/text_handler.cpp \ + source/util/bit_vector.cpp \ + source/util/parse_number.cpp \ + source/util/string_utils.cpp \ + source/util/timer.cpp \ + source/val/basic_block.cpp \ + source/val/construct.cpp \ + source/val/function.cpp \ + source/val/instruction.cpp \ + source/val/validation_state.cpp \ + source/val/validate.cpp \ + source/val/validate_adjacency.cpp \ + source/val/validate_annotation.cpp \ + source/val/validate_arithmetics.cpp \ + source/val/validate_atomics.cpp \ + source/val/validate_barriers.cpp \ + source/val/validate_bitwise.cpp \ + source/val/validate_builtins.cpp \ + source/val/validate_capability.cpp \ + source/val/validate_cfg.cpp \ + source/val/validate_composites.cpp \ + source/val/validate_constants.cpp \ + source/val/validate_conversion.cpp \ + source/val/validate_datarules.cpp \ + source/val/validate_debug.cpp \ + source/val/validate_decorations.cpp \ + source/val/validate_derivatives.cpp \ + source/val/validate_ext_inst.cpp \ + source/val/validate_execution_limitations.cpp \ + source/val/validate_function.cpp \ + source/val/validate_id.cpp \ + source/val/validate_image.cpp \ + source/val/validate_interfaces.cpp \ + source/val/validate_instruction.cpp \ + source/val/validate_memory.cpp \ + source/val/validate_mode_setting.cpp \ + source/val/validate_layout.cpp \ + source/val/validate_literals.cpp \ + source/val/validate_logicals.cpp \ + source/val/validate_non_uniform.cpp \ + source/val/validate_primitives.cpp \ + source/val/validate_type.cpp + +SPVTOOLS_OPT_SRC_FILES := \ + source/opt/aggressive_dead_code_elim_pass.cpp \ + source/opt/basic_block.cpp \ + source/opt/block_merge_pass.cpp \ + source/opt/build_module.cpp \ + source/opt/cfg.cpp \ + source/opt/cfg_cleanup_pass.cpp \ + source/opt/ccp_pass.cpp \ + source/opt/combine_access_chains.cpp \ + source/opt/common_uniform_elim_pass.cpp \ + source/opt/compact_ids_pass.cpp \ + source/opt/composite.cpp \ + source/opt/const_folding_rules.cpp \ + source/opt/constants.cpp \ + source/opt/copy_prop_arrays.cpp \ + source/opt/dead_branch_elim_pass.cpp \ + source/opt/dead_insert_elim_pass.cpp \ + source/opt/dead_variable_elimination.cpp \ + source/opt/decoration_manager.cpp \ + source/opt/def_use_manager.cpp \ + source/opt/dominator_analysis.cpp \ + source/opt/dominator_tree.cpp \ + source/opt/eliminate_dead_constant_pass.cpp \ + source/opt/eliminate_dead_functions_pass.cpp \ + source/opt/feature_manager.cpp \ + source/opt/flatten_decoration_pass.cpp \ + source/opt/fold.cpp \ + source/opt/folding_rules.cpp \ + source/opt/fold_spec_constant_op_and_composite_pass.cpp \ + source/opt/freeze_spec_constant_value_pass.cpp \ + source/opt/function.cpp \ + source/opt/if_conversion.cpp \ + source/opt/inline_pass.cpp \ + source/opt/inline_exhaustive_pass.cpp \ + source/opt/inline_opaque_pass.cpp \ + source/opt/instruction.cpp \ + source/opt/instruction_list.cpp \ + source/opt/ir_context.cpp \ + source/opt/ir_loader.cpp \ + source/opt/licm_pass.cpp \ + source/opt/local_access_chain_convert_pass.cpp \ + source/opt/local_redundancy_elimination.cpp \ + source/opt/local_single_block_elim_pass.cpp \ + source/opt/local_single_store_elim_pass.cpp \ + source/opt/local_ssa_elim_pass.cpp \ + source/opt/loop_dependence.cpp \ + source/opt/loop_dependence_helpers.cpp \ + source/opt/loop_descriptor.cpp \ + source/opt/loop_fission.cpp \ + source/opt/loop_fusion.cpp \ + source/opt/loop_fusion_pass.cpp \ + source/opt/loop_peeling.cpp \ + source/opt/loop_unroller.cpp \ + source/opt/loop_unswitch_pass.cpp \ + source/opt/loop_utils.cpp \ + source/opt/mem_pass.cpp \ + source/opt/merge_return_pass.cpp \ + source/opt/module.cpp \ + source/opt/optimizer.cpp \ + source/opt/pass.cpp \ + source/opt/pass_manager.cpp \ + source/opt/private_to_local_pass.cpp \ + source/opt/propagator.cpp \ + source/opt/reduce_load_size.cpp \ + source/opt/redundancy_elimination.cpp \ + source/opt/register_pressure.cpp \ + source/opt/remove_duplicates_pass.cpp \ + source/opt/replace_invalid_opc.cpp \ + source/opt/scalar_analysis.cpp \ + source/opt/scalar_analysis_simplification.cpp \ + source/opt/scalar_replacement_pass.cpp \ + source/opt/set_spec_constant_default_value_pass.cpp \ + source/opt/simplification_pass.cpp \ + source/opt/ssa_rewrite_pass.cpp \ + source/opt/strength_reduction_pass.cpp \ + source/opt/strip_debug_info_pass.cpp \ + source/opt/strip_reflect_info_pass.cpp \ + source/opt/type_manager.cpp \ + source/opt/types.cpp \ + source/opt/unify_const_pass.cpp \ + source/opt/value_number_table.cpp \ + source/opt/vector_dce.cpp \ + source/opt/workaround1209.cpp + +# Locations of grammar files. +# +# TODO(dneto): Build a single set of tables that embeds versioning differences on +# a per-item basis. That must happen before SPIR-V 1.4, etc. +# https://github.com/KhronosGroup/SPIRV-Tools/issues/1195 +SPV_CORE10_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.0/spirv.core.grammar.json +SPV_CORE11_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.1/spirv.core.grammar.json +SPV_CORE12_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/spirv.core.grammar.json +SPV_COREUNIFIED1_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/unified1/spirv.core.grammar.json +SPV_CORELATEST_GRAMMAR=$(SPV_COREUNIFIED1_GRAMMAR) +SPV_GLSL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.glsl.std.450.grammar.json +SPV_OPENCL_GRAMMAR=$(SPVHEADERS_LOCAL_PATH)/include/spirv/1.2/extinst.opencl.std.100.grammar.json +# TODO(dneto): I expect the DebugInfo grammar file to eventually migrate to SPIRV-Headers +SPV_DEBUGINFO_GRAMMAR=$(LOCAL_PATH)/source/extinst.debuginfo.grammar.json + +define gen_spvtools_grammar_tables +$(call generate-file-dir,$(1)/core.insts-1.0.inc) +$(1)/core.insts-1.0.inc $(1)/operand.kinds-1.0.inc $(1)/glsl.std.450.insts.inc $(1)/opencl.std.insts.inc: \ + $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + $(SPV_CORE10_GRAMMAR) \ + $(SPV_GLSL_GRAMMAR) \ + $(SPV_OPENCL_GRAMMAR) \ + $(SPV_DEBUGINFO_GRAMMAR) + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + --spirv-core-grammar=$(SPV_CORE10_GRAMMAR) \ + --extinst-glsl-grammar=$(SPV_GLSL_GRAMMAR) \ + --extinst-opencl-grammar=$(SPV_OPENCL_GRAMMAR) \ + --extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \ + --core-insts-output=$(1)/core.insts-1.0.inc \ + --glsl-insts-output=$(1)/glsl.std.450.insts.inc \ + --opencl-insts-output=$(1)/opencl.std.insts.inc \ + --operand-kinds-output=$(1)/operand.kinds-1.0.inc + @echo "[$(TARGET_ARCH_ABI)] Grammar v1.0 : instructions & operands <= grammar JSON files" +$(1)/core.insts-1.1.inc $(1)/operand.kinds-1.1.inc: \ + $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + $(SPV_CORE11_GRAMMAR) \ + $(SPV_DEBUGINFO_GRAMMAR) + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + --spirv-core-grammar=$(SPV_CORE11_GRAMMAR) \ + --extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \ + --core-insts-output=$(1)/core.insts-1.1.inc \ + --operand-kinds-output=$(1)/operand.kinds-1.1.inc + @echo "[$(TARGET_ARCH_ABI)] Grammar v1.1 : instructions & operands <= grammar JSON files" +$(1)/core.insts-1.2.inc $(1)/operand.kinds-1.2.inc: \ + $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + $(SPV_CORE12_GRAMMAR) \ + $(SPV_DEBUGINFO_GRAMMAR) + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + --spirv-core-grammar=$(SPV_CORE12_GRAMMAR) \ + --extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \ + --core-insts-output=$(1)/core.insts-1.2.inc \ + --operand-kinds-output=$(1)/operand.kinds-1.2.inc + @echo "[$(TARGET_ARCH_ABI)] Grammar v1.2 : instructions & operands <= grammar JSON files" +$(1)/core.insts-unified1.inc $(1)/operand.kinds-unified1.inc: \ + $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + $(SPV_COREUNIFIED1_GRAMMAR) \ + $(SPV_DEBUGINFO_GRAMMAR) + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + --spirv-core-grammar=$(SPV_COREUNIFIED1_GRAMMAR) \ + --extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \ + --core-insts-output=$(1)/core.insts-unified1.inc \ + --operand-kinds-output=$(1)/operand.kinds-unified1.inc + @echo "[$(TARGET_ARCH_ABI)] Grammar v1.3 (from unified1) : instructions & operands <= grammar JSON files" +$(LOCAL_PATH)/source/opcode.cpp: $(1)/core.insts-1.0.inc $(1)/core.insts-1.1.inc $(1)/core.insts-1.2.inc $(1)/core.insts-unified1.inc +$(LOCAL_PATH)/source/operand.cpp: $(1)/operand.kinds-1.0.inc $(1)/operand.kinds-1.1.inc $(1)/operand.kinds-1.2.inc $(1)/operand.kinds-unified1.inc +$(LOCAL_PATH)/source/ext_inst.cpp: \ + $(1)/glsl.std.450.insts.inc \ + $(1)/opencl.std.insts.inc \ + $(1)/debuginfo.insts.inc \ + $(1)/spv-amd-gcn-shader.insts.inc \ + $(1)/spv-amd-shader-ballot.insts.inc \ + $(1)/spv-amd-shader-explicit-vertex-parameter.insts.inc \ + $(1)/spv-amd-shader-trinary-minmax.insts.inc +endef +$(eval $(call gen_spvtools_grammar_tables,$(SPVTOOLS_OUT_PATH))) + + +define gen_spvtools_lang_headers +# Generate language-specific headers. So far we only generate C headers +# $1 is the output directory. +# $2 is the base name of the header file, e.g. "DebugInfo". +# $3 is the grammar file containing token definitions. +$(call generate-file-dir,$(1)/$(2).h) +$(1)/$(2).h : \ + $(LOCAL_PATH)/utils/generate_language_headers.py \ + $(3) + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_language_headers.py \ + --extinst-name=$(2) \ + --extinst-grammar=$(3) \ + --extinst-output-base=$(1)/$(2) + @echo "[$(TARGET_ARCH_ABI)] Generate language specific header for $(2): headers <= grammar" +$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/$(2).h +endef +# We generate language-specific headers for DebugInfo +$(eval $(call gen_spvtools_lang_headers,$(SPVTOOLS_OUT_PATH),DebugInfo,$(SPV_DEBUGINFO_GRAMMAR))) + + +define gen_spvtools_vendor_tables +$(call generate-file-dir,$(1)/$(2).insts.inc) +$(1)/$(2).insts.inc : \ + $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + $(LOCAL_PATH)/source/extinst.$(2).grammar.json + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + --extinst-vendor-grammar=$(LOCAL_PATH)/source/extinst.$(2).grammar.json \ + --vendor-insts-output=$(1)/$(2).insts.inc + @echo "[$(TARGET_ARCH_ABI)] Vendor extended instruction set: $(2) tables <= grammar" +$(LOCAL_PATH)/source/ext_inst.cpp: $(1)/$(2).insts.inc +endef +# Vendor extended instruction sets, with grammars from SPIRV-Tools source tree. +SPV_NONSTANDARD_EXTINST_GRAMMARS=$(foreach F,$(wildcard $(LOCAL_PATH)/source/extinst.*.grammar.json),$(patsubst extinst.%.grammar.json,%,$(notdir $F))) +$(foreach E,$(SPV_NONSTANDARD_EXTINST_GRAMMARS),$(eval $(call gen_spvtools_vendor_tables,$(SPVTOOLS_OUT_PATH),$E))) + +define gen_spvtools_enum_string_mapping +$(call generate-file-dir,$(1)/extension_enum.inc.inc) +$(1)/extension_enum.inc $(1)/enum_string_mapping.inc: \ + $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + $(SPV_CORELATEST_GRAMMAR) + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_grammar_tables.py \ + --spirv-core-grammar=$(SPV_CORELATEST_GRAMMAR) \ + --extinst-debuginfo-grammar=$(SPV_DEBUGINFO_GRAMMAR) \ + --extension-enum-output=$(1)/extension_enum.inc \ + --enum-string-mapping-output=$(1)/enum_string_mapping.inc + @echo "[$(TARGET_ARCH_ABI)] Generate enum<->string mapping <= grammar JSON files" +# Generated header extension_enum.inc is transitively included by table.h, which is +# used pervasively. Capture the pervasive dependency. +$(foreach F,$(SPVTOOLS_SRC_FILES) $(SPVTOOLS_OPT_SRC_FILES),$(LOCAL_PATH)/$F ) \ + : $(1)/extension_enum.inc +$(LOCAL_PATH)/source/enum_string_mapping.cpp: $(1)/enum_string_mapping.inc +endef +$(eval $(call gen_spvtools_enum_string_mapping,$(SPVTOOLS_OUT_PATH))) + +define gen_spvtools_build_version_inc +$(call generate-file-dir,$(1)/dummy_filename) +$(1)/build-version.inc: \ + $(LOCAL_PATH)/utils/update_build_version.py \ + $(LOCAL_PATH)/CHANGES + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/update_build_version.py \ + $(LOCAL_PATH) $(1)/build-version.inc + @echo "[$(TARGET_ARCH_ABI)] Generate : build-version.inc <= CHANGES" +$(LOCAL_PATH)/source/software_version.cpp: $(1)/build-version.inc +endef +$(eval $(call gen_spvtools_build_version_inc,$(SPVTOOLS_OUT_PATH))) + +define gen_spvtools_generators_inc +$(call generate-file-dir,$(1)/dummy_filename) +$(1)/generators.inc: \ + $(LOCAL_PATH)/utils/generate_registry_tables.py \ + $(SPVHEADERS_LOCAL_PATH)/include/spirv/spir-v.xml + @$(HOST_PYTHON) $(LOCAL_PATH)/utils/generate_registry_tables.py \ + --xml=$(SPVHEADERS_LOCAL_PATH)/include/spirv/spir-v.xml \ + --generator-output=$(1)/generators.inc + @echo "[$(TARGET_ARCH_ABI)] Generate : generators.inc <= spir-v.xml" +$(LOCAL_PATH)/source/opcode.cpp: $(1)/generators.inc +endef +$(eval $(call gen_spvtools_generators_inc,$(SPVTOOLS_OUT_PATH))) + +include $(CLEAR_VARS) +LOCAL_MODULE := SPIRV-Tools +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/include \ + $(LOCAL_PATH)/external/spirv-headers/include \ + $(SPVTOOLS_OUT_PATH) +LOCAL_EXPORT_C_INCLUDES := \ + $(LOCAL_PATH)/include +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror +LOCAL_SRC_FILES:= $(SPVTOOLS_SRC_FILES) +include $(BUILD_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := SPIRV-Tools-opt +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/include \ + $(LOCAL_PATH)/source \ + $(LOCAL_PATH)/external/spirv-headers/include \ + $(SPVTOOLS_OUT_PATH) +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror +LOCAL_STATIC_LIBRARIES:=SPIRV-Tools +LOCAL_SRC_FILES:= $(SPVTOOLS_OPT_SRC_FILES) +include $(BUILD_STATIC_LIBRARY) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/BUILD.gn b/3rdparty/bgfx/3rdparty/spirv-tools/BUILD.gn new file mode 100644 index 00000000000..9fa9493df53 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/BUILD.gn @@ -0,0 +1,756 @@ +# Copyright 2018 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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/spirv_tools.gni") + +import("//testing/test.gni") +import("//build_overrides/build.gni") + +spirv_headers = spirv_tools_spirv_headers_dir + +template("spvtools_core_tables") { + assert(defined(invoker.version), "Need version in $target_name generation.") + + action("spvtools_core_tables_" + target_name) { + script = "utils/generate_grammar_tables.py" + + version = invoker.version + + core_json_file = + "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" + core_insts_file = "${target_gen_dir}/core.insts-$version.inc" + operand_kinds_file = "${target_gen_dir}/operand.kinds-$version.inc" + extinst_file = "source/extinst.debuginfo.grammar.json" + + sources = [ + core_json_file, + ] + outputs = [ + core_insts_file, + operand_kinds_file, + ] + args = [ + "--spirv-core-grammar", + rebase_path(core_json_file, root_build_dir), + "--core-insts-output", + rebase_path(core_insts_file, root_build_dir), + "--extinst-debuginfo-grammar", + rebase_path(extinst_file, root_build_dir), + "--operand-kinds-output", + rebase_path(operand_kinds_file, root_build_dir), + ] + } +} + +template("spvtools_core_enums") { + assert(defined(invoker.version), "Need version in $target_name generation.") + + action("spvtools_core_enums_" + target_name) { + script = "utils/generate_grammar_tables.py" + + version = invoker.version + + core_json_file = + "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" + debug_insts_file = "source/extinst.debuginfo.grammar.json" + extension_enum_file = "${target_gen_dir}/extension_enum.inc" + extension_map_file = "${target_gen_dir}/enum_string_mapping.inc" + + args = [ + "--spirv-core-grammar", + rebase_path(core_json_file, root_build_dir), + "--extinst-debuginfo-grammar", + rebase_path(debug_insts_file, root_build_dir), + "--extension-enum-output", + rebase_path(extension_enum_file, root_build_dir), + "--enum-string-mapping-output", + rebase_path(extension_map_file, root_build_dir), + ] + inputs = [ + core_json_file, + ] + outputs = [ + extension_enum_file, + extension_map_file, + ] + } +} + +template("spvtools_glsl_tables") { + assert(defined(invoker.version), "Need version in $target_name generation.") + + action("spvtools_glsl_tables_" + target_name) { + script = "utils/generate_grammar_tables.py" + + version = invoker.version + + core_json_file = + "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" + glsl_json_file = "${spirv_headers}/include/spirv/${version}/extinst.glsl.std.450.grammar.json" + glsl_insts_file = "${target_gen_dir}/glsl.std.450.insts.inc" + debug_insts_file = "source/extinst.debuginfo.grammar.json" + + args = [ + "--spirv-core-grammar", + rebase_path(core_json_file, root_build_dir), + "--extinst-glsl-grammar", + rebase_path(glsl_json_file, root_build_dir), + "--glsl-insts-output", + rebase_path(glsl_insts_file, root_build_dir), + "--extinst-debuginfo-grammar", + rebase_path(debug_insts_file, root_build_dir), + ] + inputs = [ + core_json_file, + glsl_json_file, + ] + outputs = [ + glsl_insts_file, + ] + } +} + +template("spvtools_opencl_tables") { + assert(defined(invoker.version), "Need version in $target_name generation.") + + action("spvtools_opencl_tables_" + target_name) { + script = "utils/generate_grammar_tables.py" + + version = invoker.version + + core_json_file = + "${spirv_headers}/include/spirv/$version/spirv.core.grammar.json" + opengl_json_file = "${spirv_headers}/include/spirv/${version}/extinst.opencl.std.100.grammar.json" + opencl_insts_file = "${target_gen_dir}/opencl.std.insts.inc" + debug_insts_file = "source/extinst.debuginfo.grammar.json" + + args = [ + "--spirv-core-grammar", + rebase_path(core_json_file, root_build_dir), + "--extinst-opencl-grammar", + rebase_path(opengl_json_file, root_build_dir), + "--opencl-insts-output", + rebase_path(opencl_insts_file, root_build_dir), + "--extinst-debuginfo-grammar", + rebase_path(debug_insts_file, root_build_dir), + ] + inputs = [ + core_json_file, + opengl_json_file, + ] + outputs = [ + opencl_insts_file, + ] + } +} + +template("spvtools_language_header") { + assert(defined(invoker.name), "Need name in $target_name generation.") + + action("spvtools_language_header_" + target_name) { + script = "utils/generate_language_headers.py" + + name = invoker.name + extinst_output_base = "${target_gen_dir}/${name}" + debug_insts_file = "source/extinst.debuginfo.grammar.json" + + args = [ + "--extinst-name", + "${name}", + "--extinst-grammar", + rebase_path(debug_insts_file, root_build_dir), + "--extinst-output-base", + rebase_path(extinst_output_base, root_build_dir), + ] + inputs = [ + debug_insts_file, + ] + outputs = [ + "${extinst_output_base}.h", + ] + } +} + +template("spvtools_vendor_table") { + assert(defined(invoker.name), "Need name in $target_name generation.") + + action("spvtools_vendor_tables_" + target_name) { + script = "utils/generate_grammar_tables.py" + + name = invoker.name + extinst_vendor_grammar = "source/extinst.${name}.grammar.json" + extinst_file = "${target_gen_dir}/${name}.insts.inc" + + args = [ + "--extinst-vendor-grammar", + rebase_path(extinst_vendor_grammar, root_build_dir), + "--vendor-insts-output", + rebase_path(extinst_file, root_build_dir), + ] + inputs = [ + extinst_vendor_grammar, + ] + outputs = [ + extinst_file, + ] + } +} + +action("spvtools_generators_inc") { + script = "utils/generate_registry_tables.py" + + # TODO(dsinclair): Make work for chrome + xml_file = "${spirv_headers}/include/spirv/spir-v.xml" + inc_file = "${target_gen_dir}/generators.inc" + + sources = [ + xml_file, + ] + outputs = [ + inc_file, + ] + args = [ + "--xml", + rebase_path(xml_file, root_build_dir), + "--generator", + rebase_path(inc_file, root_build_dir), + ] +} + +action("spvtools_build_version") { + script = "utils/update_build_version.py" + + src_dir = "." + inc_file = "${target_gen_dir}/build-version.inc" + + outputs = [ + inc_file, + ] + args = [ + rebase_path(src_dir, root_build_dir), + rebase_path(inc_file, root_build_dir), + ] +} + +spvtools_core_tables("unified1") { + version = "unified1" +} +spvtools_core_enums("unified1") { + version = "unified1" +} +spvtools_glsl_tables("glsl1-0") { + version = "1.0" +} +spvtools_opencl_tables("opencl1-0") { + version = "1.0" +} +spvtools_language_header("unified1") { + name = "DebugInfo" +} + +spvtools_vendor_tables = [ + "spv-amd-shader-explicit-vertex-parameter", + "spv-amd-shader-trinary-minmax", + "spv-amd-gcn-shader", + "spv-amd-shader-ballot", + "debuginfo", +] + +foreach(table, spvtools_vendor_tables) { + spvtools_vendor_table(table) { + name = table + } +} + +config("spvtools_config") { + include_dirs = [ + ".", + "include", + "$target_gen_dir", + "${spirv_headers}/include", + ] + + if (is_clang) { + cflags = [ "-Wno-implicit-fallthrough" ] + } +} + +static_library("spvtools") { + deps = [ + ":spvtools_core_enums_unified1", + ":spvtools_core_tables_unified1", + ":spvtools_generators_inc", + ":spvtools_glsl_tables_glsl1-0", + ":spvtools_language_header_unified1", + ":spvtools_opencl_tables_opencl1-0", + ] + foreach(target_name, spvtools_vendor_tables) { + deps += [ ":spvtools_vendor_tables_$target_name" ] + } + + sources = [ + "source/assembly_grammar.cpp", + "source/assembly_grammar.h", + "source/binary.cpp", + "source/binary.h", + "source/diagnostic.cpp", + "source/diagnostic.h", + "source/disassemble.cpp", + "source/enum_set.h", + "source/enum_string_mapping.cpp", + "source/ext_inst.cpp", + "source/ext_inst.h", + "source/extensions.cpp", + "source/extensions.h", + "source/instruction.h", + "source/libspirv.cpp", + "source/macro.h", + "source/name_mapper.cpp", + "source/name_mapper.h", + "source/opcode.cpp", + "source/opcode.h", + "source/operand.cpp", + "source/operand.h", + "source/parsed_operand.cpp", + "source/parsed_operand.h", + "source/print.cpp", + "source/print.h", + "source/spirv_constant.h", + "source/spirv_definition.h", + "source/spirv_endian.cpp", + "source/spirv_endian.h", + "source/spirv_target_env.cpp", + "source/spirv_target_env.h", + "source/spirv_validator_options.cpp", + "source/spirv_validator_options.h", + "source/table.cpp", + "source/table.h", + "source/text.cpp", + "source/text.h", + "source/text_handler.cpp", + "source/text_handler.h", + "source/util/bit_vector.cpp", + "source/util/bit_vector.h", + "source/util/bitutils.h", + "source/util/hex_float.h", + "source/util/ilist.h", + "source/util/ilist_node.h", + "source/util/make_unique.h", + "source/util/parse_number.cpp", + "source/util/parse_number.h", + "source/util/small_vector.h", + "source/util/string_utils.cpp", + "source/util/string_utils.h", + "source/util/timer.cpp", + "source/util/timer.h", + ] + + public_configs = [ ":spvtools_config" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] +} + +static_library("spvtools_val") { + sources = [ + "source/val/basic_block.cpp", + "source/val/construct.cpp", + "source/val/function.cpp", + "source/val/instruction.cpp", + "source/val/validate.cpp", + "source/val/validate.h", + "source/val/validate_adjacency.cpp", + "source/val/validate_annotation.cpp", + "source/val/validate_arithmetics.cpp", + "source/val/validate_atomics.cpp", + "source/val/validate_barriers.cpp", + "source/val/validate_bitwise.cpp", + "source/val/validate_builtins.cpp", + "source/val/validate_capability.cpp", + "source/val/validate_cfg.cpp", + "source/val/validate_composites.cpp", + "source/val/validate_constants.cpp", + "source/val/validate_conversion.cpp", + "source/val/validate_datarules.cpp", + "source/val/validate_debug.cpp", + "source/val/validate_decorations.cpp", + "source/val/validate_derivatives.cpp", + "source/val/validate_execution_limitations.cpp", + "source/val/validate_ext_inst.cpp", + "source/val/validate_function.cpp", + "source/val/validate_id.cpp", + "source/val/validate_image.cpp", + "source/val/validate_instruction.cpp", + "source/val/validate_interfaces.cpp", + "source/val/validate_layout.cpp", + "source/val/validate_literals.cpp", + "source/val/validate_logicals.cpp", + "source/val/validate_memory.cpp", + "source/val/validate_mode_setting.cpp", + "source/val/validate_non_uniform.cpp", + "source/val/validate_primitives.cpp", + "source/val/validate_type.cpp", + "source/val/validation_state.cpp", + ] + + deps = [ + ":spvtools", + ] + + public_configs = [ ":spvtools_config" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] +} + +static_library("spvtools_opt") { + sources = [ + "source/opt/aggressive_dead_code_elim_pass.cpp", + "source/opt/aggressive_dead_code_elim_pass.h", + "source/opt/basic_block.cpp", + "source/opt/basic_block.h", + "source/opt/block_merge_pass.cpp", + "source/opt/block_merge_pass.h", + "source/opt/build_module.cpp", + "source/opt/build_module.h", + "source/opt/ccp_pass.cpp", + "source/opt/ccp_pass.h", + "source/opt/cfg.cpp", + "source/opt/cfg.h", + "source/opt/cfg_cleanup_pass.cpp", + "source/opt/cfg_cleanup_pass.h", + "source/opt/combine_access_chains.cpp", + "source/opt/combine_access_chains.h", + "source/opt/common_uniform_elim_pass.cpp", + "source/opt/common_uniform_elim_pass.h", + "source/opt/compact_ids_pass.cpp", + "source/opt/compact_ids_pass.h", + "source/opt/composite.cpp", + "source/opt/composite.h", + "source/opt/const_folding_rules.cpp", + "source/opt/const_folding_rules.h", + "source/opt/constants.cpp", + "source/opt/constants.h", + "source/opt/copy_prop_arrays.cpp", + "source/opt/copy_prop_arrays.h", + "source/opt/dead_branch_elim_pass.cpp", + "source/opt/dead_branch_elim_pass.h", + "source/opt/dead_insert_elim_pass.cpp", + "source/opt/dead_insert_elim_pass.h", + "source/opt/dead_variable_elimination.cpp", + "source/opt/dead_variable_elimination.h", + "source/opt/decoration_manager.cpp", + "source/opt/decoration_manager.h", + "source/opt/def_use_manager.cpp", + "source/opt/def_use_manager.h", + "source/opt/dominator_analysis.cpp", + "source/opt/dominator_analysis.h", + "source/opt/dominator_tree.cpp", + "source/opt/dominator_tree.h", + "source/opt/eliminate_dead_constant_pass.cpp", + "source/opt/eliminate_dead_constant_pass.h", + "source/opt/eliminate_dead_functions_pass.cpp", + "source/opt/eliminate_dead_functions_pass.h", + "source/opt/feature_manager.cpp", + "source/opt/feature_manager.h", + "source/opt/flatten_decoration_pass.cpp", + "source/opt/flatten_decoration_pass.h", + "source/opt/fold.cpp", + "source/opt/fold.h", + "source/opt/fold_spec_constant_op_and_composite_pass.cpp", + "source/opt/fold_spec_constant_op_and_composite_pass.h", + "source/opt/folding_rules.cpp", + "source/opt/folding_rules.h", + "source/opt/freeze_spec_constant_value_pass.cpp", + "source/opt/freeze_spec_constant_value_pass.h", + "source/opt/function.cpp", + "source/opt/function.h", + "source/opt/if_conversion.cpp", + "source/opt/if_conversion.h", + "source/opt/inline_exhaustive_pass.cpp", + "source/opt/inline_exhaustive_pass.h", + "source/opt/inline_opaque_pass.cpp", + "source/opt/inline_opaque_pass.h", + "source/opt/inline_pass.cpp", + "source/opt/inline_pass.h", + "source/opt/instruction.cpp", + "source/opt/instruction.h", + "source/opt/instruction_list.cpp", + "source/opt/instruction_list.h", + "source/opt/ir_builder.h", + "source/opt/ir_context.cpp", + "source/opt/ir_context.h", + "source/opt/ir_loader.cpp", + "source/opt/ir_loader.h", + "source/opt/iterator.h", + "source/opt/licm_pass.cpp", + "source/opt/licm_pass.h", + "source/opt/local_access_chain_convert_pass.cpp", + "source/opt/local_access_chain_convert_pass.h", + "source/opt/local_redundancy_elimination.cpp", + "source/opt/local_redundancy_elimination.h", + "source/opt/local_single_block_elim_pass.cpp", + "source/opt/local_single_block_elim_pass.h", + "source/opt/local_single_store_elim_pass.cpp", + "source/opt/local_single_store_elim_pass.h", + "source/opt/local_ssa_elim_pass.cpp", + "source/opt/local_ssa_elim_pass.h", + "source/opt/log.h", + "source/opt/loop_dependence.cpp", + "source/opt/loop_dependence.h", + "source/opt/loop_dependence_helpers.cpp", + "source/opt/loop_descriptor.cpp", + "source/opt/loop_descriptor.h", + "source/opt/loop_fission.cpp", + "source/opt/loop_fission.h", + "source/opt/loop_fusion.cpp", + "source/opt/loop_fusion.h", + "source/opt/loop_fusion_pass.cpp", + "source/opt/loop_fusion_pass.h", + "source/opt/loop_peeling.cpp", + "source/opt/loop_peeling.h", + "source/opt/loop_unroller.cpp", + "source/opt/loop_unroller.h", + "source/opt/loop_unswitch_pass.cpp", + "source/opt/loop_unswitch_pass.h", + "source/opt/loop_utils.cpp", + "source/opt/loop_utils.h", + "source/opt/mem_pass.cpp", + "source/opt/mem_pass.h", + "source/opt/merge_return_pass.cpp", + "source/opt/merge_return_pass.h", + "source/opt/module.cpp", + "source/opt/module.h", + "source/opt/null_pass.h", + "source/opt/optimizer.cpp", + "source/opt/pass.cpp", + "source/opt/pass.h", + "source/opt/pass_manager.cpp", + "source/opt/pass_manager.h", + "source/opt/passes.h", + "source/opt/private_to_local_pass.cpp", + "source/opt/private_to_local_pass.h", + "source/opt/propagator.cpp", + "source/opt/propagator.h", + "source/opt/reduce_load_size.cpp", + "source/opt/reduce_load_size.h", + "source/opt/redundancy_elimination.cpp", + "source/opt/redundancy_elimination.h", + "source/opt/reflect.h", + "source/opt/register_pressure.cpp", + "source/opt/register_pressure.h", + "source/opt/remove_duplicates_pass.cpp", + "source/opt/remove_duplicates_pass.h", + "source/opt/replace_invalid_opc.cpp", + "source/opt/replace_invalid_opc.h", + "source/opt/scalar_analysis.cpp", + "source/opt/scalar_analysis.h", + "source/opt/scalar_analysis_nodes.h", + "source/opt/scalar_analysis_simplification.cpp", + "source/opt/scalar_replacement_pass.cpp", + "source/opt/scalar_replacement_pass.h", + "source/opt/set_spec_constant_default_value_pass.cpp", + "source/opt/set_spec_constant_default_value_pass.h", + "source/opt/simplification_pass.cpp", + "source/opt/simplification_pass.h", + "source/opt/ssa_rewrite_pass.cpp", + "source/opt/ssa_rewrite_pass.h", + "source/opt/strength_reduction_pass.cpp", + "source/opt/strength_reduction_pass.h", + "source/opt/strip_debug_info_pass.cpp", + "source/opt/strip_debug_info_pass.h", + "source/opt/strip_reflect_info_pass.cpp", + "source/opt/strip_reflect_info_pass.h", + "source/opt/tree_iterator.h", + "source/opt/type_manager.cpp", + "source/opt/type_manager.h", + "source/opt/types.cpp", + "source/opt/types.h", + "source/opt/unify_const_pass.cpp", + "source/opt/unify_const_pass.h", + "source/opt/value_number_table.cpp", + "source/opt/value_number_table.h", + "source/opt/vector_dce.cpp", + "source/opt/vector_dce.h", + "source/opt/workaround1209.cpp", + "source/opt/workaround1209.h", + ] + deps = [ + ":spvtools", + ] + + public_configs = [ ":spvtools_config" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] +} + +group("SPIRV-Tools") { + deps = [ + ":spvtools", + ":spvtools_opt", + ":spvtools_val", + ] +} + +if (!build_with_chromium) { + googletest_dir = spirv_tools_googletest_dir + + config("gtest_config") { + include_dirs = [ + "${googletest_dir}/googletest", + "${googletest_dir}/googletest/include", + ] + } + + static_library("gtest") { + testonly = true + sources = [ + "${googletest_dir}/googletest/src/gtest-all.cc", + ] + public_configs = [ ":gtest_config" ] + } + + config("gmock_config") { + include_dirs = [ + "${googletest_dir}/googlemock", + "${googletest_dir}/googlemock/include", + "${googletest_dir}/googletest/include", + ] + if (is_clang) { + # TODO: Can remove this if/when the issue is fixed. + # https://github.com/google/googletest/issues/533 + cflags = [ "-Wno-inconsistent-missing-override" ] + } + } + + static_library("gmock") { + testonly = true + sources = [ + "${googletest_dir}/googlemock/src/gmock-all.cc", + ] + public_configs = [ ":gmock_config" ] + } +} + +config("spvtools_test_config") { + if (is_clang) { + cflags = [ "-Wno-self-assign" ] + } +} + +test("spvtools_test") { + sources = [ + "test/assembly_context_test.cpp", + "test/assembly_format_test.cpp", + "test/binary_destroy_test.cpp", + "test/binary_endianness_test.cpp", + "test/binary_header_get_test.cpp", + "test/binary_parse_test.cpp", + "test/binary_strnlen_s_test.cpp", + "test/binary_to_text.literal_test.cpp", + "test/binary_to_text_test.cpp", + "test/comment_test.cpp", + "test/enum_set_test.cpp", + "test/enum_string_mapping_test.cpp", + "test/ext_inst.debuginfo_test.cpp", + "test/ext_inst.glsl_test.cpp", + "test/ext_inst.opencl_test.cpp", + "test/fix_word_test.cpp", + "test/generator_magic_number_test.cpp", + "test/hex_float_test.cpp", + "test/immediate_int_test.cpp", + "test/libspirv_macros_test.cpp", + "test/name_mapper_test.cpp", + "test/named_id_test.cpp", + "test/opcode_make_test.cpp", + "test/opcode_require_capabilities_test.cpp", + "test/opcode_split_test.cpp", + "test/opcode_table_get_test.cpp", + "test/operand_capabilities_test.cpp", + "test/operand_pattern_test.cpp", + "test/operand_test.cpp", + "test/target_env_test.cpp", + "test/test_fixture.h", + "test/text_advance_test.cpp", + "test/text_destroy_test.cpp", + "test/text_literal_test.cpp", + "test/text_start_new_inst_test.cpp", + "test/text_to_binary.annotation_test.cpp", + "test/text_to_binary.barrier_test.cpp", + "test/text_to_binary.constant_test.cpp", + "test/text_to_binary.control_flow_test.cpp", + "test/text_to_binary.debug_test.cpp", + "test/text_to_binary.device_side_enqueue_test.cpp", + "test/text_to_binary.extension_test.cpp", + "test/text_to_binary.function_test.cpp", + "test/text_to_binary.group_test.cpp", + "test/text_to_binary.image_test.cpp", + "test/text_to_binary.literal_test.cpp", + "test/text_to_binary.memory_test.cpp", + "test/text_to_binary.misc_test.cpp", + "test/text_to_binary.mode_setting_test.cpp", + "test/text_to_binary.pipe_storage_test.cpp", + "test/text_to_binary.reserved_sampling_test.cpp", + "test/text_to_binary.subgroup_dispatch_test.cpp", + "test/text_to_binary.type_declaration_test.cpp", + "test/text_to_binary_test.cpp", + "test/text_word_get_test.cpp", + "test/unit_spirv.cpp", + "test/unit_spirv.h", + ] + + deps = [ + ":spvtools", + ":spvtools_language_header_unified1", + ":spvtools_val", + ] + + if (build_with_chromium) { + deps += [ + "//testing/gmock", + "//testing/gtest", + "//testing/gtest:gtest_main", + ] + } else { + deps += [ + ":gmock", + ":gtest", + ] + sources += [ "${googletest_dir}/googletest/src/gtest_main.cc" ] + } + + configs += [ + ":spvtools_config", + ":spvtools_test_config", + ] +} + +if (spirv_tools_standalone) { + group("fuzzers") { + testonly = true + deps = [ + "test/fuzzers", + ] + } +} + +executable("spirv-as") { + sources = [ + "source/software_version.cpp", + "tools/as/as.cpp", + ] + deps = [ + ":spvtools", + ":spvtools_build_version", + ] + configs += [ ":spvtools_config" ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/CHANGES b/3rdparty/bgfx/3rdparty/spirv-tools/CHANGES new file mode 100644 index 00000000000..ef499027f71 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/CHANGES @@ -0,0 +1,607 @@ +Revision history for SPIRV-Tools + +v2018.5-dev 2018-07-08 + - General: + - Support Chromium GN build + - Use Kokoro bots: + - Disable Travis-CI bots + - Disable AppVeyor VisualStudio Release builds. Keep VS 2017 Debug build + - Don't check export symbols on OSX (Darwin): some installations don't have 'objdump' + - Reorganize source files and namespaces + - Fixes for ClangTidy, and whitespace (passes 'git cl presumit --all -uf') + - Fix unused param compile warnings/errors when Effcee not present + - Avoid including time headers when timer functionality is disabled + - #1688: Use binary mode on stdin; fixes "spirv-dis . versioning, with "-dev" indicating + work in progress. The intent is to more easly report + and summarize functionality when SPIRV-Tools is incorporated + in downstream projects. + + - Summary of functionality (See the README.md for more): + - Supports SPIR-V 1.1 Rev 1 + - Supports SPIR-V 1.0 Rev 5 + - Supports GLSL std450 extended instructions 1.0 Rev 3 + - Supports OpenCL extended instructions 1.0 Rev 2 + - Assembler, disassembler are complete + - Supports floating point widths of 16, 32, 64 bits + - Supports integer widths up to 64 bits + - Validator is incomplete + - Checks capability requirements in most cases + - Checks module layout constraints + - Checks ID use-definition ordering constraints, + ignoring control flow + - Checks some control flow graph rules + - Optimizer is introduced, with few available transforms. + - Supported on Linux, OSX, Android, Windows + + - Fixes bugs: + - #143: OpenCL pow and pown arguments diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/CMakeLists.txt new file mode 100644 index 00000000000..26e2d5ab285 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/CMakeLists.txt @@ -0,0 +1,280 @@ +# Copyright (c) 2015-2016 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. + +cmake_minimum_required(VERSION 2.8.12) +if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +endif() +if (POLICY CMP0054) + # Avoid dereferencing variables or interpret keywords that have been + # quoted or bracketed. + # https://cmake.org/cmake/help/v3.1/policy/CMP0054.html + cmake_policy(SET CMP0054 NEW) +endif() +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +project(spirv-tools) +enable_testing() +set(SPIRV_TOOLS "SPIRV-Tools") + +include(GNUInstallDirs) +include(cmake/setup_build.cmake) + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + add_definitions(-DSPIRV_LINUX) + set(SPIRV_TIMER_ENABLED ON) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + add_definitions(-DSPIRV_WINDOWS) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN") + add_definitions(-DSPIRV_WINDOWS) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + add_definitions(-DSPIRV_MAC) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Android") + add_definitions(-DSPIRV_ANDROID) + set(SPIRV_TIMER_ENABLED ON) +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") + add_definitions(-DSPIRV_FREEBSD) +else() + message(FATAL_ERROR "Your platform '${CMAKE_SYSTEM_NAME}' is not supported!") +endif() + +if (${SPIRV_TIMER_ENABLED}) + add_definitions(-DSPIRV_TIMER_ENABLED) +endif() + +if ("${CMAKE_BUILD_TYPE}" STREQUAL "") + message(STATUS "No build type selected, default to Debug") + set(CMAKE_BUILD_TYPE "Debug") +endif() + +option(SKIP_SPIRV_TOOLS_INSTALL "Skip installation" ${SKIP_SPIRV_TOOLS_INSTALL}) +if(NOT ${SKIP_SPIRV_TOOLS_INSTALL}) + set(ENABLE_SPIRV_TOOLS_INSTALL ON) +endif() + +option(SPIRV_BUILD_COMPRESSION "Build SPIR-V compressing codec" OFF) + +option(SPIRV_WERROR "Enable error on warning" ON) +if(("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") AND (NOT CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))) + set(COMPILER_IS_LIKE_GNU TRUE) +endif() +if(${COMPILER_IS_LIKE_GNU}) + set(SPIRV_WARNINGS -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers) + + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Wno-self-assign) + endif() + + option(SPIRV_WARN_EVERYTHING "Enable -Weverything" ${SPIRV_WARN_EVERYTHING}) + if(${SPIRV_WARN_EVERYTHING}) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} + -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded) + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Wpedantic -pedantic-errors) + else() + message(STATUS "Unknown compiler ${CMAKE_CXX_COMPILER_ID}, " + "so SPIRV_WARN_EVERYTHING has no effect") + endif() + endif() + + if(${SPIRV_WERROR}) + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Werror) + endif() +elseif(MSVC) + set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /wd4800) + + if(${SPIRV_WERROR}) + set(SPIRV_WARNINGS ${SPIRV_WARNINGS} /WX) + endif() +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/) + +option(SPIRV_COLOR_TERMINAL "Enable color terminal output" ON) +if(${SPIRV_COLOR_TERMINAL}) + add_definitions(-DSPIRV_COLOR_TERMINAL) +endif() + +option(SPIRV_LOG_DEBUG "Enable excessive debug output" OFF) +if(${SPIRV_LOG_DEBUG}) + add_definitions(-DSPIRV_LOG_DEBUG) +endif() + +if (DEFINED SPIRV_TOOLS_EXTRA_DEFINITIONS) + add_definitions(${SPIRV_TOOLS_EXTRA_DEFINITIONS}) +endif() + +function(spvtools_default_compile_options TARGET) + target_compile_options(${TARGET} PRIVATE ${SPIRV_WARNINGS}) + + if (${COMPILER_IS_LIKE_GNU}) + target_compile_options(${TARGET} PRIVATE + -std=c++11 -fno-exceptions -fno-rtti) + target_compile_options(${TARGET} PRIVATE + -Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion + -Wno-sign-conversion) + # For good call stacks in profiles, keep the frame pointers. + if(NOT "${SPIRV_PERF}" STREQUAL "") + target_compile_options(${TARGET} PRIVATE -fno-omit-frame-pointer) + endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(SPIRV_USE_SANITIZER "" CACHE STRING + "Use the clang sanitizer [address|memory|thread|...]") + if(NOT "${SPIRV_USE_SANITIZER}" STREQUAL "") + target_compile_options(${TARGET} PRIVATE + -fsanitize=${SPIRV_USE_SANITIZER}) + endif() + else() + target_compile_options(${TARGET} PRIVATE + -Wno-missing-field-initializers) + endif() + endif() + + if (MSVC) + # Specify /EHs for exception handling. This makes using SPIRV-Tools as + # dependencies in other projects easier. + target_compile_options(${TARGET} PRIVATE /EHs) + endif() + + # For MinGW cross compile, statically link to the C++ runtime. + # But it still depends on MSVCRT.dll. + if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") + set_target_properties(${TARGET} PROPERTIES + LINK_FLAGS -static -static-libgcc -static-libstdc++) + endif() + endif() +endfunction() + +if(NOT COMMAND find_host_package) + macro(find_host_package) + find_package(${ARGN}) + endmacro() +endif() +if(NOT COMMAND find_host_program) + macro(find_host_program) + find_program(${ARGN}) + endmacro() +endif() + +find_host_package(PythonInterp) + +# Check for symbol exports on Linux. +# At the moment, this check will fail on the OSX build machines for the Android NDK. +# It appears they don't have objdump. +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + macro(spvtools_check_symbol_exports TARGET) + if (NOT "${SPIRV_SKIP_TESTS}") + add_test(NAME spirv-tools-symbol-exports-${TARGET} + COMMAND ${PYTHON_EXECUTABLE} + ${spirv-tools_SOURCE_DIR}/utils/check_symbol_exports.py "$") + endif() + endmacro() +else() + macro(spvtools_check_symbol_exports TARGET) + if (NOT "${SPIRV_SKIP_TESTS}") + message("Skipping symbol exports test for ${TARGET}") + endif() + endmacro() +endif() + +# Defaults to OFF if the user didn't set it. +option(SPIRV_SKIP_EXECUTABLES + "Skip building the executable and tests along with the library" + ${SPIRV_SKIP_EXECUTABLES}) +option(SPIRV_SKIP_TESTS + "Skip building tests along with the library" ${SPIRV_SKIP_TESTS}) +if ("${SPIRV_SKIP_EXECUTABLES}") + set(SPIRV_SKIP_TESTS ON) +endif() + +# Defaults to ON. The checks can be time consuming. +# Turn off if they take too long. +option(SPIRV_CHECK_CONTEXT "In a debug build, check if the IR context is in a valid state." ON) +if (${SPIRV_CHECK_CONTEXT}) + add_definitions(-DSPIRV_CHECK_CONTEXT) +endif() + +add_subdirectory(external) + +if (TARGET effcee) + add_definitions(-DSPIRV_EFFCEE) +endif() + +add_subdirectory(source) +add_subdirectory(tools) + +add_subdirectory(test) +add_subdirectory(examples) + +if(ENABLE_SPIRV_TOOLS_INSTALL) + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/optimizer.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/linker.hpp + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/spirv-tools/) +endif(ENABLE_SPIRV_TOOLS_INSTALL) + +if (NOT "${SPIRV_SKIP_TESTS}") + add_test(NAME spirv-tools-copyrights + COMMAND ${PYTHON_EXECUTABLE} utils/check_copyright.py + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() + +set(SPIRV_LIBRARIES "-lSPIRV-Tools -lSPIRV-Tools-link -lSPIRV-Tools-opt") +set(SPIRV_SHARED_LIBRARIES "-lSPIRV-Tools-shared") +if(SPIRV_BUILD_COMPRESSION) + set(SPIRV_LIBRARIES "${SPIRV_LIBRARIES} -lSPIRV-Tools-comp") +endif(SPIRV_BUILD_COMPRESSION) + +# Build pkg-config file +# Use a first-class target so it's regenerated when relevant files are updated. +add_custom_target(spirv-tools-pkg-config ALL + COMMAND ${CMAKE_COMMAND} + -DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES + -DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools.pc.in + -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} + -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} + -DSPIRV_LIBRARIES=${SPIRV_LIBRARIES} + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake + DEPENDS "CHANGES" "cmake/SPIRV-Tools.pc.in" "cmake/write_pkg_config.cmake") +add_custom_target(spirv-tools-shared-pkg-config ALL + COMMAND ${CMAKE_COMMAND} + -DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES + -DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/SPIRV-Tools-shared.pc.in + -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} + -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} + -DSPIRV_SHARED_LIBRARIES=${SPIRV_SHARED_LIBRARIES} + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake + DEPENDS "CHANGES" "cmake/SPIRV-Tools-shared.pc.in" "cmake/write_pkg_config.cmake") + +# Install pkg-config file +if (ENABLE_SPIRV_TOOLS_INSTALL) + install( + FILES + ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc + ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc + DESTINATION + ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +endif() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/CONTRIBUTING.md b/3rdparty/bgfx/3rdparty/spirv-tools/CONTRIBUTING.md new file mode 100644 index 00000000000..93a5610ee32 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/CONTRIBUTING.md @@ -0,0 +1,192 @@ +# Contributing to SPIR-V Tools + +## For users: Reporting bugs and requesting features + +We organize known future work in GitHub projects. See [Tracking SPIRV-Tools work +with GitHub +projects](https://github.com/KhronosGroup/SPIRV-Tools/blob/master/projects.md) +for more. + +To report a new bug or request a new feature, please file a GitHub issue. Please +ensure the bug has not already been reported by searching +[issues](https://github.com/KhronosGroup/SPIRV-Tools/issues) and +[projects](https://github.com/KhronosGroup/SPIRV-Tools/projects). If the bug has +not already been reported open a new one +[here](https://github.com/KhronosGroup/SPIRV-Tools/issues/new). + +When opening a new issue for a bug, make sure you provide the following: + +* A clear and descriptive title. + * We want a title that will make it easy for people to remember what the + issue is about. Simply using "Segfault in spirv-opt" is not helpful + because there could be (but hopefully aren't) multiple bugs with + segmentation faults with different causes. +* A test case that exposes the bug, with the steps and commands to reproduce + it. + * The easier it is for a developer to reproduce the problem, the quicker a + fix can be found and verified. It will also make it easier for someone + to possibly realize the bug is related to another issue. + +For feature requests, we use +[issues](https://github.com/KhronosGroup/SPIRV-Tools/issues) as well. Please +create a new issue, as with bugs. In the issue provide + +* A description of the problem that needs to be solved. +* Examples that demonstrate the problem. + +## For developers: Contributing a patch + +Before we can use your code, you must sign the [Khronos Open Source Contributor +License Agreement](https://cla-assistant.io/KhronosGroup/SPIRV-Tools) (CLA), +which you can do online. The CLA is necessary mainly because you own the +copyright to your changes, even after your contribution becomes part of our +codebase, so we need your permission to use and distribute your code. We also +need to be sure of various other things -- for instance that you'll tell us if +you know that your code infringes on other people's patents. You don't have to +sign the CLA until after you've submitted your code for review and a member has +approved it, but you must do it before we can put your code into our codebase. + +See +[README.md](https://github.com/KhronosGroup/SPIRV-Tools/blob/master/README.md) +for instruction on how to get, build, and test the source. Once you have made +your changes: + +* Ensure the code follows the [Google C++ Style + Guide](https://google.github.io/styleguide/cppguide.html). Running + `clang-format -style=file -i [modified-files]` can help. +* Create a pull request (PR) with your patch. +* Make sure the PR description clearly identified the problem, explains the + solution, and references the issue if applicable. +* If your patch completely fixes bug 1234, the commit message should say + `Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1234` + When you do this, the issue will be closed automatically when the commit + goes into master. Also, this helps us update the [CHANGES](CHANGES) file. +* Watch the continuous builds to make sure they pass. +* Request a code review. + +The reviewer can either approve your PR or request changes. If changes are +requested: + +* Please add new commits to your branch, instead of amending your commit. + Adding new commits makes it easier for the reviewer to see what has changed + since the last review. +* Once you are ready for another round of reviews, add a comment at the + bottom, such as "Ready for review" or "Please take a look" (or "PTAL"). This + explicit handoff is useful when responding with multiple small commits. + +After the PR has been reviewed it is the job of the reviewer to merge the PR. +Instructions for this are given below. + +## For maintainers: Reviewing a PR + +The formal code reviews are done on GitHub. Reviewers are to look for all of the +usual things: + +* Coding style follows the [Google C++ Style + Guide](https://google.github.io/styleguide/cppguide.html) +* Identify potential functional problems. +* Identify code duplication. +* Ensure the unit tests have enough coverage. +* Ensure continuous integration (CI) bots run on the PR. If not run (in the + case of PRs by external contributors), add the "kokoro:run" label to the + pull request which will trigger running all CI jobs. + +When looking for functional problems, there are some common problems reviewers +should pay particular attention to: + +* Does the code work for both Shader (Vulkan and OpenGL) and Kernel (OpenCL) + scenarios? The respective SPIR-V dialects are slightly different. +* Changes are made to a container while iterating through it. You have to be + careful that iterators are not invalidated or that elements are not skipped. +* C++11 and VS2013. We generally assume that we have a C++11 compliant + compiler. However, on Windows, we still support Visual Studio 2013, which is + not fully C++11 compliant. See + [here](https://msdn.microsoft.com/en-us/library/hh567368.aspx). In + particular, note that it does not provide default move-constructors or + move-assignments for classes. In general, r-value references do not work the + way you might assume they do. +* For SPIR-V transforms: The module is changed, but the analyses are not + updated. For example, a new instruction is added, but the def-use manager is + not updated. Later on, it is possible that the def-use manager will be used, + and give wrong results. + +## For maintainers: Merging a PR + +We intend to maintain a linear history on the GitHub master branch, and the +build and its tests should pass at each commit in that history. A linear +always-working history is easier to understand and to bisect in case we want to +find which commit introduced a bug. + +### Initial merge setup + +The following steps should be done exactly once (when you are about to merge a +PR for the first time): + +* It is assumed that upstream points to + [git@github.com](mailto:git@github.com):KhronosGroup/SPIRV-Tools.git or + https://github.com/KhronosGroup/SPIRV-Tools.git. + +* Find out the local name for the main github repo in your git configuration. + For example, in this configuration, it is labeled `upstream`. + + ``` + git remote -v + [ ... ] + upstream https://github.com/KhronosGroup/SPIRV-Tools.git (fetch) + upstream https://github.com/KhronosGroup/SPIRV-Tools.git (push) + ``` + +* Make sure that the `upstream` remote is set to fetch from the `refs/pull` + namespace: + + ``` + git config --get-all remote.upstream.fetch + +refs/heads/*:refs/remotes/upstream/* + +refs/pull/*/head:refs/remotes/upstream/pr/* + ``` + +* If the line `+refs/pull/*/head:refs/remotes/upstream/pr/*` is not present in + your configuration, you can add it with the command: + + ``` + git config --local --add remote.upstream.fetch '+refs/pull/*/head:refs/remotes/upstream/pr/*' + ``` + +### Merge workflow + +The following steps should be done for every PR that you intend to merge: + +* Make sure your local copy of the master branch is up to date: + + ``` + git checkout master + git pull + ``` + +* Fetch all pull requests refs: + + ``` + git fetch upstream + ``` + +* Checkout the particular pull request you are going to review: + + ``` + git checkout pr/1048 + ``` + +* Rebase the PR on top of the master branch. If there are conflicts, send it + back to the author and ask them to rebase. During the interactive rebase be + sure to squash all of the commits down to a single commit. + + ``` + git rebase -i master + ``` + +* **Build and test the PR.** + +* If all of the tests pass, push the commit `git push upstream HEAD:master` + +* Close the PR and add a comment saying it was push using the commit that you + just pushed. See https://github.com/KhronosGroup/SPIRV-Tools/pull/935 as an + example. diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/DEPS b/3rdparty/bgfx/3rdparty/spirv-tools/DEPS new file mode 100644 index 00000000000..b69f0320c81 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/DEPS @@ -0,0 +1,174 @@ +use_relative_paths = True + +vars = { + 'chromium_git': 'https://chromium.googlesource.com', + 'github': 'https://github.com', + + 'build_revision': '037f38ae0fe5e11b4f7c33b750fd7a1e9634a606', + 'buildtools_revision': 'ab7b6a7b350dd15804c87c20ce78982811fdd76f', + 'clang_revision': 'abe5e4f9dc0f1df848c7a0efa05256253e77a7b7', + 'effcee_revision': '04b624799f5a9dbaf3fa1dbed2ba9dce2fc8dcf2', + 'googletest_revision': '98a0d007d7092b72eea0e501bb9ad17908a1a036', + 'testing_revision': '340252637e2e7c72c0901dcbeeacfff419e19b59', + 're2_revision': '6cf8ccd82dbaab2668e9b13596c68183c9ecd13f', + 'spirv_headers_revision': 'ff684ffc6a35d2a58f0f63108877d0064ea33feb', +} + +deps = { + "build": + Var('chromium_git') + "/chromium/src/build.git@" + Var('build_revision'), + + 'buildtools': + Var('chromium_git') + '/chromium/buildtools.git@' + + Var('buildtools_revision'), + + 'external/spirv-headers': + Var('github') + '/KhronosGroup/SPIRV-Headers.git@' + + Var('spirv_headers_revision'), + + 'external/googletest': + Var('github') + '/google/googletest.git@' + Var('googletest_revision'), + + 'external/effcee': + Var('github') + '/google/effcee.git@' + Var('effcee_revision'), + + 'external/re2': + Var('github') + '/google/re2.git@' + Var('re2_revision'), + + 'testing': + Var('chromium_git') + '/chromium/src/testing@' + + Var('testing_revision'), + + 'tools/clang': + Var('chromium_git') + '/chromium/src/tools/clang@' + Var('clang_revision') +} + +recursedeps = [ + # buildtools provides clang_format, libc++, and libc++api + 'buildtools', +] + +hooks = [ + { + 'name': 'gn_win', + 'action': [ 'download_from_google_storage', + '--no_resume', + '--platform=win32', + '--no_auth', + '--bucket', 'chromium-gn', + '-s', 'SPIRV-Tools/buildtools/win/gn.exe.sha1', + ], + }, + { + 'name': 'gn_mac', + 'pattern': '.', + 'action': [ 'download_from_google_storage', + '--no_resume', + '--platform=darwin', + '--no_auth', + '--bucket', 'chromium-gn', + '-s', 'SPIRV-Tools/buildtools/mac/gn.sha1', + ], + }, + { + 'name': 'gn_linux64', + 'pattern': '.', + 'action': [ 'download_from_google_storage', + '--no_resume', + '--platform=linux*', + '--no_auth', + '--bucket', 'chromium-gn', + '-s', 'SPIRV-Tools/buildtools/linux64/gn.sha1', + ], + }, + # Pull clang-format binaries using checked-in hashes. + { + 'name': 'clang_format_win', + 'pattern': '.', + 'action': [ 'download_from_google_storage', + '--no_resume', + '--platform=win32', + '--no_auth', + '--bucket', 'chromium-clang-format', + '-s', 'SPIRV-Tools/buildtools/win/clang-format.exe.sha1', + ], + }, + { + 'name': 'clang_format_mac', + 'pattern': '.', + 'action': [ 'download_from_google_storage', + '--no_resume', + '--platform=darwin', + '--no_auth', + '--bucket', 'chromium-clang-format', + '-s', 'SPIRV-Tools/buildtools/mac/clang-format.sha1', + ], + }, + { + 'name': 'clang_format_linux', + 'pattern': '.', + 'action': [ 'download_from_google_storage', + '--no_resume', + '--platform=linux*', + '--no_auth', + '--bucket', 'chromium-clang-format', + '-s', 'SPIRV-Tools/buildtools/linux64/clang-format.sha1', + ], + }, + { + # Pull clang + 'name': 'clang', + 'pattern': '.', + 'action': ['python', + 'SPIRV-Tools/tools/clang/scripts/update.py' + ], + }, + { + 'name': 'sysroot_arm', + 'pattern': '.', + 'condition': 'checkout_linux and checkout_arm', + 'action': ['python', 'SPIRV-Tools/build/linux/sysroot_scripts/install-sysroot.py', + '--arch=arm'], + }, + { + 'name': 'sysroot_arm64', + 'pattern': '.', + 'condition': 'checkout_linux and checkout_arm64', + 'action': ['python', 'SPIRV-Tools/build/linux/sysroot_scripts/install-sysroot.py', + '--arch=arm64'], + }, + { + 'name': 'sysroot_x86', + 'pattern': '.', + 'condition': 'checkout_linux and (checkout_x86 or checkout_x64)', + 'action': ['python', 'SPIRV-Tools/build/linux/sysroot_scripts/install-sysroot.py', + '--arch=x86'], + }, + { + 'name': 'sysroot_mips', + 'pattern': '.', + 'condition': 'checkout_linux and checkout_mips', + 'action': ['python', 'SPIRV-Tools/build/linux/sysroot_scripts/install-sysroot.py', + '--arch=mips'], + }, + { + 'name': 'sysroot_x64', + 'pattern': '.', + 'condition': 'checkout_linux and checkout_x64', + 'action': ['python', 'SPIRV-Tools/build/linux/sysroot_scripts/install-sysroot.py', + '--arch=x64'], + }, + { + # Update the Windows toolchain if necessary. + 'name': 'win_toolchain', + 'pattern': '.', + 'condition': 'checkout_win', + 'action': ['python', 'SPIRV-Tools/build/vs_toolchain.py', 'update', '--force'], + }, + { + # Update the Mac toolchain if necessary. + 'name': 'mac_toolchain', + 'pattern': '.', + 'action': ['python', 'SPIRV-Tools/build/mac_toolchain.py'], + }, +] diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/LICENSE b/3rdparty/bgfx/3rdparty/spirv-tools/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT 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/3rdparty/bgfx/3rdparty/spirv-tools/PRESUBMIT.py b/3rdparty/bgfx/3rdparty/spirv-tools/PRESUBMIT.py new file mode 100644 index 00000000000..dd3117f229e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/PRESUBMIT.py @@ -0,0 +1,40 @@ +# Copyright (c) 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. + +"""Presubmit script for SPIRV-Tools. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + +LINT_FILTERS = [ + "-build/storage_class", + "-readability/casting", + "-readability/fn_size", + "-readability/todo", + "-runtime/explicit", + "-runtime/int", + "-runtime/printf", + "-runtime/references", + "-runtime/string", +] + + +def CheckChangeOnUpload(input_api, output_api): + results = [] + results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api) + results += input_api.canned_checks.CheckChangeLintsClean( + input_api, output_api, None, LINT_FILTERS) + + return results diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/README.md b/3rdparty/bgfx/3rdparty/spirv-tools/README.md new file mode 100644 index 00000000000..a5c3e37ac80 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/README.md @@ -0,0 +1,531 @@ +# SPIR-V Tools + +[![Build status](https://ci.appveyor.com/api/projects/status/gpue87cesrx3pi0d/branch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/spirv-tools/branch/master) +Linux![Linux Build Status](https://storage.googleapis.com/spirv-tools/badges/build_status_linux_release.svg) +MacOS![MacOS Build Status](https://storage.googleapis.com/spirv-tools/badges/build_status_macos_release.svg) +Windows![Windows Build Status](https://storage.googleapis.com/spirv-tools/badges/build_status_windows_release.svg) + +## Overview + +The SPIR-V Tools project provides an API and commands for processing SPIR-V +modules. + +The project includes an assembler, binary module parser, disassembler, +validator, and optimizer for SPIR-V. Except for the optimizer, all are based +on a common static library. The library contains all of the implementation +details, and is used in the standalone tools whilst also enabling integration +into other code bases directly. The optimizer implementation resides in its +own library, which depends on the core library. + +The interfaces have stabilized: +We don't anticipate making a breaking change for existing features. + +SPIR-V is defined by the Khronos Group Inc. +See the [SPIR-V Registry][spirv-registry] for the SPIR-V specification, +headers, and XML registry. + +## Versioning SPIRV-Tools + +See [`CHANGES`](CHANGES) for a high level summary of recent changes, by version. + +SPIRV-Tools project version numbers are of the form `v`*year*`.`*index* and with +an optional `-dev` suffix to indicate work in progress. For exampe, the +following versions are ordered from oldest to newest: + +* `v2016.0` +* `v2016.1-dev` +* `v2016.1` +* `v2016.2-dev` +* `v2016.2` + +Use the `--version` option on each command line tool to see the software +version. An API call reports the software version as a C-style string. + +## Supported features + +### Assembler, binary parser, and disassembler + +* Support for SPIR-V 1.0, 1.1, 1.2, and 1.3 + * Based on SPIR-V syntax described by JSON grammar files in the + [SPIRV-Headers](spirv-headers) repository. +* Support for extended instruction sets: + * GLSL std450 version 1.0 Rev 3 + * OpenCL version 1.0 Rev 2 +* Assembler only does basic syntax checking. No cross validation of + IDs or types is performed, except to check literal arguments to + `OpConstant`, `OpSpecConstant`, and `OpSwitch`. + +See [`syntax.md`](syntax.md) for the assembly language syntax. + +### Validator + +The validator checks validation rules described by the SPIR-V specification. + +Khronos recommends that tools that create or transform SPIR-V modules use the +validator to ensure their outputs are valid, and that tools that consume SPIR-V +modules optionally use the validator to protect themselves from bad inputs. +This is especially encouraged for debug and development scenarios. + +The validator has one-sided error: it will only return an error when it has +implemented a rule check and the module violates that rule. + +The validator is incomplete. +See the [CHANGES](CHANGES) file for reports on completed work, and +the [Validator +sub-project](https://github.com/KhronosGroup/SPIRV-Tools/projects/1) for planned +and in-progress work. + +*Note*: The validator checks some Universal Limits, from section 2.17 of the SPIR-V spec. +The validator will fail on a module that exceeds those minimum upper bound limits. +It is [future work](https://github.com/KhronosGroup/SPIRV-Tools/projects/1#card-1052403) +to parameterize the validator to allow larger +limits accepted by a more than minimally capable SPIR-V consumer. + + +### Optimizer + +*Note:* The optimizer is still under development. + +Currently supported optimizations: +* General + * Strip debug info +* Specialization Constants + * Set spec constant default value + * Freeze spec constant + * Fold `OpSpecConstantOp` and `OpSpecConstantComposite` + * Unify constants + * Eliminate dead constant +* Code Reduction + * Inline all function calls exhaustively + * Convert local access chains to inserts/extracts + * Eliminate local load/store in single block + * Eliminate local load/store with single store + * Eliminate local load/store with multiple stores + * Eliminate local extract from insert + * Eliminate dead instructions (aggressive) + * Eliminate dead branches + * Merge single successor / single predecessor block pairs + * Eliminate common uniform loads + * Remove duplicates: Capabilities, extended instruction imports, types, and + decorations. + +For the latest list with detailed documentation, please refer to +[`include/spirv-tools/optimizer.hpp`](include/spirv-tools/optimizer.hpp). + +For suggestions on using the code reduction options, please refer to this [white paper](https://www.lunarg.com/shader-compiler-technologies/white-paper-spirv-opt/). + + +### Linker + +*Note:* The linker is still under development. + +Current features: +* Combine multiple SPIR-V binary modules together. +* Combine into a library (exports are retained) or an executable (no symbols + are exported). + +See the [CHANGES](CHANGES) file for reports on completed work, and the [General +sub-project](https://github.com/KhronosGroup/SPIRV-Tools/projects/2) for +planned and in-progress work. + +### Extras + +* [Utility filters](#utility-filters) +* Build target `spirv-tools-vimsyntax` generates file `spvasm.vim`. + Copy that file into your `$HOME/.vim/syntax` directory to get SPIR-V assembly syntax + highlighting in Vim. This build target is not built by default. + +## Contributing + +The SPIR-V Tools project is maintained by members of the The Khronos Group Inc., +and is hosted at https://github.com/KhronosGroup/SPIRV-Tools. + +Consider joining the `public_spirv_tools_dev@khronos.org` mailing list, via +[https://www.khronos.org/spir/spirv-tools-mailing-list/](https://www.khronos.org/spir/spirv-tools-mailing-list/). +The mailing list is used to discuss development plans for the SPIRV-Tools as an open source project. +Once discussion is resolved, +specific work is tracked via issues and sometimes in one of the +[projects][spirv-tools-projects]. + +(To provide feedback on the SPIR-V _specification_, file an issue on the +[SPIRV-Headers][spirv-headers] GitHub repository.) + +See [`projects.md`](projects.md) to see how we use the +[GitHub Project +feature](https://help.github.com/articles/tracking-the-progress-of-your-work-with-projects/) +to organize planned and in-progress work. + +Contributions via merge request are welcome. Changes should: +* Be provided under the [Apache 2.0](#license). +* You'll be prompted with a one-time "click-through" + [Khronos Open Source Contributor License Agreement][spirv-tools-cla] + (CLA) dialog as part of submitting your pull request or + other contribution to GitHub. +* Include tests to cover updated functionality. +* C++ code should follow the [Google C++ Style Guide][cpp-style-guide]. +* Code should be formatted with `clang-format`. Settings are defined by + the included [.clang-format](.clang-format) file. + +We intend to maintain a linear history on the GitHub `master` branch. + +### Source code organization + +* `example`: demo code of using SPIRV-Tools APIs +* `external/googletest`: Intended location for the + [googletest][googletest] sources, not provided +* `external/effcee`: Location of [Effcee][effcee] sources, if the `effcee` library + is not already configured by an enclosing project. +* `external/re2`: Location of [RE2][re2] sources, if the `effcee` library is not already + configured by an enclosing project. + (The Effcee project already requires RE2.) +* `include/`: API clients should add this directory to the include search path +* `external/spirv-headers`: Intended location for + [SPIR-V headers][spirv-headers], not provided +* `include/spirv-tools/libspirv.h`: C API public interface +* `source/`: API implementation +* `test/`: Tests, using the [googletest][googletest] framework +* `tools/`: Command line executables + +Example of getting sources, assuming SPIRV-Tools is configured as a standalone project: + + git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools + git clone https://github.com/KhronosGroup/SPIRV-Headers.git spirv-tools/external/spirv-headers + git clone https://github.com/google/googletest.git spirv-tools/external/googletest + git clone https://github.com/google/effcee.git spirv-tools/external/effcee + git clone https://github.com/google/re2.git spirv-tools/external/re2 + +### Tests + +The project contains a number of tests, used to drive development +and ensure correctness. The tests are written using the +[googletest][googletest] framework. The `googletest` +source is not provided with this project. There are two ways to enable +tests: +* If SPIR-V Tools is configured as part of an enclosing project, then the + enclosing project should configure `googletest` before configuring SPIR-V Tools. +* If SPIR-V Tools is configured as a standalone project, then download the + `googletest` source into the `/external/googletest` directory before + configuring and building the project. + +*Note*: You must use a version of googletest that includes +[a fix][googletest-pull-612] for [googletest issue 610][googletest-issue-610]. +The fix is included on the googletest master branch any time after 2015-11-10. +In particular, googletest must be newer than version 1.7.0. + +### Optional dependency on Effcee + +Some tests depend on the [Effcee][effcee] library for stateful matching. +Effcee itself depends on [RE2][re2]. + +* If SPIRV-Tools is configured as part of a larger project that already uses + Effcee, then that project should include Effcee before SPIRV-Tools. +* Otherwise, SPIRV-Tools expects Effcee sources to appear in `external/effcee` + and RE2 sources to appear in `external/re2`. + +Currently Effcee is an optional dependency, but soon it will be required. + +## Build + +Instead of building manually, you can also download the binaries for your +platform directly from the [master-tot release][master-tot-release] on GitHub. +Those binaries are automatically uploaded by the buildbots after successful +testing and they always reflect the current top of the tree of the master +branch. + +The project uses [CMake][cmake] to generate platform-specific build +configurations. Assume that `` is the root directory of the checked +out code: + +```sh +cd +git clone https://github.com/KhronosGroup/SPIRV-Headers.git external/spirv-headers +git clone https://github.com/google/googletest.git external/googletest # optional + +mkdir build && cd build +cmake [-G ] +``` + +Once the build files have been generated, build using your preferred +development environment. + +### CMake options + +The following CMake options are supported: + +* `SPIRV_COLOR_TERMINAL={ON|OFF}`, default `ON` - Enables color console output. +* `SPIRV_SKIP_TESTS={ON|OFF}`, default `OFF`- Build only the library and + the command line tools. This will prevent the tests from being built. +* `SPIRV_SKIP_EXECUTABLES={ON|OFF}`, default `OFF`- Build only the library, not + the command line tools and tests. +* `SPIRV_BUILD_COMPRESSION={ON|OFF}`, default `OFF`- Build SPIR-V compressing + codec. +* `SPIRV_USE_SANITIZER=`, default is no sanitizing - On UNIX + platforms with an appropriate version of `clang` this option enables the use + of the sanitizers documented [here][clang-sanitizers]. + This should only be used with a debug build. +* `SPIRV_WARN_EVERYTHING={ON|OFF}`, default `OFF` - On UNIX platforms enable + more strict warnings. The code might not compile with this option enabled. + For Clang, enables `-Weverything`. For GCC, enables `-Wpedantic`. + See [`CMakeLists.txt`](CMakeLists.txt) for details. +* `SPIRV_WERROR={ON|OFF}`, default `ON` - Forces a compilation error on any + warnings encountered by enabling the compiler-specific compiler front-end + option. + +Additionally, you can pass additional C preprocessor definitions to SPIRV-Tools +via setting `SPIRV_TOOLS_EXTRA_DEFINITIONS`. For example, by setting it to +`/D_ITERATOR_DEBUG_LEVEL=0` on Windows, you can disable checked iterators and +iterator debugging. + +### Android + +SPIR-V Tools supports building static libraries `libSPIRV-Tools.a` and +`libSPIRV-Tools-opt.a` for Android: + +``` +cd + +export ANDROID_NDK=/path/to/your/ndk + +mkdir build && cd build +mkdir libs +mkdir app + +$ANDROID_NDK/ndk-build -C ../android_test \ + NDK_PROJECT_PATH=. \ + NDK_LIBS_OUT=`pwd`/libs \ + NDK_APP_OUT=`pwd`/app +``` + +## Library + +### Usage + +The internals of the library use C++11 features, and are exposed via both a C +and C++ API. + +In order to use the library from an application, the include path should point +to `/include`, which will enable the application to include the +header `/include/spirv-tools/libspirv.h{|pp}` then linking against +the static library in `/source/libSPIRV-Tools.a` or +`/source/SPIRV-Tools.lib`. +For optimization, the header file is +`/include/spirv-tools/optimizer.hpp`, and the static library is +`/source/libSPIRV-Tools-opt.a` or +`/source/SPIRV-Tools-opt.lib`. + +* `SPIRV-Tools` CMake target: Creates the static library: + * `/source/libSPIRV-Tools.a` on Linux and OS X. + * `/source/libSPIRV-Tools.lib` on Windows. +* `SPIRV-Tools-opt` CMake target: Creates the static library: + * `/source/libSPIRV-Tools-opt.a` on Linux and OS X. + * `/source/libSPIRV-Tools-opt.lib` on Windows. + +#### Entry points + +The interfaces are still under development, and are expected to change. + +There are five main entry points into the library in the C interface: + +* `spvTextToBinary`: An assembler, translating text to a binary SPIR-V module. +* `spvBinaryToText`: A disassembler, translating a binary SPIR-V module to + text. +* `spvBinaryParse`: The entry point to a binary parser API. It issues callbacks + for the header and each parsed instruction. The disassembler is implemented + as a client of `spvBinaryParse`. +* `spvValidate` implements the validator functionality. *Incomplete* +* `spvValidateBinary` implements the validator functionality. *Incomplete* + +The C++ interface is comprised of three classes, `SpirvTools`, `Optimizer` and +`Linker`, all in the `spvtools` namespace. +* `SpirvTools` provides `Assemble`, `Disassemble`, and `Validate` methods. +* `Optimizer` provides methods for registering and running optimization passes. +* `Linker` provides methods for combining together multiple binaries. + +## Command line tools + +Command line tools, which wrap the above library functions, are provided to +assemble or disassemble shader files. It's a convention to name SPIR-V +assembly and binary files with suffix `.spvasm` and `.spv`, respectively. + +### Assembler tool + +The assembler reads the assembly language text, and emits the binary form. + +The standalone assembler is the exectuable called `spirv-as`, and is located in +`/tools/spirv-as`. The functionality of the assembler is implemented +by the `spvTextToBinary` library function. + +* `spirv-as` - the standalone assembler + * `/tools/as` + +Use option `-h` to print help. + +### Disassembler tool + +The disassembler reads the binary form, and emits assembly language text. + +The standalone disassembler is the executable called `spirv-dis`, and is located in +`/tools/spirv-dis`. The functionality of the disassembler is implemented +by the `spvBinaryToText` library function. + +* `spirv-dis` - the standalone disassembler + * `/tools/dis` + +Use option `-h` to print help. + +The output includes syntax colouring when printing to the standard output stream, +on Linux, Windows, and OS X. + +### Linker tool + +The linker combines multiple SPIR-V binary modules together, resulting in a single +binary module as output. + +This is a work in progress. +The linker does not support OpenCL program linking options related to math +flags. (See section 5.6.5.2 in OpenCL 1.2) + +* `spirv-link` - the standalone linker + * `/tools/link` + +### Optimizer tool + +The optimizer processes a SPIR-V binary module, applying transformations +in the specified order. + +This is a work in progress, with initially only few available transformations. + +* `spirv-opt` - the standalone optimizer + * `/tools/opt` + +### Validator tool + +*Warning:* This functionality is under development, and is incomplete. + +The standalone validator is the executable called `spirv-val`, and is located in +`/tools/spirv-val`. The functionality of the validator is implemented +by the `spvValidate` library function. + +The validator operates on the binary form. + +* `spirv-val` - the standalone validator + * `/tools/val` + +### Control flow dumper tool + +The control flow dumper prints the control flow graph for a SPIR-V module as a +[GraphViz](http://www.graphviz.org/) graph. + +This is experimental. + +* `spirv-cfg` - the control flow graph dumper + * `/tools/cfg` + +### Utility filters + +* `spirv-lesspipe.sh` - Automatically disassembles `.spv` binary files for the + `less` program, on compatible systems. For example, set the `LESSOPEN` + environment variable as follows, assuming both `spirv-lesspipe.sh` and + `spirv-dis` are on your executable search path: + ``` + export LESSOPEN='| spirv-lesspipe.sh "%s"' + ``` + Then you page through a disassembled module as follows: + ``` + less foo.spv + ``` + * The `spirv-lesspipe.sh` script will pass through any extra arguments to + `spirv-dis`. So, for example, you can turn off colours and friendly ID + naming as follows: + ``` + export LESSOPEN='| spirv-lesspipe.sh "%s" --no-color --raw-id' + ``` + +* [vim-spirv](https://github.com/kbenzie/vim-spirv) - A vim plugin which + supports automatic disassembly of `.spv` files using the `:edit` command and + assembly using the `:write` command. The plugin also provides additional + features which include; syntax highlighting; highlighting of all ID's matching + the ID under the cursor; and highlighting errors where the `Instruction` + operand of `OpExtInst` is used without an appropriate `OpExtInstImport`. + +* `50spirv-tools.el` - Automatically disassembles '.spv' binary files when + loaded into the emacs text editor, and re-assembles them when saved, + provided any modifications to the file are valid. This functionality + must be explicitly requested by defining the symbol + SPIRV_TOOLS_INSTALL_EMACS_HELPERS as follows: + ``` + cmake -DSPIRV_TOOLS_INSTALL_EMACS_HELPERS=true ... + ``` + + In addition, this helper is only installed if the directory /etc/emacs/site-start.d + exists, which is typically true if emacs is installed on the system. + + Note that symbol IDs are not currently preserved through a load/edit/save operation. + This may change if the ability is added to spirv-as. + + +### Tests + +Tests are only built when googletest is found. Use `ctest` to run all the +tests. + +## Future Work + + +_See the [projects pages](https://github.com/KhronosGroup/SPIRV-Tools/projects) +for more information._ + +### Assembler and disassembler + +* The disassembler could emit helpful annotations in comments. For example: + * Use variable name information from debug instructions to annotate + key operations on variables. + * Show control flow information by annotating `OpLabel` instructions with + that basic block's predecessors. +* Error messages could be improved. + +### Validator + +This is a work in progress. + +### Linker + +* The linker could accept math transformations such as allowing MADs, or other + math flags passed at linking-time in OpenCL. +* Linkage attributes can not be applied through a group. +* Check decorations of linked functions attributes. +* Remove dead instructions, such as OpName targeting imported symbols. + +## Licence + +Full license terms are in [LICENSE](LICENSE) +``` +Copyright (c) 2015-2016 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. +``` + +[spirv-tools-cla]: https://cla-assistant.io/KhronosGroup/SPIRV-Tools +[spirv-tools-projects]: https://github.com/KhronosGroup/SPIRV-Tools/projects +[spirv-tools-mailing-list]: https://www.khronos.org/spir/spirv-tools-mailing-list +[spirv-registry]: https://www.khronos.org/registry/spir-v/ +[spirv-headers]: https://github.com/KhronosGroup/SPIRV-Headers +[googletest]: https://github.com/google/googletest +[googletest-pull-612]: https://github.com/google/googletest/pull/612 +[googletest-issue-610]: https://github.com/google/googletest/issues/610 +[effcee]: https://github.com/google/effcee +[re2]: https://github.com/google/re2 +[CMake]: https://cmake.org/ +[cpp-style-guide]: https://google.github.io/styleguide/cppguide.html +[clang-sanitizers]: http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation +[master-tot-release]: https://github.com/KhronosGroup/SPIRV-Tools/releases/tag/master-tot diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/android_test/Android.mk b/3rdparty/bgfx/3rdparty/spirv-tools/android_test/Android.mk new file mode 100644 index 00000000000..dbaf93ba988 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/android_test/Android.mk @@ -0,0 +1,12 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_CPP_EXTENSION := .cc .cpp .cxx +LOCAL_SRC_FILES:=test.cpp +LOCAL_MODULE:=spirvtools_test +LOCAL_LDLIBS:=-landroid +LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror +LOCAL_STATIC_LIBRARIES=SPIRV-Tools SPIRV-Tools-opt +include $(BUILD_SHARED_LIBRARY) + +include $(LOCAL_PATH)/../Android.mk diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/android_test/jni/Application.mk b/3rdparty/bgfx/3rdparty/spirv-tools/android_test/jni/Application.mk new file mode 100644 index 00000000000..d7ccd349add --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/android_test/jni/Application.mk @@ -0,0 +1,5 @@ +APP_ABI := all +APP_BUILD_SCRIPT := Android.mk +APP_STL := gnustl_static +APP_PLATFORM := android-9 +NDK_TOOLCHAIN_VERSION := 4.9 diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/android_test/test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/android_test/test.cpp new file mode 100644 index 00000000000..e6a57c12793 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/android_test/test.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2017 Google 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. + +#include +#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/optimizer.hpp" + +void android_main(struct android_app* /*state*/) { + spvtools::SpirvTools tools(SPV_ENV_UNIVERSAL_1_2); + spvtools::Optimizer optimizer(SPV_ENV_UNIVERSAL_1_2); +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/build.gni b/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/build.gni new file mode 100644 index 00000000000..833fcd34974 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/build.gni @@ -0,0 +1,46 @@ +# Copyright 2018 Google 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Variable that can be used to support multiple build scenarios, like having +# Chromium specific targets in a client project's GN file etc. +build_with_chromium = false + +# Don't use Chromium's third_party/binutils. +linux_use_bundled_binutils_override = false + +declare_args() { + # Android 32-bit non-component, non-clang builds cannot have symbol_level=2 + # due to 4GiB file size limit, see https://crbug.com/648948. + # Set this flag to true to skip the assertion. + ignore_elf32_limitations = false + + # Use the system install of Xcode for tools like ibtool, libtool, etc. + # This does not affect the compiler. When this variable is false, targets will + # instead use a hermetic install of Xcode. [The hermetic install can be + # obtained with gclient sync after setting the environment variable + # FORCE_MAC_TOOLCHAIN]. + use_system_xcode = "" +} + +if (use_system_xcode == "") { + if (target_os == "mac") { + _result = exec_script("//build/mac/should_use_hermetic_xcode.py", + [ target_os ], + "value") + use_system_xcode = _result == 0 + } + if (target_os == "ios") { + use_system_xcode = true + } +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/gtest.gni b/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/gtest.gni new file mode 100644 index 00000000000..c8b1bae4c22 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/gtest.gni @@ -0,0 +1,25 @@ +# Copyright 2018 Google 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 +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Exclude support for registering main function in multi-process tests. +gtest_include_multiprocess = false + +# Exclude support for platform-specific operations across unit tests. +gtest_include_platform_test = false + +# Exclude support for testing Objective C code on OS X and iOS. +gtest_include_objc_support = false + +# Exclude support for flushing coverage files on iOS. +gtest_include_ios_coverage = false diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/spirv_tools.gni b/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/spirv_tools.gni new file mode 100644 index 00000000000..24aa033d7b1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/build_overrides/spirv_tools.gni @@ -0,0 +1,25 @@ +# Copyright 2018 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# These are variables that are overridable by projects that include +# SPIRV-Tools. The values in this file are the defaults for when we are +# building from SPIRV-Tools' repository. + +# Whether we are building from SPIRV-Tools' repository. +# MUST be set to false in other projects. +spirv_tools_standalone = true + +# The path to SPIRV-Tools' dependencies +spirv_tools_googletest_dir = "//external/googletest" +spirv_tools_spirv_headers_dir = "//external/spirv-headers" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/cmake/SPIRV-Tools-shared.pc.in b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/SPIRV-Tools-shared.pc.in new file mode 100644 index 00000000000..0dcaa27644b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/SPIRV-Tools-shared.pc.in @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: SPIRV-Tools +Description: Tools for SPIR-V +Version: @CURRENT_VERSION@ +URL: https://github.com/KhronosGroup/SPIRV-Tools + +Libs: -L${libdir} @SPIRV_SHARED_LIBRARIES@ +Cflags: -I${includedir} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/cmake/SPIRV-Tools.pc.in b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/SPIRV-Tools.pc.in new file mode 100644 index 00000000000..2984dc57fe2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/SPIRV-Tools.pc.in @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: SPIRV-Tools +Description: Tools for SPIR-V +Version: @CURRENT_VERSION@ +URL: https://github.com/KhronosGroup/SPIRV-Tools + +Libs: -L${libdir} @SPIRV_LIBRARIES@ +Cflags: -I${includedir} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/cmake/setup_build.cmake b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/setup_build.cmake new file mode 100644 index 00000000000..6ba4c53d733 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/setup_build.cmake @@ -0,0 +1,20 @@ +# Find nosetests; see spirv_add_nosetests() for opting in to nosetests in a +# specific directory. +find_program(NOSETESTS_EXE NAMES nosetests PATHS $ENV{PYTHON_PACKAGE_PATH}) +if (NOT NOSETESTS_EXE) + message(STATUS "SPIRV-Tools: nosetests was not found - python support code will not be tested") +else() + message(STATUS "SPIRV-Tools: nosetests found - python support code will be tested") +endif() + +# Run nosetests on file ${PREFIX}_nosetest.py. Nosetests will look for classes +# and functions whose names start with "nosetest". The test name will be +# ${PREFIX}_nosetests. +function(spirv_add_nosetests PREFIX) + if(NOT "${SPIRV_SKIP_TESTS}" AND NOSETESTS_EXE) + add_test( + NAME ${PREFIX}_nosetests + COMMAND ${NOSETESTS_EXE} -m "^[Nn]ose[Tt]est" -v + ${CMAKE_CURRENT_SOURCE_DIR}/${PREFIX}_nosetest.py) + endif() +endfunction() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/cmake/write_pkg_config.cmake b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/write_pkg_config.cmake new file mode 100644 index 00000000000..d367ce3e401 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/cmake/write_pkg_config.cmake @@ -0,0 +1,31 @@ +# Copyright (c) 2017 Pierre Moreau +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# First, retrieve the current version from CHANGES +file(STRINGS ${CHANGES_FILE} CHANGES_CONTENT) +string( +REGEX + MATCH "v[0-9]+(.[0-9]+)?(-dev)? [0-9]+-[0-9]+-[0-9]+" + FIRST_VERSION_LINE + ${CHANGES_CONTENT}) +string( +REGEX + REPLACE "^v([^ ]+) .+$" "\\1" + CURRENT_VERSION + "${FIRST_VERSION_LINE}") +# If this is a development version, replace "-dev" by ".0" as pkg-config nor +# CMake support "-dev" in the version. +# If it's not a "-dev" version then ensure it ends with ".1" +string(REGEX REPLACE "-dev.1" ".0" CURRENT_VERSION "${CURRENT_VERSION}.1") +configure_file(${TEMPLATE_FILE} ${OUT_FILE} @ONLY) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/codereview.settings b/3rdparty/bgfx/3rdparty/spirv-tools/codereview.settings new file mode 100644 index 00000000000..ef84cf85723 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/codereview.settings @@ -0,0 +1,2 @@ +# This file is used by git cl to get repository specific information. +CODE_REVIEW_SERVER: github.com diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/examples/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/examples/CMakeLists.txt new file mode 100644 index 00000000000..fd627cbdaea --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/examples/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (c) 2016 Google 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. + +# Add a SPIR-V Tools example. Signature: +# add_spvtools_example( +# TARGET target_name +# SRCS src_file1.cpp src_file2.cpp +# LIBS lib_target1 lib_target2 +# ) +function(add_spvtools_example) + if (NOT ${SPIRV_SKIP_EXECUTABLES}) + set(one_value_args TARGET) + set(multi_value_args SRCS LIBS) + cmake_parse_arguments( + ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + add_executable(${ARG_TARGET} ${ARG_SRCS}) + spvtools_default_compile_options(${ARG_TARGET}) + target_link_libraries(${ARG_TARGET} PRIVATE ${ARG_LIBS}) + set_property(TARGET ${ARG_TARGET} PROPERTY FOLDER "SPIRV-Tools examples") + endif() +endfunction() + +add_subdirectory(cpp-interface) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/examples/cpp-interface/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/examples/cpp-interface/CMakeLists.txt new file mode 100644 index 00000000000..d050b075972 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/examples/cpp-interface/CMakeLists.txt @@ -0,0 +1,19 @@ +# Copyright (c) 2016 Google 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. + +add_spvtools_example( + TARGET spirv-tools-cpp-example + SRCS main.cpp + LIBS SPIRV-Tools-opt +) \ No newline at end of file diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/examples/cpp-interface/main.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/examples/cpp-interface/main.cpp new file mode 100644 index 00000000000..c5354b8bdb7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/examples/cpp-interface/main.cpp @@ -0,0 +1,64 @@ +// Copyright (c) 2016 Google 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. + +// This program demonstrates basic SPIR-V module processing using +// SPIRV-Tools C++ API: +// * Assembling +// * Validating +// * Optimizing +// * Disassembling + +#include +#include +#include + +#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/optimizer.hpp" + +int main() { + const std::string source = + " OpCapability Shader " + " OpMemoryModel Logical GLSL450 " + " OpSource GLSL 450 " + " OpDecorate %spec SpecId 1 " + " %int = OpTypeInt 32 1 " + " %spec = OpSpecConstant %int 0 " + "%const = OpConstant %int 42"; + + spvtools::SpirvTools core(SPV_ENV_VULKAN_1_0); + spvtools::Optimizer opt(SPV_ENV_VULKAN_1_0); + + auto print_msg_to_stderr = [](spv_message_level_t, const char*, + const spv_position_t&, const char* m) { + std::cerr << "error: " << m << std::endl; + }; + core.SetMessageConsumer(print_msg_to_stderr); + opt.SetMessageConsumer(print_msg_to_stderr); + + std::vector spirv; + if (!core.Assemble(source, &spirv)) return 1; + if (!core.Validate(spirv)) return 1; + + opt.RegisterPass(spvtools::CreateSetSpecConstantDefaultValuePass({{1, "42"}})) + .RegisterPass(spvtools::CreateFreezeSpecConstantValuePass()) + .RegisterPass(spvtools::CreateUnifyConstantPass()) + .RegisterPass(spvtools::CreateStripDebugInfoPass()); + if (!opt.Run(spirv.data(), spirv.size(), &spirv)) return 1; + + std::string disassembly; + if (!core.Disassemble(spirv, &disassembly)) return 1; + std::cout << disassembly << "\n"; + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/external/CMakeLists.txt new file mode 100644 index 00000000000..da0b2e6497b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/CMakeLists.txt @@ -0,0 +1,122 @@ +# Copyright (c) 2015-2016 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. + +if (DEFINED SPIRV-Headers_SOURCE_DIR) + # This allows flexible position of the SPIRV-Headers repo. + set(SPIRV_HEADER_DIR ${SPIRV-Headers_SOURCE_DIR}) +else() + if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers) + set(SPIRV_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SPIRV-Headers) + else() + set(SPIRV_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers) + endif() +endif() + +if (IS_DIRECTORY ${SPIRV_HEADER_DIR}) + set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV_HEADER_DIR}/include PARENT_SCOPE) +else() + message(FATAL_ERROR + "SPIRV-Headers was not found - please checkout a copy under external/.") +endif() + +if (NOT ${SPIRV_SKIP_TESTS}) + # Find gmock if we can. If it's not already configured, then try finding + # it in external/googletest. + if (TARGET gmock) + message(STATUS "Google Mock already configured") + else() + set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock) + if(EXISTS ${GMOCK_DIR}) + if(MSVC) + # Our tests use ::testing::Combine. Work around a compiler + # detection problem in googletest, where that template is + # accidentally disabled for VS 2017. + # See https://github.com/google/googletest/issues/1352 + add_definitions(-DGTEST_HAS_COMBINE=1) + endif() + if(WIN32) + option(gtest_force_shared_crt + "Use shared (DLL) run-time lib even when Google Test is built as static lib." + ON) + endif() + add_subdirectory(${GMOCK_DIR} EXCLUDE_FROM_ALL) + endif() + endif() + if (TARGET gmock) + set(GTEST_TARGETS + gtest + gtest_main + gmock + gmock_main + ) + foreach(target ${GTEST_TARGETS}) + set_property(TARGET ${target} PROPERTY FOLDER GoogleTest) + endforeach() + endif() + + set(SPIRV_ENABLE_EFFCEE ON) + if (MSVC) + if (MSVC_VERSION LESS 1900) + message(STATUS "SPIRV-Tools: Need Visual Studio 2015 or later for Effcee and RE2") + set(SPIRV_ENABLE_EFFCEE OFF) + endif() + endif() + + if (SPIRV_ENABLE_EFFCEE) + # Find Effcee and RE2, for testing. + # Optional for now, but eventually we'll make this required. + + # First find RE2, since Effcee depends on it. + # If already configured, then use that. Otherwise, prefer to find it under 're2' + # in this directory. + if (NOT TARGET re2) + # If we are configuring RE2, then turn off its testing. It takes a long time and + # does not add much value for us. If an enclosing project configured RE2, then it + # has already chosen whether to enable RE2 tesitng. + set(RE2_BUILD_TESTING OFF CACHE STRING "Run RE2 Tests") + if (NOT RE2_SOURCE_DIR) + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/re2) + set(RE2_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/re2" CACHE STRING "RE2 source dir" ) + endif() + endif() + endif() + + if (NOT TARGET effcee) + # Expect to find effcee in this directory. + if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/effcee) + # If we're configuring RE2 (via Effcee), then turn off RE2 testing. + if (NOT TARGET re2) + set(RE2_BUILD_TESTING OFF) + endif() + if (MSVC) + # SPIRV-Tools uses the shared CRT with MSVC. Tell Effcee to do the same. + set(EFFCEE_ENABLE_SHARED_CRT ON) + endif() + add_subdirectory(effcee) + set_property(TARGET effcee PROPERTY FOLDER Effcee) + # Turn off warnings for effcee and re2 + set_property(TARGET effcee APPEND PROPERTY COMPILE_OPTIONS -w) + set_property(TARGET re2 APPEND PROPERTY COMPILE_OPTIONS -w) + endif() + endif() + # TODO(dneto): Eventually, require this. + endif() + if (TARGET effcee) + message(STATUS "SPIRV-Tools: Effcee is configured") + else() + message(STATUS "SPIRV-Tools: Effcee is not configured. Skipping Effcee-based tests.") + endif() + +endif() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/.gitattributes b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/.gitattributes new file mode 100644 index 00000000000..3fa5aaf1655 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/.gitattributes @@ -0,0 +1,7 @@ +*.json text +*.h text +*.hpp text +*.hpp11 text +*.lua text +*.py text +*.xml diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/.gitignore b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/.gitignore new file mode 100644 index 00000000000..9bcdd5aba5a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/.gitignore @@ -0,0 +1,2 @@ +build +out diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/CMakeLists.txt new file mode 100644 index 00000000000..2488baf0ad8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/CMakeLists.txt @@ -0,0 +1,60 @@ +# Copyright (c) 2015-2016 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and/or associated documentation files (the +# "Materials"), to deal in the Materials without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Materials, and to +# permit persons to whom the Materials are furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Materials. +# +# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +# KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +# SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT +# https://www.khronos.org/registry/ +# +# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +# +# The SPIR-V headers from the SPIR-V Registry +# https://www.khronos.org/registry/spir-v/ +# +cmake_minimum_required(VERSION 2.8.11) +project(SPIRV-Headers) + +# There are two ways to use this project. +# +# Using this source tree directly from a CMake-based project: +# 1. Add an add_subdirectory directive to include this sub directory. +# 2. Use ${SPIRV-Headers_SOURCE_DIR}/include} in a target_include_directories +# command. +# +# Installing the headers first, then using them with an implicit include +# directory. To install the headers: +# 1. mkdir build ; cd build +# 2. cmake .. +# 3. cmake --build . --target install + +file(GLOB_RECURSE HEADER_FILES + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + include/spirv/*) +foreach(HEADER_FILE ${HEADER_FILES}) + get_filename_component(HEADER_INSTALL_DIR ${HEADER_FILE} PATH) + install(FILES ${HEADER_FILE} DESTINATION ${HEADER_INSTALL_DIR}) +endforeach() + +# legacy +add_custom_target(install-headers + COMMAND cmake -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv + $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/include/spirv) + +add_subdirectory(example) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/LICENSE b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/LICENSE new file mode 100644 index 00000000000..47974f8ce39 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2015-2018 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and/or associated documentation files (the +"Materials"), to deal in the Materials without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Materials, and to +permit persons to whom the Materials are furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Materials. + +MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT + https://www.khronos.org/registry/ + +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/README.md b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/README.md new file mode 100644 index 00000000000..846b20d802c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/README.md @@ -0,0 +1,124 @@ +# SPIR-V Headers + +This repository contains machine-readable files for the +[SPIR-V Registry](https://www.khronos.org/registry/spir-v/). +This includes: + +* Header files for various languages. +* JSON files describing the grammar for the SPIR-V core instruction set + and the extended instruction sets. +* The XML registry file. +* A tool to build the headers from the JSON grammar. + +Headers are provided in the [include](include) directory, with up-to-date +headers in the `unified1` subdirectory. Older headers are provided according to +their version. + +In contrast, the XML registry file has a linear history, so it is +not tied to SPIR-V specification versions. + +## How is this repository updated? + +When a new version or revision of the SPIR-V specification is published, +the SPIR-V Working Group will push new commits onto master, updating +the files under [include](include). + +The SPIR-V XML registry file is updated by Khronos whenever a new enum range is allocated. + +Pull requests can be made to +- request allocation of new enum ranges in the XML registry file +- reserve specific tokens in the JSON grammar + +## How to install the headers + +``` +mkdir build +cd build +cmake .. +cmake --build . --target install +``` + +Then, for example, you will have `/usr/local/include/spirv/unified1/spirv.h` + +If you want to install them somewhere else, then use +`-DCMAKE_INSTALL_PREFIX=/other/path` on the first `cmake` command. + +## Using the headers without installing + +A CMake-based project can use the headers without installing, as follows: + +1. Add an `add_subdirectory` directive to include this source tree. +2. Use `${SPIRV-Headers_SOURCE_DIR}/include}` in a `target_include_directories` + directive. +3. In your C or C++ source code use `#include` directives that explicitly mention + the `spirv` path component. +``` +#include "spirv/unified1/GLSL.std.450.h" +#include "spirv/unified1/OpenCL.std.h" +#include "spirv/unified1/spirv.hpp" +``` + +See also the [example](example/) subdirectory. But since that example is +*inside* this repostory, it doesn't use and `add_subdirectory` directive. + +## Generating the headers from the JSON grammar + +This will generally be done by Khronos, for a change to the JSON grammar. +However, the project for the tool to do this is included in this repository, +and can be used to test a PR, or even to include the results in the PR. +This is not required though. + +The header-generation project is under the `tools/buildHeaders` directory. +Use CMake to build the project, in a `build` subdirectory (under `tools/buildHeaders`). +There is then a bash script at `bin/makeHeaders` that shows how to use the built +header-generator binary to generate the headers from the JSON grammar. +(Execute `bin/makeHeaders` from the `tools/buildHeaders` directory.) + +Notes: +- this generator is used in a broader context within Khronos to generate the specification, + and that influences the languages used, for legacy reasons +- the C++ structures built may similarly include more than strictly necessary, for the same reason + +## FAQ + +* *How are different versions published?* + + The multiple versions of the headers have been simplified into a + single `unified1` view. The JSON grammar has a "version" field saying + what version things first showed up in. + +* *How do you handle the evolution of extended instruction sets?* + + Extended instruction sets evolve asynchronously from the core spec. + Right now there is only a single version of both the GLSL and OpenCL + headers. So we don't yet have a problematic example to resolve. + +## License + +``` +Copyright (c) 2015-2018 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and/or associated documentation files (the +"Materials"), to deal in the Materials without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Materials, and to +permit persons to whom the Materials are furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Materials. + +MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT + https://www.khronos.org/registry/ + +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +``` diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/CMakeLists.txt new file mode 100644 index 00000000000..dff65d91848 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(SPIRV-Headers-example + ${CMAKE_CURRENT_SOURCE_DIR}/example.cpp) +target_include_directories(SPIRV-Headers-example + PRIVATE ${SPIRV-Headers_SOURCE_DIR}/include) + +add_library(SPIRV-Headers-example-1.1 + ${CMAKE_CURRENT_SOURCE_DIR}/example-1.1.cpp) +target_include_directories(SPIRV-Headers-example-1.1 + PRIVATE ${SPIRV-Headers_SOURCE_DIR}/include) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/example-1.1.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/example-1.1.cpp new file mode 100644 index 00000000000..989d35c443a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/example-1.1.cpp @@ -0,0 +1,42 @@ +// Copyright (c) 2016 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and/or associated documentation files (the +// "Materials"), to deal in the Materials without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Materials, and to +// permit persons to whom the Materials are furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT +// https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +// Use the SPIR-V 1.1 core instruction set, but with 1.0 versions +// of the GLSL and OpenCL extended instruction sets. +#include +#include +#include + +namespace { + +const GLSLstd450 kSin = GLSLstd450Sin; +const OpenCLLIB::Entrypoints kNative_cos = OpenCLLIB::Native_cos; +const spv::Op kNop = spv::OpNop; + +// This instruction is new in SPIR-V 1.1. +const spv::Op kNamedBarrierInit = spv::OpNamedBarrierInitialize; + +} // anonymous namespace diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/example.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/example.cpp new file mode 100644 index 00000000000..222c101d44f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/example/example.cpp @@ -0,0 +1,37 @@ +// Copyright (c) 2016 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and/or associated documentation files (the +// "Materials"), to deal in the Materials without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Materials, and to +// permit persons to whom the Materials are furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS +// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS +// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT +// https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + +#include +#include +#include + +namespace { + +const GLSLstd450 kSin = GLSLstd450Sin; +const OpenCLLIB::Entrypoints kNative_cos = OpenCLLIB::Native_cos; +const spv::Op kNop = spv::OpNop; + +} // anonymous namespace diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/GLSL.std.450.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/GLSL.std.450.h new file mode 100644 index 00000000000..54cc00e9a88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/GLSL.std.450.h @@ -0,0 +1,131 @@ +/* +** Copyright (c) 2014-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef GLSLstd450_H +#define GLSLstd450_H + +static const int GLSLstd450Version = 100; +static const int GLSLstd450Revision = 3; + +enum GLSLstd450 { + GLSLstd450Bad = 0, // Don't use + + GLSLstd450Round = 1, + GLSLstd450RoundEven = 2, + GLSLstd450Trunc = 3, + GLSLstd450FAbs = 4, + GLSLstd450SAbs = 5, + GLSLstd450FSign = 6, + GLSLstd450SSign = 7, + GLSLstd450Floor = 8, + GLSLstd450Ceil = 9, + GLSLstd450Fract = 10, + + GLSLstd450Radians = 11, + GLSLstd450Degrees = 12, + GLSLstd450Sin = 13, + GLSLstd450Cos = 14, + GLSLstd450Tan = 15, + GLSLstd450Asin = 16, + GLSLstd450Acos = 17, + GLSLstd450Atan = 18, + GLSLstd450Sinh = 19, + GLSLstd450Cosh = 20, + GLSLstd450Tanh = 21, + GLSLstd450Asinh = 22, + GLSLstd450Acosh = 23, + GLSLstd450Atanh = 24, + GLSLstd450Atan2 = 25, + + GLSLstd450Pow = 26, + GLSLstd450Exp = 27, + GLSLstd450Log = 28, + GLSLstd450Exp2 = 29, + GLSLstd450Log2 = 30, + GLSLstd450Sqrt = 31, + GLSLstd450InverseSqrt = 32, + + GLSLstd450Determinant = 33, + GLSLstd450MatrixInverse = 34, + + GLSLstd450Modf = 35, // second operand needs an OpVariable to write to + GLSLstd450ModfStruct = 36, // no OpVariable operand + GLSLstd450FMin = 37, + GLSLstd450UMin = 38, + GLSLstd450SMin = 39, + GLSLstd450FMax = 40, + GLSLstd450UMax = 41, + GLSLstd450SMax = 42, + GLSLstd450FClamp = 43, + GLSLstd450UClamp = 44, + GLSLstd450SClamp = 45, + GLSLstd450FMix = 46, + GLSLstd450IMix = 47, // Reserved + GLSLstd450Step = 48, + GLSLstd450SmoothStep = 49, + + GLSLstd450Fma = 50, + GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to + GLSLstd450FrexpStruct = 52, // no OpVariable operand + GLSLstd450Ldexp = 53, + + GLSLstd450PackSnorm4x8 = 54, + GLSLstd450PackUnorm4x8 = 55, + GLSLstd450PackSnorm2x16 = 56, + GLSLstd450PackUnorm2x16 = 57, + GLSLstd450PackHalf2x16 = 58, + GLSLstd450PackDouble2x32 = 59, + GLSLstd450UnpackSnorm2x16 = 60, + GLSLstd450UnpackUnorm2x16 = 61, + GLSLstd450UnpackHalf2x16 = 62, + GLSLstd450UnpackSnorm4x8 = 63, + GLSLstd450UnpackUnorm4x8 = 64, + GLSLstd450UnpackDouble2x32 = 65, + + GLSLstd450Length = 66, + GLSLstd450Distance = 67, + GLSLstd450Cross = 68, + GLSLstd450Normalize = 69, + GLSLstd450FaceForward = 70, + GLSLstd450Reflect = 71, + GLSLstd450Refract = 72, + + GLSLstd450FindILsb = 73, + GLSLstd450FindSMsb = 74, + GLSLstd450FindUMsb = 75, + + GLSLstd450InterpolateAtCentroid = 76, + GLSLstd450InterpolateAtSample = 77, + GLSLstd450InterpolateAtOffset = 78, + + GLSLstd450NMin = 79, + GLSLstd450NMax = 80, + GLSLstd450NClamp = 81, + + GLSLstd450Count +}; + +#endif // #ifndef GLSLstd450_H diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/OpenCL.std.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/OpenCL.std.h new file mode 100644 index 00000000000..19a6688490c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/OpenCL.std.h @@ -0,0 +1,210 @@ +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +namespace OpenCLLIB { + +enum Entrypoints { + + // Section 2.1: Math extended instructions + Acos = 0, + Acosh = 1, + Acospi = 2, + Asin = 3, + Asinh = 4, + Asinpi = 5, + Atan = 6, + Atan2 = 7, + Atanh = 8, + Atanpi = 9, + Atan2pi = 10, + Cbrt = 11, + Ceil = 12, + Copysign = 13, + Cos = 14, + Cosh = 15, + Cospi = 16, + Erfc = 17, + Erf = 18, + Exp = 19, + Exp2 = 20, + Exp10 = 21, + Expm1 = 22, + Fabs = 23, + Fdim = 24, + Floor = 25, + Fma = 26, + Fmax = 27, + Fmin = 28, + Fmod = 29, + Fract = 30, + Frexp = 31, + Hypot = 32, + Ilogb = 33, + Ldexp = 34, + Lgamma = 35, + Lgamma_r = 36, + Log = 37, + Log2 = 38, + Log10 = 39, + Log1p = 40, + Logb = 41, + Mad = 42, + Maxmag = 43, + Minmag = 44, + Modf = 45, + Nan = 46, + Nextafter = 47, + Pow = 48, + Pown = 49, + Powr = 50, + Remainder = 51, + Remquo = 52, + Rint = 53, + Rootn = 54, + Round = 55, + Rsqrt = 56, + Sin = 57, + Sincos = 58, + Sinh = 59, + Sinpi = 60, + Sqrt = 61, + Tan = 62, + Tanh = 63, + Tanpi = 64, + Tgamma = 65, + Trunc = 66, + Half_cos = 67, + Half_divide = 68, + Half_exp = 69, + Half_exp2 = 70, + Half_exp10 = 71, + Half_log = 72, + Half_log2 = 73, + Half_log10 = 74, + Half_powr = 75, + Half_recip = 76, + Half_rsqrt = 77, + Half_sin = 78, + Half_sqrt = 79, + Half_tan = 80, + Native_cos = 81, + Native_divide = 82, + Native_exp = 83, + Native_exp2 = 84, + Native_exp10 = 85, + Native_log = 86, + Native_log2 = 87, + Native_log10 = 88, + Native_powr = 89, + Native_recip = 90, + Native_rsqrt = 91, + Native_sin = 92, + Native_sqrt = 93, + Native_tan = 94, + + // Section 2.2: Integer instructions + SAbs = 141, + SAbs_diff = 142, + SAdd_sat = 143, + UAdd_sat = 144, + SHadd = 145, + UHadd = 146, + SRhadd = 147, + URhadd = 148, + SClamp = 149, + UClamp = 150, + Clz = 151, + Ctz = 152, + SMad_hi = 153, + UMad_sat = 154, + SMad_sat = 155, + SMax = 156, + UMax = 157, + SMin = 158, + UMin = 159, + SMul_hi = 160, + Rotate = 161, + SSub_sat = 162, + USub_sat = 163, + U_Upsample = 164, + S_Upsample = 165, + Popcount = 166, + SMad24 = 167, + UMad24 = 168, + SMul24 = 169, + UMul24 = 170, + UAbs = 201, + UAbs_diff = 202, + UMul_hi = 203, + UMad_hi = 204, + + // Section 2.3: Common instructions + FClamp = 95, + Degrees = 96, + FMax_common = 97, + FMin_common = 98, + Mix = 99, + Radians = 100, + Step = 101, + Smoothstep = 102, + Sign = 103, + + // Section 2.4: Geometric instructions + Cross = 104, + Distance = 105, + Length = 106, + Normalize = 107, + Fast_distance = 108, + Fast_length = 109, + Fast_normalize = 110, + + // Section 2.5: Relational instructions + Bitselect = 186, + Select = 187, + + // Section 2.6: Vector Data Load and Store instructions + Vloadn = 171, + Vstoren = 172, + Vload_half = 173, + Vload_halfn = 174, + Vstore_half = 175, + Vstore_half_r = 176, + Vstore_halfn = 177, + Vstore_halfn_r = 178, + Vloada_halfn = 179, + Vstorea_halfn = 180, + Vstorea_halfn_r = 181, + + // Section 2.7: Miscellaneous Vector instructions + Shuffle = 182, + Shuffle2 = 183, + + // Section 2.8: Misc instructions + Printf = 184, + Prefetch = 185, +}; + +} // end namespace OpenCLLIB diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json new file mode 100644 index 00000000000..3d9f39e76c9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json @@ -0,0 +1,642 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "Round", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "RoundEven", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Trunc", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FAbs", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SAbs", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FSign", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SSign", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Floor", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ceil", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fract", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Radians", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "Degrees", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "Sin", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tan", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asin", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acos", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'y_over_x'" } + ] + }, + { + "opname" : "Sinh", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cosh", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tanh", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asinh", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acosh", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atanh", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan2", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Pow", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Exp", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Exp2", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log2", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Sqrt", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "InverseSqrt", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Determinant", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "MatrixInverse", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Modf", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "ModfStruct", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FMin", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMin", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMin", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FMax", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMax", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMax", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FClamp", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "UClamp", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "SClamp", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "FMix", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "IMix", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "Step", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SmoothStep", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fma", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "Frexp", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "FrexpStruct", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ldexp", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "PackSnorm4x8", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm4x8", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackSnorm2x16", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm2x16", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackHalf2x16", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackDouble2x32", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "UnpackSnorm2x16", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm2x16", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackHalf2x16", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "UnpackSnorm4x8", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm4x8", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackDouble2x32", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "Length", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Distance", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "Cross", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Normalize", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FaceForward", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'Nref'" } + ] + }, + { + "opname" : "Reflect", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" } + ] + }, + { + "opname" : "Refract", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'eta'" } + ] + }, + { + "opname" : "FindILsb", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindSMsb", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindUMsb", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "InterpolateAtCentroid", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtSample", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'sample'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtOffset", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'offset'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "NMin", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NMax", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NClamp", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json new file mode 100644 index 00000000000..4fe45060bb9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json @@ -0,0 +1,1279 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "acos", + "opcode" : 0, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acosh", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acospi", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asin", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinh", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinpi", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanh", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanpi", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2pi", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cbrt", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ceil", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "copysign", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cosh", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cospi", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erfc", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erf", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp2", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp10", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "expm1", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fabs", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fdim", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "floor", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fma", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fmax", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmod", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fract", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'ptr'" } + ] + }, + { + "opname" : "frexp", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "hypot", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "ilogb", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ldexp", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'k'" } + ] + }, + { + "opname" : "lgamma", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "lgamma_r", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'signp'" } + ] + }, + { + "opname" : "log", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log2", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log10", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log1p", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "logb", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "mad", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "maxmag", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "minmag", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "modf", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'iptr'" } + ] + }, + { + "opname" : "nan", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'nancode'" } + ] + }, + { + "opname" : "nextafter", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "pow", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y" } + ] + }, + { + "opname" : "pown", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "powr", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remainder", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remquo", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'quo'" } + ] + }, + { + "opname" : "rint", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rootn", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "round", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rsqrt", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sin", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sincos", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'cosval'" } + ] + }, + { + "opname" : "sinh", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sinpi", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sqrt", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tan", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanh", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanpi", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tgamma", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "trunc", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_cos", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_divide", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_exp", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp2", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp10", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log2", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log10", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_powr", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_recip", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_rsqrt", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sin", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sqrt", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_tan", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_cos", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_divide", + "opcode" : 82, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_exp", + "opcode" : 83, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp2", + "opcode" : 84, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp10", + "opcode" : 85, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log", + "opcode" : 86, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log2", + "opcode" : 87, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log10", + "opcode" : 88, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_powr", + "opcode" : 89, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_recip", + "opcode" : 90, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_rsqrt", + "opcode" : 91, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sin", + "opcode" : 92, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sqrt", + "opcode" : 93, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_tan", + "opcode" : 94, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs", + "opcode" : 141, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs_diff", + "opcode" : 142, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_add_sat", + "opcode" : 143, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_add_sat", + "opcode" : 144, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_hadd", + "opcode" : 145, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_hadd", + "opcode" : 146, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_rhadd", + "opcode" : 147, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_rhadd", + "opcode" : 148, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_clamp", + "opcode" : 149, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "u_clamp", + "opcode" : 150, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "clz", + "opcode" : 151, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ctz", + "opcode" : 152, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad_hi", + "opcode" : 153, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "u_mad_sat", + "opcode" : 154, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mad_sat", + "opcode" : 155, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_max", + "opcode" : 156, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_max", + "opcode" : 157, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_min", + "opcode" : 158, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_min", + "opcode" : 159, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_mul_hi", + "opcode" : 160, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "rotate", + "opcode" : 161, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "s_sub_sat", + "opcode" : 162, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_sub_sat", + "opcode" : 163, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_upsample", + "opcode" : 164, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "s_upsample", + "opcode" : 165, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "popcount", + "opcode" : 166, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad24", + "opcode" : 167, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "u_mad24", + "opcode" : 168, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mul24", + "opcode" : 169, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul24", + "opcode" : 170, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_abs", + "opcode" : 201, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "u_abs_diff", + "opcode" : 202, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul_hi", + "opcode" : 203, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mad_hi", + "opcode" : 204, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fclamp", + "opcode" : 95, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "degrees", + "opcode" :96, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "fmax_common", + "opcode" : 97, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin_common", + "opcode" : 98, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "mix", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "radians", + "opcode" : 100, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "step", + "opcode" : 101, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "smoothstep", + "opcode" : 102, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sign", + "opcode" : 103, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cross", + "opcode" : 104, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "distance", + "opcode" : 105, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "length", + "opcode" : 106, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "normalize", + "opcode" : 107, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_distance", + "opcode" : 108, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "fast_length", + "opcode" : 109, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_normalize", + "opcode" : 110, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "bitselect", + "opcode" : 186, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "select", + "opcode" : 187, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "vloadn", + "opcode" : 171, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstoren", + "opcode" : 172, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_half", + "opcode" : 173, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_halfn", + "opcode" : 174, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstore_half", + "opcode" : 175, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_half_r", + "opcode" : 176, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vstore_halfn", + "opcode" : 177, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_halfn_r", + "opcode" : 178, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vloada_halfn", + "opcode" : 179, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstorea_halfn", + "opcode" : 180, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstorea_halfn_r", + "opcode" : 181, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "shuffle", + "opcode" : 182, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "shuffle2", + "opcode" : 183, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "printf", + "opcode" : 184, + "operands" : [ + { "kind" : "IdRef", "name" : "'format'" }, + { "kind" : "IdRef", "name" : "'additional arguments'", "quantifier" : "*" } + ] + }, + { + "opname" : "prefetch", + "opcode" : 185, + "operands" : [ + { "kind" : "IdRef", "name" : "'ptr'" }, + { "kind" : "IdRef", "name" : "'num elements'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.core.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.core.grammar.json new file mode 100644 index 00000000000..f3cfc4c299b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.core.grammar.json @@ -0,0 +1,5775 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "magic_number" : "0x07230203", + "major_version" : 1, + "minor_version" : 0, + "revision" : 12, + "instructions" : [ + { + "opname" : "OpNop", + "opcode" : 0 + }, + { + "opname" : "OpUndef", + "opcode" : 1, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSourceContinued", + "opcode" : 2, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Continued Source'" } + ] + }, + { + "opname" : "OpSource", + "opcode" : 3, + "operands" : [ + { "kind" : "SourceLanguage" }, + { "kind" : "LiteralInteger", "name" : "'Version'" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'File'" }, + { "kind" : "LiteralString", "quantifier" : "?", "name" : "'Source'" } + ] + }, + { + "opname" : "OpSourceExtension", + "opcode" : 4, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Extension'" } + ] + }, + { + "opname" : "OpName", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpMemberName", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpString", + "opcode" : 7, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'String'" } + ] + }, + { + "opname" : "OpLine", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'File'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" } + ] + }, + { + "opname" : "OpExtension", + "opcode" : 10, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInstImport", + "opcode" : 11, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInst", + "opcode" : 12, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Set'" }, + { "kind" : "LiteralExtInstInteger", "name" : "'Instruction'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Operand 1', +\n'Operand 2', +\n..." } + ] + }, + { + "opname" : "OpMemoryModel", + "opcode" : 14, + "operands" : [ + { "kind" : "AddressingModel" }, + { "kind" : "MemoryModel" } + ] + }, + { + "opname" : "OpEntryPoint", + "opcode" : 15, + "operands" : [ + { "kind" : "ExecutionModel" }, + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Interface'" } + ] + }, + { + "opname" : "OpExecutionMode", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "ExecutionMode", "name" : "'Mode'" } + ] + }, + { + "opname" : "OpCapability", + "opcode" : 17, + "operands" : [ + { "kind" : "Capability", "name" : "'Capability'" } + ] + }, + { + "opname" : "OpTypeVoid", + "opcode" : 19, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeBool", + "opcode" : 20, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeInt", + "opcode" : 21, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" }, + { "kind" : "LiteralInteger", "name" : "'Signedness'" } + ] + }, + { + "opname" : "OpTypeFloat", + "opcode" : 22, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" } + ] + }, + { + "opname" : "OpTypeVector", + "opcode" : 23, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Component Type'" }, + { "kind" : "LiteralInteger", "name" : "'Component Count'" } + ] + }, + { + "opname" : "OpTypeMatrix", + "opcode" : 24, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Column Type'" }, + { "kind" : "LiteralInteger", "name" : "'Column Count'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpTypeImage", + "opcode" : 25, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Type'" }, + { "kind" : "Dim" }, + { "kind" : "LiteralInteger", "name" : "'Depth'" }, + { "kind" : "LiteralInteger", "name" : "'Arrayed'" }, + { "kind" : "LiteralInteger", "name" : "'MS'" }, + { "kind" : "LiteralInteger", "name" : "'Sampled'" }, + { "kind" : "ImageFormat" }, + { "kind" : "AccessQualifier", "quantifier" : "?" } + ] + }, + { + "opname" : "OpTypeSampler", + "opcode" : 26, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeSampledImage", + "opcode" : 27, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image Type'" } + ] + }, + { + "opname" : "OpTypeArray", + "opcode" : 28, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" }, + { "kind" : "IdRef", "name" : "'Length'" } + ] + }, + { + "opname" : "OpTypeRuntimeArray", + "opcode" : 29, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpTypeStruct", + "opcode" : 30, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Member 0 type', +\n'member 1 type', +\n..." } + ] + }, + { + "opname" : "OpTypeOpaque", + "opcode" : 31, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "The name of the opaque type." } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypePointer", + "opcode" : 32, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "name" : "'Type'" } + ] + }, + { + "opname" : "OpTypeFunction", + "opcode" : 33, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Return Type'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..." } + ] + }, + { + "opname" : "OpTypeEvent", + "opcode" : 34, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypeDeviceEvent", + "opcode" : 35, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypeReserveId", + "opcode" : 36, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeQueue", + "opcode" : 37, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypePipe", + "opcode" : 38, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "AccessQualifier", "name" : "'Qualifier'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeForwardPointer", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer Type'" }, + { "kind" : "StorageClass" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpConstantTrue", + "opcode" : 41, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstantFalse", + "opcode" : 42, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstant", + "opcode" : 43, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConstantComposite", + "opcode" : 44, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpConstantSampler", + "opcode" : 45, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "SamplerAddressingMode" }, + { "kind" : "LiteralInteger", "name" : "'Param'" }, + { "kind" : "SamplerFilterMode" } + ], + "capabilities" : [ "LiteralSampler" ] + }, + { + "opname" : "OpConstantNull", + "opcode" : 46, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantTrue", + "opcode" : 48, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantFalse", + "opcode" : 49, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstant", + "opcode" : 50, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpSpecConstantComposite", + "opcode" : 51, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpSpecConstantOp", + "opcode" : 52, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralSpecConstantOpInteger", "name" : "'Opcode'" } + ] + }, + { + "opname" : "OpFunction", + "opcode" : 54, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "FunctionControl" }, + { "kind" : "IdRef", "name" : "'Function Type'" } + ] + }, + { + "opname" : "OpFunctionParameter", + "opcode" : 55, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpFunctionEnd", + "opcode" : 56 + }, + { + "opname" : "OpFunctionCall", + "opcode" : 57, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Function'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Argument 0', +\n'Argument 1', +\n..." } + ] + }, + { + "opname" : "OpVariable", + "opcode" : 59, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'Initializer'" } + ] + }, + { + "opname" : "OpImageTexelPointer", + "opcode" : 60, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Sample'" } + ] + }, + { + "opname" : "OpLoad", + "opcode" : 61, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpStore", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemory", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemorySized", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpAccessChain", + "opcode" : 65, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpInBoundsAccessChain", + "opcode" : 66, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpPtrAccessChain", + "opcode" : 67, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ + "Addresses", + "VariablePointers", + "VariablePointersStorageBuffer" + ] + }, + { + "opname" : "OpArrayLength", + "opcode" : 68, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Structure'" }, + { "kind" : "LiteralInteger", "name" : "'Array member'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpGenericPtrMemSemantics", + "opcode" : 69, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpInBoundsPtrAccessChain", + "opcode" : 70, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpDecorate", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpMemberDecorate", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'Structure Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpDecorationGroup", + "opcode" : 73, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpGroupDecorate", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpGroupMemberDecorate", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "PairIdRefLiteralInteger", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpVectorExtractDynamic", + "opcode" : 77, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorInsertDynamic", + "opcode" : 78, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorShuffle", + "opcode" : 79, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Components'" } + ] + }, + { + "opname" : "OpCompositeConstruct", + "opcode" : 80, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpCompositeExtract", + "opcode" : 81, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCompositeInsert", + "opcode" : 82, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCopyObject", + "opcode" : 83, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpTranspose", + "opcode" : 84, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpSampledImage", + "opcode" : 86, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Sampler'" } + ] + }, + { + "opname" : "OpImageSampleImplicitLod", + "opcode" : 87, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleExplicitLod", + "opcode" : 88, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ] + }, + { + "opname" : "OpImageSampleDrefImplicitLod", + "opcode" : 89, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleDrefExplicitLod", + "opcode" : 90, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjImplicitLod", + "opcode" : 91, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjExplicitLod", + "opcode" : 92, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefImplicitLod", + "opcode" : 93, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefExplicitLod", + "opcode" : 94, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageFetch", + "opcode" : 95, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageGather", + "opcode" : 96, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageDrefGather", + "opcode" : 97, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageRead", + "opcode" : 98, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageWrite", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Texel'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImage", + "opcode" : 100, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" } + ] + }, + { + "opname" : "OpImageQueryFormat", + "opcode" : 101, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQueryOrder", + "opcode" : 102, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQuerySizeLod", + "opcode" : 103, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Level of Detail'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySize", + "opcode" : 104, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLod", + "opcode" : 105, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLevels", + "opcode" : 106, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySamples", + "opcode" : 107, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpConvertFToU", + "opcode" : 109, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertFToS", + "opcode" : 110, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertSToF", + "opcode" : 111, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpConvertUToF", + "opcode" : 112, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpUConvert", + "opcode" : 113, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpSConvert", + "opcode" : 114, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpFConvert", + "opcode" : 115, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpQuantizeToF16", + "opcode" : 116, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConvertPtrToU", + "opcode" : 117, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpSatConvertSToU", + "opcode" : 118, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSatConvertUToS", + "opcode" : 119, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpConvertUToPtr", + "opcode" : 120, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Integer Value'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpPtrCastToGeneric", + "opcode" : 121, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtr", + "opcode" : 122, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtrExplicit", + "opcode" : 123, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "StorageClass", "name" : "'Storage'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpBitcast", + "opcode" : 124, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSNegate", + "opcode" : 126, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpFNegate", + "opcode" : 127, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpIAdd", + "opcode" : 128, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFAdd", + "opcode" : 129, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISub", + "opcode" : 130, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFSub", + "opcode" : 131, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpIMul", + "opcode" : 132, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMul", + "opcode" : 133, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUDiv", + "opcode" : 134, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSDiv", + "opcode" : 135, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFDiv", + "opcode" : 136, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMod", + "opcode" : 137, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSRem", + "opcode" : 138, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMod", + "opcode" : 139, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFRem", + "opcode" : 140, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMod", + "opcode" : 141, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpVectorTimesScalar", + "opcode" : 142, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ] + }, + { + "opname" : "OpMatrixTimesScalar", + "opcode" : 143, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpVectorTimesMatrix", + "opcode" : 144, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesVector", + "opcode" : 145, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesMatrix", + "opcode" : 146, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'LeftMatrix'" }, + { "kind" : "IdRef", "name" : "'RightMatrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpOuterProduct", + "opcode" : 147, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpDot", + "opcode" : 148, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ] + }, + { + "opname" : "OpIAddCarry", + "opcode" : 149, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISubBorrow", + "opcode" : 150, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMulExtended", + "opcode" : 151, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMulExtended", + "opcode" : 152, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpAny", + "opcode" : 154, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpAll", + "opcode" : 155, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpIsNan", + "opcode" : 156, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsInf", + "opcode" : 157, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsFinite", + "opcode" : 158, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpIsNormal", + "opcode" : 159, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSignBitSet", + "opcode" : 160, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLessOrGreater", + "opcode" : 161, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpOrdered", + "opcode" : 162, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpUnordered", + "opcode" : 163, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLogicalEqual", + "opcode" : 164, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNotEqual", + "opcode" : 165, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalOr", + "opcode" : 166, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalAnd", + "opcode" : 167, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNot", + "opcode" : 168, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSelect", + "opcode" : 169, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'Object 1'" }, + { "kind" : "IdRef", "name" : "'Object 2'" } + ] + }, + { + "opname" : "OpIEqual", + "opcode" : 170, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpINotEqual", + "opcode" : 171, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThan", + "opcode" : 172, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThan", + "opcode" : 173, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThanEqual", + "opcode" : 174, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThanEqual", + "opcode" : 175, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThan", + "opcode" : 176, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThan", + "opcode" : 177, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThanEqual", + "opcode" : 178, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThanEqual", + "opcode" : 179, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdEqual", + "opcode" : 180, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordEqual", + "opcode" : 181, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdNotEqual", + "opcode" : 182, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordNotEqual", + "opcode" : 183, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThan", + "opcode" : 184, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThan", + "opcode" : 185, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThan", + "opcode" : 186, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThan", + "opcode" : 187, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThanEqual", + "opcode" : 188, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThanEqual", + "opcode" : 189, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThanEqual", + "opcode" : 190, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThanEqual", + "opcode" : 191, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpShiftRightLogical", + "opcode" : 194, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftRightArithmetic", + "opcode" : 195, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftLeftLogical", + "opcode" : 196, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpBitwiseOr", + "opcode" : 197, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseXor", + "opcode" : 198, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseAnd", + "opcode" : 199, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpNot", + "opcode" : 200, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpBitFieldInsert", + "opcode" : 201, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Insert'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldSExtract", + "opcode" : 202, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldUExtract", + "opcode" : 203, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitReverse", + "opcode" : 204, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitCount", + "opcode" : 205, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ] + }, + { + "opname" : "OpDPdx", + "opcode" : 207, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdy", + "opcode" : 208, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpFwidth", + "opcode" : 209, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdxFine", + "opcode" : 210, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyFine", + "opcode" : 211, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthFine", + "opcode" : 212, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdxCoarse", + "opcode" : 213, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyCoarse", + "opcode" : 214, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthCoarse", + "opcode" : 215, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpEmitVertex", + "opcode" : 218, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEndPrimitive", + "opcode" : 219, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEmitStreamVertex", + "opcode" : 220, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpEndStreamPrimitive", + "opcode" : 221, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpControlBarrier", + "opcode" : 224, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpMemoryBarrier", + "opcode" : 225, + "operands" : [ + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicLoad", + "opcode" : 227, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicStore", + "opcode" : 228, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicExchange", + "opcode" : 229, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicCompareExchange", + "opcode" : 230, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ] + }, + { + "opname" : "OpAtomicCompareExchangeWeak", + "opcode" : 231, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicIIncrement", + "opcode" : 232, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIDecrement", + "opcode" : 233, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIAdd", + "opcode" : 234, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicISub", + "opcode" : 235, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMin", + "opcode" : 236, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMin", + "opcode" : 237, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMax", + "opcode" : 238, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMax", + "opcode" : 239, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicAnd", + "opcode" : 240, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicOr", + "opcode" : 241, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicXor", + "opcode" : 242, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpPhi", + "opcode" : 245, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "PairIdRefIdRef", "quantifier" : "*", "name" : "'Variable, Parent, ...'" } + ] + }, + { + "opname" : "OpLoopMerge", + "opcode" : 246, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "IdRef", "name" : "'Continue Target'" }, + { "kind" : "LoopControl" } + ] + }, + { + "opname" : "OpSelectionMerge", + "opcode" : 247, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "SelectionControl" } + ] + }, + { + "opname" : "OpLabel", + "opcode" : 248, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpBranch", + "opcode" : 249, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target Label'" } + ] + }, + { + "opname" : "OpBranchConditional", + "opcode" : 250, + "operands" : [ + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'True Label'" }, + { "kind" : "IdRef", "name" : "'False Label'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Branch weights'" } + ] + }, + { + "opname" : "OpSwitch", + "opcode" : 251, + "operands" : [ + { "kind" : "IdRef", "name" : "'Selector'" }, + { "kind" : "IdRef", "name" : "'Default'" }, + { "kind" : "PairLiteralIntegerIdRef", "quantifier" : "*", "name" : "'Target'" } + ] + }, + { + "opname" : "OpKill", + "opcode" : 252, + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpReturn", + "opcode" : 253 + }, + { + "opname" : "OpReturnValue", + "opcode" : 254, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpUnreachable", + "opcode" : 255 + }, + { + "opname" : "OpLifetimeStart", + "opcode" : 256, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLifetimeStop", + "opcode" : 257, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAsyncCopy", + "opcode" : 259, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Destination'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Num Elements'" }, + { "kind" : "IdRef", "name" : "'Stride'" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupWaitEvents", + "opcode" : 260, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Events List'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAll", + "opcode" : 261, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupAny", + "opcode" : 262, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupBroadcast", + "opcode" : 263, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'LocalId'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupIAdd", + "opcode" : 264, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAdd", + "opcode" : 265, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMin", + "opcode" : 266, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMin", + "opcode" : 267, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMin", + "opcode" : 268, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMax", + "opcode" : 269, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMax", + "opcode" : 270, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMax", + "opcode" : 271, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpReadPipe", + "opcode" : 274, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpWritePipe", + "opcode" : 275, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedReadPipe", + "opcode" : 276, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedWritePipe", + "opcode" : 277, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveReadPipePackets", + "opcode" : 278, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveWritePipePackets", + "opcode" : 279, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitReadPipe", + "opcode" : 280, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitWritePipe", + "opcode" : 281, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpIsValidReserveId", + "opcode" : 282, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetNumPipePackets", + "opcode" : 283, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetMaxPipePackets", + "opcode" : 284, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveReadPipePackets", + "opcode" : 285, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveWritePipePackets", + "opcode" : 286, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitReadPipe", + "opcode" : 287, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitWritePipe", + "opcode" : 288, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpEnqueueMarker", + "opcode" : 291, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpEnqueueKernel", + "opcode" : 292, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Local Size'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeSubGroupCount", + "opcode" : 293, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeMaxSubGroupSize", + "opcode" : 294, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelWorkGroupSize", + "opcode" : 295, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelPreferredWorkGroupSizeMultiple", + "opcode" : 296, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpRetainEvent", + "opcode" : 297, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpReleaseEvent", + "opcode" : 298, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCreateUserEvent", + "opcode" : 299, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpIsValidEvent", + "opcode" : 300, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpSetUserEventStatus", + "opcode" : 301, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Status'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCaptureEventProfilingInfo", + "opcode" : 302, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Profiling Info'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetDefaultQueue", + "opcode" : 303, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpBuildNDRange", + "opcode" : 304, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'GlobalWorkSize'" }, + { "kind" : "IdRef", "name" : "'LocalWorkSize'" }, + { "kind" : "IdRef", "name" : "'GlobalWorkOffset'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpImageSparseSampleImplicitLod", + "opcode" : 305, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleExplicitLod", + "opcode" : 306, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefImplicitLod", + "opcode" : 307, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefExplicitLod", + "opcode" : 308, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjImplicitLod", + "opcode" : 309, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjExplicitLod", + "opcode" : 310, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjDrefImplicitLod", + "opcode" : 311, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjDrefExplicitLod", + "opcode" : 312, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseFetch", + "opcode" : 313, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseGather", + "opcode" : 314, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseDrefGather", + "opcode" : 315, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseTexelsResident", + "opcode" : 316, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Resident Code'" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpNoLine", + "opcode" : 317 + }, + { + "opname" : "OpAtomicFlagTestAndSet", + "opcode" : 318, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicFlagClear", + "opcode" : 319, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageSparseRead", + "opcode" : 320, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpDecorateId", + "opcode" : 332, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + }, + { + "opname" : "OpSubgroupBallotKHR", + "opcode" : 4421, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpSubgroupFirstInvocationKHR", + "opcode" : 4422, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpSubgroupAllKHR", + "opcode" : 4428, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupAnyKHR", + "opcode" : 4429, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupAllEqualKHR", + "opcode" : 4430, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupReadInvocationKHR", + "opcode" : 4432, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpGroupIAddNonUniformAMD", + "opcode" : 5000, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAddNonUniformAMD", + "opcode" : 5001, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMinNonUniformAMD", + "opcode" : 5002, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMinNonUniformAMD", + "opcode" : 5003, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMinNonUniformAMD", + "opcode" : 5004, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMaxNonUniformAMD", + "opcode" : 5005, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMaxNonUniformAMD", + "opcode" : 5006, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMaxNonUniformAMD", + "opcode" : 5007, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpFragmentMaskFetchAMD", + "opcode" : 5011, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "FragmentMaskAMD" ] + }, + { + "opname" : "OpFragmentFetchAMD", + "opcode" : 5012, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Fragment Index'" } + ], + "capabilities" : [ "FragmentMaskAMD" ] + }, + { + "opname" : "OpSubgroupShuffleINTEL", + "opcode" : 5571, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'InvocationId'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleDownINTEL", + "opcode" : 5572, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Next'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleUpINTEL", + "opcode" : 5573, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Previous'" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleXorINTEL", + "opcode" : 5574, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupBlockReadINTEL", + "opcode" : 5575, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Ptr'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupBlockWriteINTEL", + "opcode" : 5576, + "operands" : [ + { "kind" : "IdRef", "name" : "'Ptr'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupImageBlockReadINTEL", + "opcode" : 5577, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupImageBlockWriteINTEL", + "opcode" : 5578, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ] + }, + { + "opname" : "OpDecorateStringGOOGLE", + "opcode" : 5632, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string" ] + }, + { + "opname" : "OpMemberDecorateStringGOOGLE", + "opcode" : 5633, + "operands" : [ + { "kind" : "IdRef", "name" : "'Struct Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string" ] + } + ], + "operand_kinds" : [ + { + "category" : "BitEnum", + "kind" : "ImageOperands", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Bias", + "value" : "0x0001", + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Lod", + "value" : "0x0002", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Grad", + "value" : "0x0004", + "parameters" : [ + { "kind" : "IdRef" }, + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffset", + "value" : "0x0008", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Offset", + "value" : "0x0010", + "capabilities" : [ "ImageGatherExtended" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffsets", + "value" : "0x0020", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Sample", + "value" : "0x0040", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "MinLod", + "value" : "0x0080", + "capabilities" : [ "MinLod" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FPFastMathMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "NotNaN", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NotInf", + "value" : "0x0002", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NSZ", + "value" : "0x0004", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AllowRecip", + "value" : "0x0008", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Fast", + "value" : "0x0010", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "SelectionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Flatten", + "value" : "0x0001" + }, + { + "enumerant" : "DontFlatten", + "value" : "0x0002" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "LoopControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Unroll", + "value" : "0x0001" + }, + { + "enumerant" : "DontUnroll", + "value" : "0x0002" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FunctionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Inline", + "value" : "0x0001" + }, + { + "enumerant" : "DontInline", + "value" : "0x0002" + }, + { + "enumerant" : "Pure", + "value" : "0x0004" + }, + { + "enumerant" : "Const", + "value" : "0x0008" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemorySemantics", + "enumerants" : [ + { + "enumerant" : "Relaxed", + "value" : "0x0000" + }, + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Acquire", + "value" : "0x0002" + }, + { + "enumerant" : "Release", + "value" : "0x0004" + }, + { + "enumerant" : "AcquireRelease", + "value" : "0x0008" + }, + { + "enumerant" : "SequentiallyConsistent", + "value" : "0x0010" + }, + { + "enumerant" : "UniformMemory", + "value" : "0x0040", + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupMemory", + "value" : "0x0080" + }, + { + "enumerant" : "WorkgroupMemory", + "value" : "0x0100" + }, + { + "enumerant" : "CrossWorkgroupMemory", + "value" : "0x0200" + }, + { + "enumerant" : "AtomicCounterMemory", + "value" : "0x0400", + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "ImageMemory", + "value" : "0x0800" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemoryAccess", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Volatile", + "value" : "0x0001" + }, + { + "enumerant" : "Aligned", + "value" : "0x0002", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + }, + { + "enumerant" : "Nontemporal", + "value" : "0x0004" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "KernelProfilingInfo", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "CmdExecTime", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SourceLanguage", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "ESSL", + "value" : 1 + }, + { + "enumerant" : "GLSL", + "value" : 2 + }, + { + "enumerant" : "OpenCL_C", + "value" : 3 + }, + { + "enumerant" : "OpenCL_CPP", + "value" : 4 + }, + { + "enumerant" : "HLSL", + "value" : 5 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionModel", + "enumerants" : [ + { + "enumerant" : "Vertex", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TessellationControl", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessellationEvaluation", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Geometry", + "value" : 3, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Fragment", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLCompute", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Kernel", + "value" : 6, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AddressingModel", + "enumerants" : [ + { + "enumerant" : "Logical", + "value" : 0 + }, + { + "enumerant" : "Physical32", + "value" : 1, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Physical64", + "value" : 2, + "capabilities" : [ "Addresses" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "MemoryModel", + "enumerants" : [ + { + "enumerant" : "Simple", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSL450", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OpenCL", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionMode", + "enumerants" : [ + { + "enumerant" : "Invocations", + "value" : 0, + "capabilities" : [ "Geometry" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Number of <>'" } + ] + }, + { + "enumerant" : "SpacingEqual", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalEven", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalOdd", + "value" : 3, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCw", + "value" : 4, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCcw", + "value" : 5, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PixelCenterInteger", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginUpperLeft", + "value" : 7, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginLowerLeft", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "EarlyFragmentTests", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointMode", + "value" : 10, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Xfb", + "value" : 11, + "capabilities" : [ "TransformFeedback" ] + }, + { + "enumerant" : "DepthReplacing", + "value" : 12, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthGreater", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthLess", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthUnchanged", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "LocalSize", + "value" : 17, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "LocalSizeHint", + "value" : 18, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "InputPoints", + "value" : 19, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLines", + "value" : 20, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLinesAdjacency", + "value" : 21, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Triangles", + "value" : 22, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InputTrianglesAdjacency", + "value" : 23, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Quads", + "value" : 24, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Isolines", + "value" : 25, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "OutputVertices", + "value" : 26, + "capabilities" : [ "Geometry", "Tessellation" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vertex count'" } + ] + }, + { + "enumerant" : "OutputPoints", + "value" : 27, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputLineStrip", + "value" : 28, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputTriangleStrip", + "value" : 29, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "VecTypeHint", + "value" : 30, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vector type'" } + ] + }, + { + "enumerant" : "ContractionOff", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "PostDepthCoverage", + "value" : 4446, + "capabilities" : [ "SampleMaskPostDepthCoverage" ] + }, + { + "enumerant" : "StencilRefReplacingEXT", + "value" : 5027, + "capabilities" : [ "StencilExportEXT" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "StorageClass", + "enumerants" : [ + { + "enumerant" : "UniformConstant", + "value" : 0 + }, + { + "enumerant" : "Input", + "value" : 1 + }, + { + "enumerant" : "Uniform", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Output", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Workgroup", + "value" : 4 + }, + { + "enumerant" : "CrossWorkgroup", + "value" : 5 + }, + { + "enumerant" : "Private", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Function", + "value" : 7 + }, + { + "enumerant" : "Generic", + "value" : 8, + "capabilities" : [ "GenericPointer" ] + }, + { + "enumerant" : "PushConstant", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "AtomicCounter", + "value" : 10, + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "Image", + "value" : 11 + }, + { + "enumerant" : "StorageBuffer", + "value" : 12, + "extensions" : [ + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers" + ], + "capabilities" : [ "Shader" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Dim", + "enumerants" : [ + { + "enumerant" : "1D", + "value" : 0, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "2D", + "value" : 1 + }, + { + "enumerant" : "3D", + "value" : 2 + }, + { + "enumerant" : "Cube", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rect", + "value" : 4, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "Buffer", + "value" : 5, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "SubpassData", + "value" : 6, + "capabilities" : [ "InputAttachment" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerAddressingMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ClampToEdge", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Clamp", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Repeat", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RepeatMirrored", + "value" : 4, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerFilterMode", + "enumerants" : [ + { + "enumerant" : "Nearest", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Linear", + "value" : 1, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageFormat", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "Rgba32f", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16f", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32f", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8Snorm", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32f", + "value" : 6, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16f", + "value" : 7, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R11fG11fB10f", + "value" : 8, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16f", + "value" : 9, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16", + "value" : 10, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgb10A2", + "value" : 11, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16", + "value" : 12, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8", + "value" : 13, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16", + "value" : 14, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8", + "value" : 15, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16Snorm", + "value" : 16, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16Snorm", + "value" : 17, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8Snorm", + "value" : 18, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16Snorm", + "value" : 19, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8Snorm", + "value" : 20, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32i", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16i", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8i", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32i", + "value" : 24, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32i", + "value" : 25, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16i", + "value" : 26, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8i", + "value" : 27, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16i", + "value" : 28, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8i", + "value" : 29, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32ui", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16ui", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8ui", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32ui", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgb10a2ui", + "value" : 34, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg32ui", + "value" : 35, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16ui", + "value" : 36, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8ui", + "value" : 37, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16ui", + "value" : 38, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8ui", + "value" : 39, + "capabilities" : [ "StorageImageExtendedFormats" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelOrder", + "enumerants" : [ + { + "enumerant" : "R", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "A", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RG", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RA", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGB", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBA", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BGRA", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ARGB", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Intensity", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Luminance", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Rx", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGx", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBx", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Depth", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "DepthStencil", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGB", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBx", + "value" : 16, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBA", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sBGRA", + "value" : 18, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ABGR", + "value" : 19, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelDataType", + "enumerants" : [ + { + "enumerant" : "SnormInt8", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SnormInt16", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt8", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt16", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort565", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort555", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt8", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt16", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt32", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt8", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt16", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt32", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "HalfFloat", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt24", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010_2", + "value" : 16, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FPRoundingMode", + "enumerants" : [ + { + "enumerant" : "RTE", + "value" : 0, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTZ", + "value" : 1, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTP", + "value" : 2, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTN", + "value" : 3, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "LinkageType", + "enumerants" : [ + { + "enumerant" : "Export", + "value" : 0, + "capabilities" : [ "Linkage" ] + }, + { + "enumerant" : "Import", + "value" : 1, + "capabilities" : [ "Linkage" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AccessQualifier", + "enumerants" : [ + { + "enumerant" : "ReadOnly", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WriteOnly", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ReadWrite", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FunctionParameterAttribute", + "enumerants" : [ + { + "enumerant" : "Zext", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sext", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ByVal", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sret", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoAlias", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoCapture", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoWrite", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoReadWrite", + "value" : 7, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Decoration", + "enumerants" : [ + { + "enumerant" : "RelaxedPrecision", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SpecId", + "value" : 1, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Specialization Constant ID'" } + ] + }, + { + "enumerant" : "Block", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "BufferBlock", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "RowMajor", + "value" : 4, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ColMajor", + "value" : 5, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ArrayStride", + "value" : 6, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Array Stride'" } + ] + }, + { + "enumerant" : "MatrixStride", + "value" : 7, + "capabilities" : [ "Matrix" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Matrix Stride'" } + ] + }, + { + "enumerant" : "GLSLShared", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSLPacked", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CPacked", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BuiltIn", + "value" : 11, + "parameters" : [ + { "kind" : "BuiltIn" } + ] + }, + { + "enumerant" : "NoPerspective", + "value" : 13, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Flat", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Patch", + "value" : 15, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Centroid", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sample", + "value" : 17, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "Invariant", + "value" : 18, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Restrict", + "value" : 19 + }, + { + "enumerant" : "Aliased", + "value" : 20 + }, + { + "enumerant" : "Volatile", + "value" : 21 + }, + { + "enumerant" : "Constant", + "value" : 22, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Coherent", + "value" : 23 + }, + { + "enumerant" : "NonWritable", + "value" : 24 + }, + { + "enumerant" : "NonReadable", + "value" : 25 + }, + { + "enumerant" : "Uniform", + "value" : 26, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SaturatedConversion", + "value" : 28, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Stream", + "value" : 29, + "capabilities" : [ "GeometryStreams" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Stream Number'" } + ] + }, + { + "enumerant" : "Location", + "value" : 30, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Location'" } + ] + }, + { + "enumerant" : "Component", + "value" : 31, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Component'" } + ] + }, + { + "enumerant" : "Index", + "value" : 32, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Index'" } + ] + }, + { + "enumerant" : "Binding", + "value" : 33, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Binding Point'" } + ] + }, + { + "enumerant" : "DescriptorSet", + "value" : 34, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Descriptor Set'" } + ] + }, + { + "enumerant" : "Offset", + "value" : 35, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Byte Offset'" } + ] + }, + { + "enumerant" : "XfbBuffer", + "value" : 36, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Buffer Number'" } + ] + }, + { + "enumerant" : "XfbStride", + "value" : 37, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Stride'" } + ] + }, + { + "enumerant" : "FuncParamAttr", + "value" : 38, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FunctionParameterAttribute", "name" : "'Function Parameter Attribute'" } + ] + }, + { + "enumerant" : "FPRoundingMode", + "value" : 39, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ], + "parameters" : [ + { "kind" : "FPRoundingMode", "name" : "'Floating-Point Rounding Mode'" } + ] + }, + { + "enumerant" : "FPFastMathMode", + "value" : 40, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FPFastMathMode", "name" : "'Fast-Math Mode'" } + ] + }, + { + "enumerant" : "LinkageAttributes", + "value" : 41, + "capabilities" : [ "Linkage" ], + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "LinkageType", "name" : "'Linkage Type'" } + ] + }, + { + "enumerant" : "NoContraction", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InputAttachmentIndex", + "value" : 43, + "capabilities" : [ "InputAttachment" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Attachment Index'" } + ] + }, + { + "enumerant" : "Alignment", + "value" : 44, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Alignment'" } + ] + }, + { + "enumerant" : "ExplicitInterpAMD", + "value" : 4999 + }, + { + "enumerant" : "OverrideCoverageNV", + "value" : 5248, + "capabilities" : [ "SampleMaskOverrideCoverageNV" ] + }, + { + "enumerant" : "PassthroughNV", + "value" : 5250, + "capabilities" : [ "GeometryShaderPassthroughNV" ] + }, + { + "enumerant" : "ViewportRelativeNV", + "value" : 5252, + "capabilities" : [ "ShaderViewportMaskNV" ] + }, + { + "enumerant" : "SecondaryViewportRelativeNV", + "value" : 5256, + "capabilities" : [ "ShaderStereoViewNV" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Offset'" } + ] + }, + { + "enumerant" : "HlslCounterBufferGOOGLE", + "value" : 5634, + "parameters" : [ + { "kind" : "IdRef", "name" : "'Counter Buffer'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + }, + { + "enumerant" : "HlslSemanticGOOGLE", + "value" : 5635, + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Semantic'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "BuiltIn", + "enumerants" : [ + { + "enumerant" : "Position", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointSize", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 3, + "capabilities" : [ "ClipDistance" ] + }, + { + "enumerant" : "CullDistance", + "value" : 4, + "capabilities" : [ "CullDistance" ] + }, + { + "enumerant" : "VertexId", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceId", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PrimitiveId", + "value" : 7, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InvocationId", + "value" : 8, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "Layer", + "value" : 9, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ViewportIndex", + "value" : 10, + "capabilities" : [ "MultiViewport" ] + }, + { + "enumerant" : "TessLevelOuter", + "value" : 11, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessLevelInner", + "value" : 12, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessCoord", + "value" : 13, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PatchVertices", + "value" : 14, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "FragCoord", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointCoord", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FrontFacing", + "value" : 17, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampleId", + "value" : 18, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SamplePosition", + "value" : 19, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SampleMask", + "value" : 20, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FragDepth", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "HelperInvocation", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "NumWorkgroups", + "value" : 24 + }, + { + "enumerant" : "WorkgroupSize", + "value" : 25 + }, + { + "enumerant" : "WorkgroupId", + "value" : 26 + }, + { + "enumerant" : "LocalInvocationId", + "value" : 27 + }, + { + "enumerant" : "GlobalInvocationId", + "value" : 28 + }, + { + "enumerant" : "LocalInvocationIndex", + "value" : 29 + }, + { + "enumerant" : "WorkDim", + "value" : 30, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalSize", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "EnqueuedWorkgroupSize", + "value" : 32, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalOffset", + "value" : 33, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalLinearId", + "value" : 34, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupSize", + "value" : 36, + "capabilities" : [ "Kernel", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupMaxSize", + "value" : 37, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumSubgroups", + "value" : 38, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumEnqueuedSubgroups", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupId", + "value" : 40, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupLocalInvocationId", + "value" : 41, + "capabilities" : [ "Kernel", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "VertexIndex", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceIndex", + "value" : 43, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupEqMaskKHR", + "value" : 4416, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupGeMaskKHR", + "value" : 4417, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupGtMaskKHR", + "value" : 4418, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupLeMaskKHR", + "value" : 4419, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupLtMaskKHR", + "value" : 4420, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "BaseVertex", + "value" : 4424, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "BaseInstance", + "value" : 4425, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "DrawIndex", + "value" : 4426, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "DeviceIndex", + "value" : 4438, + "capabilities" : [ "DeviceGroup" ] + }, + { + "enumerant" : "ViewIndex", + "value" : 4440, + "capabilities" : [ "MultiView" ] + }, + { + "enumerant" : "BaryCoordNoPerspAMD", + "value" : 4992 + }, + { + "enumerant" : "BaryCoordNoPerspCentroidAMD", + "value" : 4993 + }, + { + "enumerant" : "BaryCoordNoPerspSampleAMD", + "value" : 4994 + }, + { + "enumerant" : "BaryCoordSmoothAMD", + "value" : 4995 + }, + { + "enumerant" : "BaryCoordSmoothCentroidAMD", + "value" : 4996 + }, + { + "enumerant" : "BaryCoordSmoothSampleAMD", + "value" : 4997 + }, + { + "enumerant" : "BaryCoordPullModelAMD", + "value" : 4998 + }, + { + "enumerant" : "FragStencilRefEXT", + "value" : 5014, + "capabilities" : [ "StencilExportEXT" ] + }, + { + "enumerant" : "ViewportMaskNV", + "value" : 5253, + "capabilities" : [ "ShaderViewportMaskNV" ] + }, + { + "enumerant" : "SecondaryPositionNV", + "value" : 5257, + "capabilities" : [ "ShaderStereoViewNV" ] + }, + { + "enumerant" : "SecondaryViewportMaskNV", + "value" : 5258, + "capabilities" : [ "ShaderStereoViewNV" ] + }, + { + "enumerant" : "PositionPerViewNV", + "value" : 5261, + "capabilities" : [ "PerViewAttributesNV" ] + }, + { + "enumerant" : "ViewportMaskPerViewNV", + "value" : 5262, + "capabilities" : [ "PerViewAttributesNV" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Scope", + "enumerants" : [ + { + "enumerant" : "CrossDevice", + "value" : 0 + }, + { + "enumerant" : "Device", + "value" : 1 + }, + { + "enumerant" : "Workgroup", + "value" : 2 + }, + { + "enumerant" : "Subgroup", + "value" : 3 + }, + { + "enumerant" : "Invocation", + "value" : 4 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "GroupOperation", + "enumerants" : [ + { + "enumerant" : "Reduce", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "InclusiveScan", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ExclusiveScan", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "KernelEnqueueFlags", + "enumerants" : [ + { + "enumerant" : "NoWait", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitKernel", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitWorkGroup", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Capability", + "enumerants" : [ + { + "enumerant" : "Matrix", + "value" : 0 + }, + { + "enumerant" : "Shader", + "value" : 1, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "Geometry", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Tessellation", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Addresses", + "value" : 4 + }, + { + "enumerant" : "Linkage", + "value" : 5 + }, + { + "enumerant" : "Kernel", + "value" : 6 + }, + { + "enumerant" : "Vector16", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16Buffer", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16", + "value" : 9 + }, + { + "enumerant" : "Float64", + "value" : 10 + }, + { + "enumerant" : "Int64", + "value" : 11 + }, + { + "enumerant" : "Int64Atomics", + "value" : 12, + "capabilities" : [ "Int64" ] + }, + { + "enumerant" : "ImageBasic", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ImageReadWrite", + "value" : 14, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "ImageMipmap", + "value" : 15, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "Pipes", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Groups", + "value" : 18 + }, + { + "enumerant" : "DeviceEnqueue", + "value" : 19, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "LiteralSampler", + "value" : 20, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AtomicStorage", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Int16", + "value" : 22 + }, + { + "enumerant" : "TessellationPointSize", + "value" : 23, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "GeometryPointSize", + "value" : 24, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ImageGatherExtended", + "value" : 25, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageMultisample", + "value" : 27, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "UniformBufferArrayDynamicIndexing", + "value" : 28, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledImageArrayDynamicIndexing", + "value" : 29, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageBufferArrayDynamicIndexing", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageArrayDynamicIndexing", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CullDistance", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageCubeArray", + "value" : 34, + "capabilities" : [ "SampledCubeArray" ] + }, + { + "enumerant" : "SampleRateShading", + "value" : 35, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageRect", + "value" : 36, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "SampledRect", + "value" : 37, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GenericPointer", + "value" : 38, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Int8", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "InputAttachment", + "value" : 40, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SparseResidency", + "value" : 41, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MinLod", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sampled1D", + "value" : 43 + }, + { + "enumerant" : "Image1D", + "value" : 44, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "SampledCubeArray", + "value" : 45, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledBuffer", + "value" : 46 + }, + { + "enumerant" : "ImageBuffer", + "value" : 47, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "ImageMSArray", + "value" : 48, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageExtendedFormats", + "value" : 49, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageQuery", + "value" : 50, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DerivativeControl", + "value" : 51, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InterpolationFunction", + "value" : 52, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TransformFeedback", + "value" : 53, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GeometryStreams", + "value" : 54, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "StorageImageReadWithoutFormat", + "value" : 55, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageWriteWithoutFormat", + "value" : 56, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MultiViewport", + "value" : 57, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "SubgroupBallotKHR", + "value" : 4423, + "extensions" : [ "SPV_KHR_shader_ballot" ] + }, + { + "enumerant" : "DrawParameters", + "value" : 4427, + "extensions" : [ "SPV_KHR_shader_draw_parameters" ] + }, + { + "enumerant" : "SubgroupVoteKHR", + "value" : 4431, + "extensions" : [ "SPV_KHR_subgroup_vote" ] + }, + { + "enumerant" : "StorageBuffer16BitAccess", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageUniformBufferBlock16", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "UniformAndStorageBuffer16BitAccess", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageUniform16", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StoragePushConstant16", + "value" : 4435, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageInputOutput16", + "value" : 4436, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "DeviceGroup", + "value" : 4437, + "extensions" : [ "SPV_KHR_device_group" ] + }, + { + "enumerant" : "MultiView", + "value" : 4439, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_multiview" ] + }, + { + "enumerant" : "VariablePointersStorageBuffer", + "value" : 4441, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_variable_pointers" ] + }, + { + "enumerant" : "VariablePointers", + "value" : 4442, + "capabilities" : [ "VariablePointersStorageBuffer" ], + "extensions" : [ "SPV_KHR_variable_pointers" ] + }, + { + "enumerant": "AtomicStorageOps", + "value": 4445, + "extensions": [ "SPV_KHR_shader_atomic_counter_ops" ] + }, + { + "enumerant" : "SampleMaskPostDepthCoverage", + "value" : 4447, + "extensions" : [ "SPV_KHR_post_depth_coverage" ] + }, + { + "enumerant" : "ImageGatherBiasLodAMD", + "value" : 5009, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_texture_gather_bias_lod" ] + }, + { + "enumerant" : "FragmentMaskAMD", + "value" : 5010, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_fragment_mask" ] + }, + { + "enumerant" : "StencilExportEXT", + "value" : 5013, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_shader_stencil_export" ] + }, + { + "enumerant" : "ImageReadWriteLodAMD", + "value" : 5015, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_image_load_store_lod" ] + }, + { + "enumerant" : "SampleMaskOverrideCoverageNV", + "value" : 5249, + "capabilities" : [ "SampleRateShading" ], + "extensions" : [ "SPV_NV_sample_mask_override_coverage" ] + }, + { + "enumerant" : "GeometryShaderPassthroughNV", + "value" : 5251, + "capabilities" : [ "Geometry" ], + "extensions" : [ "SPV_NV_geometry_shader_passthrough" ] + }, + { + "enumerant" : "ShaderViewportIndexLayerEXT", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_EXT_shader_viewport_index_layer" ] + }, + { + "enumerant" : "ShaderViewportIndexLayerNV", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_NV_viewport_array2" ] + }, + { + "enumerant" : "ShaderViewportMaskNV", + "value" : 5255, + "capabilities" : [ "ShaderViewportIndexLayerNV" ], + "extensions" : [ "SPV_NV_viewport_array2" ] + }, + { + "enumerant" : "ShaderStereoViewNV", + "value" : 5259, + "capabilities" : [ "ShaderViewportMaskNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ] + }, + { + "enumerant" : "PerViewAttributesNV", + "value" : 5260, + "capabilities" : [ "MultiView" ], + "extensions" : [ "SPV_NVX_multiview_per_view_attributes" ] + }, + { + "enumerant" : "SubgroupShuffleINTEL", + "value" : 5568, + "extensions" : [ "SPV_INTEL_subgroups" ] + }, + { + "enumerant" : "SubgroupBufferBlockIOINTEL", + "value" : 5569, + "extensions" : [ "SPV_INTEL_subgroups" ] + }, + { + "enumerant" : "SubgroupImageBlockIOINTEL", + "value" : 5570, + "extensions" : [ "SPV_INTEL_subgroups" ] + } + ] + }, + { + "category" : "Id", + "kind" : "IdResultType", + "doc" : "Reference to an representing the result's type of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdResult", + "doc" : "Definition of an representing the result of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdMemorySemantics", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the MemorySemantics operand kind" + }, + { + "category" : "Id", + "kind" : "IdScope", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the Scope operand kind" + }, + { + "category" : "Id", + "kind" : "IdRef", + "doc" : "Reference to an " + }, + { + "category" : "Literal", + "kind" : "LiteralInteger", + "doc" : "An integer consuming one or more words" + }, + { + "category" : "Literal", + "kind" : "LiteralString", + "doc" : "A null-terminated stream of characters consuming an integral number of words" + }, + { + "category" : "Literal", + "kind" : "LiteralContextDependentNumber", + "doc" : "A literal number whose size and format are determined by a previous operand in the enclosing instruction" + }, + { + "category" : "Literal", + "kind" : "LiteralExtInstInteger", + "doc" : "A 32-bit unsigned integer indicating which instruction to use and determining the layout of following operands (for OpExtInst)" + }, + { + "category" : "Literal", + "kind" : "LiteralSpecConstantOpInteger", + "doc" : "An opcode indicating the operation to be performed and determining the layout of following operands (for OpSpecConstantOp)" + }, + { + "category" : "Composite", + "kind" : "PairLiteralIntegerIdRef", + "bases" : [ "LiteralInteger", "IdRef" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefLiteralInteger", + "bases" : [ "IdRef", "LiteralInteger" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefIdRef", + "bases" : [ "IdRef", "IdRef" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.h new file mode 100644 index 00000000000..bd5a9b9593a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.h @@ -0,0 +1,993 @@ +/* +** Copyright (c) 2014-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +/* +** This header is automatically generated by the same tool that creates +** the Binary Section of the SPIR-V specification. +*/ + +/* +** Enumeration tokens for SPIR-V, in various styles: +** C, C++, C++11, JSON, Lua, Python +** +** - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +** - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +** - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +** - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +** - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +** +** Some tokens act like mask values, which can be OR'd together, +** while others are mutually exclusive. The mask-like ones have +** "Mask" in their name, and a parallel enum that has the shift +** amount (1 << x) for each corresponding enumerant. +*/ + +#ifndef spirv_H +#define spirv_H + +typedef unsigned int SpvId; + +#define SPV_VERSION 0x10000 +#define SPV_REVISION 12 + +static const unsigned int SpvMagicNumber = 0x07230203; +static const unsigned int SpvVersion = 0x00010000; +static const unsigned int SpvRevision = 12; +static const unsigned int SpvOpCodeMask = 0xffff; +static const unsigned int SpvWordCountShift = 16; + +typedef enum SpvSourceLanguage_ { + SpvSourceLanguageUnknown = 0, + SpvSourceLanguageESSL = 1, + SpvSourceLanguageGLSL = 2, + SpvSourceLanguageOpenCL_C = 3, + SpvSourceLanguageOpenCL_CPP = 4, + SpvSourceLanguageHLSL = 5, + SpvSourceLanguageMax = 0x7fffffff, +} SpvSourceLanguage; + +typedef enum SpvExecutionModel_ { + SpvExecutionModelVertex = 0, + SpvExecutionModelTessellationControl = 1, + SpvExecutionModelTessellationEvaluation = 2, + SpvExecutionModelGeometry = 3, + SpvExecutionModelFragment = 4, + SpvExecutionModelGLCompute = 5, + SpvExecutionModelKernel = 6, + SpvExecutionModelMax = 0x7fffffff, +} SpvExecutionModel; + +typedef enum SpvAddressingModel_ { + SpvAddressingModelLogical = 0, + SpvAddressingModelPhysical32 = 1, + SpvAddressingModelPhysical64 = 2, + SpvAddressingModelMax = 0x7fffffff, +} SpvAddressingModel; + +typedef enum SpvMemoryModel_ { + SpvMemoryModelSimple = 0, + SpvMemoryModelGLSL450 = 1, + SpvMemoryModelOpenCL = 2, + SpvMemoryModelMax = 0x7fffffff, +} SpvMemoryModel; + +typedef enum SpvExecutionMode_ { + SpvExecutionModeInvocations = 0, + SpvExecutionModeSpacingEqual = 1, + SpvExecutionModeSpacingFractionalEven = 2, + SpvExecutionModeSpacingFractionalOdd = 3, + SpvExecutionModeVertexOrderCw = 4, + SpvExecutionModeVertexOrderCcw = 5, + SpvExecutionModePixelCenterInteger = 6, + SpvExecutionModeOriginUpperLeft = 7, + SpvExecutionModeOriginLowerLeft = 8, + SpvExecutionModeEarlyFragmentTests = 9, + SpvExecutionModePointMode = 10, + SpvExecutionModeXfb = 11, + SpvExecutionModeDepthReplacing = 12, + SpvExecutionModeDepthGreater = 14, + SpvExecutionModeDepthLess = 15, + SpvExecutionModeDepthUnchanged = 16, + SpvExecutionModeLocalSize = 17, + SpvExecutionModeLocalSizeHint = 18, + SpvExecutionModeInputPoints = 19, + SpvExecutionModeInputLines = 20, + SpvExecutionModeInputLinesAdjacency = 21, + SpvExecutionModeTriangles = 22, + SpvExecutionModeInputTrianglesAdjacency = 23, + SpvExecutionModeQuads = 24, + SpvExecutionModeIsolines = 25, + SpvExecutionModeOutputVertices = 26, + SpvExecutionModeOutputPoints = 27, + SpvExecutionModeOutputLineStrip = 28, + SpvExecutionModeOutputTriangleStrip = 29, + SpvExecutionModeVecTypeHint = 30, + SpvExecutionModeContractionOff = 31, + SpvExecutionModePostDepthCoverage = 4446, + SpvExecutionModeStencilRefReplacingEXT = 5027, + SpvExecutionModeMax = 0x7fffffff, +} SpvExecutionMode; + +typedef enum SpvStorageClass_ { + SpvStorageClassUniformConstant = 0, + SpvStorageClassInput = 1, + SpvStorageClassUniform = 2, + SpvStorageClassOutput = 3, + SpvStorageClassWorkgroup = 4, + SpvStorageClassCrossWorkgroup = 5, + SpvStorageClassPrivate = 6, + SpvStorageClassFunction = 7, + SpvStorageClassGeneric = 8, + SpvStorageClassPushConstant = 9, + SpvStorageClassAtomicCounter = 10, + SpvStorageClassImage = 11, + SpvStorageClassStorageBuffer = 12, + SpvStorageClassMax = 0x7fffffff, +} SpvStorageClass; + +typedef enum SpvDim_ { + SpvDim1D = 0, + SpvDim2D = 1, + SpvDim3D = 2, + SpvDimCube = 3, + SpvDimRect = 4, + SpvDimBuffer = 5, + SpvDimSubpassData = 6, + SpvDimMax = 0x7fffffff, +} SpvDim; + +typedef enum SpvSamplerAddressingMode_ { + SpvSamplerAddressingModeNone = 0, + SpvSamplerAddressingModeClampToEdge = 1, + SpvSamplerAddressingModeClamp = 2, + SpvSamplerAddressingModeRepeat = 3, + SpvSamplerAddressingModeRepeatMirrored = 4, + SpvSamplerAddressingModeMax = 0x7fffffff, +} SpvSamplerAddressingMode; + +typedef enum SpvSamplerFilterMode_ { + SpvSamplerFilterModeNearest = 0, + SpvSamplerFilterModeLinear = 1, + SpvSamplerFilterModeMax = 0x7fffffff, +} SpvSamplerFilterMode; + +typedef enum SpvImageFormat_ { + SpvImageFormatUnknown = 0, + SpvImageFormatRgba32f = 1, + SpvImageFormatRgba16f = 2, + SpvImageFormatR32f = 3, + SpvImageFormatRgba8 = 4, + SpvImageFormatRgba8Snorm = 5, + SpvImageFormatRg32f = 6, + SpvImageFormatRg16f = 7, + SpvImageFormatR11fG11fB10f = 8, + SpvImageFormatR16f = 9, + SpvImageFormatRgba16 = 10, + SpvImageFormatRgb10A2 = 11, + SpvImageFormatRg16 = 12, + SpvImageFormatRg8 = 13, + SpvImageFormatR16 = 14, + SpvImageFormatR8 = 15, + SpvImageFormatRgba16Snorm = 16, + SpvImageFormatRg16Snorm = 17, + SpvImageFormatRg8Snorm = 18, + SpvImageFormatR16Snorm = 19, + SpvImageFormatR8Snorm = 20, + SpvImageFormatRgba32i = 21, + SpvImageFormatRgba16i = 22, + SpvImageFormatRgba8i = 23, + SpvImageFormatR32i = 24, + SpvImageFormatRg32i = 25, + SpvImageFormatRg16i = 26, + SpvImageFormatRg8i = 27, + SpvImageFormatR16i = 28, + SpvImageFormatR8i = 29, + SpvImageFormatRgba32ui = 30, + SpvImageFormatRgba16ui = 31, + SpvImageFormatRgba8ui = 32, + SpvImageFormatR32ui = 33, + SpvImageFormatRgb10a2ui = 34, + SpvImageFormatRg32ui = 35, + SpvImageFormatRg16ui = 36, + SpvImageFormatRg8ui = 37, + SpvImageFormatR16ui = 38, + SpvImageFormatR8ui = 39, + SpvImageFormatMax = 0x7fffffff, +} SpvImageFormat; + +typedef enum SpvImageChannelOrder_ { + SpvImageChannelOrderR = 0, + SpvImageChannelOrderA = 1, + SpvImageChannelOrderRG = 2, + SpvImageChannelOrderRA = 3, + SpvImageChannelOrderRGB = 4, + SpvImageChannelOrderRGBA = 5, + SpvImageChannelOrderBGRA = 6, + SpvImageChannelOrderARGB = 7, + SpvImageChannelOrderIntensity = 8, + SpvImageChannelOrderLuminance = 9, + SpvImageChannelOrderRx = 10, + SpvImageChannelOrderRGx = 11, + SpvImageChannelOrderRGBx = 12, + SpvImageChannelOrderDepth = 13, + SpvImageChannelOrderDepthStencil = 14, + SpvImageChannelOrdersRGB = 15, + SpvImageChannelOrdersRGBx = 16, + SpvImageChannelOrdersRGBA = 17, + SpvImageChannelOrdersBGRA = 18, + SpvImageChannelOrderABGR = 19, + SpvImageChannelOrderMax = 0x7fffffff, +} SpvImageChannelOrder; + +typedef enum SpvImageChannelDataType_ { + SpvImageChannelDataTypeSnormInt8 = 0, + SpvImageChannelDataTypeSnormInt16 = 1, + SpvImageChannelDataTypeUnormInt8 = 2, + SpvImageChannelDataTypeUnormInt16 = 3, + SpvImageChannelDataTypeUnormShort565 = 4, + SpvImageChannelDataTypeUnormShort555 = 5, + SpvImageChannelDataTypeUnormInt101010 = 6, + SpvImageChannelDataTypeSignedInt8 = 7, + SpvImageChannelDataTypeSignedInt16 = 8, + SpvImageChannelDataTypeSignedInt32 = 9, + SpvImageChannelDataTypeUnsignedInt8 = 10, + SpvImageChannelDataTypeUnsignedInt16 = 11, + SpvImageChannelDataTypeUnsignedInt32 = 12, + SpvImageChannelDataTypeHalfFloat = 13, + SpvImageChannelDataTypeFloat = 14, + SpvImageChannelDataTypeUnormInt24 = 15, + SpvImageChannelDataTypeUnormInt101010_2 = 16, + SpvImageChannelDataTypeMax = 0x7fffffff, +} SpvImageChannelDataType; + +typedef enum SpvImageOperandsShift_ { + SpvImageOperandsBiasShift = 0, + SpvImageOperandsLodShift = 1, + SpvImageOperandsGradShift = 2, + SpvImageOperandsConstOffsetShift = 3, + SpvImageOperandsOffsetShift = 4, + SpvImageOperandsConstOffsetsShift = 5, + SpvImageOperandsSampleShift = 6, + SpvImageOperandsMinLodShift = 7, + SpvImageOperandsMax = 0x7fffffff, +} SpvImageOperandsShift; + +typedef enum SpvImageOperandsMask_ { + SpvImageOperandsMaskNone = 0, + SpvImageOperandsBiasMask = 0x00000001, + SpvImageOperandsLodMask = 0x00000002, + SpvImageOperandsGradMask = 0x00000004, + SpvImageOperandsConstOffsetMask = 0x00000008, + SpvImageOperandsOffsetMask = 0x00000010, + SpvImageOperandsConstOffsetsMask = 0x00000020, + SpvImageOperandsSampleMask = 0x00000040, + SpvImageOperandsMinLodMask = 0x00000080, +} SpvImageOperandsMask; + +typedef enum SpvFPFastMathModeShift_ { + SpvFPFastMathModeNotNaNShift = 0, + SpvFPFastMathModeNotInfShift = 1, + SpvFPFastMathModeNSZShift = 2, + SpvFPFastMathModeAllowRecipShift = 3, + SpvFPFastMathModeFastShift = 4, + SpvFPFastMathModeMax = 0x7fffffff, +} SpvFPFastMathModeShift; + +typedef enum SpvFPFastMathModeMask_ { + SpvFPFastMathModeMaskNone = 0, + SpvFPFastMathModeNotNaNMask = 0x00000001, + SpvFPFastMathModeNotInfMask = 0x00000002, + SpvFPFastMathModeNSZMask = 0x00000004, + SpvFPFastMathModeAllowRecipMask = 0x00000008, + SpvFPFastMathModeFastMask = 0x00000010, +} SpvFPFastMathModeMask; + +typedef enum SpvFPRoundingMode_ { + SpvFPRoundingModeRTE = 0, + SpvFPRoundingModeRTZ = 1, + SpvFPRoundingModeRTP = 2, + SpvFPRoundingModeRTN = 3, + SpvFPRoundingModeMax = 0x7fffffff, +} SpvFPRoundingMode; + +typedef enum SpvLinkageType_ { + SpvLinkageTypeExport = 0, + SpvLinkageTypeImport = 1, + SpvLinkageTypeMax = 0x7fffffff, +} SpvLinkageType; + +typedef enum SpvAccessQualifier_ { + SpvAccessQualifierReadOnly = 0, + SpvAccessQualifierWriteOnly = 1, + SpvAccessQualifierReadWrite = 2, + SpvAccessQualifierMax = 0x7fffffff, +} SpvAccessQualifier; + +typedef enum SpvFunctionParameterAttribute_ { + SpvFunctionParameterAttributeZext = 0, + SpvFunctionParameterAttributeSext = 1, + SpvFunctionParameterAttributeByVal = 2, + SpvFunctionParameterAttributeSret = 3, + SpvFunctionParameterAttributeNoAlias = 4, + SpvFunctionParameterAttributeNoCapture = 5, + SpvFunctionParameterAttributeNoWrite = 6, + SpvFunctionParameterAttributeNoReadWrite = 7, + SpvFunctionParameterAttributeMax = 0x7fffffff, +} SpvFunctionParameterAttribute; + +typedef enum SpvDecoration_ { + SpvDecorationRelaxedPrecision = 0, + SpvDecorationSpecId = 1, + SpvDecorationBlock = 2, + SpvDecorationBufferBlock = 3, + SpvDecorationRowMajor = 4, + SpvDecorationColMajor = 5, + SpvDecorationArrayStride = 6, + SpvDecorationMatrixStride = 7, + SpvDecorationGLSLShared = 8, + SpvDecorationGLSLPacked = 9, + SpvDecorationCPacked = 10, + SpvDecorationBuiltIn = 11, + SpvDecorationNoPerspective = 13, + SpvDecorationFlat = 14, + SpvDecorationPatch = 15, + SpvDecorationCentroid = 16, + SpvDecorationSample = 17, + SpvDecorationInvariant = 18, + SpvDecorationRestrict = 19, + SpvDecorationAliased = 20, + SpvDecorationVolatile = 21, + SpvDecorationConstant = 22, + SpvDecorationCoherent = 23, + SpvDecorationNonWritable = 24, + SpvDecorationNonReadable = 25, + SpvDecorationUniform = 26, + SpvDecorationSaturatedConversion = 28, + SpvDecorationStream = 29, + SpvDecorationLocation = 30, + SpvDecorationComponent = 31, + SpvDecorationIndex = 32, + SpvDecorationBinding = 33, + SpvDecorationDescriptorSet = 34, + SpvDecorationOffset = 35, + SpvDecorationXfbBuffer = 36, + SpvDecorationXfbStride = 37, + SpvDecorationFuncParamAttr = 38, + SpvDecorationFPRoundingMode = 39, + SpvDecorationFPFastMathMode = 40, + SpvDecorationLinkageAttributes = 41, + SpvDecorationNoContraction = 42, + SpvDecorationInputAttachmentIndex = 43, + SpvDecorationAlignment = 44, + SpvDecorationExplicitInterpAMD = 4999, + SpvDecorationOverrideCoverageNV = 5248, + SpvDecorationPassthroughNV = 5250, + SpvDecorationViewportRelativeNV = 5252, + SpvDecorationSecondaryViewportRelativeNV = 5256, + SpvDecorationHlslCounterBufferGOOGLE = 5634, + SpvDecorationHlslSemanticGOOGLE = 5635, + SpvDecorationMax = 0x7fffffff, +} SpvDecoration; + +typedef enum SpvBuiltIn_ { + SpvBuiltInPosition = 0, + SpvBuiltInPointSize = 1, + SpvBuiltInClipDistance = 3, + SpvBuiltInCullDistance = 4, + SpvBuiltInVertexId = 5, + SpvBuiltInInstanceId = 6, + SpvBuiltInPrimitiveId = 7, + SpvBuiltInInvocationId = 8, + SpvBuiltInLayer = 9, + SpvBuiltInViewportIndex = 10, + SpvBuiltInTessLevelOuter = 11, + SpvBuiltInTessLevelInner = 12, + SpvBuiltInTessCoord = 13, + SpvBuiltInPatchVertices = 14, + SpvBuiltInFragCoord = 15, + SpvBuiltInPointCoord = 16, + SpvBuiltInFrontFacing = 17, + SpvBuiltInSampleId = 18, + SpvBuiltInSamplePosition = 19, + SpvBuiltInSampleMask = 20, + SpvBuiltInFragDepth = 22, + SpvBuiltInHelperInvocation = 23, + SpvBuiltInNumWorkgroups = 24, + SpvBuiltInWorkgroupSize = 25, + SpvBuiltInWorkgroupId = 26, + SpvBuiltInLocalInvocationId = 27, + SpvBuiltInGlobalInvocationId = 28, + SpvBuiltInLocalInvocationIndex = 29, + SpvBuiltInWorkDim = 30, + SpvBuiltInGlobalSize = 31, + SpvBuiltInEnqueuedWorkgroupSize = 32, + SpvBuiltInGlobalOffset = 33, + SpvBuiltInGlobalLinearId = 34, + SpvBuiltInSubgroupSize = 36, + SpvBuiltInSubgroupMaxSize = 37, + SpvBuiltInNumSubgroups = 38, + SpvBuiltInNumEnqueuedSubgroups = 39, + SpvBuiltInSubgroupId = 40, + SpvBuiltInSubgroupLocalInvocationId = 41, + SpvBuiltInVertexIndex = 42, + SpvBuiltInInstanceIndex = 43, + SpvBuiltInSubgroupEqMaskKHR = 4416, + SpvBuiltInSubgroupGeMaskKHR = 4417, + SpvBuiltInSubgroupGtMaskKHR = 4418, + SpvBuiltInSubgroupLeMaskKHR = 4419, + SpvBuiltInSubgroupLtMaskKHR = 4420, + SpvBuiltInBaseVertex = 4424, + SpvBuiltInBaseInstance = 4425, + SpvBuiltInDrawIndex = 4426, + SpvBuiltInDeviceIndex = 4438, + SpvBuiltInViewIndex = 4440, + SpvBuiltInBaryCoordNoPerspAMD = 4992, + SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993, + SpvBuiltInBaryCoordNoPerspSampleAMD = 4994, + SpvBuiltInBaryCoordSmoothAMD = 4995, + SpvBuiltInBaryCoordSmoothCentroidAMD = 4996, + SpvBuiltInBaryCoordSmoothSampleAMD = 4997, + SpvBuiltInBaryCoordPullModelAMD = 4998, + SpvBuiltInFragStencilRefEXT = 5014, + SpvBuiltInViewportMaskNV = 5253, + SpvBuiltInSecondaryPositionNV = 5257, + SpvBuiltInSecondaryViewportMaskNV = 5258, + SpvBuiltInPositionPerViewNV = 5261, + SpvBuiltInViewportMaskPerViewNV = 5262, + SpvBuiltInMax = 0x7fffffff, +} SpvBuiltIn; + +typedef enum SpvSelectionControlShift_ { + SpvSelectionControlFlattenShift = 0, + SpvSelectionControlDontFlattenShift = 1, + SpvSelectionControlMax = 0x7fffffff, +} SpvSelectionControlShift; + +typedef enum SpvSelectionControlMask_ { + SpvSelectionControlMaskNone = 0, + SpvSelectionControlFlattenMask = 0x00000001, + SpvSelectionControlDontFlattenMask = 0x00000002, +} SpvSelectionControlMask; + +typedef enum SpvLoopControlShift_ { + SpvLoopControlUnrollShift = 0, + SpvLoopControlDontUnrollShift = 1, + SpvLoopControlMax = 0x7fffffff, +} SpvLoopControlShift; + +typedef enum SpvLoopControlMask_ { + SpvLoopControlMaskNone = 0, + SpvLoopControlUnrollMask = 0x00000001, + SpvLoopControlDontUnrollMask = 0x00000002, +} SpvLoopControlMask; + +typedef enum SpvFunctionControlShift_ { + SpvFunctionControlInlineShift = 0, + SpvFunctionControlDontInlineShift = 1, + SpvFunctionControlPureShift = 2, + SpvFunctionControlConstShift = 3, + SpvFunctionControlMax = 0x7fffffff, +} SpvFunctionControlShift; + +typedef enum SpvFunctionControlMask_ { + SpvFunctionControlMaskNone = 0, + SpvFunctionControlInlineMask = 0x00000001, + SpvFunctionControlDontInlineMask = 0x00000002, + SpvFunctionControlPureMask = 0x00000004, + SpvFunctionControlConstMask = 0x00000008, +} SpvFunctionControlMask; + +typedef enum SpvMemorySemanticsShift_ { + SpvMemorySemanticsAcquireShift = 1, + SpvMemorySemanticsReleaseShift = 2, + SpvMemorySemanticsAcquireReleaseShift = 3, + SpvMemorySemanticsSequentiallyConsistentShift = 4, + SpvMemorySemanticsUniformMemoryShift = 6, + SpvMemorySemanticsSubgroupMemoryShift = 7, + SpvMemorySemanticsWorkgroupMemoryShift = 8, + SpvMemorySemanticsCrossWorkgroupMemoryShift = 9, + SpvMemorySemanticsAtomicCounterMemoryShift = 10, + SpvMemorySemanticsImageMemoryShift = 11, + SpvMemorySemanticsMax = 0x7fffffff, +} SpvMemorySemanticsShift; + +typedef enum SpvMemorySemanticsMask_ { + SpvMemorySemanticsMaskNone = 0, + SpvMemorySemanticsAcquireMask = 0x00000002, + SpvMemorySemanticsReleaseMask = 0x00000004, + SpvMemorySemanticsAcquireReleaseMask = 0x00000008, + SpvMemorySemanticsSequentiallyConsistentMask = 0x00000010, + SpvMemorySemanticsUniformMemoryMask = 0x00000040, + SpvMemorySemanticsSubgroupMemoryMask = 0x00000080, + SpvMemorySemanticsWorkgroupMemoryMask = 0x00000100, + SpvMemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000400, + SpvMemorySemanticsImageMemoryMask = 0x00000800, +} SpvMemorySemanticsMask; + +typedef enum SpvMemoryAccessShift_ { + SpvMemoryAccessVolatileShift = 0, + SpvMemoryAccessAlignedShift = 1, + SpvMemoryAccessNontemporalShift = 2, + SpvMemoryAccessMax = 0x7fffffff, +} SpvMemoryAccessShift; + +typedef enum SpvMemoryAccessMask_ { + SpvMemoryAccessMaskNone = 0, + SpvMemoryAccessVolatileMask = 0x00000001, + SpvMemoryAccessAlignedMask = 0x00000002, + SpvMemoryAccessNontemporalMask = 0x00000004, +} SpvMemoryAccessMask; + +typedef enum SpvScope_ { + SpvScopeCrossDevice = 0, + SpvScopeDevice = 1, + SpvScopeWorkgroup = 2, + SpvScopeSubgroup = 3, + SpvScopeInvocation = 4, + SpvScopeMax = 0x7fffffff, +} SpvScope; + +typedef enum SpvGroupOperation_ { + SpvGroupOperationReduce = 0, + SpvGroupOperationInclusiveScan = 1, + SpvGroupOperationExclusiveScan = 2, + SpvGroupOperationMax = 0x7fffffff, +} SpvGroupOperation; + +typedef enum SpvKernelEnqueueFlags_ { + SpvKernelEnqueueFlagsNoWait = 0, + SpvKernelEnqueueFlagsWaitKernel = 1, + SpvKernelEnqueueFlagsWaitWorkGroup = 2, + SpvKernelEnqueueFlagsMax = 0x7fffffff, +} SpvKernelEnqueueFlags; + +typedef enum SpvKernelProfilingInfoShift_ { + SpvKernelProfilingInfoCmdExecTimeShift = 0, + SpvKernelProfilingInfoMax = 0x7fffffff, +} SpvKernelProfilingInfoShift; + +typedef enum SpvKernelProfilingInfoMask_ { + SpvKernelProfilingInfoMaskNone = 0, + SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001, +} SpvKernelProfilingInfoMask; + +typedef enum SpvCapability_ { + SpvCapabilityMatrix = 0, + SpvCapabilityShader = 1, + SpvCapabilityGeometry = 2, + SpvCapabilityTessellation = 3, + SpvCapabilityAddresses = 4, + SpvCapabilityLinkage = 5, + SpvCapabilityKernel = 6, + SpvCapabilityVector16 = 7, + SpvCapabilityFloat16Buffer = 8, + SpvCapabilityFloat16 = 9, + SpvCapabilityFloat64 = 10, + SpvCapabilityInt64 = 11, + SpvCapabilityInt64Atomics = 12, + SpvCapabilityImageBasic = 13, + SpvCapabilityImageReadWrite = 14, + SpvCapabilityImageMipmap = 15, + SpvCapabilityPipes = 17, + SpvCapabilityGroups = 18, + SpvCapabilityDeviceEnqueue = 19, + SpvCapabilityLiteralSampler = 20, + SpvCapabilityAtomicStorage = 21, + SpvCapabilityInt16 = 22, + SpvCapabilityTessellationPointSize = 23, + SpvCapabilityGeometryPointSize = 24, + SpvCapabilityImageGatherExtended = 25, + SpvCapabilityStorageImageMultisample = 27, + SpvCapabilityUniformBufferArrayDynamicIndexing = 28, + SpvCapabilitySampledImageArrayDynamicIndexing = 29, + SpvCapabilityStorageBufferArrayDynamicIndexing = 30, + SpvCapabilityStorageImageArrayDynamicIndexing = 31, + SpvCapabilityClipDistance = 32, + SpvCapabilityCullDistance = 33, + SpvCapabilityImageCubeArray = 34, + SpvCapabilitySampleRateShading = 35, + SpvCapabilityImageRect = 36, + SpvCapabilitySampledRect = 37, + SpvCapabilityGenericPointer = 38, + SpvCapabilityInt8 = 39, + SpvCapabilityInputAttachment = 40, + SpvCapabilitySparseResidency = 41, + SpvCapabilityMinLod = 42, + SpvCapabilitySampled1D = 43, + SpvCapabilityImage1D = 44, + SpvCapabilitySampledCubeArray = 45, + SpvCapabilitySampledBuffer = 46, + SpvCapabilityImageBuffer = 47, + SpvCapabilityImageMSArray = 48, + SpvCapabilityStorageImageExtendedFormats = 49, + SpvCapabilityImageQuery = 50, + SpvCapabilityDerivativeControl = 51, + SpvCapabilityInterpolationFunction = 52, + SpvCapabilityTransformFeedback = 53, + SpvCapabilityGeometryStreams = 54, + SpvCapabilityStorageImageReadWithoutFormat = 55, + SpvCapabilityStorageImageWriteWithoutFormat = 56, + SpvCapabilityMultiViewport = 57, + SpvCapabilitySubgroupBallotKHR = 4423, + SpvCapabilityDrawParameters = 4427, + SpvCapabilitySubgroupVoteKHR = 4431, + SpvCapabilityStorageBuffer16BitAccess = 4433, + SpvCapabilityStorageUniformBufferBlock16 = 4433, + SpvCapabilityStorageUniform16 = 4434, + SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434, + SpvCapabilityStoragePushConstant16 = 4435, + SpvCapabilityStorageInputOutput16 = 4436, + SpvCapabilityDeviceGroup = 4437, + SpvCapabilityMultiView = 4439, + SpvCapabilityVariablePointersStorageBuffer = 4441, + SpvCapabilityVariablePointers = 4442, + SpvCapabilityAtomicStorageOps = 4445, + SpvCapabilitySampleMaskPostDepthCoverage = 4447, + SpvCapabilityImageGatherBiasLodAMD = 5009, + SpvCapabilityFragmentMaskAMD = 5010, + SpvCapabilityStencilExportEXT = 5013, + SpvCapabilityImageReadWriteLodAMD = 5015, + SpvCapabilitySampleMaskOverrideCoverageNV = 5249, + SpvCapabilityGeometryShaderPassthroughNV = 5251, + SpvCapabilityShaderViewportIndexLayerEXT = 5254, + SpvCapabilityShaderViewportIndexLayerNV = 5254, + SpvCapabilityShaderViewportMaskNV = 5255, + SpvCapabilityShaderStereoViewNV = 5259, + SpvCapabilityPerViewAttributesNV = 5260, + SpvCapabilitySubgroupShuffleINTEL = 5568, + SpvCapabilitySubgroupBufferBlockIOINTEL = 5569, + SpvCapabilitySubgroupImageBlockIOINTEL = 5570, + SpvCapabilityMax = 0x7fffffff, +} SpvCapability; + +typedef enum SpvOp_ { + SpvOpNop = 0, + SpvOpUndef = 1, + SpvOpSourceContinued = 2, + SpvOpSource = 3, + SpvOpSourceExtension = 4, + SpvOpName = 5, + SpvOpMemberName = 6, + SpvOpString = 7, + SpvOpLine = 8, + SpvOpExtension = 10, + SpvOpExtInstImport = 11, + SpvOpExtInst = 12, + SpvOpMemoryModel = 14, + SpvOpEntryPoint = 15, + SpvOpExecutionMode = 16, + SpvOpCapability = 17, + SpvOpTypeVoid = 19, + SpvOpTypeBool = 20, + SpvOpTypeInt = 21, + SpvOpTypeFloat = 22, + SpvOpTypeVector = 23, + SpvOpTypeMatrix = 24, + SpvOpTypeImage = 25, + SpvOpTypeSampler = 26, + SpvOpTypeSampledImage = 27, + SpvOpTypeArray = 28, + SpvOpTypeRuntimeArray = 29, + SpvOpTypeStruct = 30, + SpvOpTypeOpaque = 31, + SpvOpTypePointer = 32, + SpvOpTypeFunction = 33, + SpvOpTypeEvent = 34, + SpvOpTypeDeviceEvent = 35, + SpvOpTypeReserveId = 36, + SpvOpTypeQueue = 37, + SpvOpTypePipe = 38, + SpvOpTypeForwardPointer = 39, + SpvOpConstantTrue = 41, + SpvOpConstantFalse = 42, + SpvOpConstant = 43, + SpvOpConstantComposite = 44, + SpvOpConstantSampler = 45, + SpvOpConstantNull = 46, + SpvOpSpecConstantTrue = 48, + SpvOpSpecConstantFalse = 49, + SpvOpSpecConstant = 50, + SpvOpSpecConstantComposite = 51, + SpvOpSpecConstantOp = 52, + SpvOpFunction = 54, + SpvOpFunctionParameter = 55, + SpvOpFunctionEnd = 56, + SpvOpFunctionCall = 57, + SpvOpVariable = 59, + SpvOpImageTexelPointer = 60, + SpvOpLoad = 61, + SpvOpStore = 62, + SpvOpCopyMemory = 63, + SpvOpCopyMemorySized = 64, + SpvOpAccessChain = 65, + SpvOpInBoundsAccessChain = 66, + SpvOpPtrAccessChain = 67, + SpvOpArrayLength = 68, + SpvOpGenericPtrMemSemantics = 69, + SpvOpInBoundsPtrAccessChain = 70, + SpvOpDecorate = 71, + SpvOpMemberDecorate = 72, + SpvOpDecorationGroup = 73, + SpvOpGroupDecorate = 74, + SpvOpGroupMemberDecorate = 75, + SpvOpVectorExtractDynamic = 77, + SpvOpVectorInsertDynamic = 78, + SpvOpVectorShuffle = 79, + SpvOpCompositeConstruct = 80, + SpvOpCompositeExtract = 81, + SpvOpCompositeInsert = 82, + SpvOpCopyObject = 83, + SpvOpTranspose = 84, + SpvOpSampledImage = 86, + SpvOpImageSampleImplicitLod = 87, + SpvOpImageSampleExplicitLod = 88, + SpvOpImageSampleDrefImplicitLod = 89, + SpvOpImageSampleDrefExplicitLod = 90, + SpvOpImageSampleProjImplicitLod = 91, + SpvOpImageSampleProjExplicitLod = 92, + SpvOpImageSampleProjDrefImplicitLod = 93, + SpvOpImageSampleProjDrefExplicitLod = 94, + SpvOpImageFetch = 95, + SpvOpImageGather = 96, + SpvOpImageDrefGather = 97, + SpvOpImageRead = 98, + SpvOpImageWrite = 99, + SpvOpImage = 100, + SpvOpImageQueryFormat = 101, + SpvOpImageQueryOrder = 102, + SpvOpImageQuerySizeLod = 103, + SpvOpImageQuerySize = 104, + SpvOpImageQueryLod = 105, + SpvOpImageQueryLevels = 106, + SpvOpImageQuerySamples = 107, + SpvOpConvertFToU = 109, + SpvOpConvertFToS = 110, + SpvOpConvertSToF = 111, + SpvOpConvertUToF = 112, + SpvOpUConvert = 113, + SpvOpSConvert = 114, + SpvOpFConvert = 115, + SpvOpQuantizeToF16 = 116, + SpvOpConvertPtrToU = 117, + SpvOpSatConvertSToU = 118, + SpvOpSatConvertUToS = 119, + SpvOpConvertUToPtr = 120, + SpvOpPtrCastToGeneric = 121, + SpvOpGenericCastToPtr = 122, + SpvOpGenericCastToPtrExplicit = 123, + SpvOpBitcast = 124, + SpvOpSNegate = 126, + SpvOpFNegate = 127, + SpvOpIAdd = 128, + SpvOpFAdd = 129, + SpvOpISub = 130, + SpvOpFSub = 131, + SpvOpIMul = 132, + SpvOpFMul = 133, + SpvOpUDiv = 134, + SpvOpSDiv = 135, + SpvOpFDiv = 136, + SpvOpUMod = 137, + SpvOpSRem = 138, + SpvOpSMod = 139, + SpvOpFRem = 140, + SpvOpFMod = 141, + SpvOpVectorTimesScalar = 142, + SpvOpMatrixTimesScalar = 143, + SpvOpVectorTimesMatrix = 144, + SpvOpMatrixTimesVector = 145, + SpvOpMatrixTimesMatrix = 146, + SpvOpOuterProduct = 147, + SpvOpDot = 148, + SpvOpIAddCarry = 149, + SpvOpISubBorrow = 150, + SpvOpUMulExtended = 151, + SpvOpSMulExtended = 152, + SpvOpAny = 154, + SpvOpAll = 155, + SpvOpIsNan = 156, + SpvOpIsInf = 157, + SpvOpIsFinite = 158, + SpvOpIsNormal = 159, + SpvOpSignBitSet = 160, + SpvOpLessOrGreater = 161, + SpvOpOrdered = 162, + SpvOpUnordered = 163, + SpvOpLogicalEqual = 164, + SpvOpLogicalNotEqual = 165, + SpvOpLogicalOr = 166, + SpvOpLogicalAnd = 167, + SpvOpLogicalNot = 168, + SpvOpSelect = 169, + SpvOpIEqual = 170, + SpvOpINotEqual = 171, + SpvOpUGreaterThan = 172, + SpvOpSGreaterThan = 173, + SpvOpUGreaterThanEqual = 174, + SpvOpSGreaterThanEqual = 175, + SpvOpULessThan = 176, + SpvOpSLessThan = 177, + SpvOpULessThanEqual = 178, + SpvOpSLessThanEqual = 179, + SpvOpFOrdEqual = 180, + SpvOpFUnordEqual = 181, + SpvOpFOrdNotEqual = 182, + SpvOpFUnordNotEqual = 183, + SpvOpFOrdLessThan = 184, + SpvOpFUnordLessThan = 185, + SpvOpFOrdGreaterThan = 186, + SpvOpFUnordGreaterThan = 187, + SpvOpFOrdLessThanEqual = 188, + SpvOpFUnordLessThanEqual = 189, + SpvOpFOrdGreaterThanEqual = 190, + SpvOpFUnordGreaterThanEqual = 191, + SpvOpShiftRightLogical = 194, + SpvOpShiftRightArithmetic = 195, + SpvOpShiftLeftLogical = 196, + SpvOpBitwiseOr = 197, + SpvOpBitwiseXor = 198, + SpvOpBitwiseAnd = 199, + SpvOpNot = 200, + SpvOpBitFieldInsert = 201, + SpvOpBitFieldSExtract = 202, + SpvOpBitFieldUExtract = 203, + SpvOpBitReverse = 204, + SpvOpBitCount = 205, + SpvOpDPdx = 207, + SpvOpDPdy = 208, + SpvOpFwidth = 209, + SpvOpDPdxFine = 210, + SpvOpDPdyFine = 211, + SpvOpFwidthFine = 212, + SpvOpDPdxCoarse = 213, + SpvOpDPdyCoarse = 214, + SpvOpFwidthCoarse = 215, + SpvOpEmitVertex = 218, + SpvOpEndPrimitive = 219, + SpvOpEmitStreamVertex = 220, + SpvOpEndStreamPrimitive = 221, + SpvOpControlBarrier = 224, + SpvOpMemoryBarrier = 225, + SpvOpAtomicLoad = 227, + SpvOpAtomicStore = 228, + SpvOpAtomicExchange = 229, + SpvOpAtomicCompareExchange = 230, + SpvOpAtomicCompareExchangeWeak = 231, + SpvOpAtomicIIncrement = 232, + SpvOpAtomicIDecrement = 233, + SpvOpAtomicIAdd = 234, + SpvOpAtomicISub = 235, + SpvOpAtomicSMin = 236, + SpvOpAtomicUMin = 237, + SpvOpAtomicSMax = 238, + SpvOpAtomicUMax = 239, + SpvOpAtomicAnd = 240, + SpvOpAtomicOr = 241, + SpvOpAtomicXor = 242, + SpvOpPhi = 245, + SpvOpLoopMerge = 246, + SpvOpSelectionMerge = 247, + SpvOpLabel = 248, + SpvOpBranch = 249, + SpvOpBranchConditional = 250, + SpvOpSwitch = 251, + SpvOpKill = 252, + SpvOpReturn = 253, + SpvOpReturnValue = 254, + SpvOpUnreachable = 255, + SpvOpLifetimeStart = 256, + SpvOpLifetimeStop = 257, + SpvOpGroupAsyncCopy = 259, + SpvOpGroupWaitEvents = 260, + SpvOpGroupAll = 261, + SpvOpGroupAny = 262, + SpvOpGroupBroadcast = 263, + SpvOpGroupIAdd = 264, + SpvOpGroupFAdd = 265, + SpvOpGroupFMin = 266, + SpvOpGroupUMin = 267, + SpvOpGroupSMin = 268, + SpvOpGroupFMax = 269, + SpvOpGroupUMax = 270, + SpvOpGroupSMax = 271, + SpvOpReadPipe = 274, + SpvOpWritePipe = 275, + SpvOpReservedReadPipe = 276, + SpvOpReservedWritePipe = 277, + SpvOpReserveReadPipePackets = 278, + SpvOpReserveWritePipePackets = 279, + SpvOpCommitReadPipe = 280, + SpvOpCommitWritePipe = 281, + SpvOpIsValidReserveId = 282, + SpvOpGetNumPipePackets = 283, + SpvOpGetMaxPipePackets = 284, + SpvOpGroupReserveReadPipePackets = 285, + SpvOpGroupReserveWritePipePackets = 286, + SpvOpGroupCommitReadPipe = 287, + SpvOpGroupCommitWritePipe = 288, + SpvOpEnqueueMarker = 291, + SpvOpEnqueueKernel = 292, + SpvOpGetKernelNDrangeSubGroupCount = 293, + SpvOpGetKernelNDrangeMaxSubGroupSize = 294, + SpvOpGetKernelWorkGroupSize = 295, + SpvOpGetKernelPreferredWorkGroupSizeMultiple = 296, + SpvOpRetainEvent = 297, + SpvOpReleaseEvent = 298, + SpvOpCreateUserEvent = 299, + SpvOpIsValidEvent = 300, + SpvOpSetUserEventStatus = 301, + SpvOpCaptureEventProfilingInfo = 302, + SpvOpGetDefaultQueue = 303, + SpvOpBuildNDRange = 304, + SpvOpImageSparseSampleImplicitLod = 305, + SpvOpImageSparseSampleExplicitLod = 306, + SpvOpImageSparseSampleDrefImplicitLod = 307, + SpvOpImageSparseSampleDrefExplicitLod = 308, + SpvOpImageSparseSampleProjImplicitLod = 309, + SpvOpImageSparseSampleProjExplicitLod = 310, + SpvOpImageSparseSampleProjDrefImplicitLod = 311, + SpvOpImageSparseSampleProjDrefExplicitLod = 312, + SpvOpImageSparseFetch = 313, + SpvOpImageSparseGather = 314, + SpvOpImageSparseDrefGather = 315, + SpvOpImageSparseTexelsResident = 316, + SpvOpNoLine = 317, + SpvOpAtomicFlagTestAndSet = 318, + SpvOpAtomicFlagClear = 319, + SpvOpImageSparseRead = 320, + SpvOpDecorateId = 332, + SpvOpSubgroupBallotKHR = 4421, + SpvOpSubgroupFirstInvocationKHR = 4422, + SpvOpSubgroupAllKHR = 4428, + SpvOpSubgroupAnyKHR = 4429, + SpvOpSubgroupAllEqualKHR = 4430, + SpvOpSubgroupReadInvocationKHR = 4432, + SpvOpGroupIAddNonUniformAMD = 5000, + SpvOpGroupFAddNonUniformAMD = 5001, + SpvOpGroupFMinNonUniformAMD = 5002, + SpvOpGroupUMinNonUniformAMD = 5003, + SpvOpGroupSMinNonUniformAMD = 5004, + SpvOpGroupFMaxNonUniformAMD = 5005, + SpvOpGroupUMaxNonUniformAMD = 5006, + SpvOpGroupSMaxNonUniformAMD = 5007, + SpvOpFragmentMaskFetchAMD = 5011, + SpvOpFragmentFetchAMD = 5012, + SpvOpSubgroupShuffleINTEL = 5571, + SpvOpSubgroupShuffleDownINTEL = 5572, + SpvOpSubgroupShuffleUpINTEL = 5573, + SpvOpSubgroupShuffleXorINTEL = 5574, + SpvOpSubgroupBlockReadINTEL = 5575, + SpvOpSubgroupBlockWriteINTEL = 5576, + SpvOpSubgroupImageBlockReadINTEL = 5577, + SpvOpSubgroupImageBlockWriteINTEL = 5578, + SpvOpDecorateStringGOOGLE = 5632, + SpvOpMemberDecorateStringGOOGLE = 5633, + SpvOpMax = 0x7fffffff, +} SpvOp; + +#endif // #ifndef spirv_H + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.hpp new file mode 100644 index 00000000000..e98a89cee74 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.hpp @@ -0,0 +1,1002 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10000 +#define SPV_REVISION 12 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010000; +static const unsigned int Revision = 12; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum SourceLanguage { + SourceLanguageUnknown = 0, + SourceLanguageESSL = 1, + SourceLanguageGLSL = 2, + SourceLanguageOpenCL_C = 3, + SourceLanguageOpenCL_CPP = 4, + SourceLanguageHLSL = 5, + SourceLanguageMax = 0x7fffffff, +}; + +enum ExecutionModel { + ExecutionModelVertex = 0, + ExecutionModelTessellationControl = 1, + ExecutionModelTessellationEvaluation = 2, + ExecutionModelGeometry = 3, + ExecutionModelFragment = 4, + ExecutionModelGLCompute = 5, + ExecutionModelKernel = 6, + ExecutionModelMax = 0x7fffffff, +}; + +enum AddressingModel { + AddressingModelLogical = 0, + AddressingModelPhysical32 = 1, + AddressingModelPhysical64 = 2, + AddressingModelMax = 0x7fffffff, +}; + +enum MemoryModel { + MemoryModelSimple = 0, + MemoryModelGLSL450 = 1, + MemoryModelOpenCL = 2, + MemoryModelMax = 0x7fffffff, +}; + +enum ExecutionMode { + ExecutionModeInvocations = 0, + ExecutionModeSpacingEqual = 1, + ExecutionModeSpacingFractionalEven = 2, + ExecutionModeSpacingFractionalOdd = 3, + ExecutionModeVertexOrderCw = 4, + ExecutionModeVertexOrderCcw = 5, + ExecutionModePixelCenterInteger = 6, + ExecutionModeOriginUpperLeft = 7, + ExecutionModeOriginLowerLeft = 8, + ExecutionModeEarlyFragmentTests = 9, + ExecutionModePointMode = 10, + ExecutionModeXfb = 11, + ExecutionModeDepthReplacing = 12, + ExecutionModeDepthGreater = 14, + ExecutionModeDepthLess = 15, + ExecutionModeDepthUnchanged = 16, + ExecutionModeLocalSize = 17, + ExecutionModeLocalSizeHint = 18, + ExecutionModeInputPoints = 19, + ExecutionModeInputLines = 20, + ExecutionModeInputLinesAdjacency = 21, + ExecutionModeTriangles = 22, + ExecutionModeInputTrianglesAdjacency = 23, + ExecutionModeQuads = 24, + ExecutionModeIsolines = 25, + ExecutionModeOutputVertices = 26, + ExecutionModeOutputPoints = 27, + ExecutionModeOutputLineStrip = 28, + ExecutionModeOutputTriangleStrip = 29, + ExecutionModeVecTypeHint = 30, + ExecutionModeContractionOff = 31, + ExecutionModePostDepthCoverage = 4446, + ExecutionModeStencilRefReplacingEXT = 5027, + ExecutionModeMax = 0x7fffffff, +}; + +enum StorageClass { + StorageClassUniformConstant = 0, + StorageClassInput = 1, + StorageClassUniform = 2, + StorageClassOutput = 3, + StorageClassWorkgroup = 4, + StorageClassCrossWorkgroup = 5, + StorageClassPrivate = 6, + StorageClassFunction = 7, + StorageClassGeneric = 8, + StorageClassPushConstant = 9, + StorageClassAtomicCounter = 10, + StorageClassImage = 11, + StorageClassStorageBuffer = 12, + StorageClassMax = 0x7fffffff, +}; + +enum Dim { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + DimCube = 3, + DimRect = 4, + DimBuffer = 5, + DimSubpassData = 6, + DimMax = 0x7fffffff, +}; + +enum SamplerAddressingMode { + SamplerAddressingModeNone = 0, + SamplerAddressingModeClampToEdge = 1, + SamplerAddressingModeClamp = 2, + SamplerAddressingModeRepeat = 3, + SamplerAddressingModeRepeatMirrored = 4, + SamplerAddressingModeMax = 0x7fffffff, +}; + +enum SamplerFilterMode { + SamplerFilterModeNearest = 0, + SamplerFilterModeLinear = 1, + SamplerFilterModeMax = 0x7fffffff, +}; + +enum ImageFormat { + ImageFormatUnknown = 0, + ImageFormatRgba32f = 1, + ImageFormatRgba16f = 2, + ImageFormatR32f = 3, + ImageFormatRgba8 = 4, + ImageFormatRgba8Snorm = 5, + ImageFormatRg32f = 6, + ImageFormatRg16f = 7, + ImageFormatR11fG11fB10f = 8, + ImageFormatR16f = 9, + ImageFormatRgba16 = 10, + ImageFormatRgb10A2 = 11, + ImageFormatRg16 = 12, + ImageFormatRg8 = 13, + ImageFormatR16 = 14, + ImageFormatR8 = 15, + ImageFormatRgba16Snorm = 16, + ImageFormatRg16Snorm = 17, + ImageFormatRg8Snorm = 18, + ImageFormatR16Snorm = 19, + ImageFormatR8Snorm = 20, + ImageFormatRgba32i = 21, + ImageFormatRgba16i = 22, + ImageFormatRgba8i = 23, + ImageFormatR32i = 24, + ImageFormatRg32i = 25, + ImageFormatRg16i = 26, + ImageFormatRg8i = 27, + ImageFormatR16i = 28, + ImageFormatR8i = 29, + ImageFormatRgba32ui = 30, + ImageFormatRgba16ui = 31, + ImageFormatRgba8ui = 32, + ImageFormatR32ui = 33, + ImageFormatRgb10a2ui = 34, + ImageFormatRg32ui = 35, + ImageFormatRg16ui = 36, + ImageFormatRg8ui = 37, + ImageFormatR16ui = 38, + ImageFormatR8ui = 39, + ImageFormatMax = 0x7fffffff, +}; + +enum ImageChannelOrder { + ImageChannelOrderR = 0, + ImageChannelOrderA = 1, + ImageChannelOrderRG = 2, + ImageChannelOrderRA = 3, + ImageChannelOrderRGB = 4, + ImageChannelOrderRGBA = 5, + ImageChannelOrderBGRA = 6, + ImageChannelOrderARGB = 7, + ImageChannelOrderIntensity = 8, + ImageChannelOrderLuminance = 9, + ImageChannelOrderRx = 10, + ImageChannelOrderRGx = 11, + ImageChannelOrderRGBx = 12, + ImageChannelOrderDepth = 13, + ImageChannelOrderDepthStencil = 14, + ImageChannelOrdersRGB = 15, + ImageChannelOrdersRGBx = 16, + ImageChannelOrdersRGBA = 17, + ImageChannelOrdersBGRA = 18, + ImageChannelOrderABGR = 19, + ImageChannelOrderMax = 0x7fffffff, +}; + +enum ImageChannelDataType { + ImageChannelDataTypeSnormInt8 = 0, + ImageChannelDataTypeSnormInt16 = 1, + ImageChannelDataTypeUnormInt8 = 2, + ImageChannelDataTypeUnormInt16 = 3, + ImageChannelDataTypeUnormShort565 = 4, + ImageChannelDataTypeUnormShort555 = 5, + ImageChannelDataTypeUnormInt101010 = 6, + ImageChannelDataTypeSignedInt8 = 7, + ImageChannelDataTypeSignedInt16 = 8, + ImageChannelDataTypeSignedInt32 = 9, + ImageChannelDataTypeUnsignedInt8 = 10, + ImageChannelDataTypeUnsignedInt16 = 11, + ImageChannelDataTypeUnsignedInt32 = 12, + ImageChannelDataTypeHalfFloat = 13, + ImageChannelDataTypeFloat = 14, + ImageChannelDataTypeUnormInt24 = 15, + ImageChannelDataTypeUnormInt101010_2 = 16, + ImageChannelDataTypeMax = 0x7fffffff, +}; + +enum ImageOperandsShift { + ImageOperandsBiasShift = 0, + ImageOperandsLodShift = 1, + ImageOperandsGradShift = 2, + ImageOperandsConstOffsetShift = 3, + ImageOperandsOffsetShift = 4, + ImageOperandsConstOffsetsShift = 5, + ImageOperandsSampleShift = 6, + ImageOperandsMinLodShift = 7, + ImageOperandsMax = 0x7fffffff, +}; + +enum ImageOperandsMask { + ImageOperandsMaskNone = 0, + ImageOperandsBiasMask = 0x00000001, + ImageOperandsLodMask = 0x00000002, + ImageOperandsGradMask = 0x00000004, + ImageOperandsConstOffsetMask = 0x00000008, + ImageOperandsOffsetMask = 0x00000010, + ImageOperandsConstOffsetsMask = 0x00000020, + ImageOperandsSampleMask = 0x00000040, + ImageOperandsMinLodMask = 0x00000080, +}; + +enum FPFastMathModeShift { + FPFastMathModeNotNaNShift = 0, + FPFastMathModeNotInfShift = 1, + FPFastMathModeNSZShift = 2, + FPFastMathModeAllowRecipShift = 3, + FPFastMathModeFastShift = 4, + FPFastMathModeMax = 0x7fffffff, +}; + +enum FPFastMathModeMask { + FPFastMathModeMaskNone = 0, + FPFastMathModeNotNaNMask = 0x00000001, + FPFastMathModeNotInfMask = 0x00000002, + FPFastMathModeNSZMask = 0x00000004, + FPFastMathModeAllowRecipMask = 0x00000008, + FPFastMathModeFastMask = 0x00000010, +}; + +enum FPRoundingMode { + FPRoundingModeRTE = 0, + FPRoundingModeRTZ = 1, + FPRoundingModeRTP = 2, + FPRoundingModeRTN = 3, + FPRoundingModeMax = 0x7fffffff, +}; + +enum LinkageType { + LinkageTypeExport = 0, + LinkageTypeImport = 1, + LinkageTypeMax = 0x7fffffff, +}; + +enum AccessQualifier { + AccessQualifierReadOnly = 0, + AccessQualifierWriteOnly = 1, + AccessQualifierReadWrite = 2, + AccessQualifierMax = 0x7fffffff, +}; + +enum FunctionParameterAttribute { + FunctionParameterAttributeZext = 0, + FunctionParameterAttributeSext = 1, + FunctionParameterAttributeByVal = 2, + FunctionParameterAttributeSret = 3, + FunctionParameterAttributeNoAlias = 4, + FunctionParameterAttributeNoCapture = 5, + FunctionParameterAttributeNoWrite = 6, + FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeMax = 0x7fffffff, +}; + +enum Decoration { + DecorationRelaxedPrecision = 0, + DecorationSpecId = 1, + DecorationBlock = 2, + DecorationBufferBlock = 3, + DecorationRowMajor = 4, + DecorationColMajor = 5, + DecorationArrayStride = 6, + DecorationMatrixStride = 7, + DecorationGLSLShared = 8, + DecorationGLSLPacked = 9, + DecorationCPacked = 10, + DecorationBuiltIn = 11, + DecorationNoPerspective = 13, + DecorationFlat = 14, + DecorationPatch = 15, + DecorationCentroid = 16, + DecorationSample = 17, + DecorationInvariant = 18, + DecorationRestrict = 19, + DecorationAliased = 20, + DecorationVolatile = 21, + DecorationConstant = 22, + DecorationCoherent = 23, + DecorationNonWritable = 24, + DecorationNonReadable = 25, + DecorationUniform = 26, + DecorationSaturatedConversion = 28, + DecorationStream = 29, + DecorationLocation = 30, + DecorationComponent = 31, + DecorationIndex = 32, + DecorationBinding = 33, + DecorationDescriptorSet = 34, + DecorationOffset = 35, + DecorationXfbBuffer = 36, + DecorationXfbStride = 37, + DecorationFuncParamAttr = 38, + DecorationFPRoundingMode = 39, + DecorationFPFastMathMode = 40, + DecorationLinkageAttributes = 41, + DecorationNoContraction = 42, + DecorationInputAttachmentIndex = 43, + DecorationAlignment = 44, + DecorationExplicitInterpAMD = 4999, + DecorationOverrideCoverageNV = 5248, + DecorationPassthroughNV = 5250, + DecorationViewportRelativeNV = 5252, + DecorationSecondaryViewportRelativeNV = 5256, + DecorationHlslCounterBufferGOOGLE = 5634, + DecorationHlslSemanticGOOGLE = 5635, + DecorationMax = 0x7fffffff, +}; + +enum BuiltIn { + BuiltInPosition = 0, + BuiltInPointSize = 1, + BuiltInClipDistance = 3, + BuiltInCullDistance = 4, + BuiltInVertexId = 5, + BuiltInInstanceId = 6, + BuiltInPrimitiveId = 7, + BuiltInInvocationId = 8, + BuiltInLayer = 9, + BuiltInViewportIndex = 10, + BuiltInTessLevelOuter = 11, + BuiltInTessLevelInner = 12, + BuiltInTessCoord = 13, + BuiltInPatchVertices = 14, + BuiltInFragCoord = 15, + BuiltInPointCoord = 16, + BuiltInFrontFacing = 17, + BuiltInSampleId = 18, + BuiltInSamplePosition = 19, + BuiltInSampleMask = 20, + BuiltInFragDepth = 22, + BuiltInHelperInvocation = 23, + BuiltInNumWorkgroups = 24, + BuiltInWorkgroupSize = 25, + BuiltInWorkgroupId = 26, + BuiltInLocalInvocationId = 27, + BuiltInGlobalInvocationId = 28, + BuiltInLocalInvocationIndex = 29, + BuiltInWorkDim = 30, + BuiltInGlobalSize = 31, + BuiltInEnqueuedWorkgroupSize = 32, + BuiltInGlobalOffset = 33, + BuiltInGlobalLinearId = 34, + BuiltInSubgroupSize = 36, + BuiltInSubgroupMaxSize = 37, + BuiltInNumSubgroups = 38, + BuiltInNumEnqueuedSubgroups = 39, + BuiltInSubgroupId = 40, + BuiltInSubgroupLocalInvocationId = 41, + BuiltInVertexIndex = 42, + BuiltInInstanceIndex = 43, + BuiltInSubgroupEqMaskKHR = 4416, + BuiltInSubgroupGeMaskKHR = 4417, + BuiltInSubgroupGtMaskKHR = 4418, + BuiltInSubgroupLeMaskKHR = 4419, + BuiltInSubgroupLtMaskKHR = 4420, + BuiltInBaseVertex = 4424, + BuiltInBaseInstance = 4425, + BuiltInDrawIndex = 4426, + BuiltInDeviceIndex = 4438, + BuiltInViewIndex = 4440, + BuiltInBaryCoordNoPerspAMD = 4992, + BuiltInBaryCoordNoPerspCentroidAMD = 4993, + BuiltInBaryCoordNoPerspSampleAMD = 4994, + BuiltInBaryCoordSmoothAMD = 4995, + BuiltInBaryCoordSmoothCentroidAMD = 4996, + BuiltInBaryCoordSmoothSampleAMD = 4997, + BuiltInBaryCoordPullModelAMD = 4998, + BuiltInFragStencilRefEXT = 5014, + BuiltInViewportMaskNV = 5253, + BuiltInSecondaryPositionNV = 5257, + BuiltInSecondaryViewportMaskNV = 5258, + BuiltInPositionPerViewNV = 5261, + BuiltInViewportMaskPerViewNV = 5262, + BuiltInMax = 0x7fffffff, +}; + +enum SelectionControlShift { + SelectionControlFlattenShift = 0, + SelectionControlDontFlattenShift = 1, + SelectionControlMax = 0x7fffffff, +}; + +enum SelectionControlMask { + SelectionControlMaskNone = 0, + SelectionControlFlattenMask = 0x00000001, + SelectionControlDontFlattenMask = 0x00000002, +}; + +enum LoopControlShift { + LoopControlUnrollShift = 0, + LoopControlDontUnrollShift = 1, + LoopControlMax = 0x7fffffff, +}; + +enum LoopControlMask { + LoopControlMaskNone = 0, + LoopControlUnrollMask = 0x00000001, + LoopControlDontUnrollMask = 0x00000002, +}; + +enum FunctionControlShift { + FunctionControlInlineShift = 0, + FunctionControlDontInlineShift = 1, + FunctionControlPureShift = 2, + FunctionControlConstShift = 3, + FunctionControlMax = 0x7fffffff, +}; + +enum FunctionControlMask { + FunctionControlMaskNone = 0, + FunctionControlInlineMask = 0x00000001, + FunctionControlDontInlineMask = 0x00000002, + FunctionControlPureMask = 0x00000004, + FunctionControlConstMask = 0x00000008, +}; + +enum MemorySemanticsShift { + MemorySemanticsAcquireShift = 1, + MemorySemanticsReleaseShift = 2, + MemorySemanticsAcquireReleaseShift = 3, + MemorySemanticsSequentiallyConsistentShift = 4, + MemorySemanticsUniformMemoryShift = 6, + MemorySemanticsSubgroupMemoryShift = 7, + MemorySemanticsWorkgroupMemoryShift = 8, + MemorySemanticsCrossWorkgroupMemoryShift = 9, + MemorySemanticsAtomicCounterMemoryShift = 10, + MemorySemanticsImageMemoryShift = 11, + MemorySemanticsMax = 0x7fffffff, +}; + +enum MemorySemanticsMask { + MemorySemanticsMaskNone = 0, + MemorySemanticsAcquireMask = 0x00000002, + MemorySemanticsReleaseMask = 0x00000004, + MemorySemanticsAcquireReleaseMask = 0x00000008, + MemorySemanticsSequentiallyConsistentMask = 0x00000010, + MemorySemanticsUniformMemoryMask = 0x00000040, + MemorySemanticsSubgroupMemoryMask = 0x00000080, + MemorySemanticsWorkgroupMemoryMask = 0x00000100, + MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + MemorySemanticsAtomicCounterMemoryMask = 0x00000400, + MemorySemanticsImageMemoryMask = 0x00000800, +}; + +enum MemoryAccessShift { + MemoryAccessVolatileShift = 0, + MemoryAccessAlignedShift = 1, + MemoryAccessNontemporalShift = 2, + MemoryAccessMax = 0x7fffffff, +}; + +enum MemoryAccessMask { + MemoryAccessMaskNone = 0, + MemoryAccessVolatileMask = 0x00000001, + MemoryAccessAlignedMask = 0x00000002, + MemoryAccessNontemporalMask = 0x00000004, +}; + +enum Scope { + ScopeCrossDevice = 0, + ScopeDevice = 1, + ScopeWorkgroup = 2, + ScopeSubgroup = 3, + ScopeInvocation = 4, + ScopeMax = 0x7fffffff, +}; + +enum GroupOperation { + GroupOperationReduce = 0, + GroupOperationInclusiveScan = 1, + GroupOperationExclusiveScan = 2, + GroupOperationMax = 0x7fffffff, +}; + +enum KernelEnqueueFlags { + KernelEnqueueFlagsNoWait = 0, + KernelEnqueueFlagsWaitKernel = 1, + KernelEnqueueFlagsWaitWorkGroup = 2, + KernelEnqueueFlagsMax = 0x7fffffff, +}; + +enum KernelProfilingInfoShift { + KernelProfilingInfoCmdExecTimeShift = 0, + KernelProfilingInfoMax = 0x7fffffff, +}; + +enum KernelProfilingInfoMask { + KernelProfilingInfoMaskNone = 0, + KernelProfilingInfoCmdExecTimeMask = 0x00000001, +}; + +enum Capability { + CapabilityMatrix = 0, + CapabilityShader = 1, + CapabilityGeometry = 2, + CapabilityTessellation = 3, + CapabilityAddresses = 4, + CapabilityLinkage = 5, + CapabilityKernel = 6, + CapabilityVector16 = 7, + CapabilityFloat16Buffer = 8, + CapabilityFloat16 = 9, + CapabilityFloat64 = 10, + CapabilityInt64 = 11, + CapabilityInt64Atomics = 12, + CapabilityImageBasic = 13, + CapabilityImageReadWrite = 14, + CapabilityImageMipmap = 15, + CapabilityPipes = 17, + CapabilityGroups = 18, + CapabilityDeviceEnqueue = 19, + CapabilityLiteralSampler = 20, + CapabilityAtomicStorage = 21, + CapabilityInt16 = 22, + CapabilityTessellationPointSize = 23, + CapabilityGeometryPointSize = 24, + CapabilityImageGatherExtended = 25, + CapabilityStorageImageMultisample = 27, + CapabilityUniformBufferArrayDynamicIndexing = 28, + CapabilitySampledImageArrayDynamicIndexing = 29, + CapabilityStorageBufferArrayDynamicIndexing = 30, + CapabilityStorageImageArrayDynamicIndexing = 31, + CapabilityClipDistance = 32, + CapabilityCullDistance = 33, + CapabilityImageCubeArray = 34, + CapabilitySampleRateShading = 35, + CapabilityImageRect = 36, + CapabilitySampledRect = 37, + CapabilityGenericPointer = 38, + CapabilityInt8 = 39, + CapabilityInputAttachment = 40, + CapabilitySparseResidency = 41, + CapabilityMinLod = 42, + CapabilitySampled1D = 43, + CapabilityImage1D = 44, + CapabilitySampledCubeArray = 45, + CapabilitySampledBuffer = 46, + CapabilityImageBuffer = 47, + CapabilityImageMSArray = 48, + CapabilityStorageImageExtendedFormats = 49, + CapabilityImageQuery = 50, + CapabilityDerivativeControl = 51, + CapabilityInterpolationFunction = 52, + CapabilityTransformFeedback = 53, + CapabilityGeometryStreams = 54, + CapabilityStorageImageReadWithoutFormat = 55, + CapabilityStorageImageWriteWithoutFormat = 56, + CapabilityMultiViewport = 57, + CapabilitySubgroupBallotKHR = 4423, + CapabilityDrawParameters = 4427, + CapabilitySubgroupVoteKHR = 4431, + CapabilityStorageBuffer16BitAccess = 4433, + CapabilityStorageUniformBufferBlock16 = 4433, + CapabilityStorageUniform16 = 4434, + CapabilityUniformAndStorageBuffer16BitAccess = 4434, + CapabilityStoragePushConstant16 = 4435, + CapabilityStorageInputOutput16 = 4436, + CapabilityDeviceGroup = 4437, + CapabilityMultiView = 4439, + CapabilityVariablePointersStorageBuffer = 4441, + CapabilityVariablePointers = 4442, + CapabilityAtomicStorageOps = 4445, + CapabilitySampleMaskPostDepthCoverage = 4447, + CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, + CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, + CapabilitySampleMaskOverrideCoverageNV = 5249, + CapabilityGeometryShaderPassthroughNV = 5251, + CapabilityShaderViewportIndexLayerEXT = 5254, + CapabilityShaderViewportIndexLayerNV = 5254, + CapabilityShaderViewportMaskNV = 5255, + CapabilityShaderStereoViewNV = 5259, + CapabilityPerViewAttributesNV = 5260, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, + CapabilityMax = 0x7fffffff, +}; + +enum Op { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + OpMax = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.hpp11 b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.hpp11 new file mode 100644 index 00000000000..8896e81b7c4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.hpp11 @@ -0,0 +1,1002 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10000 +#define SPV_REVISION 12 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010000; +static const unsigned int Revision = 12; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.json new file mode 100644 index 00000000000..9b0a8f3de28 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.json @@ -0,0 +1,1020 @@ +{ + "spv": + { + "meta": + { + "Comment": + [ + [ + "Copyright (c) 2014-2018 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + [ + "This header is automatically generated by the same tool that creates", + "the Binary Section of the SPIR-V specification." + ], + [ + "Enumeration tokens for SPIR-V, in various styles:", + " C, C++, C++11, JSON, Lua, Python", + "", + "- C will have tokens with a \"Spv\" prefix, e.g.: SpvSourceLanguageGLSL", + "- C++ will have tokens in the \"spv\" name space, e.g.: spv::SourceLanguageGLSL", + "- C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL", + "- Lua will use tables, e.g.: spv.SourceLanguage.GLSL", + "- Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']", + "", + "Some tokens act like mask values, which can be OR'd together,", + "while others are mutually exclusive. The mask-like ones have", + "\"Mask\" in their name, and a parallel enum that has the shift", + "amount (1 << x) for each corresponding enumerant." + ] + ], + "MagicNumber": 119734787, + "Version": 65536, + "Revision": 12, + "OpCodeMask": 65535, + "WordCountShift": 16 + }, + "enum": + [ + { + "Name": "SourceLanguage", + "Type": "Value", + "Values": + { + "Unknown": 0, + "ESSL": 1, + "GLSL": 2, + "OpenCL_C": 3, + "OpenCL_CPP": 4, + "HLSL": 5 + } + }, + { + "Name": "ExecutionModel", + "Type": "Value", + "Values": + { + "Vertex": 0, + "TessellationControl": 1, + "TessellationEvaluation": 2, + "Geometry": 3, + "Fragment": 4, + "GLCompute": 5, + "Kernel": 6 + } + }, + { + "Name": "AddressingModel", + "Type": "Value", + "Values": + { + "Logical": 0, + "Physical32": 1, + "Physical64": 2 + } + }, + { + "Name": "MemoryModel", + "Type": "Value", + "Values": + { + "Simple": 0, + "GLSL450": 1, + "OpenCL": 2 + } + }, + { + "Name": "ExecutionMode", + "Type": "Value", + "Values": + { + "Invocations": 0, + "SpacingEqual": 1, + "SpacingFractionalEven": 2, + "SpacingFractionalOdd": 3, + "VertexOrderCw": 4, + "VertexOrderCcw": 5, + "PixelCenterInteger": 6, + "OriginUpperLeft": 7, + "OriginLowerLeft": 8, + "EarlyFragmentTests": 9, + "PointMode": 10, + "Xfb": 11, + "DepthReplacing": 12, + "DepthGreater": 14, + "DepthLess": 15, + "DepthUnchanged": 16, + "LocalSize": 17, + "LocalSizeHint": 18, + "InputPoints": 19, + "InputLines": 20, + "InputLinesAdjacency": 21, + "Triangles": 22, + "InputTrianglesAdjacency": 23, + "Quads": 24, + "Isolines": 25, + "OutputVertices": 26, + "OutputPoints": 27, + "OutputLineStrip": 28, + "OutputTriangleStrip": 29, + "VecTypeHint": 30, + "ContractionOff": 31, + "PostDepthCoverage": 4446, + "StencilRefReplacingEXT": 5027 + } + }, + { + "Name": "StorageClass", + "Type": "Value", + "Values": + { + "UniformConstant": 0, + "Input": 1, + "Uniform": 2, + "Output": 3, + "Workgroup": 4, + "CrossWorkgroup": 5, + "Private": 6, + "Function": 7, + "Generic": 8, + "PushConstant": 9, + "AtomicCounter": 10, + "Image": 11, + "StorageBuffer": 12 + } + }, + { + "Name": "Dim", + "Type": "Value", + "Values": + { + "Dim1D": 0, + "Dim2D": 1, + "Dim3D": 2, + "Cube": 3, + "Rect": 4, + "Buffer": 5, + "SubpassData": 6 + } + }, + { + "Name": "SamplerAddressingMode", + "Type": "Value", + "Values": + { + "None": 0, + "ClampToEdge": 1, + "Clamp": 2, + "Repeat": 3, + "RepeatMirrored": 4 + } + }, + { + "Name": "SamplerFilterMode", + "Type": "Value", + "Values": + { + "Nearest": 0, + "Linear": 1 + } + }, + { + "Name": "ImageFormat", + "Type": "Value", + "Values": + { + "Unknown": 0, + "Rgba32f": 1, + "Rgba16f": 2, + "R32f": 3, + "Rgba8": 4, + "Rgba8Snorm": 5, + "Rg32f": 6, + "Rg16f": 7, + "R11fG11fB10f": 8, + "R16f": 9, + "Rgba16": 10, + "Rgb10A2": 11, + "Rg16": 12, + "Rg8": 13, + "R16": 14, + "R8": 15, + "Rgba16Snorm": 16, + "Rg16Snorm": 17, + "Rg8Snorm": 18, + "R16Snorm": 19, + "R8Snorm": 20, + "Rgba32i": 21, + "Rgba16i": 22, + "Rgba8i": 23, + "R32i": 24, + "Rg32i": 25, + "Rg16i": 26, + "Rg8i": 27, + "R16i": 28, + "R8i": 29, + "Rgba32ui": 30, + "Rgba16ui": 31, + "Rgba8ui": 32, + "R32ui": 33, + "Rgb10a2ui": 34, + "Rg32ui": 35, + "Rg16ui": 36, + "Rg8ui": 37, + "R16ui": 38, + "R8ui": 39 + } + }, + { + "Name": "ImageChannelOrder", + "Type": "Value", + "Values": + { + "R": 0, + "A": 1, + "RG": 2, + "RA": 3, + "RGB": 4, + "RGBA": 5, + "BGRA": 6, + "ARGB": 7, + "Intensity": 8, + "Luminance": 9, + "Rx": 10, + "RGx": 11, + "RGBx": 12, + "Depth": 13, + "DepthStencil": 14, + "sRGB": 15, + "sRGBx": 16, + "sRGBA": 17, + "sBGRA": 18, + "ABGR": 19 + } + }, + { + "Name": "ImageChannelDataType", + "Type": "Value", + "Values": + { + "SnormInt8": 0, + "SnormInt16": 1, + "UnormInt8": 2, + "UnormInt16": 3, + "UnormShort565": 4, + "UnormShort555": 5, + "UnormInt101010": 6, + "SignedInt8": 7, + "SignedInt16": 8, + "SignedInt32": 9, + "UnsignedInt8": 10, + "UnsignedInt16": 11, + "UnsignedInt32": 12, + "HalfFloat": 13, + "Float": 14, + "UnormInt24": 15, + "UnormInt101010_2": 16 + } + }, + { + "Name": "ImageOperands", + "Type": "Bit", + "Values": + { + "Bias": 0, + "Lod": 1, + "Grad": 2, + "ConstOffset": 3, + "Offset": 4, + "ConstOffsets": 5, + "Sample": 6, + "MinLod": 7 + } + }, + { + "Name": "FPFastMathMode", + "Type": "Bit", + "Values": + { + "NotNaN": 0, + "NotInf": 1, + "NSZ": 2, + "AllowRecip": 3, + "Fast": 4 + } + }, + { + "Name": "FPRoundingMode", + "Type": "Value", + "Values": + { + "RTE": 0, + "RTZ": 1, + "RTP": 2, + "RTN": 3 + } + }, + { + "Name": "LinkageType", + "Type": "Value", + "Values": + { + "Export": 0, + "Import": 1 + } + }, + { + "Name": "AccessQualifier", + "Type": "Value", + "Values": + { + "ReadOnly": 0, + "WriteOnly": 1, + "ReadWrite": 2 + } + }, + { + "Name": "FunctionParameterAttribute", + "Type": "Value", + "Values": + { + "Zext": 0, + "Sext": 1, + "ByVal": 2, + "Sret": 3, + "NoAlias": 4, + "NoCapture": 5, + "NoWrite": 6, + "NoReadWrite": 7 + } + }, + { + "Name": "Decoration", + "Type": "Value", + "Values": + { + "RelaxedPrecision": 0, + "SpecId": 1, + "Block": 2, + "BufferBlock": 3, + "RowMajor": 4, + "ColMajor": 5, + "ArrayStride": 6, + "MatrixStride": 7, + "GLSLShared": 8, + "GLSLPacked": 9, + "CPacked": 10, + "BuiltIn": 11, + "NoPerspective": 13, + "Flat": 14, + "Patch": 15, + "Centroid": 16, + "Sample": 17, + "Invariant": 18, + "Restrict": 19, + "Aliased": 20, + "Volatile": 21, + "Constant": 22, + "Coherent": 23, + "NonWritable": 24, + "NonReadable": 25, + "Uniform": 26, + "SaturatedConversion": 28, + "Stream": 29, + "Location": 30, + "Component": 31, + "Index": 32, + "Binding": 33, + "DescriptorSet": 34, + "Offset": 35, + "XfbBuffer": 36, + "XfbStride": 37, + "FuncParamAttr": 38, + "FPRoundingMode": 39, + "FPFastMathMode": 40, + "LinkageAttributes": 41, + "NoContraction": 42, + "InputAttachmentIndex": 43, + "Alignment": 44, + "ExplicitInterpAMD": 4999, + "OverrideCoverageNV": 5248, + "PassthroughNV": 5250, + "ViewportRelativeNV": 5252, + "SecondaryViewportRelativeNV": 5256, + "HlslCounterBufferGOOGLE": 5634, + "HlslSemanticGOOGLE": 5635 + } + }, + { + "Name": "BuiltIn", + "Type": "Value", + "Values": + { + "Position": 0, + "PointSize": 1, + "ClipDistance": 3, + "CullDistance": 4, + "VertexId": 5, + "InstanceId": 6, + "PrimitiveId": 7, + "InvocationId": 8, + "Layer": 9, + "ViewportIndex": 10, + "TessLevelOuter": 11, + "TessLevelInner": 12, + "TessCoord": 13, + "PatchVertices": 14, + "FragCoord": 15, + "PointCoord": 16, + "FrontFacing": 17, + "SampleId": 18, + "SamplePosition": 19, + "SampleMask": 20, + "FragDepth": 22, + "HelperInvocation": 23, + "NumWorkgroups": 24, + "WorkgroupSize": 25, + "WorkgroupId": 26, + "LocalInvocationId": 27, + "GlobalInvocationId": 28, + "LocalInvocationIndex": 29, + "WorkDim": 30, + "GlobalSize": 31, + "EnqueuedWorkgroupSize": 32, + "GlobalOffset": 33, + "GlobalLinearId": 34, + "SubgroupSize": 36, + "SubgroupMaxSize": 37, + "NumSubgroups": 38, + "NumEnqueuedSubgroups": 39, + "SubgroupId": 40, + "SubgroupLocalInvocationId": 41, + "VertexIndex": 42, + "InstanceIndex": 43, + "SubgroupEqMaskKHR": 4416, + "SubgroupGeMaskKHR": 4417, + "SubgroupGtMaskKHR": 4418, + "SubgroupLeMaskKHR": 4419, + "SubgroupLtMaskKHR": 4420, + "BaseVertex": 4424, + "BaseInstance": 4425, + "DrawIndex": 4426, + "DeviceIndex": 4438, + "ViewIndex": 4440, + "BaryCoordNoPerspAMD": 4992, + "BaryCoordNoPerspCentroidAMD": 4993, + "BaryCoordNoPerspSampleAMD": 4994, + "BaryCoordSmoothAMD": 4995, + "BaryCoordSmoothCentroidAMD": 4996, + "BaryCoordSmoothSampleAMD": 4997, + "BaryCoordPullModelAMD": 4998, + "FragStencilRefEXT": 5014, + "ViewportMaskNV": 5253, + "SecondaryPositionNV": 5257, + "SecondaryViewportMaskNV": 5258, + "PositionPerViewNV": 5261, + "ViewportMaskPerViewNV": 5262 + } + }, + { + "Name": "SelectionControl", + "Type": "Bit", + "Values": + { + "Flatten": 0, + "DontFlatten": 1 + } + }, + { + "Name": "LoopControl", + "Type": "Bit", + "Values": + { + "Unroll": 0, + "DontUnroll": 1 + } + }, + { + "Name": "FunctionControl", + "Type": "Bit", + "Values": + { + "Inline": 0, + "DontInline": 1, + "Pure": 2, + "Const": 3 + } + }, + { + "Name": "MemorySemantics", + "Type": "Bit", + "Values": + { + "Acquire": 1, + "Release": 2, + "AcquireRelease": 3, + "SequentiallyConsistent": 4, + "UniformMemory": 6, + "SubgroupMemory": 7, + "WorkgroupMemory": 8, + "CrossWorkgroupMemory": 9, + "AtomicCounterMemory": 10, + "ImageMemory": 11 + } + }, + { + "Name": "MemoryAccess", + "Type": "Bit", + "Values": + { + "Volatile": 0, + "Aligned": 1, + "Nontemporal": 2 + } + }, + { + "Name": "Scope", + "Type": "Value", + "Values": + { + "CrossDevice": 0, + "Device": 1, + "Workgroup": 2, + "Subgroup": 3, + "Invocation": 4 + } + }, + { + "Name": "GroupOperation", + "Type": "Value", + "Values": + { + "Reduce": 0, + "InclusiveScan": 1, + "ExclusiveScan": 2 + } + }, + { + "Name": "KernelEnqueueFlags", + "Type": "Value", + "Values": + { + "NoWait": 0, + "WaitKernel": 1, + "WaitWorkGroup": 2 + } + }, + { + "Name": "KernelProfilingInfo", + "Type": "Bit", + "Values": + { + "CmdExecTime": 0 + } + }, + { + "Name": "Capability", + "Type": "Value", + "Values": + { + "Matrix": 0, + "Shader": 1, + "Geometry": 2, + "Tessellation": 3, + "Addresses": 4, + "Linkage": 5, + "Kernel": 6, + "Vector16": 7, + "Float16Buffer": 8, + "Float16": 9, + "Float64": 10, + "Int64": 11, + "Int64Atomics": 12, + "ImageBasic": 13, + "ImageReadWrite": 14, + "ImageMipmap": 15, + "Pipes": 17, + "Groups": 18, + "DeviceEnqueue": 19, + "LiteralSampler": 20, + "AtomicStorage": 21, + "Int16": 22, + "TessellationPointSize": 23, + "GeometryPointSize": 24, + "ImageGatherExtended": 25, + "StorageImageMultisample": 27, + "UniformBufferArrayDynamicIndexing": 28, + "SampledImageArrayDynamicIndexing": 29, + "StorageBufferArrayDynamicIndexing": 30, + "StorageImageArrayDynamicIndexing": 31, + "ClipDistance": 32, + "CullDistance": 33, + "ImageCubeArray": 34, + "SampleRateShading": 35, + "ImageRect": 36, + "SampledRect": 37, + "GenericPointer": 38, + "Int8": 39, + "InputAttachment": 40, + "SparseResidency": 41, + "MinLod": 42, + "Sampled1D": 43, + "Image1D": 44, + "SampledCubeArray": 45, + "SampledBuffer": 46, + "ImageBuffer": 47, + "ImageMSArray": 48, + "StorageImageExtendedFormats": 49, + "ImageQuery": 50, + "DerivativeControl": 51, + "InterpolationFunction": 52, + "TransformFeedback": 53, + "GeometryStreams": 54, + "StorageImageReadWithoutFormat": 55, + "StorageImageWriteWithoutFormat": 56, + "MultiViewport": 57, + "SubgroupBallotKHR": 4423, + "DrawParameters": 4427, + "SubgroupVoteKHR": 4431, + "StorageBuffer16BitAccess": 4433, + "StorageUniformBufferBlock16": 4433, + "StorageUniform16": 4434, + "UniformAndStorageBuffer16BitAccess": 4434, + "StoragePushConstant16": 4435, + "StorageInputOutput16": 4436, + "DeviceGroup": 4437, + "MultiView": 4439, + "VariablePointersStorageBuffer": 4441, + "VariablePointers": 4442, + "AtomicStorageOps": 4445, + "SampleMaskPostDepthCoverage": 4447, + "ImageGatherBiasLodAMD": 5009, + "FragmentMaskAMD": 5010, + "StencilExportEXT": 5013, + "ImageReadWriteLodAMD": 5015, + "SampleMaskOverrideCoverageNV": 5249, + "GeometryShaderPassthroughNV": 5251, + "ShaderViewportIndexLayerEXT": 5254, + "ShaderViewportIndexLayerNV": 5254, + "ShaderViewportMaskNV": 5255, + "ShaderStereoViewNV": 5259, + "PerViewAttributesNV": 5260, + "SubgroupShuffleINTEL": 5568, + "SubgroupBufferBlockIOINTEL": 5569, + "SubgroupImageBlockIOINTEL": 5570 + } + }, + { + "Name": "Op", + "Type": "Value", + "Values": + { + "OpNop": 0, + "OpUndef": 1, + "OpSourceContinued": 2, + "OpSource": 3, + "OpSourceExtension": 4, + "OpName": 5, + "OpMemberName": 6, + "OpString": 7, + "OpLine": 8, + "OpExtension": 10, + "OpExtInstImport": 11, + "OpExtInst": 12, + "OpMemoryModel": 14, + "OpEntryPoint": 15, + "OpExecutionMode": 16, + "OpCapability": 17, + "OpTypeVoid": 19, + "OpTypeBool": 20, + "OpTypeInt": 21, + "OpTypeFloat": 22, + "OpTypeVector": 23, + "OpTypeMatrix": 24, + "OpTypeImage": 25, + "OpTypeSampler": 26, + "OpTypeSampledImage": 27, + "OpTypeArray": 28, + "OpTypeRuntimeArray": 29, + "OpTypeStruct": 30, + "OpTypeOpaque": 31, + "OpTypePointer": 32, + "OpTypeFunction": 33, + "OpTypeEvent": 34, + "OpTypeDeviceEvent": 35, + "OpTypeReserveId": 36, + "OpTypeQueue": 37, + "OpTypePipe": 38, + "OpTypeForwardPointer": 39, + "OpConstantTrue": 41, + "OpConstantFalse": 42, + "OpConstant": 43, + "OpConstantComposite": 44, + "OpConstantSampler": 45, + "OpConstantNull": 46, + "OpSpecConstantTrue": 48, + "OpSpecConstantFalse": 49, + "OpSpecConstant": 50, + "OpSpecConstantComposite": 51, + "OpSpecConstantOp": 52, + "OpFunction": 54, + "OpFunctionParameter": 55, + "OpFunctionEnd": 56, + "OpFunctionCall": 57, + "OpVariable": 59, + "OpImageTexelPointer": 60, + "OpLoad": 61, + "OpStore": 62, + "OpCopyMemory": 63, + "OpCopyMemorySized": 64, + "OpAccessChain": 65, + "OpInBoundsAccessChain": 66, + "OpPtrAccessChain": 67, + "OpArrayLength": 68, + "OpGenericPtrMemSemantics": 69, + "OpInBoundsPtrAccessChain": 70, + "OpDecorate": 71, + "OpMemberDecorate": 72, + "OpDecorationGroup": 73, + "OpGroupDecorate": 74, + "OpGroupMemberDecorate": 75, + "OpVectorExtractDynamic": 77, + "OpVectorInsertDynamic": 78, + "OpVectorShuffle": 79, + "OpCompositeConstruct": 80, + "OpCompositeExtract": 81, + "OpCompositeInsert": 82, + "OpCopyObject": 83, + "OpTranspose": 84, + "OpSampledImage": 86, + "OpImageSampleImplicitLod": 87, + "OpImageSampleExplicitLod": 88, + "OpImageSampleDrefImplicitLod": 89, + "OpImageSampleDrefExplicitLod": 90, + "OpImageSampleProjImplicitLod": 91, + "OpImageSampleProjExplicitLod": 92, + "OpImageSampleProjDrefImplicitLod": 93, + "OpImageSampleProjDrefExplicitLod": 94, + "OpImageFetch": 95, + "OpImageGather": 96, + "OpImageDrefGather": 97, + "OpImageRead": 98, + "OpImageWrite": 99, + "OpImage": 100, + "OpImageQueryFormat": 101, + "OpImageQueryOrder": 102, + "OpImageQuerySizeLod": 103, + "OpImageQuerySize": 104, + "OpImageQueryLod": 105, + "OpImageQueryLevels": 106, + "OpImageQuerySamples": 107, + "OpConvertFToU": 109, + "OpConvertFToS": 110, + "OpConvertSToF": 111, + "OpConvertUToF": 112, + "OpUConvert": 113, + "OpSConvert": 114, + "OpFConvert": 115, + "OpQuantizeToF16": 116, + "OpConvertPtrToU": 117, + "OpSatConvertSToU": 118, + "OpSatConvertUToS": 119, + "OpConvertUToPtr": 120, + "OpPtrCastToGeneric": 121, + "OpGenericCastToPtr": 122, + "OpGenericCastToPtrExplicit": 123, + "OpBitcast": 124, + "OpSNegate": 126, + "OpFNegate": 127, + "OpIAdd": 128, + "OpFAdd": 129, + "OpISub": 130, + "OpFSub": 131, + "OpIMul": 132, + "OpFMul": 133, + "OpUDiv": 134, + "OpSDiv": 135, + "OpFDiv": 136, + "OpUMod": 137, + "OpSRem": 138, + "OpSMod": 139, + "OpFRem": 140, + "OpFMod": 141, + "OpVectorTimesScalar": 142, + "OpMatrixTimesScalar": 143, + "OpVectorTimesMatrix": 144, + "OpMatrixTimesVector": 145, + "OpMatrixTimesMatrix": 146, + "OpOuterProduct": 147, + "OpDot": 148, + "OpIAddCarry": 149, + "OpISubBorrow": 150, + "OpUMulExtended": 151, + "OpSMulExtended": 152, + "OpAny": 154, + "OpAll": 155, + "OpIsNan": 156, + "OpIsInf": 157, + "OpIsFinite": 158, + "OpIsNormal": 159, + "OpSignBitSet": 160, + "OpLessOrGreater": 161, + "OpOrdered": 162, + "OpUnordered": 163, + "OpLogicalEqual": 164, + "OpLogicalNotEqual": 165, + "OpLogicalOr": 166, + "OpLogicalAnd": 167, + "OpLogicalNot": 168, + "OpSelect": 169, + "OpIEqual": 170, + "OpINotEqual": 171, + "OpUGreaterThan": 172, + "OpSGreaterThan": 173, + "OpUGreaterThanEqual": 174, + "OpSGreaterThanEqual": 175, + "OpULessThan": 176, + "OpSLessThan": 177, + "OpULessThanEqual": 178, + "OpSLessThanEqual": 179, + "OpFOrdEqual": 180, + "OpFUnordEqual": 181, + "OpFOrdNotEqual": 182, + "OpFUnordNotEqual": 183, + "OpFOrdLessThan": 184, + "OpFUnordLessThan": 185, + "OpFOrdGreaterThan": 186, + "OpFUnordGreaterThan": 187, + "OpFOrdLessThanEqual": 188, + "OpFUnordLessThanEqual": 189, + "OpFOrdGreaterThanEqual": 190, + "OpFUnordGreaterThanEqual": 191, + "OpShiftRightLogical": 194, + "OpShiftRightArithmetic": 195, + "OpShiftLeftLogical": 196, + "OpBitwiseOr": 197, + "OpBitwiseXor": 198, + "OpBitwiseAnd": 199, + "OpNot": 200, + "OpBitFieldInsert": 201, + "OpBitFieldSExtract": 202, + "OpBitFieldUExtract": 203, + "OpBitReverse": 204, + "OpBitCount": 205, + "OpDPdx": 207, + "OpDPdy": 208, + "OpFwidth": 209, + "OpDPdxFine": 210, + "OpDPdyFine": 211, + "OpFwidthFine": 212, + "OpDPdxCoarse": 213, + "OpDPdyCoarse": 214, + "OpFwidthCoarse": 215, + "OpEmitVertex": 218, + "OpEndPrimitive": 219, + "OpEmitStreamVertex": 220, + "OpEndStreamPrimitive": 221, + "OpControlBarrier": 224, + "OpMemoryBarrier": 225, + "OpAtomicLoad": 227, + "OpAtomicStore": 228, + "OpAtomicExchange": 229, + "OpAtomicCompareExchange": 230, + "OpAtomicCompareExchangeWeak": 231, + "OpAtomicIIncrement": 232, + "OpAtomicIDecrement": 233, + "OpAtomicIAdd": 234, + "OpAtomicISub": 235, + "OpAtomicSMin": 236, + "OpAtomicUMin": 237, + "OpAtomicSMax": 238, + "OpAtomicUMax": 239, + "OpAtomicAnd": 240, + "OpAtomicOr": 241, + "OpAtomicXor": 242, + "OpPhi": 245, + "OpLoopMerge": 246, + "OpSelectionMerge": 247, + "OpLabel": 248, + "OpBranch": 249, + "OpBranchConditional": 250, + "OpSwitch": 251, + "OpKill": 252, + "OpReturn": 253, + "OpReturnValue": 254, + "OpUnreachable": 255, + "OpLifetimeStart": 256, + "OpLifetimeStop": 257, + "OpGroupAsyncCopy": 259, + "OpGroupWaitEvents": 260, + "OpGroupAll": 261, + "OpGroupAny": 262, + "OpGroupBroadcast": 263, + "OpGroupIAdd": 264, + "OpGroupFAdd": 265, + "OpGroupFMin": 266, + "OpGroupUMin": 267, + "OpGroupSMin": 268, + "OpGroupFMax": 269, + "OpGroupUMax": 270, + "OpGroupSMax": 271, + "OpReadPipe": 274, + "OpWritePipe": 275, + "OpReservedReadPipe": 276, + "OpReservedWritePipe": 277, + "OpReserveReadPipePackets": 278, + "OpReserveWritePipePackets": 279, + "OpCommitReadPipe": 280, + "OpCommitWritePipe": 281, + "OpIsValidReserveId": 282, + "OpGetNumPipePackets": 283, + "OpGetMaxPipePackets": 284, + "OpGroupReserveReadPipePackets": 285, + "OpGroupReserveWritePipePackets": 286, + "OpGroupCommitReadPipe": 287, + "OpGroupCommitWritePipe": 288, + "OpEnqueueMarker": 291, + "OpEnqueueKernel": 292, + "OpGetKernelNDrangeSubGroupCount": 293, + "OpGetKernelNDrangeMaxSubGroupSize": 294, + "OpGetKernelWorkGroupSize": 295, + "OpGetKernelPreferredWorkGroupSizeMultiple": 296, + "OpRetainEvent": 297, + "OpReleaseEvent": 298, + "OpCreateUserEvent": 299, + "OpIsValidEvent": 300, + "OpSetUserEventStatus": 301, + "OpCaptureEventProfilingInfo": 302, + "OpGetDefaultQueue": 303, + "OpBuildNDRange": 304, + "OpImageSparseSampleImplicitLod": 305, + "OpImageSparseSampleExplicitLod": 306, + "OpImageSparseSampleDrefImplicitLod": 307, + "OpImageSparseSampleDrefExplicitLod": 308, + "OpImageSparseSampleProjImplicitLod": 309, + "OpImageSparseSampleProjExplicitLod": 310, + "OpImageSparseSampleProjDrefImplicitLod": 311, + "OpImageSparseSampleProjDrefExplicitLod": 312, + "OpImageSparseFetch": 313, + "OpImageSparseGather": 314, + "OpImageSparseDrefGather": 315, + "OpImageSparseTexelsResident": 316, + "OpNoLine": 317, + "OpAtomicFlagTestAndSet": 318, + "OpAtomicFlagClear": 319, + "OpImageSparseRead": 320, + "OpDecorateId": 332, + "OpSubgroupBallotKHR": 4421, + "OpSubgroupFirstInvocationKHR": 4422, + "OpSubgroupAllKHR": 4428, + "OpSubgroupAnyKHR": 4429, + "OpSubgroupAllEqualKHR": 4430, + "OpSubgroupReadInvocationKHR": 4432, + "OpGroupIAddNonUniformAMD": 5000, + "OpGroupFAddNonUniformAMD": 5001, + "OpGroupFMinNonUniformAMD": 5002, + "OpGroupUMinNonUniformAMD": 5003, + "OpGroupSMinNonUniformAMD": 5004, + "OpGroupFMaxNonUniformAMD": 5005, + "OpGroupUMaxNonUniformAMD": 5006, + "OpGroupSMaxNonUniformAMD": 5007, + "OpFragmentMaskFetchAMD": 5011, + "OpFragmentFetchAMD": 5012, + "OpSubgroupShuffleINTEL": 5571, + "OpSubgroupShuffleDownINTEL": 5572, + "OpSubgroupShuffleUpINTEL": 5573, + "OpSubgroupShuffleXorINTEL": 5574, + "OpSubgroupBlockReadINTEL": 5575, + "OpSubgroupBlockWriteINTEL": 5576, + "OpSubgroupImageBlockReadINTEL": 5577, + "OpSubgroupImageBlockWriteINTEL": 5578, + "OpDecorateStringGOOGLE": 5632, + "OpMemberDecorateStringGOOGLE": 5633 + } + } + ] + } +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.lua b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.lua new file mode 100644 index 00000000000..2bd33ba082b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.lua @@ -0,0 +1,949 @@ +-- Copyright (c) 2014-2018 The Khronos Group Inc. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and/or associated documentation files (the "Materials"), +-- to deal in the Materials without restriction, including without limitation +-- the rights to use, copy, modify, merge, publish, distribute, sublicense, +-- and/or sell copies of the Materials, and to permit persons to whom the +-- Materials are furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Materials. +-- +-- MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +-- STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +-- HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +-- +-- THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +-- FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +-- IN THE MATERIALS. + +-- This header is automatically generated by the same tool that creates +-- the Binary Section of the SPIR-V specification. + +-- Enumeration tokens for SPIR-V, in various styles: +-- C, C++, C++11, JSON, Lua, Python +-- +-- - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +-- - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +-- - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +-- - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +-- - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +-- +-- Some tokens act like mask values, which can be OR'd together, +-- while others are mutually exclusive. The mask-like ones have +-- "Mask" in their name, and a parallel enum that has the shift +-- amount (1 << x) for each corresponding enumerant. + +spv = { + MagicNumber = 0x07230203, + Version = 0x00010000, + Revision = 12, + OpCodeMask = 0xffff, + WordCountShift = 16, + + SourceLanguage = { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + }, + + ExecutionModel = { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + }, + + AddressingModel = { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + }, + + MemoryModel = { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + }, + + ExecutionMode = { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + }, + + StorageClass = { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + }, + + Dim = { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + }, + + SamplerAddressingMode = { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + }, + + SamplerFilterMode = { + Nearest = 0, + Linear = 1, + }, + + ImageFormat = { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + }, + + ImageChannelOrder = { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + }, + + ImageChannelDataType = { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + }, + + ImageOperandsShift = { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + }, + + ImageOperandsMask = { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, + }, + + FPFastMathModeShift = { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + }, + + FPFastMathModeMask = { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, + }, + + FPRoundingMode = { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + }, + + LinkageType = { + Export = 0, + Import = 1, + }, + + AccessQualifier = { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + }, + + FunctionParameterAttribute = { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + }, + + Decoration = { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + }, + + BuiltIn = { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + }, + + SelectionControlShift = { + Flatten = 0, + DontFlatten = 1, + }, + + SelectionControlMask = { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, + }, + + LoopControlShift = { + Unroll = 0, + DontUnroll = 1, + }, + + LoopControlMask = { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + }, + + FunctionControlShift = { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + }, + + FunctionControlMask = { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, + }, + + MemorySemanticsShift = { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + }, + + MemorySemanticsMask = { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, + }, + + MemoryAccessShift = { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + }, + + MemoryAccessMask = { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, + }, + + Scope = { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + }, + + GroupOperation = { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + }, + + KernelEnqueueFlags = { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + }, + + KernelProfilingInfoShift = { + CmdExecTime = 0, + }, + + KernelProfilingInfoMask = { + MaskNone = 0, + CmdExecTime = 0x00000001, + }, + + Capability = { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + }, + + Op = { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.py b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.py new file mode 100644 index 00000000000..8a200e7655f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.0/spirv.py @@ -0,0 +1,949 @@ +# Copyright (c) 2014-2018 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and/or associated documentation files (the "Materials"), +# to deal in the Materials without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Materials, and to permit persons to whom the +# Materials are furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Materials. +# +# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +# STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +# HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +# +# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +# IN THE MATERIALS. + +# This header is automatically generated by the same tool that creates +# the Binary Section of the SPIR-V specification. + +# Enumeration tokens for SPIR-V, in various styles: +# C, C++, C++11, JSON, Lua, Python +# +# - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +# - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +# - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +# - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +# - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +# +# Some tokens act like mask values, which can be OR'd together, +# while others are mutually exclusive. The mask-like ones have +# "Mask" in their name, and a parallel enum that has the shift +# amount (1 << x) for each corresponding enumerant. + +spv = { + 'MagicNumber' : 0x07230203, + 'Version' : 0x00010000, + 'Revision' : 12, + 'OpCodeMask' : 0xffff, + 'WordCountShift' : 16, + + 'SourceLanguage' : { + 'Unknown' : 0, + 'ESSL' : 1, + 'GLSL' : 2, + 'OpenCL_C' : 3, + 'OpenCL_CPP' : 4, + 'HLSL' : 5, + }, + + 'ExecutionModel' : { + 'Vertex' : 0, + 'TessellationControl' : 1, + 'TessellationEvaluation' : 2, + 'Geometry' : 3, + 'Fragment' : 4, + 'GLCompute' : 5, + 'Kernel' : 6, + }, + + 'AddressingModel' : { + 'Logical' : 0, + 'Physical32' : 1, + 'Physical64' : 2, + }, + + 'MemoryModel' : { + 'Simple' : 0, + 'GLSL450' : 1, + 'OpenCL' : 2, + }, + + 'ExecutionMode' : { + 'Invocations' : 0, + 'SpacingEqual' : 1, + 'SpacingFractionalEven' : 2, + 'SpacingFractionalOdd' : 3, + 'VertexOrderCw' : 4, + 'VertexOrderCcw' : 5, + 'PixelCenterInteger' : 6, + 'OriginUpperLeft' : 7, + 'OriginLowerLeft' : 8, + 'EarlyFragmentTests' : 9, + 'PointMode' : 10, + 'Xfb' : 11, + 'DepthReplacing' : 12, + 'DepthGreater' : 14, + 'DepthLess' : 15, + 'DepthUnchanged' : 16, + 'LocalSize' : 17, + 'LocalSizeHint' : 18, + 'InputPoints' : 19, + 'InputLines' : 20, + 'InputLinesAdjacency' : 21, + 'Triangles' : 22, + 'InputTrianglesAdjacency' : 23, + 'Quads' : 24, + 'Isolines' : 25, + 'OutputVertices' : 26, + 'OutputPoints' : 27, + 'OutputLineStrip' : 28, + 'OutputTriangleStrip' : 29, + 'VecTypeHint' : 30, + 'ContractionOff' : 31, + 'PostDepthCoverage' : 4446, + 'StencilRefReplacingEXT' : 5027, + }, + + 'StorageClass' : { + 'UniformConstant' : 0, + 'Input' : 1, + 'Uniform' : 2, + 'Output' : 3, + 'Workgroup' : 4, + 'CrossWorkgroup' : 5, + 'Private' : 6, + 'Function' : 7, + 'Generic' : 8, + 'PushConstant' : 9, + 'AtomicCounter' : 10, + 'Image' : 11, + 'StorageBuffer' : 12, + }, + + 'Dim' : { + 'Dim1D' : 0, + 'Dim2D' : 1, + 'Dim3D' : 2, + 'Cube' : 3, + 'Rect' : 4, + 'Buffer' : 5, + 'SubpassData' : 6, + }, + + 'SamplerAddressingMode' : { + 'None' : 0, + 'ClampToEdge' : 1, + 'Clamp' : 2, + 'Repeat' : 3, + 'RepeatMirrored' : 4, + }, + + 'SamplerFilterMode' : { + 'Nearest' : 0, + 'Linear' : 1, + }, + + 'ImageFormat' : { + 'Unknown' : 0, + 'Rgba32f' : 1, + 'Rgba16f' : 2, + 'R32f' : 3, + 'Rgba8' : 4, + 'Rgba8Snorm' : 5, + 'Rg32f' : 6, + 'Rg16f' : 7, + 'R11fG11fB10f' : 8, + 'R16f' : 9, + 'Rgba16' : 10, + 'Rgb10A2' : 11, + 'Rg16' : 12, + 'Rg8' : 13, + 'R16' : 14, + 'R8' : 15, + 'Rgba16Snorm' : 16, + 'Rg16Snorm' : 17, + 'Rg8Snorm' : 18, + 'R16Snorm' : 19, + 'R8Snorm' : 20, + 'Rgba32i' : 21, + 'Rgba16i' : 22, + 'Rgba8i' : 23, + 'R32i' : 24, + 'Rg32i' : 25, + 'Rg16i' : 26, + 'Rg8i' : 27, + 'R16i' : 28, + 'R8i' : 29, + 'Rgba32ui' : 30, + 'Rgba16ui' : 31, + 'Rgba8ui' : 32, + 'R32ui' : 33, + 'Rgb10a2ui' : 34, + 'Rg32ui' : 35, + 'Rg16ui' : 36, + 'Rg8ui' : 37, + 'R16ui' : 38, + 'R8ui' : 39, + }, + + 'ImageChannelOrder' : { + 'R' : 0, + 'A' : 1, + 'RG' : 2, + 'RA' : 3, + 'RGB' : 4, + 'RGBA' : 5, + 'BGRA' : 6, + 'ARGB' : 7, + 'Intensity' : 8, + 'Luminance' : 9, + 'Rx' : 10, + 'RGx' : 11, + 'RGBx' : 12, + 'Depth' : 13, + 'DepthStencil' : 14, + 'sRGB' : 15, + 'sRGBx' : 16, + 'sRGBA' : 17, + 'sBGRA' : 18, + 'ABGR' : 19, + }, + + 'ImageChannelDataType' : { + 'SnormInt8' : 0, + 'SnormInt16' : 1, + 'UnormInt8' : 2, + 'UnormInt16' : 3, + 'UnormShort565' : 4, + 'UnormShort555' : 5, + 'UnormInt101010' : 6, + 'SignedInt8' : 7, + 'SignedInt16' : 8, + 'SignedInt32' : 9, + 'UnsignedInt8' : 10, + 'UnsignedInt16' : 11, + 'UnsignedInt32' : 12, + 'HalfFloat' : 13, + 'Float' : 14, + 'UnormInt24' : 15, + 'UnormInt101010_2' : 16, + }, + + 'ImageOperandsShift' : { + 'Bias' : 0, + 'Lod' : 1, + 'Grad' : 2, + 'ConstOffset' : 3, + 'Offset' : 4, + 'ConstOffsets' : 5, + 'Sample' : 6, + 'MinLod' : 7, + }, + + 'ImageOperandsMask' : { + 'MaskNone' : 0, + 'Bias' : 0x00000001, + 'Lod' : 0x00000002, + 'Grad' : 0x00000004, + 'ConstOffset' : 0x00000008, + 'Offset' : 0x00000010, + 'ConstOffsets' : 0x00000020, + 'Sample' : 0x00000040, + 'MinLod' : 0x00000080, + }, + + 'FPFastMathModeShift' : { + 'NotNaN' : 0, + 'NotInf' : 1, + 'NSZ' : 2, + 'AllowRecip' : 3, + 'Fast' : 4, + }, + + 'FPFastMathModeMask' : { + 'MaskNone' : 0, + 'NotNaN' : 0x00000001, + 'NotInf' : 0x00000002, + 'NSZ' : 0x00000004, + 'AllowRecip' : 0x00000008, + 'Fast' : 0x00000010, + }, + + 'FPRoundingMode' : { + 'RTE' : 0, + 'RTZ' : 1, + 'RTP' : 2, + 'RTN' : 3, + }, + + 'LinkageType' : { + 'Export' : 0, + 'Import' : 1, + }, + + 'AccessQualifier' : { + 'ReadOnly' : 0, + 'WriteOnly' : 1, + 'ReadWrite' : 2, + }, + + 'FunctionParameterAttribute' : { + 'Zext' : 0, + 'Sext' : 1, + 'ByVal' : 2, + 'Sret' : 3, + 'NoAlias' : 4, + 'NoCapture' : 5, + 'NoWrite' : 6, + 'NoReadWrite' : 7, + }, + + 'Decoration' : { + 'RelaxedPrecision' : 0, + 'SpecId' : 1, + 'Block' : 2, + 'BufferBlock' : 3, + 'RowMajor' : 4, + 'ColMajor' : 5, + 'ArrayStride' : 6, + 'MatrixStride' : 7, + 'GLSLShared' : 8, + 'GLSLPacked' : 9, + 'CPacked' : 10, + 'BuiltIn' : 11, + 'NoPerspective' : 13, + 'Flat' : 14, + 'Patch' : 15, + 'Centroid' : 16, + 'Sample' : 17, + 'Invariant' : 18, + 'Restrict' : 19, + 'Aliased' : 20, + 'Volatile' : 21, + 'Constant' : 22, + 'Coherent' : 23, + 'NonWritable' : 24, + 'NonReadable' : 25, + 'Uniform' : 26, + 'SaturatedConversion' : 28, + 'Stream' : 29, + 'Location' : 30, + 'Component' : 31, + 'Index' : 32, + 'Binding' : 33, + 'DescriptorSet' : 34, + 'Offset' : 35, + 'XfbBuffer' : 36, + 'XfbStride' : 37, + 'FuncParamAttr' : 38, + 'FPRoundingMode' : 39, + 'FPFastMathMode' : 40, + 'LinkageAttributes' : 41, + 'NoContraction' : 42, + 'InputAttachmentIndex' : 43, + 'Alignment' : 44, + 'ExplicitInterpAMD' : 4999, + 'OverrideCoverageNV' : 5248, + 'PassthroughNV' : 5250, + 'ViewportRelativeNV' : 5252, + 'SecondaryViewportRelativeNV' : 5256, + 'HlslCounterBufferGOOGLE' : 5634, + 'HlslSemanticGOOGLE' : 5635, + }, + + 'BuiltIn' : { + 'Position' : 0, + 'PointSize' : 1, + 'ClipDistance' : 3, + 'CullDistance' : 4, + 'VertexId' : 5, + 'InstanceId' : 6, + 'PrimitiveId' : 7, + 'InvocationId' : 8, + 'Layer' : 9, + 'ViewportIndex' : 10, + 'TessLevelOuter' : 11, + 'TessLevelInner' : 12, + 'TessCoord' : 13, + 'PatchVertices' : 14, + 'FragCoord' : 15, + 'PointCoord' : 16, + 'FrontFacing' : 17, + 'SampleId' : 18, + 'SamplePosition' : 19, + 'SampleMask' : 20, + 'FragDepth' : 22, + 'HelperInvocation' : 23, + 'NumWorkgroups' : 24, + 'WorkgroupSize' : 25, + 'WorkgroupId' : 26, + 'LocalInvocationId' : 27, + 'GlobalInvocationId' : 28, + 'LocalInvocationIndex' : 29, + 'WorkDim' : 30, + 'GlobalSize' : 31, + 'EnqueuedWorkgroupSize' : 32, + 'GlobalOffset' : 33, + 'GlobalLinearId' : 34, + 'SubgroupSize' : 36, + 'SubgroupMaxSize' : 37, + 'NumSubgroups' : 38, + 'NumEnqueuedSubgroups' : 39, + 'SubgroupId' : 40, + 'SubgroupLocalInvocationId' : 41, + 'VertexIndex' : 42, + 'InstanceIndex' : 43, + 'SubgroupEqMaskKHR' : 4416, + 'SubgroupGeMaskKHR' : 4417, + 'SubgroupGtMaskKHR' : 4418, + 'SubgroupLeMaskKHR' : 4419, + 'SubgroupLtMaskKHR' : 4420, + 'BaseVertex' : 4424, + 'BaseInstance' : 4425, + 'DrawIndex' : 4426, + 'DeviceIndex' : 4438, + 'ViewIndex' : 4440, + 'BaryCoordNoPerspAMD' : 4992, + 'BaryCoordNoPerspCentroidAMD' : 4993, + 'BaryCoordNoPerspSampleAMD' : 4994, + 'BaryCoordSmoothAMD' : 4995, + 'BaryCoordSmoothCentroidAMD' : 4996, + 'BaryCoordSmoothSampleAMD' : 4997, + 'BaryCoordPullModelAMD' : 4998, + 'FragStencilRefEXT' : 5014, + 'ViewportMaskNV' : 5253, + 'SecondaryPositionNV' : 5257, + 'SecondaryViewportMaskNV' : 5258, + 'PositionPerViewNV' : 5261, + 'ViewportMaskPerViewNV' : 5262, + }, + + 'SelectionControlShift' : { + 'Flatten' : 0, + 'DontFlatten' : 1, + }, + + 'SelectionControlMask' : { + 'MaskNone' : 0, + 'Flatten' : 0x00000001, + 'DontFlatten' : 0x00000002, + }, + + 'LoopControlShift' : { + 'Unroll' : 0, + 'DontUnroll' : 1, + }, + + 'LoopControlMask' : { + 'MaskNone' : 0, + 'Unroll' : 0x00000001, + 'DontUnroll' : 0x00000002, + }, + + 'FunctionControlShift' : { + 'Inline' : 0, + 'DontInline' : 1, + 'Pure' : 2, + 'Const' : 3, + }, + + 'FunctionControlMask' : { + 'MaskNone' : 0, + 'Inline' : 0x00000001, + 'DontInline' : 0x00000002, + 'Pure' : 0x00000004, + 'Const' : 0x00000008, + }, + + 'MemorySemanticsShift' : { + 'Acquire' : 1, + 'Release' : 2, + 'AcquireRelease' : 3, + 'SequentiallyConsistent' : 4, + 'UniformMemory' : 6, + 'SubgroupMemory' : 7, + 'WorkgroupMemory' : 8, + 'CrossWorkgroupMemory' : 9, + 'AtomicCounterMemory' : 10, + 'ImageMemory' : 11, + }, + + 'MemorySemanticsMask' : { + 'MaskNone' : 0, + 'Acquire' : 0x00000002, + 'Release' : 0x00000004, + 'AcquireRelease' : 0x00000008, + 'SequentiallyConsistent' : 0x00000010, + 'UniformMemory' : 0x00000040, + 'SubgroupMemory' : 0x00000080, + 'WorkgroupMemory' : 0x00000100, + 'CrossWorkgroupMemory' : 0x00000200, + 'AtomicCounterMemory' : 0x00000400, + 'ImageMemory' : 0x00000800, + }, + + 'MemoryAccessShift' : { + 'Volatile' : 0, + 'Aligned' : 1, + 'Nontemporal' : 2, + }, + + 'MemoryAccessMask' : { + 'MaskNone' : 0, + 'Volatile' : 0x00000001, + 'Aligned' : 0x00000002, + 'Nontemporal' : 0x00000004, + }, + + 'Scope' : { + 'CrossDevice' : 0, + 'Device' : 1, + 'Workgroup' : 2, + 'Subgroup' : 3, + 'Invocation' : 4, + }, + + 'GroupOperation' : { + 'Reduce' : 0, + 'InclusiveScan' : 1, + 'ExclusiveScan' : 2, + }, + + 'KernelEnqueueFlags' : { + 'NoWait' : 0, + 'WaitKernel' : 1, + 'WaitWorkGroup' : 2, + }, + + 'KernelProfilingInfoShift' : { + 'CmdExecTime' : 0, + }, + + 'KernelProfilingInfoMask' : { + 'MaskNone' : 0, + 'CmdExecTime' : 0x00000001, + }, + + 'Capability' : { + 'Matrix' : 0, + 'Shader' : 1, + 'Geometry' : 2, + 'Tessellation' : 3, + 'Addresses' : 4, + 'Linkage' : 5, + 'Kernel' : 6, + 'Vector16' : 7, + 'Float16Buffer' : 8, + 'Float16' : 9, + 'Float64' : 10, + 'Int64' : 11, + 'Int64Atomics' : 12, + 'ImageBasic' : 13, + 'ImageReadWrite' : 14, + 'ImageMipmap' : 15, + 'Pipes' : 17, + 'Groups' : 18, + 'DeviceEnqueue' : 19, + 'LiteralSampler' : 20, + 'AtomicStorage' : 21, + 'Int16' : 22, + 'TessellationPointSize' : 23, + 'GeometryPointSize' : 24, + 'ImageGatherExtended' : 25, + 'StorageImageMultisample' : 27, + 'UniformBufferArrayDynamicIndexing' : 28, + 'SampledImageArrayDynamicIndexing' : 29, + 'StorageBufferArrayDynamicIndexing' : 30, + 'StorageImageArrayDynamicIndexing' : 31, + 'ClipDistance' : 32, + 'CullDistance' : 33, + 'ImageCubeArray' : 34, + 'SampleRateShading' : 35, + 'ImageRect' : 36, + 'SampledRect' : 37, + 'GenericPointer' : 38, + 'Int8' : 39, + 'InputAttachment' : 40, + 'SparseResidency' : 41, + 'MinLod' : 42, + 'Sampled1D' : 43, + 'Image1D' : 44, + 'SampledCubeArray' : 45, + 'SampledBuffer' : 46, + 'ImageBuffer' : 47, + 'ImageMSArray' : 48, + 'StorageImageExtendedFormats' : 49, + 'ImageQuery' : 50, + 'DerivativeControl' : 51, + 'InterpolationFunction' : 52, + 'TransformFeedback' : 53, + 'GeometryStreams' : 54, + 'StorageImageReadWithoutFormat' : 55, + 'StorageImageWriteWithoutFormat' : 56, + 'MultiViewport' : 57, + 'SubgroupBallotKHR' : 4423, + 'DrawParameters' : 4427, + 'SubgroupVoteKHR' : 4431, + 'StorageBuffer16BitAccess' : 4433, + 'StorageUniformBufferBlock16' : 4433, + 'StorageUniform16' : 4434, + 'UniformAndStorageBuffer16BitAccess' : 4434, + 'StoragePushConstant16' : 4435, + 'StorageInputOutput16' : 4436, + 'DeviceGroup' : 4437, + 'MultiView' : 4439, + 'VariablePointersStorageBuffer' : 4441, + 'VariablePointers' : 4442, + 'AtomicStorageOps' : 4445, + 'SampleMaskPostDepthCoverage' : 4447, + 'ImageGatherBiasLodAMD' : 5009, + 'FragmentMaskAMD' : 5010, + 'StencilExportEXT' : 5013, + 'ImageReadWriteLodAMD' : 5015, + 'SampleMaskOverrideCoverageNV' : 5249, + 'GeometryShaderPassthroughNV' : 5251, + 'ShaderViewportIndexLayerEXT' : 5254, + 'ShaderViewportIndexLayerNV' : 5254, + 'ShaderViewportMaskNV' : 5255, + 'ShaderStereoViewNV' : 5259, + 'PerViewAttributesNV' : 5260, + 'SubgroupShuffleINTEL' : 5568, + 'SubgroupBufferBlockIOINTEL' : 5569, + 'SubgroupImageBlockIOINTEL' : 5570, + }, + + 'Op' : { + 'OpNop' : 0, + 'OpUndef' : 1, + 'OpSourceContinued' : 2, + 'OpSource' : 3, + 'OpSourceExtension' : 4, + 'OpName' : 5, + 'OpMemberName' : 6, + 'OpString' : 7, + 'OpLine' : 8, + 'OpExtension' : 10, + 'OpExtInstImport' : 11, + 'OpExtInst' : 12, + 'OpMemoryModel' : 14, + 'OpEntryPoint' : 15, + 'OpExecutionMode' : 16, + 'OpCapability' : 17, + 'OpTypeVoid' : 19, + 'OpTypeBool' : 20, + 'OpTypeInt' : 21, + 'OpTypeFloat' : 22, + 'OpTypeVector' : 23, + 'OpTypeMatrix' : 24, + 'OpTypeImage' : 25, + 'OpTypeSampler' : 26, + 'OpTypeSampledImage' : 27, + 'OpTypeArray' : 28, + 'OpTypeRuntimeArray' : 29, + 'OpTypeStruct' : 30, + 'OpTypeOpaque' : 31, + 'OpTypePointer' : 32, + 'OpTypeFunction' : 33, + 'OpTypeEvent' : 34, + 'OpTypeDeviceEvent' : 35, + 'OpTypeReserveId' : 36, + 'OpTypeQueue' : 37, + 'OpTypePipe' : 38, + 'OpTypeForwardPointer' : 39, + 'OpConstantTrue' : 41, + 'OpConstantFalse' : 42, + 'OpConstant' : 43, + 'OpConstantComposite' : 44, + 'OpConstantSampler' : 45, + 'OpConstantNull' : 46, + 'OpSpecConstantTrue' : 48, + 'OpSpecConstantFalse' : 49, + 'OpSpecConstant' : 50, + 'OpSpecConstantComposite' : 51, + 'OpSpecConstantOp' : 52, + 'OpFunction' : 54, + 'OpFunctionParameter' : 55, + 'OpFunctionEnd' : 56, + 'OpFunctionCall' : 57, + 'OpVariable' : 59, + 'OpImageTexelPointer' : 60, + 'OpLoad' : 61, + 'OpStore' : 62, + 'OpCopyMemory' : 63, + 'OpCopyMemorySized' : 64, + 'OpAccessChain' : 65, + 'OpInBoundsAccessChain' : 66, + 'OpPtrAccessChain' : 67, + 'OpArrayLength' : 68, + 'OpGenericPtrMemSemantics' : 69, + 'OpInBoundsPtrAccessChain' : 70, + 'OpDecorate' : 71, + 'OpMemberDecorate' : 72, + 'OpDecorationGroup' : 73, + 'OpGroupDecorate' : 74, + 'OpGroupMemberDecorate' : 75, + 'OpVectorExtractDynamic' : 77, + 'OpVectorInsertDynamic' : 78, + 'OpVectorShuffle' : 79, + 'OpCompositeConstruct' : 80, + 'OpCompositeExtract' : 81, + 'OpCompositeInsert' : 82, + 'OpCopyObject' : 83, + 'OpTranspose' : 84, + 'OpSampledImage' : 86, + 'OpImageSampleImplicitLod' : 87, + 'OpImageSampleExplicitLod' : 88, + 'OpImageSampleDrefImplicitLod' : 89, + 'OpImageSampleDrefExplicitLod' : 90, + 'OpImageSampleProjImplicitLod' : 91, + 'OpImageSampleProjExplicitLod' : 92, + 'OpImageSampleProjDrefImplicitLod' : 93, + 'OpImageSampleProjDrefExplicitLod' : 94, + 'OpImageFetch' : 95, + 'OpImageGather' : 96, + 'OpImageDrefGather' : 97, + 'OpImageRead' : 98, + 'OpImageWrite' : 99, + 'OpImage' : 100, + 'OpImageQueryFormat' : 101, + 'OpImageQueryOrder' : 102, + 'OpImageQuerySizeLod' : 103, + 'OpImageQuerySize' : 104, + 'OpImageQueryLod' : 105, + 'OpImageQueryLevels' : 106, + 'OpImageQuerySamples' : 107, + 'OpConvertFToU' : 109, + 'OpConvertFToS' : 110, + 'OpConvertSToF' : 111, + 'OpConvertUToF' : 112, + 'OpUConvert' : 113, + 'OpSConvert' : 114, + 'OpFConvert' : 115, + 'OpQuantizeToF16' : 116, + 'OpConvertPtrToU' : 117, + 'OpSatConvertSToU' : 118, + 'OpSatConvertUToS' : 119, + 'OpConvertUToPtr' : 120, + 'OpPtrCastToGeneric' : 121, + 'OpGenericCastToPtr' : 122, + 'OpGenericCastToPtrExplicit' : 123, + 'OpBitcast' : 124, + 'OpSNegate' : 126, + 'OpFNegate' : 127, + 'OpIAdd' : 128, + 'OpFAdd' : 129, + 'OpISub' : 130, + 'OpFSub' : 131, + 'OpIMul' : 132, + 'OpFMul' : 133, + 'OpUDiv' : 134, + 'OpSDiv' : 135, + 'OpFDiv' : 136, + 'OpUMod' : 137, + 'OpSRem' : 138, + 'OpSMod' : 139, + 'OpFRem' : 140, + 'OpFMod' : 141, + 'OpVectorTimesScalar' : 142, + 'OpMatrixTimesScalar' : 143, + 'OpVectorTimesMatrix' : 144, + 'OpMatrixTimesVector' : 145, + 'OpMatrixTimesMatrix' : 146, + 'OpOuterProduct' : 147, + 'OpDot' : 148, + 'OpIAddCarry' : 149, + 'OpISubBorrow' : 150, + 'OpUMulExtended' : 151, + 'OpSMulExtended' : 152, + 'OpAny' : 154, + 'OpAll' : 155, + 'OpIsNan' : 156, + 'OpIsInf' : 157, + 'OpIsFinite' : 158, + 'OpIsNormal' : 159, + 'OpSignBitSet' : 160, + 'OpLessOrGreater' : 161, + 'OpOrdered' : 162, + 'OpUnordered' : 163, + 'OpLogicalEqual' : 164, + 'OpLogicalNotEqual' : 165, + 'OpLogicalOr' : 166, + 'OpLogicalAnd' : 167, + 'OpLogicalNot' : 168, + 'OpSelect' : 169, + 'OpIEqual' : 170, + 'OpINotEqual' : 171, + 'OpUGreaterThan' : 172, + 'OpSGreaterThan' : 173, + 'OpUGreaterThanEqual' : 174, + 'OpSGreaterThanEqual' : 175, + 'OpULessThan' : 176, + 'OpSLessThan' : 177, + 'OpULessThanEqual' : 178, + 'OpSLessThanEqual' : 179, + 'OpFOrdEqual' : 180, + 'OpFUnordEqual' : 181, + 'OpFOrdNotEqual' : 182, + 'OpFUnordNotEqual' : 183, + 'OpFOrdLessThan' : 184, + 'OpFUnordLessThan' : 185, + 'OpFOrdGreaterThan' : 186, + 'OpFUnordGreaterThan' : 187, + 'OpFOrdLessThanEqual' : 188, + 'OpFUnordLessThanEqual' : 189, + 'OpFOrdGreaterThanEqual' : 190, + 'OpFUnordGreaterThanEqual' : 191, + 'OpShiftRightLogical' : 194, + 'OpShiftRightArithmetic' : 195, + 'OpShiftLeftLogical' : 196, + 'OpBitwiseOr' : 197, + 'OpBitwiseXor' : 198, + 'OpBitwiseAnd' : 199, + 'OpNot' : 200, + 'OpBitFieldInsert' : 201, + 'OpBitFieldSExtract' : 202, + 'OpBitFieldUExtract' : 203, + 'OpBitReverse' : 204, + 'OpBitCount' : 205, + 'OpDPdx' : 207, + 'OpDPdy' : 208, + 'OpFwidth' : 209, + 'OpDPdxFine' : 210, + 'OpDPdyFine' : 211, + 'OpFwidthFine' : 212, + 'OpDPdxCoarse' : 213, + 'OpDPdyCoarse' : 214, + 'OpFwidthCoarse' : 215, + 'OpEmitVertex' : 218, + 'OpEndPrimitive' : 219, + 'OpEmitStreamVertex' : 220, + 'OpEndStreamPrimitive' : 221, + 'OpControlBarrier' : 224, + 'OpMemoryBarrier' : 225, + 'OpAtomicLoad' : 227, + 'OpAtomicStore' : 228, + 'OpAtomicExchange' : 229, + 'OpAtomicCompareExchange' : 230, + 'OpAtomicCompareExchangeWeak' : 231, + 'OpAtomicIIncrement' : 232, + 'OpAtomicIDecrement' : 233, + 'OpAtomicIAdd' : 234, + 'OpAtomicISub' : 235, + 'OpAtomicSMin' : 236, + 'OpAtomicUMin' : 237, + 'OpAtomicSMax' : 238, + 'OpAtomicUMax' : 239, + 'OpAtomicAnd' : 240, + 'OpAtomicOr' : 241, + 'OpAtomicXor' : 242, + 'OpPhi' : 245, + 'OpLoopMerge' : 246, + 'OpSelectionMerge' : 247, + 'OpLabel' : 248, + 'OpBranch' : 249, + 'OpBranchConditional' : 250, + 'OpSwitch' : 251, + 'OpKill' : 252, + 'OpReturn' : 253, + 'OpReturnValue' : 254, + 'OpUnreachable' : 255, + 'OpLifetimeStart' : 256, + 'OpLifetimeStop' : 257, + 'OpGroupAsyncCopy' : 259, + 'OpGroupWaitEvents' : 260, + 'OpGroupAll' : 261, + 'OpGroupAny' : 262, + 'OpGroupBroadcast' : 263, + 'OpGroupIAdd' : 264, + 'OpGroupFAdd' : 265, + 'OpGroupFMin' : 266, + 'OpGroupUMin' : 267, + 'OpGroupSMin' : 268, + 'OpGroupFMax' : 269, + 'OpGroupUMax' : 270, + 'OpGroupSMax' : 271, + 'OpReadPipe' : 274, + 'OpWritePipe' : 275, + 'OpReservedReadPipe' : 276, + 'OpReservedWritePipe' : 277, + 'OpReserveReadPipePackets' : 278, + 'OpReserveWritePipePackets' : 279, + 'OpCommitReadPipe' : 280, + 'OpCommitWritePipe' : 281, + 'OpIsValidReserveId' : 282, + 'OpGetNumPipePackets' : 283, + 'OpGetMaxPipePackets' : 284, + 'OpGroupReserveReadPipePackets' : 285, + 'OpGroupReserveWritePipePackets' : 286, + 'OpGroupCommitReadPipe' : 287, + 'OpGroupCommitWritePipe' : 288, + 'OpEnqueueMarker' : 291, + 'OpEnqueueKernel' : 292, + 'OpGetKernelNDrangeSubGroupCount' : 293, + 'OpGetKernelNDrangeMaxSubGroupSize' : 294, + 'OpGetKernelWorkGroupSize' : 295, + 'OpGetKernelPreferredWorkGroupSizeMultiple' : 296, + 'OpRetainEvent' : 297, + 'OpReleaseEvent' : 298, + 'OpCreateUserEvent' : 299, + 'OpIsValidEvent' : 300, + 'OpSetUserEventStatus' : 301, + 'OpCaptureEventProfilingInfo' : 302, + 'OpGetDefaultQueue' : 303, + 'OpBuildNDRange' : 304, + 'OpImageSparseSampleImplicitLod' : 305, + 'OpImageSparseSampleExplicitLod' : 306, + 'OpImageSparseSampleDrefImplicitLod' : 307, + 'OpImageSparseSampleDrefExplicitLod' : 308, + 'OpImageSparseSampleProjImplicitLod' : 309, + 'OpImageSparseSampleProjExplicitLod' : 310, + 'OpImageSparseSampleProjDrefImplicitLod' : 311, + 'OpImageSparseSampleProjDrefExplicitLod' : 312, + 'OpImageSparseFetch' : 313, + 'OpImageSparseGather' : 314, + 'OpImageSparseDrefGather' : 315, + 'OpImageSparseTexelsResident' : 316, + 'OpNoLine' : 317, + 'OpAtomicFlagTestAndSet' : 318, + 'OpAtomicFlagClear' : 319, + 'OpImageSparseRead' : 320, + 'OpDecorateId' : 332, + 'OpSubgroupBallotKHR' : 4421, + 'OpSubgroupFirstInvocationKHR' : 4422, + 'OpSubgroupAllKHR' : 4428, + 'OpSubgroupAnyKHR' : 4429, + 'OpSubgroupAllEqualKHR' : 4430, + 'OpSubgroupReadInvocationKHR' : 4432, + 'OpGroupIAddNonUniformAMD' : 5000, + 'OpGroupFAddNonUniformAMD' : 5001, + 'OpGroupFMinNonUniformAMD' : 5002, + 'OpGroupUMinNonUniformAMD' : 5003, + 'OpGroupSMinNonUniformAMD' : 5004, + 'OpGroupFMaxNonUniformAMD' : 5005, + 'OpGroupUMaxNonUniformAMD' : 5006, + 'OpGroupSMaxNonUniformAMD' : 5007, + 'OpFragmentMaskFetchAMD' : 5011, + 'OpFragmentFetchAMD' : 5012, + 'OpSubgroupShuffleINTEL' : 5571, + 'OpSubgroupShuffleDownINTEL' : 5572, + 'OpSubgroupShuffleUpINTEL' : 5573, + 'OpSubgroupShuffleXorINTEL' : 5574, + 'OpSubgroupBlockReadINTEL' : 5575, + 'OpSubgroupBlockWriteINTEL' : 5576, + 'OpSubgroupImageBlockReadINTEL' : 5577, + 'OpSubgroupImageBlockWriteINTEL' : 5578, + 'OpDecorateStringGOOGLE' : 5632, + 'OpMemberDecorateStringGOOGLE' : 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/GLSL.std.450.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/GLSL.std.450.h new file mode 100644 index 00000000000..54cc00e9a88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/GLSL.std.450.h @@ -0,0 +1,131 @@ +/* +** Copyright (c) 2014-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef GLSLstd450_H +#define GLSLstd450_H + +static const int GLSLstd450Version = 100; +static const int GLSLstd450Revision = 3; + +enum GLSLstd450 { + GLSLstd450Bad = 0, // Don't use + + GLSLstd450Round = 1, + GLSLstd450RoundEven = 2, + GLSLstd450Trunc = 3, + GLSLstd450FAbs = 4, + GLSLstd450SAbs = 5, + GLSLstd450FSign = 6, + GLSLstd450SSign = 7, + GLSLstd450Floor = 8, + GLSLstd450Ceil = 9, + GLSLstd450Fract = 10, + + GLSLstd450Radians = 11, + GLSLstd450Degrees = 12, + GLSLstd450Sin = 13, + GLSLstd450Cos = 14, + GLSLstd450Tan = 15, + GLSLstd450Asin = 16, + GLSLstd450Acos = 17, + GLSLstd450Atan = 18, + GLSLstd450Sinh = 19, + GLSLstd450Cosh = 20, + GLSLstd450Tanh = 21, + GLSLstd450Asinh = 22, + GLSLstd450Acosh = 23, + GLSLstd450Atanh = 24, + GLSLstd450Atan2 = 25, + + GLSLstd450Pow = 26, + GLSLstd450Exp = 27, + GLSLstd450Log = 28, + GLSLstd450Exp2 = 29, + GLSLstd450Log2 = 30, + GLSLstd450Sqrt = 31, + GLSLstd450InverseSqrt = 32, + + GLSLstd450Determinant = 33, + GLSLstd450MatrixInverse = 34, + + GLSLstd450Modf = 35, // second operand needs an OpVariable to write to + GLSLstd450ModfStruct = 36, // no OpVariable operand + GLSLstd450FMin = 37, + GLSLstd450UMin = 38, + GLSLstd450SMin = 39, + GLSLstd450FMax = 40, + GLSLstd450UMax = 41, + GLSLstd450SMax = 42, + GLSLstd450FClamp = 43, + GLSLstd450UClamp = 44, + GLSLstd450SClamp = 45, + GLSLstd450FMix = 46, + GLSLstd450IMix = 47, // Reserved + GLSLstd450Step = 48, + GLSLstd450SmoothStep = 49, + + GLSLstd450Fma = 50, + GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to + GLSLstd450FrexpStruct = 52, // no OpVariable operand + GLSLstd450Ldexp = 53, + + GLSLstd450PackSnorm4x8 = 54, + GLSLstd450PackUnorm4x8 = 55, + GLSLstd450PackSnorm2x16 = 56, + GLSLstd450PackUnorm2x16 = 57, + GLSLstd450PackHalf2x16 = 58, + GLSLstd450PackDouble2x32 = 59, + GLSLstd450UnpackSnorm2x16 = 60, + GLSLstd450UnpackUnorm2x16 = 61, + GLSLstd450UnpackHalf2x16 = 62, + GLSLstd450UnpackSnorm4x8 = 63, + GLSLstd450UnpackUnorm4x8 = 64, + GLSLstd450UnpackDouble2x32 = 65, + + GLSLstd450Length = 66, + GLSLstd450Distance = 67, + GLSLstd450Cross = 68, + GLSLstd450Normalize = 69, + GLSLstd450FaceForward = 70, + GLSLstd450Reflect = 71, + GLSLstd450Refract = 72, + + GLSLstd450FindILsb = 73, + GLSLstd450FindSMsb = 74, + GLSLstd450FindUMsb = 75, + + GLSLstd450InterpolateAtCentroid = 76, + GLSLstd450InterpolateAtSample = 77, + GLSLstd450InterpolateAtOffset = 78, + + GLSLstd450NMin = 79, + GLSLstd450NMax = 80, + GLSLstd450NClamp = 81, + + GLSLstd450Count +}; + +#endif // #ifndef GLSLstd450_H diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/OpenCL.std.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/OpenCL.std.h new file mode 100644 index 00000000000..19a6688490c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/OpenCL.std.h @@ -0,0 +1,210 @@ +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +namespace OpenCLLIB { + +enum Entrypoints { + + // Section 2.1: Math extended instructions + Acos = 0, + Acosh = 1, + Acospi = 2, + Asin = 3, + Asinh = 4, + Asinpi = 5, + Atan = 6, + Atan2 = 7, + Atanh = 8, + Atanpi = 9, + Atan2pi = 10, + Cbrt = 11, + Ceil = 12, + Copysign = 13, + Cos = 14, + Cosh = 15, + Cospi = 16, + Erfc = 17, + Erf = 18, + Exp = 19, + Exp2 = 20, + Exp10 = 21, + Expm1 = 22, + Fabs = 23, + Fdim = 24, + Floor = 25, + Fma = 26, + Fmax = 27, + Fmin = 28, + Fmod = 29, + Fract = 30, + Frexp = 31, + Hypot = 32, + Ilogb = 33, + Ldexp = 34, + Lgamma = 35, + Lgamma_r = 36, + Log = 37, + Log2 = 38, + Log10 = 39, + Log1p = 40, + Logb = 41, + Mad = 42, + Maxmag = 43, + Minmag = 44, + Modf = 45, + Nan = 46, + Nextafter = 47, + Pow = 48, + Pown = 49, + Powr = 50, + Remainder = 51, + Remquo = 52, + Rint = 53, + Rootn = 54, + Round = 55, + Rsqrt = 56, + Sin = 57, + Sincos = 58, + Sinh = 59, + Sinpi = 60, + Sqrt = 61, + Tan = 62, + Tanh = 63, + Tanpi = 64, + Tgamma = 65, + Trunc = 66, + Half_cos = 67, + Half_divide = 68, + Half_exp = 69, + Half_exp2 = 70, + Half_exp10 = 71, + Half_log = 72, + Half_log2 = 73, + Half_log10 = 74, + Half_powr = 75, + Half_recip = 76, + Half_rsqrt = 77, + Half_sin = 78, + Half_sqrt = 79, + Half_tan = 80, + Native_cos = 81, + Native_divide = 82, + Native_exp = 83, + Native_exp2 = 84, + Native_exp10 = 85, + Native_log = 86, + Native_log2 = 87, + Native_log10 = 88, + Native_powr = 89, + Native_recip = 90, + Native_rsqrt = 91, + Native_sin = 92, + Native_sqrt = 93, + Native_tan = 94, + + // Section 2.2: Integer instructions + SAbs = 141, + SAbs_diff = 142, + SAdd_sat = 143, + UAdd_sat = 144, + SHadd = 145, + UHadd = 146, + SRhadd = 147, + URhadd = 148, + SClamp = 149, + UClamp = 150, + Clz = 151, + Ctz = 152, + SMad_hi = 153, + UMad_sat = 154, + SMad_sat = 155, + SMax = 156, + UMax = 157, + SMin = 158, + UMin = 159, + SMul_hi = 160, + Rotate = 161, + SSub_sat = 162, + USub_sat = 163, + U_Upsample = 164, + S_Upsample = 165, + Popcount = 166, + SMad24 = 167, + UMad24 = 168, + SMul24 = 169, + UMul24 = 170, + UAbs = 201, + UAbs_diff = 202, + UMul_hi = 203, + UMad_hi = 204, + + // Section 2.3: Common instructions + FClamp = 95, + Degrees = 96, + FMax_common = 97, + FMin_common = 98, + Mix = 99, + Radians = 100, + Step = 101, + Smoothstep = 102, + Sign = 103, + + // Section 2.4: Geometric instructions + Cross = 104, + Distance = 105, + Length = 106, + Normalize = 107, + Fast_distance = 108, + Fast_length = 109, + Fast_normalize = 110, + + // Section 2.5: Relational instructions + Bitselect = 186, + Select = 187, + + // Section 2.6: Vector Data Load and Store instructions + Vloadn = 171, + Vstoren = 172, + Vload_half = 173, + Vload_halfn = 174, + Vstore_half = 175, + Vstore_half_r = 176, + Vstore_halfn = 177, + Vstore_halfn_r = 178, + Vloada_halfn = 179, + Vstorea_halfn = 180, + Vstorea_halfn_r = 181, + + // Section 2.7: Miscellaneous Vector instructions + Shuffle = 182, + Shuffle2 = 183, + + // Section 2.8: Misc instructions + Printf = 184, + Prefetch = 185, +}; + +} // end namespace OpenCLLIB diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/extinst.glsl.std.450.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/extinst.glsl.std.450.grammar.json new file mode 100644 index 00000000000..3d9f39e76c9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/extinst.glsl.std.450.grammar.json @@ -0,0 +1,642 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "Round", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "RoundEven", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Trunc", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FAbs", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SAbs", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FSign", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SSign", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Floor", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ceil", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fract", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Radians", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "Degrees", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "Sin", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tan", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asin", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acos", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'y_over_x'" } + ] + }, + { + "opname" : "Sinh", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cosh", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tanh", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asinh", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acosh", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atanh", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan2", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Pow", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Exp", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Exp2", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log2", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Sqrt", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "InverseSqrt", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Determinant", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "MatrixInverse", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Modf", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "ModfStruct", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FMin", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMin", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMin", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FMax", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMax", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMax", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FClamp", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "UClamp", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "SClamp", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "FMix", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "IMix", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "Step", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SmoothStep", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fma", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "Frexp", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "FrexpStruct", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ldexp", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "PackSnorm4x8", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm4x8", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackSnorm2x16", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm2x16", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackHalf2x16", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackDouble2x32", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "UnpackSnorm2x16", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm2x16", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackHalf2x16", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "UnpackSnorm4x8", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm4x8", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackDouble2x32", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "Length", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Distance", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "Cross", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Normalize", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FaceForward", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'Nref'" } + ] + }, + { + "opname" : "Reflect", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" } + ] + }, + { + "opname" : "Refract", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'eta'" } + ] + }, + { + "opname" : "FindILsb", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindSMsb", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindUMsb", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "InterpolateAtCentroid", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtSample", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'sample'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtOffset", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'offset'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "NMin", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NMax", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NClamp", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/extinst.opencl.std.100.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/extinst.opencl.std.100.grammar.json new file mode 100644 index 00000000000..4fe45060bb9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/extinst.opencl.std.100.grammar.json @@ -0,0 +1,1279 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "acos", + "opcode" : 0, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acosh", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acospi", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asin", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinh", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinpi", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanh", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanpi", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2pi", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cbrt", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ceil", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "copysign", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cosh", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cospi", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erfc", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erf", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp2", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp10", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "expm1", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fabs", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fdim", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "floor", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fma", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fmax", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmod", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fract", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'ptr'" } + ] + }, + { + "opname" : "frexp", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "hypot", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "ilogb", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ldexp", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'k'" } + ] + }, + { + "opname" : "lgamma", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "lgamma_r", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'signp'" } + ] + }, + { + "opname" : "log", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log2", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log10", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log1p", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "logb", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "mad", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "maxmag", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "minmag", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "modf", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'iptr'" } + ] + }, + { + "opname" : "nan", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'nancode'" } + ] + }, + { + "opname" : "nextafter", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "pow", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y" } + ] + }, + { + "opname" : "pown", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "powr", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remainder", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remquo", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'quo'" } + ] + }, + { + "opname" : "rint", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rootn", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "round", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rsqrt", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sin", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sincos", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'cosval'" } + ] + }, + { + "opname" : "sinh", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sinpi", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sqrt", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tan", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanh", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanpi", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tgamma", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "trunc", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_cos", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_divide", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_exp", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp2", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp10", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log2", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log10", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_powr", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_recip", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_rsqrt", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sin", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sqrt", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_tan", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_cos", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_divide", + "opcode" : 82, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_exp", + "opcode" : 83, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp2", + "opcode" : 84, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp10", + "opcode" : 85, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log", + "opcode" : 86, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log2", + "opcode" : 87, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log10", + "opcode" : 88, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_powr", + "opcode" : 89, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_recip", + "opcode" : 90, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_rsqrt", + "opcode" : 91, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sin", + "opcode" : 92, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sqrt", + "opcode" : 93, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_tan", + "opcode" : 94, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs", + "opcode" : 141, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs_diff", + "opcode" : 142, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_add_sat", + "opcode" : 143, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_add_sat", + "opcode" : 144, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_hadd", + "opcode" : 145, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_hadd", + "opcode" : 146, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_rhadd", + "opcode" : 147, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_rhadd", + "opcode" : 148, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_clamp", + "opcode" : 149, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "u_clamp", + "opcode" : 150, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "clz", + "opcode" : 151, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ctz", + "opcode" : 152, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad_hi", + "opcode" : 153, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "u_mad_sat", + "opcode" : 154, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mad_sat", + "opcode" : 155, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_max", + "opcode" : 156, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_max", + "opcode" : 157, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_min", + "opcode" : 158, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_min", + "opcode" : 159, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_mul_hi", + "opcode" : 160, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "rotate", + "opcode" : 161, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "s_sub_sat", + "opcode" : 162, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_sub_sat", + "opcode" : 163, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_upsample", + "opcode" : 164, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "s_upsample", + "opcode" : 165, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "popcount", + "opcode" : 166, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad24", + "opcode" : 167, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "u_mad24", + "opcode" : 168, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mul24", + "opcode" : 169, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul24", + "opcode" : 170, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_abs", + "opcode" : 201, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "u_abs_diff", + "opcode" : 202, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul_hi", + "opcode" : 203, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mad_hi", + "opcode" : 204, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fclamp", + "opcode" : 95, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "degrees", + "opcode" :96, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "fmax_common", + "opcode" : 97, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin_common", + "opcode" : 98, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "mix", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "radians", + "opcode" : 100, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "step", + "opcode" : 101, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "smoothstep", + "opcode" : 102, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sign", + "opcode" : 103, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cross", + "opcode" : 104, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "distance", + "opcode" : 105, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "length", + "opcode" : 106, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "normalize", + "opcode" : 107, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_distance", + "opcode" : 108, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "fast_length", + "opcode" : 109, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_normalize", + "opcode" : 110, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "bitselect", + "opcode" : 186, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "select", + "opcode" : 187, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "vloadn", + "opcode" : 171, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstoren", + "opcode" : 172, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_half", + "opcode" : 173, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_halfn", + "opcode" : 174, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstore_half", + "opcode" : 175, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_half_r", + "opcode" : 176, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vstore_halfn", + "opcode" : 177, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_halfn_r", + "opcode" : 178, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vloada_halfn", + "opcode" : 179, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstorea_halfn", + "opcode" : 180, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstorea_halfn_r", + "opcode" : 181, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "shuffle", + "opcode" : 182, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "shuffle2", + "opcode" : 183, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "printf", + "opcode" : 184, + "operands" : [ + { "kind" : "IdRef", "name" : "'format'" }, + { "kind" : "IdRef", "name" : "'additional arguments'", "quantifier" : "*" } + ] + }, + { + "opname" : "prefetch", + "opcode" : 185, + "operands" : [ + { "kind" : "IdRef", "name" : "'ptr'" }, + { "kind" : "IdRef", "name" : "'num elements'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.core.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.core.grammar.json new file mode 100644 index 00000000000..c142e60a175 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.core.grammar.json @@ -0,0 +1,5938 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "magic_number" : "0x07230203", + "major_version" : 1, + "minor_version" : 1, + "revision" : 8, + "instructions" : [ + { + "opname" : "OpNop", + "opcode" : 0 + }, + { + "opname" : "OpUndef", + "opcode" : 1, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSourceContinued", + "opcode" : 2, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Continued Source'" } + ] + }, + { + "opname" : "OpSource", + "opcode" : 3, + "operands" : [ + { "kind" : "SourceLanguage" }, + { "kind" : "LiteralInteger", "name" : "'Version'" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'File'" }, + { "kind" : "LiteralString", "quantifier" : "?", "name" : "'Source'" } + ] + }, + { + "opname" : "OpSourceExtension", + "opcode" : 4, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Extension'" } + ] + }, + { + "opname" : "OpName", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpMemberName", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpString", + "opcode" : 7, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'String'" } + ] + }, + { + "opname" : "OpLine", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'File'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" } + ] + }, + { + "opname" : "OpExtension", + "opcode" : 10, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInstImport", + "opcode" : 11, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInst", + "opcode" : 12, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Set'" }, + { "kind" : "LiteralExtInstInteger", "name" : "'Instruction'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Operand 1', +\n'Operand 2', +\n..." } + ] + }, + { + "opname" : "OpMemoryModel", + "opcode" : 14, + "operands" : [ + { "kind" : "AddressingModel" }, + { "kind" : "MemoryModel" } + ] + }, + { + "opname" : "OpEntryPoint", + "opcode" : 15, + "operands" : [ + { "kind" : "ExecutionModel" }, + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Interface'" } + ] + }, + { + "opname" : "OpExecutionMode", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "ExecutionMode", "name" : "'Mode'" } + ] + }, + { + "opname" : "OpCapability", + "opcode" : 17, + "operands" : [ + { "kind" : "Capability", "name" : "'Capability'" } + ] + }, + { + "opname" : "OpTypeVoid", + "opcode" : 19, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeBool", + "opcode" : 20, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeInt", + "opcode" : 21, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" }, + { "kind" : "LiteralInteger", "name" : "'Signedness'" } + ] + }, + { + "opname" : "OpTypeFloat", + "opcode" : 22, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" } + ] + }, + { + "opname" : "OpTypeVector", + "opcode" : 23, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Component Type'" }, + { "kind" : "LiteralInteger", "name" : "'Component Count'" } + ] + }, + { + "opname" : "OpTypeMatrix", + "opcode" : 24, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Column Type'" }, + { "kind" : "LiteralInteger", "name" : "'Column Count'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpTypeImage", + "opcode" : 25, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Type'" }, + { "kind" : "Dim" }, + { "kind" : "LiteralInteger", "name" : "'Depth'" }, + { "kind" : "LiteralInteger", "name" : "'Arrayed'" }, + { "kind" : "LiteralInteger", "name" : "'MS'" }, + { "kind" : "LiteralInteger", "name" : "'Sampled'" }, + { "kind" : "ImageFormat" }, + { "kind" : "AccessQualifier", "quantifier" : "?" } + ] + }, + { + "opname" : "OpTypeSampler", + "opcode" : 26, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeSampledImage", + "opcode" : 27, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image Type'" } + ] + }, + { + "opname" : "OpTypeArray", + "opcode" : 28, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" }, + { "kind" : "IdRef", "name" : "'Length'" } + ] + }, + { + "opname" : "OpTypeRuntimeArray", + "opcode" : 29, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpTypeStruct", + "opcode" : 30, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Member 0 type', +\n'member 1 type', +\n..." } + ] + }, + { + "opname" : "OpTypeOpaque", + "opcode" : 31, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "The name of the opaque type." } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypePointer", + "opcode" : 32, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "name" : "'Type'" } + ] + }, + { + "opname" : "OpTypeFunction", + "opcode" : 33, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Return Type'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..." } + ] + }, + { + "opname" : "OpTypeEvent", + "opcode" : 34, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypeDeviceEvent", + "opcode" : 35, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypeReserveId", + "opcode" : 36, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeQueue", + "opcode" : 37, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypePipe", + "opcode" : 38, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "AccessQualifier", "name" : "'Qualifier'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeForwardPointer", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer Type'" }, + { "kind" : "StorageClass" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpConstantTrue", + "opcode" : 41, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstantFalse", + "opcode" : 42, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstant", + "opcode" : 43, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConstantComposite", + "opcode" : 44, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpConstantSampler", + "opcode" : 45, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "SamplerAddressingMode" }, + { "kind" : "LiteralInteger", "name" : "'Param'" }, + { "kind" : "SamplerFilterMode" } + ], + "capabilities" : [ "LiteralSampler" ] + }, + { + "opname" : "OpConstantNull", + "opcode" : 46, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantTrue", + "opcode" : 48, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantFalse", + "opcode" : 49, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstant", + "opcode" : 50, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpSpecConstantComposite", + "opcode" : 51, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpSpecConstantOp", + "opcode" : 52, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralSpecConstantOpInteger", "name" : "'Opcode'" } + ] + }, + { + "opname" : "OpFunction", + "opcode" : 54, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "FunctionControl" }, + { "kind" : "IdRef", "name" : "'Function Type'" } + ] + }, + { + "opname" : "OpFunctionParameter", + "opcode" : 55, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpFunctionEnd", + "opcode" : 56 + }, + { + "opname" : "OpFunctionCall", + "opcode" : 57, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Function'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Argument 0', +\n'Argument 1', +\n..." } + ] + }, + { + "opname" : "OpVariable", + "opcode" : 59, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'Initializer'" } + ] + }, + { + "opname" : "OpImageTexelPointer", + "opcode" : 60, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Sample'" } + ] + }, + { + "opname" : "OpLoad", + "opcode" : 61, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpStore", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemory", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemorySized", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpAccessChain", + "opcode" : 65, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpInBoundsAccessChain", + "opcode" : 66, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpPtrAccessChain", + "opcode" : 67, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ + "Addresses", + "VariablePointers", + "VariablePointersStorageBuffer" + ] + }, + { + "opname" : "OpArrayLength", + "opcode" : 68, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Structure'" }, + { "kind" : "LiteralInteger", "name" : "'Array member'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpGenericPtrMemSemantics", + "opcode" : 69, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpInBoundsPtrAccessChain", + "opcode" : 70, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpDecorate", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpMemberDecorate", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'Structure Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpDecorationGroup", + "opcode" : 73, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpGroupDecorate", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpGroupMemberDecorate", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "PairIdRefLiteralInteger", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpVectorExtractDynamic", + "opcode" : 77, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorInsertDynamic", + "opcode" : 78, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorShuffle", + "opcode" : 79, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Components'" } + ] + }, + { + "opname" : "OpCompositeConstruct", + "opcode" : 80, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpCompositeExtract", + "opcode" : 81, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCompositeInsert", + "opcode" : 82, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCopyObject", + "opcode" : 83, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpTranspose", + "opcode" : 84, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpSampledImage", + "opcode" : 86, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Sampler'" } + ] + }, + { + "opname" : "OpImageSampleImplicitLod", + "opcode" : 87, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleExplicitLod", + "opcode" : 88, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ] + }, + { + "opname" : "OpImageSampleDrefImplicitLod", + "opcode" : 89, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleDrefExplicitLod", + "opcode" : 90, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjImplicitLod", + "opcode" : 91, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjExplicitLod", + "opcode" : 92, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefImplicitLod", + "opcode" : 93, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefExplicitLod", + "opcode" : 94, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageFetch", + "opcode" : 95, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageGather", + "opcode" : 96, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageDrefGather", + "opcode" : 97, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageRead", + "opcode" : 98, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageWrite", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Texel'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImage", + "opcode" : 100, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" } + ] + }, + { + "opname" : "OpImageQueryFormat", + "opcode" : 101, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQueryOrder", + "opcode" : 102, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQuerySizeLod", + "opcode" : 103, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Level of Detail'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySize", + "opcode" : 104, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLod", + "opcode" : 105, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLevels", + "opcode" : 106, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySamples", + "opcode" : 107, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpConvertFToU", + "opcode" : 109, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertFToS", + "opcode" : 110, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertSToF", + "opcode" : 111, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpConvertUToF", + "opcode" : 112, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpUConvert", + "opcode" : 113, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpSConvert", + "opcode" : 114, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpFConvert", + "opcode" : 115, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpQuantizeToF16", + "opcode" : 116, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConvertPtrToU", + "opcode" : 117, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpSatConvertSToU", + "opcode" : 118, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSatConvertUToS", + "opcode" : 119, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpConvertUToPtr", + "opcode" : 120, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Integer Value'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpPtrCastToGeneric", + "opcode" : 121, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtr", + "opcode" : 122, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtrExplicit", + "opcode" : 123, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "StorageClass", "name" : "'Storage'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpBitcast", + "opcode" : 124, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSNegate", + "opcode" : 126, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpFNegate", + "opcode" : 127, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpIAdd", + "opcode" : 128, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFAdd", + "opcode" : 129, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISub", + "opcode" : 130, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFSub", + "opcode" : 131, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpIMul", + "opcode" : 132, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMul", + "opcode" : 133, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUDiv", + "opcode" : 134, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSDiv", + "opcode" : 135, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFDiv", + "opcode" : 136, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMod", + "opcode" : 137, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSRem", + "opcode" : 138, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMod", + "opcode" : 139, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFRem", + "opcode" : 140, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMod", + "opcode" : 141, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpVectorTimesScalar", + "opcode" : 142, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ] + }, + { + "opname" : "OpMatrixTimesScalar", + "opcode" : 143, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpVectorTimesMatrix", + "opcode" : 144, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesVector", + "opcode" : 145, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesMatrix", + "opcode" : 146, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'LeftMatrix'" }, + { "kind" : "IdRef", "name" : "'RightMatrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpOuterProduct", + "opcode" : 147, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpDot", + "opcode" : 148, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ] + }, + { + "opname" : "OpIAddCarry", + "opcode" : 149, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISubBorrow", + "opcode" : 150, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMulExtended", + "opcode" : 151, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMulExtended", + "opcode" : 152, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpAny", + "opcode" : 154, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpAll", + "opcode" : 155, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpIsNan", + "opcode" : 156, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsInf", + "opcode" : 157, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsFinite", + "opcode" : 158, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpIsNormal", + "opcode" : 159, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSignBitSet", + "opcode" : 160, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLessOrGreater", + "opcode" : 161, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpOrdered", + "opcode" : 162, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpUnordered", + "opcode" : 163, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLogicalEqual", + "opcode" : 164, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNotEqual", + "opcode" : 165, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalOr", + "opcode" : 166, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalAnd", + "opcode" : 167, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNot", + "opcode" : 168, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSelect", + "opcode" : 169, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'Object 1'" }, + { "kind" : "IdRef", "name" : "'Object 2'" } + ] + }, + { + "opname" : "OpIEqual", + "opcode" : 170, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpINotEqual", + "opcode" : 171, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThan", + "opcode" : 172, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThan", + "opcode" : 173, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThanEqual", + "opcode" : 174, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThanEqual", + "opcode" : 175, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThan", + "opcode" : 176, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThan", + "opcode" : 177, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThanEqual", + "opcode" : 178, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThanEqual", + "opcode" : 179, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdEqual", + "opcode" : 180, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordEqual", + "opcode" : 181, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdNotEqual", + "opcode" : 182, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordNotEqual", + "opcode" : 183, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThan", + "opcode" : 184, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThan", + "opcode" : 185, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThan", + "opcode" : 186, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThan", + "opcode" : 187, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThanEqual", + "opcode" : 188, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThanEqual", + "opcode" : 189, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThanEqual", + "opcode" : 190, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThanEqual", + "opcode" : 191, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpShiftRightLogical", + "opcode" : 194, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftRightArithmetic", + "opcode" : 195, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftLeftLogical", + "opcode" : 196, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpBitwiseOr", + "opcode" : 197, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseXor", + "opcode" : 198, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseAnd", + "opcode" : 199, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpNot", + "opcode" : 200, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpBitFieldInsert", + "opcode" : 201, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Insert'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldSExtract", + "opcode" : 202, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldUExtract", + "opcode" : 203, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitReverse", + "opcode" : 204, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitCount", + "opcode" : 205, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ] + }, + { + "opname" : "OpDPdx", + "opcode" : 207, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdy", + "opcode" : 208, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpFwidth", + "opcode" : 209, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdxFine", + "opcode" : 210, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyFine", + "opcode" : 211, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthFine", + "opcode" : 212, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdxCoarse", + "opcode" : 213, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyCoarse", + "opcode" : 214, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthCoarse", + "opcode" : 215, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpEmitVertex", + "opcode" : 218, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEndPrimitive", + "opcode" : 219, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEmitStreamVertex", + "opcode" : 220, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpEndStreamPrimitive", + "opcode" : 221, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpControlBarrier", + "opcode" : 224, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpMemoryBarrier", + "opcode" : 225, + "operands" : [ + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicLoad", + "opcode" : 227, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicStore", + "opcode" : 228, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicExchange", + "opcode" : 229, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicCompareExchange", + "opcode" : 230, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ] + }, + { + "opname" : "OpAtomicCompareExchangeWeak", + "opcode" : 231, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicIIncrement", + "opcode" : 232, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIDecrement", + "opcode" : 233, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIAdd", + "opcode" : 234, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicISub", + "opcode" : 235, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMin", + "opcode" : 236, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMin", + "opcode" : 237, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMax", + "opcode" : 238, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMax", + "opcode" : 239, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicAnd", + "opcode" : 240, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicOr", + "opcode" : 241, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicXor", + "opcode" : 242, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpPhi", + "opcode" : 245, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "PairIdRefIdRef", "quantifier" : "*", "name" : "'Variable, Parent, ...'" } + ] + }, + { + "opname" : "OpLoopMerge", + "opcode" : 246, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "IdRef", "name" : "'Continue Target'" }, + { "kind" : "LoopControl" } + ] + }, + { + "opname" : "OpSelectionMerge", + "opcode" : 247, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "SelectionControl" } + ] + }, + { + "opname" : "OpLabel", + "opcode" : 248, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpBranch", + "opcode" : 249, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target Label'" } + ] + }, + { + "opname" : "OpBranchConditional", + "opcode" : 250, + "operands" : [ + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'True Label'" }, + { "kind" : "IdRef", "name" : "'False Label'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Branch weights'" } + ] + }, + { + "opname" : "OpSwitch", + "opcode" : 251, + "operands" : [ + { "kind" : "IdRef", "name" : "'Selector'" }, + { "kind" : "IdRef", "name" : "'Default'" }, + { "kind" : "PairLiteralIntegerIdRef", "quantifier" : "*", "name" : "'Target'" } + ] + }, + { + "opname" : "OpKill", + "opcode" : 252, + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpReturn", + "opcode" : 253 + }, + { + "opname" : "OpReturnValue", + "opcode" : 254, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpUnreachable", + "opcode" : 255 + }, + { + "opname" : "OpLifetimeStart", + "opcode" : 256, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLifetimeStop", + "opcode" : 257, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAsyncCopy", + "opcode" : 259, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Destination'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Num Elements'" }, + { "kind" : "IdRef", "name" : "'Stride'" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupWaitEvents", + "opcode" : 260, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Events List'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAll", + "opcode" : 261, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupAny", + "opcode" : 262, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupBroadcast", + "opcode" : 263, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'LocalId'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupIAdd", + "opcode" : 264, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAdd", + "opcode" : 265, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMin", + "opcode" : 266, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMin", + "opcode" : 267, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMin", + "opcode" : 268, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMax", + "opcode" : 269, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMax", + "opcode" : 270, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMax", + "opcode" : 271, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpReadPipe", + "opcode" : 274, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpWritePipe", + "opcode" : 275, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedReadPipe", + "opcode" : 276, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedWritePipe", + "opcode" : 277, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveReadPipePackets", + "opcode" : 278, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveWritePipePackets", + "opcode" : 279, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitReadPipe", + "opcode" : 280, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitWritePipe", + "opcode" : 281, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpIsValidReserveId", + "opcode" : 282, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetNumPipePackets", + "opcode" : 283, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetMaxPipePackets", + "opcode" : 284, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveReadPipePackets", + "opcode" : 285, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveWritePipePackets", + "opcode" : 286, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitReadPipe", + "opcode" : 287, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitWritePipe", + "opcode" : 288, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpEnqueueMarker", + "opcode" : 291, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpEnqueueKernel", + "opcode" : 292, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Local Size'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeSubGroupCount", + "opcode" : 293, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeMaxSubGroupSize", + "opcode" : 294, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelWorkGroupSize", + "opcode" : 295, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelPreferredWorkGroupSizeMultiple", + "opcode" : 296, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpRetainEvent", + "opcode" : 297, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpReleaseEvent", + "opcode" : 298, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCreateUserEvent", + "opcode" : 299, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpIsValidEvent", + "opcode" : 300, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpSetUserEventStatus", + "opcode" : 301, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Status'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCaptureEventProfilingInfo", + "opcode" : 302, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Profiling Info'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetDefaultQueue", + "opcode" : 303, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpBuildNDRange", + "opcode" : 304, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'GlobalWorkSize'" }, + { "kind" : "IdRef", "name" : "'LocalWorkSize'" }, + { "kind" : "IdRef", "name" : "'GlobalWorkOffset'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpImageSparseSampleImplicitLod", + "opcode" : 305, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleExplicitLod", + "opcode" : 306, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefImplicitLod", + "opcode" : 307, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefExplicitLod", + "opcode" : 308, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjImplicitLod", + "opcode" : 309, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjExplicitLod", + "opcode" : 310, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjDrefImplicitLod", + "opcode" : 311, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjDrefExplicitLod", + "opcode" : 312, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseFetch", + "opcode" : 313, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseGather", + "opcode" : 314, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseDrefGather", + "opcode" : 315, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseTexelsResident", + "opcode" : 316, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Resident Code'" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpNoLine", + "opcode" : 317 + }, + { + "opname" : "OpAtomicFlagTestAndSet", + "opcode" : 318, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicFlagClear", + "opcode" : 319, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageSparseRead", + "opcode" : 320, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpSizeOf", + "opcode" : 321, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpTypePipeStorage", + "opcode" : 322, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "PipeStorage" ] + }, + { + "opname" : "OpConstantPipeStorage", + "opcode" : 323, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Packet Size'" }, + { "kind" : "LiteralInteger", "name" : "'Packet Alignment'" }, + { "kind" : "LiteralInteger", "name" : "'Capacity'" } + ], + "capabilities" : [ "PipeStorage" ] + }, + { + "opname" : "OpCreatePipeFromPipeStorage", + "opcode" : 324, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe Storage'" } + ], + "capabilities" : [ "PipeStorage" ] + }, + { + "opname" : "OpGetKernelLocalSizeForSubgroupCount", + "opcode" : 325, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Subgroup Count'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "SubgroupDispatch" ] + }, + { + "opname" : "OpGetKernelMaxNumSubgroups", + "opcode" : 326, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "SubgroupDispatch" ] + }, + { + "opname" : "OpTypeNamedBarrier", + "opcode" : 327, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "NamedBarrier" ] + }, + { + "opname" : "OpNamedBarrierInitialize", + "opcode" : 328, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Subgroup Count'" } + ], + "capabilities" : [ "NamedBarrier" ] + }, + { + "opname" : "OpMemoryNamedBarrier", + "opcode" : 329, + "operands" : [ + { "kind" : "IdRef", "name" : "'Named Barrier'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "NamedBarrier" ] + }, + { + "opname" : "OpModuleProcessed", + "opcode" : 330, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Process'" } + ] + }, + { + "opname" : "OpDecorateId", + "opcode" : 332, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + }, + { + "opname" : "OpSubgroupBallotKHR", + "opcode" : 4421, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpSubgroupFirstInvocationKHR", + "opcode" : 4422, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpSubgroupAllKHR", + "opcode" : 4428, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupAnyKHR", + "opcode" : 4429, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupAllEqualKHR", + "opcode" : 4430, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupReadInvocationKHR", + "opcode" : 4432, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpGroupIAddNonUniformAMD", + "opcode" : 5000, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAddNonUniformAMD", + "opcode" : 5001, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMinNonUniformAMD", + "opcode" : 5002, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMinNonUniformAMD", + "opcode" : 5003, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMinNonUniformAMD", + "opcode" : 5004, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMaxNonUniformAMD", + "opcode" : 5005, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMaxNonUniformAMD", + "opcode" : 5006, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMaxNonUniformAMD", + "opcode" : 5007, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpFragmentMaskFetchAMD", + "opcode" : 5011, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "FragmentMaskAMD" ] + }, + { + "opname" : "OpFragmentFetchAMD", + "opcode" : 5012, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Fragment Index'" } + ], + "capabilities" : [ "FragmentMaskAMD" ] + }, + { + "opname" : "OpSubgroupShuffleINTEL", + "opcode" : 5571, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'InvocationId'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleDownINTEL", + "opcode" : 5572, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Next'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleUpINTEL", + "opcode" : 5573, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Previous'" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleXorINTEL", + "opcode" : 5574, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupBlockReadINTEL", + "opcode" : 5575, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Ptr'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupBlockWriteINTEL", + "opcode" : 5576, + "operands" : [ + { "kind" : "IdRef", "name" : "'Ptr'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupImageBlockReadINTEL", + "opcode" : 5577, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupImageBlockWriteINTEL", + "opcode" : 5578, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ] + }, + { + "opname" : "OpDecorateStringGOOGLE", + "opcode" : 5632, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string" ] + }, + { + "opname" : "OpMemberDecorateStringGOOGLE", + "opcode" : 5633, + "operands" : [ + { "kind" : "IdRef", "name" : "'Struct Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string" ] + } + ], + "operand_kinds" : [ + { + "category" : "BitEnum", + "kind" : "ImageOperands", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Bias", + "value" : "0x0001", + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Lod", + "value" : "0x0002", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Grad", + "value" : "0x0004", + "parameters" : [ + { "kind" : "IdRef" }, + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffset", + "value" : "0x0008", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Offset", + "value" : "0x0010", + "capabilities" : [ "ImageGatherExtended" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffsets", + "value" : "0x0020", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Sample", + "value" : "0x0040", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "MinLod", + "value" : "0x0080", + "capabilities" : [ "MinLod" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FPFastMathMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "NotNaN", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NotInf", + "value" : "0x0002", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NSZ", + "value" : "0x0004", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AllowRecip", + "value" : "0x0008", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Fast", + "value" : "0x0010", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "SelectionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Flatten", + "value" : "0x0001" + }, + { + "enumerant" : "DontFlatten", + "value" : "0x0002" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "LoopControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Unroll", + "value" : "0x0001" + }, + { + "enumerant" : "DontUnroll", + "value" : "0x0002" + }, + { + "enumerant" : "DependencyInfinite", + "value" : "0x0004" + }, + { + "enumerant" : "DependencyLength", + "value" : "0x0008", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FunctionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Inline", + "value" : "0x0001" + }, + { + "enumerant" : "DontInline", + "value" : "0x0002" + }, + { + "enumerant" : "Pure", + "value" : "0x0004" + }, + { + "enumerant" : "Const", + "value" : "0x0008" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemorySemantics", + "enumerants" : [ + { + "enumerant" : "Relaxed", + "value" : "0x0000" + }, + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Acquire", + "value" : "0x0002" + }, + { + "enumerant" : "Release", + "value" : "0x0004" + }, + { + "enumerant" : "AcquireRelease", + "value" : "0x0008" + }, + { + "enumerant" : "SequentiallyConsistent", + "value" : "0x0010" + }, + { + "enumerant" : "UniformMemory", + "value" : "0x0040", + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupMemory", + "value" : "0x0080" + }, + { + "enumerant" : "WorkgroupMemory", + "value" : "0x0100" + }, + { + "enumerant" : "CrossWorkgroupMemory", + "value" : "0x0200" + }, + { + "enumerant" : "AtomicCounterMemory", + "value" : "0x0400", + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "ImageMemory", + "value" : "0x0800" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemoryAccess", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Volatile", + "value" : "0x0001" + }, + { + "enumerant" : "Aligned", + "value" : "0x0002", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + }, + { + "enumerant" : "Nontemporal", + "value" : "0x0004" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "KernelProfilingInfo", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "CmdExecTime", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SourceLanguage", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "ESSL", + "value" : 1 + }, + { + "enumerant" : "GLSL", + "value" : 2 + }, + { + "enumerant" : "OpenCL_C", + "value" : 3 + }, + { + "enumerant" : "OpenCL_CPP", + "value" : 4 + }, + { + "enumerant" : "HLSL", + "value" : 5 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionModel", + "enumerants" : [ + { + "enumerant" : "Vertex", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TessellationControl", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessellationEvaluation", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Geometry", + "value" : 3, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Fragment", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLCompute", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Kernel", + "value" : 6, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AddressingModel", + "enumerants" : [ + { + "enumerant" : "Logical", + "value" : 0 + }, + { + "enumerant" : "Physical32", + "value" : 1, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Physical64", + "value" : 2, + "capabilities" : [ "Addresses" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "MemoryModel", + "enumerants" : [ + { + "enumerant" : "Simple", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSL450", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OpenCL", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionMode", + "enumerants" : [ + { + "enumerant" : "Invocations", + "value" : 0, + "capabilities" : [ "Geometry" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Number of <>'" } + ] + }, + { + "enumerant" : "SpacingEqual", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalEven", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalOdd", + "value" : 3, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCw", + "value" : 4, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCcw", + "value" : 5, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PixelCenterInteger", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginUpperLeft", + "value" : 7, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginLowerLeft", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "EarlyFragmentTests", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointMode", + "value" : 10, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Xfb", + "value" : 11, + "capabilities" : [ "TransformFeedback" ] + }, + { + "enumerant" : "DepthReplacing", + "value" : 12, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthGreater", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthLess", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthUnchanged", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "LocalSize", + "value" : 17, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "LocalSizeHint", + "value" : 18, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "InputPoints", + "value" : 19, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLines", + "value" : 20, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLinesAdjacency", + "value" : 21, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Triangles", + "value" : 22, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InputTrianglesAdjacency", + "value" : 23, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Quads", + "value" : 24, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Isolines", + "value" : 25, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "OutputVertices", + "value" : 26, + "capabilities" : [ "Geometry", "Tessellation" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vertex count'" } + ] + }, + { + "enumerant" : "OutputPoints", + "value" : 27, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputLineStrip", + "value" : 28, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputTriangleStrip", + "value" : 29, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "VecTypeHint", + "value" : 30, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vector type'" } + ] + }, + { + "enumerant" : "ContractionOff", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Initializer", + "value" : 33, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Finalizer", + "value" : 34, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupSize", + "value" : 35, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Subgroup Size'" } + ] + }, + { + "enumerant" : "SubgroupsPerWorkgroup", + "value" : 36, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Subgroups Per Workgroup'" } + ] + }, + { + "enumerant" : "PostDepthCoverage", + "value" : 4446, + "capabilities" : [ "SampleMaskPostDepthCoverage" ] + }, + { + "enumerant" : "StencilRefReplacingEXT", + "value" : 5027, + "capabilities" : [ "StencilExportEXT" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "StorageClass", + "enumerants" : [ + { + "enumerant" : "UniformConstant", + "value" : 0 + }, + { + "enumerant" : "Input", + "value" : 1 + }, + { + "enumerant" : "Uniform", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Output", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Workgroup", + "value" : 4 + }, + { + "enumerant" : "CrossWorkgroup", + "value" : 5 + }, + { + "enumerant" : "Private", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Function", + "value" : 7 + }, + { + "enumerant" : "Generic", + "value" : 8, + "capabilities" : [ "GenericPointer" ] + }, + { + "enumerant" : "PushConstant", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "AtomicCounter", + "value" : 10, + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "Image", + "value" : 11 + }, + { + "enumerant" : "StorageBuffer", + "value" : 12, + "extensions" : [ + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers" + ], + "capabilities" : [ "Shader" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Dim", + "enumerants" : [ + { + "enumerant" : "1D", + "value" : 0, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "2D", + "value" : 1 + }, + { + "enumerant" : "3D", + "value" : 2 + }, + { + "enumerant" : "Cube", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rect", + "value" : 4, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "Buffer", + "value" : 5, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "SubpassData", + "value" : 6, + "capabilities" : [ "InputAttachment" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerAddressingMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ClampToEdge", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Clamp", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Repeat", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RepeatMirrored", + "value" : 4, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerFilterMode", + "enumerants" : [ + { + "enumerant" : "Nearest", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Linear", + "value" : 1, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageFormat", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "Rgba32f", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16f", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32f", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8Snorm", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32f", + "value" : 6, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16f", + "value" : 7, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R11fG11fB10f", + "value" : 8, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16f", + "value" : 9, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16", + "value" : 10, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgb10A2", + "value" : 11, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16", + "value" : 12, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8", + "value" : 13, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16", + "value" : 14, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8", + "value" : 15, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16Snorm", + "value" : 16, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16Snorm", + "value" : 17, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8Snorm", + "value" : 18, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16Snorm", + "value" : 19, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8Snorm", + "value" : 20, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32i", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16i", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8i", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32i", + "value" : 24, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32i", + "value" : 25, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16i", + "value" : 26, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8i", + "value" : 27, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16i", + "value" : 28, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8i", + "value" : 29, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32ui", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16ui", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8ui", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32ui", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgb10a2ui", + "value" : 34, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg32ui", + "value" : 35, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16ui", + "value" : 36, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8ui", + "value" : 37, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16ui", + "value" : 38, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8ui", + "value" : 39, + "capabilities" : [ "StorageImageExtendedFormats" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelOrder", + "enumerants" : [ + { + "enumerant" : "R", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "A", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RG", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RA", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGB", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBA", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BGRA", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ARGB", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Intensity", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Luminance", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Rx", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGx", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBx", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Depth", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "DepthStencil", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGB", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBx", + "value" : 16, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBA", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sBGRA", + "value" : 18, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ABGR", + "value" : 19, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelDataType", + "enumerants" : [ + { + "enumerant" : "SnormInt8", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SnormInt16", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt8", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt16", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort565", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort555", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt8", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt16", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt32", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt8", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt16", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt32", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "HalfFloat", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt24", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010_2", + "value" : 16, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FPRoundingMode", + "enumerants" : [ + { + "enumerant" : "RTE", + "value" : 0, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTZ", + "value" : 1, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTP", + "value" : 2, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTN", + "value" : 3, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "LinkageType", + "enumerants" : [ + { + "enumerant" : "Export", + "value" : 0, + "capabilities" : [ "Linkage" ] + }, + { + "enumerant" : "Import", + "value" : 1, + "capabilities" : [ "Linkage" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AccessQualifier", + "enumerants" : [ + { + "enumerant" : "ReadOnly", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WriteOnly", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ReadWrite", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FunctionParameterAttribute", + "enumerants" : [ + { + "enumerant" : "Zext", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sext", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ByVal", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sret", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoAlias", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoCapture", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoWrite", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoReadWrite", + "value" : 7, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Decoration", + "enumerants" : [ + { + "enumerant" : "RelaxedPrecision", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SpecId", + "value" : 1, + "capabilities" : [ "Shader", "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Specialization Constant ID'" } + ] + }, + { + "enumerant" : "Block", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "BufferBlock", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "RowMajor", + "value" : 4, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ColMajor", + "value" : 5, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ArrayStride", + "value" : 6, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Array Stride'" } + ] + }, + { + "enumerant" : "MatrixStride", + "value" : 7, + "capabilities" : [ "Matrix" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Matrix Stride'" } + ] + }, + { + "enumerant" : "GLSLShared", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSLPacked", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CPacked", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BuiltIn", + "value" : 11, + "parameters" : [ + { "kind" : "BuiltIn" } + ] + }, + { + "enumerant" : "NoPerspective", + "value" : 13, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Flat", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Patch", + "value" : 15, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Centroid", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sample", + "value" : 17, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "Invariant", + "value" : 18, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Restrict", + "value" : 19 + }, + { + "enumerant" : "Aliased", + "value" : 20 + }, + { + "enumerant" : "Volatile", + "value" : 21 + }, + { + "enumerant" : "Constant", + "value" : 22, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Coherent", + "value" : 23 + }, + { + "enumerant" : "NonWritable", + "value" : 24 + }, + { + "enumerant" : "NonReadable", + "value" : 25 + }, + { + "enumerant" : "Uniform", + "value" : 26, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SaturatedConversion", + "value" : 28, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Stream", + "value" : 29, + "capabilities" : [ "GeometryStreams" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Stream Number'" } + ] + }, + { + "enumerant" : "Location", + "value" : 30, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Location'" } + ] + }, + { + "enumerant" : "Component", + "value" : 31, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Component'" } + ] + }, + { + "enumerant" : "Index", + "value" : 32, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Index'" } + ] + }, + { + "enumerant" : "Binding", + "value" : 33, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Binding Point'" } + ] + }, + { + "enumerant" : "DescriptorSet", + "value" : 34, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Descriptor Set'" } + ] + }, + { + "enumerant" : "Offset", + "value" : 35, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Byte Offset'" } + ] + }, + { + "enumerant" : "XfbBuffer", + "value" : 36, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Buffer Number'" } + ] + }, + { + "enumerant" : "XfbStride", + "value" : 37, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Stride'" } + ] + }, + { + "enumerant" : "FuncParamAttr", + "value" : 38, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FunctionParameterAttribute", "name" : "'Function Parameter Attribute'" } + ] + }, + { + "enumerant" : "FPRoundingMode", + "value" : 39, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ], + "parameters" : [ + { "kind" : "FPRoundingMode", "name" : "'Floating-Point Rounding Mode'" } + ] + }, + { + "enumerant" : "FPFastMathMode", + "value" : 40, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FPFastMathMode", "name" : "'Fast-Math Mode'" } + ] + }, + { + "enumerant" : "LinkageAttributes", + "value" : 41, + "capabilities" : [ "Linkage" ], + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "LinkageType", "name" : "'Linkage Type'" } + ] + }, + { + "enumerant" : "NoContraction", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InputAttachmentIndex", + "value" : 43, + "capabilities" : [ "InputAttachment" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Attachment Index'" } + ] + }, + { + "enumerant" : "Alignment", + "value" : 44, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Alignment'" } + ] + }, + { + "enumerant" : "MaxByteOffset", + "value" : 45, + "capabilities" : [ "Addresses" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Max Byte Offset'" } + ] + }, + { + "enumerant" : "ExplicitInterpAMD", + "value" : 4999 + }, + { + "enumerant" : "OverrideCoverageNV", + "value" : 5248, + "capabilities" : [ "SampleMaskOverrideCoverageNV" ] + }, + { + "enumerant" : "PassthroughNV", + "value" : 5250, + "capabilities" : [ "GeometryShaderPassthroughNV" ] + }, + { + "enumerant" : "ViewportRelativeNV", + "value" : 5252, + "capabilities" : [ "ShaderViewportMaskNV" ] + }, + { + "enumerant" : "SecondaryViewportRelativeNV", + "value" : 5256, + "capabilities" : [ "ShaderStereoViewNV" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Offset'" } + ] + }, + { + "enumerant" : "HlslCounterBufferGOOGLE", + "value" : 5634, + "parameters" : [ + { "kind" : "IdRef", "name" : "'Counter Buffer'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + }, + { + "enumerant" : "HlslSemanticGOOGLE", + "value" : 5635, + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Semantic'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "BuiltIn", + "enumerants" : [ + { + "enumerant" : "Position", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointSize", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 3, + "capabilities" : [ "ClipDistance" ] + }, + { + "enumerant" : "CullDistance", + "value" : 4, + "capabilities" : [ "CullDistance" ] + }, + { + "enumerant" : "VertexId", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceId", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PrimitiveId", + "value" : 7, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InvocationId", + "value" : 8, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "Layer", + "value" : 9, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ViewportIndex", + "value" : 10, + "capabilities" : [ "MultiViewport" ] + }, + { + "enumerant" : "TessLevelOuter", + "value" : 11, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessLevelInner", + "value" : 12, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessCoord", + "value" : 13, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PatchVertices", + "value" : 14, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "FragCoord", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointCoord", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FrontFacing", + "value" : 17, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampleId", + "value" : 18, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SamplePosition", + "value" : 19, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SampleMask", + "value" : 20, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FragDepth", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "HelperInvocation", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "NumWorkgroups", + "value" : 24 + }, + { + "enumerant" : "WorkgroupSize", + "value" : 25 + }, + { + "enumerant" : "WorkgroupId", + "value" : 26 + }, + { + "enumerant" : "LocalInvocationId", + "value" : 27 + }, + { + "enumerant" : "GlobalInvocationId", + "value" : 28 + }, + { + "enumerant" : "LocalInvocationIndex", + "value" : 29 + }, + { + "enumerant" : "WorkDim", + "value" : 30, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalSize", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "EnqueuedWorkgroupSize", + "value" : 32, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalOffset", + "value" : 33, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalLinearId", + "value" : 34, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupSize", + "value" : 36, + "capabilities" : [ "Kernel", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupMaxSize", + "value" : 37, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumSubgroups", + "value" : 38, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumEnqueuedSubgroups", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupId", + "value" : 40, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupLocalInvocationId", + "value" : 41, + "capabilities" : [ "Kernel", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "VertexIndex", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceIndex", + "value" : 43, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupEqMaskKHR", + "value" : 4416, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupGeMaskKHR", + "value" : 4417, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupGtMaskKHR", + "value" : 4418, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupLeMaskKHR", + "value" : 4419, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupLtMaskKHR", + "value" : 4420, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "BaseVertex", + "value" : 4424, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "BaseInstance", + "value" : 4425, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "DrawIndex", + "value" : 4426, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "DeviceIndex", + "value" : 4438, + "capabilities" : [ "DeviceGroup" ] + }, + { + "enumerant" : "ViewIndex", + "value" : 4440, + "capabilities" : [ "MultiView" ] + }, + { + "enumerant" : "BaryCoordNoPerspAMD", + "value" : 4992 + }, + { + "enumerant" : "BaryCoordNoPerspCentroidAMD", + "value" : 4993 + }, + { + "enumerant" : "BaryCoordNoPerspSampleAMD", + "value" : 4994 + }, + { + "enumerant" : "BaryCoordSmoothAMD", + "value" : 4995 + }, + { + "enumerant" : "BaryCoordSmoothCentroidAMD", + "value" : 4996 + }, + { + "enumerant" : "BaryCoordSmoothSampleAMD", + "value" : 4997 + }, + { + "enumerant" : "BaryCoordPullModelAMD", + "value" : 4998 + }, + { + "enumerant" : "FragStencilRefEXT", + "value" : 5014, + "capabilities" : [ "StencilExportEXT" ] + }, + { + "enumerant" : "ViewportMaskNV", + "value" : 5253, + "capabilities" : [ "ShaderViewportMaskNV" ] + }, + { + "enumerant" : "SecondaryPositionNV", + "value" : 5257, + "capabilities" : [ "ShaderStereoViewNV" ] + }, + { + "enumerant" : "SecondaryViewportMaskNV", + "value" : 5258, + "capabilities" : [ "ShaderStereoViewNV" ] + }, + { + "enumerant" : "PositionPerViewNV", + "value" : 5261, + "capabilities" : [ "PerViewAttributesNV" ] + }, + { + "enumerant" : "ViewportMaskPerViewNV", + "value" : 5262, + "capabilities" : [ "PerViewAttributesNV" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Scope", + "enumerants" : [ + { + "enumerant" : "CrossDevice", + "value" : 0 + }, + { + "enumerant" : "Device", + "value" : 1 + }, + { + "enumerant" : "Workgroup", + "value" : 2 + }, + { + "enumerant" : "Subgroup", + "value" : 3 + }, + { + "enumerant" : "Invocation", + "value" : 4 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "GroupOperation", + "enumerants" : [ + { + "enumerant" : "Reduce", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "InclusiveScan", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ExclusiveScan", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "KernelEnqueueFlags", + "enumerants" : [ + { + "enumerant" : "NoWait", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitKernel", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitWorkGroup", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Capability", + "enumerants" : [ + { + "enumerant" : "Matrix", + "value" : 0 + }, + { + "enumerant" : "Shader", + "value" : 1, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "Geometry", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Tessellation", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Addresses", + "value" : 4 + }, + { + "enumerant" : "Linkage", + "value" : 5 + }, + { + "enumerant" : "Kernel", + "value" : 6 + }, + { + "enumerant" : "Vector16", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16Buffer", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16", + "value" : 9 + }, + { + "enumerant" : "Float64", + "value" : 10 + }, + { + "enumerant" : "Int64", + "value" : 11 + }, + { + "enumerant" : "Int64Atomics", + "value" : 12, + "capabilities" : [ "Int64" ] + }, + { + "enumerant" : "ImageBasic", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ImageReadWrite", + "value" : 14, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "ImageMipmap", + "value" : 15, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "Pipes", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Groups", + "value" : 18 + }, + { + "enumerant" : "DeviceEnqueue", + "value" : 19, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "LiteralSampler", + "value" : 20, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AtomicStorage", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Int16", + "value" : 22 + }, + { + "enumerant" : "TessellationPointSize", + "value" : 23, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "GeometryPointSize", + "value" : 24, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ImageGatherExtended", + "value" : 25, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageMultisample", + "value" : 27, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "UniformBufferArrayDynamicIndexing", + "value" : 28, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledImageArrayDynamicIndexing", + "value" : 29, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageBufferArrayDynamicIndexing", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageArrayDynamicIndexing", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CullDistance", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageCubeArray", + "value" : 34, + "capabilities" : [ "SampledCubeArray" ] + }, + { + "enumerant" : "SampleRateShading", + "value" : 35, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageRect", + "value" : 36, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "SampledRect", + "value" : 37, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GenericPointer", + "value" : 38, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Int8", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "InputAttachment", + "value" : 40, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SparseResidency", + "value" : 41, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MinLod", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sampled1D", + "value" : 43 + }, + { + "enumerant" : "Image1D", + "value" : 44, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "SampledCubeArray", + "value" : 45, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledBuffer", + "value" : 46 + }, + { + "enumerant" : "ImageBuffer", + "value" : 47, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "ImageMSArray", + "value" : 48, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageExtendedFormats", + "value" : 49, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageQuery", + "value" : 50, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DerivativeControl", + "value" : 51, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InterpolationFunction", + "value" : 52, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TransformFeedback", + "value" : 53, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GeometryStreams", + "value" : 54, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "StorageImageReadWithoutFormat", + "value" : 55, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageWriteWithoutFormat", + "value" : 56, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MultiViewport", + "value" : 57, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "SubgroupDispatch", + "value" : 58, + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "enumerant" : "NamedBarrier", + "value" : 59, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "PipeStorage", + "value" : 60, + "capabilities" : [ "Pipes" ] + }, + { + "enumerant" : "SubgroupBallotKHR", + "value" : 4423, + "extensions" : [ "SPV_KHR_shader_ballot" ] + }, + { + "enumerant" : "DrawParameters", + "value" : 4427, + "extensions" : [ "SPV_KHR_shader_draw_parameters" ] + }, + { + "enumerant" : "SubgroupVoteKHR", + "value" : 4431, + "extensions" : [ "SPV_KHR_subgroup_vote" ] + }, + { + "enumerant" : "StorageBuffer16BitAccess", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageUniformBufferBlock16", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "UniformAndStorageBuffer16BitAccess", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageUniform16", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StoragePushConstant16", + "value" : 4435, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageInputOutput16", + "value" : 4436, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "DeviceGroup", + "value" : 4437, + "extensions" : [ "SPV_KHR_device_group" ] + }, + { + "enumerant" : "MultiView", + "value" : 4439, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_multiview" ] + }, + { + "enumerant" : "VariablePointersStorageBuffer", + "value" : 4441, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_variable_pointers" ] + }, + { + "enumerant" : "VariablePointers", + "value" : 4442, + "capabilities" : [ "VariablePointersStorageBuffer" ], + "extensions" : [ "SPV_KHR_variable_pointers" ] + }, + { + "enumerant": "AtomicStorageOps", + "value": 4445, + "extensions": [ "SPV_KHR_shader_atomic_counter_ops" ] + }, + { + "enumerant" : "SampleMaskPostDepthCoverage", + "value" : 4447, + "extensions" : [ "SPV_KHR_post_depth_coverage" ] + }, + { + "enumerant" : "ImageGatherBiasLodAMD", + "value" : 5009, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_texture_gather_bias_lod" ] + }, + { + "enumerant" : "FragmentMaskAMD", + "value" : 5010, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_fragment_mask" ] + }, + { + "enumerant" : "StencilExportEXT", + "value" : 5013, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_shader_stencil_export" ] + }, + { + "enumerant" : "ImageReadWriteLodAMD", + "value" : 5015, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_image_load_store_lod" ] + }, + { + "enumerant" : "SampleMaskOverrideCoverageNV", + "value" : 5249, + "capabilities" : [ "SampleRateShading" ], + "extensions" : [ "SPV_NV_sample_mask_override_coverage" ] + }, + { + "enumerant" : "GeometryShaderPassthroughNV", + "value" : 5251, + "capabilities" : [ "Geometry" ], + "extensions" : [ "SPV_NV_geometry_shader_passthrough" ] + }, + { + "enumerant" : "ShaderViewportIndexLayerEXT", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_EXT_shader_viewport_index_layer" ] + }, + { + "enumerant" : "ShaderViewportIndexLayerNV", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_NV_viewport_array2" ] + }, + { + "enumerant" : "ShaderViewportMaskNV", + "value" : 5255, + "capabilities" : [ "ShaderViewportIndexLayerNV" ], + "extensions" : [ "SPV_NV_viewport_array2" ] + }, + { + "enumerant" : "ShaderStereoViewNV", + "value" : 5259, + "capabilities" : [ "ShaderViewportMaskNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ] + }, + { + "enumerant" : "PerViewAttributesNV", + "value" : 5260, + "capabilities" : [ "MultiView" ], + "extensions" : [ "SPV_NVX_multiview_per_view_attributes" ] + }, + { + "enumerant" : "SubgroupShuffleINTEL", + "value" : 5568, + "extensions" : [ "SPV_INTEL_subgroups" ] + }, + { + "enumerant" : "SubgroupBufferBlockIOINTEL", + "value" : 5569, + "extensions" : [ "SPV_INTEL_subgroups" ] + }, + { + "enumerant" : "SubgroupImageBlockIOINTEL", + "value" : 5570, + "extensions" : [ "SPV_INTEL_subgroups" ] + } + ] + }, + { + "category" : "Id", + "kind" : "IdResultType", + "doc" : "Reference to an representing the result's type of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdResult", + "doc" : "Definition of an representing the result of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdMemorySemantics", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the MemorySemantics operand kind" + }, + { + "category" : "Id", + "kind" : "IdScope", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the Scope operand kind" + }, + { + "category" : "Id", + "kind" : "IdRef", + "doc" : "Reference to an " + }, + { + "category" : "Literal", + "kind" : "LiteralInteger", + "doc" : "An integer consuming one or more words" + }, + { + "category" : "Literal", + "kind" : "LiteralString", + "doc" : "A null-terminated stream of characters consuming an integral number of words" + }, + { + "category" : "Literal", + "kind" : "LiteralContextDependentNumber", + "doc" : "A literal number whose size and format are determined by a previous operand in the enclosing instruction" + }, + { + "category" : "Literal", + "kind" : "LiteralExtInstInteger", + "doc" : "A 32-bit unsigned integer indicating which instruction to use and determining the layout of following operands (for OpExtInst)" + }, + { + "category" : "Literal", + "kind" : "LiteralSpecConstantOpInteger", + "doc" : "An opcode indicating the operation to be performed and determining the layout of following operands (for OpSpecConstantOp)" + }, + { + "category" : "Composite", + "kind" : "PairLiteralIntegerIdRef", + "bases" : [ "LiteralInteger", "IdRef" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefLiteralInteger", + "bases" : [ "IdRef", "LiteralInteger" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefIdRef", + "bases" : [ "IdRef", "IdRef" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.h new file mode 100644 index 00000000000..971c3be6d25 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.h @@ -0,0 +1,1015 @@ +/* +** Copyright (c) 2014-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +/* +** This header is automatically generated by the same tool that creates +** the Binary Section of the SPIR-V specification. +*/ + +/* +** Enumeration tokens for SPIR-V, in various styles: +** C, C++, C++11, JSON, Lua, Python +** +** - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +** - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +** - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +** - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +** - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +** +** Some tokens act like mask values, which can be OR'd together, +** while others are mutually exclusive. The mask-like ones have +** "Mask" in their name, and a parallel enum that has the shift +** amount (1 << x) for each corresponding enumerant. +*/ + +#ifndef spirv_H +#define spirv_H + +typedef unsigned int SpvId; + +#define SPV_VERSION 0x10100 +#define SPV_REVISION 8 + +static const unsigned int SpvMagicNumber = 0x07230203; +static const unsigned int SpvVersion = 0x00010100; +static const unsigned int SpvRevision = 8; +static const unsigned int SpvOpCodeMask = 0xffff; +static const unsigned int SpvWordCountShift = 16; + +typedef enum SpvSourceLanguage_ { + SpvSourceLanguageUnknown = 0, + SpvSourceLanguageESSL = 1, + SpvSourceLanguageGLSL = 2, + SpvSourceLanguageOpenCL_C = 3, + SpvSourceLanguageOpenCL_CPP = 4, + SpvSourceLanguageHLSL = 5, + SpvSourceLanguageMax = 0x7fffffff, +} SpvSourceLanguage; + +typedef enum SpvExecutionModel_ { + SpvExecutionModelVertex = 0, + SpvExecutionModelTessellationControl = 1, + SpvExecutionModelTessellationEvaluation = 2, + SpvExecutionModelGeometry = 3, + SpvExecutionModelFragment = 4, + SpvExecutionModelGLCompute = 5, + SpvExecutionModelKernel = 6, + SpvExecutionModelMax = 0x7fffffff, +} SpvExecutionModel; + +typedef enum SpvAddressingModel_ { + SpvAddressingModelLogical = 0, + SpvAddressingModelPhysical32 = 1, + SpvAddressingModelPhysical64 = 2, + SpvAddressingModelMax = 0x7fffffff, +} SpvAddressingModel; + +typedef enum SpvMemoryModel_ { + SpvMemoryModelSimple = 0, + SpvMemoryModelGLSL450 = 1, + SpvMemoryModelOpenCL = 2, + SpvMemoryModelMax = 0x7fffffff, +} SpvMemoryModel; + +typedef enum SpvExecutionMode_ { + SpvExecutionModeInvocations = 0, + SpvExecutionModeSpacingEqual = 1, + SpvExecutionModeSpacingFractionalEven = 2, + SpvExecutionModeSpacingFractionalOdd = 3, + SpvExecutionModeVertexOrderCw = 4, + SpvExecutionModeVertexOrderCcw = 5, + SpvExecutionModePixelCenterInteger = 6, + SpvExecutionModeOriginUpperLeft = 7, + SpvExecutionModeOriginLowerLeft = 8, + SpvExecutionModeEarlyFragmentTests = 9, + SpvExecutionModePointMode = 10, + SpvExecutionModeXfb = 11, + SpvExecutionModeDepthReplacing = 12, + SpvExecutionModeDepthGreater = 14, + SpvExecutionModeDepthLess = 15, + SpvExecutionModeDepthUnchanged = 16, + SpvExecutionModeLocalSize = 17, + SpvExecutionModeLocalSizeHint = 18, + SpvExecutionModeInputPoints = 19, + SpvExecutionModeInputLines = 20, + SpvExecutionModeInputLinesAdjacency = 21, + SpvExecutionModeTriangles = 22, + SpvExecutionModeInputTrianglesAdjacency = 23, + SpvExecutionModeQuads = 24, + SpvExecutionModeIsolines = 25, + SpvExecutionModeOutputVertices = 26, + SpvExecutionModeOutputPoints = 27, + SpvExecutionModeOutputLineStrip = 28, + SpvExecutionModeOutputTriangleStrip = 29, + SpvExecutionModeVecTypeHint = 30, + SpvExecutionModeContractionOff = 31, + SpvExecutionModeInitializer = 33, + SpvExecutionModeFinalizer = 34, + SpvExecutionModeSubgroupSize = 35, + SpvExecutionModeSubgroupsPerWorkgroup = 36, + SpvExecutionModePostDepthCoverage = 4446, + SpvExecutionModeStencilRefReplacingEXT = 5027, + SpvExecutionModeMax = 0x7fffffff, +} SpvExecutionMode; + +typedef enum SpvStorageClass_ { + SpvStorageClassUniformConstant = 0, + SpvStorageClassInput = 1, + SpvStorageClassUniform = 2, + SpvStorageClassOutput = 3, + SpvStorageClassWorkgroup = 4, + SpvStorageClassCrossWorkgroup = 5, + SpvStorageClassPrivate = 6, + SpvStorageClassFunction = 7, + SpvStorageClassGeneric = 8, + SpvStorageClassPushConstant = 9, + SpvStorageClassAtomicCounter = 10, + SpvStorageClassImage = 11, + SpvStorageClassStorageBuffer = 12, + SpvStorageClassMax = 0x7fffffff, +} SpvStorageClass; + +typedef enum SpvDim_ { + SpvDim1D = 0, + SpvDim2D = 1, + SpvDim3D = 2, + SpvDimCube = 3, + SpvDimRect = 4, + SpvDimBuffer = 5, + SpvDimSubpassData = 6, + SpvDimMax = 0x7fffffff, +} SpvDim; + +typedef enum SpvSamplerAddressingMode_ { + SpvSamplerAddressingModeNone = 0, + SpvSamplerAddressingModeClampToEdge = 1, + SpvSamplerAddressingModeClamp = 2, + SpvSamplerAddressingModeRepeat = 3, + SpvSamplerAddressingModeRepeatMirrored = 4, + SpvSamplerAddressingModeMax = 0x7fffffff, +} SpvSamplerAddressingMode; + +typedef enum SpvSamplerFilterMode_ { + SpvSamplerFilterModeNearest = 0, + SpvSamplerFilterModeLinear = 1, + SpvSamplerFilterModeMax = 0x7fffffff, +} SpvSamplerFilterMode; + +typedef enum SpvImageFormat_ { + SpvImageFormatUnknown = 0, + SpvImageFormatRgba32f = 1, + SpvImageFormatRgba16f = 2, + SpvImageFormatR32f = 3, + SpvImageFormatRgba8 = 4, + SpvImageFormatRgba8Snorm = 5, + SpvImageFormatRg32f = 6, + SpvImageFormatRg16f = 7, + SpvImageFormatR11fG11fB10f = 8, + SpvImageFormatR16f = 9, + SpvImageFormatRgba16 = 10, + SpvImageFormatRgb10A2 = 11, + SpvImageFormatRg16 = 12, + SpvImageFormatRg8 = 13, + SpvImageFormatR16 = 14, + SpvImageFormatR8 = 15, + SpvImageFormatRgba16Snorm = 16, + SpvImageFormatRg16Snorm = 17, + SpvImageFormatRg8Snorm = 18, + SpvImageFormatR16Snorm = 19, + SpvImageFormatR8Snorm = 20, + SpvImageFormatRgba32i = 21, + SpvImageFormatRgba16i = 22, + SpvImageFormatRgba8i = 23, + SpvImageFormatR32i = 24, + SpvImageFormatRg32i = 25, + SpvImageFormatRg16i = 26, + SpvImageFormatRg8i = 27, + SpvImageFormatR16i = 28, + SpvImageFormatR8i = 29, + SpvImageFormatRgba32ui = 30, + SpvImageFormatRgba16ui = 31, + SpvImageFormatRgba8ui = 32, + SpvImageFormatR32ui = 33, + SpvImageFormatRgb10a2ui = 34, + SpvImageFormatRg32ui = 35, + SpvImageFormatRg16ui = 36, + SpvImageFormatRg8ui = 37, + SpvImageFormatR16ui = 38, + SpvImageFormatR8ui = 39, + SpvImageFormatMax = 0x7fffffff, +} SpvImageFormat; + +typedef enum SpvImageChannelOrder_ { + SpvImageChannelOrderR = 0, + SpvImageChannelOrderA = 1, + SpvImageChannelOrderRG = 2, + SpvImageChannelOrderRA = 3, + SpvImageChannelOrderRGB = 4, + SpvImageChannelOrderRGBA = 5, + SpvImageChannelOrderBGRA = 6, + SpvImageChannelOrderARGB = 7, + SpvImageChannelOrderIntensity = 8, + SpvImageChannelOrderLuminance = 9, + SpvImageChannelOrderRx = 10, + SpvImageChannelOrderRGx = 11, + SpvImageChannelOrderRGBx = 12, + SpvImageChannelOrderDepth = 13, + SpvImageChannelOrderDepthStencil = 14, + SpvImageChannelOrdersRGB = 15, + SpvImageChannelOrdersRGBx = 16, + SpvImageChannelOrdersRGBA = 17, + SpvImageChannelOrdersBGRA = 18, + SpvImageChannelOrderABGR = 19, + SpvImageChannelOrderMax = 0x7fffffff, +} SpvImageChannelOrder; + +typedef enum SpvImageChannelDataType_ { + SpvImageChannelDataTypeSnormInt8 = 0, + SpvImageChannelDataTypeSnormInt16 = 1, + SpvImageChannelDataTypeUnormInt8 = 2, + SpvImageChannelDataTypeUnormInt16 = 3, + SpvImageChannelDataTypeUnormShort565 = 4, + SpvImageChannelDataTypeUnormShort555 = 5, + SpvImageChannelDataTypeUnormInt101010 = 6, + SpvImageChannelDataTypeSignedInt8 = 7, + SpvImageChannelDataTypeSignedInt16 = 8, + SpvImageChannelDataTypeSignedInt32 = 9, + SpvImageChannelDataTypeUnsignedInt8 = 10, + SpvImageChannelDataTypeUnsignedInt16 = 11, + SpvImageChannelDataTypeUnsignedInt32 = 12, + SpvImageChannelDataTypeHalfFloat = 13, + SpvImageChannelDataTypeFloat = 14, + SpvImageChannelDataTypeUnormInt24 = 15, + SpvImageChannelDataTypeUnormInt101010_2 = 16, + SpvImageChannelDataTypeMax = 0x7fffffff, +} SpvImageChannelDataType; + +typedef enum SpvImageOperandsShift_ { + SpvImageOperandsBiasShift = 0, + SpvImageOperandsLodShift = 1, + SpvImageOperandsGradShift = 2, + SpvImageOperandsConstOffsetShift = 3, + SpvImageOperandsOffsetShift = 4, + SpvImageOperandsConstOffsetsShift = 5, + SpvImageOperandsSampleShift = 6, + SpvImageOperandsMinLodShift = 7, + SpvImageOperandsMax = 0x7fffffff, +} SpvImageOperandsShift; + +typedef enum SpvImageOperandsMask_ { + SpvImageOperandsMaskNone = 0, + SpvImageOperandsBiasMask = 0x00000001, + SpvImageOperandsLodMask = 0x00000002, + SpvImageOperandsGradMask = 0x00000004, + SpvImageOperandsConstOffsetMask = 0x00000008, + SpvImageOperandsOffsetMask = 0x00000010, + SpvImageOperandsConstOffsetsMask = 0x00000020, + SpvImageOperandsSampleMask = 0x00000040, + SpvImageOperandsMinLodMask = 0x00000080, +} SpvImageOperandsMask; + +typedef enum SpvFPFastMathModeShift_ { + SpvFPFastMathModeNotNaNShift = 0, + SpvFPFastMathModeNotInfShift = 1, + SpvFPFastMathModeNSZShift = 2, + SpvFPFastMathModeAllowRecipShift = 3, + SpvFPFastMathModeFastShift = 4, + SpvFPFastMathModeMax = 0x7fffffff, +} SpvFPFastMathModeShift; + +typedef enum SpvFPFastMathModeMask_ { + SpvFPFastMathModeMaskNone = 0, + SpvFPFastMathModeNotNaNMask = 0x00000001, + SpvFPFastMathModeNotInfMask = 0x00000002, + SpvFPFastMathModeNSZMask = 0x00000004, + SpvFPFastMathModeAllowRecipMask = 0x00000008, + SpvFPFastMathModeFastMask = 0x00000010, +} SpvFPFastMathModeMask; + +typedef enum SpvFPRoundingMode_ { + SpvFPRoundingModeRTE = 0, + SpvFPRoundingModeRTZ = 1, + SpvFPRoundingModeRTP = 2, + SpvFPRoundingModeRTN = 3, + SpvFPRoundingModeMax = 0x7fffffff, +} SpvFPRoundingMode; + +typedef enum SpvLinkageType_ { + SpvLinkageTypeExport = 0, + SpvLinkageTypeImport = 1, + SpvLinkageTypeMax = 0x7fffffff, +} SpvLinkageType; + +typedef enum SpvAccessQualifier_ { + SpvAccessQualifierReadOnly = 0, + SpvAccessQualifierWriteOnly = 1, + SpvAccessQualifierReadWrite = 2, + SpvAccessQualifierMax = 0x7fffffff, +} SpvAccessQualifier; + +typedef enum SpvFunctionParameterAttribute_ { + SpvFunctionParameterAttributeZext = 0, + SpvFunctionParameterAttributeSext = 1, + SpvFunctionParameterAttributeByVal = 2, + SpvFunctionParameterAttributeSret = 3, + SpvFunctionParameterAttributeNoAlias = 4, + SpvFunctionParameterAttributeNoCapture = 5, + SpvFunctionParameterAttributeNoWrite = 6, + SpvFunctionParameterAttributeNoReadWrite = 7, + SpvFunctionParameterAttributeMax = 0x7fffffff, +} SpvFunctionParameterAttribute; + +typedef enum SpvDecoration_ { + SpvDecorationRelaxedPrecision = 0, + SpvDecorationSpecId = 1, + SpvDecorationBlock = 2, + SpvDecorationBufferBlock = 3, + SpvDecorationRowMajor = 4, + SpvDecorationColMajor = 5, + SpvDecorationArrayStride = 6, + SpvDecorationMatrixStride = 7, + SpvDecorationGLSLShared = 8, + SpvDecorationGLSLPacked = 9, + SpvDecorationCPacked = 10, + SpvDecorationBuiltIn = 11, + SpvDecorationNoPerspective = 13, + SpvDecorationFlat = 14, + SpvDecorationPatch = 15, + SpvDecorationCentroid = 16, + SpvDecorationSample = 17, + SpvDecorationInvariant = 18, + SpvDecorationRestrict = 19, + SpvDecorationAliased = 20, + SpvDecorationVolatile = 21, + SpvDecorationConstant = 22, + SpvDecorationCoherent = 23, + SpvDecorationNonWritable = 24, + SpvDecorationNonReadable = 25, + SpvDecorationUniform = 26, + SpvDecorationSaturatedConversion = 28, + SpvDecorationStream = 29, + SpvDecorationLocation = 30, + SpvDecorationComponent = 31, + SpvDecorationIndex = 32, + SpvDecorationBinding = 33, + SpvDecorationDescriptorSet = 34, + SpvDecorationOffset = 35, + SpvDecorationXfbBuffer = 36, + SpvDecorationXfbStride = 37, + SpvDecorationFuncParamAttr = 38, + SpvDecorationFPRoundingMode = 39, + SpvDecorationFPFastMathMode = 40, + SpvDecorationLinkageAttributes = 41, + SpvDecorationNoContraction = 42, + SpvDecorationInputAttachmentIndex = 43, + SpvDecorationAlignment = 44, + SpvDecorationMaxByteOffset = 45, + SpvDecorationExplicitInterpAMD = 4999, + SpvDecorationOverrideCoverageNV = 5248, + SpvDecorationPassthroughNV = 5250, + SpvDecorationViewportRelativeNV = 5252, + SpvDecorationSecondaryViewportRelativeNV = 5256, + SpvDecorationHlslCounterBufferGOOGLE = 5634, + SpvDecorationHlslSemanticGOOGLE = 5635, + SpvDecorationMax = 0x7fffffff, +} SpvDecoration; + +typedef enum SpvBuiltIn_ { + SpvBuiltInPosition = 0, + SpvBuiltInPointSize = 1, + SpvBuiltInClipDistance = 3, + SpvBuiltInCullDistance = 4, + SpvBuiltInVertexId = 5, + SpvBuiltInInstanceId = 6, + SpvBuiltInPrimitiveId = 7, + SpvBuiltInInvocationId = 8, + SpvBuiltInLayer = 9, + SpvBuiltInViewportIndex = 10, + SpvBuiltInTessLevelOuter = 11, + SpvBuiltInTessLevelInner = 12, + SpvBuiltInTessCoord = 13, + SpvBuiltInPatchVertices = 14, + SpvBuiltInFragCoord = 15, + SpvBuiltInPointCoord = 16, + SpvBuiltInFrontFacing = 17, + SpvBuiltInSampleId = 18, + SpvBuiltInSamplePosition = 19, + SpvBuiltInSampleMask = 20, + SpvBuiltInFragDepth = 22, + SpvBuiltInHelperInvocation = 23, + SpvBuiltInNumWorkgroups = 24, + SpvBuiltInWorkgroupSize = 25, + SpvBuiltInWorkgroupId = 26, + SpvBuiltInLocalInvocationId = 27, + SpvBuiltInGlobalInvocationId = 28, + SpvBuiltInLocalInvocationIndex = 29, + SpvBuiltInWorkDim = 30, + SpvBuiltInGlobalSize = 31, + SpvBuiltInEnqueuedWorkgroupSize = 32, + SpvBuiltInGlobalOffset = 33, + SpvBuiltInGlobalLinearId = 34, + SpvBuiltInSubgroupSize = 36, + SpvBuiltInSubgroupMaxSize = 37, + SpvBuiltInNumSubgroups = 38, + SpvBuiltInNumEnqueuedSubgroups = 39, + SpvBuiltInSubgroupId = 40, + SpvBuiltInSubgroupLocalInvocationId = 41, + SpvBuiltInVertexIndex = 42, + SpvBuiltInInstanceIndex = 43, + SpvBuiltInSubgroupEqMaskKHR = 4416, + SpvBuiltInSubgroupGeMaskKHR = 4417, + SpvBuiltInSubgroupGtMaskKHR = 4418, + SpvBuiltInSubgroupLeMaskKHR = 4419, + SpvBuiltInSubgroupLtMaskKHR = 4420, + SpvBuiltInBaseVertex = 4424, + SpvBuiltInBaseInstance = 4425, + SpvBuiltInDrawIndex = 4426, + SpvBuiltInDeviceIndex = 4438, + SpvBuiltInViewIndex = 4440, + SpvBuiltInBaryCoordNoPerspAMD = 4992, + SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993, + SpvBuiltInBaryCoordNoPerspSampleAMD = 4994, + SpvBuiltInBaryCoordSmoothAMD = 4995, + SpvBuiltInBaryCoordSmoothCentroidAMD = 4996, + SpvBuiltInBaryCoordSmoothSampleAMD = 4997, + SpvBuiltInBaryCoordPullModelAMD = 4998, + SpvBuiltInFragStencilRefEXT = 5014, + SpvBuiltInViewportMaskNV = 5253, + SpvBuiltInSecondaryPositionNV = 5257, + SpvBuiltInSecondaryViewportMaskNV = 5258, + SpvBuiltInPositionPerViewNV = 5261, + SpvBuiltInViewportMaskPerViewNV = 5262, + SpvBuiltInMax = 0x7fffffff, +} SpvBuiltIn; + +typedef enum SpvSelectionControlShift_ { + SpvSelectionControlFlattenShift = 0, + SpvSelectionControlDontFlattenShift = 1, + SpvSelectionControlMax = 0x7fffffff, +} SpvSelectionControlShift; + +typedef enum SpvSelectionControlMask_ { + SpvSelectionControlMaskNone = 0, + SpvSelectionControlFlattenMask = 0x00000001, + SpvSelectionControlDontFlattenMask = 0x00000002, +} SpvSelectionControlMask; + +typedef enum SpvLoopControlShift_ { + SpvLoopControlUnrollShift = 0, + SpvLoopControlDontUnrollShift = 1, + SpvLoopControlDependencyInfiniteShift = 2, + SpvLoopControlDependencyLengthShift = 3, + SpvLoopControlMax = 0x7fffffff, +} SpvLoopControlShift; + +typedef enum SpvLoopControlMask_ { + SpvLoopControlMaskNone = 0, + SpvLoopControlUnrollMask = 0x00000001, + SpvLoopControlDontUnrollMask = 0x00000002, + SpvLoopControlDependencyInfiniteMask = 0x00000004, + SpvLoopControlDependencyLengthMask = 0x00000008, +} SpvLoopControlMask; + +typedef enum SpvFunctionControlShift_ { + SpvFunctionControlInlineShift = 0, + SpvFunctionControlDontInlineShift = 1, + SpvFunctionControlPureShift = 2, + SpvFunctionControlConstShift = 3, + SpvFunctionControlMax = 0x7fffffff, +} SpvFunctionControlShift; + +typedef enum SpvFunctionControlMask_ { + SpvFunctionControlMaskNone = 0, + SpvFunctionControlInlineMask = 0x00000001, + SpvFunctionControlDontInlineMask = 0x00000002, + SpvFunctionControlPureMask = 0x00000004, + SpvFunctionControlConstMask = 0x00000008, +} SpvFunctionControlMask; + +typedef enum SpvMemorySemanticsShift_ { + SpvMemorySemanticsAcquireShift = 1, + SpvMemorySemanticsReleaseShift = 2, + SpvMemorySemanticsAcquireReleaseShift = 3, + SpvMemorySemanticsSequentiallyConsistentShift = 4, + SpvMemorySemanticsUniformMemoryShift = 6, + SpvMemorySemanticsSubgroupMemoryShift = 7, + SpvMemorySemanticsWorkgroupMemoryShift = 8, + SpvMemorySemanticsCrossWorkgroupMemoryShift = 9, + SpvMemorySemanticsAtomicCounterMemoryShift = 10, + SpvMemorySemanticsImageMemoryShift = 11, + SpvMemorySemanticsMax = 0x7fffffff, +} SpvMemorySemanticsShift; + +typedef enum SpvMemorySemanticsMask_ { + SpvMemorySemanticsMaskNone = 0, + SpvMemorySemanticsAcquireMask = 0x00000002, + SpvMemorySemanticsReleaseMask = 0x00000004, + SpvMemorySemanticsAcquireReleaseMask = 0x00000008, + SpvMemorySemanticsSequentiallyConsistentMask = 0x00000010, + SpvMemorySemanticsUniformMemoryMask = 0x00000040, + SpvMemorySemanticsSubgroupMemoryMask = 0x00000080, + SpvMemorySemanticsWorkgroupMemoryMask = 0x00000100, + SpvMemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000400, + SpvMemorySemanticsImageMemoryMask = 0x00000800, +} SpvMemorySemanticsMask; + +typedef enum SpvMemoryAccessShift_ { + SpvMemoryAccessVolatileShift = 0, + SpvMemoryAccessAlignedShift = 1, + SpvMemoryAccessNontemporalShift = 2, + SpvMemoryAccessMax = 0x7fffffff, +} SpvMemoryAccessShift; + +typedef enum SpvMemoryAccessMask_ { + SpvMemoryAccessMaskNone = 0, + SpvMemoryAccessVolatileMask = 0x00000001, + SpvMemoryAccessAlignedMask = 0x00000002, + SpvMemoryAccessNontemporalMask = 0x00000004, +} SpvMemoryAccessMask; + +typedef enum SpvScope_ { + SpvScopeCrossDevice = 0, + SpvScopeDevice = 1, + SpvScopeWorkgroup = 2, + SpvScopeSubgroup = 3, + SpvScopeInvocation = 4, + SpvScopeMax = 0x7fffffff, +} SpvScope; + +typedef enum SpvGroupOperation_ { + SpvGroupOperationReduce = 0, + SpvGroupOperationInclusiveScan = 1, + SpvGroupOperationExclusiveScan = 2, + SpvGroupOperationMax = 0x7fffffff, +} SpvGroupOperation; + +typedef enum SpvKernelEnqueueFlags_ { + SpvKernelEnqueueFlagsNoWait = 0, + SpvKernelEnqueueFlagsWaitKernel = 1, + SpvKernelEnqueueFlagsWaitWorkGroup = 2, + SpvKernelEnqueueFlagsMax = 0x7fffffff, +} SpvKernelEnqueueFlags; + +typedef enum SpvKernelProfilingInfoShift_ { + SpvKernelProfilingInfoCmdExecTimeShift = 0, + SpvKernelProfilingInfoMax = 0x7fffffff, +} SpvKernelProfilingInfoShift; + +typedef enum SpvKernelProfilingInfoMask_ { + SpvKernelProfilingInfoMaskNone = 0, + SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001, +} SpvKernelProfilingInfoMask; + +typedef enum SpvCapability_ { + SpvCapabilityMatrix = 0, + SpvCapabilityShader = 1, + SpvCapabilityGeometry = 2, + SpvCapabilityTessellation = 3, + SpvCapabilityAddresses = 4, + SpvCapabilityLinkage = 5, + SpvCapabilityKernel = 6, + SpvCapabilityVector16 = 7, + SpvCapabilityFloat16Buffer = 8, + SpvCapabilityFloat16 = 9, + SpvCapabilityFloat64 = 10, + SpvCapabilityInt64 = 11, + SpvCapabilityInt64Atomics = 12, + SpvCapabilityImageBasic = 13, + SpvCapabilityImageReadWrite = 14, + SpvCapabilityImageMipmap = 15, + SpvCapabilityPipes = 17, + SpvCapabilityGroups = 18, + SpvCapabilityDeviceEnqueue = 19, + SpvCapabilityLiteralSampler = 20, + SpvCapabilityAtomicStorage = 21, + SpvCapabilityInt16 = 22, + SpvCapabilityTessellationPointSize = 23, + SpvCapabilityGeometryPointSize = 24, + SpvCapabilityImageGatherExtended = 25, + SpvCapabilityStorageImageMultisample = 27, + SpvCapabilityUniformBufferArrayDynamicIndexing = 28, + SpvCapabilitySampledImageArrayDynamicIndexing = 29, + SpvCapabilityStorageBufferArrayDynamicIndexing = 30, + SpvCapabilityStorageImageArrayDynamicIndexing = 31, + SpvCapabilityClipDistance = 32, + SpvCapabilityCullDistance = 33, + SpvCapabilityImageCubeArray = 34, + SpvCapabilitySampleRateShading = 35, + SpvCapabilityImageRect = 36, + SpvCapabilitySampledRect = 37, + SpvCapabilityGenericPointer = 38, + SpvCapabilityInt8 = 39, + SpvCapabilityInputAttachment = 40, + SpvCapabilitySparseResidency = 41, + SpvCapabilityMinLod = 42, + SpvCapabilitySampled1D = 43, + SpvCapabilityImage1D = 44, + SpvCapabilitySampledCubeArray = 45, + SpvCapabilitySampledBuffer = 46, + SpvCapabilityImageBuffer = 47, + SpvCapabilityImageMSArray = 48, + SpvCapabilityStorageImageExtendedFormats = 49, + SpvCapabilityImageQuery = 50, + SpvCapabilityDerivativeControl = 51, + SpvCapabilityInterpolationFunction = 52, + SpvCapabilityTransformFeedback = 53, + SpvCapabilityGeometryStreams = 54, + SpvCapabilityStorageImageReadWithoutFormat = 55, + SpvCapabilityStorageImageWriteWithoutFormat = 56, + SpvCapabilityMultiViewport = 57, + SpvCapabilitySubgroupDispatch = 58, + SpvCapabilityNamedBarrier = 59, + SpvCapabilityPipeStorage = 60, + SpvCapabilitySubgroupBallotKHR = 4423, + SpvCapabilityDrawParameters = 4427, + SpvCapabilitySubgroupVoteKHR = 4431, + SpvCapabilityStorageBuffer16BitAccess = 4433, + SpvCapabilityStorageUniformBufferBlock16 = 4433, + SpvCapabilityStorageUniform16 = 4434, + SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434, + SpvCapabilityStoragePushConstant16 = 4435, + SpvCapabilityStorageInputOutput16 = 4436, + SpvCapabilityDeviceGroup = 4437, + SpvCapabilityMultiView = 4439, + SpvCapabilityVariablePointersStorageBuffer = 4441, + SpvCapabilityVariablePointers = 4442, + SpvCapabilityAtomicStorageOps = 4445, + SpvCapabilitySampleMaskPostDepthCoverage = 4447, + SpvCapabilityImageGatherBiasLodAMD = 5009, + SpvCapabilityFragmentMaskAMD = 5010, + SpvCapabilityStencilExportEXT = 5013, + SpvCapabilityImageReadWriteLodAMD = 5015, + SpvCapabilitySampleMaskOverrideCoverageNV = 5249, + SpvCapabilityGeometryShaderPassthroughNV = 5251, + SpvCapabilityShaderViewportIndexLayerEXT = 5254, + SpvCapabilityShaderViewportIndexLayerNV = 5254, + SpvCapabilityShaderViewportMaskNV = 5255, + SpvCapabilityShaderStereoViewNV = 5259, + SpvCapabilityPerViewAttributesNV = 5260, + SpvCapabilitySubgroupShuffleINTEL = 5568, + SpvCapabilitySubgroupBufferBlockIOINTEL = 5569, + SpvCapabilitySubgroupImageBlockIOINTEL = 5570, + SpvCapabilityMax = 0x7fffffff, +} SpvCapability; + +typedef enum SpvOp_ { + SpvOpNop = 0, + SpvOpUndef = 1, + SpvOpSourceContinued = 2, + SpvOpSource = 3, + SpvOpSourceExtension = 4, + SpvOpName = 5, + SpvOpMemberName = 6, + SpvOpString = 7, + SpvOpLine = 8, + SpvOpExtension = 10, + SpvOpExtInstImport = 11, + SpvOpExtInst = 12, + SpvOpMemoryModel = 14, + SpvOpEntryPoint = 15, + SpvOpExecutionMode = 16, + SpvOpCapability = 17, + SpvOpTypeVoid = 19, + SpvOpTypeBool = 20, + SpvOpTypeInt = 21, + SpvOpTypeFloat = 22, + SpvOpTypeVector = 23, + SpvOpTypeMatrix = 24, + SpvOpTypeImage = 25, + SpvOpTypeSampler = 26, + SpvOpTypeSampledImage = 27, + SpvOpTypeArray = 28, + SpvOpTypeRuntimeArray = 29, + SpvOpTypeStruct = 30, + SpvOpTypeOpaque = 31, + SpvOpTypePointer = 32, + SpvOpTypeFunction = 33, + SpvOpTypeEvent = 34, + SpvOpTypeDeviceEvent = 35, + SpvOpTypeReserveId = 36, + SpvOpTypeQueue = 37, + SpvOpTypePipe = 38, + SpvOpTypeForwardPointer = 39, + SpvOpConstantTrue = 41, + SpvOpConstantFalse = 42, + SpvOpConstant = 43, + SpvOpConstantComposite = 44, + SpvOpConstantSampler = 45, + SpvOpConstantNull = 46, + SpvOpSpecConstantTrue = 48, + SpvOpSpecConstantFalse = 49, + SpvOpSpecConstant = 50, + SpvOpSpecConstantComposite = 51, + SpvOpSpecConstantOp = 52, + SpvOpFunction = 54, + SpvOpFunctionParameter = 55, + SpvOpFunctionEnd = 56, + SpvOpFunctionCall = 57, + SpvOpVariable = 59, + SpvOpImageTexelPointer = 60, + SpvOpLoad = 61, + SpvOpStore = 62, + SpvOpCopyMemory = 63, + SpvOpCopyMemorySized = 64, + SpvOpAccessChain = 65, + SpvOpInBoundsAccessChain = 66, + SpvOpPtrAccessChain = 67, + SpvOpArrayLength = 68, + SpvOpGenericPtrMemSemantics = 69, + SpvOpInBoundsPtrAccessChain = 70, + SpvOpDecorate = 71, + SpvOpMemberDecorate = 72, + SpvOpDecorationGroup = 73, + SpvOpGroupDecorate = 74, + SpvOpGroupMemberDecorate = 75, + SpvOpVectorExtractDynamic = 77, + SpvOpVectorInsertDynamic = 78, + SpvOpVectorShuffle = 79, + SpvOpCompositeConstruct = 80, + SpvOpCompositeExtract = 81, + SpvOpCompositeInsert = 82, + SpvOpCopyObject = 83, + SpvOpTranspose = 84, + SpvOpSampledImage = 86, + SpvOpImageSampleImplicitLod = 87, + SpvOpImageSampleExplicitLod = 88, + SpvOpImageSampleDrefImplicitLod = 89, + SpvOpImageSampleDrefExplicitLod = 90, + SpvOpImageSampleProjImplicitLod = 91, + SpvOpImageSampleProjExplicitLod = 92, + SpvOpImageSampleProjDrefImplicitLod = 93, + SpvOpImageSampleProjDrefExplicitLod = 94, + SpvOpImageFetch = 95, + SpvOpImageGather = 96, + SpvOpImageDrefGather = 97, + SpvOpImageRead = 98, + SpvOpImageWrite = 99, + SpvOpImage = 100, + SpvOpImageQueryFormat = 101, + SpvOpImageQueryOrder = 102, + SpvOpImageQuerySizeLod = 103, + SpvOpImageQuerySize = 104, + SpvOpImageQueryLod = 105, + SpvOpImageQueryLevels = 106, + SpvOpImageQuerySamples = 107, + SpvOpConvertFToU = 109, + SpvOpConvertFToS = 110, + SpvOpConvertSToF = 111, + SpvOpConvertUToF = 112, + SpvOpUConvert = 113, + SpvOpSConvert = 114, + SpvOpFConvert = 115, + SpvOpQuantizeToF16 = 116, + SpvOpConvertPtrToU = 117, + SpvOpSatConvertSToU = 118, + SpvOpSatConvertUToS = 119, + SpvOpConvertUToPtr = 120, + SpvOpPtrCastToGeneric = 121, + SpvOpGenericCastToPtr = 122, + SpvOpGenericCastToPtrExplicit = 123, + SpvOpBitcast = 124, + SpvOpSNegate = 126, + SpvOpFNegate = 127, + SpvOpIAdd = 128, + SpvOpFAdd = 129, + SpvOpISub = 130, + SpvOpFSub = 131, + SpvOpIMul = 132, + SpvOpFMul = 133, + SpvOpUDiv = 134, + SpvOpSDiv = 135, + SpvOpFDiv = 136, + SpvOpUMod = 137, + SpvOpSRem = 138, + SpvOpSMod = 139, + SpvOpFRem = 140, + SpvOpFMod = 141, + SpvOpVectorTimesScalar = 142, + SpvOpMatrixTimesScalar = 143, + SpvOpVectorTimesMatrix = 144, + SpvOpMatrixTimesVector = 145, + SpvOpMatrixTimesMatrix = 146, + SpvOpOuterProduct = 147, + SpvOpDot = 148, + SpvOpIAddCarry = 149, + SpvOpISubBorrow = 150, + SpvOpUMulExtended = 151, + SpvOpSMulExtended = 152, + SpvOpAny = 154, + SpvOpAll = 155, + SpvOpIsNan = 156, + SpvOpIsInf = 157, + SpvOpIsFinite = 158, + SpvOpIsNormal = 159, + SpvOpSignBitSet = 160, + SpvOpLessOrGreater = 161, + SpvOpOrdered = 162, + SpvOpUnordered = 163, + SpvOpLogicalEqual = 164, + SpvOpLogicalNotEqual = 165, + SpvOpLogicalOr = 166, + SpvOpLogicalAnd = 167, + SpvOpLogicalNot = 168, + SpvOpSelect = 169, + SpvOpIEqual = 170, + SpvOpINotEqual = 171, + SpvOpUGreaterThan = 172, + SpvOpSGreaterThan = 173, + SpvOpUGreaterThanEqual = 174, + SpvOpSGreaterThanEqual = 175, + SpvOpULessThan = 176, + SpvOpSLessThan = 177, + SpvOpULessThanEqual = 178, + SpvOpSLessThanEqual = 179, + SpvOpFOrdEqual = 180, + SpvOpFUnordEqual = 181, + SpvOpFOrdNotEqual = 182, + SpvOpFUnordNotEqual = 183, + SpvOpFOrdLessThan = 184, + SpvOpFUnordLessThan = 185, + SpvOpFOrdGreaterThan = 186, + SpvOpFUnordGreaterThan = 187, + SpvOpFOrdLessThanEqual = 188, + SpvOpFUnordLessThanEqual = 189, + SpvOpFOrdGreaterThanEqual = 190, + SpvOpFUnordGreaterThanEqual = 191, + SpvOpShiftRightLogical = 194, + SpvOpShiftRightArithmetic = 195, + SpvOpShiftLeftLogical = 196, + SpvOpBitwiseOr = 197, + SpvOpBitwiseXor = 198, + SpvOpBitwiseAnd = 199, + SpvOpNot = 200, + SpvOpBitFieldInsert = 201, + SpvOpBitFieldSExtract = 202, + SpvOpBitFieldUExtract = 203, + SpvOpBitReverse = 204, + SpvOpBitCount = 205, + SpvOpDPdx = 207, + SpvOpDPdy = 208, + SpvOpFwidth = 209, + SpvOpDPdxFine = 210, + SpvOpDPdyFine = 211, + SpvOpFwidthFine = 212, + SpvOpDPdxCoarse = 213, + SpvOpDPdyCoarse = 214, + SpvOpFwidthCoarse = 215, + SpvOpEmitVertex = 218, + SpvOpEndPrimitive = 219, + SpvOpEmitStreamVertex = 220, + SpvOpEndStreamPrimitive = 221, + SpvOpControlBarrier = 224, + SpvOpMemoryBarrier = 225, + SpvOpAtomicLoad = 227, + SpvOpAtomicStore = 228, + SpvOpAtomicExchange = 229, + SpvOpAtomicCompareExchange = 230, + SpvOpAtomicCompareExchangeWeak = 231, + SpvOpAtomicIIncrement = 232, + SpvOpAtomicIDecrement = 233, + SpvOpAtomicIAdd = 234, + SpvOpAtomicISub = 235, + SpvOpAtomicSMin = 236, + SpvOpAtomicUMin = 237, + SpvOpAtomicSMax = 238, + SpvOpAtomicUMax = 239, + SpvOpAtomicAnd = 240, + SpvOpAtomicOr = 241, + SpvOpAtomicXor = 242, + SpvOpPhi = 245, + SpvOpLoopMerge = 246, + SpvOpSelectionMerge = 247, + SpvOpLabel = 248, + SpvOpBranch = 249, + SpvOpBranchConditional = 250, + SpvOpSwitch = 251, + SpvOpKill = 252, + SpvOpReturn = 253, + SpvOpReturnValue = 254, + SpvOpUnreachable = 255, + SpvOpLifetimeStart = 256, + SpvOpLifetimeStop = 257, + SpvOpGroupAsyncCopy = 259, + SpvOpGroupWaitEvents = 260, + SpvOpGroupAll = 261, + SpvOpGroupAny = 262, + SpvOpGroupBroadcast = 263, + SpvOpGroupIAdd = 264, + SpvOpGroupFAdd = 265, + SpvOpGroupFMin = 266, + SpvOpGroupUMin = 267, + SpvOpGroupSMin = 268, + SpvOpGroupFMax = 269, + SpvOpGroupUMax = 270, + SpvOpGroupSMax = 271, + SpvOpReadPipe = 274, + SpvOpWritePipe = 275, + SpvOpReservedReadPipe = 276, + SpvOpReservedWritePipe = 277, + SpvOpReserveReadPipePackets = 278, + SpvOpReserveWritePipePackets = 279, + SpvOpCommitReadPipe = 280, + SpvOpCommitWritePipe = 281, + SpvOpIsValidReserveId = 282, + SpvOpGetNumPipePackets = 283, + SpvOpGetMaxPipePackets = 284, + SpvOpGroupReserveReadPipePackets = 285, + SpvOpGroupReserveWritePipePackets = 286, + SpvOpGroupCommitReadPipe = 287, + SpvOpGroupCommitWritePipe = 288, + SpvOpEnqueueMarker = 291, + SpvOpEnqueueKernel = 292, + SpvOpGetKernelNDrangeSubGroupCount = 293, + SpvOpGetKernelNDrangeMaxSubGroupSize = 294, + SpvOpGetKernelWorkGroupSize = 295, + SpvOpGetKernelPreferredWorkGroupSizeMultiple = 296, + SpvOpRetainEvent = 297, + SpvOpReleaseEvent = 298, + SpvOpCreateUserEvent = 299, + SpvOpIsValidEvent = 300, + SpvOpSetUserEventStatus = 301, + SpvOpCaptureEventProfilingInfo = 302, + SpvOpGetDefaultQueue = 303, + SpvOpBuildNDRange = 304, + SpvOpImageSparseSampleImplicitLod = 305, + SpvOpImageSparseSampleExplicitLod = 306, + SpvOpImageSparseSampleDrefImplicitLod = 307, + SpvOpImageSparseSampleDrefExplicitLod = 308, + SpvOpImageSparseSampleProjImplicitLod = 309, + SpvOpImageSparseSampleProjExplicitLod = 310, + SpvOpImageSparseSampleProjDrefImplicitLod = 311, + SpvOpImageSparseSampleProjDrefExplicitLod = 312, + SpvOpImageSparseFetch = 313, + SpvOpImageSparseGather = 314, + SpvOpImageSparseDrefGather = 315, + SpvOpImageSparseTexelsResident = 316, + SpvOpNoLine = 317, + SpvOpAtomicFlagTestAndSet = 318, + SpvOpAtomicFlagClear = 319, + SpvOpImageSparseRead = 320, + SpvOpSizeOf = 321, + SpvOpTypePipeStorage = 322, + SpvOpConstantPipeStorage = 323, + SpvOpCreatePipeFromPipeStorage = 324, + SpvOpGetKernelLocalSizeForSubgroupCount = 325, + SpvOpGetKernelMaxNumSubgroups = 326, + SpvOpTypeNamedBarrier = 327, + SpvOpNamedBarrierInitialize = 328, + SpvOpMemoryNamedBarrier = 329, + SpvOpModuleProcessed = 330, + SpvOpDecorateId = 332, + SpvOpSubgroupBallotKHR = 4421, + SpvOpSubgroupFirstInvocationKHR = 4422, + SpvOpSubgroupAllKHR = 4428, + SpvOpSubgroupAnyKHR = 4429, + SpvOpSubgroupAllEqualKHR = 4430, + SpvOpSubgroupReadInvocationKHR = 4432, + SpvOpGroupIAddNonUniformAMD = 5000, + SpvOpGroupFAddNonUniformAMD = 5001, + SpvOpGroupFMinNonUniformAMD = 5002, + SpvOpGroupUMinNonUniformAMD = 5003, + SpvOpGroupSMinNonUniformAMD = 5004, + SpvOpGroupFMaxNonUniformAMD = 5005, + SpvOpGroupUMaxNonUniformAMD = 5006, + SpvOpGroupSMaxNonUniformAMD = 5007, + SpvOpFragmentMaskFetchAMD = 5011, + SpvOpFragmentFetchAMD = 5012, + SpvOpSubgroupShuffleINTEL = 5571, + SpvOpSubgroupShuffleDownINTEL = 5572, + SpvOpSubgroupShuffleUpINTEL = 5573, + SpvOpSubgroupShuffleXorINTEL = 5574, + SpvOpSubgroupBlockReadINTEL = 5575, + SpvOpSubgroupBlockWriteINTEL = 5576, + SpvOpSubgroupImageBlockReadINTEL = 5577, + SpvOpSubgroupImageBlockWriteINTEL = 5578, + SpvOpDecorateStringGOOGLE = 5632, + SpvOpMemberDecorateStringGOOGLE = 5633, + SpvOpMax = 0x7fffffff, +} SpvOp; + +#endif // #ifndef spirv_H + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.hpp new file mode 100644 index 00000000000..c26ac1f26c6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.hpp @@ -0,0 +1,1024 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10100 +#define SPV_REVISION 8 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010100; +static const unsigned int Revision = 8; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum SourceLanguage { + SourceLanguageUnknown = 0, + SourceLanguageESSL = 1, + SourceLanguageGLSL = 2, + SourceLanguageOpenCL_C = 3, + SourceLanguageOpenCL_CPP = 4, + SourceLanguageHLSL = 5, + SourceLanguageMax = 0x7fffffff, +}; + +enum ExecutionModel { + ExecutionModelVertex = 0, + ExecutionModelTessellationControl = 1, + ExecutionModelTessellationEvaluation = 2, + ExecutionModelGeometry = 3, + ExecutionModelFragment = 4, + ExecutionModelGLCompute = 5, + ExecutionModelKernel = 6, + ExecutionModelMax = 0x7fffffff, +}; + +enum AddressingModel { + AddressingModelLogical = 0, + AddressingModelPhysical32 = 1, + AddressingModelPhysical64 = 2, + AddressingModelMax = 0x7fffffff, +}; + +enum MemoryModel { + MemoryModelSimple = 0, + MemoryModelGLSL450 = 1, + MemoryModelOpenCL = 2, + MemoryModelMax = 0x7fffffff, +}; + +enum ExecutionMode { + ExecutionModeInvocations = 0, + ExecutionModeSpacingEqual = 1, + ExecutionModeSpacingFractionalEven = 2, + ExecutionModeSpacingFractionalOdd = 3, + ExecutionModeVertexOrderCw = 4, + ExecutionModeVertexOrderCcw = 5, + ExecutionModePixelCenterInteger = 6, + ExecutionModeOriginUpperLeft = 7, + ExecutionModeOriginLowerLeft = 8, + ExecutionModeEarlyFragmentTests = 9, + ExecutionModePointMode = 10, + ExecutionModeXfb = 11, + ExecutionModeDepthReplacing = 12, + ExecutionModeDepthGreater = 14, + ExecutionModeDepthLess = 15, + ExecutionModeDepthUnchanged = 16, + ExecutionModeLocalSize = 17, + ExecutionModeLocalSizeHint = 18, + ExecutionModeInputPoints = 19, + ExecutionModeInputLines = 20, + ExecutionModeInputLinesAdjacency = 21, + ExecutionModeTriangles = 22, + ExecutionModeInputTrianglesAdjacency = 23, + ExecutionModeQuads = 24, + ExecutionModeIsolines = 25, + ExecutionModeOutputVertices = 26, + ExecutionModeOutputPoints = 27, + ExecutionModeOutputLineStrip = 28, + ExecutionModeOutputTriangleStrip = 29, + ExecutionModeVecTypeHint = 30, + ExecutionModeContractionOff = 31, + ExecutionModeInitializer = 33, + ExecutionModeFinalizer = 34, + ExecutionModeSubgroupSize = 35, + ExecutionModeSubgroupsPerWorkgroup = 36, + ExecutionModePostDepthCoverage = 4446, + ExecutionModeStencilRefReplacingEXT = 5027, + ExecutionModeMax = 0x7fffffff, +}; + +enum StorageClass { + StorageClassUniformConstant = 0, + StorageClassInput = 1, + StorageClassUniform = 2, + StorageClassOutput = 3, + StorageClassWorkgroup = 4, + StorageClassCrossWorkgroup = 5, + StorageClassPrivate = 6, + StorageClassFunction = 7, + StorageClassGeneric = 8, + StorageClassPushConstant = 9, + StorageClassAtomicCounter = 10, + StorageClassImage = 11, + StorageClassStorageBuffer = 12, + StorageClassMax = 0x7fffffff, +}; + +enum Dim { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + DimCube = 3, + DimRect = 4, + DimBuffer = 5, + DimSubpassData = 6, + DimMax = 0x7fffffff, +}; + +enum SamplerAddressingMode { + SamplerAddressingModeNone = 0, + SamplerAddressingModeClampToEdge = 1, + SamplerAddressingModeClamp = 2, + SamplerAddressingModeRepeat = 3, + SamplerAddressingModeRepeatMirrored = 4, + SamplerAddressingModeMax = 0x7fffffff, +}; + +enum SamplerFilterMode { + SamplerFilterModeNearest = 0, + SamplerFilterModeLinear = 1, + SamplerFilterModeMax = 0x7fffffff, +}; + +enum ImageFormat { + ImageFormatUnknown = 0, + ImageFormatRgba32f = 1, + ImageFormatRgba16f = 2, + ImageFormatR32f = 3, + ImageFormatRgba8 = 4, + ImageFormatRgba8Snorm = 5, + ImageFormatRg32f = 6, + ImageFormatRg16f = 7, + ImageFormatR11fG11fB10f = 8, + ImageFormatR16f = 9, + ImageFormatRgba16 = 10, + ImageFormatRgb10A2 = 11, + ImageFormatRg16 = 12, + ImageFormatRg8 = 13, + ImageFormatR16 = 14, + ImageFormatR8 = 15, + ImageFormatRgba16Snorm = 16, + ImageFormatRg16Snorm = 17, + ImageFormatRg8Snorm = 18, + ImageFormatR16Snorm = 19, + ImageFormatR8Snorm = 20, + ImageFormatRgba32i = 21, + ImageFormatRgba16i = 22, + ImageFormatRgba8i = 23, + ImageFormatR32i = 24, + ImageFormatRg32i = 25, + ImageFormatRg16i = 26, + ImageFormatRg8i = 27, + ImageFormatR16i = 28, + ImageFormatR8i = 29, + ImageFormatRgba32ui = 30, + ImageFormatRgba16ui = 31, + ImageFormatRgba8ui = 32, + ImageFormatR32ui = 33, + ImageFormatRgb10a2ui = 34, + ImageFormatRg32ui = 35, + ImageFormatRg16ui = 36, + ImageFormatRg8ui = 37, + ImageFormatR16ui = 38, + ImageFormatR8ui = 39, + ImageFormatMax = 0x7fffffff, +}; + +enum ImageChannelOrder { + ImageChannelOrderR = 0, + ImageChannelOrderA = 1, + ImageChannelOrderRG = 2, + ImageChannelOrderRA = 3, + ImageChannelOrderRGB = 4, + ImageChannelOrderRGBA = 5, + ImageChannelOrderBGRA = 6, + ImageChannelOrderARGB = 7, + ImageChannelOrderIntensity = 8, + ImageChannelOrderLuminance = 9, + ImageChannelOrderRx = 10, + ImageChannelOrderRGx = 11, + ImageChannelOrderRGBx = 12, + ImageChannelOrderDepth = 13, + ImageChannelOrderDepthStencil = 14, + ImageChannelOrdersRGB = 15, + ImageChannelOrdersRGBx = 16, + ImageChannelOrdersRGBA = 17, + ImageChannelOrdersBGRA = 18, + ImageChannelOrderABGR = 19, + ImageChannelOrderMax = 0x7fffffff, +}; + +enum ImageChannelDataType { + ImageChannelDataTypeSnormInt8 = 0, + ImageChannelDataTypeSnormInt16 = 1, + ImageChannelDataTypeUnormInt8 = 2, + ImageChannelDataTypeUnormInt16 = 3, + ImageChannelDataTypeUnormShort565 = 4, + ImageChannelDataTypeUnormShort555 = 5, + ImageChannelDataTypeUnormInt101010 = 6, + ImageChannelDataTypeSignedInt8 = 7, + ImageChannelDataTypeSignedInt16 = 8, + ImageChannelDataTypeSignedInt32 = 9, + ImageChannelDataTypeUnsignedInt8 = 10, + ImageChannelDataTypeUnsignedInt16 = 11, + ImageChannelDataTypeUnsignedInt32 = 12, + ImageChannelDataTypeHalfFloat = 13, + ImageChannelDataTypeFloat = 14, + ImageChannelDataTypeUnormInt24 = 15, + ImageChannelDataTypeUnormInt101010_2 = 16, + ImageChannelDataTypeMax = 0x7fffffff, +}; + +enum ImageOperandsShift { + ImageOperandsBiasShift = 0, + ImageOperandsLodShift = 1, + ImageOperandsGradShift = 2, + ImageOperandsConstOffsetShift = 3, + ImageOperandsOffsetShift = 4, + ImageOperandsConstOffsetsShift = 5, + ImageOperandsSampleShift = 6, + ImageOperandsMinLodShift = 7, + ImageOperandsMax = 0x7fffffff, +}; + +enum ImageOperandsMask { + ImageOperandsMaskNone = 0, + ImageOperandsBiasMask = 0x00000001, + ImageOperandsLodMask = 0x00000002, + ImageOperandsGradMask = 0x00000004, + ImageOperandsConstOffsetMask = 0x00000008, + ImageOperandsOffsetMask = 0x00000010, + ImageOperandsConstOffsetsMask = 0x00000020, + ImageOperandsSampleMask = 0x00000040, + ImageOperandsMinLodMask = 0x00000080, +}; + +enum FPFastMathModeShift { + FPFastMathModeNotNaNShift = 0, + FPFastMathModeNotInfShift = 1, + FPFastMathModeNSZShift = 2, + FPFastMathModeAllowRecipShift = 3, + FPFastMathModeFastShift = 4, + FPFastMathModeMax = 0x7fffffff, +}; + +enum FPFastMathModeMask { + FPFastMathModeMaskNone = 0, + FPFastMathModeNotNaNMask = 0x00000001, + FPFastMathModeNotInfMask = 0x00000002, + FPFastMathModeNSZMask = 0x00000004, + FPFastMathModeAllowRecipMask = 0x00000008, + FPFastMathModeFastMask = 0x00000010, +}; + +enum FPRoundingMode { + FPRoundingModeRTE = 0, + FPRoundingModeRTZ = 1, + FPRoundingModeRTP = 2, + FPRoundingModeRTN = 3, + FPRoundingModeMax = 0x7fffffff, +}; + +enum LinkageType { + LinkageTypeExport = 0, + LinkageTypeImport = 1, + LinkageTypeMax = 0x7fffffff, +}; + +enum AccessQualifier { + AccessQualifierReadOnly = 0, + AccessQualifierWriteOnly = 1, + AccessQualifierReadWrite = 2, + AccessQualifierMax = 0x7fffffff, +}; + +enum FunctionParameterAttribute { + FunctionParameterAttributeZext = 0, + FunctionParameterAttributeSext = 1, + FunctionParameterAttributeByVal = 2, + FunctionParameterAttributeSret = 3, + FunctionParameterAttributeNoAlias = 4, + FunctionParameterAttributeNoCapture = 5, + FunctionParameterAttributeNoWrite = 6, + FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeMax = 0x7fffffff, +}; + +enum Decoration { + DecorationRelaxedPrecision = 0, + DecorationSpecId = 1, + DecorationBlock = 2, + DecorationBufferBlock = 3, + DecorationRowMajor = 4, + DecorationColMajor = 5, + DecorationArrayStride = 6, + DecorationMatrixStride = 7, + DecorationGLSLShared = 8, + DecorationGLSLPacked = 9, + DecorationCPacked = 10, + DecorationBuiltIn = 11, + DecorationNoPerspective = 13, + DecorationFlat = 14, + DecorationPatch = 15, + DecorationCentroid = 16, + DecorationSample = 17, + DecorationInvariant = 18, + DecorationRestrict = 19, + DecorationAliased = 20, + DecorationVolatile = 21, + DecorationConstant = 22, + DecorationCoherent = 23, + DecorationNonWritable = 24, + DecorationNonReadable = 25, + DecorationUniform = 26, + DecorationSaturatedConversion = 28, + DecorationStream = 29, + DecorationLocation = 30, + DecorationComponent = 31, + DecorationIndex = 32, + DecorationBinding = 33, + DecorationDescriptorSet = 34, + DecorationOffset = 35, + DecorationXfbBuffer = 36, + DecorationXfbStride = 37, + DecorationFuncParamAttr = 38, + DecorationFPRoundingMode = 39, + DecorationFPFastMathMode = 40, + DecorationLinkageAttributes = 41, + DecorationNoContraction = 42, + DecorationInputAttachmentIndex = 43, + DecorationAlignment = 44, + DecorationMaxByteOffset = 45, + DecorationExplicitInterpAMD = 4999, + DecorationOverrideCoverageNV = 5248, + DecorationPassthroughNV = 5250, + DecorationViewportRelativeNV = 5252, + DecorationSecondaryViewportRelativeNV = 5256, + DecorationHlslCounterBufferGOOGLE = 5634, + DecorationHlslSemanticGOOGLE = 5635, + DecorationMax = 0x7fffffff, +}; + +enum BuiltIn { + BuiltInPosition = 0, + BuiltInPointSize = 1, + BuiltInClipDistance = 3, + BuiltInCullDistance = 4, + BuiltInVertexId = 5, + BuiltInInstanceId = 6, + BuiltInPrimitiveId = 7, + BuiltInInvocationId = 8, + BuiltInLayer = 9, + BuiltInViewportIndex = 10, + BuiltInTessLevelOuter = 11, + BuiltInTessLevelInner = 12, + BuiltInTessCoord = 13, + BuiltInPatchVertices = 14, + BuiltInFragCoord = 15, + BuiltInPointCoord = 16, + BuiltInFrontFacing = 17, + BuiltInSampleId = 18, + BuiltInSamplePosition = 19, + BuiltInSampleMask = 20, + BuiltInFragDepth = 22, + BuiltInHelperInvocation = 23, + BuiltInNumWorkgroups = 24, + BuiltInWorkgroupSize = 25, + BuiltInWorkgroupId = 26, + BuiltInLocalInvocationId = 27, + BuiltInGlobalInvocationId = 28, + BuiltInLocalInvocationIndex = 29, + BuiltInWorkDim = 30, + BuiltInGlobalSize = 31, + BuiltInEnqueuedWorkgroupSize = 32, + BuiltInGlobalOffset = 33, + BuiltInGlobalLinearId = 34, + BuiltInSubgroupSize = 36, + BuiltInSubgroupMaxSize = 37, + BuiltInNumSubgroups = 38, + BuiltInNumEnqueuedSubgroups = 39, + BuiltInSubgroupId = 40, + BuiltInSubgroupLocalInvocationId = 41, + BuiltInVertexIndex = 42, + BuiltInInstanceIndex = 43, + BuiltInSubgroupEqMaskKHR = 4416, + BuiltInSubgroupGeMaskKHR = 4417, + BuiltInSubgroupGtMaskKHR = 4418, + BuiltInSubgroupLeMaskKHR = 4419, + BuiltInSubgroupLtMaskKHR = 4420, + BuiltInBaseVertex = 4424, + BuiltInBaseInstance = 4425, + BuiltInDrawIndex = 4426, + BuiltInDeviceIndex = 4438, + BuiltInViewIndex = 4440, + BuiltInBaryCoordNoPerspAMD = 4992, + BuiltInBaryCoordNoPerspCentroidAMD = 4993, + BuiltInBaryCoordNoPerspSampleAMD = 4994, + BuiltInBaryCoordSmoothAMD = 4995, + BuiltInBaryCoordSmoothCentroidAMD = 4996, + BuiltInBaryCoordSmoothSampleAMD = 4997, + BuiltInBaryCoordPullModelAMD = 4998, + BuiltInFragStencilRefEXT = 5014, + BuiltInViewportMaskNV = 5253, + BuiltInSecondaryPositionNV = 5257, + BuiltInSecondaryViewportMaskNV = 5258, + BuiltInPositionPerViewNV = 5261, + BuiltInViewportMaskPerViewNV = 5262, + BuiltInMax = 0x7fffffff, +}; + +enum SelectionControlShift { + SelectionControlFlattenShift = 0, + SelectionControlDontFlattenShift = 1, + SelectionControlMax = 0x7fffffff, +}; + +enum SelectionControlMask { + SelectionControlMaskNone = 0, + SelectionControlFlattenMask = 0x00000001, + SelectionControlDontFlattenMask = 0x00000002, +}; + +enum LoopControlShift { + LoopControlUnrollShift = 0, + LoopControlDontUnrollShift = 1, + LoopControlDependencyInfiniteShift = 2, + LoopControlDependencyLengthShift = 3, + LoopControlMax = 0x7fffffff, +}; + +enum LoopControlMask { + LoopControlMaskNone = 0, + LoopControlUnrollMask = 0x00000001, + LoopControlDontUnrollMask = 0x00000002, + LoopControlDependencyInfiniteMask = 0x00000004, + LoopControlDependencyLengthMask = 0x00000008, +}; + +enum FunctionControlShift { + FunctionControlInlineShift = 0, + FunctionControlDontInlineShift = 1, + FunctionControlPureShift = 2, + FunctionControlConstShift = 3, + FunctionControlMax = 0x7fffffff, +}; + +enum FunctionControlMask { + FunctionControlMaskNone = 0, + FunctionControlInlineMask = 0x00000001, + FunctionControlDontInlineMask = 0x00000002, + FunctionControlPureMask = 0x00000004, + FunctionControlConstMask = 0x00000008, +}; + +enum MemorySemanticsShift { + MemorySemanticsAcquireShift = 1, + MemorySemanticsReleaseShift = 2, + MemorySemanticsAcquireReleaseShift = 3, + MemorySemanticsSequentiallyConsistentShift = 4, + MemorySemanticsUniformMemoryShift = 6, + MemorySemanticsSubgroupMemoryShift = 7, + MemorySemanticsWorkgroupMemoryShift = 8, + MemorySemanticsCrossWorkgroupMemoryShift = 9, + MemorySemanticsAtomicCounterMemoryShift = 10, + MemorySemanticsImageMemoryShift = 11, + MemorySemanticsMax = 0x7fffffff, +}; + +enum MemorySemanticsMask { + MemorySemanticsMaskNone = 0, + MemorySemanticsAcquireMask = 0x00000002, + MemorySemanticsReleaseMask = 0x00000004, + MemorySemanticsAcquireReleaseMask = 0x00000008, + MemorySemanticsSequentiallyConsistentMask = 0x00000010, + MemorySemanticsUniformMemoryMask = 0x00000040, + MemorySemanticsSubgroupMemoryMask = 0x00000080, + MemorySemanticsWorkgroupMemoryMask = 0x00000100, + MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + MemorySemanticsAtomicCounterMemoryMask = 0x00000400, + MemorySemanticsImageMemoryMask = 0x00000800, +}; + +enum MemoryAccessShift { + MemoryAccessVolatileShift = 0, + MemoryAccessAlignedShift = 1, + MemoryAccessNontemporalShift = 2, + MemoryAccessMax = 0x7fffffff, +}; + +enum MemoryAccessMask { + MemoryAccessMaskNone = 0, + MemoryAccessVolatileMask = 0x00000001, + MemoryAccessAlignedMask = 0x00000002, + MemoryAccessNontemporalMask = 0x00000004, +}; + +enum Scope { + ScopeCrossDevice = 0, + ScopeDevice = 1, + ScopeWorkgroup = 2, + ScopeSubgroup = 3, + ScopeInvocation = 4, + ScopeMax = 0x7fffffff, +}; + +enum GroupOperation { + GroupOperationReduce = 0, + GroupOperationInclusiveScan = 1, + GroupOperationExclusiveScan = 2, + GroupOperationMax = 0x7fffffff, +}; + +enum KernelEnqueueFlags { + KernelEnqueueFlagsNoWait = 0, + KernelEnqueueFlagsWaitKernel = 1, + KernelEnqueueFlagsWaitWorkGroup = 2, + KernelEnqueueFlagsMax = 0x7fffffff, +}; + +enum KernelProfilingInfoShift { + KernelProfilingInfoCmdExecTimeShift = 0, + KernelProfilingInfoMax = 0x7fffffff, +}; + +enum KernelProfilingInfoMask { + KernelProfilingInfoMaskNone = 0, + KernelProfilingInfoCmdExecTimeMask = 0x00000001, +}; + +enum Capability { + CapabilityMatrix = 0, + CapabilityShader = 1, + CapabilityGeometry = 2, + CapabilityTessellation = 3, + CapabilityAddresses = 4, + CapabilityLinkage = 5, + CapabilityKernel = 6, + CapabilityVector16 = 7, + CapabilityFloat16Buffer = 8, + CapabilityFloat16 = 9, + CapabilityFloat64 = 10, + CapabilityInt64 = 11, + CapabilityInt64Atomics = 12, + CapabilityImageBasic = 13, + CapabilityImageReadWrite = 14, + CapabilityImageMipmap = 15, + CapabilityPipes = 17, + CapabilityGroups = 18, + CapabilityDeviceEnqueue = 19, + CapabilityLiteralSampler = 20, + CapabilityAtomicStorage = 21, + CapabilityInt16 = 22, + CapabilityTessellationPointSize = 23, + CapabilityGeometryPointSize = 24, + CapabilityImageGatherExtended = 25, + CapabilityStorageImageMultisample = 27, + CapabilityUniformBufferArrayDynamicIndexing = 28, + CapabilitySampledImageArrayDynamicIndexing = 29, + CapabilityStorageBufferArrayDynamicIndexing = 30, + CapabilityStorageImageArrayDynamicIndexing = 31, + CapabilityClipDistance = 32, + CapabilityCullDistance = 33, + CapabilityImageCubeArray = 34, + CapabilitySampleRateShading = 35, + CapabilityImageRect = 36, + CapabilitySampledRect = 37, + CapabilityGenericPointer = 38, + CapabilityInt8 = 39, + CapabilityInputAttachment = 40, + CapabilitySparseResidency = 41, + CapabilityMinLod = 42, + CapabilitySampled1D = 43, + CapabilityImage1D = 44, + CapabilitySampledCubeArray = 45, + CapabilitySampledBuffer = 46, + CapabilityImageBuffer = 47, + CapabilityImageMSArray = 48, + CapabilityStorageImageExtendedFormats = 49, + CapabilityImageQuery = 50, + CapabilityDerivativeControl = 51, + CapabilityInterpolationFunction = 52, + CapabilityTransformFeedback = 53, + CapabilityGeometryStreams = 54, + CapabilityStorageImageReadWithoutFormat = 55, + CapabilityStorageImageWriteWithoutFormat = 56, + CapabilityMultiViewport = 57, + CapabilitySubgroupDispatch = 58, + CapabilityNamedBarrier = 59, + CapabilityPipeStorage = 60, + CapabilitySubgroupBallotKHR = 4423, + CapabilityDrawParameters = 4427, + CapabilitySubgroupVoteKHR = 4431, + CapabilityStorageBuffer16BitAccess = 4433, + CapabilityStorageUniformBufferBlock16 = 4433, + CapabilityStorageUniform16 = 4434, + CapabilityUniformAndStorageBuffer16BitAccess = 4434, + CapabilityStoragePushConstant16 = 4435, + CapabilityStorageInputOutput16 = 4436, + CapabilityDeviceGroup = 4437, + CapabilityMultiView = 4439, + CapabilityVariablePointersStorageBuffer = 4441, + CapabilityVariablePointers = 4442, + CapabilityAtomicStorageOps = 4445, + CapabilitySampleMaskPostDepthCoverage = 4447, + CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, + CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, + CapabilitySampleMaskOverrideCoverageNV = 5249, + CapabilityGeometryShaderPassthroughNV = 5251, + CapabilityShaderViewportIndexLayerEXT = 5254, + CapabilityShaderViewportIndexLayerNV = 5254, + CapabilityShaderViewportMaskNV = 5255, + CapabilityShaderStereoViewNV = 5259, + CapabilityPerViewAttributesNV = 5260, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, + CapabilityMax = 0x7fffffff, +}; + +enum Op { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + OpMax = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.hpp11 b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.hpp11 new file mode 100644 index 00000000000..992d43b5f54 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.hpp11 @@ -0,0 +1,1024 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10100 +#define SPV_REVISION 8 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010100; +static const unsigned int Revision = 8; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.json new file mode 100644 index 00000000000..4c18e0192a3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.json @@ -0,0 +1,1040 @@ +{ + "spv": + { + "meta": + { + "Comment": + [ + [ + "Copyright (c) 2014-2018 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + [ + "This header is automatically generated by the same tool that creates", + "the Binary Section of the SPIR-V specification." + ], + [ + "Enumeration tokens for SPIR-V, in various styles:", + " C, C++, C++11, JSON, Lua, Python", + "", + "- C will have tokens with a \"Spv\" prefix, e.g.: SpvSourceLanguageGLSL", + "- C++ will have tokens in the \"spv\" name space, e.g.: spv::SourceLanguageGLSL", + "- C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL", + "- Lua will use tables, e.g.: spv.SourceLanguage.GLSL", + "- Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']", + "", + "Some tokens act like mask values, which can be OR'd together,", + "while others are mutually exclusive. The mask-like ones have", + "\"Mask\" in their name, and a parallel enum that has the shift", + "amount (1 << x) for each corresponding enumerant." + ] + ], + "MagicNumber": 119734787, + "Version": 65792, + "Revision": 8, + "OpCodeMask": 65535, + "WordCountShift": 16 + }, + "enum": + [ + { + "Name": "SourceLanguage", + "Type": "Value", + "Values": + { + "Unknown": 0, + "ESSL": 1, + "GLSL": 2, + "OpenCL_C": 3, + "OpenCL_CPP": 4, + "HLSL": 5 + } + }, + { + "Name": "ExecutionModel", + "Type": "Value", + "Values": + { + "Vertex": 0, + "TessellationControl": 1, + "TessellationEvaluation": 2, + "Geometry": 3, + "Fragment": 4, + "GLCompute": 5, + "Kernel": 6 + } + }, + { + "Name": "AddressingModel", + "Type": "Value", + "Values": + { + "Logical": 0, + "Physical32": 1, + "Physical64": 2 + } + }, + { + "Name": "MemoryModel", + "Type": "Value", + "Values": + { + "Simple": 0, + "GLSL450": 1, + "OpenCL": 2 + } + }, + { + "Name": "ExecutionMode", + "Type": "Value", + "Values": + { + "Invocations": 0, + "SpacingEqual": 1, + "SpacingFractionalEven": 2, + "SpacingFractionalOdd": 3, + "VertexOrderCw": 4, + "VertexOrderCcw": 5, + "PixelCenterInteger": 6, + "OriginUpperLeft": 7, + "OriginLowerLeft": 8, + "EarlyFragmentTests": 9, + "PointMode": 10, + "Xfb": 11, + "DepthReplacing": 12, + "DepthGreater": 14, + "DepthLess": 15, + "DepthUnchanged": 16, + "LocalSize": 17, + "LocalSizeHint": 18, + "InputPoints": 19, + "InputLines": 20, + "InputLinesAdjacency": 21, + "Triangles": 22, + "InputTrianglesAdjacency": 23, + "Quads": 24, + "Isolines": 25, + "OutputVertices": 26, + "OutputPoints": 27, + "OutputLineStrip": 28, + "OutputTriangleStrip": 29, + "VecTypeHint": 30, + "ContractionOff": 31, + "Initializer": 33, + "Finalizer": 34, + "SubgroupSize": 35, + "SubgroupsPerWorkgroup": 36, + "PostDepthCoverage": 4446, + "StencilRefReplacingEXT": 5027 + } + }, + { + "Name": "StorageClass", + "Type": "Value", + "Values": + { + "UniformConstant": 0, + "Input": 1, + "Uniform": 2, + "Output": 3, + "Workgroup": 4, + "CrossWorkgroup": 5, + "Private": 6, + "Function": 7, + "Generic": 8, + "PushConstant": 9, + "AtomicCounter": 10, + "Image": 11, + "StorageBuffer": 12 + } + }, + { + "Name": "Dim", + "Type": "Value", + "Values": + { + "Dim1D": 0, + "Dim2D": 1, + "Dim3D": 2, + "Cube": 3, + "Rect": 4, + "Buffer": 5, + "SubpassData": 6 + } + }, + { + "Name": "SamplerAddressingMode", + "Type": "Value", + "Values": + { + "None": 0, + "ClampToEdge": 1, + "Clamp": 2, + "Repeat": 3, + "RepeatMirrored": 4 + } + }, + { + "Name": "SamplerFilterMode", + "Type": "Value", + "Values": + { + "Nearest": 0, + "Linear": 1 + } + }, + { + "Name": "ImageFormat", + "Type": "Value", + "Values": + { + "Unknown": 0, + "Rgba32f": 1, + "Rgba16f": 2, + "R32f": 3, + "Rgba8": 4, + "Rgba8Snorm": 5, + "Rg32f": 6, + "Rg16f": 7, + "R11fG11fB10f": 8, + "R16f": 9, + "Rgba16": 10, + "Rgb10A2": 11, + "Rg16": 12, + "Rg8": 13, + "R16": 14, + "R8": 15, + "Rgba16Snorm": 16, + "Rg16Snorm": 17, + "Rg8Snorm": 18, + "R16Snorm": 19, + "R8Snorm": 20, + "Rgba32i": 21, + "Rgba16i": 22, + "Rgba8i": 23, + "R32i": 24, + "Rg32i": 25, + "Rg16i": 26, + "Rg8i": 27, + "R16i": 28, + "R8i": 29, + "Rgba32ui": 30, + "Rgba16ui": 31, + "Rgba8ui": 32, + "R32ui": 33, + "Rgb10a2ui": 34, + "Rg32ui": 35, + "Rg16ui": 36, + "Rg8ui": 37, + "R16ui": 38, + "R8ui": 39 + } + }, + { + "Name": "ImageChannelOrder", + "Type": "Value", + "Values": + { + "R": 0, + "A": 1, + "RG": 2, + "RA": 3, + "RGB": 4, + "RGBA": 5, + "BGRA": 6, + "ARGB": 7, + "Intensity": 8, + "Luminance": 9, + "Rx": 10, + "RGx": 11, + "RGBx": 12, + "Depth": 13, + "DepthStencil": 14, + "sRGB": 15, + "sRGBx": 16, + "sRGBA": 17, + "sBGRA": 18, + "ABGR": 19 + } + }, + { + "Name": "ImageChannelDataType", + "Type": "Value", + "Values": + { + "SnormInt8": 0, + "SnormInt16": 1, + "UnormInt8": 2, + "UnormInt16": 3, + "UnormShort565": 4, + "UnormShort555": 5, + "UnormInt101010": 6, + "SignedInt8": 7, + "SignedInt16": 8, + "SignedInt32": 9, + "UnsignedInt8": 10, + "UnsignedInt16": 11, + "UnsignedInt32": 12, + "HalfFloat": 13, + "Float": 14, + "UnormInt24": 15, + "UnormInt101010_2": 16 + } + }, + { + "Name": "ImageOperands", + "Type": "Bit", + "Values": + { + "Bias": 0, + "Lod": 1, + "Grad": 2, + "ConstOffset": 3, + "Offset": 4, + "ConstOffsets": 5, + "Sample": 6, + "MinLod": 7 + } + }, + { + "Name": "FPFastMathMode", + "Type": "Bit", + "Values": + { + "NotNaN": 0, + "NotInf": 1, + "NSZ": 2, + "AllowRecip": 3, + "Fast": 4 + } + }, + { + "Name": "FPRoundingMode", + "Type": "Value", + "Values": + { + "RTE": 0, + "RTZ": 1, + "RTP": 2, + "RTN": 3 + } + }, + { + "Name": "LinkageType", + "Type": "Value", + "Values": + { + "Export": 0, + "Import": 1 + } + }, + { + "Name": "AccessQualifier", + "Type": "Value", + "Values": + { + "ReadOnly": 0, + "WriteOnly": 1, + "ReadWrite": 2 + } + }, + { + "Name": "FunctionParameterAttribute", + "Type": "Value", + "Values": + { + "Zext": 0, + "Sext": 1, + "ByVal": 2, + "Sret": 3, + "NoAlias": 4, + "NoCapture": 5, + "NoWrite": 6, + "NoReadWrite": 7 + } + }, + { + "Name": "Decoration", + "Type": "Value", + "Values": + { + "RelaxedPrecision": 0, + "SpecId": 1, + "Block": 2, + "BufferBlock": 3, + "RowMajor": 4, + "ColMajor": 5, + "ArrayStride": 6, + "MatrixStride": 7, + "GLSLShared": 8, + "GLSLPacked": 9, + "CPacked": 10, + "BuiltIn": 11, + "NoPerspective": 13, + "Flat": 14, + "Patch": 15, + "Centroid": 16, + "Sample": 17, + "Invariant": 18, + "Restrict": 19, + "Aliased": 20, + "Volatile": 21, + "Constant": 22, + "Coherent": 23, + "NonWritable": 24, + "NonReadable": 25, + "Uniform": 26, + "SaturatedConversion": 28, + "Stream": 29, + "Location": 30, + "Component": 31, + "Index": 32, + "Binding": 33, + "DescriptorSet": 34, + "Offset": 35, + "XfbBuffer": 36, + "XfbStride": 37, + "FuncParamAttr": 38, + "FPRoundingMode": 39, + "FPFastMathMode": 40, + "LinkageAttributes": 41, + "NoContraction": 42, + "InputAttachmentIndex": 43, + "Alignment": 44, + "MaxByteOffset": 45, + "ExplicitInterpAMD": 4999, + "OverrideCoverageNV": 5248, + "PassthroughNV": 5250, + "ViewportRelativeNV": 5252, + "SecondaryViewportRelativeNV": 5256, + "HlslCounterBufferGOOGLE": 5634, + "HlslSemanticGOOGLE": 5635 + } + }, + { + "Name": "BuiltIn", + "Type": "Value", + "Values": + { + "Position": 0, + "PointSize": 1, + "ClipDistance": 3, + "CullDistance": 4, + "VertexId": 5, + "InstanceId": 6, + "PrimitiveId": 7, + "InvocationId": 8, + "Layer": 9, + "ViewportIndex": 10, + "TessLevelOuter": 11, + "TessLevelInner": 12, + "TessCoord": 13, + "PatchVertices": 14, + "FragCoord": 15, + "PointCoord": 16, + "FrontFacing": 17, + "SampleId": 18, + "SamplePosition": 19, + "SampleMask": 20, + "FragDepth": 22, + "HelperInvocation": 23, + "NumWorkgroups": 24, + "WorkgroupSize": 25, + "WorkgroupId": 26, + "LocalInvocationId": 27, + "GlobalInvocationId": 28, + "LocalInvocationIndex": 29, + "WorkDim": 30, + "GlobalSize": 31, + "EnqueuedWorkgroupSize": 32, + "GlobalOffset": 33, + "GlobalLinearId": 34, + "SubgroupSize": 36, + "SubgroupMaxSize": 37, + "NumSubgroups": 38, + "NumEnqueuedSubgroups": 39, + "SubgroupId": 40, + "SubgroupLocalInvocationId": 41, + "VertexIndex": 42, + "InstanceIndex": 43, + "SubgroupEqMaskKHR": 4416, + "SubgroupGeMaskKHR": 4417, + "SubgroupGtMaskKHR": 4418, + "SubgroupLeMaskKHR": 4419, + "SubgroupLtMaskKHR": 4420, + "BaseVertex": 4424, + "BaseInstance": 4425, + "DrawIndex": 4426, + "DeviceIndex": 4438, + "ViewIndex": 4440, + "BaryCoordNoPerspAMD": 4992, + "BaryCoordNoPerspCentroidAMD": 4993, + "BaryCoordNoPerspSampleAMD": 4994, + "BaryCoordSmoothAMD": 4995, + "BaryCoordSmoothCentroidAMD": 4996, + "BaryCoordSmoothSampleAMD": 4997, + "BaryCoordPullModelAMD": 4998, + "FragStencilRefEXT": 5014, + "ViewportMaskNV": 5253, + "SecondaryPositionNV": 5257, + "SecondaryViewportMaskNV": 5258, + "PositionPerViewNV": 5261, + "ViewportMaskPerViewNV": 5262 + } + }, + { + "Name": "SelectionControl", + "Type": "Bit", + "Values": + { + "Flatten": 0, + "DontFlatten": 1 + } + }, + { + "Name": "LoopControl", + "Type": "Bit", + "Values": + { + "Unroll": 0, + "DontUnroll": 1, + "DependencyInfinite": 2, + "DependencyLength": 3 + } + }, + { + "Name": "FunctionControl", + "Type": "Bit", + "Values": + { + "Inline": 0, + "DontInline": 1, + "Pure": 2, + "Const": 3 + } + }, + { + "Name": "MemorySemantics", + "Type": "Bit", + "Values": + { + "Acquire": 1, + "Release": 2, + "AcquireRelease": 3, + "SequentiallyConsistent": 4, + "UniformMemory": 6, + "SubgroupMemory": 7, + "WorkgroupMemory": 8, + "CrossWorkgroupMemory": 9, + "AtomicCounterMemory": 10, + "ImageMemory": 11 + } + }, + { + "Name": "MemoryAccess", + "Type": "Bit", + "Values": + { + "Volatile": 0, + "Aligned": 1, + "Nontemporal": 2 + } + }, + { + "Name": "Scope", + "Type": "Value", + "Values": + { + "CrossDevice": 0, + "Device": 1, + "Workgroup": 2, + "Subgroup": 3, + "Invocation": 4 + } + }, + { + "Name": "GroupOperation", + "Type": "Value", + "Values": + { + "Reduce": 0, + "InclusiveScan": 1, + "ExclusiveScan": 2 + } + }, + { + "Name": "KernelEnqueueFlags", + "Type": "Value", + "Values": + { + "NoWait": 0, + "WaitKernel": 1, + "WaitWorkGroup": 2 + } + }, + { + "Name": "KernelProfilingInfo", + "Type": "Bit", + "Values": + { + "CmdExecTime": 0 + } + }, + { + "Name": "Capability", + "Type": "Value", + "Values": + { + "Matrix": 0, + "Shader": 1, + "Geometry": 2, + "Tessellation": 3, + "Addresses": 4, + "Linkage": 5, + "Kernel": 6, + "Vector16": 7, + "Float16Buffer": 8, + "Float16": 9, + "Float64": 10, + "Int64": 11, + "Int64Atomics": 12, + "ImageBasic": 13, + "ImageReadWrite": 14, + "ImageMipmap": 15, + "Pipes": 17, + "Groups": 18, + "DeviceEnqueue": 19, + "LiteralSampler": 20, + "AtomicStorage": 21, + "Int16": 22, + "TessellationPointSize": 23, + "GeometryPointSize": 24, + "ImageGatherExtended": 25, + "StorageImageMultisample": 27, + "UniformBufferArrayDynamicIndexing": 28, + "SampledImageArrayDynamicIndexing": 29, + "StorageBufferArrayDynamicIndexing": 30, + "StorageImageArrayDynamicIndexing": 31, + "ClipDistance": 32, + "CullDistance": 33, + "ImageCubeArray": 34, + "SampleRateShading": 35, + "ImageRect": 36, + "SampledRect": 37, + "GenericPointer": 38, + "Int8": 39, + "InputAttachment": 40, + "SparseResidency": 41, + "MinLod": 42, + "Sampled1D": 43, + "Image1D": 44, + "SampledCubeArray": 45, + "SampledBuffer": 46, + "ImageBuffer": 47, + "ImageMSArray": 48, + "StorageImageExtendedFormats": 49, + "ImageQuery": 50, + "DerivativeControl": 51, + "InterpolationFunction": 52, + "TransformFeedback": 53, + "GeometryStreams": 54, + "StorageImageReadWithoutFormat": 55, + "StorageImageWriteWithoutFormat": 56, + "MultiViewport": 57, + "SubgroupDispatch": 58, + "NamedBarrier": 59, + "PipeStorage": 60, + "SubgroupBallotKHR": 4423, + "DrawParameters": 4427, + "SubgroupVoteKHR": 4431, + "StorageBuffer16BitAccess": 4433, + "StorageUniformBufferBlock16": 4433, + "StorageUniform16": 4434, + "UniformAndStorageBuffer16BitAccess": 4434, + "StoragePushConstant16": 4435, + "StorageInputOutput16": 4436, + "DeviceGroup": 4437, + "MultiView": 4439, + "VariablePointersStorageBuffer": 4441, + "VariablePointers": 4442, + "AtomicStorageOps": 4445, + "SampleMaskPostDepthCoverage": 4447, + "ImageGatherBiasLodAMD": 5009, + "FragmentMaskAMD": 5010, + "StencilExportEXT": 5013, + "ImageReadWriteLodAMD": 5015, + "SampleMaskOverrideCoverageNV": 5249, + "GeometryShaderPassthroughNV": 5251, + "ShaderViewportIndexLayerEXT": 5254, + "ShaderViewportIndexLayerNV": 5254, + "ShaderViewportMaskNV": 5255, + "ShaderStereoViewNV": 5259, + "PerViewAttributesNV": 5260, + "SubgroupShuffleINTEL": 5568, + "SubgroupBufferBlockIOINTEL": 5569, + "SubgroupImageBlockIOINTEL": 5570 + } + }, + { + "Name": "Op", + "Type": "Value", + "Values": + { + "OpNop": 0, + "OpUndef": 1, + "OpSourceContinued": 2, + "OpSource": 3, + "OpSourceExtension": 4, + "OpName": 5, + "OpMemberName": 6, + "OpString": 7, + "OpLine": 8, + "OpExtension": 10, + "OpExtInstImport": 11, + "OpExtInst": 12, + "OpMemoryModel": 14, + "OpEntryPoint": 15, + "OpExecutionMode": 16, + "OpCapability": 17, + "OpTypeVoid": 19, + "OpTypeBool": 20, + "OpTypeInt": 21, + "OpTypeFloat": 22, + "OpTypeVector": 23, + "OpTypeMatrix": 24, + "OpTypeImage": 25, + "OpTypeSampler": 26, + "OpTypeSampledImage": 27, + "OpTypeArray": 28, + "OpTypeRuntimeArray": 29, + "OpTypeStruct": 30, + "OpTypeOpaque": 31, + "OpTypePointer": 32, + "OpTypeFunction": 33, + "OpTypeEvent": 34, + "OpTypeDeviceEvent": 35, + "OpTypeReserveId": 36, + "OpTypeQueue": 37, + "OpTypePipe": 38, + "OpTypeForwardPointer": 39, + "OpConstantTrue": 41, + "OpConstantFalse": 42, + "OpConstant": 43, + "OpConstantComposite": 44, + "OpConstantSampler": 45, + "OpConstantNull": 46, + "OpSpecConstantTrue": 48, + "OpSpecConstantFalse": 49, + "OpSpecConstant": 50, + "OpSpecConstantComposite": 51, + "OpSpecConstantOp": 52, + "OpFunction": 54, + "OpFunctionParameter": 55, + "OpFunctionEnd": 56, + "OpFunctionCall": 57, + "OpVariable": 59, + "OpImageTexelPointer": 60, + "OpLoad": 61, + "OpStore": 62, + "OpCopyMemory": 63, + "OpCopyMemorySized": 64, + "OpAccessChain": 65, + "OpInBoundsAccessChain": 66, + "OpPtrAccessChain": 67, + "OpArrayLength": 68, + "OpGenericPtrMemSemantics": 69, + "OpInBoundsPtrAccessChain": 70, + "OpDecorate": 71, + "OpMemberDecorate": 72, + "OpDecorationGroup": 73, + "OpGroupDecorate": 74, + "OpGroupMemberDecorate": 75, + "OpVectorExtractDynamic": 77, + "OpVectorInsertDynamic": 78, + "OpVectorShuffle": 79, + "OpCompositeConstruct": 80, + "OpCompositeExtract": 81, + "OpCompositeInsert": 82, + "OpCopyObject": 83, + "OpTranspose": 84, + "OpSampledImage": 86, + "OpImageSampleImplicitLod": 87, + "OpImageSampleExplicitLod": 88, + "OpImageSampleDrefImplicitLod": 89, + "OpImageSampleDrefExplicitLod": 90, + "OpImageSampleProjImplicitLod": 91, + "OpImageSampleProjExplicitLod": 92, + "OpImageSampleProjDrefImplicitLod": 93, + "OpImageSampleProjDrefExplicitLod": 94, + "OpImageFetch": 95, + "OpImageGather": 96, + "OpImageDrefGather": 97, + "OpImageRead": 98, + "OpImageWrite": 99, + "OpImage": 100, + "OpImageQueryFormat": 101, + "OpImageQueryOrder": 102, + "OpImageQuerySizeLod": 103, + "OpImageQuerySize": 104, + "OpImageQueryLod": 105, + "OpImageQueryLevels": 106, + "OpImageQuerySamples": 107, + "OpConvertFToU": 109, + "OpConvertFToS": 110, + "OpConvertSToF": 111, + "OpConvertUToF": 112, + "OpUConvert": 113, + "OpSConvert": 114, + "OpFConvert": 115, + "OpQuantizeToF16": 116, + "OpConvertPtrToU": 117, + "OpSatConvertSToU": 118, + "OpSatConvertUToS": 119, + "OpConvertUToPtr": 120, + "OpPtrCastToGeneric": 121, + "OpGenericCastToPtr": 122, + "OpGenericCastToPtrExplicit": 123, + "OpBitcast": 124, + "OpSNegate": 126, + "OpFNegate": 127, + "OpIAdd": 128, + "OpFAdd": 129, + "OpISub": 130, + "OpFSub": 131, + "OpIMul": 132, + "OpFMul": 133, + "OpUDiv": 134, + "OpSDiv": 135, + "OpFDiv": 136, + "OpUMod": 137, + "OpSRem": 138, + "OpSMod": 139, + "OpFRem": 140, + "OpFMod": 141, + "OpVectorTimesScalar": 142, + "OpMatrixTimesScalar": 143, + "OpVectorTimesMatrix": 144, + "OpMatrixTimesVector": 145, + "OpMatrixTimesMatrix": 146, + "OpOuterProduct": 147, + "OpDot": 148, + "OpIAddCarry": 149, + "OpISubBorrow": 150, + "OpUMulExtended": 151, + "OpSMulExtended": 152, + "OpAny": 154, + "OpAll": 155, + "OpIsNan": 156, + "OpIsInf": 157, + "OpIsFinite": 158, + "OpIsNormal": 159, + "OpSignBitSet": 160, + "OpLessOrGreater": 161, + "OpOrdered": 162, + "OpUnordered": 163, + "OpLogicalEqual": 164, + "OpLogicalNotEqual": 165, + "OpLogicalOr": 166, + "OpLogicalAnd": 167, + "OpLogicalNot": 168, + "OpSelect": 169, + "OpIEqual": 170, + "OpINotEqual": 171, + "OpUGreaterThan": 172, + "OpSGreaterThan": 173, + "OpUGreaterThanEqual": 174, + "OpSGreaterThanEqual": 175, + "OpULessThan": 176, + "OpSLessThan": 177, + "OpULessThanEqual": 178, + "OpSLessThanEqual": 179, + "OpFOrdEqual": 180, + "OpFUnordEqual": 181, + "OpFOrdNotEqual": 182, + "OpFUnordNotEqual": 183, + "OpFOrdLessThan": 184, + "OpFUnordLessThan": 185, + "OpFOrdGreaterThan": 186, + "OpFUnordGreaterThan": 187, + "OpFOrdLessThanEqual": 188, + "OpFUnordLessThanEqual": 189, + "OpFOrdGreaterThanEqual": 190, + "OpFUnordGreaterThanEqual": 191, + "OpShiftRightLogical": 194, + "OpShiftRightArithmetic": 195, + "OpShiftLeftLogical": 196, + "OpBitwiseOr": 197, + "OpBitwiseXor": 198, + "OpBitwiseAnd": 199, + "OpNot": 200, + "OpBitFieldInsert": 201, + "OpBitFieldSExtract": 202, + "OpBitFieldUExtract": 203, + "OpBitReverse": 204, + "OpBitCount": 205, + "OpDPdx": 207, + "OpDPdy": 208, + "OpFwidth": 209, + "OpDPdxFine": 210, + "OpDPdyFine": 211, + "OpFwidthFine": 212, + "OpDPdxCoarse": 213, + "OpDPdyCoarse": 214, + "OpFwidthCoarse": 215, + "OpEmitVertex": 218, + "OpEndPrimitive": 219, + "OpEmitStreamVertex": 220, + "OpEndStreamPrimitive": 221, + "OpControlBarrier": 224, + "OpMemoryBarrier": 225, + "OpAtomicLoad": 227, + "OpAtomicStore": 228, + "OpAtomicExchange": 229, + "OpAtomicCompareExchange": 230, + "OpAtomicCompareExchangeWeak": 231, + "OpAtomicIIncrement": 232, + "OpAtomicIDecrement": 233, + "OpAtomicIAdd": 234, + "OpAtomicISub": 235, + "OpAtomicSMin": 236, + "OpAtomicUMin": 237, + "OpAtomicSMax": 238, + "OpAtomicUMax": 239, + "OpAtomicAnd": 240, + "OpAtomicOr": 241, + "OpAtomicXor": 242, + "OpPhi": 245, + "OpLoopMerge": 246, + "OpSelectionMerge": 247, + "OpLabel": 248, + "OpBranch": 249, + "OpBranchConditional": 250, + "OpSwitch": 251, + "OpKill": 252, + "OpReturn": 253, + "OpReturnValue": 254, + "OpUnreachable": 255, + "OpLifetimeStart": 256, + "OpLifetimeStop": 257, + "OpGroupAsyncCopy": 259, + "OpGroupWaitEvents": 260, + "OpGroupAll": 261, + "OpGroupAny": 262, + "OpGroupBroadcast": 263, + "OpGroupIAdd": 264, + "OpGroupFAdd": 265, + "OpGroupFMin": 266, + "OpGroupUMin": 267, + "OpGroupSMin": 268, + "OpGroupFMax": 269, + "OpGroupUMax": 270, + "OpGroupSMax": 271, + "OpReadPipe": 274, + "OpWritePipe": 275, + "OpReservedReadPipe": 276, + "OpReservedWritePipe": 277, + "OpReserveReadPipePackets": 278, + "OpReserveWritePipePackets": 279, + "OpCommitReadPipe": 280, + "OpCommitWritePipe": 281, + "OpIsValidReserveId": 282, + "OpGetNumPipePackets": 283, + "OpGetMaxPipePackets": 284, + "OpGroupReserveReadPipePackets": 285, + "OpGroupReserveWritePipePackets": 286, + "OpGroupCommitReadPipe": 287, + "OpGroupCommitWritePipe": 288, + "OpEnqueueMarker": 291, + "OpEnqueueKernel": 292, + "OpGetKernelNDrangeSubGroupCount": 293, + "OpGetKernelNDrangeMaxSubGroupSize": 294, + "OpGetKernelWorkGroupSize": 295, + "OpGetKernelPreferredWorkGroupSizeMultiple": 296, + "OpRetainEvent": 297, + "OpReleaseEvent": 298, + "OpCreateUserEvent": 299, + "OpIsValidEvent": 300, + "OpSetUserEventStatus": 301, + "OpCaptureEventProfilingInfo": 302, + "OpGetDefaultQueue": 303, + "OpBuildNDRange": 304, + "OpImageSparseSampleImplicitLod": 305, + "OpImageSparseSampleExplicitLod": 306, + "OpImageSparseSampleDrefImplicitLod": 307, + "OpImageSparseSampleDrefExplicitLod": 308, + "OpImageSparseSampleProjImplicitLod": 309, + "OpImageSparseSampleProjExplicitLod": 310, + "OpImageSparseSampleProjDrefImplicitLod": 311, + "OpImageSparseSampleProjDrefExplicitLod": 312, + "OpImageSparseFetch": 313, + "OpImageSparseGather": 314, + "OpImageSparseDrefGather": 315, + "OpImageSparseTexelsResident": 316, + "OpNoLine": 317, + "OpAtomicFlagTestAndSet": 318, + "OpAtomicFlagClear": 319, + "OpImageSparseRead": 320, + "OpSizeOf": 321, + "OpTypePipeStorage": 322, + "OpConstantPipeStorage": 323, + "OpCreatePipeFromPipeStorage": 324, + "OpGetKernelLocalSizeForSubgroupCount": 325, + "OpGetKernelMaxNumSubgroups": 326, + "OpTypeNamedBarrier": 327, + "OpNamedBarrierInitialize": 328, + "OpMemoryNamedBarrier": 329, + "OpModuleProcessed": 330, + "OpDecorateId": 332, + "OpSubgroupBallotKHR": 4421, + "OpSubgroupFirstInvocationKHR": 4422, + "OpSubgroupAllKHR": 4428, + "OpSubgroupAnyKHR": 4429, + "OpSubgroupAllEqualKHR": 4430, + "OpSubgroupReadInvocationKHR": 4432, + "OpGroupIAddNonUniformAMD": 5000, + "OpGroupFAddNonUniformAMD": 5001, + "OpGroupFMinNonUniformAMD": 5002, + "OpGroupUMinNonUniformAMD": 5003, + "OpGroupSMinNonUniformAMD": 5004, + "OpGroupFMaxNonUniformAMD": 5005, + "OpGroupUMaxNonUniformAMD": 5006, + "OpGroupSMaxNonUniformAMD": 5007, + "OpFragmentMaskFetchAMD": 5011, + "OpFragmentFetchAMD": 5012, + "OpSubgroupShuffleINTEL": 5571, + "OpSubgroupShuffleDownINTEL": 5572, + "OpSubgroupShuffleUpINTEL": 5573, + "OpSubgroupShuffleXorINTEL": 5574, + "OpSubgroupBlockReadINTEL": 5575, + "OpSubgroupBlockWriteINTEL": 5576, + "OpSubgroupImageBlockReadINTEL": 5577, + "OpSubgroupImageBlockWriteINTEL": 5578, + "OpDecorateStringGOOGLE": 5632, + "OpMemberDecorateStringGOOGLE": 5633 + } + } + ] + } +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.lua b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.lua new file mode 100644 index 00000000000..ad34e0abe9d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.lua @@ -0,0 +1,971 @@ +-- Copyright (c) 2014-2018 The Khronos Group Inc. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and/or associated documentation files (the "Materials"), +-- to deal in the Materials without restriction, including without limitation +-- the rights to use, copy, modify, merge, publish, distribute, sublicense, +-- and/or sell copies of the Materials, and to permit persons to whom the +-- Materials are furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Materials. +-- +-- MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +-- STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +-- HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +-- +-- THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +-- FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +-- IN THE MATERIALS. + +-- This header is automatically generated by the same tool that creates +-- the Binary Section of the SPIR-V specification. + +-- Enumeration tokens for SPIR-V, in various styles: +-- C, C++, C++11, JSON, Lua, Python +-- +-- - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +-- - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +-- - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +-- - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +-- - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +-- +-- Some tokens act like mask values, which can be OR'd together, +-- while others are mutually exclusive. The mask-like ones have +-- "Mask" in their name, and a parallel enum that has the shift +-- amount (1 << x) for each corresponding enumerant. + +spv = { + MagicNumber = 0x07230203, + Version = 0x00010100, + Revision = 8, + OpCodeMask = 0xffff, + WordCountShift = 16, + + SourceLanguage = { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + }, + + ExecutionModel = { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + }, + + AddressingModel = { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + }, + + MemoryModel = { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + }, + + ExecutionMode = { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + }, + + StorageClass = { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + }, + + Dim = { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + }, + + SamplerAddressingMode = { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + }, + + SamplerFilterMode = { + Nearest = 0, + Linear = 1, + }, + + ImageFormat = { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + }, + + ImageChannelOrder = { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + }, + + ImageChannelDataType = { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + }, + + ImageOperandsShift = { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + }, + + ImageOperandsMask = { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, + }, + + FPFastMathModeShift = { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + }, + + FPFastMathModeMask = { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, + }, + + FPRoundingMode = { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + }, + + LinkageType = { + Export = 0, + Import = 1, + }, + + AccessQualifier = { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + }, + + FunctionParameterAttribute = { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + }, + + Decoration = { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + }, + + BuiltIn = { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + }, + + SelectionControlShift = { + Flatten = 0, + DontFlatten = 1, + }, + + SelectionControlMask = { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, + }, + + LoopControlShift = { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + }, + + LoopControlMask = { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, + }, + + FunctionControlShift = { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + }, + + FunctionControlMask = { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, + }, + + MemorySemanticsShift = { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + }, + + MemorySemanticsMask = { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, + }, + + MemoryAccessShift = { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + }, + + MemoryAccessMask = { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, + }, + + Scope = { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + }, + + GroupOperation = { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + }, + + KernelEnqueueFlags = { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + }, + + KernelProfilingInfoShift = { + CmdExecTime = 0, + }, + + KernelProfilingInfoMask = { + MaskNone = 0, + CmdExecTime = 0x00000001, + }, + + Capability = { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + }, + + Op = { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.py b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.py new file mode 100644 index 00000000000..519a59710d1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.1/spirv.py @@ -0,0 +1,971 @@ +# Copyright (c) 2014-2018 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and/or associated documentation files (the "Materials"), +# to deal in the Materials without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Materials, and to permit persons to whom the +# Materials are furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Materials. +# +# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +# STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +# HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +# +# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +# IN THE MATERIALS. + +# This header is automatically generated by the same tool that creates +# the Binary Section of the SPIR-V specification. + +# Enumeration tokens for SPIR-V, in various styles: +# C, C++, C++11, JSON, Lua, Python +# +# - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +# - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +# - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +# - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +# - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +# +# Some tokens act like mask values, which can be OR'd together, +# while others are mutually exclusive. The mask-like ones have +# "Mask" in their name, and a parallel enum that has the shift +# amount (1 << x) for each corresponding enumerant. + +spv = { + 'MagicNumber' : 0x07230203, + 'Version' : 0x00010100, + 'Revision' : 8, + 'OpCodeMask' : 0xffff, + 'WordCountShift' : 16, + + 'SourceLanguage' : { + 'Unknown' : 0, + 'ESSL' : 1, + 'GLSL' : 2, + 'OpenCL_C' : 3, + 'OpenCL_CPP' : 4, + 'HLSL' : 5, + }, + + 'ExecutionModel' : { + 'Vertex' : 0, + 'TessellationControl' : 1, + 'TessellationEvaluation' : 2, + 'Geometry' : 3, + 'Fragment' : 4, + 'GLCompute' : 5, + 'Kernel' : 6, + }, + + 'AddressingModel' : { + 'Logical' : 0, + 'Physical32' : 1, + 'Physical64' : 2, + }, + + 'MemoryModel' : { + 'Simple' : 0, + 'GLSL450' : 1, + 'OpenCL' : 2, + }, + + 'ExecutionMode' : { + 'Invocations' : 0, + 'SpacingEqual' : 1, + 'SpacingFractionalEven' : 2, + 'SpacingFractionalOdd' : 3, + 'VertexOrderCw' : 4, + 'VertexOrderCcw' : 5, + 'PixelCenterInteger' : 6, + 'OriginUpperLeft' : 7, + 'OriginLowerLeft' : 8, + 'EarlyFragmentTests' : 9, + 'PointMode' : 10, + 'Xfb' : 11, + 'DepthReplacing' : 12, + 'DepthGreater' : 14, + 'DepthLess' : 15, + 'DepthUnchanged' : 16, + 'LocalSize' : 17, + 'LocalSizeHint' : 18, + 'InputPoints' : 19, + 'InputLines' : 20, + 'InputLinesAdjacency' : 21, + 'Triangles' : 22, + 'InputTrianglesAdjacency' : 23, + 'Quads' : 24, + 'Isolines' : 25, + 'OutputVertices' : 26, + 'OutputPoints' : 27, + 'OutputLineStrip' : 28, + 'OutputTriangleStrip' : 29, + 'VecTypeHint' : 30, + 'ContractionOff' : 31, + 'Initializer' : 33, + 'Finalizer' : 34, + 'SubgroupSize' : 35, + 'SubgroupsPerWorkgroup' : 36, + 'PostDepthCoverage' : 4446, + 'StencilRefReplacingEXT' : 5027, + }, + + 'StorageClass' : { + 'UniformConstant' : 0, + 'Input' : 1, + 'Uniform' : 2, + 'Output' : 3, + 'Workgroup' : 4, + 'CrossWorkgroup' : 5, + 'Private' : 6, + 'Function' : 7, + 'Generic' : 8, + 'PushConstant' : 9, + 'AtomicCounter' : 10, + 'Image' : 11, + 'StorageBuffer' : 12, + }, + + 'Dim' : { + 'Dim1D' : 0, + 'Dim2D' : 1, + 'Dim3D' : 2, + 'Cube' : 3, + 'Rect' : 4, + 'Buffer' : 5, + 'SubpassData' : 6, + }, + + 'SamplerAddressingMode' : { + 'None' : 0, + 'ClampToEdge' : 1, + 'Clamp' : 2, + 'Repeat' : 3, + 'RepeatMirrored' : 4, + }, + + 'SamplerFilterMode' : { + 'Nearest' : 0, + 'Linear' : 1, + }, + + 'ImageFormat' : { + 'Unknown' : 0, + 'Rgba32f' : 1, + 'Rgba16f' : 2, + 'R32f' : 3, + 'Rgba8' : 4, + 'Rgba8Snorm' : 5, + 'Rg32f' : 6, + 'Rg16f' : 7, + 'R11fG11fB10f' : 8, + 'R16f' : 9, + 'Rgba16' : 10, + 'Rgb10A2' : 11, + 'Rg16' : 12, + 'Rg8' : 13, + 'R16' : 14, + 'R8' : 15, + 'Rgba16Snorm' : 16, + 'Rg16Snorm' : 17, + 'Rg8Snorm' : 18, + 'R16Snorm' : 19, + 'R8Snorm' : 20, + 'Rgba32i' : 21, + 'Rgba16i' : 22, + 'Rgba8i' : 23, + 'R32i' : 24, + 'Rg32i' : 25, + 'Rg16i' : 26, + 'Rg8i' : 27, + 'R16i' : 28, + 'R8i' : 29, + 'Rgba32ui' : 30, + 'Rgba16ui' : 31, + 'Rgba8ui' : 32, + 'R32ui' : 33, + 'Rgb10a2ui' : 34, + 'Rg32ui' : 35, + 'Rg16ui' : 36, + 'Rg8ui' : 37, + 'R16ui' : 38, + 'R8ui' : 39, + }, + + 'ImageChannelOrder' : { + 'R' : 0, + 'A' : 1, + 'RG' : 2, + 'RA' : 3, + 'RGB' : 4, + 'RGBA' : 5, + 'BGRA' : 6, + 'ARGB' : 7, + 'Intensity' : 8, + 'Luminance' : 9, + 'Rx' : 10, + 'RGx' : 11, + 'RGBx' : 12, + 'Depth' : 13, + 'DepthStencil' : 14, + 'sRGB' : 15, + 'sRGBx' : 16, + 'sRGBA' : 17, + 'sBGRA' : 18, + 'ABGR' : 19, + }, + + 'ImageChannelDataType' : { + 'SnormInt8' : 0, + 'SnormInt16' : 1, + 'UnormInt8' : 2, + 'UnormInt16' : 3, + 'UnormShort565' : 4, + 'UnormShort555' : 5, + 'UnormInt101010' : 6, + 'SignedInt8' : 7, + 'SignedInt16' : 8, + 'SignedInt32' : 9, + 'UnsignedInt8' : 10, + 'UnsignedInt16' : 11, + 'UnsignedInt32' : 12, + 'HalfFloat' : 13, + 'Float' : 14, + 'UnormInt24' : 15, + 'UnormInt101010_2' : 16, + }, + + 'ImageOperandsShift' : { + 'Bias' : 0, + 'Lod' : 1, + 'Grad' : 2, + 'ConstOffset' : 3, + 'Offset' : 4, + 'ConstOffsets' : 5, + 'Sample' : 6, + 'MinLod' : 7, + }, + + 'ImageOperandsMask' : { + 'MaskNone' : 0, + 'Bias' : 0x00000001, + 'Lod' : 0x00000002, + 'Grad' : 0x00000004, + 'ConstOffset' : 0x00000008, + 'Offset' : 0x00000010, + 'ConstOffsets' : 0x00000020, + 'Sample' : 0x00000040, + 'MinLod' : 0x00000080, + }, + + 'FPFastMathModeShift' : { + 'NotNaN' : 0, + 'NotInf' : 1, + 'NSZ' : 2, + 'AllowRecip' : 3, + 'Fast' : 4, + }, + + 'FPFastMathModeMask' : { + 'MaskNone' : 0, + 'NotNaN' : 0x00000001, + 'NotInf' : 0x00000002, + 'NSZ' : 0x00000004, + 'AllowRecip' : 0x00000008, + 'Fast' : 0x00000010, + }, + + 'FPRoundingMode' : { + 'RTE' : 0, + 'RTZ' : 1, + 'RTP' : 2, + 'RTN' : 3, + }, + + 'LinkageType' : { + 'Export' : 0, + 'Import' : 1, + }, + + 'AccessQualifier' : { + 'ReadOnly' : 0, + 'WriteOnly' : 1, + 'ReadWrite' : 2, + }, + + 'FunctionParameterAttribute' : { + 'Zext' : 0, + 'Sext' : 1, + 'ByVal' : 2, + 'Sret' : 3, + 'NoAlias' : 4, + 'NoCapture' : 5, + 'NoWrite' : 6, + 'NoReadWrite' : 7, + }, + + 'Decoration' : { + 'RelaxedPrecision' : 0, + 'SpecId' : 1, + 'Block' : 2, + 'BufferBlock' : 3, + 'RowMajor' : 4, + 'ColMajor' : 5, + 'ArrayStride' : 6, + 'MatrixStride' : 7, + 'GLSLShared' : 8, + 'GLSLPacked' : 9, + 'CPacked' : 10, + 'BuiltIn' : 11, + 'NoPerspective' : 13, + 'Flat' : 14, + 'Patch' : 15, + 'Centroid' : 16, + 'Sample' : 17, + 'Invariant' : 18, + 'Restrict' : 19, + 'Aliased' : 20, + 'Volatile' : 21, + 'Constant' : 22, + 'Coherent' : 23, + 'NonWritable' : 24, + 'NonReadable' : 25, + 'Uniform' : 26, + 'SaturatedConversion' : 28, + 'Stream' : 29, + 'Location' : 30, + 'Component' : 31, + 'Index' : 32, + 'Binding' : 33, + 'DescriptorSet' : 34, + 'Offset' : 35, + 'XfbBuffer' : 36, + 'XfbStride' : 37, + 'FuncParamAttr' : 38, + 'FPRoundingMode' : 39, + 'FPFastMathMode' : 40, + 'LinkageAttributes' : 41, + 'NoContraction' : 42, + 'InputAttachmentIndex' : 43, + 'Alignment' : 44, + 'MaxByteOffset' : 45, + 'ExplicitInterpAMD' : 4999, + 'OverrideCoverageNV' : 5248, + 'PassthroughNV' : 5250, + 'ViewportRelativeNV' : 5252, + 'SecondaryViewportRelativeNV' : 5256, + 'HlslCounterBufferGOOGLE' : 5634, + 'HlslSemanticGOOGLE' : 5635, + }, + + 'BuiltIn' : { + 'Position' : 0, + 'PointSize' : 1, + 'ClipDistance' : 3, + 'CullDistance' : 4, + 'VertexId' : 5, + 'InstanceId' : 6, + 'PrimitiveId' : 7, + 'InvocationId' : 8, + 'Layer' : 9, + 'ViewportIndex' : 10, + 'TessLevelOuter' : 11, + 'TessLevelInner' : 12, + 'TessCoord' : 13, + 'PatchVertices' : 14, + 'FragCoord' : 15, + 'PointCoord' : 16, + 'FrontFacing' : 17, + 'SampleId' : 18, + 'SamplePosition' : 19, + 'SampleMask' : 20, + 'FragDepth' : 22, + 'HelperInvocation' : 23, + 'NumWorkgroups' : 24, + 'WorkgroupSize' : 25, + 'WorkgroupId' : 26, + 'LocalInvocationId' : 27, + 'GlobalInvocationId' : 28, + 'LocalInvocationIndex' : 29, + 'WorkDim' : 30, + 'GlobalSize' : 31, + 'EnqueuedWorkgroupSize' : 32, + 'GlobalOffset' : 33, + 'GlobalLinearId' : 34, + 'SubgroupSize' : 36, + 'SubgroupMaxSize' : 37, + 'NumSubgroups' : 38, + 'NumEnqueuedSubgroups' : 39, + 'SubgroupId' : 40, + 'SubgroupLocalInvocationId' : 41, + 'VertexIndex' : 42, + 'InstanceIndex' : 43, + 'SubgroupEqMaskKHR' : 4416, + 'SubgroupGeMaskKHR' : 4417, + 'SubgroupGtMaskKHR' : 4418, + 'SubgroupLeMaskKHR' : 4419, + 'SubgroupLtMaskKHR' : 4420, + 'BaseVertex' : 4424, + 'BaseInstance' : 4425, + 'DrawIndex' : 4426, + 'DeviceIndex' : 4438, + 'ViewIndex' : 4440, + 'BaryCoordNoPerspAMD' : 4992, + 'BaryCoordNoPerspCentroidAMD' : 4993, + 'BaryCoordNoPerspSampleAMD' : 4994, + 'BaryCoordSmoothAMD' : 4995, + 'BaryCoordSmoothCentroidAMD' : 4996, + 'BaryCoordSmoothSampleAMD' : 4997, + 'BaryCoordPullModelAMD' : 4998, + 'FragStencilRefEXT' : 5014, + 'ViewportMaskNV' : 5253, + 'SecondaryPositionNV' : 5257, + 'SecondaryViewportMaskNV' : 5258, + 'PositionPerViewNV' : 5261, + 'ViewportMaskPerViewNV' : 5262, + }, + + 'SelectionControlShift' : { + 'Flatten' : 0, + 'DontFlatten' : 1, + }, + + 'SelectionControlMask' : { + 'MaskNone' : 0, + 'Flatten' : 0x00000001, + 'DontFlatten' : 0x00000002, + }, + + 'LoopControlShift' : { + 'Unroll' : 0, + 'DontUnroll' : 1, + 'DependencyInfinite' : 2, + 'DependencyLength' : 3, + }, + + 'LoopControlMask' : { + 'MaskNone' : 0, + 'Unroll' : 0x00000001, + 'DontUnroll' : 0x00000002, + 'DependencyInfinite' : 0x00000004, + 'DependencyLength' : 0x00000008, + }, + + 'FunctionControlShift' : { + 'Inline' : 0, + 'DontInline' : 1, + 'Pure' : 2, + 'Const' : 3, + }, + + 'FunctionControlMask' : { + 'MaskNone' : 0, + 'Inline' : 0x00000001, + 'DontInline' : 0x00000002, + 'Pure' : 0x00000004, + 'Const' : 0x00000008, + }, + + 'MemorySemanticsShift' : { + 'Acquire' : 1, + 'Release' : 2, + 'AcquireRelease' : 3, + 'SequentiallyConsistent' : 4, + 'UniformMemory' : 6, + 'SubgroupMemory' : 7, + 'WorkgroupMemory' : 8, + 'CrossWorkgroupMemory' : 9, + 'AtomicCounterMemory' : 10, + 'ImageMemory' : 11, + }, + + 'MemorySemanticsMask' : { + 'MaskNone' : 0, + 'Acquire' : 0x00000002, + 'Release' : 0x00000004, + 'AcquireRelease' : 0x00000008, + 'SequentiallyConsistent' : 0x00000010, + 'UniformMemory' : 0x00000040, + 'SubgroupMemory' : 0x00000080, + 'WorkgroupMemory' : 0x00000100, + 'CrossWorkgroupMemory' : 0x00000200, + 'AtomicCounterMemory' : 0x00000400, + 'ImageMemory' : 0x00000800, + }, + + 'MemoryAccessShift' : { + 'Volatile' : 0, + 'Aligned' : 1, + 'Nontemporal' : 2, + }, + + 'MemoryAccessMask' : { + 'MaskNone' : 0, + 'Volatile' : 0x00000001, + 'Aligned' : 0x00000002, + 'Nontemporal' : 0x00000004, + }, + + 'Scope' : { + 'CrossDevice' : 0, + 'Device' : 1, + 'Workgroup' : 2, + 'Subgroup' : 3, + 'Invocation' : 4, + }, + + 'GroupOperation' : { + 'Reduce' : 0, + 'InclusiveScan' : 1, + 'ExclusiveScan' : 2, + }, + + 'KernelEnqueueFlags' : { + 'NoWait' : 0, + 'WaitKernel' : 1, + 'WaitWorkGroup' : 2, + }, + + 'KernelProfilingInfoShift' : { + 'CmdExecTime' : 0, + }, + + 'KernelProfilingInfoMask' : { + 'MaskNone' : 0, + 'CmdExecTime' : 0x00000001, + }, + + 'Capability' : { + 'Matrix' : 0, + 'Shader' : 1, + 'Geometry' : 2, + 'Tessellation' : 3, + 'Addresses' : 4, + 'Linkage' : 5, + 'Kernel' : 6, + 'Vector16' : 7, + 'Float16Buffer' : 8, + 'Float16' : 9, + 'Float64' : 10, + 'Int64' : 11, + 'Int64Atomics' : 12, + 'ImageBasic' : 13, + 'ImageReadWrite' : 14, + 'ImageMipmap' : 15, + 'Pipes' : 17, + 'Groups' : 18, + 'DeviceEnqueue' : 19, + 'LiteralSampler' : 20, + 'AtomicStorage' : 21, + 'Int16' : 22, + 'TessellationPointSize' : 23, + 'GeometryPointSize' : 24, + 'ImageGatherExtended' : 25, + 'StorageImageMultisample' : 27, + 'UniformBufferArrayDynamicIndexing' : 28, + 'SampledImageArrayDynamicIndexing' : 29, + 'StorageBufferArrayDynamicIndexing' : 30, + 'StorageImageArrayDynamicIndexing' : 31, + 'ClipDistance' : 32, + 'CullDistance' : 33, + 'ImageCubeArray' : 34, + 'SampleRateShading' : 35, + 'ImageRect' : 36, + 'SampledRect' : 37, + 'GenericPointer' : 38, + 'Int8' : 39, + 'InputAttachment' : 40, + 'SparseResidency' : 41, + 'MinLod' : 42, + 'Sampled1D' : 43, + 'Image1D' : 44, + 'SampledCubeArray' : 45, + 'SampledBuffer' : 46, + 'ImageBuffer' : 47, + 'ImageMSArray' : 48, + 'StorageImageExtendedFormats' : 49, + 'ImageQuery' : 50, + 'DerivativeControl' : 51, + 'InterpolationFunction' : 52, + 'TransformFeedback' : 53, + 'GeometryStreams' : 54, + 'StorageImageReadWithoutFormat' : 55, + 'StorageImageWriteWithoutFormat' : 56, + 'MultiViewport' : 57, + 'SubgroupDispatch' : 58, + 'NamedBarrier' : 59, + 'PipeStorage' : 60, + 'SubgroupBallotKHR' : 4423, + 'DrawParameters' : 4427, + 'SubgroupVoteKHR' : 4431, + 'StorageBuffer16BitAccess' : 4433, + 'StorageUniformBufferBlock16' : 4433, + 'StorageUniform16' : 4434, + 'UniformAndStorageBuffer16BitAccess' : 4434, + 'StoragePushConstant16' : 4435, + 'StorageInputOutput16' : 4436, + 'DeviceGroup' : 4437, + 'MultiView' : 4439, + 'VariablePointersStorageBuffer' : 4441, + 'VariablePointers' : 4442, + 'AtomicStorageOps' : 4445, + 'SampleMaskPostDepthCoverage' : 4447, + 'ImageGatherBiasLodAMD' : 5009, + 'FragmentMaskAMD' : 5010, + 'StencilExportEXT' : 5013, + 'ImageReadWriteLodAMD' : 5015, + 'SampleMaskOverrideCoverageNV' : 5249, + 'GeometryShaderPassthroughNV' : 5251, + 'ShaderViewportIndexLayerEXT' : 5254, + 'ShaderViewportIndexLayerNV' : 5254, + 'ShaderViewportMaskNV' : 5255, + 'ShaderStereoViewNV' : 5259, + 'PerViewAttributesNV' : 5260, + 'SubgroupShuffleINTEL' : 5568, + 'SubgroupBufferBlockIOINTEL' : 5569, + 'SubgroupImageBlockIOINTEL' : 5570, + }, + + 'Op' : { + 'OpNop' : 0, + 'OpUndef' : 1, + 'OpSourceContinued' : 2, + 'OpSource' : 3, + 'OpSourceExtension' : 4, + 'OpName' : 5, + 'OpMemberName' : 6, + 'OpString' : 7, + 'OpLine' : 8, + 'OpExtension' : 10, + 'OpExtInstImport' : 11, + 'OpExtInst' : 12, + 'OpMemoryModel' : 14, + 'OpEntryPoint' : 15, + 'OpExecutionMode' : 16, + 'OpCapability' : 17, + 'OpTypeVoid' : 19, + 'OpTypeBool' : 20, + 'OpTypeInt' : 21, + 'OpTypeFloat' : 22, + 'OpTypeVector' : 23, + 'OpTypeMatrix' : 24, + 'OpTypeImage' : 25, + 'OpTypeSampler' : 26, + 'OpTypeSampledImage' : 27, + 'OpTypeArray' : 28, + 'OpTypeRuntimeArray' : 29, + 'OpTypeStruct' : 30, + 'OpTypeOpaque' : 31, + 'OpTypePointer' : 32, + 'OpTypeFunction' : 33, + 'OpTypeEvent' : 34, + 'OpTypeDeviceEvent' : 35, + 'OpTypeReserveId' : 36, + 'OpTypeQueue' : 37, + 'OpTypePipe' : 38, + 'OpTypeForwardPointer' : 39, + 'OpConstantTrue' : 41, + 'OpConstantFalse' : 42, + 'OpConstant' : 43, + 'OpConstantComposite' : 44, + 'OpConstantSampler' : 45, + 'OpConstantNull' : 46, + 'OpSpecConstantTrue' : 48, + 'OpSpecConstantFalse' : 49, + 'OpSpecConstant' : 50, + 'OpSpecConstantComposite' : 51, + 'OpSpecConstantOp' : 52, + 'OpFunction' : 54, + 'OpFunctionParameter' : 55, + 'OpFunctionEnd' : 56, + 'OpFunctionCall' : 57, + 'OpVariable' : 59, + 'OpImageTexelPointer' : 60, + 'OpLoad' : 61, + 'OpStore' : 62, + 'OpCopyMemory' : 63, + 'OpCopyMemorySized' : 64, + 'OpAccessChain' : 65, + 'OpInBoundsAccessChain' : 66, + 'OpPtrAccessChain' : 67, + 'OpArrayLength' : 68, + 'OpGenericPtrMemSemantics' : 69, + 'OpInBoundsPtrAccessChain' : 70, + 'OpDecorate' : 71, + 'OpMemberDecorate' : 72, + 'OpDecorationGroup' : 73, + 'OpGroupDecorate' : 74, + 'OpGroupMemberDecorate' : 75, + 'OpVectorExtractDynamic' : 77, + 'OpVectorInsertDynamic' : 78, + 'OpVectorShuffle' : 79, + 'OpCompositeConstruct' : 80, + 'OpCompositeExtract' : 81, + 'OpCompositeInsert' : 82, + 'OpCopyObject' : 83, + 'OpTranspose' : 84, + 'OpSampledImage' : 86, + 'OpImageSampleImplicitLod' : 87, + 'OpImageSampleExplicitLod' : 88, + 'OpImageSampleDrefImplicitLod' : 89, + 'OpImageSampleDrefExplicitLod' : 90, + 'OpImageSampleProjImplicitLod' : 91, + 'OpImageSampleProjExplicitLod' : 92, + 'OpImageSampleProjDrefImplicitLod' : 93, + 'OpImageSampleProjDrefExplicitLod' : 94, + 'OpImageFetch' : 95, + 'OpImageGather' : 96, + 'OpImageDrefGather' : 97, + 'OpImageRead' : 98, + 'OpImageWrite' : 99, + 'OpImage' : 100, + 'OpImageQueryFormat' : 101, + 'OpImageQueryOrder' : 102, + 'OpImageQuerySizeLod' : 103, + 'OpImageQuerySize' : 104, + 'OpImageQueryLod' : 105, + 'OpImageQueryLevels' : 106, + 'OpImageQuerySamples' : 107, + 'OpConvertFToU' : 109, + 'OpConvertFToS' : 110, + 'OpConvertSToF' : 111, + 'OpConvertUToF' : 112, + 'OpUConvert' : 113, + 'OpSConvert' : 114, + 'OpFConvert' : 115, + 'OpQuantizeToF16' : 116, + 'OpConvertPtrToU' : 117, + 'OpSatConvertSToU' : 118, + 'OpSatConvertUToS' : 119, + 'OpConvertUToPtr' : 120, + 'OpPtrCastToGeneric' : 121, + 'OpGenericCastToPtr' : 122, + 'OpGenericCastToPtrExplicit' : 123, + 'OpBitcast' : 124, + 'OpSNegate' : 126, + 'OpFNegate' : 127, + 'OpIAdd' : 128, + 'OpFAdd' : 129, + 'OpISub' : 130, + 'OpFSub' : 131, + 'OpIMul' : 132, + 'OpFMul' : 133, + 'OpUDiv' : 134, + 'OpSDiv' : 135, + 'OpFDiv' : 136, + 'OpUMod' : 137, + 'OpSRem' : 138, + 'OpSMod' : 139, + 'OpFRem' : 140, + 'OpFMod' : 141, + 'OpVectorTimesScalar' : 142, + 'OpMatrixTimesScalar' : 143, + 'OpVectorTimesMatrix' : 144, + 'OpMatrixTimesVector' : 145, + 'OpMatrixTimesMatrix' : 146, + 'OpOuterProduct' : 147, + 'OpDot' : 148, + 'OpIAddCarry' : 149, + 'OpISubBorrow' : 150, + 'OpUMulExtended' : 151, + 'OpSMulExtended' : 152, + 'OpAny' : 154, + 'OpAll' : 155, + 'OpIsNan' : 156, + 'OpIsInf' : 157, + 'OpIsFinite' : 158, + 'OpIsNormal' : 159, + 'OpSignBitSet' : 160, + 'OpLessOrGreater' : 161, + 'OpOrdered' : 162, + 'OpUnordered' : 163, + 'OpLogicalEqual' : 164, + 'OpLogicalNotEqual' : 165, + 'OpLogicalOr' : 166, + 'OpLogicalAnd' : 167, + 'OpLogicalNot' : 168, + 'OpSelect' : 169, + 'OpIEqual' : 170, + 'OpINotEqual' : 171, + 'OpUGreaterThan' : 172, + 'OpSGreaterThan' : 173, + 'OpUGreaterThanEqual' : 174, + 'OpSGreaterThanEqual' : 175, + 'OpULessThan' : 176, + 'OpSLessThan' : 177, + 'OpULessThanEqual' : 178, + 'OpSLessThanEqual' : 179, + 'OpFOrdEqual' : 180, + 'OpFUnordEqual' : 181, + 'OpFOrdNotEqual' : 182, + 'OpFUnordNotEqual' : 183, + 'OpFOrdLessThan' : 184, + 'OpFUnordLessThan' : 185, + 'OpFOrdGreaterThan' : 186, + 'OpFUnordGreaterThan' : 187, + 'OpFOrdLessThanEqual' : 188, + 'OpFUnordLessThanEqual' : 189, + 'OpFOrdGreaterThanEqual' : 190, + 'OpFUnordGreaterThanEqual' : 191, + 'OpShiftRightLogical' : 194, + 'OpShiftRightArithmetic' : 195, + 'OpShiftLeftLogical' : 196, + 'OpBitwiseOr' : 197, + 'OpBitwiseXor' : 198, + 'OpBitwiseAnd' : 199, + 'OpNot' : 200, + 'OpBitFieldInsert' : 201, + 'OpBitFieldSExtract' : 202, + 'OpBitFieldUExtract' : 203, + 'OpBitReverse' : 204, + 'OpBitCount' : 205, + 'OpDPdx' : 207, + 'OpDPdy' : 208, + 'OpFwidth' : 209, + 'OpDPdxFine' : 210, + 'OpDPdyFine' : 211, + 'OpFwidthFine' : 212, + 'OpDPdxCoarse' : 213, + 'OpDPdyCoarse' : 214, + 'OpFwidthCoarse' : 215, + 'OpEmitVertex' : 218, + 'OpEndPrimitive' : 219, + 'OpEmitStreamVertex' : 220, + 'OpEndStreamPrimitive' : 221, + 'OpControlBarrier' : 224, + 'OpMemoryBarrier' : 225, + 'OpAtomicLoad' : 227, + 'OpAtomicStore' : 228, + 'OpAtomicExchange' : 229, + 'OpAtomicCompareExchange' : 230, + 'OpAtomicCompareExchangeWeak' : 231, + 'OpAtomicIIncrement' : 232, + 'OpAtomicIDecrement' : 233, + 'OpAtomicIAdd' : 234, + 'OpAtomicISub' : 235, + 'OpAtomicSMin' : 236, + 'OpAtomicUMin' : 237, + 'OpAtomicSMax' : 238, + 'OpAtomicUMax' : 239, + 'OpAtomicAnd' : 240, + 'OpAtomicOr' : 241, + 'OpAtomicXor' : 242, + 'OpPhi' : 245, + 'OpLoopMerge' : 246, + 'OpSelectionMerge' : 247, + 'OpLabel' : 248, + 'OpBranch' : 249, + 'OpBranchConditional' : 250, + 'OpSwitch' : 251, + 'OpKill' : 252, + 'OpReturn' : 253, + 'OpReturnValue' : 254, + 'OpUnreachable' : 255, + 'OpLifetimeStart' : 256, + 'OpLifetimeStop' : 257, + 'OpGroupAsyncCopy' : 259, + 'OpGroupWaitEvents' : 260, + 'OpGroupAll' : 261, + 'OpGroupAny' : 262, + 'OpGroupBroadcast' : 263, + 'OpGroupIAdd' : 264, + 'OpGroupFAdd' : 265, + 'OpGroupFMin' : 266, + 'OpGroupUMin' : 267, + 'OpGroupSMin' : 268, + 'OpGroupFMax' : 269, + 'OpGroupUMax' : 270, + 'OpGroupSMax' : 271, + 'OpReadPipe' : 274, + 'OpWritePipe' : 275, + 'OpReservedReadPipe' : 276, + 'OpReservedWritePipe' : 277, + 'OpReserveReadPipePackets' : 278, + 'OpReserveWritePipePackets' : 279, + 'OpCommitReadPipe' : 280, + 'OpCommitWritePipe' : 281, + 'OpIsValidReserveId' : 282, + 'OpGetNumPipePackets' : 283, + 'OpGetMaxPipePackets' : 284, + 'OpGroupReserveReadPipePackets' : 285, + 'OpGroupReserveWritePipePackets' : 286, + 'OpGroupCommitReadPipe' : 287, + 'OpGroupCommitWritePipe' : 288, + 'OpEnqueueMarker' : 291, + 'OpEnqueueKernel' : 292, + 'OpGetKernelNDrangeSubGroupCount' : 293, + 'OpGetKernelNDrangeMaxSubGroupSize' : 294, + 'OpGetKernelWorkGroupSize' : 295, + 'OpGetKernelPreferredWorkGroupSizeMultiple' : 296, + 'OpRetainEvent' : 297, + 'OpReleaseEvent' : 298, + 'OpCreateUserEvent' : 299, + 'OpIsValidEvent' : 300, + 'OpSetUserEventStatus' : 301, + 'OpCaptureEventProfilingInfo' : 302, + 'OpGetDefaultQueue' : 303, + 'OpBuildNDRange' : 304, + 'OpImageSparseSampleImplicitLod' : 305, + 'OpImageSparseSampleExplicitLod' : 306, + 'OpImageSparseSampleDrefImplicitLod' : 307, + 'OpImageSparseSampleDrefExplicitLod' : 308, + 'OpImageSparseSampleProjImplicitLod' : 309, + 'OpImageSparseSampleProjExplicitLod' : 310, + 'OpImageSparseSampleProjDrefImplicitLod' : 311, + 'OpImageSparseSampleProjDrefExplicitLod' : 312, + 'OpImageSparseFetch' : 313, + 'OpImageSparseGather' : 314, + 'OpImageSparseDrefGather' : 315, + 'OpImageSparseTexelsResident' : 316, + 'OpNoLine' : 317, + 'OpAtomicFlagTestAndSet' : 318, + 'OpAtomicFlagClear' : 319, + 'OpImageSparseRead' : 320, + 'OpSizeOf' : 321, + 'OpTypePipeStorage' : 322, + 'OpConstantPipeStorage' : 323, + 'OpCreatePipeFromPipeStorage' : 324, + 'OpGetKernelLocalSizeForSubgroupCount' : 325, + 'OpGetKernelMaxNumSubgroups' : 326, + 'OpTypeNamedBarrier' : 327, + 'OpNamedBarrierInitialize' : 328, + 'OpMemoryNamedBarrier' : 329, + 'OpModuleProcessed' : 330, + 'OpDecorateId' : 332, + 'OpSubgroupBallotKHR' : 4421, + 'OpSubgroupFirstInvocationKHR' : 4422, + 'OpSubgroupAllKHR' : 4428, + 'OpSubgroupAnyKHR' : 4429, + 'OpSubgroupAllEqualKHR' : 4430, + 'OpSubgroupReadInvocationKHR' : 4432, + 'OpGroupIAddNonUniformAMD' : 5000, + 'OpGroupFAddNonUniformAMD' : 5001, + 'OpGroupFMinNonUniformAMD' : 5002, + 'OpGroupUMinNonUniformAMD' : 5003, + 'OpGroupSMinNonUniformAMD' : 5004, + 'OpGroupFMaxNonUniformAMD' : 5005, + 'OpGroupUMaxNonUniformAMD' : 5006, + 'OpGroupSMaxNonUniformAMD' : 5007, + 'OpFragmentMaskFetchAMD' : 5011, + 'OpFragmentFetchAMD' : 5012, + 'OpSubgroupShuffleINTEL' : 5571, + 'OpSubgroupShuffleDownINTEL' : 5572, + 'OpSubgroupShuffleUpINTEL' : 5573, + 'OpSubgroupShuffleXorINTEL' : 5574, + 'OpSubgroupBlockReadINTEL' : 5575, + 'OpSubgroupBlockWriteINTEL' : 5576, + 'OpSubgroupImageBlockReadINTEL' : 5577, + 'OpSubgroupImageBlockWriteINTEL' : 5578, + 'OpDecorateStringGOOGLE' : 5632, + 'OpMemberDecorateStringGOOGLE' : 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/GLSL.std.450.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/GLSL.std.450.h new file mode 100644 index 00000000000..54cc00e9a88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/GLSL.std.450.h @@ -0,0 +1,131 @@ +/* +** Copyright (c) 2014-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef GLSLstd450_H +#define GLSLstd450_H + +static const int GLSLstd450Version = 100; +static const int GLSLstd450Revision = 3; + +enum GLSLstd450 { + GLSLstd450Bad = 0, // Don't use + + GLSLstd450Round = 1, + GLSLstd450RoundEven = 2, + GLSLstd450Trunc = 3, + GLSLstd450FAbs = 4, + GLSLstd450SAbs = 5, + GLSLstd450FSign = 6, + GLSLstd450SSign = 7, + GLSLstd450Floor = 8, + GLSLstd450Ceil = 9, + GLSLstd450Fract = 10, + + GLSLstd450Radians = 11, + GLSLstd450Degrees = 12, + GLSLstd450Sin = 13, + GLSLstd450Cos = 14, + GLSLstd450Tan = 15, + GLSLstd450Asin = 16, + GLSLstd450Acos = 17, + GLSLstd450Atan = 18, + GLSLstd450Sinh = 19, + GLSLstd450Cosh = 20, + GLSLstd450Tanh = 21, + GLSLstd450Asinh = 22, + GLSLstd450Acosh = 23, + GLSLstd450Atanh = 24, + GLSLstd450Atan2 = 25, + + GLSLstd450Pow = 26, + GLSLstd450Exp = 27, + GLSLstd450Log = 28, + GLSLstd450Exp2 = 29, + GLSLstd450Log2 = 30, + GLSLstd450Sqrt = 31, + GLSLstd450InverseSqrt = 32, + + GLSLstd450Determinant = 33, + GLSLstd450MatrixInverse = 34, + + GLSLstd450Modf = 35, // second operand needs an OpVariable to write to + GLSLstd450ModfStruct = 36, // no OpVariable operand + GLSLstd450FMin = 37, + GLSLstd450UMin = 38, + GLSLstd450SMin = 39, + GLSLstd450FMax = 40, + GLSLstd450UMax = 41, + GLSLstd450SMax = 42, + GLSLstd450FClamp = 43, + GLSLstd450UClamp = 44, + GLSLstd450SClamp = 45, + GLSLstd450FMix = 46, + GLSLstd450IMix = 47, // Reserved + GLSLstd450Step = 48, + GLSLstd450SmoothStep = 49, + + GLSLstd450Fma = 50, + GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to + GLSLstd450FrexpStruct = 52, // no OpVariable operand + GLSLstd450Ldexp = 53, + + GLSLstd450PackSnorm4x8 = 54, + GLSLstd450PackUnorm4x8 = 55, + GLSLstd450PackSnorm2x16 = 56, + GLSLstd450PackUnorm2x16 = 57, + GLSLstd450PackHalf2x16 = 58, + GLSLstd450PackDouble2x32 = 59, + GLSLstd450UnpackSnorm2x16 = 60, + GLSLstd450UnpackUnorm2x16 = 61, + GLSLstd450UnpackHalf2x16 = 62, + GLSLstd450UnpackSnorm4x8 = 63, + GLSLstd450UnpackUnorm4x8 = 64, + GLSLstd450UnpackDouble2x32 = 65, + + GLSLstd450Length = 66, + GLSLstd450Distance = 67, + GLSLstd450Cross = 68, + GLSLstd450Normalize = 69, + GLSLstd450FaceForward = 70, + GLSLstd450Reflect = 71, + GLSLstd450Refract = 72, + + GLSLstd450FindILsb = 73, + GLSLstd450FindSMsb = 74, + GLSLstd450FindUMsb = 75, + + GLSLstd450InterpolateAtCentroid = 76, + GLSLstd450InterpolateAtSample = 77, + GLSLstd450InterpolateAtOffset = 78, + + GLSLstd450NMin = 79, + GLSLstd450NMax = 80, + GLSLstd450NClamp = 81, + + GLSLstd450Count +}; + +#endif // #ifndef GLSLstd450_H diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/OpenCL.std.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/OpenCL.std.h new file mode 100644 index 00000000000..19a6688490c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/OpenCL.std.h @@ -0,0 +1,210 @@ +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +namespace OpenCLLIB { + +enum Entrypoints { + + // Section 2.1: Math extended instructions + Acos = 0, + Acosh = 1, + Acospi = 2, + Asin = 3, + Asinh = 4, + Asinpi = 5, + Atan = 6, + Atan2 = 7, + Atanh = 8, + Atanpi = 9, + Atan2pi = 10, + Cbrt = 11, + Ceil = 12, + Copysign = 13, + Cos = 14, + Cosh = 15, + Cospi = 16, + Erfc = 17, + Erf = 18, + Exp = 19, + Exp2 = 20, + Exp10 = 21, + Expm1 = 22, + Fabs = 23, + Fdim = 24, + Floor = 25, + Fma = 26, + Fmax = 27, + Fmin = 28, + Fmod = 29, + Fract = 30, + Frexp = 31, + Hypot = 32, + Ilogb = 33, + Ldexp = 34, + Lgamma = 35, + Lgamma_r = 36, + Log = 37, + Log2 = 38, + Log10 = 39, + Log1p = 40, + Logb = 41, + Mad = 42, + Maxmag = 43, + Minmag = 44, + Modf = 45, + Nan = 46, + Nextafter = 47, + Pow = 48, + Pown = 49, + Powr = 50, + Remainder = 51, + Remquo = 52, + Rint = 53, + Rootn = 54, + Round = 55, + Rsqrt = 56, + Sin = 57, + Sincos = 58, + Sinh = 59, + Sinpi = 60, + Sqrt = 61, + Tan = 62, + Tanh = 63, + Tanpi = 64, + Tgamma = 65, + Trunc = 66, + Half_cos = 67, + Half_divide = 68, + Half_exp = 69, + Half_exp2 = 70, + Half_exp10 = 71, + Half_log = 72, + Half_log2 = 73, + Half_log10 = 74, + Half_powr = 75, + Half_recip = 76, + Half_rsqrt = 77, + Half_sin = 78, + Half_sqrt = 79, + Half_tan = 80, + Native_cos = 81, + Native_divide = 82, + Native_exp = 83, + Native_exp2 = 84, + Native_exp10 = 85, + Native_log = 86, + Native_log2 = 87, + Native_log10 = 88, + Native_powr = 89, + Native_recip = 90, + Native_rsqrt = 91, + Native_sin = 92, + Native_sqrt = 93, + Native_tan = 94, + + // Section 2.2: Integer instructions + SAbs = 141, + SAbs_diff = 142, + SAdd_sat = 143, + UAdd_sat = 144, + SHadd = 145, + UHadd = 146, + SRhadd = 147, + URhadd = 148, + SClamp = 149, + UClamp = 150, + Clz = 151, + Ctz = 152, + SMad_hi = 153, + UMad_sat = 154, + SMad_sat = 155, + SMax = 156, + UMax = 157, + SMin = 158, + UMin = 159, + SMul_hi = 160, + Rotate = 161, + SSub_sat = 162, + USub_sat = 163, + U_Upsample = 164, + S_Upsample = 165, + Popcount = 166, + SMad24 = 167, + UMad24 = 168, + SMul24 = 169, + UMul24 = 170, + UAbs = 201, + UAbs_diff = 202, + UMul_hi = 203, + UMad_hi = 204, + + // Section 2.3: Common instructions + FClamp = 95, + Degrees = 96, + FMax_common = 97, + FMin_common = 98, + Mix = 99, + Radians = 100, + Step = 101, + Smoothstep = 102, + Sign = 103, + + // Section 2.4: Geometric instructions + Cross = 104, + Distance = 105, + Length = 106, + Normalize = 107, + Fast_distance = 108, + Fast_length = 109, + Fast_normalize = 110, + + // Section 2.5: Relational instructions + Bitselect = 186, + Select = 187, + + // Section 2.6: Vector Data Load and Store instructions + Vloadn = 171, + Vstoren = 172, + Vload_half = 173, + Vload_halfn = 174, + Vstore_half = 175, + Vstore_half_r = 176, + Vstore_halfn = 177, + Vstore_halfn_r = 178, + Vloada_halfn = 179, + Vstorea_halfn = 180, + Vstorea_halfn_r = 181, + + // Section 2.7: Miscellaneous Vector instructions + Shuffle = 182, + Shuffle2 = 183, + + // Section 2.8: Misc instructions + Printf = 184, + Prefetch = 185, +}; + +} // end namespace OpenCLLIB diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/extinst.glsl.std.450.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/extinst.glsl.std.450.grammar.json new file mode 100644 index 00000000000..3d9f39e76c9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/extinst.glsl.std.450.grammar.json @@ -0,0 +1,642 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "Round", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "RoundEven", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Trunc", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FAbs", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SAbs", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FSign", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SSign", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Floor", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ceil", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fract", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Radians", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "Degrees", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "Sin", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tan", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asin", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acos", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'y_over_x'" } + ] + }, + { + "opname" : "Sinh", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cosh", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tanh", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asinh", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acosh", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atanh", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan2", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Pow", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Exp", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Exp2", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log2", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Sqrt", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "InverseSqrt", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Determinant", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "MatrixInverse", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Modf", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "ModfStruct", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FMin", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMin", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMin", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FMax", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMax", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMax", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FClamp", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "UClamp", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "SClamp", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "FMix", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "IMix", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "Step", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SmoothStep", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fma", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "Frexp", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "FrexpStruct", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ldexp", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "PackSnorm4x8", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm4x8", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackSnorm2x16", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm2x16", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackHalf2x16", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackDouble2x32", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "UnpackSnorm2x16", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm2x16", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackHalf2x16", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "UnpackSnorm4x8", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm4x8", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackDouble2x32", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "Length", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Distance", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "Cross", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Normalize", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FaceForward", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'Nref'" } + ] + }, + { + "opname" : "Reflect", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" } + ] + }, + { + "opname" : "Refract", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'eta'" } + ] + }, + { + "opname" : "FindILsb", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindSMsb", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindUMsb", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "InterpolateAtCentroid", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtSample", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'sample'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtOffset", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'offset'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "NMin", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NMax", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NClamp", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/extinst.opencl.std.100.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/extinst.opencl.std.100.grammar.json new file mode 100644 index 00000000000..4fe45060bb9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/extinst.opencl.std.100.grammar.json @@ -0,0 +1,1279 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "acos", + "opcode" : 0, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acosh", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acospi", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asin", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinh", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinpi", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanh", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanpi", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2pi", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cbrt", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ceil", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "copysign", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cosh", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cospi", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erfc", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erf", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp2", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp10", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "expm1", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fabs", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fdim", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "floor", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fma", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fmax", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmod", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fract", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'ptr'" } + ] + }, + { + "opname" : "frexp", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "hypot", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "ilogb", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ldexp", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'k'" } + ] + }, + { + "opname" : "lgamma", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "lgamma_r", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'signp'" } + ] + }, + { + "opname" : "log", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log2", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log10", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log1p", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "logb", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "mad", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "maxmag", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "minmag", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "modf", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'iptr'" } + ] + }, + { + "opname" : "nan", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'nancode'" } + ] + }, + { + "opname" : "nextafter", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "pow", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y" } + ] + }, + { + "opname" : "pown", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "powr", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remainder", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remquo", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'quo'" } + ] + }, + { + "opname" : "rint", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rootn", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "round", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rsqrt", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sin", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sincos", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'cosval'" } + ] + }, + { + "opname" : "sinh", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sinpi", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sqrt", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tan", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanh", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanpi", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tgamma", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "trunc", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_cos", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_divide", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_exp", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp2", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp10", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log2", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log10", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_powr", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_recip", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_rsqrt", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sin", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sqrt", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_tan", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_cos", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_divide", + "opcode" : 82, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_exp", + "opcode" : 83, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp2", + "opcode" : 84, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp10", + "opcode" : 85, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log", + "opcode" : 86, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log2", + "opcode" : 87, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log10", + "opcode" : 88, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_powr", + "opcode" : 89, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_recip", + "opcode" : 90, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_rsqrt", + "opcode" : 91, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sin", + "opcode" : 92, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sqrt", + "opcode" : 93, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_tan", + "opcode" : 94, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs", + "opcode" : 141, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs_diff", + "opcode" : 142, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_add_sat", + "opcode" : 143, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_add_sat", + "opcode" : 144, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_hadd", + "opcode" : 145, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_hadd", + "opcode" : 146, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_rhadd", + "opcode" : 147, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_rhadd", + "opcode" : 148, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_clamp", + "opcode" : 149, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "u_clamp", + "opcode" : 150, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "clz", + "opcode" : 151, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ctz", + "opcode" : 152, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad_hi", + "opcode" : 153, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "u_mad_sat", + "opcode" : 154, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mad_sat", + "opcode" : 155, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_max", + "opcode" : 156, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_max", + "opcode" : 157, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_min", + "opcode" : 158, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_min", + "opcode" : 159, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_mul_hi", + "opcode" : 160, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "rotate", + "opcode" : 161, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "s_sub_sat", + "opcode" : 162, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_sub_sat", + "opcode" : 163, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_upsample", + "opcode" : 164, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "s_upsample", + "opcode" : 165, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "popcount", + "opcode" : 166, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad24", + "opcode" : 167, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "u_mad24", + "opcode" : 168, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mul24", + "opcode" : 169, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul24", + "opcode" : 170, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_abs", + "opcode" : 201, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "u_abs_diff", + "opcode" : 202, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul_hi", + "opcode" : 203, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mad_hi", + "opcode" : 204, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fclamp", + "opcode" : 95, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "degrees", + "opcode" :96, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "fmax_common", + "opcode" : 97, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin_common", + "opcode" : 98, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "mix", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "radians", + "opcode" : 100, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "step", + "opcode" : 101, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "smoothstep", + "opcode" : 102, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sign", + "opcode" : 103, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cross", + "opcode" : 104, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "distance", + "opcode" : 105, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "length", + "opcode" : 106, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "normalize", + "opcode" : 107, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_distance", + "opcode" : 108, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "fast_length", + "opcode" : 109, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_normalize", + "opcode" : 110, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "bitselect", + "opcode" : 186, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "select", + "opcode" : 187, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "vloadn", + "opcode" : 171, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstoren", + "opcode" : 172, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_half", + "opcode" : 173, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_halfn", + "opcode" : 174, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstore_half", + "opcode" : 175, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_half_r", + "opcode" : 176, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vstore_halfn", + "opcode" : 177, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_halfn_r", + "opcode" : 178, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vloada_halfn", + "opcode" : 179, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstorea_halfn", + "opcode" : 180, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstorea_halfn_r", + "opcode" : 181, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "shuffle", + "opcode" : 182, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "shuffle2", + "opcode" : 183, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "printf", + "opcode" : 184, + "operands" : [ + { "kind" : "IdRef", "name" : "'format'" }, + { "kind" : "IdRef", "name" : "'additional arguments'", "quantifier" : "*" } + ] + }, + { + "opname" : "prefetch", + "opcode" : 185, + "operands" : [ + { "kind" : "IdRef", "name" : "'ptr'" }, + { "kind" : "IdRef", "name" : "'num elements'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.core.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.core.grammar.json new file mode 100644 index 00000000000..393ee3c8497 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.core.grammar.json @@ -0,0 +1,5986 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "magic_number" : "0x07230203", + "major_version" : 1, + "minor_version" : 2, + "revision" : 2, + "instructions" : [ + { + "opname" : "OpNop", + "opcode" : 0 + }, + { + "opname" : "OpUndef", + "opcode" : 1, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSourceContinued", + "opcode" : 2, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Continued Source'" } + ] + }, + { + "opname" : "OpSource", + "opcode" : 3, + "operands" : [ + { "kind" : "SourceLanguage" }, + { "kind" : "LiteralInteger", "name" : "'Version'" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'File'" }, + { "kind" : "LiteralString", "quantifier" : "?", "name" : "'Source'" } + ] + }, + { + "opname" : "OpSourceExtension", + "opcode" : 4, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Extension'" } + ] + }, + { + "opname" : "OpName", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpMemberName", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpString", + "opcode" : 7, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'String'" } + ] + }, + { + "opname" : "OpLine", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'File'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" } + ] + }, + { + "opname" : "OpExtension", + "opcode" : 10, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInstImport", + "opcode" : 11, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInst", + "opcode" : 12, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Set'" }, + { "kind" : "LiteralExtInstInteger", "name" : "'Instruction'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Operand 1', +\n'Operand 2', +\n..." } + ] + }, + { + "opname" : "OpMemoryModel", + "opcode" : 14, + "operands" : [ + { "kind" : "AddressingModel" }, + { "kind" : "MemoryModel" } + ] + }, + { + "opname" : "OpEntryPoint", + "opcode" : 15, + "operands" : [ + { "kind" : "ExecutionModel" }, + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Interface'" } + ] + }, + { + "opname" : "OpExecutionMode", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "ExecutionMode", "name" : "'Mode'" } + ] + }, + { + "opname" : "OpCapability", + "opcode" : 17, + "operands" : [ + { "kind" : "Capability", "name" : "'Capability'" } + ] + }, + { + "opname" : "OpTypeVoid", + "opcode" : 19, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeBool", + "opcode" : 20, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeInt", + "opcode" : 21, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" }, + { "kind" : "LiteralInteger", "name" : "'Signedness'" } + ] + }, + { + "opname" : "OpTypeFloat", + "opcode" : 22, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" } + ] + }, + { + "opname" : "OpTypeVector", + "opcode" : 23, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Component Type'" }, + { "kind" : "LiteralInteger", "name" : "'Component Count'" } + ] + }, + { + "opname" : "OpTypeMatrix", + "opcode" : 24, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Column Type'" }, + { "kind" : "LiteralInteger", "name" : "'Column Count'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpTypeImage", + "opcode" : 25, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Type'" }, + { "kind" : "Dim" }, + { "kind" : "LiteralInteger", "name" : "'Depth'" }, + { "kind" : "LiteralInteger", "name" : "'Arrayed'" }, + { "kind" : "LiteralInteger", "name" : "'MS'" }, + { "kind" : "LiteralInteger", "name" : "'Sampled'" }, + { "kind" : "ImageFormat" }, + { "kind" : "AccessQualifier", "quantifier" : "?" } + ] + }, + { + "opname" : "OpTypeSampler", + "opcode" : 26, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeSampledImage", + "opcode" : 27, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image Type'" } + ] + }, + { + "opname" : "OpTypeArray", + "opcode" : 28, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" }, + { "kind" : "IdRef", "name" : "'Length'" } + ] + }, + { + "opname" : "OpTypeRuntimeArray", + "opcode" : 29, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpTypeStruct", + "opcode" : 30, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Member 0 type', +\n'member 1 type', +\n..." } + ] + }, + { + "opname" : "OpTypeOpaque", + "opcode" : 31, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "The name of the opaque type." } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypePointer", + "opcode" : 32, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "name" : "'Type'" } + ] + }, + { + "opname" : "OpTypeFunction", + "opcode" : 33, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Return Type'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..." } + ] + }, + { + "opname" : "OpTypeEvent", + "opcode" : 34, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypeDeviceEvent", + "opcode" : 35, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypeReserveId", + "opcode" : 36, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeQueue", + "opcode" : 37, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypePipe", + "opcode" : 38, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "AccessQualifier", "name" : "'Qualifier'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeForwardPointer", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer Type'" }, + { "kind" : "StorageClass" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpConstantTrue", + "opcode" : 41, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstantFalse", + "opcode" : 42, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstant", + "opcode" : 43, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConstantComposite", + "opcode" : 44, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpConstantSampler", + "opcode" : 45, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "SamplerAddressingMode" }, + { "kind" : "LiteralInteger", "name" : "'Param'" }, + { "kind" : "SamplerFilterMode" } + ], + "capabilities" : [ "LiteralSampler" ] + }, + { + "opname" : "OpConstantNull", + "opcode" : 46, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantTrue", + "opcode" : 48, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantFalse", + "opcode" : 49, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstant", + "opcode" : 50, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpSpecConstantComposite", + "opcode" : 51, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpSpecConstantOp", + "opcode" : 52, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralSpecConstantOpInteger", "name" : "'Opcode'" } + ] + }, + { + "opname" : "OpFunction", + "opcode" : 54, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "FunctionControl" }, + { "kind" : "IdRef", "name" : "'Function Type'" } + ] + }, + { + "opname" : "OpFunctionParameter", + "opcode" : 55, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpFunctionEnd", + "opcode" : 56 + }, + { + "opname" : "OpFunctionCall", + "opcode" : 57, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Function'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Argument 0', +\n'Argument 1', +\n..." } + ] + }, + { + "opname" : "OpVariable", + "opcode" : 59, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'Initializer'" } + ] + }, + { + "opname" : "OpImageTexelPointer", + "opcode" : 60, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Sample'" } + ] + }, + { + "opname" : "OpLoad", + "opcode" : 61, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpStore", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemory", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemorySized", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpAccessChain", + "opcode" : 65, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpInBoundsAccessChain", + "opcode" : 66, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpPtrAccessChain", + "opcode" : 67, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ + "Addresses", + "VariablePointers", + "VariablePointersStorageBuffer" + ] + }, + { + "opname" : "OpArrayLength", + "opcode" : 68, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Structure'" }, + { "kind" : "LiteralInteger", "name" : "'Array member'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpGenericPtrMemSemantics", + "opcode" : 69, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpInBoundsPtrAccessChain", + "opcode" : 70, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpDecorate", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpMemberDecorate", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'Structure Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpDecorationGroup", + "opcode" : 73, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpGroupDecorate", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpGroupMemberDecorate", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "PairIdRefLiteralInteger", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpVectorExtractDynamic", + "opcode" : 77, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorInsertDynamic", + "opcode" : 78, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorShuffle", + "opcode" : 79, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Components'" } + ] + }, + { + "opname" : "OpCompositeConstruct", + "opcode" : 80, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpCompositeExtract", + "opcode" : 81, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCompositeInsert", + "opcode" : 82, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCopyObject", + "opcode" : 83, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpTranspose", + "opcode" : 84, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpSampledImage", + "opcode" : 86, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Sampler'" } + ] + }, + { + "opname" : "OpImageSampleImplicitLod", + "opcode" : 87, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleExplicitLod", + "opcode" : 88, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ] + }, + { + "opname" : "OpImageSampleDrefImplicitLod", + "opcode" : 89, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleDrefExplicitLod", + "opcode" : 90, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjImplicitLod", + "opcode" : 91, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjExplicitLod", + "opcode" : 92, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefImplicitLod", + "opcode" : 93, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefExplicitLod", + "opcode" : 94, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageFetch", + "opcode" : 95, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageGather", + "opcode" : 96, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageDrefGather", + "opcode" : 97, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageRead", + "opcode" : 98, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageWrite", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Texel'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImage", + "opcode" : 100, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" } + ] + }, + { + "opname" : "OpImageQueryFormat", + "opcode" : 101, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQueryOrder", + "opcode" : 102, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQuerySizeLod", + "opcode" : 103, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Level of Detail'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySize", + "opcode" : 104, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLod", + "opcode" : 105, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLevels", + "opcode" : 106, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySamples", + "opcode" : 107, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpConvertFToU", + "opcode" : 109, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertFToS", + "opcode" : 110, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertSToF", + "opcode" : 111, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpConvertUToF", + "opcode" : 112, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpUConvert", + "opcode" : 113, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpSConvert", + "opcode" : 114, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpFConvert", + "opcode" : 115, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpQuantizeToF16", + "opcode" : 116, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConvertPtrToU", + "opcode" : 117, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpSatConvertSToU", + "opcode" : 118, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSatConvertUToS", + "opcode" : 119, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpConvertUToPtr", + "opcode" : 120, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Integer Value'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpPtrCastToGeneric", + "opcode" : 121, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtr", + "opcode" : 122, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtrExplicit", + "opcode" : 123, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "StorageClass", "name" : "'Storage'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpBitcast", + "opcode" : 124, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSNegate", + "opcode" : 126, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpFNegate", + "opcode" : 127, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpIAdd", + "opcode" : 128, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFAdd", + "opcode" : 129, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISub", + "opcode" : 130, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFSub", + "opcode" : 131, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpIMul", + "opcode" : 132, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMul", + "opcode" : 133, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUDiv", + "opcode" : 134, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSDiv", + "opcode" : 135, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFDiv", + "opcode" : 136, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMod", + "opcode" : 137, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSRem", + "opcode" : 138, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMod", + "opcode" : 139, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFRem", + "opcode" : 140, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMod", + "opcode" : 141, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpVectorTimesScalar", + "opcode" : 142, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ] + }, + { + "opname" : "OpMatrixTimesScalar", + "opcode" : 143, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpVectorTimesMatrix", + "opcode" : 144, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesVector", + "opcode" : 145, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesMatrix", + "opcode" : 146, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'LeftMatrix'" }, + { "kind" : "IdRef", "name" : "'RightMatrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpOuterProduct", + "opcode" : 147, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpDot", + "opcode" : 148, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ] + }, + { + "opname" : "OpIAddCarry", + "opcode" : 149, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISubBorrow", + "opcode" : 150, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMulExtended", + "opcode" : 151, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMulExtended", + "opcode" : 152, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpAny", + "opcode" : 154, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpAll", + "opcode" : 155, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpIsNan", + "opcode" : 156, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsInf", + "opcode" : 157, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsFinite", + "opcode" : 158, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpIsNormal", + "opcode" : 159, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSignBitSet", + "opcode" : 160, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLessOrGreater", + "opcode" : 161, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpOrdered", + "opcode" : 162, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpUnordered", + "opcode" : 163, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLogicalEqual", + "opcode" : 164, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNotEqual", + "opcode" : 165, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalOr", + "opcode" : 166, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalAnd", + "opcode" : 167, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNot", + "opcode" : 168, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSelect", + "opcode" : 169, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'Object 1'" }, + { "kind" : "IdRef", "name" : "'Object 2'" } + ] + }, + { + "opname" : "OpIEqual", + "opcode" : 170, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpINotEqual", + "opcode" : 171, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThan", + "opcode" : 172, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThan", + "opcode" : 173, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThanEqual", + "opcode" : 174, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThanEqual", + "opcode" : 175, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThan", + "opcode" : 176, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThan", + "opcode" : 177, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThanEqual", + "opcode" : 178, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThanEqual", + "opcode" : 179, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdEqual", + "opcode" : 180, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordEqual", + "opcode" : 181, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdNotEqual", + "opcode" : 182, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordNotEqual", + "opcode" : 183, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThan", + "opcode" : 184, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThan", + "opcode" : 185, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThan", + "opcode" : 186, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThan", + "opcode" : 187, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThanEqual", + "opcode" : 188, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThanEqual", + "opcode" : 189, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThanEqual", + "opcode" : 190, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThanEqual", + "opcode" : 191, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpShiftRightLogical", + "opcode" : 194, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftRightArithmetic", + "opcode" : 195, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftLeftLogical", + "opcode" : 196, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpBitwiseOr", + "opcode" : 197, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseXor", + "opcode" : 198, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseAnd", + "opcode" : 199, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpNot", + "opcode" : 200, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpBitFieldInsert", + "opcode" : 201, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Insert'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldSExtract", + "opcode" : 202, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldUExtract", + "opcode" : 203, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitReverse", + "opcode" : 204, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitCount", + "opcode" : 205, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ] + }, + { + "opname" : "OpDPdx", + "opcode" : 207, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdy", + "opcode" : 208, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpFwidth", + "opcode" : 209, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdxFine", + "opcode" : 210, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyFine", + "opcode" : 211, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthFine", + "opcode" : 212, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdxCoarse", + "opcode" : 213, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyCoarse", + "opcode" : 214, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthCoarse", + "opcode" : 215, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpEmitVertex", + "opcode" : 218, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEndPrimitive", + "opcode" : 219, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEmitStreamVertex", + "opcode" : 220, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpEndStreamPrimitive", + "opcode" : 221, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpControlBarrier", + "opcode" : 224, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpMemoryBarrier", + "opcode" : 225, + "operands" : [ + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicLoad", + "opcode" : 227, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicStore", + "opcode" : 228, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicExchange", + "opcode" : 229, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicCompareExchange", + "opcode" : 230, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ] + }, + { + "opname" : "OpAtomicCompareExchangeWeak", + "opcode" : 231, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicIIncrement", + "opcode" : 232, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIDecrement", + "opcode" : 233, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIAdd", + "opcode" : 234, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicISub", + "opcode" : 235, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMin", + "opcode" : 236, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMin", + "opcode" : 237, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMax", + "opcode" : 238, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMax", + "opcode" : 239, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicAnd", + "opcode" : 240, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicOr", + "opcode" : 241, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicXor", + "opcode" : 242, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpPhi", + "opcode" : 245, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "PairIdRefIdRef", "quantifier" : "*", "name" : "'Variable, Parent, ...'" } + ] + }, + { + "opname" : "OpLoopMerge", + "opcode" : 246, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "IdRef", "name" : "'Continue Target'" }, + { "kind" : "LoopControl" } + ] + }, + { + "opname" : "OpSelectionMerge", + "opcode" : 247, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "SelectionControl" } + ] + }, + { + "opname" : "OpLabel", + "opcode" : 248, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpBranch", + "opcode" : 249, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target Label'" } + ] + }, + { + "opname" : "OpBranchConditional", + "opcode" : 250, + "operands" : [ + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'True Label'" }, + { "kind" : "IdRef", "name" : "'False Label'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Branch weights'" } + ] + }, + { + "opname" : "OpSwitch", + "opcode" : 251, + "operands" : [ + { "kind" : "IdRef", "name" : "'Selector'" }, + { "kind" : "IdRef", "name" : "'Default'" }, + { "kind" : "PairLiteralIntegerIdRef", "quantifier" : "*", "name" : "'Target'" } + ] + }, + { + "opname" : "OpKill", + "opcode" : 252, + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpReturn", + "opcode" : 253 + }, + { + "opname" : "OpReturnValue", + "opcode" : 254, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpUnreachable", + "opcode" : 255 + }, + { + "opname" : "OpLifetimeStart", + "opcode" : 256, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLifetimeStop", + "opcode" : 257, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAsyncCopy", + "opcode" : 259, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Destination'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Num Elements'" }, + { "kind" : "IdRef", "name" : "'Stride'" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupWaitEvents", + "opcode" : 260, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Events List'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAll", + "opcode" : 261, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupAny", + "opcode" : 262, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupBroadcast", + "opcode" : 263, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'LocalId'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupIAdd", + "opcode" : 264, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAdd", + "opcode" : 265, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMin", + "opcode" : 266, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMin", + "opcode" : 267, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMin", + "opcode" : 268, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMax", + "opcode" : 269, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMax", + "opcode" : 270, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMax", + "opcode" : 271, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpReadPipe", + "opcode" : 274, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpWritePipe", + "opcode" : 275, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedReadPipe", + "opcode" : 276, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedWritePipe", + "opcode" : 277, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveReadPipePackets", + "opcode" : 278, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveWritePipePackets", + "opcode" : 279, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitReadPipe", + "opcode" : 280, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitWritePipe", + "opcode" : 281, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpIsValidReserveId", + "opcode" : 282, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetNumPipePackets", + "opcode" : 283, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetMaxPipePackets", + "opcode" : 284, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveReadPipePackets", + "opcode" : 285, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveWritePipePackets", + "opcode" : 286, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitReadPipe", + "opcode" : 287, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitWritePipe", + "opcode" : 288, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpEnqueueMarker", + "opcode" : 291, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpEnqueueKernel", + "opcode" : 292, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Local Size'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeSubGroupCount", + "opcode" : 293, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeMaxSubGroupSize", + "opcode" : 294, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelWorkGroupSize", + "opcode" : 295, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelPreferredWorkGroupSizeMultiple", + "opcode" : 296, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpRetainEvent", + "opcode" : 297, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpReleaseEvent", + "opcode" : 298, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCreateUserEvent", + "opcode" : 299, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpIsValidEvent", + "opcode" : 300, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpSetUserEventStatus", + "opcode" : 301, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Status'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCaptureEventProfilingInfo", + "opcode" : 302, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Profiling Info'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetDefaultQueue", + "opcode" : 303, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpBuildNDRange", + "opcode" : 304, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'GlobalWorkSize'" }, + { "kind" : "IdRef", "name" : "'LocalWorkSize'" }, + { "kind" : "IdRef", "name" : "'GlobalWorkOffset'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpImageSparseSampleImplicitLod", + "opcode" : 305, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleExplicitLod", + "opcode" : 306, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefImplicitLod", + "opcode" : 307, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefExplicitLod", + "opcode" : 308, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjImplicitLod", + "opcode" : 309, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjExplicitLod", + "opcode" : 310, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjDrefImplicitLod", + "opcode" : 311, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjDrefExplicitLod", + "opcode" : 312, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseFetch", + "opcode" : 313, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseGather", + "opcode" : 314, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseDrefGather", + "opcode" : 315, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseTexelsResident", + "opcode" : 316, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Resident Code'" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpNoLine", + "opcode" : 317 + }, + { + "opname" : "OpAtomicFlagTestAndSet", + "opcode" : 318, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicFlagClear", + "opcode" : 319, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageSparseRead", + "opcode" : 320, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpSizeOf", + "opcode" : 321, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpTypePipeStorage", + "opcode" : 322, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "PipeStorage" ] + }, + { + "opname" : "OpConstantPipeStorage", + "opcode" : 323, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Packet Size'" }, + { "kind" : "LiteralInteger", "name" : "'Packet Alignment'" }, + { "kind" : "LiteralInteger", "name" : "'Capacity'" } + ], + "capabilities" : [ "PipeStorage" ] + }, + { + "opname" : "OpCreatePipeFromPipeStorage", + "opcode" : 324, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe Storage'" } + ], + "capabilities" : [ "PipeStorage" ] + }, + { + "opname" : "OpGetKernelLocalSizeForSubgroupCount", + "opcode" : 325, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Subgroup Count'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "SubgroupDispatch" ] + }, + { + "opname" : "OpGetKernelMaxNumSubgroups", + "opcode" : 326, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "SubgroupDispatch" ] + }, + { + "opname" : "OpTypeNamedBarrier", + "opcode" : 327, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "NamedBarrier" ] + }, + { + "opname" : "OpNamedBarrierInitialize", + "opcode" : 328, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Subgroup Count'" } + ], + "capabilities" : [ "NamedBarrier" ] + }, + { + "opname" : "OpMemoryNamedBarrier", + "opcode" : 329, + "operands" : [ + { "kind" : "IdRef", "name" : "'Named Barrier'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "NamedBarrier" ] + }, + { + "opname" : "OpModuleProcessed", + "opcode" : 330, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Process'" } + ] + }, + { + "opname" : "OpExecutionModeId", + "opcode" : 331, + "operands" : [ + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "ExecutionMode", "name" : "'Mode'" } + ] + }, + { + "opname" : "OpDecorateId", + "opcode" : 332, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpSubgroupBallotKHR", + "opcode" : 4421, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpSubgroupFirstInvocationKHR", + "opcode" : 4422, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpSubgroupAllKHR", + "opcode" : 4428, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupAnyKHR", + "opcode" : 4429, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupAllEqualKHR", + "opcode" : 4430, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupVoteKHR" ] + }, + { + "opname" : "OpSubgroupReadInvocationKHR", + "opcode" : 4432, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "opname" : "OpGroupIAddNonUniformAMD", + "opcode" : 5000, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAddNonUniformAMD", + "opcode" : 5001, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMinNonUniformAMD", + "opcode" : 5002, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMinNonUniformAMD", + "opcode" : 5003, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMinNonUniformAMD", + "opcode" : 5004, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMaxNonUniformAMD", + "opcode" : 5005, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMaxNonUniformAMD", + "opcode" : 5006, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMaxNonUniformAMD", + "opcode" : 5007, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpFragmentMaskFetchAMD", + "opcode" : 5011, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "FragmentMaskAMD" ] + }, + { + "opname" : "OpFragmentFetchAMD", + "opcode" : 5012, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Fragment Index'" } + ], + "capabilities" : [ "FragmentMaskAMD" ] + }, + { + "opname" : "OpSubgroupShuffleINTEL", + "opcode" : 5571, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'InvocationId'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleDownINTEL", + "opcode" : 5572, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Next'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleUpINTEL", + "opcode" : 5573, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Previous'" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupShuffleXorINTEL", + "opcode" : 5574, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ] + }, + { + "opname" : "OpSubgroupBlockReadINTEL", + "opcode" : 5575, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Ptr'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupBlockWriteINTEL", + "opcode" : 5576, + "operands" : [ + { "kind" : "IdRef", "name" : "'Ptr'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupImageBlockReadINTEL", + "opcode" : 5577, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ] + }, + { + "opname" : "OpSubgroupImageBlockWriteINTEL", + "opcode" : 5578, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ] + }, + { + "opname" : "OpDecorateStringGOOGLE", + "opcode" : 5632, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string" ] + }, + { + "opname" : "OpMemberDecorateStringGOOGLE", + "opcode" : 5633, + "operands" : [ + { "kind" : "IdRef", "name" : "'Struct Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string" ] + } + ], + "operand_kinds" : [ + { + "category" : "BitEnum", + "kind" : "ImageOperands", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Bias", + "value" : "0x0001", + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Lod", + "value" : "0x0002", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Grad", + "value" : "0x0004", + "parameters" : [ + { "kind" : "IdRef" }, + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffset", + "value" : "0x0008", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Offset", + "value" : "0x0010", + "capabilities" : [ "ImageGatherExtended" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffsets", + "value" : "0x0020", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Sample", + "value" : "0x0040", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "MinLod", + "value" : "0x0080", + "capabilities" : [ "MinLod" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FPFastMathMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "NotNaN", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NotInf", + "value" : "0x0002", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NSZ", + "value" : "0x0004", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AllowRecip", + "value" : "0x0008", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Fast", + "value" : "0x0010", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "SelectionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Flatten", + "value" : "0x0001" + }, + { + "enumerant" : "DontFlatten", + "value" : "0x0002" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "LoopControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Unroll", + "value" : "0x0001" + }, + { + "enumerant" : "DontUnroll", + "value" : "0x0002" + }, + { + "enumerant" : "DependencyInfinite", + "value" : "0x0004" + }, + { + "enumerant" : "DependencyLength", + "value" : "0x0008", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FunctionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Inline", + "value" : "0x0001" + }, + { + "enumerant" : "DontInline", + "value" : "0x0002" + }, + { + "enumerant" : "Pure", + "value" : "0x0004" + }, + { + "enumerant" : "Const", + "value" : "0x0008" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemorySemantics", + "enumerants" : [ + { + "enumerant" : "Relaxed", + "value" : "0x0000" + }, + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Acquire", + "value" : "0x0002" + }, + { + "enumerant" : "Release", + "value" : "0x0004" + }, + { + "enumerant" : "AcquireRelease", + "value" : "0x0008" + }, + { + "enumerant" : "SequentiallyConsistent", + "value" : "0x0010" + }, + { + "enumerant" : "UniformMemory", + "value" : "0x0040", + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupMemory", + "value" : "0x0080" + }, + { + "enumerant" : "WorkgroupMemory", + "value" : "0x0100" + }, + { + "enumerant" : "CrossWorkgroupMemory", + "value" : "0x0200" + }, + { + "enumerant" : "AtomicCounterMemory", + "value" : "0x0400", + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "ImageMemory", + "value" : "0x0800" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemoryAccess", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Volatile", + "value" : "0x0001" + }, + { + "enumerant" : "Aligned", + "value" : "0x0002", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + }, + { + "enumerant" : "Nontemporal", + "value" : "0x0004" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "KernelProfilingInfo", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "CmdExecTime", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SourceLanguage", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "ESSL", + "value" : 1 + }, + { + "enumerant" : "GLSL", + "value" : 2 + }, + { + "enumerant" : "OpenCL_C", + "value" : 3 + }, + { + "enumerant" : "OpenCL_CPP", + "value" : 4 + }, + { + "enumerant" : "HLSL", + "value" : 5 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionModel", + "enumerants" : [ + { + "enumerant" : "Vertex", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TessellationControl", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessellationEvaluation", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Geometry", + "value" : 3, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Fragment", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLCompute", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Kernel", + "value" : 6, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AddressingModel", + "enumerants" : [ + { + "enumerant" : "Logical", + "value" : 0 + }, + { + "enumerant" : "Physical32", + "value" : 1, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Physical64", + "value" : 2, + "capabilities" : [ "Addresses" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "MemoryModel", + "enumerants" : [ + { + "enumerant" : "Simple", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSL450", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OpenCL", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionMode", + "enumerants" : [ + { + "enumerant" : "Invocations", + "value" : 0, + "capabilities" : [ "Geometry" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Number of <>'" } + ] + }, + { + "enumerant" : "SpacingEqual", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalEven", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalOdd", + "value" : 3, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCw", + "value" : 4, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCcw", + "value" : 5, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PixelCenterInteger", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginUpperLeft", + "value" : 7, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginLowerLeft", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "EarlyFragmentTests", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointMode", + "value" : 10, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Xfb", + "value" : 11, + "capabilities" : [ "TransformFeedback" ] + }, + { + "enumerant" : "DepthReplacing", + "value" : 12, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthGreater", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthLess", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthUnchanged", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "LocalSize", + "value" : 17, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "LocalSizeHint", + "value" : 18, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "InputPoints", + "value" : 19, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLines", + "value" : 20, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLinesAdjacency", + "value" : 21, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Triangles", + "value" : 22, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InputTrianglesAdjacency", + "value" : 23, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Quads", + "value" : 24, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Isolines", + "value" : 25, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "OutputVertices", + "value" : 26, + "capabilities" : [ "Geometry", "Tessellation" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vertex count'" } + ] + }, + { + "enumerant" : "OutputPoints", + "value" : 27, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputLineStrip", + "value" : 28, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputTriangleStrip", + "value" : 29, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "VecTypeHint", + "value" : 30, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vector type'" } + ] + }, + { + "enumerant" : "ContractionOff", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Initializer", + "value" : 33, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Finalizer", + "value" : 34, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupSize", + "value" : 35, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Subgroup Size'" } + ] + }, + { + "enumerant" : "SubgroupsPerWorkgroup", + "value" : 36, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Subgroups Per Workgroup'" } + ] + }, + { + "enumerant" : "SubgroupsPerWorkgroupId", + "value" : 37, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Subgroups Per Workgroup'" } + ] + }, + { + "enumerant" : "LocalSizeId", + "value" : 38, + "parameters" : [ + { "kind" : "IdRef", "name" : "'x size'" }, + { "kind" : "IdRef", "name" : "'y size'" }, + { "kind" : "IdRef", "name" : "'z size'" } + ] + }, + { + "enumerant" : "LocalSizeHintId", + "value" : 39, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Local Size Hint'" } + ] + }, + { + "enumerant" : "PostDepthCoverage", + "value" : 4446, + "capabilities" : [ "SampleMaskPostDepthCoverage" ] + }, + { + "enumerant" : "StencilRefReplacingEXT", + "value" : 5027, + "capabilities" : [ "StencilExportEXT" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "StorageClass", + "enumerants" : [ + { + "enumerant" : "UniformConstant", + "value" : 0 + }, + { + "enumerant" : "Input", + "value" : 1 + }, + { + "enumerant" : "Uniform", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Output", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Workgroup", + "value" : 4 + }, + { + "enumerant" : "CrossWorkgroup", + "value" : 5 + }, + { + "enumerant" : "Private", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Function", + "value" : 7 + }, + { + "enumerant" : "Generic", + "value" : 8, + "capabilities" : [ "GenericPointer" ] + }, + { + "enumerant" : "PushConstant", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "AtomicCounter", + "value" : 10, + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "Image", + "value" : 11 + }, + { + "enumerant" : "StorageBuffer", + "value" : 12, + "extensions" : [ + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers" + ], + "capabilities" : [ "Shader" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Dim", + "enumerants" : [ + { + "enumerant" : "1D", + "value" : 0, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "2D", + "value" : 1 + }, + { + "enumerant" : "3D", + "value" : 2 + }, + { + "enumerant" : "Cube", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rect", + "value" : 4, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "Buffer", + "value" : 5, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "SubpassData", + "value" : 6, + "capabilities" : [ "InputAttachment" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerAddressingMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ClampToEdge", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Clamp", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Repeat", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RepeatMirrored", + "value" : 4, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerFilterMode", + "enumerants" : [ + { + "enumerant" : "Nearest", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Linear", + "value" : 1, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageFormat", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "Rgba32f", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16f", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32f", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8Snorm", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32f", + "value" : 6, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16f", + "value" : 7, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R11fG11fB10f", + "value" : 8, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16f", + "value" : 9, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16", + "value" : 10, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgb10A2", + "value" : 11, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16", + "value" : 12, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8", + "value" : 13, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16", + "value" : 14, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8", + "value" : 15, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16Snorm", + "value" : 16, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16Snorm", + "value" : 17, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8Snorm", + "value" : 18, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16Snorm", + "value" : 19, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8Snorm", + "value" : 20, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32i", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16i", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8i", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32i", + "value" : 24, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32i", + "value" : 25, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16i", + "value" : 26, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8i", + "value" : 27, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16i", + "value" : 28, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8i", + "value" : 29, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32ui", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16ui", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8ui", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32ui", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgb10a2ui", + "value" : 34, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg32ui", + "value" : 35, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16ui", + "value" : 36, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8ui", + "value" : 37, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16ui", + "value" : 38, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8ui", + "value" : 39, + "capabilities" : [ "StorageImageExtendedFormats" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelOrder", + "enumerants" : [ + { + "enumerant" : "R", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "A", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RG", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RA", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGB", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBA", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BGRA", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ARGB", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Intensity", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Luminance", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Rx", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGx", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBx", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Depth", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "DepthStencil", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGB", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBx", + "value" : 16, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBA", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sBGRA", + "value" : 18, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ABGR", + "value" : 19, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelDataType", + "enumerants" : [ + { + "enumerant" : "SnormInt8", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SnormInt16", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt8", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt16", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort565", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort555", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt8", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt16", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt32", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt8", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt16", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt32", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "HalfFloat", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt24", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010_2", + "value" : 16, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FPRoundingMode", + "enumerants" : [ + { + "enumerant" : "RTE", + "value" : 0, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTZ", + "value" : 1, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTP", + "value" : 2, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + }, + { + "enumerant" : "RTN", + "value" : 3, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "LinkageType", + "enumerants" : [ + { + "enumerant" : "Export", + "value" : 0, + "capabilities" : [ "Linkage" ] + }, + { + "enumerant" : "Import", + "value" : 1, + "capabilities" : [ "Linkage" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AccessQualifier", + "enumerants" : [ + { + "enumerant" : "ReadOnly", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WriteOnly", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ReadWrite", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FunctionParameterAttribute", + "enumerants" : [ + { + "enumerant" : "Zext", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sext", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ByVal", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sret", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoAlias", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoCapture", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoWrite", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoReadWrite", + "value" : 7, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Decoration", + "enumerants" : [ + { + "enumerant" : "RelaxedPrecision", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SpecId", + "value" : 1, + "capabilities" : [ "Shader", "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Specialization Constant ID'" } + ] + }, + { + "enumerant" : "Block", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "BufferBlock", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "RowMajor", + "value" : 4, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ColMajor", + "value" : 5, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ArrayStride", + "value" : 6, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Array Stride'" } + ] + }, + { + "enumerant" : "MatrixStride", + "value" : 7, + "capabilities" : [ "Matrix" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Matrix Stride'" } + ] + }, + { + "enumerant" : "GLSLShared", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSLPacked", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CPacked", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BuiltIn", + "value" : 11, + "parameters" : [ + { "kind" : "BuiltIn" } + ] + }, + { + "enumerant" : "NoPerspective", + "value" : 13, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Flat", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Patch", + "value" : 15, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Centroid", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sample", + "value" : 17, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "Invariant", + "value" : 18, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Restrict", + "value" : 19 + }, + { + "enumerant" : "Aliased", + "value" : 20 + }, + { + "enumerant" : "Volatile", + "value" : 21 + }, + { + "enumerant" : "Constant", + "value" : 22, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Coherent", + "value" : 23 + }, + { + "enumerant" : "NonWritable", + "value" : 24 + }, + { + "enumerant" : "NonReadable", + "value" : 25 + }, + { + "enumerant" : "Uniform", + "value" : 26, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SaturatedConversion", + "value" : 28, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Stream", + "value" : 29, + "capabilities" : [ "GeometryStreams" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Stream Number'" } + ] + }, + { + "enumerant" : "Location", + "value" : 30, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Location'" } + ] + }, + { + "enumerant" : "Component", + "value" : 31, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Component'" } + ] + }, + { + "enumerant" : "Index", + "value" : 32, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Index'" } + ] + }, + { + "enumerant" : "Binding", + "value" : 33, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Binding Point'" } + ] + }, + { + "enumerant" : "DescriptorSet", + "value" : 34, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Descriptor Set'" } + ] + }, + { + "enumerant" : "Offset", + "value" : 35, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Byte Offset'" } + ] + }, + { + "enumerant" : "XfbBuffer", + "value" : 36, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Buffer Number'" } + ] + }, + { + "enumerant" : "XfbStride", + "value" : 37, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Stride'" } + ] + }, + { + "enumerant" : "FuncParamAttr", + "value" : 38, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FunctionParameterAttribute", "name" : "'Function Parameter Attribute'" } + ] + }, + { + "enumerant" : "FPRoundingMode", + "value" : 39, + "capabilities" : [ + "Kernel", + "StorageUniformBufferBlock16", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16" + ], + "parameters" : [ + { "kind" : "FPRoundingMode", "name" : "'Floating-Point Rounding Mode'" } + ] + }, + { + "enumerant" : "FPFastMathMode", + "value" : 40, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FPFastMathMode", "name" : "'Fast-Math Mode'" } + ] + }, + { + "enumerant" : "LinkageAttributes", + "value" : 41, + "capabilities" : [ "Linkage" ], + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "LinkageType", "name" : "'Linkage Type'" } + ] + }, + { + "enumerant" : "NoContraction", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InputAttachmentIndex", + "value" : 43, + "capabilities" : [ "InputAttachment" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Attachment Index'" } + ] + }, + { + "enumerant" : "Alignment", + "value" : 44, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Alignment'" } + ] + }, + { + "enumerant" : "MaxByteOffset", + "value" : 45, + "capabilities" : [ "Addresses" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Max Byte Offset'" } + ] + }, + { + "enumerant" : "AlignmentId", + "value" : 46, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Alignment'" } + ] + }, + { + "enumerant" : "MaxByteOffsetId", + "value" : 47, + "capabilities" : [ "Addresses" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Max Byte Offset'" } + ] + }, + { + "enumerant" : "ExplicitInterpAMD", + "value" : 4999 + }, + { + "enumerant" : "OverrideCoverageNV", + "value" : 5248, + "capabilities" : [ "SampleMaskOverrideCoverageNV" ] + }, + { + "enumerant" : "PassthroughNV", + "value" : 5250, + "capabilities" : [ "GeometryShaderPassthroughNV" ] + }, + { + "enumerant" : "ViewportRelativeNV", + "value" : 5252, + "capabilities" : [ "ShaderViewportMaskNV" ] + }, + { + "enumerant" : "SecondaryViewportRelativeNV", + "value" : 5256, + "capabilities" : [ "ShaderStereoViewNV" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Offset'" } + ] + }, + { + "enumerant" : "HlslCounterBufferGOOGLE", + "value" : 5634, + "parameters" : [ + { "kind" : "IdRef", "name" : "'Counter Buffer'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + }, + { + "enumerant" : "HlslSemanticGOOGLE", + "value" : 5635, + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Semantic'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "BuiltIn", + "enumerants" : [ + { + "enumerant" : "Position", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointSize", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 3, + "capabilities" : [ "ClipDistance" ] + }, + { + "enumerant" : "CullDistance", + "value" : 4, + "capabilities" : [ "CullDistance" ] + }, + { + "enumerant" : "VertexId", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceId", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PrimitiveId", + "value" : 7, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InvocationId", + "value" : 8, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "Layer", + "value" : 9, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ViewportIndex", + "value" : 10, + "capabilities" : [ "MultiViewport" ] + }, + { + "enumerant" : "TessLevelOuter", + "value" : 11, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessLevelInner", + "value" : 12, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessCoord", + "value" : 13, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PatchVertices", + "value" : 14, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "FragCoord", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointCoord", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FrontFacing", + "value" : 17, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampleId", + "value" : 18, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SamplePosition", + "value" : 19, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SampleMask", + "value" : 20, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FragDepth", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "HelperInvocation", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "NumWorkgroups", + "value" : 24 + }, + { + "enumerant" : "WorkgroupSize", + "value" : 25 + }, + { + "enumerant" : "WorkgroupId", + "value" : 26 + }, + { + "enumerant" : "LocalInvocationId", + "value" : 27 + }, + { + "enumerant" : "GlobalInvocationId", + "value" : 28 + }, + { + "enumerant" : "LocalInvocationIndex", + "value" : 29 + }, + { + "enumerant" : "WorkDim", + "value" : 30, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalSize", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "EnqueuedWorkgroupSize", + "value" : 32, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalOffset", + "value" : 33, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalLinearId", + "value" : 34, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupSize", + "value" : 36, + "capabilities" : [ "Kernel", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupMaxSize", + "value" : 37, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumSubgroups", + "value" : 38, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumEnqueuedSubgroups", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupId", + "value" : 40, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupLocalInvocationId", + "value" : 41, + "capabilities" : [ "Kernel", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "VertexIndex", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceIndex", + "value" : 43, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupEqMaskKHR", + "value" : 4416, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupGeMaskKHR", + "value" : 4417, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupGtMaskKHR", + "value" : 4418, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupLeMaskKHR", + "value" : 4419, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupLtMaskKHR", + "value" : 4420, + "capabilities" : [ "SubgroupBallotKHR" ] + }, + { + "enumerant" : "BaseVertex", + "value" : 4424, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "BaseInstance", + "value" : 4425, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "DrawIndex", + "value" : 4426, + "capabilities" : [ "DrawParameters" ] + }, + { + "enumerant" : "DeviceIndex", + "value" : 4438, + "capabilities" : [ "DeviceGroup" ] + }, + { + "enumerant" : "ViewIndex", + "value" : 4440, + "capabilities" : [ "MultiView" ] + }, + { + "enumerant" : "BaryCoordNoPerspAMD", + "value" : 4992 + }, + { + "enumerant" : "BaryCoordNoPerspCentroidAMD", + "value" : 4993 + }, + { + "enumerant" : "BaryCoordNoPerspSampleAMD", + "value" : 4994 + }, + { + "enumerant" : "BaryCoordSmoothAMD", + "value" : 4995 + }, + { + "enumerant" : "BaryCoordSmoothCentroidAMD", + "value" : 4996 + }, + { + "enumerant" : "BaryCoordSmoothSampleAMD", + "value" : 4997 + }, + { + "enumerant" : "BaryCoordPullModelAMD", + "value" : 4998 + }, + { + "enumerant" : "FragStencilRefEXT", + "value" : 5014, + "capabilities" : [ "StencilExportEXT" ] + }, + { + "enumerant" : "ViewportMaskNV", + "value" : 5253, + "capabilities" : [ "ShaderViewportMaskNV" ] + }, + { + "enumerant" : "SecondaryPositionNV", + "value" : 5257, + "capabilities" : [ "ShaderStereoViewNV" ] + }, + { + "enumerant" : "SecondaryViewportMaskNV", + "value" : 5258, + "capabilities" : [ "ShaderStereoViewNV" ] + }, + { + "enumerant" : "PositionPerViewNV", + "value" : 5261, + "capabilities" : [ "PerViewAttributesNV" ] + }, + { + "enumerant" : "ViewportMaskPerViewNV", + "value" : 5262, + "capabilities" : [ "PerViewAttributesNV" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Scope", + "enumerants" : [ + { + "enumerant" : "CrossDevice", + "value" : 0 + }, + { + "enumerant" : "Device", + "value" : 1 + }, + { + "enumerant" : "Workgroup", + "value" : 2 + }, + { + "enumerant" : "Subgroup", + "value" : 3 + }, + { + "enumerant" : "Invocation", + "value" : 4 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "GroupOperation", + "enumerants" : [ + { + "enumerant" : "Reduce", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "InclusiveScan", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ExclusiveScan", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "KernelEnqueueFlags", + "enumerants" : [ + { + "enumerant" : "NoWait", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitKernel", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitWorkGroup", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Capability", + "enumerants" : [ + { + "enumerant" : "Matrix", + "value" : 0 + }, + { + "enumerant" : "Shader", + "value" : 1, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "Geometry", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Tessellation", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Addresses", + "value" : 4 + }, + { + "enumerant" : "Linkage", + "value" : 5 + }, + { + "enumerant" : "Kernel", + "value" : 6 + }, + { + "enumerant" : "Vector16", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16Buffer", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16", + "value" : 9 + }, + { + "enumerant" : "Float64", + "value" : 10 + }, + { + "enumerant" : "Int64", + "value" : 11 + }, + { + "enumerant" : "Int64Atomics", + "value" : 12, + "capabilities" : [ "Int64" ] + }, + { + "enumerant" : "ImageBasic", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ImageReadWrite", + "value" : 14, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "ImageMipmap", + "value" : 15, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "Pipes", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Groups", + "value" : 18 + }, + { + "enumerant" : "DeviceEnqueue", + "value" : 19, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "LiteralSampler", + "value" : 20, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AtomicStorage", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Int16", + "value" : 22 + }, + { + "enumerant" : "TessellationPointSize", + "value" : 23, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "GeometryPointSize", + "value" : 24, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ImageGatherExtended", + "value" : 25, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageMultisample", + "value" : 27, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "UniformBufferArrayDynamicIndexing", + "value" : 28, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledImageArrayDynamicIndexing", + "value" : 29, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageBufferArrayDynamicIndexing", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageArrayDynamicIndexing", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CullDistance", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageCubeArray", + "value" : 34, + "capabilities" : [ "SampledCubeArray" ] + }, + { + "enumerant" : "SampleRateShading", + "value" : 35, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageRect", + "value" : 36, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "SampledRect", + "value" : 37, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GenericPointer", + "value" : 38, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Int8", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "InputAttachment", + "value" : 40, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SparseResidency", + "value" : 41, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MinLod", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sampled1D", + "value" : 43 + }, + { + "enumerant" : "Image1D", + "value" : 44, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "SampledCubeArray", + "value" : 45, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledBuffer", + "value" : 46 + }, + { + "enumerant" : "ImageBuffer", + "value" : 47, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "ImageMSArray", + "value" : 48, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageExtendedFormats", + "value" : 49, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageQuery", + "value" : 50, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DerivativeControl", + "value" : 51, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InterpolationFunction", + "value" : 52, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TransformFeedback", + "value" : 53, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GeometryStreams", + "value" : 54, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "StorageImageReadWithoutFormat", + "value" : 55, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageWriteWithoutFormat", + "value" : 56, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MultiViewport", + "value" : 57, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "SubgroupDispatch", + "value" : 58, + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "enumerant" : "NamedBarrier", + "value" : 59, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "PipeStorage", + "value" : 60, + "capabilities" : [ "Pipes" ] + }, + { + "enumerant" : "SubgroupBallotKHR", + "value" : 4423, + "extensions" : [ "SPV_KHR_shader_ballot" ] + }, + { + "enumerant" : "DrawParameters", + "value" : 4427, + "extensions" : [ "SPV_KHR_shader_draw_parameters" ] + }, + { + "enumerant" : "SubgroupVoteKHR", + "value" : 4431, + "extensions" : [ "SPV_KHR_subgroup_vote" ] + }, + { + "enumerant" : "StorageBuffer16BitAccess", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageUniformBufferBlock16", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "UniformAndStorageBuffer16BitAccess", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageUniform16", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StoragePushConstant16", + "value" : 4435, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "StorageInputOutput16", + "value" : 4436, + "extensions" : [ "SPV_KHR_16bit_storage" ] + }, + { + "enumerant" : "DeviceGroup", + "value" : 4437, + "extensions" : [ "SPV_KHR_device_group" ] + }, + { + "enumerant" : "MultiView", + "value" : 4439, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_multiview" ] + }, + { + "enumerant" : "VariablePointersStorageBuffer", + "value" : 4441, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_variable_pointers" ] + }, + { + "enumerant" : "VariablePointers", + "value" : 4442, + "capabilities" : [ "VariablePointersStorageBuffer" ], + "extensions" : [ "SPV_KHR_variable_pointers" ] + }, + { + "enumerant": "AtomicStorageOps", + "value": 4445, + "extensions": [ "SPV_KHR_shader_atomic_counter_ops" ] + }, + { + "enumerant" : "SampleMaskPostDepthCoverage", + "value" : 4447, + "extensions" : [ "SPV_KHR_post_depth_coverage" ] + }, + { + "enumerant" : "ImageGatherBiasLodAMD", + "value" : 5009, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_texture_gather_bias_lod" ] + }, + { + "enumerant" : "FragmentMaskAMD", + "value" : 5010, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_fragment_mask" ] + }, + { + "enumerant" : "StencilExportEXT", + "value" : 5013, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_shader_stencil_export" ] + }, + { + "enumerant" : "ImageReadWriteLodAMD", + "value" : 5015, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_image_load_store_lod" ] + }, + { + "enumerant" : "SampleMaskOverrideCoverageNV", + "value" : 5249, + "capabilities" : [ "SampleRateShading" ], + "extensions" : [ "SPV_NV_sample_mask_override_coverage" ] + }, + { + "enumerant" : "GeometryShaderPassthroughNV", + "value" : 5251, + "capabilities" : [ "Geometry" ], + "extensions" : [ "SPV_NV_geometry_shader_passthrough" ] + }, + { + "enumerant" : "ShaderViewportIndexLayerEXT", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_EXT_shader_viewport_index_layer" ] + }, + { + "enumerant" : "ShaderViewportIndexLayerNV", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_NV_viewport_array2" ] + }, + { + "enumerant" : "ShaderViewportMaskNV", + "value" : 5255, + "capabilities" : [ "ShaderViewportIndexLayerNV" ], + "extensions" : [ "SPV_NV_viewport_array2" ] + }, + { + "enumerant" : "ShaderStereoViewNV", + "value" : 5259, + "capabilities" : [ "ShaderViewportMaskNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ] + }, + { + "enumerant" : "PerViewAttributesNV", + "value" : 5260, + "capabilities" : [ "MultiView" ], + "extensions" : [ "SPV_NVX_multiview_per_view_attributes" ] + }, + { + "enumerant" : "SubgroupShuffleINTEL", + "value" : 5568, + "extensions" : [ "SPV_INTEL_subgroups" ] + }, + { + "enumerant" : "SubgroupBufferBlockIOINTEL", + "value" : 5569, + "extensions" : [ "SPV_INTEL_subgroups" ] + }, + { + "enumerant" : "SubgroupImageBlockIOINTEL", + "value" : 5570, + "extensions" : [ "SPV_INTEL_subgroups" ] + } + ] + }, + { + "category" : "Id", + "kind" : "IdResultType", + "doc" : "Reference to an representing the result's type of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdResult", + "doc" : "Definition of an representing the result of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdMemorySemantics", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the MemorySemantics operand kind" + }, + { + "category" : "Id", + "kind" : "IdScope", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the Scope operand kind" + }, + { + "category" : "Id", + "kind" : "IdRef", + "doc" : "Reference to an " + }, + { + "category" : "Literal", + "kind" : "LiteralInteger", + "doc" : "An integer consuming one or more words" + }, + { + "category" : "Literal", + "kind" : "LiteralString", + "doc" : "A null-terminated stream of characters consuming an integral number of words" + }, + { + "category" : "Literal", + "kind" : "LiteralContextDependentNumber", + "doc" : "A literal number whose size and format are determined by a previous operand in the enclosing instruction" + }, + { + "category" : "Literal", + "kind" : "LiteralExtInstInteger", + "doc" : "A 32-bit unsigned integer indicating which instruction to use and determining the layout of following operands (for OpExtInst)" + }, + { + "category" : "Literal", + "kind" : "LiteralSpecConstantOpInteger", + "doc" : "An opcode indicating the operation to be performed and determining the layout of following operands (for OpSpecConstantOp)" + }, + { + "category" : "Composite", + "kind" : "PairLiteralIntegerIdRef", + "bases" : [ "LiteralInteger", "IdRef" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefLiteralInteger", + "bases" : [ "IdRef", "LiteralInteger" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefIdRef", + "bases" : [ "IdRef", "IdRef" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.h new file mode 100644 index 00000000000..7c6d884d8e4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.h @@ -0,0 +1,1021 @@ +/* +** Copyright (c) 2014-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +/* +** This header is automatically generated by the same tool that creates +** the Binary Section of the SPIR-V specification. +*/ + +/* +** Enumeration tokens for SPIR-V, in various styles: +** C, C++, C++11, JSON, Lua, Python +** +** - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +** - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +** - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +** - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +** - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +** +** Some tokens act like mask values, which can be OR'd together, +** while others are mutually exclusive. The mask-like ones have +** "Mask" in their name, and a parallel enum that has the shift +** amount (1 << x) for each corresponding enumerant. +*/ + +#ifndef spirv_H +#define spirv_H + +typedef unsigned int SpvId; + +#define SPV_VERSION 0x10200 +#define SPV_REVISION 2 + +static const unsigned int SpvMagicNumber = 0x07230203; +static const unsigned int SpvVersion = 0x00010200; +static const unsigned int SpvRevision = 2; +static const unsigned int SpvOpCodeMask = 0xffff; +static const unsigned int SpvWordCountShift = 16; + +typedef enum SpvSourceLanguage_ { + SpvSourceLanguageUnknown = 0, + SpvSourceLanguageESSL = 1, + SpvSourceLanguageGLSL = 2, + SpvSourceLanguageOpenCL_C = 3, + SpvSourceLanguageOpenCL_CPP = 4, + SpvSourceLanguageHLSL = 5, + SpvSourceLanguageMax = 0x7fffffff, +} SpvSourceLanguage; + +typedef enum SpvExecutionModel_ { + SpvExecutionModelVertex = 0, + SpvExecutionModelTessellationControl = 1, + SpvExecutionModelTessellationEvaluation = 2, + SpvExecutionModelGeometry = 3, + SpvExecutionModelFragment = 4, + SpvExecutionModelGLCompute = 5, + SpvExecutionModelKernel = 6, + SpvExecutionModelMax = 0x7fffffff, +} SpvExecutionModel; + +typedef enum SpvAddressingModel_ { + SpvAddressingModelLogical = 0, + SpvAddressingModelPhysical32 = 1, + SpvAddressingModelPhysical64 = 2, + SpvAddressingModelMax = 0x7fffffff, +} SpvAddressingModel; + +typedef enum SpvMemoryModel_ { + SpvMemoryModelSimple = 0, + SpvMemoryModelGLSL450 = 1, + SpvMemoryModelOpenCL = 2, + SpvMemoryModelMax = 0x7fffffff, +} SpvMemoryModel; + +typedef enum SpvExecutionMode_ { + SpvExecutionModeInvocations = 0, + SpvExecutionModeSpacingEqual = 1, + SpvExecutionModeSpacingFractionalEven = 2, + SpvExecutionModeSpacingFractionalOdd = 3, + SpvExecutionModeVertexOrderCw = 4, + SpvExecutionModeVertexOrderCcw = 5, + SpvExecutionModePixelCenterInteger = 6, + SpvExecutionModeOriginUpperLeft = 7, + SpvExecutionModeOriginLowerLeft = 8, + SpvExecutionModeEarlyFragmentTests = 9, + SpvExecutionModePointMode = 10, + SpvExecutionModeXfb = 11, + SpvExecutionModeDepthReplacing = 12, + SpvExecutionModeDepthGreater = 14, + SpvExecutionModeDepthLess = 15, + SpvExecutionModeDepthUnchanged = 16, + SpvExecutionModeLocalSize = 17, + SpvExecutionModeLocalSizeHint = 18, + SpvExecutionModeInputPoints = 19, + SpvExecutionModeInputLines = 20, + SpvExecutionModeInputLinesAdjacency = 21, + SpvExecutionModeTriangles = 22, + SpvExecutionModeInputTrianglesAdjacency = 23, + SpvExecutionModeQuads = 24, + SpvExecutionModeIsolines = 25, + SpvExecutionModeOutputVertices = 26, + SpvExecutionModeOutputPoints = 27, + SpvExecutionModeOutputLineStrip = 28, + SpvExecutionModeOutputTriangleStrip = 29, + SpvExecutionModeVecTypeHint = 30, + SpvExecutionModeContractionOff = 31, + SpvExecutionModeInitializer = 33, + SpvExecutionModeFinalizer = 34, + SpvExecutionModeSubgroupSize = 35, + SpvExecutionModeSubgroupsPerWorkgroup = 36, + SpvExecutionModeSubgroupsPerWorkgroupId = 37, + SpvExecutionModeLocalSizeId = 38, + SpvExecutionModeLocalSizeHintId = 39, + SpvExecutionModePostDepthCoverage = 4446, + SpvExecutionModeStencilRefReplacingEXT = 5027, + SpvExecutionModeMax = 0x7fffffff, +} SpvExecutionMode; + +typedef enum SpvStorageClass_ { + SpvStorageClassUniformConstant = 0, + SpvStorageClassInput = 1, + SpvStorageClassUniform = 2, + SpvStorageClassOutput = 3, + SpvStorageClassWorkgroup = 4, + SpvStorageClassCrossWorkgroup = 5, + SpvStorageClassPrivate = 6, + SpvStorageClassFunction = 7, + SpvStorageClassGeneric = 8, + SpvStorageClassPushConstant = 9, + SpvStorageClassAtomicCounter = 10, + SpvStorageClassImage = 11, + SpvStorageClassStorageBuffer = 12, + SpvStorageClassMax = 0x7fffffff, +} SpvStorageClass; + +typedef enum SpvDim_ { + SpvDim1D = 0, + SpvDim2D = 1, + SpvDim3D = 2, + SpvDimCube = 3, + SpvDimRect = 4, + SpvDimBuffer = 5, + SpvDimSubpassData = 6, + SpvDimMax = 0x7fffffff, +} SpvDim; + +typedef enum SpvSamplerAddressingMode_ { + SpvSamplerAddressingModeNone = 0, + SpvSamplerAddressingModeClampToEdge = 1, + SpvSamplerAddressingModeClamp = 2, + SpvSamplerAddressingModeRepeat = 3, + SpvSamplerAddressingModeRepeatMirrored = 4, + SpvSamplerAddressingModeMax = 0x7fffffff, +} SpvSamplerAddressingMode; + +typedef enum SpvSamplerFilterMode_ { + SpvSamplerFilterModeNearest = 0, + SpvSamplerFilterModeLinear = 1, + SpvSamplerFilterModeMax = 0x7fffffff, +} SpvSamplerFilterMode; + +typedef enum SpvImageFormat_ { + SpvImageFormatUnknown = 0, + SpvImageFormatRgba32f = 1, + SpvImageFormatRgba16f = 2, + SpvImageFormatR32f = 3, + SpvImageFormatRgba8 = 4, + SpvImageFormatRgba8Snorm = 5, + SpvImageFormatRg32f = 6, + SpvImageFormatRg16f = 7, + SpvImageFormatR11fG11fB10f = 8, + SpvImageFormatR16f = 9, + SpvImageFormatRgba16 = 10, + SpvImageFormatRgb10A2 = 11, + SpvImageFormatRg16 = 12, + SpvImageFormatRg8 = 13, + SpvImageFormatR16 = 14, + SpvImageFormatR8 = 15, + SpvImageFormatRgba16Snorm = 16, + SpvImageFormatRg16Snorm = 17, + SpvImageFormatRg8Snorm = 18, + SpvImageFormatR16Snorm = 19, + SpvImageFormatR8Snorm = 20, + SpvImageFormatRgba32i = 21, + SpvImageFormatRgba16i = 22, + SpvImageFormatRgba8i = 23, + SpvImageFormatR32i = 24, + SpvImageFormatRg32i = 25, + SpvImageFormatRg16i = 26, + SpvImageFormatRg8i = 27, + SpvImageFormatR16i = 28, + SpvImageFormatR8i = 29, + SpvImageFormatRgba32ui = 30, + SpvImageFormatRgba16ui = 31, + SpvImageFormatRgba8ui = 32, + SpvImageFormatR32ui = 33, + SpvImageFormatRgb10a2ui = 34, + SpvImageFormatRg32ui = 35, + SpvImageFormatRg16ui = 36, + SpvImageFormatRg8ui = 37, + SpvImageFormatR16ui = 38, + SpvImageFormatR8ui = 39, + SpvImageFormatMax = 0x7fffffff, +} SpvImageFormat; + +typedef enum SpvImageChannelOrder_ { + SpvImageChannelOrderR = 0, + SpvImageChannelOrderA = 1, + SpvImageChannelOrderRG = 2, + SpvImageChannelOrderRA = 3, + SpvImageChannelOrderRGB = 4, + SpvImageChannelOrderRGBA = 5, + SpvImageChannelOrderBGRA = 6, + SpvImageChannelOrderARGB = 7, + SpvImageChannelOrderIntensity = 8, + SpvImageChannelOrderLuminance = 9, + SpvImageChannelOrderRx = 10, + SpvImageChannelOrderRGx = 11, + SpvImageChannelOrderRGBx = 12, + SpvImageChannelOrderDepth = 13, + SpvImageChannelOrderDepthStencil = 14, + SpvImageChannelOrdersRGB = 15, + SpvImageChannelOrdersRGBx = 16, + SpvImageChannelOrdersRGBA = 17, + SpvImageChannelOrdersBGRA = 18, + SpvImageChannelOrderABGR = 19, + SpvImageChannelOrderMax = 0x7fffffff, +} SpvImageChannelOrder; + +typedef enum SpvImageChannelDataType_ { + SpvImageChannelDataTypeSnormInt8 = 0, + SpvImageChannelDataTypeSnormInt16 = 1, + SpvImageChannelDataTypeUnormInt8 = 2, + SpvImageChannelDataTypeUnormInt16 = 3, + SpvImageChannelDataTypeUnormShort565 = 4, + SpvImageChannelDataTypeUnormShort555 = 5, + SpvImageChannelDataTypeUnormInt101010 = 6, + SpvImageChannelDataTypeSignedInt8 = 7, + SpvImageChannelDataTypeSignedInt16 = 8, + SpvImageChannelDataTypeSignedInt32 = 9, + SpvImageChannelDataTypeUnsignedInt8 = 10, + SpvImageChannelDataTypeUnsignedInt16 = 11, + SpvImageChannelDataTypeUnsignedInt32 = 12, + SpvImageChannelDataTypeHalfFloat = 13, + SpvImageChannelDataTypeFloat = 14, + SpvImageChannelDataTypeUnormInt24 = 15, + SpvImageChannelDataTypeUnormInt101010_2 = 16, + SpvImageChannelDataTypeMax = 0x7fffffff, +} SpvImageChannelDataType; + +typedef enum SpvImageOperandsShift_ { + SpvImageOperandsBiasShift = 0, + SpvImageOperandsLodShift = 1, + SpvImageOperandsGradShift = 2, + SpvImageOperandsConstOffsetShift = 3, + SpvImageOperandsOffsetShift = 4, + SpvImageOperandsConstOffsetsShift = 5, + SpvImageOperandsSampleShift = 6, + SpvImageOperandsMinLodShift = 7, + SpvImageOperandsMax = 0x7fffffff, +} SpvImageOperandsShift; + +typedef enum SpvImageOperandsMask_ { + SpvImageOperandsMaskNone = 0, + SpvImageOperandsBiasMask = 0x00000001, + SpvImageOperandsLodMask = 0x00000002, + SpvImageOperandsGradMask = 0x00000004, + SpvImageOperandsConstOffsetMask = 0x00000008, + SpvImageOperandsOffsetMask = 0x00000010, + SpvImageOperandsConstOffsetsMask = 0x00000020, + SpvImageOperandsSampleMask = 0x00000040, + SpvImageOperandsMinLodMask = 0x00000080, +} SpvImageOperandsMask; + +typedef enum SpvFPFastMathModeShift_ { + SpvFPFastMathModeNotNaNShift = 0, + SpvFPFastMathModeNotInfShift = 1, + SpvFPFastMathModeNSZShift = 2, + SpvFPFastMathModeAllowRecipShift = 3, + SpvFPFastMathModeFastShift = 4, + SpvFPFastMathModeMax = 0x7fffffff, +} SpvFPFastMathModeShift; + +typedef enum SpvFPFastMathModeMask_ { + SpvFPFastMathModeMaskNone = 0, + SpvFPFastMathModeNotNaNMask = 0x00000001, + SpvFPFastMathModeNotInfMask = 0x00000002, + SpvFPFastMathModeNSZMask = 0x00000004, + SpvFPFastMathModeAllowRecipMask = 0x00000008, + SpvFPFastMathModeFastMask = 0x00000010, +} SpvFPFastMathModeMask; + +typedef enum SpvFPRoundingMode_ { + SpvFPRoundingModeRTE = 0, + SpvFPRoundingModeRTZ = 1, + SpvFPRoundingModeRTP = 2, + SpvFPRoundingModeRTN = 3, + SpvFPRoundingModeMax = 0x7fffffff, +} SpvFPRoundingMode; + +typedef enum SpvLinkageType_ { + SpvLinkageTypeExport = 0, + SpvLinkageTypeImport = 1, + SpvLinkageTypeMax = 0x7fffffff, +} SpvLinkageType; + +typedef enum SpvAccessQualifier_ { + SpvAccessQualifierReadOnly = 0, + SpvAccessQualifierWriteOnly = 1, + SpvAccessQualifierReadWrite = 2, + SpvAccessQualifierMax = 0x7fffffff, +} SpvAccessQualifier; + +typedef enum SpvFunctionParameterAttribute_ { + SpvFunctionParameterAttributeZext = 0, + SpvFunctionParameterAttributeSext = 1, + SpvFunctionParameterAttributeByVal = 2, + SpvFunctionParameterAttributeSret = 3, + SpvFunctionParameterAttributeNoAlias = 4, + SpvFunctionParameterAttributeNoCapture = 5, + SpvFunctionParameterAttributeNoWrite = 6, + SpvFunctionParameterAttributeNoReadWrite = 7, + SpvFunctionParameterAttributeMax = 0x7fffffff, +} SpvFunctionParameterAttribute; + +typedef enum SpvDecoration_ { + SpvDecorationRelaxedPrecision = 0, + SpvDecorationSpecId = 1, + SpvDecorationBlock = 2, + SpvDecorationBufferBlock = 3, + SpvDecorationRowMajor = 4, + SpvDecorationColMajor = 5, + SpvDecorationArrayStride = 6, + SpvDecorationMatrixStride = 7, + SpvDecorationGLSLShared = 8, + SpvDecorationGLSLPacked = 9, + SpvDecorationCPacked = 10, + SpvDecorationBuiltIn = 11, + SpvDecorationNoPerspective = 13, + SpvDecorationFlat = 14, + SpvDecorationPatch = 15, + SpvDecorationCentroid = 16, + SpvDecorationSample = 17, + SpvDecorationInvariant = 18, + SpvDecorationRestrict = 19, + SpvDecorationAliased = 20, + SpvDecorationVolatile = 21, + SpvDecorationConstant = 22, + SpvDecorationCoherent = 23, + SpvDecorationNonWritable = 24, + SpvDecorationNonReadable = 25, + SpvDecorationUniform = 26, + SpvDecorationSaturatedConversion = 28, + SpvDecorationStream = 29, + SpvDecorationLocation = 30, + SpvDecorationComponent = 31, + SpvDecorationIndex = 32, + SpvDecorationBinding = 33, + SpvDecorationDescriptorSet = 34, + SpvDecorationOffset = 35, + SpvDecorationXfbBuffer = 36, + SpvDecorationXfbStride = 37, + SpvDecorationFuncParamAttr = 38, + SpvDecorationFPRoundingMode = 39, + SpvDecorationFPFastMathMode = 40, + SpvDecorationLinkageAttributes = 41, + SpvDecorationNoContraction = 42, + SpvDecorationInputAttachmentIndex = 43, + SpvDecorationAlignment = 44, + SpvDecorationMaxByteOffset = 45, + SpvDecorationAlignmentId = 46, + SpvDecorationMaxByteOffsetId = 47, + SpvDecorationExplicitInterpAMD = 4999, + SpvDecorationOverrideCoverageNV = 5248, + SpvDecorationPassthroughNV = 5250, + SpvDecorationViewportRelativeNV = 5252, + SpvDecorationSecondaryViewportRelativeNV = 5256, + SpvDecorationHlslCounterBufferGOOGLE = 5634, + SpvDecorationHlslSemanticGOOGLE = 5635, + SpvDecorationMax = 0x7fffffff, +} SpvDecoration; + +typedef enum SpvBuiltIn_ { + SpvBuiltInPosition = 0, + SpvBuiltInPointSize = 1, + SpvBuiltInClipDistance = 3, + SpvBuiltInCullDistance = 4, + SpvBuiltInVertexId = 5, + SpvBuiltInInstanceId = 6, + SpvBuiltInPrimitiveId = 7, + SpvBuiltInInvocationId = 8, + SpvBuiltInLayer = 9, + SpvBuiltInViewportIndex = 10, + SpvBuiltInTessLevelOuter = 11, + SpvBuiltInTessLevelInner = 12, + SpvBuiltInTessCoord = 13, + SpvBuiltInPatchVertices = 14, + SpvBuiltInFragCoord = 15, + SpvBuiltInPointCoord = 16, + SpvBuiltInFrontFacing = 17, + SpvBuiltInSampleId = 18, + SpvBuiltInSamplePosition = 19, + SpvBuiltInSampleMask = 20, + SpvBuiltInFragDepth = 22, + SpvBuiltInHelperInvocation = 23, + SpvBuiltInNumWorkgroups = 24, + SpvBuiltInWorkgroupSize = 25, + SpvBuiltInWorkgroupId = 26, + SpvBuiltInLocalInvocationId = 27, + SpvBuiltInGlobalInvocationId = 28, + SpvBuiltInLocalInvocationIndex = 29, + SpvBuiltInWorkDim = 30, + SpvBuiltInGlobalSize = 31, + SpvBuiltInEnqueuedWorkgroupSize = 32, + SpvBuiltInGlobalOffset = 33, + SpvBuiltInGlobalLinearId = 34, + SpvBuiltInSubgroupSize = 36, + SpvBuiltInSubgroupMaxSize = 37, + SpvBuiltInNumSubgroups = 38, + SpvBuiltInNumEnqueuedSubgroups = 39, + SpvBuiltInSubgroupId = 40, + SpvBuiltInSubgroupLocalInvocationId = 41, + SpvBuiltInVertexIndex = 42, + SpvBuiltInInstanceIndex = 43, + SpvBuiltInSubgroupEqMaskKHR = 4416, + SpvBuiltInSubgroupGeMaskKHR = 4417, + SpvBuiltInSubgroupGtMaskKHR = 4418, + SpvBuiltInSubgroupLeMaskKHR = 4419, + SpvBuiltInSubgroupLtMaskKHR = 4420, + SpvBuiltInBaseVertex = 4424, + SpvBuiltInBaseInstance = 4425, + SpvBuiltInDrawIndex = 4426, + SpvBuiltInDeviceIndex = 4438, + SpvBuiltInViewIndex = 4440, + SpvBuiltInBaryCoordNoPerspAMD = 4992, + SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993, + SpvBuiltInBaryCoordNoPerspSampleAMD = 4994, + SpvBuiltInBaryCoordSmoothAMD = 4995, + SpvBuiltInBaryCoordSmoothCentroidAMD = 4996, + SpvBuiltInBaryCoordSmoothSampleAMD = 4997, + SpvBuiltInBaryCoordPullModelAMD = 4998, + SpvBuiltInFragStencilRefEXT = 5014, + SpvBuiltInViewportMaskNV = 5253, + SpvBuiltInSecondaryPositionNV = 5257, + SpvBuiltInSecondaryViewportMaskNV = 5258, + SpvBuiltInPositionPerViewNV = 5261, + SpvBuiltInViewportMaskPerViewNV = 5262, + SpvBuiltInMax = 0x7fffffff, +} SpvBuiltIn; + +typedef enum SpvSelectionControlShift_ { + SpvSelectionControlFlattenShift = 0, + SpvSelectionControlDontFlattenShift = 1, + SpvSelectionControlMax = 0x7fffffff, +} SpvSelectionControlShift; + +typedef enum SpvSelectionControlMask_ { + SpvSelectionControlMaskNone = 0, + SpvSelectionControlFlattenMask = 0x00000001, + SpvSelectionControlDontFlattenMask = 0x00000002, +} SpvSelectionControlMask; + +typedef enum SpvLoopControlShift_ { + SpvLoopControlUnrollShift = 0, + SpvLoopControlDontUnrollShift = 1, + SpvLoopControlDependencyInfiniteShift = 2, + SpvLoopControlDependencyLengthShift = 3, + SpvLoopControlMax = 0x7fffffff, +} SpvLoopControlShift; + +typedef enum SpvLoopControlMask_ { + SpvLoopControlMaskNone = 0, + SpvLoopControlUnrollMask = 0x00000001, + SpvLoopControlDontUnrollMask = 0x00000002, + SpvLoopControlDependencyInfiniteMask = 0x00000004, + SpvLoopControlDependencyLengthMask = 0x00000008, +} SpvLoopControlMask; + +typedef enum SpvFunctionControlShift_ { + SpvFunctionControlInlineShift = 0, + SpvFunctionControlDontInlineShift = 1, + SpvFunctionControlPureShift = 2, + SpvFunctionControlConstShift = 3, + SpvFunctionControlMax = 0x7fffffff, +} SpvFunctionControlShift; + +typedef enum SpvFunctionControlMask_ { + SpvFunctionControlMaskNone = 0, + SpvFunctionControlInlineMask = 0x00000001, + SpvFunctionControlDontInlineMask = 0x00000002, + SpvFunctionControlPureMask = 0x00000004, + SpvFunctionControlConstMask = 0x00000008, +} SpvFunctionControlMask; + +typedef enum SpvMemorySemanticsShift_ { + SpvMemorySemanticsAcquireShift = 1, + SpvMemorySemanticsReleaseShift = 2, + SpvMemorySemanticsAcquireReleaseShift = 3, + SpvMemorySemanticsSequentiallyConsistentShift = 4, + SpvMemorySemanticsUniformMemoryShift = 6, + SpvMemorySemanticsSubgroupMemoryShift = 7, + SpvMemorySemanticsWorkgroupMemoryShift = 8, + SpvMemorySemanticsCrossWorkgroupMemoryShift = 9, + SpvMemorySemanticsAtomicCounterMemoryShift = 10, + SpvMemorySemanticsImageMemoryShift = 11, + SpvMemorySemanticsMax = 0x7fffffff, +} SpvMemorySemanticsShift; + +typedef enum SpvMemorySemanticsMask_ { + SpvMemorySemanticsMaskNone = 0, + SpvMemorySemanticsAcquireMask = 0x00000002, + SpvMemorySemanticsReleaseMask = 0x00000004, + SpvMemorySemanticsAcquireReleaseMask = 0x00000008, + SpvMemorySemanticsSequentiallyConsistentMask = 0x00000010, + SpvMemorySemanticsUniformMemoryMask = 0x00000040, + SpvMemorySemanticsSubgroupMemoryMask = 0x00000080, + SpvMemorySemanticsWorkgroupMemoryMask = 0x00000100, + SpvMemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000400, + SpvMemorySemanticsImageMemoryMask = 0x00000800, +} SpvMemorySemanticsMask; + +typedef enum SpvMemoryAccessShift_ { + SpvMemoryAccessVolatileShift = 0, + SpvMemoryAccessAlignedShift = 1, + SpvMemoryAccessNontemporalShift = 2, + SpvMemoryAccessMax = 0x7fffffff, +} SpvMemoryAccessShift; + +typedef enum SpvMemoryAccessMask_ { + SpvMemoryAccessMaskNone = 0, + SpvMemoryAccessVolatileMask = 0x00000001, + SpvMemoryAccessAlignedMask = 0x00000002, + SpvMemoryAccessNontemporalMask = 0x00000004, +} SpvMemoryAccessMask; + +typedef enum SpvScope_ { + SpvScopeCrossDevice = 0, + SpvScopeDevice = 1, + SpvScopeWorkgroup = 2, + SpvScopeSubgroup = 3, + SpvScopeInvocation = 4, + SpvScopeMax = 0x7fffffff, +} SpvScope; + +typedef enum SpvGroupOperation_ { + SpvGroupOperationReduce = 0, + SpvGroupOperationInclusiveScan = 1, + SpvGroupOperationExclusiveScan = 2, + SpvGroupOperationMax = 0x7fffffff, +} SpvGroupOperation; + +typedef enum SpvKernelEnqueueFlags_ { + SpvKernelEnqueueFlagsNoWait = 0, + SpvKernelEnqueueFlagsWaitKernel = 1, + SpvKernelEnqueueFlagsWaitWorkGroup = 2, + SpvKernelEnqueueFlagsMax = 0x7fffffff, +} SpvKernelEnqueueFlags; + +typedef enum SpvKernelProfilingInfoShift_ { + SpvKernelProfilingInfoCmdExecTimeShift = 0, + SpvKernelProfilingInfoMax = 0x7fffffff, +} SpvKernelProfilingInfoShift; + +typedef enum SpvKernelProfilingInfoMask_ { + SpvKernelProfilingInfoMaskNone = 0, + SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001, +} SpvKernelProfilingInfoMask; + +typedef enum SpvCapability_ { + SpvCapabilityMatrix = 0, + SpvCapabilityShader = 1, + SpvCapabilityGeometry = 2, + SpvCapabilityTessellation = 3, + SpvCapabilityAddresses = 4, + SpvCapabilityLinkage = 5, + SpvCapabilityKernel = 6, + SpvCapabilityVector16 = 7, + SpvCapabilityFloat16Buffer = 8, + SpvCapabilityFloat16 = 9, + SpvCapabilityFloat64 = 10, + SpvCapabilityInt64 = 11, + SpvCapabilityInt64Atomics = 12, + SpvCapabilityImageBasic = 13, + SpvCapabilityImageReadWrite = 14, + SpvCapabilityImageMipmap = 15, + SpvCapabilityPipes = 17, + SpvCapabilityGroups = 18, + SpvCapabilityDeviceEnqueue = 19, + SpvCapabilityLiteralSampler = 20, + SpvCapabilityAtomicStorage = 21, + SpvCapabilityInt16 = 22, + SpvCapabilityTessellationPointSize = 23, + SpvCapabilityGeometryPointSize = 24, + SpvCapabilityImageGatherExtended = 25, + SpvCapabilityStorageImageMultisample = 27, + SpvCapabilityUniformBufferArrayDynamicIndexing = 28, + SpvCapabilitySampledImageArrayDynamicIndexing = 29, + SpvCapabilityStorageBufferArrayDynamicIndexing = 30, + SpvCapabilityStorageImageArrayDynamicIndexing = 31, + SpvCapabilityClipDistance = 32, + SpvCapabilityCullDistance = 33, + SpvCapabilityImageCubeArray = 34, + SpvCapabilitySampleRateShading = 35, + SpvCapabilityImageRect = 36, + SpvCapabilitySampledRect = 37, + SpvCapabilityGenericPointer = 38, + SpvCapabilityInt8 = 39, + SpvCapabilityInputAttachment = 40, + SpvCapabilitySparseResidency = 41, + SpvCapabilityMinLod = 42, + SpvCapabilitySampled1D = 43, + SpvCapabilityImage1D = 44, + SpvCapabilitySampledCubeArray = 45, + SpvCapabilitySampledBuffer = 46, + SpvCapabilityImageBuffer = 47, + SpvCapabilityImageMSArray = 48, + SpvCapabilityStorageImageExtendedFormats = 49, + SpvCapabilityImageQuery = 50, + SpvCapabilityDerivativeControl = 51, + SpvCapabilityInterpolationFunction = 52, + SpvCapabilityTransformFeedback = 53, + SpvCapabilityGeometryStreams = 54, + SpvCapabilityStorageImageReadWithoutFormat = 55, + SpvCapabilityStorageImageWriteWithoutFormat = 56, + SpvCapabilityMultiViewport = 57, + SpvCapabilitySubgroupDispatch = 58, + SpvCapabilityNamedBarrier = 59, + SpvCapabilityPipeStorage = 60, + SpvCapabilitySubgroupBallotKHR = 4423, + SpvCapabilityDrawParameters = 4427, + SpvCapabilitySubgroupVoteKHR = 4431, + SpvCapabilityStorageBuffer16BitAccess = 4433, + SpvCapabilityStorageUniformBufferBlock16 = 4433, + SpvCapabilityStorageUniform16 = 4434, + SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434, + SpvCapabilityStoragePushConstant16 = 4435, + SpvCapabilityStorageInputOutput16 = 4436, + SpvCapabilityDeviceGroup = 4437, + SpvCapabilityMultiView = 4439, + SpvCapabilityVariablePointersStorageBuffer = 4441, + SpvCapabilityVariablePointers = 4442, + SpvCapabilityAtomicStorageOps = 4445, + SpvCapabilitySampleMaskPostDepthCoverage = 4447, + SpvCapabilityImageGatherBiasLodAMD = 5009, + SpvCapabilityFragmentMaskAMD = 5010, + SpvCapabilityStencilExportEXT = 5013, + SpvCapabilityImageReadWriteLodAMD = 5015, + SpvCapabilitySampleMaskOverrideCoverageNV = 5249, + SpvCapabilityGeometryShaderPassthroughNV = 5251, + SpvCapabilityShaderViewportIndexLayerEXT = 5254, + SpvCapabilityShaderViewportIndexLayerNV = 5254, + SpvCapabilityShaderViewportMaskNV = 5255, + SpvCapabilityShaderStereoViewNV = 5259, + SpvCapabilityPerViewAttributesNV = 5260, + SpvCapabilitySubgroupShuffleINTEL = 5568, + SpvCapabilitySubgroupBufferBlockIOINTEL = 5569, + SpvCapabilitySubgroupImageBlockIOINTEL = 5570, + SpvCapabilityMax = 0x7fffffff, +} SpvCapability; + +typedef enum SpvOp_ { + SpvOpNop = 0, + SpvOpUndef = 1, + SpvOpSourceContinued = 2, + SpvOpSource = 3, + SpvOpSourceExtension = 4, + SpvOpName = 5, + SpvOpMemberName = 6, + SpvOpString = 7, + SpvOpLine = 8, + SpvOpExtension = 10, + SpvOpExtInstImport = 11, + SpvOpExtInst = 12, + SpvOpMemoryModel = 14, + SpvOpEntryPoint = 15, + SpvOpExecutionMode = 16, + SpvOpCapability = 17, + SpvOpTypeVoid = 19, + SpvOpTypeBool = 20, + SpvOpTypeInt = 21, + SpvOpTypeFloat = 22, + SpvOpTypeVector = 23, + SpvOpTypeMatrix = 24, + SpvOpTypeImage = 25, + SpvOpTypeSampler = 26, + SpvOpTypeSampledImage = 27, + SpvOpTypeArray = 28, + SpvOpTypeRuntimeArray = 29, + SpvOpTypeStruct = 30, + SpvOpTypeOpaque = 31, + SpvOpTypePointer = 32, + SpvOpTypeFunction = 33, + SpvOpTypeEvent = 34, + SpvOpTypeDeviceEvent = 35, + SpvOpTypeReserveId = 36, + SpvOpTypeQueue = 37, + SpvOpTypePipe = 38, + SpvOpTypeForwardPointer = 39, + SpvOpConstantTrue = 41, + SpvOpConstantFalse = 42, + SpvOpConstant = 43, + SpvOpConstantComposite = 44, + SpvOpConstantSampler = 45, + SpvOpConstantNull = 46, + SpvOpSpecConstantTrue = 48, + SpvOpSpecConstantFalse = 49, + SpvOpSpecConstant = 50, + SpvOpSpecConstantComposite = 51, + SpvOpSpecConstantOp = 52, + SpvOpFunction = 54, + SpvOpFunctionParameter = 55, + SpvOpFunctionEnd = 56, + SpvOpFunctionCall = 57, + SpvOpVariable = 59, + SpvOpImageTexelPointer = 60, + SpvOpLoad = 61, + SpvOpStore = 62, + SpvOpCopyMemory = 63, + SpvOpCopyMemorySized = 64, + SpvOpAccessChain = 65, + SpvOpInBoundsAccessChain = 66, + SpvOpPtrAccessChain = 67, + SpvOpArrayLength = 68, + SpvOpGenericPtrMemSemantics = 69, + SpvOpInBoundsPtrAccessChain = 70, + SpvOpDecorate = 71, + SpvOpMemberDecorate = 72, + SpvOpDecorationGroup = 73, + SpvOpGroupDecorate = 74, + SpvOpGroupMemberDecorate = 75, + SpvOpVectorExtractDynamic = 77, + SpvOpVectorInsertDynamic = 78, + SpvOpVectorShuffle = 79, + SpvOpCompositeConstruct = 80, + SpvOpCompositeExtract = 81, + SpvOpCompositeInsert = 82, + SpvOpCopyObject = 83, + SpvOpTranspose = 84, + SpvOpSampledImage = 86, + SpvOpImageSampleImplicitLod = 87, + SpvOpImageSampleExplicitLod = 88, + SpvOpImageSampleDrefImplicitLod = 89, + SpvOpImageSampleDrefExplicitLod = 90, + SpvOpImageSampleProjImplicitLod = 91, + SpvOpImageSampleProjExplicitLod = 92, + SpvOpImageSampleProjDrefImplicitLod = 93, + SpvOpImageSampleProjDrefExplicitLod = 94, + SpvOpImageFetch = 95, + SpvOpImageGather = 96, + SpvOpImageDrefGather = 97, + SpvOpImageRead = 98, + SpvOpImageWrite = 99, + SpvOpImage = 100, + SpvOpImageQueryFormat = 101, + SpvOpImageQueryOrder = 102, + SpvOpImageQuerySizeLod = 103, + SpvOpImageQuerySize = 104, + SpvOpImageQueryLod = 105, + SpvOpImageQueryLevels = 106, + SpvOpImageQuerySamples = 107, + SpvOpConvertFToU = 109, + SpvOpConvertFToS = 110, + SpvOpConvertSToF = 111, + SpvOpConvertUToF = 112, + SpvOpUConvert = 113, + SpvOpSConvert = 114, + SpvOpFConvert = 115, + SpvOpQuantizeToF16 = 116, + SpvOpConvertPtrToU = 117, + SpvOpSatConvertSToU = 118, + SpvOpSatConvertUToS = 119, + SpvOpConvertUToPtr = 120, + SpvOpPtrCastToGeneric = 121, + SpvOpGenericCastToPtr = 122, + SpvOpGenericCastToPtrExplicit = 123, + SpvOpBitcast = 124, + SpvOpSNegate = 126, + SpvOpFNegate = 127, + SpvOpIAdd = 128, + SpvOpFAdd = 129, + SpvOpISub = 130, + SpvOpFSub = 131, + SpvOpIMul = 132, + SpvOpFMul = 133, + SpvOpUDiv = 134, + SpvOpSDiv = 135, + SpvOpFDiv = 136, + SpvOpUMod = 137, + SpvOpSRem = 138, + SpvOpSMod = 139, + SpvOpFRem = 140, + SpvOpFMod = 141, + SpvOpVectorTimesScalar = 142, + SpvOpMatrixTimesScalar = 143, + SpvOpVectorTimesMatrix = 144, + SpvOpMatrixTimesVector = 145, + SpvOpMatrixTimesMatrix = 146, + SpvOpOuterProduct = 147, + SpvOpDot = 148, + SpvOpIAddCarry = 149, + SpvOpISubBorrow = 150, + SpvOpUMulExtended = 151, + SpvOpSMulExtended = 152, + SpvOpAny = 154, + SpvOpAll = 155, + SpvOpIsNan = 156, + SpvOpIsInf = 157, + SpvOpIsFinite = 158, + SpvOpIsNormal = 159, + SpvOpSignBitSet = 160, + SpvOpLessOrGreater = 161, + SpvOpOrdered = 162, + SpvOpUnordered = 163, + SpvOpLogicalEqual = 164, + SpvOpLogicalNotEqual = 165, + SpvOpLogicalOr = 166, + SpvOpLogicalAnd = 167, + SpvOpLogicalNot = 168, + SpvOpSelect = 169, + SpvOpIEqual = 170, + SpvOpINotEqual = 171, + SpvOpUGreaterThan = 172, + SpvOpSGreaterThan = 173, + SpvOpUGreaterThanEqual = 174, + SpvOpSGreaterThanEqual = 175, + SpvOpULessThan = 176, + SpvOpSLessThan = 177, + SpvOpULessThanEqual = 178, + SpvOpSLessThanEqual = 179, + SpvOpFOrdEqual = 180, + SpvOpFUnordEqual = 181, + SpvOpFOrdNotEqual = 182, + SpvOpFUnordNotEqual = 183, + SpvOpFOrdLessThan = 184, + SpvOpFUnordLessThan = 185, + SpvOpFOrdGreaterThan = 186, + SpvOpFUnordGreaterThan = 187, + SpvOpFOrdLessThanEqual = 188, + SpvOpFUnordLessThanEqual = 189, + SpvOpFOrdGreaterThanEqual = 190, + SpvOpFUnordGreaterThanEqual = 191, + SpvOpShiftRightLogical = 194, + SpvOpShiftRightArithmetic = 195, + SpvOpShiftLeftLogical = 196, + SpvOpBitwiseOr = 197, + SpvOpBitwiseXor = 198, + SpvOpBitwiseAnd = 199, + SpvOpNot = 200, + SpvOpBitFieldInsert = 201, + SpvOpBitFieldSExtract = 202, + SpvOpBitFieldUExtract = 203, + SpvOpBitReverse = 204, + SpvOpBitCount = 205, + SpvOpDPdx = 207, + SpvOpDPdy = 208, + SpvOpFwidth = 209, + SpvOpDPdxFine = 210, + SpvOpDPdyFine = 211, + SpvOpFwidthFine = 212, + SpvOpDPdxCoarse = 213, + SpvOpDPdyCoarse = 214, + SpvOpFwidthCoarse = 215, + SpvOpEmitVertex = 218, + SpvOpEndPrimitive = 219, + SpvOpEmitStreamVertex = 220, + SpvOpEndStreamPrimitive = 221, + SpvOpControlBarrier = 224, + SpvOpMemoryBarrier = 225, + SpvOpAtomicLoad = 227, + SpvOpAtomicStore = 228, + SpvOpAtomicExchange = 229, + SpvOpAtomicCompareExchange = 230, + SpvOpAtomicCompareExchangeWeak = 231, + SpvOpAtomicIIncrement = 232, + SpvOpAtomicIDecrement = 233, + SpvOpAtomicIAdd = 234, + SpvOpAtomicISub = 235, + SpvOpAtomicSMin = 236, + SpvOpAtomicUMin = 237, + SpvOpAtomicSMax = 238, + SpvOpAtomicUMax = 239, + SpvOpAtomicAnd = 240, + SpvOpAtomicOr = 241, + SpvOpAtomicXor = 242, + SpvOpPhi = 245, + SpvOpLoopMerge = 246, + SpvOpSelectionMerge = 247, + SpvOpLabel = 248, + SpvOpBranch = 249, + SpvOpBranchConditional = 250, + SpvOpSwitch = 251, + SpvOpKill = 252, + SpvOpReturn = 253, + SpvOpReturnValue = 254, + SpvOpUnreachable = 255, + SpvOpLifetimeStart = 256, + SpvOpLifetimeStop = 257, + SpvOpGroupAsyncCopy = 259, + SpvOpGroupWaitEvents = 260, + SpvOpGroupAll = 261, + SpvOpGroupAny = 262, + SpvOpGroupBroadcast = 263, + SpvOpGroupIAdd = 264, + SpvOpGroupFAdd = 265, + SpvOpGroupFMin = 266, + SpvOpGroupUMin = 267, + SpvOpGroupSMin = 268, + SpvOpGroupFMax = 269, + SpvOpGroupUMax = 270, + SpvOpGroupSMax = 271, + SpvOpReadPipe = 274, + SpvOpWritePipe = 275, + SpvOpReservedReadPipe = 276, + SpvOpReservedWritePipe = 277, + SpvOpReserveReadPipePackets = 278, + SpvOpReserveWritePipePackets = 279, + SpvOpCommitReadPipe = 280, + SpvOpCommitWritePipe = 281, + SpvOpIsValidReserveId = 282, + SpvOpGetNumPipePackets = 283, + SpvOpGetMaxPipePackets = 284, + SpvOpGroupReserveReadPipePackets = 285, + SpvOpGroupReserveWritePipePackets = 286, + SpvOpGroupCommitReadPipe = 287, + SpvOpGroupCommitWritePipe = 288, + SpvOpEnqueueMarker = 291, + SpvOpEnqueueKernel = 292, + SpvOpGetKernelNDrangeSubGroupCount = 293, + SpvOpGetKernelNDrangeMaxSubGroupSize = 294, + SpvOpGetKernelWorkGroupSize = 295, + SpvOpGetKernelPreferredWorkGroupSizeMultiple = 296, + SpvOpRetainEvent = 297, + SpvOpReleaseEvent = 298, + SpvOpCreateUserEvent = 299, + SpvOpIsValidEvent = 300, + SpvOpSetUserEventStatus = 301, + SpvOpCaptureEventProfilingInfo = 302, + SpvOpGetDefaultQueue = 303, + SpvOpBuildNDRange = 304, + SpvOpImageSparseSampleImplicitLod = 305, + SpvOpImageSparseSampleExplicitLod = 306, + SpvOpImageSparseSampleDrefImplicitLod = 307, + SpvOpImageSparseSampleDrefExplicitLod = 308, + SpvOpImageSparseSampleProjImplicitLod = 309, + SpvOpImageSparseSampleProjExplicitLod = 310, + SpvOpImageSparseSampleProjDrefImplicitLod = 311, + SpvOpImageSparseSampleProjDrefExplicitLod = 312, + SpvOpImageSparseFetch = 313, + SpvOpImageSparseGather = 314, + SpvOpImageSparseDrefGather = 315, + SpvOpImageSparseTexelsResident = 316, + SpvOpNoLine = 317, + SpvOpAtomicFlagTestAndSet = 318, + SpvOpAtomicFlagClear = 319, + SpvOpImageSparseRead = 320, + SpvOpSizeOf = 321, + SpvOpTypePipeStorage = 322, + SpvOpConstantPipeStorage = 323, + SpvOpCreatePipeFromPipeStorage = 324, + SpvOpGetKernelLocalSizeForSubgroupCount = 325, + SpvOpGetKernelMaxNumSubgroups = 326, + SpvOpTypeNamedBarrier = 327, + SpvOpNamedBarrierInitialize = 328, + SpvOpMemoryNamedBarrier = 329, + SpvOpModuleProcessed = 330, + SpvOpExecutionModeId = 331, + SpvOpDecorateId = 332, + SpvOpSubgroupBallotKHR = 4421, + SpvOpSubgroupFirstInvocationKHR = 4422, + SpvOpSubgroupAllKHR = 4428, + SpvOpSubgroupAnyKHR = 4429, + SpvOpSubgroupAllEqualKHR = 4430, + SpvOpSubgroupReadInvocationKHR = 4432, + SpvOpGroupIAddNonUniformAMD = 5000, + SpvOpGroupFAddNonUniformAMD = 5001, + SpvOpGroupFMinNonUniformAMD = 5002, + SpvOpGroupUMinNonUniformAMD = 5003, + SpvOpGroupSMinNonUniformAMD = 5004, + SpvOpGroupFMaxNonUniformAMD = 5005, + SpvOpGroupUMaxNonUniformAMD = 5006, + SpvOpGroupSMaxNonUniformAMD = 5007, + SpvOpFragmentMaskFetchAMD = 5011, + SpvOpFragmentFetchAMD = 5012, + SpvOpSubgroupShuffleINTEL = 5571, + SpvOpSubgroupShuffleDownINTEL = 5572, + SpvOpSubgroupShuffleUpINTEL = 5573, + SpvOpSubgroupShuffleXorINTEL = 5574, + SpvOpSubgroupBlockReadINTEL = 5575, + SpvOpSubgroupBlockWriteINTEL = 5576, + SpvOpSubgroupImageBlockReadINTEL = 5577, + SpvOpSubgroupImageBlockWriteINTEL = 5578, + SpvOpDecorateStringGOOGLE = 5632, + SpvOpMemberDecorateStringGOOGLE = 5633, + SpvOpMax = 0x7fffffff, +} SpvOp; + +#endif // #ifndef spirv_H + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.hpp new file mode 100644 index 00000000000..57bd97a0210 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.hpp @@ -0,0 +1,1030 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10200 +#define SPV_REVISION 2 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010200; +static const unsigned int Revision = 2; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum SourceLanguage { + SourceLanguageUnknown = 0, + SourceLanguageESSL = 1, + SourceLanguageGLSL = 2, + SourceLanguageOpenCL_C = 3, + SourceLanguageOpenCL_CPP = 4, + SourceLanguageHLSL = 5, + SourceLanguageMax = 0x7fffffff, +}; + +enum ExecutionModel { + ExecutionModelVertex = 0, + ExecutionModelTessellationControl = 1, + ExecutionModelTessellationEvaluation = 2, + ExecutionModelGeometry = 3, + ExecutionModelFragment = 4, + ExecutionModelGLCompute = 5, + ExecutionModelKernel = 6, + ExecutionModelMax = 0x7fffffff, +}; + +enum AddressingModel { + AddressingModelLogical = 0, + AddressingModelPhysical32 = 1, + AddressingModelPhysical64 = 2, + AddressingModelMax = 0x7fffffff, +}; + +enum MemoryModel { + MemoryModelSimple = 0, + MemoryModelGLSL450 = 1, + MemoryModelOpenCL = 2, + MemoryModelMax = 0x7fffffff, +}; + +enum ExecutionMode { + ExecutionModeInvocations = 0, + ExecutionModeSpacingEqual = 1, + ExecutionModeSpacingFractionalEven = 2, + ExecutionModeSpacingFractionalOdd = 3, + ExecutionModeVertexOrderCw = 4, + ExecutionModeVertexOrderCcw = 5, + ExecutionModePixelCenterInteger = 6, + ExecutionModeOriginUpperLeft = 7, + ExecutionModeOriginLowerLeft = 8, + ExecutionModeEarlyFragmentTests = 9, + ExecutionModePointMode = 10, + ExecutionModeXfb = 11, + ExecutionModeDepthReplacing = 12, + ExecutionModeDepthGreater = 14, + ExecutionModeDepthLess = 15, + ExecutionModeDepthUnchanged = 16, + ExecutionModeLocalSize = 17, + ExecutionModeLocalSizeHint = 18, + ExecutionModeInputPoints = 19, + ExecutionModeInputLines = 20, + ExecutionModeInputLinesAdjacency = 21, + ExecutionModeTriangles = 22, + ExecutionModeInputTrianglesAdjacency = 23, + ExecutionModeQuads = 24, + ExecutionModeIsolines = 25, + ExecutionModeOutputVertices = 26, + ExecutionModeOutputPoints = 27, + ExecutionModeOutputLineStrip = 28, + ExecutionModeOutputTriangleStrip = 29, + ExecutionModeVecTypeHint = 30, + ExecutionModeContractionOff = 31, + ExecutionModeInitializer = 33, + ExecutionModeFinalizer = 34, + ExecutionModeSubgroupSize = 35, + ExecutionModeSubgroupsPerWorkgroup = 36, + ExecutionModeSubgroupsPerWorkgroupId = 37, + ExecutionModeLocalSizeId = 38, + ExecutionModeLocalSizeHintId = 39, + ExecutionModePostDepthCoverage = 4446, + ExecutionModeStencilRefReplacingEXT = 5027, + ExecutionModeMax = 0x7fffffff, +}; + +enum StorageClass { + StorageClassUniformConstant = 0, + StorageClassInput = 1, + StorageClassUniform = 2, + StorageClassOutput = 3, + StorageClassWorkgroup = 4, + StorageClassCrossWorkgroup = 5, + StorageClassPrivate = 6, + StorageClassFunction = 7, + StorageClassGeneric = 8, + StorageClassPushConstant = 9, + StorageClassAtomicCounter = 10, + StorageClassImage = 11, + StorageClassStorageBuffer = 12, + StorageClassMax = 0x7fffffff, +}; + +enum Dim { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + DimCube = 3, + DimRect = 4, + DimBuffer = 5, + DimSubpassData = 6, + DimMax = 0x7fffffff, +}; + +enum SamplerAddressingMode { + SamplerAddressingModeNone = 0, + SamplerAddressingModeClampToEdge = 1, + SamplerAddressingModeClamp = 2, + SamplerAddressingModeRepeat = 3, + SamplerAddressingModeRepeatMirrored = 4, + SamplerAddressingModeMax = 0x7fffffff, +}; + +enum SamplerFilterMode { + SamplerFilterModeNearest = 0, + SamplerFilterModeLinear = 1, + SamplerFilterModeMax = 0x7fffffff, +}; + +enum ImageFormat { + ImageFormatUnknown = 0, + ImageFormatRgba32f = 1, + ImageFormatRgba16f = 2, + ImageFormatR32f = 3, + ImageFormatRgba8 = 4, + ImageFormatRgba8Snorm = 5, + ImageFormatRg32f = 6, + ImageFormatRg16f = 7, + ImageFormatR11fG11fB10f = 8, + ImageFormatR16f = 9, + ImageFormatRgba16 = 10, + ImageFormatRgb10A2 = 11, + ImageFormatRg16 = 12, + ImageFormatRg8 = 13, + ImageFormatR16 = 14, + ImageFormatR8 = 15, + ImageFormatRgba16Snorm = 16, + ImageFormatRg16Snorm = 17, + ImageFormatRg8Snorm = 18, + ImageFormatR16Snorm = 19, + ImageFormatR8Snorm = 20, + ImageFormatRgba32i = 21, + ImageFormatRgba16i = 22, + ImageFormatRgba8i = 23, + ImageFormatR32i = 24, + ImageFormatRg32i = 25, + ImageFormatRg16i = 26, + ImageFormatRg8i = 27, + ImageFormatR16i = 28, + ImageFormatR8i = 29, + ImageFormatRgba32ui = 30, + ImageFormatRgba16ui = 31, + ImageFormatRgba8ui = 32, + ImageFormatR32ui = 33, + ImageFormatRgb10a2ui = 34, + ImageFormatRg32ui = 35, + ImageFormatRg16ui = 36, + ImageFormatRg8ui = 37, + ImageFormatR16ui = 38, + ImageFormatR8ui = 39, + ImageFormatMax = 0x7fffffff, +}; + +enum ImageChannelOrder { + ImageChannelOrderR = 0, + ImageChannelOrderA = 1, + ImageChannelOrderRG = 2, + ImageChannelOrderRA = 3, + ImageChannelOrderRGB = 4, + ImageChannelOrderRGBA = 5, + ImageChannelOrderBGRA = 6, + ImageChannelOrderARGB = 7, + ImageChannelOrderIntensity = 8, + ImageChannelOrderLuminance = 9, + ImageChannelOrderRx = 10, + ImageChannelOrderRGx = 11, + ImageChannelOrderRGBx = 12, + ImageChannelOrderDepth = 13, + ImageChannelOrderDepthStencil = 14, + ImageChannelOrdersRGB = 15, + ImageChannelOrdersRGBx = 16, + ImageChannelOrdersRGBA = 17, + ImageChannelOrdersBGRA = 18, + ImageChannelOrderABGR = 19, + ImageChannelOrderMax = 0x7fffffff, +}; + +enum ImageChannelDataType { + ImageChannelDataTypeSnormInt8 = 0, + ImageChannelDataTypeSnormInt16 = 1, + ImageChannelDataTypeUnormInt8 = 2, + ImageChannelDataTypeUnormInt16 = 3, + ImageChannelDataTypeUnormShort565 = 4, + ImageChannelDataTypeUnormShort555 = 5, + ImageChannelDataTypeUnormInt101010 = 6, + ImageChannelDataTypeSignedInt8 = 7, + ImageChannelDataTypeSignedInt16 = 8, + ImageChannelDataTypeSignedInt32 = 9, + ImageChannelDataTypeUnsignedInt8 = 10, + ImageChannelDataTypeUnsignedInt16 = 11, + ImageChannelDataTypeUnsignedInt32 = 12, + ImageChannelDataTypeHalfFloat = 13, + ImageChannelDataTypeFloat = 14, + ImageChannelDataTypeUnormInt24 = 15, + ImageChannelDataTypeUnormInt101010_2 = 16, + ImageChannelDataTypeMax = 0x7fffffff, +}; + +enum ImageOperandsShift { + ImageOperandsBiasShift = 0, + ImageOperandsLodShift = 1, + ImageOperandsGradShift = 2, + ImageOperandsConstOffsetShift = 3, + ImageOperandsOffsetShift = 4, + ImageOperandsConstOffsetsShift = 5, + ImageOperandsSampleShift = 6, + ImageOperandsMinLodShift = 7, + ImageOperandsMax = 0x7fffffff, +}; + +enum ImageOperandsMask { + ImageOperandsMaskNone = 0, + ImageOperandsBiasMask = 0x00000001, + ImageOperandsLodMask = 0x00000002, + ImageOperandsGradMask = 0x00000004, + ImageOperandsConstOffsetMask = 0x00000008, + ImageOperandsOffsetMask = 0x00000010, + ImageOperandsConstOffsetsMask = 0x00000020, + ImageOperandsSampleMask = 0x00000040, + ImageOperandsMinLodMask = 0x00000080, +}; + +enum FPFastMathModeShift { + FPFastMathModeNotNaNShift = 0, + FPFastMathModeNotInfShift = 1, + FPFastMathModeNSZShift = 2, + FPFastMathModeAllowRecipShift = 3, + FPFastMathModeFastShift = 4, + FPFastMathModeMax = 0x7fffffff, +}; + +enum FPFastMathModeMask { + FPFastMathModeMaskNone = 0, + FPFastMathModeNotNaNMask = 0x00000001, + FPFastMathModeNotInfMask = 0x00000002, + FPFastMathModeNSZMask = 0x00000004, + FPFastMathModeAllowRecipMask = 0x00000008, + FPFastMathModeFastMask = 0x00000010, +}; + +enum FPRoundingMode { + FPRoundingModeRTE = 0, + FPRoundingModeRTZ = 1, + FPRoundingModeRTP = 2, + FPRoundingModeRTN = 3, + FPRoundingModeMax = 0x7fffffff, +}; + +enum LinkageType { + LinkageTypeExport = 0, + LinkageTypeImport = 1, + LinkageTypeMax = 0x7fffffff, +}; + +enum AccessQualifier { + AccessQualifierReadOnly = 0, + AccessQualifierWriteOnly = 1, + AccessQualifierReadWrite = 2, + AccessQualifierMax = 0x7fffffff, +}; + +enum FunctionParameterAttribute { + FunctionParameterAttributeZext = 0, + FunctionParameterAttributeSext = 1, + FunctionParameterAttributeByVal = 2, + FunctionParameterAttributeSret = 3, + FunctionParameterAttributeNoAlias = 4, + FunctionParameterAttributeNoCapture = 5, + FunctionParameterAttributeNoWrite = 6, + FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeMax = 0x7fffffff, +}; + +enum Decoration { + DecorationRelaxedPrecision = 0, + DecorationSpecId = 1, + DecorationBlock = 2, + DecorationBufferBlock = 3, + DecorationRowMajor = 4, + DecorationColMajor = 5, + DecorationArrayStride = 6, + DecorationMatrixStride = 7, + DecorationGLSLShared = 8, + DecorationGLSLPacked = 9, + DecorationCPacked = 10, + DecorationBuiltIn = 11, + DecorationNoPerspective = 13, + DecorationFlat = 14, + DecorationPatch = 15, + DecorationCentroid = 16, + DecorationSample = 17, + DecorationInvariant = 18, + DecorationRestrict = 19, + DecorationAliased = 20, + DecorationVolatile = 21, + DecorationConstant = 22, + DecorationCoherent = 23, + DecorationNonWritable = 24, + DecorationNonReadable = 25, + DecorationUniform = 26, + DecorationSaturatedConversion = 28, + DecorationStream = 29, + DecorationLocation = 30, + DecorationComponent = 31, + DecorationIndex = 32, + DecorationBinding = 33, + DecorationDescriptorSet = 34, + DecorationOffset = 35, + DecorationXfbBuffer = 36, + DecorationXfbStride = 37, + DecorationFuncParamAttr = 38, + DecorationFPRoundingMode = 39, + DecorationFPFastMathMode = 40, + DecorationLinkageAttributes = 41, + DecorationNoContraction = 42, + DecorationInputAttachmentIndex = 43, + DecorationAlignment = 44, + DecorationMaxByteOffset = 45, + DecorationAlignmentId = 46, + DecorationMaxByteOffsetId = 47, + DecorationExplicitInterpAMD = 4999, + DecorationOverrideCoverageNV = 5248, + DecorationPassthroughNV = 5250, + DecorationViewportRelativeNV = 5252, + DecorationSecondaryViewportRelativeNV = 5256, + DecorationHlslCounterBufferGOOGLE = 5634, + DecorationHlslSemanticGOOGLE = 5635, + DecorationMax = 0x7fffffff, +}; + +enum BuiltIn { + BuiltInPosition = 0, + BuiltInPointSize = 1, + BuiltInClipDistance = 3, + BuiltInCullDistance = 4, + BuiltInVertexId = 5, + BuiltInInstanceId = 6, + BuiltInPrimitiveId = 7, + BuiltInInvocationId = 8, + BuiltInLayer = 9, + BuiltInViewportIndex = 10, + BuiltInTessLevelOuter = 11, + BuiltInTessLevelInner = 12, + BuiltInTessCoord = 13, + BuiltInPatchVertices = 14, + BuiltInFragCoord = 15, + BuiltInPointCoord = 16, + BuiltInFrontFacing = 17, + BuiltInSampleId = 18, + BuiltInSamplePosition = 19, + BuiltInSampleMask = 20, + BuiltInFragDepth = 22, + BuiltInHelperInvocation = 23, + BuiltInNumWorkgroups = 24, + BuiltInWorkgroupSize = 25, + BuiltInWorkgroupId = 26, + BuiltInLocalInvocationId = 27, + BuiltInGlobalInvocationId = 28, + BuiltInLocalInvocationIndex = 29, + BuiltInWorkDim = 30, + BuiltInGlobalSize = 31, + BuiltInEnqueuedWorkgroupSize = 32, + BuiltInGlobalOffset = 33, + BuiltInGlobalLinearId = 34, + BuiltInSubgroupSize = 36, + BuiltInSubgroupMaxSize = 37, + BuiltInNumSubgroups = 38, + BuiltInNumEnqueuedSubgroups = 39, + BuiltInSubgroupId = 40, + BuiltInSubgroupLocalInvocationId = 41, + BuiltInVertexIndex = 42, + BuiltInInstanceIndex = 43, + BuiltInSubgroupEqMaskKHR = 4416, + BuiltInSubgroupGeMaskKHR = 4417, + BuiltInSubgroupGtMaskKHR = 4418, + BuiltInSubgroupLeMaskKHR = 4419, + BuiltInSubgroupLtMaskKHR = 4420, + BuiltInBaseVertex = 4424, + BuiltInBaseInstance = 4425, + BuiltInDrawIndex = 4426, + BuiltInDeviceIndex = 4438, + BuiltInViewIndex = 4440, + BuiltInBaryCoordNoPerspAMD = 4992, + BuiltInBaryCoordNoPerspCentroidAMD = 4993, + BuiltInBaryCoordNoPerspSampleAMD = 4994, + BuiltInBaryCoordSmoothAMD = 4995, + BuiltInBaryCoordSmoothCentroidAMD = 4996, + BuiltInBaryCoordSmoothSampleAMD = 4997, + BuiltInBaryCoordPullModelAMD = 4998, + BuiltInFragStencilRefEXT = 5014, + BuiltInViewportMaskNV = 5253, + BuiltInSecondaryPositionNV = 5257, + BuiltInSecondaryViewportMaskNV = 5258, + BuiltInPositionPerViewNV = 5261, + BuiltInViewportMaskPerViewNV = 5262, + BuiltInMax = 0x7fffffff, +}; + +enum SelectionControlShift { + SelectionControlFlattenShift = 0, + SelectionControlDontFlattenShift = 1, + SelectionControlMax = 0x7fffffff, +}; + +enum SelectionControlMask { + SelectionControlMaskNone = 0, + SelectionControlFlattenMask = 0x00000001, + SelectionControlDontFlattenMask = 0x00000002, +}; + +enum LoopControlShift { + LoopControlUnrollShift = 0, + LoopControlDontUnrollShift = 1, + LoopControlDependencyInfiniteShift = 2, + LoopControlDependencyLengthShift = 3, + LoopControlMax = 0x7fffffff, +}; + +enum LoopControlMask { + LoopControlMaskNone = 0, + LoopControlUnrollMask = 0x00000001, + LoopControlDontUnrollMask = 0x00000002, + LoopControlDependencyInfiniteMask = 0x00000004, + LoopControlDependencyLengthMask = 0x00000008, +}; + +enum FunctionControlShift { + FunctionControlInlineShift = 0, + FunctionControlDontInlineShift = 1, + FunctionControlPureShift = 2, + FunctionControlConstShift = 3, + FunctionControlMax = 0x7fffffff, +}; + +enum FunctionControlMask { + FunctionControlMaskNone = 0, + FunctionControlInlineMask = 0x00000001, + FunctionControlDontInlineMask = 0x00000002, + FunctionControlPureMask = 0x00000004, + FunctionControlConstMask = 0x00000008, +}; + +enum MemorySemanticsShift { + MemorySemanticsAcquireShift = 1, + MemorySemanticsReleaseShift = 2, + MemorySemanticsAcquireReleaseShift = 3, + MemorySemanticsSequentiallyConsistentShift = 4, + MemorySemanticsUniformMemoryShift = 6, + MemorySemanticsSubgroupMemoryShift = 7, + MemorySemanticsWorkgroupMemoryShift = 8, + MemorySemanticsCrossWorkgroupMemoryShift = 9, + MemorySemanticsAtomicCounterMemoryShift = 10, + MemorySemanticsImageMemoryShift = 11, + MemorySemanticsMax = 0x7fffffff, +}; + +enum MemorySemanticsMask { + MemorySemanticsMaskNone = 0, + MemorySemanticsAcquireMask = 0x00000002, + MemorySemanticsReleaseMask = 0x00000004, + MemorySemanticsAcquireReleaseMask = 0x00000008, + MemorySemanticsSequentiallyConsistentMask = 0x00000010, + MemorySemanticsUniformMemoryMask = 0x00000040, + MemorySemanticsSubgroupMemoryMask = 0x00000080, + MemorySemanticsWorkgroupMemoryMask = 0x00000100, + MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + MemorySemanticsAtomicCounterMemoryMask = 0x00000400, + MemorySemanticsImageMemoryMask = 0x00000800, +}; + +enum MemoryAccessShift { + MemoryAccessVolatileShift = 0, + MemoryAccessAlignedShift = 1, + MemoryAccessNontemporalShift = 2, + MemoryAccessMax = 0x7fffffff, +}; + +enum MemoryAccessMask { + MemoryAccessMaskNone = 0, + MemoryAccessVolatileMask = 0x00000001, + MemoryAccessAlignedMask = 0x00000002, + MemoryAccessNontemporalMask = 0x00000004, +}; + +enum Scope { + ScopeCrossDevice = 0, + ScopeDevice = 1, + ScopeWorkgroup = 2, + ScopeSubgroup = 3, + ScopeInvocation = 4, + ScopeMax = 0x7fffffff, +}; + +enum GroupOperation { + GroupOperationReduce = 0, + GroupOperationInclusiveScan = 1, + GroupOperationExclusiveScan = 2, + GroupOperationMax = 0x7fffffff, +}; + +enum KernelEnqueueFlags { + KernelEnqueueFlagsNoWait = 0, + KernelEnqueueFlagsWaitKernel = 1, + KernelEnqueueFlagsWaitWorkGroup = 2, + KernelEnqueueFlagsMax = 0x7fffffff, +}; + +enum KernelProfilingInfoShift { + KernelProfilingInfoCmdExecTimeShift = 0, + KernelProfilingInfoMax = 0x7fffffff, +}; + +enum KernelProfilingInfoMask { + KernelProfilingInfoMaskNone = 0, + KernelProfilingInfoCmdExecTimeMask = 0x00000001, +}; + +enum Capability { + CapabilityMatrix = 0, + CapabilityShader = 1, + CapabilityGeometry = 2, + CapabilityTessellation = 3, + CapabilityAddresses = 4, + CapabilityLinkage = 5, + CapabilityKernel = 6, + CapabilityVector16 = 7, + CapabilityFloat16Buffer = 8, + CapabilityFloat16 = 9, + CapabilityFloat64 = 10, + CapabilityInt64 = 11, + CapabilityInt64Atomics = 12, + CapabilityImageBasic = 13, + CapabilityImageReadWrite = 14, + CapabilityImageMipmap = 15, + CapabilityPipes = 17, + CapabilityGroups = 18, + CapabilityDeviceEnqueue = 19, + CapabilityLiteralSampler = 20, + CapabilityAtomicStorage = 21, + CapabilityInt16 = 22, + CapabilityTessellationPointSize = 23, + CapabilityGeometryPointSize = 24, + CapabilityImageGatherExtended = 25, + CapabilityStorageImageMultisample = 27, + CapabilityUniformBufferArrayDynamicIndexing = 28, + CapabilitySampledImageArrayDynamicIndexing = 29, + CapabilityStorageBufferArrayDynamicIndexing = 30, + CapabilityStorageImageArrayDynamicIndexing = 31, + CapabilityClipDistance = 32, + CapabilityCullDistance = 33, + CapabilityImageCubeArray = 34, + CapabilitySampleRateShading = 35, + CapabilityImageRect = 36, + CapabilitySampledRect = 37, + CapabilityGenericPointer = 38, + CapabilityInt8 = 39, + CapabilityInputAttachment = 40, + CapabilitySparseResidency = 41, + CapabilityMinLod = 42, + CapabilitySampled1D = 43, + CapabilityImage1D = 44, + CapabilitySampledCubeArray = 45, + CapabilitySampledBuffer = 46, + CapabilityImageBuffer = 47, + CapabilityImageMSArray = 48, + CapabilityStorageImageExtendedFormats = 49, + CapabilityImageQuery = 50, + CapabilityDerivativeControl = 51, + CapabilityInterpolationFunction = 52, + CapabilityTransformFeedback = 53, + CapabilityGeometryStreams = 54, + CapabilityStorageImageReadWithoutFormat = 55, + CapabilityStorageImageWriteWithoutFormat = 56, + CapabilityMultiViewport = 57, + CapabilitySubgroupDispatch = 58, + CapabilityNamedBarrier = 59, + CapabilityPipeStorage = 60, + CapabilitySubgroupBallotKHR = 4423, + CapabilityDrawParameters = 4427, + CapabilitySubgroupVoteKHR = 4431, + CapabilityStorageBuffer16BitAccess = 4433, + CapabilityStorageUniformBufferBlock16 = 4433, + CapabilityStorageUniform16 = 4434, + CapabilityUniformAndStorageBuffer16BitAccess = 4434, + CapabilityStoragePushConstant16 = 4435, + CapabilityStorageInputOutput16 = 4436, + CapabilityDeviceGroup = 4437, + CapabilityMultiView = 4439, + CapabilityVariablePointersStorageBuffer = 4441, + CapabilityVariablePointers = 4442, + CapabilityAtomicStorageOps = 4445, + CapabilitySampleMaskPostDepthCoverage = 4447, + CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, + CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, + CapabilitySampleMaskOverrideCoverageNV = 5249, + CapabilityGeometryShaderPassthroughNV = 5251, + CapabilityShaderViewportIndexLayerEXT = 5254, + CapabilityShaderViewportIndexLayerNV = 5254, + CapabilityShaderViewportMaskNV = 5255, + CapabilityShaderStereoViewNV = 5259, + CapabilityPerViewAttributesNV = 5260, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, + CapabilityMax = 0x7fffffff, +}; + +enum Op { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + OpMax = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.hpp11 b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.hpp11 new file mode 100644 index 00000000000..7a875fdb166 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.hpp11 @@ -0,0 +1,1030 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10200 +#define SPV_REVISION 2 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010200; +static const unsigned int Revision = 2; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.json new file mode 100644 index 00000000000..9c0ff0a43e3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.json @@ -0,0 +1,1046 @@ +{ + "spv": + { + "meta": + { + "Comment": + [ + [ + "Copyright (c) 2014-2018 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + [ + "This header is automatically generated by the same tool that creates", + "the Binary Section of the SPIR-V specification." + ], + [ + "Enumeration tokens for SPIR-V, in various styles:", + " C, C++, C++11, JSON, Lua, Python", + "", + "- C will have tokens with a \"Spv\" prefix, e.g.: SpvSourceLanguageGLSL", + "- C++ will have tokens in the \"spv\" name space, e.g.: spv::SourceLanguageGLSL", + "- C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL", + "- Lua will use tables, e.g.: spv.SourceLanguage.GLSL", + "- Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']", + "", + "Some tokens act like mask values, which can be OR'd together,", + "while others are mutually exclusive. The mask-like ones have", + "\"Mask\" in their name, and a parallel enum that has the shift", + "amount (1 << x) for each corresponding enumerant." + ] + ], + "MagicNumber": 119734787, + "Version": 66048, + "Revision": 2, + "OpCodeMask": 65535, + "WordCountShift": 16 + }, + "enum": + [ + { + "Name": "SourceLanguage", + "Type": "Value", + "Values": + { + "Unknown": 0, + "ESSL": 1, + "GLSL": 2, + "OpenCL_C": 3, + "OpenCL_CPP": 4, + "HLSL": 5 + } + }, + { + "Name": "ExecutionModel", + "Type": "Value", + "Values": + { + "Vertex": 0, + "TessellationControl": 1, + "TessellationEvaluation": 2, + "Geometry": 3, + "Fragment": 4, + "GLCompute": 5, + "Kernel": 6 + } + }, + { + "Name": "AddressingModel", + "Type": "Value", + "Values": + { + "Logical": 0, + "Physical32": 1, + "Physical64": 2 + } + }, + { + "Name": "MemoryModel", + "Type": "Value", + "Values": + { + "Simple": 0, + "GLSL450": 1, + "OpenCL": 2 + } + }, + { + "Name": "ExecutionMode", + "Type": "Value", + "Values": + { + "Invocations": 0, + "SpacingEqual": 1, + "SpacingFractionalEven": 2, + "SpacingFractionalOdd": 3, + "VertexOrderCw": 4, + "VertexOrderCcw": 5, + "PixelCenterInteger": 6, + "OriginUpperLeft": 7, + "OriginLowerLeft": 8, + "EarlyFragmentTests": 9, + "PointMode": 10, + "Xfb": 11, + "DepthReplacing": 12, + "DepthGreater": 14, + "DepthLess": 15, + "DepthUnchanged": 16, + "LocalSize": 17, + "LocalSizeHint": 18, + "InputPoints": 19, + "InputLines": 20, + "InputLinesAdjacency": 21, + "Triangles": 22, + "InputTrianglesAdjacency": 23, + "Quads": 24, + "Isolines": 25, + "OutputVertices": 26, + "OutputPoints": 27, + "OutputLineStrip": 28, + "OutputTriangleStrip": 29, + "VecTypeHint": 30, + "ContractionOff": 31, + "Initializer": 33, + "Finalizer": 34, + "SubgroupSize": 35, + "SubgroupsPerWorkgroup": 36, + "SubgroupsPerWorkgroupId": 37, + "LocalSizeId": 38, + "LocalSizeHintId": 39, + "PostDepthCoverage": 4446, + "StencilRefReplacingEXT": 5027 + } + }, + { + "Name": "StorageClass", + "Type": "Value", + "Values": + { + "UniformConstant": 0, + "Input": 1, + "Uniform": 2, + "Output": 3, + "Workgroup": 4, + "CrossWorkgroup": 5, + "Private": 6, + "Function": 7, + "Generic": 8, + "PushConstant": 9, + "AtomicCounter": 10, + "Image": 11, + "StorageBuffer": 12 + } + }, + { + "Name": "Dim", + "Type": "Value", + "Values": + { + "Dim1D": 0, + "Dim2D": 1, + "Dim3D": 2, + "Cube": 3, + "Rect": 4, + "Buffer": 5, + "SubpassData": 6 + } + }, + { + "Name": "SamplerAddressingMode", + "Type": "Value", + "Values": + { + "None": 0, + "ClampToEdge": 1, + "Clamp": 2, + "Repeat": 3, + "RepeatMirrored": 4 + } + }, + { + "Name": "SamplerFilterMode", + "Type": "Value", + "Values": + { + "Nearest": 0, + "Linear": 1 + } + }, + { + "Name": "ImageFormat", + "Type": "Value", + "Values": + { + "Unknown": 0, + "Rgba32f": 1, + "Rgba16f": 2, + "R32f": 3, + "Rgba8": 4, + "Rgba8Snorm": 5, + "Rg32f": 6, + "Rg16f": 7, + "R11fG11fB10f": 8, + "R16f": 9, + "Rgba16": 10, + "Rgb10A2": 11, + "Rg16": 12, + "Rg8": 13, + "R16": 14, + "R8": 15, + "Rgba16Snorm": 16, + "Rg16Snorm": 17, + "Rg8Snorm": 18, + "R16Snorm": 19, + "R8Snorm": 20, + "Rgba32i": 21, + "Rgba16i": 22, + "Rgba8i": 23, + "R32i": 24, + "Rg32i": 25, + "Rg16i": 26, + "Rg8i": 27, + "R16i": 28, + "R8i": 29, + "Rgba32ui": 30, + "Rgba16ui": 31, + "Rgba8ui": 32, + "R32ui": 33, + "Rgb10a2ui": 34, + "Rg32ui": 35, + "Rg16ui": 36, + "Rg8ui": 37, + "R16ui": 38, + "R8ui": 39 + } + }, + { + "Name": "ImageChannelOrder", + "Type": "Value", + "Values": + { + "R": 0, + "A": 1, + "RG": 2, + "RA": 3, + "RGB": 4, + "RGBA": 5, + "BGRA": 6, + "ARGB": 7, + "Intensity": 8, + "Luminance": 9, + "Rx": 10, + "RGx": 11, + "RGBx": 12, + "Depth": 13, + "DepthStencil": 14, + "sRGB": 15, + "sRGBx": 16, + "sRGBA": 17, + "sBGRA": 18, + "ABGR": 19 + } + }, + { + "Name": "ImageChannelDataType", + "Type": "Value", + "Values": + { + "SnormInt8": 0, + "SnormInt16": 1, + "UnormInt8": 2, + "UnormInt16": 3, + "UnormShort565": 4, + "UnormShort555": 5, + "UnormInt101010": 6, + "SignedInt8": 7, + "SignedInt16": 8, + "SignedInt32": 9, + "UnsignedInt8": 10, + "UnsignedInt16": 11, + "UnsignedInt32": 12, + "HalfFloat": 13, + "Float": 14, + "UnormInt24": 15, + "UnormInt101010_2": 16 + } + }, + { + "Name": "ImageOperands", + "Type": "Bit", + "Values": + { + "Bias": 0, + "Lod": 1, + "Grad": 2, + "ConstOffset": 3, + "Offset": 4, + "ConstOffsets": 5, + "Sample": 6, + "MinLod": 7 + } + }, + { + "Name": "FPFastMathMode", + "Type": "Bit", + "Values": + { + "NotNaN": 0, + "NotInf": 1, + "NSZ": 2, + "AllowRecip": 3, + "Fast": 4 + } + }, + { + "Name": "FPRoundingMode", + "Type": "Value", + "Values": + { + "RTE": 0, + "RTZ": 1, + "RTP": 2, + "RTN": 3 + } + }, + { + "Name": "LinkageType", + "Type": "Value", + "Values": + { + "Export": 0, + "Import": 1 + } + }, + { + "Name": "AccessQualifier", + "Type": "Value", + "Values": + { + "ReadOnly": 0, + "WriteOnly": 1, + "ReadWrite": 2 + } + }, + { + "Name": "FunctionParameterAttribute", + "Type": "Value", + "Values": + { + "Zext": 0, + "Sext": 1, + "ByVal": 2, + "Sret": 3, + "NoAlias": 4, + "NoCapture": 5, + "NoWrite": 6, + "NoReadWrite": 7 + } + }, + { + "Name": "Decoration", + "Type": "Value", + "Values": + { + "RelaxedPrecision": 0, + "SpecId": 1, + "Block": 2, + "BufferBlock": 3, + "RowMajor": 4, + "ColMajor": 5, + "ArrayStride": 6, + "MatrixStride": 7, + "GLSLShared": 8, + "GLSLPacked": 9, + "CPacked": 10, + "BuiltIn": 11, + "NoPerspective": 13, + "Flat": 14, + "Patch": 15, + "Centroid": 16, + "Sample": 17, + "Invariant": 18, + "Restrict": 19, + "Aliased": 20, + "Volatile": 21, + "Constant": 22, + "Coherent": 23, + "NonWritable": 24, + "NonReadable": 25, + "Uniform": 26, + "SaturatedConversion": 28, + "Stream": 29, + "Location": 30, + "Component": 31, + "Index": 32, + "Binding": 33, + "DescriptorSet": 34, + "Offset": 35, + "XfbBuffer": 36, + "XfbStride": 37, + "FuncParamAttr": 38, + "FPRoundingMode": 39, + "FPFastMathMode": 40, + "LinkageAttributes": 41, + "NoContraction": 42, + "InputAttachmentIndex": 43, + "Alignment": 44, + "MaxByteOffset": 45, + "AlignmentId": 46, + "MaxByteOffsetId": 47, + "ExplicitInterpAMD": 4999, + "OverrideCoverageNV": 5248, + "PassthroughNV": 5250, + "ViewportRelativeNV": 5252, + "SecondaryViewportRelativeNV": 5256, + "HlslCounterBufferGOOGLE": 5634, + "HlslSemanticGOOGLE": 5635 + } + }, + { + "Name": "BuiltIn", + "Type": "Value", + "Values": + { + "Position": 0, + "PointSize": 1, + "ClipDistance": 3, + "CullDistance": 4, + "VertexId": 5, + "InstanceId": 6, + "PrimitiveId": 7, + "InvocationId": 8, + "Layer": 9, + "ViewportIndex": 10, + "TessLevelOuter": 11, + "TessLevelInner": 12, + "TessCoord": 13, + "PatchVertices": 14, + "FragCoord": 15, + "PointCoord": 16, + "FrontFacing": 17, + "SampleId": 18, + "SamplePosition": 19, + "SampleMask": 20, + "FragDepth": 22, + "HelperInvocation": 23, + "NumWorkgroups": 24, + "WorkgroupSize": 25, + "WorkgroupId": 26, + "LocalInvocationId": 27, + "GlobalInvocationId": 28, + "LocalInvocationIndex": 29, + "WorkDim": 30, + "GlobalSize": 31, + "EnqueuedWorkgroupSize": 32, + "GlobalOffset": 33, + "GlobalLinearId": 34, + "SubgroupSize": 36, + "SubgroupMaxSize": 37, + "NumSubgroups": 38, + "NumEnqueuedSubgroups": 39, + "SubgroupId": 40, + "SubgroupLocalInvocationId": 41, + "VertexIndex": 42, + "InstanceIndex": 43, + "SubgroupEqMaskKHR": 4416, + "SubgroupGeMaskKHR": 4417, + "SubgroupGtMaskKHR": 4418, + "SubgroupLeMaskKHR": 4419, + "SubgroupLtMaskKHR": 4420, + "BaseVertex": 4424, + "BaseInstance": 4425, + "DrawIndex": 4426, + "DeviceIndex": 4438, + "ViewIndex": 4440, + "BaryCoordNoPerspAMD": 4992, + "BaryCoordNoPerspCentroidAMD": 4993, + "BaryCoordNoPerspSampleAMD": 4994, + "BaryCoordSmoothAMD": 4995, + "BaryCoordSmoothCentroidAMD": 4996, + "BaryCoordSmoothSampleAMD": 4997, + "BaryCoordPullModelAMD": 4998, + "FragStencilRefEXT": 5014, + "ViewportMaskNV": 5253, + "SecondaryPositionNV": 5257, + "SecondaryViewportMaskNV": 5258, + "PositionPerViewNV": 5261, + "ViewportMaskPerViewNV": 5262 + } + }, + { + "Name": "SelectionControl", + "Type": "Bit", + "Values": + { + "Flatten": 0, + "DontFlatten": 1 + } + }, + { + "Name": "LoopControl", + "Type": "Bit", + "Values": + { + "Unroll": 0, + "DontUnroll": 1, + "DependencyInfinite": 2, + "DependencyLength": 3 + } + }, + { + "Name": "FunctionControl", + "Type": "Bit", + "Values": + { + "Inline": 0, + "DontInline": 1, + "Pure": 2, + "Const": 3 + } + }, + { + "Name": "MemorySemantics", + "Type": "Bit", + "Values": + { + "Acquire": 1, + "Release": 2, + "AcquireRelease": 3, + "SequentiallyConsistent": 4, + "UniformMemory": 6, + "SubgroupMemory": 7, + "WorkgroupMemory": 8, + "CrossWorkgroupMemory": 9, + "AtomicCounterMemory": 10, + "ImageMemory": 11 + } + }, + { + "Name": "MemoryAccess", + "Type": "Bit", + "Values": + { + "Volatile": 0, + "Aligned": 1, + "Nontemporal": 2 + } + }, + { + "Name": "Scope", + "Type": "Value", + "Values": + { + "CrossDevice": 0, + "Device": 1, + "Workgroup": 2, + "Subgroup": 3, + "Invocation": 4 + } + }, + { + "Name": "GroupOperation", + "Type": "Value", + "Values": + { + "Reduce": 0, + "InclusiveScan": 1, + "ExclusiveScan": 2 + } + }, + { + "Name": "KernelEnqueueFlags", + "Type": "Value", + "Values": + { + "NoWait": 0, + "WaitKernel": 1, + "WaitWorkGroup": 2 + } + }, + { + "Name": "KernelProfilingInfo", + "Type": "Bit", + "Values": + { + "CmdExecTime": 0 + } + }, + { + "Name": "Capability", + "Type": "Value", + "Values": + { + "Matrix": 0, + "Shader": 1, + "Geometry": 2, + "Tessellation": 3, + "Addresses": 4, + "Linkage": 5, + "Kernel": 6, + "Vector16": 7, + "Float16Buffer": 8, + "Float16": 9, + "Float64": 10, + "Int64": 11, + "Int64Atomics": 12, + "ImageBasic": 13, + "ImageReadWrite": 14, + "ImageMipmap": 15, + "Pipes": 17, + "Groups": 18, + "DeviceEnqueue": 19, + "LiteralSampler": 20, + "AtomicStorage": 21, + "Int16": 22, + "TessellationPointSize": 23, + "GeometryPointSize": 24, + "ImageGatherExtended": 25, + "StorageImageMultisample": 27, + "UniformBufferArrayDynamicIndexing": 28, + "SampledImageArrayDynamicIndexing": 29, + "StorageBufferArrayDynamicIndexing": 30, + "StorageImageArrayDynamicIndexing": 31, + "ClipDistance": 32, + "CullDistance": 33, + "ImageCubeArray": 34, + "SampleRateShading": 35, + "ImageRect": 36, + "SampledRect": 37, + "GenericPointer": 38, + "Int8": 39, + "InputAttachment": 40, + "SparseResidency": 41, + "MinLod": 42, + "Sampled1D": 43, + "Image1D": 44, + "SampledCubeArray": 45, + "SampledBuffer": 46, + "ImageBuffer": 47, + "ImageMSArray": 48, + "StorageImageExtendedFormats": 49, + "ImageQuery": 50, + "DerivativeControl": 51, + "InterpolationFunction": 52, + "TransformFeedback": 53, + "GeometryStreams": 54, + "StorageImageReadWithoutFormat": 55, + "StorageImageWriteWithoutFormat": 56, + "MultiViewport": 57, + "SubgroupDispatch": 58, + "NamedBarrier": 59, + "PipeStorage": 60, + "SubgroupBallotKHR": 4423, + "DrawParameters": 4427, + "SubgroupVoteKHR": 4431, + "StorageBuffer16BitAccess": 4433, + "StorageUniformBufferBlock16": 4433, + "StorageUniform16": 4434, + "UniformAndStorageBuffer16BitAccess": 4434, + "StoragePushConstant16": 4435, + "StorageInputOutput16": 4436, + "DeviceGroup": 4437, + "MultiView": 4439, + "VariablePointersStorageBuffer": 4441, + "VariablePointers": 4442, + "AtomicStorageOps": 4445, + "SampleMaskPostDepthCoverage": 4447, + "ImageGatherBiasLodAMD": 5009, + "FragmentMaskAMD": 5010, + "StencilExportEXT": 5013, + "ImageReadWriteLodAMD": 5015, + "SampleMaskOverrideCoverageNV": 5249, + "GeometryShaderPassthroughNV": 5251, + "ShaderViewportIndexLayerEXT": 5254, + "ShaderViewportIndexLayerNV": 5254, + "ShaderViewportMaskNV": 5255, + "ShaderStereoViewNV": 5259, + "PerViewAttributesNV": 5260, + "SubgroupShuffleINTEL": 5568, + "SubgroupBufferBlockIOINTEL": 5569, + "SubgroupImageBlockIOINTEL": 5570 + } + }, + { + "Name": "Op", + "Type": "Value", + "Values": + { + "OpNop": 0, + "OpUndef": 1, + "OpSourceContinued": 2, + "OpSource": 3, + "OpSourceExtension": 4, + "OpName": 5, + "OpMemberName": 6, + "OpString": 7, + "OpLine": 8, + "OpExtension": 10, + "OpExtInstImport": 11, + "OpExtInst": 12, + "OpMemoryModel": 14, + "OpEntryPoint": 15, + "OpExecutionMode": 16, + "OpCapability": 17, + "OpTypeVoid": 19, + "OpTypeBool": 20, + "OpTypeInt": 21, + "OpTypeFloat": 22, + "OpTypeVector": 23, + "OpTypeMatrix": 24, + "OpTypeImage": 25, + "OpTypeSampler": 26, + "OpTypeSampledImage": 27, + "OpTypeArray": 28, + "OpTypeRuntimeArray": 29, + "OpTypeStruct": 30, + "OpTypeOpaque": 31, + "OpTypePointer": 32, + "OpTypeFunction": 33, + "OpTypeEvent": 34, + "OpTypeDeviceEvent": 35, + "OpTypeReserveId": 36, + "OpTypeQueue": 37, + "OpTypePipe": 38, + "OpTypeForwardPointer": 39, + "OpConstantTrue": 41, + "OpConstantFalse": 42, + "OpConstant": 43, + "OpConstantComposite": 44, + "OpConstantSampler": 45, + "OpConstantNull": 46, + "OpSpecConstantTrue": 48, + "OpSpecConstantFalse": 49, + "OpSpecConstant": 50, + "OpSpecConstantComposite": 51, + "OpSpecConstantOp": 52, + "OpFunction": 54, + "OpFunctionParameter": 55, + "OpFunctionEnd": 56, + "OpFunctionCall": 57, + "OpVariable": 59, + "OpImageTexelPointer": 60, + "OpLoad": 61, + "OpStore": 62, + "OpCopyMemory": 63, + "OpCopyMemorySized": 64, + "OpAccessChain": 65, + "OpInBoundsAccessChain": 66, + "OpPtrAccessChain": 67, + "OpArrayLength": 68, + "OpGenericPtrMemSemantics": 69, + "OpInBoundsPtrAccessChain": 70, + "OpDecorate": 71, + "OpMemberDecorate": 72, + "OpDecorationGroup": 73, + "OpGroupDecorate": 74, + "OpGroupMemberDecorate": 75, + "OpVectorExtractDynamic": 77, + "OpVectorInsertDynamic": 78, + "OpVectorShuffle": 79, + "OpCompositeConstruct": 80, + "OpCompositeExtract": 81, + "OpCompositeInsert": 82, + "OpCopyObject": 83, + "OpTranspose": 84, + "OpSampledImage": 86, + "OpImageSampleImplicitLod": 87, + "OpImageSampleExplicitLod": 88, + "OpImageSampleDrefImplicitLod": 89, + "OpImageSampleDrefExplicitLod": 90, + "OpImageSampleProjImplicitLod": 91, + "OpImageSampleProjExplicitLod": 92, + "OpImageSampleProjDrefImplicitLod": 93, + "OpImageSampleProjDrefExplicitLod": 94, + "OpImageFetch": 95, + "OpImageGather": 96, + "OpImageDrefGather": 97, + "OpImageRead": 98, + "OpImageWrite": 99, + "OpImage": 100, + "OpImageQueryFormat": 101, + "OpImageQueryOrder": 102, + "OpImageQuerySizeLod": 103, + "OpImageQuerySize": 104, + "OpImageQueryLod": 105, + "OpImageQueryLevels": 106, + "OpImageQuerySamples": 107, + "OpConvertFToU": 109, + "OpConvertFToS": 110, + "OpConvertSToF": 111, + "OpConvertUToF": 112, + "OpUConvert": 113, + "OpSConvert": 114, + "OpFConvert": 115, + "OpQuantizeToF16": 116, + "OpConvertPtrToU": 117, + "OpSatConvertSToU": 118, + "OpSatConvertUToS": 119, + "OpConvertUToPtr": 120, + "OpPtrCastToGeneric": 121, + "OpGenericCastToPtr": 122, + "OpGenericCastToPtrExplicit": 123, + "OpBitcast": 124, + "OpSNegate": 126, + "OpFNegate": 127, + "OpIAdd": 128, + "OpFAdd": 129, + "OpISub": 130, + "OpFSub": 131, + "OpIMul": 132, + "OpFMul": 133, + "OpUDiv": 134, + "OpSDiv": 135, + "OpFDiv": 136, + "OpUMod": 137, + "OpSRem": 138, + "OpSMod": 139, + "OpFRem": 140, + "OpFMod": 141, + "OpVectorTimesScalar": 142, + "OpMatrixTimesScalar": 143, + "OpVectorTimesMatrix": 144, + "OpMatrixTimesVector": 145, + "OpMatrixTimesMatrix": 146, + "OpOuterProduct": 147, + "OpDot": 148, + "OpIAddCarry": 149, + "OpISubBorrow": 150, + "OpUMulExtended": 151, + "OpSMulExtended": 152, + "OpAny": 154, + "OpAll": 155, + "OpIsNan": 156, + "OpIsInf": 157, + "OpIsFinite": 158, + "OpIsNormal": 159, + "OpSignBitSet": 160, + "OpLessOrGreater": 161, + "OpOrdered": 162, + "OpUnordered": 163, + "OpLogicalEqual": 164, + "OpLogicalNotEqual": 165, + "OpLogicalOr": 166, + "OpLogicalAnd": 167, + "OpLogicalNot": 168, + "OpSelect": 169, + "OpIEqual": 170, + "OpINotEqual": 171, + "OpUGreaterThan": 172, + "OpSGreaterThan": 173, + "OpUGreaterThanEqual": 174, + "OpSGreaterThanEqual": 175, + "OpULessThan": 176, + "OpSLessThan": 177, + "OpULessThanEqual": 178, + "OpSLessThanEqual": 179, + "OpFOrdEqual": 180, + "OpFUnordEqual": 181, + "OpFOrdNotEqual": 182, + "OpFUnordNotEqual": 183, + "OpFOrdLessThan": 184, + "OpFUnordLessThan": 185, + "OpFOrdGreaterThan": 186, + "OpFUnordGreaterThan": 187, + "OpFOrdLessThanEqual": 188, + "OpFUnordLessThanEqual": 189, + "OpFOrdGreaterThanEqual": 190, + "OpFUnordGreaterThanEqual": 191, + "OpShiftRightLogical": 194, + "OpShiftRightArithmetic": 195, + "OpShiftLeftLogical": 196, + "OpBitwiseOr": 197, + "OpBitwiseXor": 198, + "OpBitwiseAnd": 199, + "OpNot": 200, + "OpBitFieldInsert": 201, + "OpBitFieldSExtract": 202, + "OpBitFieldUExtract": 203, + "OpBitReverse": 204, + "OpBitCount": 205, + "OpDPdx": 207, + "OpDPdy": 208, + "OpFwidth": 209, + "OpDPdxFine": 210, + "OpDPdyFine": 211, + "OpFwidthFine": 212, + "OpDPdxCoarse": 213, + "OpDPdyCoarse": 214, + "OpFwidthCoarse": 215, + "OpEmitVertex": 218, + "OpEndPrimitive": 219, + "OpEmitStreamVertex": 220, + "OpEndStreamPrimitive": 221, + "OpControlBarrier": 224, + "OpMemoryBarrier": 225, + "OpAtomicLoad": 227, + "OpAtomicStore": 228, + "OpAtomicExchange": 229, + "OpAtomicCompareExchange": 230, + "OpAtomicCompareExchangeWeak": 231, + "OpAtomicIIncrement": 232, + "OpAtomicIDecrement": 233, + "OpAtomicIAdd": 234, + "OpAtomicISub": 235, + "OpAtomicSMin": 236, + "OpAtomicUMin": 237, + "OpAtomicSMax": 238, + "OpAtomicUMax": 239, + "OpAtomicAnd": 240, + "OpAtomicOr": 241, + "OpAtomicXor": 242, + "OpPhi": 245, + "OpLoopMerge": 246, + "OpSelectionMerge": 247, + "OpLabel": 248, + "OpBranch": 249, + "OpBranchConditional": 250, + "OpSwitch": 251, + "OpKill": 252, + "OpReturn": 253, + "OpReturnValue": 254, + "OpUnreachable": 255, + "OpLifetimeStart": 256, + "OpLifetimeStop": 257, + "OpGroupAsyncCopy": 259, + "OpGroupWaitEvents": 260, + "OpGroupAll": 261, + "OpGroupAny": 262, + "OpGroupBroadcast": 263, + "OpGroupIAdd": 264, + "OpGroupFAdd": 265, + "OpGroupFMin": 266, + "OpGroupUMin": 267, + "OpGroupSMin": 268, + "OpGroupFMax": 269, + "OpGroupUMax": 270, + "OpGroupSMax": 271, + "OpReadPipe": 274, + "OpWritePipe": 275, + "OpReservedReadPipe": 276, + "OpReservedWritePipe": 277, + "OpReserveReadPipePackets": 278, + "OpReserveWritePipePackets": 279, + "OpCommitReadPipe": 280, + "OpCommitWritePipe": 281, + "OpIsValidReserveId": 282, + "OpGetNumPipePackets": 283, + "OpGetMaxPipePackets": 284, + "OpGroupReserveReadPipePackets": 285, + "OpGroupReserveWritePipePackets": 286, + "OpGroupCommitReadPipe": 287, + "OpGroupCommitWritePipe": 288, + "OpEnqueueMarker": 291, + "OpEnqueueKernel": 292, + "OpGetKernelNDrangeSubGroupCount": 293, + "OpGetKernelNDrangeMaxSubGroupSize": 294, + "OpGetKernelWorkGroupSize": 295, + "OpGetKernelPreferredWorkGroupSizeMultiple": 296, + "OpRetainEvent": 297, + "OpReleaseEvent": 298, + "OpCreateUserEvent": 299, + "OpIsValidEvent": 300, + "OpSetUserEventStatus": 301, + "OpCaptureEventProfilingInfo": 302, + "OpGetDefaultQueue": 303, + "OpBuildNDRange": 304, + "OpImageSparseSampleImplicitLod": 305, + "OpImageSparseSampleExplicitLod": 306, + "OpImageSparseSampleDrefImplicitLod": 307, + "OpImageSparseSampleDrefExplicitLod": 308, + "OpImageSparseSampleProjImplicitLod": 309, + "OpImageSparseSampleProjExplicitLod": 310, + "OpImageSparseSampleProjDrefImplicitLod": 311, + "OpImageSparseSampleProjDrefExplicitLod": 312, + "OpImageSparseFetch": 313, + "OpImageSparseGather": 314, + "OpImageSparseDrefGather": 315, + "OpImageSparseTexelsResident": 316, + "OpNoLine": 317, + "OpAtomicFlagTestAndSet": 318, + "OpAtomicFlagClear": 319, + "OpImageSparseRead": 320, + "OpSizeOf": 321, + "OpTypePipeStorage": 322, + "OpConstantPipeStorage": 323, + "OpCreatePipeFromPipeStorage": 324, + "OpGetKernelLocalSizeForSubgroupCount": 325, + "OpGetKernelMaxNumSubgroups": 326, + "OpTypeNamedBarrier": 327, + "OpNamedBarrierInitialize": 328, + "OpMemoryNamedBarrier": 329, + "OpModuleProcessed": 330, + "OpExecutionModeId": 331, + "OpDecorateId": 332, + "OpSubgroupBallotKHR": 4421, + "OpSubgroupFirstInvocationKHR": 4422, + "OpSubgroupAllKHR": 4428, + "OpSubgroupAnyKHR": 4429, + "OpSubgroupAllEqualKHR": 4430, + "OpSubgroupReadInvocationKHR": 4432, + "OpGroupIAddNonUniformAMD": 5000, + "OpGroupFAddNonUniformAMD": 5001, + "OpGroupFMinNonUniformAMD": 5002, + "OpGroupUMinNonUniformAMD": 5003, + "OpGroupSMinNonUniformAMD": 5004, + "OpGroupFMaxNonUniformAMD": 5005, + "OpGroupUMaxNonUniformAMD": 5006, + "OpGroupSMaxNonUniformAMD": 5007, + "OpFragmentMaskFetchAMD": 5011, + "OpFragmentFetchAMD": 5012, + "OpSubgroupShuffleINTEL": 5571, + "OpSubgroupShuffleDownINTEL": 5572, + "OpSubgroupShuffleUpINTEL": 5573, + "OpSubgroupShuffleXorINTEL": 5574, + "OpSubgroupBlockReadINTEL": 5575, + "OpSubgroupBlockWriteINTEL": 5576, + "OpSubgroupImageBlockReadINTEL": 5577, + "OpSubgroupImageBlockWriteINTEL": 5578, + "OpDecorateStringGOOGLE": 5632, + "OpMemberDecorateStringGOOGLE": 5633 + } + } + ] + } +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.lua b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.lua new file mode 100644 index 00000000000..0de507d5c91 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.lua @@ -0,0 +1,977 @@ +-- Copyright (c) 2014-2018 The Khronos Group Inc. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and/or associated documentation files (the "Materials"), +-- to deal in the Materials without restriction, including without limitation +-- the rights to use, copy, modify, merge, publish, distribute, sublicense, +-- and/or sell copies of the Materials, and to permit persons to whom the +-- Materials are furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Materials. +-- +-- MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +-- STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +-- HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +-- +-- THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +-- FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +-- IN THE MATERIALS. + +-- This header is automatically generated by the same tool that creates +-- the Binary Section of the SPIR-V specification. + +-- Enumeration tokens for SPIR-V, in various styles: +-- C, C++, C++11, JSON, Lua, Python +-- +-- - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +-- - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +-- - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +-- - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +-- - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +-- +-- Some tokens act like mask values, which can be OR'd together, +-- while others are mutually exclusive. The mask-like ones have +-- "Mask" in their name, and a parallel enum that has the shift +-- amount (1 << x) for each corresponding enumerant. + +spv = { + MagicNumber = 0x07230203, + Version = 0x00010200, + Revision = 2, + OpCodeMask = 0xffff, + WordCountShift = 16, + + SourceLanguage = { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + }, + + ExecutionModel = { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + }, + + AddressingModel = { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + }, + + MemoryModel = { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + }, + + ExecutionMode = { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + }, + + StorageClass = { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + }, + + Dim = { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + }, + + SamplerAddressingMode = { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + }, + + SamplerFilterMode = { + Nearest = 0, + Linear = 1, + }, + + ImageFormat = { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + }, + + ImageChannelOrder = { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + }, + + ImageChannelDataType = { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + }, + + ImageOperandsShift = { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + }, + + ImageOperandsMask = { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, + }, + + FPFastMathModeShift = { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + }, + + FPFastMathModeMask = { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, + }, + + FPRoundingMode = { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + }, + + LinkageType = { + Export = 0, + Import = 1, + }, + + AccessQualifier = { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + }, + + FunctionParameterAttribute = { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + }, + + Decoration = { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + }, + + BuiltIn = { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + }, + + SelectionControlShift = { + Flatten = 0, + DontFlatten = 1, + }, + + SelectionControlMask = { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, + }, + + LoopControlShift = { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + }, + + LoopControlMask = { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, + }, + + FunctionControlShift = { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + }, + + FunctionControlMask = { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, + }, + + MemorySemanticsShift = { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + }, + + MemorySemanticsMask = { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, + }, + + MemoryAccessShift = { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + }, + + MemoryAccessMask = { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, + }, + + Scope = { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + }, + + GroupOperation = { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + }, + + KernelEnqueueFlags = { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + }, + + KernelProfilingInfoShift = { + CmdExecTime = 0, + }, + + KernelProfilingInfoMask = { + MaskNone = 0, + CmdExecTime = 0x00000001, + }, + + Capability = { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + }, + + Op = { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.py b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.py new file mode 100644 index 00000000000..cefee4d66ac --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/1.2/spirv.py @@ -0,0 +1,977 @@ +# Copyright (c) 2014-2018 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and/or associated documentation files (the "Materials"), +# to deal in the Materials without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Materials, and to permit persons to whom the +# Materials are furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Materials. +# +# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +# STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +# HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +# +# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +# IN THE MATERIALS. + +# This header is automatically generated by the same tool that creates +# the Binary Section of the SPIR-V specification. + +# Enumeration tokens for SPIR-V, in various styles: +# C, C++, C++11, JSON, Lua, Python +# +# - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +# - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +# - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +# - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +# - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +# +# Some tokens act like mask values, which can be OR'd together, +# while others are mutually exclusive. The mask-like ones have +# "Mask" in their name, and a parallel enum that has the shift +# amount (1 << x) for each corresponding enumerant. + +spv = { + 'MagicNumber' : 0x07230203, + 'Version' : 0x00010200, + 'Revision' : 2, + 'OpCodeMask' : 0xffff, + 'WordCountShift' : 16, + + 'SourceLanguage' : { + 'Unknown' : 0, + 'ESSL' : 1, + 'GLSL' : 2, + 'OpenCL_C' : 3, + 'OpenCL_CPP' : 4, + 'HLSL' : 5, + }, + + 'ExecutionModel' : { + 'Vertex' : 0, + 'TessellationControl' : 1, + 'TessellationEvaluation' : 2, + 'Geometry' : 3, + 'Fragment' : 4, + 'GLCompute' : 5, + 'Kernel' : 6, + }, + + 'AddressingModel' : { + 'Logical' : 0, + 'Physical32' : 1, + 'Physical64' : 2, + }, + + 'MemoryModel' : { + 'Simple' : 0, + 'GLSL450' : 1, + 'OpenCL' : 2, + }, + + 'ExecutionMode' : { + 'Invocations' : 0, + 'SpacingEqual' : 1, + 'SpacingFractionalEven' : 2, + 'SpacingFractionalOdd' : 3, + 'VertexOrderCw' : 4, + 'VertexOrderCcw' : 5, + 'PixelCenterInteger' : 6, + 'OriginUpperLeft' : 7, + 'OriginLowerLeft' : 8, + 'EarlyFragmentTests' : 9, + 'PointMode' : 10, + 'Xfb' : 11, + 'DepthReplacing' : 12, + 'DepthGreater' : 14, + 'DepthLess' : 15, + 'DepthUnchanged' : 16, + 'LocalSize' : 17, + 'LocalSizeHint' : 18, + 'InputPoints' : 19, + 'InputLines' : 20, + 'InputLinesAdjacency' : 21, + 'Triangles' : 22, + 'InputTrianglesAdjacency' : 23, + 'Quads' : 24, + 'Isolines' : 25, + 'OutputVertices' : 26, + 'OutputPoints' : 27, + 'OutputLineStrip' : 28, + 'OutputTriangleStrip' : 29, + 'VecTypeHint' : 30, + 'ContractionOff' : 31, + 'Initializer' : 33, + 'Finalizer' : 34, + 'SubgroupSize' : 35, + 'SubgroupsPerWorkgroup' : 36, + 'SubgroupsPerWorkgroupId' : 37, + 'LocalSizeId' : 38, + 'LocalSizeHintId' : 39, + 'PostDepthCoverage' : 4446, + 'StencilRefReplacingEXT' : 5027, + }, + + 'StorageClass' : { + 'UniformConstant' : 0, + 'Input' : 1, + 'Uniform' : 2, + 'Output' : 3, + 'Workgroup' : 4, + 'CrossWorkgroup' : 5, + 'Private' : 6, + 'Function' : 7, + 'Generic' : 8, + 'PushConstant' : 9, + 'AtomicCounter' : 10, + 'Image' : 11, + 'StorageBuffer' : 12, + }, + + 'Dim' : { + 'Dim1D' : 0, + 'Dim2D' : 1, + 'Dim3D' : 2, + 'Cube' : 3, + 'Rect' : 4, + 'Buffer' : 5, + 'SubpassData' : 6, + }, + + 'SamplerAddressingMode' : { + 'None' : 0, + 'ClampToEdge' : 1, + 'Clamp' : 2, + 'Repeat' : 3, + 'RepeatMirrored' : 4, + }, + + 'SamplerFilterMode' : { + 'Nearest' : 0, + 'Linear' : 1, + }, + + 'ImageFormat' : { + 'Unknown' : 0, + 'Rgba32f' : 1, + 'Rgba16f' : 2, + 'R32f' : 3, + 'Rgba8' : 4, + 'Rgba8Snorm' : 5, + 'Rg32f' : 6, + 'Rg16f' : 7, + 'R11fG11fB10f' : 8, + 'R16f' : 9, + 'Rgba16' : 10, + 'Rgb10A2' : 11, + 'Rg16' : 12, + 'Rg8' : 13, + 'R16' : 14, + 'R8' : 15, + 'Rgba16Snorm' : 16, + 'Rg16Snorm' : 17, + 'Rg8Snorm' : 18, + 'R16Snorm' : 19, + 'R8Snorm' : 20, + 'Rgba32i' : 21, + 'Rgba16i' : 22, + 'Rgba8i' : 23, + 'R32i' : 24, + 'Rg32i' : 25, + 'Rg16i' : 26, + 'Rg8i' : 27, + 'R16i' : 28, + 'R8i' : 29, + 'Rgba32ui' : 30, + 'Rgba16ui' : 31, + 'Rgba8ui' : 32, + 'R32ui' : 33, + 'Rgb10a2ui' : 34, + 'Rg32ui' : 35, + 'Rg16ui' : 36, + 'Rg8ui' : 37, + 'R16ui' : 38, + 'R8ui' : 39, + }, + + 'ImageChannelOrder' : { + 'R' : 0, + 'A' : 1, + 'RG' : 2, + 'RA' : 3, + 'RGB' : 4, + 'RGBA' : 5, + 'BGRA' : 6, + 'ARGB' : 7, + 'Intensity' : 8, + 'Luminance' : 9, + 'Rx' : 10, + 'RGx' : 11, + 'RGBx' : 12, + 'Depth' : 13, + 'DepthStencil' : 14, + 'sRGB' : 15, + 'sRGBx' : 16, + 'sRGBA' : 17, + 'sBGRA' : 18, + 'ABGR' : 19, + }, + + 'ImageChannelDataType' : { + 'SnormInt8' : 0, + 'SnormInt16' : 1, + 'UnormInt8' : 2, + 'UnormInt16' : 3, + 'UnormShort565' : 4, + 'UnormShort555' : 5, + 'UnormInt101010' : 6, + 'SignedInt8' : 7, + 'SignedInt16' : 8, + 'SignedInt32' : 9, + 'UnsignedInt8' : 10, + 'UnsignedInt16' : 11, + 'UnsignedInt32' : 12, + 'HalfFloat' : 13, + 'Float' : 14, + 'UnormInt24' : 15, + 'UnormInt101010_2' : 16, + }, + + 'ImageOperandsShift' : { + 'Bias' : 0, + 'Lod' : 1, + 'Grad' : 2, + 'ConstOffset' : 3, + 'Offset' : 4, + 'ConstOffsets' : 5, + 'Sample' : 6, + 'MinLod' : 7, + }, + + 'ImageOperandsMask' : { + 'MaskNone' : 0, + 'Bias' : 0x00000001, + 'Lod' : 0x00000002, + 'Grad' : 0x00000004, + 'ConstOffset' : 0x00000008, + 'Offset' : 0x00000010, + 'ConstOffsets' : 0x00000020, + 'Sample' : 0x00000040, + 'MinLod' : 0x00000080, + }, + + 'FPFastMathModeShift' : { + 'NotNaN' : 0, + 'NotInf' : 1, + 'NSZ' : 2, + 'AllowRecip' : 3, + 'Fast' : 4, + }, + + 'FPFastMathModeMask' : { + 'MaskNone' : 0, + 'NotNaN' : 0x00000001, + 'NotInf' : 0x00000002, + 'NSZ' : 0x00000004, + 'AllowRecip' : 0x00000008, + 'Fast' : 0x00000010, + }, + + 'FPRoundingMode' : { + 'RTE' : 0, + 'RTZ' : 1, + 'RTP' : 2, + 'RTN' : 3, + }, + + 'LinkageType' : { + 'Export' : 0, + 'Import' : 1, + }, + + 'AccessQualifier' : { + 'ReadOnly' : 0, + 'WriteOnly' : 1, + 'ReadWrite' : 2, + }, + + 'FunctionParameterAttribute' : { + 'Zext' : 0, + 'Sext' : 1, + 'ByVal' : 2, + 'Sret' : 3, + 'NoAlias' : 4, + 'NoCapture' : 5, + 'NoWrite' : 6, + 'NoReadWrite' : 7, + }, + + 'Decoration' : { + 'RelaxedPrecision' : 0, + 'SpecId' : 1, + 'Block' : 2, + 'BufferBlock' : 3, + 'RowMajor' : 4, + 'ColMajor' : 5, + 'ArrayStride' : 6, + 'MatrixStride' : 7, + 'GLSLShared' : 8, + 'GLSLPacked' : 9, + 'CPacked' : 10, + 'BuiltIn' : 11, + 'NoPerspective' : 13, + 'Flat' : 14, + 'Patch' : 15, + 'Centroid' : 16, + 'Sample' : 17, + 'Invariant' : 18, + 'Restrict' : 19, + 'Aliased' : 20, + 'Volatile' : 21, + 'Constant' : 22, + 'Coherent' : 23, + 'NonWritable' : 24, + 'NonReadable' : 25, + 'Uniform' : 26, + 'SaturatedConversion' : 28, + 'Stream' : 29, + 'Location' : 30, + 'Component' : 31, + 'Index' : 32, + 'Binding' : 33, + 'DescriptorSet' : 34, + 'Offset' : 35, + 'XfbBuffer' : 36, + 'XfbStride' : 37, + 'FuncParamAttr' : 38, + 'FPRoundingMode' : 39, + 'FPFastMathMode' : 40, + 'LinkageAttributes' : 41, + 'NoContraction' : 42, + 'InputAttachmentIndex' : 43, + 'Alignment' : 44, + 'MaxByteOffset' : 45, + 'AlignmentId' : 46, + 'MaxByteOffsetId' : 47, + 'ExplicitInterpAMD' : 4999, + 'OverrideCoverageNV' : 5248, + 'PassthroughNV' : 5250, + 'ViewportRelativeNV' : 5252, + 'SecondaryViewportRelativeNV' : 5256, + 'HlslCounterBufferGOOGLE' : 5634, + 'HlslSemanticGOOGLE' : 5635, + }, + + 'BuiltIn' : { + 'Position' : 0, + 'PointSize' : 1, + 'ClipDistance' : 3, + 'CullDistance' : 4, + 'VertexId' : 5, + 'InstanceId' : 6, + 'PrimitiveId' : 7, + 'InvocationId' : 8, + 'Layer' : 9, + 'ViewportIndex' : 10, + 'TessLevelOuter' : 11, + 'TessLevelInner' : 12, + 'TessCoord' : 13, + 'PatchVertices' : 14, + 'FragCoord' : 15, + 'PointCoord' : 16, + 'FrontFacing' : 17, + 'SampleId' : 18, + 'SamplePosition' : 19, + 'SampleMask' : 20, + 'FragDepth' : 22, + 'HelperInvocation' : 23, + 'NumWorkgroups' : 24, + 'WorkgroupSize' : 25, + 'WorkgroupId' : 26, + 'LocalInvocationId' : 27, + 'GlobalInvocationId' : 28, + 'LocalInvocationIndex' : 29, + 'WorkDim' : 30, + 'GlobalSize' : 31, + 'EnqueuedWorkgroupSize' : 32, + 'GlobalOffset' : 33, + 'GlobalLinearId' : 34, + 'SubgroupSize' : 36, + 'SubgroupMaxSize' : 37, + 'NumSubgroups' : 38, + 'NumEnqueuedSubgroups' : 39, + 'SubgroupId' : 40, + 'SubgroupLocalInvocationId' : 41, + 'VertexIndex' : 42, + 'InstanceIndex' : 43, + 'SubgroupEqMaskKHR' : 4416, + 'SubgroupGeMaskKHR' : 4417, + 'SubgroupGtMaskKHR' : 4418, + 'SubgroupLeMaskKHR' : 4419, + 'SubgroupLtMaskKHR' : 4420, + 'BaseVertex' : 4424, + 'BaseInstance' : 4425, + 'DrawIndex' : 4426, + 'DeviceIndex' : 4438, + 'ViewIndex' : 4440, + 'BaryCoordNoPerspAMD' : 4992, + 'BaryCoordNoPerspCentroidAMD' : 4993, + 'BaryCoordNoPerspSampleAMD' : 4994, + 'BaryCoordSmoothAMD' : 4995, + 'BaryCoordSmoothCentroidAMD' : 4996, + 'BaryCoordSmoothSampleAMD' : 4997, + 'BaryCoordPullModelAMD' : 4998, + 'FragStencilRefEXT' : 5014, + 'ViewportMaskNV' : 5253, + 'SecondaryPositionNV' : 5257, + 'SecondaryViewportMaskNV' : 5258, + 'PositionPerViewNV' : 5261, + 'ViewportMaskPerViewNV' : 5262, + }, + + 'SelectionControlShift' : { + 'Flatten' : 0, + 'DontFlatten' : 1, + }, + + 'SelectionControlMask' : { + 'MaskNone' : 0, + 'Flatten' : 0x00000001, + 'DontFlatten' : 0x00000002, + }, + + 'LoopControlShift' : { + 'Unroll' : 0, + 'DontUnroll' : 1, + 'DependencyInfinite' : 2, + 'DependencyLength' : 3, + }, + + 'LoopControlMask' : { + 'MaskNone' : 0, + 'Unroll' : 0x00000001, + 'DontUnroll' : 0x00000002, + 'DependencyInfinite' : 0x00000004, + 'DependencyLength' : 0x00000008, + }, + + 'FunctionControlShift' : { + 'Inline' : 0, + 'DontInline' : 1, + 'Pure' : 2, + 'Const' : 3, + }, + + 'FunctionControlMask' : { + 'MaskNone' : 0, + 'Inline' : 0x00000001, + 'DontInline' : 0x00000002, + 'Pure' : 0x00000004, + 'Const' : 0x00000008, + }, + + 'MemorySemanticsShift' : { + 'Acquire' : 1, + 'Release' : 2, + 'AcquireRelease' : 3, + 'SequentiallyConsistent' : 4, + 'UniformMemory' : 6, + 'SubgroupMemory' : 7, + 'WorkgroupMemory' : 8, + 'CrossWorkgroupMemory' : 9, + 'AtomicCounterMemory' : 10, + 'ImageMemory' : 11, + }, + + 'MemorySemanticsMask' : { + 'MaskNone' : 0, + 'Acquire' : 0x00000002, + 'Release' : 0x00000004, + 'AcquireRelease' : 0x00000008, + 'SequentiallyConsistent' : 0x00000010, + 'UniformMemory' : 0x00000040, + 'SubgroupMemory' : 0x00000080, + 'WorkgroupMemory' : 0x00000100, + 'CrossWorkgroupMemory' : 0x00000200, + 'AtomicCounterMemory' : 0x00000400, + 'ImageMemory' : 0x00000800, + }, + + 'MemoryAccessShift' : { + 'Volatile' : 0, + 'Aligned' : 1, + 'Nontemporal' : 2, + }, + + 'MemoryAccessMask' : { + 'MaskNone' : 0, + 'Volatile' : 0x00000001, + 'Aligned' : 0x00000002, + 'Nontemporal' : 0x00000004, + }, + + 'Scope' : { + 'CrossDevice' : 0, + 'Device' : 1, + 'Workgroup' : 2, + 'Subgroup' : 3, + 'Invocation' : 4, + }, + + 'GroupOperation' : { + 'Reduce' : 0, + 'InclusiveScan' : 1, + 'ExclusiveScan' : 2, + }, + + 'KernelEnqueueFlags' : { + 'NoWait' : 0, + 'WaitKernel' : 1, + 'WaitWorkGroup' : 2, + }, + + 'KernelProfilingInfoShift' : { + 'CmdExecTime' : 0, + }, + + 'KernelProfilingInfoMask' : { + 'MaskNone' : 0, + 'CmdExecTime' : 0x00000001, + }, + + 'Capability' : { + 'Matrix' : 0, + 'Shader' : 1, + 'Geometry' : 2, + 'Tessellation' : 3, + 'Addresses' : 4, + 'Linkage' : 5, + 'Kernel' : 6, + 'Vector16' : 7, + 'Float16Buffer' : 8, + 'Float16' : 9, + 'Float64' : 10, + 'Int64' : 11, + 'Int64Atomics' : 12, + 'ImageBasic' : 13, + 'ImageReadWrite' : 14, + 'ImageMipmap' : 15, + 'Pipes' : 17, + 'Groups' : 18, + 'DeviceEnqueue' : 19, + 'LiteralSampler' : 20, + 'AtomicStorage' : 21, + 'Int16' : 22, + 'TessellationPointSize' : 23, + 'GeometryPointSize' : 24, + 'ImageGatherExtended' : 25, + 'StorageImageMultisample' : 27, + 'UniformBufferArrayDynamicIndexing' : 28, + 'SampledImageArrayDynamicIndexing' : 29, + 'StorageBufferArrayDynamicIndexing' : 30, + 'StorageImageArrayDynamicIndexing' : 31, + 'ClipDistance' : 32, + 'CullDistance' : 33, + 'ImageCubeArray' : 34, + 'SampleRateShading' : 35, + 'ImageRect' : 36, + 'SampledRect' : 37, + 'GenericPointer' : 38, + 'Int8' : 39, + 'InputAttachment' : 40, + 'SparseResidency' : 41, + 'MinLod' : 42, + 'Sampled1D' : 43, + 'Image1D' : 44, + 'SampledCubeArray' : 45, + 'SampledBuffer' : 46, + 'ImageBuffer' : 47, + 'ImageMSArray' : 48, + 'StorageImageExtendedFormats' : 49, + 'ImageQuery' : 50, + 'DerivativeControl' : 51, + 'InterpolationFunction' : 52, + 'TransformFeedback' : 53, + 'GeometryStreams' : 54, + 'StorageImageReadWithoutFormat' : 55, + 'StorageImageWriteWithoutFormat' : 56, + 'MultiViewport' : 57, + 'SubgroupDispatch' : 58, + 'NamedBarrier' : 59, + 'PipeStorage' : 60, + 'SubgroupBallotKHR' : 4423, + 'DrawParameters' : 4427, + 'SubgroupVoteKHR' : 4431, + 'StorageBuffer16BitAccess' : 4433, + 'StorageUniformBufferBlock16' : 4433, + 'StorageUniform16' : 4434, + 'UniformAndStorageBuffer16BitAccess' : 4434, + 'StoragePushConstant16' : 4435, + 'StorageInputOutput16' : 4436, + 'DeviceGroup' : 4437, + 'MultiView' : 4439, + 'VariablePointersStorageBuffer' : 4441, + 'VariablePointers' : 4442, + 'AtomicStorageOps' : 4445, + 'SampleMaskPostDepthCoverage' : 4447, + 'ImageGatherBiasLodAMD' : 5009, + 'FragmentMaskAMD' : 5010, + 'StencilExportEXT' : 5013, + 'ImageReadWriteLodAMD' : 5015, + 'SampleMaskOverrideCoverageNV' : 5249, + 'GeometryShaderPassthroughNV' : 5251, + 'ShaderViewportIndexLayerEXT' : 5254, + 'ShaderViewportIndexLayerNV' : 5254, + 'ShaderViewportMaskNV' : 5255, + 'ShaderStereoViewNV' : 5259, + 'PerViewAttributesNV' : 5260, + 'SubgroupShuffleINTEL' : 5568, + 'SubgroupBufferBlockIOINTEL' : 5569, + 'SubgroupImageBlockIOINTEL' : 5570, + }, + + 'Op' : { + 'OpNop' : 0, + 'OpUndef' : 1, + 'OpSourceContinued' : 2, + 'OpSource' : 3, + 'OpSourceExtension' : 4, + 'OpName' : 5, + 'OpMemberName' : 6, + 'OpString' : 7, + 'OpLine' : 8, + 'OpExtension' : 10, + 'OpExtInstImport' : 11, + 'OpExtInst' : 12, + 'OpMemoryModel' : 14, + 'OpEntryPoint' : 15, + 'OpExecutionMode' : 16, + 'OpCapability' : 17, + 'OpTypeVoid' : 19, + 'OpTypeBool' : 20, + 'OpTypeInt' : 21, + 'OpTypeFloat' : 22, + 'OpTypeVector' : 23, + 'OpTypeMatrix' : 24, + 'OpTypeImage' : 25, + 'OpTypeSampler' : 26, + 'OpTypeSampledImage' : 27, + 'OpTypeArray' : 28, + 'OpTypeRuntimeArray' : 29, + 'OpTypeStruct' : 30, + 'OpTypeOpaque' : 31, + 'OpTypePointer' : 32, + 'OpTypeFunction' : 33, + 'OpTypeEvent' : 34, + 'OpTypeDeviceEvent' : 35, + 'OpTypeReserveId' : 36, + 'OpTypeQueue' : 37, + 'OpTypePipe' : 38, + 'OpTypeForwardPointer' : 39, + 'OpConstantTrue' : 41, + 'OpConstantFalse' : 42, + 'OpConstant' : 43, + 'OpConstantComposite' : 44, + 'OpConstantSampler' : 45, + 'OpConstantNull' : 46, + 'OpSpecConstantTrue' : 48, + 'OpSpecConstantFalse' : 49, + 'OpSpecConstant' : 50, + 'OpSpecConstantComposite' : 51, + 'OpSpecConstantOp' : 52, + 'OpFunction' : 54, + 'OpFunctionParameter' : 55, + 'OpFunctionEnd' : 56, + 'OpFunctionCall' : 57, + 'OpVariable' : 59, + 'OpImageTexelPointer' : 60, + 'OpLoad' : 61, + 'OpStore' : 62, + 'OpCopyMemory' : 63, + 'OpCopyMemorySized' : 64, + 'OpAccessChain' : 65, + 'OpInBoundsAccessChain' : 66, + 'OpPtrAccessChain' : 67, + 'OpArrayLength' : 68, + 'OpGenericPtrMemSemantics' : 69, + 'OpInBoundsPtrAccessChain' : 70, + 'OpDecorate' : 71, + 'OpMemberDecorate' : 72, + 'OpDecorationGroup' : 73, + 'OpGroupDecorate' : 74, + 'OpGroupMemberDecorate' : 75, + 'OpVectorExtractDynamic' : 77, + 'OpVectorInsertDynamic' : 78, + 'OpVectorShuffle' : 79, + 'OpCompositeConstruct' : 80, + 'OpCompositeExtract' : 81, + 'OpCompositeInsert' : 82, + 'OpCopyObject' : 83, + 'OpTranspose' : 84, + 'OpSampledImage' : 86, + 'OpImageSampleImplicitLod' : 87, + 'OpImageSampleExplicitLod' : 88, + 'OpImageSampleDrefImplicitLod' : 89, + 'OpImageSampleDrefExplicitLod' : 90, + 'OpImageSampleProjImplicitLod' : 91, + 'OpImageSampleProjExplicitLod' : 92, + 'OpImageSampleProjDrefImplicitLod' : 93, + 'OpImageSampleProjDrefExplicitLod' : 94, + 'OpImageFetch' : 95, + 'OpImageGather' : 96, + 'OpImageDrefGather' : 97, + 'OpImageRead' : 98, + 'OpImageWrite' : 99, + 'OpImage' : 100, + 'OpImageQueryFormat' : 101, + 'OpImageQueryOrder' : 102, + 'OpImageQuerySizeLod' : 103, + 'OpImageQuerySize' : 104, + 'OpImageQueryLod' : 105, + 'OpImageQueryLevels' : 106, + 'OpImageQuerySamples' : 107, + 'OpConvertFToU' : 109, + 'OpConvertFToS' : 110, + 'OpConvertSToF' : 111, + 'OpConvertUToF' : 112, + 'OpUConvert' : 113, + 'OpSConvert' : 114, + 'OpFConvert' : 115, + 'OpQuantizeToF16' : 116, + 'OpConvertPtrToU' : 117, + 'OpSatConvertSToU' : 118, + 'OpSatConvertUToS' : 119, + 'OpConvertUToPtr' : 120, + 'OpPtrCastToGeneric' : 121, + 'OpGenericCastToPtr' : 122, + 'OpGenericCastToPtrExplicit' : 123, + 'OpBitcast' : 124, + 'OpSNegate' : 126, + 'OpFNegate' : 127, + 'OpIAdd' : 128, + 'OpFAdd' : 129, + 'OpISub' : 130, + 'OpFSub' : 131, + 'OpIMul' : 132, + 'OpFMul' : 133, + 'OpUDiv' : 134, + 'OpSDiv' : 135, + 'OpFDiv' : 136, + 'OpUMod' : 137, + 'OpSRem' : 138, + 'OpSMod' : 139, + 'OpFRem' : 140, + 'OpFMod' : 141, + 'OpVectorTimesScalar' : 142, + 'OpMatrixTimesScalar' : 143, + 'OpVectorTimesMatrix' : 144, + 'OpMatrixTimesVector' : 145, + 'OpMatrixTimesMatrix' : 146, + 'OpOuterProduct' : 147, + 'OpDot' : 148, + 'OpIAddCarry' : 149, + 'OpISubBorrow' : 150, + 'OpUMulExtended' : 151, + 'OpSMulExtended' : 152, + 'OpAny' : 154, + 'OpAll' : 155, + 'OpIsNan' : 156, + 'OpIsInf' : 157, + 'OpIsFinite' : 158, + 'OpIsNormal' : 159, + 'OpSignBitSet' : 160, + 'OpLessOrGreater' : 161, + 'OpOrdered' : 162, + 'OpUnordered' : 163, + 'OpLogicalEqual' : 164, + 'OpLogicalNotEqual' : 165, + 'OpLogicalOr' : 166, + 'OpLogicalAnd' : 167, + 'OpLogicalNot' : 168, + 'OpSelect' : 169, + 'OpIEqual' : 170, + 'OpINotEqual' : 171, + 'OpUGreaterThan' : 172, + 'OpSGreaterThan' : 173, + 'OpUGreaterThanEqual' : 174, + 'OpSGreaterThanEqual' : 175, + 'OpULessThan' : 176, + 'OpSLessThan' : 177, + 'OpULessThanEqual' : 178, + 'OpSLessThanEqual' : 179, + 'OpFOrdEqual' : 180, + 'OpFUnordEqual' : 181, + 'OpFOrdNotEqual' : 182, + 'OpFUnordNotEqual' : 183, + 'OpFOrdLessThan' : 184, + 'OpFUnordLessThan' : 185, + 'OpFOrdGreaterThan' : 186, + 'OpFUnordGreaterThan' : 187, + 'OpFOrdLessThanEqual' : 188, + 'OpFUnordLessThanEqual' : 189, + 'OpFOrdGreaterThanEqual' : 190, + 'OpFUnordGreaterThanEqual' : 191, + 'OpShiftRightLogical' : 194, + 'OpShiftRightArithmetic' : 195, + 'OpShiftLeftLogical' : 196, + 'OpBitwiseOr' : 197, + 'OpBitwiseXor' : 198, + 'OpBitwiseAnd' : 199, + 'OpNot' : 200, + 'OpBitFieldInsert' : 201, + 'OpBitFieldSExtract' : 202, + 'OpBitFieldUExtract' : 203, + 'OpBitReverse' : 204, + 'OpBitCount' : 205, + 'OpDPdx' : 207, + 'OpDPdy' : 208, + 'OpFwidth' : 209, + 'OpDPdxFine' : 210, + 'OpDPdyFine' : 211, + 'OpFwidthFine' : 212, + 'OpDPdxCoarse' : 213, + 'OpDPdyCoarse' : 214, + 'OpFwidthCoarse' : 215, + 'OpEmitVertex' : 218, + 'OpEndPrimitive' : 219, + 'OpEmitStreamVertex' : 220, + 'OpEndStreamPrimitive' : 221, + 'OpControlBarrier' : 224, + 'OpMemoryBarrier' : 225, + 'OpAtomicLoad' : 227, + 'OpAtomicStore' : 228, + 'OpAtomicExchange' : 229, + 'OpAtomicCompareExchange' : 230, + 'OpAtomicCompareExchangeWeak' : 231, + 'OpAtomicIIncrement' : 232, + 'OpAtomicIDecrement' : 233, + 'OpAtomicIAdd' : 234, + 'OpAtomicISub' : 235, + 'OpAtomicSMin' : 236, + 'OpAtomicUMin' : 237, + 'OpAtomicSMax' : 238, + 'OpAtomicUMax' : 239, + 'OpAtomicAnd' : 240, + 'OpAtomicOr' : 241, + 'OpAtomicXor' : 242, + 'OpPhi' : 245, + 'OpLoopMerge' : 246, + 'OpSelectionMerge' : 247, + 'OpLabel' : 248, + 'OpBranch' : 249, + 'OpBranchConditional' : 250, + 'OpSwitch' : 251, + 'OpKill' : 252, + 'OpReturn' : 253, + 'OpReturnValue' : 254, + 'OpUnreachable' : 255, + 'OpLifetimeStart' : 256, + 'OpLifetimeStop' : 257, + 'OpGroupAsyncCopy' : 259, + 'OpGroupWaitEvents' : 260, + 'OpGroupAll' : 261, + 'OpGroupAny' : 262, + 'OpGroupBroadcast' : 263, + 'OpGroupIAdd' : 264, + 'OpGroupFAdd' : 265, + 'OpGroupFMin' : 266, + 'OpGroupUMin' : 267, + 'OpGroupSMin' : 268, + 'OpGroupFMax' : 269, + 'OpGroupUMax' : 270, + 'OpGroupSMax' : 271, + 'OpReadPipe' : 274, + 'OpWritePipe' : 275, + 'OpReservedReadPipe' : 276, + 'OpReservedWritePipe' : 277, + 'OpReserveReadPipePackets' : 278, + 'OpReserveWritePipePackets' : 279, + 'OpCommitReadPipe' : 280, + 'OpCommitWritePipe' : 281, + 'OpIsValidReserveId' : 282, + 'OpGetNumPipePackets' : 283, + 'OpGetMaxPipePackets' : 284, + 'OpGroupReserveReadPipePackets' : 285, + 'OpGroupReserveWritePipePackets' : 286, + 'OpGroupCommitReadPipe' : 287, + 'OpGroupCommitWritePipe' : 288, + 'OpEnqueueMarker' : 291, + 'OpEnqueueKernel' : 292, + 'OpGetKernelNDrangeSubGroupCount' : 293, + 'OpGetKernelNDrangeMaxSubGroupSize' : 294, + 'OpGetKernelWorkGroupSize' : 295, + 'OpGetKernelPreferredWorkGroupSizeMultiple' : 296, + 'OpRetainEvent' : 297, + 'OpReleaseEvent' : 298, + 'OpCreateUserEvent' : 299, + 'OpIsValidEvent' : 300, + 'OpSetUserEventStatus' : 301, + 'OpCaptureEventProfilingInfo' : 302, + 'OpGetDefaultQueue' : 303, + 'OpBuildNDRange' : 304, + 'OpImageSparseSampleImplicitLod' : 305, + 'OpImageSparseSampleExplicitLod' : 306, + 'OpImageSparseSampleDrefImplicitLod' : 307, + 'OpImageSparseSampleDrefExplicitLod' : 308, + 'OpImageSparseSampleProjImplicitLod' : 309, + 'OpImageSparseSampleProjExplicitLod' : 310, + 'OpImageSparseSampleProjDrefImplicitLod' : 311, + 'OpImageSparseSampleProjDrefExplicitLod' : 312, + 'OpImageSparseFetch' : 313, + 'OpImageSparseGather' : 314, + 'OpImageSparseDrefGather' : 315, + 'OpImageSparseTexelsResident' : 316, + 'OpNoLine' : 317, + 'OpAtomicFlagTestAndSet' : 318, + 'OpAtomicFlagClear' : 319, + 'OpImageSparseRead' : 320, + 'OpSizeOf' : 321, + 'OpTypePipeStorage' : 322, + 'OpConstantPipeStorage' : 323, + 'OpCreatePipeFromPipeStorage' : 324, + 'OpGetKernelLocalSizeForSubgroupCount' : 325, + 'OpGetKernelMaxNumSubgroups' : 326, + 'OpTypeNamedBarrier' : 327, + 'OpNamedBarrierInitialize' : 328, + 'OpMemoryNamedBarrier' : 329, + 'OpModuleProcessed' : 330, + 'OpExecutionModeId' : 331, + 'OpDecorateId' : 332, + 'OpSubgroupBallotKHR' : 4421, + 'OpSubgroupFirstInvocationKHR' : 4422, + 'OpSubgroupAllKHR' : 4428, + 'OpSubgroupAnyKHR' : 4429, + 'OpSubgroupAllEqualKHR' : 4430, + 'OpSubgroupReadInvocationKHR' : 4432, + 'OpGroupIAddNonUniformAMD' : 5000, + 'OpGroupFAddNonUniformAMD' : 5001, + 'OpGroupFMinNonUniformAMD' : 5002, + 'OpGroupUMinNonUniformAMD' : 5003, + 'OpGroupSMinNonUniformAMD' : 5004, + 'OpGroupFMaxNonUniformAMD' : 5005, + 'OpGroupUMaxNonUniformAMD' : 5006, + 'OpGroupSMaxNonUniformAMD' : 5007, + 'OpFragmentMaskFetchAMD' : 5011, + 'OpFragmentFetchAMD' : 5012, + 'OpSubgroupShuffleINTEL' : 5571, + 'OpSubgroupShuffleDownINTEL' : 5572, + 'OpSubgroupShuffleUpINTEL' : 5573, + 'OpSubgroupShuffleXorINTEL' : 5574, + 'OpSubgroupBlockReadINTEL' : 5575, + 'OpSubgroupBlockWriteINTEL' : 5576, + 'OpSubgroupImageBlockReadINTEL' : 5577, + 'OpSubgroupImageBlockWriteINTEL' : 5578, + 'OpDecorateStringGOOGLE' : 5632, + 'OpMemberDecorateStringGOOGLE' : 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/spir-v.xml b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/spir-v.xml new file mode 100644 index 00000000000..b05bfa7c49b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/spir-v.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/GLSL.std.450.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/GLSL.std.450.h new file mode 100644 index 00000000000..54cc00e9a88 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/GLSL.std.450.h @@ -0,0 +1,131 @@ +/* +** Copyright (c) 2014-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef GLSLstd450_H +#define GLSLstd450_H + +static const int GLSLstd450Version = 100; +static const int GLSLstd450Revision = 3; + +enum GLSLstd450 { + GLSLstd450Bad = 0, // Don't use + + GLSLstd450Round = 1, + GLSLstd450RoundEven = 2, + GLSLstd450Trunc = 3, + GLSLstd450FAbs = 4, + GLSLstd450SAbs = 5, + GLSLstd450FSign = 6, + GLSLstd450SSign = 7, + GLSLstd450Floor = 8, + GLSLstd450Ceil = 9, + GLSLstd450Fract = 10, + + GLSLstd450Radians = 11, + GLSLstd450Degrees = 12, + GLSLstd450Sin = 13, + GLSLstd450Cos = 14, + GLSLstd450Tan = 15, + GLSLstd450Asin = 16, + GLSLstd450Acos = 17, + GLSLstd450Atan = 18, + GLSLstd450Sinh = 19, + GLSLstd450Cosh = 20, + GLSLstd450Tanh = 21, + GLSLstd450Asinh = 22, + GLSLstd450Acosh = 23, + GLSLstd450Atanh = 24, + GLSLstd450Atan2 = 25, + + GLSLstd450Pow = 26, + GLSLstd450Exp = 27, + GLSLstd450Log = 28, + GLSLstd450Exp2 = 29, + GLSLstd450Log2 = 30, + GLSLstd450Sqrt = 31, + GLSLstd450InverseSqrt = 32, + + GLSLstd450Determinant = 33, + GLSLstd450MatrixInverse = 34, + + GLSLstd450Modf = 35, // second operand needs an OpVariable to write to + GLSLstd450ModfStruct = 36, // no OpVariable operand + GLSLstd450FMin = 37, + GLSLstd450UMin = 38, + GLSLstd450SMin = 39, + GLSLstd450FMax = 40, + GLSLstd450UMax = 41, + GLSLstd450SMax = 42, + GLSLstd450FClamp = 43, + GLSLstd450UClamp = 44, + GLSLstd450SClamp = 45, + GLSLstd450FMix = 46, + GLSLstd450IMix = 47, // Reserved + GLSLstd450Step = 48, + GLSLstd450SmoothStep = 49, + + GLSLstd450Fma = 50, + GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to + GLSLstd450FrexpStruct = 52, // no OpVariable operand + GLSLstd450Ldexp = 53, + + GLSLstd450PackSnorm4x8 = 54, + GLSLstd450PackUnorm4x8 = 55, + GLSLstd450PackSnorm2x16 = 56, + GLSLstd450PackUnorm2x16 = 57, + GLSLstd450PackHalf2x16 = 58, + GLSLstd450PackDouble2x32 = 59, + GLSLstd450UnpackSnorm2x16 = 60, + GLSLstd450UnpackUnorm2x16 = 61, + GLSLstd450UnpackHalf2x16 = 62, + GLSLstd450UnpackSnorm4x8 = 63, + GLSLstd450UnpackUnorm4x8 = 64, + GLSLstd450UnpackDouble2x32 = 65, + + GLSLstd450Length = 66, + GLSLstd450Distance = 67, + GLSLstd450Cross = 68, + GLSLstd450Normalize = 69, + GLSLstd450FaceForward = 70, + GLSLstd450Reflect = 71, + GLSLstd450Refract = 72, + + GLSLstd450FindILsb = 73, + GLSLstd450FindSMsb = 74, + GLSLstd450FindUMsb = 75, + + GLSLstd450InterpolateAtCentroid = 76, + GLSLstd450InterpolateAtSample = 77, + GLSLstd450InterpolateAtOffset = 78, + + GLSLstd450NMin = 79, + GLSLstd450NMax = 80, + GLSLstd450NClamp = 81, + + GLSLstd450Count +}; + +#endif // #ifndef GLSLstd450_H diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/OpenCL.std.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/OpenCL.std.h new file mode 100644 index 00000000000..fe759e1bcbc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/OpenCL.std.h @@ -0,0 +1,215 @@ +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef OPENCLstd_H +#define OPENCLstd_H + +namespace OpenCLLIB { + +enum Entrypoints { + + // Section 2.1: Math extended instructions + Acos = 0, + Acosh = 1, + Acospi = 2, + Asin = 3, + Asinh = 4, + Asinpi = 5, + Atan = 6, + Atan2 = 7, + Atanh = 8, + Atanpi = 9, + Atan2pi = 10, + Cbrt = 11, + Ceil = 12, + Copysign = 13, + Cos = 14, + Cosh = 15, + Cospi = 16, + Erfc = 17, + Erf = 18, + Exp = 19, + Exp2 = 20, + Exp10 = 21, + Expm1 = 22, + Fabs = 23, + Fdim = 24, + Floor = 25, + Fma = 26, + Fmax = 27, + Fmin = 28, + Fmod = 29, + Fract = 30, + Frexp = 31, + Hypot = 32, + Ilogb = 33, + Ldexp = 34, + Lgamma = 35, + Lgamma_r = 36, + Log = 37, + Log2 = 38, + Log10 = 39, + Log1p = 40, + Logb = 41, + Mad = 42, + Maxmag = 43, + Minmag = 44, + Modf = 45, + Nan = 46, + Nextafter = 47, + Pow = 48, + Pown = 49, + Powr = 50, + Remainder = 51, + Remquo = 52, + Rint = 53, + Rootn = 54, + Round = 55, + Rsqrt = 56, + Sin = 57, + Sincos = 58, + Sinh = 59, + Sinpi = 60, + Sqrt = 61, + Tan = 62, + Tanh = 63, + Tanpi = 64, + Tgamma = 65, + Trunc = 66, + Half_cos = 67, + Half_divide = 68, + Half_exp = 69, + Half_exp2 = 70, + Half_exp10 = 71, + Half_log = 72, + Half_log2 = 73, + Half_log10 = 74, + Half_powr = 75, + Half_recip = 76, + Half_rsqrt = 77, + Half_sin = 78, + Half_sqrt = 79, + Half_tan = 80, + Native_cos = 81, + Native_divide = 82, + Native_exp = 83, + Native_exp2 = 84, + Native_exp10 = 85, + Native_log = 86, + Native_log2 = 87, + Native_log10 = 88, + Native_powr = 89, + Native_recip = 90, + Native_rsqrt = 91, + Native_sin = 92, + Native_sqrt = 93, + Native_tan = 94, + + // Section 2.2: Integer instructions + SAbs = 141, + SAbs_diff = 142, + SAdd_sat = 143, + UAdd_sat = 144, + SHadd = 145, + UHadd = 146, + SRhadd = 147, + URhadd = 148, + SClamp = 149, + UClamp = 150, + Clz = 151, + Ctz = 152, + SMad_hi = 153, + UMad_sat = 154, + SMad_sat = 155, + SMax = 156, + UMax = 157, + SMin = 158, + UMin = 159, + SMul_hi = 160, + Rotate = 161, + SSub_sat = 162, + USub_sat = 163, + U_Upsample = 164, + S_Upsample = 165, + Popcount = 166, + SMad24 = 167, + UMad24 = 168, + SMul24 = 169, + UMul24 = 170, + UAbs = 201, + UAbs_diff = 202, + UMul_hi = 203, + UMad_hi = 204, + + // Section 2.3: Common instructions + FClamp = 95, + Degrees = 96, + FMax_common = 97, + FMin_common = 98, + Mix = 99, + Radians = 100, + Step = 101, + Smoothstep = 102, + Sign = 103, + + // Section 2.4: Geometric instructions + Cross = 104, + Distance = 105, + Length = 106, + Normalize = 107, + Fast_distance = 108, + Fast_length = 109, + Fast_normalize = 110, + + // Section 2.5: Relational instructions + Bitselect = 186, + Select = 187, + + // Section 2.6: Vector Data Load and Store instructions + Vloadn = 171, + Vstoren = 172, + Vload_half = 173, + Vload_halfn = 174, + Vstore_half = 175, + Vstore_half_r = 176, + Vstore_halfn = 177, + Vstore_halfn_r = 178, + Vloada_halfn = 179, + Vstorea_halfn = 180, + Vstorea_halfn_r = 181, + + // Section 2.7: Miscellaneous Vector instructions + Shuffle = 182, + Shuffle2 = 183, + + // Section 2.8: Misc instructions + Printf = 184, + Prefetch = 185, +}; + +} // end namespace OpenCLLIB + +#endif // #ifndef OPENCLstd_H diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/extinst.glsl.std.450.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/extinst.glsl.std.450.grammar.json new file mode 100644 index 00000000000..3d9f39e76c9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/extinst.glsl.std.450.grammar.json @@ -0,0 +1,642 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "Round", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "RoundEven", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Trunc", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FAbs", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SAbs", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FSign", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SSign", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Floor", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ceil", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fract", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Radians", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "Degrees", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "Sin", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tan", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asin", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acos", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'y_over_x'" } + ] + }, + { + "opname" : "Sinh", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Cosh", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Tanh", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Asinh", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Acosh", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atanh", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Atan2", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Pow", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Exp", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Exp2", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Log2", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Sqrt", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "InverseSqrt", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Determinant", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "MatrixInverse", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Modf", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "ModfStruct", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FMin", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMin", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMin", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FMax", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "UMax", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "SMax", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "FClamp", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "UClamp", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "SClamp", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + }, + { + "opname" : "FMix", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "IMix", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "Step", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "SmoothStep", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Fma", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "Frexp", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "FrexpStruct", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Ldexp", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "PackSnorm4x8", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm4x8", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackSnorm2x16", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackUnorm2x16", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackHalf2x16", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "PackDouble2x32", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "UnpackSnorm2x16", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm2x16", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackHalf2x16", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ] + }, + { + "opname" : "UnpackSnorm4x8", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackUnorm4x8", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "UnpackDouble2x32", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" } + ], + "capabilities" : [ "Float64" ] + }, + { + "opname" : "Length", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "Distance", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "Cross", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "Normalize", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "FaceForward", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'Nref'" } + ] + }, + { + "opname" : "Reflect", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" } + ] + }, + { + "opname" : "Refract", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'I'" }, + { "kind" : "IdRef", "name" : "'N'" }, + { "kind" : "IdRef", "name" : "'eta'" } + ] + }, + { + "opname" : "FindILsb", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindSMsb", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "FindUMsb", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "InterpolateAtCentroid", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtSample", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'sample'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "InterpolateAtOffset", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'offset'" } + ], + "capabilities" : [ "InterpolationFunction" ] + }, + { + "opname" : "NMin", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NMax", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "NClamp", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minVal'" }, + { "kind" : "IdRef", "name" : "'maxVal'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json new file mode 100644 index 00000000000..4fe45060bb9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json @@ -0,0 +1,1279 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 2, + "instructions" : [ + { + "opname" : "acos", + "opcode" : 0, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acosh", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "acospi", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asin", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinh", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "asinpi", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanh", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atanpi", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "atan2pi", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cbrt", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ceil", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "copysign", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "cos", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cosh", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cospi", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erfc", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "erf", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp2", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "exp10", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "expm1", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fabs", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fdim", + "opcode" : 24, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "floor", + "opcode" : 25, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "fma", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fmax", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmod", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fract", + "opcode" : 30, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'ptr'" } + ] + }, + { + "opname" : "frexp", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'exp'" } + ] + }, + { + "opname" : "hypot", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "ilogb", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ldexp", + "opcode" : 34, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'k'" } + ] + }, + { + "opname" : "lgamma", + "opcode" : 35, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "lgamma_r", + "opcode" : 36, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'signp'" } + ] + }, + { + "opname" : "log", + "opcode" : 37, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log2", + "opcode" : 38, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log10", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "log1p", + "opcode" : 40, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "logb", + "opcode" : 41, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "mad", + "opcode" : 42, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "maxmag", + "opcode" : 43, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "minmag", + "opcode" : 44, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "modf", + "opcode" : 45, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'iptr'" } + ] + }, + { + "opname" : "nan", + "opcode" : 46, + "operands" : [ + { "kind" : "IdRef", "name" : "'nancode'" } + ] + }, + { + "opname" : "nextafter", + "opcode" : 47, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "pow", + "opcode" : 48, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y" } + ] + }, + { + "opname" : "pown", + "opcode" : 49, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "powr", + "opcode" : 50, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remainder", + "opcode" : 51, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "remquo", + "opcode" : 52, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'quo'" } + ] + }, + { + "opname" : "rint", + "opcode" : 53, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rootn", + "opcode" : 54, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "round", + "opcode" : 55, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "rsqrt", + "opcode" : 56, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sin", + "opcode" : 57, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sincos", + "opcode" : 58, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'cosval'" } + ] + }, + { + "opname" : "sinh", + "opcode" : 59, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sinpi", + "opcode" : 60, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sqrt", + "opcode" : 61, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tan", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanh", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tanpi", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "tgamma", + "opcode" : 65, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "trunc", + "opcode" : 66, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_cos", + "opcode" : 67, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_divide", + "opcode" : 68, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_exp", + "opcode" : 69, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp2", + "opcode" : 70, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_exp10", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log2", + "opcode" : 73, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_log10", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_powr", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "half_recip", + "opcode" : 76, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_rsqrt", + "opcode" : 77, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sin", + "opcode" : 78, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_sqrt", + "opcode" : 79, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "half_tan", + "opcode" : 80, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_cos", + "opcode" : 81, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_divide", + "opcode" : 82, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_exp", + "opcode" : 83, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp2", + "opcode" : 84, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_exp10", + "opcode" : 85, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log", + "opcode" : 86, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log2", + "opcode" : 87, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_log10", + "opcode" : 88, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_powr", + "opcode" : 89, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "native_recip", + "opcode" : 90, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_rsqrt", + "opcode" : 91, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sin", + "opcode" : 92, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_sqrt", + "opcode" : 93, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "native_tan", + "opcode" : 94, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs", + "opcode" : 141, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_abs_diff", + "opcode" : 142, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_add_sat", + "opcode" : 143, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_add_sat", + "opcode" : 144, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_hadd", + "opcode" : 145, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_hadd", + "opcode" : 146, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_rhadd", + "opcode" : 147, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_rhadd", + "opcode" : 148, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_clamp", + "opcode" : 149, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "u_clamp", + "opcode" : 150, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "clz", + "opcode" : 151, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "ctz", + "opcode" : 152, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad_hi", + "opcode" : 153, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "u_mad_sat", + "opcode" : 154, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mad_sat", + "opcode" : 155, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_max", + "opcode" : 156, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_max", + "opcode" : 157, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_min", + "opcode" : 158, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_min", + "opcode" : 159, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "s_mul_hi", + "opcode" : 160, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "rotate", + "opcode" : 161, + "operands" : [ + { "kind" : "IdRef", "name" : "'v'" }, + { "kind" : "IdRef", "name" : "'i'" } + ] + }, + { + "opname" : "s_sub_sat", + "opcode" : 162, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_sub_sat", + "opcode" : 163, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_upsample", + "opcode" : 164, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "s_upsample", + "opcode" : 165, + "operands" : [ + { "kind" : "IdRef", "name" : "'hi'" }, + { "kind" : "IdRef", "name" : "'lo'" } + ] + }, + { + "opname" : "popcount", + "opcode" : 166, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "s_mad24", + "opcode" : 167, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "u_mad24", + "opcode" : 168, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ] + }, + { + "opname" : "s_mul24", + "opcode" : 169, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul24", + "opcode" : 170, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_abs", + "opcode" : 201, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "u_abs_diff", + "opcode" : 202, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mul_hi", + "opcode" : 203, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "u_mad_hi", + "opcode" : 204, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "fclamp", + "opcode" : 95, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'minval'" }, + { "kind" : "IdRef", "name" : "'maxval'" } + ] + }, + { + "opname" : "degrees", + "opcode" :96, + "operands" : [ + { "kind" : "IdRef", "name" : "'radians'" } + ] + }, + { + "opname" : "fmax_common", + "opcode" : 97, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "fmin_common", + "opcode" : 98, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ] + }, + { + "opname" : "mix", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'a'" } + ] + }, + { + "opname" : "radians", + "opcode" : 100, + "operands" : [ + { "kind" : "IdRef", "name" : "'degrees'" } + ] + }, + { + "opname" : "step", + "opcode" : 101, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "smoothstep", + "opcode" : 102, + "operands" : [ + { "kind" : "IdRef", "name" : "'edge0'" }, + { "kind" : "IdRef", "name" : "'edge1'" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "sign", + "opcode" : 103, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "cross", + "opcode" : 104, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "distance", + "opcode" : 105, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "length", + "opcode" : 106, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "normalize", + "opcode" : 107, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_distance", + "opcode" : 108, + "operands" : [ + { "kind" : "IdRef", "name" : "'p0'" }, + { "kind" : "IdRef", "name" : "'p1'" } + ] + }, + { + "opname" : "fast_length", + "opcode" : 109, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "fast_normalize", + "opcode" : 110, + "operands" : [ + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "bitselect", + "opcode" : 186, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "select", + "opcode" : 187, + "operands" : [ + { "kind" : "IdRef", "name" : "'a'" }, + { "kind" : "IdRef", "name" : "'b'" }, + { "kind" : "IdRef", "name" : "'c'" } + ] + }, + { + "opname" : "vloadn", + "opcode" : 171, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstoren", + "opcode" : 172, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_half", + "opcode" : 173, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vload_halfn", + "opcode" : 174, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstore_half", + "opcode" : 175, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_half_r", + "opcode" : 176, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vstore_halfn", + "opcode" : 177, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstore_halfn_r", + "opcode" : 178, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "vloada_halfn", + "opcode" : 179, + "operands" : [ + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "LiteralInteger", "name" : "'n'" } + ] + }, + { + "opname" : "vstorea_halfn", + "opcode" : 180, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" } + ] + }, + { + "opname" : "vstorea_halfn_r", + "opcode" : 181, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" }, + { "kind" : "IdRef", "name" : "'p'" }, + { "kind" : "FPRoundingMode", "name" : "'mode'" } + ] + }, + { + "opname" : "shuffle", + "opcode" : 182, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "shuffle2", + "opcode" : 183, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'shuffle mask'" } + ] + }, + { + "opname" : "printf", + "opcode" : 184, + "operands" : [ + { "kind" : "IdRef", "name" : "'format'" }, + { "kind" : "IdRef", "name" : "'additional arguments'", "quantifier" : "*" } + ] + }, + { + "opname" : "prefetch", + "opcode" : 185, + "operands" : [ + { "kind" : "IdRef", "name" : "'ptr'" }, + { "kind" : "IdRef", "name" : "'num elements'" } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.core.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.core.grammar.json new file mode 100644 index 00000000000..cb641420d07 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.core.grammar.json @@ -0,0 +1,6818 @@ +{ + "copyright" : [ + "Copyright (c) 2014-2016 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "magic_number" : "0x07230203", + "major_version" : 1, + "minor_version" : 3, + "revision" : 1, + "instructions" : [ + { + "opname" : "OpNop", + "opcode" : 0 + }, + { + "opname" : "OpUndef", + "opcode" : 1, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSourceContinued", + "opcode" : 2, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Continued Source'" } + ] + }, + { + "opname" : "OpSource", + "opcode" : 3, + "operands" : [ + { "kind" : "SourceLanguage" }, + { "kind" : "LiteralInteger", "name" : "'Version'" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'File'" }, + { "kind" : "LiteralString", "quantifier" : "?", "name" : "'Source'" } + ] + }, + { + "opname" : "OpSourceExtension", + "opcode" : 4, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Extension'" } + ] + }, + { + "opname" : "OpName", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpMemberName", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpString", + "opcode" : 7, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'String'" } + ] + }, + { + "opname" : "OpLine", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'File'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" } + ] + }, + { + "opname" : "OpExtension", + "opcode" : 10, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInstImport", + "opcode" : 11, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "'Name'" } + ] + }, + { + "opname" : "OpExtInst", + "opcode" : 12, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Set'" }, + { "kind" : "LiteralExtInstInteger", "name" : "'Instruction'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Operand 1', +\n'Operand 2', +\n..." } + ] + }, + { + "opname" : "OpMemoryModel", + "opcode" : 14, + "operands" : [ + { "kind" : "AddressingModel" }, + { "kind" : "MemoryModel" } + ] + }, + { + "opname" : "OpEntryPoint", + "opcode" : 15, + "operands" : [ + { "kind" : "ExecutionModel" }, + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Interface'" } + ] + }, + { + "opname" : "OpExecutionMode", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "ExecutionMode", "name" : "'Mode'" } + ] + }, + { + "opname" : "OpCapability", + "opcode" : 17, + "operands" : [ + { "kind" : "Capability", "name" : "'Capability'" } + ] + }, + { + "opname" : "OpTypeVoid", + "opcode" : 19, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeBool", + "opcode" : 20, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeInt", + "opcode" : 21, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" }, + { "kind" : "LiteralInteger", "name" : "'Signedness'" } + ] + }, + { + "opname" : "OpTypeFloat", + "opcode" : 22, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Width'" } + ] + }, + { + "opname" : "OpTypeVector", + "opcode" : 23, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Component Type'" }, + { "kind" : "LiteralInteger", "name" : "'Component Count'" } + ] + }, + { + "opname" : "OpTypeMatrix", + "opcode" : 24, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Column Type'" }, + { "kind" : "LiteralInteger", "name" : "'Column Count'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpTypeImage", + "opcode" : 25, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Type'" }, + { "kind" : "Dim" }, + { "kind" : "LiteralInteger", "name" : "'Depth'" }, + { "kind" : "LiteralInteger", "name" : "'Arrayed'" }, + { "kind" : "LiteralInteger", "name" : "'MS'" }, + { "kind" : "LiteralInteger", "name" : "'Sampled'" }, + { "kind" : "ImageFormat" }, + { "kind" : "AccessQualifier", "quantifier" : "?" } + ] + }, + { + "opname" : "OpTypeSampler", + "opcode" : 26, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpTypeSampledImage", + "opcode" : 27, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image Type'" } + ] + }, + { + "opname" : "OpTypeArray", + "opcode" : 28, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" }, + { "kind" : "IdRef", "name" : "'Length'" } + ] + }, + { + "opname" : "OpTypeRuntimeArray", + "opcode" : 29, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Element Type'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpTypeStruct", + "opcode" : 30, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Member 0 type', +\n'member 1 type', +\n..." } + ] + }, + { + "opname" : "OpTypeOpaque", + "opcode" : 31, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "LiteralString", "name" : "The name of the opaque type." } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypePointer", + "opcode" : 32, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "name" : "'Type'" } + ] + }, + { + "opname" : "OpTypeFunction", + "opcode" : 33, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Return Type'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..." } + ] + }, + { + "opname" : "OpTypeEvent", + "opcode" : 34, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpTypeDeviceEvent", + "opcode" : 35, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypeReserveId", + "opcode" : 36, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeQueue", + "opcode" : 37, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpTypePipe", + "opcode" : 38, + "operands" : [ + { "kind" : "IdResult" }, + { "kind" : "AccessQualifier", "name" : "'Qualifier'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpTypeForwardPointer", + "opcode" : 39, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer Type'" }, + { "kind" : "StorageClass" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpConstantTrue", + "opcode" : 41, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstantFalse", + "opcode" : 42, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpConstant", + "opcode" : 43, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConstantComposite", + "opcode" : 44, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpConstantSampler", + "opcode" : 45, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "SamplerAddressingMode" }, + { "kind" : "LiteralInteger", "name" : "'Param'" }, + { "kind" : "SamplerFilterMode" } + ], + "capabilities" : [ "LiteralSampler" ] + }, + { + "opname" : "OpConstantNull", + "opcode" : 46, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantTrue", + "opcode" : 48, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstantFalse", + "opcode" : 49, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpSpecConstant", + "opcode" : 50, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralContextDependentNumber", "name" : "'Value'" } + ] + }, + { + "opname" : "OpSpecConstantComposite", + "opcode" : 51, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpSpecConstantOp", + "opcode" : 52, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralSpecConstantOpInteger", "name" : "'Opcode'" } + ] + }, + { + "opname" : "OpFunction", + "opcode" : 54, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "FunctionControl" }, + { "kind" : "IdRef", "name" : "'Function Type'" } + ] + }, + { + "opname" : "OpFunctionParameter", + "opcode" : 55, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpFunctionEnd", + "opcode" : 56 + }, + { + "opname" : "OpFunctionCall", + "opcode" : 57, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Function'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Argument 0', +\n'Argument 1', +\n..." } + ] + }, + { + "opname" : "OpVariable", + "opcode" : 59, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "StorageClass" }, + { "kind" : "IdRef", "quantifier" : "?", "name" : "'Initializer'" } + ] + }, + { + "opname" : "OpImageTexelPointer", + "opcode" : 60, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Sample'" } + ] + }, + { + "opname" : "OpLoad", + "opcode" : 61, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpStore", + "opcode" : 62, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemory", + "opcode" : 63, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ] + }, + { + "opname" : "OpCopyMemorySized", + "opcode" : 64, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "MemoryAccess", "quantifier" : "?" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpAccessChain", + "opcode" : 65, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpInBoundsAccessChain", + "opcode" : 66, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpPtrAccessChain", + "opcode" : 67, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ + "Addresses", + "VariablePointers", + "VariablePointersStorageBuffer" + ] + }, + { + "opname" : "OpArrayLength", + "opcode" : 68, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Structure'" }, + { "kind" : "LiteralInteger", "name" : "'Array member'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpGenericPtrMemSemantics", + "opcode" : 69, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpInBoundsPtrAccessChain", + "opcode" : 70, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Element'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Indexes'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpDecorate", + "opcode" : 71, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpMemberDecorate", + "opcode" : 72, + "operands" : [ + { "kind" : "IdRef", "name" : "'Structure Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ] + }, + { + "opname" : "OpDecorationGroup", + "opcode" : 73, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpGroupDecorate", + "opcode" : 74, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpGroupMemberDecorate", + "opcode" : 75, + "operands" : [ + { "kind" : "IdRef", "name" : "'Decoration Group'" }, + { "kind" : "PairIdRefLiteralInteger", "quantifier" : "*", "name" : "'Targets'" } + ] + }, + { + "opname" : "OpVectorExtractDynamic", + "opcode" : 77, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorInsertDynamic", + "opcode" : 78, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ] + }, + { + "opname" : "OpVectorShuffle", + "opcode" : 79, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Components'" } + ] + }, + { + "opname" : "OpCompositeConstruct", + "opcode" : 80, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Constituents'" } + ] + }, + { + "opname" : "OpCompositeExtract", + "opcode" : 81, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCompositeInsert", + "opcode" : 82, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Object'" }, + { "kind" : "IdRef", "name" : "'Composite'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Indexes'" } + ] + }, + { + "opname" : "OpCopyObject", + "opcode" : 83, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpTranspose", + "opcode" : 84, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpSampledImage", + "opcode" : 86, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Sampler'" } + ] + }, + { + "opname" : "OpImageSampleImplicitLod", + "opcode" : 87, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleExplicitLod", + "opcode" : 88, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ] + }, + { + "opname" : "OpImageSampleDrefImplicitLod", + "opcode" : 89, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleDrefExplicitLod", + "opcode" : 90, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjImplicitLod", + "opcode" : 91, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjExplicitLod", + "opcode" : 92, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefImplicitLod", + "opcode" : 93, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageSampleProjDrefExplicitLod", + "opcode" : 94, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageFetch", + "opcode" : 95, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageGather", + "opcode" : 96, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageDrefGather", + "opcode" : 97, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpImageRead", + "opcode" : 98, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImageWrite", + "opcode" : 99, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Texel'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ] + }, + { + "opname" : "OpImage", + "opcode" : 100, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" } + ] + }, + { + "opname" : "OpImageQueryFormat", + "opcode" : 101, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQueryOrder", + "opcode" : 102, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageQuerySizeLod", + "opcode" : 103, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Level of Detail'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySize", + "opcode" : 104, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLod", + "opcode" : 105, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "ImageQuery" ] + }, + { + "opname" : "OpImageQueryLevels", + "opcode" : 106, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpImageQuerySamples", + "opcode" : 107, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" } + ], + "capabilities" : [ "Kernel", "ImageQuery" ] + }, + { + "opname" : "OpConvertFToU", + "opcode" : 109, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertFToS", + "opcode" : 110, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpConvertSToF", + "opcode" : 111, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpConvertUToF", + "opcode" : 112, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpUConvert", + "opcode" : 113, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ] + }, + { + "opname" : "OpSConvert", + "opcode" : 114, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ] + }, + { + "opname" : "OpFConvert", + "opcode" : 115, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Float Value'" } + ] + }, + { + "opname" : "OpQuantizeToF16", + "opcode" : 116, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpConvertPtrToU", + "opcode" : 117, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpSatConvertSToU", + "opcode" : 118, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Signed Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSatConvertUToS", + "opcode" : 119, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Unsigned Value'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpConvertUToPtr", + "opcode" : 120, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Integer Value'" } + ], + "capabilities" : [ "Addresses" ] + }, + { + "opname" : "OpPtrCastToGeneric", + "opcode" : 121, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtr", + "opcode" : 122, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGenericCastToPtrExplicit", + "opcode" : 123, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "StorageClass", "name" : "'Storage'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpBitcast", + "opcode" : 124, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSNegate", + "opcode" : 126, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpFNegate", + "opcode" : 127, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpIAdd", + "opcode" : 128, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFAdd", + "opcode" : 129, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISub", + "opcode" : 130, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFSub", + "opcode" : 131, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpIMul", + "opcode" : 132, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMul", + "opcode" : 133, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUDiv", + "opcode" : 134, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSDiv", + "opcode" : 135, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFDiv", + "opcode" : 136, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMod", + "opcode" : 137, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSRem", + "opcode" : 138, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMod", + "opcode" : 139, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFRem", + "opcode" : 140, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFMod", + "opcode" : 141, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpVectorTimesScalar", + "opcode" : 142, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ] + }, + { + "opname" : "OpMatrixTimesScalar", + "opcode" : 143, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Scalar'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpVectorTimesMatrix", + "opcode" : 144, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" }, + { "kind" : "IdRef", "name" : "'Matrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesVector", + "opcode" : 145, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Matrix'" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpMatrixTimesMatrix", + "opcode" : 146, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'LeftMatrix'" }, + { "kind" : "IdRef", "name" : "'RightMatrix'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpOuterProduct", + "opcode" : 147, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ], + "capabilities" : [ "Matrix" ] + }, + { + "opname" : "OpDot", + "opcode" : 148, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector 1'" }, + { "kind" : "IdRef", "name" : "'Vector 2'" } + ] + }, + { + "opname" : "OpIAddCarry", + "opcode" : 149, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpISubBorrow", + "opcode" : 150, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUMulExtended", + "opcode" : 151, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSMulExtended", + "opcode" : 152, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpAny", + "opcode" : 154, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpAll", + "opcode" : 155, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Vector'" } + ] + }, + { + "opname" : "OpIsNan", + "opcode" : 156, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsInf", + "opcode" : 157, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ] + }, + { + "opname" : "OpIsFinite", + "opcode" : 158, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpIsNormal", + "opcode" : 159, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpSignBitSet", + "opcode" : 160, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLessOrGreater", + "opcode" : 161, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpOrdered", + "opcode" : 162, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpUnordered", + "opcode" : 163, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLogicalEqual", + "opcode" : 164, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNotEqual", + "opcode" : 165, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalOr", + "opcode" : 166, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalAnd", + "opcode" : 167, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpLogicalNot", + "opcode" : 168, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpSelect", + "opcode" : 169, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'Object 1'" }, + { "kind" : "IdRef", "name" : "'Object 2'" } + ] + }, + { + "opname" : "OpIEqual", + "opcode" : 170, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpINotEqual", + "opcode" : 171, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThan", + "opcode" : 172, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThan", + "opcode" : 173, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpUGreaterThanEqual", + "opcode" : 174, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSGreaterThanEqual", + "opcode" : 175, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThan", + "opcode" : 176, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThan", + "opcode" : 177, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpULessThanEqual", + "opcode" : 178, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpSLessThanEqual", + "opcode" : 179, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdEqual", + "opcode" : 180, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordEqual", + "opcode" : 181, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdNotEqual", + "opcode" : 182, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordNotEqual", + "opcode" : 183, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThan", + "opcode" : 184, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThan", + "opcode" : 185, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThan", + "opcode" : 186, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThan", + "opcode" : 187, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdLessThanEqual", + "opcode" : 188, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordLessThanEqual", + "opcode" : 189, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFOrdGreaterThanEqual", + "opcode" : 190, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpFUnordGreaterThanEqual", + "opcode" : 191, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpShiftRightLogical", + "opcode" : 194, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftRightArithmetic", + "opcode" : 195, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpShiftLeftLogical", + "opcode" : 196, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Shift'" } + ] + }, + { + "opname" : "OpBitwiseOr", + "opcode" : 197, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseXor", + "opcode" : 198, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpBitwiseAnd", + "opcode" : 199, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand 1'" }, + { "kind" : "IdRef", "name" : "'Operand 2'" } + ] + }, + { + "opname" : "OpNot", + "opcode" : 200, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Operand'" } + ] + }, + { + "opname" : "OpBitFieldInsert", + "opcode" : 201, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Insert'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldSExtract", + "opcode" : 202, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitFieldUExtract", + "opcode" : 203, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Count'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitReverse", + "opcode" : 204, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpBitCount", + "opcode" : 205, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Base'" } + ] + }, + { + "opname" : "OpDPdx", + "opcode" : 207, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdy", + "opcode" : 208, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpFwidth", + "opcode" : 209, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpDPdxFine", + "opcode" : 210, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyFine", + "opcode" : 211, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthFine", + "opcode" : 212, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdxCoarse", + "opcode" : 213, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpDPdyCoarse", + "opcode" : 214, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpFwidthCoarse", + "opcode" : 215, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'P'" } + ], + "capabilities" : [ "DerivativeControl" ] + }, + { + "opname" : "OpEmitVertex", + "opcode" : 218, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEndPrimitive", + "opcode" : 219, + "capabilities" : [ "Geometry" ] + }, + { + "opname" : "OpEmitStreamVertex", + "opcode" : 220, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpEndStreamPrimitive", + "opcode" : 221, + "operands" : [ + { "kind" : "IdRef", "name" : "'Stream'" } + ], + "capabilities" : [ "GeometryStreams" ] + }, + { + "opname" : "OpControlBarrier", + "opcode" : 224, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpMemoryBarrier", + "opcode" : 225, + "operands" : [ + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicLoad", + "opcode" : 227, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicStore", + "opcode" : 228, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicExchange", + "opcode" : 229, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicCompareExchange", + "opcode" : 230, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ] + }, + { + "opname" : "OpAtomicCompareExchangeWeak", + "opcode" : 231, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Equal'" }, + { "kind" : "IdMemorySemantics", "name" : "'Unequal'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Comparator'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicIIncrement", + "opcode" : 232, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIDecrement", + "opcode" : 233, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ] + }, + { + "opname" : "OpAtomicIAdd", + "opcode" : 234, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicISub", + "opcode" : 235, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMin", + "opcode" : 236, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMin", + "opcode" : 237, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicSMax", + "opcode" : 238, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicUMax", + "opcode" : 239, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicAnd", + "opcode" : 240, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicOr", + "opcode" : 241, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpAtomicXor", + "opcode" : 242, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpPhi", + "opcode" : 245, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "PairIdRefIdRef", "quantifier" : "*", "name" : "'Variable, Parent, ...'" } + ] + }, + { + "opname" : "OpLoopMerge", + "opcode" : 246, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "IdRef", "name" : "'Continue Target'" }, + { "kind" : "LoopControl" } + ] + }, + { + "opname" : "OpSelectionMerge", + "opcode" : 247, + "operands" : [ + { "kind" : "IdRef", "name" : "'Merge Block'" }, + { "kind" : "SelectionControl" } + ] + }, + { + "opname" : "OpLabel", + "opcode" : 248, + "operands" : [ + { "kind" : "IdResult" } + ] + }, + { + "opname" : "OpBranch", + "opcode" : 249, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target Label'" } + ] + }, + { + "opname" : "OpBranchConditional", + "opcode" : 250, + "operands" : [ + { "kind" : "IdRef", "name" : "'Condition'" }, + { "kind" : "IdRef", "name" : "'True Label'" }, + { "kind" : "IdRef", "name" : "'False Label'" }, + { "kind" : "LiteralInteger", "quantifier" : "*", "name" : "'Branch weights'" } + ] + }, + { + "opname" : "OpSwitch", + "opcode" : 251, + "operands" : [ + { "kind" : "IdRef", "name" : "'Selector'" }, + { "kind" : "IdRef", "name" : "'Default'" }, + { "kind" : "PairLiteralIntegerIdRef", "quantifier" : "*", "name" : "'Target'" } + ] + }, + { + "opname" : "OpKill", + "opcode" : 252, + "capabilities" : [ "Shader" ] + }, + { + "opname" : "OpReturn", + "opcode" : 253 + }, + { + "opname" : "OpReturnValue", + "opcode" : 254, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" } + ] + }, + { + "opname" : "OpUnreachable", + "opcode" : 255 + }, + { + "opname" : "OpLifetimeStart", + "opcode" : 256, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpLifetimeStop", + "opcode" : 257, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "LiteralInteger", "name" : "'Size'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAsyncCopy", + "opcode" : 259, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Destination'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "IdRef", "name" : "'Num Elements'" }, + { "kind" : "IdRef", "name" : "'Stride'" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupWaitEvents", + "opcode" : 260, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Events List'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpGroupAll", + "opcode" : 261, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupAny", + "opcode" : 262, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupBroadcast", + "opcode" : 263, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'LocalId'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupIAdd", + "opcode" : 264, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFAdd", + "opcode" : 265, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMin", + "opcode" : 266, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMin", + "opcode" : 267, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMin", + "opcode" : 268, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupFMax", + "opcode" : 269, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupUMax", + "opcode" : 270, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpGroupSMax", + "opcode" : 271, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ] + }, + { + "opname" : "OpReadPipe", + "opcode" : 274, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpWritePipe", + "opcode" : 275, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedReadPipe", + "opcode" : 276, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReservedWritePipe", + "opcode" : 277, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Index'" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveReadPipePackets", + "opcode" : 278, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpReserveWritePipePackets", + "opcode" : 279, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitReadPipe", + "opcode" : 280, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpCommitWritePipe", + "opcode" : 281, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpIsValidReserveId", + "opcode" : 282, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetNumPipePackets", + "opcode" : 283, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGetMaxPipePackets", + "opcode" : 284, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveReadPipePackets", + "opcode" : 285, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupReserveWritePipePackets", + "opcode" : 286, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Num Packets'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitReadPipe", + "opcode" : 287, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpGroupCommitWritePipe", + "opcode" : 288, + "operands" : [ + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Pipe'" }, + { "kind" : "IdRef", "name" : "'Reserve Id'" }, + { "kind" : "IdRef", "name" : "'Packet Size'" }, + { "kind" : "IdRef", "name" : "'Packet Alignment'" } + ], + "capabilities" : [ "Pipes" ] + }, + { + "opname" : "OpEnqueueMarker", + "opcode" : 291, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpEnqueueKernel", + "opcode" : 292, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Queue'" }, + { "kind" : "IdRef", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Num Events'" }, + { "kind" : "IdRef", "name" : "'Wait Events'" }, + { "kind" : "IdRef", "name" : "'Ret Event'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" }, + { "kind" : "IdRef", "quantifier" : "*", "name" : "'Local Size'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeSubGroupCount", + "opcode" : 293, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelNDrangeMaxSubGroupSize", + "opcode" : 294, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'ND Range'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelWorkGroupSize", + "opcode" : 295, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetKernelPreferredWorkGroupSizeMultiple", + "opcode" : 296, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpRetainEvent", + "opcode" : 297, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpReleaseEvent", + "opcode" : 298, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCreateUserEvent", + "opcode" : 299, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpIsValidEvent", + "opcode" : 300, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Event'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpSetUserEventStatus", + "opcode" : 301, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Status'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpCaptureEventProfilingInfo", + "opcode" : 302, + "operands" : [ + { "kind" : "IdRef", "name" : "'Event'" }, + { "kind" : "IdRef", "name" : "'Profiling Info'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpGetDefaultQueue", + "opcode" : 303, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpBuildNDRange", + "opcode" : 304, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'GlobalWorkSize'" }, + { "kind" : "IdRef", "name" : "'LocalWorkSize'" }, + { "kind" : "IdRef", "name" : "'GlobalWorkOffset'" } + ], + "capabilities" : [ "DeviceEnqueue" ] + }, + { + "opname" : "OpImageSparseSampleImplicitLod", + "opcode" : 305, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleExplicitLod", + "opcode" : 306, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefImplicitLod", + "opcode" : 307, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleDrefExplicitLod", + "opcode" : 308, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseSampleProjImplicitLod", + "opcode" : 309, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ], + "version" : "None" + }, + { + "opname" : "OpImageSparseSampleProjExplicitLod", + "opcode" : 310, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ], + "version" : "None" + }, + { + "opname" : "OpImageSparseSampleProjDrefImplicitLod", + "opcode" : 311, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ], + "version" : "None" + }, + { + "opname" : "OpImageSparseSampleProjDrefExplicitLod", + "opcode" : 312, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands" } + ], + "capabilities" : [ "SparseResidency" ], + "version" : "None" + }, + { + "opname" : "OpImageSparseFetch", + "opcode" : 313, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseGather", + "opcode" : 314, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Component'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseDrefGather", + "opcode" : 315, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Sampled Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'D~ref~'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpImageSparseTexelsResident", + "opcode" : 316, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Resident Code'" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpNoLine", + "opcode" : 317 + }, + { + "opname" : "OpAtomicFlagTestAndSet", + "opcode" : 318, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpAtomicFlagClear", + "opcode" : 319, + "operands" : [ + { "kind" : "IdRef", "name" : "'Pointer'" }, + { "kind" : "IdScope", "name" : "'Scope'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "Kernel" ] + }, + { + "opname" : "OpImageSparseRead", + "opcode" : 320, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "ImageOperands", "quantifier" : "?" } + ], + "capabilities" : [ "SparseResidency" ] + }, + { + "opname" : "OpSizeOf", + "opcode" : 321, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pointer'" } + ], + "capabilities" : [ "Addresses" ], + "version" : "1.1" + }, + { + "opname" : "OpTypePipeStorage", + "opcode" : 322, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "PipeStorage" ], + "version" : "1.1" + }, + { + "opname" : "OpConstantPipeStorage", + "opcode" : 323, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "LiteralInteger", "name" : "'Packet Size'" }, + { "kind" : "LiteralInteger", "name" : "'Packet Alignment'" }, + { "kind" : "LiteralInteger", "name" : "'Capacity'" } + ], + "capabilities" : [ "PipeStorage" ], + "version" : "1.1" + }, + { + "opname" : "OpCreatePipeFromPipeStorage", + "opcode" : 324, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Pipe Storage'" } + ], + "capabilities" : [ "PipeStorage" ], + "version" : "1.1" + }, + { + "opname" : "OpGetKernelLocalSizeForSubgroupCount", + "opcode" : 325, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Subgroup Count'" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "SubgroupDispatch" ], + "version" : "1.1" + }, + { + "opname" : "OpGetKernelMaxNumSubgroups", + "opcode" : 326, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Invoke'" }, + { "kind" : "IdRef", "name" : "'Param'" }, + { "kind" : "IdRef", "name" : "'Param Size'" }, + { "kind" : "IdRef", "name" : "'Param Align'" } + ], + "capabilities" : [ "SubgroupDispatch" ], + "version" : "1.1" + }, + { + "opname" : "OpTypeNamedBarrier", + "opcode" : 327, + "operands" : [ + { "kind" : "IdResult" } + ], + "capabilities" : [ "NamedBarrier" ], + "version" : "1.1" + }, + { + "opname" : "OpNamedBarrierInitialize", + "opcode" : 328, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Subgroup Count'" } + ], + "capabilities" : [ "NamedBarrier" ], + "version" : "1.1" + }, + { + "opname" : "OpMemoryNamedBarrier", + "opcode" : 329, + "operands" : [ + { "kind" : "IdRef", "name" : "'Named Barrier'" }, + { "kind" : "IdScope", "name" : "'Memory'" }, + { "kind" : "IdMemorySemantics", "name" : "'Semantics'" } + ], + "capabilities" : [ "NamedBarrier" ], + "version" : "1.1" + }, + { + "opname" : "OpModuleProcessed", + "opcode" : 330, + "operands" : [ + { "kind" : "LiteralString", "name" : "'Process'" } + ], + "version" : "1.1" + }, + { + "opname" : "OpExecutionModeId", + "opcode" : 331, + "operands" : [ + { "kind" : "IdRef", "name" : "'Entry Point'" }, + { "kind" : "ExecutionMode", "name" : "'Mode'" } + ], + "version" : "1.2" + }, + { + "opname" : "OpDecorateId", + "opcode" : 332, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ], + "version" : "1.2" + }, + { + "opname" : "OpGroupNonUniformElect", + "opcode" : 333, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" } + ], + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformAll", + "opcode" : 334, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "GroupNonUniformVote" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformAny", + "opcode" : 335, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "GroupNonUniformVote" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformAllEqual", + "opcode" : 336, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformVote" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBroadcast", + "opcode" : 337, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Id'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBroadcastFirst", + "opcode" : 338, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBallot", + "opcode" : 339, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformInverseBallot", + "opcode" : 340, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBallotBitExtract", + "opcode" : 341, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBallotBitCount", + "opcode" : 342, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBallotFindLSB", + "opcode" : 343, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBallotFindMSB", + "opcode" : 344, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformShuffle", + "opcode" : 345, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Id'" } + ], + "capabilities" : [ "GroupNonUniformShuffle" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformShuffleXor", + "opcode" : 346, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Mask'" } + ], + "capabilities" : [ "GroupNonUniformShuffle" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformShuffleUp", + "opcode" : 347, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "GroupNonUniformShuffleRelative" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformShuffleDown", + "opcode" : 348, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "GroupNonUniformShuffleRelative" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformIAdd", + "opcode" : 349, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformFAdd", + "opcode" : 350, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformIMul", + "opcode" : 351, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformFMul", + "opcode" : 352, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformSMin", + "opcode" : 353, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformUMin", + "opcode" : 354, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformFMin", + "opcode" : 355, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformSMax", + "opcode" : 356, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformUMax", + "opcode" : 357, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformFMax", + "opcode" : 358, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBitwiseAnd", + "opcode" : 359, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBitwiseOr", + "opcode" : 360, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformBitwiseXor", + "opcode" : 361, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformLogicalAnd", + "opcode" : 362, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformLogicalOr", + "opcode" : 363, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformLogicalXor", + "opcode" : 364, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'ClusterSize'", "quantifier" : "?" } + ], + "capabilities" : [ "GroupNonUniformArithmetic", "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformQuadBroadcast", + "opcode" : 365, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ], + "capabilities" : [ "GroupNonUniformQuad" ], + "version" : "1.3" + }, + { + "opname" : "OpGroupNonUniformQuadSwap", + "opcode" : 366, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Direction'" } + ], + "capabilities" : [ "GroupNonUniformQuad" ], + "version" : "1.3" + }, + { + "opname" : "OpSubgroupBallotKHR", + "opcode" : 4421, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupFirstInvocationKHR", + "opcode" : 4422, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupAllKHR", + "opcode" : 4428, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "extensions" : [ + "SPV_KHR_subgroup_vote" + ], + "capabilities" : [ "SubgroupVoteKHR" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupAnyKHR", + "opcode" : 4429, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "extensions" : [ + "SPV_KHR_subgroup_vote" + ], + "capabilities" : [ "SubgroupVoteKHR" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupAllEqualKHR", + "opcode" : 4430, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Predicate'" } + ], + "extensions" : [ + "SPV_KHR_subgroup_vote" + ], + "capabilities" : [ "SubgroupVoteKHR" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupReadInvocationKHR", + "opcode" : 4432, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Index'" } + ], + "capabilities" : [ "SubgroupBallotKHR" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupIAddNonUniformAMD", + "opcode" : 5000, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupFAddNonUniformAMD", + "opcode" : 5001, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupFMinNonUniformAMD", + "opcode" : 5002, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupUMinNonUniformAMD", + "opcode" : 5003, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupSMinNonUniformAMD", + "opcode" : 5004, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupFMaxNonUniformAMD", + "opcode" : 5005, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupUMaxNonUniformAMD", + "opcode" : 5006, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpGroupSMaxNonUniformAMD", + "opcode" : 5007, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdScope", "name" : "'Execution'" }, + { "kind" : "GroupOperation", "name" : "'Operation'" }, + { "kind" : "IdRef", "name" : "'X'" } + ], + "capabilities" : [ "Groups" ], + "extensions" : [ "SPV_AMD_shader_ballot" ], + "version" : "None" + }, + { + "opname" : "OpFragmentMaskFetchAMD", + "opcode" : 5011, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "FragmentMaskAMD" ], + "extensions" : [ "SPV_AMD_shader_fragment_mask" ], + "version" : "None" + }, + { + "opname" : "OpFragmentFetchAMD", + "opcode" : 5012, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Fragment Index'" } + ], + "capabilities" : [ "FragmentMaskAMD" ], + "extensions" : [ "SPV_AMD_shader_fragment_mask" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupShuffleINTEL", + "opcode" : 5571, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'InvocationId'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupShuffleDownINTEL", + "opcode" : 5572, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Next'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupShuffleUpINTEL", + "opcode" : 5573, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Previous'" }, + { "kind" : "IdRef", "name" : "'Current'" }, + { "kind" : "IdRef", "name" : "'Delta'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupShuffleXorINTEL", + "opcode" : 5574, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Data'" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "SubgroupShuffleINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupBlockReadINTEL", + "opcode" : 5575, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Ptr'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupBlockWriteINTEL", + "opcode" : 5576, + "operands" : [ + { "kind" : "IdRef", "name" : "'Ptr'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupBufferBlockIOINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupImageBlockReadINTEL", + "opcode" : 5577, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ], + "version" : "None" + }, + { + "opname" : "OpSubgroupImageBlockWriteINTEL", + "opcode" : 5578, + "operands" : [ + { "kind" : "IdRef", "name" : "'Image'" }, + { "kind" : "IdRef", "name" : "'Coordinate'" }, + { "kind" : "IdRef", "name" : "'Data'" } + ], + "capabilities" : [ "SubgroupImageBlockIOINTEL" ], + "version" : "None" + }, + { + "opname" : "OpDecorateStringGOOGLE", + "opcode" : 5632, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1" ], + "version" : "None" + }, + { + "opname" : "OpMemberDecorateStringGOOGLE", + "opcode" : 5633, + "operands" : [ + { "kind" : "IdRef", "name" : "'Struct Type'" }, + { "kind" : "LiteralInteger", "name" : "'Member'" }, + { "kind" : "Decoration" } + ], + "extensions" : [ "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1" ], + "version" : "None" + }, + { + "opname" : "OpGroupNonUniformPartitionNV", + "opcode" : 5296, + "operands" : [ + { "kind" : "IdResultType" }, + { "kind" : "IdResult" }, + { "kind" : "IdRef", "name" : "'Value'" } + ], + "capabilities" : [ "GroupNonUniformPartitionedNV" ], + "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "version" : "None" + } + ], + "operand_kinds" : [ + { + "category" : "BitEnum", + "kind" : "ImageOperands", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Bias", + "value" : "0x0001", + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Lod", + "value" : "0x0002", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Grad", + "value" : "0x0004", + "parameters" : [ + { "kind" : "IdRef" }, + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffset", + "value" : "0x0008", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Offset", + "value" : "0x0010", + "capabilities" : [ "ImageGatherExtended" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "ConstOffsets", + "value" : "0x0020", + "capabilities" : [ "ImageGatherExtended" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "Sample", + "value" : "0x0040", + "parameters" : [ + { "kind" : "IdRef" } + ] + }, + { + "enumerant" : "MinLod", + "value" : "0x0080", + "capabilities" : [ "MinLod" ], + "parameters" : [ + { "kind" : "IdRef" } + ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FPFastMathMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "NotNaN", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NotInf", + "value" : "0x0002", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NSZ", + "value" : "0x0004", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AllowRecip", + "value" : "0x0008", + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Fast", + "value" : "0x0010", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "BitEnum", + "kind" : "SelectionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Flatten", + "value" : "0x0001" + }, + { + "enumerant" : "DontFlatten", + "value" : "0x0002" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "LoopControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Unroll", + "value" : "0x0001" + }, + { + "enumerant" : "DontUnroll", + "value" : "0x0002" + }, + { + "enumerant" : "DependencyInfinite", + "value" : "0x0004", + "version" : "1.1" + }, + { + "enumerant" : "DependencyLength", + "value" : "0x0008", + "parameters" : [ + { "kind" : "LiteralInteger" } + ], + "version" : "1.1" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "FunctionControl", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Inline", + "value" : "0x0001" + }, + { + "enumerant" : "DontInline", + "value" : "0x0002" + }, + { + "enumerant" : "Pure", + "value" : "0x0004" + }, + { + "enumerant" : "Const", + "value" : "0x0008" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemorySemantics", + "enumerants" : [ + { + "enumerant" : "Relaxed", + "value" : "0x0000" + }, + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Acquire", + "value" : "0x0002" + }, + { + "enumerant" : "Release", + "value" : "0x0004" + }, + { + "enumerant" : "AcquireRelease", + "value" : "0x0008" + }, + { + "enumerant" : "SequentiallyConsistent", + "value" : "0x0010" + }, + { + "enumerant" : "UniformMemory", + "value" : "0x0040", + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupMemory", + "value" : "0x0080" + }, + { + "enumerant" : "WorkgroupMemory", + "value" : "0x0100" + }, + { + "enumerant" : "CrossWorkgroupMemory", + "value" : "0x0200" + }, + { + "enumerant" : "AtomicCounterMemory", + "value" : "0x0400", + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "ImageMemory", + "value" : "0x0800" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "MemoryAccess", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "Volatile", + "value" : "0x0001" + }, + { + "enumerant" : "Aligned", + "value" : "0x0002", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + }, + { + "enumerant" : "Nontemporal", + "value" : "0x0004" + } + ] + }, + { + "category" : "BitEnum", + "kind" : "KernelProfilingInfo", + "enumerants" : [ + { + "enumerant" : "None", + "value" : "0x0000" + }, + { + "enumerant" : "CmdExecTime", + "value" : "0x0001", + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SourceLanguage", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "ESSL", + "value" : 1 + }, + { + "enumerant" : "GLSL", + "value" : 2 + }, + { + "enumerant" : "OpenCL_C", + "value" : 3 + }, + { + "enumerant" : "OpenCL_CPP", + "value" : 4 + }, + { + "enumerant" : "HLSL", + "value" : 5 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionModel", + "enumerants" : [ + { + "enumerant" : "Vertex", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TessellationControl", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessellationEvaluation", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Geometry", + "value" : 3, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Fragment", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLCompute", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Kernel", + "value" : 6, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AddressingModel", + "enumerants" : [ + { + "enumerant" : "Logical", + "value" : 0 + }, + { + "enumerant" : "Physical32", + "value" : 1, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Physical64", + "value" : 2, + "capabilities" : [ "Addresses" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "MemoryModel", + "enumerants" : [ + { + "enumerant" : "Simple", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSL450", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OpenCL", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ExecutionMode", + "enumerants" : [ + { + "enumerant" : "Invocations", + "value" : 0, + "capabilities" : [ "Geometry" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Number of <>'" } + ] + }, + { + "enumerant" : "SpacingEqual", + "value" : 1, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalEven", + "value" : 2, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "SpacingFractionalOdd", + "value" : 3, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCw", + "value" : 4, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "VertexOrderCcw", + "value" : 5, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PixelCenterInteger", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginUpperLeft", + "value" : 7, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "OriginLowerLeft", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "EarlyFragmentTests", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointMode", + "value" : 10, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Xfb", + "value" : 11, + "capabilities" : [ "TransformFeedback" ] + }, + { + "enumerant" : "DepthReplacing", + "value" : 12, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthGreater", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthLess", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DepthUnchanged", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "LocalSize", + "value" : 17, + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "LocalSizeHint", + "value" : 18, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'x size'" }, + { "kind" : "LiteralInteger", "name" : "'y size'" }, + { "kind" : "LiteralInteger", "name" : "'z size'" } + ] + }, + { + "enumerant" : "InputPoints", + "value" : 19, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLines", + "value" : 20, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "InputLinesAdjacency", + "value" : 21, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Triangles", + "value" : 22, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InputTrianglesAdjacency", + "value" : 23, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "Quads", + "value" : 24, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Isolines", + "value" : 25, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "OutputVertices", + "value" : 26, + "capabilities" : [ "Geometry", "Tessellation" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vertex count'" } + ] + }, + { + "enumerant" : "OutputPoints", + "value" : 27, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputLineStrip", + "value" : 28, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "OutputTriangleStrip", + "value" : 29, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "VecTypeHint", + "value" : 30, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Vector type'" } + ] + }, + { + "enumerant" : "ContractionOff", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Initializer", + "value" : 33, + "capabilities" : [ "Kernel" ], + "version" : "1.1" + }, + { + "enumerant" : "Finalizer", + "value" : 34, + "capabilities" : [ "Kernel" ], + "version" : "1.1" + }, + { + "enumerant" : "SubgroupSize", + "value" : 35, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Subgroup Size'" } + ], + "version" : "1.1" + }, + { + "enumerant" : "SubgroupsPerWorkgroup", + "value" : 36, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Subgroups Per Workgroup'" } + ], + "version" : "1.1" + }, + { + "enumerant" : "SubgroupsPerWorkgroupId", + "value" : 37, + "capabilities" : [ "SubgroupDispatch" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Subgroups Per Workgroup'" } + ], + "version" : "1.2" + }, + { + "enumerant" : "LocalSizeId", + "value" : 38, + "parameters" : [ + { "kind" : "IdRef", "name" : "'x size'" }, + { "kind" : "IdRef", "name" : "'y size'" }, + { "kind" : "IdRef", "name" : "'z size'" } + ], + "version" : "1.2" + }, + { + "enumerant" : "LocalSizeHintId", + "value" : 39, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Local Size Hint'" } + ], + "version" : "1.2" + }, + { + "enumerant" : "PostDepthCoverage", + "value" : 4446, + "capabilities" : [ "SampleMaskPostDepthCoverage" ], + "extensions" : [ "SPV_KHR_post_depth_coverage" ], + "version" : "None" + }, + { + "enumerant" : "StencilRefReplacingEXT", + "value" : 5027, + "capabilities" : [ "StencilExportEXT" ], + "extensions" : [ "SPV_EXT_shader_stencil_export" ], + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "StorageClass", + "enumerants" : [ + { + "enumerant" : "UniformConstant", + "value" : 0 + }, + { + "enumerant" : "Input", + "value" : 1 + }, + { + "enumerant" : "Uniform", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Output", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Workgroup", + "value" : 4 + }, + { + "enumerant" : "CrossWorkgroup", + "value" : 5 + }, + { + "enumerant" : "Private", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Function", + "value" : 7 + }, + { + "enumerant" : "Generic", + "value" : 8, + "capabilities" : [ "GenericPointer" ] + }, + { + "enumerant" : "PushConstant", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "AtomicCounter", + "value" : 10, + "capabilities" : [ "AtomicStorage" ] + }, + { + "enumerant" : "Image", + "value" : 11 + }, + { + "enumerant" : "StorageBuffer", + "value" : 12, + "extensions" : [ + "SPV_KHR_storage_buffer_storage_class", + "SPV_KHR_variable_pointers" + ], + "capabilities" : [ "Shader" ], + "version" : "1.3" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Dim", + "enumerants" : [ + { + "enumerant" : "1D", + "value" : 0, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "2D", + "value" : 1 + }, + { + "enumerant" : "3D", + "value" : 2 + }, + { + "enumerant" : "Cube", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rect", + "value" : 4, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "Buffer", + "value" : 5, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "SubpassData", + "value" : 6, + "capabilities" : [ "InputAttachment" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerAddressingMode", + "enumerants" : [ + { + "enumerant" : "None", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ClampToEdge", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Clamp", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Repeat", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RepeatMirrored", + "value" : 4, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "SamplerFilterMode", + "enumerants" : [ + { + "enumerant" : "Nearest", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Linear", + "value" : 1, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageFormat", + "enumerants" : [ + { + "enumerant" : "Unknown", + "value" : 0 + }, + { + "enumerant" : "Rgba32f", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16f", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32f", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8", + "value" : 4, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8Snorm", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32f", + "value" : 6, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16f", + "value" : 7, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R11fG11fB10f", + "value" : 8, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16f", + "value" : 9, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16", + "value" : 10, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgb10A2", + "value" : 11, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16", + "value" : 12, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8", + "value" : 13, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16", + "value" : 14, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8", + "value" : 15, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba16Snorm", + "value" : 16, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16Snorm", + "value" : 17, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8Snorm", + "value" : 18, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16Snorm", + "value" : 19, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8Snorm", + "value" : 20, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32i", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16i", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8i", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32i", + "value" : 24, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rg32i", + "value" : 25, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16i", + "value" : 26, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8i", + "value" : 27, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16i", + "value" : 28, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8i", + "value" : 29, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rgba32ui", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba16ui", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgba8ui", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "R32ui", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Rgb10a2ui", + "value" : 34, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg32ui", + "value" : 35, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg16ui", + "value" : 36, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "Rg8ui", + "value" : 37, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R16ui", + "value" : 38, + "capabilities" : [ "StorageImageExtendedFormats" ] + }, + { + "enumerant" : "R8ui", + "value" : 39, + "capabilities" : [ "StorageImageExtendedFormats" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelOrder", + "enumerants" : [ + { + "enumerant" : "R", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "A", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RG", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RA", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGB", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBA", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BGRA", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ARGB", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Intensity", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Luminance", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Rx", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGx", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "RGBx", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Depth", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "DepthStencil", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGB", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBx", + "value" : 16, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sRGBA", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "sBGRA", + "value" : 18, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ABGR", + "value" : 19, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "ImageChannelDataType", + "enumerants" : [ + { + "enumerant" : "SnormInt8", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SnormInt16", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt8", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt16", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort565", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormShort555", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt8", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt16", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SignedInt32", + "value" : 9, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt8", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt16", + "value" : 11, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnsignedInt32", + "value" : 12, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "HalfFloat", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float", + "value" : 14, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt24", + "value" : 15, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "UnormInt101010_2", + "value" : 16, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FPRoundingMode", + "enumerants" : [ + { + "enumerant" : "RTE", + "value" : 0 + }, + { + "enumerant" : "RTZ", + "value" : 1 + }, + { + "enumerant" : "RTP", + "value" : 2 + }, + { + "enumerant" : "RTN", + "value" : 3 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "LinkageType", + "enumerants" : [ + { + "enumerant" : "Export", + "value" : 0, + "capabilities" : [ "Linkage" ] + }, + { + "enumerant" : "Import", + "value" : 1, + "capabilities" : [ "Linkage" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "AccessQualifier", + "enumerants" : [ + { + "enumerant" : "ReadOnly", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WriteOnly", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ReadWrite", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "FunctionParameterAttribute", + "enumerants" : [ + { + "enumerant" : "Zext", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sext", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ByVal", + "value" : 2, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Sret", + "value" : 3, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoAlias", + "value" : 4, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoCapture", + "value" : 5, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoWrite", + "value" : 6, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NoReadWrite", + "value" : 7, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Decoration", + "enumerants" : [ + { + "enumerant" : "RelaxedPrecision", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SpecId", + "value" : 1, + "capabilities" : [ "Shader", "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Specialization Constant ID'" } + ] + }, + { + "enumerant" : "Block", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "BufferBlock", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "RowMajor", + "value" : 4, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ColMajor", + "value" : 5, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "ArrayStride", + "value" : 6, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Array Stride'" } + ] + }, + { + "enumerant" : "MatrixStride", + "value" : 7, + "capabilities" : [ "Matrix" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Matrix Stride'" } + ] + }, + { + "enumerant" : "GLSLShared", + "value" : 8, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GLSLPacked", + "value" : 9, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CPacked", + "value" : 10, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "BuiltIn", + "value" : 11, + "parameters" : [ + { "kind" : "BuiltIn" } + ] + }, + { + "enumerant" : "NoPerspective", + "value" : 13, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Flat", + "value" : 14, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Patch", + "value" : 15, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "Centroid", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sample", + "value" : 17, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "Invariant", + "value" : 18, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Restrict", + "value" : 19 + }, + { + "enumerant" : "Aliased", + "value" : 20 + }, + { + "enumerant" : "Volatile", + "value" : 21 + }, + { + "enumerant" : "Constant", + "value" : 22, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Coherent", + "value" : 23 + }, + { + "enumerant" : "NonWritable", + "value" : 24 + }, + { + "enumerant" : "NonReadable", + "value" : 25 + }, + { + "enumerant" : "Uniform", + "value" : 26, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SaturatedConversion", + "value" : 28, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Stream", + "value" : 29, + "capabilities" : [ "GeometryStreams" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Stream Number'" } + ] + }, + { + "enumerant" : "Location", + "value" : 30, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Location'" } + ] + }, + { + "enumerant" : "Component", + "value" : 31, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Component'" } + ] + }, + { + "enumerant" : "Index", + "value" : 32, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Index'" } + ] + }, + { + "enumerant" : "Binding", + "value" : 33, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Binding Point'" } + ] + }, + { + "enumerant" : "DescriptorSet", + "value" : 34, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Descriptor Set'" } + ] + }, + { + "enumerant" : "Offset", + "value" : 35, + "capabilities" : [ "Shader" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Byte Offset'" } + ] + }, + { + "enumerant" : "XfbBuffer", + "value" : 36, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Buffer Number'" } + ] + }, + { + "enumerant" : "XfbStride", + "value" : 37, + "capabilities" : [ "TransformFeedback" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'XFB Stride'" } + ] + }, + { + "enumerant" : "FuncParamAttr", + "value" : 38, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FunctionParameterAttribute", "name" : "'Function Parameter Attribute'" } + ] + }, + { + "enumerant" : "FPRoundingMode", + "value" : 39, + "parameters" : [ + { "kind" : "FPRoundingMode", "name" : "'Floating-Point Rounding Mode'" } + ] + }, + { + "enumerant" : "FPFastMathMode", + "value" : 40, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "FPFastMathMode", "name" : "'Fast-Math Mode'" } + ] + }, + { + "enumerant" : "LinkageAttributes", + "value" : 41, + "capabilities" : [ "Linkage" ], + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Name'" }, + { "kind" : "LinkageType", "name" : "'Linkage Type'" } + ] + }, + { + "enumerant" : "NoContraction", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InputAttachmentIndex", + "value" : 43, + "capabilities" : [ "InputAttachment" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Attachment Index'" } + ] + }, + { + "enumerant" : "Alignment", + "value" : 44, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Alignment'" } + ] + }, + { + "enumerant" : "MaxByteOffset", + "value" : 45, + "capabilities" : [ "Addresses" ], + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Max Byte Offset'" } + ], + "version" : "1.1" + }, + { + "enumerant" : "AlignmentId", + "value" : 46, + "capabilities" : [ "Kernel" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Alignment'" } + ], + "version" : "1.2" + }, + { + "enumerant" : "MaxByteOffsetId", + "value" : 47, + "capabilities" : [ "Addresses" ], + "parameters" : [ + { "kind" : "IdRef", "name" : "'Max Byte Offset'" } + ], + "version" : "1.2" + }, + { + "enumerant" : "ExplicitInterpAMD", + "value" : 4999, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "OverrideCoverageNV", + "value" : 5248, + "capabilities" : [ "SampleMaskOverrideCoverageNV" ], + "extensions" : [ "SPV_NV_sample_mask_override_coverage" ], + "version" : "None" + }, + { + "enumerant" : "PassthroughNV", + "value" : 5250, + "capabilities" : [ "GeometryShaderPassthroughNV" ], + "extensions" : [ "SPV_NV_geometry_shader_passthrough" ], + "version" : "None" + }, + { + "enumerant" : "ViewportRelativeNV", + "value" : 5252, + "capabilities" : [ "ShaderViewportMaskNV" ], + "version" : "None" + }, + { + "enumerant" : "SecondaryViewportRelativeNV", + "value" : 5256, + "capabilities" : [ "ShaderStereoViewNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ], + "version" : "None", + "parameters" : [ + { "kind" : "LiteralInteger", "name" : "'Offset'" } + ] + }, + { + "enumerant" : "NonUniformEXT", + "value" : 5300, + "capabilities" : [ "ShaderNonUniformEXT" ] + }, + { + "enumerant" : "HlslCounterBufferGOOGLE", + "value" : 5634, + "parameters" : [ + { "kind" : "IdRef", "name" : "'Counter Buffer'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ], + "version" : "None" + }, + { + "enumerant" : "HlslSemanticGOOGLE", + "value" : 5635, + "parameters" : [ + { "kind" : "LiteralString", "name" : "'Semantic'" } + ], + "extensions" : [ "SPV_GOOGLE_hlsl_functionality1" ], + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "BuiltIn", + "enumerants" : [ + { + "enumerant" : "Position", + "value" : 0, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointSize", + "value" : 1, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 3, + "capabilities" : [ "ClipDistance" ] + }, + { + "enumerant" : "CullDistance", + "value" : 4, + "capabilities" : [ "CullDistance" ] + }, + { + "enumerant" : "VertexId", + "value" : 5, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceId", + "value" : 6, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PrimitiveId", + "value" : 7, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "InvocationId", + "value" : 8, + "capabilities" : [ "Geometry", "Tessellation" ] + }, + { + "enumerant" : "Layer", + "value" : 9, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ViewportIndex", + "value" : 10, + "capabilities" : [ "MultiViewport" ] + }, + { + "enumerant" : "TessLevelOuter", + "value" : 11, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessLevelInner", + "value" : 12, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "TessCoord", + "value" : 13, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "PatchVertices", + "value" : 14, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "FragCoord", + "value" : 15, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "PointCoord", + "value" : 16, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FrontFacing", + "value" : 17, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampleId", + "value" : 18, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SamplePosition", + "value" : 19, + "capabilities" : [ "SampleRateShading" ] + }, + { + "enumerant" : "SampleMask", + "value" : 20, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "FragDepth", + "value" : 22, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "HelperInvocation", + "value" : 23, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "NumWorkgroups", + "value" : 24 + }, + { + "enumerant" : "WorkgroupSize", + "value" : 25 + }, + { + "enumerant" : "WorkgroupId", + "value" : 26 + }, + { + "enumerant" : "LocalInvocationId", + "value" : 27 + }, + { + "enumerant" : "GlobalInvocationId", + "value" : 28 + }, + { + "enumerant" : "LocalInvocationIndex", + "value" : 29 + }, + { + "enumerant" : "WorkDim", + "value" : 30, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalSize", + "value" : 31, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "EnqueuedWorkgroupSize", + "value" : 32, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalOffset", + "value" : 33, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "GlobalLinearId", + "value" : 34, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupSize", + "value" : 36, + "capabilities" : [ "Kernel", "GroupNonUniform", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "SubgroupMaxSize", + "value" : 37, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "NumSubgroups", + "value" : 38, + "capabilities" : [ "Kernel", "GroupNonUniform" ] + }, + { + "enumerant" : "NumEnqueuedSubgroups", + "value" : 39, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "SubgroupId", + "value" : 40, + "capabilities" : [ "Kernel", "GroupNonUniform" ] + }, + { + "enumerant" : "SubgroupLocalInvocationId", + "value" : 41, + "capabilities" : [ "Kernel", "GroupNonUniform", "SubgroupBallotKHR" ] + }, + { + "enumerant" : "VertexIndex", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InstanceIndex", + "value" : 43, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SubgroupEqMask", + "value" : 4416, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupGeMask", + "value" : 4417, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupGtMask", + "value" : 4418, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupLeMask", + "value" : 4419, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupLtMask", + "value" : 4420, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupEqMaskKHR", + "value" : 4416, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupGeMaskKHR", + "value" : 4417, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupGtMaskKHR", + "value" : 4418, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupLeMaskKHR", + "value" : 4419, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupLtMaskKHR", + "value" : 4420, + "capabilities" : [ "SubgroupBallotKHR", "GroupNonUniformBallot" ], + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "1.3" + }, + { + "enumerant" : "BaseVertex", + "value" : 4424, + "capabilities" : [ "DrawParameters" ], + "extensions" : [ "SPV_KHR_shader_draw_parameters" ], + "version" : "1.3" + }, + { + "enumerant" : "BaseInstance", + "value" : 4425, + "capabilities" : [ "DrawParameters" ], + "extensions" : [ "SPV_KHR_shader_draw_parameters" ], + "version" : "1.3" + }, + { + "enumerant" : "DrawIndex", + "value" : 4426, + "capabilities" : [ "DrawParameters" ], + "extensions" : [ "SPV_KHR_shader_draw_parameters" ], + "version" : "1.3" + }, + { + "enumerant" : "DeviceIndex", + "value" : 4438, + "capabilities" : [ "DeviceGroup" ], + "extensions" : [ "SPV_KHR_device_group" ], + "version" : "1.3" + }, + { + "enumerant" : "ViewIndex", + "value" : 4440, + "capabilities" : [ "MultiView" ], + "extensions" : [ "SPV_KHR_multiview" ], + "version" : "1.3" + }, + { + "enumerant" : "BaryCoordNoPerspAMD", + "value" : 4992, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "BaryCoordNoPerspCentroidAMD", + "value" : 4993, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "BaryCoordNoPerspSampleAMD", + "value" : 4994, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "BaryCoordSmoothAMD", + "value" : 4995, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "BaryCoordSmoothCentroidAMD", + "value" : 4996, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "BaryCoordSmoothSampleAMD", + "value" : 4997, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "BaryCoordPullModelAMD", + "value" : 4998, + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ], + "version" : "None" + }, + { + "enumerant" : "FragStencilRefEXT", + "value" : 5014, + "capabilities" : [ "StencilExportEXT" ], + "extensions" : [ "SPV_EXT_shader_stencil_export" ], + "version" : "None" + }, + { + "enumerant" : "ViewportMaskNV", + "value" : 5253, + "capabilities" : [ "ShaderViewportMaskNV" ], + "version" : "None" + }, + { + "enumerant" : "SecondaryPositionNV", + "value" : 5257, + "capabilities" : [ "ShaderStereoViewNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ], + "version" : "None" + }, + { + "enumerant" : "SecondaryViewportMaskNV", + "value" : 5258, + "capabilities" : [ "ShaderStereoViewNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ], + "version" : "None" + }, + { + "enumerant" : "PositionPerViewNV", + "value" : 5261, + "capabilities" : [ "PerViewAttributesNV" ], + "version" : "None" + }, + { + "enumerant" : "ViewportMaskPerViewNV", + "value" : 5262, + "capabilities" : [ "PerViewAttributesNV" ], + "version" : "None" + }, + { + "enumerant" : "FullyCoveredEXT", + "value" : 5264, + "capabilities" : [ "FragmentFullyCoveredEXT" ], + "extensions" : [ "SPV_EXT_fragment_fully_covered" ], + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Scope", + "enumerants" : [ + { + "enumerant" : "CrossDevice", + "value" : 0 + }, + { + "enumerant" : "Device", + "value" : 1 + }, + { + "enumerant" : "Workgroup", + "value" : 2 + }, + { + "enumerant" : "Subgroup", + "value" : 3 + }, + { + "enumerant" : "Invocation", + "value" : 4 + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "GroupOperation", + "enumerants" : [ + { + "enumerant" : "Reduce", + "value" : 0, + "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ] + }, + { + "enumerant" : "InclusiveScan", + "value" : 1, + "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ] + }, + { + "enumerant" : "ExclusiveScan", + "value" : 2, + "capabilities" : [ "Kernel", "GroupNonUniformArithmetic", "GroupNonUniformBallot" ] + }, + { + "enumerant" : "ClusteredReduce", + "value" : 3, + "capabilities" : [ "GroupNonUniformClustered" ], + "version" : "1.3" + }, + { + "enumerant" : "PartitionedReduceNV", + "value" : 6, + "capabilities" : [ "GroupNonUniformPartitionedNV" ], + "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "version" : "None" + }, + { + "enumerant" : "PartitionedInclusiveScanNV", + "value" : 7, + "capabilities" : [ "GroupNonUniformPartitionedNV" ], + "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "version" : "None" + }, + { + "enumerant" : "PartitionedExclusiveScanNV", + "value" : 8, + "capabilities" : [ "GroupNonUniformPartitionedNV" ], + "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "version" : "None" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "KernelEnqueueFlags", + "enumerants" : [ + { + "enumerant" : "NoWait", + "value" : 0, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitKernel", + "value" : 1, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "WaitWorkGroup", + "value" : 2, + "capabilities" : [ "Kernel" ] + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "Capability", + "enumerants" : [ + { + "enumerant" : "Matrix", + "value" : 0 + }, + { + "enumerant" : "Shader", + "value" : 1, + "capabilities" : [ "Matrix" ] + }, + { + "enumerant" : "Geometry", + "value" : 2, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Tessellation", + "value" : 3, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Addresses", + "value" : 4 + }, + { + "enumerant" : "Linkage", + "value" : 5 + }, + { + "enumerant" : "Kernel", + "value" : 6 + }, + { + "enumerant" : "Vector16", + "value" : 7, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16Buffer", + "value" : 8, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Float16", + "value" : 9 + }, + { + "enumerant" : "Float64", + "value" : 10 + }, + { + "enumerant" : "Int64", + "value" : 11 + }, + { + "enumerant" : "Int64Atomics", + "value" : 12, + "capabilities" : [ "Int64" ] + }, + { + "enumerant" : "ImageBasic", + "value" : 13, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "ImageReadWrite", + "value" : 14, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "ImageMipmap", + "value" : 15, + "capabilities" : [ "ImageBasic" ] + }, + { + "enumerant" : "Pipes", + "value" : 17, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "Groups", + "value" : 18 + }, + { + "enumerant" : "DeviceEnqueue", + "value" : 19, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "LiteralSampler", + "value" : 20, + "capabilities" : [ "Kernel" ] + }, + { + "enumerant" : "AtomicStorage", + "value" : 21, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Int16", + "value" : 22 + }, + { + "enumerant" : "TessellationPointSize", + "value" : 23, + "capabilities" : [ "Tessellation" ] + }, + { + "enumerant" : "GeometryPointSize", + "value" : 24, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "ImageGatherExtended", + "value" : 25, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageMultisample", + "value" : 27, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "UniformBufferArrayDynamicIndexing", + "value" : 28, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledImageArrayDynamicIndexing", + "value" : 29, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageBufferArrayDynamicIndexing", + "value" : 30, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageArrayDynamicIndexing", + "value" : 31, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ClipDistance", + "value" : 32, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "CullDistance", + "value" : 33, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageCubeArray", + "value" : 34, + "capabilities" : [ "SampledCubeArray" ] + }, + { + "enumerant" : "SampleRateShading", + "value" : 35, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageRect", + "value" : 36, + "capabilities" : [ "SampledRect" ] + }, + { + "enumerant" : "SampledRect", + "value" : 37, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GenericPointer", + "value" : 38, + "capabilities" : [ "Addresses" ] + }, + { + "enumerant" : "Int8", + "value" : 39 + }, + { + "enumerant" : "InputAttachment", + "value" : 40, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SparseResidency", + "value" : 41, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MinLod", + "value" : 42, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "Sampled1D", + "value" : 43 + }, + { + "enumerant" : "Image1D", + "value" : 44, + "capabilities" : [ "Sampled1D" ] + }, + { + "enumerant" : "SampledCubeArray", + "value" : 45, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "SampledBuffer", + "value" : 46 + }, + { + "enumerant" : "ImageBuffer", + "value" : 47, + "capabilities" : [ "SampledBuffer" ] + }, + { + "enumerant" : "ImageMSArray", + "value" : 48, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageExtendedFormats", + "value" : 49, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "ImageQuery", + "value" : 50, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "DerivativeControl", + "value" : 51, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "InterpolationFunction", + "value" : 52, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "TransformFeedback", + "value" : 53, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "GeometryStreams", + "value" : 54, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "StorageImageReadWithoutFormat", + "value" : 55, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "StorageImageWriteWithoutFormat", + "value" : 56, + "capabilities" : [ "Shader" ] + }, + { + "enumerant" : "MultiViewport", + "value" : 57, + "capabilities" : [ "Geometry" ] + }, + { + "enumerant" : "SubgroupDispatch", + "value" : 58, + "capabilities" : [ "DeviceEnqueue" ], + "version" : "1.1" + }, + { + "enumerant" : "NamedBarrier", + "value" : 59, + "capabilities" : [ "Kernel" ], + "version" : "1.1" + }, + { + "enumerant" : "PipeStorage", + "value" : 60, + "capabilities" : [ "Pipes" ], + "version" : "1.1" + }, + { + "enumerant" : "GroupNonUniform", + "value" : 61, + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformVote", + "value" : 62, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformArithmetic", + "value" : 63, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformBallot", + "value" : 64, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformShuffle", + "value" : 65, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformShuffleRelative", + "value" : 66, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformClustered", + "value" : 67, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "GroupNonUniformQuad", + "value" : 68, + "capabilities" : [ "GroupNonUniform" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupBallotKHR", + "value" : 4423, + "extensions" : [ "SPV_KHR_shader_ballot" ], + "version" : "None" + }, + { + "enumerant" : "DrawParameters", + "value" : 4427, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_shader_draw_parameters" ], + "version" : "1.3" + }, + { + "enumerant" : "SubgroupVoteKHR", + "value" : 4431, + "extensions" : [ "SPV_KHR_subgroup_vote" ], + "version" : "None" + }, + { + "enumerant" : "StorageBuffer16BitAccess", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ], + "version" : "1.3" + }, + { + "enumerant" : "StorageUniformBufferBlock16", + "value" : 4433, + "extensions" : [ "SPV_KHR_16bit_storage" ], + "version" : "1.3" + }, + { + "enumerant" : "UniformAndStorageBuffer16BitAccess", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ], + "version" : "1.3" + }, + { + "enumerant" : "StorageUniform16", + "value" : 4434, + "capabilities" : [ + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16" + ], + "extensions" : [ "SPV_KHR_16bit_storage" ], + "version" : "1.3" + }, + { + "enumerant" : "StoragePushConstant16", + "value" : 4435, + "extensions" : [ "SPV_KHR_16bit_storage" ], + "version" : "1.3" + }, + { + "enumerant" : "StorageInputOutput16", + "value" : 4436, + "extensions" : [ "SPV_KHR_16bit_storage" ], + "version" : "1.3" + }, + { + "enumerant" : "DeviceGroup", + "value" : 4437, + "extensions" : [ "SPV_KHR_device_group" ], + "version" : "1.3" + }, + { + "enumerant" : "MultiView", + "value" : 4439, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_multiview" ], + "version" : "1.3" + }, + { + "enumerant" : "VariablePointersStorageBuffer", + "value" : 4441, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_KHR_variable_pointers" ], + "version" : "1.3" + }, + { + "enumerant" : "VariablePointers", + "value" : 4442, + "capabilities" : [ "VariablePointersStorageBuffer" ], + "extensions" : [ "SPV_KHR_variable_pointers" ], + "version" : "1.3" + }, + { + "enumerant" : "AtomicStorageOps", + "value" : 4445, + "extensions" : [ "SPV_KHR_shader_atomic_counter_ops" ], + "version" : "None" + }, + { + "enumerant" : "SampleMaskPostDepthCoverage", + "value" : 4447, + "extensions" : [ "SPV_KHR_post_depth_coverage" ], + "version" : "None" + }, + { + "enumerant" : "StorageBuffer8BitAccess", + "value" : 4448, + "extensions" : [ "SPV_KHR_8bit_storage" ], + "version" : "None" + }, + { + "enumerant" : "UniformAndStorageBuffer8BitAccess", + "value" : 4449, + "capabilities" : [ "StorageBuffer8BitAccess" ], + "extensions" : [ "SPV_KHR_8bit_storage" ], + "version" : "None" + }, + { + "enumerant" : "StoragePushConstant8", + "value" : 4450, + "extensions" : [ "SPV_KHR_8bit_storage" ], + "version" : "None" + }, + { + "enumerant" : "Float16ImageAMD", + "value" : 5008, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_gpu_shader_half_float_fetch" ], + "version" : "None" + }, + { + "enumerant" : "ImageGatherBiasLodAMD", + "value" : 5009, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_texture_gather_bias_lod" ], + "version" : "None" + }, + { + "enumerant" : "FragmentMaskAMD", + "value" : 5010, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_fragment_mask" ], + "version" : "None" + }, + { + "enumerant" : "StencilExportEXT", + "value" : 5013, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_shader_stencil_export" ], + "version" : "None" + }, + { + "enumerant" : "ImageReadWriteLodAMD", + "value" : 5015, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_AMD_shader_image_load_store_lod" ], + "version" : "None" + }, + { + "enumerant" : "SampleMaskOverrideCoverageNV", + "value" : 5249, + "capabilities" : [ "SampleRateShading" ], + "extensions" : [ "SPV_NV_sample_mask_override_coverage" ], + "version" : "None" + }, + { + "enumerant" : "GeometryShaderPassthroughNV", + "value" : 5251, + "capabilities" : [ "Geometry" ], + "extensions" : [ "SPV_NV_geometry_shader_passthrough" ], + "version" : "None" + }, + { + "enumerant" : "ShaderViewportIndexLayerEXT", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_EXT_shader_viewport_index_layer" ], + "version" : "None" + }, + { + "enumerant" : "ShaderViewportIndexLayerNV", + "value" : 5254, + "capabilities" : [ "MultiViewport" ], + "extensions" : [ "SPV_NV_viewport_array2" ], + "version" : "None" + }, + { + "enumerant" : "ShaderViewportMaskNV", + "value" : 5255, + "capabilities" : [ "ShaderViewportIndexLayerNV" ], + "extensions" : [ "SPV_NV_viewport_array2" ], + "version" : "None" + }, + { + "enumerant" : "ShaderStereoViewNV", + "value" : 5259, + "capabilities" : [ "ShaderViewportMaskNV" ], + "extensions" : [ "SPV_NV_stereo_view_rendering" ], + "version" : "None" + }, + { + "enumerant" : "PerViewAttributesNV", + "value" : 5260, + "capabilities" : [ "MultiView" ], + "extensions" : [ "SPV_NVX_multiview_per_view_attributes" ], + "version" : "None" + }, + { + "enumerant" : "FragmentFullyCoveredEXT", + "value" : 5265, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_fragment_fully_covered" ], + "version" : "None" + }, + { + "enumerant" : "ShaderNonUniformEXT", + "value" : 5301, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "RuntimeDescriptorArrayEXT", + "value" : 5302, + "capabilities" : [ "Shader" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "InputAttachmentArrayDynamicIndexingEXT", + "value" : 5303, + "capabilities" : [ "InputAttachment" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "UniformTexelBufferArrayDynamicIndexingEXT", + "value" : 5304, + "capabilities" : [ "SampledBuffer" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "StorageTexelBufferArrayDynamicIndexingEXT", + "value" : 5305, + "capabilities" : [ "ImageBuffer" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "UniformBufferArrayNonUniformIndexingEXT", + "value" : 5306, + "capabilities" : [ "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "SampledImageArrayNonUniformIndexingEXT", + "value" : 5307, + "capabilities" : [ "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "StorageBufferArrayNonUniformIndexingEXT", + "value" : 5308, + "capabilities" : [ "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "StorageImageArrayNonUniformIndexingEXT", + "value" : 5309, + "capabilities" : [ "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "InputAttachmentArrayNonUniformIndexingEXT", + "value" : 5310, + "capabilities" : [ "InputAttachment", "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "UniformTexelBufferArrayNonUniformIndexingEXT", + "value" : 5311, + "capabilities" : [ "SampledBuffer", "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "StorageTexelBufferArrayNonUniformIndexingEXT", + "value" : 5312, + "capabilities" : [ "ImageBuffer", "ShaderNonUniformEXT" ], + "extensions" : [ "SPV_EXT_descriptor_indexing" ], + "version" : "None" + }, + { + "enumerant" : "SubgroupShuffleINTEL", + "value" : 5568, + "extensions" : [ "SPV_INTEL_subgroups" ], + "version" : "None" + }, + { + "enumerant" : "SubgroupBufferBlockIOINTEL", + "value" : 5569, + "extensions" : [ "SPV_INTEL_subgroups" ], + "version" : "None" + }, + { + "enumerant" : "SubgroupImageBlockIOINTEL", + "value" : 5570, + "extensions" : [ "SPV_INTEL_subgroups" ], + "version" : "None" + }, + { + "enumerant" : "GroupNonUniformPartitionedNV", + "value" : 5297, + "extensions" : [ "SPV_NV_shader_subgroup_partitioned" ], + "version" : "None" + } + ] + }, + { + "category" : "Id", + "kind" : "IdResultType", + "doc" : "Reference to an representing the result's type of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdResult", + "doc" : "Definition of an representing the result of the enclosing instruction" + }, + { + "category" : "Id", + "kind" : "IdMemorySemantics", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the MemorySemantics operand kind" + }, + { + "category" : "Id", + "kind" : "IdScope", + "doc" : "Reference to an representing a 32-bit integer that is a mask from the Scope operand kind" + }, + { + "category" : "Id", + "kind" : "IdRef", + "doc" : "Reference to an " + }, + { + "category" : "Literal", + "kind" : "LiteralInteger", + "doc" : "An integer consuming one or more words" + }, + { + "category" : "Literal", + "kind" : "LiteralString", + "doc" : "A null-terminated stream of characters consuming an integral number of words" + }, + { + "category" : "Literal", + "kind" : "LiteralContextDependentNumber", + "doc" : "A literal number whose size and format are determined by a previous operand in the enclosing instruction" + }, + { + "category" : "Literal", + "kind" : "LiteralExtInstInteger", + "doc" : "A 32-bit unsigned integer indicating which instruction to use and determining the layout of following operands (for OpExtInst)" + }, + { + "category" : "Literal", + "kind" : "LiteralSpecConstantOpInteger", + "doc" : "An opcode indicating the operation to be performed and determining the layout of following operands (for OpSpecConstantOp)" + }, + { + "category" : "Composite", + "kind" : "PairLiteralIntegerIdRef", + "bases" : [ "LiteralInteger", "IdRef" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefLiteralInteger", + "bases" : [ "IdRef", "LiteralInteger" ] + }, + { + "category" : "Composite", + "kind" : "PairIdRefIdRef", + "bases" : [ "IdRef", "IdRef" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.h new file mode 100644 index 00000000000..4c90c936ce0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.h @@ -0,0 +1,1093 @@ +/* +** Copyright (c) 2014-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +/* +** This header is automatically generated by the same tool that creates +** the Binary Section of the SPIR-V specification. +*/ + +/* +** Enumeration tokens for SPIR-V, in various styles: +** C, C++, C++11, JSON, Lua, Python +** +** - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +** - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +** - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +** - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +** - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +** +** Some tokens act like mask values, which can be OR'd together, +** while others are mutually exclusive. The mask-like ones have +** "Mask" in their name, and a parallel enum that has the shift +** amount (1 << x) for each corresponding enumerant. +*/ + +#ifndef spirv_H +#define spirv_H + +typedef unsigned int SpvId; + +#define SPV_VERSION 0x10300 +#define SPV_REVISION 1 + +static const unsigned int SpvMagicNumber = 0x07230203; +static const unsigned int SpvVersion = 0x00010300; +static const unsigned int SpvRevision = 1; +static const unsigned int SpvOpCodeMask = 0xffff; +static const unsigned int SpvWordCountShift = 16; + +typedef enum SpvSourceLanguage_ { + SpvSourceLanguageUnknown = 0, + SpvSourceLanguageESSL = 1, + SpvSourceLanguageGLSL = 2, + SpvSourceLanguageOpenCL_C = 3, + SpvSourceLanguageOpenCL_CPP = 4, + SpvSourceLanguageHLSL = 5, + SpvSourceLanguageMax = 0x7fffffff, +} SpvSourceLanguage; + +typedef enum SpvExecutionModel_ { + SpvExecutionModelVertex = 0, + SpvExecutionModelTessellationControl = 1, + SpvExecutionModelTessellationEvaluation = 2, + SpvExecutionModelGeometry = 3, + SpvExecutionModelFragment = 4, + SpvExecutionModelGLCompute = 5, + SpvExecutionModelKernel = 6, + SpvExecutionModelMax = 0x7fffffff, +} SpvExecutionModel; + +typedef enum SpvAddressingModel_ { + SpvAddressingModelLogical = 0, + SpvAddressingModelPhysical32 = 1, + SpvAddressingModelPhysical64 = 2, + SpvAddressingModelMax = 0x7fffffff, +} SpvAddressingModel; + +typedef enum SpvMemoryModel_ { + SpvMemoryModelSimple = 0, + SpvMemoryModelGLSL450 = 1, + SpvMemoryModelOpenCL = 2, + SpvMemoryModelMax = 0x7fffffff, +} SpvMemoryModel; + +typedef enum SpvExecutionMode_ { + SpvExecutionModeInvocations = 0, + SpvExecutionModeSpacingEqual = 1, + SpvExecutionModeSpacingFractionalEven = 2, + SpvExecutionModeSpacingFractionalOdd = 3, + SpvExecutionModeVertexOrderCw = 4, + SpvExecutionModeVertexOrderCcw = 5, + SpvExecutionModePixelCenterInteger = 6, + SpvExecutionModeOriginUpperLeft = 7, + SpvExecutionModeOriginLowerLeft = 8, + SpvExecutionModeEarlyFragmentTests = 9, + SpvExecutionModePointMode = 10, + SpvExecutionModeXfb = 11, + SpvExecutionModeDepthReplacing = 12, + SpvExecutionModeDepthGreater = 14, + SpvExecutionModeDepthLess = 15, + SpvExecutionModeDepthUnchanged = 16, + SpvExecutionModeLocalSize = 17, + SpvExecutionModeLocalSizeHint = 18, + SpvExecutionModeInputPoints = 19, + SpvExecutionModeInputLines = 20, + SpvExecutionModeInputLinesAdjacency = 21, + SpvExecutionModeTriangles = 22, + SpvExecutionModeInputTrianglesAdjacency = 23, + SpvExecutionModeQuads = 24, + SpvExecutionModeIsolines = 25, + SpvExecutionModeOutputVertices = 26, + SpvExecutionModeOutputPoints = 27, + SpvExecutionModeOutputLineStrip = 28, + SpvExecutionModeOutputTriangleStrip = 29, + SpvExecutionModeVecTypeHint = 30, + SpvExecutionModeContractionOff = 31, + SpvExecutionModeInitializer = 33, + SpvExecutionModeFinalizer = 34, + SpvExecutionModeSubgroupSize = 35, + SpvExecutionModeSubgroupsPerWorkgroup = 36, + SpvExecutionModeSubgroupsPerWorkgroupId = 37, + SpvExecutionModeLocalSizeId = 38, + SpvExecutionModeLocalSizeHintId = 39, + SpvExecutionModePostDepthCoverage = 4446, + SpvExecutionModeStencilRefReplacingEXT = 5027, + SpvExecutionModeMax = 0x7fffffff, +} SpvExecutionMode; + +typedef enum SpvStorageClass_ { + SpvStorageClassUniformConstant = 0, + SpvStorageClassInput = 1, + SpvStorageClassUniform = 2, + SpvStorageClassOutput = 3, + SpvStorageClassWorkgroup = 4, + SpvStorageClassCrossWorkgroup = 5, + SpvStorageClassPrivate = 6, + SpvStorageClassFunction = 7, + SpvStorageClassGeneric = 8, + SpvStorageClassPushConstant = 9, + SpvStorageClassAtomicCounter = 10, + SpvStorageClassImage = 11, + SpvStorageClassStorageBuffer = 12, + SpvStorageClassMax = 0x7fffffff, +} SpvStorageClass; + +typedef enum SpvDim_ { + SpvDim1D = 0, + SpvDim2D = 1, + SpvDim3D = 2, + SpvDimCube = 3, + SpvDimRect = 4, + SpvDimBuffer = 5, + SpvDimSubpassData = 6, + SpvDimMax = 0x7fffffff, +} SpvDim; + +typedef enum SpvSamplerAddressingMode_ { + SpvSamplerAddressingModeNone = 0, + SpvSamplerAddressingModeClampToEdge = 1, + SpvSamplerAddressingModeClamp = 2, + SpvSamplerAddressingModeRepeat = 3, + SpvSamplerAddressingModeRepeatMirrored = 4, + SpvSamplerAddressingModeMax = 0x7fffffff, +} SpvSamplerAddressingMode; + +typedef enum SpvSamplerFilterMode_ { + SpvSamplerFilterModeNearest = 0, + SpvSamplerFilterModeLinear = 1, + SpvSamplerFilterModeMax = 0x7fffffff, +} SpvSamplerFilterMode; + +typedef enum SpvImageFormat_ { + SpvImageFormatUnknown = 0, + SpvImageFormatRgba32f = 1, + SpvImageFormatRgba16f = 2, + SpvImageFormatR32f = 3, + SpvImageFormatRgba8 = 4, + SpvImageFormatRgba8Snorm = 5, + SpvImageFormatRg32f = 6, + SpvImageFormatRg16f = 7, + SpvImageFormatR11fG11fB10f = 8, + SpvImageFormatR16f = 9, + SpvImageFormatRgba16 = 10, + SpvImageFormatRgb10A2 = 11, + SpvImageFormatRg16 = 12, + SpvImageFormatRg8 = 13, + SpvImageFormatR16 = 14, + SpvImageFormatR8 = 15, + SpvImageFormatRgba16Snorm = 16, + SpvImageFormatRg16Snorm = 17, + SpvImageFormatRg8Snorm = 18, + SpvImageFormatR16Snorm = 19, + SpvImageFormatR8Snorm = 20, + SpvImageFormatRgba32i = 21, + SpvImageFormatRgba16i = 22, + SpvImageFormatRgba8i = 23, + SpvImageFormatR32i = 24, + SpvImageFormatRg32i = 25, + SpvImageFormatRg16i = 26, + SpvImageFormatRg8i = 27, + SpvImageFormatR16i = 28, + SpvImageFormatR8i = 29, + SpvImageFormatRgba32ui = 30, + SpvImageFormatRgba16ui = 31, + SpvImageFormatRgba8ui = 32, + SpvImageFormatR32ui = 33, + SpvImageFormatRgb10a2ui = 34, + SpvImageFormatRg32ui = 35, + SpvImageFormatRg16ui = 36, + SpvImageFormatRg8ui = 37, + SpvImageFormatR16ui = 38, + SpvImageFormatR8ui = 39, + SpvImageFormatMax = 0x7fffffff, +} SpvImageFormat; + +typedef enum SpvImageChannelOrder_ { + SpvImageChannelOrderR = 0, + SpvImageChannelOrderA = 1, + SpvImageChannelOrderRG = 2, + SpvImageChannelOrderRA = 3, + SpvImageChannelOrderRGB = 4, + SpvImageChannelOrderRGBA = 5, + SpvImageChannelOrderBGRA = 6, + SpvImageChannelOrderARGB = 7, + SpvImageChannelOrderIntensity = 8, + SpvImageChannelOrderLuminance = 9, + SpvImageChannelOrderRx = 10, + SpvImageChannelOrderRGx = 11, + SpvImageChannelOrderRGBx = 12, + SpvImageChannelOrderDepth = 13, + SpvImageChannelOrderDepthStencil = 14, + SpvImageChannelOrdersRGB = 15, + SpvImageChannelOrdersRGBx = 16, + SpvImageChannelOrdersRGBA = 17, + SpvImageChannelOrdersBGRA = 18, + SpvImageChannelOrderABGR = 19, + SpvImageChannelOrderMax = 0x7fffffff, +} SpvImageChannelOrder; + +typedef enum SpvImageChannelDataType_ { + SpvImageChannelDataTypeSnormInt8 = 0, + SpvImageChannelDataTypeSnormInt16 = 1, + SpvImageChannelDataTypeUnormInt8 = 2, + SpvImageChannelDataTypeUnormInt16 = 3, + SpvImageChannelDataTypeUnormShort565 = 4, + SpvImageChannelDataTypeUnormShort555 = 5, + SpvImageChannelDataTypeUnormInt101010 = 6, + SpvImageChannelDataTypeSignedInt8 = 7, + SpvImageChannelDataTypeSignedInt16 = 8, + SpvImageChannelDataTypeSignedInt32 = 9, + SpvImageChannelDataTypeUnsignedInt8 = 10, + SpvImageChannelDataTypeUnsignedInt16 = 11, + SpvImageChannelDataTypeUnsignedInt32 = 12, + SpvImageChannelDataTypeHalfFloat = 13, + SpvImageChannelDataTypeFloat = 14, + SpvImageChannelDataTypeUnormInt24 = 15, + SpvImageChannelDataTypeUnormInt101010_2 = 16, + SpvImageChannelDataTypeMax = 0x7fffffff, +} SpvImageChannelDataType; + +typedef enum SpvImageOperandsShift_ { + SpvImageOperandsBiasShift = 0, + SpvImageOperandsLodShift = 1, + SpvImageOperandsGradShift = 2, + SpvImageOperandsConstOffsetShift = 3, + SpvImageOperandsOffsetShift = 4, + SpvImageOperandsConstOffsetsShift = 5, + SpvImageOperandsSampleShift = 6, + SpvImageOperandsMinLodShift = 7, + SpvImageOperandsMax = 0x7fffffff, +} SpvImageOperandsShift; + +typedef enum SpvImageOperandsMask_ { + SpvImageOperandsMaskNone = 0, + SpvImageOperandsBiasMask = 0x00000001, + SpvImageOperandsLodMask = 0x00000002, + SpvImageOperandsGradMask = 0x00000004, + SpvImageOperandsConstOffsetMask = 0x00000008, + SpvImageOperandsOffsetMask = 0x00000010, + SpvImageOperandsConstOffsetsMask = 0x00000020, + SpvImageOperandsSampleMask = 0x00000040, + SpvImageOperandsMinLodMask = 0x00000080, +} SpvImageOperandsMask; + +typedef enum SpvFPFastMathModeShift_ { + SpvFPFastMathModeNotNaNShift = 0, + SpvFPFastMathModeNotInfShift = 1, + SpvFPFastMathModeNSZShift = 2, + SpvFPFastMathModeAllowRecipShift = 3, + SpvFPFastMathModeFastShift = 4, + SpvFPFastMathModeMax = 0x7fffffff, +} SpvFPFastMathModeShift; + +typedef enum SpvFPFastMathModeMask_ { + SpvFPFastMathModeMaskNone = 0, + SpvFPFastMathModeNotNaNMask = 0x00000001, + SpvFPFastMathModeNotInfMask = 0x00000002, + SpvFPFastMathModeNSZMask = 0x00000004, + SpvFPFastMathModeAllowRecipMask = 0x00000008, + SpvFPFastMathModeFastMask = 0x00000010, +} SpvFPFastMathModeMask; + +typedef enum SpvFPRoundingMode_ { + SpvFPRoundingModeRTE = 0, + SpvFPRoundingModeRTZ = 1, + SpvFPRoundingModeRTP = 2, + SpvFPRoundingModeRTN = 3, + SpvFPRoundingModeMax = 0x7fffffff, +} SpvFPRoundingMode; + +typedef enum SpvLinkageType_ { + SpvLinkageTypeExport = 0, + SpvLinkageTypeImport = 1, + SpvLinkageTypeMax = 0x7fffffff, +} SpvLinkageType; + +typedef enum SpvAccessQualifier_ { + SpvAccessQualifierReadOnly = 0, + SpvAccessQualifierWriteOnly = 1, + SpvAccessQualifierReadWrite = 2, + SpvAccessQualifierMax = 0x7fffffff, +} SpvAccessQualifier; + +typedef enum SpvFunctionParameterAttribute_ { + SpvFunctionParameterAttributeZext = 0, + SpvFunctionParameterAttributeSext = 1, + SpvFunctionParameterAttributeByVal = 2, + SpvFunctionParameterAttributeSret = 3, + SpvFunctionParameterAttributeNoAlias = 4, + SpvFunctionParameterAttributeNoCapture = 5, + SpvFunctionParameterAttributeNoWrite = 6, + SpvFunctionParameterAttributeNoReadWrite = 7, + SpvFunctionParameterAttributeMax = 0x7fffffff, +} SpvFunctionParameterAttribute; + +typedef enum SpvDecoration_ { + SpvDecorationRelaxedPrecision = 0, + SpvDecorationSpecId = 1, + SpvDecorationBlock = 2, + SpvDecorationBufferBlock = 3, + SpvDecorationRowMajor = 4, + SpvDecorationColMajor = 5, + SpvDecorationArrayStride = 6, + SpvDecorationMatrixStride = 7, + SpvDecorationGLSLShared = 8, + SpvDecorationGLSLPacked = 9, + SpvDecorationCPacked = 10, + SpvDecorationBuiltIn = 11, + SpvDecorationNoPerspective = 13, + SpvDecorationFlat = 14, + SpvDecorationPatch = 15, + SpvDecorationCentroid = 16, + SpvDecorationSample = 17, + SpvDecorationInvariant = 18, + SpvDecorationRestrict = 19, + SpvDecorationAliased = 20, + SpvDecorationVolatile = 21, + SpvDecorationConstant = 22, + SpvDecorationCoherent = 23, + SpvDecorationNonWritable = 24, + SpvDecorationNonReadable = 25, + SpvDecorationUniform = 26, + SpvDecorationSaturatedConversion = 28, + SpvDecorationStream = 29, + SpvDecorationLocation = 30, + SpvDecorationComponent = 31, + SpvDecorationIndex = 32, + SpvDecorationBinding = 33, + SpvDecorationDescriptorSet = 34, + SpvDecorationOffset = 35, + SpvDecorationXfbBuffer = 36, + SpvDecorationXfbStride = 37, + SpvDecorationFuncParamAttr = 38, + SpvDecorationFPRoundingMode = 39, + SpvDecorationFPFastMathMode = 40, + SpvDecorationLinkageAttributes = 41, + SpvDecorationNoContraction = 42, + SpvDecorationInputAttachmentIndex = 43, + SpvDecorationAlignment = 44, + SpvDecorationMaxByteOffset = 45, + SpvDecorationAlignmentId = 46, + SpvDecorationMaxByteOffsetId = 47, + SpvDecorationExplicitInterpAMD = 4999, + SpvDecorationOverrideCoverageNV = 5248, + SpvDecorationPassthroughNV = 5250, + SpvDecorationViewportRelativeNV = 5252, + SpvDecorationSecondaryViewportRelativeNV = 5256, + SpvDecorationNonUniformEXT = 5300, + SpvDecorationHlslCounterBufferGOOGLE = 5634, + SpvDecorationHlslSemanticGOOGLE = 5635, + SpvDecorationMax = 0x7fffffff, +} SpvDecoration; + +typedef enum SpvBuiltIn_ { + SpvBuiltInPosition = 0, + SpvBuiltInPointSize = 1, + SpvBuiltInClipDistance = 3, + SpvBuiltInCullDistance = 4, + SpvBuiltInVertexId = 5, + SpvBuiltInInstanceId = 6, + SpvBuiltInPrimitiveId = 7, + SpvBuiltInInvocationId = 8, + SpvBuiltInLayer = 9, + SpvBuiltInViewportIndex = 10, + SpvBuiltInTessLevelOuter = 11, + SpvBuiltInTessLevelInner = 12, + SpvBuiltInTessCoord = 13, + SpvBuiltInPatchVertices = 14, + SpvBuiltInFragCoord = 15, + SpvBuiltInPointCoord = 16, + SpvBuiltInFrontFacing = 17, + SpvBuiltInSampleId = 18, + SpvBuiltInSamplePosition = 19, + SpvBuiltInSampleMask = 20, + SpvBuiltInFragDepth = 22, + SpvBuiltInHelperInvocation = 23, + SpvBuiltInNumWorkgroups = 24, + SpvBuiltInWorkgroupSize = 25, + SpvBuiltInWorkgroupId = 26, + SpvBuiltInLocalInvocationId = 27, + SpvBuiltInGlobalInvocationId = 28, + SpvBuiltInLocalInvocationIndex = 29, + SpvBuiltInWorkDim = 30, + SpvBuiltInGlobalSize = 31, + SpvBuiltInEnqueuedWorkgroupSize = 32, + SpvBuiltInGlobalOffset = 33, + SpvBuiltInGlobalLinearId = 34, + SpvBuiltInSubgroupSize = 36, + SpvBuiltInSubgroupMaxSize = 37, + SpvBuiltInNumSubgroups = 38, + SpvBuiltInNumEnqueuedSubgroups = 39, + SpvBuiltInSubgroupId = 40, + SpvBuiltInSubgroupLocalInvocationId = 41, + SpvBuiltInVertexIndex = 42, + SpvBuiltInInstanceIndex = 43, + SpvBuiltInSubgroupEqMask = 4416, + SpvBuiltInSubgroupEqMaskKHR = 4416, + SpvBuiltInSubgroupGeMask = 4417, + SpvBuiltInSubgroupGeMaskKHR = 4417, + SpvBuiltInSubgroupGtMask = 4418, + SpvBuiltInSubgroupGtMaskKHR = 4418, + SpvBuiltInSubgroupLeMask = 4419, + SpvBuiltInSubgroupLeMaskKHR = 4419, + SpvBuiltInSubgroupLtMask = 4420, + SpvBuiltInSubgroupLtMaskKHR = 4420, + SpvBuiltInBaseVertex = 4424, + SpvBuiltInBaseInstance = 4425, + SpvBuiltInDrawIndex = 4426, + SpvBuiltInDeviceIndex = 4438, + SpvBuiltInViewIndex = 4440, + SpvBuiltInBaryCoordNoPerspAMD = 4992, + SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993, + SpvBuiltInBaryCoordNoPerspSampleAMD = 4994, + SpvBuiltInBaryCoordSmoothAMD = 4995, + SpvBuiltInBaryCoordSmoothCentroidAMD = 4996, + SpvBuiltInBaryCoordSmoothSampleAMD = 4997, + SpvBuiltInBaryCoordPullModelAMD = 4998, + SpvBuiltInFragStencilRefEXT = 5014, + SpvBuiltInViewportMaskNV = 5253, + SpvBuiltInSecondaryPositionNV = 5257, + SpvBuiltInSecondaryViewportMaskNV = 5258, + SpvBuiltInPositionPerViewNV = 5261, + SpvBuiltInViewportMaskPerViewNV = 5262, + SpvBuiltInFullyCoveredEXT = 5264, + SpvBuiltInMax = 0x7fffffff, +} SpvBuiltIn; + +typedef enum SpvSelectionControlShift_ { + SpvSelectionControlFlattenShift = 0, + SpvSelectionControlDontFlattenShift = 1, + SpvSelectionControlMax = 0x7fffffff, +} SpvSelectionControlShift; + +typedef enum SpvSelectionControlMask_ { + SpvSelectionControlMaskNone = 0, + SpvSelectionControlFlattenMask = 0x00000001, + SpvSelectionControlDontFlattenMask = 0x00000002, +} SpvSelectionControlMask; + +typedef enum SpvLoopControlShift_ { + SpvLoopControlUnrollShift = 0, + SpvLoopControlDontUnrollShift = 1, + SpvLoopControlDependencyInfiniteShift = 2, + SpvLoopControlDependencyLengthShift = 3, + SpvLoopControlMax = 0x7fffffff, +} SpvLoopControlShift; + +typedef enum SpvLoopControlMask_ { + SpvLoopControlMaskNone = 0, + SpvLoopControlUnrollMask = 0x00000001, + SpvLoopControlDontUnrollMask = 0x00000002, + SpvLoopControlDependencyInfiniteMask = 0x00000004, + SpvLoopControlDependencyLengthMask = 0x00000008, +} SpvLoopControlMask; + +typedef enum SpvFunctionControlShift_ { + SpvFunctionControlInlineShift = 0, + SpvFunctionControlDontInlineShift = 1, + SpvFunctionControlPureShift = 2, + SpvFunctionControlConstShift = 3, + SpvFunctionControlMax = 0x7fffffff, +} SpvFunctionControlShift; + +typedef enum SpvFunctionControlMask_ { + SpvFunctionControlMaskNone = 0, + SpvFunctionControlInlineMask = 0x00000001, + SpvFunctionControlDontInlineMask = 0x00000002, + SpvFunctionControlPureMask = 0x00000004, + SpvFunctionControlConstMask = 0x00000008, +} SpvFunctionControlMask; + +typedef enum SpvMemorySemanticsShift_ { + SpvMemorySemanticsAcquireShift = 1, + SpvMemorySemanticsReleaseShift = 2, + SpvMemorySemanticsAcquireReleaseShift = 3, + SpvMemorySemanticsSequentiallyConsistentShift = 4, + SpvMemorySemanticsUniformMemoryShift = 6, + SpvMemorySemanticsSubgroupMemoryShift = 7, + SpvMemorySemanticsWorkgroupMemoryShift = 8, + SpvMemorySemanticsCrossWorkgroupMemoryShift = 9, + SpvMemorySemanticsAtomicCounterMemoryShift = 10, + SpvMemorySemanticsImageMemoryShift = 11, + SpvMemorySemanticsMax = 0x7fffffff, +} SpvMemorySemanticsShift; + +typedef enum SpvMemorySemanticsMask_ { + SpvMemorySemanticsMaskNone = 0, + SpvMemorySemanticsAcquireMask = 0x00000002, + SpvMemorySemanticsReleaseMask = 0x00000004, + SpvMemorySemanticsAcquireReleaseMask = 0x00000008, + SpvMemorySemanticsSequentiallyConsistentMask = 0x00000010, + SpvMemorySemanticsUniformMemoryMask = 0x00000040, + SpvMemorySemanticsSubgroupMemoryMask = 0x00000080, + SpvMemorySemanticsWorkgroupMemoryMask = 0x00000100, + SpvMemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000400, + SpvMemorySemanticsImageMemoryMask = 0x00000800, +} SpvMemorySemanticsMask; + +typedef enum SpvMemoryAccessShift_ { + SpvMemoryAccessVolatileShift = 0, + SpvMemoryAccessAlignedShift = 1, + SpvMemoryAccessNontemporalShift = 2, + SpvMemoryAccessMax = 0x7fffffff, +} SpvMemoryAccessShift; + +typedef enum SpvMemoryAccessMask_ { + SpvMemoryAccessMaskNone = 0, + SpvMemoryAccessVolatileMask = 0x00000001, + SpvMemoryAccessAlignedMask = 0x00000002, + SpvMemoryAccessNontemporalMask = 0x00000004, +} SpvMemoryAccessMask; + +typedef enum SpvScope_ { + SpvScopeCrossDevice = 0, + SpvScopeDevice = 1, + SpvScopeWorkgroup = 2, + SpvScopeSubgroup = 3, + SpvScopeInvocation = 4, + SpvScopeMax = 0x7fffffff, +} SpvScope; + +typedef enum SpvGroupOperation_ { + SpvGroupOperationReduce = 0, + SpvGroupOperationInclusiveScan = 1, + SpvGroupOperationExclusiveScan = 2, + SpvGroupOperationClusteredReduce = 3, + SpvGroupOperationPartitionedReduceNV = 6, + SpvGroupOperationPartitionedInclusiveScanNV = 7, + SpvGroupOperationPartitionedExclusiveScanNV = 8, + SpvGroupOperationMax = 0x7fffffff, +} SpvGroupOperation; + +typedef enum SpvKernelEnqueueFlags_ { + SpvKernelEnqueueFlagsNoWait = 0, + SpvKernelEnqueueFlagsWaitKernel = 1, + SpvKernelEnqueueFlagsWaitWorkGroup = 2, + SpvKernelEnqueueFlagsMax = 0x7fffffff, +} SpvKernelEnqueueFlags; + +typedef enum SpvKernelProfilingInfoShift_ { + SpvKernelProfilingInfoCmdExecTimeShift = 0, + SpvKernelProfilingInfoMax = 0x7fffffff, +} SpvKernelProfilingInfoShift; + +typedef enum SpvKernelProfilingInfoMask_ { + SpvKernelProfilingInfoMaskNone = 0, + SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001, +} SpvKernelProfilingInfoMask; + +typedef enum SpvCapability_ { + SpvCapabilityMatrix = 0, + SpvCapabilityShader = 1, + SpvCapabilityGeometry = 2, + SpvCapabilityTessellation = 3, + SpvCapabilityAddresses = 4, + SpvCapabilityLinkage = 5, + SpvCapabilityKernel = 6, + SpvCapabilityVector16 = 7, + SpvCapabilityFloat16Buffer = 8, + SpvCapabilityFloat16 = 9, + SpvCapabilityFloat64 = 10, + SpvCapabilityInt64 = 11, + SpvCapabilityInt64Atomics = 12, + SpvCapabilityImageBasic = 13, + SpvCapabilityImageReadWrite = 14, + SpvCapabilityImageMipmap = 15, + SpvCapabilityPipes = 17, + SpvCapabilityGroups = 18, + SpvCapabilityDeviceEnqueue = 19, + SpvCapabilityLiteralSampler = 20, + SpvCapabilityAtomicStorage = 21, + SpvCapabilityInt16 = 22, + SpvCapabilityTessellationPointSize = 23, + SpvCapabilityGeometryPointSize = 24, + SpvCapabilityImageGatherExtended = 25, + SpvCapabilityStorageImageMultisample = 27, + SpvCapabilityUniformBufferArrayDynamicIndexing = 28, + SpvCapabilitySampledImageArrayDynamicIndexing = 29, + SpvCapabilityStorageBufferArrayDynamicIndexing = 30, + SpvCapabilityStorageImageArrayDynamicIndexing = 31, + SpvCapabilityClipDistance = 32, + SpvCapabilityCullDistance = 33, + SpvCapabilityImageCubeArray = 34, + SpvCapabilitySampleRateShading = 35, + SpvCapabilityImageRect = 36, + SpvCapabilitySampledRect = 37, + SpvCapabilityGenericPointer = 38, + SpvCapabilityInt8 = 39, + SpvCapabilityInputAttachment = 40, + SpvCapabilitySparseResidency = 41, + SpvCapabilityMinLod = 42, + SpvCapabilitySampled1D = 43, + SpvCapabilityImage1D = 44, + SpvCapabilitySampledCubeArray = 45, + SpvCapabilitySampledBuffer = 46, + SpvCapabilityImageBuffer = 47, + SpvCapabilityImageMSArray = 48, + SpvCapabilityStorageImageExtendedFormats = 49, + SpvCapabilityImageQuery = 50, + SpvCapabilityDerivativeControl = 51, + SpvCapabilityInterpolationFunction = 52, + SpvCapabilityTransformFeedback = 53, + SpvCapabilityGeometryStreams = 54, + SpvCapabilityStorageImageReadWithoutFormat = 55, + SpvCapabilityStorageImageWriteWithoutFormat = 56, + SpvCapabilityMultiViewport = 57, + SpvCapabilitySubgroupDispatch = 58, + SpvCapabilityNamedBarrier = 59, + SpvCapabilityPipeStorage = 60, + SpvCapabilityGroupNonUniform = 61, + SpvCapabilityGroupNonUniformVote = 62, + SpvCapabilityGroupNonUniformArithmetic = 63, + SpvCapabilityGroupNonUniformBallot = 64, + SpvCapabilityGroupNonUniformShuffle = 65, + SpvCapabilityGroupNonUniformShuffleRelative = 66, + SpvCapabilityGroupNonUniformClustered = 67, + SpvCapabilityGroupNonUniformQuad = 68, + SpvCapabilitySubgroupBallotKHR = 4423, + SpvCapabilityDrawParameters = 4427, + SpvCapabilitySubgroupVoteKHR = 4431, + SpvCapabilityStorageBuffer16BitAccess = 4433, + SpvCapabilityStorageUniformBufferBlock16 = 4433, + SpvCapabilityStorageUniform16 = 4434, + SpvCapabilityUniformAndStorageBuffer16BitAccess = 4434, + SpvCapabilityStoragePushConstant16 = 4435, + SpvCapabilityStorageInputOutput16 = 4436, + SpvCapabilityDeviceGroup = 4437, + SpvCapabilityMultiView = 4439, + SpvCapabilityVariablePointersStorageBuffer = 4441, + SpvCapabilityVariablePointers = 4442, + SpvCapabilityAtomicStorageOps = 4445, + SpvCapabilitySampleMaskPostDepthCoverage = 4447, + SpvCapabilityStorageBuffer8BitAccess = 4448, + SpvCapabilityUniformAndStorageBuffer8BitAccess = 4449, + SpvCapabilityStoragePushConstant8 = 4450, + SpvCapabilityFloat16ImageAMD = 5008, + SpvCapabilityImageGatherBiasLodAMD = 5009, + SpvCapabilityFragmentMaskAMD = 5010, + SpvCapabilityStencilExportEXT = 5013, + SpvCapabilityImageReadWriteLodAMD = 5015, + SpvCapabilitySampleMaskOverrideCoverageNV = 5249, + SpvCapabilityGeometryShaderPassthroughNV = 5251, + SpvCapabilityShaderViewportIndexLayerEXT = 5254, + SpvCapabilityShaderViewportIndexLayerNV = 5254, + SpvCapabilityShaderViewportMaskNV = 5255, + SpvCapabilityShaderStereoViewNV = 5259, + SpvCapabilityPerViewAttributesNV = 5260, + SpvCapabilityFragmentFullyCoveredEXT = 5265, + SpvCapabilityGroupNonUniformPartitionedNV = 5297, + SpvCapabilityShaderNonUniformEXT = 5301, + SpvCapabilityRuntimeDescriptorArrayEXT = 5302, + SpvCapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, + SpvCapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, + SpvCapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, + SpvCapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, + SpvCapabilitySampledImageArrayNonUniformIndexingEXT = 5307, + SpvCapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, + SpvCapabilityStorageImageArrayNonUniformIndexingEXT = 5309, + SpvCapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, + SpvCapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, + SpvCapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, + SpvCapabilitySubgroupShuffleINTEL = 5568, + SpvCapabilitySubgroupBufferBlockIOINTEL = 5569, + SpvCapabilitySubgroupImageBlockIOINTEL = 5570, + SpvCapabilityMax = 0x7fffffff, +} SpvCapability; + +typedef enum SpvOp_ { + SpvOpNop = 0, + SpvOpUndef = 1, + SpvOpSourceContinued = 2, + SpvOpSource = 3, + SpvOpSourceExtension = 4, + SpvOpName = 5, + SpvOpMemberName = 6, + SpvOpString = 7, + SpvOpLine = 8, + SpvOpExtension = 10, + SpvOpExtInstImport = 11, + SpvOpExtInst = 12, + SpvOpMemoryModel = 14, + SpvOpEntryPoint = 15, + SpvOpExecutionMode = 16, + SpvOpCapability = 17, + SpvOpTypeVoid = 19, + SpvOpTypeBool = 20, + SpvOpTypeInt = 21, + SpvOpTypeFloat = 22, + SpvOpTypeVector = 23, + SpvOpTypeMatrix = 24, + SpvOpTypeImage = 25, + SpvOpTypeSampler = 26, + SpvOpTypeSampledImage = 27, + SpvOpTypeArray = 28, + SpvOpTypeRuntimeArray = 29, + SpvOpTypeStruct = 30, + SpvOpTypeOpaque = 31, + SpvOpTypePointer = 32, + SpvOpTypeFunction = 33, + SpvOpTypeEvent = 34, + SpvOpTypeDeviceEvent = 35, + SpvOpTypeReserveId = 36, + SpvOpTypeQueue = 37, + SpvOpTypePipe = 38, + SpvOpTypeForwardPointer = 39, + SpvOpConstantTrue = 41, + SpvOpConstantFalse = 42, + SpvOpConstant = 43, + SpvOpConstantComposite = 44, + SpvOpConstantSampler = 45, + SpvOpConstantNull = 46, + SpvOpSpecConstantTrue = 48, + SpvOpSpecConstantFalse = 49, + SpvOpSpecConstant = 50, + SpvOpSpecConstantComposite = 51, + SpvOpSpecConstantOp = 52, + SpvOpFunction = 54, + SpvOpFunctionParameter = 55, + SpvOpFunctionEnd = 56, + SpvOpFunctionCall = 57, + SpvOpVariable = 59, + SpvOpImageTexelPointer = 60, + SpvOpLoad = 61, + SpvOpStore = 62, + SpvOpCopyMemory = 63, + SpvOpCopyMemorySized = 64, + SpvOpAccessChain = 65, + SpvOpInBoundsAccessChain = 66, + SpvOpPtrAccessChain = 67, + SpvOpArrayLength = 68, + SpvOpGenericPtrMemSemantics = 69, + SpvOpInBoundsPtrAccessChain = 70, + SpvOpDecorate = 71, + SpvOpMemberDecorate = 72, + SpvOpDecorationGroup = 73, + SpvOpGroupDecorate = 74, + SpvOpGroupMemberDecorate = 75, + SpvOpVectorExtractDynamic = 77, + SpvOpVectorInsertDynamic = 78, + SpvOpVectorShuffle = 79, + SpvOpCompositeConstruct = 80, + SpvOpCompositeExtract = 81, + SpvOpCompositeInsert = 82, + SpvOpCopyObject = 83, + SpvOpTranspose = 84, + SpvOpSampledImage = 86, + SpvOpImageSampleImplicitLod = 87, + SpvOpImageSampleExplicitLod = 88, + SpvOpImageSampleDrefImplicitLod = 89, + SpvOpImageSampleDrefExplicitLod = 90, + SpvOpImageSampleProjImplicitLod = 91, + SpvOpImageSampleProjExplicitLod = 92, + SpvOpImageSampleProjDrefImplicitLod = 93, + SpvOpImageSampleProjDrefExplicitLod = 94, + SpvOpImageFetch = 95, + SpvOpImageGather = 96, + SpvOpImageDrefGather = 97, + SpvOpImageRead = 98, + SpvOpImageWrite = 99, + SpvOpImage = 100, + SpvOpImageQueryFormat = 101, + SpvOpImageQueryOrder = 102, + SpvOpImageQuerySizeLod = 103, + SpvOpImageQuerySize = 104, + SpvOpImageQueryLod = 105, + SpvOpImageQueryLevels = 106, + SpvOpImageQuerySamples = 107, + SpvOpConvertFToU = 109, + SpvOpConvertFToS = 110, + SpvOpConvertSToF = 111, + SpvOpConvertUToF = 112, + SpvOpUConvert = 113, + SpvOpSConvert = 114, + SpvOpFConvert = 115, + SpvOpQuantizeToF16 = 116, + SpvOpConvertPtrToU = 117, + SpvOpSatConvertSToU = 118, + SpvOpSatConvertUToS = 119, + SpvOpConvertUToPtr = 120, + SpvOpPtrCastToGeneric = 121, + SpvOpGenericCastToPtr = 122, + SpvOpGenericCastToPtrExplicit = 123, + SpvOpBitcast = 124, + SpvOpSNegate = 126, + SpvOpFNegate = 127, + SpvOpIAdd = 128, + SpvOpFAdd = 129, + SpvOpISub = 130, + SpvOpFSub = 131, + SpvOpIMul = 132, + SpvOpFMul = 133, + SpvOpUDiv = 134, + SpvOpSDiv = 135, + SpvOpFDiv = 136, + SpvOpUMod = 137, + SpvOpSRem = 138, + SpvOpSMod = 139, + SpvOpFRem = 140, + SpvOpFMod = 141, + SpvOpVectorTimesScalar = 142, + SpvOpMatrixTimesScalar = 143, + SpvOpVectorTimesMatrix = 144, + SpvOpMatrixTimesVector = 145, + SpvOpMatrixTimesMatrix = 146, + SpvOpOuterProduct = 147, + SpvOpDot = 148, + SpvOpIAddCarry = 149, + SpvOpISubBorrow = 150, + SpvOpUMulExtended = 151, + SpvOpSMulExtended = 152, + SpvOpAny = 154, + SpvOpAll = 155, + SpvOpIsNan = 156, + SpvOpIsInf = 157, + SpvOpIsFinite = 158, + SpvOpIsNormal = 159, + SpvOpSignBitSet = 160, + SpvOpLessOrGreater = 161, + SpvOpOrdered = 162, + SpvOpUnordered = 163, + SpvOpLogicalEqual = 164, + SpvOpLogicalNotEqual = 165, + SpvOpLogicalOr = 166, + SpvOpLogicalAnd = 167, + SpvOpLogicalNot = 168, + SpvOpSelect = 169, + SpvOpIEqual = 170, + SpvOpINotEqual = 171, + SpvOpUGreaterThan = 172, + SpvOpSGreaterThan = 173, + SpvOpUGreaterThanEqual = 174, + SpvOpSGreaterThanEqual = 175, + SpvOpULessThan = 176, + SpvOpSLessThan = 177, + SpvOpULessThanEqual = 178, + SpvOpSLessThanEqual = 179, + SpvOpFOrdEqual = 180, + SpvOpFUnordEqual = 181, + SpvOpFOrdNotEqual = 182, + SpvOpFUnordNotEqual = 183, + SpvOpFOrdLessThan = 184, + SpvOpFUnordLessThan = 185, + SpvOpFOrdGreaterThan = 186, + SpvOpFUnordGreaterThan = 187, + SpvOpFOrdLessThanEqual = 188, + SpvOpFUnordLessThanEqual = 189, + SpvOpFOrdGreaterThanEqual = 190, + SpvOpFUnordGreaterThanEqual = 191, + SpvOpShiftRightLogical = 194, + SpvOpShiftRightArithmetic = 195, + SpvOpShiftLeftLogical = 196, + SpvOpBitwiseOr = 197, + SpvOpBitwiseXor = 198, + SpvOpBitwiseAnd = 199, + SpvOpNot = 200, + SpvOpBitFieldInsert = 201, + SpvOpBitFieldSExtract = 202, + SpvOpBitFieldUExtract = 203, + SpvOpBitReverse = 204, + SpvOpBitCount = 205, + SpvOpDPdx = 207, + SpvOpDPdy = 208, + SpvOpFwidth = 209, + SpvOpDPdxFine = 210, + SpvOpDPdyFine = 211, + SpvOpFwidthFine = 212, + SpvOpDPdxCoarse = 213, + SpvOpDPdyCoarse = 214, + SpvOpFwidthCoarse = 215, + SpvOpEmitVertex = 218, + SpvOpEndPrimitive = 219, + SpvOpEmitStreamVertex = 220, + SpvOpEndStreamPrimitive = 221, + SpvOpControlBarrier = 224, + SpvOpMemoryBarrier = 225, + SpvOpAtomicLoad = 227, + SpvOpAtomicStore = 228, + SpvOpAtomicExchange = 229, + SpvOpAtomicCompareExchange = 230, + SpvOpAtomicCompareExchangeWeak = 231, + SpvOpAtomicIIncrement = 232, + SpvOpAtomicIDecrement = 233, + SpvOpAtomicIAdd = 234, + SpvOpAtomicISub = 235, + SpvOpAtomicSMin = 236, + SpvOpAtomicUMin = 237, + SpvOpAtomicSMax = 238, + SpvOpAtomicUMax = 239, + SpvOpAtomicAnd = 240, + SpvOpAtomicOr = 241, + SpvOpAtomicXor = 242, + SpvOpPhi = 245, + SpvOpLoopMerge = 246, + SpvOpSelectionMerge = 247, + SpvOpLabel = 248, + SpvOpBranch = 249, + SpvOpBranchConditional = 250, + SpvOpSwitch = 251, + SpvOpKill = 252, + SpvOpReturn = 253, + SpvOpReturnValue = 254, + SpvOpUnreachable = 255, + SpvOpLifetimeStart = 256, + SpvOpLifetimeStop = 257, + SpvOpGroupAsyncCopy = 259, + SpvOpGroupWaitEvents = 260, + SpvOpGroupAll = 261, + SpvOpGroupAny = 262, + SpvOpGroupBroadcast = 263, + SpvOpGroupIAdd = 264, + SpvOpGroupFAdd = 265, + SpvOpGroupFMin = 266, + SpvOpGroupUMin = 267, + SpvOpGroupSMin = 268, + SpvOpGroupFMax = 269, + SpvOpGroupUMax = 270, + SpvOpGroupSMax = 271, + SpvOpReadPipe = 274, + SpvOpWritePipe = 275, + SpvOpReservedReadPipe = 276, + SpvOpReservedWritePipe = 277, + SpvOpReserveReadPipePackets = 278, + SpvOpReserveWritePipePackets = 279, + SpvOpCommitReadPipe = 280, + SpvOpCommitWritePipe = 281, + SpvOpIsValidReserveId = 282, + SpvOpGetNumPipePackets = 283, + SpvOpGetMaxPipePackets = 284, + SpvOpGroupReserveReadPipePackets = 285, + SpvOpGroupReserveWritePipePackets = 286, + SpvOpGroupCommitReadPipe = 287, + SpvOpGroupCommitWritePipe = 288, + SpvOpEnqueueMarker = 291, + SpvOpEnqueueKernel = 292, + SpvOpGetKernelNDrangeSubGroupCount = 293, + SpvOpGetKernelNDrangeMaxSubGroupSize = 294, + SpvOpGetKernelWorkGroupSize = 295, + SpvOpGetKernelPreferredWorkGroupSizeMultiple = 296, + SpvOpRetainEvent = 297, + SpvOpReleaseEvent = 298, + SpvOpCreateUserEvent = 299, + SpvOpIsValidEvent = 300, + SpvOpSetUserEventStatus = 301, + SpvOpCaptureEventProfilingInfo = 302, + SpvOpGetDefaultQueue = 303, + SpvOpBuildNDRange = 304, + SpvOpImageSparseSampleImplicitLod = 305, + SpvOpImageSparseSampleExplicitLod = 306, + SpvOpImageSparseSampleDrefImplicitLod = 307, + SpvOpImageSparseSampleDrefExplicitLod = 308, + SpvOpImageSparseSampleProjImplicitLod = 309, + SpvOpImageSparseSampleProjExplicitLod = 310, + SpvOpImageSparseSampleProjDrefImplicitLod = 311, + SpvOpImageSparseSampleProjDrefExplicitLod = 312, + SpvOpImageSparseFetch = 313, + SpvOpImageSparseGather = 314, + SpvOpImageSparseDrefGather = 315, + SpvOpImageSparseTexelsResident = 316, + SpvOpNoLine = 317, + SpvOpAtomicFlagTestAndSet = 318, + SpvOpAtomicFlagClear = 319, + SpvOpImageSparseRead = 320, + SpvOpSizeOf = 321, + SpvOpTypePipeStorage = 322, + SpvOpConstantPipeStorage = 323, + SpvOpCreatePipeFromPipeStorage = 324, + SpvOpGetKernelLocalSizeForSubgroupCount = 325, + SpvOpGetKernelMaxNumSubgroups = 326, + SpvOpTypeNamedBarrier = 327, + SpvOpNamedBarrierInitialize = 328, + SpvOpMemoryNamedBarrier = 329, + SpvOpModuleProcessed = 330, + SpvOpExecutionModeId = 331, + SpvOpDecorateId = 332, + SpvOpGroupNonUniformElect = 333, + SpvOpGroupNonUniformAll = 334, + SpvOpGroupNonUniformAny = 335, + SpvOpGroupNonUniformAllEqual = 336, + SpvOpGroupNonUniformBroadcast = 337, + SpvOpGroupNonUniformBroadcastFirst = 338, + SpvOpGroupNonUniformBallot = 339, + SpvOpGroupNonUniformInverseBallot = 340, + SpvOpGroupNonUniformBallotBitExtract = 341, + SpvOpGroupNonUniformBallotBitCount = 342, + SpvOpGroupNonUniformBallotFindLSB = 343, + SpvOpGroupNonUniformBallotFindMSB = 344, + SpvOpGroupNonUniformShuffle = 345, + SpvOpGroupNonUniformShuffleXor = 346, + SpvOpGroupNonUniformShuffleUp = 347, + SpvOpGroupNonUniformShuffleDown = 348, + SpvOpGroupNonUniformIAdd = 349, + SpvOpGroupNonUniformFAdd = 350, + SpvOpGroupNonUniformIMul = 351, + SpvOpGroupNonUniformFMul = 352, + SpvOpGroupNonUniformSMin = 353, + SpvOpGroupNonUniformUMin = 354, + SpvOpGroupNonUniformFMin = 355, + SpvOpGroupNonUniformSMax = 356, + SpvOpGroupNonUniformUMax = 357, + SpvOpGroupNonUniformFMax = 358, + SpvOpGroupNonUniformBitwiseAnd = 359, + SpvOpGroupNonUniformBitwiseOr = 360, + SpvOpGroupNonUniformBitwiseXor = 361, + SpvOpGroupNonUniformLogicalAnd = 362, + SpvOpGroupNonUniformLogicalOr = 363, + SpvOpGroupNonUniformLogicalXor = 364, + SpvOpGroupNonUniformQuadBroadcast = 365, + SpvOpGroupNonUniformQuadSwap = 366, + SpvOpSubgroupBallotKHR = 4421, + SpvOpSubgroupFirstInvocationKHR = 4422, + SpvOpSubgroupAllKHR = 4428, + SpvOpSubgroupAnyKHR = 4429, + SpvOpSubgroupAllEqualKHR = 4430, + SpvOpSubgroupReadInvocationKHR = 4432, + SpvOpGroupIAddNonUniformAMD = 5000, + SpvOpGroupFAddNonUniformAMD = 5001, + SpvOpGroupFMinNonUniformAMD = 5002, + SpvOpGroupUMinNonUniformAMD = 5003, + SpvOpGroupSMinNonUniformAMD = 5004, + SpvOpGroupFMaxNonUniformAMD = 5005, + SpvOpGroupUMaxNonUniformAMD = 5006, + SpvOpGroupSMaxNonUniformAMD = 5007, + SpvOpFragmentMaskFetchAMD = 5011, + SpvOpFragmentFetchAMD = 5012, + SpvOpGroupNonUniformPartitionNV = 5296, + SpvOpSubgroupShuffleINTEL = 5571, + SpvOpSubgroupShuffleDownINTEL = 5572, + SpvOpSubgroupShuffleUpINTEL = 5573, + SpvOpSubgroupShuffleXorINTEL = 5574, + SpvOpSubgroupBlockReadINTEL = 5575, + SpvOpSubgroupBlockWriteINTEL = 5576, + SpvOpSubgroupImageBlockReadINTEL = 5577, + SpvOpSubgroupImageBlockWriteINTEL = 5578, + SpvOpDecorateStringGOOGLE = 5632, + SpvOpMemberDecorateStringGOOGLE = 5633, + SpvOpMax = 0x7fffffff, +} SpvOp; + +#endif // #ifndef spirv_H + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.hpp new file mode 100644 index 00000000000..f16c2963eb3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.hpp @@ -0,0 +1,1102 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10300 +#define SPV_REVISION 1 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010300; +static const unsigned int Revision = 1; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum SourceLanguage { + SourceLanguageUnknown = 0, + SourceLanguageESSL = 1, + SourceLanguageGLSL = 2, + SourceLanguageOpenCL_C = 3, + SourceLanguageOpenCL_CPP = 4, + SourceLanguageHLSL = 5, + SourceLanguageMax = 0x7fffffff, +}; + +enum ExecutionModel { + ExecutionModelVertex = 0, + ExecutionModelTessellationControl = 1, + ExecutionModelTessellationEvaluation = 2, + ExecutionModelGeometry = 3, + ExecutionModelFragment = 4, + ExecutionModelGLCompute = 5, + ExecutionModelKernel = 6, + ExecutionModelMax = 0x7fffffff, +}; + +enum AddressingModel { + AddressingModelLogical = 0, + AddressingModelPhysical32 = 1, + AddressingModelPhysical64 = 2, + AddressingModelMax = 0x7fffffff, +}; + +enum MemoryModel { + MemoryModelSimple = 0, + MemoryModelGLSL450 = 1, + MemoryModelOpenCL = 2, + MemoryModelMax = 0x7fffffff, +}; + +enum ExecutionMode { + ExecutionModeInvocations = 0, + ExecutionModeSpacingEqual = 1, + ExecutionModeSpacingFractionalEven = 2, + ExecutionModeSpacingFractionalOdd = 3, + ExecutionModeVertexOrderCw = 4, + ExecutionModeVertexOrderCcw = 5, + ExecutionModePixelCenterInteger = 6, + ExecutionModeOriginUpperLeft = 7, + ExecutionModeOriginLowerLeft = 8, + ExecutionModeEarlyFragmentTests = 9, + ExecutionModePointMode = 10, + ExecutionModeXfb = 11, + ExecutionModeDepthReplacing = 12, + ExecutionModeDepthGreater = 14, + ExecutionModeDepthLess = 15, + ExecutionModeDepthUnchanged = 16, + ExecutionModeLocalSize = 17, + ExecutionModeLocalSizeHint = 18, + ExecutionModeInputPoints = 19, + ExecutionModeInputLines = 20, + ExecutionModeInputLinesAdjacency = 21, + ExecutionModeTriangles = 22, + ExecutionModeInputTrianglesAdjacency = 23, + ExecutionModeQuads = 24, + ExecutionModeIsolines = 25, + ExecutionModeOutputVertices = 26, + ExecutionModeOutputPoints = 27, + ExecutionModeOutputLineStrip = 28, + ExecutionModeOutputTriangleStrip = 29, + ExecutionModeVecTypeHint = 30, + ExecutionModeContractionOff = 31, + ExecutionModeInitializer = 33, + ExecutionModeFinalizer = 34, + ExecutionModeSubgroupSize = 35, + ExecutionModeSubgroupsPerWorkgroup = 36, + ExecutionModeSubgroupsPerWorkgroupId = 37, + ExecutionModeLocalSizeId = 38, + ExecutionModeLocalSizeHintId = 39, + ExecutionModePostDepthCoverage = 4446, + ExecutionModeStencilRefReplacingEXT = 5027, + ExecutionModeMax = 0x7fffffff, +}; + +enum StorageClass { + StorageClassUniformConstant = 0, + StorageClassInput = 1, + StorageClassUniform = 2, + StorageClassOutput = 3, + StorageClassWorkgroup = 4, + StorageClassCrossWorkgroup = 5, + StorageClassPrivate = 6, + StorageClassFunction = 7, + StorageClassGeneric = 8, + StorageClassPushConstant = 9, + StorageClassAtomicCounter = 10, + StorageClassImage = 11, + StorageClassStorageBuffer = 12, + StorageClassMax = 0x7fffffff, +}; + +enum Dim { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + DimCube = 3, + DimRect = 4, + DimBuffer = 5, + DimSubpassData = 6, + DimMax = 0x7fffffff, +}; + +enum SamplerAddressingMode { + SamplerAddressingModeNone = 0, + SamplerAddressingModeClampToEdge = 1, + SamplerAddressingModeClamp = 2, + SamplerAddressingModeRepeat = 3, + SamplerAddressingModeRepeatMirrored = 4, + SamplerAddressingModeMax = 0x7fffffff, +}; + +enum SamplerFilterMode { + SamplerFilterModeNearest = 0, + SamplerFilterModeLinear = 1, + SamplerFilterModeMax = 0x7fffffff, +}; + +enum ImageFormat { + ImageFormatUnknown = 0, + ImageFormatRgba32f = 1, + ImageFormatRgba16f = 2, + ImageFormatR32f = 3, + ImageFormatRgba8 = 4, + ImageFormatRgba8Snorm = 5, + ImageFormatRg32f = 6, + ImageFormatRg16f = 7, + ImageFormatR11fG11fB10f = 8, + ImageFormatR16f = 9, + ImageFormatRgba16 = 10, + ImageFormatRgb10A2 = 11, + ImageFormatRg16 = 12, + ImageFormatRg8 = 13, + ImageFormatR16 = 14, + ImageFormatR8 = 15, + ImageFormatRgba16Snorm = 16, + ImageFormatRg16Snorm = 17, + ImageFormatRg8Snorm = 18, + ImageFormatR16Snorm = 19, + ImageFormatR8Snorm = 20, + ImageFormatRgba32i = 21, + ImageFormatRgba16i = 22, + ImageFormatRgba8i = 23, + ImageFormatR32i = 24, + ImageFormatRg32i = 25, + ImageFormatRg16i = 26, + ImageFormatRg8i = 27, + ImageFormatR16i = 28, + ImageFormatR8i = 29, + ImageFormatRgba32ui = 30, + ImageFormatRgba16ui = 31, + ImageFormatRgba8ui = 32, + ImageFormatR32ui = 33, + ImageFormatRgb10a2ui = 34, + ImageFormatRg32ui = 35, + ImageFormatRg16ui = 36, + ImageFormatRg8ui = 37, + ImageFormatR16ui = 38, + ImageFormatR8ui = 39, + ImageFormatMax = 0x7fffffff, +}; + +enum ImageChannelOrder { + ImageChannelOrderR = 0, + ImageChannelOrderA = 1, + ImageChannelOrderRG = 2, + ImageChannelOrderRA = 3, + ImageChannelOrderRGB = 4, + ImageChannelOrderRGBA = 5, + ImageChannelOrderBGRA = 6, + ImageChannelOrderARGB = 7, + ImageChannelOrderIntensity = 8, + ImageChannelOrderLuminance = 9, + ImageChannelOrderRx = 10, + ImageChannelOrderRGx = 11, + ImageChannelOrderRGBx = 12, + ImageChannelOrderDepth = 13, + ImageChannelOrderDepthStencil = 14, + ImageChannelOrdersRGB = 15, + ImageChannelOrdersRGBx = 16, + ImageChannelOrdersRGBA = 17, + ImageChannelOrdersBGRA = 18, + ImageChannelOrderABGR = 19, + ImageChannelOrderMax = 0x7fffffff, +}; + +enum ImageChannelDataType { + ImageChannelDataTypeSnormInt8 = 0, + ImageChannelDataTypeSnormInt16 = 1, + ImageChannelDataTypeUnormInt8 = 2, + ImageChannelDataTypeUnormInt16 = 3, + ImageChannelDataTypeUnormShort565 = 4, + ImageChannelDataTypeUnormShort555 = 5, + ImageChannelDataTypeUnormInt101010 = 6, + ImageChannelDataTypeSignedInt8 = 7, + ImageChannelDataTypeSignedInt16 = 8, + ImageChannelDataTypeSignedInt32 = 9, + ImageChannelDataTypeUnsignedInt8 = 10, + ImageChannelDataTypeUnsignedInt16 = 11, + ImageChannelDataTypeUnsignedInt32 = 12, + ImageChannelDataTypeHalfFloat = 13, + ImageChannelDataTypeFloat = 14, + ImageChannelDataTypeUnormInt24 = 15, + ImageChannelDataTypeUnormInt101010_2 = 16, + ImageChannelDataTypeMax = 0x7fffffff, +}; + +enum ImageOperandsShift { + ImageOperandsBiasShift = 0, + ImageOperandsLodShift = 1, + ImageOperandsGradShift = 2, + ImageOperandsConstOffsetShift = 3, + ImageOperandsOffsetShift = 4, + ImageOperandsConstOffsetsShift = 5, + ImageOperandsSampleShift = 6, + ImageOperandsMinLodShift = 7, + ImageOperandsMax = 0x7fffffff, +}; + +enum ImageOperandsMask { + ImageOperandsMaskNone = 0, + ImageOperandsBiasMask = 0x00000001, + ImageOperandsLodMask = 0x00000002, + ImageOperandsGradMask = 0x00000004, + ImageOperandsConstOffsetMask = 0x00000008, + ImageOperandsOffsetMask = 0x00000010, + ImageOperandsConstOffsetsMask = 0x00000020, + ImageOperandsSampleMask = 0x00000040, + ImageOperandsMinLodMask = 0x00000080, +}; + +enum FPFastMathModeShift { + FPFastMathModeNotNaNShift = 0, + FPFastMathModeNotInfShift = 1, + FPFastMathModeNSZShift = 2, + FPFastMathModeAllowRecipShift = 3, + FPFastMathModeFastShift = 4, + FPFastMathModeMax = 0x7fffffff, +}; + +enum FPFastMathModeMask { + FPFastMathModeMaskNone = 0, + FPFastMathModeNotNaNMask = 0x00000001, + FPFastMathModeNotInfMask = 0x00000002, + FPFastMathModeNSZMask = 0x00000004, + FPFastMathModeAllowRecipMask = 0x00000008, + FPFastMathModeFastMask = 0x00000010, +}; + +enum FPRoundingMode { + FPRoundingModeRTE = 0, + FPRoundingModeRTZ = 1, + FPRoundingModeRTP = 2, + FPRoundingModeRTN = 3, + FPRoundingModeMax = 0x7fffffff, +}; + +enum LinkageType { + LinkageTypeExport = 0, + LinkageTypeImport = 1, + LinkageTypeMax = 0x7fffffff, +}; + +enum AccessQualifier { + AccessQualifierReadOnly = 0, + AccessQualifierWriteOnly = 1, + AccessQualifierReadWrite = 2, + AccessQualifierMax = 0x7fffffff, +}; + +enum FunctionParameterAttribute { + FunctionParameterAttributeZext = 0, + FunctionParameterAttributeSext = 1, + FunctionParameterAttributeByVal = 2, + FunctionParameterAttributeSret = 3, + FunctionParameterAttributeNoAlias = 4, + FunctionParameterAttributeNoCapture = 5, + FunctionParameterAttributeNoWrite = 6, + FunctionParameterAttributeNoReadWrite = 7, + FunctionParameterAttributeMax = 0x7fffffff, +}; + +enum Decoration { + DecorationRelaxedPrecision = 0, + DecorationSpecId = 1, + DecorationBlock = 2, + DecorationBufferBlock = 3, + DecorationRowMajor = 4, + DecorationColMajor = 5, + DecorationArrayStride = 6, + DecorationMatrixStride = 7, + DecorationGLSLShared = 8, + DecorationGLSLPacked = 9, + DecorationCPacked = 10, + DecorationBuiltIn = 11, + DecorationNoPerspective = 13, + DecorationFlat = 14, + DecorationPatch = 15, + DecorationCentroid = 16, + DecorationSample = 17, + DecorationInvariant = 18, + DecorationRestrict = 19, + DecorationAliased = 20, + DecorationVolatile = 21, + DecorationConstant = 22, + DecorationCoherent = 23, + DecorationNonWritable = 24, + DecorationNonReadable = 25, + DecorationUniform = 26, + DecorationSaturatedConversion = 28, + DecorationStream = 29, + DecorationLocation = 30, + DecorationComponent = 31, + DecorationIndex = 32, + DecorationBinding = 33, + DecorationDescriptorSet = 34, + DecorationOffset = 35, + DecorationXfbBuffer = 36, + DecorationXfbStride = 37, + DecorationFuncParamAttr = 38, + DecorationFPRoundingMode = 39, + DecorationFPFastMathMode = 40, + DecorationLinkageAttributes = 41, + DecorationNoContraction = 42, + DecorationInputAttachmentIndex = 43, + DecorationAlignment = 44, + DecorationMaxByteOffset = 45, + DecorationAlignmentId = 46, + DecorationMaxByteOffsetId = 47, + DecorationExplicitInterpAMD = 4999, + DecorationOverrideCoverageNV = 5248, + DecorationPassthroughNV = 5250, + DecorationViewportRelativeNV = 5252, + DecorationSecondaryViewportRelativeNV = 5256, + DecorationNonUniformEXT = 5300, + DecorationHlslCounterBufferGOOGLE = 5634, + DecorationHlslSemanticGOOGLE = 5635, + DecorationMax = 0x7fffffff, +}; + +enum BuiltIn { + BuiltInPosition = 0, + BuiltInPointSize = 1, + BuiltInClipDistance = 3, + BuiltInCullDistance = 4, + BuiltInVertexId = 5, + BuiltInInstanceId = 6, + BuiltInPrimitiveId = 7, + BuiltInInvocationId = 8, + BuiltInLayer = 9, + BuiltInViewportIndex = 10, + BuiltInTessLevelOuter = 11, + BuiltInTessLevelInner = 12, + BuiltInTessCoord = 13, + BuiltInPatchVertices = 14, + BuiltInFragCoord = 15, + BuiltInPointCoord = 16, + BuiltInFrontFacing = 17, + BuiltInSampleId = 18, + BuiltInSamplePosition = 19, + BuiltInSampleMask = 20, + BuiltInFragDepth = 22, + BuiltInHelperInvocation = 23, + BuiltInNumWorkgroups = 24, + BuiltInWorkgroupSize = 25, + BuiltInWorkgroupId = 26, + BuiltInLocalInvocationId = 27, + BuiltInGlobalInvocationId = 28, + BuiltInLocalInvocationIndex = 29, + BuiltInWorkDim = 30, + BuiltInGlobalSize = 31, + BuiltInEnqueuedWorkgroupSize = 32, + BuiltInGlobalOffset = 33, + BuiltInGlobalLinearId = 34, + BuiltInSubgroupSize = 36, + BuiltInSubgroupMaxSize = 37, + BuiltInNumSubgroups = 38, + BuiltInNumEnqueuedSubgroups = 39, + BuiltInSubgroupId = 40, + BuiltInSubgroupLocalInvocationId = 41, + BuiltInVertexIndex = 42, + BuiltInInstanceIndex = 43, + BuiltInSubgroupEqMask = 4416, + BuiltInSubgroupEqMaskKHR = 4416, + BuiltInSubgroupGeMask = 4417, + BuiltInSubgroupGeMaskKHR = 4417, + BuiltInSubgroupGtMask = 4418, + BuiltInSubgroupGtMaskKHR = 4418, + BuiltInSubgroupLeMask = 4419, + BuiltInSubgroupLeMaskKHR = 4419, + BuiltInSubgroupLtMask = 4420, + BuiltInSubgroupLtMaskKHR = 4420, + BuiltInBaseVertex = 4424, + BuiltInBaseInstance = 4425, + BuiltInDrawIndex = 4426, + BuiltInDeviceIndex = 4438, + BuiltInViewIndex = 4440, + BuiltInBaryCoordNoPerspAMD = 4992, + BuiltInBaryCoordNoPerspCentroidAMD = 4993, + BuiltInBaryCoordNoPerspSampleAMD = 4994, + BuiltInBaryCoordSmoothAMD = 4995, + BuiltInBaryCoordSmoothCentroidAMD = 4996, + BuiltInBaryCoordSmoothSampleAMD = 4997, + BuiltInBaryCoordPullModelAMD = 4998, + BuiltInFragStencilRefEXT = 5014, + BuiltInViewportMaskNV = 5253, + BuiltInSecondaryPositionNV = 5257, + BuiltInSecondaryViewportMaskNV = 5258, + BuiltInPositionPerViewNV = 5261, + BuiltInViewportMaskPerViewNV = 5262, + BuiltInFullyCoveredEXT = 5264, + BuiltInMax = 0x7fffffff, +}; + +enum SelectionControlShift { + SelectionControlFlattenShift = 0, + SelectionControlDontFlattenShift = 1, + SelectionControlMax = 0x7fffffff, +}; + +enum SelectionControlMask { + SelectionControlMaskNone = 0, + SelectionControlFlattenMask = 0x00000001, + SelectionControlDontFlattenMask = 0x00000002, +}; + +enum LoopControlShift { + LoopControlUnrollShift = 0, + LoopControlDontUnrollShift = 1, + LoopControlDependencyInfiniteShift = 2, + LoopControlDependencyLengthShift = 3, + LoopControlMax = 0x7fffffff, +}; + +enum LoopControlMask { + LoopControlMaskNone = 0, + LoopControlUnrollMask = 0x00000001, + LoopControlDontUnrollMask = 0x00000002, + LoopControlDependencyInfiniteMask = 0x00000004, + LoopControlDependencyLengthMask = 0x00000008, +}; + +enum FunctionControlShift { + FunctionControlInlineShift = 0, + FunctionControlDontInlineShift = 1, + FunctionControlPureShift = 2, + FunctionControlConstShift = 3, + FunctionControlMax = 0x7fffffff, +}; + +enum FunctionControlMask { + FunctionControlMaskNone = 0, + FunctionControlInlineMask = 0x00000001, + FunctionControlDontInlineMask = 0x00000002, + FunctionControlPureMask = 0x00000004, + FunctionControlConstMask = 0x00000008, +}; + +enum MemorySemanticsShift { + MemorySemanticsAcquireShift = 1, + MemorySemanticsReleaseShift = 2, + MemorySemanticsAcquireReleaseShift = 3, + MemorySemanticsSequentiallyConsistentShift = 4, + MemorySemanticsUniformMemoryShift = 6, + MemorySemanticsSubgroupMemoryShift = 7, + MemorySemanticsWorkgroupMemoryShift = 8, + MemorySemanticsCrossWorkgroupMemoryShift = 9, + MemorySemanticsAtomicCounterMemoryShift = 10, + MemorySemanticsImageMemoryShift = 11, + MemorySemanticsMax = 0x7fffffff, +}; + +enum MemorySemanticsMask { + MemorySemanticsMaskNone = 0, + MemorySemanticsAcquireMask = 0x00000002, + MemorySemanticsReleaseMask = 0x00000004, + MemorySemanticsAcquireReleaseMask = 0x00000008, + MemorySemanticsSequentiallyConsistentMask = 0x00000010, + MemorySemanticsUniformMemoryMask = 0x00000040, + MemorySemanticsSubgroupMemoryMask = 0x00000080, + MemorySemanticsWorkgroupMemoryMask = 0x00000100, + MemorySemanticsCrossWorkgroupMemoryMask = 0x00000200, + MemorySemanticsAtomicCounterMemoryMask = 0x00000400, + MemorySemanticsImageMemoryMask = 0x00000800, +}; + +enum MemoryAccessShift { + MemoryAccessVolatileShift = 0, + MemoryAccessAlignedShift = 1, + MemoryAccessNontemporalShift = 2, + MemoryAccessMax = 0x7fffffff, +}; + +enum MemoryAccessMask { + MemoryAccessMaskNone = 0, + MemoryAccessVolatileMask = 0x00000001, + MemoryAccessAlignedMask = 0x00000002, + MemoryAccessNontemporalMask = 0x00000004, +}; + +enum Scope { + ScopeCrossDevice = 0, + ScopeDevice = 1, + ScopeWorkgroup = 2, + ScopeSubgroup = 3, + ScopeInvocation = 4, + ScopeMax = 0x7fffffff, +}; + +enum GroupOperation { + GroupOperationReduce = 0, + GroupOperationInclusiveScan = 1, + GroupOperationExclusiveScan = 2, + GroupOperationClusteredReduce = 3, + GroupOperationPartitionedReduceNV = 6, + GroupOperationPartitionedInclusiveScanNV = 7, + GroupOperationPartitionedExclusiveScanNV = 8, + GroupOperationMax = 0x7fffffff, +}; + +enum KernelEnqueueFlags { + KernelEnqueueFlagsNoWait = 0, + KernelEnqueueFlagsWaitKernel = 1, + KernelEnqueueFlagsWaitWorkGroup = 2, + KernelEnqueueFlagsMax = 0x7fffffff, +}; + +enum KernelProfilingInfoShift { + KernelProfilingInfoCmdExecTimeShift = 0, + KernelProfilingInfoMax = 0x7fffffff, +}; + +enum KernelProfilingInfoMask { + KernelProfilingInfoMaskNone = 0, + KernelProfilingInfoCmdExecTimeMask = 0x00000001, +}; + +enum Capability { + CapabilityMatrix = 0, + CapabilityShader = 1, + CapabilityGeometry = 2, + CapabilityTessellation = 3, + CapabilityAddresses = 4, + CapabilityLinkage = 5, + CapabilityKernel = 6, + CapabilityVector16 = 7, + CapabilityFloat16Buffer = 8, + CapabilityFloat16 = 9, + CapabilityFloat64 = 10, + CapabilityInt64 = 11, + CapabilityInt64Atomics = 12, + CapabilityImageBasic = 13, + CapabilityImageReadWrite = 14, + CapabilityImageMipmap = 15, + CapabilityPipes = 17, + CapabilityGroups = 18, + CapabilityDeviceEnqueue = 19, + CapabilityLiteralSampler = 20, + CapabilityAtomicStorage = 21, + CapabilityInt16 = 22, + CapabilityTessellationPointSize = 23, + CapabilityGeometryPointSize = 24, + CapabilityImageGatherExtended = 25, + CapabilityStorageImageMultisample = 27, + CapabilityUniformBufferArrayDynamicIndexing = 28, + CapabilitySampledImageArrayDynamicIndexing = 29, + CapabilityStorageBufferArrayDynamicIndexing = 30, + CapabilityStorageImageArrayDynamicIndexing = 31, + CapabilityClipDistance = 32, + CapabilityCullDistance = 33, + CapabilityImageCubeArray = 34, + CapabilitySampleRateShading = 35, + CapabilityImageRect = 36, + CapabilitySampledRect = 37, + CapabilityGenericPointer = 38, + CapabilityInt8 = 39, + CapabilityInputAttachment = 40, + CapabilitySparseResidency = 41, + CapabilityMinLod = 42, + CapabilitySampled1D = 43, + CapabilityImage1D = 44, + CapabilitySampledCubeArray = 45, + CapabilitySampledBuffer = 46, + CapabilityImageBuffer = 47, + CapabilityImageMSArray = 48, + CapabilityStorageImageExtendedFormats = 49, + CapabilityImageQuery = 50, + CapabilityDerivativeControl = 51, + CapabilityInterpolationFunction = 52, + CapabilityTransformFeedback = 53, + CapabilityGeometryStreams = 54, + CapabilityStorageImageReadWithoutFormat = 55, + CapabilityStorageImageWriteWithoutFormat = 56, + CapabilityMultiViewport = 57, + CapabilitySubgroupDispatch = 58, + CapabilityNamedBarrier = 59, + CapabilityPipeStorage = 60, + CapabilityGroupNonUniform = 61, + CapabilityGroupNonUniformVote = 62, + CapabilityGroupNonUniformArithmetic = 63, + CapabilityGroupNonUniformBallot = 64, + CapabilityGroupNonUniformShuffle = 65, + CapabilityGroupNonUniformShuffleRelative = 66, + CapabilityGroupNonUniformClustered = 67, + CapabilityGroupNonUniformQuad = 68, + CapabilitySubgroupBallotKHR = 4423, + CapabilityDrawParameters = 4427, + CapabilitySubgroupVoteKHR = 4431, + CapabilityStorageBuffer16BitAccess = 4433, + CapabilityStorageUniformBufferBlock16 = 4433, + CapabilityStorageUniform16 = 4434, + CapabilityUniformAndStorageBuffer16BitAccess = 4434, + CapabilityStoragePushConstant16 = 4435, + CapabilityStorageInputOutput16 = 4436, + CapabilityDeviceGroup = 4437, + CapabilityMultiView = 4439, + CapabilityVariablePointersStorageBuffer = 4441, + CapabilityVariablePointers = 4442, + CapabilityAtomicStorageOps = 4445, + CapabilitySampleMaskPostDepthCoverage = 4447, + CapabilityStorageBuffer8BitAccess = 4448, + CapabilityUniformAndStorageBuffer8BitAccess = 4449, + CapabilityStoragePushConstant8 = 4450, + CapabilityFloat16ImageAMD = 5008, + CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, + CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, + CapabilitySampleMaskOverrideCoverageNV = 5249, + CapabilityGeometryShaderPassthroughNV = 5251, + CapabilityShaderViewportIndexLayerEXT = 5254, + CapabilityShaderViewportIndexLayerNV = 5254, + CapabilityShaderViewportMaskNV = 5255, + CapabilityShaderStereoViewNV = 5259, + CapabilityPerViewAttributesNV = 5260, + CapabilityFragmentFullyCoveredEXT = 5265, + CapabilityGroupNonUniformPartitionedNV = 5297, + CapabilityShaderNonUniformEXT = 5301, + CapabilityRuntimeDescriptorArrayEXT = 5302, + CapabilityInputAttachmentArrayDynamicIndexingEXT = 5303, + CapabilityUniformTexelBufferArrayDynamicIndexingEXT = 5304, + CapabilityStorageTexelBufferArrayDynamicIndexingEXT = 5305, + CapabilityUniformBufferArrayNonUniformIndexingEXT = 5306, + CapabilitySampledImageArrayNonUniformIndexingEXT = 5307, + CapabilityStorageBufferArrayNonUniformIndexingEXT = 5308, + CapabilityStorageImageArrayNonUniformIndexingEXT = 5309, + CapabilityInputAttachmentArrayNonUniformIndexingEXT = 5310, + CapabilityUniformTexelBufferArrayNonUniformIndexingEXT = 5311, + CapabilityStorageTexelBufferArrayNonUniformIndexingEXT = 5312, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, + CapabilityMax = 0x7fffffff, +}; + +enum Op { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpGroupNonUniformElect = 333, + OpGroupNonUniformAll = 334, + OpGroupNonUniformAny = 335, + OpGroupNonUniformAllEqual = 336, + OpGroupNonUniformBroadcast = 337, + OpGroupNonUniformBroadcastFirst = 338, + OpGroupNonUniformBallot = 339, + OpGroupNonUniformInverseBallot = 340, + OpGroupNonUniformBallotBitExtract = 341, + OpGroupNonUniformBallotBitCount = 342, + OpGroupNonUniformBallotFindLSB = 343, + OpGroupNonUniformBallotFindMSB = 344, + OpGroupNonUniformShuffle = 345, + OpGroupNonUniformShuffleXor = 346, + OpGroupNonUniformShuffleUp = 347, + OpGroupNonUniformShuffleDown = 348, + OpGroupNonUniformIAdd = 349, + OpGroupNonUniformFAdd = 350, + OpGroupNonUniformIMul = 351, + OpGroupNonUniformFMul = 352, + OpGroupNonUniformSMin = 353, + OpGroupNonUniformUMin = 354, + OpGroupNonUniformFMin = 355, + OpGroupNonUniformSMax = 356, + OpGroupNonUniformUMax = 357, + OpGroupNonUniformFMax = 358, + OpGroupNonUniformBitwiseAnd = 359, + OpGroupNonUniformBitwiseOr = 360, + OpGroupNonUniformBitwiseXor = 361, + OpGroupNonUniformLogicalAnd = 362, + OpGroupNonUniformLogicalOr = 363, + OpGroupNonUniformLogicalXor = 364, + OpGroupNonUniformQuadBroadcast = 365, + OpGroupNonUniformQuadSwap = 366, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpGroupNonUniformPartitionNV = 5296, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + OpMax = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.hpp11 b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.hpp11 new file mode 100644 index 00000000000..3bd5b8a0df2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.hpp11 @@ -0,0 +1,1102 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// This header is automatically generated by the same tool that creates +// the Binary Section of the SPIR-V specification. + +// Enumeration tokens for SPIR-V, in various styles: +// C, C++, C++11, JSON, Lua, Python +// +// - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +// - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +// - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +// - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +// - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +// +// Some tokens act like mask values, which can be OR'd together, +// while others are mutually exclusive. The mask-like ones have +// "Mask" in their name, and a parallel enum that has the shift +// amount (1 << x) for each corresponding enumerant. + +#ifndef spirv_HPP +#define spirv_HPP + +namespace spv { + +typedef unsigned int Id; + +#define SPV_VERSION 0x10300 +#define SPV_REVISION 1 + +static const unsigned int MagicNumber = 0x07230203; +static const unsigned int Version = 0x00010300; +static const unsigned int Revision = 1; +static const unsigned int OpCodeMask = 0xffff; +static const unsigned int WordCountShift = 16; + +enum class SourceLanguage : unsigned { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + Max = 0x7fffffff, +}; + +enum class ExecutionModel : unsigned { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + Max = 0x7fffffff, +}; + +enum class AddressingModel : unsigned { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + Max = 0x7fffffff, +}; + +enum class MemoryModel : unsigned { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + Max = 0x7fffffff, +}; + +enum class ExecutionMode : unsigned { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + Max = 0x7fffffff, +}; + +enum class StorageClass : unsigned { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + Max = 0x7fffffff, +}; + +enum class Dim : unsigned { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + Max = 0x7fffffff, +}; + +enum class SamplerAddressingMode : unsigned { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + Max = 0x7fffffff, +}; + +enum class SamplerFilterMode : unsigned { + Nearest = 0, + Linear = 1, + Max = 0x7fffffff, +}; + +enum class ImageFormat : unsigned { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + Max = 0x7fffffff, +}; + +enum class ImageChannelOrder : unsigned { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + Max = 0x7fffffff, +}; + +enum class ImageChannelDataType : unsigned { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + Max = 0x7fffffff, +}; + +enum class ImageOperandsShift : unsigned { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + Max = 0x7fffffff, +}; + +enum class ImageOperandsMask : unsigned { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, +}; + +enum class FPFastMathModeShift : unsigned { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + Max = 0x7fffffff, +}; + +enum class FPFastMathModeMask : unsigned { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, +}; + +enum class FPRoundingMode : unsigned { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + Max = 0x7fffffff, +}; + +enum class LinkageType : unsigned { + Export = 0, + Import = 1, + Max = 0x7fffffff, +}; + +enum class AccessQualifier : unsigned { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + Max = 0x7fffffff, +}; + +enum class FunctionParameterAttribute : unsigned { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + Max = 0x7fffffff, +}; + +enum class Decoration : unsigned { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + NonUniformEXT = 5300, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + Max = 0x7fffffff, +}; + +enum class BuiltIn : unsigned { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMask = 4416, + SubgroupEqMaskKHR = 4416, + SubgroupGeMask = 4417, + SubgroupGeMaskKHR = 4417, + SubgroupGtMask = 4418, + SubgroupGtMaskKHR = 4418, + SubgroupLeMask = 4419, + SubgroupLeMaskKHR = 4419, + SubgroupLtMask = 4420, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + FullyCoveredEXT = 5264, + Max = 0x7fffffff, +}; + +enum class SelectionControlShift : unsigned { + Flatten = 0, + DontFlatten = 1, + Max = 0x7fffffff, +}; + +enum class SelectionControlMask : unsigned { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, +}; + +enum class LoopControlShift : unsigned { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + Max = 0x7fffffff, +}; + +enum class LoopControlMask : unsigned { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, +}; + +enum class FunctionControlShift : unsigned { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + Max = 0x7fffffff, +}; + +enum class FunctionControlMask : unsigned { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, +}; + +enum class MemorySemanticsShift : unsigned { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + Max = 0x7fffffff, +}; + +enum class MemorySemanticsMask : unsigned { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, +}; + +enum class MemoryAccessShift : unsigned { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + Max = 0x7fffffff, +}; + +enum class MemoryAccessMask : unsigned { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, +}; + +enum class Scope : unsigned { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + Max = 0x7fffffff, +}; + +enum class GroupOperation : unsigned { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + ClusteredReduce = 3, + PartitionedReduceNV = 6, + PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanNV = 8, + Max = 0x7fffffff, +}; + +enum class KernelEnqueueFlags : unsigned { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoShift : unsigned { + CmdExecTime = 0, + Max = 0x7fffffff, +}; + +enum class KernelProfilingInfoMask : unsigned { + MaskNone = 0, + CmdExecTime = 0x00000001, +}; + +enum class Capability : unsigned { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + GroupNonUniform = 61, + GroupNonUniformVote = 62, + GroupNonUniformArithmetic = 63, + GroupNonUniformBallot = 64, + GroupNonUniformShuffle = 65, + GroupNonUniformShuffleRelative = 66, + GroupNonUniformClustered = 67, + GroupNonUniformQuad = 68, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + StorageBuffer8BitAccess = 4448, + UniformAndStorageBuffer8BitAccess = 4449, + StoragePushConstant8 = 4450, + Float16ImageAMD = 5008, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + FragmentFullyCoveredEXT = 5265, + GroupNonUniformPartitionedNV = 5297, + ShaderNonUniformEXT = 5301, + RuntimeDescriptorArrayEXT = 5302, + InputAttachmentArrayDynamicIndexingEXT = 5303, + UniformTexelBufferArrayDynamicIndexingEXT = 5304, + StorageTexelBufferArrayDynamicIndexingEXT = 5305, + UniformBufferArrayNonUniformIndexingEXT = 5306, + SampledImageArrayNonUniformIndexingEXT = 5307, + StorageBufferArrayNonUniformIndexingEXT = 5308, + StorageImageArrayNonUniformIndexingEXT = 5309, + InputAttachmentArrayNonUniformIndexingEXT = 5310, + UniformTexelBufferArrayNonUniformIndexingEXT = 5311, + StorageTexelBufferArrayNonUniformIndexingEXT = 5312, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + Max = 0x7fffffff, +}; + +enum class Op : unsigned { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpGroupNonUniformElect = 333, + OpGroupNonUniformAll = 334, + OpGroupNonUniformAny = 335, + OpGroupNonUniformAllEqual = 336, + OpGroupNonUniformBroadcast = 337, + OpGroupNonUniformBroadcastFirst = 338, + OpGroupNonUniformBallot = 339, + OpGroupNonUniformInverseBallot = 340, + OpGroupNonUniformBallotBitExtract = 341, + OpGroupNonUniformBallotBitCount = 342, + OpGroupNonUniformBallotFindLSB = 343, + OpGroupNonUniformBallotFindMSB = 344, + OpGroupNonUniformShuffle = 345, + OpGroupNonUniformShuffleXor = 346, + OpGroupNonUniformShuffleUp = 347, + OpGroupNonUniformShuffleDown = 348, + OpGroupNonUniformIAdd = 349, + OpGroupNonUniformFAdd = 350, + OpGroupNonUniformIMul = 351, + OpGroupNonUniformFMul = 352, + OpGroupNonUniformSMin = 353, + OpGroupNonUniformUMin = 354, + OpGroupNonUniformFMin = 355, + OpGroupNonUniformSMax = 356, + OpGroupNonUniformUMax = 357, + OpGroupNonUniformFMax = 358, + OpGroupNonUniformBitwiseAnd = 359, + OpGroupNonUniformBitwiseOr = 360, + OpGroupNonUniformBitwiseXor = 361, + OpGroupNonUniformLogicalAnd = 362, + OpGroupNonUniformLogicalOr = 363, + OpGroupNonUniformLogicalXor = 364, + OpGroupNonUniformQuadBroadcast = 365, + OpGroupNonUniformQuadSwap = 366, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpGroupNonUniformPartitionNV = 5296, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + Max = 0x7fffffff, +}; + +// Overload operator| for mask bit combining + +inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } +inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); } +inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); } +inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); } +inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); } +inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); } +inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); } +inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); } + +} // end namespace spv + +#endif // #ifndef spirv_HPP + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.json b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.json new file mode 100644 index 00000000000..a592dfa2315 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.json @@ -0,0 +1,1118 @@ +{ + "spv": + { + "meta": + { + "Comment": + [ + [ + "Copyright (c) 2014-2018 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + [ + "This header is automatically generated by the same tool that creates", + "the Binary Section of the SPIR-V specification." + ], + [ + "Enumeration tokens for SPIR-V, in various styles:", + " C, C++, C++11, JSON, Lua, Python", + "", + "- C will have tokens with a \"Spv\" prefix, e.g.: SpvSourceLanguageGLSL", + "- C++ will have tokens in the \"spv\" name space, e.g.: spv::SourceLanguageGLSL", + "- C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL", + "- Lua will use tables, e.g.: spv.SourceLanguage.GLSL", + "- Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']", + "", + "Some tokens act like mask values, which can be OR'd together,", + "while others are mutually exclusive. The mask-like ones have", + "\"Mask\" in their name, and a parallel enum that has the shift", + "amount (1 << x) for each corresponding enumerant." + ] + ], + "MagicNumber": 119734787, + "Version": 66304, + "Revision": 1, + "OpCodeMask": 65535, + "WordCountShift": 16 + }, + "enum": + [ + { + "Name": "SourceLanguage", + "Type": "Value", + "Values": + { + "Unknown": 0, + "ESSL": 1, + "GLSL": 2, + "OpenCL_C": 3, + "OpenCL_CPP": 4, + "HLSL": 5 + } + }, + { + "Name": "ExecutionModel", + "Type": "Value", + "Values": + { + "Vertex": 0, + "TessellationControl": 1, + "TessellationEvaluation": 2, + "Geometry": 3, + "Fragment": 4, + "GLCompute": 5, + "Kernel": 6 + } + }, + { + "Name": "AddressingModel", + "Type": "Value", + "Values": + { + "Logical": 0, + "Physical32": 1, + "Physical64": 2 + } + }, + { + "Name": "MemoryModel", + "Type": "Value", + "Values": + { + "Simple": 0, + "GLSL450": 1, + "OpenCL": 2 + } + }, + { + "Name": "ExecutionMode", + "Type": "Value", + "Values": + { + "Invocations": 0, + "SpacingEqual": 1, + "SpacingFractionalEven": 2, + "SpacingFractionalOdd": 3, + "VertexOrderCw": 4, + "VertexOrderCcw": 5, + "PixelCenterInteger": 6, + "OriginUpperLeft": 7, + "OriginLowerLeft": 8, + "EarlyFragmentTests": 9, + "PointMode": 10, + "Xfb": 11, + "DepthReplacing": 12, + "DepthGreater": 14, + "DepthLess": 15, + "DepthUnchanged": 16, + "LocalSize": 17, + "LocalSizeHint": 18, + "InputPoints": 19, + "InputLines": 20, + "InputLinesAdjacency": 21, + "Triangles": 22, + "InputTrianglesAdjacency": 23, + "Quads": 24, + "Isolines": 25, + "OutputVertices": 26, + "OutputPoints": 27, + "OutputLineStrip": 28, + "OutputTriangleStrip": 29, + "VecTypeHint": 30, + "ContractionOff": 31, + "Initializer": 33, + "Finalizer": 34, + "SubgroupSize": 35, + "SubgroupsPerWorkgroup": 36, + "SubgroupsPerWorkgroupId": 37, + "LocalSizeId": 38, + "LocalSizeHintId": 39, + "PostDepthCoverage": 4446, + "StencilRefReplacingEXT": 5027 + } + }, + { + "Name": "StorageClass", + "Type": "Value", + "Values": + { + "UniformConstant": 0, + "Input": 1, + "Uniform": 2, + "Output": 3, + "Workgroup": 4, + "CrossWorkgroup": 5, + "Private": 6, + "Function": 7, + "Generic": 8, + "PushConstant": 9, + "AtomicCounter": 10, + "Image": 11, + "StorageBuffer": 12 + } + }, + { + "Name": "Dim", + "Type": "Value", + "Values": + { + "Dim1D": 0, + "Dim2D": 1, + "Dim3D": 2, + "Cube": 3, + "Rect": 4, + "Buffer": 5, + "SubpassData": 6 + } + }, + { + "Name": "SamplerAddressingMode", + "Type": "Value", + "Values": + { + "None": 0, + "ClampToEdge": 1, + "Clamp": 2, + "Repeat": 3, + "RepeatMirrored": 4 + } + }, + { + "Name": "SamplerFilterMode", + "Type": "Value", + "Values": + { + "Nearest": 0, + "Linear": 1 + } + }, + { + "Name": "ImageFormat", + "Type": "Value", + "Values": + { + "Unknown": 0, + "Rgba32f": 1, + "Rgba16f": 2, + "R32f": 3, + "Rgba8": 4, + "Rgba8Snorm": 5, + "Rg32f": 6, + "Rg16f": 7, + "R11fG11fB10f": 8, + "R16f": 9, + "Rgba16": 10, + "Rgb10A2": 11, + "Rg16": 12, + "Rg8": 13, + "R16": 14, + "R8": 15, + "Rgba16Snorm": 16, + "Rg16Snorm": 17, + "Rg8Snorm": 18, + "R16Snorm": 19, + "R8Snorm": 20, + "Rgba32i": 21, + "Rgba16i": 22, + "Rgba8i": 23, + "R32i": 24, + "Rg32i": 25, + "Rg16i": 26, + "Rg8i": 27, + "R16i": 28, + "R8i": 29, + "Rgba32ui": 30, + "Rgba16ui": 31, + "Rgba8ui": 32, + "R32ui": 33, + "Rgb10a2ui": 34, + "Rg32ui": 35, + "Rg16ui": 36, + "Rg8ui": 37, + "R16ui": 38, + "R8ui": 39 + } + }, + { + "Name": "ImageChannelOrder", + "Type": "Value", + "Values": + { + "R": 0, + "A": 1, + "RG": 2, + "RA": 3, + "RGB": 4, + "RGBA": 5, + "BGRA": 6, + "ARGB": 7, + "Intensity": 8, + "Luminance": 9, + "Rx": 10, + "RGx": 11, + "RGBx": 12, + "Depth": 13, + "DepthStencil": 14, + "sRGB": 15, + "sRGBx": 16, + "sRGBA": 17, + "sBGRA": 18, + "ABGR": 19 + } + }, + { + "Name": "ImageChannelDataType", + "Type": "Value", + "Values": + { + "SnormInt8": 0, + "SnormInt16": 1, + "UnormInt8": 2, + "UnormInt16": 3, + "UnormShort565": 4, + "UnormShort555": 5, + "UnormInt101010": 6, + "SignedInt8": 7, + "SignedInt16": 8, + "SignedInt32": 9, + "UnsignedInt8": 10, + "UnsignedInt16": 11, + "UnsignedInt32": 12, + "HalfFloat": 13, + "Float": 14, + "UnormInt24": 15, + "UnormInt101010_2": 16 + } + }, + { + "Name": "ImageOperands", + "Type": "Bit", + "Values": + { + "Bias": 0, + "Lod": 1, + "Grad": 2, + "ConstOffset": 3, + "Offset": 4, + "ConstOffsets": 5, + "Sample": 6, + "MinLod": 7 + } + }, + { + "Name": "FPFastMathMode", + "Type": "Bit", + "Values": + { + "NotNaN": 0, + "NotInf": 1, + "NSZ": 2, + "AllowRecip": 3, + "Fast": 4 + } + }, + { + "Name": "FPRoundingMode", + "Type": "Value", + "Values": + { + "RTE": 0, + "RTZ": 1, + "RTP": 2, + "RTN": 3 + } + }, + { + "Name": "LinkageType", + "Type": "Value", + "Values": + { + "Export": 0, + "Import": 1 + } + }, + { + "Name": "AccessQualifier", + "Type": "Value", + "Values": + { + "ReadOnly": 0, + "WriteOnly": 1, + "ReadWrite": 2 + } + }, + { + "Name": "FunctionParameterAttribute", + "Type": "Value", + "Values": + { + "Zext": 0, + "Sext": 1, + "ByVal": 2, + "Sret": 3, + "NoAlias": 4, + "NoCapture": 5, + "NoWrite": 6, + "NoReadWrite": 7 + } + }, + { + "Name": "Decoration", + "Type": "Value", + "Values": + { + "RelaxedPrecision": 0, + "SpecId": 1, + "Block": 2, + "BufferBlock": 3, + "RowMajor": 4, + "ColMajor": 5, + "ArrayStride": 6, + "MatrixStride": 7, + "GLSLShared": 8, + "GLSLPacked": 9, + "CPacked": 10, + "BuiltIn": 11, + "NoPerspective": 13, + "Flat": 14, + "Patch": 15, + "Centroid": 16, + "Sample": 17, + "Invariant": 18, + "Restrict": 19, + "Aliased": 20, + "Volatile": 21, + "Constant": 22, + "Coherent": 23, + "NonWritable": 24, + "NonReadable": 25, + "Uniform": 26, + "SaturatedConversion": 28, + "Stream": 29, + "Location": 30, + "Component": 31, + "Index": 32, + "Binding": 33, + "DescriptorSet": 34, + "Offset": 35, + "XfbBuffer": 36, + "XfbStride": 37, + "FuncParamAttr": 38, + "FPRoundingMode": 39, + "FPFastMathMode": 40, + "LinkageAttributes": 41, + "NoContraction": 42, + "InputAttachmentIndex": 43, + "Alignment": 44, + "MaxByteOffset": 45, + "AlignmentId": 46, + "MaxByteOffsetId": 47, + "ExplicitInterpAMD": 4999, + "OverrideCoverageNV": 5248, + "PassthroughNV": 5250, + "ViewportRelativeNV": 5252, + "SecondaryViewportRelativeNV": 5256, + "NonUniformEXT": 5300, + "HlslCounterBufferGOOGLE": 5634, + "HlslSemanticGOOGLE": 5635 + } + }, + { + "Name": "BuiltIn", + "Type": "Value", + "Values": + { + "Position": 0, + "PointSize": 1, + "ClipDistance": 3, + "CullDistance": 4, + "VertexId": 5, + "InstanceId": 6, + "PrimitiveId": 7, + "InvocationId": 8, + "Layer": 9, + "ViewportIndex": 10, + "TessLevelOuter": 11, + "TessLevelInner": 12, + "TessCoord": 13, + "PatchVertices": 14, + "FragCoord": 15, + "PointCoord": 16, + "FrontFacing": 17, + "SampleId": 18, + "SamplePosition": 19, + "SampleMask": 20, + "FragDepth": 22, + "HelperInvocation": 23, + "NumWorkgroups": 24, + "WorkgroupSize": 25, + "WorkgroupId": 26, + "LocalInvocationId": 27, + "GlobalInvocationId": 28, + "LocalInvocationIndex": 29, + "WorkDim": 30, + "GlobalSize": 31, + "EnqueuedWorkgroupSize": 32, + "GlobalOffset": 33, + "GlobalLinearId": 34, + "SubgroupSize": 36, + "SubgroupMaxSize": 37, + "NumSubgroups": 38, + "NumEnqueuedSubgroups": 39, + "SubgroupId": 40, + "SubgroupLocalInvocationId": 41, + "VertexIndex": 42, + "InstanceIndex": 43, + "SubgroupEqMask": 4416, + "SubgroupEqMaskKHR": 4416, + "SubgroupGeMask": 4417, + "SubgroupGeMaskKHR": 4417, + "SubgroupGtMask": 4418, + "SubgroupGtMaskKHR": 4418, + "SubgroupLeMask": 4419, + "SubgroupLeMaskKHR": 4419, + "SubgroupLtMask": 4420, + "SubgroupLtMaskKHR": 4420, + "BaseVertex": 4424, + "BaseInstance": 4425, + "DrawIndex": 4426, + "DeviceIndex": 4438, + "ViewIndex": 4440, + "BaryCoordNoPerspAMD": 4992, + "BaryCoordNoPerspCentroidAMD": 4993, + "BaryCoordNoPerspSampleAMD": 4994, + "BaryCoordSmoothAMD": 4995, + "BaryCoordSmoothCentroidAMD": 4996, + "BaryCoordSmoothSampleAMD": 4997, + "BaryCoordPullModelAMD": 4998, + "FragStencilRefEXT": 5014, + "ViewportMaskNV": 5253, + "SecondaryPositionNV": 5257, + "SecondaryViewportMaskNV": 5258, + "PositionPerViewNV": 5261, + "ViewportMaskPerViewNV": 5262, + "FullyCoveredEXT": 5264 + } + }, + { + "Name": "SelectionControl", + "Type": "Bit", + "Values": + { + "Flatten": 0, + "DontFlatten": 1 + } + }, + { + "Name": "LoopControl", + "Type": "Bit", + "Values": + { + "Unroll": 0, + "DontUnroll": 1, + "DependencyInfinite": 2, + "DependencyLength": 3 + } + }, + { + "Name": "FunctionControl", + "Type": "Bit", + "Values": + { + "Inline": 0, + "DontInline": 1, + "Pure": 2, + "Const": 3 + } + }, + { + "Name": "MemorySemantics", + "Type": "Bit", + "Values": + { + "Acquire": 1, + "Release": 2, + "AcquireRelease": 3, + "SequentiallyConsistent": 4, + "UniformMemory": 6, + "SubgroupMemory": 7, + "WorkgroupMemory": 8, + "CrossWorkgroupMemory": 9, + "AtomicCounterMemory": 10, + "ImageMemory": 11 + } + }, + { + "Name": "MemoryAccess", + "Type": "Bit", + "Values": + { + "Volatile": 0, + "Aligned": 1, + "Nontemporal": 2 + } + }, + { + "Name": "Scope", + "Type": "Value", + "Values": + { + "CrossDevice": 0, + "Device": 1, + "Workgroup": 2, + "Subgroup": 3, + "Invocation": 4 + } + }, + { + "Name": "GroupOperation", + "Type": "Value", + "Values": + { + "Reduce": 0, + "InclusiveScan": 1, + "ExclusiveScan": 2, + "ClusteredReduce": 3, + "PartitionedReduceNV": 6, + "PartitionedInclusiveScanNV": 7, + "PartitionedExclusiveScanNV": 8 + } + }, + { + "Name": "KernelEnqueueFlags", + "Type": "Value", + "Values": + { + "NoWait": 0, + "WaitKernel": 1, + "WaitWorkGroup": 2 + } + }, + { + "Name": "KernelProfilingInfo", + "Type": "Bit", + "Values": + { + "CmdExecTime": 0 + } + }, + { + "Name": "Capability", + "Type": "Value", + "Values": + { + "Matrix": 0, + "Shader": 1, + "Geometry": 2, + "Tessellation": 3, + "Addresses": 4, + "Linkage": 5, + "Kernel": 6, + "Vector16": 7, + "Float16Buffer": 8, + "Float16": 9, + "Float64": 10, + "Int64": 11, + "Int64Atomics": 12, + "ImageBasic": 13, + "ImageReadWrite": 14, + "ImageMipmap": 15, + "Pipes": 17, + "Groups": 18, + "DeviceEnqueue": 19, + "LiteralSampler": 20, + "AtomicStorage": 21, + "Int16": 22, + "TessellationPointSize": 23, + "GeometryPointSize": 24, + "ImageGatherExtended": 25, + "StorageImageMultisample": 27, + "UniformBufferArrayDynamicIndexing": 28, + "SampledImageArrayDynamicIndexing": 29, + "StorageBufferArrayDynamicIndexing": 30, + "StorageImageArrayDynamicIndexing": 31, + "ClipDistance": 32, + "CullDistance": 33, + "ImageCubeArray": 34, + "SampleRateShading": 35, + "ImageRect": 36, + "SampledRect": 37, + "GenericPointer": 38, + "Int8": 39, + "InputAttachment": 40, + "SparseResidency": 41, + "MinLod": 42, + "Sampled1D": 43, + "Image1D": 44, + "SampledCubeArray": 45, + "SampledBuffer": 46, + "ImageBuffer": 47, + "ImageMSArray": 48, + "StorageImageExtendedFormats": 49, + "ImageQuery": 50, + "DerivativeControl": 51, + "InterpolationFunction": 52, + "TransformFeedback": 53, + "GeometryStreams": 54, + "StorageImageReadWithoutFormat": 55, + "StorageImageWriteWithoutFormat": 56, + "MultiViewport": 57, + "SubgroupDispatch": 58, + "NamedBarrier": 59, + "PipeStorage": 60, + "GroupNonUniform": 61, + "GroupNonUniformVote": 62, + "GroupNonUniformArithmetic": 63, + "GroupNonUniformBallot": 64, + "GroupNonUniformShuffle": 65, + "GroupNonUniformShuffleRelative": 66, + "GroupNonUniformClustered": 67, + "GroupNonUniformQuad": 68, + "SubgroupBallotKHR": 4423, + "DrawParameters": 4427, + "SubgroupVoteKHR": 4431, + "StorageBuffer16BitAccess": 4433, + "StorageUniformBufferBlock16": 4433, + "StorageUniform16": 4434, + "UniformAndStorageBuffer16BitAccess": 4434, + "StoragePushConstant16": 4435, + "StorageInputOutput16": 4436, + "DeviceGroup": 4437, + "MultiView": 4439, + "VariablePointersStorageBuffer": 4441, + "VariablePointers": 4442, + "AtomicStorageOps": 4445, + "SampleMaskPostDepthCoverage": 4447, + "StorageBuffer8BitAccess": 4448, + "UniformAndStorageBuffer8BitAccess": 4449, + "StoragePushConstant8": 4450, + "Float16ImageAMD": 5008, + "ImageGatherBiasLodAMD": 5009, + "FragmentMaskAMD": 5010, + "StencilExportEXT": 5013, + "ImageReadWriteLodAMD": 5015, + "SampleMaskOverrideCoverageNV": 5249, + "GeometryShaderPassthroughNV": 5251, + "ShaderViewportIndexLayerEXT": 5254, + "ShaderViewportIndexLayerNV": 5254, + "ShaderViewportMaskNV": 5255, + "ShaderStereoViewNV": 5259, + "PerViewAttributesNV": 5260, + "FragmentFullyCoveredEXT": 5265, + "GroupNonUniformPartitionedNV": 5297, + "ShaderNonUniformEXT": 5301, + "RuntimeDescriptorArrayEXT": 5302, + "InputAttachmentArrayDynamicIndexingEXT": 5303, + "UniformTexelBufferArrayDynamicIndexingEXT": 5304, + "StorageTexelBufferArrayDynamicIndexingEXT": 5305, + "UniformBufferArrayNonUniformIndexingEXT": 5306, + "SampledImageArrayNonUniformIndexingEXT": 5307, + "StorageBufferArrayNonUniformIndexingEXT": 5308, + "StorageImageArrayNonUniformIndexingEXT": 5309, + "InputAttachmentArrayNonUniformIndexingEXT": 5310, + "UniformTexelBufferArrayNonUniformIndexingEXT": 5311, + "StorageTexelBufferArrayNonUniformIndexingEXT": 5312, + "SubgroupShuffleINTEL": 5568, + "SubgroupBufferBlockIOINTEL": 5569, + "SubgroupImageBlockIOINTEL": 5570 + } + }, + { + "Name": "Op", + "Type": "Value", + "Values": + { + "OpNop": 0, + "OpUndef": 1, + "OpSourceContinued": 2, + "OpSource": 3, + "OpSourceExtension": 4, + "OpName": 5, + "OpMemberName": 6, + "OpString": 7, + "OpLine": 8, + "OpExtension": 10, + "OpExtInstImport": 11, + "OpExtInst": 12, + "OpMemoryModel": 14, + "OpEntryPoint": 15, + "OpExecutionMode": 16, + "OpCapability": 17, + "OpTypeVoid": 19, + "OpTypeBool": 20, + "OpTypeInt": 21, + "OpTypeFloat": 22, + "OpTypeVector": 23, + "OpTypeMatrix": 24, + "OpTypeImage": 25, + "OpTypeSampler": 26, + "OpTypeSampledImage": 27, + "OpTypeArray": 28, + "OpTypeRuntimeArray": 29, + "OpTypeStruct": 30, + "OpTypeOpaque": 31, + "OpTypePointer": 32, + "OpTypeFunction": 33, + "OpTypeEvent": 34, + "OpTypeDeviceEvent": 35, + "OpTypeReserveId": 36, + "OpTypeQueue": 37, + "OpTypePipe": 38, + "OpTypeForwardPointer": 39, + "OpConstantTrue": 41, + "OpConstantFalse": 42, + "OpConstant": 43, + "OpConstantComposite": 44, + "OpConstantSampler": 45, + "OpConstantNull": 46, + "OpSpecConstantTrue": 48, + "OpSpecConstantFalse": 49, + "OpSpecConstant": 50, + "OpSpecConstantComposite": 51, + "OpSpecConstantOp": 52, + "OpFunction": 54, + "OpFunctionParameter": 55, + "OpFunctionEnd": 56, + "OpFunctionCall": 57, + "OpVariable": 59, + "OpImageTexelPointer": 60, + "OpLoad": 61, + "OpStore": 62, + "OpCopyMemory": 63, + "OpCopyMemorySized": 64, + "OpAccessChain": 65, + "OpInBoundsAccessChain": 66, + "OpPtrAccessChain": 67, + "OpArrayLength": 68, + "OpGenericPtrMemSemantics": 69, + "OpInBoundsPtrAccessChain": 70, + "OpDecorate": 71, + "OpMemberDecorate": 72, + "OpDecorationGroup": 73, + "OpGroupDecorate": 74, + "OpGroupMemberDecorate": 75, + "OpVectorExtractDynamic": 77, + "OpVectorInsertDynamic": 78, + "OpVectorShuffle": 79, + "OpCompositeConstruct": 80, + "OpCompositeExtract": 81, + "OpCompositeInsert": 82, + "OpCopyObject": 83, + "OpTranspose": 84, + "OpSampledImage": 86, + "OpImageSampleImplicitLod": 87, + "OpImageSampleExplicitLod": 88, + "OpImageSampleDrefImplicitLod": 89, + "OpImageSampleDrefExplicitLod": 90, + "OpImageSampleProjImplicitLod": 91, + "OpImageSampleProjExplicitLod": 92, + "OpImageSampleProjDrefImplicitLod": 93, + "OpImageSampleProjDrefExplicitLod": 94, + "OpImageFetch": 95, + "OpImageGather": 96, + "OpImageDrefGather": 97, + "OpImageRead": 98, + "OpImageWrite": 99, + "OpImage": 100, + "OpImageQueryFormat": 101, + "OpImageQueryOrder": 102, + "OpImageQuerySizeLod": 103, + "OpImageQuerySize": 104, + "OpImageQueryLod": 105, + "OpImageQueryLevels": 106, + "OpImageQuerySamples": 107, + "OpConvertFToU": 109, + "OpConvertFToS": 110, + "OpConvertSToF": 111, + "OpConvertUToF": 112, + "OpUConvert": 113, + "OpSConvert": 114, + "OpFConvert": 115, + "OpQuantizeToF16": 116, + "OpConvertPtrToU": 117, + "OpSatConvertSToU": 118, + "OpSatConvertUToS": 119, + "OpConvertUToPtr": 120, + "OpPtrCastToGeneric": 121, + "OpGenericCastToPtr": 122, + "OpGenericCastToPtrExplicit": 123, + "OpBitcast": 124, + "OpSNegate": 126, + "OpFNegate": 127, + "OpIAdd": 128, + "OpFAdd": 129, + "OpISub": 130, + "OpFSub": 131, + "OpIMul": 132, + "OpFMul": 133, + "OpUDiv": 134, + "OpSDiv": 135, + "OpFDiv": 136, + "OpUMod": 137, + "OpSRem": 138, + "OpSMod": 139, + "OpFRem": 140, + "OpFMod": 141, + "OpVectorTimesScalar": 142, + "OpMatrixTimesScalar": 143, + "OpVectorTimesMatrix": 144, + "OpMatrixTimesVector": 145, + "OpMatrixTimesMatrix": 146, + "OpOuterProduct": 147, + "OpDot": 148, + "OpIAddCarry": 149, + "OpISubBorrow": 150, + "OpUMulExtended": 151, + "OpSMulExtended": 152, + "OpAny": 154, + "OpAll": 155, + "OpIsNan": 156, + "OpIsInf": 157, + "OpIsFinite": 158, + "OpIsNormal": 159, + "OpSignBitSet": 160, + "OpLessOrGreater": 161, + "OpOrdered": 162, + "OpUnordered": 163, + "OpLogicalEqual": 164, + "OpLogicalNotEqual": 165, + "OpLogicalOr": 166, + "OpLogicalAnd": 167, + "OpLogicalNot": 168, + "OpSelect": 169, + "OpIEqual": 170, + "OpINotEqual": 171, + "OpUGreaterThan": 172, + "OpSGreaterThan": 173, + "OpUGreaterThanEqual": 174, + "OpSGreaterThanEqual": 175, + "OpULessThan": 176, + "OpSLessThan": 177, + "OpULessThanEqual": 178, + "OpSLessThanEqual": 179, + "OpFOrdEqual": 180, + "OpFUnordEqual": 181, + "OpFOrdNotEqual": 182, + "OpFUnordNotEqual": 183, + "OpFOrdLessThan": 184, + "OpFUnordLessThan": 185, + "OpFOrdGreaterThan": 186, + "OpFUnordGreaterThan": 187, + "OpFOrdLessThanEqual": 188, + "OpFUnordLessThanEqual": 189, + "OpFOrdGreaterThanEqual": 190, + "OpFUnordGreaterThanEqual": 191, + "OpShiftRightLogical": 194, + "OpShiftRightArithmetic": 195, + "OpShiftLeftLogical": 196, + "OpBitwiseOr": 197, + "OpBitwiseXor": 198, + "OpBitwiseAnd": 199, + "OpNot": 200, + "OpBitFieldInsert": 201, + "OpBitFieldSExtract": 202, + "OpBitFieldUExtract": 203, + "OpBitReverse": 204, + "OpBitCount": 205, + "OpDPdx": 207, + "OpDPdy": 208, + "OpFwidth": 209, + "OpDPdxFine": 210, + "OpDPdyFine": 211, + "OpFwidthFine": 212, + "OpDPdxCoarse": 213, + "OpDPdyCoarse": 214, + "OpFwidthCoarse": 215, + "OpEmitVertex": 218, + "OpEndPrimitive": 219, + "OpEmitStreamVertex": 220, + "OpEndStreamPrimitive": 221, + "OpControlBarrier": 224, + "OpMemoryBarrier": 225, + "OpAtomicLoad": 227, + "OpAtomicStore": 228, + "OpAtomicExchange": 229, + "OpAtomicCompareExchange": 230, + "OpAtomicCompareExchangeWeak": 231, + "OpAtomicIIncrement": 232, + "OpAtomicIDecrement": 233, + "OpAtomicIAdd": 234, + "OpAtomicISub": 235, + "OpAtomicSMin": 236, + "OpAtomicUMin": 237, + "OpAtomicSMax": 238, + "OpAtomicUMax": 239, + "OpAtomicAnd": 240, + "OpAtomicOr": 241, + "OpAtomicXor": 242, + "OpPhi": 245, + "OpLoopMerge": 246, + "OpSelectionMerge": 247, + "OpLabel": 248, + "OpBranch": 249, + "OpBranchConditional": 250, + "OpSwitch": 251, + "OpKill": 252, + "OpReturn": 253, + "OpReturnValue": 254, + "OpUnreachable": 255, + "OpLifetimeStart": 256, + "OpLifetimeStop": 257, + "OpGroupAsyncCopy": 259, + "OpGroupWaitEvents": 260, + "OpGroupAll": 261, + "OpGroupAny": 262, + "OpGroupBroadcast": 263, + "OpGroupIAdd": 264, + "OpGroupFAdd": 265, + "OpGroupFMin": 266, + "OpGroupUMin": 267, + "OpGroupSMin": 268, + "OpGroupFMax": 269, + "OpGroupUMax": 270, + "OpGroupSMax": 271, + "OpReadPipe": 274, + "OpWritePipe": 275, + "OpReservedReadPipe": 276, + "OpReservedWritePipe": 277, + "OpReserveReadPipePackets": 278, + "OpReserveWritePipePackets": 279, + "OpCommitReadPipe": 280, + "OpCommitWritePipe": 281, + "OpIsValidReserveId": 282, + "OpGetNumPipePackets": 283, + "OpGetMaxPipePackets": 284, + "OpGroupReserveReadPipePackets": 285, + "OpGroupReserveWritePipePackets": 286, + "OpGroupCommitReadPipe": 287, + "OpGroupCommitWritePipe": 288, + "OpEnqueueMarker": 291, + "OpEnqueueKernel": 292, + "OpGetKernelNDrangeSubGroupCount": 293, + "OpGetKernelNDrangeMaxSubGroupSize": 294, + "OpGetKernelWorkGroupSize": 295, + "OpGetKernelPreferredWorkGroupSizeMultiple": 296, + "OpRetainEvent": 297, + "OpReleaseEvent": 298, + "OpCreateUserEvent": 299, + "OpIsValidEvent": 300, + "OpSetUserEventStatus": 301, + "OpCaptureEventProfilingInfo": 302, + "OpGetDefaultQueue": 303, + "OpBuildNDRange": 304, + "OpImageSparseSampleImplicitLod": 305, + "OpImageSparseSampleExplicitLod": 306, + "OpImageSparseSampleDrefImplicitLod": 307, + "OpImageSparseSampleDrefExplicitLod": 308, + "OpImageSparseSampleProjImplicitLod": 309, + "OpImageSparseSampleProjExplicitLod": 310, + "OpImageSparseSampleProjDrefImplicitLod": 311, + "OpImageSparseSampleProjDrefExplicitLod": 312, + "OpImageSparseFetch": 313, + "OpImageSparseGather": 314, + "OpImageSparseDrefGather": 315, + "OpImageSparseTexelsResident": 316, + "OpNoLine": 317, + "OpAtomicFlagTestAndSet": 318, + "OpAtomicFlagClear": 319, + "OpImageSparseRead": 320, + "OpSizeOf": 321, + "OpTypePipeStorage": 322, + "OpConstantPipeStorage": 323, + "OpCreatePipeFromPipeStorage": 324, + "OpGetKernelLocalSizeForSubgroupCount": 325, + "OpGetKernelMaxNumSubgroups": 326, + "OpTypeNamedBarrier": 327, + "OpNamedBarrierInitialize": 328, + "OpMemoryNamedBarrier": 329, + "OpModuleProcessed": 330, + "OpExecutionModeId": 331, + "OpDecorateId": 332, + "OpGroupNonUniformElect": 333, + "OpGroupNonUniformAll": 334, + "OpGroupNonUniformAny": 335, + "OpGroupNonUniformAllEqual": 336, + "OpGroupNonUniformBroadcast": 337, + "OpGroupNonUniformBroadcastFirst": 338, + "OpGroupNonUniformBallot": 339, + "OpGroupNonUniformInverseBallot": 340, + "OpGroupNonUniformBallotBitExtract": 341, + "OpGroupNonUniformBallotBitCount": 342, + "OpGroupNonUniformBallotFindLSB": 343, + "OpGroupNonUniformBallotFindMSB": 344, + "OpGroupNonUniformShuffle": 345, + "OpGroupNonUniformShuffleXor": 346, + "OpGroupNonUniformShuffleUp": 347, + "OpGroupNonUniformShuffleDown": 348, + "OpGroupNonUniformIAdd": 349, + "OpGroupNonUniformFAdd": 350, + "OpGroupNonUniformIMul": 351, + "OpGroupNonUniformFMul": 352, + "OpGroupNonUniformSMin": 353, + "OpGroupNonUniformUMin": 354, + "OpGroupNonUniformFMin": 355, + "OpGroupNonUniformSMax": 356, + "OpGroupNonUniformUMax": 357, + "OpGroupNonUniformFMax": 358, + "OpGroupNonUniformBitwiseAnd": 359, + "OpGroupNonUniformBitwiseOr": 360, + "OpGroupNonUniformBitwiseXor": 361, + "OpGroupNonUniformLogicalAnd": 362, + "OpGroupNonUniformLogicalOr": 363, + "OpGroupNonUniformLogicalXor": 364, + "OpGroupNonUniformQuadBroadcast": 365, + "OpGroupNonUniformQuadSwap": 366, + "OpSubgroupBallotKHR": 4421, + "OpSubgroupFirstInvocationKHR": 4422, + "OpSubgroupAllKHR": 4428, + "OpSubgroupAnyKHR": 4429, + "OpSubgroupAllEqualKHR": 4430, + "OpSubgroupReadInvocationKHR": 4432, + "OpGroupIAddNonUniformAMD": 5000, + "OpGroupFAddNonUniformAMD": 5001, + "OpGroupFMinNonUniformAMD": 5002, + "OpGroupUMinNonUniformAMD": 5003, + "OpGroupSMinNonUniformAMD": 5004, + "OpGroupFMaxNonUniformAMD": 5005, + "OpGroupUMaxNonUniformAMD": 5006, + "OpGroupSMaxNonUniformAMD": 5007, + "OpFragmentMaskFetchAMD": 5011, + "OpFragmentFetchAMD": 5012, + "OpGroupNonUniformPartitionNV": 5296, + "OpSubgroupShuffleINTEL": 5571, + "OpSubgroupShuffleDownINTEL": 5572, + "OpSubgroupShuffleUpINTEL": 5573, + "OpSubgroupShuffleXorINTEL": 5574, + "OpSubgroupBlockReadINTEL": 5575, + "OpSubgroupBlockWriteINTEL": 5576, + "OpSubgroupImageBlockReadINTEL": 5577, + "OpSubgroupImageBlockWriteINTEL": 5578, + "OpDecorateStringGOOGLE": 5632, + "OpMemberDecorateStringGOOGLE": 5633 + } + } + ] + } +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.lua b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.lua new file mode 100644 index 00000000000..43e9ba5be47 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.lua @@ -0,0 +1,1049 @@ +-- Copyright (c) 2014-2018 The Khronos Group Inc. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and/or associated documentation files (the "Materials"), +-- to deal in the Materials without restriction, including without limitation +-- the rights to use, copy, modify, merge, publish, distribute, sublicense, +-- and/or sell copies of the Materials, and to permit persons to whom the +-- Materials are furnished to do so, subject to the following conditions: +-- +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Materials. +-- +-- MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +-- STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +-- HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +-- +-- THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +-- FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +-- IN THE MATERIALS. + +-- This header is automatically generated by the same tool that creates +-- the Binary Section of the SPIR-V specification. + +-- Enumeration tokens for SPIR-V, in various styles: +-- C, C++, C++11, JSON, Lua, Python +-- +-- - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +-- - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +-- - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +-- - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +-- - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +-- +-- Some tokens act like mask values, which can be OR'd together, +-- while others are mutually exclusive. The mask-like ones have +-- "Mask" in their name, and a parallel enum that has the shift +-- amount (1 << x) for each corresponding enumerant. + +spv = { + MagicNumber = 0x07230203, + Version = 0x00010300, + Revision = 1, + OpCodeMask = 0xffff, + WordCountShift = 16, + + SourceLanguage = { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + }, + + ExecutionModel = { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + }, + + AddressingModel = { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + }, + + MemoryModel = { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + }, + + ExecutionMode = { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + }, + + StorageClass = { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + }, + + Dim = { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + }, + + SamplerAddressingMode = { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + }, + + SamplerFilterMode = { + Nearest = 0, + Linear = 1, + }, + + ImageFormat = { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + }, + + ImageChannelOrder = { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + }, + + ImageChannelDataType = { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + }, + + ImageOperandsShift = { + Bias = 0, + Lod = 1, + Grad = 2, + ConstOffset = 3, + Offset = 4, + ConstOffsets = 5, + Sample = 6, + MinLod = 7, + }, + + ImageOperandsMask = { + MaskNone = 0, + Bias = 0x00000001, + Lod = 0x00000002, + Grad = 0x00000004, + ConstOffset = 0x00000008, + Offset = 0x00000010, + ConstOffsets = 0x00000020, + Sample = 0x00000040, + MinLod = 0x00000080, + }, + + FPFastMathModeShift = { + NotNaN = 0, + NotInf = 1, + NSZ = 2, + AllowRecip = 3, + Fast = 4, + }, + + FPFastMathModeMask = { + MaskNone = 0, + NotNaN = 0x00000001, + NotInf = 0x00000002, + NSZ = 0x00000004, + AllowRecip = 0x00000008, + Fast = 0x00000010, + }, + + FPRoundingMode = { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + }, + + LinkageType = { + Export = 0, + Import = 1, + }, + + AccessQualifier = { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + }, + + FunctionParameterAttribute = { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + }, + + Decoration = { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + NonUniformEXT = 5300, + HlslCounterBufferGOOGLE = 5634, + HlslSemanticGOOGLE = 5635, + }, + + BuiltIn = { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMask = 4416, + SubgroupEqMaskKHR = 4416, + SubgroupGeMask = 4417, + SubgroupGeMaskKHR = 4417, + SubgroupGtMask = 4418, + SubgroupGtMaskKHR = 4418, + SubgroupLeMask = 4419, + SubgroupLeMaskKHR = 4419, + SubgroupLtMask = 4420, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + FullyCoveredEXT = 5264, + }, + + SelectionControlShift = { + Flatten = 0, + DontFlatten = 1, + }, + + SelectionControlMask = { + MaskNone = 0, + Flatten = 0x00000001, + DontFlatten = 0x00000002, + }, + + LoopControlShift = { + Unroll = 0, + DontUnroll = 1, + DependencyInfinite = 2, + DependencyLength = 3, + }, + + LoopControlMask = { + MaskNone = 0, + Unroll = 0x00000001, + DontUnroll = 0x00000002, + DependencyInfinite = 0x00000004, + DependencyLength = 0x00000008, + }, + + FunctionControlShift = { + Inline = 0, + DontInline = 1, + Pure = 2, + Const = 3, + }, + + FunctionControlMask = { + MaskNone = 0, + Inline = 0x00000001, + DontInline = 0x00000002, + Pure = 0x00000004, + Const = 0x00000008, + }, + + MemorySemanticsShift = { + Acquire = 1, + Release = 2, + AcquireRelease = 3, + SequentiallyConsistent = 4, + UniformMemory = 6, + SubgroupMemory = 7, + WorkgroupMemory = 8, + CrossWorkgroupMemory = 9, + AtomicCounterMemory = 10, + ImageMemory = 11, + }, + + MemorySemanticsMask = { + MaskNone = 0, + Acquire = 0x00000002, + Release = 0x00000004, + AcquireRelease = 0x00000008, + SequentiallyConsistent = 0x00000010, + UniformMemory = 0x00000040, + SubgroupMemory = 0x00000080, + WorkgroupMemory = 0x00000100, + CrossWorkgroupMemory = 0x00000200, + AtomicCounterMemory = 0x00000400, + ImageMemory = 0x00000800, + }, + + MemoryAccessShift = { + Volatile = 0, + Aligned = 1, + Nontemporal = 2, + }, + + MemoryAccessMask = { + MaskNone = 0, + Volatile = 0x00000001, + Aligned = 0x00000002, + Nontemporal = 0x00000004, + }, + + Scope = { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + }, + + GroupOperation = { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + ClusteredReduce = 3, + PartitionedReduceNV = 6, + PartitionedInclusiveScanNV = 7, + PartitionedExclusiveScanNV = 8, + }, + + KernelEnqueueFlags = { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + }, + + KernelProfilingInfoShift = { + CmdExecTime = 0, + }, + + KernelProfilingInfoMask = { + MaskNone = 0, + CmdExecTime = 0x00000001, + }, + + Capability = { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + GroupNonUniform = 61, + GroupNonUniformVote = 62, + GroupNonUniformArithmetic = 63, + GroupNonUniformBallot = 64, + GroupNonUniformShuffle = 65, + GroupNonUniformShuffleRelative = 66, + GroupNonUniformClustered = 67, + GroupNonUniformQuad = 68, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + StorageUniform16 = 4434, + UniformAndStorageBuffer16BitAccess = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + StorageBuffer8BitAccess = 4448, + UniformAndStorageBuffer8BitAccess = 4449, + StoragePushConstant8 = 4450, + Float16ImageAMD = 5008, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + FragmentFullyCoveredEXT = 5265, + GroupNonUniformPartitionedNV = 5297, + ShaderNonUniformEXT = 5301, + RuntimeDescriptorArrayEXT = 5302, + InputAttachmentArrayDynamicIndexingEXT = 5303, + UniformTexelBufferArrayDynamicIndexingEXT = 5304, + StorageTexelBufferArrayDynamicIndexingEXT = 5305, + UniformBufferArrayNonUniformIndexingEXT = 5306, + SampledImageArrayNonUniformIndexingEXT = 5307, + StorageBufferArrayNonUniformIndexingEXT = 5308, + StorageImageArrayNonUniformIndexingEXT = 5309, + InputAttachmentArrayNonUniformIndexingEXT = 5310, + UniformTexelBufferArrayNonUniformIndexingEXT = 5311, + StorageTexelBufferArrayNonUniformIndexingEXT = 5312, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + }, + + Op = { + OpNop = 0, + OpUndef = 1, + OpSourceContinued = 2, + OpSource = 3, + OpSourceExtension = 4, + OpName = 5, + OpMemberName = 6, + OpString = 7, + OpLine = 8, + OpExtension = 10, + OpExtInstImport = 11, + OpExtInst = 12, + OpMemoryModel = 14, + OpEntryPoint = 15, + OpExecutionMode = 16, + OpCapability = 17, + OpTypeVoid = 19, + OpTypeBool = 20, + OpTypeInt = 21, + OpTypeFloat = 22, + OpTypeVector = 23, + OpTypeMatrix = 24, + OpTypeImage = 25, + OpTypeSampler = 26, + OpTypeSampledImage = 27, + OpTypeArray = 28, + OpTypeRuntimeArray = 29, + OpTypeStruct = 30, + OpTypeOpaque = 31, + OpTypePointer = 32, + OpTypeFunction = 33, + OpTypeEvent = 34, + OpTypeDeviceEvent = 35, + OpTypeReserveId = 36, + OpTypeQueue = 37, + OpTypePipe = 38, + OpTypeForwardPointer = 39, + OpConstantTrue = 41, + OpConstantFalse = 42, + OpConstant = 43, + OpConstantComposite = 44, + OpConstantSampler = 45, + OpConstantNull = 46, + OpSpecConstantTrue = 48, + OpSpecConstantFalse = 49, + OpSpecConstant = 50, + OpSpecConstantComposite = 51, + OpSpecConstantOp = 52, + OpFunction = 54, + OpFunctionParameter = 55, + OpFunctionEnd = 56, + OpFunctionCall = 57, + OpVariable = 59, + OpImageTexelPointer = 60, + OpLoad = 61, + OpStore = 62, + OpCopyMemory = 63, + OpCopyMemorySized = 64, + OpAccessChain = 65, + OpInBoundsAccessChain = 66, + OpPtrAccessChain = 67, + OpArrayLength = 68, + OpGenericPtrMemSemantics = 69, + OpInBoundsPtrAccessChain = 70, + OpDecorate = 71, + OpMemberDecorate = 72, + OpDecorationGroup = 73, + OpGroupDecorate = 74, + OpGroupMemberDecorate = 75, + OpVectorExtractDynamic = 77, + OpVectorInsertDynamic = 78, + OpVectorShuffle = 79, + OpCompositeConstruct = 80, + OpCompositeExtract = 81, + OpCompositeInsert = 82, + OpCopyObject = 83, + OpTranspose = 84, + OpSampledImage = 86, + OpImageSampleImplicitLod = 87, + OpImageSampleExplicitLod = 88, + OpImageSampleDrefImplicitLod = 89, + OpImageSampleDrefExplicitLod = 90, + OpImageSampleProjImplicitLod = 91, + OpImageSampleProjExplicitLod = 92, + OpImageSampleProjDrefImplicitLod = 93, + OpImageSampleProjDrefExplicitLod = 94, + OpImageFetch = 95, + OpImageGather = 96, + OpImageDrefGather = 97, + OpImageRead = 98, + OpImageWrite = 99, + OpImage = 100, + OpImageQueryFormat = 101, + OpImageQueryOrder = 102, + OpImageQuerySizeLod = 103, + OpImageQuerySize = 104, + OpImageQueryLod = 105, + OpImageQueryLevels = 106, + OpImageQuerySamples = 107, + OpConvertFToU = 109, + OpConvertFToS = 110, + OpConvertSToF = 111, + OpConvertUToF = 112, + OpUConvert = 113, + OpSConvert = 114, + OpFConvert = 115, + OpQuantizeToF16 = 116, + OpConvertPtrToU = 117, + OpSatConvertSToU = 118, + OpSatConvertUToS = 119, + OpConvertUToPtr = 120, + OpPtrCastToGeneric = 121, + OpGenericCastToPtr = 122, + OpGenericCastToPtrExplicit = 123, + OpBitcast = 124, + OpSNegate = 126, + OpFNegate = 127, + OpIAdd = 128, + OpFAdd = 129, + OpISub = 130, + OpFSub = 131, + OpIMul = 132, + OpFMul = 133, + OpUDiv = 134, + OpSDiv = 135, + OpFDiv = 136, + OpUMod = 137, + OpSRem = 138, + OpSMod = 139, + OpFRem = 140, + OpFMod = 141, + OpVectorTimesScalar = 142, + OpMatrixTimesScalar = 143, + OpVectorTimesMatrix = 144, + OpMatrixTimesVector = 145, + OpMatrixTimesMatrix = 146, + OpOuterProduct = 147, + OpDot = 148, + OpIAddCarry = 149, + OpISubBorrow = 150, + OpUMulExtended = 151, + OpSMulExtended = 152, + OpAny = 154, + OpAll = 155, + OpIsNan = 156, + OpIsInf = 157, + OpIsFinite = 158, + OpIsNormal = 159, + OpSignBitSet = 160, + OpLessOrGreater = 161, + OpOrdered = 162, + OpUnordered = 163, + OpLogicalEqual = 164, + OpLogicalNotEqual = 165, + OpLogicalOr = 166, + OpLogicalAnd = 167, + OpLogicalNot = 168, + OpSelect = 169, + OpIEqual = 170, + OpINotEqual = 171, + OpUGreaterThan = 172, + OpSGreaterThan = 173, + OpUGreaterThanEqual = 174, + OpSGreaterThanEqual = 175, + OpULessThan = 176, + OpSLessThan = 177, + OpULessThanEqual = 178, + OpSLessThanEqual = 179, + OpFOrdEqual = 180, + OpFUnordEqual = 181, + OpFOrdNotEqual = 182, + OpFUnordNotEqual = 183, + OpFOrdLessThan = 184, + OpFUnordLessThan = 185, + OpFOrdGreaterThan = 186, + OpFUnordGreaterThan = 187, + OpFOrdLessThanEqual = 188, + OpFUnordLessThanEqual = 189, + OpFOrdGreaterThanEqual = 190, + OpFUnordGreaterThanEqual = 191, + OpShiftRightLogical = 194, + OpShiftRightArithmetic = 195, + OpShiftLeftLogical = 196, + OpBitwiseOr = 197, + OpBitwiseXor = 198, + OpBitwiseAnd = 199, + OpNot = 200, + OpBitFieldInsert = 201, + OpBitFieldSExtract = 202, + OpBitFieldUExtract = 203, + OpBitReverse = 204, + OpBitCount = 205, + OpDPdx = 207, + OpDPdy = 208, + OpFwidth = 209, + OpDPdxFine = 210, + OpDPdyFine = 211, + OpFwidthFine = 212, + OpDPdxCoarse = 213, + OpDPdyCoarse = 214, + OpFwidthCoarse = 215, + OpEmitVertex = 218, + OpEndPrimitive = 219, + OpEmitStreamVertex = 220, + OpEndStreamPrimitive = 221, + OpControlBarrier = 224, + OpMemoryBarrier = 225, + OpAtomicLoad = 227, + OpAtomicStore = 228, + OpAtomicExchange = 229, + OpAtomicCompareExchange = 230, + OpAtomicCompareExchangeWeak = 231, + OpAtomicIIncrement = 232, + OpAtomicIDecrement = 233, + OpAtomicIAdd = 234, + OpAtomicISub = 235, + OpAtomicSMin = 236, + OpAtomicUMin = 237, + OpAtomicSMax = 238, + OpAtomicUMax = 239, + OpAtomicAnd = 240, + OpAtomicOr = 241, + OpAtomicXor = 242, + OpPhi = 245, + OpLoopMerge = 246, + OpSelectionMerge = 247, + OpLabel = 248, + OpBranch = 249, + OpBranchConditional = 250, + OpSwitch = 251, + OpKill = 252, + OpReturn = 253, + OpReturnValue = 254, + OpUnreachable = 255, + OpLifetimeStart = 256, + OpLifetimeStop = 257, + OpGroupAsyncCopy = 259, + OpGroupWaitEvents = 260, + OpGroupAll = 261, + OpGroupAny = 262, + OpGroupBroadcast = 263, + OpGroupIAdd = 264, + OpGroupFAdd = 265, + OpGroupFMin = 266, + OpGroupUMin = 267, + OpGroupSMin = 268, + OpGroupFMax = 269, + OpGroupUMax = 270, + OpGroupSMax = 271, + OpReadPipe = 274, + OpWritePipe = 275, + OpReservedReadPipe = 276, + OpReservedWritePipe = 277, + OpReserveReadPipePackets = 278, + OpReserveWritePipePackets = 279, + OpCommitReadPipe = 280, + OpCommitWritePipe = 281, + OpIsValidReserveId = 282, + OpGetNumPipePackets = 283, + OpGetMaxPipePackets = 284, + OpGroupReserveReadPipePackets = 285, + OpGroupReserveWritePipePackets = 286, + OpGroupCommitReadPipe = 287, + OpGroupCommitWritePipe = 288, + OpEnqueueMarker = 291, + OpEnqueueKernel = 292, + OpGetKernelNDrangeSubGroupCount = 293, + OpGetKernelNDrangeMaxSubGroupSize = 294, + OpGetKernelWorkGroupSize = 295, + OpGetKernelPreferredWorkGroupSizeMultiple = 296, + OpRetainEvent = 297, + OpReleaseEvent = 298, + OpCreateUserEvent = 299, + OpIsValidEvent = 300, + OpSetUserEventStatus = 301, + OpCaptureEventProfilingInfo = 302, + OpGetDefaultQueue = 303, + OpBuildNDRange = 304, + OpImageSparseSampleImplicitLod = 305, + OpImageSparseSampleExplicitLod = 306, + OpImageSparseSampleDrefImplicitLod = 307, + OpImageSparseSampleDrefExplicitLod = 308, + OpImageSparseSampleProjImplicitLod = 309, + OpImageSparseSampleProjExplicitLod = 310, + OpImageSparseSampleProjDrefImplicitLod = 311, + OpImageSparseSampleProjDrefExplicitLod = 312, + OpImageSparseFetch = 313, + OpImageSparseGather = 314, + OpImageSparseDrefGather = 315, + OpImageSparseTexelsResident = 316, + OpNoLine = 317, + OpAtomicFlagTestAndSet = 318, + OpAtomicFlagClear = 319, + OpImageSparseRead = 320, + OpSizeOf = 321, + OpTypePipeStorage = 322, + OpConstantPipeStorage = 323, + OpCreatePipeFromPipeStorage = 324, + OpGetKernelLocalSizeForSubgroupCount = 325, + OpGetKernelMaxNumSubgroups = 326, + OpTypeNamedBarrier = 327, + OpNamedBarrierInitialize = 328, + OpMemoryNamedBarrier = 329, + OpModuleProcessed = 330, + OpExecutionModeId = 331, + OpDecorateId = 332, + OpGroupNonUniformElect = 333, + OpGroupNonUniformAll = 334, + OpGroupNonUniformAny = 335, + OpGroupNonUniformAllEqual = 336, + OpGroupNonUniformBroadcast = 337, + OpGroupNonUniformBroadcastFirst = 338, + OpGroupNonUniformBallot = 339, + OpGroupNonUniformInverseBallot = 340, + OpGroupNonUniformBallotBitExtract = 341, + OpGroupNonUniformBallotBitCount = 342, + OpGroupNonUniformBallotFindLSB = 343, + OpGroupNonUniformBallotFindMSB = 344, + OpGroupNonUniformShuffle = 345, + OpGroupNonUniformShuffleXor = 346, + OpGroupNonUniformShuffleUp = 347, + OpGroupNonUniformShuffleDown = 348, + OpGroupNonUniformIAdd = 349, + OpGroupNonUniformFAdd = 350, + OpGroupNonUniformIMul = 351, + OpGroupNonUniformFMul = 352, + OpGroupNonUniformSMin = 353, + OpGroupNonUniformUMin = 354, + OpGroupNonUniformFMin = 355, + OpGroupNonUniformSMax = 356, + OpGroupNonUniformUMax = 357, + OpGroupNonUniformFMax = 358, + OpGroupNonUniformBitwiseAnd = 359, + OpGroupNonUniformBitwiseOr = 360, + OpGroupNonUniformBitwiseXor = 361, + OpGroupNonUniformLogicalAnd = 362, + OpGroupNonUniformLogicalOr = 363, + OpGroupNonUniformLogicalXor = 364, + OpGroupNonUniformQuadBroadcast = 365, + OpGroupNonUniformQuadSwap = 366, + OpSubgroupBallotKHR = 4421, + OpSubgroupFirstInvocationKHR = 4422, + OpSubgroupAllKHR = 4428, + OpSubgroupAnyKHR = 4429, + OpSubgroupAllEqualKHR = 4430, + OpSubgroupReadInvocationKHR = 4432, + OpGroupIAddNonUniformAMD = 5000, + OpGroupFAddNonUniformAMD = 5001, + OpGroupFMinNonUniformAMD = 5002, + OpGroupUMinNonUniformAMD = 5003, + OpGroupSMinNonUniformAMD = 5004, + OpGroupFMaxNonUniformAMD = 5005, + OpGroupUMaxNonUniformAMD = 5006, + OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpGroupNonUniformPartitionNV = 5296, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, + OpDecorateStringGOOGLE = 5632, + OpMemberDecorateStringGOOGLE = 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.py b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.py new file mode 100644 index 00000000000..cb3775ff9a1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/include/spirv/unified1/spirv.py @@ -0,0 +1,1049 @@ +# Copyright (c) 2014-2018 The Khronos Group Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and/or associated documentation files (the "Materials"), +# to deal in the Materials without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Materials, and to permit persons to whom the +# Materials are furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Materials. +# +# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +# STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +# HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +# +# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +# IN THE MATERIALS. + +# This header is automatically generated by the same tool that creates +# the Binary Section of the SPIR-V specification. + +# Enumeration tokens for SPIR-V, in various styles: +# C, C++, C++11, JSON, Lua, Python +# +# - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL +# - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL +# - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL +# - Lua will use tables, e.g.: spv.SourceLanguage.GLSL +# - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL'] +# +# Some tokens act like mask values, which can be OR'd together, +# while others are mutually exclusive. The mask-like ones have +# "Mask" in their name, and a parallel enum that has the shift +# amount (1 << x) for each corresponding enumerant. + +spv = { + 'MagicNumber' : 0x07230203, + 'Version' : 0x00010300, + 'Revision' : 1, + 'OpCodeMask' : 0xffff, + 'WordCountShift' : 16, + + 'SourceLanguage' : { + 'Unknown' : 0, + 'ESSL' : 1, + 'GLSL' : 2, + 'OpenCL_C' : 3, + 'OpenCL_CPP' : 4, + 'HLSL' : 5, + }, + + 'ExecutionModel' : { + 'Vertex' : 0, + 'TessellationControl' : 1, + 'TessellationEvaluation' : 2, + 'Geometry' : 3, + 'Fragment' : 4, + 'GLCompute' : 5, + 'Kernel' : 6, + }, + + 'AddressingModel' : { + 'Logical' : 0, + 'Physical32' : 1, + 'Physical64' : 2, + }, + + 'MemoryModel' : { + 'Simple' : 0, + 'GLSL450' : 1, + 'OpenCL' : 2, + }, + + 'ExecutionMode' : { + 'Invocations' : 0, + 'SpacingEqual' : 1, + 'SpacingFractionalEven' : 2, + 'SpacingFractionalOdd' : 3, + 'VertexOrderCw' : 4, + 'VertexOrderCcw' : 5, + 'PixelCenterInteger' : 6, + 'OriginUpperLeft' : 7, + 'OriginLowerLeft' : 8, + 'EarlyFragmentTests' : 9, + 'PointMode' : 10, + 'Xfb' : 11, + 'DepthReplacing' : 12, + 'DepthGreater' : 14, + 'DepthLess' : 15, + 'DepthUnchanged' : 16, + 'LocalSize' : 17, + 'LocalSizeHint' : 18, + 'InputPoints' : 19, + 'InputLines' : 20, + 'InputLinesAdjacency' : 21, + 'Triangles' : 22, + 'InputTrianglesAdjacency' : 23, + 'Quads' : 24, + 'Isolines' : 25, + 'OutputVertices' : 26, + 'OutputPoints' : 27, + 'OutputLineStrip' : 28, + 'OutputTriangleStrip' : 29, + 'VecTypeHint' : 30, + 'ContractionOff' : 31, + 'Initializer' : 33, + 'Finalizer' : 34, + 'SubgroupSize' : 35, + 'SubgroupsPerWorkgroup' : 36, + 'SubgroupsPerWorkgroupId' : 37, + 'LocalSizeId' : 38, + 'LocalSizeHintId' : 39, + 'PostDepthCoverage' : 4446, + 'StencilRefReplacingEXT' : 5027, + }, + + 'StorageClass' : { + 'UniformConstant' : 0, + 'Input' : 1, + 'Uniform' : 2, + 'Output' : 3, + 'Workgroup' : 4, + 'CrossWorkgroup' : 5, + 'Private' : 6, + 'Function' : 7, + 'Generic' : 8, + 'PushConstant' : 9, + 'AtomicCounter' : 10, + 'Image' : 11, + 'StorageBuffer' : 12, + }, + + 'Dim' : { + 'Dim1D' : 0, + 'Dim2D' : 1, + 'Dim3D' : 2, + 'Cube' : 3, + 'Rect' : 4, + 'Buffer' : 5, + 'SubpassData' : 6, + }, + + 'SamplerAddressingMode' : { + 'None' : 0, + 'ClampToEdge' : 1, + 'Clamp' : 2, + 'Repeat' : 3, + 'RepeatMirrored' : 4, + }, + + 'SamplerFilterMode' : { + 'Nearest' : 0, + 'Linear' : 1, + }, + + 'ImageFormat' : { + 'Unknown' : 0, + 'Rgba32f' : 1, + 'Rgba16f' : 2, + 'R32f' : 3, + 'Rgba8' : 4, + 'Rgba8Snorm' : 5, + 'Rg32f' : 6, + 'Rg16f' : 7, + 'R11fG11fB10f' : 8, + 'R16f' : 9, + 'Rgba16' : 10, + 'Rgb10A2' : 11, + 'Rg16' : 12, + 'Rg8' : 13, + 'R16' : 14, + 'R8' : 15, + 'Rgba16Snorm' : 16, + 'Rg16Snorm' : 17, + 'Rg8Snorm' : 18, + 'R16Snorm' : 19, + 'R8Snorm' : 20, + 'Rgba32i' : 21, + 'Rgba16i' : 22, + 'Rgba8i' : 23, + 'R32i' : 24, + 'Rg32i' : 25, + 'Rg16i' : 26, + 'Rg8i' : 27, + 'R16i' : 28, + 'R8i' : 29, + 'Rgba32ui' : 30, + 'Rgba16ui' : 31, + 'Rgba8ui' : 32, + 'R32ui' : 33, + 'Rgb10a2ui' : 34, + 'Rg32ui' : 35, + 'Rg16ui' : 36, + 'Rg8ui' : 37, + 'R16ui' : 38, + 'R8ui' : 39, + }, + + 'ImageChannelOrder' : { + 'R' : 0, + 'A' : 1, + 'RG' : 2, + 'RA' : 3, + 'RGB' : 4, + 'RGBA' : 5, + 'BGRA' : 6, + 'ARGB' : 7, + 'Intensity' : 8, + 'Luminance' : 9, + 'Rx' : 10, + 'RGx' : 11, + 'RGBx' : 12, + 'Depth' : 13, + 'DepthStencil' : 14, + 'sRGB' : 15, + 'sRGBx' : 16, + 'sRGBA' : 17, + 'sBGRA' : 18, + 'ABGR' : 19, + }, + + 'ImageChannelDataType' : { + 'SnormInt8' : 0, + 'SnormInt16' : 1, + 'UnormInt8' : 2, + 'UnormInt16' : 3, + 'UnormShort565' : 4, + 'UnormShort555' : 5, + 'UnormInt101010' : 6, + 'SignedInt8' : 7, + 'SignedInt16' : 8, + 'SignedInt32' : 9, + 'UnsignedInt8' : 10, + 'UnsignedInt16' : 11, + 'UnsignedInt32' : 12, + 'HalfFloat' : 13, + 'Float' : 14, + 'UnormInt24' : 15, + 'UnormInt101010_2' : 16, + }, + + 'ImageOperandsShift' : { + 'Bias' : 0, + 'Lod' : 1, + 'Grad' : 2, + 'ConstOffset' : 3, + 'Offset' : 4, + 'ConstOffsets' : 5, + 'Sample' : 6, + 'MinLod' : 7, + }, + + 'ImageOperandsMask' : { + 'MaskNone' : 0, + 'Bias' : 0x00000001, + 'Lod' : 0x00000002, + 'Grad' : 0x00000004, + 'ConstOffset' : 0x00000008, + 'Offset' : 0x00000010, + 'ConstOffsets' : 0x00000020, + 'Sample' : 0x00000040, + 'MinLod' : 0x00000080, + }, + + 'FPFastMathModeShift' : { + 'NotNaN' : 0, + 'NotInf' : 1, + 'NSZ' : 2, + 'AllowRecip' : 3, + 'Fast' : 4, + }, + + 'FPFastMathModeMask' : { + 'MaskNone' : 0, + 'NotNaN' : 0x00000001, + 'NotInf' : 0x00000002, + 'NSZ' : 0x00000004, + 'AllowRecip' : 0x00000008, + 'Fast' : 0x00000010, + }, + + 'FPRoundingMode' : { + 'RTE' : 0, + 'RTZ' : 1, + 'RTP' : 2, + 'RTN' : 3, + }, + + 'LinkageType' : { + 'Export' : 0, + 'Import' : 1, + }, + + 'AccessQualifier' : { + 'ReadOnly' : 0, + 'WriteOnly' : 1, + 'ReadWrite' : 2, + }, + + 'FunctionParameterAttribute' : { + 'Zext' : 0, + 'Sext' : 1, + 'ByVal' : 2, + 'Sret' : 3, + 'NoAlias' : 4, + 'NoCapture' : 5, + 'NoWrite' : 6, + 'NoReadWrite' : 7, + }, + + 'Decoration' : { + 'RelaxedPrecision' : 0, + 'SpecId' : 1, + 'Block' : 2, + 'BufferBlock' : 3, + 'RowMajor' : 4, + 'ColMajor' : 5, + 'ArrayStride' : 6, + 'MatrixStride' : 7, + 'GLSLShared' : 8, + 'GLSLPacked' : 9, + 'CPacked' : 10, + 'BuiltIn' : 11, + 'NoPerspective' : 13, + 'Flat' : 14, + 'Patch' : 15, + 'Centroid' : 16, + 'Sample' : 17, + 'Invariant' : 18, + 'Restrict' : 19, + 'Aliased' : 20, + 'Volatile' : 21, + 'Constant' : 22, + 'Coherent' : 23, + 'NonWritable' : 24, + 'NonReadable' : 25, + 'Uniform' : 26, + 'SaturatedConversion' : 28, + 'Stream' : 29, + 'Location' : 30, + 'Component' : 31, + 'Index' : 32, + 'Binding' : 33, + 'DescriptorSet' : 34, + 'Offset' : 35, + 'XfbBuffer' : 36, + 'XfbStride' : 37, + 'FuncParamAttr' : 38, + 'FPRoundingMode' : 39, + 'FPFastMathMode' : 40, + 'LinkageAttributes' : 41, + 'NoContraction' : 42, + 'InputAttachmentIndex' : 43, + 'Alignment' : 44, + 'MaxByteOffset' : 45, + 'AlignmentId' : 46, + 'MaxByteOffsetId' : 47, + 'ExplicitInterpAMD' : 4999, + 'OverrideCoverageNV' : 5248, + 'PassthroughNV' : 5250, + 'ViewportRelativeNV' : 5252, + 'SecondaryViewportRelativeNV' : 5256, + 'NonUniformEXT' : 5300, + 'HlslCounterBufferGOOGLE' : 5634, + 'HlslSemanticGOOGLE' : 5635, + }, + + 'BuiltIn' : { + 'Position' : 0, + 'PointSize' : 1, + 'ClipDistance' : 3, + 'CullDistance' : 4, + 'VertexId' : 5, + 'InstanceId' : 6, + 'PrimitiveId' : 7, + 'InvocationId' : 8, + 'Layer' : 9, + 'ViewportIndex' : 10, + 'TessLevelOuter' : 11, + 'TessLevelInner' : 12, + 'TessCoord' : 13, + 'PatchVertices' : 14, + 'FragCoord' : 15, + 'PointCoord' : 16, + 'FrontFacing' : 17, + 'SampleId' : 18, + 'SamplePosition' : 19, + 'SampleMask' : 20, + 'FragDepth' : 22, + 'HelperInvocation' : 23, + 'NumWorkgroups' : 24, + 'WorkgroupSize' : 25, + 'WorkgroupId' : 26, + 'LocalInvocationId' : 27, + 'GlobalInvocationId' : 28, + 'LocalInvocationIndex' : 29, + 'WorkDim' : 30, + 'GlobalSize' : 31, + 'EnqueuedWorkgroupSize' : 32, + 'GlobalOffset' : 33, + 'GlobalLinearId' : 34, + 'SubgroupSize' : 36, + 'SubgroupMaxSize' : 37, + 'NumSubgroups' : 38, + 'NumEnqueuedSubgroups' : 39, + 'SubgroupId' : 40, + 'SubgroupLocalInvocationId' : 41, + 'VertexIndex' : 42, + 'InstanceIndex' : 43, + 'SubgroupEqMask' : 4416, + 'SubgroupEqMaskKHR' : 4416, + 'SubgroupGeMask' : 4417, + 'SubgroupGeMaskKHR' : 4417, + 'SubgroupGtMask' : 4418, + 'SubgroupGtMaskKHR' : 4418, + 'SubgroupLeMask' : 4419, + 'SubgroupLeMaskKHR' : 4419, + 'SubgroupLtMask' : 4420, + 'SubgroupLtMaskKHR' : 4420, + 'BaseVertex' : 4424, + 'BaseInstance' : 4425, + 'DrawIndex' : 4426, + 'DeviceIndex' : 4438, + 'ViewIndex' : 4440, + 'BaryCoordNoPerspAMD' : 4992, + 'BaryCoordNoPerspCentroidAMD' : 4993, + 'BaryCoordNoPerspSampleAMD' : 4994, + 'BaryCoordSmoothAMD' : 4995, + 'BaryCoordSmoothCentroidAMD' : 4996, + 'BaryCoordSmoothSampleAMD' : 4997, + 'BaryCoordPullModelAMD' : 4998, + 'FragStencilRefEXT' : 5014, + 'ViewportMaskNV' : 5253, + 'SecondaryPositionNV' : 5257, + 'SecondaryViewportMaskNV' : 5258, + 'PositionPerViewNV' : 5261, + 'ViewportMaskPerViewNV' : 5262, + 'FullyCoveredEXT' : 5264, + }, + + 'SelectionControlShift' : { + 'Flatten' : 0, + 'DontFlatten' : 1, + }, + + 'SelectionControlMask' : { + 'MaskNone' : 0, + 'Flatten' : 0x00000001, + 'DontFlatten' : 0x00000002, + }, + + 'LoopControlShift' : { + 'Unroll' : 0, + 'DontUnroll' : 1, + 'DependencyInfinite' : 2, + 'DependencyLength' : 3, + }, + + 'LoopControlMask' : { + 'MaskNone' : 0, + 'Unroll' : 0x00000001, + 'DontUnroll' : 0x00000002, + 'DependencyInfinite' : 0x00000004, + 'DependencyLength' : 0x00000008, + }, + + 'FunctionControlShift' : { + 'Inline' : 0, + 'DontInline' : 1, + 'Pure' : 2, + 'Const' : 3, + }, + + 'FunctionControlMask' : { + 'MaskNone' : 0, + 'Inline' : 0x00000001, + 'DontInline' : 0x00000002, + 'Pure' : 0x00000004, + 'Const' : 0x00000008, + }, + + 'MemorySemanticsShift' : { + 'Acquire' : 1, + 'Release' : 2, + 'AcquireRelease' : 3, + 'SequentiallyConsistent' : 4, + 'UniformMemory' : 6, + 'SubgroupMemory' : 7, + 'WorkgroupMemory' : 8, + 'CrossWorkgroupMemory' : 9, + 'AtomicCounterMemory' : 10, + 'ImageMemory' : 11, + }, + + 'MemorySemanticsMask' : { + 'MaskNone' : 0, + 'Acquire' : 0x00000002, + 'Release' : 0x00000004, + 'AcquireRelease' : 0x00000008, + 'SequentiallyConsistent' : 0x00000010, + 'UniformMemory' : 0x00000040, + 'SubgroupMemory' : 0x00000080, + 'WorkgroupMemory' : 0x00000100, + 'CrossWorkgroupMemory' : 0x00000200, + 'AtomicCounterMemory' : 0x00000400, + 'ImageMemory' : 0x00000800, + }, + + 'MemoryAccessShift' : { + 'Volatile' : 0, + 'Aligned' : 1, + 'Nontemporal' : 2, + }, + + 'MemoryAccessMask' : { + 'MaskNone' : 0, + 'Volatile' : 0x00000001, + 'Aligned' : 0x00000002, + 'Nontemporal' : 0x00000004, + }, + + 'Scope' : { + 'CrossDevice' : 0, + 'Device' : 1, + 'Workgroup' : 2, + 'Subgroup' : 3, + 'Invocation' : 4, + }, + + 'GroupOperation' : { + 'Reduce' : 0, + 'InclusiveScan' : 1, + 'ExclusiveScan' : 2, + 'ClusteredReduce' : 3, + 'PartitionedReduceNV' : 6, + 'PartitionedInclusiveScanNV' : 7, + 'PartitionedExclusiveScanNV' : 8, + }, + + 'KernelEnqueueFlags' : { + 'NoWait' : 0, + 'WaitKernel' : 1, + 'WaitWorkGroup' : 2, + }, + + 'KernelProfilingInfoShift' : { + 'CmdExecTime' : 0, + }, + + 'KernelProfilingInfoMask' : { + 'MaskNone' : 0, + 'CmdExecTime' : 0x00000001, + }, + + 'Capability' : { + 'Matrix' : 0, + 'Shader' : 1, + 'Geometry' : 2, + 'Tessellation' : 3, + 'Addresses' : 4, + 'Linkage' : 5, + 'Kernel' : 6, + 'Vector16' : 7, + 'Float16Buffer' : 8, + 'Float16' : 9, + 'Float64' : 10, + 'Int64' : 11, + 'Int64Atomics' : 12, + 'ImageBasic' : 13, + 'ImageReadWrite' : 14, + 'ImageMipmap' : 15, + 'Pipes' : 17, + 'Groups' : 18, + 'DeviceEnqueue' : 19, + 'LiteralSampler' : 20, + 'AtomicStorage' : 21, + 'Int16' : 22, + 'TessellationPointSize' : 23, + 'GeometryPointSize' : 24, + 'ImageGatherExtended' : 25, + 'StorageImageMultisample' : 27, + 'UniformBufferArrayDynamicIndexing' : 28, + 'SampledImageArrayDynamicIndexing' : 29, + 'StorageBufferArrayDynamicIndexing' : 30, + 'StorageImageArrayDynamicIndexing' : 31, + 'ClipDistance' : 32, + 'CullDistance' : 33, + 'ImageCubeArray' : 34, + 'SampleRateShading' : 35, + 'ImageRect' : 36, + 'SampledRect' : 37, + 'GenericPointer' : 38, + 'Int8' : 39, + 'InputAttachment' : 40, + 'SparseResidency' : 41, + 'MinLod' : 42, + 'Sampled1D' : 43, + 'Image1D' : 44, + 'SampledCubeArray' : 45, + 'SampledBuffer' : 46, + 'ImageBuffer' : 47, + 'ImageMSArray' : 48, + 'StorageImageExtendedFormats' : 49, + 'ImageQuery' : 50, + 'DerivativeControl' : 51, + 'InterpolationFunction' : 52, + 'TransformFeedback' : 53, + 'GeometryStreams' : 54, + 'StorageImageReadWithoutFormat' : 55, + 'StorageImageWriteWithoutFormat' : 56, + 'MultiViewport' : 57, + 'SubgroupDispatch' : 58, + 'NamedBarrier' : 59, + 'PipeStorage' : 60, + 'GroupNonUniform' : 61, + 'GroupNonUniformVote' : 62, + 'GroupNonUniformArithmetic' : 63, + 'GroupNonUniformBallot' : 64, + 'GroupNonUniformShuffle' : 65, + 'GroupNonUniformShuffleRelative' : 66, + 'GroupNonUniformClustered' : 67, + 'GroupNonUniformQuad' : 68, + 'SubgroupBallotKHR' : 4423, + 'DrawParameters' : 4427, + 'SubgroupVoteKHR' : 4431, + 'StorageBuffer16BitAccess' : 4433, + 'StorageUniformBufferBlock16' : 4433, + 'StorageUniform16' : 4434, + 'UniformAndStorageBuffer16BitAccess' : 4434, + 'StoragePushConstant16' : 4435, + 'StorageInputOutput16' : 4436, + 'DeviceGroup' : 4437, + 'MultiView' : 4439, + 'VariablePointersStorageBuffer' : 4441, + 'VariablePointers' : 4442, + 'AtomicStorageOps' : 4445, + 'SampleMaskPostDepthCoverage' : 4447, + 'StorageBuffer8BitAccess' : 4448, + 'UniformAndStorageBuffer8BitAccess' : 4449, + 'StoragePushConstant8' : 4450, + 'Float16ImageAMD' : 5008, + 'ImageGatherBiasLodAMD' : 5009, + 'FragmentMaskAMD' : 5010, + 'StencilExportEXT' : 5013, + 'ImageReadWriteLodAMD' : 5015, + 'SampleMaskOverrideCoverageNV' : 5249, + 'GeometryShaderPassthroughNV' : 5251, + 'ShaderViewportIndexLayerEXT' : 5254, + 'ShaderViewportIndexLayerNV' : 5254, + 'ShaderViewportMaskNV' : 5255, + 'ShaderStereoViewNV' : 5259, + 'PerViewAttributesNV' : 5260, + 'FragmentFullyCoveredEXT' : 5265, + 'GroupNonUniformPartitionedNV' : 5297, + 'ShaderNonUniformEXT' : 5301, + 'RuntimeDescriptorArrayEXT' : 5302, + 'InputAttachmentArrayDynamicIndexingEXT' : 5303, + 'UniformTexelBufferArrayDynamicIndexingEXT' : 5304, + 'StorageTexelBufferArrayDynamicIndexingEXT' : 5305, + 'UniformBufferArrayNonUniformIndexingEXT' : 5306, + 'SampledImageArrayNonUniformIndexingEXT' : 5307, + 'StorageBufferArrayNonUniformIndexingEXT' : 5308, + 'StorageImageArrayNonUniformIndexingEXT' : 5309, + 'InputAttachmentArrayNonUniformIndexingEXT' : 5310, + 'UniformTexelBufferArrayNonUniformIndexingEXT' : 5311, + 'StorageTexelBufferArrayNonUniformIndexingEXT' : 5312, + 'SubgroupShuffleINTEL' : 5568, + 'SubgroupBufferBlockIOINTEL' : 5569, + 'SubgroupImageBlockIOINTEL' : 5570, + }, + + 'Op' : { + 'OpNop' : 0, + 'OpUndef' : 1, + 'OpSourceContinued' : 2, + 'OpSource' : 3, + 'OpSourceExtension' : 4, + 'OpName' : 5, + 'OpMemberName' : 6, + 'OpString' : 7, + 'OpLine' : 8, + 'OpExtension' : 10, + 'OpExtInstImport' : 11, + 'OpExtInst' : 12, + 'OpMemoryModel' : 14, + 'OpEntryPoint' : 15, + 'OpExecutionMode' : 16, + 'OpCapability' : 17, + 'OpTypeVoid' : 19, + 'OpTypeBool' : 20, + 'OpTypeInt' : 21, + 'OpTypeFloat' : 22, + 'OpTypeVector' : 23, + 'OpTypeMatrix' : 24, + 'OpTypeImage' : 25, + 'OpTypeSampler' : 26, + 'OpTypeSampledImage' : 27, + 'OpTypeArray' : 28, + 'OpTypeRuntimeArray' : 29, + 'OpTypeStruct' : 30, + 'OpTypeOpaque' : 31, + 'OpTypePointer' : 32, + 'OpTypeFunction' : 33, + 'OpTypeEvent' : 34, + 'OpTypeDeviceEvent' : 35, + 'OpTypeReserveId' : 36, + 'OpTypeQueue' : 37, + 'OpTypePipe' : 38, + 'OpTypeForwardPointer' : 39, + 'OpConstantTrue' : 41, + 'OpConstantFalse' : 42, + 'OpConstant' : 43, + 'OpConstantComposite' : 44, + 'OpConstantSampler' : 45, + 'OpConstantNull' : 46, + 'OpSpecConstantTrue' : 48, + 'OpSpecConstantFalse' : 49, + 'OpSpecConstant' : 50, + 'OpSpecConstantComposite' : 51, + 'OpSpecConstantOp' : 52, + 'OpFunction' : 54, + 'OpFunctionParameter' : 55, + 'OpFunctionEnd' : 56, + 'OpFunctionCall' : 57, + 'OpVariable' : 59, + 'OpImageTexelPointer' : 60, + 'OpLoad' : 61, + 'OpStore' : 62, + 'OpCopyMemory' : 63, + 'OpCopyMemorySized' : 64, + 'OpAccessChain' : 65, + 'OpInBoundsAccessChain' : 66, + 'OpPtrAccessChain' : 67, + 'OpArrayLength' : 68, + 'OpGenericPtrMemSemantics' : 69, + 'OpInBoundsPtrAccessChain' : 70, + 'OpDecorate' : 71, + 'OpMemberDecorate' : 72, + 'OpDecorationGroup' : 73, + 'OpGroupDecorate' : 74, + 'OpGroupMemberDecorate' : 75, + 'OpVectorExtractDynamic' : 77, + 'OpVectorInsertDynamic' : 78, + 'OpVectorShuffle' : 79, + 'OpCompositeConstruct' : 80, + 'OpCompositeExtract' : 81, + 'OpCompositeInsert' : 82, + 'OpCopyObject' : 83, + 'OpTranspose' : 84, + 'OpSampledImage' : 86, + 'OpImageSampleImplicitLod' : 87, + 'OpImageSampleExplicitLod' : 88, + 'OpImageSampleDrefImplicitLod' : 89, + 'OpImageSampleDrefExplicitLod' : 90, + 'OpImageSampleProjImplicitLod' : 91, + 'OpImageSampleProjExplicitLod' : 92, + 'OpImageSampleProjDrefImplicitLod' : 93, + 'OpImageSampleProjDrefExplicitLod' : 94, + 'OpImageFetch' : 95, + 'OpImageGather' : 96, + 'OpImageDrefGather' : 97, + 'OpImageRead' : 98, + 'OpImageWrite' : 99, + 'OpImage' : 100, + 'OpImageQueryFormat' : 101, + 'OpImageQueryOrder' : 102, + 'OpImageQuerySizeLod' : 103, + 'OpImageQuerySize' : 104, + 'OpImageQueryLod' : 105, + 'OpImageQueryLevels' : 106, + 'OpImageQuerySamples' : 107, + 'OpConvertFToU' : 109, + 'OpConvertFToS' : 110, + 'OpConvertSToF' : 111, + 'OpConvertUToF' : 112, + 'OpUConvert' : 113, + 'OpSConvert' : 114, + 'OpFConvert' : 115, + 'OpQuantizeToF16' : 116, + 'OpConvertPtrToU' : 117, + 'OpSatConvertSToU' : 118, + 'OpSatConvertUToS' : 119, + 'OpConvertUToPtr' : 120, + 'OpPtrCastToGeneric' : 121, + 'OpGenericCastToPtr' : 122, + 'OpGenericCastToPtrExplicit' : 123, + 'OpBitcast' : 124, + 'OpSNegate' : 126, + 'OpFNegate' : 127, + 'OpIAdd' : 128, + 'OpFAdd' : 129, + 'OpISub' : 130, + 'OpFSub' : 131, + 'OpIMul' : 132, + 'OpFMul' : 133, + 'OpUDiv' : 134, + 'OpSDiv' : 135, + 'OpFDiv' : 136, + 'OpUMod' : 137, + 'OpSRem' : 138, + 'OpSMod' : 139, + 'OpFRem' : 140, + 'OpFMod' : 141, + 'OpVectorTimesScalar' : 142, + 'OpMatrixTimesScalar' : 143, + 'OpVectorTimesMatrix' : 144, + 'OpMatrixTimesVector' : 145, + 'OpMatrixTimesMatrix' : 146, + 'OpOuterProduct' : 147, + 'OpDot' : 148, + 'OpIAddCarry' : 149, + 'OpISubBorrow' : 150, + 'OpUMulExtended' : 151, + 'OpSMulExtended' : 152, + 'OpAny' : 154, + 'OpAll' : 155, + 'OpIsNan' : 156, + 'OpIsInf' : 157, + 'OpIsFinite' : 158, + 'OpIsNormal' : 159, + 'OpSignBitSet' : 160, + 'OpLessOrGreater' : 161, + 'OpOrdered' : 162, + 'OpUnordered' : 163, + 'OpLogicalEqual' : 164, + 'OpLogicalNotEqual' : 165, + 'OpLogicalOr' : 166, + 'OpLogicalAnd' : 167, + 'OpLogicalNot' : 168, + 'OpSelect' : 169, + 'OpIEqual' : 170, + 'OpINotEqual' : 171, + 'OpUGreaterThan' : 172, + 'OpSGreaterThan' : 173, + 'OpUGreaterThanEqual' : 174, + 'OpSGreaterThanEqual' : 175, + 'OpULessThan' : 176, + 'OpSLessThan' : 177, + 'OpULessThanEqual' : 178, + 'OpSLessThanEqual' : 179, + 'OpFOrdEqual' : 180, + 'OpFUnordEqual' : 181, + 'OpFOrdNotEqual' : 182, + 'OpFUnordNotEqual' : 183, + 'OpFOrdLessThan' : 184, + 'OpFUnordLessThan' : 185, + 'OpFOrdGreaterThan' : 186, + 'OpFUnordGreaterThan' : 187, + 'OpFOrdLessThanEqual' : 188, + 'OpFUnordLessThanEqual' : 189, + 'OpFOrdGreaterThanEqual' : 190, + 'OpFUnordGreaterThanEqual' : 191, + 'OpShiftRightLogical' : 194, + 'OpShiftRightArithmetic' : 195, + 'OpShiftLeftLogical' : 196, + 'OpBitwiseOr' : 197, + 'OpBitwiseXor' : 198, + 'OpBitwiseAnd' : 199, + 'OpNot' : 200, + 'OpBitFieldInsert' : 201, + 'OpBitFieldSExtract' : 202, + 'OpBitFieldUExtract' : 203, + 'OpBitReverse' : 204, + 'OpBitCount' : 205, + 'OpDPdx' : 207, + 'OpDPdy' : 208, + 'OpFwidth' : 209, + 'OpDPdxFine' : 210, + 'OpDPdyFine' : 211, + 'OpFwidthFine' : 212, + 'OpDPdxCoarse' : 213, + 'OpDPdyCoarse' : 214, + 'OpFwidthCoarse' : 215, + 'OpEmitVertex' : 218, + 'OpEndPrimitive' : 219, + 'OpEmitStreamVertex' : 220, + 'OpEndStreamPrimitive' : 221, + 'OpControlBarrier' : 224, + 'OpMemoryBarrier' : 225, + 'OpAtomicLoad' : 227, + 'OpAtomicStore' : 228, + 'OpAtomicExchange' : 229, + 'OpAtomicCompareExchange' : 230, + 'OpAtomicCompareExchangeWeak' : 231, + 'OpAtomicIIncrement' : 232, + 'OpAtomicIDecrement' : 233, + 'OpAtomicIAdd' : 234, + 'OpAtomicISub' : 235, + 'OpAtomicSMin' : 236, + 'OpAtomicUMin' : 237, + 'OpAtomicSMax' : 238, + 'OpAtomicUMax' : 239, + 'OpAtomicAnd' : 240, + 'OpAtomicOr' : 241, + 'OpAtomicXor' : 242, + 'OpPhi' : 245, + 'OpLoopMerge' : 246, + 'OpSelectionMerge' : 247, + 'OpLabel' : 248, + 'OpBranch' : 249, + 'OpBranchConditional' : 250, + 'OpSwitch' : 251, + 'OpKill' : 252, + 'OpReturn' : 253, + 'OpReturnValue' : 254, + 'OpUnreachable' : 255, + 'OpLifetimeStart' : 256, + 'OpLifetimeStop' : 257, + 'OpGroupAsyncCopy' : 259, + 'OpGroupWaitEvents' : 260, + 'OpGroupAll' : 261, + 'OpGroupAny' : 262, + 'OpGroupBroadcast' : 263, + 'OpGroupIAdd' : 264, + 'OpGroupFAdd' : 265, + 'OpGroupFMin' : 266, + 'OpGroupUMin' : 267, + 'OpGroupSMin' : 268, + 'OpGroupFMax' : 269, + 'OpGroupUMax' : 270, + 'OpGroupSMax' : 271, + 'OpReadPipe' : 274, + 'OpWritePipe' : 275, + 'OpReservedReadPipe' : 276, + 'OpReservedWritePipe' : 277, + 'OpReserveReadPipePackets' : 278, + 'OpReserveWritePipePackets' : 279, + 'OpCommitReadPipe' : 280, + 'OpCommitWritePipe' : 281, + 'OpIsValidReserveId' : 282, + 'OpGetNumPipePackets' : 283, + 'OpGetMaxPipePackets' : 284, + 'OpGroupReserveReadPipePackets' : 285, + 'OpGroupReserveWritePipePackets' : 286, + 'OpGroupCommitReadPipe' : 287, + 'OpGroupCommitWritePipe' : 288, + 'OpEnqueueMarker' : 291, + 'OpEnqueueKernel' : 292, + 'OpGetKernelNDrangeSubGroupCount' : 293, + 'OpGetKernelNDrangeMaxSubGroupSize' : 294, + 'OpGetKernelWorkGroupSize' : 295, + 'OpGetKernelPreferredWorkGroupSizeMultiple' : 296, + 'OpRetainEvent' : 297, + 'OpReleaseEvent' : 298, + 'OpCreateUserEvent' : 299, + 'OpIsValidEvent' : 300, + 'OpSetUserEventStatus' : 301, + 'OpCaptureEventProfilingInfo' : 302, + 'OpGetDefaultQueue' : 303, + 'OpBuildNDRange' : 304, + 'OpImageSparseSampleImplicitLod' : 305, + 'OpImageSparseSampleExplicitLod' : 306, + 'OpImageSparseSampleDrefImplicitLod' : 307, + 'OpImageSparseSampleDrefExplicitLod' : 308, + 'OpImageSparseSampleProjImplicitLod' : 309, + 'OpImageSparseSampleProjExplicitLod' : 310, + 'OpImageSparseSampleProjDrefImplicitLod' : 311, + 'OpImageSparseSampleProjDrefExplicitLod' : 312, + 'OpImageSparseFetch' : 313, + 'OpImageSparseGather' : 314, + 'OpImageSparseDrefGather' : 315, + 'OpImageSparseTexelsResident' : 316, + 'OpNoLine' : 317, + 'OpAtomicFlagTestAndSet' : 318, + 'OpAtomicFlagClear' : 319, + 'OpImageSparseRead' : 320, + 'OpSizeOf' : 321, + 'OpTypePipeStorage' : 322, + 'OpConstantPipeStorage' : 323, + 'OpCreatePipeFromPipeStorage' : 324, + 'OpGetKernelLocalSizeForSubgroupCount' : 325, + 'OpGetKernelMaxNumSubgroups' : 326, + 'OpTypeNamedBarrier' : 327, + 'OpNamedBarrierInitialize' : 328, + 'OpMemoryNamedBarrier' : 329, + 'OpModuleProcessed' : 330, + 'OpExecutionModeId' : 331, + 'OpDecorateId' : 332, + 'OpGroupNonUniformElect' : 333, + 'OpGroupNonUniformAll' : 334, + 'OpGroupNonUniformAny' : 335, + 'OpGroupNonUniformAllEqual' : 336, + 'OpGroupNonUniformBroadcast' : 337, + 'OpGroupNonUniformBroadcastFirst' : 338, + 'OpGroupNonUniformBallot' : 339, + 'OpGroupNonUniformInverseBallot' : 340, + 'OpGroupNonUniformBallotBitExtract' : 341, + 'OpGroupNonUniformBallotBitCount' : 342, + 'OpGroupNonUniformBallotFindLSB' : 343, + 'OpGroupNonUniformBallotFindMSB' : 344, + 'OpGroupNonUniformShuffle' : 345, + 'OpGroupNonUniformShuffleXor' : 346, + 'OpGroupNonUniformShuffleUp' : 347, + 'OpGroupNonUniformShuffleDown' : 348, + 'OpGroupNonUniformIAdd' : 349, + 'OpGroupNonUniformFAdd' : 350, + 'OpGroupNonUniformIMul' : 351, + 'OpGroupNonUniformFMul' : 352, + 'OpGroupNonUniformSMin' : 353, + 'OpGroupNonUniformUMin' : 354, + 'OpGroupNonUniformFMin' : 355, + 'OpGroupNonUniformSMax' : 356, + 'OpGroupNonUniformUMax' : 357, + 'OpGroupNonUniformFMax' : 358, + 'OpGroupNonUniformBitwiseAnd' : 359, + 'OpGroupNonUniformBitwiseOr' : 360, + 'OpGroupNonUniformBitwiseXor' : 361, + 'OpGroupNonUniformLogicalAnd' : 362, + 'OpGroupNonUniformLogicalOr' : 363, + 'OpGroupNonUniformLogicalXor' : 364, + 'OpGroupNonUniformQuadBroadcast' : 365, + 'OpGroupNonUniformQuadSwap' : 366, + 'OpSubgroupBallotKHR' : 4421, + 'OpSubgroupFirstInvocationKHR' : 4422, + 'OpSubgroupAllKHR' : 4428, + 'OpSubgroupAnyKHR' : 4429, + 'OpSubgroupAllEqualKHR' : 4430, + 'OpSubgroupReadInvocationKHR' : 4432, + 'OpGroupIAddNonUniformAMD' : 5000, + 'OpGroupFAddNonUniformAMD' : 5001, + 'OpGroupFMinNonUniformAMD' : 5002, + 'OpGroupUMinNonUniformAMD' : 5003, + 'OpGroupSMinNonUniformAMD' : 5004, + 'OpGroupFMaxNonUniformAMD' : 5005, + 'OpGroupUMaxNonUniformAMD' : 5006, + 'OpGroupSMaxNonUniformAMD' : 5007, + 'OpFragmentMaskFetchAMD' : 5011, + 'OpFragmentFetchAMD' : 5012, + 'OpGroupNonUniformPartitionNV' : 5296, + 'OpSubgroupShuffleINTEL' : 5571, + 'OpSubgroupShuffleDownINTEL' : 5572, + 'OpSubgroupShuffleUpINTEL' : 5573, + 'OpSubgroupShuffleXorINTEL' : 5574, + 'OpSubgroupBlockReadINTEL' : 5575, + 'OpSubgroupBlockWriteINTEL' : 5576, + 'OpSubgroupImageBlockReadINTEL' : 5577, + 'OpSubgroupImageBlockWriteINTEL' : 5578, + 'OpDecorateStringGOOGLE' : 5632, + 'OpMemberDecorateStringGOOGLE' : 5633, + }, + +} + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/CMakeLists.txt new file mode 100644 index 00000000000..c6241510edf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 2.8) + +set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix" FORCE) + +project(buildSpvHeaders) + +set(SOURCES + main.cpp + jsonToSpirv.cpp + header.cpp + jsoncpp/dist/jsoncpp.cpp) + +set(HEADERS + jsonToSpirv.h + header.h + jsoncpp/dist/json/json.h) + +if(CMAKE_COMPILER_IS_GNUCXX) + add_definitions(-std=c++11) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_definitions(-std=c++11) +endif() + +add_executable(buildSpvHeaders ${SOURCES} ${HEADERS}) + +install(TARGETS buildSpvHeaders RUNTIME DESTINATION bin) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/bin/makeHeaders b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/bin/makeHeaders new file mode 100644 index 00000000000..bf2c61515f1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/bin/makeHeaders @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +cd ../../include/spirv/unified1 +../../../tools/buildHeaders/build/install/bin/buildSpvHeaders -H spirv.core.grammar.json +dos2unix spirv.* diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/header.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/header.cpp new file mode 100644 index 00000000000..b8b227f3bcc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/header.cpp @@ -0,0 +1,713 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// +// Print headers for SPIR-V in several languages. +// +// To change the header information, change the C++-built database in doc.*. +// +// Then, use "spriv -h " - e.g, spriv.{h,hpp,lua,py,etc}: +// replace the auto-generated header, or "spirv -H" to generate all +// supported language headers to predefined names in the current directory. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "jsoncpp/dist/json/json.h" + +#include "header.h" +#include "jsonToSpirv.h" + +// snprintf and _snprintf are not quite the same, but close enough +// for our use. +#ifdef _MSC_VER +#pragma warning(disable:4996) +#define snprintf _snprintf +#endif + +// This file converts SPIR-V definitions to an internal JSON +// representation, and then generates language specific +// data from that single internal form. + +// Initially, the internal form is created from C++ data, +// though this can be changed to a JSON master in time. + +namespace { + class TPrinter { + protected: + TPrinter(); + + static const int DocMagicNumber = 0x07230203; + static const int DocVersion = 0x00010300; + static const int DocRevision = 1; + #define DocRevisionString "1" + static const std::string DocCopyright; + static const std::string DocComment1; + static const std::string DocComment2; + + enum enumStyle_t { + enumNoMask, + enumCount, + enumShift, + enumMask, + enumHex, + }; + + static std::string styleStr(enumStyle_t s) { + return s == enumShift ? "Shift" : + s == enumMask ? "Mask" : ""; + } + + friend std::ostream& operator<<(std::ostream&, const TPrinter&); + + virtual void printAll(std::ostream&) const; + virtual void printComments(std::ostream&) const; + virtual void printPrologue(std::ostream&) const { } + virtual void printDefs(std::ostream&) const; + virtual void printEpilogue(std::ostream&) const { } + virtual void printMeta(std::ostream&) const; + virtual void printTypes(std::ostream&) const { } + + virtual std::string escapeComment(const std::string& s) const; + + // Default printComments() uses these comment strings + virtual std::string commentBeg() const { return ""; } + virtual std::string commentEnd(bool isLast) const { return ""; } + virtual std::string commentBOL() const { return ""; } + virtual std::string commentEOL(bool isLast) const { return ""; } + + typedef std::pair valpair_t; + + // for printing enum values + virtual std::string enumBeg(const std::string&, enumStyle_t) const { return ""; } + virtual std::string enumEnd(const std::string&, enumStyle_t, bool isLast = false) const { + return ""; + } + virtual std::string enumFmt(const std::string&, const valpair_t&, + enumStyle_t, bool isLast = false) const { + return ""; + } + virtual std::string maxEnumFmt(const std::string&, const valpair_t&, + enumStyle_t) const { + return ""; + } + + virtual std::string fmtConstInt(unsigned val, const std::string& name, + const char* fmt, bool isLast = false) const { + return ""; + } + + std::vector getSortedVals(const Json::Value&) const; + + virtual std::string indent(int count = 1) const { + return std::string(count * 4, ' '); // default indent level = 4 + } + + static std::string fmtNum(const char* fmt, unsigned val) { + char buff[16]; // ample for 8 hex digits + 0x + snprintf(buff, sizeof(buff), fmt, val); + buff[sizeof(buff)-1] = '\0'; // MSVC doesn't promise null termination + return buff; + } + + static std::string fmtStyleVal(unsigned v, enumStyle_t style); + + // If the enum value name would start with a sigit, prepend the enum name. + // E.g, "3D" -> "Dim3D". + static std::string prependIfDigit(const std::string& ename, const std::string& vname) { + return (std::isdigit(vname[0]) ? ename : std::string("")) + vname; + } + + void addComment(Json::Value& node, const std::string& str); + + Json::Value spvRoot; // JSON SPIR-V data + }; + + // Format value as mask or value + std::string TPrinter::fmtStyleVal(unsigned v, enumStyle_t style) + { + switch (style) { + case enumMask: + return fmtNum("0x%08x", 1< + TPrinter::getSortedVals(const Json::Value& p) const + { + std::vector values; + + for (auto e = p.begin(); e != p.end(); ++e) + values.push_back(valpair_t(e->asUInt(), e.name())); + + // Use a stable sort because we might have aliases, e.g. + // SubgropuBallot (might be in future core) vs. SubgroupBallotKHR. + std::stable_sort(values.begin(), values.end()); + + return values; + } + + // Escape comment characters if needed + std::string TPrinter::escapeComment(const std::string& s) const { return s; } + + // Format comments in language specific way + void TPrinter::printComments(std::ostream& out) const + { + const int commentCount = spvRoot["spv"]["meta"]["Comment"].size(); + int commentNum = 0; + + for (const auto& comment : spvRoot["spv"]["meta"]["Comment"]) { + out << commentBeg(); + + for (int line = 0; line < int(comment.size()); ++line) + out << commentBOL() << escapeComment(comment[line].asString()) << + commentEOL((line+1) == comment.size()) << std::endl; + + out << commentEnd(++commentNum == commentCount) << std::endl; + } + } + + // Format header metadata + void TPrinter::printMeta(std::ostream& out) const + { + const Json::Value& meta = spvRoot["spv"]["meta"]; + + const auto print = [&](const char* name, const char* fmt, bool isLast) { + out << fmtConstInt(meta[name].asUInt(), name, fmt, isLast); + }; + + print("MagicNumber", "0x%08lx", false); + print("Version", "0x%08lx", false); + print("Revision", "%d", false); + print("OpCodeMask", "0x%04x", false); + print("WordCountShift", "%d", true); + } + + // Format value definitions in language specific way + void TPrinter::printDefs(std::ostream& out) const + { + const Json::Value& enums = spvRoot["spv"]["enum"]; + + for (auto opClass = enums.begin(); opClass != enums.end(); ++opClass) { + const bool isMask = (*opClass)["Type"].asString() == "Bit"; + const auto opName = (*opClass)["Name"].asString(); + const auto opPrefix = opName == "Op" ? "" : opName; + + for (enumStyle_t style = (isMask ? enumShift : enumCount); + style <= (isMask ? enumMask : enumCount); style = enumStyle_t(int(style)+1)) { + + out << enumBeg(opName, style); + + if (style == enumMask) + out << enumFmt(opPrefix, valpair_t(0, "MaskNone"), enumNoMask); + + const auto sorted = getSortedVals((*opClass)["Values"]); + + std::string maxEnum = maxEnumFmt(opName, valpair_t(0x7FFFFFFF, "Max"), enumHex); + + bool printMax = (style != enumMask && maxEnum.size() > 0); + + for (const auto& v : sorted) + out << enumFmt(opPrefix, v, style, !printMax && v.first == sorted.back().first); + + if (printMax) + out << maxEnum; + + auto nextOpClass = opClass; + out << enumEnd(opName, style, ++nextOpClass == enums.end()); + } + } + } + + void TPrinter::printAll(std::ostream& out) const + { + printComments(out); + printPrologue(out); + printTypes(out); + printMeta(out); + printDefs(out); + printEpilogue(out); + } + + // Stream entire header to output + std::ostream& operator<<(std::ostream& out, const TPrinter &p) + { + p.printAll(out); + return out; + } + + // JSON printer. Rather than use the default printer, we supply our own so + // we can control the printing order within various containers. + class TPrinterJSON final : public TPrinter { + private: + void printPrologue(std::ostream& out) const override { out << "{\n" + indent() + "\"spv\":\n" + indent() + "{\n"; } + void printEpilogue(std::ostream& out) const override { out << indent() + "}\n}\n"; } + + std::string escapeComment(const std::string& s) const override { + std::string newStr; + for (auto c : s) { + if (c == '"') { + newStr += '\\'; + newStr += c; + } else { + newStr += c; + } + } + return newStr; + } + + std::string fmtConstInt(unsigned val, const std::string& name, + const char* fmt, bool isLast) const override { + return indent(3) + '"' + name + "\": " + fmtNum("%d", val) + (isLast ? "\n" : ",\n"); + } + + void printMeta(std::ostream& out) const override + { + out << indent(2) + "\"meta\":\n" + indent(2) + "{\n"; + printComments(out); + TPrinter::printMeta(out); + out << indent(2) + "},\n"; + } + + std::string commentBeg() const override { return indent(4) + "[\n"; } + std::string commentEnd(bool isLast) const override { return indent(4) + (isLast ? "]" : "],"); } + std::string commentBOL() const override { return indent(5) + '"'; } + std::string commentEOL(bool isLast) const override { return (isLast ? "\"" : "\","); } + + void printComments(std::ostream& out) const override + { + out << indent(3) + "\"Comment\":\n" + indent(3) + "[\n"; + TPrinter::printComments(out); + out << indent(3) + "],\n"; + } + + void printDefs(std::ostream& out) const override + { + out << indent(2) + "\"enum\":\n" + indent(2) + "[\n"; + TPrinter::printDefs(out); + out << indent(2) + "]\n"; + } + + void printAll(std::ostream& out) const override + { + printPrologue(out); + printMeta(out); + printDefs(out); + printEpilogue(out); + } + + std::string enumBeg(const std::string& s, enumStyle_t style) const override { + if (style == enumMask) + return ""; + return indent(3) + "{\n" + + indent(4) + "\"Name\": \"" + s + "\",\n" + + indent(4) + "\"Type\": " + (style == enumShift ? "\"Bit\"" : "\"Value\"") + ",\n" + + indent(4) + "\"Values\":\n" + + indent(4) + "{\n"; + } + + std::string enumEnd(const std::string& s, enumStyle_t style, bool isLast) const override { + if (style == enumMask) + return ""; + return indent(4) + "}\n" + + indent(3) + "}" + (isLast ? "" : ",") + "\n"; + } + + std::string enumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style, bool isLast) const override { + if (style == enumMask || style == enumNoMask) + return ""; + return indent(5) + '"' + prependIfDigit(s, v.second) + "\": " + fmtNum("%d", v.first) + + (isLast ? "\n" : ",\n"); + } + }; + + // base for C and C++ + class TPrinterCBase : public TPrinter { + protected: + virtual void printPrologue(std::ostream& out) const override { + out << "#ifndef spirv_" << headerGuardSuffix() << std::endl + << "#define spirv_" << headerGuardSuffix() << std::endl + << std::endl; + } + + void printMeta(std::ostream& out) const override { + out << "#define SPV_VERSION 0x" << std::hex << DocVersion << std::dec << "\n"; + out << "#define SPV_REVISION " << DocRevision << "\n"; + out << "\n"; + + return TPrinter::printMeta(out); + } + + virtual void printEpilogue(std::ostream& out) const override { + out << "#endif // #ifndef spirv_" << headerGuardSuffix() << std::endl; + } + + virtual void printTypes(std::ostream& out) const override { + out << "typedef unsigned int " << pre() << "Id;\n\n"; + } + + virtual std::string fmtConstInt(unsigned val, const std::string& name, + const char* fmt, bool isLast) const override + { + return std::string("static const unsigned int ") + pre() + name + + " = " + fmtNum(fmt, val) + (isLast ? ";\n\n" : ";\n"); + } + + virtual std::string pre() const { return ""; } // C name prefix + virtual std::string headerGuardSuffix() const = 0; + }; + + // C printer + class TPrinterC final : public TPrinterCBase { + private: + std::string commentBeg() const override { return "/*\n"; } + std::string commentEnd(bool isLast) const override { return "*/\n"; } + std::string commentBOL() const override { return "** "; } + + std::string enumBeg(const std::string& s, enumStyle_t style) const override { + return std::string("typedef enum ") + pre() + s + styleStr(style) + "_ {\n"; + } + + std::string enumEnd(const std::string& s, enumStyle_t style, bool isLast) const override { + return "} " + pre() + s + styleStr(style) + ";\n\n"; + } + + std::string enumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style, bool isLast) const override { + return indent() + pre() + s + v.second + styleStr(style) + " = " + fmtStyleVal(v.first, style) + ",\n"; + } + + std::string maxEnumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style) const override { + return enumFmt(s, v, style, true); + } + + std::string pre() const override { return "Spv"; } // C name prefix + std::string headerGuardSuffix() const override { return "H"; } + }; + + // C++ printer + class TPrinterCPP : public TPrinterCBase { + private: + void printPrologue(std::ostream& out) const override { + TPrinterCBase::printPrologue(out); + out << "namespace spv {\n\n"; + } + + void printEpilogue(std::ostream& out) const override { + const Json::Value& enums = spvRoot["spv"]["enum"]; + + // Create overloaded operator| for mask types + out << "// Overload operator| for mask bit combining\n\n"; + + for (auto opClass = enums.begin(); opClass != enums.end(); ++opClass) { + const bool isMask = (*opClass)["Type"].asString() == "Bit"; + const auto opName = (*opClass)["Name"].asString(); + + if (isMask) { + const auto typeName = opName + styleStr(enumMask); + + out << "inline " + typeName + " operator|(" + typeName + " a, " + typeName + " b) { return " + + typeName + "(unsigned(a) | unsigned(b)); }\n"; + } + } + + out << "\n} // end namespace spv\n\n"; + TPrinterCBase::printEpilogue(out); + } + + std::string commentBOL() const override { return "// "; } + + + virtual std::string enumBeg(const std::string& s, enumStyle_t style) const override { + return std::string("enum ") + s + styleStr(style) + " {\n"; + } + + std::string enumEnd(const std::string& s, enumStyle_t style, bool isLast) const override { + return "};\n\n"; + } + + virtual std::string enumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style, bool isLast) const override { + return indent() + s + v.second + styleStr(style) + " = " + fmtStyleVal(v.first, style) + ",\n"; + } + + virtual std::string maxEnumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style) const override { + return enumFmt(s, v, style, true); + } + + // The C++ and C++11 headers define types with the same name. So they + // should use the same header guard. + std::string headerGuardSuffix() const override { return "HPP"; } + + std::string operators; + }; + + // C++11 printer (uses enum classes) + class TPrinterCPP11 final : public TPrinterCPP { + private: + std::string enumBeg(const std::string& s, enumStyle_t style) const override { + return std::string("enum class ") + s + styleStr(style) + " : unsigned {\n"; + } + + std::string enumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style, bool isLast) const override { + return indent() + prependIfDigit(s, v.second) + " = " + fmtStyleVal(v.first, style) + ",\n"; + } + + std::string maxEnumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style) const override { + return enumFmt(s, v, style, true); + } + + std::string headerGuardSuffix() const override { return "HPP"; } + }; + + // LUA printer + class TPrinterLua final : public TPrinter { + private: + void printPrologue(std::ostream& out) const override { out << "spv = {\n"; } + + void printEpilogue(std::ostream& out) const override { out << "}\n"; } + + std::string commentBOL() const override { return "-- "; } + + std::string enumBeg(const std::string& s, enumStyle_t style) const override { + return indent() + s + styleStr(style) + " = {\n"; + } + + std::string enumEnd(const std::string& s, enumStyle_t style, bool isLast) const override { + return indent() + "},\n\n"; + } + + std::string enumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style, bool isLast) const override { + return indent(2) + prependIfDigit(s, v.second) + " = " + fmtStyleVal(v.first, style) + ",\n"; + } + + virtual std::string fmtConstInt(unsigned val, const std::string& name, + const char* fmt, bool isLast) const override + { + return indent() + name + " = " + fmtNum(fmt, val) + (isLast ? ",\n\n" : ",\n"); + } + }; + + // Python printer + class TPrinterPython final : public TPrinter { + private: + void printPrologue(std::ostream& out) const override { out << "spv = {\n"; } + + void printEpilogue(std::ostream& out) const override { out << "}\n"; } + + std::string commentBOL() const override { return "# "; } + + std::string enumBeg(const std::string& s, enumStyle_t style) const override { + return indent() + "'" + s + styleStr(style) + "'" + " : {\n"; + } + + std::string enumEnd(const std::string& s, enumStyle_t style, bool isLast) const override { + return indent() + "},\n\n"; + } + + std::string enumFmt(const std::string& s, const valpair_t& v, + enumStyle_t style, bool isLast) const override { + return indent(2) + "'" + prependIfDigit(s, v.second) + "'" + " : " + fmtStyleVal(v.first, style) + ",\n"; + } + + std::string fmtConstInt(unsigned val, const std::string& name, + const char* fmt, bool isLast) const override + { + return indent() + "'" + name + "'" + " : " + fmtNum(fmt, val) + (isLast ? ",\n\n" : ",\n"); + } + }; + +} // namespace + +namespace spv { + void PrintAllHeaders() + { + // TODO: Once MSVC 2012 is no longer a factor, use brace initializers here + std::vector> langInfo; + + langInfo.push_back(std::make_pair(ELangC, "spirv.h")); + langInfo.push_back(std::make_pair(ELangCPP, "spirv.hpp")); + langInfo.push_back(std::make_pair(ELangCPP11, "spirv.hpp11")); + langInfo.push_back(std::make_pair(ELangJSON, "spirv.json")); + langInfo.push_back(std::make_pair(ELangLua, "spirv.lua")); + langInfo.push_back(std::make_pair(ELangPython, "spirv.py")); + + for (const auto& lang : langInfo) { + std::ofstream out(lang.second, std::ios::out); + + if ((out.rdstate() & std::ifstream::failbit)) { + std::cerr << "Unable to open file: " << lang.second << std::endl; + } else { + PrintHeader(lang.first, out); + } + } + } + + // Print header for given language to given output stream + void PrintHeader(TLanguage lang, std::ostream& out) + { + typedef std::unique_ptr TPrinterPtr; + TPrinterPtr p; + + switch (lang) { + case ELangC: p = TPrinterPtr(new TPrinterC); break; + case ELangCPP: p = TPrinterPtr(new TPrinterCPP); break; + case ELangCPP11: p = TPrinterPtr(new TPrinterCPP11); break; + case ELangJSON: p = TPrinterPtr(new TPrinterJSON); break; + case ELangLua: p = TPrinterPtr(new TPrinterLua); break; + case ELangPython: p = TPrinterPtr(new TPrinterPython); break; + case ELangAll: PrintAllHeaders(); break; + default: + std::cerr << "Unknown language." << std::endl; + return; + } + + // Print the data in the requested format + if (p) + out << *p << std::endl; + + // object is auto-deleted + } + +} // namespace spv diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/header.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/header.h new file mode 100644 index 00000000000..5a0952db2d4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/header.h @@ -0,0 +1,52 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +// +// Print headers for SPIR-V in several languages. +// + +#pragma once +#ifndef header +#define header + +#include + +namespace spv { + // Languages supported + enum TLanguage { + ELangC, // C + ELangCPP, // C++03 + ELangCPP11, // C++11 + ELangJSON, // JSON + ELangLua, // Lua + ELangPython, // Python + + ELangAll, // print headers in all languages to files + }; + + // Generate header for requested language + void PrintHeader(TLanguage, std::ostream&); +} // namespace spv + +#endif // header diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsonToSpirv.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsonToSpirv.cpp new file mode 100644 index 00000000000..bb325661efb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsonToSpirv.cpp @@ -0,0 +1,437 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +#include +#include +#include +#include +#include +#include +#include + +#include "jsoncpp/dist/json/json.h" + +#include "jsonToSpirv.h" + +namespace spv { + +// The set of objects that hold all the instruction/operand +// parameterization information. +InstructionValues InstructionDesc; + +// Note: There is no entry for OperandOpcode. Use InstructionDesc instead. +EnumDefinition OperandClassParams[OperandOpcode]; +EnumValues SourceLanguageParams; +EnumValues ExecutionModelParams; +EnumValues AddressingParams; +EnumValues MemoryParams; +EnumValues ExecutionModeParams; +EnumValues StorageParams; +EnumValues SamplerAddressingModeParams; +EnumValues SamplerFilterModeParams; +EnumValues ImageFormatParams; +EnumValues ImageChannelOrderParams; +EnumValues ImageChannelDataTypeParams; +EnumValues ImageOperandsParams; +EnumValues FPFastMathParams; +EnumValues FPRoundingModeParams; +EnumValues LinkageTypeParams; +EnumValues DecorationParams; +EnumValues BuiltInParams; +EnumValues DimensionalityParams; +EnumValues FuncParamAttrParams; +EnumValues AccessQualifierParams; +EnumValues GroupOperationParams; +EnumValues LoopControlParams; +EnumValues SelectionControlParams; +EnumValues FunctionControlParams; +EnumValues MemorySemanticsParams; +EnumValues MemoryAccessParams; +EnumValues ScopeParams; +EnumValues KernelEnqueueFlagsParams; +EnumValues KernelProfilingInfoParams; +EnumValues CapabilityParams; + +std::pair ReadFile(const std::string& path) +{ + std::ifstream fstream(path, std::ios::in); + if (fstream) { + std::string contents; + fstream.seekg(0, std::ios::end); + contents.reserve((unsigned int)fstream.tellg()); + fstream.seekg(0, std::ios::beg); + contents.assign((std::istreambuf_iterator(fstream)), + std::istreambuf_iterator()); + return std::make_pair(true, contents); + } + return std::make_pair(false, ""); +} + +struct ClassOptionality { + OperandClass type; + bool optional; +}; + +// Converts the |operandKind| and |quantifier| pair used to describe operands +// in the JSON grammar to OperandClass and optionality used in this repo. +ClassOptionality ToOperandClassAndOptionality(const std::string& operandKind, const std::string& quantifier) +{ + assert(quantifier.empty() || quantifier == "?" || quantifier == "*"); + + if (operandKind == "IdRef") { + if (quantifier.empty()) + return {OperandId, false}; + else if (quantifier == "?") + return {OperandId, true}; + else + return {OperandVariableIds, false}; + } else if (operandKind == "LiteralInteger") { + if (quantifier.empty()) + return {OperandLiteralNumber, false}; + if (quantifier == "?") + return {OperandOptionalLiteral, true}; + else + return {OperandVariableLiterals, false}; + } else if (operandKind == "LiteralString") { + if (quantifier.empty()) + return {OperandLiteralString, false}; + else if (quantifier == "?") + return {OperandLiteralString, true}; + else { + assert(0 && "this case should not exist"); + return {OperandNone, false}; + } + } else if (operandKind == "PairLiteralIntegerIdRef") { + // Used by OpSwitch in the grammar + return {OperandVariableLiteralId, false}; + } else if (operandKind == "PairIdRefLiteralInteger") { + // Used by OpGroupMemberDecorate in the grammar + return {OperandVariableIdLiteral, false}; + } else if (operandKind == "PairIdRefIdRef") { + // Used by OpPhi in the grammar + return {OperandVariableIds, false}; + } else { + OperandClass type = OperandNone; + if (operandKind == "IdMemorySemantics" || operandKind == "MemorySemantics") { + type = OperandMemorySemantics; + } else if (operandKind == "IdScope" || operandKind == "Scope") { + type = OperandScope; + } else if (operandKind == "LiteralExtInstInteger") { + type = OperandLiteralNumber; + } else if (operandKind == "LiteralSpecConstantOpInteger") { + type = OperandLiteralNumber; + } else if (operandKind == "LiteralContextDependentNumber") { + type = OperandVariableLiterals; + } else if (operandKind == "SourceLanguage") { + type = OperandSource; + } else if (operandKind == "ExecutionModel") { + type = OperandExecutionModel; + } else if (operandKind == "AddressingModel") { + type = OperandAddressing; + } else if (operandKind == "MemoryModel") { + type = OperandMemory; + } else if (operandKind == "ExecutionMode") { + type = OperandExecutionMode; + } else if (operandKind == "StorageClass") { + type = OperandStorage; + } else if (operandKind == "Dim") { + type = OperandDimensionality; + } else if (operandKind == "SamplerAddressingMode") { + type = OperandSamplerAddressingMode; + } else if (operandKind == "SamplerFilterMode") { + type = OperandSamplerFilterMode; + } else if (operandKind == "ImageFormat") { + type = OperandSamplerImageFormat; + } else if (operandKind == "ImageChannelOrder") { + type = OperandImageChannelOrder; + } else if (operandKind == "ImageChannelDataType") { + type = OperandImageChannelDataType; + } else if (operandKind == "FPRoundingMode") { + type = OperandFPRoundingMode; + } else if (operandKind == "LinkageType") { + type = OperandLinkageType; + } else if (operandKind == "AccessQualifier") { + type = OperandAccessQualifier; + } else if (operandKind == "FunctionParameterAttribute") { + type = OperandFuncParamAttr; + } else if (operandKind == "Decoration") { + type = OperandDecoration; + } else if (operandKind == "BuiltIn") { + type = OperandBuiltIn; + } else if (operandKind == "GroupOperation") { + type = OperandGroupOperation; + } else if (operandKind == "KernelEnqueueFlags") { + type = OperandKernelEnqueueFlags; + } else if (operandKind == "KernelProfilingInfo") { + type = OperandKernelProfilingInfo; + } else if (operandKind == "Capability") { + type = OperandCapability; + } else if (operandKind == "ImageOperands") { + type = OperandImageOperands; + } else if (operandKind == "FPFastMathMode") { + type = OperandFPFastMath; + } else if (operandKind == "SelectionControl") { + type = OperandSelect; + } else if (operandKind == "LoopControl") { + type = OperandLoop; + } else if (operandKind == "FunctionControl") { + type = OperandFunction; + } else if (operandKind == "MemoryAccess") { + type = OperandMemoryAccess; + } + + if (type == OperandNone) { + std::cerr << "Unhandled operand kind found: " << operandKind << std::endl; + exit(1); + } + return {type, !quantifier.empty()}; + } +} + +bool IsTypeOrResultId(const std::string& str, bool* isType, bool* isResult) +{ + if (str == "IdResultType") + return *isType = true; + if (str == "IdResult") + return *isResult = true; + return false; +} + +// Given a number string, returns the position of the only bits set in the number. +// So it requires the number is a power of two. +unsigned int NumberStringToBit(const std::string& str) +{ + char* parseEnd; + unsigned int value = (unsigned int)std::strtol(str.c_str(), &parseEnd, 16); + assert(!(value & (value - 1)) && "input number is not a power of 2"); + unsigned int bit = 0; + for (; value; value >>= 1) ++bit; + return bit; +} + +void jsonToSpirv(const std::string& jsonPath) +{ + // only do this once. + static bool initialized = false; + if (initialized) + return; + initialized = true; + + // Read the JSON grammar file. + bool fileReadOk = false; + std::string content; + std::tie(fileReadOk, content) = ReadFile(jsonPath); + if (!fileReadOk) { + std::cerr << "Failed to read JSON grammar file: " + << jsonPath << std::endl; + exit(1); + } + + // Decode the JSON grammar file. + Json::Reader reader; + Json::Value root; + if (!reader.parse(content, root)) { + std::cerr << "Failed to parse JSON grammar:\n" + << reader.getFormattedErrorMessages(); + exit(1); + } + + // Layouts for all instructions. + + // A lambda for returning capabilities from a JSON object as strings. + const auto getCaps = [](const Json::Value& object) { + EnumCaps result; + const auto& caps = object["capabilities"]; + if (!caps.empty()) { + assert(caps.isArray()); + for (const auto& cap : caps) { + result.emplace_back(cap.asString()); + } + } + return result; + }; + + // A lambda for returning extensions from a JSON object as strings. + const auto getExts = [](const Json::Value& object) { + Extensions result; + const auto& exts = object["extensions"]; + if (!exts.empty()) { + assert(exts.isArray()); + for (const auto& ext : exts) { + result.emplace_back(ext.asString()); + } + } + return result; + }; + + const Json::Value insts = root["instructions"]; + for (const auto& inst : insts) { + const unsigned int opcode = inst["opcode"].asUInt(); + const std::string name = inst["opname"].asString(); + EnumCaps caps = getCaps(inst); + std::string version = inst["version"].asString(); + Extensions exts = getExts(inst); + OperandParameters operands; + bool defResultId = false; + bool defTypeId = false; + for (const auto& operand : inst["operands"]) { + const std::string kind = operand["kind"].asString(); + const std::string quantifier = operand.get("quantifier", "").asString(); + const std::string doc = operand.get("name", "").asString(); + if (!IsTypeOrResultId(kind, &defTypeId, &defResultId)) { + const auto p = ToOperandClassAndOptionality(kind, quantifier); + operands.push(p.type, doc, p.optional); + } + } + InstructionDesc.emplace_back( + std::move(EnumValue(opcode, name, + std::move(caps), std::move(version), std::move(exts), + std::move(operands))), + defTypeId, defResultId); + } + + // Specific additional context-dependent operands + + // Populate dest with EnumValue objects constructed from source. + const auto populateEnumValues = [&getCaps,&getExts](EnumValues* dest, const Json::Value& source, bool bitEnum) { + // A lambda for determining the numeric value to be used for a given + // enumerant in JSON form, and whether that value is a 0 in a bitfield. + auto getValue = [&bitEnum](const Json::Value& enumerant) { + std::pair result{0u,false}; + if (!bitEnum) { + result.first = enumerant["value"].asUInt(); + } else { + const unsigned int bit = NumberStringToBit(enumerant["value"].asString()); + if (bit == 0) + result.second = true; + else + result.first = bit - 1; // This is the *shift* amount. + } + return result; + }; + + for (const auto& enumerant : source["enumerants"]) { + unsigned value; + bool skip_zero_in_bitfield; + std::tie(value, skip_zero_in_bitfield) = getValue(enumerant); + if (skip_zero_in_bitfield) + continue; + EnumCaps caps(getCaps(enumerant)); + std::string version = enumerant["version"].asString(); + Extensions exts(getExts(enumerant)); + OperandParameters params; + const Json::Value& paramsJson = enumerant["parameters"]; + if (!paramsJson.empty()) { // This enumerant has parameters. + assert(paramsJson.isArray()); + for (const auto& param : paramsJson) { + const std::string kind = param["kind"].asString(); + const std::string doc = param.get("name", "").asString(); + const auto p = ToOperandClassAndOptionality(kind, ""); // All parameters are required! + params.push(p.type, doc); + } + } + dest->emplace_back( + value, enumerant["enumerant"].asString(), + std::move(caps), std::move(version), std::move(exts), std::move(params)); + } + }; + + const auto establishOperandClass = [&populateEnumValues]( + const std::string& enumName, spv::OperandClass operandClass, + spv::EnumValues* enumValues, const Json::Value& operandEnum, const std::string& category) { + assert(category == "BitEnum" || category == "ValueEnum"); + bool bitEnum = (category == "BitEnum"); + populateEnumValues(enumValues, operandEnum, bitEnum); + OperandClassParams[operandClass].set(enumName, enumValues, bitEnum); + }; + + const Json::Value operandEnums = root["operand_kinds"]; + for (const auto& operandEnum : operandEnums) { + const std::string enumName = operandEnum["kind"].asString(); + const std::string category = operandEnum["category"].asString(); + if (enumName == "SourceLanguage") { + establishOperandClass(enumName, OperandSource, &SourceLanguageParams, operandEnum, category); + } else if (enumName == "Decoration") { + establishOperandClass(enumName, OperandDecoration, &DecorationParams, operandEnum, category); + } else if (enumName == "ExecutionMode") { + establishOperandClass(enumName, OperandExecutionMode, &ExecutionModeParams, operandEnum, category); + } else if (enumName == "Capability") { + establishOperandClass(enumName, OperandCapability, &CapabilityParams, operandEnum, category); + } else if (enumName == "AddressingModel") { + establishOperandClass(enumName, OperandAddressing, &AddressingParams, operandEnum, category); + } else if (enumName == "MemoryModel") { + establishOperandClass(enumName, OperandMemory, &MemoryParams, operandEnum, category); + } else if (enumName == "MemorySemantics") { + establishOperandClass(enumName, OperandMemorySemantics, &MemorySemanticsParams, operandEnum, category); + } else if (enumName == "ExecutionModel") { + establishOperandClass(enumName, OperandExecutionModel, &ExecutionModelParams, operandEnum, category); + } else if (enumName == "StorageClass") { + establishOperandClass(enumName, OperandStorage, &StorageParams, operandEnum, category); + } else if (enumName == "SamplerAddressingMode") { + establishOperandClass(enumName, OperandSamplerAddressingMode, &SamplerAddressingModeParams, operandEnum, category); + } else if (enumName == "SamplerFilterMode") { + establishOperandClass(enumName, OperandSamplerFilterMode, &SamplerFilterModeParams, operandEnum, category); + } else if (enumName == "ImageFormat") { + establishOperandClass(enumName, OperandSamplerImageFormat, &ImageFormatParams, operandEnum, category); + } else if (enumName == "ImageChannelOrder") { + establishOperandClass(enumName, OperandImageChannelOrder, &ImageChannelOrderParams, operandEnum, category); + } else if (enumName == "ImageChannelDataType") { + establishOperandClass(enumName, OperandImageChannelDataType, &ImageChannelDataTypeParams, operandEnum, category); + } else if (enumName == "ImageOperands") { + establishOperandClass(enumName, OperandImageOperands, &ImageOperandsParams, operandEnum, category); + } else if (enumName == "FPFastMathMode") { + establishOperandClass(enumName, OperandFPFastMath, &FPFastMathParams, operandEnum, category); + } else if (enumName == "FPRoundingMode") { + establishOperandClass(enumName, OperandFPRoundingMode, &FPRoundingModeParams, operandEnum, category); + } else if (enumName == "LinkageType") { + establishOperandClass(enumName, OperandLinkageType, &LinkageTypeParams, operandEnum, category); + } else if (enumName == "FunctionParameterAttribute") { + establishOperandClass(enumName, OperandFuncParamAttr, &FuncParamAttrParams, operandEnum, category); + } else if (enumName == "AccessQualifier") { + establishOperandClass(enumName, OperandAccessQualifier, &AccessQualifierParams, operandEnum, category); + } else if (enumName == "BuiltIn") { + establishOperandClass(enumName, OperandBuiltIn, &BuiltInParams, operandEnum, category); + } else if (enumName == "SelectionControl") { + establishOperandClass(enumName, OperandSelect, &SelectionControlParams, operandEnum, category); + } else if (enumName == "LoopControl") { + establishOperandClass(enumName, OperandLoop, &LoopControlParams, operandEnum, category); + } else if (enumName == "FunctionControl") { + establishOperandClass(enumName, OperandFunction, &FunctionControlParams, operandEnum, category); + } else if (enumName == "Dim") { + establishOperandClass(enumName, OperandDimensionality, &DimensionalityParams, operandEnum, category); + } else if (enumName == "MemoryAccess") { + establishOperandClass(enumName, OperandMemoryAccess, &MemoryAccessParams, operandEnum, category); + } else if (enumName == "Scope") { + establishOperandClass(enumName, OperandScope, &ScopeParams, operandEnum, category); + } else if (enumName == "GroupOperation") { + establishOperandClass(enumName, OperandGroupOperation, &GroupOperationParams, operandEnum, category); + } else if (enumName == "KernelEnqueueFlags") { + establishOperandClass(enumName, OperandKernelEnqueueFlags, &KernelEnqueueFlagsParams, operandEnum, category); + } else if (enumName == "KernelProfilingInfo") { + establishOperandClass(enumName, OperandKernelProfilingInfo, &KernelProfilingInfoParams, operandEnum, category); + } + } +} + +}; // end namespace spv diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsonToSpirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsonToSpirv.h new file mode 100644 index 00000000000..00a2f70d9af --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsonToSpirv.h @@ -0,0 +1,260 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +#pragma once +#ifndef JSON_TO_SPIRV +#define JSON_TO_SPIRV + +#include +#include +#include +#include + +namespace spv { + + // Reads the file in the given |path|. Returns true and the contents of the +// file on success; otherwise, returns false and an empty string. +std::pair ReadFile(const std::string& path); + +// Fill in all the parameters +void jsonToSpirv(const std::string& jsonPath); + +// For parameterizing operands. +enum OperandClass { + OperandNone, + OperandId, + OperandVariableIds, + OperandOptionalLiteral, + OperandOptionalLiteralString, + OperandVariableLiterals, + OperandVariableIdLiteral, + OperandVariableLiteralId, + OperandLiteralNumber, + OperandLiteralString, + OperandSource, + OperandExecutionModel, + OperandAddressing, + OperandMemory, + OperandExecutionMode, + OperandStorage, + OperandDimensionality, + OperandSamplerAddressingMode, + OperandSamplerFilterMode, + OperandSamplerImageFormat, + OperandImageChannelOrder, + OperandImageChannelDataType, + OperandImageOperands, + OperandFPFastMath, + OperandFPRoundingMode, + OperandLinkageType, + OperandAccessQualifier, + OperandFuncParamAttr, + OperandDecoration, + OperandBuiltIn, + OperandSelect, + OperandLoop, + OperandFunction, + OperandMemorySemantics, + OperandMemoryAccess, + OperandScope, + OperandGroupOperation, + OperandKernelEnqueueFlags, + OperandKernelProfilingInfo, + OperandCapability, + + OperandOpcode, + + OperandCount +}; + +// Any specific enum can have a set of capabilities that allow it: +typedef std::vector EnumCaps; + +// A set of extensions. +typedef std::vector Extensions; + +// Parameterize a set of operands with their OperandClass(es) and descriptions. +class OperandParameters { +public: + OperandParameters() { } + void push(OperandClass oc, const std::string& d, bool opt = false) + { + opClass.push_back(oc); + desc.push_back(d); + optional.push_back(opt); + } + void setOptional(); + OperandClass getClass(int op) const { return opClass[op]; } + const char* getDesc(int op) const { return desc[op].c_str(); } + bool isOptional(int op) const { return optional[op]; } + int getNum() const { return (int)opClass.size(); } + +protected: + std::vector opClass; + std::vector desc; + std::vector optional; +}; + +// An ordered sequence of EValue. We'll preserve the order found in the +// JSON file. You can look up a value by enum or by name. If there are +// duplicate values, then take the first. We assume names are unique. +// The EValue must have an unsigned |value| field and a string |name| field. +template +class EnumValuesContainer { +public: + using ContainerType = std::vector; + using iterator = typename ContainerType::iterator; + using const_iterator = typename ContainerType::const_iterator; + + EnumValuesContainer() {} + + // Constructs an EValue in place as a new element at the end of the + // sequence. + template + void emplace_back(Args&&... args) { + values.emplace_back(std::forward(args)...); + } + + // Returns the first EValue in the sequence with the given value. + // More than one EValue might have the same value. + EValue& operator[](unsigned value) { + auto where = std::find_if(begin(), end(), [&value](const EValue& e) { + return value == e.value; + }); + assert((where != end()) && "Could not find enum in the enum list"); + return *where; + } + // Returns the EValue with the given name. We assume uniqueness + // by name. + EValue& at(std::string name) { + auto where = std::find_if(begin(), end(), [&name](const EValue& e) { + return name == e.name; + }); + assert((where != end()) && "Could not find name in the enum list"); + return *where; + } + + iterator begin() { return values.begin(); } + iterator end() { return values.end(); } + +private: + ContainerType values; +}; + +// A single enumerant value. Corresponds to a row in an enumeration table +// in the spec. +class EnumValue { +public: + EnumValue() : value(0), desc(nullptr) {} + EnumValue(unsigned int the_value, const std::string& the_name, EnumCaps&& the_caps, const std::string& the_version, + Extensions&& the_extensions, OperandParameters&& the_operands) : + value(the_value), name(the_name), capabilities(std::move(the_caps)), version(std::move(the_version)), + extensions(std::move(the_extensions)), operands(std::move(the_operands)), desc(nullptr) { } + + // For ValueEnum, the value from the JSON file. + // For BitEnum, the index of the bit position represented by this mask. + // (That is, what you shift 1 by to get the mask.) + unsigned value; + std::string name; + EnumCaps capabilities; + std::string version; + // A feature only be enabled by certain extensions. + // An empty list means the feature does not require an extension. + // Normally, only Capability enums are enabled by extension. In turn, + // other enums and instructions are enabled by those capabilities. + Extensions extensions; + OperandParameters operands; + const char* desc; +}; + +using EnumValues = EnumValuesContainer; + +// Parameterize a set of enumerants that form an enum +class EnumDefinition { +public: + EnumDefinition() : + desc(0), bitmask(false), enumValues(nullptr) { } + void set(const std::string& enumName, EnumValues* enumValuesArg, bool mask = false) + { + codeName = enumName; + bitmask = mask; + enumValues = enumValuesArg; + } + // Returns the first EnumValue in the sequence with the given value. + // More than one EnumValue might have the same value. Only valid + // if enumValues has been populated. + EnumValue& operator[](unsigned value) { + assert(enumValues != nullptr); + return (*enumValues)[value]; + } + // Returns the name of the first EnumValue with the given value. + // Assumes enumValues has been populated. + const char* getName(unsigned value) { + return (*this)[value].name.c_str(); + } + + using iterator = EnumValues::iterator; + iterator begin() { return enumValues->begin(); } + iterator end() { return enumValues->end(); } + + std::string codeName; // name to use when declaring headers for code + const char* desc; + bool bitmask; // true if these enumerants combine into a bitmask + EnumValues* enumValues; // parameters for each individual enumerant +}; + +// Parameterize an instruction's logical format, including its known set of operands, +// per OperandParameters above. +class InstructionValue : public EnumValue { +public: + InstructionValue(EnumValue&& e, bool has_type, bool has_result) + : EnumValue(std::move(e)), + opDesc("TBD"), + opClass(0), + typePresent(has_type), + resultPresent(has_result) {} + + bool hasResult() const { return resultPresent != 0; } + bool hasType() const { return typePresent != 0; } + + const char* opDesc; + int opClass; + +protected: + int typePresent : 1; + int resultPresent : 1; +}; + +using InstructionValues = EnumValuesContainer; + +// Parameterization info for all instructions. +extern InstructionValues InstructionDesc; + +// These hold definitions of the enumerants used for operands. +// This is indexed by OperandClass, but not including OperandOpcode. +extern EnumDefinition OperandClassParams[]; + +}; // end namespace spv + +#endif // JSON_TO_SPIRV diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json/json-forwards.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json/json-forwards.h new file mode 100644 index 00000000000..ccbdb2b13c3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json/json-forwards.h @@ -0,0 +1,255 @@ +/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/). +/// It is intended to be used with #include "json/json-forwards.h" +/// This header provides forward declaration for all JsonCpp types. + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + +#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED +# define JSON_FORWARD_AMALGATED_H_INCLUDED +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +#define JSON_IS_AMALGAMATION + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_CONFIG_H_INCLUDED +#define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of +/// std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 + +// If non-zero, the library uses exceptions to report bad input instead of C +// assertion macros. The default is to use exceptions. +#ifndef JSON_USE_EXCEPTION +#define JSON_USE_EXCEPTION 1 +#endif + +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +/// Remarks: it is automatically defined in the generated amalgated header. +// #define JSON_IS_AMALGAMATION + +#ifdef JSON_IN_CPPTL +#include +#ifndef JSON_USE_CPPTL +#define JSON_USE_CPPTL 1 +#endif +#endif + +#ifdef JSON_IN_CPPTL +#define JSON_API CPPTL_API +#elif defined(JSON_DLL_BUILD) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllexport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#elif defined(JSON_DLL) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllimport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#endif // ifdef JSON_IN_CPPTL +#if !defined(JSON_API) +#define JSON_API +#endif + +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for +// integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 +// Microsoft Visual Studio 6 only support conversion from __int64 to double +// (no conversion from unsigned __int64). +#define JSON_USE_INT64_DOUBLE_CONVERSION 1 +// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' +// characters in the debug information) +// All projects I've ever seen with VS6 were using this globally (not bothering +// with pragma push/pop). +#pragma warning(disable : 4786) +#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 + +#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 +/// Indicates that the following function is deprecated. +#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +#elif defined(__clang__) && defined(__has_feature) +#if __has_feature(attribute_deprecated_with_message) +#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +#endif +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) +#endif + +#if !defined(JSONCPP_DEPRECATED) +#define JSONCPP_DEPRECATED(message) +#endif // if !defined(JSONCPP_DEPRECATED) + +namespace Json { +typedef int Int; +typedef unsigned int UInt; +#if defined(JSON_NO_INT64) +typedef int LargestInt; +typedef unsigned int LargestUInt; +#undef JSON_HAS_INT64 +#else // if defined(JSON_NO_INT64) +// For Microsoft Visual use specific types as long long is not supported +#if defined(_MSC_VER) // Microsoft Visual Studio +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#else // if defined(_MSC_VER) // Other platforms, use long long +typedef long long int Int64; +typedef unsigned long long int UInt64; +#endif // if defined(_MSC_VER) +typedef Int64 LargestInt; +typedef UInt64 LargestUInt; +#define JSON_HAS_INT64 +#endif // if defined(JSON_NO_INT64) +} // end namespace Json + +#endif // JSON_CONFIG_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_FORWARDS_H_INCLUDED +#define JSON_FORWARDS_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// writer.h +class FastWriter; +class StyledWriter; + +// reader.h +class Reader; + +// features.h +class Features; + +// value.h +typedef unsigned int ArrayIndex; +class StaticString; +class Path; +class PathArgument; +class Value; +class ValueIteratorBase; +class ValueIterator; +class ValueConstIterator; + +} // namespace Json + +#endif // JSON_FORWARDS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + + + + + +#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json/json.h b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json/json.h new file mode 100644 index 00000000000..e01991e0f75 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/json/json.h @@ -0,0 +1,2017 @@ +/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/). +/// It is intended to be used with #include "json/json.h" + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + +#ifndef JSON_AMALGATED_H_INCLUDED +# define JSON_AMALGATED_H_INCLUDED +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +#define JSON_IS_AMALGAMATION + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/version.h +// ////////////////////////////////////////////////////////////////////// + +// DO NOT EDIT. This file is generated by CMake from "version" +// and "version.h.in" files. +// Run CMake configure step to update it. +#ifndef JSON_VERSION_H_INCLUDED +# define JSON_VERSION_H_INCLUDED + +# define JSONCPP_VERSION_STRING "1.6.2" +# define JSONCPP_VERSION_MAJOR 1 +# define JSONCPP_VERSION_MINOR 6 +# define JSONCPP_VERSION_PATCH 2 +# define JSONCPP_VERSION_QUALIFIER +# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) + +#endif // JSON_VERSION_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/version.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_CONFIG_H_INCLUDED +#define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of +/// std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 + +// If non-zero, the library uses exceptions to report bad input instead of C +// assertion macros. The default is to use exceptions. +#ifndef JSON_USE_EXCEPTION +#define JSON_USE_EXCEPTION 1 +#endif + +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +/// Remarks: it is automatically defined in the generated amalgated header. +// #define JSON_IS_AMALGAMATION + +#ifdef JSON_IN_CPPTL +#include +#ifndef JSON_USE_CPPTL +#define JSON_USE_CPPTL 1 +#endif +#endif + +#ifdef JSON_IN_CPPTL +#define JSON_API CPPTL_API +#elif defined(JSON_DLL_BUILD) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllexport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#elif defined(JSON_DLL) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllimport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#endif // ifdef JSON_IN_CPPTL +#if !defined(JSON_API) +#define JSON_API +#endif + +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for +// integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 +// Microsoft Visual Studio 6 only support conversion from __int64 to double +// (no conversion from unsigned __int64). +#define JSON_USE_INT64_DOUBLE_CONVERSION 1 +// Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' +// characters in the debug information) +// All projects I've ever seen with VS6 were using this globally (not bothering +// with pragma push/pop). +#pragma warning(disable : 4786) +#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6 + +#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008 +/// Indicates that the following function is deprecated. +#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +#elif defined(__clang__) && defined(__has_feature) +#if __has_feature(attribute_deprecated_with_message) +#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +#endif +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +#define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +#elif defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) +#endif + +#if !defined(JSONCPP_DEPRECATED) +#define JSONCPP_DEPRECATED(message) +#endif // if !defined(JSONCPP_DEPRECATED) + +namespace Json { +typedef int Int; +typedef unsigned int UInt; +#if defined(JSON_NO_INT64) +typedef int LargestInt; +typedef unsigned int LargestUInt; +#undef JSON_HAS_INT64 +#else // if defined(JSON_NO_INT64) +// For Microsoft Visual use specific types as long long is not supported +#if defined(_MSC_VER) // Microsoft Visual Studio +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#else // if defined(_MSC_VER) // Other platforms, use long long +typedef long long int Int64; +typedef unsigned long long int UInt64; +#endif // if defined(_MSC_VER) +typedef Int64 LargestInt; +typedef UInt64 LargestUInt; +#define JSON_HAS_INT64 +#endif // if defined(JSON_NO_INT64) +} // end namespace Json + +#endif // JSON_CONFIG_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_FORWARDS_H_INCLUDED +#define JSON_FORWARDS_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// writer.h +class FastWriter; +class StyledWriter; + +// reader.h +class Reader; + +// features.h +class Features; + +// value.h +typedef unsigned int ArrayIndex; +class StaticString; +class Path; +class PathArgument; +class Value; +class ValueIteratorBase; +class ValueIterator; +class ValueConstIterator; + +} // namespace Json + +#endif // JSON_FORWARDS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/features.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_FEATURES_H_INCLUDED +#define CPPTL_JSON_FEATURES_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +/** \brief Configuration passed to reader and writer. + * This configuration object can be used to force the Reader or Writer + * to behave in a standard conforming way. + */ +class JSON_API Features { +public: + /** \brief A configuration that allows all features and assumes all strings + * are UTF-8. + * - C & C++ comments are allowed + * - Root object can be any JSON value + * - Assumes Value strings are encoded in UTF-8 + */ + static Features all(); + + /** \brief A configuration that is strictly compatible with the JSON + * specification. + * - Comments are forbidden. + * - Root object must be either an array or an object value. + * - Assumes Value strings are encoded in UTF-8 + */ + static Features strictMode(); + + /** \brief Initialize the configuration like JsonConfig::allFeatures; + */ + Features(); + + /// \c true if comments are allowed. Default: \c true. + bool allowComments_; + + /// \c true if root must be either an array or an object value. Default: \c + /// false. + bool strictRoot_; + + /// \c true if dropped null placeholders are allowed. Default: \c false. + bool allowDroppedNullPlaceholders_; + + /// \c true if numeric object key are allowed. Default: \c false. + bool allowNumericKeys_; +}; + +} // namespace Json + +#endif // CPPTL_JSON_FEATURES_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/features.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/value.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_H_INCLUDED +#define CPPTL_JSON_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include + +#ifndef JSON_USE_CPPTL_SMALLMAP +#include +#else +#include +#endif +#ifdef JSON_USE_CPPTL +#include +#endif + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +/** \brief JSON (JavaScript Object Notation). + */ +namespace Json { + +/** Base class for all exceptions we throw. + * + * We use nothing but these internally. Of course, STL can throw others. + */ +class JSON_API Exception; +/** Exceptions which the user cannot easily avoid. + * + * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input + * + * \remark derived from Json::Exception + */ +class JSON_API RuntimeError; +/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. + * + * These are precondition-violations (user bugs) and internal errors (our bugs). + * + * \remark derived from Json::Exception + */ +class JSON_API LogicError; + +/// used internally +void throwRuntimeError(std::string const& msg); +/// used internally +void throwLogicError(std::string const& msg); + +/** \brief Type of the value held by a Value object. + */ +enum ValueType { + nullValue = 0, ///< 'null' value + intValue, ///< signed integer value + uintValue, ///< unsigned integer value + realValue, ///< double value + stringValue, ///< UTF-8 string value + booleanValue, ///< bool value + arrayValue, ///< array value (ordered list) + objectValue ///< object value (collection of name/value pairs). +}; + +enum CommentPlacement { + commentBefore = 0, ///< a comment placed on the line before a value + commentAfterOnSameLine, ///< a comment just after a value on the same line + commentAfter, ///< a comment on the line after a value (only make sense for + /// root value) + numberOfCommentPlacement +}; + +//# ifdef JSON_USE_CPPTL +// typedef CppTL::AnyEnumerator EnumMemberNames; +// typedef CppTL::AnyEnumerator EnumValues; +//# endif + +/** \brief Lightweight wrapper to tag static string. + * + * Value constructor and objectValue member assignement takes advantage of the + * StaticString and avoid the cost of string duplication when storing the + * string or the member name. + * + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ +class JSON_API StaticString { +public: + explicit StaticString(const char* czstring) : c_str_(czstring) {} + + operator const char*() const { return c_str_; } + + const char* c_str() const { return c_str_; } + +private: + const char* c_str_; +}; + +/** \brief Represents a JSON value. + * + * This class is a discriminated union wrapper that can represents a: + * - signed integer [range: Value::minInt - Value::maxInt] + * - unsigned integer (range: 0 - Value::maxUInt) + * - double + * - UTF-8 string + * - boolean + * - 'null' + * - an ordered list of Value + * - collection of name/value pairs (javascript object) + * + * The type of the held value is represented by a #ValueType and + * can be obtained using type(). + * + * Values of an #objectValue or #arrayValue can be accessed using operator[]() + * methods. + * Non-const methods will automatically create the a #nullValue element + * if it does not exist. + * The sequence of an #arrayValue will be automatically resized and initialized + * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. + * + * The get() methods can be used to obtain default value in the case the + * required element does not exist. + * + * It is possible to iterate over the list of a #objectValue values using + * the getMemberNames() method. + * + * \note #Value string-length fit in size_t, but keys must be < 2^30. + * (The reason is an implementation detail.) A #CharReader will raise an + * exception if a bound is exceeded to avoid security holes in your app, + * but the Value API does *not* check bounds. That is the responsibility + * of the caller. + */ +class JSON_API Value { + friend class ValueIteratorBase; +public: + typedef std::vector Members; + typedef ValueIterator iterator; + typedef ValueConstIterator const_iterator; + typedef Json::UInt UInt; + typedef Json::Int Int; +#if defined(JSON_HAS_INT64) + typedef Json::UInt64 UInt64; + typedef Json::Int64 Int64; +#endif // defined(JSON_HAS_INT64) + typedef Json::LargestInt LargestInt; + typedef Json::LargestUInt LargestUInt; + typedef Json::ArrayIndex ArrayIndex; + + static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value(). + static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null + /// Minimum signed integer value that can be stored in a Json::Value. + static const LargestInt minLargestInt; + /// Maximum signed integer value that can be stored in a Json::Value. + static const LargestInt maxLargestInt; + /// Maximum unsigned integer value that can be stored in a Json::Value. + static const LargestUInt maxLargestUInt; + + /// Minimum signed int value that can be stored in a Json::Value. + static const Int minInt; + /// Maximum signed int value that can be stored in a Json::Value. + static const Int maxInt; + /// Maximum unsigned int value that can be stored in a Json::Value. + static const UInt maxUInt; + +#if defined(JSON_HAS_INT64) + /// Minimum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 minInt64; + /// Maximum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 maxInt64; + /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. + static const UInt64 maxUInt64; +#endif // defined(JSON_HAS_INT64) + +private: +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + class CZString { + public: + enum DuplicationPolicy { + noDuplication = 0, + duplicate, + duplicateOnCopy + }; + CZString(ArrayIndex index); + CZString(char const* str, unsigned length, DuplicationPolicy allocate); + CZString(CZString const& other); + ~CZString(); + CZString& operator=(CZString other); + bool operator<(CZString const& other) const; + bool operator==(CZString const& other) const; + ArrayIndex index() const; + //const char* c_str() const; ///< \deprecated + char const* data() const; + unsigned length() const; + bool isStaticString() const; + + private: + void swap(CZString& other); + + struct StringStorage { + unsigned policy_: 2; + unsigned length_: 30; // 1GB max + }; + + char const* cstr_; // actually, a prefixed string, unless policy is noDup + union { + ArrayIndex index_; + StringStorage storage_; + }; + }; + +public: +#ifndef JSON_USE_CPPTL_SMALLMAP + typedef std::map ObjectValues; +#else + typedef CppTL::SmallMap ObjectValues; +#endif // ifndef JSON_USE_CPPTL_SMALLMAP +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + +public: + /** \brief Create a default Value of the given type. + + This is a very useful constructor. + To create an empty array, pass arrayValue. + To create an empty object, pass objectValue. + Another Value can then be set to this one by assignment. +This is useful since clear() and resize() will not alter types. + + Examples: +\code +Json::Value null_value; // null +Json::Value arr_value(Json::arrayValue); // [] +Json::Value obj_value(Json::objectValue); // {} +\endcode + */ + Value(ValueType type = nullValue); + Value(Int value); + Value(UInt value); +#if defined(JSON_HAS_INT64) + Value(Int64 value); + Value(UInt64 value); +#endif // if defined(JSON_HAS_INT64) + Value(double value); + Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.) + Value(const char* beginValue, const char* endValue); ///< Copy all, incl zeroes. + /** \brief Constructs a value from a static string. + + * Like other value string constructor but do not duplicate the string for + * internal storage. The given string must remain alive after the call to this + * constructor. + * \note This works only for null-terminated strings. (We cannot change the + * size of this class, so we have nowhere to store the length, + * which might be computed later for various operations.) + * + * Example of usage: + * \code + * static StaticString foo("some text"); + * Json::Value aValue(foo); + * \endcode + */ + Value(const StaticString& value); + Value(const std::string& value); ///< Copy data() til size(). Embedded zeroes too. +#ifdef JSON_USE_CPPTL + Value(const CppTL::ConstString& value); +#endif + Value(bool value); + /// Deep copy. + Value(const Value& other); + ~Value(); + + /// Deep copy, then swap(other). + /// \note Over-write existing comments. To preserve comments, use #swapPayload(). + Value& operator=(Value other); + /// Swap everything. + void swap(Value& other); + /// Swap values but leave comments and source offsets in place. + void swapPayload(Value& other); + + ValueType type() const; + + /// Compare payload only, not comments etc. + bool operator<(const Value& other) const; + bool operator<=(const Value& other) const; + bool operator>=(const Value& other) const; + bool operator>(const Value& other) const; + bool operator==(const Value& other) const; + bool operator!=(const Value& other) const; + int compare(const Value& other) const; + + const char* asCString() const; ///< Embedded zeroes could cause you trouble! + std::string asString() const; ///< Embedded zeroes are possible. + /** Get raw char* of string-value. + * \return false if !string. (Seg-fault if str or end are NULL.) + */ + bool getString( + char const** str, char const** end) const; +#ifdef JSON_USE_CPPTL + CppTL::ConstString asConstString() const; +#endif + Int asInt() const; + UInt asUInt() const; +#if defined(JSON_HAS_INT64) + Int64 asInt64() const; + UInt64 asUInt64() const; +#endif // if defined(JSON_HAS_INT64) + LargestInt asLargestInt() const; + LargestUInt asLargestUInt() const; + float asFloat() const; + double asDouble() const; + bool asBool() const; + + bool isNull() const; + bool isBool() const; + bool isInt() const; + bool isInt64() const; + bool isUInt() const; + bool isUInt64() const; + bool isIntegral() const; + bool isDouble() const; + bool isNumeric() const; + bool isString() const; + bool isArray() const; + bool isObject() const; + + bool isConvertibleTo(ValueType other) const; + + /// Number of values in array or object + ArrayIndex size() const; + + /// \brief Return true if empty array, empty object, or null; + /// otherwise, false. + bool empty() const; + + /// Return isNull() + bool operator!() const; + + /// Remove all object members and array elements. + /// \pre type() is arrayValue, objectValue, or nullValue + /// \post type() is unchanged + void clear(); + + /// Resize the array to size elements. + /// New elements are initialized to null. + /// May only be called on nullValue or arrayValue. + /// \pre type() is arrayValue or nullValue + /// \post type() is arrayValue + void resize(ArrayIndex size); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are + /// inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value& operator[](ArrayIndex index); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are + /// inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value& operator[](int index); + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value& operator[](ArrayIndex index) const; + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value& operator[](int index) const; + + /// If the array contains at least index+1 elements, returns the element + /// value, + /// otherwise returns defaultValue. + Value get(ArrayIndex index, const Value& defaultValue) const; + /// Return true if index < size(). + bool isValidIndex(ArrayIndex index) const; + /// \brief Append value to array at the end. + /// + /// Equivalent to jsonvalue[jsonvalue.size()] = value; + Value& append(const Value& value); + + /// Access an object value by name, create a null member if it does not exist. + /// \note Because of our implementation, keys are limited to 2^30 -1 chars. + /// Exceeding that will cause an exception. + Value& operator[](const char* key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value& operator[](const char* key) const; + /// Access an object value by name, create a null member if it does not exist. + /// \param key may contain embedded nulls. + Value& operator[](const std::string& key); + /// Access an object value by name, returns null if there is no member with + /// that name. + /// \param key may contain embedded nulls. + const Value& operator[](const std::string& key) const; + /** \brief Access an object value by name, create a null member if it does not + exist. + + * If the object has no entry for that name, then the member name used to store + * the new entry is not duplicated. + * Example of use: + * \code + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + Value& operator[](const StaticString& key); +#ifdef JSON_USE_CPPTL + /// Access an object value by name, create a null member if it does not exist. + Value& operator[](const CppTL::ConstString& key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value& operator[](const CppTL::ConstString& key) const; +#endif + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + Value get(const char* key, const Value& defaultValue) const; + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + /// \param key may contain embedded nulls. + Value get(const char* key, const char* end, const Value& defaultValue) const; + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + /// \param key may contain embedded nulls. + Value get(const std::string& key, const Value& defaultValue) const; +#ifdef JSON_USE_CPPTL + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + Value get(const CppTL::ConstString& key, const Value& defaultValue) const; +#endif + /// Most general and efficient version of isMember()const, get()const, + /// and operator[]const + /// \note As stated elsewhere, behavior is undefined if (end-key) >= 2^30 + Value const* find(char const* key, char const* end) const; + /// Most general and efficient version of object-mutators. + /// \note As stated elsewhere, behavior is undefined if (end-key) >= 2^30 + /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue. + Value const* demand(char const* key, char const* end); + /// \brief Remove and return the named member. + /// + /// Do nothing if it did not exist. + /// \return the removed Value, or null. + /// \pre type() is objectValue or nullValue + /// \post type() is unchanged + /// \deprecated + Value removeMember(const char* key); + /// Same as removeMember(const char*) + /// \param key may contain embedded nulls. + /// \deprecated + Value removeMember(const std::string& key); + /// Same as removeMember(const char* key, const char* end, Value* removed), + /// but 'key' is null-terminated. + bool removeMember(const char* key, Value* removed); + /** \brief Remove the named map member. + + Update 'removed' iff removed. + \param key may contain embedded nulls. + \return true iff removed (no exceptions) + */ + bool removeMember(std::string const& key, Value* removed); + /// Same as removeMember(std::string const& key, Value* removed) + bool removeMember(const char* key, const char* end, Value* removed); + /** \brief Remove the indexed array element. + + O(n) expensive operations. + Update 'removed' iff removed. + \return true iff removed (no exceptions) + */ + bool removeIndex(ArrayIndex i, Value* removed); + + /// Return true if the object has a member named key. + /// \note 'key' must be null-terminated. + bool isMember(const char* key) const; + /// Return true if the object has a member named key. + /// \param key may contain embedded nulls. + bool isMember(const std::string& key) const; + /// Same as isMember(std::string const& key)const + bool isMember(const char* key, const char* end) const; +#ifdef JSON_USE_CPPTL + /// Return true if the object has a member named key. + bool isMember(const CppTL::ConstString& key) const; +#endif + + /// \brief Return a list of the member names. + /// + /// If null, return an empty list. + /// \pre type() is objectValue or nullValue + /// \post if type() was nullValue, it remains nullValue + Members getMemberNames() const; + + //# ifdef JSON_USE_CPPTL + // EnumMemberNames enumMemberNames() const; + // EnumValues enumValues() const; + //# endif + + /// \deprecated Always pass len. + JSONCPP_DEPRECATED("Use setComment(std::string const&) instead.") + void setComment(const char* comment, CommentPlacement placement); + /// Comments must be //... or /* ... */ + void setComment(const char* comment, size_t len, CommentPlacement placement); + /// Comments must be //... or /* ... */ + void setComment(const std::string& comment, CommentPlacement placement); + bool hasComment(CommentPlacement placement) const; + /// Include delimiters and embedded newlines. + std::string getComment(CommentPlacement placement) const; + + std::string toStyledString() const; + + const_iterator begin() const; + const_iterator end() const; + + iterator begin(); + iterator end(); + + // Accessors for the [start, limit) range of bytes within the JSON text from + // which this value was parsed, if any. + void setOffsetStart(size_t start); + void setOffsetLimit(size_t limit); + size_t getOffsetStart() const; + size_t getOffsetLimit() const; + +private: + void initBasic(ValueType type, bool allocated = false); + + Value& resolveReference(const char* key); + Value& resolveReference(const char* key, const char* end); + + struct CommentInfo { + CommentInfo(); + ~CommentInfo(); + + void setComment(const char* text, size_t len); + + char* comment_; + }; + + // struct MemberNamesTransform + //{ + // typedef const char *result_type; + // const char *operator()( const CZString &name ) const + // { + // return name.c_str(); + // } + //}; + + union ValueHolder { + LargestInt int_; + LargestUInt uint_; + double real_; + bool bool_; + char* string_; // actually ptr to unsigned, followed by str, unless !allocated_ + ObjectValues* map_; + } value_; + ValueType type_ : 8; + unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. + // If not allocated_, string_ must be null-terminated. + CommentInfo* comments_; + + // [start, limit) byte offsets in the source JSON text from which this Value + // was extracted. + size_t start_; + size_t limit_; +}; + +/** \brief Experimental and untested: represents an element of the "path" to + * access a node. + */ +class JSON_API PathArgument { +public: + friend class Path; + + PathArgument(); + PathArgument(ArrayIndex index); + PathArgument(const char* key); + PathArgument(const std::string& key); + +private: + enum Kind { + kindNone = 0, + kindIndex, + kindKey + }; + std::string key_; + ArrayIndex index_; + Kind kind_; +}; + +/** \brief Experimental and untested: represents a "path" to access a node. + * + * Syntax: + * - "." => root node + * - ".[n]" => elements at index 'n' of root node (an array value) + * - ".name" => member named 'name' of root node (an object value) + * - ".name1.name2.name3" + * - ".[0][1][2].name1[3]" + * - ".%" => member name is provided as parameter + * - ".[%]" => index is provied as parameter + */ +class JSON_API Path { +public: + Path(const std::string& path, + const PathArgument& a1 = PathArgument(), + const PathArgument& a2 = PathArgument(), + const PathArgument& a3 = PathArgument(), + const PathArgument& a4 = PathArgument(), + const PathArgument& a5 = PathArgument()); + + const Value& resolve(const Value& root) const; + Value resolve(const Value& root, const Value& defaultValue) const; + /// Creates the "path" to access the specified node and returns a reference on + /// the node. + Value& make(Value& root) const; + +private: + typedef std::vector InArgs; + typedef std::vector Args; + + void makePath(const std::string& path, const InArgs& in); + void addPathInArg(const std::string& path, + const InArgs& in, + InArgs::const_iterator& itInArg, + PathArgument::Kind kind); + void invalidPath(const std::string& path, int location); + + Args args_; +}; + +/** \brief base class for Value iterators. + * + */ +class JSON_API ValueIteratorBase { +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef unsigned int size_t; + typedef int difference_type; + typedef ValueIteratorBase SelfType; + + bool operator==(const SelfType& other) const { return isEqual(other); } + + bool operator!=(const SelfType& other) const { return !isEqual(other); } + + difference_type operator-(const SelfType& other) const { + return other.computeDistance(*this); + } + + /// Return either the index or the member name of the referenced value as a + /// Value. + Value key() const; + + /// Return the index of the referenced Value, or -1 if it is not an arrayValue. + UInt index() const; + + /// Return the member name of the referenced Value, or "" if it is not an + /// objectValue. + /// \note Avoid `c_str()` on result, as embedded zeroes are possible. + std::string name() const; + + /// Return the member name of the referenced Value. "" if it is not an + /// objectValue. + /// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls. + JSONCPP_DEPRECATED("Use `key = name();` instead.") + char const* memberName() const; + /// Return the member name of the referenced Value, or NULL if it is not an + /// objectValue. + /// \note Better version than memberName(). Allows embedded nulls. + char const* memberName(char const** end) const; + +protected: + Value& deref() const; + + void increment(); + + void decrement(); + + difference_type computeDistance(const SelfType& other) const; + + bool isEqual(const SelfType& other) const; + + void copy(const SelfType& other); + +private: + Value::ObjectValues::iterator current_; + // Indicates that iterator is for a null value. + bool isNull_; + +public: + // For some reason, BORLAND needs these at the end, rather + // than earlier. No idea why. + ValueIteratorBase(); + explicit ValueIteratorBase(const Value::ObjectValues::iterator& current); +}; + +/** \brief const iterator for object and array value. + * + */ +class JSON_API ValueConstIterator : public ValueIteratorBase { + friend class Value; + +public: + typedef const Value value_type; + //typedef unsigned int size_t; + //typedef int difference_type; + typedef const Value& reference; + typedef const Value* pointer; + typedef ValueConstIterator SelfType; + + ValueConstIterator(); + +private: +/*! \internal Use by Value to create an iterator. + */ + explicit ValueConstIterator(const Value::ObjectValues::iterator& current); +public: + SelfType& operator=(const ValueIteratorBase& other); + + SelfType operator++(int) { + SelfType temp(*this); + ++*this; + return temp; + } + + SelfType operator--(int) { + SelfType temp(*this); + --*this; + return temp; + } + + SelfType& operator--() { + decrement(); + return *this; + } + + SelfType& operator++() { + increment(); + return *this; + } + + reference operator*() const { return deref(); } + + pointer operator->() const { return &deref(); } +}; + +/** \brief Iterator for object and array value. + */ +class JSON_API ValueIterator : public ValueIteratorBase { + friend class Value; + +public: + typedef Value value_type; + typedef unsigned int size_t; + typedef int difference_type; + typedef Value& reference; + typedef Value* pointer; + typedef ValueIterator SelfType; + + ValueIterator(); + ValueIterator(const ValueConstIterator& other); + ValueIterator(const ValueIterator& other); + +private: +/*! \internal Use by Value to create an iterator. + */ + explicit ValueIterator(const Value::ObjectValues::iterator& current); +public: + SelfType& operator=(const SelfType& other); + + SelfType operator++(int) { + SelfType temp(*this); + ++*this; + return temp; + } + + SelfType operator--(int) { + SelfType temp(*this); + --*this; + return temp; + } + + SelfType& operator--() { + decrement(); + return *this; + } + + SelfType& operator++() { + increment(); + return *this; + } + + reference operator*() const { return deref(); } + + pointer operator->() const { return &deref(); } +}; + +} // namespace Json + + +namespace std { +/// Specialize std::swap() for Json::Value. +template<> +inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); } +} + + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // CPPTL_JSON_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/value.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/reader.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_READER_H_INCLUDED +#define CPPTL_JSON_READER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "features.h" +#include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +namespace Json { + +/** \brief Unserialize a JSON document into a + *Value. + * + * \deprecated Use CharReader and CharReaderBuilder. + */ +class JSON_API Reader { +public: + typedef char Char; + typedef const Char* Location; + + /** \brief An error tagged with where in the JSON text it was encountered. + * + * The offsets give the [start, limit) range of bytes within the text. Note + * that this is bytes, not codepoints. + * + */ + struct StructuredError { + size_t offset_start; + size_t offset_limit; + std::string message; + }; + + /** \brief Constructs a Reader allowing all features + * for parsing. + */ + Reader(); + + /** \brief Constructs a Reader allowing the specified feature set + * for parsing. + */ + Reader(const Features& features); + + /** \brief Read a Value from a JSON + * document. + * \param document UTF-8 encoded string containing the document to read. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them + * back during + * serialization, \c false to discard comments. + * This parameter is ignored if + * Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an + * error occurred. + */ + bool + parse(const std::string& document, Value& root, bool collectComments = true); + + /** \brief Read a Value from a JSON + document. + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the + document to read. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the + document to read. + * Must be >= beginDoc. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them + back during + * serialization, \c false to discard comments. + * This parameter is ignored if + Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an + error occurred. + */ + bool parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments = true); + + /// \brief Parse from input stream. + /// \see Json::operator>>(std::istream&, Json::Value&). + bool parse(std::istream& is, Value& root, bool collectComments = true); + + /** \brief Returns a user friendly string that list errors in the parsed + * document. + * \return Formatted error message with the list of errors with their location + * in + * the parsed document. An empty string is returned if no error + * occurred + * during parsing. + * \deprecated Use getFormattedErrorMessages() instead (typo fix). + */ + JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.") + std::string getFormatedErrorMessages() const; + + /** \brief Returns a user friendly string that list errors in the parsed + * document. + * \return Formatted error message with the list of errors with their location + * in + * the parsed document. An empty string is returned if no error + * occurred + * during parsing. + */ + std::string getFormattedErrorMessages() const; + + /** \brief Returns a vector of structured erros encounted while parsing. + * \return A (possibly empty) vector of StructuredError objects. Currently + * only one error can be returned, but the caller should tolerate + * multiple + * errors. This can occur if the parser recovers from a non-fatal + * parse error and then encounters additional errors. + */ + std::vector getStructuredErrors() const; + + /** \brief Add a semantic error message. + * \param value JSON Value location associated with the error + * \param message The error message. + * \return \c true if the error was successfully added, \c false if the + * Value offset exceeds the document size. + */ + bool pushError(const Value& value, const std::string& message); + + /** \brief Add a semantic error message with extra context. + * \param value JSON Value location associated with the error + * \param message The error message. + * \param extra Additional JSON Value location to contextualize the error + * \return \c true if the error was successfully added, \c false if either + * Value offset exceeds the document size. + */ + bool pushError(const Value& value, const std::string& message, const Value& extra); + + /** \brief Return whether there are any errors. + * \return \c true if there are no errors to report \c false if + * errors have occurred. + */ + bool good() const; + +private: + enum TokenType { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque Errors; + + bool readToken(Token& token); + void skipSpaces(); + bool match(Location pattern, int patternLength); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + void readNumber(); + bool readValue(); + bool readObject(Token& token); + bool readArray(Token& token); + bool decodeNumber(Token& token); + bool decodeNumber(Token& token, Value& decoded); + bool decodeString(Token& token); + bool decodeString(Token& token, std::string& decoded); + bool decodeDouble(Token& token); + bool decodeDouble(Token& token, Value& decoded); + bool decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool addError(const std::string& message, Token& token, Location extra = 0); + bool recoverFromError(TokenType skipUntilToken); + bool addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken); + void skipUntilSpace(); + Value& currentValue(); + Char getNextChar(); + void + getLocationLineAndColumn(Location location, int& line, int& column) const; + std::string getLocationLineAndColumn(Location location) const; + void addComment(Location begin, Location end, CommentPlacement placement); + void skipCommentTokens(Token& token); + + typedef std::stack Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value* lastValue_; + std::string commentsBefore_; + Features features_; + bool collectComments_; +}; // Reader + +/** Interface for reading JSON from a char array. + */ +class JSON_API CharReader { +public: + virtual ~CharReader() {} + /** \brief Read a Value from a JSON + document. + * The document must be a UTF-8 encoded string containing the document to read. + * + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the + document to read. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the + document to read. + * Must be >= beginDoc. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param errs [out] Formatted error messages (if not NULL) + * a user friendly string that lists errors in the parsed + * document. + * \return \c true if the document was successfully parsed, \c false if an + error occurred. + */ + virtual bool parse( + char const* beginDoc, char const* endDoc, + Value* root, std::string* errs) = 0; + + class Factory { + public: + virtual ~Factory() {} + /** \brief Allocate a CharReader via operator new(). + * \throw std::exception if something goes wrong (e.g. invalid settings) + */ + virtual CharReader* newCharReader() const = 0; + }; // Factory +}; // CharReader + +/** \brief Build a CharReader implementation. + +Usage: +\code + using namespace Json; + CharReaderBuilder builder; + builder["collectComments"] = false; + Value value; + std::string errs; + bool ok = parseFromStream(builder, std::cin, &value, &errs); +\endcode +*/ +class JSON_API CharReaderBuilder : public CharReader::Factory { +public: + // Note: We use a Json::Value so that we can add data-members to this class + // without a major version bump. + /** Configuration of this builder. + These are case-sensitive. + Available settings (case-sensitive): + - `"collectComments": false or true` + - true to collect comment and allow writing them + back during serialization, false to discard comments. + This parameter is ignored if allowComments is false. + - `"allowComments": false or true` + - true if comments are allowed. + - `"strictRoot": false or true` + - true if root must be either an array or an object value + - `"allowDroppedNullPlaceholders": false or true` + - true if dropped null placeholders are allowed. (See StreamWriterBuilder.) + - `"allowNumericKeys": false or true` + - true if numeric object keys are allowed. + - `"allowSingleQuotes": false or true` + - true if '' are allowed for strings (both keys and values) + - `"stackLimit": integer` + - Exceeding stackLimit (recursive depth of `readValue()`) will + cause an exception. + - This is a security issue (seg-faults caused by deeply nested JSON), + so the default is low. + - `"failIfExtra": false or true` + - If true, `parse()` returns false when extra non-whitespace trails + the JSON value in the input string. + - `"rejectDupKeys": false or true` + - If true, `parse()` returns false when a key is duplicated within an object. + + You can examine 'settings_` yourself + to see the defaults. You can also write and read them just like any + JSON Value. + \sa setDefaults() + */ + Json::Value settings_; + + CharReaderBuilder(); + virtual ~CharReaderBuilder(); + + virtual CharReader* newCharReader() const; + + /** \return true if 'settings' are legal and consistent; + * otherwise, indicate bad settings via 'invalid'. + */ + bool validate(Json::Value* invalid) const; + + /** A simple way to update a specific setting. + */ + Value& operator[](std::string key); + + /** Called by ctor, but you can use this to reset settings_. + * \pre 'settings' != NULL (but Json::null is fine) + * \remark Defaults: + * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults + */ + static void setDefaults(Json::Value* settings); + /** Same as old Features::strictMode(). + * \pre 'settings' != NULL (but Json::null is fine) + * \remark Defaults: + * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode + */ + static void strictMode(Json::Value* settings); +}; + +/** Consume entire stream and use its begin/end. + * Someday we might have a real StreamReader, but for now this + * is convenient. + */ +bool JSON_API parseFromStream( + CharReader::Factory const&, + std::istream&, + Value* root, std::string* errs); + +/** \brief Read from 'sin' into 'root'. + + Always keep comments from the input JSON. + + This can be used to read a file into a particular sub-object. + For example: + \code + Json::Value root; + cin >> root["dir"]["file"]; + cout << root; + \endcode + Result: + \verbatim + { + "dir": { + "file": { + // The input stream JSON would be nested here. + } + } + } + \endverbatim + \throw std::exception on parse error. + \see Json::operator<<() +*/ +JSON_API std::istream& operator>>(std::istream&, Value&); + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // CPPTL_JSON_READER_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/reader.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/writer.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_WRITER_H_INCLUDED +#define JSON_WRITER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +namespace Json { + +class Value; + +/** + +Usage: +\code + using namespace Json; + void writeToStdout(StreamWriter::Factory const& factory, Value const& value) { + std::unique_ptr const writer( + factory.newStreamWriter()); + writer->write(value, &std::cout); + std::cout << std::endl; // add lf and flush + } +\endcode +*/ +class JSON_API StreamWriter { +protected: + std::ostream* sout_; // not owned; will not delete +public: + StreamWriter(); + virtual ~StreamWriter(); + /** Write Value into document as configured in sub-class. + Do not take ownership of sout, but maintain a reference during function. + \pre sout != NULL + \return zero on success (For now, we always return zero, so check the stream instead.) + \throw std::exception possibly, depending on configuration + */ + virtual int write(Value const& root, std::ostream* sout) = 0; + + /** \brief A simple abstract factory. + */ + class JSON_API Factory { + public: + virtual ~Factory(); + /** \brief Allocate a CharReader via operator new(). + * \throw std::exception if something goes wrong (e.g. invalid settings) + */ + virtual StreamWriter* newStreamWriter() const = 0; + }; // Factory +}; // StreamWriter + +/** \brief Write into stringstream, then return string, for convenience. + * A StreamWriter will be created from the factory, used, and then deleted. + */ +std::string JSON_API writeString(StreamWriter::Factory const& factory, Value const& root); + + +/** \brief Build a StreamWriter implementation. + +Usage: +\code + using namespace Json; + Value value = ...; + StreamWriterBuilder builder; + builder["commentStyle"] = "None"; + builder["indentation"] = " "; // or whatever you like + std::unique_ptr writer( + builder.newStreamWriter()); + writer->write(value, &std::cout); + std::cout << std::endl; // add lf and flush +\endcode +*/ +class JSON_API StreamWriterBuilder : public StreamWriter::Factory { +public: + // Note: We use a Json::Value so that we can add data-members to this class + // without a major version bump. + /** Configuration of this builder. + Available settings (case-sensitive): + - "commentStyle": "None" or "All" + - "indentation": "" + - "enableYAMLCompatibility": false or true + - slightly change the whitespace around colons + - "dropNullPlaceholders": false or true + - Drop the "null" string from the writer's output for nullValues. + Strictly speaking, this is not valid JSON. But when the output is being + fed to a browser's Javascript, it makes for smaller output and the + browser can handle the output just fine. + + You can examine 'settings_` yourself + to see the defaults. You can also write and read them just like any + JSON Value. + \sa setDefaults() + */ + Json::Value settings_; + + StreamWriterBuilder(); + virtual ~StreamWriterBuilder(); + + /** + * \throw std::exception if something goes wrong (e.g. invalid settings) + */ + virtual StreamWriter* newStreamWriter() const; + + /** \return true if 'settings' are legal and consistent; + * otherwise, indicate bad settings via 'invalid'. + */ + bool validate(Json::Value* invalid) const; + /** A simple way to update a specific setting. + */ + Value& operator[](std::string key); + + /** Called by ctor, but you can use this to reset settings_. + * \pre 'settings' != NULL (but Json::null is fine) + * \remark Defaults: + * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults + */ + static void setDefaults(Json::Value* settings); +}; + +/** \brief Abstract class for writers. + * \deprecated Use StreamWriter. (And really, this is an implementation detail.) + */ +class JSON_API Writer { +public: + virtual ~Writer(); + + virtual std::string write(const Value& root) = 0; +}; + +/** \brief Outputs a Value in JSON format + *without formatting (not human friendly). + * + * The JSON document is written in a single line. It is not intended for 'human' + *consumption, + * but may be usefull to support feature such as RPC where bandwith is limited. + * \sa Reader, Value + * \deprecated Use StreamWriterBuilder. + */ +class JSON_API FastWriter : public Writer { + +public: + FastWriter(); + virtual ~FastWriter() {} + + void enableYAMLCompatibility(); + + /** \brief Drop the "null" string from the writer's output for nullValues. + * Strictly speaking, this is not valid JSON. But when the output is being + * fed to a browser's Javascript, it makes for smaller output and the + * browser can handle the output just fine. + */ + void dropNullPlaceholders(); + + void omitEndingLineFeed(); + +public: // overridden from Writer + virtual std::string write(const Value& root); + +private: + void writeValue(const Value& value); + + std::string document_; + bool yamlCompatiblityEnabled_; + bool dropNullPlaceholders_; + bool omitEndingLineFeed_; +}; + +/** \brief Writes a Value in JSON format in a + *human friendly way. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per + *line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value + *types, + * and all the values fit on one lines, then print the array on a single + *line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their + *#CommentPlacement. + * + * \sa Reader, Value, Value::setComment() + * \deprecated Use StreamWriterBuilder. + */ +class JSON_API StyledWriter : public Writer { +public: + StyledWriter(); + virtual ~StyledWriter() {} + +public: // overridden from Writer + /** \brief Serialize a Value in JSON format. + * \param root Value to serialize. + * \return String containing the JSON document that represents the root value. + */ + virtual std::string write(const Value& root); + +private: + void writeValue(const Value& value); + void writeArrayValue(const Value& value); + bool isMultineArray(const Value& value); + void pushValue(const std::string& value); + void writeIndent(); + void writeWithIndent(const std::string& value); + void indent(); + void unindent(); + void writeCommentBeforeValue(const Value& root); + void writeCommentAfterValueOnSameLine(const Value& root); + bool hasCommentForValue(const Value& value); + static std::string normalizeEOL(const std::string& text); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::string document_; + std::string indentString_; + int rightMargin_; + int indentSize_; + bool addChildValues_; +}; + +/** \brief Writes a Value in JSON format in a + human friendly way, + to a stream rather than to a string. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per + line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value + types, + * and all the values fit on one lines, then print the array on a single + line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their + #CommentPlacement. + * + * \param indentation Each level will be indented by this amount extra. + * \sa Reader, Value, Value::setComment() + * \deprecated Use StreamWriterBuilder. + */ +class JSON_API StyledStreamWriter { +public: + StyledStreamWriter(std::string indentation = "\t"); + ~StyledStreamWriter() {} + +public: + /** \brief Serialize a Value in JSON format. + * \param out Stream to write to. (Can be ostringstream, e.g.) + * \param root Value to serialize. + * \note There is no point in deriving from Writer, since write() should not + * return a value. + */ + void write(std::ostream& out, const Value& root); + +private: + void writeValue(const Value& value); + void writeArrayValue(const Value& value); + bool isMultineArray(const Value& value); + void pushValue(const std::string& value); + void writeIndent(); + void writeWithIndent(const std::string& value); + void indent(); + void unindent(); + void writeCommentBeforeValue(const Value& root); + void writeCommentAfterValueOnSameLine(const Value& root); + bool hasCommentForValue(const Value& value); + static std::string normalizeEOL(const std::string& text); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::ostream* document_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + bool addChildValues_ : 1; + bool indented_ : 1; +}; + +#if defined(JSON_HAS_INT64) +std::string JSON_API valueToString(Int value); +std::string JSON_API valueToString(UInt value); +#endif // if defined(JSON_HAS_INT64) +std::string JSON_API valueToString(LargestInt value); +std::string JSON_API valueToString(LargestUInt value); +std::string JSON_API valueToString(double value); +std::string JSON_API valueToString(bool value); +std::string JSON_API valueToQuotedString(const char* value); + +/// \brief Output using the StyledStreamWriter. +/// \see Json::operator>>() +JSON_API std::ostream& operator<<(std::ostream&, const Value& root); + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // JSON_WRITER_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/writer.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/assertions.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED +#define CPPTL_JSON_ASSERTIONS_H_INCLUDED + +#include +#include + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +/** It should not be possible for a maliciously designed file to + * cause an abort() or seg-fault, so these macros are used only + * for pre-condition violations and internal logic errors. + */ +#if JSON_USE_EXCEPTION + +// @todo <= add detail about condition in exception +# define JSON_ASSERT(condition) \ + {if (!(condition)) {Json::throwLogicError( "assert json failed" );}} + +# define JSON_FAIL_MESSAGE(message) \ + { \ + std::ostringstream oss; oss << message; \ + Json::throwLogicError(oss.str()); \ + abort(); \ + } + +#else // JSON_USE_EXCEPTION + +# define JSON_ASSERT(condition) assert(condition) + +// The call to assert() will show the failure message in debug builds. In +// release builds we abort, for a core-dump or debugger. +# define JSON_FAIL_MESSAGE(message) \ + { \ + std::ostringstream oss; oss << message; \ + assert(false && oss.str().c_str()); \ + abort(); \ + } + + +#endif + +#define JSON_ASSERT_MESSAGE(condition, message) \ + if (!(condition)) { \ + JSON_FAIL_MESSAGE(message); \ + } + +#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/assertions.h +// ////////////////////////////////////////////////////////////////////// + + + + + +#endif //ifndef JSON_AMALGATED_H_INCLUDED diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/jsoncpp.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/jsoncpp.cpp new file mode 100644 index 00000000000..13049140401 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/jsoncpp/dist/jsoncpp.cpp @@ -0,0 +1,5124 @@ +/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/). +/// It is intended to be used with #include "json/json.h" + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + + +#include "json/json.h" + +#ifndef JSON_IS_AMALGAMATION +#error "Compile with -I PATH_TO_JSON_DIRECTORY" +#endif + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_tool.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED +#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +/* This header provides common string manipulation support, such as UTF-8, + * portable conversion from/to string... + * + * It is an internal header that must not be exposed. + */ + +namespace Json { + +/// Converts a unicode code-point to UTF-8. +static inline std::string codePointToUTF8(unsigned int cp) { + std::string result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) { + result.resize(1); + result[0] = static_cast(cp); + } else if (cp <= 0x7FF) { + result.resize(2); + result[1] = static_cast(0x80 | (0x3f & cp)); + result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); + } else if (cp <= 0xFFFF) { + result.resize(3); + result[2] = static_cast(0x80 | (0x3f & cp)); + result[1] = 0x80 | static_cast((0x3f & (cp >> 6))); + result[0] = 0xE0 | static_cast((0xf & (cp >> 12))); + } else if (cp <= 0x10FFFF) { + result.resize(4); + result[3] = static_cast(0x80 | (0x3f & cp)); + result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + +/// Returns true if ch is a control character (in range [0,32[). +static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; } + +enum { + /// Constant that specify the size of the buffer that must be passed to + /// uintToString. + uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 +}; + +// Defines a char buffer for use with uintToString(). +typedef char UIntToStringBuffer[uintToStringBufferSize]; + +/** Converts an unsigned integer to string. + * @param value Unsigned interger to convert to string + * @param current Input/Output string buffer. + * Must have at least uintToStringBufferSize chars free. + */ +static inline void uintToString(LargestUInt value, char*& current) { + *--current = 0; + do { + *--current = char(value % 10) + '0'; + value /= 10; + } while (value != 0); +} + +/** Change ',' to '.' everywhere in buffer. + * + * We had a sophisticated way, but it did not work in WinCE. + * @see https://github.com/open-source-parsers/jsoncpp/pull/9 + */ +static inline void fixNumericLocale(char* begin, char* end) { + while (begin < end) { + if (*begin == ',') { + *begin = '.'; + } + ++begin; + } +} + +} // namespace Json { + +#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_tool.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_reader.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below +#define snprintf _snprintf +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +// Disable warning about strdup being deprecated. +#pragma warning(disable : 4996) +#endif + +static int const stackLimit_g = 1000; +static int stackDepth_g = 0; // see readValue() + +namespace Json { + +#if __cplusplus >= 201103L +typedef std::unique_ptr CharReaderPtr; +#else +typedef std::auto_ptr CharReaderPtr; +#endif + +// Implementation of class Features +// //////////////////////////////// + +Features::Features() + : allowComments_(true), strictRoot_(false), + allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {} + +Features Features::all() { return Features(); } + +Features Features::strictMode() { + Features features; + features.allowComments_ = false; + features.strictRoot_ = true; + features.allowDroppedNullPlaceholders_ = false; + features.allowNumericKeys_ = false; + return features; +} + +// Implementation of class Reader +// //////////////////////////////// + +static bool containsNewLine(Reader::Location begin, Reader::Location end) { + for (; begin < end; ++begin) + if (*begin == '\n' || *begin == '\r') + return true; + return false; +} + +// Class Reader +// ////////////////////////////////////////////////////////////////// + +Reader::Reader() + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(Features::all()), + collectComments_() {} + +Reader::Reader(const Features& features) + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(features), collectComments_() { +} + +bool +Reader::parse(const std::string& document, Value& root, bool collectComments) { + document_ = document; + const char* begin = document_.c_str(); + const char* end = begin + document_.length(); + return parse(begin, end, root, collectComments); +} + +bool Reader::parse(std::istream& sin, Value& root, bool collectComments) { + // std::istream_iterator begin(sin); + // std::istream_iterator end; + // Those would allow streamed input from a file, if parse() were a + // template function. + + // Since std::string is reference-counted, this at least does not + // create an extra copy. + std::string doc; + std::getline(sin, doc, (char)EOF); + return parse(doc, root, collectComments); +} + +bool Reader::parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments) { + if (!features_.allowComments_) { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while (!nodes_.empty()) + nodes_.pop(); + nodes_.push(&root); + + stackDepth_g = 0; // Yes, this is bad coding, but options are limited. + bool successful = readValue(); + Token token; + skipCommentTokens(token); + if (collectComments_ && !commentsBefore_.empty()) + root.setComment(commentsBefore_, commentAfter); + if (features_.strictRoot_) { + if (!root.isArray() && !root.isObject()) { + // Set error location to start of doc, ideally should be first token found + // in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( + "A valid JSON document must be either an array or an object value.", + token); + return false; + } + } + return successful; +} + +bool Reader::readValue() { + // This is a non-reentrant way to support a stackLimit. Terrible! + // But this deprecated class has a security problem: Bad input can + // cause a seg-fault. This seems like a fair, binary-compatible way + // to prevent the problem. + if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue()."); + ++stackDepth_g; + + Token token; + skipCommentTokens(token); + bool successful = true; + + if (collectComments_ && !commentsBefore_.empty()) { + currentValue().setComment(commentsBefore_, commentBefore); + commentsBefore_ = ""; + } + + switch (token.type_) { + case tokenObjectBegin: + successful = readObject(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenArrayBegin: + successful = readArray(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenNumber: + successful = decodeNumber(token); + break; + case tokenString: + successful = decodeString(token); + break; + case tokenTrue: + { + Value v(true); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenFalse: + { + Value v(false); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenNull: + { + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenArraySeparator: + case tokenObjectEnd: + case tokenArrayEnd: + if (features_.allowDroppedNullPlaceholders_) { + // "Un-read" the current token and mark the current value as a null + // token. + current_--; + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(current_ - begin_ - 1); + currentValue().setOffsetLimit(current_ - begin_); + break; + } // Else, fall through... + default: + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return addError("Syntax error: value, object or array expected.", token); + } + + if (collectComments_) { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + --stackDepth_g; + return successful; +} + +void Reader::skipCommentTokens(Token& token) { + if (features_.allowComments_) { + do { + readToken(token); + } while (token.type_ == tokenComment); + } else { + readToken(token); + } +} + +bool Reader::readToken(Token& token) { + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch (c) { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match("rue", 3); + break; + case 'f': + token.type_ = tokenFalse; + ok = match("alse", 4); + break; + case 'n': + token.type_ = tokenNull; + ok = match("ull", 3); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if (!ok) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + +void Reader::skipSpaces() { + while (current_ != end_) { + Char c = *current_; + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') + ++current_; + else + break; + } +} + +bool Reader::match(Location pattern, int patternLength) { + if (end_ - current_ < patternLength) + return false; + int index = patternLength; + while (index--) + if (current_[index] != pattern[index]) + return false; + current_ += patternLength; + return true; +} + +bool Reader::readComment() { + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if (c == '*') + successful = readCStyleComment(); + else if (c == '/') + successful = readCppStyleComment(); + if (!successful) + return false; + + if (collectComments_) { + CommentPlacement placement = commentBefore; + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { + if (c != '*' || !containsNewLine(commentBegin, current_)) + placement = commentAfterOnSameLine; + } + + addComment(commentBegin, current_, placement); + } + return true; +} + +static std::string normalizeEOL(Reader::Location begin, Reader::Location end) { + std::string normalized; + normalized.reserve(end - begin); + Reader::Location current = begin; + while (current != end) { + char c = *current++; + if (c == '\r') { + if (current != end && *current == '\n') + // convert dos EOL + ++current; + // convert Mac EOL + normalized += '\n'; + } else { + normalized += c; + } + } + return normalized; +} + +void +Reader::addComment(Location begin, Location end, CommentPlacement placement) { + assert(collectComments_); + const std::string& normalized = normalizeEOL(begin, end); + if (placement == commentAfterOnSameLine) { + assert(lastValue_ != 0); + lastValue_->setComment(normalized, placement); + } else { + commentsBefore_ += normalized; + } +} + +bool Reader::readCStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '*' && *current_ == '/') + break; + } + return getNextChar() == '/'; +} + +bool Reader::readCppStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '\n') + break; + if (c == '\r') { + // Consume DOS EOL. It will be normalized in addComment. + if (current_ != end_ && *current_ == '\n') + getNextChar(); + // Break on Moc OS 9 EOL. + break; + } + } + return true; +} + +void Reader::readNumber() { + const char *p = current_; + char c = '0'; // stopgap for already consumed character + // integral part + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + // fractional part + if (c == '.') { + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } + // exponential part + if (c == 'e' || c == 'E') { + c = (current_ = p) < end_ ? *p++ : 0; + if (c == '+' || c == '-') + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } +} + +bool Reader::readString() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '"') + break; + } + return c == '"'; +} + +bool Reader::readObject(Token& tokenStart) { + Token tokenName; + std::string name; + Value init(objectValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + while (readToken(tokenName)) { + bool initialTokenOk = true; + while (tokenName.type_ == tokenComment && initialTokenOk) + initialTokenOk = readToken(tokenName); + if (!initialTokenOk) + break; + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object + return true; + name = ""; + if (tokenName.type_ == tokenString) { + if (!decodeString(tokenName, name)) + return recoverFromError(tokenObjectEnd); + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { + Value numberName; + if (!decodeNumber(tokenName, numberName)) + return recoverFromError(tokenObjectEnd); + name = numberName.asString(); + } else { + break; + } + + Token colon; + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { + return addErrorAndRecover( + "Missing ':' after object member name", colon, tokenObjectEnd); + } + Value& value = currentValue()[name]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenObjectEnd); + + Token comma; + if (!readToken(comma) || + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment)) { + return addErrorAndRecover( + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); + } + bool finalizeTokenOk = true; + while (comma.type_ == tokenComment && finalizeTokenOk) + finalizeTokenOk = readToken(comma); + if (comma.type_ == tokenObjectEnd) + return true; + } + return addErrorAndRecover( + "Missing '}' or object member name", tokenName, tokenObjectEnd); +} + +bool Reader::readArray(Token& tokenStart) { + Value init(arrayValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + skipSpaces(); + if (*current_ == ']') // empty array + { + Token endArray; + readToken(endArray); + return true; + } + int index = 0; + for (;;) { + Value& value = currentValue()[index++]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenArrayEnd); + + Token token; + // Accept Comment after last item in the array. + ok = readToken(token); + while (token.type_ == tokenComment && ok) { + ok = readToken(token); + } + bool badTokenType = + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); + if (!ok || badTokenType) { + return addErrorAndRecover( + "Missing ',' or ']' in array declaration", token, tokenArrayEnd); + } + if (token.type_ == tokenArrayEnd) + break; + } + return true; +} + +bool Reader::decodeNumber(Token& token) { + Value decoded; + if (!decodeNumber(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeNumber(Token& token, Value& decoded) { + // Attempts to parse the number as an integer. If the number is + // larger than the maximum supported value of an integer then + // we decode the number as a double. + Location current = token.start_; + bool isNegative = *current == '-'; + if (isNegative) + ++current; + // TODO: Help the compiler do the div and mod at compile time or get rid of them. + Value::LargestUInt maxIntegerValue = + isNegative ? Value::LargestUInt(-Value::minLargestInt) + : Value::maxLargestUInt; + Value::LargestUInt threshold = maxIntegerValue / 10; + Value::LargestUInt value = 0; + while (current < token.end_) { + Char c = *current++; + if (c < '0' || c > '9') + return decodeDouble(token, decoded); + Value::UInt digit(c - '0'); + if (value >= threshold) { + // We've hit or exceeded the max value divided by 10 (rounded down). If + // a) we've only just touched the limit, b) this is the last digit, and + // c) it's small enough to fit in that rounding delta, we're okay. + // Otherwise treat this number as a double to avoid overflow. + if (value > threshold || current != token.end_ || + digit > maxIntegerValue % 10) { + return decodeDouble(token, decoded); + } + } + value = value * 10 + digit; + } + if (isNegative) + decoded = -Value::LargestInt(value); + else if (value <= Value::LargestUInt(Value::maxInt)) + decoded = Value::LargestInt(value); + else + decoded = value; + return true; +} + +bool Reader::decodeDouble(Token& token) { + Value decoded; + if (!decodeDouble(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeDouble(Token& token, Value& decoded) { + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + + // Sanity check to avoid buffer overflow exploits. + if (length < 0) { + return addError("Unable to parse token length", token); + } + + // Avoid using a string constant for the format control string given to + // sscanf, as this can cause hard to debug crashes on OS X. See here for more + // info: + // + // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html + char format[] = "%lf"; + + if (length <= bufferSize) { + Char buffer[bufferSize + 1]; + memcpy(buffer, token.start_, length); + buffer[length] = 0; + count = sscanf(buffer, format, &value); + } else { + std::string buffer(token.start_, token.end_); + count = sscanf(buffer.c_str(), format, &value); + } + + if (count != 1) + return addError("'" + std::string(token.start_, token.end_) + + "' is not a number.", + token); + decoded = value; + return true; +} + +bool Reader::decodeString(Token& token) { + std::string decoded_string; + if (!decodeString(token, decoded_string)) + return false; + Value decoded(decoded_string); + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeString(Token& token, std::string& decoded) { + decoded.reserve(token.end_ - token.start_ - 2); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while (current != end) { + Char c = *current++; + if (c == '"') + break; + else if (c == '\\') { + if (current == end) + return addError("Empty escape sequence in string", token, current); + Char escape = *current++; + switch (escape) { + case '"': + decoded += '"'; + break; + case '/': + decoded += '/'; + break; + case '\\': + decoded += '\\'; + break; + case 'b': + decoded += '\b'; + break; + case 'f': + decoded += '\f'; + break; + case 'n': + decoded += '\n'; + break; + case 'r': + decoded += '\r'; + break; + case 't': + decoded += '\t'; + break; + case 'u': { + unsigned int unicode; + if (!decodeUnicodeCodePoint(token, current, end, unicode)) + return false; + decoded += codePointToUTF8(unicode); + } break; + default: + return addError("Bad escape sequence in string", token, current); + } + } else { + decoded += c; + } + } + return true; +} + +bool Reader::decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + + if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) { + // surrogate pairs + if (end - current < 6) + return addError( + "additional six characters expected to parse unicode surrogate pair.", + token, + current); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++) == 'u') { + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } else + return false; + } else + return addError("expecting another \\u token to begin the second half of " + "a unicode surrogate pair", + token, + current); + } + return true; +} + +bool Reader::decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + if (end - current < 4) + return addError( + "Bad unicode escape sequence in string: four digits expected.", + token, + current); + unicode = 0; + for (int index = 0; index < 4; ++index) { + Char c = *current++; + unicode *= 16; + if (c >= '0' && c <= '9') + unicode += c - '0'; + else if (c >= 'a' && c <= 'f') + unicode += c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + unicode += c - 'A' + 10; + else + return addError( + "Bad unicode escape sequence in string: hexadecimal digit expected.", + token, + current); + } + return true; +} + +bool +Reader::addError(const std::string& message, Token& token, Location extra) { + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back(info); + return false; +} + +bool Reader::recoverFromError(TokenType skipUntilToken) { + int errorCount = int(errors_.size()); + Token skip; + for (;;) { + if (!readToken(skip)) + errors_.resize(errorCount); // discard errors caused by recovery + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) + break; + } + errors_.resize(errorCount); + return false; +} + +bool Reader::addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken) { + addError(message, token); + return recoverFromError(skipUntilToken); +} + +Value& Reader::currentValue() { return *(nodes_.top()); } + +Reader::Char Reader::getNextChar() { + if (current_ == end_) + return 0; + return *current_++; +} + +void Reader::getLocationLineAndColumn(Location location, + int& line, + int& column) const { + Location current = begin_; + Location lastLineStart = current; + line = 0; + while (current < location && current != end_) { + Char c = *current++; + if (c == '\r') { + if (*current == '\n') + ++current; + lastLineStart = current; + ++line; + } else if (c == '\n') { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + +std::string Reader::getLocationLineAndColumn(Location location) const { + int line, column; + getLocationLineAndColumn(location, line, column); + char buffer[18 + 16 + 16 + 1]; +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) +#if defined(WINCE) + _snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#else + sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#endif +#else + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#endif + return buffer; +} + +// Deprecated. Preserved for backward compatibility +std::string Reader::getFormatedErrorMessages() const { + return getFormattedErrorMessages(); +} + +std::string Reader::getFormattedErrorMessages() const { + std::string formattedMessage; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + formattedMessage += + "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if (error.extra_) + formattedMessage += + "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n"; + } + return formattedMessage; +} + +std::vector Reader::getStructuredErrors() const { + std::vector allErrors; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + Reader::StructuredError structured; + structured.offset_start = error.token_.start_ - begin_; + structured.offset_limit = error.token_.end_ - begin_; + structured.message = error.message_; + allErrors.push_back(structured); + } + return allErrors; +} + +bool Reader::pushError(const Value& value, const std::string& message) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = end_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = 0; + errors_.push_back(info); + return true; +} + +bool Reader::pushError(const Value& value, const std::string& message, const Value& extra) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length + || extra.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = begin_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = begin_ + extra.getOffsetStart(); + errors_.push_back(info); + return true; +} + +bool Reader::good() const { + return !errors_.size(); +} + +// exact copy of Features +class OurFeatures { +public: + static OurFeatures all(); + OurFeatures(); + bool allowComments_; + bool strictRoot_; + bool allowDroppedNullPlaceholders_; + bool allowNumericKeys_; + bool allowSingleQuotes_; + bool failIfExtra_; + bool rejectDupKeys_; + int stackLimit_; +}; // OurFeatures + +// exact copy of Implementation of class Features +// //////////////////////////////// + +OurFeatures::OurFeatures() + : allowComments_(true), strictRoot_(false) + , allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) + , allowSingleQuotes_(false) + , failIfExtra_(false) +{ +} + +OurFeatures OurFeatures::all() { return OurFeatures(); } + +// Implementation of class Reader +// //////////////////////////////// + +// exact copy of Reader, renamed to OurReader +class OurReader { +public: + typedef char Char; + typedef const Char* Location; + struct StructuredError { + size_t offset_start; + size_t offset_limit; + std::string message; + }; + + OurReader(OurFeatures const& features); + bool parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments = true); + std::string getFormattedErrorMessages() const; + std::vector getStructuredErrors() const; + bool pushError(const Value& value, const std::string& message); + bool pushError(const Value& value, const std::string& message, const Value& extra); + bool good() const; + +private: + OurReader(OurReader const&); // no impl + void operator=(OurReader const&); // no impl + + enum TokenType { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque Errors; + + bool readToken(Token& token); + void skipSpaces(); + bool match(Location pattern, int patternLength); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + bool readStringSingleQuote(); + void readNumber(); + bool readValue(); + bool readObject(Token& token); + bool readArray(Token& token); + bool decodeNumber(Token& token); + bool decodeNumber(Token& token, Value& decoded); + bool decodeString(Token& token); + bool decodeString(Token& token, std::string& decoded); + bool decodeDouble(Token& token); + bool decodeDouble(Token& token, Value& decoded); + bool decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool addError(const std::string& message, Token& token, Location extra = 0); + bool recoverFromError(TokenType skipUntilToken); + bool addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken); + void skipUntilSpace(); + Value& currentValue(); + Char getNextChar(); + void + getLocationLineAndColumn(Location location, int& line, int& column) const; + std::string getLocationLineAndColumn(Location location) const; + void addComment(Location begin, Location end, CommentPlacement placement); + void skipCommentTokens(Token& token); + + typedef std::stack Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value* lastValue_; + std::string commentsBefore_; + int stackDepth_; + + OurFeatures const features_; + bool collectComments_; +}; // OurReader + +// complete copy of Read impl, for OurReader + +OurReader::OurReader(OurFeatures const& features) + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(features), collectComments_() { +} + +bool OurReader::parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments) { + if (!features_.allowComments_) { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while (!nodes_.empty()) + nodes_.pop(); + nodes_.push(&root); + + stackDepth_ = 0; + bool successful = readValue(); + Token token; + skipCommentTokens(token); + if (features_.failIfExtra_) { + if (token.type_ != tokenError && token.type_ != tokenEndOfStream) { + addError("Extra non-whitespace after JSON value.", token); + return false; + } + } + if (collectComments_ && !commentsBefore_.empty()) + root.setComment(commentsBefore_, commentAfter); + if (features_.strictRoot_) { + if (!root.isArray() && !root.isObject()) { + // Set error location to start of doc, ideally should be first token found + // in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( + "A valid JSON document must be either an array or an object value.", + token); + return false; + } + } + return successful; +} + +bool OurReader::readValue() { + if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue()."); + ++stackDepth_; + Token token; + skipCommentTokens(token); + bool successful = true; + + if (collectComments_ && !commentsBefore_.empty()) { + currentValue().setComment(commentsBefore_, commentBefore); + commentsBefore_ = ""; + } + + switch (token.type_) { + case tokenObjectBegin: + successful = readObject(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenArrayBegin: + successful = readArray(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenNumber: + successful = decodeNumber(token); + break; + case tokenString: + successful = decodeString(token); + break; + case tokenTrue: + { + Value v(true); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenFalse: + { + Value v(false); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenNull: + { + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenArraySeparator: + case tokenObjectEnd: + case tokenArrayEnd: + if (features_.allowDroppedNullPlaceholders_) { + // "Un-read" the current token and mark the current value as a null + // token. + current_--; + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(current_ - begin_ - 1); + currentValue().setOffsetLimit(current_ - begin_); + break; + } // else, fall through ... + default: + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return addError("Syntax error: value, object or array expected.", token); + } + + if (collectComments_) { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + --stackDepth_; + return successful; +} + +void OurReader::skipCommentTokens(Token& token) { + if (features_.allowComments_) { + do { + readToken(token); + } while (token.type_ == tokenComment); + } else { + readToken(token); + } +} + +bool OurReader::readToken(Token& token) { + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch (c) { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '\'': + if (features_.allowSingleQuotes_) { + token.type_ = tokenString; + ok = readStringSingleQuote(); + break; + } // else continue + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match("rue", 3); + break; + case 'f': + token.type_ = tokenFalse; + ok = match("alse", 4); + break; + case 'n': + token.type_ = tokenNull; + ok = match("ull", 3); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if (!ok) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + +void OurReader::skipSpaces() { + while (current_ != end_) { + Char c = *current_; + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') + ++current_; + else + break; + } +} + +bool OurReader::match(Location pattern, int patternLength) { + if (end_ - current_ < patternLength) + return false; + int index = patternLength; + while (index--) + if (current_[index] != pattern[index]) + return false; + current_ += patternLength; + return true; +} + +bool OurReader::readComment() { + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if (c == '*') + successful = readCStyleComment(); + else if (c == '/') + successful = readCppStyleComment(); + if (!successful) + return false; + + if (collectComments_) { + CommentPlacement placement = commentBefore; + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { + if (c != '*' || !containsNewLine(commentBegin, current_)) + placement = commentAfterOnSameLine; + } + + addComment(commentBegin, current_, placement); + } + return true; +} + +void +OurReader::addComment(Location begin, Location end, CommentPlacement placement) { + assert(collectComments_); + const std::string& normalized = normalizeEOL(begin, end); + if (placement == commentAfterOnSameLine) { + assert(lastValue_ != 0); + lastValue_->setComment(normalized, placement); + } else { + commentsBefore_ += normalized; + } +} + +bool OurReader::readCStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '*' && *current_ == '/') + break; + } + return getNextChar() == '/'; +} + +bool OurReader::readCppStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '\n') + break; + if (c == '\r') { + // Consume DOS EOL. It will be normalized in addComment. + if (current_ != end_ && *current_ == '\n') + getNextChar(); + // Break on Moc OS 9 EOL. + break; + } + } + return true; +} + +void OurReader::readNumber() { + const char *p = current_; + char c = '0'; // stopgap for already consumed character + // integral part + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + // fractional part + if (c == '.') { + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } + // exponential part + if (c == 'e' || c == 'E') { + c = (current_ = p) < end_ ? *p++ : 0; + if (c == '+' || c == '-') + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } +} +bool OurReader::readString() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '"') + break; + } + return c == '"'; +} + + +bool OurReader::readStringSingleQuote() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '\'') + break; + } + return c == '\''; +} + +bool OurReader::readObject(Token& tokenStart) { + Token tokenName; + std::string name; + Value init(objectValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + while (readToken(tokenName)) { + bool initialTokenOk = true; + while (tokenName.type_ == tokenComment && initialTokenOk) + initialTokenOk = readToken(tokenName); + if (!initialTokenOk) + break; + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object + return true; + name = ""; + if (tokenName.type_ == tokenString) { + if (!decodeString(tokenName, name)) + return recoverFromError(tokenObjectEnd); + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { + Value numberName; + if (!decodeNumber(tokenName, numberName)) + return recoverFromError(tokenObjectEnd); + name = numberName.asString(); + } else { + break; + } + + Token colon; + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { + return addErrorAndRecover( + "Missing ':' after object member name", colon, tokenObjectEnd); + } + if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30"); + if (features_.rejectDupKeys_ && currentValue().isMember(name)) { + std::string msg = "Duplicate key: '" + name + "'"; + return addErrorAndRecover( + msg, tokenName, tokenObjectEnd); + } + Value& value = currentValue()[name]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenObjectEnd); + + Token comma; + if (!readToken(comma) || + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment)) { + return addErrorAndRecover( + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); + } + bool finalizeTokenOk = true; + while (comma.type_ == tokenComment && finalizeTokenOk) + finalizeTokenOk = readToken(comma); + if (comma.type_ == tokenObjectEnd) + return true; + } + return addErrorAndRecover( + "Missing '}' or object member name", tokenName, tokenObjectEnd); +} + +bool OurReader::readArray(Token& tokenStart) { + Value init(arrayValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + skipSpaces(); + if (*current_ == ']') // empty array + { + Token endArray; + readToken(endArray); + return true; + } + int index = 0; + for (;;) { + Value& value = currentValue()[index++]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenArrayEnd); + + Token token; + // Accept Comment after last item in the array. + ok = readToken(token); + while (token.type_ == tokenComment && ok) { + ok = readToken(token); + } + bool badTokenType = + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); + if (!ok || badTokenType) { + return addErrorAndRecover( + "Missing ',' or ']' in array declaration", token, tokenArrayEnd); + } + if (token.type_ == tokenArrayEnd) + break; + } + return true; +} + +bool OurReader::decodeNumber(Token& token) { + Value decoded; + if (!decodeNumber(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool OurReader::decodeNumber(Token& token, Value& decoded) { + // Attempts to parse the number as an integer. If the number is + // larger than the maximum supported value of an integer then + // we decode the number as a double. + Location current = token.start_; + bool isNegative = *current == '-'; + if (isNegative) + ++current; + // TODO: Help the compiler do the div and mod at compile time or get rid of them. + Value::LargestUInt maxIntegerValue = + isNegative ? Value::LargestUInt(-Value::minLargestInt) + : Value::maxLargestUInt; + Value::LargestUInt threshold = maxIntegerValue / 10; + Value::LargestUInt value = 0; + while (current < token.end_) { + Char c = *current++; + if (c < '0' || c > '9') + return decodeDouble(token, decoded); + Value::UInt digit(c - '0'); + if (value >= threshold) { + // We've hit or exceeded the max value divided by 10 (rounded down). If + // a) we've only just touched the limit, b) this is the last digit, and + // c) it's small enough to fit in that rounding delta, we're okay. + // Otherwise treat this number as a double to avoid overflow. + if (value > threshold || current != token.end_ || + digit > maxIntegerValue % 10) { + return decodeDouble(token, decoded); + } + } + value = value * 10 + digit; + } + if (isNegative) + decoded = -Value::LargestInt(value); + else if (value <= Value::LargestUInt(Value::maxInt)) + decoded = Value::LargestInt(value); + else + decoded = value; + return true; +} + +bool OurReader::decodeDouble(Token& token) { + Value decoded; + if (!decodeDouble(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool OurReader::decodeDouble(Token& token, Value& decoded) { + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + + // Sanity check to avoid buffer overflow exploits. + if (length < 0) { + return addError("Unable to parse token length", token); + } + + // Avoid using a string constant for the format control string given to + // sscanf, as this can cause hard to debug crashes on OS X. See here for more + // info: + // + // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html + char format[] = "%lf"; + + if (length <= bufferSize) { + Char buffer[bufferSize + 1]; + memcpy(buffer, token.start_, length); + buffer[length] = 0; + count = sscanf(buffer, format, &value); + } else { + std::string buffer(token.start_, token.end_); + count = sscanf(buffer.c_str(), format, &value); + } + + if (count != 1) + return addError("'" + std::string(token.start_, token.end_) + + "' is not a number.", + token); + decoded = value; + return true; +} + +bool OurReader::decodeString(Token& token) { + std::string decoded_string; + if (!decodeString(token, decoded_string)) + return false; + Value decoded(decoded_string); + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool OurReader::decodeString(Token& token, std::string& decoded) { + decoded.reserve(token.end_ - token.start_ - 2); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while (current != end) { + Char c = *current++; + if (c == '"') + break; + else if (c == '\\') { + if (current == end) + return addError("Empty escape sequence in string", token, current); + Char escape = *current++; + switch (escape) { + case '"': + decoded += '"'; + break; + case '/': + decoded += '/'; + break; + case '\\': + decoded += '\\'; + break; + case 'b': + decoded += '\b'; + break; + case 'f': + decoded += '\f'; + break; + case 'n': + decoded += '\n'; + break; + case 'r': + decoded += '\r'; + break; + case 't': + decoded += '\t'; + break; + case 'u': { + unsigned int unicode; + if (!decodeUnicodeCodePoint(token, current, end, unicode)) + return false; + decoded += codePointToUTF8(unicode); + } break; + default: + return addError("Bad escape sequence in string", token, current); + } + } else { + decoded += c; + } + } + return true; +} + +bool OurReader::decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + + if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) { + // surrogate pairs + if (end - current < 6) + return addError( + "additional six characters expected to parse unicode surrogate pair.", + token, + current); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++) == 'u') { + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } else + return false; + } else + return addError("expecting another \\u token to begin the second half of " + "a unicode surrogate pair", + token, + current); + } + return true; +} + +bool OurReader::decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + if (end - current < 4) + return addError( + "Bad unicode escape sequence in string: four digits expected.", + token, + current); + unicode = 0; + for (int index = 0; index < 4; ++index) { + Char c = *current++; + unicode *= 16; + if (c >= '0' && c <= '9') + unicode += c - '0'; + else if (c >= 'a' && c <= 'f') + unicode += c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + unicode += c - 'A' + 10; + else + return addError( + "Bad unicode escape sequence in string: hexadecimal digit expected.", + token, + current); + } + return true; +} + +bool +OurReader::addError(const std::string& message, Token& token, Location extra) { + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back(info); + return false; +} + +bool OurReader::recoverFromError(TokenType skipUntilToken) { + int errorCount = int(errors_.size()); + Token skip; + for (;;) { + if (!readToken(skip)) + errors_.resize(errorCount); // discard errors caused by recovery + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) + break; + } + errors_.resize(errorCount); + return false; +} + +bool OurReader::addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken) { + addError(message, token); + return recoverFromError(skipUntilToken); +} + +Value& OurReader::currentValue() { return *(nodes_.top()); } + +OurReader::Char OurReader::getNextChar() { + if (current_ == end_) + return 0; + return *current_++; +} + +void OurReader::getLocationLineAndColumn(Location location, + int& line, + int& column) const { + Location current = begin_; + Location lastLineStart = current; + line = 0; + while (current < location && current != end_) { + Char c = *current++; + if (c == '\r') { + if (*current == '\n') + ++current; + lastLineStart = current; + ++line; + } else if (c == '\n') { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + +std::string OurReader::getLocationLineAndColumn(Location location) const { + int line, column; + getLocationLineAndColumn(location, line, column); + char buffer[18 + 16 + 16 + 1]; +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) +#if defined(WINCE) + _snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#else + sprintf_s(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#endif +#else + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); +#endif + return buffer; +} + +std::string OurReader::getFormattedErrorMessages() const { + std::string formattedMessage; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + formattedMessage += + "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if (error.extra_) + formattedMessage += + "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n"; + } + return formattedMessage; +} + +std::vector OurReader::getStructuredErrors() const { + std::vector allErrors; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + OurReader::StructuredError structured; + structured.offset_start = error.token_.start_ - begin_; + structured.offset_limit = error.token_.end_ - begin_; + structured.message = error.message_; + allErrors.push_back(structured); + } + return allErrors; +} + +bool OurReader::pushError(const Value& value, const std::string& message) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = end_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = 0; + errors_.push_back(info); + return true; +} + +bool OurReader::pushError(const Value& value, const std::string& message, const Value& extra) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length + || extra.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = begin_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = begin_ + extra.getOffsetStart(); + errors_.push_back(info); + return true; +} + +bool OurReader::good() const { + return !errors_.size(); +} + + +class OurCharReader : public CharReader { + bool const collectComments_; + OurReader reader_; +public: + OurCharReader( + bool collectComments, + OurFeatures const& features) + : collectComments_(collectComments) + , reader_(features) + {} + virtual bool parse( + char const* beginDoc, char const* endDoc, + Value* root, std::string* errs) { + bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_); + if (errs) { + *errs = reader_.getFormattedErrorMessages(); + } + return ok; + } +}; + +CharReaderBuilder::CharReaderBuilder() +{ + setDefaults(&settings_); +} +CharReaderBuilder::~CharReaderBuilder() +{} +CharReader* CharReaderBuilder::newCharReader() const +{ + bool collectComments = settings_["collectComments"].asBool(); + OurFeatures features = OurFeatures::all(); + features.allowComments_ = settings_["allowComments"].asBool(); + features.strictRoot_ = settings_["strictRoot"].asBool(); + features.allowDroppedNullPlaceholders_ = settings_["allowDroppedNullPlaceholders"].asBool(); + features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool(); + features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool(); + features.stackLimit_ = settings_["stackLimit"].asInt(); + features.failIfExtra_ = settings_["failIfExtra"].asBool(); + features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool(); + return new OurCharReader(collectComments, features); +} +static void getValidReaderKeys(std::set* valid_keys) +{ + valid_keys->clear(); + valid_keys->insert("collectComments"); + valid_keys->insert("allowComments"); + valid_keys->insert("strictRoot"); + valid_keys->insert("allowDroppedNullPlaceholders"); + valid_keys->insert("allowNumericKeys"); + valid_keys->insert("allowSingleQuotes"); + valid_keys->insert("stackLimit"); + valid_keys->insert("failIfExtra"); + valid_keys->insert("rejectDupKeys"); +} +bool CharReaderBuilder::validate(Json::Value* invalid) const +{ + Json::Value my_invalid; + if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL + Json::Value& inv = *invalid; + std::set valid_keys; + getValidReaderKeys(&valid_keys); + Value::Members keys = settings_.getMemberNames(); + size_t n = keys.size(); + for (size_t i = 0; i < n; ++i) { + std::string const& key = keys[i]; + if (valid_keys.find(key) == valid_keys.end()) { + inv[key] = settings_[key]; + } + } + return 0u == inv.size(); +} +Value& CharReaderBuilder::operator[](std::string key) +{ + return settings_[key]; +} +// static +void CharReaderBuilder::strictMode(Json::Value* settings) +{ +//! [CharReaderBuilderStrictMode] + (*settings)["allowComments"] = false; + (*settings)["strictRoot"] = true; + (*settings)["allowDroppedNullPlaceholders"] = false; + (*settings)["allowNumericKeys"] = false; + (*settings)["allowSingleQuotes"] = false; + (*settings)["failIfExtra"] = true; + (*settings)["rejectDupKeys"] = true; +//! [CharReaderBuilderStrictMode] +} +// static +void CharReaderBuilder::setDefaults(Json::Value* settings) +{ +//! [CharReaderBuilderDefaults] + (*settings)["collectComments"] = true; + (*settings)["allowComments"] = true; + (*settings)["strictRoot"] = false; + (*settings)["allowDroppedNullPlaceholders"] = false; + (*settings)["allowNumericKeys"] = false; + (*settings)["allowSingleQuotes"] = false; + (*settings)["stackLimit"] = 1000; + (*settings)["failIfExtra"] = false; + (*settings)["rejectDupKeys"] = false; +//! [CharReaderBuilderDefaults] +} + +////////////////////////////////// +// global functions + +bool parseFromStream( + CharReader::Factory const& fact, std::istream& sin, + Value* root, std::string* errs) +{ + std::ostringstream ssin; + ssin << sin.rdbuf(); + std::string doc = ssin.str(); + char const* begin = doc.data(); + char const* end = begin + doc.size(); + // Note that we do not actually need a null-terminator. + CharReaderPtr const reader(fact.newCharReader()); + return reader->parse(begin, end, root, errs); +} + +std::istream& operator>>(std::istream& sin, Value& root) { + CharReaderBuilder b; + std::string errs; + bool ok = parseFromStream(b, sin, &root, &errs); + if (!ok) { + fprintf(stderr, + "Error from reader: %s", + errs.c_str()); + + throwRuntimeError("reader error"); + } + return sin; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_reader.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_valueiterator.inl +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIteratorBase +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIteratorBase::ValueIteratorBase() + : current_(), isNull_(true) { +} + +ValueIteratorBase::ValueIteratorBase( + const Value::ObjectValues::iterator& current) + : current_(current), isNull_(false) {} + +Value& ValueIteratorBase::deref() const { + return current_->second; +} + +void ValueIteratorBase::increment() { + ++current_; +} + +void ValueIteratorBase::decrement() { + --current_; +} + +ValueIteratorBase::difference_type +ValueIteratorBase::computeDistance(const SelfType& other) const { +#ifdef JSON_USE_CPPTL_SMALLMAP + return other.current_ - current_; +#else + // Iterator for null value are initialized using the default + // constructor, which initialize current_ to the default + // std::map::iterator. As begin() and end() are two instance + // of the default std::map::iterator, they can not be compared. + // To allow this, we handle this comparison specifically. + if (isNull_ && other.isNull_) { + return 0; + } + + // Usage of std::distance is not portable (does not compile with Sun Studio 12 + // RogueWave STL, + // which is the one used by default). + // Using a portable hand-made version for non random iterator instead: + // return difference_type( std::distance( current_, other.current_ ) ); + difference_type myDistance = 0; + for (Value::ObjectValues::iterator it = current_; it != other.current_; + ++it) { + ++myDistance; + } + return myDistance; +#endif +} + +bool ValueIteratorBase::isEqual(const SelfType& other) const { + if (isNull_) { + return other.isNull_; + } + return current_ == other.current_; +} + +void ValueIteratorBase::copy(const SelfType& other) { + current_ = other.current_; + isNull_ = other.isNull_; +} + +Value ValueIteratorBase::key() const { + const Value::CZString czstring = (*current_).first; + if (czstring.data()) { + if (czstring.isStaticString()) + return Value(StaticString(czstring.data())); + return Value(czstring.data(), czstring.data() + czstring.length()); + } + return Value(czstring.index()); +} + +UInt ValueIteratorBase::index() const { + const Value::CZString czstring = (*current_).first; + if (!czstring.data()) + return czstring.index(); + return Value::UInt(-1); +} + +std::string ValueIteratorBase::name() const { + char const* key; + char const* end; + key = memberName(&end); + if (!key) return std::string(); + return std::string(key, end); +} + +char const* ValueIteratorBase::memberName() const { + const char* name = (*current_).first.data(); + return name ? name : ""; +} + +char const* ValueIteratorBase::memberName(char const** end) const { + const char* name = (*current_).first.data(); + if (!name) { + *end = NULL; + return NULL; + } + *end = name + (*current_).first.length(); + return name; +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueConstIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueConstIterator::ValueConstIterator() {} + +ValueConstIterator::ValueConstIterator( + const Value::ObjectValues::iterator& current) + : ValueIteratorBase(current) {} + +ValueConstIterator& ValueConstIterator:: +operator=(const ValueIteratorBase& other) { + copy(other); + return *this; +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIterator::ValueIterator() {} + +ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) + : ValueIteratorBase(current) {} + +ValueIterator::ValueIterator(const ValueConstIterator& other) + : ValueIteratorBase(other) {} + +ValueIterator::ValueIterator(const ValueIterator& other) + : ValueIteratorBase(other) {} + +ValueIterator& ValueIterator::operator=(const SelfType& other) { + copy(other); + return *this; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_valueiterator.inl +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_value.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#ifdef JSON_USE_CPPTL +#include +#endif +#include // size_t +#include // min() + +#define JSON_ASSERT_UNREACHABLE assert(false) + +namespace Json { + +// This is a walkaround to avoid the static initialization of Value::null. +// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of +// 8 (instead of 4) as a bit of future-proofing. +#if defined(__ARMEL__) +#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) +#else +#define ALIGNAS(byte_alignment) +#endif +static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 }; +const unsigned char& kNullRef = kNull[0]; +const Value& Value::null = reinterpret_cast(kNullRef); +const Value& Value::nullRef = null; + +const Int Value::minInt = Int(~(UInt(-1) / 2)); +const Int Value::maxInt = Int(UInt(-1) / 2); +const UInt Value::maxUInt = UInt(-1); +#if defined(JSON_HAS_INT64) +const Int64 Value::minInt64 = Int64(~(UInt64(-1) / 2)); +const Int64 Value::maxInt64 = Int64(UInt64(-1) / 2); +const UInt64 Value::maxUInt64 = UInt64(-1); +// The constant is hard-coded because some compiler have trouble +// converting Value::maxUInt64 to a double correctly (AIX/xlC). +// Assumes that UInt64 is a 64 bits integer. +static const double maxUInt64AsDouble = 18446744073709551615.0; +#endif // defined(JSON_HAS_INT64) +const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2)); +const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2); +const LargestUInt Value::maxLargestUInt = LargestUInt(-1); + +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +template +static inline bool InRange(double d, T min, U max) { + return d >= min && d <= max; +} +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +static inline double integerToDouble(Json::UInt64 value) { + return static_cast(Int64(value / 2)) * 2.0 + Int64(value & 1); +} + +template static inline double integerToDouble(T value) { + return static_cast(value); +} + +template +static inline bool InRange(double d, T min, U max) { + return d >= integerToDouble(min) && d <= integerToDouble(max); +} +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + +/** Duplicates the specified string value. + * @param value Pointer to the string to duplicate. Must be zero-terminated if + * length is "unknown". + * @param length Length of the value. if equals to unknown, then it will be + * computed using strlen(value). + * @return Pointer on the duplicate instance of string. + */ +static inline char* duplicateStringValue(const char* value, + size_t length) { + // Avoid an integer overflow in the call to malloc below by limiting length + // to a sane value. + if (length >= (size_t)Value::maxInt) + length = Value::maxInt - 1; + + char* newString = static_cast(malloc(length + 1)); + if (newString == NULL) { + throwRuntimeError( + "in Json::Value::duplicateStringValue(): " + "Failed to allocate string value buffer"); + } + memcpy(newString, value, length); + newString[length] = 0; + return newString; +} + +/* Record the length as a prefix. + */ +static inline char* duplicateAndPrefixStringValue( + const char* value, + unsigned int length) +{ + // Avoid an integer overflow in the call to malloc below by limiting length + // to a sane value. + JSON_ASSERT_MESSAGE(length <= (unsigned)Value::maxInt - sizeof(unsigned) - 1U, + "in Json::Value::duplicateAndPrefixStringValue(): " + "length too big for prefixing"); + unsigned actualLength = length + sizeof(unsigned) + 1U; + char* newString = static_cast(malloc(actualLength)); + if (newString == 0) { + throwRuntimeError( + "in Json::Value::duplicateAndPrefixStringValue(): " + "Failed to allocate string value buffer"); + } + *reinterpret_cast(newString) = length; + memcpy(newString + sizeof(unsigned), value, length); + newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later + return newString; +} +inline static void decodePrefixedString( + bool isPrefixed, char const* prefixed, + unsigned* length, char const** value) +{ + if (!isPrefixed) { + *length = strlen(prefixed); + *value = prefixed; + } else { + *length = *reinterpret_cast(prefixed); + *value = prefixed + sizeof(unsigned); + } +} +/** Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue(). + */ +static inline void releaseStringValue(char* value) { free(value); } + +} // namespace Json + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ValueInternals... +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#if !defined(JSON_IS_AMALGAMATION) + +#include "json_valueiterator.inl" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +class JSON_API Exception : public std::exception { +public: + Exception(std::string const& msg); + virtual ~Exception() throw(); + virtual char const* what() const throw(); +protected: + std::string const msg_; +}; +class JSON_API RuntimeError : public Exception { +public: + RuntimeError(std::string const& msg); +}; +class JSON_API LogicError : public Exception { +public: + LogicError(std::string const& msg); +}; + +Exception::Exception(std::string const& msg) + : msg_(msg) +{} +Exception::~Exception() throw() +{} +char const* Exception::what() const throw() +{ + return msg_.c_str(); +} +RuntimeError::RuntimeError(std::string const& msg) + : Exception(msg) +{} +LogicError::LogicError(std::string const& msg) + : Exception(msg) +{} +void throwRuntimeError(std::string const& msg) +{ + throw RuntimeError(msg); +} +void throwLogicError(std::string const& msg) +{ + throw LogicError(msg); +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CommentInfo +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +Value::CommentInfo::CommentInfo() : comment_(0) {} + +Value::CommentInfo::~CommentInfo() { + if (comment_) + releaseStringValue(comment_); +} + +void Value::CommentInfo::setComment(const char* text, size_t len) { + if (comment_) { + releaseStringValue(comment_); + comment_ = 0; + } + JSON_ASSERT(text != 0); + JSON_ASSERT_MESSAGE( + text[0] == '\0' || text[0] == '/', + "in Json::Value::setComment(): Comments must start with /"); + // It seems that /**/ style comments are acceptable as well. + comment_ = duplicateStringValue(text, len); +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CZString +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +// Notes: policy_ indicates if the string was allocated when +// a string is stored. + +Value::CZString::CZString(ArrayIndex index) : cstr_(0), index_(index) {} + +Value::CZString::CZString(char const* str, unsigned length, DuplicationPolicy allocate) + : cstr_(str) +{ + // allocate != duplicate + storage_.policy_ = allocate; + storage_.length_ = length; +} + +Value::CZString::CZString(const CZString& other) + : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0 + ? duplicateStringValue(other.cstr_, other.storage_.length_) + : other.cstr_) +{ + storage_.policy_ = (other.cstr_ + ? (other.storage_.policy_ == noDuplication + ? noDuplication : duplicate) + : other.storage_.policy_); + storage_.length_ = other.storage_.length_; +} + +Value::CZString::~CZString() { + if (cstr_ && storage_.policy_ == duplicate) + releaseStringValue(const_cast(cstr_)); +} + +void Value::CZString::swap(CZString& other) { + std::swap(cstr_, other.cstr_); + std::swap(index_, other.index_); +} + +Value::CZString& Value::CZString::operator=(CZString other) { + swap(other); + return *this; +} + +bool Value::CZString::operator<(const CZString& other) const { + if (!cstr_) return index_ < other.index_; + //return strcmp(cstr_, other.cstr_) < 0; + // Assume both are strings. + unsigned this_len = this->storage_.length_; + unsigned other_len = other.storage_.length_; + unsigned min_len = std::min(this_len, other_len); + int comp = memcmp(this->cstr_, other.cstr_, min_len); + if (comp < 0) return true; + if (comp > 0) return false; + return (this_len < other_len); +} + +bool Value::CZString::operator==(const CZString& other) const { + if (!cstr_) return index_ == other.index_; + //return strcmp(cstr_, other.cstr_) == 0; + // Assume both are strings. + unsigned this_len = this->storage_.length_; + unsigned other_len = other.storage_.length_; + if (this_len != other_len) return false; + int comp = memcmp(this->cstr_, other.cstr_, this_len); + return comp == 0; +} + +ArrayIndex Value::CZString::index() const { return index_; } + +//const char* Value::CZString::c_str() const { return cstr_; } +const char* Value::CZString::data() const { return cstr_; } +unsigned Value::CZString::length() const { return storage_.length_; } +bool Value::CZString::isStaticString() const { return storage_.policy_ == noDuplication; } + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::Value +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/*! \internal Default constructor initialization must be equivalent to: + * memset( this, 0, sizeof(Value) ) + * This optimization is used in ValueInternalMap fast allocator. + */ +Value::Value(ValueType type) { + initBasic(type); + switch (type) { + case nullValue: + break; + case intValue: + case uintValue: + value_.int_ = 0; + break; + case realValue: + value_.real_ = 0.0; + break; + case stringValue: + value_.string_ = 0; + break; + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(); + break; + case booleanValue: + value_.bool_ = false; + break; + default: + JSON_ASSERT_UNREACHABLE; + } +} + +Value::Value(Int value) { + initBasic(intValue); + value_.int_ = value; +} + +Value::Value(UInt value) { + initBasic(uintValue); + value_.uint_ = value; +} +#if defined(JSON_HAS_INT64) +Value::Value(Int64 value) { + initBasic(intValue); + value_.int_ = value; +} +Value::Value(UInt64 value) { + initBasic(uintValue); + value_.uint_ = value; +} +#endif // defined(JSON_HAS_INT64) + +Value::Value(double value) { + initBasic(realValue); + value_.real_ = value; +} + +Value::Value(const char* value) { + initBasic(stringValue, true); + value_.string_ = duplicateAndPrefixStringValue(value, static_cast(strlen(value))); +} + +Value::Value(const char* beginValue, const char* endValue) { + initBasic(stringValue, true); + value_.string_ = + duplicateAndPrefixStringValue(beginValue, static_cast(endValue - beginValue)); +} + +Value::Value(const std::string& value) { + initBasic(stringValue, true); + value_.string_ = + duplicateAndPrefixStringValue(value.data(), static_cast(value.length())); +} + +Value::Value(const StaticString& value) { + initBasic(stringValue); + value_.string_ = const_cast(value.c_str()); +} + +#ifdef JSON_USE_CPPTL +Value::Value(const CppTL::ConstString& value) { + initBasic(stringValue, true); + value_.string_ = duplicateAndPrefixStringValue(value, static_cast(value.length())); +} +#endif + +Value::Value(bool value) { + initBasic(booleanValue); + value_.bool_ = value; +} + +Value::Value(Value const& other) + : type_(other.type_), allocated_(false) + , + comments_(0), start_(other.start_), limit_(other.limit_) +{ + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + value_ = other.value_; + break; + case stringValue: + if (other.value_.string_ && other.allocated_) { + unsigned len; + char const* str; + decodePrefixedString(other.allocated_, other.value_.string_, + &len, &str); + value_.string_ = duplicateAndPrefixStringValue(str, len); + allocated_ = true; + } else { + value_.string_ = other.value_.string_; + allocated_ = false; + } + break; + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(*other.value_.map_); + break; + default: + JSON_ASSERT_UNREACHABLE; + } + if (other.comments_) { + comments_ = new CommentInfo[numberOfCommentPlacement]; + for (int comment = 0; comment < numberOfCommentPlacement; ++comment) { + const CommentInfo& otherComment = other.comments_[comment]; + if (otherComment.comment_) + comments_[comment].setComment( + otherComment.comment_, strlen(otherComment.comment_)); + } + } +} + +Value::~Value() { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue: + if (allocated_) + releaseStringValue(value_.string_); + break; + case arrayValue: + case objectValue: + delete value_.map_; + break; + default: + JSON_ASSERT_UNREACHABLE; + } + + if (comments_) + delete[] comments_; +} + +Value& Value::operator=(Value other) { + swap(other); + return *this; +} + +void Value::swapPayload(Value& other) { + ValueType temp = type_; + type_ = other.type_; + other.type_ = temp; + std::swap(value_, other.value_); + int temp2 = allocated_; + allocated_ = other.allocated_; + other.allocated_ = temp2; +} + +void Value::swap(Value& other) { + swapPayload(other); + std::swap(comments_, other.comments_); + std::swap(start_, other.start_); + std::swap(limit_, other.limit_); +} + +ValueType Value::type() const { return type_; } + +int Value::compare(const Value& other) const { + if (*this < other) + return -1; + if (*this > other) + return 1; + return 0; +} + +bool Value::operator<(const Value& other) const { + int typeDelta = type_ - other.type_; + if (typeDelta) + return typeDelta < 0 ? true : false; + switch (type_) { + case nullValue: + return false; + case intValue: + return value_.int_ < other.value_.int_; + case uintValue: + return value_.uint_ < other.value_.uint_; + case realValue: + return value_.real_ < other.value_.real_; + case booleanValue: + return value_.bool_ < other.value_.bool_; + case stringValue: + { + if ((value_.string_ == 0) || (other.value_.string_ == 0)) { + if (other.value_.string_) return true; + else return false; + } + unsigned this_len; + unsigned other_len; + char const* this_str; + char const* other_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); + unsigned min_len = std::min(this_len, other_len); + int comp = memcmp(this_str, other_str, min_len); + if (comp < 0) return true; + if (comp > 0) return false; + return (this_len < other_len); + } + case arrayValue: + case objectValue: { + int delta = int(value_.map_->size() - other.value_.map_->size()); + if (delta) + return delta < 0; + return (*value_.map_) < (*other.value_.map_); + } + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool Value::operator<=(const Value& other) const { return !(other < *this); } + +bool Value::operator>=(const Value& other) const { return !(*this < other); } + +bool Value::operator>(const Value& other) const { return other < *this; } + +bool Value::operator==(const Value& other) const { + // if ( type_ != other.type_ ) + // GCC 2.95.3 says: + // attempt to take address of bit-field structure member `Json::Value::type_' + // Beats me, but a temp solves the problem. + int temp = other.type_; + if (type_ != temp) + return false; + switch (type_) { + case nullValue: + return true; + case intValue: + return value_.int_ == other.value_.int_; + case uintValue: + return value_.uint_ == other.value_.uint_; + case realValue: + return value_.real_ == other.value_.real_; + case booleanValue: + return value_.bool_ == other.value_.bool_; + case stringValue: + { + if ((value_.string_ == 0) || (other.value_.string_ == 0)) { + return (value_.string_ == other.value_.string_); + } + unsigned this_len; + unsigned other_len; + char const* this_str; + char const* other_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); + if (this_len != other_len) return false; + int comp = memcmp(this_str, other_str, this_len); + return comp == 0; + } + case arrayValue: + case objectValue: + return value_.map_->size() == other.value_.map_->size() && + (*value_.map_) == (*other.value_.map_); + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool Value::operator!=(const Value& other) const { return !(*this == other); } + +const char* Value::asCString() const { + JSON_ASSERT_MESSAGE(type_ == stringValue, + "in Json::Value::asCString(): requires stringValue"); + if (value_.string_ == 0) return 0; + unsigned this_len; + char const* this_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + return this_str; +} + +bool Value::getString(char const** str, char const** end) const { + if (type_ != stringValue) return false; + if (value_.string_ == 0) return false; + unsigned length; + decodePrefixedString(this->allocated_, this->value_.string_, &length, str); + *end = *str + length; + return true; +} + +std::string Value::asString() const { + switch (type_) { + case nullValue: + return ""; + case stringValue: + { + if (value_.string_ == 0) return ""; + unsigned this_len; + char const* this_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + return std::string(this_str, this_len); + } + case booleanValue: + return value_.bool_ ? "true" : "false"; + case intValue: + return valueToString(value_.int_); + case uintValue: + return valueToString(value_.uint_); + case realValue: + return valueToString(value_.real_); + default: + JSON_FAIL_MESSAGE("Type is not convertible to string"); + } +} + +#ifdef JSON_USE_CPPTL +CppTL::ConstString Value::asConstString() const { + unsigned len; + char const* str; + decodePrefixedString(allocated_, value_.string_, + &len, &str); + return CppTL::ConstString(str, len); +} +#endif + +Value::Int Value::asInt() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range"); + return Int(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range"); + return Int(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt), + "double out of Int range"); + return Int(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to Int."); +} + +Value::UInt Value::asUInt() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range"); + return UInt(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range"); + return UInt(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt), + "double out of UInt range"); + return UInt(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to UInt."); +} + +#if defined(JSON_HAS_INT64) + +Value::Int64 Value::asInt64() const { + switch (type_) { + case intValue: + return Int64(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); + return Int64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), + "double out of Int64 range"); + return Int64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to Int64."); +} + +Value::UInt64 Value::asUInt64() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); + return UInt64(value_.int_); + case uintValue: + return UInt64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), + "double out of UInt64 range"); + return UInt64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to UInt64."); +} +#endif // if defined(JSON_HAS_INT64) + +LargestInt Value::asLargestInt() const { +#if defined(JSON_NO_INT64) + return asInt(); +#else + return asInt64(); +#endif +} + +LargestUInt Value::asLargestUInt() const { +#if defined(JSON_NO_INT64) + return asUInt(); +#else + return asUInt64(); +#endif +} + +double Value::asDouble() const { + switch (type_) { + case intValue: + return static_cast(value_.int_); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast(value_.uint_); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble(value_.uint_); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return value_.real_; + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0 : 0.0; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to double."); +} + +float Value::asFloat() const { + switch (type_) { + case intValue: + return static_cast(value_.int_); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast(value_.uint_); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble(value_.uint_); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return static_cast(value_.real_); + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0f : 0.0f; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to float."); +} + +bool Value::asBool() const { + switch (type_) { + case booleanValue: + return value_.bool_; + case nullValue: + return false; + case intValue: + return value_.int_ ? true : false; + case uintValue: + return value_.uint_ ? true : false; + case realValue: + return value_.real_ ? true : false; + default: + break; + } + JSON_FAIL_MESSAGE("Value is not convertible to bool."); +} + +bool Value::isConvertibleTo(ValueType other) const { + switch (other) { + case nullValue: + return (isNumeric() && asDouble() == 0.0) || + (type_ == booleanValue && value_.bool_ == false) || + (type_ == stringValue && asString() == "") || + (type_ == arrayValue && value_.map_->size() == 0) || + (type_ == objectValue && value_.map_->size() == 0) || + type_ == nullValue; + case intValue: + return isInt() || + (type_ == realValue && InRange(value_.real_, minInt, maxInt)) || + type_ == booleanValue || type_ == nullValue; + case uintValue: + return isUInt() || + (type_ == realValue && InRange(value_.real_, 0, maxUInt)) || + type_ == booleanValue || type_ == nullValue; + case realValue: + return isNumeric() || type_ == booleanValue || type_ == nullValue; + case booleanValue: + return isNumeric() || type_ == booleanValue || type_ == nullValue; + case stringValue: + return isNumeric() || type_ == booleanValue || type_ == stringValue || + type_ == nullValue; + case arrayValue: + return type_ == arrayValue || type_ == nullValue; + case objectValue: + return type_ == objectValue || type_ == nullValue; + } + JSON_ASSERT_UNREACHABLE; + return false; +} + +/// Number of values in array or object +ArrayIndex Value::size() const { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + case stringValue: + return 0; + case arrayValue: // size of the array is highest index + 1 + if (!value_.map_->empty()) { + ObjectValues::const_iterator itLast = value_.map_->end(); + --itLast; + return (*itLast).first.index() + 1; + } + return 0; + case objectValue: + return ArrayIndex(value_.map_->size()); + } + JSON_ASSERT_UNREACHABLE; + return 0; // unreachable; +} + +bool Value::empty() const { + if (isNull() || isArray() || isObject()) + return size() == 0u; + else + return false; +} + +bool Value::operator!() const { return isNull(); } + +void Value::clear() { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue || + type_ == objectValue, + "in Json::Value::clear(): requires complex value"); + start_ = 0; + limit_ = 0; + switch (type_) { + case arrayValue: + case objectValue: + value_.map_->clear(); + break; + default: + break; + } +} + +void Value::resize(ArrayIndex newSize) { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, + "in Json::Value::resize(): requires arrayValue"); + if (type_ == nullValue) + *this = Value(arrayValue); + ArrayIndex oldSize = size(); + if (newSize == 0) + clear(); + else if (newSize > oldSize) + (*this)[newSize - 1]; + else { + for (ArrayIndex index = newSize; index < oldSize; ++index) { + value_.map_->erase(index); + } + assert(size() == newSize); + } +} + +Value& Value::operator[](ArrayIndex index) { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == arrayValue, + "in Json::Value::operator[](ArrayIndex): requires arrayValue"); + if (type_ == nullValue) + *this = Value(arrayValue); + CZString key(index); + ObjectValues::iterator it = value_.map_->lower_bound(key); + if (it != value_.map_->end() && (*it).first == key) + return (*it).second; + + ObjectValues::value_type defaultValue(key, nullRef); + it = value_.map_->insert(it, defaultValue); + return (*it).second; +} + +Value& Value::operator[](int index) { + JSON_ASSERT_MESSAGE( + index >= 0, + "in Json::Value::operator[](int index): index cannot be negative"); + return (*this)[ArrayIndex(index)]; +} + +const Value& Value::operator[](ArrayIndex index) const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == arrayValue, + "in Json::Value::operator[](ArrayIndex)const: requires arrayValue"); + if (type_ == nullValue) + return nullRef; + CZString key(index); + ObjectValues::const_iterator it = value_.map_->find(key); + if (it == value_.map_->end()) + return nullRef; + return (*it).second; +} + +const Value& Value::operator[](int index) const { + JSON_ASSERT_MESSAGE( + index >= 0, + "in Json::Value::operator[](int index) const: index cannot be negative"); + return (*this)[ArrayIndex(index)]; +} + +void Value::initBasic(ValueType type, bool allocated) { + type_ = type; + allocated_ = allocated; + comments_ = 0; + start_ = 0; + limit_ = 0; +} + +// Access an object value by name, create a null member if it does not exist. +// @pre Type of '*this' is object or null. +// @param key is null-terminated. +Value& Value::resolveReference(const char* key) { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::resolveReference(): requires objectValue"); + if (type_ == nullValue) + *this = Value(objectValue); + CZString actualKey( + key, static_cast(strlen(key)), CZString::noDuplication); // NOTE! + ObjectValues::iterator it = value_.map_->lower_bound(actualKey); + if (it != value_.map_->end() && (*it).first == actualKey) + return (*it).second; + + ObjectValues::value_type defaultValue(actualKey, nullRef); + it = value_.map_->insert(it, defaultValue); + Value& value = (*it).second; + return value; +} + +// @param key is not null-terminated. +Value& Value::resolveReference(char const* key, char const* end) +{ + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::resolveReference(key, end): requires objectValue"); + if (type_ == nullValue) + *this = Value(objectValue); + CZString actualKey( + key, static_cast(end-key), CZString::duplicateOnCopy); + ObjectValues::iterator it = value_.map_->lower_bound(actualKey); + if (it != value_.map_->end() && (*it).first == actualKey) + return (*it).second; + + ObjectValues::value_type defaultValue(actualKey, nullRef); + it = value_.map_->insert(it, defaultValue); + Value& value = (*it).second; + return value; +} + +Value Value::get(ArrayIndex index, const Value& defaultValue) const { + const Value* value = &((*this)[index]); + return value == &nullRef ? defaultValue : *value; +} + +bool Value::isValidIndex(ArrayIndex index) const { return index < size(); } + +Value const* Value::find(char const* key, char const* end) const +{ + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::find(key, end, found): requires objectValue or nullValue"); + if (type_ == nullValue) return NULL; + CZString actualKey(key, static_cast(end-key), CZString::noDuplication); + ObjectValues::const_iterator it = value_.map_->find(actualKey); + if (it == value_.map_->end()) return NULL; + return &(*it).second; +} +const Value& Value::operator[](const char* key) const +{ + Value const* found = find(key, key + strlen(key)); + if (!found) return nullRef; + return *found; +} +Value const& Value::operator[](std::string const& key) const +{ + Value const* found = find(key.data(), key.data() + key.length()); + if (!found) return nullRef; + return *found; +} + +Value& Value::operator[](const char* key) { + return resolveReference(key, key + strlen(key)); +} + +Value& Value::operator[](const std::string& key) { + return resolveReference(key.data(), key.data() + key.length()); +} + +Value& Value::operator[](const StaticString& key) { + return resolveReference(key.c_str()); +} + +#ifdef JSON_USE_CPPTL +Value& Value::operator[](const CppTL::ConstString& key) { + return resolveReference(key.c_str(), key.end_c_str()); +} +Value const& Value::operator[](CppTL::ConstString const& key) const +{ + Value const* found = find(key.c_str(), key.end_c_str()); + if (!found) return nullRef; + return *found; +} +#endif + +Value& Value::append(const Value& value) { return (*this)[size()] = value; } + +Value Value::get(char const* key, char const* end, Value const& defaultValue) const +{ + Value const* found = find(key, end); + return !found ? defaultValue : *found; +} +Value Value::get(char const* key, Value const& defaultValue) const +{ + return get(key, key + strlen(key), defaultValue); +} +Value Value::get(std::string const& key, Value const& defaultValue) const +{ + return get(key.data(), key.data() + key.length(), defaultValue); +} + + +bool Value::removeMember(const char* key, const char* end, Value* removed) +{ + if (type_ != objectValue) { + return false; + } + CZString actualKey(key, static_cast(end-key), CZString::noDuplication); + ObjectValues::iterator it = value_.map_->find(actualKey); + if (it == value_.map_->end()) + return false; + *removed = it->second; + value_.map_->erase(it); + return true; +} +bool Value::removeMember(const char* key, Value* removed) +{ + return removeMember(key, key + strlen(key), removed); +} +bool Value::removeMember(std::string const& key, Value* removed) +{ + return removeMember(key.data(), key.data() + key.length(), removed); +} +Value Value::removeMember(const char* key) +{ + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue, + "in Json::Value::removeMember(): requires objectValue"); + if (type_ == nullValue) + return nullRef; + + Value removed; // null + removeMember(key, key + strlen(key), &removed); + return removed; // still null if removeMember() did nothing +} +Value Value::removeMember(const std::string& key) +{ + return removeMember(key.c_str()); +} + +bool Value::removeIndex(ArrayIndex index, Value* removed) { + if (type_ != arrayValue) { + return false; + } + CZString key(index); + ObjectValues::iterator it = value_.map_->find(key); + if (it == value_.map_->end()) { + return false; + } + *removed = it->second; + ArrayIndex oldSize = size(); + // shift left all items left, into the place of the "removed" + for (ArrayIndex i = index; i < (oldSize - 1); ++i){ + CZString key(i); + (*value_.map_)[key] = (*this)[i + 1]; + } + // erase the last one ("leftover") + CZString keyLast(oldSize - 1); + ObjectValues::iterator itLast = value_.map_->find(keyLast); + value_.map_->erase(itLast); + return true; +} + +#ifdef JSON_USE_CPPTL +Value Value::get(const CppTL::ConstString& key, + const Value& defaultValue) const { + return get(key.c_str(), key.end_c_str(), defaultValue); +} +#endif + +bool Value::isMember(char const* key, char const* end) const +{ + Value const* value = find(key, end); + return NULL != value; +} +bool Value::isMember(char const* key) const +{ + return isMember(key, key + strlen(key)); +} +bool Value::isMember(std::string const& key) const +{ + return isMember(key.data(), key.data() + key.length()); +} + +#ifdef JSON_USE_CPPTL +bool Value::isMember(const CppTL::ConstString& key) const { + return isMember(key.c_str(), key.end_c_str()); +} +#endif + +Value::Members Value::getMemberNames() const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::getMemberNames(), value must be objectValue"); + if (type_ == nullValue) + return Value::Members(); + Members members; + members.reserve(value_.map_->size()); + ObjectValues::const_iterator it = value_.map_->begin(); + ObjectValues::const_iterator itEnd = value_.map_->end(); + for (; it != itEnd; ++it) { + members.push_back(std::string((*it).first.data(), + (*it).first.length())); + } + return members; +} +// +//# ifdef JSON_USE_CPPTL +// EnumMemberNames +// Value::enumMemberNames() const +//{ +// if ( type_ == objectValue ) +// { +// return CppTL::Enum::any( CppTL::Enum::transform( +// CppTL::Enum::keys( *(value_.map_), CppTL::Type() ), +// MemberNamesTransform() ) ); +// } +// return EnumMemberNames(); +//} +// +// +// EnumValues +// Value::enumValues() const +//{ +// if ( type_ == objectValue || type_ == arrayValue ) +// return CppTL::Enum::anyValues( *(value_.map_), +// CppTL::Type() ); +// return EnumValues(); +//} +// +//# endif + +static bool IsIntegral(double d) { + double integral_part; + return modf(d, &integral_part) == 0.0; +} + +bool Value::isNull() const { return type_ == nullValue; } + +bool Value::isBool() const { return type_ == booleanValue; } + +bool Value::isInt() const { + switch (type_) { + case intValue: + return value_.int_ >= minInt && value_.int_ <= maxInt; + case uintValue: + return value_.uint_ <= UInt(maxInt); + case realValue: + return value_.real_ >= minInt && value_.real_ <= maxInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool Value::isUInt() const { + switch (type_) { + case intValue: + return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt); + case uintValue: + return value_.uint_ <= maxUInt; + case realValue: + return value_.real_ >= 0 && value_.real_ <= maxUInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool Value::isInt64() const { +#if defined(JSON_HAS_INT64) + switch (type_) { + case intValue: + return true; + case uintValue: + return value_.uint_ <= UInt64(maxInt64); + case realValue: + // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a + // double, so double(maxInt64) will be rounded up to 2^63. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= double(minInt64) && + value_.real_ < double(maxInt64) && IsIntegral(value_.real_); + default: + break; + } +#endif // JSON_HAS_INT64 + return false; +} + +bool Value::isUInt64() const { +#if defined(JSON_HAS_INT64) + switch (type_) { + case intValue: + return value_.int_ >= 0; + case uintValue: + return true; + case realValue: + // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a + // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble && + IsIntegral(value_.real_); + default: + break; + } +#endif // JSON_HAS_INT64 + return false; +} + +bool Value::isIntegral() const { +#if defined(JSON_HAS_INT64) + return isInt64() || isUInt64(); +#else + return isInt() || isUInt(); +#endif +} + +bool Value::isDouble() const { return type_ == realValue || isIntegral(); } + +bool Value::isNumeric() const { return isIntegral() || isDouble(); } + +bool Value::isString() const { return type_ == stringValue; } + +bool Value::isArray() const { return type_ == arrayValue; } + +bool Value::isObject() const { return type_ == objectValue; } + +void Value::setComment(const char* comment, size_t len, CommentPlacement placement) { + if (!comments_) + comments_ = new CommentInfo[numberOfCommentPlacement]; + if ((len > 0) && (comment[len-1] == '\n')) { + // Always discard trailing newline, to aid indentation. + len -= 1; + } + comments_[placement].setComment(comment, len); +} + +void Value::setComment(const char* comment, CommentPlacement placement) { + setComment(comment, strlen(comment), placement); +} + +void Value::setComment(const std::string& comment, CommentPlacement placement) { + setComment(comment.c_str(), comment.length(), placement); +} + +bool Value::hasComment(CommentPlacement placement) const { + return comments_ != 0 && comments_[placement].comment_ != 0; +} + +std::string Value::getComment(CommentPlacement placement) const { + if (hasComment(placement)) + return comments_[placement].comment_; + return ""; +} + +void Value::setOffsetStart(size_t start) { start_ = start; } + +void Value::setOffsetLimit(size_t limit) { limit_ = limit; } + +size_t Value::getOffsetStart() const { return start_; } + +size_t Value::getOffsetLimit() const { return limit_; } + +std::string Value::toStyledString() const { + StyledWriter writer; + return writer.write(*this); +} + +Value::const_iterator Value::begin() const { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return const_iterator(value_.map_->begin()); + break; + default: + break; + } + return const_iterator(); +} + +Value::const_iterator Value::end() const { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return const_iterator(value_.map_->end()); + break; + default: + break; + } + return const_iterator(); +} + +Value::iterator Value::begin() { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return iterator(value_.map_->begin()); + break; + default: + break; + } + return iterator(); +} + +Value::iterator Value::end() { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return iterator(value_.map_->end()); + break; + default: + break; + } + return iterator(); +} + +// class PathArgument +// ////////////////////////////////////////////////////////////////// + +PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {} + +PathArgument::PathArgument(ArrayIndex index) + : key_(), index_(index), kind_(kindIndex) {} + +PathArgument::PathArgument(const char* key) + : key_(key), index_(), kind_(kindKey) {} + +PathArgument::PathArgument(const std::string& key) + : key_(key.c_str()), index_(), kind_(kindKey) {} + +// class Path +// ////////////////////////////////////////////////////////////////// + +Path::Path(const std::string& path, + const PathArgument& a1, + const PathArgument& a2, + const PathArgument& a3, + const PathArgument& a4, + const PathArgument& a5) { + InArgs in; + in.push_back(&a1); + in.push_back(&a2); + in.push_back(&a3); + in.push_back(&a4); + in.push_back(&a5); + makePath(path, in); +} + +void Path::makePath(const std::string& path, const InArgs& in) { + const char* current = path.c_str(); + const char* end = current + path.length(); + InArgs::const_iterator itInArg = in.begin(); + while (current != end) { + if (*current == '[') { + ++current; + if (*current == '%') + addPathInArg(path, in, itInArg, PathArgument::kindIndex); + else { + ArrayIndex index = 0; + for (; current != end && *current >= '0' && *current <= '9'; ++current) + index = index * 10 + ArrayIndex(*current - '0'); + args_.push_back(index); + } + if (current == end || *current++ != ']') + invalidPath(path, int(current - path.c_str())); + } else if (*current == '%') { + addPathInArg(path, in, itInArg, PathArgument::kindKey); + ++current; + } else if (*current == '.') { + ++current; + } else { + const char* beginName = current; + while (current != end && !strchr("[.", *current)) + ++current; + args_.push_back(std::string(beginName, current)); + } + } +} + +void Path::addPathInArg(const std::string& /*path*/, + const InArgs& in, + InArgs::const_iterator& itInArg, + PathArgument::Kind kind) { + if (itInArg == in.end()) { + // Error: missing argument %d + } else if ((*itInArg)->kind_ != kind) { + // Error: bad argument type + } else { + args_.push_back(**itInArg); + } +} + +void Path::invalidPath(const std::string& /*path*/, int /*location*/) { + // Error: invalid path. +} + +const Value& Path::resolve(const Value& root) const { + const Value* node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument& arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray() || !node->isValidIndex(arg.index_)) { + // Error: unable to resolve path (array value expected at position... + } + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) { + // Error: unable to resolve path (object value expected at position...) + } + node = &((*node)[arg.key_]); + if (node == &Value::nullRef) { + // Error: unable to resolve path (object has no member named '' at + // position...) + } + } + } + return *node; +} + +Value Path::resolve(const Value& root, const Value& defaultValue) const { + const Value* node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument& arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray() || !node->isValidIndex(arg.index_)) + return defaultValue; + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) + return defaultValue; + node = &((*node)[arg.key_]); + if (node == &Value::nullRef) + return defaultValue; + } + } + return *node; +} + +Value& Path::make(Value& root) const { + Value* node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument& arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray()) { + // Error: node is not an array at position ... + } + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) { + // Error: node is not an object at position... + } + node = &((*node)[arg.key_]); + } + } + return *node; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_value.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_writer.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0 +#include +#define isfinite _finite +#elif defined(__sun) && defined(__SVR4) //Solaris +#include +#define isfinite finite +#else +#include +#define isfinite std::isfinite +#endif + +#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below +#define snprintf _snprintf +#elif defined(__ANDROID__) +#define snprintf snprintf +#elif __cplusplus >= 201103L +#define snprintf std::snprintf +#endif + +#if defined(__BORLANDC__) +#include +#define isfinite _finite +#define snprintf _snprintf +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +// Disable warning about strdup being deprecated. +#pragma warning(disable : 4996) +#endif + +namespace Json { + +#if __cplusplus >= 201103L +typedef std::unique_ptr StreamWriterPtr; +#else +typedef std::auto_ptr StreamWriterPtr; +#endif + +static bool containsControlCharacter(const char* str) { + while (*str) { + if (isControlCharacter(*(str++))) + return true; + } + return false; +} + +static bool containsControlCharacter0(const char* str, unsigned len) { + char const* end = str + len; + while (end != str) { + if (isControlCharacter(*str) || 0==*str) + return true; + ++str; + } + return false; +} + +std::string valueToString(LargestInt value) { + UIntToStringBuffer buffer; + char* current = buffer + sizeof(buffer); + bool isNegative = value < 0; + if (isNegative) + value = -value; + uintToString(LargestUInt(value), current); + if (isNegative) + *--current = '-'; + assert(current >= buffer); + return current; +} + +std::string valueToString(LargestUInt value) { + UIntToStringBuffer buffer; + char* current = buffer + sizeof(buffer); + uintToString(value, current); + assert(current >= buffer); + return current; +} + +#if defined(JSON_HAS_INT64) + +std::string valueToString(Int value) { + return valueToString(LargestInt(value)); +} + +std::string valueToString(UInt value) { + return valueToString(LargestUInt(value)); +} + +#endif // # if defined(JSON_HAS_INT64) + +std::string valueToString(double value) { + // Allocate a buffer that is more than large enough to store the 16 digits of + // precision requested below. + char buffer[32]; + int len = -1; + +// Print into the buffer. We need not request the alternative representation +// that always has a decimal point because JSON doesn't distingish the +// concepts of reals and integers. +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with + // visual studio 2005 to + // avoid warning. +#if defined(WINCE) + len = _snprintf(buffer, sizeof(buffer), "%.17g", value); +#else + len = sprintf_s(buffer, sizeof(buffer), "%.17g", value); +#endif +#else + if (isfinite(value)) { + len = snprintf(buffer, sizeof(buffer), "%.17g", value); + } else { + // IEEE standard states that NaN values will not compare to themselves + if (value != value) { + len = snprintf(buffer, sizeof(buffer), "null"); + } else if (value < 0) { + len = snprintf(buffer, sizeof(buffer), "-1e+9999"); + } else { + len = snprintf(buffer, sizeof(buffer), "1e+9999"); + } + // For those, we do not need to call fixNumLoc, but it is fast. + } +#endif + assert(len >= 0); + fixNumericLocale(buffer, buffer + len); + return buffer; +} + +std::string valueToString(bool value) { return value ? "true" : "false"; } + +std::string valueToQuotedString(const char* value) { + if (value == NULL) + return ""; + // Not sure how to handle unicode... + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && + !containsControlCharacter(value)) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + std::string::size_type maxsize = + strlen(value) * 2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + for (const char* c = value; *c != 0; ++c) { + switch (*c) { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + // case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something. + // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); + result += oss.str(); + } else { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// https://github.com/upcaste/upcaste/blob/master/src/upcore/src/cstring/strnpbrk.cpp +static char const* strnpbrk(char const* s, char const* accept, size_t n) { + assert((s || !n) && accept); + + char const* const end = s + n; + for (char const* cur = s; cur < end; ++cur) { + int const c = *cur; + for (char const* a = accept; *a; ++a) { + if (*a == c) { + return cur; + } + } + } + return NULL; +} +static std::string valueToQuotedStringN(const char* value, unsigned length) { + if (value == NULL) + return ""; + // Not sure how to handle unicode... + if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL && + !containsControlCharacter0(value, length)) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + std::string::size_type maxsize = + length * 2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + char const* end = value + length; + for (const char* c = value; c != end; ++c) { + switch (*c) { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + // case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something.) + // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); + result += oss.str(); + } else { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// Class Writer +// ////////////////////////////////////////////////////////////////// +Writer::~Writer() {} + +// Class FastWriter +// ////////////////////////////////////////////////////////////////// + +FastWriter::FastWriter() + : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false), + omitEndingLineFeed_(false) {} + +void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; } + +void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; } + +void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; } + +std::string FastWriter::write(const Value& root) { + document_ = ""; + writeValue(root); + if (!omitEndingLineFeed_) + document_ += "\n"; + return document_; +} + +void FastWriter::writeValue(const Value& value) { + switch (value.type()) { + case nullValue: + if (!dropNullPlaceholders_) + document_ += "null"; + break; + case intValue: + document_ += valueToString(value.asLargestInt()); + break; + case uintValue: + document_ += valueToString(value.asLargestUInt()); + break; + case realValue: + document_ += valueToString(value.asDouble()); + break; + case stringValue: + { + // Is NULL possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) document_ += valueToQuotedStringN(str, static_cast(end-str)); + break; + } + case booleanValue: + document_ += valueToString(value.asBool()); + break; + case arrayValue: { + document_ += '['; + int size = value.size(); + for (int index = 0; index < size; ++index) { + if (index > 0) + document_ += ','; + writeValue(value[index]); + } + document_ += ']'; + } break; + case objectValue: { + Value::Members members(value.getMemberNames()); + document_ += '{'; + for (Value::Members::iterator it = members.begin(); it != members.end(); + ++it) { + const std::string& name = *it; + if (it != members.begin()) + document_ += ','; + document_ += valueToQuotedStringN(name.data(), name.length()); + document_ += yamlCompatiblityEnabled_ ? ": " : ":"; + writeValue(value[name]); + } + document_ += '}'; + } break; + } +} + +// Class StyledWriter +// ////////////////////////////////////////////////////////////////// + +StyledWriter::StyledWriter() + : rightMargin_(74), indentSize_(3), addChildValues_() {} + +std::string StyledWriter::write(const Value& root) { + document_ = ""; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue(root); + writeValue(root); + writeCommentAfterValueOnSameLine(root); + document_ += "\n"; + return document_; +} + +void StyledWriter::writeValue(const Value& value) { + switch (value.type()) { + case nullValue: + pushValue("null"); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + { + // Is NULL possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); + else pushValue(""); + break; + } + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + const std::string& name = *it; + const Value& childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedString(name.c_str())); + document_ += " : "; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + document_ += ','; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void StyledWriter::writeArrayValue(const Value& value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isArrayMultiLine = isMultineArray(value); + if (isArrayMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + const Value& childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + writeIndent(); + writeValue(childValue); + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + document_ += ','; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + document_ += "[ "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + document_ += ", "; + document_ += childValues_[index]; + } + document_ += " ]"; + } + } +} + +bool StyledWriter::isMultineArray(const Value& value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + const Value& childValue = value[index]; + isMultiLine = + isMultiLine || ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + if (hasCommentForValue(value[index])) { + isMultiLine = true; + } + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void StyledWriter::pushValue(const std::string& value) { + if (addChildValues_) + childValues_.push_back(value); + else + document_ += value; +} + +void StyledWriter::writeIndent() { + if (!document_.empty()) { + char last = document_[document_.length() - 1]; + if (last == ' ') // already indented + return; + if (last != '\n') // Comments may add new-line + document_ += '\n'; + } + document_ += indentString_; +} + +void StyledWriter::writeWithIndent(const std::string& value) { + writeIndent(); + document_ += value; +} + +void StyledWriter::indent() { indentString_ += std::string(indentSize_, ' '); } + +void StyledWriter::unindent() { + assert(int(indentString_.size()) >= indentSize_); + indentString_.resize(indentString_.size() - indentSize_); +} + +void StyledWriter::writeCommentBeforeValue(const Value& root) { + if (!root.hasComment(commentBefore)) + return; + + document_ += "\n"; + writeIndent(); + const std::string& comment = root.getComment(commentBefore); + std::string::const_iterator iter = comment.begin(); + while (iter != comment.end()) { + document_ += *iter; + if (*iter == '\n' && + (iter != comment.end() && *(iter + 1) == '/')) + writeIndent(); + ++iter; + } + + // Comments are stripped of trailing newlines, so add one here + document_ += "\n"; +} + +void StyledWriter::writeCommentAfterValueOnSameLine(const Value& root) { + if (root.hasComment(commentAfterOnSameLine)) + document_ += " " + root.getComment(commentAfterOnSameLine); + + if (root.hasComment(commentAfter)) { + document_ += "\n"; + document_ += root.getComment(commentAfter); + document_ += "\n"; + } +} + +bool StyledWriter::hasCommentForValue(const Value& value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +// Class StyledStreamWriter +// ////////////////////////////////////////////////////////////////// + +StyledStreamWriter::StyledStreamWriter(std::string indentation) + : document_(NULL), rightMargin_(74), indentation_(indentation), + addChildValues_() {} + +void StyledStreamWriter::write(std::ostream& out, const Value& root) { + document_ = &out; + addChildValues_ = false; + indentString_ = ""; + indented_ = true; + writeCommentBeforeValue(root); + if (!indented_) writeIndent(); + indented_ = true; + writeValue(root); + writeCommentAfterValueOnSameLine(root); + *document_ << "\n"; + document_ = NULL; // Forget the stream, for safety. +} + +void StyledStreamWriter::writeValue(const Value& value) { + switch (value.type()) { + case nullValue: + pushValue("null"); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + { + // Is NULL possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); + else pushValue(""); + break; + } + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + const std::string& name = *it; + const Value& childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedString(name.c_str())); + *document_ << " : "; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void StyledStreamWriter::writeArrayValue(const Value& value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isArrayMultiLine = isMultineArray(value); + if (isArrayMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + const Value& childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + if (!indented_) writeIndent(); + indented_ = true; + writeValue(childValue); + indented_ = false; + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + *document_ << "[ "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + *document_ << ", "; + *document_ << childValues_[index]; + } + *document_ << " ]"; + } + } +} + +bool StyledStreamWriter::isMultineArray(const Value& value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + const Value& childValue = value[index]; + isMultiLine = + isMultiLine || ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + if (hasCommentForValue(value[index])) { + isMultiLine = true; + } + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void StyledStreamWriter::pushValue(const std::string& value) { + if (addChildValues_) + childValues_.push_back(value); + else + *document_ << value; +} + +void StyledStreamWriter::writeIndent() { + // blep intended this to look at the so-far-written string + // to determine whether we are already indented, but + // with a stream we cannot do that. So we rely on some saved state. + // The caller checks indented_. + *document_ << '\n' << indentString_; +} + +void StyledStreamWriter::writeWithIndent(const std::string& value) { + if (!indented_) writeIndent(); + *document_ << value; + indented_ = false; +} + +void StyledStreamWriter::indent() { indentString_ += indentation_; } + +void StyledStreamWriter::unindent() { + assert(indentString_.size() >= indentation_.size()); + indentString_.resize(indentString_.size() - indentation_.size()); +} + +void StyledStreamWriter::writeCommentBeforeValue(const Value& root) { + if (!root.hasComment(commentBefore)) + return; + + if (!indented_) writeIndent(); + const std::string& comment = root.getComment(commentBefore); + std::string::const_iterator iter = comment.begin(); + while (iter != comment.end()) { + *document_ << *iter; + if (*iter == '\n' && + (iter != comment.end() && *(iter + 1) == '/')) + // writeIndent(); // would include newline + *document_ << indentString_; + ++iter; + } + indented_ = false; +} + +void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value& root) { + if (root.hasComment(commentAfterOnSameLine)) + *document_ << ' ' << root.getComment(commentAfterOnSameLine); + + if (root.hasComment(commentAfter)) { + writeIndent(); + *document_ << root.getComment(commentAfter); + } + indented_ = false; +} + +bool StyledStreamWriter::hasCommentForValue(const Value& value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +////////////////////////// +// BuiltStyledStreamWriter + +/// Scoped enums are not available until C++11. +struct CommentStyle { + /// Decide whether to write comments. + enum Enum { + None, ///< Drop all comments. + Most, ///< Recover odd behavior of previous versions (not implemented yet). + All ///< Keep all comments. + }; +}; + +struct BuiltStyledStreamWriter : public StreamWriter +{ + BuiltStyledStreamWriter( + std::string const& indentation, + CommentStyle::Enum cs, + std::string const& colonSymbol, + std::string const& nullSymbol, + std::string const& endingLineFeedSymbol); + virtual int write(Value const& root, std::ostream* sout); +private: + void writeValue(Value const& value); + void writeArrayValue(Value const& value); + bool isMultineArray(Value const& value); + void pushValue(std::string const& value); + void writeIndent(); + void writeWithIndent(std::string const& value); + void indent(); + void unindent(); + void writeCommentBeforeValue(Value const& root); + void writeCommentAfterValueOnSameLine(Value const& root); + static bool hasCommentForValue(const Value& value); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + CommentStyle::Enum cs_; + std::string colonSymbol_; + std::string nullSymbol_; + std::string endingLineFeedSymbol_; + bool addChildValues_ : 1; + bool indented_ : 1; +}; +BuiltStyledStreamWriter::BuiltStyledStreamWriter( + std::string const& indentation, + CommentStyle::Enum cs, + std::string const& colonSymbol, + std::string const& nullSymbol, + std::string const& endingLineFeedSymbol) + : rightMargin_(74) + , indentation_(indentation) + , cs_(cs) + , colonSymbol_(colonSymbol) + , nullSymbol_(nullSymbol) + , endingLineFeedSymbol_(endingLineFeedSymbol) + , addChildValues_(false) + , indented_(false) +{ +} +int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout) +{ + sout_ = sout; + addChildValues_ = false; + indented_ = true; + indentString_ = ""; + writeCommentBeforeValue(root); + if (!indented_) writeIndent(); + indented_ = true; + writeValue(root); + writeCommentAfterValueOnSameLine(root); + *sout_ << endingLineFeedSymbol_; + sout_ = NULL; + return 0; +} +void BuiltStyledStreamWriter::writeValue(Value const& value) { + switch (value.type()) { + case nullValue: + pushValue(nullSymbol_); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + { + // Is NULL is possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); + else pushValue(""); + break; + } + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + std::string const& name = *it; + Value const& childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedStringN(name.data(), name.length())); + *sout_ << colonSymbol_; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *sout_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void BuiltStyledStreamWriter::writeArrayValue(Value const& value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value); + if (isMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + Value const& childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + if (!indented_) writeIndent(); + indented_ = true; + writeValue(childValue); + indented_ = false; + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *sout_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + *sout_ << "["; + if (!indentation_.empty()) *sout_ << " "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + *sout_ << ", "; + *sout_ << childValues_[index]; + } + if (!indentation_.empty()) *sout_ << " "; + *sout_ << "]"; + } + } +} + +bool BuiltStyledStreamWriter::isMultineArray(Value const& value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + Value const& childValue = value[index]; + isMultiLine = + isMultiLine || ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + if (hasCommentForValue(value[index])) { + isMultiLine = true; + } + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void BuiltStyledStreamWriter::pushValue(std::string const& value) { + if (addChildValues_) + childValues_.push_back(value); + else + *sout_ << value; +} + +void BuiltStyledStreamWriter::writeIndent() { + // blep intended this to look at the so-far-written string + // to determine whether we are already indented, but + // with a stream we cannot do that. So we rely on some saved state. + // The caller checks indented_. + + if (!indentation_.empty()) { + // In this case, drop newlines too. + *sout_ << '\n' << indentString_; + } +} + +void BuiltStyledStreamWriter::writeWithIndent(std::string const& value) { + if (!indented_) writeIndent(); + *sout_ << value; + indented_ = false; +} + +void BuiltStyledStreamWriter::indent() { indentString_ += indentation_; } + +void BuiltStyledStreamWriter::unindent() { + assert(indentString_.size() >= indentation_.size()); + indentString_.resize(indentString_.size() - indentation_.size()); +} + +void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) { + if (cs_ == CommentStyle::None) return; + if (!root.hasComment(commentBefore)) + return; + + if (!indented_) writeIndent(); + const std::string& comment = root.getComment(commentBefore); + std::string::const_iterator iter = comment.begin(); + while (iter != comment.end()) { + *sout_ << *iter; + if (*iter == '\n' && + (iter != comment.end() && *(iter + 1) == '/')) + // writeIndent(); // would write extra newline + *sout_ << indentString_; + ++iter; + } + indented_ = false; +} + +void BuiltStyledStreamWriter::writeCommentAfterValueOnSameLine(Value const& root) { + if (cs_ == CommentStyle::None) return; + if (root.hasComment(commentAfterOnSameLine)) + *sout_ << " " + root.getComment(commentAfterOnSameLine); + + if (root.hasComment(commentAfter)) { + writeIndent(); + *sout_ << root.getComment(commentAfter); + } +} + +// static +bool BuiltStyledStreamWriter::hasCommentForValue(const Value& value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +/////////////// +// StreamWriter + +StreamWriter::StreamWriter() + : sout_(NULL) +{ +} +StreamWriter::~StreamWriter() +{ +} +StreamWriter::Factory::~Factory() +{} +StreamWriterBuilder::StreamWriterBuilder() +{ + setDefaults(&settings_); +} +StreamWriterBuilder::~StreamWriterBuilder() +{} +StreamWriter* StreamWriterBuilder::newStreamWriter() const +{ + std::string indentation = settings_["indentation"].asString(); + std::string cs_str = settings_["commentStyle"].asString(); + bool eyc = settings_["enableYAMLCompatibility"].asBool(); + bool dnp = settings_["dropNullPlaceholders"].asBool(); + CommentStyle::Enum cs = CommentStyle::All; + if (cs_str == "All") { + cs = CommentStyle::All; + } else if (cs_str == "None") { + cs = CommentStyle::None; + } else { + throwRuntimeError("commentStyle must be 'All' or 'None'"); + } + std::string colonSymbol = " : "; + if (eyc) { + colonSymbol = ": "; + } else if (indentation.empty()) { + colonSymbol = ":"; + } + std::string nullSymbol = "null"; + if (dnp) { + nullSymbol = ""; + } + std::string endingLineFeedSymbol = ""; + return new BuiltStyledStreamWriter( + indentation, cs, + colonSymbol, nullSymbol, endingLineFeedSymbol); +} +static void getValidWriterKeys(std::set* valid_keys) +{ + valid_keys->clear(); + valid_keys->insert("indentation"); + valid_keys->insert("commentStyle"); + valid_keys->insert("enableYAMLCompatibility"); + valid_keys->insert("dropNullPlaceholders"); +} +bool StreamWriterBuilder::validate(Json::Value* invalid) const +{ + Json::Value my_invalid; + if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL + Json::Value& inv = *invalid; + std::set valid_keys; + getValidWriterKeys(&valid_keys); + Value::Members keys = settings_.getMemberNames(); + size_t n = keys.size(); + for (size_t i = 0; i < n; ++i) { + std::string const& key = keys[i]; + if (valid_keys.find(key) == valid_keys.end()) { + inv[key] = settings_[key]; + } + } + return 0u == inv.size(); +} +Value& StreamWriterBuilder::operator[](std::string key) +{ + return settings_[key]; +} +// static +void StreamWriterBuilder::setDefaults(Json::Value* settings) +{ + //! [StreamWriterBuilderDefaults] + (*settings)["commentStyle"] = "All"; + (*settings)["indentation"] = "\t"; + (*settings)["enableYAMLCompatibility"] = false; + (*settings)["dropNullPlaceholders"] = false; + //! [StreamWriterBuilderDefaults] +} + +std::string writeString(StreamWriter::Factory const& builder, Value const& root) { + std::ostringstream sout; + StreamWriterPtr const writer(builder.newStreamWriter()); + writer->write(root, &sout); + return sout.str(); +} + +std::ostream& operator<<(std::ostream& sout, Value const& root) { + StreamWriterBuilder builder; + StreamWriterPtr const writer(builder.newStreamWriter()); + writer->write(root, &sout); + return sout; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_writer.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/main.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/main.cpp new file mode 100644 index 00000000000..e146b39b4b7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/external/SPIRV-Headers/tools/buildHeaders/main.cpp @@ -0,0 +1,121 @@ +// Copyright (c) 2014-2018 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +//#include +#include +#include + +#include "jsonToSpirv.h" +#include "header.h" + +// Command-line options +enum TOptions { + EOptionNone = 0x000, + EOptionPrintHeader = 0x008, +}; + +std::string jsonPath; +int Options; +spv::TLanguage Language; + +void Usage() +{ + printf("Usage: spirv option [file]\n" + "\n" + " -h print header for given language to stdout, from one of:\n" + " C - C99 header\n" + " C++ - C++03 or greater header (also accepts C++03)\n" + " C++11 - C++11 or greater header\n" + " JSON - JSON format data\n" + " Lua - Lua module\n" + " Python - Python module (also accepts Py)\n" + " -H print header in all supported languages to files in current directory\n" + ); +} + +std::string tolower_s(std::string s) +{ + std::transform(s.begin(), s.end(), s.begin(), ::tolower); + return s; +} + +bool ProcessArguments(int argc, char* argv[]) +{ + argc--; + argv++; + for (; argc >= 1; argc--, argv++) { + if (argv[0][0] == '-') { + switch (argv[0][1]) { + case 'H': + Options |= EOptionPrintHeader; + Language = spv::ELangAll; + break; + case 'h': { + if (argc < 2) + return false; + + Options |= EOptionPrintHeader; + const std::string language(tolower_s(argv[1])); + + if (language == "c") { + Language = spv::ELangC; + } else if (language == "c++" || language == "c++03") { + Language = spv::ELangCPP; + } else if (language == "c++11") { + Language = spv::ELangCPP11; + } else if (language == "json") { + Language = spv::ELangJSON; + } else if (language == "lua") { + Language = spv::ELangLua; + } else if (language == "python" || language == "py") { + Language = spv::ELangPython; + } else + return false; + + return true; + } + default: + return false; + } + } else { + jsonPath = std::string(argv[0]); + } + } + + return true; +} + +int main(int argc, char* argv[]) +{ + if (argc < 2 || ! ProcessArguments(argc, argv)) { + Usage(); + return 1; + } + + spv::jsonToSpirv(jsonPath); + if (Options & EOptionPrintHeader) + spv::PrintHeader(Language, std::cout); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/DebugInfo.h b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/DebugInfo.h new file mode 100644 index 00000000000..9639ea10776 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/DebugInfo.h @@ -0,0 +1,137 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and/or associated documentation files (the "Materials"), +// to deal in the Materials without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Materials, and to permit persons to whom the +// Materials are furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Materials. +// +// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +// +// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +// IN THE MATERIALS. + +#ifndef SPIRV_EXTINST_DebugInfo_H_ +#define SPIRV_EXTINST_DebugInfo_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { DebugInfoVersion = 100, DebugInfoVersion_BitWidthPadding = 0x7fffffff }; +enum { DebugInfoRevision = 1, DebugInfoRevision_BitWidthPadding = 0x7fffffff }; + +enum DebugInfoInstructions { + DebugInfoDebugInfoNone = 0, + DebugInfoDebugCompilationUnit = 1, + DebugInfoDebugTypeBasic = 2, + DebugInfoDebugTypePointer = 3, + DebugInfoDebugTypeQualifier = 4, + DebugInfoDebugTypeArray = 5, + DebugInfoDebugTypeVector = 6, + DebugInfoDebugTypedef = 7, + DebugInfoDebugTypeFunction = 8, + DebugInfoDebugTypeEnum = 9, + DebugInfoDebugTypeComposite = 10, + DebugInfoDebugTypeMember = 11, + DebugInfoDebugTypeInheritance = 12, + DebugInfoDebugTypePtrToMember = 13, + DebugInfoDebugTypeTemplate = 14, + DebugInfoDebugTypeTemplateParameter = 15, + DebugInfoDebugTypeTemplateTemplateParameter = 16, + DebugInfoDebugTypeTemplateParameterPack = 17, + DebugInfoDebugGlobalVariable = 18, + DebugInfoDebugFunctionDeclaration = 19, + DebugInfoDebugFunction = 20, + DebugInfoDebugLexicalBlock = 21, + DebugInfoDebugLexicalBlockDiscriminator = 22, + DebugInfoDebugScope = 23, + DebugInfoDebugNoScope = 24, + DebugInfoDebugInlinedAt = 25, + DebugInfoDebugLocalVariable = 26, + DebugInfoDebugInlinedVariable = 27, + DebugInfoDebugDeclare = 28, + DebugInfoDebugValue = 29, + DebugInfoDebugOperation = 30, + DebugInfoDebugExpression = 31, + DebugInfoDebugMacroDef = 32, + DebugInfoDebugMacroUndef = 33, + DebugInfoInstructionsMax = 0x7ffffff +}; + + +enum DebugInfoDebugInfoFlags { + DebugInfoFlagIsProtected = 0x01, + DebugInfoFlagIsPrivate = 0x02, + DebugInfoFlagIsPublic = 0x03, + DebugInfoFlagIsLocal = 0x04, + DebugInfoFlagIsDefinition = 0x08, + DebugInfoFlagFwdDecl = 0x10, + DebugInfoFlagArtificial = 0x20, + DebugInfoFlagExplicit = 0x40, + DebugInfoFlagPrototyped = 0x80, + DebugInfoFlagObjectPointer = 0x100, + DebugInfoFlagStaticMember = 0x200, + DebugInfoFlagIndirectVariable = 0x400, + DebugInfoFlagLValueReference = 0x800, + DebugInfoFlagRValueReference = 0x1000, + DebugInfoFlagIsOptimized = 0x2000, + DebugInfoDebugInfoFlagsMax = 0x7ffffff +}; + +enum DebugInfoDebugBaseTypeAttributeEncoding { + DebugInfoUnspecified = 0, + DebugInfoAddress = 1, + DebugInfoBoolean = 2, + DebugInfoFloat = 4, + DebugInfoSigned = 5, + DebugInfoSignedChar = 6, + DebugInfoUnsigned = 7, + DebugInfoUnsignedChar = 8, + DebugInfoDebugBaseTypeAttributeEncodingMax = 0x7ffffff +}; + +enum DebugInfoDebugCompositeType { + DebugInfoClass = 0, + DebugInfoStructure = 1, + DebugInfoUnion = 2, + DebugInfoDebugCompositeTypeMax = 0x7ffffff +}; + +enum DebugInfoDebugTypeQualifier { + DebugInfoConstType = 0, + DebugInfoVolatileType = 1, + DebugInfoRestrictType = 2, + DebugInfoDebugTypeQualifierMax = 0x7ffffff +}; + +enum DebugInfoDebugOperation { + DebugInfoDeref = 0, + DebugInfoPlus = 1, + DebugInfoMinus = 2, + DebugInfoPlusUconst = 3, + DebugInfoBitPiece = 4, + DebugInfoSwap = 5, + DebugInfoXderef = 6, + DebugInfoStackValue = 7, + DebugInfoConstu = 8, + DebugInfoDebugOperationMax = 0x7ffffff +}; + + +#ifdef __cplusplus +} +#endif + +#endif // SPIRV_EXTINST_DebugInfo_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc new file mode 100644 index 00000000000..311820b736f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/build-version.inc @@ -0,0 +1 @@ +"v2018.5-dev", "SPIRV-Tools v2018.5-dev v2018.4-149-g58e53ea" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc new file mode 100644 index 00000000000..e7e16db6b3c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/core.insts-unified1.inc @@ -0,0 +1,410 @@ +static const SpvCapability pygen_variable_caps_Addresses[] = {SpvCapabilityAddresses}; +static const SpvCapability pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBuffer[] = {SpvCapabilityAddresses, SpvCapabilityVariablePointers, SpvCapabilityVariablePointersStorageBuffer}; +static const SpvCapability pygen_variable_caps_DerivativeControl[] = {SpvCapabilityDerivativeControl}; +static const SpvCapability pygen_variable_caps_DeviceEnqueue[] = {SpvCapabilityDeviceEnqueue}; +static const SpvCapability pygen_variable_caps_FragmentMaskAMD[] = {SpvCapabilityFragmentMaskAMD}; +static const SpvCapability pygen_variable_caps_Geometry[] = {SpvCapabilityGeometry}; +static const SpvCapability pygen_variable_caps_GeometryStreams[] = {SpvCapabilityGeometryStreams}; +static const SpvCapability pygen_variable_caps_GroupNonUniform[] = {SpvCapabilityGroupNonUniform}; +static const SpvCapability pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered[] = {SpvCapabilityGroupNonUniformArithmetic, SpvCapabilityGroupNonUniformClustered}; +static const SpvCapability pygen_variable_caps_GroupNonUniformBallot[] = {SpvCapabilityGroupNonUniformBallot}; +static const SpvCapability pygen_variable_caps_GroupNonUniformPartitionedNV[] = {SpvCapabilityGroupNonUniformPartitionedNV}; +static const SpvCapability pygen_variable_caps_GroupNonUniformQuad[] = {SpvCapabilityGroupNonUniformQuad}; +static const SpvCapability pygen_variable_caps_GroupNonUniformShuffle[] = {SpvCapabilityGroupNonUniformShuffle}; +static const SpvCapability pygen_variable_caps_GroupNonUniformShuffleRelative[] = {SpvCapabilityGroupNonUniformShuffleRelative}; +static const SpvCapability pygen_variable_caps_GroupNonUniformVote[] = {SpvCapabilityGroupNonUniformVote}; +static const SpvCapability pygen_variable_caps_Groups[] = {SpvCapabilityGroups}; +static const SpvCapability pygen_variable_caps_ImageQuery[] = {SpvCapabilityImageQuery}; +static const SpvCapability pygen_variable_caps_Kernel[] = {SpvCapabilityKernel}; +static const SpvCapability pygen_variable_caps_KernelImageQuery[] = {SpvCapabilityKernel, SpvCapabilityImageQuery}; +static const SpvCapability pygen_variable_caps_LiteralSampler[] = {SpvCapabilityLiteralSampler}; +static const SpvCapability pygen_variable_caps_Matrix[] = {SpvCapabilityMatrix}; +static const SpvCapability pygen_variable_caps_NamedBarrier[] = {SpvCapabilityNamedBarrier}; +static const SpvCapability pygen_variable_caps_PipeStorage[] = {SpvCapabilityPipeStorage}; +static const SpvCapability pygen_variable_caps_Pipes[] = {SpvCapabilityPipes}; +static const SpvCapability pygen_variable_caps_Shader[] = {SpvCapabilityShader}; +static const SpvCapability pygen_variable_caps_SparseResidency[] = {SpvCapabilitySparseResidency}; +static const SpvCapability pygen_variable_caps_SubgroupBallotKHR[] = {SpvCapabilitySubgroupBallotKHR}; +static const SpvCapability pygen_variable_caps_SubgroupBufferBlockIOINTEL[] = {SpvCapabilitySubgroupBufferBlockIOINTEL}; +static const SpvCapability pygen_variable_caps_SubgroupDispatch[] = {SpvCapabilitySubgroupDispatch}; +static const SpvCapability pygen_variable_caps_SubgroupImageBlockIOINTEL[] = {SpvCapabilitySubgroupImageBlockIOINTEL}; +static const SpvCapability pygen_variable_caps_SubgroupShuffleINTEL[] = {SpvCapabilitySubgroupShuffleINTEL}; +static const SpvCapability pygen_variable_caps_SubgroupVoteKHR[] = {SpvCapabilitySubgroupVoteKHR}; + +static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_ballot[] = {spvtools::Extension::kSPV_AMD_shader_ballot}; +static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_fragment_mask[] = {spvtools::Extension::kSPV_AMD_shader_fragment_mask}; +static const spvtools::Extension pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1[] = {spvtools::Extension::kSPV_GOOGLE_decorate_string, spvtools::Extension::kSPV_GOOGLE_hlsl_functionality1}; +static const spvtools::Extension pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1[] = {spvtools::Extension::kSPV_GOOGLE_hlsl_functionality1}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_ballot[] = {spvtools::Extension::kSPV_KHR_shader_ballot}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_subgroup_vote[] = {spvtools::Extension::kSPV_KHR_subgroup_vote}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_subgroup_partitioned[] = {spvtools::Extension::kSPV_NV_shader_subgroup_partitioned}; + +static const spv_opcode_desc_t kOpcodeTableEntries[] = { + {"Nop", SpvOpNop, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Undef", SpvOpUndef, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SourceContinued", SpvOpSourceContinued, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Source", SpvOpSource, 0, nullptr, 4, {SPV_OPERAND_TYPE_SOURCE_LANGUAGE, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SourceExtension", SpvOpSourceExtension, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Name", SpvOpName, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MemberName", SpvOpMemberName, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"String", SpvOpString, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Line", SpvOpLine, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Extension", SpvOpExtension, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ExtInstImport", SpvOpExtInstImport, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ExtInst", SpvOpExtInst, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MemoryModel", SpvOpMemoryModel, 0, nullptr, 2, {SPV_OPERAND_TYPE_ADDRESSING_MODEL, SPV_OPERAND_TYPE_MEMORY_MODEL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EntryPoint", SpvOpEntryPoint, 0, nullptr, 4, {SPV_OPERAND_TYPE_EXECUTION_MODEL, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ExecutionMode", SpvOpExecutionMode, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXECUTION_MODE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Capability", SpvOpCapability, 0, nullptr, 1, {SPV_OPERAND_TYPE_CAPABILITY}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeVoid", SpvOpTypeVoid, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeBool", SpvOpTypeBool, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeInt", SpvOpTypeInt, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeFloat", SpvOpTypeFloat, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeVector", SpvOpTypeVector, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeMatrix", SpvOpTypeMatrix, 1, pygen_variable_caps_Matrix, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeImage", SpvOpTypeImage, 0, nullptr, 9, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DIMENSIONALITY, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeSampler", SpvOpTypeSampler, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeSampledImage", SpvOpTypeSampledImage, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeArray", SpvOpTypeArray, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeRuntimeArray", SpvOpTypeRuntimeArray, 1, pygen_variable_caps_Shader, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeStruct", SpvOpTypeStruct, 0, nullptr, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeOpaque", SpvOpTypeOpaque, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_STRING}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypePointer", SpvOpTypePointer, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeFunction", SpvOpTypeFunction, 0, nullptr, 3, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeEvent", SpvOpTypeEvent, 1, pygen_variable_caps_Kernel, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeDeviceEvent", SpvOpTypeDeviceEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeReserveId", SpvOpTypeReserveId, 1, pygen_variable_caps_Pipes, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeQueue", SpvOpTypeQueue, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypePipe", SpvOpTypePipe, 1, pygen_variable_caps_Pipes, 2, {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ACCESS_QUALIFIER}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TypeForwardPointer", SpvOpTypeForwardPointer, 1, pygen_variable_caps_Addresses, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstantTrue", SpvOpConstantTrue, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstantFalse", SpvOpConstantFalse, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Constant", SpvOpConstant, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstantComposite", SpvOpConstantComposite, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstantSampler", SpvOpConstantSampler, 1, pygen_variable_caps_LiteralSampler, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstantNull", SpvOpConstantNull, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpecConstantTrue", SpvOpSpecConstantTrue, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpecConstantFalse", SpvOpSpecConstantFalse, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpecConstant", SpvOpSpecConstant, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpecConstantComposite", SpvOpSpecConstantComposite, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpecConstantOp", SpvOpSpecConstantOp, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Function", SpvOpFunction, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_FUNCTION_CONTROL, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FunctionParameter", SpvOpFunctionParameter, 0, nullptr, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FunctionEnd", SpvOpFunctionEnd, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FunctionCall", SpvOpFunctionCall, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Variable", SpvOpVariable, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageTexelPointer", SpvOpImageTexelPointer, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Load", SpvOpLoad, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Store", SpvOpStore, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CopyMemory", SpvOpCopyMemory, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CopyMemorySized", SpvOpCopyMemorySized, 1, pygen_variable_caps_Addresses, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AccessChain", SpvOpAccessChain, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InBoundsAccessChain", SpvOpInBoundsAccessChain, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PtrAccessChain", SpvOpPtrAccessChain, 3, pygen_variable_caps_AddressesVariablePointersVariablePointersStorageBuffer, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ArrayLength", SpvOpArrayLength, 1, pygen_variable_caps_Shader, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GenericPtrMemSemantics", SpvOpGenericPtrMemSemantics, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InBoundsPtrAccessChain", SpvOpInBoundsPtrAccessChain, 1, pygen_variable_caps_Addresses, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Decorate", SpvOpDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MemberDecorate", SpvOpMemberDecorate, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DecorationGroup", SpvOpDecorationGroup, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupDecorate", SpvOpGroupDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupMemberDecorate", SpvOpGroupMemberDecorate, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VectorExtractDynamic", SpvOpVectorExtractDynamic, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VectorInsertDynamic", SpvOpVectorInsertDynamic, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VectorShuffle", SpvOpVectorShuffle, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CompositeConstruct", SpvOpCompositeConstruct, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CompositeExtract", SpvOpCompositeExtract, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CompositeInsert", SpvOpCompositeInsert, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CopyObject", SpvOpCopyObject, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Transpose", SpvOpTranspose, 1, pygen_variable_caps_Matrix, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampledImage", SpvOpSampledImage, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleImplicitLod", SpvOpImageSampleImplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleExplicitLod", SpvOpImageSampleExplicitLod, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleDrefImplicitLod", SpvOpImageSampleDrefImplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleDrefExplicitLod", SpvOpImageSampleDrefExplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleProjImplicitLod", SpvOpImageSampleProjImplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleProjExplicitLod", SpvOpImageSampleProjExplicitLod, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleProjDrefImplicitLod", SpvOpImageSampleProjDrefImplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSampleProjDrefExplicitLod", SpvOpImageSampleProjDrefExplicitLod, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageFetch", SpvOpImageFetch, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageGather", SpvOpImageGather, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageDrefGather", SpvOpImageDrefGather, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageRead", SpvOpImageRead, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageWrite", SpvOpImageWrite, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Image", SpvOpImage, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQueryFormat", SpvOpImageQueryFormat, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQueryOrder", SpvOpImageQueryOrder, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQuerySizeLod", SpvOpImageQuerySizeLod, 2, pygen_variable_caps_KernelImageQuery, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQuerySize", SpvOpImageQuerySize, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQueryLod", SpvOpImageQueryLod, 1, pygen_variable_caps_ImageQuery, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQueryLevels", SpvOpImageQueryLevels, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQuerySamples", SpvOpImageQuerySamples, 2, pygen_variable_caps_KernelImageQuery, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConvertFToU", SpvOpConvertFToU, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConvertFToS", SpvOpConvertFToS, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConvertSToF", SpvOpConvertSToF, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConvertUToF", SpvOpConvertUToF, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UConvert", SpvOpUConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SConvert", SpvOpSConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FConvert", SpvOpFConvert, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"QuantizeToF16", SpvOpQuantizeToF16, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConvertPtrToU", SpvOpConvertPtrToU, 1, pygen_variable_caps_Addresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SatConvertSToU", SpvOpSatConvertSToU, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SatConvertUToS", SpvOpSatConvertUToS, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConvertUToPtr", SpvOpConvertUToPtr, 1, pygen_variable_caps_Addresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PtrCastToGeneric", SpvOpPtrCastToGeneric, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GenericCastToPtr", SpvOpGenericCastToPtr, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GenericCastToPtrExplicit", SpvOpGenericCastToPtrExplicit, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Bitcast", SpvOpBitcast, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SNegate", SpvOpSNegate, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FNegate", SpvOpFNegate, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IAdd", SpvOpIAdd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FAdd", SpvOpFAdd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ISub", SpvOpISub, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FSub", SpvOpFSub, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IMul", SpvOpIMul, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FMul", SpvOpFMul, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UDiv", SpvOpUDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SDiv", SpvOpSDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FDiv", SpvOpFDiv, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UMod", SpvOpUMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SRem", SpvOpSRem, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SMod", SpvOpSMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FRem", SpvOpFRem, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FMod", SpvOpFMod, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VectorTimesScalar", SpvOpVectorTimesScalar, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MatrixTimesScalar", SpvOpMatrixTimesScalar, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VectorTimesMatrix", SpvOpVectorTimesMatrix, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MatrixTimesVector", SpvOpMatrixTimesVector, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MatrixTimesMatrix", SpvOpMatrixTimesMatrix, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OuterProduct", SpvOpOuterProduct, 1, pygen_variable_caps_Matrix, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Dot", SpvOpDot, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IAddCarry", SpvOpIAddCarry, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ISubBorrow", SpvOpISubBorrow, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UMulExtended", SpvOpUMulExtended, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SMulExtended", SpvOpSMulExtended, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Any", SpvOpAny, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"All", SpvOpAll, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IsNan", SpvOpIsNan, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IsInf", SpvOpIsInf, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IsFinite", SpvOpIsFinite, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IsNormal", SpvOpIsNormal, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SignBitSet", SpvOpSignBitSet, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LessOrGreater", SpvOpLessOrGreater, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Ordered", SpvOpOrdered, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Unordered", SpvOpUnordered, 1, pygen_variable_caps_Kernel, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LogicalEqual", SpvOpLogicalEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LogicalNotEqual", SpvOpLogicalNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LogicalOr", SpvOpLogicalOr, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LogicalAnd", SpvOpLogicalAnd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LogicalNot", SpvOpLogicalNot, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Select", SpvOpSelect, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IEqual", SpvOpIEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"INotEqual", SpvOpINotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UGreaterThan", SpvOpUGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SGreaterThan", SpvOpSGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UGreaterThanEqual", SpvOpUGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SGreaterThanEqual", SpvOpSGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ULessThan", SpvOpULessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SLessThan", SpvOpSLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ULessThanEqual", SpvOpULessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SLessThanEqual", SpvOpSLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FOrdEqual", SpvOpFOrdEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FUnordEqual", SpvOpFUnordEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FOrdNotEqual", SpvOpFOrdNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FUnordNotEqual", SpvOpFUnordNotEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FOrdLessThan", SpvOpFOrdLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FUnordLessThan", SpvOpFUnordLessThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FOrdGreaterThan", SpvOpFOrdGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FUnordGreaterThan", SpvOpFUnordGreaterThan, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FOrdLessThanEqual", SpvOpFOrdLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FUnordLessThanEqual", SpvOpFUnordLessThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FOrdGreaterThanEqual", SpvOpFOrdGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FUnordGreaterThanEqual", SpvOpFUnordGreaterThanEqual, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ShiftRightLogical", SpvOpShiftRightLogical, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ShiftRightArithmetic", SpvOpShiftRightArithmetic, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ShiftLeftLogical", SpvOpShiftLeftLogical, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitwiseOr", SpvOpBitwiseOr, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitwiseXor", SpvOpBitwiseXor, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitwiseAnd", SpvOpBitwiseAnd, 0, nullptr, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Not", SpvOpNot, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitFieldInsert", SpvOpBitFieldInsert, 1, pygen_variable_caps_Shader, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitFieldSExtract", SpvOpBitFieldSExtract, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitFieldUExtract", SpvOpBitFieldUExtract, 1, pygen_variable_caps_Shader, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitReverse", SpvOpBitReverse, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitCount", SpvOpBitCount, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DPdx", SpvOpDPdx, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DPdy", SpvOpDPdy, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Fwidth", SpvOpFwidth, 1, pygen_variable_caps_Shader, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DPdxFine", SpvOpDPdxFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DPdyFine", SpvOpDPdyFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FwidthFine", SpvOpFwidthFine, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DPdxCoarse", SpvOpDPdxCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DPdyCoarse", SpvOpDPdyCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FwidthCoarse", SpvOpFwidthCoarse, 1, pygen_variable_caps_DerivativeControl, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EmitVertex", SpvOpEmitVertex, 1, pygen_variable_caps_Geometry, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EndPrimitive", SpvOpEndPrimitive, 1, pygen_variable_caps_Geometry, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EmitStreamVertex", SpvOpEmitStreamVertex, 1, pygen_variable_caps_GeometryStreams, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EndStreamPrimitive", SpvOpEndStreamPrimitive, 1, pygen_variable_caps_GeometryStreams, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ControlBarrier", SpvOpControlBarrier, 0, nullptr, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MemoryBarrier", SpvOpMemoryBarrier, 0, nullptr, 2, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicLoad", SpvOpAtomicLoad, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicStore", SpvOpAtomicStore, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicExchange", SpvOpAtomicExchange, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicCompareExchange", SpvOpAtomicCompareExchange, 0, nullptr, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicCompareExchangeWeak", SpvOpAtomicCompareExchangeWeak, 1, pygen_variable_caps_Kernel, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicIIncrement", SpvOpAtomicIIncrement, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicIDecrement", SpvOpAtomicIDecrement, 0, nullptr, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicIAdd", SpvOpAtomicIAdd, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicISub", SpvOpAtomicISub, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicSMin", SpvOpAtomicSMin, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicUMin", SpvOpAtomicUMin, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicSMax", SpvOpAtomicSMax, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicUMax", SpvOpAtomicUMax, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicAnd", SpvOpAtomicAnd, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicOr", SpvOpAtomicOr, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicXor", SpvOpAtomicXor, 0, nullptr, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Phi", SpvOpPhi, 0, nullptr, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LoopMerge", SpvOpLoopMerge, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LOOP_CONTROL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SelectionMerge", SpvOpSelectionMerge, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SELECTION_CONTROL}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Label", SpvOpLabel, 0, nullptr, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Branch", SpvOpBranch, 0, nullptr, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BranchConditional", SpvOpBranchConditional, 0, nullptr, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Switch", SpvOpSwitch, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Kill", SpvOpKill, 1, pygen_variable_caps_Shader, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Return", SpvOpReturn, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReturnValue", SpvOpReturnValue, 0, nullptr, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Unreachable", SpvOpUnreachable, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LifetimeStart", SpvOpLifetimeStart, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LifetimeStop", SpvOpLifetimeStop, 1, pygen_variable_caps_Kernel, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupAsyncCopy", SpvOpGroupAsyncCopy, 1, pygen_variable_caps_Kernel, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupWaitEvents", SpvOpGroupWaitEvents, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupAll", SpvOpGroupAll, 1, pygen_variable_caps_Groups, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupAny", SpvOpGroupAny, 1, pygen_variable_caps_Groups, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupBroadcast", SpvOpGroupBroadcast, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupIAdd", SpvOpGroupIAdd, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupFAdd", SpvOpGroupFAdd, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupFMin", SpvOpGroupFMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupUMin", SpvOpGroupUMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupSMin", SpvOpGroupSMin, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupFMax", SpvOpGroupFMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupUMax", SpvOpGroupUMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupSMax", SpvOpGroupSMax, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReadPipe", SpvOpReadPipe, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WritePipe", SpvOpWritePipe, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReservedReadPipe", SpvOpReservedReadPipe, 1, pygen_variable_caps_Pipes, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReservedWritePipe", SpvOpReservedWritePipe, 1, pygen_variable_caps_Pipes, 8, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReserveReadPipePackets", SpvOpReserveReadPipePackets, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReserveWritePipePackets", SpvOpReserveWritePipePackets, 1, pygen_variable_caps_Pipes, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CommitReadPipe", SpvOpCommitReadPipe, 1, pygen_variable_caps_Pipes, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CommitWritePipe", SpvOpCommitWritePipe, 1, pygen_variable_caps_Pipes, 4, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IsValidReserveId", SpvOpIsValidReserveId, 1, pygen_variable_caps_Pipes, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetNumPipePackets", SpvOpGetNumPipePackets, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetMaxPipePackets", SpvOpGetMaxPipePackets, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupReserveReadPipePackets", SpvOpGroupReserveReadPipePackets, 1, pygen_variable_caps_Pipes, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupReserveWritePipePackets", SpvOpGroupReserveWritePipePackets, 1, pygen_variable_caps_Pipes, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupCommitReadPipe", SpvOpGroupCommitReadPipe, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GroupCommitWritePipe", SpvOpGroupCommitWritePipe, 1, pygen_variable_caps_Pipes, 5, {SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EnqueueMarker", SpvOpEnqueueMarker, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EnqueueKernel", SpvOpEnqueueKernel, 1, pygen_variable_caps_DeviceEnqueue, 13, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetKernelNDrangeSubGroupCount", SpvOpGetKernelNDrangeSubGroupCount, 1, pygen_variable_caps_DeviceEnqueue, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetKernelNDrangeMaxSubGroupSize", SpvOpGetKernelNDrangeMaxSubGroupSize, 1, pygen_variable_caps_DeviceEnqueue, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetKernelWorkGroupSize", SpvOpGetKernelWorkGroupSize, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetKernelPreferredWorkGroupSizeMultiple", SpvOpGetKernelPreferredWorkGroupSizeMultiple, 1, pygen_variable_caps_DeviceEnqueue, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RetainEvent", SpvOpRetainEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReleaseEvent", SpvOpReleaseEvent, 1, pygen_variable_caps_DeviceEnqueue, 1, {SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CreateUserEvent", SpvOpCreateUserEvent, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"IsValidEvent", SpvOpIsValidEvent, 1, pygen_variable_caps_DeviceEnqueue, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SetUserEventStatus", SpvOpSetUserEventStatus, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CaptureEventProfilingInfo", SpvOpCaptureEventProfilingInfo, 1, pygen_variable_caps_DeviceEnqueue, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GetDefaultQueue", SpvOpGetDefaultQueue, 1, pygen_variable_caps_DeviceEnqueue, 2, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BuildNDRange", SpvOpBuildNDRange, 1, pygen_variable_caps_DeviceEnqueue, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseSampleImplicitLod", SpvOpImageSparseSampleImplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseSampleExplicitLod", SpvOpImageSparseSampleExplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseSampleDrefImplicitLod", SpvOpImageSparseSampleDrefImplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseSampleDrefExplicitLod", SpvOpImageSparseSampleDrefExplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseSampleProjImplicitLod", SpvOpImageSparseSampleProjImplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu}, + {"ImageSparseSampleProjExplicitLod", SpvOpImageSparseSampleProjExplicitLod, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu}, + {"ImageSparseSampleProjDrefImplicitLod", SpvOpImageSparseSampleProjDrefImplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu}, + {"ImageSparseSampleProjDrefExplicitLod", SpvOpImageSparseSampleProjDrefExplicitLod, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_IMAGE}, 1, 1, 0, nullptr, 0xffffffffu}, + {"ImageSparseFetch", SpvOpImageSparseFetch, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseGather", SpvOpImageSparseGather, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseDrefGather", SpvOpImageSparseDrefGather, 1, pygen_variable_caps_SparseResidency, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseTexelsResident", SpvOpImageSparseTexelsResident, 1, pygen_variable_caps_SparseResidency, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoLine", SpvOpNoLine, 0, nullptr, 0, {}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicFlagTestAndSet", SpvOpAtomicFlagTestAndSet, 1, pygen_variable_caps_Kernel, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicFlagClear", SpvOpAtomicFlagClear, 1, pygen_variable_caps_Kernel, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageSparseRead", SpvOpImageSparseRead, 1, pygen_variable_caps_SparseResidency, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_IMAGE}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SizeOf", SpvOpSizeOf, 1, pygen_variable_caps_Addresses, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"TypePipeStorage", SpvOpTypePipeStorage, 1, pygen_variable_caps_PipeStorage, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"ConstantPipeStorage", SpvOpConstantPipeStorage, 1, pygen_variable_caps_PipeStorage, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"CreatePipeFromPipeStorage", SpvOpCreatePipeFromPipeStorage, 1, pygen_variable_caps_PipeStorage, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"GetKernelLocalSizeForSubgroupCount", SpvOpGetKernelLocalSizeForSubgroupCount, 1, pygen_variable_caps_SubgroupDispatch, 7, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"GetKernelMaxNumSubgroups", SpvOpGetKernelMaxNumSubgroups, 1, pygen_variable_caps_SubgroupDispatch, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"TypeNamedBarrier", SpvOpTypeNamedBarrier, 1, pygen_variable_caps_NamedBarrier, 1, {SPV_OPERAND_TYPE_RESULT_ID}, 1, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"NamedBarrierInitialize", SpvOpNamedBarrierInitialize, 1, pygen_variable_caps_NamedBarrier, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"MemoryNamedBarrier", SpvOpMemoryNamedBarrier, 1, pygen_variable_caps_NamedBarrier, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"ModuleProcessed", SpvOpModuleProcessed, 0, nullptr, 1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,1)}, + {"ExecutionModeId", SpvOpExecutionModeId, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_EXECUTION_MODE}, 0, 0, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,2)}, + {"DecorateId", SpvOpDecorateId, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 1, pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1, SPV_SPIRV_VERSION_WORD(1,2)}, + {"GroupNonUniformElect", SpvOpGroupNonUniformElect, 1, pygen_variable_caps_GroupNonUniform, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformAll", SpvOpGroupNonUniformAll, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformAny", SpvOpGroupNonUniformAny, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformAllEqual", SpvOpGroupNonUniformAllEqual, 1, pygen_variable_caps_GroupNonUniformVote, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBroadcast", SpvOpGroupNonUniformBroadcast, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBroadcastFirst", SpvOpGroupNonUniformBroadcastFirst, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBallot", SpvOpGroupNonUniformBallot, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformInverseBallot", SpvOpGroupNonUniformInverseBallot, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBallotBitExtract", SpvOpGroupNonUniformBallotBitExtract, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBallotBitCount", SpvOpGroupNonUniformBallotBitCount, 1, pygen_variable_caps_GroupNonUniformBallot, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBallotFindLSB", SpvOpGroupNonUniformBallotFindLSB, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBallotFindMSB", SpvOpGroupNonUniformBallotFindMSB, 1, pygen_variable_caps_GroupNonUniformBallot, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformShuffle", SpvOpGroupNonUniformShuffle, 1, pygen_variable_caps_GroupNonUniformShuffle, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformShuffleXor", SpvOpGroupNonUniformShuffleXor, 1, pygen_variable_caps_GroupNonUniformShuffle, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformShuffleUp", SpvOpGroupNonUniformShuffleUp, 1, pygen_variable_caps_GroupNonUniformShuffleRelative, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformShuffleDown", SpvOpGroupNonUniformShuffleDown, 1, pygen_variable_caps_GroupNonUniformShuffleRelative, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformIAdd", SpvOpGroupNonUniformIAdd, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformFAdd", SpvOpGroupNonUniformFAdd, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformIMul", SpvOpGroupNonUniformIMul, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformFMul", SpvOpGroupNonUniformFMul, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformSMin", SpvOpGroupNonUniformSMin, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformUMin", SpvOpGroupNonUniformUMin, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformFMin", SpvOpGroupNonUniformFMin, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformSMax", SpvOpGroupNonUniformSMax, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformUMax", SpvOpGroupNonUniformUMax, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformFMax", SpvOpGroupNonUniformFMax, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBitwiseAnd", SpvOpGroupNonUniformBitwiseAnd, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBitwiseOr", SpvOpGroupNonUniformBitwiseOr, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBitwiseXor", SpvOpGroupNonUniformBitwiseXor, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformLogicalAnd", SpvOpGroupNonUniformLogicalAnd, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformLogicalOr", SpvOpGroupNonUniformLogicalOr, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformLogicalXor", SpvOpGroupNonUniformLogicalXor, 2, pygen_variable_caps_GroupNonUniformArithmeticGroupNonUniformClustered, 6, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformQuadBroadcast", SpvOpGroupNonUniformQuadBroadcast, 1, pygen_variable_caps_GroupNonUniformQuad, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformQuadSwap", SpvOpGroupNonUniformQuadSwap, 1, pygen_variable_caps_GroupNonUniformQuad, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupBallotKHR", SpvOpSubgroupBallotKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu}, + {"SubgroupFirstInvocationKHR", SpvOpSubgroupFirstInvocationKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu}, + {"SubgroupAllKHR", SpvOpSubgroupAllKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu}, + {"SubgroupAnyKHR", SpvOpSubgroupAnyKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu}, + {"SubgroupAllEqualKHR", SpvOpSubgroupAllEqualKHR, 1, pygen_variable_caps_SubgroupVoteKHR, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, 0xffffffffu}, + {"SubgroupReadInvocationKHR", SpvOpSubgroupReadInvocationKHR, 1, pygen_variable_caps_SubgroupBallotKHR, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_KHR_shader_ballot, 0xffffffffu}, + {"GroupIAddNonUniformAMD", SpvOpGroupIAddNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupFAddNonUniformAMD", SpvOpGroupFAddNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupFMinNonUniformAMD", SpvOpGroupFMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupUMinNonUniformAMD", SpvOpGroupUMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupSMinNonUniformAMD", SpvOpGroupSMinNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupFMaxNonUniformAMD", SpvOpGroupFMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupUMaxNonUniformAMD", SpvOpGroupUMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"GroupSMaxNonUniformAMD", SpvOpGroupSMaxNonUniformAMD, 1, pygen_variable_caps_Groups, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_SCOPE_ID, SPV_OPERAND_TYPE_GROUP_OPERATION, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_ballot, 0xffffffffu}, + {"FragmentMaskFetchAMD", SpvOpFragmentMaskFetchAMD, 1, pygen_variable_caps_FragmentMaskAMD, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, 0xffffffffu}, + {"FragmentFetchAMD", SpvOpFragmentFetchAMD, 1, pygen_variable_caps_FragmentMaskAMD, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, 0xffffffffu}, + {"GroupNonUniformPartitionNV", SpvOpGroupNonUniformPartitionNV, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, 0xffffffffu}, + {"SubgroupShuffleINTEL", SpvOpSubgroupShuffleINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu}, + {"SubgroupShuffleDownINTEL", SpvOpSubgroupShuffleDownINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu}, + {"SubgroupShuffleUpINTEL", SpvOpSubgroupShuffleUpINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 5, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu}, + {"SubgroupShuffleXorINTEL", SpvOpSubgroupShuffleXorINTEL, 1, pygen_variable_caps_SubgroupShuffleINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu}, + {"SubgroupBlockReadINTEL", SpvOpSubgroupBlockReadINTEL, 1, pygen_variable_caps_SubgroupBufferBlockIOINTEL, 3, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu}, + {"SubgroupBlockWriteINTEL", SpvOpSubgroupBlockWriteINTEL, 1, pygen_variable_caps_SubgroupBufferBlockIOINTEL, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu}, + {"SubgroupImageBlockReadINTEL", SpvOpSubgroupImageBlockReadINTEL, 1, pygen_variable_caps_SubgroupImageBlockIOINTEL, 4, {SPV_OPERAND_TYPE_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 1, 1, 0, nullptr, 0xffffffffu}, + {"SubgroupImageBlockWriteINTEL", SpvOpSubgroupImageBlockWriteINTEL, 1, pygen_variable_caps_SubgroupImageBlockIOINTEL, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, 0, 0, 0, nullptr, 0xffffffffu}, + {"DecorateStringGOOGLE", SpvOpDecorateStringGOOGLE, 0, nullptr, 2, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, 0xffffffffu}, + {"MemberDecorateStringGOOGLE", SpvOpMemberDecorateStringGOOGLE, 0, nullptr, 3, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_DECORATION}, 0, 0, 2, pygen_variable_exts_SPV_GOOGLE_decorate_stringSPV_GOOGLE_hlsl_functionality1, 0xffffffffu} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/debuginfo.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/debuginfo.insts.inc new file mode 100644 index 00000000000..e28cc97d2fd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/debuginfo.insts.inc @@ -0,0 +1,38 @@ + + +static const spv_ext_inst_desc_t debuginfo_entries[] = { + {"DebugInfoNone", 0, 0, nullptr, {SPV_OPERAND_TYPE_NONE}}, + {"DebugCompilationUnit", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeBasic", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypePointer", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeQualifier", 4, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeArray", 5, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeVector", 6, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypedef", 7, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeFunction", 8, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeEnum", 9, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeComposite", 10, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeMember", 11, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeInheritance", 12, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypePtrToMember", 13, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeTemplate", 14, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeTemplateParameter", 15, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeTemplateTemplateParameter", 16, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"DebugTypeTemplateParameterPack", 17, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugGlobalVariable", 18, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugFunctionDeclaration", 19, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_NONE}}, + {"DebugFunction", 20, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugLexicalBlock", 21, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugLexicalBlockDiscriminator", 22, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugScope", 23, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugNoScope", 24, 0, nullptr, {SPV_OPERAND_TYPE_NONE}}, + {"DebugInlinedAt", 25, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugLocalVariable", 26, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"DebugInlinedVariable", 27, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugDeclare", 28, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugValue", 29, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugOperation", 30, 0, nullptr, {SPV_OPERAND_TYPE_DEBUG_OPERATION, SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"DebugExpression", 31, 0, nullptr, {SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugMacroDef", 32, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_OPTIONAL_ID, SPV_OPERAND_TYPE_NONE}}, + {"DebugMacroUndef", 33, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc new file mode 100644 index 00000000000..964b142d94d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/enum_string_mapping.inc @@ -0,0 +1,325 @@ +const char* ExtensionToString(Extension extension) { + switch (extension) { + case Extension::kSPV_AMD_gcn_shader: + return "SPV_AMD_gcn_shader"; + case Extension::kSPV_AMD_gpu_shader_half_float: + return "SPV_AMD_gpu_shader_half_float"; + case Extension::kSPV_AMD_gpu_shader_half_float_fetch: + return "SPV_AMD_gpu_shader_half_float_fetch"; + case Extension::kSPV_AMD_gpu_shader_int16: + return "SPV_AMD_gpu_shader_int16"; + case Extension::kSPV_AMD_shader_ballot: + return "SPV_AMD_shader_ballot"; + case Extension::kSPV_AMD_shader_explicit_vertex_parameter: + return "SPV_AMD_shader_explicit_vertex_parameter"; + case Extension::kSPV_AMD_shader_fragment_mask: + return "SPV_AMD_shader_fragment_mask"; + case Extension::kSPV_AMD_shader_image_load_store_lod: + return "SPV_AMD_shader_image_load_store_lod"; + case Extension::kSPV_AMD_shader_trinary_minmax: + return "SPV_AMD_shader_trinary_minmax"; + case Extension::kSPV_AMD_texture_gather_bias_lod: + return "SPV_AMD_texture_gather_bias_lod"; + case Extension::kSPV_EXT_descriptor_indexing: + return "SPV_EXT_descriptor_indexing"; + case Extension::kSPV_EXT_fragment_fully_covered: + return "SPV_EXT_fragment_fully_covered"; + case Extension::kSPV_EXT_shader_stencil_export: + return "SPV_EXT_shader_stencil_export"; + case Extension::kSPV_EXT_shader_viewport_index_layer: + return "SPV_EXT_shader_viewport_index_layer"; + case Extension::kSPV_GOOGLE_decorate_string: + return "SPV_GOOGLE_decorate_string"; + case Extension::kSPV_GOOGLE_hlsl_functionality1: + return "SPV_GOOGLE_hlsl_functionality1"; + case Extension::kSPV_INTEL_subgroups: + return "SPV_INTEL_subgroups"; + case Extension::kSPV_KHR_16bit_storage: + return "SPV_KHR_16bit_storage"; + case Extension::kSPV_KHR_8bit_storage: + return "SPV_KHR_8bit_storage"; + case Extension::kSPV_KHR_device_group: + return "SPV_KHR_device_group"; + case Extension::kSPV_KHR_multiview: + return "SPV_KHR_multiview"; + case Extension::kSPV_KHR_post_depth_coverage: + return "SPV_KHR_post_depth_coverage"; + case Extension::kSPV_KHR_shader_atomic_counter_ops: + return "SPV_KHR_shader_atomic_counter_ops"; + case Extension::kSPV_KHR_shader_ballot: + return "SPV_KHR_shader_ballot"; + case Extension::kSPV_KHR_shader_draw_parameters: + return "SPV_KHR_shader_draw_parameters"; + case Extension::kSPV_KHR_storage_buffer_storage_class: + return "SPV_KHR_storage_buffer_storage_class"; + case Extension::kSPV_KHR_subgroup_vote: + return "SPV_KHR_subgroup_vote"; + case Extension::kSPV_KHR_variable_pointers: + return "SPV_KHR_variable_pointers"; + case Extension::kSPV_NVX_multiview_per_view_attributes: + return "SPV_NVX_multiview_per_view_attributes"; + case Extension::kSPV_NV_geometry_shader_passthrough: + return "SPV_NV_geometry_shader_passthrough"; + case Extension::kSPV_NV_sample_mask_override_coverage: + return "SPV_NV_sample_mask_override_coverage"; + case Extension::kSPV_NV_shader_subgroup_partitioned: + return "SPV_NV_shader_subgroup_partitioned"; + case Extension::kSPV_NV_stereo_view_rendering: + return "SPV_NV_stereo_view_rendering"; + case Extension::kSPV_NV_viewport_array2: + return "SPV_NV_viewport_array2"; + case Extension::kSPV_VALIDATOR_ignore_type_decl_unique: + return "SPV_VALIDATOR_ignore_type_decl_unique"; + }; + + return ""; +} + + + bool GetExtensionFromString(const char* str, Extension* extension) { + static const char* known_ext_strs[] = { "SPV_AMD_gcn_shader", "SPV_AMD_gpu_shader_half_float", "SPV_AMD_gpu_shader_half_float_fetch", "SPV_AMD_gpu_shader_int16", "SPV_AMD_shader_ballot", "SPV_AMD_shader_explicit_vertex_parameter", "SPV_AMD_shader_fragment_mask", "SPV_AMD_shader_image_load_store_lod", "SPV_AMD_shader_trinary_minmax", "SPV_AMD_texture_gather_bias_lod", "SPV_EXT_descriptor_indexing", "SPV_EXT_fragment_fully_covered", "SPV_EXT_shader_stencil_export", "SPV_EXT_shader_viewport_index_layer", "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1", "SPV_INTEL_subgroups", "SPV_KHR_16bit_storage", "SPV_KHR_8bit_storage", "SPV_KHR_device_group", "SPV_KHR_multiview", "SPV_KHR_post_depth_coverage", "SPV_KHR_shader_atomic_counter_ops", "SPV_KHR_shader_ballot", "SPV_KHR_shader_draw_parameters", "SPV_KHR_storage_buffer_storage_class", "SPV_KHR_subgroup_vote", "SPV_KHR_variable_pointers", "SPV_NVX_multiview_per_view_attributes", "SPV_NV_geometry_shader_passthrough", "SPV_NV_sample_mask_override_coverage", "SPV_NV_shader_subgroup_partitioned", "SPV_NV_stereo_view_rendering", "SPV_NV_viewport_array2", "SPV_VALIDATOR_ignore_type_decl_unique" }; + static const Extension known_ext_ids[] = { Extension::kSPV_AMD_gcn_shader, Extension::kSPV_AMD_gpu_shader_half_float, Extension::kSPV_AMD_gpu_shader_half_float_fetch, Extension::kSPV_AMD_gpu_shader_int16, Extension::kSPV_AMD_shader_ballot, Extension::kSPV_AMD_shader_explicit_vertex_parameter, Extension::kSPV_AMD_shader_fragment_mask, Extension::kSPV_AMD_shader_image_load_store_lod, Extension::kSPV_AMD_shader_trinary_minmax, Extension::kSPV_AMD_texture_gather_bias_lod, Extension::kSPV_EXT_descriptor_indexing, Extension::kSPV_EXT_fragment_fully_covered, Extension::kSPV_EXT_shader_stencil_export, Extension::kSPV_EXT_shader_viewport_index_layer, Extension::kSPV_GOOGLE_decorate_string, Extension::kSPV_GOOGLE_hlsl_functionality1, Extension::kSPV_INTEL_subgroups, Extension::kSPV_KHR_16bit_storage, Extension::kSPV_KHR_8bit_storage, Extension::kSPV_KHR_device_group, Extension::kSPV_KHR_multiview, Extension::kSPV_KHR_post_depth_coverage, Extension::kSPV_KHR_shader_atomic_counter_ops, Extension::kSPV_KHR_shader_ballot, Extension::kSPV_KHR_shader_draw_parameters, Extension::kSPV_KHR_storage_buffer_storage_class, Extension::kSPV_KHR_subgroup_vote, Extension::kSPV_KHR_variable_pointers, Extension::kSPV_NVX_multiview_per_view_attributes, Extension::kSPV_NV_geometry_shader_passthrough, Extension::kSPV_NV_sample_mask_override_coverage, Extension::kSPV_NV_shader_subgroup_partitioned, Extension::kSPV_NV_stereo_view_rendering, Extension::kSPV_NV_viewport_array2, Extension::kSPV_VALIDATOR_ignore_type_decl_unique }; + const auto b = std::begin(known_ext_strs); + const auto e = std::end(known_ext_strs); + const auto found = std::equal_range( + b, e, str, [](const char* str1, const char* str2) { + return std::strcmp(str1, str2) < 0; + }); + if (found.first == e || found.first == found.second) return false; + + *extension = known_ext_ids[found.first - b]; + return true; + } + + +const char* CapabilityToString(SpvCapability capability) { + switch (capability) { + case SpvCapabilityMatrix: + return "Matrix"; + case SpvCapabilityShader: + return "Shader"; + case SpvCapabilityGeometry: + return "Geometry"; + case SpvCapabilityTessellation: + return "Tessellation"; + case SpvCapabilityAddresses: + return "Addresses"; + case SpvCapabilityLinkage: + return "Linkage"; + case SpvCapabilityKernel: + return "Kernel"; + case SpvCapabilityVector16: + return "Vector16"; + case SpvCapabilityFloat16Buffer: + return "Float16Buffer"; + case SpvCapabilityFloat16: + return "Float16"; + case SpvCapabilityFloat64: + return "Float64"; + case SpvCapabilityInt64: + return "Int64"; + case SpvCapabilityInt64Atomics: + return "Int64Atomics"; + case SpvCapabilityImageBasic: + return "ImageBasic"; + case SpvCapabilityImageReadWrite: + return "ImageReadWrite"; + case SpvCapabilityImageMipmap: + return "ImageMipmap"; + case SpvCapabilityPipes: + return "Pipes"; + case SpvCapabilityGroups: + return "Groups"; + case SpvCapabilityDeviceEnqueue: + return "DeviceEnqueue"; + case SpvCapabilityLiteralSampler: + return "LiteralSampler"; + case SpvCapabilityAtomicStorage: + return "AtomicStorage"; + case SpvCapabilityInt16: + return "Int16"; + case SpvCapabilityTessellationPointSize: + return "TessellationPointSize"; + case SpvCapabilityGeometryPointSize: + return "GeometryPointSize"; + case SpvCapabilityImageGatherExtended: + return "ImageGatherExtended"; + case SpvCapabilityStorageImageMultisample: + return "StorageImageMultisample"; + case SpvCapabilityUniformBufferArrayDynamicIndexing: + return "UniformBufferArrayDynamicIndexing"; + case SpvCapabilitySampledImageArrayDynamicIndexing: + return "SampledImageArrayDynamicIndexing"; + case SpvCapabilityStorageBufferArrayDynamicIndexing: + return "StorageBufferArrayDynamicIndexing"; + case SpvCapabilityStorageImageArrayDynamicIndexing: + return "StorageImageArrayDynamicIndexing"; + case SpvCapabilityClipDistance: + return "ClipDistance"; + case SpvCapabilityCullDistance: + return "CullDistance"; + case SpvCapabilityImageCubeArray: + return "ImageCubeArray"; + case SpvCapabilitySampleRateShading: + return "SampleRateShading"; + case SpvCapabilityImageRect: + return "ImageRect"; + case SpvCapabilitySampledRect: + return "SampledRect"; + case SpvCapabilityGenericPointer: + return "GenericPointer"; + case SpvCapabilityInt8: + return "Int8"; + case SpvCapabilityInputAttachment: + return "InputAttachment"; + case SpvCapabilitySparseResidency: + return "SparseResidency"; + case SpvCapabilityMinLod: + return "MinLod"; + case SpvCapabilitySampled1D: + return "Sampled1D"; + case SpvCapabilityImage1D: + return "Image1D"; + case SpvCapabilitySampledCubeArray: + return "SampledCubeArray"; + case SpvCapabilitySampledBuffer: + return "SampledBuffer"; + case SpvCapabilityImageBuffer: + return "ImageBuffer"; + case SpvCapabilityImageMSArray: + return "ImageMSArray"; + case SpvCapabilityStorageImageExtendedFormats: + return "StorageImageExtendedFormats"; + case SpvCapabilityImageQuery: + return "ImageQuery"; + case SpvCapabilityDerivativeControl: + return "DerivativeControl"; + case SpvCapabilityInterpolationFunction: + return "InterpolationFunction"; + case SpvCapabilityTransformFeedback: + return "TransformFeedback"; + case SpvCapabilityGeometryStreams: + return "GeometryStreams"; + case SpvCapabilityStorageImageReadWithoutFormat: + return "StorageImageReadWithoutFormat"; + case SpvCapabilityStorageImageWriteWithoutFormat: + return "StorageImageWriteWithoutFormat"; + case SpvCapabilityMultiViewport: + return "MultiViewport"; + case SpvCapabilitySubgroupDispatch: + return "SubgroupDispatch"; + case SpvCapabilityNamedBarrier: + return "NamedBarrier"; + case SpvCapabilityPipeStorage: + return "PipeStorage"; + case SpvCapabilityGroupNonUniform: + return "GroupNonUniform"; + case SpvCapabilityGroupNonUniformVote: + return "GroupNonUniformVote"; + case SpvCapabilityGroupNonUniformArithmetic: + return "GroupNonUniformArithmetic"; + case SpvCapabilityGroupNonUniformBallot: + return "GroupNonUniformBallot"; + case SpvCapabilityGroupNonUniformShuffle: + return "GroupNonUniformShuffle"; + case SpvCapabilityGroupNonUniformShuffleRelative: + return "GroupNonUniformShuffleRelative"; + case SpvCapabilityGroupNonUniformClustered: + return "GroupNonUniformClustered"; + case SpvCapabilityGroupNonUniformQuad: + return "GroupNonUniformQuad"; + case SpvCapabilitySubgroupBallotKHR: + return "SubgroupBallotKHR"; + case SpvCapabilityDrawParameters: + return "DrawParameters"; + case SpvCapabilitySubgroupVoteKHR: + return "SubgroupVoteKHR"; + case SpvCapabilityStorageBuffer16BitAccess: + return "StorageBuffer16BitAccess"; + case SpvCapabilityUniformAndStorageBuffer16BitAccess: + return "UniformAndStorageBuffer16BitAccess"; + case SpvCapabilityStoragePushConstant16: + return "StoragePushConstant16"; + case SpvCapabilityStorageInputOutput16: + return "StorageInputOutput16"; + case SpvCapabilityDeviceGroup: + return "DeviceGroup"; + case SpvCapabilityMultiView: + return "MultiView"; + case SpvCapabilityVariablePointersStorageBuffer: + return "VariablePointersStorageBuffer"; + case SpvCapabilityVariablePointers: + return "VariablePointers"; + case SpvCapabilityAtomicStorageOps: + return "AtomicStorageOps"; + case SpvCapabilitySampleMaskPostDepthCoverage: + return "SampleMaskPostDepthCoverage"; + case SpvCapabilityStorageBuffer8BitAccess: + return "StorageBuffer8BitAccess"; + case SpvCapabilityUniformAndStorageBuffer8BitAccess: + return "UniformAndStorageBuffer8BitAccess"; + case SpvCapabilityStoragePushConstant8: + return "StoragePushConstant8"; + case SpvCapabilityFloat16ImageAMD: + return "Float16ImageAMD"; + case SpvCapabilityImageGatherBiasLodAMD: + return "ImageGatherBiasLodAMD"; + case SpvCapabilityFragmentMaskAMD: + return "FragmentMaskAMD"; + case SpvCapabilityStencilExportEXT: + return "StencilExportEXT"; + case SpvCapabilityImageReadWriteLodAMD: + return "ImageReadWriteLodAMD"; + case SpvCapabilitySampleMaskOverrideCoverageNV: + return "SampleMaskOverrideCoverageNV"; + case SpvCapabilityGeometryShaderPassthroughNV: + return "GeometryShaderPassthroughNV"; + case SpvCapabilityShaderViewportIndexLayerEXT: + return "ShaderViewportIndexLayerEXT"; + case SpvCapabilityShaderViewportMaskNV: + return "ShaderViewportMaskNV"; + case SpvCapabilityShaderStereoViewNV: + return "ShaderStereoViewNV"; + case SpvCapabilityPerViewAttributesNV: + return "PerViewAttributesNV"; + case SpvCapabilityFragmentFullyCoveredEXT: + return "FragmentFullyCoveredEXT"; + case SpvCapabilityShaderNonUniformEXT: + return "ShaderNonUniformEXT"; + case SpvCapabilityRuntimeDescriptorArrayEXT: + return "RuntimeDescriptorArrayEXT"; + case SpvCapabilityInputAttachmentArrayDynamicIndexingEXT: + return "InputAttachmentArrayDynamicIndexingEXT"; + case SpvCapabilityUniformTexelBufferArrayDynamicIndexingEXT: + return "UniformTexelBufferArrayDynamicIndexingEXT"; + case SpvCapabilityStorageTexelBufferArrayDynamicIndexingEXT: + return "StorageTexelBufferArrayDynamicIndexingEXT"; + case SpvCapabilityUniformBufferArrayNonUniformIndexingEXT: + return "UniformBufferArrayNonUniformIndexingEXT"; + case SpvCapabilitySampledImageArrayNonUniformIndexingEXT: + return "SampledImageArrayNonUniformIndexingEXT"; + case SpvCapabilityStorageBufferArrayNonUniformIndexingEXT: + return "StorageBufferArrayNonUniformIndexingEXT"; + case SpvCapabilityStorageImageArrayNonUniformIndexingEXT: + return "StorageImageArrayNonUniformIndexingEXT"; + case SpvCapabilityInputAttachmentArrayNonUniformIndexingEXT: + return "InputAttachmentArrayNonUniformIndexingEXT"; + case SpvCapabilityUniformTexelBufferArrayNonUniformIndexingEXT: + return "UniformTexelBufferArrayNonUniformIndexingEXT"; + case SpvCapabilityStorageTexelBufferArrayNonUniformIndexingEXT: + return "StorageTexelBufferArrayNonUniformIndexingEXT"; + case SpvCapabilitySubgroupShuffleINTEL: + return "SubgroupShuffleINTEL"; + case SpvCapabilitySubgroupBufferBlockIOINTEL: + return "SubgroupBufferBlockIOINTEL"; + case SpvCapabilitySubgroupImageBlockIOINTEL: + return "SubgroupImageBlockIOINTEL"; + case SpvCapabilityGroupNonUniformPartitionedNV: + return "GroupNonUniformPartitionedNV"; + case SpvCapabilityMax: + assert(0 && "Attempting to convert SpvCapabilityMax to string"); + return ""; + }; + + return ""; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc new file mode 100644 index 00000000000..c1cf94a7b89 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/extension_enum.inc @@ -0,0 +1,35 @@ +kSPV_AMD_gcn_shader, +kSPV_AMD_gpu_shader_half_float, +kSPV_AMD_gpu_shader_half_float_fetch, +kSPV_AMD_gpu_shader_int16, +kSPV_AMD_shader_ballot, +kSPV_AMD_shader_explicit_vertex_parameter, +kSPV_AMD_shader_fragment_mask, +kSPV_AMD_shader_image_load_store_lod, +kSPV_AMD_shader_trinary_minmax, +kSPV_AMD_texture_gather_bias_lod, +kSPV_EXT_descriptor_indexing, +kSPV_EXT_fragment_fully_covered, +kSPV_EXT_shader_stencil_export, +kSPV_EXT_shader_viewport_index_layer, +kSPV_GOOGLE_decorate_string, +kSPV_GOOGLE_hlsl_functionality1, +kSPV_INTEL_subgroups, +kSPV_KHR_16bit_storage, +kSPV_KHR_8bit_storage, +kSPV_KHR_device_group, +kSPV_KHR_multiview, +kSPV_KHR_post_depth_coverage, +kSPV_KHR_shader_atomic_counter_ops, +kSPV_KHR_shader_ballot, +kSPV_KHR_shader_draw_parameters, +kSPV_KHR_storage_buffer_storage_class, +kSPV_KHR_subgroup_vote, +kSPV_KHR_variable_pointers, +kSPV_NVX_multiview_per_view_attributes, +kSPV_NV_geometry_shader_passthrough, +kSPV_NV_sample_mask_override_coverage, +kSPV_NV_shader_subgroup_partitioned, +kSPV_NV_stereo_view_rendering, +kSPV_NV_viewport_array2, +kSPV_VALIDATOR_ignore_type_decl_unique diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/generators.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/generators.inc new file mode 100644 index 00000000000..39709d3aac0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/generators.inc @@ -0,0 +1,20 @@ +{0, "Khronos", "", "Khronos"}, +{1, "LunarG", "", "LunarG"}, +{2, "Valve", "", "Valve"}, +{3, "Codeplay", "", "Codeplay"}, +{4, "NVIDIA", "", "NVIDIA"}, +{5, "ARM", "", "ARM"}, +{6, "Khronos", "LLVM/SPIR-V Translator", "Khronos LLVM/SPIR-V Translator"}, +{7, "Khronos", "SPIR-V Tools Assembler", "Khronos SPIR-V Tools Assembler"}, +{8, "Khronos", "Glslang Reference Front End", "Khronos Glslang Reference Front End"}, +{9, "Qualcomm", "", "Qualcomm"}, +{10, "AMD", "", "AMD"}, +{11, "Intel", "", "Intel"}, +{12, "Imagination", "", "Imagination"}, +{13, "Google", "Shaderc over Glslang", "Google Shaderc over Glslang"}, +{14, "Google", "spiregg", "Google spiregg"}, +{15, "Google", "rspirv", "Google rspirv"}, +{16, "X-LEGEND", "Mesa-IR/SPIR-V Translator", "X-LEGEND Mesa-IR/SPIR-V Translator"}, +{17, "Khronos", "SPIR-V Tools Linker", "Khronos SPIR-V Tools Linker"}, +{18, "Wine", "VKD3D Shader Compiler", "Wine VKD3D Shader Compiler"}, +{19, "Clay", "Clay Shader Compiler", "Clay Clay Shader Compiler"}, diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc new file mode 100644 index 00000000000..6bb2e76624d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/glsl.std.450.insts.inc @@ -0,0 +1,86 @@ +static const SpvCapability pygen_variable_caps_Float64[] = {SpvCapabilityFloat64}; +static const SpvCapability pygen_variable_caps_InterpolationFunction[] = {SpvCapabilityInterpolationFunction}; + +static const spv_ext_inst_desc_t glsl_entries[] = { + {"Round", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"RoundEven", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Trunc", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FAbs", 4, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SAbs", 5, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FSign", 6, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SSign", 7, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Floor", 8, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Ceil", 9, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Fract", 10, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Radians", 11, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Degrees", 12, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Sin", 13, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Cos", 14, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Tan", 15, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Asin", 16, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Acos", 17, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Atan", 18, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Sinh", 19, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Cosh", 20, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Tanh", 21, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Asinh", 22, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Acosh", 23, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Atanh", 24, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Atan2", 25, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Pow", 26, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Exp", 27, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Log", 28, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Exp2", 29, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Log2", 30, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Sqrt", 31, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"InverseSqrt", 32, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Determinant", 33, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"MatrixInverse", 34, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Modf", 35, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ModfStruct", 36, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FMin", 37, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UMin", 38, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SMin", 39, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FMax", 40, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UMax", 41, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SMax", 42, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FClamp", 43, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UClamp", 44, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SClamp", 45, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FMix", 46, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"IMix", 47, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Step", 48, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SmoothStep", 49, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Fma", 50, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Frexp", 51, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FrexpStruct", 52, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Ldexp", 53, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PackSnorm4x8", 54, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PackUnorm4x8", 55, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PackSnorm2x16", 56, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PackUnorm2x16", 57, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PackHalf2x16", 58, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"PackDouble2x32", 59, 1, pygen_variable_caps_Float64, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UnpackSnorm2x16", 60, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UnpackUnorm2x16", 61, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UnpackHalf2x16", 62, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UnpackSnorm4x8", 63, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UnpackUnorm4x8", 64, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UnpackDouble2x32", 65, 1, pygen_variable_caps_Float64, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Length", 66, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Distance", 67, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Cross", 68, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Normalize", 69, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FaceForward", 70, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Reflect", 71, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"Refract", 72, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FindILsb", 73, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FindSMsb", 74, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FindUMsb", 75, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"InterpolateAtCentroid", 76, 1, pygen_variable_caps_InterpolationFunction, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"InterpolateAtSample", 77, 1, pygen_variable_caps_InterpolationFunction, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"InterpolateAtOffset", 78, 1, pygen_variable_caps_InterpolationFunction, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"NMin", 79, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"NMax", 80, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"NClamp", 81, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/opencl.std.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/opencl.std.insts.inc new file mode 100644 index 00000000000..abc76efc389 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/opencl.std.insts.inc @@ -0,0 +1,166 @@ + + +static const spv_ext_inst_desc_t opencl_entries[] = { + {"acos", 0, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"acosh", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"acospi", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"asin", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"asinh", 4, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"asinpi", 5, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"atan", 6, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"atan2", 7, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"atanh", 8, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"atanpi", 9, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"atan2pi", 10, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"cbrt", 11, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ceil", 12, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"copysign", 13, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"cos", 14, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"cosh", 15, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"cospi", 16, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"erfc", 17, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"erf", 18, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"exp", 19, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"exp2", 20, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"exp10", 21, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"expm1", 22, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fabs", 23, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fdim", 24, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"floor", 25, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fma", 26, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fmax", 27, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fmin", 28, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fmod", 29, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fract", 30, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"frexp", 31, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"hypot", 32, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ilogb", 33, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ldexp", 34, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"lgamma", 35, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"lgamma_r", 36, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"log", 37, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"log2", 38, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"log10", 39, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"log1p", 40, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"logb", 41, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"mad", 42, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"maxmag", 43, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"minmag", 44, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"modf", 45, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"nan", 46, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"nextafter", 47, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"pow", 48, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"pown", 49, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"powr", 50, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"remainder", 51, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"remquo", 52, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"rint", 53, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"rootn", 54, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"round", 55, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"rsqrt", 56, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"sin", 57, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"sincos", 58, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"sinh", 59, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"sinpi", 60, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"sqrt", 61, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"tan", 62, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"tanh", 63, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"tanpi", 64, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"tgamma", 65, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"trunc", 66, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_cos", 67, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_divide", 68, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_exp", 69, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_exp2", 70, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_exp10", 71, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_log", 72, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_log2", 73, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_log10", 74, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_powr", 75, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_recip", 76, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_rsqrt", 77, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_sin", 78, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_sqrt", 79, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"half_tan", 80, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_cos", 81, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_divide", 82, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_exp", 83, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_exp2", 84, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_exp10", 85, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_log", 86, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_log2", 87, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_log10", 88, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_powr", 89, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_recip", 90, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_rsqrt", 91, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_sin", 92, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_sqrt", 93, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"native_tan", 94, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fclamp", 95, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"degrees", 96, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fmax_common", 97, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fmin_common", 98, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"mix", 99, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"radians", 100, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"step", 101, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"smoothstep", 102, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"sign", 103, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"cross", 104, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"distance", 105, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"length", 106, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"normalize", 107, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fast_distance", 108, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fast_length", 109, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"fast_normalize", 110, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_abs", 141, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_abs_diff", 142, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_add_sat", 143, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_add_sat", 144, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_hadd", 145, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_hadd", 146, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_rhadd", 147, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_rhadd", 148, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_clamp", 149, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_clamp", 150, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"clz", 151, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"ctz", 152, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_mad_hi", 153, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_mad_sat", 154, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_mad_sat", 155, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_max", 156, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_max", 157, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_min", 158, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_min", 159, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_mul_hi", 160, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"rotate", 161, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_sub_sat", 162, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_sub_sat", 163, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_upsample", 164, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_upsample", 165, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"popcount", 166, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_mad24", 167, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_mad24", 168, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"s_mul24", 169, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_mul24", 170, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"vloadn", 171, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"vstoren", 172, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"vload_half", 173, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"vload_halfn", 174, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"vstore_half", 175, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"vstore_half_r", 176, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}}, + {"vstore_halfn", 177, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"vstore_halfn_r", 178, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}}, + {"vloada_halfn", 179, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, + {"vstorea_halfn", 180, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"vstorea_halfn_r", 181, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}}, + {"shuffle", 182, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"shuffle2", 183, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"printf", 184, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_NONE}}, + {"prefetch", 185, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"bitselect", 186, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"select", 187, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_abs", 201, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_abs_diff", 202, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_mul_hi", 203, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"u_mad_hi", 204, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc new file mode 100644 index 00000000000..e40c74b213b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/operand.kinds-unified1.inc @@ -0,0 +1,749 @@ +static const SpvCapability pygen_variable_caps_Addresses[] = {SpvCapabilityAddresses}; +static const SpvCapability pygen_variable_caps_AtomicStorage[] = {SpvCapabilityAtomicStorage}; +static const SpvCapability pygen_variable_caps_ClipDistance[] = {SpvCapabilityClipDistance}; +static const SpvCapability pygen_variable_caps_CullDistance[] = {SpvCapabilityCullDistance}; +static const SpvCapability pygen_variable_caps_DeviceEnqueue[] = {SpvCapabilityDeviceEnqueue}; +static const SpvCapability pygen_variable_caps_DeviceGroup[] = {SpvCapabilityDeviceGroup}; +static const SpvCapability pygen_variable_caps_DrawParameters[] = {SpvCapabilityDrawParameters}; +static const SpvCapability pygen_variable_caps_FragmentFullyCoveredEXT[] = {SpvCapabilityFragmentFullyCoveredEXT}; +static const SpvCapability pygen_variable_caps_GenericPointer[] = {SpvCapabilityGenericPointer}; +static const SpvCapability pygen_variable_caps_Geometry[] = {SpvCapabilityGeometry}; +static const SpvCapability pygen_variable_caps_GeometryTessellation[] = {SpvCapabilityGeometry, SpvCapabilityTessellation}; +static const SpvCapability pygen_variable_caps_GeometryShaderPassthroughNV[] = {SpvCapabilityGeometryShaderPassthroughNV}; +static const SpvCapability pygen_variable_caps_GeometryStreams[] = {SpvCapabilityGeometryStreams}; +static const SpvCapability pygen_variable_caps_GroupNonUniform[] = {SpvCapabilityGroupNonUniform}; +static const SpvCapability pygen_variable_caps_GroupNonUniformClustered[] = {SpvCapabilityGroupNonUniformClustered}; +static const SpvCapability pygen_variable_caps_GroupNonUniformPartitionedNV[] = {SpvCapabilityGroupNonUniformPartitionedNV}; +static const SpvCapability pygen_variable_caps_ImageBasic[] = {SpvCapabilityImageBasic}; +static const SpvCapability pygen_variable_caps_ImageBuffer[] = {SpvCapabilityImageBuffer}; +static const SpvCapability pygen_variable_caps_ImageBufferShaderNonUniformEXT[] = {SpvCapabilityImageBuffer, SpvCapabilityShaderNonUniformEXT}; +static const SpvCapability pygen_variable_caps_ImageGatherExtended[] = {SpvCapabilityImageGatherExtended}; +static const SpvCapability pygen_variable_caps_InputAttachment[] = {SpvCapabilityInputAttachment}; +static const SpvCapability pygen_variable_caps_InputAttachmentShaderNonUniformEXT[] = {SpvCapabilityInputAttachment, SpvCapabilityShaderNonUniformEXT}; +static const SpvCapability pygen_variable_caps_Int64[] = {SpvCapabilityInt64}; +static const SpvCapability pygen_variable_caps_Kernel[] = {SpvCapabilityKernel}; +static const SpvCapability pygen_variable_caps_KernelGroupNonUniform[] = {SpvCapabilityKernel, SpvCapabilityGroupNonUniform}; +static const SpvCapability pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR[] = {SpvCapabilityKernel, SpvCapabilityGroupNonUniform, SpvCapabilitySubgroupBallotKHR}; +static const SpvCapability pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot[] = {SpvCapabilityKernel, SpvCapabilityGroupNonUniformArithmetic, SpvCapabilityGroupNonUniformBallot}; +static const SpvCapability pygen_variable_caps_Linkage[] = {SpvCapabilityLinkage}; +static const SpvCapability pygen_variable_caps_Matrix[] = {SpvCapabilityMatrix}; +static const SpvCapability pygen_variable_caps_MinLod[] = {SpvCapabilityMinLod}; +static const SpvCapability pygen_variable_caps_MultiView[] = {SpvCapabilityMultiView}; +static const SpvCapability pygen_variable_caps_MultiViewport[] = {SpvCapabilityMultiViewport}; +static const SpvCapability pygen_variable_caps_PerViewAttributesNV[] = {SpvCapabilityPerViewAttributesNV}; +static const SpvCapability pygen_variable_caps_Pipes[] = {SpvCapabilityPipes}; +static const SpvCapability pygen_variable_caps_SampleMaskOverrideCoverageNV[] = {SpvCapabilitySampleMaskOverrideCoverageNV}; +static const SpvCapability pygen_variable_caps_SampleMaskPostDepthCoverage[] = {SpvCapabilitySampleMaskPostDepthCoverage}; +static const SpvCapability pygen_variable_caps_SampleRateShading[] = {SpvCapabilitySampleRateShading}; +static const SpvCapability pygen_variable_caps_Sampled1D[] = {SpvCapabilitySampled1D}; +static const SpvCapability pygen_variable_caps_SampledBuffer[] = {SpvCapabilitySampledBuffer}; +static const SpvCapability pygen_variable_caps_SampledBufferShaderNonUniformEXT[] = {SpvCapabilitySampledBuffer, SpvCapabilityShaderNonUniformEXT}; +static const SpvCapability pygen_variable_caps_SampledCubeArray[] = {SpvCapabilitySampledCubeArray}; +static const SpvCapability pygen_variable_caps_SampledRect[] = {SpvCapabilitySampledRect}; +static const SpvCapability pygen_variable_caps_Shader[] = {SpvCapabilityShader}; +static const SpvCapability pygen_variable_caps_ShaderKernel[] = {SpvCapabilityShader, SpvCapabilityKernel}; +static const SpvCapability pygen_variable_caps_ShaderNonUniformEXT[] = {SpvCapabilityShaderNonUniformEXT}; +static const SpvCapability pygen_variable_caps_ShaderStereoViewNV[] = {SpvCapabilityShaderStereoViewNV}; +static const SpvCapability pygen_variable_caps_ShaderViewportIndexLayerNV[] = {SpvCapabilityShaderViewportIndexLayerNV}; +static const SpvCapability pygen_variable_caps_ShaderViewportMaskNV[] = {SpvCapabilityShaderViewportMaskNV}; +static const SpvCapability pygen_variable_caps_StencilExportEXT[] = {SpvCapabilityStencilExportEXT}; +static const SpvCapability pygen_variable_caps_StorageBuffer16BitAccessStorageUniformBufferBlock16[] = {SpvCapabilityStorageBuffer16BitAccess, SpvCapabilityStorageUniformBufferBlock16}; +static const SpvCapability pygen_variable_caps_StorageBuffer8BitAccess[] = {SpvCapabilityStorageBuffer8BitAccess}; +static const SpvCapability pygen_variable_caps_StorageImageExtendedFormats[] = {SpvCapabilityStorageImageExtendedFormats}; +static const SpvCapability pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot[] = {SpvCapabilitySubgroupBallotKHR, SpvCapabilityGroupNonUniformBallot}; +static const SpvCapability pygen_variable_caps_SubgroupDispatch[] = {SpvCapabilitySubgroupDispatch}; +static const SpvCapability pygen_variable_caps_Tessellation[] = {SpvCapabilityTessellation}; +static const SpvCapability pygen_variable_caps_TransformFeedback[] = {SpvCapabilityTransformFeedback}; +static const SpvCapability pygen_variable_caps_VariablePointersStorageBuffer[] = {SpvCapabilityVariablePointersStorageBuffer}; + +static const spvtools::Extension pygen_variable_exts_SPV_AMD_gpu_shader_half_float_fetch[] = {spvtools::Extension::kSPV_AMD_gpu_shader_half_float_fetch}; +static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter[] = {spvtools::Extension::kSPV_AMD_shader_explicit_vertex_parameter}; +static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_fragment_mask[] = {spvtools::Extension::kSPV_AMD_shader_fragment_mask}; +static const spvtools::Extension pygen_variable_exts_SPV_AMD_shader_image_load_store_lod[] = {spvtools::Extension::kSPV_AMD_shader_image_load_store_lod}; +static const spvtools::Extension pygen_variable_exts_SPV_AMD_texture_gather_bias_lod[] = {spvtools::Extension::kSPV_AMD_texture_gather_bias_lod}; +static const spvtools::Extension pygen_variable_exts_SPV_EXT_descriptor_indexing[] = {spvtools::Extension::kSPV_EXT_descriptor_indexing}; +static const spvtools::Extension pygen_variable_exts_SPV_EXT_fragment_fully_covered[] = {spvtools::Extension::kSPV_EXT_fragment_fully_covered}; +static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_stencil_export[] = {spvtools::Extension::kSPV_EXT_shader_stencil_export}; +static const spvtools::Extension pygen_variable_exts_SPV_EXT_shader_viewport_index_layer[] = {spvtools::Extension::kSPV_EXT_shader_viewport_index_layer}; +static const spvtools::Extension pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1[] = {spvtools::Extension::kSPV_GOOGLE_hlsl_functionality1}; +static const spvtools::Extension pygen_variable_exts_SPV_INTEL_subgroups[] = {spvtools::Extension::kSPV_INTEL_subgroups}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_16bit_storage[] = {spvtools::Extension::kSPV_KHR_16bit_storage}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_8bit_storage[] = {spvtools::Extension::kSPV_KHR_8bit_storage}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_device_group[] = {spvtools::Extension::kSPV_KHR_device_group}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_multiview[] = {spvtools::Extension::kSPV_KHR_multiview}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_post_depth_coverage[] = {spvtools::Extension::kSPV_KHR_post_depth_coverage}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_atomic_counter_ops[] = {spvtools::Extension::kSPV_KHR_shader_atomic_counter_ops}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_ballot[] = {spvtools::Extension::kSPV_KHR_shader_ballot}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_shader_draw_parameters[] = {spvtools::Extension::kSPV_KHR_shader_draw_parameters}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_storage_buffer_storage_classSPV_KHR_variable_pointers[] = {spvtools::Extension::kSPV_KHR_storage_buffer_storage_class, spvtools::Extension::kSPV_KHR_variable_pointers}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_subgroup_vote[] = {spvtools::Extension::kSPV_KHR_subgroup_vote}; +static const spvtools::Extension pygen_variable_exts_SPV_KHR_variable_pointers[] = {spvtools::Extension::kSPV_KHR_variable_pointers}; +static const spvtools::Extension pygen_variable_exts_SPV_NVX_multiview_per_view_attributes[] = {spvtools::Extension::kSPV_NVX_multiview_per_view_attributes}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_geometry_shader_passthrough[] = {spvtools::Extension::kSPV_NV_geometry_shader_passthrough}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_sample_mask_override_coverage[] = {spvtools::Extension::kSPV_NV_sample_mask_override_coverage}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_shader_subgroup_partitioned[] = {spvtools::Extension::kSPV_NV_shader_subgroup_partitioned}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_stereo_view_rendering[] = {spvtools::Extension::kSPV_NV_stereo_view_rendering}; +static const spvtools::Extension pygen_variable_exts_SPV_NV_viewport_array2[] = {spvtools::Extension::kSPV_NV_viewport_array2}; + +static const spv_operand_desc_t pygen_variable_ImageOperandsEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Bias", 0x0001, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Lod", 0x0002, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Grad", 0x0004, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstOffset", 0x0008, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Offset", 0x0010, 1, pygen_variable_caps_ImageGatherExtended, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ConstOffsets", 0x0020, 1, pygen_variable_caps_ImageGatherExtended, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Sample", 0x0040, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MinLod", 0x0080, 1, pygen_variable_caps_MinLod, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_FPFastMathModeEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NotNaN", 0x0001, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NotInf", 0x0002, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NSZ", 0x0004, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AllowRecip", 0x0008, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Fast", 0x0010, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_SelectionControlEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Flatten", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DontFlatten", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_LoopControlEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Unroll", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DontUnroll", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DependencyInfinite", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"DependencyLength", 0x0008, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1)} +}; + +static const spv_operand_desc_t pygen_variable_FunctionControlEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Inline", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DontInline", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Pure", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Const", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_MemorySemanticsEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Relaxed", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Acquire", 0x0002, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Release", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AcquireRelease", 0x0008, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SequentiallyConsistent", 0x0010, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UniformMemory", 0x0040, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupMemory", 0x0080, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WorkgroupMemory", 0x0100, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CrossWorkgroupMemory", 0x0200, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicCounterMemory", 0x0400, 1, pygen_variable_caps_AtomicStorage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageMemory", 0x0800, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_MemoryAccessEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Volatile", 0x0001, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Aligned", 0x0002, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Nontemporal", 0x0004, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_KernelProfilingInfoEntries[] = { + {"None", 0x0000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CmdExecTime", 0x0001, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_SourceLanguageEntries[] = { + {"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ESSL", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GLSL", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OpenCL_C", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OpenCL_CPP", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"HLSL", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_ExecutionModelEntries[] = { + {"Vertex", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TessellationControl", 1, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TessellationEvaluation", 2, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Geometry", 3, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Fragment", 4, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GLCompute", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Kernel", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_AddressingModelEntries[] = { + {"Logical", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Physical32", 1, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Physical64", 2, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_MemoryModelEntries[] = { + {"Simple", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GLSL450", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OpenCL", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_ExecutionModeEntries[] = { + {"Invocations", 0, 1, pygen_variable_caps_Geometry, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpacingEqual", 1, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpacingFractionalEven", 2, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpacingFractionalOdd", 3, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VertexOrderCw", 4, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VertexOrderCcw", 5, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PixelCenterInteger", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OriginUpperLeft", 7, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OriginLowerLeft", 8, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EarlyFragmentTests", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PointMode", 10, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Xfb", 11, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DepthReplacing", 12, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DepthGreater", 14, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DepthLess", 15, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DepthUnchanged", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LocalSize", 17, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LocalSizeHint", 18, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InputPoints", 19, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InputLines", 20, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InputLinesAdjacency", 21, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Triangles", 22, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InputTrianglesAdjacency", 23, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Quads", 24, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Isolines", 25, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OutputVertices", 26, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OutputPoints", 27, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OutputLineStrip", 28, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"OutputTriangleStrip", 29, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VecTypeHint", 30, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ContractionOff", 31, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Initializer", 33, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"Finalizer", 34, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"SubgroupSize", 35, 1, pygen_variable_caps_SubgroupDispatch, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"SubgroupsPerWorkgroup", 36, 1, pygen_variable_caps_SubgroupDispatch, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"SubgroupsPerWorkgroupId", 37, 1, pygen_variable_caps_SubgroupDispatch, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2)}, + {"LocalSizeId", 38, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2)}, + {"LocalSizeHintId", 39, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2)}, + {"PostDepthCoverage", 4446, 1, pygen_variable_caps_SampleMaskPostDepthCoverage, 1, pygen_variable_exts_SPV_KHR_post_depth_coverage, {}, 0xffffffffu}, + {"StencilRefReplacingEXT", 5027, 1, pygen_variable_caps_StencilExportEXT, 1, pygen_variable_exts_SPV_EXT_shader_stencil_export, {}, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_StorageClassEntries[] = { + {"UniformConstant", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Input", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Uniform", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Output", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Workgroup", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CrossWorkgroup", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Private", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Function", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Generic", 8, 1, pygen_variable_caps_GenericPointer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PushConstant", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicCounter", 10, 1, pygen_variable_caps_AtomicStorage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Image", 11, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageBuffer", 12, 1, pygen_variable_caps_Shader, 2, pygen_variable_exts_SPV_KHR_storage_buffer_storage_classSPV_KHR_variable_pointers, {}, SPV_SPIRV_VERSION_WORD(1,3)} +}; + +static const spv_operand_desc_t pygen_variable_DimEntries[] = { + {"1D", 0, 1, pygen_variable_caps_Sampled1D, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"2D", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"3D", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Cube", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rect", 4, 1, pygen_variable_caps_SampledRect, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Buffer", 5, 1, pygen_variable_caps_SampledBuffer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubpassData", 6, 1, pygen_variable_caps_InputAttachment, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_SamplerAddressingModeEntries[] = { + {"None", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ClampToEdge", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Clamp", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Repeat", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RepeatMirrored", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_SamplerFilterModeEntries[] = { + {"Nearest", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Linear", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_ImageFormatEntries[] = { + {"Unknown", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba32f", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba16f", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R32f", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba8", 4, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba8Snorm", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg32f", 6, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg16f", 7, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R11fG11fB10f", 8, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R16f", 9, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba16", 10, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgb10A2", 11, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg16", 12, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg8", 13, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R16", 14, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R8", 15, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba16Snorm", 16, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg16Snorm", 17, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg8Snorm", 18, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R16Snorm", 19, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R8Snorm", 20, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba32i", 21, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba16i", 22, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba8i", 23, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R32i", 24, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg32i", 25, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg16i", 26, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg8i", 27, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R16i", 28, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R8i", 29, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba32ui", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba16ui", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgba8ui", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R32ui", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rgb10a2ui", 34, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg32ui", 35, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg16ui", 36, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rg8ui", 37, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R16ui", 38, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"R8ui", 39, 1, pygen_variable_caps_StorageImageExtendedFormats, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_ImageChannelOrderEntries[] = { + {"R", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"A", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RG", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RA", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RGB", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RGBA", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BGRA", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ARGB", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Intensity", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Luminance", 9, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Rx", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RGx", 11, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RGBx", 12, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Depth", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DepthStencil", 14, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"sRGB", 15, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"sRGBx", 16, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"sRGBA", 17, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"sBGRA", 18, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ABGR", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_ImageChannelDataTypeEntries[] = { + {"SnormInt8", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SnormInt16", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormInt8", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormInt16", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormShort565", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormShort555", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormInt101010", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SignedInt8", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SignedInt16", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SignedInt32", 9, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnsignedInt8", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnsignedInt16", 11, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnsignedInt32", 12, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"HalfFloat", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Float", 14, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormInt24", 15, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnormInt101010_2", 16, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_FPRoundingModeEntries[] = { + {"RTE", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RTZ", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RTP", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RTN", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_LinkageTypeEntries[] = { + {"Export", 0, 1, pygen_variable_caps_Linkage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Import", 1, 1, pygen_variable_caps_Linkage, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_AccessQualifierEntries[] = { + {"ReadOnly", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WriteOnly", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ReadWrite", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_FunctionParameterAttributeEntries[] = { + {"Zext", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Sext", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ByVal", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Sret", 3, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoAlias", 4, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoCapture", 5, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoWrite", 6, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoReadWrite", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_DecorationEntries[] = { + {"RelaxedPrecision", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SpecId", 1, 2, pygen_variable_caps_ShaderKernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Block", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BufferBlock", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RowMajor", 4, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ColMajor", 5, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ArrayStride", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MatrixStride", 7, 1, pygen_variable_caps_Matrix, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GLSLShared", 8, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GLSLPacked", 9, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CPacked", 10, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BuiltIn", 11, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_BUILT_IN}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoPerspective", 13, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Flat", 14, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Patch", 15, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Centroid", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Sample", 17, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Invariant", 18, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Restrict", 19, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Aliased", 20, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Volatile", 21, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Constant", 22, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Coherent", 23, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NonWritable", 24, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NonReadable", 25, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Uniform", 26, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SaturatedConversion", 28, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Stream", 29, 1, pygen_variable_caps_GeometryStreams, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Location", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Component", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Index", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Binding", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DescriptorSet", 34, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Offset", 35, 1, pygen_variable_caps_Shader, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"XfbBuffer", 36, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"XfbStride", 37, 1, pygen_variable_caps_TransformFeedback, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FuncParamAttr", 38, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FPRoundingMode", 39, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_FP_ROUNDING_MODE}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FPFastMathMode", 40, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LinkageAttributes", 41, 1, pygen_variable_caps_Linkage, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LINKAGE_TYPE}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NoContraction", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InputAttachmentIndex", 43, 1, pygen_variable_caps_InputAttachment, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Alignment", 44, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MaxByteOffset", 45, 1, pygen_variable_caps_Addresses, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"AlignmentId", 46, 1, pygen_variable_caps_Kernel, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2)}, + {"MaxByteOffsetId", 47, 1, pygen_variable_caps_Addresses, 0, nullptr, {SPV_OPERAND_TYPE_ID}, SPV_SPIRV_VERSION_WORD(1,2)}, + {"ExplicitInterpAMD", 4999, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"OverrideCoverageNV", 5248, 1, pygen_variable_caps_SampleMaskOverrideCoverageNV, 1, pygen_variable_exts_SPV_NV_sample_mask_override_coverage, {}, 0xffffffffu}, + {"PassthroughNV", 5250, 1, pygen_variable_caps_GeometryShaderPassthroughNV, 1, pygen_variable_exts_SPV_NV_geometry_shader_passthrough, {}, 0xffffffffu}, + {"ViewportRelativeNV", 5252, 1, pygen_variable_caps_ShaderViewportMaskNV, 0, nullptr, {}, 0xffffffffu}, + {"SecondaryViewportRelativeNV", 5256, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, 0xffffffffu}, + {"NonUniformEXT", 5300, 1, pygen_variable_caps_ShaderNonUniformEXT, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"HlslCounterBufferGOOGLE", 5634, 0, nullptr, 1, pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1, {SPV_OPERAND_TYPE_ID}, 0xffffffffu}, + {"HlslSemanticGOOGLE", 5635, 0, nullptr, 1, pygen_variable_exts_SPV_GOOGLE_hlsl_functionality1, {SPV_OPERAND_TYPE_LITERAL_STRING}, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_BuiltInEntries[] = { + {"Position", 0, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PointSize", 1, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ClipDistance", 3, 1, pygen_variable_caps_ClipDistance, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CullDistance", 4, 1, pygen_variable_caps_CullDistance, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VertexId", 5, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InstanceId", 6, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PrimitiveId", 7, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InvocationId", 8, 2, pygen_variable_caps_GeometryTessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Layer", 9, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ViewportIndex", 10, 1, pygen_variable_caps_MultiViewport, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TessLevelOuter", 11, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TessLevelInner", 12, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TessCoord", 13, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PatchVertices", 14, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FragCoord", 15, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PointCoord", 16, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FrontFacing", 17, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampleId", 18, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SamplePosition", 19, 1, pygen_variable_caps_SampleRateShading, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampleMask", 20, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FragDepth", 22, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"HelperInvocation", 23, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NumWorkgroups", 24, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WorkgroupSize", 25, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WorkgroupId", 26, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LocalInvocationId", 27, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GlobalInvocationId", 28, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LocalInvocationIndex", 29, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WorkDim", 30, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GlobalSize", 31, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"EnqueuedWorkgroupSize", 32, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GlobalOffset", 33, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GlobalLinearId", 34, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupSize", 36, 3, pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupMaxSize", 37, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NumSubgroups", 38, 2, pygen_variable_caps_KernelGroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"NumEnqueuedSubgroups", 39, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupId", 40, 2, pygen_variable_caps_KernelGroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupLocalInvocationId", 41, 3, pygen_variable_caps_KernelGroupNonUniformSubgroupBallotKHR, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VertexIndex", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InstanceIndex", 43, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupEqMask", 4416, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupEqMaskKHR", 4416, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupGeMask", 4417, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupGeMaskKHR", 4417, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupGtMask", 4418, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupGtMaskKHR", 4418, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupLeMask", 4419, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupLeMaskKHR", 4419, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupLtMask", 4420, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupLtMaskKHR", 4420, 2, pygen_variable_caps_SubgroupBallotKHRGroupNonUniformBallot, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"BaseVertex", 4424, 1, pygen_variable_caps_DrawParameters, 1, pygen_variable_exts_SPV_KHR_shader_draw_parameters, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"BaseInstance", 4425, 1, pygen_variable_caps_DrawParameters, 1, pygen_variable_exts_SPV_KHR_shader_draw_parameters, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"DrawIndex", 4426, 1, pygen_variable_caps_DrawParameters, 1, pygen_variable_exts_SPV_KHR_shader_draw_parameters, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"DeviceIndex", 4438, 1, pygen_variable_caps_DeviceGroup, 1, pygen_variable_exts_SPV_KHR_device_group, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"ViewIndex", 4440, 1, pygen_variable_caps_MultiView, 1, pygen_variable_exts_SPV_KHR_multiview, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"BaryCoordNoPerspAMD", 4992, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"BaryCoordNoPerspCentroidAMD", 4993, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"BaryCoordNoPerspSampleAMD", 4994, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"BaryCoordSmoothAMD", 4995, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"BaryCoordSmoothCentroidAMD", 4996, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"BaryCoordSmoothSampleAMD", 4997, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"BaryCoordPullModelAMD", 4998, 0, nullptr, 1, pygen_variable_exts_SPV_AMD_shader_explicit_vertex_parameter, {}, 0xffffffffu}, + {"FragStencilRefEXT", 5014, 1, pygen_variable_caps_StencilExportEXT, 1, pygen_variable_exts_SPV_EXT_shader_stencil_export, {}, 0xffffffffu}, + {"ViewportMaskNV", 5253, 1, pygen_variable_caps_ShaderViewportMaskNV, 0, nullptr, {}, 0xffffffffu}, + {"SecondaryPositionNV", 5257, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {}, 0xffffffffu}, + {"SecondaryViewportMaskNV", 5258, 1, pygen_variable_caps_ShaderStereoViewNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {}, 0xffffffffu}, + {"PositionPerViewNV", 5261, 1, pygen_variable_caps_PerViewAttributesNV, 0, nullptr, {}, 0xffffffffu}, + {"ViewportMaskPerViewNV", 5262, 1, pygen_variable_caps_PerViewAttributesNV, 0, nullptr, {}, 0xffffffffu}, + {"FullyCoveredEXT", 5264, 1, pygen_variable_caps_FragmentFullyCoveredEXT, 1, pygen_variable_exts_SPV_EXT_fragment_fully_covered, {}, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_ScopeEntries[] = { + {"CrossDevice", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Device", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Workgroup", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Subgroup", 3, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Invocation", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_GroupOperationEntries[] = { + {"Reduce", 0, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InclusiveScan", 1, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ExclusiveScan", 2, 3, pygen_variable_caps_KernelGroupNonUniformArithmeticGroupNonUniformBallot, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ClusteredReduce", 3, 1, pygen_variable_caps_GroupNonUniformClustered, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"PartitionedReduceNV", 6, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, {}, 0xffffffffu}, + {"PartitionedInclusiveScanNV", 7, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, {}, 0xffffffffu}, + {"PartitionedExclusiveScanNV", 8, 1, pygen_variable_caps_GroupNonUniformPartitionedNV, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, {}, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_KernelEnqueueFlagsEntries[] = { + {"NoWait", 0, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WaitKernel", 1, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"WaitWorkGroup", 2, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_CapabilityEntries[] = { + {"Matrix", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Shader", 1, 1, pygen_variable_caps_Matrix, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Geometry", 2, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Tessellation", 3, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Addresses", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Linkage", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Kernel", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Vector16", 7, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Float16Buffer", 8, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Float16", 9, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Float64", 10, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Int64", 11, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Int64Atomics", 12, 1, pygen_variable_caps_Int64, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageBasic", 13, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageReadWrite", 14, 1, pygen_variable_caps_ImageBasic, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageMipmap", 15, 1, pygen_variable_caps_ImageBasic, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Pipes", 17, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Groups", 18, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DeviceEnqueue", 19, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"LiteralSampler", 20, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"AtomicStorage", 21, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Int16", 22, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TessellationPointSize", 23, 1, pygen_variable_caps_Tessellation, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GeometryPointSize", 24, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageGatherExtended", 25, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageImageMultisample", 27, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UniformBufferArrayDynamicIndexing", 28, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampledImageArrayDynamicIndexing", 29, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageBufferArrayDynamicIndexing", 30, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageImageArrayDynamicIndexing", 31, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ClipDistance", 32, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"CullDistance", 33, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageCubeArray", 34, 1, pygen_variable_caps_SampledCubeArray, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampleRateShading", 35, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageRect", 36, 1, pygen_variable_caps_SampledRect, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampledRect", 37, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GenericPointer", 38, 1, pygen_variable_caps_Addresses, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Int8", 39, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InputAttachment", 40, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SparseResidency", 41, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MinLod", 42, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Sampled1D", 43, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Image1D", 44, 1, pygen_variable_caps_Sampled1D, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampledCubeArray", 45, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SampledBuffer", 46, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageBuffer", 47, 1, pygen_variable_caps_SampledBuffer, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageMSArray", 48, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageImageExtendedFormats", 49, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"ImageQuery", 50, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"DerivativeControl", 51, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"InterpolationFunction", 52, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"TransformFeedback", 53, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"GeometryStreams", 54, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageImageReadWithoutFormat", 55, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StorageImageWriteWithoutFormat", 56, 1, pygen_variable_caps_Shader, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"MultiViewport", 57, 1, pygen_variable_caps_Geometry, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SubgroupDispatch", 58, 1, pygen_variable_caps_DeviceEnqueue, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"NamedBarrier", 59, 1, pygen_variable_caps_Kernel, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"PipeStorage", 60, 1, pygen_variable_caps_Pipes, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,1)}, + {"GroupNonUniform", 61, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformVote", 62, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformArithmetic", 63, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformBallot", 64, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformShuffle", 65, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformShuffleRelative", 66, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformClustered", 67, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"GroupNonUniformQuad", 68, 1, pygen_variable_caps_GroupNonUniform, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupBallotKHR", 4423, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_shader_ballot, {}, 0xffffffffu}, + {"DrawParameters", 4427, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_shader_draw_parameters, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"SubgroupVoteKHR", 4431, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_subgroup_vote, {}, 0xffffffffu}, + {"StorageBuffer16BitAccess", 4433, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_16bit_storage, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"StorageUniformBufferBlock16", 4433, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_16bit_storage, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"StorageUniform16", 4434, 2, pygen_variable_caps_StorageBuffer16BitAccessStorageUniformBufferBlock16, 1, pygen_variable_exts_SPV_KHR_16bit_storage, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"UniformAndStorageBuffer16BitAccess", 4434, 2, pygen_variable_caps_StorageBuffer16BitAccessStorageUniformBufferBlock16, 1, pygen_variable_exts_SPV_KHR_16bit_storage, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"StoragePushConstant16", 4435, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_16bit_storage, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"StorageInputOutput16", 4436, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_16bit_storage, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"DeviceGroup", 4437, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_device_group, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"MultiView", 4439, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_multiview, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"VariablePointersStorageBuffer", 4441, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_KHR_variable_pointers, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"VariablePointers", 4442, 1, pygen_variable_caps_VariablePointersStorageBuffer, 1, pygen_variable_exts_SPV_KHR_variable_pointers, {}, SPV_SPIRV_VERSION_WORD(1,3)}, + {"AtomicStorageOps", 4445, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_shader_atomic_counter_ops, {}, 0xffffffffu}, + {"SampleMaskPostDepthCoverage", 4447, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_post_depth_coverage, {}, 0xffffffffu}, + {"StorageBuffer8BitAccess", 4448, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_8bit_storage, {}, 0xffffffffu}, + {"UniformAndStorageBuffer8BitAccess", 4449, 1, pygen_variable_caps_StorageBuffer8BitAccess, 1, pygen_variable_exts_SPV_KHR_8bit_storage, {}, 0xffffffffu}, + {"StoragePushConstant8", 4450, 0, nullptr, 1, pygen_variable_exts_SPV_KHR_8bit_storage, {}, 0xffffffffu}, + {"Float16ImageAMD", 5008, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_gpu_shader_half_float_fetch, {}, 0xffffffffu}, + {"ImageGatherBiasLodAMD", 5009, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_texture_gather_bias_lod, {}, 0xffffffffu}, + {"FragmentMaskAMD", 5010, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_shader_fragment_mask, {}, 0xffffffffu}, + {"StencilExportEXT", 5013, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_shader_stencil_export, {}, 0xffffffffu}, + {"ImageReadWriteLodAMD", 5015, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_AMD_shader_image_load_store_lod, {}, 0xffffffffu}, + {"SampleMaskOverrideCoverageNV", 5249, 1, pygen_variable_caps_SampleRateShading, 1, pygen_variable_exts_SPV_NV_sample_mask_override_coverage, {}, 0xffffffffu}, + {"GeometryShaderPassthroughNV", 5251, 1, pygen_variable_caps_Geometry, 1, pygen_variable_exts_SPV_NV_geometry_shader_passthrough, {}, 0xffffffffu}, + {"ShaderViewportIndexLayerEXT", 5254, 1, pygen_variable_caps_MultiViewport, 1, pygen_variable_exts_SPV_EXT_shader_viewport_index_layer, {}, 0xffffffffu}, + {"ShaderViewportIndexLayerNV", 5254, 1, pygen_variable_caps_MultiViewport, 1, pygen_variable_exts_SPV_NV_viewport_array2, {}, 0xffffffffu}, + {"ShaderViewportMaskNV", 5255, 1, pygen_variable_caps_ShaderViewportIndexLayerNV, 1, pygen_variable_exts_SPV_NV_viewport_array2, {}, 0xffffffffu}, + {"ShaderStereoViewNV", 5259, 1, pygen_variable_caps_ShaderViewportMaskNV, 1, pygen_variable_exts_SPV_NV_stereo_view_rendering, {}, 0xffffffffu}, + {"PerViewAttributesNV", 5260, 1, pygen_variable_caps_MultiView, 1, pygen_variable_exts_SPV_NVX_multiview_per_view_attributes, {}, 0xffffffffu}, + {"FragmentFullyCoveredEXT", 5265, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_fragment_fully_covered, {}, 0xffffffffu}, + {"GroupNonUniformPartitionedNV", 5297, 0, nullptr, 1, pygen_variable_exts_SPV_NV_shader_subgroup_partitioned, {}, 0xffffffffu}, + {"ShaderNonUniformEXT", 5301, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"RuntimeDescriptorArrayEXT", 5302, 1, pygen_variable_caps_Shader, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"InputAttachmentArrayDynamicIndexingEXT", 5303, 1, pygen_variable_caps_InputAttachment, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"UniformTexelBufferArrayDynamicIndexingEXT", 5304, 1, pygen_variable_caps_SampledBuffer, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"StorageTexelBufferArrayDynamicIndexingEXT", 5305, 1, pygen_variable_caps_ImageBuffer, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"UniformBufferArrayNonUniformIndexingEXT", 5306, 1, pygen_variable_caps_ShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"SampledImageArrayNonUniformIndexingEXT", 5307, 1, pygen_variable_caps_ShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"StorageBufferArrayNonUniformIndexingEXT", 5308, 1, pygen_variable_caps_ShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"StorageImageArrayNonUniformIndexingEXT", 5309, 1, pygen_variable_caps_ShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"InputAttachmentArrayNonUniformIndexingEXT", 5310, 2, pygen_variable_caps_InputAttachmentShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"UniformTexelBufferArrayNonUniformIndexingEXT", 5311, 2, pygen_variable_caps_SampledBufferShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"StorageTexelBufferArrayNonUniformIndexingEXT", 5312, 2, pygen_variable_caps_ImageBufferShaderNonUniformEXT, 1, pygen_variable_exts_SPV_EXT_descriptor_indexing, {}, 0xffffffffu}, + {"SubgroupShuffleINTEL", 5568, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu}, + {"SubgroupBufferBlockIOINTEL", 5569, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu}, + {"SubgroupImageBlockIOINTEL", 5570, 0, nullptr, 1, pygen_variable_exts_SPV_INTEL_subgroups, {}, 0xffffffffu} +}; + +static const spv_operand_desc_t pygen_variable_DebugInfoFlagsEntries[] = { + {"FlagIsProtected", 0x01, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagIsPrivate", 0x02, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagIsPublic", 0x03, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagIsLocal", 0x04, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagIsDefinition", 0x08, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagFwdDecl", 0x10, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagArtificial", 0x20, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagExplicit", 0x40, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagPrototyped", 0x80, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagObjectPointer", 0x100, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagStaticMember", 0x200, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagIndirectVariable", 0x400, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagLValueReference", 0x800, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagRValueReference", 0x1000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"FlagIsOptimized", 0x2000, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_DebugBaseTypeAttributeEncodingEntries[] = { + {"Unspecified", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Address", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Boolean", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Float", 4, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Signed", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"SignedChar", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Unsigned", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"UnsignedChar", 8, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_DebugCompositeTypeEntries[] = { + {"Class", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Structure", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Union", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_DebugTypeQualifierEntries[] = { + {"ConstType", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"VolatileType", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"RestrictType", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_t pygen_variable_DebugOperationEntries[] = { + {"Deref", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Plus", 1, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Minus", 2, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"PlusUconst", 3, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"BitPiece", 4, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Swap", 5, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Xderef", 6, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"StackValue", 7, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(1, 0)}, + {"Constu", 8, 0, nullptr, 0, nullptr, {SPV_OPERAND_TYPE_LITERAL_INTEGER}, SPV_SPIRV_VERSION_WORD(1, 0)} +}; + +static const spv_operand_desc_group_t pygen_variable_OperandInfoTable[] = { + {SPV_OPERAND_TYPE_IMAGE, ARRAY_SIZE(pygen_variable_ImageOperandsEntries), pygen_variable_ImageOperandsEntries}, + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, ARRAY_SIZE(pygen_variable_FPFastMathModeEntries), pygen_variable_FPFastMathModeEntries}, + {SPV_OPERAND_TYPE_SELECTION_CONTROL, ARRAY_SIZE(pygen_variable_SelectionControlEntries), pygen_variable_SelectionControlEntries}, + {SPV_OPERAND_TYPE_LOOP_CONTROL, ARRAY_SIZE(pygen_variable_LoopControlEntries), pygen_variable_LoopControlEntries}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, ARRAY_SIZE(pygen_variable_FunctionControlEntries), pygen_variable_FunctionControlEntries}, + {SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, ARRAY_SIZE(pygen_variable_MemorySemanticsEntries), pygen_variable_MemorySemanticsEntries}, + {SPV_OPERAND_TYPE_MEMORY_ACCESS, ARRAY_SIZE(pygen_variable_MemoryAccessEntries), pygen_variable_MemoryAccessEntries}, + {SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO, ARRAY_SIZE(pygen_variable_KernelProfilingInfoEntries), pygen_variable_KernelProfilingInfoEntries}, + {SPV_OPERAND_TYPE_SOURCE_LANGUAGE, ARRAY_SIZE(pygen_variable_SourceLanguageEntries), pygen_variable_SourceLanguageEntries}, + {SPV_OPERAND_TYPE_EXECUTION_MODEL, ARRAY_SIZE(pygen_variable_ExecutionModelEntries), pygen_variable_ExecutionModelEntries}, + {SPV_OPERAND_TYPE_ADDRESSING_MODEL, ARRAY_SIZE(pygen_variable_AddressingModelEntries), pygen_variable_AddressingModelEntries}, + {SPV_OPERAND_TYPE_MEMORY_MODEL, ARRAY_SIZE(pygen_variable_MemoryModelEntries), pygen_variable_MemoryModelEntries}, + {SPV_OPERAND_TYPE_EXECUTION_MODE, ARRAY_SIZE(pygen_variable_ExecutionModeEntries), pygen_variable_ExecutionModeEntries}, + {SPV_OPERAND_TYPE_STORAGE_CLASS, ARRAY_SIZE(pygen_variable_StorageClassEntries), pygen_variable_StorageClassEntries}, + {SPV_OPERAND_TYPE_DIMENSIONALITY, ARRAY_SIZE(pygen_variable_DimEntries), pygen_variable_DimEntries}, + {SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE, ARRAY_SIZE(pygen_variable_SamplerAddressingModeEntries), pygen_variable_SamplerAddressingModeEntries}, + {SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE, ARRAY_SIZE(pygen_variable_SamplerFilterModeEntries), pygen_variable_SamplerFilterModeEntries}, + {SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, ARRAY_SIZE(pygen_variable_ImageFormatEntries), pygen_variable_ImageFormatEntries}, + {SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER, ARRAY_SIZE(pygen_variable_ImageChannelOrderEntries), pygen_variable_ImageChannelOrderEntries}, + {SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE, ARRAY_SIZE(pygen_variable_ImageChannelDataTypeEntries), pygen_variable_ImageChannelDataTypeEntries}, + {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, ARRAY_SIZE(pygen_variable_FPRoundingModeEntries), pygen_variable_FPRoundingModeEntries}, + {SPV_OPERAND_TYPE_LINKAGE_TYPE, ARRAY_SIZE(pygen_variable_LinkageTypeEntries), pygen_variable_LinkageTypeEntries}, + {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, ARRAY_SIZE(pygen_variable_AccessQualifierEntries), pygen_variable_AccessQualifierEntries}, + {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, ARRAY_SIZE(pygen_variable_FunctionParameterAttributeEntries), pygen_variable_FunctionParameterAttributeEntries}, + {SPV_OPERAND_TYPE_DECORATION, ARRAY_SIZE(pygen_variable_DecorationEntries), pygen_variable_DecorationEntries}, + {SPV_OPERAND_TYPE_BUILT_IN, ARRAY_SIZE(pygen_variable_BuiltInEntries), pygen_variable_BuiltInEntries}, + {SPV_OPERAND_TYPE_SCOPE_ID, ARRAY_SIZE(pygen_variable_ScopeEntries), pygen_variable_ScopeEntries}, + {SPV_OPERAND_TYPE_GROUP_OPERATION, ARRAY_SIZE(pygen_variable_GroupOperationEntries), pygen_variable_GroupOperationEntries}, + {SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS, ARRAY_SIZE(pygen_variable_KernelEnqueueFlagsEntries), pygen_variable_KernelEnqueueFlagsEntries}, + {SPV_OPERAND_TYPE_CAPABILITY, ARRAY_SIZE(pygen_variable_CapabilityEntries), pygen_variable_CapabilityEntries}, + {SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, ARRAY_SIZE(pygen_variable_DebugInfoFlagsEntries), pygen_variable_DebugInfoFlagsEntries}, + {SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING, ARRAY_SIZE(pygen_variable_DebugBaseTypeAttributeEncodingEntries), pygen_variable_DebugBaseTypeAttributeEncodingEntries}, + {SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE, ARRAY_SIZE(pygen_variable_DebugCompositeTypeEntries), pygen_variable_DebugCompositeTypeEntries}, + {SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER, ARRAY_SIZE(pygen_variable_DebugTypeQualifierEntries), pygen_variable_DebugTypeQualifierEntries}, + {SPV_OPERAND_TYPE_DEBUG_OPERATION, ARRAY_SIZE(pygen_variable_DebugOperationEntries), pygen_variable_DebugOperationEntries}, + {SPV_OPERAND_TYPE_OPTIONAL_IMAGE, ARRAY_SIZE(pygen_variable_ImageOperandsEntries), pygen_variable_ImageOperandsEntries}, + {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, ARRAY_SIZE(pygen_variable_MemoryAccessEntries), pygen_variable_MemoryAccessEntries}, + {SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER, ARRAY_SIZE(pygen_variable_AccessQualifierEntries), pygen_variable_AccessQualifierEntries} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-gcn-shader.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-gcn-shader.insts.inc new file mode 100644 index 00000000000..48f7f47680c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-gcn-shader.insts.inc @@ -0,0 +1,7 @@ + + +static const spv_ext_inst_desc_t spv_amd_gcn_shader_entries[] = { + {"CubeFaceIndexAMD", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"CubeFaceCoordAMD", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"TimeAMD", 3, 0, nullptr, {SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-ballot.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-ballot.insts.inc new file mode 100644 index 00000000000..6216051b977 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-ballot.insts.inc @@ -0,0 +1,8 @@ + + +static const spv_ext_inst_desc_t spv_amd_shader_ballot_entries[] = { + {"SwizzleInvocationsAMD", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SwizzleInvocationsMaskedAMD", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"WriteInvocationAMD", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"MbcntAMD", 4, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-explicit-vertex-parameter.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-explicit-vertex-parameter.insts.inc new file mode 100644 index 00000000000..6b612854f54 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-explicit-vertex-parameter.insts.inc @@ -0,0 +1,5 @@ + + +static const spv_ext_inst_desc_t spv_amd_shader_explicit_vertex_parameter_entries[] = { + {"InterpolateAtVertexAMD", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-trinary-minmax.insts.inc b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-trinary-minmax.insts.inc new file mode 100644 index 00000000000..061e862a401 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/generated/spv-amd-shader-trinary-minmax.insts.inc @@ -0,0 +1,13 @@ + + +static const spv_ext_inst_desc_t spv_amd_shader_trinary_minmax_entries[] = { + {"FMin3AMD", 1, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UMin3AMD", 2, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SMin3AMD", 3, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FMax3AMD", 4, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UMax3AMD", 5, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SMax3AMD", 6, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"FMid3AMD", 7, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"UMid3AMD", 8, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}}, + {"SMid3AMD", 9, 0, nullptr, {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}} +}; diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h new file mode 100644 index 00000000000..a7e1b30079b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.h @@ -0,0 +1,599 @@ +// Copyright (c) 2015-2016 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. + +#ifndef INCLUDE_SPIRV_TOOLS_LIBSPIRV_H_ +#define INCLUDE_SPIRV_TOOLS_LIBSPIRV_H_ + +#ifdef __cplusplus +extern "C" { +#else +#include +#endif + +#include +#include + +#if defined(SPIRV_TOOLS_SHAREDLIB) +#if defined(_WIN32) +#if defined(SPIRV_TOOLS_IMPLEMENTATION) +#define SPIRV_TOOLS_EXPORT __declspec(dllexport) +#else +#define SPIRV_TOOLS_EXPORT __declspec(dllimport) +#endif +#else +#if defined(SPIRV_TOOLS_IMPLEMENTATION) +#define SPIRV_TOOLS_EXPORT __attribute__((visibility("default"))) +#else +#define SPIRV_TOOLS_EXPORT +#endif +#endif +#else +#define SPIRV_TOOLS_EXPORT +#endif + +// Helpers + +#define SPV_BIT(shift) (1 << (shift)) + +#define SPV_FORCE_16_BIT_ENUM(name) _##name = 0x7fff +#define SPV_FORCE_32_BIT_ENUM(name) _##name = 0x7fffffff + +// Enumerations + +typedef enum spv_result_t { + SPV_SUCCESS = 0, + SPV_UNSUPPORTED = 1, + SPV_END_OF_STREAM = 2, + SPV_WARNING = 3, + SPV_FAILED_MATCH = 4, + SPV_REQUESTED_TERMINATION = 5, // Success, but signals early termination. + SPV_ERROR_INTERNAL = -1, + SPV_ERROR_OUT_OF_MEMORY = -2, + SPV_ERROR_INVALID_POINTER = -3, + SPV_ERROR_INVALID_BINARY = -4, + SPV_ERROR_INVALID_TEXT = -5, + SPV_ERROR_INVALID_TABLE = -6, + SPV_ERROR_INVALID_VALUE = -7, + SPV_ERROR_INVALID_DIAGNOSTIC = -8, + SPV_ERROR_INVALID_LOOKUP = -9, + SPV_ERROR_INVALID_ID = -10, + SPV_ERROR_INVALID_CFG = -11, + SPV_ERROR_INVALID_LAYOUT = -12, + SPV_ERROR_INVALID_CAPABILITY = -13, + SPV_ERROR_INVALID_DATA = -14, // Indicates data rules validation failure. + SPV_ERROR_MISSING_EXTENSION = -15, + SPV_ERROR_WRONG_VERSION = -16, // Indicates wrong SPIR-V version + SPV_FORCE_32_BIT_ENUM(spv_result_t) +} spv_result_t; + +// Severity levels of messages communicated to the consumer. +typedef enum spv_message_level_t { + SPV_MSG_FATAL, // Unrecoverable error due to environment. + // Will exit the program immediately. E.g., + // out of memory. + SPV_MSG_INTERNAL_ERROR, // Unrecoverable error due to SPIRV-Tools + // internals. + // Will exit the program immediately. E.g., + // unimplemented feature. + SPV_MSG_ERROR, // Normal error due to user input. + SPV_MSG_WARNING, // Warning information. + SPV_MSG_INFO, // General information. + SPV_MSG_DEBUG, // Debug information. +} spv_message_level_t; + +typedef enum spv_endianness_t { + SPV_ENDIANNESS_LITTLE, + SPV_ENDIANNESS_BIG, + SPV_FORCE_32_BIT_ENUM(spv_endianness_t) +} spv_endianness_t; + +// The kinds of operands that an instruction may have. +// +// Some operand types are "concrete". The binary parser uses a concrete +// operand type to describe an operand of a parsed instruction. +// +// The assembler uses all operand types. In addition to determining what +// kind of value an operand may be, non-concrete operand types capture the +// fact that an operand might be optional (may be absent, or present exactly +// once), or might occur zero or more times. +// +// Sometimes we also need to be able to express the fact that an operand +// is a member of an optional tuple of values. In that case the first member +// would be optional, and the subsequent members would be required. +typedef enum spv_operand_type_t { + // A sentinel value. + SPV_OPERAND_TYPE_NONE = 0, + + // Set 1: Operands that are IDs. + SPV_OPERAND_TYPE_ID, + SPV_OPERAND_TYPE_TYPE_ID, + SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, // SPIR-V Sec 3.25 + SPV_OPERAND_TYPE_SCOPE_ID, // SPIR-V Sec 3.27 + + // Set 2: Operands that are literal numbers. + SPV_OPERAND_TYPE_LITERAL_INTEGER, // Always unsigned 32-bits. + // The Instruction argument to OpExtInst. It's an unsigned 32-bit literal + // number indicating which instruction to use from an extended instruction + // set. + SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER, + // The Opcode argument to OpSpecConstantOp. It determines the operation + // to be performed on constant operands to compute a specialization constant + // result. + SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER, + // A literal number whose format and size are determined by a previous operand + // in the same instruction. It's a signed integer, an unsigned integer, or a + // floating point number. It also has a specified bit width. The width + // may be larger than 32, which would require such a typed literal value to + // occupy multiple SPIR-V words. + SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, + + // Set 3: The literal string operand type. + SPV_OPERAND_TYPE_LITERAL_STRING, + + // Set 4: Operands that are a single word enumerated value. + SPV_OPERAND_TYPE_SOURCE_LANGUAGE, // SPIR-V Sec 3.2 + SPV_OPERAND_TYPE_EXECUTION_MODEL, // SPIR-V Sec 3.3 + SPV_OPERAND_TYPE_ADDRESSING_MODEL, // SPIR-V Sec 3.4 + SPV_OPERAND_TYPE_MEMORY_MODEL, // SPIR-V Sec 3.5 + SPV_OPERAND_TYPE_EXECUTION_MODE, // SPIR-V Sec 3.6 + SPV_OPERAND_TYPE_STORAGE_CLASS, // SPIR-V Sec 3.7 + SPV_OPERAND_TYPE_DIMENSIONALITY, // SPIR-V Sec 3.8 + SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE, // SPIR-V Sec 3.9 + SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE, // SPIR-V Sec 3.10 + SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, // SPIR-V Sec 3.11 + SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER, // SPIR-V Sec 3.12 + SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE, // SPIR-V Sec 3.13 + SPV_OPERAND_TYPE_FP_ROUNDING_MODE, // SPIR-V Sec 3.16 + SPV_OPERAND_TYPE_LINKAGE_TYPE, // SPIR-V Sec 3.17 + SPV_OPERAND_TYPE_ACCESS_QUALIFIER, // SPIR-V Sec 3.18 + SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, // SPIR-V Sec 3.19 + SPV_OPERAND_TYPE_DECORATION, // SPIR-V Sec 3.20 + SPV_OPERAND_TYPE_BUILT_IN, // SPIR-V Sec 3.21 + SPV_OPERAND_TYPE_GROUP_OPERATION, // SPIR-V Sec 3.28 + SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS, // SPIR-V Sec 3.29 + SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO, // SPIR-V Sec 3.30 + SPV_OPERAND_TYPE_CAPABILITY, // SPIR-V Sec 3.31 + + // Set 5: Operands that are a single word bitmask. + // Sometimes a set bit indicates the instruction requires still more operands. + SPV_OPERAND_TYPE_IMAGE, // SPIR-V Sec 3.14 + SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, // SPIR-V Sec 3.15 + SPV_OPERAND_TYPE_SELECTION_CONTROL, // SPIR-V Sec 3.22 + SPV_OPERAND_TYPE_LOOP_CONTROL, // SPIR-V Sec 3.23 + SPV_OPERAND_TYPE_FUNCTION_CONTROL, // SPIR-V Sec 3.24 + SPV_OPERAND_TYPE_MEMORY_ACCESS, // SPIR-V Sec 3.26 + +// The remaining operand types are only used internally by the assembler. +// There are two categories: +// Optional : expands to 0 or 1 operand, like ? in regular expressions. +// Variable : expands to 0, 1 or many operands or pairs of operands. +// This is similar to * in regular expressions. + +// Macros for defining bounds on optional and variable operand types. +// Any variable operand type is also optional. +#define FIRST_OPTIONAL(ENUM) ENUM, SPV_OPERAND_TYPE_FIRST_OPTIONAL_TYPE = ENUM +#define FIRST_VARIABLE(ENUM) ENUM, SPV_OPERAND_TYPE_FIRST_VARIABLE_TYPE = ENUM +#define LAST_VARIABLE(ENUM) \ + ENUM, SPV_OPERAND_TYPE_LAST_VARIABLE_TYPE = ENUM, \ + SPV_OPERAND_TYPE_LAST_OPTIONAL_TYPE = ENUM + + // An optional operand represents zero or one logical operands. + // In an instruction definition, this may only appear at the end of the + // operand types. + FIRST_OPTIONAL(SPV_OPERAND_TYPE_OPTIONAL_ID), + // An optional image operand type. + SPV_OPERAND_TYPE_OPTIONAL_IMAGE, + // An optional memory access type. + SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, + // An optional literal integer. + SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER, + // An optional literal number, which may be either integer or floating point. + SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER, + // Like SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, but optional, and integral. + SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER, + // An optional literal string. + SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING, + // An optional access qualifier + SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER, + // An optional context-independent value, or CIV. CIVs are tokens that we can + // assemble regardless of where they occur -- literals, IDs, immediate + // integers, etc. + SPV_OPERAND_TYPE_OPTIONAL_CIV, + + // A variable operand represents zero or more logical operands. + // In an instruction definition, this may only appear at the end of the + // operand types. + FIRST_VARIABLE(SPV_OPERAND_TYPE_VARIABLE_ID), + SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER, + // A sequence of zero or more pairs of (typed literal integer, Id). + // Expands to zero or more: + // (SPV_OPERAND_TYPE_TYPED_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID) + // where the literal number must always be an integer of some sort. + SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER_ID, + // A sequence of zero or more pairs of (Id, Literal integer) + LAST_VARIABLE(SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER), + + // The following are concrete enum types. + SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS, // DebugInfo Sec 3.2. A mask. + SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING, // DebugInfo Sec 3.3 + SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE, // DebugInfo Sec 3.4 + SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER, // DebugInfo Sec 3.5 + SPV_OPERAND_TYPE_DEBUG_OPERATION, // DebugInfo Sec 3.6 + + // This is a sentinel value, and does not represent an operand type. + // It should come last. + SPV_OPERAND_TYPE_NUM_OPERAND_TYPES, + + SPV_FORCE_32_BIT_ENUM(spv_operand_type_t) +} spv_operand_type_t; + +typedef enum spv_ext_inst_type_t { + SPV_EXT_INST_TYPE_NONE = 0, + SPV_EXT_INST_TYPE_GLSL_STD_450, + SPV_EXT_INST_TYPE_OPENCL_STD, + SPV_EXT_INST_TYPE_SPV_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER, + SPV_EXT_INST_TYPE_SPV_AMD_SHADER_TRINARY_MINMAX, + SPV_EXT_INST_TYPE_SPV_AMD_GCN_SHADER, + SPV_EXT_INST_TYPE_SPV_AMD_SHADER_BALLOT, + SPV_EXT_INST_TYPE_DEBUGINFO, + + SPV_FORCE_32_BIT_ENUM(spv_ext_inst_type_t) +} spv_ext_inst_type_t; + +// This determines at a high level the kind of a binary-encoded literal +// number, but not the bit width. +// In principle, these could probably be folded into new entries in +// spv_operand_type_t. But then we'd have some special case differences +// between the assembler and disassembler. +typedef enum spv_number_kind_t { + SPV_NUMBER_NONE = 0, // The default for value initialization. + SPV_NUMBER_UNSIGNED_INT, + SPV_NUMBER_SIGNED_INT, + SPV_NUMBER_FLOATING, +} spv_number_kind_t; + +typedef enum spv_text_to_binary_options_t { + SPV_TEXT_TO_BINARY_OPTION_NONE = SPV_BIT(0), + // Numeric IDs in the binary will have the same values as in the source. + // Non-numeric IDs are allocated by filling in the gaps, starting with 1 + // and going up. + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS = SPV_BIT(1), + SPV_FORCE_32_BIT_ENUM(spv_text_to_binary_options_t) +} spv_text_to_binary_options_t; + +typedef enum spv_binary_to_text_options_t { + SPV_BINARY_TO_TEXT_OPTION_NONE = SPV_BIT(0), + SPV_BINARY_TO_TEXT_OPTION_PRINT = SPV_BIT(1), + SPV_BINARY_TO_TEXT_OPTION_COLOR = SPV_BIT(2), + SPV_BINARY_TO_TEXT_OPTION_INDENT = SPV_BIT(3), + SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET = SPV_BIT(4), + // Do not output the module header as leading comments in the assembly. + SPV_BINARY_TO_TEXT_OPTION_NO_HEADER = SPV_BIT(5), + // Use friendly names where possible. The heuristic may expand over + // time, but will use common names for scalar types, and debug names from + // OpName instructions. + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES = SPV_BIT(6), + SPV_FORCE_32_BIT_ENUM(spv_binary_to_text_options_t) +} spv_binary_to_text_options_t; + +// Structures + +// Information about an operand parsed from a binary SPIR-V module. +// Note that the values are not included. You still need access to the binary +// to extract the values. +typedef struct spv_parsed_operand_t { + // Location of the operand, in words from the start of the instruction. + uint16_t offset; + // Number of words occupied by this operand. + uint16_t num_words; + // The "concrete" operand type. See the definition of spv_operand_type_t + // for details. + spv_operand_type_t type; + // If type is a literal number type, then number_kind says whether it's + // a signed integer, an unsigned integer, or a floating point number. + spv_number_kind_t number_kind; + // The number of bits for a literal number type. + uint32_t number_bit_width; +} spv_parsed_operand_t; + +// An instruction parsed from a binary SPIR-V module. +typedef struct spv_parsed_instruction_t { + // An array of words for this instruction, in native endianness. + const uint32_t* words; + // The number of words in this instruction. + uint16_t num_words; + uint16_t opcode; + // The extended instruction type, if opcode is OpExtInst. Otherwise + // this is the "none" value. + spv_ext_inst_type_t ext_inst_type; + // The type id, or 0 if this instruction doesn't have one. + uint32_t type_id; + // The result id, or 0 if this instruction doesn't have one. + uint32_t result_id; + // The array of parsed operands. + const spv_parsed_operand_t* operands; + uint16_t num_operands; +} spv_parsed_instruction_t; + +typedef struct spv_const_binary_t { + const uint32_t* code; + const size_t wordCount; +} spv_const_binary_t; + +typedef struct spv_binary_t { + uint32_t* code; + size_t wordCount; +} spv_binary_t; + +typedef struct spv_text_t { + const char* str; + size_t length; +} spv_text_t; + +typedef struct spv_position_t { + size_t line; + size_t column; + size_t index; +} spv_position_t; + +typedef struct spv_diagnostic_t { + spv_position_t position; + char* error; + bool isTextSource; +} spv_diagnostic_t; + +// Opaque struct containing the context used to operate on a SPIR-V module. +// Its object is used by various translation API functions. +typedef struct spv_context_t spv_context_t; + +typedef struct spv_validator_options_t spv_validator_options_t; + +// Type Definitions + +typedef spv_const_binary_t* spv_const_binary; +typedef spv_binary_t* spv_binary; +typedef spv_text_t* spv_text; +typedef spv_position_t* spv_position; +typedef spv_diagnostic_t* spv_diagnostic; +typedef const spv_context_t* spv_const_context; +typedef spv_context_t* spv_context; +typedef spv_validator_options_t* spv_validator_options; +typedef const spv_validator_options_t* spv_const_validator_options; + +// Platform API + +// Returns the SPIRV-Tools software version as a null-terminated string. +// The contents of the underlying storage is valid for the remainder of +// the process. +SPIRV_TOOLS_EXPORT const char* spvSoftwareVersionString(void); +// Returns a null-terminated string containing the name of the project, +// the software version string, and commit details. +// The contents of the underlying storage is valid for the remainder of +// the process. +SPIRV_TOOLS_EXPORT const char* spvSoftwareVersionDetailsString(void); + +// Certain target environments impose additional restrictions on SPIR-V, so it's +// often necessary to specify which one applies. SPV_ENV_UNIVERSAL means +// environment-agnostic SPIR-V. +typedef enum { + SPV_ENV_UNIVERSAL_1_0, // SPIR-V 1.0 latest revision, no other restrictions. + SPV_ENV_VULKAN_1_0, // Vulkan 1.0 latest revision. + SPV_ENV_UNIVERSAL_1_1, // SPIR-V 1.1 latest revision, no other restrictions. + SPV_ENV_OPENCL_2_1, // OpenCL Full Profile 2.1 latest revision. + SPV_ENV_OPENCL_2_2, // OpenCL Full Profile 2.2 latest revision. + SPV_ENV_OPENGL_4_0, // OpenGL 4.0 plus GL_ARB_gl_spirv, latest revisions. + SPV_ENV_OPENGL_4_1, // OpenGL 4.1 plus GL_ARB_gl_spirv, latest revisions. + SPV_ENV_OPENGL_4_2, // OpenGL 4.2 plus GL_ARB_gl_spirv, latest revisions. + SPV_ENV_OPENGL_4_3, // OpenGL 4.3 plus GL_ARB_gl_spirv, latest revisions. + // There is no variant for OpenGL 4.4. + SPV_ENV_OPENGL_4_5, // OpenGL 4.5 plus GL_ARB_gl_spirv, latest revisions. + SPV_ENV_UNIVERSAL_1_2, // SPIR-V 1.2, latest revision, no other restrictions. + SPV_ENV_OPENCL_1_2, // OpenCL Full Profile 1.2 plus cl_khr_il_program, + // latest revision. + SPV_ENV_OPENCL_EMBEDDED_1_2, // OpenCL Embedded Profile 1.2 plus + // cl_khr_il_program, latest revision. + SPV_ENV_OPENCL_2_0, // OpenCL Full Profile 2.0 plus cl_khr_il_program, + // latest revision. + SPV_ENV_OPENCL_EMBEDDED_2_0, // OpenCL Embedded Profile 2.0 plus + // cl_khr_il_program, latest revision. + SPV_ENV_OPENCL_EMBEDDED_2_1, // OpenCL Embedded Profile 2.1 latest revision. + SPV_ENV_OPENCL_EMBEDDED_2_2, // OpenCL Embedded Profile 2.2 latest revision. + SPV_ENV_UNIVERSAL_1_3, // SPIR-V 1.3 latest revision, no other restrictions. + SPV_ENV_VULKAN_1_1, // Vulkan 1.1 latest revision. + SPV_ENV_WEBGPU_0, // Work in progress WebGPU 1.0. +} spv_target_env; + +// SPIR-V Validator can be parameterized with the following Universal Limits. +typedef enum { + spv_validator_limit_max_struct_members, + spv_validator_limit_max_struct_depth, + spv_validator_limit_max_local_variables, + spv_validator_limit_max_global_variables, + spv_validator_limit_max_switch_branches, + spv_validator_limit_max_function_args, + spv_validator_limit_max_control_flow_nesting_depth, + spv_validator_limit_max_access_chain_indexes, +} spv_validator_limit; + +// Returns a string describing the given SPIR-V target environment. +SPIRV_TOOLS_EXPORT const char* spvTargetEnvDescription(spv_target_env env); + +// Creates a context object. Returns null if env is invalid. +SPIRV_TOOLS_EXPORT spv_context spvContextCreate(spv_target_env env); + +// Destroys the given context object. +SPIRV_TOOLS_EXPORT void spvContextDestroy(spv_context context); + +// Creates a Validator options object with default options. Returns a valid +// options object. The object remains valid until it is passed into +// spvValidatorOptionsDestroy. +SPIRV_TOOLS_EXPORT spv_validator_options spvValidatorOptionsCreate(void); + +// Destroys the given Validator options object. +SPIRV_TOOLS_EXPORT void spvValidatorOptionsDestroy( + spv_validator_options options); + +// Records the maximum Universal Limit that is considered valid in the given +// Validator options object. argument must be a valid options object. +SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetUniversalLimit( + spv_validator_options options, spv_validator_limit limit_type, + uint32_t limit); + +// Record whether or not the validator should relax the rules on types for +// stores to structs. When relaxed, it will allow a type mismatch as long as +// the types are structs with the same layout. Two structs have the same layout +// if +// +// 1) the members of the structs are either the same type or are structs with +// same layout, and +// +// 2) the decorations that affect the memory layout are identical for both +// types. Other decorations are not relevant. +SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetRelaxStoreStruct( + spv_validator_options options, bool val); + +// Records whether or not the validator should relax the rules on pointer usage +// in logical addressing mode. +// +// When relaxed, it will allow the following usage cases of pointers: +// 1) OpVariable allocating an object whose type is a pointer type +// 2) OpReturnValue returning a pointer value +SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetRelaxLogicalPointer( + spv_validator_options options, bool val); + +// Records whether or not the validator should relax the rules on block layout. +// +// When relaxed, it will enable VK_KHR_relaxed_block_layout when validating +// standard uniform/storage block layout. +SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetRelaxBlockLayout( + spv_validator_options options, bool val); + +// Records whether or not the validator should skip validating standard +// uniform/storage block layout. +SPIRV_TOOLS_EXPORT void spvValidatorOptionsSetSkipBlockLayout( + spv_validator_options options, bool val); + +// Encodes the given SPIR-V assembly text to its binary representation. The +// length parameter specifies the number of bytes for text. Encoded binary will +// be stored into *binary. Any error will be written into *diagnostic if +// diagnostic is non-null. The generated binary is independent of the context +// and may outlive it. +SPIRV_TOOLS_EXPORT spv_result_t spvTextToBinary(const spv_const_context context, + const char* text, + const size_t length, + spv_binary* binary, + spv_diagnostic* diagnostic); + +// Encodes the given SPIR-V assembly text to its binary representation. Same as +// spvTextToBinary but with options. The options parameter is a bit field of +// spv_text_to_binary_options_t. +SPIRV_TOOLS_EXPORT spv_result_t spvTextToBinaryWithOptions( + const spv_const_context context, const char* text, const size_t length, + const uint32_t options, spv_binary* binary, spv_diagnostic* diagnostic); + +// Frees an allocated text stream. This is a no-op if the text parameter +// is a null pointer. +SPIRV_TOOLS_EXPORT void spvTextDestroy(spv_text text); + +// Decodes the given SPIR-V binary representation to its assembly text. The +// word_count parameter specifies the number of words for binary. The options +// parameter is a bit field of spv_binary_to_text_options_t. Decoded text will +// be stored into *text. Any error will be written into *diagnostic if +// diagnostic is non-null. +SPIRV_TOOLS_EXPORT spv_result_t spvBinaryToText(const spv_const_context context, + const uint32_t* binary, + const size_t word_count, + const uint32_t options, + spv_text* text, + spv_diagnostic* diagnostic); + +// Frees a binary stream from memory. This is a no-op if binary is a null +// pointer. +SPIRV_TOOLS_EXPORT void spvBinaryDestroy(spv_binary binary); + +// Validates a SPIR-V binary for correctness. Any errors will be written into +// *diagnostic if diagnostic is non-null. +SPIRV_TOOLS_EXPORT spv_result_t spvValidate(const spv_const_context context, + const spv_const_binary binary, + spv_diagnostic* diagnostic); + +// Validates a SPIR-V binary for correctness. Uses the provided Validator +// options. Any errors will be written into *diagnostic if diagnostic is +// non-null. +SPIRV_TOOLS_EXPORT spv_result_t spvValidateWithOptions( + const spv_const_context context, const spv_const_validator_options options, + const spv_const_binary binary, spv_diagnostic* diagnostic); + +// Validates a raw SPIR-V binary for correctness. Any errors will be written +// into *diagnostic if diagnostic is non-null. +SPIRV_TOOLS_EXPORT spv_result_t +spvValidateBinary(const spv_const_context context, const uint32_t* words, + const size_t num_words, spv_diagnostic* diagnostic); + +// Creates a diagnostic object. The position parameter specifies the location in +// the text/binary stream. The message parameter, copied into the diagnostic +// object, contains the error message to display. +SPIRV_TOOLS_EXPORT spv_diagnostic +spvDiagnosticCreate(const spv_position position, const char* message); + +// Destroys a diagnostic object. This is a no-op if diagnostic is a null +// pointer. +SPIRV_TOOLS_EXPORT void spvDiagnosticDestroy(spv_diagnostic diagnostic); + +// Prints the diagnostic to stderr. +SPIRV_TOOLS_EXPORT spv_result_t +spvDiagnosticPrint(const spv_diagnostic diagnostic); + +// The binary parser interface. + +// A pointer to a function that accepts a parsed SPIR-V header. +// The integer arguments are the 32-bit words from the header, as specified +// in SPIR-V 1.0 Section 2.3 Table 1. +// The function should return SPV_SUCCESS if parsing should continue. +typedef spv_result_t (*spv_parsed_header_fn_t)( + void* user_data, spv_endianness_t endian, uint32_t magic, uint32_t version, + uint32_t generator, uint32_t id_bound, uint32_t reserved); + +// A pointer to a function that accepts a parsed SPIR-V instruction. +// The parsed_instruction value is transient: it may be overwritten +// or released immediately after the function has returned. That also +// applies to the words array member of the parsed instruction. The +// function should return SPV_SUCCESS if and only if parsing should +// continue. +typedef spv_result_t (*spv_parsed_instruction_fn_t)( + void* user_data, const spv_parsed_instruction_t* parsed_instruction); + +// Parses a SPIR-V binary, specified as counted sequence of 32-bit words. +// Parsing feedback is provided via two callbacks provided as function +// pointers. Each callback function pointer can be a null pointer, in +// which case it is never called. Otherwise, in a valid parse the +// parsed-header callback is called once, and then the parsed-instruction +// callback once for each instruction in the stream. The user_data parameter +// is supplied as context to the callbacks. Returns SPV_SUCCESS on successful +// parse where the callbacks always return SPV_SUCCESS. For an invalid parse, +// returns a status code other than SPV_SUCCESS, and if diagnostic is non-null +// also emits a diagnostic. If a callback returns anything other than +// SPV_SUCCESS, then that status code is returned, no further callbacks are +// issued, and no additional diagnostics are emitted. +SPIRV_TOOLS_EXPORT spv_result_t spvBinaryParse( + const spv_const_context context, void* user_data, const uint32_t* words, + const size_t num_words, spv_parsed_header_fn_t parse_header, + spv_parsed_instruction_fn_t parse_instruction, spv_diagnostic* diagnostic); + +#ifdef __cplusplus +} +#endif + +#endif // INCLUDE_SPIRV_TOOLS_LIBSPIRV_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp new file mode 100644 index 00000000000..b6ae38c10b0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/libspirv.hpp @@ -0,0 +1,185 @@ +// Copyright (c) 2016 Google 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. + +#ifndef INCLUDE_SPIRV_TOOLS_LIBSPIRV_HPP_ +#define INCLUDE_SPIRV_TOOLS_LIBSPIRV_HPP_ + +#include +#include +#include +#include + +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// Message consumer. The C strings for source and message are only alive for the +// specific invocation. +using MessageConsumer = std::function; + +// C++ RAII wrapper around the C context object spv_context. +class Context { + public: + // Constructs a context targeting the given environment |env|. + // + // The constructed instance will have an empty message consumer, which just + // ignores all messages from the library. Use SetMessageConsumer() to supply + // one if messages are of concern. + explicit Context(spv_target_env env); + + // Enables move constructor/assignment operations. + Context(Context&& other); + Context& operator=(Context&& other); + + // Disables copy constructor/assignment operations. + Context(const Context&) = delete; + Context& operator=(const Context&) = delete; + + // Destructs this instance. + ~Context(); + + // Sets the message consumer to the given |consumer|. The |consumer| will be + // invoked once for each message communicated from the library. + void SetMessageConsumer(MessageConsumer consumer); + + // Returns the underlying spv_context. + spv_context& CContext(); + const spv_context& CContext() const; + + private: + spv_context context_; +}; + +// A RAII wrapper around a validator options object. +class ValidatorOptions { + public: + ValidatorOptions() : options_(spvValidatorOptionsCreate()) {} + ~ValidatorOptions() { spvValidatorOptionsDestroy(options_); } + // Allow implicit conversion to the underlying object. + operator spv_validator_options() const { return options_; } + + // Sets a limit. + void SetUniversalLimit(spv_validator_limit limit_type, uint32_t limit) { + spvValidatorOptionsSetUniversalLimit(options_, limit_type, limit); + } + + void SetRelaxStructStore(bool val) { + spvValidatorOptionsSetRelaxStoreStruct(options_, val); + } + + // Enables VK_KHR_relaxed_block_layout when validating standard + // uniform/storage buffer layout. + void SetRelaxBlockLayout(bool val) { + spvValidatorOptionsSetRelaxBlockLayout(options_, val); + } + + // Skips validating standard uniform/storage buffer layout. + void SetSkipBlockLayout(bool val) { + spvValidatorOptionsSetSkipBlockLayout(options_, val); + } + + // Records whether or not the validator should relax the rules on pointer + // usage in logical addressing mode. + // + // When relaxed, it will allow the following usage cases of pointers: + // 1) OpVariable allocating an object whose type is a pointer type + // 2) OpReturnValue returning a pointer value + void SetRelaxLogicalPointer(bool val) { + spvValidatorOptionsSetRelaxLogicalPointer(options_, val); + } + + private: + spv_validator_options options_; +}; + +// C++ interface for SPIRV-Tools functionalities. It wraps the context +// (including target environment and the corresponding SPIR-V grammar) and +// provides methods for assembling, disassembling, and validating. +// +// Instances of this class provide basic thread-safety guarantee. +class SpirvTools { + public: + enum { + // Default assembling option used by assemble(): + kDefaultAssembleOption = SPV_TEXT_TO_BINARY_OPTION_NONE, + + // Default disassembling option used by Disassemble(): + // * Avoid prefix comments from decoding the SPIR-V module header, and + // * Use friendly names for variables. + kDefaultDisassembleOption = SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES + }; + + // Constructs an instance targeting the given environment |env|. + // + // The constructed instance will have an empty message consumer, which just + // ignores all messages from the library. Use SetMessageConsumer() to supply + // one if messages are of concern. + explicit SpirvTools(spv_target_env env); + + // Disables copy/move constructor/assignment operations. + SpirvTools(const SpirvTools&) = delete; + SpirvTools(SpirvTools&&) = delete; + SpirvTools& operator=(const SpirvTools&) = delete; + SpirvTools& operator=(SpirvTools&&) = delete; + + // Destructs this instance. + ~SpirvTools(); + + // Sets the message consumer to the given |consumer|. The |consumer| will be + // invoked once for each message communicated from the library. + void SetMessageConsumer(MessageConsumer consumer); + + // Assembles the given assembly |text| and writes the result to |binary|. + // Returns true on successful assembling. |binary| will be kept untouched if + // assembling is unsuccessful. + bool Assemble(const std::string& text, std::vector* binary, + uint32_t options = kDefaultAssembleOption) const; + // |text_size| specifies the number of bytes in |text|. A terminating null + // character is not required to present in |text| as long as |text| is valid. + bool Assemble(const char* text, size_t text_size, + std::vector* binary, + uint32_t options = kDefaultAssembleOption) const; + + // Disassembles the given SPIR-V |binary| with the given |options| and writes + // the assembly to |text|. Returns ture on successful disassembling. |text| + // will be kept untouched if diassembling is unsuccessful. + bool Disassemble(const std::vector& binary, std::string* text, + uint32_t options = kDefaultDisassembleOption) const; + // |binary_size| specifies the number of words in |binary|. + bool Disassemble(const uint32_t* binary, size_t binary_size, + std::string* text, + uint32_t options = kDefaultDisassembleOption) const; + + // Validates the given SPIR-V |binary|. Returns true if no issues are found. + // Otherwise, returns false and communicates issues via the message consumer + // registered. + bool Validate(const std::vector& binary) const; + // |binary_size| specifies the number of words in |binary|. + bool Validate(const uint32_t* binary, size_t binary_size) const; + // Like the previous overload, but takes an options object. + bool Validate(const uint32_t* binary, size_t binary_size, + const ValidatorOptions& options) const; + + private: + struct Impl; // Opaque struct for holding the data fields used by this class. + std::unique_ptr impl_; // Unique pointer to implementation data. +}; + +} // namespace spvtools + +#endif // INCLUDE_SPIRV_TOOLS_LIBSPIRV_HPP_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp new file mode 100644 index 00000000000..d2f3e72ca2a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/linker.hpp @@ -0,0 +1,97 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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_SPIRV_TOOLS_LINKER_HPP_ +#define INCLUDE_SPIRV_TOOLS_LINKER_HPP_ + +#include + +#include +#include + +#include "libspirv.hpp" + +namespace spvtools { + +class LinkerOptions { + public: + LinkerOptions() + : create_library_(false), + verify_ids_(false), + allow_partial_linkage_(false) {} + + // Returns whether a library or an executable should be produced by the + // linking phase. + // + // All exported symbols are kept when creating a library, whereas they will + // be removed when creating an executable. + // The returned value will be true if creating a library, and false if + // creating an executable. + bool GetCreateLibrary() const { return create_library_; } + + // Sets whether a library or an executable should be produced. + void SetCreateLibrary(bool create_library) { + create_library_ = create_library; + } + + // Returns whether to verify the uniqueness of the unique ids in the merged + // context. + bool GetVerifyIds() const { return verify_ids_; } + + // Sets whether to verify the uniqueness of the unique ids in the merged + // context. + void SetVerifyIds(bool verify_ids) { verify_ids_ = verify_ids; } + + // Returns whether to allow for imported symbols to have no corresponding + // exported symbols + bool GetAllowPartialLinkage() const { return allow_partial_linkage_; } + + // Sets whether to allow for imported symbols to have no corresponding + // exported symbols + void SetAllowPartialLinkage(bool allow_partial_linkage) { + allow_partial_linkage_ = allow_partial_linkage; + } + + private: + bool create_library_; + bool verify_ids_; + bool allow_partial_linkage_; +}; + +// Links one or more SPIR-V modules into a new SPIR-V module. That is, combine +// several SPIR-V modules into one, resolving link dependencies between them. +// +// At least one binary has to be provided in |binaries|. Those binaries do not +// have to be valid, but they should be at least parseable. +// The functions can fail due to the following: +// * The given context was not initialised using `spvContextCreate()`; +// * No input modules were given; +// * One or more of those modules were not parseable; +// * The input modules used different addressing or memory models; +// * The ID or global variable number limit were exceeded; +// * Some entry points were defined multiple times; +// * Some imported symbols did not have an exported counterpart; +// * Possibly other reasons. +spv_result_t Link(const Context& context, + const std::vector>& binaries, + std::vector* linked_binary, + const LinkerOptions& options = LinkerOptions()); +spv_result_t Link(const Context& context, const uint32_t* const* binaries, + const size_t* binary_sizes, size_t num_binaries, + std::vector* linked_binary, + const LinkerOptions& options = LinkerOptions()); + +} // namespace spvtools + +#endif // INCLUDE_SPIRV_TOOLS_LINKER_HPP_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp new file mode 100644 index 00000000000..4364d9ff50d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/include/spirv-tools/optimizer.hpp @@ -0,0 +1,655 @@ +// Copyright (c) 2016 Google 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. + +#ifndef INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ +#define INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ + +#include +#include +#include +#include +#include + +#include "libspirv.hpp" + +namespace spvtools { + +namespace opt { +class Pass; +} + +// C++ interface for SPIR-V optimization functionalities. It wraps the context +// (including target environment and the corresponding SPIR-V grammar) and +// provides methods for registering optimization passes and optimizing. +// +// Instances of this class provides basic thread-safety guarantee. +class Optimizer { + public: + // The token for an optimization pass. It is returned via one of the + // Create*Pass() standalone functions at the end of this header file and + // consumed by the RegisterPass() method. Tokens are one-time objects that + // only support move; copying is not allowed. + struct PassToken { + struct Impl; // Opaque struct for holding inernal data. + + PassToken(std::unique_ptr); + + // Tokens for built-in passes should be created using Create*Pass functions + // below; for out-of-tree passes, use this constructor instead. + // Note that this API isn't guaranteed to be stable and may change without + // preserving source or binary compatibility in the future. + PassToken(std::unique_ptr&& pass); + + // Tokens can only be moved. Copying is disabled. + PassToken(const PassToken&) = delete; + PassToken(PassToken&&); + PassToken& operator=(const PassToken&) = delete; + PassToken& operator=(PassToken&&); + + ~PassToken(); + + std::unique_ptr impl_; // Unique pointer to internal data. + }; + + // Constructs an instance with the given target |env|, which is used to decode + // the binaries to be optimized later. + // + // The constructed instance will have an empty message consumer, which just + // ignores all messages from the library. Use SetMessageConsumer() to supply + // one if messages are of concern. + explicit Optimizer(spv_target_env env); + + // Disables copy/move constructor/assignment operations. + Optimizer(const Optimizer&) = delete; + Optimizer(Optimizer&&) = delete; + Optimizer& operator=(const Optimizer&) = delete; + Optimizer& operator=(Optimizer&&) = delete; + + // Destructs this instance. + ~Optimizer(); + + // Sets the message consumer to the given |consumer|. The |consumer| will be + // invoked once for each message communicated from the library. + void SetMessageConsumer(MessageConsumer consumer); + + // Returns a reference to the registered message consumer. + const MessageConsumer& consumer() const; + + // Registers the given |pass| to this optimizer. Passes will be run in the + // exact order of registration. The token passed in will be consumed by this + // method. + Optimizer& RegisterPass(PassToken&& pass); + + // Registers passes that attempt to improve performance of generated code. + // This sequence of passes is subject to constant review and will change + // from time to time. + Optimizer& RegisterPerformancePasses(); + + // Registers passes that attempt to improve the size of generated code. + // This sequence of passes is subject to constant review and will change + // from time to time. + Optimizer& RegisterSizePasses(); + + // Registers passes that attempt to legalize the generated code. + // + // Note: this recipe is specially designed for legalizing SPIR-V. It should be + // used by compilers after translating HLSL source code literally. It should + // *not* be used by general workloads for performance or size improvement. + // + // This sequence of passes is subject to constant review and will change + // from time to time. + Optimizer& RegisterLegalizationPasses(); + + // Register passes specified in the list of |flags|. Each flag must be a + // string of a form accepted by Optimizer::FlagHasValidForm(). + // + // If the list of flags contains an invalid entry, it returns false and an + // error message is emitted to the MessageConsumer object (use + // Optimizer::SetMessageConsumer to define a message consumer, if needed). + // + // If all the passes are registered successfully, it returns true. + bool RegisterPassesFromFlags(const std::vector& flags); + + // Registers the optimization pass associated with |flag|. This only accepts + // |flag| values of the form "--pass_name[=pass_args]". If no such pass + // exists, it returns false. Otherwise, the pass is registered and it returns + // true. + // + // The following flags have special meaning: + // + // -O: Registers all performance optimization passes + // (Optimizer::RegisterPerformancePasses) + // + // -Os: Registers all size optimization passes + // (Optimizer::RegisterSizePasses). + // + // --legalize-hlsl: Registers all passes that legalize SPIR-V generated by an + // HLSL front-end. + bool RegisterPassFromFlag(const std::string& flag); + + // Validates that |flag| has a valid format. Strings accepted: + // + // --pass_name[=pass_args] + // -O + // -Os + // + // If |flag| takes one of the forms above, it returns true. Otherwise, it + // returns false. + bool FlagHasValidForm(const std::string& flag) const; + + // Optimizes the given SPIR-V module |original_binary| and writes the + // optimized binary into |optimized_binary|. + // Returns true on successful optimization, whether or not the module is + // modified. Returns false if |original_binary| fails to validate or if errors + // occur when processing |original_binary| using any of the registered passes. + // In that case, no further passes are executed and the contents in + // |optimized_binary| may be invalid. + // + // It's allowed to alias |original_binary| to the start of |optimized_binary|. + bool Run(const uint32_t* original_binary, size_t original_binary_size, + std::vector* optimized_binary) const; + + // Same as above, except passes |options| to the validator when trying to + // validate the binary. If |skip_validation| is true, then the caller is + // guaranteeing that |original_binary| is valid, and the validator will not + // be run. + bool Run(const uint32_t* original_binary, const size_t original_binary_size, + std::vector* optimized_binary, + const ValidatorOptions& options, bool skip_validation = false) const; + + // Returns a vector of strings with all the pass names added to this + // optimizer's pass manager. These strings are valid until the associated + // pass manager is destroyed. + std::vector GetPassNames() const; + + // Sets the option to print the disassembly before each pass and after the + // last pass. If |out| is null, then no output is generated. Otherwise, + // output is sent to the |out| output stream. + Optimizer& SetPrintAll(std::ostream* out); + + // Sets the option to print the resource utilization of each pass. If |out| + // is null, then no output is generated. Otherwise, output is sent to the + // |out| output stream. + Optimizer& SetTimeReport(std::ostream* out); + + private: + struct Impl; // Opaque struct for holding internal data. + std::unique_ptr impl_; // Unique pointer to internal data. +}; + +// Creates a null pass. +// A null pass does nothing to the SPIR-V module to be optimized. +Optimizer::PassToken CreateNullPass(); + +// Creates a strip-debug-info pass. +// A strip-debug-info pass removes all debug instructions (as documented in +// Section 3.32.2 of the SPIR-V spec) of the SPIR-V module to be optimized. +Optimizer::PassToken CreateStripDebugInfoPass(); + +// Creates a strip-reflect-info pass. +// A strip-reflect-info pass removes all reflections instructions. +// For now, this is limited to removing decorations defined in +// SPV_GOOGLE_hlsl_functionality1. The coverage may expand in +// the future. +Optimizer::PassToken CreateStripReflectInfoPass(); + +// Creates an eliminate-dead-functions pass. +// An eliminate-dead-functions pass will remove all functions that are not in +// the call trees rooted at entry points and exported functions. These +// functions are not needed because they will never be called. +Optimizer::PassToken CreateEliminateDeadFunctionsPass(); + +// Creates a set-spec-constant-default-value pass from a mapping from spec-ids +// to the default values in the form of string. +// A set-spec-constant-default-value pass sets the default values for the +// spec constants that have SpecId decorations (i.e., those defined by +// OpSpecConstant{|True|False} instructions). +Optimizer::PassToken CreateSetSpecConstantDefaultValuePass( + const std::unordered_map& id_value_map); + +// Creates a set-spec-constant-default-value pass from a mapping from spec-ids +// to the default values in the form of bit pattern. +// A set-spec-constant-default-value pass sets the default values for the +// spec constants that have SpecId decorations (i.e., those defined by +// OpSpecConstant{|True|False} instructions). +Optimizer::PassToken CreateSetSpecConstantDefaultValuePass( + const std::unordered_map>& id_value_map); + +// Creates a flatten-decoration pass. +// A flatten-decoration pass replaces grouped decorations with equivalent +// ungrouped decorations. That is, it replaces each OpDecorationGroup +// instruction and associated OpGroupDecorate and OpGroupMemberDecorate +// instructions with equivalent OpDecorate and OpMemberDecorate instructions. +// The pass does not attempt to preserve debug information for instructions +// it removes. +Optimizer::PassToken CreateFlattenDecorationPass(); + +// Creates a freeze-spec-constant-value pass. +// A freeze-spec-constant pass specializes the value of spec constants to +// their default values. This pass only processes the spec constants that have +// SpecId decorations (defined by OpSpecConstant, OpSpecConstantTrue, or +// OpSpecConstantFalse instructions) and replaces them with their normal +// counterparts (OpConstant, OpConstantTrue, or OpConstantFalse). The +// corresponding SpecId annotation instructions will also be removed. This +// pass does not fold the newly added normal constants and does not process +// other spec constants defined by OpSpecConstantComposite or +// OpSpecConstantOp. +Optimizer::PassToken CreateFreezeSpecConstantValuePass(); + +// Creates a fold-spec-constant-op-and-composite pass. +// A fold-spec-constant-op-and-composite pass folds spec constants defined by +// OpSpecConstantOp or OpSpecConstantComposite instruction, to normal Constants +// defined by OpConstantTrue, OpConstantFalse, OpConstant, OpConstantNull, or +// OpConstantComposite instructions. Note that spec constants defined with +// OpSpecConstant, OpSpecConstantTrue, or OpSpecConstantFalse instructions are +// not handled, as these instructions indicate their value are not determined +// and can be changed in future. A spec constant is foldable if all of its +// value(s) can be determined from the module. E.g., an integer spec constant +// defined with OpSpecConstantOp instruction can be folded if its value won't +// change later. This pass will replace the original OpSpecContantOp instruction +// with an OpConstant instruction. When folding composite spec constants, +// new instructions may be inserted to define the components of the composite +// constant first, then the original spec constants will be replaced by +// OpConstantComposite instructions. +// +// There are some operations not supported yet: +// OpSConvert, OpFConvert, OpQuantizeToF16 and +// all the operations under Kernel capability. +// TODO(qining): Add support for the operations listed above. +Optimizer::PassToken CreateFoldSpecConstantOpAndCompositePass(); + +// Creates a unify-constant pass. +// A unify-constant pass de-duplicates the constants. Constants with the exact +// same value and identical form will be unified and only one constant will +// be kept for each unique pair of type and value. +// There are several cases not handled by this pass: +// 1) Constants defined by OpConstantNull instructions (null constants) and +// constants defined by OpConstantFalse, OpConstant or OpConstantComposite +// with value 0 (zero-valued normal constants) are not considered equivalent. +// So null constants won't be used to replace zero-valued normal constants, +// vice versa. +// 2) Whenever there are decorations to the constant's result id id, the +// constant won't be handled, which means, it won't be used to replace any +// other constants, neither can other constants replace it. +// 3) NaN in float point format with different bit patterns are not unified. +Optimizer::PassToken CreateUnifyConstantPass(); + +// Creates a eliminate-dead-constant pass. +// A eliminate-dead-constant pass removes dead constants, including normal +// contants defined by OpConstant, OpConstantComposite, OpConstantTrue, or +// OpConstantFalse and spec constants defined by OpSpecConstant, +// OpSpecConstantComposite, OpSpecConstantTrue, OpSpecConstantFalse or +// OpSpecConstantOp. +Optimizer::PassToken CreateEliminateDeadConstantPass(); + +// Creates a strength-reduction pass. +// A strength-reduction pass will look for opportunities to replace an +// instruction with an equivalent and less expensive one. For example, +// multiplying by a power of 2 can be replaced by a bit shift. +Optimizer::PassToken CreateStrengthReductionPass(); + +// Creates a block merge pass. +// This pass searches for blocks with a single Branch to a block with no +// other predecessors and merges the blocks into a single block. Continue +// blocks and Merge blocks are not candidates for the second block. +// +// The pass is most useful after Dead Branch Elimination, which can leave +// such sequences of blocks. Merging them makes subsequent passes more +// effective, such as single block local store-load elimination. +// +// While this pass reduces the number of occurrences of this sequence, at +// this time it does not guarantee all such sequences are eliminated. +// +// Presence of phi instructions can inhibit this optimization. Handling +// these is left for future improvements. +Optimizer::PassToken CreateBlockMergePass(); + +// Creates an exhaustive inline pass. +// An exhaustive inline pass attempts to exhaustively inline all function +// calls in all functions in an entry point call tree. The intent is to enable, +// albeit through brute force, analysis and optimization across function +// calls by subsequent optimization passes. As the inlining is exhaustive, +// there is no attempt to optimize for size or runtime performance. Functions +// that are not in the call tree of an entry point are not changed. +Optimizer::PassToken CreateInlineExhaustivePass(); + +// Creates an opaque inline pass. +// An opaque inline pass inlines all function calls in all functions in all +// entry point call trees where the called function contains an opaque type +// in either its parameter types or return type. An opaque type is currently +// defined as Image, Sampler or SampledImage. The intent is to enable, albeit +// through brute force, analysis and optimization across these function calls +// by subsequent passes in order to remove the storing of opaque types which is +// not legal in Vulkan. Functions that are not in the call tree of an entry +// point are not changed. +Optimizer::PassToken CreateInlineOpaquePass(); + +// Creates a single-block local variable load/store elimination pass. +// For every entry point function, do single block memory optimization of +// function variables referenced only with non-access-chain loads and stores. +// For each targeted variable load, if previous store to that variable in the +// block, replace the load's result id with the value id of the store. +// If previous load within the block, replace the current load's result id +// with the previous load's result id. In either case, delete the current +// load. Finally, check if any remaining stores are useless, and delete store +// and variable if possible. +// +// The presence of access chain references and function calls can inhibit +// the above optimization. +// +// Only modules with relaxed logical addressing (see opt/instruction.h) are +// currently processed. +// +// This pass is most effective if preceeded by Inlining and +// LocalAccessChainConvert. This pass will reduce the work needed to be done +// by LocalSingleStoreElim and LocalMultiStoreElim. +// +// Only functions in the call tree of an entry point are processed. +Optimizer::PassToken CreateLocalSingleBlockLoadStoreElimPass(); + +// Create dead branch elimination pass. +// For each entry point function, this pass will look for SelectionMerge +// BranchConditionals with constant condition and convert to a Branch to +// the indicated label. It will delete resulting dead blocks. +// +// For all phi functions in merge block, replace all uses with the id +// corresponding to the living predecessor. +// +// Note that some branches and blocks may be left to avoid creating invalid +// control flow. Improving this is left to future work. +// +// This pass is most effective when preceeded by passes which eliminate +// local loads and stores, effectively propagating constant values where +// possible. +Optimizer::PassToken CreateDeadBranchElimPass(); + +// Creates an SSA local variable load/store elimination pass. +// For every entry point function, eliminate all loads and stores of function +// scope variables only referenced with non-access-chain loads and stores. +// Eliminate the variables as well. +// +// The presence of access chain references and function calls can inhibit +// the above optimization. +// +// Only shader modules with relaxed logical addressing (see opt/instruction.h) +// are currently processed. Currently modules with any extensions enabled are +// not processed. This is left for future work. +// +// This pass is most effective if preceeded by Inlining and +// LocalAccessChainConvert. LocalSingleStoreElim and LocalSingleBlockElim +// will reduce the work that this pass has to do. +Optimizer::PassToken CreateLocalMultiStoreElimPass(); + +// Creates a local access chain conversion pass. +// A local access chain conversion pass identifies all function scope +// variables which are accessed only with loads, stores and access chains +// with constant indices. It then converts all loads and stores of such +// variables into equivalent sequences of loads, stores, extracts and inserts. +// +// This pass only processes entry point functions. It currently only converts +// non-nested, non-ptr access chains. It does not process modules with +// non-32-bit integer types present. Optional memory access options on loads +// and stores are ignored as we are only processing function scope variables. +// +// This pass unifies access to these variables to a single mode and simplifies +// subsequent analysis and elimination of these variables along with their +// loads and stores allowing values to propagate to their points of use where +// possible. +Optimizer::PassToken CreateLocalAccessChainConvertPass(); + +// Creates a local single store elimination pass. +// For each entry point function, this pass eliminates loads and stores for +// function scope variable that are stored to only once, where possible. Only +// whole variable loads and stores are eliminated; access-chain references are +// not optimized. Replace all loads of such variables with the value that is +// stored and eliminate any resulting dead code. +// +// Currently, the presence of access chains and function calls can inhibit this +// pass, however the Inlining and LocalAccessChainConvert passes can make it +// more effective. In additional, many non-load/store memory operations are +// not supported and will prohibit optimization of a function. Support of +// these operations are future work. +// +// Only shader modules with relaxed logical addressing (see opt/instruction.h) +// are currently processed. +// +// This pass will reduce the work needed to be done by LocalSingleBlockElim +// and LocalMultiStoreElim and can improve the effectiveness of other passes +// such as DeadBranchElimination which depend on values for their analysis. +Optimizer::PassToken CreateLocalSingleStoreElimPass(); + +// Creates an insert/extract elimination pass. +// This pass processes each entry point function in the module, searching for +// extracts on a sequence of inserts. It further searches the sequence for an +// insert with indices identical to the extract. If such an insert can be +// found before hitting a conflicting insert, the extract's result id is +// replaced with the id of the values from the insert. +// +// Besides removing extracts this pass enables subsequent dead code elimination +// passes to delete the inserts. This pass performs best after access chains are +// converted to inserts and extracts and local loads and stores are eliminated. +Optimizer::PassToken CreateInsertExtractElimPass(); + +// Creates a dead insert elimination pass. +// This pass processes each entry point function in the module, searching for +// unreferenced inserts into composite types. These are most often unused +// stores to vector components. They are unused because they are never +// referenced, or because there is another insert to the same component between +// the insert and the reference. After removing the inserts, dead code +// elimination is attempted on the inserted values. +// +// This pass performs best after access chains are converted to inserts and +// extracts and local loads and stores are eliminated. While executing this +// pass can be advantageous on its own, it is also advantageous to execute +// this pass after CreateInsertExtractPass() as it will remove any unused +// inserts created by that pass. +Optimizer::PassToken CreateDeadInsertElimPass(); + +// Creates a pass to consolidate uniform references. +// For each entry point function in the module, first change all constant index +// access chain loads into equivalent composite extracts. Then consolidate +// identical uniform loads into one uniform load. Finally, consolidate +// identical uniform extracts into one uniform extract. This may require +// moving a load or extract to a point which dominates all uses. +// +// This pass requires a module to have structured control flow ie shader +// capability. It also requires logical addressing ie Addresses capability +// is not enabled. It also currently does not support any extensions. +// +// This pass currently only optimizes loads with a single index. +Optimizer::PassToken CreateCommonUniformElimPass(); + +// Create aggressive dead code elimination pass +// This pass eliminates unused code from the module. In addition, +// it detects and eliminates code which may have spurious uses but which do +// not contribute to the output of the function. The most common cause of +// such code sequences is summations in loops whose result is no longer used +// due to dead code elimination. This optimization has additional compile +// time cost over standard dead code elimination. +// +// This pass only processes entry point functions. It also only processes +// shaders with relaxed logical addressing (see opt/instruction.h). It +// currently will not process functions with function calls. Unreachable +// functions are deleted. +// +// This pass will be made more effective by first running passes that remove +// dead control flow and inlines function calls. +// +// This pass can be especially useful after running Local Access Chain +// Conversion, which tends to cause cycles of dead code to be left after +// Store/Load elimination passes are completed. These cycles cannot be +// eliminated with standard dead code elimination. +Optimizer::PassToken CreateAggressiveDCEPass(); + +// Creates a compact ids pass. +// The pass remaps result ids to a compact and gapless range starting from %1. +Optimizer::PassToken CreateCompactIdsPass(); + +// Creates a remove duplicate pass. +// This pass removes various duplicates: +// * duplicate capabilities; +// * duplicate extended instruction imports; +// * duplicate types; +// * duplicate decorations. +Optimizer::PassToken CreateRemoveDuplicatesPass(); + +// Creates a CFG cleanup pass. +// This pass removes cruft from the control flow graph of functions that are +// reachable from entry points and exported functions. It currently includes the +// following functionality: +// +// - Removal of unreachable basic blocks. +Optimizer::PassToken CreateCFGCleanupPass(); + +// Create dead variable elimination pass. +// This pass will delete module scope variables, along with their decorations, +// that are not referenced. +Optimizer::PassToken CreateDeadVariableEliminationPass(); + +// create merge return pass. +// changes functions that have multiple return statements so they have a single +// return statement. +// +// for structured control flow it is assumed that the only unreachable blocks in +// the function are trivial merge and continue blocks. +// +// a trivial merge block contains the label and an opunreachable instructions, +// nothing else. a trivial continue block contain a label and an opbranch to +// the header, nothing else. +// +// these conditions are guaranteed to be met after running dead-branch +// elimination. +Optimizer::PassToken CreateMergeReturnPass(); + +// Create value numbering pass. +// This pass will look for instructions in the same basic block that compute the +// same value, and remove the redundant ones. +Optimizer::PassToken CreateLocalRedundancyEliminationPass(); + +// Create LICM pass. +// This pass will look for invariant instructions inside loops and hoist them to +// the loops preheader. +Optimizer::PassToken CreateLoopInvariantCodeMotionPass(); + +// Creates a loop fission pass. +// This pass will split all top level loops whose register pressure exceedes the +// given |threshold|. +Optimizer::PassToken CreateLoopFissionPass(size_t threshold); + +// Creates a loop fusion pass. +// This pass will look for adjacent loops that are compatible and legal to be +// fused. The fuse all such loops as long as the register usage for the fused +// loop stays under the threshold defined by |max_registers_per_loop|. +Optimizer::PassToken CreateLoopFusionPass(size_t max_registers_per_loop); + +// Creates a loop peeling pass. +// This pass will look for conditions inside a loop that are true or false only +// for the N first or last iteration. For loop with such condition, those N +// iterations of the loop will be executed outside of the main loop. +// To limit code size explosion, the loop peeling can only happen if the code +// size growth for each loop is under |code_growth_threshold|. +Optimizer::PassToken CreateLoopPeelingPass(); + +// Creates a loop unswitch pass. +// This pass will look for loop independent branch conditions and move the +// condition out of the loop and version the loop based on the taken branch. +// Works best after LICM and local multi store elimination pass. +Optimizer::PassToken CreateLoopUnswitchPass(); + +// Create global value numbering pass. +// This pass will look for instructions where the same value is computed on all +// paths leading to the instruction. Those instructions are deleted. +Optimizer::PassToken CreateRedundancyEliminationPass(); + +// Create scalar replacement pass. +// This pass replaces composite function scope variables with variables for each +// element if those elements are accessed individually. The parameter is a +// limit on the number of members in the composite variable that the pass will +// consider replacing. +Optimizer::PassToken CreateScalarReplacementPass(uint32_t size_limit = 100); + +// Create a private to local pass. +// This pass looks for variables delcared in the private storage class that are +// used in only one function. Those variables are moved to the function storage +// class in the function that they are used. +Optimizer::PassToken CreatePrivateToLocalPass(); + +// Creates a conditional constant propagation (CCP) pass. +// This pass implements the SSA-CCP algorithm in +// +// Constant propagation with conditional branches, +// Wegman and Zadeck, ACM TOPLAS 13(2):181-210. +// +// Constant values in expressions and conditional jumps are folded and +// simplified. This may reduce code size by removing never executed jump targets +// and computations with constant operands. +Optimizer::PassToken CreateCCPPass(); + +// Creates a workaround driver bugs pass. This pass attempts to work around +// a known driver bug (issue #1209) by identifying the bad code sequences and +// rewriting them. +// +// Current workaround: Avoid OpUnreachable instructions in loops. +Optimizer::PassToken CreateWorkaround1209Pass(); + +// Creates a pass that converts if-then-else like assignments into OpSelect. +Optimizer::PassToken CreateIfConversionPass(); + +// Creates a pass that will replace instructions that are not valid for the +// current shader stage by constants. Has no effect on non-shader modules. +Optimizer::PassToken CreateReplaceInvalidOpcodePass(); + +// Creates a pass that simplifies instructions using the instruction folder. +Optimizer::PassToken CreateSimplificationPass(); + +// Create loop unroller pass. +// Creates a pass to unroll loops which have the "Unroll" loop control +// mask set. The loops must meet a specific criteria in order to be unrolled +// safely this criteria is checked before doing the unroll by the +// LoopUtils::CanPerformUnroll method. Any loop that does not meet the criteria +// won't be unrolled. See CanPerformUnroll LoopUtils.h for more information. +Optimizer::PassToken CreateLoopUnrollPass(bool fully_unroll, int factor = 0); + +// Create the SSA rewrite pass. +// This pass converts load/store operations on function local variables into +// operations on SSA IDs. This allows SSA optimizers to act on these variables. +// Only variables that are local to the function and of supported types are +// processed (see IsSSATargetVar for details). +Optimizer::PassToken CreateSSARewritePass(); + +// Create copy propagate arrays pass. +// This pass looks to copy propagate memory references for arrays. It looks +// for specific code patterns to recognize array copies. +Optimizer::PassToken CreateCopyPropagateArraysPass(); + +// Create a vector dce pass. +// This pass looks for components of vectors that are unused, and removes them +// from the vector. Note this would still leave around lots of dead code that +// a pass of ADCE will be able to remove. +Optimizer::PassToken CreateVectorDCEPass(); + +// Create a pass to reduce the size of loads. +// This pass looks for loads of structures where only a few of its members are +// used. It replaces the loads feeding an OpExtract with an OpAccessChain and +// a load of the specific elements. +Optimizer::PassToken CreateReduceLoadSizePass(); + +// Create a pass to combine chained access chains. +// This pass looks for access chains fed by other access chains and combines +// them into a single instruction where possible. +Optimizer::PassToken CreateCombineAccessChainsPass(); + +} // namespace spvtools + +#endif // INCLUDE_SPIRV_TOOLS_OPTIMIZER_HPP_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/build.sh new file mode 100644 index 00000000000..e31744fd15d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/build.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Android Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +BUILD_ROOT=$PWD +SRC=$PWD/github/SPIRV-Tools +TARGET_ARCH="armeabi-v7a with NEON" +export ANDROID_NDK=/opt/android-ndk-r15c + +# Get NINJA. +wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip +unzip -q ninja-linux.zip +export PATH="$PWD:$PATH" +git clone --depth=1 https://github.com/taka-no-me/android-cmake.git android-cmake +export TOOLCHAIN_PATH=$PWD/android-cmake/android.toolchain.cmake + + +cd $SRC +git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers +git clone --depth=1 https://github.com/google/googletest external/googletest +git clone --depth=1 https://github.com/google/effcee external/effcee +git clone --depth=1 https://github.com/google/re2 external/re2 + +mkdir build && cd $SRC/build + +# Invoke the build. +BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} +echo $(date): Starting build... +cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_NATIVE_API_LEVEL=android-14 -DANDROID_ABI="armeabi-v7a with NEON" -DSPIRV_BUILD_COMPRESSION=ON -DSPIRV_SKIP_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_PATH -GNinja -DANDROID_NDK=$ANDROID_NDK .. + +echo $(date): Build everything... +ninja +echo $(date): Build completed. diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/continuous.cfg new file mode 100644 index 00000000000..3bdb17a57c9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/continuous.cfg @@ -0,0 +1,17 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +# +build_file: "SPIRV-Tools/kokoro/android/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/presubmit.cfg new file mode 100644 index 00000000000..21589ccc1c7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/android/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/android/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/check-format/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/check-format/build.sh new file mode 100644 index 00000000000..2a8d50fb56e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/check-format/build.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Android Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +BUILD_ROOT=$PWD +SRC=$PWD/github/SPIRV-Tools + +# Get clang-format-5.0.0. +# Once kokoro upgrades the Ubuntu VMs, we can use 'apt-get install clang-format' +curl -L http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04.tar.xz -o clang-llvm.tar.xz +tar xf clang-llvm.tar.xz +export PATH=$PWD/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin:$PATH + +cd $SRC +git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers +git clone --depth=1 https://github.com/google/googletest external/googletest +git clone --depth=1 https://github.com/google/effcee external/effcee +git clone --depth=1 https://github.com/google/re2 external/re2 +curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o utils/clang-format-diff.py; + +echo $(date): Check formatting... +./utils/check_code_format.sh; +echo $(date): check completed. diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/check-format/presubmit_check_format.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/check-format/presubmit_check_format.cfg new file mode 100644 index 00000000000..1993289d6ae --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/check-format/presubmit_check_format.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/check-format/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/linux.png b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/linux.png new file mode 100644 index 00000000000..ff066d979e1 Binary files /dev/null and b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/linux.png differ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/macos.png b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/macos.png new file mode 100644 index 00000000000..d1349c0928e Binary files /dev/null and b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/macos.png differ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/windows.png b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/windows.png new file mode 100644 index 00000000000..a3784699905 Binary files /dev/null and b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/img/windows.png differ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/build.sh new file mode 100644 index 00000000000..11b2968a600 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG clang diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/continuous.cfg new file mode 100644 index 00000000000..e92f059ed51 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/linux-clang-debug/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/presubmit.cfg new file mode 100644 index 00000000000..5011b445e78 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-debug/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/linux-clang-debug/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/build.sh new file mode 100644 index 00000000000..47643317150 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE clang diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/continuous.cfg new file mode 100644 index 00000000000..687434accdd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/linux-clang-release/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/presubmit.cfg new file mode 100644 index 00000000000..b7b9b5594bf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-clang-release/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/linux-clang-release/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/build.sh new file mode 100644 index 00000000000..3ef1e251b71 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG gcc diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/continuous.cfg new file mode 100644 index 00000000000..4f8418d84c4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/linux-gcc-debug/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/presubmit.cfg new file mode 100644 index 00000000000..2d9fe5c9973 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-debug/presubmit.cfg @@ -0,0 +1,17 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/linux-gcc-debug/build.sh" + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/build.sh new file mode 100644 index 00000000000..3e97d8d3b96 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE gcc diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/continuous.cfg new file mode 100644 index 00000000000..41a0024e780 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/linux-gcc-release/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/presubmit.cfg new file mode 100644 index 00000000000..c249a5ab043 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/linux-gcc-release/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/linux-gcc-release/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/build.sh new file mode 100644 index 00000000000..8d9a062f627 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# MacOS Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/macos/build.sh Debug + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/continuous.cfg new file mode 100644 index 00000000000..84aaa5c2588 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/macos-clang-debug/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/presubmit.cfg new file mode 100644 index 00000000000..1d2f60da9a9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-debug/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/macos-clang-debug/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/build.sh new file mode 100644 index 00000000000..ccc8b16aa00 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# MacOS Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +SCRIPT_DIR=`dirname "$BASH_SOURCE"` +source $SCRIPT_DIR/../scripts/macos/build.sh RelWithDebInfo + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/continuous.cfg new file mode 100644 index 00000000000..a8e23a71aa2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/macos-clang-release/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/presubmit.cfg new file mode 100644 index 00000000000..dbaa266cc87 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/macos-clang-release/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/macos-clang-release/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/build.sh new file mode 100644 index 00000000000..d51f071ea86 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +BUILD_ROOT=$PWD +SRC=$PWD/github/SPIRV-Tools + +# Get NINJA. +wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip +unzip -q ninja-linux.zip +export PATH="$PWD:$PATH" + +# NDK Path +export ANDROID_NDK=/opt/android-ndk-r15c + +# Get the dependencies. +cd $SRC +git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers +git clone --depth=1 https://github.com/google/googletest external/googletest +git clone --depth=1 https://github.com/google/effcee external/effcee +git clone --depth=1 https://github.com/google/re2 external/re2 + +mkdir build && cd $SRC/build +mkdir libs +mkdir app + +# Invoke the build. +BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} +echo $(date): Starting ndk-build ... +$ANDROID_NDK/ndk-build \ + -C $SRC/android_test \ + NDK_PROJECT_PATH=. \ + NDK_LIBS_OUT=./libs \ + NDK_APP_OUT=./app \ + -j8 + +echo $(date): ndk-build completed. + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/continuous.cfg new file mode 100644 index 00000000000..b908a4814d3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/continuous.cfg @@ -0,0 +1,17 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +# +build_file: "SPIRV-Tools/kokoro/ndk-build/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/presubmit.cfg new file mode 100644 index 00000000000..3c1be4bf7b9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/ndk-build/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/ndk-build/build.sh" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/linux/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/linux/build.sh new file mode 100644 index 00000000000..d457539d400 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/linux/build.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Linux Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +BUILD_ROOT=$PWD +SRC=$PWD/github/SPIRV-Tools +CONFIG=$1 +COMPILER=$2 + +SKIP_TESTS="False" +BUILD_TYPE="Debug" + +CMAKE_C_CXX_COMPILER="" +if [ $COMPILER = "clang" ] +then + sudo ln -s /usr/bin/clang-3.8 /usr/bin/clang + sudo ln -s /usr/bin/clang++-3.8 /usr/bin/clang++ + CMAKE_C_CXX_COMPILER="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++" +fi + +# Possible configurations are: +# ASAN, COVERAGE, RELEASE, DEBUG, DEBUG_EXCEPTION, RELEASE_MINGW + +if [ $CONFIG = "RELEASE" ] || [ $CONFIG = "RELEASE_MINGW" ] +then + BUILD_TYPE="RelWithDebInfo" +fi + +ADDITIONAL_CMAKE_FLAGS="" +if [ $CONFIG = "ASAN" ] +then + ADDITIONAL_CMAKE_FLAGS="-DCMAKE_CXX_FLAGS=-fsanitize=address -DCMAKE_C_FLAGS=-fsanitize=address" + export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-3.4 +elif [ $CONFIG = "COVERAGE" ] +then + ADDITIONAL_CMAKE_FLAGS="-DENABLE_CODE_COVERAGE=ON" + SKIP_TESTS="True" +elif [ $CONFIG = "DEBUG_EXCEPTION" ] +then + ADDITIONAL_CMAKE_FLAGS="-DDISABLE_EXCEPTIONS=ON -DDISABLE_RTTI=ON" +elif [ $CONFIG = "RELEASE_MINGW" ] +then + ADDITIONAL_CMAKE_FLAGS="-Dgtest_disable_pthreads=ON -DCMAKE_TOOLCHAIN_FILE=$SRC/cmake/linux-mingw-toolchain.cmake" + SKIP_TESTS="True" +fi + +# Get NINJA. +wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip +unzip -q ninja-linux.zip +export PATH="$PWD:$PATH" + +cd $SRC +git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers +git clone --depth=1 https://github.com/google/googletest external/googletest +git clone --depth=1 https://github.com/google/effcee external/effcee +git clone --depth=1 https://github.com/google/re2 external/re2 + +mkdir build && cd $SRC/build + +# Invoke the build. +BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} +echo $(date): Starting build... +cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF $ADDITIONAL_CMAKE_FLAGS $CMAKE_C_CXX_COMPILER .. + +echo $(date): Build everything... +ninja +echo $(date): Build completed. + +if [ $CONFIG = "COVERAGE" ] +then + echo $(date): Check coverage... + ninja report-coverage + echo $(date): Check coverage completed. +fi + +echo $(date): Starting ctest... +if [ $SKIP_TESTS = "False" ] +then + ctest -j4 --output-on-failure --timeout 300 +fi +echo $(date): ctest completed. + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/macos/build.sh b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/macos/build.sh new file mode 100644 index 00000000000..a7f0453fe05 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/macos/build.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# MacOS Build Script. + +# Fail on any error. +set -e +# Display commands being run. +set -x + +BUILD_ROOT=$PWD +SRC=$PWD/github/SPIRV-Tools +BUILD_TYPE=$1 + +# Get NINJA. +wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip +unzip -q ninja-mac.zip +chmod +x ninja +export PATH="$PWD:$PATH" + +cd $SRC +git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers +git clone --depth=1 https://github.com/google/googletest external/googletest +git clone --depth=1 https://github.com/google/effcee external/effcee +git clone --depth=1 https://github.com/google/re2 external/re2 + +mkdir build && cd $SRC/build + +# Invoke the build. +BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT} +echo $(date): Starting build... +cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. + +echo $(date): Build everything... +ninja +echo $(date): Build completed. + +echo $(date): Starting ctest... +ctest -j4 --output-on-failure --timeout 300 +echo $(date): ctest completed. + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/windows/build.bat b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/windows/build.bat new file mode 100644 index 00000000000..a2472fb4fd7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/scripts/windows/build.bat @@ -0,0 +1,90 @@ +:: Copyright (c) 2018 Google LLC. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: +:: Windows Build Script. + +@echo on + +set BUILD_ROOT=%cd% +set SRC=%cd%\github\SPIRV-Tools +set BUILD_TYPE=%1 +set VS_VERSION=%2 + +:: Force usage of python 2.7 rather than 3.6 +set PATH=C:\python27;%PATH% + +cd %SRC% +git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers +git clone --depth=1 https://github.com/google/googletest external/googletest +git clone --depth=1 https://github.com/google/effcee external/effcee +git clone --depth=1 https://github.com/google/re2 external/re2 + +:: ######################################### +:: set up msvc build env +:: ######################################### +if %VS_VERSION% == 2017 ( + call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 + echo "Using VS 2017..." +) else if %VS_VERSION% == 2015 ( + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 + echo "Using VS 2015..." +) else if %VS_VERSION% == 2013 ( + call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64 + echo "Using VS 2013..." +) + +cd %SRC% +mkdir build +cd build + +:: ######################################### +:: Start building. +:: ######################################### +echo "Starting build... %DATE% %TIME%" +if "%KOKORO_GITHUB_COMMIT%." == "." ( + set BUILD_SHA=%KOKORO_GITHUB_PULL_REQUEST_COMMIT% +) else ( + set BUILD_SHA=%KOKORO_GITHUB_COMMIT% +) + +:: Skip building tests for VS2013 +if %VS_VERSION% == 2013 ( + cmake -GNinja -DSPIRV_SKIP_TESTS=ON -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe .. +) else ( + cmake -GNinja -DSPIRV_BUILD_COMPRESSION=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=install -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe .. +) + +if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL% + +echo "Build everything... %DATE% %TIME%" +ninja +if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL% +echo "Build Completed %DATE% %TIME%" + +:: ################################################ +:: Run the tests (We no longer run tests on VS2013) +:: ################################################ +if NOT %VS_VERSION% == 2013 ( + echo "Running Tests... %DATE% %TIME%" + ctest -C %BUILD_TYPE% --output-on-failure --timeout 300 + if %ERRORLEVEL% GEQ 1 exit /b %ERRORLEVEL% + echo "Tests Completed %DATE% %TIME%" +) + +:: Clean up some directories. +rm -rf %SRC%\build +rm -rf %SRC%\external + +exit /b %ERRORLEVEL% + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/build.bat b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/build.bat new file mode 100644 index 00000000000..e77172afc93 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/build.bat @@ -0,0 +1,24 @@ +:: Copyright (c) 2018 Google LLC. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: +:: Windows Build Script. + +@echo on + +:: Find out the directory of the common build script. +set SCRIPT_DIR=%~dp0 + +:: Call with correct parameter +call %SCRIPT_DIR%\..\scripts\windows\build.bat RelWithDebInfo 2013 + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/continuous.cfg new file mode 100644 index 00000000000..5dfcba63bc2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2013-release/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/presubmit.cfg new file mode 100644 index 00000000000..7d3b238227c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2013-release/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2013-release/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/build.bat b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/build.bat new file mode 100644 index 00000000000..c0e4bd317a3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/build.bat @@ -0,0 +1,24 @@ +:: Copyright (c) 2018 Google LLC. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: +:: Windows Build Script. + +@echo on + +:: Find out the directory of the common build script. +set SCRIPT_DIR=%~dp0 + +:: Call with correct parameter +call %SCRIPT_DIR%\..\scripts\windows\build.bat RelWithDebInfo 2015 + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/continuous.cfg new file mode 100644 index 00000000000..3e47e526882 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2015-release/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/presubmit.cfg new file mode 100644 index 00000000000..85a162593f4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2015-release/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2015-release/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/build.bat b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/build.bat new file mode 100644 index 00000000000..25783a9e58e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/build.bat @@ -0,0 +1,23 @@ +:: Copyright (c) 2018 Google LLC. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: +:: Windows Build Script. + +@echo on + +:: Find out the directory of the common build script. +set SCRIPT_DIR=%~dp0 + +:: Call with correct parameter +call %SCRIPT_DIR%\..\scripts\windows\build.bat Debug 2017 diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/continuous.cfg new file mode 100644 index 00000000000..b842c30f198 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2017-debug/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/presubmit.cfg new file mode 100644 index 00000000000..a7a553aee92 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-debug/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2017-debug/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/build.bat b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/build.bat new file mode 100644 index 00000000000..899fcbcfb5b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/build.bat @@ -0,0 +1,24 @@ +:: Copyright (c) 2018 Google LLC. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: +:: Windows Build Script. + +@echo on + +:: Find out the directory of the common build script. +set SCRIPT_DIR=%~dp0 + +:: Call with correct parameter +call %SCRIPT_DIR%\..\scripts\windows\build.bat RelWithDebInfo 2017 + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/continuous.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/continuous.cfg new file mode 100644 index 00000000000..7b8c2ff2b82 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/continuous.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Continuous build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2017-release/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/presubmit.cfg b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/presubmit.cfg new file mode 100644 index 00000000000..5efd429274a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/kokoro/windows-msvc-2017-release/presubmit.cfg @@ -0,0 +1,16 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Presubmit build configuration. +build_file: "SPIRV-Tools/kokoro/windows-msvc-2017-release/build.bat" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/projects.md b/3rdparty/bgfx/3rdparty/spirv-tools/projects.md new file mode 100644 index 00000000000..8f7f0bcd942 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/projects.md @@ -0,0 +1,82 @@ +# Tracking SPIRV-Tools work with GitHub projects + +We are experimenting with using the [GitHub Project +feature](https://help.github.com/articles/tracking-the-progress-of-your-work-with-projects/) +to track progress toward large goals. + +For more on GitHub Projects in general, see: +* [Introductory blog post](https://github.com/blog/2256-a-whole-new-github-universe-announcing-new-tools-forums-and-features) +* [Introductory video](https://www.youtube.com/watch?v=C6MGKHkNtxU) + +The current SPIRV-Tools project list can be found at +[https://github.com/KhronosGroup/SPIRV-Tools/projects](https://github.com/KhronosGroup/SPIRV-Tools/projects) + +## How we use a Project + +A GitHub Project is a set of work with an overall purpose, and +consists of a collection of *Cards*. +Each card is either a *Note* or a regular GitHub *Issue.* +A Note can be converted to an Issue. + +In our projects, a card represents work, i.e. a change that can +be applied to the repository. +The work could be a feature, a bug to be fixed, documentation to be +updated, etc. + +A project and its cards are used as a [Kanban +board](https://en.wikipedia.org/wiki/Kanban_board), where cards progress +through a workflow starting with ideas through to implementation and completion. + +In our usage, a *project manager* is someone who organizes the work. +They manage the creation and movement of cards +through the project workflow: +* They create cards to capture ideas, or to decompose large ideas into smaller + ones. +* They determine if the work for a card has been completed. +* Normally they are the person (or persons) who can approve and merge a pull + request into the `master` branch. + +Our projects organize cards into the following columns: +* `Ideas`: Work which could be done, captured either as Cards or Notes. + * A card in this column could be marked as a [PLACEHOLDER](#placeholders). +* `Ready to start`: Issues which represent work we'd like to do, and which + are not blocked by other work. + * The issue should be narrow enough that it can usually be addressed by a + single pull request. + * We want these to be Issues (not Notes) so that someone can claim the work + by updating the Issue with their intent to do the work. + Once an Issue is claimed, the project manager moves the corresponding card + from `Ready to start` to `In progress`. +* `In progress`: Issues which were in `Ready to start` but which have been + claimed by someone. +* `Done`: Issues which have been resolved, by completing their work. + * The changes have been applied to the repository, typically by being pushed + into the `master` branch. + * Other kinds of work could update repository settings, for example. +* `Rejected ideas`: Work which has been considered, but which we don't want + implemented. + * We keep rejected ideas so they are not proposed again. This serves + as a form of institutional memory. + * We should record why an idea is rejected. For this reason, a rejected + idea is likely to be an Issue which has been closed. + +## Prioritization + +We are considering prioritizing cards in the `Ideas` and `Ready to start` +columns so that things that should be considered first float up to the top. + +Experience will tell us if we stick to that rule, and if it proves helpful. + +## Placeholders + +A *placeholder* is a Note or Issue that represents a possibly large amount +of work that can be broadly defined but which may not have been broken down +into small implementable pieces of work. + +Use a placeholder to capture a big idea, but without doing the upfront work +to consider all the details of how it should be implemented. +Over time, break off pieces of the placeholder into implementable Issues. +Move those Issues into the `Ready to start` column when they become unblocked. + +We delete the placeholder when all its work has been decomposed into +implementable cards. diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/source/CMakeLists.txt new file mode 100644 index 00000000000..4df5de3ad41 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/CMakeLists.txt @@ -0,0 +1,371 @@ +# Copyright (c) 2015-2016 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. + +set(GRAMMAR_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_grammar_tables.py") +set(VIMSYNTAX_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_vim_syntax.py") +set(XML_REGISTRY_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_registry_tables.py") +set(LANG_HEADER_PROCESSING_SCRIPT "${spirv-tools_SOURCE_DIR}/utils/generate_language_headers.py") + +# For now, assume the DebugInfo grammar file is in the current directory. +# It might migrate to SPIRV-Headers. +set(DEBUGINFO_GRAMMAR_JSON_FILE "${CMAKE_CURRENT_SOURCE_DIR}/extinst.debuginfo.grammar.json") + +# macro() definitions are used in the following because we need to append .inc +# file paths into some global lists (*_CPP_DEPENDS). And those global lists are +# later used by set_source_files_properties() calls. +# function() definitions are not suitable because they create new scopes. +macro(spvtools_core_tables VERSION) + set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") + set(GRAMMAR_INSTS_INC_FILE "${spirv-tools_BINARY_DIR}/core.insts-${VERSION}.inc") + set(GRAMMAR_KINDS_INC_FILE "${spirv-tools_BINARY_DIR}/operand.kinds-${VERSION}.inc") + add_custom_command(OUTPUT ${GRAMMAR_INSTS_INC_FILE} ${GRAMMAR_KINDS_INC_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} + --spirv-core-grammar=${GRAMMAR_JSON_FILE} + --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE} + --core-insts-output=${GRAMMAR_INSTS_INC_FILE} + --operand-kinds-output=${GRAMMAR_KINDS_INC_FILE} + DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE} ${DEBUGINFO_GRAMMAR_JSON_FILE} + COMMENT "Generate info tables for SPIR-V v${VERSION} core instructions and operands.") + list(APPEND OPCODE_CPP_DEPENDS ${GRAMMAR_INSTS_INC_FILE}) + list(APPEND OPERAND_CPP_DEPENDS ${GRAMMAR_KINDS_INC_FILE}) +endmacro(spvtools_core_tables) + +macro(spvtools_enum_string_mapping VERSION) + set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") + set(GRAMMAR_EXTENSION_ENUM_INC_FILE "${spirv-tools_BINARY_DIR}/extension_enum.inc") + set(GRAMMAR_ENUM_STRING_MAPPING_INC_FILE "${spirv-tools_BINARY_DIR}/enum_string_mapping.inc") + add_custom_command(OUTPUT ${GRAMMAR_EXTENSION_ENUM_INC_FILE} + ${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} + --spirv-core-grammar=${GRAMMAR_JSON_FILE} + --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE} + --extension-enum-output=${GRAMMAR_EXTENSION_ENUM_INC_FILE} + --enum-string-mapping-output=${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE} + DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE} ${DEBUGINFO_GRAMMAR_JSON_FILE} + COMMENT "Generate enum-string mapping for SPIR-V v${VERSION}.") + list(APPEND EXTENSION_H_DEPENDS ${GRAMMAR_EXTENSION_ENUM_INC_FILE}) + list(APPEND ENUM_STRING_MAPPING_CPP_DEPENDS ${GRAMMAR_ENUM_STRING_MAPPING_INC_FILE}) +endmacro(spvtools_enum_string_mapping) + +macro(spvtools_vimsyntax VERSION CLVERSION) + set(GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") + set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.glsl.std.450.grammar.json") + set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.opencl.std.100.grammar.json") + set(VIMSYNTAX_FILE "${spirv-tools_BINARY_DIR}/spvasm.vim") + add_custom_command(OUTPUT ${VIMSYNTAX_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${VIMSYNTAX_PROCESSING_SCRIPT} + --spirv-core-grammar=${GRAMMAR_JSON_FILE} + --extinst-debuginfo-grammar=${DEBUGINFO_GRAMMAR_JSON_FILE} + --extinst-glsl-grammar=${GLSL_GRAMMAR_JSON_FILE} + --extinst-opencl-grammar=${OPENCL_GRAMMAR_JSON_FILE} + >${VIMSYNTAX_FILE} + DEPENDS ${VIMSYNTAX_PROCESSING_SCRIPT} ${GRAMMAR_JSON_FILE} + ${GLSL_GRAMMAR_JSON_FILE} ${OPENCL_GRAMMAR_JSON_FILE} ${DEBUGINFO_GRAMMAR_JSON_FILE} + COMMENT "Generate spvasm.vim: Vim syntax file for SPIR-V assembly.") +endmacro(spvtools_vimsyntax) + +macro(spvtools_glsl_tables VERSION) + set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") + set(GLSL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.glsl.std.450.grammar.json") + set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/glsl.std.450.insts.inc") + add_custom_command(OUTPUT ${GRAMMAR_INC_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} + --extinst-glsl-grammar=${GLSL_GRAMMAR_JSON_FILE} + --glsl-insts-output=${GRAMMAR_INC_FILE} + DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${CORE_GRAMMAR_JSON_FILE} ${GLSL_GRAMMAR_JSON_FILE} + COMMENT "Generate info tables for GLSL extended instructions and operands v${VERSION}.") + list(APPEND EXTINST_CPP_DEPENDS ${GRAMMAR_INC_FILE}) +endmacro(spvtools_glsl_tables) + +macro(spvtools_opencl_tables VERSION) + set(CORE_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/spirv.core.grammar.json") + set(OPENCL_GRAMMAR_JSON_FILE "${SPIRV_HEADER_INCLUDE_DIR}/spirv/${VERSION}/extinst.opencl.std.100.grammar.json") + set(GRAMMAR_INC_FILE "${spirv-tools_BINARY_DIR}/opencl.std.insts.inc") + add_custom_command(OUTPUT ${GRAMMAR_INC_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} + --extinst-opencl-grammar=${OPENCL_GRAMMAR_JSON_FILE} + --opencl-insts-output=${GRAMMAR_INC_FILE} + DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${CORE_GRAMMAR_JSON_FILE} ${OPENCL_GRAMMAR_JSON_FILE} + COMMENT "Generate info tables for OpenCL extended instructions and operands v${VERSION}.") + list(APPEND EXTINST_CPP_DEPENDS ${GRAMMAR_INC_FILE}) +endmacro(spvtools_opencl_tables) + +macro(spvtools_vendor_tables VENDOR_TABLE) + set(INSTS_FILE "${spirv-tools_BINARY_DIR}/${VENDOR_TABLE}.insts.inc") + set(GRAMMAR_FILE "${spirv-tools_SOURCE_DIR}/source/extinst.${VENDOR_TABLE}.grammar.json") + add_custom_command(OUTPUT ${INSTS_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${GRAMMAR_PROCESSING_SCRIPT} + --extinst-vendor-grammar=${GRAMMAR_FILE} + --vendor-insts-output=${INSTS_FILE} + DEPENDS ${GRAMMAR_PROCESSING_SCRIPT} ${GRAMMAR_FILE} + COMMENT "Generate extended instruction tables for ${VENDOR_TABLE}.") + list(APPEND EXTINST_CPP_DEPENDS ${INSTS_FILE}) + add_custom_target(spirv-tools-${VENDOR_TABLE} DEPENDS ${INSTS_FILE}) + set_property(TARGET spirv-tools-${VENDOR_TABLE} PROPERTY FOLDER "SPIRV-Tools build") +endmacro(spvtools_vendor_tables) + +macro(spvtools_extinst_lang_headers NAME GRAMMAR_FILE) + set(OUTBASE ${spirv-tools_BINARY_DIR}/${NAME}) + set(OUT_H ${OUTBASE}.h) + add_custom_command(OUTPUT ${OUT_H} + COMMAND ${PYTHON_EXECUTABLE} ${LANG_HEADER_PROCESSING_SCRIPT} + --extinst-name=${NAME} + --extinst-grammar=${GRAMMAR_FILE} + --extinst-output-base=${OUTBASE} + DEPENDS ${LANG_HEADER_PROCESSING_SCRIPT} ${GRAMMAR_FILE} + COMMENT "Generate language specific header for ${NAME}.") + list(APPEND EXTINST_CPP_DEPENDS ${OUT_H}) + add_custom_target(spirv-tools-header-${NAME} DEPENDS ${OUT_H}) + set_property(TARGET spirv-tools-header-${NAME} PROPERTY FOLDER "SPIRV-Tools build") +endmacro(spvtools_extinst_lang_headers) + +spvtools_core_tables("unified1") +spvtools_enum_string_mapping("unified1") +spvtools_opencl_tables("unified1") +spvtools_glsl_tables("unified1") +spvtools_vendor_tables("spv-amd-shader-explicit-vertex-parameter") +spvtools_vendor_tables("spv-amd-shader-trinary-minmax") +spvtools_vendor_tables("spv-amd-gcn-shader") +spvtools_vendor_tables("spv-amd-shader-ballot") +spvtools_vendor_tables("debuginfo") +spvtools_extinst_lang_headers("DebugInfo" ${DEBUGINFO_GRAMMAR_JSON_FILE}) + +spvtools_vimsyntax("unified1" "1.0") +add_custom_target(spirv-tools-vimsyntax DEPENDS ${VIMSYNTAX_FILE}) +set_property(TARGET spirv-tools-vimsyntax PROPERTY FOLDER "SPIRV-Tools utilities") + +# Extract the list of known generators from the SPIR-V XML registry file. +set(GENERATOR_INC_FILE ${spirv-tools_BINARY_DIR}/generators.inc) +set(SPIRV_XML_REGISTRY_FILE ${SPIRV_HEADER_INCLUDE_DIR}/spirv/spir-v.xml) +add_custom_command(OUTPUT ${GENERATOR_INC_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${XML_REGISTRY_PROCESSING_SCRIPT} + --xml=${SPIRV_XML_REGISTRY_FILE} + --generator-output=${GENERATOR_INC_FILE} + DEPENDS ${XML_REGISTRY_PROCESSING_SCRIPT} ${SPIRV_XML_REGISTRY_FILE} + COMMENT "Generate tables based on the SPIR-V XML registry.") +list(APPEND OPCODE_CPP_DEPENDS ${GENERATOR_INC_FILE}) + +# The following .cpp files include the above generated .inc files. +# Add those .inc files as their dependencies. +# +# Why using such an awkward way? +# * If we use add_custom_target() to define a target to generate all .inc files +# and let ${SPIRV_TOOLS} depend on it, then we need to run ninja twice every +# time the grammar is updated: the first time is for generating those .inc +# files, and the second time is for rebuilding .cpp files, when ninja finds +# out that .inc files are updated. +# * If we use add_custom_command() with PRE_BUILD, then the grammar processing +# script will always run no matter whether the grammar is updated. +# * add_dependencies() is used to add *target* dependencies to a target. +# * The following solution only generates .inc files when the script or the +# grammar files is updated, and in a single ninja run. +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp + PROPERTIES OBJECT_DEPENDS "${OPCODE_CPP_DEPENDS}") +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/operand.cpp + PROPERTIES OBJECT_DEPENDS "${OPERAND_CPP_DEPENDS}") +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp + PROPERTIES OBJECT_DEPENDS "${EXTINST_CPP_DEPENDS}") +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.cpp + PROPERTIES OBJECT_DEPENDS "${ENUM_STRING_MAPPING_CPP_DEPENDS}") + +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/extension.h + PROPERTIES HEADER_FILE_ONLY TRUE) +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/extension.h + PROPERTIES OBJECT_DEPENDS "${EXTENSION_H_DEPENDS}") + +set(SPIRV_TOOLS_BUILD_VERSION_INC + ${spirv-tools_BINARY_DIR}/build-version.inc) +set(SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR + ${spirv-tools_SOURCE_DIR}/utils/update_build_version.py) +set(SPIRV_TOOLS_CHANGES_FILE + ${spirv-tools_SOURCE_DIR}/CHANGES) +add_custom_command(OUTPUT ${SPIRV_TOOLS_BUILD_VERSION_INC} + COMMAND ${PYTHON_EXECUTABLE} + ${SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR} + ${spirv-tools_SOURCE_DIR} ${SPIRV_TOOLS_BUILD_VERSION_INC} + DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC_GENERATOR} + ${SPIRV_TOOLS_CHANGES_FILE} + COMMENT "Update build-version.inc in the SPIRV-Tools build directory (if necessary).") +# Convenience target for standalone generation of the build-version.inc file. +# This is not required for any dependence chain. +add_custom_target(spirv-tools-build-version + DEPENDS ${SPIRV_TOOLS_BUILD_VERSION_INC}) +set_property(TARGET spirv-tools-build-version PROPERTY FOLDER "SPIRV-Tools build") + +add_subdirectory(comp) +add_subdirectory(opt) +add_subdirectory(link) + +set(SPIRV_SOURCES + ${spirv-tools_SOURCE_DIR}/include/spirv-tools/libspirv.h + + ${CMAKE_CURRENT_SOURCE_DIR}/util/bitutils.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/hex_float.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/make_unique.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/small_vector.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.h + ${CMAKE_CURRENT_SOURCE_DIR}/util/timer.h + ${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.h + ${CMAKE_CURRENT_SOURCE_DIR}/binary.h + ${CMAKE_CURRENT_SOURCE_DIR}/cfa.h + ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.h + ${CMAKE_CURRENT_SOURCE_DIR}/disassemble.h + ${CMAKE_CURRENT_SOURCE_DIR}/enum_set.h + ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.h + ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.h + ${CMAKE_CURRENT_SOURCE_DIR}/extensions.h + ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.h + ${CMAKE_CURRENT_SOURCE_DIR}/instruction.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_glsl_std_450_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_opencl_std_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/latest_version_spirv_header.h + ${CMAKE_CURRENT_SOURCE_DIR}/macro.h + ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.h + ${CMAKE_CURRENT_SOURCE_DIR}/opcode.h + ${CMAKE_CURRENT_SOURCE_DIR}/operand.h + ${CMAKE_CURRENT_SOURCE_DIR}/parsed_operand.h + ${CMAKE_CURRENT_SOURCE_DIR}/print.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_constant.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_definition.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.h + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.h + ${CMAKE_CURRENT_SOURCE_DIR}/table.h + ${CMAKE_CURRENT_SOURCE_DIR}/text.h + ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.h + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.h + + ${CMAKE_CURRENT_SOURCE_DIR}/util/bit_vector.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/parse_number.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/util/string_utils.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/binary.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/disassemble.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/enum_string_mapping.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/extensions.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/id_descriptor.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/libspirv.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/name_mapper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/operand.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/parsed_operand.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/print.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_target_env.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/spirv_validator_options.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/table.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/text.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/text_handler.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_adjacency.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_annotation.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_arithmetics.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_atomics.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_barriers.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_bitwise.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_builtins.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_capability.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_cfg.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_composites.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_constants.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_conversion.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_datarules.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_debug.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_decorations.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_derivatives.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_ext_inst.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_execution_limitations.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_function.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_id.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_image.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_interfaces.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_instruction.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_layout.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_literals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_logicals.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_mode_setting.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_non_uniform.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_primitives.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validate_type.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/decoration.h + ${CMAKE_CURRENT_SOURCE_DIR}/val/basic_block.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/construct.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/function.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/instruction.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val/validation_state.cpp) + +if (${SPIRV_TIMER_ENABLED}) + set(SPIRV_SOURCES + ${SPIRV_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/util/timer.cpp) +endif() + +# The software_version.cpp file includes build-version.inc. +# Rebuild the software_version.cpp object file if it is older than +# build-version.inc or whenever build-version.inc itself is out of +# date. In the latter case, rebuild build-version.inc first. +# CMake is not smart enough to detect this dependency automatically. +# Without this, the dependency detection system for #included files +# does not kick in on a clean build for the following reason: The +# build will fail early because it doesn't know how to build the +# missing source file build-version.inc. That occurs before the +# preprocessor is run on software_version.cpp to detect the +# #include dependency. +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/software_version.cpp + PROPERTIES OBJECT_DEPENDS "${SPIRV_TOOLS_BUILD_VERSION_INC}") + +add_library(${SPIRV_TOOLS} ${SPIRV_SOURCES}) +spvtools_default_compile_options(${SPIRV_TOOLS}) +target_include_directories(${SPIRV_TOOLS} + PUBLIC ${spirv-tools_SOURCE_DIR}/include + PRIVATE ${spirv-tools_BINARY_DIR} + PRIVATE ${SPIRV_HEADER_INCLUDE_DIR} + ) +set_property(TARGET ${SPIRV_TOOLS} PROPERTY FOLDER "SPIRV-Tools libraries") +spvtools_check_symbol_exports(${SPIRV_TOOLS}) + +add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES}) +spvtools_default_compile_options(${SPIRV_TOOLS}-shared) +target_include_directories(${SPIRV_TOOLS}-shared + PUBLIC ${spirv-tools_SOURCE_DIR}/include + PRIVATE ${spirv-tools_BINARY_DIR} + PRIVATE ${SPIRV_HEADER_INCLUDE_DIR} + ) +set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden) +set_property(TARGET ${SPIRV_TOOLS}-shared PROPERTY FOLDER "SPIRV-Tools libraries") +spvtools_check_symbol_exports(${SPIRV_TOOLS}-shared) +target_compile_definitions(${SPIRV_TOOLS}-shared + PRIVATE SPIRV_TOOLS_IMPLEMENTATION + PUBLIC SPIRV_TOOLS_SHAREDLIB +) + +if(ENABLE_SPIRV_TOOLS_INSTALL) + install(TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif(ENABLE_SPIRV_TOOLS_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp new file mode 100644 index 00000000000..4d98e3dab82 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/assembly_grammar.cpp @@ -0,0 +1,263 @@ +// Copyright (c) 2015-2016 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. + +#include "source/assembly_grammar.h" + +#include +#include +#include + +#include "source/ext_inst.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/table.h" + +namespace spvtools { +namespace { + +/// @brief Parses a mask expression string for the given operand type. +/// +/// A mask expression is a sequence of one or more terms separated by '|', +/// where each term a named enum value for the given type. No whitespace +/// is permitted. +/// +/// On success, the value is written to pValue. +/// +/// @param[in] operandTable operand lookup table +/// @param[in] type of the operand +/// @param[in] textValue word of text to be parsed +/// @param[out] pValue where the resulting value is written +/// +/// @return result code +spv_result_t spvTextParseMaskOperand(spv_target_env env, + const spv_operand_table operandTable, + const spv_operand_type_t type, + const char* textValue, uint32_t* pValue) { + if (textValue == nullptr) return SPV_ERROR_INVALID_TEXT; + size_t text_length = strlen(textValue); + if (text_length == 0) return SPV_ERROR_INVALID_TEXT; + const char* text_end = textValue + text_length; + + // We only support mask expressions in ASCII, so the separator value is a + // char. + const char separator = '|'; + + // Accumulate the result by interpreting one word at a time, scanning + // from left to right. + uint32_t value = 0; + const char* begin = textValue; // The left end of the current word. + const char* end = nullptr; // One character past the end of the current word. + do { + end = std::find(begin, text_end, separator); + + spv_operand_desc entry = nullptr; + if (spvOperandTableNameLookup(env, operandTable, type, begin, end - begin, + &entry)) { + return SPV_ERROR_INVALID_TEXT; + } + value |= entry->value; + + // Advance to the next word by skipping over the separator. + begin = end + 1; + } while (end != text_end); + + *pValue = value; + return SPV_SUCCESS; +} + +// Associates an opcode with its name. +struct SpecConstantOpcodeEntry { + SpvOp opcode; + const char* name; +}; + +// All the opcodes allowed as the operation for OpSpecConstantOp. +// The name does not have the usual "Op" prefix. For example opcode SpvOpIAdd +// is associated with the name "IAdd". +// +// clang-format off +#define CASE(NAME) { SpvOp##NAME, #NAME } +const SpecConstantOpcodeEntry kOpSpecConstantOpcodes[] = { + // Conversion + CASE(SConvert), + CASE(FConvert), + CASE(ConvertFToS), + CASE(ConvertSToF), + CASE(ConvertFToU), + CASE(ConvertUToF), + CASE(UConvert), + CASE(ConvertPtrToU), + CASE(ConvertUToPtr), + CASE(GenericCastToPtr), + CASE(PtrCastToGeneric), + CASE(Bitcast), + CASE(QuantizeToF16), + // Arithmetic + CASE(SNegate), + CASE(Not), + CASE(IAdd), + CASE(ISub), + CASE(IMul), + CASE(UDiv), + CASE(SDiv), + CASE(UMod), + CASE(SRem), + CASE(SMod), + CASE(ShiftRightLogical), + CASE(ShiftRightArithmetic), + CASE(ShiftLeftLogical), + CASE(BitwiseOr), + CASE(BitwiseAnd), + CASE(BitwiseXor), + CASE(FNegate), + CASE(FAdd), + CASE(FSub), + CASE(FMul), + CASE(FDiv), + CASE(FRem), + CASE(FMod), + // Composite + CASE(VectorShuffle), + CASE(CompositeExtract), + CASE(CompositeInsert), + // Logical + CASE(LogicalOr), + CASE(LogicalAnd), + CASE(LogicalNot), + CASE(LogicalEqual), + CASE(LogicalNotEqual), + CASE(Select), + // Comparison + CASE(IEqual), + CASE(INotEqual), + CASE(ULessThan), + CASE(SLessThan), + CASE(UGreaterThan), + CASE(SGreaterThan), + CASE(ULessThanEqual), + CASE(SLessThanEqual), + CASE(UGreaterThanEqual), + CASE(SGreaterThanEqual), + // Memory + CASE(AccessChain), + CASE(InBoundsAccessChain), + CASE(PtrAccessChain), + CASE(InBoundsPtrAccessChain), +}; + +// The 59 is determined by counting the opcodes listed in the spec. +static_assert(59 == sizeof(kOpSpecConstantOpcodes)/sizeof(kOpSpecConstantOpcodes[0]), + "OpSpecConstantOp opcode table is incomplete"); +#undef CASE +// clang-format on + +const size_t kNumOpSpecConstantOpcodes = + sizeof(kOpSpecConstantOpcodes) / sizeof(kOpSpecConstantOpcodes[0]); + +} // namespace + +bool AssemblyGrammar::isValid() const { + return operandTable_ && opcodeTable_ && extInstTable_; +} + +CapabilitySet AssemblyGrammar::filterCapsAgainstTargetEnv( + const SpvCapability* cap_array, uint32_t count) const { + CapabilitySet cap_set; + for (uint32_t i = 0; i < count; ++i) { + spv_operand_desc cap_desc = {}; + if (SPV_SUCCESS == lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, + static_cast(cap_array[i]), + &cap_desc)) { + // spvOperandTableValueLookup() filters capabilities internally + // according to the current target environment by itself. So we + // should be safe to add this capability if the lookup succeeds. + cap_set.Add(cap_array[i]); + } + } + return cap_set; +} + +spv_result_t AssemblyGrammar::lookupOpcode(const char* name, + spv_opcode_desc* desc) const { + return spvOpcodeTableNameLookup(target_env_, opcodeTable_, name, desc); +} + +spv_result_t AssemblyGrammar::lookupOpcode(SpvOp opcode, + spv_opcode_desc* desc) const { + return spvOpcodeTableValueLookup(target_env_, opcodeTable_, opcode, desc); +} + +spv_result_t AssemblyGrammar::lookupOperand(spv_operand_type_t type, + const char* name, size_t name_len, + spv_operand_desc* desc) const { + return spvOperandTableNameLookup(target_env_, operandTable_, type, name, + name_len, desc); +} + +spv_result_t AssemblyGrammar::lookupOperand(spv_operand_type_t type, + uint32_t operand, + spv_operand_desc* desc) const { + return spvOperandTableValueLookup(target_env_, operandTable_, type, operand, + desc); +} + +spv_result_t AssemblyGrammar::lookupSpecConstantOpcode(const char* name, + SpvOp* opcode) const { + const auto* last = kOpSpecConstantOpcodes + kNumOpSpecConstantOpcodes; + const auto* found = + std::find_if(kOpSpecConstantOpcodes, last, + [name](const SpecConstantOpcodeEntry& entry) { + return 0 == strcmp(name, entry.name); + }); + if (found == last) return SPV_ERROR_INVALID_LOOKUP; + *opcode = found->opcode; + return SPV_SUCCESS; +} + +spv_result_t AssemblyGrammar::lookupSpecConstantOpcode(SpvOp opcode) const { + const auto* last = kOpSpecConstantOpcodes + kNumOpSpecConstantOpcodes; + const auto* found = + std::find_if(kOpSpecConstantOpcodes, last, + [opcode](const SpecConstantOpcodeEntry& entry) { + return opcode == entry.opcode; + }); + if (found == last) return SPV_ERROR_INVALID_LOOKUP; + return SPV_SUCCESS; +} + +spv_result_t AssemblyGrammar::parseMaskOperand(const spv_operand_type_t type, + const char* textValue, + uint32_t* pValue) const { + return spvTextParseMaskOperand(target_env_, operandTable_, type, textValue, + pValue); +} +spv_result_t AssemblyGrammar::lookupExtInst(spv_ext_inst_type_t type, + const char* textValue, + spv_ext_inst_desc* extInst) const { + return spvExtInstTableNameLookup(extInstTable_, type, textValue, extInst); +} + +spv_result_t AssemblyGrammar::lookupExtInst(spv_ext_inst_type_t type, + uint32_t firstWord, + spv_ext_inst_desc* extInst) const { + return spvExtInstTableValueLookup(extInstTable_, type, firstWord, extInst); +} + +void AssemblyGrammar::pushOperandTypesForMask( + const spv_operand_type_t type, const uint32_t mask, + spv_operand_pattern_t* pattern) const { + spvPushOperandTypesForMask(target_env_, operandTable_, type, mask, pattern); +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h new file mode 100644 index 00000000000..17c2bd3bacd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/assembly_grammar.h @@ -0,0 +1,138 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_ASSEMBLY_GRAMMAR_H_ +#define SOURCE_ASSEMBLY_GRAMMAR_H_ + +#include "source/enum_set.h" +#include "source/latest_version_spirv_header.h" +#include "source/operand.h" +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// Encapsulates the grammar to use for SPIR-V assembly. +// Contains methods to query for valid instructions and operands. +class AssemblyGrammar { + public: + explicit AssemblyGrammar(const spv_const_context context) + : target_env_(context->target_env), + operandTable_(context->operand_table), + opcodeTable_(context->opcode_table), + extInstTable_(context->ext_inst_table) {} + + // Returns true if the internal tables have been initialized with valid data. + bool isValid() const; + + // Returns the SPIR-V target environment. + spv_target_env target_env() const { return target_env_; } + + // Removes capabilities not available in the current target environment and + // returns the rest. + CapabilitySet filterCapsAgainstTargetEnv(const SpvCapability* cap_array, + uint32_t count) const; + + // Fills in the desc parameter with the information about the opcode + // of the given name. Returns SPV_SUCCESS if the opcode was found, and + // SPV_ERROR_INVALID_LOOKUP if the opcode does not exist. + spv_result_t lookupOpcode(const char* name, spv_opcode_desc* desc) const; + + // Fills in the desc parameter with the information about the opcode + // of the valid. Returns SPV_SUCCESS if the opcode was found, and + // SPV_ERROR_INVALID_LOOKUP if the opcode does not exist. + spv_result_t lookupOpcode(SpvOp opcode, spv_opcode_desc* desc) const; + + // Fills in the desc parameter with the information about the given + // operand. Returns SPV_SUCCESS if the operand was found, and + // SPV_ERROR_INVALID_LOOKUP otherwise. + spv_result_t lookupOperand(spv_operand_type_t type, const char* name, + size_t name_len, spv_operand_desc* desc) const; + + // Fills in the desc parameter with the information about the given + // operand. Returns SPV_SUCCESS if the operand was found, and + // SPV_ERROR_INVALID_LOOKUP otherwise. + spv_result_t lookupOperand(spv_operand_type_t type, uint32_t operand, + spv_operand_desc* desc) const; + + // Finds operand entry in the grammar table and returns its name. + // Returns "Unknown" if not found. + const char* lookupOperandName(spv_operand_type_t type, + uint32_t operand) const { + spv_operand_desc desc = nullptr; + if (lookupOperand(type, operand, &desc) != SPV_SUCCESS || !desc) { + return "Unknown"; + } + return desc->name; + } + + // Finds the opcode for the given OpSpecConstantOp opcode name. The name + // should not have the "Op" prefix. For example, "IAdd" corresponds to + // the integer add opcode for OpSpecConstantOp. On success, returns + // SPV_SUCCESS and sends the discovered operation code through the opcode + // parameter. On failure, returns SPV_ERROR_INVALID_LOOKUP. + spv_result_t lookupSpecConstantOpcode(const char* name, SpvOp* opcode) const; + + // Returns SPV_SUCCESS if the given opcode is valid as the opcode operand + // to OpSpecConstantOp. + spv_result_t lookupSpecConstantOpcode(SpvOp opcode) const; + + // Parses a mask expression string for the given operand type. + // + // A mask expression is a sequence of one or more terms separated by '|', + // where each term is a named enum value for a given type. No whitespace + // is permitted. + // + // On success, the value is written to pValue, and SPV_SUCCESS is returned. + // The operand type is defined by the type parameter, and the text to be + // parsed is defined by the textValue parameter. + spv_result_t parseMaskOperand(const spv_operand_type_t type, + const char* textValue, uint32_t* pValue) const; + + // Writes the extended operand with the given type and text to the *extInst + // parameter. + // Returns SPV_SUCCESS if the value could be found. + spv_result_t lookupExtInst(spv_ext_inst_type_t type, const char* textValue, + spv_ext_inst_desc* extInst) const; + + // Writes the extended operand with the given type and first encoded word + // to the *extInst parameter. + // Returns SPV_SUCCESS if the value could be found. + spv_result_t lookupExtInst(spv_ext_inst_type_t type, uint32_t firstWord, + spv_ext_inst_desc* extInst) const; + + // Inserts the operands expected after the given typed mask onto the end + // of the given pattern. + // + // Each set bit in the mask represents zero or more operand types that + // should be appended onto the pattern. Operands for a less significant + // bit must always match before operands for a more significant bit, so + // the operands for a less significant bit must appear closer to the end + // of the pattern stack. + // + // If a set bit is unknown, then we assume it has no operands. + void pushOperandTypesForMask(const spv_operand_type_t type, + const uint32_t mask, + spv_operand_pattern_t* pattern) const; + + private: + const spv_target_env target_env_; + const spv_operand_table operandTable_; + const spv_opcode_table opcodeTable_; + const spv_ext_inst_table extInstTable_; +}; + +} // namespace spvtools + +#endif // SOURCE_ASSEMBLY_GRAMMAR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/binary.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/binary.cpp new file mode 100644 index 00000000000..6604d80945d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/binary.cpp @@ -0,0 +1,791 @@ +// Copyright (c) 2015-2016 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. + +#include "source/binary.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/diagnostic.h" +#include "source/ext_inst.h" +#include "source/latest_version_spirv_header.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" + +spv_result_t spvBinaryHeaderGet(const spv_const_binary binary, + const spv_endianness_t endian, + spv_header_t* pHeader) { + if (!binary->code) return SPV_ERROR_INVALID_BINARY; + if (binary->wordCount < SPV_INDEX_INSTRUCTION) + return SPV_ERROR_INVALID_BINARY; + if (!pHeader) return SPV_ERROR_INVALID_POINTER; + + // TODO: Validation checking? + pHeader->magic = spvFixWord(binary->code[SPV_INDEX_MAGIC_NUMBER], endian); + pHeader->version = spvFixWord(binary->code[SPV_INDEX_VERSION_NUMBER], endian); + pHeader->generator = + spvFixWord(binary->code[SPV_INDEX_GENERATOR_NUMBER], endian); + pHeader->bound = spvFixWord(binary->code[SPV_INDEX_BOUND], endian); + pHeader->schema = spvFixWord(binary->code[SPV_INDEX_SCHEMA], endian); + pHeader->instructions = &binary->code[SPV_INDEX_INSTRUCTION]; + + return SPV_SUCCESS; +} + +namespace { + +// A SPIR-V binary parser. A parser instance communicates detailed parse +// results via callbacks. +class Parser { + public: + // The user_data value is provided to the callbacks as context. + Parser(const spv_const_context context, void* user_data, + spv_parsed_header_fn_t parsed_header_fn, + spv_parsed_instruction_fn_t parsed_instruction_fn) + : grammar_(context), + consumer_(context->consumer), + user_data_(user_data), + parsed_header_fn_(parsed_header_fn), + parsed_instruction_fn_(parsed_instruction_fn) {} + + // Parses the specified binary SPIR-V module, issuing callbacks on a parsed + // header and for each parsed instruction. Returns SPV_SUCCESS on success. + // Otherwise returns an error code and issues a diagnostic. + spv_result_t parse(const uint32_t* words, size_t num_words, + spv_diagnostic* diagnostic); + + private: + // All remaining methods work on the current module parse state. + + // Like the parse method, but works on the current module parse state. + spv_result_t parseModule(); + + // Parses an instruction at the current position of the binary. Assumes + // the header has been parsed, the endian has been set, and the word index is + // still in range. Advances the parsing position past the instruction, and + // updates other parsing state for the current module. + // On success, returns SPV_SUCCESS and issues the parsed-instruction callback. + // On failure, returns an error code and issues a diagnostic. + spv_result_t parseInstruction(); + + // Parses an instruction operand with the given type, for an instruction + // starting at inst_offset words into the SPIR-V binary. + // If the SPIR-V binary is the same endianness as the host, then the + // endian_converted_inst_words parameter is ignored. Otherwise, this method + // appends the words for this operand, converted to host native endianness, + // to the end of endian_converted_inst_words. This method also updates the + // expected_operands parameter, and the scalar members of the inst parameter. + // On success, returns SPV_SUCCESS, advances past the operand, and pushes a + // new entry on to the operands vector. Otherwise returns an error code and + // issues a diagnostic. + spv_result_t parseOperand(size_t inst_offset, spv_parsed_instruction_t* inst, + const spv_operand_type_t type, + std::vector* endian_converted_inst_words, + std::vector* operands, + spv_operand_pattern_t* expected_operands); + + // Records the numeric type for an operand according to the type information + // associated with the given non-zero type Id. This can fail if the type Id + // is not a type Id, or if the type Id does not reference a scalar numeric + // type. On success, return SPV_SUCCESS and populates the num_words, + // number_kind, and number_bit_width fields of parsed_operand. + spv_result_t setNumericTypeInfoForType(spv_parsed_operand_t* parsed_operand, + uint32_t type_id); + + // Records the number type for an instruction at the given offset, if that + // instruction generates a type. For types that aren't scalar numbers, + // record something with number kind SPV_NUMBER_NONE. + void recordNumberType(size_t inst_offset, + const spv_parsed_instruction_t* inst); + + // Returns a diagnostic stream object initialized with current position in + // the input stream, and for the given error code. Any data written to the + // returned object will be propagated to the current parse's diagnostic + // object. + spvtools::DiagnosticStream diagnostic(spv_result_t error) { + return spvtools::DiagnosticStream({0, 0, _.word_index}, consumer_, "", + error); + } + + // Returns a diagnostic stream object with the default parse error code. + spvtools::DiagnosticStream diagnostic() { + // The default failure for parsing is invalid binary. + return diagnostic(SPV_ERROR_INVALID_BINARY); + } + + // Issues a diagnostic describing an exhaustion of input condition when + // trying to decode an instruction operand, and returns + // SPV_ERROR_INVALID_BINARY. + spv_result_t exhaustedInputDiagnostic(size_t inst_offset, SpvOp opcode, + spv_operand_type_t type) { + return diagnostic() << "End of input reached while decoding Op" + << spvOpcodeString(opcode) << " starting at word " + << inst_offset + << ((_.word_index < _.num_words) ? ": truncated " + : ": missing ") + << spvOperandTypeStr(type) << " operand at word offset " + << _.word_index - inst_offset << "."; + } + + // Returns the endian-corrected word at the current position. + uint32_t peek() const { return peekAt(_.word_index); } + + // Returns the endian-corrected word at the given position. + uint32_t peekAt(size_t index) const { + assert(index < _.num_words); + return spvFixWord(_.words[index], _.endian); + } + + // Data members + + const spvtools::AssemblyGrammar grammar_; // SPIR-V syntax utility. + const spvtools::MessageConsumer& consumer_; // Message consumer callback. + void* const user_data_; // Context for the callbacks + const spv_parsed_header_fn_t parsed_header_fn_; // Parsed header callback + const spv_parsed_instruction_fn_t + parsed_instruction_fn_; // Parsed instruction callback + + // Describes the format of a typed literal number. + struct NumberType { + spv_number_kind_t type; + uint32_t bit_width; + }; + + // The state used to parse a single SPIR-V binary module. + struct State { + State(const uint32_t* words_arg, size_t num_words_arg, + spv_diagnostic* diagnostic_arg) + : words(words_arg), + num_words(num_words_arg), + diagnostic(diagnostic_arg), + word_index(0), + endian(), + requires_endian_conversion(false) { + // Temporary storage for parser state within a single instruction. + // Most instructions require fewer than 25 words or operands. + operands.reserve(25); + endian_converted_words.reserve(25); + expected_operands.reserve(25); + } + State() : State(0, 0, nullptr) {} + const uint32_t* words; // Words in the binary SPIR-V module. + size_t num_words; // Number of words in the module. + spv_diagnostic* diagnostic; // Where diagnostics go. + size_t word_index; // The current position in words. + spv_endianness_t endian; // The endianness of the binary. + // Is the SPIR-V binary in a different endiannes from the host native + // endianness? + bool requires_endian_conversion; + + // Maps a result ID to its type ID. By convention: + // - a result ID that is a type definition maps to itself. + // - a result ID without a type maps to 0. (E.g. for OpLabel) + std::unordered_map id_to_type_id; + // Maps a type ID to its number type description. + std::unordered_map type_id_to_number_type_info; + // Maps an ExtInstImport id to the extended instruction type. + std::unordered_map + import_id_to_ext_inst_type; + + // Used by parseOperand + std::vector operands; + std::vector endian_converted_words; + spv_operand_pattern_t expected_operands; + } _; +}; + +spv_result_t Parser::parse(const uint32_t* words, size_t num_words, + spv_diagnostic* diagnostic_arg) { + _ = State(words, num_words, diagnostic_arg); + + const spv_result_t result = parseModule(); + + // Clear the module state. The tables might be big. + _ = State(); + + return result; +} + +spv_result_t Parser::parseModule() { + if (!_.words) return diagnostic() << "Missing module."; + + if (_.num_words < SPV_INDEX_INSTRUCTION) + return diagnostic() << "Module has incomplete header: only " << _.num_words + << " words instead of " << SPV_INDEX_INSTRUCTION; + + // Check the magic number and detect the module's endianness. + spv_const_binary_t binary{_.words, _.num_words}; + if (spvBinaryEndianness(&binary, &_.endian)) { + return diagnostic() << "Invalid SPIR-V magic number '" << std::hex + << _.words[0] << "'."; + } + _.requires_endian_conversion = !spvIsHostEndian(_.endian); + + // Process the header. + spv_header_t header; + if (spvBinaryHeaderGet(&binary, _.endian, &header)) { + // It turns out there is no way to trigger this error since the only + // failure cases are already handled above, with better messages. + return diagnostic(SPV_ERROR_INTERNAL) + << "Internal error: unhandled header parse failure"; + } + if (parsed_header_fn_) { + if (auto error = parsed_header_fn_(user_data_, _.endian, header.magic, + header.version, header.generator, + header.bound, header.schema)) { + return error; + } + } + + // Process the instructions. + _.word_index = SPV_INDEX_INSTRUCTION; + while (_.word_index < _.num_words) + if (auto error = parseInstruction()) return error; + + // Running off the end should already have been reported earlier. + assert(_.word_index == _.num_words); + + return SPV_SUCCESS; +} + +spv_result_t Parser::parseInstruction() { + // The zero values for all members except for opcode are the + // correct initial values. + spv_parsed_instruction_t inst = {}; + + const uint32_t first_word = peek(); + + // If the module's endianness is different from the host native endianness, + // then converted_words contains the the endian-translated words in the + // instruction. + _.endian_converted_words.clear(); + _.endian_converted_words.push_back(first_word); + + // After a successful parse of the instruction, the inst.operands member + // will point to this vector's storage. + _.operands.clear(); + + assert(_.word_index < _.num_words); + // Decompose and check the first word. + uint16_t inst_word_count = 0; + spvOpcodeSplit(first_word, &inst_word_count, &inst.opcode); + if (inst_word_count < 1) { + return diagnostic() << "Invalid instruction word count: " + << inst_word_count; + } + spv_opcode_desc opcode_desc; + if (grammar_.lookupOpcode(static_cast(inst.opcode), &opcode_desc)) + return diagnostic() << "Invalid opcode: " << inst.opcode; + + // Advance past the opcode word. But remember the of the start + // of the instruction. + const size_t inst_offset = _.word_index; + _.word_index++; + + // Maintains the ordered list of expected operand types. + // For many instructions we only need the {numTypes, operandTypes} + // entries in opcode_desc. However, sometimes we need to modify + // the list as we parse the operands. This occurs when an operand + // has its own logical operands (such as the LocalSize operand for + // ExecutionMode), or for extended instructions that may have their + // own operands depending on the selected extended instruction. + _.expected_operands.clear(); + for (auto i = 0; i < opcode_desc->numTypes; i++) + _.expected_operands.push_back( + opcode_desc->operandTypes[opcode_desc->numTypes - i - 1]); + + while (_.word_index < inst_offset + inst_word_count) { + const uint16_t inst_word_index = uint16_t(_.word_index - inst_offset); + if (_.expected_operands.empty()) { + return diagnostic() << "Invalid instruction Op" << opcode_desc->name + << " starting at word " << inst_offset + << ": expected no more operands after " + << inst_word_index + << " words, but stated word count is " + << inst_word_count << "."; + } + + spv_operand_type_t type = + spvTakeFirstMatchableOperand(&_.expected_operands); + + if (auto error = + parseOperand(inst_offset, &inst, type, &_.endian_converted_words, + &_.operands, &_.expected_operands)) { + return error; + } + } + + if (!_.expected_operands.empty() && + !spvOperandIsOptional(_.expected_operands.back())) { + return diagnostic() << "End of input reached while decoding Op" + << opcode_desc->name << " starting at word " + << inst_offset << ": expected more operands after " + << inst_word_count << " words."; + } + + if ((inst_offset + inst_word_count) != _.word_index) { + return diagnostic() << "Invalid word count: Op" << opcode_desc->name + << " starting at word " << inst_offset + << " says it has " << inst_word_count + << " words, but found " << _.word_index - inst_offset + << " words instead."; + } + + // Check the computed length of the endian-converted words vector against + // the declared number of words in the instruction. If endian conversion + // is required, then they should match. If no endian conversion was + // performed, then the vector only contains the initial opcode/word-count + // word. + assert(!_.requires_endian_conversion || + (inst_word_count == _.endian_converted_words.size())); + assert(_.requires_endian_conversion || + (_.endian_converted_words.size() == 1)); + + recordNumberType(inst_offset, &inst); + + if (_.requires_endian_conversion) { + // We must wait until here to set this pointer, because the vector might + // have been be resized while we accumulated its elements. + inst.words = _.endian_converted_words.data(); + } else { + // If no conversion is required, then just point to the underlying binary. + // This saves time and space. + inst.words = _.words + inst_offset; + } + inst.num_words = inst_word_count; + + // We must wait until here to set this pointer, because the vector might + // have been be resized while we accumulated its elements. + inst.operands = _.operands.data(); + inst.num_operands = uint16_t(_.operands.size()); + + // Issue the callback. The callee should know that all the storage in inst + // is transient, and will disappear immediately afterward. + if (parsed_instruction_fn_) { + if (auto error = parsed_instruction_fn_(user_data_, &inst)) return error; + } + + return SPV_SUCCESS; +} + +spv_result_t Parser::parseOperand(size_t inst_offset, + spv_parsed_instruction_t* inst, + const spv_operand_type_t type, + std::vector* words, + std::vector* operands, + spv_operand_pattern_t* expected_operands) { + const SpvOp opcode = static_cast(inst->opcode); + // We'll fill in this result as we go along. + spv_parsed_operand_t parsed_operand; + parsed_operand.offset = uint16_t(_.word_index - inst_offset); + // Most operands occupy one word. This might be be adjusted later. + parsed_operand.num_words = 1; + // The type argument is the one used by the grammar to parse the instruction. + // But it can exposes internal parser details such as whether an operand is + // optional or actually represents a variable-length sequence of operands. + // The resulting type should be adjusted to avoid those internal details. + // In most cases, the resulting operand type is the same as the grammar type. + parsed_operand.type = type; + + // Assume non-numeric values. This will be updated for literal numbers. + parsed_operand.number_kind = SPV_NUMBER_NONE; + parsed_operand.number_bit_width = 0; + + if (_.word_index >= _.num_words) + return exhaustedInputDiagnostic(inst_offset, opcode, type); + + const uint32_t word = peek(); + + // Do the words in this operand have to be converted to native endianness? + // True for all but literal strings. + bool convert_operand_endianness = true; + + switch (type) { + case SPV_OPERAND_TYPE_TYPE_ID: + if (!word) + return diagnostic(SPV_ERROR_INVALID_ID) << "Error: Type Id is 0"; + inst->type_id = word; + break; + + case SPV_OPERAND_TYPE_RESULT_ID: + if (!word) + return diagnostic(SPV_ERROR_INVALID_ID) << "Error: Result Id is 0"; + inst->result_id = word; + // Save the result ID to type ID mapping. + // In the grammar, type ID always appears before result ID. + if (_.id_to_type_id.find(inst->result_id) != _.id_to_type_id.end()) + return diagnostic(SPV_ERROR_INVALID_ID) + << "Id " << inst->result_id << " is defined more than once"; + // Record it. + // A regular value maps to its type. Some instructions (e.g. OpLabel) + // have no type Id, and will map to 0. The result Id for a + // type-generating instruction (e.g. OpTypeInt) maps to itself. + _.id_to_type_id[inst->result_id] = + spvOpcodeGeneratesType(opcode) ? inst->result_id : inst->type_id; + break; + + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: + if (!word) return diagnostic(SPV_ERROR_INVALID_ID) << "Id is 0"; + parsed_operand.type = SPV_OPERAND_TYPE_ID; + + if (opcode == SpvOpExtInst && parsed_operand.offset == 3) { + // The current word is the extended instruction set Id. + // Set the extended instruction set type for the current instruction. + auto ext_inst_type_iter = _.import_id_to_ext_inst_type.find(word); + if (ext_inst_type_iter == _.import_id_to_ext_inst_type.end()) { + return diagnostic(SPV_ERROR_INVALID_ID) + << "OpExtInst set Id " << word + << " does not reference an OpExtInstImport result Id"; + } + inst->ext_inst_type = ext_inst_type_iter->second; + } + break; + + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + // Check for trivially invalid values. The operand descriptions already + // have the word "ID" in them. + if (!word) return diagnostic() << spvOperandTypeStr(type) << " is 0"; + break; + + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { + assert(SpvOpExtInst == opcode); + assert(inst->ext_inst_type != SPV_EXT_INST_TYPE_NONE); + spv_ext_inst_desc ext_inst; + if (grammar_.lookupExtInst(inst->ext_inst_type, word, &ext_inst)) + return diagnostic() << "Invalid extended instruction number: " << word; + spvPushOperandTypes(ext_inst->operandTypes, expected_operands); + } break; + + case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: { + assert(SpvOpSpecConstantOp == opcode); + if (grammar_.lookupSpecConstantOpcode(SpvOp(word))) { + return diagnostic() + << "Invalid " << spvOperandTypeStr(type) << ": " << word; + } + spv_opcode_desc opcode_entry = nullptr; + if (grammar_.lookupOpcode(SpvOp(word), &opcode_entry)) { + return diagnostic(SPV_ERROR_INTERNAL) + << "OpSpecConstant opcode table out of sync"; + } + // OpSpecConstant opcodes must have a type and result. We've already + // processed them, so skip them when preparing to parse the other + // operants for the opcode. + assert(opcode_entry->hasType); + assert(opcode_entry->hasResult); + assert(opcode_entry->numTypes >= 2); + spvPushOperandTypes(opcode_entry->operandTypes + 2, expected_operands); + } break; + + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: + // These are regular single-word literal integer operands. + // Post-parsing validation should check the range of the parsed value. + parsed_operand.type = SPV_OPERAND_TYPE_LITERAL_INTEGER; + // It turns out they are always unsigned integers! + parsed_operand.number_kind = SPV_NUMBER_UNSIGNED_INT; + parsed_operand.number_bit_width = 32; + break; + + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: + case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: + parsed_operand.type = SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER; + if (opcode == SpvOpSwitch) { + // The literal operands have the same type as the value + // referenced by the selector Id. + const uint32_t selector_id = peekAt(inst_offset + 1); + const auto type_id_iter = _.id_to_type_id.find(selector_id); + if (type_id_iter == _.id_to_type_id.end() || + type_id_iter->second == 0) { + return diagnostic() << "Invalid OpSwitch: selector id " << selector_id + << " has no type"; + } + uint32_t type_id = type_id_iter->second; + + if (selector_id == type_id) { + // Recall that by convention, a result ID that is a type definition + // maps to itself. + return diagnostic() << "Invalid OpSwitch: selector id " << selector_id + << " is a type, not a value"; + } + if (auto error = setNumericTypeInfoForType(&parsed_operand, type_id)) + return error; + if (parsed_operand.number_kind != SPV_NUMBER_UNSIGNED_INT && + parsed_operand.number_kind != SPV_NUMBER_SIGNED_INT) { + return diagnostic() << "Invalid OpSwitch: selector id " << selector_id + << " is not a scalar integer"; + } + } else { + assert(opcode == SpvOpConstant || opcode == SpvOpSpecConstant); + // The literal number type is determined by the type Id for the + // constant. + assert(inst->type_id); + if (auto error = + setNumericTypeInfoForType(&parsed_operand, inst->type_id)) + return error; + } + break; + + case SPV_OPERAND_TYPE_LITERAL_STRING: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { + convert_operand_endianness = false; + const char* string = + reinterpret_cast(_.words + _.word_index); + // Compute the length of the string, but make sure we don't run off the + // end of the input. + const size_t remaining_input_bytes = + sizeof(uint32_t) * (_.num_words - _.word_index); + const size_t string_num_content_bytes = + spv_strnlen_s(string, remaining_input_bytes); + // If there was no terminating null byte, then that's an end-of-input + // error. + if (string_num_content_bytes == remaining_input_bytes) + return exhaustedInputDiagnostic(inst_offset, opcode, type); + // Account for null in the word length, so add 1 for null, then add 3 to + // make sure we round up. The following is equivalent to: + // (string_num_content_bytes + 1 + 3) / 4 + const size_t string_num_words = string_num_content_bytes / 4 + 1; + // Make sure we can record the word count without overflow. + // + // This error can't currently be triggered because of validity + // checks elsewhere. + if (string_num_words > std::numeric_limits::max()) { + return diagnostic() << "Literal string is longer than " + << std::numeric_limits::max() + << " words: " << string_num_words << " words long"; + } + parsed_operand.num_words = uint16_t(string_num_words); + parsed_operand.type = SPV_OPERAND_TYPE_LITERAL_STRING; + + if (SpvOpExtInstImport == opcode) { + // Record the extended instruction type for the ID for this import. + // There is only one string literal argument to OpExtInstImport, + // so it's sufficient to guard this just on the opcode. + const spv_ext_inst_type_t ext_inst_type = + spvExtInstImportTypeGet(string); + if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { + return diagnostic() + << "Invalid extended instruction import '" << string << "'"; + } + // We must have parsed a valid result ID. It's a condition + // of the grammar, and we only accept non-zero result Ids. + assert(inst->result_id); + _.import_id_to_ext_inst_type[inst->result_id] = ext_inst_type; + } + } break; + + case SPV_OPERAND_TYPE_CAPABILITY: + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: + case SPV_OPERAND_TYPE_EXECUTION_MODEL: + case SPV_OPERAND_TYPE_ADDRESSING_MODEL: + case SPV_OPERAND_TYPE_MEMORY_MODEL: + case SPV_OPERAND_TYPE_EXECUTION_MODE: + case SPV_OPERAND_TYPE_STORAGE_CLASS: + case SPV_OPERAND_TYPE_DIMENSIONALITY: + case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: + case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: + case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: + case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: + case SPV_OPERAND_TYPE_LINKAGE_TYPE: + case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: + case SPV_OPERAND_TYPE_DECORATION: + case SPV_OPERAND_TYPE_BUILT_IN: + case SPV_OPERAND_TYPE_GROUP_OPERATION: + case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: + case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: + case SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING: + case SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE: + case SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER: + case SPV_OPERAND_TYPE_DEBUG_OPERATION: { + // A single word that is a plain enum value. + + // Map an optional operand type to its corresponding concrete type. + if (type == SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER) + parsed_operand.type = SPV_OPERAND_TYPE_ACCESS_QUALIFIER; + + spv_operand_desc entry; + if (grammar_.lookupOperand(type, word, &entry)) { + return diagnostic() + << "Invalid " << spvOperandTypeStr(parsed_operand.type) + << " operand: " << word; + } + // Prepare to accept operands to this operand, if needed. + spvPushOperandTypes(entry->operandTypes, expected_operands); + } break; + + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + case SPV_OPERAND_TYPE_LOOP_CONTROL: + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_SELECTION_CONTROL: + case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: { + // This operand is a mask. + + // Map an optional operand type to its corresponding concrete type. + if (type == SPV_OPERAND_TYPE_OPTIONAL_IMAGE) + parsed_operand.type = SPV_OPERAND_TYPE_IMAGE; + else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS) + parsed_operand.type = SPV_OPERAND_TYPE_MEMORY_ACCESS; + + // Check validity of set mask bits. Also prepare for operands for those + // masks if they have any. To get operand order correct, scan from + // MSB to LSB since we can only prepend operands to a pattern. + // The only case in the grammar where you have more than one mask bit + // having an operand is for image operands. See SPIR-V 3.14 Image + // Operands. + uint32_t remaining_word = word; + for (uint32_t mask = (1u << 31); remaining_word; mask >>= 1) { + if (remaining_word & mask) { + spv_operand_desc entry; + if (grammar_.lookupOperand(type, mask, &entry)) { + return diagnostic() + << "Invalid " << spvOperandTypeStr(parsed_operand.type) + << " operand: " << word << " has invalid mask component " + << mask; + } + remaining_word ^= mask; + spvPushOperandTypes(entry->operandTypes, expected_operands); + } + } + if (word == 0) { + // An all-zeroes mask *might* also be valid. + spv_operand_desc entry; + if (SPV_SUCCESS == grammar_.lookupOperand(type, 0, &entry)) { + // Prepare for its operands, if any. + spvPushOperandTypes(entry->operandTypes, expected_operands); + } + } + } break; + default: + return diagnostic() << "Internal error: Unhandled operand type: " << type; + } + + assert(spvOperandIsConcrete(parsed_operand.type)); + + operands->push_back(parsed_operand); + + const size_t index_after_operand = _.word_index + parsed_operand.num_words; + + // Avoid buffer overrun for the cases where the operand has more than one + // word, and where it isn't a string. (Those other cases have already been + // handled earlier.) For example, this error can occur for a multi-word + // argument to OpConstant, or a multi-word case literal operand for OpSwitch. + if (_.num_words < index_after_operand) + return exhaustedInputDiagnostic(inst_offset, opcode, type); + + if (_.requires_endian_conversion) { + // Copy instruction words. Translate to native endianness as needed. + if (convert_operand_endianness) { + const spv_endianness_t endianness = _.endian; + std::transform(_.words + _.word_index, _.words + index_after_operand, + std::back_inserter(*words), + [endianness](const uint32_t raw_word) { + return spvFixWord(raw_word, endianness); + }); + } else { + words->insert(words->end(), _.words + _.word_index, + _.words + index_after_operand); + } + } + + // Advance past the operand. + _.word_index = index_after_operand; + + return SPV_SUCCESS; +} + +spv_result_t Parser::setNumericTypeInfoForType( + spv_parsed_operand_t* parsed_operand, uint32_t type_id) { + assert(type_id != 0); + auto type_info_iter = _.type_id_to_number_type_info.find(type_id); + if (type_info_iter == _.type_id_to_number_type_info.end()) { + return diagnostic() << "Type Id " << type_id << " is not a type"; + } + const NumberType& info = type_info_iter->second; + if (info.type == SPV_NUMBER_NONE) { + // This is a valid type, but for something other than a scalar number. + return diagnostic() << "Type Id " << type_id + << " is not a scalar numeric type"; + } + + parsed_operand->number_kind = info.type; + parsed_operand->number_bit_width = info.bit_width; + // Round up the word count. + parsed_operand->num_words = static_cast((info.bit_width + 31) / 32); + return SPV_SUCCESS; +} + +void Parser::recordNumberType(size_t inst_offset, + const spv_parsed_instruction_t* inst) { + const SpvOp opcode = static_cast(inst->opcode); + if (spvOpcodeGeneratesType(opcode)) { + NumberType info = {SPV_NUMBER_NONE, 0}; + if (SpvOpTypeInt == opcode) { + const bool is_signed = peekAt(inst_offset + 3) != 0; + info.type = is_signed ? SPV_NUMBER_SIGNED_INT : SPV_NUMBER_UNSIGNED_INT; + info.bit_width = peekAt(inst_offset + 2); + } else if (SpvOpTypeFloat == opcode) { + info.type = SPV_NUMBER_FLOATING; + info.bit_width = peekAt(inst_offset + 2); + } + // The *result* Id of a type generating instruction is the type Id. + _.type_id_to_number_type_info[inst->result_id] = info; + } +} + +} // anonymous namespace + +spv_result_t spvBinaryParse(const spv_const_context context, void* user_data, + const uint32_t* code, const size_t num_words, + spv_parsed_header_fn_t parsed_header, + spv_parsed_instruction_fn_t parsed_instruction, + spv_diagnostic* diagnostic) { + spv_context_t hijack_context = *context; + if (diagnostic) { + *diagnostic = nullptr; + spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, diagnostic); + } + Parser parser(&hijack_context, user_data, parsed_header, parsed_instruction); + return parser.parse(code, num_words, diagnostic); +} + +// TODO(dneto): This probably belongs in text.cpp since that's the only place +// that a spv_binary_t value is created. +void spvBinaryDestroy(spv_binary binary) { + if (!binary) return; + delete[] binary->code; + delete binary; +} + +size_t spv_strnlen_s(const char* str, size_t strsz) { + if (!str) return 0; + for (size_t i = 0; i < strsz; i++) { + if (!str[i]) return i; + } + return strsz; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/binary.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/binary.h new file mode 100644 index 00000000000..66d24c7e41f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/binary.h @@ -0,0 +1,36 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_BINARY_H_ +#define SOURCE_BINARY_H_ + +#include "source/spirv_definition.h" +#include "spirv-tools/libspirv.h" + +// Functions + +// Grabs the header from the SPIR-V module given in the binary parameter. The +// endian parameter specifies the endianness of the binary module. On success, +// returns SPV_SUCCESS and writes the parsed header into *header. +spv_result_t spvBinaryHeaderGet(const spv_const_binary binary, + const spv_endianness_t endian, + spv_header_t* header); + +// Returns the number of non-null characters in str before the first null +// character, or strsz if there is no null character. Examines at most the +// first strsz characters in str. Returns 0 if str is nullptr. This is a +// replacement for C11's strnlen_s which might not exist in all environments. +size_t spv_strnlen_s(const char* str, size_t strsz); + +#endif // SOURCE_BINARY_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/cfa.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/cfa.h new file mode 100644 index 00000000000..97ef398d690 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/cfa.h @@ -0,0 +1,347 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_CFA_H_ +#define SOURCE_CFA_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace spvtools { + +// Control Flow Analysis of control flow graphs of basic block nodes |BB|. +template +class CFA { + using bb_ptr = BB*; + using cbb_ptr = const BB*; + using bb_iter = typename std::vector::const_iterator; + using get_blocks_func = std::function*(const BB*)>; + + struct block_info { + cbb_ptr block; ///< pointer to the block + bb_iter iter; ///< Iterator to the current child node being processed + }; + + /// Returns true if a block with @p id is found in the @p work_list vector + /// + /// @param[in] work_list Set of blocks visited in the the depth first + /// traversal + /// of the CFG + /// @param[in] id The ID of the block being checked + /// + /// @return true if the edge work_list.back().block->id() => id is a back-edge + static bool FindInWorkList(const std::vector& work_list, + uint32_t id); + + public: + /// @brief Depth first traversal starting from the \p entry BasicBlock + /// + /// This function performs a depth first traversal from the \p entry + /// BasicBlock and calls the pre/postorder functions when it needs to process + /// the node in pre order, post order. It also calls the backedge function + /// when a back edge is encountered. + /// + /// @param[in] entry The root BasicBlock of a CFG + /// @param[in] successor_func A function which will return a pointer to the + /// successor nodes + /// @param[in] preorder A function that will be called for every block in a + /// CFG following preorder traversal semantics + /// @param[in] postorder A function that will be called for every block in a + /// CFG following postorder traversal semantics + /// @param[in] backedge A function that will be called when a backedge is + /// encountered during a traversal + /// NOTE: The @p successor_func and predecessor_func each return a pointer to + /// a + /// collection such that iterators to that collection remain valid for the + /// lifetime of the algorithm. + static void DepthFirstTraversal( + const BB* entry, get_blocks_func successor_func, + std::function preorder, + std::function postorder, + std::function backedge); + + /// @brief Calculates dominator edges for a set of blocks + /// + /// Computes dominators using the algorithm of Cooper, Harvey, and Kennedy + /// "A Simple, Fast Dominance Algorithm", 2001. + /// + /// The algorithm assumes there is a unique root node (a node without + /// predecessors), and it is therefore at the end of the postorder vector. + /// + /// This function calculates the dominator edges for a set of blocks in the + /// CFG. + /// Uses the dominator algorithm by Cooper et al. + /// + /// @param[in] postorder A vector of blocks in post order traversal + /// order + /// in a CFG + /// @param[in] predecessor_func Function used to get the predecessor nodes of + /// a + /// block + /// + /// @return the dominator tree of the graph, as a vector of pairs of nodes. + /// The first node in the pair is a node in the graph. The second node in the + /// pair is its immediate dominator in the sense of Cooper et.al., where a + /// block + /// without predecessors (such as the root node) is its own immediate + /// dominator. + static std::vector> CalculateDominators( + const std::vector& postorder, get_blocks_func predecessor_func); + + // Computes a minimal set of root nodes required to traverse, in the forward + // direction, the CFG represented by the given vector of blocks, and successor + // and predecessor functions. When considering adding two nodes, each having + // predecessors, favour using the one that appears earlier on the input blocks + // list. + static std::vector TraversalRoots(const std::vector& blocks, + get_blocks_func succ_func, + get_blocks_func pred_func); + + static void ComputeAugmentedCFG( + std::vector& ordered_blocks, BB* pseudo_entry_block, + BB* pseudo_exit_block, + std::unordered_map>* augmented_successors_map, + std::unordered_map>* + augmented_predecessors_map, + get_blocks_func succ_func, get_blocks_func pred_func); +}; + +template +bool CFA::FindInWorkList(const std::vector& work_list, + uint32_t id) { + for (const auto b : work_list) { + if (b.block->id() == id) return true; + } + return false; +} + +template +void CFA::DepthFirstTraversal( + const BB* entry, get_blocks_func successor_func, + std::function preorder, + std::function postorder, + std::function backedge) { + std::unordered_set processed; + + /// NOTE: work_list is the sequence of nodes from the root node to the node + /// being processed in the traversal + std::vector work_list; + work_list.reserve(10); + + work_list.push_back({entry, std::begin(*successor_func(entry))}); + preorder(entry); + processed.insert(entry->id()); + + while (!work_list.empty()) { + block_info& top = work_list.back(); + if (top.iter == end(*successor_func(top.block))) { + postorder(top.block); + work_list.pop_back(); + } else { + BB* child = *top.iter; + top.iter++; + if (FindInWorkList(work_list, child->id())) { + backedge(top.block, child); + } + if (processed.count(child->id()) == 0) { + preorder(child); + work_list.emplace_back( + block_info{child, std::begin(*successor_func(child))}); + processed.insert(child->id()); + } + } + } +} + +template +std::vector> CFA::CalculateDominators( + const std::vector& postorder, get_blocks_func predecessor_func) { + struct block_detail { + size_t dominator; ///< The index of blocks's dominator in post order array + size_t postorder_index; ///< The index of the block in the post order array + }; + const size_t undefined_dom = postorder.size(); + + std::unordered_map idoms; + for (size_t i = 0; i < postorder.size(); i++) { + idoms[postorder[i]] = {undefined_dom, i}; + } + idoms[postorder.back()].dominator = idoms[postorder.back()].postorder_index; + + bool changed = true; + while (changed) { + changed = false; + for (auto b = postorder.rbegin() + 1; b != postorder.rend(); ++b) { + const std::vector& predecessors = *predecessor_func(*b); + // Find the first processed/reachable predecessor that is reachable + // in the forward traversal. + auto res = std::find_if(std::begin(predecessors), std::end(predecessors), + [&idoms, undefined_dom](BB* pred) { + return idoms.count(pred) && + idoms[pred].dominator != undefined_dom; + }); + if (res == end(predecessors)) continue; + const BB* idom = *res; + size_t idom_idx = idoms[idom].postorder_index; + + // all other predecessors + for (const auto* p : predecessors) { + if (idom == p) continue; + // Only consider nodes reachable in the forward traversal. + // Otherwise the intersection doesn't make sense and will never + // terminate. + if (!idoms.count(p)) continue; + if (idoms[p].dominator != undefined_dom) { + size_t finger1 = idoms[p].postorder_index; + size_t finger2 = idom_idx; + while (finger1 != finger2) { + while (finger1 < finger2) { + finger1 = idoms[postorder[finger1]].dominator; + } + while (finger2 < finger1) { + finger2 = idoms[postorder[finger2]].dominator; + } + } + idom_idx = finger1; + } + } + if (idoms[*b].dominator != idom_idx) { + idoms[*b].dominator = idom_idx; + changed = true; + } + } + } + + std::vector> out; + for (auto idom : idoms) { + // NOTE: performing a const cast for convenient usage with + // UpdateImmediateDominators + out.push_back({const_cast(std::get<0>(idom)), + const_cast(postorder[std::get<1>(idom).dominator])}); + } + + // Sort by postorder index to generate a deterministic ordering of edges. + std::sort( + out.begin(), out.end(), + [&idoms](const std::pair& lhs, + const std::pair& rhs) { + assert(lhs.first); + assert(lhs.second); + assert(rhs.first); + assert(rhs.second); + auto lhs_indices = std::make_pair(idoms[lhs.first].postorder_index, + idoms[lhs.second].postorder_index); + auto rhs_indices = std::make_pair(idoms[rhs.first].postorder_index, + idoms[rhs.second].postorder_index); + return lhs_indices < rhs_indices; + }); + return out; +} + +template +std::vector CFA::TraversalRoots(const std::vector& blocks, + get_blocks_func succ_func, + get_blocks_func pred_func) { + // The set of nodes which have been visited from any of the roots so far. + std::unordered_set visited; + + auto mark_visited = [&visited](const BB* b) { visited.insert(b); }; + auto ignore_block = [](const BB*) {}; + auto ignore_blocks = [](const BB*, const BB*) {}; + + auto traverse_from_root = [&mark_visited, &succ_func, &ignore_block, + &ignore_blocks](const BB* entry) { + DepthFirstTraversal(entry, succ_func, mark_visited, ignore_block, + ignore_blocks); + }; + + std::vector result; + + // First collect nodes without predecessors. + for (auto block : blocks) { + if (pred_func(block)->empty()) { + assert(visited.count(block) == 0 && "Malformed graph!"); + result.push_back(block); + traverse_from_root(block); + } + } + + // Now collect other stranded nodes. These must be in unreachable cycles. + for (auto block : blocks) { + if (visited.count(block) == 0) { + result.push_back(block); + traverse_from_root(block); + } + } + + return result; +} + +template +void CFA::ComputeAugmentedCFG( + std::vector& ordered_blocks, BB* pseudo_entry_block, + BB* pseudo_exit_block, + std::unordered_map>* augmented_successors_map, + std::unordered_map>* augmented_predecessors_map, + get_blocks_func succ_func, get_blocks_func pred_func) { + // Compute the successors of the pseudo-entry block, and + // the predecessors of the pseudo exit block. + auto sources = TraversalRoots(ordered_blocks, succ_func, pred_func); + + // For the predecessor traversals, reverse the order of blocks. This + // will affect the post-dominance calculation as follows: + // - Suppose you have blocks A and B, with A appearing before B in + // the list of blocks. + // - Also, A branches only to B, and B branches only to A. + // - We want to compute A as dominating B, and B as post-dominating B. + // By using reversed blocks for predecessor traversal roots discovery, + // we'll add an edge from B to the pseudo-exit node, rather than from A. + // All this is needed to correctly process the dominance/post-dominance + // constraint when A is a loop header that points to itself as its + // own continue target, and B is the latch block for the loop. + std::vector reversed_blocks(ordered_blocks.rbegin(), + ordered_blocks.rend()); + auto sinks = TraversalRoots(reversed_blocks, pred_func, succ_func); + + // Wire up the pseudo entry block. + (*augmented_successors_map)[pseudo_entry_block] = sources; + for (auto block : sources) { + auto& augmented_preds = (*augmented_predecessors_map)[block]; + const auto preds = pred_func(block); + augmented_preds.reserve(1 + preds->size()); + augmented_preds.push_back(pseudo_entry_block); + augmented_preds.insert(augmented_preds.end(), preds->begin(), preds->end()); + } + + // Wire up the pseudo exit block. + (*augmented_predecessors_map)[pseudo_exit_block] = sinks; + for (auto block : sinks) { + auto& augmented_succ = (*augmented_successors_map)[block]; + const auto succ = succ_func(block); + augmented_succ.reserve(1 + succ->size()); + augmented_succ.push_back(pseudo_exit_block); + augmented_succ.insert(augmented_succ.end(), succ->begin(), succ->end()); + } +} + +} // namespace spvtools + +#endif // SOURCE_CFA_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/CMakeLists.txt new file mode 100644 index 00000000000..f65f9f670d2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright (c) 2017 Google 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. + +if(SPIRV_BUILD_COMPRESSION) + add_library(SPIRV-Tools-comp + bit_stream.cpp + bit_stream.h + huffman_codec.h + markv_codec.cpp + markv_codec.h + markv.cpp + markv.h + markv_decoder.cpp + markv_decoder.h + markv_encoder.cpp + markv_encoder.h + markv_logger.h + move_to_front.h + move_to_front.cpp) + + spvtools_default_compile_options(SPIRV-Tools-comp) + target_include_directories(SPIRV-Tools-comp + PUBLIC ${spirv-tools_SOURCE_DIR}/include + PUBLIC ${SPIRV_HEADER_INCLUDE_DIR} + PRIVATE ${spirv-tools_BINARY_DIR} + ) + + target_link_libraries(SPIRV-Tools-comp + PUBLIC ${SPIRV_TOOLS}) + + set_property(TARGET SPIRV-Tools-comp PROPERTY FOLDER "SPIRV-Tools libraries") + spvtools_check_symbol_exports(SPIRV-Tools-comp) + + if(ENABLE_SPIRV_TOOLS_INSTALL) + install(TARGETS SPIRV-Tools-comp + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif(ENABLE_SPIRV_TOOLS_INSTALL) + +endif(SPIRV_BUILD_COMPRESSION) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/bit_stream.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/bit_stream.cpp new file mode 100644 index 00000000000..a5769e03e49 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/bit_stream.cpp @@ -0,0 +1,348 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include + +#include "source/comp/bit_stream.h" + +namespace spvtools { +namespace comp { +namespace { + +// Returns if the system is little-endian. Unfortunately only works during +// runtime. +bool IsLittleEndian() { + // This constant value allows the detection of the host machine's endianness. + // Accessing it as an array of bytes is valid due to C++11 section 3.10 + // paragraph 10. + static const uint16_t kFF00 = 0xff00; + return reinterpret_cast(&kFF00)[0] == 0; +} + +// Copies bytes from the given buffer to a uint64_t buffer. +// Motivation: casting uint64_t* to uint8_t* is ok. Casting in the other +// direction is only advisable if uint8_t* is aligned to 64-bit word boundary. +std::vector ToBuffer64(const void* buffer, size_t num_bytes) { + std::vector out; + out.resize((num_bytes + 7) / 8, 0); + memcpy(out.data(), buffer, num_bytes); + return out; +} + +// Copies uint8_t buffer to a uint64_t buffer. +std::vector ToBuffer64(const std::vector& in) { + return ToBuffer64(in.data(), in.size()); +} + +// Returns uint64_t containing the same bits as |val|. +// Type size must be less than 8 bytes. +template +uint64_t ToU64(T val) { + static_assert(sizeof(T) <= 8, "Type size too big"); + uint64_t val64 = 0; + std::memcpy(&val64, &val, sizeof(T)); + return val64; +} + +// Returns value of type T containing the same bits as |val64|. +// Type size must be less than 8 bytes. Upper (unused) bits of |val64| must be +// zero (irrelevant, but is checked with assertion). +template +T FromU64(uint64_t val64) { + assert(sizeof(T) == 8 || (val64 >> (sizeof(T) * 8)) == 0); + static_assert(sizeof(T) <= 8, "Type size too big"); + T val = 0; + std::memcpy(&val, &val64, sizeof(T)); + return val; +} + +// Writes bits from |val| to |writer| in chunks of size |chunk_length|. +// Signal bit is used to signal if the reader should expect another chunk: +// 0 - no more chunks to follow +// 1 - more chunks to follow +// If number of written bits reaches |max_payload| last chunk is truncated. +void WriteVariableWidthInternal(BitWriterInterface* writer, uint64_t val, + size_t chunk_length, size_t max_payload) { + assert(chunk_length > 0); + assert(chunk_length < max_payload); + assert(max_payload == 64 || (val >> max_payload) == 0); + + if (val == 0) { + // Split in two writes for more readable logging. + writer->WriteBits(0, chunk_length); + writer->WriteBits(0, 1); + return; + } + + size_t payload_written = 0; + + while (val) { + if (payload_written + chunk_length >= max_payload) { + // This has to be the last chunk. + // There is no need for the signal bit and the chunk can be truncated. + const size_t left_to_write = max_payload - payload_written; + assert((val >> left_to_write) == 0); + writer->WriteBits(val, left_to_write); + break; + } + + writer->WriteBits(val, chunk_length); + payload_written += chunk_length; + val = val >> chunk_length; + + // Write a single bit to signal if there is more to come. + writer->WriteBits(val ? 1 : 0, 1); + } +} + +// Reads data written with WriteVariableWidthInternal. |chunk_length| and +// |max_payload| should be identical to those used to write the data. +// Returns false if the stream ends prematurely. +bool ReadVariableWidthInternal(BitReaderInterface* reader, uint64_t* val, + size_t chunk_length, size_t max_payload) { + assert(chunk_length > 0); + assert(chunk_length <= max_payload); + size_t payload_read = 0; + + while (payload_read + chunk_length < max_payload) { + uint64_t bits = 0; + if (reader->ReadBits(&bits, chunk_length) != chunk_length) return false; + + *val |= bits << payload_read; + payload_read += chunk_length; + + uint64_t more_to_come = 0; + if (reader->ReadBits(&more_to_come, 1) != 1) return false; + + if (!more_to_come) { + return true; + } + } + + // Need to read the last chunk which may be truncated. No signal bit follows. + uint64_t bits = 0; + const size_t left_to_read = max_payload - payload_read; + if (reader->ReadBits(&bits, left_to_read) != left_to_read) return false; + + *val |= bits << payload_read; + return true; +} + +// Calls WriteVariableWidthInternal with the right max_payload argument. +template +void WriteVariableWidthUnsigned(BitWriterInterface* writer, T val, + size_t chunk_length) { + static_assert(std::is_unsigned::value, "Type must be unsigned"); + static_assert(std::is_integral::value, "Type must be integral"); + WriteVariableWidthInternal(writer, val, chunk_length, sizeof(T) * 8); +} + +// Calls ReadVariableWidthInternal with the right max_payload argument. +template +bool ReadVariableWidthUnsigned(BitReaderInterface* reader, T* val, + size_t chunk_length) { + static_assert(std::is_unsigned::value, "Type must be unsigned"); + static_assert(std::is_integral::value, "Type must be integral"); + uint64_t val64 = 0; + if (!ReadVariableWidthInternal(reader, &val64, chunk_length, sizeof(T) * 8)) + return false; + *val = static_cast(val64); + assert(*val == val64); + return true; +} + +// Encodes signed |val| to an unsigned value and calls +// WriteVariableWidthInternal with the right max_payload argument. +template +void WriteVariableWidthSigned(BitWriterInterface* writer, T val, + size_t chunk_length, size_t zigzag_exponent) { + static_assert(std::is_signed::value, "Type must be signed"); + static_assert(std::is_integral::value, "Type must be integral"); + WriteVariableWidthInternal(writer, EncodeZigZag(val, zigzag_exponent), + chunk_length, sizeof(T) * 8); +} + +// Calls ReadVariableWidthInternal with the right max_payload argument +// and decodes the value. +template +bool ReadVariableWidthSigned(BitReaderInterface* reader, T* val, + size_t chunk_length, size_t zigzag_exponent) { + static_assert(std::is_signed::value, "Type must be signed"); + static_assert(std::is_integral::value, "Type must be integral"); + uint64_t encoded = 0; + if (!ReadVariableWidthInternal(reader, &encoded, chunk_length, sizeof(T) * 8)) + return false; + + const int64_t decoded = DecodeZigZag(encoded, zigzag_exponent); + + *val = static_cast(decoded); + assert(*val == decoded); + return true; +} + +} // namespace + +void BitWriterInterface::WriteVariableWidthU64(uint64_t val, + size_t chunk_length) { + WriteVariableWidthUnsigned(this, val, chunk_length); +} + +void BitWriterInterface::WriteVariableWidthU32(uint32_t val, + size_t chunk_length) { + WriteVariableWidthUnsigned(this, val, chunk_length); +} + +void BitWriterInterface::WriteVariableWidthU16(uint16_t val, + size_t chunk_length) { + WriteVariableWidthUnsigned(this, val, chunk_length); +} + +void BitWriterInterface::WriteVariableWidthS64(int64_t val, size_t chunk_length, + size_t zigzag_exponent) { + WriteVariableWidthSigned(this, val, chunk_length, zigzag_exponent); +} + +BitWriterWord64::BitWriterWord64(size_t reserve_bits) : end_(0) { + buffer_.reserve(NumBitsToNumWords<64>(reserve_bits)); +} + +void BitWriterWord64::WriteBits(uint64_t bits, size_t num_bits) { + // Check that |bits| and |num_bits| are valid and consistent. + assert(num_bits <= 64); + const bool is_little_endian = IsLittleEndian(); + assert(is_little_endian && "Big-endian architecture support not implemented"); + if (!is_little_endian) return; + + if (num_bits == 0) return; + + bits = GetLowerBits(bits, num_bits); + + EmitSequence(bits, num_bits); + + // Offset from the start of the current word. + const size_t offset = end_ % 64; + + if (offset == 0) { + // If no offset, simply add |bits| as a new word to the buffer_. + buffer_.push_back(bits); + } else { + // Shift bits and add them to the current word after offset. + const uint64_t first_word = bits << offset; + buffer_.back() |= first_word; + + // If we don't overflow to the next word, there is nothing more to do. + + if (offset + num_bits > 64) { + // We overflow to the next word. + const uint64_t second_word = bits >> (64 - offset); + // Add remaining bits as a new word to buffer_. + buffer_.push_back(second_word); + } + } + + // Move end_ into position for next write. + end_ += num_bits; + assert(buffer_.size() * 64 >= end_); +} + +bool BitReaderInterface::ReadVariableWidthU64(uint64_t* val, + size_t chunk_length) { + return ReadVariableWidthUnsigned(this, val, chunk_length); +} + +bool BitReaderInterface::ReadVariableWidthU32(uint32_t* val, + size_t chunk_length) { + return ReadVariableWidthUnsigned(this, val, chunk_length); +} + +bool BitReaderInterface::ReadVariableWidthU16(uint16_t* val, + size_t chunk_length) { + return ReadVariableWidthUnsigned(this, val, chunk_length); +} + +bool BitReaderInterface::ReadVariableWidthS64(int64_t* val, size_t chunk_length, + size_t zigzag_exponent) { + return ReadVariableWidthSigned(this, val, chunk_length, zigzag_exponent); +} + +BitReaderWord64::BitReaderWord64(std::vector&& buffer) + : buffer_(std::move(buffer)), pos_(0) {} + +BitReaderWord64::BitReaderWord64(const std::vector& buffer) + : buffer_(ToBuffer64(buffer)), pos_(0) {} + +BitReaderWord64::BitReaderWord64(const void* buffer, size_t num_bytes) + : buffer_(ToBuffer64(buffer, num_bytes)), pos_(0) {} + +size_t BitReaderWord64::ReadBits(uint64_t* bits, size_t num_bits) { + assert(num_bits <= 64); + const bool is_little_endian = IsLittleEndian(); + assert(is_little_endian && "Big-endian architecture support not implemented"); + if (!is_little_endian) return 0; + + if (ReachedEnd()) return 0; + + // Index of the current word. + const size_t index = pos_ / 64; + + // Bit position in the current word where we start reading. + const size_t offset = pos_ % 64; + + // Read all bits from the current word (it might be too much, but + // excessive bits will be removed later). + *bits = buffer_[index] >> offset; + + const size_t num_read_from_first_word = std::min(64 - offset, num_bits); + pos_ += num_read_from_first_word; + + if (pos_ >= buffer_.size() * 64) { + // Reached end of buffer_. + EmitSequence(*bits, num_read_from_first_word); + return num_read_from_first_word; + } + + if (offset + num_bits > 64) { + // Requested |num_bits| overflows to next word. + // Write all bits from the beginning of next word to *bits after offset. + *bits |= buffer_[index + 1] << (64 - offset); + pos_ += offset + num_bits - 64; + } + + // We likely have written more bits than requested. Clear excessive bits. + *bits = GetLowerBits(*bits, num_bits); + EmitSequence(*bits, num_bits); + return num_bits; +} + +bool BitReaderWord64::ReachedEnd() const { return pos_ >= buffer_.size() * 64; } + +bool BitReaderWord64::OnlyZeroesLeft() const { + if (ReachedEnd()) return true; + + const size_t index = pos_ / 64; + if (index < buffer_.size() - 1) return false; + + assert(index == buffer_.size() - 1); + + const size_t offset = pos_ % 64; + const uint64_t remaining_bits = buffer_[index] >> offset; + return !remaining_bits; +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/bit_stream.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/bit_stream.h new file mode 100644 index 00000000000..5f82344d6a5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/bit_stream.h @@ -0,0 +1,280 @@ +// Copyright (c) 2017 Google 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. + +// Contains utils for reading, writing and debug printing bit streams. + +#ifndef SOURCE_COMP_BIT_STREAM_H_ +#define SOURCE_COMP_BIT_STREAM_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace comp { + +// Terminology: +// Bits - usually used for a uint64 word, first bit is the lowest. +// Stream - std::string of '0' and '1', read left-to-right, +// i.e. first bit is at the front and not at the end as in +// std::bitset::to_string(). +// Bitset - std::bitset corresponding to uint64 bits and to reverse(stream). + +// Converts number of bits to a respective number of chunks of size N. +// For example NumBitsToNumWords<8> returns how many bytes are needed to store +// |num_bits|. +template +inline size_t NumBitsToNumWords(size_t num_bits) { + return (num_bits + (N - 1)) / N; +} + +// Returns value of the same type as |in|, where all but the first |num_bits| +// are set to zero. +template +inline T GetLowerBits(T in, size_t num_bits) { + return sizeof(T) * 8 == num_bits ? in : in & T((T(1) << num_bits) - T(1)); +} + +// Encodes signed integer as unsigned. This is a generalized version of +// EncodeZigZag, designed to favor small positive numbers. +// Values are transformed in blocks of 2^|block_exponent|. +// If |block_exponent| is zero, then this degenerates into normal EncodeZigZag. +// Example when |block_exponent| is 1 (return value is the index): +// 0, 1, -1, -2, 2, 3, -3, -4, 4, 5, -5, -6, 6, 7, -7, -8 +// Example when |block_exponent| is 2: +// 0, 1, 2, 3, -1, -2, -3, -4, 4, 5, 6, 7, -5, -6, -7, -8 +inline uint64_t EncodeZigZag(int64_t val, size_t block_exponent) { + assert(block_exponent < 64); + const uint64_t uval = static_cast(val >= 0 ? val : -val - 1); + const uint64_t block_num = + ((uval >> block_exponent) << 1) + (val >= 0 ? 0 : 1); + const uint64_t pos = GetLowerBits(uval, block_exponent); + return (block_num << block_exponent) + pos; +} + +// Decodes signed integer encoded with EncodeZigZag. |block_exponent| must be +// the same. +inline int64_t DecodeZigZag(uint64_t val, size_t block_exponent) { + assert(block_exponent < 64); + const uint64_t block_num = val >> block_exponent; + const uint64_t pos = GetLowerBits(val, block_exponent); + if (block_num & 1) { + // Negative. + return -1LL - ((block_num >> 1) << block_exponent) - pos; + } else { + // Positive. + return ((block_num >> 1) << block_exponent) + pos; + } +} + +// Converts first |num_bits| stored in uint64 to a left-to-right stream of bits. +inline std::string BitsToStream(uint64_t bits, size_t num_bits = 64) { + std::bitset<64> bitset(bits); + std::string str = bitset.to_string().substr(64 - num_bits); + std::reverse(str.begin(), str.end()); + return str; +} + +// Base class for writing sequences of bits. +class BitWriterInterface { + public: + BitWriterInterface() = default; + virtual ~BitWriterInterface() = default; + + // Writes lower |num_bits| in |bits| to the stream. + // |num_bits| must be no greater than 64. + virtual void WriteBits(uint64_t bits, size_t num_bits) = 0; + + // Writes bits from value of type |T| to the stream. No encoding is done. + // Always writes 8 * sizeof(T) bits. + template + void WriteUnencoded(T val) { + static_assert(sizeof(T) <= 64, "Type size too large"); + uint64_t bits = 0; + memcpy(&bits, &val, sizeof(T)); + WriteBits(bits, sizeof(T) * 8); + } + + // Writes |val| in chunks of size |chunk_length| followed by a signal bit: + // 0 - no more chunks to follow + // 1 - more chunks to follow + // for example 255 is encoded into 1111 1 1111 0 for chunk length 4. + // The last chunk can be truncated and signal bit omitted, if the entire + // payload (for example 16 bit for uint16_t has already been written). + void WriteVariableWidthU64(uint64_t val, size_t chunk_length); + void WriteVariableWidthU32(uint32_t val, size_t chunk_length); + void WriteVariableWidthU16(uint16_t val, size_t chunk_length); + void WriteVariableWidthS64(int64_t val, size_t chunk_length, + size_t zigzag_exponent); + + // Returns number of bits written. + virtual size_t GetNumBits() const = 0; + + // Provides direct access to the buffer data if implemented. + virtual const uint8_t* GetData() const { return nullptr; } + + // Returns buffer size in bytes. + size_t GetDataSizeBytes() const { return NumBitsToNumWords<8>(GetNumBits()); } + + // Generates and returns byte array containing written bits. + virtual std::vector GetDataCopy() const = 0; + + BitWriterInterface(const BitWriterInterface&) = delete; + BitWriterInterface& operator=(const BitWriterInterface&) = delete; +}; + +// This class is an implementation of BitWriterInterface, using +// std::vector to store written bits. +class BitWriterWord64 : public BitWriterInterface { + public: + explicit BitWriterWord64(size_t reserve_bits = 64); + + void WriteBits(uint64_t bits, size_t num_bits) override; + + size_t GetNumBits() const override { return end_; } + + const uint8_t* GetData() const override { + return reinterpret_cast(buffer_.data()); + } + + std::vector GetDataCopy() const override { + return std::vector(GetData(), GetData() + GetDataSizeBytes()); + } + + // Sets callback to emit bit sequences after every write. + void SetCallback(std::function callback) { + callback_ = callback; + } + + protected: + // Sends string generated from arguments to callback_ if defined. + void EmitSequence(uint64_t bits, size_t num_bits) const { + if (callback_) callback_(BitsToStream(bits, num_bits)); + } + + private: + std::vector buffer_; + // Total number of bits written so far. Named 'end' as analogy to std::end(). + size_t end_; + + // If not null, the writer will use the callback to emit the written bit + // sequence as a string of '0' and '1'. + std::function callback_; +}; + +// Base class for reading sequences of bits. +class BitReaderInterface { + public: + BitReaderInterface() {} + virtual ~BitReaderInterface() {} + + // Reads |num_bits| from the stream, stores them in |bits|. + // Returns number of read bits. |num_bits| must be no greater than 64. + virtual size_t ReadBits(uint64_t* bits, size_t num_bits) = 0; + + // Reads 8 * sizeof(T) bits and stores them in |val|. + template + bool ReadUnencoded(T* val) { + static_assert(sizeof(T) <= 64, "Type size too large"); + uint64_t bits = 0; + const size_t num_read = ReadBits(&bits, sizeof(T) * 8); + if (num_read != sizeof(T) * 8) return false; + memcpy(val, &bits, sizeof(T)); + return true; + } + + // Returns number of bits already read. + virtual size_t GetNumReadBits() const = 0; + + // These two functions define 'hard' and 'soft' EOF. + // + // Returns true if the end of the buffer was reached. + virtual bool ReachedEnd() const = 0; + // Returns true if we reached the end of the buffer or are nearing it and only + // zero bits are left to read. Implementations of this function are allowed to + // commit a "false negative" error if the end of the buffer was not reached, + // i.e. it can return false even if indeed only zeroes are left. + // It is assumed that the consumer expects that + // the buffer stream ends with padding zeroes, and would accept this as a + // 'soft' EOF. Implementations of this class do not necessarily need to + // implement this, default behavior can simply delegate to ReachedEnd(). + virtual bool OnlyZeroesLeft() const { return ReachedEnd(); } + + // Reads value encoded with WriteVariableWidthXXX (see BitWriterInterface). + // Reader and writer must use the same |chunk_length| and variable type. + // Returns true on success, false if the bit stream ends prematurely. + bool ReadVariableWidthU64(uint64_t* val, size_t chunk_length); + bool ReadVariableWidthU32(uint32_t* val, size_t chunk_length); + bool ReadVariableWidthU16(uint16_t* val, size_t chunk_length); + bool ReadVariableWidthS64(int64_t* val, size_t chunk_length, + size_t zigzag_exponent); + + BitReaderInterface(const BitReaderInterface&) = delete; + BitReaderInterface& operator=(const BitReaderInterface&) = delete; +}; + +// This class is an implementation of BitReaderInterface which accepts both +// uint8_t and uint64_t buffers as input. uint64_t buffers are consumed and +// owned. uint8_t buffers are copied. +class BitReaderWord64 : public BitReaderInterface { + public: + // Consumes and owns the buffer. + explicit BitReaderWord64(std::vector&& buffer); + + // Copies the buffer and casts it to uint64. + // Consuming the original buffer and casting it to uint64 is difficult, + // as it would potentially cause data misalignment and poor performance. + explicit BitReaderWord64(const std::vector& buffer); + BitReaderWord64(const void* buffer, size_t num_bytes); + + size_t ReadBits(uint64_t* bits, size_t num_bits) override; + + size_t GetNumReadBits() const override { return pos_; } + + bool ReachedEnd() const override; + bool OnlyZeroesLeft() const override; + + BitReaderWord64() = delete; + + // Sets callback to emit bit sequences after every read. + void SetCallback(std::function callback) { + callback_ = callback; + } + + protected: + // Sends string generated from arguments to callback_ if defined. + void EmitSequence(uint64_t bits, size_t num_bits) const { + if (callback_) callback_(BitsToStream(bits, num_bits)); + } + + private: + const std::vector buffer_; + size_t pos_; + + // If not null, the reader will use the callback to emit the read bit + // sequence as a string of '0' and '1'. + std::function callback_; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_BIT_STREAM_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/huffman_codec.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/huffman_codec.h new file mode 100644 index 00000000000..16602161448 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/huffman_codec.h @@ -0,0 +1,389 @@ +// Copyright (c) 2017 Google 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. + +// Contains utils for reading, writing and debug printing bit streams. + +#ifndef SOURCE_COMP_HUFFMAN_CODEC_H_ +#define SOURCE_COMP_HUFFMAN_CODEC_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace comp { + +// Used to generate and apply a Huffman coding scheme. +// |Val| is the type of variable being encoded (for example a string or a +// literal). +template +class HuffmanCodec { + public: + // Huffman tree node. + struct Node { + Node() {} + + // Creates Node from serialization leaving weight and id undefined. + Node(const Val& in_value, uint32_t in_left, uint32_t in_right) + : value(in_value), left(in_left), right(in_right) {} + + Val value = Val(); + uint32_t weight = 0; + // Ids are issued sequentially starting from 1. Ids are used as an ordering + // tie-breaker, to make sure that the ordering (and resulting coding scheme) + // are consistent accross multiple platforms. + uint32_t id = 0; + // Handles of children. + uint32_t left = 0; + uint32_t right = 0; + }; + + // Creates Huffman codec from a histogramm. + // Histogramm counts must not be zero. + explicit HuffmanCodec(const std::map& hist) { + if (hist.empty()) return; + + // Heuristic estimate. + nodes_.reserve(3 * hist.size()); + + // Create NIL. + CreateNode(); + + // The queue is sorted in ascending order by weight (or by node id if + // weights are equal). + std::vector queue_vector; + queue_vector.reserve(hist.size()); + std::priority_queue, + std::function> + queue(std::bind(&HuffmanCodec::LeftIsBigger, this, + std::placeholders::_1, std::placeholders::_2), + std::move(queue_vector)); + + // Put all leaves in the queue. + for (const auto& pair : hist) { + const uint32_t node = CreateNode(); + MutableValueOf(node) = pair.first; + MutableWeightOf(node) = pair.second; + assert(WeightOf(node)); + queue.push(node); + } + + // Form the tree by combining two subtrees with the least weight, + // and pushing the root of the new tree in the queue. + while (true) { + // We push a node at the end of each iteration, so the queue is never + // supposed to be empty at this point, unless there are no leaves, but + // that case was already handled. + assert(!queue.empty()); + const uint32_t right = queue.top(); + queue.pop(); + + // If the queue is empty at this point, then the last node is + // the root of the complete Huffman tree. + if (queue.empty()) { + root_ = right; + break; + } + + const uint32_t left = queue.top(); + queue.pop(); + + // Combine left and right into a new tree and push it into the queue. + const uint32_t parent = CreateNode(); + MutableWeightOf(parent) = WeightOf(right) + WeightOf(left); + MutableLeftOf(parent) = left; + MutableRightOf(parent) = right; + queue.push(parent); + } + + // Traverse the tree and form encoding table. + CreateEncodingTable(); + } + + // Creates Huffman codec from saved tree structure. + // |nodes| is the list of nodes of the tree, nodes[0] being NIL. + // |root_handle| is the index of the root node. + HuffmanCodec(uint32_t root_handle, std::vector&& nodes) { + nodes_ = std::move(nodes); + assert(!nodes_.empty()); + assert(root_handle > 0 && root_handle < nodes_.size()); + assert(!LeftOf(0) && !RightOf(0)); + + root_ = root_handle; + + // Traverse the tree and form encoding table. + CreateEncodingTable(); + } + + // Serializes the codec in the following text format: + // (, { + // {0, 0, 0}, + // {val1, left1, right1}, + // {val2, left2, right2}, + // ... + // }) + std::string SerializeToText(int indent_num_whitespaces) const { + const bool value_is_text = std::is_same::value; + + const std::string indent1 = std::string(indent_num_whitespaces, ' '); + const std::string indent2 = std::string(indent_num_whitespaces + 2, ' '); + + std::stringstream code; + code << "(" << root_ << ", {\n"; + + for (const Node& node : nodes_) { + code << indent2 << "{"; + if (value_is_text) code << "\""; + code << node.value; + if (value_is_text) code << "\""; + code << ", " << node.left << ", " << node.right << "},\n"; + } + + code << indent1 << "})"; + + return code.str(); + } + + // Prints the Huffman tree in the following format: + // w------w------'x' + // w------'y' + // Where w stands for the weight of the node. + // Right tree branches appear above left branches. Taking the right path + // adds 1 to the code, taking the left adds 0. + void PrintTree(std::ostream& out) const { PrintTreeInternal(out, root_, 0); } + + // Traverses the tree and prints the Huffman table: value, code + // and optionally node weight for every leaf. + void PrintTable(std::ostream& out, bool print_weights = true) { + std::queue> queue; + queue.emplace(root_, ""); + + while (!queue.empty()) { + const uint32_t node = queue.front().first; + const std::string code = queue.front().second; + queue.pop(); + if (!RightOf(node) && !LeftOf(node)) { + out << ValueOf(node); + if (print_weights) out << " " << WeightOf(node); + out << " " << code << std::endl; + } else { + if (LeftOf(node)) queue.emplace(LeftOf(node), code + "0"); + + if (RightOf(node)) queue.emplace(RightOf(node), code + "1"); + } + } + } + + // Returns the Huffman table. The table was built at at construction time, + // this function just returns a const reference. + const std::unordered_map>& GetEncodingTable() + const { + return encoding_table_; + } + + // Encodes |val| and stores its Huffman code in the lower |num_bits| of + // |bits|. Returns false of |val| is not in the Huffman table. + bool Encode(const Val& val, uint64_t* bits, size_t* num_bits) const { + auto it = encoding_table_.find(val); + if (it == encoding_table_.end()) return false; + *bits = it->second.first; + *num_bits = it->second.second; + return true; + } + + // Reads bits one-by-one using callback |read_bit| until a match is found. + // Matching value is stored in |val|. Returns false if |read_bit| terminates + // before a code was mathced. + // |read_bit| has type bool func(bool* bit). When called, the next bit is + // stored in |bit|. |read_bit| returns false if the stream terminates + // prematurely. + bool DecodeFromStream(const std::function& read_bit, + Val* val) const { + uint32_t node = root_; + while (true) { + assert(node); + + if (!RightOf(node) && !LeftOf(node)) { + *val = ValueOf(node); + return true; + } + + bool go_right; + if (!read_bit(&go_right)) return false; + + if (go_right) + node = RightOf(node); + else + node = LeftOf(node); + } + + assert(0); + return false; + } + + private: + // Returns value of the node referenced by |handle|. + Val ValueOf(uint32_t node) const { return nodes_.at(node).value; } + + // Returns left child of |node|. + uint32_t LeftOf(uint32_t node) const { return nodes_.at(node).left; } + + // Returns right child of |node|. + uint32_t RightOf(uint32_t node) const { return nodes_.at(node).right; } + + // Returns weight of |node|. + uint32_t WeightOf(uint32_t node) const { return nodes_.at(node).weight; } + + // Returns id of |node|. + uint32_t IdOf(uint32_t node) const { return nodes_.at(node).id; } + + // Returns mutable reference to value of |node|. + Val& MutableValueOf(uint32_t node) { + assert(node); + return nodes_.at(node).value; + } + + // Returns mutable reference to handle of left child of |node|. + uint32_t& MutableLeftOf(uint32_t node) { + assert(node); + return nodes_.at(node).left; + } + + // Returns mutable reference to handle of right child of |node|. + uint32_t& MutableRightOf(uint32_t node) { + assert(node); + return nodes_.at(node).right; + } + + // Returns mutable reference to weight of |node|. + uint32_t& MutableWeightOf(uint32_t node) { return nodes_.at(node).weight; } + + // Returns mutable reference to id of |node|. + uint32_t& MutableIdOf(uint32_t node) { return nodes_.at(node).id; } + + // Returns true if |left| has bigger weight than |right|. Node ids are + // used as tie-breaker. + bool LeftIsBigger(uint32_t left, uint32_t right) const { + if (WeightOf(left) == WeightOf(right)) { + assert(IdOf(left) != IdOf(right)); + return IdOf(left) > IdOf(right); + } + return WeightOf(left) > WeightOf(right); + } + + // Prints subtree (helper function used by PrintTree). + void PrintTreeInternal(std::ostream& out, uint32_t node, size_t depth) const { + if (!node) return; + + const size_t kTextFieldWidth = 7; + + if (!RightOf(node) && !LeftOf(node)) { + out << ValueOf(node) << std::endl; + } else { + if (RightOf(node)) { + std::stringstream label; + label << std::setfill('-') << std::left << std::setw(kTextFieldWidth) + << WeightOf(RightOf(node)); + out << label.str(); + PrintTreeInternal(out, RightOf(node), depth + 1); + } + + if (LeftOf(node)) { + out << std::string(depth * kTextFieldWidth, ' '); + std::stringstream label; + label << std::setfill('-') << std::left << std::setw(kTextFieldWidth) + << WeightOf(LeftOf(node)); + out << label.str(); + PrintTreeInternal(out, LeftOf(node), depth + 1); + } + } + } + + // Traverses the Huffman tree and saves paths to the leaves as bit + // sequences to encoding_table_. + void CreateEncodingTable() { + struct Context { + Context(uint32_t in_node, uint64_t in_bits, size_t in_depth) + : node(in_node), bits(in_bits), depth(in_depth) {} + uint32_t node; + // Huffman tree depth cannot exceed 64 as histogramm counts are expected + // to be positive and limited by numeric_limits::max(). + // For practical applications tree depth would be much smaller than 64. + uint64_t bits; + size_t depth; + }; + + std::queue queue; + queue.emplace(root_, 0, 0); + + while (!queue.empty()) { + const Context& context = queue.front(); + const uint32_t node = context.node; + const uint64_t bits = context.bits; + const size_t depth = context.depth; + queue.pop(); + + if (!RightOf(node) && !LeftOf(node)) { + auto insertion_result = encoding_table_.emplace( + ValueOf(node), std::pair(bits, depth)); + assert(insertion_result.second); + (void)insertion_result; + } else { + if (LeftOf(node)) queue.emplace(LeftOf(node), bits, depth + 1); + + if (RightOf(node)) + queue.emplace(RightOf(node), bits | (1ULL << depth), depth + 1); + } + } + } + + // Creates new Huffman tree node and stores it in the deleter array. + uint32_t CreateNode() { + const uint32_t handle = static_cast(nodes_.size()); + nodes_.emplace_back(Node()); + nodes_.back().id = next_node_id_++; + return handle; + } + + // Huffman tree root handle. + uint32_t root_ = 0; + + // Huffman tree deleter. + std::vector nodes_; + + // Encoding table value -> {bits, num_bits}. + // Huffman codes are expected to never exceed 64 bit length (this is in fact + // impossible if frequencies are stored as uint32_t). + std::unordered_map> encoding_table_; + + // Next node id issued by CreateNode(); + uint32_t next_node_id_ = 1; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_HUFFMAN_CODEC_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv.cpp new file mode 100644 index 00000000000..736bc51ba27 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv.cpp @@ -0,0 +1,112 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/comp/markv.h" + +#include "source/comp/markv_decoder.h" +#include "source/comp/markv_encoder.h" + +namespace spvtools { +namespace comp { +namespace { + +spv_result_t EncodeHeader(void* user_data, spv_endianness_t endian, + uint32_t magic, uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t schema) { + MarkvEncoder* encoder = reinterpret_cast(user_data); + return encoder->EncodeHeader(endian, magic, version, generator, id_bound, + schema); +} + +spv_result_t EncodeInstruction(void* user_data, + const spv_parsed_instruction_t* inst) { + MarkvEncoder* encoder = reinterpret_cast(user_data); + return encoder->EncodeInstruction(*inst); +} + +} // namespace + +spv_result_t SpirvToMarkv( + spv_const_context context, const std::vector& spirv, + const MarkvCodecOptions& options, const MarkvModel& markv_model, + MessageConsumer message_consumer, MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer, std::vector* markv) { + spv_context_t hijack_context = *context; + SetContextMessageConsumer(&hijack_context, message_consumer); + + spv_validator_options validator_options = + MarkvDecoder::GetValidatorOptions(options); + if (validator_options) { + spv_const_binary_t spirv_binary = {spirv.data(), spirv.size()}; + const spv_result_t result = spvValidateWithOptions( + &hijack_context, validator_options, &spirv_binary, nullptr); + if (result != SPV_SUCCESS) return result; + } + + MarkvEncoder encoder(&hijack_context, options, &markv_model); + + spv_position_t position = {}; + if (log_consumer || debug_consumer) { + encoder.CreateLogger(log_consumer, debug_consumer); + + spv_text text = nullptr; + if (spvBinaryToText(&hijack_context, spirv.data(), spirv.size(), + SPV_BINARY_TO_TEXT_OPTION_NO_HEADER, &text, + nullptr) != SPV_SUCCESS) { + return DiagnosticStream(position, hijack_context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Failed to disassemble SPIR-V binary."; + } + assert(text); + encoder.SetDisassembly(std::string(text->str, text->length)); + spvTextDestroy(text); + } + + if (spvBinaryParse(&hijack_context, &encoder, spirv.data(), spirv.size(), + EncodeHeader, EncodeInstruction, nullptr) != SPV_SUCCESS) { + return DiagnosticStream(position, hijack_context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Unable to encode to MARK-V."; + } + + *markv = encoder.GetMarkvBinary(); + return SPV_SUCCESS; +} + +spv_result_t MarkvToSpirv( + spv_const_context context, const std::vector& markv, + const MarkvCodecOptions& options, const MarkvModel& markv_model, + MessageConsumer message_consumer, MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer, std::vector* spirv) { + spv_position_t position = {}; + spv_context_t hijack_context = *context; + SetContextMessageConsumer(&hijack_context, message_consumer); + + MarkvDecoder decoder(&hijack_context, markv, options, &markv_model); + + if (log_consumer || debug_consumer) + decoder.CreateLogger(log_consumer, debug_consumer); + + if (decoder.DecodeModule(spirv) != SPV_SUCCESS) { + return DiagnosticStream(position, hijack_context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Unable to decode MARK-V."; + } + + assert(!spirv->empty()); + return SPV_SUCCESS; +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv.h new file mode 100644 index 00000000000..587086f9126 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv.h @@ -0,0 +1,74 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// MARK-V is a compression format for SPIR-V binaries. It strips away +// non-essential information (such as result ids which can be regenerated) and +// uses various bit reduction techiniques to reduce the size of the binary and +// make it more similar to other compressed SPIR-V files to further improve +// compression of the dataset. + +#ifndef SOURCE_COMP_MARKV_H_ +#define SOURCE_COMP_MARKV_H_ + +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace comp { + +class MarkvModel; + +struct MarkvCodecOptions { + bool validate_spirv_binary = false; +}; + +// Debug callback. Called once per instruction. +// |words| is instruction SPIR-V words. +// |bits| is a textual representation of the MARK-V bit sequence used to encode +// the instruction (char '0' for 0, char '1' for 1). +// |comment| contains all logs generated while processing the instruction. +using MarkvDebugConsumer = + std::function& words, + const std::string& bits, const std::string& comment)>; + +// Logging callback. Called often (if decoder reads a single bit, the log +// consumer will receive 1 character string with that bit). +// This callback is more suitable for continous output than MarkvDebugConsumer, +// for example if the codec crashes it would allow to pinpoint on which operand +// or bit the crash happened. +// |snippet| could be any atomic fragment of text logged by the codec. It can +// contain a paragraph of text with newlines, or can be just one character. +using MarkvLogConsumer = std::function; + +// Encodes the given SPIR-V binary to MARK-V binary. +// |log_consumer| is optional (pass MarkvLogConsumer() to disable). +// |debug_consumer| is optional (pass MarkvDebugConsumer() to disable). +spv_result_t SpirvToMarkv( + spv_const_context context, const std::vector& spirv, + const MarkvCodecOptions& options, const MarkvModel& markv_model, + MessageConsumer message_consumer, MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer, std::vector* markv); + +// Decodes a SPIR-V binary from the given MARK-V binary. +// |log_consumer| is optional (pass MarkvLogConsumer() to disable). +// |debug_consumer| is optional (pass MarkvDebugConsumer() to disable). +spv_result_t MarkvToSpirv( + spv_const_context context, const std::vector& markv, + const MarkvCodecOptions& options, const MarkvModel& markv_model, + MessageConsumer message_consumer, MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer, std::vector* spirv); + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_codec.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_codec.cpp new file mode 100644 index 00000000000..ae3ce79f2b6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_codec.cpp @@ -0,0 +1,793 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// MARK-V is a compression format for SPIR-V binaries. It strips away +// non-essential information (such as result IDs which can be regenerated) and +// uses various bit reduction techniques to reduce the size of the binary. + +#include "source/comp/markv_codec.h" + +#include "source/comp/markv_logger.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/opcode.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace comp { +namespace { + +// Custom hash function used to produce short descriptors. +uint32_t ShortHashU32Array(const std::vector& words) { + // The hash function is a sum of hashes of each word seeded by word index. + // Knuth's multiplicative hash is used to hash the words. + const uint32_t kKnuthMulHash = 2654435761; + uint32_t val = 0; + for (uint32_t i = 0; i < words.size(); ++i) { + val += (words[i] + i + 123) * kKnuthMulHash; + } + return 1 + val % ((1 << MarkvCodec::kShortDescriptorNumBits) - 1); +} + +// Returns a set of mtf rank codecs based on a plausible hand-coded +// distribution. +std::map>> +GetMtfHuffmanCodecs() { + std::map>> codecs; + + std::unique_ptr> codec; + + codec = MakeUnique>(std::map({ + {0, 5}, + {1, 40}, + {2, 10}, + {3, 5}, + {4, 5}, + {5, 5}, + {6, 3}, + {7, 3}, + {8, 3}, + {9, 3}, + {MarkvCodec::kMtfRankEncodedByValueSignal, 10}, + })); + codecs.emplace(kMtfAll, std::move(codec)); + + codec = MakeUnique>(std::map({ + {1, 50}, + {2, 20}, + {3, 5}, + {4, 5}, + {5, 2}, + {6, 1}, + {7, 1}, + {8, 1}, + {9, 1}, + {MarkvCodec::kMtfRankEncodedByValueSignal, 10}, + })); + codecs.emplace(kMtfGenericNonZeroRank, std::move(codec)); + + return codecs; +} + +} // namespace + +const uint32_t MarkvCodec::kMarkvMagicNumber = 0x07230303; + +const uint32_t MarkvCodec::kMtfSmallestRankEncodedByValue = 10; + +const uint32_t MarkvCodec::kMtfRankEncodedByValueSignal = + std::numeric_limits::max(); + +const uint32_t MarkvCodec::kShortDescriptorNumBits = 8; + +const size_t MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte = 8; + +MarkvCodec::MarkvCodec(spv_const_context context, + spv_validator_options validator_options, + const MarkvModel* model) + : validator_options_(validator_options), + grammar_(context), + model_(model), + short_id_descriptors_(ShortHashU32Array), + mtf_huffman_codecs_(GetMtfHuffmanCodecs()), + context_(context) {} + +MarkvCodec::~MarkvCodec() { spvValidatorOptionsDestroy(validator_options_); } + +MarkvCodec::MarkvHeader::MarkvHeader() + : magic_number(MarkvCodec::kMarkvMagicNumber), + markv_version(MarkvCodec::GetMarkvVersion()) {} + +// Defines and returns current MARK-V version. +// static +uint32_t MarkvCodec::GetMarkvVersion() { + const uint32_t kVersionMajor = 1; + const uint32_t kVersionMinor = 4; + return kVersionMinor | (kVersionMajor << 16); +} + +size_t MarkvCodec::GetNumBitsToNextByte(size_t bit_pos) const { + return (8 - (bit_pos % 8)) % 8; +} + +// Returns true if the opcode has a fixed number of operands. May return a +// false negative. +bool MarkvCodec::OpcodeHasFixedNumberOfOperands(SpvOp opcode) const { + switch (opcode) { + // TODO(atgoo@github.com) This is not a complete list. + case SpvOpNop: + case SpvOpName: + case SpvOpUndef: + case SpvOpSizeOf: + case SpvOpLine: + case SpvOpNoLine: + case SpvOpDecorationGroup: + case SpvOpExtension: + case SpvOpExtInstImport: + case SpvOpMemoryModel: + case SpvOpCapability: + case SpvOpTypeVoid: + case SpvOpTypeBool: + case SpvOpTypeInt: + case SpvOpTypeFloat: + case SpvOpTypeVector: + case SpvOpTypeMatrix: + case SpvOpTypeSampler: + case SpvOpTypeSampledImage: + case SpvOpTypeArray: + case SpvOpTypePointer: + case SpvOpConstantTrue: + case SpvOpConstantFalse: + case SpvOpLabel: + case SpvOpBranch: + case SpvOpFunction: + case SpvOpFunctionParameter: + case SpvOpFunctionEnd: + case SpvOpBitcast: + case SpvOpCopyObject: + case SpvOpTranspose: + case SpvOpSNegate: + case SpvOpFNegate: + case SpvOpIAdd: + case SpvOpFAdd: + case SpvOpISub: + case SpvOpFSub: + case SpvOpIMul: + case SpvOpFMul: + case SpvOpUDiv: + case SpvOpSDiv: + case SpvOpFDiv: + case SpvOpUMod: + case SpvOpSRem: + case SpvOpSMod: + case SpvOpFRem: + case SpvOpFMod: + case SpvOpVectorTimesScalar: + case SpvOpMatrixTimesScalar: + case SpvOpVectorTimesMatrix: + case SpvOpMatrixTimesVector: + case SpvOpMatrixTimesMatrix: + case SpvOpOuterProduct: + case SpvOpDot: + return true; + default: + break; + } + return false; +} + +void MarkvCodec::ProcessCurInstruction() { + instructions_.emplace_back(new val::Instruction(&inst_)); + + const SpvOp opcode = SpvOp(inst_.opcode); + + if (inst_.result_id) { + id_to_def_instruction_.emplace(inst_.result_id, instructions_.back().get()); + + // Collect ids local to the current function. + if (cur_function_id_) { + ids_local_to_cur_function_.push_back(inst_.result_id); + } + + // Starting new function. + if (opcode == SpvOpFunction) { + cur_function_id_ = inst_.result_id; + cur_function_return_type_ = inst_.type_id; + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + multi_mtf_.Insert(GetMtfFunctionWithReturnType(inst_.type_id), + inst_.result_id); + } + + // Store function parameter types in a queue, so that we know which types + // to expect in the following OpFunctionParameter instructions. + const val::Instruction* def_inst = FindDef(inst_.words[4]); + assert(def_inst); + assert(def_inst->opcode() == SpvOpTypeFunction); + for (uint32_t i = 3; i < def_inst->words().size(); ++i) { + remaining_function_parameter_types_.push_back(def_inst->word(i)); + } + } + } + + // Remove local ids from MTFs if function end. + if (opcode == SpvOpFunctionEnd) { + cur_function_id_ = 0; + for (uint32_t id : ids_local_to_cur_function_) multi_mtf_.RemoveFromAll(id); + ids_local_to_cur_function_.clear(); + assert(remaining_function_parameter_types_.empty()); + } + + if (!inst_.result_id) return; + + { + // Save the result ID to type ID mapping. + // In the grammar, type ID always appears before result ID. + // A regular value maps to its type. Some instructions (e.g. OpLabel) + // have no type Id, and will map to 0. The result Id for a + // type-generating instruction (e.g. OpTypeInt) maps to itself. + auto insertion_result = id_to_type_id_.emplace( + inst_.result_id, spvOpcodeGeneratesType(SpvOp(inst_.opcode)) + ? inst_.result_id + : inst_.type_id); + (void)insertion_result; + assert(insertion_result.second); + } + + // Add result_id to MTFs. + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + switch (opcode) { + case SpvOpTypeFloat: + case SpvOpTypeInt: + case SpvOpTypeBool: + case SpvOpTypeVector: + case SpvOpTypePointer: + case SpvOpExtInstImport: + case SpvOpTypeSampledImage: + case SpvOpTypeImage: + case SpvOpTypeSampler: + multi_mtf_.Insert(GetMtfIdGeneratedByOpcode(opcode), inst_.result_id); + break; + default: + break; + } + + if (spvOpcodeIsComposite(opcode)) { + multi_mtf_.Insert(kMtfTypeComposite, inst_.result_id); + } + + if (opcode == SpvOpLabel) { + multi_mtf_.InsertOrPromote(kMtfLabel, inst_.result_id); + } + + if (opcode == SpvOpTypeInt) { + multi_mtf_.Insert(kMtfTypeScalar, inst_.result_id); + multi_mtf_.Insert(kMtfTypeIntScalarOrVector, inst_.result_id); + } + + if (opcode == SpvOpTypeFloat) { + multi_mtf_.Insert(kMtfTypeScalar, inst_.result_id); + multi_mtf_.Insert(kMtfTypeFloatScalarOrVector, inst_.result_id); + } + + if (opcode == SpvOpTypeBool) { + multi_mtf_.Insert(kMtfTypeScalar, inst_.result_id); + multi_mtf_.Insert(kMtfTypeBoolScalarOrVector, inst_.result_id); + } + + if (opcode == SpvOpTypeVector) { + const uint32_t component_type_id = inst_.words[2]; + const uint32_t size = inst_.words[3]; + if (multi_mtf_.HasValue(GetMtfIdGeneratedByOpcode(SpvOpTypeFloat), + component_type_id)) { + multi_mtf_.Insert(kMtfTypeFloatScalarOrVector, inst_.result_id); + } else if (multi_mtf_.HasValue(GetMtfIdGeneratedByOpcode(SpvOpTypeInt), + component_type_id)) { + multi_mtf_.Insert(kMtfTypeIntScalarOrVector, inst_.result_id); + } else if (multi_mtf_.HasValue(GetMtfIdGeneratedByOpcode(SpvOpTypeBool), + component_type_id)) { + multi_mtf_.Insert(kMtfTypeBoolScalarOrVector, inst_.result_id); + } + multi_mtf_.Insert(GetMtfTypeVectorOfSize(size), inst_.result_id); + } + + if (inst_.opcode == SpvOpTypeFunction) { + const uint32_t return_type = inst_.words[2]; + multi_mtf_.Insert(kMtfTypeReturnedByFunction, return_type); + multi_mtf_.Insert(GetMtfFunctionTypeWithReturnType(return_type), + inst_.result_id); + } + + if (inst_.type_id) { + const val::Instruction* type_inst = FindDef(inst_.type_id); + assert(type_inst); + + multi_mtf_.Insert(kMtfObject, inst_.result_id); + + multi_mtf_.Insert(GetMtfIdOfType(inst_.type_id), inst_.result_id); + + if (multi_mtf_.HasValue(kMtfTypeFloatScalarOrVector, inst_.type_id)) { + multi_mtf_.Insert(kMtfFloatScalarOrVector, inst_.result_id); + } + + if (multi_mtf_.HasValue(kMtfTypeIntScalarOrVector, inst_.type_id)) + multi_mtf_.Insert(kMtfIntScalarOrVector, inst_.result_id); + + if (multi_mtf_.HasValue(kMtfTypeBoolScalarOrVector, inst_.type_id)) + multi_mtf_.Insert(kMtfBoolScalarOrVector, inst_.result_id); + + if (multi_mtf_.HasValue(kMtfTypeComposite, inst_.type_id)) + multi_mtf_.Insert(kMtfComposite, inst_.result_id); + + switch (type_inst->opcode()) { + case SpvOpTypeInt: + case SpvOpTypeBool: + case SpvOpTypePointer: + case SpvOpTypeVector: + case SpvOpTypeImage: + case SpvOpTypeSampledImage: + case SpvOpTypeSampler: + multi_mtf_.Insert( + GetMtfIdWithTypeGeneratedByOpcode(type_inst->opcode()), + inst_.result_id); + break; + default: + break; + } + + if (type_inst->opcode() == SpvOpTypeVector) { + const uint32_t component_type = type_inst->word(2); + multi_mtf_.Insert(GetMtfVectorOfComponentType(component_type), + inst_.result_id); + } + + if (type_inst->opcode() == SpvOpTypePointer) { + assert(type_inst->operands().size() > 2); + assert(type_inst->words().size() > type_inst->operands()[2].offset); + const uint32_t data_type = + type_inst->word(type_inst->operands()[2].offset); + multi_mtf_.Insert(GetMtfPointerToType(data_type), inst_.result_id); + + if (multi_mtf_.HasValue(kMtfTypeComposite, data_type)) + multi_mtf_.Insert(kMtfTypePointerToComposite, inst_.result_id); + } + } + + if (spvOpcodeGeneratesType(opcode)) { + if (opcode != SpvOpTypeFunction) { + multi_mtf_.Insert(kMtfTypeNonFunction, inst_.result_id); + } + } + } + + if (model_->AnyDescriptorHasCodingScheme()) { + const uint32_t long_descriptor = + long_id_descriptors_.ProcessInstruction(inst_); + if (model_->DescriptorHasCodingScheme(long_descriptor)) + multi_mtf_.Insert(GetMtfLongIdDescriptor(long_descriptor), + inst_.result_id); + } + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + const uint32_t short_descriptor = + short_id_descriptors_.ProcessInstruction(inst_); + multi_mtf_.Insert(GetMtfShortIdDescriptor(short_descriptor), + inst_.result_id); + } +} + +uint64_t MarkvCodec::GetRuleBasedMtf() { + // This function is only called for id operands (but not result ids). + assert(spvIsIdType(operand_.type) || + operand_.type == SPV_OPERAND_TYPE_OPTIONAL_ID); + assert(operand_.type != SPV_OPERAND_TYPE_RESULT_ID); + + const SpvOp opcode = static_cast(inst_.opcode); + + // All operand slots which expect label id. + if ((inst_.opcode == SpvOpLoopMerge && operand_index_ <= 1) || + (inst_.opcode == SpvOpSelectionMerge && operand_index_ == 0) || + (inst_.opcode == SpvOpBranch && operand_index_ == 0) || + (inst_.opcode == SpvOpBranchConditional && + (operand_index_ == 1 || operand_index_ == 2)) || + (inst_.opcode == SpvOpPhi && operand_index_ >= 3 && + operand_index_ % 2 == 1) || + (inst_.opcode == SpvOpSwitch && operand_index_ > 0)) { + return kMtfLabel; + } + + switch (opcode) { + case SpvOpFAdd: + case SpvOpFSub: + case SpvOpFMul: + case SpvOpFDiv: + case SpvOpFRem: + case SpvOpFMod: + case SpvOpFNegate: { + if (operand_index_ == 0) return kMtfTypeFloatScalarOrVector; + return GetMtfIdOfType(inst_.type_id); + } + + case SpvOpISub: + case SpvOpIAdd: + case SpvOpIMul: + case SpvOpSDiv: + case SpvOpUDiv: + case SpvOpSMod: + case SpvOpUMod: + case SpvOpSRem: + case SpvOpSNegate: { + if (operand_index_ == 0) return kMtfTypeIntScalarOrVector; + + return kMtfIntScalarOrVector; + } + + // TODO(atgoo@github.com) Add OpConvertFToU and other opcodes. + + case SpvOpFOrdEqual: + case SpvOpFUnordEqual: + case SpvOpFOrdNotEqual: + case SpvOpFUnordNotEqual: + case SpvOpFOrdLessThan: + case SpvOpFUnordLessThan: + case SpvOpFOrdGreaterThan: + case SpvOpFUnordGreaterThan: + case SpvOpFOrdLessThanEqual: + case SpvOpFUnordLessThanEqual: + case SpvOpFOrdGreaterThanEqual: + case SpvOpFUnordGreaterThanEqual: { + if (operand_index_ == 0) return kMtfTypeBoolScalarOrVector; + if (operand_index_ == 2) return kMtfFloatScalarOrVector; + if (operand_index_ == 3) { + const uint32_t first_operand_id = GetInstWords()[3]; + const uint32_t first_operand_type = id_to_type_id_.at(first_operand_id); + return GetMtfIdOfType(first_operand_type); + } + break; + } + + case SpvOpVectorShuffle: { + if (operand_index_ == 0) { + assert(inst_.num_operands > 4); + return GetMtfTypeVectorOfSize(inst_.num_operands - 4); + } + + assert(inst_.type_id); + if (operand_index_ == 2 || operand_index_ == 3) + return GetMtfVectorOfComponentType( + GetVectorComponentType(inst_.type_id)); + break; + } + + case SpvOpVectorTimesScalar: { + if (operand_index_ == 0) { + // TODO(atgoo@github.com) Could be narrowed to vector of floats. + return GetMtfIdGeneratedByOpcode(SpvOpTypeVector); + } + + assert(inst_.type_id); + if (operand_index_ == 2) return GetMtfIdOfType(inst_.type_id); + if (operand_index_ == 3) + return GetMtfIdOfType(GetVectorComponentType(inst_.type_id)); + break; + } + + case SpvOpDot: { + if (operand_index_ == 0) return GetMtfIdGeneratedByOpcode(SpvOpTypeFloat); + + assert(inst_.type_id); + if (operand_index_ == 2) + return GetMtfVectorOfComponentType(inst_.type_id); + if (operand_index_ == 3) { + const uint32_t vector_id = GetInstWords()[3]; + const uint32_t vector_type = id_to_type_id_.at(vector_id); + return GetMtfIdOfType(vector_type); + } + break; + } + + case SpvOpTypeVector: { + if (operand_index_ == 1) { + return kMtfTypeScalar; + } + break; + } + + case SpvOpTypeMatrix: { + if (operand_index_ == 1) { + return GetMtfIdGeneratedByOpcode(SpvOpTypeVector); + } + break; + } + + case SpvOpTypePointer: { + if (operand_index_ == 2) { + return kMtfTypeNonFunction; + } + break; + } + + case SpvOpTypeStruct: { + if (operand_index_ >= 1) { + return kMtfTypeNonFunction; + } + break; + } + + case SpvOpTypeFunction: { + if (operand_index_ == 1) { + return kMtfTypeNonFunction; + } + + if (operand_index_ >= 2) { + return kMtfTypeNonFunction; + } + break; + } + + case SpvOpLoad: { + if (operand_index_ == 0) return kMtfTypeNonFunction; + + if (operand_index_ == 2) { + assert(inst_.type_id); + return GetMtfPointerToType(inst_.type_id); + } + break; + } + + case SpvOpStore: { + if (operand_index_ == 0) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypePointer); + if (operand_index_ == 1) { + const uint32_t pointer_id = GetInstWords()[1]; + const uint32_t pointer_type = id_to_type_id_.at(pointer_id); + const val::Instruction* pointer_inst = FindDef(pointer_type); + assert(pointer_inst); + assert(pointer_inst->opcode() == SpvOpTypePointer); + const uint32_t data_type = + pointer_inst->word(pointer_inst->operands()[2].offset); + return GetMtfIdOfType(data_type); + } + break; + } + + case SpvOpVariable: { + if (operand_index_ == 0) + return GetMtfIdGeneratedByOpcode(SpvOpTypePointer); + break; + } + + case SpvOpAccessChain: { + if (operand_index_ == 0) + return GetMtfIdGeneratedByOpcode(SpvOpTypePointer); + if (operand_index_ == 2) return kMtfTypePointerToComposite; + if (operand_index_ >= 3) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeInt); + break; + } + + case SpvOpCompositeConstruct: { + if (operand_index_ == 0) return kMtfTypeComposite; + if (operand_index_ >= 2) { + const uint32_t composite_type = GetInstWords()[1]; + if (multi_mtf_.HasValue(kMtfTypeFloatScalarOrVector, composite_type)) + return kMtfFloatScalarOrVector; + if (multi_mtf_.HasValue(kMtfTypeIntScalarOrVector, composite_type)) + return kMtfIntScalarOrVector; + if (multi_mtf_.HasValue(kMtfTypeBoolScalarOrVector, composite_type)) + return kMtfBoolScalarOrVector; + } + break; + } + + case SpvOpCompositeExtract: { + if (operand_index_ == 2) return kMtfComposite; + break; + } + + case SpvOpConstantComposite: { + if (operand_index_ == 0) return kMtfTypeComposite; + if (operand_index_ >= 2) { + const val::Instruction* composite_type_inst = FindDef(inst_.type_id); + assert(composite_type_inst); + if (composite_type_inst->opcode() == SpvOpTypeVector) { + return GetMtfIdOfType(composite_type_inst->word(2)); + } + } + break; + } + + case SpvOpExtInst: { + if (operand_index_ == 2) + return GetMtfIdGeneratedByOpcode(SpvOpExtInstImport); + if (operand_index_ >= 4) { + const uint32_t return_type = GetInstWords()[1]; + const uint32_t ext_inst_type = inst_.ext_inst_type; + const uint32_t ext_inst_index = GetInstWords()[4]; + // TODO(atgoo@github.com) The list of extended instructions is + // incomplete. Only common instructions and low-hanging fruits listed. + if (ext_inst_type == SPV_EXT_INST_TYPE_GLSL_STD_450) { + switch (ext_inst_index) { + case GLSLstd450FAbs: + case GLSLstd450FClamp: + case GLSLstd450FMax: + case GLSLstd450FMin: + case GLSLstd450FMix: + case GLSLstd450Step: + case GLSLstd450SmoothStep: + case GLSLstd450Fma: + case GLSLstd450Pow: + case GLSLstd450Exp: + case GLSLstd450Exp2: + case GLSLstd450Log: + case GLSLstd450Log2: + case GLSLstd450Sqrt: + case GLSLstd450InverseSqrt: + case GLSLstd450Fract: + case GLSLstd450Floor: + case GLSLstd450Ceil: + case GLSLstd450Radians: + case GLSLstd450Degrees: + case GLSLstd450Sin: + case GLSLstd450Cos: + case GLSLstd450Tan: + case GLSLstd450Sinh: + case GLSLstd450Cosh: + case GLSLstd450Tanh: + case GLSLstd450Asin: + case GLSLstd450Acos: + case GLSLstd450Atan: + case GLSLstd450Atan2: + case GLSLstd450Asinh: + case GLSLstd450Acosh: + case GLSLstd450Atanh: + case GLSLstd450MatrixInverse: + case GLSLstd450Cross: + case GLSLstd450Normalize: + case GLSLstd450Reflect: + case GLSLstd450FaceForward: + return GetMtfIdOfType(return_type); + case GLSLstd450Length: + case GLSLstd450Distance: + case GLSLstd450Refract: + return kMtfFloatScalarOrVector; + default: + break; + } + } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_STD) { + switch (ext_inst_index) { + case OpenCLLIB::Fabs: + case OpenCLLIB::FClamp: + case OpenCLLIB::Fmax: + case OpenCLLIB::Fmin: + case OpenCLLIB::Step: + case OpenCLLIB::Smoothstep: + case OpenCLLIB::Fma: + case OpenCLLIB::Pow: + case OpenCLLIB::Exp: + case OpenCLLIB::Exp2: + case OpenCLLIB::Log: + case OpenCLLIB::Log2: + case OpenCLLIB::Sqrt: + case OpenCLLIB::Rsqrt: + case OpenCLLIB::Fract: + case OpenCLLIB::Floor: + case OpenCLLIB::Ceil: + case OpenCLLIB::Radians: + case OpenCLLIB::Degrees: + case OpenCLLIB::Sin: + case OpenCLLIB::Cos: + case OpenCLLIB::Tan: + case OpenCLLIB::Sinh: + case OpenCLLIB::Cosh: + case OpenCLLIB::Tanh: + case OpenCLLIB::Asin: + case OpenCLLIB::Acos: + case OpenCLLIB::Atan: + case OpenCLLIB::Atan2: + case OpenCLLIB::Asinh: + case OpenCLLIB::Acosh: + case OpenCLLIB::Atanh: + case OpenCLLIB::Cross: + case OpenCLLIB::Normalize: + return GetMtfIdOfType(return_type); + case OpenCLLIB::Length: + case OpenCLLIB::Distance: + return kMtfFloatScalarOrVector; + default: + break; + } + } + } + break; + } + + case SpvOpFunction: { + if (operand_index_ == 0) return kMtfTypeReturnedByFunction; + + if (operand_index_ == 3) { + const uint32_t return_type = GetInstWords()[1]; + return GetMtfFunctionTypeWithReturnType(return_type); + } + break; + } + + case SpvOpFunctionCall: { + if (operand_index_ == 0) return kMtfTypeReturnedByFunction; + + if (operand_index_ == 2) { + const uint32_t return_type = GetInstWords()[1]; + return GetMtfFunctionWithReturnType(return_type); + } + + if (operand_index_ >= 3) { + const uint32_t function_id = GetInstWords()[3]; + const val::Instruction* function_inst = FindDef(function_id); + if (!function_inst) return kMtfObject; + + assert(function_inst->opcode() == SpvOpFunction); + + const uint32_t function_type_id = function_inst->word(4); + const val::Instruction* function_type_inst = FindDef(function_type_id); + assert(function_type_inst); + assert(function_type_inst->opcode() == SpvOpTypeFunction); + + const uint32_t argument_type = function_type_inst->word(operand_index_); + return GetMtfIdOfType(argument_type); + } + break; + } + + case SpvOpReturnValue: { + if (operand_index_ == 0) return GetMtfIdOfType(cur_function_return_type_); + break; + } + + case SpvOpBranchConditional: { + if (operand_index_ == 0) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeBool); + break; + } + + case SpvOpSampledImage: { + if (operand_index_ == 0) + return GetMtfIdGeneratedByOpcode(SpvOpTypeSampledImage); + if (operand_index_ == 2) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeImage); + if (operand_index_ == 3) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeSampler); + break; + } + + case SpvOpImageSampleImplicitLod: { + if (operand_index_ == 0) + return GetMtfIdGeneratedByOpcode(SpvOpTypeVector); + if (operand_index_ == 2) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeSampledImage); + if (operand_index_ == 3) + return GetMtfIdWithTypeGeneratedByOpcode(SpvOpTypeVector); + break; + } + + default: + break; + } + + return kMtfNone; +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_codec.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_codec.h new file mode 100644 index 00000000000..f313d617889 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_codec.h @@ -0,0 +1,337 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_COMP_MARKV_CODEC_H_ +#define SOURCE_COMP_MARKV_CODEC_H_ + +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/comp/huffman_codec.h" +#include "source/comp/markv_model.h" +#include "source/comp/move_to_front.h" +#include "source/diagnostic.h" +#include "source/id_descriptor.h" + +#include "source/val/instruction.h" + +// Base class for MARK-V encoder and decoder. Contains common functionality +// such as: +// - Validator connection and validation state. +// - SPIR-V grammar and helper functions. + +namespace spvtools { +namespace comp { + +class MarkvLogger; + +// Handles for move-to-front sequences. Enums which end with "Begin" define +// handle spaces which start at that value and span 16 or 32 bit wide. +enum : uint64_t { + kMtfNone = 0, + // All ids. + kMtfAll, + // All forward declared ids. + kMtfForwardDeclared, + // All type ids except for generated by OpTypeFunction. + kMtfTypeNonFunction, + // All labels. + kMtfLabel, + // All ids created by instructions which had type_id. + kMtfObject, + // All types generated by OpTypeFloat, OpTypeInt, OpTypeBool. + kMtfTypeScalar, + // All composite types. + kMtfTypeComposite, + // Boolean type or any vector type of it. + kMtfTypeBoolScalarOrVector, + // All float types or any vector floats type. + kMtfTypeFloatScalarOrVector, + // All int types or any vector int type. + kMtfTypeIntScalarOrVector, + // All types declared as return types in OpTypeFunction. + kMtfTypeReturnedByFunction, + // All composite objects. + kMtfComposite, + // All bool objects or vectors of bools. + kMtfBoolScalarOrVector, + // All float objects or vectors of float. + kMtfFloatScalarOrVector, + // All int objects or vectors of int. + kMtfIntScalarOrVector, + // All pointer types which point to composited. + kMtfTypePointerToComposite, + // Used by EncodeMtfRankHuffman. + kMtfGenericNonZeroRank, + // Handle space for ids of specific type. + kMtfIdOfTypeBegin = 0x10000, + // Handle space for ids generated by specific opcode. + kMtfIdGeneratedByOpcode = 0x20000, + // Handle space for ids of objects with type generated by specific opcode. + kMtfIdWithTypeGeneratedByOpcodeBegin = 0x30000, + // All vectors of specific component type. + kMtfVectorOfComponentTypeBegin = 0x40000, + // All vector types of specific size. + kMtfTypeVectorOfSizeBegin = 0x50000, + // All pointer types to specific type. + kMtfPointerToTypeBegin = 0x60000, + // All function types which return specific type. + kMtfFunctionTypeWithReturnTypeBegin = 0x70000, + // All function objects which return specific type. + kMtfFunctionWithReturnTypeBegin = 0x80000, + // Short id descriptor space (max 16-bit). + kMtfShortIdDescriptorSpaceBegin = 0x90000, + // Long id descriptor space (32-bit). + kMtfLongIdDescriptorSpaceBegin = 0x100000000, +}; + +class MarkvCodec { + public: + static const uint32_t kMarkvMagicNumber; + + // Mtf ranks smaller than this are encoded with Huffman coding. + static const uint32_t kMtfSmallestRankEncodedByValue; + + // Signals that the mtf rank is too large to be encoded with Huffman. + static const uint32_t kMtfRankEncodedByValueSignal; + + static const uint32_t kShortDescriptorNumBits; + + static const size_t kByteBreakAfterInstIfLessThanUntilNextByte; + + static uint32_t GetMarkvVersion(); + + virtual ~MarkvCodec(); + + protected: + struct MarkvHeader { + MarkvHeader(); + + uint32_t magic_number; + uint32_t markv_version; + // Magic number to identify or verify MarkvModel used for encoding. + uint32_t markv_model = 0; + uint32_t markv_length_in_bits = 0; + uint32_t spirv_version = 0; + uint32_t spirv_generator = 0; + }; + + // |model| is owned by the caller, must be not null and valid during the + // lifetime of the codec. + MarkvCodec(spv_const_context context, spv_validator_options validator_options, + const MarkvModel* model); + + // Returns instruction which created |id| or nullptr if such instruction was + // not registered. + const val::Instruction* FindDef(uint32_t id) const { + const auto it = id_to_def_instruction_.find(id); + if (it == id_to_def_instruction_.end()) return nullptr; + return it->second; + } + + size_t GetNumBitsToNextByte(size_t bit_pos) const; + bool OpcodeHasFixedNumberOfOperands(SpvOp opcode) const; + + // Returns type id of vector type component. + uint32_t GetVectorComponentType(uint32_t vector_type_id) const { + const val::Instruction* type_inst = FindDef(vector_type_id); + assert(type_inst); + assert(type_inst->opcode() == SpvOpTypeVector); + + const uint32_t component_type = + type_inst->word(type_inst->operands()[1].offset); + return component_type; + } + + // Returns mtf handle for ids of given type. + uint64_t GetMtfIdOfType(uint32_t type_id) const { + return kMtfIdOfTypeBegin + type_id; + } + + // Returns mtf handle for ids generated by given opcode. + uint64_t GetMtfIdGeneratedByOpcode(SpvOp opcode) const { + return kMtfIdGeneratedByOpcode + opcode; + } + + // Returns mtf handle for ids of type generated by given opcode. + uint64_t GetMtfIdWithTypeGeneratedByOpcode(SpvOp opcode) const { + return kMtfIdWithTypeGeneratedByOpcodeBegin + opcode; + } + + // Returns mtf handle for vectors of specific component type. + uint64_t GetMtfVectorOfComponentType(uint32_t type_id) const { + return kMtfVectorOfComponentTypeBegin + type_id; + } + + // Returns mtf handle for vector type of specific size. + uint64_t GetMtfTypeVectorOfSize(uint32_t size) const { + return kMtfTypeVectorOfSizeBegin + size; + } + + // Returns mtf handle for pointers to specific size. + uint64_t GetMtfPointerToType(uint32_t type_id) const { + return kMtfPointerToTypeBegin + type_id; + } + + // Returns mtf handle for function types with given return type. + uint64_t GetMtfFunctionTypeWithReturnType(uint32_t type_id) const { + return kMtfFunctionTypeWithReturnTypeBegin + type_id; + } + + // Returns mtf handle for functions with given return type. + uint64_t GetMtfFunctionWithReturnType(uint32_t type_id) const { + return kMtfFunctionWithReturnTypeBegin + type_id; + } + + // Returns mtf handle for the given long id descriptor. + uint64_t GetMtfLongIdDescriptor(uint32_t descriptor) const { + return kMtfLongIdDescriptorSpaceBegin + descriptor; + } + + // Returns mtf handle for the given short id descriptor. + uint64_t GetMtfShortIdDescriptor(uint32_t descriptor) const { + return kMtfShortIdDescriptorSpaceBegin + descriptor; + } + + // Process data from the current instruction. This would update MTFs and + // other data containers. + void ProcessCurInstruction(); + + // Returns move-to-front handle to be used for the current operand slot. + // Mtf handle is chosen based on a set of rules defined by SPIR-V grammar. + uint64_t GetRuleBasedMtf(); + + // Returns words of the current instruction. Decoder has a different + // implementation and the array is valid only until the previously decoded + // word. + virtual const uint32_t* GetInstWords() const { return inst_.words; } + + // Returns the opcode of the previous instruction. + SpvOp GetPrevOpcode() const { + if (instructions_.empty()) return SpvOpNop; + + return instructions_.back()->opcode(); + } + + // Returns diagnostic stream, position index is set to instruction number. + DiagnosticStream Diag(spv_result_t error_code) const { + return DiagnosticStream({0, 0, instructions_.size()}, context_->consumer, + "", error_code); + } + + // Returns current id bound. + uint32_t GetIdBound() const { return id_bound_; } + + // Sets current id bound, expected to be no lower than the previous one. + void SetIdBound(uint32_t id_bound) { + assert(id_bound >= id_bound_); + id_bound_ = id_bound; + } + + // Returns Huffman codec for ranks of the mtf with given |handle|. + // Different mtfs can use different rank distributions. + // May return nullptr if the codec doesn't exist. + const HuffmanCodec* GetMtfHuffmanCodec(uint64_t handle) const { + const auto it = mtf_huffman_codecs_.find(handle); + if (it == mtf_huffman_codecs_.end()) return nullptr; + return it->second.get(); + } + + // Promotes id in all move-to-front sequences if ids can be shared by multiple + // sequences. + void PromoteIfNeeded(uint32_t id) { + if (!model_->AnyDescriptorHasCodingScheme() && + model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + // Move-to-front sequences do not share ids. Nothing to do. + return; + } + multi_mtf_.Promote(id); + } + + spv_validator_options validator_options_ = nullptr; + const AssemblyGrammar grammar_; + MarkvHeader header_; + + // MARK-V model, not owned. + const MarkvModel* model_ = nullptr; + + // Current instruction, current operand and current operand index. + spv_parsed_instruction_t inst_; + spv_parsed_operand_t operand_; + uint32_t operand_index_; + + // Maps a result ID to its type ID. By convention: + // - a result ID that is a type definition maps to itself. + // - a result ID without a type maps to 0. (E.g. for OpLabel) + std::unordered_map id_to_type_id_; + + // Container for all move-to-front sequences. + MultiMoveToFront multi_mtf_; + + // Id of the current function or zero if outside of function. + uint32_t cur_function_id_ = 0; + + // Return type of the current function. + uint32_t cur_function_return_type_ = 0; + + // Remaining function parameter types. This container is filled on OpFunction, + // and drained on OpFunctionParameter. + std::list remaining_function_parameter_types_; + + // List of ids local to the current function. + std::vector ids_local_to_cur_function_; + + // List of instructions in the order they are given in the module. + std::vector> instructions_; + + // Container/computer for long (32-bit) id descriptors. + IdDescriptorCollection long_id_descriptors_; + + // Container/computer for short id descriptors. + // Short descriptors are stored in uint32_t, but their actual bit width is + // defined with kShortDescriptorNumBits. + // It doesn't seem logical to have a different computer for short id + // descriptors, since one could actually map/truncate long descriptors. + // But as short descriptors have collisions, the efficiency of + // compression depends on the collision pattern, and short descriptors + // produced by function ShortHashU32Array have been empirically proven to + // produce better results. + IdDescriptorCollection short_id_descriptors_; + + // Huffman codecs for move-to-front ranks. The map key is mtf handle. Doesn't + // need to contain a different codec for every handle as most use one and the + // same. + std::map>> + mtf_huffman_codecs_; + + // If not nullptr, codec will log comments on the compression process. + std::unique_ptr logger_; + + spv_const_context context_ = nullptr; + + private: + // Maps result id to the instruction which defined it. + std::unordered_map id_to_def_instruction_; + + uint32_t id_bound_ = 1; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_CODEC_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_decoder.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_decoder.cpp new file mode 100644 index 00000000000..22115831dc7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_decoder.cpp @@ -0,0 +1,925 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/comp/markv_decoder.h" + +#include +#include +#include + +#include "source/ext_inst.h" +#include "source/opcode.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace comp { + +spv_result_t MarkvDecoder::DecodeNonIdWord(uint32_t* word) { + auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); + + if (codec) { + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to decode non-id word with Huffman"; + + if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { + // The word decoded successfully. + *word = uint32_t(decoded_value); + assert(*word == decoded_value); + return SPV_SUCCESS; + } + + // Received kMarkvNoneOfTheAbove signal, use fallback decoding. + } + + const size_t chunk_length = + model_->GetOperandVariableWidthChunkLength(operand_.type); + if (chunk_length) { + if (!reader_.ReadVariableWidthU32(word, chunk_length)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to decode non-id word with varint"; + } else { + if (!reader_.ReadUnencoded(word)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read unencoded non-id word"; + } + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeOpcodeAndNumberOfOperands( + uint32_t* opcode, uint32_t* num_operands) { + // First try to use the Markov chain codec. + auto* codec = + model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); + if (codec) { + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode opcode_and_num_operands, previous opcode is " + << spvOpcodeString(GetPrevOpcode()); + + if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { + // The word was successfully decoded. + *opcode = uint32_t(decoded_value & 0xFFFF); + *num_operands = uint32_t(decoded_value >> 16); + return SPV_SUCCESS; + } + + // Received kMarkvNoneOfTheAbove signal, use fallback decoding. + } + + // Fallback to base-rate codec. + codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); + assert(codec); + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode opcode_and_num_operands with global codec"; + + if (decoded_value == MarkvModel::GetMarkvNoneOfTheAbove()) { + // Received kMarkvNoneOfTheAbove signal, fallback further. + return SPV_UNSUPPORTED; + } + + *opcode = uint32_t(decoded_value & 0xFFFF); + *num_operands = uint32_t(decoded_value >> 16); + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeMtfRankHuffman(uint64_t mtf, + uint32_t fallback_method, + uint32_t* rank) { + const auto* codec = GetMtfHuffmanCodec(mtf); + if (!codec) { + assert(fallback_method != kMtfNone); + codec = GetMtfHuffmanCodec(fallback_method); + } + + if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to decode MTF rank"; + + uint32_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) << "Failed to decode MTF rank with Huffman"; + + if (decoded_value == kMtfRankEncodedByValueSignal) { + // Decode by value. + if (!reader_.ReadVariableWidthU32(rank, model_->mtf_rank_chunk_length())) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode MTF rank with varint"; + *rank += MarkvCodec::kMtfSmallestRankEncodedByValue; + } else { + // Decode using Huffman coding. + assert(decoded_value < MarkvCodec::kMtfSmallestRankEncodedByValue); + *rank = decoded_value; + } + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeIdWithDescriptor(uint32_t* id) { + auto* codec = + model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); + + uint64_t mtf = kMtfNone; + if (codec) { + uint64_t decoded_value = 0; + if (!codec->DecodeFromStream(GetReadBitCallback(), &decoded_value)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode descriptor with Huffman"; + + if (decoded_value != MarkvModel::GetMarkvNoneOfTheAbove()) { + const uint32_t long_descriptor = uint32_t(decoded_value); + mtf = GetMtfLongIdDescriptor(long_descriptor); + } + } + + if (mtf == kMtfNone) { + if (model_->id_fallback_strategy() != + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + return SPV_UNSUPPORTED; + } + + uint64_t decoded_value = 0; + if (!reader_.ReadBits(&decoded_value, MarkvCodec::kShortDescriptorNumBits)) + return Diag(SPV_ERROR_INTERNAL) << "Failed to read short descriptor"; + const uint32_t short_descriptor = uint32_t(decoded_value); + if (short_descriptor == 0) { + // Forward declared id. + return SPV_UNSUPPORTED; + } + mtf = GetMtfShortIdDescriptor(short_descriptor); + } + + return DecodeExistingId(mtf, id); +} + +spv_result_t MarkvDecoder::DecodeExistingId(uint64_t mtf, uint32_t* id) { + assert(multi_mtf_.GetSize(mtf) > 0); + *id = 0; + + uint32_t rank = 0; + + if (multi_mtf_.GetSize(mtf) == 1) { + rank = 1; + } else { + const spv_result_t result = + DecodeMtfRankHuffman(mtf, kMtfGenericNonZeroRank, &rank); + if (result != SPV_SUCCESS) return result; + } + + assert(rank); + if (!multi_mtf_.ValueFromRank(mtf, rank, id)) + return Diag(SPV_ERROR_INTERNAL) << "MTF rank is out of bounds"; + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeRefId(uint32_t* id) { + { + const spv_result_t result = DecodeIdWithDescriptor(id); + if (result != SPV_UNSUPPORTED) return result; + } + + const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( + SpvOp(inst_.opcode))(operand_index_); + uint32_t rank = 0; + *id = 0; + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + uint64_t mtf = GetRuleBasedMtf(); + if (mtf != kMtfNone && !can_forward_declare) { + return DecodeExistingId(mtf, id); + } + + if (mtf == kMtfNone) mtf = kMtfAll; + { + const spv_result_t result = DecodeMtfRankHuffman(mtf, kMtfAll, &rank); + if (result != SPV_SUCCESS) return result; + } + + if (rank == 0) { + // This is the first occurrence of a forward declared id. + *id = GetIdBound(); + SetIdBound(*id + 1); + multi_mtf_.Insert(kMtfAll, *id); + multi_mtf_.Insert(kMtfForwardDeclared, *id); + if (mtf != kMtfAll) multi_mtf_.Insert(mtf, *id); + } else { + if (!multi_mtf_.ValueFromRank(mtf, rank, id)) + return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; + } + } else { + assert(can_forward_declare); + + if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to decode MTF rank with varint"; + + if (rank == 0) { + // This is the first occurrence of a forward declared id. + *id = GetIdBound(); + SetIdBound(*id + 1); + multi_mtf_.Insert(kMtfForwardDeclared, *id); + } else { + if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, id)) + return Diag(SPV_ERROR_INTERNAL) << "MTF rank out of bounds"; + } + } + assert(*id); + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeTypeId() { + if (inst_.opcode == SpvOpFunctionParameter) { + assert(!remaining_function_parameter_types_.empty()); + inst_.type_id = remaining_function_parameter_types_.front(); + remaining_function_parameter_types_.pop_front(); + return SPV_SUCCESS; + } + + { + const spv_result_t result = DecodeIdWithDescriptor(&inst_.type_id); + if (result != SPV_UNSUPPORTED) return result; + } + + assert(model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased); + + uint64_t mtf = GetRuleBasedMtf(); + assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( + operand_index_)); + + if (mtf == kMtfNone) { + mtf = kMtfTypeNonFunction; + // Function types should have been handled by GetRuleBasedMtf. + assert(inst_.opcode != SpvOpFunction); + } + + return DecodeExistingId(mtf, &inst_.type_id); +} + +spv_result_t MarkvDecoder::DecodeResultId() { + uint32_t rank = 0; + + const uint64_t num_still_forward_declared = + multi_mtf_.GetSize(kMtfForwardDeclared); + + if (num_still_forward_declared) { + // Some ids were forward declared. Check if this id is one of them. + uint64_t id_was_forward_declared; + if (!reader_.ReadBits(&id_was_forward_declared, 1)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read id_was_forward_declared flag"; + + if (id_was_forward_declared) { + if (!reader_.ReadVariableWidthU32(&rank, model_->mtf_rank_chunk_length())) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read MTF rank of forward declared id"; + + if (rank) { + // The id was forward declared, recover it from kMtfForwardDeclared. + if (!multi_mtf_.ValueFromRank(kMtfForwardDeclared, rank, + &inst_.result_id)) + return Diag(SPV_ERROR_INTERNAL) + << "Forward declared MTF rank is out of bounds"; + + // We can now remove the id from kMtfForwardDeclared. + if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to remove id from kMtfForwardDeclared"; + } + } + } + + if (inst_.result_id == 0) { + // The id was not forward declared, issue a new id. + inst_.result_id = GetIdBound(); + SetIdBound(inst_.result_id + 1); + } + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + if (!rank) { + multi_mtf_.Insert(kMtfAll, inst_.result_id); + } + } + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeLiteralNumber( + const spv_parsed_operand_t& operand) { + if (operand.number_bit_width <= 32) { + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + inst_words_.push_back(word); + } else { + assert(operand.number_bit_width <= 64); + uint64_t word = 0; + if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { + if (!reader_.ReadVariableWidthU64(&word, model_->u64_chunk_length())) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal U64"; + } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { + int64_t val = 0; + if (!reader_.ReadVariableWidthS64(&val, model_->s64_chunk_length(), + model_->s64_block_exponent())) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal S64"; + std::memcpy(&word, &val, 8); + } else if (operand.number_kind == SPV_NUMBER_FLOATING) { + if (!reader_.ReadUnencoded(&word)) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read literal F64"; + } else { + return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; + } + inst_words_.push_back(static_cast(word)); + inst_words_.push_back(static_cast(word >> 32)); + } + return SPV_SUCCESS; +} + +bool MarkvDecoder::ReadToByteBreak(size_t byte_break_if_less_than) { + const size_t num_bits_to_next_byte = + GetNumBitsToNextByte(reader_.GetNumReadBits()); + if (num_bits_to_next_byte == 0 || + num_bits_to_next_byte > byte_break_if_less_than) + return true; + + uint64_t bits = 0; + if (!reader_.ReadBits(&bits, num_bits_to_next_byte)) return false; + + assert(bits == 0); + if (bits != 0) return false; + + return true; +} + +spv_result_t MarkvDecoder::DecodeModule(std::vector* spirv_binary) { + const bool header_read_success = + reader_.ReadUnencoded(&header_.magic_number) && + reader_.ReadUnencoded(&header_.markv_version) && + reader_.ReadUnencoded(&header_.markv_model) && + reader_.ReadUnencoded(&header_.markv_length_in_bits) && + reader_.ReadUnencoded(&header_.spirv_version) && + reader_.ReadUnencoded(&header_.spirv_generator); + + if (!header_read_success) + return Diag(SPV_ERROR_INVALID_BINARY) << "Unable to read MARK-V header"; + + if (header_.markv_length_in_bits == 0) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Header markv_length_in_bits field is zero"; + + if (header_.magic_number != MarkvCodec::kMarkvMagicNumber) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary has incorrect magic number"; + + // TODO(atgoo@github.com): Print version strings. + if (header_.markv_version != MarkvCodec::GetMarkvVersion()) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary and the codec have different versions"; + + const uint32_t model_type = header_.markv_model >> 16; + const uint32_t model_version = header_.markv_model & 0xFFFF; + if (model_type != model_->model_type()) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary and the codec use different MARK-V models"; + + if (model_version != model_->model_version()) + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary and the codec use different versions if the same " + << "MARK-V model"; + + spirv_.reserve(header_.markv_length_in_bits / 2); // Heuristic. + spirv_.resize(5, 0); + spirv_[0] = SpvMagicNumber; + spirv_[1] = header_.spirv_version; + spirv_[2] = header_.spirv_generator; + + if (logger_) { + reader_.SetCallback( + [this](const std::string& str) { logger_->AppendBitSequence(str); }); + } + + while (reader_.GetNumReadBits() < header_.markv_length_in_bits) { + inst_ = {}; + const spv_result_t decode_result = DecodeInstruction(); + if (decode_result != SPV_SUCCESS) return decode_result; + } + + if (validator_options_) { + spv_const_binary_t validation_binary = {spirv_.data(), spirv_.size()}; + const spv_result_t result = spvValidateWithOptions( + context_, validator_options_, &validation_binary, nullptr); + if (result != SPV_SUCCESS) return result; + } + + // Validate the decode binary + if (reader_.GetNumReadBits() != header_.markv_length_in_bits || + !reader_.OnlyZeroesLeft()) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "MARK-V binary has wrong stated bit length " + << reader_.GetNumReadBits() << " " << header_.markv_length_in_bits; + } + + // Decoding of the module is finished, validation state should have correct + // id bound. + spirv_[3] = GetIdBound(); + + *spirv_binary = std::move(spirv_); + return SPV_SUCCESS; +} + +// TODO(atgoo@github.com): The implementation borrows heavily from +// Parser::parseOperand. +// Consider coupling them together in some way once MARK-V codec is more mature. +// For now it's better to keep the code independent for experimentation +// purposes. +spv_result_t MarkvDecoder::DecodeOperand( + size_t operand_offset, const spv_operand_type_t type, + spv_operand_pattern_t* expected_operands) { + const SpvOp opcode = static_cast(inst_.opcode); + + memset(&operand_, 0, sizeof(operand_)); + + assert((operand_offset >> 16) == 0); + operand_.offset = static_cast(operand_offset); + operand_.type = type; + + // Set default values, may be updated later. + operand_.number_kind = SPV_NUMBER_NONE; + operand_.number_bit_width = 0; + + const size_t first_word_index = inst_words_.size(); + + switch (type) { + case SPV_OPERAND_TYPE_RESULT_ID: { + const spv_result_t result = DecodeResultId(); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(inst_.result_id); + SetIdBound(std::max(GetIdBound(), inst_.result_id + 1)); + PromoteIfNeeded(inst_.result_id); + break; + } + + case SPV_OPERAND_TYPE_TYPE_ID: { + const spv_result_t result = DecodeTypeId(); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(inst_.type_id); + SetIdBound(std::max(GetIdBound(), inst_.type_id + 1)); + PromoteIfNeeded(inst_.type_id); + break; + } + + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { + uint32_t id = 0; + const spv_result_t result = DecodeRefId(&id); + if (result != SPV_SUCCESS) return result; + + if (id == 0) return Diag(SPV_ERROR_INVALID_BINARY) << "Decoded id is 0"; + + if (type == SPV_OPERAND_TYPE_ID || type == SPV_OPERAND_TYPE_OPTIONAL_ID) { + operand_.type = SPV_OPERAND_TYPE_ID; + + if (opcode == SpvOpExtInst && operand_.offset == 3) { + // The current word is the extended instruction set id. + // Set the extended instruction set type for the current + // instruction. + auto ext_inst_type_iter = import_id_to_ext_inst_type_.find(id); + if (ext_inst_type_iter == import_id_to_ext_inst_type_.end()) { + return Diag(SPV_ERROR_INVALID_ID) + << "OpExtInst set id " << id + << " does not reference an OpExtInstImport result Id"; + } + inst_.ext_inst_type = ext_inst_type_iter->second; + } + } + + inst_words_.push_back(id); + SetIdBound(std::max(GetIdBound(), id + 1)); + PromoteIfNeeded(id); + break; + } + + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + + assert(SpvOpExtInst == opcode); + assert(inst_.ext_inst_type != SPV_EXT_INST_TYPE_NONE); + spv_ext_inst_desc ext_inst; + if (grammar_.lookupExtInst(inst_.ext_inst_type, word, &ext_inst)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid extended instruction number: " << word; + spvPushOperandTypes(ext_inst->operandTypes, expected_operands); + break; + } + + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: { + // These are regular single-word literal integer operands. + // Post-parsing validation should check the range of the parsed value. + operand_.type = SPV_OPERAND_TYPE_LITERAL_INTEGER; + // It turns out they are always unsigned integers! + operand_.number_kind = SPV_NUMBER_UNSIGNED_INT; + operand_.number_bit_width = 32; + + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + break; + } + + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: + case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: { + operand_.type = SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER; + if (opcode == SpvOpSwitch) { + // The literal operands have the same type as the value + // referenced by the selector Id. + const uint32_t selector_id = inst_words_.at(1); + const auto type_id_iter = id_to_type_id_.find(selector_id); + if (type_id_iter == id_to_type_id_.end() || type_id_iter->second == 0) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid OpSwitch: selector id " << selector_id + << " has no type"; + } + uint32_t type_id = type_id_iter->second; + + if (selector_id == type_id) { + // Recall that by convention, a result ID that is a type definition + // maps to itself. + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid OpSwitch: selector id " << selector_id + << " is a type, not a value"; + } + if (auto error = SetNumericTypeInfoForType(&operand_, type_id)) + return error; + if (operand_.number_kind != SPV_NUMBER_UNSIGNED_INT && + operand_.number_kind != SPV_NUMBER_SIGNED_INT) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid OpSwitch: selector id " << selector_id + << " is not a scalar integer"; + } + } else { + assert(opcode == SpvOpConstant || opcode == SpvOpSpecConstant); + // The literal number type is determined by the type Id for the + // constant. + assert(inst_.type_id); + if (auto error = SetNumericTypeInfoForType(&operand_, inst_.type_id)) + return error; + } + + if (auto error = DecodeLiteralNumber(operand_)) return error; + + break; + } + + case SPV_OPERAND_TYPE_LITERAL_STRING: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { + operand_.type = SPV_OPERAND_TYPE_LITERAL_STRING; + std::vector str; + auto* codec = model_->GetLiteralStringHuffmanCodec(inst_.opcode); + + if (codec) { + std::string decoded_string; + const bool huffman_result = + codec->DecodeFromStream(GetReadBitCallback(), &decoded_string); + assert(huffman_result); + if (!huffman_result) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read literal string"; + + if (decoded_string != "kMarkvNoneOfTheAbove") { + std::copy(decoded_string.begin(), decoded_string.end(), + std::back_inserter(str)); + str.push_back('\0'); + } + } + + // The loop is expected to terminate once we encounter '\0' or exhaust + // the bit stream. + if (str.empty()) { + while (true) { + char ch = 0; + if (!reader_.ReadUnencoded(&ch)) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read literal string"; + + str.push_back(ch); + + if (ch == '\0') break; + } + } + + while (str.size() % 4 != 0) str.push_back('\0'); + + inst_words_.resize(inst_words_.size() + str.size() / 4); + std::memcpy(&inst_words_[first_word_index], str.data(), str.size()); + + if (SpvOpExtInstImport == opcode) { + // Record the extended instruction type for the ID for this import. + // There is only one string literal argument to OpExtInstImport, + // so it's sufficient to guard this just on the opcode. + const spv_ext_inst_type_t ext_inst_type = + spvExtInstImportTypeGet(str.data()); + if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid extended instruction import '" << str.data() + << "'"; + } + // We must have parsed a valid result ID. It's a condition + // of the grammar, and we only accept non-zero result Ids. + assert(inst_.result_id); + const bool inserted = + import_id_to_ext_inst_type_.emplace(inst_.result_id, ext_inst_type) + .second; + (void)inserted; + assert(inserted); + } + break; + } + + case SPV_OPERAND_TYPE_CAPABILITY: + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: + case SPV_OPERAND_TYPE_EXECUTION_MODEL: + case SPV_OPERAND_TYPE_ADDRESSING_MODEL: + case SPV_OPERAND_TYPE_MEMORY_MODEL: + case SPV_OPERAND_TYPE_EXECUTION_MODE: + case SPV_OPERAND_TYPE_STORAGE_CLASS: + case SPV_OPERAND_TYPE_DIMENSIONALITY: + case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: + case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: + case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: + case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: + case SPV_OPERAND_TYPE_LINKAGE_TYPE: + case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: + case SPV_OPERAND_TYPE_DECORATION: + case SPV_OPERAND_TYPE_BUILT_IN: + case SPV_OPERAND_TYPE_GROUP_OPERATION: + case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: + case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: { + // A single word that is a plain enum value. + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + + // Map an optional operand type to its corresponding concrete type. + if (type == SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER) + operand_.type = SPV_OPERAND_TYPE_ACCESS_QUALIFIER; + + spv_operand_desc entry; + if (grammar_.lookupOperand(type, word, &entry)) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid " << spvOperandTypeStr(operand_.type) + << " operand: " << word; + } + + // Prepare to accept operands to this operand, if needed. + spvPushOperandTypes(entry->operandTypes, expected_operands); + break; + } + + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + case SPV_OPERAND_TYPE_LOOP_CONTROL: + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_SELECTION_CONTROL: { + // This operand is a mask. + uint32_t word = 0; + const spv_result_t result = DecodeNonIdWord(&word); + if (result != SPV_SUCCESS) return result; + + inst_words_.push_back(word); + + // Map an optional operand type to its corresponding concrete type. + if (type == SPV_OPERAND_TYPE_OPTIONAL_IMAGE) + operand_.type = SPV_OPERAND_TYPE_IMAGE; + else if (type == SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS) + operand_.type = SPV_OPERAND_TYPE_MEMORY_ACCESS; + + // Check validity of set mask bits. Also prepare for operands for those + // masks if they have any. To get operand order correct, scan from + // MSB to LSB since we can only prepend operands to a pattern. + // The only case in the grammar where you have more than one mask bit + // having an operand is for image operands. See SPIR-V 3.14 Image + // Operands. + uint32_t remaining_word = word; + for (uint32_t mask = (1u << 31); remaining_word; mask >>= 1) { + if (remaining_word & mask) { + spv_operand_desc entry; + if (grammar_.lookupOperand(type, mask, &entry)) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Invalid " << spvOperandTypeStr(operand_.type) + << " operand: " << word << " has invalid mask component " + << mask; + } + remaining_word ^= mask; + spvPushOperandTypes(entry->operandTypes, expected_operands); + } + } + if (word == 0) { + // An all-zeroes mask *might* also be valid. + spv_operand_desc entry; + if (SPV_SUCCESS == grammar_.lookupOperand(type, 0, &entry)) { + // Prepare for its operands, if any. + spvPushOperandTypes(entry->operandTypes, expected_operands); + } + } + break; + } + default: + return Diag(SPV_ERROR_INVALID_BINARY) + << "Internal error: Unhandled operand type: " << type; + } + + operand_.num_words = uint16_t(inst_words_.size() - first_word_index); + + assert(spvOperandIsConcrete(operand_.type)); + + parsed_operands_.push_back(operand_); + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::DecodeInstruction() { + parsed_operands_.clear(); + inst_words_.clear(); + + // Opcode/num_words placeholder, the word will be filled in later. + inst_words_.push_back(0); + + bool num_operands_still_unknown = true; + { + uint32_t opcode = 0; + uint32_t num_operands = 0; + + const spv_result_t opcode_decoding_result = + DecodeOpcodeAndNumberOfOperands(&opcode, &num_operands); + if (opcode_decoding_result < 0) return opcode_decoding_result; + + if (opcode_decoding_result == SPV_SUCCESS) { + inst_.num_operands = static_cast(num_operands); + num_operands_still_unknown = false; + } else { + if (!reader_.ReadVariableWidthU32(&opcode, + model_->opcode_chunk_length())) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read opcode of instruction"; + } + } + + inst_.opcode = static_cast(opcode); + } + + const SpvOp opcode = static_cast(inst_.opcode); + + spv_opcode_desc opcode_desc; + if (grammar_.lookupOpcode(opcode, &opcode_desc) != SPV_SUCCESS) { + return Diag(SPV_ERROR_INVALID_BINARY) << "Invalid opcode"; + } + + spv_operand_pattern_t expected_operands; + expected_operands.reserve(opcode_desc->numTypes); + for (auto i = 0; i < opcode_desc->numTypes; i++) { + expected_operands.push_back( + opcode_desc->operandTypes[opcode_desc->numTypes - i - 1]); + } + + if (num_operands_still_unknown) { + if (!OpcodeHasFixedNumberOfOperands(opcode)) { + if (!reader_.ReadVariableWidthU16(&inst_.num_operands, + model_->num_operands_chunk_length())) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to read num_operands of instruction"; + } else { + inst_.num_operands = static_cast(expected_operands.size()); + } + } + + for (operand_index_ = 0; + operand_index_ < static_cast(inst_.num_operands); + ++operand_index_) { + assert(!expected_operands.empty()); + const spv_operand_type_t type = + spvTakeFirstMatchableOperand(&expected_operands); + + const size_t operand_offset = inst_words_.size(); + + const spv_result_t decode_result = + DecodeOperand(operand_offset, type, &expected_operands); + + if (decode_result != SPV_SUCCESS) return decode_result; + } + + assert(inst_.num_operands == parsed_operands_.size()); + + // Only valid while inst_words_ and parsed_operands_ remain unchanged (until + // next DecodeInstruction call). + inst_.words = inst_words_.data(); + inst_.operands = parsed_operands_.empty() ? nullptr : parsed_operands_.data(); + inst_.num_words = static_cast(inst_words_.size()); + inst_words_[0] = spvOpcodeMake(inst_.num_words, SpvOp(inst_.opcode)); + + std::copy(inst_words_.begin(), inst_words_.end(), std::back_inserter(spirv_)); + + assert(inst_.num_words == + std::accumulate( + parsed_operands_.begin(), parsed_operands_.end(), 1, + [](int num_words, const spv_parsed_operand_t& operand) { + return num_words += operand.num_words; + }) && + "num_words in instruction doesn't correspond to the sum of num_words" + "in the operands"); + + RecordNumberType(); + ProcessCurInstruction(); + + if (!ReadToByteBreak(MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte)) + return Diag(SPV_ERROR_INVALID_BINARY) << "Failed to read to byte break"; + + if (logger_) { + logger_->NewLine(); + std::stringstream ss; + ss << spvOpcodeString(opcode) << " "; + for (size_t index = 1; index < inst_words_.size(); ++index) + ss << inst_words_[index] << " "; + logger_->AppendText(ss.str()); + logger_->NewLine(); + logger_->NewLine(); + if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; + } + + return SPV_SUCCESS; +} + +spv_result_t MarkvDecoder::SetNumericTypeInfoForType( + spv_parsed_operand_t* parsed_operand, uint32_t type_id) { + assert(type_id != 0); + auto type_info_iter = type_id_to_number_type_info_.find(type_id); + if (type_info_iter == type_id_to_number_type_info_.end()) { + return Diag(SPV_ERROR_INVALID_BINARY) + << "Type Id " << type_id << " is not a type"; + } + + const NumberType& info = type_info_iter->second; + if (info.type == SPV_NUMBER_NONE) { + // This is a valid type, but for something other than a scalar number. + return Diag(SPV_ERROR_INVALID_BINARY) + << "Type Id " << type_id << " is not a scalar numeric type"; + } + + parsed_operand->number_kind = info.type; + parsed_operand->number_bit_width = info.bit_width; + // Round up the word count. + parsed_operand->num_words = static_cast((info.bit_width + 31) / 32); + return SPV_SUCCESS; +} + +void MarkvDecoder::RecordNumberType() { + const SpvOp opcode = static_cast(inst_.opcode); + if (spvOpcodeGeneratesType(opcode)) { + NumberType info = {SPV_NUMBER_NONE, 0}; + if (SpvOpTypeInt == opcode) { + info.bit_width = inst_.words[inst_.operands[1].offset]; + info.type = inst_.words[inst_.operands[2].offset] + ? SPV_NUMBER_SIGNED_INT + : SPV_NUMBER_UNSIGNED_INT; + } else if (SpvOpTypeFloat == opcode) { + info.bit_width = inst_.words[inst_.operands[1].offset]; + info.type = SPV_NUMBER_FLOATING; + } + // The *result* Id of a type generating instruction is the type Id. + type_id_to_number_type_info_[inst_.result_id] = info; + } +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_decoder.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_decoder.h new file mode 100644 index 00000000000..4d8402b4427 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_decoder.h @@ -0,0 +1,175 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/comp/bit_stream.h" +#include "source/comp/markv.h" +#include "source/comp/markv_codec.h" +#include "source/comp/markv_logger.h" +#include "source/util/make_unique.h" + +#ifndef SOURCE_COMP_MARKV_DECODER_H_ +#define SOURCE_COMP_MARKV_DECODER_H_ + +namespace spvtools { +namespace comp { + +class MarkvLogger; + +// Decodes MARK-V buffers written by MarkvEncoder. +class MarkvDecoder : public MarkvCodec { + public: + // |model| is owned by the caller, must be not null and valid during the + // lifetime of MarkvEncoder. + MarkvDecoder(spv_const_context context, const std::vector& markv, + const MarkvCodecOptions& options, const MarkvModel* model) + : MarkvCodec(context, GetValidatorOptions(options), model), + options_(options), + reader_(markv) { + SetIdBound(1); + parsed_operands_.reserve(25); + inst_words_.reserve(25); + } + ~MarkvDecoder() = default; + + // Creates an internal logger which writes comments on the decoding process. + void CreateLogger(MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer) { + logger_ = MakeUnique(log_consumer, debug_consumer); + } + + // Decodes SPIR-V from MARK-V and stores the words in |spirv_binary|. + // Can be called only once. Fails if data of wrong format or ends prematurely, + // of if validation fails. + spv_result_t DecodeModule(std::vector* spirv_binary); + + // Creates and returns validator options. Returned value owned by the caller. + static spv_validator_options GetValidatorOptions( + const MarkvCodecOptions& options) { + return options.validate_spirv_binary ? spvValidatorOptionsCreate() + : nullptr; + } + + private: + // Describes the format of a typed literal number. + struct NumberType { + spv_number_kind_t type; + uint32_t bit_width; + }; + + // Reads a single bit from reader_. The read bit is stored in |bit|. + // Returns false iff reader_ fails. + bool ReadBit(bool* bit) { + uint64_t bits = 0; + const bool result = reader_.ReadBits(&bits, 1); + if (result) *bit = bits ? true : false; + return result; + }; + + // Returns ReadBit bound to the class object. + std::function GetReadBitCallback() { + return std::bind(&MarkvDecoder::ReadBit, this, std::placeholders::_1); + } + + // Reads a single non-id word from bit stream. operand_.type determines if + // the word needs to be decoded and how. + spv_result_t DecodeNonIdWord(uint32_t* word); + + // Reads and decodes both opcode and num_operands as a single code. + // Returns SPV_UNSUPPORTED iff no suitable codec was found. + spv_result_t DecodeOpcodeAndNumberOfOperands(uint32_t* opcode, + uint32_t* num_operands); + + // Reads mtf rank from bit stream. |mtf| is used to determine the codec + // scheme. |fallback_method| is used if no codec defined for |mtf|. + spv_result_t DecodeMtfRankHuffman(uint64_t mtf, uint32_t fallback_method, + uint32_t* rank); + + // Reads id using coding based on mtf associated with the id descriptor. + // Returns SPV_UNSUPPORTED iff fallback method needs to be used. + spv_result_t DecodeIdWithDescriptor(uint32_t* id); + + // Reads id using coding based on the given |mtf|, which is expected to + // contain the needed |id|. + spv_result_t DecodeExistingId(uint64_t mtf, uint32_t* id); + + // Reads type id of the current instruction if can't be inferred. + spv_result_t DecodeTypeId(); + + // Reads result id of the current instruction if can't be inferred. + spv_result_t DecodeResultId(); + + // Reads id which is neither type nor result id. + spv_result_t DecodeRefId(uint32_t* id); + + // Reads and discards bits until the beginning of the next byte if the + // number of bits until the next byte is less than |byte_break_if_less_than|. + bool ReadToByteBreak(size_t byte_break_if_less_than); + + // Returns instruction words decoded up to this point. + const uint32_t* GetInstWords() const override { return inst_words_.data(); } + + // Reads a literal number as it is described in |operand| from the bit stream, + // decodes and writes it to spirv_. + spv_result_t DecodeLiteralNumber(const spv_parsed_operand_t& operand); + + // Reads instruction from bit stream, decodes and validates it. + // Decoded instruction is valid until the next call of DecodeInstruction(). + spv_result_t DecodeInstruction(); + + // Read operand from the stream decodes and validates it. + spv_result_t DecodeOperand(size_t operand_offset, + const spv_operand_type_t type, + spv_operand_pattern_t* expected_operands); + + // Records the numeric type for an operand according to the type information + // associated with the given non-zero type Id. This can fail if the type Id + // is not a type Id, or if the type Id does not reference a scalar numeric + // type. On success, return SPV_SUCCESS and populates the num_words, + // number_kind, and number_bit_width fields of parsed_operand. + spv_result_t SetNumericTypeInfoForType(spv_parsed_operand_t* parsed_operand, + uint32_t type_id); + + // Records the number type for the current instruction, if it generates a + // type. For types that aren't scalar numbers, record something with number + // kind SPV_NUMBER_NONE. + void RecordNumberType(); + + MarkvCodecOptions options_; + + // Temporary sink where decoded SPIR-V words are written. Once it contains the + // entire module, the container is moved and returned. + std::vector spirv_; + + // Bit stream containing encoded data. + BitReaderWord64 reader_; + + // Temporary storage for operands of the currently parsed instruction. + // Valid until next DecodeInstruction call. + std::vector parsed_operands_; + + // Temporary storage for current instruction words. + // Valid until next DecodeInstruction call. + std::vector inst_words_; + + // Maps a type ID to its number type description. + std::unordered_map type_id_to_number_type_info_; + + // Maps an ExtInstImport id to the extended instruction type. + std::unordered_map import_id_to_ext_inst_type_; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_DECODER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_encoder.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_encoder.cpp new file mode 100644 index 00000000000..1abd5864603 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_encoder.cpp @@ -0,0 +1,486 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/comp/markv_encoder.h" + +#include "source/binary.h" +#include "source/opcode.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace comp { +namespace { + +const size_t kCommentNumWhitespaces = 2; + +} // namespace + +spv_result_t MarkvEncoder::EncodeNonIdWord(uint32_t word) { + auto* codec = model_->GetNonIdWordHuffmanCodec(inst_.opcode, operand_index_); + + if (codec) { + uint64_t bits = 0; + size_t num_bits = 0; + if (codec->Encode(word, &bits, &num_bits)) { + // Encoding successful. + writer_.WriteBits(bits, num_bits); + return SPV_SUCCESS; + } else { + // Encoding failed, write kMarkvNoneOfTheAbove flag. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Non-id word Huffman table for " + << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " + << operand_index_ << " is missing kMarkvNoneOfTheAbove"; + writer_.WriteBits(bits, num_bits); + } + } + + // Fallback encoding. + const size_t chunk_length = + model_->GetOperandVariableWidthChunkLength(operand_.type); + if (chunk_length) { + writer_.WriteVariableWidthU32(word, chunk_length); + } else { + writer_.WriteUnencoded(word); + } + return SPV_SUCCESS; +} + +spv_result_t MarkvEncoder::EncodeOpcodeAndNumOperands(uint32_t opcode, + uint32_t num_operands) { + uint64_t bits = 0; + size_t num_bits = 0; + + const uint32_t word = opcode | (num_operands << 16); + + // First try to use the Markov chain codec. + auto* codec = + model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(GetPrevOpcode()); + if (codec) { + if (codec->Encode(word, &bits, &num_bits)) { + // The word was successfully encoded into bits/num_bits. + writer_.WriteBits(bits, num_bits); + return SPV_SUCCESS; + } else { + // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove + // and use fallback encoding. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "opcode_and_num_operands Huffman table for " + << spvOpcodeString(GetPrevOpcode()) + << "is missing kMarkvNoneOfTheAbove"; + writer_.WriteBits(bits, num_bits); + } + } + + // Fallback to base-rate codec. + codec = model_->GetOpcodeAndNumOperandsMarkovHuffmanCodec(SpvOpNop); + assert(codec); + if (codec->Encode(word, &bits, &num_bits)) { + // The word was successfully encoded into bits/num_bits. + writer_.WriteBits(bits, num_bits); + return SPV_SUCCESS; + } else { + // The word is not in the Huffman table. Write kMarkvNoneOfTheAbove + // and return false. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Global opcode_and_num_operands Huffman table is missing " + << "kMarkvNoneOfTheAbove"; + writer_.WriteBits(bits, num_bits); + return SPV_UNSUPPORTED; + } +} + +spv_result_t MarkvEncoder::EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, + uint64_t fallback_method) { + const auto* codec = GetMtfHuffmanCodec(mtf); + if (!codec) { + assert(fallback_method != kMtfNone); + codec = GetMtfHuffmanCodec(fallback_method); + } + + if (!codec) return Diag(SPV_ERROR_INTERNAL) << "No codec to encode MTF rank"; + + uint64_t bits = 0; + size_t num_bits = 0; + if (rank < MarkvCodec::kMtfSmallestRankEncodedByValue) { + // Encode using Huffman coding. + if (!codec->Encode(rank, &bits, &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to encode MTF rank with Huffman"; + + writer_.WriteBits(bits, num_bits); + } else { + // Encode by value. + if (!codec->Encode(MarkvCodec::kMtfRankEncodedByValueSignal, &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to encode kMtfRankEncodedByValueSignal"; + + writer_.WriteBits(bits, num_bits); + writer_.WriteVariableWidthU32( + rank - MarkvCodec::kMtfSmallestRankEncodedByValue, + model_->mtf_rank_chunk_length()); + } + return SPV_SUCCESS; +} + +spv_result_t MarkvEncoder::EncodeIdWithDescriptor(uint32_t id) { + // Get the descriptor for id. + const uint32_t long_descriptor = long_id_descriptors_.GetDescriptor(id); + auto* codec = + model_->GetIdDescriptorHuffmanCodec(inst_.opcode, operand_index_); + uint64_t bits = 0; + size_t num_bits = 0; + uint64_t mtf = kMtfNone; + if (long_descriptor && codec && + codec->Encode(long_descriptor, &bits, &num_bits)) { + // If the descriptor exists and is in the table, write the descriptor and + // proceed to encoding the rank. + writer_.WriteBits(bits, num_bits); + mtf = GetMtfLongIdDescriptor(long_descriptor); + } else { + if (codec) { + // The descriptor doesn't exist or we have no coding for it. Write + // kMarkvNoneOfTheAbove and go to fallback method. + if (!codec->Encode(MarkvModel::GetMarkvNoneOfTheAbove(), &bits, + &num_bits)) + return Diag(SPV_ERROR_INTERNAL) + << "Descriptor Huffman table for " + << spvOpcodeString(SpvOp(inst_.opcode)) << " operand index " + << operand_index_ << " is missing kMarkvNoneOfTheAbove"; + + writer_.WriteBits(bits, num_bits); + } + + if (model_->id_fallback_strategy() != + MarkvModel::IdFallbackStrategy::kShortDescriptor) { + return SPV_UNSUPPORTED; + } + + const uint32_t short_descriptor = short_id_descriptors_.GetDescriptor(id); + writer_.WriteBits(short_descriptor, MarkvCodec::kShortDescriptorNumBits); + + if (short_descriptor == 0) { + // Forward declared id. + return SPV_UNSUPPORTED; + } + + mtf = GetMtfShortIdDescriptor(short_descriptor); + } + + // Descriptor has been encoded. Now encode the rank of the id in the + // associated mtf sequence. + return EncodeExistingId(mtf, id); +} + +spv_result_t MarkvEncoder::EncodeExistingId(uint64_t mtf, uint32_t id) { + assert(multi_mtf_.GetSize(mtf) > 0); + if (multi_mtf_.GetSize(mtf) == 1) { + // If the sequence has only one element no need to write rank, the decoder + // would make the same decision. + return SPV_SUCCESS; + } + + uint32_t rank = 0; + if (!multi_mtf_.RankFromValue(mtf, id, &rank)) + return Diag(SPV_ERROR_INTERNAL) << "Id is not in the MTF sequence"; + + return EncodeMtfRankHuffman(rank, mtf, kMtfGenericNonZeroRank); +} + +spv_result_t MarkvEncoder::EncodeRefId(uint32_t id) { + { + // Try to encode using id descriptor mtfs. + const spv_result_t result = EncodeIdWithDescriptor(id); + if (result != SPV_UNSUPPORTED) return result; + // If can't be done continue with other methods. + } + + const bool can_forward_declare = spvOperandCanBeForwardDeclaredFunction( + SpvOp(inst_.opcode))(operand_index_); + uint32_t rank = 0; + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + // Encode using rule-based mtf. + uint64_t mtf = GetRuleBasedMtf(); + + if (mtf != kMtfNone && !can_forward_declare) { + assert(multi_mtf_.HasValue(kMtfAll, id)); + return EncodeExistingId(mtf, id); + } + + if (mtf == kMtfNone) mtf = kMtfAll; + + if (!multi_mtf_.RankFromValue(mtf, id, &rank)) { + // This is the first occurrence of a forward declared id. + multi_mtf_.Insert(kMtfAll, id); + multi_mtf_.Insert(kMtfForwardDeclared, id); + if (mtf != kMtfAll) multi_mtf_.Insert(mtf, id); + rank = 0; + } + + return EncodeMtfRankHuffman(rank, mtf, kMtfAll); + } else { + assert(can_forward_declare); + + if (!multi_mtf_.RankFromValue(kMtfForwardDeclared, id, &rank)) { + // This is the first occurrence of a forward declared id. + multi_mtf_.Insert(kMtfForwardDeclared, id); + rank = 0; + } + + writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); + return SPV_SUCCESS; + } +} + +spv_result_t MarkvEncoder::EncodeTypeId() { + if (inst_.opcode == SpvOpFunctionParameter) { + assert(!remaining_function_parameter_types_.empty()); + assert(inst_.type_id == remaining_function_parameter_types_.front()); + remaining_function_parameter_types_.pop_front(); + return SPV_SUCCESS; + } + + { + // Try to encode using id descriptor mtfs. + const spv_result_t result = EncodeIdWithDescriptor(inst_.type_id); + if (result != SPV_UNSUPPORTED) return result; + // If can't be done continue with other methods. + } + + assert(model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased); + + uint64_t mtf = GetRuleBasedMtf(); + assert(!spvOperandCanBeForwardDeclaredFunction(SpvOp(inst_.opcode))( + operand_index_)); + + if (mtf == kMtfNone) { + mtf = kMtfTypeNonFunction; + // Function types should have been handled by GetRuleBasedMtf. + assert(inst_.opcode != SpvOpFunction); + } + + return EncodeExistingId(mtf, inst_.type_id); +} + +spv_result_t MarkvEncoder::EncodeResultId() { + uint32_t rank = 0; + + const uint64_t num_still_forward_declared = + multi_mtf_.GetSize(kMtfForwardDeclared); + + if (num_still_forward_declared) { + // We write the rank only if kMtfForwardDeclared is not empty. If it is + // empty the decoder knows that there are no forward declared ids to expect. + if (multi_mtf_.RankFromValue(kMtfForwardDeclared, inst_.result_id, &rank)) { + // This is a definition of a forward declared id. We can remove the id + // from kMtfForwardDeclared. + if (!multi_mtf_.Remove(kMtfForwardDeclared, inst_.result_id)) + return Diag(SPV_ERROR_INTERNAL) + << "Failed to remove id from kMtfForwardDeclared"; + writer_.WriteBits(1, 1); + writer_.WriteVariableWidthU32(rank, model_->mtf_rank_chunk_length()); + } else { + rank = 0; + writer_.WriteBits(0, 1); + } + } + + if (model_->id_fallback_strategy() == + MarkvModel::IdFallbackStrategy::kRuleBased) { + if (!rank) { + multi_mtf_.Insert(kMtfAll, inst_.result_id); + } + } + + return SPV_SUCCESS; +} + +spv_result_t MarkvEncoder::EncodeLiteralNumber( + const spv_parsed_operand_t& operand) { + if (operand.number_bit_width <= 32) { + const uint32_t word = inst_.words[operand.offset]; + return EncodeNonIdWord(word); + } else { + assert(operand.number_bit_width <= 64); + const uint64_t word = uint64_t(inst_.words[operand.offset]) | + (uint64_t(inst_.words[operand.offset + 1]) << 32); + if (operand.number_kind == SPV_NUMBER_UNSIGNED_INT) { + writer_.WriteVariableWidthU64(word, model_->u64_chunk_length()); + } else if (operand.number_kind == SPV_NUMBER_SIGNED_INT) { + int64_t val = 0; + std::memcpy(&val, &word, 8); + writer_.WriteVariableWidthS64(val, model_->s64_chunk_length(), + model_->s64_block_exponent()); + } else if (operand.number_kind == SPV_NUMBER_FLOATING) { + writer_.WriteUnencoded(word); + } else { + return Diag(SPV_ERROR_INTERNAL) << "Unsupported bit length"; + } + } + return SPV_SUCCESS; +} + +void MarkvEncoder::AddByteBreak(size_t byte_break_if_less_than) { + const size_t num_bits_to_next_byte = + GetNumBitsToNextByte(writer_.GetNumBits()); + if (num_bits_to_next_byte == 0 || + num_bits_to_next_byte > byte_break_if_less_than) + return; + + if (logger_) { + logger_->AppendWhitespaces(kCommentNumWhitespaces); + logger_->AppendText(""); + } + + writer_.WriteBits(0, num_bits_to_next_byte); +} + +spv_result_t MarkvEncoder::EncodeInstruction( + const spv_parsed_instruction_t& inst) { + SpvOp opcode = SpvOp(inst.opcode); + inst_ = inst; + + LogDisassemblyInstruction(); + + const spv_result_t opcode_encodig_result = + EncodeOpcodeAndNumOperands(opcode, inst.num_operands); + if (opcode_encodig_result < 0) return opcode_encodig_result; + + if (opcode_encodig_result != SPV_SUCCESS) { + // Fallback encoding for opcode and num_operands. + writer_.WriteVariableWidthU32(opcode, model_->opcode_chunk_length()); + + if (!OpcodeHasFixedNumberOfOperands(opcode)) { + // If the opcode has a variable number of operands, encode the number of + // operands with the instruction. + + if (logger_) logger_->AppendWhitespaces(kCommentNumWhitespaces); + + writer_.WriteVariableWidthU16(inst.num_operands, + model_->num_operands_chunk_length()); + } + } + + // Write operands. + const uint32_t num_operands = inst_.num_operands; + for (operand_index_ = 0; operand_index_ < num_operands; ++operand_index_) { + operand_ = inst_.operands[operand_index_]; + + if (logger_) { + logger_->AppendWhitespaces(kCommentNumWhitespaces); + logger_->AppendText("<"); + logger_->AppendText(spvOperandTypeStr(operand_.type)); + logger_->AppendText(">"); + } + + switch (operand_.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: { + const uint32_t id = inst_.words[operand_.offset]; + if (operand_.type == SPV_OPERAND_TYPE_TYPE_ID) { + const spv_result_t result = EncodeTypeId(); + if (result != SPV_SUCCESS) return result; + } else if (operand_.type == SPV_OPERAND_TYPE_RESULT_ID) { + const spv_result_t result = EncodeResultId(); + if (result != SPV_SUCCESS) return result; + } else { + const spv_result_t result = EncodeRefId(id); + if (result != SPV_SUCCESS) return result; + } + + PromoteIfNeeded(id); + break; + } + + case SPV_OPERAND_TYPE_LITERAL_INTEGER: { + const spv_result_t result = + EncodeNonIdWord(inst_.words[operand_.offset]); + if (result != SPV_SUCCESS) return result; + break; + } + + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { + const spv_result_t result = EncodeLiteralNumber(operand_); + if (result != SPV_SUCCESS) return result; + break; + } + + case SPV_OPERAND_TYPE_LITERAL_STRING: { + const char* src = + reinterpret_cast(&inst_.words[operand_.offset]); + + auto* codec = model_->GetLiteralStringHuffmanCodec(opcode); + if (codec) { + uint64_t bits = 0; + size_t num_bits = 0; + const std::string str = src; + if (codec->Encode(str, &bits, &num_bits)) { + writer_.WriteBits(bits, num_bits); + break; + } else { + bool result = + codec->Encode("kMarkvNoneOfTheAbove", &bits, &num_bits); + (void)result; + assert(result); + writer_.WriteBits(bits, num_bits); + } + } + + const size_t length = spv_strnlen_s(src, operand_.num_words * 4); + if (length == operand_.num_words * 4) + return Diag(SPV_ERROR_INVALID_BINARY) + << "Failed to find terminal character of literal string"; + for (size_t i = 0; i < length + 1; ++i) writer_.WriteUnencoded(src[i]); + break; + } + + default: { + for (int i = 0; i < operand_.num_words; ++i) { + const uint32_t word = inst_.words[operand_.offset + i]; + const spv_result_t result = EncodeNonIdWord(word); + if (result != SPV_SUCCESS) return result; + } + break; + } + } + } + + AddByteBreak(MarkvCodec::kByteBreakAfterInstIfLessThanUntilNextByte); + + if (logger_) { + logger_->NewLine(); + logger_->NewLine(); + if (!logger_->DebugInstruction(inst_)) return SPV_REQUESTED_TERMINATION; + } + + ProcessCurInstruction(); + + return SPV_SUCCESS; +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_encoder.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_encoder.h new file mode 100644 index 00000000000..21843123f0d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_encoder.h @@ -0,0 +1,167 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/comp/bit_stream.h" +#include "source/comp/markv.h" +#include "source/comp/markv_codec.h" +#include "source/comp/markv_logger.h" +#include "source/util/make_unique.h" + +#ifndef SOURCE_COMP_MARKV_ENCODER_H_ +#define SOURCE_COMP_MARKV_ENCODER_H_ + +#include + +namespace spvtools { +namespace comp { + +// SPIR-V to MARK-V encoder. Exposes functions EncodeHeader and +// EncodeInstruction which can be used as callback by spvBinaryParse. +// Encoded binary is written to an internally maintained bitstream. +// After the last instruction is encoded, the resulting MARK-V binary can be +// acquired by calling GetMarkvBinary(). +// +// The encoder uses SPIR-V validator to keep internal state, therefore +// SPIR-V binary needs to be able to pass validator checks. +// CreateCommentsLogger() can be used to enable the encoder to write comments +// on how encoding was done, which can later be accessed with GetComments(). +class MarkvEncoder : public MarkvCodec { + public: + // |model| is owned by the caller, must be not null and valid during the + // lifetime of MarkvEncoder. + MarkvEncoder(spv_const_context context, const MarkvCodecOptions& options, + const MarkvModel* model) + : MarkvCodec(context, GetValidatorOptions(options), model), + options_(options) {} + ~MarkvEncoder() override = default; + + // Writes data from SPIR-V header to MARK-V header. + spv_result_t EncodeHeader(spv_endianness_t /* endian */, uint32_t /* magic */, + uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t /* schema */) { + SetIdBound(id_bound); + header_.spirv_version = version; + header_.spirv_generator = generator; + return SPV_SUCCESS; + } + + // Creates an internal logger which writes comments on the encoding process. + void CreateLogger(MarkvLogConsumer log_consumer, + MarkvDebugConsumer debug_consumer) { + logger_ = MakeUnique(log_consumer, debug_consumer); + writer_.SetCallback( + [this](const std::string& str) { logger_->AppendBitSequence(str); }); + } + + // Encodes SPIR-V instruction to MARK-V and writes to bit stream. + // Operation can fail if the instruction fails to pass the validator or if + // the encoder stubmles on something unexpected. + spv_result_t EncodeInstruction(const spv_parsed_instruction_t& inst); + + // Concatenates MARK-V header and the bit stream with encoded instructions + // into a single buffer and returns it as spv_markv_binary. The returned + // value is owned by the caller and needs to be destroyed with + // spvMarkvBinaryDestroy(). + std::vector GetMarkvBinary() { + header_.markv_length_in_bits = + static_cast(sizeof(header_) * 8 + writer_.GetNumBits()); + header_.markv_model = + (model_->model_type() << 16) | model_->model_version(); + + const size_t num_bytes = sizeof(header_) + writer_.GetDataSizeBytes(); + std::vector markv(num_bytes); + + assert(writer_.GetData()); + std::memcpy(markv.data(), &header_, sizeof(header_)); + std::memcpy(markv.data() + sizeof(header_), writer_.GetData(), + writer_.GetDataSizeBytes()); + return markv; + } + + // Optionally adds disassembly to the comments. + // Disassembly should contain all instructions in the module separated by + // \n, and no header. + void SetDisassembly(std::string&& disassembly) { + disassembly_ = MakeUnique(std::move(disassembly)); + } + + // Extracts the next instruction line from the disassembly and logs it. + void LogDisassemblyInstruction() { + if (logger_ && disassembly_) { + std::string line; + std::getline(*disassembly_, line, '\n'); + logger_->AppendTextNewLine(line); + } + } + + private: + // Creates and returns validator options. Returned value owned by the caller. + static spv_validator_options GetValidatorOptions( + const MarkvCodecOptions& options) { + return options.validate_spirv_binary ? spvValidatorOptionsCreate() + : nullptr; + } + + // Writes a single word to bit stream. operand_.type determines if the word is + // encoded and how. + spv_result_t EncodeNonIdWord(uint32_t word); + + // Writes both opcode and num_operands as a single code. + // Returns SPV_UNSUPPORTED iff no suitable codec was found. + spv_result_t EncodeOpcodeAndNumOperands(uint32_t opcode, + uint32_t num_operands); + + // Writes mtf rank to bit stream. |mtf| is used to determine the codec + // scheme. |fallback_method| is used if no codec defined for |mtf|. + spv_result_t EncodeMtfRankHuffman(uint32_t rank, uint64_t mtf, + uint64_t fallback_method); + + // Writes id using coding based on mtf associated with the id descriptor. + // Returns SPV_UNSUPPORTED iff fallback method needs to be used. + spv_result_t EncodeIdWithDescriptor(uint32_t id); + + // Writes id using coding based on the given |mtf|, which is expected to + // contain the given |id|. + spv_result_t EncodeExistingId(uint64_t mtf, uint32_t id); + + // Writes type id of the current instruction if can't be inferred. + spv_result_t EncodeTypeId(); + + // Writes result id of the current instruction if can't be inferred. + spv_result_t EncodeResultId(); + + // Writes ids which are neither type nor result ids. + spv_result_t EncodeRefId(uint32_t id); + + // Writes bits to the stream until the beginning of the next byte if the + // number of bits until the next byte is less than |byte_break_if_less_than|. + void AddByteBreak(size_t byte_break_if_less_than); + + // Encodes a literal number operand and writes it to the bit stream. + spv_result_t EncodeLiteralNumber(const spv_parsed_operand_t& operand); + + MarkvCodecOptions options_; + + // Bit stream where encoded instructions are written. + BitWriterWord64 writer_; + + // If not nullptr, disassembled instruction lines will be written to comments. + // Format: \n separated instruction lines, no header. + std::unique_ptr disassembly_; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_ENCODER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_logger.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_logger.h new file mode 100644 index 00000000000..c07fe97b7ab --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_logger.h @@ -0,0 +1,93 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_COMP_MARKV_LOGGER_H_ +#define SOURCE_COMP_MARKV_LOGGER_H_ + +#include "source/comp/markv.h" + +namespace spvtools { +namespace comp { + +class MarkvLogger { + public: + MarkvLogger(MarkvLogConsumer log_consumer, MarkvDebugConsumer debug_consumer) + : log_consumer_(log_consumer), debug_consumer_(debug_consumer) {} + + void AppendText(const std::string& str) { + Append(str); + use_delimiter_ = false; + } + + void AppendTextNewLine(const std::string& str) { + Append(str); + Append("\n"); + use_delimiter_ = false; + } + + void AppendBitSequence(const std::string& str) { + if (debug_consumer_) instruction_bits_ << str; + if (use_delimiter_) Append("-"); + Append(str); + use_delimiter_ = true; + } + + void AppendWhitespaces(size_t num) { + Append(std::string(num, ' ')); + use_delimiter_ = false; + } + + void NewLine() { + Append("\n"); + use_delimiter_ = false; + } + + bool DebugInstruction(const spv_parsed_instruction_t& inst) { + bool result = true; + if (debug_consumer_) { + result = debug_consumer_( + std::vector(inst.words, inst.words + inst.num_words), + instruction_bits_.str(), instruction_comment_.str()); + instruction_bits_.str(std::string()); + instruction_comment_.str(std::string()); + } + return result; + } + + private: + MarkvLogger(const MarkvLogger&) = delete; + MarkvLogger(MarkvLogger&&) = delete; + MarkvLogger& operator=(const MarkvLogger&) = delete; + MarkvLogger& operator=(MarkvLogger&&) = delete; + + void Append(const std::string& str) { + if (log_consumer_) log_consumer_(str); + if (debug_consumer_) instruction_comment_ << str; + } + + MarkvLogConsumer log_consumer_; + MarkvDebugConsumer debug_consumer_; + + std::stringstream instruction_bits_; + std::stringstream instruction_comment_; + + // If true a delimiter will be appended before the next bit sequence. + // Used to generate outputs like: 1100-0 1110-1-1100-1-1111-0 110-0. + bool use_delimiter_ = false; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_LOGGER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_model.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_model.h new file mode 100644 index 00000000000..d03df02df9d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/markv_model.h @@ -0,0 +1,232 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_COMP_MARKV_MODEL_H_ +#define SOURCE_COMP_MARKV_MODEL_H_ + +#include + +#include "source/comp/huffman_codec.h" +#include "source/latest_version_spirv_header.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace comp { + +// Base class for MARK-V models. +// The class contains encoding/decoding model with various constants and +// codecs used by the compression algorithm. +class MarkvModel { + public: + MarkvModel() + : operand_chunk_lengths_( + static_cast(SPV_OPERAND_TYPE_NUM_OPERAND_TYPES), 0) { + // Set default values. + operand_chunk_lengths_[SPV_OPERAND_TYPE_TYPE_ID] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_RESULT_ID] = 8; + operand_chunk_lengths_[SPV_OPERAND_TYPE_ID] = 8; + operand_chunk_lengths_[SPV_OPERAND_TYPE_SCOPE_ID] = 8; + operand_chunk_lengths_[SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID] = 8; + operand_chunk_lengths_[SPV_OPERAND_TYPE_LITERAL_INTEGER] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_CAPABILITY] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_SOURCE_LANGUAGE] = 3; + operand_chunk_lengths_[SPV_OPERAND_TYPE_EXECUTION_MODEL] = 3; + operand_chunk_lengths_[SPV_OPERAND_TYPE_ADDRESSING_MODEL] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_MEMORY_MODEL] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_EXECUTION_MODE] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_STORAGE_CLASS] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_DIMENSIONALITY] = 3; + operand_chunk_lengths_[SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE] = 3; + operand_chunk_lengths_[SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_FP_ROUNDING_MODE] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_LINKAGE_TYPE] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_ACCESS_QUALIFIER] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE] = 3; + operand_chunk_lengths_[SPV_OPERAND_TYPE_DECORATION] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_BUILT_IN] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_GROUP_OPERATION] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO] = 2; + operand_chunk_lengths_[SPV_OPERAND_TYPE_FP_FAST_MATH_MODE] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_FUNCTION_CONTROL] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_LOOP_CONTROL] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_IMAGE] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_IMAGE] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_SELECTION_CONTROL] = 4; + operand_chunk_lengths_[SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER] = 6; + operand_chunk_lengths_[SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER] = 6; + } + + uint32_t model_type() const { return model_type_; } + uint32_t model_version() const { return model_version_; } + + uint32_t opcode_chunk_length() const { return opcode_chunk_length_; } + uint32_t num_operands_chunk_length() const { + return num_operands_chunk_length_; + } + uint32_t mtf_rank_chunk_length() const { return mtf_rank_chunk_length_; } + + uint32_t u64_chunk_length() const { return u64_chunk_length_; } + uint32_t s64_chunk_length() const { return s64_chunk_length_; } + uint32_t s64_block_exponent() const { return s64_block_exponent_; } + + enum class IdFallbackStrategy { + kRuleBased = 0, + kShortDescriptor, + }; + + IdFallbackStrategy id_fallback_strategy() const { + return id_fallback_strategy_; + } + + // Returns a codec for common opcode_and_num_operands words for the given + // previous opcode. May return nullptr if the codec doesn't exist. + const HuffmanCodec* GetOpcodeAndNumOperandsMarkovHuffmanCodec( + uint32_t prev_opcode) const { + if (prev_opcode == SpvOpNop) + return opcode_and_num_operands_huffman_codec_.get(); + + const auto it = + opcode_and_num_operands_markov_huffman_codecs_.find(prev_opcode); + if (it == opcode_and_num_operands_markov_huffman_codecs_.end()) + return nullptr; + return it->second.get(); + } + + // Returns a codec for common non-id words used for given operand slot. + // Operand slot is defined by the opcode and the operand index. + // May return nullptr if the codec doesn't exist. + const HuffmanCodec* GetNonIdWordHuffmanCodec( + uint32_t opcode, uint32_t operand_index) const { + const auto it = non_id_word_huffman_codecs_.find( + std::pair(opcode, operand_index)); + if (it == non_id_word_huffman_codecs_.end()) return nullptr; + return it->second.get(); + } + + // Returns a codec for common id descriptos used for given operand slot. + // Operand slot is defined by the opcode and the operand index. + // May return nullptr if the codec doesn't exist. + const HuffmanCodec* GetIdDescriptorHuffmanCodec( + uint32_t opcode, uint32_t operand_index) const { + const auto it = id_descriptor_huffman_codecs_.find( + std::pair(opcode, operand_index)); + if (it == id_descriptor_huffman_codecs_.end()) return nullptr; + return it->second.get(); + } + + // Returns a codec for common strings used by the given opcode. + // Operand slot is defined by the opcode and the operand index. + // May return nullptr if the codec doesn't exist. + const HuffmanCodec* GetLiteralStringHuffmanCodec( + uint32_t opcode) const { + const auto it = literal_string_huffman_codecs_.find(opcode); + if (it == literal_string_huffman_codecs_.end()) return nullptr; + return it->second.get(); + } + + // Checks if |descriptor| has a coding scheme in any of + // id_descriptor_huffman_codecs_. + bool DescriptorHasCodingScheme(uint32_t descriptor) const { + return descriptors_with_coding_scheme_.count(descriptor); + } + + // Checks if any descriptor has a coding scheme. + bool AnyDescriptorHasCodingScheme() const { + return !descriptors_with_coding_scheme_.empty(); + } + + // Returns chunk length used for variable length encoding of spirv operand + // words. + uint32_t GetOperandVariableWidthChunkLength(spv_operand_type_t type) const { + return operand_chunk_lengths_.at(static_cast(type)); + } + + // Sets model type. + void SetModelType(uint32_t in_model_type) { model_type_ = in_model_type; } + + // Sets model version. + void SetModelVersion(uint32_t in_model_version) { + model_version_ = in_model_version; + } + + // Returns value used by Huffman codecs as a signal that a value is not in the + // coding table. + static uint64_t GetMarkvNoneOfTheAbove() { + // Magic number. + return 1111111111111111111; + } + + MarkvModel(const MarkvModel&) = delete; + const MarkvModel& operator=(const MarkvModel&) = delete; + + protected: + // Huffman codec for base-rate of opcode_and_num_operands. + std::unique_ptr> + opcode_and_num_operands_huffman_codec_; + + // Huffman codecs for opcode_and_num_operands. The map key is previous opcode. + std::map>> + opcode_and_num_operands_markov_huffman_codecs_; + + // Huffman codecs for non-id single-word operand values. + // The map key is pair . + std::map, + std::unique_ptr>> + non_id_word_huffman_codecs_; + + // Huffman codecs for id descriptors. The map key is pair + // . + std::map, + std::unique_ptr>> + id_descriptor_huffman_codecs_; + + // Set of all descriptors which have a coding scheme in any of + // id_descriptor_huffman_codecs_. + std::unordered_set descriptors_with_coding_scheme_; + + // Huffman codecs for literal strings. The map key is the opcode of the + // current instruction. This assumes, that there is no more than one literal + // string operand per instruction, but would still work even if this is not + // the case. Names and debug information strings are not collected. + std::map>> + literal_string_huffman_codecs_; + + // Chunk lengths used for variable width encoding of operands (index is + // spv_operand_type of the operand). + std::vector operand_chunk_lengths_; + + uint32_t opcode_chunk_length_ = 7; + uint32_t num_operands_chunk_length_ = 3; + uint32_t mtf_rank_chunk_length_ = 5; + + uint32_t u64_chunk_length_ = 8; + uint32_t s64_chunk_length_ = 8; + uint32_t s64_block_exponent_ = 10; + + IdFallbackStrategy id_fallback_strategy_ = + IdFallbackStrategy::kShortDescriptor; + + uint32_t model_type_ = 0; + uint32_t model_version_ = 0; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MARKV_MODEL_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/move_to_front.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/move_to_front.cpp new file mode 100644 index 00000000000..9d35a3f5b61 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/move_to_front.cpp @@ -0,0 +1,456 @@ +// Copyright (c) 2018 Google 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. + +#include "source/comp/move_to_front.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace comp { + +bool MoveToFront::Insert(uint32_t value) { + auto it = value_to_node_.find(value); + if (it != value_to_node_.end() && IsInTree(it->second)) return false; + + const uint32_t old_size = GetSize(); + (void)old_size; + + InsertNode(CreateNode(next_timestamp_++, value)); + + last_accessed_value_ = value; + last_accessed_value_valid_ = true; + + assert(value_to_node_.count(value)); + assert(old_size + 1 == GetSize()); + return true; +} + +bool MoveToFront::Remove(uint32_t value) { + auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) return false; + + if (!IsInTree(it->second)) return false; + + if (last_accessed_value_ == value) last_accessed_value_valid_ = false; + + const uint32_t orphan = RemoveNode(it->second); + (void)orphan; + // The node of |value| is still alive but it's orphaned now. Can still be + // reused later. + assert(!IsInTree(orphan)); + assert(ValueOf(orphan) == value); + return true; +} + +bool MoveToFront::RankFromValue(uint32_t value, uint32_t* rank) { + if (last_accessed_value_valid_ && last_accessed_value_ == value) { + *rank = 1; + return true; + } + + const uint32_t old_size = GetSize(); + if (old_size == 1) { + if (ValueOf(root_) == value) { + *rank = 1; + return true; + } else { + return false; + } + } + + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) { + return false; + } + + uint32_t target = it->second; + + if (!IsInTree(target)) { + return false; + } + + uint32_t node = target; + *rank = 1 + SizeOf(LeftOf(node)); + while (node) { + if (IsRightChild(node)) *rank += 1 + SizeOf(LeftOf(ParentOf(node))); + node = ParentOf(node); + } + + // Don't update timestamp if the node has rank 1. + if (*rank != 1) { + // Update timestamp and reposition the node. + target = RemoveNode(target); + assert(ValueOf(target) == value); + assert(old_size == GetSize() + 1); + MutableTimestampOf(target) = next_timestamp_++; + InsertNode(target); + assert(old_size == GetSize()); + } + + last_accessed_value_ = value; + last_accessed_value_valid_ = true; + return true; +} + +bool MoveToFront::HasValue(uint32_t value) const { + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) { + return false; + } + + return IsInTree(it->second); +} + +bool MoveToFront::Promote(uint32_t value) { + if (last_accessed_value_valid_ && last_accessed_value_ == value) { + return true; + } + + const uint32_t old_size = GetSize(); + if (old_size == 1) return ValueOf(root_) == value; + + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) { + return false; + } + + uint32_t target = it->second; + + if (!IsInTree(target)) { + return false; + } + + // Update timestamp and reposition the node. + target = RemoveNode(target); + assert(ValueOf(target) == value); + assert(old_size == GetSize() + 1); + + MutableTimestampOf(target) = next_timestamp_++; + InsertNode(target); + assert(old_size == GetSize()); + + last_accessed_value_ = value; + last_accessed_value_valid_ = true; + return true; +} + +bool MoveToFront::ValueFromRank(uint32_t rank, uint32_t* value) { + if (last_accessed_value_valid_ && rank == 1) { + *value = last_accessed_value_; + return true; + } + + const uint32_t old_size = GetSize(); + if (rank <= 0 || rank > old_size) { + return false; + } + + if (old_size == 1) { + *value = ValueOf(root_); + return true; + } + + const bool update_timestamp = (rank != 1); + + uint32_t node = root_; + while (node) { + const uint32_t left_subtree_num_nodes = SizeOf(LeftOf(node)); + if (rank == left_subtree_num_nodes + 1) { + // This is the node we are looking for. + // Don't update timestamp if the node has rank 1. + if (update_timestamp) { + node = RemoveNode(node); + assert(old_size == GetSize() + 1); + MutableTimestampOf(node) = next_timestamp_++; + InsertNode(node); + assert(old_size == GetSize()); + } + *value = ValueOf(node); + last_accessed_value_ = *value; + last_accessed_value_valid_ = true; + return true; + } + + if (rank < left_subtree_num_nodes + 1) { + // Descend into the left subtree. The rank is still valid. + node = LeftOf(node); + } else { + // Descend into the right subtree. We leave behind the left subtree and + // the current node, adjust the |rank| accordingly. + rank -= left_subtree_num_nodes + 1; + node = RightOf(node); + } + } + + assert(0); + return false; +} + +uint32_t MoveToFront::CreateNode(uint32_t timestamp, uint32_t value) { + uint32_t handle = static_cast(nodes_.size()); + const auto result = value_to_node_.emplace(value, handle); + if (result.second) { + // Create new node. + nodes_.emplace_back(Node()); + Node& node = nodes_.back(); + node.timestamp = timestamp; + node.value = value; + node.size = 1; + // Non-NIL nodes start with height 1 because their NIL children are + // leaves. + node.height = 1; + } else { + // Reuse old node. + handle = result.first->second; + assert(!IsInTree(handle)); + assert(ValueOf(handle) == value); + assert(SizeOf(handle) == 1); + assert(HeightOf(handle) == 1); + MutableTimestampOf(handle) = timestamp; + } + + return handle; +} + +void MoveToFront::InsertNode(uint32_t node) { + assert(!IsInTree(node)); + assert(SizeOf(node) == 1); + assert(HeightOf(node) == 1); + assert(TimestampOf(node)); + + if (!root_) { + root_ = node; + return; + } + + uint32_t iter = root_; + uint32_t parent = 0; + + // Will determine if |node| will become the right or left child after + // insertion (but before balancing). + bool right_child = true; + + // Find the node which will become |node|'s parent after insertion + // (but before balancing). + while (iter) { + parent = iter; + assert(TimestampOf(iter) != TimestampOf(node)); + right_child = TimestampOf(iter) > TimestampOf(node); + iter = right_child ? RightOf(iter) : LeftOf(iter); + } + + assert(parent); + + // Connect node and parent. + MutableParentOf(node) = parent; + if (right_child) + MutableRightOf(parent) = node; + else + MutableLeftOf(parent) = node; + + // Insertion is finished. Start the balancing process. + bool needs_rebalancing = true; + parent = ParentOf(node); + + while (parent) { + UpdateNode(parent); + + if (needs_rebalancing) { + const int parent_balance = BalanceOf(parent); + + if (RightOf(parent) == node) { + // Added node to the right subtree. + if (parent_balance > 1) { + // Parent is right heavy, rotate left. + if (BalanceOf(node) < 0) RotateRight(node); + parent = RotateLeft(parent); + } else if (parent_balance == 0 || parent_balance == -1) { + // Parent is balanced or left heavy, no need to balance further. + needs_rebalancing = false; + } + } else { + // Added node to the left subtree. + if (parent_balance < -1) { + // Parent is left heavy, rotate right. + if (BalanceOf(node) > 0) RotateLeft(node); + parent = RotateRight(parent); + } else if (parent_balance == 0 || parent_balance == 1) { + // Parent is balanced or right heavy, no need to balance further. + needs_rebalancing = false; + } + } + } + + assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); + + node = parent; + parent = ParentOf(parent); + } +} + +uint32_t MoveToFront::RemoveNode(uint32_t node) { + if (LeftOf(node) && RightOf(node)) { + // If |node| has two children, then use another node as scapegoat and swap + // their contents. We pick the scapegoat on the side of the tree which has + // more nodes. + const uint32_t scapegoat = SizeOf(LeftOf(node)) >= SizeOf(RightOf(node)) + ? RightestDescendantOf(LeftOf(node)) + : LeftestDescendantOf(RightOf(node)); + assert(scapegoat); + std::swap(MutableValueOf(node), MutableValueOf(scapegoat)); + std::swap(MutableTimestampOf(node), MutableTimestampOf(scapegoat)); + value_to_node_[ValueOf(node)] = node; + value_to_node_[ValueOf(scapegoat)] = scapegoat; + node = scapegoat; + } + + // |node| may have only one child at this point. + assert(!RightOf(node) || !LeftOf(node)); + + uint32_t parent = ParentOf(node); + uint32_t child = RightOf(node) ? RightOf(node) : LeftOf(node); + + // Orphan |node| and reconnect parent and child. + if (child) MutableParentOf(child) = parent; + + if (parent) { + if (LeftOf(parent) == node) + MutableLeftOf(parent) = child; + else + MutableRightOf(parent) = child; + } + + MutableParentOf(node) = 0; + MutableLeftOf(node) = 0; + MutableRightOf(node) = 0; + UpdateNode(node); + const uint32_t orphan = node; + + if (root_ == node) root_ = child; + + // Removal is finished. Start the balancing process. + bool needs_rebalancing = true; + node = child; + + while (parent) { + UpdateNode(parent); + + if (needs_rebalancing) { + const int parent_balance = BalanceOf(parent); + + if (parent_balance == 1 || parent_balance == -1) { + // The height of the subtree was not changed. + needs_rebalancing = false; + } else { + if (RightOf(parent) == node) { + // Removed node from the right subtree. + if (parent_balance < -1) { + // Parent is left heavy, rotate right. + const uint32_t sibling = LeftOf(parent); + if (BalanceOf(sibling) > 0) RotateLeft(sibling); + parent = RotateRight(parent); + } + } else { + // Removed node from the left subtree. + if (parent_balance > 1) { + // Parent is right heavy, rotate left. + const uint32_t sibling = RightOf(parent); + if (BalanceOf(sibling) < 0) RotateRight(sibling); + parent = RotateLeft(parent); + } + } + } + } + + assert(BalanceOf(parent) >= -1 && (BalanceOf(parent) <= 1)); + + node = parent; + parent = ParentOf(parent); + } + + return orphan; +} + +uint32_t MoveToFront::RotateLeft(const uint32_t node) { + const uint32_t pivot = RightOf(node); + assert(pivot); + + // LeftOf(pivot) gets attached to node in place of pivot. + MutableRightOf(node) = LeftOf(pivot); + if (RightOf(node)) MutableParentOf(RightOf(node)) = node; + + // Pivot gets attached to ParentOf(node) in place of node. + MutableParentOf(pivot) = ParentOf(node); + if (!ParentOf(node)) + root_ = pivot; + else if (IsLeftChild(node)) + MutableLeftOf(ParentOf(node)) = pivot; + else + MutableRightOf(ParentOf(node)) = pivot; + + // Node is child of pivot. + MutableLeftOf(pivot) = node; + MutableParentOf(node) = pivot; + + // Update both node and pivot. Pivot is the new parent of node, so node should + // be updated first. + UpdateNode(node); + UpdateNode(pivot); + + return pivot; +} + +uint32_t MoveToFront::RotateRight(const uint32_t node) { + const uint32_t pivot = LeftOf(node); + assert(pivot); + + // RightOf(pivot) gets attached to node in place of pivot. + MutableLeftOf(node) = RightOf(pivot); + if (LeftOf(node)) MutableParentOf(LeftOf(node)) = node; + + // Pivot gets attached to ParentOf(node) in place of node. + MutableParentOf(pivot) = ParentOf(node); + if (!ParentOf(node)) + root_ = pivot; + else if (IsLeftChild(node)) + MutableLeftOf(ParentOf(node)) = pivot; + else + MutableRightOf(ParentOf(node)) = pivot; + + // Node is child of pivot. + MutableRightOf(pivot) = node; + MutableParentOf(node) = pivot; + + // Update both node and pivot. Pivot is the new parent of node, so node should + // be updated first. + UpdateNode(node); + UpdateNode(pivot); + + return pivot; +} + +void MoveToFront::UpdateNode(uint32_t node) { + MutableSizeOf(node) = 1 + SizeOf(LeftOf(node)) + SizeOf(RightOf(node)); + MutableHeightOf(node) = + 1 + std::max(HeightOf(LeftOf(node)), HeightOf(RightOf(node))); +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/move_to_front.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/move_to_front.h new file mode 100644 index 00000000000..8752194ece6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/comp/move_to_front.h @@ -0,0 +1,384 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_COMP_MOVE_TO_FRONT_H_ +#define SOURCE_COMP_MOVE_TO_FRONT_H_ + +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace comp { + +// Log(n) move-to-front implementation. Implements the following functions: +// Insert - pushes value to the front of the mtf sequence +// (only unique values allowed). +// Remove - remove value from the sequence. +// ValueFromRank - access value by its 1-indexed rank in the sequence. +// RankFromValue - get the rank of the given value in the sequence. +// Accessing a value with ValueFromRank or RankFromValue moves the value to the +// front of the sequence (rank of 1). +// +// The implementation is based on an AVL-based order statistic tree. The tree +// is ordered by timestamps issued when values are inserted or accessed (recent +// values go to the left side of the tree, old values are gradually rotated to +// the right side). +// +// Terminology +// rank: 1-indexed rank showing how recently the value was inserted or accessed. +// node: handle used internally to access node data. +// size: size of the subtree of a node (including the node). +// height: distance from a node to the farthest leaf. +class MoveToFront { + public: + explicit MoveToFront(size_t reserve_capacity = 4) { + nodes_.reserve(reserve_capacity); + + // Create NIL node. + nodes_.emplace_back(Node()); + } + + virtual ~MoveToFront() = default; + + // Inserts value in the move-to-front sequence. Does nothing if the value is + // already in the sequence. Returns true if insertion was successful. + // The inserted value is placed at the front of the sequence (rank 1). + bool Insert(uint32_t value); + + // Removes value from move-to-front sequence. Returns false iff the value + // was not found. + bool Remove(uint32_t value); + + // Computes 1-indexed rank of value in the move-to-front sequence and moves + // the value to the front. Example: + // Before the call: 4 8 2 1 7 + // RankFromValue(8) returns 2 + // After the call: 8 4 2 1 7 + // Returns true iff the value was found in the sequence. + bool RankFromValue(uint32_t value, uint32_t* rank); + + // Returns value corresponding to a 1-indexed rank in the move-to-front + // sequence and moves the value to the front. Example: + // Before the call: 4 8 2 1 7 + // ValueFromRank(2) returns 8 + // After the call: 8 4 2 1 7 + // Returns true iff the rank is within bounds [1, GetSize()]. + bool ValueFromRank(uint32_t rank, uint32_t* value); + + // Moves the value to the front of the sequence. + // Returns false iff value is not in the sequence. + bool Promote(uint32_t value); + + // Returns true iff the move-to-front sequence contains the value. + bool HasValue(uint32_t value) const; + + // Returns the number of elements in the move-to-front sequence. + uint32_t GetSize() const { return SizeOf(root_); } + + protected: + // Internal tree data structure uses handles instead of pointers. Leaves and + // root parent reference a singleton under handle 0. Although dereferencing + // a null pointer is not possible, inappropriate access to handle 0 would + // cause an assertion. Handles are not garbage collected if value was + // deprecated + // with DeprecateValue(). But handles are recycled when a node is + // repositioned. + + // Internal tree data structure node. + struct Node { + // Timestamp from a logical clock which updates every time the element is + // accessed through ValueFromRank or RankFromValue. + uint32_t timestamp = 0; + // The size of the node's subtree, including the node. + // SizeOf(LeftOf(node)) + SizeOf(RightOf(node)) + 1. + uint32_t size = 0; + // Handles to connected nodes. + uint32_t left = 0; + uint32_t right = 0; + uint32_t parent = 0; + // Distance to the farthest leaf. + // Leaves have height 0, real nodes at least 1. + uint32_t height = 0; + // Stored value. + uint32_t value = 0; + }; + + // Creates node and sets correct values. Non-NIL nodes should be created only + // through this function. If the node with this value has been created + // previously + // and since orphaned, reuses the old node instead of creating a new one. + uint32_t CreateNode(uint32_t timestamp, uint32_t value); + + // Node accessor methods. Naming is designed to be similar to natural + // language as these functions tend to be used in sequences, for example: + // ParentOf(LeftestDescendentOf(RightOf(node))) + + // Returns value of the node referenced by |handle|. + uint32_t ValueOf(uint32_t node) const { return nodes_.at(node).value; } + + // Returns left child of |node|. + uint32_t LeftOf(uint32_t node) const { return nodes_.at(node).left; } + + // Returns right child of |node|. + uint32_t RightOf(uint32_t node) const { return nodes_.at(node).right; } + + // Returns parent of |node|. + uint32_t ParentOf(uint32_t node) const { return nodes_.at(node).parent; } + + // Returns timestamp of |node|. + uint32_t TimestampOf(uint32_t node) const { + assert(node); + return nodes_.at(node).timestamp; + } + + // Returns size of |node|. + uint32_t SizeOf(uint32_t node) const { return nodes_.at(node).size; } + + // Returns height of |node|. + uint32_t HeightOf(uint32_t node) const { return nodes_.at(node).height; } + + // Returns mutable reference to value of |node|. + uint32_t& MutableValueOf(uint32_t node) { + assert(node); + return nodes_.at(node).value; + } + + // Returns mutable reference to handle of left child of |node|. + uint32_t& MutableLeftOf(uint32_t node) { + assert(node); + return nodes_.at(node).left; + } + + // Returns mutable reference to handle of right child of |node|. + uint32_t& MutableRightOf(uint32_t node) { + assert(node); + return nodes_.at(node).right; + } + + // Returns mutable reference to handle of parent of |node|. + uint32_t& MutableParentOf(uint32_t node) { + assert(node); + return nodes_.at(node).parent; + } + + // Returns mutable reference to timestamp of |node|. + uint32_t& MutableTimestampOf(uint32_t node) { + assert(node); + return nodes_.at(node).timestamp; + } + + // Returns mutable reference to size of |node|. + uint32_t& MutableSizeOf(uint32_t node) { + assert(node); + return nodes_.at(node).size; + } + + // Returns mutable reference to height of |node|. + uint32_t& MutableHeightOf(uint32_t node) { + assert(node); + return nodes_.at(node).height; + } + + // Returns true iff |node| is left child of its parent. + bool IsLeftChild(uint32_t node) const { + assert(node); + return LeftOf(ParentOf(node)) == node; + } + + // Returns true iff |node| is right child of its parent. + bool IsRightChild(uint32_t node) const { + assert(node); + return RightOf(ParentOf(node)) == node; + } + + // Returns true iff |node| has no relatives. + bool IsOrphan(uint32_t node) const { + assert(node); + return !ParentOf(node) && !LeftOf(node) && !RightOf(node); + } + + // Returns true iff |node| is in the tree. + bool IsInTree(uint32_t node) const { + assert(node); + return node == root_ || !IsOrphan(node); + } + + // Returns the height difference between right and left subtrees. + int BalanceOf(uint32_t node) const { + return int(HeightOf(RightOf(node))) - int(HeightOf(LeftOf(node))); + } + + // Updates size and height of the node, assuming that the children have + // correct values. + void UpdateNode(uint32_t node); + + // Returns the most LeftOf(LeftOf(... descendent which is not leaf. + uint32_t LeftestDescendantOf(uint32_t node) const { + uint32_t parent = 0; + while (node) { + parent = node; + node = LeftOf(node); + } + return parent; + } + + // Returns the most RightOf(RightOf(... descendent which is not leaf. + uint32_t RightestDescendantOf(uint32_t node) const { + uint32_t parent = 0; + while (node) { + parent = node; + node = RightOf(node); + } + return parent; + } + + // Inserts node in the tree. The node must be an orphan. + void InsertNode(uint32_t node); + + // Removes node from the tree. May change value_to_node_ if removal uses a + // scapegoat. Returns the removed (orphaned) handle for recycling. The + // returned handle may not be equal to |node| if scapegoat was used. + uint32_t RemoveNode(uint32_t node); + + // Rotates |node| left, reassigns all connections and returns the node + // which takes place of the |node|. + uint32_t RotateLeft(const uint32_t node); + + // Rotates |node| right, reassigns all connections and returns the node + // which takes place of the |node|. + uint32_t RotateRight(const uint32_t node); + + // Root node handle. The tree is empty if root_ is 0. + uint32_t root_ = 0; + + // Incremented counters for next timestamp and value. + uint32_t next_timestamp_ = 1; + + // Holds all tree nodes. Indices of this vector are node handles. + std::vector nodes_; + + // Maps ids to node handles. + std::unordered_map value_to_node_; + + // Cache for the last accessed value in the sequence. + uint32_t last_accessed_value_ = 0; + bool last_accessed_value_valid_ = false; +}; + +class MultiMoveToFront { + public: + // Inserts |value| to sequence with handle |mtf|. + // Returns false if |mtf| already has |value|. + bool Insert(uint64_t mtf, uint32_t value) { + if (GetMtf(mtf).Insert(value)) { + val_to_mtfs_[value].insert(mtf); + return true; + } + return false; + } + + // Removes |value| from sequence with handle |mtf|. + // Returns false if |mtf| doesn't have |value|. + bool Remove(uint64_t mtf, uint32_t value) { + if (GetMtf(mtf).Remove(value)) { + val_to_mtfs_[value].erase(mtf); + return true; + } + assert(val_to_mtfs_[value].count(mtf) == 0); + return false; + } + + // Removes |value| from all sequences which have it. + void RemoveFromAll(uint32_t value) { + auto it = val_to_mtfs_.find(value); + if (it == val_to_mtfs_.end()) return; + + auto& mtfs_containing_value = it->second; + for (uint64_t mtf : mtfs_containing_value) { + GetMtf(mtf).Remove(value); + } + + val_to_mtfs_.erase(value); + } + + // Computes rank of |value| in sequence |mtf|. + // Returns false if |mtf| doesn't have |value|. + bool RankFromValue(uint64_t mtf, uint32_t value, uint32_t* rank) { + return GetMtf(mtf).RankFromValue(value, rank); + } + + // Finds |value| with |rank| in sequence |mtf|. + // Returns false if |rank| is out of bounds. + bool ValueFromRank(uint64_t mtf, uint32_t rank, uint32_t* value) { + return GetMtf(mtf).ValueFromRank(rank, value); + } + + // Returns size of |mtf| sequence. + uint32_t GetSize(uint64_t mtf) { return GetMtf(mtf).GetSize(); } + + // Promotes |value| in all sequences which have it. + void Promote(uint32_t value) { + const auto it = val_to_mtfs_.find(value); + if (it == val_to_mtfs_.end()) return; + + const auto& mtfs_containing_value = it->second; + for (uint64_t mtf : mtfs_containing_value) { + GetMtf(mtf).Promote(value); + } + } + + // Inserts |value| in sequence |mtf| or promotes if it's already there. + void InsertOrPromote(uint64_t mtf, uint32_t value) { + if (!Insert(mtf, value)) { + GetMtf(mtf).Promote(value); + } + } + + // Returns if |mtf| sequence has |value|. + bool HasValue(uint64_t mtf, uint32_t value) { + return GetMtf(mtf).HasValue(value); + } + + private: + // Returns actual MoveToFront object corresponding to |handle|. + // As multiple operations are often performed consecutively for the same + // sequence, the last returned value is cached. + MoveToFront& GetMtf(uint64_t handle) { + if (!cached_mtf_ || cached_handle_ != handle) { + cached_handle_ = handle; + cached_mtf_ = &mtfs_[handle]; + } + + return *cached_mtf_; + } + + // Container holding MoveToFront objects. Map key is sequence handle. + std::map mtfs_; + + // Container mapping value to sequences which contain that value. + std::unordered_map> val_to_mtfs_; + + // Cache for the last accessed sequence. + uint64_t cached_handle_ = 0; + MoveToFront* cached_mtf_ = nullptr; +}; + +} // namespace comp +} // namespace spvtools + +#endif // SOURCE_COMP_MOVE_TO_FRONT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/diagnostic.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/diagnostic.cpp new file mode 100644 index 00000000000..edc27c8fd91 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/diagnostic.cpp @@ -0,0 +1,193 @@ +// Copyright (c) 2015-2016 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. + +#include "source/diagnostic.h" + +#include +#include +#include +#include +#include + +#include "source/table.h" + +// Diagnostic API + +spv_diagnostic spvDiagnosticCreate(const spv_position position, + const char* message) { + spv_diagnostic diagnostic = new spv_diagnostic_t; + if (!diagnostic) return nullptr; + size_t length = strlen(message) + 1; + diagnostic->error = new char[length]; + if (!diagnostic->error) { + delete diagnostic; + return nullptr; + } + diagnostic->position = *position; + diagnostic->isTextSource = false; + memset(diagnostic->error, 0, length); + strncpy(diagnostic->error, message, length); + return diagnostic; +} + +void spvDiagnosticDestroy(spv_diagnostic diagnostic) { + if (!diagnostic) return; + delete[] diagnostic->error; + delete diagnostic; +} + +spv_result_t spvDiagnosticPrint(const spv_diagnostic diagnostic) { + if (!diagnostic) return SPV_ERROR_INVALID_DIAGNOSTIC; + + if (diagnostic->isTextSource) { + // NOTE: This is a text position + // NOTE: add 1 to the line as editors start at line 1, we are counting new + // line characters to start at line 0 + std::cerr << "error: " << diagnostic->position.line + 1 << ": " + << diagnostic->position.column + 1 << ": " << diagnostic->error + << "\n"; + return SPV_SUCCESS; + } + + // NOTE: Assume this is a binary position + std::cerr << "error: "; + if (diagnostic->position.index > 0) + std::cerr << diagnostic->position.index << ": "; + std::cerr << diagnostic->error << "\n"; + return SPV_SUCCESS; +} + +namespace spvtools { + +DiagnosticStream::DiagnosticStream(DiagnosticStream&& other) + : stream_(), + position_(other.position_), + consumer_(other.consumer_), + disassembled_instruction_(std::move(other.disassembled_instruction_)), + error_(other.error_) { + // Prevent the other object from emitting output during destruction. + other.error_ = SPV_FAILED_MATCH; + // Some platforms are missing support for std::ostringstream functionality, + // including: move constructor, swap method. Either would have been a + // better choice than copying the string. + stream_ << other.stream_.str(); +} + +DiagnosticStream::~DiagnosticStream() { + if (error_ != SPV_FAILED_MATCH && consumer_ != nullptr) { + auto level = SPV_MSG_ERROR; + switch (error_) { + case SPV_SUCCESS: + case SPV_REQUESTED_TERMINATION: // Essentially success. + level = SPV_MSG_INFO; + break; + case SPV_WARNING: + level = SPV_MSG_WARNING; + break; + case SPV_UNSUPPORTED: + case SPV_ERROR_INTERNAL: + case SPV_ERROR_INVALID_TABLE: + level = SPV_MSG_INTERNAL_ERROR; + break; + case SPV_ERROR_OUT_OF_MEMORY: + level = SPV_MSG_FATAL; + break; + default: + break; + } + if (disassembled_instruction_.size() > 0) + stream_ << std::endl << " " << disassembled_instruction_ << std::endl; + + consumer_(level, "input", position_, stream_.str().c_str()); + } +} + +void UseDiagnosticAsMessageConsumer(spv_context context, + spv_diagnostic* diagnostic) { + assert(diagnostic && *diagnostic == nullptr); + + auto create_diagnostic = [diagnostic](spv_message_level_t, const char*, + const spv_position_t& position, + const char* message) { + auto p = position; + spvDiagnosticDestroy(*diagnostic); // Avoid memory leak. + *diagnostic = spvDiagnosticCreate(&p, message); + }; + SetContextMessageConsumer(context, std::move(create_diagnostic)); +} + +std::string spvResultToString(spv_result_t res) { + std::string out; + switch (res) { + case SPV_SUCCESS: + out = "SPV_SUCCESS"; + break; + case SPV_UNSUPPORTED: + out = "SPV_UNSUPPORTED"; + break; + case SPV_END_OF_STREAM: + out = "SPV_END_OF_STREAM"; + break; + case SPV_WARNING: + out = "SPV_WARNING"; + break; + case SPV_FAILED_MATCH: + out = "SPV_FAILED_MATCH"; + break; + case SPV_REQUESTED_TERMINATION: + out = "SPV_REQUESTED_TERMINATION"; + break; + case SPV_ERROR_INTERNAL: + out = "SPV_ERROR_INTERNAL"; + break; + case SPV_ERROR_OUT_OF_MEMORY: + out = "SPV_ERROR_OUT_OF_MEMORY"; + break; + case SPV_ERROR_INVALID_POINTER: + out = "SPV_ERROR_INVALID_POINTER"; + break; + case SPV_ERROR_INVALID_BINARY: + out = "SPV_ERROR_INVALID_BINARY"; + break; + case SPV_ERROR_INVALID_TEXT: + out = "SPV_ERROR_INVALID_TEXT"; + break; + case SPV_ERROR_INVALID_TABLE: + out = "SPV_ERROR_INVALID_TABLE"; + break; + case SPV_ERROR_INVALID_VALUE: + out = "SPV_ERROR_INVALID_VALUE"; + break; + case SPV_ERROR_INVALID_DIAGNOSTIC: + out = "SPV_ERROR_INVALID_DIAGNOSTIC"; + break; + case SPV_ERROR_INVALID_LOOKUP: + out = "SPV_ERROR_INVALID_LOOKUP"; + break; + case SPV_ERROR_INVALID_ID: + out = "SPV_ERROR_INVALID_ID"; + break; + case SPV_ERROR_INVALID_CFG: + out = "SPV_ERROR_INVALID_CFG"; + break; + case SPV_ERROR_INVALID_LAYOUT: + out = "SPV_ERROR_INVALID_LAYOUT"; + break; + default: + out = "Unknown Error"; + } + return out; +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/diagnostic.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/diagnostic.h new file mode 100644 index 00000000000..22df961432f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/diagnostic.h @@ -0,0 +1,79 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_DIAGNOSTIC_H_ +#define SOURCE_DIAGNOSTIC_H_ + +#include +#include + +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { + +// A DiagnosticStream remembers the current position of the input and an error +// code, and captures diagnostic messages via the left-shift operator. +// If the error code is not SPV_FAILED_MATCH, then captured messages are +// emitted during the destructor. +class DiagnosticStream { + public: + DiagnosticStream(spv_position_t position, const MessageConsumer& consumer, + const std::string& disassembled_instruction, + spv_result_t error) + : position_(position), + consumer_(consumer), + disassembled_instruction_(disassembled_instruction), + error_(error) {} + + // Creates a DiagnosticStream from an expiring DiagnosticStream. + // The new object takes the contents of the other, and prevents the + // other from emitting anything during destruction. + DiagnosticStream(DiagnosticStream&& other); + + // Destroys a DiagnosticStream. + // If its status code is something other than SPV_FAILED_MATCH + // then emit the accumulated message to the consumer. + ~DiagnosticStream(); + + // Adds the given value to the diagnostic message to be written. + template + DiagnosticStream& operator<<(const T& val) { + stream_ << val; + return *this; + } + + // Conversion operator to spv_result, returning the error code. + operator spv_result_t() { return error_; } + + private: + std::ostringstream stream_; + spv_position_t position_; + MessageConsumer consumer_; // Message consumer callback. + std::string disassembled_instruction_; + spv_result_t error_; +}; + +// Changes the MessageConsumer in |context| to one that updates |diagnostic| +// with the last message received. +// +// This function expects that |diagnostic| is not nullptr and its content is a +// nullptr. +void UseDiagnosticAsMessageConsumer(spv_context context, + spv_diagnostic* diagnostic); + +std::string spvResultToString(spv_result_t res); + +} // namespace spvtools + +#endif // SOURCE_DIAGNOSTIC_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/disassemble.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/disassemble.cpp new file mode 100644 index 00000000000..c116f50722c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/disassemble.cpp @@ -0,0 +1,478 @@ +// Copyright (c) 2015-2016 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. + +// This file contains a disassembler: It converts a SPIR-V binary +// to text. + +#include +#include +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/disassemble.h" +#include "source/ext_inst.h" +#include "source/name_mapper.h" +#include "source/opcode.h" +#include "source/parsed_operand.h" +#include "source/print.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" +#include "source/util/hex_float.h" +#include "source/util/make_unique.h" +#include "spirv-tools/libspirv.h" + +namespace { + +// A Disassembler instance converts a SPIR-V binary to its assembly +// representation. +class Disassembler { + public: + Disassembler(const spvtools::AssemblyGrammar& grammar, uint32_t options, + spvtools::NameMapper name_mapper) + : grammar_(grammar), + print_(spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_PRINT, options)), + color_(spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_COLOR, options)), + indent_(spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_INDENT, options) + ? kStandardIndent + : 0), + text_(), + out_(print_ ? out_stream() : out_stream(text_)), + stream_(out_.get()), + header_(!spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER, options)), + show_byte_offset_(spvIsInBitfield( + SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET, options)), + byte_offset_(0), + name_mapper_(std::move(name_mapper)) {} + + // Emits the assembly header for the module, and sets up internal state + // so subsequent callbacks can handle the cases where the entire module + // is either big-endian or little-endian. + spv_result_t HandleHeader(spv_endianness_t endian, uint32_t version, + uint32_t generator, uint32_t id_bound, + uint32_t schema); + // Emits the assembly text for the given instruction. + spv_result_t HandleInstruction(const spv_parsed_instruction_t& inst); + + // If not printing, populates text_result with the accumulated text. + // Returns SPV_SUCCESS on success. + spv_result_t SaveTextResult(spv_text* text_result) const; + + private: + enum { kStandardIndent = 15 }; + + using out_stream = spvtools::out_stream; + + // Emits an operand for the given instruction, where the instruction + // is at offset words from the start of the binary. + void EmitOperand(const spv_parsed_instruction_t& inst, + const uint16_t operand_index); + + // Emits a mask expression for the given mask word of the specified type. + void EmitMaskOperand(const spv_operand_type_t type, const uint32_t word); + + // Resets the output color, if color is turned on. + void ResetColor() { + if (color_) out_.get() << spvtools::clr::reset{print_}; + } + // Sets the output to grey, if color is turned on. + void SetGrey() { + if (color_) out_.get() << spvtools::clr::grey{print_}; + } + // Sets the output to blue, if color is turned on. + void SetBlue() { + if (color_) out_.get() << spvtools::clr::blue{print_}; + } + // Sets the output to yellow, if color is turned on. + void SetYellow() { + if (color_) out_.get() << spvtools::clr::yellow{print_}; + } + // Sets the output to red, if color is turned on. + void SetRed() { + if (color_) out_.get() << spvtools::clr::red{print_}; + } + // Sets the output to green, if color is turned on. + void SetGreen() { + if (color_) out_.get() << spvtools::clr::green{print_}; + } + + const spvtools::AssemblyGrammar& grammar_; + const bool print_; // Should we also print to the standard output stream? + const bool color_; // Should we print in colour? + const int indent_; // How much to indent. 0 means don't indent + spv_endianness_t endian_; // The detected endianness of the binary. + std::stringstream text_; // Captures the text, if not printing. + out_stream out_; // The Output stream. Either to text_ or standard output. + std::ostream& stream_; // The output std::stream. + const bool header_; // Should we output header as the leading comment? + const bool show_byte_offset_; // Should we print byte offset, in hex? + size_t byte_offset_; // The number of bytes processed so far. + spvtools::NameMapper name_mapper_; +}; + +spv_result_t Disassembler::HandleHeader(spv_endianness_t endian, + uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t schema) { + endian_ = endian; + + if (header_) { + SetGrey(); + const char* generator_tool = + spvGeneratorStr(SPV_GENERATOR_TOOL_PART(generator)); + stream_ << "; SPIR-V\n" + << "; Version: " << SPV_SPIRV_VERSION_MAJOR_PART(version) << "." + << SPV_SPIRV_VERSION_MINOR_PART(version) << "\n" + << "; Generator: " << generator_tool; + // For unknown tools, print the numeric tool value. + if (0 == strcmp("Unknown", generator_tool)) { + stream_ << "(" << SPV_GENERATOR_TOOL_PART(generator) << ")"; + } + // Print the miscellaneous part of the generator word on the same + // line as the tool name. + stream_ << "; " << SPV_GENERATOR_MISC_PART(generator) << "\n" + << "; Bound: " << id_bound << "\n" + << "; Schema: " << schema << "\n"; + ResetColor(); + } + + byte_offset_ = SPV_INDEX_INSTRUCTION * sizeof(uint32_t); + + return SPV_SUCCESS; +} + +spv_result_t Disassembler::HandleInstruction( + const spv_parsed_instruction_t& inst) { + if (inst.result_id) { + SetBlue(); + const std::string id_name = name_mapper_(inst.result_id); + if (indent_) + stream_ << std::setw(std::max(0, indent_ - 3 - int(id_name.size()))); + stream_ << "%" << id_name; + ResetColor(); + stream_ << " = "; + } else { + stream_ << std::string(indent_, ' '); + } + + stream_ << "Op" << spvOpcodeString(static_cast(inst.opcode)); + + for (uint16_t i = 0; i < inst.num_operands; i++) { + const spv_operand_type_t type = inst.operands[i].type; + assert(type != SPV_OPERAND_TYPE_NONE); + if (type == SPV_OPERAND_TYPE_RESULT_ID) continue; + stream_ << " "; + EmitOperand(inst, i); + } + + if (show_byte_offset_) { + SetGrey(); + auto saved_flags = stream_.flags(); + auto saved_fill = stream_.fill(); + stream_ << " ; 0x" << std::setw(8) << std::hex << std::setfill('0') + << byte_offset_; + stream_.flags(saved_flags); + stream_.fill(saved_fill); + ResetColor(); + } + + byte_offset_ += inst.num_words * sizeof(uint32_t); + + stream_ << "\n"; + return SPV_SUCCESS; +} + +void Disassembler::EmitOperand(const spv_parsed_instruction_t& inst, + const uint16_t operand_index) { + assert(operand_index < inst.num_operands); + const spv_parsed_operand_t& operand = inst.operands[operand_index]; + const uint32_t word = inst.words[operand.offset]; + switch (operand.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + assert(false && " is not supposed to be handled here"); + SetBlue(); + stream_ << "%" << name_mapper_(word); + break; + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + SetYellow(); + stream_ << "%" << name_mapper_(word); + break; + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { + spv_ext_inst_desc ext_inst; + if (grammar_.lookupExtInst(inst.ext_inst_type, word, &ext_inst)) + assert(false && "should have caught this earlier"); + SetRed(); + stream_ << ext_inst->name; + } break; + case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: { + spv_opcode_desc opcode_desc; + if (grammar_.lookupOpcode(SpvOp(word), &opcode_desc)) + assert(false && "should have caught this earlier"); + SetRed(); + stream_ << opcode_desc->name; + } break; + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { + SetRed(); + spvtools::EmitNumericLiteral(&stream_, inst, operand); + ResetColor(); + } break; + case SPV_OPERAND_TYPE_LITERAL_STRING: { + stream_ << "\""; + SetGreen(); + // Strings are always little-endian, and null-terminated. + // Write out the characters, escaping as needed, and without copying + // the entire string. + auto c_str = reinterpret_cast(inst.words + operand.offset); + for (auto p = c_str; *p; ++p) { + if (*p == '"' || *p == '\\') stream_ << '\\'; + stream_ << *p; + } + ResetColor(); + stream_ << '"'; + } break; + case SPV_OPERAND_TYPE_CAPABILITY: + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: + case SPV_OPERAND_TYPE_EXECUTION_MODEL: + case SPV_OPERAND_TYPE_ADDRESSING_MODEL: + case SPV_OPERAND_TYPE_MEMORY_MODEL: + case SPV_OPERAND_TYPE_EXECUTION_MODE: + case SPV_OPERAND_TYPE_STORAGE_CLASS: + case SPV_OPERAND_TYPE_DIMENSIONALITY: + case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: + case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: + case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: + case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: + case SPV_OPERAND_TYPE_LINKAGE_TYPE: + case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: + case SPV_OPERAND_TYPE_DECORATION: + case SPV_OPERAND_TYPE_BUILT_IN: + case SPV_OPERAND_TYPE_GROUP_OPERATION: + case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: + case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: + case SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING: + case SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE: + case SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER: + case SPV_OPERAND_TYPE_DEBUG_OPERATION: { + spv_operand_desc entry; + if (grammar_.lookupOperand(operand.type, word, &entry)) + assert(false && "should have caught this earlier"); + stream_ << entry->name; + } break; + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + case SPV_OPERAND_TYPE_LOOP_CONTROL: + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_SELECTION_CONTROL: + case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: + EmitMaskOperand(operand.type, word); + break; + default: + assert(false && "unhandled or invalid case"); + } + ResetColor(); +} + +void Disassembler::EmitMaskOperand(const spv_operand_type_t type, + const uint32_t word) { + // Scan the mask from least significant bit to most significant bit. For each + // set bit, emit the name of that bit. Separate multiple names with '|'. + uint32_t remaining_word = word; + uint32_t mask; + int num_emitted = 0; + for (mask = 1; remaining_word; mask <<= 1) { + if (remaining_word & mask) { + remaining_word ^= mask; + spv_operand_desc entry; + if (grammar_.lookupOperand(type, mask, &entry)) + assert(false && "should have caught this earlier"); + if (num_emitted) stream_ << "|"; + stream_ << entry->name; + num_emitted++; + } + } + if (!num_emitted) { + // An operand value of 0 was provided, so represent it by the name + // of the 0 value. In many cases, that's "None". + spv_operand_desc entry; + if (SPV_SUCCESS == grammar_.lookupOperand(type, 0, &entry)) + stream_ << entry->name; + } +} + +spv_result_t Disassembler::SaveTextResult(spv_text* text_result) const { + if (!print_) { + size_t length = text_.str().size(); + char* str = new char[length + 1]; + if (!str) return SPV_ERROR_OUT_OF_MEMORY; + strncpy(str, text_.str().c_str(), length + 1); + spv_text text = new spv_text_t(); + if (!text) { + delete[] str; + return SPV_ERROR_OUT_OF_MEMORY; + } + text->str = str; + text->length = length; + *text_result = text; + } + return SPV_SUCCESS; +} + +spv_result_t DisassembleHeader(void* user_data, spv_endianness_t endian, + uint32_t /* magic */, uint32_t version, + uint32_t generator, uint32_t id_bound, + uint32_t schema) { + assert(user_data); + auto disassembler = static_cast(user_data); + return disassembler->HandleHeader(endian, version, generator, id_bound, + schema); +} + +spv_result_t DisassembleInstruction( + void* user_data, const spv_parsed_instruction_t* parsed_instruction) { + assert(user_data); + auto disassembler = static_cast(user_data); + return disassembler->HandleInstruction(*parsed_instruction); +} + +// Simple wrapper class to provide extra data necessary for targeted +// instruction disassembly. +class WrappedDisassembler { + public: + WrappedDisassembler(Disassembler* dis, const uint32_t* binary, size_t wc) + : disassembler_(dis), inst_binary_(binary), word_count_(wc) {} + + Disassembler* disassembler() { return disassembler_; } + const uint32_t* inst_binary() const { return inst_binary_; } + size_t word_count() const { return word_count_; } + + private: + Disassembler* disassembler_; + const uint32_t* inst_binary_; + const size_t word_count_; +}; + +spv_result_t DisassembleTargetHeader(void* user_data, spv_endianness_t endian, + uint32_t /* magic */, uint32_t version, + uint32_t generator, uint32_t id_bound, + uint32_t schema) { + assert(user_data); + auto wrapped = static_cast(user_data); + return wrapped->disassembler()->HandleHeader(endian, version, generator, + id_bound, schema); +} + +spv_result_t DisassembleTargetInstruction( + void* user_data, const spv_parsed_instruction_t* parsed_instruction) { + assert(user_data); + auto wrapped = static_cast(user_data); + // Check if this is the instruction we want to disassemble. + if (wrapped->word_count() == parsed_instruction->num_words && + std::equal(wrapped->inst_binary(), + wrapped->inst_binary() + wrapped->word_count(), + parsed_instruction->words)) { + // Found the target instruction. Disassemble it and signal that we should + // stop searching so we don't output the same instruction again. + if (auto error = + wrapped->disassembler()->HandleInstruction(*parsed_instruction)) + return error; + return SPV_REQUESTED_TERMINATION; + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t spvBinaryToText(const spv_const_context context, + const uint32_t* code, const size_t wordCount, + const uint32_t options, spv_text* pText, + spv_diagnostic* pDiagnostic) { + spv_context_t hijack_context = *context; + if (pDiagnostic) { + *pDiagnostic = nullptr; + spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, pDiagnostic); + } + + const spvtools::AssemblyGrammar grammar(&hijack_context); + if (!grammar.isValid()) return SPV_ERROR_INVALID_TABLE; + + // Generate friendly names for Ids if requested. + std::unique_ptr friendly_mapper; + spvtools::NameMapper name_mapper = spvtools::GetTrivialNameMapper(); + if (options & SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) { + friendly_mapper = spvtools::MakeUnique( + &hijack_context, code, wordCount); + name_mapper = friendly_mapper->GetNameMapper(); + } + + // Now disassemble! + Disassembler disassembler(grammar, options, name_mapper); + if (auto error = spvBinaryParse(&hijack_context, &disassembler, code, + wordCount, DisassembleHeader, + DisassembleInstruction, pDiagnostic)) { + return error; + } + + return disassembler.SaveTextResult(pText); +} + +std::string spvtools::spvInstructionBinaryToText(const spv_target_env env, + const uint32_t* instCode, + const size_t instWordCount, + const uint32_t* code, + const size_t wordCount, + const uint32_t options) { + spv_context context = spvContextCreate(env); + const spvtools::AssemblyGrammar grammar(context); + if (!grammar.isValid()) { + spvContextDestroy(context); + return ""; + } + + // Generate friendly names for Ids if requested. + std::unique_ptr friendly_mapper; + spvtools::NameMapper name_mapper = spvtools::GetTrivialNameMapper(); + if (options & SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) { + friendly_mapper = spvtools::MakeUnique( + context, code, wordCount); + name_mapper = friendly_mapper->GetNameMapper(); + } + + // Now disassemble! + Disassembler disassembler(grammar, options, name_mapper); + WrappedDisassembler wrapped(&disassembler, instCode, instWordCount); + spvBinaryParse(context, &wrapped, code, wordCount, DisassembleTargetHeader, + DisassembleTargetInstruction, nullptr); + + spv_text text = nullptr; + std::string output; + if (disassembler.SaveTextResult(&text) == SPV_SUCCESS) { + output.assign(text->str, text->str + text->length); + // Drop trailing newline characters. + while (!output.empty() && output.back() == '\n') output.pop_back(); + } + spvTextDestroy(text); + spvContextDestroy(context); + + return output; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/disassemble.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/disassemble.h new file mode 100644 index 00000000000..ac3574272a9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/disassemble.h @@ -0,0 +1,38 @@ +// Copyright (c) 2018 Google 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. + +#ifndef SOURCE_DISASSEMBLE_H_ +#define SOURCE_DISASSEMBLE_H_ + +#include + +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// Decodes the given SPIR-V instruction binary representation to its assembly +// text. The context is inferred from the provided module binary. The options +// parameter is a bit field of spv_binary_to_text_options_t. Decoded text will +// be stored into *text. Any error will be written into *diagnostic if +// diagnostic is non-null. +std::string spvInstructionBinaryToText(const spv_target_env env, + const uint32_t* inst_binary, + const size_t inst_word_count, + const uint32_t* binary, + const size_t word_count, + const uint32_t options); + +} // namespace spvtools + +#endif // SOURCE_DISASSEMBLE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_set.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_set.h new file mode 100644 index 00000000000..e4ef297cd77 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_set.h @@ -0,0 +1,173 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_ENUM_SET_H_ +#define SOURCE_ENUM_SET_H_ + +#include +#include +#include +#include +#include + +#include "source/latest_version_spirv_header.h" +#include "source/util/make_unique.h" + +namespace spvtools { + +// A set of values of a 32-bit enum type. +// It is fast and compact for the common case, where enum values +// are at most 63. But it can represent enums with larger values, +// as may appear in extensions. +template +class EnumSet { + private: + // The ForEach method will call the functor on enum values in + // enum value order (lowest to highest). To make that easier, use + // an ordered set for the overflow values. + using OverflowSetType = std::set; + + public: + // Construct an empty set. + EnumSet() {} + // Construct an set with just the given enum value. + explicit EnumSet(EnumType c) { Add(c); } + // Construct an set from an initializer list of enum values. + EnumSet(std::initializer_list cs) { + for (auto c : cs) Add(c); + } + EnumSet(uint32_t count, const EnumType* ptr) { + for (uint32_t i = 0; i < count; ++i) Add(ptr[i]); + } + // Copy constructor. + EnumSet(const EnumSet& other) { *this = other; } + // Move constructor. The moved-from set is emptied. + EnumSet(EnumSet&& other) { + mask_ = other.mask_; + overflow_ = std::move(other.overflow_); + other.mask_ = 0; + other.overflow_.reset(nullptr); + } + // Assignment operator. + EnumSet& operator=(const EnumSet& other) { + if (&other != this) { + mask_ = other.mask_; + overflow_.reset(other.overflow_ ? new OverflowSetType(*other.overflow_) + : nullptr); + } + return *this; + } + + // Adds the given enum value to the set. This has no effect if the + // enum value is already in the set. + void Add(EnumType c) { AddWord(ToWord(c)); } + + // Returns true if this enum value is in the set. + bool Contains(EnumType c) const { return ContainsWord(ToWord(c)); } + + // Applies f to each enum in the set, in order from smallest enum + // value to largest. + void ForEach(std::function f) const { + for (uint32_t i = 0; i < 64; ++i) { + if (mask_ & AsMask(i)) f(static_cast(i)); + } + if (overflow_) { + for (uint32_t c : *overflow_) f(static_cast(c)); + } + } + + // Returns true if the set is empty. + bool IsEmpty() const { + if (mask_) return false; + if (overflow_ && !overflow_->empty()) return false; + return true; + } + + // Returns true if the set contains ANY of the elements of |in_set|, + // or if |in_set| is empty. + bool HasAnyOf(const EnumSet& in_set) const { + if (in_set.IsEmpty()) return true; + + if (mask_ & in_set.mask_) return true; + + if (!overflow_ || !in_set.overflow_) return false; + + for (uint32_t item : *in_set.overflow_) { + if (overflow_->find(item) != overflow_->end()) return true; + } + + return false; + } + + private: + // Adds the given enum value (as a 32-bit word) to the set. This has no + // effect if the enum value is already in the set. + void AddWord(uint32_t word) { + if (auto new_bits = AsMask(word)) { + mask_ |= new_bits; + } else { + Overflow().insert(word); + } + } + + // Returns true if the enum represented as a 32-bit word is in the set. + bool ContainsWord(uint32_t word) const { + // We shouldn't call Overflow() since this is a const method. + if (auto bits = AsMask(word)) { + return (mask_ & bits) != 0; + } else if (auto overflow = overflow_.get()) { + return overflow->find(word) != overflow->end(); + } + // The word is large, but the set doesn't have large members, so + // it doesn't have an overflow set. + return false; + } + + // Returns the enum value as a uint32_t. + uint32_t ToWord(EnumType value) const { + static_assert(sizeof(EnumType) <= sizeof(uint32_t), + "EnumType must statically castable to uint32_t"); + return static_cast(value); + } + + // Determines whether the given enum value can be represented + // as a bit in a uint64_t mask. If so, then returns that mask bit. + // Otherwise, returns 0. + uint64_t AsMask(uint32_t word) const { + if (word > 63) return 0; + return uint64_t(1) << word; + } + + // Ensures that overflow_set_ references a set. A new empty set is + // allocated if one doesn't exist yet. Returns overflow_set_. + OverflowSetType& Overflow() { + if (overflow_.get() == nullptr) { + overflow_ = MakeUnique(); + } + return *overflow_; + } + + // Enums with values up to 63 are stored as bits in this mask. + uint64_t mask_ = 0; + // Enums with values larger than 63 are stored in this set. + // This set should normally be empty or very small. + std::unique_ptr overflow_ = {}; +}; + +// A set of SpvCapability, optimized for small capability values. +using CapabilitySet = EnumSet; + +} // namespace spvtools + +#endif // SOURCE_ENUM_SET_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.cpp new file mode 100644 index 00000000000..32361a08d38 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.cpp @@ -0,0 +1,29 @@ +// Copyright (c) 2017 Google 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. + +#include "source/enum_string_mapping.h" + +#include +#include +#include +#include +#include + +#include "source/extensions.h" + +namespace spvtools { + +#include "enum_string_mapping.inc" + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h new file mode 100644 index 00000000000..af8f56b82ac --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/enum_string_mapping.h @@ -0,0 +1,36 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_ENUM_STRING_MAPPING_H_ +#define SOURCE_ENUM_STRING_MAPPING_H_ + +#include + +#include "source/extensions.h" +#include "source/latest_version_spirv_header.h" + +namespace spvtools { + +// Finds Extension enum corresponding to |str|. Returns false if not found. +bool GetExtensionFromString(const char* str, Extension* extension); + +// Returns text string corresponding to |extension|. +const char* ExtensionToString(Extension extension); + +// Returns text string corresponding to |capability|. +const char* CapabilityToString(SpvCapability capability); + +} // namespace spvtools + +#endif // SOURCE_ENUM_STRING_MAPPING_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/ext_inst.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/ext_inst.cpp new file mode 100644 index 00000000000..a4c00c2fff2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/ext_inst.cpp @@ -0,0 +1,162 @@ +// Copyright (c) 2015-2016 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. + +#include "source/ext_inst.h" + +#include +#include + +// DebugInfo extended instruction set. +// See https://www.khronos.org/registry/spir-v/specs/1.0/DebugInfo.html +// TODO(dneto): DebugInfo.h should probably move to SPIRV-Headers. +#include "DebugInfo.h" + +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/macro.h" +#include "source/spirv_definition.h" + +#include "debuginfo.insts.inc" +#include "glsl.std.450.insts.inc" +#include "opencl.std.insts.inc" + +#include "spv-amd-gcn-shader.insts.inc" +#include "spv-amd-shader-ballot.insts.inc" +#include "spv-amd-shader-explicit-vertex-parameter.insts.inc" +#include "spv-amd-shader-trinary-minmax.insts.inc" + +static const spv_ext_inst_group_t kGroups_1_0[] = { + {SPV_EXT_INST_TYPE_GLSL_STD_450, ARRAY_SIZE(glsl_entries), glsl_entries}, + {SPV_EXT_INST_TYPE_OPENCL_STD, ARRAY_SIZE(opencl_entries), opencl_entries}, + {SPV_EXT_INST_TYPE_SPV_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER, + ARRAY_SIZE(spv_amd_shader_explicit_vertex_parameter_entries), + spv_amd_shader_explicit_vertex_parameter_entries}, + {SPV_EXT_INST_TYPE_SPV_AMD_SHADER_TRINARY_MINMAX, + ARRAY_SIZE(spv_amd_shader_trinary_minmax_entries), + spv_amd_shader_trinary_minmax_entries}, + {SPV_EXT_INST_TYPE_SPV_AMD_GCN_SHADER, + ARRAY_SIZE(spv_amd_gcn_shader_entries), spv_amd_gcn_shader_entries}, + {SPV_EXT_INST_TYPE_SPV_AMD_SHADER_BALLOT, + ARRAY_SIZE(spv_amd_shader_ballot_entries), spv_amd_shader_ballot_entries}, + {SPV_EXT_INST_TYPE_DEBUGINFO, ARRAY_SIZE(debuginfo_entries), + debuginfo_entries}, +}; + +static const spv_ext_inst_table_t kTable_1_0 = {ARRAY_SIZE(kGroups_1_0), + kGroups_1_0}; + +spv_result_t spvExtInstTableGet(spv_ext_inst_table* pExtInstTable, + spv_target_env env) { + if (!pExtInstTable) return SPV_ERROR_INVALID_POINTER; + + switch (env) { + // The extended instruction sets are all version 1.0 so far. + case SPV_ENV_UNIVERSAL_1_0: + case SPV_ENV_VULKAN_1_0: + case SPV_ENV_UNIVERSAL_1_1: + case SPV_ENV_UNIVERSAL_1_2: + case SPV_ENV_OPENCL_1_2: + case SPV_ENV_OPENCL_EMBEDDED_1_2: + case SPV_ENV_OPENCL_2_0: + case SPV_ENV_OPENCL_EMBEDDED_2_0: + case SPV_ENV_OPENCL_2_1: + case SPV_ENV_OPENCL_EMBEDDED_2_1: + case SPV_ENV_OPENCL_2_2: + case SPV_ENV_OPENCL_EMBEDDED_2_2: + case SPV_ENV_OPENGL_4_0: + case SPV_ENV_OPENGL_4_1: + case SPV_ENV_OPENGL_4_2: + case SPV_ENV_OPENGL_4_3: + case SPV_ENV_OPENGL_4_5: + case SPV_ENV_UNIVERSAL_1_3: + case SPV_ENV_VULKAN_1_1: + case SPV_ENV_WEBGPU_0: + *pExtInstTable = &kTable_1_0; + return SPV_SUCCESS; + default: + assert(0 && "Unknown spv_target_env in spvExtInstTableGet()"); + return SPV_ERROR_INVALID_TABLE; + } +} + +spv_ext_inst_type_t spvExtInstImportTypeGet(const char* name) { + // The names are specified by the respective extension instruction + // specifications. + if (!strcmp("GLSL.std.450", name)) { + return SPV_EXT_INST_TYPE_GLSL_STD_450; + } + if (!strcmp("OpenCL.std", name)) { + return SPV_EXT_INST_TYPE_OPENCL_STD; + } + if (!strcmp("SPV_AMD_shader_explicit_vertex_parameter", name)) { + return SPV_EXT_INST_TYPE_SPV_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER; + } + if (!strcmp("SPV_AMD_shader_trinary_minmax", name)) { + return SPV_EXT_INST_TYPE_SPV_AMD_SHADER_TRINARY_MINMAX; + } + if (!strcmp("SPV_AMD_gcn_shader", name)) { + return SPV_EXT_INST_TYPE_SPV_AMD_GCN_SHADER; + } + if (!strcmp("SPV_AMD_shader_ballot", name)) { + return SPV_EXT_INST_TYPE_SPV_AMD_SHADER_BALLOT; + } + if (!strcmp("DebugInfo", name)) { + return SPV_EXT_INST_TYPE_DEBUGINFO; + } + return SPV_EXT_INST_TYPE_NONE; +} + +spv_result_t spvExtInstTableNameLookup(const spv_ext_inst_table table, + const spv_ext_inst_type_t type, + const char* name, + spv_ext_inst_desc* pEntry) { + if (!table) return SPV_ERROR_INVALID_TABLE; + if (!pEntry) return SPV_ERROR_INVALID_POINTER; + + for (uint32_t groupIndex = 0; groupIndex < table->count; groupIndex++) { + const auto& group = table->groups[groupIndex]; + if (type != group.type) continue; + for (uint32_t index = 0; index < group.count; index++) { + const auto& entry = group.entries[index]; + if (!strcmp(name, entry.name)) { + *pEntry = &entry; + return SPV_SUCCESS; + } + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} + +spv_result_t spvExtInstTableValueLookup(const spv_ext_inst_table table, + const spv_ext_inst_type_t type, + const uint32_t value, + spv_ext_inst_desc* pEntry) { + if (!table) return SPV_ERROR_INVALID_TABLE; + if (!pEntry) return SPV_ERROR_INVALID_POINTER; + + for (uint32_t groupIndex = 0; groupIndex < table->count; groupIndex++) { + const auto& group = table->groups[groupIndex]; + if (type != group.type) continue; + for (uint32_t index = 0; index < group.count; index++) { + const auto& entry = group.entries[index]; + if (value == entry.ext_inst) { + *pEntry = &entry; + return SPV_SUCCESS; + } + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/ext_inst.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/ext_inst.h new file mode 100644 index 00000000000..a821cc2bc79 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/ext_inst.h @@ -0,0 +1,40 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_EXT_INST_H_ +#define SOURCE_EXT_INST_H_ + +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +// Gets the type of the extended instruction set with the specified name. +spv_ext_inst_type_t spvExtInstImportTypeGet(const char* name); + +// Finds the named extented instruction of the given type in the given extended +// instruction table. On success, returns SPV_SUCCESS and writes a handle of +// the instruction entry into *entry. +spv_result_t spvExtInstTableNameLookup(const spv_ext_inst_table table, + const spv_ext_inst_type_t type, + const char* name, + spv_ext_inst_desc* entry); + +// Finds the extented instruction of the given type in the given extended +// instruction table by value. On success, returns SPV_SUCCESS and writes a +// handle of the instruction entry into *entry. +spv_result_t spvExtInstTableValueLookup(const spv_ext_inst_table table, + const spv_ext_inst_type_t type, + const uint32_t value, + spv_ext_inst_desc* pEntry); + +#endif // SOURCE_EXT_INST_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extensions.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/extensions.cpp new file mode 100644 index 00000000000..a94db273e73 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extensions.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2017 Google 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. + +#include "source/extensions.h" + +#include +#include +#include + +#include "source/enum_string_mapping.h" + +namespace spvtools { + +std::string GetExtensionString(const spv_parsed_instruction_t* inst) { + if (inst->opcode != SpvOpExtension) return "ERROR_not_op_extension"; + + assert(inst->num_operands == 1); + + const auto& operand = inst->operands[0]; + assert(operand.type == SPV_OPERAND_TYPE_LITERAL_STRING); + assert(inst->num_words > operand.offset); + + return reinterpret_cast(inst->words + operand.offset); +} + +std::string ExtensionSetToString(const ExtensionSet& extensions) { + std::stringstream ss; + extensions.ForEach( + [&ss](Extension ext) { ss << ExtensionToString(ext) << " "; }); + return ss.str(); +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extensions.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/extensions.h new file mode 100644 index 00000000000..8023444c310 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extensions.h @@ -0,0 +1,40 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_EXTENSIONS_H_ +#define SOURCE_EXTENSIONS_H_ + +#include + +#include "source/enum_set.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// The known SPIR-V extensions. +enum Extension { +#include "extension_enum.inc" +}; + +using ExtensionSet = EnumSet; + +// Returns literal string operand of OpExtension instruction. +std::string GetExtensionString(const spv_parsed_instruction_t* inst); + +// Returns text string listing |extensions| separated by whitespace. +std::string ExtensionSetToString(const ExtensionSet& extensions); + +} // namespace spvtools + +#endif // SOURCE_EXTENSIONS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.debuginfo.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.debuginfo.grammar.json new file mode 100644 index 00000000000..9212f6f48c5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.debuginfo.grammar.json @@ -0,0 +1,568 @@ +{ + "copyright" : [ + "Copyright (c) 2017 The Khronos Group Inc.", + "", + "Permission is hereby granted, free of charge, to any person obtaining a copy", + "of this software and/or associated documentation files (the \"Materials\"),", + "to deal in the Materials without restriction, including without limitation", + "the rights to use, copy, modify, merge, publish, distribute, sublicense,", + "and/or sell copies of the Materials, and to permit persons to whom the", + "Materials are furnished to do so, subject to the following conditions:", + "", + "The above copyright notice and this permission notice shall be included in", + "all copies or substantial portions of the Materials.", + "", + "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", + "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", + "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", + "", + "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", + "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", + "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", + "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", + "IN THE MATERIALS." + ], + "version" : 100, + "revision" : 1, + "instructions" : [ + { + "opname" : "DebugInfoNone", + "opcode" : 0 + }, + { + "opname" : "DebugCompilationUnit", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Version'" }, + { "kind" : "LiteralInteger", "name" : "'DWARF Version'" } + ] + }, + { + "opname" : "DebugTypeBasic", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "DebugBaseTypeAttributeEncoding", "name" : "'Encoding'" } + ] + }, + { + "opname" : "DebugTypePointer", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'Base Type'" }, + { "kind" : "StorageClass", "name" : "'Storage Class'" }, + { "kind" : "DebugInfoFlags", "name" : "'Literal Flags'" } + ] + }, + { + "opname" : "DebugTypeQualifier", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'Base Type'" }, + { "kind" : "DebugTypeQualifier", "name" : "'Type Qualifier'" } + ] + }, + { + "opname" : "DebugTypeArray", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'Base Type'" }, + { "kind" : "IdRef", "name" : "'Component Counts'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugTypeVector", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'Base Type'" }, + { "kind" : "LiteralInteger", "name" : "'Component Count'" } + ] + }, + { + "opname" : "DebugTypedef", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Base Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" } + ] + }, + { + "opname" : "DebugTypeFunction", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'Return Type'" }, + { "kind" : "IdRef", "name" : "'Paramter Types'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugTypeEnum", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Underlying Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" }, + { "kind" : "PairIdRefIdRef", "name" : "'Value, Name, Value, Name, ...'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugTypeComposite", + "opcode" : 10, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "DebugCompositeType", "name" : "'Tag'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'Members'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugTypeMember", + "opcode" : 11, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'Value'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugTypeInheritance", + "opcode" : 12, + "operands" : [ + { "kind" : "IdRef", "name" : "'Child'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Offset'" }, + { "kind" : "IdRef", "name" : "'Size'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" } + ] + }, + { + "opname" : "DebugTypePtrToMember", + "opcode" : 13, + "operands" : [ + { "kind" : "IdRef", "name" : "'Member Type'" }, + { "kind" : "IdRef", "name" : "'Parent'" } + ] + }, + { + "opname" : "DebugTypeTemplate", + "opcode" : 14, + "operands" : [ + { "kind" : "IdRef", "name" : "'Target'" }, + { "kind" : "IdRef", "name" : "'Parameters'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugTypeTemplateParameter", + "opcode" : 15, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Actual Type'" }, + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" } + ] + }, + { + "opname" : "DebugTypeTemplateTemplateParameter", + "opcode" : 16, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Template Name'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" } + ] + }, + { + "opname" : "DebugTypeTemplateParameterPack", + "opcode" : 17, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Template Parameters'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugGlobalVariable", + "opcode" : 18, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Linkage Name'" }, + { "kind" : "IdRef", "name" : "'Variable'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" }, + { "kind" : "IdRef", "name" : "'Static Member Declaration'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugFunctionDeclaration", + "opcode" : 19, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Linkage Name'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" } + ] + }, + { + "opname" : "DebugFunction", + "opcode" : 20, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Linkage Name'" }, + { "kind" : "DebugInfoFlags", "name" : "'Flags'" }, + { "kind" : "LiteralInteger", "name" : "'Scope Line'" }, + { "kind" : "IdRef", "name" : "'Function'" }, + { "kind" : "IdRef", "name" : "'Declaration'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugLexicalBlock", + "opcode" : 21, + "operands" : [ + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "IdRef", "name" : "'Name'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugLexicalBlockDiscriminator", + "opcode" : 22, + "operands" : [ + { "kind" : "IdRef", "name" : "'Scope'" }, + { "kind" : "LiteralInteger", "name" : "'Discriminator'" }, + { "kind" : "IdRef", "name" : "'Parent'" } + ] + }, + { + "opname" : "DebugScope", + "opcode" : 23, + "operands" : [ + { "kind" : "IdRef", "name" : "'Scope'" }, + { "kind" : "IdRef", "name" : "'Inlined At'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugNoScope", + "opcode" : 24 + }, + { + "opname" : "DebugInlinedAt", + "opcode" : 25, + "operands" : [ + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "IdRef", "name" : "'Scope'" }, + { "kind" : "IdRef", "name" : "'Inlined'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugLocalVariable", + "opcode" : 26, + "operands" : [ + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Type'" }, + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "LiteralInteger", "name" : "'Column'" }, + { "kind" : "IdRef", "name" : "'Parent'" }, + { "kind" : "LiteralInteger", "name" : "'Arg Number'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugInlinedVariable", + "opcode" : 27, + "operands" : [ + { "kind" : "IdRef", "name" : "'Variable'" }, + { "kind" : "IdRef", "name" : "'Inlined'" } + ] + }, + { + "opname" : "DebugDeclare", + "opcode" : 28, + "operands" : [ + { "kind" : "IdRef", "name" : "'Local Variable'" }, + { "kind" : "IdRef", "name" : "'Variable'" }, + { "kind" : "IdRef", "name" : "'Expression'" } + ] + }, + { + "opname" : "DebugValue", + "opcode" : 29, + "operands" : [ + { "kind" : "IdRef", "name" : "'Value'" }, + { "kind" : "IdRef", "name" : "'Expression'" }, + { "kind" : "IdRef", "name" : "'Indexes'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugOperation", + "opcode" : 30, + "operands" : [ + { "kind" : "DebugOperation", "name" : "'OpCode'" }, + { "kind" : "LiteralInteger", "name" : "'Operands ...'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugExpression", + "opcode" : 31, + "operands" : [ + { "kind" : "IdRef", "name" : "'Operands ...'", "quantifier" : "*" } + ] + }, + { + "opname" : "DebugMacroDef", + "opcode" : 32, + "operands" : [ + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "IdRef", "name" : "'Name'" }, + { "kind" : "IdRef", "name" : "'Value'", "quantifier" : "?" } + ] + }, + { + "opname" : "DebugMacroUndef", + "opcode" : 33, + "operands" : [ + { "kind" : "IdRef", "name" : "'Source'" }, + { "kind" : "LiteralInteger", "name" : "'Line'" }, + { "kind" : "IdRef", "name" : "'Macro'" } + ] + } + ], + "operand_kinds" : [ + { + "category" : "BitEnum", + "kind" : "DebugInfoFlags", + "enumerants" : [ + { + "enumerant" : "FlagIsProtected", + "value" : "0x01" + }, + { + "enumerant" : "FlagIsPrivate", + "value" : "0x02" + }, + { + "enumerant" : "FlagIsPublic", + "value" : "0x03" + }, + { + "enumerant" : "FlagIsLocal", + "value" : "0x04" + }, + { + "enumerant" : "FlagIsDefinition", + "value" : "0x08" + }, + { + "enumerant" : "FlagFwdDecl", + "value" : "0x10" + }, + { + "enumerant" : "FlagArtificial", + "value" : "0x20" + }, + { + "enumerant" : "FlagExplicit", + "value" : "0x40" + }, + { + "enumerant" : "FlagPrototyped", + "value" : "0x80" + }, + { + "enumerant" : "FlagObjectPointer", + "value" : "0x100" + }, + { + "enumerant" : "FlagStaticMember", + "value" : "0x200" + }, + { + "enumerant" : "FlagIndirectVariable", + "value" : "0x400" + }, + { + "enumerant" : "FlagLValueReference", + "value" : "0x800" + }, + { + "enumerant" : "FlagRValueReference", + "value" : "0x1000" + }, + { + "enumerant" : "FlagIsOptimized", + "value" : "0x2000" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "DebugBaseTypeAttributeEncoding", + "enumerants" : [ + { + "enumerant" : "Unspecified", + "value" : "0" + }, + { + "enumerant" : "Address", + "value" : "1" + }, + { + "enumerant" : "Boolean", + "value" : "2" + }, + { + "enumerant" : "Float", + "value" : "4" + }, + { + "enumerant" : "Signed", + "value" : "5" + }, + { + "enumerant" : "SignedChar", + "value" : "6" + }, + { + "enumerant" : "Unsigned", + "value" : "7" + }, + { + "enumerant" : "UnsignedChar", + "value" : "8" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "DebugCompositeType", + "enumerants" : [ + { + "enumerant" : "Class", + "value" : "0" + }, + { + "enumerant" : "Structure", + "value" : "1" + }, + { + "enumerant" : "Union", + "value" : "2" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "DebugTypeQualifier", + "enumerants" : [ + { + "enumerant" : "ConstType", + "value" : "0" + }, + { + "enumerant" : "VolatileType", + "value" : "1" + }, + { + "enumerant" : "RestrictType", + "value" : "2" + } + ] + }, + { + "category" : "ValueEnum", + "kind" : "DebugOperation", + "enumerants" : [ + { + "enumerant" : "Deref", + "value" : "0" + }, + { + "enumerant" : "Plus", + "value" : "1" + }, + { + "enumerant" : "Minus", + "value" : "2" + }, + { + "enumerant" : "PlusUconst", + "value" : "3", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + }, + { + "enumerant" : "BitPiece", + "value" : "4", + "parameters" : [ + { "kind" : "LiteralInteger" }, + { "kind" : "LiteralInteger" } + ] + }, + { + "enumerant" : "Swap", + "value" : "5" + }, + { + "enumerant" : "Xderef", + "value" : "6" + }, + { + "enumerant" : "StackValue", + "value" : "7" + }, + { + "enumerant" : "Constu", + "value" : "8", + "parameters" : [ + { "kind" : "LiteralInteger" } + ] + } + ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json new file mode 100644 index 00000000000..e18251bba1b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-gcn-shader.grammar.json @@ -0,0 +1,26 @@ +{ + "revision" : 2, + "instructions" : [ + { + "opname" : "CubeFaceIndexAMD", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'P'" } + ], + "extensions" : [ "SPV_AMD_gcn_shader" ] + }, + { + "opname" : "CubeFaceCoordAMD", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'P'" } + ], + "extensions" : [ "SPV_AMD_gcn_shader" ] + }, + { + "opname" : "TimeAMD", + "opcode" : 3, + "extensions" : [ "SPV_AMD_gcn_shader" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-ballot.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-ballot.grammar.json new file mode 100644 index 00000000000..62a470eeb65 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-ballot.grammar.json @@ -0,0 +1,41 @@ +{ + "revision" : 5, + "instructions" : [ + { + "opname" : "SwizzleInvocationsAMD", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'offset'" } + ], + "extensions" : [ "SPV_AMD_shader_ballot" ] + }, + { + "opname" : "SwizzleInvocationsMaskedAMD", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'data'" }, + { "kind" : "IdRef", "name" : "'mask'" } + ], + "extensions" : [ "SPV_AMD_shader_ballot" ] + }, + { + "opname" : "WriteInvocationAMD", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'inputValue'" }, + { "kind" : "IdRef", "name" : "'writeValue'" }, + { "kind" : "IdRef", "name" : "'invocationIndex'" } + ], + "extensions" : [ "SPV_AMD_shader_ballot" ] + }, + { + "opname" : "MbcntAMD", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'mask'" } + ], + "extensions" : [ "SPV_AMD_shader_ballot" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json new file mode 100644 index 00000000000..e156b1b6f81 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json @@ -0,0 +1,14 @@ +{ + "revision" : 4, + "instructions" : [ + { + "opname" : "InterpolateAtVertexAMD", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'interpolant'" }, + { "kind" : "IdRef", "name" : "'vertexIdx'" } + ], + "extensions" : [ "SPV_AMD_shader_explicit_vertex_parameter" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-trinary-minmax.grammar.json b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-trinary-minmax.grammar.json new file mode 100644 index 00000000000..c681976fe92 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/extinst.spv-amd-shader-trinary-minmax.grammar.json @@ -0,0 +1,95 @@ +{ + "revision" : 4, + "instructions" : [ + { + "opname" : "FMin3AMD", + "opcode" : 1, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "UMin3AMD", + "opcode" : 2, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "SMin3AMD", + "opcode" : 3, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "FMax3AMD", + "opcode" : 4, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "UMax3AMD", + "opcode" : 5, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "SMax3AMD", + "opcode" : 6, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "FMid3AMD", + "opcode" : 7, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "UMid3AMD", + "opcode" : 8, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + }, + { + "opname" : "SMid3AMD", + "opcode" : 9, + "operands" : [ + { "kind" : "IdRef", "name" : "'x'" }, + { "kind" : "IdRef", "name" : "'y'" }, + { "kind" : "IdRef", "name" : "'z'" } + ], + "extensions" : [ "SPV_AMD_shader_trinary_minmax" ] + } + ] +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/id_descriptor.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/id_descriptor.cpp new file mode 100644 index 00000000000..d44ed672c23 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/id_descriptor.cpp @@ -0,0 +1,78 @@ +// Copyright (c) 2017 Google 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. + +#include "source/id_descriptor.h" + +#include +#include + +#include "source/opcode.h" +#include "source/operand.h" + +namespace spvtools { +namespace { + +// Hashes an array of words. Order of words is important. +uint32_t HashU32Array(const std::vector& words) { + // The hash function is a sum of hashes of each word seeded by word index. + // Knuth's multiplicative hash is used to hash the words. + const uint32_t kKnuthMulHash = 2654435761; + uint32_t val = 0; + for (uint32_t i = 0; i < words.size(); ++i) { + val += (words[i] + i + 123) * kKnuthMulHash; + } + return val; +} + +} // namespace + +uint32_t IdDescriptorCollection::ProcessInstruction( + const spv_parsed_instruction_t& inst) { + if (!inst.result_id) return 0; + + assert(words_.empty()); + words_.push_back(inst.words[0]); + + for (size_t operand_index = 0; operand_index < inst.num_operands; + ++operand_index) { + const auto& operand = inst.operands[operand_index]; + if (spvIsIdType(operand.type)) { + const uint32_t id = inst.words[operand.offset]; + const auto it = id_to_descriptor_.find(id); + // Forward declared ids are not hashed. + if (it != id_to_descriptor_.end()) { + words_.push_back(it->second); + } + } else { + for (size_t operand_word_index = 0; + operand_word_index < operand.num_words; ++operand_word_index) { + words_.push_back(inst.words[operand.offset + operand_word_index]); + } + } + } + + uint32_t descriptor = + custom_hash_func_ ? custom_hash_func_(words_) : HashU32Array(words_); + if (descriptor == 0) descriptor = 1; + assert(descriptor); + + words_.clear(); + + const auto result = id_to_descriptor_.emplace(inst.result_id, descriptor); + assert(result.second); + (void)result; + return descriptor; +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/id_descriptor.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/id_descriptor.h new file mode 100644 index 00000000000..add23343a10 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/id_descriptor.h @@ -0,0 +1,63 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_ID_DESCRIPTOR_H_ +#define SOURCE_ID_DESCRIPTOR_H_ + +#include +#include + +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { + +using CustomHashFunc = std::function&)>; + +// Computes and stores id descriptors. +// +// Descriptors are computed as hash of all words in the instruction where ids +// were substituted with previously computed descriptors. +class IdDescriptorCollection { + public: + explicit IdDescriptorCollection( + CustomHashFunc custom_hash_func = CustomHashFunc()) + : custom_hash_func_(custom_hash_func) { + words_.reserve(16); + } + + // Computes descriptor for the result id of the given instruction and + // registers it in id_to_descriptor_. Returns the computed descriptor. + // This function needs to be sequentially called for every instruction in the + // module. + uint32_t ProcessInstruction(const spv_parsed_instruction_t& inst); + + // Returns a previously computed descriptor id. + uint32_t GetDescriptor(uint32_t id) const { + const auto it = id_to_descriptor_.find(id); + if (it == id_to_descriptor_.end()) return 0; + return it->second; + } + + private: + std::unordered_map id_to_descriptor_; + + std::function&)> custom_hash_func_; + + // Scratch buffer used for hashing. Class member to optimize on allocation. + std::vector words_; +}; + +} // namespace spvtools + +#endif // SOURCE_ID_DESCRIPTOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/instruction.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/instruction.h new file mode 100644 index 00000000000..9e7dccd03b8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/instruction.h @@ -0,0 +1,49 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_INSTRUCTION_H_ +#define SOURCE_INSTRUCTION_H_ + +#include +#include + +#include "source/latest_version_spirv_header.h" +#include "spirv-tools/libspirv.h" + +// Describes an instruction. +struct spv_instruction_t { + // Normally, both opcode and extInstType contain valid data. + // However, when the assembler parses ! as the first word in + // an instruction and opcode and extInstType are invalid. + SpvOp opcode; + spv_ext_inst_type_t extInstType; + + // The Id of the result type, if this instruction has one. Zero otherwise. + uint32_t resultTypeId; + + // The instruction, as a sequence of 32-bit words. + // For a regular instruction the opcode and word count are combined + // in words[0], as described in the SPIR-V spec. + // Otherwise, the first token was !, and that number appears + // in words[0]. Subsequent elements are the result of parsing + // tokens in the alternate parsing mode as described in syntax.md. + std::vector words; +}; + +// Appends a word to an instruction, without checking for overflow. +inline void spvInstructionAddWord(spv_instruction_t* inst, uint32_t value) { + inst->words.push_back(value); +} + +#endif // SOURCE_INSTRUCTION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_glsl_std_450_header.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_glsl_std_450_header.h new file mode 100644 index 00000000000..bed1f2502ee --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_glsl_std_450_header.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_LATEST_VERSION_GLSL_STD_450_HEADER_H_ +#define SOURCE_LATEST_VERSION_GLSL_STD_450_HEADER_H_ + +#include "spirv/unified1/GLSL.std.450.h" + +#endif // SOURCE_LATEST_VERSION_GLSL_STD_450_HEADER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_opencl_std_header.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_opencl_std_header.h new file mode 100644 index 00000000000..90ff9c03360 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_opencl_std_header.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_LATEST_VERSION_OPENCL_STD_HEADER_H_ +#define SOURCE_LATEST_VERSION_OPENCL_STD_HEADER_H_ + +#include "spirv/unified1/OpenCL.std.h" + +#endif // SOURCE_LATEST_VERSION_OPENCL_STD_HEADER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h new file mode 100644 index 00000000000..e4f28e43e5c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/latest_version_spirv_header.h @@ -0,0 +1,20 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ +#define SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ + +#include "spirv/unified1/spirv.h" + +#endif // SOURCE_LATEST_VERSION_SPIRV_HEADER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/libspirv.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/libspirv.cpp new file mode 100644 index 00000000000..cbbc4c90891 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/libspirv.cpp @@ -0,0 +1,131 @@ +// Copyright (c) 2016 Google 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. + +#include "spirv-tools/libspirv.hpp" + +#include + +#include +#include +#include + +#include "source/table.h" + +namespace spvtools { + +Context::Context(spv_target_env env) : context_(spvContextCreate(env)) {} + +Context::Context(Context&& other) : context_(other.context_) { + other.context_ = nullptr; +} + +Context& Context::operator=(Context&& other) { + spvContextDestroy(context_); + context_ = other.context_; + other.context_ = nullptr; + + return *this; +} + +Context::~Context() { spvContextDestroy(context_); } + +void Context::SetMessageConsumer(MessageConsumer consumer) { + SetContextMessageConsumer(context_, std::move(consumer)); +} + +spv_context& Context::CContext() { return context_; } + +const spv_context& Context::CContext() const { return context_; } + +// Structs for holding the data members for SpvTools. +struct SpirvTools::Impl { + explicit Impl(spv_target_env env) : context(spvContextCreate(env)) { + // The default consumer in spv_context_t is a null consumer, which provides + // equivalent functionality (from the user's perspective) as a real consumer + // does nothing. + } + ~Impl() { spvContextDestroy(context); } + + spv_context context; // C interface context object. +}; + +SpirvTools::SpirvTools(spv_target_env env) : impl_(new Impl(env)) {} + +SpirvTools::~SpirvTools() {} + +void SpirvTools::SetMessageConsumer(MessageConsumer consumer) { + SetContextMessageConsumer(impl_->context, std::move(consumer)); +} + +bool SpirvTools::Assemble(const std::string& text, + std::vector* binary, + uint32_t options) const { + return Assemble(text.data(), text.size(), binary, options); +} + +bool SpirvTools::Assemble(const char* text, const size_t text_size, + std::vector* binary, + uint32_t options) const { + spv_binary spvbinary = nullptr; + spv_result_t status = spvTextToBinaryWithOptions( + impl_->context, text, text_size, options, &spvbinary, nullptr); + if (status == SPV_SUCCESS) { + binary->assign(spvbinary->code, spvbinary->code + spvbinary->wordCount); + } + spvBinaryDestroy(spvbinary); + return status == SPV_SUCCESS; +} + +bool SpirvTools::Disassemble(const std::vector& binary, + std::string* text, uint32_t options) const { + return Disassemble(binary.data(), binary.size(), text, options); +} + +bool SpirvTools::Disassemble(const uint32_t* binary, const size_t binary_size, + std::string* text, uint32_t options) const { + spv_text spvtext = nullptr; + spv_result_t status = spvBinaryToText(impl_->context, binary, binary_size, + options, &spvtext, nullptr); + if (status == SPV_SUCCESS) { + text->assign(spvtext->str, spvtext->str + spvtext->length); + } + spvTextDestroy(spvtext); + return status == SPV_SUCCESS; +} + +bool SpirvTools::Validate(const std::vector& binary) const { + return Validate(binary.data(), binary.size()); +} + +bool SpirvTools::Validate(const uint32_t* binary, + const size_t binary_size) const { + return spvValidateBinary(impl_->context, binary, binary_size, nullptr) == + SPV_SUCCESS; +} + +bool SpirvTools::Validate(const uint32_t* binary, const size_t binary_size, + const ValidatorOptions& options) const { + spv_const_binary_t the_binary{binary, binary_size}; + spv_diagnostic diagnostic = nullptr; + bool valid = spvValidateWithOptions(impl_->context, options, &the_binary, + &diagnostic) == SPV_SUCCESS; + if (!valid && impl_->context->consumer) { + impl_->context->consumer.operator()( + SPV_MSG_ERROR, nullptr, diagnostic->position, diagnostic->error); + } + spvDiagnosticDestroy(diagnostic); + return valid; +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/link/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/source/link/CMakeLists.txt new file mode 100644 index 00000000000..8ca4df39f7a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/link/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) 2017 Pierre Moreau + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +add_library(SPIRV-Tools-link + linker.cpp +) + +spvtools_default_compile_options(SPIRV-Tools-link) +target_include_directories(SPIRV-Tools-link + PUBLIC ${spirv-tools_SOURCE_DIR}/include + PUBLIC ${SPIRV_HEADER_INCLUDE_DIR} + PRIVATE ${spirv-tools_BINARY_DIR} +) +# We need the IR functionnalities from the optimizer +target_link_libraries(SPIRV-Tools-link + PUBLIC SPIRV-Tools-opt) + +set_property(TARGET SPIRV-Tools-link PROPERTY FOLDER "SPIRV-Tools libraries") +spvtools_check_symbol_exports(SPIRV-Tools-link) + +if(ENABLE_SPIRV_TOOLS_INSTALL) + install(TARGETS SPIRV-Tools-link + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif(ENABLE_SPIRV_TOOLS_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/link/linker.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/link/linker.cpp new file mode 100644 index 00000000000..f28b7595aaa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/link/linker.cpp @@ -0,0 +1,769 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "spirv-tools/linker.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/diagnostic.h" +#include "source/opt/build_module.h" +#include "source/opt/compact_ids_pass.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/ir_loader.h" +#include "source/opt/pass_manager.h" +#include "source/opt/remove_duplicates_pass.h" +#include "source/spirv_target_env.h" +#include "source/util/make_unique.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace { + +using opt::IRContext; +using opt::Instruction; +using opt::Module; +using opt::Operand; +using opt::PassManager; +using opt::RemoveDuplicatesPass; +using opt::analysis::DecorationManager; +using opt::analysis::DefUseManager; + +// Stores various information about an imported or exported symbol. +struct LinkageSymbolInfo { + SpvId id; // ID of the symbol + SpvId type_id; // ID of the type of the symbol + std::string name; // unique name defining the symbol and used for matching + // imports and exports together + std::vector parameter_ids; // ID of the parameters of the symbol, if + // it is a function +}; +struct LinkageEntry { + LinkageSymbolInfo imported_symbol; + LinkageSymbolInfo exported_symbol; + + LinkageEntry(const LinkageSymbolInfo& import_info, + const LinkageSymbolInfo& export_info) + : imported_symbol(import_info), exported_symbol(export_info) {} +}; +using LinkageTable = std::vector; + +// Shifts the IDs used in each binary of |modules| so that they occupy a +// disjoint range from the other binaries, and compute the new ID bound which +// is returned in |max_id_bound|. +// +// Both |modules| and |max_id_bound| should not be null, and |modules| should +// not be empty either. Furthermore |modules| should not contain any null +// pointers. +spv_result_t ShiftIdsInModules(const MessageConsumer& consumer, + std::vector* modules, + uint32_t* max_id_bound); + +// Generates the header for the linked module and returns it in |header|. +// +// |header| should not be null, |modules| should not be empty and pointers +// should be non-null. |max_id_bound| should be strictly greater than 0. +// +// TODO(pierremoreau): What to do when binaries use different versions of +// SPIR-V? For now, use the max of all versions found in +// the input modules. +spv_result_t GenerateHeader(const MessageConsumer& consumer, + const std::vector& modules, + uint32_t max_id_bound, opt::ModuleHeader* header); + +// Merge all the modules from |in_modules| into a single module owned by +// |linked_context|. +// +// |linked_context| should not be null. +spv_result_t MergeModules(const MessageConsumer& consumer, + const std::vector& in_modules, + const AssemblyGrammar& grammar, + IRContext* linked_context); + +// Compute all pairs of import and export and return it in |linkings_to_do|. +// +// |linkings_to_do should not be null. Built-in symbols will be ignored. +// +// TODO(pierremoreau): Linkage attributes applied by a group decoration are +// currently not handled. (You could have a group being +// applied to a single ID.) +// TODO(pierremoreau): What should be the proper behaviour with built-in +// symbols? +spv_result_t GetImportExportPairs(const MessageConsumer& consumer, + const opt::IRContext& linked_context, + const DefUseManager& def_use_manager, + const DecorationManager& decoration_manager, + bool allow_partial_linkage, + LinkageTable* linkings_to_do); + +// Checks that for each pair of import and export, the import and export have +// the same type as well as the same decorations. +// +// TODO(pierremoreau): Decorations on functions parameters are currently not +// checked. +spv_result_t CheckImportExportCompatibility(const MessageConsumer& consumer, + const LinkageTable& linkings_to_do, + opt::IRContext* context); + +// Remove linkage specific instructions, such as prototypes of imported +// functions, declarations of imported variables, import (and export if +// necessary) linkage attribtes. +// +// |linked_context| and |decoration_manager| should not be null, and the +// 'RemoveDuplicatePass' should be run first. +// +// TODO(pierremoreau): Linkage attributes applied by a group decoration are +// currently not handled. (You could have a group being +// applied to a single ID.) +// TODO(pierremoreau): Run a pass for removing dead instructions, for example +// OpName for prototypes of imported funcions. +spv_result_t RemoveLinkageSpecificInstructions( + const MessageConsumer& consumer, const LinkerOptions& options, + const LinkageTable& linkings_to_do, DecorationManager* decoration_manager, + opt::IRContext* linked_context); + +// Verify that the unique ids of each instruction in |linked_context| (i.e. the +// merged module) are truly unique. Does not check the validity of other ids +spv_result_t VerifyIds(const MessageConsumer& consumer, + opt::IRContext* linked_context); + +spv_result_t ShiftIdsInModules(const MessageConsumer& consumer, + std::vector* modules, + uint32_t* max_id_bound) { + spv_position_t position = {}; + + if (modules == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|modules| of ShiftIdsInModules should not be null."; + if (modules->empty()) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|modules| of ShiftIdsInModules should not be empty."; + if (max_id_bound == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|max_id_bound| of ShiftIdsInModules should not be null."; + + uint32_t id_bound = modules->front()->IdBound() - 1u; + for (auto module_iter = modules->begin() + 1; module_iter != modules->end(); + ++module_iter) { + Module* module = *module_iter; + module->ForEachInst([&id_bound](Instruction* insn) { + insn->ForEachId([&id_bound](uint32_t* id) { *id += id_bound; }); + }); + id_bound += module->IdBound() - 1u; + if (id_bound > 0x3FFFFF) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_ID) + << "The limit of IDs, 4194303, was exceeded:" + << " " << id_bound << " is the current ID bound."; + + // Invalidate the DefUseManager + module->context()->InvalidateAnalyses(opt::IRContext::kAnalysisDefUse); + } + ++id_bound; + if (id_bound > 0x3FFFFF) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_ID) + << "The limit of IDs, 4194303, was exceeded:" + << " " << id_bound << " is the current ID bound."; + + *max_id_bound = id_bound; + + return SPV_SUCCESS; +} + +spv_result_t GenerateHeader(const MessageConsumer& consumer, + const std::vector& modules, + uint32_t max_id_bound, opt::ModuleHeader* header) { + spv_position_t position = {}; + + if (modules.empty()) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|modules| of GenerateHeader should not be empty."; + if (max_id_bound == 0u) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|max_id_bound| of GenerateHeader should not be null."; + + uint32_t version = 0u; + for (const auto& module : modules) + version = std::max(version, module->version()); + + header->magic_number = SpvMagicNumber; + header->version = version; + header->generator = 17u; + header->bound = max_id_bound; + header->reserved = 0u; + + return SPV_SUCCESS; +} + +spv_result_t MergeModules(const MessageConsumer& consumer, + const std::vector& input_modules, + const AssemblyGrammar& grammar, + IRContext* linked_context) { + spv_position_t position = {}; + + if (linked_context == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|linked_module| of MergeModules should not be null."; + Module* linked_module = linked_context->module(); + + if (input_modules.empty()) return SPV_SUCCESS; + + for (const auto& module : input_modules) + for (const auto& inst : module->capabilities()) + linked_module->AddCapability( + std::unique_ptr(inst.Clone(linked_context))); + + for (const auto& module : input_modules) + for (const auto& inst : module->extensions()) + linked_module->AddExtension( + std::unique_ptr(inst.Clone(linked_context))); + + for (const auto& module : input_modules) + for (const auto& inst : module->ext_inst_imports()) + linked_module->AddExtInstImport( + std::unique_ptr(inst.Clone(linked_context))); + + do { + const Instruction* memory_model_inst = input_modules[0]->GetMemoryModel(); + if (memory_model_inst == nullptr) break; + + uint32_t addressing_model = memory_model_inst->GetSingleWordOperand(0u); + uint32_t memory_model = memory_model_inst->GetSingleWordOperand(1u); + for (const auto& module : input_modules) { + memory_model_inst = module->GetMemoryModel(); + if (memory_model_inst == nullptr) continue; + + if (addressing_model != memory_model_inst->GetSingleWordOperand(0u)) { + spv_operand_desc initial_desc = nullptr, current_desc = nullptr; + grammar.lookupOperand(SPV_OPERAND_TYPE_ADDRESSING_MODEL, + addressing_model, &initial_desc); + grammar.lookupOperand(SPV_OPERAND_TYPE_ADDRESSING_MODEL, + memory_model_inst->GetSingleWordOperand(0u), + ¤t_desc); + return DiagnosticStream(position, consumer, "", SPV_ERROR_INTERNAL) + << "Conflicting addressing models: " << initial_desc->name + << " vs " << current_desc->name << "."; + } + if (memory_model != memory_model_inst->GetSingleWordOperand(1u)) { + spv_operand_desc initial_desc = nullptr, current_desc = nullptr; + grammar.lookupOperand(SPV_OPERAND_TYPE_MEMORY_MODEL, memory_model, + &initial_desc); + grammar.lookupOperand(SPV_OPERAND_TYPE_MEMORY_MODEL, + memory_model_inst->GetSingleWordOperand(1u), + ¤t_desc); + return DiagnosticStream(position, consumer, "", SPV_ERROR_INTERNAL) + << "Conflicting memory models: " << initial_desc->name << " vs " + << current_desc->name << "."; + } + } + + if (memory_model_inst != nullptr) + linked_module->SetMemoryModel(std::unique_ptr( + memory_model_inst->Clone(linked_context))); + } while (false); + + std::vector> entry_points; + for (const auto& module : input_modules) + for (const auto& inst : module->entry_points()) { + const uint32_t model = inst.GetSingleWordInOperand(0); + const char* const name = + reinterpret_cast(inst.GetInOperand(2).words.data()); + const auto i = std::find_if( + entry_points.begin(), entry_points.end(), + [model, name](const std::pair& v) { + return v.first == model && strcmp(name, v.second) == 0; + }); + if (i != entry_points.end()) { + spv_operand_desc desc = nullptr; + grammar.lookupOperand(SPV_OPERAND_TYPE_EXECUTION_MODEL, model, &desc); + return DiagnosticStream(position, consumer, "", SPV_ERROR_INTERNAL) + << "The entry point \"" << name << "\", with execution model " + << desc->name << ", was already defined."; + } + linked_module->AddEntryPoint( + std::unique_ptr(inst.Clone(linked_context))); + entry_points.emplace_back(model, name); + } + + for (const auto& module : input_modules) + for (const auto& inst : module->execution_modes()) + linked_module->AddExecutionMode( + std::unique_ptr(inst.Clone(linked_context))); + + for (const auto& module : input_modules) + for (const auto& inst : module->debugs1()) + linked_module->AddDebug1Inst( + std::unique_ptr(inst.Clone(linked_context))); + + for (const auto& module : input_modules) + for (const auto& inst : module->debugs2()) + linked_module->AddDebug2Inst( + std::unique_ptr(inst.Clone(linked_context))); + + for (const auto& module : input_modules) + for (const auto& inst : module->debugs3()) + linked_module->AddDebug3Inst( + std::unique_ptr(inst.Clone(linked_context))); + + // If the generated module uses SPIR-V 1.1 or higher, add an + // OpModuleProcessed instruction about the linking step. + if (linked_module->version() >= 0x10100) { + const std::string processed_string("Linked by SPIR-V Tools Linker"); + const auto num_chars = processed_string.size(); + // Compute num words, accommodate the terminating null character. + const auto num_words = (num_chars + 1 + 3) / 4; + std::vector processed_words(num_words, 0u); + std::memcpy(processed_words.data(), processed_string.data(), num_chars); + linked_module->AddDebug3Inst(std::unique_ptr( + new Instruction(linked_context, SpvOpModuleProcessed, 0u, 0u, + {{SPV_OPERAND_TYPE_LITERAL_STRING, processed_words}}))); + } + + for (const auto& module : input_modules) + for (const auto& inst : module->annotations()) + linked_module->AddAnnotationInst( + std::unique_ptr(inst.Clone(linked_context))); + + // TODO(pierremoreau): Since the modules have not been validate, should we + // expect SpvStorageClassFunction variables outside + // functions? + uint32_t num_global_values = 0u; + for (const auto& module : input_modules) { + for (const auto& inst : module->types_values()) { + linked_module->AddType( + std::unique_ptr(inst.Clone(linked_context))); + num_global_values += inst.opcode() == SpvOpVariable; + } + } + if (num_global_values > 0xFFFF) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INTERNAL) + << "The limit of global values, 65535, was exceeded;" + << " " << num_global_values << " global values were found."; + + // Process functions and their basic blocks + for (const auto& module : input_modules) { + for (const auto& func : *module) { + std::unique_ptr cloned_func(func.Clone(linked_context)); + linked_module->AddFunction(std::move(cloned_func)); + } + } + + return SPV_SUCCESS; +} + +spv_result_t GetImportExportPairs(const MessageConsumer& consumer, + const opt::IRContext& linked_context, + const DefUseManager& def_use_manager, + const DecorationManager& decoration_manager, + bool allow_partial_linkage, + LinkageTable* linkings_to_do) { + spv_position_t position = {}; + + if (linkings_to_do == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|linkings_to_do| of GetImportExportPairs should not be empty."; + + std::vector imports; + std::unordered_map> exports; + + // Figure out the imports and exports + for (const auto& decoration : linked_context.annotations()) { + if (decoration.opcode() != SpvOpDecorate || + decoration.GetSingleWordInOperand(1u) != SpvDecorationLinkageAttributes) + continue; + + const SpvId id = decoration.GetSingleWordInOperand(0u); + // Ignore if the targeted symbol is a built-in + bool is_built_in = false; + for (const auto& id_decoration : + decoration_manager.GetDecorationsFor(id, false)) { + if (id_decoration->GetSingleWordInOperand(1u) == SpvDecorationBuiltIn) { + is_built_in = true; + break; + } + } + if (is_built_in) { + continue; + } + + const uint32_t type = decoration.GetSingleWordInOperand(3u); + + LinkageSymbolInfo symbol_info; + symbol_info.name = + reinterpret_cast(decoration.GetInOperand(2u).words.data()); + symbol_info.id = id; + symbol_info.type_id = 0u; + + // Retrieve the type of the current symbol. This information will be used + // when checking that the imported and exported symbols have the same + // types. + const Instruction* def_inst = def_use_manager.GetDef(id); + if (def_inst == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "ID " << id << " is never defined:\n"; + + if (def_inst->opcode() == SpvOpVariable) { + symbol_info.type_id = def_inst->type_id(); + } else if (def_inst->opcode() == SpvOpFunction) { + symbol_info.type_id = def_inst->GetSingleWordInOperand(1u); + + // range-based for loop calls begin()/end(), but never cbegin()/cend(), + // which will not work here. + for (auto func_iter = linked_context.module()->cbegin(); + func_iter != linked_context.module()->cend(); ++func_iter) { + if (func_iter->result_id() != id) continue; + func_iter->ForEachParam([&symbol_info](const Instruction* inst) { + symbol_info.parameter_ids.push_back(inst->result_id()); + }); + } + } else { + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Only global variables and functions can be decorated using" + << " LinkageAttributes; " << id << " is neither of them.\n"; + } + + if (type == SpvLinkageTypeImport) + imports.push_back(symbol_info); + else if (type == SpvLinkageTypeExport) + exports[symbol_info.name].push_back(symbol_info); + } + + // Find the import/export pairs + for (const auto& import : imports) { + std::vector possible_exports; + const auto& exp = exports.find(import.name); + if (exp != exports.end()) possible_exports = exp->second; + if (possible_exports.empty() && !allow_partial_linkage) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Unresolved external reference to \"" << import.name << "\"."; + else if (possible_exports.size() > 1u) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Too many external references, " << possible_exports.size() + << ", were found for \"" << import.name << "\"."; + + if (!possible_exports.empty()) + linkings_to_do->emplace_back(import, possible_exports.front()); + } + + return SPV_SUCCESS; +} + +spv_result_t CheckImportExportCompatibility(const MessageConsumer& consumer, + const LinkageTable& linkings_to_do, + opt::IRContext* context) { + spv_position_t position = {}; + + // Ensure th import and export types are the same. + const DefUseManager& def_use_manager = *context->get_def_use_mgr(); + const DecorationManager& decoration_manager = *context->get_decoration_mgr(); + for (const auto& linking_entry : linkings_to_do) { + if (!RemoveDuplicatesPass::AreTypesEqual( + *def_use_manager.GetDef(linking_entry.imported_symbol.type_id), + *def_use_manager.GetDef(linking_entry.exported_symbol.type_id), + context)) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Type mismatch on symbol \"" + << linking_entry.imported_symbol.name + << "\" between imported variable/function %" + << linking_entry.imported_symbol.id + << " and exported variable/function %" + << linking_entry.exported_symbol.id << "."; + } + + // Ensure the import and export decorations are similar + for (const auto& linking_entry : linkings_to_do) { + if (!decoration_manager.HaveTheSameDecorations( + linking_entry.imported_symbol.id, linking_entry.exported_symbol.id)) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Decorations mismatch on symbol \"" + << linking_entry.imported_symbol.name + << "\" between imported variable/function %" + << linking_entry.imported_symbol.id + << " and exported variable/function %" + << linking_entry.exported_symbol.id << "."; + // TODO(pierremoreau): Decorations on function parameters should probably + // match, except for FuncParamAttr if I understand the + // spec correctly. + // TODO(pierremoreau): Decorations on the function return type should + // match, except for FuncParamAttr. + } + + return SPV_SUCCESS; +} + +spv_result_t RemoveLinkageSpecificInstructions( + const MessageConsumer& consumer, const LinkerOptions& options, + const LinkageTable& linkings_to_do, DecorationManager* decoration_manager, + opt::IRContext* linked_context) { + spv_position_t position = {}; + + if (decoration_manager == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|decoration_manager| of RemoveLinkageSpecificInstructions " + "should not be empty."; + if (linked_context == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_DATA) + << "|linked_module| of RemoveLinkageSpecificInstructions should not " + "be empty."; + + // TODO(pierremoreau): Remove FuncParamAttr decorations of imported + // functions' return type. + + // Remove FuncParamAttr decorations of imported functions' parameters. + // From the SPIR-V specification, Sec. 2.13: + // When resolving imported functions, the Function Control and all Function + // Parameter Attributes are taken from the function definition, and not + // from the function declaration. + for (const auto& linking_entry : linkings_to_do) { + for (const auto parameter_id : + linking_entry.imported_symbol.parameter_ids) { + decoration_manager->RemoveDecorationsFrom( + parameter_id, [](const Instruction& inst) { + return (inst.opcode() == SpvOpDecorate || + inst.opcode() == SpvOpMemberDecorate) && + inst.GetSingleWordInOperand(1u) == + SpvDecorationFuncParamAttr; + }); + } + } + + // Remove prototypes of imported functions + for (const auto& linking_entry : linkings_to_do) { + for (auto func_iter = linked_context->module()->begin(); + func_iter != linked_context->module()->end();) { + if (func_iter->result_id() == linking_entry.imported_symbol.id) + func_iter = func_iter.Erase(); + else + ++func_iter; + } + } + + // Remove declarations of imported variables + for (const auto& linking_entry : linkings_to_do) { + auto next = linked_context->types_values_begin(); + for (auto inst = next; inst != linked_context->types_values_end(); + inst = next) { + ++next; + if (inst->result_id() == linking_entry.imported_symbol.id) { + linked_context->KillInst(&*inst); + } + } + } + + // If partial linkage is allowed, we need an efficient way to check whether + // an imported ID had a corresponding export symbol. As uses of the imported + // symbol have already been replaced by the exported symbol, use the exported + // symbol ID. + // TODO(pierremoreau): This will not work if the decoration is applied + // through a group, but the linker does not support that + // either. + std::unordered_set imports; + if (options.GetAllowPartialLinkage()) { + imports.reserve(linkings_to_do.size()); + for (const auto& linking_entry : linkings_to_do) + imports.emplace(linking_entry.exported_symbol.id); + } + + // Remove import linkage attributes + auto next = linked_context->annotation_begin(); + for (auto inst = next; inst != linked_context->annotation_end(); + inst = next) { + ++next; + // If this is an import annotation: + // * if we do not allow partial linkage, remove all import annotations; + // * otherwise, remove the annotation only if there was a corresponding + // export. + if (inst->opcode() == SpvOpDecorate && + inst->GetSingleWordOperand(1u) == SpvDecorationLinkageAttributes && + inst->GetSingleWordOperand(3u) == SpvLinkageTypeImport && + (!options.GetAllowPartialLinkage() || + imports.find(inst->GetSingleWordOperand(0u)) != imports.end())) { + linked_context->KillInst(&*inst); + } + } + + // Remove export linkage attributes if making an executable + if (!options.GetCreateLibrary()) { + next = linked_context->annotation_begin(); + for (auto inst = next; inst != linked_context->annotation_end(); + inst = next) { + ++next; + if (inst->opcode() == SpvOpDecorate && + inst->GetSingleWordOperand(1u) == SpvDecorationLinkageAttributes && + inst->GetSingleWordOperand(3u) == SpvLinkageTypeExport) { + linked_context->KillInst(&*inst); + } + } + } + + // Remove Linkage capability if making an executable and partial linkage is + // not allowed + if (!options.GetCreateLibrary() && !options.GetAllowPartialLinkage()) { + for (auto& inst : linked_context->capabilities()) + if (inst.GetSingleWordInOperand(0u) == SpvCapabilityLinkage) { + linked_context->KillInst(&inst); + // The RemoveDuplicatesPass did remove duplicated capabilities, so we + // now there aren’t more SpvCapabilityLinkage further down. + break; + } + } + + return SPV_SUCCESS; +} + +spv_result_t VerifyIds(const MessageConsumer& consumer, + opt::IRContext* linked_context) { + std::unordered_set ids; + bool ok = true; + linked_context->module()->ForEachInst( + [&ids, &ok](const opt::Instruction* inst) { + ok &= ids.insert(inst->unique_id()).second; + }); + + if (!ok) { + consumer(SPV_MSG_INTERNAL_ERROR, "", {}, "Non-unique id in merged module"); + return SPV_ERROR_INVALID_ID; + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t Link(const Context& context, + const std::vector>& binaries, + std::vector* linked_binary, + const LinkerOptions& options) { + std::vector binary_ptrs; + binary_ptrs.reserve(binaries.size()); + std::vector binary_sizes; + binary_sizes.reserve(binaries.size()); + + for (const auto& binary : binaries) { + binary_ptrs.push_back(binary.data()); + binary_sizes.push_back(binary.size()); + } + + return Link(context, binary_ptrs.data(), binary_sizes.data(), binaries.size(), + linked_binary, options); +} + +spv_result_t Link(const Context& context, const uint32_t* const* binaries, + const size_t* binary_sizes, size_t num_binaries, + std::vector* linked_binary, + const LinkerOptions& options) { + spv_position_t position = {}; + const spv_context& c_context = context.CContext(); + const MessageConsumer& consumer = c_context->consumer; + + linked_binary->clear(); + if (num_binaries == 0u) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "No modules were given."; + + std::vector> ir_contexts; + std::vector modules; + modules.reserve(num_binaries); + for (size_t i = 0u; i < num_binaries; ++i) { + const uint32_t schema = binaries[i][4u]; + if (schema != 0u) { + position.index = 4u; + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Schema is non-zero for module " << i << "."; + } + + std::unique_ptr ir_context = BuildModule( + c_context->target_env, consumer, binaries[i], binary_sizes[i]); + if (ir_context == nullptr) + return DiagnosticStream(position, consumer, "", SPV_ERROR_INVALID_BINARY) + << "Failed to build a module out of " << ir_contexts.size() << "."; + modules.push_back(ir_context->module()); + ir_contexts.push_back(std::move(ir_context)); + } + + // Phase 1: Shift the IDs used in each binary so that they occupy a disjoint + // range from the other binaries, and compute the new ID bound. + uint32_t max_id_bound = 0u; + spv_result_t res = ShiftIdsInModules(consumer, &modules, &max_id_bound); + if (res != SPV_SUCCESS) return res; + + // Phase 2: Generate the header + opt::ModuleHeader header; + res = GenerateHeader(consumer, modules, max_id_bound, &header); + if (res != SPV_SUCCESS) return res; + IRContext linked_context(c_context->target_env, consumer); + linked_context.module()->SetHeader(header); + + // Phase 3: Merge all the binaries into a single one. + AssemblyGrammar grammar(c_context); + res = MergeModules(consumer, modules, grammar, &linked_context); + if (res != SPV_SUCCESS) return res; + + if (options.GetVerifyIds()) { + res = VerifyIds(consumer, &linked_context); + if (res != SPV_SUCCESS) return res; + } + + // Phase 4: Find the import/export pairs + LinkageTable linkings_to_do; + res = GetImportExportPairs(consumer, linked_context, + *linked_context.get_def_use_mgr(), + *linked_context.get_decoration_mgr(), + options.GetAllowPartialLinkage(), &linkings_to_do); + if (res != SPV_SUCCESS) return res; + + // Phase 5: Ensure the import and export have the same types and decorations. + res = + CheckImportExportCompatibility(consumer, linkings_to_do, &linked_context); + if (res != SPV_SUCCESS) return res; + + // Phase 6: Remove duplicates + PassManager manager; + manager.SetMessageConsumer(consumer); + manager.AddPass(); + opt::Pass::Status pass_res = manager.Run(&linked_context); + if (pass_res == opt::Pass::Status::Failure) return SPV_ERROR_INVALID_DATA; + + // Phase 7: Rematch import variables/functions to export variables/functions + for (const auto& linking_entry : linkings_to_do) + linked_context.ReplaceAllUsesWith(linking_entry.imported_symbol.id, + linking_entry.exported_symbol.id); + + // Phase 8: Remove linkage specific instructions, such as import/export + // attributes, linkage capability, etc. if applicable + res = RemoveLinkageSpecificInstructions(consumer, options, linkings_to_do, + linked_context.get_decoration_mgr(), + &linked_context); + if (res != SPV_SUCCESS) return res; + + // Phase 9: Compact the IDs used in the module + manager.AddPass(); + pass_res = manager.Run(&linked_context); + if (pass_res == opt::Pass::Status::Failure) return SPV_ERROR_INVALID_DATA; + + // Phase 10: Output the module + linked_context.module()->ToBinary(linked_binary, true); + + return SPV_SUCCESS; +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/macro.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/macro.h new file mode 100644 index 00000000000..7219ffed1f4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/macro.h @@ -0,0 +1,25 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_MACRO_H_ +#define SOURCE_MACRO_H_ + +// Evaluates to the number of elements of array A. +// +// If we could use constexpr, then we could make this a template function. +// If the source arrays were std::array, then we could have used +// std::array::size. +#define ARRAY_SIZE(A) (static_cast(sizeof(A) / sizeof(A[0]))) + +#endif // SOURCE_MACRO_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp new file mode 100644 index 00000000000..43fdfb34b57 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/name_mapper.cpp @@ -0,0 +1,331 @@ +// Copyright (c) 2016 Google 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. + +#include "source/name_mapper.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "spirv-tools/libspirv.h" + +#include "source/latest_version_spirv_header.h" +#include "source/parsed_operand.h" + +namespace spvtools { +namespace { + +// Converts a uint32_t to its string decimal representation. +std::string to_string(uint32_t id) { + // Use stringstream, since some versions of Android compilers lack + // std::to_string. + std::stringstream os; + os << id; + return os.str(); +} + +} // anonymous namespace + +NameMapper GetTrivialNameMapper() { return to_string; } + +FriendlyNameMapper::FriendlyNameMapper(const spv_const_context context, + const uint32_t* code, + const size_t wordCount) + : grammar_(AssemblyGrammar(context)) { + spv_diagnostic diag = nullptr; + // We don't care if the parse fails. + spvBinaryParse(context, this, code, wordCount, nullptr, + ParseInstructionForwarder, &diag); + spvDiagnosticDestroy(diag); +} + +std::string FriendlyNameMapper::NameForId(uint32_t id) { + auto iter = name_for_id_.find(id); + if (iter == name_for_id_.end()) { + // It must have been an invalid module, so just return a trivial mapping. + // We don't care about uniqueness. + return to_string(id); + } else { + return iter->second; + } +} + +std::string FriendlyNameMapper::Sanitize(const std::string& suggested_name) { + if (suggested_name.empty()) return "_"; + // Otherwise, replace invalid characters by '_'. + std::string result; + std::string valid = + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "_0123456789"; + std::transform(suggested_name.begin(), suggested_name.end(), + std::back_inserter(result), [&valid](const char c) { + return (std::string::npos == valid.find(c)) ? '_' : c; + }); + return result; +} + +void FriendlyNameMapper::SaveName(uint32_t id, + const std::string& suggested_name) { + if (name_for_id_.find(id) != name_for_id_.end()) return; + + const std::string sanitized_suggested_name = Sanitize(suggested_name); + std::string name = sanitized_suggested_name; + auto inserted = used_names_.insert(name); + if (!inserted.second) { + const std::string base_name = sanitized_suggested_name + "_"; + for (uint32_t index = 0; !inserted.second; ++index) { + name = base_name + to_string(index); + inserted = used_names_.insert(name); + } + } + name_for_id_[id] = name; +} + +void FriendlyNameMapper::SaveBuiltInName(uint32_t target_id, + uint32_t built_in) { +#define GLCASE(name) \ + case SpvBuiltIn##name: \ + SaveName(target_id, "gl_" #name); \ + return; +#define GLCASE2(name, suggested) \ + case SpvBuiltIn##name: \ + SaveName(target_id, "gl_" #suggested); \ + return; +#define CASE(name) \ + case SpvBuiltIn##name: \ + SaveName(target_id, #name); \ + return; + switch (built_in) { + GLCASE(Position) + GLCASE(PointSize) + GLCASE(ClipDistance) + GLCASE(CullDistance) + GLCASE2(VertexId, VertexID) + GLCASE2(InstanceId, InstanceID) + GLCASE2(PrimitiveId, PrimitiveID) + GLCASE2(InvocationId, InvocationID) + GLCASE(Layer) + GLCASE(ViewportIndex) + GLCASE(TessLevelOuter) + GLCASE(TessLevelInner) + GLCASE(TessCoord) + GLCASE(PatchVertices) + GLCASE(FragCoord) + GLCASE(PointCoord) + GLCASE(FrontFacing) + GLCASE2(SampleId, SampleID) + GLCASE(SamplePosition) + GLCASE(SampleMask) + GLCASE(FragDepth) + GLCASE(HelperInvocation) + GLCASE2(NumWorkgroups, NumWorkGroups) + GLCASE2(WorkgroupSize, WorkGroupSize) + GLCASE2(WorkgroupId, WorkGroupID) + GLCASE2(LocalInvocationId, LocalInvocationID) + GLCASE2(GlobalInvocationId, GlobalInvocationID) + GLCASE(LocalInvocationIndex) + CASE(WorkDim) + CASE(GlobalSize) + CASE(EnqueuedWorkgroupSize) + CASE(GlobalOffset) + CASE(GlobalLinearId) + CASE(SubgroupSize) + CASE(SubgroupMaxSize) + CASE(NumSubgroups) + CASE(NumEnqueuedSubgroups) + CASE(SubgroupId) + CASE(SubgroupLocalInvocationId) + GLCASE(VertexIndex) + GLCASE(InstanceIndex) + CASE(SubgroupEqMaskKHR) + CASE(SubgroupGeMaskKHR) + CASE(SubgroupGtMaskKHR) + CASE(SubgroupLeMaskKHR) + CASE(SubgroupLtMaskKHR) + default: + break; + } +#undef GLCASE +#undef GLCASE2 +#undef CASE +} + +spv_result_t FriendlyNameMapper::ParseInstruction( + const spv_parsed_instruction_t& inst) { + const auto result_id = inst.result_id; + switch (inst.opcode) { + case SpvOpName: + SaveName(inst.words[1], reinterpret_cast(inst.words + 2)); + break; + case SpvOpDecorate: + // Decorations come after OpName. So OpName will take precedence over + // decorations. + // + // In theory, we should also handle OpGroupDecorate. But that's unlikely + // to occur. + if (inst.words[2] == SpvDecorationBuiltIn) { + assert(inst.num_words > 3); + SaveBuiltInName(inst.words[1], inst.words[3]); + } + break; + case SpvOpTypeVoid: + SaveName(result_id, "void"); + break; + case SpvOpTypeBool: + SaveName(result_id, "bool"); + break; + case SpvOpTypeInt: { + std::string signedness; + std::string root; + const auto bit_width = inst.words[2]; + switch (bit_width) { + case 8: + root = "char"; + break; + case 16: + root = "short"; + break; + case 32: + root = "int"; + break; + case 64: + root = "long"; + break; + default: + root = to_string(bit_width); + signedness = "i"; + break; + } + if (0 == inst.words[3]) signedness = "u"; + SaveName(result_id, signedness + root); + } break; + case SpvOpTypeFloat: { + const auto bit_width = inst.words[2]; + switch (bit_width) { + case 16: + SaveName(result_id, "half"); + break; + case 32: + SaveName(result_id, "float"); + break; + case 64: + SaveName(result_id, "double"); + break; + default: + SaveName(result_id, std::string("fp") + to_string(bit_width)); + break; + } + } break; + case SpvOpTypeVector: + SaveName(result_id, std::string("v") + to_string(inst.words[3]) + + NameForId(inst.words[2])); + break; + case SpvOpTypeMatrix: + SaveName(result_id, std::string("mat") + to_string(inst.words[3]) + + NameForId(inst.words[2])); + break; + case SpvOpTypeArray: + SaveName(result_id, std::string("_arr_") + NameForId(inst.words[2]) + + "_" + NameForId(inst.words[3])); + break; + case SpvOpTypeRuntimeArray: + SaveName(result_id, + std::string("_runtimearr_") + NameForId(inst.words[2])); + break; + case SpvOpTypePointer: + SaveName(result_id, std::string("_ptr_") + + NameForEnumOperand(SPV_OPERAND_TYPE_STORAGE_CLASS, + inst.words[2]) + + "_" + NameForId(inst.words[3])); + break; + case SpvOpTypePipe: + SaveName(result_id, + std::string("Pipe") + + NameForEnumOperand(SPV_OPERAND_TYPE_ACCESS_QUALIFIER, + inst.words[2])); + break; + case SpvOpTypeEvent: + SaveName(result_id, "Event"); + break; + case SpvOpTypeDeviceEvent: + SaveName(result_id, "DeviceEvent"); + break; + case SpvOpTypeReserveId: + SaveName(result_id, "ReserveId"); + break; + case SpvOpTypeQueue: + SaveName(result_id, "Queue"); + break; + case SpvOpTypeOpaque: + SaveName(result_id, + std::string("Opaque_") + + Sanitize(reinterpret_cast(inst.words + 2))); + break; + case SpvOpTypePipeStorage: + SaveName(result_id, "PipeStorage"); + break; + case SpvOpTypeNamedBarrier: + SaveName(result_id, "NamedBarrier"); + break; + case SpvOpTypeStruct: + // Structs are mapped rather simplisitically. Just indicate that they + // are a struct and then give the raw Id number. + SaveName(result_id, std::string("_struct_") + to_string(result_id)); + break; + case SpvOpConstantTrue: + SaveName(result_id, "true"); + break; + case SpvOpConstantFalse: + SaveName(result_id, "false"); + break; + case SpvOpConstant: { + std::ostringstream value; + EmitNumericLiteral(&value, inst, inst.operands[2]); + auto value_str = value.str(); + // Use 'n' to signify negative. Other invalid characters will be mapped + // to underscore. + for (auto& c : value_str) + if (c == '-') c = 'n'; + SaveName(result_id, NameForId(inst.type_id) + "_" + value_str); + } break; + default: + // If this instruction otherwise defines an Id, then save a mapping for + // it. This is needed to ensure uniqueness in there is an OpName with + // string something like "1" that might collide with this result_id. + // We should only do this if a name hasn't already been registered by some + // previous forward reference. + if (result_id && name_for_id_.find(result_id) == name_for_id_.end()) + SaveName(result_id, to_string(result_id)); + break; + } + return SPV_SUCCESS; +} + +std::string FriendlyNameMapper::NameForEnumOperand(spv_operand_type_t type, + uint32_t word) { + spv_operand_desc desc = nullptr; + if (SPV_SUCCESS == grammar_.lookupOperand(type, word, &desc)) { + return desc->name; + } else { + // Invalid input. Just give something sane. + return std::string("StorageClass") + to_string(word); + } +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/name_mapper.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/name_mapper.h new file mode 100644 index 00000000000..6902141b198 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/name_mapper.h @@ -0,0 +1,122 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_NAME_MAPPER_H_ +#define SOURCE_NAME_MAPPER_H_ + +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// A NameMapper maps SPIR-V Id values to names. Each name is valid to use in +// SPIR-V assembly. The mapping is one-to-one, i.e. no two Ids map to the same +// name. +using NameMapper = std::function; + +// Returns a NameMapper which always maps an Id to its decimal representation. +NameMapper GetTrivialNameMapper(); + +// A FriendlyNameMapper parses a module upon construction. If the parse is +// successful, then the NameForId method maps an Id to a friendly name +// while also satisfying the constraints on a NameMapper. +// +// The mapping is friendly in the following sense: +// - If an Id has a debug name (via OpName), then that will be used when +// possible. +// - Well known scalar types map to friendly names. For example, +// OpTypeVoid should be %void. Scalar types map to their names in OpenCL +// when +// there is a correspondence, and otherwise as follows: +// - unsigned integer type of n bits map to "u" followed by n +// - signed integer type of n bits map to "i" followed by n +// - floating point type of n bits map to "fp" followed by n +// - Vector type names map to "v" followed by the number of components, +// followed by the friendly name for the base type. +// - Matrix type names map to "mat" followed by the number of columns, +// followed by the friendly name for the base vector type. +// - Pointer types map to "_ptr_", then the name of the storage class, then the +// name for the pointee type. +// - Exotic types like event, pipe, opaque, queue, reserve-id map to their own +// human readable names. +// - A struct type maps to "_struct_" followed by the raw Id number. That's +// pretty simplistic, but workable. +// - A built-in variable maps to its GLSL variable name. +// - Numeric literals in OpConstant map to a human-friendly name. +class FriendlyNameMapper { + public: + // Construct a friendly name mapper, and determine friendly names for each + // defined Id in the specified module. The module is specified by the code + // wordCount, and should be parseable in the specified context. + FriendlyNameMapper(const spv_const_context context, const uint32_t* code, + const size_t wordCount); + + // Returns a NameMapper which maps ids to the friendly names parsed from the + // module provided to the constructor. + NameMapper GetNameMapper() { + return [this](uint32_t id) { return this->NameForId(id); }; + } + + // Returns the friendly name for the given id. If the module parsed during + // construction is valid, then the mapping satisfies the rules for a + // NameMapper. + std::string NameForId(uint32_t id); + + private: + // Transforms the given string so that it is acceptable as an Id name in + // assembly language. Two distinct inputs can map to the same output. + std::string Sanitize(const std::string& suggested_name); + + // Records a name for the given id. If this id already has a name, then + // this is a no-op. If the id doesn't have a name, use the given + // suggested_name if it hasn't already been taken, and otherwise generate + // a new (unused) name based on the suggested name. + void SaveName(uint32_t id, const std::string& suggested_name); + + // Records a built-in variable name for target_id. If target_id already + // has a name then this is a no-op. + void SaveBuiltInName(uint32_t target_id, uint32_t built_in); + + // Collects information from the given parsed instruction to populate + // name_for_id_. Returns SPV_SUCCESS; + spv_result_t ParseInstruction(const spv_parsed_instruction_t& inst); + + // Forwards a parsed-instruction callback from the binary parser into the + // FriendlyNameMapper hidden inside the user_data parameter. + static spv_result_t ParseInstructionForwarder( + void* user_data, const spv_parsed_instruction_t* parsed_instruction) { + return reinterpret_cast(user_data)->ParseInstruction( + *parsed_instruction); + } + + // Returns the friendly name for an enumerant. + std::string NameForEnumOperand(spv_operand_type_t type, uint32_t word); + + // Maps an id to its friendly name. This will have an entry for each Id + // defined in the module. + std::unordered_map name_for_id_; + // The set of names that have a mapping in name_for_id_; + std::unordered_set used_names_; + // The assembly grammar for the current context. + const AssemblyGrammar grammar_; +}; + +} // namespace spvtools + +#endif // SOURCE_NAME_MAPPER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opcode.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opcode.cpp new file mode 100644 index 00000000000..af34b64605b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opcode.cpp @@ -0,0 +1,585 @@ +// Copyright (c) 2015-2016 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. + +#include "source/opcode.h" + +#include +#include + +#include +#include + +#include "source/instruction.h" +#include "source/macro.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" +#include "source/spirv_target_env.h" +#include "spirv-tools/libspirv.h" + +namespace { +struct OpcodeDescPtrLen { + const spv_opcode_desc_t* ptr; + uint32_t len; +}; + +#include "core.insts-unified1.inc" + +static const spv_opcode_table_t kOpcodeTable = {ARRAY_SIZE(kOpcodeTableEntries), + kOpcodeTableEntries}; + +// Represents a vendor tool entry in the SPIR-V XML Regsitry. +struct VendorTool { + uint32_t value; + const char* vendor; + const char* tool; // Might be empty string. + const char* vendor_tool; // Combiantion of vendor and tool. +}; + +const VendorTool vendor_tools[] = { +#include "generators.inc" +}; + +} // anonymous namespace + +// TODO(dneto): Move this to another file. It doesn't belong with opcode +// processing. +const char* spvGeneratorStr(uint32_t generator) { + auto where = std::find_if( + std::begin(vendor_tools), std::end(vendor_tools), + [generator](const VendorTool& vt) { return generator == vt.value; }); + if (where != std::end(vendor_tools)) return where->vendor_tool; + return "Unknown"; +} + +uint32_t spvOpcodeMake(uint16_t wordCount, SpvOp opcode) { + return ((uint32_t)opcode) | (((uint32_t)wordCount) << 16); +} + +void spvOpcodeSplit(const uint32_t word, uint16_t* pWordCount, + uint16_t* pOpcode) { + if (pWordCount) { + *pWordCount = (uint16_t)((0xffff0000 & word) >> 16); + } + if (pOpcode) { + *pOpcode = 0x0000ffff & word; + } +} + +spv_result_t spvOpcodeTableGet(spv_opcode_table* pInstTable, spv_target_env) { + if (!pInstTable) return SPV_ERROR_INVALID_POINTER; + + // Descriptions of each opcode. Each entry describes the format of the + // instruction that follows a particular opcode. + + *pInstTable = &kOpcodeTable; + return SPV_SUCCESS; +} + +spv_result_t spvOpcodeTableNameLookup(spv_target_env env, + const spv_opcode_table table, + const char* name, + spv_opcode_desc* pEntry) { + if (!name || !pEntry) return SPV_ERROR_INVALID_POINTER; + if (!table) return SPV_ERROR_INVALID_TABLE; + + // TODO: This lookup of the Opcode table is suboptimal! Binary sort would be + // preferable but the table requires sorting on the Opcode name, but it's + // static const initialized and matches the order of the spec. + const size_t nameLength = strlen(name); + for (uint64_t opcodeIndex = 0; opcodeIndex < table->count; ++opcodeIndex) { + const spv_opcode_desc_t& entry = table->entries[opcodeIndex]; + // We considers the current opcode as available as long as + // 1. The target environment satisfies the minimal requirement of the + // opcode; or + // 2. There is at least one extension enabling this opcode. + // + // Note that the second rule assumes the extension enabling this instruction + // is indeed requested in the SPIR-V code; checking that should be + // validator's work. + if ((spvVersionForTargetEnv(env) >= entry.minVersion || + entry.numExtensions > 0u || entry.numCapabilities > 0u) && + nameLength == strlen(entry.name) && + !strncmp(name, entry.name, nameLength)) { + // NOTE: Found out Opcode! + *pEntry = &entry; + return SPV_SUCCESS; + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} + +spv_result_t spvOpcodeTableValueLookup(spv_target_env env, + const spv_opcode_table table, + const SpvOp opcode, + spv_opcode_desc* pEntry) { + if (!table) return SPV_ERROR_INVALID_TABLE; + if (!pEntry) return SPV_ERROR_INVALID_POINTER; + + const auto beg = table->entries; + const auto end = table->entries + table->count; + + spv_opcode_desc_t needle = {"", opcode, 0, nullptr, 0, {}, + false, false, 0, nullptr, ~0u}; + + auto comp = [](const spv_opcode_desc_t& lhs, const spv_opcode_desc_t& rhs) { + return lhs.opcode < rhs.opcode; + }; + + // We need to loop here because there can exist multiple symbols for the same + // opcode value, and they can be introduced in different target environments, + // which means they can have different minimal version requirements. + // Assumes the underlying table is already sorted ascendingly according to + // opcode value. + for (auto it = std::lower_bound(beg, end, needle, comp); + it != end && it->opcode == opcode; ++it) { + // We considers the current opcode as available as long as + // 1. The target environment satisfies the minimal requirement of the + // opcode; or + // 2. There is at least one extension enabling this opcode. + // + // Note that the second rule assumes the extension enabling this instruction + // is indeed requested in the SPIR-V code; checking that should be + // validator's work. + if (spvVersionForTargetEnv(env) >= it->minVersion || + it->numExtensions > 0u || it->numCapabilities > 0u) { + *pEntry = it; + return SPV_SUCCESS; + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} + +void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, + const uint16_t wordCount, const spv_endianness_t endian, + spv_instruction_t* pInst) { + pInst->opcode = opcode; + pInst->words.resize(wordCount); + for (uint16_t wordIndex = 0; wordIndex < wordCount; ++wordIndex) { + pInst->words[wordIndex] = spvFixWord(words[wordIndex], endian); + if (!wordIndex) { + uint16_t thisWordCount; + uint16_t thisOpcode; + spvOpcodeSplit(pInst->words[wordIndex], &thisWordCount, &thisOpcode); + assert(opcode == static_cast(thisOpcode) && + wordCount == thisWordCount && "Endianness failed!"); + } + } +} + +const char* spvOpcodeString(const SpvOp opcode) { + const auto beg = kOpcodeTableEntries; + const auto end = kOpcodeTableEntries + ARRAY_SIZE(kOpcodeTableEntries); + spv_opcode_desc_t needle = {"", opcode, 0, nullptr, 0, {}, + false, false, 0, nullptr, ~0u}; + auto comp = [](const spv_opcode_desc_t& lhs, const spv_opcode_desc_t& rhs) { + return lhs.opcode < rhs.opcode; + }; + auto it = std::lower_bound(beg, end, needle, comp); + if (it != end && it->opcode == opcode) { + return it->name; + } + + assert(0 && "Unreachable!"); + return "unknown"; +} + +int32_t spvOpcodeIsScalarType(const SpvOp opcode) { + switch (opcode) { + case SpvOpTypeInt: + case SpvOpTypeFloat: + case SpvOpTypeBool: + return true; + default: + return false; + } +} + +int32_t spvOpcodeIsSpecConstant(const SpvOp opcode) { + switch (opcode) { + case SpvOpSpecConstantTrue: + case SpvOpSpecConstantFalse: + case SpvOpSpecConstant: + case SpvOpSpecConstantComposite: + case SpvOpSpecConstantOp: + return true; + default: + return false; + } +} + +int32_t spvOpcodeIsConstant(const SpvOp opcode) { + switch (opcode) { + case SpvOpConstantTrue: + case SpvOpConstantFalse: + case SpvOpConstant: + case SpvOpConstantComposite: + case SpvOpConstantSampler: + case SpvOpConstantNull: + case SpvOpSpecConstantTrue: + case SpvOpSpecConstantFalse: + case SpvOpSpecConstant: + case SpvOpSpecConstantComposite: + case SpvOpSpecConstantOp: + return true; + default: + return false; + } +} + +bool spvOpcodeIsConstantOrUndef(const SpvOp opcode) { + return opcode == SpvOpUndef || spvOpcodeIsConstant(opcode); +} + +bool spvOpcodeIsScalarSpecConstant(const SpvOp opcode) { + switch (opcode) { + case SpvOpSpecConstantTrue: + case SpvOpSpecConstantFalse: + case SpvOpSpecConstant: + return true; + default: + return false; + } +} + +int32_t spvOpcodeIsComposite(const SpvOp opcode) { + switch (opcode) { + case SpvOpTypeVector: + case SpvOpTypeMatrix: + case SpvOpTypeArray: + case SpvOpTypeStruct: + return true; + default: + return false; + } +} + +bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode) { + switch (opcode) { + case SpvOpVariable: + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpFunctionParameter: + case SpvOpImageTexelPointer: + case SpvOpCopyObject: + case SpvOpSelect: + case SpvOpPhi: + case SpvOpFunctionCall: + case SpvOpPtrAccessChain: + case SpvOpLoad: + case SpvOpConstantNull: + return true; + default: + return false; + } +} + +int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode) { + switch (opcode) { + case SpvOpVariable: + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpFunctionParameter: + case SpvOpImageTexelPointer: + case SpvOpCopyObject: + return true; + default: + return false; + } +} + +int32_t spvOpcodeGeneratesType(SpvOp op) { + switch (op) { + case SpvOpTypeVoid: + case SpvOpTypeBool: + case SpvOpTypeInt: + case SpvOpTypeFloat: + case SpvOpTypeVector: + case SpvOpTypeMatrix: + case SpvOpTypeImage: + case SpvOpTypeSampler: + case SpvOpTypeSampledImage: + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: + case SpvOpTypeStruct: + case SpvOpTypeOpaque: + case SpvOpTypePointer: + case SpvOpTypeFunction: + case SpvOpTypeEvent: + case SpvOpTypeDeviceEvent: + case SpvOpTypeReserveId: + case SpvOpTypeQueue: + case SpvOpTypePipe: + case SpvOpTypePipeStorage: + case SpvOpTypeNamedBarrier: + return true; + default: + // In particular, OpTypeForwardPointer does not generate a type, + // but declares a storage class for a pointer type generated + // by a different instruction. + break; + } + return 0; +} + +bool spvOpcodeIsDecoration(const SpvOp opcode) { + switch (opcode) { + case SpvOpDecorate: + case SpvOpDecorateId: + case SpvOpMemberDecorate: + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: + case SpvOpDecorateStringGOOGLE: + case SpvOpMemberDecorateStringGOOGLE: + return true; + default: + break; + } + return false; +} + +bool spvOpcodeIsLoad(const SpvOp opcode) { + switch (opcode) { + case SpvOpLoad: + case SpvOpImageSampleExplicitLod: + case SpvOpImageSampleImplicitLod: + case SpvOpImageSampleDrefImplicitLod: + case SpvOpImageSampleDrefExplicitLod: + case SpvOpImageSampleProjImplicitLod: + case SpvOpImageSampleProjExplicitLod: + case SpvOpImageSampleProjDrefImplicitLod: + case SpvOpImageSampleProjDrefExplicitLod: + case SpvOpImageFetch: + case SpvOpImageGather: + case SpvOpImageDrefGather: + case SpvOpImageRead: + case SpvOpImageSparseSampleImplicitLod: + case SpvOpImageSparseSampleExplicitLod: + case SpvOpImageSparseSampleDrefExplicitLod: + case SpvOpImageSparseSampleDrefImplicitLod: + case SpvOpImageSparseFetch: + case SpvOpImageSparseGather: + case SpvOpImageSparseDrefGather: + case SpvOpImageSparseRead: + return true; + default: + return false; + } +} + +bool spvOpcodeIsBranch(SpvOp opcode) { + switch (opcode) { + case SpvOpBranch: + case SpvOpBranchConditional: + case SpvOpSwitch: + return true; + default: + return false; + } +} + +bool spvOpcodeIsAtomicOp(const 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: + return true; + default: + return false; + } +} + +bool spvOpcodeIsReturn(SpvOp opcode) { + switch (opcode) { + case SpvOpReturn: + case SpvOpReturnValue: + return true; + default: + return false; + } +} + +bool spvOpcodeIsReturnOrAbort(SpvOp opcode) { + return spvOpcodeIsReturn(opcode) || opcode == SpvOpKill || + opcode == SpvOpUnreachable; +} + +bool spvOpcodeIsBlockTerminator(SpvOp opcode) { + return spvOpcodeIsBranch(opcode) || spvOpcodeIsReturnOrAbort(opcode); +} + +bool spvOpcodeIsBaseOpaqueType(SpvOp opcode) { + switch (opcode) { + case SpvOpTypeImage: + case SpvOpTypeSampler: + case SpvOpTypeSampledImage: + case SpvOpTypeOpaque: + case SpvOpTypeEvent: + case SpvOpTypeDeviceEvent: + case SpvOpTypeReserveId: + case SpvOpTypeQueue: + case SpvOpTypePipe: + case SpvOpTypeForwardPointer: + case SpvOpTypePipeStorage: + case SpvOpTypeNamedBarrier: + return true; + default: + return false; + } +} + +bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode) { + switch (opcode) { + case SpvOpGroupNonUniformElect: + case SpvOpGroupNonUniformAll: + case SpvOpGroupNonUniformAny: + case SpvOpGroupNonUniformAllEqual: + case SpvOpGroupNonUniformBroadcast: + case SpvOpGroupNonUniformBroadcastFirst: + case SpvOpGroupNonUniformBallot: + case SpvOpGroupNonUniformInverseBallot: + case SpvOpGroupNonUniformBallotBitExtract: + case SpvOpGroupNonUniformBallotBitCount: + case SpvOpGroupNonUniformBallotFindLSB: + case SpvOpGroupNonUniformBallotFindMSB: + case SpvOpGroupNonUniformShuffle: + case SpvOpGroupNonUniformShuffleXor: + case SpvOpGroupNonUniformShuffleUp: + case SpvOpGroupNonUniformShuffleDown: + case SpvOpGroupNonUniformIAdd: + case SpvOpGroupNonUniformFAdd: + case SpvOpGroupNonUniformIMul: + case SpvOpGroupNonUniformFMul: + case SpvOpGroupNonUniformSMin: + case SpvOpGroupNonUniformUMin: + case SpvOpGroupNonUniformFMin: + case SpvOpGroupNonUniformSMax: + case SpvOpGroupNonUniformUMax: + case SpvOpGroupNonUniformFMax: + case SpvOpGroupNonUniformBitwiseAnd: + case SpvOpGroupNonUniformBitwiseOr: + case SpvOpGroupNonUniformBitwiseXor: + case SpvOpGroupNonUniformLogicalAnd: + case SpvOpGroupNonUniformLogicalOr: + case SpvOpGroupNonUniformLogicalXor: + case SpvOpGroupNonUniformQuadBroadcast: + case SpvOpGroupNonUniformQuadSwap: + return true; + default: + return false; + } +} + +bool spvOpcodeIsScalarizable(SpvOp opcode) { + switch (opcode) { + case SpvOpPhi: + case SpvOpCopyObject: + case SpvOpConvertFToU: + case SpvOpConvertFToS: + case SpvOpConvertSToF: + case SpvOpConvertUToF: + case SpvOpUConvert: + case SpvOpSConvert: + case SpvOpFConvert: + case SpvOpQuantizeToF16: + case SpvOpVectorInsertDynamic: + case SpvOpSNegate: + case SpvOpFNegate: + case SpvOpIAdd: + case SpvOpFAdd: + case SpvOpISub: + case SpvOpFSub: + case SpvOpIMul: + case SpvOpFMul: + case SpvOpUDiv: + case SpvOpSDiv: + case SpvOpFDiv: + case SpvOpUMod: + case SpvOpSRem: + case SpvOpSMod: + case SpvOpFRem: + case SpvOpFMod: + case SpvOpVectorTimesScalar: + case SpvOpIAddCarry: + case SpvOpISubBorrow: + case SpvOpUMulExtended: + case SpvOpSMulExtended: + case SpvOpShiftRightLogical: + case SpvOpShiftRightArithmetic: + case SpvOpShiftLeftLogical: + case SpvOpBitwiseOr: + case SpvOpBitwiseAnd: + case SpvOpNot: + case SpvOpBitFieldInsert: + case SpvOpBitFieldSExtract: + case SpvOpBitFieldUExtract: + case SpvOpBitReverse: + case SpvOpBitCount: + case SpvOpIsNan: + case SpvOpIsInf: + case SpvOpIsFinite: + case SpvOpIsNormal: + case SpvOpSignBitSet: + case SpvOpLessOrGreater: + case SpvOpOrdered: + case SpvOpUnordered: + case SpvOpLogicalEqual: + case SpvOpLogicalNotEqual: + case SpvOpLogicalOr: + case SpvOpLogicalAnd: + case SpvOpLogicalNot: + case SpvOpSelect: + case SpvOpIEqual: + case SpvOpINotEqual: + case SpvOpUGreaterThan: + case SpvOpSGreaterThan: + case SpvOpUGreaterThanEqual: + case SpvOpSGreaterThanEqual: + case SpvOpULessThan: + case SpvOpSLessThan: + case SpvOpULessThanEqual: + case SpvOpSLessThanEqual: + case SpvOpFOrdEqual: + case SpvOpFUnordEqual: + case SpvOpFOrdNotEqual: + case SpvOpFUnordNotEqual: + case SpvOpFOrdLessThan: + case SpvOpFUnordLessThan: + case SpvOpFOrdGreaterThan: + case SpvOpFUnordGreaterThan: + case SpvOpFOrdLessThanEqual: + case SpvOpFUnordLessThanEqual: + case SpvOpFOrdGreaterThanEqual: + case SpvOpFUnordGreaterThanEqual: + return true; + default: + return false; + } +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opcode.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opcode.h new file mode 100644 index 00000000000..5643a64c8b2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opcode.h @@ -0,0 +1,128 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_OPCODE_H_ +#define SOURCE_OPCODE_H_ + +#include "source/instruction.h" +#include "source/latest_version_spirv_header.h" +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +// Returns the name of a registered SPIR-V generator as a null-terminated +// string. If the generator is not known, then returns the string "Unknown". +// The generator parameter should be most significant 16-bits of the generator +// word in the SPIR-V module header. +// +// See the registry at https://www.khronos.org/registry/spir-v/api/spir-v.xml. +const char* spvGeneratorStr(uint32_t generator); + +// Combines word_count and opcode enumerant in single word. +uint32_t spvOpcodeMake(uint16_t word_count, SpvOp opcode); + +// Splits word into into two constituent parts: word_count and opcode. +void spvOpcodeSplit(const uint32_t word, uint16_t* word_count, + uint16_t* opcode); + +// Finds the named opcode in the given opcode table. On success, returns +// SPV_SUCCESS and writes a handle of the table entry into *entry. +spv_result_t spvOpcodeTableNameLookup(spv_target_env, + const spv_opcode_table table, + const char* name, spv_opcode_desc* entry); + +// Finds the opcode by enumerant in the given opcode table. On success, returns +// SPV_SUCCESS and writes a handle of the table entry into *entry. +spv_result_t spvOpcodeTableValueLookup(spv_target_env, + const spv_opcode_table table, + const SpvOp opcode, + spv_opcode_desc* entry); + +// Copies an instruction's word and fixes the endianness to host native. The +// source instruction's stream/opcode/endianness is in the words/opcode/endian +// parameter. The word_count parameter specifies the number of words to copy. +// Writes copied instruction into *inst. +void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, + const uint16_t word_count, + const spv_endianness_t endian, spv_instruction_t* inst); + +// Gets the name of an instruction, without the "Op" prefix. +const char* spvOpcodeString(const SpvOp opcode); + +// Determine if the given opcode is a scalar type. Returns zero if false, +// non-zero otherwise. +int32_t spvOpcodeIsScalarType(const SpvOp opcode); + +// Determines if the given opcode is a specialization constant. Returns zero if +// false, non-zero otherwise. +int32_t spvOpcodeIsSpecConstant(const SpvOp opcode); + +// Determines if the given opcode is a constant. Returns zero if false, non-zero +// otherwise. +int32_t spvOpcodeIsConstant(const SpvOp opcode); + +// Returns true if the given opcode is a constant or undef. +bool spvOpcodeIsConstantOrUndef(const SpvOp opcode); + +// Returns true if the given opcode is a scalar specialization constant. +bool spvOpcodeIsScalarSpecConstant(const SpvOp opcode); + +// Determines if the given opcode is a composite type. Returns zero if false, +// non-zero otherwise. +int32_t spvOpcodeIsComposite(const SpvOp opcode); + +// Determines if the given opcode results in a pointer when using the logical +// addressing model. Returns zero if false, non-zero otherwise. +int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode); + +// Returns whether the given opcode could result in a pointer or a variable +// pointer when using the logical addressing model. +bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode); + +// Determines if the given opcode generates a type. Returns zero if false, +// non-zero otherwise. +int32_t spvOpcodeGeneratesType(SpvOp opcode); + +// Returns true if the opcode adds a decoration to an id. +bool spvOpcodeIsDecoration(const SpvOp opcode); + +// Returns true if the opcode is a load from memory into a result id. This +// function only considers core instructions. +bool spvOpcodeIsLoad(const SpvOp opcode); + +// Returns true if the opcode is an atomic operation. +bool spvOpcodeIsAtomicOp(const SpvOp opcode); + +// Returns true if the given opcode is a branch instruction. +bool spvOpcodeIsBranch(SpvOp opcode); + +// Returns true if the given opcode is a return instruction. +bool spvOpcodeIsReturn(SpvOp opcode); + +// Returns true if the given opcode is a return instruction or it aborts +// execution. +bool spvOpcodeIsReturnOrAbort(SpvOp opcode); + +// Returns true if the given opcode is a basic block terminator. +bool spvOpcodeIsBlockTerminator(SpvOp opcode); + +// Returns true if the given opcode always defines an opaque type. +bool spvOpcodeIsBaseOpaqueType(SpvOp opcode); + +// Returns true if the given opcode is a non-uniform group operation. +bool spvOpcodeIsNonUniformGroupOperation(SpvOp opcode); + +// Returns true if the opcode with vector inputs could be divided into a series +// of independent scalar operations that would give the same result. +bool spvOpcodeIsScalarizable(SpvOp opcode); +#endif // SOURCE_OPCODE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/operand.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/operand.cpp new file mode 100644 index 00000000000..c97b13fc654 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/operand.cpp @@ -0,0 +1,474 @@ +// Copyright (c) 2015-2016 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. + +#include "source/operand.h" + +#include +#include +#include + +#include "source/macro.h" +#include "source/spirv_constant.h" +#include "source/spirv_target_env.h" + +// For now, assume unified1 contains up to SPIR-V 1.3 and no later +// SPIR-V version. +// TODO(dneto): Make one set of tables, but with version tags on a +// per-item basis. https://github.com/KhronosGroup/SPIRV-Tools/issues/1195 + +#include "operand.kinds-unified1.inc" + +static const spv_operand_table_t kOperandTable = { + ARRAY_SIZE(pygen_variable_OperandInfoTable), + pygen_variable_OperandInfoTable}; + +spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable, + spv_target_env) { + if (!pOperandTable) return SPV_ERROR_INVALID_POINTER; + + *pOperandTable = &kOperandTable; + return SPV_SUCCESS; +} + +spv_result_t spvOperandTableNameLookup(spv_target_env env, + const spv_operand_table table, + const spv_operand_type_t type, + const char* name, + const size_t nameLength, + spv_operand_desc* pEntry) { + if (!table) return SPV_ERROR_INVALID_TABLE; + if (!name || !pEntry) return SPV_ERROR_INVALID_POINTER; + + for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) { + const auto& group = table->types[typeIndex]; + if (type != group.type) continue; + for (uint64_t index = 0; index < group.count; ++index) { + const auto& entry = group.entries[index]; + // We consider the current operand as available as long as + // 1. The target environment satisfies the minimal requirement of the + // operand; or + // 2. There is at least one extension enabling this operand; or + // 3. There is at least one capability enabling this operand. + // + // Note that the second rule assumes the extension enabling this operand + // is indeed requested in the SPIR-V code; checking that should be + // validator's work. + if ((spvVersionForTargetEnv(env) >= entry.minVersion || + entry.numExtensions > 0u || entry.numCapabilities > 0u) && + nameLength == strlen(entry.name) && + !strncmp(entry.name, name, nameLength)) { + *pEntry = &entry; + return SPV_SUCCESS; + } + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} + +spv_result_t spvOperandTableValueLookup(spv_target_env env, + const spv_operand_table table, + const spv_operand_type_t type, + const uint32_t value, + spv_operand_desc* pEntry) { + if (!table) return SPV_ERROR_INVALID_TABLE; + if (!pEntry) return SPV_ERROR_INVALID_POINTER; + + spv_operand_desc_t needle = {"", value, 0, nullptr, 0, nullptr, {}, ~0u}; + + auto comp = [](const spv_operand_desc_t& lhs, const spv_operand_desc_t& rhs) { + return lhs.value < rhs.value; + }; + + for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) { + const auto& group = table->types[typeIndex]; + if (type != group.type) continue; + + const auto beg = group.entries; + const auto end = group.entries + group.count; + + // We need to loop here because there can exist multiple symbols for the + // same operand value, and they can be introduced in different target + // environments, which means they can have different minimal version + // requirements. For example, SubgroupEqMaskKHR can exist in any SPIR-V + // version as long as the SPV_KHR_shader_ballot extension is there; but + // starting from SPIR-V 1.3, SubgroupEqMask, which has the same numeric + // value as SubgroupEqMaskKHR, is available in core SPIR-V without extension + // requirements. + // Assumes the underlying table is already sorted ascendingly according to + // opcode value. + for (auto it = std::lower_bound(beg, end, needle, comp); + it != end && it->value == value; ++it) { + // We consider the current operand as available as long as + // 1. The target environment satisfies the minimal requirement of the + // operand; or + // 2. There is at least one extension enabling this operand; or + // 3. There is at least one capability enabling this operand. + // + // Note that the second rule assumes the extension enabling this operand + // is indeed requested in the SPIR-V code; checking that should be + // validator's work. + if (spvVersionForTargetEnv(env) >= it->minVersion || + it->numExtensions > 0u || it->numCapabilities > 0u) { + *pEntry = it; + return SPV_SUCCESS; + } + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} + +const char* spvOperandTypeStr(spv_operand_type_t type) { + switch (type) { + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: + return "ID"; + case SPV_OPERAND_TYPE_TYPE_ID: + return "type ID"; + case SPV_OPERAND_TYPE_RESULT_ID: + return "result ID"; + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER: + return "literal number"; + case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: + return "possibly multi-word literal integer"; + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: + return "possibly multi-word literal number"; + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: + return "extension instruction number"; + case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: + return "OpSpecConstantOp opcode"; + case SPV_OPERAND_TYPE_LITERAL_STRING: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: + return "literal string"; + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: + return "source language"; + case SPV_OPERAND_TYPE_EXECUTION_MODEL: + return "execution model"; + case SPV_OPERAND_TYPE_ADDRESSING_MODEL: + return "addressing model"; + case SPV_OPERAND_TYPE_MEMORY_MODEL: + return "memory model"; + case SPV_OPERAND_TYPE_EXECUTION_MODE: + return "execution mode"; + case SPV_OPERAND_TYPE_STORAGE_CLASS: + return "storage class"; + case SPV_OPERAND_TYPE_DIMENSIONALITY: + return "dimensionality"; + case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: + return "sampler addressing mode"; + case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: + return "sampler filter mode"; + case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: + return "image format"; + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + return "floating-point fast math mode"; + case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: + return "floating-point rounding mode"; + case SPV_OPERAND_TYPE_LINKAGE_TYPE: + return "linkage type"; + case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER: + return "access qualifier"; + case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: + return "function parameter attribute"; + case SPV_OPERAND_TYPE_DECORATION: + return "decoration"; + case SPV_OPERAND_TYPE_BUILT_IN: + return "built-in"; + case SPV_OPERAND_TYPE_SELECTION_CONTROL: + return "selection control"; + case SPV_OPERAND_TYPE_LOOP_CONTROL: + return "loop control"; + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + return "function control"; + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + return "memory semantics ID"; + case SPV_OPERAND_TYPE_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: + return "memory access"; + case SPV_OPERAND_TYPE_SCOPE_ID: + return "scope ID"; + case SPV_OPERAND_TYPE_GROUP_OPERATION: + return "group operation"; + case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: + return "kernel enqeue flags"; + case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: + return "kernel profiling info"; + case SPV_OPERAND_TYPE_CAPABILITY: + return "capability"; + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: + return "image"; + case SPV_OPERAND_TYPE_OPTIONAL_CIV: + return "context-insensitive value"; + case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: + return "debug info flags"; + case SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING: + return "debug base type encoding"; + case SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE: + return "debug composite type"; + case SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER: + return "debug type qualifier"; + case SPV_OPERAND_TYPE_DEBUG_OPERATION: + return "debug operation"; + + // The next values are for values returned from an instruction, not actually + // an operand. So the specific strings don't matter. But let's add them + // for completeness and ease of testing. + case SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER: + return "image channel order"; + case SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE: + return "image channel data type"; + + case SPV_OPERAND_TYPE_NONE: + return "NONE"; + default: + assert(0 && "Unhandled operand type!"); + break; + } + return "unknown"; +} + +void spvPushOperandTypes(const spv_operand_type_t* types, + spv_operand_pattern_t* pattern) { + const spv_operand_type_t* endTypes; + for (endTypes = types; *endTypes != SPV_OPERAND_TYPE_NONE; ++endTypes) { + } + + while (endTypes-- != types) { + pattern->push_back(*endTypes); + } +} + +void spvPushOperandTypesForMask(spv_target_env env, + const spv_operand_table operandTable, + const spv_operand_type_t type, + const uint32_t mask, + spv_operand_pattern_t* pattern) { + // Scan from highest bits to lowest bits because we will append in LIFO + // fashion, and we need the operands for lower order bits to be consumed first + for (uint32_t candidate_bit = (1u << 31u); candidate_bit; + candidate_bit >>= 1) { + if (candidate_bit & mask) { + spv_operand_desc entry = nullptr; + if (SPV_SUCCESS == spvOperandTableValueLookup(env, operandTable, type, + candidate_bit, &entry)) { + spvPushOperandTypes(entry->operandTypes, pattern); + } + } + } +} + +bool spvOperandIsConcrete(spv_operand_type_t type) { + if (spvIsIdType(type) || spvOperandIsConcreteMask(type)) { + return true; + } + switch (type) { + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: + case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: + case SPV_OPERAND_TYPE_LITERAL_STRING: + case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: + case SPV_OPERAND_TYPE_EXECUTION_MODEL: + case SPV_OPERAND_TYPE_ADDRESSING_MODEL: + case SPV_OPERAND_TYPE_MEMORY_MODEL: + case SPV_OPERAND_TYPE_EXECUTION_MODE: + case SPV_OPERAND_TYPE_STORAGE_CLASS: + case SPV_OPERAND_TYPE_DIMENSIONALITY: + case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: + case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: + case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: + case SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER: + case SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE: + case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: + case SPV_OPERAND_TYPE_LINKAGE_TYPE: + case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: + case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: + case SPV_OPERAND_TYPE_DECORATION: + case SPV_OPERAND_TYPE_BUILT_IN: + case SPV_OPERAND_TYPE_GROUP_OPERATION: + case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: + case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: + case SPV_OPERAND_TYPE_CAPABILITY: + case SPV_OPERAND_TYPE_DEBUG_BASE_TYPE_ATTRIBUTE_ENCODING: + case SPV_OPERAND_TYPE_DEBUG_COMPOSITE_TYPE: + case SPV_OPERAND_TYPE_DEBUG_TYPE_QUALIFIER: + case SPV_OPERAND_TYPE_DEBUG_OPERATION: + return true; + default: + break; + } + return false; +} + +bool spvOperandIsConcreteMask(spv_operand_type_t type) { + switch (type) { + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + case SPV_OPERAND_TYPE_SELECTION_CONTROL: + case SPV_OPERAND_TYPE_LOOP_CONTROL: + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + case SPV_OPERAND_TYPE_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: + return true; + default: + break; + } + return false; +} + +bool spvOperandIsOptional(spv_operand_type_t type) { + return SPV_OPERAND_TYPE_FIRST_OPTIONAL_TYPE <= type && + type <= SPV_OPERAND_TYPE_LAST_OPTIONAL_TYPE; +} + +bool spvOperandIsVariable(spv_operand_type_t type) { + return SPV_OPERAND_TYPE_FIRST_VARIABLE_TYPE <= type && + type <= SPV_OPERAND_TYPE_LAST_VARIABLE_TYPE; +} + +bool spvExpandOperandSequenceOnce(spv_operand_type_t type, + spv_operand_pattern_t* pattern) { + switch (type) { + case SPV_OPERAND_TYPE_VARIABLE_ID: + pattern->push_back(type); + pattern->push_back(SPV_OPERAND_TYPE_OPTIONAL_ID); + return true; + case SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER: + pattern->push_back(type); + pattern->push_back(SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER); + return true; + case SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER_ID: + // Represents Zero or more (Literal number, Id) pairs, + // where the literal number must be a scalar integer. + pattern->push_back(type); + pattern->push_back(SPV_OPERAND_TYPE_ID); + pattern->push_back(SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER); + return true; + case SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER: + // Represents Zero or more (Id, Literal number) pairs. + pattern->push_back(type); + pattern->push_back(SPV_OPERAND_TYPE_LITERAL_INTEGER); + pattern->push_back(SPV_OPERAND_TYPE_OPTIONAL_ID); + return true; + default: + break; + } + return false; +} + +spv_operand_type_t spvTakeFirstMatchableOperand( + spv_operand_pattern_t* pattern) { + assert(!pattern->empty()); + spv_operand_type_t result; + do { + result = pattern->back(); + pattern->pop_back(); + } while (spvExpandOperandSequenceOnce(result, pattern)); + return result; +} + +spv_operand_pattern_t spvAlternatePatternFollowingImmediate( + const spv_operand_pattern_t& pattern) { + auto it = + std::find(pattern.crbegin(), pattern.crend(), SPV_OPERAND_TYPE_RESULT_ID); + if (it != pattern.crend()) { + spv_operand_pattern_t alternatePattern(it - pattern.crbegin() + 2, + SPV_OPERAND_TYPE_OPTIONAL_CIV); + alternatePattern[1] = SPV_OPERAND_TYPE_RESULT_ID; + return alternatePattern; + } + + // No result-id found, so just expect CIVs. + return {SPV_OPERAND_TYPE_OPTIONAL_CIV}; +} + +bool spvIsIdType(spv_operand_type_t type) { + switch (type) { + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + return true; + default: + return false; + } +} + +std::function spvOperandCanBeForwardDeclaredFunction( + SpvOp opcode) { + std::function out; + switch (opcode) { + case SpvOpExecutionMode: + case SpvOpExecutionModeId: + case SpvOpEntryPoint: + case SpvOpName: + case SpvOpMemberName: + case SpvOpSelectionMerge: + case SpvOpDecorate: + case SpvOpMemberDecorate: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + case SpvOpMemberDecorateStringGOOGLE: + case SpvOpTypeStruct: + case SpvOpBranch: + case SpvOpLoopMerge: + out = [](unsigned) { return true; }; + break; + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: + case SpvOpBranchConditional: + case SpvOpSwitch: + out = [](unsigned index) { return index != 0; }; + break; + + case SpvOpFunctionCall: + // The Function parameter. + out = [](unsigned index) { return index == 2; }; + break; + + case SpvOpPhi: + out = [](unsigned index) { return index > 1; }; + break; + + case SpvOpEnqueueKernel: + // The Invoke parameter. + out = [](unsigned index) { return index == 8; }; + break; + + case SpvOpGetKernelNDrangeSubGroupCount: + case SpvOpGetKernelNDrangeMaxSubGroupSize: + // The Invoke parameter. + out = [](unsigned index) { return index == 3; }; + break; + + case SpvOpGetKernelWorkGroupSize: + case SpvOpGetKernelPreferredWorkGroupSizeMultiple: + // The Invoke parameter. + out = [](unsigned index) { return index == 2; }; + break; + case SpvOpTypeForwardPointer: + out = [](unsigned index) { return index == 0; }; + break; + default: + out = [](unsigned) { return false; }; + break; + } + return out; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/operand.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/operand.h new file mode 100644 index 00000000000..76f16f7ae5b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/operand.h @@ -0,0 +1,141 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_OPERAND_H_ +#define SOURCE_OPERAND_H_ + +#include +#include + +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +// A sequence of operand types. +// +// A SPIR-V parser uses an operand pattern to describe what is expected +// next on the input. +// +// As we parse an instruction in text or binary form from left to right, +// we pop and push at the end of the pattern vector. Symbols later in the +// pattern vector are matched against the input before symbols earlier in the +// pattern vector are matched. + +// Using a vector in this way reduces memory traffic, which is good for +// performance. +using spv_operand_pattern_t = std::vector; + +// Finds the named operand in the table. The type parameter specifies the +// operand's group. A handle of the operand table entry for this operand will +// be written into *entry. +spv_result_t spvOperandTableNameLookup(spv_target_env, + const spv_operand_table table, + const spv_operand_type_t type, + const char* name, + const size_t name_length, + spv_operand_desc* entry); + +// Finds the operand with value in the table. The type parameter specifies the +// operand's group. A handle of the operand table entry for this operand will +// be written into *entry. +spv_result_t spvOperandTableValueLookup(spv_target_env, + const spv_operand_table table, + const spv_operand_type_t type, + const uint32_t value, + spv_operand_desc* entry); + +// Gets the name string of the non-variable operand type. +const char* spvOperandTypeStr(spv_operand_type_t type); + +// Returns true if the given type is concrete. +bool spvOperandIsConcrete(spv_operand_type_t type); + +// Returns true if the given type is concrete and also a mask. +bool spvOperandIsConcreteMask(spv_operand_type_t type); + +// Returns true if an operand of the given type is optional. +bool spvOperandIsOptional(spv_operand_type_t type); + +// Returns true if an operand type represents zero or more logical operands. +// +// Note that a single logical operand may still be a variable number of words. +// For example, a literal string may be many words, but is just one logical +// operand. +bool spvOperandIsVariable(spv_operand_type_t type); + +// Append a list of operand types to the end of the pattern vector. +// The types parameter specifies the source array of types, ending with +// SPV_OPERAND_TYPE_NONE. +void spvPushOperandTypes(const spv_operand_type_t* types, + spv_operand_pattern_t* pattern); + +// Appends the operands expected after the given typed mask onto the +// end of the given pattern. +// +// Each set bit in the mask represents zero or more operand types that should +// be appended onto the pattern. Operands for a less significant bit always +// appear after operands for a more significant bit. +// +// If a set bit is unknown, then we assume it has no operands. +void spvPushOperandTypesForMask(spv_target_env, + const spv_operand_table operand_table, + const spv_operand_type_t mask_type, + const uint32_t mask, + spv_operand_pattern_t* pattern); + +// Expands an operand type representing zero or more logical operands, +// exactly once. +// +// If the given type represents potentially several logical operands, +// then prepend the given pattern with the first expansion of the logical +// operands, followed by original type. Otherwise, don't modify the pattern. +// +// For example, the SPV_OPERAND_TYPE_VARIABLE_ID represents zero or more +// IDs. In that case we would prepend the pattern with SPV_OPERAND_TYPE_ID +// followed by SPV_OPERAND_TYPE_VARIABLE_ID again. +// +// This also applies to zero or more tuples of logical operands. In that case +// we prepend pattern with for the members of the tuple, followed by the +// original type argument. The pattern must encode the fact that if any part +// of the tuple is present, then all tuple members should be. So the first +// member of the tuple must be optional, and the remaining members +// non-optional. +// +// Returns true if we modified the pattern. +bool spvExpandOperandSequenceOnce(spv_operand_type_t type, + spv_operand_pattern_t* pattern); + +// Expands the first element in the pattern until it is a matchable operand +// type, then pops it off the front and returns it. The pattern must not be +// empty. +// +// A matchable operand type is anything other than a zero-or-more-items +// operand type. +spv_operand_type_t spvTakeFirstMatchableOperand(spv_operand_pattern_t* pattern); + +// Calculates the corresponding post-immediate alternate pattern, which allows +// a limited set of operand types. +spv_operand_pattern_t spvAlternatePatternFollowingImmediate( + const spv_operand_pattern_t& pattern); + +// Is the operand an ID? +bool spvIsIdType(spv_operand_type_t type); + +// Takes the opcode of an instruction and returns +// a function object that will return true if the index +// of the operand can be forward declared. This function will +// used in the SSA validation stage of the pipeline +std::function spvOperandCanBeForwardDeclaredFunction( + SpvOp opcode); + +#endif // SOURCE_OPERAND_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/CMakeLists.txt new file mode 100644 index 00000000000..83f92fe886f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/CMakeLists.txt @@ -0,0 +1,205 @@ +# Copyright (c) 2016 Google 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. +add_library(SPIRV-Tools-opt + aggressive_dead_code_elim_pass.h + basic_block.h + block_merge_pass.h + build_module.h + ccp_pass.h + cfg_cleanup_pass.h + cfg.h + combine_access_chains.h + common_uniform_elim_pass.h + compact_ids_pass.h + composite.h + const_folding_rules.h + constants.h + copy_prop_arrays.h + dead_branch_elim_pass.h + dead_insert_elim_pass.h + dead_variable_elimination.h + decoration_manager.h + def_use_manager.h + dominator_analysis.h + dominator_tree.h + eliminate_dead_constant_pass.h + eliminate_dead_functions_pass.h + feature_manager.h + flatten_decoration_pass.h + fold.h + folding_rules.h + fold_spec_constant_op_and_composite_pass.h + freeze_spec_constant_value_pass.h + function.h + if_conversion.h + inline_exhaustive_pass.h + inline_opaque_pass.h + inline_pass.h + instruction.h + instruction_list.h + ir_builder.h + ir_context.h + ir_loader.h + licm_pass.h + local_access_chain_convert_pass.h + local_redundancy_elimination.h + local_single_block_elim_pass.h + local_single_store_elim_pass.h + local_ssa_elim_pass.h + log.h + loop_dependence.h + loop_descriptor.h + loop_fission.h + loop_fusion.h + loop_fusion_pass.h + loop_peeling.h + loop_unroller.h + loop_utils.h + loop_unswitch_pass.h + mem_pass.h + merge_return_pass.h + module.h + null_pass.h + passes.h + pass.h + pass_manager.h + private_to_local_pass.h + propagator.h + reduce_load_size.h + redundancy_elimination.h + reflect.h + register_pressure.h + remove_duplicates_pass.h + replace_invalid_opc.h + scalar_analysis.h + scalar_analysis_nodes.h + scalar_replacement_pass.h + set_spec_constant_default_value_pass.h + simplification_pass.h + ssa_rewrite_pass.h + strength_reduction_pass.h + strip_debug_info_pass.h + strip_reflect_info_pass.h + tree_iterator.h + type_manager.h + types.h + unify_const_pass.h + value_number_table.h + vector_dce.h + workaround1209.h + + aggressive_dead_code_elim_pass.cpp + basic_block.cpp + block_merge_pass.cpp + build_module.cpp + ccp_pass.cpp + cfg_cleanup_pass.cpp + cfg.cpp + combine_access_chains.cpp + common_uniform_elim_pass.cpp + compact_ids_pass.cpp + composite.cpp + const_folding_rules.cpp + constants.cpp + copy_prop_arrays.cpp + dead_branch_elim_pass.cpp + dead_insert_elim_pass.cpp + dead_variable_elimination.cpp + decoration_manager.cpp + def_use_manager.cpp + dominator_analysis.cpp + dominator_tree.cpp + eliminate_dead_constant_pass.cpp + eliminate_dead_functions_pass.cpp + feature_manager.cpp + flatten_decoration_pass.cpp + fold.cpp + folding_rules.cpp + fold_spec_constant_op_and_composite_pass.cpp + freeze_spec_constant_value_pass.cpp + function.cpp + if_conversion.cpp + inline_exhaustive_pass.cpp + inline_opaque_pass.cpp + inline_pass.cpp + instruction.cpp + instruction_list.cpp + ir_context.cpp + ir_loader.cpp + licm_pass.cpp + local_access_chain_convert_pass.cpp + local_redundancy_elimination.cpp + local_single_block_elim_pass.cpp + local_single_store_elim_pass.cpp + local_ssa_elim_pass.cpp + loop_dependence.cpp + loop_dependence_helpers.cpp + loop_descriptor.cpp + loop_fission.cpp + loop_fusion.cpp + loop_fusion_pass.cpp + loop_peeling.cpp + loop_utils.cpp + loop_unroller.cpp + loop_unswitch_pass.cpp + mem_pass.cpp + merge_return_pass.cpp + module.cpp + optimizer.cpp + pass.cpp + pass_manager.cpp + private_to_local_pass.cpp + propagator.cpp + reduce_load_size.cpp + redundancy_elimination.cpp + register_pressure.cpp + remove_duplicates_pass.cpp + replace_invalid_opc.cpp + scalar_analysis.cpp + scalar_analysis_simplification.cpp + scalar_replacement_pass.cpp + set_spec_constant_default_value_pass.cpp + simplification_pass.cpp + ssa_rewrite_pass.cpp + strength_reduction_pass.cpp + strip_debug_info_pass.cpp + strip_reflect_info_pass.cpp + type_manager.cpp + types.cpp + unify_const_pass.cpp + value_number_table.cpp + vector_dce.cpp + workaround1209.cpp +) + +spvtools_default_compile_options(SPIRV-Tools-opt) +target_include_directories(SPIRV-Tools-opt + PUBLIC ${spirv-tools_SOURCE_DIR}/include + PUBLIC ${SPIRV_HEADER_INCLUDE_DIR} + PRIVATE ${spirv-tools_BINARY_DIR} +) +# We need the assembling and disassembling functionalities in the main library. +target_link_libraries(SPIRV-Tools-opt + PUBLIC ${SPIRV_TOOLS}) + +set_property(TARGET SPIRV-Tools-opt PROPERTY FOLDER "SPIRV-Tools libraries") +spvtools_check_symbol_exports(SPIRV-Tools-opt) + +if(ENABLE_SPIRV_TOOLS_INSTALL) + install(TARGETS SPIRV-Tools-opt + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif(ENABLE_SPIRV_TOOLS_INSTALL) + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp new file mode 100644 index 00000000000..faf278aa62a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp @@ -0,0 +1,756 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG Inc. +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/aggressive_dead_code_elim_pass.h" + +#include +#include + +#include "source/cfa.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/iterator.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kTypePointerStorageClassInIdx = 0; +const uint32_t kEntryPointFunctionIdInIdx = 1; +const uint32_t kSelectionMergeMergeBlockIdInIdx = 0; +const uint32_t kLoopMergeMergeBlockIdInIdx = 0; +const uint32_t kLoopMergeContinueBlockIdInIdx = 1; +const uint32_t kCopyMemoryTargetAddrInIdx = 0; +const uint32_t kCopyMemorySourceAddrInIdx = 1; + +// Sorting functor to present annotation instructions in an easy-to-process +// order. The functor orders by opcode first and falls back on unique id +// ordering if both instructions have the same opcode. +// +// Desired priority: +// SpvOpGroupDecorate +// SpvOpGroupMemberDecorate +// SpvOpDecorate +// SpvOpMemberDecorate +// SpvOpDecorateId +// SpvOpDecorateStringGOOGLE +// SpvOpDecorationGroup +struct DecorationLess { + bool operator()(const Instruction* lhs, const Instruction* rhs) const { + assert(lhs && rhs); + SpvOp lhsOp = lhs->opcode(); + SpvOp rhsOp = rhs->opcode(); + if (lhsOp != rhsOp) { +#define PRIORITY_CASE(opcode) \ + if (lhsOp == opcode && rhsOp != opcode) return true; \ + if (rhsOp == opcode && lhsOp != opcode) return false; + // OpGroupDecorate and OpGroupMember decorate are highest priority to + // eliminate dead targets early and simplify subsequent checks. + PRIORITY_CASE(SpvOpGroupDecorate) + PRIORITY_CASE(SpvOpGroupMemberDecorate) + PRIORITY_CASE(SpvOpDecorate) + PRIORITY_CASE(SpvOpMemberDecorate) + PRIORITY_CASE(SpvOpDecorateId) + PRIORITY_CASE(SpvOpDecorateStringGOOGLE) + // OpDecorationGroup is lowest priority to ensure use/def chains remain + // usable for instructions that target this group. + PRIORITY_CASE(SpvOpDecorationGroup) +#undef PRIORITY_CASE + } + + // Fall back to maintain total ordering (compare unique ids). + return *lhs < *rhs; + } +}; + +} // namespace + +bool AggressiveDCEPass::IsVarOfStorage(uint32_t varId, uint32_t storageClass) { + if (varId == 0) return false; + const Instruction* varInst = get_def_use_mgr()->GetDef(varId); + const SpvOp op = varInst->opcode(); + if (op != SpvOpVariable) return false; + const uint32_t varTypeId = varInst->type_id(); + const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); + if (varTypeInst->opcode() != SpvOpTypePointer) return false; + return varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) == + storageClass; +} + +bool AggressiveDCEPass::IsLocalVar(uint32_t varId) { + if (IsVarOfStorage(varId, SpvStorageClassFunction)) { + return true; + } + if (!private_like_local_) { + return false; + } + + return IsVarOfStorage(varId, SpvStorageClassPrivate) || + IsVarOfStorage(varId, SpvStorageClassWorkgroup); +} + +void AggressiveDCEPass::AddStores(uint32_t ptrId) { + get_def_use_mgr()->ForEachUser(ptrId, [this, ptrId](Instruction* user) { + switch (user->opcode()) { + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpCopyObject: + this->AddStores(user->result_id()); + break; + case SpvOpLoad: + break; + case SpvOpCopyMemory: + case SpvOpCopyMemorySized: + if (user->GetSingleWordInOperand(kCopyMemoryTargetAddrInIdx) == ptrId) { + AddToWorklist(user); + } + break; + // If default, assume it stores e.g. frexp, modf, function call + case SpvOpStore: + default: + AddToWorklist(user); + break; + } + }); +} + +bool AggressiveDCEPass::AllExtensionsSupported() const { + // If any extension not in whitelist, return false + for (auto& ei : get_module()->extensions()) { + const char* extName = + reinterpret_cast(&ei.GetInOperand(0).words[0]); + if (extensions_whitelist_.find(extName) == extensions_whitelist_.end()) + return false; + } + return true; +} + +bool AggressiveDCEPass::IsDead(Instruction* inst) { + if (IsLive(inst)) return false; + if (inst->IsBranch() && !IsStructuredHeader(context()->get_instr_block(inst), + nullptr, nullptr, nullptr)) + return false; + return true; +} + +bool AggressiveDCEPass::IsTargetDead(Instruction* inst) { + const uint32_t tId = inst->GetSingleWordInOperand(0); + Instruction* tInst = get_def_use_mgr()->GetDef(tId); + if (IsAnnotationInst(tInst->opcode())) { + // This must be a decoration group. We go through annotations in a specific + // order. So if this is not used by any group or group member decorates, it + // is dead. + assert(tInst->opcode() == SpvOpDecorationGroup); + bool dead = true; + get_def_use_mgr()->ForEachUser(tInst, [&dead](Instruction* user) { + if (user->opcode() == SpvOpGroupDecorate || + user->opcode() == SpvOpGroupMemberDecorate) + dead = false; + }); + return dead; + } + return IsDead(tInst); +} + +void AggressiveDCEPass::ProcessLoad(uint32_t varId) { + // Only process locals + if (!IsLocalVar(varId)) return; + // Return if already processed + if (live_local_vars_.find(varId) != live_local_vars_.end()) return; + // Mark all stores to varId as live + AddStores(varId); + // Cache varId as processed + live_local_vars_.insert(varId); +} + +bool AggressiveDCEPass::IsStructuredHeader(BasicBlock* bp, + Instruction** mergeInst, + Instruction** branchInst, + uint32_t* mergeBlockId) { + if (!bp) return false; + Instruction* mi = bp->GetMergeInst(); + if (mi == nullptr) return false; + Instruction* bri = &*bp->tail(); + if (branchInst != nullptr) *branchInst = bri; + if (mergeInst != nullptr) *mergeInst = mi; + if (mergeBlockId != nullptr) *mergeBlockId = mi->GetSingleWordInOperand(0); + return true; +} + +void AggressiveDCEPass::ComputeBlock2HeaderMaps( + std::list& structuredOrder) { + block2headerBranch_.clear(); + branch2merge_.clear(); + structured_order_index_.clear(); + std::stack currentHeaderBranch; + currentHeaderBranch.push(nullptr); + uint32_t currentMergeBlockId = 0; + uint32_t index = 0; + for (auto bi = structuredOrder.begin(); bi != structuredOrder.end(); + ++bi, ++index) { + structured_order_index_[*bi] = index; + // If this block is the merge block of the current control construct, + // we are leaving the current construct so we must update state + if ((*bi)->id() == currentMergeBlockId) { + currentHeaderBranch.pop(); + Instruction* chb = currentHeaderBranch.top(); + if (chb != nullptr) + currentMergeBlockId = branch2merge_[chb]->GetSingleWordInOperand(0); + } + Instruction* mergeInst; + Instruction* branchInst; + uint32_t mergeBlockId; + bool is_header = + IsStructuredHeader(*bi, &mergeInst, &branchInst, &mergeBlockId); + // If this is a loop header, update state first so the block will map to + // the loop. + if (is_header && mergeInst->opcode() == SpvOpLoopMerge) { + currentHeaderBranch.push(branchInst); + branch2merge_[branchInst] = mergeInst; + currentMergeBlockId = mergeBlockId; + } + // Map the block to the current construct. + block2headerBranch_[*bi] = currentHeaderBranch.top(); + // If this is an if header, update state so following blocks map to the if. + if (is_header && mergeInst->opcode() == SpvOpSelectionMerge) { + currentHeaderBranch.push(branchInst); + branch2merge_[branchInst] = mergeInst; + currentMergeBlockId = mergeBlockId; + } + } +} + +void AggressiveDCEPass::AddBranch(uint32_t labelId, BasicBlock* bp) { + std::unique_ptr newBranch( + new Instruction(context(), SpvOpBranch, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {labelId}}})); + context()->AnalyzeDefUse(&*newBranch); + context()->set_instr_block(&*newBranch, bp); + bp->AddInstruction(std::move(newBranch)); +} + +void AggressiveDCEPass::AddBreaksAndContinuesToWorklist( + Instruction* mergeInst) { + assert(mergeInst->opcode() == SpvOpSelectionMerge || + mergeInst->opcode() == SpvOpLoopMerge); + + BasicBlock* header = context()->get_instr_block(mergeInst); + uint32_t headerIndex = structured_order_index_[header]; + const uint32_t mergeId = mergeInst->GetSingleWordInOperand(0); + BasicBlock* merge = context()->get_instr_block(mergeId); + uint32_t mergeIndex = structured_order_index_[merge]; + get_def_use_mgr()->ForEachUser( + mergeId, [headerIndex, mergeIndex, this](Instruction* user) { + if (!user->IsBranch()) return; + BasicBlock* block = context()->get_instr_block(user); + uint32_t index = structured_order_index_[block]; + if (headerIndex < index && index < mergeIndex) { + // This is a break from the loop. + AddToWorklist(user); + // Add branch's merge if there is one. + Instruction* userMerge = branch2merge_[user]; + if (userMerge != nullptr) AddToWorklist(userMerge); + } + }); + + if (mergeInst->opcode() != SpvOpLoopMerge) { + return; + } + + // For loops we need to find the continues as well. + const uint32_t contId = + mergeInst->GetSingleWordInOperand(kLoopMergeContinueBlockIdInIdx); + get_def_use_mgr()->ForEachUser(contId, [&contId, this](Instruction* user) { + SpvOp op = user->opcode(); + if (op == SpvOpBranchConditional || op == SpvOpSwitch) { + // A conditional branch or switch can only be a continue if it does not + // have a merge instruction or its merge block is not the continue block. + Instruction* hdrMerge = branch2merge_[user]; + if (hdrMerge != nullptr && hdrMerge->opcode() == SpvOpSelectionMerge) { + uint32_t hdrMergeId = + hdrMerge->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx); + if (hdrMergeId == contId) return; + // Need to mark merge instruction too + AddToWorklist(hdrMerge); + } + } else if (op == SpvOpBranch) { + // An unconditional branch can only be a continue if it is not + // branching to its own merge block. + BasicBlock* blk = context()->get_instr_block(user); + Instruction* hdrBranch = block2headerBranch_[blk]; + if (hdrBranch == nullptr) return; + Instruction* hdrMerge = branch2merge_[hdrBranch]; + if (hdrMerge->opcode() == SpvOpLoopMerge) return; + uint32_t hdrMergeId = + hdrMerge->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx); + if (contId == hdrMergeId) return; + } else { + return; + } + AddToWorklist(user); + }); +} + +bool AggressiveDCEPass::AggressiveDCE(Function* func) { + // Mark function parameters as live. + AddToWorklist(&func->DefInst()); + func->ForEachParam( + [this](const Instruction* param) { + AddToWorklist(const_cast(param)); + }, + false); + + // Compute map from block to controlling conditional branch + std::list structuredOrder; + cfg()->ComputeStructuredOrder(func, &*func->begin(), &structuredOrder); + ComputeBlock2HeaderMaps(structuredOrder); + bool modified = false; + // Add instructions with external side effects to worklist. Also add branches + // EXCEPT those immediately contained in an "if" selection construct or a loop + // or continue construct. + // TODO(greg-lunarg): Handle Frexp, Modf more optimally + call_in_func_ = false; + func_is_entry_point_ = false; + private_stores_.clear(); + // Stacks to keep track of when we are inside an if- or loop-construct. + // When immediately inside an if- or loop-construct, we do not initially + // mark branches live. All other branches must be marked live. + std::stack assume_branches_live; + std::stack currentMergeBlockId; + // Push sentinel values on stack for when outside of any control flow. + assume_branches_live.push(true); + currentMergeBlockId.push(0); + for (auto bi = structuredOrder.begin(); bi != structuredOrder.end(); ++bi) { + // If exiting if or loop, update stacks + if ((*bi)->id() == currentMergeBlockId.top()) { + assume_branches_live.pop(); + currentMergeBlockId.pop(); + } + for (auto ii = (*bi)->begin(); ii != (*bi)->end(); ++ii) { + SpvOp op = ii->opcode(); + switch (op) { + case SpvOpStore: { + uint32_t varId; + (void)GetPtr(&*ii, &varId); + // Mark stores as live if their variable is not function scope + // and is not private scope. Remember private stores for possible + // later inclusion. We cannot call IsLocalVar at this point because + // private_like_local_ has not been set yet. + if (IsVarOfStorage(varId, SpvStorageClassPrivate) || + IsVarOfStorage(varId, SpvStorageClassWorkgroup)) + private_stores_.push_back(&*ii); + else if (!IsVarOfStorage(varId, SpvStorageClassFunction)) + AddToWorklist(&*ii); + } break; + case SpvOpCopyMemory: + case SpvOpCopyMemorySized: { + uint32_t varId; + (void)GetPtr(ii->GetSingleWordInOperand(kCopyMemoryTargetAddrInIdx), + &varId); + if (IsVarOfStorage(varId, SpvStorageClassPrivate) || + IsVarOfStorage(varId, SpvStorageClassWorkgroup)) + private_stores_.push_back(&*ii); + else if (!IsVarOfStorage(varId, SpvStorageClassFunction)) + AddToWorklist(&*ii); + } break; + case SpvOpLoopMerge: { + assume_branches_live.push(false); + currentMergeBlockId.push( + ii->GetSingleWordInOperand(kLoopMergeMergeBlockIdInIdx)); + } break; + case SpvOpSelectionMerge: { + assume_branches_live.push(false); + currentMergeBlockId.push( + ii->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx)); + } break; + case SpvOpSwitch: + case SpvOpBranch: + case SpvOpBranchConditional: { + if (assume_branches_live.top()) { + AddToWorklist(&*ii); + } + } break; + default: { + // Function calls, atomics, function params, function returns, etc. + // TODO(greg-lunarg): function calls live only if write to non-local + if (!ii->IsOpcodeSafeToDelete()) { + AddToWorklist(&*ii); + } + // Remember function calls + if (op == SpvOpFunctionCall) call_in_func_ = true; + } break; + } + } + } + // See if current function is an entry point + for (auto& ei : get_module()->entry_points()) { + if (ei.GetSingleWordInOperand(kEntryPointFunctionIdInIdx) == + func->result_id()) { + func_is_entry_point_ = true; + break; + } + } + // If the current function is an entry point and has no function calls, + // we can optimize private variables as locals + private_like_local_ = func_is_entry_point_ && !call_in_func_; + // If privates are not like local, add their stores to worklist + if (!private_like_local_) + for (auto& ps : private_stores_) AddToWorklist(ps); + // Perform closure on live instruction set. + while (!worklist_.empty()) { + Instruction* liveInst = worklist_.front(); + // Add all operand instructions if not already live + liveInst->ForEachInId([&liveInst, this](const uint32_t* iid) { + Instruction* inInst = get_def_use_mgr()->GetDef(*iid); + // Do not add label if an operand of a branch. This is not needed + // as part of live code discovery and can create false live code, + // for example, the branch to a header of a loop. + if (inInst->opcode() == SpvOpLabel && liveInst->IsBranch()) return; + AddToWorklist(inInst); + }); + if (liveInst->type_id() != 0) { + AddToWorklist(get_def_use_mgr()->GetDef(liveInst->type_id())); + } + // If in a structured if or loop construct, add the controlling + // conditional branch and its merge. Any containing control construct + // is marked live when the merge and branch are processed out of the + // worklist. + BasicBlock* blk = context()->get_instr_block(liveInst); + Instruction* branchInst = block2headerBranch_[blk]; + if (branchInst != nullptr) { + AddToWorklist(branchInst); + Instruction* mergeInst = branch2merge_[branchInst]; + AddToWorklist(mergeInst); + AddBreaksAndContinuesToWorklist(mergeInst); + } + // If local load, add all variable's stores if variable not already live + if (liveInst->opcode() == SpvOpLoad) { + uint32_t varId; + (void)GetPtr(liveInst, &varId); + if (varId != 0) { + ProcessLoad(varId); + } + } else if (liveInst->opcode() == SpvOpCopyMemory || + liveInst->opcode() == SpvOpCopyMemorySized) { + uint32_t varId; + (void)GetPtr(liveInst->GetSingleWordInOperand(kCopyMemorySourceAddrInIdx), + &varId); + if (varId != 0) { + ProcessLoad(varId); + } + // If function call, treat as if it loads from all pointer arguments + } else if (liveInst->opcode() == SpvOpFunctionCall) { + liveInst->ForEachInId([this](const uint32_t* iid) { + // Skip non-ptr args + if (!IsPtr(*iid)) return; + uint32_t varId; + (void)GetPtr(*iid, &varId); + ProcessLoad(varId); + }); + // If function parameter, treat as if it's result id is loaded from + } else if (liveInst->opcode() == SpvOpFunctionParameter) { + ProcessLoad(liveInst->result_id()); + // We treat an OpImageTexelPointer as a load of the pointer, and + // that value is manipulated to get the result. + } else if (liveInst->opcode() == SpvOpImageTexelPointer) { + uint32_t varId; + (void)GetPtr(liveInst, &varId); + if (varId != 0) { + ProcessLoad(varId); + } + } + worklist_.pop(); + } + + // Kill dead instructions and remember dead blocks + for (auto bi = structuredOrder.begin(); bi != structuredOrder.end();) { + uint32_t mergeBlockId = 0; + (*bi)->ForEachInst([this, &modified, &mergeBlockId](Instruction* inst) { + if (!IsDead(inst)) return; + if (inst->opcode() == SpvOpLabel) return; + // If dead instruction is selection merge, remember merge block + // for new branch at end of block + if (inst->opcode() == SpvOpSelectionMerge || + inst->opcode() == SpvOpLoopMerge) + mergeBlockId = inst->GetSingleWordInOperand(0); + to_kill_.push_back(inst); + modified = true; + }); + // If a structured if or loop was deleted, add a branch to its merge + // block, and traverse to the merge block and continue processing there. + // We know the block still exists because the label is not deleted. + if (mergeBlockId != 0) { + AddBranch(mergeBlockId, *bi); + for (++bi; (*bi)->id() != mergeBlockId; ++bi) { + } + } else { + ++bi; + } + } + + return modified; +} + +void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() { + // Keep all execution modes. + for (auto& exec : get_module()->execution_modes()) { + AddToWorklist(&exec); + } + // Keep all entry points. + for (auto& entry : get_module()->entry_points()) { + AddToWorklist(&entry); + } + // Keep workgroup size. + for (auto& anno : get_module()->annotations()) { + if (anno.opcode() == SpvOpDecorate) { + if (anno.GetSingleWordInOperand(1u) == SpvDecorationBuiltIn && + anno.GetSingleWordInOperand(2u) == SpvBuiltInWorkgroupSize) { + AddToWorklist(&anno); + } + } + } +} + +Pass::Status AggressiveDCEPass::ProcessImpl() { + // Current functionality assumes shader capability + // TODO(greg-lunarg): Handle additional capabilities + if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + return Status::SuccessWithoutChange; + // Current functionality assumes relaxed logical addressing (see + // instruction.h) + // TODO(greg-lunarg): Handle non-logical addressing + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + return Status::SuccessWithoutChange; + // If any extensions in the module are not explicitly supported, + // return unmodified. + if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; + + // Eliminate Dead functions. + bool modified = EliminateDeadFunctions(); + + InitializeModuleScopeLiveInstructions(); + + // Process all entry point functions. + ProcessFunction pfn = [this](Function* fp) { return AggressiveDCE(fp); }; + modified |= ProcessEntryPointCallTree(pfn, get_module()); + + // Process module-level instructions. Now that all live instructions have + // been marked, it is safe to remove dead global values. + modified |= ProcessGlobalValues(); + + // Kill all dead instructions. + for (auto inst : to_kill_) { + context()->KillInst(inst); + } + + // Cleanup all CFG including all unreachable blocks. + ProcessFunction cleanup = [this](Function* f) { return CFGCleanup(f); }; + modified |= ProcessEntryPointCallTree(cleanup, get_module()); + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool AggressiveDCEPass::EliminateDeadFunctions() { + // Identify live functions first. Those that are not live + // are dead. ADCE is disabled for non-shaders so we do not check for exported + // functions here. + std::unordered_set live_function_set; + ProcessFunction mark_live = [&live_function_set](Function* fp) { + live_function_set.insert(fp); + return false; + }; + ProcessEntryPointCallTree(mark_live, get_module()); + + bool modified = false; + for (auto funcIter = get_module()->begin(); + funcIter != get_module()->end();) { + if (live_function_set.count(&*funcIter) == 0) { + modified = true; + EliminateFunction(&*funcIter); + funcIter = funcIter.Erase(); + } else { + ++funcIter; + } + } + + return modified; +} + +void AggressiveDCEPass::EliminateFunction(Function* func) { + // Remove all of the instruction in the function body + func->ForEachInst([this](Instruction* inst) { context()->KillInst(inst); }, + true); +} + +bool AggressiveDCEPass::ProcessGlobalValues() { + // Remove debug and annotation statements referencing dead instructions. + // This must be done before killing the instructions, otherwise there are + // dead objects in the def/use database. + bool modified = false; + Instruction* instruction = &*get_module()->debug2_begin(); + while (instruction) { + if (instruction->opcode() != SpvOpName) { + instruction = instruction->NextNode(); + continue; + } + + if (IsTargetDead(instruction)) { + instruction = context()->KillInst(instruction); + modified = true; + } else { + instruction = instruction->NextNode(); + } + } + + // This code removes all unnecessary decorations safely (see #1174). It also + // does so in a more efficient manner than deleting them only as the targets + // are deleted. + std::vector annotations; + for (auto& inst : get_module()->annotations()) annotations.push_back(&inst); + std::sort(annotations.begin(), annotations.end(), DecorationLess()); + for (auto annotation : annotations) { + switch (annotation->opcode()) { + case SpvOpDecorate: + case SpvOpMemberDecorate: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + if (IsTargetDead(annotation)) { + context()->KillInst(annotation); + modified = true; + } + break; + case SpvOpGroupDecorate: { + // Go through the targets of this group decorate. Remove each dead + // target. If all targets are dead, remove this decoration. + bool dead = true; + for (uint32_t i = 1; i < annotation->NumOperands();) { + Instruction* opInst = + get_def_use_mgr()->GetDef(annotation->GetSingleWordOperand(i)); + if (IsDead(opInst)) { + // Don't increment |i|. + annotation->RemoveOperand(i); + modified = true; + } else { + i++; + dead = false; + } + } + if (dead) { + context()->KillInst(annotation); + modified = true; + } + break; + } + case SpvOpGroupMemberDecorate: { + // Go through the targets of this group member decorate. Remove each + // dead target (and member index). If all targets are dead, remove this + // decoration. + bool dead = true; + for (uint32_t i = 1; i < annotation->NumOperands();) { + Instruction* opInst = + get_def_use_mgr()->GetDef(annotation->GetSingleWordOperand(i)); + if (IsDead(opInst)) { + // Don't increment |i|. + annotation->RemoveOperand(i + 1); + annotation->RemoveOperand(i); + modified = true; + } else { + i += 2; + dead = false; + } + } + if (dead) { + context()->KillInst(annotation); + modified = true; + } + break; + } + case SpvOpDecorationGroup: + // By the time we hit decoration groups we've checked everything that + // can target them. So if they have no uses they must be dead. + if (get_def_use_mgr()->NumUsers(annotation) == 0) { + context()->KillInst(annotation); + modified = true; + } + break; + default: + assert(false); + break; + } + } + + // Since ADCE is disabled for non-shaders, we don't check for export linkage + // attributes here. + for (auto& val : get_module()->types_values()) { + if (IsDead(&val)) { + to_kill_.push_back(&val); + } + } + + return modified; +} + +AggressiveDCEPass::AggressiveDCEPass() = default; + +Pass::Status AggressiveDCEPass::Process() { + // Initialize extensions whitelist + InitExtensions(); + return ProcessImpl(); +} + +void AggressiveDCEPass::InitExtensions() { + extensions_whitelist_.clear(); + extensions_whitelist_.insert({ + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h new file mode 100644 index 00000000000..3c03cc66b96 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h @@ -0,0 +1,192 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_AGGRESSIVE_DEAD_CODE_ELIM_PASS_H_ +#define SOURCE_OPT_AGGRESSIVE_DEAD_CODE_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" +#include "source/util/bit_vector.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class AggressiveDCEPass : public MemPass { + using cbb_ptr = const BasicBlock*; + + public: + using GetBlocksFunction = + std::function*(const BasicBlock*)>; + + AggressiveDCEPass(); + const char* name() const override { return "eliminate-dead-code-aggressive"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; + } + + private: + // Return true if |varId| is a variable of |storageClass|. |varId| must either + // be 0 or the result of an instruction. + bool IsVarOfStorage(uint32_t varId, uint32_t storageClass); + + // Return true if |varId| is variable of function storage class or is + // private variable and privates can be optimized like locals (see + // privates_like_local_). + bool IsLocalVar(uint32_t varId); + + // Return true if |inst| is marked live. + bool IsLive(const Instruction* inst) const { + return live_insts_.Get(inst->unique_id()); + } + + // Returns true if |inst| is dead. + bool IsDead(Instruction* inst); + + // Adds entry points, execution modes and workgroup size decorations to the + // worklist for processing with the first function. + void InitializeModuleScopeLiveInstructions(); + + // Add |inst| to worklist_ and live_insts_. + void AddToWorklist(Instruction* inst) { + if (!live_insts_.Set(inst->unique_id())) { + worklist_.push(inst); + } + } + + // Add all store instruction which use |ptrId|, directly or indirectly, + // to the live instruction worklist. + void AddStores(uint32_t ptrId); + + // Initialize extensions whitelist + void InitExtensions(); + + // Return true if all extensions in this module are supported by this pass. + bool AllExtensionsSupported() const; + + // Returns true if the target of |inst| is dead. An instruction is dead if + // its result id is used in decoration or debug instructions only. |inst| is + // assumed to be OpName, OpMemberName or an annotation instruction. + bool IsTargetDead(Instruction* inst); + + // If |varId| is local, mark all stores of varId as live. + void ProcessLoad(uint32_t varId); + + // If |bp| is structured header block, returns true and sets |mergeInst| to + // the merge instruction, |branchInst| to the branch and |mergeBlockId| to the + // merge block if they are not nullptr. Any of |mergeInst|, |branchInst| or + // |mergeBlockId| may be a null pointer. Returns false if |bp| is a null + // pointer. + bool IsStructuredHeader(BasicBlock* bp, Instruction** mergeInst, + Instruction** branchInst, uint32_t* mergeBlockId); + + // Initialize block2headerBranch_ and branch2merge_ using |structuredOrder| + // to order blocks. + void ComputeBlock2HeaderMaps(std::list& structuredOrder); + + // Add branch to |labelId| to end of block |bp|. + void AddBranch(uint32_t labelId, BasicBlock* bp); + + // Add all break and continue branches in the construct associated with + // |mergeInst| to worklist if not already live + void AddBreaksAndContinuesToWorklist(Instruction* mergeInst); + + // Eliminates dead debug2 and annotation instructions. Marks dead globals for + // removal (e.g. types, constants and variables). + bool ProcessGlobalValues(); + + // Erases functions that are unreachable from the entry points of the module. + bool EliminateDeadFunctions(); + + // Removes |func| from the module and deletes all its instructions. + void EliminateFunction(Function* func); + + // For function |func|, mark all Stores to non-function-scope variables + // and block terminating instructions as live. Recursively mark the values + // they use. When complete, mark any non-live instructions to be deleted. + // Returns true if the function has been modified. + // + // Note: This function does not delete useless control structures. All + // existing control structures will remain. This can leave not-insignificant + // sequences of ultimately useless code. + // TODO(): Remove useless control constructs. + bool AggressiveDCE(Function* func); + + Pass::Status ProcessImpl(); + + // True if current function has a call instruction contained in it + bool call_in_func_; + + // True if current function is an entry point + bool func_is_entry_point_; + + // True if current function is entry point and has no function calls. + bool private_like_local_; + + // Live Instruction Worklist. An instruction is added to this list + // if it might have a side effect, either directly or indirectly. + // If we don't know, then add it to this list. Instructions are + // removed from this list as the algorithm traces side effects, + // building up the live instructions set |live_insts_|. + std::queue worklist_; + + // Map from block to the branch instruction in the header of the most + // immediate controlling structured if or loop. A loop header block points + // to its own branch instruction. An if-selection block points to the branch + // of an enclosing construct's header, if one exists. + std::unordered_map block2headerBranch_; + + // Maps basic block to their index in the structured order traversal. + std::unordered_map structured_order_index_; + + // Map from branch to its associated merge instruction, if any + std::unordered_map branch2merge_; + + // Store instructions to variables of private storage + std::vector private_stores_; + + // Live Instructions + utils::BitVector live_insts_; + + // Live Local Variables + std::unordered_set live_local_vars_; + + // List of instructions to delete. Deletion is delayed until debug and + // annotation instructions are processed. + std::vector to_kill_; + + // Extensions supported by this pass. + std::unordered_set extensions_whitelist_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_AGGRESSIVE_DEAD_CODE_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp new file mode 100644 index 00000000000..b18b114a5d3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/basic_block.cpp @@ -0,0 +1,250 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/basic_block.h" + +#include + +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kLoopMergeContinueBlockIdInIdx = 1; +const uint32_t kLoopMergeMergeBlockIdInIdx = 0; +const uint32_t kSelectionMergeMergeBlockIdInIdx = 0; + +} // namespace + +BasicBlock* BasicBlock::Clone(IRContext* context) const { + BasicBlock* clone = new BasicBlock( + std::unique_ptr(GetLabelInst()->Clone(context))); + for (const auto& inst : insts_) + // Use the incoming context + clone->AddInstruction(std::unique_ptr(inst.Clone(context))); + return clone; +} + +const Instruction* BasicBlock::GetMergeInst() const { + const Instruction* result = nullptr; + // If it exists, the merge instruction immediately precedes the + // terminator. + auto iter = ctail(); + if (iter != cbegin()) { + --iter; + const auto opcode = iter->opcode(); + if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) { + result = &*iter; + } + } + return result; +} + +Instruction* BasicBlock::GetMergeInst() { + Instruction* result = nullptr; + // If it exists, the merge instruction immediately precedes the + // terminator. + auto iter = tail(); + if (iter != begin()) { + --iter; + const auto opcode = iter->opcode(); + if (opcode == SpvOpLoopMerge || opcode == SpvOpSelectionMerge) { + result = &*iter; + } + } + return result; +} + +const Instruction* BasicBlock::GetLoopMergeInst() const { + if (auto* merge = GetMergeInst()) { + if (merge->opcode() == SpvOpLoopMerge) { + return merge; + } + } + return nullptr; +} + +Instruction* BasicBlock::GetLoopMergeInst() { + if (auto* merge = GetMergeInst()) { + if (merge->opcode() == SpvOpLoopMerge) { + return merge; + } + } + return nullptr; +} + +void BasicBlock::KillAllInsts(bool killLabel) { + ForEachInst([killLabel](Instruction* ip) { + if (killLabel || ip->opcode() != SpvOpLabel) { + ip->context()->KillInst(ip); + } + }); +} + +void BasicBlock::ForEachSuccessorLabel( + const std::function& f) const { + const auto br = &insts_.back(); + switch (br->opcode()) { + case SpvOpBranch: { + f(br->GetOperand(0).words[0]); + } break; + case SpvOpBranchConditional: + case SpvOpSwitch: { + bool is_first = true; + br->ForEachInId([&is_first, &f](const uint32_t* idp) { + if (!is_first) f(*idp); + is_first = false; + }); + } break; + default: + break; + } +} + +void BasicBlock::ForEachSuccessorLabel( + const std::function& f) { + auto br = &insts_.back(); + switch (br->opcode()) { + case SpvOpBranch: { + uint32_t tmp_id = br->GetOperand(0).words[0]; + f(&tmp_id); + if (tmp_id != br->GetOperand(0).words[0]) br->SetOperand(0, {tmp_id}); + } break; + case SpvOpBranchConditional: + case SpvOpSwitch: { + bool is_first = true; + br->ForEachInId([&is_first, &f](uint32_t* idp) { + if (!is_first) f(idp); + is_first = false; + }); + } break; + default: + break; + } +} + +bool BasicBlock::IsSuccessor(const BasicBlock* block) const { + uint32_t succId = block->id(); + bool isSuccessor = false; + ForEachSuccessorLabel([&isSuccessor, succId](const uint32_t label) { + if (label == succId) isSuccessor = true; + }); + return isSuccessor; +} + +void BasicBlock::ForMergeAndContinueLabel( + const std::function& f) { + auto ii = insts_.end(); + --ii; + if (ii == insts_.begin()) return; + --ii; + if (ii->opcode() == SpvOpSelectionMerge || ii->opcode() == SpvOpLoopMerge) { + ii->ForEachInId([&f](const uint32_t* idp) { f(*idp); }); + } +} + +uint32_t BasicBlock::MergeBlockIdIfAny() const { + auto merge_ii = cend(); + --merge_ii; + uint32_t mbid = 0; + if (merge_ii != cbegin()) { + --merge_ii; + if (merge_ii->opcode() == SpvOpLoopMerge) { + mbid = merge_ii->GetSingleWordInOperand(kLoopMergeMergeBlockIdInIdx); + } else if (merge_ii->opcode() == SpvOpSelectionMerge) { + mbid = merge_ii->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx); + } + } + + return mbid; +} + +uint32_t BasicBlock::ContinueBlockIdIfAny() const { + auto merge_ii = cend(); + --merge_ii; + uint32_t cbid = 0; + if (merge_ii != cbegin()) { + --merge_ii; + if (merge_ii->opcode() == SpvOpLoopMerge) { + cbid = merge_ii->GetSingleWordInOperand(kLoopMergeContinueBlockIdInIdx); + } + } + return cbid; +} + +std::ostream& operator<<(std::ostream& str, const BasicBlock& block) { + str << block.PrettyPrint(); + return str; +} + +std::string BasicBlock::PrettyPrint(uint32_t options) const { + std::ostringstream str; + ForEachInst([&str, options](const Instruction* inst) { + str << inst->PrettyPrint(options); + if (!IsTerminatorInst(inst->opcode())) { + str << std::endl; + } + }); + return str.str(); +} + +BasicBlock* BasicBlock::SplitBasicBlock(IRContext* context, uint32_t label_id, + iterator iter) { + assert(!insts_.empty()); + + BasicBlock* new_block = new BasicBlock(MakeUnique( + context, SpvOpLabel, 0, label_id, std::initializer_list{})); + + new_block->insts_.Splice(new_block->end(), &insts_, iter, end()); + new_block->SetParent(GetParent()); + + context->AnalyzeDefUse(new_block->GetLabelInst()); + + // Update the phi nodes in the successor blocks to reference the new block id. + const_cast(new_block)->ForEachSuccessorLabel( + [new_block, this, context](const uint32_t label) { + BasicBlock* target_bb = context->get_instr_block(label); + target_bb->ForEachPhiInst( + [this, new_block, context](Instruction* phi_inst) { + bool changed = false; + for (uint32_t i = 1; i < phi_inst->NumInOperands(); i += 2) { + if (phi_inst->GetSingleWordInOperand(i) == this->id()) { + changed = true; + phi_inst->SetInOperand(i, {new_block->id()}); + } + } + + if (changed) { + context->UpdateDefUse(phi_inst); + } + }); + }); + + if (context->AreAnalysesValid(IRContext::kAnalysisInstrToBlockMapping)) { + context->set_instr_block(new_block->GetLabelInst(), new_block); + new_block->ForEachInst([new_block, context](Instruction* inst) { + context->set_instr_block(inst, new_block); + }); + } + + return new_block; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h new file mode 100644 index 00000000000..9e1706e14fe --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/basic_block.h @@ -0,0 +1,320 @@ +// Copyright (c) 2016 Google 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. + +// This file defines the language constructs for representing a SPIR-V +// module in memory. + +#ifndef SOURCE_OPT_BASIC_BLOCK_H_ +#define SOURCE_OPT_BASIC_BLOCK_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/instruction_list.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +class Function; +class IRContext; + +// A SPIR-V basic block. +class BasicBlock { + public: + using iterator = InstructionList::iterator; + using const_iterator = InstructionList::const_iterator; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = + std::reverse_iterator; + + // Creates a basic block with the given starting |label|. + inline explicit BasicBlock(std::unique_ptr label); + + explicit BasicBlock(const BasicBlock& bb) = delete; + + // Creates a clone of the basic block in the given |context| + // + // The parent function will default to null and needs to be explicitly set by + // the user. + BasicBlock* Clone(IRContext*) const; + + // Sets the enclosing function for this basic block. + void SetParent(Function* function) { function_ = function; } + + // Return the enclosing function + inline Function* GetParent() const { return function_; } + + // Appends an instruction to this basic block. + inline void AddInstruction(std::unique_ptr i); + + // Appends all of block's instructions (except label) to this block + inline void AddInstructions(BasicBlock* bp); + + // The label starting this basic block. + Instruction* GetLabelInst() { return label_.get(); } + const Instruction* GetLabelInst() const { return label_.get(); } + + // Returns the merge instruction in this basic block, if it exists. + // Otherwise return null. May be used whenever tail() can be used. + const Instruction* GetMergeInst() const; + Instruction* GetMergeInst(); + + // Returns the OpLoopMerge instruciton in this basic block, if it exists. + // Otherwise return null. May be used whenever tail() can be used. + const Instruction* GetLoopMergeInst() const; + Instruction* GetLoopMergeInst(); + + // Returns the id of the label at the top of this block + inline uint32_t id() const { return label_->result_id(); } + + iterator begin() { return insts_.begin(); } + iterator end() { return insts_.end(); } + const_iterator begin() const { return insts_.cbegin(); } + const_iterator end() const { return insts_.cend(); } + const_iterator cbegin() const { return insts_.cbegin(); } + const_iterator cend() const { return insts_.cend(); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(cend()); + } + const_reverse_iterator rend() const { + return const_reverse_iterator(cbegin()); + } + const_reverse_iterator crbegin() const { + return const_reverse_iterator(cend()); + } + const_reverse_iterator crend() const { + return const_reverse_iterator(cbegin()); + } + + // Returns an iterator pointing to the last instruction. This may only + // be used if this block has an instruction other than the OpLabel + // that defines it. + iterator tail() { + assert(!insts_.empty()); + return --end(); + } + + // Returns a const iterator, but othewrise similar to tail(). + const_iterator ctail() const { + assert(!insts_.empty()); + return --insts_.cend(); + } + + // Returns true if the basic block has at least one successor. + inline bool hasSuccessor() const { return ctail()->IsBranch(); } + + // Runs the given function |f| on each instruction in this basic block, and + // optionally on the debug line instructions that might precede them. + inline void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false); + inline void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false) const; + + // Runs the given function |f| on each instruction in this basic block, and + // optionally on the debug line instructions that might precede them. If |f| + // returns false, iteration is terminated and this function returns false. + inline bool WhileEachInst(const std::function& f, + bool run_on_debug_line_insts = false); + inline bool WhileEachInst(const std::function& f, + bool run_on_debug_line_insts = false) const; + + // Runs the given function |f| on each Phi instruction in this basic block, + // and optionally on the debug line instructions that might precede them. + inline void ForEachPhiInst(const std::function& f, + bool run_on_debug_line_insts = false); + + // Runs the given function |f| on each Phi instruction in this basic block, + // and optionally on the debug line instructions that might precede them. If + // |f| returns false, iteration is terminated and this function return false. + inline bool WhileEachPhiInst(const std::function& f, + bool run_on_debug_line_insts = false); + + // Runs the given function |f| on each label id of each successor block + void ForEachSuccessorLabel( + const std::function& f) const; + + // Runs the given function |f| on each label id of each successor block. + // Modifying the pointed value will change the branch taken by the basic + // block. It is the caller responsibility to update or invalidate the CFG. + void ForEachSuccessorLabel(const std::function& f); + + // Returns true if |block| is a direct successor of |this|. + bool IsSuccessor(const BasicBlock* block) const; + + // Runs the given function |f| on the merge and continue label, if any + void ForMergeAndContinueLabel(const std::function& f); + + // Returns true if this basic block has any Phi instructions. + bool HasPhiInstructions() { + return !WhileEachPhiInst([](Instruction*) { return false; }); + } + + // Return true if this block is a loop header block. + bool IsLoopHeader() const { return GetLoopMergeInst() != nullptr; } + + // Returns the ID of the merge block declared by a merge instruction in this + // block, if any. If none, returns zero. + uint32_t MergeBlockIdIfAny() const; + + // Returns the ID of the continue block declared by a merge instruction in + // this block, if any. If none, returns zero. + uint32_t ContinueBlockIdIfAny() const; + + // Returns the terminator instruction. Assumes the terminator exists. + Instruction* terminator() { return &*tail(); } + const Instruction* terminator() const { return &*ctail(); } + + // Returns true if this basic block exits this function and returns to its + // caller. + bool IsReturn() const { return ctail()->IsReturn(); } + + // Returns true if this basic block exits this function or aborts execution. + bool IsReturnOrAbort() const { return ctail()->IsReturnOrAbort(); } + + // Kill all instructions in this block. Whether or not to kill the label is + // indicated by |killLabel|. + void KillAllInsts(bool killLabel); + + // Splits this basic block into two. Returns a new basic block with label + // |labelId| containing the instructions from |iter| onwards. Instructions + // prior to |iter| remain in this basic block. + BasicBlock* SplitBasicBlock(IRContext* context, uint32_t label_id, + iterator iter); + + // Pretty-prints this basic block into a std::string by printing every + // instruction in it. + // + // |options| are the disassembly options. SPV_BINARY_TO_TEXT_OPTION_NO_HEADER + // is always added to |options|. + std::string PrettyPrint(uint32_t options = 0u) const; + + private: + // The enclosing function. + Function* function_; + // The label starting this basic block. + std::unique_ptr label_; + // Instructions inside this basic block, but not the OpLabel. + InstructionList insts_; +}; + +// Pretty-prints |block| to |str|. Returns |str|. +std::ostream& operator<<(std::ostream& str, const BasicBlock& block); + +inline BasicBlock::BasicBlock(std::unique_ptr label) + : function_(nullptr), label_(std::move(label)) {} + +inline void BasicBlock::AddInstruction(std::unique_ptr i) { + insts_.push_back(std::move(i)); +} + +inline void BasicBlock::AddInstructions(BasicBlock* bp) { + auto bEnd = end(); + (void)bEnd.MoveBefore(&bp->insts_); +} + +inline bool BasicBlock::WhileEachInst( + const std::function& f, bool run_on_debug_line_insts) { + if (label_) { + if (!label_->WhileEachInst(f, run_on_debug_line_insts)) return false; + } + if (insts_.empty()) { + return true; + } + + Instruction* inst = &insts_.front(); + while (inst != nullptr) { + Instruction* next_instruction = inst->NextNode(); + if (!inst->WhileEachInst(f, run_on_debug_line_insts)) return false; + inst = next_instruction; + } + return true; +} + +inline bool BasicBlock::WhileEachInst( + const std::function& f, + bool run_on_debug_line_insts) const { + if (label_) { + if (!static_cast(label_.get()) + ->WhileEachInst(f, run_on_debug_line_insts)) + return false; + } + for (const auto& inst : insts_) { + if (!static_cast(&inst)->WhileEachInst( + f, run_on_debug_line_insts)) + return false; + } + return true; +} + +inline void BasicBlock::ForEachInst(const std::function& f, + bool run_on_debug_line_insts) { + WhileEachInst( + [&f](Instruction* inst) { + f(inst); + return true; + }, + run_on_debug_line_insts); +} + +inline void BasicBlock::ForEachInst( + const std::function& f, + bool run_on_debug_line_insts) const { + WhileEachInst( + [&f](const Instruction* inst) { + f(inst); + return true; + }, + run_on_debug_line_insts); +} + +inline bool BasicBlock::WhileEachPhiInst( + const std::function& f, bool run_on_debug_line_insts) { + if (insts_.empty()) { + return true; + } + + Instruction* inst = &insts_.front(); + while (inst != nullptr) { + Instruction* next_instruction = inst->NextNode(); + if (inst->opcode() != SpvOpPhi) break; + if (!inst->WhileEachInst(f, run_on_debug_line_insts)) return false; + inst = next_instruction; + } + return true; +} + +inline void BasicBlock::ForEachPhiInst( + const std::function& f, bool run_on_debug_line_insts) { + WhileEachPhiInst( + [&f](Instruction* inst) { + f(inst); + return true; + }, + run_on_debug_line_insts); +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_BASIC_BLOCK_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp new file mode 100644 index 00000000000..aa4c1bd9242 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.cpp @@ -0,0 +1,158 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/block_merge_pass.h" + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +void BlockMergePass::KillInstAndName(Instruction* inst) { + std::vector to_kill; + get_def_use_mgr()->ForEachUser(inst, [&to_kill](Instruction* user) { + if (user->opcode() == SpvOpName) { + to_kill.push_back(user); + } + }); + for (auto i : to_kill) { + context()->KillInst(i); + } + context()->KillInst(inst); +} + +bool BlockMergePass::MergeBlocks(Function* func) { + bool modified = false; + for (auto bi = func->begin(); bi != func->end();) { + // Find block with single successor which has no other predecessors. + auto ii = bi->end(); + --ii; + Instruction* br = &*ii; + if (br->opcode() != SpvOpBranch) { + ++bi; + continue; + } + + const uint32_t lab_id = br->GetSingleWordInOperand(0); + if (cfg()->preds(lab_id).size() != 1) { + ++bi; + continue; + } + + bool pred_is_header = IsHeader(&*bi); + bool succ_is_header = IsHeader(lab_id); + if (pred_is_header && succ_is_header) { + // Cannot merge two headers together. + ++bi; + continue; + } + + bool pred_is_merge = IsMerge(&*bi); + bool succ_is_merge = IsMerge(lab_id); + if (pred_is_merge && succ_is_merge) { + // Cannot merge two merges together. + ++bi; + continue; + } + + Instruction* merge_inst = bi->GetMergeInst(); + if (pred_is_header && lab_id != merge_inst->GetSingleWordInOperand(0u)) { + // If this is a header block and the successor is not its merge, we must + // be careful about which blocks we are willing to merge together. + // OpLoopMerge must be followed by a conditional or unconditional branch. + // The merge must be a loop merge because a selection merge cannot be + // followed by an unconditional branch. + BasicBlock* succ_block = context()->get_instr_block(lab_id); + SpvOp succ_term_op = succ_block->terminator()->opcode(); + assert(merge_inst->opcode() == SpvOpLoopMerge); + if (succ_term_op != SpvOpBranch && + succ_term_op != SpvOpBranchConditional) { + ++bi; + continue; + } + } + + // Merge blocks. + context()->KillInst(br); + auto sbi = bi; + for (; sbi != func->end(); ++sbi) + if (sbi->id() == lab_id) break; + // If bi is sbi's only predecessor, it dominates sbi and thus + // sbi must follow bi in func's ordering. + assert(sbi != func->end()); + + // Update the inst-to-block mapping for the instructions in sbi. + for (auto& inst : *sbi) { + context()->set_instr_block(&inst, &*bi); + } + + // Now actually move the instructions. + bi->AddInstructions(&*sbi); + + if (merge_inst) { + if (pred_is_header && lab_id == merge_inst->GetSingleWordInOperand(0u)) { + // Merging the header and merge blocks, so remove the structured control + // flow declaration. + context()->KillInst(merge_inst); + } else { + // Move the merge instruction to just before the terminator. + merge_inst->InsertBefore(bi->terminator()); + } + } + context()->ReplaceAllUsesWith(lab_id, bi->id()); + KillInstAndName(sbi->GetLabelInst()); + (void)sbi.Erase(); + // Reprocess block. + modified = true; + } + return modified; +} + +bool BlockMergePass::IsHeader(BasicBlock* block) { + return block->GetMergeInst() != nullptr; +} + +bool BlockMergePass::IsHeader(uint32_t id) { + return IsHeader(context()->get_instr_block(get_def_use_mgr()->GetDef(id))); +} + +bool BlockMergePass::IsMerge(uint32_t id) { + return !get_def_use_mgr()->WhileEachUse(id, [](Instruction* user, + uint32_t index) { + SpvOp op = user->opcode(); + if ((op == SpvOpLoopMerge || op == SpvOpSelectionMerge) && index == 0u) { + return false; + } + return true; + }); +} + +bool BlockMergePass::IsMerge(BasicBlock* block) { return IsMerge(block->id()); } + +Pass::Status BlockMergePass::Process() { + // Process all entry point functions. + ProcessFunction pfn = [this](Function* fp) { return MergeBlocks(fp); }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +BlockMergePass::BlockMergePass() = default; + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.h new file mode 100644 index 00000000000..0ecde48846e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/block_merge_pass.h @@ -0,0 +1,71 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_BLOCK_MERGE_PASS_H_ +#define SOURCE_OPT_BLOCK_MERGE_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class BlockMergePass : public Pass { + public: + BlockMergePass(); + const char* name() const override { return "merge-blocks"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisNameMap; + } + + private: + // Kill any OpName instruction referencing |inst|, then kill |inst|. + void KillInstAndName(Instruction* inst); + + // Search |func| for blocks which have a single Branch to a block + // with no other predecessors. Merge these blocks into a single block. + bool MergeBlocks(Function* func); + + // Returns true if |block| (or |id|) contains a merge instruction. + bool IsHeader(BasicBlock* block); + bool IsHeader(uint32_t id); + + // Returns true if |block| (or |id|) is the merge target of a merge + // instruction. + bool IsMerge(BasicBlock* block); + bool IsMerge(uint32_t id); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_BLOCK_MERGE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/build_module.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/build_module.cpp new file mode 100644 index 00000000000..fc76a3c29da --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/build_module.cpp @@ -0,0 +1,79 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/build_module.h" + +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/ir_loader.h" +#include "source/table.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace { + +// Sets the module header for IrLoader. Meets the interface requirement of +// spvBinaryParse(). +spv_result_t SetSpvHeader(void* builder, spv_endianness_t, uint32_t magic, + uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t reserved) { + reinterpret_cast(builder)->SetModuleHeader( + magic, version, generator, id_bound, reserved); + return SPV_SUCCESS; +} + +// Processes a parsed instruction for IrLoader. Meets the interface requirement +// of spvBinaryParse(). +spv_result_t SetSpvInst(void* builder, const spv_parsed_instruction_t* inst) { + if (reinterpret_cast(builder)->AddInstruction(inst)) { + return SPV_SUCCESS; + } + return SPV_ERROR_INVALID_BINARY; +} + +} // namespace + +std::unique_ptr BuildModule(spv_target_env env, + MessageConsumer consumer, + const uint32_t* binary, + const size_t size) { + auto context = spvContextCreate(env); + SetContextMessageConsumer(context, consumer); + + auto irContext = MakeUnique(env, consumer); + opt::IrLoader loader(consumer, irContext->module()); + + spv_result_t status = spvBinaryParse(context, &loader, binary, size, + SetSpvHeader, SetSpvInst, nullptr); + loader.EndModule(); + + spvContextDestroy(context); + + return status == SPV_SUCCESS ? std::move(irContext) : nullptr; +} + +std::unique_ptr BuildModule(spv_target_env env, + MessageConsumer consumer, + const std::string& text, + uint32_t assemble_options) { + SpirvTools t(env); + t.SetMessageConsumer(consumer); + std::vector binary; + if (!t.Assemble(text, &binary, assemble_options)) return nullptr; + return BuildModule(env, consumer, binary.data(), binary.size()); +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/build_module.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/build_module.h new file mode 100644 index 00000000000..c9d1cf2e457 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/build_module.h @@ -0,0 +1,46 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_BUILD_MODULE_H_ +#define SOURCE_OPT_BUILD_MODULE_H_ + +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { + +// Builds an Module returns the owning IRContext from the given SPIR-V +// |binary|. |size| specifies number of words in |binary|. The |binary| will be +// decoded according to the given target |env|. Returns nullptr if errors occur +// and sends the errors to |consumer|. +std::unique_ptr BuildModule(spv_target_env env, + MessageConsumer consumer, + const uint32_t* binary, + size_t size); + +// Builds an Module and returns the owning IRContext from the given +// SPIR-V assembly |text|. The |text| will be encoded according to the given +// target |env|. Returns nullptr if errors occur and sends the errors to +// |consumer|. +std::unique_ptr BuildModule( + spv_target_env env, MessageConsumer consumer, const std::string& text, + uint32_t assemble_options = SpirvTools::kDefaultAssembleOption); + +} // namespace spvtools + +#endif // SOURCE_OPT_BUILD_MODULE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp new file mode 100644 index 00000000000..a8411d9fe17 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.cpp @@ -0,0 +1,328 @@ +// Copyright (c) 2017 Google 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. + +// This file implements conditional constant propagation as described in +// +// Constant propagation with conditional branches, +// Wegman and Zadeck, ACM TOPLAS 13(2):181-210. + +#include "source/opt/ccp_pass.h" + +#include +#include + +#include "source/opt/fold.h" +#include "source/opt/function.h" +#include "source/opt/module.h" +#include "source/opt/propagator.h" + +namespace spvtools { +namespace opt { + +namespace { + +// This SSA id is never defined nor referenced in the IR. It is a special ID +// which represents varying values. When an ID is found to have a varying +// value, its entry in the |values_| table maps to kVaryingSSAId. +const uint32_t kVaryingSSAId = std::numeric_limits::max(); + +} // namespace + +bool CCPPass::IsVaryingValue(uint32_t id) const { return id == kVaryingSSAId; } + +SSAPropagator::PropStatus CCPPass::MarkInstructionVarying(Instruction* instr) { + assert(instr->result_id() != 0 && + "Instructions with no result cannot be marked varying."); + values_[instr->result_id()] = kVaryingSSAId; + return SSAPropagator::kVarying; +} + +SSAPropagator::PropStatus CCPPass::VisitPhi(Instruction* phi) { + uint32_t meet_val_id = 0; + + // Implement the lattice meet operation. The result of this Phi instruction is + // interesting only if the meet operation over arguments coming through + // executable edges yields the same constant value. + for (uint32_t i = 2; i < phi->NumOperands(); i += 2) { + if (!propagator_->IsPhiArgExecutable(phi, i)) { + // Ignore arguments coming through non-executable edges. + continue; + } + uint32_t phi_arg_id = phi->GetSingleWordOperand(i); + auto it = values_.find(phi_arg_id); + if (it != values_.end()) { + // We found an argument with a constant value. Apply the meet operation + // with the previous arguments. + if (it->second == kVaryingSSAId) { + // The "constant" value is actually a placeholder for varying. Return + // varying for this phi. + return MarkInstructionVarying(phi); + } else if (meet_val_id == 0) { + // This is the first argument we find. Initialize the result to its + // constant value id. + meet_val_id = it->second; + } else if (it->second == meet_val_id) { + // The argument is the same constant value already computed. Continue + // looking. + continue; + } else { + // We either found a varying value, or another constant value different + // from the previous computed meet value. This Phi will never be + // constant. + return MarkInstructionVarying(phi); + } + } else { + // The incoming value has no recorded value and is therefore not + // interesting. A not interesting value joined with any other value is the + // other value. + continue; + } + } + + // If there are no incoming executable edges, the meet ID will still be 0. In + // that case, return not interesting to evaluate the Phi node again. + if (meet_val_id == 0) { + return SSAPropagator::kNotInteresting; + } + + // All the operands have the same constant value represented by |meet_val_id|. + // Set the Phi's result to that value and declare it interesting. + values_[phi->result_id()] = meet_val_id; + return SSAPropagator::kInteresting; +} + +SSAPropagator::PropStatus CCPPass::VisitAssignment(Instruction* instr) { + assert(instr->result_id() != 0 && + "Expecting an instruction that produces a result"); + + // If this is a copy operation, and the RHS is a known constant, assign its + // value to the LHS. + if (instr->opcode() == SpvOpCopyObject) { + uint32_t rhs_id = instr->GetSingleWordInOperand(0); + auto it = values_.find(rhs_id); + if (it != values_.end()) { + if (IsVaryingValue(it->second)) { + return MarkInstructionVarying(instr); + } else { + values_[instr->result_id()] = it->second; + return SSAPropagator::kInteresting; + } + } + return SSAPropagator::kNotInteresting; + } + + // Instructions with a RHS that cannot produce a constant are always varying. + if (!instr->IsFoldable()) { + return MarkInstructionVarying(instr); + } + + // See if the RHS of the assignment folds into a constant value. + auto map_func = [this](uint32_t id) { + auto it = values_.find(id); + if (it == values_.end() || IsVaryingValue(it->second)) { + return id; + } + return it->second; + }; + Instruction* folded_inst = + context()->get_instruction_folder().FoldInstructionToConstant(instr, + map_func); + if (folded_inst != nullptr) { + // We do not want to change the body of the function by adding new + // instructions. When folding we can only generate new constants. + assert(folded_inst->IsConstant() && "CCP is only interested in constant."); + values_[instr->result_id()] = folded_inst->result_id(); + return SSAPropagator::kInteresting; + } + + // Conservatively mark this instruction as varying if any input id is varying. + if (!instr->WhileEachInId([this](uint32_t* op_id) { + auto iter = values_.find(*op_id); + if (iter != values_.end() && IsVaryingValue(iter->second)) return false; + return true; + })) { + return MarkInstructionVarying(instr); + } + + // If not, see if there is a least one unknown operand to the instruction. If + // so, we might be able to fold it later. + if (!instr->WhileEachInId([this](uint32_t* op_id) { + auto it = values_.find(*op_id); + if (it == values_.end()) return false; + return true; + })) { + return SSAPropagator::kNotInteresting; + } + + // Otherwise, we will never be able to fold this instruction, so mark it + // varying. + return MarkInstructionVarying(instr); +} + +SSAPropagator::PropStatus CCPPass::VisitBranch(Instruction* instr, + BasicBlock** dest_bb) const { + assert(instr->IsBranch() && "Expected a branch instruction."); + + *dest_bb = nullptr; + uint32_t dest_label = 0; + if (instr->opcode() == SpvOpBranch) { + // An unconditional jump always goes to its unique destination. + dest_label = instr->GetSingleWordInOperand(0); + } else if (instr->opcode() == SpvOpBranchConditional) { + // For a conditional branch, determine whether the predicate selector has a + // known value in |values_|. If it does, set the destination block + // according to the selector's boolean value. + uint32_t pred_id = instr->GetSingleWordOperand(0); + auto it = values_.find(pred_id); + if (it == values_.end() || IsVaryingValue(it->second)) { + // The predicate has an unknown value, either branch could be taken. + return SSAPropagator::kVarying; + } + + // Get the constant value for the predicate selector from the value table. + // Use it to decide which branch will be taken. + uint32_t pred_val_id = it->second; + const analysis::Constant* c = const_mgr_->FindDeclaredConstant(pred_val_id); + assert(c && "Expected to find a constant declaration for a known value."); + // Undef values should have returned as varying above. + assert(c->AsBoolConstant() || c->AsNullConstant()); + if (c->AsNullConstant()) { + dest_label = instr->GetSingleWordOperand(2u); + } else { + const analysis::BoolConstant* val = c->AsBoolConstant(); + dest_label = val->value() ? instr->GetSingleWordOperand(1) + : instr->GetSingleWordOperand(2); + } + } else { + // For an OpSwitch, extract the value taken by the switch selector and check + // which of the target literals it matches. The branch associated with that + // literal is the taken branch. + assert(instr->opcode() == SpvOpSwitch); + if (instr->GetOperand(0).words.size() != 1) { + // If the selector is wider than 32-bits, return varying. TODO(dnovillo): + // Add support for wider constants. + return SSAPropagator::kVarying; + } + uint32_t select_id = instr->GetSingleWordOperand(0); + auto it = values_.find(select_id); + if (it == values_.end() || IsVaryingValue(it->second)) { + // The selector has an unknown value, any of the branches could be taken. + return SSAPropagator::kVarying; + } + + // Get the constant value for the selector from the value table. Use it to + // decide which branch will be taken. + uint32_t select_val_id = it->second; + const analysis::Constant* c = + const_mgr_->FindDeclaredConstant(select_val_id); + assert(c && "Expected to find a constant declaration for a known value."); + // TODO: support 64-bit integer switches. + uint32_t constant_cond = 0; + if (const analysis::IntConstant* val = c->AsIntConstant()) { + constant_cond = val->words()[0]; + } else { + // Undef values should have returned varying above. + assert(c->AsNullConstant()); + constant_cond = 0; + } + + // Start assuming that the selector will take the default value; + dest_label = instr->GetSingleWordOperand(1); + for (uint32_t i = 2; i < instr->NumOperands(); i += 2) { + if (constant_cond == instr->GetSingleWordOperand(i)) { + dest_label = instr->GetSingleWordOperand(i + 1); + break; + } + } + } + + assert(dest_label && "Destination label should be set at this point."); + *dest_bb = context()->cfg()->block(dest_label); + return SSAPropagator::kInteresting; +} + +SSAPropagator::PropStatus CCPPass::VisitInstruction(Instruction* instr, + BasicBlock** dest_bb) { + *dest_bb = nullptr; + if (instr->opcode() == SpvOpPhi) { + return VisitPhi(instr); + } else if (instr->IsBranch()) { + return VisitBranch(instr, dest_bb); + } else if (instr->result_id()) { + return VisitAssignment(instr); + } + return SSAPropagator::kVarying; +} + +bool CCPPass::ReplaceValues() { + bool retval = false; + for (const auto& it : values_) { + uint32_t id = it.first; + uint32_t cst_id = it.second; + if (!IsVaryingValue(cst_id) && id != cst_id) { + retval |= context()->ReplaceAllUsesWith(id, cst_id); + } + } + return retval; +} + +bool CCPPass::PropagateConstants(Function* fp) { + // Mark function parameters as varying. + fp->ForEachParam([this](const Instruction* inst) { + values_[inst->result_id()] = kVaryingSSAId; + }); + + const auto visit_fn = [this](Instruction* instr, BasicBlock** dest_bb) { + return VisitInstruction(instr, dest_bb); + }; + + propagator_ = + std::unique_ptr(new SSAPropagator(context(), visit_fn)); + + if (propagator_->Run(fp)) { + return ReplaceValues(); + } + + return false; +} + +void CCPPass::Initialize() { + const_mgr_ = context()->get_constant_mgr(); + + // Populate the constant table with values from constant declarations in the + // module. The values of each OpConstant declaration is the identity + // assignment (i.e., each constant is its own value). + for (const auto& inst : get_module()->types_values()) { + // Record compile time constant ids. Treat all other global values as + // varying. + if (inst.IsConstant()) { + values_[inst.result_id()] = inst.result_id(); + } else { + values_[inst.result_id()] = kVaryingSSAId; + } + } +} + +Pass::Status CCPPass::Process() { + Initialize(); + + // Process all entry point functions. + ProcessFunction pfn = [this](Function* fp) { return PropagateConstants(fp); }; + bool modified = ProcessReachableCallTree(pfn, context()); + return modified ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.h new file mode 100644 index 00000000000..178fd1281d1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ccp_pass.h @@ -0,0 +1,112 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_CCP_PASS_H_ +#define SOURCE_OPT_CCP_PASS_H_ + +#include +#include + +#include "source/opt/constants.h" +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" +#include "source/opt/propagator.h" + +namespace spvtools { +namespace opt { + +class CCPPass : public MemPass { + public: + CCPPass() = default; + + const char* name() const override { return "ccp"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisNameMap; + } + + private: + // Initializes the pass. + void Initialize(); + + // Runs constant propagation on the given function |fp|. Returns true if any + // constants were propagated and the IR modified. + bool PropagateConstants(Function* fp); + + // Visits a single instruction |instr|. If the instruction is a conditional + // branch that always jumps to the same basic block, it sets the destination + // block in |dest_bb|. + SSAPropagator::PropStatus VisitInstruction(Instruction* instr, + BasicBlock** dest_bb); + + // Visits an OpPhi instruction |phi|. This applies the meet operator for the + // CCP lattice. Essentially, if all the operands in |phi| have the same + // constant value C, the result for |phi| gets assigned the value C. + SSAPropagator::PropStatus VisitPhi(Instruction* phi); + + // Visits an SSA assignment instruction |instr|. If the RHS of |instr| folds + // into a constant value C, then the LHS of |instr| is assigned the value C in + // |values_|. + SSAPropagator::PropStatus VisitAssignment(Instruction* instr); + + // Visits a branch instruction |instr|. If the branch is conditional + // (OpBranchConditional or OpSwitch), and the value of its selector is known, + // |dest_bb| will be set to the corresponding destination block. Unconditional + // branches always set |dest_bb| to the single destination block. + SSAPropagator::PropStatus VisitBranch(Instruction* instr, + BasicBlock** dest_bb) const; + + // Replaces all operands used in |fp| with the corresponding constant values + // in |values_|. Returns true if any operands were replaced, and false + // otherwise. + bool ReplaceValues(); + + // Marks |instr| as varying by registering a varying value for its result + // into the |values_| table. Returns SSAPropagator::kVarying. + SSAPropagator::PropStatus MarkInstructionVarying(Instruction* instr); + + // Returns true if |id| is the special SSA id that corresponds to a varying + // value. + bool IsVaryingValue(uint32_t id) const; + + // Constant manager for the parent IR context. Used to record new constants + // generated during propagation. + analysis::ConstantManager* const_mgr_; + + // Constant value table. Each entry in this map + // represents the compile-time constant value for |id| as declared by + // |const_decl_id|. Each |const_decl_id| in this table is an OpConstant + // declaration for the current module. + // + // Additionally, this table keeps track of SSA IDs with varying values. If an + // SSA ID is found to have a varying value, it will have an entry in this + // table that maps to the special SSA id kVaryingSSAId. These values are + // never replaced in the IR, they are used by CCP during propagation. + std::unordered_map values_; + + // Propagator engine used. + std::unique_ptr propagator_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_CCP_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp new file mode 100644 index 00000000000..dcf2b573ff0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg.cpp @@ -0,0 +1,318 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/cfg.h" + +#include +#include + +#include "source/cfa.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { +namespace { + +using cbb_ptr = const opt::BasicBlock*; + +// Universal Limit of ResultID + 1 +const int kMaxResultId = 0x400000; + +} // namespace + +CFG::CFG(Module* module) + : module_(module), + pseudo_entry_block_(std::unique_ptr( + new Instruction(module->context(), SpvOpLabel, 0, 0, {}))), + pseudo_exit_block_(std::unique_ptr(new Instruction( + module->context(), SpvOpLabel, 0, kMaxResultId, {}))) { + for (auto& fn : *module) { + for (auto& blk : fn) { + RegisterBlock(&blk); + } + } +} + +void CFG::AddEdges(BasicBlock* blk) { + uint32_t blk_id = blk->id(); + // Force the creation of an entry, not all basic block have predecessors + // (such as the entry blocks and some unreachables). + label2preds_[blk_id]; + const auto* const_blk = blk; + const_blk->ForEachSuccessorLabel( + [blk_id, this](const uint32_t succ_id) { AddEdge(blk_id, succ_id); }); +} + +void CFG::RemoveNonExistingEdges(uint32_t blk_id) { + std::vector updated_pred_list; + for (uint32_t id : preds(blk_id)) { + const BasicBlock* pred_blk = block(id); + bool has_branch = false; + pred_blk->ForEachSuccessorLabel([&has_branch, blk_id](uint32_t succ) { + if (succ == blk_id) { + has_branch = true; + } + }); + if (has_branch) updated_pred_list.push_back(id); + } + + label2preds_.at(blk_id) = std::move(updated_pred_list); +} + +void CFG::ComputeStructuredOrder(Function* func, BasicBlock* root, + std::list* order) { + assert(module_->context()->get_feature_mgr()->HasCapability( + SpvCapabilityShader) && + "This only works on structured control flow"); + + // Compute structured successors and do DFS. + ComputeStructuredSuccessors(func); + auto ignore_block = [](cbb_ptr) {}; + auto ignore_edge = [](cbb_ptr, cbb_ptr) {}; + auto get_structured_successors = [this](const BasicBlock* b) { + return &(block2structured_succs_[b]); + }; + + // TODO(greg-lunarg): Get rid of const_cast by making moving const + // out of the cfa.h prototypes and into the invoking code. + auto post_order = [&](cbb_ptr b) { + order->push_front(const_cast(b)); + }; + CFA::DepthFirstTraversal(root, get_structured_successors, + ignore_block, post_order, ignore_edge); +} + +void CFG::ForEachBlockInPostOrder(BasicBlock* bb, + const std::function& f) { + std::vector po; + std::unordered_set seen; + ComputePostOrderTraversal(bb, &po, &seen); + + for (BasicBlock* current_bb : po) { + if (!IsPseudoExitBlock(current_bb) && !IsPseudoEntryBlock(current_bb)) { + f(current_bb); + } + } +} + +void CFG::ForEachBlockInReversePostOrder( + BasicBlock* bb, const std::function& f) { + std::vector po; + std::unordered_set seen; + ComputePostOrderTraversal(bb, &po, &seen); + + for (auto current_bb = po.rbegin(); current_bb != po.rend(); ++current_bb) { + if (!IsPseudoExitBlock(*current_bb) && !IsPseudoEntryBlock(*current_bb)) { + f(*current_bb); + } + } +} + +void CFG::ComputeStructuredSuccessors(Function* func) { + block2structured_succs_.clear(); + for (auto& blk : *func) { + // If no predecessors in function, make successor to pseudo entry. + if (label2preds_[blk.id()].size() == 0) + block2structured_succs_[&pseudo_entry_block_].push_back(&blk); + + // If header, make merge block first successor and continue block second + // successor if there is one. + uint32_t mbid = blk.MergeBlockIdIfAny(); + if (mbid != 0) { + block2structured_succs_[&blk].push_back(block(mbid)); + uint32_t cbid = blk.ContinueBlockIdIfAny(); + if (cbid != 0) { + block2structured_succs_[&blk].push_back(block(cbid)); + } + } + + // Add true successors. + const auto& const_blk = blk; + const_blk.ForEachSuccessorLabel([&blk, this](const uint32_t sbid) { + block2structured_succs_[&blk].push_back(block(sbid)); + }); + } +} + +void CFG::ComputePostOrderTraversal(BasicBlock* bb, + std::vector* order, + std::unordered_set* seen) { + seen->insert(bb); + static_cast(bb)->ForEachSuccessorLabel( + [&order, &seen, this](const uint32_t sbid) { + BasicBlock* succ_bb = id2block_[sbid]; + if (!seen->count(succ_bb)) { + ComputePostOrderTraversal(succ_bb, order, seen); + } + }); + order->push_back(bb); +} + +BasicBlock* CFG::SplitLoopHeader(BasicBlock* bb) { + assert(bb->GetLoopMergeInst() && "Expecting bb to be the header of a loop."); + + Function* fn = bb->GetParent(); + IRContext* context = module_->context(); + + // Find the insertion point for the new bb. + Function::iterator header_it = std::find_if( + fn->begin(), fn->end(), + [bb](BasicBlock& block_in_func) { return &block_in_func == bb; }); + assert(header_it != fn->end()); + + const std::vector& pred = preds(bb->id()); + // Find the back edge + BasicBlock* latch_block = nullptr; + Function::iterator latch_block_iter = header_it; + while (++latch_block_iter != fn->end()) { + // If blocks are in the proper order, then the only branch that appears + // after the header is the latch. + if (std::find(pred.begin(), pred.end(), latch_block_iter->id()) != + pred.end()) { + break; + } + } + assert(latch_block_iter != fn->end() && "Could not find the latch."); + latch_block = &*latch_block_iter; + + RemoveSuccessorEdges(bb); + + // Create the new header bb basic bb. + // Leave the phi instructions behind. + auto iter = bb->begin(); + while (iter->opcode() == SpvOpPhi) { + ++iter; + } + + std::unique_ptr newBlock( + bb->SplitBasicBlock(context, context->TakeNextId(), iter)); + + // Insert the new bb in the correct position + auto insert_pos = header_it; + ++insert_pos; + BasicBlock* new_header = &*insert_pos.InsertBefore(std::move(newBlock)); + new_header->SetParent(fn); + uint32_t new_header_id = new_header->id(); + context->AnalyzeDefUse(new_header->GetLabelInst()); + + // Update cfg + RegisterBlock(new_header); + + // Update bb mappings. + context->set_instr_block(new_header->GetLabelInst(), new_header); + new_header->ForEachInst([new_header, context](Instruction* inst) { + context->set_instr_block(inst, new_header); + }); + + // Adjust the OpPhi instructions as needed. + bb->ForEachPhiInst([latch_block, bb, new_header, context](Instruction* phi) { + std::vector preheader_phi_ops; + std::vector header_phi_ops; + + // Identify where the original inputs to original OpPhi belong: header or + // preheader. + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + uint32_t def_id = phi->GetSingleWordInOperand(i); + uint32_t branch_id = phi->GetSingleWordInOperand(i + 1); + if (branch_id == latch_block->id()) { + header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {def_id}}); + header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {branch_id}}); + } else { + preheader_phi_ops.push_back(def_id); + preheader_phi_ops.push_back(branch_id); + } + } + + // Create a phi instruction if and only if the preheader_phi_ops has more + // than one pair. + if (preheader_phi_ops.size() > 2) { + InstructionBuilder builder( + context, &*bb->begin(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + + Instruction* new_phi = builder.AddPhi(phi->type_id(), preheader_phi_ops); + + // Add the OpPhi to the header bb. + header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {new_phi->result_id()}}); + header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {bb->id()}}); + } else { + // An OpPhi with a single entry is just a copy. In this case use the same + // instruction in the new header. + header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {preheader_phi_ops[0]}}); + header_phi_ops.push_back({SPV_OPERAND_TYPE_ID, {bb->id()}}); + } + + phi->RemoveFromList(); + std::unique_ptr phi_owner(phi); + phi->SetInOperands(std::move(header_phi_ops)); + new_header->begin()->InsertBefore(std::move(phi_owner)); + context->set_instr_block(phi, new_header); + context->AnalyzeUses(phi); + }); + + // Add a branch to the new header. + InstructionBuilder branch_builder( + context, bb, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + bb->AddInstruction( + MakeUnique(context, SpvOpBranch, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {new_header->id()}}})); + context->AnalyzeUses(bb->terminator()); + context->set_instr_block(bb->terminator(), bb); + label2preds_[new_header->id()].push_back(bb->id()); + + // Update the latch to branch to the new header. + latch_block->ForEachSuccessorLabel([bb, new_header_id](uint32_t* id) { + if (*id == bb->id()) { + *id = new_header_id; + } + }); + Instruction* latch_branch = latch_block->terminator(); + context->AnalyzeUses(latch_branch); + label2preds_[new_header->id()].push_back(latch_block->id()); + + auto& block_preds = label2preds_[bb->id()]; + auto latch_pos = + std::find(block_preds.begin(), block_preds.end(), latch_block->id()); + assert(latch_pos != block_preds.end() && "The cfg was invalid."); + block_preds.erase(latch_pos); + + // Update the loop descriptors + if (context->AreAnalysesValid(IRContext::kAnalysisLoopAnalysis)) { + LoopDescriptor* loop_desc = context->GetLoopDescriptor(bb->GetParent()); + Loop* loop = (*loop_desc)[bb->id()]; + + loop->AddBasicBlock(new_header_id); + loop->SetHeaderBlock(new_header); + loop_desc->SetBasicBlockToLoop(new_header_id, loop); + + loop->RemoveBasicBlock(bb->id()); + loop->SetPreHeaderBlock(bb); + + Loop* parent_loop = loop->GetParent(); + if (parent_loop != nullptr) { + parent_loop->AddBasicBlock(bb->id()); + loop_desc->SetBasicBlockToLoop(bb->id(), parent_loop); + } else { + loop_desc->SetBasicBlockToLoop(bb->id(), nullptr); + } + } + return new_header; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg.h new file mode 100644 index 00000000000..375d09c5c73 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg.h @@ -0,0 +1,171 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_CFG_H_ +#define SOURCE_OPT_CFG_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" + +namespace spvtools { +namespace opt { + +class CFG { + public: + explicit CFG(Module* module); + + // Return the list of predecesors for basic block with label |blkid|. + // TODO(dnovillo): Move this to BasicBlock. + const std::vector& preds(uint32_t blk_id) const { + assert(label2preds_.count(blk_id)); + return label2preds_.at(blk_id); + } + + // Return a pointer to the basic block instance corresponding to the label + // |blk_id|. + BasicBlock* block(uint32_t blk_id) const { return id2block_.at(blk_id); } + + // Return the pseudo entry and exit blocks. + const BasicBlock* pseudo_entry_block() const { return &pseudo_entry_block_; } + BasicBlock* pseudo_entry_block() { return &pseudo_entry_block_; } + + const BasicBlock* pseudo_exit_block() const { return &pseudo_exit_block_; } + BasicBlock* pseudo_exit_block() { return &pseudo_exit_block_; } + + // Return true if |block_ptr| is the pseudo-entry block. + bool IsPseudoEntryBlock(BasicBlock* block_ptr) const { + return block_ptr == &pseudo_entry_block_; + } + + // Return true if |block_ptr| is the pseudo-exit block. + bool IsPseudoExitBlock(BasicBlock* block_ptr) const { + return block_ptr == &pseudo_exit_block_; + } + + // Compute structured block order into |order| for |func| starting at |root|. + // This order has the property that dominators come before all blocks they + // dominate and merge blocks come after all blocks that are in the control + // constructs of their header. + void ComputeStructuredOrder(Function* func, BasicBlock* root, + std::list* order); + + // Applies |f| to the basic block in post order starting with |bb|. + // Note that basic blocks that cannot be reached from |bb| node will not be + // processed. + void ForEachBlockInPostOrder(BasicBlock* bb, + const std::function& f); + + // Applies |f| to the basic block in reverse post order starting with |bb|. + // Note that basic blocks that cannot be reached from |bb| node will not be + // processed. + void ForEachBlockInReversePostOrder( + BasicBlock* bb, const std::function& f); + + // Registers |blk| as a basic block in the cfg, this also updates the + // predecessor lists of each successor of |blk|. + void RegisterBlock(BasicBlock* blk) { + uint32_t blk_id = blk->id(); + id2block_[blk_id] = blk; + AddEdges(blk); + } + + // Removes from the CFG any mapping for the basic block id |blk_id|. + void ForgetBlock(const BasicBlock* blk) { + id2block_.erase(blk->id()); + label2preds_.erase(blk->id()); + RemoveSuccessorEdges(blk); + } + + void RemoveEdge(uint32_t pred_blk_id, uint32_t succ_blk_id) { + auto pred_it = label2preds_.find(succ_blk_id); + if (pred_it == label2preds_.end()) return; + auto& preds_list = pred_it->second; + auto it = std::find(preds_list.begin(), preds_list.end(), pred_blk_id); + if (it != preds_list.end()) preds_list.erase(it); + } + + // Registers |blk| to all of its successors. + void AddEdges(BasicBlock* blk); + + // Registers the basic block id |pred_blk_id| as being a predecessor of the + // basic block id |succ_blk_id|. + void AddEdge(uint32_t pred_blk_id, uint32_t succ_blk_id) { + label2preds_[succ_blk_id].push_back(pred_blk_id); + } + + // Removes any edges that no longer exist from the predecessor mapping for + // the basic block id |blk_id|. + void RemoveNonExistingEdges(uint32_t blk_id); + + // Remove all edges that leave |bb|. + void RemoveSuccessorEdges(const BasicBlock* bb) { + bb->ForEachSuccessorLabel( + [bb, this](uint32_t succ_id) { RemoveEdge(bb->id(), succ_id); }); + } + + // Divides |block| into two basic blocks. The first block will have the same + // id as |block| and will become a preheader for the loop. The other block + // is a new block that will be the new loop header. + // + // Returns a pointer to the new loop header. + BasicBlock* SplitLoopHeader(BasicBlock* bb); + + private: + // Compute structured successors for function |func|. A block's structured + // successors are the blocks it branches to together with its declared merge + // block and continue block if it has them. When order matters, the merge + // block and continue block always appear first. This assures correct depth + // first search in the presence of early returns and kills. If the successor + // vector contain duplicates of the merge or continue blocks, they are safely + // ignored by DFS. + void ComputeStructuredSuccessors(Function* func); + + // Computes the post-order traversal of the cfg starting at |bb| skipping + // nodes in |seen|. The order of the traversal is appended to |order|, and + // all nodes in the traversal are added to |seen|. + void ComputePostOrderTraversal(BasicBlock* bb, + std::vector* order, + std::unordered_set* seen); + + // Module for this CFG. + Module* module_; + + // Map from block to its structured successor blocks. See + // ComputeStructuredSuccessors() for definition. + std::unordered_map> + block2structured_succs_; + + // Extra block whose successors are all blocks with no predecessors + // in function. + BasicBlock pseudo_entry_block_; + + // Augmented CFG Exit Block. + BasicBlock pseudo_exit_block_; + + // Map from block's label id to its predecessor blocks ids + std::unordered_map> label2preds_; + + // Map from block's label id to block. + std::unordered_map id2block_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_CFG_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp new file mode 100644 index 00000000000..2d548462b4b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.cpp @@ -0,0 +1,39 @@ +// Copyright (c) 2017 Google 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. + +// This file implements a pass to cleanup the CFG to remove superfluous +// constructs (e.g., unreachable basic blocks, empty control flow structures, +// etc) + +#include +#include + +#include "source/opt/cfg_cleanup_pass.h" + +#include "source/opt/function.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +Pass::Status CFGCleanupPass::Process() { + // Process all entry point functions. + ProcessFunction pfn = [this](Function* fp) { return CFGCleanup(fp); }; + bool modified = ProcessReachableCallTree(pfn, context()); + return modified ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.h new file mode 100644 index 00000000000..afbc67c09f3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/cfg_cleanup_pass.h @@ -0,0 +1,40 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_CFG_CLEANUP_PASS_H_ +#define SOURCE_OPT_CFG_CLEANUP_PASS_H_ + +#include "source/opt/function.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +class CFGCleanupPass : public MemPass { + public: + CFGCleanupPass() = default; + + const char* name() const override { return "cfg-cleanup"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse; + } +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_CFG_CLEANUP_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp new file mode 100644 index 00000000000..facfc24b6c0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.cpp @@ -0,0 +1,290 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/combine_access_chains.h" + +#include + +#include "source/opt/constants.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status CombineAccessChains::Process() { + bool modified = false; + + for (auto& function : *get_module()) { + modified |= ProcessFunction(function); + } + + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool CombineAccessChains::ProcessFunction(Function& function) { + bool modified = false; + + cfg()->ForEachBlockInReversePostOrder( + function.entry().get(), [&modified, this](BasicBlock* block) { + block->ForEachInst([&modified, this](Instruction* inst) { + switch (inst->opcode()) { + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpPtrAccessChain: + case SpvOpInBoundsPtrAccessChain: + modified |= CombineAccessChain(inst); + break; + default: + break; + } + }); + }); + + return modified; +} + +uint32_t CombineAccessChains::GetConstantValue( + const analysis::Constant* constant_inst) { + if (constant_inst->type()->AsInteger()->width() <= 32) { + if (constant_inst->type()->AsInteger()->IsSigned()) { + return static_cast(constant_inst->GetS32()); + } else { + return constant_inst->GetU32(); + } + } else { + assert(false); + return 0u; + } +} + +uint32_t CombineAccessChains::GetArrayStride(const Instruction* inst) { + uint32_t array_stride = 0; + context()->get_decoration_mgr()->WhileEachDecoration( + inst->type_id(), SpvDecorationArrayStride, + [&array_stride](const Instruction& decoration) { + assert(decoration.opcode() != SpvOpDecorateId); + if (decoration.opcode() == SpvOpDecorate) { + array_stride = decoration.GetSingleWordInOperand(1); + } else { + array_stride = decoration.GetSingleWordInOperand(2); + } + return false; + }); + return array_stride; +} + +const analysis::Type* CombineAccessChains::GetIndexedType(Instruction* inst) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + + Instruction* base_ptr = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + const analysis::Type* type = type_mgr->GetType(base_ptr->type_id()); + assert(type->AsPointer()); + type = type->AsPointer()->pointee_type(); + std::vector element_indices; + uint32_t starting_index = 1; + if (IsPtrAccessChain(inst->opcode())) { + // Skip the first index of OpPtrAccessChain as it does not affect type + // resolution. + starting_index = 2; + } + for (uint32_t i = starting_index; i < inst->NumInOperands(); ++i) { + Instruction* index_inst = + def_use_mgr->GetDef(inst->GetSingleWordInOperand(i)); + const analysis::Constant* index_constant = + context()->get_constant_mgr()->GetConstantFromInst(index_inst); + if (index_constant) { + uint32_t index_value = GetConstantValue(index_constant); + element_indices.push_back(index_value); + } else { + // This index must not matter to resolve the type in valid SPIR-V. + element_indices.push_back(0); + } + } + type = type_mgr->GetMemberType(type, element_indices); + return type; +} + +bool CombineAccessChains::CombineIndices(Instruction* ptr_input, + Instruction* inst, + std::vector* new_operands) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::ConstantManager* constant_mgr = context()->get_constant_mgr(); + + Instruction* last_index_inst = def_use_mgr->GetDef( + ptr_input->GetSingleWordInOperand(ptr_input->NumInOperands() - 1)); + const analysis::Constant* last_index_constant = + constant_mgr->GetConstantFromInst(last_index_inst); + + Instruction* element_inst = + def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); + const analysis::Constant* element_constant = + constant_mgr->GetConstantFromInst(element_inst); + + // Combine the last index of the AccessChain (|ptr_inst|) with the element + // operand of the PtrAccessChain (|inst|). + const bool combining_element_operands = + IsPtrAccessChain(inst->opcode()) && + IsPtrAccessChain(ptr_input->opcode()) && ptr_input->NumInOperands() == 2; + uint32_t new_value_id = 0; + const analysis::Type* type = GetIndexedType(ptr_input); + if (last_index_constant && element_constant) { + // Combine the constants. + uint32_t new_value = GetConstantValue(last_index_constant) + + GetConstantValue(element_constant); + const analysis::Constant* new_value_constant = + constant_mgr->GetConstant(last_index_constant->type(), {new_value}); + Instruction* new_value_inst = + constant_mgr->GetDefiningInstruction(new_value_constant); + new_value_id = new_value_inst->result_id(); + } else if (!type->AsStruct() || combining_element_operands) { + // Generate an addition of the two indices. + InstructionBuilder builder( + context(), inst, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + Instruction* addition = builder.AddIAdd(last_index_inst->type_id(), + last_index_inst->result_id(), + element_inst->result_id()); + new_value_id = addition->result_id(); + } else { + // Indexing into structs must be constant, so bail out here. + return false; + } + new_operands->push_back({SPV_OPERAND_TYPE_ID, {new_value_id}}); + return true; +} + +bool CombineAccessChains::CreateNewInputOperands( + Instruction* ptr_input, Instruction* inst, + std::vector* new_operands) { + // Start by copying all the input operands of the feeder access chain. + for (uint32_t i = 0; i != ptr_input->NumInOperands() - 1; ++i) { + new_operands->push_back(ptr_input->GetInOperand(i)); + } + + // Deal with the last index of the feeder access chain. + if (IsPtrAccessChain(inst->opcode())) { + // The last index of the feeder should be combined with the element operand + // of |inst|. + if (!CombineIndices(ptr_input, inst, new_operands)) return false; + } else { + // The indices aren't being combined so now add the last index operand of + // |ptr_input|. + new_operands->push_back( + ptr_input->GetInOperand(ptr_input->NumInOperands() - 1)); + } + + // Copy the remaining index operands. + uint32_t starting_index = IsPtrAccessChain(inst->opcode()) ? 2 : 1; + for (uint32_t i = starting_index; i < inst->NumInOperands(); ++i) { + new_operands->push_back(inst->GetInOperand(i)); + } + + return true; +} + +bool CombineAccessChains::CombineAccessChain(Instruction* inst) { + assert((inst->opcode() == SpvOpPtrAccessChain || + inst->opcode() == SpvOpAccessChain || + inst->opcode() == SpvOpInBoundsAccessChain || + inst->opcode() == SpvOpInBoundsPtrAccessChain) && + "Wrong opcode. Expected an access chain."); + + Instruction* ptr_input = + context()->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0)); + if (ptr_input->opcode() != SpvOpAccessChain && + ptr_input->opcode() != SpvOpInBoundsAccessChain && + ptr_input->opcode() != SpvOpPtrAccessChain && + ptr_input->opcode() != SpvOpInBoundsPtrAccessChain) { + return false; + } + + if (Has64BitIndices(inst) || Has64BitIndices(ptr_input)) return false; + + // Handles the following cases: + // 1. |ptr_input| is an index-less access chain. Replace the pointer + // in |inst| with |ptr_input|'s pointer. + // 2. |inst| is a index-less access chain. Change |inst| to an + // OpCopyObject. + // 3. |inst| is not a pointer access chain. + // |inst|'s indices are appended to |ptr_input|'s indices. + // 4. |ptr_input| is not pointer access chain. + // |inst| is a pointer access chain. + // |inst|'s element operand is combined with the last index in + // |ptr_input| to form a new operand. + // 5. |ptr_input| is a pointer access chain. + // Like the above scenario, |inst|'s element operand is combined + // with |ptr_input|'s last index. This results is either a + // combined element operand or combined regular index. + + // TODO(alan-baker): Support this properly. Requires analyzing the + // size/alignment of the type and converting the stride into an element + // index. + uint32_t array_stride = GetArrayStride(ptr_input); + if (array_stride != 0) return false; + + if (ptr_input->NumInOperands() == 1) { + // The input is effectively a no-op. + inst->SetInOperand(0, {ptr_input->GetSingleWordInOperand(0)}); + context()->AnalyzeUses(inst); + } else if (inst->NumInOperands() == 1) { + // |inst| is a no-op, change it to a copy. Instruction simplification will + // clean it up. + inst->SetOpcode(SpvOpCopyObject); + } else { + std::vector new_operands; + if (!CreateNewInputOperands(ptr_input, inst, &new_operands)) return false; + + // Update the instruction. + inst->SetOpcode(UpdateOpcode(inst->opcode(), ptr_input->opcode())); + inst->SetInOperands(std::move(new_operands)); + context()->AnalyzeUses(inst); + } + return true; +} + +SpvOp CombineAccessChains::UpdateOpcode(SpvOp base_opcode, SpvOp input_opcode) { + auto IsInBounds = [](SpvOp opcode) { + return opcode == SpvOpInBoundsPtrAccessChain || + opcode == SpvOpInBoundsAccessChain; + }; + + if (input_opcode == SpvOpInBoundsPtrAccessChain) { + if (!IsInBounds(base_opcode)) return SpvOpPtrAccessChain; + } else if (input_opcode == SpvOpInBoundsAccessChain) { + if (!IsInBounds(base_opcode)) return SpvOpAccessChain; + } + + return input_opcode; +} + +bool CombineAccessChains::IsPtrAccessChain(SpvOp opcode) { + return opcode == SpvOpPtrAccessChain || opcode == SpvOpInBoundsPtrAccessChain; +} + +bool CombineAccessChains::Has64BitIndices(Instruction* inst) { + for (uint32_t i = 1; i < inst->NumInOperands(); ++i) { + Instruction* index_inst = + context()->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(i)); + const analysis::Type* index_type = + context()->get_type_mgr()->GetType(index_inst->type_id()); + if (!index_type->AsInteger() || index_type->AsInteger()->width() != 32) + return true; + } + return false; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h new file mode 100644 index 00000000000..75885dadafe --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/combine_access_chains.h @@ -0,0 +1,82 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_COMBINE_ACCESS_CHAINS_H_ +#define SOURCE_OPT_COMBINE_ACCESS_CHAINS_H_ + +#include + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class CombineAccessChains : public Pass { + public: + const char* name() const override { return "combine-access-chains"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisNameMap; + } + + private: + // Combine access chains in |function|. Blocks are processed in reverse + // post-order. Returns true if the function is modified. + bool ProcessFunction(Function& function); + + // Combines an access chain (normal, in bounds or pointer) |inst| if its base + // pointer is another access chain. Returns true if the access chain was + // modified. + bool CombineAccessChain(Instruction* inst); + + // Returns the value of |constant_inst| as a uint32_t. + uint32_t GetConstantValue(const analysis::Constant* constant_inst); + + // Returns the array stride of |inst|'s type. + uint32_t GetArrayStride(const Instruction* inst); + + // Returns the type by resolving the index operands |inst|. |inst| must be an + // access chain instruction. + const analysis::Type* GetIndexedType(Instruction* inst); + + // Populates |new_operands| with the operands for the combined access chain. + // Returns false if the access chains cannot be combined. + bool CreateNewInputOperands(Instruction* ptr_input, Instruction* inst, + std::vector* new_operands); + + // Combines the last index of |ptr_input| with the element operand of |inst|. + // Adds the combined operand to |new_operands|. + bool CombineIndices(Instruction* ptr_input, Instruction* inst, + std::vector* new_operands); + + // Returns the opcode to use for the combined access chain. + SpvOp UpdateOpcode(SpvOp base_opcode, SpvOp input_opcode); + + // Returns true if |opcode| is a pointer access chain. + bool IsPtrAccessChain(SpvOp opcode); + + // Returns true if |inst| (an access chain) has 64-bit indices. + bool Has64BitIndices(Instruction* inst); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_COMBINE_ACCESS_CHAINS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/common_uniform_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/common_uniform_elim_pass.cpp new file mode 100644 index 00000000000..e6426a555d9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/common_uniform_elim_pass.cpp @@ -0,0 +1,580 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/common_uniform_elim_pass.h" +#include "source/cfa.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kAccessChainPtrIdInIdx = 0; +const uint32_t kTypePointerStorageClassInIdx = 0; +const uint32_t kTypePointerTypeIdInIdx = 1; +const uint32_t kConstantValueInIdx = 0; +const uint32_t kExtractCompositeIdInIdx = 0; +const uint32_t kExtractIdx0InIdx = 1; +const uint32_t kStorePtrIdInIdx = 0; +const uint32_t kLoadPtrIdInIdx = 0; +const uint32_t kCopyObjectOperandInIdx = 0; +const uint32_t kTypeIntWidthInIdx = 0; + +} // anonymous namespace + +bool CommonUniformElimPass::IsNonPtrAccessChain(const SpvOp opcode) const { + return opcode == SpvOpAccessChain || opcode == SpvOpInBoundsAccessChain; +} + +bool CommonUniformElimPass::IsSamplerOrImageType( + const Instruction* typeInst) const { + switch (typeInst->opcode()) { + case SpvOpTypeSampler: + case SpvOpTypeImage: + case SpvOpTypeSampledImage: + return true; + default: + break; + } + if (typeInst->opcode() != SpvOpTypeStruct) return false; + // Return true if any member is a sampler or image + return !typeInst->WhileEachInId([this](const uint32_t* tid) { + const Instruction* compTypeInst = get_def_use_mgr()->GetDef(*tid); + if (IsSamplerOrImageType(compTypeInst)) { + return false; + } + return true; + }); +} + +bool CommonUniformElimPass::IsSamplerOrImageVar(uint32_t varId) const { + const Instruction* varInst = get_def_use_mgr()->GetDef(varId); + assert(varInst->opcode() == SpvOpVariable); + const uint32_t varTypeId = varInst->type_id(); + const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); + const uint32_t varPteTypeId = + varTypeInst->GetSingleWordInOperand(kTypePointerTypeIdInIdx); + Instruction* varPteTypeInst = get_def_use_mgr()->GetDef(varPteTypeId); + return IsSamplerOrImageType(varPteTypeInst); +} + +Instruction* CommonUniformElimPass::GetPtr(Instruction* ip, uint32_t* objId) { + const SpvOp op = ip->opcode(); + assert(op == SpvOpStore || op == SpvOpLoad); + *objId = ip->GetSingleWordInOperand(op == SpvOpStore ? kStorePtrIdInIdx + : kLoadPtrIdInIdx); + Instruction* ptrInst = get_def_use_mgr()->GetDef(*objId); + while (ptrInst->opcode() == SpvOpCopyObject) { + *objId = ptrInst->GetSingleWordInOperand(kCopyObjectOperandInIdx); + ptrInst = get_def_use_mgr()->GetDef(*objId); + } + Instruction* objInst = ptrInst; + while (objInst->opcode() != SpvOpVariable && + objInst->opcode() != SpvOpFunctionParameter) { + if (IsNonPtrAccessChain(objInst->opcode())) { + *objId = objInst->GetSingleWordInOperand(kAccessChainPtrIdInIdx); + } else { + assert(objInst->opcode() == SpvOpCopyObject); + *objId = objInst->GetSingleWordInOperand(kCopyObjectOperandInIdx); + } + objInst = get_def_use_mgr()->GetDef(*objId); + } + return ptrInst; +} + +bool CommonUniformElimPass::IsVolatileStruct(uint32_t type_id) { + assert(get_def_use_mgr()->GetDef(type_id)->opcode() == SpvOpTypeStruct); + return !get_decoration_mgr()->WhileEachDecoration( + type_id, SpvDecorationVolatile, [](const Instruction&) { return false; }); +} + +bool CommonUniformElimPass::IsAccessChainToVolatileStructType( + const Instruction& AccessChainInst) { + assert(AccessChainInst.opcode() == SpvOpAccessChain); + + uint32_t ptr_id = AccessChainInst.GetSingleWordInOperand(0); + const Instruction* ptr_inst = get_def_use_mgr()->GetDef(ptr_id); + uint32_t pointee_type_id = GetPointeeTypeId(ptr_inst); + const uint32_t num_operands = AccessChainInst.NumOperands(); + + // walk the type tree: + for (uint32_t idx = 3; idx < num_operands; ++idx) { + Instruction* pointee_type = get_def_use_mgr()->GetDef(pointee_type_id); + + switch (pointee_type->opcode()) { + case SpvOpTypeMatrix: + case SpvOpTypeVector: + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: + pointee_type_id = pointee_type->GetSingleWordOperand(1); + break; + case SpvOpTypeStruct: + // check for volatile decorations: + if (IsVolatileStruct(pointee_type_id)) return true; + + if (idx < num_operands - 1) { + const uint32_t index_id = AccessChainInst.GetSingleWordOperand(idx); + const Instruction* index_inst = get_def_use_mgr()->GetDef(index_id); + uint32_t index_value = index_inst->GetSingleWordOperand( + 2); // TODO: replace with GetUintValueFromConstant() + pointee_type_id = pointee_type->GetSingleWordInOperand(index_value); + } + break; + default: + assert(false && "Unhandled pointee type."); + } + } + return false; +} + +bool CommonUniformElimPass::IsVolatileLoad(const Instruction& loadInst) { + assert(loadInst.opcode() == SpvOpLoad); + // Check if this Load instruction has Volatile Memory Access flag + if (loadInst.NumOperands() == 4) { + uint32_t memory_access_mask = loadInst.GetSingleWordOperand(3); + if (memory_access_mask & SpvMemoryAccessVolatileMask) return true; + } + // If we load a struct directly (result type is struct), + // check if the struct is decorated volatile + uint32_t type_id = loadInst.type_id(); + if (get_def_use_mgr()->GetDef(type_id)->opcode() == SpvOpTypeStruct) + return IsVolatileStruct(type_id); + else + return false; +} + +bool CommonUniformElimPass::IsUniformVar(uint32_t varId) { + const Instruction* varInst = + get_def_use_mgr()->id_to_defs().find(varId)->second; + if (varInst->opcode() != SpvOpVariable) return false; + const uint32_t varTypeId = varInst->type_id(); + const Instruction* varTypeInst = + get_def_use_mgr()->id_to_defs().find(varTypeId)->second; + return varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) == + SpvStorageClassUniform || + varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) == + SpvStorageClassUniformConstant; +} + +bool CommonUniformElimPass::HasUnsupportedDecorates(uint32_t id) const { + return !get_def_use_mgr()->WhileEachUser(id, [this](Instruction* user) { + if (IsNonTypeDecorate(user->opcode())) return false; + return true; + }); +} + +bool CommonUniformElimPass::HasOnlyNamesAndDecorates(uint32_t id) const { + return get_def_use_mgr()->WhileEachUser(id, [this](Instruction* user) { + SpvOp op = user->opcode(); + if (op != SpvOpName && !IsNonTypeDecorate(op)) return false; + return true; + }); +} + +void CommonUniformElimPass::DeleteIfUseless(Instruction* inst) { + const uint32_t resId = inst->result_id(); + assert(resId != 0); + if (HasOnlyNamesAndDecorates(resId)) { + context()->KillInst(inst); + } +} + +Instruction* CommonUniformElimPass::ReplaceAndDeleteLoad(Instruction* loadInst, + uint32_t replId, + Instruction* ptrInst) { + const uint32_t loadId = loadInst->result_id(); + context()->KillNamesAndDecorates(loadId); + (void)context()->ReplaceAllUsesWith(loadId, replId); + // remove load instruction + Instruction* next_instruction = context()->KillInst(loadInst); + // if access chain, see if it can be removed as well + if (IsNonPtrAccessChain(ptrInst->opcode())) DeleteIfUseless(ptrInst); + return next_instruction; +} + +void CommonUniformElimPass::GenACLoadRepl( + const Instruction* ptrInst, + std::vector>* newInsts, uint32_t* resultId) { + // Build and append Load + const uint32_t ldResultId = TakeNextId(); + const uint32_t varId = + ptrInst->GetSingleWordInOperand(kAccessChainPtrIdInIdx); + const Instruction* varInst = get_def_use_mgr()->GetDef(varId); + assert(varInst->opcode() == SpvOpVariable); + const uint32_t varPteTypeId = GetPointeeTypeId(varInst); + std::vector load_in_operands; + load_in_operands.push_back(Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, + std::initializer_list{varId})); + std::unique_ptr newLoad(new Instruction( + context(), SpvOpLoad, varPteTypeId, ldResultId, load_in_operands)); + get_def_use_mgr()->AnalyzeInstDefUse(&*newLoad); + newInsts->emplace_back(std::move(newLoad)); + + // Build and append Extract + const uint32_t extResultId = TakeNextId(); + const uint32_t ptrPteTypeId = GetPointeeTypeId(ptrInst); + std::vector ext_in_opnds; + ext_in_opnds.push_back(Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, + std::initializer_list{ldResultId})); + uint32_t iidIdx = 0; + ptrInst->ForEachInId([&iidIdx, &ext_in_opnds, this](const uint32_t* iid) { + if (iidIdx > 0) { + const Instruction* cInst = get_def_use_mgr()->GetDef(*iid); + uint32_t val = cInst->GetSingleWordInOperand(kConstantValueInIdx); + ext_in_opnds.push_back( + Operand(spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, + std::initializer_list{val})); + } + ++iidIdx; + }); + std::unique_ptr newExt( + new Instruction(context(), SpvOpCompositeExtract, ptrPteTypeId, + extResultId, ext_in_opnds)); + get_def_use_mgr()->AnalyzeInstDefUse(&*newExt); + newInsts->emplace_back(std::move(newExt)); + *resultId = extResultId; +} + +bool CommonUniformElimPass::IsConstantIndexAccessChain(Instruction* acp) { + uint32_t inIdx = 0; + return acp->WhileEachInId([&inIdx, this](uint32_t* tid) { + if (inIdx > 0) { + Instruction* opInst = get_def_use_mgr()->GetDef(*tid); + if (opInst->opcode() != SpvOpConstant) return false; + } + ++inIdx; + return true; + }); +} + +bool CommonUniformElimPass::UniformAccessChainConvert(Function* func) { + bool modified = false; + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (Instruction* inst = &*bi->begin(); inst; inst = inst->NextNode()) { + if (inst->opcode() != SpvOpLoad) continue; + uint32_t varId; + Instruction* ptrInst = GetPtr(inst, &varId); + if (!IsNonPtrAccessChain(ptrInst->opcode())) continue; + // Do not convert nested access chains + if (ptrInst->GetSingleWordInOperand(kAccessChainPtrIdInIdx) != varId) + continue; + if (!IsUniformVar(varId)) continue; + if (!IsConstantIndexAccessChain(ptrInst)) continue; + if (HasUnsupportedDecorates(inst->result_id())) continue; + if (HasUnsupportedDecorates(ptrInst->result_id())) continue; + if (IsVolatileLoad(*inst)) continue; + if (IsAccessChainToVolatileStructType(*ptrInst)) continue; + std::vector> newInsts; + uint32_t replId; + GenACLoadRepl(ptrInst, &newInsts, &replId); + inst = ReplaceAndDeleteLoad(inst, replId, ptrInst); + inst = inst->InsertBefore(std::move(newInsts)); + modified = true; + } + } + return modified; +} + +void CommonUniformElimPass::ComputeStructuredSuccessors(Function* func) { + block2structured_succs_.clear(); + for (auto& blk : *func) { + // If header, make merge block first successor. + uint32_t mbid = blk.MergeBlockIdIfAny(); + if (mbid != 0) { + block2structured_succs_[&blk].push_back(cfg()->block(mbid)); + uint32_t cbid = blk.ContinueBlockIdIfAny(); + if (cbid != 0) { + block2structured_succs_[&blk].push_back(cfg()->block(mbid)); + } + } + // add true successors + const auto& const_blk = blk; + const_blk.ForEachSuccessorLabel([&blk, this](const uint32_t sbid) { + block2structured_succs_[&blk].push_back(cfg()->block(sbid)); + }); + } +} + +void CommonUniformElimPass::ComputeStructuredOrder( + Function* func, std::list* order) { + // Compute structured successors and do DFS + ComputeStructuredSuccessors(func); + auto ignore_block = [](cbb_ptr) {}; + auto ignore_edge = [](cbb_ptr, cbb_ptr) {}; + auto get_structured_successors = [this](const BasicBlock* block) { + return &(block2structured_succs_[block]); + }; + // TODO(greg-lunarg): Get rid of const_cast by making moving const + // out of the cfa.h prototypes and into the invoking code. + auto post_order = [&](cbb_ptr b) { + order->push_front(const_cast(b)); + }; + + order->clear(); + CFA::DepthFirstTraversal(&*func->begin(), + get_structured_successors, ignore_block, + post_order, ignore_edge); +} + +bool CommonUniformElimPass::CommonUniformLoadElimination(Function* func) { + // Process all blocks in structured order. This is just one way (the + // simplest?) to keep track of the most recent block outside of control + // flow, used to copy common instructions, guaranteed to dominate all + // following load sites. + std::list structuredOrder; + ComputeStructuredOrder(func, &structuredOrder); + uniform2load_id_.clear(); + bool modified = false; + // Find insertion point in first block to copy non-dominating loads. + auto insertItr = func->begin()->begin(); + while (insertItr->opcode() == SpvOpVariable || + insertItr->opcode() == SpvOpNop) + ++insertItr; + // Update insertItr until it will not be removed. Without this code, + // ReplaceAndDeleteLoad() can set |insertItr| as a dangling pointer. + while (IsUniformLoadToBeRemoved(&*insertItr)) ++insertItr; + uint32_t mergeBlockId = 0; + for (auto bi = structuredOrder.begin(); bi != structuredOrder.end(); ++bi) { + BasicBlock* bp = *bi; + // Check if we are exiting outermost control construct. If so, remember + // new load insertion point. Trying to keep register pressure down. + if (mergeBlockId == bp->id()) { + mergeBlockId = 0; + insertItr = bp->begin(); + // Update insertItr until it will not be removed. Without this code, + // ReplaceAndDeleteLoad() can set |insertItr| as a dangling pointer. + while (IsUniformLoadToBeRemoved(&*insertItr)) ++insertItr; + } + for (Instruction* inst = &*bp->begin(); inst; inst = inst->NextNode()) { + if (inst->opcode() != SpvOpLoad) continue; + uint32_t varId; + Instruction* ptrInst = GetPtr(inst, &varId); + if (ptrInst->opcode() != SpvOpVariable) continue; + if (!IsUniformVar(varId)) continue; + if (IsSamplerOrImageVar(varId)) continue; + if (HasUnsupportedDecorates(inst->result_id())) continue; + if (IsVolatileLoad(*inst)) continue; + uint32_t replId; + const auto uItr = uniform2load_id_.find(varId); + if (uItr != uniform2load_id_.end()) { + replId = uItr->second; + } else { + if (mergeBlockId == 0) { + // Load is in dominating block; just remember it + uniform2load_id_[varId] = inst->result_id(); + continue; + } else { + // Copy load into most recent dominating block and remember it + replId = TakeNextId(); + std::unique_ptr newLoad(new Instruction( + context(), SpvOpLoad, inst->type_id(), replId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {varId}}})); + get_def_use_mgr()->AnalyzeInstDefUse(&*newLoad); + insertItr = insertItr.InsertBefore(std::move(newLoad)); + ++insertItr; + uniform2load_id_[varId] = replId; + } + } + inst = ReplaceAndDeleteLoad(inst, replId, ptrInst); + modified = true; + } + // If we are outside of any control construct and entering one, remember + // the id of the merge block + if (mergeBlockId == 0) { + mergeBlockId = bp->MergeBlockIdIfAny(); + } + } + return modified; +} + +bool CommonUniformElimPass::CommonUniformLoadElimBlock(Function* func) { + bool modified = false; + for (auto& blk : *func) { + uniform2load_id_.clear(); + for (Instruction* inst = &*blk.begin(); inst; inst = inst->NextNode()) { + if (inst->opcode() != SpvOpLoad) continue; + uint32_t varId; + Instruction* ptrInst = GetPtr(inst, &varId); + if (ptrInst->opcode() != SpvOpVariable) continue; + if (!IsUniformVar(varId)) continue; + if (!IsSamplerOrImageVar(varId)) continue; + if (HasUnsupportedDecorates(inst->result_id())) continue; + if (IsVolatileLoad(*inst)) continue; + uint32_t replId; + const auto uItr = uniform2load_id_.find(varId); + if (uItr != uniform2load_id_.end()) { + replId = uItr->second; + } else { + uniform2load_id_[varId] = inst->result_id(); + continue; + } + inst = ReplaceAndDeleteLoad(inst, replId, ptrInst); + modified = true; + } + } + return modified; +} + +bool CommonUniformElimPass::CommonExtractElimination(Function* func) { + // Find all composite ids with duplicate extracts. + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end(); ++ii) { + if (ii->opcode() != SpvOpCompositeExtract) continue; + // TODO(greg-lunarg): Support multiple indices + if (ii->NumInOperands() > 2) continue; + if (HasUnsupportedDecorates(ii->result_id())) continue; + uint32_t compId = ii->GetSingleWordInOperand(kExtractCompositeIdInIdx); + uint32_t idx = ii->GetSingleWordInOperand(kExtractIdx0InIdx); + comp2idx2inst_[compId][idx].push_back(&*ii); + } + } + // For all defs of ids with duplicate extracts, insert new extracts + // after def, and replace and delete old extracts + bool modified = false; + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end(); ++ii) { + const auto cItr = comp2idx2inst_.find(ii->result_id()); + if (cItr == comp2idx2inst_.end()) continue; + for (auto idxItr : cItr->second) { + if (idxItr.second.size() < 2) continue; + uint32_t replId = TakeNextId(); + std::unique_ptr newExtract( + idxItr.second.front()->Clone(context())); + newExtract->SetResultId(replId); + get_def_use_mgr()->AnalyzeInstDefUse(&*newExtract); + ++ii; + ii = ii.InsertBefore(std::move(newExtract)); + for (auto instItr : idxItr.second) { + uint32_t resId = instItr->result_id(); + context()->KillNamesAndDecorates(resId); + (void)context()->ReplaceAllUsesWith(resId, replId); + context()->KillInst(instItr); + } + modified = true; + } + } + } + return modified; +} + +bool CommonUniformElimPass::EliminateCommonUniform(Function* func) { + bool modified = false; + modified |= UniformAccessChainConvert(func); + modified |= CommonUniformLoadElimination(func); + modified |= CommonExtractElimination(func); + + modified |= CommonUniformLoadElimBlock(func); + return modified; +} + +void CommonUniformElimPass::Initialize() { + // Clear collections. + comp2idx2inst_.clear(); + + // Initialize extension whitelist + InitExtensions(); +} + +bool CommonUniformElimPass::AllExtensionsSupported() const { + // If any extension not in whitelist, return false + for (auto& ei : get_module()->extensions()) { + const char* extName = + reinterpret_cast(&ei.GetInOperand(0).words[0]); + if (extensions_whitelist_.find(extName) == extensions_whitelist_.end()) + return false; + } + return true; +} + +Pass::Status CommonUniformElimPass::ProcessImpl() { + // Assumes all control flow structured. + // TODO(greg-lunarg): Do SSA rewrite for non-structured control flow + if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + return Status::SuccessWithoutChange; + // Assumes logical addressing only + // TODO(greg-lunarg): Add support for physical addressing + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + return Status::SuccessWithoutChange; + // Do not process if any disallowed extensions are enabled + if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; + // Do not process if module contains OpGroupDecorate. Additional + // support required in KillNamesAndDecorates(). + // TODO(greg-lunarg): Add support for OpGroupDecorate + for (auto& ai : get_module()->annotations()) + if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + // If non-32-bit integer type in module, terminate processing + // TODO(): Handle non-32-bit integer constants in access chains + for (const Instruction& inst : get_module()->types_values()) + if (inst.opcode() == SpvOpTypeInt && + inst.GetSingleWordInOperand(kTypeIntWidthInIdx) != 32) + return Status::SuccessWithoutChange; + // Process entry point functions + ProcessFunction pfn = [this](Function* fp) { + return EliminateCommonUniform(fp); + }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +CommonUniformElimPass::CommonUniformElimPass() = default; + +Pass::Status CommonUniformElimPass::Process() { + Initialize(); + return ProcessImpl(); +} + +void CommonUniformElimPass::InitExtensions() { + extensions_whitelist_.clear(); + extensions_whitelist_.insert({ + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/common_uniform_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/common_uniform_elim_pass.h new file mode 100644 index 00000000000..e6ef69c5dca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/common_uniform_elim_pass.h @@ -0,0 +1,213 @@ +// Copyright (c) 2016 The Khronos Group Inc. +// Copyright (c) 2016 Valve Corporation +// Copyright (c) 2016 LunarG 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. + +#ifndef SOURCE_OPT_COMMON_UNIFORM_ELIM_PASS_H_ +#define SOURCE_OPT_COMMON_UNIFORM_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class CommonUniformElimPass : public Pass { + using cbb_ptr = const BasicBlock*; + + public: + using GetBlocksFunction = + std::function*(const BasicBlock*)>; + + CommonUniformElimPass(); + + const char* name() const override { return "eliminate-common-uniform"; } + Status Process() override; + + private: + // Returns true if |opcode| is a non-ptr access chain op + bool IsNonPtrAccessChain(const SpvOp opcode) const; + + // Returns true if |typeInst| is a sampler or image type or a struct + // containing one, recursively. + bool IsSamplerOrImageType(const Instruction* typeInst) const; + + // Returns true if |varId| is a variable containing a sampler or image. + bool IsSamplerOrImageVar(uint32_t varId) const; + + // Given a load or store pointed at by |ip|, return the top-most + // non-CopyObj in its pointer operand. Also return the base pointer + // in |objId|. + Instruction* GetPtr(Instruction* ip, uint32_t* objId); + + // Return true if variable is uniform + bool IsUniformVar(uint32_t varId); + + // Given the type id for a struct type, checks if the struct type + // or any struct member is volatile decorated + bool IsVolatileStruct(uint32_t type_id); + + // Given an OpAccessChain instruction, return true + // if the accessed variable belongs to a volatile + // decorated object or member of a struct type + bool IsAccessChainToVolatileStructType(const Instruction& AccessChainInst); + + // Given an OpLoad instruction, return true if + // OpLoad has a Volatile Memory Access flag or if + // the resulting type is a volatile decorated struct + bool IsVolatileLoad(const Instruction& loadInst); + + // Return true if any uses of |id| are decorate ops. + bool HasUnsupportedDecorates(uint32_t id) const; + + // Return true if all uses of |id| are only name or decorate ops. + bool HasOnlyNamesAndDecorates(uint32_t id) const; + + // Delete inst if it has no uses. Assumes inst has a resultId. + void DeleteIfUseless(Instruction* inst); + + // Replace all instances of load's id with replId and delete load + // and its access chain, if any + Instruction* ReplaceAndDeleteLoad(Instruction* loadInst, uint32_t replId, + Instruction* ptrInst); + + // For the (constant index) access chain ptrInst, create an + // equivalent load and extract + void GenACLoadRepl(const Instruction* ptrInst, + std::vector>* newInsts, + uint32_t* resultId); + + // Return true if all indices are constant + bool IsConstantIndexAccessChain(Instruction* acp); + + // Convert all uniform access chain loads into load/extract. + bool UniformAccessChainConvert(Function* func); + + // Compute structured successors for function |func|. + // A block's structured successors are the blocks it branches to + // together with its declared merge block if it has one. + // When order matters, the merge block always appears first. + // This assures correct depth first search in the presence of early + // returns and kills. If the successor vector contain duplicates + // if the merge block, they are safely ignored by DFS. + // + // TODO(dnovillo): This pass computes structured successors slightly different + // than the implementation in class Pass. Can this be re-factored? + void ComputeStructuredSuccessors(Function* func); + + // Compute structured block order for |func| into |structuredOrder|. This + // order has the property that dominators come before all blocks they + // dominate and merge blocks come after all blocks that are in the control + // constructs of their header. + // + // TODO(dnovillo): This pass computes structured order slightly different + // than the implementation in class Pass. Can this be re-factored? + void ComputeStructuredOrder(Function* func, std::list* order); + + // Eliminate loads of uniform variables which have previously been loaded. + // If first load is in control flow, move it to first block of function. + // Most effective if preceded by UniformAccessChainRemoval(). + bool CommonUniformLoadElimination(Function* func); + + // Eliminate loads of uniform sampler and image variables which have + // previously + // been loaded in the same block for types whose loads cannot cross blocks. + bool CommonUniformLoadElimBlock(Function* func); + + // Eliminate duplicated extracts of same id. Extract may be moved to same + // block as the id definition. This is primarily intended for extracts + // from uniform loads. Most effective if preceded by + // CommonUniformLoadElimination(). + bool CommonExtractElimination(Function* func); + + // For function |func|, first change all uniform constant index + // access chain loads into equivalent composite extracts. Then consolidate + // identical uniform loads into one uniform load. Finally, consolidate + // identical uniform extracts into one uniform extract. This may require + // moving a load or extract to a point which dominates all uses. + // Return true if func is modified. + // + // This pass requires the function to have structured control flow ie shader + // capability. It also requires logical addressing ie Addresses capability + // is not enabled. It also currently does not support any extensions. + // + // This function currently only optimizes loads with a single index. + bool EliminateCommonUniform(Function* func); + + // Initialize extensions whitelist + void InitExtensions(); + + // Return true if all extensions in this module are allowed by this pass. + bool AllExtensionsSupported() const; + + // Return true if |op| is a decorate for non-type instruction + inline bool IsNonTypeDecorate(uint32_t op) const { + return (op == SpvOpDecorate || op == SpvOpDecorateId); + } + + // Return true if |inst| is an instruction that loads uniform variable and + // can be replaced with other uniform load instruction. + bool IsUniformLoadToBeRemoved(Instruction* inst) { + if (inst->opcode() == SpvOpLoad) { + uint32_t varId; + Instruction* ptrInst = GetPtr(inst, &varId); + if (ptrInst->opcode() == SpvOpVariable && IsUniformVar(varId) && + !IsSamplerOrImageVar(varId) && + !HasUnsupportedDecorates(inst->result_id()) && !IsVolatileLoad(*inst)) + return true; + } + return false; + } + + void Initialize(); + Pass::Status ProcessImpl(); + + // Map from uniform variable id to its common load id + std::unordered_map uniform2load_id_; + + // Map of extract composite ids to map of indices to insts + // TODO(greg-lunarg): Consider std::vector. + std::unordered_map>> + comp2idx2inst_; + + // Extensions supported by this pass. + std::unordered_set extensions_whitelist_; + + // Map from block to its structured successor blocks. See + // ComputeStructuredSuccessors() for definition. + std::unordered_map> + block2structured_succs_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_COMMON_UNIFORM_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/compact_ids_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/compact_ids_pass.cpp new file mode 100644 index 00000000000..68b940f1d40 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/compact_ids_pass.cpp @@ -0,0 +1,70 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/compact_ids_pass.h" + +#include +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status CompactIdsPass::Process() { + bool modified = false; + std::unordered_map result_id_mapping; + + context()->module()->ForEachInst( + [&result_id_mapping, &modified](Instruction* inst) { + auto operand = inst->begin(); + while (operand != inst->end()) { + const auto type = operand->type; + if (spvIsIdType(type)) { + assert(operand->words.size() == 1); + uint32_t& id = operand->words[0]; + auto it = result_id_mapping.find(id); + if (it == result_id_mapping.end()) { + const uint32_t new_id = + static_cast(result_id_mapping.size()) + 1; + const auto insertion_result = + result_id_mapping.emplace(id, new_id); + it = insertion_result.first; + assert(insertion_result.second); + } + if (id != it->second) { + modified = true; + id = it->second; + // Update data cached in the instruction object. + if (type == SPV_OPERAND_TYPE_RESULT_ID) { + inst->SetResultId(id); + } else if (type == SPV_OPERAND_TYPE_TYPE_ID) { + inst->SetResultType(id); + } + } + } + ++operand; + } + }, + true); + + if (modified) + context()->module()->SetIdBound( + static_cast(result_id_mapping.size() + 1)); + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/compact_ids_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/compact_ids_pass.h new file mode 100644 index 00000000000..d97ae0fa49f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/compact_ids_pass.h @@ -0,0 +1,42 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_COMPACT_IDS_PASS_H_ +#define SOURCE_OPT_COMPACT_IDS_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class CompactIdsPass : public Pass { + public: + const char* name() const override { return "compact-ids"; } + Status Process() override; + + // Return the mask of preserved Analyses. + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisLoopAnalysis; + } +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_COMPACT_IDS_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/composite.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/composite.cpp new file mode 100644 index 00000000000..2b4dca25792 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/composite.cpp @@ -0,0 +1,52 @@ +// Copyright (c) 2018 The Khronos Group Inc. +// Copyright (c) 2018 Valve Corporation +// Copyright (c) 2018 LunarG 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. + +#include "source/opt/composite.h" + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "spirv/1.2/GLSL.std.450.h" + +namespace spvtools { +namespace opt { + +bool ExtInsMatch(const std::vector& extIndices, + const Instruction* insInst, const uint32_t extOffset) { + uint32_t numIndices = static_cast(extIndices.size()) - extOffset; + if (numIndices != insInst->NumInOperands() - 2) return false; + for (uint32_t i = 0; i < numIndices; ++i) + if (extIndices[i + extOffset] != insInst->GetSingleWordInOperand(i + 2)) + return false; + return true; +} + +bool ExtInsConflict(const std::vector& extIndices, + const Instruction* insInst, const uint32_t extOffset) { + if (extIndices.size() - extOffset == insInst->NumInOperands() - 2) + return false; + uint32_t extNumIndices = static_cast(extIndices.size()) - extOffset; + uint32_t insNumIndices = insInst->NumInOperands() - 2; + uint32_t numIndices = std::min(extNumIndices, insNumIndices); + for (uint32_t i = 0; i < numIndices; ++i) + if (extIndices[i + extOffset] != insInst->GetSingleWordInOperand(i + 2)) + return false; + return true; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/composite.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/composite.h new file mode 100644 index 00000000000..3cc036e4d7f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/composite.h @@ -0,0 +1,51 @@ +// Copyright (c) 2018 The Khronos Group Inc. +// Copyright (c) 2018 Valve Corporation +// Copyright (c) 2018 LunarG 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. + +#ifndef SOURCE_OPT_COMPOSITE_H_ +#define SOURCE_OPT_COMPOSITE_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// Return true if the extract indices in |extIndices| starting at |extOffset| +// match indices of insert |insInst|. +bool ExtInsMatch(const std::vector& extIndices, + const Instruction* insInst, const uint32_t extOffset); + +// Return true if indices in |extIndices| starting at |extOffset| and +// indices of insert |insInst| conflict, specifically, if the insert +// changes bits specified by the extract, but changes either more bits +// or less bits than the extract specifies, meaning the exact value being +// inserted cannot be used to replace the extract. +bool ExtInsConflict(const std::vector& extIndices, + const Instruction* insInst, const uint32_t extOffset); + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_COMPOSITE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp new file mode 100644 index 00000000000..f6013a3d71e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.cpp @@ -0,0 +1,849 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/const_folding_rules.h" + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kExtractCompositeIdInIdx = 0; + +// Returns true if |type| is Float or a vector of Float. +bool HasFloatingPoint(const analysis::Type* type) { + if (type->AsFloat()) { + return true; + } else if (const analysis::Vector* vec_type = type->AsVector()) { + return vec_type->element_type()->AsFloat() != nullptr; + } + + return false; +} + +// Folds an OpcompositeExtract where input is a composite constant. +ConstantFoldingRule FoldExtractWithConstants() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + const analysis::Constant* c = constants[kExtractCompositeIdInIdx]; + if (c == nullptr) { + return nullptr; + } + + for (uint32_t i = 1; i < inst->NumInOperands(); ++i) { + uint32_t element_index = inst->GetSingleWordInOperand(i); + if (c->AsNullConstant()) { + // Return Null for the return type. + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + return const_mgr->GetConstant(type_mgr->GetType(inst->type_id()), {}); + } + + auto cc = c->AsCompositeConstant(); + assert(cc != nullptr); + auto components = cc->GetComponents(); + c = components[element_index]; + } + return c; + }; +} + +ConstantFoldingRule FoldVectorShuffleWithConstants() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + assert(inst->opcode() == SpvOpVectorShuffle); + const analysis::Constant* c1 = constants[0]; + const analysis::Constant* c2 = constants[1]; + if (c1 == nullptr || c2 == nullptr) { + return nullptr; + } + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* element_type = c1->type()->AsVector()->element_type(); + + std::vector c1_components; + if (const analysis::VectorConstant* vec_const = c1->AsVectorConstant()) { + c1_components = vec_const->GetComponents(); + } else { + assert(c1->AsNullConstant()); + const analysis::Constant* element = + const_mgr->GetConstant(element_type, {}); + c1_components.resize(c1->type()->AsVector()->element_count(), element); + } + std::vector c2_components; + if (const analysis::VectorConstant* vec_const = c2->AsVectorConstant()) { + c2_components = vec_const->GetComponents(); + } else { + assert(c2->AsNullConstant()); + const analysis::Constant* element = + const_mgr->GetConstant(element_type, {}); + c2_components.resize(c2->type()->AsVector()->element_count(), element); + } + + std::vector ids; + const uint32_t undef_literal_value = 0xffffffff; + for (uint32_t i = 2; i < inst->NumInOperands(); ++i) { + uint32_t index = inst->GetSingleWordInOperand(i); + if (index == undef_literal_value) { + // Don't fold shuffle with undef literal value. + return nullptr; + } else if (index < c1_components.size()) { + Instruction* member_inst = + const_mgr->GetDefiningInstruction(c1_components[index]); + ids.push_back(member_inst->result_id()); + } else { + Instruction* member_inst = const_mgr->GetDefiningInstruction( + c2_components[index - c1_components.size()]); + ids.push_back(member_inst->result_id()); + } + } + + analysis::TypeManager* type_mgr = context->get_type_mgr(); + return const_mgr->GetConstant(type_mgr->GetType(inst->type_id()), ids); + }; +} + +ConstantFoldingRule FoldVectorTimesScalar() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + assert(inst->opcode() == SpvOpVectorTimesScalar); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + + if (!inst->IsFloatingPointFoldingAllowed()) { + if (HasFloatingPoint(type_mgr->GetType(inst->type_id()))) { + return nullptr; + } + } + + const analysis::Constant* c1 = constants[0]; + const analysis::Constant* c2 = constants[1]; + + if (c1 && c1->IsZero()) { + return c1; + } + + if (c2 && c2->IsZero()) { + // Get or create the NullConstant for this type. + std::vector ids; + return const_mgr->GetConstant(type_mgr->GetType(inst->type_id()), ids); + } + + if (c1 == nullptr || c2 == nullptr) { + return nullptr; + } + + // Check result type. + const analysis::Type* result_type = type_mgr->GetType(inst->type_id()); + const analysis::Vector* vector_type = result_type->AsVector(); + assert(vector_type != nullptr); + const analysis::Type* element_type = vector_type->element_type(); + assert(element_type != nullptr); + const analysis::Float* float_type = element_type->AsFloat(); + assert(float_type != nullptr); + + // Check types of c1 and c2. + assert(c1->type()->AsVector() == vector_type); + assert(c1->type()->AsVector()->element_type() == element_type && + c2->type() == element_type); + + // Get a float vector that is the result of vector-times-scalar. + std::vector c1_components = + c1->GetVectorComponents(const_mgr); + std::vector ids; + if (float_type->width() == 32) { + float scalar = c2->GetFloat(); + for (uint32_t i = 0; i < c1_components.size(); ++i) { + utils::FloatProxy result(c1_components[i]->GetFloat() * scalar); + std::vector words = result.GetWords(); + const analysis::Constant* new_elem = + const_mgr->GetConstant(float_type, words); + ids.push_back(const_mgr->GetDefiningInstruction(new_elem)->result_id()); + } + return const_mgr->GetConstant(vector_type, ids); + } else if (float_type->width() == 64) { + double scalar = c2->GetDouble(); + for (uint32_t i = 0; i < c1_components.size(); ++i) { + utils::FloatProxy result(c1_components[i]->GetDouble() * + scalar); + std::vector words = result.GetWords(); + const analysis::Constant* new_elem = + const_mgr->GetConstant(float_type, words); + ids.push_back(const_mgr->GetDefiningInstruction(new_elem)->result_id()); + } + return const_mgr->GetConstant(vector_type, ids); + } + return nullptr; + }; +} + +ConstantFoldingRule FoldCompositeWithConstants() { + // Folds an OpCompositeConstruct where all of the inputs are constants to a + // constant. A new constant is created if necessary. + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* new_type = type_mgr->GetType(inst->type_id()); + Instruction* type_inst = + context->get_def_use_mgr()->GetDef(inst->type_id()); + + std::vector ids; + for (uint32_t i = 0; i < constants.size(); ++i) { + const analysis::Constant* element_const = constants[i]; + if (element_const == nullptr) { + return nullptr; + } + + uint32_t component_type_id = 0; + if (type_inst->opcode() == SpvOpTypeStruct) { + component_type_id = type_inst->GetSingleWordInOperand(i); + } else if (type_inst->opcode() == SpvOpTypeArray) { + component_type_id = type_inst->GetSingleWordInOperand(0); + } + + uint32_t element_id = + const_mgr->FindDeclaredConstant(element_const, component_type_id); + if (element_id == 0) { + return nullptr; + } + ids.push_back(element_id); + } + return const_mgr->GetConstant(new_type, ids); + }; +} + +// The interface for a function that returns the result of applying a scalar +// floating-point binary operation on |a| and |b|. The type of the return value +// will be |type|. The input constants must also be of type |type|. +using UnaryScalarFoldingRule = std::function; + +// The interface for a function that returns the result of applying a scalar +// floating-point binary operation on |a| and |b|. The type of the return value +// will be |type|. The input constants must also be of type |type|. +using BinaryScalarFoldingRule = std::function; + +// Returns a |ConstantFoldingRule| that folds unary floating point scalar ops +// using |scalar_rule| and unary float point vectors ops by applying +// |scalar_rule| to the elements of the vector. The |ConstantFoldingRule| +// that is returned assumes that |constants| contains 1 entry. If they are +// not |nullptr|, then their type is either |Float| or |Integer| or a |Vector| +// whose element type is |Float| or |Integer|. +ConstantFoldingRule FoldFPUnaryOp(UnaryScalarFoldingRule scalar_rule) { + return [scalar_rule](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* result_type = type_mgr->GetType(inst->type_id()); + const analysis::Vector* vector_type = result_type->AsVector(); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + + if (constants[0] == nullptr) { + return nullptr; + } + + if (vector_type != nullptr) { + std::vector a_components; + std::vector results_components; + + a_components = constants[0]->GetVectorComponents(const_mgr); + + // Fold each component of the vector. + for (uint32_t i = 0; i < a_components.size(); ++i) { + results_components.push_back(scalar_rule(vector_type->element_type(), + a_components[i], const_mgr)); + if (results_components[i] == nullptr) { + return nullptr; + } + } + + // Build the constant object and return it. + std::vector ids; + for (const analysis::Constant* member : results_components) { + ids.push_back(const_mgr->GetDefiningInstruction(member)->result_id()); + } + return const_mgr->GetConstant(vector_type, ids); + } else { + return scalar_rule(result_type, constants[0], const_mgr); + } + }; +} + +// Returns a |ConstantFoldingRule| that folds floating point scalars using +// |scalar_rule| and vectors of floating point by applying |scalar_rule| to the +// elements of the vector. The |ConstantFoldingRule| that is returned assumes +// that |constants| contains 2 entries. If they are not |nullptr|, then their +// type is either |Float| or a |Vector| whose element type is |Float|. +ConstantFoldingRule FoldFPBinaryOp(BinaryScalarFoldingRule scalar_rule) { + return [scalar_rule](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* result_type = type_mgr->GetType(inst->type_id()); + const analysis::Vector* vector_type = result_type->AsVector(); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + + if (constants[0] == nullptr || constants[1] == nullptr) { + return nullptr; + } + + if (vector_type != nullptr) { + std::vector a_components; + std::vector b_components; + std::vector results_components; + + a_components = constants[0]->GetVectorComponents(const_mgr); + b_components = constants[1]->GetVectorComponents(const_mgr); + + // Fold each component of the vector. + for (uint32_t i = 0; i < a_components.size(); ++i) { + results_components.push_back(scalar_rule(vector_type->element_type(), + a_components[i], + b_components[i], const_mgr)); + if (results_components[i] == nullptr) { + return nullptr; + } + } + + // Build the constant object and return it. + std::vector ids; + for (const analysis::Constant* member : results_components) { + ids.push_back(const_mgr->GetDefiningInstruction(member)->result_id()); + } + return const_mgr->GetConstant(vector_type, ids); + } else { + return scalar_rule(result_type, constants[0], constants[1], const_mgr); + } + }; +} + +// This macro defines a |UnaryScalarFoldingRule| that performs float to +// integer conversion. +// TODO(greg-lunarg): Support for 64-bit integer types. +UnaryScalarFoldingRule FoldFToIOp() { + return [](const analysis::Type* result_type, const analysis::Constant* a, + analysis::ConstantManager* const_mgr) -> const analysis::Constant* { + assert(result_type != nullptr && a != nullptr); + const analysis::Integer* integer_type = result_type->AsInteger(); + const analysis::Float* float_type = a->type()->AsFloat(); + assert(float_type != nullptr); + assert(integer_type != nullptr); + if (integer_type->width() != 32) return nullptr; + if (float_type->width() == 32) { + float fa = a->GetFloat(); + uint32_t result = integer_type->IsSigned() + ? static_cast(static_cast(fa)) + : static_cast(fa); + std::vector words = {result}; + return const_mgr->GetConstant(result_type, words); + } else if (float_type->width() == 64) { + double fa = a->GetDouble(); + uint32_t result = integer_type->IsSigned() + ? static_cast(static_cast(fa)) + : static_cast(fa); + std::vector words = {result}; + return const_mgr->GetConstant(result_type, words); + } + return nullptr; + }; +} + +// This function defines a |UnaryScalarFoldingRule| that performs integer to +// float conversion. +// TODO(greg-lunarg): Support for 64-bit integer types. +UnaryScalarFoldingRule FoldIToFOp() { + return [](const analysis::Type* result_type, const analysis::Constant* a, + analysis::ConstantManager* const_mgr) -> const analysis::Constant* { + assert(result_type != nullptr && a != nullptr); + const analysis::Integer* integer_type = a->type()->AsInteger(); + const analysis::Float* float_type = result_type->AsFloat(); + assert(float_type != nullptr); + assert(integer_type != nullptr); + if (integer_type->width() != 32) return nullptr; + uint32_t ua = a->GetU32(); + if (float_type->width() == 32) { + float result_val = integer_type->IsSigned() + ? static_cast(static_cast(ua)) + : static_cast(ua); + utils::FloatProxy result(result_val); + std::vector words = {result.data()}; + return const_mgr->GetConstant(result_type, words); + } else if (float_type->width() == 64) { + double result_val = integer_type->IsSigned() + ? static_cast(static_cast(ua)) + : static_cast(ua); + utils::FloatProxy result(result_val); + std::vector words = result.GetWords(); + return const_mgr->GetConstant(result_type, words); + } + return nullptr; + }; +} + +// This macro defines a |BinaryScalarFoldingRule| that applies |op|. The +// operator |op| must work for both float and double, and use syntax "f1 op f2". +#define FOLD_FPARITH_OP(op) \ + [](const analysis::Type* result_type, const analysis::Constant* a, \ + const analysis::Constant* b, \ + analysis::ConstantManager* const_mgr_in_macro) \ + -> const analysis::Constant* { \ + assert(result_type != nullptr && a != nullptr && b != nullptr); \ + assert(result_type == a->type() && result_type == b->type()); \ + const analysis::Float* float_type_in_macro = result_type->AsFloat(); \ + assert(float_type_in_macro != nullptr); \ + if (float_type_in_macro->width() == 32) { \ + float fa = a->GetFloat(); \ + float fb = b->GetFloat(); \ + utils::FloatProxy result_in_macro(fa op fb); \ + std::vector words_in_macro = result_in_macro.GetWords(); \ + return const_mgr_in_macro->GetConstant(result_type, words_in_macro); \ + } else if (float_type_in_macro->width() == 64) { \ + double fa = a->GetDouble(); \ + double fb = b->GetDouble(); \ + utils::FloatProxy result_in_macro(fa op fb); \ + std::vector words_in_macro = result_in_macro.GetWords(); \ + return const_mgr_in_macro->GetConstant(result_type, words_in_macro); \ + } \ + return nullptr; \ + } + +// Define the folding rule for conversion between floating point and integer +ConstantFoldingRule FoldFToI() { return FoldFPUnaryOp(FoldFToIOp()); } +ConstantFoldingRule FoldIToF() { return FoldFPUnaryOp(FoldIToFOp()); } + +// Define the folding rules for subtraction, addition, multiplication, and +// division for floating point values. +ConstantFoldingRule FoldFSub() { return FoldFPBinaryOp(FOLD_FPARITH_OP(-)); } +ConstantFoldingRule FoldFAdd() { return FoldFPBinaryOp(FOLD_FPARITH_OP(+)); } +ConstantFoldingRule FoldFMul() { return FoldFPBinaryOp(FOLD_FPARITH_OP(*)); } +ConstantFoldingRule FoldFDiv() { return FoldFPBinaryOp(FOLD_FPARITH_OP(/)); } + +bool CompareFloatingPoint(bool op_result, bool op_unordered, + bool need_ordered) { + if (need_ordered) { + // operands are ordered and Operand 1 is |op| Operand 2 + return !op_unordered && op_result; + } else { + // operands are unordered or Operand 1 is |op| Operand 2 + return op_unordered || op_result; + } +} + +// This macro defines a |BinaryScalarFoldingRule| that applies |op|. The +// operator |op| must work for both float and double, and use syntax "f1 op f2". +#define FOLD_FPCMP_OP(op, ord) \ + [](const analysis::Type* result_type, const analysis::Constant* a, \ + const analysis::Constant* b, \ + analysis::ConstantManager* const_mgr) -> const analysis::Constant* { \ + assert(result_type != nullptr && a != nullptr && b != nullptr); \ + assert(result_type->AsBool()); \ + assert(a->type() == b->type()); \ + const analysis::Float* float_type = a->type()->AsFloat(); \ + assert(float_type != nullptr); \ + if (float_type->width() == 32) { \ + float fa = a->GetFloat(); \ + float fb = b->GetFloat(); \ + bool result = CompareFloatingPoint( \ + fa op fb, std::isnan(fa) || std::isnan(fb), ord); \ + std::vector words = {uint32_t(result)}; \ + return const_mgr->GetConstant(result_type, words); \ + } else if (float_type->width() == 64) { \ + double fa = a->GetDouble(); \ + double fb = b->GetDouble(); \ + bool result = CompareFloatingPoint( \ + fa op fb, std::isnan(fa) || std::isnan(fb), ord); \ + std::vector words = {uint32_t(result)}; \ + return const_mgr->GetConstant(result_type, words); \ + } \ + return nullptr; \ + } + +// Define the folding rules for ordered and unordered comparison for floating +// point values. +ConstantFoldingRule FoldFOrdEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(==, true)); +} +ConstantFoldingRule FoldFUnordEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(==, false)); +} +ConstantFoldingRule FoldFOrdNotEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(!=, true)); +} +ConstantFoldingRule FoldFUnordNotEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(!=, false)); +} +ConstantFoldingRule FoldFOrdLessThan() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(<, true)); +} +ConstantFoldingRule FoldFUnordLessThan() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(<, false)); +} +ConstantFoldingRule FoldFOrdGreaterThan() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(>, true)); +} +ConstantFoldingRule FoldFUnordGreaterThan() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(>, false)); +} +ConstantFoldingRule FoldFOrdLessThanEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(<=, true)); +} +ConstantFoldingRule FoldFUnordLessThanEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(<=, false)); +} +ConstantFoldingRule FoldFOrdGreaterThanEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(>=, true)); +} +ConstantFoldingRule FoldFUnordGreaterThanEqual() { + return FoldFPBinaryOp(FOLD_FPCMP_OP(>=, false)); +} + +// Folds an OpDot where all of the inputs are constants to a +// constant. A new constant is created if necessary. +ConstantFoldingRule FoldOpDotWithConstants() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* new_type = type_mgr->GetType(inst->type_id()); + assert(new_type->AsFloat() && "OpDot should have a float return type."); + const analysis::Float* float_type = new_type->AsFloat(); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + + // If one of the operands is 0, then the result is 0. + bool has_zero_operand = false; + + for (int i = 0; i < 2; ++i) { + if (constants[i]) { + if (constants[i]->AsNullConstant() || + constants[i]->AsVectorConstant()->IsZero()) { + has_zero_operand = true; + break; + } + } + } + + if (has_zero_operand) { + if (float_type->width() == 32) { + utils::FloatProxy result(0.0f); + std::vector words = result.GetWords(); + return const_mgr->GetConstant(float_type, words); + } + if (float_type->width() == 64) { + utils::FloatProxy result(0.0); + std::vector words = result.GetWords(); + return const_mgr->GetConstant(float_type, words); + } + return nullptr; + } + + if (constants[0] == nullptr || constants[1] == nullptr) { + return nullptr; + } + + std::vector a_components; + std::vector b_components; + + a_components = constants[0]->GetVectorComponents(const_mgr); + b_components = constants[1]->GetVectorComponents(const_mgr); + + utils::FloatProxy result(0.0); + std::vector words = result.GetWords(); + const analysis::Constant* result_const = + const_mgr->GetConstant(float_type, words); + for (uint32_t i = 0; i < a_components.size(); ++i) { + if (a_components[i] == nullptr || b_components[i] == nullptr) { + return nullptr; + } + + const analysis::Constant* component = FOLD_FPARITH_OP(*)( + new_type, a_components[i], b_components[i], const_mgr); + result_const = + FOLD_FPARITH_OP(+)(new_type, result_const, component, const_mgr); + } + return result_const; + }; +} + +// This function defines a |UnaryScalarFoldingRule| that subtracts the constant +// from zero. +UnaryScalarFoldingRule FoldFNegateOp() { + return [](const analysis::Type* result_type, const analysis::Constant* a, + analysis::ConstantManager* const_mgr) -> const analysis::Constant* { + assert(result_type != nullptr && a != nullptr); + assert(result_type == a->type()); + const analysis::Float* float_type = result_type->AsFloat(); + assert(float_type != nullptr); + if (float_type->width() == 32) { + float fa = a->GetFloat(); + utils::FloatProxy result(-fa); + std::vector words = result.GetWords(); + return const_mgr->GetConstant(result_type, words); + } else if (float_type->width() == 64) { + double da = a->GetDouble(); + utils::FloatProxy result(-da); + std::vector words = result.GetWords(); + return const_mgr->GetConstant(result_type, words); + } + return nullptr; + }; +} + +ConstantFoldingRule FoldFNegate() { return FoldFPUnaryOp(FoldFNegateOp()); } + +ConstantFoldingRule FoldFClampFeedingCompare(uint32_t cmp_opcode) { + return [cmp_opcode](IRContext* context, Instruction* inst, + const std::vector& constants) + -> const analysis::Constant* { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return nullptr; + } + + uint32_t non_const_idx = (constants[0] ? 1 : 0); + uint32_t operand_id = inst->GetSingleWordInOperand(non_const_idx); + Instruction* operand_inst = def_use_mgr->GetDef(operand_id); + + analysis::TypeManager* type_mgr = context->get_type_mgr(); + const analysis::Type* operand_type = + type_mgr->GetType(operand_inst->type_id()); + + if (!operand_type->AsFloat()) { + return nullptr; + } + + if (operand_type->AsFloat()->width() != 32 && + operand_type->AsFloat()->width() != 64) { + return nullptr; + } + + if (operand_inst->opcode() != SpvOpExtInst) { + return nullptr; + } + + if (operand_inst->GetSingleWordInOperand(1) != GLSLstd450FClamp) { + return nullptr; + } + + if (constants[1] == nullptr && constants[0] == nullptr) { + return nullptr; + } + + uint32_t max_id = operand_inst->GetSingleWordInOperand(4); + const analysis::Constant* max_const = + const_mgr->FindDeclaredConstant(max_id); + + uint32_t min_id = operand_inst->GetSingleWordInOperand(3); + const analysis::Constant* min_const = + const_mgr->FindDeclaredConstant(min_id); + + bool found_result = false; + bool result = false; + + switch (cmp_opcode) { + case SpvOpFOrdLessThan: + case SpvOpFUnordLessThan: + case SpvOpFOrdGreaterThanEqual: + case SpvOpFUnordGreaterThanEqual: + if (constants[0]) { + if (min_const) { + if (constants[0]->GetValueAsDouble() < + min_const->GetValueAsDouble()) { + found_result = true; + result = (cmp_opcode == SpvOpFOrdLessThan || + cmp_opcode == SpvOpFUnordLessThan); + } + } + if (max_const) { + if (constants[0]->GetValueAsDouble() >= + max_const->GetValueAsDouble()) { + found_result = true; + result = !(cmp_opcode == SpvOpFOrdLessThan || + cmp_opcode == SpvOpFUnordLessThan); + } + } + } + + if (constants[1]) { + if (max_const) { + if (max_const->GetValueAsDouble() < + constants[1]->GetValueAsDouble()) { + found_result = true; + result = (cmp_opcode == SpvOpFOrdLessThan || + cmp_opcode == SpvOpFUnordLessThan); + } + } + + if (min_const) { + if (min_const->GetValueAsDouble() >= + constants[1]->GetValueAsDouble()) { + found_result = true; + result = !(cmp_opcode == SpvOpFOrdLessThan || + cmp_opcode == SpvOpFUnordLessThan); + } + } + } + break; + case SpvOpFOrdGreaterThan: + case SpvOpFUnordGreaterThan: + case SpvOpFOrdLessThanEqual: + case SpvOpFUnordLessThanEqual: + if (constants[0]) { + if (min_const) { + if (constants[0]->GetValueAsDouble() <= + min_const->GetValueAsDouble()) { + found_result = true; + result = (cmp_opcode == SpvOpFOrdLessThanEqual || + cmp_opcode == SpvOpFUnordLessThanEqual); + } + } + if (max_const) { + if (constants[0]->GetValueAsDouble() > + max_const->GetValueAsDouble()) { + found_result = true; + result = !(cmp_opcode == SpvOpFOrdLessThanEqual || + cmp_opcode == SpvOpFUnordLessThanEqual); + } + } + } + + if (constants[1]) { + if (max_const) { + if (max_const->GetValueAsDouble() <= + constants[1]->GetValueAsDouble()) { + found_result = true; + result = (cmp_opcode == SpvOpFOrdLessThanEqual || + cmp_opcode == SpvOpFUnordLessThanEqual); + } + } + + if (min_const) { + if (min_const->GetValueAsDouble() > + constants[1]->GetValueAsDouble()) { + found_result = true; + result = !(cmp_opcode == SpvOpFOrdLessThanEqual || + cmp_opcode == SpvOpFUnordLessThanEqual); + } + } + } + break; + default: + return nullptr; + } + + if (!found_result) { + return nullptr; + } + + const analysis::Type* bool_type = + context->get_type_mgr()->GetType(inst->type_id()); + const analysis::Constant* result_const = + const_mgr->GetConstant(bool_type, {static_cast(result)}); + assert(result_const); + return result_const; + }; +} + +} // namespace + +ConstantFoldingRules::ConstantFoldingRules() { + // Add all folding rules to the list for the opcodes to which they apply. + // Note that the order in which rules are added to the list matters. If a rule + // applies to the instruction, the rest of the rules will not be attempted. + // Take that into consideration. + + rules_[SpvOpCompositeConstruct].push_back(FoldCompositeWithConstants()); + + rules_[SpvOpCompositeExtract].push_back(FoldExtractWithConstants()); + + rules_[SpvOpConvertFToS].push_back(FoldFToI()); + rules_[SpvOpConvertFToU].push_back(FoldFToI()); + rules_[SpvOpConvertSToF].push_back(FoldIToF()); + rules_[SpvOpConvertUToF].push_back(FoldIToF()); + + rules_[SpvOpDot].push_back(FoldOpDotWithConstants()); + rules_[SpvOpFAdd].push_back(FoldFAdd()); + rules_[SpvOpFDiv].push_back(FoldFDiv()); + rules_[SpvOpFMul].push_back(FoldFMul()); + rules_[SpvOpFSub].push_back(FoldFSub()); + + rules_[SpvOpFOrdEqual].push_back(FoldFOrdEqual()); + + rules_[SpvOpFUnordEqual].push_back(FoldFUnordEqual()); + + rules_[SpvOpFOrdNotEqual].push_back(FoldFOrdNotEqual()); + + rules_[SpvOpFUnordNotEqual].push_back(FoldFUnordNotEqual()); + + rules_[SpvOpFOrdLessThan].push_back(FoldFOrdLessThan()); + rules_[SpvOpFOrdLessThan].push_back( + FoldFClampFeedingCompare(SpvOpFOrdLessThan)); + + rules_[SpvOpFUnordLessThan].push_back(FoldFUnordLessThan()); + rules_[SpvOpFUnordLessThan].push_back( + FoldFClampFeedingCompare(SpvOpFUnordLessThan)); + + rules_[SpvOpFOrdGreaterThan].push_back(FoldFOrdGreaterThan()); + rules_[SpvOpFOrdGreaterThan].push_back( + FoldFClampFeedingCompare(SpvOpFOrdGreaterThan)); + + rules_[SpvOpFUnordGreaterThan].push_back(FoldFUnordGreaterThan()); + rules_[SpvOpFUnordGreaterThan].push_back( + FoldFClampFeedingCompare(SpvOpFUnordGreaterThan)); + + rules_[SpvOpFOrdLessThanEqual].push_back(FoldFOrdLessThanEqual()); + rules_[SpvOpFOrdLessThanEqual].push_back( + FoldFClampFeedingCompare(SpvOpFOrdLessThanEqual)); + + rules_[SpvOpFUnordLessThanEqual].push_back(FoldFUnordLessThanEqual()); + rules_[SpvOpFUnordLessThanEqual].push_back( + FoldFClampFeedingCompare(SpvOpFUnordLessThanEqual)); + + rules_[SpvOpFOrdGreaterThanEqual].push_back(FoldFOrdGreaterThanEqual()); + rules_[SpvOpFOrdGreaterThanEqual].push_back( + FoldFClampFeedingCompare(SpvOpFOrdGreaterThanEqual)); + + rules_[SpvOpFUnordGreaterThanEqual].push_back(FoldFUnordGreaterThanEqual()); + rules_[SpvOpFUnordGreaterThanEqual].push_back( + FoldFClampFeedingCompare(SpvOpFUnordGreaterThanEqual)); + + rules_[SpvOpVectorShuffle].push_back(FoldVectorShuffleWithConstants()); + rules_[SpvOpVectorTimesScalar].push_back(FoldVectorTimesScalar()); + + rules_[SpvOpFNegate].push_back(FoldFNegate()); +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h new file mode 100644 index 00000000000..c1865792bcd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/const_folding_rules.h @@ -0,0 +1,80 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_CONST_FOLDING_RULES_H_ +#define SOURCE_OPT_CONST_FOLDING_RULES_H_ + +#include +#include + +#include "source/opt/constants.h" + +namespace spvtools { +namespace opt { + +// Constant Folding Rules: +// +// The folding mechanism is built around the concept of a |ConstantFoldingRule|. +// A constant folding rule is a function that implements a method of simplifying +// an instruction to a constant. +// +// The inputs to a folding rule are: +// |inst| - the instruction to be simplified. +// |constants| - if an in-operands is an id of a constant, then the +// corresponding value in |constants| contains that +// constant value. Otherwise, the corresponding entry in +// |constants| is |nullptr|. +// +// A constant folding rule returns a pointer to an Constant if |inst| can be +// simplified using this rule. Otherwise, it returns |nullptr|. +// +// See const_folding_rules.cpp for examples on how to write a constant folding +// rule. +// +// Be sure to add new constant folding rules to the table of constant folding +// rules in the constructor for ConstantFoldingRules. The new rule should be +// added to the list for every opcode that it applies to. Note that earlier +// rules in the list are given priority. That is, if an earlier rule is able to +// fold an instruction, the later rules will not be attempted. + +using ConstantFoldingRule = std::function& constants)>; + +class ConstantFoldingRules { + public: + ConstantFoldingRules(); + + // Returns true if there is at least 1 folding rule for |opcode|. + bool HasFoldingRule(SpvOp opcode) const { return rules_.count(opcode); } + + // Returns an vector of constant folding rules for |opcode|. + const std::vector& GetRulesForOpcode( + SpvOp opcode) const { + auto it = rules_.find(opcode); + if (it != rules_.end()) { + return it->second; + } + return empty_vector_; + } + + private: + std::unordered_map> rules_; + std::vector empty_vector_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_CONST_FOLDING_RULES_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp new file mode 100644 index 00000000000..ecb5f97c4cc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/constants.cpp @@ -0,0 +1,373 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/constants.h" + +#include +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace analysis { + +float Constant::GetFloat() const { + assert(type()->AsFloat() != nullptr && type()->AsFloat()->width() == 32); + + if (const FloatConstant* fc = AsFloatConstant()) { + return fc->GetFloatValue(); + } else { + assert(AsNullConstant() && "Must be a floating point constant."); + return 0.0f; + } +} + +double Constant::GetDouble() const { + assert(type()->AsFloat() != nullptr && type()->AsFloat()->width() == 64); + + if (const FloatConstant* fc = AsFloatConstant()) { + return fc->GetDoubleValue(); + } else { + assert(AsNullConstant() && "Must be a floating point constant."); + return 0.0; + } +} + +double Constant::GetValueAsDouble() const { + assert(type()->AsFloat() != nullptr); + if (type()->AsFloat()->width() == 32) { + return GetFloat(); + } else { + assert(type()->AsFloat()->width() == 64); + return GetDouble(); + } +} + +uint32_t Constant::GetU32() const { + assert(type()->AsInteger() != nullptr); + assert(type()->AsInteger()->width() == 32); + + if (const IntConstant* ic = AsIntConstant()) { + return ic->GetU32BitValue(); + } else { + assert(AsNullConstant() && "Must be an integer constant."); + return 0u; + } +} + +uint64_t Constant::GetU64() const { + assert(type()->AsInteger() != nullptr); + assert(type()->AsInteger()->width() == 64); + + if (const IntConstant* ic = AsIntConstant()) { + return ic->GetU64BitValue(); + } else { + assert(AsNullConstant() && "Must be an integer constant."); + return 0u; + } +} + +int32_t Constant::GetS32() const { + assert(type()->AsInteger() != nullptr); + assert(type()->AsInteger()->width() == 32); + + if (const IntConstant* ic = AsIntConstant()) { + return ic->GetS32BitValue(); + } else { + assert(AsNullConstant() && "Must be an integer constant."); + return 0; + } +} + +int64_t Constant::GetS64() const { + assert(type()->AsInteger() != nullptr); + assert(type()->AsInteger()->width() == 64); + + if (const IntConstant* ic = AsIntConstant()) { + return ic->GetS64BitValue(); + } else { + assert(AsNullConstant() && "Must be an integer constant."); + return 0; + } +} + +ConstantManager::ConstantManager(IRContext* ctx) : ctx_(ctx) { + // Populate the constant table with values from constant declarations in the + // module. The values of each OpConstant declaration is the identity + // assignment (i.e., each constant is its own value). + for (const auto& inst : ctx_->module()->GetConstants()) { + MapInst(inst); + } +} + +Type* ConstantManager::GetType(const Instruction* inst) const { + return context()->get_type_mgr()->GetType(inst->type_id()); +} + +std::vector ConstantManager::GetOperandConstants( + Instruction* inst) const { + std::vector constants; + for (uint32_t i = 0; i < inst->NumInOperands(); i++) { + const Operand* operand = &inst->GetInOperand(i); + if (operand->type != SPV_OPERAND_TYPE_ID) { + constants.push_back(nullptr); + } else { + uint32_t id = operand->words[0]; + const analysis::Constant* constant = FindDeclaredConstant(id); + constants.push_back(constant); + } + } + return constants; +} + +uint32_t ConstantManager::FindDeclaredConstant(const Constant* c, + uint32_t type_id) const { + c = FindConstant(c); + if (c == nullptr) { + return 0; + } + + for (auto range = const_val_to_id_.equal_range(c); + range.first != range.second; ++range.first) { + Instruction* const_def = + context()->get_def_use_mgr()->GetDef(range.first->second); + if (type_id == 0 || const_def->type_id() == type_id) { + return range.first->second; + } + } + return 0; +} + +std::vector ConstantManager::GetConstantsFromIds( + const std::vector& ids) const { + std::vector constants; + for (uint32_t id : ids) { + if (const Constant* c = FindDeclaredConstant(id)) { + constants.push_back(c); + } else { + return {}; + } + } + return constants; +} + +Instruction* ConstantManager::BuildInstructionAndAddToModule( + const Constant* new_const, Module::inst_iterator* pos, uint32_t type_id) { + uint32_t new_id = context()->TakeNextId(); + auto new_inst = CreateInstruction(new_id, new_const, type_id); + if (!new_inst) { + return nullptr; + } + auto* new_inst_ptr = new_inst.get(); + *pos = pos->InsertBefore(std::move(new_inst)); + ++(*pos); + context()->get_def_use_mgr()->AnalyzeInstDefUse(new_inst_ptr); + MapConstantToInst(new_const, new_inst_ptr); + return new_inst_ptr; +} + +Instruction* ConstantManager::GetDefiningInstruction( + const Constant* c, uint32_t type_id, Module::inst_iterator* pos) { + assert(type_id == 0 || + context()->get_type_mgr()->GetType(type_id) == c->type()); + uint32_t decl_id = FindDeclaredConstant(c, type_id); + if (decl_id == 0) { + auto iter = context()->types_values_end(); + if (pos == nullptr) pos = &iter; + return BuildInstructionAndAddToModule(c, pos, type_id); + } else { + auto def = context()->get_def_use_mgr()->GetDef(decl_id); + assert(def != nullptr); + assert((type_id == 0 || def->type_id() == type_id) && + "This constant already has an instruction with a different type."); + return def; + } +} + +std::unique_ptr ConstantManager::CreateConstant( + const Type* type, const std::vector& literal_words_or_ids) const { + if (literal_words_or_ids.size() == 0) { + // Constant declared with OpConstantNull + return MakeUnique(type); + } else if (auto* bt = type->AsBool()) { + assert(literal_words_or_ids.size() == 1 && + "Bool constant should be declared with one operand"); + return MakeUnique(bt, literal_words_or_ids.front()); + } else if (auto* it = type->AsInteger()) { + return MakeUnique(it, literal_words_or_ids); + } else if (auto* ft = type->AsFloat()) { + return MakeUnique(ft, literal_words_or_ids); + } else if (auto* vt = type->AsVector()) { + auto components = GetConstantsFromIds(literal_words_or_ids); + if (components.empty()) return nullptr; + // All components of VectorConstant must be of type Bool, Integer or Float. + if (!std::all_of(components.begin(), components.end(), + [](const Constant* c) { + if (c->type()->AsBool() || c->type()->AsInteger() || + c->type()->AsFloat()) { + return true; + } else { + return false; + } + })) + return nullptr; + // All components of VectorConstant must be in the same type. + const auto* component_type = components.front()->type(); + if (!std::all_of(components.begin(), components.end(), + [&component_type](const Constant* c) { + if (c->type() == component_type) return true; + return false; + })) + return nullptr; + return MakeUnique(vt, components); + } else if (auto* mt = type->AsMatrix()) { + auto components = GetConstantsFromIds(literal_words_or_ids); + if (components.empty()) return nullptr; + return MakeUnique(mt, components); + } else if (auto* st = type->AsStruct()) { + auto components = GetConstantsFromIds(literal_words_or_ids); + if (components.empty()) return nullptr; + return MakeUnique(st, components); + } else if (auto* at = type->AsArray()) { + auto components = GetConstantsFromIds(literal_words_or_ids); + if (components.empty()) return nullptr; + return MakeUnique(at, components); + } else { + return nullptr; + } +} + +const Constant* ConstantManager::GetConstantFromInst(Instruction* inst) { + std::vector literal_words_or_ids; + + // Collect the constant defining literals or component ids. + for (uint32_t i = 0; i < inst->NumInOperands(); i++) { + literal_words_or_ids.insert(literal_words_or_ids.end(), + inst->GetInOperand(i).words.begin(), + inst->GetInOperand(i).words.end()); + } + + switch (inst->opcode()) { + // OpConstant{True|False} have the value embedded in the opcode. So they + // are not handled by the for-loop above. Here we add the value explicitly. + case SpvOp::SpvOpConstantTrue: + literal_words_or_ids.push_back(true); + break; + case SpvOp::SpvOpConstantFalse: + literal_words_or_ids.push_back(false); + break; + case SpvOp::SpvOpConstantNull: + case SpvOp::SpvOpConstant: + case SpvOp::SpvOpConstantComposite: + case SpvOp::SpvOpSpecConstantComposite: + break; + default: + return nullptr; + } + + return GetConstant(GetType(inst), literal_words_or_ids); +} + +std::unique_ptr ConstantManager::CreateInstruction( + uint32_t id, const Constant* c, uint32_t type_id) const { + uint32_t type = + (type_id == 0) ? context()->get_type_mgr()->GetId(c->type()) : type_id; + if (c->AsNullConstant()) { + return MakeUnique(context(), SpvOp::SpvOpConstantNull, type, + id, std::initializer_list{}); + } else if (const BoolConstant* bc = c->AsBoolConstant()) { + return MakeUnique( + context(), + bc->value() ? SpvOp::SpvOpConstantTrue : SpvOp::SpvOpConstantFalse, + type, id, std::initializer_list{}); + } else if (const IntConstant* ic = c->AsIntConstant()) { + return MakeUnique( + context(), SpvOp::SpvOpConstant, type, id, + std::initializer_list{ + Operand(spv_operand_type_t::SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, + ic->words())}); + } else if (const FloatConstant* fc = c->AsFloatConstant()) { + return MakeUnique( + context(), SpvOp::SpvOpConstant, type, id, + std::initializer_list{ + Operand(spv_operand_type_t::SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, + fc->words())}); + } else if (const CompositeConstant* cc = c->AsCompositeConstant()) { + return CreateCompositeInstruction(id, cc, type_id); + } else { + return nullptr; + } +} + +std::unique_ptr ConstantManager::CreateCompositeInstruction( + uint32_t result_id, const CompositeConstant* cc, uint32_t type_id) const { + std::vector operands; + Instruction* type_inst = context()->get_def_use_mgr()->GetDef(type_id); + uint32_t component_index = 0; + for (const Constant* component_const : cc->GetComponents()) { + uint32_t component_type_id = 0; + if (type_inst && type_inst->opcode() == SpvOpTypeStruct) { + component_type_id = type_inst->GetSingleWordInOperand(component_index); + } else if (type_inst && type_inst->opcode() == SpvOpTypeArray) { + component_type_id = type_inst->GetSingleWordInOperand(0); + } + uint32_t id = FindDeclaredConstant(component_const, component_type_id); + + if (id == 0) { + // Cannot get the id of the component constant, while all components + // should have been added to the module prior to the composite constant. + // Cannot create OpConstantComposite instruction in this case. + return nullptr; + } + operands.emplace_back(spv_operand_type_t::SPV_OPERAND_TYPE_ID, + std::initializer_list{id}); + component_index++; + } + uint32_t type = + (type_id == 0) ? context()->get_type_mgr()->GetId(cc->type()) : type_id; + return MakeUnique(context(), SpvOp::SpvOpConstantComposite, type, + result_id, std::move(operands)); +} + +const Constant* ConstantManager::GetConstant( + const Type* type, const std::vector& literal_words_or_ids) { + auto cst = CreateConstant(type, literal_words_or_ids); + return cst ? RegisterConstant(std::move(cst)) : nullptr; +} + +std::vector Constant::GetVectorComponents( + analysis::ConstantManager* const_mgr) const { + std::vector components; + const analysis::VectorConstant* a = this->AsVectorConstant(); + const analysis::Vector* vector_type = this->type()->AsVector(); + assert(vector_type != nullptr); + if (a != nullptr) { + for (uint32_t i = 0; i < vector_type->element_count(); ++i) { + components.push_back(a->GetComponents()[i]); + } + } else { + const analysis::Type* element_type = vector_type->element_type(); + const analysis::Constant* element_null_const = + const_mgr->GetConstant(element_type, {}); + for (uint32_t i = 0; i < vector_type->element_count(); ++i) { + components.push_back(element_null_const); + } + } + return components; +} + +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/constants.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/constants.h new file mode 100644 index 00000000000..2415c122e4a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/constants.h @@ -0,0 +1,696 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_CONSTANTS_H_ +#define SOURCE_OPT_CONSTANTS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/module.h" +#include "source/opt/type_manager.h" +#include "source/opt/types.h" +#include "source/util/hex_float.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +class IRContext; + +namespace analysis { + +// Class hierarchy to represent the normal constants defined through +// OpConstantTrue, OpConstantFalse, OpConstant, OpConstantNull and +// OpConstantComposite instructions. +// TODO(qining): Add class for constants defined with OpConstantSampler. +class Constant; +class ScalarConstant; +class IntConstant; +class FloatConstant; +class BoolConstant; +class CompositeConstant; +class StructConstant; +class VectorConstant; +class MatrixConstant; +class ArrayConstant; +class NullConstant; +class ConstantManager; + +// Abstract class for a SPIR-V constant. It has a bunch of As methods, +// which is used as a way to probe the actual +class Constant { + public: + Constant() = delete; + virtual ~Constant() {} + + // Make a deep copy of this constant. + virtual std::unique_ptr Copy() const = 0; + + // reflections + virtual ScalarConstant* AsScalarConstant() { return nullptr; } + virtual IntConstant* AsIntConstant() { return nullptr; } + virtual FloatConstant* AsFloatConstant() { return nullptr; } + virtual BoolConstant* AsBoolConstant() { return nullptr; } + virtual CompositeConstant* AsCompositeConstant() { return nullptr; } + virtual StructConstant* AsStructConstant() { return nullptr; } + virtual VectorConstant* AsVectorConstant() { return nullptr; } + virtual MatrixConstant* AsMatrixConstant() { return nullptr; } + virtual ArrayConstant* AsArrayConstant() { return nullptr; } + virtual NullConstant* AsNullConstant() { return nullptr; } + + virtual const ScalarConstant* AsScalarConstant() const { return nullptr; } + virtual const IntConstant* AsIntConstant() const { return nullptr; } + virtual const FloatConstant* AsFloatConstant() const { return nullptr; } + virtual const BoolConstant* AsBoolConstant() const { return nullptr; } + virtual const CompositeConstant* AsCompositeConstant() const { + return nullptr; + } + virtual const StructConstant* AsStructConstant() const { return nullptr; } + virtual const VectorConstant* AsVectorConstant() const { return nullptr; } + virtual const MatrixConstant* AsMatrixConstant() const { return nullptr; } + virtual const ArrayConstant* AsArrayConstant() const { return nullptr; } + virtual const NullConstant* AsNullConstant() const { return nullptr; } + + // Returns the float representation of the constant. Must be a 32 bit + // Float type. + float GetFloat() const; + + // Returns the double representation of the constant. Must be a 64 bit + // Float type. + double GetDouble() const; + + // Returns the double representation of the constant. Must be a 32-bit or + // 64-bit Float type. + double GetValueAsDouble() const; + + // Returns uint32_t representation of the constant. Must be a 32 bit + // Integer type. + uint32_t GetU32() const; + + // Returns uint64_t representation of the constant. Must be a 64 bit + // Integer type. + uint64_t GetU64() const; + + // Returns int32_t representation of the constant. Must be a 32 bit + // Integer type. + int32_t GetS32() const; + + // Returns int64_t representation of the constant. Must be a 64 bit + // Integer type. + int64_t GetS64() const; + + // Returns true if the constant is a zero or a composite containing 0s. + virtual bool IsZero() const { return false; } + + const Type* type() const { return type_; } + + // Returns an std::vector containing the elements of |constant|. The type of + // |constant| must be |Vector|. + std::vector GetVectorComponents( + ConstantManager* const_mgr) const; + + protected: + Constant(const Type* ty) : type_(ty) {} + + // The type of this constant. + const Type* type_; +}; + +// Abstract class for scalar type constants. +class ScalarConstant : public Constant { + public: + ScalarConstant() = delete; + ScalarConstant* AsScalarConstant() override { return this; } + const ScalarConstant* AsScalarConstant() const override { return this; } + + // Returns a const reference of the value of this constant in 32-bit words. + virtual const std::vector& words() const { return words_; } + + // Returns true if the value is zero. + bool IsZero() const override { + bool is_zero = true; + for (uint32_t v : words()) { + if (v != 0) { + is_zero = false; + break; + } + } + return is_zero; + } + + protected: + ScalarConstant(const Type* ty, const std::vector& w) + : Constant(ty), words_(w) {} + ScalarConstant(const Type* ty, std::vector&& w) + : Constant(ty), words_(std::move(w)) {} + std::vector words_; +}; + +// Integer type constant. +class IntConstant : public ScalarConstant { + public: + IntConstant(const Integer* ty, const std::vector& w) + : ScalarConstant(ty, w) {} + IntConstant(const Integer* ty, std::vector&& w) + : ScalarConstant(ty, std::move(w)) {} + + IntConstant* AsIntConstant() override { return this; } + const IntConstant* AsIntConstant() const override { return this; } + + int32_t GetS32BitValue() const { + // Relies on signed values smaller than 32-bit being sign extended. See + // section 2.2.1 of the SPIR-V spec. + assert(words().size() == 1); + return words()[0]; + } + + uint32_t GetU32BitValue() const { + // Relies on unsigned values smaller than 32-bit being zero extended. See + // section 2.2.1 of the SPIR-V spec. + assert(words().size() == 1); + return words()[0]; + } + + int64_t GetS64BitValue() const { + // Relies on unsigned values smaller than 64-bit being sign extended. See + // section 2.2.1 of the SPIR-V spec. + assert(words().size() == 2); + return static_cast(words()[1]) << 32 | + static_cast(words()[0]); + } + + uint64_t GetU64BitValue() const { + // Relies on unsigned values smaller than 64-bit being zero extended. See + // section 2.2.1 of the SPIR-V spec. + assert(words().size() == 2); + return static_cast(words()[1]) << 32 | + static_cast(words()[0]); + } + + // Make a copy of this IntConstant instance. + std::unique_ptr CopyIntConstant() const { + return MakeUnique(type_->AsInteger(), words_); + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyIntConstant().release()); + } +}; + +// Float type constant. +class FloatConstant : public ScalarConstant { + public: + FloatConstant(const Float* ty, const std::vector& w) + : ScalarConstant(ty, w) {} + FloatConstant(const Float* ty, std::vector&& w) + : ScalarConstant(ty, std::move(w)) {} + + FloatConstant* AsFloatConstant() override { return this; } + const FloatConstant* AsFloatConstant() const override { return this; } + + // Make a copy of this FloatConstant instance. + std::unique_ptr CopyFloatConstant() const { + return MakeUnique(type_->AsFloat(), words_); + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyFloatConstant().release()); + } + + // Returns the float value of |this|. The type of |this| must be |Float| with + // width of 32. + float GetFloatValue() const { + assert(type()->AsFloat()->width() == 32 && + "Not a 32-bit floating point value."); + utils::FloatProxy a(words()[0]); + return a.getAsFloat(); + } + + // Returns the double value of |this|. The type of |this| must be |Float| + // with width of 64. + double GetDoubleValue() const { + assert(type()->AsFloat()->width() == 64 && + "Not a 32-bit floating point value."); + uint64_t combined_words = words()[1]; + combined_words = combined_words << 32; + combined_words |= words()[0]; + utils::FloatProxy a(combined_words); + return a.getAsFloat(); + } +}; + +// Bool type constant. +class BoolConstant : public ScalarConstant { + public: + BoolConstant(const Bool* ty, bool v) + : ScalarConstant(ty, {static_cast(v)}), value_(v) {} + + BoolConstant* AsBoolConstant() override { return this; } + const BoolConstant* AsBoolConstant() const override { return this; } + + // Make a copy of this BoolConstant instance. + std::unique_ptr CopyBoolConstant() const { + return MakeUnique(type_->AsBool(), value_); + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyBoolConstant().release()); + } + + bool value() const { return value_; } + + private: + bool value_; +}; + +// Abstract class for composite constants. +class CompositeConstant : public Constant { + public: + CompositeConstant() = delete; + CompositeConstant* AsCompositeConstant() override { return this; } + const CompositeConstant* AsCompositeConstant() const override { return this; } + + // Returns a const reference of the components held in this composite + // constant. + virtual const std::vector& GetComponents() const { + return components_; + } + + bool IsZero() const override { + for (const Constant* c : GetComponents()) { + if (!c->IsZero()) { + return false; + } + } + return true; + } + + protected: + CompositeConstant(const Type* ty) : Constant(ty), components_() {} + CompositeConstant(const Type* ty, + const std::vector& components) + : Constant(ty), components_(components) {} + CompositeConstant(const Type* ty, std::vector&& components) + : Constant(ty), components_(std::move(components)) {} + std::vector components_; +}; + +// Struct type constant. +class StructConstant : public CompositeConstant { + public: + StructConstant(const Struct* ty) : CompositeConstant(ty) {} + StructConstant(const Struct* ty, + const std::vector& components) + : CompositeConstant(ty, components) {} + StructConstant(const Struct* ty, std::vector&& components) + : CompositeConstant(ty, std::move(components)) {} + + StructConstant* AsStructConstant() override { return this; } + const StructConstant* AsStructConstant() const override { return this; } + + // Make a copy of this StructConstant instance. + std::unique_ptr CopyStructConstant() const { + return MakeUnique(type_->AsStruct(), components_); + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyStructConstant().release()); + } +}; + +// Vector type constant. +class VectorConstant : public CompositeConstant { + public: + VectorConstant(const Vector* ty) + : CompositeConstant(ty), component_type_(ty->element_type()) {} + VectorConstant(const Vector* ty, + const std::vector& components) + : CompositeConstant(ty, components), + component_type_(ty->element_type()) {} + VectorConstant(const Vector* ty, std::vector&& components) + : CompositeConstant(ty, std::move(components)), + component_type_(ty->element_type()) {} + + VectorConstant* AsVectorConstant() override { return this; } + const VectorConstant* AsVectorConstant() const override { return this; } + + // Make a copy of this VectorConstant instance. + std::unique_ptr CopyVectorConstant() const { + auto another = MakeUnique(type_->AsVector()); + another->components_.insert(another->components_.end(), components_.begin(), + components_.end()); + return another; + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyVectorConstant().release()); + } + + const Type* component_type() const { return component_type_; } + + private: + const Type* component_type_; +}; + +// Matrix type constant. +class MatrixConstant : public CompositeConstant { + public: + MatrixConstant(const Matrix* ty) + : CompositeConstant(ty), component_type_(ty->element_type()) {} + MatrixConstant(const Matrix* ty, + const std::vector& components) + : CompositeConstant(ty, components), + component_type_(ty->element_type()) {} + MatrixConstant(const Vector* ty, std::vector&& components) + : CompositeConstant(ty, std::move(components)), + component_type_(ty->element_type()) {} + + MatrixConstant* AsMatrixConstant() override { return this; } + const MatrixConstant* AsMatrixConstant() const override { return this; } + + // Make a copy of this MatrixConstant instance. + std::unique_ptr CopyMatrixConstant() const { + auto another = MakeUnique(type_->AsMatrix()); + another->components_.insert(another->components_.end(), components_.begin(), + components_.end()); + return another; + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyMatrixConstant().release()); + } + + const Type* component_type() { return component_type_; } + + private: + const Type* component_type_; +}; + +// Array type constant. +class ArrayConstant : public CompositeConstant { + public: + ArrayConstant(const Array* ty) : CompositeConstant(ty) {} + ArrayConstant(const Array* ty, const std::vector& components) + : CompositeConstant(ty, components) {} + ArrayConstant(const Array* ty, std::vector&& components) + : CompositeConstant(ty, std::move(components)) {} + + ArrayConstant* AsArrayConstant() override { return this; } + const ArrayConstant* AsArrayConstant() const override { return this; } + + // Make a copy of this ArrayConstant instance. + std::unique_ptr CopyArrayConstant() const { + return MakeUnique(type_->AsArray(), components_); + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyArrayConstant().release()); + } +}; + +// Null type constant. +class NullConstant : public Constant { + public: + NullConstant(const Type* ty) : Constant(ty) {} + NullConstant* AsNullConstant() override { return this; } + const NullConstant* AsNullConstant() const override { return this; } + + // Make a copy of this NullConstant instance. + std::unique_ptr CopyNullConstant() const { + return MakeUnique(type_); + } + std::unique_ptr Copy() const override { + return std::unique_ptr(CopyNullConstant().release()); + } + bool IsZero() const override { return true; }; +}; + +// Hash function for Constant instances. Use the structure of the constant as +// the key. +struct ConstantHash { + void add_pointer(std::u32string* h, const void* p) const { + uint64_t ptr_val = reinterpret_cast(p); + h->push_back(static_cast(ptr_val >> 32)); + h->push_back(static_cast(ptr_val)); + } + + size_t operator()(const Constant* const_val) const { + std::u32string h; + add_pointer(&h, const_val->type()); + if (const auto scalar = const_val->AsScalarConstant()) { + for (const auto& w : scalar->words()) { + h.push_back(w); + } + } else if (const auto composite = const_val->AsCompositeConstant()) { + for (const auto& c : composite->GetComponents()) { + add_pointer(&h, c); + } + } else if (const_val->AsNullConstant()) { + h.push_back(0); + } else { + assert( + false && + "Tried to compute the hash value of an invalid Constant instance."); + } + + return std::hash()(h); + } +}; + +// Equality comparison structure for two constants. +struct ConstantEqual { + bool operator()(const Constant* c1, const Constant* c2) const { + if (c1->type() != c2->type()) { + return false; + } + + if (const auto& s1 = c1->AsScalarConstant()) { + const auto& s2 = c2->AsScalarConstant(); + return s2 && s1->words() == s2->words(); + } else if (const auto& composite1 = c1->AsCompositeConstant()) { + const auto& composite2 = c2->AsCompositeConstant(); + return composite2 && + composite1->GetComponents() == composite2->GetComponents(); + } else if (c1->AsNullConstant()) { + return c2->AsNullConstant() != nullptr; + } else { + assert(false && "Tried to compare two invalid Constant instances."); + } + return false; + } +}; + +// This class represents a pool of constants. +class ConstantManager { + public: + ConstantManager(IRContext* ctx); + + IRContext* context() const { return ctx_; } + + // Gets or creates a unique Constant instance of type |type| and a vector of + // constant defining words |words|. If a Constant instance existed already in + // the constant pool, it returns a pointer to it. Otherwise, it creates one + // using CreateConstant. If a new Constant instance cannot be created, it + // returns nullptr. + const Constant* GetConstant( + const Type* type, const std::vector& literal_words_or_ids); + + template + const Constant* GetConstant(const Type* type, const C& literal_words_or_ids) { + return GetConstant(type, std::vector(literal_words_or_ids.begin(), + literal_words_or_ids.end())); + } + + // Gets or creates a Constant instance to hold the constant value of the given + // instruction. It returns a pointer to a Constant instance or nullptr if it + // could not create the constant. + const Constant* GetConstantFromInst(Instruction* inst); + + // Gets or creates a constant defining instruction for the given Constant |c|. + // If |c| had already been defined, it returns a pointer to the existing + // declaration. Otherwise, it calls BuildInstructionAndAddToModule. If the + // optional |pos| is given, it will insert any newly created instructions at + // the given instruction iterator position. Otherwise, it inserts the new + // instruction at the end of the current module's types section. + // + // |type_id| is an optional argument for disambiguating equivalent types. If + // |type_id| is specified, it is used as the type of the constant when a new + // instruction is created. Otherwise the type of the constant is derived by + // getting an id from the type manager for |c|. + // + // When |type_id| is not zero, the type of |c| must be the type returned by + // type manager when given |type_id|. + Instruction* GetDefiningInstruction(const Constant* c, uint32_t type_id = 0, + Module::inst_iterator* pos = nullptr); + + // Creates a constant defining instruction for the given Constant instance + // and inserts the instruction at the position specified by the given + // instruction iterator. Returns a pointer to the created instruction if + // succeeded, otherwise returns a null pointer. The instruction iterator + // points to the same instruction before and after the insertion. This is the + // only method that actually manages id creation/assignment and instruction + // creation/insertion for a new Constant instance. + // + // |type_id| is an optional argument for disambiguating equivalent types. If + // |type_id| is specified, it is used as the type of the constant. Otherwise + // the type of the constant is derived by getting an id from the type manager + // for |c|. + Instruction* BuildInstructionAndAddToModule(const Constant* c, + Module::inst_iterator* pos, + uint32_t type_id = 0); + + // A helper function to get the result type of the given instruction. Returns + // nullptr if the instruction does not have a type id (type id is 0). + Type* GetType(const Instruction* inst) const; + + // A helper function to get the collected normal constant with the given id. + // Returns the pointer to the Constant instance in case it is found. + // Otherwise, it returns a null pointer. + const Constant* FindDeclaredConstant(uint32_t id) const { + auto iter = id_to_const_val_.find(id); + return (iter != id_to_const_val_.end()) ? iter->second : nullptr; + } + + // A helper function to get the id of a collected constant with the pointer + // to the Constant instance. Returns 0 in case the constant is not found. + uint32_t FindDeclaredConstant(const Constant* c, uint32_t type_id) const; + + // Returns the canonical constant that has the same structure and value as the + // given Constant |cst|. If none is found, it returns nullptr. + // + // TODO: Should be able to give a type id to disambiguate types with the same + // structure. + const Constant* FindConstant(const Constant* c) const { + auto it = const_pool_.find(c); + return (it != const_pool_.end()) ? *it : nullptr; + } + + // Registers a new constant |cst| in the constant pool. If the constant + // existed already, it returns a pointer to the previously existing Constant + // in the pool. Otherwise, it returns |cst|. + const Constant* RegisterConstant(std::unique_ptr cst) { + auto ret = const_pool_.insert(cst.get()); + if (ret.second) { + owned_constants_.emplace_back(std::move(cst)); + } + return *ret.first; + } + + // A helper function to get a vector of Constant instances with the specified + // ids. If it can not find the Constant instance for any one of the ids, + // it returns an empty vector. + std::vector GetConstantsFromIds( + const std::vector& ids) const; + + // Returns a vector of constants representing each in operand. If an operand + // is not constant its entry is nullptr. + std::vector GetOperandConstants(Instruction* inst) const; + + // Records a mapping between |inst| and the constant value generated by it. + // It returns true if a new Constant was successfully mapped, false if |inst| + // generates no constant values. + bool MapInst(Instruction* inst) { + if (auto cst = GetConstantFromInst(inst)) { + MapConstantToInst(cst, inst); + return true; + } + return false; + } + + void RemoveId(uint32_t id) { + auto it = id_to_const_val_.find(id); + if (it != id_to_const_val_.end()) { + const_val_to_id_.erase(it->second); + id_to_const_val_.erase(it); + } + } + + // Records a new mapping between |inst| and |const_value|. This updates the + // two mappings |id_to_const_val_| and |const_val_to_id_|. + void MapConstantToInst(const Constant* const_value, Instruction* inst) { + if (id_to_const_val_.insert({inst->result_id(), const_value}).second) { + const_val_to_id_.insert({const_value, inst->result_id()}); + } + } + + private: + // Creates a Constant instance with the given type and a vector of constant + // defining words. Returns a unique pointer to the created Constant instance + // if the Constant instance can be created successfully. To create scalar + // type constants, the vector should contain the constant value in 32 bit + // words and the given type must be of type Bool, Integer or Float. To create + // composite type constants, the vector should contain the component ids, and + // those component ids should have been recorded before as Normal Constants. + // And the given type must be of type Struct, Vector or Array. When creating + // VectorType Constant instance, the components must be scalars of the same + // type, either Bool, Integer or Float. If any of the rules above failed, the + // creation will fail and nullptr will be returned. If the vector is empty, + // a NullConstant instance will be created with the given type. + std::unique_ptr CreateConstant( + const Type* type, + const std::vector& literal_words_or_ids) const; + + // Creates an instruction with the given result id to declare a constant + // represented by the given Constant instance. Returns an unique pointer to + // the created instruction if the instruction can be created successfully. + // Otherwise, returns a null pointer. + // + // |type_id| is an optional argument for disambiguating equivalent types. If + // |type_id| is specified, it is used as the type of the constant. Otherwise + // the type of the constant is derived by getting an id from the type manager + // for |c|. + std::unique_ptr CreateInstruction(uint32_t result_id, + const Constant* c, + uint32_t type_id = 0) const; + + // Creates an OpConstantComposite instruction with the given result id and + // the CompositeConst instance which represents a composite constant. Returns + // an unique pointer to the created instruction if succeeded. Otherwise + // returns a null pointer. + // + // |type_id| is an optional argument for disambiguating equivalent types. If + // |type_id| is specified, it is used as the type of the constant. Otherwise + // the type of the constant is derived by getting an id from the type manager + // for |c|. + std::unique_ptr CreateCompositeInstruction( + uint32_t result_id, const CompositeConstant* cc, + uint32_t type_id = 0) const; + + // IR context that owns this constant manager. + IRContext* ctx_; + + // A mapping from the result ids of Normal Constants to their + // Constant instances. All Normal Constants in the module, either + // existing ones before optimization or the newly generated ones, should have + // their Constant instance stored and their result id registered in this map. + std::unordered_map id_to_const_val_; + + // A mapping from the Constant instance of Normal Constants to their + // result id in the module. This is a mirror map of |id_to_const_val_|. All + // Normal Constants that defining instructions in the module should have + // their Constant and their result id registered here. + std::multimap const_val_to_id_; + + // The constant pool. All created constants are registered here. + std::unordered_set const_pool_; + + // The constant that are owned by the constant manager. Every constant in + // |const_pool_| should be in |owned_constants_| as well. + std::vector> owned_constants_; +}; + +} // namespace analysis +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_CONSTANTS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp new file mode 100644 index 00000000000..028b237d73e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.cpp @@ -0,0 +1,846 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/copy_prop_arrays.h" + +#include + +#include "source/opt/ir_builder.h" + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kLoadPointerInOperand = 0; +const uint32_t kStorePointerInOperand = 0; +const uint32_t kStoreObjectInOperand = 1; +const uint32_t kCompositeExtractObjectInOperand = 0; + +} // namespace + +Pass::Status CopyPropagateArrays::Process() { + bool modified = false; + for (Function& function : *get_module()) { + BasicBlock* entry_bb = &*function.begin(); + + for (auto var_inst = entry_bb->begin(); var_inst->opcode() == SpvOpVariable; + ++var_inst) { + if (!IsPointerToArrayType(var_inst->type_id())) { + continue; + } + + // Find the only store to the entire memory location, if it exists. + Instruction* store_inst = FindStoreInstruction(&*var_inst); + + if (!store_inst) { + continue; + } + + std::unique_ptr source_object = + FindSourceObjectIfPossible(&*var_inst, store_inst); + + if (source_object != nullptr) { + if (CanUpdateUses(&*var_inst, source_object->GetPointerTypeId())) { + modified = true; + PropagateObject(&*var_inst, source_object.get(), store_inst); + } + } + } + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +std::unique_ptr +CopyPropagateArrays::FindSourceObjectIfPossible(Instruction* var_inst, + Instruction* store_inst) { + assert(var_inst->opcode() == SpvOpVariable && "Expecting a variable."); + + // Check that the variable is a composite object where |store_inst| + // dominates all of its loads. + if (!store_inst) { + return nullptr; + } + + // Look at the loads to ensure they are dominated by the store. + if (!HasValidReferencesOnly(var_inst, store_inst)) { + return nullptr; + } + + // If so, look at the store to see if it is the copy of an object. + std::unique_ptr source = GetSourceObjectIfAny( + store_inst->GetSingleWordInOperand(kStoreObjectInOperand)); + + if (!source) { + return nullptr; + } + + // Ensure that |source| does not change between the point at which it is + // loaded, and the position in which |var_inst| is loaded. + // + // For now we will go with the easy to implement approach, and check that the + // entire variable (not just the specific component) is never written to. + + if (!HasNoStores(source->GetVariable())) { + return nullptr; + } + return source; +} + +Instruction* CopyPropagateArrays::FindStoreInstruction( + const Instruction* var_inst) const { + Instruction* store_inst = nullptr; + get_def_use_mgr()->WhileEachUser( + var_inst, [&store_inst, var_inst](Instruction* use) { + if (use->opcode() == SpvOpStore && + use->GetSingleWordInOperand(kStorePointerInOperand) == + var_inst->result_id()) { + if (store_inst == nullptr) { + store_inst = use; + } else { + store_inst = nullptr; + return false; + } + } + return true; + }); + return store_inst; +} + +void CopyPropagateArrays::PropagateObject(Instruction* var_inst, + MemoryObject* source, + Instruction* insertion_point) { + assert(var_inst->opcode() == SpvOpVariable && + "This function propagates variables."); + + Instruction* new_access_chain = BuildNewAccessChain(insertion_point, source); + context()->KillNamesAndDecorates(var_inst); + UpdateUses(var_inst, new_access_chain); +} + +Instruction* CopyPropagateArrays::BuildNewAccessChain( + Instruction* insertion_point, + CopyPropagateArrays::MemoryObject* source) const { + InstructionBuilder builder( + context(), insertion_point, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + + if (source->AccessChain().size() == 0) { + return source->GetVariable(); + } + + return builder.AddAccessChain(source->GetPointerTypeId(), + source->GetVariable()->result_id(), + source->AccessChain()); +} + +bool CopyPropagateArrays::HasNoStores(Instruction* ptr_inst) { + return get_def_use_mgr()->WhileEachUser(ptr_inst, [this](Instruction* use) { + if (use->opcode() == SpvOpLoad) { + return true; + } else if (use->opcode() == SpvOpAccessChain) { + return HasNoStores(use); + } else if (use->IsDecoration() || use->opcode() == SpvOpName) { + return true; + } else if (use->opcode() == SpvOpStore) { + return false; + } else if (use->opcode() == SpvOpImageTexelPointer) { + return true; + } + // Some other instruction. Be conservative. + return false; + }); +} + +bool CopyPropagateArrays::HasValidReferencesOnly(Instruction* ptr_inst, + Instruction* store_inst) { + BasicBlock* store_block = context()->get_instr_block(store_inst); + DominatorAnalysis* dominator_analysis = + context()->GetDominatorAnalysis(store_block->GetParent()); + + return get_def_use_mgr()->WhileEachUser( + ptr_inst, + [this, store_inst, dominator_analysis, ptr_inst](Instruction* use) { + if (use->opcode() == SpvOpLoad || + use->opcode() == SpvOpImageTexelPointer) { + // TODO: If there are many load in the same BB as |store_inst| the + // time to do the multiple traverses can add up. Consider collecting + // those loads and doing a single traversal. + return dominator_analysis->Dominates(store_inst, use); + } else if (use->opcode() == SpvOpAccessChain) { + return HasValidReferencesOnly(use, store_inst); + } else if (use->IsDecoration() || use->opcode() == SpvOpName) { + return true; + } else if (use->opcode() == SpvOpStore) { + // If we are storing to part of the object it is not an candidate. + return ptr_inst->opcode() == SpvOpVariable && + store_inst->GetSingleWordInOperand(kStorePointerInOperand) == + ptr_inst->result_id(); + } + // Some other instruction. Be conservative. + return false; + }); +} + +std::unique_ptr +CopyPropagateArrays::GetSourceObjectIfAny(uint32_t result) { + Instruction* result_inst = context()->get_def_use_mgr()->GetDef(result); + + switch (result_inst->opcode()) { + case SpvOpLoad: + return BuildMemoryObjectFromLoad(result_inst); + case SpvOpCompositeExtract: + return BuildMemoryObjectFromExtract(result_inst); + case SpvOpCompositeConstruct: + return BuildMemoryObjectFromCompositeConstruct(result_inst); + case SpvOpCopyObject: + return GetSourceObjectIfAny(result_inst->GetSingleWordInOperand(0)); + case SpvOpCompositeInsert: + return BuildMemoryObjectFromInsert(result_inst); + default: + return nullptr; + } +} + +std::unique_ptr +CopyPropagateArrays::BuildMemoryObjectFromLoad(Instruction* load_inst) { + std::vector components_in_reverse; + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + Instruction* current_inst = def_use_mgr->GetDef( + load_inst->GetSingleWordInOperand(kLoadPointerInOperand)); + + // Build the access chain for the memory object by collecting the indices used + // in the OpAccessChain instructions. If we find a variable index, then + // return |nullptr| because we cannot know for sure which memory location is + // used. + // + // It is built in reverse order because the different |OpAccessChain| + // instructions are visited in reverse order from which they are applied. + while (current_inst->opcode() == SpvOpAccessChain) { + for (uint32_t i = current_inst->NumInOperands() - 1; i >= 1; --i) { + uint32_t element_index_id = current_inst->GetSingleWordInOperand(i); + components_in_reverse.push_back(element_index_id); + } + current_inst = def_use_mgr->GetDef(current_inst->GetSingleWordInOperand(0)); + } + + // If the address in the load is not constructed from an |OpVariable| + // instruction followed by a series of |OpAccessChain| instructions, then + // return |nullptr| because we cannot identify the owner or access chain + // exactly. + if (current_inst->opcode() != SpvOpVariable) { + return nullptr; + } + + // Build the memory object. Use |rbegin| and |rend| to put the access chain + // back in the correct order. + return std::unique_ptr( + new MemoryObject(current_inst, components_in_reverse.rbegin(), + components_in_reverse.rend())); +} + +std::unique_ptr +CopyPropagateArrays::BuildMemoryObjectFromExtract(Instruction* extract_inst) { + assert(extract_inst->opcode() == SpvOpCompositeExtract && + "Expecting an OpCompositeExtract instruction."); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + + std::unique_ptr result = GetSourceObjectIfAny( + extract_inst->GetSingleWordInOperand(kCompositeExtractObjectInOperand)); + + if (result) { + analysis::Integer int_type(32, false); + const analysis::Type* uint32_type = + context()->get_type_mgr()->GetRegisteredType(&int_type); + + std::vector components; + // Convert the indices in the extract instruction to a series of ids that + // can be used by the |OpAccessChain| instruction. + for (uint32_t i = 1; i < extract_inst->NumInOperands(); ++i) { + uint32_t index = extract_inst->GetSingleWordInOperand(i); + const analysis::Constant* index_const = + const_mgr->GetConstant(uint32_type, {index}); + components.push_back( + const_mgr->GetDefiningInstruction(index_const)->result_id()); + } + result->GetMember(components); + return result; + } + return nullptr; +} + +std::unique_ptr +CopyPropagateArrays::BuildMemoryObjectFromCompositeConstruct( + Instruction* conststruct_inst) { + assert(conststruct_inst->opcode() == SpvOpCompositeConstruct && + "Expecting an OpCompositeConstruct instruction."); + + // If every operand in the instruction are part of the same memory object, and + // are being combined in the same order, then the result is the same as the + // parent. + + std::unique_ptr memory_object = + GetSourceObjectIfAny(conststruct_inst->GetSingleWordInOperand(0)); + + if (!memory_object) { + return nullptr; + } + + if (!memory_object->IsMember()) { + return nullptr; + } + + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + const analysis::Constant* last_access = + const_mgr->FindDeclaredConstant(memory_object->AccessChain().back()); + if (!last_access || + (!last_access->AsIntConstant() && !last_access->AsNullConstant())) { + return nullptr; + } + + if (last_access->GetU32() != 0) { + return nullptr; + } + + memory_object->GetParent(); + + if (memory_object->GetNumberOfMembers() != + conststruct_inst->NumInOperands()) { + return nullptr; + } + + for (uint32_t i = 1; i < conststruct_inst->NumInOperands(); ++i) { + std::unique_ptr member_object = + GetSourceObjectIfAny(conststruct_inst->GetSingleWordInOperand(i)); + + if (!member_object->IsMember()) { + return nullptr; + } + + if (!memory_object->Contains(member_object.get())) { + return nullptr; + } + + last_access = + const_mgr->FindDeclaredConstant(member_object->AccessChain().back()); + if (!last_access || !last_access->AsIntConstant()) { + return nullptr; + } + + if (last_access->GetU32() != i) { + return nullptr; + } + } + return memory_object; +} + +std::unique_ptr +CopyPropagateArrays::BuildMemoryObjectFromInsert(Instruction* insert_inst) { + assert(insert_inst->opcode() == SpvOpCompositeInsert && + "Expecting an OpCompositeInsert instruction."); + + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + const analysis::Type* result_type = type_mgr->GetType(insert_inst->type_id()); + + uint32_t number_of_elements = 0; + if (const analysis::Struct* struct_type = result_type->AsStruct()) { + number_of_elements = + static_cast(struct_type->element_types().size()); + } else if (const analysis::Array* array_type = result_type->AsArray()) { + const analysis::Constant* length_const = + const_mgr->FindDeclaredConstant(array_type->LengthId()); + assert(length_const->AsIntConstant()); + number_of_elements = length_const->AsIntConstant()->GetU32(); + } else if (const analysis::Vector* vector_type = result_type->AsVector()) { + number_of_elements = vector_type->element_count(); + } else if (const analysis::Matrix* matrix_type = result_type->AsMatrix()) { + number_of_elements = matrix_type->element_count(); + } + + if (number_of_elements == 0) { + return nullptr; + } + + if (insert_inst->NumInOperands() != 3) { + return nullptr; + } + + if (insert_inst->GetSingleWordInOperand(2) != number_of_elements - 1) { + return nullptr; + } + + std::unique_ptr memory_object = + GetSourceObjectIfAny(insert_inst->GetSingleWordInOperand(0)); + + if (!memory_object) { + return nullptr; + } + + if (!memory_object->IsMember()) { + return nullptr; + } + + const analysis::Constant* last_access = + const_mgr->FindDeclaredConstant(memory_object->AccessChain().back()); + if (!last_access || !last_access->AsIntConstant()) { + return nullptr; + } + + if (last_access->GetU32() != number_of_elements - 1) { + return nullptr; + } + + memory_object->GetParent(); + + Instruction* current_insert = + def_use_mgr->GetDef(insert_inst->GetSingleWordInOperand(1)); + for (uint32_t i = number_of_elements - 1; i > 0; --i) { + if (current_insert->opcode() != SpvOpCompositeInsert) { + return nullptr; + } + + if (current_insert->NumInOperands() != 3) { + return nullptr; + } + + if (current_insert->GetSingleWordInOperand(2) != i - 1) { + return nullptr; + } + + std::unique_ptr current_memory_object = + GetSourceObjectIfAny(current_insert->GetSingleWordInOperand(0)); + + if (!current_memory_object) { + return nullptr; + } + + if (!current_memory_object->IsMember()) { + return nullptr; + } + + if (memory_object->AccessChain().size() + 1 != + current_memory_object->AccessChain().size()) { + return nullptr; + } + + if (!memory_object->Contains(current_memory_object.get())) { + return nullptr; + } + + const analysis::Constant* current_last_access = + const_mgr->FindDeclaredConstant( + current_memory_object->AccessChain().back()); + if (!current_last_access || !current_last_access->AsIntConstant()) { + return nullptr; + } + + if (current_last_access->GetU32() != i - 1) { + return nullptr; + } + current_insert = + def_use_mgr->GetDef(current_insert->GetSingleWordInOperand(1)); + } + + return memory_object; +} + +bool CopyPropagateArrays::IsPointerToArrayType(uint32_t type_id) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::Pointer* pointer_type = type_mgr->GetType(type_id)->AsPointer(); + if (pointer_type) { + return pointer_type->pointee_type()->kind() == analysis::Type::kArray || + pointer_type->pointee_type()->kind() == analysis::Type::kImage; + } + return false; +} + +bool CopyPropagateArrays::CanUpdateUses(Instruction* original_ptr_inst, + uint32_t type_id) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + analysis::Type* type = type_mgr->GetType(type_id); + if (type->AsRuntimeArray()) { + return false; + } + + if (!type->AsStruct() && !type->AsArray() && !type->AsPointer()) { + // If the type is not an aggregate, then the desired type must be the + // same as the current type. No work to do, and we can do that. + return true; + } + + return def_use_mgr->WhileEachUse( + original_ptr_inst, + [this, type_mgr, const_mgr, type](Instruction* use, uint32_t) { + switch (use->opcode()) { + case SpvOpLoad: { + analysis::Pointer* pointer_type = type->AsPointer(); + uint32_t new_type_id = + type_mgr->GetId(pointer_type->pointee_type()); + + if (new_type_id != use->type_id()) { + return CanUpdateUses(use, new_type_id); + } + return true; + } + case SpvOpAccessChain: { + analysis::Pointer* pointer_type = type->AsPointer(); + const analysis::Type* pointee_type = pointer_type->pointee_type(); + + std::vector access_chain; + for (uint32_t i = 1; i < use->NumInOperands(); ++i) { + const analysis::Constant* index_const = + const_mgr->FindDeclaredConstant( + use->GetSingleWordInOperand(i)); + if (index_const) { + access_chain.push_back(index_const->AsIntConstant()->GetU32()); + } else { + // Variable index means the type is a type where every element + // is the same type. Use element 0 to get the type. + access_chain.push_back(0); + } + } + + const analysis::Type* new_pointee_type = + type_mgr->GetMemberType(pointee_type, access_chain); + analysis::Pointer pointerTy(new_pointee_type, + pointer_type->storage_class()); + uint32_t new_pointer_type_id = + context()->get_type_mgr()->GetTypeInstruction(&pointerTy); + + if (new_pointer_type_id != use->type_id()) { + return CanUpdateUses(use, new_pointer_type_id); + } + return true; + } + case SpvOpCompositeExtract: { + std::vector access_chain; + for (uint32_t i = 1; i < use->NumInOperands(); ++i) { + access_chain.push_back(use->GetSingleWordInOperand(i)); + } + + const analysis::Type* new_type = + type_mgr->GetMemberType(type, access_chain); + uint32_t new_type_id = type_mgr->GetTypeInstruction(new_type); + + if (new_type_id != use->type_id()) { + return CanUpdateUses(use, new_type_id); + } + return true; + } + case SpvOpStore: + // Can't handle changing the type of a store. There are too many + // other things that might need to change as well. Not worth the + // effort. Punting for now. + + // TODO (s-perron): This can be handled by expanding the store into + // a series of extracts, composite constructs, and a store. + return true; + case SpvOpImageTexelPointer: + case SpvOpName: + return true; + default: + return use->IsDecoration(); + } + }); +} +void CopyPropagateArrays::UpdateUses(Instruction* original_ptr_inst, + Instruction* new_ptr_inst) { + // TODO (s-perron): Keep the def-use manager up to date. Not done now because + // it can cause problems for the |ForEachUse| traversals. Can be use by + // keeping a list of instructions that need updating, and then updating them + // in |PropagateObject|. + + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + std::vector > uses; + def_use_mgr->ForEachUse(original_ptr_inst, + [&uses](Instruction* use, uint32_t index) { + uses.push_back({use, index}); + }); + + for (auto pair : uses) { + Instruction* use = pair.first; + uint32_t index = pair.second; + analysis::Pointer* pointer_type = nullptr; + switch (use->opcode()) { + case SpvOpLoad: { + // Replace the actual use. + context()->ForgetUses(use); + use->SetOperand(index, {new_ptr_inst->result_id()}); + + // Update the type. + pointer_type = type_mgr->GetType(new_ptr_inst->type_id())->AsPointer(); + uint32_t new_type_id = type_mgr->GetId(pointer_type->pointee_type()); + if (new_type_id != use->type_id()) { + use->SetResultType(new_type_id); + context()->AnalyzeUses(use); + UpdateUses(use, use); + } else { + context()->AnalyzeUses(use); + } + } break; + case SpvOpAccessChain: { + // Update the actual use. + context()->ForgetUses(use); + use->SetOperand(index, {new_ptr_inst->result_id()}); + + // Update the result type. + pointer_type = type_mgr->GetType(new_ptr_inst->type_id())->AsPointer(); + const analysis::Type* pointee_type = pointer_type->pointee_type(); + + // Convert the ids on the OpAccessChain to indices that can be used to + // get the specific member. + std::vector access_chain; + for (uint32_t i = 1; i < use->NumInOperands(); ++i) { + const analysis::Constant* index_const = + const_mgr->FindDeclaredConstant(use->GetSingleWordInOperand(i)); + if (index_const) { + access_chain.push_back(index_const->AsIntConstant()->GetU32()); + } else { + // Variable index means the type is an type where every element + // is the same type. Use element 0 to get the type. + access_chain.push_back(0); + } + } + const analysis::Type* new_pointee_type = + type_mgr->GetMemberType(pointee_type, access_chain); + + // Now build a pointer to the type of the member. + analysis::Pointer new_pointer_type(new_pointee_type, + pointer_type->storage_class()); + uint32_t new_pointer_type_id = + context()->get_type_mgr()->GetTypeInstruction(&new_pointer_type); + + if (new_pointer_type_id != use->type_id()) { + use->SetResultType(new_pointer_type_id); + context()->AnalyzeUses(use); + UpdateUses(use, use); + } else { + context()->AnalyzeUses(use); + } + } break; + case SpvOpCompositeExtract: { + // Update the actual use. + context()->ForgetUses(use); + use->SetOperand(index, {new_ptr_inst->result_id()}); + + std::vector access_chain; + for (uint32_t i = 1; i < use->NumInOperands(); ++i) { + access_chain.push_back(use->GetSingleWordInOperand(i)); + } + + const analysis::Type* type = type_mgr->GetType(new_ptr_inst->type_id()); + const analysis::Type* new_type = + type_mgr->GetMemberType(type, access_chain); + uint32_t new_type_id = type_mgr->GetTypeInstruction(new_type); + + if (new_type_id != use->type_id()) { + use->SetResultType(new_type_id); + context()->AnalyzeUses(use); + UpdateUses(use, use); + } else { + context()->AnalyzeUses(use); + } + } break; + case SpvOpStore: + // If the use is the pointer, then it is the single store to that + // variable. We do not want to replace it. Instead, it will become + // dead after all of the loads are removed, and ADCE will get rid of it. + // + // If the use is the object being stored, we will create a copy of the + // object turning it into the correct type. The copy is done by + // decomposing the object into the base type, which must be the same, + // and then rebuilding them. + if (index == 1) { + Instruction* target_pointer = def_use_mgr->GetDef( + use->GetSingleWordInOperand(kStorePointerInOperand)); + pointer_type = + type_mgr->GetType(target_pointer->type_id())->AsPointer(); + uint32_t copy = + GenerateCopy(original_ptr_inst, + type_mgr->GetId(pointer_type->pointee_type()), use); + + context()->ForgetUses(use); + use->SetInOperand(index, {copy}); + context()->AnalyzeUses(use); + } + break; + case SpvOpImageTexelPointer: + // We treat an OpImageTexelPointer as a load. The result type should + // always have the Image storage class, and should not need to be + // updated. + + // Replace the actual use. + context()->ForgetUses(use); + use->SetOperand(index, {new_ptr_inst->result_id()}); + context()->AnalyzeUses(use); + break; + default: + assert(false && "Don't know how to rewrite instruction"); + break; + } + } +} + +uint32_t CopyPropagateArrays::GenerateCopy(Instruction* object_inst, + uint32_t new_type_id, + Instruction* insertion_position) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + + uint32_t original_type_id = object_inst->type_id(); + if (original_type_id == new_type_id) { + return object_inst->result_id(); + } + + InstructionBuilder ir_builder( + context(), insertion_position, + IRContext::kAnalysisInstrToBlockMapping | IRContext::kAnalysisDefUse); + + analysis::Type* original_type = type_mgr->GetType(original_type_id); + analysis::Type* new_type = type_mgr->GetType(new_type_id); + + if (const analysis::Array* original_array_type = original_type->AsArray()) { + uint32_t original_element_type_id = + type_mgr->GetId(original_array_type->element_type()); + + analysis::Array* new_array_type = new_type->AsArray(); + assert(new_array_type != nullptr && "Can't copy an array to a non-array."); + uint32_t new_element_type_id = + type_mgr->GetId(new_array_type->element_type()); + + std::vector element_ids; + const analysis::Constant* length_const = + const_mgr->FindDeclaredConstant(original_array_type->LengthId()); + assert(length_const->AsIntConstant()); + uint32_t array_length = length_const->AsIntConstant()->GetU32(); + for (uint32_t i = 0; i < array_length; i++) { + Instruction* extract = ir_builder.AddCompositeExtract( + original_element_type_id, object_inst->result_id(), {i}); + element_ids.push_back( + GenerateCopy(extract, new_element_type_id, insertion_position)); + } + + return ir_builder.AddCompositeConstruct(new_type_id, element_ids) + ->result_id(); + } else if (const analysis::Struct* original_struct_type = + original_type->AsStruct()) { + analysis::Struct* new_struct_type = new_type->AsStruct(); + + const std::vector& original_types = + original_struct_type->element_types(); + const std::vector& new_types = + new_struct_type->element_types(); + std::vector element_ids; + for (uint32_t i = 0; i < original_types.size(); i++) { + Instruction* extract = ir_builder.AddCompositeExtract( + type_mgr->GetId(original_types[i]), object_inst->result_id(), {i}); + element_ids.push_back(GenerateCopy(extract, type_mgr->GetId(new_types[i]), + insertion_position)); + } + return ir_builder.AddCompositeConstruct(new_type_id, element_ids) + ->result_id(); + } else { + // If we do not have an aggregate type, then we have a problem. Either we + // found multiple instances of the same type, or we are copying to an + // incompatible type. Either way the code is illegal. + assert(false && + "Don't know how to copy this type. Code is likely illegal."); + } + return 0; +} + +void CopyPropagateArrays::MemoryObject::GetMember( + const std::vector& access_chain) { + access_chain_.insert(access_chain_.end(), access_chain.begin(), + access_chain.end()); +} + +uint32_t CopyPropagateArrays::MemoryObject::GetNumberOfMembers() { + IRContext* context = variable_inst_->context(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + + const analysis::Type* type = type_mgr->GetType(variable_inst_->type_id()); + type = type->AsPointer()->pointee_type(); + + std::vector access_indices = GetAccessIds(); + type = type_mgr->GetMemberType(type, access_indices); + + if (const analysis::Struct* struct_type = type->AsStruct()) { + return static_cast(struct_type->element_types().size()); + } else if (const analysis::Array* array_type = type->AsArray()) { + const analysis::Constant* length_const = + context->get_constant_mgr()->FindDeclaredConstant( + array_type->LengthId()); + assert(length_const->AsIntConstant()); + return length_const->AsIntConstant()->GetU32(); + } else if (const analysis::Vector* vector_type = type->AsVector()) { + return vector_type->element_count(); + } else if (const analysis::Matrix* matrix_type = type->AsMatrix()) { + return matrix_type->element_count(); + } else { + return 0; + } +} + +template +CopyPropagateArrays::MemoryObject::MemoryObject(Instruction* var_inst, + iterator begin, iterator end) + : variable_inst_(var_inst), access_chain_(begin, end) {} + +std::vector CopyPropagateArrays::MemoryObject::GetAccessIds() const { + analysis::ConstantManager* const_mgr = + variable_inst_->context()->get_constant_mgr(); + + std::vector access_indices; + for (uint32_t id : AccessChain()) { + const analysis::Constant* element_index_const = + const_mgr->FindDeclaredConstant(id); + if (!element_index_const) { + access_indices.push_back(0); + } else { + assert(element_index_const->AsIntConstant()); + access_indices.push_back(element_index_const->AsIntConstant()->GetU32()); + } + } + return access_indices; +} + +bool CopyPropagateArrays::MemoryObject::Contains( + CopyPropagateArrays::MemoryObject* other) { + if (this->GetVariable() != other->GetVariable()) { + return false; + } + + if (AccessChain().size() > other->AccessChain().size()) { + return false; + } + + for (uint32_t i = 0; i < AccessChain().size(); i++) { + if (AccessChain()[i] != other->AccessChain()[i]) { + return false; + } + } + return true; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h new file mode 100644 index 00000000000..abc07165f47 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/copy_prop_arrays.h @@ -0,0 +1,231 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_COPY_PROP_ARRAYS_H_ +#define SOURCE_OPT_COPY_PROP_ARRAYS_H_ + +#include +#include + +#include "source/opt/mem_pass.h" + +namespace spvtools { +namespace opt { + +// This pass implements a simple array copy propagation. It does not do a full +// array data flow. It looks for simple cases that meet the following +// conditions: +// +// 1) The source must never be stored to. +// 2) The target must be stored to exactly once. +// 3) The store to the target must be a store to the entire array, and be a +// copy of the entire source. +// 4) All loads of the target must be dominated by the store. +// +// The hard part is keeping all of the types correct. We do not want to +// have to do too large a search to update everything, which may not be +// possible, do we give up if we see any instruction that might be hard to +// update. + +class CopyPropagateArrays : public MemPass { + public: + const char* name() const override { return "copy-propagate-arrays"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisCFG | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisDecorations | + IRContext::kAnalysisDominatorAnalysis | IRContext::kAnalysisNameMap; + } + + private: + // The class used to identify a particular memory object. This memory object + // will be owned by a particular variable, meaning that the memory is part of + // that variable. It could be the entire variable or a member of the + // variable. + class MemoryObject { + public: + // Construction a memory object that is owned by |var_inst|. The iterator + // |begin| and |end| traverse a container of integers that identify which + // member of |var_inst| this memory object will represent. These integers + // are interpreted the same way they would be in an |OpAccessChain| + // instruction. + template + MemoryObject(Instruction* var_inst, iterator begin, iterator end); + + // Change |this| to now point to the member identified by |access_chain| + // (starting from the current member). The elements in |access_chain| are + // interpreted the same as the indices in the |OpAccessChain| + // instruction. + void GetMember(const std::vector& access_chain); + + // Change |this| to now represent the first enclosing object to which it + // belongs. (Remove the last element off the access_chain). It is invalid + // to call this function if |this| does not represent a member of its owner. + void GetParent() { + assert(IsMember()); + access_chain_.pop_back(); + } + + // Returns true if |this| represents a member of its owner, and not the + // entire variable. + bool IsMember() const { return !access_chain_.empty(); } + + // Returns the number of members in the object represented by |this|. If + // |this| does not represent a composite type, the return value will be 0. + uint32_t GetNumberOfMembers(); + + // Returns the owning variable that the memory object is contained in. + Instruction* GetVariable() const { return variable_inst_; } + + // Returns a vector of integers that can be used to access the specific + // member that |this| represents starting from the owning variable. These + // values are to be interpreted the same way the indices are in an + // |OpAccessChain| instruction. + const std::vector& AccessChain() const { return access_chain_; } + + // Returns the type id of the pointer type that can be used to point to this + // memory object. + uint32_t GetPointerTypeId() const { + analysis::TypeManager* type_mgr = + GetVariable()->context()->get_type_mgr(); + const analysis::Pointer* pointer_type = + type_mgr->GetType(GetVariable()->type_id())->AsPointer(); + const analysis::Type* var_type = pointer_type->pointee_type(); + const analysis::Type* member_type = + type_mgr->GetMemberType(var_type, GetAccessIds()); + uint32_t member_type_id = type_mgr->GetId(member_type); + assert(member_type != 0); + uint32_t member_pointer_type_id = type_mgr->FindPointerToType( + member_type_id, pointer_type->storage_class()); + return member_pointer_type_id; + } + + // Returns the storage class of the memory object. + SpvStorageClass GetStorageClass() const { + analysis::TypeManager* type_mgr = + GetVariable()->context()->get_type_mgr(); + const analysis::Pointer* pointer_type = + type_mgr->GetType(GetVariable()->type_id())->AsPointer(); + return pointer_type->storage_class(); + } + + // Returns true if |other| represents memory that is contains inside of the + // memory represented by |this|. + bool Contains(MemoryObject* other); + + private: + // The variable that owns this memory object. + Instruction* variable_inst_; + + // The access chain to reach the particular member the memory object + // represents. It should be interpreted the same way the indices in an + // |OpAccessChain| are interpreted. + std::vector access_chain_; + std::vector GetAccessIds() const; + }; + + // Returns the memory object being stored to |var_inst| in the store + // instruction |store_inst|, if one exists, that can be used in place of + // |var_inst| in all of the loads of |var_inst|. This code is conservative + // and only identifies very simple cases. If no such memory object can be + // found, the return value is |nullptr|. + std::unique_ptr FindSourceObjectIfPossible( + Instruction* var_inst, Instruction* store_inst); + + // Replaces all loads of |var_inst| with a load from |source| instead. + // |insertion_pos| is a position where it is possible to construct the + // address of |source| and also dominates all of the loads of |var_inst|. + void PropagateObject(Instruction* var_inst, MemoryObject* source, + Instruction* insertion_pos); + + // Returns true if all of the references to |ptr_inst| can be rewritten and + // are dominated by |store_inst|. + bool HasValidReferencesOnly(Instruction* ptr_inst, Instruction* store_inst); + + // Returns a memory object that at one time was equivalent to the value in + // |result|. If no such memory object exists, the return value is |nullptr|. + std::unique_ptr GetSourceObjectIfAny(uint32_t result); + + // Returns the memory object that is loaded by |load_inst|. If a memory + // object cannot be identified, the return value is |nullptr|. The opcode of + // |load_inst| must be |OpLoad|. + std::unique_ptr BuildMemoryObjectFromLoad( + Instruction* load_inst); + + // Returns the memory object that at some point was equivalent to the result + // of |extract_inst|. If a memory object cannot be identified, the return + // value is |nullptr|. The opcode of |extract_inst| must be + // |OpCompositeExtract|. + std::unique_ptr BuildMemoryObjectFromExtract( + Instruction* extract_inst); + + // Returns the memory object that at some point was equivalent to the result + // of |construct_inst|. If a memory object cannot be identified, the return + // value is |nullptr|. The opcode of |constuct_inst| must be + // |OpCompositeConstruct|. + std::unique_ptr BuildMemoryObjectFromCompositeConstruct( + Instruction* conststruct_inst); + + // Returns the memory object that at some point was equivalent to the result + // of |insert_inst|. If a memory object cannot be identified, the return + // value is |nullptr\. The opcode of |insert_inst| must be + // |OpCompositeInsert|. This function looks for a series of + // |OpCompositeInsert| instructions that insert the elements one at a time in + // order from beginning to end. + std::unique_ptr BuildMemoryObjectFromInsert( + Instruction* insert_inst); + + // Return true if |type_id| is a pointer type whose pointee type is an array. + bool IsPointerToArrayType(uint32_t type_id); + + // Returns true of there are not stores using |ptr_inst| or something derived + // from it. + bool HasNoStores(Instruction* ptr_inst); + + // Creates an |OpAccessChain| instruction whose result is a pointer the memory + // represented by |source|. The new instruction will be placed before + // |insertion_point|. |insertion_point| must be part of a function. Returns + // the new instruction. + Instruction* BuildNewAccessChain(Instruction* insertion_point, + MemoryObject* source) const; + + // Rewrites all uses of |original_ptr| to use |new_pointer_inst| updating + // types of other instructions as needed. This function should not be called + // if |CanUpdateUses(original_ptr_inst, new_pointer_inst->type_id())| returns + // false. + void UpdateUses(Instruction* original_ptr_inst, + Instruction* new_pointer_inst); + + // Return true if |UpdateUses| is able to change all of the uses of + // |original_ptr_inst| to |type_id| and still have valid code. + bool CanUpdateUses(Instruction* original_ptr_inst, uint32_t type_id); + + // Returns the id whose value is the same as |object_to_copy| except its type + // is |new_type_id|. Any instructions need to generate this value will be + // inserted before |insertion_position|. + uint32_t GenerateCopy(Instruction* object_to_copy, uint32_t new_type_id, + Instruction* insertion_position); + + // Returns a store to |var_inst| that writes to the entire variable, and is + // the only store that does so. Note it does not look through OpAccessChain + // instruction, so partial stores are not considered. + Instruction* FindStoreInstruction(const Instruction* var_inst) const; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_COPY_PROP_ARRAYS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp new file mode 100644 index 00000000000..b147ef74ca6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.cpp @@ -0,0 +1,467 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG Inc. +// Copyright (c) 2018 Google 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. + +#include "source/opt/dead_branch_elim_pass.h" + +#include +#include +#include + +#include "source/cfa.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kBranchCondTrueLabIdInIdx = 1; +const uint32_t kBranchCondFalseLabIdInIdx = 2; + +} // anonymous namespace + +bool DeadBranchElimPass::GetConstCondition(uint32_t condId, bool* condVal) { + bool condIsConst; + Instruction* cInst = get_def_use_mgr()->GetDef(condId); + switch (cInst->opcode()) { + case SpvOpConstantFalse: { + *condVal = false; + condIsConst = true; + } break; + case SpvOpConstantTrue: { + *condVal = true; + condIsConst = true; + } break; + case SpvOpLogicalNot: { + bool negVal; + condIsConst = + GetConstCondition(cInst->GetSingleWordInOperand(0), &negVal); + if (condIsConst) *condVal = !negVal; + } break; + default: { condIsConst = false; } break; + } + return condIsConst; +} + +bool DeadBranchElimPass::GetConstInteger(uint32_t selId, uint32_t* selVal) { + Instruction* sInst = get_def_use_mgr()->GetDef(selId); + uint32_t typeId = sInst->type_id(); + Instruction* typeInst = get_def_use_mgr()->GetDef(typeId); + if (!typeInst || (typeInst->opcode() != SpvOpTypeInt)) return false; + // TODO(greg-lunarg): Support non-32 bit ints + if (typeInst->GetSingleWordInOperand(0) != 32) return false; + if (sInst->opcode() == SpvOpConstant) { + *selVal = sInst->GetSingleWordInOperand(0); + return true; + } else if (sInst->opcode() == SpvOpConstantNull) { + *selVal = 0; + return true; + } + return false; +} + +void DeadBranchElimPass::AddBranch(uint32_t labelId, BasicBlock* bp) { + assert(get_def_use_mgr()->GetDef(labelId) != nullptr); + std::unique_ptr newBranch( + new Instruction(context(), SpvOpBranch, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {labelId}}})); + context()->AnalyzeDefUse(&*newBranch); + context()->set_instr_block(&*newBranch, bp); + bp->AddInstruction(std::move(newBranch)); +} + +BasicBlock* DeadBranchElimPass::GetParentBlock(uint32_t id) { + return context()->get_instr_block(get_def_use_mgr()->GetDef(id)); +} + +bool DeadBranchElimPass::MarkLiveBlocks( + Function* func, std::unordered_set* live_blocks) { + std::unordered_set continues; + std::vector stack; + stack.push_back(&*func->begin()); + bool modified = false; + while (!stack.empty()) { + BasicBlock* block = stack.back(); + stack.pop_back(); + + // Live blocks doubles as visited set. + if (!live_blocks->insert(block).second) continue; + + uint32_t cont_id = block->ContinueBlockIdIfAny(); + if (cont_id != 0) continues.insert(GetParentBlock(cont_id)); + + Instruction* terminator = block->terminator(); + uint32_t live_lab_id = 0; + // Check if the terminator has a single valid successor. + if (terminator->opcode() == SpvOpBranchConditional) { + bool condVal; + if (GetConstCondition(terminator->GetSingleWordInOperand(0u), &condVal)) { + live_lab_id = terminator->GetSingleWordInOperand( + condVal ? kBranchCondTrueLabIdInIdx : kBranchCondFalseLabIdInIdx); + } + } else if (terminator->opcode() == SpvOpSwitch) { + uint32_t sel_val; + if (GetConstInteger(terminator->GetSingleWordInOperand(0u), &sel_val)) { + // Search switch operands for selector value, set live_lab_id to + // corresponding label, use default if not found. + uint32_t icnt = 0; + uint32_t case_val; + terminator->WhileEachInOperand( + [&icnt, &case_val, &sel_val, &live_lab_id](const uint32_t* idp) { + if (icnt == 1) { + // Start with default label. + live_lab_id = *idp; + } else if (icnt > 1) { + if (icnt % 2 == 0) { + case_val = *idp; + } else { + if (case_val == sel_val) { + live_lab_id = *idp; + return false; + } + } + } + ++icnt; + return true; + }); + } + } + + // Don't simplify branches of continue blocks. A path from the continue to + // the header is required. + // TODO(alan-baker): They can be simplified iff there remains a path to the + // backedge. Structured control flow should guarantee one path hits the + // backedge, but I've removed the requirement for structured control flow + // from this pass. + bool simplify = live_lab_id != 0 && !continues.count(block); + + if (simplify) { + modified = true; + // Replace with unconditional branch. + // Remove the merge instruction if it is a selection merge. + AddBranch(live_lab_id, block); + context()->KillInst(terminator); + Instruction* mergeInst = block->GetMergeInst(); + if (mergeInst && mergeInst->opcode() == SpvOpSelectionMerge) { + Instruction* first_break = FindFirstExitFromSelectionMerge( + live_lab_id, mergeInst->GetSingleWordInOperand(0)); + if (first_break == nullptr) { + context()->KillInst(mergeInst); + } else { + mergeInst->RemoveFromList(); + first_break->InsertBefore(std::unique_ptr(mergeInst)); + context()->set_instr_block(mergeInst, + context()->get_instr_block(first_break)); + } + } + stack.push_back(GetParentBlock(live_lab_id)); + } else { + // All successors are live. + const auto* const_block = block; + const_block->ForEachSuccessorLabel([&stack, this](const uint32_t label) { + stack.push_back(GetParentBlock(label)); + }); + } + } + + return modified; +} + +void DeadBranchElimPass::MarkUnreachableStructuredTargets( + const std::unordered_set& live_blocks, + std::unordered_set* unreachable_merges, + std::unordered_map* unreachable_continues) { + for (auto block : live_blocks) { + if (auto merge_id = block->MergeBlockIdIfAny()) { + BasicBlock* merge_block = GetParentBlock(merge_id); + if (!live_blocks.count(merge_block)) { + unreachable_merges->insert(merge_block); + } + if (auto cont_id = block->ContinueBlockIdIfAny()) { + BasicBlock* cont_block = GetParentBlock(cont_id); + if (!live_blocks.count(cont_block)) { + (*unreachable_continues)[cont_block] = block; + } + } + } + } +} + +bool DeadBranchElimPass::FixPhiNodesInLiveBlocks( + Function* func, const std::unordered_set& live_blocks, + const std::unordered_map& unreachable_continues) { + bool modified = false; + for (auto& block : *func) { + if (live_blocks.count(&block)) { + for (auto iter = block.begin(); iter != block.end();) { + if (iter->opcode() != SpvOpPhi) { + break; + } + + bool changed = false; + bool backedge_added = false; + Instruction* inst = &*iter; + std::vector operands; + // Build a complete set of operands (not just input operands). Start + // with type and result id operands. + operands.push_back(inst->GetOperand(0u)); + operands.push_back(inst->GetOperand(1u)); + // Iterate through the incoming labels and determine which to keep + // and/or modify. If there in an unreachable continue block, there will + // be an edge from that block to the header. We need to keep it to + // maintain the structured control flow. If the header has more that 2 + // incoming edges, then the OpPhi must have an entry for that edge. + // However, if there is only one other incoming edge, the OpPhi can be + // eliminated. + for (uint32_t i = 1; i < inst->NumInOperands(); i += 2) { + BasicBlock* inc = GetParentBlock(inst->GetSingleWordInOperand(i)); + auto cont_iter = unreachable_continues.find(inc); + if (cont_iter != unreachable_continues.end() && + cont_iter->second == &block && inst->NumInOperands() > 4) { + if (get_def_use_mgr() + ->GetDef(inst->GetSingleWordInOperand(i - 1)) + ->opcode() == SpvOpUndef) { + // Already undef incoming value, no change necessary. + operands.push_back(inst->GetInOperand(i - 1)); + operands.push_back(inst->GetInOperand(i)); + backedge_added = true; + } else { + // Replace incoming value with undef if this phi exists in the + // loop header. Otherwise, this edge is not live since the + // unreachable continue block will be replaced with an + // unconditional branch to the header only. + operands.emplace_back( + SPV_OPERAND_TYPE_ID, + std::initializer_list{Type2Undef(inst->type_id())}); + operands.push_back(inst->GetInOperand(i)); + changed = true; + backedge_added = true; + } + } else if (live_blocks.count(inc) && inc->IsSuccessor(&block)) { + // Keep live incoming edge. + operands.push_back(inst->GetInOperand(i - 1)); + operands.push_back(inst->GetInOperand(i)); + } else { + // Remove incoming edge. + changed = true; + } + } + + if (changed) { + modified = true; + uint32_t continue_id = block.ContinueBlockIdIfAny(); + if (!backedge_added && continue_id != 0 && + unreachable_continues.count(GetParentBlock(continue_id)) && + operands.size() > 4) { + // Changed the backedge to branch from the continue block instead + // of a successor of the continue block. Add an entry to the phi to + // provide an undef for the continue block. Since the successor of + // the continue must also be unreachable (dominated by the continue + // block), any entry for the original backedge has been removed + // from the phi operands. + operands.emplace_back( + SPV_OPERAND_TYPE_ID, + std::initializer_list{Type2Undef(inst->type_id())}); + operands.emplace_back(SPV_OPERAND_TYPE_ID, + std::initializer_list{continue_id}); + } + + // Either replace the phi with a single value or rebuild the phi out + // of |operands|. + // + // We always have type and result id operands. So this phi has a + // single source if there are two more operands beyond those. + if (operands.size() == 4) { + // First input data operands is at index 2. + uint32_t replId = operands[2u].words[0]; + context()->ReplaceAllUsesWith(inst->result_id(), replId); + iter = context()->KillInst(&*inst); + } else { + // We've rewritten the operands, so first instruct the def/use + // manager to forget uses in the phi before we replace them. After + // replacing operands update the def/use manager by re-analyzing + // the used ids in this phi. + get_def_use_mgr()->EraseUseRecordsOfOperandIds(inst); + inst->ReplaceOperands(operands); + get_def_use_mgr()->AnalyzeInstUse(inst); + ++iter; + } + } else { + ++iter; + } + } + } + } + + return modified; +} + +bool DeadBranchElimPass::EraseDeadBlocks( + Function* func, const std::unordered_set& live_blocks, + const std::unordered_set& unreachable_merges, + const std::unordered_map& unreachable_continues) { + bool modified = false; + for (auto ebi = func->begin(); ebi != func->end();) { + if (unreachable_merges.count(&*ebi)) { + if (ebi->begin() != ebi->tail() || + ebi->terminator()->opcode() != SpvOpUnreachable) { + // Make unreachable, but leave the label. + KillAllInsts(&*ebi, false); + // Add unreachable terminator. + ebi->AddInstruction( + MakeUnique(context(), SpvOpUnreachable, 0, 0, + std::initializer_list{})); + context()->set_instr_block(&*ebi->tail(), &*ebi); + modified = true; + } + ++ebi; + } else if (unreachable_continues.count(&*ebi)) { + uint32_t cont_id = unreachable_continues.find(&*ebi)->second->id(); + if (ebi->begin() != ebi->tail() || + ebi->terminator()->opcode() != SpvOpBranch || + ebi->terminator()->GetSingleWordInOperand(0u) != cont_id) { + // Make unreachable, but leave the label. + KillAllInsts(&*ebi, false); + // Add unconditional branch to header. + assert(unreachable_continues.count(&*ebi)); + ebi->AddInstruction(MakeUnique( + context(), SpvOpBranch, 0, 0, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {cont_id}}})); + get_def_use_mgr()->AnalyzeInstUse(&*ebi->tail()); + context()->set_instr_block(&*ebi->tail(), &*ebi); + modified = true; + } + ++ebi; + } else if (!live_blocks.count(&*ebi)) { + // Kill this block. + KillAllInsts(&*ebi); + ebi = ebi.Erase(); + modified = true; + } else { + ++ebi; + } + } + + return modified; +} + +bool DeadBranchElimPass::EliminateDeadBranches(Function* func) { + bool modified = false; + std::unordered_set live_blocks; + modified |= MarkLiveBlocks(func, &live_blocks); + + std::unordered_set unreachable_merges; + std::unordered_map unreachable_continues; + MarkUnreachableStructuredTargets(live_blocks, &unreachable_merges, + &unreachable_continues); + modified |= FixPhiNodesInLiveBlocks(func, live_blocks, unreachable_continues); + modified |= EraseDeadBlocks(func, live_blocks, unreachable_merges, + unreachable_continues); + + return modified; +} + +void DeadBranchElimPass::FixBlockOrder() { + context()->BuildInvalidAnalyses(IRContext::kAnalysisCFG | + IRContext::kAnalysisDominatorAnalysis); + // Reorders blocks according to DFS of dominator tree. + ProcessFunction reorder_dominators = [this](Function* function) { + DominatorAnalysis* dominators = context()->GetDominatorAnalysis(function); + std::vector blocks; + for (auto iter = dominators->GetDomTree().begin(); + iter != dominators->GetDomTree().end(); ++iter) { + if (iter->id() != 0) { + blocks.push_back(iter->bb_); + } + } + for (uint32_t i = 1; i < blocks.size(); ++i) { + function->MoveBasicBlockToAfter(blocks[i]->id(), blocks[i - 1]); + } + return true; + }; + + // Reorders blocks according to structured order. + ProcessFunction reorder_structured = [this](Function* function) { + std::list order; + context()->cfg()->ComputeStructuredOrder(function, &*function->begin(), + &order); + std::vector blocks; + for (auto block : order) { + blocks.push_back(block); + } + for (uint32_t i = 1; i < blocks.size(); ++i) { + function->MoveBasicBlockToAfter(blocks[i]->id(), blocks[i - 1]); + } + return true; + }; + + // Structured order is more intuitive so use it where possible. + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) { + ProcessReachableCallTree(reorder_structured, context()); + } else { + ProcessReachableCallTree(reorder_dominators, context()); + } +} + +Pass::Status DeadBranchElimPass::Process() { + // Do not process if module contains OpGroupDecorate. Additional + // support required in KillNamesAndDecorates(). + // TODO(greg-lunarg): Add support for OpGroupDecorate + for (auto& ai : get_module()->annotations()) + if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + // Process all entry point functions + ProcessFunction pfn = [this](Function* fp) { + return EliminateDeadBranches(fp); + }; + bool modified = ProcessReachableCallTree(pfn, context()); + if (modified) FixBlockOrder(); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +Instruction* DeadBranchElimPass::FindFirstExitFromSelectionMerge( + uint32_t start_block_id, uint32_t merge_block_id) { + // To find the "first" exit, we follow branches looking for a conditional + // branch that is not in a nested construct and is not the header of a new + // construct. We follow the control flow from |start_block_id| to find the + // first one. + while (start_block_id != merge_block_id) { + BasicBlock* start_block = context()->get_instr_block(start_block_id); + Instruction* branch = start_block->terminator(); + uint32_t next_block_id = 0; + switch (branch->opcode()) { + case SpvOpBranchConditional: + case SpvOpSwitch: + next_block_id = start_block->MergeBlockIdIfAny(); + if (next_block_id == 0) { + return branch; + } + break; + case SpvOpBranch: + next_block_id = branch->GetSingleWordInOperand(0); + break; + default: + return nullptr; + } + start_block_id = next_block_id; + } + return nullptr; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h new file mode 100644 index 00000000000..f8b44120771 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_branch_elim_pass.h @@ -0,0 +1,149 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_DEAD_BRANCH_ELIM_PASS_H_ +#define SOURCE_OPT_DEAD_BRANCH_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class DeadBranchElimPass : public MemPass { + using cbb_ptr = const BasicBlock*; + + public: + DeadBranchElimPass() = default; + + const char* name() const override { return "eliminate-dead-branches"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; + } + + private: + // If |condId| is boolean constant, return conditional value in |condVal| and + // return true, otherwise return false. + bool GetConstCondition(uint32_t condId, bool* condVal); + + // If |valId| is a 32-bit integer constant, return value via |value| and + // return true, otherwise return false. + bool GetConstInteger(uint32_t valId, uint32_t* value); + + // Add branch to |labelId| to end of block |bp|. + void AddBranch(uint32_t labelId, BasicBlock* bp); + + // For function |func|, look for BranchConditionals with constant condition + // and convert to a Branch to the indicated label. Delete resulting dead + // blocks. Note some such branches and blocks may be left to avoid creating + // invalid control flow. + // TODO(greg-lunarg): Remove remaining constant conditional branches and dead + // blocks. + bool EliminateDeadBranches(Function* func); + + // Returns the basic block containing |id|. + // Note: this pass only requires correct instruction block mappings for the + // input. This pass does not preserve the block mapping, so it is not kept + // up-to-date during processing. + BasicBlock* GetParentBlock(uint32_t id); + + // Marks live blocks reachable from the entry of |func|. Simplifies constant + // branches and switches as it proceeds, to limit the number of live blocks. + // It is careful not to eliminate backedges even if they are dead, but the + // header is live. Likewise, unreachable merge blocks named in live merge + // instruction must be retained (though they may be clobbered). + bool MarkLiveBlocks(Function* func, + std::unordered_set* live_blocks); + + // Checks for unreachable merge and continue blocks with live headers; those + // blocks must be retained. Continues are tracked separately so that a live + // phi can be updated to take an undef value from any of its predecessors + // that are unreachable continues. + // + // |unreachable_continues| maps the id of an unreachable continue target to + // the header block that declares it. + void MarkUnreachableStructuredTargets( + const std::unordered_set& live_blocks, + std::unordered_set* unreachable_merges, + std::unordered_map* unreachable_continues); + + // Fix phis in reachable blocks so that only live (or unremovable) incoming + // edges are present. If the block now only has a single live incoming edge, + // remove the phi and replace its uses with its data input. If the single + // remaining incoming edge is from the phi itself, the the phi is in an + // unreachable single block loop. Either the block is dead and will be + // removed, or it's reachable from an unreachable continue target. In the + // latter case that continue target block will be collapsed into a block that + // only branches back to its header and we'll eliminate the block with the + // phi. + // + // |unreachable_continues| maps continue targets that cannot be reached to + // merge instruction that declares them. + bool FixPhiNodesInLiveBlocks( + Function* func, const std::unordered_set& live_blocks, + const std::unordered_map& + unreachable_continues); + + // Erases dead blocks. Any block captured in |unreachable_merges| or + // |unreachable_continues| is a dead block that is required to remain due to + // a live merge instruction in the corresponding header. These blocks will + // have their instructions clobbered and will become a label and terminator. + // Unreachable merge blocks are terminated by OpUnreachable, while + // unreachable continue blocks are terminated by an unconditional branch to + // the header. Otherwise, blocks are dead if not explicitly captured in + // |live_blocks| and are totally removed. + // + // |unreachable_continues| maps continue targets that cannot be reached to + // corresponding header block that declares them. + bool EraseDeadBlocks( + Function* func, const std::unordered_set& live_blocks, + const std::unordered_set& unreachable_merges, + const std::unordered_map& + unreachable_continues); + + // Reorders blocks in reachable functions so that they satisfy dominator + // block ordering rules. + void FixBlockOrder(); + + // Return the first branch instruction that is a conditional branch to + // |merge_block_id|. Returns |nullptr| if not such branch exists. If there are + // multiple such branches, the first one is the one that would be executed + // first when running the code. That is, the one that dominates all of the + // others. + // + // |start_block_id| must be a block whose innermost containing merge construct + // has |merge_block_id| as the merge block. + Instruction* FindFirstExitFromSelectionMerge(uint32_t start_block_id, + uint32_t merge_block_id); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DEAD_BRANCH_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp new file mode 100644 index 00000000000..b42588ff732 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.cpp @@ -0,0 +1,263 @@ +// Copyright (c) 2018 The Khronos Group Inc. +// Copyright (c) 2018 Valve Corporation +// Copyright (c) 2018 LunarG 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. + +#include "source/opt/dead_insert_elim_pass.h" + +#include "source/opt/composite.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "spirv/1.2/GLSL.std.450.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kTypeVectorCountInIdx = 1; +const uint32_t kTypeMatrixCountInIdx = 1; +const uint32_t kTypeArrayLengthIdInIdx = 1; +const uint32_t kTypeIntWidthInIdx = 0; +const uint32_t kConstantValueInIdx = 0; +const uint32_t kInsertObjectIdInIdx = 0; +const uint32_t kInsertCompositeIdInIdx = 1; + +} // anonymous namespace + +uint32_t DeadInsertElimPass::NumComponents(Instruction* typeInst) { + switch (typeInst->opcode()) { + case SpvOpTypeVector: { + return typeInst->GetSingleWordInOperand(kTypeVectorCountInIdx); + } break; + case SpvOpTypeMatrix: { + return typeInst->GetSingleWordInOperand(kTypeMatrixCountInIdx); + } break; + case SpvOpTypeArray: { + uint32_t lenId = + typeInst->GetSingleWordInOperand(kTypeArrayLengthIdInIdx); + Instruction* lenInst = get_def_use_mgr()->GetDef(lenId); + if (lenInst->opcode() != SpvOpConstant) return 0; + uint32_t lenTypeId = lenInst->type_id(); + Instruction* lenTypeInst = get_def_use_mgr()->GetDef(lenTypeId); + // TODO(greg-lunarg): Support non-32-bit array length + if (lenTypeInst->GetSingleWordInOperand(kTypeIntWidthInIdx) != 32) + return 0; + return lenInst->GetSingleWordInOperand(kConstantValueInIdx); + } break; + case SpvOpTypeStruct: { + return typeInst->NumInOperands(); + } break; + default: { return 0; } break; + } +} + +void DeadInsertElimPass::MarkInsertChain( + Instruction* insertChain, std::vector* pExtIndices, + uint32_t extOffset, std::unordered_set* visited_phis) { + // Not currently optimizing array inserts. + Instruction* typeInst = get_def_use_mgr()->GetDef(insertChain->type_id()); + if (typeInst->opcode() == SpvOpTypeArray) return; + // Insert chains are only composed of inserts and phis + if (insertChain->opcode() != SpvOpCompositeInsert && + insertChain->opcode() != SpvOpPhi) + return; + // If extract indices are empty, mark all subcomponents if type + // is constant length. + if (pExtIndices == nullptr) { + uint32_t cnum = NumComponents(typeInst); + if (cnum > 0) { + std::vector extIndices; + for (uint32_t i = 0; i < cnum; i++) { + extIndices.clear(); + extIndices.push_back(i); + std::unordered_set sub_visited_phis; + MarkInsertChain(insertChain, &extIndices, 0, &sub_visited_phis); + } + return; + } + } + Instruction* insInst = insertChain; + while (insInst->opcode() == SpvOpCompositeInsert) { + // If no extract indices, mark insert and inserted object (which might + // also be an insert chain) and continue up the chain though the input + // composite. + // + // Note: We mark inserted objects in this function (rather than in + // EliminateDeadInsertsOnePass) because in some cases, we can do it + // more accurately here. + if (pExtIndices == nullptr) { + liveInserts_.insert(insInst->result_id()); + uint32_t objId = insInst->GetSingleWordInOperand(kInsertObjectIdInIdx); + std::unordered_set obj_visited_phis; + MarkInsertChain(get_def_use_mgr()->GetDef(objId), nullptr, 0, + &obj_visited_phis); + // If extract indices match insert, we are done. Mark insert and + // inserted object. + } else if (ExtInsMatch(*pExtIndices, insInst, extOffset)) { + liveInserts_.insert(insInst->result_id()); + uint32_t objId = insInst->GetSingleWordInOperand(kInsertObjectIdInIdx); + std::unordered_set obj_visited_phis; + MarkInsertChain(get_def_use_mgr()->GetDef(objId), nullptr, 0, + &obj_visited_phis); + break; + // If non-matching intersection, mark insert + } else if (ExtInsConflict(*pExtIndices, insInst, extOffset)) { + liveInserts_.insert(insInst->result_id()); + // If more extract indices than insert, we are done. Use remaining + // extract indices to mark inserted object. + uint32_t numInsertIndices = insInst->NumInOperands() - 2; + if (pExtIndices->size() - extOffset > numInsertIndices) { + uint32_t objId = insInst->GetSingleWordInOperand(kInsertObjectIdInIdx); + std::unordered_set obj_visited_phis; + MarkInsertChain(get_def_use_mgr()->GetDef(objId), pExtIndices, + extOffset + numInsertIndices, &obj_visited_phis); + break; + // If fewer extract indices than insert, also mark inserted object and + // continue up chain. + } else { + uint32_t objId = insInst->GetSingleWordInOperand(kInsertObjectIdInIdx); + std::unordered_set obj_visited_phis; + MarkInsertChain(get_def_use_mgr()->GetDef(objId), nullptr, 0, + &obj_visited_phis); + } + } + // Get next insert in chain + const uint32_t compId = + insInst->GetSingleWordInOperand(kInsertCompositeIdInIdx); + insInst = get_def_use_mgr()->GetDef(compId); + } + // If insert chain ended with phi, do recursive call on each operand + if (insInst->opcode() != SpvOpPhi) return; + // Mark phi visited to prevent potential infinite loop. If phi is already + // visited, return to avoid infinite loop. + if (visited_phis->count(insInst->result_id()) != 0) return; + visited_phis->insert(insInst->result_id()); + + // Phis may have duplicate inputs values for different edges, prune incoming + // ids lists before recursing. + std::vector ids; + for (uint32_t i = 0; i < insInst->NumInOperands(); i += 2) { + ids.push_back(insInst->GetSingleWordInOperand(i)); + } + std::sort(ids.begin(), ids.end()); + auto new_end = std::unique(ids.begin(), ids.end()); + for (auto id_iter = ids.begin(); id_iter != new_end; ++id_iter) { + Instruction* pi = get_def_use_mgr()->GetDef(*id_iter); + MarkInsertChain(pi, pExtIndices, extOffset, visited_phis); + } +} + +bool DeadInsertElimPass::EliminateDeadInserts(Function* func) { + bool modified = false; + bool lastmodified = true; + // Each pass can delete dead instructions, thus potentially revealing + // new dead insertions ie insertions with no uses. + while (lastmodified) { + lastmodified = EliminateDeadInsertsOnePass(func); + modified |= lastmodified; + } + return modified; +} + +bool DeadInsertElimPass::EliminateDeadInsertsOnePass(Function* func) { + bool modified = false; + liveInserts_.clear(); + visitedPhis_.clear(); + // Mark all live inserts + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end(); ++ii) { + // Only process Inserts and composite Phis + SpvOp op = ii->opcode(); + Instruction* typeInst = get_def_use_mgr()->GetDef(ii->type_id()); + if (op != SpvOpCompositeInsert && + (op != SpvOpPhi || !spvOpcodeIsComposite(typeInst->opcode()))) + continue; + // The marking algorithm can be expensive for large arrays and the + // efficacy of eliminating dead inserts into arrays is questionable. + // Skip optimizing array inserts for now. Just mark them live. + // TODO(greg-lunarg): Eliminate dead array inserts + if (op == SpvOpCompositeInsert) { + if (typeInst->opcode() == SpvOpTypeArray) { + liveInserts_.insert(ii->result_id()); + continue; + } + } + const uint32_t id = ii->result_id(); + get_def_use_mgr()->ForEachUser(id, [&ii, this](Instruction* user) { + switch (user->opcode()) { + case SpvOpCompositeInsert: + case SpvOpPhi: + // Use by insert or phi does not initiate marking + break; + case SpvOpCompositeExtract: { + // Capture extract indices + std::vector extIndices; + uint32_t icnt = 0; + user->ForEachInOperand([&icnt, &extIndices](const uint32_t* idp) { + if (icnt > 0) extIndices.push_back(*idp); + ++icnt; + }); + // Mark all inserts in chain that intersect with extract + std::unordered_set visited_phis; + MarkInsertChain(&*ii, &extIndices, 0, &visited_phis); + } break; + default: { + // Mark inserts in chain for all components + MarkInsertChain(&*ii, nullptr, 0, nullptr); + } break; + } + }); + } + } + // Find and disconnect dead inserts + std::vector dead_instructions; + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end(); ++ii) { + if (ii->opcode() != SpvOpCompositeInsert) continue; + const uint32_t id = ii->result_id(); + if (liveInserts_.find(id) != liveInserts_.end()) continue; + const uint32_t replId = + ii->GetSingleWordInOperand(kInsertCompositeIdInIdx); + (void)context()->ReplaceAllUsesWith(id, replId); + dead_instructions.push_back(&*ii); + modified = true; + } + } + // DCE dead inserts + while (!dead_instructions.empty()) { + Instruction* inst = dead_instructions.back(); + dead_instructions.pop_back(); + DCEInst(inst, [&dead_instructions](Instruction* other_inst) { + auto i = std::find(dead_instructions.begin(), dead_instructions.end(), + other_inst); + if (i != dead_instructions.end()) { + dead_instructions.erase(i); + } + }); + } + return modified; +} + +Pass::Status DeadInsertElimPass::Process() { + // Process all entry point functions. + ProcessFunction pfn = [this](Function* fp) { + return EliminateDeadInserts(fp); + }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.h new file mode 100644 index 00000000000..0b111d02c00 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_insert_elim_pass.h @@ -0,0 +1,89 @@ +// Copyright (c) 2018 The Khronos Group Inc. +// Copyright (c) 2018 Valve Corporation +// Copyright (c) 2018 LunarG 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. + +#ifndef SOURCE_OPT_DEAD_INSERT_ELIM_PASS_H_ +#define SOURCE_OPT_DEAD_INSERT_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class DeadInsertElimPass : public MemPass { + public: + DeadInsertElimPass() = default; + + const char* name() const override { return "eliminate-dead-inserts"; } + Status Process() override; + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisNameMap; + } + + private: + // Return the number of subcomponents in the composite type |typeId|. + // Return 0 if not a composite type or number of components is not a + // 32-bit constant. + uint32_t NumComponents(Instruction* typeInst); + + // Mark all inserts in instruction chain ending at |insertChain| with + // indices that intersect with extract indices |extIndices| starting with + // index at |extOffset|. Chains are composed solely of Inserts and Phis. + // Mark all inserts in chain if |extIndices| is nullptr. + void MarkInsertChain(Instruction* insertChain, + std::vector* extIndices, uint32_t extOffset, + std::unordered_set* visited_phis); + + // Perform EliminateDeadInsertsOnePass(|func|) until no modification is + // made. Return true if modified. + bool EliminateDeadInserts(Function* func); + + // DCE all dead struct, matrix and vector inserts in |func|. An insert is + // dead if the value it inserts is never used. Replace any reference to the + // insert with its original composite. Return true if modified. Dead inserts + // in dependence cycles are not currently eliminated. Dead inserts into + // arrays are not currently eliminated. + bool EliminateDeadInsertsOnePass(Function* func); + + // Return true if all extensions in this module are allowed by this pass. + bool AllExtensionsSupported() const; + + // Live inserts + std::unordered_set liveInserts_; + + // Visited phis as insert chain is traversed; used to avoid infinite loop + std::unordered_map visitedPhis_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DEAD_INSERT_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp new file mode 100644 index 00000000000..28371068401 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.cpp @@ -0,0 +1,111 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/dead_variable_elimination.h" + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +// This optimization removes global variables that are not needed because they +// are definitely not accessed. +Pass::Status DeadVariableElimination::Process() { + // The algorithm will compute the reference count for every global variable. + // Anything with a reference count of 0 will then be deleted. For variables + // that might have references that are not explicit in this context, we use + // the value kMustKeep as the reference count. + std::vector ids_to_remove; + + // Get the reference count for all of the global OpVariable instructions. + for (auto& inst : context()->types_values()) { + if (inst.opcode() != SpvOp::SpvOpVariable) { + continue; + } + + size_t count = 0; + uint32_t result_id = inst.result_id(); + + // Check the linkage. If it is exported, it could be reference somewhere + // else, so we must keep the variable around. + get_decoration_mgr()->ForEachDecoration( + result_id, SpvDecorationLinkageAttributes, + [&count](const Instruction& linkage_instruction) { + uint32_t last_operand = linkage_instruction.NumOperands() - 1; + if (linkage_instruction.GetSingleWordOperand(last_operand) == + SpvLinkageTypeExport) { + count = kMustKeep; + } + }); + + if (count != kMustKeep) { + // If we don't have to keep the instruction for other reasons, then look + // at the uses and count the number of real references. + count = 0; + get_def_use_mgr()->ForEachUser(result_id, [&count](Instruction* user) { + if (!IsAnnotationInst(user->opcode()) && user->opcode() != SpvOpName) { + ++count; + } + }); + } + reference_count_[result_id] = count; + if (count == 0) { + ids_to_remove.push_back(result_id); + } + } + + // Remove all of the variables that have a reference count of 0. + bool modified = false; + if (!ids_to_remove.empty()) { + modified = true; + for (auto result_id : ids_to_remove) { + DeleteVariable(result_id); + } + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +void DeadVariableElimination::DeleteVariable(uint32_t result_id) { + Instruction* inst = get_def_use_mgr()->GetDef(result_id); + assert(inst->opcode() == SpvOpVariable && + "Should not be trying to delete anything other than an OpVariable."); + + // Look for an initializer that references another variable. We need to know + // if that variable can be deleted after the reference is removed. + if (inst->NumOperands() == 4) { + Instruction* initializer = + get_def_use_mgr()->GetDef(inst->GetSingleWordOperand(3)); + + // TODO: Handle OpSpecConstantOP which might be defined in terms of other + // variables. Will probably require a unified dead code pass that does all + // instruction types. (Issue 906) + if (initializer->opcode() == SpvOpVariable) { + uint32_t initializer_id = initializer->result_id(); + size_t& count = reference_count_[initializer_id]; + if (count != kMustKeep) { + --count; + } + + if (count == 0) { + DeleteVariable(initializer_id); + } + } + } + context()->KillDef(result_id); +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.h new file mode 100644 index 00000000000..40a7bc02563 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dead_variable_elimination.h @@ -0,0 +1,55 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_DEAD_VARIABLE_ELIMINATION_H_ +#define SOURCE_OPT_DEAD_VARIABLE_ELIMINATION_H_ + +#include +#include + +#include "source/opt/decoration_manager.h" +#include "source/opt/mem_pass.h" + +namespace spvtools { +namespace opt { + +class DeadVariableElimination : public MemPass { + public: + const char* name() const override { return "eliminate-dead-variables"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse; + } + + private: + // Deletes the OpVariable instruction who result id is |result_id|. + void DeleteVariable(uint32_t result_id); + + // Keeps track of the number of references of an id. Once that value is 0, it + // is safe to remove the corresponding instruction. + // + // Note that the special value kMustKeep is used to indicate that the + // instruction cannot be deleted for reasons other that is being explicitly + // referenced. + std::unordered_map reference_count_; + + // Special value used to indicate that an id cannot be safely deleted. + enum { kMustKeep = INT_MAX }; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DEAD_VARIABLE_ELIMINATION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp new file mode 100644 index 00000000000..82aa495c9e9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.cpp @@ -0,0 +1,479 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/decoration_manager.h" + +#include +#include +#include +#include +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace analysis { + +void DecorationManager::RemoveDecorationsFrom( + uint32_t id, std::function pred) { + const auto ids_iter = id_to_decoration_insts_.find(id); + if (ids_iter == id_to_decoration_insts_.end()) return; + + TargetData& decorations_info = ids_iter->second; + auto context = module_->context(); + std::vector insts_to_kill; + const bool is_group = !decorations_info.decorate_insts.empty(); + + // Schedule all direct decorations for removal if instructed as such by + // |pred|. + for (Instruction* inst : decorations_info.direct_decorations) + if (pred(*inst)) insts_to_kill.push_back(inst); + + // For all groups being directly applied to |id|, remove |id| (and the + // literal if |inst| is an OpGroupMemberDecorate) from the instruction + // applying the group. + std::unordered_set indirect_decorations_to_remove; + for (Instruction* inst : decorations_info.indirect_decorations) { + assert(inst->opcode() == SpvOpGroupDecorate || + inst->opcode() == SpvOpGroupMemberDecorate); + + std::vector group_decorations_to_keep; + const uint32_t group_id = inst->GetSingleWordInOperand(0u); + const auto group_iter = id_to_decoration_insts_.find(group_id); + assert(group_iter != id_to_decoration_insts_.end() && + "Unknown decoration group"); + const auto& group_decorations = group_iter->second.direct_decorations; + for (Instruction* decoration : group_decorations) { + if (!pred(*decoration)) group_decorations_to_keep.push_back(decoration); + } + + // If all decorations should be kept, move to the next group + if (group_decorations_to_keep.size() == group_decorations.size()) continue; + + // Otherwise, remove |id| from the targets of |group_id| + const uint32_t stride = inst->opcode() == SpvOpGroupDecorate ? 1u : 2u; + bool was_modified = false; + for (uint32_t i = 1u; i < inst->NumInOperands();) { + if (inst->GetSingleWordInOperand(i) != id) { + i += stride; + continue; + } + + const uint32_t last_operand_index = inst->NumInOperands() - stride; + if (i < last_operand_index) + inst->GetInOperand(i) = inst->GetInOperand(last_operand_index); + // Remove the associated literal, if it exists. + if (stride == 2u) { + if (i < last_operand_index) + inst->GetInOperand(i + 1u) = + inst->GetInOperand(last_operand_index + 1u); + inst->RemoveInOperand(last_operand_index + 1u); + } + inst->RemoveInOperand(last_operand_index); + was_modified = true; + } + + // If the instruction has no targets left, remove the instruction + // altogether. + if (inst->NumInOperands() == 1u) { + indirect_decorations_to_remove.emplace(inst); + insts_to_kill.push_back(inst); + } else if (was_modified) { + context->ForgetUses(inst); + indirect_decorations_to_remove.emplace(inst); + context->AnalyzeUses(inst); + } + + // If only some of the decorations should be kept, clone them and apply + // them directly to |id|. + if (!group_decorations_to_keep.empty()) { + for (Instruction* decoration : group_decorations_to_keep) { + // simply clone decoration and change |group_id| to |id| + std::unique_ptr new_inst( + decoration->Clone(module_->context())); + new_inst->SetInOperand(0, {id}); + module_->AddAnnotationInst(std::move(new_inst)); + auto decoration_iter = --module_->annotation_end(); + context->AnalyzeUses(&*decoration_iter); + } + } + } + + auto& indirect_decorations = decorations_info.indirect_decorations; + indirect_decorations.erase( + std::remove_if( + indirect_decorations.begin(), indirect_decorations.end(), + [&indirect_decorations_to_remove](const Instruction* inst) { + return indirect_decorations_to_remove.count(inst); + }), + indirect_decorations.end()); + + for (Instruction* inst : insts_to_kill) context->KillInst(inst); + insts_to_kill.clear(); + + // Schedule all instructions applying the group for removal if this group no + // longer applies decorations, either directly or indirectly. + if (is_group && decorations_info.direct_decorations.empty() && + decorations_info.indirect_decorations.empty()) { + for (Instruction* inst : decorations_info.decorate_insts) + insts_to_kill.push_back(inst); + } + for (Instruction* inst : insts_to_kill) context->KillInst(inst); + + if (decorations_info.direct_decorations.empty() && + decorations_info.indirect_decorations.empty() && + decorations_info.decorate_insts.empty()) { + id_to_decoration_insts_.erase(ids_iter); + + // Remove the OpDecorationGroup defining this group. + if (is_group) context->KillInst(context->get_def_use_mgr()->GetDef(id)); + } +} + +std::vector DecorationManager::GetDecorationsFor( + uint32_t id, bool include_linkage) { + return InternalGetDecorationsFor(id, include_linkage); +} + +std::vector DecorationManager::GetDecorationsFor( + uint32_t id, bool include_linkage) const { + return const_cast(this) + ->InternalGetDecorationsFor(id, include_linkage); +} + +bool DecorationManager::HaveTheSameDecorations(uint32_t id1, + uint32_t id2) const { + using InstructionList = std::vector; + using DecorationSet = std::set; + + const InstructionList decorations_for1 = GetDecorationsFor(id1, false); + const InstructionList decorations_for2 = GetDecorationsFor(id2, false); + + // This function splits the decoration instructions into different sets, + // based on their opcode; only OpDecorate, OpDecorateId, + // OpDecorateStringGOOGLE, and OpMemberDecorate are considered, the other + // opcodes are ignored. + const auto fillDecorationSets = + [](const InstructionList& decoration_list, DecorationSet* decorate_set, + DecorationSet* decorate_id_set, DecorationSet* decorate_string_set, + DecorationSet* member_decorate_set) { + for (const Instruction* inst : decoration_list) { + std::u32string decoration_payload; + // Ignore the opcode and the target as we do not want them to be + // compared. + for (uint32_t i = 1u; i < inst->NumInOperands(); ++i) { + for (uint32_t word : inst->GetInOperand(i).words) { + decoration_payload.push_back(word); + } + } + + switch (inst->opcode()) { + case SpvOpDecorate: + decorate_set->emplace(std::move(decoration_payload)); + break; + case SpvOpMemberDecorate: + member_decorate_set->emplace(std::move(decoration_payload)); + break; + case SpvOpDecorateId: + decorate_id_set->emplace(std::move(decoration_payload)); + break; + case SpvOpDecorateStringGOOGLE: + decorate_string_set->emplace(std::move(decoration_payload)); + break; + default: + break; + } + } + }; + + DecorationSet decorate_set_for1; + DecorationSet decorate_id_set_for1; + DecorationSet decorate_string_set_for1; + DecorationSet member_decorate_set_for1; + fillDecorationSets(decorations_for1, &decorate_set_for1, + &decorate_id_set_for1, &decorate_string_set_for1, + &member_decorate_set_for1); + + DecorationSet decorate_set_for2; + DecorationSet decorate_id_set_for2; + DecorationSet decorate_string_set_for2; + DecorationSet member_decorate_set_for2; + fillDecorationSets(decorations_for2, &decorate_set_for2, + &decorate_id_set_for2, &decorate_string_set_for2, + &member_decorate_set_for2); + + const bool result = decorate_set_for1 == decorate_set_for2 && + decorate_id_set_for1 == decorate_id_set_for2 && + member_decorate_set_for1 == member_decorate_set_for2 && + // Compare string sets last in case the strings are long. + decorate_string_set_for1 == decorate_string_set_for2; + return result; +} + +// TODO(pierremoreau): If OpDecorateId is referencing an OpConstant, one could +// check that the constants are the same rather than just +// looking at the constant ID. +bool DecorationManager::AreDecorationsTheSame(const Instruction* inst1, + const Instruction* inst2, + bool ignore_target) const { + switch (inst1->opcode()) { + case SpvOpDecorate: + case SpvOpMemberDecorate: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + break; + default: + return false; + } + + if (inst1->opcode() != inst2->opcode() || + inst1->NumInOperands() != inst2->NumInOperands()) + return false; + + for (uint32_t i = ignore_target ? 1u : 0u; i < inst1->NumInOperands(); ++i) + if (inst1->GetInOperand(i) != inst2->GetInOperand(i)) return false; + + return true; +} + +void DecorationManager::AnalyzeDecorations() { + if (!module_) return; + + // For each group and instruction, collect all their decoration instructions. + for (Instruction& inst : module_->annotations()) { + AddDecoration(&inst); + } +} +void DecorationManager::AddDecoration(Instruction* inst) { + switch (inst->opcode()) { + case SpvOpDecorate: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + case SpvOpMemberDecorate: { + const auto target_id = inst->GetSingleWordInOperand(0u); + id_to_decoration_insts_[target_id].direct_decorations.push_back(inst); + break; + } + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: { + const uint32_t start = inst->opcode() == SpvOpGroupDecorate ? 1u : 2u; + const uint32_t stride = start; + for (uint32_t i = start; i < inst->NumInOperands(); i += stride) { + const auto target_id = inst->GetSingleWordInOperand(i); + TargetData& target_data = id_to_decoration_insts_[target_id]; + target_data.indirect_decorations.push_back(inst); + } + const auto target_id = inst->GetSingleWordInOperand(0u); + id_to_decoration_insts_[target_id].decorate_insts.push_back(inst); + break; + } + default: + break; + } +} + +template +std::vector DecorationManager::InternalGetDecorationsFor( + uint32_t id, bool include_linkage) { + std::vector decorations; + + const auto ids_iter = id_to_decoration_insts_.find(id); + // |id| has no decorations + if (ids_iter == id_to_decoration_insts_.end()) return decorations; + + const TargetData& target_data = ids_iter->second; + + const auto process_direct_decorations = + [include_linkage, + &decorations](const std::vector& direct_decorations) { + for (Instruction* inst : direct_decorations) { + const bool is_linkage = inst->opcode() == SpvOpDecorate && + inst->GetSingleWordInOperand(1u) == + SpvDecorationLinkageAttributes; + if (include_linkage || !is_linkage) decorations.push_back(inst); + } + }; + + // Process |id|'s decorations. + process_direct_decorations(ids_iter->second.direct_decorations); + + // Process the decorations of all groups applied to |id|. + for (const Instruction* inst : target_data.indirect_decorations) { + const uint32_t group_id = inst->GetSingleWordInOperand(0u); + const auto group_iter = id_to_decoration_insts_.find(group_id); + assert(group_iter != id_to_decoration_insts_.end() && "Unknown group ID"); + process_direct_decorations(group_iter->second.direct_decorations); + } + + return decorations; +} + +bool DecorationManager::WhileEachDecoration( + uint32_t id, uint32_t decoration, + std::function f) { + for (const Instruction* inst : GetDecorationsFor(id, true)) { + switch (inst->opcode()) { + case SpvOpMemberDecorate: + if (inst->GetSingleWordInOperand(2) == decoration) { + if (!f(*inst)) return false; + } + break; + case SpvOpDecorate: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + if (inst->GetSingleWordInOperand(1) == decoration) { + if (!f(*inst)) return false; + } + break; + default: + assert(false && "Unexpected decoration instruction"); + } + } + return true; +} + +void DecorationManager::ForEachDecoration( + uint32_t id, uint32_t decoration, + std::function f) { + WhileEachDecoration(id, decoration, [&f](const Instruction& inst) { + f(inst); + return true; + }); +} + +void DecorationManager::CloneDecorations(uint32_t from, uint32_t to) { + const auto decoration_list = id_to_decoration_insts_.find(from); + if (decoration_list == id_to_decoration_insts_.end()) return; + auto context = module_->context(); + for (Instruction* inst : decoration_list->second.direct_decorations) { + // simply clone decoration and change |target-id| to |to| + std::unique_ptr new_inst(inst->Clone(module_->context())); + new_inst->SetInOperand(0, {to}); + module_->AddAnnotationInst(std::move(new_inst)); + auto decoration_iter = --module_->annotation_end(); + context->AnalyzeUses(&*decoration_iter); + } + // We need to copy the list of instructions as ForgetUses and AnalyzeUses are + // going to modify it. + std::vector indirect_decorations = + decoration_list->second.indirect_decorations; + for (Instruction* inst : indirect_decorations) { + switch (inst->opcode()) { + case SpvOpGroupDecorate: + context->ForgetUses(inst); + // add |to| to list of decorated id's + inst->AddOperand( + Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, {to})); + context->AnalyzeUses(inst); + break; + case SpvOpGroupMemberDecorate: { + context->ForgetUses(inst); + // for each (id == from), add (to, literal) as operands + const uint32_t num_operands = inst->NumOperands(); + for (uint32_t i = 1; i < num_operands; i += 2) { + Operand op = inst->GetOperand(i); + if (op.words[0] == from) { // add new pair of operands: (to, literal) + inst->AddOperand( + Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, {to})); + op = inst->GetOperand(i + 1); + inst->AddOperand(std::move(op)); + } + } + context->AnalyzeUses(inst); + break; + } + default: + assert(false && "Unexpected decoration instruction"); + } + } +} + +void DecorationManager::CloneDecorations( + uint32_t from, uint32_t to, + const std::vector& decorations_to_copy) { + const auto decoration_list = id_to_decoration_insts_.find(from); + if (decoration_list == id_to_decoration_insts_.end()) return; + auto context = module_->context(); + for (Instruction* inst : decoration_list->second.direct_decorations) { + if (std::find(decorations_to_copy.begin(), decorations_to_copy.end(), + inst->GetSingleWordInOperand(1)) == + decorations_to_copy.end()) { + continue; + } + + // Clone decoration and change |target-id| to |to|. + std::unique_ptr new_inst(inst->Clone(module_->context())); + new_inst->SetInOperand(0, {to}); + module_->AddAnnotationInst(std::move(new_inst)); + auto decoration_iter = --module_->annotation_end(); + context->AnalyzeUses(&*decoration_iter); + } + + // We need to copy the list of instructions as ForgetUses and AnalyzeUses are + // going to modify it. + std::vector indirect_decorations = + decoration_list->second.indirect_decorations; + for (Instruction* inst : indirect_decorations) { + switch (inst->opcode()) { + case SpvOpGroupDecorate: + CloneDecorations(inst->GetSingleWordInOperand(0), to, + decorations_to_copy); + break; + case SpvOpGroupMemberDecorate: { + assert(false && "The source id is not suppose to be a type."); + break; + } + default: + assert(false && "Unexpected decoration instruction"); + } + } +} + +void DecorationManager::RemoveDecoration(Instruction* inst) { + const auto remove_from_container = [inst](std::vector& v) { + v.erase(std::remove(v.begin(), v.end(), inst), v.end()); + }; + + switch (inst->opcode()) { + case SpvOpDecorate: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + case SpvOpMemberDecorate: { + const auto target_id = inst->GetSingleWordInOperand(0u); + auto const iter = id_to_decoration_insts_.find(target_id); + if (iter == id_to_decoration_insts_.end()) return; + remove_from_container(iter->second.direct_decorations); + } break; + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: { + const uint32_t stride = inst->opcode() == SpvOpGroupDecorate ? 1u : 2u; + for (uint32_t i = 1u; i < inst->NumInOperands(); i += stride) { + const auto target_id = inst->GetSingleWordInOperand(i); + auto const iter = id_to_decoration_insts_.find(target_id); + if (iter == id_to_decoration_insts_.end()) continue; + remove_from_container(iter->second.indirect_decorations); + } + const auto group_id = inst->GetSingleWordInOperand(0u); + auto const iter = id_to_decoration_insts_.find(group_id); + if (iter == id_to_decoration_insts_.end()) return; + remove_from_container(iter->second.decorate_insts); + } break; + default: + break; + } +} +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h new file mode 100644 index 00000000000..a517ba2d8cb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/decoration_manager.h @@ -0,0 +1,142 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_DECORATION_MANAGER_H_ +#define SOURCE_OPT_DECORATION_MANAGER_H_ + +#include +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { +namespace analysis { + +// A class for analyzing and managing decorations in an Module. +class DecorationManager { + public: + // Constructs a decoration manager from the given |module| + explicit DecorationManager(Module* module) : module_(module) { + AnalyzeDecorations(); + } + DecorationManager() = delete; + + // Removes all decorations from |id| (either directly or indirectly) for + // which |pred| returns true. + // If |id| is a group ID, OpGroupDecorate and OpGroupMemberDecorate will be + // removed if they have no targets left, and OpDecorationGroup will be + // removed if the group is not applied to anyone and contains no decorations. + void RemoveDecorationsFrom(uint32_t id, + std::function pred = + [](const Instruction&) { return true; }); + + // Removes all decorations from the result id of |inst|. + // + // NOTE: This is only meant to be called from ir_context, as only metadata + // will be removed, and no actual instruction. + void RemoveDecoration(Instruction* inst); + + // Returns a vector of all decorations affecting |id|. If a group is applied + // to |id|, the decorations of that group are returned rather than the group + // decoration instruction. If |include_linkage| is not set, linkage + // decorations won't be returned. + std::vector GetDecorationsFor(uint32_t id, + bool include_linkage); + std::vector GetDecorationsFor(uint32_t id, + bool include_linkage) const; + // Returns whether two IDs have the same decorations. Two SpvOpGroupDecorate + // instructions that apply the same decorations but to different IDs, still + // count as being the same. + bool HaveTheSameDecorations(uint32_t id1, uint32_t id2) const; + // Returns whether the two decorations instructions are the same and are + // applying the same decorations; unless |ignore_target| is false, the targets + // to which they are applied to does not matter, except for the member part. + // + // This is only valid for OpDecorate, OpMemberDecorate and OpDecorateId; it + // will return false for other opcodes. + bool AreDecorationsTheSame(const Instruction* inst1, const Instruction* inst2, + bool ignore_target) const; + + // |f| is run on each decoration instruction for |id| with decoration + // |decoration|. Processed are all decorations which target |id| either + // directly or indirectly by Decoration Groups. + void ForEachDecoration(uint32_t id, uint32_t decoration, + std::function f); + + // |f| is run on each decoration instruction for |id| with decoration + // |decoration|. Processes all decoration which target |id| either directly or + // indirectly through decoration groups. If |f| returns false, iteration is + // terminated and this function returns false. + bool WhileEachDecoration(uint32_t id, uint32_t decoration, + std::function f); + + // Clone all decorations from one id |from|. + // The cloned decorations are assigned to the given id |to| and are + // added to the module. The purpose is to decorate cloned instructions. + // This function does not check if the id |to| is already decorated. + void CloneDecorations(uint32_t from, uint32_t to); + + // Same as above, but only clone the decoration if the decoration operand is + // in |decorations_to_copy|. This function has the extra restriction that + // |from| and |to| must not be an object, not a type. + void CloneDecorations(uint32_t from, uint32_t to, + const std::vector& decorations_to_copy); + + // Informs the decoration manager of a new decoration that it needs to track. + void AddDecoration(Instruction* inst); + + private: + // Analyzes the defs and uses in the given |module| and populates data + // structures in this class. Does nothing if |module| is nullptr. + void AnalyzeDecorations(); + + template + std::vector InternalGetDecorationsFor(uint32_t id, bool include_linkage); + + // Tracks decoration information of an ID. + struct TargetData { + std::vector direct_decorations; // All decorate + // instructions applied + // to the tracked ID. + std::vector indirect_decorations; // All instructions + // applying a group to + // the tracked ID. + std::vector decorate_insts; // All decorate instructions + // applying the decorations + // of the tracked ID to + // targets. + // It is empty if the + // tracked ID is not a + // group. + }; + + // Mapping from ids to the instructions applying a decoration to those ids. + // In other words, for each id you get all decoration instructions + // referencing that id, be it directly (SpvOpDecorate, SpvOpMemberDecorate + // and SpvOpDecorateId), or indirectly (SpvOpGroupDecorate, + // SpvOpMemberGroupDecorate). + std::unordered_map id_to_decoration_insts_; + // The enclosing module. + Module* module_; +}; + +} // namespace analysis +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DECORATION_MANAGER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/def_use_manager.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/def_use_manager.cpp new file mode 100644 index 00000000000..4e364938251 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/def_use_manager.cpp @@ -0,0 +1,289 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/def_use_manager.h" + +#include + +#include "source/opt/log.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { +namespace analysis { + +void DefUseManager::AnalyzeInstDef(Instruction* inst) { + const uint32_t def_id = inst->result_id(); + if (def_id != 0) { + auto iter = id_to_def_.find(def_id); + if (iter != id_to_def_.end()) { + // Clear the original instruction that defining the same result id of the + // new instruction. + ClearInst(iter->second); + } + id_to_def_[def_id] = inst; + } else { + ClearInst(inst); + } +} + +void DefUseManager::AnalyzeInstUse(Instruction* inst) { + // Create entry for the given instruction. Note that the instruction may + // not have any in-operands. In such cases, we still need a entry for those + // instructions so this manager knows it has seen the instruction later. + auto* used_ids = &inst_to_used_ids_[inst]; + if (used_ids->size()) { + EraseUseRecordsOfOperandIds(inst); + used_ids = &inst_to_used_ids_[inst]; + } + used_ids->clear(); // It might have existed before. + + for (uint32_t i = 0; i < inst->NumOperands(); ++i) { + switch (inst->GetOperand(i).type) { + // For any id type but result id type + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: { + uint32_t use_id = inst->GetSingleWordOperand(i); + Instruction* def = GetDef(use_id); + assert(def && "Definition is not registered."); + id_to_users_.insert(UserEntry(def, inst)); + used_ids->push_back(use_id); + } break; + default: + break; + } + } +} + +void DefUseManager::AnalyzeInstDefUse(Instruction* inst) { + AnalyzeInstDef(inst); + AnalyzeInstUse(inst); +} + +void DefUseManager::UpdateDefUse(Instruction* inst) { + const uint32_t def_id = inst->result_id(); + if (def_id != 0) { + auto iter = id_to_def_.find(def_id); + if (iter == id_to_def_.end()) { + AnalyzeInstDef(inst); + } + } + AnalyzeInstUse(inst); +} + +Instruction* DefUseManager::GetDef(uint32_t id) { + auto iter = id_to_def_.find(id); + if (iter == id_to_def_.end()) return nullptr; + return iter->second; +} + +const Instruction* DefUseManager::GetDef(uint32_t id) const { + const auto iter = id_to_def_.find(id); + if (iter == id_to_def_.end()) return nullptr; + return iter->second; +} + +DefUseManager::IdToUsersMap::const_iterator DefUseManager::UsersBegin( + const Instruction* def) const { + return id_to_users_.lower_bound( + UserEntry(const_cast(def), nullptr)); +} + +bool DefUseManager::UsersNotEnd(const IdToUsersMap::const_iterator& iter, + const IdToUsersMap::const_iterator& cached_end, + const Instruction* inst) const { + return (iter != cached_end && iter->first == inst); +} + +bool DefUseManager::UsersNotEnd(const IdToUsersMap::const_iterator& iter, + const Instruction* inst) const { + return UsersNotEnd(iter, id_to_users_.end(), inst); +} + +bool DefUseManager::WhileEachUser( + const Instruction* def, const std::function& f) const { + // Ensure that |def| has been registered. + assert(def && (!def->HasResultId() || def == GetDef(def->result_id())) && + "Definition is not registered."); + if (!def->HasResultId()) return true; + + auto end = id_to_users_.end(); + for (auto iter = UsersBegin(def); UsersNotEnd(iter, end, def); ++iter) { + if (!f(iter->second)) return false; + } + return true; +} + +bool DefUseManager::WhileEachUser( + uint32_t id, const std::function& f) const { + return WhileEachUser(GetDef(id), f); +} + +void DefUseManager::ForEachUser( + const Instruction* def, const std::function& f) const { + WhileEachUser(def, [&f](Instruction* user) { + f(user); + return true; + }); +} + +void DefUseManager::ForEachUser( + uint32_t id, const std::function& f) const { + ForEachUser(GetDef(id), f); +} + +bool DefUseManager::WhileEachUse( + const Instruction* def, + const std::function& f) const { + // Ensure that |def| has been registered. + assert(def && (!def->HasResultId() || def == GetDef(def->result_id())) && + "Definition is not registered."); + if (!def->HasResultId()) return true; + + auto end = id_to_users_.end(); + for (auto iter = UsersBegin(def); UsersNotEnd(iter, end, def); ++iter) { + Instruction* user = iter->second; + for (uint32_t idx = 0; idx != user->NumOperands(); ++idx) { + const Operand& op = user->GetOperand(idx); + if (op.type != SPV_OPERAND_TYPE_RESULT_ID && spvIsIdType(op.type)) { + if (def->result_id() == op.words[0]) { + if (!f(user, idx)) return false; + } + } + } + } + return true; +} + +bool DefUseManager::WhileEachUse( + uint32_t id, const std::function& f) const { + return WhileEachUse(GetDef(id), f); +} + +void DefUseManager::ForEachUse( + const Instruction* def, + const std::function& f) const { + WhileEachUse(def, [&f](Instruction* user, uint32_t index) { + f(user, index); + return true; + }); +} + +void DefUseManager::ForEachUse( + uint32_t id, const std::function& f) const { + ForEachUse(GetDef(id), f); +} + +uint32_t DefUseManager::NumUsers(const Instruction* def) const { + uint32_t count = 0; + ForEachUser(def, [&count](Instruction*) { ++count; }); + return count; +} + +uint32_t DefUseManager::NumUsers(uint32_t id) const { + return NumUsers(GetDef(id)); +} + +uint32_t DefUseManager::NumUses(const Instruction* def) const { + uint32_t count = 0; + ForEachUse(def, [&count](Instruction*, uint32_t) { ++count; }); + return count; +} + +uint32_t DefUseManager::NumUses(uint32_t id) const { + return NumUses(GetDef(id)); +} + +std::vector DefUseManager::GetAnnotations(uint32_t id) const { + std::vector annos; + const Instruction* def = GetDef(id); + if (!def) return annos; + + ForEachUser(def, [&annos](Instruction* user) { + if (IsAnnotationInst(user->opcode())) { + annos.push_back(user); + } + }); + return annos; +} + +void DefUseManager::AnalyzeDefUse(Module* module) { + if (!module) return; + // Analyze all the defs before any uses to catch forward references. + module->ForEachInst( + std::bind(&DefUseManager::AnalyzeInstDef, this, std::placeholders::_1)); + module->ForEachInst( + std::bind(&DefUseManager::AnalyzeInstUse, this, std::placeholders::_1)); +} + +void DefUseManager::ClearInst(Instruction* inst) { + auto iter = inst_to_used_ids_.find(inst); + if (iter != inst_to_used_ids_.end()) { + EraseUseRecordsOfOperandIds(inst); + if (inst->result_id() != 0) { + // Remove all uses of this inst. + auto users_begin = UsersBegin(inst); + auto end = id_to_users_.end(); + auto new_end = users_begin; + for (; UsersNotEnd(new_end, end, inst); ++new_end) { + } + id_to_users_.erase(users_begin, new_end); + id_to_def_.erase(inst->result_id()); + } + } +} + +void DefUseManager::EraseUseRecordsOfOperandIds(const Instruction* inst) { + // Go through all ids used by this instruction, remove this instruction's + // uses of them. + auto iter = inst_to_used_ids_.find(inst); + if (iter != inst_to_used_ids_.end()) { + for (auto use_id : iter->second) { + id_to_users_.erase( + UserEntry(GetDef(use_id), const_cast(inst))); + } + inst_to_used_ids_.erase(inst); + } +} + +bool operator==(const DefUseManager& lhs, const DefUseManager& rhs) { + if (lhs.id_to_def_ != rhs.id_to_def_) { + return false; + } + + if (lhs.id_to_users_ != rhs.id_to_users_) { + for (auto p : lhs.id_to_users_) { + if (rhs.id_to_users_.count(p) == 0) { + return false; + } + } + for (auto p : rhs.id_to_users_) { + if (lhs.id_to_users_.count(p) == 0) { + return false; + } + } + return false; + } + + if (lhs.inst_to_used_ids_ != lhs.inst_to_used_ids_) { + return false; + } + return true; +} + +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/def_use_manager.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/def_use_manager.h new file mode 100644 index 00000000000..0499e82b545 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/def_use_manager.h @@ -0,0 +1,256 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_DEF_USE_MANAGER_H_ +#define SOURCE_OPT_DEF_USE_MANAGER_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace opt { +namespace analysis { + +// Class for representing a use of id. Note that: +// * Result type id is a use. +// * Ids referenced in OpSectionMerge & OpLoopMerge are considered as use. +// * Ids referenced in OpPhi's in operands are considered as use. +struct Use { + Instruction* inst; // Instruction using the id. + uint32_t operand_index; // logical operand index of the id use. This can be + // the index of result type id. +}; + +inline bool operator==(const Use& lhs, const Use& rhs) { + return lhs.inst == rhs.inst && lhs.operand_index == rhs.operand_index; +} + +inline bool operator!=(const Use& lhs, const Use& rhs) { return !(lhs == rhs); } + +inline bool operator<(const Use& lhs, const Use& rhs) { + if (lhs.inst < rhs.inst) return true; + if (lhs.inst > rhs.inst) return false; + return lhs.operand_index < rhs.operand_index; +} + +// Definition and user pair. +// +// The first element of the pair is the definition. +// The second element of the pair is the user. +// +// Definition should never be null. User can be null, however, such an entry +// should be used only for searching (e.g. all users of a particular definition) +// and never stored in a container. +using UserEntry = std::pair; + +// Orders UserEntry for use in associative containers (i.e. less than ordering). +// +// The definition of an UserEntry is treated as the major key and the users as +// the minor key so that all the users of a particular definition are +// consecutive in a container. +// +// A null user always compares less than a real user. This is done to provide +// easy values to search for the beginning of the users of a particular +// definition (i.e. using {def, nullptr}). +struct UserEntryLess { + bool operator()(const UserEntry& lhs, const UserEntry& rhs) const { + // If lhs.first and rhs.first are both null, fall through to checking the + // second entries. + if (!lhs.first && rhs.first) return true; + if (lhs.first && !rhs.first) return false; + + // If neither definition is null, then compare unique ids. + if (lhs.first && rhs.first) { + if (lhs.first->unique_id() < rhs.first->unique_id()) return true; + if (rhs.first->unique_id() < lhs.first->unique_id()) return false; + } + + // Return false on equality. + if (!lhs.second && !rhs.second) return false; + if (!lhs.second) return true; + if (!rhs.second) return false; + + // If neither user is null then compare unique ids. + return lhs.second->unique_id() < rhs.second->unique_id(); + } +}; + +// A class for analyzing and managing defs and uses in an Module. +class DefUseManager { + public: + using IdToDefMap = std::unordered_map; + using IdToUsersMap = std::set; + + // Constructs a def-use manager from the given |module|. All internal messages + // will be communicated to the outside via the given message |consumer|. This + // instance only keeps a reference to the |consumer|, so the |consumer| should + // outlive this instance. + DefUseManager(Module* module) { AnalyzeDefUse(module); } + + DefUseManager(const DefUseManager&) = delete; + DefUseManager(DefUseManager&&) = delete; + DefUseManager& operator=(const DefUseManager&) = delete; + DefUseManager& operator=(DefUseManager&&) = delete; + + // Analyzes the defs in the given |inst|. + void AnalyzeInstDef(Instruction* inst); + + // Analyzes the uses in the given |inst|. + // + // All operands of |inst| must be analyzed as defs. + void AnalyzeInstUse(Instruction* inst); + + // Analyzes the defs and uses in the given |inst|. + void AnalyzeInstDefUse(Instruction* inst); + + // Returns the def instruction for the given |id|. If there is no instruction + // defining |id|, returns nullptr. + Instruction* GetDef(uint32_t id); + const Instruction* GetDef(uint32_t id) const; + + // Runs the given function |f| on each unique user instruction of |def| (or + // |id|). + // + // If one instruction uses |def| in multiple operands, that instruction will + // only be visited once. + // + // |def| (or |id|) must be registered as a definition. + void ForEachUser(const Instruction* def, + const std::function& f) const; + void ForEachUser(uint32_t id, + const std::function& f) const; + + // Runs the given function |f| on each unique user instruction of |def| (or + // |id|). If |f| returns false, iteration is terminated and this function + // returns false. + // + // If one instruction uses |def| in multiple operands, that instruction will + // be only be visited once. + // + // |def| (or |id|) must be registered as a definition. + bool WhileEachUser(const Instruction* def, + const std::function& f) const; + bool WhileEachUser(uint32_t id, + const std::function& f) const; + + // Runs the given function |f| on each unique use of |def| (or + // |id|). + // + // If one instruction uses |def| in multiple operands, each operand will be + // visited separately. + // + // |def| (or |id|) must be registered as a definition. + void ForEachUse( + const Instruction* def, + const std::function& f) const; + void ForEachUse( + uint32_t id, + const std::function& f) const; + + // Runs the given function |f| on each unique use of |def| (or + // |id|). If |f| returns false, iteration is terminated and this function + // returns false. + // + // If one instruction uses |def| in multiple operands, each operand will be + // visited separately. + // + // |def| (or |id|) must be registered as a definition. + bool WhileEachUse( + const Instruction* def, + const std::function& f) const; + bool WhileEachUse( + uint32_t id, + const std::function& f) const; + + // Returns the number of users of |def| (or |id|). + uint32_t NumUsers(const Instruction* def) const; + uint32_t NumUsers(uint32_t id) const; + + // Returns the number of uses of |def| (or |id|). + uint32_t NumUses(const Instruction* def) const; + uint32_t NumUses(uint32_t id) const; + + // Returns the annotation instrunctions which are a direct use of the given + // |id|. This means when the decorations are applied through decoration + // group(s), this function will just return the OpGroupDecorate + // instrcution(s) which refer to the given id as an operand. The OpDecorate + // instructions which decorate the decoration group will not be returned. + std::vector GetAnnotations(uint32_t id) const; + + // Returns the map from ids to their def instructions. + const IdToDefMap& id_to_defs() const { return id_to_def_; } + // Returns the map from instructions to their users. + const IdToUsersMap& id_to_users() const { return id_to_users_; } + + // Clear the internal def-use record of the given instruction |inst|. This + // method will update the use information of the operand ids of |inst|. The + // record: |inst| uses an |id|, will be removed from the use records of |id|. + // If |inst| defines an result id, the use record of this result id will also + // be removed. Does nothing if |inst| was not analyzed before. + void ClearInst(Instruction* inst); + + // Erases the records that a given instruction uses its operand ids. + void EraseUseRecordsOfOperandIds(const Instruction* inst); + + friend bool operator==(const DefUseManager&, const DefUseManager&); + friend bool operator!=(const DefUseManager& lhs, const DefUseManager& rhs) { + return !(lhs == rhs); + } + + // If |inst| has not already been analysed, then analyses its defintion and + // uses. + void UpdateDefUse(Instruction* inst); + + private: + using InstToUsedIdsMap = + std::unordered_map>; + + // Returns the first location that {|def|, nullptr} could be inserted into the + // users map without violating ordering. + IdToUsersMap::const_iterator UsersBegin(const Instruction* def) const; + + // Returns true if |iter| has not reached the end of |def|'s users. + // + // In the first version |iter| is compared against the end of the map for + // validity before other checks. In the second version, |iter| is compared + // against |cached_end| for validity before other checks. This allows caching + // the map's end which is a performance improvement on some platforms. + bool UsersNotEnd(const IdToUsersMap::const_iterator& iter, + const Instruction* def) const; + bool UsersNotEnd(const IdToUsersMap::const_iterator& iter, + const IdToUsersMap::const_iterator& cached_end, + const Instruction* def) const; + + // Analyzes the defs and uses in the given |module| and populates data + // structures in this class. Does nothing if |module| is nullptr. + void AnalyzeDefUse(Module* module); + + IdToDefMap id_to_def_; // Mapping from ids to their definitions + IdToUsersMap id_to_users_; // Mapping from ids to their users + // Mapping from instructions to the ids used in the instruction. + InstToUsedIdsMap inst_to_used_ids_; +}; + +} // namespace analysis +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DEF_USE_MANAGER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp new file mode 100644 index 00000000000..aef43e69faf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.cpp @@ -0,0 +1,68 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/dominator_analysis.h" + +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +BasicBlock* DominatorAnalysisBase::CommonDominator(BasicBlock* b1, + BasicBlock* b2) const { + if (!b1 || !b2) return nullptr; + + std::unordered_set seen; + BasicBlock* block = b1; + while (block && seen.insert(block).second) { + block = ImmediateDominator(block); + } + + block = b2; + while (block && !seen.count(block)) { + block = ImmediateDominator(block); + } + + return block; +} + +bool DominatorAnalysisBase::Dominates(Instruction* a, Instruction* b) const { + if (!a || !b) { + return false; + } + + if (a == b) { + return true; + } + + BasicBlock* bb_a = a->context()->get_instr_block(a); + BasicBlock* bb_b = b->context()->get_instr_block(b); + + if (bb_a != bb_b) { + return tree_.Dominates(bb_a, bb_b); + } + + Instruction* current_inst = a; + while ((current_inst = current_inst->NextNode())) { + if (current_inst == b) { + return true; + } + } + return false; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.h new file mode 100644 index 00000000000..a94120a55f9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_analysis.h @@ -0,0 +1,138 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_DOMINATOR_ANALYSIS_H_ +#define SOURCE_OPT_DOMINATOR_ANALYSIS_H_ + +#include +#include + +#include "source/opt/dominator_tree.h" + +namespace spvtools { +namespace opt { + +// Interface to perform dominator or postdominator analysis on a given function. +class DominatorAnalysisBase { + public: + explicit DominatorAnalysisBase(bool is_post_dom) : tree_(is_post_dom) {} + + // Calculates the dominator (or postdominator) tree for given function |f|. + inline void InitializeTree(const CFG& cfg, const Function* f) { + tree_.InitializeTree(cfg, f); + } + + // Returns true if BasicBlock |a| dominates BasicBlock |b|. + inline bool Dominates(const BasicBlock* a, const BasicBlock* b) const { + if (!a || !b) return false; + return Dominates(a->id(), b->id()); + } + + // Returns true if BasicBlock |a| dominates BasicBlock |b|. Same as above only + // using the BasicBlock IDs. + inline bool Dominates(uint32_t a, uint32_t b) const { + return tree_.Dominates(a, b); + } + + // Returns true if instruction |a| dominates instruction |b|. + bool Dominates(Instruction* a, Instruction* b) const; + + // Returns true if BasicBlock |a| strictly dominates BasicBlock |b|. + inline bool StrictlyDominates(const BasicBlock* a, + const BasicBlock* b) const { + if (!a || !b) return false; + return StrictlyDominates(a->id(), b->id()); + } + + // Returns true if BasicBlock |a| strictly dominates BasicBlock |b|. Same as + // above only using the BasicBlock IDs. + inline bool StrictlyDominates(uint32_t a, uint32_t b) const { + return tree_.StrictlyDominates(a, b); + } + + // Returns the immediate dominator of |node| or returns nullptr if it is has + // no dominator. + inline BasicBlock* ImmediateDominator(const BasicBlock* node) const { + if (!node) return nullptr; + return tree_.ImmediateDominator(node); + } + + // Returns the immediate dominator of |node_id| or returns nullptr if it is + // has no dominator. Same as above but operates on IDs. + inline BasicBlock* ImmediateDominator(uint32_t node_id) const { + return tree_.ImmediateDominator(node_id); + } + + // Returns true if |node| is reachable from the entry. + inline bool IsReachable(const BasicBlock* node) const { + if (!node) return false; + return tree_.ReachableFromRoots(node->id()); + } + + // Returns true if |node_id| is reachable from the entry. + inline bool IsReachable(uint32_t node_id) const { + return tree_.ReachableFromRoots(node_id); + } + + // Dump the tree structure into the given |out| stream in the dot format. + inline void DumpAsDot(std::ostream& out) const { tree_.DumpTreeAsDot(out); } + + // Returns true if this is a postdomiator tree. + inline bool IsPostDominator() const { return tree_.IsPostDominator(); } + + // Returns the tree itself for manual operations, such as traversing the + // roots. + // For normal dominance relationships the methods above should be used. + inline DominatorTree& GetDomTree() { return tree_; } + inline const DominatorTree& GetDomTree() const { return tree_; } + + // Force the dominator tree to be removed + inline void ClearTree() { tree_.ClearTree(); } + + // Applies the std::function |func| to dominator tree nodes in dominator + // order. + void Visit(std::function func) { + tree_.Visit(func); + } + + // Applies the std::function |func| to dominator tree nodes in dominator + // order. + void Visit(std::function func) const { + tree_.Visit(func); + } + + // Returns the most immediate basic block that dominates both |b1| and |b2|. + // If there is no such basic block, nullptr is returned. + BasicBlock* CommonDominator(BasicBlock* b1, BasicBlock* b2) const; + + protected: + DominatorTree tree_; +}; + +// Derived class for normal dominator analysis. +class DominatorAnalysis : public DominatorAnalysisBase { + public: + DominatorAnalysis() : DominatorAnalysisBase(false) {} +}; + +// Derived class for postdominator analysis. +class PostDominatorAnalysis : public DominatorAnalysisBase { + public: + PostDominatorAnalysis() : DominatorAnalysisBase(true) {} +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DOMINATOR_ANALYSIS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp new file mode 100644 index 00000000000..c9346e1c53e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.cpp @@ -0,0 +1,394 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "source/cfa.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/ir_context.h" + +// Calculates the dominator or postdominator tree for a given function. +// 1 - Compute the successors and predecessors for each BasicBlock. We add a +// dummy node for the start node or for postdominators the exit. This node will +// point to all entry or all exit nodes. +// 2 - Using the CFA::DepthFirstTraversal get a depth first postordered list of +// all BasicBlocks. Using the successors (or for postdominator, predecessors) +// calculated in step 1 to traverse the tree. +// 3 - Pass the list calculated in step 2 to the CFA::CalculateDominators using +// the predecessors list (or for postdominator, successors). This will give us a +// vector of BB pairs. Each BB and its immediate dominator. +// 4 - Using the list from 3 use those edges to build a tree of +// DominatorTreeNodes. Each node containing a link to the parent dominator and +// children which are dominated. +// 5 - Using the tree from 4, perform a depth first traversal to calculate the +// preorder and postorder index of each node. We use these indexes to compare +// nodes against each other for domination checks. + +namespace spvtools { +namespace opt { +namespace { + +// Wrapper around CFA::DepthFirstTraversal to provide an interface to perform +// depth first search on generic BasicBlock types. Will call post and pre order +// user defined functions during traversal +// +// BBType - BasicBlock type. Will either be BasicBlock or DominatorTreeNode +// SuccessorLambda - Lamdba matching the signature of 'const +// std::vector*(const BBType *A)'. Will return a vector of the nodes +// succeding BasicBlock A. +// PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be +// called on each node traversed AFTER their children. +// PreLambda - Lamdba matching the signature of 'void (const BBType*)' will be +// called on each node traversed BEFORE their children. +template +static void DepthFirstSearch(const BBType* bb, SuccessorLambda successors, + PreLambda pre, PostLambda post) { + // Ignore backedge operation. + auto nop_backedge = [](const BBType*, const BBType*) {}; + CFA::DepthFirstTraversal(bb, successors, pre, post, nop_backedge); +} + +// Wrapper around CFA::DepthFirstTraversal to provide an interface to perform +// depth first search on generic BasicBlock types. This overload is for only +// performing user defined post order. +// +// BBType - BasicBlock type. Will either be BasicBlock or DominatorTreeNode +// SuccessorLambda - Lamdba matching the signature of 'const +// std::vector*(const BBType *A)'. Will return a vector of the nodes +// succeding BasicBlock A. +// PostLambda - Lamdba matching the signature of 'void (const BBType*)' will be +// called on each node traversed after their children. +template +static void DepthFirstSearchPostOrder(const BBType* bb, + SuccessorLambda successors, + PostLambda post) { + // Ignore preorder operation. + auto nop_preorder = [](const BBType*) {}; + DepthFirstSearch(bb, successors, nop_preorder, post); +} + +// Small type trait to get the function class type. +template +struct GetFunctionClass { + using FunctionType = Function; +}; + +// Helper class to compute predecessors and successors for each Basic Block in a +// function. Through GetPredFunctor and GetSuccessorFunctor it provides an +// interface to get the successor and predecessor lists for each basic +// block. This is required by the DepthFirstTraversal and ComputeDominator +// functions which take as parameter an std::function returning the successors +// and predecessors respectively. +// +// When computing the post-dominator tree, all edges are inverted. So successors +// returned by this class will be predecessors in the original CFG. +template +class BasicBlockSuccessorHelper { + // This should eventually become const BasicBlock. + using BasicBlock = BBType; + using Function = typename GetFunctionClass::FunctionType; + + using BasicBlockListTy = std::vector; + using BasicBlockMapTy = std::map; + + public: + // For compliance with the dominance tree computation, entry nodes are + // connected to a single dummy node. + BasicBlockSuccessorHelper(Function& func, const BasicBlock* dummy_start_node, + bool post); + + // CFA::CalculateDominators requires std::vector. + using GetBlocksFunction = + std::function*(const BasicBlock*)>; + + // Returns the list of predecessor functions. + GetBlocksFunction GetPredFunctor() { + return [this](const BasicBlock* bb) { + BasicBlockListTy* v = &this->predecessors_[bb]; + return v; + }; + } + + // Returns a vector of the list of successor nodes from a given node. + GetBlocksFunction GetSuccessorFunctor() { + return [this](const BasicBlock* bb) { + BasicBlockListTy* v = &this->successors_[bb]; + return v; + }; + } + + private: + bool invert_graph_; + BasicBlockMapTy successors_; + BasicBlockMapTy predecessors_; + + // Build the successors and predecessors map for each basic blocks |f|. + // If |invert_graph_| is true, all edges are reversed (successors becomes + // predecessors and vice versa). + // For convenience, the start of the graph is |dummy_start_node|. + // The dominator tree construction requires a unique entry node, which cannot + // be guaranteed for the postdominator graph. The |dummy_start_node| BB is + // here to gather all entry nodes. + void CreateSuccessorMap(Function& f, const BasicBlock* dummy_start_node); +}; + +template +BasicBlockSuccessorHelper::BasicBlockSuccessorHelper( + Function& func, const BasicBlock* dummy_start_node, bool invert) + : invert_graph_(invert) { + CreateSuccessorMap(func, dummy_start_node); +} + +template +void BasicBlockSuccessorHelper::CreateSuccessorMap( + Function& f, const BasicBlock* dummy_start_node) { + std::map id_to_BB_map; + auto GetSuccessorBasicBlock = [&f, &id_to_BB_map](uint32_t successor_id) { + BasicBlock*& Succ = id_to_BB_map[successor_id]; + if (!Succ) { + for (BasicBlock& BBIt : f) { + if (successor_id == BBIt.id()) { + Succ = &BBIt; + break; + } + } + } + return Succ; + }; + + if (invert_graph_) { + // For the post dominator tree, we see the inverted graph. + // successors_ in the inverted graph are the predecessors in the CFG. + // The tree construction requires 1 entry point, so we add a dummy node + // that is connected to all function exiting basic blocks. + // An exiting basic block is a block with an OpKill, OpUnreachable, + // OpReturn or OpReturnValue as terminator instruction. + for (BasicBlock& bb : f) { + if (bb.hasSuccessor()) { + BasicBlockListTy& pred_list = predecessors_[&bb]; + const auto& const_bb = bb; + const_bb.ForEachSuccessorLabel( + [this, &pred_list, &bb, + &GetSuccessorBasicBlock](const uint32_t successor_id) { + BasicBlock* succ = GetSuccessorBasicBlock(successor_id); + // Inverted graph: our successors in the CFG + // are our predecessors in the inverted graph. + this->successors_[succ].push_back(&bb); + pred_list.push_back(succ); + }); + } else { + successors_[dummy_start_node].push_back(&bb); + predecessors_[&bb].push_back(const_cast(dummy_start_node)); + } + } + } else { + successors_[dummy_start_node].push_back(f.entry().get()); + predecessors_[f.entry().get()].push_back( + const_cast(dummy_start_node)); + for (BasicBlock& bb : f) { + BasicBlockListTy& succ_list = successors_[&bb]; + + const auto& const_bb = bb; + const_bb.ForEachSuccessorLabel([&](const uint32_t successor_id) { + BasicBlock* succ = GetSuccessorBasicBlock(successor_id); + succ_list.push_back(succ); + predecessors_[succ].push_back(&bb); + }); + } + } +} + +} // namespace + +bool DominatorTree::StrictlyDominates(uint32_t a, uint32_t b) const { + if (a == b) return false; + return Dominates(a, b); +} + +bool DominatorTree::StrictlyDominates(const BasicBlock* a, + const BasicBlock* b) const { + return DominatorTree::StrictlyDominates(a->id(), b->id()); +} + +bool DominatorTree::StrictlyDominates(const DominatorTreeNode* a, + const DominatorTreeNode* b) const { + if (a == b) return false; + return Dominates(a, b); +} + +bool DominatorTree::Dominates(uint32_t a, uint32_t b) const { + // Check that both of the inputs are actual nodes. + const DominatorTreeNode* a_node = GetTreeNode(a); + const DominatorTreeNode* b_node = GetTreeNode(b); + if (!a_node || !b_node) return false; + + return Dominates(a_node, b_node); +} + +bool DominatorTree::Dominates(const DominatorTreeNode* a, + const DominatorTreeNode* b) const { + // Node A dominates node B if they are the same. + if (a == b) return true; + + return a->dfs_num_pre_ < b->dfs_num_pre_ && + a->dfs_num_post_ > b->dfs_num_post_; +} + +bool DominatorTree::Dominates(const BasicBlock* A, const BasicBlock* B) const { + return Dominates(A->id(), B->id()); +} + +BasicBlock* DominatorTree::ImmediateDominator(const BasicBlock* A) const { + return ImmediateDominator(A->id()); +} + +BasicBlock* DominatorTree::ImmediateDominator(uint32_t a) const { + // Check that A is a valid node in the tree. + auto a_itr = nodes_.find(a); + if (a_itr == nodes_.end()) return nullptr; + + const DominatorTreeNode* node = &a_itr->second; + + if (node->parent_ == nullptr) { + return nullptr; + } + + return node->parent_->bb_; +} + +DominatorTreeNode* DominatorTree::GetOrInsertNode(BasicBlock* bb) { + DominatorTreeNode* dtn = nullptr; + + std::map::iterator node_iter = + nodes_.find(bb->id()); + if (node_iter == nodes_.end()) { + dtn = &nodes_.emplace(std::make_pair(bb->id(), DominatorTreeNode{bb})) + .first->second; + } else { + dtn = &node_iter->second; + } + + return dtn; +} + +void DominatorTree::GetDominatorEdges( + const Function* f, const BasicBlock* dummy_start_node, + std::vector>* edges) { + // Each time the depth first traversal calls the postorder callback + // std::function we push that node into the postorder vector to create our + // postorder list. + std::vector postorder; + auto postorder_function = [&](const BasicBlock* b) { + postorder.push_back(b); + }; + + // CFA::CalculateDominators requires std::vector + // BB are derived from F, so we need to const cast it at some point + // no modification is made on F. + BasicBlockSuccessorHelper helper{ + *const_cast(f), dummy_start_node, postdominator_}; + + // The successor function tells DepthFirstTraversal how to move to successive + // nodes by providing an interface to get a list of successor nodes from any + // given node. + auto successor_functor = helper.GetSuccessorFunctor(); + + // The predecessor functor does the same as the successor functor + // but for all nodes preceding a given node. + auto predecessor_functor = helper.GetPredFunctor(); + + // If we're building a post dominator tree we traverse the tree in reverse + // using the predecessor function in place of the successor function and vice + // versa. + DepthFirstSearchPostOrder(dummy_start_node, successor_functor, + postorder_function); + *edges = CFA::CalculateDominators(postorder, predecessor_functor); +} + +void DominatorTree::InitializeTree(const CFG& cfg, const Function* f) { + ClearTree(); + + // Skip over empty functions. + if (f->cbegin() == f->cend()) { + return; + } + + const BasicBlock* dummy_start_node = + postdominator_ ? cfg.pseudo_exit_block() : cfg.pseudo_entry_block(); + + // Get the immediate dominator for each node. + std::vector> edges; + GetDominatorEdges(f, dummy_start_node, &edges); + + // Transform the vector into the tree structure which we can use to + // efficiently query dominance. + for (auto edge : edges) { + DominatorTreeNode* first = GetOrInsertNode(edge.first); + + if (edge.first == edge.second) { + if (std::find(roots_.begin(), roots_.end(), first) == roots_.end()) + roots_.push_back(first); + continue; + } + + DominatorTreeNode* second = GetOrInsertNode(edge.second); + + first->parent_ = second; + second->children_.push_back(first); + } + ResetDFNumbering(); +} + +void DominatorTree::ResetDFNumbering() { + int index = 0; + auto preFunc = [&index](const DominatorTreeNode* node) { + const_cast(node)->dfs_num_pre_ = ++index; + }; + + auto postFunc = [&index](const DominatorTreeNode* node) { + const_cast(node)->dfs_num_post_ = ++index; + }; + + auto getSucc = [](const DominatorTreeNode* node) { return &node->children_; }; + + for (auto root : roots_) DepthFirstSearch(root, getSucc, preFunc, postFunc); +} + +void DominatorTree::DumpTreeAsDot(std::ostream& out_stream) const { + out_stream << "digraph {\n"; + Visit([&out_stream](const DominatorTreeNode* node) { + // Print the node. + if (node->bb_) { + out_stream << node->bb_->id() << "[label=\"" << node->bb_->id() + << "\"];\n"; + } + + // Print the arrow from the parent to this node. Entry nodes will not have + // parents so draw them as children from the dummy node. + if (node->parent_) { + out_stream << node->parent_->bb_->id() << " -> " << node->bb_->id() + << ";\n"; + } + + // Return true to continue the traversal. + return true; + }); + out_stream << "}\n"; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.h new file mode 100644 index 00000000000..0024bc508a8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/dominator_tree.h @@ -0,0 +1,305 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_DOMINATOR_TREE_H_ +#define SOURCE_OPT_DOMINATOR_TREE_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/cfg.h" +#include "source/opt/tree_iterator.h" + +namespace spvtools { +namespace opt { +// This helper struct forms the nodes in the tree, with each node containing its +// children. It also contains two values, for the pre and post indexes in the +// tree which are used to compare two nodes. +struct DominatorTreeNode { + explicit DominatorTreeNode(BasicBlock* bb) + : bb_(bb), + parent_(nullptr), + children_({}), + dfs_num_pre_(-1), + dfs_num_post_(-1) {} + + using iterator = std::vector::iterator; + using const_iterator = std::vector::const_iterator; + + // depth first preorder iterator. + using df_iterator = TreeDFIterator; + using const_df_iterator = TreeDFIterator; + // depth first postorder iterator. + using post_iterator = PostOrderTreeDFIterator; + using const_post_iterator = PostOrderTreeDFIterator; + + iterator begin() { return children_.begin(); } + iterator end() { return children_.end(); } + const_iterator begin() const { return cbegin(); } + const_iterator end() const { return cend(); } + const_iterator cbegin() const { return children_.begin(); } + const_iterator cend() const { return children_.end(); } + + // Depth first preorder iterator using this node as root. + df_iterator df_begin() { return df_iterator(this); } + df_iterator df_end() { return df_iterator(); } + const_df_iterator df_begin() const { return df_cbegin(); } + const_df_iterator df_end() const { return df_cend(); } + const_df_iterator df_cbegin() const { return const_df_iterator(this); } + const_df_iterator df_cend() const { return const_df_iterator(); } + + // Depth first postorder iterator using this node as root. + post_iterator post_begin() { return post_iterator::begin(this); } + post_iterator post_end() { return post_iterator::end(nullptr); } + const_post_iterator post_begin() const { return post_cbegin(); } + const_post_iterator post_end() const { return post_cend(); } + const_post_iterator post_cbegin() const { + return const_post_iterator::begin(this); + } + const_post_iterator post_cend() const { + return const_post_iterator::end(nullptr); + } + + inline uint32_t id() const { return bb_->id(); } + + BasicBlock* bb_; + DominatorTreeNode* parent_; + std::vector children_; + + // These indexes are used to compare two given nodes. A node is a child or + // grandchild of another node if its preorder index is greater than the + // first nodes preorder index AND if its postorder index is less than the + // first nodes postorder index. + int dfs_num_pre_; + int dfs_num_post_; +}; + +// A class representing a tree of BasicBlocks in a given function, where each +// node is dominated by its parent. +class DominatorTree { + public: + // Map OpLabel ids to dominator tree nodes + using DominatorTreeNodeMap = std::map; + using iterator = TreeDFIterator; + using const_iterator = TreeDFIterator; + using post_iterator = PostOrderTreeDFIterator; + using const_post_iterator = PostOrderTreeDFIterator; + + // List of DominatorTreeNode to define the list of roots + using DominatorTreeNodeList = std::vector; + using roots_iterator = DominatorTreeNodeList::iterator; + using roots_const_iterator = DominatorTreeNodeList::const_iterator; + + DominatorTree() : postdominator_(false) {} + explicit DominatorTree(bool post) : postdominator_(post) {} + + // Depth first iterators. + // Traverse the dominator tree in a depth first pre-order. + // The pseudo-block is ignored. + iterator begin() { return ++iterator(GetRoot()); } + iterator end() { return iterator(); } + const_iterator begin() const { return cbegin(); } + const_iterator end() const { return cend(); } + const_iterator cbegin() const { return ++const_iterator(GetRoot()); } + const_iterator cend() const { return const_iterator(); } + + // Traverse the dominator tree in a depth first post-order. + // The pseudo-block is ignored. + post_iterator post_begin() { return post_iterator::begin(GetRoot()); } + post_iterator post_end() { return post_iterator::end(GetRoot()); } + const_post_iterator post_begin() const { return post_cbegin(); } + const_post_iterator post_end() const { return post_cend(); } + const_post_iterator post_cbegin() const { + return const_post_iterator::begin(GetRoot()); + } + const_post_iterator post_cend() const { + return const_post_iterator::end(GetRoot()); + } + + roots_iterator roots_begin() { return roots_.begin(); } + roots_iterator roots_end() { return roots_.end(); } + roots_const_iterator roots_begin() const { return roots_cbegin(); } + roots_const_iterator roots_end() const { return roots_cend(); } + roots_const_iterator roots_cbegin() const { return roots_.begin(); } + roots_const_iterator roots_cend() const { return roots_.end(); } + + // Get the unique root of the tree. + // It is guaranteed to work on a dominator tree. + // post-dominator might have a list. + DominatorTreeNode* GetRoot() { + assert(roots_.size() == 1); + return *roots_.begin(); + } + + const DominatorTreeNode* GetRoot() const { + assert(roots_.size() == 1); + return *roots_.begin(); + } + + const DominatorTreeNodeList& Roots() const { return roots_; } + + // Dumps the tree in the graphvis dot format into the |out_stream|. + void DumpTreeAsDot(std::ostream& out_stream) const; + + // Build the (post-)dominator tree for the given control flow graph + // |cfg| and the function |f|. |f| must exist in the |cfg|. Any + // existing data in the dominator tree will be overwritten + void InitializeTree(const CFG& cfg, const Function* f); + + // Check if the basic block |a| dominates the basic block |b|. + bool Dominates(const BasicBlock* a, const BasicBlock* b) const; + + // Check if the basic block id |a| dominates the basic block id |b|. + bool Dominates(uint32_t a, uint32_t b) const; + + // Check if the dominator tree node |a| dominates the dominator tree node |b|. + bool Dominates(const DominatorTreeNode* a, const DominatorTreeNode* b) const; + + // Check if the basic block |a| strictly dominates the basic block |b|. + bool StrictlyDominates(const BasicBlock* a, const BasicBlock* b) const; + + // Check if the basic block id |a| strictly dominates the basic block id |b|. + bool StrictlyDominates(uint32_t a, uint32_t b) const; + + // Check if the dominator tree node |a| strictly dominates the dominator tree + // node |b|. + bool StrictlyDominates(const DominatorTreeNode* a, + const DominatorTreeNode* b) const; + + // Returns the immediate dominator of basic block |a|. + BasicBlock* ImmediateDominator(const BasicBlock* A) const; + + // Returns the immediate dominator of basic block id |a|. + BasicBlock* ImmediateDominator(uint32_t a) const; + + // Returns true if the basic block |a| is reachable by this tree. A node would + // be unreachable if it cannot be reached by traversal from the start node or + // for a postdominator tree, cannot be reached from the exit nodes. + inline bool ReachableFromRoots(const BasicBlock* a) const { + if (!a) return false; + return ReachableFromRoots(a->id()); + } + + // Returns true if the basic block id |a| is reachable by this tree. + bool ReachableFromRoots(uint32_t a) const { + return GetTreeNode(a) != nullptr; + } + + // Returns true if this tree is a post dominator tree. + bool IsPostDominator() const { return postdominator_; } + + // Clean up the tree. + void ClearTree() { + nodes_.clear(); + roots_.clear(); + } + + // Applies the std::function |func| to all nodes in the dominator tree. + // Tree nodes are visited in a depth first pre-order. + bool Visit(std::function func) { + for (auto n : *this) { + if (!func(&n)) return false; + } + return true; + } + + // Applies the std::function |func| to all nodes in the dominator tree. + // Tree nodes are visited in a depth first pre-order. + bool Visit(std::function func) const { + for (auto n : *this) { + if (!func(&n)) return false; + } + return true; + } + + // Applies the std::function |func| to all nodes in the dominator tree from + // |node| downwards. The boolean return from |func| is used to determine + // whether or not the children should also be traversed. Tree nodes are + // visited in a depth first pre-order. + void VisitChildrenIf(std::function func, + iterator node) { + if (func(&*node)) { + for (auto n : *node) { + VisitChildrenIf(func, n->df_begin()); + } + } + } + + // Returns the DominatorTreeNode associated with the basic block |bb|. + // If the |bb| is unknown to the dominator tree, it returns null. + inline DominatorTreeNode* GetTreeNode(BasicBlock* bb) { + return GetTreeNode(bb->id()); + } + // Returns the DominatorTreeNode associated with the basic block |bb|. + // If the |bb| is unknown to the dominator tree, it returns null. + inline const DominatorTreeNode* GetTreeNode(BasicBlock* bb) const { + return GetTreeNode(bb->id()); + } + + // Returns the DominatorTreeNode associated with the basic block id |id|. + // If the id |id| is unknown to the dominator tree, it returns null. + inline DominatorTreeNode* GetTreeNode(uint32_t id) { + DominatorTreeNodeMap::iterator node_iter = nodes_.find(id); + if (node_iter == nodes_.end()) { + return nullptr; + } + return &node_iter->second; + } + // Returns the DominatorTreeNode associated with the basic block id |id|. + // If the id |id| is unknown to the dominator tree, it returns null. + inline const DominatorTreeNode* GetTreeNode(uint32_t id) const { + DominatorTreeNodeMap::const_iterator node_iter = nodes_.find(id); + if (node_iter == nodes_.end()) { + return nullptr; + } + return &node_iter->second; + } + + // Adds the basic block |bb| to the tree structure if it doesn't already + // exist. + DominatorTreeNode* GetOrInsertNode(BasicBlock* bb); + + // Recomputes the DF numbering of the tree. + void ResetDFNumbering(); + + private: + // Wrapper function which gets the list of pairs of each BasicBlocks to its + // immediately dominating BasicBlock and stores the result in the the edges + // parameter. + // + // The |edges| vector will contain the dominator tree as pairs of nodes. + // The first node in the pair is a node in the graph. The second node in the + // pair is its immediate dominator. + // The root of the tree has themself as immediate dominator. + void GetDominatorEdges( + const Function* f, const BasicBlock* dummy_start_node, + std::vector>* edges); + + // The roots of the tree. + std::vector roots_; + + // Pairs each basic block id to the tree node containing that basic block. + DominatorTreeNodeMap nodes_; + + // True if this is a post dominator tree. + bool postdominator_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_DOMINATOR_TREE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp new file mode 100644 index 00000000000..d368bd1453f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp @@ -0,0 +1,104 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/eliminate_dead_constant_pass.h" + +#include +#include +#include +#include + +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +Pass::Status EliminateDeadConstantPass::Process() { + std::unordered_set working_list; + // Traverse all the instructions to get the initial set of dead constants as + // working list and count number of real uses for constants. Uses in + // annotation instructions do not count. + std::unordered_map use_counts; + std::vector constants = context()->GetConstants(); + for (auto* c : constants) { + uint32_t const_id = c->result_id(); + size_t count = 0; + context()->get_def_use_mgr()->ForEachUse( + const_id, [&count](Instruction* user, uint32_t index) { + (void)index; + SpvOp op = user->opcode(); + if (!(IsAnnotationInst(op) || IsDebug1Inst(op) || IsDebug2Inst(op) || + IsDebug3Inst(op))) { + ++count; + } + }); + use_counts[c] = count; + if (!count) { + working_list.insert(c); + } + } + + // Start from the constants with 0 uses, back trace through the def-use chain + // to find all dead constants. + std::unordered_set dead_consts; + while (!working_list.empty()) { + Instruction* inst = *working_list.begin(); + // Back propagate if the instruction contains IDs in its operands. + switch (inst->opcode()) { + case SpvOp::SpvOpConstantComposite: + case SpvOp::SpvOpSpecConstantComposite: + case SpvOp::SpvOpSpecConstantOp: + for (uint32_t i = 0; i < inst->NumInOperands(); i++) { + // SpecConstantOp instruction contains 'opcode' as its operand. Need + // to exclude such operands when decreasing uses. + if (inst->GetInOperand(i).type != SPV_OPERAND_TYPE_ID) { + continue; + } + uint32_t operand_id = inst->GetSingleWordInOperand(i); + Instruction* def_inst = + context()->get_def_use_mgr()->GetDef(operand_id); + // If the use_count does not have any count for the def_inst, + // def_inst must not be a constant, and should be ignored here. + if (!use_counts.count(def_inst)) { + continue; + } + // The number of uses should never be less then 0, so it can not be + // less than 1 before it decreases. + SPIRV_ASSERT(consumer(), use_counts[def_inst] > 0); + --use_counts[def_inst]; + if (!use_counts[def_inst]) { + working_list.insert(def_inst); + } + } + break; + default: + break; + } + dead_consts.insert(inst); + working_list.erase(inst); + } + + // Turn all dead instructions and uses of them to nop + for (auto* dc : dead_consts) { + context()->KillDef(dc->result_id()); + } + return dead_consts.empty() ? Status::SuccessWithoutChange + : Status::SuccessWithChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.h new file mode 100644 index 00000000000..01692dbf465 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_constant_pass.h @@ -0,0 +1,35 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ +#define SOURCE_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class EliminateDeadConstantPass : public Pass { + public: + const char* name() const override { return "eliminate-dead-const"; } + Status Process() override; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_ELIMINATE_DEAD_CONSTANT_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp new file mode 100644 index 00000000000..5be983a58fa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp @@ -0,0 +1,56 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/eliminate_dead_functions_pass.h" + +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status EliminateDeadFunctionsPass::Process() { + // Identify live functions first. Those that are not live + // are dead. + std::unordered_set live_function_set; + ProcessFunction mark_live = [&live_function_set](Function* fp) { + live_function_set.insert(fp); + return false; + }; + ProcessReachableCallTree(mark_live, context()); + + bool modified = false; + for (auto funcIter = get_module()->begin(); + funcIter != get_module()->end();) { + if (live_function_set.count(&*funcIter) == 0) { + modified = true; + EliminateFunction(&*funcIter); + funcIter = funcIter.Erase(); + } else { + ++funcIter; + } + } + + return modified ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +void EliminateDeadFunctionsPass::EliminateFunction(Function* func) { + // Remove all of the instruction in the function body + func->ForEachInst([this](Instruction* inst) { context()->KillInst(inst); }, + true); +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_pass.h new file mode 100644 index 00000000000..165e9a6b5dc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/eliminate_dead_functions_pass.h @@ -0,0 +1,43 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ +#define SOURCE_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ + +#include "source/opt/def_use_manager.h" +#include "source/opt/function.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class EliminateDeadFunctionsPass : public MemPass { + public: + const char* name() const override { return "eliminate-dead-functions"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse; + } + + private: + void EliminateFunction(Function* func); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_ELIMINATE_DEAD_FUNCTIONS_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp new file mode 100644 index 00000000000..b7fc16a50df --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.cpp @@ -0,0 +1,67 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/feature_manager.h" + +#include +#include +#include + +#include "source/enum_string_mapping.h" + +namespace spvtools { +namespace opt { + +void FeatureManager::Analyze(Module* module) { + AddExtensions(module); + AddCapabilities(module); + AddExtInstImportIds(module); +} + +void FeatureManager::AddExtensions(Module* module) { + for (auto ext : module->extensions()) { + const std::string name = + reinterpret_cast(ext.GetInOperand(0u).words.data()); + Extension extension; + if (GetExtensionFromString(name.c_str(), &extension)) { + extensions_.Add(extension); + } + } +} + +void FeatureManager::AddCapability(SpvCapability cap) { + if (capabilities_.Contains(cap)) return; + + capabilities_.Add(cap); + + spv_operand_desc desc = {}; + if (SPV_SUCCESS == + grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc)) { + CapabilitySet(desc->numCapabilities, desc->capabilities) + .ForEach([this](SpvCapability c) { AddCapability(c); }); + } +} + +void FeatureManager::AddCapabilities(Module* module) { + for (Instruction& inst : module->capabilities()) { + AddCapability(static_cast(inst.GetSingleWordInOperand(0))); + } +} + +void FeatureManager::AddExtInstImportIds(Module* module) { + extinst_importid_GLSLstd450_ = module->GetExtInstImportId("GLSL.std.450"); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h new file mode 100644 index 00000000000..80b2cccf63e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/feature_manager.h @@ -0,0 +1,78 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_FEATURE_MANAGER_H_ +#define SOURCE_OPT_FEATURE_MANAGER_H_ + +#include "source/assembly_grammar.h" +#include "source/extensions.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// Tracks features enabled by a module. The IRContext has a FeatureManager. +class FeatureManager { + public: + explicit FeatureManager(const AssemblyGrammar& grammar) : grammar_(grammar) {} + + // Returns true if |ext| is an enabled extension in the module. + bool HasExtension(Extension ext) const { return extensions_.Contains(ext); } + + // Returns true if |cap| is an enabled capability in the module. + bool HasCapability(SpvCapability cap) const { + return capabilities_.Contains(cap); + } + + // Analyzes |module| and records enabled extensions and capabilities. + void Analyze(Module* module); + + CapabilitySet* GetCapabilities() { return &capabilities_; } + const CapabilitySet* GetCapabilities() const { return &capabilities_; } + + uint32_t GetExtInstImportId_GLSLstd450() const { + return extinst_importid_GLSLstd450_; + } + + private: + // Analyzes |module| and records enabled extensions. + void AddExtensions(Module* module); + + // Adds the given |capability| and all implied capabilities into the current + // FeatureManager. + void AddCapability(SpvCapability capability); + + // Analyzes |module| and records enabled capabilities. + void AddCapabilities(Module* module); + + // Analyzes |module| and records imported external instruction sets. + void AddExtInstImportIds(Module* module); + + // Auxiliary object for querying SPIR-V grammar facts. + const AssemblyGrammar& grammar_; + + // The enabled extensions. + ExtensionSet extensions_; + + // The enabled capabilities. + CapabilitySet capabilities_; + + // Common external instruction import ids, cached for performance. + uint32_t extinst_importid_GLSLstd450_ = 0; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FEATURE_MANAGER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp new file mode 100644 index 00000000000..f4de9116f9a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.cpp @@ -0,0 +1,165 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/flatten_decoration_pass.h" + +#include +#include +#include +#include +#include +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +using Words = std::vector; +using OrderedUsesMap = std::unordered_map; + +Pass::Status FlattenDecorationPass::Process() { + bool modified = false; + + // The target Id of OpDecorationGroup instructions. + // We have to track this separately from its uses, in case it + // has no uses. + std::unordered_set group_ids; + // Maps a decoration group Id to its GroupDecorate targets, in order + // of appearance. + OrderedUsesMap normal_uses; + // Maps a decoration group Id to its GroupMemberDecorate targets and + // their indices, in of appearance. + OrderedUsesMap member_uses; + + auto annotations = context()->annotations(); + + // On the first pass, record each OpDecorationGroup with its ordered uses. + // Rely on unordered_map::operator[] to create its entries on first access. + for (const auto& inst : annotations) { + switch (inst.opcode()) { + case SpvOp::SpvOpDecorationGroup: + group_ids.insert(inst.result_id()); + break; + case SpvOp::SpvOpGroupDecorate: { + Words& words = normal_uses[inst.GetSingleWordInOperand(0)]; + for (uint32_t i = 1; i < inst.NumInOperandWords(); i++) { + words.push_back(inst.GetSingleWordInOperand(i)); + } + } break; + case SpvOp::SpvOpGroupMemberDecorate: { + Words& words = member_uses[inst.GetSingleWordInOperand(0)]; + for (uint32_t i = 1; i < inst.NumInOperandWords(); i++) { + words.push_back(inst.GetSingleWordInOperand(i)); + } + } break; + default: + break; + } + } + + // On the second pass, replace OpDecorationGroup and its uses with + // equivalent normal and struct member uses. + auto inst_iter = annotations.begin(); + // We have to re-evaluate the end pointer + while (inst_iter != context()->annotations().end()) { + // Should we replace this instruction? + bool replace = false; + switch (inst_iter->opcode()) { + case SpvOp::SpvOpDecorationGroup: + case SpvOp::SpvOpGroupDecorate: + case SpvOp::SpvOpGroupMemberDecorate: + replace = true; + break; + case SpvOp::SpvOpDecorate: { + // If this decoration targets a group, then replace it + // by sets of normal and member decorations. + const uint32_t group = inst_iter->GetSingleWordOperand(0); + const auto normal_uses_iter = normal_uses.find(group); + if (normal_uses_iter != normal_uses.end()) { + for (auto target : normal_uses[group]) { + std::unique_ptr new_inst(inst_iter->Clone(context())); + new_inst->SetInOperand(0, Words{target}); + inst_iter = inst_iter.InsertBefore(std::move(new_inst)); + ++inst_iter; + replace = true; + } + } + const auto member_uses_iter = member_uses.find(group); + if (member_uses_iter != member_uses.end()) { + const Words& member_id_pairs = (*member_uses_iter).second; + // The collection is a sequence of pairs. + assert((member_id_pairs.size() % 2) == 0); + for (size_t i = 0; i < member_id_pairs.size(); i += 2) { + // Make an OpMemberDecorate instruction for each (target, member) + // pair. + const uint32_t target = member_id_pairs[i]; + const uint32_t member = member_id_pairs[i + 1]; + std::vector operands; + operands.push_back(Operand(SPV_OPERAND_TYPE_ID, {target})); + operands.push_back( + Operand(SPV_OPERAND_TYPE_LITERAL_INTEGER, {member})); + auto decoration_operands_iter = inst_iter->begin(); + decoration_operands_iter++; // Skip the group target. + operands.insert(operands.end(), decoration_operands_iter, + inst_iter->end()); + std::unique_ptr new_inst(new Instruction( + context(), SpvOp::SpvOpMemberDecorate, 0, 0, operands)); + inst_iter = inst_iter.InsertBefore(std::move(new_inst)); + ++inst_iter; + replace = true; + } + } + // If this is an OpDecorate targeting the OpDecorationGroup itself, + // remove it even if that decoration group itself is not the target of + // any OpGroupDecorate or OpGroupMemberDecorate. + if (!replace && group_ids.count(group)) { + replace = true; + } + } break; + default: + break; + } + if (replace) { + inst_iter = inst_iter.Erase(); + modified = true; + } else { + // Handle the case of decorations unrelated to decoration groups. + ++inst_iter; + } + } + + // Remove OpName instructions which reference the removed group decorations. + // An OpDecorationGroup instruction might not have been used by an + // OpGroupDecorate or OpGroupMemberDecorate instruction. + if (!group_ids.empty()) { + for (auto debug_inst_iter = context()->debug2_begin(); + debug_inst_iter != context()->debug2_end();) { + if (debug_inst_iter->opcode() == SpvOp::SpvOpName) { + const uint32_t target = debug_inst_iter->GetSingleWordOperand(0); + if (group_ids.count(target)) { + debug_inst_iter = debug_inst_iter.Erase(); + modified = true; + } else { + ++debug_inst_iter; + } + } + } + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.h new file mode 100644 index 00000000000..6a34f5bb294 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/flatten_decoration_pass.h @@ -0,0 +1,35 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_FLATTEN_DECORATION_PASS_H_ +#define SOURCE_OPT_FLATTEN_DECORATION_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class FlattenDecorationPass : public Pass { + public: + const char* name() const override { return "flatten-decorations"; } + Status Process() override; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FLATTEN_DECORATION_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp new file mode 100644 index 00000000000..09d7e512245 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold.cpp @@ -0,0 +1,656 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/fold.h" + +#include +#include +#include + +#include "source/opt/const_folding_rules.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/folding_rules.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { + +#ifndef INT32_MIN +#define INT32_MIN (-2147483648) +#endif + +#ifndef INT32_MAX +#define INT32_MAX 2147483647 +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff /* 4294967295U */ +#endif + +} // namespace + +uint32_t InstructionFolder::UnaryOperate(SpvOp opcode, uint32_t operand) const { + switch (opcode) { + // Arthimetics + case SpvOp::SpvOpSNegate: + return -static_cast(operand); + case SpvOp::SpvOpNot: + return ~operand; + case SpvOp::SpvOpLogicalNot: + return !static_cast(operand); + default: + assert(false && + "Unsupported unary operation for OpSpecConstantOp instruction"); + return 0u; + } +} + +uint32_t InstructionFolder::BinaryOperate(SpvOp opcode, uint32_t a, + uint32_t b) const { + switch (opcode) { + // Arthimetics + case SpvOp::SpvOpIAdd: + return a + b; + case SpvOp::SpvOpISub: + return a - b; + case SpvOp::SpvOpIMul: + return a * b; + case SpvOp::SpvOpUDiv: + assert(b != 0); + return a / b; + case SpvOp::SpvOpSDiv: + assert(b != 0u); + return (static_cast(a)) / (static_cast(b)); + case SpvOp::SpvOpSRem: { + // The sign of non-zero result comes from the first operand: a. This is + // guaranteed by C++11 rules for integer division operator. The division + // result is rounded toward zero, so the result of '%' has the sign of + // the first operand. + assert(b != 0u); + return static_cast(a) % static_cast(b); + } + case SpvOp::SpvOpSMod: { + // The sign of non-zero result comes from the second operand: b + assert(b != 0u); + int32_t rem = BinaryOperate(SpvOp::SpvOpSRem, a, b); + int32_t b_prim = static_cast(b); + return (rem + b_prim) % b_prim; + } + case SpvOp::SpvOpUMod: + assert(b != 0u); + return (a % b); + + // Shifting + case SpvOp::SpvOpShiftRightLogical: { + return a >> b; + } + case SpvOp::SpvOpShiftRightArithmetic: + return (static_cast(a)) >> b; + case SpvOp::SpvOpShiftLeftLogical: + return a << b; + + // Bitwise operations + case SpvOp::SpvOpBitwiseOr: + return a | b; + case SpvOp::SpvOpBitwiseAnd: + return a & b; + case SpvOp::SpvOpBitwiseXor: + return a ^ b; + + // Logical + case SpvOp::SpvOpLogicalEqual: + return (static_cast(a)) == (static_cast(b)); + case SpvOp::SpvOpLogicalNotEqual: + return (static_cast(a)) != (static_cast(b)); + case SpvOp::SpvOpLogicalOr: + return (static_cast(a)) || (static_cast(b)); + case SpvOp::SpvOpLogicalAnd: + return (static_cast(a)) && (static_cast(b)); + + // Comparison + case SpvOp::SpvOpIEqual: + return a == b; + case SpvOp::SpvOpINotEqual: + return a != b; + case SpvOp::SpvOpULessThan: + return a < b; + case SpvOp::SpvOpSLessThan: + return (static_cast(a)) < (static_cast(b)); + case SpvOp::SpvOpUGreaterThan: + return a > b; + case SpvOp::SpvOpSGreaterThan: + return (static_cast(a)) > (static_cast(b)); + case SpvOp::SpvOpULessThanEqual: + return a <= b; + case SpvOp::SpvOpSLessThanEqual: + return (static_cast(a)) <= (static_cast(b)); + case SpvOp::SpvOpUGreaterThanEqual: + return a >= b; + case SpvOp::SpvOpSGreaterThanEqual: + return (static_cast(a)) >= (static_cast(b)); + default: + assert(false && + "Unsupported binary operation for OpSpecConstantOp instruction"); + return 0u; + } +} + +uint32_t InstructionFolder::TernaryOperate(SpvOp opcode, uint32_t a, uint32_t b, + uint32_t c) const { + switch (opcode) { + case SpvOp::SpvOpSelect: + return (static_cast(a)) ? b : c; + default: + assert(false && + "Unsupported ternary operation for OpSpecConstantOp instruction"); + return 0u; + } +} + +uint32_t InstructionFolder::OperateWords( + SpvOp opcode, const std::vector& operand_words) const { + switch (operand_words.size()) { + case 1: + return UnaryOperate(opcode, operand_words.front()); + case 2: + return BinaryOperate(opcode, operand_words.front(), operand_words.back()); + case 3: + return TernaryOperate(opcode, operand_words[0], operand_words[1], + operand_words[2]); + default: + assert(false && "Invalid number of operands"); + return 0; + } +} + +bool InstructionFolder::FoldInstructionInternal(Instruction* inst) const { + auto identity_map = [](uint32_t id) { return id; }; + Instruction* folded_inst = FoldInstructionToConstant(inst, identity_map); + if (folded_inst != nullptr) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {folded_inst->result_id()}}}); + return true; + } + + SpvOp opcode = inst->opcode(); + analysis::ConstantManager* const_manager = context_->get_constant_mgr(); + + std::vector constants = + const_manager->GetOperandConstants(inst); + + for (const FoldingRule& rule : GetFoldingRules().GetRulesForOpcode(opcode)) { + if (rule(context_, inst, constants)) { + return true; + } + } + return false; +} + +// Returns the result of performing an operation on scalar constant operands. +// This function extracts the operand values as 32 bit words and returns the +// result in 32 bit word. Scalar constants with longer than 32-bit width are +// not accepted in this function. +uint32_t InstructionFolder::FoldScalars( + SpvOp opcode, + const std::vector& operands) const { + assert(IsFoldableOpcode(opcode) && + "Unhandled instruction opcode in FoldScalars"); + std::vector operand_values_in_raw_words; + for (const auto& operand : operands) { + if (const analysis::ScalarConstant* scalar = operand->AsScalarConstant()) { + const auto& scalar_words = scalar->words(); + assert(scalar_words.size() == 1 && + "Scalar constants with longer than 32-bit width are not allowed " + "in FoldScalars()"); + operand_values_in_raw_words.push_back(scalar_words.front()); + } else if (operand->AsNullConstant()) { + operand_values_in_raw_words.push_back(0u); + } else { + assert(false && + "FoldScalars() only accepts ScalarConst or NullConst type of " + "constant"); + } + } + return OperateWords(opcode, operand_values_in_raw_words); +} + +bool InstructionFolder::FoldBinaryIntegerOpToConstant( + Instruction* inst, const std::function& id_map, + uint32_t* result) const { + SpvOp opcode = inst->opcode(); + analysis::ConstantManager* const_manger = context_->get_constant_mgr(); + + uint32_t ids[2]; + const analysis::IntConstant* constants[2]; + for (uint32_t i = 0; i < 2; i++) { + const Operand* operand = &inst->GetInOperand(i); + if (operand->type != SPV_OPERAND_TYPE_ID) { + return false; + } + ids[i] = id_map(operand->words[0]); + const analysis::Constant* constant = + const_manger->FindDeclaredConstant(ids[i]); + constants[i] = (constant != nullptr ? constant->AsIntConstant() : nullptr); + } + + switch (opcode) { + // Arthimetics + case SpvOp::SpvOpIMul: + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] != nullptr && constants[i]->IsZero()) { + *result = 0; + return true; + } + } + break; + case SpvOp::SpvOpUDiv: + case SpvOp::SpvOpSDiv: + case SpvOp::SpvOpSRem: + case SpvOp::SpvOpSMod: + case SpvOp::SpvOpUMod: + // This changes undefined behaviour (ie divide by 0) into a 0. + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] != nullptr && constants[i]->IsZero()) { + *result = 0; + return true; + } + } + break; + + // Shifting + case SpvOp::SpvOpShiftRightLogical: + case SpvOp::SpvOpShiftLeftLogical: + if (constants[1] != nullptr) { + // When shifting by a value larger than the size of the result, the + // result is undefined. We are setting the undefined behaviour to a + // result of 0. + uint32_t shift_amount = constants[1]->GetU32BitValue(); + if (shift_amount >= 32) { + *result = 0; + return true; + } + } + break; + + // Bitwise operations + case SpvOp::SpvOpBitwiseOr: + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] != nullptr) { + // TODO: Change the mask against a value based on the bit width of the + // instruction result type. This way we can handle say 16-bit values + // as well. + uint32_t mask = constants[i]->GetU32BitValue(); + if (mask == 0xFFFFFFFF) { + *result = 0xFFFFFFFF; + return true; + } + } + } + break; + case SpvOp::SpvOpBitwiseAnd: + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] != nullptr) { + if (constants[i]->IsZero()) { + *result = 0; + return true; + } + } + } + break; + + // Comparison + case SpvOp::SpvOpULessThan: + if (constants[0] != nullptr && + constants[0]->GetU32BitValue() == UINT32_MAX) { + *result = false; + return true; + } + if (constants[1] != nullptr && constants[1]->GetU32BitValue() == 0) { + *result = false; + return true; + } + break; + case SpvOp::SpvOpSLessThan: + if (constants[0] != nullptr && + constants[0]->GetS32BitValue() == INT32_MAX) { + *result = false; + return true; + } + if (constants[1] != nullptr && + constants[1]->GetS32BitValue() == INT32_MIN) { + *result = false; + return true; + } + break; + case SpvOp::SpvOpUGreaterThan: + if (constants[0] != nullptr && constants[0]->IsZero()) { + *result = false; + return true; + } + if (constants[1] != nullptr && + constants[1]->GetU32BitValue() == UINT32_MAX) { + *result = false; + return true; + } + break; + case SpvOp::SpvOpSGreaterThan: + if (constants[0] != nullptr && + constants[0]->GetS32BitValue() == INT32_MIN) { + *result = false; + return true; + } + if (constants[1] != nullptr && + constants[1]->GetS32BitValue() == INT32_MAX) { + *result = false; + return true; + } + break; + case SpvOp::SpvOpULessThanEqual: + if (constants[0] != nullptr && constants[0]->IsZero()) { + *result = true; + return true; + } + if (constants[1] != nullptr && + constants[1]->GetU32BitValue() == UINT32_MAX) { + *result = true; + return true; + } + break; + case SpvOp::SpvOpSLessThanEqual: + if (constants[0] != nullptr && + constants[0]->GetS32BitValue() == INT32_MIN) { + *result = true; + return true; + } + if (constants[1] != nullptr && + constants[1]->GetS32BitValue() == INT32_MAX) { + *result = true; + return true; + } + break; + case SpvOp::SpvOpUGreaterThanEqual: + if (constants[0] != nullptr && + constants[0]->GetU32BitValue() == UINT32_MAX) { + *result = true; + return true; + } + if (constants[1] != nullptr && constants[1]->GetU32BitValue() == 0) { + *result = true; + return true; + } + break; + case SpvOp::SpvOpSGreaterThanEqual: + if (constants[0] != nullptr && + constants[0]->GetS32BitValue() == INT32_MAX) { + *result = true; + return true; + } + if (constants[1] != nullptr && + constants[1]->GetS32BitValue() == INT32_MIN) { + *result = true; + return true; + } + break; + default: + break; + } + return false; +} + +bool InstructionFolder::FoldBinaryBooleanOpToConstant( + Instruction* inst, const std::function& id_map, + uint32_t* result) const { + SpvOp opcode = inst->opcode(); + analysis::ConstantManager* const_manger = context_->get_constant_mgr(); + + uint32_t ids[2]; + const analysis::BoolConstant* constants[2]; + for (uint32_t i = 0; i < 2; i++) { + const Operand* operand = &inst->GetInOperand(i); + if (operand->type != SPV_OPERAND_TYPE_ID) { + return false; + } + ids[i] = id_map(operand->words[0]); + const analysis::Constant* constant = + const_manger->FindDeclaredConstant(ids[i]); + constants[i] = (constant != nullptr ? constant->AsBoolConstant() : nullptr); + } + + switch (opcode) { + // Logical + case SpvOp::SpvOpLogicalOr: + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] != nullptr) { + if (constants[i]->value()) { + *result = true; + return true; + } + } + } + break; + case SpvOp::SpvOpLogicalAnd: + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] != nullptr) { + if (!constants[i]->value()) { + *result = false; + return true; + } + } + } + break; + + default: + break; + } + return false; +} + +bool InstructionFolder::FoldIntegerOpToConstant( + Instruction* inst, const std::function& id_map, + uint32_t* result) const { + assert(IsFoldableOpcode(inst->opcode()) && + "Unhandled instruction opcode in FoldScalars"); + switch (inst->NumInOperands()) { + case 2: + return FoldBinaryIntegerOpToConstant(inst, id_map, result) || + FoldBinaryBooleanOpToConstant(inst, id_map, result); + default: + return false; + } +} + +std::vector InstructionFolder::FoldVectors( + SpvOp opcode, uint32_t num_dims, + const std::vector& operands) const { + assert(IsFoldableOpcode(opcode) && + "Unhandled instruction opcode in FoldVectors"); + std::vector result; + for (uint32_t d = 0; d < num_dims; d++) { + std::vector operand_values_for_one_dimension; + for (const auto& operand : operands) { + if (const analysis::VectorConstant* vector_operand = + operand->AsVectorConstant()) { + // Extract the raw value of the scalar component constants + // in 32-bit words here. The reason of not using FoldScalars() here + // is that we do not create temporary null constants as components + // when the vector operand is a NullConstant because Constant creation + // may need extra checks for the validity and that is not manageed in + // here. + if (const analysis::ScalarConstant* scalar_component = + vector_operand->GetComponents().at(d)->AsScalarConstant()) { + const auto& scalar_words = scalar_component->words(); + assert( + scalar_words.size() == 1 && + "Vector components with longer than 32-bit width are not allowed " + "in FoldVectors()"); + operand_values_for_one_dimension.push_back(scalar_words.front()); + } else if (operand->AsNullConstant()) { + operand_values_for_one_dimension.push_back(0u); + } else { + assert(false && + "VectorConst should only has ScalarConst or NullConst as " + "components"); + } + } else if (operand->AsNullConstant()) { + operand_values_for_one_dimension.push_back(0u); + } else { + assert(false && + "FoldVectors() only accepts VectorConst or NullConst type of " + "constant"); + } + } + result.push_back(OperateWords(opcode, operand_values_for_one_dimension)); + } + return result; +} + +bool InstructionFolder::IsFoldableOpcode(SpvOp opcode) const { + // NOTE: Extend to more opcodes as new cases are handled in the folder + // functions. + switch (opcode) { + case SpvOp::SpvOpBitwiseAnd: + case SpvOp::SpvOpBitwiseOr: + case SpvOp::SpvOpBitwiseXor: + case SpvOp::SpvOpIAdd: + case SpvOp::SpvOpIEqual: + case SpvOp::SpvOpIMul: + case SpvOp::SpvOpINotEqual: + case SpvOp::SpvOpISub: + case SpvOp::SpvOpLogicalAnd: + case SpvOp::SpvOpLogicalEqual: + case SpvOp::SpvOpLogicalNot: + case SpvOp::SpvOpLogicalNotEqual: + case SpvOp::SpvOpLogicalOr: + case SpvOp::SpvOpNot: + case SpvOp::SpvOpSDiv: + case SpvOp::SpvOpSelect: + case SpvOp::SpvOpSGreaterThan: + case SpvOp::SpvOpSGreaterThanEqual: + case SpvOp::SpvOpShiftLeftLogical: + case SpvOp::SpvOpShiftRightArithmetic: + case SpvOp::SpvOpShiftRightLogical: + case SpvOp::SpvOpSLessThan: + case SpvOp::SpvOpSLessThanEqual: + case SpvOp::SpvOpSMod: + case SpvOp::SpvOpSNegate: + case SpvOp::SpvOpSRem: + case SpvOp::SpvOpUDiv: + case SpvOp::SpvOpUGreaterThan: + case SpvOp::SpvOpUGreaterThanEqual: + case SpvOp::SpvOpULessThan: + case SpvOp::SpvOpULessThanEqual: + case SpvOp::SpvOpUMod: + return true; + default: + return false; + } +} + +bool InstructionFolder::IsFoldableConstant( + const analysis::Constant* cst) const { + // Currently supported constants are 32-bit values or null constants. + if (const analysis::ScalarConstant* scalar = cst->AsScalarConstant()) + return scalar->words().size() == 1; + else + return cst->AsNullConstant() != nullptr; +} + +Instruction* InstructionFolder::FoldInstructionToConstant( + Instruction* inst, std::function id_map) const { + analysis::ConstantManager* const_mgr = context_->get_constant_mgr(); + + if (!inst->IsFoldableByFoldScalar() && + !GetConstantFoldingRules().HasFoldingRule(inst->opcode())) { + return nullptr; + } + // Collect the values of the constant parameters. + std::vector constants; + bool missing_constants = false; + inst->ForEachInId([&constants, &missing_constants, const_mgr, + &id_map](uint32_t* op_id) { + uint32_t id = id_map(*op_id); + const analysis::Constant* const_op = const_mgr->FindDeclaredConstant(id); + if (!const_op) { + constants.push_back(nullptr); + missing_constants = true; + } else { + constants.push_back(const_op); + } + }); + + if (GetConstantFoldingRules().HasFoldingRule(inst->opcode())) { + const analysis::Constant* folded_const = nullptr; + for (auto rule : + GetConstantFoldingRules().GetRulesForOpcode(inst->opcode())) { + folded_const = rule(context_, inst, constants); + if (folded_const != nullptr) { + Instruction* const_inst = + const_mgr->GetDefiningInstruction(folded_const, inst->type_id()); + assert(const_inst->type_id() == inst->type_id()); + // May be a new instruction that needs to be analysed. + context_->UpdateDefUse(const_inst); + return const_inst; + } + } + } + + uint32_t result_val = 0; + bool successful = false; + // If all parameters are constant, fold the instruction to a constant. + if (!missing_constants && inst->IsFoldableByFoldScalar()) { + result_val = FoldScalars(inst->opcode(), constants); + successful = true; + } + + if (!successful && inst->IsFoldableByFoldScalar()) { + successful = FoldIntegerOpToConstant(inst, id_map, &result_val); + } + + if (successful) { + const analysis::Constant* result_const = + const_mgr->GetConstant(const_mgr->GetType(inst), {result_val}); + Instruction* folded_inst = + const_mgr->GetDefiningInstruction(result_const, inst->type_id()); + return folded_inst; + } + return nullptr; +} + +bool InstructionFolder::IsFoldableType(Instruction* type_inst) const { + // Support 32-bit integers. + if (type_inst->opcode() == SpvOpTypeInt) { + return type_inst->GetSingleWordInOperand(0) == 32; + } + // Support booleans. + if (type_inst->opcode() == SpvOpTypeBool) { + return true; + } + // Nothing else yet. + return false; +} + +bool InstructionFolder::FoldInstruction(Instruction* inst) const { + bool modified = false; + Instruction* folded_inst(inst); + while (folded_inst->opcode() != SpvOpCopyObject && + FoldInstructionInternal(&*folded_inst)) { + modified = true; + } + return modified; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold.h new file mode 100644 index 00000000000..0dc7c0ebbee --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold.h @@ -0,0 +1,171 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_FOLD_H_ +#define SOURCE_OPT_FOLD_H_ + +#include +#include + +#include "source/opt/const_folding_rules.h" +#include "source/opt/constants.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/folding_rules.h" + +namespace spvtools { +namespace opt { + +class InstructionFolder { + public: + explicit InstructionFolder(IRContext* context) : context_(context) {} + + // Returns the result of folding a scalar instruction with the given |opcode| + // and |operands|. Each entry in |operands| is a pointer to an + // analysis::Constant instance, which should've been created with the constant + // manager (See IRContext::get_constant_mgr). + // + // It is an error to call this function with an opcode that does not pass the + // IsFoldableOpcode test. If any error occurs during folding, the folder will + // fail with a call to assert. + uint32_t FoldScalars( + SpvOp opcode, + const std::vector& operands) const; + + // Returns the result of performing an operation with the given |opcode| over + // constant vectors with |num_dims| dimensions. Each entry in |operands| is a + // pointer to an analysis::Constant instance, which should've been created + // with the constant manager (See IRContext::get_constant_mgr). + // + // This function iterates through the given vector type constant operands and + // calculates the result for each element of the result vector to return. + // Vectors with longer than 32-bit scalar components are not accepted in this + // function. + // + // It is an error to call this function with an opcode that does not pass the + // IsFoldableOpcode test. If any error occurs during folding, the folder will + // fail with a call to assert. + std::vector FoldVectors( + SpvOp opcode, uint32_t num_dims, + const std::vector& operands) const; + + // Returns true if |opcode| represents an operation handled by FoldScalars or + // FoldVectors. + bool IsFoldableOpcode(SpvOp opcode) const; + + // Returns true if |cst| is supported by FoldScalars and FoldVectors. + bool IsFoldableConstant(const analysis::Constant* cst) const; + + // Returns true if |FoldInstructionToConstant| could fold an instruction whose + // result type is |type_inst|. + bool IsFoldableType(Instruction* type_inst) const; + + // Tries to fold |inst| to a single constant, when the input ids to |inst| + // have been substituted using |id_map|. Returns a pointer to the OpConstant* + // instruction if successful. If necessary, a new constant instruction is + // created and placed in the global values section. + // + // |id_map| is a function that takes one result id and returns another. It + // can be used for things like CCP where it is known that some ids contain a + // constant, but the instruction itself has not been updated yet. This can + // map those ids to the appropriate constants. + Instruction* FoldInstructionToConstant( + Instruction* inst, std::function id_map) const; + // Returns true if |inst| can be folded into a simpler instruction. + // If |inst| can be simplified, |inst| is overwritten with the simplified + // instruction reusing the same result id. + // + // If |inst| is simplified, it is possible that the resulting code in invalid + // because the instruction is in a bad location. Callers of this function + // have to handle the following cases: + // + // 1) An OpPhi becomes and OpCopyObject - If there are OpPhi instruction after + // |inst| in a basic block then this is invalid. The caller must fix this + // up. + bool FoldInstruction(Instruction* inst) const; + + // Return true if this opcode has a const folding rule associtated with it. + bool HasConstFoldingRule(SpvOp opcode) const { + return GetConstantFoldingRules().HasFoldingRule(opcode); + } + + private: + // Returns a reference to the ConstnatFoldingRules instance. + const ConstantFoldingRules& GetConstantFoldingRules() const { + return const_folding_rules; + } + + // Returns a reference to the FoldingRules instance. + const FoldingRules& GetFoldingRules() const { return folding_rules; } + + // Returns the single-word result from performing the given unary operation on + // the operand value which is passed in as a 32-bit word. + uint32_t UnaryOperate(SpvOp opcode, uint32_t operand) const; + + // Returns the single-word result from performing the given binary operation + // on the operand values which are passed in as two 32-bit word. + uint32_t BinaryOperate(SpvOp opcode, uint32_t a, uint32_t b) const; + + // Returns the single-word result from performing the given ternary operation + // on the operand values which are passed in as three 32-bit word. + uint32_t TernaryOperate(SpvOp opcode, uint32_t a, uint32_t b, + uint32_t c) const; + + // Returns the single-word result from performing the given operation on the + // operand words. This only works with 32-bit operations and uses boolean + // convention that 0u is false, and anything else is boolean true. + // TODO(qining): Support operands other than 32-bit wide. + uint32_t OperateWords(SpvOp opcode, + const std::vector& operand_words) const; + + bool FoldInstructionInternal(Instruction* inst) const; + + // Returns true if |inst| is a binary operation that takes two integers as + // parameters and folds to a constant that can be represented as an unsigned + // 32-bit value when the ids have been replaced by |id_map|. If |inst| can be + // folded, the resulting value is returned in |*result|. Valid result types + // for the instruction are any integer (signed or unsigned) with 32-bits or + // less, or a boolean value. + bool FoldBinaryIntegerOpToConstant( + Instruction* inst, const std::function& id_map, + uint32_t* result) const; + + // Returns true if |inst| is a binary operation on two boolean values, and + // folds + // to a constant boolean value when the ids have been replaced using |id_map|. + // If |inst| can be folded, the result value is returned in |*result|. + bool FoldBinaryBooleanOpToConstant( + Instruction* inst, const std::function& id_map, + uint32_t* result) const; + + // Returns true if |inst| can be folded to an constant when the ids have been + // substituted using id_map. If it can, the value is returned in |result|. If + // not, |result| is unchanged. It is assumed that not all operands are + // constant. Those cases are handled by |FoldScalar|. + bool FoldIntegerOpToConstant(Instruction* inst, + const std::function& id_map, + uint32_t* result) const; + + IRContext* context_; + + // Folding rules used by |FoldInstructionToConstant| and |FoldInstruction|. + ConstantFoldingRules const_folding_rules; + + // Folding rules used by |FoldInstruction|. + FoldingRules folding_rules; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FOLD_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp new file mode 100644 index 00000000000..663d112d425 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp @@ -0,0 +1,385 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/fold_spec_constant_op_and_composite_pass.h" + +#include +#include +#include + +#include "source/opt/constants.h" +#include "source/opt/fold.h" +#include "source/opt/ir_context.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +Pass::Status FoldSpecConstantOpAndCompositePass::Process() { + bool modified = false; + // Traverse through all the constant defining instructions. For Normal + // Constants whose values are determined and do not depend on OpUndef + // instructions, records their values in two internal maps: id_to_const_val_ + // and const_val_to_id_ so that we can use them to infer the value of Spec + // Constants later. + // For Spec Constants defined with OpSpecConstantComposite instructions, if + // all of their components are Normal Constants, they will be turned into + // Normal Constants too. For Spec Constants defined with OpSpecConstantOp + // instructions, we check if they only depends on Normal Constants and fold + // them when possible. The two maps for Normal Constants: id_to_const_val_ + // and const_val_to_id_ will be updated along the traversal so that the new + // Normal Constants generated from folding can be used to fold following Spec + // Constants. + // This algorithm depends on the SSA property of SPIR-V when + // defining constants. The dependent constants must be defined before the + // dependee constants. So a dependent Spec Constant must be defined and + // will be processed before its dependee Spec Constant. When we encounter + // the dependee Spec Constants, all its dependent constants must have been + // processed and all its dependent Spec Constants should have been folded if + // possible. + Module::inst_iterator next_inst = context()->types_values_begin(); + for (Module::inst_iterator inst_iter = next_inst; + // Need to re-evaluate the end iterator since we may modify the list of + // instructions in this section of the module as the process goes. + inst_iter != context()->types_values_end(); inst_iter = next_inst) { + ++next_inst; + Instruction* inst = &*inst_iter; + // Collect constant values of normal constants and process the + // OpSpecConstantOp and OpSpecConstantComposite instructions if possible. + // The constant values will be stored in analysis::Constant instances. + // OpConstantSampler instruction is not collected here because it cannot be + // used in OpSpecConstant{Composite|Op} instructions. + // TODO(qining): If the constant or its type has decoration, we may need + // to skip it. + if (context()->get_constant_mgr()->GetType(inst) && + !context()->get_constant_mgr()->GetType(inst)->decoration_empty()) + continue; + switch (SpvOp opcode = inst->opcode()) { + // Records the values of Normal Constants. + case SpvOp::SpvOpConstantTrue: + case SpvOp::SpvOpConstantFalse: + case SpvOp::SpvOpConstant: + case SpvOp::SpvOpConstantNull: + case SpvOp::SpvOpConstantComposite: + case SpvOp::SpvOpSpecConstantComposite: { + // A Constant instance will be created if the given instruction is a + // Normal Constant whose value(s) are fixed. Note that for a composite + // Spec Constant defined with OpSpecConstantComposite instruction, if + // all of its components are Normal Constants already, the Spec + // Constant will be turned in to a Normal Constant. In that case, a + // Constant instance should also be created successfully and recorded + // in the id_to_const_val_ and const_val_to_id_ mapps. + if (auto const_value = + context()->get_constant_mgr()->GetConstantFromInst(inst)) { + // Need to replace the OpSpecConstantComposite instruction with a + // corresponding OpConstantComposite instruction. + if (opcode == SpvOp::SpvOpSpecConstantComposite) { + inst->SetOpcode(SpvOp::SpvOpConstantComposite); + modified = true; + } + context()->get_constant_mgr()->MapConstantToInst(const_value, inst); + } + break; + } + // For a Spec Constants defined with OpSpecConstantOp instruction, check + // if it only depends on Normal Constants. If so, the Spec Constant will + // be folded. The original Spec Constant defining instruction will be + // replaced by Normal Constant defining instructions, and the new Normal + // Constants will be added to id_to_const_val_ and const_val_to_id_ so + // that we can use the new Normal Constants when folding following Spec + // Constants. + case SpvOp::SpvOpSpecConstantOp: + modified |= ProcessOpSpecConstantOp(&inst_iter); + break; + default: + break; + } + } + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool FoldSpecConstantOpAndCompositePass::ProcessOpSpecConstantOp( + Module::inst_iterator* pos) { + Instruction* inst = &**pos; + Instruction* folded_inst = nullptr; + assert(inst->GetInOperand(0).type == + SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER && + "The first in-operand of OpSpecContantOp instruction must be of " + "SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER type"); + + switch (static_cast(inst->GetSingleWordInOperand(0))) { + case SpvOp::SpvOpCompositeExtract: + folded_inst = DoCompositeExtract(pos); + break; + case SpvOp::SpvOpVectorShuffle: + folded_inst = DoVectorShuffle(pos); + break; + + case SpvOp::SpvOpCompositeInsert: + // Current Glslang does not generate code with OpSpecConstantOp + // CompositeInsert instruction, so this is not implmented so far. + // TODO(qining): Implement CompositeInsert case. + return false; + + default: + // Component-wise operations. + folded_inst = DoComponentWiseOperation(pos); + break; + } + if (!folded_inst) return false; + + // Replace the original constant with the new folded constant, kill the + // original constant. + uint32_t new_id = folded_inst->result_id(); + uint32_t old_id = inst->result_id(); + context()->ReplaceAllUsesWith(old_id, new_id); + context()->KillDef(old_id); + return true; +} + +uint32_t FoldSpecConstantOpAndCompositePass::GetTypeComponent( + uint32_t typeId, uint32_t element) const { + Instruction* type = context()->get_def_use_mgr()->GetDef(typeId); + uint32_t subtype = type->GetTypeComponent(element); + assert(subtype != 0); + + return subtype; +} + +Instruction* FoldSpecConstantOpAndCompositePass::DoCompositeExtract( + Module::inst_iterator* pos) { + Instruction* inst = &**pos; + assert(inst->NumInOperands() - 1 >= 2 && + "OpSpecConstantOp CompositeExtract requires at least two non-type " + "non-opcode operands."); + assert(inst->GetInOperand(1).type == SPV_OPERAND_TYPE_ID && + "The composite operand must have a SPV_OPERAND_TYPE_ID type"); + assert( + inst->GetInOperand(2).type == SPV_OPERAND_TYPE_LITERAL_INTEGER && + "The literal operand must have a SPV_OPERAND_TYPE_LITERAL_INTEGER type"); + + // Note that for OpSpecConstantOp, the second in-operand is the first id + // operand. The first in-operand is the spec opcode. + uint32_t source = inst->GetSingleWordInOperand(1); + uint32_t type = context()->get_def_use_mgr()->GetDef(source)->type_id(); + const analysis::Constant* first_operand_const = + context()->get_constant_mgr()->FindDeclaredConstant(source); + if (!first_operand_const) return nullptr; + + const analysis::Constant* current_const = first_operand_const; + for (uint32_t i = 2; i < inst->NumInOperands(); i++) { + uint32_t literal = inst->GetSingleWordInOperand(i); + type = GetTypeComponent(type, literal); + } + for (uint32_t i = 2; i < inst->NumInOperands(); i++) { + uint32_t literal = inst->GetSingleWordInOperand(i); + if (const analysis::CompositeConstant* composite_const = + current_const->AsCompositeConstant()) { + // Case 1: current constant is a non-null composite type constant. + assert(literal < composite_const->GetComponents().size() && + "Literal index out of bound of the composite constant"); + current_const = composite_const->GetComponents().at(literal); + } else if (current_const->AsNullConstant()) { + // Case 2: current constant is a constant created with OpConstantNull. + // Because components of a NullConstant are always NullConstants, we can + // return early with a NullConstant in the result type. + return context()->get_constant_mgr()->BuildInstructionAndAddToModule( + context()->get_constant_mgr()->GetConstant( + context()->get_constant_mgr()->GetType(inst), {}), + pos, type); + } else { + // Dereferencing a non-composite constant. Invalid case. + return nullptr; + } + } + return context()->get_constant_mgr()->BuildInstructionAndAddToModule( + current_const, pos); +} + +Instruction* FoldSpecConstantOpAndCompositePass::DoVectorShuffle( + Module::inst_iterator* pos) { + Instruction* inst = &**pos; + analysis::Vector* result_vec_type = + context()->get_constant_mgr()->GetType(inst)->AsVector(); + assert(inst->NumInOperands() - 1 > 2 && + "OpSpecConstantOp DoVectorShuffle instruction requires more than 2 " + "operands (2 vector ids and at least one literal operand"); + assert(result_vec_type && + "The result of VectorShuffle must be of type vector"); + + // A temporary null constants that can be used as the components of the result + // vector. This is needed when any one of the vector operands are null + // constant. + const analysis::Constant* null_component_constants = nullptr; + + // Get a concatenated vector of scalar constants. The vector should be built + // with the components from the first and the second operand of VectorShuffle. + std::vector concatenated_components; + // Note that for OpSpecConstantOp, the second in-operand is the first id + // operand. The first in-operand is the spec opcode. + for (uint32_t i : {1, 2}) { + assert(inst->GetInOperand(i).type == SPV_OPERAND_TYPE_ID && + "The vector operand must have a SPV_OPERAND_TYPE_ID type"); + uint32_t operand_id = inst->GetSingleWordInOperand(i); + auto operand_const = + context()->get_constant_mgr()->FindDeclaredConstant(operand_id); + if (!operand_const) return nullptr; + const analysis::Type* operand_type = operand_const->type(); + assert(operand_type->AsVector() && + "The first two operand of VectorShuffle must be of vector type"); + if (auto vec_const = operand_const->AsVectorConstant()) { + // case 1: current operand is a non-null vector constant. + concatenated_components.insert(concatenated_components.end(), + vec_const->GetComponents().begin(), + vec_const->GetComponents().end()); + } else if (operand_const->AsNullConstant()) { + // case 2: current operand is a null vector constant. Create a temporary + // null scalar constant as the component. + if (!null_component_constants) { + const analysis::Type* component_type = + operand_type->AsVector()->element_type(); + null_component_constants = + context()->get_constant_mgr()->GetConstant(component_type, {}); + } + // Append the null scalar consts to the concatenated components + // vector. + concatenated_components.insert(concatenated_components.end(), + operand_type->AsVector()->element_count(), + null_component_constants); + } else { + // no other valid cases + return nullptr; + } + } + // Create null component constants if there are any. The component constants + // must be added to the module before the dependee composite constants to + // satisfy SSA def-use dominance. + if (null_component_constants) { + context()->get_constant_mgr()->BuildInstructionAndAddToModule( + null_component_constants, pos); + } + // Create the new vector constant with the selected components. + std::vector selected_components; + for (uint32_t i = 3; i < inst->NumInOperands(); i++) { + assert(inst->GetInOperand(i).type == SPV_OPERAND_TYPE_LITERAL_INTEGER && + "The literal operand must of type SPV_OPERAND_TYPE_LITERAL_INTEGER"); + uint32_t literal = inst->GetSingleWordInOperand(i); + assert(literal < concatenated_components.size() && + "Literal index out of bound of the concatenated vector"); + selected_components.push_back(concatenated_components[literal]); + } + auto new_vec_const = MakeUnique( + result_vec_type, selected_components); + auto reg_vec_const = + context()->get_constant_mgr()->RegisterConstant(std::move(new_vec_const)); + return context()->get_constant_mgr()->BuildInstructionAndAddToModule( + reg_vec_const, pos); +} + +namespace { +// A helper function to check the type for component wise operations. Returns +// true if the type: +// 1) is bool type; +// 2) is 32-bit int type; +// 3) is vector of bool type; +// 4) is vector of 32-bit integer type. +// Otherwise returns false. +bool IsValidTypeForComponentWiseOperation(const analysis::Type* type) { + if (type->AsBool()) { + return true; + } else if (auto* it = type->AsInteger()) { + if (it->width() == 32) return true; + } else if (auto* vt = type->AsVector()) { + if (vt->element_type()->AsBool()) { + return true; + } else if (auto* vit = vt->element_type()->AsInteger()) { + if (vit->width() == 32) return true; + } + } + return false; +} +} // namespace + +Instruction* FoldSpecConstantOpAndCompositePass::DoComponentWiseOperation( + Module::inst_iterator* pos) { + const Instruction* inst = &**pos; + const analysis::Type* result_type = + context()->get_constant_mgr()->GetType(inst); + SpvOp spec_opcode = static_cast(inst->GetSingleWordInOperand(0)); + // Check and collect operands. + std::vector operands; + + if (!std::all_of( + inst->cbegin(), inst->cend(), [&operands, this](const Operand& o) { + // skip the operands that is not an id. + if (o.type != spv_operand_type_t::SPV_OPERAND_TYPE_ID) return true; + uint32_t id = o.words.front(); + if (auto c = + context()->get_constant_mgr()->FindDeclaredConstant(id)) { + if (IsValidTypeForComponentWiseOperation(c->type())) { + operands.push_back(c); + return true; + } + } + return false; + })) + return nullptr; + + if (result_type->AsInteger() || result_type->AsBool()) { + // Scalar operation + uint32_t result_val = + context()->get_instruction_folder().FoldScalars(spec_opcode, operands); + auto result_const = + context()->get_constant_mgr()->GetConstant(result_type, {result_val}); + return context()->get_constant_mgr()->BuildInstructionAndAddToModule( + result_const, pos); + } else if (result_type->AsVector()) { + // Vector operation + const analysis::Type* element_type = + result_type->AsVector()->element_type(); + uint32_t num_dims = result_type->AsVector()->element_count(); + std::vector result_vec = + context()->get_instruction_folder().FoldVectors(spec_opcode, num_dims, + operands); + std::vector result_vector_components; + for (uint32_t r : result_vec) { + if (auto rc = + context()->get_constant_mgr()->GetConstant(element_type, {r})) { + result_vector_components.push_back(rc); + if (!context()->get_constant_mgr()->BuildInstructionAndAddToModule( + rc, pos)) { + assert(false && + "Failed to build and insert constant declaring instruction " + "for the given vector component constant"); + } + } else { + assert(false && "Failed to create constants with 32-bit word"); + } + } + auto new_vec_const = MakeUnique( + result_type->AsVector(), result_vector_components); + auto reg_vec_const = context()->get_constant_mgr()->RegisterConstant( + std::move(new_vec_const)); + return context()->get_constant_mgr()->BuildInstructionAndAddToModule( + reg_vec_const, pos); + } else { + // Cannot process invalid component wise operation. The result of component + // wise operation must be of integer or bool scalar or vector of + // integer/bool type. + return nullptr; + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h new file mode 100644 index 00000000000..16271251f42 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h @@ -0,0 +1,84 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ +#define SOURCE_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ + +#include +#include +#include + +#include "source/opt/constants.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" +#include "source/opt/type_manager.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class FoldSpecConstantOpAndCompositePass : public Pass { + public: + FoldSpecConstantOpAndCompositePass() = default; + + const char* name() const override { return "fold-spec-const-op-composite"; } + + // Iterates through the types-constants-globals section of the given module, + // finds the Spec Constants defined with OpSpecConstantOp and + // OpSpecConstantComposite instructions. If the result value of those spec + // constants can be folded, fold them to their corresponding normal constants. + Status Process() override; + + private: + // Processes the OpSpecConstantOp instruction pointed by the given + // instruction iterator, folds it to normal constants if possible. Returns + // true if the spec constant is folded to normal constants. New instructions + // will be inserted before the OpSpecConstantOp instruction pointed by the + // instruction iterator. The instruction iterator, which is passed by + // pointer, will still point to the original OpSpecConstantOp instruction. If + // folding is done successfully, the original OpSpecConstantOp instruction + // will be changed to Nop and new folded instruction will be inserted before + // it. + bool ProcessOpSpecConstantOp(Module::inst_iterator* pos); + + // Try to fold the OpSpecConstantOp CompositeExtract instruction pointed by + // the given instruction iterator to a normal constant defining instruction. + // Returns the pointer to the new constant defining instruction if succeeded. + // Otherwise returns nullptr. + Instruction* DoCompositeExtract(Module::inst_iterator* inst_iter_ptr); + + // Try to fold the OpSpecConstantOp VectorShuffle instruction pointed by the + // given instruction iterator to a normal constant defining instruction. + // Returns the pointer to the new constant defining instruction if succeeded. + // Otherwise return nullptr. + Instruction* DoVectorShuffle(Module::inst_iterator* inst_iter_ptr); + + // Try to fold the OpSpecConstantOp instruction + // pointed by the given instruction iterator to a normal constant defining + // instruction. Returns the pointer to the new constant defining instruction + // if succeeded, otherwise return nullptr. + Instruction* DoComponentWiseOperation(Module::inst_iterator* inst_iter_ptr); + + // Returns the |element|'th subtype of |type|. + // + // |type| must be a composite type. + uint32_t GetTypeComponent(uint32_t type, uint32_t element) const; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FOLD_SPEC_CONSTANT_OP_AND_COMPOSITE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp new file mode 100644 index 00000000000..c64cedfb193 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.cpp @@ -0,0 +1,2243 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/folding_rules.h" + +#include +#include +#include + +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kExtractCompositeIdInIdx = 0; +const uint32_t kInsertObjectIdInIdx = 0; +const uint32_t kInsertCompositeIdInIdx = 1; +const uint32_t kExtInstSetIdInIdx = 0; +const uint32_t kExtInstInstructionInIdx = 1; +const uint32_t kFMixXIdInIdx = 2; +const uint32_t kFMixYIdInIdx = 3; +const uint32_t kFMixAIdInIdx = 4; +const uint32_t kStoreObjectInIdx = 1; + +// Returns the element width of |type|. +uint32_t ElementWidth(const analysis::Type* type) { + if (const analysis::Vector* vec_type = type->AsVector()) { + return ElementWidth(vec_type->element_type()); + } else if (const analysis::Float* float_type = type->AsFloat()) { + return float_type->width(); + } else { + assert(type->AsInteger()); + return type->AsInteger()->width(); + } +} + +// Returns true if |type| is Float or a vector of Float. +bool HasFloatingPoint(const analysis::Type* type) { + if (type->AsFloat()) { + return true; + } else if (const analysis::Vector* vec_type = type->AsVector()) { + return vec_type->element_type()->AsFloat() != nullptr; + } + + return false; +} + +// Returns false if |val| is NaN, infinite or subnormal. +template +bool IsValidResult(T val) { + int classified = std::fpclassify(val); + switch (classified) { + case FP_NAN: + case FP_INFINITE: + case FP_SUBNORMAL: + return false; + default: + return true; + } +} + +const analysis::Constant* ConstInput( + const std::vector& constants) { + return constants[0] ? constants[0] : constants[1]; +} + +Instruction* NonConstInput(IRContext* context, const analysis::Constant* c, + Instruction* inst) { + uint32_t in_op = c ? 1u : 0u; + return context->get_def_use_mgr()->GetDef( + inst->GetSingleWordInOperand(in_op)); +} + +// Returns the negation of |c|. |c| must be a 32 or 64 bit floating point +// constant. +uint32_t NegateFloatingPointConstant(analysis::ConstantManager* const_mgr, + const analysis::Constant* c) { + assert(c); + assert(c->type()->AsFloat()); + uint32_t width = c->type()->AsFloat()->width(); + assert(width == 32 || width == 64); + std::vector words; + if (width == 64) { + utils::FloatProxy result(c->GetDouble() * -1.0); + words = result.GetWords(); + } else { + utils::FloatProxy result(c->GetFloat() * -1.0f); + words = result.GetWords(); + } + + const analysis::Constant* negated_const = + const_mgr->GetConstant(c->type(), std::move(words)); + return const_mgr->GetDefiningInstruction(negated_const)->result_id(); +} + +std::vector ExtractInts(uint64_t val) { + std::vector words; + words.push_back(static_cast(val)); + words.push_back(static_cast(val >> 32)); + return words; +} + +// Negates the integer constant |c|. Returns the id of the defining instruction. +uint32_t NegateIntegerConstant(analysis::ConstantManager* const_mgr, + const analysis::Constant* c) { + assert(c); + assert(c->type()->AsInteger()); + uint32_t width = c->type()->AsInteger()->width(); + assert(width == 32 || width == 64); + std::vector words; + if (width == 64) { + uint64_t uval = static_cast(0 - c->GetU64()); + words = ExtractInts(uval); + } else { + words.push_back(static_cast(0 - c->GetU32())); + } + + const analysis::Constant* negated_const = + const_mgr->GetConstant(c->type(), std::move(words)); + return const_mgr->GetDefiningInstruction(negated_const)->result_id(); +} + +// Negates the vector constant |c|. Returns the id of the defining instruction. +uint32_t NegateVectorConstant(analysis::ConstantManager* const_mgr, + const analysis::Constant* c) { + assert(const_mgr && c); + assert(c->type()->AsVector()); + if (c->AsNullConstant()) { + // 0.0 vs -0.0 shouldn't matter. + return const_mgr->GetDefiningInstruction(c)->result_id(); + } else { + const analysis::Type* component_type = + c->AsVectorConstant()->component_type(); + std::vector words; + for (auto& comp : c->AsVectorConstant()->GetComponents()) { + if (component_type->AsFloat()) { + words.push_back(NegateFloatingPointConstant(const_mgr, comp)); + } else { + assert(component_type->AsInteger()); + words.push_back(NegateIntegerConstant(const_mgr, comp)); + } + } + + const analysis::Constant* negated_const = + const_mgr->GetConstant(c->type(), std::move(words)); + return const_mgr->GetDefiningInstruction(negated_const)->result_id(); + } +} + +// Negates |c|. Returns the id of the defining instruction. +uint32_t NegateConstant(analysis::ConstantManager* const_mgr, + const analysis::Constant* c) { + if (c->type()->AsVector()) { + return NegateVectorConstant(const_mgr, c); + } else if (c->type()->AsFloat()) { + return NegateFloatingPointConstant(const_mgr, c); + } else { + assert(c->type()->AsInteger()); + return NegateIntegerConstant(const_mgr, c); + } +} + +// Takes the reciprocal of |c|. |c|'s type must be Float or a vector of Float. +// Returns 0 if the reciprocal is NaN, infinite or subnormal. +uint32_t Reciprocal(analysis::ConstantManager* const_mgr, + const analysis::Constant* c) { + assert(const_mgr && c); + assert(c->type()->AsFloat()); + + uint32_t width = c->type()->AsFloat()->width(); + assert(width == 32 || width == 64); + std::vector words; + if (width == 64) { + spvtools::utils::FloatProxy result(1.0 / c->GetDouble()); + if (!IsValidResult(result.getAsFloat())) return 0; + words = result.GetWords(); + } else { + spvtools::utils::FloatProxy result(1.0f / c->GetFloat()); + if (!IsValidResult(result.getAsFloat())) return 0; + words = result.GetWords(); + } + + const analysis::Constant* negated_const = + const_mgr->GetConstant(c->type(), std::move(words)); + return const_mgr->GetDefiningInstruction(negated_const)->result_id(); +} + +// Replaces fdiv where second operand is constant with fmul. +FoldingRule ReciprocalFDiv() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFDiv); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (!inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + if (constants[1] != nullptr) { + uint32_t id = 0; + if (const analysis::VectorConstant* vector_const = + constants[1]->AsVectorConstant()) { + std::vector neg_ids; + for (auto& comp : vector_const->GetComponents()) { + id = Reciprocal(const_mgr, comp); + if (id == 0) return false; + neg_ids.push_back(id); + } + const analysis::Constant* negated_const = + const_mgr->GetConstant(constants[1]->type(), std::move(neg_ids)); + id = const_mgr->GetDefiningInstruction(negated_const)->result_id(); + } else if (constants[1]->AsFloatConstant()) { + id = Reciprocal(const_mgr, constants[1]); + if (id == 0) return false; + } else { + // Don't fold a null constant. + return false; + } + inst->SetOpcode(SpvOpFMul); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0u)}}, + {SPV_OPERAND_TYPE_ID, {id}}}); + return true; + } + + return false; + }; +} + +// Elides consecutive negate instructions. +FoldingRule MergeNegateArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFNegate || inst->opcode() == SpvOpSNegate); + (void)constants; + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (HasFloatingPoint(type) && !inst->IsFloatingPointFoldingAllowed()) + return false; + + Instruction* op_inst = + context->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0u)); + if (HasFloatingPoint(type) && !op_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (op_inst->opcode() == inst->opcode()) { + // Elide negates. + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op_inst->GetSingleWordInOperand(0u)}}}); + return true; + } + + return false; + }; +} + +// Merges negate into a mul or div operation if that operation contains a +// constant operand. +// Cases: +// -(x * 2) = x * -2 +// -(2 * x) = x * -2 +// -(x / 2) = x / -2 +// -(2 / x) = -2 / x +FoldingRule MergeNegateMulDivArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFNegate || inst->opcode() == SpvOpSNegate); + (void)constants; + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (HasFloatingPoint(type) && !inst->IsFloatingPointFoldingAllowed()) + return false; + + Instruction* op_inst = + context->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0u)); + if (HasFloatingPoint(type) && !op_inst->IsFloatingPointFoldingAllowed()) + return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + SpvOp opcode = op_inst->opcode(); + if (opcode == SpvOpFMul || opcode == SpvOpFDiv || opcode == SpvOpIMul || + opcode == SpvOpSDiv || opcode == SpvOpUDiv) { + std::vector op_constants = + const_mgr->GetOperandConstants(op_inst); + // Merge negate into mul or div if one operand is constant. + if (op_constants[0] || op_constants[1]) { + bool zero_is_variable = op_constants[0] == nullptr; + const analysis::Constant* c = ConstInput(op_constants); + uint32_t neg_id = NegateConstant(const_mgr, c); + uint32_t non_const_id = zero_is_variable + ? op_inst->GetSingleWordInOperand(0u) + : op_inst->GetSingleWordInOperand(1u); + // Change this instruction to a mul/div. + inst->SetOpcode(op_inst->opcode()); + if (opcode == SpvOpFDiv || opcode == SpvOpUDiv || opcode == SpvOpSDiv) { + uint32_t op0 = zero_is_variable ? non_const_id : neg_id; + uint32_t op1 = zero_is_variable ? neg_id : non_const_id; + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op0}}, {SPV_OPERAND_TYPE_ID, {op1}}}); + } else { + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {non_const_id}}, + {SPV_OPERAND_TYPE_ID, {neg_id}}}); + } + return true; + } + } + + return false; + }; +} + +// Merges negate into a add or sub operation if that operation contains a +// constant operand. +// Cases: +// -(x + 2) = -2 - x +// -(2 + x) = -2 - x +// -(x - 2) = 2 - x +// -(2 - x) = x - 2 +FoldingRule MergeNegateAddSubArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFNegate || inst->opcode() == SpvOpSNegate); + (void)constants; + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (HasFloatingPoint(type) && !inst->IsFloatingPointFoldingAllowed()) + return false; + + Instruction* op_inst = + context->get_def_use_mgr()->GetDef(inst->GetSingleWordInOperand(0u)); + if (HasFloatingPoint(type) && !op_inst->IsFloatingPointFoldingAllowed()) + return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + if (op_inst->opcode() == SpvOpFAdd || op_inst->opcode() == SpvOpFSub || + op_inst->opcode() == SpvOpIAdd || op_inst->opcode() == SpvOpISub) { + std::vector op_constants = + const_mgr->GetOperandConstants(op_inst); + if (op_constants[0] || op_constants[1]) { + bool zero_is_variable = op_constants[0] == nullptr; + bool is_add = (op_inst->opcode() == SpvOpFAdd) || + (op_inst->opcode() == SpvOpIAdd); + bool swap_operands = !is_add || zero_is_variable; + bool negate_const = is_add; + const analysis::Constant* c = ConstInput(op_constants); + uint32_t const_id = 0; + if (negate_const) { + const_id = NegateConstant(const_mgr, c); + } else { + const_id = zero_is_variable ? op_inst->GetSingleWordInOperand(1u) + : op_inst->GetSingleWordInOperand(0u); + } + + // Swap operands if necessary and make the instruction a subtraction. + uint32_t op0 = + zero_is_variable ? op_inst->GetSingleWordInOperand(0u) : const_id; + uint32_t op1 = + zero_is_variable ? const_id : op_inst->GetSingleWordInOperand(1u); + if (swap_operands) std::swap(op0, op1); + inst->SetOpcode(HasFloatingPoint(type) ? SpvOpFSub : SpvOpISub); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op0}}, {SPV_OPERAND_TYPE_ID, {op1}}}); + return true; + } + } + + return false; + }; +} + +// Returns true if |c| has a zero element. +bool HasZero(const analysis::Constant* c) { + if (c->AsNullConstant()) { + return true; + } + if (const analysis::VectorConstant* vec_const = c->AsVectorConstant()) { + for (auto& comp : vec_const->GetComponents()) + if (HasZero(comp)) return true; + } else { + assert(c->AsScalarConstant()); + return c->AsScalarConstant()->IsZero(); + } + + return false; +} + +// Performs |input1| |opcode| |input2| and returns the merged constant result +// id. Returns 0 if the result is not a valid value. The input types must be +// Float. +uint32_t PerformFloatingPointOperation(analysis::ConstantManager* const_mgr, + SpvOp opcode, + const analysis::Constant* input1, + const analysis::Constant* input2) { + const analysis::Type* type = input1->type(); + assert(type->AsFloat()); + uint32_t width = type->AsFloat()->width(); + assert(width == 32 || width == 64); + std::vector words; +#define FOLD_OP(op) \ + if (width == 64) { \ + utils::FloatProxy val = \ + input1->GetDouble() op input2->GetDouble(); \ + double dval = val.getAsFloat(); \ + if (!IsValidResult(dval)) return 0; \ + words = val.GetWords(); \ + } else { \ + utils::FloatProxy val = input1->GetFloat() op input2->GetFloat(); \ + float fval = val.getAsFloat(); \ + if (!IsValidResult(fval)) return 0; \ + words = val.GetWords(); \ + } + switch (opcode) { + case SpvOpFMul: + FOLD_OP(*); + break; + case SpvOpFDiv: + if (HasZero(input2)) return 0; + FOLD_OP(/); + break; + case SpvOpFAdd: + FOLD_OP(+); + break; + case SpvOpFSub: + FOLD_OP(-); + break; + default: + assert(false && "Unexpected operation"); + break; + } +#undef FOLD_OP + const analysis::Constant* merged_const = const_mgr->GetConstant(type, words); + return const_mgr->GetDefiningInstruction(merged_const)->result_id(); +} + +// Performs |input1| |opcode| |input2| and returns the merged constant result +// id. Returns 0 if the result is not a valid value. The input types must be +// Integers. +uint32_t PerformIntegerOperation(analysis::ConstantManager* const_mgr, + SpvOp opcode, const analysis::Constant* input1, + const analysis::Constant* input2) { + assert(input1->type()->AsInteger()); + const analysis::Integer* type = input1->type()->AsInteger(); + uint32_t width = type->AsInteger()->width(); + assert(width == 32 || width == 64); + std::vector words; +#define FOLD_OP(op) \ + if (width == 64) { \ + if (type->IsSigned()) { \ + int64_t val = input1->GetS64() op input2->GetS64(); \ + words = ExtractInts(static_cast(val)); \ + } else { \ + uint64_t val = input1->GetU64() op input2->GetU64(); \ + words = ExtractInts(val); \ + } \ + } else { \ + if (type->IsSigned()) { \ + int32_t val = input1->GetS32() op input2->GetS32(); \ + words.push_back(static_cast(val)); \ + } else { \ + uint32_t val = input1->GetU32() op input2->GetU32(); \ + words.push_back(val); \ + } \ + } + switch (opcode) { + case SpvOpIMul: + FOLD_OP(*); + break; + case SpvOpSDiv: + case SpvOpUDiv: + assert(false && "Should not merge integer division"); + break; + case SpvOpIAdd: + FOLD_OP(+); + break; + case SpvOpISub: + FOLD_OP(-); + break; + default: + assert(false && "Unexpected operation"); + break; + } +#undef FOLD_OP + const analysis::Constant* merged_const = const_mgr->GetConstant(type, words); + return const_mgr->GetDefiningInstruction(merged_const)->result_id(); +} + +// Performs |input1| |opcode| |input2| and returns the merged constant result +// id. Returns 0 if the result is not a valid value. The input types must be +// Integers, Floats or Vectors of such. +uint32_t PerformOperation(analysis::ConstantManager* const_mgr, SpvOp opcode, + const analysis::Constant* input1, + const analysis::Constant* input2) { + assert(input1 && input2); + assert(input1->type() == input2->type()); + const analysis::Type* type = input1->type(); + std::vector words; + if (const analysis::Vector* vector_type = type->AsVector()) { + const analysis::Type* ele_type = vector_type->element_type(); + for (uint32_t i = 0; i != vector_type->element_count(); ++i) { + uint32_t id = 0; + + const analysis::Constant* input1_comp = nullptr; + if (const analysis::VectorConstant* input1_vector = + input1->AsVectorConstant()) { + input1_comp = input1_vector->GetComponents()[i]; + } else { + assert(input1->AsNullConstant()); + input1_comp = const_mgr->GetConstant(ele_type, {}); + } + + const analysis::Constant* input2_comp = nullptr; + if (const analysis::VectorConstant* input2_vector = + input2->AsVectorConstant()) { + input2_comp = input2_vector->GetComponents()[i]; + } else { + assert(input2->AsNullConstant()); + input2_comp = const_mgr->GetConstant(ele_type, {}); + } + + if (ele_type->AsFloat()) { + id = PerformFloatingPointOperation(const_mgr, opcode, input1_comp, + input2_comp); + } else { + assert(ele_type->AsInteger()); + id = PerformIntegerOperation(const_mgr, opcode, input1_comp, + input2_comp); + } + if (id == 0) return 0; + words.push_back(id); + } + const analysis::Constant* merged_const = + const_mgr->GetConstant(type, words); + return const_mgr->GetDefiningInstruction(merged_const)->result_id(); + } else if (type->AsFloat()) { + return PerformFloatingPointOperation(const_mgr, opcode, input1, input2); + } else { + assert(type->AsInteger()); + return PerformIntegerOperation(const_mgr, opcode, input1, input2); + } +} + +// Merges consecutive multiplies where each contains one constant operand. +// Cases: +// 2 * (x * 2) = x * 4 +// 2 * (2 * x) = x * 4 +// (x * 2) * 2 = x * 4 +// (2 * x) * 2 = x * 4 +FoldingRule MergeMulMulArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFMul || inst->opcode() == SpvOpIMul); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (HasFloatingPoint(type) && !inst->IsFloatingPointFoldingAllowed()) + return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + // Determine the constant input and the variable input in |inst|. + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (HasFloatingPoint(type) && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == inst->opcode()) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + bool other_first_is_variable = other_constants[0] == nullptr; + uint32_t merged_id = PerformOperation(const_mgr, inst->opcode(), + const_input1, const_input2); + if (merged_id == 0) return false; + + uint32_t non_const_id = other_first_is_variable + ? other_inst->GetSingleWordInOperand(0u) + : other_inst->GetSingleWordInOperand(1u); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {non_const_id}}, + {SPV_OPERAND_TYPE_ID, {merged_id}}}); + return true; + } + + return false; + }; +} + +// Merges divides into subsequent multiplies if each instruction contains one +// constant operand. Does not support integer operations. +// Cases: +// 2 * (x / 2) = x * 1 +// 2 * (2 / x) = 4 / x +// (x / 2) * 2 = x * 1 +// (2 / x) * 2 = 4 / x +// (y / x) * x = y +// x * (y / x) = y +FoldingRule MergeMulDivArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFMul); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (!inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + for (uint32_t i = 0; i < 2; i++) { + uint32_t op_id = inst->GetSingleWordInOperand(i); + Instruction* op_inst = def_use_mgr->GetDef(op_id); + if (op_inst->opcode() == SpvOpFDiv) { + if (op_inst->GetSingleWordInOperand(1) == + inst->GetSingleWordInOperand(1 - i)) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op_inst->GetSingleWordInOperand(0)}}}); + return true; + } + } + } + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (!other_inst->IsFloatingPointFoldingAllowed()) return false; + + if (other_inst->opcode() == SpvOpFDiv) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2 || HasZero(const_input2)) return false; + + bool other_first_is_variable = other_constants[0] == nullptr; + // If the variable value is the second operand of the divide, multiply + // the constants together. Otherwise divide the constants. + uint32_t merged_id = PerformOperation( + const_mgr, + other_first_is_variable ? other_inst->opcode() : inst->opcode(), + const_input1, const_input2); + if (merged_id == 0) return false; + + uint32_t non_const_id = other_first_is_variable + ? other_inst->GetSingleWordInOperand(0u) + : other_inst->GetSingleWordInOperand(1u); + + // If the variable value is on the second operand of the div, then this + // operation is a div. Otherwise it should be a multiply. + inst->SetOpcode(other_first_is_variable ? inst->opcode() + : other_inst->opcode()); + if (other_first_is_variable) { + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {non_const_id}}, + {SPV_OPERAND_TYPE_ID, {merged_id}}}); + } else { + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {merged_id}}, + {SPV_OPERAND_TYPE_ID, {non_const_id}}}); + } + return true; + } + + return false; + }; +} + +// Merges multiply of constant and negation. +// Cases: +// (-x) * 2 = x * -2 +// 2 * (-x) = x * -2 +FoldingRule MergeMulNegateArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFMul || inst->opcode() == SpvOpIMul); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpFNegate || + other_inst->opcode() == SpvOpSNegate) { + uint32_t neg_id = NegateConstant(const_mgr, const_input1); + + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {other_inst->GetSingleWordInOperand(0u)}}, + {SPV_OPERAND_TYPE_ID, {neg_id}}}); + return true; + } + + return false; + }; +} + +// Merges consecutive divides if each instruction contains one constant operand. +// Does not support integer division. +// Cases: +// 2 / (x / 2) = 4 / x +// 4 / (2 / x) = 2 * x +// (4 / x) / 2 = 2 / x +// (x / 2) / 2 = x / 4 +FoldingRule MergeDivDivArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFDiv); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (!inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1 || HasZero(const_input1)) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (!other_inst->IsFloatingPointFoldingAllowed()) return false; + + bool first_is_variable = constants[0] == nullptr; + if (other_inst->opcode() == inst->opcode()) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2 || HasZero(const_input2)) return false; + + bool other_first_is_variable = other_constants[0] == nullptr; + + SpvOp merge_op = inst->opcode(); + if (other_first_is_variable) { + // Constants magnify. + merge_op = SpvOpFMul; + } + + // This is an x / (*) case. Swap the inputs. Doesn't harm multiply + // because it is commutative. + if (first_is_variable) std::swap(const_input1, const_input2); + uint32_t merged_id = + PerformOperation(const_mgr, merge_op, const_input1, const_input2); + if (merged_id == 0) return false; + + uint32_t non_const_id = other_first_is_variable + ? other_inst->GetSingleWordInOperand(0u) + : other_inst->GetSingleWordInOperand(1u); + + SpvOp op = inst->opcode(); + if (!first_is_variable && !other_first_is_variable) { + // Effectively div of 1/x, so change to multiply. + op = SpvOpFMul; + } + + uint32_t op1 = merged_id; + uint32_t op2 = non_const_id; + if (first_is_variable && other_first_is_variable) std::swap(op1, op2); + inst->SetOpcode(op); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + return true; + } + + return false; + }; +} + +// Fold multiplies succeeded by divides where each instruction contains a +// constant operand. Does not support integer divide. +// Cases: +// 4 / (x * 2) = 2 / x +// 4 / (2 * x) = 2 / x +// (x * 4) / 2 = x * 2 +// (4 * x) / 2 = x * 2 +// (x * y) / x = y +// (y * x) / x = y +FoldingRule MergeDivMulArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFDiv); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + if (!inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + uint32_t op_id = inst->GetSingleWordInOperand(0); + Instruction* op_inst = def_use_mgr->GetDef(op_id); + + if (op_inst->opcode() == SpvOpFMul) { + for (uint32_t i = 0; i < 2; i++) { + if (op_inst->GetSingleWordInOperand(i) == + inst->GetSingleWordInOperand(1)) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, + {op_inst->GetSingleWordInOperand(1 - i)}}}); + return true; + } + } + } + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1 || HasZero(const_input1)) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (!other_inst->IsFloatingPointFoldingAllowed()) return false; + + bool first_is_variable = constants[0] == nullptr; + if (other_inst->opcode() == SpvOpFMul) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + bool other_first_is_variable = other_constants[0] == nullptr; + + // This is an x / (*) case. Swap the inputs. + if (first_is_variable) std::swap(const_input1, const_input2); + uint32_t merged_id = PerformOperation(const_mgr, inst->opcode(), + const_input1, const_input2); + if (merged_id == 0) return false; + + uint32_t non_const_id = other_first_is_variable + ? other_inst->GetSingleWordInOperand(0u) + : other_inst->GetSingleWordInOperand(1u); + + uint32_t op1 = merged_id; + uint32_t op2 = non_const_id; + if (first_is_variable) std::swap(op1, op2); + + // Convert to multiply + if (first_is_variable) inst->SetOpcode(other_inst->opcode()); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + return true; + } + + return false; + }; +} + +// Fold divides of a constant and a negation. +// Cases: +// (-x) / 2 = x / -2 +// 2 / (-x) = 2 / -x +FoldingRule MergeDivNegateArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFDiv || inst->opcode() == SpvOpSDiv || + inst->opcode() == SpvOpUDiv); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + bool first_is_variable = constants[0] == nullptr; + if (other_inst->opcode() == SpvOpFNegate || + other_inst->opcode() == SpvOpSNegate) { + uint32_t neg_id = NegateConstant(const_mgr, const_input1); + + if (first_is_variable) { + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {other_inst->GetSingleWordInOperand(0u)}}, + {SPV_OPERAND_TYPE_ID, {neg_id}}}); + } else { + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {neg_id}}, + {SPV_OPERAND_TYPE_ID, {other_inst->GetSingleWordInOperand(0u)}}}); + } + return true; + } + + return false; + }; +} + +// Folds addition of a constant and a negation. +// Cases: +// (-x) + 2 = 2 - x +// 2 + (-x) = 2 - x +FoldingRule MergeAddNegateArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpSNegate || + other_inst->opcode() == SpvOpFNegate) { + inst->SetOpcode(HasFloatingPoint(type) ? SpvOpFSub : SpvOpISub); + uint32_t const_id = constants[0] ? inst->GetSingleWordInOperand(0u) + : inst->GetSingleWordInOperand(1u); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {const_id}}, + {SPV_OPERAND_TYPE_ID, {other_inst->GetSingleWordInOperand(0u)}}}); + return true; + } + return false; + }; +} + +// Folds subtraction of a constant and a negation. +// Cases: +// (-x) - 2 = -2 - x +// 2 - (-x) = x + 2 +FoldingRule MergeSubNegateArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFSub || inst->opcode() == SpvOpISub); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpSNegate || + other_inst->opcode() == SpvOpFNegate) { + uint32_t op1 = 0; + uint32_t op2 = 0; + SpvOp opcode = inst->opcode(); + if (constants[0] != nullptr) { + op1 = other_inst->GetSingleWordInOperand(0u); + op2 = inst->GetSingleWordInOperand(0u); + opcode = HasFloatingPoint(type) ? SpvOpFAdd : SpvOpIAdd; + } else { + op1 = NegateConstant(const_mgr, const_input1); + op2 = other_inst->GetSingleWordInOperand(0u); + } + + inst->SetOpcode(opcode); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + return true; + } + return false; + }; +} + +// Folds addition of an addition where each operation has a constant operand. +// Cases: +// (x + 2) + 2 = x + 4 +// (2 + x) + 2 = x + 4 +// 2 + (x + 2) = x + 4 +// 2 + (2 + x) = x + 4 +FoldingRule MergeAddAddArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpFAdd || + other_inst->opcode() == SpvOpIAdd) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + Instruction* non_const_input = + NonConstInput(context, other_constants[0], other_inst); + uint32_t merged_id = PerformOperation(const_mgr, inst->opcode(), + const_input1, const_input2); + if (merged_id == 0) return false; + + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {non_const_input->result_id()}}, + {SPV_OPERAND_TYPE_ID, {merged_id}}}); + return true; + } + return false; + }; +} + +// Folds addition of a subtraction where each operation has a constant operand. +// Cases: +// (x - 2) + 2 = x + 0 +// (2 - x) + 2 = 4 - x +// 2 + (x - 2) = x + 0 +// 2 + (2 - x) = 4 - x +FoldingRule MergeAddSubArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFAdd || inst->opcode() == SpvOpIAdd); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpFSub || + other_inst->opcode() == SpvOpISub) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + bool first_is_variable = other_constants[0] == nullptr; + SpvOp op = inst->opcode(); + uint32_t op1 = 0; + uint32_t op2 = 0; + if (first_is_variable) { + // Subtract constants. Non-constant operand is first. + op1 = other_inst->GetSingleWordInOperand(0u); + op2 = PerformOperation(const_mgr, other_inst->opcode(), const_input1, + const_input2); + } else { + // Add constants. Constant operand is first. Change the opcode. + op1 = PerformOperation(const_mgr, inst->opcode(), const_input1, + const_input2); + op2 = other_inst->GetSingleWordInOperand(1u); + op = other_inst->opcode(); + } + if (op1 == 0 || op2 == 0) return false; + + inst->SetOpcode(op); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + return true; + } + return false; + }; +} + +// Folds subtraction of an addition where each operand has a constant operand. +// Cases: +// (x + 2) - 2 = x + 0 +// (2 + x) - 2 = x + 0 +// 2 - (x + 2) = 0 - x +// 2 - (2 + x) = 0 - x +FoldingRule MergeSubAddArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFSub || inst->opcode() == SpvOpISub); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpFAdd || + other_inst->opcode() == SpvOpIAdd) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + Instruction* non_const_input = + NonConstInput(context, other_constants[0], other_inst); + + // If the first operand of the sub is not a constant, swap the constants + // so the subtraction has the correct operands. + if (constants[0] == nullptr) std::swap(const_input1, const_input2); + // Subtract the constants. + uint32_t merged_id = PerformOperation(const_mgr, inst->opcode(), + const_input1, const_input2); + SpvOp op = inst->opcode(); + uint32_t op1 = 0; + uint32_t op2 = 0; + if (constants[0] == nullptr) { + // Non-constant operand is first. Change the opcode. + op1 = non_const_input->result_id(); + op2 = merged_id; + op = other_inst->opcode(); + } else { + // Constant operand is first. + op1 = merged_id; + op2 = non_const_input->result_id(); + } + if (op1 == 0 || op2 == 0) return false; + + inst->SetOpcode(op); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + return true; + } + return false; + }; +} + +// Folds subtraction of a subtraction where each operand has a constant operand. +// Cases: +// (x - 2) - 2 = x - 4 +// (2 - x) - 2 = 0 - x +// 2 - (x - 2) = 4 - x +// 2 - (2 - x) = x + 0 +FoldingRule MergeSubSubArithmetic() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFSub || inst->opcode() == SpvOpISub); + const analysis::Type* type = + context->get_type_mgr()->GetType(inst->type_id()); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + bool uses_float = HasFloatingPoint(type); + if (uses_float && !inst->IsFloatingPointFoldingAllowed()) return false; + + uint32_t width = ElementWidth(type); + if (width != 32 && width != 64) return false; + + const analysis::Constant* const_input1 = ConstInput(constants); + if (!const_input1) return false; + Instruction* other_inst = NonConstInput(context, constants[0], inst); + if (uses_float && !other_inst->IsFloatingPointFoldingAllowed()) + return false; + + if (other_inst->opcode() == SpvOpFSub || + other_inst->opcode() == SpvOpISub) { + std::vector other_constants = + const_mgr->GetOperandConstants(other_inst); + const analysis::Constant* const_input2 = ConstInput(other_constants); + if (!const_input2) return false; + + Instruction* non_const_input = + NonConstInput(context, other_constants[0], other_inst); + + // Merge the constants. + uint32_t merged_id = 0; + SpvOp merge_op = inst->opcode(); + if (other_constants[0] == nullptr) { + merge_op = uses_float ? SpvOpFAdd : SpvOpIAdd; + } else if (constants[0] == nullptr) { + std::swap(const_input1, const_input2); + } + merged_id = + PerformOperation(const_mgr, merge_op, const_input1, const_input2); + if (merged_id == 0) return false; + + SpvOp op = inst->opcode(); + if (constants[0] != nullptr && other_constants[0] != nullptr) { + // Change the operation. + op = uses_float ? SpvOpFAdd : SpvOpIAdd; + } + + uint32_t op1 = 0; + uint32_t op2 = 0; + if ((constants[0] == nullptr) ^ (other_constants[0] == nullptr)) { + op1 = merged_id; + op2 = non_const_input->result_id(); + } else { + op1 = non_const_input->result_id(); + op2 = merged_id; + } + + inst->SetOpcode(op); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}}); + return true; + } + return false; + }; +} + +FoldingRule IntMultipleBy1() { + return [](IRContext*, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpIMul && "Wrong opcode. Should be OpIMul."); + for (uint32_t i = 0; i < 2; i++) { + if (constants[i] == nullptr) { + continue; + } + const analysis::IntConstant* int_constant = constants[i]->AsIntConstant(); + if (int_constant) { + uint32_t width = ElementWidth(int_constant->type()); + if (width != 32 && width != 64) return false; + bool is_one = (width == 32) ? int_constant->GetU32BitValue() == 1u + : int_constant->GetU64BitValue() == 1ull; + if (is_one) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(1 - i)}}}); + return true; + } + } + } + return false; + }; +} + +FoldingRule CompositeConstructFeedingExtract() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + // If the input to an OpCompositeExtract is an OpCompositeConstruct, + // then we can simply use the appropriate element in the construction. + assert(inst->opcode() == SpvOpCompositeExtract && + "Wrong opcode. Should be OpCompositeExtract."); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + uint32_t cid = inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + Instruction* cinst = def_use_mgr->GetDef(cid); + + if (cinst->opcode() != SpvOpCompositeConstruct) { + return false; + } + + std::vector operands; + analysis::Type* composite_type = type_mgr->GetType(cinst->type_id()); + if (composite_type->AsVector() == nullptr) { + // Get the element being extracted from the OpCompositeConstruct + // Since it is not a vector, it is simple to extract the single element. + uint32_t element_index = inst->GetSingleWordInOperand(1); + uint32_t element_id = cinst->GetSingleWordInOperand(element_index); + operands.push_back({SPV_OPERAND_TYPE_ID, {element_id}}); + + // Add the remaining indices for extraction. + for (uint32_t i = 2; i < inst->NumInOperands(); ++i) { + operands.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, + {inst->GetSingleWordInOperand(i)}}); + } + + } else { + // With vectors we have to handle the case where it is concatenating + // vectors. + assert(inst->NumInOperands() == 2 && + "Expecting a vector of scalar values."); + + uint32_t element_index = inst->GetSingleWordInOperand(1); + for (uint32_t construct_index = 0; + construct_index < cinst->NumInOperands(); ++construct_index) { + uint32_t element_id = cinst->GetSingleWordInOperand(construct_index); + Instruction* element_def = def_use_mgr->GetDef(element_id); + analysis::Vector* element_type = + type_mgr->GetType(element_def->type_id())->AsVector(); + if (element_type) { + uint32_t vector_size = element_type->element_count(); + if (vector_size < element_index) { + // The element we want comes after this vector. + element_index -= vector_size; + } else { + // We want an element of this vector. + operands.push_back({SPV_OPERAND_TYPE_ID, {element_id}}); + operands.push_back( + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {element_index}}); + break; + } + } else { + if (element_index == 0) { + // This is a scalar, and we this is the element we are extracting. + operands.push_back({SPV_OPERAND_TYPE_ID, {element_id}}); + break; + } else { + // Skip over this scalar value. + --element_index; + } + } + } + } + + // If there were no extra indices, then we have the final object. No need + // to extract even more. + if (operands.size() == 1) { + inst->SetOpcode(SpvOpCopyObject); + } + + inst->SetInOperands(std::move(operands)); + return true; + }; +} + +FoldingRule CompositeExtractFeedingConstruct() { + // If the OpCompositeConstruct is simply putting back together elements that + // where extracted from the same souce, we can simlpy reuse the source. + // + // This is a common code pattern because of the way that scalar replacement + // works. + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpCompositeConstruct && + "Wrong opcode. Should be OpCompositeConstruct."); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + uint32_t original_id = 0; + + // Check each element to make sure they are: + // - extractions + // - extracting the same position they are inserting + // - all extract from the same id. + for (uint32_t i = 0; i < inst->NumInOperands(); ++i) { + uint32_t element_id = inst->GetSingleWordInOperand(i); + Instruction* element_inst = def_use_mgr->GetDef(element_id); + + if (element_inst->opcode() != SpvOpCompositeExtract) { + return false; + } + + if (element_inst->NumInOperands() != 2) { + return false; + } + + if (element_inst->GetSingleWordInOperand(1) != i) { + return false; + } + + if (i == 0) { + original_id = + element_inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + } else if (original_id != element_inst->GetSingleWordInOperand( + kExtractCompositeIdInIdx)) { + return false; + } + } + + // The last check it to see that the object being extracted from is the + // correct type. + Instruction* original_inst = def_use_mgr->GetDef(original_id); + if (original_inst->type_id() != inst->type_id()) { + return false; + } + + // Simplify by using the original object. + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {original_id}}}); + return true; + }; +} + +FoldingRule InsertFeedingExtract() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpCompositeExtract && + "Wrong opcode. Should be OpCompositeExtract."); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + uint32_t cid = inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + Instruction* cinst = def_use_mgr->GetDef(cid); + + if (cinst->opcode() != SpvOpCompositeInsert) { + return false; + } + + // Find the first position where the list of insert and extract indicies + // differ, if at all. + uint32_t i; + for (i = 1; i < inst->NumInOperands(); ++i) { + if (i + 1 >= cinst->NumInOperands()) { + break; + } + + if (inst->GetSingleWordInOperand(i) != + cinst->GetSingleWordInOperand(i + 1)) { + break; + } + } + + // We are extracting the element that was inserted. + if (i == inst->NumInOperands() && i + 1 == cinst->NumInOperands()) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, + {cinst->GetSingleWordInOperand(kInsertObjectIdInIdx)}}}); + return true; + } + + // Extracting the value that was inserted along with values for the base + // composite. Cannot do anything. + if (i == inst->NumInOperands()) { + return false; + } + + // Extracting an element of the value that was inserted. Extract from + // that value directly. + if (i + 1 == cinst->NumInOperands()) { + std::vector operands; + operands.push_back( + {SPV_OPERAND_TYPE_ID, + {cinst->GetSingleWordInOperand(kInsertObjectIdInIdx)}}); + for (; i < inst->NumInOperands(); ++i) { + operands.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, + {inst->GetSingleWordInOperand(i)}}); + } + inst->SetInOperands(std::move(operands)); + return true; + } + + // Extracting a value that is disjoint from the element being inserted. + // Rewrite the extract to use the composite input to the insert. + std::vector operands; + operands.push_back( + {SPV_OPERAND_TYPE_ID, + {cinst->GetSingleWordInOperand(kInsertCompositeIdInIdx)}}); + for (i = 1; i < inst->NumInOperands(); ++i) { + operands.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, + {inst->GetSingleWordInOperand(i)}}); + } + inst->SetInOperands(std::move(operands)); + return true; + }; +} + +// When a VectorShuffle is feeding an Extract, we can extract from one of the +// operands of the VectorShuffle. We just need to adjust the index in the +// extract instruction. +FoldingRule VectorShuffleFeedingExtract() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpCompositeExtract && + "Wrong opcode. Should be OpCompositeExtract."); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + uint32_t cid = inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + Instruction* cinst = def_use_mgr->GetDef(cid); + + if (cinst->opcode() != SpvOpVectorShuffle) { + return false; + } + + // Find the size of the first vector operand of the VectorShuffle + Instruction* first_input = + def_use_mgr->GetDef(cinst->GetSingleWordInOperand(0)); + analysis::Type* first_input_type = + type_mgr->GetType(first_input->type_id()); + assert(first_input_type->AsVector() && + "Input to vector shuffle should be vectors."); + uint32_t first_input_size = first_input_type->AsVector()->element_count(); + + // Get index of the element the vector shuffle is placing in the position + // being extracted. + uint32_t new_index = + cinst->GetSingleWordInOperand(2 + inst->GetSingleWordInOperand(1)); + + // Extracting an undefined value so fold this extract into an undef. + const uint32_t undef_literal_value = 0xffffffff; + if (new_index == undef_literal_value) { + inst->SetOpcode(SpvOpUndef); + inst->SetInOperands({}); + return true; + } + + // Get the id of the of the vector the elemtent comes from, and update the + // index if needed. + uint32_t new_vector = 0; + if (new_index < first_input_size) { + new_vector = cinst->GetSingleWordInOperand(0); + } else { + new_vector = cinst->GetSingleWordInOperand(1); + new_index -= first_input_size; + } + + // Update the extract instruction. + inst->SetInOperand(kExtractCompositeIdInIdx, {new_vector}); + inst->SetInOperand(1, {new_index}); + return true; + }; +} + +// When an FMix with is feeding an Extract that extracts an element whose +// corresponding |a| in the FMix is 0 or 1, we can extract from one of the +// operands of the FMix. +FoldingRule FMixFeedingExtract() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpCompositeExtract && + "Wrong opcode. Should be OpCompositeExtract."); + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + + uint32_t composite_id = + inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + Instruction* composite_inst = def_use_mgr->GetDef(composite_id); + + if (composite_inst->opcode() != SpvOpExtInst) { + return false; + } + + uint32_t inst_set_id = + context->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); + + if (composite_inst->GetSingleWordInOperand(kExtInstSetIdInIdx) != + inst_set_id || + composite_inst->GetSingleWordInOperand(kExtInstInstructionInIdx) != + GLSLstd450FMix) { + return false; + } + + // Get the |a| for the FMix instruction. + uint32_t a_id = composite_inst->GetSingleWordInOperand(kFMixAIdInIdx); + std::unique_ptr a(inst->Clone(context)); + a->SetInOperand(kExtractCompositeIdInIdx, {a_id}); + context->get_instruction_folder().FoldInstruction(a.get()); + + if (a->opcode() != SpvOpCopyObject) { + return false; + } + + const analysis::Constant* a_const = + const_mgr->FindDeclaredConstant(a->GetSingleWordInOperand(0)); + + if (!a_const) { + return false; + } + + bool use_x = false; + + assert(a_const->type()->AsFloat()); + double element_value = a_const->GetValueAsDouble(); + if (element_value == 0.0) { + use_x = true; + } else if (element_value == 1.0) { + use_x = false; + } else { + return false; + } + + // Get the id of the of the vector the element comes from. + uint32_t new_vector = 0; + if (use_x) { + new_vector = composite_inst->GetSingleWordInOperand(kFMixXIdInIdx); + } else { + new_vector = composite_inst->GetSingleWordInOperand(kFMixYIdInIdx); + } + + // Update the extract instruction. + inst->SetInOperand(kExtractCompositeIdInIdx, {new_vector}); + return true; + }; +} + +FoldingRule RedundantPhi() { + // An OpPhi instruction where all values are the same or the result of the phi + // itself, can be replaced by the value itself. + return [](IRContext*, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpPhi && "Wrong opcode. Should be OpPhi."); + + uint32_t incoming_value = 0; + + for (uint32_t i = 0; i < inst->NumInOperands(); i += 2) { + uint32_t op_id = inst->GetSingleWordInOperand(i); + if (op_id == inst->result_id()) { + continue; + } + + if (incoming_value == 0) { + incoming_value = op_id; + } else if (op_id != incoming_value) { + // Found two possible value. Can't simplify. + return false; + } + } + + if (incoming_value == 0) { + // Code looks invalid. Don't do anything. + return false; + } + + // We have a single incoming value. Simplify using that value. + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {incoming_value}}}); + return true; + }; +} + +FoldingRule RedundantSelect() { + // An OpSelect instruction where both values are the same or the condition is + // constant can be replaced by one of the values + return [](IRContext*, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpSelect && + "Wrong opcode. Should be OpSelect."); + assert(inst->NumInOperands() == 3); + assert(constants.size() == 3); + + uint32_t true_id = inst->GetSingleWordInOperand(1); + uint32_t false_id = inst->GetSingleWordInOperand(2); + + if (true_id == false_id) { + // Both results are the same, condition doesn't matter + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {true_id}}}); + return true; + } else if (constants[0]) { + const analysis::Type* type = constants[0]->type(); + if (type->AsBool()) { + // Scalar constant value, select the corresponding value. + inst->SetOpcode(SpvOpCopyObject); + if (constants[0]->AsNullConstant() || + !constants[0]->AsBoolConstant()->value()) { + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {false_id}}}); + } else { + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {true_id}}}); + } + return true; + } else { + assert(type->AsVector()); + if (constants[0]->AsNullConstant()) { + // All values come from false id. + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {false_id}}}); + return true; + } else { + // Convert to a vector shuffle. + std::vector ops; + ops.push_back({SPV_OPERAND_TYPE_ID, {true_id}}); + ops.push_back({SPV_OPERAND_TYPE_ID, {false_id}}); + const analysis::VectorConstant* vector_const = + constants[0]->AsVectorConstant(); + uint32_t size = + static_cast(vector_const->GetComponents().size()); + for (uint32_t i = 0; i != size; ++i) { + const analysis::Constant* component = + vector_const->GetComponents()[i]; + if (component->AsNullConstant() || + !component->AsBoolConstant()->value()) { + // Selecting from the false vector which is the second input + // vector to the shuffle. Offset the index by |size|. + ops.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, {i + size}}); + } else { + // Selecting from true vector which is the first input vector to + // the shuffle. + ops.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, {i}}); + } + } + + inst->SetOpcode(SpvOpVectorShuffle); + inst->SetInOperands(std::move(ops)); + return true; + } + } + } + + return false; + }; +} + +enum class FloatConstantKind { Unknown, Zero, One }; + +FloatConstantKind getFloatConstantKind(const analysis::Constant* constant) { + if (constant == nullptr) { + return FloatConstantKind::Unknown; + } + + assert(HasFloatingPoint(constant->type()) && "Unexpected constant type"); + + if (constant->AsNullConstant()) { + return FloatConstantKind::Zero; + } else if (const analysis::VectorConstant* vc = + constant->AsVectorConstant()) { + const std::vector& components = + vc->GetComponents(); + assert(!components.empty()); + + FloatConstantKind kind = getFloatConstantKind(components[0]); + + for (size_t i = 1; i < components.size(); ++i) { + if (getFloatConstantKind(components[i]) != kind) { + return FloatConstantKind::Unknown; + } + } + + return kind; + } else if (const analysis::FloatConstant* fc = constant->AsFloatConstant()) { + if (fc->IsZero()) return FloatConstantKind::Zero; + + uint32_t width = fc->type()->AsFloat()->width(); + if (width != 32 && width != 64) return FloatConstantKind::Unknown; + + double value = (width == 64) ? fc->GetDoubleValue() : fc->GetFloatValue(); + + if (value == 0.0) { + return FloatConstantKind::Zero; + } else if (value == 1.0) { + return FloatConstantKind::One; + } else { + return FloatConstantKind::Unknown; + } + } else { + return FloatConstantKind::Unknown; + } +} + +FoldingRule RedundantFAdd() { + return [](IRContext*, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFAdd && "Wrong opcode. Should be OpFAdd."); + assert(constants.size() == 2); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + FloatConstantKind kind0 = getFloatConstantKind(constants[0]); + FloatConstantKind kind1 = getFloatConstantKind(constants[1]); + + if (kind0 == FloatConstantKind::Zero || kind1 == FloatConstantKind::Zero) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, + {inst->GetSingleWordInOperand( + kind0 == FloatConstantKind::Zero ? 1 : 0)}}}); + return true; + } + + return false; + }; +} + +FoldingRule RedundantFSub() { + return [](IRContext*, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFSub && "Wrong opcode. Should be OpFSub."); + assert(constants.size() == 2); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + FloatConstantKind kind0 = getFloatConstantKind(constants[0]); + FloatConstantKind kind1 = getFloatConstantKind(constants[1]); + + if (kind0 == FloatConstantKind::Zero) { + inst->SetOpcode(SpvOpFNegate); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(1)}}}); + return true; + } + + if (kind1 == FloatConstantKind::Zero) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); + return true; + } + + return false; + }; +} + +FoldingRule RedundantFMul() { + return [](IRContext*, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFMul && "Wrong opcode. Should be OpFMul."); + assert(constants.size() == 2); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + FloatConstantKind kind0 = getFloatConstantKind(constants[0]); + FloatConstantKind kind1 = getFloatConstantKind(constants[1]); + + if (kind0 == FloatConstantKind::Zero || kind1 == FloatConstantKind::Zero) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, + {inst->GetSingleWordInOperand( + kind0 == FloatConstantKind::Zero ? 0 : 1)}}}); + return true; + } + + if (kind0 == FloatConstantKind::One || kind1 == FloatConstantKind::One) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, + {inst->GetSingleWordInOperand( + kind0 == FloatConstantKind::One ? 1 : 0)}}}); + return true; + } + + return false; + }; +} + +FoldingRule RedundantFDiv() { + return [](IRContext*, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpFDiv && "Wrong opcode. Should be OpFDiv."); + assert(constants.size() == 2); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + FloatConstantKind kind0 = getFloatConstantKind(constants[0]); + FloatConstantKind kind1 = getFloatConstantKind(constants[1]); + + if (kind0 == FloatConstantKind::Zero) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); + return true; + } + + if (kind1 == FloatConstantKind::One) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(0)}}}); + return true; + } + + return false; + }; +} + +FoldingRule RedundantFMix() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpExtInst && + "Wrong opcode. Should be OpExtInst."); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + uint32_t instSetId = + context->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); + + if (inst->GetSingleWordInOperand(kExtInstSetIdInIdx) == instSetId && + inst->GetSingleWordInOperand(kExtInstInstructionInIdx) == + GLSLstd450FMix) { + assert(constants.size() == 5); + + FloatConstantKind kind4 = getFloatConstantKind(constants[4]); + + if (kind4 == FloatConstantKind::Zero || kind4 == FloatConstantKind::One) { + inst->SetOpcode(SpvOpCopyObject); + inst->SetInOperands( + {{SPV_OPERAND_TYPE_ID, + {inst->GetSingleWordInOperand(kind4 == FloatConstantKind::Zero + ? kFMixXIdInIdx + : kFMixYIdInIdx)}}}); + return true; + } + } + + return false; + }; +} + +// This rule handles addition of zero for integers. +FoldingRule RedundantIAdd() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpIAdd && "Wrong opcode. Should be OpIAdd."); + + uint32_t operand = std::numeric_limits::max(); + const analysis::Type* operand_type = nullptr; + if (constants[0] && constants[0]->IsZero()) { + operand = inst->GetSingleWordInOperand(1); + operand_type = constants[0]->type(); + } else if (constants[1] && constants[1]->IsZero()) { + operand = inst->GetSingleWordInOperand(0); + operand_type = constants[1]->type(); + } + + if (operand != std::numeric_limits::max()) { + const analysis::Type* inst_type = + context->get_type_mgr()->GetType(inst->type_id()); + if (inst_type->IsSame(operand_type)) { + inst->SetOpcode(SpvOpCopyObject); + } else { + inst->SetOpcode(SpvOpBitcast); + } + inst->SetInOperands({{SPV_OPERAND_TYPE_ID, {operand}}}); + return true; + } + return false; + }; +} + +// This rule look for a dot with a constant vector containing a single 1 and +// the rest 0s. This is the same as doing an extract. +FoldingRule DotProductDoingExtract() { + return [](IRContext* context, Instruction* inst, + const std::vector& constants) { + assert(inst->opcode() == SpvOpDot && "Wrong opcode. Should be OpDot."); + + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + + if (!inst->IsFloatingPointFoldingAllowed()) { + return false; + } + + for (int i = 0; i < 2; ++i) { + if (!constants[i]) { + continue; + } + + const analysis::Vector* vector_type = constants[i]->type()->AsVector(); + assert(vector_type && "Inputs to OpDot must be vectors."); + const analysis::Float* element_type = + vector_type->element_type()->AsFloat(); + assert(element_type && "Inputs to OpDot must be vectors of floats."); + uint32_t element_width = element_type->width(); + if (element_width != 32 && element_width != 64) { + return false; + } + + std::vector components; + components = constants[i]->GetVectorComponents(const_mgr); + + const uint32_t kNotFound = std::numeric_limits::max(); + + uint32_t component_with_one = kNotFound; + bool all_others_zero = true; + for (uint32_t j = 0; j < components.size(); ++j) { + const analysis::Constant* element = components[j]; + double value = + (element_width == 32 ? element->GetFloat() : element->GetDouble()); + if (value == 0.0) { + continue; + } else if (value == 1.0) { + if (component_with_one == kNotFound) { + component_with_one = j; + } else { + component_with_one = kNotFound; + break; + } + } else { + all_others_zero = false; + break; + } + } + + if (!all_others_zero || component_with_one == kNotFound) { + continue; + } + + std::vector operands; + operands.push_back( + {SPV_OPERAND_TYPE_ID, {inst->GetSingleWordInOperand(1u - i)}}); + operands.push_back( + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {component_with_one}}); + + inst->SetOpcode(SpvOpCompositeExtract); + inst->SetInOperands(std::move(operands)); + return true; + } + return false; + }; +} + +// If we are storing an undef, then we can remove the store. +// +// TODO: We can do something similar for OpImageWrite, but checking for volatile +// is complicated. Waiting to see if it is needed. +FoldingRule StoringUndef() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpStore && "Wrong opcode. Should be OpStore."); + + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + + // If this is a volatile store, the store cannot be removed. + if (inst->NumInOperands() == 3) { + if (inst->GetSingleWordInOperand(3) & SpvMemoryAccessVolatileMask) { + return false; + } + } + + uint32_t object_id = inst->GetSingleWordInOperand(kStoreObjectInIdx); + Instruction* object_inst = def_use_mgr->GetDef(object_id); + if (object_inst->opcode() == SpvOpUndef) { + inst->ToNop(); + return true; + } + return false; + }; +} + +FoldingRule VectorShuffleFeedingShuffle() { + return [](IRContext* context, Instruction* inst, + const std::vector&) { + assert(inst->opcode() == SpvOpVectorShuffle && + "Wrong opcode. Should be OpVectorShuffle."); + + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context->get_type_mgr(); + + Instruction* feeding_shuffle_inst = + def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + analysis::Vector* op0_type = + type_mgr->GetType(feeding_shuffle_inst->type_id())->AsVector(); + uint32_t op0_length = op0_type->element_count(); + + bool feeder_is_op0 = true; + if (feeding_shuffle_inst->opcode() != SpvOpVectorShuffle) { + feeding_shuffle_inst = + def_use_mgr->GetDef(inst->GetSingleWordInOperand(1)); + feeder_is_op0 = false; + } + + if (feeding_shuffle_inst->opcode() != SpvOpVectorShuffle) { + return false; + } + + Instruction* feeder2 = + def_use_mgr->GetDef(feeding_shuffle_inst->GetSingleWordInOperand(0)); + analysis::Vector* feeder_op0_type = + type_mgr->GetType(feeder2->type_id())->AsVector(); + uint32_t feeder_op0_length = feeder_op0_type->element_count(); + + uint32_t new_feeder_id = 0; + std::vector new_operands; + new_operands.resize( + 2, {SPV_OPERAND_TYPE_ID, {0}}); // Place holders for vector operands. + const uint32_t undef_literal = 0xffffffff; + for (uint32_t op = 2; op < inst->NumInOperands(); ++op) { + uint32_t component_index = inst->GetSingleWordInOperand(op); + + // Do not interpret the undefined value literal as coming from operand 1. + if (component_index != undef_literal && + feeder_is_op0 == (component_index < op0_length)) { + // This component comes from the feeding_shuffle_inst. Update + // |component_index| to be the index into the operand of the feeder. + + // Adjust component_index to get the index into the operands of the + // feeding_shuffle_inst. + if (component_index >= op0_length) { + component_index -= op0_length; + } + component_index = + feeding_shuffle_inst->GetSingleWordInOperand(component_index + 2); + + // Check if we are using a component from the first or second operand of + // the feeding instruction. + if (component_index < feeder_op0_length) { + if (new_feeder_id == 0) { + // First time through, save the id of the operand the element comes + // from. + new_feeder_id = feeding_shuffle_inst->GetSingleWordInOperand(0); + } else if (new_feeder_id != + feeding_shuffle_inst->GetSingleWordInOperand(0)) { + // We need both elements of the feeding_shuffle_inst, so we cannot + // fold. + return false; + } + } else { + if (new_feeder_id == 0) { + // First time through, save the id of the operand the element comes + // from. + new_feeder_id = feeding_shuffle_inst->GetSingleWordInOperand(1); + } else if (new_feeder_id != + feeding_shuffle_inst->GetSingleWordInOperand(1)) { + // We need both elements of the feeding_shuffle_inst, so we cannot + // fold. + return false; + } + component_index -= feeder_op0_length; + } + + if (!feeder_is_op0) { + component_index += op0_length; + } + } + new_operands.push_back( + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {component_index}}); + } + + if (new_feeder_id == 0) { + analysis::ConstantManager* const_mgr = context->get_constant_mgr(); + const analysis::Type* type = + type_mgr->GetType(feeding_shuffle_inst->type_id()); + const analysis::Constant* null_const = const_mgr->GetConstant(type, {}); + new_feeder_id = + const_mgr->GetDefiningInstruction(null_const, 0)->result_id(); + } + + if (feeder_is_op0) { + // If the size of the first vector operand changed then the indices + // referring to the second operand need to be adjusted. + Instruction* new_feeder_inst = def_use_mgr->GetDef(new_feeder_id); + analysis::Type* new_feeder_type = + type_mgr->GetType(new_feeder_inst->type_id()); + uint32_t new_op0_size = new_feeder_type->AsVector()->element_count(); + int32_t adjustment = op0_length - new_op0_size; + + if (adjustment != 0) { + for (uint32_t i = 2; i < new_operands.size(); i++) { + if (inst->GetSingleWordInOperand(i) >= op0_length) { + new_operands[i].words[0] -= adjustment; + } + } + } + + new_operands[0].words[0] = new_feeder_id; + new_operands[1] = inst->GetInOperand(1); + } else { + new_operands[1].words[0] = new_feeder_id; + new_operands[0] = inst->GetInOperand(0); + } + + inst->SetInOperands(std::move(new_operands)); + return true; + }; +} + +} // namespace + +FoldingRules::FoldingRules() { + // Add all folding rules to the list for the opcodes to which they apply. + // Note that the order in which rules are added to the list matters. If a rule + // applies to the instruction, the rest of the rules will not be attempted. + // Take that into consideration. + rules_[SpvOpCompositeConstruct].push_back(CompositeExtractFeedingConstruct()); + + rules_[SpvOpCompositeExtract].push_back(InsertFeedingExtract()); + rules_[SpvOpCompositeExtract].push_back(CompositeConstructFeedingExtract()); + rules_[SpvOpCompositeExtract].push_back(VectorShuffleFeedingExtract()); + rules_[SpvOpCompositeExtract].push_back(FMixFeedingExtract()); + + rules_[SpvOpDot].push_back(DotProductDoingExtract()); + + rules_[SpvOpExtInst].push_back(RedundantFMix()); + + rules_[SpvOpFAdd].push_back(RedundantFAdd()); + rules_[SpvOpFAdd].push_back(MergeAddNegateArithmetic()); + rules_[SpvOpFAdd].push_back(MergeAddAddArithmetic()); + rules_[SpvOpFAdd].push_back(MergeAddSubArithmetic()); + + rules_[SpvOpFDiv].push_back(RedundantFDiv()); + rules_[SpvOpFDiv].push_back(ReciprocalFDiv()); + rules_[SpvOpFDiv].push_back(MergeDivDivArithmetic()); + rules_[SpvOpFDiv].push_back(MergeDivMulArithmetic()); + rules_[SpvOpFDiv].push_back(MergeDivNegateArithmetic()); + + rules_[SpvOpFMul].push_back(RedundantFMul()); + rules_[SpvOpFMul].push_back(MergeMulMulArithmetic()); + rules_[SpvOpFMul].push_back(MergeMulDivArithmetic()); + rules_[SpvOpFMul].push_back(MergeMulNegateArithmetic()); + + rules_[SpvOpFNegate].push_back(MergeNegateArithmetic()); + rules_[SpvOpFNegate].push_back(MergeNegateAddSubArithmetic()); + rules_[SpvOpFNegate].push_back(MergeNegateMulDivArithmetic()); + + rules_[SpvOpFSub].push_back(RedundantFSub()); + rules_[SpvOpFSub].push_back(MergeSubNegateArithmetic()); + rules_[SpvOpFSub].push_back(MergeSubAddArithmetic()); + rules_[SpvOpFSub].push_back(MergeSubSubArithmetic()); + + rules_[SpvOpIAdd].push_back(RedundantIAdd()); + rules_[SpvOpIAdd].push_back(MergeAddNegateArithmetic()); + rules_[SpvOpIAdd].push_back(MergeAddAddArithmetic()); + rules_[SpvOpIAdd].push_back(MergeAddSubArithmetic()); + + rules_[SpvOpIMul].push_back(IntMultipleBy1()); + rules_[SpvOpIMul].push_back(MergeMulMulArithmetic()); + rules_[SpvOpIMul].push_back(MergeMulNegateArithmetic()); + + rules_[SpvOpISub].push_back(MergeSubNegateArithmetic()); + rules_[SpvOpISub].push_back(MergeSubAddArithmetic()); + rules_[SpvOpISub].push_back(MergeSubSubArithmetic()); + + rules_[SpvOpPhi].push_back(RedundantPhi()); + + rules_[SpvOpSDiv].push_back(MergeDivNegateArithmetic()); + + rules_[SpvOpSNegate].push_back(MergeNegateArithmetic()); + rules_[SpvOpSNegate].push_back(MergeNegateMulDivArithmetic()); + rules_[SpvOpSNegate].push_back(MergeNegateAddSubArithmetic()); + + rules_[SpvOpSelect].push_back(RedundantSelect()); + + rules_[SpvOpStore].push_back(StoringUndef()); + + rules_[SpvOpUDiv].push_back(MergeDivNegateArithmetic()); + + rules_[SpvOpVectorShuffle].push_back(VectorShuffleFeedingShuffle()); +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h new file mode 100644 index 00000000000..33fdbffe94b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/folding_rules.h @@ -0,0 +1,79 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_FOLDING_RULES_H_ +#define SOURCE_OPT_FOLDING_RULES_H_ + +#include +#include +#include + +#include "source/opt/constants.h" + +namespace spvtools { +namespace opt { + +// Folding Rules: +// +// The folding mechanism is built around the concept of a |FoldingRule|. A +// folding rule is a function that implements a method of simplifying an +// instruction. +// +// The inputs to a folding rule are: +// |inst| - the instruction to be simplified. +// |constants| - if an in-operands is an id of a constant, then the +// corresponding value in |constants| contains that +// constant value. Otherwise, the corresponding entry in +// |constants| is |nullptr|. +// +// A folding rule returns true if |inst| can be simplified using this rule. If +// the instruction can be simplified, then |inst| is changed to the simplified +// instruction. Otherwise, |inst| remains the same. +// +// See folding_rules.cpp for examples on how to write a folding rule. It is +// important to note that if |inst| can be folded to the result of an +// instruction that feed it, then |inst| should be changed to an OpCopyObject +// that copies that id. +// +// Be sure to add new folding rules to the table of folding rules in the +// constructor for FoldingRules. The new rule should be added to the list for +// every opcode that it applies to. Note that earlier rules in the list are +// given priority. That is, if an earlier rule is able to fold an instruction, +// the later rules will not be attempted. + +using FoldingRule = std::function& constants)>; + +class FoldingRules { + public: + FoldingRules(); + + const std::vector& GetRulesForOpcode(SpvOp opcode) const { + auto it = rules_.find(opcode); + if (it != rules_.end()) { + return it->second; + } + return empty_vector_; + } + + private: + std::unordered_map> rules_; + std::vector empty_vector_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FOLDING_RULES_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp new file mode 100644 index 00000000000..10e98fd8b79 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp @@ -0,0 +1,53 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/freeze_spec_constant_value_pass.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status FreezeSpecConstantValuePass::Process() { + bool modified = false; + auto ctx = context(); + ctx->module()->ForEachInst([&modified, ctx](Instruction* inst) { + switch (inst->opcode()) { + case SpvOp::SpvOpSpecConstant: + inst->SetOpcode(SpvOp::SpvOpConstant); + modified = true; + break; + case SpvOp::SpvOpSpecConstantTrue: + inst->SetOpcode(SpvOp::SpvOpConstantTrue); + modified = true; + break; + case SpvOp::SpvOpSpecConstantFalse: + inst->SetOpcode(SpvOp::SpvOpConstantFalse); + modified = true; + break; + case SpvOp::SpvOpDecorate: + if (inst->GetSingleWordInOperand(1) == + SpvDecoration::SpvDecorationSpecId) { + ctx->KillInst(inst); + modified = true; + } + break; + default: + break; + } + }); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.h new file mode 100644 index 00000000000..0663adf401c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/freeze_spec_constant_value_pass.h @@ -0,0 +1,35 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ +#define SOURCE_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class FreezeSpecConstantValuePass : public Pass { + public: + const char* name() const override { return "freeze-spec-const"; } + Status Process() override; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FREEZE_SPEC_CONSTANT_VALUE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/function.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/function.cpp new file mode 100644 index 00000000000..c6894c68102 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/function.cpp @@ -0,0 +1,109 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/function.h" + +#include +#include + +namespace spvtools { +namespace opt { + +Function* Function::Clone(IRContext* ctx) const { + Function* clone = + new Function(std::unique_ptr(DefInst().Clone(ctx))); + clone->params_.reserve(params_.size()); + ForEachParam( + [clone, ctx](const Instruction* inst) { + clone->AddParameter(std::unique_ptr(inst->Clone(ctx))); + }, + true); + + clone->blocks_.reserve(blocks_.size()); + for (const auto& b : blocks_) { + std::unique_ptr bb(b->Clone(ctx)); + bb->SetParent(clone); + clone->AddBasicBlock(std::move(bb)); + } + + clone->SetFunctionEnd(std::unique_ptr(EndInst()->Clone(ctx))); + return clone; +} + +void Function::ForEachInst(const std::function& f, + bool run_on_debug_line_insts) { + if (def_inst_) def_inst_->ForEachInst(f, run_on_debug_line_insts); + for (auto& param : params_) param->ForEachInst(f, run_on_debug_line_insts); + for (auto& bb : blocks_) bb->ForEachInst(f, run_on_debug_line_insts); + if (end_inst_) end_inst_->ForEachInst(f, run_on_debug_line_insts); +} + +void Function::ForEachInst(const std::function& f, + bool run_on_debug_line_insts) const { + if (def_inst_) + static_cast(def_inst_.get()) + ->ForEachInst(f, run_on_debug_line_insts); + + for (const auto& param : params_) + static_cast(param.get()) + ->ForEachInst(f, run_on_debug_line_insts); + + for (const auto& bb : blocks_) + static_cast(bb.get())->ForEachInst( + f, run_on_debug_line_insts); + + if (end_inst_) + static_cast(end_inst_.get()) + ->ForEachInst(f, run_on_debug_line_insts); +} + +void Function::ForEachParam(const std::function& f, + bool run_on_debug_line_insts) const { + for (const auto& param : params_) + static_cast(param.get()) + ->ForEachInst(f, run_on_debug_line_insts); +} + +BasicBlock* Function::InsertBasicBlockAfter( + std::unique_ptr&& new_block, BasicBlock* position) { + for (auto bb_iter = begin(); bb_iter != end(); ++bb_iter) { + if (&*bb_iter == position) { + new_block->SetParent(this); + ++bb_iter; + bb_iter = bb_iter.InsertBefore(std::move(new_block)); + return &*bb_iter; + } + } + assert(false && "Could not find insertion point."); + return nullptr; +} + +std::ostream& operator<<(std::ostream& str, const Function& func) { + str << func.PrettyPrint(); + return str; +} + +std::string Function::PrettyPrint(uint32_t options) const { + std::ostringstream str; + ForEachInst([&str, options](const Instruction* inst) { + str << inst->PrettyPrint(options); + if (inst->opcode() != SpvOpFunctionEnd) { + str << std::endl; + } + }); + return str.str(); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/function.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/function.h new file mode 100644 index 00000000000..4dc5d25a69e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/function.h @@ -0,0 +1,190 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_FUNCTION_H_ +#define SOURCE_OPT_FUNCTION_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +class CFG; +class IRContext; +class Module; + +// A SPIR-V function. +class Function { + public: + using iterator = UptrVectorIterator; + using const_iterator = UptrVectorIterator; + + // Creates a function instance declared by the given OpFunction instruction + // |def_inst|. + inline explicit Function(std::unique_ptr def_inst); + + explicit Function(const Function& f) = delete; + + // Creates a clone of the instruction in the given |context| + // + // The parent module will default to null and needs to be explicitly set by + // the user. + Function* Clone(IRContext*) const; + // The OpFunction instruction that begins the definition of this function. + Instruction& DefInst() { return *def_inst_; } + const Instruction& DefInst() const { return *def_inst_; } + + // Appends a parameter to this function. + inline void AddParameter(std::unique_ptr p); + // Appends a basic block to this function. + inline void AddBasicBlock(std::unique_ptr b); + // Appends a basic block to this function at the position |ip|. + inline void AddBasicBlock(std::unique_ptr b, iterator ip); + template + inline void AddBasicBlocks(T begin, T end, iterator ip); + + // Move basic block with |id| to the position after |ip|. Both have to be + // contained in this function. + inline void MoveBasicBlockToAfter(uint32_t id, BasicBlock* ip); + + // Delete all basic blocks that contain no instructions. + inline void RemoveEmptyBlocks(); + + // Saves the given function end instruction. + inline void SetFunctionEnd(std::unique_ptr end_inst); + + // Returns the given function end instruction. + inline Instruction* EndInst() { return end_inst_.get(); } + inline const Instruction* EndInst() const { return end_inst_.get(); } + + // Returns function's id + inline uint32_t result_id() const { return def_inst_->result_id(); } + + // Returns function's return type id + inline uint32_t type_id() const { return def_inst_->type_id(); } + + // Returns the entry basic block for this function. + const std::unique_ptr& entry() const { return blocks_.front(); } + + iterator begin() { return iterator(&blocks_, blocks_.begin()); } + iterator end() { return iterator(&blocks_, blocks_.end()); } + const_iterator begin() const { return cbegin(); } + const_iterator end() const { return cend(); } + const_iterator cbegin() const { + return const_iterator(&blocks_, blocks_.cbegin()); + } + const_iterator cend() const { + return const_iterator(&blocks_, blocks_.cend()); + } + + // Returns an iterator to the basic block |id|. + iterator FindBlock(uint32_t bb_id) { + return std::find_if(begin(), end(), [bb_id](const BasicBlock& it_bb) { + return bb_id == it_bb.id(); + }); + } + + // Runs the given function |f| on each instruction in this function, and + // optionally on debug line instructions that might precede them. + void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false); + void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false) const; + + // Runs the given function |f| on each parameter instruction in this function, + // and optionally on debug line instructions that might precede them. + void ForEachParam(const std::function& f, + bool run_on_debug_line_insts = false) const; + + BasicBlock* InsertBasicBlockAfter(std::unique_ptr&& new_block, + BasicBlock* position); + + // Pretty-prints all the basic blocks in this function into a std::string. + // + // |options| are the disassembly options. SPV_BINARY_TO_TEXT_OPTION_NO_HEADER + // is always added to |options|. + std::string PrettyPrint(uint32_t options = 0u) const; + + private: + // The OpFunction instruction that begins the definition of this function. + std::unique_ptr def_inst_; + // All parameters to this function. + std::vector> params_; + // All basic blocks inside this function in specification order + std::vector> blocks_; + // The OpFunctionEnd instruction. + std::unique_ptr end_inst_; +}; + +// Pretty-prints |func| to |str|. Returns |str|. +std::ostream& operator<<(std::ostream& str, const Function& func); + +inline Function::Function(std::unique_ptr def_inst) + : def_inst_(std::move(def_inst)), end_inst_() {} + +inline void Function::AddParameter(std::unique_ptr p) { + params_.emplace_back(std::move(p)); +} + +inline void Function::AddBasicBlock(std::unique_ptr b) { + AddBasicBlock(std::move(b), end()); +} + +inline void Function::AddBasicBlock(std::unique_ptr b, + iterator ip) { + ip.InsertBefore(std::move(b)); +} + +template +inline void Function::AddBasicBlocks(T src_begin, T src_end, iterator ip) { + blocks_.insert(ip.Get(), std::make_move_iterator(src_begin), + std::make_move_iterator(src_end)); +} + +inline void Function::MoveBasicBlockToAfter(uint32_t id, BasicBlock* ip) { + auto block_to_move = std::move(*FindBlock(id).Get()); + + assert(block_to_move->GetParent() == ip->GetParent() && + "Both blocks have to be in the same function."); + + InsertBasicBlockAfter(std::move(block_to_move), ip); + blocks_.erase(std::find(std::begin(blocks_), std::end(blocks_), nullptr)); +} + +inline void Function::RemoveEmptyBlocks() { + auto first_empty = + std::remove_if(std::begin(blocks_), std::end(blocks_), + [](const std::unique_ptr& bb) -> bool { + return bb->GetLabelInst()->opcode() == SpvOpNop; + }); + blocks_.erase(first_empty, std::end(blocks_)); +} + +inline void Function::SetFunctionEnd(std::unique_ptr end_inst) { + end_inst_ = std::move(end_inst); +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_FUNCTION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp new file mode 100644 index 00000000000..7a3717f9851 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.cpp @@ -0,0 +1,278 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/if_conversion.h" + +#include +#include + +#include "source/opt/value_number_table.h" + +namespace spvtools { +namespace opt { + +Pass::Status IfConversion::Process() { + const ValueNumberTable& vn_table = *context()->GetValueNumberTable(); + bool modified = false; + std::vector to_kill; + for (auto& func : *get_module()) { + DominatorAnalysis* dominators = context()->GetDominatorAnalysis(&func); + for (auto& block : func) { + // Check if it is possible for |block| to have phis that can be + // transformed. + BasicBlock* common = nullptr; + if (!CheckBlock(&block, dominators, &common)) continue; + + // Get an insertion point. + auto iter = block.begin(); + while (iter != block.end() && iter->opcode() == SpvOpPhi) { + ++iter; + } + + InstructionBuilder builder( + context(), &*iter, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + block.ForEachPhiInst([this, &builder, &modified, &common, &to_kill, + dominators, &block, &vn_table](Instruction* phi) { + // This phi is not compatible, but subsequent phis might be. + if (!CheckType(phi->type_id())) return; + + // We cannot transform cases where the phi is used by another phi in the + // same block due to instruction ordering restrictions. + // TODO(alan-baker): If all inappropriate uses could also be + // transformed, we could still remove this phi. + if (!CheckPhiUsers(phi, &block)) return; + + // Identify the incoming values associated with the true and false + // branches. If |then_block| dominates |inc0| or if the true edge + // branches straight to this block and |common| is |inc0|, then |inc0| + // is on the true branch. Otherwise the |inc1| is on the true branch. + BasicBlock* inc0 = GetIncomingBlock(phi, 0u); + Instruction* branch = common->terminator(); + uint32_t condition = branch->GetSingleWordInOperand(0u); + BasicBlock* then_block = GetBlock(branch->GetSingleWordInOperand(1u)); + Instruction* true_value = nullptr; + Instruction* false_value = nullptr; + if ((then_block == &block && inc0 == common) || + dominators->Dominates(then_block, inc0)) { + true_value = GetIncomingValue(phi, 0u); + false_value = GetIncomingValue(phi, 1u); + } else { + true_value = GetIncomingValue(phi, 1u); + false_value = GetIncomingValue(phi, 0u); + } + + BasicBlock* true_def_block = context()->get_instr_block(true_value); + BasicBlock* false_def_block = context()->get_instr_block(false_value); + + uint32_t true_vn = vn_table.GetValueNumber(true_value); + uint32_t false_vn = vn_table.GetValueNumber(false_value); + if (true_vn != 0 && true_vn == false_vn) { + Instruction* inst_to_use = nullptr; + + // Try to pick an instruction that is not in a side node. If we can't + // pick either the true for false branch as long as they can be + // legally moved. + if (!true_def_block || + dominators->Dominates(true_def_block, &block)) { + inst_to_use = true_value; + } else if (!false_def_block || + dominators->Dominates(false_def_block, &block)) { + inst_to_use = false_value; + } else if (CanHoistInstruction(true_value, common, dominators)) { + inst_to_use = true_value; + } else if (CanHoistInstruction(false_value, common, dominators)) { + inst_to_use = false_value; + } + + if (inst_to_use != nullptr) { + modified = true; + HoistInstruction(inst_to_use, common, dominators); + context()->KillNamesAndDecorates(phi); + context()->ReplaceAllUsesWith(phi->result_id(), + inst_to_use->result_id()); + } + return; + } + + // If either incoming value is defined in a block that does not dominate + // this phi, then we cannot eliminate the phi with a select. + // TODO(alan-baker): Perform code motion where it makes sense to enable + // the transform in this case. + if (true_def_block && !dominators->Dominates(true_def_block, &block)) + return; + + if (false_def_block && !dominators->Dominates(false_def_block, &block)) + return; + + analysis::Type* data_ty = + context()->get_type_mgr()->GetType(true_value->type_id()); + if (analysis::Vector* vec_data_ty = data_ty->AsVector()) { + condition = SplatCondition(vec_data_ty, condition, &builder); + } + + Instruction* select = builder.AddSelect(phi->type_id(), condition, + true_value->result_id(), + false_value->result_id()); + context()->ReplaceAllUsesWith(phi->result_id(), select->result_id()); + to_kill.push_back(phi); + modified = true; + + return; + }); + } + } + + for (auto inst : to_kill) { + context()->KillInst(inst); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool IfConversion::CheckBlock(BasicBlock* block, DominatorAnalysis* dominators, + BasicBlock** common) { + const std::vector& preds = cfg()->preds(block->id()); + + // TODO(alan-baker): Extend to more than two predecessors + if (preds.size() != 2) return false; + + BasicBlock* inc0 = context()->get_instr_block(preds[0]); + if (dominators->Dominates(block, inc0)) return false; + + BasicBlock* inc1 = context()->get_instr_block(preds[1]); + if (dominators->Dominates(block, inc1)) return false; + + // All phis will have the same common dominator, so cache the result + // for this block. If there is no common dominator, then we cannot transform + // any phi in this basic block. + *common = dominators->CommonDominator(inc0, inc1); + if (!*common || cfg()->IsPseudoEntryBlock(*common)) return false; + Instruction* branch = (*common)->terminator(); + if (branch->opcode() != SpvOpBranchConditional) return false; + + return true; +} + +bool IfConversion::CheckPhiUsers(Instruction* phi, BasicBlock* block) { + return get_def_use_mgr()->WhileEachUser(phi, [block, + this](Instruction* user) { + if (user->opcode() == SpvOpPhi && context()->get_instr_block(user) == block) + return false; + return true; + }); +} + +uint32_t IfConversion::SplatCondition(analysis::Vector* vec_data_ty, + uint32_t cond, + InstructionBuilder* builder) { + // If the data inputs to OpSelect are vectors, the condition for + // OpSelect must be a boolean vector with the same number of + // components. So splat the condition for the branch into a vector + // type. + analysis::Bool bool_ty; + analysis::Vector bool_vec_ty(&bool_ty, vec_data_ty->element_count()); + uint32_t bool_vec_id = + context()->get_type_mgr()->GetTypeInstruction(&bool_vec_ty); + std::vector ids(vec_data_ty->element_count(), cond); + return builder->AddCompositeConstruct(bool_vec_id, ids)->result_id(); +} + +bool IfConversion::CheckType(uint32_t id) { + Instruction* type = get_def_use_mgr()->GetDef(id); + SpvOp op = type->opcode(); + if (spvOpcodeIsScalarType(op) || op == SpvOpTypePointer || + op == SpvOpTypeVector) + return true; + return false; +} + +BasicBlock* IfConversion::GetBlock(uint32_t id) { + return context()->get_instr_block(get_def_use_mgr()->GetDef(id)); +} + +BasicBlock* IfConversion::GetIncomingBlock(Instruction* phi, + uint32_t predecessor) { + uint32_t in_index = 2 * predecessor + 1; + return GetBlock(phi->GetSingleWordInOperand(in_index)); +} + +Instruction* IfConversion::GetIncomingValue(Instruction* phi, + uint32_t predecessor) { + uint32_t in_index = 2 * predecessor; + return get_def_use_mgr()->GetDef(phi->GetSingleWordInOperand(in_index)); +} + +void IfConversion::HoistInstruction(Instruction* inst, BasicBlock* target_block, + DominatorAnalysis* dominators) { + BasicBlock* inst_block = context()->get_instr_block(inst); + if (!inst_block) { + // This is in the header, and dominates everything. + return; + } + + if (dominators->Dominates(inst_block, target_block)) { + // Already in position. No work to do. + return; + } + + assert(inst->IsOpcodeCodeMotionSafe() && + "Trying to move an instruction that is not safe to move."); + + // First hoist all instructions it depends on. + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + inst->ForEachInId( + [this, target_block, def_use_mgr, dominators](uint32_t* id) { + Instruction* operand_inst = def_use_mgr->GetDef(*id); + HoistInstruction(operand_inst, target_block, dominators); + }); + + Instruction* insertion_pos = target_block->terminator(); + if ((insertion_pos)->PreviousNode()->opcode() == SpvOpSelectionMerge) { + insertion_pos = insertion_pos->PreviousNode(); + } + inst->RemoveFromList(); + insertion_pos->InsertBefore(std::unique_ptr(inst)); + context()->set_instr_block(inst, target_block); +} + +bool IfConversion::CanHoistInstruction(Instruction* inst, + BasicBlock* target_block, + DominatorAnalysis* dominators) { + BasicBlock* inst_block = context()->get_instr_block(inst); + if (!inst_block) { + // This is in the header, and dominates everything. + return true; + } + + if (dominators->Dominates(inst_block, target_block)) { + // Already in position. No work to do. + return true; + } + + if (!inst->IsOpcodeCodeMotionSafe()) { + return false; + } + + // Check all instruction |inst| depends on. + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + return inst->WhileEachInId( + [this, target_block, def_use_mgr, dominators](uint32_t* id) { + Instruction* operand_inst = def_use_mgr->GetDef(*id); + return CanHoistInstruction(operand_inst, target_block, dominators); + }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.h new file mode 100644 index 00000000000..609bdf3926c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/if_conversion.h @@ -0,0 +1,88 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_IF_CONVERSION_H_ +#define SOURCE_OPT_IF_CONVERSION_H_ + +#include "source/opt/basic_block.h" +#include "source/opt/ir_builder.h" +#include "source/opt/pass.h" +#include "source/opt/types.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class IfConversion : public Pass { + public: + const char* name() const override { return "if-conversion"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisInstrToBlockMapping | IRContext::kAnalysisCFG | + IRContext::kAnalysisNameMap; + } + + private: + // Returns true if |id| is a valid type for use with OpSelect. OpSelect only + // allows scalars, vectors and pointers as valid inputs. + bool CheckType(uint32_t id); + + // Returns the basic block containing |id|. + BasicBlock* GetBlock(uint32_t id); + + // Returns the basic block for the |predecessor|'th index predecessor of + // |phi|. + BasicBlock* GetIncomingBlock(Instruction* phi, uint32_t predecessor); + + // Returns the instruction defining the |predecessor|'th index of |phi|. + Instruction* GetIncomingValue(Instruction* phi, uint32_t predecessor); + + // Returns the id of a OpCompositeConstruct boolean vector. The composite has + // the same number of elements as |vec_data_ty| and each member is |cond|. + // |where| indicates the location in |block| to insert the composite + // construct. If necessary, this function will also construct the necessary + // type instructions for the boolean vector. + uint32_t SplatCondition(analysis::Vector* vec_data_ty, uint32_t cond, + InstructionBuilder* builder); + + // Returns true if none of |phi|'s users are in |block|. + bool CheckPhiUsers(Instruction* phi, BasicBlock* block); + + // Returns |false| if |block| is not appropriate to transform. Only + // transforms blocks with two predecessors. Neither incoming block can be + // dominated by |block|. Both predecessors must share a common dominator that + // is terminated by a conditional branch. + bool CheckBlock(BasicBlock* block, DominatorAnalysis* dominators, + BasicBlock** common); + + // Moves |inst| to |target_block| if it does not already dominate the block. + // Any instructions that |inst| depends on are move if necessary. It is + // assumed that |inst| can be hoisted to |target_block| as defined by + // |CanHoistInstruction|. |dominators| is the dominator analysis for the + // function that contains |target_block|. + void HoistInstruction(Instruction* inst, BasicBlock* target_block, + DominatorAnalysis* dominators); + + // Returns true if it is legal to move |inst| and the instructions it depends + // on to |target_block| if they do not already dominate |target_block|. + bool CanHoistInstruction(Instruction* inst, BasicBlock* target_block, + DominatorAnalysis* dominators); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_IF_CONVERSION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_exhaustive_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_exhaustive_pass.cpp new file mode 100644 index 00000000000..5714cd867d6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_exhaustive_pass.cpp @@ -0,0 +1,79 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/inline_exhaustive_pass.h" + +#include + +namespace spvtools { +namespace opt { + +bool InlineExhaustivePass::InlineExhaustive(Function* func) { + bool modified = false; + // Using block iterators here because of block erasures and insertions. + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end();) { + if (IsInlinableFunctionCall(&*ii)) { + // Inline call. + std::vector> newBlocks; + std::vector> newVars; + GenInlineCode(&newBlocks, &newVars, ii, bi); + // If call block is replaced with more than one block, point + // succeeding phis at new last block. + if (newBlocks.size() > 1) UpdateSucceedingPhis(newBlocks); + // Replace old calling block with new block(s). + + // We need to kill the name and decorations for the call, which + // will be deleted. Other instructions in the block will be moved to + // newBlocks. We don't need to do anything with those. + context()->KillNamesAndDecorates(&*ii); + + bi = bi.Erase(); + + for (auto& bb : newBlocks) { + bb->SetParent(func); + } + bi = bi.InsertBefore(&newBlocks); + // Insert new function variables. + if (newVars.size() > 0) + func->begin()->begin().InsertBefore(std::move(newVars)); + // Restart inlining at beginning of calling block. + ii = bi->begin(); + modified = true; + } else { + ++ii; + } + } + } + return modified; +} + +Pass::Status InlineExhaustivePass::ProcessImpl() { + // Attempt exhaustive inlining on each entry point function in module + ProcessFunction pfn = [this](Function* fp) { return InlineExhaustive(fp); }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +InlineExhaustivePass::InlineExhaustivePass() = default; + +Pass::Status InlineExhaustivePass::Process() { + InitializeInline(); + return ProcessImpl(); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_exhaustive_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_exhaustive_pass.h new file mode 100644 index 00000000000..103e091e00b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_exhaustive_pass.h @@ -0,0 +1,53 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_INLINE_EXHAUSTIVE_PASS_H_ +#define SOURCE_OPT_INLINE_EXHAUSTIVE_PASS_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/def_use_manager.h" +#include "source/opt/inline_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class InlineExhaustivePass : public InlinePass { + public: + InlineExhaustivePass(); + Status Process() override; + + const char* name() const override { return "inline-entry-points-exhaustive"; } + + private: + // Exhaustively inline all function calls in func as well as in + // all code that is inlined into func. Return true if func is modified. + bool InlineExhaustive(Function* func); + + void Initialize(); + Pass::Status ProcessImpl(); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_INLINE_EXHAUSTIVE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp new file mode 100644 index 00000000000..c2c3719fe04 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.cpp @@ -0,0 +1,113 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/inline_opaque_pass.h" + +#include + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kTypePointerTypeIdInIdx = 1; + +} // anonymous namespace + +bool InlineOpaquePass::IsOpaqueType(uint32_t typeId) { + const Instruction* typeInst = get_def_use_mgr()->GetDef(typeId); + switch (typeInst->opcode()) { + case SpvOpTypeSampler: + case SpvOpTypeImage: + case SpvOpTypeSampledImage: + return true; + case SpvOpTypePointer: + return IsOpaqueType( + typeInst->GetSingleWordInOperand(kTypePointerTypeIdInIdx)); + default: + break; + } + // TODO(greg-lunarg): Handle arrays containing opaque type + if (typeInst->opcode() != SpvOpTypeStruct) return false; + // Return true if any member is opaque + return !typeInst->WhileEachInId([this](const uint32_t* tid) { + if (IsOpaqueType(*tid)) return false; + return true; + }); +} + +bool InlineOpaquePass::HasOpaqueArgsOrReturn(const Instruction* callInst) { + // Check return type + if (IsOpaqueType(callInst->type_id())) return true; + // Check args + int icnt = 0; + return !callInst->WhileEachInId([&icnt, this](const uint32_t* iid) { + if (icnt > 0) { + const Instruction* argInst = get_def_use_mgr()->GetDef(*iid); + if (IsOpaqueType(argInst->type_id())) return false; + } + ++icnt; + return true; + }); +} + +bool InlineOpaquePass::InlineOpaque(Function* func) { + bool modified = false; + // Using block iterators here because of block erasures and insertions. + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end();) { + if (IsInlinableFunctionCall(&*ii) && HasOpaqueArgsOrReturn(&*ii)) { + // Inline call. + std::vector> newBlocks; + std::vector> newVars; + GenInlineCode(&newBlocks, &newVars, ii, bi); + // If call block is replaced with more than one block, point + // succeeding phis at new last block. + if (newBlocks.size() > 1) UpdateSucceedingPhis(newBlocks); + // Replace old calling block with new block(s). + bi = bi.Erase(); + bi = bi.InsertBefore(&newBlocks); + // Insert new function variables. + if (newVars.size() > 0) + func->begin()->begin().InsertBefore(std::move(newVars)); + // Restart inlining at beginning of calling block. + ii = bi->begin(); + modified = true; + } else { + ++ii; + } + } + } + return modified; +} + +void InlineOpaquePass::Initialize() { InitializeInline(); } + +Pass::Status InlineOpaquePass::ProcessImpl() { + // Do opaque inlining on each function in entry point call tree + ProcessFunction pfn = [this](Function* fp) { return InlineOpaque(fp); }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +InlineOpaquePass::InlineOpaquePass() = default; + +Pass::Status InlineOpaquePass::Process() { + Initialize(); + return ProcessImpl(); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.h new file mode 100644 index 00000000000..aad43fd6a33 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_opaque_pass.h @@ -0,0 +1,60 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_INLINE_OPAQUE_PASS_H_ +#define SOURCE_OPT_INLINE_OPAQUE_PASS_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/def_use_manager.h" +#include "source/opt/inline_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class InlineOpaquePass : public InlinePass { + public: + InlineOpaquePass(); + Status Process() override; + + const char* name() const override { return "inline-entry-points-opaque"; } + + private: + // Return true if |typeId| is or contains opaque type + bool IsOpaqueType(uint32_t typeId); + + // Return true if function call |callInst| has opaque argument or return type + bool HasOpaqueArgsOrReturn(const Instruction* callInst); + + // Inline all function calls in |func| that have opaque params or return + // type. Inline similarly all code that is inlined into func. Return true + // if func is modified. + bool InlineOpaque(Function* func); + + void Initialize(); + Pass::Status ProcessImpl(); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_INLINE_OPAQUE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp new file mode 100644 index 00000000000..5a88ef5d3fa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.cpp @@ -0,0 +1,695 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/inline_pass.h" + +#include +#include + +#include "source/cfa.h" +#include "source/util/make_unique.h" + +// Indices of operands in SPIR-V instructions + +static const int kSpvFunctionCallFunctionId = 2; +static const int kSpvFunctionCallArgumentId = 3; +static const int kSpvReturnValueId = 0; +static const int kSpvLoopMergeMergeBlockId = 0; +static const int kSpvLoopMergeContinueTargetIdInIdx = 1; + +namespace spvtools { +namespace opt { + +uint32_t InlinePass::AddPointerToType(uint32_t type_id, + SpvStorageClass storage_class) { + uint32_t resultId = TakeNextId(); + std::unique_ptr type_inst( + new Instruction(context(), SpvOpTypePointer, 0, resultId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, + {uint32_t(storage_class)}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {type_id}}})); + context()->AddType(std::move(type_inst)); + analysis::Type* pointeeTy; + std::unique_ptr pointerTy; + std::tie(pointeeTy, pointerTy) = + context()->get_type_mgr()->GetTypeAndPointerType(type_id, + SpvStorageClassFunction); + context()->get_type_mgr()->RegisterType(resultId, *pointerTy); + return resultId; +} + +void InlinePass::AddBranch(uint32_t label_id, + std::unique_ptr* block_ptr) { + std::unique_ptr newBranch( + new Instruction(context(), SpvOpBranch, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {label_id}}})); + (*block_ptr)->AddInstruction(std::move(newBranch)); +} + +void InlinePass::AddBranchCond(uint32_t cond_id, uint32_t true_id, + uint32_t false_id, + std::unique_ptr* block_ptr) { + std::unique_ptr newBranch( + new Instruction(context(), SpvOpBranchConditional, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {cond_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {true_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {false_id}}})); + (*block_ptr)->AddInstruction(std::move(newBranch)); +} + +void InlinePass::AddLoopMerge(uint32_t merge_id, uint32_t continue_id, + std::unique_ptr* block_ptr) { + std::unique_ptr newLoopMerge(new Instruction( + context(), SpvOpLoopMerge, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {merge_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {continue_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_LOOP_CONTROL, {0}}})); + (*block_ptr)->AddInstruction(std::move(newLoopMerge)); +} + +void InlinePass::AddStore(uint32_t ptr_id, uint32_t val_id, + std::unique_ptr* block_ptr) { + std::unique_ptr newStore( + new Instruction(context(), SpvOpStore, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ptr_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {val_id}}})); + (*block_ptr)->AddInstruction(std::move(newStore)); +} + +void InlinePass::AddLoad(uint32_t type_id, uint32_t resultId, uint32_t ptr_id, + std::unique_ptr* block_ptr) { + std::unique_ptr newLoad( + new Instruction(context(), SpvOpLoad, type_id, resultId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ptr_id}}})); + (*block_ptr)->AddInstruction(std::move(newLoad)); +} + +std::unique_ptr InlinePass::NewLabel(uint32_t label_id) { + std::unique_ptr newLabel( + new Instruction(context(), SpvOpLabel, 0, label_id, {})); + return newLabel; +} + +uint32_t InlinePass::GetFalseId() { + if (false_id_ != 0) return false_id_; + false_id_ = get_module()->GetGlobalValue(SpvOpConstantFalse); + if (false_id_ != 0) return false_id_; + uint32_t boolId = get_module()->GetGlobalValue(SpvOpTypeBool); + if (boolId == 0) { + boolId = TakeNextId(); + get_module()->AddGlobalValue(SpvOpTypeBool, boolId, 0); + } + false_id_ = TakeNextId(); + get_module()->AddGlobalValue(SpvOpConstantFalse, false_id_, boolId); + return false_id_; +} + +void InlinePass::MapParams( + Function* calleeFn, BasicBlock::iterator call_inst_itr, + std::unordered_map* callee2caller) { + int param_idx = 0; + calleeFn->ForEachParam([&call_inst_itr, ¶m_idx, + &callee2caller](const Instruction* cpi) { + const uint32_t pid = cpi->result_id(); + (*callee2caller)[pid] = call_inst_itr->GetSingleWordOperand( + kSpvFunctionCallArgumentId + param_idx); + ++param_idx; + }); +} + +void InlinePass::CloneAndMapLocals( + Function* calleeFn, std::vector>* new_vars, + std::unordered_map* callee2caller) { + auto callee_block_itr = calleeFn->begin(); + auto callee_var_itr = callee_block_itr->begin(); + while (callee_var_itr->opcode() == SpvOp::SpvOpVariable) { + std::unique_ptr var_inst(callee_var_itr->Clone(context())); + uint32_t newId = TakeNextId(); + get_decoration_mgr()->CloneDecorations(callee_var_itr->result_id(), newId); + var_inst->SetResultId(newId); + (*callee2caller)[callee_var_itr->result_id()] = newId; + new_vars->push_back(std::move(var_inst)); + ++callee_var_itr; + } +} + +uint32_t InlinePass::CreateReturnVar( + Function* calleeFn, std::vector>* new_vars) { + uint32_t returnVarId = 0; + const uint32_t calleeTypeId = calleeFn->type_id(); + analysis::Type* calleeType = context()->get_type_mgr()->GetType(calleeTypeId); + if (calleeType->AsVoid() == nullptr) { + // Find or create ptr to callee return type. + uint32_t returnVarTypeId = context()->get_type_mgr()->FindPointerToType( + calleeTypeId, SpvStorageClassFunction); + if (returnVarTypeId == 0) + returnVarTypeId = AddPointerToType(calleeTypeId, SpvStorageClassFunction); + // Add return var to new function scope variables. + returnVarId = TakeNextId(); + std::unique_ptr var_inst( + new Instruction(context(), SpvOpVariable, returnVarTypeId, returnVarId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, + {SpvStorageClassFunction}}})); + new_vars->push_back(std::move(var_inst)); + } + get_decoration_mgr()->CloneDecorations(calleeFn->result_id(), returnVarId); + return returnVarId; +} + +bool InlinePass::IsSameBlockOp(const Instruction* inst) const { + return inst->opcode() == SpvOpSampledImage || inst->opcode() == SpvOpImage; +} + +void InlinePass::CloneSameBlockOps( + std::unique_ptr* inst, + std::unordered_map* postCallSB, + std::unordered_map* preCallSB, + std::unique_ptr* block_ptr) { + (*inst)->ForEachInId( + [&postCallSB, &preCallSB, &block_ptr, this](uint32_t* iid) { + const auto mapItr = (*postCallSB).find(*iid); + if (mapItr == (*postCallSB).end()) { + const auto mapItr2 = (*preCallSB).find(*iid); + if (mapItr2 != (*preCallSB).end()) { + // Clone pre-call same-block ops, map result id. + const Instruction* inInst = mapItr2->second; + std::unique_ptr sb_inst(inInst->Clone(context())); + CloneSameBlockOps(&sb_inst, postCallSB, preCallSB, block_ptr); + const uint32_t rid = sb_inst->result_id(); + const uint32_t nid = this->TakeNextId(); + get_decoration_mgr()->CloneDecorations(rid, nid); + sb_inst->SetResultId(nid); + (*postCallSB)[rid] = nid; + *iid = nid; + (*block_ptr)->AddInstruction(std::move(sb_inst)); + } + } else { + // Reset same-block op operand. + *iid = mapItr->second; + } + }); +} + +void InlinePass::GenInlineCode( + std::vector>* new_blocks, + std::vector>* new_vars, + BasicBlock::iterator call_inst_itr, + UptrVectorIterator call_block_itr) { + // Map from all ids in the callee to their equivalent id in the caller + // as callee instructions are copied into caller. + std::unordered_map callee2caller; + // Pre-call same-block insts + std::unordered_map preCallSB; + // Post-call same-block op ids + std::unordered_map postCallSB; + + // Invalidate the def-use chains. They are not kept up to date while + // inlining. However, certain calls try to keep them up-to-date if they are + // valid. These operations can fail. + context()->InvalidateAnalyses(IRContext::kAnalysisDefUse); + + Function* calleeFn = id2function_[call_inst_itr->GetSingleWordOperand( + kSpvFunctionCallFunctionId)]; + + // Check for multiple returns in the callee. + auto fi = multi_return_funcs_.find(calleeFn->result_id()); + const bool multiReturn = fi != multi_return_funcs_.end(); + + // Map parameters to actual arguments. + MapParams(calleeFn, call_inst_itr, &callee2caller); + + // Define caller local variables for all callee variables and create map to + // them. + CloneAndMapLocals(calleeFn, new_vars, &callee2caller); + + // Create return var if needed. + uint32_t returnVarId = CreateReturnVar(calleeFn, new_vars); + + // Create set of callee result ids. Used to detect forward references + std::unordered_set callee_result_ids; + calleeFn->ForEachInst([&callee_result_ids](const Instruction* cpi) { + const uint32_t rid = cpi->result_id(); + if (rid != 0) callee_result_ids.insert(rid); + }); + + // If the caller is in a single-block loop, and the callee has multiple + // blocks, then the normal inlining logic will place the OpLoopMerge in + // the last of several blocks in the loop. Instead, it should be placed + // at the end of the first block. First determine if the caller is in a + // single block loop. We'll wait to move the OpLoopMerge until the end + // of the regular inlining logic, and only if necessary. + bool caller_is_single_block_loop = false; + bool caller_is_loop_header = false; + if (auto* loop_merge = call_block_itr->GetLoopMergeInst()) { + caller_is_loop_header = true; + caller_is_single_block_loop = + call_block_itr->id() == + loop_merge->GetSingleWordInOperand(kSpvLoopMergeContinueTargetIdInIdx); + } + + bool callee_begins_with_structured_header = + (*(calleeFn->begin())).GetMergeInst() != nullptr; + + // Clone and map callee code. Copy caller block code to beginning of + // first block and end of last block. + bool prevInstWasReturn = false; + uint32_t singleTripLoopHeaderId = 0; + uint32_t singleTripLoopContinueId = 0; + uint32_t returnLabelId = 0; + bool multiBlocks = false; + const uint32_t calleeTypeId = calleeFn->type_id(); + // new_blk_ptr is a new basic block in the caller. New instructions are + // written to it. It is created when we encounter the OpLabel + // of the first callee block. It is appended to new_blocks only when + // it is complete. + std::unique_ptr new_blk_ptr; + calleeFn->ForEachInst([&new_blocks, &callee2caller, &call_block_itr, + &call_inst_itr, &new_blk_ptr, &prevInstWasReturn, + &returnLabelId, &returnVarId, caller_is_loop_header, + callee_begins_with_structured_header, &calleeTypeId, + &multiBlocks, &postCallSB, &preCallSB, multiReturn, + &singleTripLoopHeaderId, &singleTripLoopContinueId, + &callee_result_ids, this](const Instruction* cpi) { + switch (cpi->opcode()) { + case SpvOpFunction: + case SpvOpFunctionParameter: + // Already processed + break; + case SpvOpVariable: + if (cpi->NumInOperands() == 2) { + assert(callee2caller.count(cpi->result_id()) && + "Expected the variable to have already been mapped."); + uint32_t new_var_id = callee2caller.at(cpi->result_id()); + + // The initializer must be a constant or global value. No mapped + // should be used. + uint32_t val_id = cpi->GetSingleWordInOperand(1); + AddStore(new_var_id, val_id, &new_blk_ptr); + } + break; + case SpvOpUnreachable: + case SpvOpKill: { + // Generate a return label so that we split the block with the function + // call. Copy the terminator into the new block. + if (returnLabelId == 0) returnLabelId = this->TakeNextId(); + std::unique_ptr terminator( + new Instruction(context(), cpi->opcode(), 0, 0, {})); + new_blk_ptr->AddInstruction(std::move(terminator)); + break; + } + case SpvOpLabel: { + // If previous instruction was early return, insert branch + // instruction to return block. + if (prevInstWasReturn) { + if (returnLabelId == 0) returnLabelId = this->TakeNextId(); + AddBranch(returnLabelId, &new_blk_ptr); + prevInstWasReturn = false; + } + // Finish current block (if it exists) and get label for next block. + uint32_t labelId; + bool firstBlock = false; + if (new_blk_ptr != nullptr) { + new_blocks->push_back(std::move(new_blk_ptr)); + // If result id is already mapped, use it, otherwise get a new + // one. + const uint32_t rid = cpi->result_id(); + const auto mapItr = callee2caller.find(rid); + labelId = (mapItr != callee2caller.end()) ? mapItr->second + : this->TakeNextId(); + } else { + // First block needs to use label of original block + // but map callee label in case of phi reference. + labelId = call_block_itr->id(); + callee2caller[cpi->result_id()] = labelId; + firstBlock = true; + } + // Create first/next block. + new_blk_ptr = MakeUnique(NewLabel(labelId)); + if (firstBlock) { + // Copy contents of original caller block up to call instruction. + for (auto cii = call_block_itr->begin(); cii != call_inst_itr; + cii = call_block_itr->begin()) { + Instruction* inst = &*cii; + inst->RemoveFromList(); + std::unique_ptr cp_inst(inst); + // Remember same-block ops for possible regeneration. + if (IsSameBlockOp(&*cp_inst)) { + auto* sb_inst_ptr = cp_inst.get(); + preCallSB[cp_inst->result_id()] = sb_inst_ptr; + } + new_blk_ptr->AddInstruction(std::move(cp_inst)); + } + if (caller_is_loop_header && callee_begins_with_structured_header) { + // We can't place both the caller's merge instruction and another + // merge instruction in the same block. So split the calling block. + // Insert an unconditional branch to a new guard block. Later, + // once we know the ID of the last block, we will move the caller's + // OpLoopMerge from the last generated block into the first block. + // We also wait to avoid invalidating various iterators. + const auto guard_block_id = this->TakeNextId(); + AddBranch(guard_block_id, &new_blk_ptr); + new_blocks->push_back(std::move(new_blk_ptr)); + // Start the next block. + new_blk_ptr = MakeUnique(NewLabel(guard_block_id)); + // Reset the mapping of the callee's entry block to point to + // the guard block. Do this so we can fix up phis later on to + // satisfy dominance. + callee2caller[cpi->result_id()] = guard_block_id; + } + // If callee has multiple returns, insert a header block for + // single-trip loop that will encompass callee code. Start postheader + // block. + // + // Note: Consider the following combination: + // - the caller is a single block loop + // - the callee does not begin with a structure header + // - the callee has multiple returns. + // We still need to split the caller block and insert a guard block. + // But we only need to do it once. We haven't done it yet, but the + // single-trip loop header will serve the same purpose. + if (multiReturn) { + singleTripLoopHeaderId = this->TakeNextId(); + AddBranch(singleTripLoopHeaderId, &new_blk_ptr); + new_blocks->push_back(std::move(new_blk_ptr)); + new_blk_ptr = + MakeUnique(NewLabel(singleTripLoopHeaderId)); + returnLabelId = this->TakeNextId(); + singleTripLoopContinueId = this->TakeNextId(); + AddLoopMerge(returnLabelId, singleTripLoopContinueId, &new_blk_ptr); + uint32_t postHeaderId = this->TakeNextId(); + AddBranch(postHeaderId, &new_blk_ptr); + new_blocks->push_back(std::move(new_blk_ptr)); + new_blk_ptr = MakeUnique(NewLabel(postHeaderId)); + multiBlocks = true; + // Reset the mapping of the callee's entry block to point to + // the post-header block. Do this so we can fix up phis later + // on to satisfy dominance. + callee2caller[cpi->result_id()] = postHeaderId; + } + } else { + multiBlocks = true; + } + } break; + case SpvOpReturnValue: { + // Store return value to return variable. + assert(returnVarId != 0); + uint32_t valId = cpi->GetInOperand(kSpvReturnValueId).words[0]; + const auto mapItr = callee2caller.find(valId); + if (mapItr != callee2caller.end()) { + valId = mapItr->second; + } + AddStore(returnVarId, valId, &new_blk_ptr); + + // Remember we saw a return; if followed by a label, will need to + // insert branch. + prevInstWasReturn = true; + } break; + case SpvOpReturn: { + // Remember we saw a return; if followed by a label, will need to + // insert branch. + prevInstWasReturn = true; + } break; + case SpvOpFunctionEnd: { + // If there was an early return, we generated a return label id + // for it. Now we have to generate the return block with that Id. + if (returnLabelId != 0) { + // If previous instruction was return, insert branch instruction + // to return block. + if (prevInstWasReturn) AddBranch(returnLabelId, &new_blk_ptr); + if (multiReturn) { + // If we generated a loop header to for the single-trip loop + // to accommodate multiple returns, insert the continue + // target block now, with a false branch back to the loop header. + new_blocks->push_back(std::move(new_blk_ptr)); + new_blk_ptr = + MakeUnique(NewLabel(singleTripLoopContinueId)); + AddBranchCond(GetFalseId(), singleTripLoopHeaderId, returnLabelId, + &new_blk_ptr); + } + // Generate the return block. + new_blocks->push_back(std::move(new_blk_ptr)); + new_blk_ptr = MakeUnique(NewLabel(returnLabelId)); + multiBlocks = true; + } + // Load return value into result id of call, if it exists. + if (returnVarId != 0) { + const uint32_t resId = call_inst_itr->result_id(); + assert(resId != 0); + AddLoad(calleeTypeId, resId, returnVarId, &new_blk_ptr); + } + // Copy remaining instructions from caller block. + for (Instruction* inst = call_inst_itr->NextNode(); inst; + inst = call_inst_itr->NextNode()) { + inst->RemoveFromList(); + std::unique_ptr cp_inst(inst); + // If multiple blocks generated, regenerate any same-block + // instruction that has not been seen in this last block. + if (multiBlocks) { + CloneSameBlockOps(&cp_inst, &postCallSB, &preCallSB, &new_blk_ptr); + // Remember same-block ops in this block. + if (IsSameBlockOp(&*cp_inst)) { + const uint32_t rid = cp_inst->result_id(); + postCallSB[rid] = rid; + } + } + new_blk_ptr->AddInstruction(std::move(cp_inst)); + } + // Finalize inline code. + new_blocks->push_back(std::move(new_blk_ptr)); + } break; + default: { + // Copy callee instruction and remap all input Ids. + std::unique_ptr cp_inst(cpi->Clone(context())); + cp_inst->ForEachInId([&callee2caller, &callee_result_ids, + this](uint32_t* iid) { + const auto mapItr = callee2caller.find(*iid); + if (mapItr != callee2caller.end()) { + *iid = mapItr->second; + } else if (callee_result_ids.find(*iid) != callee_result_ids.end()) { + // Forward reference. Allocate a new id, map it, + // use it and check for it when remapping result ids + const uint32_t nid = this->TakeNextId(); + callee2caller[*iid] = nid; + *iid = nid; + } + }); + // If result id is non-zero, remap it. If already mapped, use mapped + // value, else use next id. + const uint32_t rid = cp_inst->result_id(); + if (rid != 0) { + const auto mapItr = callee2caller.find(rid); + uint32_t nid; + if (mapItr != callee2caller.end()) { + nid = mapItr->second; + } else { + nid = this->TakeNextId(); + callee2caller[rid] = nid; + } + cp_inst->SetResultId(nid); + get_decoration_mgr()->CloneDecorations(rid, nid); + } + new_blk_ptr->AddInstruction(std::move(cp_inst)); + } break; + } + }); + + if (caller_is_loop_header && (new_blocks->size() > 1)) { + // Move the OpLoopMerge from the last block back to the first, where + // it belongs. + auto& first = new_blocks->front(); + auto& last = new_blocks->back(); + assert(first != last); + + // Insert a modified copy of the loop merge into the first block. + auto loop_merge_itr = last->tail(); + --loop_merge_itr; + assert(loop_merge_itr->opcode() == SpvOpLoopMerge); + std::unique_ptr cp_inst(loop_merge_itr->Clone(context())); + if (caller_is_single_block_loop) { + // Also, update its continue target to point to the last block. + cp_inst->SetInOperand(kSpvLoopMergeContinueTargetIdInIdx, {last->id()}); + } + first->tail().InsertBefore(std::move(cp_inst)); + + // Remove the loop merge from the last block. + loop_merge_itr->RemoveFromList(); + delete &*loop_merge_itr; + } + + // Update block map given replacement blocks. + for (auto& blk : *new_blocks) { + id2block_[blk->id()] = &*blk; + } +} + +bool InlinePass::IsInlinableFunctionCall(const Instruction* inst) { + if (inst->opcode() != SpvOp::SpvOpFunctionCall) return false; + const uint32_t calleeFnId = + inst->GetSingleWordOperand(kSpvFunctionCallFunctionId); + const auto ci = inlinable_.find(calleeFnId); + return ci != inlinable_.cend(); +} + +void InlinePass::UpdateSucceedingPhis( + std::vector>& new_blocks) { + const auto firstBlk = new_blocks.begin(); + const auto lastBlk = new_blocks.end() - 1; + const uint32_t firstId = (*firstBlk)->id(); + const uint32_t lastId = (*lastBlk)->id(); + const BasicBlock& const_last_block = *lastBlk->get(); + const_last_block.ForEachSuccessorLabel( + [&firstId, &lastId, this](const uint32_t succ) { + BasicBlock* sbp = this->id2block_[succ]; + sbp->ForEachPhiInst([&firstId, &lastId](Instruction* phi) { + phi->ForEachInId([&firstId, &lastId](uint32_t* id) { + if (*id == firstId) *id = lastId; + }); + }); + }); +} + +bool InlinePass::HasMultipleReturns(Function* func) { + bool seenReturn = false; + bool multipleReturns = false; + for (auto& blk : *func) { + auto terminal_ii = blk.cend(); + --terminal_ii; + if (terminal_ii->opcode() == SpvOpReturn || + terminal_ii->opcode() == SpvOpReturnValue) { + if (seenReturn) { + multipleReturns = true; + break; + } + seenReturn = true; + } + } + return multipleReturns; +} + +void InlinePass::ComputeStructuredSuccessors(Function* func) { + // If header, make merge block first successor. + for (auto& blk : *func) { + uint32_t mbid = blk.MergeBlockIdIfAny(); + if (mbid != 0) { + block2structured_succs_[&blk].push_back(id2block_[mbid]); + } + + // Add true successors. + const auto& const_blk = blk; + const_blk.ForEachSuccessorLabel([&blk, this](const uint32_t sbid) { + block2structured_succs_[&blk].push_back(id2block_[sbid]); + }); + } +} + +InlinePass::GetBlocksFunction InlinePass::StructuredSuccessorsFunction() { + return [this](const BasicBlock* block) { + return &(block2structured_succs_[block]); + }; +} + +bool InlinePass::HasNoReturnInLoop(Function* func) { + // If control not structured, do not do loop/return analysis + // TODO: Analyze returns in non-structured control flow + if (!context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + return false; + // Compute structured block order. This order has the property + // that dominators are before all blocks they dominate and merge blocks + // are after all blocks that are in the control constructs of their header. + ComputeStructuredSuccessors(func); + auto ignore_block = [](cbb_ptr) {}; + auto ignore_edge = [](cbb_ptr, cbb_ptr) {}; + std::list structuredOrder; + CFA::DepthFirstTraversal( + &*func->begin(), StructuredSuccessorsFunction(), ignore_block, + [&](cbb_ptr b) { structuredOrder.push_front(b); }, ignore_edge); + // Search for returns in loops. Only need to track outermost loop + bool return_in_loop = false; + uint32_t outerLoopMergeId = 0; + for (auto& blk : structuredOrder) { + // Exiting current outer loop + if (blk->id() == outerLoopMergeId) outerLoopMergeId = 0; + // Return block + auto terminal_ii = blk->cend(); + --terminal_ii; + if (terminal_ii->opcode() == SpvOpReturn || + terminal_ii->opcode() == SpvOpReturnValue) { + if (outerLoopMergeId != 0) { + return_in_loop = true; + break; + } + } else if (terminal_ii != blk->cbegin()) { + auto merge_ii = terminal_ii; + --merge_ii; + // Entering outermost loop + if (merge_ii->opcode() == SpvOpLoopMerge && outerLoopMergeId == 0) + outerLoopMergeId = + merge_ii->GetSingleWordOperand(kSpvLoopMergeMergeBlockId); + } + } + return !return_in_loop; +} + +void InlinePass::AnalyzeReturns(Function* func) { + // Look for multiple returns + if (!HasMultipleReturns(func)) { + no_return_in_loop_.insert(func->result_id()); + return; + } + multi_return_funcs_.insert(func->result_id()); + // If multiple returns, see if any are in a loop + if (HasNoReturnInLoop(func)) no_return_in_loop_.insert(func->result_id()); +} + +bool InlinePass::IsInlinableFunction(Function* func) { + // We can only inline a function if it has blocks. + if (func->cbegin() == func->cend()) return false; + // Do not inline functions with returns in loops. Currently early return + // functions are inlined by wrapping them in a one trip loop and implementing + // the returns as a branch to the loop's merge block. However, this can only + // done validly if the return was not in a loop in the original function. + // Also remember functions with multiple (early) returns. + AnalyzeReturns(func); + return no_return_in_loop_.find(func->result_id()) != + no_return_in_loop_.cend(); +} + +void InlinePass::InitializeInline() { + false_id_ = 0; + + // clear collections + id2function_.clear(); + id2block_.clear(); + block2structured_succs_.clear(); + inlinable_.clear(); + no_return_in_loop_.clear(); + multi_return_funcs_.clear(); + + for (auto& fn : *get_module()) { + // Initialize function and block maps. + id2function_[fn.result_id()] = &fn; + for (auto& blk : fn) { + id2block_[blk.id()] = &blk; + } + // Compute inlinability + if (IsInlinableFunction(&fn)) inlinable_.insert(fn.result_id()); + } +} + +InlinePass::InlinePass() {} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h new file mode 100644 index 00000000000..55369c98cb7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/inline_pass.h @@ -0,0 +1,189 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_INLINE_PASS_H_ +#define SOURCE_OPT_INLINE_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/decoration_manager.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class InlinePass : public Pass { + using cbb_ptr = const BasicBlock*; + + public: + using GetBlocksFunction = + std::function*(const BasicBlock*)>; + + virtual ~InlinePass() = default; + + protected: + InlinePass(); + + // Add pointer to type to module and return resultId. + uint32_t AddPointerToType(uint32_t type_id, SpvStorageClass storage_class); + + // Add unconditional branch to labelId to end of block block_ptr. + void AddBranch(uint32_t labelId, std::unique_ptr* block_ptr); + + // Add conditional branch to end of block |block_ptr|. + void AddBranchCond(uint32_t cond_id, uint32_t true_id, uint32_t false_id, + std::unique_ptr* block_ptr); + + // Add unconditional branch to labelId to end of block block_ptr. + void AddLoopMerge(uint32_t merge_id, uint32_t continue_id, + std::unique_ptr* block_ptr); + + // Add store of valId to ptrId to end of block block_ptr. + void AddStore(uint32_t ptrId, uint32_t valId, + std::unique_ptr* block_ptr); + + // Add load of ptrId into resultId to end of block block_ptr. + void AddLoad(uint32_t typeId, uint32_t resultId, uint32_t ptrId, + std::unique_ptr* block_ptr); + + // Return new label. + std::unique_ptr NewLabel(uint32_t label_id); + + // Returns the id for the boolean false value. Looks in the module first + // and creates it if not found. Remembers it for future calls. + uint32_t GetFalseId(); + + // Map callee params to caller args + void MapParams(Function* calleeFn, BasicBlock::iterator call_inst_itr, + std::unordered_map* callee2caller); + + // Clone and map callee locals + void CloneAndMapLocals(Function* calleeFn, + std::vector>* new_vars, + std::unordered_map* callee2caller); + + // Create return variable for callee clone code if needed. Return id + // if created, otherwise 0. + uint32_t CreateReturnVar(Function* calleeFn, + std::vector>* new_vars); + + // Return true if instruction must be in the same block that its result + // is used. + bool IsSameBlockOp(const Instruction* inst) const; + + // Clone operands which must be in same block as consumer instructions. + // Look in preCallSB for instructions that need cloning. Look in + // postCallSB for instructions already cloned. Add cloned instruction + // to postCallSB. + void CloneSameBlockOps(std::unique_ptr* inst, + std::unordered_map* postCallSB, + std::unordered_map* preCallSB, + std::unique_ptr* block_ptr); + + // Return in new_blocks the result of inlining the call at call_inst_itr + // within its block at call_block_itr. The block at call_block_itr can + // just be replaced with the blocks in new_blocks. Any additional branches + // are avoided. Debug instructions are cloned along with their callee + // instructions. Early returns are replaced by a store to a local return + // variable and a branch to a (created) exit block where the local variable + // is returned. Formal parameters are trivially mapped to their actual + // parameters. Note that the first block in new_blocks retains the label + // of the original calling block. Also note that if an exit block is + // created, it is the last block of new_blocks. + // + // Also return in new_vars additional OpVariable instructions required by + // and to be inserted into the caller function after the block at + // call_block_itr is replaced with new_blocks. + void GenInlineCode(std::vector>* new_blocks, + std::vector>* new_vars, + BasicBlock::iterator call_inst_itr, + UptrVectorIterator call_block_itr); + + // Return true if |inst| is a function call that can be inlined. + bool IsInlinableFunctionCall(const Instruction* inst); + + // Compute structured successors for function |func|. + // A block's structured successors are the blocks it branches to + // together with its declared merge block if it has one. + // When order matters, the merge block always appears first. + // This assures correct depth first search in the presence of early + // returns and kills. If the successor vector contain duplicates + // if the merge block, they are safely ignored by DFS. + void ComputeStructuredSuccessors(Function* func); + + // Return function to return ordered structure successors for a given block + // Assumes ComputeStructuredSuccessors() has been called. + GetBlocksFunction StructuredSuccessorsFunction(); + + // Return true if |func| has multiple returns + bool HasMultipleReturns(Function* func); + + // Return true if |func| has no return in a loop. The current analysis + // requires structured control flow, so return false if control flow not + // structured ie. module is not a shader. + bool HasNoReturnInLoop(Function* func); + + // Find all functions with multiple returns and no returns in loops + void AnalyzeReturns(Function* func); + + // Return true if |func| is a function that can be inlined. + bool IsInlinableFunction(Function* func); + + // Update phis in succeeding blocks to point to new last block + void UpdateSucceedingPhis( + std::vector>& new_blocks); + + // Initialize state for optimization of |module| + void InitializeInline(); + + // Map from function's result id to function. + std::unordered_map id2function_; + + // Map from block's label id to block. TODO(dnovillo): This is superfluous wrt + // CFG. It has functionality not present in CFG. Consolidate. + std::unordered_map id2block_; + + // Set of ids of functions with multiple returns. + std::set multi_return_funcs_; + + // Set of ids of functions with no returns in loop + std::set no_return_in_loop_; + + // Set of ids of inlinable functions + std::set inlinable_; + + // result id for OpConstantFalse + uint32_t false_id_; + + // Map from block to its structured successor blocks. See + // ComputeStructuredSuccessors() for definition. TODO(dnovillo): This is + // superfluous wrt CFG, but it seems to be computed in a slightly + // different way in the inliner. Can these be consolidated? + std::unordered_map> + block2structured_succs_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_INLINE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp new file mode 100644 index 00000000000..4cfa41d8e4b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction.cpp @@ -0,0 +1,746 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/instruction.h" + +#include + +#include "source/disassemble.h" +#include "source/opt/fold.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +namespace { +// Indices used to get particular operands out of instructions using InOperand. +const uint32_t kTypeImageDimIndex = 1; +const uint32_t kLoadBaseIndex = 0; +const uint32_t kVariableStorageClassIndex = 0; +const uint32_t kTypeImageSampledIndex = 5; +} // namespace + +Instruction::Instruction(IRContext* c) + : utils::IntrusiveNodeBase(), + context_(c), + opcode_(SpvOpNop), + has_type_id_(false), + has_result_id_(false), + unique_id_(c->TakeNextUniqueId()) {} + +Instruction::Instruction(IRContext* c, SpvOp op) + : utils::IntrusiveNodeBase(), + context_(c), + opcode_(op), + has_type_id_(false), + has_result_id_(false), + unique_id_(c->TakeNextUniqueId()) {} + +Instruction::Instruction(IRContext* c, const spv_parsed_instruction_t& inst, + std::vector&& dbg_line) + : context_(c), + opcode_(static_cast(inst.opcode)), + has_type_id_(inst.type_id != 0), + has_result_id_(inst.result_id != 0), + unique_id_(c->TakeNextUniqueId()), + dbg_line_insts_(std::move(dbg_line)) { + assert((!IsDebugLineInst(opcode_) || dbg_line.empty()) && + "Op(No)Line attaching to Op(No)Line found"); + for (uint32_t i = 0; i < inst.num_operands; ++i) { + const auto& current_payload = inst.operands[i]; + std::vector words( + inst.words + current_payload.offset, + inst.words + current_payload.offset + current_payload.num_words); + operands_.emplace_back(current_payload.type, std::move(words)); + } +} + +Instruction::Instruction(IRContext* c, SpvOp op, uint32_t ty_id, + uint32_t res_id, const OperandList& in_operands) + : utils::IntrusiveNodeBase(), + context_(c), + opcode_(op), + has_type_id_(ty_id != 0), + has_result_id_(res_id != 0), + unique_id_(c->TakeNextUniqueId()), + operands_() { + if (has_type_id_) { + operands_.emplace_back(spv_operand_type_t::SPV_OPERAND_TYPE_TYPE_ID, + std::initializer_list{ty_id}); + } + if (has_result_id_) { + operands_.emplace_back(spv_operand_type_t::SPV_OPERAND_TYPE_RESULT_ID, + std::initializer_list{res_id}); + } + operands_.insert(operands_.end(), in_operands.begin(), in_operands.end()); +} + +Instruction::Instruction(Instruction&& that) + : utils::IntrusiveNodeBase(), + opcode_(that.opcode_), + has_type_id_(that.has_type_id_), + has_result_id_(that.has_result_id_), + unique_id_(that.unique_id_), + operands_(std::move(that.operands_)), + dbg_line_insts_(std::move(that.dbg_line_insts_)) {} + +Instruction& Instruction::operator=(Instruction&& that) { + opcode_ = that.opcode_; + has_type_id_ = that.has_type_id_; + has_result_id_ = that.has_result_id_; + unique_id_ = that.unique_id_; + operands_ = std::move(that.operands_); + dbg_line_insts_ = std::move(that.dbg_line_insts_); + return *this; +} + +Instruction* Instruction::Clone(IRContext* c) const { + Instruction* clone = new Instruction(c); + clone->opcode_ = opcode_; + clone->has_type_id_ = has_type_id_; + clone->has_result_id_ = has_result_id_; + clone->unique_id_ = c->TakeNextUniqueId(); + clone->operands_ = operands_; + clone->dbg_line_insts_ = dbg_line_insts_; + return clone; +} + +uint32_t Instruction::GetSingleWordOperand(uint32_t index) const { + const auto& words = GetOperand(index).words; + assert(words.size() == 1 && "expected the operand only taking one word"); + return words.front(); +} + +uint32_t Instruction::NumInOperandWords() const { + uint32_t size = 0; + for (uint32_t i = TypeResultIdCount(); i < operands_.size(); ++i) + size += static_cast(operands_[i].words.size()); + return size; +} + +void Instruction::ToBinaryWithoutAttachedDebugInsts( + std::vector* binary) const { + const uint32_t num_words = 1 + NumOperandWords(); + binary->push_back((num_words << 16) | static_cast(opcode_)); + for (const auto& operand : operands_) + binary->insert(binary->end(), operand.words.begin(), operand.words.end()); +} + +void Instruction::ReplaceOperands(const OperandList& new_operands) { + operands_.clear(); + operands_.insert(operands_.begin(), new_operands.begin(), new_operands.end()); +} + +bool Instruction::IsReadOnlyLoad() const { + if (IsLoad()) { + Instruction* address_def = GetBaseAddress(); + if (!address_def || address_def->opcode() != SpvOpVariable) { + return false; + } + return address_def->IsReadOnlyVariable(); + } + return false; +} + +Instruction* Instruction::GetBaseAddress() const { + assert((IsLoad() || opcode() == SpvOpStore || opcode() == SpvOpAccessChain || + opcode() == SpvOpInBoundsAccessChain || opcode() == SpvOpCopyObject || + opcode() == SpvOpImageTexelPointer) && + "GetBaseAddress should only be called on instructions that take a " + "pointer or image."); + uint32_t base = GetSingleWordInOperand(kLoadBaseIndex); + Instruction* base_inst = context()->get_def_use_mgr()->GetDef(base); + bool done = false; + while (!done) { + switch (base_inst->opcode()) { + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpPtrAccessChain: + case SpvOpInBoundsPtrAccessChain: + case SpvOpImageTexelPointer: + case SpvOpCopyObject: + // All of these instructions have the base pointer use a base pointer + // in in-operand 0. + base = base_inst->GetSingleWordInOperand(0); + base_inst = context()->get_def_use_mgr()->GetDef(base); + break; + default: + done = true; + break; + } + } + + switch (opcode()) { + case SpvOpLoad: + case SpvOpStore: + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpCopyObject: + // A load or store through a pointer. + assert(base_inst->IsValidBasePointer() && + "We cannot have a base pointer come from this load"); + break; + default: + // A load or store of an image. + assert(base_inst->IsValidBaseImage() && "We are expecting an image."); + break; + } + return base_inst; +} + +bool Instruction::IsReadOnlyVariable() const { + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityShader)) + return IsReadOnlyVariableShaders(); + else + return IsReadOnlyVariableKernel(); +} + +bool Instruction::IsVulkanStorageImage() const { + if (opcode() != SpvOpTypePointer) { + return false; + } + + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + if (storage_class != SpvStorageClassUniformConstant) { + return false; + } + + Instruction* base_type = + context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); + if (base_type->opcode() != SpvOpTypeImage) { + return false; + } + + if (base_type->GetSingleWordInOperand(kTypeImageDimIndex) == SpvDimBuffer) { + return false; + } + + // Check if the image is sampled. If we do not know for sure that it is, + // then assume it is a storage image. + auto s = base_type->GetSingleWordInOperand(kTypeImageSampledIndex); + return s != 1; +} + +bool Instruction::IsVulkanSampledImage() const { + if (opcode() != SpvOpTypePointer) { + return false; + } + + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + if (storage_class != SpvStorageClassUniformConstant) { + return false; + } + + Instruction* base_type = + context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); + if (base_type->opcode() != SpvOpTypeImage) { + return false; + } + + if (base_type->GetSingleWordInOperand(kTypeImageDimIndex) == SpvDimBuffer) { + return false; + } + + // Check if the image is sampled. If we know for sure that it is, + // then return true. + auto s = base_type->GetSingleWordInOperand(kTypeImageSampledIndex); + return s == 1; +} + +bool Instruction::IsVulkanStorageTexelBuffer() const { + if (opcode() != SpvOpTypePointer) { + return false; + } + + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + if (storage_class != SpvStorageClassUniformConstant) { + return false; + } + + Instruction* base_type = + context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); + if (base_type->opcode() != SpvOpTypeImage) { + return false; + } + + if (base_type->GetSingleWordInOperand(kTypeImageDimIndex) != SpvDimBuffer) { + return false; + } + + // Check if the image is sampled. If we do not know for sure that it is, + // then assume it is a storage texel buffer. + return base_type->GetSingleWordInOperand(kTypeImageSampledIndex) != 1; +} + +bool Instruction::IsVulkanStorageBuffer() const { + // Is there a difference between a "Storage buffer" and a "dynamic storage + // buffer" in SPIR-V and do we care about the difference? + if (opcode() != SpvOpTypePointer) { + return false; + } + + Instruction* base_type = + context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); + + if (base_type->opcode() != SpvOpTypeStruct) { + return false; + } + + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + if (storage_class == SpvStorageClassUniform) { + bool is_buffer_block = false; + context()->get_decoration_mgr()->ForEachDecoration( + base_type->result_id(), SpvDecorationBufferBlock, + [&is_buffer_block](const Instruction&) { is_buffer_block = true; }); + return is_buffer_block; + } else if (storage_class == SpvStorageClassStorageBuffer) { + bool is_block = false; + context()->get_decoration_mgr()->ForEachDecoration( + base_type->result_id(), SpvDecorationBlock, + [&is_block](const Instruction&) { is_block = true; }); + return is_block; + } + return false; +} + +bool Instruction::IsVulkanUniformBuffer() const { + if (opcode() != SpvOpTypePointer) { + return false; + } + + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + if (storage_class != SpvStorageClassUniform) { + return false; + } + + Instruction* base_type = + context()->get_def_use_mgr()->GetDef(GetSingleWordInOperand(1)); + if (base_type->opcode() != SpvOpTypeStruct) { + return false; + } + + bool is_block = false; + context()->get_decoration_mgr()->ForEachDecoration( + base_type->result_id(), SpvDecorationBlock, + [&is_block](const Instruction&) { is_block = true; }); + return is_block; +} + +bool Instruction::IsReadOnlyVariableShaders() const { + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + Instruction* type_def = context()->get_def_use_mgr()->GetDef(type_id()); + + switch (storage_class) { + case SpvStorageClassUniformConstant: + if (!type_def->IsVulkanStorageImage() && + !type_def->IsVulkanStorageTexelBuffer()) { + return true; + } + break; + case SpvStorageClassUniform: + if (!type_def->IsVulkanStorageBuffer()) { + return true; + } + break; + case SpvStorageClassPushConstant: + case SpvStorageClassInput: + return true; + default: + break; + } + + bool is_nonwritable = false; + context()->get_decoration_mgr()->ForEachDecoration( + result_id(), SpvDecorationNonWritable, + [&is_nonwritable](const Instruction&) { is_nonwritable = true; }); + return is_nonwritable; +} + +bool Instruction::IsReadOnlyVariableKernel() const { + uint32_t storage_class = GetSingleWordInOperand(kVariableStorageClassIndex); + return storage_class == SpvStorageClassUniformConstant; +} + +uint32_t Instruction::GetTypeComponent(uint32_t element) const { + uint32_t subtype = 0; + switch (opcode()) { + case SpvOpTypeStruct: + subtype = GetSingleWordInOperand(element); + break; + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: + case SpvOpTypeVector: + case SpvOpTypeMatrix: + // These types all have uniform subtypes. + subtype = GetSingleWordInOperand(0u); + break; + default: + break; + } + + return subtype; +} + +Instruction* Instruction::InsertBefore( + std::vector>&& list) { + Instruction* first_node = list.front().get(); + for (auto& i : list) { + i.release()->InsertBefore(this); + } + list.clear(); + return first_node; +} + +Instruction* Instruction::InsertBefore(std::unique_ptr&& i) { + i.get()->InsertBefore(this); + return i.release(); +} + +bool Instruction::IsValidBasePointer() const { + uint32_t tid = type_id(); + if (tid == 0) { + return false; + } + + Instruction* type = context()->get_def_use_mgr()->GetDef(tid); + if (type->opcode() != SpvOpTypePointer) { + return false; + } + + auto feature_mgr = context()->get_feature_mgr(); + if (feature_mgr->HasCapability(SpvCapabilityAddresses)) { + // TODO: The rules here could be more restrictive. + return true; + } + + if (opcode() == SpvOpVariable || opcode() == SpvOpFunctionParameter) { + return true; + } + + // With variable pointers, there are more valid base pointer objects. + // Variable pointers implicitly declares Variable pointers storage buffer. + SpvStorageClass storage_class = + static_cast(type->GetSingleWordInOperand(0)); + if ((feature_mgr->HasCapability(SpvCapabilityVariablePointersStorageBuffer) && + storage_class == SpvStorageClassStorageBuffer) || + (feature_mgr->HasCapability(SpvCapabilityVariablePointers) && + storage_class == SpvStorageClassWorkgroup)) { + switch (opcode()) { + case SpvOpPhi: + case SpvOpSelect: + case SpvOpFunctionCall: + case SpvOpConstantNull: + return true; + default: + break; + } + } + + uint32_t pointee_type_id = type->GetSingleWordInOperand(1); + Instruction* pointee_type_inst = + context()->get_def_use_mgr()->GetDef(pointee_type_id); + + if (pointee_type_inst->IsOpaqueType()) { + return true; + } + return false; +} + +bool Instruction::IsValidBaseImage() const { + uint32_t tid = type_id(); + if (tid == 0) { + return false; + } + + Instruction* type = context()->get_def_use_mgr()->GetDef(tid); + return (type->opcode() == SpvOpTypeImage || + type->opcode() == SpvOpTypeSampledImage); +} + +bool Instruction::IsOpaqueType() const { + if (opcode() == SpvOpTypeStruct) { + bool is_opaque = false; + ForEachInOperand([&is_opaque, this](const uint32_t* op_id) { + Instruction* type_inst = context()->get_def_use_mgr()->GetDef(*op_id); + is_opaque |= type_inst->IsOpaqueType(); + }); + return is_opaque; + } else if (opcode() == SpvOpTypeArray) { + uint32_t sub_type_id = GetSingleWordInOperand(0); + Instruction* sub_type_inst = + context()->get_def_use_mgr()->GetDef(sub_type_id); + return sub_type_inst->IsOpaqueType(); + } else { + return opcode() == SpvOpTypeRuntimeArray || + spvOpcodeIsBaseOpaqueType(opcode()); + } +} + +bool Instruction::IsFoldable() const { + return IsFoldableByFoldScalar() || + context()->get_instruction_folder().HasConstFoldingRule(opcode()); +} + +bool Instruction::IsFoldableByFoldScalar() const { + const InstructionFolder& folder = context()->get_instruction_folder(); + if (!folder.IsFoldableOpcode(opcode())) { + return false; + } + Instruction* type = context()->get_def_use_mgr()->GetDef(type_id()); + return folder.IsFoldableType(type); +} + +bool Instruction::IsFloatingPointFoldingAllowed() const { + // TODO: Add the rules for kernels. For now it will be pessimistic. + if (!context_->get_feature_mgr()->HasCapability(SpvCapabilityShader)) { + return false; + } + + bool is_nocontract = false; + context_->get_decoration_mgr()->WhileEachDecoration( + opcode_, SpvDecorationNoContraction, + [&is_nocontract](const Instruction&) { + is_nocontract = true; + return false; + }); + return !is_nocontract; +} + +std::string Instruction::PrettyPrint(uint32_t options) const { + // Convert the module to binary. + std::vector module_binary; + context()->module()->ToBinary(&module_binary, /* skip_nop = */ false); + + // Convert the instruction to binary. This is used to identify the correct + // stream of words to output from the module. + std::vector inst_binary; + ToBinaryWithoutAttachedDebugInsts(&inst_binary); + + // Do not generate a header. + return spvInstructionBinaryToText( + context()->grammar().target_env(), inst_binary.data(), inst_binary.size(), + module_binary.data(), module_binary.size(), + options | SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); +} + +std::ostream& operator<<(std::ostream& str, const Instruction& inst) { + str << inst.PrettyPrint(); + return str; +} + +bool Instruction::IsOpcodeCodeMotionSafe() const { + switch (opcode_) { + case SpvOpNop: + case SpvOpUndef: + case SpvOpLoad: + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpArrayLength: + case SpvOpVectorExtractDynamic: + case SpvOpVectorInsertDynamic: + case SpvOpVectorShuffle: + case SpvOpCompositeConstruct: + case SpvOpCompositeExtract: + case SpvOpCompositeInsert: + case SpvOpCopyObject: + case SpvOpTranspose: + case SpvOpConvertFToU: + case SpvOpConvertFToS: + case SpvOpConvertSToF: + case SpvOpConvertUToF: + case SpvOpUConvert: + case SpvOpSConvert: + case SpvOpFConvert: + case SpvOpQuantizeToF16: + case SpvOpBitcast: + case SpvOpSNegate: + case SpvOpFNegate: + case SpvOpIAdd: + case SpvOpFAdd: + case SpvOpISub: + case SpvOpFSub: + case SpvOpIMul: + case SpvOpFMul: + case SpvOpUDiv: + case SpvOpSDiv: + case SpvOpFDiv: + case SpvOpUMod: + case SpvOpSRem: + case SpvOpSMod: + case SpvOpFRem: + case SpvOpFMod: + case SpvOpVectorTimesScalar: + case SpvOpMatrixTimesScalar: + case SpvOpVectorTimesMatrix: + case SpvOpMatrixTimesVector: + case SpvOpMatrixTimesMatrix: + case SpvOpOuterProduct: + case SpvOpDot: + case SpvOpIAddCarry: + case SpvOpISubBorrow: + case SpvOpUMulExtended: + case SpvOpSMulExtended: + case SpvOpAny: + case SpvOpAll: + case SpvOpIsNan: + case SpvOpIsInf: + case SpvOpLogicalEqual: + case SpvOpLogicalNotEqual: + case SpvOpLogicalOr: + case SpvOpLogicalAnd: + case SpvOpLogicalNot: + case SpvOpSelect: + case SpvOpIEqual: + case SpvOpINotEqual: + case SpvOpUGreaterThan: + case SpvOpSGreaterThan: + case SpvOpUGreaterThanEqual: + case SpvOpSGreaterThanEqual: + case SpvOpULessThan: + case SpvOpSLessThan: + case SpvOpULessThanEqual: + case SpvOpSLessThanEqual: + case SpvOpFOrdEqual: + case SpvOpFUnordEqual: + case SpvOpFOrdNotEqual: + case SpvOpFUnordNotEqual: + case SpvOpFOrdLessThan: + case SpvOpFUnordLessThan: + case SpvOpFOrdGreaterThan: + case SpvOpFUnordGreaterThan: + case SpvOpFOrdLessThanEqual: + case SpvOpFUnordLessThanEqual: + case SpvOpFOrdGreaterThanEqual: + case SpvOpFUnordGreaterThanEqual: + case SpvOpShiftRightLogical: + case SpvOpShiftRightArithmetic: + case SpvOpShiftLeftLogical: + case SpvOpBitwiseOr: + case SpvOpBitwiseXor: + case SpvOpBitwiseAnd: + case SpvOpNot: + case SpvOpBitFieldInsert: + case SpvOpBitFieldSExtract: + case SpvOpBitFieldUExtract: + case SpvOpBitReverse: + case SpvOpBitCount: + case SpvOpSizeOf: + return true; + default: + return false; + } +} + +bool Instruction::IsScalarizable() const { + if (spvOpcodeIsScalarizable(opcode())) { + return true; + } + + const uint32_t kExtInstSetIdInIdx = 0; + const uint32_t kExtInstInstructionInIdx = 1; + + if (opcode() == SpvOpExtInst) { + uint32_t instSetId = + context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450(); + + if (GetSingleWordInOperand(kExtInstSetIdInIdx) == instSetId) { + switch (GetSingleWordInOperand(kExtInstInstructionInIdx)) { + case GLSLstd450Round: + case GLSLstd450RoundEven: + case GLSLstd450Trunc: + case GLSLstd450FAbs: + case GLSLstd450SAbs: + case GLSLstd450FSign: + case GLSLstd450SSign: + case GLSLstd450Floor: + case GLSLstd450Ceil: + case GLSLstd450Fract: + case GLSLstd450Radians: + case GLSLstd450Degrees: + case GLSLstd450Sin: + case GLSLstd450Cos: + case GLSLstd450Tan: + case GLSLstd450Asin: + case GLSLstd450Acos: + case GLSLstd450Atan: + case GLSLstd450Sinh: + case GLSLstd450Cosh: + case GLSLstd450Tanh: + case GLSLstd450Asinh: + case GLSLstd450Acosh: + case GLSLstd450Atanh: + case GLSLstd450Atan2: + case GLSLstd450Pow: + case GLSLstd450Exp: + case GLSLstd450Log: + case GLSLstd450Exp2: + case GLSLstd450Log2: + case GLSLstd450Sqrt: + case GLSLstd450InverseSqrt: + case GLSLstd450Modf: + case GLSLstd450FMin: + case GLSLstd450UMin: + case GLSLstd450SMin: + case GLSLstd450FMax: + case GLSLstd450UMax: + case GLSLstd450SMax: + case GLSLstd450FClamp: + case GLSLstd450UClamp: + case GLSLstd450SClamp: + case GLSLstd450FMix: + case GLSLstd450Step: + case GLSLstd450SmoothStep: + case GLSLstd450Fma: + case GLSLstd450Frexp: + case GLSLstd450Ldexp: + case GLSLstd450FindILsb: + case GLSLstd450FindSMsb: + case GLSLstd450FindUMsb: + case GLSLstd450NMin: + case GLSLstd450NMax: + case GLSLstd450NClamp: + return true; + default: + return false; + } + } + } + return false; +} + +bool Instruction::IsOpcodeSafeToDelete() const { + if (context()->IsCombinatorInstruction(this)) { + return true; + } + + switch (opcode()) { + case SpvOpDPdx: + case SpvOpDPdy: + case SpvOpFwidth: + case SpvOpDPdxFine: + case SpvOpDPdyFine: + case SpvOpFwidthFine: + case SpvOpDPdxCoarse: + case SpvOpDPdyCoarse: + case SpvOpFwidthCoarse: + case SpvOpImageQueryLod: + return true; + default: + return false; + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction.h new file mode 100644 index 00000000000..2533ba27239 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction.h @@ -0,0 +1,735 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_INSTRUCTION_H_ +#define SOURCE_OPT_INSTRUCTION_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opcode.h" +#include "source/operand.h" +#include "source/util/ilist_node.h" +#include "source/util/small_vector.h" + +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_spirv_header.h" +#include "source/opt/reflect.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace opt { + +class Function; +class IRContext; +class Module; +class InstructionList; + +// Relaxed logical addressing: +// +// In the logical addressing model, pointers cannot be stored or loaded. This +// is a useful assumption because it simplifies the aliasing significantly. +// However, for the purpose of legalizing code generated from HLSL, we will have +// to allow storing and loading of pointers to opaque objects and runtime +// arrays. This relaxation of the rule still implies that function and private +// scope variables do not have any aliasing, so we can treat them as before. +// This will be call the relaxed logical addressing model. +// +// This relaxation of the rule will be allowed by |GetBaseAddress|, but it will +// enforce that no other pointers are stored or loaded. + +// About operand: +// +// In the SPIR-V specification, the term "operand" is used to mean any single +// SPIR-V word following the leading wordcount-opcode word. Here, the term +// "operand" is used to mean a *logical* operand. A logical operand may consist +// of multiple SPIR-V words, which together make up the same component. For +// example, a logical operand of a 64-bit integer needs two words to express. +// +// Further, we categorize logical operands into *in* and *out* operands. +// In operands are operands actually serve as input to operations, while out +// operands are operands that represent ids generated from operations (result +// type id or result id). For example, for "OpIAdd %rtype %rid %inop1 %inop2", +// "%inop1" and "%inop2" are in operands, while "%rtype" and "%rid" are out +// operands. + +// A *logical* operand to a SPIR-V instruction. It can be the type id, result +// id, or other additional operands carried in an instruction. +struct Operand { + using OperandData = utils::SmallVector; + Operand(spv_operand_type_t t, OperandData&& w) + : type(t), words(std::move(w)) {} + + Operand(spv_operand_type_t t, const OperandData& w) : type(t), words(w) {} + + spv_operand_type_t type; // Type of this logical operand. + OperandData words; // Binary segments of this logical operand. + + friend bool operator==(const Operand& o1, const Operand& o2) { + return o1.type == o2.type && o1.words == o2.words; + } + + // TODO(antiagainst): create fields for literal number kind, width, etc. +}; + +inline bool operator!=(const Operand& o1, const Operand& o2) { + return !(o1 == o2); +} + +// A SPIR-V instruction. It contains the opcode and any additional logical +// operand, including the result id (if any) and result type id (if any). It +// may also contain line-related debug instruction (OpLine, OpNoLine) directly +// appearing before this instruction. Note that the result id of an instruction +// should never change after the instruction being built. If the result id +// needs to change, the user should create a new instruction instead. +class Instruction : public utils::IntrusiveNodeBase { + public: + using OperandList = std::vector; + using iterator = OperandList::iterator; + using const_iterator = OperandList::const_iterator; + + // Creates a default OpNop instruction. + // This exists solely for containers that can't do without. Should be removed. + Instruction() + : utils::IntrusiveNodeBase(), + context_(nullptr), + opcode_(SpvOpNop), + has_type_id_(false), + has_result_id_(false), + unique_id_(0) {} + + // Creates a default OpNop instruction. + Instruction(IRContext*); + // Creates an instruction with the given opcode |op| and no additional logical + // operands. + Instruction(IRContext*, SpvOp); + // Creates an instruction using the given spv_parsed_instruction_t |inst|. All + // the data inside |inst| will be copied and owned in this instance. And keep + // record of line-related debug instructions |dbg_line| ahead of this + // instruction, if any. + Instruction(IRContext* c, const spv_parsed_instruction_t& inst, + std::vector&& dbg_line = {}); + + // Creates an instruction with the given opcode |op|, type id: |ty_id|, + // result id: |res_id| and input operands: |in_operands|. + Instruction(IRContext* c, SpvOp op, uint32_t ty_id, uint32_t res_id, + const OperandList& in_operands); + + // TODO: I will want to remove these, but will first have to remove the use of + // std::vector. + Instruction(const Instruction&) = default; + Instruction& operator=(const Instruction&) = default; + + Instruction(Instruction&&); + Instruction& operator=(Instruction&&); + + virtual ~Instruction() = default; + + // Returns a newly allocated instruction that has the same operands, result, + // and type as |this|. The new instruction is not linked into any list. + // It is the responsibility of the caller to make sure that the storage is + // removed. It is the caller's responsibility to make sure that there is only + // one instruction for each result id. + Instruction* Clone(IRContext* c) const; + + IRContext* context() const { return context_; } + + SpvOp opcode() const { return opcode_; } + // Sets the opcode of this instruction to a specific opcode. Note this may + // invalidate the instruction. + // TODO(qining): Remove this function when instruction building and insertion + // is well implemented. + void SetOpcode(SpvOp op) { opcode_ = op; } + uint32_t type_id() const { + return has_type_id_ ? GetSingleWordOperand(0) : 0; + } + uint32_t result_id() const { + return has_result_id_ ? GetSingleWordOperand(has_type_id_ ? 1 : 0) : 0; + } + uint32_t unique_id() const { + assert(unique_id_ != 0); + return unique_id_; + } + // Returns the vector of line-related debug instructions attached to this + // instruction and the caller can directly modify them. + std::vector& dbg_line_insts() { return dbg_line_insts_; } + const std::vector& dbg_line_insts() const { + return dbg_line_insts_; + } + + // Same semantics as in the base class except the list the InstructionList + // containing |pos| will now assume ownership of |this|. + // inline void MoveBefore(Instruction* pos); + // inline void InsertAfter(Instruction* pos); + + // Begin and end iterators for operands. + iterator begin() { return operands_.begin(); } + iterator end() { return operands_.end(); } + const_iterator begin() const { return operands_.cbegin(); } + const_iterator end() const { return operands_.cend(); } + // Const begin and end iterators for operands. + const_iterator cbegin() const { return operands_.cbegin(); } + const_iterator cend() const { return operands_.cend(); } + + // Gets the number of logical operands. + uint32_t NumOperands() const { + return static_cast(operands_.size()); + } + // Gets the number of SPIR-V words occupied by all logical operands. + uint32_t NumOperandWords() const { + return NumInOperandWords() + TypeResultIdCount(); + } + // Gets the |index|-th logical operand. + inline Operand& GetOperand(uint32_t index); + inline const Operand& GetOperand(uint32_t index) const; + // Adds |operand| to the list of operands of this instruction. + // It is the responsibility of the caller to make sure + // that the instruction remains valid. + inline void AddOperand(Operand&& operand); + // Gets the |index|-th logical operand as a single SPIR-V word. This method is + // not expected to be used with logical operands consisting of multiple SPIR-V + // words. + uint32_t GetSingleWordOperand(uint32_t index) const; + // Sets the |index|-th in-operand's data to the given |data|. + inline void SetInOperand(uint32_t index, Operand::OperandData&& data); + // Sets the |index|-th operand's data to the given |data|. + // This is for in-operands modification only, but with |index| expressed in + // terms of operand index rather than in-operand index. + inline void SetOperand(uint32_t index, Operand::OperandData&& data); + // Replace all of the in operands with those in |new_operands|. + inline void SetInOperands(OperandList&& new_operands); + // Sets the result type id. + inline void SetResultType(uint32_t ty_id); + // Sets the result id + inline void SetResultId(uint32_t res_id); + inline bool HasResultId() const { return has_result_id_; } + // Remove the |index|-th operand + void RemoveOperand(uint32_t index) { + operands_.erase(operands_.begin() + index); + } + + // The following methods are similar to the above, but are for in operands. + uint32_t NumInOperands() const { + return static_cast(operands_.size() - TypeResultIdCount()); + } + uint32_t NumInOperandWords() const; + Operand& GetInOperand(uint32_t index) { + return GetOperand(index + TypeResultIdCount()); + } + const Operand& GetInOperand(uint32_t index) const { + return GetOperand(index + TypeResultIdCount()); + } + uint32_t GetSingleWordInOperand(uint32_t index) const { + return GetSingleWordOperand(index + TypeResultIdCount()); + } + void RemoveInOperand(uint32_t index) { + operands_.erase(operands_.begin() + index + TypeResultIdCount()); + } + + // Returns true if this instruction is OpNop. + inline bool IsNop() const; + // Turns this instruction to OpNop. This does not clear out all preceding + // line-related debug instructions. + inline void ToNop(); + + // Runs the given function |f| on this instruction and optionally on the + // preceding debug line instructions. The function will always be run + // if this is itself a debug line instruction. + inline void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false); + inline void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false) const; + + // Runs the given function |f| on this instruction and optionally on the + // preceding debug line instructions. The function will always be run + // if this is itself a debug line instruction. If |f| returns false, + // iteration is terminated and this function returns false. + inline bool WhileEachInst(const std::function& f, + bool run_on_debug_line_insts = false); + inline bool WhileEachInst(const std::function& f, + bool run_on_debug_line_insts = false) const; + + // Runs the given function |f| on all operand ids. + // + // |f| should not transform an ID into 0, as 0 is an invalid ID. + inline void ForEachId(const std::function& f); + inline void ForEachId(const std::function& f) const; + + // Runs the given function |f| on all "in" operand ids. + inline void ForEachInId(const std::function& f); + inline void ForEachInId(const std::function& f) const; + + // Runs the given function |f| on all "in" operand ids. If |f| returns false, + // iteration is terminated and this function returns false. + inline bool WhileEachInId(const std::function& f); + inline bool WhileEachInId( + const std::function& f) const; + + // Runs the given function |f| on all "in" operands. + inline void ForEachInOperand(const std::function& f); + inline void ForEachInOperand( + const std::function& f) const; + + // Runs the given function |f| on all "in" operands. If |f| returns false, + // iteration is terminated and this function return false. + inline bool WhileEachInOperand(const std::function& f); + inline bool WhileEachInOperand( + const std::function& f) const; + + // Returns true if any operands can be labels + inline bool HasLabels() const; + + // Pushes the binary segments for this instruction into the back of *|binary|. + void ToBinaryWithoutAttachedDebugInsts(std::vector* binary) const; + + // Replaces the operands to the instruction with |new_operands|. The caller + // is responsible for building a complete and valid list of operands for + // this instruction. + void ReplaceOperands(const OperandList& new_operands); + + // Returns true if the instruction annotates an id with a decoration. + inline bool IsDecoration() const; + + // Returns true if the instruction is known to be a load from read-only + // memory. + bool IsReadOnlyLoad() const; + + // Returns the instruction that gives the base address of an address + // calculation. The instruction must be a load, as defined by |IsLoad|, + // store, copy, or access chain instruction. In logical addressing mode, will + // return an OpVariable or OpFunctionParameter instruction. For relaxed + // logical addressing, it would also return a load of a pointer to an opaque + // object. For physical addressing mode, could return other types of + // instructions. + Instruction* GetBaseAddress() const; + + // Returns true if the instruction loads from memory or samples an image, and + // stores the result into an id. It considers only core instructions. + // Memory-to-memory instructions are not considered loads. + inline bool IsLoad() const; + + // Returns true if the instruction declares a variable that is read-only. + bool IsReadOnlyVariable() const; + + // The following functions check for the various descriptor types defined in + // the Vulkan specification section 13.1. + + // Returns true if the instruction defines a pointer type that points to a + // storage image. + bool IsVulkanStorageImage() const; + + // Returns true if the instruction defines a pointer type that points to a + // sampled image. + bool IsVulkanSampledImage() const; + + // Returns true if the instruction defines a pointer type that points to a + // storage texel buffer. + bool IsVulkanStorageTexelBuffer() const; + + // Returns true if the instruction defines a pointer type that points to a + // storage buffer. + bool IsVulkanStorageBuffer() const; + + // Returns true if the instruction defines a pointer type that points to a + // uniform buffer. + bool IsVulkanUniformBuffer() const; + + // Returns true if the instruction is an atom operation. + inline bool IsAtomicOp() const; + + // Returns true if this instruction is a branch or switch instruction (either + // conditional or not). + bool IsBranch() const { return spvOpcodeIsBranch(opcode()); } + + // Returns true if this instruction causes the function to finish execution + // and return to its caller + bool IsReturn() const { return spvOpcodeIsReturn(opcode()); } + + // Returns true if this instruction exits this function or aborts execution. + bool IsReturnOrAbort() const { return spvOpcodeIsReturnOrAbort(opcode()); } + + // Returns the id for the |element|'th subtype. If the |this| is not a + // composite type, this function returns 0. + uint32_t GetTypeComponent(uint32_t element) const; + + // Returns true if this instruction is a basic block terminator. + bool IsBlockTerminator() const { + return spvOpcodeIsBlockTerminator(opcode()); + } + + // Returns true if |this| is an instruction that define an opaque type. Since + // runtime array have similar characteristics they are included as opaque + // types. + bool IsOpaqueType() const; + + // Returns true if |this| is an instruction which could be folded into a + // constant value. + bool IsFoldable() const; + + // Returns true if |this| is an instruction which could be folded into a + // constant value by |FoldScalar|. + bool IsFoldableByFoldScalar() const; + + // Returns true if we are allowed to fold or otherwise manipulate the + // instruction that defines |id| in the given context. This includes not + // handling NaN values. + bool IsFloatingPointFoldingAllowed() const; + + inline bool operator==(const Instruction&) const; + inline bool operator!=(const Instruction&) const; + inline bool operator<(const Instruction&) const; + + Instruction* InsertBefore(std::vector>&& list); + Instruction* InsertBefore(std::unique_ptr&& i); + using utils::IntrusiveNodeBase::InsertBefore; + + // Returns true if |this| is an instruction defining a constant, but not a + // Spec constant. + inline bool IsConstant() const; + + // Returns true if |this| is an instruction with an opcode safe to move + bool IsOpcodeCodeMotionSafe() const; + + // Pretty-prints |inst|. + // + // Provides the disassembly of a specific instruction. Utilizes |inst|'s + // context to provide the correct interpretation of types, constants, etc. + // + // |options| are the disassembly options. SPV_BINARY_TO_TEXT_OPTION_NO_HEADER + // is always added to |options|. + std::string PrettyPrint(uint32_t options = 0u) const; + + // Returns true if the result can be a vector and the result of each component + // depends on the corresponding component of any vector inputs. + bool IsScalarizable() const; + + // Return true if the only effect of this instructions is the result. + bool IsOpcodeSafeToDelete() const; + + // Returns true if it is valid to use the result of |inst| as the base + // pointer for a load or store. In this case, valid is defined by the relaxed + // logical addressing rules when using logical addressing. Normal validation + // rules for physical addressing. + bool IsValidBasePointer() const; + + private: + // Returns the total count of result type id and result id. + uint32_t TypeResultIdCount() const { + if (has_type_id_ && has_result_id_) return 2; + if (has_type_id_ || has_result_id_) return 1; + return 0; + } + + // Returns true if the instruction declares a variable that is read-only. The + // first version assumes the module is a shader module. The second assumes a + // kernel. + bool IsReadOnlyVariableShaders() const; + bool IsReadOnlyVariableKernel() const; + + // Returns true if the result of |inst| can be used as the base image for an + // instruction that samples a image, reads an image, or writes to an image. + bool IsValidBaseImage() const; + + IRContext* context_; // IR Context + SpvOp opcode_; // Opcode + bool has_type_id_; // True if the instruction has a type id + bool has_result_id_; // True if the instruction has a result id + uint32_t unique_id_; // Unique instruction id + // All logical operands, including result type id and result id. + OperandList operands_; + // Opline and OpNoLine instructions preceding this instruction. Note that for + // Instructions representing OpLine or OpNonLine itself, this field should be + // empty. + std::vector dbg_line_insts_; + + friend InstructionList; +}; + +// Pretty-prints |inst| to |str| and returns |str|. +// +// Provides the disassembly of a specific instruction. Utilizes |inst|'s context +// to provide the correct interpretation of types, constants, etc. +// +// Disassembly uses raw ids (not pretty printed names). +std::ostream& operator<<(std::ostream& str, const Instruction& inst); + +inline bool Instruction::operator==(const Instruction& other) const { + return unique_id() == other.unique_id(); +} + +inline bool Instruction::operator!=(const Instruction& other) const { + return !(*this == other); +} + +inline bool Instruction::operator<(const Instruction& other) const { + return unique_id() < other.unique_id(); +} + +inline Operand& Instruction::GetOperand(uint32_t index) { + assert(index < operands_.size() && "operand index out of bound"); + return operands_[index]; +} + +inline const Operand& Instruction::GetOperand(uint32_t index) const { + assert(index < operands_.size() && "operand index out of bound"); + return operands_[index]; +} + +inline void Instruction::AddOperand(Operand&& operand) { + operands_.push_back(std::move(operand)); +} + +inline void Instruction::SetInOperand(uint32_t index, + Operand::OperandData&& data) { + SetOperand(index + TypeResultIdCount(), std::move(data)); +} + +inline void Instruction::SetOperand(uint32_t index, + Operand::OperandData&& data) { + assert(index < operands_.size() && "operand index out of bound"); + assert(index >= TypeResultIdCount() && "operand is not a in-operand"); + operands_[index].words = std::move(data); +} + +inline void Instruction::SetInOperands(OperandList&& new_operands) { + // Remove the old in operands. + operands_.erase(operands_.begin() + TypeResultIdCount(), operands_.end()); + // Add the new in operands. + operands_.insert(operands_.end(), new_operands.begin(), new_operands.end()); +} + +inline void Instruction::SetResultId(uint32_t res_id) { + // TODO(dsinclair): Allow setting a result id if there wasn't one + // previously. Need to make room in the operands_ array to place the result, + // and update the has_result_id_ flag. + assert(has_result_id_); + + // TODO(dsinclair): Allow removing the result id. This needs to make sure, + // if there was a result id previously to remove it from the operands_ array + // and reset the has_result_id_ flag. + assert(res_id != 0); + + auto ridx = has_type_id_ ? 1 : 0; + operands_[ridx].words = {res_id}; +} + +inline void Instruction::SetResultType(uint32_t ty_id) { + // TODO(dsinclair): Allow setting a type id if there wasn't one + // previously. Need to make room in the operands_ array to place the result, + // and update the has_type_id_ flag. + assert(has_type_id_); + + // TODO(dsinclair): Allow removing the type id. This needs to make sure, + // if there was a type id previously to remove it from the operands_ array + // and reset the has_type_id_ flag. + assert(ty_id != 0); + + operands_.front().words = {ty_id}; +} + +inline bool Instruction::IsNop() const { + return opcode_ == SpvOpNop && !has_type_id_ && !has_result_id_ && + operands_.empty(); +} + +inline void Instruction::ToNop() { + opcode_ = SpvOpNop; + has_type_id_ = false; + has_result_id_ = false; + operands_.clear(); +} + +inline bool Instruction::WhileEachInst( + const std::function& f, bool run_on_debug_line_insts) { + if (run_on_debug_line_insts) { + for (auto& dbg_line : dbg_line_insts_) { + if (!f(&dbg_line)) return false; + } + } + return f(this); +} + +inline bool Instruction::WhileEachInst( + const std::function& f, + bool run_on_debug_line_insts) const { + if (run_on_debug_line_insts) { + for (auto& dbg_line : dbg_line_insts_) { + if (!f(&dbg_line)) return false; + } + } + return f(this); +} + +inline void Instruction::ForEachInst(const std::function& f, + bool run_on_debug_line_insts) { + WhileEachInst( + [&f](Instruction* inst) { + f(inst); + return true; + }, + run_on_debug_line_insts); +} + +inline void Instruction::ForEachInst( + const std::function& f, + bool run_on_debug_line_insts) const { + WhileEachInst( + [&f](const Instruction* inst) { + f(inst); + return true; + }, + run_on_debug_line_insts); +} + +inline void Instruction::ForEachId(const std::function& f) { + for (auto& opnd : operands_) + if (spvIsIdType(opnd.type)) f(&opnd.words[0]); +} + +inline void Instruction::ForEachId( + const std::function& f) const { + for (const auto& opnd : operands_) + if (spvIsIdType(opnd.type)) f(&opnd.words[0]); +} + +inline bool Instruction::WhileEachInId( + const std::function& f) { + for (auto& opnd : operands_) { + switch (opnd.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + break; + default: + if (spvIsIdType(opnd.type)) { + if (!f(&opnd.words[0])) return false; + } + break; + } + } + return true; +} + +inline bool Instruction::WhileEachInId( + const std::function& f) const { + for (const auto& opnd : operands_) { + switch (opnd.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + break; + default: + if (spvIsIdType(opnd.type)) { + if (!f(&opnd.words[0])) return false; + } + break; + } + } + return true; +} + +inline void Instruction::ForEachInId(const std::function& f) { + WhileEachInId([&f](uint32_t* id) { + f(id); + return true; + }); +} + +inline void Instruction::ForEachInId( + const std::function& f) const { + WhileEachInId([&f](const uint32_t* id) { + f(id); + return true; + }); +} + +inline bool Instruction::WhileEachInOperand( + const std::function& f) { + for (auto& opnd : operands_) { + switch (opnd.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + break; + default: + if (!f(&opnd.words[0])) return false; + break; + } + } + return true; +} + +inline bool Instruction::WhileEachInOperand( + const std::function& f) const { + for (const auto& opnd : operands_) { + switch (opnd.type) { + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + break; + default: + if (!f(&opnd.words[0])) return false; + break; + } + } + return true; +} + +inline void Instruction::ForEachInOperand( + const std::function& f) { + WhileEachInOperand([&f](uint32_t* op) { + f(op); + return true; + }); +} + +inline void Instruction::ForEachInOperand( + const std::function& f) const { + WhileEachInOperand([&f](const uint32_t* op) { + f(op); + return true; + }); +} + +inline bool Instruction::HasLabels() const { + switch (opcode_) { + case SpvOpSelectionMerge: + case SpvOpBranch: + case SpvOpLoopMerge: + case SpvOpBranchConditional: + case SpvOpSwitch: + case SpvOpPhi: + return true; + break; + default: + break; + } + return false; +} + +bool Instruction::IsDecoration() const { + return spvOpcodeIsDecoration(opcode()); +} + +bool Instruction::IsLoad() const { return spvOpcodeIsLoad(opcode()); } + +bool Instruction::IsAtomicOp() const { return spvOpcodeIsAtomicOp(opcode()); } + +bool Instruction::IsConstant() const { + return IsCompileTimeConstantInst(opcode()); +} +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_INSTRUCTION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction_list.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction_list.cpp new file mode 100644 index 00000000000..385a136ec78 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction_list.cpp @@ -0,0 +1,36 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/instruction_list.h" + +namespace spvtools { +namespace opt { + +InstructionList::iterator InstructionList::iterator::InsertBefore( + std::vector>&& list) { + Instruction* first_node = list.front().get(); + for (auto& i : list) { + i.release()->InsertBefore(node_); + } + list.clear(); + return iterator(first_node); +} + +InstructionList::iterator InstructionList::iterator::InsertBefore( + std::unique_ptr&& i) { + i.get()->InsertBefore(node_); + return iterator(i.release()); +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction_list.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction_list.h new file mode 100644 index 00000000000..ea1cc7c46ca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/instruction_list.h @@ -0,0 +1,130 @@ + +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_INSTRUCTION_LIST_H_ +#define SOURCE_OPT_INSTRUCTION_LIST_H_ + +#include +#include +#include +#include +#include + +#include "source/latest_version_spirv_header.h" +#include "source/operand.h" +#include "source/opt/instruction.h" +#include "source/util/ilist.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace opt { + +// This class is intended to be the container for Instructions. This container +// owns the instructions that are in it. When removing an Instruction from the +// list, the caller is assuming responsibility for deleting the storage. +// +// TODO: Because there are a number of other data structures that will want +// pointers to instruction, ownership should probably be moved to the module. +// Because of that I have not made the ownership passing in this class fully +// explicit. For example, RemoveFromList takes ownership from the list, but +// does not return an std::unique_ptr to signal that. When we fully decide on +// ownership, this will have to be fixed up one way or the other. +class InstructionList : public utils::IntrusiveList { + public: + InstructionList() = default; + InstructionList(InstructionList&& that) + : utils::IntrusiveList(std::move(that)) {} + InstructionList& operator=(InstructionList&& that) { + auto p = static_cast*>(this); + *p = std::move(that); + return *this; + } + + // Destroy this list and any instructions in the list. + inline virtual ~InstructionList(); + + class iterator : public utils::IntrusiveList::iterator { + public: + iterator(const utils::IntrusiveList::iterator& i) + : utils::IntrusiveList::iterator(i) {} + iterator(Instruction* i) : utils::IntrusiveList::iterator(i) {} + + // DEPRECATED: Please use MoveBefore with an InstructionList instead. + // + // Moves the nodes in |list| to the list that |this| points to. The + // positions of the nodes will be immediately before the element pointed to + // by the iterator. The return value will be an iterator pointing to the + // first of the newly inserted elements. Ownership of the elements in + // |list| is now passed on to |*this|. + iterator InsertBefore(std::vector>&& list); + + // The node |i| will be inserted immediately before |this|. The return value + // will be an iterator pointing to the newly inserted node. The owner of + // |*i| becomes |*this| + iterator InsertBefore(std::unique_ptr&& i); + + // Removes the node from the list, and deletes the storage. Returns a valid + // iterator to the next node. + iterator Erase() { + iterator_template next_node = *this; + ++next_node; + node_->RemoveFromList(); + delete node_; + return next_node; + } + }; + + iterator begin() { return utils::IntrusiveList::begin(); } + iterator end() { return utils::IntrusiveList::end(); } + const_iterator begin() const { + return utils::IntrusiveList::begin(); + } + const_iterator end() const { + return utils::IntrusiveList::end(); + } + + void push_back(std::unique_ptr&& inst) { + utils::IntrusiveList::push_back(inst.release()); + } + + // Same as in the base class, except it will delete the data as well. + inline void clear(); + + // Runs the given function |f| on the instructions in the list and optionally + // on the preceding debug line instructions. + inline void ForEachInst(const std::function& f, + bool run_on_debug_line_insts) { + auto next = begin(); + for (auto i = next; i != end(); i = next) { + ++next; + i->ForEachInst(f, run_on_debug_line_insts); + } + } +}; + +InstructionList::~InstructionList() { clear(); } + +void InstructionList::clear() { + while (!empty()) { + Instruction* inst = &front(); + inst->RemoveFromList(); + delete inst; + } +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_INSTRUCTION_LIST_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h new file mode 100644 index 00000000000..2dab76e52a0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_builder.h @@ -0,0 +1,421 @@ +// Copyright (c) 2018 Google 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. + +#ifndef SOURCE_OPT_IR_BUILDER_H_ +#define SOURCE_OPT_IR_BUILDER_H_ + +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/constants.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +// In SPIR-V, ids are encoded as uint16_t, this id is guaranteed to be always +// invalid. +const uint32_t kInvalidId = std::numeric_limits::max(); + +// Helper class to abstract instruction construction and insertion. +// The instruction builder can preserve the following analyses (specified via +// the constructors): +// - Def-use analysis +// - Instruction to block analysis +class InstructionBuilder { + public: + using InsertionPointTy = BasicBlock::iterator; + + // Creates an InstructionBuilder, all new instructions will be inserted before + // the instruction |insert_before|. + InstructionBuilder( + IRContext* context, Instruction* insert_before, + IRContext::Analysis preserved_analyses = IRContext::kAnalysisNone) + : InstructionBuilder(context, context->get_instr_block(insert_before), + InsertionPointTy(insert_before), + preserved_analyses) {} + + // Creates an InstructionBuilder, all new instructions will be inserted at the + // end of the basic block |parent_block|. + InstructionBuilder( + IRContext* context, BasicBlock* parent_block, + IRContext::Analysis preserved_analyses = IRContext::kAnalysisNone) + : InstructionBuilder(context, parent_block, parent_block->end(), + preserved_analyses) {} + + // Creates a new selection merge instruction. + // The id |merge_id| is the merge basic block id. + Instruction* AddSelectionMerge( + uint32_t merge_id, + uint32_t selection_control = SpvSelectionControlMaskNone) { + std::unique_ptr new_branch_merge(new Instruction( + GetContext(), SpvOpSelectionMerge, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {merge_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_SELECTION_CONTROL, + {selection_control}}})); + return AddInstruction(std::move(new_branch_merge)); + } + + // Creates a new branch instruction to |label_id|. + // Note that the user must make sure the final basic block is + // well formed. + Instruction* AddBranch(uint32_t label_id) { + std::unique_ptr new_branch(new Instruction( + GetContext(), SpvOpBranch, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {label_id}}})); + return AddInstruction(std::move(new_branch)); + } + + // Creates a new conditional instruction and the associated selection merge + // instruction if requested. + // The id |cond_id| is the id of the condition instruction, must be of + // type bool. + // The id |true_id| is the id of the basic block to branch to if the condition + // is true. + // The id |false_id| is the id of the basic block to branch to if the + // condition is false. + // The id |merge_id| is the id of the merge basic block for the selection + // merge instruction. If |merge_id| equals kInvalidId then no selection merge + // instruction will be created. + // The value |selection_control| is the selection control flag for the + // selection merge instruction. + // Note that the user must make sure the final basic block is + // well formed. + Instruction* AddConditionalBranch( + uint32_t cond_id, uint32_t true_id, uint32_t false_id, + uint32_t merge_id = kInvalidId, + uint32_t selection_control = SpvSelectionControlMaskNone) { + if (merge_id != kInvalidId) { + AddSelectionMerge(merge_id, selection_control); + } + std::unique_ptr new_branch(new Instruction( + GetContext(), SpvOpBranchConditional, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {cond_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {true_id}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {false_id}}})); + return AddInstruction(std::move(new_branch)); + } + + // Creates a new switch instruction and the associated selection merge + // instruction if requested. + // The id |selector_id| is the id of the selector instruction, must be of + // type int. + // The id |default_id| is the id of the default basic block to branch to. + // The vector |targets| is the pair of literal/branch id. + // The id |merge_id| is the id of the merge basic block for the selection + // merge instruction. If |merge_id| equals kInvalidId then no selection merge + // instruction will be created. + // The value |selection_control| is the selection control flag for the + // selection merge instruction. + // Note that the user must make sure the final basic block is + // well formed. + Instruction* AddSwitch( + uint32_t selector_id, uint32_t default_id, + const std::vector>& targets, + uint32_t merge_id = kInvalidId, + uint32_t selection_control = SpvSelectionControlMaskNone) { + if (merge_id != kInvalidId) { + AddSelectionMerge(merge_id, selection_control); + } + std::vector operands; + operands.emplace_back( + Operand{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {selector_id}}); + operands.emplace_back( + Operand{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {default_id}}); + for (auto& target : targets) { + operands.emplace_back( + Operand{spv_operand_type_t::SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER, + target.first}); + operands.emplace_back( + Operand{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {target.second}}); + } + std::unique_ptr new_switch( + new Instruction(GetContext(), SpvOpSwitch, 0, 0, operands)); + return AddInstruction(std::move(new_switch)); + } + + // Creates a phi instruction. + // The id |type| must be the id of the phi instruction's type. + // The vector |incomings| must be a sequence of pairs of . + Instruction* AddPhi(uint32_t type, const std::vector& incomings) { + assert(incomings.size() % 2 == 0 && "A sequence of pairs is expected"); + std::vector phi_ops; + for (size_t i = 0; i < incomings.size(); i++) { + phi_ops.push_back({SPV_OPERAND_TYPE_ID, {incomings[i]}}); + } + std::unique_ptr phi_inst(new Instruction( + GetContext(), SpvOpPhi, type, GetContext()->TakeNextId(), phi_ops)); + return AddInstruction(std::move(phi_inst)); + } + + // Creates an addition instruction. + // The id |type| must be the id of the instruction's type, must be the same as + // |op1| and |op2| types. + // The id |op1| is the left hand side of the operation. + // The id |op2| is the right hand side of the operation. + Instruction* AddIAdd(uint32_t type, uint32_t op1, uint32_t op2) { + std::unique_ptr inst(new Instruction( + GetContext(), SpvOpIAdd, type, GetContext()->TakeNextId(), + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); + return AddInstruction(std::move(inst)); + } + + // Creates a less than instruction for unsigned integer. + // The id |op1| is the left hand side of the operation. + // The id |op2| is the right hand side of the operation. + // It is assumed that |op1| and |op2| have the same underlying type. + Instruction* AddULessThan(uint32_t op1, uint32_t op2) { + analysis::Bool bool_type; + uint32_t type = GetContext()->get_type_mgr()->GetId(&bool_type); + std::unique_ptr inst(new Instruction( + GetContext(), SpvOpULessThan, type, GetContext()->TakeNextId(), + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); + return AddInstruction(std::move(inst)); + } + + // Creates a less than instruction for signed integer. + // The id |op1| is the left hand side of the operation. + // The id |op2| is the right hand side of the operation. + // It is assumed that |op1| and |op2| have the same underlying type. + Instruction* AddSLessThan(uint32_t op1, uint32_t op2) { + analysis::Bool bool_type; + uint32_t type = GetContext()->get_type_mgr()->GetId(&bool_type); + std::unique_ptr inst(new Instruction( + GetContext(), SpvOpSLessThan, type, GetContext()->TakeNextId(), + {{SPV_OPERAND_TYPE_ID, {op1}}, {SPV_OPERAND_TYPE_ID, {op2}}})); + return AddInstruction(std::move(inst)); + } + + // Creates an OpILessThan or OpULessThen instruction depending on the sign of + // |op1|. The id |op1| is the left hand side of the operation. The id |op2| is + // the right hand side of the operation. It is assumed that |op1| and |op2| + // have the same underlying type. + Instruction* AddLessThan(uint32_t op1, uint32_t op2) { + Instruction* op1_insn = context_->get_def_use_mgr()->GetDef(op1); + analysis::Type* type = + GetContext()->get_type_mgr()->GetType(op1_insn->type_id()); + analysis::Integer* int_type = type->AsInteger(); + assert(int_type && "Operand is not of int type"); + + if (int_type->IsSigned()) + return AddSLessThan(op1, op2); + else + return AddULessThan(op1, op2); + } + + // Creates a select instruction. + // |type| must match the types of |true_value| and |false_value|. It is up to + // the caller to ensure that |cond| is a correct type (bool or vector of + // bool) for |type|. + Instruction* AddSelect(uint32_t type, uint32_t cond, uint32_t true_value, + uint32_t false_value) { + std::unique_ptr select(new Instruction( + GetContext(), SpvOpSelect, type, GetContext()->TakeNextId(), + std::initializer_list{{SPV_OPERAND_TYPE_ID, {cond}}, + {SPV_OPERAND_TYPE_ID, {true_value}}, + {SPV_OPERAND_TYPE_ID, {false_value}}})); + return AddInstruction(std::move(select)); + } + + // Adds a signed int32 constant to the binary. + // The |value| parameter is the constant value to be added. + Instruction* Add32BitSignedIntegerConstant(int32_t value) { + return Add32BitConstantInteger(value, true); + } + + // Create a composite construct. + // |type| should be a composite type and the number of elements it has should + // match the size od |ids|. + Instruction* AddCompositeConstruct(uint32_t type, + const std::vector& ids) { + std::vector ops; + for (auto id : ids) { + ops.emplace_back(SPV_OPERAND_TYPE_ID, + std::initializer_list{id}); + } + std::unique_ptr construct( + new Instruction(GetContext(), SpvOpCompositeConstruct, type, + GetContext()->TakeNextId(), ops)); + return AddInstruction(std::move(construct)); + } + // Adds an unsigned int32 constant to the binary. + // The |value| parameter is the constant value to be added. + Instruction* Add32BitUnsignedIntegerConstant(uint32_t value) { + return Add32BitConstantInteger(value, false); + } + + // Adds either a signed or unsigned 32 bit integer constant to the binary + // depedning on the |sign|. If |sign| is true then the value is added as a + // signed constant otherwise as an unsigned constant. If |sign| is false the + // value must not be a negative number. + template + Instruction* Add32BitConstantInteger(T value, bool sign) { + // Assert that we are not trying to store a negative number in an unsigned + // type. + if (!sign) + assert(value >= 0 && + "Trying to add a signed integer with an unsigned type!"); + + analysis::Integer int_type{32, sign}; + + // Get or create the integer type. This rebuilds the type and manages the + // memory for the rebuilt type. + uint32_t type_id = + GetContext()->get_type_mgr()->GetTypeInstruction(&int_type); + + // Get the memory managed type so that it is safe to be stored by + // GetConstant. + analysis::Type* rebuilt_type = + GetContext()->get_type_mgr()->GetType(type_id); + + // Even if the value is negative we need to pass the bit pattern as a + // uint32_t to GetConstant. + uint32_t word = value; + + // Create the constant value. + const analysis::Constant* constant = + GetContext()->get_constant_mgr()->GetConstant(rebuilt_type, {word}); + + // Create the OpConstant instruction using the type and the value. + return GetContext()->get_constant_mgr()->GetDefiningInstruction(constant); + } + + Instruction* AddCompositeExtract(uint32_t type, uint32_t id_of_composite, + const std::vector& index_list) { + std::vector operands; + operands.push_back({SPV_OPERAND_TYPE_ID, {id_of_composite}}); + + for (uint32_t index : index_list) { + operands.push_back({SPV_OPERAND_TYPE_LITERAL_INTEGER, {index}}); + } + + std::unique_ptr new_inst( + new Instruction(GetContext(), SpvOpCompositeExtract, type, + GetContext()->TakeNextId(), operands)); + return AddInstruction(std::move(new_inst)); + } + + // Creates an unreachable instruction. + Instruction* AddUnreachable() { + std::unique_ptr select( + new Instruction(GetContext(), SpvOpUnreachable, 0, 0, + std::initializer_list{})); + return AddInstruction(std::move(select)); + } + + Instruction* AddAccessChain(uint32_t type_id, uint32_t base_ptr_id, + std::vector ids) { + std::vector operands; + operands.push_back({SPV_OPERAND_TYPE_ID, {base_ptr_id}}); + + for (uint32_t index_id : ids) { + operands.push_back({SPV_OPERAND_TYPE_ID, {index_id}}); + } + + std::unique_ptr new_inst( + new Instruction(GetContext(), SpvOpAccessChain, type_id, + GetContext()->TakeNextId(), operands)); + return AddInstruction(std::move(new_inst)); + } + + Instruction* AddLoad(uint32_t type_id, uint32_t base_ptr_id) { + std::vector operands; + operands.push_back({SPV_OPERAND_TYPE_ID, {base_ptr_id}}); + + std::unique_ptr new_inst( + new Instruction(GetContext(), SpvOpLoad, type_id, + GetContext()->TakeNextId(), operands)); + return AddInstruction(std::move(new_inst)); + } + + // Inserts the new instruction before the insertion point. + Instruction* AddInstruction(std::unique_ptr&& insn) { + Instruction* insn_ptr = &*insert_before_.InsertBefore(std::move(insn)); + UpdateInstrToBlockMapping(insn_ptr); + UpdateDefUseMgr(insn_ptr); + return insn_ptr; + } + + // Returns the insertion point iterator. + InsertionPointTy GetInsertPoint() { return insert_before_; } + + // Change the insertion point to insert before the instruction + // |insert_before|. + void SetInsertPoint(Instruction* insert_before) { + parent_ = context_->get_instr_block(insert_before); + insert_before_ = InsertionPointTy(insert_before); + } + + // Change the insertion point to insert at the end of the basic block + // |parent_block|. + void SetInsertPoint(BasicBlock* parent_block) { + parent_ = parent_block; + insert_before_ = parent_block->end(); + } + + // Returns the context which instructions are constructed for. + IRContext* GetContext() const { return context_; } + + // Returns the set of preserved analyses. + inline IRContext::Analysis GetPreservedAnalysis() const { + return preserved_analyses_; + } + + private: + InstructionBuilder(IRContext* context, BasicBlock* parent, + InsertionPointTy insert_before, + IRContext::Analysis preserved_analyses) + : context_(context), + parent_(parent), + insert_before_(insert_before), + preserved_analyses_(preserved_analyses) { + assert(!(preserved_analyses_ & ~(IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping))); + } + + // Returns true if the users requested to update |analysis|. + inline bool IsAnalysisUpdateRequested(IRContext::Analysis analysis) const { + return preserved_analyses_ & analysis; + } + + // Updates the def/use manager if the user requested it. If he did not request + // an update, this function does nothing. + inline void UpdateDefUseMgr(Instruction* insn) { + if (IsAnalysisUpdateRequested(IRContext::kAnalysisDefUse)) + GetContext()->get_def_use_mgr()->AnalyzeInstDefUse(insn); + } + + // Updates the instruction to block analysis if the user requested it. If he + // did not request an update, this function does nothing. + inline void UpdateInstrToBlockMapping(Instruction* insn) { + if (IsAnalysisUpdateRequested(IRContext::kAnalysisInstrToBlockMapping) && + parent_) + GetContext()->set_instr_block(insn, parent_); + } + + IRContext* context_; + BasicBlock* parent_; + InsertionPointTy insert_before_; + const IRContext::Analysis preserved_analyses_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_IR_BUILDER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp new file mode 100644 index 00000000000..742ac1f6268 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_context.cpp @@ -0,0 +1,655 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/ir_context.h" + +#include + +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/log.h" +#include "source/opt/mem_pass.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +void IRContext::BuildInvalidAnalyses(IRContext::Analysis set) { + if (set & kAnalysisDefUse) { + BuildDefUseManager(); + } + if (set & kAnalysisInstrToBlockMapping) { + BuildInstrToBlockMapping(); + } + if (set & kAnalysisDecorations) { + BuildDecorationManager(); + } + if (set & kAnalysisCFG) { + BuildCFG(); + } + if (set & kAnalysisDominatorAnalysis) { + ResetDominatorAnalysis(); + } + if (set & kAnalysisLoopAnalysis) { + ResetLoopAnalysis(); + } + if (set & kAnalysisNameMap) { + BuildIdToNameMap(); + } + if (set & kAnalysisScalarEvolution) { + BuildScalarEvolutionAnalysis(); + } + if (set & kAnalysisRegisterPressure) { + BuildRegPressureAnalysis(); + } + if (set & kAnalysisValueNumberTable) { + BuildValueNumberTable(); + } +} + +void IRContext::InvalidateAnalysesExceptFor( + IRContext::Analysis preserved_analyses) { + uint32_t analyses_to_invalidate = valid_analyses_ & (~preserved_analyses); + InvalidateAnalyses(static_cast(analyses_to_invalidate)); +} + +void IRContext::InvalidateAnalyses(IRContext::Analysis analyses_to_invalidate) { + if (analyses_to_invalidate & kAnalysisDefUse) { + def_use_mgr_.reset(nullptr); + } + if (analyses_to_invalidate & kAnalysisInstrToBlockMapping) { + instr_to_block_.clear(); + } + if (analyses_to_invalidate & kAnalysisDecorations) { + decoration_mgr_.reset(nullptr); + } + if (analyses_to_invalidate & kAnalysisCombinators) { + combinator_ops_.clear(); + } + if (analyses_to_invalidate & kAnalysisCFG) { + cfg_.reset(nullptr); + } + if (analyses_to_invalidate & kAnalysisDominatorAnalysis) { + dominator_trees_.clear(); + post_dominator_trees_.clear(); + } + if (analyses_to_invalidate & kAnalysisNameMap) { + id_to_name_.reset(nullptr); + } + if (analyses_to_invalidate & kAnalysisValueNumberTable) { + vn_table_.reset(nullptr); + } + + valid_analyses_ = Analysis(valid_analyses_ & ~analyses_to_invalidate); +} + +Instruction* IRContext::KillInst(Instruction* inst) { + if (!inst) { + return nullptr; + } + + KillNamesAndDecorates(inst); + + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->ClearInst(inst); + } + if (AreAnalysesValid(kAnalysisInstrToBlockMapping)) { + instr_to_block_.erase(inst); + } + if (AreAnalysesValid(kAnalysisDecorations)) { + if (inst->result_id() != 0) { + decoration_mgr_->RemoveDecorationsFrom(inst->result_id()); + } + if (inst->IsDecoration()) { + decoration_mgr_->RemoveDecoration(inst); + } + } + + if (type_mgr_ && IsTypeInst(inst->opcode())) { + type_mgr_->RemoveId(inst->result_id()); + } + + if (constant_mgr_ && IsConstantInst(inst->opcode())) { + constant_mgr_->RemoveId(inst->result_id()); + } + + RemoveFromIdToName(inst); + + Instruction* next_instruction = nullptr; + if (inst->IsInAList()) { + next_instruction = inst->NextNode(); + inst->RemoveFromList(); + delete inst; + } else { + // Needed for instructions that are not part of a list like OpLabels, + // OpFunction, OpFunctionEnd, etc.. + inst->ToNop(); + } + return next_instruction; +} + +bool IRContext::KillDef(uint32_t id) { + Instruction* def = get_def_use_mgr()->GetDef(id); + if (def != nullptr) { + KillInst(def); + return true; + } + return false; +} + +bool IRContext::ReplaceAllUsesWith(uint32_t before, uint32_t after) { + if (before == after) return false; + + // Ensure that |after| has been registered as def. + assert(get_def_use_mgr()->GetDef(after) && + "'after' is not a registered def."); + + std::vector> uses_to_update; + get_def_use_mgr()->ForEachUse( + before, [&uses_to_update](Instruction* user, uint32_t index) { + uses_to_update.emplace_back(user, index); + }); + + Instruction* prev = nullptr; + for (auto p : uses_to_update) { + Instruction* user = p.first; + uint32_t index = p.second; + if (prev == nullptr || prev != user) { + ForgetUses(user); + prev = user; + } + const uint32_t type_result_id_count = + (user->result_id() != 0) + (user->type_id() != 0); + + if (index < type_result_id_count) { + // Update the type_id. Note that result id is immutable so it should + // never be updated. + if (user->type_id() != 0 && index == 0) { + user->SetResultType(after); + } else if (user->type_id() == 0) { + SPIRV_ASSERT(consumer_, false, + "Result type id considered as use while the instruction " + "doesn't have a result type id."); + (void)consumer_; // Makes the compiler happy for release build. + } else { + SPIRV_ASSERT(consumer_, false, + "Trying setting the immutable result id."); + } + } else { + // Update an in-operand. + uint32_t in_operand_pos = index - type_result_id_count; + // Make the modification in the instruction. + user->SetInOperand(in_operand_pos, {after}); + } + AnalyzeUses(user); + } + + return true; +} + +bool IRContext::IsConsistent() { +#ifndef SPIRV_CHECK_CONTEXT + return true; +#endif + + if (AreAnalysesValid(kAnalysisDefUse)) { + analysis::DefUseManager new_def_use(module()); + if (*get_def_use_mgr() != new_def_use) { + return false; + } + } + + if (AreAnalysesValid(kAnalysisInstrToBlockMapping)) { + for (auto& func : *module()) { + for (auto& block : func) { + if (!block.WhileEachInst([this, &block](Instruction* inst) { + if (get_instr_block(inst) != &block) { + return false; + } + return true; + })) + return false; + } + } + } + + if (!CheckCFG()) { + return false; + } + + return true; +} + +void IRContext::ForgetUses(Instruction* inst) { + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->EraseUseRecordsOfOperandIds(inst); + } + if (AreAnalysesValid(kAnalysisDecorations)) { + if (inst->IsDecoration()) { + get_decoration_mgr()->RemoveDecoration(inst); + } + } + RemoveFromIdToName(inst); +} + +void IRContext::AnalyzeUses(Instruction* inst) { + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->AnalyzeInstUse(inst); + } + if (AreAnalysesValid(kAnalysisDecorations)) { + if (inst->IsDecoration()) { + get_decoration_mgr()->AddDecoration(inst); + } + } + if (id_to_name_ && + (inst->opcode() == SpvOpName || inst->opcode() == SpvOpMemberName)) { + id_to_name_->insert({inst->GetSingleWordInOperand(0), inst}); + } +} + +void IRContext::KillNamesAndDecorates(uint32_t id) { + std::vector decorations = + get_decoration_mgr()->GetDecorationsFor(id, true); + + for (Instruction* inst : decorations) { + KillInst(inst); + } + + std::vector name_to_kill; + for (auto name : GetNames(id)) { + name_to_kill.push_back(name.second); + } + for (Instruction* name_inst : name_to_kill) { + KillInst(name_inst); + } +} + +void IRContext::KillNamesAndDecorates(Instruction* inst) { + const uint32_t rId = inst->result_id(); + if (rId == 0) return; + KillNamesAndDecorates(rId); +} + +void IRContext::AddCombinatorsForCapability(uint32_t capability) { + if (capability == SpvCapabilityShader) { + combinator_ops_[0].insert({SpvOpNop, + SpvOpUndef, + SpvOpConstant, + SpvOpConstantTrue, + SpvOpConstantFalse, + SpvOpConstantComposite, + SpvOpConstantSampler, + SpvOpConstantNull, + SpvOpTypeVoid, + SpvOpTypeBool, + SpvOpTypeInt, + SpvOpTypeFloat, + SpvOpTypeVector, + SpvOpTypeMatrix, + SpvOpTypeImage, + SpvOpTypeSampler, + SpvOpTypeSampledImage, + SpvOpTypeArray, + SpvOpTypeRuntimeArray, + SpvOpTypeStruct, + SpvOpTypeOpaque, + SpvOpTypePointer, + SpvOpTypeFunction, + SpvOpTypeEvent, + SpvOpTypeDeviceEvent, + SpvOpTypeReserveId, + SpvOpTypeQueue, + SpvOpTypePipe, + SpvOpTypeForwardPointer, + SpvOpVariable, + SpvOpImageTexelPointer, + SpvOpLoad, + SpvOpAccessChain, + SpvOpInBoundsAccessChain, + SpvOpArrayLength, + SpvOpVectorExtractDynamic, + SpvOpVectorInsertDynamic, + SpvOpVectorShuffle, + SpvOpCompositeConstruct, + SpvOpCompositeExtract, + SpvOpCompositeInsert, + SpvOpCopyObject, + SpvOpTranspose, + SpvOpSampledImage, + SpvOpImageSampleImplicitLod, + SpvOpImageSampleExplicitLod, + SpvOpImageSampleDrefImplicitLod, + SpvOpImageSampleDrefExplicitLod, + SpvOpImageSampleProjImplicitLod, + SpvOpImageSampleProjExplicitLod, + SpvOpImageSampleProjDrefImplicitLod, + SpvOpImageSampleProjDrefExplicitLod, + SpvOpImageFetch, + SpvOpImageGather, + SpvOpImageDrefGather, + SpvOpImageRead, + SpvOpImage, + SpvOpImageQueryFormat, + SpvOpImageQueryOrder, + SpvOpImageQuerySizeLod, + SpvOpImageQuerySize, + SpvOpImageQueryLevels, + SpvOpImageQuerySamples, + SpvOpConvertFToU, + SpvOpConvertFToS, + SpvOpConvertSToF, + SpvOpConvertUToF, + SpvOpUConvert, + SpvOpSConvert, + SpvOpFConvert, + SpvOpQuantizeToF16, + SpvOpBitcast, + SpvOpSNegate, + SpvOpFNegate, + SpvOpIAdd, + SpvOpFAdd, + SpvOpISub, + SpvOpFSub, + SpvOpIMul, + SpvOpFMul, + SpvOpUDiv, + SpvOpSDiv, + SpvOpFDiv, + SpvOpUMod, + SpvOpSRem, + SpvOpSMod, + SpvOpFRem, + SpvOpFMod, + SpvOpVectorTimesScalar, + SpvOpMatrixTimesScalar, + SpvOpVectorTimesMatrix, + SpvOpMatrixTimesVector, + SpvOpMatrixTimesMatrix, + SpvOpOuterProduct, + SpvOpDot, + SpvOpIAddCarry, + SpvOpISubBorrow, + SpvOpUMulExtended, + SpvOpSMulExtended, + SpvOpAny, + SpvOpAll, + SpvOpIsNan, + SpvOpIsInf, + SpvOpLogicalEqual, + SpvOpLogicalNotEqual, + SpvOpLogicalOr, + SpvOpLogicalAnd, + SpvOpLogicalNot, + SpvOpSelect, + SpvOpIEqual, + SpvOpINotEqual, + SpvOpUGreaterThan, + SpvOpSGreaterThan, + SpvOpUGreaterThanEqual, + SpvOpSGreaterThanEqual, + SpvOpULessThan, + SpvOpSLessThan, + SpvOpULessThanEqual, + SpvOpSLessThanEqual, + SpvOpFOrdEqual, + SpvOpFUnordEqual, + SpvOpFOrdNotEqual, + SpvOpFUnordNotEqual, + SpvOpFOrdLessThan, + SpvOpFUnordLessThan, + SpvOpFOrdGreaterThan, + SpvOpFUnordGreaterThan, + SpvOpFOrdLessThanEqual, + SpvOpFUnordLessThanEqual, + SpvOpFOrdGreaterThanEqual, + SpvOpFUnordGreaterThanEqual, + SpvOpShiftRightLogical, + SpvOpShiftRightArithmetic, + SpvOpShiftLeftLogical, + SpvOpBitwiseOr, + SpvOpBitwiseXor, + SpvOpBitwiseAnd, + SpvOpNot, + SpvOpBitFieldInsert, + SpvOpBitFieldSExtract, + SpvOpBitFieldUExtract, + SpvOpBitReverse, + SpvOpBitCount, + SpvOpPhi, + SpvOpImageSparseSampleImplicitLod, + SpvOpImageSparseSampleExplicitLod, + SpvOpImageSparseSampleDrefImplicitLod, + SpvOpImageSparseSampleDrefExplicitLod, + SpvOpImageSparseSampleProjImplicitLod, + SpvOpImageSparseSampleProjExplicitLod, + SpvOpImageSparseSampleProjDrefImplicitLod, + SpvOpImageSparseSampleProjDrefExplicitLod, + SpvOpImageSparseFetch, + SpvOpImageSparseGather, + SpvOpImageSparseDrefGather, + SpvOpImageSparseTexelsResident, + SpvOpImageSparseRead, + SpvOpSizeOf}); + } +} + +void IRContext::AddCombinatorsForExtension(Instruction* extension) { + assert(extension->opcode() == SpvOpExtInstImport && + "Expecting an import of an extension's instruction set."); + const char* extension_name = + reinterpret_cast(&extension->GetInOperand(0).words[0]); + if (!strcmp(extension_name, "GLSL.std.450")) { + combinator_ops_[extension->result_id()] = {GLSLstd450Round, + GLSLstd450RoundEven, + GLSLstd450Trunc, + GLSLstd450FAbs, + GLSLstd450SAbs, + GLSLstd450FSign, + GLSLstd450SSign, + GLSLstd450Floor, + GLSLstd450Ceil, + GLSLstd450Fract, + GLSLstd450Radians, + GLSLstd450Degrees, + GLSLstd450Sin, + GLSLstd450Cos, + GLSLstd450Tan, + GLSLstd450Asin, + GLSLstd450Acos, + GLSLstd450Atan, + GLSLstd450Sinh, + GLSLstd450Cosh, + GLSLstd450Tanh, + GLSLstd450Asinh, + GLSLstd450Acosh, + GLSLstd450Atanh, + GLSLstd450Atan2, + GLSLstd450Pow, + GLSLstd450Exp, + GLSLstd450Log, + GLSLstd450Exp2, + GLSLstd450Log2, + GLSLstd450Sqrt, + GLSLstd450InverseSqrt, + GLSLstd450Determinant, + GLSLstd450MatrixInverse, + GLSLstd450ModfStruct, + GLSLstd450FMin, + GLSLstd450UMin, + GLSLstd450SMin, + GLSLstd450FMax, + GLSLstd450UMax, + GLSLstd450SMax, + GLSLstd450FClamp, + GLSLstd450UClamp, + GLSLstd450SClamp, + GLSLstd450FMix, + GLSLstd450IMix, + GLSLstd450Step, + GLSLstd450SmoothStep, + GLSLstd450Fma, + GLSLstd450FrexpStruct, + GLSLstd450Ldexp, + GLSLstd450PackSnorm4x8, + GLSLstd450PackUnorm4x8, + GLSLstd450PackSnorm2x16, + GLSLstd450PackUnorm2x16, + GLSLstd450PackHalf2x16, + GLSLstd450PackDouble2x32, + GLSLstd450UnpackSnorm2x16, + GLSLstd450UnpackUnorm2x16, + GLSLstd450UnpackHalf2x16, + GLSLstd450UnpackSnorm4x8, + GLSLstd450UnpackUnorm4x8, + GLSLstd450UnpackDouble2x32, + GLSLstd450Length, + GLSLstd450Distance, + GLSLstd450Cross, + GLSLstd450Normalize, + GLSLstd450FaceForward, + GLSLstd450Reflect, + GLSLstd450Refract, + GLSLstd450FindILsb, + GLSLstd450FindSMsb, + GLSLstd450FindUMsb, + GLSLstd450InterpolateAtCentroid, + GLSLstd450InterpolateAtSample, + GLSLstd450InterpolateAtOffset, + GLSLstd450NMin, + GLSLstd450NMax, + GLSLstd450NClamp}; + } else { + // Map the result id to the empty set. + combinator_ops_[extension->result_id()]; + } +} + +void IRContext::InitializeCombinators() { + get_feature_mgr()->GetCapabilities()->ForEach( + [this](SpvCapability cap) { AddCombinatorsForCapability(cap); }); + + for (auto& extension : module()->ext_inst_imports()) { + AddCombinatorsForExtension(&extension); + } + + valid_analyses_ |= kAnalysisCombinators; +} + +void IRContext::RemoveFromIdToName(const Instruction* inst) { + if (id_to_name_ && + (inst->opcode() == SpvOpName || inst->opcode() == SpvOpMemberName)) { + auto range = id_to_name_->equal_range(inst->GetSingleWordInOperand(0)); + for (auto it = range.first; it != range.second; ++it) { + if (it->second == inst) { + id_to_name_->erase(it); + break; + } + } + } +} + +LoopDescriptor* IRContext::GetLoopDescriptor(const Function* f) { + if (!AreAnalysesValid(kAnalysisLoopAnalysis)) { + ResetLoopAnalysis(); + } + + std::unordered_map::iterator it = + loop_descriptors_.find(f); + if (it == loop_descriptors_.end()) { + return &loop_descriptors_ + .emplace(std::make_pair(f, LoopDescriptor(this, f))) + .first->second; + } + + return &it->second; +} + +// Gets the dominator analysis for function |f|. +DominatorAnalysis* IRContext::GetDominatorAnalysis(const Function* f) { + if (!AreAnalysesValid(kAnalysisDominatorAnalysis)) { + ResetDominatorAnalysis(); + } + + if (dominator_trees_.find(f) == dominator_trees_.end()) { + dominator_trees_[f].InitializeTree(*cfg(), f); + } + + return &dominator_trees_[f]; +} + +// Gets the postdominator analysis for function |f|. +PostDominatorAnalysis* IRContext::GetPostDominatorAnalysis(const Function* f) { + if (!AreAnalysesValid(kAnalysisDominatorAnalysis)) { + ResetDominatorAnalysis(); + } + + if (post_dominator_trees_.find(f) == post_dominator_trees_.end()) { + post_dominator_trees_[f].InitializeTree(*cfg(), f); + } + + return &post_dominator_trees_[f]; +} + +bool IRContext::CheckCFG() { + std::unordered_map> real_preds; + if (!AreAnalysesValid(kAnalysisCFG)) { + return true; + } + + for (Function& function : *module()) { + for (const auto& bb : function) { + bb.ForEachSuccessorLabel([&bb, &real_preds](const uint32_t lab_id) { + real_preds[lab_id].push_back(bb.id()); + }); + } + + for (auto& bb : function) { + std::vector preds = cfg()->preds(bb.id()); + std::vector real = real_preds[bb.id()]; + std::sort(preds.begin(), preds.end()); + std::sort(real.begin(), real.end()); + + bool same = true; + if (preds.size() != real.size()) { + same = false; + } + + for (size_t i = 0; i < real.size() && same; i++) { + if (preds[i] != real[i]) { + same = false; + } + } + + if (!same) { + std::cerr << "Predecessors for " << bb.id() << " are different:\n"; + + std::cerr << "Real:"; + for (uint32_t i : real) { + std::cerr << ' ' << i; + } + std::cerr << std::endl; + + std::cerr << "Recorded:"; + for (uint32_t i : preds) { + std::cerr << ' ' << i; + } + std::cerr << std::endl; + } + if (!same) return false; + } + } + + return true; +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h new file mode 100644 index 00000000000..a9d892fa2fb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_context.h @@ -0,0 +1,858 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_IR_CONTEXT_H_ +#define SOURCE_OPT_IR_CONTEXT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/opt/cfg.h" +#include "source/opt/constants.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/feature_manager.h" +#include "source/opt/fold.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/module.h" +#include "source/opt/register_pressure.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/type_manager.h" +#include "source/opt/value_number_table.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +class IRContext { + public: + // Available analyses. + // + // When adding a new analysis: + // + // 1. Enum values should be powers of 2. These are cast into uint32_t + // bitmasks, so we can have at most 31 analyses represented. + // + // 2. Make sure it gets invalidated or preserved by IRContext methods that add + // or remove IR elements (e.g., KillDef, KillInst, ReplaceAllUsesWith). + // + // 3. Add handling code in BuildInvalidAnalyses and InvalidateAnalyses + enum Analysis { + kAnalysisNone = 0 << 0, + kAnalysisBegin = 1 << 0, + kAnalysisDefUse = kAnalysisBegin, + kAnalysisInstrToBlockMapping = 1 << 1, + kAnalysisDecorations = 1 << 2, + kAnalysisCombinators = 1 << 3, + kAnalysisCFG = 1 << 4, + kAnalysisDominatorAnalysis = 1 << 5, + kAnalysisLoopAnalysis = 1 << 6, + kAnalysisNameMap = 1 << 7, + kAnalysisScalarEvolution = 1 << 8, + kAnalysisRegisterPressure = 1 << 9, + kAnalysisValueNumberTable = 1 << 10, + kAnalysisEnd = 1 << 11 + }; + + friend inline Analysis operator|(Analysis lhs, Analysis rhs); + friend inline Analysis& operator|=(Analysis& lhs, Analysis rhs); + friend inline Analysis operator<<(Analysis a, int shift); + friend inline Analysis& operator<<=(Analysis& a, int shift); + + // Creates an |IRContext| that contains an owned |Module| + IRContext(spv_target_env env, MessageConsumer c) + : syntax_context_(spvContextCreate(env)), + grammar_(syntax_context_), + unique_id_(0), + module_(new Module()), + consumer_(std::move(c)), + def_use_mgr_(nullptr), + valid_analyses_(kAnalysisNone), + constant_mgr_(nullptr), + type_mgr_(nullptr), + id_to_name_(nullptr) { + SetContextMessageConsumer(syntax_context_, consumer_); + module_->SetContext(this); + } + + IRContext(spv_target_env env, std::unique_ptr&& m, MessageConsumer c) + : syntax_context_(spvContextCreate(env)), + grammar_(syntax_context_), + unique_id_(0), + module_(std::move(m)), + consumer_(std::move(c)), + def_use_mgr_(nullptr), + valid_analyses_(kAnalysisNone), + type_mgr_(nullptr), + id_to_name_(nullptr) { + SetContextMessageConsumer(syntax_context_, consumer_); + module_->SetContext(this); + InitializeCombinators(); + } + + ~IRContext() { spvContextDestroy(syntax_context_); } + + Module* module() const { return module_.get(); } + + // Returns a vector of pointers to constant-creation instructions in this + // context. + inline std::vector GetConstants(); + inline std::vector GetConstants() const; + + // Iterators for annotation instructions contained in this context. + inline Module::inst_iterator annotation_begin(); + inline Module::inst_iterator annotation_end(); + inline IteratorRange annotations(); + inline IteratorRange annotations() const; + + // Iterators for capabilities instructions contained in this module. + inline Module::inst_iterator capability_begin(); + inline Module::inst_iterator capability_end(); + inline IteratorRange capabilities(); + inline IteratorRange capabilities() const; + + // Iterators for types, constants and global variables instructions. + inline Module::inst_iterator types_values_begin(); + inline Module::inst_iterator types_values_end(); + inline IteratorRange types_values(); + inline IteratorRange types_values() const; + + // Iterators for extension instructions contained in this module. + inline Module::inst_iterator ext_inst_import_begin(); + inline Module::inst_iterator ext_inst_import_end(); + inline IteratorRange ext_inst_imports(); + inline IteratorRange ext_inst_imports() const; + + // There are several kinds of debug instructions, according to where they can + // appear in the logical layout of a module: + // - Section 7a: OpString, OpSourceExtension, OpSource, OpSourceContinued + // - Section 7b: OpName, OpMemberName + // - Section 7c: OpModuleProcessed + // - Mostly anywhere: OpLine and OpNoLine + // + + // Iterators for debug 1 instructions (excluding OpLine & OpNoLine) contained + // in this module. These are for layout section 7a. + inline Module::inst_iterator debug1_begin(); + inline Module::inst_iterator debug1_end(); + inline IteratorRange debugs1(); + inline IteratorRange debugs1() const; + + // Iterators for debug 2 instructions (excluding OpLine & OpNoLine) contained + // in this module. These are for layout section 7b. + inline Module::inst_iterator debug2_begin(); + inline Module::inst_iterator debug2_end(); + inline IteratorRange debugs2(); + inline IteratorRange debugs2() const; + + // Iterators for debug 3 instructions (excluding OpLine & OpNoLine) contained + // in this module. These are for layout section 7c. + inline Module::inst_iterator debug3_begin(); + inline Module::inst_iterator debug3_end(); + inline IteratorRange debugs3(); + inline IteratorRange debugs3() const; + + // Clears all debug instructions (excluding OpLine & OpNoLine). + inline void debug_clear(); + + // Appends a capability instruction to this module. + inline void AddCapability(std::unique_ptr&& c); + // Appends an extension instruction to this module. + inline void AddExtension(std::unique_ptr&& e); + // Appends an extended instruction set instruction to this module. + inline void AddExtInstImport(std::unique_ptr&& e); + // Set the memory model for this module. + inline void SetMemoryModel(std::unique_ptr&& m); + // Appends an entry point instruction to this module. + inline void AddEntryPoint(std::unique_ptr&& e); + // Appends an execution mode instruction to this module. + inline void AddExecutionMode(std::unique_ptr&& e); + // Appends a debug 1 instruction (excluding OpLine & OpNoLine) to this module. + // "debug 1" instructions are the ones in layout section 7.a), see section + // 2.4 Logical Layout of a Module from the SPIR-V specification. + inline void AddDebug1Inst(std::unique_ptr&& d); + // Appends a debug 2 instruction (excluding OpLine & OpNoLine) to this module. + // "debug 2" instructions are the ones in layout section 7.b), see section + // 2.4 Logical Layout of a Module from the SPIR-V specification. + inline void AddDebug2Inst(std::unique_ptr&& d); + // Appends a debug 3 instruction (OpModuleProcessed) to this module. + // This is due to decision by the SPIR Working Group, pending publication. + inline void AddDebug3Inst(std::unique_ptr&& d); + // Appends an annotation instruction to this module. + inline void AddAnnotationInst(std::unique_ptr&& a); + // Appends a type-declaration instruction to this module. + inline void AddType(std::unique_ptr&& t); + // Appends a constant, global variable, or OpUndef instruction to this module. + inline void AddGlobalValue(std::unique_ptr&& v); + // Appends a function to this module. + inline void AddFunction(std::unique_ptr&& f); + + // Returns a pointer to a def-use manager. If the def-use manager is + // invalid, it is rebuilt first. + analysis::DefUseManager* get_def_use_mgr() { + if (!AreAnalysesValid(kAnalysisDefUse)) { + BuildDefUseManager(); + } + return def_use_mgr_.get(); + } + + // Returns a pointer to a value number table. If the liveness analysis is + // invalid, it is rebuilt first. + ValueNumberTable* GetValueNumberTable() { + if (!AreAnalysesValid(kAnalysisValueNumberTable)) { + BuildValueNumberTable(); + } + return vn_table_.get(); + } + + // Returns a pointer to a liveness analysis. If the liveness analysis is + // invalid, it is rebuilt first. + LivenessAnalysis* GetLivenessAnalysis() { + if (!AreAnalysesValid(kAnalysisRegisterPressure)) { + BuildRegPressureAnalysis(); + } + return reg_pressure_.get(); + } + + // Returns the basic block for instruction |instr|. Re-builds the instruction + // block map, if needed. + BasicBlock* get_instr_block(Instruction* instr) { + if (!AreAnalysesValid(kAnalysisInstrToBlockMapping)) { + BuildInstrToBlockMapping(); + } + auto entry = instr_to_block_.find(instr); + return (entry != instr_to_block_.end()) ? entry->second : nullptr; + } + + // Returns the basic block for |id|. Re-builds the instruction block map, if + // needed. + // + // |id| must be a registered definition. + BasicBlock* get_instr_block(uint32_t id) { + Instruction* def = get_def_use_mgr()->GetDef(id); + return get_instr_block(def); + } + + // Sets the basic block for |inst|. Re-builds the mapping if it has become + // invalid. + void set_instr_block(Instruction* inst, BasicBlock* block) { + if (AreAnalysesValid(kAnalysisInstrToBlockMapping)) { + instr_to_block_[inst] = block; + } + } + + // Returns a pointer the decoration manager. If the decoration manger is + // invalid, it is rebuilt first. + analysis::DecorationManager* get_decoration_mgr() { + if (!AreAnalysesValid(kAnalysisDecorations)) { + BuildDecorationManager(); + } + return decoration_mgr_.get(); + } + + // Returns a pointer to the constant manager. If no constant manager has been + // created yet, it creates one. NOTE: Once created, the constant manager + // remains active and it is never re-built. + analysis::ConstantManager* get_constant_mgr() { + if (!constant_mgr_) + constant_mgr_ = MakeUnique(this); + return constant_mgr_.get(); + } + + // Returns a pointer to the type manager. If no type manager has been created + // yet, it creates one. NOTE: Once created, the type manager remains active it + // is never re-built. + analysis::TypeManager* get_type_mgr() { + if (!type_mgr_) + type_mgr_ = MakeUnique(consumer(), this); + return type_mgr_.get(); + } + + // Returns a pointer to the scalar evolution analysis. If it is invalid it + // will be rebuilt first. + ScalarEvolutionAnalysis* GetScalarEvolutionAnalysis() { + if (!AreAnalysesValid(kAnalysisScalarEvolution)) { + BuildScalarEvolutionAnalysis(); + } + return scalar_evolution_analysis_.get(); + } + + // Build the map from the ids to the OpName and OpMemberName instruction + // associated with it. + inline void BuildIdToNameMap(); + + // Returns a range of instrucions that contain all of the OpName and + // OpMemberNames associated with the given id. + inline IteratorRange::iterator> + GetNames(uint32_t id); + + // Sets the message consumer to the given |consumer|. |consumer| which will be + // invoked every time there is a message to be communicated to the outside. + void SetMessageConsumer(MessageConsumer c) { consumer_ = std::move(c); } + + // Returns the reference to the message consumer for this pass. + const MessageConsumer& consumer() const { return consumer_; } + + // Rebuilds the analyses in |set| that are invalid. + void BuildInvalidAnalyses(Analysis set); + + // Invalidates all of the analyses except for those in |preserved_analyses|. + void InvalidateAnalysesExceptFor(Analysis preserved_analyses); + + // Invalidates the analyses marked in |analyses_to_invalidate|. + void InvalidateAnalyses(Analysis analyses_to_invalidate); + + // Deletes the instruction defining the given |id|. Returns true on + // success, false if the given |id| is not defined at all. This method also + // erases the name, decorations, and defintion of |id|. + // + // Pointers and iterators pointing to the deleted instructions become invalid. + // However other pointers and iterators are still valid. + bool KillDef(uint32_t id); + + // Deletes the given instruction |inst|. This method erases the + // information of the given instruction's uses of its operands. If |inst| + // defines a result id, its name and decorations will also be deleted. + // + // Pointer and iterator pointing to the deleted instructions become invalid. + // However other pointers and iterators are still valid. + // + // Note that if an instruction is not in an instruction list, the memory may + // not be safe to delete, so the instruction is turned into a OpNop instead. + // This can happen with OpLabel. + // + // Returns a pointer to the instruction after |inst| or |nullptr| if no such + // instruction exists. + Instruction* KillInst(Instruction* inst); + + // Returns true if all of the given analyses are valid. + bool AreAnalysesValid(Analysis set) { return (set & valid_analyses_) == set; } + + // Replaces all uses of |before| id with |after| id. Returns true if any + // replacement happens. This method does not kill the definition of the + // |before| id. If |after| is the same as |before|, does nothing and returns + // false. + // + // |before| and |after| must be registered definitions in the DefUseManager. + bool ReplaceAllUsesWith(uint32_t before, uint32_t after); + + // Returns true if all of the analyses that are suppose to be valid are + // actually valid. + bool IsConsistent(); + + // The IRContext will look at the def and uses of |inst| and update any valid + // analyses will be updated accordingly. + inline void AnalyzeDefUse(Instruction* inst); + + // Informs the IRContext that the uses of |inst| are going to change, and that + // is should forget everything it know about the current uses. Any valid + // analyses will be updated accordingly. + void ForgetUses(Instruction* inst); + + // The IRContext will look at the uses of |inst| and update any valid analyses + // will be updated accordingly. + void AnalyzeUses(Instruction* inst); + + // Kill all name and decorate ops targeting |id|. + void KillNamesAndDecorates(uint32_t id); + + // Kill all name and decorate ops targeting the result id of |inst|. + void KillNamesAndDecorates(Instruction* inst); + + // Returns the next unique id for use by an instruction. + inline uint32_t TakeNextUniqueId() { + assert(unique_id_ != std::numeric_limits::max()); + + // Skip zero. + return ++unique_id_; + } + + // Returns true if |inst| is a combinator in the current context. + // |combinator_ops_| is built if it has not been already. + inline bool IsCombinatorInstruction(const Instruction* inst) { + if (!AreAnalysesValid(kAnalysisCombinators)) { + InitializeCombinators(); + } + const uint32_t kExtInstSetIdInIndx = 0; + const uint32_t kExtInstInstructionInIndx = 1; + + if (inst->opcode() != SpvOpExtInst) { + return combinator_ops_[0].count(inst->opcode()) != 0; + } else { + uint32_t set = inst->GetSingleWordInOperand(kExtInstSetIdInIndx); + uint32_t op = inst->GetSingleWordInOperand(kExtInstInstructionInIndx); + return combinator_ops_[set].count(op) != 0; + } + } + + // Returns a pointer to the CFG for all the functions in |module_|. + CFG* cfg() { + if (!AreAnalysesValid(kAnalysisCFG)) { + BuildCFG(); + } + return cfg_.get(); + } + + // Gets the loop descriptor for function |f|. + LoopDescriptor* GetLoopDescriptor(const Function* f); + + // Gets the dominator analysis for function |f|. + DominatorAnalysis* GetDominatorAnalysis(const Function* f); + + // Gets the postdominator analysis for function |f|. + PostDominatorAnalysis* GetPostDominatorAnalysis(const Function* f); + + // Remove the dominator tree of |f| from the cache. + inline void RemoveDominatorAnalysis(const Function* f) { + dominator_trees_.erase(f); + } + + // Remove the postdominator tree of |f| from the cache. + inline void RemovePostDominatorAnalysis(const Function* f) { + post_dominator_trees_.erase(f); + } + + // Return the next available SSA id and increment it. + inline uint32_t TakeNextId() { return module()->TakeNextIdBound(); } + + FeatureManager* get_feature_mgr() { + if (!feature_mgr_.get()) { + AnalyzeFeatures(); + } + return feature_mgr_.get(); + } + + // Returns the grammar for this context. + const AssemblyGrammar& grammar() const { return grammar_; } + + // If |inst| has not yet been analysed by the def-use manager, then analyse + // its definitions and uses. + inline void UpdateDefUse(Instruction* inst); + + const InstructionFolder& get_instruction_folder() { + if (!inst_folder_) { + inst_folder_ = MakeUnique(this); + } + return *inst_folder_; + } + + private: + // Builds the def-use manager from scratch, even if it was already valid. + void BuildDefUseManager() { + def_use_mgr_ = MakeUnique(module()); + valid_analyses_ = valid_analyses_ | kAnalysisDefUse; + } + + // Builds the instruction-block map for the whole module. + void BuildInstrToBlockMapping() { + instr_to_block_.clear(); + for (auto& fn : *module_) { + for (auto& block : fn) { + block.ForEachInst([this, &block](Instruction* inst) { + instr_to_block_[inst] = █ + }); + } + } + valid_analyses_ = valid_analyses_ | kAnalysisInstrToBlockMapping; + } + + void BuildDecorationManager() { + decoration_mgr_ = MakeUnique(module()); + valid_analyses_ = valid_analyses_ | kAnalysisDecorations; + } + + void BuildCFG() { + cfg_ = MakeUnique(module()); + valid_analyses_ = valid_analyses_ | kAnalysisCFG; + } + + void BuildScalarEvolutionAnalysis() { + scalar_evolution_analysis_ = MakeUnique(this); + valid_analyses_ = valid_analyses_ | kAnalysisScalarEvolution; + } + + // Builds the liveness analysis from scratch, even if it was already valid. + void BuildRegPressureAnalysis() { + reg_pressure_ = MakeUnique(this); + valid_analyses_ = valid_analyses_ | kAnalysisRegisterPressure; + } + + // Builds the value number table analysis from scratch, even if it was already + // valid. + void BuildValueNumberTable() { + vn_table_ = MakeUnique(this); + valid_analyses_ = valid_analyses_ | kAnalysisValueNumberTable; + } + + // Removes all computed dominator and post-dominator trees. This will force + // the context to rebuild the trees on demand. + void ResetDominatorAnalysis() { + // Clear the cache. + dominator_trees_.clear(); + post_dominator_trees_.clear(); + valid_analyses_ = valid_analyses_ | kAnalysisDominatorAnalysis; + } + + // Removes all computed loop descriptors. + void ResetLoopAnalysis() { + // Clear the cache. + loop_descriptors_.clear(); + valid_analyses_ = valid_analyses_ | kAnalysisLoopAnalysis; + } + + // Analyzes the features in the owned module. Builds the manager if required. + void AnalyzeFeatures() { + feature_mgr_ = MakeUnique(grammar_); + feature_mgr_->Analyze(module()); + } + + // Scans a module looking for it capabilities, and initializes combinator_ops_ + // accordingly. + void InitializeCombinators(); + + // Add the combinator opcode for the given capability to combinator_ops_. + void AddCombinatorsForCapability(uint32_t capability); + + // Add the combinator opcode for the given extension to combinator_ops_. + void AddCombinatorsForExtension(Instruction* extension); + + // Remove |inst| from |id_to_name_| if it is in map. + void RemoveFromIdToName(const Instruction* inst); + + // Returns true if it is suppose to be valid but it is incorrect. Returns + // true if the cfg is invalidated. + bool CheckCFG(); + + // The SPIR-V syntax context containing grammar tables for opcodes and + // operands. + spv_context syntax_context_; + + // Auxiliary object for querying SPIR-V grammar facts. + AssemblyGrammar grammar_; + + // An unique identifier for instructions in |module_|. Can be used to order + // instructions in a container. + // + // This member is initialized to 0, but always issues this value plus one. + // Therefore, 0 is not a valid unique id for an instruction. + uint32_t unique_id_; + + // The module being processed within this IR context. + std::unique_ptr module_; + + // A message consumer for diagnostics. + MessageConsumer consumer_; + + // The def-use manager for |module_|. + std::unique_ptr def_use_mgr_; + + // The instruction decoration manager for |module_|. + std::unique_ptr decoration_mgr_; + std::unique_ptr feature_mgr_; + + // A map from instructions the the basic block they belong to. This mapping is + // built on-demand when get_instr_block() is called. + // + // NOTE: Do not traverse this map. Ever. Use the function and basic block + // iterators to traverse instructions. + std::unordered_map instr_to_block_; + + // A bitset indicating which analyes are currently valid. + Analysis valid_analyses_; + + // Opcodes of shader capability core executable instructions + // without side-effect. + std::unordered_map> combinator_ops_; + + // The CFG for all the functions in |module_|. + std::unique_ptr cfg_; + + // Each function in the module will create its own dominator tree. We cache + // the result so it doesn't need to be rebuilt each time. + std::map dominator_trees_; + std::map post_dominator_trees_; + + // Cache of loop descriptors for each function. + std::unordered_map loop_descriptors_; + + // Constant manager for |module_|. + std::unique_ptr constant_mgr_; + + // Type manager for |module_|. + std::unique_ptr type_mgr_; + + // A map from an id to its corresponding OpName and OpMemberName instructions. + std::unique_ptr> id_to_name_; + + // The cache scalar evolution analysis node. + std::unique_ptr scalar_evolution_analysis_; + + // The liveness analysis |module_|. + std::unique_ptr reg_pressure_; + + std::unique_ptr vn_table_; + + std::unique_ptr inst_folder_; +}; + +inline IRContext::Analysis operator|(IRContext::Analysis lhs, + IRContext::Analysis rhs) { + return static_cast(static_cast(lhs) | + static_cast(rhs)); +} + +inline IRContext::Analysis& operator|=(IRContext::Analysis& lhs, + IRContext::Analysis rhs) { + lhs = static_cast(static_cast(lhs) | + static_cast(rhs)); + return lhs; +} + +inline IRContext::Analysis operator<<(IRContext::Analysis a, int shift) { + return static_cast(static_cast(a) << shift); +} + +inline IRContext::Analysis& operator<<=(IRContext::Analysis& a, int shift) { + a = static_cast(static_cast(a) << shift); + return a; +} + +std::vector IRContext::GetConstants() { + return module()->GetConstants(); +} + +std::vector IRContext::GetConstants() const { + return ((const Module*)module())->GetConstants(); +} + +Module::inst_iterator IRContext::annotation_begin() { + return module()->annotation_begin(); +} + +Module::inst_iterator IRContext::annotation_end() { + return module()->annotation_end(); +} + +IteratorRange IRContext::annotations() { + return module_->annotations(); +} + +IteratorRange IRContext::annotations() const { + return ((const Module*)module_.get())->annotations(); +} + +Module::inst_iterator IRContext::capability_begin() { + return module()->capability_begin(); +} + +Module::inst_iterator IRContext::capability_end() { + return module()->capability_end(); +} + +IteratorRange IRContext::capabilities() { + return module()->capabilities(); +} + +IteratorRange IRContext::capabilities() const { + return ((const Module*)module())->capabilities(); +} + +Module::inst_iterator IRContext::types_values_begin() { + return module()->types_values_begin(); +} + +Module::inst_iterator IRContext::types_values_end() { + return module()->types_values_end(); +} + +IteratorRange IRContext::types_values() { + return module()->types_values(); +} + +IteratorRange IRContext::types_values() const { + return ((const Module*)module_.get())->types_values(); +} + +Module::inst_iterator IRContext::ext_inst_import_begin() { + return module()->ext_inst_import_begin(); +} + +Module::inst_iterator IRContext::ext_inst_import_end() { + return module()->ext_inst_import_end(); +} + +IteratorRange IRContext::ext_inst_imports() { + return module()->ext_inst_imports(); +} + +IteratorRange IRContext::ext_inst_imports() const { + return ((const Module*)module_.get())->ext_inst_imports(); +} + +Module::inst_iterator IRContext::debug1_begin() { + return module()->debug1_begin(); +} + +Module::inst_iterator IRContext::debug1_end() { return module()->debug1_end(); } + +IteratorRange IRContext::debugs1() { + return module()->debugs1(); +} + +IteratorRange IRContext::debugs1() const { + return ((const Module*)module_.get())->debugs1(); +} + +Module::inst_iterator IRContext::debug2_begin() { + return module()->debug2_begin(); +} +Module::inst_iterator IRContext::debug2_end() { return module()->debug2_end(); } + +IteratorRange IRContext::debugs2() { + return module()->debugs2(); +} + +IteratorRange IRContext::debugs2() const { + return ((const Module*)module_.get())->debugs2(); +} + +Module::inst_iterator IRContext::debug3_begin() { + return module()->debug3_begin(); +} + +Module::inst_iterator IRContext::debug3_end() { return module()->debug3_end(); } + +IteratorRange IRContext::debugs3() { + return module()->debugs3(); +} + +IteratorRange IRContext::debugs3() const { + return ((const Module*)module_.get())->debugs3(); +} + +void IRContext::debug_clear() { module_->debug_clear(); } + +void IRContext::AddCapability(std::unique_ptr&& c) { + AddCombinatorsForCapability(c->GetSingleWordInOperand(0)); + module()->AddCapability(std::move(c)); +} + +void IRContext::AddExtension(std::unique_ptr&& e) { + module()->AddExtension(std::move(e)); +} + +void IRContext::AddExtInstImport(std::unique_ptr&& e) { + AddCombinatorsForExtension(e.get()); + module()->AddExtInstImport(std::move(e)); +} + +void IRContext::SetMemoryModel(std::unique_ptr&& m) { + module()->SetMemoryModel(std::move(m)); +} + +void IRContext::AddEntryPoint(std::unique_ptr&& e) { + module()->AddEntryPoint(std::move(e)); +} + +void IRContext::AddExecutionMode(std::unique_ptr&& e) { + module()->AddExecutionMode(std::move(e)); +} + +void IRContext::AddDebug1Inst(std::unique_ptr&& d) { + module()->AddDebug1Inst(std::move(d)); +} + +void IRContext::AddDebug2Inst(std::unique_ptr&& d) { + if (AreAnalysesValid(kAnalysisNameMap)) { + if (d->opcode() == SpvOpName || d->opcode() == SpvOpMemberName) { + id_to_name_->insert({d->result_id(), d.get()}); + } + } + module()->AddDebug2Inst(std::move(d)); +} + +void IRContext::AddDebug3Inst(std::unique_ptr&& d) { + module()->AddDebug3Inst(std::move(d)); +} + +void IRContext::AddAnnotationInst(std::unique_ptr&& a) { + if (AreAnalysesValid(kAnalysisDecorations)) { + get_decoration_mgr()->AddDecoration(a.get()); + } + module()->AddAnnotationInst(std::move(a)); +} + +void IRContext::AddType(std::unique_ptr&& t) { + module()->AddType(std::move(t)); + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->AnalyzeInstDefUse(&*(--types_values_end())); + } +} + +void IRContext::AddGlobalValue(std::unique_ptr&& v) { + module()->AddGlobalValue(std::move(v)); + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->AnalyzeInstDef(&*(--types_values_end())); + } +} + +void IRContext::AddFunction(std::unique_ptr&& f) { + module()->AddFunction(std::move(f)); +} + +void IRContext::AnalyzeDefUse(Instruction* inst) { + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->AnalyzeInstDefUse(inst); + } +} + +void IRContext::UpdateDefUse(Instruction* inst) { + if (AreAnalysesValid(kAnalysisDefUse)) { + get_def_use_mgr()->UpdateDefUse(inst); + } +} + +void IRContext::BuildIdToNameMap() { + id_to_name_ = MakeUnique>(); + for (Instruction& debug_inst : debugs2()) { + if (debug_inst.opcode() == SpvOpMemberName || + debug_inst.opcode() == SpvOpName) { + id_to_name_->insert({debug_inst.GetSingleWordInOperand(0), &debug_inst}); + } + } + valid_analyses_ = valid_analyses_ | kAnalysisNameMap; +} + +IteratorRange::iterator> +IRContext::GetNames(uint32_t id) { + if (!AreAnalysesValid(kAnalysisNameMap)) { + BuildIdToNameMap(); + } + auto result = id_to_name_->equal_range(id); + return make_range(std::move(result.first), std::move(result.second)); +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_IR_CONTEXT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp new file mode 100644 index 00000000000..46e2bee427f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.cpp @@ -0,0 +1,163 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/ir_loader.h" + +#include + +#include "source/opt/log.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +IrLoader::IrLoader(const MessageConsumer& consumer, Module* m) + : consumer_(consumer), + module_(m), + source_(""), + inst_index_(0) {} + +bool IrLoader::AddInstruction(const spv_parsed_instruction_t* inst) { + ++inst_index_; + const auto opcode = static_cast(inst->opcode); + if (IsDebugLineInst(opcode)) { + dbg_line_info_.push_back(Instruction(module()->context(), *inst)); + return true; + } + + std::unique_ptr spv_inst( + new Instruction(module()->context(), *inst, std::move(dbg_line_info_))); + dbg_line_info_.clear(); + + const char* src = source_.c_str(); + spv_position_t loc = {inst_index_, 0, 0}; + + // Handle function and basic block boundaries first, then normal + // instructions. + if (opcode == SpvOpFunction) { + if (function_ != nullptr) { + Error(consumer_, src, loc, "function inside function"); + return false; + } + function_ = MakeUnique(std::move(spv_inst)); + } else if (opcode == SpvOpFunctionEnd) { + if (function_ == nullptr) { + Error(consumer_, src, loc, + "OpFunctionEnd without corresponding OpFunction"); + return false; + } + if (block_ != nullptr) { + Error(consumer_, src, loc, "OpFunctionEnd inside basic block"); + return false; + } + function_->SetFunctionEnd(std::move(spv_inst)); + module_->AddFunction(std::move(function_)); + function_ = nullptr; + } else if (opcode == SpvOpLabel) { + if (function_ == nullptr) { + Error(consumer_, src, loc, "OpLabel outside function"); + return false; + } + if (block_ != nullptr) { + Error(consumer_, src, loc, "OpLabel inside basic block"); + return false; + } + block_ = MakeUnique(std::move(spv_inst)); + } else if (IsTerminatorInst(opcode)) { + if (function_ == nullptr) { + Error(consumer_, src, loc, "terminator instruction outside function"); + return false; + } + if (block_ == nullptr) { + Error(consumer_, src, loc, "terminator instruction outside basic block"); + return false; + } + block_->AddInstruction(std::move(spv_inst)); + function_->AddBasicBlock(std::move(block_)); + block_ = nullptr; + } else { + if (function_ == nullptr) { // Outside function definition + SPIRV_ASSERT(consumer_, block_ == nullptr); + if (opcode == SpvOpCapability) { + module_->AddCapability(std::move(spv_inst)); + } else if (opcode == SpvOpExtension) { + module_->AddExtension(std::move(spv_inst)); + } else if (opcode == SpvOpExtInstImport) { + module_->AddExtInstImport(std::move(spv_inst)); + } else if (opcode == SpvOpMemoryModel) { + module_->SetMemoryModel(std::move(spv_inst)); + } else if (opcode == SpvOpEntryPoint) { + module_->AddEntryPoint(std::move(spv_inst)); + } else if (opcode == SpvOpExecutionMode) { + module_->AddExecutionMode(std::move(spv_inst)); + } else if (IsDebug1Inst(opcode)) { + module_->AddDebug1Inst(std::move(spv_inst)); + } else if (IsDebug2Inst(opcode)) { + module_->AddDebug2Inst(std::move(spv_inst)); + } else if (IsDebug3Inst(opcode)) { + module_->AddDebug3Inst(std::move(spv_inst)); + } else if (IsAnnotationInst(opcode)) { + module_->AddAnnotationInst(std::move(spv_inst)); + } else if (IsTypeInst(opcode)) { + module_->AddType(std::move(spv_inst)); + } else if (IsConstantInst(opcode) || opcode == SpvOpVariable || + opcode == SpvOpUndef) { + module_->AddGlobalValue(std::move(spv_inst)); + } else { + SPIRV_UNIMPLEMENTED(consumer_, + "unhandled inst type outside function definition"); + } + } else { + if (block_ == nullptr) { // Inside function but outside blocks + if (opcode != SpvOpFunctionParameter) { + Errorf(consumer_, src, loc, + "Non-OpFunctionParameter (opcode: %d) found inside " + "function but outside basic block", + opcode); + return false; + } + function_->AddParameter(std::move(spv_inst)); + } else { + block_->AddInstruction(std::move(spv_inst)); + } + } + } + return true; +} + +// Resolves internal references among the module, functions, basic blocks, etc. +// This function should be called after adding all instructions. +void IrLoader::EndModule() { + if (block_ && function_) { + // We're in the middle of a basic block, but the terminator is missing. + // Register the block anyway. This lets us write tests with less + // boilerplate. + function_->AddBasicBlock(std::move(block_)); + block_ = nullptr; + } + if (function_) { + // We're in the middle of a function, but the OpFunctionEnd is missing. + // Register the function anyway. This lets us write tests with less + // boilerplate. + module_->AddFunction(std::move(function_)); + function_ = nullptr; + } + for (auto& function : *module_) { + for (auto& bb : function) bb.SetParent(&function); + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.h new file mode 100644 index 00000000000..940d7b0db08 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ir_loader.h @@ -0,0 +1,86 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_IR_LOADER_H_ +#define SOURCE_OPT_IR_LOADER_H_ + +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace opt { + +// Loader class for constructing SPIR-V in-memory IR representation. Methods in +// this class are designed to work with the interface for spvBinaryParse() in +// libspirv.h so that we can leverage the syntax checks implemented behind it. +// +// The user is expected to call SetModuleHeader() to fill in the module's +// header, and then AddInstruction() for each decoded instruction, and finally +// EndModule() to finalize the module. The instructions processed in sequence +// by AddInstruction() should comprise a valid SPIR-V module. +class IrLoader { + public: + // Instantiates a builder to construct the given |module| gradually. + // All internal messages will be communicated to the outside via the given + // message |consumer|. This instance only keeps a reference to the |consumer|, + // so the |consumer| should outlive this instance. + IrLoader(const MessageConsumer& consumer, Module* m); + + // Sets the source name of the module. + void SetSource(const std::string& src) { source_ = src; } + + Module* module() const { return module_; } + + // Sets the fields in the module's header to the given parameters. + void SetModuleHeader(uint32_t magic, uint32_t version, uint32_t generator, + uint32_t bound, uint32_t reserved) { + module_->SetHeader({magic, version, generator, bound, reserved}); + } + // Adds an instruction to the module. Returns true if no error occurs. This + // method will properly capture and store the data provided in |inst| so that + // |inst| is no longer needed after returning. + bool AddInstruction(const spv_parsed_instruction_t* inst); + // Finalizes the module construction. This must be called after the module + // header has been set and all instructions have been added. This is + // forgiving in the case of a missing terminator instruction on a basic block, + // or a missing OpFunctionEnd. Resolves internal bookkeeping. + void EndModule(); + + private: + // Consumer for communicating messages to outside. + const MessageConsumer& consumer_; + // The module to be built. + Module* module_; + // The source name of the module. + std::string source_; + // The last used instruction index. + uint32_t inst_index_; + // The current Function under construction. + std::unique_ptr function_; + // The current BasicBlock under construction. + std::unique_ptr block_; + // Line related debug instructions accumulated thus far. + std::vector dbg_line_info_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_IR_LOADER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/iterator.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/iterator.h new file mode 100644 index 00000000000..444d457c5c6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/iterator.h @@ -0,0 +1,358 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_ITERATOR_H_ +#define SOURCE_OPT_ITERATOR_H_ + +#include // for ptrdiff_t +#include +#include +#include +#include +#include + +namespace spvtools { +namespace opt { + +// An ad hoc iterator class for std::vector>. The +// purpose of this iterator class is to provide transparent access to those +// std::unique_ptr managed elements in the vector, behaving like we are using +// std::vector<|ValueType|>. +template +class UptrVectorIterator + : public std::iterator::type> { + public: + using super = std::iterator< + std::random_access_iterator_tag, + typename std::conditional::type>; + + using pointer = typename super::pointer; + using reference = typename super::reference; + using difference_type = typename super::difference_type; + + // Type aliases. We need to apply constness properly if |IsConst| is true. + using Uptr = std::unique_ptr; + using UptrVector = typename std::conditional, + std::vector>::type; + using UnderlyingIterator = + typename std::conditional::type; + + // Creates a new iterator from the given |container| and its raw iterator + // |it|. + UptrVectorIterator(UptrVector* container, const UnderlyingIterator& it) + : container_(container), iterator_(it) {} + UptrVectorIterator(const UptrVectorIterator&) = default; + UptrVectorIterator& operator=(const UptrVectorIterator&) = default; + + inline UptrVectorIterator& operator++(); + inline UptrVectorIterator operator++(int); + inline UptrVectorIterator& operator--(); + inline UptrVectorIterator operator--(int); + + reference operator*() const { return **iterator_; } + pointer operator->() { return (*iterator_).get(); } + reference operator[](ptrdiff_t index) { return **(iterator_ + index); } + + inline bool operator==(const UptrVectorIterator& that) const; + inline bool operator!=(const UptrVectorIterator& that) const; + + inline ptrdiff_t operator-(const UptrVectorIterator& that) const; + inline bool operator<(const UptrVectorIterator& that) const; + + // Inserts the given |value| to the position pointed to by this iterator + // and returns an iterator to the newly iserted |value|. + // If the underlying vector changes capacity, all previous iterators will be + // invalidated. Otherwise, those previous iterators pointing to after the + // insertion point will be invalidated. + template + inline typename std::enable_if::type + InsertBefore(Uptr value); + + // Inserts the given |valueVector| to the position pointed to by this iterator + // and returns an iterator to the first newly inserted value. + // If the underlying vector changes capacity, all previous iterators will be + // invalidated. Otherwise, those previous iterators pointing to after the + // insertion point will be invalidated. + template + inline typename std::enable_if::type + InsertBefore(UptrVector* valueVector); + + // Erases the value at the position pointed to by this iterator + // and returns an iterator to the following value. + // If the underlying vector changes capacity, all previous iterators will be + // invalidated. Otherwise, those previous iterators pointing to after the + // erasure point will be invalidated. + template + inline typename std::enable_if::type + Erase(); + + // Returns the underlying iterator. + UnderlyingIterator Get() const { return iterator_; } + + // Returns a valid end iterator for the underlying container. + UptrVectorIterator End() const { + return UptrVectorIterator(container_, container_->end()); + } + + private: + UptrVector* container_; // The container we are manipulating. + UnderlyingIterator iterator_; // The raw iterator from the container. +}; + +// Handy class for a (begin, end) iterator pair. +template +class IteratorRange { + public: + IteratorRange(const IteratorType& b, const IteratorType& e) + : begin_(b), end_(e) {} + IteratorRange(IteratorType&& b, IteratorType&& e) + : begin_(std::move(b)), end_(std::move(e)) {} + + IteratorType begin() const { return begin_; } + IteratorType end() const { return end_; } + + bool empty() const { return begin_ == end_; } + size_t size() const { return end_ - begin_; } + + private: + IteratorType begin_; + IteratorType end_; +}; + +// Returns a (begin, end) iterator pair for the given iterators. +// The iterators must belong to the same container. +template +inline IteratorRange make_range(const IteratorType& begin, + const IteratorType& end) { + return {begin, end}; +} + +// Returns a (begin, end) iterator pair for the given iterators. +// The iterators must belong to the same container. +template +inline IteratorRange make_range(IteratorType&& begin, + IteratorType&& end) { + return {std::move(begin), std::move(end)}; +} + +// Returns a (begin, end) iterator pair for the given container. +template > +inline IteratorRange make_range( + std::vector>& container) { + return {IteratorType(&container, container.begin()), + IteratorType(&container, container.end())}; +} + +// Returns a const (begin, end) iterator pair for the given container. +template > +inline IteratorRange make_const_range( + const std::vector>& container) { + return {IteratorType(&container, container.cbegin()), + IteratorType(&container, container.cend())}; +} + +// Wrapping iterator class that only consider elements that satisfy the given +// predicate |Predicate|. When moving to the next element of the iterator, the +// FilterIterator will iterate over the range until it finds an element that +// satisfies |Predicate| or reaches the end of the iterator. +// +// Currently this iterator is always an input iterator. +template +class FilterIterator + : public std::iterator< + std::input_iterator_tag, typename SubIterator::value_type, + typename SubIterator::difference_type, typename SubIterator::pointer, + typename SubIterator::reference> { + public: + // Iterator interface. + using iterator_category = typename SubIterator::iterator_category; + using value_type = typename SubIterator::value_type; + using pointer = typename SubIterator::pointer; + using reference = typename SubIterator::reference; + using difference_type = typename SubIterator::difference_type; + + using Range = IteratorRange; + + FilterIterator(const IteratorRange& iteration_range, + Predicate predicate) + : cur_(iteration_range.begin()), + end_(iteration_range.end()), + predicate_(predicate) { + if (!IsPredicateSatisfied()) { + MoveToNextPosition(); + } + } + + FilterIterator(const SubIterator& end, Predicate predicate) + : FilterIterator({end, end}, predicate) {} + + inline FilterIterator& operator++() { + MoveToNextPosition(); + return *this; + } + inline FilterIterator operator++(int) { + FilterIterator old = *this; + MoveToNextPosition(); + return old; + } + + reference operator*() const { return *cur_; } + pointer operator->() { return &*cur_; } + + inline bool operator==(const FilterIterator& rhs) const { + return cur_ == rhs.cur_ && end_ == rhs.end_; + } + inline bool operator!=(const FilterIterator& rhs) const { + return !(*this == rhs); + } + + // Returns the underlying iterator. + SubIterator Get() const { return cur_; } + + // Returns the sentinel iterator. + FilterIterator GetEnd() const { return FilterIterator(end_, predicate_); } + + private: + // Returns true if the predicate is satisfied or the current iterator reached + // the end. + bool IsPredicateSatisfied() { return cur_ == end_ || predicate_(*cur_); } + + void MoveToNextPosition() { + if (cur_ == end_) return; + + do { + ++cur_; + } while (!IsPredicateSatisfied()); + } + + SubIterator cur_; + SubIterator end_; + Predicate predicate_; +}; + +template +FilterIterator MakeFilterIterator( + const IteratorRange& sub_iterator_range, Predicate predicate) { + return FilterIterator(sub_iterator_range, predicate); +} + +template +FilterIterator MakeFilterIterator( + const SubIterator& begin, const SubIterator& end, Predicate predicate) { + return MakeFilterIterator(make_range(begin, end), predicate); +} + +template +typename FilterIterator::Range MakeFilterIteratorRange( + const SubIterator& begin, const SubIterator& end, Predicate predicate) { + return typename FilterIterator::Range( + MakeFilterIterator(begin, end, predicate), + MakeFilterIterator(end, end, predicate)); +} + +template +inline UptrVectorIterator& UptrVectorIterator::operator++() { + ++iterator_; + return *this; +} + +template +inline UptrVectorIterator UptrVectorIterator::operator++(int) { + auto it = *this; + ++(*this); + return it; +} + +template +inline UptrVectorIterator& UptrVectorIterator::operator--() { + --iterator_; + return *this; +} + +template +inline UptrVectorIterator UptrVectorIterator::operator--(int) { + auto it = *this; + --(*this); + return it; +} + +template +inline bool UptrVectorIterator::operator==( + const UptrVectorIterator& that) const { + return container_ == that.container_ && iterator_ == that.iterator_; +} + +template +inline bool UptrVectorIterator::operator!=( + const UptrVectorIterator& that) const { + return !(*this == that); +} + +template +inline ptrdiff_t UptrVectorIterator::operator-( + const UptrVectorIterator& that) const { + assert(container_ == that.container_); + return iterator_ - that.iterator_; +} + +template +inline bool UptrVectorIterator::operator<( + const UptrVectorIterator& that) const { + assert(container_ == that.container_); + return iterator_ < that.iterator_; +} + +template +template +inline + typename std::enable_if>::type + UptrVectorIterator::InsertBefore(Uptr value) { + auto index = iterator_ - container_->begin(); + container_->insert(iterator_, std::move(value)); + return UptrVectorIterator(container_, container_->begin() + index); +} + +template +template +inline + typename std::enable_if>::type + UptrVectorIterator::InsertBefore(UptrVector* values) { + const auto pos = iterator_ - container_->begin(); + const auto origsz = container_->size(); + container_->resize(origsz + values->size()); + std::move_backward(container_->begin() + pos, container_->begin() + origsz, + container_->end()); + std::move(values->begin(), values->end(), container_->begin() + pos); + return UptrVectorIterator(container_, container_->begin() + pos); +} + +template +template +inline + typename std::enable_if>::type + UptrVectorIterator::Erase() { + auto index = iterator_ - container_->begin(); + (void)container_->erase(iterator_); + return UptrVectorIterator(container_, container_->begin() + index); +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_ITERATOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp new file mode 100644 index 00000000000..d8256679e31 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.cpp @@ -0,0 +1,117 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/licm_pass.h" + +#include +#include + +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +Pass::Status LICMPass::Process() { + return ProcessIRContext() ? Status::SuccessWithChange + : Status::SuccessWithoutChange; +} + +bool LICMPass::ProcessIRContext() { + bool modified = false; + Module* module = get_module(); + + // Process each function in the module + for (Function& f : *module) { + modified |= ProcessFunction(&f); + } + return modified; +} + +bool LICMPass::ProcessFunction(Function* f) { + bool modified = false; + LoopDescriptor* loop_descriptor = context()->GetLoopDescriptor(f); + + // Process each loop in the function + for (Loop& loop : *loop_descriptor) { + // Ignore nested loops, as we will process them in order in ProcessLoop + if (loop.IsNested()) { + continue; + } + modified |= ProcessLoop(&loop, f); + } + return modified; +} + +bool LICMPass::ProcessLoop(Loop* loop, Function* f) { + bool modified = false; + + // Process all nested loops first + for (Loop* nested_loop : *loop) { + modified |= ProcessLoop(nested_loop, f); + } + + std::vector loop_bbs{}; + modified |= AnalyseAndHoistFromBB(loop, f, loop->GetHeaderBlock(), &loop_bbs); + + for (size_t i = 0; i < loop_bbs.size(); ++i) { + BasicBlock* bb = loop_bbs[i]; + // do not delete the element + modified |= AnalyseAndHoistFromBB(loop, f, bb, &loop_bbs); + } + + return modified; +} + +bool LICMPass::AnalyseAndHoistFromBB(Loop* loop, Function* f, BasicBlock* bb, + std::vector* loop_bbs) { + bool modified = false; + std::function hoist_inst = + [this, &loop, &modified](Instruction* inst) { + if (loop->ShouldHoistInstruction(this->context(), inst)) { + HoistInstruction(loop, inst); + modified = true; + } + }; + + if (IsImmediatelyContainedInLoop(loop, f, bb)) { + bb->ForEachInst(hoist_inst, false); + } + + DominatorAnalysis* dom_analysis = context()->GetDominatorAnalysis(f); + DominatorTree& dom_tree = dom_analysis->GetDomTree(); + + for (DominatorTreeNode* child_dom_tree_node : *dom_tree.GetTreeNode(bb)) { + if (loop->IsInsideLoop(child_dom_tree_node->bb_)) { + loop_bbs->push_back(child_dom_tree_node->bb_); + } + } + + return modified; +} + +bool LICMPass::IsImmediatelyContainedInLoop(Loop* loop, Function* f, + BasicBlock* bb) { + LoopDescriptor* loop_descriptor = context()->GetLoopDescriptor(f); + return loop == (*loop_descriptor)[bb->id()]; +} + +void LICMPass::HoistInstruction(Loop* loop, Instruction* inst) { + BasicBlock* pre_header_bb = loop->GetOrCreatePreHeaderBlock(); + inst->InsertBefore(std::move(&(*pre_header_bb->tail()))); + context()->set_instr_block(inst, pre_header_bb); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.h new file mode 100644 index 00000000000..a17450043a1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/licm_pass.h @@ -0,0 +1,67 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LICM_PASS_H_ +#define SOURCE_OPT_LICM_PASS_H_ + +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +class LICMPass : public Pass { + public: + LICMPass() {} + + const char* name() const override { return "loop-invariant-code-motion"; } + Status Process() override; + + private: + // Searches the IRContext for functions and processes each, moving invariants + // outside loops within the function where possible + // Returns true if a change was made to a function within the IRContext + bool ProcessIRContext(); + + // Checks the function for loops, calling ProcessLoop on each one found. + // Returns true if a change was made to the function, false otherwise. + bool ProcessFunction(Function* f); + + // Checks for invariants in the loop and attempts to move them to the loops + // preheader. Works from inner loop to outer when nested loops are found. + // Returns true if a change was made to the loop, false otherwise. + bool ProcessLoop(Loop* loop, Function* f); + + // Analyses each instruction in |bb|, hoisting invariants to |pre_header_bb|. + // Each child of |bb| wrt to |dom_tree| is pushed to |loop_bbs| + bool AnalyseAndHoistFromBB(Loop* loop, Function* f, BasicBlock* bb, + std::vector* loop_bbs); + + // Returns true if |bb| is immediately contained in |loop| + bool IsImmediatelyContainedInLoop(Loop* loop, Function* f, BasicBlock* bb); + + // Move the instruction to the given BasicBlock + // This method will update the instruction to block mapping for the context + void HoistInstruction(Loop* loop, Instruction* inst); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LICM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp new file mode 100644 index 00000000000..5d00e98f788 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.cpp @@ -0,0 +1,346 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/local_access_chain_convert_pass.h" + +#include "ir_builder.h" +#include "ir_context.h" +#include "iterator.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kStoreValIdInIdx = 1; +const uint32_t kAccessChainPtrIdInIdx = 0; +const uint32_t kConstantValueInIdx = 0; +const uint32_t kTypeIntWidthInIdx = 0; + +} // anonymous namespace + +void LocalAccessChainConvertPass::BuildAndAppendInst( + SpvOp opcode, uint32_t typeId, uint32_t resultId, + const std::vector& in_opnds, + std::vector>* newInsts) { + std::unique_ptr newInst( + new Instruction(context(), opcode, typeId, resultId, in_opnds)); + get_def_use_mgr()->AnalyzeInstDefUse(&*newInst); + newInsts->emplace_back(std::move(newInst)); +} + +uint32_t LocalAccessChainConvertPass::BuildAndAppendVarLoad( + const Instruction* ptrInst, uint32_t* varId, uint32_t* varPteTypeId, + std::vector>* newInsts) { + const uint32_t ldResultId = TakeNextId(); + *varId = ptrInst->GetSingleWordInOperand(kAccessChainPtrIdInIdx); + const Instruction* varInst = get_def_use_mgr()->GetDef(*varId); + assert(varInst->opcode() == SpvOpVariable); + *varPteTypeId = GetPointeeTypeId(varInst); + BuildAndAppendInst(SpvOpLoad, *varPteTypeId, ldResultId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {*varId}}}, + newInsts); + return ldResultId; +} + +void LocalAccessChainConvertPass::AppendConstantOperands( + const Instruction* ptrInst, std::vector* in_opnds) { + uint32_t iidIdx = 0; + ptrInst->ForEachInId([&iidIdx, &in_opnds, this](const uint32_t* iid) { + if (iidIdx > 0) { + const Instruction* cInst = get_def_use_mgr()->GetDef(*iid); + uint32_t val = cInst->GetSingleWordInOperand(kConstantValueInIdx); + in_opnds->push_back( + {spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, {val}}); + } + ++iidIdx; + }); +} + +void LocalAccessChainConvertPass::ReplaceAccessChainLoad( + const Instruction* address_inst, Instruction* original_load) { + // Build and append load of variable in ptrInst + std::vector> new_inst; + uint32_t varId; + uint32_t varPteTypeId; + const uint32_t ldResultId = + BuildAndAppendVarLoad(address_inst, &varId, &varPteTypeId, &new_inst); + context()->get_decoration_mgr()->CloneDecorations( + original_load->result_id(), ldResultId, {SpvDecorationRelaxedPrecision}); + original_load->InsertBefore(std::move(new_inst)); + + // Rewrite |original_load| into an extract. + Instruction::OperandList new_operands; + + // copy the result id and the type id to the new operand list. + new_operands.emplace_back(original_load->GetOperand(0)); + new_operands.emplace_back(original_load->GetOperand(1)); + + new_operands.emplace_back( + Operand({spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ldResultId}})); + AppendConstantOperands(address_inst, &new_operands); + original_load->SetOpcode(SpvOpCompositeExtract); + original_load->ReplaceOperands(new_operands); + context()->UpdateDefUse(original_load); +} + +void LocalAccessChainConvertPass::GenAccessChainStoreReplacement( + const Instruction* ptrInst, uint32_t valId, + std::vector>* newInsts) { + // Build and append load of variable in ptrInst + uint32_t varId; + uint32_t varPteTypeId; + const uint32_t ldResultId = + BuildAndAppendVarLoad(ptrInst, &varId, &varPteTypeId, newInsts); + context()->get_decoration_mgr()->CloneDecorations( + varId, ldResultId, {SpvDecorationRelaxedPrecision}); + + // Build and append Insert + const uint32_t insResultId = TakeNextId(); + std::vector ins_in_opnds = { + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {valId}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {ldResultId}}}; + AppendConstantOperands(ptrInst, &ins_in_opnds); + BuildAndAppendInst(SpvOpCompositeInsert, varPteTypeId, insResultId, + ins_in_opnds, newInsts); + + context()->get_decoration_mgr()->CloneDecorations( + varId, insResultId, {SpvDecorationRelaxedPrecision}); + + // Build and append Store + BuildAndAppendInst(SpvOpStore, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, {varId}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {insResultId}}}, + newInsts); +} + +bool LocalAccessChainConvertPass::IsConstantIndexAccessChain( + const Instruction* acp) const { + uint32_t inIdx = 0; + return acp->WhileEachInId([&inIdx, this](const uint32_t* tid) { + if (inIdx > 0) { + Instruction* opInst = get_def_use_mgr()->GetDef(*tid); + if (opInst->opcode() != SpvOpConstant) return false; + } + ++inIdx; + return true; + }); +} + +bool LocalAccessChainConvertPass::HasOnlySupportedRefs(uint32_t ptrId) { + if (supported_ref_ptrs_.find(ptrId) != supported_ref_ptrs_.end()) return true; + if (get_def_use_mgr()->WhileEachUser(ptrId, [this](Instruction* user) { + SpvOp op = user->opcode(); + if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) { + if (!HasOnlySupportedRefs(user->result_id())) { + return false; + } + } else if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName && + !IsNonTypeDecorate(op)) { + return false; + } + return true; + })) { + supported_ref_ptrs_.insert(ptrId); + return true; + } + return false; +} + +void LocalAccessChainConvertPass::FindTargetVars(Function* func) { + for (auto bi = func->begin(); bi != func->end(); ++bi) { + for (auto ii = bi->begin(); ii != bi->end(); ++ii) { + switch (ii->opcode()) { + case SpvOpStore: + case SpvOpLoad: { + uint32_t varId; + Instruction* ptrInst = GetPtr(&*ii, &varId); + if (!IsTargetVar(varId)) break; + const SpvOp op = ptrInst->opcode(); + // Rule out variables with non-supported refs eg function calls + if (!HasOnlySupportedRefs(varId)) { + seen_non_target_vars_.insert(varId); + seen_target_vars_.erase(varId); + break; + } + // Rule out variables with nested access chains + // TODO(): Convert nested access chains + if (IsNonPtrAccessChain(op) && ptrInst->GetSingleWordInOperand( + kAccessChainPtrIdInIdx) != varId) { + seen_non_target_vars_.insert(varId); + seen_target_vars_.erase(varId); + break; + } + // Rule out variables accessed with non-constant indices + if (!IsConstantIndexAccessChain(ptrInst)) { + seen_non_target_vars_.insert(varId); + seen_target_vars_.erase(varId); + break; + } + } break; + default: + break; + } + } + } +} + +bool LocalAccessChainConvertPass::ConvertLocalAccessChains(Function* func) { + FindTargetVars(func); + // Replace access chains of all targeted variables with equivalent + // extract and insert sequences + bool modified = false; + for (auto bi = func->begin(); bi != func->end(); ++bi) { + std::vector dead_instructions; + for (auto ii = bi->begin(); ii != bi->end(); ++ii) { + switch (ii->opcode()) { + case SpvOpLoad: { + uint32_t varId; + Instruction* ptrInst = GetPtr(&*ii, &varId); + if (!IsNonPtrAccessChain(ptrInst->opcode())) break; + if (!IsTargetVar(varId)) break; + std::vector> newInsts; + ReplaceAccessChainLoad(ptrInst, &*ii); + modified = true; + } break; + case SpvOpStore: { + uint32_t varId; + Instruction* ptrInst = GetPtr(&*ii, &varId); + if (!IsNonPtrAccessChain(ptrInst->opcode())) break; + if (!IsTargetVar(varId)) break; + std::vector> newInsts; + uint32_t valId = ii->GetSingleWordInOperand(kStoreValIdInIdx); + GenAccessChainStoreReplacement(ptrInst, valId, &newInsts); + dead_instructions.push_back(&*ii); + ++ii; + ii = ii.InsertBefore(std::move(newInsts)); + ++ii; + ++ii; + modified = true; + } break; + default: + break; + } + } + + while (!dead_instructions.empty()) { + Instruction* inst = dead_instructions.back(); + dead_instructions.pop_back(); + DCEInst(inst, [&dead_instructions](Instruction* other_inst) { + auto i = std::find(dead_instructions.begin(), dead_instructions.end(), + other_inst); + if (i != dead_instructions.end()) { + dead_instructions.erase(i); + } + }); + } + } + return modified; +} + +void LocalAccessChainConvertPass::Initialize() { + // Initialize Target Variable Caches + seen_target_vars_.clear(); + seen_non_target_vars_.clear(); + + // Initialize collections + supported_ref_ptrs_.clear(); + + // Initialize extension whitelist + InitExtensions(); +} + +bool LocalAccessChainConvertPass::AllExtensionsSupported() const { + // If any extension not in whitelist, return false + for (auto& ei : get_module()->extensions()) { + const char* extName = + reinterpret_cast(&ei.GetInOperand(0).words[0]); + if (extensions_whitelist_.find(extName) == extensions_whitelist_.end()) + return false; + } + return true; +} + +Pass::Status LocalAccessChainConvertPass::ProcessImpl() { + // If non-32-bit integer type in module, terminate processing + // TODO(): Handle non-32-bit integer constants in access chains + for (const Instruction& inst : get_module()->types_values()) + if (inst.opcode() == SpvOpTypeInt && + inst.GetSingleWordInOperand(kTypeIntWidthInIdx) != 32) + return Status::SuccessWithoutChange; + // Do not process if module contains OpGroupDecorate. Additional + // support required in KillNamesAndDecorates(). + // TODO(greg-lunarg): Add support for OpGroupDecorate + for (auto& ai : get_module()->annotations()) + if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + // Do not process if any disallowed extensions are enabled + if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; + // Process all entry point functions. + ProcessFunction pfn = [this](Function* fp) { + return ConvertLocalAccessChains(fp); + }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +LocalAccessChainConvertPass::LocalAccessChainConvertPass() {} + +Pass::Status LocalAccessChainConvertPass::Process() { + Initialize(); + return ProcessImpl(); +} + +void LocalAccessChainConvertPass::InitExtensions() { + extensions_whitelist_.clear(); + extensions_whitelist_.insert({ + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h new file mode 100644 index 00000000000..9d06890bfd2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_access_chain_convert_pass.h @@ -0,0 +1,130 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ +#define SOURCE_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class LocalAccessChainConvertPass : public MemPass { + public: + LocalAccessChainConvertPass(); + + const char* name() const override { return "convert-local-access-chains"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse; + } + + using ProcessFunction = std::function; + + private: + // Return true if all refs through |ptrId| are only loads or stores and + // cache ptrId in supported_ref_ptrs_. TODO(dnovillo): This function is + // replicated in other passes and it's slightly different in every pass. Is it + // possible to make one common implementation? + bool HasOnlySupportedRefs(uint32_t ptrId); + + // Search |func| and cache function scope variables of target type that are + // not accessed with non-constant-index access chains. Also cache non-target + // variables. + void FindTargetVars(Function* func); + + // Build instruction from |opcode|, |typeId|, |resultId|, and |in_opnds|. + // Append to |newInsts|. + void BuildAndAppendInst(SpvOp opcode, uint32_t typeId, uint32_t resultId, + const std::vector& in_opnds, + std::vector>* newInsts); + + // Build load of variable in |ptrInst| and append to |newInsts|. + // Return var in |varId| and its pointee type in |varPteTypeId|. + uint32_t BuildAndAppendVarLoad( + const Instruction* ptrInst, uint32_t* varId, uint32_t* varPteTypeId, + std::vector>* newInsts); + + // Append literal integer operands to |in_opnds| corresponding to constant + // integer operands from access chain |ptrInst|. Assumes all indices in + // access chains are OpConstant. + void AppendConstantOperands(const Instruction* ptrInst, + std::vector* in_opnds); + + // Create a load/insert/store equivalent to a store of + // |valId| through (constant index) access chaing |ptrInst|. + // Append to |newInsts|. + void GenAccessChainStoreReplacement( + const Instruction* ptrInst, uint32_t valId, + std::vector>* newInsts); + + // For the (constant index) access chain |address_inst|, create an + // equivalent load and extract that replaces |original_load|. The result id + // of the extract will be the same as the original result id of + // |original_load|. + void ReplaceAccessChainLoad(const Instruction* address_inst, + Instruction* original_load); + + // Return true if all indices of access chain |acp| are OpConstant integers + bool IsConstantIndexAccessChain(const Instruction* acp) const; + + // Identify all function scope variables of target type which are + // accessed only with loads, stores and access chains with constant + // indices. Convert all loads and stores of such variables into equivalent + // loads, stores, extracts and inserts. This unifies access to these + // variables to a single mode and simplifies analysis and optimization. + // See IsTargetType() for targeted types. + // + // Nested access chains and pointer access chains are not currently + // converted. + bool ConvertLocalAccessChains(Function* func); + + // Initialize extensions whitelist + void InitExtensions(); + + // Return true if all extensions in this module are allowed by this pass. + bool AllExtensionsSupported() const; + + void Initialize(); + Pass::Status ProcessImpl(); + + // Variables with only supported references, ie. loads and stores using + // variable directly or through non-ptr access chains. + std::unordered_set supported_ref_ptrs_; + + // Extensions supported by this pass. + std::unordered_set extensions_whitelist_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOCAL_ACCESS_CHAIN_CONVERT_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_redundancy_elimination.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_redundancy_elimination.cpp new file mode 100644 index 00000000000..9539e655661 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_redundancy_elimination.cpp @@ -0,0 +1,67 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/local_redundancy_elimination.h" + +#include "source/opt/value_number_table.h" + +namespace spvtools { +namespace opt { + +Pass::Status LocalRedundancyEliminationPass::Process() { + bool modified = false; + ValueNumberTable vnTable(context()); + + for (auto& func : *get_module()) { + for (auto& bb : func) { + // Keeps track of all ids that contain a given value number. We keep + // track of multiple values because they could have the same value, but + // different decorations. + std::map value_to_ids; + if (EliminateRedundanciesInBB(&bb, vnTable, &value_to_ids)) + modified = true; + } + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool LocalRedundancyEliminationPass::EliminateRedundanciesInBB( + BasicBlock* block, const ValueNumberTable& vnTable, + std::map* value_to_ids) { + bool modified = false; + + auto func = [this, &vnTable, &modified, value_to_ids](Instruction* inst) { + if (inst->result_id() == 0) { + return; + } + + uint32_t value = vnTable.GetValueNumber(inst); + + if (value == 0) { + return; + } + + auto candidate = value_to_ids->insert({value, inst->result_id()}); + if (!candidate.second) { + context()->KillNamesAndDecorates(inst); + context()->ReplaceAllUsesWith(inst->result_id(), candidate.first->second); + context()->KillInst(inst); + modified = true; + } + }; + block->ForEachInst(func); + return modified; +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_redundancy_elimination.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_redundancy_elimination.h new file mode 100644 index 00000000000..9f55c8bfea7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_redundancy_elimination.h @@ -0,0 +1,67 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ +#define SOURCE_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" +#include "source/opt/value_number_table.h" + +namespace spvtools { +namespace opt { + +// This pass implements local redundancy elimination. Its goal is to reduce the +// number of times the same value is computed. It works on each basic block +// independently, ie local. For each instruction in a basic block, it gets the +// value number for the result id, |id|, of the instruction. If that value +// number has already been computed in the basic block, it tries to replace the +// uses of |id| by the id that already contains the same value. Then the +// current instruction is deleted. +class LocalRedundancyEliminationPass : public Pass { + public: + const char* name() const override { return "local-redundancy-elimination"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisNameMap; + } + + protected: + // Deletes instructions in |block| whose value is in |value_to_ids| or is + // computed earlier in |block|. + // + // |vnTable| must have computed a value number for every result id defined + // in |bb|. + // + // |value_to_ids| is a map from value number to ids. If {vn, id} is in + // |value_to_ids| then vn is the value number of id, and the definition of id + // dominates |bb|. + // + // Returns true if the module is changed. + bool EliminateRedundanciesInBB(BasicBlock* block, + const ValueNumberTable& vnTable, + std::map* value_to_ids); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOCAL_REDUNDANCY_ELIMINATION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp new file mode 100644 index 00000000000..bb909f4aa99 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.cpp @@ -0,0 +1,255 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/local_single_block_elim_pass.h" + +#include + +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kStoreValIdInIdx = 1; + +} // anonymous namespace + +bool LocalSingleBlockLoadStoreElimPass::HasOnlySupportedRefs(uint32_t ptrId) { + if (supported_ref_ptrs_.find(ptrId) != supported_ref_ptrs_.end()) return true; + if (get_def_use_mgr()->WhileEachUser(ptrId, [this](Instruction* user) { + SpvOp op = user->opcode(); + if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) { + if (!HasOnlySupportedRefs(user->result_id())) { + return false; + } + } else if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName && + !IsNonTypeDecorate(op)) { + return false; + } + return true; + })) { + supported_ref_ptrs_.insert(ptrId); + return true; + } + return false; +} + +bool LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElim( + Function* func) { + // Perform local store/load, load/load and store/store elimination + // on each block + bool modified = false; + std::vector instructions_to_kill; + std::unordered_set instructions_to_save; + for (auto bi = func->begin(); bi != func->end(); ++bi) { + var2store_.clear(); + var2load_.clear(); + auto next = bi->begin(); + for (auto ii = next; ii != bi->end(); ii = next) { + ++next; + switch (ii->opcode()) { + case SpvOpStore: { + // Verify store variable is target type + uint32_t varId; + Instruction* ptrInst = GetPtr(&*ii, &varId); + if (!IsTargetVar(varId)) continue; + if (!HasOnlySupportedRefs(varId)) continue; + // If a store to the whole variable, remember it for succeeding + // loads and stores. Otherwise forget any previous store to that + // variable. + if (ptrInst->opcode() == SpvOpVariable) { + // If a previous store to same variable, mark the store + // for deletion if not still used. + auto prev_store = var2store_.find(varId); + if (prev_store != var2store_.end() && + instructions_to_save.count(prev_store->second) == 0) { + instructions_to_kill.push_back(prev_store->second); + modified = true; + } + + bool kill_store = false; + auto li = var2load_.find(varId); + if (li != var2load_.end()) { + if (ii->GetSingleWordInOperand(kStoreValIdInIdx) == + li->second->result_id()) { + // We are storing the same value that already exists in the + // memory location. The store does nothing. + kill_store = true; + } + } + + if (!kill_store) { + var2store_[varId] = &*ii; + var2load_.erase(varId); + } else { + instructions_to_kill.push_back(&*ii); + modified = true; + } + } else { + assert(IsNonPtrAccessChain(ptrInst->opcode())); + var2store_.erase(varId); + var2load_.erase(varId); + } + } break; + case SpvOpLoad: { + // Verify store variable is target type + uint32_t varId; + Instruction* ptrInst = GetPtr(&*ii, &varId); + if (!IsTargetVar(varId)) continue; + if (!HasOnlySupportedRefs(varId)) continue; + uint32_t replId = 0; + if (ptrInst->opcode() == SpvOpVariable) { + // If a load from a variable, look for a previous store or + // load from that variable and use its value. + auto si = var2store_.find(varId); + if (si != var2store_.end()) { + replId = si->second->GetSingleWordInOperand(kStoreValIdInIdx); + } else { + auto li = var2load_.find(varId); + if (li != var2load_.end()) { + replId = li->second->result_id(); + } + } + } else { + // If a partial load of a previously seen store, remember + // not to delete the store. + auto si = var2store_.find(varId); + if (si != var2store_.end()) instructions_to_save.insert(si->second); + } + if (replId != 0) { + // replace load's result id and delete load + context()->KillNamesAndDecorates(&*ii); + context()->ReplaceAllUsesWith(ii->result_id(), replId); + instructions_to_kill.push_back(&*ii); + modified = true; + } else { + if (ptrInst->opcode() == SpvOpVariable) + var2load_[varId] = &*ii; // register load + } + } break; + case SpvOpFunctionCall: { + // Conservatively assume all locals are redefined for now. + // TODO(): Handle more optimally + var2store_.clear(); + var2load_.clear(); + } break; + default: + break; + } + } + } + + for (Instruction* inst : instructions_to_kill) { + context()->KillInst(inst); + } + + return modified; +} + +void LocalSingleBlockLoadStoreElimPass::Initialize() { + // Initialize Target Type Caches + seen_target_vars_.clear(); + seen_non_target_vars_.clear(); + + // Clear collections + supported_ref_ptrs_.clear(); + + // Initialize extensions whitelist + InitExtensions(); +} + +bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const { + // If any extension not in whitelist, return false + for (auto& ei : get_module()->extensions()) { + const char* extName = + reinterpret_cast(&ei.GetInOperand(0).words[0]); + if (extensions_whitelist_.find(extName) == extensions_whitelist_.end()) + return false; + } + return true; +} + +Pass::Status LocalSingleBlockLoadStoreElimPass::ProcessImpl() { + // Assumes relaxed logical addressing only (see instruction.h). + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + return Status::SuccessWithoutChange; + // Do not process if module contains OpGroupDecorate. Additional + // support required in KillNamesAndDecorates(). + // TODO(greg-lunarg): Add support for OpGroupDecorate + for (auto& ai : get_module()->annotations()) + if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + // If any extensions in the module are not explicitly supported, + // return unmodified. + if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; + // Process all entry point functions + ProcessFunction pfn = [this](Function* fp) { + return LocalSingleBlockLoadStoreElim(fp); + }; + + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +LocalSingleBlockLoadStoreElimPass::LocalSingleBlockLoadStoreElimPass() = + default; + +Pass::Status LocalSingleBlockLoadStoreElimPass::Process() { + Initialize(); + return ProcessImpl(); +} + +void LocalSingleBlockLoadStoreElimPass::InitExtensions() { + extensions_whitelist_.clear(); + extensions_whitelist_.insert({ + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.h new file mode 100644 index 00000000000..3dead98347e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_block_elim_pass.h @@ -0,0 +1,105 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ +#define SOURCE_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class LocalSingleBlockLoadStoreElimPass : public MemPass { + public: + LocalSingleBlockLoadStoreElimPass(); + + const char* name() const override { return "eliminate-local-single-block"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; + } + + private: + // Return true if all uses of |varId| are only through supported reference + // operations ie. loads and store. Also cache in supported_ref_ptrs_. + // TODO(dnovillo): This function is replicated in other passes and it's + // slightly different in every pass. Is it possible to make one common + // implementation? + bool HasOnlySupportedRefs(uint32_t varId); + + // On all entry point functions, within each basic block, eliminate + // loads and stores to function variables where possible. For + // loads, if previous load or store to same variable, replace + // load id with previous id and delete load. Finally, check if + // remaining stores are useless, and delete store and variable + // where possible. Assumes logical addressing. + bool LocalSingleBlockLoadStoreElim(Function* func); + + // Initialize extensions whitelist + void InitExtensions(); + + // Return true if all extensions in this module are supported by this pass. + bool AllExtensionsSupported() const; + + void Initialize(); + Pass::Status ProcessImpl(); + + // Map from function scope variable to a store of that variable in the + // current block whose value is currently valid. This map is cleared + // at the start of each block and incrementally updated as the block + // is scanned. The stores are candidates for elimination. The map is + // conservatively cleared when a function call is encountered. + std::unordered_map var2store_; + + // Map from function scope variable to a load of that variable in the + // current block whose value is currently valid. This map is cleared + // at the start of each block and incrementally updated as the block + // is scanned. The stores are candidates for elimination. The map is + // conservatively cleared when a function call is encountered. + std::unordered_map var2load_; + + // Set of variables whose most recent store in the current block cannot be + // deleted, for example, if there is a load of the variable which is + // dependent on the store and is not replaced and deleted by this pass, + // for example, a load through an access chain. A variable is removed + // from this set each time a new store of that variable is encountered. + std::unordered_set pinned_vars_; + + // Extensions supported by this pass. + std::unordered_set extensions_whitelist_; + + // Variables that are only referenced by supported operations for this + // pass ie. loads and stores. + std::unordered_set supported_ref_ptrs_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOCAL_SINGLE_BLOCK_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp new file mode 100644 index 00000000000..4c837fc73f9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.cpp @@ -0,0 +1,241 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/local_single_store_elim_pass.h" + +#include "source/cfa.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kStoreValIdInIdx = 1; +const uint32_t kVariableInitIdInIdx = 1; + +} // anonymous namespace + +bool LocalSingleStoreElimPass::LocalSingleStoreElim(Function* func) { + bool modified = false; + + // Check all function scope variables in |func|. + BasicBlock* entry_block = &*func->begin(); + for (Instruction& inst : *entry_block) { + if (inst.opcode() != SpvOpVariable) { + break; + } + + modified |= ProcessVariable(&inst); + } + return modified; +} + +bool LocalSingleStoreElimPass::AllExtensionsSupported() const { + // If any extension not in whitelist, return false + for (auto& ei : get_module()->extensions()) { + const char* extName = + reinterpret_cast(&ei.GetInOperand(0).words[0]); + if (extensions_whitelist_.find(extName) == extensions_whitelist_.end()) + return false; + } + return true; +} + +Pass::Status LocalSingleStoreElimPass::ProcessImpl() { + // Assumes relaxed logical addressing only (see instruction.h) + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + return Status::SuccessWithoutChange; + + // Do not process if any disallowed extensions are enabled + if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; + // Process all entry point functions + ProcessFunction pfn = [this](Function* fp) { + return LocalSingleStoreElim(fp); + }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +LocalSingleStoreElimPass::LocalSingleStoreElimPass() = default; + +Pass::Status LocalSingleStoreElimPass::Process() { + InitExtensionWhiteList(); + return ProcessImpl(); +} + +void LocalSingleStoreElimPass::InitExtensionWhiteList() { + extensions_whitelist_.insert({ + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + }); +} +bool LocalSingleStoreElimPass::ProcessVariable(Instruction* var_inst) { + std::vector users; + FindUses(var_inst, &users); + + Instruction* store_inst = FindSingleStoreAndCheckUses(var_inst, users); + + if (store_inst == nullptr) { + return false; + } + + return RewriteLoads(store_inst, users); +} + +Instruction* LocalSingleStoreElimPass::FindSingleStoreAndCheckUses( + Instruction* var_inst, const std::vector& users) const { + // Make sure there is exactly 1 store. + Instruction* store_inst = nullptr; + + // If |var_inst| has an initializer, then that will count as a store. + if (var_inst->NumInOperands() > 1) { + store_inst = var_inst; + } + + for (Instruction* user : users) { + switch (user->opcode()) { + case SpvOpStore: + // Since we are in the relaxed addressing mode, the use has to be the + // base address of the store, and not the value being store. Otherwise, + // we would have a pointer to a pointer to function scope memory, which + // is not allowed. + if (store_inst == nullptr) { + store_inst = user; + } else { + // More than 1 store. + return nullptr; + } + break; + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + if (FeedsAStore(user)) { + // Has a partial store. Cannot propagate that. + return nullptr; + } + break; + case SpvOpLoad: + case SpvOpImageTexelPointer: + case SpvOpName: + case SpvOpCopyObject: + break; + default: + if (!user->IsDecoration()) { + // Don't know if this instruction modifies the variable. + // Conservatively assume it is a store. + return nullptr; + } + break; + } + } + return store_inst; +} + +void LocalSingleStoreElimPass::FindUses( + const Instruction* var_inst, std::vector* users) const { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + def_use_mgr->ForEachUser(var_inst, [users, this](Instruction* user) { + users->push_back(user); + if (user->opcode() == SpvOpCopyObject) { + FindUses(user, users); + } + }); +} + +bool LocalSingleStoreElimPass::FeedsAStore(Instruction* inst) const { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + return !def_use_mgr->WhileEachUser(inst, [this](Instruction* user) { + switch (user->opcode()) { + case SpvOpStore: + return false; + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpCopyObject: + return !FeedsAStore(user); + case SpvOpLoad: + case SpvOpImageTexelPointer: + case SpvOpName: + return true; + default: + // Don't know if this instruction modifies the variable. + // Conservatively assume it is a store. + return user->IsDecoration(); + } + }); +} + +bool LocalSingleStoreElimPass::RewriteLoads( + Instruction* store_inst, const std::vector& uses) { + BasicBlock* store_block = context()->get_instr_block(store_inst); + DominatorAnalysis* dominator_analysis = + context()->GetDominatorAnalysis(store_block->GetParent()); + + uint32_t stored_id; + if (store_inst->opcode() == SpvOpStore) + stored_id = store_inst->GetSingleWordInOperand(kStoreValIdInIdx); + else + stored_id = store_inst->GetSingleWordInOperand(kVariableInitIdInIdx); + + std::vector uses_in_store_block; + bool modified = false; + for (Instruction* use : uses) { + if (use->opcode() == SpvOpLoad) { + if (dominator_analysis->Dominates(store_inst, use)) { + modified = true; + context()->KillNamesAndDecorates(use->result_id()); + context()->ReplaceAllUsesWith(use->result_id(), stored_id); + context()->KillInst(use); + } + } + } + + return modified; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.h new file mode 100644 index 00000000000..d3d64b829ac --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_single_store_elim_pass.h @@ -0,0 +1,101 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ +#define SOURCE_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class LocalSingleStoreElimPass : public Pass { + using cbb_ptr = const BasicBlock*; + + public: + LocalSingleStoreElimPass(); + + const char* name() const override { return "eliminate-local-single-store"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; + } + + private: + // Do "single-store" optimization of function variables defined only + // with a single non-access-chain store in |func|. Replace all their + // non-access-chain loads with the value that is stored and eliminate + // any resulting dead code. + bool LocalSingleStoreElim(Function* func); + + // Initialize extensions whitelist + void InitExtensionWhiteList(); + + // Return true if all extensions in this module are allowed by this pass. + bool AllExtensionsSupported() const; + + Pass::Status ProcessImpl(); + + // If there is a single store to |var_inst|, and it covers the entire + // variable, then replace all of the loads of the entire variable that are + // dominated by the store by the value that was stored. Returns true if the + // module was changed. + bool ProcessVariable(Instruction* var_inst); + + // Collects all of the uses of |var_inst| into |uses|. This looks through + // OpObjectCopy's that copy the address of the variable, and collects those + // uses as well. + void FindUses(const Instruction* var_inst, + std::vector* uses) const; + + // Returns a store to |var_inst| if + // - it is a store to the entire variable, + // - and there are no other instructions that may modify |var_inst|. + Instruction* FindSingleStoreAndCheckUses( + Instruction* var_inst, const std::vector& users) const; + + // Returns true if the address that results from |inst| may be used as a base + // address in a store instruction or may be used to compute the base address + // of a store instruction. + bool FeedsAStore(Instruction* inst) const; + + // Replaces all of the loads in |uses| by the value stored in |store_inst|. + // The load instructions are then killed. + bool RewriteLoads(Instruction* store_inst, + const std::vector& uses); + + // Extensions supported by this pass. + std::unordered_set extensions_whitelist_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOCAL_SINGLE_STORE_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_ssa_elim_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_ssa_elim_pass.cpp new file mode 100644 index 00000000000..ec7326ed0e1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_ssa_elim_pass.cpp @@ -0,0 +1,105 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/local_ssa_elim_pass.h" + +#include "source/cfa.h" +#include "source/opt/iterator.h" +#include "source/opt/ssa_rewrite_pass.h" + +namespace spvtools { +namespace opt { + +bool LocalMultiStoreElimPass::AllExtensionsSupported() const { + // If any extension not in whitelist, return false + for (auto& ei : get_module()->extensions()) { + const char* extName = + reinterpret_cast(&ei.GetInOperand(0).words[0]); + if (extensions_whitelist_.find(extName) == extensions_whitelist_.end()) + return false; + } + return true; +} + +Pass::Status LocalMultiStoreElimPass::ProcessImpl() { + // Assumes relaxed logical addressing only (see instruction.h) + // TODO(greg-lunarg): Add support for physical addressing + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + return Status::SuccessWithoutChange; + // Do not process if module contains OpGroupDecorate. Additional + // support required in KillNamesAndDecorates(). + // TODO(greg-lunarg): Add support for OpGroupDecorate + for (auto& ai : get_module()->annotations()) + if (ai.opcode() == SpvOpGroupDecorate) return Status::SuccessWithoutChange; + // Do not process if any disallowed extensions are enabled + if (!AllExtensionsSupported()) return Status::SuccessWithoutChange; + // Process functions + ProcessFunction pfn = [this](Function* fp) { + return SSARewriter(this).RewriteFunctionIntoSSA(fp); + }; + bool modified = ProcessEntryPointCallTree(pfn, get_module()); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +LocalMultiStoreElimPass::LocalMultiStoreElimPass() = default; + +Pass::Status LocalMultiStoreElimPass::Process() { + // Initialize extension whitelist + InitExtensions(); + return ProcessImpl(); +} + +void LocalMultiStoreElimPass::InitExtensions() { + extensions_whitelist_.clear(); + extensions_whitelist_.insert({ + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", + "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", + "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", + "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", + "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", + "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", + "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", + "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", + "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", + // SPV_KHR_variable_pointers + // Currently do not support extended pointer expressions + "SPV_AMD_gpu_shader_int16", + "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", + "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", + "SPV_AMD_shader_fragment_mask", + "SPV_EXT_fragment_fully_covered", + "SPV_AMD_gpu_shader_half_float_fetch", + "SPV_GOOGLE_decorate_string", + "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", + "SPV_EXT_descriptor_indexing", + }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_ssa_elim_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_ssa_elim_pass.h new file mode 100644 index 00000000000..63d3c33bac3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/local_ssa_elim_pass.h @@ -0,0 +1,70 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_LOCAL_SSA_ELIM_PASS_H_ +#define SOURCE_OPT_LOCAL_SSA_ELIM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/mem_pass.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class LocalMultiStoreElimPass : public MemPass { + using cbb_ptr = const BasicBlock*; + + public: + using GetBlocksFunction = + std::function*(const BasicBlock*)>; + + LocalMultiStoreElimPass(); + + const char* name() const override { return "eliminate-local-multi-store"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; + } + + private: + // Initialize extensions whitelist + void InitExtensions(); + + // Return true if all extensions in this module are allowed by this pass. + bool AllExtensionsSupported() const; + + Pass::Status ProcessImpl(); + + // Extensions supported by this pass. + std::unordered_set extensions_whitelist_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOCAL_SSA_ELIM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/log.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/log.h new file mode 100644 index 00000000000..f87cbf3817b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/log.h @@ -0,0 +1,231 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_LOG_H_ +#define SOURCE_OPT_LOG_H_ + +#include +#include +#include +#include + +#include "spirv-tools/libspirv.hpp" + +// Asserts the given condition is true. Otherwise, sends a message to the +// consumer and exits the problem with failure code. Accepts the following +// formats: +// +// SPIRV_ASSERT(, ); +// SPIRV_ASSERT(, , ); +// SPIRV_ASSERT(, , +// , ); +// +// In the third format, the number of cannot exceed (5 - +// 2). If more arguments are wanted, grow PP_ARG_N and PP_NARGS in the below. +#if !defined(NDEBUG) +#define SPIRV_ASSERT(consumer, ...) SPIRV_ASSERT_IMPL(consumer, __VA_ARGS__) +#else +#define SPIRV_ASSERT(consumer, ...) +#endif + +// Logs a debug message to the consumer. Accepts the following formats: +// +// SPIRV_DEBUG(, ); +// SPIRV_DEBUG(, , ); +// +// In the second format, the number of cannot exceed (5 - +// 1). If more arguments are wanted, grow PP_ARG_N and PP_NARGS in the below. +#if !defined(NDEBUG) && defined(SPIRV_LOG_DEBUG) +#define SPIRV_DEBUG(consumer, ...) SPIRV_DEBUG_IMPL(consumer, __VA_ARGS__) +#else +#define SPIRV_DEBUG(consumer, ...) +#endif + +// Logs an error message to the consumer saying the given feature is +// unimplemented. +#define SPIRV_UNIMPLEMENTED(consumer, feature) \ + do { \ + spvtools::Log(consumer, SPV_MSG_INTERNAL_ERROR, __FILE__, \ + {__LINE__, 0, 0}, "unimplemented: " feature); \ + } while (0) + +// Logs an error message to the consumer saying the code location +// should be unreachable. +#define SPIRV_UNREACHABLE(consumer) \ + do { \ + spvtools::Log(consumer, SPV_MSG_INTERNAL_ERROR, __FILE__, \ + {__LINE__, 0, 0}, "unreachable"); \ + } while (0) + +// Helper macros for concatenating arguments. +#define SPIRV_CONCATENATE(a, b) SPIRV_CONCATENATE_(a, b) +#define SPIRV_CONCATENATE_(a, b) a##b + +// Helper macro to force expanding __VA_ARGS__ to satisfy MSVC compiler. +#define PP_EXPAND(x) x + +namespace spvtools { + +// Calls the given |consumer| by supplying the |message|. The |message| is from +// the given |source| and |location| and of the given severity |level|. +inline void Log(const MessageConsumer& consumer, spv_message_level_t level, + const char* source, const spv_position_t& position, + const char* message) { + if (consumer != nullptr) consumer(level, source, position, message); +} + +// Calls the given |consumer| by supplying the message composed according to the +// given |format|. The |message| is from the given |source| and |location| and +// of the given severity |level|. +template +void Logf(const MessageConsumer& consumer, spv_message_level_t level, + const char* source, const spv_position_t& position, + const char* format, Args&&... args) { +#if defined(_MSC_VER) && _MSC_VER < 1900 +// Sadly, snprintf() is not supported until Visual Studio 2015! +#define snprintf _snprintf +#endif + + enum { kInitBufferSize = 256 }; + + char message[kInitBufferSize]; + const int size = + snprintf(message, kInitBufferSize, format, std::forward(args)...); + + if (size >= 0 && size < kInitBufferSize) { + Log(consumer, level, source, position, message); + return; + } + + if (size >= 0) { + // The initial buffer is insufficient. Allocate a buffer of a larger size, + // and write to it instead. Force the size to be unsigned to avoid a + // warning in GCC 7.1. + std::vector longer_message(size + 1u); + snprintf(longer_message.data(), longer_message.size(), format, + std::forward(args)...); + Log(consumer, level, source, position, longer_message.data()); + return; + } + + Log(consumer, level, source, position, "cannot compose log message"); + +#if defined(_MSC_VER) && _MSC_VER < 1900 +#undef snprintf +#endif +} + +// Calls the given |consumer| by supplying the given error |message|. The +// |message| is from the given |source| and |location|. +inline void Error(const MessageConsumer& consumer, const char* source, + const spv_position_t& position, const char* message) { + Log(consumer, SPV_MSG_ERROR, source, position, message); +} + +// Calls the given |consumer| by supplying the error message composed according +// to the given |format|. The |message| is from the given |source| and +// |location|. +template +inline void Errorf(const MessageConsumer& consumer, const char* source, + const spv_position_t& position, const char* format, + Args&&... args) { + Logf(consumer, SPV_MSG_ERROR, source, position, format, + std::forward(args)...); +} + +} // namespace spvtools + +#define SPIRV_ASSERT_IMPL(consumer, ...) \ + PP_EXPAND(SPIRV_CONCATENATE(SPIRV_ASSERT_, PP_NARGS(__VA_ARGS__))( \ + consumer, __VA_ARGS__)) + +#define SPIRV_DEBUG_IMPL(consumer, ...) \ + PP_EXPAND(SPIRV_CONCATENATE(SPIRV_DEBUG_, PP_NARGS(__VA_ARGS__))( \ + consumer, __VA_ARGS__)) + +#define SPIRV_ASSERT_1(consumer, condition) \ + do { \ + if (!(condition)) { \ + spvtools::Log(consumer, SPV_MSG_INTERNAL_ERROR, __FILE__, \ + {__LINE__, 0, 0}, "assertion failed: " #condition); \ + std::exit(EXIT_FAILURE); \ + } \ + } while (0) + +#define SPIRV_ASSERT_2(consumer, condition, message) \ + do { \ + if (!(condition)) { \ + spvtools::Log(consumer, SPV_MSG_INTERNAL_ERROR, __FILE__, \ + {__LINE__, 0, 0}, "assertion failed: " message); \ + std::exit(EXIT_FAILURE); \ + } \ + } while (0) + +#define SPIRV_ASSERT_more(consumer, condition, format, ...) \ + do { \ + if (!(condition)) { \ + spvtools::Logf(consumer, SPV_MSG_INTERNAL_ERROR, __FILE__, \ + {__LINE__, 0, 0}, "assertion failed: " format, \ + __VA_ARGS__); \ + std::exit(EXIT_FAILURE); \ + } \ + } while (0) + +#define SPIRV_ASSERT_3(consumer, condition, format, ...) \ + SPIRV_ASSERT_more(consumer, condition, format, __VA_ARGS__) + +#define SPIRV_ASSERT_4(consumer, condition, format, ...) \ + SPIRV_ASSERT_more(consumer, condition, format, __VA_ARGS__) + +#define SPIRV_ASSERT_5(consumer, condition, format, ...) \ + SPIRV_ASSERT_more(consumer, condition, format, __VA_ARGS__) + +#define SPIRV_DEBUG_1(consumer, message) \ + do { \ + spvtools::Log(consumer, SPV_MSG_DEBUG, __FILE__, {__LINE__, 0, 0}, \ + message); \ + } while (0) + +#define SPIRV_DEBUG_more(consumer, format, ...) \ + do { \ + spvtools::Logf(consumer, SPV_MSG_DEBUG, __FILE__, {__LINE__, 0, 0}, \ + format, __VA_ARGS__); \ + } while (0) + +#define SPIRV_DEBUG_2(consumer, format, ...) \ + SPIRV_DEBUG_more(consumer, format, __VA_ARGS__) + +#define SPIRV_DEBUG_3(consumer, format, ...) \ + SPIRV_DEBUG_more(consumer, format, __VA_ARGS__) + +#define SPIRV_DEBUG_4(consumer, format, ...) \ + SPIRV_DEBUG_more(consumer, format, __VA_ARGS__) + +#define SPIRV_DEBUG_5(consumer, format, ...) \ + SPIRV_DEBUG_more(consumer, format, __VA_ARGS__) + +// Macros for counting the number of arguments passed in. +#define PP_NARGS(...) PP_EXPAND(PP_ARG_N(__VA_ARGS__, 5, 4, 3, 2, 1, 0)) +#define PP_ARG_N(_1, _2, _3, _4, _5, N, ...) N + +// Tests for making sure that PP_NARGS() behaves as expected. +static_assert(PP_NARGS(0) == 1, "PP_NARGS macro error"); +static_assert(PP_NARGS(0, 0) == 2, "PP_NARGS macro error"); +static_assert(PP_NARGS(0, 0, 0) == 3, "PP_NARGS macro error"); +static_assert(PP_NARGS(0, 0, 0, 0) == 4, "PP_NARGS macro error"); +static_assert(PP_NARGS(0, 0, 0, 0, 0) == 5, "PP_NARGS macro error"); +static_assert(PP_NARGS(1 + 1, 2, 3 / 3) == 3, "PP_NARGS macro error"); +static_assert(PP_NARGS((1, 1), 2, (3, 3)) == 3, "PP_NARGS macro error"); + +#endif // SOURCE_OPT_LOG_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp new file mode 100644 index 00000000000..d8de699bf76 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.cpp @@ -0,0 +1,1675 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_dependence.h" + +#include +#include +#include +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/scalar_analysis_nodes.h" + +namespace spvtools { +namespace opt { + +using SubscriptPair = std::pair; + +namespace { + +// Calculate the greatest common divisor of a & b using Stein's algorithm. +// https://en.wikipedia.org/wiki/Binary_GCD_algorithm +int64_t GreatestCommonDivisor(int64_t a, int64_t b) { + // Simple cases + if (a == b) { + return a; + } else if (a == 0) { + return b; + } else if (b == 0) { + return a; + } + + // Both even + if (a % 2 == 0 && b % 2 == 0) { + return 2 * GreatestCommonDivisor(a / 2, b / 2); + } + + // Even a, odd b + if (a % 2 == 0 && b % 2 == 1) { + return GreatestCommonDivisor(a / 2, b); + } + + // Odd a, even b + if (a % 2 == 1 && b % 2 == 0) { + return GreatestCommonDivisor(a, b / 2); + } + + // Both odd, reduce the larger argument + if (a > b) { + return GreatestCommonDivisor((a - b) / 2, b); + } else { + return GreatestCommonDivisor((b - a) / 2, a); + } +} + +// Check if node is affine, ie in the form: a0*i0 + a1*i1 + ... an*in + c +// and contains only the following types of nodes: SERecurrentNode, SEAddNode +// and SEConstantNode +bool IsInCorrectFormForGCDTest(SENode* node) { + bool children_ok = true; + + if (auto add_node = node->AsSEAddNode()) { + for (auto child : add_node->GetChildren()) { + children_ok &= IsInCorrectFormForGCDTest(child); + } + } + + bool this_ok = node->AsSERecurrentNode() || node->AsSEAddNode() || + node->AsSEConstantNode(); + + return children_ok && this_ok; +} + +// If |node| is an SERecurrentNode then returns |node| or if |node| is an +// SEAddNode returns a vector of SERecurrentNode that are its children. +std::vector GetAllTopLevelRecurrences(SENode* node) { + auto nodes = std::vector{}; + if (auto recurrent_node = node->AsSERecurrentNode()) { + nodes.push_back(recurrent_node); + } + + if (auto add_node = node->AsSEAddNode()) { + for (auto child : add_node->GetChildren()) { + auto child_nodes = GetAllTopLevelRecurrences(child); + nodes.insert(nodes.end(), child_nodes.begin(), child_nodes.end()); + } + } + + return nodes; +} + +// If |node| is an SEConstantNode then returns |node| or if |node| is an +// SEAddNode returns a vector of SEConstantNode that are its children. +std::vector GetAllTopLevelConstants(SENode* node) { + auto nodes = std::vector{}; + if (auto recurrent_node = node->AsSEConstantNode()) { + nodes.push_back(recurrent_node); + } + + if (auto add_node = node->AsSEAddNode()) { + for (auto child : add_node->GetChildren()) { + auto child_nodes = GetAllTopLevelConstants(child); + nodes.insert(nodes.end(), child_nodes.begin(), child_nodes.end()); + } + } + + return nodes; +} + +bool AreOffsetsAndCoefficientsConstant( + const std::vector& nodes) { + for (auto node : nodes) { + if (!node->GetOffset()->AsSEConstantNode() || + !node->GetOffset()->AsSEConstantNode()) { + return false; + } + } + return true; +} + +// Fold all SEConstantNode that appear in |recurrences| and |constants| into a +// single integer value. +int64_t CalculateConstantTerm(const std::vector& recurrences, + const std::vector& constants) { + int64_t constant_term = 0; + for (auto recurrence : recurrences) { + constant_term += + recurrence->GetOffset()->AsSEConstantNode()->FoldToSingleValue(); + } + + for (auto constant : constants) { + constant_term += constant->FoldToSingleValue(); + } + + return constant_term; +} + +int64_t CalculateGCDFromCoefficients( + const std::vector& recurrences, int64_t running_gcd) { + for (SERecurrentNode* recurrence : recurrences) { + auto coefficient = recurrence->GetCoefficient()->AsSEConstantNode(); + + running_gcd = GreatestCommonDivisor( + running_gcd, std::abs(coefficient->FoldToSingleValue())); + } + + return running_gcd; +} + +// Compare 2 fractions while first normalizing them, e.g. 2/4 and 4/8 will both +// be simplified to 1/2 and then determined to be equal. +bool NormalizeAndCompareFractions(int64_t numerator_0, int64_t denominator_0, + int64_t numerator_1, int64_t denominator_1) { + auto gcd_0 = + GreatestCommonDivisor(std::abs(numerator_0), std::abs(denominator_0)); + auto gcd_1 = + GreatestCommonDivisor(std::abs(numerator_1), std::abs(denominator_1)); + + auto normalized_numerator_0 = numerator_0 / gcd_0; + auto normalized_denominator_0 = denominator_0 / gcd_0; + auto normalized_numerator_1 = numerator_1 / gcd_1; + auto normalized_denominator_1 = denominator_1 / gcd_1; + + return normalized_numerator_0 == normalized_numerator_1 && + normalized_denominator_0 == normalized_denominator_1; +} + +} // namespace + +bool LoopDependenceAnalysis::GetDependence(const Instruction* source, + const Instruction* destination, + DistanceVector* distance_vector) { + // Start off by finding and marking all the loops in |loops_| that are + // irrelevant to the dependence analysis. + MarkUnsusedDistanceEntriesAsIrrelevant(source, destination, distance_vector); + + Instruction* source_access_chain = GetOperandDefinition(source, 0); + Instruction* destination_access_chain = GetOperandDefinition(destination, 0); + + auto num_access_chains = + (source_access_chain->opcode() == SpvOpAccessChain) + + (destination_access_chain->opcode() == SpvOpAccessChain); + + // If neither is an access chain, then they are load/store to a variable. + if (num_access_chains == 0) { + if (source_access_chain != destination_access_chain) { + // Not the same location, report independence + return true; + } else { + // Accessing the same variable + for (auto& entry : distance_vector->GetEntries()) { + entry = DistanceEntry(); + } + return false; + } + } + + // If only one is an access chain, it could be accessing a part of a struct + if (num_access_chains == 1) { + auto source_is_chain = source_access_chain->opcode() == SpvOpAccessChain; + auto access_chain = + source_is_chain ? source_access_chain : destination_access_chain; + auto variable = + source_is_chain ? destination_access_chain : source_access_chain; + + auto location_in_chain = GetOperandDefinition(access_chain, 0); + + if (variable != location_in_chain) { + // Not the same location, report independence + return true; + } else { + // Accessing the same variable + for (auto& entry : distance_vector->GetEntries()) { + entry = DistanceEntry(); + } + return false; + } + } + + // If the access chains aren't collecting from the same structure there is no + // dependence. + Instruction* source_array = GetOperandDefinition(source_access_chain, 0); + Instruction* destination_array = + GetOperandDefinition(destination_access_chain, 0); + + // Nested access chains are not supported yet, bail out. + if (source_array->opcode() == SpvOpAccessChain || + destination_array->opcode() == SpvOpAccessChain) { + for (auto& entry : distance_vector->GetEntries()) { + entry = DistanceEntry(); + } + return false; + } + + if (source_array != destination_array) { + PrintDebug("Proved independence through different arrays."); + return true; + } + + // To handle multiple subscripts we must get every operand in the access + // chains past the first. + std::vector source_subscripts = GetSubscripts(source); + std::vector destination_subscripts = GetSubscripts(destination); + + auto sets_of_subscripts = + PartitionSubscripts(source_subscripts, destination_subscripts); + + auto first_coupled = std::partition( + std::begin(sets_of_subscripts), std::end(sets_of_subscripts), + [](const std::set>& set) { + return set.size() == 1; + }); + + // Go through each subscript testing for independence. + // If any subscript results in independence, we prove independence between the + // load and store. + // If we can't prove independence we store what information we can gather in + // a DistanceVector. + for (auto it = std::begin(sets_of_subscripts); it < first_coupled; ++it) { + auto source_subscript = std::get<0>(*(*it).begin()); + auto destination_subscript = std::get<1>(*(*it).begin()); + + SENode* source_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(source_subscript)); + SENode* destination_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(destination_subscript)); + + // Check the loops are in a form we support. + auto subscript_pair = std::make_pair(source_node, destination_node); + + const Loop* loop = GetLoopForSubscriptPair(subscript_pair); + if (loop) { + if (!IsSupportedLoop(loop)) { + PrintDebug( + "GetDependence found an unsupported loop form. Assuming <=> for " + "loop."); + DistanceEntry* distance_entry = + GetDistanceEntryForSubscriptPair(subscript_pair, distance_vector); + if (distance_entry) { + distance_entry->direction = DistanceEntry::Directions::ALL; + } + continue; + } + } + + // If either node is simplified to a CanNotCompute we can't perform any + // analysis so must assume <=> dependence and return. + if (source_node->GetType() == SENode::CanNotCompute || + destination_node->GetType() == SENode::CanNotCompute) { + // Record the <=> dependence if we can get a DistanceEntry + PrintDebug( + "GetDependence found source_node || destination_node as " + "CanNotCompute. Abandoning evaluation for this subscript."); + DistanceEntry* distance_entry = + GetDistanceEntryForSubscriptPair(subscript_pair, distance_vector); + if (distance_entry) { + distance_entry->direction = DistanceEntry::Directions::ALL; + } + continue; + } + + // We have no induction variables so can apply a ZIV test. + if (IsZIV(subscript_pair)) { + PrintDebug("Found a ZIV subscript pair"); + if (ZIVTest(subscript_pair)) { + PrintDebug("Proved independence with ZIVTest."); + return true; + } + } + + // We have only one induction variable so should attempt an SIV test. + if (IsSIV(subscript_pair)) { + PrintDebug("Found a SIV subscript pair."); + if (SIVTest(subscript_pair, distance_vector)) { + PrintDebug("Proved independence with SIVTest."); + return true; + } + } + + // We have multiple induction variables so should attempt an MIV test. + if (IsMIV(subscript_pair)) { + PrintDebug("Found a MIV subscript pair."); + if (GCDMIVTest(subscript_pair)) { + PrintDebug("Proved independence with the GCD test."); + auto current_loops = CollectLoops(source_node, destination_node); + + for (auto current_loop : current_loops) { + auto distance_entry = + GetDistanceEntryForLoop(current_loop, distance_vector); + distance_entry->direction = DistanceEntry::Directions::NONE; + } + return true; + } + } + } + + for (auto it = first_coupled; it < std::end(sets_of_subscripts); ++it) { + auto coupled_instructions = *it; + std::vector coupled_subscripts{}; + + for (const auto& elem : coupled_instructions) { + auto source_subscript = std::get<0>(elem); + auto destination_subscript = std::get<1>(elem); + + SENode* source_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(source_subscript)); + SENode* destination_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(destination_subscript)); + + coupled_subscripts.push_back({source_node, destination_node}); + } + + auto supported = true; + + for (const auto& subscript : coupled_subscripts) { + auto loops = CollectLoops(std::get<0>(subscript), std::get<1>(subscript)); + + auto is_subscript_supported = + std::all_of(std::begin(loops), std::end(loops), + [this](const Loop* l) { return IsSupportedLoop(l); }); + + supported = supported && is_subscript_supported; + } + + if (DeltaTest(coupled_subscripts, distance_vector)) { + return true; + } + } + + // We were unable to prove independence so must gather all of the direction + // information we found. + PrintDebug( + "Couldn't prove independence.\n" + "All possible direction information has been collected in the input " + "DistanceVector."); + + return false; +} + +bool LoopDependenceAnalysis::ZIVTest( + const std::pair& subscript_pair) { + auto source = std::get<0>(subscript_pair); + auto destination = std::get<1>(subscript_pair); + + PrintDebug("Performing ZIVTest"); + // If source == destination, dependence with direction = and distance 0. + if (source == destination) { + PrintDebug("ZIVTest found EQ dependence."); + return false; + } else { + PrintDebug("ZIVTest found independence."); + // Otherwise we prove independence. + return true; + } +} + +bool LoopDependenceAnalysis::SIVTest( + const std::pair& subscript_pair, + DistanceVector* distance_vector) { + DistanceEntry* distance_entry = + GetDistanceEntryForSubscriptPair(subscript_pair, distance_vector); + if (!distance_entry) { + PrintDebug( + "SIVTest could not find a DistanceEntry for subscript_pair. Exiting"); + } + + SENode* source_node = std::get<0>(subscript_pair); + SENode* destination_node = std::get<1>(subscript_pair); + + int64_t source_induction_count = CountInductionVariables(source_node); + int64_t destination_induction_count = + CountInductionVariables(destination_node); + + // If the source node has no induction variables we can apply a + // WeakZeroSrcTest. + if (source_induction_count == 0) { + PrintDebug("Found source has no induction variable."); + if (WeakZeroSourceSIVTest( + source_node, destination_node->AsSERecurrentNode(), + destination_node->AsSERecurrentNode()->GetCoefficient(), + distance_entry)) { + PrintDebug("Proved independence with WeakZeroSourceSIVTest."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } + } + + // If the destination has no induction variables we can apply a + // WeakZeroDestTest. + if (destination_induction_count == 0) { + PrintDebug("Found destination has no induction variable."); + if (WeakZeroDestinationSIVTest( + source_node->AsSERecurrentNode(), destination_node, + source_node->AsSERecurrentNode()->GetCoefficient(), + distance_entry)) { + PrintDebug("Proved independence with WeakZeroDestinationSIVTest."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } + } + + // We now need to collect the SERecurrentExpr nodes from source and + // destination. We do not handle cases where source or destination have + // multiple SERecurrentExpr nodes. + std::vector source_recurrent_nodes = + source_node->CollectRecurrentNodes(); + std::vector destination_recurrent_nodes = + destination_node->CollectRecurrentNodes(); + + if (source_recurrent_nodes.size() == 1 && + destination_recurrent_nodes.size() == 1) { + PrintDebug("Found source and destination have 1 induction variable."); + SERecurrentNode* source_recurrent_expr = *source_recurrent_nodes.begin(); + SERecurrentNode* destination_recurrent_expr = + *destination_recurrent_nodes.begin(); + + // If the coefficients are identical we can apply a StrongSIVTest. + if (source_recurrent_expr->GetCoefficient() == + destination_recurrent_expr->GetCoefficient()) { + PrintDebug("Found source and destination share coefficient."); + if (StrongSIVTest(source_node, destination_node, + source_recurrent_expr->GetCoefficient(), + distance_entry)) { + PrintDebug("Proved independence with StrongSIVTest"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } + } + + // If the coefficients are of equal magnitude and opposite sign we can + // apply a WeakCrossingSIVTest. + if (source_recurrent_expr->GetCoefficient() == + scalar_evolution_.CreateNegation( + destination_recurrent_expr->GetCoefficient())) { + PrintDebug("Found source coefficient = -destination coefficient."); + if (WeakCrossingSIVTest(source_node, destination_node, + source_recurrent_expr->GetCoefficient(), + distance_entry)) { + PrintDebug("Proved independence with WeakCrossingSIVTest"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } + } + } + + return false; +} + +bool LoopDependenceAnalysis::StrongSIVTest(SENode* source, SENode* destination, + SENode* coefficient, + DistanceEntry* distance_entry) { + PrintDebug("Performing StrongSIVTest."); + // If both source and destination are SERecurrentNodes we can perform tests + // based on distance. + // If either source or destination contain value unknown nodes or if one or + // both are not SERecurrentNodes we must attempt a symbolic test. + std::vector source_value_unknown_nodes = + source->CollectValueUnknownNodes(); + std::vector destination_value_unknown_nodes = + destination->CollectValueUnknownNodes(); + if (source_value_unknown_nodes.size() > 0 || + destination_value_unknown_nodes.size() > 0) { + PrintDebug( + "StrongSIVTest found symbolics. Will attempt SymbolicStrongSIVTest."); + return SymbolicStrongSIVTest(source, destination, coefficient, + distance_entry); + } + + if (!source->AsSERecurrentNode() || !destination->AsSERecurrentNode()) { + PrintDebug( + "StrongSIVTest could not simplify source and destination to " + "SERecurrentNodes so will exit."); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; + } + + // Build an SENode for distance. + std::pair subscript_pair = + std::make_pair(source, destination); + const Loop* subscript_loop = GetLoopForSubscriptPair(subscript_pair); + SENode* source_constant_term = + GetConstantTerm(subscript_loop, source->AsSERecurrentNode()); + SENode* destination_constant_term = + GetConstantTerm(subscript_loop, destination->AsSERecurrentNode()); + if (!source_constant_term || !destination_constant_term) { + PrintDebug( + "StrongSIVTest could not collect the constant terms of either source " + "or destination so will exit."); + return false; + } + SENode* constant_term_delta = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateSubtraction( + destination_constant_term, source_constant_term)); + + // Scalar evolution doesn't perform division, so we must fold to constants and + // do it manually. + // We must check the offset delta and coefficient are constants. + int64_t distance = 0; + SEConstantNode* delta_constant = constant_term_delta->AsSEConstantNode(); + SEConstantNode* coefficient_constant = coefficient->AsSEConstantNode(); + if (delta_constant && coefficient_constant) { + int64_t delta_value = delta_constant->FoldToSingleValue(); + int64_t coefficient_value = coefficient_constant->FoldToSingleValue(); + PrintDebug( + "StrongSIVTest found delta value and coefficient value as constants " + "with values:\n" + "\tdelta value: " + + ToString(delta_value) + + "\n\tcoefficient value: " + ToString(coefficient_value) + "\n"); + // Check if the distance is not integral to try to prove independence. + if (delta_value % coefficient_value != 0) { + PrintDebug( + "StrongSIVTest proved independence through distance not being an " + "integer."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } else { + distance = delta_value / coefficient_value; + PrintDebug("StrongSIV test found distance as " + ToString(distance)); + } + } else { + // If we can't fold delta and coefficient to single values we can't produce + // distance. + // As a result we can't perform the rest of the pass and must assume + // dependence in all directions. + PrintDebug("StrongSIVTest could not produce a distance. Must exit."); + distance_entry->distance = DistanceEntry::Directions::ALL; + return false; + } + + // Next we gather the upper and lower bounds as constants if possible. If + // distance > upper_bound - lower_bound we prove independence. + SENode* lower_bound = GetLowerBound(subscript_loop); + SENode* upper_bound = GetUpperBound(subscript_loop); + if (lower_bound && upper_bound) { + PrintDebug("StrongSIVTest found bounds."); + SENode* bounds = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(upper_bound, lower_bound)); + + if (bounds->GetType() == SENode::SENodeType::Constant) { + int64_t bounds_value = bounds->AsSEConstantNode()->FoldToSingleValue(); + PrintDebug( + "StrongSIVTest found upper_bound - lower_bound as a constant with " + "value " + + ToString(bounds_value)); + + // If the absolute value of the distance is > upper bound - lower bound + // then we prove independence. + if (llabs(distance) > llabs(bounds_value)) { + PrintDebug( + "StrongSIVTest proved independence through distance escaping the " + "loop bounds."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::NONE; + distance_entry->distance = distance; + return true; + } + } + } else { + PrintDebug("StrongSIVTest was unable to gather lower and upper bounds."); + } + + // Otherwise we can get a direction as follows + // { < if distance > 0 + // direction = { = if distance == 0 + // { > if distance < 0 + PrintDebug( + "StrongSIVTest could not prove independence. Gathering direction " + "information."); + if (distance > 0) { + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::LT; + distance_entry->distance = distance; + return false; + } + if (distance == 0) { + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::EQ; + distance_entry->distance = 0; + return false; + } + if (distance < 0) { + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::GT; + distance_entry->distance = distance; + return false; + } + + // We were unable to prove independence or discern any additional information + // Must assume <=> direction. + PrintDebug( + "StrongSIVTest was unable to determine any dependence information."); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; +} + +bool LoopDependenceAnalysis::SymbolicStrongSIVTest( + SENode* source, SENode* destination, SENode* coefficient, + DistanceEntry* distance_entry) { + PrintDebug("Performing SymbolicStrongSIVTest."); + SENode* source_destination_delta = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(source, destination)); + // By cancelling out the induction variables by subtracting the source and + // destination we can produce an expression of symbolics and constants. This + // expression can be compared to the loop bounds to find if the offset is + // outwith the bounds. + std::pair subscript_pair = + std::make_pair(source, destination); + const Loop* subscript_loop = GetLoopForSubscriptPair(subscript_pair); + if (IsProvablyOutsideOfLoopBounds(subscript_loop, source_destination_delta, + coefficient)) { + PrintDebug( + "SymbolicStrongSIVTest proved independence through loop bounds."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } + // We were unable to prove independence or discern any additional information. + // Must assume <=> direction. + PrintDebug( + "SymbolicStrongSIVTest was unable to determine any dependence " + "information."); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; +} + +bool LoopDependenceAnalysis::WeakZeroSourceSIVTest( + SENode* source, SERecurrentNode* destination, SENode* coefficient, + DistanceEntry* distance_entry) { + PrintDebug("Performing WeakZeroSourceSIVTest."); + std::pair subscript_pair = + std::make_pair(source, destination); + const Loop* subscript_loop = GetLoopForSubscriptPair(subscript_pair); + // Build an SENode for distance. + SENode* destination_constant_term = + GetConstantTerm(subscript_loop, destination); + SENode* delta = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(source, destination_constant_term)); + + // Scalar evolution doesn't perform division, so we must fold to constants and + // do it manually. + int64_t distance = 0; + SEConstantNode* delta_constant = delta->AsSEConstantNode(); + SEConstantNode* coefficient_constant = coefficient->AsSEConstantNode(); + if (delta_constant && coefficient_constant) { + PrintDebug( + "WeakZeroSourceSIVTest folding delta and coefficient to constants."); + int64_t delta_value = delta_constant->FoldToSingleValue(); + int64_t coefficient_value = coefficient_constant->FoldToSingleValue(); + // Check if the distance is not integral. + if (delta_value % coefficient_value != 0) { + PrintDebug( + "WeakZeroSourceSIVTest proved independence through distance not " + "being an integer."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } else { + distance = delta_value / coefficient_value; + PrintDebug( + "WeakZeroSourceSIVTest calculated distance with the following " + "values\n" + "\tdelta value: " + + ToString(delta_value) + + "\n\tcoefficient value: " + ToString(coefficient_value) + + "\n\tdistance: " + ToString(distance) + "\n"); + } + } else { + PrintDebug( + "WeakZeroSourceSIVTest was unable to fold delta and coefficient to " + "constants."); + } + + // If we can prove the distance is outside the bounds we prove independence. + SEConstantNode* lower_bound = + GetLowerBound(subscript_loop)->AsSEConstantNode(); + SEConstantNode* upper_bound = + GetUpperBound(subscript_loop)->AsSEConstantNode(); + if (lower_bound && upper_bound) { + PrintDebug("WeakZeroSourceSIVTest found bounds as SEConstantNodes."); + int64_t lower_bound_value = lower_bound->FoldToSingleValue(); + int64_t upper_bound_value = upper_bound->FoldToSingleValue(); + if (!IsWithinBounds(llabs(distance), lower_bound_value, + upper_bound_value)) { + PrintDebug( + "WeakZeroSourceSIVTest proved independence through distance escaping " + "the loop bounds."); + PrintDebug( + "Bound values were as follow\n" + "\tlower bound value: " + + ToString(lower_bound_value) + + "\n\tupper bound value: " + ToString(upper_bound_value) + + "\n\tdistance value: " + ToString(distance) + "\n"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::NONE; + distance_entry->distance = distance; + return true; + } + } else { + PrintDebug( + "WeakZeroSourceSIVTest was unable to find lower and upper bound as " + "SEConstantNodes."); + } + + // Now we want to see if we can detect to peel the first or last iterations. + + // We get the FirstTripValue as GetFirstTripInductionNode() + + // GetConstantTerm(destination) + SENode* first_trip_SENode = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateAddNode( + GetFirstTripInductionNode(subscript_loop), + GetConstantTerm(subscript_loop, destination))); + + // If source == FirstTripValue, peel_first. + if (first_trip_SENode) { + PrintDebug("WeakZeroSourceSIVTest built first_trip_SENode."); + if (first_trip_SENode->AsSEConstantNode()) { + PrintDebug( + "WeakZeroSourceSIVTest has found first_trip_SENode as an " + "SEConstantNode with value: " + + ToString(first_trip_SENode->AsSEConstantNode()->FoldToSingleValue()) + + "\n"); + } + if (source == first_trip_SENode) { + // We have found that peeling the first iteration will break dependency. + PrintDebug( + "WeakZeroSourceSIVTest has found peeling first iteration will break " + "dependency"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::PEEL; + distance_entry->peel_first = true; + return false; + } + } else { + PrintDebug("WeakZeroSourceSIVTest was unable to build first_trip_SENode"); + } + + // We get the LastTripValue as GetFinalTripInductionNode(coefficient) + + // GetConstantTerm(destination) + SENode* final_trip_SENode = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateAddNode( + GetFinalTripInductionNode(subscript_loop, coefficient), + GetConstantTerm(subscript_loop, destination))); + + // If source == LastTripValue, peel_last. + if (final_trip_SENode) { + PrintDebug("WeakZeroSourceSIVTest built final_trip_SENode."); + if (first_trip_SENode->AsSEConstantNode()) { + PrintDebug( + "WeakZeroSourceSIVTest has found final_trip_SENode as an " + "SEConstantNode with value: " + + ToString(final_trip_SENode->AsSEConstantNode()->FoldToSingleValue()) + + "\n"); + } + if (source == final_trip_SENode) { + // We have found that peeling the last iteration will break dependency. + PrintDebug( + "WeakZeroSourceSIVTest has found peeling final iteration will break " + "dependency"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::PEEL; + distance_entry->peel_last = true; + return false; + } + } else { + PrintDebug("WeakZeroSourceSIVTest was unable to build final_trip_SENode"); + } + + // We were unable to prove independence or discern any additional information. + // Must assume <=> direction. + PrintDebug( + "WeakZeroSourceSIVTest was unable to determine any dependence " + "information."); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; +} + +bool LoopDependenceAnalysis::WeakZeroDestinationSIVTest( + SERecurrentNode* source, SENode* destination, SENode* coefficient, + DistanceEntry* distance_entry) { + PrintDebug("Performing WeakZeroDestinationSIVTest."); + // Build an SENode for distance. + std::pair subscript_pair = + std::make_pair(source, destination); + const Loop* subscript_loop = GetLoopForSubscriptPair(subscript_pair); + SENode* source_constant_term = GetConstantTerm(subscript_loop, source); + SENode* delta = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(destination, source_constant_term)); + + // Scalar evolution doesn't perform division, so we must fold to constants and + // do it manually. + int64_t distance = 0; + SEConstantNode* delta_constant = delta->AsSEConstantNode(); + SEConstantNode* coefficient_constant = coefficient->AsSEConstantNode(); + if (delta_constant && coefficient_constant) { + PrintDebug( + "WeakZeroDestinationSIVTest folding delta and coefficient to " + "constants."); + int64_t delta_value = delta_constant->FoldToSingleValue(); + int64_t coefficient_value = coefficient_constant->FoldToSingleValue(); + // Check if the distance is not integral. + if (delta_value % coefficient_value != 0) { + PrintDebug( + "WeakZeroDestinationSIVTest proved independence through distance not " + "being an integer."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } else { + distance = delta_value / coefficient_value; + PrintDebug( + "WeakZeroDestinationSIVTest calculated distance with the following " + "values\n" + "\tdelta value: " + + ToString(delta_value) + + "\n\tcoefficient value: " + ToString(coefficient_value) + + "\n\tdistance: " + ToString(distance) + "\n"); + } + } else { + PrintDebug( + "WeakZeroDestinationSIVTest was unable to fold delta and coefficient " + "to constants."); + } + + // If we can prove the distance is outside the bounds we prove independence. + SEConstantNode* lower_bound = + GetLowerBound(subscript_loop)->AsSEConstantNode(); + SEConstantNode* upper_bound = + GetUpperBound(subscript_loop)->AsSEConstantNode(); + if (lower_bound && upper_bound) { + PrintDebug("WeakZeroDestinationSIVTest found bounds as SEConstantNodes."); + int64_t lower_bound_value = lower_bound->FoldToSingleValue(); + int64_t upper_bound_value = upper_bound->FoldToSingleValue(); + if (!IsWithinBounds(llabs(distance), lower_bound_value, + upper_bound_value)) { + PrintDebug( + "WeakZeroDestinationSIVTest proved independence through distance " + "escaping the loop bounds."); + PrintDebug( + "Bound values were as follows\n" + "\tlower bound value: " + + ToString(lower_bound_value) + + "\n\tupper bound value: " + ToString(upper_bound_value) + + "\n\tdistance value: " + ToString(distance)); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::NONE; + distance_entry->distance = distance; + return true; + } + } else { + PrintDebug( + "WeakZeroDestinationSIVTest was unable to find lower and upper bound " + "as SEConstantNodes."); + } + + // Now we want to see if we can detect to peel the first or last iterations. + + // We get the FirstTripValue as GetFirstTripInductionNode() + + // GetConstantTerm(source) + SENode* first_trip_SENode = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateAddNode(GetFirstTripInductionNode(subscript_loop), + GetConstantTerm(subscript_loop, source))); + + // If destination == FirstTripValue, peel_first. + if (first_trip_SENode) { + PrintDebug("WeakZeroDestinationSIVTest built first_trip_SENode."); + if (first_trip_SENode->AsSEConstantNode()) { + PrintDebug( + "WeakZeroDestinationSIVTest has found first_trip_SENode as an " + "SEConstantNode with value: " + + ToString(first_trip_SENode->AsSEConstantNode()->FoldToSingleValue()) + + "\n"); + } + if (destination == first_trip_SENode) { + // We have found that peeling the first iteration will break dependency. + PrintDebug( + "WeakZeroDestinationSIVTest has found peeling first iteration will " + "break dependency"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::PEEL; + distance_entry->peel_first = true; + return false; + } + } else { + PrintDebug( + "WeakZeroDestinationSIVTest was unable to build first_trip_SENode"); + } + + // We get the LastTripValue as GetFinalTripInductionNode(coefficient) + + // GetConstantTerm(source) + SENode* final_trip_SENode = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateAddNode( + GetFinalTripInductionNode(subscript_loop, coefficient), + GetConstantTerm(subscript_loop, source))); + + // If destination == LastTripValue, peel_last. + if (final_trip_SENode) { + PrintDebug("WeakZeroDestinationSIVTest built final_trip_SENode."); + if (final_trip_SENode->AsSEConstantNode()) { + PrintDebug( + "WeakZeroDestinationSIVTest has found final_trip_SENode as an " + "SEConstantNode with value: " + + ToString(final_trip_SENode->AsSEConstantNode()->FoldToSingleValue()) + + "\n"); + } + if (destination == final_trip_SENode) { + // We have found that peeling the last iteration will break dependency. + PrintDebug( + "WeakZeroDestinationSIVTest has found peeling final iteration will " + "break dependency"); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::PEEL; + distance_entry->peel_last = true; + return false; + } + } else { + PrintDebug( + "WeakZeroDestinationSIVTest was unable to build final_trip_SENode"); + } + + // We were unable to prove independence or discern any additional information. + // Must assume <=> direction. + PrintDebug( + "WeakZeroDestinationSIVTest was unable to determine any dependence " + "information."); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; +} + +bool LoopDependenceAnalysis::WeakCrossingSIVTest( + SENode* source, SENode* destination, SENode* coefficient, + DistanceEntry* distance_entry) { + PrintDebug("Performing WeakCrossingSIVTest."); + // We currently can't handle symbolic WeakCrossingSIVTests. If either source + // or destination are not SERecurrentNodes we must exit. + if (!source->AsSERecurrentNode() || !destination->AsSERecurrentNode()) { + PrintDebug( + "WeakCrossingSIVTest found source or destination != SERecurrentNode. " + "Exiting"); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; + } + + // Build an SENode for distance. + SENode* offset_delta = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateSubtraction( + destination->AsSERecurrentNode()->GetOffset(), + source->AsSERecurrentNode()->GetOffset())); + + // Scalar evolution doesn't perform division, so we must fold to constants and + // do it manually. + int64_t distance = 0; + SEConstantNode* delta_constant = offset_delta->AsSEConstantNode(); + SEConstantNode* coefficient_constant = coefficient->AsSEConstantNode(); + if (delta_constant && coefficient_constant) { + PrintDebug( + "WeakCrossingSIVTest folding offset_delta and coefficient to " + "constants."); + int64_t delta_value = delta_constant->FoldToSingleValue(); + int64_t coefficient_value = coefficient_constant->FoldToSingleValue(); + // Check if the distance is not integral or if it has a non-integral part + // equal to 1/2. + if (delta_value % (2 * coefficient_value) != 0 && + static_cast(delta_value % (2 * coefficient_value)) / + static_cast(2 * coefficient_value) != + 0.5) { + PrintDebug( + "WeakCrossingSIVTest proved independence through distance escaping " + "the loop bounds."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DIRECTION; + distance_entry->direction = DistanceEntry::Directions::NONE; + return true; + } else { + distance = delta_value / (2 * coefficient_value); + } + + if (distance == 0) { + PrintDebug("WeakCrossingSIVTest found EQ dependence."); + distance_entry->dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + distance_entry->direction = DistanceEntry::Directions::EQ; + distance_entry->distance = 0; + return false; + } + } else { + PrintDebug( + "WeakCrossingSIVTest was unable to fold offset_delta and coefficient " + "to constants."); + } + + // We were unable to prove independence or discern any additional information. + // Must assume <=> direction. + PrintDebug( + "WeakCrossingSIVTest was unable to determine any dependence " + "information."); + distance_entry->direction = DistanceEntry::Directions::ALL; + return false; +} + +// Perform the GCD test if both, the source and the destination nodes, are in +// the form a0*i0 + a1*i1 + ... an*in + c. +bool LoopDependenceAnalysis::GCDMIVTest( + const std::pair& subscript_pair) { + auto source = std::get<0>(subscript_pair); + auto destination = std::get<1>(subscript_pair); + + // Bail out if source/destination is in an unexpected form. + if (!IsInCorrectFormForGCDTest(source) || + !IsInCorrectFormForGCDTest(destination)) { + return false; + } + + auto source_recurrences = GetAllTopLevelRecurrences(source); + auto dest_recurrences = GetAllTopLevelRecurrences(destination); + + // Bail out if all offsets and coefficients aren't constant. + if (!AreOffsetsAndCoefficientsConstant(source_recurrences) || + !AreOffsetsAndCoefficientsConstant(dest_recurrences)) { + return false; + } + + // Calculate the GCD of all coefficients. + auto source_constants = GetAllTopLevelConstants(source); + int64_t source_constant = + CalculateConstantTerm(source_recurrences, source_constants); + + auto dest_constants = GetAllTopLevelConstants(destination); + int64_t destination_constant = + CalculateConstantTerm(dest_recurrences, dest_constants); + + int64_t delta = std::abs(source_constant - destination_constant); + + int64_t running_gcd = 0; + + running_gcd = CalculateGCDFromCoefficients(source_recurrences, running_gcd); + running_gcd = CalculateGCDFromCoefficients(dest_recurrences, running_gcd); + + return delta % running_gcd != 0; +} + +using PartitionedSubscripts = + std::vector>>; +PartitionedSubscripts LoopDependenceAnalysis::PartitionSubscripts( + const std::vector& source_subscripts, + const std::vector& destination_subscripts) { + PartitionedSubscripts partitions{}; + + auto num_subscripts = source_subscripts.size(); + + // Create initial partitions with one subscript pair per partition. + for (size_t i = 0; i < num_subscripts; ++i) { + partitions.push_back({{source_subscripts[i], destination_subscripts[i]}}); + } + + // Iterate over the loops to create all partitions + for (auto loop : loops_) { + int64_t k = -1; + + for (size_t j = 0; j < partitions.size(); ++j) { + auto& current_partition = partitions[j]; + + // Does |loop| appear in |current_partition| + auto it = std::find_if( + current_partition.begin(), current_partition.end(), + [loop, + this](const std::pair& elem) -> bool { + auto source_recurrences = + scalar_evolution_.AnalyzeInstruction(std::get<0>(elem)) + ->CollectRecurrentNodes(); + auto destination_recurrences = + scalar_evolution_.AnalyzeInstruction(std::get<1>(elem)) + ->CollectRecurrentNodes(); + + source_recurrences.insert(source_recurrences.end(), + destination_recurrences.begin(), + destination_recurrences.end()); + + auto loops_in_pair = CollectLoops(source_recurrences); + auto end_it = loops_in_pair.end(); + + return std::find(loops_in_pair.begin(), end_it, loop) != end_it; + }); + + auto has_loop = it != current_partition.end(); + + if (has_loop) { + if (k == -1) { + k = j; + } else { + // Add |partitions[j]| to |partitions[k]| and discard |partitions[j]| + partitions[static_cast(k)].insert(current_partition.begin(), + current_partition.end()); + current_partition.clear(); + } + } + } + } + + // Remove empty (discarded) partitions + partitions.erase( + std::remove_if( + partitions.begin(), partitions.end(), + [](const std::set>& partition) { + return partition.empty(); + }), + partitions.end()); + + return partitions; +} + +Constraint* LoopDependenceAnalysis::IntersectConstraints( + Constraint* constraint_0, Constraint* constraint_1, + const SENode* lower_bound, const SENode* upper_bound) { + if (constraint_0->AsDependenceNone()) { + return constraint_1; + } else if (constraint_1->AsDependenceNone()) { + return constraint_0; + } + + // Both constraints are distances. Either the same distance or independent. + if (constraint_0->AsDependenceDistance() && + constraint_1->AsDependenceDistance()) { + auto dist_0 = constraint_0->AsDependenceDistance(); + auto dist_1 = constraint_1->AsDependenceDistance(); + + if (*dist_0->GetDistance() == *dist_1->GetDistance()) { + return constraint_0; + } else { + return make_constraint(); + } + } + + // Both constraints are points. Either the same point or independent. + if (constraint_0->AsDependencePoint() && constraint_1->AsDependencePoint()) { + auto point_0 = constraint_0->AsDependencePoint(); + auto point_1 = constraint_1->AsDependencePoint(); + + if (*point_0->GetSource() == *point_1->GetSource() && + *point_0->GetDestination() == *point_1->GetDestination()) { + return constraint_0; + } else { + return make_constraint(); + } + } + + // Both constraints are lines/distances. + if ((constraint_0->AsDependenceDistance() || + constraint_0->AsDependenceLine()) && + (constraint_1->AsDependenceDistance() || + constraint_1->AsDependenceLine())) { + auto is_distance_0 = constraint_0->AsDependenceDistance() != nullptr; + auto is_distance_1 = constraint_1->AsDependenceDistance() != nullptr; + + auto a0 = is_distance_0 ? scalar_evolution_.CreateConstant(1) + : constraint_0->AsDependenceLine()->GetA(); + auto b0 = is_distance_0 ? scalar_evolution_.CreateConstant(-1) + : constraint_0->AsDependenceLine()->GetB(); + auto c0 = + is_distance_0 + ? scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateNegation( + constraint_0->AsDependenceDistance()->GetDistance())) + : constraint_0->AsDependenceLine()->GetC(); + + auto a1 = is_distance_1 ? scalar_evolution_.CreateConstant(1) + : constraint_1->AsDependenceLine()->GetA(); + auto b1 = is_distance_1 ? scalar_evolution_.CreateConstant(-1) + : constraint_1->AsDependenceLine()->GetB(); + auto c1 = + is_distance_1 + ? scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateNegation( + constraint_1->AsDependenceDistance()->GetDistance())) + : constraint_1->AsDependenceLine()->GetC(); + + if (a0->AsSEConstantNode() && b0->AsSEConstantNode() && + c0->AsSEConstantNode() && a1->AsSEConstantNode() && + b1->AsSEConstantNode() && c1->AsSEConstantNode()) { + auto constant_a0 = a0->AsSEConstantNode()->FoldToSingleValue(); + auto constant_b0 = b0->AsSEConstantNode()->FoldToSingleValue(); + auto constant_c0 = c0->AsSEConstantNode()->FoldToSingleValue(); + + auto constant_a1 = a1->AsSEConstantNode()->FoldToSingleValue(); + auto constant_b1 = b1->AsSEConstantNode()->FoldToSingleValue(); + auto constant_c1 = c1->AsSEConstantNode()->FoldToSingleValue(); + + // a & b can't both be zero, otherwise it wouldn't be line. + if (NormalizeAndCompareFractions(constant_a0, constant_b0, constant_a1, + constant_b1)) { + // Slopes are equal, either parallel lines or the same line. + + if (constant_b0 == 0 && constant_b1 == 0) { + if (NormalizeAndCompareFractions(constant_c0, constant_a0, + constant_c1, constant_a1)) { + return constraint_0; + } + + return make_constraint(); + } else if (NormalizeAndCompareFractions(constant_c0, constant_b0, + constant_c1, constant_b1)) { + // Same line. + return constraint_0; + } else { + // Parallel lines can't intersect, report independence. + return make_constraint(); + } + + } else { + // Lines are not parallel, therefore, they must intersect. + + // Calculate intersection. + if (upper_bound->AsSEConstantNode() && + lower_bound->AsSEConstantNode()) { + auto constant_lower_bound = + lower_bound->AsSEConstantNode()->FoldToSingleValue(); + auto constant_upper_bound = + upper_bound->AsSEConstantNode()->FoldToSingleValue(); + + auto up = constant_b1 * constant_c0 - constant_b0 * constant_c1; + // Both b or both a can't be 0, so down is never 0 + // otherwise would have entered the parallel line section. + auto down = constant_b1 * constant_a0 - constant_b0 * constant_a1; + + auto x_coord = up / down; + + int64_t y_coord = 0; + int64_t arg1 = 0; + int64_t const_b_to_use = 0; + + if (constant_b1 != 0) { + arg1 = constant_c1 - constant_a1 * x_coord; + y_coord = arg1 / constant_b1; + const_b_to_use = constant_b1; + } else if (constant_b0 != 0) { + arg1 = constant_c0 - constant_a0 * x_coord; + y_coord = arg1 / constant_b0; + const_b_to_use = constant_b0; + } + + if (up % down == 0 && + arg1 % const_b_to_use == 0 && // Coordinates are integers. + constant_lower_bound <= + x_coord && // x_coord is within loop bounds. + x_coord <= constant_upper_bound && + constant_lower_bound <= + y_coord && // y_coord is within loop bounds. + y_coord <= constant_upper_bound) { + // Lines intersect at integer coordinates. + return make_constraint( + scalar_evolution_.CreateConstant(x_coord), + scalar_evolution_.CreateConstant(y_coord), + constraint_0->GetLoop()); + + } else { + return make_constraint(); + } + + } else { + // Not constants, bail out. + return make_constraint(); + } + } + + } else { + // Not constants, bail out. + return make_constraint(); + } + } + + // One constraint is a line/distance and the other is a point. + if ((constraint_0->AsDependencePoint() && + (constraint_1->AsDependenceLine() || + constraint_1->AsDependenceDistance())) || + (constraint_1->AsDependencePoint() && + (constraint_0->AsDependenceLine() || + constraint_0->AsDependenceDistance()))) { + auto point_0 = constraint_0->AsDependencePoint() != nullptr; + + auto point = point_0 ? constraint_0->AsDependencePoint() + : constraint_1->AsDependencePoint(); + + auto line_or_distance = point_0 ? constraint_1 : constraint_0; + + auto is_distance = line_or_distance->AsDependenceDistance() != nullptr; + + auto a = is_distance ? scalar_evolution_.CreateConstant(1) + : line_or_distance->AsDependenceLine()->GetA(); + auto b = is_distance ? scalar_evolution_.CreateConstant(-1) + : line_or_distance->AsDependenceLine()->GetB(); + auto c = + is_distance + ? scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateNegation( + line_or_distance->AsDependenceDistance()->GetDistance())) + : line_or_distance->AsDependenceLine()->GetC(); + + auto x = point->GetSource(); + auto y = point->GetDestination(); + + if (a->AsSEConstantNode() && b->AsSEConstantNode() && + c->AsSEConstantNode() && x->AsSEConstantNode() && + y->AsSEConstantNode()) { + auto constant_a = a->AsSEConstantNode()->FoldToSingleValue(); + auto constant_b = b->AsSEConstantNode()->FoldToSingleValue(); + auto constant_c = c->AsSEConstantNode()->FoldToSingleValue(); + + auto constant_x = x->AsSEConstantNode()->FoldToSingleValue(); + auto constant_y = y->AsSEConstantNode()->FoldToSingleValue(); + + auto left_hand_side = constant_a * constant_x + constant_b * constant_y; + + if (left_hand_side == constant_c) { + // Point is on line, return point + return point_0 ? constraint_0 : constraint_1; + } else { + // Point not on line, report independence (empty constraint). + return make_constraint(); + } + + } else { + // Not constants, bail out. + return make_constraint(); + } + } + + return nullptr; +} + +// Propagate constraints function as described in section 5 of Practical +// Dependence Testing, Goff, Kennedy, Tseng, 1991. +SubscriptPair LoopDependenceAnalysis::PropagateConstraints( + const SubscriptPair& subscript_pair, + const std::vector& constraints) { + SENode* new_first = subscript_pair.first; + SENode* new_second = subscript_pair.second; + + for (auto& constraint : constraints) { + // In the paper this is a[k]. We're extracting the coefficient ('a') of a + // recurrent expression with respect to the loop 'k'. + SENode* coefficient_of_recurrent = + scalar_evolution_.GetCoefficientFromRecurrentTerm( + new_first, constraint->GetLoop()); + + // In the paper this is a'[k]. + SENode* coefficient_of_recurrent_prime = + scalar_evolution_.GetCoefficientFromRecurrentTerm( + new_second, constraint->GetLoop()); + + if (constraint->GetType() == Constraint::Distance) { + DependenceDistance* as_distance = constraint->AsDependenceDistance(); + + // In the paper this is a[k]*d + SENode* rhs = scalar_evolution_.CreateMultiplyNode( + coefficient_of_recurrent, as_distance->GetDistance()); + + // In the paper this is a[k] <- 0 + SENode* zeroed_coefficient = + scalar_evolution_.BuildGraphWithoutRecurrentTerm( + new_first, constraint->GetLoop()); + + // In the paper this is e <- e - a[k]*d. + new_first = scalar_evolution_.CreateSubtraction(zeroed_coefficient, rhs); + new_first = scalar_evolution_.SimplifyExpression(new_first); + + // In the paper this is a'[k] - a[k]. + SENode* new_child = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(coefficient_of_recurrent_prime, + coefficient_of_recurrent)); + + // In the paper this is a'[k]'i[k]. + SERecurrentNode* prime_recurrent = + scalar_evolution_.GetRecurrentTerm(new_second, constraint->GetLoop()); + + if (!prime_recurrent) continue; + + // As we hash the nodes we need to create a new node when we update a + // child. + SENode* new_recurrent = scalar_evolution_.CreateRecurrentExpression( + constraint->GetLoop(), prime_recurrent->GetOffset(), new_child); + // In the paper this is a'[k] <- a'[k] - a[k]. + new_second = scalar_evolution_.UpdateChildNode( + new_second, prime_recurrent, new_recurrent); + } + } + + new_second = scalar_evolution_.SimplifyExpression(new_second); + return std::make_pair(new_first, new_second); +} + +bool LoopDependenceAnalysis::DeltaTest( + const std::vector& coupled_subscripts, + DistanceVector* dv_entry) { + std::vector constraints(loops_.size()); + + std::vector loop_appeared(loops_.size()); + + std::generate(std::begin(constraints), std::end(constraints), + [this]() { return make_constraint(); }); + + // Separate SIV and MIV subscripts + std::vector siv_subscripts{}; + std::vector miv_subscripts{}; + + for (const auto& subscript_pair : coupled_subscripts) { + if (IsSIV(subscript_pair)) { + siv_subscripts.push_back(subscript_pair); + } else { + miv_subscripts.push_back(subscript_pair); + } + } + + // Delta Test + while (!siv_subscripts.empty()) { + std::vector results(siv_subscripts.size()); + + std::vector current_distances( + siv_subscripts.size(), DistanceVector(loops_.size())); + + // Apply SIV test to all SIV subscripts, report independence if any of them + // is independent + std::transform( + std::begin(siv_subscripts), std::end(siv_subscripts), + std::begin(current_distances), std::begin(results), + [this](SubscriptPair& p, DistanceVector& d) { return SIVTest(p, &d); }); + + if (std::accumulate(std::begin(results), std::end(results), false, + std::logical_or{})) { + return true; + } + + // Derive new constraint vector. + std::vector> all_new_constrants{}; + + for (size_t i = 0; i < siv_subscripts.size(); ++i) { + auto loop = GetLoopForSubscriptPair(siv_subscripts[i]); + + auto loop_id = + std::distance(std::begin(loops_), + std::find(std::begin(loops_), std::end(loops_), loop)); + + loop_appeared[loop_id] = true; + auto distance_entry = current_distances[i].GetEntries()[loop_id]; + + if (distance_entry.dependence_information == + DistanceEntry::DependenceInformation::DISTANCE) { + // Construct a DependenceDistance. + auto node = scalar_evolution_.CreateConstant(distance_entry.distance); + + all_new_constrants.push_back( + {make_constraint(node, loop), loop_id}); + } else { + // Construct a DependenceLine. + const auto& subscript_pair = siv_subscripts[i]; + SENode* source_node = std::get<0>(subscript_pair); + SENode* destination_node = std::get<1>(subscript_pair); + + int64_t source_induction_count = CountInductionVariables(source_node); + int64_t destination_induction_count = + CountInductionVariables(destination_node); + + SENode* a = nullptr; + SENode* b = nullptr; + SENode* c = nullptr; + + if (destination_induction_count != 0) { + a = destination_node->AsSERecurrentNode()->GetCoefficient(); + c = scalar_evolution_.CreateNegation( + destination_node->AsSERecurrentNode()->GetOffset()); + } else { + a = scalar_evolution_.CreateConstant(0); + c = scalar_evolution_.CreateNegation(destination_node); + } + + if (source_induction_count != 0) { + b = scalar_evolution_.CreateNegation( + source_node->AsSERecurrentNode()->GetCoefficient()); + c = scalar_evolution_.CreateAddNode( + c, source_node->AsSERecurrentNode()->GetOffset()); + } else { + b = scalar_evolution_.CreateConstant(0); + c = scalar_evolution_.CreateAddNode(c, source_node); + } + + a = scalar_evolution_.SimplifyExpression(a); + b = scalar_evolution_.SimplifyExpression(b); + c = scalar_evolution_.SimplifyExpression(c); + + all_new_constrants.push_back( + {make_constraint(a, b, c, loop), loop_id}); + } + } + + // Calculate the intersection between the new and existing constraints. + std::vector intersection = constraints; + for (const auto& constraint_to_intersect : all_new_constrants) { + auto loop_id = std::get<1>(constraint_to_intersect); + auto loop = loops_[loop_id]; + intersection[loop_id] = IntersectConstraints( + intersection[loop_id], std::get<0>(constraint_to_intersect), + GetLowerBound(loop), GetUpperBound(loop)); + } + + // Report independence if an empty constraint (DependenceEmpty) is found. + auto first_empty = + std::find_if(std::begin(intersection), std::end(intersection), + [](Constraint* constraint) { + return constraint->AsDependenceEmpty() != nullptr; + }); + if (first_empty != std::end(intersection)) { + return true; + } + std::vector new_siv_subscripts{}; + std::vector new_miv_subscripts{}; + + auto equal = + std::equal(std::begin(constraints), std::end(constraints), + std::begin(intersection), + [](Constraint* a, Constraint* b) { return *a == *b; }); + + // If any constraints have changed, propagate them into the rest of the + // subscripts possibly creating new ZIV/SIV subscripts. + if (!equal) { + std::vector new_subscripts(miv_subscripts.size()); + + // Propagate constraints into MIV subscripts + std::transform(std::begin(miv_subscripts), std::end(miv_subscripts), + std::begin(new_subscripts), + [this, &intersection](SubscriptPair& subscript_pair) { + return PropagateConstraints(subscript_pair, + intersection); + }); + + // If a ZIV subscript is returned, apply test, otherwise, update untested + // subscripts. + for (auto& subscript : new_subscripts) { + if (IsZIV(subscript) && ZIVTest(subscript)) { + return true; + } else if (IsSIV(subscript)) { + new_siv_subscripts.push_back(subscript); + } else { + new_miv_subscripts.push_back(subscript); + } + } + } + + // Set new constraints and subscripts to test. + std::swap(siv_subscripts, new_siv_subscripts); + std::swap(miv_subscripts, new_miv_subscripts); + std::swap(constraints, intersection); + } + + // Create the dependence vector from the constraints. + for (size_t i = 0; i < loops_.size(); ++i) { + // Don't touch entries for loops that weren't tested. + if (loop_appeared[i]) { + auto current_constraint = constraints[i]; + auto& current_distance_entry = (*dv_entry).GetEntries()[i]; + + if (auto dependence_distance = + current_constraint->AsDependenceDistance()) { + if (auto constant_node = + dependence_distance->GetDistance()->AsSEConstantNode()) { + current_distance_entry.dependence_information = + DistanceEntry::DependenceInformation::DISTANCE; + + current_distance_entry.distance = constant_node->FoldToSingleValue(); + if (current_distance_entry.distance == 0) { + current_distance_entry.direction = DistanceEntry::Directions::EQ; + } else if (current_distance_entry.distance < 0) { + current_distance_entry.direction = DistanceEntry::Directions::GT; + } else { + current_distance_entry.direction = DistanceEntry::Directions::LT; + } + } + } else if (auto dependence_point = + current_constraint->AsDependencePoint()) { + auto source = dependence_point->GetSource(); + auto destination = dependence_point->GetDestination(); + + if (source->AsSEConstantNode() && destination->AsSEConstantNode()) { + current_distance_entry = DistanceEntry( + source->AsSEConstantNode()->FoldToSingleValue(), + destination->AsSEConstantNode()->FoldToSingleValue()); + } + } + } + } + + // Test any remaining MIV subscripts and report independence if found. + std::vector results(miv_subscripts.size()); + + std::transform(std::begin(miv_subscripts), std::end(miv_subscripts), + std::begin(results), + [this](const SubscriptPair& p) { return GCDMIVTest(p); }); + + return std::accumulate(std::begin(results), std::end(results), false, + std::logical_or{}); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.h new file mode 100644 index 00000000000..582c8d0acbd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence.h @@ -0,0 +1,558 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_DEPENDENCE_H_ +#define SOURCE_OPT_LOOP_DEPENDENCE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/scalar_analysis.h" + +namespace spvtools { +namespace opt { + +// Stores information about dependence between a load and a store wrt a single +// loop in a loop nest. +// DependenceInformation +// * UNKNOWN if no dependence information can be gathered or is gathered +// for it. +// * DIRECTION if a dependence direction could be found, but not a +// distance. +// * DISTANCE if a dependence distance could be found. +// * PEEL if peeling either the first or last iteration will break +// dependence between the given load and store. +// * IRRELEVANT if it has no effect on the dependence between the given +// load and store. +// +// If peel_first == true, the analysis has found that peeling the first +// iteration of this loop will break dependence. +// +// If peel_last == true, the analysis has found that peeling the last iteration +// of this loop will break dependence. +class DistanceEntry { + public: + enum DependenceInformation { + UNKNOWN = 0, + DIRECTION = 1, + DISTANCE = 2, + PEEL = 3, + IRRELEVANT = 4, + POINT = 5 + }; + enum Directions { + NONE = 0, + LT = 1, + EQ = 2, + LE = 3, + GT = 4, + NE = 5, + GE = 6, + ALL = 7 + }; + DependenceInformation dependence_information; + Directions direction; + int64_t distance; + bool peel_first; + bool peel_last; + int64_t point_x; + int64_t point_y; + + DistanceEntry() + : dependence_information(DependenceInformation::UNKNOWN), + direction(Directions::ALL), + distance(0), + peel_first(false), + peel_last(false), + point_x(0), + point_y(0) {} + + explicit DistanceEntry(Directions direction_) + : dependence_information(DependenceInformation::DIRECTION), + direction(direction_), + distance(0), + peel_first(false), + peel_last(false), + point_x(0), + point_y(0) {} + + DistanceEntry(Directions direction_, int64_t distance_) + : dependence_information(DependenceInformation::DISTANCE), + direction(direction_), + distance(distance_), + peel_first(false), + peel_last(false), + point_x(0), + point_y(0) {} + + DistanceEntry(int64_t x, int64_t y) + : dependence_information(DependenceInformation::POINT), + direction(Directions::ALL), + distance(0), + peel_first(false), + peel_last(false), + point_x(x), + point_y(y) {} + + bool operator==(const DistanceEntry& rhs) const { + return direction == rhs.direction && peel_first == rhs.peel_first && + peel_last == rhs.peel_last && distance == rhs.distance && + point_x == rhs.point_x && point_y == rhs.point_y; + } + + bool operator!=(const DistanceEntry& rhs) const { return !(*this == rhs); } +}; + +// Stores a vector of DistanceEntrys, one per loop in the analysis. +// A DistanceVector holds all of the information gathered in a dependence +// analysis wrt the loops stored in the LoopDependenceAnalysis performing the +// analysis. +class DistanceVector { + public: + explicit DistanceVector(size_t size) : entries(size, DistanceEntry{}) {} + + explicit DistanceVector(std::vector entries_) + : entries(entries_) {} + + DistanceEntry& GetEntry(size_t index) { return entries[index]; } + const DistanceEntry& GetEntry(size_t index) const { return entries[index]; } + + std::vector& GetEntries() { return entries; } + const std::vector& GetEntries() const { return entries; } + + bool operator==(const DistanceVector& rhs) const { + if (entries.size() != rhs.entries.size()) { + return false; + } + for (size_t i = 0; i < entries.size(); ++i) { + if (entries[i] != rhs.entries[i]) { + return false; + } + } + return true; + } + bool operator!=(const DistanceVector& rhs) const { return !(*this == rhs); } + + private: + std::vector entries; +}; + +class DependenceLine; +class DependenceDistance; +class DependencePoint; +class DependenceNone; +class DependenceEmpty; + +class Constraint { + public: + explicit Constraint(const Loop* loop) : loop_(loop) {} + enum ConstraintType { Line, Distance, Point, None, Empty }; + + virtual ConstraintType GetType() const = 0; + + virtual ~Constraint() {} + + // Get the loop this constraint belongs to. + const Loop* GetLoop() const { return loop_; } + + bool operator==(const Constraint& other) const; + + bool operator!=(const Constraint& other) const; + +#define DeclareCastMethod(target) \ + virtual target* As##target() { return nullptr; } \ + virtual const target* As##target() const { return nullptr; } + DeclareCastMethod(DependenceLine); + DeclareCastMethod(DependenceDistance); + DeclareCastMethod(DependencePoint); + DeclareCastMethod(DependenceNone); + DeclareCastMethod(DependenceEmpty); +#undef DeclareCastMethod + + protected: + const Loop* loop_; +}; + +class DependenceLine : public Constraint { + public: + DependenceLine(SENode* a, SENode* b, SENode* c, const Loop* loop) + : Constraint(loop), a_(a), b_(b), c_(c) {} + + ConstraintType GetType() const final { return Line; } + + DependenceLine* AsDependenceLine() final { return this; } + const DependenceLine* AsDependenceLine() const final { return this; } + + SENode* GetA() const { return a_; } + SENode* GetB() const { return b_; } + SENode* GetC() const { return c_; } + + private: + SENode* a_; + SENode* b_; + SENode* c_; +}; + +class DependenceDistance : public Constraint { + public: + DependenceDistance(SENode* distance, const Loop* loop) + : Constraint(loop), distance_(distance) {} + + ConstraintType GetType() const final { return Distance; } + + DependenceDistance* AsDependenceDistance() final { return this; } + const DependenceDistance* AsDependenceDistance() const final { return this; } + + SENode* GetDistance() const { return distance_; } + + private: + SENode* distance_; +}; + +class DependencePoint : public Constraint { + public: + DependencePoint(SENode* source, SENode* destination, const Loop* loop) + : Constraint(loop), source_(source), destination_(destination) {} + + ConstraintType GetType() const final { return Point; } + + DependencePoint* AsDependencePoint() final { return this; } + const DependencePoint* AsDependencePoint() const final { return this; } + + SENode* GetSource() const { return source_; } + SENode* GetDestination() const { return destination_; } + + private: + SENode* source_; + SENode* destination_; +}; + +class DependenceNone : public Constraint { + public: + DependenceNone() : Constraint(nullptr) {} + ConstraintType GetType() const final { return None; } + + DependenceNone* AsDependenceNone() final { return this; } + const DependenceNone* AsDependenceNone() const final { return this; } +}; + +class DependenceEmpty : public Constraint { + public: + DependenceEmpty() : Constraint(nullptr) {} + ConstraintType GetType() const final { return Empty; } + + DependenceEmpty* AsDependenceEmpty() final { return this; } + const DependenceEmpty* AsDependenceEmpty() const final { return this; } +}; + +// Provides dependence information between a store instruction and a load +// instruction inside the same loop in a loop nest. +// +// The analysis can only check dependence between stores and loads with regard +// to the loop nest it is created with. +// +// The analysis can output debugging information to a stream. The output +// describes the control flow of the analysis and what information it can deduce +// at each step. +// SetDebugStream and ClearDebugStream are provided for this functionality. +// +// The dependency algorithm is based on the 1990 Paper +// Practical Dependence Testing +// Gina Goff, Ken Kennedy, Chau-Wen Tseng +// +// The algorithm first identifies subscript pairs between the load and store. +// Each pair is tested until all have been tested or independence is found. +// The number of induction variables in a pair determines which test to perform +// on it; +// Zero Index Variable (ZIV) is used when no induction variables are present +// in the pair. +// Single Index Variable (SIV) is used when only one induction variable is +// present, but may occur multiple times in the pair. +// Multiple Index Variable (MIV) is used when more than one induction variable +// is present in the pair. +class LoopDependenceAnalysis { + public: + LoopDependenceAnalysis(IRContext* context, std::vector loops) + : context_(context), + loops_(loops), + scalar_evolution_(context), + debug_stream_(nullptr), + constraints_{} {} + + // Finds the dependence between |source| and |destination|. + // |source| should be an OpLoad. + // |destination| should be an OpStore. + // Any direction and distance information found will be stored in + // |distance_vector|. + // Returns true if independence is found, false otherwise. + bool GetDependence(const Instruction* source, const Instruction* destination, + DistanceVector* distance_vector); + + // Returns true if |subscript_pair| represents a Zero Index Variable pair + // (ZIV) + bool IsZIV(const std::pair& subscript_pair); + + // Returns true if |subscript_pair| represents a Single Index Variable + // (SIV) pair + bool IsSIV(const std::pair& subscript_pair); + + // Returns true if |subscript_pair| represents a Multiple Index Variable + // (MIV) pair + bool IsMIV(const std::pair& subscript_pair); + + // Finds the lower bound of |loop| as an SENode* and returns the result. + // The lower bound is the starting value of the loops induction variable + SENode* GetLowerBound(const Loop* loop); + + // Finds the upper bound of |loop| as an SENode* and returns the result. + // The upper bound is the last value before the loop exit condition is met. + SENode* GetUpperBound(const Loop* loop); + + // Returns true if |value| is between |bound_one| and |bound_two| (inclusive). + bool IsWithinBounds(int64_t value, int64_t bound_one, int64_t bound_two); + + // Finds the bounds of |loop| as upper_bound - lower_bound and returns the + // resulting SENode. + // If the operations can not be completed a nullptr is returned. + SENode* GetTripCount(const Loop* loop); + + // Returns the SENode* produced by building an SENode from the result of + // calling GetInductionInitValue on |loop|. + // If the operation can not be completed a nullptr is returned. + SENode* GetFirstTripInductionNode(const Loop* loop); + + // Returns the SENode* produced by building an SENode from the result of + // GetFirstTripInductionNode + (GetTripCount - 1) * induction_coefficient. + // If the operation can not be completed a nullptr is returned. + SENode* GetFinalTripInductionNode(const Loop* loop, + SENode* induction_coefficient); + + // Returns all the distinct loops that appear in |nodes|. + std::set CollectLoops( + const std::vector& nodes); + + // Returns all the distinct loops that appear in |source| and |destination|. + std::set CollectLoops(SENode* source, SENode* destination); + + // Returns true if |distance| is provably outside the loop bounds. + // |coefficient| must be an SENode representing the coefficient of the + // induction variable of |loop|. + // This method is able to handle some symbolic cases which IsWithinBounds + // can't handle. + bool IsProvablyOutsideOfLoopBounds(const Loop* loop, SENode* distance, + SENode* coefficient); + + // Sets the ostream for debug information for the analysis. + void SetDebugStream(std::ostream& debug_stream) { + debug_stream_ = &debug_stream; + } + + // Clears the stored ostream to stop debug information printing. + void ClearDebugStream() { debug_stream_ = nullptr; } + + // Returns the ScalarEvolutionAnalysis used by this analysis. + ScalarEvolutionAnalysis* GetScalarEvolution() { return &scalar_evolution_; } + + // Creates a new constraint of type |T| and returns the pointer to it. + template + Constraint* make_constraint(Args&&... args) { + constraints_.push_back( + std::unique_ptr(new T(std::forward(args)...))); + + return constraints_.back().get(); + } + + // Subscript partitioning as described in Figure 1 of 'Practical Dependence + // Testing' by Gina Goff, Ken Kennedy, and Chau-Wen Tseng from PLDI '91. + // Partitions the subscripts into independent subscripts and minimally coupled + // sets of subscripts. + // Returns the partitioning of subscript pairs. Sets of size 1 indicates an + // independent subscript-pair and others indicate coupled sets. + using PartitionedSubscripts = + std::vector>>; + PartitionedSubscripts PartitionSubscripts( + const std::vector& source_subscripts, + const std::vector& destination_subscripts); + + // Returns the Loop* matching the loop for |subscript_pair|. + // |subscript_pair| must be an SIV pair. + const Loop* GetLoopForSubscriptPair( + const std::pair& subscript_pair); + + // Returns the DistanceEntry matching the loop for |subscript_pair|. + // |subscript_pair| must be an SIV pair. + DistanceEntry* GetDistanceEntryForSubscriptPair( + const std::pair& subscript_pair, + DistanceVector* distance_vector); + + // Returns the DistanceEntry matching |loop|. + DistanceEntry* GetDistanceEntryForLoop(const Loop* loop, + DistanceVector* distance_vector); + + // Returns a vector of Instruction* which form the subscripts of the array + // access defined by the access chain |instruction|. + std::vector GetSubscripts(const Instruction* instruction); + + // Delta test as described in Figure 3 of 'Practical Dependence + // Testing' by Gina Goff, Ken Kennedy, and Chau-Wen Tseng from PLDI '91. + bool DeltaTest( + const std::vector>& coupled_subscripts, + DistanceVector* dv_entry); + + // Constraint propagation as described in Figure 5 of 'Practical Dependence + // Testing' by Gina Goff, Ken Kennedy, and Chau-Wen Tseng from PLDI '91. + std::pair PropagateConstraints( + const std::pair& subscript_pair, + const std::vector& constraints); + + // Constraint intersection as described in Figure 4 of 'Practical Dependence + // Testing' by Gina Goff, Ken Kennedy, and Chau-Wen Tseng from PLDI '91. + Constraint* IntersectConstraints(Constraint* constraint_0, + Constraint* constraint_1, + const SENode* lower_bound, + const SENode* upper_bound); + + // Returns true if each loop in |loops| is in a form supported by this + // analysis. + // A loop is supported if it has a single induction variable and that + // induction variable has a step of +1 or -1 per loop iteration. + bool CheckSupportedLoops(std::vector loops); + + // Returns true if |loop| is in a form supported by this analysis. + // A loop is supported if it has a single induction variable and that + // induction variable has a step of +1 or -1 per loop iteration. + bool IsSupportedLoop(const Loop* loop); + + private: + IRContext* context_; + + // The loop nest we are analysing the dependence of. + std::vector loops_; + + // The ScalarEvolutionAnalysis used by this analysis to store and perform much + // of its logic. + ScalarEvolutionAnalysis scalar_evolution_; + + // The ostream debug information for the analysis to print to. + std::ostream* debug_stream_; + + // Stores all the constraints created by the analysis. + std::list> constraints_; + + // Returns true if independence can be proven and false if it can't be proven. + bool ZIVTest(const std::pair& subscript_pair); + + // Analyzes the subscript pair to find an applicable SIV test. + // Returns true if independence can be proven and false if it can't be proven. + bool SIVTest(const std::pair& subscript_pair, + DistanceVector* distance_vector); + + // Takes the form a*i + c1, a*i + c2 + // When c1 and c2 are loop invariant and a is constant + // distance = (c1 - c2)/a + // < if distance > 0 + // direction = = if distance = 0 + // > if distance < 0 + // Returns true if independence is proven and false if it can't be proven. + bool StrongSIVTest(SENode* source, SENode* destination, SENode* coeff, + DistanceEntry* distance_entry); + + // Takes for form a*i + c1, a*i + c2 + // where c1 and c2 are loop invariant and a is constant. + // c1 and/or c2 contain one or more SEValueUnknown nodes. + bool SymbolicStrongSIVTest(SENode* source, SENode* destination, + SENode* coefficient, + DistanceEntry* distance_entry); + + // Takes the form a1*i + c1, a2*i + c2 + // where a1 = 0 + // distance = (c1 - c2) / a2 + // Returns true if independence is proven and false if it can't be proven. + bool WeakZeroSourceSIVTest(SENode* source, SERecurrentNode* destination, + SENode* coefficient, + DistanceEntry* distance_entry); + + // Takes the form a1*i + c1, a2*i + c2 + // where a2 = 0 + // distance = (c2 - c1) / a1 + // Returns true if independence is proven and false if it can't be proven. + bool WeakZeroDestinationSIVTest(SERecurrentNode* source, SENode* destination, + SENode* coefficient, + DistanceEntry* distance_entry); + + // Takes the form a1*i + c1, a2*i + c2 + // where a1 = -a2 + // distance = (c2 - c1) / 2*a1 + // Returns true if independence is proven and false if it can't be proven. + bool WeakCrossingSIVTest(SENode* source, SENode* destination, + SENode* coefficient, DistanceEntry* distance_entry); + + // Uses the def_use_mgr to get the instruction referenced by + // SingleWordInOperand(|id|) when called on |instruction|. + Instruction* GetOperandDefinition(const Instruction* instruction, int id); + + // Perform the GCD test if both, the source and the destination nodes, are in + // the form a0*i0 + a1*i1 + ... an*in + c. + bool GCDMIVTest(const std::pair& subscript_pair); + + // Finds the number of induction variables in |node|. + // Returns -1 on failure. + int64_t CountInductionVariables(SENode* node); + + // Finds the number of induction variables shared between |source| and + // |destination|. + // Returns -1 on failure. + int64_t CountInductionVariables(SENode* source, SENode* destination); + + // Takes the offset from the induction variable and subtracts the lower bound + // from it to get the constant term added to the induction. + // Returns the resuting constant term, or nullptr if it could not be produced. + SENode* GetConstantTerm(const Loop* loop, SERecurrentNode* induction); + + // Marks all the distance entries in |distance_vector| that were relate to + // loops in |loops_| but were not used in any subscripts as irrelevant to the + // to the dependence test. + void MarkUnsusedDistanceEntriesAsIrrelevant(const Instruction* source, + const Instruction* destination, + DistanceVector* distance_vector); + + // Converts |value| to a std::string and returns the result. + // This is required because Android does not compile std::to_string. + template + std::string ToString(valueT value) { + std::ostringstream string_stream; + string_stream << value; + return string_stream.str(); + } + + // Prints |debug_msg| and "\n" to the ostream pointed to by |debug_stream_|. + // Won't print anything if |debug_stream_| is nullptr. + void PrintDebug(std::string debug_msg); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_DEPENDENCE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp new file mode 100644 index 00000000000..de27a0a7249 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_dependence_helpers.cpp @@ -0,0 +1,541 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_dependence.h" + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/scalar_analysis_nodes.h" + +namespace spvtools { +namespace opt { + +bool LoopDependenceAnalysis::IsZIV( + const std::pair& subscript_pair) { + return CountInductionVariables(subscript_pair.first, subscript_pair.second) == + 0; +} + +bool LoopDependenceAnalysis::IsSIV( + const std::pair& subscript_pair) { + return CountInductionVariables(subscript_pair.first, subscript_pair.second) == + 1; +} + +bool LoopDependenceAnalysis::IsMIV( + const std::pair& subscript_pair) { + return CountInductionVariables(subscript_pair.first, subscript_pair.second) > + 1; +} + +SENode* LoopDependenceAnalysis::GetLowerBound(const Loop* loop) { + Instruction* cond_inst = loop->GetConditionInst(); + if (!cond_inst) { + return nullptr; + } + Instruction* lower_inst = GetOperandDefinition(cond_inst, 0); + switch (cond_inst->opcode()) { + case SpvOpULessThan: + case SpvOpSLessThan: + case SpvOpULessThanEqual: + case SpvOpSLessThanEqual: + case SpvOpUGreaterThan: + case SpvOpSGreaterThan: + case SpvOpUGreaterThanEqual: + case SpvOpSGreaterThanEqual: { + // If we have a phi we are looking at the induction variable. We look + // through the phi to the initial value of the phi upon entering the loop. + if (lower_inst->opcode() == SpvOpPhi) { + lower_inst = GetOperandDefinition(lower_inst, 0); + // We don't handle looking through multiple phis. + if (lower_inst->opcode() == SpvOpPhi) { + return nullptr; + } + } + return scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(lower_inst)); + } + default: + return nullptr; + } +} + +SENode* LoopDependenceAnalysis::GetUpperBound(const Loop* loop) { + Instruction* cond_inst = loop->GetConditionInst(); + if (!cond_inst) { + return nullptr; + } + Instruction* upper_inst = GetOperandDefinition(cond_inst, 1); + switch (cond_inst->opcode()) { + case SpvOpULessThan: + case SpvOpSLessThan: { + // When we have a < condition we must subtract 1 from the analyzed upper + // instruction. + SENode* upper_bound = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction( + scalar_evolution_.AnalyzeInstruction(upper_inst), + scalar_evolution_.CreateConstant(1))); + return upper_bound; + } + case SpvOpUGreaterThan: + case SpvOpSGreaterThan: { + // When we have a > condition we must add 1 to the analyzed upper + // instruction. + SENode* upper_bound = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateAddNode( + scalar_evolution_.AnalyzeInstruction(upper_inst), + scalar_evolution_.CreateConstant(1))); + return upper_bound; + } + case SpvOpULessThanEqual: + case SpvOpSLessThanEqual: + case SpvOpUGreaterThanEqual: + case SpvOpSGreaterThanEqual: { + // We don't need to modify the results of analyzing when we have <= or >=. + SENode* upper_bound = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(upper_inst)); + return upper_bound; + } + default: + return nullptr; + } +} + +bool LoopDependenceAnalysis::IsWithinBounds(int64_t value, int64_t bound_one, + int64_t bound_two) { + if (bound_one < bound_two) { + // If |bound_one| is the lower bound. + return (value >= bound_one && value <= bound_two); + } else if (bound_one > bound_two) { + // If |bound_two| is the lower bound. + return (value >= bound_two && value <= bound_one); + } else { + // Both bounds have the same value. + return value == bound_one; + } +} + +bool LoopDependenceAnalysis::IsProvablyOutsideOfLoopBounds( + const Loop* loop, SENode* distance, SENode* coefficient) { + // We test to see if we can reduce the coefficient to an integral constant. + SEConstantNode* coefficient_constant = coefficient->AsSEConstantNode(); + if (!coefficient_constant) { + PrintDebug( + "IsProvablyOutsideOfLoopBounds could not reduce coefficient to a " + "SEConstantNode so must exit."); + return false; + } + + SENode* lower_bound = GetLowerBound(loop); + SENode* upper_bound = GetUpperBound(loop); + if (!lower_bound || !upper_bound) { + PrintDebug( + "IsProvablyOutsideOfLoopBounds could not get both the lower and upper " + "bounds so must exit."); + return false; + } + // If the coefficient is positive we calculate bounds as upper - lower + // If the coefficient is negative we calculate bounds as lower - upper + SENode* bounds = nullptr; + if (coefficient_constant->FoldToSingleValue() >= 0) { + PrintDebug( + "IsProvablyOutsideOfLoopBounds found coefficient >= 0.\n" + "Using bounds as upper - lower."); + bounds = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(upper_bound, lower_bound)); + } else { + PrintDebug( + "IsProvablyOutsideOfLoopBounds found coefficient < 0.\n" + "Using bounds as lower - upper."); + bounds = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(lower_bound, upper_bound)); + } + + // We can attempt to deal with symbolic cases by subtracting |distance| and + // the bound nodes. If we can subtract, simplify and produce a SEConstantNode + // we can produce some information. + SEConstantNode* distance_minus_bounds = + scalar_evolution_ + .SimplifyExpression( + scalar_evolution_.CreateSubtraction(distance, bounds)) + ->AsSEConstantNode(); + if (distance_minus_bounds) { + PrintDebug( + "IsProvablyOutsideOfLoopBounds found distance - bounds as a " + "SEConstantNode with value " + + ToString(distance_minus_bounds->FoldToSingleValue())); + // If distance - bounds > 0 we prove the distance is outwith the loop + // bounds. + if (distance_minus_bounds->FoldToSingleValue() > 0) { + PrintDebug( + "IsProvablyOutsideOfLoopBounds found distance escaped the loop " + "bounds."); + return true; + } + } + + return false; +} + +const Loop* LoopDependenceAnalysis::GetLoopForSubscriptPair( + const std::pair& subscript_pair) { + // Collect all the SERecurrentNodes. + std::vector source_nodes = + std::get<0>(subscript_pair)->CollectRecurrentNodes(); + std::vector destination_nodes = + std::get<1>(subscript_pair)->CollectRecurrentNodes(); + + // Collect all the loops stored by the SERecurrentNodes. + std::unordered_set loops{}; + for (auto source_nodes_it = source_nodes.begin(); + source_nodes_it != source_nodes.end(); ++source_nodes_it) { + loops.insert((*source_nodes_it)->GetLoop()); + } + for (auto destination_nodes_it = destination_nodes.begin(); + destination_nodes_it != destination_nodes.end(); + ++destination_nodes_it) { + loops.insert((*destination_nodes_it)->GetLoop()); + } + + // If we didn't find 1 loop |subscript_pair| is a subscript over multiple or 0 + // loops. We don't handle this so return nullptr. + if (loops.size() != 1) { + PrintDebug("GetLoopForSubscriptPair found loops.size() != 1."); + return nullptr; + } + return *loops.begin(); +} + +DistanceEntry* LoopDependenceAnalysis::GetDistanceEntryForLoop( + const Loop* loop, DistanceVector* distance_vector) { + if (!loop) { + return nullptr; + } + + DistanceEntry* distance_entry = nullptr; + for (size_t loop_index = 0; loop_index < loops_.size(); ++loop_index) { + if (loop == loops_[loop_index]) { + distance_entry = &(distance_vector->GetEntries()[loop_index]); + break; + } + } + + return distance_entry; +} + +DistanceEntry* LoopDependenceAnalysis::GetDistanceEntryForSubscriptPair( + const std::pair& subscript_pair, + DistanceVector* distance_vector) { + const Loop* loop = GetLoopForSubscriptPair(subscript_pair); + + return GetDistanceEntryForLoop(loop, distance_vector); +} + +SENode* LoopDependenceAnalysis::GetTripCount(const Loop* loop) { + BasicBlock* condition_block = loop->FindConditionBlock(); + if (!condition_block) { + return nullptr; + } + Instruction* induction_instr = loop->FindConditionVariable(condition_block); + if (!induction_instr) { + return nullptr; + } + Instruction* cond_instr = loop->GetConditionInst(); + if (!cond_instr) { + return nullptr; + } + + size_t iteration_count = 0; + + // We have to check the instruction type here. If the condition instruction + // isn't a supported type we can't calculate the trip count. + if (loop->IsSupportedCondition(cond_instr->opcode())) { + if (loop->FindNumberOfIterations(induction_instr, &*condition_block->tail(), + &iteration_count)) { + return scalar_evolution_.CreateConstant( + static_cast(iteration_count)); + } + } + + return nullptr; +} + +SENode* LoopDependenceAnalysis::GetFirstTripInductionNode(const Loop* loop) { + BasicBlock* condition_block = loop->FindConditionBlock(); + if (!condition_block) { + return nullptr; + } + Instruction* induction_instr = loop->FindConditionVariable(condition_block); + if (!induction_instr) { + return nullptr; + } + int64_t induction_initial_value = 0; + if (!loop->GetInductionInitValue(induction_instr, &induction_initial_value)) { + return nullptr; + } + + SENode* induction_init_SENode = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateConstant(induction_initial_value)); + return induction_init_SENode; +} + +SENode* LoopDependenceAnalysis::GetFinalTripInductionNode( + const Loop* loop, SENode* induction_coefficient) { + SENode* first_trip_induction_node = GetFirstTripInductionNode(loop); + if (!first_trip_induction_node) { + return nullptr; + } + // Get trip_count as GetTripCount - 1 + // This is because the induction variable is not stepped on the first + // iteration of the loop + SENode* trip_count = + scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateSubtraction( + GetTripCount(loop), scalar_evolution_.CreateConstant(1))); + // Return first_trip_induction_node + trip_count * induction_coefficient + return scalar_evolution_.SimplifyExpression(scalar_evolution_.CreateAddNode( + first_trip_induction_node, + scalar_evolution_.CreateMultiplyNode(trip_count, induction_coefficient))); +} + +std::set LoopDependenceAnalysis::CollectLoops( + const std::vector& recurrent_nodes) { + // We don't handle loops with more than one induction variable. Therefore we + // can identify the number of induction variables by collecting all of the + // loops the collected recurrent nodes belong to. + std::set loops{}; + for (auto recurrent_nodes_it = recurrent_nodes.begin(); + recurrent_nodes_it != recurrent_nodes.end(); ++recurrent_nodes_it) { + loops.insert((*recurrent_nodes_it)->GetLoop()); + } + + return loops; +} + +int64_t LoopDependenceAnalysis::CountInductionVariables(SENode* node) { + if (!node) { + return -1; + } + + std::vector recurrent_nodes = node->CollectRecurrentNodes(); + + // We don't handle loops with more than one induction variable. Therefore we + // can identify the number of induction variables by collecting all of the + // loops the collected recurrent nodes belong to. + std::set loops = CollectLoops(recurrent_nodes); + + return static_cast(loops.size()); +} + +std::set LoopDependenceAnalysis::CollectLoops( + SENode* source, SENode* destination) { + if (!source || !destination) { + return std::set{}; + } + + std::vector source_nodes = source->CollectRecurrentNodes(); + std::vector destination_nodes = + destination->CollectRecurrentNodes(); + + std::set loops = CollectLoops(source_nodes); + std::set destination_loops = CollectLoops(destination_nodes); + + loops.insert(std::begin(destination_loops), std::end(destination_loops)); + + return loops; +} + +int64_t LoopDependenceAnalysis::CountInductionVariables(SENode* source, + SENode* destination) { + if (!source || !destination) { + return -1; + } + + std::set loops = CollectLoops(source, destination); + + return static_cast(loops.size()); +} + +Instruction* LoopDependenceAnalysis::GetOperandDefinition( + const Instruction* instruction, int id) { + return context_->get_def_use_mgr()->GetDef( + instruction->GetSingleWordInOperand(id)); +} + +std::vector LoopDependenceAnalysis::GetSubscripts( + const Instruction* instruction) { + Instruction* access_chain = GetOperandDefinition(instruction, 0); + + std::vector subscripts; + + for (auto i = 1u; i < access_chain->NumInOperandWords(); ++i) { + subscripts.push_back(GetOperandDefinition(access_chain, i)); + } + + return subscripts; +} + +SENode* LoopDependenceAnalysis::GetConstantTerm(const Loop* loop, + SERecurrentNode* induction) { + SENode* offset = induction->GetOffset(); + SENode* lower_bound = GetLowerBound(loop); + if (!offset || !lower_bound) { + return nullptr; + } + SENode* constant_term = scalar_evolution_.SimplifyExpression( + scalar_evolution_.CreateSubtraction(offset, lower_bound)); + return constant_term; +} + +bool LoopDependenceAnalysis::CheckSupportedLoops( + std::vector loops) { + for (auto loop : loops) { + if (!IsSupportedLoop(loop)) { + return false; + } + } + return true; +} + +void LoopDependenceAnalysis::MarkUnsusedDistanceEntriesAsIrrelevant( + const Instruction* source, const Instruction* destination, + DistanceVector* distance_vector) { + std::vector source_subscripts = GetSubscripts(source); + std::vector destination_subscripts = GetSubscripts(destination); + + std::set used_loops{}; + + for (Instruction* source_inst : source_subscripts) { + SENode* source_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(source_inst)); + std::vector recurrent_nodes = + source_node->CollectRecurrentNodes(); + for (SERecurrentNode* recurrent_node : recurrent_nodes) { + used_loops.insert(recurrent_node->GetLoop()); + } + } + + for (Instruction* destination_inst : destination_subscripts) { + SENode* destination_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(destination_inst)); + std::vector recurrent_nodes = + destination_node->CollectRecurrentNodes(); + for (SERecurrentNode* recurrent_node : recurrent_nodes) { + used_loops.insert(recurrent_node->GetLoop()); + } + } + + for (size_t i = 0; i < loops_.size(); ++i) { + if (used_loops.find(loops_[i]) == used_loops.end()) { + distance_vector->GetEntries()[i].dependence_information = + DistanceEntry::DependenceInformation::IRRELEVANT; + } + } +} + +bool LoopDependenceAnalysis::IsSupportedLoop(const Loop* loop) { + std::vector inductions{}; + loop->GetInductionVariables(inductions); + if (inductions.size() != 1) { + return false; + } + Instruction* induction = inductions[0]; + SENode* induction_node = scalar_evolution_.SimplifyExpression( + scalar_evolution_.AnalyzeInstruction(induction)); + if (!induction_node->AsSERecurrentNode()) { + return false; + } + SENode* induction_step = + induction_node->AsSERecurrentNode()->GetCoefficient(); + if (!induction_step->AsSEConstantNode()) { + return false; + } + if (!(induction_step->AsSEConstantNode()->FoldToSingleValue() == 1 || + induction_step->AsSEConstantNode()->FoldToSingleValue() == -1)) { + return false; + } + return true; +} + +void LoopDependenceAnalysis::PrintDebug(std::string debug_msg) { + if (debug_stream_) { + (*debug_stream_) << debug_msg << "\n"; + } +} + +bool Constraint::operator==(const Constraint& other) const { + // A distance of |d| is equivalent to a line |x - y = -d| + if ((GetType() == ConstraintType::Distance && + other.GetType() == ConstraintType::Line) || + (GetType() == ConstraintType::Line && + other.GetType() == ConstraintType::Distance)) { + auto is_distance = AsDependenceLine() != nullptr; + + auto as_distance = + is_distance ? AsDependenceDistance() : other.AsDependenceDistance(); + auto distance = as_distance->GetDistance(); + + auto line = other.AsDependenceLine(); + + auto scalar_evolution = distance->GetParentAnalysis(); + + auto neg_distance = scalar_evolution->SimplifyExpression( + scalar_evolution->CreateNegation(distance)); + + return *scalar_evolution->CreateConstant(1) == *line->GetA() && + *scalar_evolution->CreateConstant(-1) == *line->GetB() && + *neg_distance == *line->GetC(); + } + + if (GetType() != other.GetType()) { + return false; + } + + if (AsDependenceDistance()) { + return *AsDependenceDistance()->GetDistance() == + *other.AsDependenceDistance()->GetDistance(); + } + + if (AsDependenceLine()) { + auto this_line = AsDependenceLine(); + auto other_line = other.AsDependenceLine(); + return *this_line->GetA() == *other_line->GetA() && + *this_line->GetB() == *other_line->GetB() && + *this_line->GetC() == *other_line->GetC(); + } + + if (AsDependencePoint()) { + auto this_point = AsDependencePoint(); + auto other_point = other.AsDependencePoint(); + + return *this_point->GetSource() == *other_point->GetSource() && + *this_point->GetDestination() == *other_point->GetDestination(); + } + + return true; +} + +bool Constraint::operator!=(const Constraint& other) const { + return !(*this == other); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp new file mode 100644 index 00000000000..efc56bdba68 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.cpp @@ -0,0 +1,1010 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/loop_descriptor.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/cfg.h" +#include "source/opt/constants.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" +#include "source/opt/tree_iterator.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +// Takes in a phi instruction |induction| and the loop |header| and returns the +// step operation of the loop. +Instruction* Loop::GetInductionStepOperation( + const Instruction* induction) const { + // Induction must be a phi instruction. + assert(induction->opcode() == SpvOpPhi); + + Instruction* step = nullptr; + + analysis::DefUseManager* def_use_manager = context_->get_def_use_mgr(); + + // Traverse the incoming operands of the phi instruction. + for (uint32_t operand_id = 1; operand_id < induction->NumInOperands(); + operand_id += 2) { + // Incoming edge. + BasicBlock* incoming_block = + context_->cfg()->block(induction->GetSingleWordInOperand(operand_id)); + + // Check if the block is dominated by header, and thus coming from within + // the loop. + if (IsInsideLoop(incoming_block)) { + step = def_use_manager->GetDef( + induction->GetSingleWordInOperand(operand_id - 1)); + break; + } + } + + if (!step || !IsSupportedStepOp(step->opcode())) { + return nullptr; + } + + // The induction variable which binds the loop must only be modified once. + uint32_t lhs = step->GetSingleWordInOperand(0); + uint32_t rhs = step->GetSingleWordInOperand(1); + + // One of the left hand side or right hand side of the step instruction must + // be the induction phi and the other must be an OpConstant. + if (lhs != induction->result_id() && rhs != induction->result_id()) { + return nullptr; + } + + if (def_use_manager->GetDef(lhs)->opcode() != SpvOp::SpvOpConstant && + def_use_manager->GetDef(rhs)->opcode() != SpvOp::SpvOpConstant) { + return nullptr; + } + + return step; +} + +// Returns true if the |step| operation is an induction variable step operation +// which is currently handled. +bool Loop::IsSupportedStepOp(SpvOp step) const { + switch (step) { + case SpvOp::SpvOpISub: + case SpvOp::SpvOpIAdd: + return true; + default: + return false; + } +} + +bool Loop::IsSupportedCondition(SpvOp condition) const { + switch (condition) { + // < + case SpvOp::SpvOpULessThan: + case SpvOp::SpvOpSLessThan: + // > + case SpvOp::SpvOpUGreaterThan: + case SpvOp::SpvOpSGreaterThan: + + // >= + case SpvOp::SpvOpSGreaterThanEqual: + case SpvOp::SpvOpUGreaterThanEqual: + // <= + case SpvOp::SpvOpSLessThanEqual: + case SpvOp::SpvOpULessThanEqual: + + return true; + default: + return false; + } +} + +int64_t Loop::GetResidualConditionValue(SpvOp condition, int64_t initial_value, + int64_t step_value, + size_t number_of_iterations, + size_t factor) { + int64_t remainder = + initial_value + (number_of_iterations % factor) * step_value; + + // We subtract or add one as the above formula calculates the remainder if the + // loop where just less than or greater than. Adding or subtracting one should + // give a functionally equivalent value. + switch (condition) { + case SpvOp::SpvOpSGreaterThanEqual: + case SpvOp::SpvOpUGreaterThanEqual: { + remainder -= 1; + break; + } + case SpvOp::SpvOpSLessThanEqual: + case SpvOp::SpvOpULessThanEqual: { + remainder += 1; + break; + } + + default: + break; + } + return remainder; +} + +Instruction* Loop::GetConditionInst() const { + BasicBlock* condition_block = FindConditionBlock(); + if (!condition_block) { + return nullptr; + } + Instruction* branch_conditional = &*condition_block->tail(); + if (!branch_conditional || + branch_conditional->opcode() != SpvOpBranchConditional) { + return nullptr; + } + Instruction* condition_inst = context_->get_def_use_mgr()->GetDef( + branch_conditional->GetSingleWordInOperand(0)); + if (IsSupportedCondition(condition_inst->opcode())) { + return condition_inst; + } + + return nullptr; +} + +// Extract the initial value from the |induction| OpPhi instruction and store it +// in |value|. If the function couldn't find the initial value of |induction| +// return false. +bool Loop::GetInductionInitValue(const Instruction* induction, + int64_t* value) const { + Instruction* constant_instruction = nullptr; + analysis::DefUseManager* def_use_manager = context_->get_def_use_mgr(); + + for (uint32_t operand_id = 0; operand_id < induction->NumInOperands(); + operand_id += 2) { + BasicBlock* bb = context_->cfg()->block( + induction->GetSingleWordInOperand(operand_id + 1)); + + if (!IsInsideLoop(bb)) { + constant_instruction = def_use_manager->GetDef( + induction->GetSingleWordInOperand(operand_id)); + } + } + + if (!constant_instruction) return false; + + const analysis::Constant* constant = + context_->get_constant_mgr()->FindDeclaredConstant( + constant_instruction->result_id()); + if (!constant) return false; + + if (value) { + const analysis::Integer* type = + constant->AsIntConstant()->type()->AsInteger(); + + if (type->IsSigned()) { + *value = constant->AsIntConstant()->GetS32BitValue(); + } else { + *value = constant->AsIntConstant()->GetU32BitValue(); + } + } + + return true; +} + +Loop::Loop(IRContext* context, DominatorAnalysis* dom_analysis, + BasicBlock* header, BasicBlock* continue_target, + BasicBlock* merge_target) + : context_(context), + loop_header_(header), + loop_continue_(continue_target), + loop_merge_(merge_target), + loop_preheader_(nullptr), + parent_(nullptr), + loop_is_marked_for_removal_(false) { + assert(context); + assert(dom_analysis); + loop_preheader_ = FindLoopPreheader(dom_analysis); + loop_latch_ = FindLatchBlock(); +} + +BasicBlock* Loop::FindLoopPreheader(DominatorAnalysis* dom_analysis) { + CFG* cfg = context_->cfg(); + DominatorTree& dom_tree = dom_analysis->GetDomTree(); + DominatorTreeNode* header_node = dom_tree.GetTreeNode(loop_header_); + + // The loop predecessor. + BasicBlock* loop_pred = nullptr; + + auto header_pred = cfg->preds(loop_header_->id()); + for (uint32_t p_id : header_pred) { + DominatorTreeNode* node = dom_tree.GetTreeNode(p_id); + if (node && !dom_tree.Dominates(header_node, node)) { + // The predecessor is not part of the loop, so potential loop preheader. + if (loop_pred && node->bb_ != loop_pred) { + // If we saw 2 distinct predecessors that are outside the loop, we don't + // have a loop preheader. + return nullptr; + } + loop_pred = node->bb_; + } + } + // Safe guard against invalid code, SPIR-V spec forbids loop with the entry + // node as header. + assert(loop_pred && "The header node is the entry block ?"); + + // So we have a unique basic block that can enter this loop. + // If this loop is the unique successor of this block, then it is a loop + // preheader. + bool is_preheader = true; + uint32_t loop_header_id = loop_header_->id(); + const auto* const_loop_pred = loop_pred; + const_loop_pred->ForEachSuccessorLabel( + [&is_preheader, loop_header_id](const uint32_t id) { + if (id != loop_header_id) is_preheader = false; + }); + if (is_preheader) return loop_pred; + return nullptr; +} + +bool Loop::IsInsideLoop(Instruction* inst) const { + const BasicBlock* parent_block = context_->get_instr_block(inst); + if (!parent_block) return false; + return IsInsideLoop(parent_block); +} + +bool Loop::IsBasicBlockInLoopSlow(const BasicBlock* bb) { + assert(bb->GetParent() && "The basic block does not belong to a function"); + DominatorAnalysis* dom_analysis = + context_->GetDominatorAnalysis(bb->GetParent()); + if (dom_analysis->IsReachable(bb) && + !dom_analysis->Dominates(GetHeaderBlock(), bb)) + return false; + + return true; +} + +BasicBlock* Loop::GetOrCreatePreHeaderBlock() { + if (loop_preheader_) return loop_preheader_; + + CFG* cfg = context_->cfg(); + loop_header_ = cfg->SplitLoopHeader(loop_header_); + return loop_preheader_; +} + +void Loop::SetContinueBlock(BasicBlock* continue_block) { + assert(IsInsideLoop(continue_block)); + loop_continue_ = continue_block; +} + +void Loop::SetLatchBlock(BasicBlock* latch) { +#ifndef NDEBUG + assert(latch->GetParent() && "The basic block does not belong to a function"); + + const auto* const_latch = latch; + const_latch->ForEachSuccessorLabel([this](uint32_t id) { + assert((!IsInsideLoop(id) || id == GetHeaderBlock()->id()) && + "A predecessor of the continue block does not belong to the loop"); + }); +#endif // NDEBUG + assert(IsInsideLoop(latch) && "The continue block is not in the loop"); + + SetLatchBlockImpl(latch); +} + +void Loop::SetMergeBlock(BasicBlock* merge) { +#ifndef NDEBUG + assert(merge->GetParent() && "The basic block does not belong to a function"); +#endif // NDEBUG + assert(!IsInsideLoop(merge) && "The merge block is in the loop"); + + SetMergeBlockImpl(merge); + if (GetHeaderBlock()->GetLoopMergeInst()) { + UpdateLoopMergeInst(); + } +} + +void Loop::SetPreHeaderBlock(BasicBlock* preheader) { + if (preheader) { + assert(!IsInsideLoop(preheader) && "The preheader block is in the loop"); + assert(preheader->tail()->opcode() == SpvOpBranch && + "The preheader block does not unconditionally branch to the header " + "block"); + assert(preheader->tail()->GetSingleWordOperand(0) == + GetHeaderBlock()->id() && + "The preheader block does not unconditionally branch to the header " + "block"); + } + loop_preheader_ = preheader; +} + +BasicBlock* Loop::FindLatchBlock() { + CFG* cfg = context_->cfg(); + + DominatorAnalysis* dominator_analysis = + context_->GetDominatorAnalysis(loop_header_->GetParent()); + + // Look at the predecessors of the loop header to find a predecessor block + // which is dominated by the loop continue target. There should only be one + // block which meets this criteria and this is the latch block, as per the + // SPIR-V spec. + for (uint32_t block_id : cfg->preds(loop_header_->id())) { + if (dominator_analysis->Dominates(loop_continue_->id(), block_id)) { + return cfg->block(block_id); + } + } + + assert( + false && + "Every loop should have a latch block dominated by the continue target"); + return nullptr; +} + +void Loop::GetExitBlocks(std::unordered_set* exit_blocks) const { + CFG* cfg = context_->cfg(); + exit_blocks->clear(); + + for (uint32_t bb_id : GetBlocks()) { + const BasicBlock* bb = cfg->block(bb_id); + bb->ForEachSuccessorLabel([exit_blocks, this](uint32_t succ) { + if (!IsInsideLoop(succ)) { + exit_blocks->insert(succ); + } + }); + } +} + +void Loop::GetMergingBlocks( + std::unordered_set* merging_blocks) const { + assert(GetMergeBlock() && "This loop is not structured"); + CFG* cfg = context_->cfg(); + merging_blocks->clear(); + + std::stack to_visit; + to_visit.push(GetMergeBlock()); + while (!to_visit.empty()) { + const BasicBlock* bb = to_visit.top(); + to_visit.pop(); + merging_blocks->insert(bb->id()); + for (uint32_t pred_id : cfg->preds(bb->id())) { + if (!IsInsideLoop(pred_id) && !merging_blocks->count(pred_id)) { + to_visit.push(cfg->block(pred_id)); + } + } + } +} + +namespace { + +static inline bool IsBasicBlockSafeToClone(IRContext* context, BasicBlock* bb) { + for (Instruction& inst : *bb) { + if (!inst.IsBranch() && !context->IsCombinatorInstruction(&inst)) + return false; + } + + return true; +} + +} // namespace + +bool Loop::IsSafeToClone() const { + CFG& cfg = *context_->cfg(); + + for (uint32_t bb_id : GetBlocks()) { + BasicBlock* bb = cfg.block(bb_id); + assert(bb); + if (!IsBasicBlockSafeToClone(context_, bb)) return false; + } + + // Look at the merge construct. + if (GetHeaderBlock()->GetLoopMergeInst()) { + std::unordered_set blocks; + GetMergingBlocks(&blocks); + blocks.erase(GetMergeBlock()->id()); + for (uint32_t bb_id : blocks) { + BasicBlock* bb = cfg.block(bb_id); + assert(bb); + if (!IsBasicBlockSafeToClone(context_, bb)) return false; + } + } + + return true; +} + +bool Loop::IsLCSSA() const { + CFG* cfg = context_->cfg(); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + std::unordered_set exit_blocks; + GetExitBlocks(&exit_blocks); + + // Declare ir_context so we can capture context_ in the below lambda + IRContext* ir_context = context_; + + for (uint32_t bb_id : GetBlocks()) { + for (Instruction& insn : *cfg->block(bb_id)) { + // All uses must be either: + // - In the loop; + // - In an exit block and in a phi instruction. + if (!def_use_mgr->WhileEachUser( + &insn, + [&exit_blocks, ir_context, this](Instruction* use) -> bool { + BasicBlock* parent = ir_context->get_instr_block(use); + assert(parent && "Invalid analysis"); + if (IsInsideLoop(parent)) return true; + if (use->opcode() != SpvOpPhi) return false; + return exit_blocks.count(parent->id()); + })) + return false; + } + } + return true; +} + +bool Loop::ShouldHoistInstruction(IRContext* context, Instruction* inst) { + return AreAllOperandsOutsideLoop(context, inst) && + inst->IsOpcodeCodeMotionSafe(); +} + +bool Loop::AreAllOperandsOutsideLoop(IRContext* context, Instruction* inst) { + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + bool all_outside_loop = true; + + const std::function operand_outside_loop = + [this, &def_use_mgr, &all_outside_loop](uint32_t* id) { + if (this->IsInsideLoop(def_use_mgr->GetDef(*id))) { + all_outside_loop = false; + return; + } + }; + + inst->ForEachInId(operand_outside_loop); + return all_outside_loop; +} + +void Loop::ComputeLoopStructuredOrder( + std::vector* ordered_loop_blocks, bool include_pre_header, + bool include_merge) const { + CFG& cfg = *context_->cfg(); + + // Reserve the memory: all blocks in the loop + extra if needed. + ordered_loop_blocks->reserve(GetBlocks().size() + include_pre_header + + include_merge); + + if (include_pre_header && GetPreHeaderBlock()) + ordered_loop_blocks->push_back(loop_preheader_); + cfg.ForEachBlockInReversePostOrder( + loop_header_, [ordered_loop_blocks, this](BasicBlock* bb) { + if (IsInsideLoop(bb)) ordered_loop_blocks->push_back(bb); + }); + if (include_merge && GetMergeBlock()) + ordered_loop_blocks->push_back(loop_merge_); +} + +LoopDescriptor::LoopDescriptor(IRContext* context, const Function* f) + : loops_(), dummy_top_loop_(nullptr) { + PopulateList(context, f); +} + +LoopDescriptor::~LoopDescriptor() { ClearLoops(); } + +void LoopDescriptor::PopulateList(IRContext* context, const Function* f) { + DominatorAnalysis* dom_analysis = context->GetDominatorAnalysis(f); + + ClearLoops(); + + // Post-order traversal of the dominator tree to find all the OpLoopMerge + // instructions. + DominatorTree& dom_tree = dom_analysis->GetDomTree(); + for (DominatorTreeNode& node : + make_range(dom_tree.post_begin(), dom_tree.post_end())) { + Instruction* merge_inst = node.bb_->GetLoopMergeInst(); + if (merge_inst) { + bool all_backedge_unreachable = true; + for (uint32_t pid : context->cfg()->preds(node.bb_->id())) { + if (dom_analysis->IsReachable(pid) && + dom_analysis->Dominates(node.bb_->id(), pid)) { + all_backedge_unreachable = false; + break; + } + } + if (all_backedge_unreachable) + continue; // ignore this one, we actually never branch back. + + // The id of the merge basic block of this loop. + uint32_t merge_bb_id = merge_inst->GetSingleWordOperand(0); + + // The id of the continue basic block of this loop. + uint32_t continue_bb_id = merge_inst->GetSingleWordOperand(1); + + // The merge target of this loop. + BasicBlock* merge_bb = context->cfg()->block(merge_bb_id); + + // The continue target of this loop. + BasicBlock* continue_bb = context->cfg()->block(continue_bb_id); + + // The basic block containing the merge instruction. + BasicBlock* header_bb = context->get_instr_block(merge_inst); + + // Add the loop to the list of all the loops in the function. + Loop* current_loop = + new Loop(context, dom_analysis, header_bb, continue_bb, merge_bb); + loops_.push_back(current_loop); + + // We have a bottom-up construction, so if this loop has nested-loops, + // they are by construction at the tail of the loop list. + for (auto itr = loops_.rbegin() + 1; itr != loops_.rend(); ++itr) { + Loop* previous_loop = *itr; + + // If the loop already has a parent, then it has been processed. + if (previous_loop->HasParent()) continue; + + // If the current loop does not dominates the previous loop then it is + // not nested loop. + if (!dom_analysis->Dominates(header_bb, + previous_loop->GetHeaderBlock())) + continue; + // If the current loop merge dominates the previous loop then it is + // not nested loop. + if (dom_analysis->Dominates(merge_bb, previous_loop->GetHeaderBlock())) + continue; + + current_loop->AddNestedLoop(previous_loop); + } + DominatorTreeNode* dom_merge_node = dom_tree.GetTreeNode(merge_bb); + for (DominatorTreeNode& loop_node : + make_range(node.df_begin(), node.df_end())) { + // Check if we are in the loop. + if (dom_tree.Dominates(dom_merge_node, &loop_node)) continue; + current_loop->AddBasicBlock(loop_node.bb_); + basic_block_to_loop_.insert( + std::make_pair(loop_node.bb_->id(), current_loop)); + } + } + } + for (Loop* loop : loops_) { + if (!loop->HasParent()) dummy_top_loop_.nested_loops_.push_back(loop); + } +} + +std::vector LoopDescriptor::GetLoopsInBinaryLayoutOrder() { + std::vector ids{}; + + for (size_t i = 0; i < NumLoops(); ++i) { + ids.push_back(GetLoopByIndex(i).GetHeaderBlock()->id()); + } + + std::vector loops{}; + if (!ids.empty()) { + auto function = GetLoopByIndex(0).GetHeaderBlock()->GetParent(); + for (const auto& block : *function) { + auto block_id = block.id(); + + auto element = std::find(std::begin(ids), std::end(ids), block_id); + if (element != std::end(ids)) { + loops.push_back(&GetLoopByIndex(element - std::begin(ids))); + } + } + } + + return loops; +} + +BasicBlock* Loop::FindConditionBlock() const { + if (!loop_merge_) { + return nullptr; + } + BasicBlock* condition_block = nullptr; + + uint32_t in_loop_pred = 0; + for (uint32_t p : context_->cfg()->preds(loop_merge_->id())) { + if (IsInsideLoop(p)) { + if (in_loop_pred) { + // 2 in-loop predecessors. + return nullptr; + } + in_loop_pred = p; + } + } + if (!in_loop_pred) { + // Merge block is unreachable. + return nullptr; + } + + BasicBlock* bb = context_->cfg()->block(in_loop_pred); + + if (!bb) return nullptr; + + const Instruction& branch = *bb->ctail(); + + // Make sure the branch is a conditional branch. + if (branch.opcode() != SpvOpBranchConditional) return nullptr; + + // Make sure one of the two possible branches is to the merge block. + if (branch.GetSingleWordInOperand(1) == loop_merge_->id() || + branch.GetSingleWordInOperand(2) == loop_merge_->id()) { + condition_block = bb; + } + + return condition_block; +} + +bool Loop::FindNumberOfIterations(const Instruction* induction, + const Instruction* branch_inst, + size_t* iterations_out, + int64_t* step_value_out, + int64_t* init_value_out) const { + // From the branch instruction find the branch condition. + analysis::DefUseManager* def_use_manager = context_->get_def_use_mgr(); + + // Condition instruction from the OpConditionalBranch. + Instruction* condition = + def_use_manager->GetDef(branch_inst->GetSingleWordOperand(0)); + + assert(IsSupportedCondition(condition->opcode())); + + // Get the constant manager from the ir context. + analysis::ConstantManager* const_manager = context_->get_constant_mgr(); + + // Find the constant value used by the condition variable. Exit out if it + // isn't a constant int. + const analysis::Constant* upper_bound = + const_manager->FindDeclaredConstant(condition->GetSingleWordOperand(3)); + if (!upper_bound) return false; + + // Must be integer because of the opcode on the condition. + int64_t condition_value = 0; + + const analysis::Integer* type = + upper_bound->AsIntConstant()->type()->AsInteger(); + + if (type->width() > 32) { + return false; + } + + if (type->IsSigned()) { + condition_value = upper_bound->AsIntConstant()->GetS32BitValue(); + } else { + condition_value = upper_bound->AsIntConstant()->GetU32BitValue(); + } + + // Find the instruction which is stepping through the loop. + Instruction* step_inst = GetInductionStepOperation(induction); + if (!step_inst) return false; + + // Find the constant value used by the condition variable. + const analysis::Constant* step_constant = + const_manager->FindDeclaredConstant(step_inst->GetSingleWordOperand(3)); + if (!step_constant) return false; + + // Must be integer because of the opcode on the condition. + int64_t step_value = 0; + + const analysis::Integer* step_type = + step_constant->AsIntConstant()->type()->AsInteger(); + + if (step_type->IsSigned()) { + step_value = step_constant->AsIntConstant()->GetS32BitValue(); + } else { + step_value = step_constant->AsIntConstant()->GetU32BitValue(); + } + + // If this is a subtraction step we should negate the step value. + if (step_inst->opcode() == SpvOp::SpvOpISub) { + step_value = -step_value; + } + + // Find the inital value of the loop and make sure it is a constant integer. + int64_t init_value = 0; + if (!GetInductionInitValue(induction, &init_value)) return false; + + // If iterations is non null then store the value in that. + int64_t num_itrs = GetIterations(condition->opcode(), condition_value, + init_value, step_value); + + // If the loop body will not be reached return false. + if (num_itrs <= 0) { + return false; + } + + if (iterations_out) { + assert(static_cast(num_itrs) <= std::numeric_limits::max()); + *iterations_out = static_cast(num_itrs); + } + + if (step_value_out) { + *step_value_out = step_value; + } + + if (init_value_out) { + *init_value_out = init_value; + } + + return true; +} + +// We retrieve the number of iterations using the following formula, diff / +// |step_value| where diff is calculated differently according to the +// |condition| and uses the |condition_value| and |init_value|. If diff / +// |step_value| is NOT cleanly divisable then we add one to the sum. +int64_t Loop::GetIterations(SpvOp condition, int64_t condition_value, + int64_t init_value, int64_t step_value) const { + int64_t diff = 0; + + switch (condition) { + case SpvOp::SpvOpSLessThan: + case SpvOp::SpvOpULessThan: { + // If the condition is not met to begin with the loop will never iterate. + if (!(init_value < condition_value)) return 0; + + diff = condition_value - init_value; + + // If the operation is a less then operation then the diff and step must + // have the same sign otherwise the induction will never cross the + // condition (either never true or always true). + if ((diff < 0 && step_value > 0) || (diff > 0 && step_value < 0)) { + return 0; + } + + break; + } + case SpvOp::SpvOpSGreaterThan: + case SpvOp::SpvOpUGreaterThan: { + // If the condition is not met to begin with the loop will never iterate. + if (!(init_value > condition_value)) return 0; + + diff = init_value - condition_value; + + // If the operation is a greater than operation then the diff and step + // must have opposite signs. Otherwise the condition will always be true + // or will never be true. + if ((diff < 0 && step_value < 0) || (diff > 0 && step_value > 0)) { + return 0; + } + + break; + } + + case SpvOp::SpvOpSGreaterThanEqual: + case SpvOp::SpvOpUGreaterThanEqual: { + // If the condition is not met to begin with the loop will never iterate. + if (!(init_value >= condition_value)) return 0; + + // We subract one to make it the same as SpvOpGreaterThan as it is + // functionally equivalent. + diff = init_value - (condition_value - 1); + + // If the operation is a greater than operation then the diff and step + // must have opposite signs. Otherwise the condition will always be true + // or will never be true. + if ((diff > 0 && step_value > 0) || (diff < 0 && step_value < 0)) { + return 0; + } + + break; + } + + case SpvOp::SpvOpSLessThanEqual: + case SpvOp::SpvOpULessThanEqual: { + // If the condition is not met to begin with the loop will never iterate. + if (!(init_value <= condition_value)) return 0; + + // We add one to make it the same as SpvOpLessThan as it is functionally + // equivalent. + diff = (condition_value + 1) - init_value; + + // If the operation is a less than operation then the diff and step must + // have the same sign otherwise the induction will never cross the + // condition (either never true or always true). + if ((diff < 0 && step_value > 0) || (diff > 0 && step_value < 0)) { + return 0; + } + + break; + } + + default: + assert(false && + "Could not retrieve number of iterations from the loop condition. " + "Condition is not supported."); + } + + // Take the abs of - step values. + step_value = llabs(step_value); + diff = llabs(diff); + int64_t result = diff / step_value; + + if (diff % step_value != 0) { + result += 1; + } + return result; +} + +// Returns the list of induction variables within the loop. +void Loop::GetInductionVariables( + std::vector& induction_variables) const { + for (Instruction& inst : *loop_header_) { + if (inst.opcode() == SpvOp::SpvOpPhi) { + induction_variables.push_back(&inst); + } + } +} + +Instruction* Loop::FindConditionVariable( + const BasicBlock* condition_block) const { + // Find the branch instruction. + const Instruction& branch_inst = *condition_block->ctail(); + + Instruction* induction = nullptr; + // Verify that the branch instruction is a conditional branch. + if (branch_inst.opcode() == SpvOp::SpvOpBranchConditional) { + // From the branch instruction find the branch condition. + analysis::DefUseManager* def_use_manager = context_->get_def_use_mgr(); + + // Find the instruction representing the condition used in the conditional + // branch. + Instruction* condition = + def_use_manager->GetDef(branch_inst.GetSingleWordOperand(0)); + + // Ensure that the condition is a less than operation. + if (condition && IsSupportedCondition(condition->opcode())) { + // The left hand side operand of the operation. + Instruction* variable_inst = + def_use_manager->GetDef(condition->GetSingleWordOperand(2)); + + // Make sure the variable instruction used is a phi. + if (!variable_inst || variable_inst->opcode() != SpvOpPhi) return nullptr; + + // Make sure the phi instruction only has two incoming blocks. Each + // incoming block will be represented by two in operands in the phi + // instruction, the value and the block which that value came from. We + // assume the cannocalised phi will have two incoming values, one from the + // preheader and one from the continue block. + size_t max_supported_operands = 4; + if (variable_inst->NumInOperands() == max_supported_operands) { + // The operand index of the first incoming block label. + uint32_t operand_label_1 = 1; + + // The operand index of the second incoming block label. + uint32_t operand_label_2 = 3; + + // Make sure one of them is the preheader. + if (!IsInsideLoop( + variable_inst->GetSingleWordInOperand(operand_label_1)) && + !IsInsideLoop( + variable_inst->GetSingleWordInOperand(operand_label_2))) { + return nullptr; + } + + // And make sure that the other is the latch block. + if (variable_inst->GetSingleWordInOperand(operand_label_1) != + loop_latch_->id() && + variable_inst->GetSingleWordInOperand(operand_label_2) != + loop_latch_->id()) { + return nullptr; + } + } else { + return nullptr; + } + + if (!FindNumberOfIterations(variable_inst, &branch_inst, nullptr)) + return nullptr; + induction = variable_inst; + } + } + + return induction; +} + +bool LoopDescriptor::CreatePreHeaderBlocksIfMissing() { + auto modified = false; + + for (auto& loop : *this) { + if (!loop.GetPreHeaderBlock()) { + modified = true; + loop.GetOrCreatePreHeaderBlock(); + } + } + + return modified; +} + +// Add and remove loops which have been marked for addition and removal to +// maintain the state of the loop descriptor class. +void LoopDescriptor::PostModificationCleanup() { + LoopContainerType loops_to_remove_; + for (Loop* loop : loops_) { + if (loop->IsMarkedForRemoval()) { + loops_to_remove_.push_back(loop); + if (loop->HasParent()) { + loop->GetParent()->RemoveChildLoop(loop); + } + } + } + + for (Loop* loop : loops_to_remove_) { + loops_.erase(std::find(loops_.begin(), loops_.end(), loop)); + } + + for (auto& pair : loops_to_add_) { + Loop* parent = pair.first; + Loop* loop = pair.second; + + if (parent) { + loop->SetParent(nullptr); + parent->AddNestedLoop(loop); + + for (uint32_t block_id : loop->GetBlocks()) { + parent->AddBasicBlock(block_id); + } + } + + loops_.emplace_back(loop); + } + + loops_to_add_.clear(); +} + +void LoopDescriptor::ClearLoops() { + for (Loop* loop : loops_) { + delete loop; + } + loops_.clear(); +} + +// Adds a new loop nest to the descriptor set. +Loop* LoopDescriptor::AddLoopNest(std::unique_ptr new_loop) { + Loop* loop = new_loop.release(); + if (!loop->HasParent()) dummy_top_loop_.nested_loops_.push_back(loop); + // Iterate from inner to outer most loop, adding basic block to loop mapping + // as we go. + for (Loop& current_loop : + make_range(iterator::begin(loop), iterator::end(nullptr))) { + loops_.push_back(¤t_loop); + for (uint32_t bb_id : current_loop.GetBlocks()) + basic_block_to_loop_.insert(std::make_pair(bb_id, ¤t_loop)); + } + + return loop; +} + +void LoopDescriptor::RemoveLoop(Loop* loop) { + Loop* parent = loop->GetParent() ? loop->GetParent() : &dummy_top_loop_; + parent->nested_loops_.erase(std::find(parent->nested_loops_.begin(), + parent->nested_loops_.end(), loop)); + std::for_each( + loop->nested_loops_.begin(), loop->nested_loops_.end(), + [loop](Loop* sub_loop) { sub_loop->SetParent(loop->GetParent()); }); + parent->nested_loops_.insert(parent->nested_loops_.end(), + loop->nested_loops_.begin(), + loop->nested_loops_.end()); + for (uint32_t bb_id : loop->GetBlocks()) { + Loop* l = FindLoopForBasicBlock(bb_id); + if (l == loop) { + SetBasicBlockToLoop(bb_id, l->GetParent()); + } else { + ForgetBasicBlock(bb_id); + } + } + + LoopContainerType::iterator it = + std::find(loops_.begin(), loops_.end(), loop); + assert(it != loops_.end()); + delete loop; + loops_.erase(it); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h new file mode 100644 index 00000000000..45a175a0cad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_descriptor.h @@ -0,0 +1,572 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_LOOP_DESCRIPTOR_H_ +#define SOURCE_OPT_LOOP_DESCRIPTOR_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/module.h" +#include "source/opt/tree_iterator.h" + +namespace spvtools { +namespace opt { + +class IRContext; +class CFG; +class LoopDescriptor; + +// A class to represent and manipulate a loop in structured control flow. +class Loop { + // The type used to represent nested child loops. + using ChildrenList = std::vector; + + public: + using iterator = ChildrenList::iterator; + using const_iterator = ChildrenList::const_iterator; + using BasicBlockListTy = std::unordered_set; + + explicit Loop(IRContext* context) + : context_(context), + loop_header_(nullptr), + loop_continue_(nullptr), + loop_merge_(nullptr), + loop_preheader_(nullptr), + loop_latch_(nullptr), + parent_(nullptr), + loop_is_marked_for_removal_(false) {} + + Loop(IRContext* context, DominatorAnalysis* analysis, BasicBlock* header, + BasicBlock* continue_target, BasicBlock* merge_target); + + // Iterators over the immediate sub-loops. + inline iterator begin() { return nested_loops_.begin(); } + inline iterator end() { return nested_loops_.end(); } + inline const_iterator begin() const { return cbegin(); } + inline const_iterator end() const { return cend(); } + inline const_iterator cbegin() const { return nested_loops_.begin(); } + inline const_iterator cend() const { return nested_loops_.end(); } + + // Returns the header (first basic block of the loop). This block contains the + // OpLoopMerge instruction. + inline BasicBlock* GetHeaderBlock() { return loop_header_; } + inline const BasicBlock* GetHeaderBlock() const { return loop_header_; } + inline void SetHeaderBlock(BasicBlock* header) { loop_header_ = header; } + + // Updates the OpLoopMerge instruction to reflect the current state of the + // loop. + inline void UpdateLoopMergeInst() { + assert(GetHeaderBlock()->GetLoopMergeInst() && + "The loop is not structured"); + Instruction* merge_inst = GetHeaderBlock()->GetLoopMergeInst(); + merge_inst->SetInOperand(0, {GetMergeBlock()->id()}); + } + + // Returns the continue target basic block. This is the block designated as + // the continue target by the OpLoopMerge instruction. + inline BasicBlock* GetContinueBlock() { return loop_continue_; } + inline const BasicBlock* GetContinueBlock() const { return loop_continue_; } + + // Returns the latch basic block (basic block that holds the back-edge). + // These functions return nullptr if the loop is not structured (i.e. if it + // has more than one backedge). + inline BasicBlock* GetLatchBlock() { return loop_latch_; } + inline const BasicBlock* GetLatchBlock() const { return loop_latch_; } + + // Sets |latch| as the loop unique block branching back to the header. + // A latch block must have the following properties: + // - |latch| must be in the loop; + // - must be the only block branching back to the header block. + void SetLatchBlock(BasicBlock* latch); + + // Sets |continue_block| as the continue block of the loop. This should be the + // continue target of the OpLoopMerge and should dominate the latch block. + void SetContinueBlock(BasicBlock* continue_block); + + // Returns the basic block which marks the end of the loop. + // These functions return nullptr if the loop is not structured. + inline BasicBlock* GetMergeBlock() { return loop_merge_; } + inline const BasicBlock* GetMergeBlock() const { return loop_merge_; } + // Sets |merge| as the loop merge block. A merge block must have the following + // properties: + // - |merge| must not be in the loop; + // - all its predecessors must be in the loop. + // - it must not be already used as merge block. + // If the loop has an OpLoopMerge in its header, this instruction is also + // updated. + void SetMergeBlock(BasicBlock* merge); + + // Returns the loop pre-header, nullptr means that the loop predecessor does + // not qualify as a preheader. + // The preheader is the unique predecessor that: + // - Dominates the loop header; + // - Has only the loop header as successor. + inline BasicBlock* GetPreHeaderBlock() { return loop_preheader_; } + + // Returns the loop pre-header. + inline const BasicBlock* GetPreHeaderBlock() const { return loop_preheader_; } + // Sets |preheader| as the loop preheader block. A preheader block must have + // the following properties: + // - |merge| must not be in the loop; + // - have an unconditional branch to the loop header. + void SetPreHeaderBlock(BasicBlock* preheader); + + // Returns the loop pre-header, if there is no suitable preheader it will be + // created. + BasicBlock* GetOrCreatePreHeaderBlock(); + + // Returns true if this loop contains any nested loops. + inline bool HasNestedLoops() const { return nested_loops_.size() != 0; } + + // Clears and fills |exit_blocks| with all basic blocks that are not in the + // loop and has at least one predecessor in the loop. + void GetExitBlocks(std::unordered_set* exit_blocks) const; + + // Clears and fills |merging_blocks| with all basic blocks that are + // post-dominated by the merge block. The merge block must exist. + // The set |merging_blocks| will only contain the merge block if it is + // unreachable. + void GetMergingBlocks(std::unordered_set* merging_blocks) const; + + // Returns true if the loop is in a Loop Closed SSA form. + // In LCSSA form, all in-loop definitions are used in the loop or in phi + // instructions in the loop exit blocks. + bool IsLCSSA() const; + + // Returns the depth of this loop in the loop nest. + // The outer-most loop has a depth of 1. + inline size_t GetDepth() const { + size_t lvl = 1; + for (const Loop* loop = GetParent(); loop; loop = loop->GetParent()) lvl++; + return lvl; + } + + inline size_t NumImmediateChildren() const { return nested_loops_.size(); } + + inline bool HasChildren() const { return !nested_loops_.empty(); } + // Adds |nested| as a nested loop of this loop. Automatically register |this| + // as the parent of |nested|. + inline void AddNestedLoop(Loop* nested) { + assert(!nested->GetParent() && "The loop has another parent."); + nested_loops_.push_back(nested); + nested->SetParent(this); + } + + inline Loop* GetParent() { return parent_; } + inline const Loop* GetParent() const { return parent_; } + + inline bool HasParent() const { return parent_; } + + // Returns true if this loop is itself nested within another loop. + inline bool IsNested() const { return parent_ != nullptr; } + + // Returns the set of all basic blocks contained within the loop. Will be all + // BasicBlocks dominated by the header which are not also dominated by the + // loop merge block. + inline const BasicBlockListTy& GetBlocks() const { + return loop_basic_blocks_; + } + + // Returns true if the basic block |bb| is inside this loop. + inline bool IsInsideLoop(const BasicBlock* bb) const { + return IsInsideLoop(bb->id()); + } + + // Returns true if the basic block id |bb_id| is inside this loop. + inline bool IsInsideLoop(uint32_t bb_id) const { + return loop_basic_blocks_.count(bb_id); + } + + // Returns true if the instruction |inst| is inside this loop. + bool IsInsideLoop(Instruction* inst) const; + + // Adds the Basic Block |bb| to this loop and its parents. + void AddBasicBlock(const BasicBlock* bb) { AddBasicBlock(bb->id()); } + + // Adds the Basic Block with |id| to this loop and its parents. + void AddBasicBlock(uint32_t id) { + for (Loop* loop = this; loop != nullptr; loop = loop->parent_) { + loop->loop_basic_blocks_.insert(id); + } + } + + // Removes the Basic Block id |bb_id| from this loop and its parents. + // It the user responsibility to make sure the removed block is not a merge, + // header or continue block. + void RemoveBasicBlock(uint32_t bb_id) { + for (Loop* loop = this; loop != nullptr; loop = loop->parent_) { + loop->loop_basic_blocks_.erase(bb_id); + } + } + + // Removes all the basic blocks from the set of basic blocks within the loop. + // This does not affect any of the stored pointers to the header, preheader, + // merge, or continue blocks. + void ClearBlocks() { loop_basic_blocks_.clear(); } + + // Adds the Basic Block |bb| this loop and its parents. + void AddBasicBlockToLoop(const BasicBlock* bb) { + assert(IsBasicBlockInLoopSlow(bb) && + "Basic block does not belong to the loop"); + + AddBasicBlock(bb); + } + + // Returns the list of induction variables within the loop. + void GetInductionVariables(std::vector& inductions) const; + + // This function uses the |condition| to find the induction variable which is + // used by the loop condition within the loop. This only works if the loop is + // bound by a single condition and single induction variable. + Instruction* FindConditionVariable(const BasicBlock* condition) const; + + // Returns the number of iterations within a loop when given the |induction| + // variable and the loop |condition| check. It stores the found number of + // iterations in the output parameter |iterations| and optionally, the step + // value in |step_value| and the initial value of the induction variable in + // |init_value|. + bool FindNumberOfIterations(const Instruction* induction, + const Instruction* condition, size_t* iterations, + int64_t* step_amount = nullptr, + int64_t* init_value = nullptr) const; + + // Returns the value of the OpLoopMerge control operand as a bool. Loop + // control can be None(0), Unroll(1), or DontUnroll(2). This function returns + // true if it is set to Unroll. + inline bool HasUnrollLoopControl() const { + assert(loop_header_); + if (!loop_header_->GetLoopMergeInst()) return false; + + return loop_header_->GetLoopMergeInst()->GetSingleWordOperand(2) == 1; + } + + // Finds the conditional block with a branch to the merge and continue blocks + // within the loop body. + BasicBlock* FindConditionBlock() const; + + // Remove the child loop form this loop. + inline void RemoveChildLoop(Loop* loop) { + nested_loops_.erase( + std::find(nested_loops_.begin(), nested_loops_.end(), loop)); + loop->SetParent(nullptr); + } + + // Mark this loop to be removed later by a call to + // LoopDescriptor::PostModificationCleanup. + inline void MarkLoopForRemoval() { loop_is_marked_for_removal_ = true; } + + // Returns whether or not this loop has been marked for removal. + inline bool IsMarkedForRemoval() const { return loop_is_marked_for_removal_; } + + // Returns true if all nested loops have been marked for removal. + inline bool AreAllChildrenMarkedForRemoval() const { + for (const Loop* child : nested_loops_) { + if (!child->IsMarkedForRemoval()) { + return false; + } + } + return true; + } + + // Checks if the loop contains any instruction that will prevent it from being + // cloned. If the loop is structured, the merge construct is also considered. + bool IsSafeToClone() const; + + // Sets the parent loop of this loop, that is, a loop which contains this loop + // as a nested child loop. + inline void SetParent(Loop* parent) { parent_ = parent; } + + // Returns true is the instruction is invariant and safe to move wrt loop + bool ShouldHoistInstruction(IRContext* context, Instruction* inst); + + // Returns true if all operands of inst are in basic blocks not contained in + // loop + bool AreAllOperandsOutsideLoop(IRContext* context, Instruction* inst); + + // Extract the initial value from the |induction| variable and store it in + // |value|. If the function couldn't find the initial value of |induction| + // return false. + bool GetInductionInitValue(const Instruction* induction, + int64_t* value) const; + + // Takes in a phi instruction |induction| and the loop |header| and returns + // the step operation of the loop. + Instruction* GetInductionStepOperation(const Instruction* induction) const; + + // Returns true if we can deduce the number of loop iterations in the step + // operation |step|. IsSupportedCondition must also be true for the condition + // instruction. + bool IsSupportedStepOp(SpvOp step) const; + + // Returns true if we can deduce the number of loop iterations in the + // condition operation |condition|. IsSupportedStepOp must also be true for + // the step instruction. + bool IsSupportedCondition(SpvOp condition) const; + + // Creates the list of the loop's basic block in structured order and store + // the result in |ordered_loop_blocks|. If |include_pre_header| is true, the + // pre-header block will also be included at the beginning of the list if it + // exist. If |include_merge| is true, the merge block will also be included at + // the end of the list if it exist. + void ComputeLoopStructuredOrder(std::vector* ordered_loop_blocks, + bool include_pre_header = false, + bool include_merge = false) const; + + // Given the loop |condition|, |initial_value|, |step_value|, the trip count + // |number_of_iterations|, and the |unroll_factor| requested, get the new + // condition value for the residual loop. + static int64_t GetResidualConditionValue(SpvOp condition, + int64_t initial_value, + int64_t step_value, + size_t number_of_iterations, + size_t unroll_factor); + + // Returns the condition instruction for entry into the loop + // Returns nullptr if it can't be found. + Instruction* GetConditionInst() const; + + // Returns the context associated this loop. + IRContext* GetContext() const { return context_; } + + // Looks at all the blocks with a branch to the header block to find one + // which is also dominated by the loop continue block. This block is the latch + // block. The specification mandates that this block should exist, therefore + // this function will assert if it is not found. + BasicBlock* FindLatchBlock(); + + private: + IRContext* context_; + // The block which marks the start of the loop. + BasicBlock* loop_header_; + + // The block which begins the body of the loop. + BasicBlock* loop_continue_; + + // The block which marks the end of the loop. + BasicBlock* loop_merge_; + + // The block immediately before the loop header. + BasicBlock* loop_preheader_; + + // The block containing the backedge to the loop header. + BasicBlock* loop_latch_; + + // A parent of a loop is the loop which contains it as a nested child loop. + Loop* parent_; + + // Nested child loops of this loop. + ChildrenList nested_loops_; + + // A set of all the basic blocks which comprise the loop structure. Will be + // computed only when needed on demand. + BasicBlockListTy loop_basic_blocks_; + + // Check that |bb| is inside the loop using domination property. + // Note: this is for assertion purposes only, IsInsideLoop should be used + // instead. + bool IsBasicBlockInLoopSlow(const BasicBlock* bb); + + // Returns the loop preheader if it exists, returns nullptr otherwise. + BasicBlock* FindLoopPreheader(DominatorAnalysis* dom_analysis); + + // Sets |latch| as the loop unique latch block. No checks are performed + // here. + inline void SetLatchBlockImpl(BasicBlock* latch) { loop_latch_ = latch; } + // Sets |merge| as the loop merge block. No checks are performed here. + inline void SetMergeBlockImpl(BasicBlock* merge) { loop_merge_ = merge; } + + // Each differnt loop |condition| affects how we calculate the number of + // iterations using the |condition_value|, |init_value|, and |step_values| of + // the induction variable. This method will return the number of iterations in + // a loop with those values for a given |condition|. + int64_t GetIterations(SpvOp condition, int64_t condition_value, + int64_t init_value, int64_t step_value) const; + + // This is to allow for loops to be removed mid iteration without invalidating + // the iterators. + bool loop_is_marked_for_removal_; + + // This is only to allow LoopDescriptor::dummy_top_loop_ to add top level + // loops as child. + friend class LoopDescriptor; + friend class LoopUtils; +}; + +// Loop descriptions class for a given function. +// For a given function, the class builds loop nests information. +// The analysis expects a structured control flow. +class LoopDescriptor { + public: + // Iterator interface (depth first postorder traversal). + using iterator = PostOrderTreeDFIterator; + using const_iterator = PostOrderTreeDFIterator; + + using pre_iterator = TreeDFIterator; + using const_pre_iterator = TreeDFIterator; + + // Creates a loop object for all loops found in |f|. + LoopDescriptor(IRContext* context, const Function* f); + + // Disable copy constructor, to avoid double-free on destruction. + LoopDescriptor(const LoopDescriptor&) = delete; + // Move constructor. + LoopDescriptor(LoopDescriptor&& other) : dummy_top_loop_(nullptr) { + // We need to take ownership of the Loop objects in the other + // LoopDescriptor, to avoid double-free. + loops_ = std::move(other.loops_); + other.loops_.clear(); + basic_block_to_loop_ = std::move(other.basic_block_to_loop_); + other.basic_block_to_loop_.clear(); + dummy_top_loop_ = std::move(other.dummy_top_loop_); + } + + // Destructor + ~LoopDescriptor(); + + // Returns the number of loops found in the function. + inline size_t NumLoops() const { return loops_.size(); } + + // Returns the loop at a particular |index|. The |index| must be in bounds, + // check with NumLoops before calling. + inline Loop& GetLoopByIndex(size_t index) const { + assert(loops_.size() > index && + "Index out of range (larger than loop count)"); + return *loops_[index]; + } + + // Returns the loops in |this| in the order their headers appear in the + // binary. + std::vector GetLoopsInBinaryLayoutOrder(); + + // Returns the inner most loop that contains the basic block id |block_id|. + inline Loop* operator[](uint32_t block_id) const { + return FindLoopForBasicBlock(block_id); + } + + // Returns the inner most loop that contains the basic block |bb|. + inline Loop* operator[](const BasicBlock* bb) const { + return (*this)[bb->id()]; + } + + // Iterators for post order depth first traversal of the loops. + // Inner most loops will be visited first. + inline iterator begin() { return iterator::begin(&dummy_top_loop_); } + inline iterator end() { return iterator::end(&dummy_top_loop_); } + inline const_iterator begin() const { return cbegin(); } + inline const_iterator end() const { return cend(); } + inline const_iterator cbegin() const { + return const_iterator::begin(&dummy_top_loop_); + } + inline const_iterator cend() const { + return const_iterator::end(&dummy_top_loop_); + } + + // Iterators for pre-order depth first traversal of the loops. + // Inner most loops will be visited first. + inline pre_iterator pre_begin() { return ++pre_iterator(&dummy_top_loop_); } + inline pre_iterator pre_end() { return pre_iterator(); } + inline const_pre_iterator pre_begin() const { return pre_cbegin(); } + inline const_pre_iterator pre_end() const { return pre_cend(); } + inline const_pre_iterator pre_cbegin() const { + return ++const_pre_iterator(&dummy_top_loop_); + } + inline const_pre_iterator pre_cend() const { return const_pre_iterator(); } + + // Returns the inner most loop that contains the basic block |bb|. + inline void SetBasicBlockToLoop(uint32_t bb_id, Loop* loop) { + basic_block_to_loop_[bb_id] = loop; + } + + // Mark the loop |loop_to_add| as needing to be added when the user calls + // PostModificationCleanup. |parent| may be null. + inline void AddLoop(Loop* loop_to_add, Loop* parent) { + loops_to_add_.emplace_back(std::make_pair(parent, loop_to_add)); + } + + // Checks all loops in |this| and will create pre-headers for all loops + // that don't have one. Returns |true| if any blocks were created. + bool CreatePreHeaderBlocksIfMissing(); + + // Should be called to preserve the LoopAnalysis after loops have been marked + // for addition with AddLoop or MarkLoopForRemoval. + void PostModificationCleanup(); + + // Removes the basic block id |bb_id| from the block to loop mapping. + inline void ForgetBasicBlock(uint32_t bb_id) { + basic_block_to_loop_.erase(bb_id); + } + + // Adds the loop |new_loop| and all its nested loops to the descriptor set. + // The object takes ownership of all the loops. + Loop* AddLoopNest(std::unique_ptr new_loop); + + // Remove the loop |loop|. + void RemoveLoop(Loop* loop); + + void SetAsTopLoop(Loop* loop) { + assert(std::find(dummy_top_loop_.begin(), dummy_top_loop_.end(), loop) == + dummy_top_loop_.end() && + "already registered"); + dummy_top_loop_.nested_loops_.push_back(loop); + } + + Loop* GetDummyRootLoop() { return &dummy_top_loop_; } + const Loop* GetDummyRootLoop() const { return &dummy_top_loop_; } + + private: + // TODO(dneto): This should be a vector of unique_ptr. But VisualStudio 2013 + // is unable to compile it. + using LoopContainerType = std::vector; + using LoopsToAddContainerType = std::vector>; + + // Creates loop descriptors for the function |f|. + void PopulateList(IRContext* context, const Function* f); + + // Returns the inner most loop that contains the basic block id |block_id|. + inline Loop* FindLoopForBasicBlock(uint32_t block_id) const { + std::unordered_map::const_iterator it = + basic_block_to_loop_.find(block_id); + return it != basic_block_to_loop_.end() ? it->second : nullptr; + } + + // Erase all the loop information. + void ClearLoops(); + + // A list of all the loops in the function. This variable owns the Loop + // objects. + LoopContainerType loops_; + + // Dummy root: this "loop" is only there to help iterators creation. + Loop dummy_top_loop_; + + std::unordered_map basic_block_to_loop_; + + // List of the loops marked for addition when PostModificationCleanup is + // called. + LoopsToAddContainerType loops_to_add_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_DESCRIPTOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp new file mode 100644 index 00000000000..0052406dd7a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.cpp @@ -0,0 +1,512 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_fission.h" + +#include + +#include "source/opt/register_pressure.h" + +// Implement loop fission with an optional parameter to split only +// if the register pressure in a given loop meets a certain criteria. This is +// controlled via the constructors of LoopFissionPass. +// +// 1 - Build a list of loops to be split, these are top level loops (loops +// without child loops themselves) which meet the register pressure criteria, as +// determined by the ShouldSplitLoop method of LoopFissionPass. +// +// 2 - For each loop in the list, group each instruction into a set of related +// instructions by traversing each instructions users and operands recursively. +// We stop if we encounter an instruction we have seen before or an instruction +// which we don't consider relevent (i.e OpLoopMerge). We then group these +// groups into two different sets, one for the first loop and one for the +// second. +// +// 3 - We then run CanPerformSplit to check that it would be legal to split a +// loop using those two sets. We check that we haven't altered the relative +// order load/stores appear in the binary and that we aren't breaking any +// dependency between load/stores by splitting them into two loops. We also +// check that none of the OpBranch instructions are dependent on a load as we +// leave control flow structure intact and move only instructions in the body so +// we want to avoid any loads with side affects or aliasing. +// +// 4 - We then split the loop by calling SplitLoop. This function clones the +// loop and attaches it to the preheader and connects the new loops merge block +// to the current loop header block. We then use the two sets built in step 2 to +// remove instructions from each loop. If an instruction appears in the first +// set it is removed from the second loop and vice versa. +// +// 5 - If the multiple split passes flag is set we check if each of the loops +// still meet the register pressure criteria. If they do then we add them to the +// list of loops to be split (created in step one) to allow for loops to be +// split multiple times. +// + +namespace spvtools { +namespace opt { + +class LoopFissionImpl { + public: + LoopFissionImpl(IRContext* context, Loop* loop) + : context_(context), loop_(loop), load_used_in_condition_(false) {} + + // Group each instruction in the loop into sets of instructions related by + // their usedef chains. An instruction which uses another will appear in the + // same set. Then merge those sets into just two sets. Returns false if there + // was one or less sets created. + bool GroupInstructionsByUseDef(); + + // Check if the sets built by GroupInstructionsByUseDef violate any data + // dependence rules. + bool CanPerformSplit(); + + // Split the loop and return a pointer to the new loop. + Loop* SplitLoop(); + + // Checks if |inst| is safe to move. We can only move instructions which don't + // have any side effects and OpLoads and OpStores. + bool MovableInstruction(const Instruction& inst) const; + + private: + // Traverse the def use chain of |inst| and add the users and uses of |inst| + // which are in the same loop to the |returned_set|. + void TraverseUseDef(Instruction* inst, std::set* returned_set, + bool ignore_phi_users = false, bool report_loads = false); + + // We group the instructions in the block into two different groups, the + // instructions to be kept in the original loop and the ones to be cloned into + // the new loop. As the cloned loop is attached to the preheader it will be + // the first loop and the second loop will be the original. + std::set cloned_loop_instructions_; + std::set original_loop_instructions_; + + // We need a set of all the instructions to be seen so we can break any + // recursion and also so we can ignore certain instructions by preemptively + // adding them to this set. + std::set seen_instructions_; + + // A map of instructions to their relative position in the function. + std::map instruction_order_; + + IRContext* context_; + + Loop* loop_; + + // This is set to true by TraverseUseDef when traversing the instructions + // related to the loop condition and any if conditions should any of those + // instructions be a load. + bool load_used_in_condition_; +}; + +bool LoopFissionImpl::MovableInstruction(const Instruction& inst) const { + return inst.opcode() == SpvOp::SpvOpLoad || + inst.opcode() == SpvOp::SpvOpStore || + inst.opcode() == SpvOp::SpvOpSelectionMerge || + inst.opcode() == SpvOp::SpvOpPhi || inst.IsOpcodeCodeMotionSafe(); +} + +void LoopFissionImpl::TraverseUseDef(Instruction* inst, + std::set* returned_set, + bool ignore_phi_users, bool report_loads) { + assert(returned_set && "Set to be returned cannot be null."); + + analysis::DefUseManager* def_use = context_->get_def_use_mgr(); + std::set& inst_set = *returned_set; + + // We create this functor to traverse the use def chain to build the + // grouping of related instructions. The lambda captures the std::function + // to allow it to recurse. + std::function traverser_functor; + traverser_functor = [this, def_use, &inst_set, &traverser_functor, + ignore_phi_users, report_loads](Instruction* user) { + // If we've seen the instruction before or it is not inside the loop end the + // traversal. + if (!user || seen_instructions_.count(user) != 0 || + !context_->get_instr_block(user) || + !loop_->IsInsideLoop(context_->get_instr_block(user))) { + return; + } + + // Don't include labels or loop merge instructions in the instruction sets. + // Including them would mean we group instructions related only by using the + // same labels (i.e phis). We already preempt the inclusion of + // OpSelectionMerge by adding related instructions to the seen_instructions_ + // set. + if (user->opcode() == SpvOp::SpvOpLoopMerge || + user->opcode() == SpvOp::SpvOpLabel) + return; + + // If the |report_loads| flag is set, set the class field + // load_used_in_condition_ to false. This is used to check that none of the + // condition checks in the loop rely on loads. + if (user->opcode() == SpvOp::SpvOpLoad && report_loads) { + load_used_in_condition_ = true; + } + + // Add the instruction to the set of instructions already seen, this breaks + // recursion and allows us to ignore certain instructions. + seen_instructions_.insert(user); + + inst_set.insert(user); + + // Wrapper functor to traverse the operands of each instruction. + auto traverse_operand = [&traverser_functor, def_use](const uint32_t* id) { + traverser_functor(def_use->GetDef(*id)); + }; + user->ForEachInOperand(traverse_operand); + + // For the first traversal we want to ignore the users of the phi. + if (ignore_phi_users && user->opcode() == SpvOp::SpvOpPhi) return; + + // Traverse each user with this lambda. + def_use->ForEachUser(user, traverser_functor); + + // Wrapper functor for the use traversal. + auto traverse_use = [&traverser_functor](Instruction* use, uint32_t) { + traverser_functor(use); + }; + def_use->ForEachUse(user, traverse_use); + + }; + + // We start the traversal of the use def graph by invoking the above + // lambda with the |inst| parameter. + traverser_functor(inst); +} + +bool LoopFissionImpl::GroupInstructionsByUseDef() { + std::vector> sets{}; + + // We want to ignore all the instructions stemming from the loop condition + // instruction. + BasicBlock* condition_block = loop_->FindConditionBlock(); + + if (!condition_block) return false; + Instruction* condition = &*condition_block->tail(); + + // We iterate over the blocks via iterating over all the blocks in the + // function, we do this so we are iterating in the same order which the blocks + // appear in the binary. + Function& function = *loop_->GetHeaderBlock()->GetParent(); + + // Create a temporary set to ignore certain groups of instructions within the + // loop. We don't want any instructions related to control flow to be removed + // from either loop only instructions within the control flow bodies. + std::set instructions_to_ignore{}; + TraverseUseDef(condition, &instructions_to_ignore, true, true); + + // Traverse control flow instructions to ensure they are added to the + // seen_instructions_ set and will be ignored when it it called with actual + // sets. + for (BasicBlock& block : function) { + if (!loop_->IsInsideLoop(block.id())) continue; + + for (Instruction& inst : block) { + // Ignore all instructions related to control flow. + if (inst.opcode() == SpvOp::SpvOpSelectionMerge || inst.IsBranch()) { + TraverseUseDef(&inst, &instructions_to_ignore, true, true); + } + } + } + + // Traverse the instructions and generate the sets, automatically ignoring any + // instructions in instructions_to_ignore. + for (BasicBlock& block : function) { + if (!loop_->IsInsideLoop(block.id()) || + loop_->GetHeaderBlock()->id() == block.id()) + continue; + + for (Instruction& inst : block) { + // Record the order that each load/store is seen. + if (inst.opcode() == SpvOp::SpvOpLoad || + inst.opcode() == SpvOp::SpvOpStore) { + instruction_order_[&inst] = instruction_order_.size(); + } + + // Ignore instructions already seen in a traversal. + if (seen_instructions_.count(&inst) != 0) { + continue; + } + + // Build the set. + std::set inst_set{}; + TraverseUseDef(&inst, &inst_set); + if (!inst_set.empty()) sets.push_back(std::move(inst_set)); + } + } + + // If we have one or zero sets return false to indicate that due to + // insufficient instructions we couldn't split the loop into two groups and + // thus the loop can't be split any further. + if (sets.size() < 2) { + return false; + } + + // Merge the loop sets into two different sets. In CanPerformSplit we will + // validate that we don't break the relative ordering of loads/stores by doing + // this. + for (size_t index = 0; index < sets.size() / 2; ++index) { + cloned_loop_instructions_.insert(sets[index].begin(), sets[index].end()); + } + for (size_t index = sets.size() / 2; index < sets.size(); ++index) { + original_loop_instructions_.insert(sets[index].begin(), sets[index].end()); + } + + return true; +} + +bool LoopFissionImpl::CanPerformSplit() { + // Return false if any of the condition instructions in the loop depend on a + // load. + if (load_used_in_condition_) { + return false; + } + + // Build a list of all parent loops of this loop. Loop dependence analysis + // needs this structure. + std::vector loops; + Loop* parent_loop = loop_; + while (parent_loop) { + loops.push_back(parent_loop); + parent_loop = parent_loop->GetParent(); + } + + LoopDependenceAnalysis analysis{context_, loops}; + + // A list of all the stores in the cloned loop. + std::vector set_one_stores{}; + + // A list of all the loads in the cloned loop. + std::vector set_one_loads{}; + + // Populate the above lists. + for (Instruction* inst : cloned_loop_instructions_) { + if (inst->opcode() == SpvOp::SpvOpStore) { + set_one_stores.push_back(inst); + } else if (inst->opcode() == SpvOp::SpvOpLoad) { + set_one_loads.push_back(inst); + } + + // If we find any instruction which we can't move (such as a barrier), + // return false. + if (!MovableInstruction(*inst)) return false; + } + + // We need to calculate the depth of the loop to create the loop dependency + // distance vectors. + const size_t loop_depth = loop_->GetDepth(); + + // Check the dependencies between loads in the cloned loop and stores in the + // original and vice versa. + for (Instruction* inst : original_loop_instructions_) { + // If we find any instruction which we can't move (such as a barrier), + // return false. + if (!MovableInstruction(*inst)) return false; + + // Look at the dependency between the loads in the original and stores in + // the cloned loops. + if (inst->opcode() == SpvOp::SpvOpLoad) { + for (Instruction* store : set_one_stores) { + DistanceVector vec{loop_depth}; + + // If the store actually should appear after the load, return false. + // This means the store has been placed in the wrong grouping. + if (instruction_order_[store] > instruction_order_[inst]) { + return false; + } + // If not independent check the distance vector. + if (!analysis.GetDependence(store, inst, &vec)) { + for (DistanceEntry& entry : vec.GetEntries()) { + // A distance greater than zero means that the store in the cloned + // loop has a dependency on the load in the original loop. + if (entry.distance > 0) return false; + } + } + } + } else if (inst->opcode() == SpvOp::SpvOpStore) { + for (Instruction* load : set_one_loads) { + DistanceVector vec{loop_depth}; + + // If the load actually should appear after the store, return false. + if (instruction_order_[load] > instruction_order_[inst]) { + return false; + } + + // If not independent check the distance vector. + if (!analysis.GetDependence(inst, load, &vec)) { + for (DistanceEntry& entry : vec.GetEntries()) { + // A distance less than zero means the load in the cloned loop is + // dependent on the store instruction in the original loop. + if (entry.distance < 0) return false; + } + } + } + } + } + return true; +} + +Loop* LoopFissionImpl::SplitLoop() { + // Clone the loop. + LoopUtils util{context_, loop_}; + LoopUtils::LoopCloningResult clone_results; + Loop* cloned_loop = util.CloneAndAttachLoopToHeader(&clone_results); + + // Update the OpLoopMerge in the cloned loop. + cloned_loop->UpdateLoopMergeInst(); + + // Add the loop_ to the module. + Function::iterator it = + util.GetFunction()->FindBlock(loop_->GetOrCreatePreHeaderBlock()->id()); + util.GetFunction()->AddBasicBlocks(clone_results.cloned_bb_.begin(), + clone_results.cloned_bb_.end(), ++it); + loop_->SetPreHeaderBlock(cloned_loop->GetMergeBlock()); + + std::vector instructions_to_kill{}; + + // Kill all the instructions which should appear in the cloned loop but not in + // the original loop. + for (uint32_t id : loop_->GetBlocks()) { + BasicBlock* block = context_->cfg()->block(id); + + for (Instruction& inst : *block) { + // If the instruction appears in the cloned loop instruction group, kill + // it. + if (cloned_loop_instructions_.count(&inst) == 1 && + original_loop_instructions_.count(&inst) == 0) { + instructions_to_kill.push_back(&inst); + if (inst.opcode() == SpvOp::SpvOpPhi) { + context_->ReplaceAllUsesWith( + inst.result_id(), clone_results.value_map_[inst.result_id()]); + } + } + } + } + + // Kill all instructions which should appear in the original loop and not in + // the cloned loop. + for (uint32_t id : cloned_loop->GetBlocks()) { + BasicBlock* block = context_->cfg()->block(id); + for (Instruction& inst : *block) { + Instruction* old_inst = clone_results.ptr_map_[&inst]; + // If the instruction belongs to the original loop instruction group, kill + // it. + if (cloned_loop_instructions_.count(old_inst) == 0 && + original_loop_instructions_.count(old_inst) == 1) { + instructions_to_kill.push_back(&inst); + } + } + } + + for (Instruction* i : instructions_to_kill) { + context_->KillInst(i); + } + + return cloned_loop; +} + +LoopFissionPass::LoopFissionPass(const size_t register_threshold_to_split, + bool split_multiple_times) + : split_multiple_times_(split_multiple_times) { + // Split if the number of registers in the loop exceeds + // |register_threshold_to_split|. + split_criteria_ = + [register_threshold_to_split]( + const RegisterLiveness::RegionRegisterLiveness& liveness) { + return liveness.used_registers_ > register_threshold_to_split; + }; +} + +LoopFissionPass::LoopFissionPass() : split_multiple_times_(false) { + // Split by default. + split_criteria_ = [](const RegisterLiveness::RegionRegisterLiveness&) { + return true; + }; +} + +bool LoopFissionPass::ShouldSplitLoop(const Loop& loop, IRContext* c) { + LivenessAnalysis* analysis = c->GetLivenessAnalysis(); + + RegisterLiveness::RegionRegisterLiveness liveness{}; + + Function* function = loop.GetHeaderBlock()->GetParent(); + analysis->Get(function)->ComputeLoopRegisterPressure(loop, &liveness); + + return split_criteria_(liveness); +} + +Pass::Status LoopFissionPass::Process() { + bool changed = false; + + for (Function& f : *context()->module()) { + // We collect all the inner most loops in the function and run the loop + // splitting util on each. The reason we do this is to allow us to iterate + // over each, as creating new loops will invalidate the the loop iterator. + std::vector inner_most_loops{}; + LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(&f); + for (Loop& loop : loop_descriptor) { + if (!loop.HasChildren() && ShouldSplitLoop(loop, context())) { + inner_most_loops.push_back(&loop); + } + } + + // List of new loops which meet the criteria to be split again. + std::vector new_loops_to_split{}; + + while (!inner_most_loops.empty()) { + for (Loop* loop : inner_most_loops) { + LoopFissionImpl impl{context(), loop}; + + // Group the instructions in the loop into two different sets of related + // instructions. If we can't group the instructions into the two sets + // then we can't split the loop any further. + if (!impl.GroupInstructionsByUseDef()) { + continue; + } + + if (impl.CanPerformSplit()) { + Loop* second_loop = impl.SplitLoop(); + changed = true; + context()->InvalidateAnalysesExceptFor( + IRContext::kAnalysisLoopAnalysis); + + // If the newly created loop meets the criteria to be split, split it + // again. + if (ShouldSplitLoop(*second_loop, context())) + new_loops_to_split.push_back(second_loop); + + // If the original loop (now split) still meets the criteria to be + // split, split it again. + if (ShouldSplitLoop(*loop, context())) + new_loops_to_split.push_back(loop); + } + } + + // If the split multiple times flag has been set add the new loops which + // meet the splitting criteria into the list of loops to be split on the + // next iteration. + if (split_multiple_times_) { + inner_most_loops = std::move(new_loops_to_split); + } else { + break; + } + } + } + + return changed ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.h new file mode 100644 index 00000000000..e7a59c18586 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fission.h @@ -0,0 +1,78 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_FISSION_H_ +#define SOURCE_OPT_LOOP_FISSION_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/cfg.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_utils.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" +#include "source/opt/tree_iterator.h" + +namespace spvtools { +namespace opt { + +class LoopFissionPass : public Pass { + public: + // Fuction used to determine if a given loop should be split. Takes register + // pressure region for that loop as a parameter and returns true if the loop + // should be split. + using FissionCriteriaFunction = + std::function; + + // Pass built with this constructor will split all loops regardless of + // register pressure. Will not split loops more than once. + LoopFissionPass(); + + // Split the loop if the number of registers used in the loop exceeds + // |register_threshold_to_split|. |split_multiple_times| flag determines + // whether or not the pass should split loops after already splitting them + // once. + LoopFissionPass(size_t register_threshold_to_split, + bool split_multiple_times = true); + + // Split loops whose register pressure meets the criteria of |functor|. + LoopFissionPass(FissionCriteriaFunction functor, + bool split_multiple_times = true) + : split_criteria_(functor), split_multiple_times_(split_multiple_times) {} + + const char* name() const override { return "loop-fission"; } + + Pass::Status Process() override; + + // Checks if |loop| meets the register pressure criteria to be split. + bool ShouldSplitLoop(const Loop& loop, IRContext* context); + + private: + // Functor to run in ShouldSplitLoop to determine if the register pressure + // criteria is met for splitting the loop. + FissionCriteriaFunction split_criteria_; + + // Flag designating whether or not we should also split the result of + // previously split loops if they meet the register presure criteria. + bool split_multiple_times_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_FISSION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp new file mode 100644 index 00000000000..07d171a0afc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.cpp @@ -0,0 +1,730 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_fusion.h" + +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_descriptor.h" + +namespace spvtools { +namespace opt { + +namespace { + +// Append all the loops nested in |loop| to |loops|. +void CollectChildren(Loop* loop, std::vector* loops) { + for (auto child : *loop) { + loops->push_back(child); + if (child->NumImmediateChildren() != 0) { + CollectChildren(child, loops); + } + } +} + +// Return the set of locations accessed by |stores| and |loads|. +std::set GetLocationsAccessed( + const std::map>& stores, + const std::map>& loads) { + std::set locations{}; + + for (const auto& kv : stores) { + locations.insert(std::get<0>(kv)); + } + + for (const auto& kv : loads) { + locations.insert(std::get<0>(kv)); + } + + return locations; +} + +// Append all dependences from |sources| to |destinations| to |dependences|. +void GetDependences(std::vector* dependences, + LoopDependenceAnalysis* analysis, + const std::vector& sources, + const std::vector& destinations, + size_t num_entries) { + for (auto source : sources) { + for (auto destination : destinations) { + DistanceVector dist(num_entries); + if (!analysis->GetDependence(source, destination, &dist)) { + dependences->push_back(dist); + } + } + } +} + +// Apped all instructions in |block| to |instructions|. +void AddInstructionsInBlock(std::vector* instructions, + BasicBlock* block) { + for (auto& inst : *block) { + instructions->push_back(&inst); + } + + instructions->push_back(block->GetLabelInst()); +} + +} // namespace + +bool LoopFusion::UsedInContinueOrConditionBlock(Instruction* phi_instruction, + Loop* loop) { + auto condition_block = loop->FindConditionBlock()->id(); + auto continue_block = loop->GetContinueBlock()->id(); + auto not_used = context_->get_def_use_mgr()->WhileEachUser( + phi_instruction, + [this, condition_block, continue_block](Instruction* instruction) { + auto block_id = context_->get_instr_block(instruction)->id(); + return block_id != condition_block && block_id != continue_block; + }); + + return !not_used; +} + +void LoopFusion::RemoveIfNotUsedContinueOrConditionBlock( + std::vector* instructions, Loop* loop) { + instructions->erase( + std::remove_if(std::begin(*instructions), std::end(*instructions), + [this, loop](Instruction* instruction) { + return !UsedInContinueOrConditionBlock(instruction, + loop); + }), + std::end(*instructions)); +} + +bool LoopFusion::AreCompatible() { + // Check that the loops are in the same function. + if (loop_0_->GetHeaderBlock()->GetParent() != + loop_1_->GetHeaderBlock()->GetParent()) { + return false; + } + + // Check that both loops have pre-header blocks. + if (!loop_0_->GetPreHeaderBlock() || !loop_1_->GetPreHeaderBlock()) { + return false; + } + + // Check there are no breaks. + if (context_->cfg()->preds(loop_0_->GetMergeBlock()->id()).size() != 1 || + context_->cfg()->preds(loop_1_->GetMergeBlock()->id()).size() != 1) { + return false; + } + + // Check there are no continues. + if (context_->cfg()->preds(loop_0_->GetContinueBlock()->id()).size() != 1 || + context_->cfg()->preds(loop_1_->GetContinueBlock()->id()).size() != 1) { + return false; + } + + // |GetInductionVariables| returns all OpPhi in the header. Check that both + // loops have exactly one that is used in the continue and condition blocks. + std::vector inductions_0{}, inductions_1{}; + loop_0_->GetInductionVariables(inductions_0); + RemoveIfNotUsedContinueOrConditionBlock(&inductions_0, loop_0_); + + if (inductions_0.size() != 1) { + return false; + } + + induction_0_ = inductions_0.front(); + + loop_1_->GetInductionVariables(inductions_1); + RemoveIfNotUsedContinueOrConditionBlock(&inductions_1, loop_1_); + + if (inductions_1.size() != 1) { + return false; + } + + induction_1_ = inductions_1.front(); + + if (!CheckInit()) { + return false; + } + + if (!CheckCondition()) { + return false; + } + + if (!CheckStep()) { + return false; + } + + // Check adjacency, |loop_0_| should come just before |loop_1_|. + // There is always at least one block between loops, even if it's empty. + // We'll check at most 2 preceeding blocks. + + auto pre_header_1 = loop_1_->GetPreHeaderBlock(); + + std::vector block_to_check{}; + block_to_check.push_back(pre_header_1); + + if (loop_0_->GetMergeBlock() != loop_1_->GetPreHeaderBlock()) { + // Follow CFG for one more block. + auto preds = context_->cfg()->preds(pre_header_1->id()); + if (preds.size() == 1) { + auto block = &*containing_function_->FindBlock(preds.front()); + if (block == loop_0_->GetMergeBlock()) { + block_to_check.push_back(block); + } else { + return false; + } + } else { + return false; + } + } + + // Check that the separating blocks are either empty or only contains a store + // to a local variable that is never read (left behind by + // '--eliminate-local-multi-store'). Also allow OpPhi, since the loop could be + // in LCSSA form. + for (auto block : block_to_check) { + for (auto& inst : *block) { + if (inst.opcode() == SpvOpStore) { + // Get the definition of the target to check it's function scope so + // there are no observable side effects. + auto variable = + context_->get_def_use_mgr()->GetDef(inst.GetSingleWordInOperand(0)); + + if (variable->opcode() != SpvOpVariable || + variable->GetSingleWordInOperand(0) != SpvStorageClassFunction) { + return false; + } + + // Check the target is never loaded. + auto is_used = false; + context_->get_def_use_mgr()->ForEachUse( + inst.GetSingleWordInOperand(0), + [&is_used](Instruction* use_inst, uint32_t) { + if (use_inst->opcode() == SpvOpLoad) { + is_used = true; + } + }); + + if (is_used) { + return false; + } + } else if (inst.opcode() == SpvOpPhi) { + if (inst.NumInOperands() != 2) { + return false; + } + } else if (inst.opcode() != SpvOpBranch) { + return false; + } + } + } + + return true; +} // namespace opt + +bool LoopFusion::ContainsBarriersOrFunctionCalls(Loop* loop) { + for (const auto& block : loop->GetBlocks()) { + for (const auto& inst : *containing_function_->FindBlock(block)) { + auto opcode = inst.opcode(); + if (opcode == SpvOpFunctionCall || opcode == SpvOpControlBarrier || + opcode == SpvOpMemoryBarrier || opcode == SpvOpTypeNamedBarrier || + opcode == SpvOpNamedBarrierInitialize || + opcode == SpvOpMemoryNamedBarrier) { + return true; + } + } + } + + return false; +} + +bool LoopFusion::CheckInit() { + int64_t loop_0_init; + if (!loop_0_->GetInductionInitValue(induction_0_, &loop_0_init)) { + return false; + } + + int64_t loop_1_init; + if (!loop_1_->GetInductionInitValue(induction_1_, &loop_1_init)) { + return false; + } + + if (loop_0_init != loop_1_init) { + return false; + } + + return true; +} + +bool LoopFusion::CheckCondition() { + auto condition_0 = loop_0_->GetConditionInst(); + auto condition_1 = loop_1_->GetConditionInst(); + + if (!loop_0_->IsSupportedCondition(condition_0->opcode()) || + !loop_1_->IsSupportedCondition(condition_1->opcode())) { + return false; + } + + if (condition_0->opcode() != condition_1->opcode()) { + return false; + } + + for (uint32_t i = 0; i < condition_0->NumInOperandWords(); ++i) { + auto arg_0 = context_->get_def_use_mgr()->GetDef( + condition_0->GetSingleWordInOperand(i)); + auto arg_1 = context_->get_def_use_mgr()->GetDef( + condition_1->GetSingleWordInOperand(i)); + + if (arg_0 == induction_0_ && arg_1 == induction_1_) { + continue; + } + + if (arg_0 == induction_0_ && arg_1 != induction_1_) { + return false; + } + + if (arg_1 == induction_1_ && arg_0 != induction_0_) { + return false; + } + + if (arg_0 != arg_1) { + return false; + } + } + + return true; +} + +bool LoopFusion::CheckStep() { + auto scalar_analysis = context_->GetScalarEvolutionAnalysis(); + SENode* induction_node_0 = scalar_analysis->SimplifyExpression( + scalar_analysis->AnalyzeInstruction(induction_0_)); + if (!induction_node_0->AsSERecurrentNode()) { + return false; + } + + SENode* induction_step_0 = + induction_node_0->AsSERecurrentNode()->GetCoefficient(); + if (!induction_step_0->AsSEConstantNode()) { + return false; + } + + SENode* induction_node_1 = scalar_analysis->SimplifyExpression( + scalar_analysis->AnalyzeInstruction(induction_1_)); + if (!induction_node_1->AsSERecurrentNode()) { + return false; + } + + SENode* induction_step_1 = + induction_node_1->AsSERecurrentNode()->GetCoefficient(); + if (!induction_step_1->AsSEConstantNode()) { + return false; + } + + if (*induction_step_0 != *induction_step_1) { + return false; + } + + return true; +} + +std::map> LoopFusion::LocationToMemOps( + const std::vector& mem_ops) { + std::map> location_map{}; + + for (auto instruction : mem_ops) { + auto access_location = context_->get_def_use_mgr()->GetDef( + instruction->GetSingleWordInOperand(0)); + + while (access_location->opcode() == SpvOpAccessChain) { + access_location = context_->get_def_use_mgr()->GetDef( + access_location->GetSingleWordInOperand(0)); + } + + location_map[access_location].push_back(instruction); + } + + return location_map; +} + +std::pair, std::vector> +LoopFusion::GetLoadsAndStoresInLoop(Loop* loop) { + std::vector loads{}; + std::vector stores{}; + + for (auto block_id : loop->GetBlocks()) { + if (block_id == loop->GetContinueBlock()->id()) { + continue; + } + + for (auto& instruction : *containing_function_->FindBlock(block_id)) { + if (instruction.opcode() == SpvOpLoad) { + loads.push_back(&instruction); + } else if (instruction.opcode() == SpvOpStore) { + stores.push_back(&instruction); + } + } + } + + return std::make_pair(loads, stores); +} + +bool LoopFusion::IsUsedInLoop(Instruction* instruction, Loop* loop) { + auto not_used = context_->get_def_use_mgr()->WhileEachUser( + instruction, [this, loop](Instruction* user) { + auto block_id = context_->get_instr_block(user)->id(); + return !loop->IsInsideLoop(block_id); + }); + + return !not_used; +} + +bool LoopFusion::IsLegal() { + assert(AreCompatible() && "Fusion can't be legal, loops are not compatible."); + + // Bail out if there are function calls as they could have side-effects that + // cause dependencies or if there are any barriers. + if (ContainsBarriersOrFunctionCalls(loop_0_) || + ContainsBarriersOrFunctionCalls(loop_1_)) { + return false; + } + + std::vector phi_instructions{}; + loop_0_->GetInductionVariables(phi_instructions); + + // Check no OpPhi in |loop_0_| is used in |loop_1_|. + for (auto phi_instruction : phi_instructions) { + if (IsUsedInLoop(phi_instruction, loop_1_)) { + return false; + } + } + + // Check no LCSSA OpPhi in merge block of |loop_0_| is used in |loop_1_|. + auto phi_used = false; + loop_0_->GetMergeBlock()->ForEachPhiInst( + [this, &phi_used](Instruction* phi_instruction) { + phi_used |= IsUsedInLoop(phi_instruction, loop_1_); + }); + + if (phi_used) { + return false; + } + + // Grab loads & stores from both loops. + auto loads_stores_0 = GetLoadsAndStoresInLoop(loop_0_); + auto loads_stores_1 = GetLoadsAndStoresInLoop(loop_1_); + + // Build memory location to operation maps. + auto load_locs_0 = LocationToMemOps(std::get<0>(loads_stores_0)); + auto store_locs_0 = LocationToMemOps(std::get<1>(loads_stores_0)); + + auto load_locs_1 = LocationToMemOps(std::get<0>(loads_stores_1)); + auto store_locs_1 = LocationToMemOps(std::get<1>(loads_stores_1)); + + // Get the locations accessed in both loops. + auto locations_0 = GetLocationsAccessed(store_locs_0, load_locs_0); + auto locations_1 = GetLocationsAccessed(store_locs_1, load_locs_1); + + std::vector potential_clashes{}; + + std::set_intersection(std::begin(locations_0), std::end(locations_0), + std::begin(locations_1), std::end(locations_1), + std::back_inserter(potential_clashes)); + + // If the loops don't access the same variables, the fusion is legal. + if (potential_clashes.empty()) { + return true; + } + + // Find variables that have at least one store. + std::vector potential_clashes_with_stores{}; + for (auto location : potential_clashes) { + if (store_locs_0.find(location) != std::end(store_locs_0) || + store_locs_1.find(location) != std::end(store_locs_1)) { + potential_clashes_with_stores.push_back(location); + } + } + + // If there are only loads to the same variables, the fusion is legal. + if (potential_clashes_with_stores.empty()) { + return true; + } + + // Else if loads and at least one store (across loops) to the same variable + // there is a potential dependence and we need to check the dependence + // distance. + + // Find all the loops in this loop nest for the dependency analysis. + std::vector loops{}; + + // Find the parents. + for (auto current_loop = loop_0_; current_loop != nullptr; + current_loop = current_loop->GetParent()) { + loops.push_back(current_loop); + } + + auto this_loop_position = loops.size() - 1; + std::reverse(std::begin(loops), std::end(loops)); + + // Find the children. + CollectChildren(loop_0_, &loops); + CollectChildren(loop_1_, &loops); + + // Check that any dependes created are legal. That means the fused loops do + // not have any dependencies with dependence distance greater than 0 that did + // not exist in the original loops. + + LoopDependenceAnalysis analysis(context_, loops); + + analysis.GetScalarEvolution()->AddLoopsToPretendAreTheSame( + {loop_0_, loop_1_}); + + for (auto location : potential_clashes_with_stores) { + // Analyse dependences from |loop_0_| to |loop_1_|. + std::vector dependences; + // Read-After-Write. + GetDependences(&dependences, &analysis, store_locs_0[location], + load_locs_1[location], loops.size()); + // Write-After-Read. + GetDependences(&dependences, &analysis, load_locs_0[location], + store_locs_1[location], loops.size()); + // Write-After-Write. + GetDependences(&dependences, &analysis, store_locs_0[location], + store_locs_1[location], loops.size()); + + // Check that the induction variables either don't appear in the subscripts + // or the dependence distance is negative. + for (const auto& dependence : dependences) { + const auto& entry = dependence.GetEntries()[this_loop_position]; + if ((entry.dependence_information == + DistanceEntry::DependenceInformation::DISTANCE && + entry.distance < 1) || + (entry.dependence_information == + DistanceEntry::DependenceInformation::IRRELEVANT)) { + continue; + } else { + return false; + } + } + } + + return true; +} + +void ReplacePhiParentWith(Instruction* inst, uint32_t orig_block, + uint32_t new_block) { + if (inst->GetSingleWordInOperand(1) == orig_block) { + inst->SetInOperand(1, {new_block}); + } else { + inst->SetInOperand(3, {new_block}); + } +} + +void LoopFusion::Fuse() { + assert(AreCompatible() && "Can't fuse, loops aren't compatible"); + assert(IsLegal() && "Can't fuse, illegal"); + + // Save the pointers/ids, won't be found in the middle of doing modifications. + auto header_1 = loop_1_->GetHeaderBlock()->id(); + auto condition_1 = loop_1_->FindConditionBlock()->id(); + auto continue_1 = loop_1_->GetContinueBlock()->id(); + auto continue_0 = loop_0_->GetContinueBlock()->id(); + auto condition_block_of_0 = loop_0_->FindConditionBlock(); + + // Find the blocks whose branches need updating. + auto first_block_of_1 = &*(++containing_function_->FindBlock(condition_1)); + auto last_block_of_1 = &*(--containing_function_->FindBlock(continue_1)); + auto last_block_of_0 = &*(--containing_function_->FindBlock(continue_0)); + + // Update the branch for |last_block_of_loop_0| to go to |first_block_of_1|. + last_block_of_0->ForEachSuccessorLabel( + [first_block_of_1](uint32_t* succ) { *succ = first_block_of_1->id(); }); + + // Update the branch for the |last_block_of_loop_1| to go to the continue + // block of |loop_0_|. + last_block_of_1->ForEachSuccessorLabel( + [this](uint32_t* succ) { *succ = loop_0_->GetContinueBlock()->id(); }); + + // Update merge block id in the header of |loop_0_| to the merge block of + // |loop_1_|. + loop_0_->GetHeaderBlock()->ForEachInst([this](Instruction* inst) { + if (inst->opcode() == SpvOpLoopMerge) { + inst->SetInOperand(0, {loop_1_->GetMergeBlock()->id()}); + } + }); + + // Update condition branch target in |loop_0_| to the merge block of + // |loop_1_|. + condition_block_of_0->ForEachInst([this](Instruction* inst) { + if (inst->opcode() == SpvOpBranchConditional) { + auto loop_0_merge_block_id = loop_0_->GetMergeBlock()->id(); + + if (inst->GetSingleWordInOperand(1) == loop_0_merge_block_id) { + inst->SetInOperand(1, {loop_1_->GetMergeBlock()->id()}); + } else { + inst->SetInOperand(2, {loop_1_->GetMergeBlock()->id()}); + } + } + }); + + // Move OpPhi instructions not corresponding to the induction variable from + // the header of |loop_1_| to the header of |loop_0_|. + std::vector instructions_to_move{}; + for (auto& instruction : *loop_1_->GetHeaderBlock()) { + if (instruction.opcode() == SpvOpPhi && &instruction != induction_1_) { + instructions_to_move.push_back(&instruction); + } + } + + for (auto& it : instructions_to_move) { + it->RemoveFromList(); + it->InsertBefore(induction_0_); + } + + // Update the OpPhi parents to the correct blocks in |loop_0_|. + loop_0_->GetHeaderBlock()->ForEachPhiInst([this](Instruction* i) { + ReplacePhiParentWith(i, loop_1_->GetPreHeaderBlock()->id(), + loop_0_->GetPreHeaderBlock()->id()); + + ReplacePhiParentWith(i, loop_1_->GetContinueBlock()->id(), + loop_0_->GetContinueBlock()->id()); + }); + + // Update instruction to block mapping & DefUseManager. + for (auto& phi_instruction : instructions_to_move) { + context_->set_instr_block(phi_instruction, loop_0_->GetHeaderBlock()); + context_->get_def_use_mgr()->AnalyzeInstUse(phi_instruction); + } + + // Replace the uses of the induction variable of |loop_1_| with that the + // induction variable of |loop_0_|. + context_->ReplaceAllUsesWith(induction_1_->result_id(), + induction_0_->result_id()); + + // Replace LCSSA OpPhi in merge block of |loop_0_|. + loop_0_->GetMergeBlock()->ForEachPhiInst([this](Instruction* instruction) { + context_->ReplaceAllUsesWith(instruction->result_id(), + instruction->GetSingleWordInOperand(0)); + }); + + // Update LCSSA OpPhi in merge block of |loop_1_|. + loop_1_->GetMergeBlock()->ForEachPhiInst( + [condition_block_of_0](Instruction* instruction) { + instruction->SetInOperand(1, {condition_block_of_0->id()}); + }); + + // Move the continue block of |loop_0_| after the last block of |loop_1_|. + containing_function_->MoveBasicBlockToAfter(continue_0, last_block_of_1); + + // Gather all instructions to be killed from |loop_1_| (induction variable + // initialisation, header, condition and continue blocks). + std::vector instr_to_delete{}; + AddInstructionsInBlock(&instr_to_delete, loop_1_->GetPreHeaderBlock()); + AddInstructionsInBlock(&instr_to_delete, loop_1_->GetHeaderBlock()); + AddInstructionsInBlock(&instr_to_delete, loop_1_->FindConditionBlock()); + AddInstructionsInBlock(&instr_to_delete, loop_1_->GetContinueBlock()); + + // There was an additional empty block between the loops, kill that too. + if (loop_0_->GetMergeBlock() != loop_1_->GetPreHeaderBlock()) { + AddInstructionsInBlock(&instr_to_delete, loop_0_->GetMergeBlock()); + } + + // Update the CFG, so it wouldn't need invalidating. + auto cfg = context_->cfg(); + + cfg->ForgetBlock(loop_1_->GetPreHeaderBlock()); + cfg->ForgetBlock(loop_1_->GetHeaderBlock()); + cfg->ForgetBlock(loop_1_->FindConditionBlock()); + cfg->ForgetBlock(loop_1_->GetContinueBlock()); + + if (loop_0_->GetMergeBlock() != loop_1_->GetPreHeaderBlock()) { + cfg->ForgetBlock(loop_0_->GetMergeBlock()); + } + + cfg->RemoveEdge(last_block_of_0->id(), loop_0_->GetContinueBlock()->id()); + cfg->AddEdge(last_block_of_0->id(), first_block_of_1->id()); + + cfg->AddEdge(last_block_of_1->id(), loop_0_->GetContinueBlock()->id()); + + cfg->AddEdge(loop_0_->GetContinueBlock()->id(), + loop_1_->GetHeaderBlock()->id()); + + cfg->AddEdge(condition_block_of_0->id(), loop_1_->GetMergeBlock()->id()); + + // Update DefUseManager. + auto def_use_mgr = context_->get_def_use_mgr(); + + // Uses of labels that are in updated branches need analysing. + def_use_mgr->AnalyzeInstUse(last_block_of_0->terminator()); + def_use_mgr->AnalyzeInstUse(last_block_of_1->terminator()); + def_use_mgr->AnalyzeInstUse(loop_0_->GetHeaderBlock()->GetLoopMergeInst()); + def_use_mgr->AnalyzeInstUse(condition_block_of_0->terminator()); + + // Update the LoopDescriptor, so it wouldn't need invalidating. + auto ld = context_->GetLoopDescriptor(containing_function_); + + // Create a copy, so the iterator wouldn't be invalidated. + std::vector loops_to_add_remove{}; + for (auto child_loop : *loop_1_) { + loops_to_add_remove.push_back(child_loop); + } + + for (auto child_loop : loops_to_add_remove) { + loop_1_->RemoveChildLoop(child_loop); + loop_0_->AddNestedLoop(child_loop); + } + + auto loop_1_blocks = loop_1_->GetBlocks(); + + for (auto block : loop_1_blocks) { + loop_1_->RemoveBasicBlock(block); + if (block != header_1 && block != condition_1 && block != continue_1) { + loop_0_->AddBasicBlock(block); + if ((*ld)[block] == loop_1_) { + ld->SetBasicBlockToLoop(block, loop_0_); + } + } + + if ((*ld)[block] == loop_1_) { + ld->ForgetBasicBlock(block); + } + } + + loop_1_->RemoveBasicBlock(loop_1_->GetPreHeaderBlock()->id()); + ld->ForgetBasicBlock(loop_1_->GetPreHeaderBlock()->id()); + + if (loop_0_->GetMergeBlock() != loop_1_->GetPreHeaderBlock()) { + loop_0_->RemoveBasicBlock(loop_0_->GetMergeBlock()->id()); + ld->ForgetBasicBlock(loop_0_->GetMergeBlock()->id()); + } + + loop_0_->SetMergeBlock(loop_1_->GetMergeBlock()); + + loop_1_->ClearBlocks(); + + ld->RemoveLoop(loop_1_); + + // Kill unnessecary instructions and remove all empty blocks. + for (auto inst : instr_to_delete) { + context_->KillInst(inst); + } + + containing_function_->RemoveEmptyBlocks(); + + // Invalidate analyses. + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisInstrToBlockMapping | + IRContext::Analysis::kAnalysisLoopAnalysis | + IRContext::Analysis::kAnalysisDefUse | IRContext::Analysis::kAnalysisCFG); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.h new file mode 100644 index 00000000000..d61d6783c86 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion.h @@ -0,0 +1,114 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_FUSION_H_ +#define SOURCE_OPT_LOOP_FUSION_H_ + +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" +#include "source/opt/scalar_analysis.h" + +namespace spvtools { +namespace opt { + +class LoopFusion { + public: + LoopFusion(IRContext* context, Loop* loop_0, Loop* loop_1) + : context_(context), + loop_0_(loop_0), + loop_1_(loop_1), + containing_function_(loop_0->GetHeaderBlock()->GetParent()) {} + + // Checks if the |loop_0| and |loop_1| are compatible for fusion. + // That means: + // * they both have one induction variable + // * they have the same upper and lower bounds + // - same inital value + // - same condition + // * they have the same update step + // * they are adjacent, with |loop_0| appearing before |loop_1| + // * there are no break/continue in either of them + // * they both have pre-header blocks (required for ScalarEvolutionAnalysis + // and dependence checking). + bool AreCompatible(); + + // Checks if compatible |loop_0| and |loop_1| are legal to fuse. + // * fused loops do not have any dependencies with dependence distance greater + // than 0 that did not exist in the original loops. + // * there are no function calls in the loops (could have side-effects) + bool IsLegal(); + + // Perform the actual fusion of |loop_0_| and |loop_1_|. The loops have to be + // compatible and the fusion has to be legal. + void Fuse(); + + private: + // Check that the initial values are the same. + bool CheckInit(); + + // Check that the conditions are the same. + bool CheckCondition(); + + // Check that the steps are the same. + bool CheckStep(); + + // Returns |true| if |instruction| is used in the continue or condition block + // of |loop|. + bool UsedInContinueOrConditionBlock(Instruction* instruction, Loop* loop); + + // Remove entries in |instructions| that are not used in the continue or + // condition block of |loop|. + void RemoveIfNotUsedContinueOrConditionBlock( + std::vector* instructions, Loop* loop); + + // Returns |true| if |instruction| is used in |loop|. + bool IsUsedInLoop(Instruction* instruction, Loop* loop); + + // Returns |true| if |loop| has at least one barrier or function call. + bool ContainsBarriersOrFunctionCalls(Loop* loop); + + // Get all instructions in the |loop| (except in the latch block) that have + // the opcode |opcode|. + std::pair, std::vector> + GetLoadsAndStoresInLoop(Loop* loop); + + // Given a vector of memory operations (OpLoad/OpStore), constructs a map from + // variables to the loads/stores that those variables. + std::map> LocationToMemOps( + const std::vector& mem_ops); + + IRContext* context_; + + // The original loops to be fused. + Loop* loop_0_; + Loop* loop_1_; + + // The function that contains |loop_0_| and |loop_1_|. + Function* containing_function_ = nullptr; + + // The induction variables for |loop_0_| and |loop_1_|. + Instruction* induction_0_ = nullptr; + Instruction* induction_1_ = nullptr; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_FUSION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp new file mode 100644 index 00000000000..bd8444ae566 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.cpp @@ -0,0 +1,69 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_fusion_pass.h" + +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "source/opt/register_pressure.h" + +namespace spvtools { +namespace opt { + +Pass::Status LoopFusionPass::Process() { + bool modified = false; + Module* module = context()->module(); + + // Process each function in the module + for (Function& f : *module) { + modified |= ProcessFunction(&f); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool LoopFusionPass::ProcessFunction(Function* function) { + LoopDescriptor& ld = *context()->GetLoopDescriptor(function); + + // If a loop doesn't have a preheader needs then it needs to be created. Make + // sure to return Status::SuccessWithChange in that case. + auto modified = ld.CreatePreHeaderBlocksIfMissing(); + + // TODO(tremmelg): Could the only loop that |loop| could possibly be fused be + // picked out so don't have to check every loop + for (auto& loop_0 : ld) { + for (auto& loop_1 : ld) { + LoopFusion fusion(context(), &loop_0, &loop_1); + + if (fusion.AreCompatible() && fusion.IsLegal()) { + RegisterLiveness liveness(context(), function); + RegisterLiveness::RegionRegisterLiveness reg_pressure{}; + liveness.SimulateFusion(loop_0, loop_1, ®_pressure); + + if (reg_pressure.used_registers_ <= max_registers_per_loop_) { + fusion.Fuse(); + // Recurse, as the current iterators will have been invalidated. + ProcessFunction(function); + return true; + } + } + } + } + + return modified; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.h new file mode 100644 index 00000000000..3a0be60004d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_fusion_pass.h @@ -0,0 +1,51 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_FUSION_PASS_H_ +#define SOURCE_OPT_LOOP_FUSION_PASS_H_ + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// Implements a loop fusion pass. +// This pass will look for adjacent loops that are compatible and legal to be +// fused. It will fuse all such loops as long as the register usage for the +// fused loop stays under the threshold defined by |max_registers_per_loop|. +class LoopFusionPass : public Pass { + public: + explicit LoopFusionPass(size_t max_registers_per_loop) + : Pass(), max_registers_per_loop_(max_registers_per_loop) {} + + const char* name() const override { return "loop-fusion"; } + + // Processes the given |module|. Returns Status::Failure if errors occur when + // processing. Returns the corresponding Status::Success if processing is + // succesful to indicate whether changes have been made to the modue. + Status Process() override; + + private: + // Fuse loops in |function| if compatible, legal and the fused loop won't use + // too many registers. + bool ProcessFunction(Function* function); + + // The maximum number of registers a fused loop is allowed to use. + size_t max_registers_per_loop_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_FUSION_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp new file mode 100644 index 00000000000..7d27480ae23 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.cpp @@ -0,0 +1,1083 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_peeling.h" +#include "source/opt/loop_utils.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/scalar_analysis_nodes.h" + +namespace spvtools { +namespace opt { +size_t LoopPeelingPass::code_grow_threshold_ = 1000; + +void LoopPeeling::DuplicateAndConnectLoop( + LoopUtils::LoopCloningResult* clone_results) { + CFG& cfg = *context_->cfg(); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + assert(CanPeelLoop() && "Cannot peel loop!"); + + std::vector ordered_loop_blocks; + BasicBlock* pre_header = loop_->GetOrCreatePreHeaderBlock(); + + loop_->ComputeLoopStructuredOrder(&ordered_loop_blocks); + + cloned_loop_ = loop_utils_.CloneLoop(clone_results, ordered_loop_blocks); + + // Add the basic block to the function. + Function::iterator it = + loop_utils_.GetFunction()->FindBlock(pre_header->id()); + assert(it != loop_utils_.GetFunction()->end() && + "Pre-header not found in the function."); + loop_utils_.GetFunction()->AddBasicBlocks( + clone_results->cloned_bb_.begin(), clone_results->cloned_bb_.end(), ++it); + + // Make the |loop_|'s preheader the |cloned_loop_| one. + BasicBlock* cloned_header = cloned_loop_->GetHeaderBlock(); + pre_header->ForEachSuccessorLabel( + [cloned_header](uint32_t* succ) { *succ = cloned_header->id(); }); + + // Update cfg. + cfg.RemoveEdge(pre_header->id(), loop_->GetHeaderBlock()->id()); + cloned_loop_->SetPreHeaderBlock(pre_header); + loop_->SetPreHeaderBlock(nullptr); + + // When cloning the loop, we didn't cloned the merge block, so currently + // |cloned_loop_| shares the same block as |loop_|. + // We mutate all branches from |cloned_loop_| block to |loop_|'s merge into a + // branch to |loop_|'s header (so header will also be the merge of + // |cloned_loop_|). + uint32_t cloned_loop_exit = 0; + for (uint32_t pred_id : cfg.preds(loop_->GetMergeBlock()->id())) { + if (loop_->IsInsideLoop(pred_id)) continue; + BasicBlock* bb = cfg.block(pred_id); + assert(cloned_loop_exit == 0 && "The loop has multiple exits."); + cloned_loop_exit = bb->id(); + bb->ForEachSuccessorLabel([this](uint32_t* succ) { + if (*succ == loop_->GetMergeBlock()->id()) + *succ = loop_->GetHeaderBlock()->id(); + }); + } + + // Update cfg. + cfg.RemoveNonExistingEdges(loop_->GetMergeBlock()->id()); + cfg.AddEdge(cloned_loop_exit, loop_->GetHeaderBlock()->id()); + + // Patch the phi of the original loop header: + // - Set the loop entry branch to come from the cloned loop exit block; + // - Set the initial value of the phi using the corresponding cloned loop + // exit values. + // + // We patch the iterating value initializers of the original loop using the + // corresponding cloned loop exit values. Connects the cloned loop iterating + // values to the original loop. This make sure that the initial value of the + // second loop starts with the last value of the first loop. + // + // For example, loops like: + // + // int z = 0; + // for (int i = 0; i++ < M; i += cst1) { + // if (cond) + // z += cst2; + // } + // + // Will become: + // + // int z = 0; + // int i = 0; + // for (; i++ < M; i += cst1) { + // if (cond) + // z += cst2; + // } + // for (; i++ < M; i += cst1) { + // if (cond) + // z += cst2; + // } + loop_->GetHeaderBlock()->ForEachPhiInst([cloned_loop_exit, def_use_mgr, + clone_results, + this](Instruction* phi) { + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + if (!loop_->IsInsideLoop(phi->GetSingleWordInOperand(i + 1))) { + phi->SetInOperand(i, + {clone_results->value_map_.at( + exit_value_.at(phi->result_id())->result_id())}); + phi->SetInOperand(i + 1, {cloned_loop_exit}); + def_use_mgr->AnalyzeInstUse(phi); + return; + } + } + }); + + // Force the creation of a new preheader for the original loop and set it as + // the merge block for the cloned loop. + cloned_loop_->SetMergeBlock(loop_->GetOrCreatePreHeaderBlock()); +} + +void LoopPeeling::InsertCanonicalInductionVariable( + LoopUtils::LoopCloningResult* clone_results) { + if (original_loop_canonical_induction_variable_) { + canonical_induction_variable_ = + context_->get_def_use_mgr()->GetDef(clone_results->value_map_.at( + original_loop_canonical_induction_variable_->result_id())); + return; + } + + BasicBlock::iterator insert_point = GetClonedLoop()->GetLatchBlock()->tail(); + if (GetClonedLoop()->GetLatchBlock()->GetMergeInst()) { + --insert_point; + } + InstructionBuilder builder( + context_, &*insert_point, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + Instruction* uint_1_cst = + builder.Add32BitConstantInteger(1, int_type_->IsSigned()); + // Create the increment. + // Note that we do "1 + 1" here, one of the operand should the phi + // value but we don't have it yet. The operand will be set latter. + Instruction* iv_inc = builder.AddIAdd( + uint_1_cst->type_id(), uint_1_cst->result_id(), uint_1_cst->result_id()); + + builder.SetInsertPoint(&*GetClonedLoop()->GetHeaderBlock()->begin()); + + canonical_induction_variable_ = builder.AddPhi( + uint_1_cst->type_id(), + {builder.Add32BitConstantInteger(0, int_type_->IsSigned()) + ->result_id(), + GetClonedLoop()->GetPreHeaderBlock()->id(), iv_inc->result_id(), + GetClonedLoop()->GetLatchBlock()->id()}); + // Connect everything. + iv_inc->SetInOperand(0, {canonical_induction_variable_->result_id()}); + + // Update def/use manager. + context_->get_def_use_mgr()->AnalyzeInstUse(iv_inc); + + // If do-while form, use the incremented value. + if (do_while_form_) { + canonical_induction_variable_ = iv_inc; + } +} + +void LoopPeeling::GetIteratorUpdateOperations( + const Loop* loop, Instruction* iterator, + std::unordered_set* operations) { + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + operations->insert(iterator); + iterator->ForEachInId([def_use_mgr, loop, operations, this](uint32_t* id) { + Instruction* insn = def_use_mgr->GetDef(*id); + if (insn->opcode() == SpvOpLabel) { + return; + } + if (operations->count(insn)) { + return; + } + if (!loop->IsInsideLoop(insn)) { + return; + } + GetIteratorUpdateOperations(loop, insn, operations); + }); +} + +// Gather the set of blocks for all the path from |entry| to |root|. +static void GetBlocksInPath(uint32_t block, uint32_t entry, + std::unordered_set* blocks_in_path, + const CFG& cfg) { + for (uint32_t pid : cfg.preds(block)) { + if (blocks_in_path->insert(pid).second) { + if (pid != entry) { + GetBlocksInPath(pid, entry, blocks_in_path, cfg); + } + } + } +} + +bool LoopPeeling::IsConditionCheckSideEffectFree() const { + CFG& cfg = *context_->cfg(); + + // The "do-while" form does not cause issues, the algorithm takes into account + // the first iteration. + if (!do_while_form_) { + uint32_t condition_block_id = cfg.preds(loop_->GetMergeBlock()->id())[0]; + + std::unordered_set blocks_in_path; + + blocks_in_path.insert(condition_block_id); + GetBlocksInPath(condition_block_id, loop_->GetHeaderBlock()->id(), + &blocks_in_path, cfg); + + for (uint32_t bb_id : blocks_in_path) { + BasicBlock* bb = cfg.block(bb_id); + if (!bb->WhileEachInst([this](Instruction* insn) { + if (insn->IsBranch()) return true; + switch (insn->opcode()) { + case SpvOpLabel: + case SpvOpSelectionMerge: + case SpvOpLoopMerge: + return true; + default: + break; + } + return context_->IsCombinatorInstruction(insn); + })) { + return false; + } + } + } + + return true; +} + +void LoopPeeling::GetIteratingExitValues() { + CFG& cfg = *context_->cfg(); + + loop_->GetHeaderBlock()->ForEachPhiInst( + [this](Instruction* phi) { exit_value_[phi->result_id()] = nullptr; }); + + if (!loop_->GetMergeBlock()) { + return; + } + if (cfg.preds(loop_->GetMergeBlock()->id()).size() != 1) { + return; + } + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + uint32_t condition_block_id = cfg.preds(loop_->GetMergeBlock()->id())[0]; + + auto& header_pred = cfg.preds(loop_->GetHeaderBlock()->id()); + do_while_form_ = std::find(header_pred.begin(), header_pred.end(), + condition_block_id) != header_pred.end(); + if (do_while_form_) { + loop_->GetHeaderBlock()->ForEachPhiInst( + [condition_block_id, def_use_mgr, this](Instruction* phi) { + std::unordered_set operations; + + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + if (condition_block_id == phi->GetSingleWordInOperand(i + 1)) { + exit_value_[phi->result_id()] = + def_use_mgr->GetDef(phi->GetSingleWordInOperand(i)); + } + } + }); + } else { + DominatorTree* dom_tree = + &context_->GetDominatorAnalysis(loop_utils_.GetFunction()) + ->GetDomTree(); + BasicBlock* condition_block = cfg.block(condition_block_id); + + loop_->GetHeaderBlock()->ForEachPhiInst( + [dom_tree, condition_block, this](Instruction* phi) { + std::unordered_set operations; + + // Not the back-edge value, check if the phi instruction is the only + // possible candidate. + GetIteratorUpdateOperations(loop_, phi, &operations); + + for (Instruction* insn : operations) { + if (insn == phi) { + continue; + } + if (dom_tree->Dominates(context_->get_instr_block(insn), + condition_block)) { + return; + } + } + exit_value_[phi->result_id()] = phi; + }); + } +} + +void LoopPeeling::FixExitCondition( + const std::function& condition_builder) { + CFG& cfg = *context_->cfg(); + + uint32_t condition_block_id = 0; + for (uint32_t id : cfg.preds(GetClonedLoop()->GetMergeBlock()->id())) { + if (GetClonedLoop()->IsInsideLoop(id)) { + condition_block_id = id; + break; + } + } + assert(condition_block_id != 0 && "2nd loop in improperly connected"); + + BasicBlock* condition_block = cfg.block(condition_block_id); + Instruction* exit_condition = condition_block->terminator(); + assert(exit_condition->opcode() == SpvOpBranchConditional); + BasicBlock::iterator insert_point = condition_block->tail(); + if (condition_block->GetMergeInst()) { + --insert_point; + } + + exit_condition->SetInOperand(0, {condition_builder(&*insert_point)}); + + uint32_t to_continue_block_idx = + GetClonedLoop()->IsInsideLoop(exit_condition->GetSingleWordInOperand(1)) + ? 1 + : 2; + exit_condition->SetInOperand( + 1, {exit_condition->GetSingleWordInOperand(to_continue_block_idx)}); + exit_condition->SetInOperand(2, {GetClonedLoop()->GetMergeBlock()->id()}); + + // Update def/use manager. + context_->get_def_use_mgr()->AnalyzeInstUse(exit_condition); +} + +BasicBlock* LoopPeeling::CreateBlockBefore(BasicBlock* bb) { + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + CFG& cfg = *context_->cfg(); + assert(cfg.preds(bb->id()).size() == 1 && "More than one predecessor"); + + std::unique_ptr new_bb = + MakeUnique(std::unique_ptr(new Instruction( + context_, SpvOpLabel, 0, context_->TakeNextId(), {}))); + new_bb->SetParent(loop_utils_.GetFunction()); + // Update the loop descriptor. + Loop* in_loop = (*loop_utils_.GetLoopDescriptor())[bb]; + if (in_loop) { + in_loop->AddBasicBlock(new_bb.get()); + loop_utils_.GetLoopDescriptor()->SetBasicBlockToLoop(new_bb->id(), in_loop); + } + + context_->set_instr_block(new_bb->GetLabelInst(), new_bb.get()); + def_use_mgr->AnalyzeInstDefUse(new_bb->GetLabelInst()); + + BasicBlock* bb_pred = cfg.block(cfg.preds(bb->id())[0]); + bb_pred->tail()->ForEachInId([bb, &new_bb](uint32_t* id) { + if (*id == bb->id()) { + *id = new_bb->id(); + } + }); + cfg.RemoveEdge(bb_pred->id(), bb->id()); + cfg.AddEdge(bb_pred->id(), new_bb->id()); + def_use_mgr->AnalyzeInstUse(&*bb_pred->tail()); + + // Update the incoming branch. + bb->ForEachPhiInst([&new_bb, def_use_mgr](Instruction* phi) { + phi->SetInOperand(1, {new_bb->id()}); + def_use_mgr->AnalyzeInstUse(phi); + }); + InstructionBuilder( + context_, new_bb.get(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping) + .AddBranch(bb->id()); + cfg.RegisterBlock(new_bb.get()); + + // Add the basic block to the function. + Function::iterator it = loop_utils_.GetFunction()->FindBlock(bb->id()); + assert(it != loop_utils_.GetFunction()->end() && + "Basic block not found in the function."); + BasicBlock* ret = new_bb.get(); + loop_utils_.GetFunction()->AddBasicBlock(std::move(new_bb), it); + return ret; +} + +BasicBlock* LoopPeeling::ProtectLoop(Loop* loop, Instruction* condition, + BasicBlock* if_merge) { + BasicBlock* if_block = loop->GetOrCreatePreHeaderBlock(); + // Will no longer be a pre-header because of the if. + loop->SetPreHeaderBlock(nullptr); + // Kill the branch to the header. + context_->KillInst(&*if_block->tail()); + + InstructionBuilder builder( + context_, if_block, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + builder.AddConditionalBranch(condition->result_id(), + loop->GetHeaderBlock()->id(), if_merge->id(), + if_merge->id()); + + return if_block; +} + +void LoopPeeling::PeelBefore(uint32_t peel_factor) { + assert(CanPeelLoop() && "Cannot peel loop"); + LoopUtils::LoopCloningResult clone_results; + + // Clone the loop and insert the cloned one before the loop. + DuplicateAndConnectLoop(&clone_results); + + // Add a canonical induction variable "canonical_induction_variable_". + InsertCanonicalInductionVariable(&clone_results); + + InstructionBuilder builder( + context_, &*cloned_loop_->GetPreHeaderBlock()->tail(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + Instruction* factor = + builder.Add32BitConstantInteger(peel_factor, int_type_->IsSigned()); + + Instruction* has_remaining_iteration = builder.AddLessThan( + factor->result_id(), loop_iteration_count_->result_id()); + Instruction* max_iteration = builder.AddSelect( + factor->type_id(), has_remaining_iteration->result_id(), + factor->result_id(), loop_iteration_count_->result_id()); + + // Change the exit condition of the cloned loop to be (exit when become + // false): + // "canonical_induction_variable_" < min("factor", "loop_iteration_count_") + FixExitCondition([max_iteration, this](Instruction* insert_before_point) { + return InstructionBuilder(context_, insert_before_point, + IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping) + .AddLessThan(canonical_induction_variable_->result_id(), + max_iteration->result_id()) + ->result_id(); + }); + + // "Protect" the second loop: the second loop can only be executed if + // |has_remaining_iteration| is true (i.e. factor < loop_iteration_count_). + BasicBlock* if_merge_block = loop_->GetMergeBlock(); + loop_->SetMergeBlock(CreateBlockBefore(loop_->GetMergeBlock())); + // Prevent the second loop from being executed if we already executed all the + // required iterations. + BasicBlock* if_block = + ProtectLoop(loop_, has_remaining_iteration, if_merge_block); + // Patch the phi of the merge block. + if_merge_block->ForEachPhiInst( + [&clone_results, if_block, this](Instruction* phi) { + // if_merge_block had previously only 1 predecessor. + uint32_t incoming_value = phi->GetSingleWordInOperand(0); + auto def_in_loop = clone_results.value_map_.find(incoming_value); + if (def_in_loop != clone_results.value_map_.end()) + incoming_value = def_in_loop->second; + phi->AddOperand( + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {incoming_value}}); + phi->AddOperand( + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {if_block->id()}}); + context_->get_def_use_mgr()->AnalyzeInstUse(phi); + }); + + context_->InvalidateAnalysesExceptFor( + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisCFG); +} + +void LoopPeeling::PeelAfter(uint32_t peel_factor) { + assert(CanPeelLoop() && "Cannot peel loop"); + LoopUtils::LoopCloningResult clone_results; + + // Clone the loop and insert the cloned one before the loop. + DuplicateAndConnectLoop(&clone_results); + + // Add a canonical induction variable "canonical_induction_variable_". + InsertCanonicalInductionVariable(&clone_results); + + InstructionBuilder builder( + context_, &*cloned_loop_->GetPreHeaderBlock()->tail(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + Instruction* factor = + builder.Add32BitConstantInteger(peel_factor, int_type_->IsSigned()); + + Instruction* has_remaining_iteration = builder.AddLessThan( + factor->result_id(), loop_iteration_count_->result_id()); + + // Change the exit condition of the cloned loop to be (exit when become + // false): + // "canonical_induction_variable_" + "factor" < "loop_iteration_count_" + FixExitCondition([factor, this](Instruction* insert_before_point) { + InstructionBuilder cond_builder( + context_, insert_before_point, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + // Build the following check: canonical_induction_variable_ + factor < + // iteration_count + return cond_builder + .AddLessThan(cond_builder + .AddIAdd(canonical_induction_variable_->type_id(), + canonical_induction_variable_->result_id(), + factor->result_id()) + ->result_id(), + loop_iteration_count_->result_id()) + ->result_id(); + }); + + // "Protect" the first loop: the first loop can only be executed if + // factor < loop_iteration_count_. + + // The original loop's pre-header was the cloned loop merge block. + GetClonedLoop()->SetMergeBlock( + CreateBlockBefore(GetOriginalLoop()->GetPreHeaderBlock())); + // Use the second loop preheader as if merge block. + + // Prevent the first loop if only the peeled loop needs it. + BasicBlock* if_block = ProtectLoop(cloned_loop_, has_remaining_iteration, + GetOriginalLoop()->GetPreHeaderBlock()); + + // Patch the phi of the header block. + // We added an if to enclose the first loop and because the phi node are + // connected to the exit value of the first loop, the definition no longer + // dominate the preheader. + // We had to the preheader (our if merge block) the required phi instruction + // and patch the header phi. + GetOriginalLoop()->GetHeaderBlock()->ForEachPhiInst( + [&clone_results, if_block, this](Instruction* phi) { + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + auto find_value_idx = [](Instruction* phi_inst, Loop* loop) { + uint32_t preheader_value_idx = + !loop->IsInsideLoop(phi_inst->GetSingleWordInOperand(1)) ? 0 : 2; + return preheader_value_idx; + }; + + Instruction* cloned_phi = + def_use_mgr->GetDef(clone_results.value_map_.at(phi->result_id())); + uint32_t cloned_preheader_value = cloned_phi->GetSingleWordInOperand( + find_value_idx(cloned_phi, GetClonedLoop())); + + Instruction* new_phi = + InstructionBuilder(context_, + &*GetOriginalLoop()->GetPreHeaderBlock()->tail(), + IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping) + .AddPhi(phi->type_id(), + {phi->GetSingleWordInOperand( + find_value_idx(phi, GetOriginalLoop())), + GetClonedLoop()->GetMergeBlock()->id(), + cloned_preheader_value, if_block->id()}); + + phi->SetInOperand(find_value_idx(phi, GetOriginalLoop()), + {new_phi->result_id()}); + def_use_mgr->AnalyzeInstUse(phi); + }); + + context_->InvalidateAnalysesExceptFor( + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisCFG); +} + +Pass::Status LoopPeelingPass::Process() { + bool modified = false; + Module* module = context()->module(); + + // Process each function in the module + for (Function& f : *module) { + modified |= ProcessFunction(&f); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool LoopPeelingPass::ProcessFunction(Function* f) { + bool modified = false; + LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(f); + + std::vector to_process_loop; + to_process_loop.reserve(loop_descriptor.NumLoops()); + for (Loop& l : loop_descriptor) { + to_process_loop.push_back(&l); + } + + ScalarEvolutionAnalysis scev_analysis(context()); + + for (Loop* loop : to_process_loop) { + CodeMetrics loop_size; + loop_size.Analyze(*loop); + + auto try_peel = [&loop_size, &modified, this](Loop* loop_to_peel) -> Loop* { + if (!loop_to_peel->IsLCSSA()) { + LoopUtils(context(), loop_to_peel).MakeLoopClosedSSA(); + } + + bool peeled_loop; + Loop* still_peelable_loop; + std::tie(peeled_loop, still_peelable_loop) = + ProcessLoop(loop_to_peel, &loop_size); + + if (peeled_loop) { + modified = true; + } + + return still_peelable_loop; + }; + + Loop* still_peelable_loop = try_peel(loop); + // The pass is working out the maximum factor by which a loop can be peeled. + // If the loop can potentially be peeled again, then there is only one + // possible direction, so only one call is still needed. + if (still_peelable_loop) { + try_peel(loop); + } + } + + return modified; +} + +std::pair LoopPeelingPass::ProcessLoop(Loop* loop, + CodeMetrics* loop_size) { + ScalarEvolutionAnalysis* scev_analysis = + context()->GetScalarEvolutionAnalysis(); + // Default values for bailing out. + std::pair bail_out{false, nullptr}; + + BasicBlock* exit_block = loop->FindConditionBlock(); + if (!exit_block) { + return bail_out; + } + + Instruction* exiting_iv = loop->FindConditionVariable(exit_block); + if (!exiting_iv) { + return bail_out; + } + size_t iterations = 0; + if (!loop->FindNumberOfIterations(exiting_iv, &*exit_block->tail(), + &iterations)) { + return bail_out; + } + if (!iterations) { + return bail_out; + } + + Instruction* canonical_induction_variable = nullptr; + + loop->GetHeaderBlock()->WhileEachPhiInst([&canonical_induction_variable, + scev_analysis, + this](Instruction* insn) { + if (const SERecurrentNode* iv = + scev_analysis->AnalyzeInstruction(insn)->AsSERecurrentNode()) { + const SEConstantNode* offset = iv->GetOffset()->AsSEConstantNode(); + const SEConstantNode* coeff = iv->GetCoefficient()->AsSEConstantNode(); + if (offset && coeff && offset->FoldToSingleValue() == 0 && + coeff->FoldToSingleValue() == 1) { + if (context()->get_type_mgr()->GetType(insn->type_id())->AsInteger()) { + canonical_induction_variable = insn; + return false; + } + } + } + return true; + }); + + bool is_signed = canonical_induction_variable + ? context() + ->get_type_mgr() + ->GetType(canonical_induction_variable->type_id()) + ->AsInteger() + ->IsSigned() + : false; + + LoopPeeling peeler( + loop, + InstructionBuilder( + context(), loop->GetHeaderBlock(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping) + .Add32BitConstantInteger(static_cast(iterations), + is_signed), + canonical_induction_variable); + + if (!peeler.CanPeelLoop()) { + return bail_out; + } + + // For each basic block in the loop, check if it can be peeled. If it + // can, get the direction (before/after) and by which factor. + LoopPeelingInfo peel_info(loop, iterations, scev_analysis); + + uint32_t peel_before_factor = 0; + uint32_t peel_after_factor = 0; + + for (uint32_t block : loop->GetBlocks()) { + if (block == exit_block->id()) { + continue; + } + BasicBlock* bb = cfg()->block(block); + PeelDirection direction; + uint32_t factor; + std::tie(direction, factor) = peel_info.GetPeelingInfo(bb); + + if (direction == PeelDirection::kNone) { + continue; + } + if (direction == PeelDirection::kBefore) { + peel_before_factor = std::max(peel_before_factor, factor); + } else { + assert(direction == PeelDirection::kAfter); + peel_after_factor = std::max(peel_after_factor, factor); + } + } + PeelDirection direction = PeelDirection::kNone; + uint32_t factor = 0; + + // Find which direction we should peel. + if (peel_before_factor) { + factor = peel_before_factor; + direction = PeelDirection::kBefore; + } + if (peel_after_factor) { + if (peel_before_factor < peel_after_factor) { + // Favor a peel after here and give the peel before another shot later. + factor = peel_after_factor; + direction = PeelDirection::kAfter; + } + } + + // Do the peel if we can. + if (direction == PeelDirection::kNone) return bail_out; + + // This does not take into account branch elimination opportunities and + // the unrolling. It assumes the peeled loop will be unrolled as well. + if (factor * loop_size->roi_size_ > code_grow_threshold_) { + return bail_out; + } + loop_size->roi_size_ *= factor; + + // Find if a loop should be peeled again. + Loop* extra_opportunity = nullptr; + + if (direction == PeelDirection::kBefore) { + peeler.PeelBefore(factor); + if (stats_) { + stats_->peeled_loops_.emplace_back(loop, PeelDirection::kBefore, factor); + } + if (peel_after_factor) { + // We could have peeled after, give it another try. + extra_opportunity = peeler.GetOriginalLoop(); + } + } else { + peeler.PeelAfter(factor); + if (stats_) { + stats_->peeled_loops_.emplace_back(loop, PeelDirection::kAfter, factor); + } + if (peel_before_factor) { + // We could have peeled before, give it another try. + extra_opportunity = peeler.GetClonedLoop(); + } + } + + return {true, extra_opportunity}; +} + +uint32_t LoopPeelingPass::LoopPeelingInfo::GetFirstLoopInvariantOperand( + Instruction* condition) const { + for (uint32_t i = 0; i < condition->NumInOperands(); i++) { + BasicBlock* bb = + context_->get_instr_block(condition->GetSingleWordInOperand(i)); + if (bb && loop_->IsInsideLoop(bb)) { + return condition->GetSingleWordInOperand(i); + } + } + + return 0; +} + +uint32_t LoopPeelingPass::LoopPeelingInfo::GetFirstNonLoopInvariantOperand( + Instruction* condition) const { + for (uint32_t i = 0; i < condition->NumInOperands(); i++) { + BasicBlock* bb = + context_->get_instr_block(condition->GetSingleWordInOperand(i)); + if (!bb || !loop_->IsInsideLoop(bb)) { + return condition->GetSingleWordInOperand(i); + } + } + + return 0; +} + +static bool IsHandledCondition(SpvOp opcode) { + switch (opcode) { + case SpvOpIEqual: + case SpvOpINotEqual: + case SpvOpUGreaterThan: + case SpvOpSGreaterThan: + case SpvOpUGreaterThanEqual: + case SpvOpSGreaterThanEqual: + case SpvOpULessThan: + case SpvOpSLessThan: + case SpvOpULessThanEqual: + case SpvOpSLessThanEqual: + return true; + default: + return false; + } +} + +LoopPeelingPass::LoopPeelingInfo::Direction +LoopPeelingPass::LoopPeelingInfo::GetPeelingInfo(BasicBlock* bb) const { + if (bb->terminator()->opcode() != SpvOpBranchConditional) { + return GetNoneDirection(); + } + + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + Instruction* condition = + def_use_mgr->GetDef(bb->terminator()->GetSingleWordInOperand(0)); + + if (!IsHandledCondition(condition->opcode())) { + return GetNoneDirection(); + } + + if (!GetFirstLoopInvariantOperand(condition)) { + // No loop invariant, it cannot be peeled by this pass. + return GetNoneDirection(); + } + if (!GetFirstNonLoopInvariantOperand(condition)) { + // Seems to be a job for the unswitch pass. + return GetNoneDirection(); + } + + // Left hand-side. + SExpression lhs = scev_analysis_->AnalyzeInstruction( + def_use_mgr->GetDef(condition->GetSingleWordInOperand(0))); + if (lhs->GetType() == SENode::CanNotCompute) { + // Can't make any conclusion. + return GetNoneDirection(); + } + + // Right hand-side. + SExpression rhs = scev_analysis_->AnalyzeInstruction( + def_use_mgr->GetDef(condition->GetSingleWordInOperand(1))); + if (rhs->GetType() == SENode::CanNotCompute) { + // Can't make any conclusion. + return GetNoneDirection(); + } + + // Only take into account recurrent expression over the current loop. + bool is_lhs_rec = !scev_analysis_->IsLoopInvariant(loop_, lhs); + bool is_rhs_rec = !scev_analysis_->IsLoopInvariant(loop_, rhs); + + if ((is_lhs_rec && is_rhs_rec) || (!is_lhs_rec && !is_rhs_rec)) { + return GetNoneDirection(); + } + + if (is_lhs_rec) { + if (!lhs->AsSERecurrentNode() || + lhs->AsSERecurrentNode()->GetLoop() != loop_) { + return GetNoneDirection(); + } + } + if (is_rhs_rec) { + if (!rhs->AsSERecurrentNode() || + rhs->AsSERecurrentNode()->GetLoop() != loop_) { + return GetNoneDirection(); + } + } + + // If the op code is ==, then we try a peel before or after. + // If opcode is not <, >, <= or >=, we bail out. + // + // For the remaining cases, we canonicalize the expression so that the + // constant expression is on the left hand side and the recurring expression + // is on the right hand side. If we swap hand side, then < becomes >, <= + // becomes >= etc. + // If the opcode is <=, then we add 1 to the right hand side and do the peel + // check on <. + // If the opcode is >=, then we add 1 to the left hand side and do the peel + // check on >. + + CmpOperator cmp_operator; + switch (condition->opcode()) { + default: + return GetNoneDirection(); + case SpvOpIEqual: + case SpvOpINotEqual: + return HandleEquality(lhs, rhs); + case SpvOpUGreaterThan: + case SpvOpSGreaterThan: { + cmp_operator = CmpOperator::kGT; + break; + } + case SpvOpULessThan: + case SpvOpSLessThan: { + cmp_operator = CmpOperator::kLT; + break; + } + // We add one to transform >= into > and <= into <. + case SpvOpUGreaterThanEqual: + case SpvOpSGreaterThanEqual: { + cmp_operator = CmpOperator::kGE; + break; + } + case SpvOpULessThanEqual: + case SpvOpSLessThanEqual: { + cmp_operator = CmpOperator::kLE; + break; + } + } + + // Force the left hand side to be the non recurring expression. + if (is_lhs_rec) { + std::swap(lhs, rhs); + switch (cmp_operator) { + case CmpOperator::kLT: { + cmp_operator = CmpOperator::kGT; + break; + } + case CmpOperator::kGT: { + cmp_operator = CmpOperator::kLT; + break; + } + case CmpOperator::kLE: { + cmp_operator = CmpOperator::kGE; + break; + } + case CmpOperator::kGE: { + cmp_operator = CmpOperator::kLE; + break; + } + } + } + return HandleInequality(cmp_operator, lhs, rhs->AsSERecurrentNode()); +} + +SExpression LoopPeelingPass::LoopPeelingInfo::GetValueAtFirstIteration( + SERecurrentNode* rec) const { + return rec->GetOffset(); +} + +SExpression LoopPeelingPass::LoopPeelingInfo::GetValueAtIteration( + SERecurrentNode* rec, int64_t iteration) const { + SExpression coeff = rec->GetCoefficient(); + SExpression offset = rec->GetOffset(); + + return (coeff * iteration) + offset; +} + +SExpression LoopPeelingPass::LoopPeelingInfo::GetValueAtLastIteration( + SERecurrentNode* rec) const { + return GetValueAtIteration(rec, loop_max_iterations_ - 1); +} + +bool LoopPeelingPass::LoopPeelingInfo::EvalOperator(CmpOperator cmp_op, + SExpression lhs, + SExpression rhs, + bool* result) const { + assert(scev_analysis_->IsLoopInvariant(loop_, lhs)); + assert(scev_analysis_->IsLoopInvariant(loop_, rhs)); + // We perform the test: 0 cmp_op rhs - lhs + // What is left is then to determine the sign of the expression. + switch (cmp_op) { + case CmpOperator::kLT: { + return scev_analysis_->IsAlwaysGreaterThanZero(rhs - lhs, result); + } + case CmpOperator::kGT: { + return scev_analysis_->IsAlwaysGreaterThanZero(lhs - rhs, result); + } + case CmpOperator::kLE: { + return scev_analysis_->IsAlwaysGreaterOrEqualToZero(rhs - lhs, result); + } + case CmpOperator::kGE: { + return scev_analysis_->IsAlwaysGreaterOrEqualToZero(lhs - rhs, result); + } + } + return false; +} + +LoopPeelingPass::LoopPeelingInfo::Direction +LoopPeelingPass::LoopPeelingInfo::HandleEquality(SExpression lhs, + SExpression rhs) const { + { + // Try peel before opportunity. + SExpression lhs_cst = lhs; + if (SERecurrentNode* rec_node = lhs->AsSERecurrentNode()) { + lhs_cst = rec_node->GetOffset(); + } + SExpression rhs_cst = rhs; + if (SERecurrentNode* rec_node = rhs->AsSERecurrentNode()) { + rhs_cst = rec_node->GetOffset(); + } + + if (lhs_cst == rhs_cst) { + return Direction{LoopPeelingPass::PeelDirection::kBefore, 1}; + } + } + + { + // Try peel after opportunity. + SExpression lhs_cst = lhs; + if (SERecurrentNode* rec_node = lhs->AsSERecurrentNode()) { + // rec_node(x) = a * x + b + // assign to lhs: a * (loop_max_iterations_ - 1) + b + lhs_cst = GetValueAtLastIteration(rec_node); + } + SExpression rhs_cst = rhs; + if (SERecurrentNode* rec_node = rhs->AsSERecurrentNode()) { + // rec_node(x) = a * x + b + // assign to lhs: a * (loop_max_iterations_ - 1) + b + rhs_cst = GetValueAtLastIteration(rec_node); + } + + if (lhs_cst == rhs_cst) { + return Direction{LoopPeelingPass::PeelDirection::kAfter, 1}; + } + } + + return GetNoneDirection(); +} + +LoopPeelingPass::LoopPeelingInfo::Direction +LoopPeelingPass::LoopPeelingInfo::HandleInequality(CmpOperator cmp_op, + SExpression lhs, + SERecurrentNode* rhs) const { + SExpression offset = rhs->GetOffset(); + SExpression coefficient = rhs->GetCoefficient(); + // Compute (cst - B) / A. + std::pair flip_iteration = (lhs - offset) / coefficient; + if (!flip_iteration.first->AsSEConstantNode()) { + return GetNoneDirection(); + } + // note: !!flip_iteration.second normalize to 0/1 (via bool cast). + int64_t iteration = + flip_iteration.first->AsSEConstantNode()->FoldToSingleValue() + + !!flip_iteration.second; + if (iteration <= 0 || + loop_max_iterations_ <= static_cast(iteration)) { + // Always true or false within the loop bounds. + return GetNoneDirection(); + } + // If this is a <= or >= operator and the iteration, make sure |iteration| is + // the one flipping the condition. + // If (cst - B) and A are not divisible, this equivalent to a < or > check, so + // we skip this test. + if (!flip_iteration.second && + (cmp_op == CmpOperator::kLE || cmp_op == CmpOperator::kGE)) { + bool first_iteration; + bool current_iteration; + if (!EvalOperator(cmp_op, lhs, offset, &first_iteration) || + !EvalOperator(cmp_op, lhs, GetValueAtIteration(rhs, iteration), + ¤t_iteration)) { + return GetNoneDirection(); + } + // If the condition did not flip the next will. + if (first_iteration == current_iteration) { + iteration++; + } + } + + uint32_t cast_iteration = 0; + // sanity check: can we fit |iteration| in a uint32_t ? + if (static_cast(iteration) < std::numeric_limits::max()) { + cast_iteration = static_cast(iteration); + } + + if (cast_iteration) { + // Peel before if we are closer to the start, after if closer to the end. + if (loop_max_iterations_ / 2 > cast_iteration) { + return Direction{LoopPeelingPass::PeelDirection::kBefore, cast_iteration}; + } else { + return Direction{ + LoopPeelingPass::PeelDirection::kAfter, + static_cast(loop_max_iterations_ - cast_iteration)}; + } + } + + return GetNoneDirection(); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.h new file mode 100644 index 00000000000..413f896f251 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_peeling.h @@ -0,0 +1,336 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_PEELING_H_ +#define SOURCE_OPT_LOOP_PEELING_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "source/opt/scalar_analysis.h" + +namespace spvtools { +namespace opt { + +// Utility class to perform the peeling of a given loop. +// The loop peeling transformation make a certain amount of a loop iterations to +// be executed either before (peel before) or after (peel after) the transformed +// loop. +// +// For peeling cases the transformation does the following steps: +// - It clones the loop and inserts the cloned loop before the original loop; +// - It connects all iterating values of the cloned loop with the +// corresponding original loop values so that the second loop starts with +// the appropriate values. +// - It inserts a new induction variable "i" is inserted into the cloned that +// starts with the value 0 and increment by step of one. +// +// The last step is specific to each case: +// - Peel before: the transformation is to peel the "N" first iterations. +// The exit condition of the cloned loop is changed so that the loop +// exits when "i < N" becomes false. The original loop is then protected to +// only execute if there is any iteration left to do. +// - Peel after: the transformation is to peel the "N" last iterations, +// then the exit condition of the cloned loop is changed so that the loop +// exits when "i + N < max_iteration" becomes false, where "max_iteration" +// is the upper bound of the loop. The cloned loop is then protected to +// only execute if there is any iteration left to do no covered by the +// second. +// +// To be peelable: +// - The loop must be in LCSSA form; +// - The loop must not contain any breaks; +// - The loop must not have any ambiguous iterators updates (see +// "CanPeelLoop"). +// The method "CanPeelLoop" checks that those constrained are met. +class LoopPeeling { + public: + // LoopPeeling constructor. + // |loop| is the loop to peel. + // |loop_iteration_count| is the instruction holding the |loop| iteration + // count, must be invariant for |loop| and must be of an int 32 type (signed + // or unsigned). + // |canonical_induction_variable| is an induction variable that can be used to + // count the number of iterations, must be of the same type as + // |loop_iteration_count| and start at 0 and increase by step of one at each + // iteration. The value nullptr is interpreted as no suitable variable exists + // and one will be created. + LoopPeeling(Loop* loop, Instruction* loop_iteration_count, + Instruction* canonical_induction_variable = nullptr) + : context_(loop->GetContext()), + loop_utils_(loop->GetContext(), loop), + loop_(loop), + loop_iteration_count_(!loop->IsInsideLoop(loop_iteration_count) + ? loop_iteration_count + : nullptr), + int_type_(nullptr), + original_loop_canonical_induction_variable_( + canonical_induction_variable), + canonical_induction_variable_(nullptr) { + if (loop_iteration_count_) { + int_type_ = context_->get_type_mgr() + ->GetType(loop_iteration_count_->type_id()) + ->AsInteger(); + if (canonical_induction_variable_) { + assert(canonical_induction_variable_->type_id() == + loop_iteration_count_->type_id() && + "loop_iteration_count and canonical_induction_variable do not " + "have the same type"); + } + } + GetIteratingExitValues(); + } + + // Returns true if the loop can be peeled. + // To be peelable, all operation involved in the update of the loop iterators + // must not dominates the exit condition. This restriction is a work around to + // not miss compile code like: + // + // for (int i = 0; i + 1 < N; i++) {} + // for (int i = 0; ++i < N; i++) {} + // + // The increment will happen before the test on the exit condition leading to + // very look-a-like code. + // + // This restriction will not apply if a loop rotate is applied before (i.e. + // becomes a do-while loop). + bool CanPeelLoop() const { + CFG& cfg = *context_->cfg(); + + if (!loop_iteration_count_) { + return false; + } + if (!int_type_) { + return false; + } + if (int_type_->width() != 32) { + return false; + } + if (!loop_->IsLCSSA()) { + return false; + } + if (!loop_->GetMergeBlock()) { + return false; + } + if (cfg.preds(loop_->GetMergeBlock()->id()).size() != 1) { + return false; + } + if (!IsConditionCheckSideEffectFree()) { + return false; + } + + return !std::any_of(exit_value_.cbegin(), exit_value_.cend(), + [](std::pair it) { + return it.second == nullptr; + }); + } + + // Moves the execution of the |factor| first iterations of the loop into a + // dedicated loop. + void PeelBefore(uint32_t factor); + + // Moves the execution of the |factor| last iterations of the loop into a + // dedicated loop. + void PeelAfter(uint32_t factor); + + // Returns the cloned loop. + Loop* GetClonedLoop() { return cloned_loop_; } + // Returns the original loop. + Loop* GetOriginalLoop() { return loop_; } + + private: + IRContext* context_; + LoopUtils loop_utils_; + // The original loop. + Loop* loop_; + // The initial |loop_| upper bound. + Instruction* loop_iteration_count_; + // The int type to use for the canonical_induction_variable_. + analysis::Integer* int_type_; + // The cloned loop. + Loop* cloned_loop_; + // This is set to true when the exit and back-edge branch instruction is the + // same. + bool do_while_form_; + // The canonical induction variable from the original loop if it exists. + Instruction* original_loop_canonical_induction_variable_; + // The canonical induction variable of the cloned loop. The induction variable + // is initialized to 0 and incremented by step of 1. + Instruction* canonical_induction_variable_; + // Map between loop iterators and exit values. Loop iterators + std::unordered_map exit_value_; + + // Duplicate |loop_| and place the new loop before the cloned loop. Iterating + // values from the cloned loop are then connected to the original loop as + // initializer. + void DuplicateAndConnectLoop(LoopUtils::LoopCloningResult* clone_results); + + // Insert the canonical induction variable into the first loop as a simplified + // counter. + void InsertCanonicalInductionVariable( + LoopUtils::LoopCloningResult* clone_results); + + // Fixes the exit condition of the before loop. The function calls + // |condition_builder| to get the condition to use in the conditional branch + // of the loop exit. The loop will be exited if the condition evaluate to + // true. |condition_builder| takes an Instruction* that represent the + // insertion point. + void FixExitCondition( + const std::function& condition_builder); + + // Gathers all operations involved in the update of |iterator| into + // |operations|. + void GetIteratorUpdateOperations( + const Loop* loop, Instruction* iterator, + std::unordered_set* operations); + + // Gathers exiting iterator values. The function builds a map between each + // iterating value in the loop (a phi instruction in the loop header) and its + // SSA value when it exit the loop. If no exit value can be accurately found, + // it is map to nullptr (see comment on CanPeelLoop). + void GetIteratingExitValues(); + + // Returns true if a for-loop has no instruction with effects before the + // condition check. + bool IsConditionCheckSideEffectFree() const; + + // Creates a new basic block and insert it between |bb| and the predecessor of + // |bb|. + BasicBlock* CreateBlockBefore(BasicBlock* bb); + + // Inserts code to only execute |loop| only if the given |condition| is true. + // |if_merge| is a suitable basic block to be used by the if condition as + // merge block. + // The function returns the if block protecting the loop. + BasicBlock* ProtectLoop(Loop* loop, Instruction* condition, + BasicBlock* if_merge); +}; + +// Implements a loop peeling optimization. +// For each loop, the pass will try to peel it if there is conditions that +// are true for the "N" first or last iterations of the loop. +// To avoid code size explosion, too large loops will not be peeled. +class LoopPeelingPass : public Pass { + public: + // Describes the peeling direction. + enum class PeelDirection { + kNone, // Cannot peel + kBefore, // Can peel before + kAfter // Can peel last + }; + + // Holds some statistics about peeled function. + struct LoopPeelingStats { + std::vector> peeled_loops_; + }; + + LoopPeelingPass(LoopPeelingStats* stats = nullptr) : stats_(stats) {} + + // Sets the loop peeling growth threshold. If the code size increase is above + // |code_grow_threshold|, the loop will not be peeled. The code size is + // measured in terms of SPIR-V instructions. + static void SetLoopPeelingThreshold(size_t code_grow_threshold) { + code_grow_threshold_ = code_grow_threshold; + } + + // Returns the loop peeling code growth threshold. + static size_t GetLoopPeelingThreshold() { return code_grow_threshold_; } + + const char* name() const override { return "loop-peeling"; } + + // Processes the given |module|. Returns Status::Failure if errors occur when + // processing. Returns the corresponding Status::Success if processing is + // succesful to indicate whether changes have been made to the modue. + Pass::Status Process() override; + + private: + // Describes the peeling direction. + enum class CmpOperator { + kLT, // less than + kGT, // greater than + kLE, // less than or equal + kGE, // greater than or equal + }; + + class LoopPeelingInfo { + public: + using Direction = std::pair; + + LoopPeelingInfo(Loop* loop, size_t loop_max_iterations, + ScalarEvolutionAnalysis* scev_analysis) + : context_(loop->GetContext()), + loop_(loop), + scev_analysis_(scev_analysis), + loop_max_iterations_(loop_max_iterations) {} + + // Returns by how much and to which direction a loop should be peeled to + // make the conditional branch of the basic block |bb| an unconditional + // branch. If |bb|'s terminator is not a conditional branch or the condition + // is not workable then it returns PeelDirection::kNone and a 0 factor. + Direction GetPeelingInfo(BasicBlock* bb) const; + + private: + // Returns the id of the loop invariant operand of the conditional + // expression |condition|. It returns if no operand is invariant. + uint32_t GetFirstLoopInvariantOperand(Instruction* condition) const; + // Returns the id of the non loop invariant operand of the conditional + // expression |condition|. It returns if all operands are invariant. + uint32_t GetFirstNonLoopInvariantOperand(Instruction* condition) const; + + // Returns the value of |rec| at the first loop iteration. + SExpression GetValueAtFirstIteration(SERecurrentNode* rec) const; + // Returns the value of |rec| at the given |iteration|. + SExpression GetValueAtIteration(SERecurrentNode* rec, + int64_t iteration) const; + // Returns the value of |rec| at the last loop iteration. + SExpression GetValueAtLastIteration(SERecurrentNode* rec) const; + + bool EvalOperator(CmpOperator cmp_op, SExpression lhs, SExpression rhs, + bool* result) const; + + Direction HandleEquality(SExpression lhs, SExpression rhs) const; + Direction HandleInequality(CmpOperator cmp_op, SExpression lhs, + SERecurrentNode* rhs) const; + + static Direction GetNoneDirection() { + return Direction{LoopPeelingPass::PeelDirection::kNone, 0}; + } + IRContext* context_; + Loop* loop_; + ScalarEvolutionAnalysis* scev_analysis_; + size_t loop_max_iterations_; + }; + // Peel profitable loops in |f|. + bool ProcessFunction(Function* f); + // Peel |loop| if profitable. + std::pair ProcessLoop(Loop* loop, CodeMetrics* loop_size); + + static size_t code_grow_threshold_; + LoopPeelingStats* stats_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_PEELING_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp new file mode 100644 index 00000000000..587615edf37 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.cpp @@ -0,0 +1,1064 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_unroller.h" + +#include +#include +#include +#include +#include +#include + +#include "source/opt/ir_builder.h" +#include "source/opt/loop_utils.h" + +// Implements loop util unrolling functionality for fully and partially +// unrolling loops. Given a factor it will duplicate the loop that many times, +// appending each one to the end of the old loop and removing backedges, to +// create a new unrolled loop. +// +// 1 - User calls LoopUtils::FullyUnroll or LoopUtils::PartiallyUnroll with a +// loop they wish to unroll. LoopUtils::CanPerformUnroll is used to +// validate that a given loop can be unrolled. That method (along with the +// constructor of loop) checks that the IR is in the expected canonicalised +// format. +// +// 2 - The LoopUtils methods create a LoopUnrollerUtilsImpl object to actually +// perform the unrolling. This implements helper methods to copy the loop basic +// blocks and remap the ids of instructions used inside them. +// +// 3 - The core of LoopUnrollerUtilsImpl is the Unroll method, this method +// actually performs the loop duplication. It does this by creating a +// LoopUnrollState object and then copying the loop as given by the factor +// parameter. The LoopUnrollState object retains the state of the unroller +// between the loop body copies as each iteration needs information on the last +// to adjust the phi induction variable, adjust the OpLoopMerge instruction in +// the main loop header, and change the previous continue block to point to the +// new header and the new continue block to the main loop header. +// +// 4 - If the loop is to be fully unrolled then it is simply closed after step +// 3, with the OpLoopMerge being deleted, the backedge removed, and the +// condition blocks folded. +// +// 5 - If it is being partially unrolled: if the unrolling factor leaves the +// loop with an even number of bodies with respect to the number of loop +// iterations then step 3 is all that is needed. If it is uneven then we need to +// duplicate the loop completely and unroll the duplicated loop to cover the +// residual part and adjust the first loop to cover only the "even" part. For +// instance if you request an unroll factor of 3 on a loop with 10 iterations +// then copying the body three times would leave you with three bodies in the +// loop +// where the loop still iterates over each 4 times. So we make two loops one +// iterating once then a second loop of three iterating 3 times. + +namespace spvtools { +namespace opt { +namespace { + +// Loop control constant value for DontUnroll flag. +static const uint32_t kLoopControlDontUnrollIndex = 2; + +// Operand index of the loop control parameter of the OpLoopMerge. +static const uint32_t kLoopControlIndex = 2; + +// This utility class encapsulates some of the state we need to maintain between +// loop unrolls. Specifically it maintains key blocks and the induction variable +// in the current loop duplication step and the blocks from the previous one. +// This is because each step of the unroll needs to use data from both the +// preceding step and the original loop. +struct LoopUnrollState { + LoopUnrollState() + : previous_phi_(nullptr), + previous_latch_block_(nullptr), + previous_condition_block_(nullptr), + new_phi(nullptr), + new_continue_block(nullptr), + new_condition_block(nullptr), + new_header_block(nullptr) {} + + // Initialize from the loop descriptor class. + LoopUnrollState(Instruction* induction, BasicBlock* latch_block, + BasicBlock* condition, std::vector&& phis) + : previous_phi_(induction), + previous_latch_block_(latch_block), + previous_condition_block_(condition), + new_phi(nullptr), + new_continue_block(nullptr), + new_condition_block(nullptr), + new_header_block(nullptr) { + previous_phis_ = std::move(phis); + } + + // Swap the state so that the new nodes are now the previous nodes. + void NextIterationState() { + previous_phi_ = new_phi; + previous_latch_block_ = new_latch_block; + previous_condition_block_ = new_condition_block; + previous_phis_ = std::move(new_phis_); + + // Clear new nodes. + new_phi = nullptr; + new_continue_block = nullptr; + new_condition_block = nullptr; + new_header_block = nullptr; + new_latch_block = nullptr; + + // Clear new block/instruction maps. + new_blocks.clear(); + new_inst.clear(); + ids_to_new_inst.clear(); + } + + // The induction variable from the immediately preceding loop body. + Instruction* previous_phi_; + + // All the phi nodes from the previous loop iteration. + std::vector previous_phis_; + + std::vector new_phis_; + + // The previous latch block. The backedge will be removed from this and + // added to the new latch block. + BasicBlock* previous_latch_block_; + + // The previous condition block. This may be folded to flatten the loop. + BasicBlock* previous_condition_block_; + + // The new induction variable. + Instruction* new_phi; + + // The new continue block. + BasicBlock* new_continue_block; + + // The new condition block. + BasicBlock* new_condition_block; + + // The new header block. + BasicBlock* new_header_block; + + // The new latch block. + BasicBlock* new_latch_block; + + // A mapping of new block ids to the original blocks which they were copied + // from. + std::unordered_map new_blocks; + + // A mapping of the original instruction ids to the instruction ids to their + // copies. + std::unordered_map new_inst; + + std::unordered_map ids_to_new_inst; +}; + +// This class implements the actual unrolling. It uses a LoopUnrollState to +// maintain the state of the unrolling inbetween steps. +class LoopUnrollerUtilsImpl { + public: + using BasicBlockListTy = std::vector>; + + LoopUnrollerUtilsImpl(IRContext* c, Function* function) + : context_(c), + function_(*function), + loop_condition_block_(nullptr), + loop_induction_variable_(nullptr), + number_of_loop_iterations_(0), + loop_step_value_(0), + loop_init_value_(0) {} + + // Unroll the |loop| by given |factor| by copying the whole body |factor| + // times. The resulting basicblock structure will remain a loop. + void PartiallyUnroll(Loop*, size_t factor); + + // If partially unrolling the |loop| would leave the loop with too many bodies + // for its number of iterations then this method should be used. This method + // will duplicate the |loop| completely, making the duplicated loop the + // successor of the original's merge block. The original loop will have its + // condition changed to loop over the residual part and the duplicate will be + // partially unrolled. The resulting structure will be two loops. + void PartiallyUnrollResidualFactor(Loop* loop, size_t factor); + + // Fully unroll the |loop| by copying the full body by the total number of + // loop iterations, folding all conditions, and removing the backedge from the + // continue block to the header. + void FullyUnroll(Loop* loop); + + // Get the ID of the variable in the |phi| paired with |label|. + uint32_t GetPhiDefID(const Instruction* phi, uint32_t label) const; + + // Close the loop by removing the OpLoopMerge from the |loop| header block and + // making the backedge point to the merge block. + void CloseUnrolledLoop(Loop* loop); + + // Remove the OpConditionalBranch instruction inside |conditional_block| used + // to branch to either exit or continue the loop and replace it with an + // unconditional OpBranch to block |new_target|. + void FoldConditionBlock(BasicBlock* condtion_block, uint32_t new_target); + + // Add all blocks_to_add_ to function_ at the |insert_point|. + void AddBlocksToFunction(const BasicBlock* insert_point); + + // Duplicates the |old_loop|, cloning each body and remaping the ids without + // removing instructions or changing relative structure. Result will be stored + // in |new_loop|. + void DuplicateLoop(Loop* old_loop, Loop* new_loop); + + inline size_t GetLoopIterationCount() const { + return number_of_loop_iterations_; + } + + // Extracts the initial state information from the |loop|. + void Init(Loop* loop); + + // Replace the uses of each induction variable outside the loop with the final + // value of the induction variable before the loop exit. To reflect the proper + // state of a fully unrolled loop. + void ReplaceInductionUseWithFinalValue(Loop* loop); + + // Remove all the instructions in the invalidated_instructions_ vector. + void RemoveDeadInstructions(); + + // Replace any use of induction variables outwith the loop with the final + // value of the induction variable in the unrolled loop. + void ReplaceOutsideLoopUseWithFinalValue(Loop* loop); + + // Set the LoopControl operand of the OpLoopMerge instruction to be + // DontUnroll. + void MarkLoopControlAsDontUnroll(Loop* loop) const; + + private: + // Remap all the in |basic_block| to new IDs and keep the mapping of new ids + // to old + // ids. |loop| is used to identify special loop blocks (header, continue, + // ect). + void AssignNewResultIds(BasicBlock* basic_block); + + // Using the map built by AssignNewResultIds, for each instruction in + // |basic_block| use + // that map to substitute the IDs used by instructions (in the operands) with + // the new ids. + void RemapOperands(BasicBlock* basic_block); + + // Copy the whole body of the loop, all blocks dominated by the |loop| header + // and not dominated by the |loop| merge. The copied body will be linked to by + // the old |loop| continue block and the new body will link to the |loop| + // header via the new continue block. |eliminate_conditions| is used to decide + // whether or not to fold all the condition blocks other than the last one. + void CopyBody(Loop* loop, bool eliminate_conditions); + + // Copy a given |block_to_copy| in the |loop| and record the mapping of the + // old/new ids. |preserve_instructions| determines whether or not the method + // will modify (other than result_id) instructions which are copied. + void CopyBasicBlock(Loop* loop, const BasicBlock* block_to_copy, + bool preserve_instructions); + + // The actual implementation of the unroll step. Unrolls |loop| by given + // |factor| by copying the body by |factor| times. Also propagates the + // induction variable value throughout the copies. + void Unroll(Loop* loop, size_t factor); + + // Fills the loop_blocks_inorder_ field with the ordered list of basic blocks + // as computed by the method ComputeLoopOrderedBlocks. + void ComputeLoopOrderedBlocks(Loop* loop); + + // Adds the blocks_to_add_ to both the |loop| and to the parent of |loop| if + // the parent exists. + void AddBlocksToLoop(Loop* loop) const; + + // After the partially unroll step the phi instructions in the header block + // will be in an illegal format. This function makes the phis legal by making + // the edge from the latch block come from the new latch block and the value + // to be the actual value of the phi at that point. + void LinkLastPhisToStart(Loop* loop) const; + + // A pointer to the IRContext. Used to add/remove instructions and for usedef + // chains. + IRContext* context_; + + // A reference the function the loop is within. + Function& function_; + + // A list of basic blocks to be added to the loop at the end of an unroll + // step. + BasicBlockListTy blocks_to_add_; + + // List of instructions which are now dead and can be removed. + std::vector invalidated_instructions_; + + // Maintains the current state of the transform between calls to unroll. + LoopUnrollState state_; + + // An ordered list containing the loop basic blocks. + std::vector loop_blocks_inorder_; + + // The block containing the condition check which contains a conditional + // branch to the merge and continue block. + BasicBlock* loop_condition_block_; + + // The induction variable of the loop. + Instruction* loop_induction_variable_; + + // Phis used in the loop need to be remapped to use the actual result values + // and then be remapped at the end. + std::vector loop_phi_instructions_; + + // The number of loop iterations that the loop would preform pre-unroll. + size_t number_of_loop_iterations_; + + // The amount that the loop steps each iteration. + int64_t loop_step_value_; + + // The value the loop starts stepping from. + int64_t loop_init_value_; +}; + +/* + * Static helper functions. + */ + +// Retrieve the index of the OpPhi instruction |phi| which corresponds to the +// incoming |block| id. +static uint32_t GetPhiIndexFromLabel(const BasicBlock* block, + const Instruction* phi) { + for (uint32_t i = 1; i < phi->NumInOperands(); i += 2) { + if (block->id() == phi->GetSingleWordInOperand(i)) { + return i; + } + } + assert(false && "Could not find operand in instruction."); + return 0; +} + +void LoopUnrollerUtilsImpl::Init(Loop* loop) { + loop_condition_block_ = loop->FindConditionBlock(); + + // When we reinit the second loop during PartiallyUnrollResidualFactor we need + // to use the cached value from the duplicate step as the dominator tree + // basded solution, loop->FindConditionBlock, requires all the nodes to be + // connected up with the correct branches. They won't be at this point. + if (!loop_condition_block_) { + loop_condition_block_ = state_.new_condition_block; + } + assert(loop_condition_block_); + + loop_induction_variable_ = loop->FindConditionVariable(loop_condition_block_); + assert(loop_induction_variable_); + + bool found = loop->FindNumberOfIterations( + loop_induction_variable_, &*loop_condition_block_->ctail(), + &number_of_loop_iterations_, &loop_step_value_, &loop_init_value_); + (void)found; // To silence unused variable warning on release builds. + assert(found); + + // Blocks are stored in an unordered set of ids in the loop class, we need to + // create the dominator ordered list. + ComputeLoopOrderedBlocks(loop); +} + +// This function is used to partially unroll the loop when the factor provided +// would normally lead to an illegal optimization. Instead of just unrolling the +// loop it creates two loops and unrolls one and adjusts the condition on the +// other. The end result being that the new loop pair iterates over the correct +// number of bodies. +void LoopUnrollerUtilsImpl::PartiallyUnrollResidualFactor(Loop* loop, + size_t factor) { + std::unique_ptr new_label{new Instruction( + context_, SpvOp::SpvOpLabel, 0, context_->TakeNextId(), {})}; + std::unique_ptr new_exit_bb{new BasicBlock(std::move(new_label))}; + + // Save the id of the block before we move it. + uint32_t new_merge_id = new_exit_bb->id(); + + // Add the block the list of blocks to add, we want this merge block to be + // right at the start of the new blocks. + blocks_to_add_.push_back(std::move(new_exit_bb)); + BasicBlock* new_exit_bb_raw = blocks_to_add_[0].get(); + Instruction& original_conditional_branch = *loop_condition_block_->tail(); + // Duplicate the loop, providing access to the blocks of both loops. + // This is a naked new due to the VS2013 requirement of not having unique + // pointers in vectors, as it will be inserted into a vector with + // loop_descriptor.AddLoop. + Loop* new_loop = new Loop(*loop); + + // Clear the basic blocks of the new loop. + new_loop->ClearBlocks(); + + DuplicateLoop(loop, new_loop); + + // Add the blocks to the function. + AddBlocksToFunction(loop->GetMergeBlock()); + blocks_to_add_.clear(); + + // Create a new merge block for the first loop. + InstructionBuilder builder{context_, new_exit_bb_raw}; + // Make the first loop branch to the second. + builder.AddBranch(new_loop->GetHeaderBlock()->id()); + + loop_condition_block_ = state_.new_condition_block; + loop_induction_variable_ = state_.new_phi; + // Unroll the new loop by the factor with the usual -1 to account for the + // existing block iteration. + Unroll(new_loop, factor); + + LinkLastPhisToStart(new_loop); + AddBlocksToLoop(new_loop); + + // Add the new merge block to the back of the list of blocks to be added. It + // needs to be the last block added to maintain dominator order in the binary. + blocks_to_add_.push_back( + std::unique_ptr(new_loop->GetMergeBlock())); + + // Add the blocks to the function. + AddBlocksToFunction(loop->GetMergeBlock()); + + // Reset the usedef analysis. + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisLoopAnalysis); + analysis::DefUseManager* def_use_manager = context_->get_def_use_mgr(); + + // The loop condition. + Instruction* condition_check = def_use_manager->GetDef( + original_conditional_branch.GetSingleWordOperand(0)); + + // This should have been checked by the LoopUtils::CanPerformUnroll function + // before entering this. + assert(loop->IsSupportedCondition(condition_check->opcode())); + + // We need to account for the initial body when calculating the remainder. + int64_t remainder = Loop::GetResidualConditionValue( + condition_check->opcode(), loop_init_value_, loop_step_value_, + number_of_loop_iterations_, factor); + + assert(remainder > std::numeric_limits::min() && + remainder < std::numeric_limits::max()); + + Instruction* new_constant = nullptr; + + // If the remainder is negative then we add a signed constant, otherwise just + // add an unsigned constant. + if (remainder < 0) { + new_constant = + builder.Add32BitSignedIntegerConstant(static_cast(remainder)); + } else { + new_constant = builder.Add32BitUnsignedIntegerConstant( + static_cast(remainder)); + } + + uint32_t constant_id = new_constant->result_id(); + + // Update the condition check. + condition_check->SetInOperand(1, {constant_id}); + + // Update the next phi node. The phi will have a constant value coming in from + // the preheader block. For the duplicated loop we need to update the constant + // to be the amount of iterations covered by the first loop and the incoming + // block to be the first loops new merge block. + std::vector new_inductions; + new_loop->GetInductionVariables(new_inductions); + + std::vector old_inductions; + loop->GetInductionVariables(old_inductions); + for (size_t index = 0; index < new_inductions.size(); ++index) { + Instruction* new_induction = new_inductions[index]; + Instruction* old_induction = old_inductions[index]; + // Get the index of the loop initalizer, the value coming in from the + // preheader. + uint32_t initalizer_index = + GetPhiIndexFromLabel(new_loop->GetPreHeaderBlock(), old_induction); + + // Replace the second loop initalizer with the phi from the first + new_induction->SetInOperand(initalizer_index - 1, + {old_induction->result_id()}); + new_induction->SetInOperand(initalizer_index, {new_merge_id}); + + // If the use of the first loop induction variable is outside of the loop + // then replace that use with the second loop induction variable. + uint32_t second_loop_induction = new_induction->result_id(); + auto replace_use_outside_of_loop = [loop, second_loop_induction]( + Instruction* user, + uint32_t operand_index) { + if (!loop->IsInsideLoop(user)) { + user->SetOperand(operand_index, {second_loop_induction}); + } + }; + + context_->get_def_use_mgr()->ForEachUse(old_induction, + replace_use_outside_of_loop); + } + + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisLoopAnalysis); + + context_->ReplaceAllUsesWith(loop->GetMergeBlock()->id(), new_merge_id); + + LoopDescriptor& loop_descriptor = *context_->GetLoopDescriptor(&function_); + + loop_descriptor.AddLoop(new_loop, loop->GetParent()); + + RemoveDeadInstructions(); +} + +// Mark this loop as DontUnroll as it will already be unrolled and it may not +// be safe to unroll a previously partially unrolled loop. +void LoopUnrollerUtilsImpl::MarkLoopControlAsDontUnroll(Loop* loop) const { + Instruction* loop_merge_inst = loop->GetHeaderBlock()->GetLoopMergeInst(); + assert(loop_merge_inst && + "Loop merge instruction could not be found after entering unroller " + "(should have exited before this)"); + loop_merge_inst->SetInOperand(kLoopControlIndex, + {kLoopControlDontUnrollIndex}); +} + +// Duplicate the |loop| body |factor| - 1 number of times while keeping the loop +// backedge intact. This will leave the loop with |factor| number of bodies +// after accounting for the initial body. +void LoopUnrollerUtilsImpl::Unroll(Loop* loop, size_t factor) { + // If we unroll a loop partially it will not be safe to unroll it further. + // This is due to the current method of calculating the number of loop + // iterations. + MarkLoopControlAsDontUnroll(loop); + + std::vector inductions; + loop->GetInductionVariables(inductions); + state_ = LoopUnrollState{loop_induction_variable_, loop->GetLatchBlock(), + loop_condition_block_, std::move(inductions)}; + for (size_t i = 0; i < factor - 1; ++i) { + CopyBody(loop, true); + } +} + +void LoopUnrollerUtilsImpl::RemoveDeadInstructions() { + // Remove the dead instructions. + for (Instruction* inst : invalidated_instructions_) { + context_->KillInst(inst); + } +} + +void LoopUnrollerUtilsImpl::ReplaceInductionUseWithFinalValue(Loop* loop) { + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisLoopAnalysis); + std::vector inductions; + loop->GetInductionVariables(inductions); + + for (size_t index = 0; index < inductions.size(); ++index) { + uint32_t trip_step_id = GetPhiDefID(state_.previous_phis_[index], + state_.previous_latch_block_->id()); + context_->ReplaceAllUsesWith(inductions[index]->result_id(), trip_step_id); + invalidated_instructions_.push_back(inductions[index]); + } +} + +// Fully unroll the loop by partially unrolling it by the number of loop +// iterations minus one for the body already accounted for. +void LoopUnrollerUtilsImpl::FullyUnroll(Loop* loop) { + // We unroll the loop by number of iterations in the loop. + Unroll(loop, number_of_loop_iterations_); + + // The first condition block is preserved until now so it can be copied. + FoldConditionBlock(loop_condition_block_, 1); + + // Delete the OpLoopMerge and remove the backedge to the header. + CloseUnrolledLoop(loop); + + // Mark the loop for later deletion. This allows us to preserve the loop + // iterators but still disregard dead loops. + loop->MarkLoopForRemoval(); + + // If the loop has a parent add the new blocks to the parent. + if (loop->GetParent()) { + AddBlocksToLoop(loop->GetParent()); + } + + // Add the blocks to the function. + AddBlocksToFunction(loop->GetMergeBlock()); + + ReplaceInductionUseWithFinalValue(loop); + + RemoveDeadInstructions(); + // Invalidate all analyses. + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisLoopAnalysis); +} + +// Copy a given basic block, give it a new result_id, and store the new block +// and the id mapping in the state. |preserve_instructions| is used to determine +// whether or not this function should edit instructions other than the +// |result_id|. +void LoopUnrollerUtilsImpl::CopyBasicBlock(Loop* loop, const BasicBlock* itr, + bool preserve_instructions) { + // Clone the block exactly, including the IDs. + BasicBlock* basic_block = itr->Clone(context_); + basic_block->SetParent(itr->GetParent()); + + // Assign each result a new unique ID and keep a mapping of the old ids to + // the new ones. + AssignNewResultIds(basic_block); + + // If this is the continue block we are copying. + if (itr == loop->GetContinueBlock()) { + // Make the OpLoopMerge point to this block for the continue. + if (!preserve_instructions) { + Instruction* merge_inst = loop->GetHeaderBlock()->GetLoopMergeInst(); + merge_inst->SetInOperand(1, {basic_block->id()}); + } + + state_.new_continue_block = basic_block; + } + + // If this is the header block we are copying. + if (itr == loop->GetHeaderBlock()) { + state_.new_header_block = basic_block; + + if (!preserve_instructions) { + // Remove the loop merge instruction if it exists. + Instruction* merge_inst = basic_block->GetLoopMergeInst(); + if (merge_inst) invalidated_instructions_.push_back(merge_inst); + } + } + + // If this is the latch block being copied, record it in the state. + if (itr == loop->GetLatchBlock()) state_.new_latch_block = basic_block; + + // If this is the condition block we are copying. + if (itr == loop_condition_block_) { + state_.new_condition_block = basic_block; + } + + // Add this block to the list of blocks to add to the function at the end of + // the unrolling process. + blocks_to_add_.push_back(std::unique_ptr(basic_block)); + + // Keep tracking the old block via a map. + state_.new_blocks[itr->id()] = basic_block; +} + +void LoopUnrollerUtilsImpl::CopyBody(Loop* loop, bool eliminate_conditions) { + // Copy each basic block in the loop, give them new ids, and save state + // information. + for (const BasicBlock* itr : loop_blocks_inorder_) { + CopyBasicBlock(loop, itr, false); + } + + // Set the previous latch block to point to the new header. + Instruction& latch_branch = *state_.previous_latch_block_->tail(); + latch_branch.SetInOperand(0, {state_.new_header_block->id()}); + + // As the algorithm copies the original loop blocks exactly, the tail of the + // latch block on iterations after the first one will be a branch to the new + // header and not the actual loop header. The last continue block in the loop + // should always be a backedge to the global header. + Instruction& new_latch_branch = *state_.new_latch_block->tail(); + new_latch_branch.SetInOperand(0, {loop->GetHeaderBlock()->id()}); + + std::vector inductions; + loop->GetInductionVariables(inductions); + for (size_t index = 0; index < inductions.size(); ++index) { + Instruction* master_copy = inductions[index]; + + assert(master_copy->result_id() != 0); + Instruction* induction_clone = + state_.ids_to_new_inst[state_.new_inst[master_copy->result_id()]]; + + state_.new_phis_.push_back(induction_clone); + assert(induction_clone->result_id() != 0); + + if (!state_.previous_phis_.empty()) { + state_.new_inst[master_copy->result_id()] = GetPhiDefID( + state_.previous_phis_[index], state_.previous_latch_block_->id()); + } else { + // Do not replace the first phi block ids. + state_.new_inst[master_copy->result_id()] = master_copy->result_id(); + } + } + + if (eliminate_conditions && + state_.new_condition_block != loop_condition_block_) { + FoldConditionBlock(state_.new_condition_block, 1); + } + + // Only reference to the header block is the backedge in the latch block, + // don't change this. + state_.new_inst[loop->GetHeaderBlock()->id()] = loop->GetHeaderBlock()->id(); + + for (auto& pair : state_.new_blocks) { + RemapOperands(pair.second); + } + + for (Instruction* dead_phi : state_.new_phis_) + invalidated_instructions_.push_back(dead_phi); + + // Swap the state so the new is now the previous. + state_.NextIterationState(); +} + +uint32_t LoopUnrollerUtilsImpl::GetPhiDefID(const Instruction* phi, + uint32_t label) const { + for (uint32_t operand = 3; operand < phi->NumOperands(); operand += 2) { + if (phi->GetSingleWordOperand(operand) == label) { + return phi->GetSingleWordOperand(operand - 1); + } + } + assert(false && "Could not find a phi index matching the provided label"); + return 0; +} + +void LoopUnrollerUtilsImpl::FoldConditionBlock(BasicBlock* condition_block, + uint32_t operand_label) { + // Remove the old conditional branch to the merge and continue blocks. + Instruction& old_branch = *condition_block->tail(); + uint32_t new_target = old_branch.GetSingleWordOperand(operand_label); + + context_->KillInst(&old_branch); + // Add the new unconditional branch to the merge block. + InstructionBuilder builder{context_, condition_block}; + builder.AddBranch(new_target); +} + +void LoopUnrollerUtilsImpl::CloseUnrolledLoop(Loop* loop) { + // Remove the OpLoopMerge instruction from the function. + Instruction* merge_inst = loop->GetHeaderBlock()->GetLoopMergeInst(); + invalidated_instructions_.push_back(merge_inst); + + // Remove the final backedge to the header and make it point instead to the + // merge block. + state_.previous_latch_block_->tail()->SetInOperand( + 0, {loop->GetMergeBlock()->id()}); + + // Remove all induction variables as the phis will now be invalid. Replace all + // uses with the constant initializer value (all uses of phis will be in + // the first iteration with the subsequent phis already having been removed). + std::vector inductions; + loop->GetInductionVariables(inductions); + + // We can use the state instruction mechanism to replace all internal loop + // values within the first loop trip (as the subsequent ones will be updated + // by the copy function) with the value coming in from the preheader and then + // use context ReplaceAllUsesWith for the uses outside the loop with the final + // trip phi value. + state_.new_inst.clear(); + for (Instruction* induction : inductions) { + uint32_t initalizer_id = + GetPhiDefID(induction, loop->GetPreHeaderBlock()->id()); + + state_.new_inst[induction->result_id()] = initalizer_id; + } + + for (BasicBlock* block : loop_blocks_inorder_) { + RemapOperands(block); + } +} + +// Uses the first loop to create a copy of the loop with new IDs. +void LoopUnrollerUtilsImpl::DuplicateLoop(Loop* old_loop, Loop* new_loop) { + std::vector new_block_order; + + // Copy every block in the old loop. + for (const BasicBlock* itr : loop_blocks_inorder_) { + CopyBasicBlock(old_loop, itr, true); + new_block_order.push_back(blocks_to_add_.back().get()); + } + + // Clone the merge block, give it a new id and record it in the state. + BasicBlock* new_merge = old_loop->GetMergeBlock()->Clone(context_); + new_merge->SetParent(old_loop->GetMergeBlock()->GetParent()); + AssignNewResultIds(new_merge); + state_.new_blocks[old_loop->GetMergeBlock()->id()] = new_merge; + + // Remap the operands of every instruction in the loop to point to the new + // copies. + for (auto& pair : state_.new_blocks) { + RemapOperands(pair.second); + } + + loop_blocks_inorder_ = std::move(new_block_order); + + AddBlocksToLoop(new_loop); + + new_loop->SetHeaderBlock(state_.new_header_block); + new_loop->SetContinueBlock(state_.new_continue_block); + new_loop->SetLatchBlock(state_.new_latch_block); + new_loop->SetMergeBlock(new_merge); +} + +// Whenever the utility copies a block it stores it in a tempory buffer, this +// function adds the buffer into the Function. The blocks will be inserted +// after the block |insert_point|. +void LoopUnrollerUtilsImpl::AddBlocksToFunction( + const BasicBlock* insert_point) { + for (auto basic_block_iterator = function_.begin(); + basic_block_iterator != function_.end(); ++basic_block_iterator) { + if (basic_block_iterator->id() == insert_point->id()) { + basic_block_iterator.InsertBefore(&blocks_to_add_); + return; + } + } + + assert( + false && + "Could not add basic blocks to function as insert point was not found."); +} + +// Assign all result_ids in |basic_block| instructions to new IDs and preserve +// the mapping of new ids to old ones. +void LoopUnrollerUtilsImpl::AssignNewResultIds(BasicBlock* basic_block) { + // Label instructions aren't covered by normal traversal of the + // instructions. + uint32_t new_label_id = context_->TakeNextId(); + + // Assign a new id to the label. + state_.new_inst[basic_block->GetLabelInst()->result_id()] = new_label_id; + basic_block->GetLabelInst()->SetResultId(new_label_id); + + for (Instruction& inst : *basic_block) { + uint32_t old_id = inst.result_id(); + + // Ignore stores etc. + if (old_id == 0) { + continue; + } + + // Give the instruction a new id. + inst.SetResultId(context_->TakeNextId()); + + // Save the mapping of old_id -> new_id. + state_.new_inst[old_id] = inst.result_id(); + // Check if this instruction is the induction variable. + if (loop_induction_variable_->result_id() == old_id) { + // Save a pointer to the new copy of it. + state_.new_phi = &inst; + } + state_.ids_to_new_inst[inst.result_id()] = &inst; + } +} + +// For all instructions in |basic_block| check if the operands used are from a +// copied instruction and if so swap out the operand for the copy of it. +void LoopUnrollerUtilsImpl::RemapOperands(BasicBlock* basic_block) { + for (Instruction& inst : *basic_block) { + auto remap_operands_to_new_ids = [this](uint32_t* id) { + auto itr = state_.new_inst.find(*id); + + if (itr != state_.new_inst.end()) { + *id = itr->second; + } + }; + + inst.ForEachInId(remap_operands_to_new_ids); + } +} + +// Generate the ordered list of basic blocks in the |loop| and cache it for +// later use. +void LoopUnrollerUtilsImpl::ComputeLoopOrderedBlocks(Loop* loop) { + loop_blocks_inorder_.clear(); + loop->ComputeLoopStructuredOrder(&loop_blocks_inorder_); +} + +// Adds the blocks_to_add_ to both the loop and to the parent. +void LoopUnrollerUtilsImpl::AddBlocksToLoop(Loop* loop) const { + // Add the blocks to this loop. + for (auto& block_itr : blocks_to_add_) { + loop->AddBasicBlock(block_itr.get()); + } + + // Add the blocks to the parent as well. + if (loop->GetParent()) AddBlocksToLoop(loop->GetParent()); +} + +void LoopUnrollerUtilsImpl::LinkLastPhisToStart(Loop* loop) const { + std::vector inductions; + loop->GetInductionVariables(inductions); + + for (size_t i = 0; i < inductions.size(); ++i) { + Instruction* last_phi_in_block = state_.previous_phis_[i]; + + uint32_t phi_index = + GetPhiIndexFromLabel(state_.previous_latch_block_, last_phi_in_block); + uint32_t phi_variable = + last_phi_in_block->GetSingleWordInOperand(phi_index - 1); + uint32_t phi_label = last_phi_in_block->GetSingleWordInOperand(phi_index); + + Instruction* phi = inductions[i]; + phi->SetInOperand(phi_index - 1, {phi_variable}); + phi->SetInOperand(phi_index, {phi_label}); + } +} + +// Duplicate the |loop| body |factor| number of times while keeping the loop +// backedge intact. +void LoopUnrollerUtilsImpl::PartiallyUnroll(Loop* loop, size_t factor) { + Unroll(loop, factor); + LinkLastPhisToStart(loop); + AddBlocksToLoop(loop); + AddBlocksToFunction(loop->GetMergeBlock()); + RemoveDeadInstructions(); +} + +/* + * End LoopUtilsImpl. + */ + +} // namespace + +/* + * + * Begin Utils. + * + * */ + +bool LoopUtils::CanPerformUnroll() { + // The loop is expected to be in structured order. + if (!loop_->GetHeaderBlock()->GetMergeInst()) { + return false; + } + + // Find check the loop has a condition we can find and evaluate. + const BasicBlock* condition = loop_->FindConditionBlock(); + if (!condition) return false; + + // Check that we can find and process the induction variable. + const Instruction* induction = loop_->FindConditionVariable(condition); + if (!induction || induction->opcode() != SpvOpPhi) return false; + + // Check that we can find the number of loop iterations. + if (!loop_->FindNumberOfIterations(induction, &*condition->ctail(), nullptr)) + return false; + + // Make sure the latch block is a unconditional branch to the header + // block. + const Instruction& branch = *loop_->GetLatchBlock()->ctail(); + bool branching_assumption = + branch.opcode() == SpvOpBranch && + branch.GetSingleWordInOperand(0) == loop_->GetHeaderBlock()->id(); + if (!branching_assumption) { + return false; + } + + std::vector inductions; + loop_->GetInductionVariables(inductions); + + // Ban breaks within the loop. + const std::vector& merge_block_preds = + context_->cfg()->preds(loop_->GetMergeBlock()->id()); + if (merge_block_preds.size() != 1) { + return false; + } + + // Ban continues within the loop. + const std::vector& continue_block_preds = + context_->cfg()->preds(loop_->GetContinueBlock()->id()); + if (continue_block_preds.size() != 1) { + return false; + } + + // Ban returns in the loop. + // Iterate over all the blocks within the loop and check that none of them + // exit the loop. + for (uint32_t label_id : loop_->GetBlocks()) { + const BasicBlock* block = context_->cfg()->block(label_id); + if (block->ctail()->opcode() == SpvOp::SpvOpKill || + block->ctail()->opcode() == SpvOp::SpvOpReturn || + block->ctail()->opcode() == SpvOp::SpvOpReturnValue) { + return false; + } + } + // Can only unroll inner loops. + if (!loop_->AreAllChildrenMarkedForRemoval()) { + return false; + } + + return true; +} + +bool LoopUtils::PartiallyUnroll(size_t factor) { + if (factor == 1 || !CanPerformUnroll()) return false; + + // Create the unroller utility. + LoopUnrollerUtilsImpl unroller{context_, + loop_->GetHeaderBlock()->GetParent()}; + unroller.Init(loop_); + + // If the unrolling factor is larger than or the same size as the loop just + // fully unroll the loop. + if (factor >= unroller.GetLoopIterationCount()) { + unroller.FullyUnroll(loop_); + return true; + } + + // If the loop unrolling factor is an residual number of iterations we need to + // let run the loop for the residual part then let it branch into the unrolled + // remaining part. We add one when calucating the remainder to take into + // account the one iteration already in the loop. + if (unroller.GetLoopIterationCount() % factor != 0) { + unroller.PartiallyUnrollResidualFactor(loop_, factor); + } else { + unroller.PartiallyUnroll(loop_, factor); + } + + return true; +} + +bool LoopUtils::FullyUnroll() { + if (!CanPerformUnroll()) return false; + + std::vector inductions; + loop_->GetInductionVariables(inductions); + + LoopUnrollerUtilsImpl unroller{context_, + loop_->GetHeaderBlock()->GetParent()}; + + unroller.Init(loop_); + unroller.FullyUnroll(loop_); + + return true; +} + +void LoopUtils::Finalize() { + // Clean up the loop descriptor to preserve the analysis. + + LoopDescriptor* LD = context_->GetLoopDescriptor(&function_); + LD->PostModificationCleanup(); +} + +/* + * + * Begin Pass. + * + */ + +Pass::Status LoopUnroller::Process() { + bool changed = false; + for (Function& f : *context()->module()) { + LoopDescriptor* LD = context()->GetLoopDescriptor(&f); + for (Loop& loop : *LD) { + LoopUtils loop_utils{context(), &loop}; + if (!loop.HasUnrollLoopControl() || !loop_utils.CanPerformUnroll()) { + continue; + } + + if (fully_unroll_) { + loop_utils.FullyUnroll(); + } else { + loop_utils.PartiallyUnroll(unroll_factor_); + } + changed = true; + } + LD->PostModificationCleanup(); + } + + return changed ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.h new file mode 100644 index 00000000000..eb358ae2428 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unroller.h @@ -0,0 +1,41 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_UNROLLER_H_ +#define SOURCE_OPT_LOOP_UNROLLER_H_ + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +class LoopUnroller : public Pass { + public: + LoopUnroller() : Pass(), fully_unroll_(true), unroll_factor_(0) {} + LoopUnroller(bool fully_unroll, int unroll_factor) + : Pass(), fully_unroll_(fully_unroll), unroll_factor_(unroll_factor) {} + + const char* name() const override { return "loop-unroll"; } + + Status Process() override; + + private: + bool fully_unroll_; + int unroll_factor_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_UNROLLER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp new file mode 100644 index 00000000000..59a0cbcd379 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.cpp @@ -0,0 +1,898 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/loop_unswitch_pass.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/fold.h" +#include "source/opt/function.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" + +#include "source/opt/loop_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +static const uint32_t kTypePointerStorageClassInIdx = 0; +static const uint32_t kBranchCondTrueLabIdInIdx = 1; +static const uint32_t kBranchCondFalseLabIdInIdx = 2; + +} // anonymous namespace + +namespace { + +// This class handle the unswitch procedure for a given loop. +// The unswitch will not happen if: +// - The loop has any instruction that will prevent it; +// - The loop invariant condition is not uniform. +class LoopUnswitch { + public: + LoopUnswitch(IRContext* context, Function* function, Loop* loop, + LoopDescriptor* loop_desc) + : function_(function), + loop_(loop), + loop_desc_(*loop_desc), + context_(context), + switch_block_(nullptr) {} + + // Returns true if the loop can be unswitched. + // Can be unswitch if: + // - The loop has no instructions that prevents it (such as barrier); + // - The loop has one conditional branch or switch that do not depends on the + // loop; + // - The loop invariant condition is uniform; + bool CanUnswitchLoop() { + if (switch_block_) return true; + if (loop_->IsSafeToClone()) return false; + + CFG& cfg = *context_->cfg(); + + for (uint32_t bb_id : loop_->GetBlocks()) { + BasicBlock* bb = cfg.block(bb_id); + if (bb->terminator()->IsBranch() && + bb->terminator()->opcode() != SpvOpBranch) { + if (IsConditionLoopInvariant(bb->terminator())) { + switch_block_ = bb; + break; + } + } + } + + return switch_block_; + } + + // Return the iterator to the basic block |bb|. + Function::iterator FindBasicBlockPosition(BasicBlock* bb_to_find) { + Function::iterator it = function_->FindBlock(bb_to_find->id()); + assert(it != function_->end() && "Basic Block not found"); + return it; + } + + // Creates a new basic block and insert it into the function |fn| at the + // position |ip|. This function preserves the def/use and instr to block + // managers. + BasicBlock* CreateBasicBlock(Function::iterator ip) { + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + BasicBlock* bb = &*ip.InsertBefore(std::unique_ptr( + new BasicBlock(std::unique_ptr(new Instruction( + context_, SpvOpLabel, 0, context_->TakeNextId(), {}))))); + bb->SetParent(function_); + def_use_mgr->AnalyzeInstDef(bb->GetLabelInst()); + context_->set_instr_block(bb->GetLabelInst(), bb); + + return bb; + } + + // Unswitches |loop_|. + void PerformUnswitch() { + assert(CanUnswitchLoop() && + "Cannot unswitch if there is not constant condition"); + assert(loop_->GetPreHeaderBlock() && "This loop has no pre-header block"); + assert(loop_->IsLCSSA() && "This loop is not in LCSSA form"); + + CFG& cfg = *context_->cfg(); + DominatorTree* dom_tree = + &context_->GetDominatorAnalysis(function_)->GetDomTree(); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + LoopUtils loop_utils(context_, loop_); + + ////////////////////////////////////////////////////////////////////////////// + // Step 1: Create the if merge block for structured modules. + // To do so, the |loop_| merge block will become the if's one and we + // create a merge for the loop. This will limit the amount of duplicated + // code the structured control flow imposes. + // For non structured program, the new loop will be connected to + // the old loop's exit blocks. + ////////////////////////////////////////////////////////////////////////////// + + // Get the merge block if it exists. + BasicBlock* if_merge_block = loop_->GetMergeBlock(); + // The merge block is only created if the loop has a unique exit block. We + // have this guarantee for structured loops, for compute loop it will + // trivially help maintain both a structured-like form and LCSAA. + BasicBlock* loop_merge_block = + if_merge_block + ? CreateBasicBlock(FindBasicBlockPosition(if_merge_block)) + : nullptr; + if (loop_merge_block) { + // Add the instruction and update managers. + InstructionBuilder builder( + context_, loop_merge_block, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + builder.AddBranch(if_merge_block->id()); + builder.SetInsertPoint(&*loop_merge_block->begin()); + cfg.RegisterBlock(loop_merge_block); + def_use_mgr->AnalyzeInstDef(loop_merge_block->GetLabelInst()); + // Update CFG. + if_merge_block->ForEachPhiInst( + [loop_merge_block, &builder, this](Instruction* phi) { + Instruction* cloned = phi->Clone(context_); + builder.AddInstruction(std::unique_ptr(cloned)); + phi->SetInOperand(0, {cloned->result_id()}); + phi->SetInOperand(1, {loop_merge_block->id()}); + for (uint32_t j = phi->NumInOperands() - 1; j > 1; j--) + phi->RemoveInOperand(j); + }); + // Copy the predecessor list (will get invalidated otherwise). + std::vector preds = cfg.preds(if_merge_block->id()); + for (uint32_t pid : preds) { + if (pid == loop_merge_block->id()) continue; + BasicBlock* p_bb = cfg.block(pid); + p_bb->ForEachSuccessorLabel( + [if_merge_block, loop_merge_block](uint32_t* id) { + if (*id == if_merge_block->id()) *id = loop_merge_block->id(); + }); + cfg.AddEdge(pid, loop_merge_block->id()); + } + cfg.RemoveNonExistingEdges(if_merge_block->id()); + // Update loop descriptor. + if (Loop* ploop = loop_->GetParent()) { + ploop->AddBasicBlock(loop_merge_block); + loop_desc_.SetBasicBlockToLoop(loop_merge_block->id(), ploop); + } + + // Update the dominator tree. + DominatorTreeNode* loop_merge_dtn = + dom_tree->GetOrInsertNode(loop_merge_block); + DominatorTreeNode* if_merge_block_dtn = + dom_tree->GetOrInsertNode(if_merge_block); + loop_merge_dtn->parent_ = if_merge_block_dtn->parent_; + loop_merge_dtn->children_.push_back(if_merge_block_dtn); + loop_merge_dtn->parent_->children_.push_back(loop_merge_dtn); + if_merge_block_dtn->parent_->children_.erase(std::find( + if_merge_block_dtn->parent_->children_.begin(), + if_merge_block_dtn->parent_->children_.end(), if_merge_block_dtn)); + + loop_->SetMergeBlock(loop_merge_block); + } + + //////////////////////////////////////////////////////////////////////////// + // Step 2: Build a new preheader for |loop_|, use the old one + // for the constant branch. + //////////////////////////////////////////////////////////////////////////// + + BasicBlock* if_block = loop_->GetPreHeaderBlock(); + // If this preheader is the parent loop header, + // we need to create a dedicated block for the if. + BasicBlock* loop_pre_header = + CreateBasicBlock(++FindBasicBlockPosition(if_block)); + InstructionBuilder( + context_, loop_pre_header, + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping) + .AddBranch(loop_->GetHeaderBlock()->id()); + + if_block->tail()->SetInOperand(0, {loop_pre_header->id()}); + + // Update loop descriptor. + if (Loop* ploop = loop_desc_[if_block]) { + ploop->AddBasicBlock(loop_pre_header); + loop_desc_.SetBasicBlockToLoop(loop_pre_header->id(), ploop); + } + + // Update the CFG. + cfg.RegisterBlock(loop_pre_header); + def_use_mgr->AnalyzeInstDef(loop_pre_header->GetLabelInst()); + cfg.AddEdge(if_block->id(), loop_pre_header->id()); + cfg.RemoveNonExistingEdges(loop_->GetHeaderBlock()->id()); + + loop_->GetHeaderBlock()->ForEachPhiInst( + [loop_pre_header, if_block](Instruction* phi) { + phi->ForEachInId([loop_pre_header, if_block](uint32_t* id) { + if (*id == if_block->id()) { + *id = loop_pre_header->id(); + } + }); + }); + loop_->SetPreHeaderBlock(loop_pre_header); + + // Update the dominator tree. + DominatorTreeNode* loop_pre_header_dtn = + dom_tree->GetOrInsertNode(loop_pre_header); + DominatorTreeNode* if_block_dtn = dom_tree->GetTreeNode(if_block); + loop_pre_header_dtn->parent_ = if_block_dtn; + assert( + if_block_dtn->children_.size() == 1 && + "A loop preheader should only have the header block as a child in the " + "dominator tree"); + loop_pre_header_dtn->children_.push_back(if_block_dtn->children_[0]); + if_block_dtn->children_.clear(); + if_block_dtn->children_.push_back(loop_pre_header_dtn); + + // Make domination queries valid. + dom_tree->ResetDFNumbering(); + + // Compute an ordered list of basic block to clone: loop blocks + pre-header + // + merge block. + loop_->ComputeLoopStructuredOrder(&ordered_loop_blocks_, true, true); + + ///////////////////////////// + // Do the actual unswitch: // + // - Clone the loop // + // - Connect exits // + // - Specialize the loop // + ///////////////////////////// + + Instruction* iv_condition = &*switch_block_->tail(); + SpvOp iv_opcode = iv_condition->opcode(); + Instruction* condition = + def_use_mgr->GetDef(iv_condition->GetOperand(0).words[0]); + + analysis::ConstantManager* cst_mgr = context_->get_constant_mgr(); + const analysis::Type* cond_type = + context_->get_type_mgr()->GetType(condition->type_id()); + + // Build the list of value for which we need to clone and specialize the + // loop. + std::vector> constant_branch; + // Special case for the original loop + Instruction* original_loop_constant_value; + BasicBlock* original_loop_target; + if (iv_opcode == SpvOpBranchConditional) { + constant_branch.emplace_back( + cst_mgr->GetDefiningInstruction(cst_mgr->GetConstant(cond_type, {0})), + nullptr); + original_loop_constant_value = + cst_mgr->GetDefiningInstruction(cst_mgr->GetConstant(cond_type, {1})); + } else { + // We are looking to take the default branch, so we can't provide a + // specific value. + original_loop_constant_value = nullptr; + for (uint32_t i = 2; i < iv_condition->NumInOperands(); i += 2) { + constant_branch.emplace_back( + cst_mgr->GetDefiningInstruction(cst_mgr->GetConstant( + cond_type, iv_condition->GetInOperand(i).words)), + nullptr); + } + } + + // Get the loop landing pads. + std::unordered_set if_merging_blocks; + std::function is_from_original_loop; + if (loop_->GetHeaderBlock()->GetLoopMergeInst()) { + if_merging_blocks.insert(if_merge_block->id()); + is_from_original_loop = [this](uint32_t id) { + return loop_->IsInsideLoop(id) || loop_->GetMergeBlock()->id() == id; + }; + } else { + loop_->GetExitBlocks(&if_merging_blocks); + is_from_original_loop = [this](uint32_t id) { + return loop_->IsInsideLoop(id); + }; + } + + for (auto& specialisation_pair : constant_branch) { + Instruction* specialisation_value = specialisation_pair.first; + ////////////////////////////////////////////////////////// + // Step 3: Duplicate |loop_|. + ////////////////////////////////////////////////////////// + LoopUtils::LoopCloningResult clone_result; + + Loop* cloned_loop = + loop_utils.CloneLoop(&clone_result, ordered_loop_blocks_); + specialisation_pair.second = cloned_loop->GetPreHeaderBlock(); + + //////////////////////////////////// + // Step 4: Specialize the loop. // + //////////////////////////////////// + + { + std::unordered_set dead_blocks; + std::unordered_set unreachable_merges; + SimplifyLoop( + make_range( + UptrVectorIterator(&clone_result.cloned_bb_, + clone_result.cloned_bb_.begin()), + UptrVectorIterator(&clone_result.cloned_bb_, + clone_result.cloned_bb_.end())), + cloned_loop, condition, specialisation_value, &dead_blocks); + + // We tagged dead blocks, create the loop before we invalidate any basic + // block. + cloned_loop = + CleanLoopNest(cloned_loop, dead_blocks, &unreachable_merges); + CleanUpCFG( + UptrVectorIterator(&clone_result.cloned_bb_, + clone_result.cloned_bb_.begin()), + dead_blocks, unreachable_merges); + + /////////////////////////////////////////////////////////// + // Step 5: Connect convergent edges to the landing pads. // + /////////////////////////////////////////////////////////// + + for (uint32_t merge_bb_id : if_merging_blocks) { + BasicBlock* merge = context_->cfg()->block(merge_bb_id); + // We are in LCSSA so we only care about phi instructions. + merge->ForEachPhiInst([is_from_original_loop, &dead_blocks, + &clone_result](Instruction* phi) { + uint32_t num_in_operands = phi->NumInOperands(); + for (uint32_t i = 0; i < num_in_operands; i += 2) { + uint32_t pred = phi->GetSingleWordInOperand(i + 1); + if (is_from_original_loop(pred)) { + pred = clone_result.value_map_.at(pred); + if (!dead_blocks.count(pred)) { + uint32_t incoming_value_id = phi->GetSingleWordInOperand(i); + // Not all the incoming value are coming from the loop. + ValueMapTy::iterator new_value = + clone_result.value_map_.find(incoming_value_id); + if (new_value != clone_result.value_map_.end()) { + incoming_value_id = new_value->second; + } + phi->AddOperand({SPV_OPERAND_TYPE_ID, {incoming_value_id}}); + phi->AddOperand({SPV_OPERAND_TYPE_ID, {pred}}); + } + } + } + }); + } + } + function_->AddBasicBlocks(clone_result.cloned_bb_.begin(), + clone_result.cloned_bb_.end(), + ++FindBasicBlockPosition(if_block)); + } + + // Same as above but specialize the existing loop + { + std::unordered_set dead_blocks; + std::unordered_set unreachable_merges; + SimplifyLoop(make_range(function_->begin(), function_->end()), loop_, + condition, original_loop_constant_value, &dead_blocks); + + for (uint32_t merge_bb_id : if_merging_blocks) { + BasicBlock* merge = context_->cfg()->block(merge_bb_id); + // LCSSA, so we only care about phi instructions. + // If we the phi is reduced to a single incoming branch, do not + // propagate it to preserve LCSSA. + PatchPhis(merge, dead_blocks, true); + } + if (if_merge_block) { + bool has_live_pred = false; + for (uint32_t pid : cfg.preds(if_merge_block->id())) { + if (!dead_blocks.count(pid)) { + has_live_pred = true; + break; + } + } + if (!has_live_pred) unreachable_merges.insert(if_merge_block->id()); + } + original_loop_target = loop_->GetPreHeaderBlock(); + // We tagged dead blocks, prune the loop descriptor from any dead loops. + // After this call, |loop_| can be nullptr (i.e. the unswitch killed this + // loop). + loop_ = CleanLoopNest(loop_, dead_blocks, &unreachable_merges); + + CleanUpCFG(function_->begin(), dead_blocks, unreachable_merges); + } + + ///////////////////////////////////// + // Finally: connect the new loops. // + ///////////////////////////////////// + + // Delete the old jump + context_->KillInst(&*if_block->tail()); + InstructionBuilder builder(context_, if_block); + if (iv_opcode == SpvOpBranchConditional) { + assert(constant_branch.size() == 1); + builder.AddConditionalBranch( + condition->result_id(), original_loop_target->id(), + constant_branch[0].second->id(), + if_merge_block ? if_merge_block->id() : kInvalidId); + } else { + std::vector> targets; + for (auto& t : constant_branch) { + targets.emplace_back(t.first->GetInOperand(0).words, t.second->id()); + } + + builder.AddSwitch(condition->result_id(), original_loop_target->id(), + targets, + if_merge_block ? if_merge_block->id() : kInvalidId); + } + + switch_block_ = nullptr; + ordered_loop_blocks_.clear(); + + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisLoopAnalysis); + } + + // Returns true if the unswitch killed the original |loop_|. + bool WasLoopKilled() const { return loop_ == nullptr; } + + private: + using ValueMapTy = std::unordered_map; + using BlockMapTy = std::unordered_map; + + Function* function_; + Loop* loop_; + LoopDescriptor& loop_desc_; + IRContext* context_; + + BasicBlock* switch_block_; + // Map between instructions and if they are dynamically uniform. + std::unordered_map dynamically_uniform_; + // The loop basic blocks in structured order. + std::vector ordered_loop_blocks_; + + // Returns the next usable id for the context. + uint32_t TakeNextId() { return context_->TakeNextId(); } + + // Patches |bb|'s phi instruction by removing incoming value from unexisting + // or tagged as dead branches. + void PatchPhis(BasicBlock* bb, + const std::unordered_set& dead_blocks, + bool preserve_phi) { + CFG& cfg = *context_->cfg(); + + std::vector phi_to_kill; + const std::vector& bb_preds = cfg.preds(bb->id()); + auto is_branch_dead = [&bb_preds, &dead_blocks](uint32_t id) { + return dead_blocks.count(id) || + std::find(bb_preds.begin(), bb_preds.end(), id) == bb_preds.end(); + }; + bb->ForEachPhiInst([&phi_to_kill, &is_branch_dead, preserve_phi, + this](Instruction* insn) { + uint32_t i = 0; + while (i < insn->NumInOperands()) { + uint32_t incoming_id = insn->GetSingleWordInOperand(i + 1); + if (is_branch_dead(incoming_id)) { + // Remove the incoming block id operand. + insn->RemoveInOperand(i + 1); + // Remove the definition id operand. + insn->RemoveInOperand(i); + continue; + } + i += 2; + } + // If there is only 1 remaining edge, propagate the value and + // kill the instruction. + if (insn->NumInOperands() == 2 && !preserve_phi) { + phi_to_kill.push_back(insn); + context_->ReplaceAllUsesWith(insn->result_id(), + insn->GetSingleWordInOperand(0)); + } + }); + for (Instruction* insn : phi_to_kill) { + context_->KillInst(insn); + } + } + + // Removes any block that is tagged as dead, if the block is in + // |unreachable_merges| then all block's instructions are replaced by a + // OpUnreachable. + void CleanUpCFG(UptrVectorIterator bb_it, + const std::unordered_set& dead_blocks, + const std::unordered_set& unreachable_merges) { + CFG& cfg = *context_->cfg(); + + while (bb_it != bb_it.End()) { + BasicBlock& bb = *bb_it; + + if (unreachable_merges.count(bb.id())) { + if (bb.begin() != bb.tail() || + bb.terminator()->opcode() != SpvOpUnreachable) { + // Make unreachable, but leave the label. + bb.KillAllInsts(false); + InstructionBuilder(context_, &bb).AddUnreachable(); + cfg.RemoveNonExistingEdges(bb.id()); + } + ++bb_it; + } else if (dead_blocks.count(bb.id())) { + cfg.ForgetBlock(&bb); + // Kill this block. + bb.KillAllInsts(true); + bb_it = bb_it.Erase(); + } else { + cfg.RemoveNonExistingEdges(bb.id()); + ++bb_it; + } + } + } + + // Return true if |c_inst| is a Boolean constant and set |cond_val| with the + // value that |c_inst| + bool GetConstCondition(const Instruction* c_inst, bool* cond_val) { + bool cond_is_const; + switch (c_inst->opcode()) { + case SpvOpConstantFalse: { + *cond_val = false; + cond_is_const = true; + } break; + case SpvOpConstantTrue: { + *cond_val = true; + cond_is_const = true; + } break; + default: { cond_is_const = false; } break; + } + return cond_is_const; + } + + // Simplifies |loop| assuming the instruction |to_version_insn| takes the + // value |cst_value|. |block_range| is an iterator range returning the loop + // basic blocks in a structured order (dominator first). + // The function will ignore basic blocks returned by |block_range| if they + // does not belong to the loop. + // The set |dead_blocks| will contain all the dead basic blocks. + // + // Requirements: + // - |loop| must be in the LCSSA form; + // - |cst_value| must be constant or null (to represent the default target + // of an OpSwitch). + void SimplifyLoop(IteratorRange> block_range, + Loop* loop, Instruction* to_version_insn, + Instruction* cst_value, + std::unordered_set* dead_blocks) { + CFG& cfg = *context_->cfg(); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + std::function ignore_node; + ignore_node = [loop](uint32_t bb_id) { return !loop->IsInsideLoop(bb_id); }; + + std::vector> use_list; + def_use_mgr->ForEachUse(to_version_insn, + [&use_list, &ignore_node, this]( + Instruction* inst, uint32_t operand_index) { + BasicBlock* bb = context_->get_instr_block(inst); + + if (!bb || ignore_node(bb->id())) { + // Out of the loop, the specialization does not + // apply any more. + return; + } + use_list.emplace_back(inst, operand_index); + }); + + // First pass: inject the specialized value into the loop (and only the + // loop). + for (auto use : use_list) { + Instruction* inst = use.first; + uint32_t operand_index = use.second; + BasicBlock* bb = context_->get_instr_block(inst); + + // If it is not a branch, simply inject the value. + if (!inst->IsBranch()) { + // To also handle switch, cst_value can be nullptr: this case + // means that we are looking to branch to the default target of + // the switch. We don't actually know its value so we don't touch + // it if it not a switch. + if (cst_value) { + inst->SetOperand(operand_index, {cst_value->result_id()}); + def_use_mgr->AnalyzeInstUse(inst); + } + } + + // The user is a branch, kill dead branches. + uint32_t live_target = 0; + std::unordered_set dead_branches; + switch (inst->opcode()) { + case SpvOpBranchConditional: { + assert(cst_value && "No constant value to specialize !"); + bool branch_cond = false; + if (GetConstCondition(cst_value, &branch_cond)) { + uint32_t true_label = + inst->GetSingleWordInOperand(kBranchCondTrueLabIdInIdx); + uint32_t false_label = + inst->GetSingleWordInOperand(kBranchCondFalseLabIdInIdx); + live_target = branch_cond ? true_label : false_label; + uint32_t dead_target = !branch_cond ? true_label : false_label; + cfg.RemoveEdge(bb->id(), dead_target); + } + break; + } + case SpvOpSwitch: { + live_target = inst->GetSingleWordInOperand(1); + if (cst_value) { + if (!cst_value->IsConstant()) break; + const Operand& cst = cst_value->GetInOperand(0); + for (uint32_t i = 2; i < inst->NumInOperands(); i += 2) { + const Operand& literal = inst->GetInOperand(i); + if (literal == cst) { + live_target = inst->GetSingleWordInOperand(i + 1); + break; + } + } + } + for (uint32_t i = 1; i < inst->NumInOperands(); i += 2) { + uint32_t id = inst->GetSingleWordInOperand(i); + if (id != live_target) { + cfg.RemoveEdge(bb->id(), id); + } + } + } + default: + break; + } + if (live_target != 0) { + // Check for the presence of the merge block. + if (Instruction* merge = bb->GetMergeInst()) context_->KillInst(merge); + context_->KillInst(&*bb->tail()); + InstructionBuilder builder(context_, bb, + IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping); + builder.AddBranch(live_target); + } + } + + // Go through the loop basic block and tag all blocks that are obviously + // dead. + std::unordered_set visited; + for (BasicBlock& bb : block_range) { + if (ignore_node(bb.id())) continue; + visited.insert(bb.id()); + + // Check if this block is dead, if so tag it as dead otherwise patch phi + // instructions. + bool has_live_pred = false; + for (uint32_t pid : cfg.preds(bb.id())) { + if (!dead_blocks->count(pid)) { + has_live_pred = true; + break; + } + } + if (!has_live_pred) { + dead_blocks->insert(bb.id()); + const BasicBlock& cbb = bb; + // Patch the phis for any back-edge. + cbb.ForEachSuccessorLabel( + [dead_blocks, &visited, &cfg, this](uint32_t id) { + if (!visited.count(id) || dead_blocks->count(id)) return; + BasicBlock* succ = cfg.block(id); + PatchPhis(succ, *dead_blocks, false); + }); + continue; + } + // Update the phi instructions, some incoming branch have/will disappear. + PatchPhis(&bb, *dead_blocks, /* preserve_phi = */ false); + } + } + + // Returns true if the header is not reachable or tagged as dead or if we + // never loop back. + bool IsLoopDead(BasicBlock* header, BasicBlock* latch, + const std::unordered_set& dead_blocks) { + if (!header || dead_blocks.count(header->id())) return true; + if (!latch || dead_blocks.count(latch->id())) return true; + for (uint32_t pid : context_->cfg()->preds(header->id())) { + if (!dead_blocks.count(pid)) { + // Seems reachable. + return false; + } + } + return true; + } + + // Cleans the loop nest under |loop| and reflect changes to the loop + // descriptor. This will kill all descriptors that represent dead loops. + // If |loop_| is killed, it will be set to nullptr. + // Any merge blocks that become unreachable will be added to + // |unreachable_merges|. + // The function returns the pointer to |loop| or nullptr if the loop was + // killed. + Loop* CleanLoopNest(Loop* loop, + const std::unordered_set& dead_blocks, + std::unordered_set* unreachable_merges) { + // This represent the pair of dead loop and nearest alive parent (nullptr if + // no parent). + std::unordered_map dead_loops; + auto get_parent = [&dead_loops](Loop* l) -> Loop* { + std::unordered_map::iterator it = dead_loops.find(l); + if (it != dead_loops.end()) return it->second; + return nullptr; + }; + + bool is_main_loop_dead = + IsLoopDead(loop->GetHeaderBlock(), loop->GetLatchBlock(), dead_blocks); + if (is_main_loop_dead) { + if (Instruction* merge = loop->GetHeaderBlock()->GetLoopMergeInst()) { + context_->KillInst(merge); + } + dead_loops[loop] = loop->GetParent(); + } else { + dead_loops[loop] = loop; + } + + // For each loop, check if we killed it. If we did, find a suitable parent + // for its children. + for (Loop& sub_loop : + make_range(++TreeDFIterator(loop), TreeDFIterator())) { + if (IsLoopDead(sub_loop.GetHeaderBlock(), sub_loop.GetLatchBlock(), + dead_blocks)) { + if (Instruction* merge = + sub_loop.GetHeaderBlock()->GetLoopMergeInst()) { + context_->KillInst(merge); + } + dead_loops[&sub_loop] = get_parent(&sub_loop); + } else { + // The loop is alive, check if its merge block is dead, if it is, tag it + // as required. + if (sub_loop.GetMergeBlock()) { + uint32_t merge_id = sub_loop.GetMergeBlock()->id(); + if (dead_blocks.count(merge_id)) { + unreachable_merges->insert(sub_loop.GetMergeBlock()->id()); + } + } + } + } + if (!is_main_loop_dead) dead_loops.erase(loop); + + // Remove dead blocks from live loops. + for (uint32_t bb_id : dead_blocks) { + Loop* l = loop_desc_[bb_id]; + if (l) { + l->RemoveBasicBlock(bb_id); + loop_desc_.ForgetBasicBlock(bb_id); + } + } + + std::for_each( + dead_loops.begin(), dead_loops.end(), + [&loop, + this](std::unordered_map::iterator::reference it) { + if (it.first == loop) loop = nullptr; + loop_desc_.RemoveLoop(it.first); + }); + + return loop; + } + + // Returns true if |var| is dynamically uniform. + // Note: this is currently approximated as uniform. + bool IsDynamicallyUniform(Instruction* var, const BasicBlock* entry, + const DominatorTree& post_dom_tree) { + assert(post_dom_tree.IsPostDominator()); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + auto it = dynamically_uniform_.find(var->result_id()); + + if (it != dynamically_uniform_.end()) return it->second; + + analysis::DecorationManager* dec_mgr = context_->get_decoration_mgr(); + + bool& is_uniform = dynamically_uniform_[var->result_id()]; + is_uniform = false; + + dec_mgr->WhileEachDecoration(var->result_id(), SpvDecorationUniform, + [&is_uniform](const Instruction&) { + is_uniform = true; + return false; + }); + if (is_uniform) { + return is_uniform; + } + + BasicBlock* parent = context_->get_instr_block(var); + if (!parent) { + return is_uniform = true; + } + + if (!post_dom_tree.Dominates(parent->id(), entry->id())) { + return is_uniform = false; + } + if (var->opcode() == SpvOpLoad) { + const uint32_t PtrTypeId = + def_use_mgr->GetDef(var->GetSingleWordInOperand(0))->type_id(); + const Instruction* PtrTypeInst = def_use_mgr->GetDef(PtrTypeId); + uint32_t storage_class = + PtrTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx); + if (storage_class != SpvStorageClassUniform && + storage_class != SpvStorageClassUniformConstant) { + return is_uniform = false; + } + } else { + if (!context_->IsCombinatorInstruction(var)) { + return is_uniform = false; + } + } + + return is_uniform = var->WhileEachInId([entry, &post_dom_tree, + this](const uint32_t* id) { + return IsDynamicallyUniform(context_->get_def_use_mgr()->GetDef(*id), + entry, post_dom_tree); + }); + } + + // Returns true if |insn| is constant and dynamically uniform within the loop. + bool IsConditionLoopInvariant(Instruction* insn) { + assert(insn->IsBranch()); + assert(insn->opcode() != SpvOpBranch); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + Instruction* condition = def_use_mgr->GetDef(insn->GetOperand(0).words[0]); + return !loop_->IsInsideLoop(condition) && + IsDynamicallyUniform( + condition, function_->entry().get(), + context_->GetPostDominatorAnalysis(function_)->GetDomTree()); + } +}; + +} // namespace + +Pass::Status LoopUnswitchPass::Process() { + bool modified = false; + Module* module = context()->module(); + + // Process each function in the module + for (Function& f : *module) { + modified |= ProcessFunction(&f); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool LoopUnswitchPass::ProcessFunction(Function* f) { + bool modified = false; + std::unordered_set processed_loop; + + LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(f); + + bool loop_changed = true; + while (loop_changed) { + loop_changed = false; + for (Loop& loop : + make_range(++TreeDFIterator(loop_descriptor.GetDummyRootLoop()), + TreeDFIterator())) { + if (processed_loop.count(&loop)) continue; + processed_loop.insert(&loop); + + LoopUnswitch unswitcher(context(), f, &loop, &loop_descriptor); + while (!unswitcher.WasLoopKilled() && unswitcher.CanUnswitchLoop()) { + if (!loop.IsLCSSA()) { + LoopUtils(context(), &loop).MakeLoopClosedSSA(); + } + modified = true; + loop_changed = true; + unswitcher.PerformUnswitch(); + } + if (loop_changed) break; + } + } + + return modified; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.h new file mode 100644 index 00000000000..3ecdd611625 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_unswitch_pass.h @@ -0,0 +1,43 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_UNSWITCH_PASS_H_ +#define SOURCE_OPT_LOOP_UNSWITCH_PASS_H_ + +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// Implements the loop unswitch optimization. +// The loop unswitch hoists invariant "if" statements if the conditions are +// constant within the loop and clones the loop for each branch. +class LoopUnswitchPass : public Pass { + public: + const char* name() const override { return "loop-unswitch"; } + + // Processes the given |module|. Returns Status::Failure if errors occur when + // processing. Returns the corresponding Status::Success if processing is + // succesful to indicate whether changes have been made to the modue. + Pass::Status Process() override; + + private: + bool ProcessFunction(Function* f); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_UNSWITCH_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp new file mode 100644 index 00000000000..482335f3bf9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.cpp @@ -0,0 +1,689 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/cfa.h" +#include "source/opt/cfg.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" + +namespace spvtools { +namespace opt { + +namespace { +// Return true if |bb| is dominated by at least one block in |exits| +static inline bool DominatesAnExit(BasicBlock* bb, + const std::unordered_set& exits, + const DominatorTree& dom_tree) { + for (BasicBlock* e_bb : exits) + if (dom_tree.Dominates(bb, e_bb)) return true; + return false; +} + +// Utility class to rewrite out-of-loop uses of an in-loop definition in terms +// of phi instructions to achieve a LCSSA form. +// For a given definition, the class user registers phi instructions using that +// definition in all loop exit blocks by which the definition escapes. +// Then, when rewriting a use of the definition, the rewriter walks the +// paths from the use the loop exits. At each step, it will insert a phi +// instruction to merge the incoming value according to exit blocks definition. +class LCSSARewriter { + public: + LCSSARewriter(IRContext* context, const DominatorTree& dom_tree, + const std::unordered_set& exit_bb, + BasicBlock* merge_block) + : context_(context), + cfg_(context_->cfg()), + dom_tree_(dom_tree), + exit_bb_(exit_bb), + merge_block_id_(merge_block ? merge_block->id() : 0) {} + + struct UseRewriter { + explicit UseRewriter(LCSSARewriter* base, const Instruction& def_insn) + : base_(base), def_insn_(def_insn) {} + // Rewrites the use of |def_insn_| by the instruction |user| at the index + // |operand_index| in terms of phi instruction. This recursively builds new + // phi instructions from |user| to the loop exit blocks' phis. The use of + // |def_insn_| in |user| is replaced by the relevant phi instruction at the + // end of the operation. + // It is assumed that |user| does not dominates any of the loop exit basic + // block. This operation does not update the def/use manager, instead it + // records what needs to be updated. The actual update is performed by + // UpdateManagers. + void RewriteUse(BasicBlock* bb, Instruction* user, uint32_t operand_index) { + assert( + (user->opcode() != SpvOpPhi || bb != GetParent(user)) && + "The root basic block must be the incoming edge if |user| is a phi " + "instruction"); + assert((user->opcode() == SpvOpPhi || bb == GetParent(user)) && + "The root basic block must be the instruction parent if |user| is " + "not " + "phi instruction"); + + Instruction* new_def = GetOrBuildIncoming(bb->id()); + + user->SetOperand(operand_index, {new_def->result_id()}); + rewritten_.insert(user); + } + + // In-place update of some managers (avoid full invalidation). + inline void UpdateManagers() { + analysis::DefUseManager* def_use_mgr = base_->context_->get_def_use_mgr(); + // Register all new definitions. + for (Instruction* insn : rewritten_) { + def_use_mgr->AnalyzeInstDef(insn); + } + // Register all new uses. + for (Instruction* insn : rewritten_) { + def_use_mgr->AnalyzeInstUse(insn); + } + } + + private: + // Return the basic block that |instr| belongs to. + BasicBlock* GetParent(Instruction* instr) { + return base_->context_->get_instr_block(instr); + } + + // Builds a phi instruction for the basic block |bb|. The function assumes + // that |defining_blocks| contains the list of basic block that define the + // usable value for each predecessor of |bb|. + inline Instruction* CreatePhiInstruction( + BasicBlock* bb, const std::vector& defining_blocks) { + std::vector incomings; + const std::vector& bb_preds = base_->cfg_->preds(bb->id()); + assert(bb_preds.size() == defining_blocks.size()); + for (size_t i = 0; i < bb_preds.size(); i++) { + incomings.push_back( + GetOrBuildIncoming(defining_blocks[i])->result_id()); + incomings.push_back(bb_preds[i]); + } + InstructionBuilder builder(base_->context_, &*bb->begin(), + IRContext::kAnalysisInstrToBlockMapping); + Instruction* incoming_phi = + builder.AddPhi(def_insn_.type_id(), incomings); + + rewritten_.insert(incoming_phi); + return incoming_phi; + } + + // Builds a phi instruction for the basic block |bb|, all incoming values + // will be |value|. + inline Instruction* CreatePhiInstruction(BasicBlock* bb, + const Instruction& value) { + std::vector incomings; + const std::vector& bb_preds = base_->cfg_->preds(bb->id()); + for (size_t i = 0; i < bb_preds.size(); i++) { + incomings.push_back(value.result_id()); + incomings.push_back(bb_preds[i]); + } + InstructionBuilder builder(base_->context_, &*bb->begin(), + IRContext::kAnalysisInstrToBlockMapping); + Instruction* incoming_phi = + builder.AddPhi(def_insn_.type_id(), incomings); + + rewritten_.insert(incoming_phi); + return incoming_phi; + } + + // Return the new def to use for the basic block |bb_id|. + // If |bb_id| does not have a suitable def to use then we: + // - return the common def used by all predecessors; + // - if there is no common def, then we build a new phi instr at the + // beginning of |bb_id| and return this new instruction. + Instruction* GetOrBuildIncoming(uint32_t bb_id) { + assert(base_->cfg_->block(bb_id) != nullptr && "Unknown basic block"); + + Instruction*& incoming_phi = bb_to_phi_[bb_id]; + if (incoming_phi) { + return incoming_phi; + } + + BasicBlock* bb = &*base_->cfg_->block(bb_id); + // If this is an exit basic block, look if there already is an eligible + // phi instruction. An eligible phi has |def_insn_| as all incoming + // values. + if (base_->exit_bb_.count(bb)) { + // Look if there is an eligible phi in this block. + if (!bb->WhileEachPhiInst([&incoming_phi, this](Instruction* phi) { + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + if (phi->GetSingleWordInOperand(i) != def_insn_.result_id()) + return true; + } + incoming_phi = phi; + rewritten_.insert(incoming_phi); + return false; + })) { + return incoming_phi; + } + incoming_phi = CreatePhiInstruction(bb, def_insn_); + return incoming_phi; + } + + // Get the block that defines the value to use for each predecessor. + // If the vector has 1 value, then it means that this block does not need + // to build a phi instruction unless |bb_id| is the loop merge block. + const std::vector& defining_blocks = + base_->GetDefiningBlocks(bb_id); + + // Special case for structured loops: merge block might be different from + // the exit block set. To maintain structured properties it will ease + // transformations if the merge block also holds a phi instruction like + // the exit ones. + if (defining_blocks.size() > 1 || bb_id == base_->merge_block_id_) { + if (defining_blocks.size() > 1) { + incoming_phi = CreatePhiInstruction(bb, defining_blocks); + } else { + assert(bb_id == base_->merge_block_id_); + incoming_phi = + CreatePhiInstruction(bb, *GetOrBuildIncoming(defining_blocks[0])); + } + } else { + incoming_phi = GetOrBuildIncoming(defining_blocks[0]); + } + + return incoming_phi; + } + + LCSSARewriter* base_; + const Instruction& def_insn_; + std::unordered_map bb_to_phi_; + std::unordered_set rewritten_; + }; + + private: + // Return the new def to use for the basic block |bb_id|. + // If |bb_id| does not have a suitable def to use then we: + // - return the common def used by all predecessors; + // - if there is no common def, then we build a new phi instr at the + // beginning of |bb_id| and return this new instruction. + const std::vector& GetDefiningBlocks(uint32_t bb_id) { + assert(cfg_->block(bb_id) != nullptr && "Unknown basic block"); + std::vector& defining_blocks = bb_to_defining_blocks_[bb_id]; + + if (defining_blocks.size()) return defining_blocks; + + // Check if one of the loop exit basic block dominates |bb_id|. + for (const BasicBlock* e_bb : exit_bb_) { + if (dom_tree_.Dominates(e_bb->id(), bb_id)) { + defining_blocks.push_back(e_bb->id()); + return defining_blocks; + } + } + + // Process parents, they will returns their suitable blocks. + // If they are all the same, this means this basic block is dominated by a + // common block, so we won't need to build a phi instruction. + for (uint32_t pred_id : cfg_->preds(bb_id)) { + const std::vector& pred_blocks = GetDefiningBlocks(pred_id); + if (pred_blocks.size() == 1) + defining_blocks.push_back(pred_blocks[0]); + else + defining_blocks.push_back(pred_id); + } + assert(defining_blocks.size()); + if (std::all_of(defining_blocks.begin(), defining_blocks.end(), + [&defining_blocks](uint32_t id) { + return id == defining_blocks[0]; + })) { + // No need for a phi. + defining_blocks.resize(1); + } + + return defining_blocks; + } + + IRContext* context_; + CFG* cfg_; + const DominatorTree& dom_tree_; + const std::unordered_set& exit_bb_; + uint32_t merge_block_id_; + // This map represent the set of known paths. For each key, the vector + // represent the set of blocks holding the definition to be used to build the + // phi instruction. + // If the vector has 0 value, then the path is unknown yet, and must be built. + // If the vector has 1 value, then the value defined by that basic block + // should be used. + // If the vector has more than 1 value, then a phi node must be created, the + // basic block ordering is the same as the predecessor ordering. + std::unordered_map> bb_to_defining_blocks_; +}; + +// Make the set |blocks| closed SSA. The set is closed SSA if all the uses +// outside the set are phi instructions in exiting basic block set (hold by +// |lcssa_rewriter|). +inline void MakeSetClosedSSA(IRContext* context, Function* function, + const std::unordered_set& blocks, + const std::unordered_set& exit_bb, + LCSSARewriter* lcssa_rewriter) { + CFG& cfg = *context->cfg(); + DominatorTree& dom_tree = + context->GetDominatorAnalysis(function)->GetDomTree(); + analysis::DefUseManager* def_use_manager = context->get_def_use_mgr(); + + for (uint32_t bb_id : blocks) { + BasicBlock* bb = cfg.block(bb_id); + // If bb does not dominate an exit block, then it cannot have escaping defs. + if (!DominatesAnExit(bb, exit_bb, dom_tree)) continue; + for (Instruction& inst : *bb) { + LCSSARewriter::UseRewriter rewriter(lcssa_rewriter, inst); + def_use_manager->ForEachUse( + &inst, [&blocks, &rewriter, &exit_bb, context]( + Instruction* use, uint32_t operand_index) { + BasicBlock* use_parent = context->get_instr_block(use); + assert(use_parent); + if (blocks.count(use_parent->id())) return; + + if (use->opcode() == SpvOpPhi) { + // If the use is a Phi instruction and the incoming block is + // coming from the loop, then that's consistent with LCSSA form. + if (exit_bb.count(use_parent)) { + return; + } else { + // That's not an exit block, but the user is a phi instruction. + // Consider the incoming branch only. + use_parent = context->get_instr_block( + use->GetSingleWordOperand(operand_index + 1)); + } + } + // Rewrite the use. Note that this call does not invalidate the + // def/use manager. So this operation is safe. + rewriter.RewriteUse(use_parent, use, operand_index); + }); + rewriter.UpdateManagers(); + } + } +} + +} // namespace + +void LoopUtils::CreateLoopDedicatedExits() { + Function* function = loop_->GetHeaderBlock()->GetParent(); + LoopDescriptor& loop_desc = *context_->GetLoopDescriptor(function); + CFG& cfg = *context_->cfg(); + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + const IRContext::Analysis PreservedAnalyses = + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping; + + // Gathers the set of basic block that are not in this loop and have at least + // one predecessor in the loop and one not in the loop. + std::unordered_set exit_bb_set; + loop_->GetExitBlocks(&exit_bb_set); + + std::unordered_set new_loop_exits; + bool made_change = false; + // For each block, we create a new one that gathers all branches from + // the loop and fall into the block. + for (uint32_t non_dedicate_id : exit_bb_set) { + BasicBlock* non_dedicate = cfg.block(non_dedicate_id); + const std::vector& bb_pred = cfg.preds(non_dedicate_id); + // Ignore the block if all the predecessors are in the loop. + if (std::all_of(bb_pred.begin(), bb_pred.end(), + [this](uint32_t id) { return loop_->IsInsideLoop(id); })) { + new_loop_exits.insert(non_dedicate); + continue; + } + + made_change = true; + Function::iterator insert_pt = function->begin(); + for (; insert_pt != function->end() && &*insert_pt != non_dedicate; + ++insert_pt) { + } + assert(insert_pt != function->end() && "Basic Block not found"); + + // Create the dedicate exit basic block. + BasicBlock& exit = *insert_pt.InsertBefore(std::unique_ptr( + new BasicBlock(std::unique_ptr(new Instruction( + context_, SpvOpLabel, 0, context_->TakeNextId(), {}))))); + exit.SetParent(function); + + // Redirect in loop predecessors to |exit| block. + for (uint32_t exit_pred_id : bb_pred) { + if (loop_->IsInsideLoop(exit_pred_id)) { + BasicBlock* pred_block = cfg.block(exit_pred_id); + pred_block->ForEachSuccessorLabel([non_dedicate, &exit](uint32_t* id) { + if (*id == non_dedicate->id()) *id = exit.id(); + }); + // Update the CFG. + // |non_dedicate|'s predecessor list will be updated at the end of the + // loop. + cfg.RegisterBlock(pred_block); + } + } + + // Register the label to the def/use manager, requires for the phi patching. + def_use_mgr->AnalyzeInstDefUse(exit.GetLabelInst()); + context_->set_instr_block(exit.GetLabelInst(), &exit); + + InstructionBuilder builder(context_, &exit, PreservedAnalyses); + // Now jump from our dedicate basic block to the old exit. + // We also reset the insert point so all instructions are inserted before + // the branch. + builder.SetInsertPoint(builder.AddBranch(non_dedicate->id())); + non_dedicate->ForEachPhiInst( + [&builder, &exit, def_use_mgr, this](Instruction* phi) { + // New phi operands for this instruction. + std::vector new_phi_op; + // Phi operands for the dedicated exit block. + std::vector exit_phi_op; + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + uint32_t def_id = phi->GetSingleWordInOperand(i); + uint32_t incoming_id = phi->GetSingleWordInOperand(i + 1); + if (loop_->IsInsideLoop(incoming_id)) { + exit_phi_op.push_back(def_id); + exit_phi_op.push_back(incoming_id); + } else { + new_phi_op.push_back(def_id); + new_phi_op.push_back(incoming_id); + } + } + + // Build the new phi instruction dedicated exit block. + Instruction* exit_phi = builder.AddPhi(phi->type_id(), exit_phi_op); + // Build the new incoming branch. + new_phi_op.push_back(exit_phi->result_id()); + new_phi_op.push_back(exit.id()); + // Rewrite operands. + uint32_t idx = 0; + for (; idx < new_phi_op.size(); idx++) + phi->SetInOperand(idx, {new_phi_op[idx]}); + // Remove extra operands, from last to first (more efficient). + for (uint32_t j = phi->NumInOperands() - 1; j >= idx; j--) + phi->RemoveInOperand(j); + // Update the def/use manager for this |phi|. + def_use_mgr->AnalyzeInstUse(phi); + }); + // Update the CFG. + cfg.RegisterBlock(&exit); + cfg.RemoveNonExistingEdges(non_dedicate->id()); + new_loop_exits.insert(&exit); + // If non_dedicate is in a loop, add the new dedicated exit in that loop. + if (Loop* parent_loop = loop_desc[non_dedicate]) + parent_loop->AddBasicBlock(&exit); + } + + if (new_loop_exits.size() == 1) { + loop_->SetMergeBlock(*new_loop_exits.begin()); + } + + if (made_change) { + context_->InvalidateAnalysesExceptFor( + PreservedAnalyses | IRContext::kAnalysisCFG | + IRContext::Analysis::kAnalysisLoopAnalysis); + } +} + +void LoopUtils::MakeLoopClosedSSA() { + CreateLoopDedicatedExits(); + + Function* function = loop_->GetHeaderBlock()->GetParent(); + CFG& cfg = *context_->cfg(); + DominatorTree& dom_tree = + context_->GetDominatorAnalysis(function)->GetDomTree(); + + std::unordered_set exit_bb; + { + std::unordered_set exit_bb_id; + loop_->GetExitBlocks(&exit_bb_id); + for (uint32_t bb_id : exit_bb_id) { + exit_bb.insert(cfg.block(bb_id)); + } + } + + LCSSARewriter lcssa_rewriter(context_, dom_tree, exit_bb, + loop_->GetMergeBlock()); + MakeSetClosedSSA(context_, function, loop_->GetBlocks(), exit_bb, + &lcssa_rewriter); + + // Make sure all defs post-dominated by the merge block have their last use no + // further than the merge block. + if (loop_->GetMergeBlock()) { + std::unordered_set merging_bb_id; + loop_->GetMergingBlocks(&merging_bb_id); + merging_bb_id.erase(loop_->GetMergeBlock()->id()); + // Reset the exit set, now only the merge block is the exit. + exit_bb.clear(); + exit_bb.insert(loop_->GetMergeBlock()); + // LCSSARewriter is reusable here only because it forces the creation of a + // phi instruction in the merge block. + MakeSetClosedSSA(context_, function, merging_bb_id, exit_bb, + &lcssa_rewriter); + } + + context_->InvalidateAnalysesExceptFor( + IRContext::Analysis::kAnalysisCFG | + IRContext::Analysis::kAnalysisDominatorAnalysis | + IRContext::Analysis::kAnalysisLoopAnalysis); +} + +Loop* LoopUtils::CloneLoop(LoopCloningResult* cloning_result) const { + // Compute the structured order of the loop basic blocks and store it in the + // vector ordered_loop_blocks. + std::vector ordered_loop_blocks; + loop_->ComputeLoopStructuredOrder(&ordered_loop_blocks); + + // Clone the loop. + return CloneLoop(cloning_result, ordered_loop_blocks); +} + +Loop* LoopUtils::CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result) { + // Clone the loop. + Loop* new_loop = CloneLoop(cloning_result); + + // Create a new exit block/label for the new loop. + std::unique_ptr new_label{new Instruction( + context_, SpvOp::SpvOpLabel, 0, context_->TakeNextId(), {})}; + std::unique_ptr new_exit_bb{new BasicBlock(std::move(new_label))}; + new_exit_bb->SetParent(loop_->GetMergeBlock()->GetParent()); + + // Create an unconditional branch to the header block. + InstructionBuilder builder{context_, new_exit_bb.get()}; + builder.AddBranch(loop_->GetHeaderBlock()->id()); + + // Save the ids of the new and old merge block. + const uint32_t old_merge_block = loop_->GetMergeBlock()->id(); + const uint32_t new_merge_block = new_exit_bb->id(); + + // Replace the uses of the old merge block in the new loop with the new merge + // block. + for (std::unique_ptr& basic_block : cloning_result->cloned_bb_) { + for (Instruction& inst : *basic_block) { + // For each operand in each instruction check if it is using the old merge + // block and change it to be the new merge block. + auto replace_merge_use = [old_merge_block, + new_merge_block](uint32_t* id) { + if (*id == old_merge_block) *id = new_merge_block; + }; + inst.ForEachInOperand(replace_merge_use); + } + } + + const uint32_t old_header = loop_->GetHeaderBlock()->id(); + const uint32_t new_header = new_loop->GetHeaderBlock()->id(); + analysis::DefUseManager* def_use = context_->get_def_use_mgr(); + + def_use->ForEachUse(old_header, + [new_header, this](Instruction* inst, uint32_t operand) { + if (!this->loop_->IsInsideLoop(inst)) + inst->SetOperand(operand, {new_header}); + }); + + def_use->ForEachUse( + loop_->GetOrCreatePreHeaderBlock()->id(), + [new_merge_block, this](Instruction* inst, uint32_t operand) { + if (this->loop_->IsInsideLoop(inst)) + inst->SetOperand(operand, {new_merge_block}); + + }); + new_loop->SetMergeBlock(new_exit_bb.get()); + + new_loop->SetPreHeaderBlock(loop_->GetPreHeaderBlock()); + + // Add the new block into the cloned instructions. + cloning_result->cloned_bb_.push_back(std::move(new_exit_bb)); + + return new_loop; +} + +Loop* LoopUtils::CloneLoop( + LoopCloningResult* cloning_result, + const std::vector& ordered_loop_blocks) const { + analysis::DefUseManager* def_use_mgr = context_->get_def_use_mgr(); + + std::unique_ptr new_loop = MakeUnique(context_); + + CFG& cfg = *context_->cfg(); + + // Clone and place blocks in a SPIR-V compliant order (dominators first). + for (BasicBlock* old_bb : ordered_loop_blocks) { + // For each basic block in the loop, we clone it and register the mapping + // between old and new ids. + BasicBlock* new_bb = old_bb->Clone(context_); + new_bb->SetParent(&function_); + new_bb->GetLabelInst()->SetResultId(context_->TakeNextId()); + def_use_mgr->AnalyzeInstDef(new_bb->GetLabelInst()); + context_->set_instr_block(new_bb->GetLabelInst(), new_bb); + cloning_result->cloned_bb_.emplace_back(new_bb); + + cloning_result->old_to_new_bb_[old_bb->id()] = new_bb; + cloning_result->new_to_old_bb_[new_bb->id()] = old_bb; + cloning_result->value_map_[old_bb->id()] = new_bb->id(); + + if (loop_->IsInsideLoop(old_bb)) new_loop->AddBasicBlock(new_bb); + + for (auto new_inst = new_bb->begin(), old_inst = old_bb->begin(); + new_inst != new_bb->end(); ++new_inst, ++old_inst) { + cloning_result->ptr_map_[&*new_inst] = &*old_inst; + if (new_inst->HasResultId()) { + new_inst->SetResultId(context_->TakeNextId()); + cloning_result->value_map_[old_inst->result_id()] = + new_inst->result_id(); + + // Only look at the defs for now, uses are not updated yet. + def_use_mgr->AnalyzeInstDef(&*new_inst); + } + } + } + + // All instructions (including all labels) have been cloned, + // remap instruction operands id with the new ones. + for (std::unique_ptr& bb_ref : cloning_result->cloned_bb_) { + BasicBlock* bb = bb_ref.get(); + + for (Instruction& insn : *bb) { + insn.ForEachInId([cloning_result](uint32_t* old_id) { + // If the operand is defined in the loop, remap the id. + auto id_it = cloning_result->value_map_.find(*old_id); + if (id_it != cloning_result->value_map_.end()) { + *old_id = id_it->second; + } + }); + // Only look at what the instruction uses. All defs are register, so all + // should be fine now. + def_use_mgr->AnalyzeInstUse(&insn); + context_->set_instr_block(&insn, bb); + } + cfg.RegisterBlock(bb); + } + + PopulateLoopNest(new_loop.get(), *cloning_result); + + return new_loop.release(); +} + +void LoopUtils::PopulateLoopNest( + Loop* new_loop, const LoopCloningResult& cloning_result) const { + std::unordered_map loop_mapping; + loop_mapping[loop_] = new_loop; + + if (loop_->HasParent()) loop_->GetParent()->AddNestedLoop(new_loop); + PopulateLoopDesc(new_loop, loop_, cloning_result); + + for (Loop& sub_loop : + make_range(++TreeDFIterator(loop_), TreeDFIterator())) { + Loop* cloned = new Loop(context_); + if (Loop* parent = loop_mapping[sub_loop.GetParent()]) + parent->AddNestedLoop(cloned); + loop_mapping[&sub_loop] = cloned; + PopulateLoopDesc(cloned, &sub_loop, cloning_result); + } + + loop_desc_->AddLoopNest(std::unique_ptr(new_loop)); +} + +// Populates |new_loop| descriptor according to |old_loop|'s one. +void LoopUtils::PopulateLoopDesc( + Loop* new_loop, Loop* old_loop, + const LoopCloningResult& cloning_result) const { + for (uint32_t bb_id : old_loop->GetBlocks()) { + BasicBlock* bb = cloning_result.old_to_new_bb_.at(bb_id); + new_loop->AddBasicBlock(bb); + } + new_loop->SetHeaderBlock( + cloning_result.old_to_new_bb_.at(old_loop->GetHeaderBlock()->id())); + if (old_loop->GetLatchBlock()) + new_loop->SetLatchBlock( + cloning_result.old_to_new_bb_.at(old_loop->GetLatchBlock()->id())); + if (old_loop->GetContinueBlock()) + new_loop->SetContinueBlock( + cloning_result.old_to_new_bb_.at(old_loop->GetContinueBlock()->id())); + if (old_loop->GetMergeBlock()) { + auto it = + cloning_result.old_to_new_bb_.find(old_loop->GetMergeBlock()->id()); + BasicBlock* bb = it != cloning_result.old_to_new_bb_.end() + ? it->second + : old_loop->GetMergeBlock(); + new_loop->SetMergeBlock(bb); + } + if (old_loop->GetPreHeaderBlock()) { + auto it = + cloning_result.old_to_new_bb_.find(old_loop->GetPreHeaderBlock()->id()); + if (it != cloning_result.old_to_new_bb_.end()) { + new_loop->SetPreHeaderBlock(it->second); + } + } +} + +// Class to gather some metrics about a region of interest. +void CodeMetrics::Analyze(const Loop& loop) { + CFG& cfg = *loop.GetContext()->cfg(); + + roi_size_ = 0; + block_sizes_.clear(); + + for (uint32_t id : loop.GetBlocks()) { + const BasicBlock* bb = cfg.block(id); + size_t bb_size = 0; + bb->ForEachInst([&bb_size](const Instruction* insn) { + if (insn->opcode() == SpvOpLabel) return; + if (insn->IsNop()) return; + if (insn->opcode() == SpvOpPhi) return; + bb_size++; + }); + block_sizes_[bb->id()] = bb_size; + roi_size_ += bb_size; + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.h new file mode 100644 index 00000000000..a4e61900bc7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/loop_utils.h @@ -0,0 +1,182 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_LOOP_UTILS_H_ +#define SOURCE_OPT_LOOP_UTILS_H_ + +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/loop_descriptor.h" + +namespace spvtools { + +namespace opt { + +// Class to gather some metrics about a Region Of Interest (ROI). +// So far it counts the number of instructions in a ROI (excluding debug +// and label instructions) per basic block and in total. +struct CodeMetrics { + void Analyze(const Loop& loop); + + // The number of instructions per basic block in the ROI. + std::unordered_map block_sizes_; + + // Number of instruction in the ROI. + size_t roi_size_; +}; + +// LoopUtils is used to encapsulte loop optimizations and from the passes which +// use them. Any pass which needs a loop optimization should do it through this +// or through a pass which is using this. +class LoopUtils { + public: + // Holds a auxiliary results of the loop cloning procedure. + struct LoopCloningResult { + using ValueMapTy = std::unordered_map; + using BlockMapTy = std::unordered_map; + using PtrMap = std::unordered_map; + + PtrMap ptr_map_; + + // Mapping between the original loop ids and the new one. + ValueMapTy value_map_; + // Mapping between original loop blocks to the cloned one. + BlockMapTy old_to_new_bb_; + // Mapping between the cloned loop blocks to original one. + BlockMapTy new_to_old_bb_; + // List of cloned basic block. + std::vector> cloned_bb_; + }; + + LoopUtils(IRContext* context, Loop* loop) + : context_(context), + loop_desc_( + context->GetLoopDescriptor(loop->GetHeaderBlock()->GetParent())), + loop_(loop), + function_(*loop_->GetHeaderBlock()->GetParent()) {} + + // The converts the current loop to loop closed SSA form. + // In the loop closed SSA, all loop exiting values go through a dedicated Phi + // instruction. For instance: + // + // for (...) { + // A1 = ... + // if (...) + // A2 = ... + // A = phi A1, A2 + // } + // ... = op A ... + // + // Becomes + // + // for (...) { + // A1 = ... + // if (...) + // A2 = ... + // A = phi A1, A2 + // } + // C = phi A + // ... = op C ... + // + // This makes some loop transformations (such as loop unswitch) simpler + // (removes the needs to take care of exiting variables). + void MakeLoopClosedSSA(); + + // Create dedicate exit basic block. This ensure all exit basic blocks has the + // loop as sole predecessors. + // By construction, structured control flow already has a dedicated exit + // block. + // Preserves: CFG, def/use and instruction to block mapping. + void CreateLoopDedicatedExits(); + + // Clone |loop_| and remap its instructions. Newly created blocks + // will be added to the |cloning_result.cloned_bb_| list, correctly ordered to + // be inserted into a function. + // It is assumed that |ordered_loop_blocks| is compatible with the result of + // |Loop::ComputeLoopStructuredOrder|. If the preheader and merge block are in + // the list they will also be cloned. If not, the resulting loop will share + // them with the original loop. + // The function preserves the def/use, cfg and instr to block analyses. + // The cloned loop nest will be added to the loop descriptor and will have + // ownership. + Loop* CloneLoop(LoopCloningResult* cloning_result, + const std::vector& ordered_loop_blocks) const; + // Clone |loop_| and remap its instructions, as above. Overload to compute + // loop block ordering within method rather than taking in as parameter. + Loop* CloneLoop(LoopCloningResult* cloning_result) const; + + // Clone the |loop_| and make the new loop branch to the second loop on exit. + Loop* CloneAndAttachLoopToHeader(LoopCloningResult* cloning_result); + + // Perfom a partial unroll of |loop| by given |factor|. This will copy the + // body of the loop |factor| times. So a |factor| of one would give a new loop + // with the original body plus one unrolled copy body. + bool PartiallyUnroll(size_t factor); + + // Fully unroll |loop|. + bool FullyUnroll(); + + // This function validates that |loop| meets the assumptions made by the + // implementation of the loop unroller. As the implementation accommodates + // more types of loops this function can reduce its checks. + // + // The conditions checked to ensure the loop can be unrolled are as follows: + // 1. That the loop is in structured order. + // 2. That the continue block is a branch to the header. + // 3. That the only phi used in the loop is the induction variable. + // TODO(stephen@codeplay.com): This is a temporary mesure, after the loop is + // converted into LCSAA form and has a single entry and exit we can rewrite + // the other phis. + // 4. That this is an inner most loop, or that loops contained within this + // loop have already been fully unrolled. + // 5. That each instruction in the loop is only used within the loop. + // (Related to the above phi condition). + bool CanPerformUnroll(); + + // Maintains the loop descriptor object after the unroll functions have been + // called, otherwise the analysis should be invalidated. + void Finalize(); + + // Returns the context associate to |loop_|. + IRContext* GetContext() { return context_; } + // Returns the loop descriptor owning |loop_|. + LoopDescriptor* GetLoopDescriptor() { return loop_desc_; } + // Returns the loop on which the object operates on. + Loop* GetLoop() const { return loop_; } + // Returns the function that |loop_| belong to. + Function* GetFunction() const { return &function_; } + + private: + IRContext* context_; + LoopDescriptor* loop_desc_; + Loop* loop_; + Function& function_; + + // Populates the loop nest of |new_loop| according to |loop_| nest. + void PopulateLoopNest(Loop* new_loop, + const LoopCloningResult& cloning_result) const; + + // Populates |new_loop| descriptor according to |old_loop|'s one. + void PopulateLoopDesc(Loop* new_loop, Loop* old_loop, + const LoopCloningResult& cloning_result) const; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_LOOP_UTILS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp new file mode 100644 index 00000000000..c65e04938aa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.cpp @@ -0,0 +1,495 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/mem_pass.h" + +#include +#include +#include + +#include "source/cfa.h" +#include "source/opt/basic_block.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kCopyObjectOperandInIdx = 0; +const uint32_t kTypePointerStorageClassInIdx = 0; +const uint32_t kTypePointerTypeIdInIdx = 1; + +} // namespace + +bool MemPass::IsBaseTargetType(const Instruction* typeInst) const { + switch (typeInst->opcode()) { + case SpvOpTypeInt: + case SpvOpTypeFloat: + case SpvOpTypeBool: + case SpvOpTypeVector: + case SpvOpTypeMatrix: + case SpvOpTypeImage: + case SpvOpTypeSampler: + case SpvOpTypeSampledImage: + case SpvOpTypePointer: + return true; + default: + break; + } + return false; +} + +bool MemPass::IsTargetType(const Instruction* typeInst) const { + if (IsBaseTargetType(typeInst)) return true; + if (typeInst->opcode() == SpvOpTypeArray) { + if (!IsTargetType( + get_def_use_mgr()->GetDef(typeInst->GetSingleWordOperand(1)))) { + return false; + } + return true; + } + if (typeInst->opcode() != SpvOpTypeStruct) return false; + // All struct members must be math type + return typeInst->WhileEachInId([this](const uint32_t* tid) { + Instruction* compTypeInst = get_def_use_mgr()->GetDef(*tid); + if (!IsTargetType(compTypeInst)) return false; + return true; + }); +} + +bool MemPass::IsNonPtrAccessChain(const SpvOp opcode) const { + return opcode == SpvOpAccessChain || opcode == SpvOpInBoundsAccessChain; +} + +bool MemPass::IsPtr(uint32_t ptrId) { + uint32_t varId = ptrId; + Instruction* ptrInst = get_def_use_mgr()->GetDef(varId); + while (ptrInst->opcode() == SpvOpCopyObject) { + varId = ptrInst->GetSingleWordInOperand(kCopyObjectOperandInIdx); + ptrInst = get_def_use_mgr()->GetDef(varId); + } + const SpvOp op = ptrInst->opcode(); + if (op == SpvOpVariable || IsNonPtrAccessChain(op)) return true; + if (op != SpvOpFunctionParameter) return false; + const uint32_t varTypeId = ptrInst->type_id(); + const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); + return varTypeInst->opcode() == SpvOpTypePointer; +} + +Instruction* MemPass::GetPtr(uint32_t ptrId, uint32_t* varId) { + *varId = ptrId; + Instruction* ptrInst = get_def_use_mgr()->GetDef(*varId); + Instruction* varInst; + + if (ptrInst->opcode() != SpvOpVariable && + ptrInst->opcode() != SpvOpFunctionParameter) { + varInst = ptrInst->GetBaseAddress(); + } else { + varInst = ptrInst; + } + if (varInst->opcode() == SpvOpVariable) { + *varId = varInst->result_id(); + } else { + *varId = 0; + } + + while (ptrInst->opcode() == SpvOpCopyObject) { + uint32_t temp = ptrInst->GetSingleWordInOperand(0); + ptrInst = get_def_use_mgr()->GetDef(temp); + } + + return ptrInst; +} + +Instruction* MemPass::GetPtr(Instruction* ip, uint32_t* varId) { + assert(ip->opcode() == SpvOpStore || ip->opcode() == SpvOpLoad || + ip->opcode() == SpvOpImageTexelPointer); + + // All of these opcode place the pointer in position 0. + const uint32_t ptrId = ip->GetSingleWordInOperand(0); + return GetPtr(ptrId, varId); +} + +bool MemPass::HasOnlyNamesAndDecorates(uint32_t id) const { + return get_def_use_mgr()->WhileEachUser(id, [this](Instruction* user) { + SpvOp op = user->opcode(); + if (op != SpvOpName && !IsNonTypeDecorate(op)) { + return false; + } + return true; + }); +} + +void MemPass::KillAllInsts(BasicBlock* bp, bool killLabel) { + bp->KillAllInsts(killLabel); +} + +bool MemPass::HasLoads(uint32_t varId) const { + return !get_def_use_mgr()->WhileEachUser(varId, [this](Instruction* user) { + SpvOp op = user->opcode(); + // TODO(): The following is slightly conservative. Could be + // better handling of non-store/name. + if (IsNonPtrAccessChain(op) || op == SpvOpCopyObject) { + if (HasLoads(user->result_id())) { + return false; + } + } else if (op != SpvOpStore && op != SpvOpName && !IsNonTypeDecorate(op)) { + return false; + } + return true; + }); +} + +bool MemPass::IsLiveVar(uint32_t varId) const { + const Instruction* varInst = get_def_use_mgr()->GetDef(varId); + // assume live if not a variable eg. function parameter + if (varInst->opcode() != SpvOpVariable) return true; + // non-function scope vars are live + const uint32_t varTypeId = varInst->type_id(); + const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); + if (varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) != + SpvStorageClassFunction) + return true; + // test if variable is loaded from + return HasLoads(varId); +} + +void MemPass::AddStores(uint32_t ptr_id, std::queue* insts) { + get_def_use_mgr()->ForEachUser(ptr_id, [this, insts](Instruction* user) { + SpvOp op = user->opcode(); + if (IsNonPtrAccessChain(op)) { + AddStores(user->result_id(), insts); + } else if (op == SpvOpStore) { + insts->push(user); + } + }); +} + +void MemPass::DCEInst(Instruction* inst, + const std::function& call_back) { + std::queue deadInsts; + deadInsts.push(inst); + while (!deadInsts.empty()) { + Instruction* di = deadInsts.front(); + // Don't delete labels + if (di->opcode() == SpvOpLabel) { + deadInsts.pop(); + continue; + } + // Remember operands + std::set ids; + di->ForEachInId([&ids](uint32_t* iid) { ids.insert(*iid); }); + uint32_t varId = 0; + // Remember variable if dead load + if (di->opcode() == SpvOpLoad) (void)GetPtr(di, &varId); + if (call_back) { + call_back(di); + } + context()->KillInst(di); + // For all operands with no remaining uses, add their instruction + // to the dead instruction queue. + for (auto id : ids) + if (HasOnlyNamesAndDecorates(id)) { + Instruction* odi = get_def_use_mgr()->GetDef(id); + if (context()->IsCombinatorInstruction(odi)) deadInsts.push(odi); + } + // if a load was deleted and it was the variable's + // last load, add all its stores to dead queue + if (varId != 0 && !IsLiveVar(varId)) AddStores(varId, &deadInsts); + deadInsts.pop(); + } +} + +MemPass::MemPass() {} + +bool MemPass::HasOnlySupportedRefs(uint32_t varId) { + return get_def_use_mgr()->WhileEachUser(varId, [this](Instruction* user) { + SpvOp op = user->opcode(); + if (op != SpvOpStore && op != SpvOpLoad && op != SpvOpName && + !IsNonTypeDecorate(op)) { + return false; + } + return true; + }); +} + +uint32_t MemPass::Type2Undef(uint32_t type_id) { + const auto uitr = type2undefs_.find(type_id); + if (uitr != type2undefs_.end()) return uitr->second; + const uint32_t undefId = TakeNextId(); + std::unique_ptr undef_inst( + new Instruction(context(), SpvOpUndef, type_id, undefId, {})); + get_def_use_mgr()->AnalyzeInstDefUse(&*undef_inst); + get_module()->AddGlobalValue(std::move(undef_inst)); + type2undefs_[type_id] = undefId; + return undefId; +} + +bool MemPass::IsTargetVar(uint32_t varId) { + if (varId == 0) { + return false; + } + + if (seen_non_target_vars_.find(varId) != seen_non_target_vars_.end()) + return false; + if (seen_target_vars_.find(varId) != seen_target_vars_.end()) return true; + const Instruction* varInst = get_def_use_mgr()->GetDef(varId); + if (varInst->opcode() != SpvOpVariable) return false; + const uint32_t varTypeId = varInst->type_id(); + const Instruction* varTypeInst = get_def_use_mgr()->GetDef(varTypeId); + if (varTypeInst->GetSingleWordInOperand(kTypePointerStorageClassInIdx) != + SpvStorageClassFunction) { + seen_non_target_vars_.insert(varId); + return false; + } + const uint32_t varPteTypeId = + varTypeInst->GetSingleWordInOperand(kTypePointerTypeIdInIdx); + Instruction* varPteTypeInst = get_def_use_mgr()->GetDef(varPteTypeId); + if (!IsTargetType(varPteTypeInst)) { + seen_non_target_vars_.insert(varId); + return false; + } + seen_target_vars_.insert(varId); + return true; +} + +// Remove all |phi| operands coming from unreachable blocks (i.e., blocks not in +// |reachable_blocks|). There are two types of removal that this function can +// perform: +// +// 1- Any operand that comes directly from an unreachable block is completely +// removed. Since the block is unreachable, the edge between the unreachable +// block and the block holding |phi| has been removed. +// +// 2- Any operand that comes via a live block and was defined at an unreachable +// block gets its value replaced with an OpUndef value. Since the argument +// was generated in an unreachable block, it no longer exists, so it cannot +// be referenced. However, since the value does not reach |phi| directly +// from the unreachable block, the operand cannot be removed from |phi|. +// Therefore, we replace the argument value with OpUndef. +// +// For example, in the switch() below, assume that we want to remove the +// argument with value %11 coming from block %41. +// +// [ ... ] +// %41 = OpLabel <--- Unreachable block +// %11 = OpLoad %int %y +// [ ... ] +// OpSelectionMerge %16 None +// OpSwitch %12 %16 10 %13 13 %14 18 %15 +// %13 = OpLabel +// OpBranch %16 +// %14 = OpLabel +// OpStore %outparm %int_14 +// OpBranch %16 +// %15 = OpLabel +// OpStore %outparm %int_15 +// OpBranch %16 +// %16 = OpLabel +// %30 = OpPhi %int %11 %41 %int_42 %13 %11 %14 %11 %15 +// +// Since %41 is now an unreachable block, the first operand of |phi| needs to +// be removed completely. But the operands (%11 %14) and (%11 %15) cannot be +// removed because %14 and %15 are reachable blocks. Since %11 no longer exist, +// in those arguments, we replace all references to %11 with an OpUndef value. +// This results in |phi| looking like: +// +// %50 = OpUndef %int +// [ ... ] +// %30 = OpPhi %int %int_42 %13 %50 %14 %50 %15 +void MemPass::RemovePhiOperands( + Instruction* phi, const std::unordered_set& reachable_blocks) { + std::vector keep_operands; + uint32_t type_id = 0; + // The id of an undefined value we've generated. + uint32_t undef_id = 0; + + // Traverse all the operands in |phi|. Build the new operand vector by adding + // all the original operands from |phi| except the unwanted ones. + for (uint32_t i = 0; i < phi->NumOperands();) { + if (i < 2) { + // The first two arguments are always preserved. + keep_operands.push_back(phi->GetOperand(i)); + ++i; + continue; + } + + // The remaining Phi arguments come in pairs. Index 'i' contains the + // variable id, index 'i + 1' is the originating block id. + assert(i % 2 == 0 && i < phi->NumOperands() - 1 && + "malformed Phi arguments"); + + BasicBlock* in_block = cfg()->block(phi->GetSingleWordOperand(i + 1)); + if (reachable_blocks.find(in_block) == reachable_blocks.end()) { + // If the incoming block is unreachable, remove both operands as this + // means that the |phi| has lost an incoming edge. + i += 2; + continue; + } + + // In all other cases, the operand must be kept but may need to be changed. + uint32_t arg_id = phi->GetSingleWordOperand(i); + Instruction* arg_def_instr = get_def_use_mgr()->GetDef(arg_id); + BasicBlock* def_block = context()->get_instr_block(arg_def_instr); + if (def_block && + reachable_blocks.find(def_block) == reachable_blocks.end()) { + // If the current |phi| argument was defined in an unreachable block, it + // means that this |phi| argument is no longer defined. Replace it with + // |undef_id|. + if (!undef_id) { + type_id = arg_def_instr->type_id(); + undef_id = Type2Undef(type_id); + } + keep_operands.push_back( + Operand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, {undef_id})); + } else { + // Otherwise, the argument comes from a reachable block or from no block + // at all (meaning that it was defined in the global section of the + // program). In both cases, keep the argument intact. + keep_operands.push_back(phi->GetOperand(i)); + } + + keep_operands.push_back(phi->GetOperand(i + 1)); + + i += 2; + } + + context()->ForgetUses(phi); + phi->ReplaceOperands(keep_operands); + context()->AnalyzeUses(phi); +} + +void MemPass::RemoveBlock(Function::iterator* bi) { + auto& rm_block = **bi; + + // Remove instructions from the block. + rm_block.ForEachInst([&rm_block, this](Instruction* inst) { + // Note that we do not kill the block label instruction here. The label + // instruction is needed to identify the block, which is needed by the + // removal of phi operands. + if (inst != rm_block.GetLabelInst()) { + context()->KillInst(inst); + } + }); + + // Remove the label instruction last. + auto label = rm_block.GetLabelInst(); + context()->KillInst(label); + + *bi = bi->Erase(); +} + +bool MemPass::RemoveUnreachableBlocks(Function* func) { + bool modified = false; + + // Mark reachable all blocks reachable from the function's entry block. + std::unordered_set reachable_blocks; + std::unordered_set visited_blocks; + std::queue worklist; + reachable_blocks.insert(func->entry().get()); + + // Initially mark the function entry point as reachable. + worklist.push(func->entry().get()); + + auto mark_reachable = [&reachable_blocks, &visited_blocks, &worklist, + this](uint32_t label_id) { + auto successor = cfg()->block(label_id); + if (visited_blocks.count(successor) == 0) { + reachable_blocks.insert(successor); + worklist.push(successor); + visited_blocks.insert(successor); + } + }; + + // Transitively mark all blocks reachable from the entry as reachable. + while (!worklist.empty()) { + BasicBlock* block = worklist.front(); + worklist.pop(); + + // All the successors of a live block are also live. + static_cast(block)->ForEachSuccessorLabel( + mark_reachable); + + // All the Merge and ContinueTarget blocks of a live block are also live. + block->ForMergeAndContinueLabel(mark_reachable); + } + + // Update operands of Phi nodes that reference unreachable blocks. + for (auto& block : *func) { + // If the block is about to be removed, don't bother updating its + // Phi instructions. + if (reachable_blocks.count(&block) == 0) { + continue; + } + + // If the block is reachable and has Phi instructions, remove all + // operands from its Phi instructions that reference unreachable blocks. + // If the block has no Phi instructions, this is a no-op. + block.ForEachPhiInst([&reachable_blocks, this](Instruction* phi) { + RemovePhiOperands(phi, reachable_blocks); + }); + } + + // Erase unreachable blocks. + for (auto ebi = func->begin(); ebi != func->end();) { + if (reachable_blocks.count(&*ebi) == 0) { + RemoveBlock(&ebi); + modified = true; + } else { + ++ebi; + } + } + + return modified; +} + +bool MemPass::CFGCleanup(Function* func) { + bool modified = false; + modified |= RemoveUnreachableBlocks(func); + return modified; +} + +void MemPass::CollectTargetVars(Function* func) { + seen_target_vars_.clear(); + seen_non_target_vars_.clear(); + type2undefs_.clear(); + + // Collect target (and non-) variable sets. Remove variables with + // non-load/store refs from target variable set + for (auto& blk : *func) { + for (auto& inst : blk) { + switch (inst.opcode()) { + case SpvOpStore: + case SpvOpLoad: { + uint32_t varId; + (void)GetPtr(&inst, &varId); + if (!IsTargetVar(varId)) break; + if (HasOnlySupportedRefs(varId)) break; + seen_non_target_vars_.insert(varId); + seen_target_vars_.erase(varId); + } break; + default: + break; + } + } + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h new file mode 100644 index 00000000000..67ce26b1394 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/mem_pass.h @@ -0,0 +1,163 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#ifndef SOURCE_OPT_MEM_PASS_H_ +#define SOURCE_OPT_MEM_PASS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// A common base class for mem2reg-type passes. Provides common +// utility functions and supporting state. +class MemPass : public Pass { + public: + virtual ~MemPass() = default; + + // Returns an undef value for the given |var_id|'s type. + uint32_t GetUndefVal(uint32_t var_id) { + return Type2Undef(GetPointeeTypeId(get_def_use_mgr()->GetDef(var_id))); + } + + // Given a load or store |ip|, return the pointer instruction. + // Also return the base variable's id in |varId|. If no base variable is + // found, |varId| will be 0. + Instruction* GetPtr(Instruction* ip, uint32_t* varId); + + // Return true if |varId| is a previously identified target variable. + // Return false if |varId| is a previously identified non-target variable. + // + // Non-target variables are variable of function scope of a target type that + // are accessed with constant-index access chains. not accessed with + // non-constant-index access chains. Also cache non-target variables. + // + // If variable is not cached, return true if variable is a function scope + // variable of target type, false otherwise. Updates caches of target and + // non-target variables. + bool IsTargetVar(uint32_t varId); + + // Collect target SSA variables. This traverses all the loads and stores in + // function |func| looking for variables that can be replaced with SSA IDs. It + // populates the sets |seen_target_vars_| and |seen_non_target_vars_|. + void CollectTargetVars(Function* func); + + protected: + MemPass(); + + // Returns true if |typeInst| is a scalar type + // or a vector or matrix + bool IsBaseTargetType(const Instruction* typeInst) const; + + // Returns true if |typeInst| is a math type or a struct or array + // of a math type. + // TODO(): Add more complex types to convert + bool IsTargetType(const Instruction* typeInst) const; + + // Returns true if |opcode| is a non-ptr access chain op + bool IsNonPtrAccessChain(const SpvOp opcode) const; + + // Given the id |ptrId|, return true if the top-most non-CopyObj is + // a variable, a non-ptr access chain or a parameter of pointer type. + bool IsPtr(uint32_t ptrId); + + // Given the id of a pointer |ptrId|, return the top-most non-CopyObj. + // Also return the base variable's id in |varId|. If no base variable is + // found, |varId| will be 0. + Instruction* GetPtr(uint32_t ptrId, uint32_t* varId); + + // Return true if all uses of |id| are only name or decorate ops. + bool HasOnlyNamesAndDecorates(uint32_t id) const; + + // Kill all instructions in block |bp|. Whether or not to kill the label is + // indicated by |killLabel|. + void KillAllInsts(BasicBlock* bp, bool killLabel = true); + + // Return true if any instruction loads from |varId| + bool HasLoads(uint32_t varId) const; + + // Return true if |varId| is not a function variable or if it has + // a load + bool IsLiveVar(uint32_t varId) const; + + // Add stores using |ptr_id| to |insts| + void AddStores(uint32_t ptr_id, std::queue* insts); + + // Delete |inst| and iterate DCE on all its operands if they are now + // useless. If a load is deleted and its variable has no other loads, + // delete all its variable's stores. + void DCEInst(Instruction* inst, const std::function&); + + // Call all the cleanup helper functions on |func|. + bool CFGCleanup(Function* func); + + // Return true if |op| is supported decorate. + inline bool IsNonTypeDecorate(uint32_t op) const { + return (op == SpvOpDecorate || op == SpvOpDecorateId); + } + + // Return undef in function for type. Create and insert an undef after the + // first non-variable in the function if it doesn't already exist. Add + // undef to function undef map. + uint32_t Type2Undef(uint32_t type_id); + + // Cache of verified target vars + std::unordered_set seen_target_vars_; + + // Cache of verified non-target vars + std::unordered_set seen_non_target_vars_; + + private: + // Return true if all uses of |varId| are only through supported reference + // operations ie. loads and store. Also cache in supported_ref_vars_. + // TODO(dnovillo): This function is replicated in other passes and it's + // slightly different in every pass. Is it possible to make one common + // implementation? + bool HasOnlySupportedRefs(uint32_t varId); + + // Remove all the unreachable basic blocks in |func|. + bool RemoveUnreachableBlocks(Function* func); + + // Remove the block pointed by the iterator |*bi|. This also removes + // all the instructions in the pointed-to block. + void RemoveBlock(Function::iterator* bi); + + // Remove Phi operands in |phi| that are coming from blocks not in + // |reachable_blocks|. + void RemovePhiOperands( + Instruction* phi, + const std::unordered_set& reachable_blocks); + + // Map from type to undef + std::unordered_map type2undefs_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_MEM_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp new file mode 100644 index 00000000000..4068d4a18f9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.cpp @@ -0,0 +1,824 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/merge_return_pass.h" + +#include +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +Pass::Status MergeReturnPass::Process() { + bool modified = false; + bool is_shader = + context()->get_feature_mgr()->HasCapability(SpvCapabilityShader); + for (auto& function : *get_module()) { + std::vector return_blocks = CollectReturnBlocks(&function); + if (return_blocks.size() <= 1) continue; + + function_ = &function; + return_flag_ = nullptr; + return_value_ = nullptr; + final_return_block_ = nullptr; + + modified = true; + if (is_shader) { + ProcessStructured(&function, return_blocks); + } else { + MergeReturnBlocks(&function, return_blocks); + } + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +void MergeReturnPass::ProcessStructured( + Function* function, const std::vector& return_blocks) { + std::list order; + cfg()->ComputeStructuredOrder(function, &*function->begin(), &order); + + // Create the new return block + CreateReturnBlock(); + + // Create the return + CreateReturn(final_return_block_); + + cfg()->RegisterBlock(final_return_block_); + + state_.clear(); + state_.emplace_back(nullptr, nullptr); + for (auto block : order) { + if (cfg()->IsPseudoEntryBlock(block) || cfg()->IsPseudoExitBlock(block)) { + continue; + } + + auto blockId = block->GetLabelInst()->result_id(); + if (blockId == CurrentState().CurrentMergeId()) { + // Pop the current state as we've hit the merge + state_.pop_back(); + } + + ProcessStructuredBlock(block); + + // Generate state for next block + if (Instruction* mergeInst = block->GetMergeInst()) { + Instruction* loopMergeInst = block->GetLoopMergeInst(); + if (!loopMergeInst) loopMergeInst = state_.back().LoopMergeInst(); + state_.emplace_back(loopMergeInst, mergeInst); + } + } + + state_.clear(); + state_.emplace_back(nullptr, nullptr); + std::unordered_set predicated; + for (auto block : order) { + if (cfg()->IsPseudoEntryBlock(block) || cfg()->IsPseudoExitBlock(block)) { + continue; + } + + auto blockId = block->id(); + if (blockId == CurrentState().CurrentMergeId()) { + // Pop the current state as we've hit the merge + state_.pop_back(); + } + + // Predicate successors of the original return blocks as necessary. + if (std::find(return_blocks.begin(), return_blocks.end(), block) != + return_blocks.end()) { + PredicateBlocks(block, &predicated, &order); + } + + // Generate state for next block + if (Instruction* mergeInst = block->GetMergeInst()) { + Instruction* loopMergeInst = block->GetLoopMergeInst(); + if (!loopMergeInst) loopMergeInst = state_.back().LoopMergeInst(); + state_.emplace_back(loopMergeInst, mergeInst); + } + } + + // We have not kept the dominator tree up-to-date. + // Invalidate it at this point to make sure it will be rebuilt. + context()->RemoveDominatorAnalysis(function); + AddNewPhiNodes(); +} + +void MergeReturnPass::CreateReturnBlock() { + // Create a label for the new return block + std::unique_ptr return_label( + new Instruction(context(), SpvOpLabel, 0u, TakeNextId(), {})); + + // Create the new basic block + std::unique_ptr return_block( + new BasicBlock(std::move(return_label))); + function_->AddBasicBlock(std::move(return_block)); + final_return_block_ = &*(--function_->end()); + context()->AnalyzeDefUse(final_return_block_->GetLabelInst()); + context()->set_instr_block(final_return_block_->GetLabelInst(), + final_return_block_); + final_return_block_->SetParent(function_); +} + +void MergeReturnPass::CreateReturn(BasicBlock* block) { + AddReturnValue(); + + if (return_value_) { + // Load and return the final return value + uint32_t loadId = TakeNextId(); + block->AddInstruction(MakeUnique( + context(), SpvOpLoad, function_->type_id(), loadId, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {return_value_->result_id()}}})); + Instruction* var_inst = block->terminator(); + context()->AnalyzeDefUse(var_inst); + context()->set_instr_block(var_inst, block); + context()->get_decoration_mgr()->CloneDecorations( + return_value_->result_id(), loadId, {SpvDecorationRelaxedPrecision}); + + block->AddInstruction(MakeUnique( + context(), SpvOpReturnValue, 0, 0, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {loadId}}})); + context()->AnalyzeDefUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + } else { + block->AddInstruction(MakeUnique(context(), SpvOpReturn)); + context()->AnalyzeDefUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + } +} + +void MergeReturnPass::ProcessStructuredBlock(BasicBlock* block) { + SpvOp tail_opcode = block->tail()->opcode(); + if (tail_opcode == SpvOpReturn || tail_opcode == SpvOpReturnValue) { + if (!return_flag_) { + AddReturnFlag(); + } + } + + if (tail_opcode == SpvOpReturn || tail_opcode == SpvOpReturnValue || + tail_opcode == SpvOpUnreachable) { + if (CurrentState().InLoop()) { + // Can always break out of innermost loop + BranchToBlock(block, CurrentState().LoopMergeId()); + } else if (CurrentState().InStructuredFlow()) { + BranchToBlock(block, CurrentState().CurrentMergeId()); + } else { + BranchToBlock(block, final_return_block_->id()); + } + } +} + +void MergeReturnPass::BranchToBlock(BasicBlock* block, uint32_t target) { + if (block->tail()->opcode() == SpvOpReturn || + block->tail()->opcode() == SpvOpReturnValue) { + RecordReturned(block); + RecordReturnValue(block); + } + BasicBlock* target_block = context()->get_instr_block(target); + UpdatePhiNodes(block, target_block); + + Instruction* return_inst = block->terminator(); + return_inst->SetOpcode(SpvOpBranch); + return_inst->ReplaceOperands({{SPV_OPERAND_TYPE_ID, {target}}}); + context()->get_def_use_mgr()->AnalyzeInstDefUse(return_inst); + cfg()->AddEdge(block->id(), target); +} + +void MergeReturnPass::UpdatePhiNodes(BasicBlock* new_source, + BasicBlock* target) { + target->ForEachPhiInst([this, new_source](Instruction* inst) { + uint32_t undefId = Type2Undef(inst->type_id()); + inst->AddOperand({SPV_OPERAND_TYPE_ID, {undefId}}); + inst->AddOperand({SPV_OPERAND_TYPE_ID, {new_source->id()}}); + context()->UpdateDefUse(inst); + }); + + const auto& target_pred = cfg()->preds(target->id()); + if (target_pred.size() == 1) { + MarkForNewPhiNodes(target, context()->get_instr_block(target_pred[0])); + } +} + +void MergeReturnPass::CreatePhiNodesForInst(BasicBlock* merge_block, + uint32_t predecessor, + Instruction& inst) { + DominatorAnalysis* dom_tree = + context()->GetDominatorAnalysis(merge_block->GetParent()); + BasicBlock* inst_bb = context()->get_instr_block(&inst); + + if (inst.result_id() != 0) { + std::vector users_to_update; + context()->get_def_use_mgr()->ForEachUser( + &inst, [&users_to_update, &dom_tree, inst_bb, this](Instruction* user) { + BasicBlock* user_bb = context()->get_instr_block(user); + // If |user_bb| is nullptr, then |user| is not in the function. It is + // something like an OpName or decoration, which should not be + // replaced with the result of the OpPhi. + if (user_bb && !dom_tree->Dominates(inst_bb, user_bb)) { + users_to_update.push_back(user); + } + }); + + if (users_to_update.empty()) { + return; + } + + // There is at least one values that needs to be replaced. + // First create the OpPhi instruction. + InstructionBuilder builder(context(), &*merge_block->begin(), + IRContext::kAnalysisDefUse); + uint32_t undef_id = Type2Undef(inst.type_id()); + std::vector phi_operands; + + // Add the operands for the defining instructions. + phi_operands.push_back(inst.result_id()); + phi_operands.push_back(predecessor); + + // Add undef from all other blocks. + std::vector preds = cfg()->preds(merge_block->id()); + for (uint32_t pred_id : preds) { + if (pred_id != predecessor) { + phi_operands.push_back(undef_id); + phi_operands.push_back(pred_id); + } + } + + Instruction* new_phi = builder.AddPhi(inst.type_id(), phi_operands); + uint32_t result_of_phi = new_phi->result_id(); + + // Update all of the users to use the result of the new OpPhi. + for (Instruction* user : users_to_update) { + user->ForEachInId([&inst, result_of_phi](uint32_t* id) { + if (*id == inst.result_id()) { + *id = result_of_phi; + } + }); + context()->AnalyzeUses(user); + } + } +} + +void MergeReturnPass::PredicateBlocks( + BasicBlock* return_block, std::unordered_set* predicated, + std::list* order) { + // The CFG is being modified as the function proceeds so avoid caching + // successors. + + if (predicated->count(return_block)) { + return; + } + + BasicBlock* block = nullptr; + const BasicBlock* const_block = const_cast(return_block); + const_block->ForEachSuccessorLabel([this, &block](const uint32_t idx) { + BasicBlock* succ_block = context()->get_instr_block(idx); + assert(block == nullptr); + block = succ_block; + }); + assert(block && + "Return blocks should have returns already replaced by a single " + "unconditional branch."); + + auto state = state_.rbegin(); + std::unordered_set seen; + if (block->id() == state->CurrentMergeId()) { + state++; + } else if (block->id() == state->LoopMergeId()) { + while (state->LoopMergeId() == block->id()) { + state++; + } + } + + while (block != nullptr && block != final_return_block_) { + if (!predicated->insert(block).second) break; + // Skip structured subgraphs. + BasicBlock* next = nullptr; + if (state->InLoop()) { + next = context()->get_instr_block(state->LoopMergeId()); + while (state->LoopMergeId() == next->id()) { + state++; + } + BreakFromConstruct(block, next, predicated, order); + } else if (false && state->InStructuredFlow()) { + // TODO(#1861): This is disabled until drivers are fixed to accept + // conditional exits from a selection construct. Reenable tests when + // this code is turned back on. + + next = context()->get_instr_block(state->CurrentMergeId()); + state++; + BreakFromConstruct(block, next, predicated, order); + } else { + BasicBlock* tail = block; + while (tail->GetMergeInst()) { + tail = context()->get_instr_block(tail->MergeBlockIdIfAny()); + } + + // Must find |next| (the successor of |tail|) before predicating the + // block because, if |block| == |tail|, then |tail| will have multiple + // successors. + next = nullptr; + const_cast(tail)->ForEachSuccessorLabel( + [this, &next](const uint32_t idx) { + BasicBlock* succ_block = context()->get_instr_block(idx); + assert(next == nullptr && + "Found block with multiple successors and no merge " + "instruction."); + next = succ_block; + }); + + PredicateBlock(block, tail, predicated, order); + } + block = next; + } +} + +bool MergeReturnPass::RequiresPredication(const BasicBlock* block, + const BasicBlock* tail_block) const { + // This is intentionally conservative. + // TODO(alanbaker): re-visit this when more performance data is available. + if (block != tail_block) return true; + + bool requires_predicate = false; + block->ForEachInst([&requires_predicate](const Instruction* inst) { + if (inst->opcode() != SpvOpPhi && inst->opcode() != SpvOpLabel && + !IsTerminatorInst(inst->opcode())) { + requires_predicate = true; + } + }); + return requires_predicate; +} + +void MergeReturnPass::PredicateBlock( + BasicBlock* block, BasicBlock* tail_block, + std::unordered_set* predicated, + std::list* order) { + if (!RequiresPredication(block, tail_block)) { + return; + } + + // Make sure the cfg is build here. If we don't then it becomes very hard + // to know which new blocks need to be updated. + context()->BuildInvalidAnalyses(IRContext::kAnalysisCFG); + + // When predicating, be aware of whether this block is a header block, a + // merge block or both. + // + // If this block is a merge block, ensure the appropriate header stays + // up-to-date with any changes (i.e. points to the pre-header). + // + // If this block is a header block, predicate the entire structured + // subgraph. This can act recursively. + + // If |block| is a loop header, then the back edge must jump to the original + // code, not the new header. + if (block->GetLoopMergeInst()) { + cfg()->SplitLoopHeader(block); + } + + // Leave the phi instructions behind. + auto iter = block->begin(); + while (iter->opcode() == SpvOpPhi) { + ++iter; + } + + // Forget about the edges leaving block. They will be removed. + cfg()->RemoveSuccessorEdges(block); + + std::unique_ptr new_block( + block->SplitBasicBlock(context(), TakeNextId(), iter)); + BasicBlock* old_body = + function_->InsertBasicBlockAfter(std::move(new_block), block); + predicated->insert(old_body); + + // Update |order| so old_block will be traversed. + InsertAfterElement(block, old_body, order); + + if (tail_block == block) { + tail_block = old_body; + } + + const BasicBlock* const_old_body = static_cast(old_body); + const_old_body->ForEachSuccessorLabel( + [old_body, block, this](const uint32_t label) { + BasicBlock* target_bb = context()->get_instr_block(label); + if (MarkedSinglePred(target_bb) == block) { + MarkForNewPhiNodes(target_bb, old_body); + } + }); + + std::unique_ptr new_merge_block(new BasicBlock( + MakeUnique(context(), SpvOpLabel, 0, TakeNextId(), + std::initializer_list{}))); + + BasicBlock* new_merge = + function_->InsertBasicBlockAfter(std::move(new_merge_block), tail_block); + predicated->insert(new_merge); + new_merge->SetParent(function_); + + // Update |order| so old_block will be traversed. + InsertAfterElement(tail_block, new_merge, order); + + // Register the new label. + get_def_use_mgr()->AnalyzeInstDef(new_merge->GetLabelInst()); + context()->set_instr_block(new_merge->GetLabelInst(), new_merge); + + // Move the tail branch into the new merge and fix the mapping. If a single + // block is being predicated then its branch was moved to the old body + // previously. + std::unique_ptr inst; + Instruction* i = tail_block->terminator(); + cfg()->RemoveSuccessorEdges(tail_block); + get_def_use_mgr()->ClearInst(i); + inst.reset(std::move(i)); + inst->RemoveFromList(); + new_merge->end().InsertBefore(std::move(inst)); + get_def_use_mgr()->AnalyzeInstUse(new_merge->terminator()); + context()->set_instr_block(new_merge->terminator(), new_merge); + + // Add a branch to the new merge. If we jumped multiple blocks, the branch + // is added to tail_block, otherwise the branch belongs in old_body. + tail_block->AddInstruction( + MakeUnique(context(), SpvOpBranch, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {new_merge->id()}}})); + get_def_use_mgr()->AnalyzeInstUse(tail_block->terminator()); + context()->set_instr_block(tail_block->terminator(), tail_block); + + // Within the new header we need the following: + // 1. Load of the return status flag + // 2. Declare the merge block + // 3. Branch to new merge (true) or old body (false) + + // 1. Load of the return status flag + analysis::Bool bool_type; + uint32_t bool_id = context()->get_type_mgr()->GetId(&bool_type); + assert(bool_id != 0); + uint32_t load_id = TakeNextId(); + block->AddInstruction(MakeUnique( + context(), SpvOpLoad, bool_id, load_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {return_flag_->result_id()}}})); + get_def_use_mgr()->AnalyzeInstDefUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + + // 2. Declare the merge block + block->AddInstruction(MakeUnique( + context(), SpvOpSelectionMerge, 0, 0, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {new_merge->id()}}, + {SPV_OPERAND_TYPE_SELECTION_CONTROL, + {SpvSelectionControlMaskNone}}})); + get_def_use_mgr()->AnalyzeInstUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + + // 3. Branch to new merge (true) or old body (false) + block->AddInstruction(MakeUnique( + context(), SpvOpBranchConditional, 0, 0, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {load_id}}, + {SPV_OPERAND_TYPE_ID, {new_merge->id()}}, + {SPV_OPERAND_TYPE_ID, {old_body->id()}}})); + get_def_use_mgr()->AnalyzeInstUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + + assert(old_body->begin() != old_body->end()); + assert(block->begin() != block->end()); + assert(new_merge->begin() != new_merge->end()); + + // Update the cfg + cfg()->AddEdges(block); + cfg()->RegisterBlock(old_body); + if (old_body != tail_block) { + cfg()->AddEdges(tail_block); + } + cfg()->RegisterBlock(new_merge); + MarkForNewPhiNodes(new_merge, tail_block); +} + +void MergeReturnPass::BreakFromConstruct( + BasicBlock* block, BasicBlock* merge_block, + std::unordered_set* predicated, + std::list* order) { + // Make sure the cfg is build here. If we don't then it becomes very hard + // to know which new blocks need to be updated. + context()->BuildInvalidAnalyses(IRContext::kAnalysisCFG); + + // When predicating, be aware of whether this block is a header block, a + // merge block or both. + // + // If this block is a merge block, ensure the appropriate header stays + // up-to-date with any changes (i.e. points to the pre-header). + // + // If this block is a header block, predicate the entire structured + // subgraph. This can act recursively. + + // If |block| is a loop header, then the back edge must jump to the original + // code, not the new header. + if (block->GetLoopMergeInst()) { + cfg()->SplitLoopHeader(block); + } + + // Leave the phi instructions behind. + auto iter = block->begin(); + while (iter->opcode() == SpvOpPhi) { + ++iter; + } + + // Forget about the edges leaving block. They will be removed. + cfg()->RemoveSuccessorEdges(block); + + std::unique_ptr new_block( + block->SplitBasicBlock(context(), TakeNextId(), iter)); + BasicBlock* old_body = + function_->InsertBasicBlockAfter(std::move(new_block), block); + predicated->insert(old_body); + + // Update |order| so old_block will be traversed. + InsertAfterElement(block, old_body, order); + + // Within the new header we need the following: + // 1. Load of the return status flag + // 2. Branch to |merge_block| (true) or old body (false) + // 3. Update OpPhi instructions in |merge_block|. + // + // Sine we are branching to the merge block of the current construct, there is + // no need for an OpSelectionMerge. + + // 1. Load of the return status flag + analysis::Bool bool_type; + uint32_t bool_id = context()->get_type_mgr()->GetId(&bool_type); + assert(bool_id != 0); + uint32_t load_id = TakeNextId(); + block->AddInstruction(MakeUnique( + context(), SpvOpLoad, bool_id, load_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {return_flag_->result_id()}}})); + get_def_use_mgr()->AnalyzeInstDefUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + + // 2. Branch to |merge_block| (true) or |old_body| (false) + block->AddInstruction(MakeUnique( + context(), SpvOpBranchConditional, 0, 0, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {load_id}}, + {SPV_OPERAND_TYPE_ID, {merge_block->id()}}, + {SPV_OPERAND_TYPE_ID, {old_body->id()}}})); + get_def_use_mgr()->AnalyzeInstUse(block->terminator()); + context()->set_instr_block(block->terminator(), block); + + // Update the cfg + cfg()->AddEdges(block); + cfg()->RegisterBlock(old_body); + + // 3. Update OpPhi instructions in |merge_block|. + BasicBlock* merge_original_pred = MarkedSinglePred(merge_block); + if (merge_original_pred == nullptr) { + UpdatePhiNodes(block, merge_block); + } else if (merge_original_pred == block) { + MarkForNewPhiNodes(merge_block, old_body); + } + + assert(old_body->begin() != old_body->end()); + assert(block->begin() != block->end()); +} + +void MergeReturnPass::RecordReturned(BasicBlock* block) { + if (block->tail()->opcode() != SpvOpReturn && + block->tail()->opcode() != SpvOpReturnValue) + return; + + assert(return_flag_ && "Did not generate the return flag variable."); + + if (!constant_true_) { + analysis::Bool temp; + const analysis::Bool* bool_type = + context()->get_type_mgr()->GetRegisteredType(&temp)->AsBool(); + + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + const analysis::Constant* true_const = + const_mgr->GetConstant(bool_type, {true}); + constant_true_ = const_mgr->GetDefiningInstruction(true_const); + context()->UpdateDefUse(constant_true_); + } + + std::unique_ptr return_store(new Instruction( + context(), SpvOpStore, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {return_flag_->result_id()}}, + {SPV_OPERAND_TYPE_ID, {constant_true_->result_id()}}})); + + Instruction* store_inst = + &*block->tail().InsertBefore(std::move(return_store)); + context()->set_instr_block(store_inst, block); + context()->AnalyzeDefUse(store_inst); +} + +void MergeReturnPass::RecordReturnValue(BasicBlock* block) { + auto terminator = *block->tail(); + if (terminator.opcode() != SpvOpReturnValue) { + return; + } + + assert(return_value_ && + "Did not generate the variable to hold the return value."); + + std::unique_ptr value_store(new Instruction( + context(), SpvOpStore, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {return_value_->result_id()}}, + {SPV_OPERAND_TYPE_ID, {terminator.GetSingleWordInOperand(0u)}}})); + + Instruction* store_inst = + &*block->tail().InsertBefore(std::move(value_store)); + context()->set_instr_block(store_inst, block); + context()->AnalyzeDefUse(store_inst); +} + +void MergeReturnPass::AddReturnValue() { + if (return_value_) return; + + uint32_t return_type_id = function_->type_id(); + if (get_def_use_mgr()->GetDef(return_type_id)->opcode() == SpvOpTypeVoid) + return; + + uint32_t return_ptr_type = context()->get_type_mgr()->FindPointerToType( + return_type_id, SpvStorageClassFunction); + + uint32_t var_id = TakeNextId(); + std::unique_ptr returnValue(new Instruction( + context(), SpvOpVariable, return_ptr_type, var_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}})); + + auto insert_iter = function_->begin()->begin(); + insert_iter.InsertBefore(std::move(returnValue)); + BasicBlock* entry_block = &*function_->begin(); + return_value_ = &*entry_block->begin(); + context()->AnalyzeDefUse(return_value_); + context()->set_instr_block(return_value_, entry_block); + + context()->get_decoration_mgr()->CloneDecorations( + function_->result_id(), var_id, {SpvDecorationRelaxedPrecision}); +} + +void MergeReturnPass::AddReturnFlag() { + if (return_flag_) return; + + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + + analysis::Bool temp; + uint32_t bool_id = type_mgr->GetTypeInstruction(&temp); + analysis::Bool* bool_type = type_mgr->GetType(bool_id)->AsBool(); + + const analysis::Constant* false_const = + const_mgr->GetConstant(bool_type, {false}); + uint32_t const_false_id = + const_mgr->GetDefiningInstruction(false_const)->result_id(); + + uint32_t bool_ptr_id = + type_mgr->FindPointerToType(bool_id, SpvStorageClassFunction); + + uint32_t var_id = TakeNextId(); + std::unique_ptr returnFlag(new Instruction( + context(), SpvOpVariable, bool_ptr_id, var_id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}, + {SPV_OPERAND_TYPE_ID, {const_false_id}}})); + + auto insert_iter = function_->begin()->begin(); + + insert_iter.InsertBefore(std::move(returnFlag)); + BasicBlock* entry_block = &*function_->begin(); + return_flag_ = &*entry_block->begin(); + context()->AnalyzeDefUse(return_flag_); + context()->set_instr_block(return_flag_, entry_block); +} + +std::vector MergeReturnPass::CollectReturnBlocks( + Function* function) { + std::vector return_blocks; + for (auto& block : *function) { + Instruction& terminator = *block.tail(); + if (terminator.opcode() == SpvOpReturn || + terminator.opcode() == SpvOpReturnValue) { + return_blocks.push_back(&block); + } + } + return return_blocks; +} + +void MergeReturnPass::MergeReturnBlocks( + Function* function, const std::vector& return_blocks) { + if (return_blocks.size() <= 1) { + // No work to do. + return; + } + + CreateReturnBlock(); + uint32_t return_id = final_return_block_->id(); + auto ret_block_iter = --function->end(); + // Create the PHI for the merged block (if necessary). + // Create new return. + std::vector phi_ops; + for (auto block : return_blocks) { + if (block->tail()->opcode() == SpvOpReturnValue) { + phi_ops.push_back( + {SPV_OPERAND_TYPE_ID, {block->tail()->GetSingleWordInOperand(0u)}}); + phi_ops.push_back({SPV_OPERAND_TYPE_ID, {block->id()}}); + } + } + + if (!phi_ops.empty()) { + // Need a PHI node to select the correct return value. + uint32_t phi_result_id = TakeNextId(); + uint32_t phi_type_id = function->type_id(); + std::unique_ptr phi_inst(new Instruction( + context(), SpvOpPhi, phi_type_id, phi_result_id, phi_ops)); + ret_block_iter->AddInstruction(std::move(phi_inst)); + BasicBlock::iterator phiIter = ret_block_iter->tail(); + + std::unique_ptr return_inst( + new Instruction(context(), SpvOpReturnValue, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {phi_result_id}}})); + ret_block_iter->AddInstruction(std::move(return_inst)); + BasicBlock::iterator ret = ret_block_iter->tail(); + + // Register the phi def and mark instructions for use updates. + get_def_use_mgr()->AnalyzeInstDefUse(&*phiIter); + get_def_use_mgr()->AnalyzeInstDef(&*ret); + } else { + std::unique_ptr return_inst( + new Instruction(context(), SpvOpReturn)); + ret_block_iter->AddInstruction(std::move(return_inst)); + } + + // Replace returns with branches + for (auto block : return_blocks) { + context()->ForgetUses(block->terminator()); + block->tail()->SetOpcode(SpvOpBranch); + block->tail()->ReplaceOperands({{SPV_OPERAND_TYPE_ID, {return_id}}}); + get_def_use_mgr()->AnalyzeInstUse(block->terminator()); + get_def_use_mgr()->AnalyzeInstUse(block->GetLabelInst()); + } + + get_def_use_mgr()->AnalyzeInstDefUse(ret_block_iter->GetLabelInst()); +} + +void MergeReturnPass::AddNewPhiNodes() { + DominatorAnalysis* dom_tree = context()->GetDominatorAnalysis(function_); + std::list order; + cfg()->ComputeStructuredOrder(function_, &*function_->begin(), &order); + + for (BasicBlock* bb : order) { + AddNewPhiNodes(bb, new_merge_nodes_[bb], + dom_tree->ImmediateDominator(bb)->id()); + } +} + +void MergeReturnPass::AddNewPhiNodes(BasicBlock* bb, BasicBlock* pred, + uint32_t header_id) { + DominatorAnalysis* dom_tree = context()->GetDominatorAnalysis(function_); + // Insert as a stopping point. We do not have to add anything in the block + // or above because the header dominates |bb|. + + BasicBlock* current_bb = pred; + while (current_bb != nullptr && current_bb->id() != header_id) { + for (Instruction& inst : *current_bb) { + CreatePhiNodesForInst(bb, pred->id(), inst); + } + current_bb = dom_tree->ImmediateDominator(current_bb); + } +} + +void MergeReturnPass::MarkForNewPhiNodes(BasicBlock* block, + BasicBlock* single_original_pred) { + new_merge_nodes_[block] = single_original_pred; +} + +void MergeReturnPass::InsertAfterElement(BasicBlock* element, + BasicBlock* new_element, + std::list* list) { + auto pos = std::find(list->begin(), list->end(), element); + assert(pos != list->end()); + ++pos; + list->insert(pos, new_element); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.h new file mode 100644 index 00000000000..472d059fe5a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/merge_return_pass.h @@ -0,0 +1,336 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_MERGE_RETURN_PASS_H_ +#define SOURCE_OPT_MERGE_RETURN_PASS_H_ + +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/function.h" +#include "source/opt/mem_pass.h" + +namespace spvtools { +namespace opt { + +/******************************************************************************* + * + * Handling Structured Control Flow: + * + * Structured control flow guarantees that the CFG will reconverge at a given + * point (the merge block). Within structured control flow, all blocks must be + * post-dominated by the merge block, except return blocks and break blocks. + * A break block is a block that branches to the innermost loop's merge block. + * + * Beyond this, we further assume that all unreachable blocks have been + * cleanedup. This means that the only unreachable blocks are those necessary + * for valid structured control flow. + * + * Algorithm: + * + * If a return is encountered, it should record that: i) the function has + * "returned" and ii) the value of the return. The return should be replaced + * with a branch. If current block is not within structured control flow, this + * is the final return. This block should branch to the new return block (its + * direct successor). If the current block is within structured control flow, + * the branch destination should be the innermost loop's merge (if it exists) + * or the merge block of the immediate structured control flow. If the merge + * block produces any live values it will need to be predicated. While the merge + * is nested in structured control flow, the predication path should branch to + * the next best merge block available. Once structured control flow has been + * exited, remaining blocks must be predicated with new structured control flow + * (OpSelectionMerge). These should be nested correctly in case of straight line + * branching to reach the final return block. + * + * In the final return block, the return value should be loaded and returned. + * Memory promotion passes should be able to promote the newly introduced + * variables ("has returned" and "return value"). + * + * Predicating the Final Merge: + * + * At each merge block predication needs to be introduced (optimization: only if + * that block produces value live beyond it). This needs to be done carefully. + * The merge block should be split into multiple blocks. + * + * 1 (header) + * / \ + * (ret) 2 3 (merge) + * + * || + * \/ + * + * 1 (header) + * / \ + * 2 | + * \ / + * 3 (merge for 1, new header) + * / \ + * | 3 (old body) + * \ / + * (ret) 4 (new merge) + * + * In the above (simple) example, the return originally in |2| is passed through + * the merge. That merge is predicated such that the old body of the block is + * the else branch. The branch condition is based on the value of the "has + * returned" variable. In more complicated examples (blocks between |1| and + * |3|), the SSA would need to fixed up due the newly reconvergent path at the + * merge for |1|. Assuming |3| originally was also a return block, the old body + * of |3| should also store the return value for that case. The return value in + * |4| just requires loading the return value variable. + * + ******************************************************************************/ + +// Documented in optimizer.hpp +class MergeReturnPass : public MemPass { + public: + MergeReturnPass() + : function_(nullptr), + return_flag_(nullptr), + return_value_(nullptr), + constant_true_(nullptr), + final_return_block_(nullptr) {} + + const char* name() const override { return "merge-return"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + // return IRContext::kAnalysisDefUse; + return IRContext::kAnalysisNone; + } + + private: + // This class is used to store the a loop merge instruction and a selection + // merge instruction. The intended use is that is represent the inner most + // contain selection construct and the inner most loop construct. + class StructuredControlState { + public: + StructuredControlState(Instruction* loop, Instruction* merge) + : loop_merge_(loop), current_merge_(merge) {} + + StructuredControlState(const StructuredControlState&) = default; + + bool InLoop() const { return loop_merge_; } + bool InStructuredFlow() const { return CurrentMergeId() != 0; } + + uint32_t CurrentMergeId() const { + return current_merge_ ? current_merge_->GetSingleWordInOperand(0u) : 0u; + } + + uint32_t CurrentMergeHeader() const { + return current_merge_ ? current_merge_->context() + ->get_instr_block(current_merge_) + ->id() + : 0; + } + + uint32_t LoopMergeId() const { + return loop_merge_ ? loop_merge_->GetSingleWordInOperand(0u) : 0u; + } + + uint32_t CurrentLoopHeader() const { + return loop_merge_ + ? loop_merge_->context()->get_instr_block(loop_merge_)->id() + : 0; + } + + Instruction* LoopMergeInst() const { return loop_merge_; } + + private: + Instruction* loop_merge_; + Instruction* current_merge_; + }; + + // Returns all BasicBlocks terminated by OpReturn or OpReturnValue in + // |function|. + std::vector CollectReturnBlocks(Function* function); + + // Creates a new basic block with a single return. If |function| returns a + // value, a phi node is created to select the correct value to return. + // Replaces old returns with an unconditional branch to the new block. + void MergeReturnBlocks(Function* function, + const std::vector& returnBlocks); + + // Merges the return instruction in |function| so that it has a single return + // statement. It is assumed that |function| has structured control flow, and + // that |return_blocks| is a list of all of the basic blocks in |function| + // that have a return. + void ProcessStructured(Function* function, + const std::vector& return_blocks); + + // Changes an OpReturn* or OpUnreachable instruction at the end of |block| + // into a store to |return_flag_|, a store to |return_value_| (if necessary), + // and a branch to the appropriate merge block. + // + // Is is assumed that |AddReturnValue| have already been called to created the + // variable to store a return value if there is one. + // + // Note this will break the semantics. To fix this, PredicateBlock will have + // to be called on the merge block the branch targets. + void ProcessStructuredBlock(BasicBlock* block); + + // Creates a variable used to store whether or not the control flow has + // traversed a block that used to have a return. A pointer to the instruction + // declaring the variable is stored in |return_flag_|. + void AddReturnFlag(); + + // Creates the variable used to store the return value when passing through + // a block that use to contain an OpReturnValue. + void AddReturnValue(); + + // Adds a store that stores true to |return_flag_| immediately before the + // terminator of |block|. It is assumed that |AddReturnFlag| has already been + // called. + void RecordReturned(BasicBlock* block); + + // Adds an instruction that stores the value being returned in the + // OpReturnValue in |block|. The value is stored to |return_value_|, and the + // store is placed before the OpReturnValue. + // + // If |block| does not contain an OpReturnValue, then this function has no + // effect. If |block| contains an OpReturnValue, then |AddReturnValue| must + // have already been called to create the variable to store to. + void RecordReturnValue(BasicBlock* block); + + // Adds an unconditional branch in |block| that branches to |target|. It also + // adds stores to |return_flag_| and |return_value_| as needed. + // |AddReturnFlag| and |AddReturnValue| must have already been called. + void BranchToBlock(BasicBlock* block, uint32_t target); + + // Returns true if we need to predicate |block| where |tail_block| is the + // merge point. (See |PredicateBlocks|). There is no need to predicate if + // there is no code that could be executed. + bool RequiresPredication(const BasicBlock* block, + const BasicBlock* tail_block) const; + + // For every basic block that is reachable from |return_block|, extra code is + // added to jump around any code that should not be executed because the + // original code would have already returned. This involves adding new + // selections constructs to jump around these instructions. + // + // If new blocks that are created will be added to |order|. This way a call + // can traverse these new block in structured order. + void PredicateBlocks(BasicBlock* return_block, + std::unordered_set* pSet, + std::list* order); + + // Add a conditional branch at the start of |block| that either jumps to + // |merge_block| or the original code in |block| depending on the value in + // |return_flag_|. + // + // If new blocks that are created will be added to |order|. This way a call + // can traverse these new block in structured order. + void BreakFromConstruct(BasicBlock* block, BasicBlock* merge_block, + std::unordered_set* predicated, + std::list* order); + + // Add the predication code (see |PredicateBlocks|) to |tail_block| if it + // requires predication. |tail_block| and any new blocks that are known to + // not require predication will be added to |predicated|. + // + // If new blocks that are created will be added to |order|. This way a call + // can traverse these new block in structured order. + void PredicateBlock(BasicBlock* block, BasicBlock* tail_block, + std::unordered_set* predicated, + std::list* order); + + // Add an |OpReturn| or |OpReturnValue| to the end of |block|. If an + // |OpReturnValue| is needed, the return value is loaded from |return_value_|. + void CreateReturn(BasicBlock* block); + + // Creates a block at the end of the function that will become the single + // return block at the end of the pass. + void CreateReturnBlock(); + + // Creates a Phi node in |merge_block| for the result of |inst| coming from + // |predecessor|. Any uses of the result of |inst| that are no longer + // dominated by |inst|, are replaced with the result of the new |OpPhi| + // instruction. + void CreatePhiNodesForInst(BasicBlock* merge_block, uint32_t predecessor, + Instruction& inst); + + // Traverse the nodes in |new_merge_nodes_|, and adds the OpPhi instructions + // that are needed to make the code correct. It is assumed that at this point + // there are no unreachable blocks in the control flow graph. + void AddNewPhiNodes(); + + // Creates any new phi nodes that are needed in |bb| now that |pred| is no + // longer the only block that preceedes |bb|. |header_id| is the id of the + // basic block for the loop or selection construct that merges at |bb|. + void AddNewPhiNodes(BasicBlock* bb, BasicBlock* pred, uint32_t header_id); + + // Saves |block| to a list of basic block that will require OpPhi nodes to be + // added by calling |AddNewPhiNodes|. It is assumed that |block| used to have + // a single predecessor, |single_original_pred|, but now has more. + void MarkForNewPhiNodes(BasicBlock* block, BasicBlock* single_original_pred); + + // Return the original single predcessor of |block| if it was flagged as + // having a single predecessor. |nullptr| is returned otherwise. + BasicBlock* MarkedSinglePred(BasicBlock* block) { + auto it = new_merge_nodes_.find(block); + if (it != new_merge_nodes_.end()) { + return it->second; + } else { + return nullptr; + } + } + + // Modifies existing OpPhi instruction in |target| block to account for the + // new edge from |new_source|. The value for that edge will be an Undef. If + // |target| only had a single predecessor, then it is marked as needing new + // phi nodes. See |MarkForNewPhiNodes|. + void UpdatePhiNodes(BasicBlock* new_source, BasicBlock* target); + + StructuredControlState& CurrentState() { return state_.back(); } + + // Inserts |new_element| into |list| after the first occurrence of |element|. + // |element| must be in |list| at least once. + void InsertAfterElement(BasicBlock* element, BasicBlock* new_element, + std::list* list); + + // A stack used to keep track of the innermost contain loop and selection + // constructs. + std::vector state_; + + // The current function being transformed. + Function* function_; + + // The |OpVariable| instruction defining a boolean variable used to keep track + // of whether or not the function is trying to return. + Instruction* return_flag_; + + // The |OpVariable| instruction defining a variabled to used to keep track of + // the value that was returned when passing through a block that use to + // contain an |OpReturnValue|. + Instruction* return_value_; + + // The instruction defining the boolean constant true. + Instruction* constant_true_; + + // The basic block that is suppose to become the contain the only return value + // after processing the current function. + BasicBlock* final_return_block_; + + // This map contains the set of nodes that use to have a single predcessor, + // but now have more. They will need new OpPhi nodes. For each of the nodes, + // it is mapped to it original single predcessor. It is assumed there are no + // values that will need a phi on the new edges. + std::unordered_map new_merge_nodes_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_MERGE_RETURN_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/module.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/module.cpp new file mode 100644 index 00000000000..6d024b5bcbc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/module.cpp @@ -0,0 +1,173 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/module.h" + +#include +#include +#include + +#include "source/operand.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +std::vector Module::GetTypes() { + std::vector type_insts; + for (auto& inst : types_values_) { + if (IsTypeInst(inst.opcode())) type_insts.push_back(&inst); + } + return type_insts; +} + +std::vector Module::GetTypes() const { + std::vector type_insts; + for (auto& inst : types_values_) { + if (IsTypeInst(inst.opcode())) type_insts.push_back(&inst); + } + return type_insts; +} + +std::vector Module::GetConstants() { + std::vector const_insts; + for (auto& inst : types_values_) { + if (IsConstantInst(inst.opcode())) const_insts.push_back(&inst); + } + return const_insts; +} + +std::vector Module::GetConstants() const { + std::vector const_insts; + for (auto& inst : types_values_) { + if (IsConstantInst(inst.opcode())) const_insts.push_back(&inst); + } + return const_insts; +} + +uint32_t Module::GetGlobalValue(SpvOp opcode) const { + for (auto& inst : types_values_) { + if (inst.opcode() == opcode) return inst.result_id(); + } + return 0; +} + +void Module::AddGlobalValue(SpvOp opcode, uint32_t result_id, + uint32_t type_id) { + std::unique_ptr newGlobal( + new Instruction(context(), opcode, type_id, result_id, {})); + AddGlobalValue(std::move(newGlobal)); +} + +void Module::ForEachInst(const std::function& f, + bool run_on_debug_line_insts) { +#define DELEGATE(list) list.ForEachInst(f, run_on_debug_line_insts) + DELEGATE(capabilities_); + DELEGATE(extensions_); + DELEGATE(ext_inst_imports_); + if (memory_model_) memory_model_->ForEachInst(f, run_on_debug_line_insts); + DELEGATE(entry_points_); + DELEGATE(execution_modes_); + DELEGATE(debugs1_); + DELEGATE(debugs2_); + DELEGATE(debugs3_); + DELEGATE(annotations_); + DELEGATE(types_values_); + for (auto& i : functions_) i->ForEachInst(f, run_on_debug_line_insts); +#undef DELEGATE +} + +void Module::ForEachInst(const std::function& f, + bool run_on_debug_line_insts) const { +#define DELEGATE(i) i.ForEachInst(f, run_on_debug_line_insts) + for (auto& i : capabilities_) DELEGATE(i); + for (auto& i : extensions_) DELEGATE(i); + for (auto& i : ext_inst_imports_) DELEGATE(i); + if (memory_model_) + static_cast(memory_model_.get()) + ->ForEachInst(f, run_on_debug_line_insts); + for (auto& i : entry_points_) DELEGATE(i); + for (auto& i : execution_modes_) DELEGATE(i); + for (auto& i : debugs1_) DELEGATE(i); + for (auto& i : debugs2_) DELEGATE(i); + for (auto& i : debugs3_) DELEGATE(i); + for (auto& i : annotations_) DELEGATE(i); + for (auto& i : types_values_) DELEGATE(i); + for (auto& i : functions_) { + static_cast(i.get())->ForEachInst(f, + run_on_debug_line_insts); + } +#undef DELEGATE +} + +void Module::ToBinary(std::vector* binary, bool skip_nop) const { + binary->push_back(header_.magic_number); + binary->push_back(header_.version); + // TODO(antiagainst): should we change the generator number? + binary->push_back(header_.generator); + binary->push_back(header_.bound); + binary->push_back(header_.reserved); + + auto write_inst = [binary, skip_nop](const Instruction* i) { + if (!(skip_nop && i->IsNop())) i->ToBinaryWithoutAttachedDebugInsts(binary); + }; + ForEachInst(write_inst, true); +} + +uint32_t Module::ComputeIdBound() const { + uint32_t highest = 0; + + ForEachInst( + [&highest](const Instruction* inst) { + for (const auto& operand : *inst) { + if (spvIsIdType(operand.type)) { + highest = std::max(highest, operand.words[0]); + } + } + }, + true /* scan debug line insts as well */); + + return highest + 1; +} + +bool Module::HasExplicitCapability(uint32_t cap) { + for (auto& ci : capabilities_) { + uint32_t tcap = ci.GetSingleWordOperand(0); + if (tcap == cap) { + return true; + } + } + return false; +} + +uint32_t Module::GetExtInstImportId(const char* extstr) { + for (auto& ei : ext_inst_imports_) + if (!strcmp(extstr, + reinterpret_cast(&(ei.GetInOperand(0).words[0])))) + return ei.result_id(); + return 0; +} + +std::ostream& operator<<(std::ostream& str, const Module& module) { + module.ForEachInst([&str](const Instruction* inst) { + str << *inst; + if (inst->opcode() != SpvOpFunctionEnd) { + str << std::endl; + } + }); + return str; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/module.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/module.h new file mode 100644 index 00000000000..eca8cc77983 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/module.h @@ -0,0 +1,476 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_MODULE_H_ +#define SOURCE_OPT_MODULE_H_ + +#include +#include +#include +#include + +#include "source/opt/function.h" +#include "source/opt/instruction.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +class IRContext; + +// A struct for containing the module header information. +struct ModuleHeader { + uint32_t magic_number; + uint32_t version; + uint32_t generator; + uint32_t bound; + uint32_t reserved; +}; + +// A SPIR-V module. It contains all the information for a SPIR-V module and +// serves as the backbone of optimization transformations. +class Module { + public: + using iterator = UptrVectorIterator; + using const_iterator = UptrVectorIterator; + using inst_iterator = InstructionList::iterator; + using const_inst_iterator = InstructionList::const_iterator; + + // Creates an empty module with zero'd header. + Module() : header_({}) {} + + // Sets the header to the given |header|. + void SetHeader(const ModuleHeader& header) { header_ = header; } + + // Sets the Id bound. + void SetIdBound(uint32_t bound) { header_.bound = bound; } + + // Returns the Id bound. + uint32_t IdBound() { return header_.bound; } + + // Returns the current Id bound and increases it to the next available value. + uint32_t TakeNextIdBound() { return header_.bound++; } + + // Appends a capability instruction to this module. + inline void AddCapability(std::unique_ptr c); + + // Appends an extension instruction to this module. + inline void AddExtension(std::unique_ptr e); + + // Appends an extended instruction set instruction to this module. + inline void AddExtInstImport(std::unique_ptr e); + + // Set the memory model for this module. + inline void SetMemoryModel(std::unique_ptr m); + + // Appends an entry point instruction to this module. + inline void AddEntryPoint(std::unique_ptr e); + + // Appends an execution mode instruction to this module. + inline void AddExecutionMode(std::unique_ptr e); + + // Appends a debug 1 instruction (excluding OpLine & OpNoLine) to this module. + // "debug 1" instructions are the ones in layout section 7.a), see section + // 2.4 Logical Layout of a Module from the SPIR-V specification. + inline void AddDebug1Inst(std::unique_ptr d); + + // Appends a debug 2 instruction (excluding OpLine & OpNoLine) to this module. + // "debug 2" instructions are the ones in layout section 7.b), see section + // 2.4 Logical Layout of a Module from the SPIR-V specification. + inline void AddDebug2Inst(std::unique_ptr d); + + // Appends a debug 3 instruction (OpModuleProcessed) to this module. + // This is due to decision by the SPIR Working Group, pending publication. + inline void AddDebug3Inst(std::unique_ptr d); + + // Appends an annotation instruction to this module. + inline void AddAnnotationInst(std::unique_ptr a); + + // Appends a type-declaration instruction to this module. + inline void AddType(std::unique_ptr t); + + // Appends a constant, global variable, or OpUndef instruction to this module. + inline void AddGlobalValue(std::unique_ptr v); + + // Appends a function to this module. + inline void AddFunction(std::unique_ptr f); + + // Returns a vector of pointers to type-declaration instructions in this + // module. + std::vector GetTypes(); + std::vector GetTypes() const; + // Returns a vector of pointers to constant-creation instructions in this + // module. + std::vector GetConstants(); + std::vector GetConstants() const; + + // Return result id of global value with |opcode|, 0 if not present. + uint32_t GetGlobalValue(SpvOp opcode) const; + + // Add global value with |opcode|, |result_id| and |type_id| + void AddGlobalValue(SpvOp opcode, uint32_t result_id, uint32_t type_id); + + inline uint32_t id_bound() const { return header_.bound; } + + inline uint32_t version() const { return header_.version; } + + // Iterators for capabilities instructions contained in this module. + inline inst_iterator capability_begin(); + inline inst_iterator capability_end(); + inline IteratorRange capabilities(); + inline IteratorRange capabilities() const; + + // Iterators for ext_inst_imports instructions contained in this module. + inline inst_iterator ext_inst_import_begin(); + inline inst_iterator ext_inst_import_end(); + inline IteratorRange ext_inst_imports(); + inline IteratorRange ext_inst_imports() const; + + // Return the memory model instruction contained inthis module. + inline Instruction* GetMemoryModel() { return memory_model_.get(); } + inline const Instruction* GetMemoryModel() const { + return memory_model_.get(); + } + + // There are several kinds of debug instructions, according to where they can + // appear in the logical layout of a module: + // - Section 7a: OpString, OpSourceExtension, OpSource, OpSourceContinued + // - Section 7b: OpName, OpMemberName + // - Section 7c: OpModuleProcessed + // - Mostly anywhere: OpLine and OpNoLine + // + + // Iterators for debug 1 instructions (excluding OpLine & OpNoLine) contained + // in this module. These are for layout section 7a. + inline inst_iterator debug1_begin(); + inline inst_iterator debug1_end(); + inline IteratorRange debugs1(); + inline IteratorRange debugs1() const; + + // Iterators for debug 2 instructions (excluding OpLine & OpNoLine) contained + // in this module. These are for layout section 7b. + inline inst_iterator debug2_begin(); + inline inst_iterator debug2_end(); + inline IteratorRange debugs2(); + inline IteratorRange debugs2() const; + + // Iterators for debug 3 instructions (excluding OpLine & OpNoLine) contained + // in this module. These are for layout section 7c. + inline inst_iterator debug3_begin(); + inline inst_iterator debug3_end(); + inline IteratorRange debugs3(); + inline IteratorRange debugs3() const; + + // Iterators for entry point instructions contained in this module + inline IteratorRange entry_points(); + inline IteratorRange entry_points() const; + + // Iterators for execution_modes instructions contained in this module. + inline inst_iterator execution_mode_begin(); + inline inst_iterator execution_mode_end(); + inline IteratorRange execution_modes(); + inline IteratorRange execution_modes() const; + + // Clears all debug instructions (excluding OpLine & OpNoLine). + void debug_clear() { + debug1_clear(); + debug2_clear(); + debug3_clear(); + } + + // Clears all debug 1 instructions (excluding OpLine & OpNoLine). + void debug1_clear() { debugs1_.clear(); } + + // Clears all debug 2 instructions (excluding OpLine & OpNoLine). + void debug2_clear() { debugs2_.clear(); } + + // Clears all debug 3 instructions (excluding OpLine & OpNoLine). + void debug3_clear() { debugs3_.clear(); } + + // Iterators for annotation instructions contained in this module. + inline inst_iterator annotation_begin(); + inline inst_iterator annotation_end(); + IteratorRange annotations(); + IteratorRange annotations() const; + + // Iterators for extension instructions contained in this module. + inline inst_iterator extension_begin(); + inline inst_iterator extension_end(); + IteratorRange extensions(); + IteratorRange extensions() const; + + // Iterators for types, constants and global variables instructions. + inline inst_iterator types_values_begin(); + inline inst_iterator types_values_end(); + inline IteratorRange types_values(); + inline IteratorRange types_values() const; + + // Iterators for functions contained in this module. + iterator begin() { return iterator(&functions_, functions_.begin()); } + iterator end() { return iterator(&functions_, functions_.end()); } + const_iterator begin() const { return cbegin(); } + const_iterator end() const { return cend(); } + inline const_iterator cbegin() const; + inline const_iterator cend() const; + + // Invokes function |f| on all instructions in this module, and optionally on + // the debug line instructions that precede them. + void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false); + void ForEachInst(const std::function& f, + bool run_on_debug_line_insts = false) const; + + // Pushes the binary segments for this instruction into the back of *|binary|. + // If |skip_nop| is true and this is a OpNop, do nothing. + void ToBinary(std::vector* binary, bool skip_nop) const; + + // Returns 1 more than the maximum Id value mentioned in the module. + uint32_t ComputeIdBound() const; + + // Returns true if module has capability |cap| + bool HasExplicitCapability(uint32_t cap); + + // Returns id for OpExtInst instruction for extension |extstr|. + // Returns 0 if not found. + uint32_t GetExtInstImportId(const char* extstr); + + // Sets the associated context for this module + void SetContext(IRContext* c) { context_ = c; } + + // Gets the associated context for this module + IRContext* context() const { return context_; } + + private: + ModuleHeader header_; // Module header + + // The following fields respect the "Logical Layout of a Module" in + // Section 2.4 of the SPIR-V specification. + IRContext* context_; + InstructionList capabilities_; + InstructionList extensions_; + InstructionList ext_inst_imports_; + // A module only has one memory model instruction. + std::unique_ptr memory_model_; + InstructionList entry_points_; + InstructionList execution_modes_; + InstructionList debugs1_; + InstructionList debugs2_; + InstructionList debugs3_; + InstructionList annotations_; + // Type declarations, constants, and global variable declarations. + InstructionList types_values_; + std::vector> functions_; +}; + +// Pretty-prints |module| to |str|. Returns |str|. +std::ostream& operator<<(std::ostream& str, const Module& module); + +inline void Module::AddCapability(std::unique_ptr c) { + capabilities_.push_back(std::move(c)); +} + +inline void Module::AddExtension(std::unique_ptr e) { + extensions_.push_back(std::move(e)); +} + +inline void Module::AddExtInstImport(std::unique_ptr e) { + ext_inst_imports_.push_back(std::move(e)); +} + +inline void Module::SetMemoryModel(std::unique_ptr m) { + memory_model_ = std::move(m); +} + +inline void Module::AddEntryPoint(std::unique_ptr e) { + entry_points_.push_back(std::move(e)); +} + +inline void Module::AddExecutionMode(std::unique_ptr e) { + execution_modes_.push_back(std::move(e)); +} + +inline void Module::AddDebug1Inst(std::unique_ptr d) { + debugs1_.push_back(std::move(d)); +} + +inline void Module::AddDebug2Inst(std::unique_ptr d) { + debugs2_.push_back(std::move(d)); +} + +inline void Module::AddDebug3Inst(std::unique_ptr d) { + debugs3_.push_back(std::move(d)); +} + +inline void Module::AddAnnotationInst(std::unique_ptr a) { + annotations_.push_back(std::move(a)); +} + +inline void Module::AddType(std::unique_ptr t) { + types_values_.push_back(std::move(t)); +} + +inline void Module::AddGlobalValue(std::unique_ptr v) { + types_values_.push_back(std::move(v)); +} + +inline void Module::AddFunction(std::unique_ptr f) { + functions_.emplace_back(std::move(f)); +} + +inline Module::inst_iterator Module::capability_begin() { + return capabilities_.begin(); +} +inline Module::inst_iterator Module::capability_end() { + return capabilities_.end(); +} + +inline IteratorRange Module::capabilities() { + return make_range(capabilities_.begin(), capabilities_.end()); +} + +inline IteratorRange Module::capabilities() const { + return make_range(capabilities_.begin(), capabilities_.end()); +} + +inline Module::inst_iterator Module::ext_inst_import_begin() { + return ext_inst_imports_.begin(); +} +inline Module::inst_iterator Module::ext_inst_import_end() { + return ext_inst_imports_.end(); +} + +inline IteratorRange Module::ext_inst_imports() { + return make_range(ext_inst_imports_.begin(), ext_inst_imports_.end()); +} + +inline IteratorRange Module::ext_inst_imports() + const { + return make_range(ext_inst_imports_.begin(), ext_inst_imports_.end()); +} + +inline Module::inst_iterator Module::debug1_begin() { return debugs1_.begin(); } +inline Module::inst_iterator Module::debug1_end() { return debugs1_.end(); } + +inline IteratorRange Module::debugs1() { + return make_range(debugs1_.begin(), debugs1_.end()); +} + +inline IteratorRange Module::debugs1() const { + return make_range(debugs1_.begin(), debugs1_.end()); +} + +inline Module::inst_iterator Module::debug2_begin() { return debugs2_.begin(); } +inline Module::inst_iterator Module::debug2_end() { return debugs2_.end(); } + +inline IteratorRange Module::debugs2() { + return make_range(debugs2_.begin(), debugs2_.end()); +} + +inline IteratorRange Module::debugs2() const { + return make_range(debugs2_.begin(), debugs2_.end()); +} + +inline Module::inst_iterator Module::debug3_begin() { return debugs3_.begin(); } +inline Module::inst_iterator Module::debug3_end() { return debugs3_.end(); } + +inline IteratorRange Module::debugs3() { + return make_range(debugs3_.begin(), debugs3_.end()); +} + +inline IteratorRange Module::debugs3() const { + return make_range(debugs3_.begin(), debugs3_.end()); +} + +inline IteratorRange Module::entry_points() { + return make_range(entry_points_.begin(), entry_points_.end()); +} + +inline IteratorRange Module::entry_points() const { + return make_range(entry_points_.begin(), entry_points_.end()); +} + +inline Module::inst_iterator Module::execution_mode_begin() { + return execution_modes_.begin(); +} +inline Module::inst_iterator Module::execution_mode_end() { + return execution_modes_.end(); +} + +inline IteratorRange Module::execution_modes() { + return make_range(execution_modes_.begin(), execution_modes_.end()); +} + +inline IteratorRange Module::execution_modes() + const { + return make_range(execution_modes_.begin(), execution_modes_.end()); +} + +inline Module::inst_iterator Module::annotation_begin() { + return annotations_.begin(); +} +inline Module::inst_iterator Module::annotation_end() { + return annotations_.end(); +} + +inline IteratorRange Module::annotations() { + return make_range(annotations_.begin(), annotations_.end()); +} + +inline IteratorRange Module::annotations() const { + return make_range(annotations_.begin(), annotations_.end()); +} + +inline Module::inst_iterator Module::extension_begin() { + return extensions_.begin(); +} +inline Module::inst_iterator Module::extension_end() { + return extensions_.end(); +} + +inline IteratorRange Module::extensions() { + return make_range(extensions_.begin(), extensions_.end()); +} + +inline IteratorRange Module::extensions() const { + return make_range(extensions_.begin(), extensions_.end()); +} + +inline Module::inst_iterator Module::types_values_begin() { + return types_values_.begin(); +} + +inline Module::inst_iterator Module::types_values_end() { + return types_values_.end(); +} + +inline IteratorRange Module::types_values() { + return make_range(types_values_.begin(), types_values_.end()); +} + +inline IteratorRange Module::types_values() const { + return make_range(types_values_.begin(), types_values_.end()); +} + +inline Module::const_iterator Module::cbegin() const { + return const_iterator(&functions_, functions_.cbegin()); +} + +inline Module::const_iterator Module::cend() const { + return const_iterator(&functions_, functions_.cend()); +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_MODULE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/null_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/null_pass.h new file mode 100644 index 00000000000..2b5974fb9ba --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/null_pass.h @@ -0,0 +1,34 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_NULL_PASS_H_ +#define SOURCE_OPT_NULL_PASS_H_ + +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class NullPass : public Pass { + public: + const char* name() const override { return "null"; } + Status Process() override { return Status::SuccessWithoutChange; } +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_NULL_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp new file mode 100644 index 00000000000..30654869c5d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/optimizer.cpp @@ -0,0 +1,752 @@ +// Copyright (c) 2016 Google 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. + +#include "spirv-tools/optimizer.hpp" + +#include +#include +#include +#include +#include + +#include "source/opt/build_module.h" +#include "source/opt/log.h" +#include "source/opt/pass_manager.h" +#include "source/opt/passes.h" +#include "source/opt/reduce_load_size.h" +#include "source/opt/simplification_pass.h" +#include "source/util/make_unique.h" + +namespace spvtools { + +struct Optimizer::PassToken::Impl { + Impl(std::unique_ptr p) : pass(std::move(p)) {} + + std::unique_ptr pass; // Internal implementation pass. +}; + +Optimizer::PassToken::PassToken( + std::unique_ptr impl) + : impl_(std::move(impl)) {} + +Optimizer::PassToken::PassToken(std::unique_ptr&& pass) + : impl_(MakeUnique(std::move(pass))) {} + +Optimizer::PassToken::PassToken(PassToken&& that) + : impl_(std::move(that.impl_)) {} + +Optimizer::PassToken& Optimizer::PassToken::operator=(PassToken&& that) { + impl_ = std::move(that.impl_); + return *this; +} + +Optimizer::PassToken::~PassToken() {} + +struct Optimizer::Impl { + explicit Impl(spv_target_env env) : target_env(env), pass_manager() {} + + const spv_target_env target_env; // Target environment. + opt::PassManager pass_manager; // Internal implementation pass manager. +}; + +Optimizer::Optimizer(spv_target_env env) : impl_(new Impl(env)) {} + +Optimizer::~Optimizer() {} + +void Optimizer::SetMessageConsumer(MessageConsumer c) { + // All passes' message consumer needs to be updated. + for (uint32_t i = 0; i < impl_->pass_manager.NumPasses(); ++i) { + impl_->pass_manager.GetPass(i)->SetMessageConsumer(c); + } + impl_->pass_manager.SetMessageConsumer(std::move(c)); +} + +const MessageConsumer& Optimizer::consumer() const { + return impl_->pass_manager.consumer(); +} + +Optimizer& Optimizer::RegisterPass(PassToken&& p) { + // Change to use the pass manager's consumer. + p.impl_->pass->SetMessageConsumer(consumer()); + impl_->pass_manager.AddPass(std::move(p.impl_->pass)); + return *this; +} + +// The legalization passes take a spir-v shader generated by an HLSL front-end +// and turn it into a valid vulkan spir-v shader. There are two ways in which +// the code will be invalid at the start: +// +// 1) There will be opaque objects, like images, which will be passed around +// in intermediate objects. Valid spir-v will have to replace the use of +// the opaque object with an intermediate object that is the result of the +// load of the global opaque object. +// +// 2) There will be variables that contain pointers to structured or uniform +// buffers. It be legal, the variables must be eliminated, and the +// references to the structured buffers must use the result of OpVariable +// in the Uniform storage class. +// +// Optimization in this list must accept shaders with these relaxation of the +// rules. There is not guarantee that this list of optimizations is able to +// legalize all inputs, but it is on a best effort basis. +// +// The legalization problem is essentially a very general copy propagation +// problem. The optimization we use are all used to either do copy propagation +// or enable more copy propagation. +Optimizer& Optimizer::RegisterLegalizationPasses() { + return + // Remove unreachable block so that merge return works. + RegisterPass(CreateDeadBranchElimPass()) + // Merge the returns so we can inline. + .RegisterPass(CreateMergeReturnPass()) + // Make sure uses and definitions are in the same function. + .RegisterPass(CreateInlineExhaustivePass()) + // Make private variable function scope + .RegisterPass(CreateEliminateDeadFunctionsPass()) + .RegisterPass(CreatePrivateToLocalPass()) + // Propagate the value stored to the loads in very simple cases. + .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) + .RegisterPass(CreateLocalSingleStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + // Split up aggregates so they are easier to deal with. + .RegisterPass(CreateScalarReplacementPass(0)) + // Remove loads and stores so everything is in intermediate values. + // Takes care of copy propagation of non-members. + .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) + .RegisterPass(CreateLocalSingleStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateLocalMultiStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + // Propagate constants to get as many constant conditions on branches + // as possible. + .RegisterPass(CreateCCPPass()) + .RegisterPass(CreateDeadBranchElimPass()) + // Copy propagate members. Cleans up code sequences generated by + // scalar replacement. Also important for removing OpPhi nodes. + .RegisterPass(CreateSimplificationPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateCopyPropagateArraysPass()) + // May need loop unrolling here see + // https://github.com/Microsoft/DirectXShaderCompiler/pull/930 + // Get rid of unused code that contain traces of illegal code + // or unused references to unbound external objects + .RegisterPass(CreateVectorDCEPass()) + .RegisterPass(CreateDeadInsertElimPass()) + .RegisterPass(CreateReduceLoadSizePass()) + .RegisterPass(CreateAggressiveDCEPass()); +} + +Optimizer& Optimizer::RegisterPerformancePasses() { + return RegisterPass(CreateMergeReturnPass()) + .RegisterPass(CreateInlineExhaustivePass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreatePrivateToLocalPass()) + .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) + .RegisterPass(CreateLocalSingleStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateScalarReplacementPass()) + .RegisterPass(CreateLocalAccessChainConvertPass()) + .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) + .RegisterPass(CreateLocalSingleStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateLocalMultiStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateCCPPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateRedundancyEliminationPass()) + .RegisterPass(CreateCombineAccessChainsPass()) + .RegisterPass(CreateSimplificationPass()) + .RegisterPass(CreateVectorDCEPass()) + .RegisterPass(CreateDeadInsertElimPass()) + .RegisterPass(CreateDeadBranchElimPass()) + .RegisterPass(CreateSimplificationPass()) + .RegisterPass(CreateIfConversionPass()) + .RegisterPass(CreateCopyPropagateArraysPass()) + .RegisterPass(CreateReduceLoadSizePass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateBlockMergePass()) + .RegisterPass(CreateRedundancyEliminationPass()) + .RegisterPass(CreateDeadBranchElimPass()) + .RegisterPass(CreateBlockMergePass()) + .RegisterPass(CreateSimplificationPass()); + // Currently exposing driver bugs resulting in crashes (#946) + // .RegisterPass(CreateCommonUniformElimPass()) +} + +Optimizer& Optimizer::RegisterSizePasses() { + return RegisterPass(CreateMergeReturnPass()) + .RegisterPass(CreateInlineExhaustivePass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreatePrivateToLocalPass()) + .RegisterPass(CreateScalarReplacementPass()) + .RegisterPass(CreateLocalAccessChainConvertPass()) + .RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()) + .RegisterPass(CreateLocalSingleStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateSimplificationPass()) + .RegisterPass(CreateDeadInsertElimPass()) + .RegisterPass(CreateLocalMultiStoreElimPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateCCPPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateDeadBranchElimPass()) + .RegisterPass(CreateIfConversionPass()) + .RegisterPass(CreateAggressiveDCEPass()) + .RegisterPass(CreateBlockMergePass()) + .RegisterPass(CreateSimplificationPass()) + .RegisterPass(CreateDeadInsertElimPass()) + .RegisterPass(CreateRedundancyEliminationPass()) + .RegisterPass(CreateCFGCleanupPass()) + // Currently exposing driver bugs resulting in crashes (#946) + // .RegisterPass(CreateCommonUniformElimPass()) + .RegisterPass(CreateAggressiveDCEPass()); +} + +bool Optimizer::RegisterPassesFromFlags(const std::vector& flags) { + for (const auto& flag : flags) { + if (!RegisterPassFromFlag(flag)) { + return false; + } + } + + return true; +} + +namespace { + +// Splits the string |flag|, of the form '--pass_name[=pass_args]' into two +// strings "pass_name" and "pass_args". If |flag| has no arguments, the second +// string will be empty. +std::pair SplitFlagArgs(const std::string& flag) { + if (flag.size() < 2) return make_pair(flag, std::string()); + + // Detect the last dash before the pass name. Since we have to + // handle single dash options (-O and -Os), count up to two dashes. + size_t dash_ix = 0; + if (flag[0] == '-' && flag[1] == '-') + dash_ix = 2; + else if (flag[0] == '-') + dash_ix = 1; + + size_t ix = flag.find('='); + return (ix != std::string::npos) + ? make_pair(flag.substr(dash_ix, ix - 2), flag.substr(ix + 1)) + : make_pair(flag.substr(dash_ix), std::string()); +} +} // namespace + +bool Optimizer::FlagHasValidForm(const std::string& flag) const { + if (flag == "-O" || flag == "-Os") { + return true; + } else if (flag.size() > 2 && flag.substr(0, 2) == "--") { + return true; + } + + Errorf(consumer(), nullptr, {}, + "%s is not a valid flag. Flag passes should have the form " + "'--pass_name[=pass_args]'. Special flag names also accepted: -O " + "and -Os.", + flag.c_str()); + return false; +} + +bool Optimizer::RegisterPassFromFlag(const std::string& flag) { + if (!FlagHasValidForm(flag)) { + return false; + } + + // Split flags of the form --pass_name=pass_args. + auto p = SplitFlagArgs(flag); + std::string pass_name = p.first; + std::string pass_args = p.second; + + // FIXME(dnovillo): This should be re-factored so that pass names can be + // automatically checked against Pass::name() and PassToken instances created + // via a template function. Additionally, class Pass should have a desc() + // method that describes the pass (so it can be used in --help). + // + // Both Pass::name() and Pass::desc() should be static class members so they + // can be invoked without creating a pass instance. + if (pass_name == "strip-debug") { + RegisterPass(CreateStripDebugInfoPass()); + } else if (pass_name == "strip-reflect") { + RegisterPass(CreateStripReflectInfoPass()); + } else if (pass_name == "set-spec-const-default-value") { + if (pass_args.size() > 0) { + auto spec_ids_vals = + opt::SetSpecConstantDefaultValuePass::ParseDefaultValuesString( + pass_args.c_str()); + if (!spec_ids_vals) { + Errorf(consumer(), nullptr, {}, + "Invalid argument for --set-spec-const-default-value: %s", + pass_args.c_str()); + return false; + } + RegisterPass( + CreateSetSpecConstantDefaultValuePass(std::move(*spec_ids_vals))); + } else { + Errorf(consumer(), nullptr, {}, + "Invalid spec constant value string '%s'. Expected a string of " + ": pairs.", + pass_args.c_str()); + return false; + } + } else if (pass_name == "if-conversion") { + RegisterPass(CreateIfConversionPass()); + } else if (pass_name == "freeze-spec-const") { + RegisterPass(CreateFreezeSpecConstantValuePass()); + } else if (pass_name == "inline-entry-points-exhaustive") { + RegisterPass(CreateInlineExhaustivePass()); + } else if (pass_name == "inline-entry-points-opaque") { + RegisterPass(CreateInlineOpaquePass()); + } else if (pass_name == "combine-access-chains") { + RegisterPass(CreateCombineAccessChainsPass()); + } else if (pass_name == "convert-local-access-chains") { + RegisterPass(CreateLocalAccessChainConvertPass()); + } else if (pass_name == "eliminate-dead-code-aggressive") { + RegisterPass(CreateAggressiveDCEPass()); + } else if (pass_name == "eliminate-insert-extract") { + RegisterPass(CreateInsertExtractElimPass()); + } else if (pass_name == "eliminate-local-single-block") { + RegisterPass(CreateLocalSingleBlockLoadStoreElimPass()); + } else if (pass_name == "eliminate-local-single-store") { + RegisterPass(CreateLocalSingleStoreElimPass()); + } else if (pass_name == "merge-blocks") { + RegisterPass(CreateBlockMergePass()); + } else if (pass_name == "merge-return") { + RegisterPass(CreateMergeReturnPass()); + } else if (pass_name == "eliminate-dead-branches") { + RegisterPass(CreateDeadBranchElimPass()); + } else if (pass_name == "eliminate-dead-functions") { + RegisterPass(CreateEliminateDeadFunctionsPass()); + } else if (pass_name == "eliminate-local-multi-store") { + RegisterPass(CreateLocalMultiStoreElimPass()); + } else if (pass_name == "eliminate-common-uniform") { + RegisterPass(CreateCommonUniformElimPass()); + } else if (pass_name == "eliminate-dead-const") { + RegisterPass(CreateEliminateDeadConstantPass()); + } else if (pass_name == "eliminate-dead-inserts") { + RegisterPass(CreateDeadInsertElimPass()); + } else if (pass_name == "eliminate-dead-variables") { + RegisterPass(CreateDeadVariableEliminationPass()); + } else if (pass_name == "fold-spec-const-op-composite") { + RegisterPass(CreateFoldSpecConstantOpAndCompositePass()); + } else if (pass_name == "loop-unswitch") { + RegisterPass(CreateLoopUnswitchPass()); + } else if (pass_name == "scalar-replacement") { + if (pass_args.size() == 0) { + RegisterPass(CreateScalarReplacementPass()); + } else { + int limit = atoi(pass_args.c_str()); + if (limit > 0) { + RegisterPass(CreateScalarReplacementPass(limit)); + } else { + Error(consumer(), nullptr, {}, + "--scalar-replacement must have no arguments or a positive " + "integer argument"); + return false; + } + } + } else if (pass_name == "strength-reduction") { + RegisterPass(CreateStrengthReductionPass()); + } else if (pass_name == "unify-const") { + RegisterPass(CreateUnifyConstantPass()); + } else if (pass_name == "flatten-decorations") { + RegisterPass(CreateFlattenDecorationPass()); + } else if (pass_name == "compact-ids") { + RegisterPass(CreateCompactIdsPass()); + } else if (pass_name == "cfg-cleanup") { + RegisterPass(CreateCFGCleanupPass()); + } else if (pass_name == "local-redundancy-elimination") { + RegisterPass(CreateLocalRedundancyEliminationPass()); + } else if (pass_name == "loop-invariant-code-motion") { + RegisterPass(CreateLoopInvariantCodeMotionPass()); + } else if (pass_name == "reduce-load-size") { + RegisterPass(CreateReduceLoadSizePass()); + } else if (pass_name == "redundancy-elimination") { + RegisterPass(CreateRedundancyEliminationPass()); + } else if (pass_name == "private-to-local") { + RegisterPass(CreatePrivateToLocalPass()); + } else if (pass_name == "remove-duplicates") { + RegisterPass(CreateRemoveDuplicatesPass()); + } else if (pass_name == "workaround-1209") { + RegisterPass(CreateWorkaround1209Pass()); + } else if (pass_name == "replace-invalid-opcode") { + RegisterPass(CreateReplaceInvalidOpcodePass()); + } else if (pass_name == "simplify-instructions") { + RegisterPass(CreateSimplificationPass()); + } else if (pass_name == "ssa-rewrite") { + RegisterPass(CreateSSARewritePass()); + } else if (pass_name == "copy-propagate-arrays") { + RegisterPass(CreateCopyPropagateArraysPass()); + } else if (pass_name == "loop-fission") { + int register_threshold_to_split = + (pass_args.size() > 0) ? atoi(pass_args.c_str()) : -1; + if (register_threshold_to_split > 0) { + RegisterPass(CreateLoopFissionPass( + static_cast(register_threshold_to_split))); + } else { + Error(consumer(), nullptr, {}, + "--loop-fission must have a positive integer argument"); + return false; + } + } else if (pass_name == "loop-fusion") { + int max_registers_per_loop = + (pass_args.size() > 0) ? atoi(pass_args.c_str()) : -1; + if (max_registers_per_loop > 0) { + RegisterPass( + CreateLoopFusionPass(static_cast(max_registers_per_loop))); + } else { + Error(consumer(), nullptr, {}, + "--loop-fusion must have a positive integer argument"); + return false; + } + } else if (pass_name == "loop-unroll") { + RegisterPass(CreateLoopUnrollPass(true)); + } else if (pass_name == "vector-dce") { + RegisterPass(CreateVectorDCEPass()); + } else if (pass_name == "loop-unroll-partial") { + int factor = (pass_args.size() > 0) ? atoi(pass_args.c_str()) : 0; + if (factor > 0) { + RegisterPass(CreateLoopUnrollPass(false, factor)); + } else { + Error(consumer(), nullptr, {}, + "--loop-unroll-partial must have a positive integer argument"); + return false; + } + } else if (pass_name == "loop-peeling") { + RegisterPass(CreateLoopPeelingPass()); + } else if (pass_name == "loop-peeling-threshold") { + int factor = (pass_args.size() > 0) ? atoi(pass_args.c_str()) : 0; + if (factor > 0) { + opt::LoopPeelingPass::SetLoopPeelingThreshold(factor); + } else { + Error(consumer(), nullptr, {}, + "--loop-peeling-threshold must have a positive integer argument"); + return false; + } + } else if (pass_name == "ccp") { + RegisterPass(CreateCCPPass()); + } else if (pass_name == "O") { + RegisterPerformancePasses(); + } else if (pass_name == "Os") { + RegisterSizePasses(); + } else if (pass_name == "legalize-hlsl") { + RegisterLegalizationPasses(); + } else { + Errorf(consumer(), nullptr, {}, + "Unknown flag '--%s'. Use --help for a list of valid flags", + pass_name.c_str()); + return false; + } + + return true; +} + +bool Optimizer::Run(const uint32_t* original_binary, + const size_t original_binary_size, + std::vector* optimized_binary) const { + return Run(original_binary, original_binary_size, optimized_binary, + ValidatorOptions()); +} + +bool Optimizer::Run(const uint32_t* original_binary, + const size_t original_binary_size, + std::vector* optimized_binary, + const ValidatorOptions& options, + bool skip_validation) const { + spvtools::SpirvTools tools(impl_->target_env); + tools.SetMessageConsumer(impl_->pass_manager.consumer()); + if (!skip_validation && + !tools.Validate(original_binary, original_binary_size, options)) { + return false; + } + + std::unique_ptr context = BuildModule( + impl_->target_env, consumer(), original_binary, original_binary_size); + if (context == nullptr) return false; + + auto status = impl_->pass_manager.Run(context.get()); + if (status == opt::Pass::Status::SuccessWithChange || + (status == opt::Pass::Status::SuccessWithoutChange && + (optimized_binary->data() != original_binary || + optimized_binary->size() != original_binary_size))) { + optimized_binary->clear(); + context->module()->ToBinary(optimized_binary, /* skip_nop = */ true); + } + + return status != opt::Pass::Status::Failure; +} + +Optimizer& Optimizer::SetPrintAll(std::ostream* out) { + impl_->pass_manager.SetPrintAll(out); + return *this; +} + +Optimizer& Optimizer::SetTimeReport(std::ostream* out) { + impl_->pass_manager.SetTimeReport(out); + return *this; +} + +Optimizer::PassToken CreateNullPass() { + return MakeUnique(MakeUnique()); +} + +Optimizer::PassToken CreateStripDebugInfoPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateStripReflectInfoPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateEliminateDeadFunctionsPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateSetSpecConstantDefaultValuePass( + const std::unordered_map& id_value_map) { + return MakeUnique( + MakeUnique(id_value_map)); +} + +Optimizer::PassToken CreateSetSpecConstantDefaultValuePass( + const std::unordered_map>& id_value_map) { + return MakeUnique( + MakeUnique(id_value_map)); +} + +Optimizer::PassToken CreateFlattenDecorationPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateFreezeSpecConstantValuePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateFoldSpecConstantOpAndCompositePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateUnifyConstantPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateEliminateDeadConstantPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateDeadVariableEliminationPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateStrengthReductionPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateBlockMergePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateInlineExhaustivePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateInlineOpaquePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLocalAccessChainConvertPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLocalSingleBlockLoadStoreElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLocalSingleStoreElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateInsertExtractElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateDeadInsertElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateDeadBranchElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLocalMultiStoreElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateAggressiveDCEPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateCommonUniformElimPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateCompactIdsPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateMergeReturnPass() { + return MakeUnique( + MakeUnique()); +} + +std::vector Optimizer::GetPassNames() const { + std::vector v; + for (uint32_t i = 0; i < impl_->pass_manager.NumPasses(); i++) { + v.push_back(impl_->pass_manager.GetPass(i)->name()); + } + return v; +} + +Optimizer::PassToken CreateCFGCleanupPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLocalRedundancyEliminationPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLoopFissionPass(size_t threshold) { + return MakeUnique( + MakeUnique(threshold)); +} + +Optimizer::PassToken CreateLoopFusionPass(size_t max_registers_per_loop) { + return MakeUnique( + MakeUnique(max_registers_per_loop)); +} + +Optimizer::PassToken CreateLoopInvariantCodeMotionPass() { + return MakeUnique(MakeUnique()); +} + +Optimizer::PassToken CreateLoopPeelingPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLoopUnswitchPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateRedundancyEliminationPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateRemoveDuplicatesPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateScalarReplacementPass(uint32_t size_limit) { + return MakeUnique( + MakeUnique(size_limit)); +} + +Optimizer::PassToken CreatePrivateToLocalPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateCCPPass() { + return MakeUnique(MakeUnique()); +} + +Optimizer::PassToken CreateWorkaround1209Pass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateIfConversionPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateReplaceInvalidOpcodePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateSimplificationPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateLoopUnrollPass(bool fully_unroll, int factor) { + return MakeUnique( + MakeUnique(fully_unroll, factor)); +} + +Optimizer::PassToken CreateSSARewritePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateCopyPropagateArraysPass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateVectorDCEPass() { + return MakeUnique(MakeUnique()); +} + +Optimizer::PassToken CreateReduceLoadSizePass() { + return MakeUnique( + MakeUnique()); +} + +Optimizer::PassToken CreateCombineAccessChainsPass() { + return MakeUnique( + MakeUnique()); +} +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp new file mode 100644 index 00000000000..4c4a232c6c5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass.cpp @@ -0,0 +1,129 @@ +// Copyright (c) 2017 The Khronos Group Inc. +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include "source/opt/pass.h" + +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +namespace { + +const uint32_t kEntryPointFunctionIdInIdx = 1; +const uint32_t kTypePointerTypeIdInIdx = 1; + +} // namespace + +Pass::Pass() : consumer_(nullptr), context_(nullptr), already_run_(false) {} + +void Pass::AddCalls(Function* func, std::queue* todo) { + for (auto bi = func->begin(); bi != func->end(); ++bi) + for (auto ii = bi->begin(); ii != bi->end(); ++ii) + if (ii->opcode() == SpvOpFunctionCall) + todo->push(ii->GetSingleWordInOperand(0)); +} + +bool Pass::ProcessEntryPointCallTree(ProcessFunction& pfn, Module* module) { + // Map from function's result id to function + std::unordered_map id2function; + for (auto& fn : *module) id2function[fn.result_id()] = &fn; + + // Collect all of the entry points as the roots. + std::queue roots; + for (auto& e : module->entry_points()) + roots.push(e.GetSingleWordInOperand(kEntryPointFunctionIdInIdx)); + return ProcessCallTreeFromRoots(pfn, id2function, &roots); +} + +bool Pass::ProcessReachableCallTree(ProcessFunction& pfn, + IRContext* irContext) { + // Map from function's result id to function + std::unordered_map id2function; + for (auto& fn : *irContext->module()) id2function[fn.result_id()] = &fn; + + std::queue roots; + + // Add all entry points since they can be reached from outside the module. + for (auto& e : irContext->module()->entry_points()) + roots.push(e.GetSingleWordInOperand(kEntryPointFunctionIdInIdx)); + + // Add all exported functions since they can be reached from outside the + // module. + for (auto& a : irContext->annotations()) { + // TODO: Handle group decorations as well. Currently not generate by any + // front-end, but could be coming. + if (a.opcode() == SpvOp::SpvOpDecorate) { + if (a.GetSingleWordOperand(1) == + SpvDecoration::SpvDecorationLinkageAttributes) { + uint32_t lastOperand = a.NumOperands() - 1; + if (a.GetSingleWordOperand(lastOperand) == + SpvLinkageType::SpvLinkageTypeExport) { + uint32_t id = a.GetSingleWordOperand(0); + if (id2function.count(id) != 0) roots.push(id); + } + } + } + } + + return ProcessCallTreeFromRoots(pfn, id2function, &roots); +} + +bool Pass::ProcessCallTreeFromRoots( + ProcessFunction& pfn, + const std::unordered_map& id2function, + std::queue* roots) { + // Process call tree + bool modified = false; + std::unordered_set done; + + while (!roots->empty()) { + const uint32_t fi = roots->front(); + roots->pop(); + if (done.insert(fi).second) { + Function* fn = id2function.at(fi); + modified = pfn(fn) || modified; + AddCalls(fn, roots); + } + } + return modified; +} + +Pass::Status Pass::Run(IRContext* ctx) { + if (already_run_) { + return Status::Failure; + } + already_run_ = true; + + context_ = ctx; + Pass::Status status = Process(); + context_ = nullptr; + + if (status == Status::SuccessWithChange) { + ctx->InvalidateAnalysesExceptFor(GetPreservedAnalyses()); + } + assert(ctx->IsConsistent()); + return status; +} + +uint32_t Pass::GetPointeeTypeId(const Instruction* ptrInst) const { + const uint32_t ptrTypeId = ptrInst->type_id(); + const Instruction* ptrTypeInst = get_def_use_mgr()->GetDef(ptrTypeId); + return ptrTypeInst->GetSingleWordInOperand(kTypePointerTypeIdInIdx); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass.h new file mode 100644 index 00000000000..df1745099d0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass.h @@ -0,0 +1,165 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_PASS_H_ +#define SOURCE_OPT_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace opt { + +// Abstract class of a pass. All passes should implement this abstract class +// and all analysis and transformation is done via the Process() method. +class Pass { + public: + // The status of processing a module using a pass. + // + // The numbers for the cases are assigned to make sure that Failure & anything + // is Failure, SuccessWithChange & any success is SuccessWithChange. + enum class Status { + Failure = 0x00, + SuccessWithChange = 0x10, + SuccessWithoutChange = 0x11, + }; + + using ProcessFunction = std::function; + + // Destructs the pass. + virtual ~Pass() = default; + + // Returns a descriptive name for this pass. + // + // NOTE: When deriving a new pass class, make sure you make the name + // compatible with the corresponding spirv-opt command-line flag. For example, + // if you add the flag --my-pass to spirv-opt, make this function return + // "my-pass" (no leading hyphens). + virtual const char* name() const = 0; + + // Sets the message consumer to the given |consumer|. |consumer| which will be + // invoked every time there is a message to be communicated to the outside. + void SetMessageConsumer(MessageConsumer c) { consumer_ = std::move(c); } + + // Returns the reference to the message consumer for this pass. + const MessageConsumer& consumer() const { return consumer_; } + + // Returns the def-use manager used for this pass. TODO(dnovillo): This should + // be handled by the pass manager. + analysis::DefUseManager* get_def_use_mgr() const { + return context()->get_def_use_mgr(); + } + + analysis::DecorationManager* get_decoration_mgr() const { + return context()->get_decoration_mgr(); + } + + FeatureManager* get_feature_mgr() const { + return context()->get_feature_mgr(); + } + + // Returns a pointer to the current module for this pass. + Module* get_module() const { return context_->module(); } + + // Sets the pointer to the current context for this pass. + void SetContextForTesting(IRContext* ctx) { context_ = ctx; } + + // Returns a pointer to the current context for this pass. + IRContext* context() const { return context_; } + + // Returns a pointer to the CFG for current module. + CFG* cfg() const { return context()->cfg(); } + + // Add to |todo| all ids of functions called in |func|. + void AddCalls(Function* func, std::queue* todo); + + // Applies |pfn| to every function in the call trees that are rooted at the + // entry points. Returns true if any call |pfn| returns true. By convention + // |pfn| should return true if it modified the module. + bool ProcessEntryPointCallTree(ProcessFunction& pfn, Module* module); + + // Applies |pfn| to every function in the call trees rooted at the entry + // points and exported functions. Returns true if any call |pfn| returns + // true. By convention |pfn| should return true if it modified the module. + bool ProcessReachableCallTree(ProcessFunction& pfn, IRContext* irContext); + + // Applies |pfn| to every function in the call trees rooted at the elements of + // |roots|. Returns true if any call to |pfn| returns true. By convention + // |pfn| should return true if it modified the module. After returning + // |roots| will be empty. + bool ProcessCallTreeFromRoots( + ProcessFunction& pfn, + const std::unordered_map& id2function, + std::queue* roots); + + // Run the pass on the given |module|. Returns Status::Failure if errors occur + // when processing. Returns the corresponding Status::Success if processing is + // successful to indicate whether changes are made to the module. If there + // were any changes it will also invalidate the analyses in the IRContext + // that are not preserved. + // + // It is an error if |Run| is called twice with the same instance of the pass. + // If this happens the return value will be |Failure|. + Status Run(IRContext* ctx); + + // Returns the set of analyses that the pass is guaranteed to preserve. + virtual IRContext::Analysis GetPreservedAnalyses() { + return IRContext::kAnalysisNone; + } + + // Return type id for |ptrInst|'s pointee + uint32_t GetPointeeTypeId(const Instruction* ptrInst) const; + + protected: + // Constructs a new pass. + // + // The constructed instance will have an empty message consumer, which just + // ignores all messages from the library. Use SetMessageConsumer() to supply + // one if messages are of concern. + Pass(); + + // Processes the given |module|. Returns Status::Failure if errors occur when + // processing. Returns the corresponding Status::Success if processing is + // succesful to indicate whether changes are made to the module. + virtual Status Process() = 0; + + // Return the next available SSA id and increment it. + uint32_t TakeNextId() { return context_->TakeNextId(); } + + private: + MessageConsumer consumer_; // Message consumer. + + // The context that this pass belongs to. + IRContext* context_; + + // An instance of a pass can only be run once because it is too hard to + // enforce proper resetting of internal state for each instance. This member + // is used to check that we do not run the same instance twice. + bool already_run_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass_manager.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass_manager.cpp new file mode 100644 index 00000000000..fa1e1d8a81a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass_manager.cpp @@ -0,0 +1,71 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/pass_manager.h" + +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/util/timer.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { + +namespace opt { + +Pass::Status PassManager::Run(IRContext* context) { + auto status = Pass::Status::SuccessWithoutChange; + + // If print_all_stream_ is not null, prints the disassembly of the module + // to that stream, with the given preamble and optionally the pass name. + auto print_disassembly = [&context, this](const char* preamble, Pass* pass) { + if (print_all_stream_) { + std::vector binary; + context->module()->ToBinary(&binary, false); + SpirvTools t(SPV_ENV_UNIVERSAL_1_2); + std::string disassembly; + t.Disassemble(binary, &disassembly, 0); + *print_all_stream_ << preamble << (pass ? pass->name() : "") << "\n" + << disassembly << std::endl; + } + }; + + SPIRV_TIMER_DESCRIPTION(time_report_stream_, /* measure_mem_usage = */ true); + for (auto& pass : passes_) { + print_disassembly("; IR before pass ", pass.get()); + SPIRV_TIMER_SCOPED(time_report_stream_, (pass ? pass->name() : ""), true); + const auto one_status = pass->Run(context); + if (one_status == Pass::Status::Failure) return one_status; + if (one_status == Pass::Status::SuccessWithChange) status = one_status; + + // Reset the pass to free any memory used by the pass. + pass.reset(nullptr); + } + print_disassembly("; IR after last pass", nullptr); + + // Set the Id bound in the header in case a pass forgot to do so. + // + // TODO(dnovillo): This should be unnecessary and automatically maintained by + // the IRContext. + if (status == Pass::Status::SuccessWithChange) { + context->module()->SetIdBound(context->module()->ComputeIdBound()); + } + passes_.clear(); + return status; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass_manager.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass_manager.h new file mode 100644 index 00000000000..ed88aa17c86 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/pass_manager.h @@ -0,0 +1,131 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_PASS_MANAGER_H_ +#define SOURCE_OPT_PASS_MANAGER_H_ + +#include +#include +#include +#include + +#include "source/opt/log.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +#include "source/opt/ir_context.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace opt { + +// The pass manager, responsible for tracking and running passes. +// Clients should first call AddPass() to add passes and then call Run() +// to run on a module. Passes are executed in the exact order of addition. +class PassManager { + public: + // Constructs a pass manager. + // + // The constructed instance will have an empty message consumer, which just + // ignores all messages from the library. Use SetMessageConsumer() to supply + // one if messages are of concern. + PassManager() + : consumer_(nullptr), + print_all_stream_(nullptr), + time_report_stream_(nullptr) {} + + // Sets the message consumer to the given |consumer|. + void SetMessageConsumer(MessageConsumer c) { consumer_ = std::move(c); } + + // Adds an externally constructed pass. + void AddPass(std::unique_ptr pass); + // Uses the argument |args| to construct a pass instance of type |T|, and adds + // the pass instance to this pass manger. The pass added will use this pass + // manager's message consumer. + template + void AddPass(Args&&... args); + + // Returns the number of passes added. + uint32_t NumPasses() const; + // Returns a pointer to the |index|th pass added. + inline Pass* GetPass(uint32_t index) const; + + // Returns the message consumer. + inline const MessageConsumer& consumer() const; + + // Runs all passes on the given |module|. Returns Status::Failure if errors + // occur when processing using one of the registered passes. All passes + // registered after the error-reporting pass will be skipped. Returns the + // corresponding Status::Success if processing is succesful to indicate + // whether changes are made to the module. + // + // After running all the passes, they are removed from the list. + Pass::Status Run(IRContext* context); + + // Sets the option to print the disassembly before each pass and after the + // last pass. Output is written to |out| if that is not null. No output + // is generated if |out| is null. + PassManager& SetPrintAll(std::ostream* out) { + print_all_stream_ = out; + return *this; + } + + // Sets the option to print the resource utilization of each pass. Output is + // written to |out| if that is not null. No output is generated if |out| is + // null. + PassManager& SetTimeReport(std::ostream* out) { + time_report_stream_ = out; + return *this; + } + + private: + // Consumer for messages. + MessageConsumer consumer_; + // A vector of passes. Order matters. + std::vector> passes_; + // The output stream to write disassembly to before each pass, and after + // the last pass. If this is null, no output is generated. + std::ostream* print_all_stream_; + // The output stream to write the resource utilization of each pass. If this + // is null, no output is generated. + std::ostream* time_report_stream_; +}; + +inline void PassManager::AddPass(std::unique_ptr pass) { + passes_.push_back(std::move(pass)); +} + +template +inline void PassManager::AddPass(Args&&... args) { + passes_.emplace_back(new T(std::forward(args)...)); + passes_.back()->SetMessageConsumer(consumer_); +} + +inline uint32_t PassManager::NumPasses() const { + return static_cast(passes_.size()); +} + +inline Pass* PassManager::GetPass(uint32_t index) const { + SPIRV_ASSERT(consumer_, index < passes_.size(), "index out of bound"); + return passes_[index].get(); +} + +inline const MessageConsumer& PassManager::consumer() const { + return consumer_; +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_PASS_MANAGER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/passes.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/passes.h new file mode 100644 index 00000000000..42106c8f7b7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/passes.h @@ -0,0 +1,67 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_PASSES_H_ +#define SOURCE_OPT_PASSES_H_ + +// A single header to include all passes. + +#include "source/opt/aggressive_dead_code_elim_pass.h" +#include "source/opt/block_merge_pass.h" +#include "source/opt/ccp_pass.h" +#include "source/opt/cfg_cleanup_pass.h" +#include "source/opt/combine_access_chains.h" +#include "source/opt/common_uniform_elim_pass.h" +#include "source/opt/compact_ids_pass.h" +#include "source/opt/copy_prop_arrays.h" +#include "source/opt/dead_branch_elim_pass.h" +#include "source/opt/dead_insert_elim_pass.h" +#include "source/opt/dead_variable_elimination.h" +#include "source/opt/eliminate_dead_constant_pass.h" +#include "source/opt/eliminate_dead_functions_pass.h" +#include "source/opt/flatten_decoration_pass.h" +#include "source/opt/fold_spec_constant_op_and_composite_pass.h" +#include "source/opt/freeze_spec_constant_value_pass.h" +#include "source/opt/if_conversion.h" +#include "source/opt/inline_exhaustive_pass.h" +#include "source/opt/inline_opaque_pass.h" +#include "source/opt/licm_pass.h" +#include "source/opt/local_access_chain_convert_pass.h" +#include "source/opt/local_redundancy_elimination.h" +#include "source/opt/local_single_block_elim_pass.h" +#include "source/opt/local_single_store_elim_pass.h" +#include "source/opt/local_ssa_elim_pass.h" +#include "source/opt/loop_fission.h" +#include "source/opt/loop_fusion_pass.h" +#include "source/opt/loop_peeling.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_unswitch_pass.h" +#include "source/opt/merge_return_pass.h" +#include "source/opt/null_pass.h" +#include "source/opt/private_to_local_pass.h" +#include "source/opt/reduce_load_size.h" +#include "source/opt/redundancy_elimination.h" +#include "source/opt/remove_duplicates_pass.h" +#include "source/opt/replace_invalid_opc.h" +#include "source/opt/scalar_replacement_pass.h" +#include "source/opt/set_spec_constant_default_value_pass.h" +#include "source/opt/ssa_rewrite_pass.h" +#include "source/opt/strength_reduction_pass.h" +#include "source/opt/strip_debug_info_pass.h" +#include "source/opt/strip_reflect_info_pass.h" +#include "source/opt/unify_const_pass.h" +#include "source/opt/vector_dce.h" +#include "source/opt/workaround1209.h" + +#endif // SOURCE_OPT_PASSES_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp new file mode 100644 index 00000000000..02909a72b5b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.cpp @@ -0,0 +1,186 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/private_to_local_pass.h" + +#include +#include +#include + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kVariableStorageClassInIdx = 0; +const uint32_t kSpvTypePointerTypeIdInIdx = 1; + +} // namespace + +Pass::Status PrivateToLocalPass::Process() { + bool modified = false; + + // Private variables require the shader capability. If this is not a shader, + // there is no work to do. + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityAddresses)) + return Status::SuccessWithoutChange; + + std::vector> variables_to_move; + for (auto& inst : context()->types_values()) { + if (inst.opcode() != SpvOpVariable) { + continue; + } + + if (inst.GetSingleWordInOperand(kVariableStorageClassInIdx) != + SpvStorageClassPrivate) { + continue; + } + + Function* target_function = FindLocalFunction(inst); + if (target_function != nullptr) { + variables_to_move.push_back({&inst, target_function}); + } + } + + modified = !variables_to_move.empty(); + for (auto p : variables_to_move) { + MoveVariable(p.first, p.second); + } + + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +Function* PrivateToLocalPass::FindLocalFunction(const Instruction& inst) const { + bool found_first_use = false; + Function* target_function = nullptr; + context()->get_def_use_mgr()->ForEachUser( + inst.result_id(), + [&target_function, &found_first_use, this](Instruction* use) { + BasicBlock* current_block = context()->get_instr_block(use); + if (current_block == nullptr) { + return; + } + + if (!IsValidUse(use)) { + found_first_use = true; + target_function = nullptr; + return; + } + Function* current_function = current_block->GetParent(); + if (!found_first_use) { + found_first_use = true; + target_function = current_function; + } else if (target_function != current_function) { + target_function = nullptr; + } + }); + return target_function; +} // namespace opt + +void PrivateToLocalPass::MoveVariable(Instruction* variable, + Function* function) { + // The variable needs to be removed from the global section, and placed in the + // header of the function. First step remove from the global list. + variable->RemoveFromList(); + std::unique_ptr var(variable); // Take ownership. + context()->ForgetUses(variable); + + // Update the storage class of the variable. + variable->SetInOperand(kVariableStorageClassInIdx, {SpvStorageClassFunction}); + + // Update the type as well. + uint32_t new_type_id = GetNewType(variable->type_id()); + variable->SetResultType(new_type_id); + + // Place the variable at the start of the first basic block. + context()->AnalyzeUses(variable); + context()->set_instr_block(variable, &*function->begin()); + function->begin()->begin()->InsertBefore(move(var)); + + // Update uses where the type may have changed. + UpdateUses(variable->result_id()); +} + +uint32_t PrivateToLocalPass::GetNewType(uint32_t old_type_id) { + auto type_mgr = context()->get_type_mgr(); + Instruction* old_type_inst = get_def_use_mgr()->GetDef(old_type_id); + uint32_t pointee_type_id = + old_type_inst->GetSingleWordInOperand(kSpvTypePointerTypeIdInIdx); + uint32_t new_type_id = + type_mgr->FindPointerToType(pointee_type_id, SpvStorageClassFunction); + context()->UpdateDefUse(context()->get_def_use_mgr()->GetDef(new_type_id)); + return new_type_id; +} + +bool PrivateToLocalPass::IsValidUse(const Instruction* inst) const { + // The cases in this switch have to match the cases in |UpdateUse|. + // If we don't know how to update it, it is not valid. + switch (inst->opcode()) { + case SpvOpLoad: + case SpvOpStore: + case SpvOpImageTexelPointer: // Treat like a load + return true; + case SpvOpAccessChain: + return context()->get_def_use_mgr()->WhileEachUser( + inst, [this](const Instruction* user) { + if (!IsValidUse(user)) return false; + return true; + }); + case SpvOpName: + return true; + default: + return spvOpcodeIsDecoration(inst->opcode()); + } +} + +void PrivateToLocalPass::UpdateUse(Instruction* inst) { + // The cases in this switch have to match the cases in |IsValidUse|. If we + // don't think it is valid, the optimization will not view the variable as a + // candidate, and therefore the use will not be updated. + switch (inst->opcode()) { + case SpvOpLoad: + case SpvOpStore: + case SpvOpImageTexelPointer: // Treat like a load + // The type is fine because it is the type pointed to, and that does not + // change. + break; + case SpvOpAccessChain: + context()->ForgetUses(inst); + inst->SetResultType(GetNewType(inst->type_id())); + context()->AnalyzeUses(inst); + + // Update uses where the type may have changed. + UpdateUses(inst->result_id()); + break; + case SpvOpName: + break; + default: + assert(spvOpcodeIsDecoration(inst->opcode()) && + "Do not know how to update the type for this instruction."); + break; + } +} +void PrivateToLocalPass::UpdateUses(uint32_t id) { + std::vector uses; + context()->get_def_use_mgr()->ForEachUser( + id, [&uses](Instruction* use) { uses.push_back(use); }); + + for (Instruction* use : uses) { + UpdateUse(use); + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.h new file mode 100644 index 00000000000..f706e6e91ab --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/private_to_local_pass.h @@ -0,0 +1,72 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_PRIVATE_TO_LOCAL_PASS_H_ +#define SOURCE_OPT_PRIVATE_TO_LOCAL_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// This pass implements total redundancy elimination. This is the same as +// local redundancy elimination except it looks across basic block boundaries. +// An instruction, inst, is totally redundant if there is another instruction +// that dominates inst, and also computes the same value. +class PrivateToLocalPass : public Pass { + public: + const char* name() const override { return "private-to-local"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisNameMap; + } + + private: + // Moves |variable| from the private storage class to the function storage + // class of |function|. + void MoveVariable(Instruction* variable, Function* function); + + // |inst| is an instruction declaring a varible. If that variable is + // referenced in a single function and all of uses are valid as defined by + // |IsValidUse|, then that function is returned. Otherwise, the return + // value is |nullptr|. + Function* FindLocalFunction(const Instruction& inst) const; + + // Returns true is |inst| is a valid use of a pointer. In this case, a + // valid use is one where the transformation is able to rewrite the type to + // match a change in storage class of the original variable. + bool IsValidUse(const Instruction* inst) const; + + // Given the result id of a pointer type, |old_type_id|, this function + // returns the id of a the same pointer type except the storage class has + // been changed to function. If the type does not already exist, it will be + // created. + uint32_t GetNewType(uint32_t old_type_id); + + // Updates |inst|, and any instruction dependent on |inst|, to reflect the + // change of the base pointer now pointing to the function storage class. + void UpdateUse(Instruction* inst); + void UpdateUses(uint32_t id); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_PRIVATE_TO_LOCAL_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp new file mode 100644 index 00000000000..6a1f1aafbc5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/propagator.cpp @@ -0,0 +1,291 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/propagator.h" + +namespace spvtools { +namespace opt { + +void SSAPropagator::AddControlEdge(const Edge& edge) { + BasicBlock* dest_bb = edge.dest; + + // Refuse to add the exit block to the work list. + if (dest_bb == ctx_->cfg()->pseudo_exit_block()) { + return; + } + + // Try to mark the edge executable. If it was already in the set of + // executable edges, do nothing. + if (!MarkEdgeExecutable(edge)) { + return; + } + + // If the edge had not already been marked executable, add the destination + // basic block to the work list. + blocks_.push(dest_bb); +} + +void SSAPropagator::AddSSAEdges(Instruction* instr) { + // Ignore instructions that produce no result. + if (instr->result_id() == 0) { + return; + } + + get_def_use_mgr()->ForEachUser( + instr->result_id(), [this](Instruction* use_instr) { + // If the basic block for |use_instr| has not been simulated yet, do + // nothing. The instruction |use_instr| will be simulated next time the + // block is scheduled. + if (!BlockHasBeenSimulated(ctx_->get_instr_block(use_instr))) { + return; + } + + if (ShouldSimulateAgain(use_instr)) { + ssa_edge_uses_.push(use_instr); + } + }); +} + +bool SSAPropagator::IsPhiArgExecutable(Instruction* phi, uint32_t i) const { + BasicBlock* phi_bb = ctx_->get_instr_block(phi); + + uint32_t in_label_id = phi->GetSingleWordOperand(i + 1); + Instruction* in_label_instr = get_def_use_mgr()->GetDef(in_label_id); + BasicBlock* in_bb = ctx_->get_instr_block(in_label_instr); + + return IsEdgeExecutable(Edge(in_bb, phi_bb)); +} + +bool SSAPropagator::SetStatus(Instruction* inst, PropStatus status) { + bool has_old_status = false; + PropStatus old_status = kVarying; + if (HasStatus(inst)) { + has_old_status = true; + old_status = Status(inst); + } + + assert((!has_old_status || old_status <= status) && + "Invalid lattice transition"); + + bool status_changed = !has_old_status || (old_status != status); + if (status_changed) statuses_[inst] = status; + + return status_changed; +} + +bool SSAPropagator::Simulate(Instruction* instr) { + bool changed = false; + + // Don't bother visiting instructions that should not be simulated again. + if (!ShouldSimulateAgain(instr)) { + return changed; + } + + BasicBlock* dest_bb = nullptr; + PropStatus status = visit_fn_(instr, &dest_bb); + bool status_changed = SetStatus(instr, status); + + if (status == kVarying) { + // The statement produces a varying result, add it to the list of statements + // not to simulate anymore and add its SSA def-use edges for simulation. + DontSimulateAgain(instr); + if (status_changed) { + AddSSAEdges(instr); + } + + // If |instr| is a block terminator, add all the control edges out of its + // block. + if (instr->IsBlockTerminator()) { + BasicBlock* block = ctx_->get_instr_block(instr); + for (const auto& e : bb_succs_.at(block)) { + AddControlEdge(e); + } + } + return false; + } else if (status == kInteresting) { + // Add the SSA edges coming out of this instruction if the propagation + // status has changed. + if (status_changed) { + AddSSAEdges(instr); + } + + // If there are multiple outgoing control flow edges and we know which one + // will be taken, add the destination block to the CFG work list. + if (dest_bb) { + AddControlEdge(Edge(ctx_->get_instr_block(instr), dest_bb)); + } + changed = true; + } + + // At this point, we are dealing with instructions that are in status + // kInteresting or kNotInteresting. To decide whether this instruction should + // be simulated again, we examine its operands. If at least one operand O is + // defined at an instruction D that should be simulated again, then the output + // of D might affect |instr|, so we should simulate |instr| again. + bool has_operands_to_simulate = false; + if (instr->opcode() == SpvOpPhi) { + // For Phi instructions, an operand causes the Phi to be simulated again if + // the operand comes from an edge that has not yet been traversed or if its + // definition should be simulated again. + for (uint32_t i = 2; i < instr->NumOperands(); i += 2) { + // Phi arguments come in pairs. Index 'i' contains the + // variable id, index 'i + 1' is the originating block id. + assert(i % 2 == 0 && i < instr->NumOperands() - 1 && + "malformed Phi arguments"); + + uint32_t arg_id = instr->GetSingleWordOperand(i); + Instruction* arg_def_instr = get_def_use_mgr()->GetDef(arg_id); + if (!IsPhiArgExecutable(instr, i) || ShouldSimulateAgain(arg_def_instr)) { + has_operands_to_simulate = true; + break; + } + } + } else { + // For regular instructions, check if the defining instruction of each + // operand needs to be simulated again. If so, then this instruction should + // also be simulated again. + has_operands_to_simulate = + !instr->WhileEachInId([this](const uint32_t* use) { + Instruction* def_instr = get_def_use_mgr()->GetDef(*use); + if (ShouldSimulateAgain(def_instr)) { + return false; + } + return true; + }); + } + + if (!has_operands_to_simulate) { + DontSimulateAgain(instr); + } + + return changed; +} + +bool SSAPropagator::Simulate(BasicBlock* block) { + if (block == ctx_->cfg()->pseudo_exit_block()) { + return false; + } + + // Always simulate Phi instructions, even if we have simulated this block + // before. We do this because Phi instructions receive their inputs from + // incoming edges. When those edges are marked executable, the corresponding + // operand can be simulated. + bool changed = false; + block->ForEachPhiInst( + [&changed, this](Instruction* instr) { changed |= Simulate(instr); }); + + // If this is the first time this block is being simulated, simulate every + // statement in it. + if (!BlockHasBeenSimulated(block)) { + block->ForEachInst([this, &changed](Instruction* instr) { + if (instr->opcode() != SpvOpPhi) { + changed |= Simulate(instr); + } + }); + + MarkBlockSimulated(block); + + // If this block has exactly one successor, mark the edge to its successor + // as executable. + if (bb_succs_.at(block).size() == 1) { + AddControlEdge(bb_succs_.at(block).at(0)); + } + } + + return changed; +} + +void SSAPropagator::Initialize(Function* fn) { + // Compute predecessor and successor blocks for every block in |fn|'s CFG. + // TODO(dnovillo): Move this to CFG and always build them. Alternately, + // move it to IRContext and build CFG preds/succs on-demand. + bb_succs_[ctx_->cfg()->pseudo_entry_block()].push_back( + Edge(ctx_->cfg()->pseudo_entry_block(), fn->entry().get())); + + for (auto& block : *fn) { + const auto& const_block = block; + const_block.ForEachSuccessorLabel([this, &block](const uint32_t label_id) { + BasicBlock* succ_bb = + ctx_->get_instr_block(get_def_use_mgr()->GetDef(label_id)); + bb_succs_[&block].push_back(Edge(&block, succ_bb)); + bb_preds_[succ_bb].push_back(Edge(succ_bb, &block)); + }); + if (block.IsReturnOrAbort()) { + bb_succs_[&block].push_back( + Edge(&block, ctx_->cfg()->pseudo_exit_block())); + bb_preds_[ctx_->cfg()->pseudo_exit_block()].push_back( + Edge(ctx_->cfg()->pseudo_exit_block(), &block)); + } + } + + // Add the edges out of the entry block to seed the propagator. + const auto& entry_succs = bb_succs_[ctx_->cfg()->pseudo_entry_block()]; + for (const auto& e : entry_succs) { + AddControlEdge(e); + } +} + +bool SSAPropagator::Run(Function* fn) { + Initialize(fn); + + bool changed = false; + while (!blocks_.empty() || !ssa_edge_uses_.empty()) { + // Simulate all blocks first. Simulating blocks will add SSA edges to + // follow after all the blocks have been simulated. + if (!blocks_.empty()) { + auto block = blocks_.front(); + changed |= Simulate(block); + blocks_.pop(); + continue; + } + + // Simulate edges from the SSA queue. + if (!ssa_edge_uses_.empty()) { + Instruction* instr = ssa_edge_uses_.front(); + changed |= Simulate(instr); + ssa_edge_uses_.pop(); + } + } + +#ifndef NDEBUG + // Verify all visited values have settled. No value that has been simulated + // should end on not interesting. + fn->ForEachInst([this](Instruction* inst) { + assert( + (!HasStatus(inst) || Status(inst) != SSAPropagator::kNotInteresting) && + "Unsettled value"); + }); +#endif + + return changed; +} + +std::ostream& operator<<(std::ostream& str, + const SSAPropagator::PropStatus& status) { + switch (status) { + case SSAPropagator::kVarying: + str << "Varying"; + break; + case SSAPropagator::kInteresting: + str << "Interesting"; + break; + default: + str << "Not interesting"; + break; + } + return str; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/propagator.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/propagator.h new file mode 100644 index 00000000000..ac7c0e7eacc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/propagator.h @@ -0,0 +1,317 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_PROPAGATOR_H_ +#define SOURCE_OPT_PROPAGATOR_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" + +namespace spvtools { +namespace opt { + +// Represents a CFG control edge. +struct Edge { + Edge(BasicBlock* b1, BasicBlock* b2) : source(b1), dest(b2) { + assert(source && "CFG edges cannot have a null source block."); + assert(dest && "CFG edges cannot have a null destination block."); + } + BasicBlock* source; + BasicBlock* dest; + bool operator<(const Edge& o) const { + return std::make_pair(source->id(), dest->id()) < + std::make_pair(o.source->id(), o.dest->id()); + } +}; + +// This class implements a generic value propagation algorithm based on the +// conditional constant propagation algorithm proposed in +// +// Constant propagation with conditional branches, +// Wegman and Zadeck, ACM TOPLAS 13(2):181-210. +// +// A Propagation Engine for GCC +// Diego Novillo, GCC Summit 2005 +// http://ols.fedoraproject.org/GCC/Reprints-2005/novillo-Reprint.pdf +// +// The purpose of this implementation is to act as a common framework for any +// transformation that needs to propagate values from statements producing new +// values to statements using those values. Simulation proceeds as follows: +// +// 1- Initially, all edges of the CFG are marked not executable and the CFG +// worklist is seeded with all the statements in the entry basic block. +// +// 2- Every instruction I is simulated by calling a pass-provided function +// |visit_fn|. This function is responsible for three things: +// +// (a) Keep a value table of interesting values. This table maps SSA IDs to +// their values. For instance, when implementing constant propagation, +// given a store operation 'OpStore %f %int_3', |visit_fn| should assign +// the value 3 to the table slot for %f. +// +// In general, |visit_fn| will need to use the value table to replace its +// operands, fold the result and decide whether a new value needs to be +// stored in the table. |visit_fn| should only create a new mapping in +// the value table if all the operands in the instruction are known and +// present in the value table. +// +// (b) Return a status indicator to direct the propagator logic. Once the +// instruction is simulated, the propagator needs to know whether this +// instruction produced something interesting. This is indicated via +// |visit_fn|'s return value: +// +// SSAPropagator::kNotInteresting: Instruction I produces nothing of +// interest and does not affect any of the work lists. The +// propagator will visit the statement again if any of its operands +// produce an interesting value in the future. +// +// |visit_fn| should always return this value when it is not sure +// whether the instruction will produce an interesting value in the +// future or not. For instance, for constant propagation, an OpIAdd +// instruction may produce a constant if its two operands are +// constant, but the first time we visit the instruction, we still +// may not have its operands in the value table. +// +// SSAPropagator::kVarying: The value produced by I cannot be determined +// at compile time. Further simulation of I is not required. The +// propagator will not visit this instruction again. Additionally, +// the propagator will add all the instructions at the end of SSA +// def-use edges to be simulated again. +// +// If I is a basic block terminator, it will mark all outgoing edges +// as executable so they are traversed one more time. Eventually +// the kVarying attribute will be spread out to all the data and +// control dependents for I. +// +// It is important for propagation to use kVarying as a bottom value +// for the propagation lattice. It should never be possible for an +// instruction to return kVarying once and kInteresting on a second +// visit. Otherwise, propagation would not stabilize. +// +// SSAPropagator::kInteresting: Instruction I produces a value that can +// be computed at compile time. In this case, |visit_fn| should +// create a new mapping between I's result ID and the produced +// value. Much like the kNotInteresting case, the propagator will +// visit this instruction again if any of its operands changes. +// This is useful when the statement changes from one interesting +// state to another. +// +// (c) For conditional branches, |visit_fn| may decide which edge to take out +// of I's basic block. For example, if the operand for an OpSwitch is +// known to take a specific constant value, |visit_fn| should figure out +// the destination basic block and pass it back by setting the second +// argument to |visit_fn|. +// +// At the end of propagation, values in the value table are guaranteed to be +// stable and can be replaced in the IR. +// +// 3- The propagator keeps two work queues. Instructions are only added to +// these queues if they produce an interesting or varying value. None of this +// should be handled by |visit_fn|. The propagator keeps track of this +// automatically (see SSAPropagator::Simulate for implementation). +// +// CFG blocks: contains the queue of blocks to be simulated. +// Blocks are added to this queue if their incoming edges are +// executable. +// +// SSA Edges: An SSA edge is a def-use edge between a value-producing +// instruction and its use instruction. The SSA edges list +// contains the statements at the end of a def-use edge that need +// to be re-visited when an instruction produces a kVarying or +// kInteresting result. +// +// 4- Simulation terminates when all work queues are drained. +// +// +// EXAMPLE: Basic constant store propagator. +// +// Suppose we want to propagate all constant assignments of the form "OpStore +// %id %cst" where "%id" is some variable and "%cst" an OpConstant. The +// following code builds a table |values| where every id that was assigned a +// constant value is mapped to the constant value it was assigned. +// +// auto ctx = BuildModule(...); +// std::map values; +// const auto visit_fn = [&ctx, &values](Instruction* instr, +// BasicBlock** dest_bb) { +// if (instr->opcode() == SpvOpStore) { +// uint32_t rhs_id = instr->GetSingleWordOperand(1); +// Instruction* rhs_def = ctx->get_def_use_mgr()->GetDef(rhs_id); +// if (rhs_def->opcode() == SpvOpConstant) { +// uint32_t val = rhs_def->GetSingleWordOperand(2); +// values[rhs_id] = val; +// return SSAPropagator::kInteresting; +// } +// } +// return SSAPropagator::kVarying; +// }; +// SSAPropagator propagator(ctx.get(), &cfg, visit_fn); +// propagator.Run(&fn); +// +// Given the code: +// +// %int_4 = OpConstant %int 4 +// %int_3 = OpConstant %int 3 +// %int_1 = OpConstant %int 1 +// OpStore %x %int_4 +// OpStore %y %int_3 +// OpStore %z %int_1 +// +// After SSAPropagator::Run returns, the |values| map will contain the entries: +// values[%x] = 4, values[%y] = 3, and, values[%z] = 1. +class SSAPropagator { + public: + // Lattice values used for propagation. See class documentation for + // a description. + enum PropStatus { kNotInteresting, kInteresting, kVarying }; + + using VisitFunction = std::function; + + SSAPropagator(IRContext* context, const VisitFunction& visit_fn) + : ctx_(context), visit_fn_(visit_fn) {} + + // Runs the propagator on function |fn|. Returns true if changes were made to + // the function. Otherwise, it returns false. + bool Run(Function* fn); + + // Returns true if the |i|th argument for |phi| comes through a CFG edge that + // has been marked executable. |i| should be an index value accepted by + // Instruction::GetSingleWordOperand. + bool IsPhiArgExecutable(Instruction* phi, uint32_t i) const; + + // Returns true if |inst| has a recorded status. This will be true once |inst| + // has been simulated once. + bool HasStatus(Instruction* inst) const { return statuses_.count(inst); } + + // Returns the current propagation status of |inst|. Assumes + // |HasStatus(inst)| returns true. + PropStatus Status(Instruction* inst) const { + return statuses_.find(inst)->second; + } + + // Records the propagation status |status| for |inst|. Returns true if the + // status for |inst| has changed or set was set for the first time. + bool SetStatus(Instruction* inst, PropStatus status); + + private: + // Initialize processing. + void Initialize(Function* fn); + + // Simulate the execution |block| by calling |visit_fn_| on every instruction + // in it. + bool Simulate(BasicBlock* block); + + // Simulate the execution of |instr| by replacing all the known values in + // every operand and determining whether the result is interesting for + // propagation. This invokes the callback function |visit_fn_| to determine + // the value computed by |instr|. + bool Simulate(Instruction* instr); + + // Returns true if |instr| should be simulated again. + bool ShouldSimulateAgain(Instruction* instr) const { + return do_not_simulate_.find(instr) == do_not_simulate_.end(); + } + + // Add |instr| to the set of instructions not to simulate again. + void DontSimulateAgain(Instruction* instr) { do_not_simulate_.insert(instr); } + + // Returns true if |block| has been simulated already. + bool BlockHasBeenSimulated(BasicBlock* block) const { + return simulated_blocks_.find(block) != simulated_blocks_.end(); + } + + // Marks block |block| as simulated. + void MarkBlockSimulated(BasicBlock* block) { + simulated_blocks_.insert(block); + } + + // Marks |edge| as executable. Returns false if the edge was already marked + // as executable. + bool MarkEdgeExecutable(const Edge& edge) { + return executable_edges_.insert(edge).second; + } + + // Returns true if |edge| has been marked as executable. + bool IsEdgeExecutable(const Edge& edge) const { + return executable_edges_.find(edge) != executable_edges_.end(); + } + + // Returns a pointer to the def-use manager for |ctx_|. + analysis::DefUseManager* get_def_use_mgr() const { + return ctx_->get_def_use_mgr(); + } + + // If the CFG edge |e| has not been executed, this function adds |e|'s + // destination block to the work list. + void AddControlEdge(const Edge& e); + + // Adds all the instructions that use the result of |instr| to the SSA edges + // work list. If |instr| produces no result id, this does nothing. + void AddSSAEdges(Instruction* instr); + + // IR context to use. + IRContext* ctx_; + + // Function that visits instructions during simulation. The output of this + // function is used to determine if the simulated instruction produced a value + // interesting for propagation. The function is responsible for keeping + // track of interesting values by storing them in some user-provided map. + VisitFunction visit_fn_; + + // SSA def-use edges to traverse. Each entry is a destination statement for an + // SSA def-use edge as returned by |def_use_manager_|. + std::queue ssa_edge_uses_; + + // Blocks to simulate. + std::queue blocks_; + + // Blocks simulated during propagation. + std::unordered_set simulated_blocks_; + + // Set of instructions that should not be simulated again because they have + // been found to be in the kVarying state. + std::unordered_set do_not_simulate_; + + // Map between a basic block and its predecessor edges. + // TODO(dnovillo): Move this to CFG and always build them. Alternately, + // move it to IRContext and build CFG preds/succs on-demand. + std::unordered_map> bb_preds_; + + // Map between a basic block and its successor edges. + // TODO(dnovillo): Move this to CFG and always build them. Alternately, + // move it to IRContext and build CFG preds/succs on-demand. + std::unordered_map> bb_succs_; + + // Set of executable CFG edges. + std::set executable_edges_; + + // Tracks instruction propagation status. + std::unordered_map statuses_; +}; + +std::ostream& operator<<(std::ostream& str, + const SSAPropagator::PropStatus& status); + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_PROPAGATOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp new file mode 100644 index 00000000000..b692c6b544b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.cpp @@ -0,0 +1,181 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/reduce_load_size.h" + +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/ir_context.h" +#include "source/util/bit_vector.h" + +namespace { + +const uint32_t kExtractCompositeIdInIdx = 0; +const uint32_t kVariableStorageClassInIdx = 0; +const uint32_t kLoadPointerInIdx = 0; +const double kThreshold = 0.9; + +} // namespace + +namespace spvtools { +namespace opt { + +Pass::Status ReduceLoadSize::Process() { + bool modified = false; + + for (auto& func : *get_module()) { + func.ForEachInst([&modified, this](Instruction* inst) { + if (inst->opcode() == SpvOpCompositeExtract) { + if (ShouldReplaceExtract(inst)) { + modified |= ReplaceExtract(inst); + } + } + }); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool ReduceLoadSize::ReplaceExtract(Instruction* inst) { + assert(inst->opcode() == SpvOpCompositeExtract && + "Wrong opcode. Should be OpCompositeExtract."); + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + + uint32_t composite_id = + inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + Instruction* composite_inst = def_use_mgr->GetDef(composite_id); + + if (composite_inst->opcode() != SpvOpLoad) { + return false; + } + + analysis::Type* composite_type = type_mgr->GetType(composite_inst->type_id()); + if (composite_type->kind() == analysis::Type::kVector || + composite_type->kind() == analysis::Type::kMatrix) { + return false; + } + + Instruction* var = composite_inst->GetBaseAddress(); + if (var == nullptr || var->opcode() != SpvOpVariable) { + return false; + } + + SpvStorageClass storage_class = static_cast( + var->GetSingleWordInOperand(kVariableStorageClassInIdx)); + switch (storage_class) { + case SpvStorageClassUniform: + case SpvStorageClassUniformConstant: + case SpvStorageClassInput: + break; + default: + return false; + } + + // Create a new access chain and load just after the old load. + // We cannot create the new access chain load in the position of the extract + // because the storage may have been written to in between. + InstructionBuilder ir_builder( + inst->context(), composite_inst, + IRContext::kAnalysisInstrToBlockMapping | IRContext::kAnalysisDefUse); + + uint32_t pointer_to_result_type_id = + type_mgr->FindPointerToType(inst->type_id(), storage_class); + assert(pointer_to_result_type_id != 0 && + "We did not find the pointer type that we need."); + + analysis::Integer int_type(32, false); + const analysis::Type* uint32_type = type_mgr->GetRegisteredType(&int_type); + std::vector ids; + for (uint32_t i = 1; i < inst->NumInOperands(); ++i) { + uint32_t index = inst->GetSingleWordInOperand(i); + const analysis::Constant* index_const = + const_mgr->GetConstant(uint32_type, {index}); + ids.push_back(const_mgr->GetDefiningInstruction(index_const)->result_id()); + } + + Instruction* new_access_chain = ir_builder.AddAccessChain( + pointer_to_result_type_id, + composite_inst->GetSingleWordInOperand(kLoadPointerInIdx), ids); + Instruction* new_laod = + ir_builder.AddLoad(inst->type_id(), new_access_chain->result_id()); + + context()->ReplaceAllUsesWith(inst->result_id(), new_laod->result_id()); + context()->KillInst(inst); + return true; +} + +bool ReduceLoadSize::ShouldReplaceExtract(Instruction* inst) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + Instruction* op_inst = def_use_mgr->GetDef( + inst->GetSingleWordInOperand(kExtractCompositeIdInIdx)); + + if (op_inst->opcode() != SpvOpLoad) { + return false; + } + + auto cached_result = should_replace_cache_.find(op_inst->result_id()); + if (cached_result != should_replace_cache_.end()) { + return cached_result->second; + } + + bool all_elements_used = false; + std::set elements_used; + + all_elements_used = + !def_use_mgr->WhileEachUser(op_inst, [&elements_used](Instruction* use) { + if (use->opcode() != SpvOpCompositeExtract) { + return false; + } + elements_used.insert(use->GetSingleWordInOperand(1)); + return true; + }); + + bool should_replace = false; + if (all_elements_used) { + should_replace = false; + } else { + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::Type* load_type = type_mgr->GetType(op_inst->type_id()); + uint32_t total_size = 1; + switch (load_type->kind()) { + case analysis::Type::kArray: { + const analysis::Constant* size_const = + const_mgr->FindDeclaredConstant(load_type->AsArray()->LengthId()); + assert(size_const->AsIntConstant()); + total_size = size_const->GetU32(); + } break; + case analysis::Type::kStruct: + total_size = static_cast( + load_type->AsStruct()->element_types().size()); + break; + default: + break; + } + double percent_used = static_cast(elements_used.size()) / + static_cast(total_size); + should_replace = (percent_used < kThreshold); + } + + should_replace_cache_[op_inst->result_id()] = should_replace; + return should_replace; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.h new file mode 100644 index 00000000000..724a430bbf6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reduce_load_size.h @@ -0,0 +1,64 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_REDUCE_LOAD_SIZE_H_ +#define SOURCE_OPT_REDUCE_LOAD_SIZE_H_ + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class ReduceLoadSize : public Pass { + public: + const char* name() const override { return "reduce-load-size"; } + Status Process() override; + + // Return the mask of preserved Analyses. + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisCombinators | IRContext::kAnalysisCFG | + IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisNameMap; + } + + private: + // Replaces |inst|, which must be an OpCompositeExtract instruction, with + // an OpAccessChain and a load if possible. This happens only if it is a load + // feeding |inst|. Returns true if the substitution happened. The position + // of the new instructions will be in the same place as the load feeding the + // extract. + bool ReplaceExtract(Instruction* inst); + + // Returns true if the OpCompositeExtract instruction |inst| should be replace + // or not. This is determined by looking at the load that feeds |inst| if + // it is a load. |should_replace_cache_| is used to cache the results based + // on the load feeding |inst|. + bool ShouldReplaceExtract(Instruction* inst); + + // Maps the result id of an OpLoad instruction to the result of whether or + // not the OpCompositeExtract that use the id should be replaced. + std::unordered_map should_replace_cache_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_REDUCE_LOAD_SIZE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/redundancy_elimination.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/redundancy_elimination.cpp new file mode 100644 index 00000000000..362e54dc6b9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/redundancy_elimination.cpp @@ -0,0 +1,56 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/redundancy_elimination.h" + +#include "source/opt/value_number_table.h" + +namespace spvtools { +namespace opt { + +Pass::Status RedundancyEliminationPass::Process() { + bool modified = false; + ValueNumberTable vnTable(context()); + + for (auto& func : *get_module()) { + // Build the dominator tree for this function. It is how the code is + // traversed. + DominatorTree& dom_tree = + context()->GetDominatorAnalysis(&func)->GetDomTree(); + + // Keeps track of all ids that contain a given value number. We keep + // track of multiple values because they could have the same value, but + // different decorations. + std::map value_to_ids; + + if (EliminateRedundanciesFrom(dom_tree.GetRoot(), vnTable, value_to_ids)) { + modified = true; + } + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool RedundancyEliminationPass::EliminateRedundanciesFrom( + DominatorTreeNode* bb, const ValueNumberTable& vnTable, + std::map value_to_ids) { + bool modified = EliminateRedundanciesInBB(bb->bb_, vnTable, &value_to_ids); + + for (auto dominated_bb : bb->children_) { + modified |= EliminateRedundanciesFrom(dominated_bb, vnTable, value_to_ids); + } + + return modified; +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/redundancy_elimination.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/redundancy_elimination.h new file mode 100644 index 00000000000..91809b5d574 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/redundancy_elimination.h @@ -0,0 +1,56 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_REDUNDANCY_ELIMINATION_H_ +#define SOURCE_OPT_REDUNDANCY_ELIMINATION_H_ + +#include + +#include "source/opt/ir_context.h" +#include "source/opt/local_redundancy_elimination.h" +#include "source/opt/pass.h" +#include "source/opt/value_number_table.h" + +namespace spvtools { +namespace opt { + +// This pass implements total redundancy elimination. This is the same as +// local redundancy elimination except it looks across basic block boundaries. +// An instruction, inst, is totally redundant if there is another instruction +// that dominates inst, and also computes the same value. +class RedundancyEliminationPass : public LocalRedundancyEliminationPass { + public: + const char* name() const override { return "redundancy-elimination"; } + Status Process() override; + + protected: + // Removes for all total redundancies in the function starting at |bb|. + // + // |vnTable| must have computed a value number for every result id defined + // in the function containing |bb|. + // + // |value_to_ids| is a map from value number to ids. If {vn, id} is in + // |value_to_ids| then vn is the value number of id, and the defintion of id + // dominates |bb|. + // + // Returns true if at least one instruction is deleted. + bool EliminateRedundanciesFrom(DominatorTreeNode* bb, + const ValueNumberTable& vnTable, + std::map value_to_ids); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_REDUNDANCY_ELIMINATION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reflect.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reflect.h new file mode 100644 index 00000000000..fb2de7b1513 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/reflect.h @@ -0,0 +1,65 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_REFLECT_H_ +#define SOURCE_OPT_REFLECT_H_ + +#include "source/latest_version_spirv_header.h" + +namespace spvtools { +namespace opt { + +// Note that as SPIR-V evolves over time, new opcodes may appear. So the +// following functions tend to be outdated and should be updated when SPIR-V +// version bumps. + +inline bool IsDebug1Inst(SpvOp opcode) { + return (opcode >= SpvOpSourceContinued && opcode <= SpvOpSourceExtension) || + opcode == SpvOpString; +} +inline bool IsDebug2Inst(SpvOp opcode) { + return opcode == SpvOpName || opcode == SpvOpMemberName; +} +inline bool IsDebug3Inst(SpvOp opcode) { + return opcode == SpvOpModuleProcessed; +} +inline bool IsDebugLineInst(SpvOp opcode) { + return opcode == SpvOpLine || opcode == SpvOpNoLine; +} +inline bool IsAnnotationInst(SpvOp opcode) { + return (opcode >= SpvOpDecorate && opcode <= SpvOpGroupMemberDecorate) || + opcode == SpvOpDecorateId || opcode == SpvOpDecorateStringGOOGLE || + opcode == SpvOpMemberDecorateStringGOOGLE; +} +inline bool IsTypeInst(SpvOp opcode) { + return (opcode >= SpvOpTypeVoid && opcode <= SpvOpTypeForwardPointer) || + opcode == SpvOpTypePipeStorage || opcode == SpvOpTypeNamedBarrier; +} +inline bool IsConstantInst(SpvOp opcode) { + return opcode >= SpvOpConstantTrue && opcode <= SpvOpSpecConstantOp; +} +inline bool IsCompileTimeConstantInst(SpvOp opcode) { + return opcode >= SpvOpConstantTrue && opcode <= SpvOpConstantNull; +} +inline bool IsSpecConstantInst(SpvOp opcode) { + return opcode >= SpvOpSpecConstantTrue && opcode <= SpvOpSpecConstantOp; +} +inline bool IsTerminatorInst(SpvOp opcode) { + return opcode >= SpvOpBranch && opcode <= SpvOpUnreachable; +} + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_REFLECT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp new file mode 100644 index 00000000000..34dac1d7b1e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.cpp @@ -0,0 +1,576 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/register_pressure.h" + +#include +#include + +#include "source/opt/cfg.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/dominator_tree.h" +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/iterator.h" + +namespace spvtools { +namespace opt { + +namespace { +// Predicate for the FilterIterator to only consider instructions that are not +// phi instructions defined in the basic block |bb|. +class ExcludePhiDefinedInBlock { + public: + ExcludePhiDefinedInBlock(IRContext* context, const BasicBlock* bb) + : context_(context), bb_(bb) {} + + bool operator()(Instruction* insn) const { + return !(insn->opcode() == SpvOpPhi && + context_->get_instr_block(insn) == bb_); + } + + private: + IRContext* context_; + const BasicBlock* bb_; +}; + +// Returns true if |insn| generates a SSA register that is likely to require a +// physical register. +bool CreatesRegisterUsage(Instruction* insn) { + if (!insn->HasResultId()) return false; + if (insn->opcode() == SpvOpUndef) return false; + if (IsConstantInst(insn->opcode())) return false; + if (insn->opcode() == SpvOpLabel) return false; + return true; +} + +// Compute the register liveness for each basic block of a function. This also +// fill-up some information about the pick register usage and a break down of +// register usage. This implements: "A non-iterative data-flow algorithm for +// computing liveness sets in strict ssa programs" from Boissinot et al. +class ComputeRegisterLiveness { + public: + ComputeRegisterLiveness(RegisterLiveness* reg_pressure, Function* f) + : reg_pressure_(reg_pressure), + context_(reg_pressure->GetContext()), + function_(f), + cfg_(*reg_pressure->GetContext()->cfg()), + def_use_manager_(*reg_pressure->GetContext()->get_def_use_mgr()), + dom_tree_( + reg_pressure->GetContext()->GetDominatorAnalysis(f)->GetDomTree()), + loop_desc_(*reg_pressure->GetContext()->GetLoopDescriptor(f)) {} + + // Computes the register liveness for |function_| and then estimate the + // register usage. The liveness algorithm works in 2 steps: + // - First, compute the liveness for each basic blocks, but will ignore any + // back-edge; + // - Second, walk loop forest to propagate registers crossing back-edges + // (add iterative values into the liveness set). + void Compute() { + cfg_.ForEachBlockInPostOrder(&*function_->begin(), [this](BasicBlock* bb) { + ComputePartialLiveness(bb); + }); + DoLoopLivenessUnification(); + EvaluateRegisterRequirements(); + } + + private: + // Registers all SSA register used by successors of |bb| in their phi + // instructions. + void ComputePhiUses(const BasicBlock& bb, + RegisterLiveness::RegionRegisterLiveness::LiveSet* live) { + uint32_t bb_id = bb.id(); + bb.ForEachSuccessorLabel([live, bb_id, this](uint32_t sid) { + BasicBlock* succ_bb = cfg_.block(sid); + succ_bb->ForEachPhiInst([live, bb_id, this](const Instruction* phi) { + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + if (phi->GetSingleWordInOperand(i + 1) == bb_id) { + Instruction* insn_op = + def_use_manager_.GetDef(phi->GetSingleWordInOperand(i)); + if (CreatesRegisterUsage(insn_op)) { + live->insert(insn_op); + break; + } + } + } + }); + }); + } + + // Computes register liveness for each basic blocks but ignores all + // back-edges. + void ComputePartialLiveness(BasicBlock* bb) { + assert(reg_pressure_->Get(bb) == nullptr && + "Basic block already processed"); + + RegisterLiveness::RegionRegisterLiveness* live_inout = + reg_pressure_->GetOrInsert(bb->id()); + ComputePhiUses(*bb, &live_inout->live_out_); + + const BasicBlock* cbb = bb; + cbb->ForEachSuccessorLabel([&live_inout, bb, this](uint32_t sid) { + // Skip back edges. + if (dom_tree_.Dominates(sid, bb->id())) { + return; + } + + BasicBlock* succ_bb = cfg_.block(sid); + RegisterLiveness::RegionRegisterLiveness* succ_live_inout = + reg_pressure_->Get(succ_bb); + assert(succ_live_inout && + "Successor liveness analysis was not performed"); + + ExcludePhiDefinedInBlock predicate(context_, succ_bb); + auto filter = + MakeFilterIteratorRange(succ_live_inout->live_in_.begin(), + succ_live_inout->live_in_.end(), predicate); + live_inout->live_out_.insert(filter.begin(), filter.end()); + }); + + live_inout->live_in_ = live_inout->live_out_; + for (Instruction& insn : make_range(bb->rbegin(), bb->rend())) { + if (insn.opcode() == SpvOpPhi) { + live_inout->live_in_.insert(&insn); + break; + } + live_inout->live_in_.erase(&insn); + insn.ForEachInId([live_inout, this](uint32_t* id) { + Instruction* insn_op = def_use_manager_.GetDef(*id); + if (CreatesRegisterUsage(insn_op)) { + live_inout->live_in_.insert(insn_op); + } + }); + } + } + + // Propagates the register liveness information of each loop iterators. + void DoLoopLivenessUnification() { + for (const Loop* loop : *loop_desc_.GetDummyRootLoop()) { + DoLoopLivenessUnification(*loop); + } + } + + // Propagates the register liveness information of loop iterators trough-out + // the loop body. + void DoLoopLivenessUnification(const Loop& loop) { + auto blocks_in_loop = MakeFilterIteratorRange( + loop.GetBlocks().begin(), loop.GetBlocks().end(), + [&loop, this](uint32_t bb_id) { + return bb_id != loop.GetHeaderBlock()->id() && + loop_desc_[bb_id] == &loop; + }); + + RegisterLiveness::RegionRegisterLiveness* header_live_inout = + reg_pressure_->Get(loop.GetHeaderBlock()); + assert(header_live_inout && + "Liveness analysis was not performed for the current block"); + + ExcludePhiDefinedInBlock predicate(context_, loop.GetHeaderBlock()); + auto live_loop = + MakeFilterIteratorRange(header_live_inout->live_in_.begin(), + header_live_inout->live_in_.end(), predicate); + + for (uint32_t bb_id : blocks_in_loop) { + BasicBlock* bb = cfg_.block(bb_id); + + RegisterLiveness::RegionRegisterLiveness* live_inout = + reg_pressure_->Get(bb); + live_inout->live_in_.insert(live_loop.begin(), live_loop.end()); + live_inout->live_out_.insert(live_loop.begin(), live_loop.end()); + } + + for (const Loop* inner_loop : loop) { + RegisterLiveness::RegionRegisterLiveness* live_inout = + reg_pressure_->Get(inner_loop->GetHeaderBlock()); + live_inout->live_in_.insert(live_loop.begin(), live_loop.end()); + live_inout->live_out_.insert(live_loop.begin(), live_loop.end()); + + DoLoopLivenessUnification(*inner_loop); + } + } + + // Get the number of required registers for this each basic block. + void EvaluateRegisterRequirements() { + for (BasicBlock& bb : *function_) { + RegisterLiveness::RegionRegisterLiveness* live_inout = + reg_pressure_->Get(bb.id()); + assert(live_inout != nullptr && "Basic block not processed"); + + size_t reg_count = live_inout->live_out_.size(); + for (Instruction* insn : live_inout->live_out_) { + live_inout->AddRegisterClass(insn); + } + live_inout->used_registers_ = reg_count; + + std::unordered_set die_in_block; + for (Instruction& insn : make_range(bb.rbegin(), bb.rend())) { + // If it is a phi instruction, the register pressure will not change + // anymore. + if (insn.opcode() == SpvOpPhi) { + break; + } + + insn.ForEachInId( + [live_inout, &die_in_block, ®_count, this](uint32_t* id) { + Instruction* op_insn = def_use_manager_.GetDef(*id); + if (!CreatesRegisterUsage(op_insn) || + live_inout->live_out_.count(op_insn)) { + // already taken into account. + return; + } + if (!die_in_block.count(*id)) { + live_inout->AddRegisterClass(def_use_manager_.GetDef(*id)); + reg_count++; + die_in_block.insert(*id); + } + }); + live_inout->used_registers_ = + std::max(live_inout->used_registers_, reg_count); + if (CreatesRegisterUsage(&insn)) { + reg_count--; + } + } + } + } + + RegisterLiveness* reg_pressure_; + IRContext* context_; + Function* function_; + CFG& cfg_; + analysis::DefUseManager& def_use_manager_; + DominatorTree& dom_tree_; + LoopDescriptor& loop_desc_; +}; +} // namespace + +// Get the number of required registers for each basic block. +void RegisterLiveness::RegionRegisterLiveness::AddRegisterClass( + Instruction* insn) { + assert(CreatesRegisterUsage(insn) && "Instruction does not use a register"); + analysis::Type* type = + insn->context()->get_type_mgr()->GetType(insn->type_id()); + + RegisterLiveness::RegisterClass reg_class{type, false}; + + insn->context()->get_decoration_mgr()->WhileEachDecoration( + insn->result_id(), SpvDecorationUniform, + [®_class](const Instruction&) { + reg_class.is_uniform_ = true; + return false; + }); + + AddRegisterClass(reg_class); +} + +void RegisterLiveness::Analyze(Function* f) { + block_pressure_.clear(); + ComputeRegisterLiveness(this, f).Compute(); +} + +void RegisterLiveness::ComputeLoopRegisterPressure( + const Loop& loop, RegionRegisterLiveness* loop_reg_pressure) const { + loop_reg_pressure->Clear(); + + const RegionRegisterLiveness* header_live_inout = Get(loop.GetHeaderBlock()); + loop_reg_pressure->live_in_ = header_live_inout->live_in_; + + std::unordered_set exit_blocks; + loop.GetExitBlocks(&exit_blocks); + + for (uint32_t bb_id : exit_blocks) { + const RegionRegisterLiveness* live_inout = Get(bb_id); + loop_reg_pressure->live_out_.insert(live_inout->live_in_.begin(), + live_inout->live_in_.end()); + } + + std::unordered_set seen_insn; + for (Instruction* insn : loop_reg_pressure->live_out_) { + loop_reg_pressure->AddRegisterClass(insn); + seen_insn.insert(insn->result_id()); + } + for (Instruction* insn : loop_reg_pressure->live_in_) { + if (!seen_insn.count(insn->result_id())) { + continue; + } + loop_reg_pressure->AddRegisterClass(insn); + seen_insn.insert(insn->result_id()); + } + + loop_reg_pressure->used_registers_ = 0; + + for (uint32_t bb_id : loop.GetBlocks()) { + BasicBlock* bb = context_->cfg()->block(bb_id); + + const RegionRegisterLiveness* live_inout = Get(bb_id); + assert(live_inout != nullptr && "Basic block not processed"); + loop_reg_pressure->used_registers_ = std::max( + loop_reg_pressure->used_registers_, live_inout->used_registers_); + + for (Instruction& insn : *bb) { + if (insn.opcode() == SpvOpPhi || !CreatesRegisterUsage(&insn) || + seen_insn.count(insn.result_id())) { + continue; + } + loop_reg_pressure->AddRegisterClass(&insn); + } + } +} + +void RegisterLiveness::SimulateFusion( + const Loop& l1, const Loop& l2, RegionRegisterLiveness* sim_result) const { + sim_result->Clear(); + + // Compute the live-in state: + // sim_result.live_in = l1.live_in U l2.live_in + // This assumes that |l1| does not generated register that is live-out for + // |l1|. + const RegionRegisterLiveness* l1_header_live_inout = Get(l1.GetHeaderBlock()); + sim_result->live_in_ = l1_header_live_inout->live_in_; + + const RegionRegisterLiveness* l2_header_live_inout = Get(l2.GetHeaderBlock()); + sim_result->live_in_.insert(l2_header_live_inout->live_in_.begin(), + l2_header_live_inout->live_in_.end()); + + // The live-out set of the fused loop is the l2 live-out set. + std::unordered_set exit_blocks; + l2.GetExitBlocks(&exit_blocks); + + for (uint32_t bb_id : exit_blocks) { + const RegionRegisterLiveness* live_inout = Get(bb_id); + sim_result->live_out_.insert(live_inout->live_in_.begin(), + live_inout->live_in_.end()); + } + + // Compute the register usage information. + std::unordered_set seen_insn; + for (Instruction* insn : sim_result->live_out_) { + sim_result->AddRegisterClass(insn); + seen_insn.insert(insn->result_id()); + } + for (Instruction* insn : sim_result->live_in_) { + if (!seen_insn.count(insn->result_id())) { + continue; + } + sim_result->AddRegisterClass(insn); + seen_insn.insert(insn->result_id()); + } + + sim_result->used_registers_ = 0; + + // The loop fusion is injecting the l1 before the l2, the latch of l1 will be + // connected to the header of l2. + // To compute the register usage, we inject the loop live-in (union of l1 and + // l2 live-in header blocks) into the the live in/out of each basic block of + // l1 to get the peak register usage. We then repeat the operation to for l2 + // basic blocks but in this case we inject the live-out of the latch of l1. + auto live_loop = MakeFilterIteratorRange( + sim_result->live_in_.begin(), sim_result->live_in_.end(), + [&l1, &l2](Instruction* insn) { + BasicBlock* bb = insn->context()->get_instr_block(insn); + return insn->HasResultId() && + !(insn->opcode() == SpvOpPhi && + (bb == l1.GetHeaderBlock() || bb == l2.GetHeaderBlock())); + }); + + for (uint32_t bb_id : l1.GetBlocks()) { + BasicBlock* bb = context_->cfg()->block(bb_id); + + const RegionRegisterLiveness* live_inout_info = Get(bb_id); + assert(live_inout_info != nullptr && "Basic block not processed"); + RegionRegisterLiveness::LiveSet live_out = live_inout_info->live_out_; + live_out.insert(live_loop.begin(), live_loop.end()); + sim_result->used_registers_ = + std::max(sim_result->used_registers_, + live_inout_info->used_registers_ + live_out.size() - + live_inout_info->live_out_.size()); + + for (Instruction& insn : *bb) { + if (insn.opcode() == SpvOpPhi || !CreatesRegisterUsage(&insn) || + seen_insn.count(insn.result_id())) { + continue; + } + sim_result->AddRegisterClass(&insn); + } + } + + const RegionRegisterLiveness* l1_latch_live_inout_info = + Get(l1.GetLatchBlock()->id()); + assert(l1_latch_live_inout_info != nullptr && "Basic block not processed"); + RegionRegisterLiveness::LiveSet l1_latch_live_out = + l1_latch_live_inout_info->live_out_; + l1_latch_live_out.insert(live_loop.begin(), live_loop.end()); + + auto live_loop_l2 = + make_range(l1_latch_live_out.begin(), l1_latch_live_out.end()); + + for (uint32_t bb_id : l2.GetBlocks()) { + BasicBlock* bb = context_->cfg()->block(bb_id); + + const RegionRegisterLiveness* live_inout_info = Get(bb_id); + assert(live_inout_info != nullptr && "Basic block not processed"); + RegionRegisterLiveness::LiveSet live_out = live_inout_info->live_out_; + live_out.insert(live_loop_l2.begin(), live_loop_l2.end()); + sim_result->used_registers_ = + std::max(sim_result->used_registers_, + live_inout_info->used_registers_ + live_out.size() - + live_inout_info->live_out_.size()); + + for (Instruction& insn : *bb) { + if (insn.opcode() == SpvOpPhi || !CreatesRegisterUsage(&insn) || + seen_insn.count(insn.result_id())) { + continue; + } + sim_result->AddRegisterClass(&insn); + } + } +} + +void RegisterLiveness::SimulateFission( + const Loop& loop, const std::unordered_set& moved_inst, + const std::unordered_set& copied_inst, + RegionRegisterLiveness* l1_sim_result, + RegionRegisterLiveness* l2_sim_result) const { + l1_sim_result->Clear(); + l2_sim_result->Clear(); + + // Filter predicates: consider instructions that only belong to the first and + // second loop. + auto belong_to_loop1 = [&moved_inst, &copied_inst, &loop](Instruction* insn) { + return moved_inst.count(insn) || copied_inst.count(insn) || + !loop.IsInsideLoop(insn); + }; + auto belong_to_loop2 = [&moved_inst](Instruction* insn) { + return !moved_inst.count(insn); + }; + + const RegionRegisterLiveness* header_live_inout = Get(loop.GetHeaderBlock()); + // l1 live-in + { + auto live_loop = MakeFilterIteratorRange( + header_live_inout->live_in_.begin(), header_live_inout->live_in_.end(), + belong_to_loop1); + l1_sim_result->live_in_.insert(live_loop.begin(), live_loop.end()); + } + // l2 live-in + { + auto live_loop = MakeFilterIteratorRange( + header_live_inout->live_in_.begin(), header_live_inout->live_in_.end(), + belong_to_loop2); + l2_sim_result->live_in_.insert(live_loop.begin(), live_loop.end()); + } + + std::unordered_set exit_blocks; + loop.GetExitBlocks(&exit_blocks); + + // l2 live-out. + for (uint32_t bb_id : exit_blocks) { + const RegionRegisterLiveness* live_inout = Get(bb_id); + l2_sim_result->live_out_.insert(live_inout->live_in_.begin(), + live_inout->live_in_.end()); + } + // l1 live-out. + { + auto live_out = MakeFilterIteratorRange(l2_sim_result->live_out_.begin(), + l2_sim_result->live_out_.end(), + belong_to_loop1); + l1_sim_result->live_out_.insert(live_out.begin(), live_out.end()); + } + { + auto live_out = + MakeFilterIteratorRange(l2_sim_result->live_in_.begin(), + l2_sim_result->live_in_.end(), belong_to_loop1); + l1_sim_result->live_out_.insert(live_out.begin(), live_out.end()); + } + // Lives out of l1 are live out of l2 so are live in of l2 as well. + l2_sim_result->live_in_.insert(l1_sim_result->live_out_.begin(), + l1_sim_result->live_out_.end()); + + for (Instruction* insn : l1_sim_result->live_in_) { + l1_sim_result->AddRegisterClass(insn); + } + for (Instruction* insn : l2_sim_result->live_in_) { + l2_sim_result->AddRegisterClass(insn); + } + + l1_sim_result->used_registers_ = 0; + l2_sim_result->used_registers_ = 0; + + for (uint32_t bb_id : loop.GetBlocks()) { + BasicBlock* bb = context_->cfg()->block(bb_id); + + const RegisterLiveness::RegionRegisterLiveness* live_inout = Get(bb_id); + assert(live_inout != nullptr && "Basic block not processed"); + auto l1_block_live_out = + MakeFilterIteratorRange(live_inout->live_out_.begin(), + live_inout->live_out_.end(), belong_to_loop1); + auto l2_block_live_out = + MakeFilterIteratorRange(live_inout->live_out_.begin(), + live_inout->live_out_.end(), belong_to_loop2); + + size_t l1_reg_count = + std::distance(l1_block_live_out.begin(), l1_block_live_out.end()); + size_t l2_reg_count = + std::distance(l2_block_live_out.begin(), l2_block_live_out.end()); + + std::unordered_set die_in_block; + for (Instruction& insn : make_range(bb->rbegin(), bb->rend())) { + if (insn.opcode() == SpvOpPhi) { + break; + } + + bool does_belong_to_loop1 = belong_to_loop1(&insn); + bool does_belong_to_loop2 = belong_to_loop2(&insn); + insn.ForEachInId([live_inout, &die_in_block, &l1_reg_count, &l2_reg_count, + does_belong_to_loop1, does_belong_to_loop2, + this](uint32_t* id) { + Instruction* op_insn = context_->get_def_use_mgr()->GetDef(*id); + if (!CreatesRegisterUsage(op_insn) || + live_inout->live_out_.count(op_insn)) { + // already taken into account. + return; + } + if (!die_in_block.count(*id)) { + if (does_belong_to_loop1) { + l1_reg_count++; + } + if (does_belong_to_loop2) { + l2_reg_count++; + } + die_in_block.insert(*id); + } + }); + l1_sim_result->used_registers_ = + std::max(l1_sim_result->used_registers_, l1_reg_count); + l2_sim_result->used_registers_ = + std::max(l2_sim_result->used_registers_, l2_reg_count); + if (CreatesRegisterUsage(&insn)) { + if (does_belong_to_loop1) { + if (!l1_sim_result->live_in_.count(&insn)) { + l1_sim_result->AddRegisterClass(&insn); + } + l1_reg_count--; + } + if (does_belong_to_loop2) { + if (!l2_sim_result->live_in_.count(&insn)) { + l2_sim_result->AddRegisterClass(&insn); + } + l2_reg_count--; + } + } + } + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.h new file mode 100644 index 00000000000..cb3d2e2703b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/register_pressure.h @@ -0,0 +1,196 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_REGISTER_PRESSURE_H_ +#define SOURCE_OPT_REGISTER_PRESSURE_H_ + +#include +#include +#include +#include + +#include "source/opt/function.h" +#include "source/opt/types.h" + +namespace spvtools { +namespace opt { + +class IRContext; +class Loop; +class LoopDescriptor; + +// Handles the register pressure of a function for different regions (function, +// loop, basic block). It also contains some utilities to foresee the register +// pressure following code transformations. +class RegisterLiveness { + public: + // Classification of SSA registers. + struct RegisterClass { + analysis::Type* type_; + bool is_uniform_; + + bool operator==(const RegisterClass& rhs) const { + return std::tie(type_, is_uniform_) == + std::tie(rhs.type_, rhs.is_uniform_); + } + }; + + struct RegionRegisterLiveness { + using LiveSet = std::unordered_set; + using RegClassSetTy = std::vector>; + + // SSA register live when entering the basic block. + LiveSet live_in_; + // SSA register live when exiting the basic block. + LiveSet live_out_; + + // Maximum number of required registers. + size_t used_registers_; + // Break down of the number of required registers per class of register. + RegClassSetTy registers_classes_; + + void Clear() { + live_out_.clear(); + live_in_.clear(); + used_registers_ = 0; + registers_classes_.clear(); + } + + void AddRegisterClass(const RegisterClass& reg_class) { + auto it = std::find_if( + registers_classes_.begin(), registers_classes_.end(), + [®_class](const std::pair& class_count) { + return class_count.first == reg_class; + }); + if (it != registers_classes_.end()) { + it->second++; + } else { + registers_classes_.emplace_back(std::move(reg_class), + static_cast(1)); + } + } + + void AddRegisterClass(Instruction* insn); + }; + + RegisterLiveness(IRContext* context, Function* f) : context_(context) { + Analyze(f); + } + + // Returns liveness and register information for the basic block |bb|. If no + // entry exist for the basic block, the function returns null. + const RegionRegisterLiveness* Get(const BasicBlock* bb) const { + return Get(bb->id()); + } + + // Returns liveness and register information for the basic block id |bb_id|. + // If no entry exist for the basic block, the function returns null. + const RegionRegisterLiveness* Get(uint32_t bb_id) const { + RegionRegisterLivenessMap::const_iterator it = block_pressure_.find(bb_id); + if (it != block_pressure_.end()) { + return &it->second; + } + return nullptr; + } + + IRContext* GetContext() const { return context_; } + + // Returns liveness and register information for the basic block |bb|. If no + // entry exist for the basic block, the function returns null. + RegionRegisterLiveness* Get(const BasicBlock* bb) { return Get(bb->id()); } + + // Returns liveness and register information for the basic block id |bb_id|. + // If no entry exist for the basic block, the function returns null. + RegionRegisterLiveness* Get(uint32_t bb_id) { + RegionRegisterLivenessMap::iterator it = block_pressure_.find(bb_id); + if (it != block_pressure_.end()) { + return &it->second; + } + return nullptr; + } + + // Returns liveness and register information for the basic block id |bb_id| or + // create a new empty entry if no entry already existed. + RegionRegisterLiveness* GetOrInsert(uint32_t bb_id) { + return &block_pressure_[bb_id]; + } + + // Compute the register pressure for the |loop| and store the result into + // |reg_pressure|. The live-in set corresponds to the live-in set of the + // header block, the live-out set of the loop corresponds to the union of the + // live-in sets of each exit basic block. + void ComputeLoopRegisterPressure(const Loop& loop, + RegionRegisterLiveness* reg_pressure) const; + + // Estimate the register pressure for the |l1| and |l2| as if they were making + // one unique loop. The result is stored into |simulation_result|. + void SimulateFusion(const Loop& l1, const Loop& l2, + RegionRegisterLiveness* simulation_result) const; + + // Estimate the register pressure of |loop| after it has been fissioned + // according to |moved_instructions| and |copied_instructions|. The function + // assumes that the fission creates a new loop before |loop|, moves any + // instructions present inside |moved_instructions| and copies any + // instructions present inside |copied_instructions| into this new loop. + // The set |loop1_sim_result| store the simulation result of the loop with the + // moved instructions. The set |loop2_sim_result| store the simulation result + // of the loop with the removed instructions. + void SimulateFission( + const Loop& loop, + const std::unordered_set& moved_instructions, + const std::unordered_set& copied_instructions, + RegionRegisterLiveness* loop1_sim_result, + RegionRegisterLiveness* loop2_sim_result) const; + + private: + using RegionRegisterLivenessMap = + std::unordered_map; + + IRContext* context_; + RegionRegisterLivenessMap block_pressure_; + + void Analyze(Function* f); +}; + +// Handles the register pressure of a function for different regions (function, +// loop, basic block). It also contains some utilities to foresee the register +// pressure following code transformations. +class LivenessAnalysis { + using LivenessAnalysisMap = + std::unordered_map; + + public: + LivenessAnalysis(IRContext* context) : context_(context) {} + + // Computes the liveness analysis for the function |f| and cache the result. + // If the analysis was performed for this function, then the cached analysis + // is returned. + const RegisterLiveness* Get(Function* f) { + LivenessAnalysisMap::iterator it = analysis_cache_.find(f); + if (it != analysis_cache_.end()) { + return &it->second; + } + return &analysis_cache_.emplace(f, RegisterLiveness{context_, f}) + .first->second; + } + + private: + IRContext* context_; + LivenessAnalysisMap analysis_cache_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_REGISTER_PRESSURE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp new file mode 100644 index 00000000000..a37e9df9e7b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.cpp @@ -0,0 +1,196 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/remove_duplicates_pass.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opcode.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/reflect.h" + +namespace spvtools { +namespace opt { + +Pass::Status RemoveDuplicatesPass::Process() { + bool modified = RemoveDuplicateCapabilities(); + modified |= RemoveDuplicatesExtInstImports(); + modified |= RemoveDuplicateTypes(); + modified |= RemoveDuplicateDecorations(); + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +bool RemoveDuplicatesPass::RemoveDuplicateCapabilities() const { + bool modified = false; + + if (context()->capabilities().empty()) { + return modified; + } + + std::unordered_set capabilities; + for (auto* i = &*context()->capability_begin(); i;) { + auto res = capabilities.insert(i->GetSingleWordOperand(0u)); + + if (res.second) { + // Never seen before, keep it. + i = i->NextNode(); + } else { + // It's a duplicate, remove it. + i = context()->KillInst(i); + modified = true; + } + } + + return modified; +} + +bool RemoveDuplicatesPass::RemoveDuplicatesExtInstImports() const { + bool modified = false; + + if (context()->ext_inst_imports().empty()) { + return modified; + } + + std::unordered_map ext_inst_imports; + for (auto* i = &*context()->ext_inst_import_begin(); i;) { + auto res = ext_inst_imports.emplace( + reinterpret_cast(i->GetInOperand(0u).words.data()), + i->result_id()); + if (res.second) { + // Never seen before, keep it. + i = i->NextNode(); + } else { + // It's a duplicate, remove it. + context()->ReplaceAllUsesWith(i->result_id(), res.first->second); + i = context()->KillInst(i); + modified = true; + } + } + + return modified; +} + +bool RemoveDuplicatesPass::RemoveDuplicateTypes() const { + bool modified = false; + + if (context()->types_values().empty()) { + return modified; + } + + std::vector visited_types; + std::vector to_delete; + for (auto* i = &*context()->types_values_begin(); i; i = i->NextNode()) { + // We only care about types. + if (!spvOpcodeGeneratesType((i->opcode())) && + i->opcode() != SpvOpTypeForwardPointer) { + continue; + } + + // Is the current type equal to one of the types we have aready visited? + SpvId id_to_keep = 0u; + // TODO(dneto0): Use a trie to avoid quadratic behaviour? Extract the + // ResultIdTrie from unify_const_pass.cpp for this. + for (auto j : visited_types) { + if (AreTypesEqual(*i, *j, context())) { + id_to_keep = j->result_id(); + break; + } + } + + if (id_to_keep == 0u) { + // This is a never seen before type, keep it around. + visited_types.emplace_back(i); + } else { + // The same type has already been seen before, remove this one. + context()->KillNamesAndDecorates(i->result_id()); + context()->ReplaceAllUsesWith(i->result_id(), id_to_keep); + modified = true; + to_delete.emplace_back(i); + } + } + + for (auto i : to_delete) { + context()->KillInst(i); + } + + return modified; +} + +// TODO(pierremoreau): Duplicate decoration groups should be removed. For +// example, in +// OpDecorate %1 Constant +// %1 = OpDecorationGroup +// OpDecorate %2 Constant +// %2 = OpDecorationGroup +// OpGroupDecorate %1 %3 +// OpGroupDecorate %2 %4 +// group %2 could be removed. +bool RemoveDuplicatesPass::RemoveDuplicateDecorations() const { + bool modified = false; + + std::vector visited_decorations; + + analysis::DecorationManager decoration_manager(context()->module()); + for (auto* i = &*context()->annotation_begin(); i;) { + // Is the current decoration equal to one of the decorations we have aready + // visited? + bool already_visited = false; + // TODO(dneto0): Use a trie to avoid quadratic behaviour? Extract the + // ResultIdTrie from unify_const_pass.cpp for this. + for (const Instruction* j : visited_decorations) { + if (decoration_manager.AreDecorationsTheSame(&*i, j, false)) { + already_visited = true; + break; + } + } + + if (!already_visited) { + // This is a never seen before decoration, keep it around. + visited_decorations.emplace_back(&*i); + i = i->NextNode(); + } else { + // The same decoration has already been seen before, remove this one. + modified = true; + i = context()->KillInst(i); + } + } + + return modified; +} + +bool RemoveDuplicatesPass::AreTypesEqual(const Instruction& inst1, + const Instruction& inst2, + IRContext* context) { + if (inst1.opcode() != inst2.opcode()) return false; + if (!IsTypeInst(inst1.opcode())) return false; + + const analysis::Type* type1 = + context->get_type_mgr()->GetType(inst1.result_id()); + const analysis::Type* type2 = + context->get_type_mgr()->GetType(inst2.result_id()); + if (type1 && type2 && *type1 == *type2) return true; + + return false; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.h new file mode 100644 index 00000000000..8554a987dc0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/remove_duplicates_pass.h @@ -0,0 +1,67 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_REMOVE_DUPLICATES_PASS_H_ +#define SOURCE_OPT_REMOVE_DUPLICATES_PASS_H_ + +#include +#include + +#include "source/opt/decoration_manager.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +using IdDecorationsList = + std::unordered_map>; + +// See optimizer.hpp for documentation. +class RemoveDuplicatesPass : public Pass { + public: + const char* name() const override { return "remove-duplicates"; } + Status Process() override; + + // TODO(pierremoreau): Move this function somewhere else (e.g. pass.h or + // within the type manager) + // Returns whether two types are equal, and have the same decorations. + static bool AreTypesEqual(const Instruction& inst1, const Instruction& inst2, + IRContext* context); + + private: + // Remove duplicate capabilities from the module + // + // Returns true if the module was modified, false otherwise. + bool RemoveDuplicateCapabilities() const; + // Remove duplicate extended instruction imports from the module + // + // Returns true if the module was modified, false otherwise. + bool RemoveDuplicatesExtInstImports() const; + // Remove duplicate types from the module + // + // Returns true if the module was modified, false otherwise. + bool RemoveDuplicateTypes() const; + // Remove duplicate decorations from the module + // + // Returns true if the module was modified, false otherwise. + bool RemoveDuplicateDecorations() const; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_REMOVE_DUPLICATES_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp new file mode 100644 index 00000000000..4e0f24f467e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.cpp @@ -0,0 +1,207 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/replace_invalid_opc.h" + +#include +#include + +namespace spvtools { +namespace opt { + +Pass::Status ReplaceInvalidOpcodePass::Process() { + bool modified = false; + + if (context()->get_feature_mgr()->HasCapability(SpvCapabilityLinkage)) { + return Status::SuccessWithoutChange; + } + + SpvExecutionModel execution_model = GetExecutionModel(); + if (execution_model == SpvExecutionModelKernel) { + // We do not handle kernels. + return Status::SuccessWithoutChange; + } + if (execution_model == SpvExecutionModelMax) { + // Mixed execution models for the entry points. This case is not currently + // handled. + return Status::SuccessWithoutChange; + } + + for (Function& func : *get_module()) { + modified |= RewriteFunction(&func, execution_model); + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +SpvExecutionModel ReplaceInvalidOpcodePass::GetExecutionModel() { + SpvExecutionModel result = SpvExecutionModelMax; + bool first = true; + for (Instruction& entry_point : get_module()->entry_points()) { + if (first) { + result = + static_cast(entry_point.GetSingleWordInOperand(0)); + first = false; + } else { + SpvExecutionModel current_model = + static_cast(entry_point.GetSingleWordInOperand(0)); + if (current_model != result) { + result = SpvExecutionModelMax; + break; + } + } + } + return result; +} + +bool ReplaceInvalidOpcodePass::RewriteFunction(Function* function, + SpvExecutionModel model) { + bool modified = false; + Instruction* last_line_dbg_inst = nullptr; + function->ForEachInst( + [model, &modified, &last_line_dbg_inst, this](Instruction* inst) { + // Track the debug information so we can have a meaningful message. + if (inst->opcode() == SpvOpLabel || inst->opcode() == SpvOpNoLine) { + last_line_dbg_inst = nullptr; + return; + } else if (inst->opcode() == SpvOpLine) { + last_line_dbg_inst = inst; + return; + } + + bool replace = false; + if (model != SpvExecutionModelFragment && + IsFragmentShaderOnlyInstruction(inst)) { + replace = true; + } + + if (model != SpvExecutionModelTessellationControl && + model != SpvExecutionModelGLCompute) { + if (inst->opcode() == SpvOpControlBarrier) { + assert(model != SpvExecutionModelKernel && + "Expecting to be working on a shader module."); + replace = true; + } + } + + if (replace) { + modified = true; + if (last_line_dbg_inst == nullptr) { + ReplaceInstruction(inst, nullptr, 0, 0); + } else { + // Get the name of the source file. + Instruction* file_name = context()->get_def_use_mgr()->GetDef( + last_line_dbg_inst->GetSingleWordInOperand(0)); + const char* source = reinterpret_cast( + &file_name->GetInOperand(0).words[0]); + + // Get the line number and column number. + uint32_t line_number = + last_line_dbg_inst->GetSingleWordInOperand(1); + uint32_t col_number = last_line_dbg_inst->GetSingleWordInOperand(2); + + // Replace the instruction. + ReplaceInstruction(inst, source, line_number, col_number); + } + } + }, + /* run_on_debug_line_insts = */ true); + return modified; +} + +bool ReplaceInvalidOpcodePass::IsFragmentShaderOnlyInstruction( + Instruction* inst) { + switch (inst->opcode()) { + case SpvOpDPdx: + case SpvOpDPdy: + case SpvOpFwidth: + case SpvOpDPdxFine: + case SpvOpDPdyFine: + case SpvOpFwidthFine: + case SpvOpDPdxCoarse: + case SpvOpDPdyCoarse: + case SpvOpFwidthCoarse: + case SpvOpImageSampleImplicitLod: + case SpvOpImageSampleDrefImplicitLod: + case SpvOpImageSampleProjImplicitLod: + case SpvOpImageSampleProjDrefImplicitLod: + case SpvOpImageSparseSampleImplicitLod: + case SpvOpImageSparseSampleDrefImplicitLod: + case SpvOpImageQueryLod: + // TODO: Teach |ReplaceInstruction| to handle block terminators. Then + // uncomment the OpKill case. + // case SpvOpKill: + return true; + default: + return false; + } +} + +void ReplaceInvalidOpcodePass::ReplaceInstruction(Instruction* inst, + const char* source, + uint32_t line_number, + uint32_t column_number) { + if (inst->result_id() != 0) { + uint32_t const_id = GetSpecialConstant(inst->type_id()); + context()->KillNamesAndDecorates(inst); + context()->ReplaceAllUsesWith(inst->result_id(), const_id); + } + assert(!inst->IsBlockTerminator() && + "We cannot simply delete a block terminator. It must be replaced " + "with something."); + if (consumer()) { + std::string message = BuildWarningMessage(inst->opcode()); + consumer()(SPV_MSG_WARNING, source, {line_number, column_number, 0}, + message.c_str()); + } + context()->KillInst(inst); +} + +uint32_t ReplaceInvalidOpcodePass::GetSpecialConstant(uint32_t type_id) { + const analysis::Constant* special_const = nullptr; + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + + Instruction* type = context()->get_def_use_mgr()->GetDef(type_id); + if (type->opcode() == SpvOpTypeVector) { + uint32_t component_const = + GetSpecialConstant(type->GetSingleWordInOperand(0)); + std::vector ids; + for (uint32_t i = 0; i < type->GetSingleWordInOperand(1); ++i) { + ids.push_back(component_const); + } + special_const = const_mgr->GetConstant(type_mgr->GetType(type_id), ids); + } else { + assert(type->opcode() == SpvOpTypeInt || type->opcode() == SpvOpTypeFloat); + std::vector literal_words; + for (uint32_t i = 0; i < type->GetSingleWordInOperand(0); i += 32) { + literal_words.push_back(0xDEADBEEF); + } + special_const = + const_mgr->GetConstant(type_mgr->GetType(type_id), literal_words); + } + assert(special_const != nullptr); + return const_mgr->GetDefiningInstruction(special_const)->result_id(); +} + +std::string ReplaceInvalidOpcodePass::BuildWarningMessage(SpvOp opcode) { + spv_opcode_desc opcode_info; + context()->grammar().lookupOpcode(opcode, &opcode_info); + std::string message = "Removing "; + message += opcode_info->name; + message += " instruction because of incompatible execution model."; + return message; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h new file mode 100644 index 00000000000..426bcac5e67 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/replace_invalid_opc.h @@ -0,0 +1,67 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_REPLACE_INVALID_OPC_H_ +#define SOURCE_OPT_REPLACE_INVALID_OPC_H_ + +#include + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// This pass will runs on shader modules only. It will replace the result of +// instructions that are valid for shader modules, but not the current shader +// stage, with a constant value. If the instruction does not have a return +// value, the instruction will simply be deleted. +class ReplaceInvalidOpcodePass : public Pass { + public: + const char* name() const override { return "replace-invalid-opcode"; } + Status Process() override; + + private: + // Returns the execution model that is used by every entry point in the + // module. If more than one execution model is used in the module, then the + // return value is SpvExecutionModelMax. + SpvExecutionModel GetExecutionModel(); + + // Replaces all instructions in |function| that are invalid with execution + // model |mode|, but valid for another shader model, with a special constant + // value. See |GetSpecialConstant|. + bool RewriteFunction(Function* function, SpvExecutionModel mode); + + // Returns true if |inst| is valid for fragment shaders only. + bool IsFragmentShaderOnlyInstruction(Instruction* inst); + + // Replaces all uses of the result of |inst|, if there is one, with the id of + // a special constant. Then |inst| is killed. |inst| cannot be a block + // terminator because the basic block will then become invalid. |inst| is no + // longer valid after calling this function. + void ReplaceInstruction(Instruction* inst, const char* source, + uint32_t line_number, uint32_t column_number); + + // Returns the id of a constant with type |type_id|. The type must be an + // integer, float, or vector. For scalar types, the hex representation of the + // constant will be the concatenation of 0xDEADBEEF with itself until the + // width of the type has been reached. For a vector, each element of the + // constant will be constructed the same way. + uint32_t GetSpecialConstant(uint32_t type_id); + std::string BuildWarningMessage(SpvOp opcode); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_REPLACE_INVALID_OPC_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp new file mode 100644 index 00000000000..38555e649e4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.cpp @@ -0,0 +1,988 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/scalar_analysis.h" + +#include +#include +#include +#include + +#include "source/opt/ir_context.h" + +// Transforms a given scalar operation instruction into a DAG representation. +// +// 1. Take an instruction and traverse its operands until we reach a +// constant node or an instruction which we do not know how to compute the +// value, such as a load. +// +// 2. Create a new node for each instruction traversed and build the nodes for +// the in operands of that instruction as well. +// +// 3. Add the operand nodes as children of the first and hash the node. Use the +// hash to see if the node is already in the cache. We ensure the children are +// always in sorted order so that two nodes with the same children but inserted +// in a different order have the same hash and so that the overloaded operator== +// will return true. If the node is already in the cache return the cached +// version instead. +// +// 4. The created DAG can then be simplified by +// ScalarAnalysis::SimplifyExpression, implemented in +// scalar_analysis_simplification.cpp. See that file for further information on +// the simplification process. +// + +namespace spvtools { +namespace opt { + +uint32_t SENode::NumberOfNodes = 0; + +ScalarEvolutionAnalysis::ScalarEvolutionAnalysis(IRContext* context) + : context_(context), pretend_equal_{} { + // Create and cached the CantComputeNode. + cached_cant_compute_ = + GetCachedOrAdd(std::unique_ptr(new SECantCompute(this))); +} + +SENode* ScalarEvolutionAnalysis::CreateNegation(SENode* operand) { + // If operand is can't compute then the whole graph is can't compute. + if (operand->IsCantCompute()) return CreateCantComputeNode(); + + if (operand->GetType() == SENode::Constant) { + return CreateConstant(-operand->AsSEConstantNode()->FoldToSingleValue()); + } + std::unique_ptr negation_node{new SENegative(this)}; + negation_node->AddChild(operand); + return GetCachedOrAdd(std::move(negation_node)); +} + +SENode* ScalarEvolutionAnalysis::CreateConstant(int64_t integer) { + return GetCachedOrAdd( + std::unique_ptr(new SEConstantNode(this, integer))); +} + +SENode* ScalarEvolutionAnalysis::CreateRecurrentExpression( + const Loop* loop, SENode* offset, SENode* coefficient) { + assert(loop && "Recurrent add expressions must have a valid loop."); + + // If operands are can't compute then the whole graph is can't compute. + if (offset->IsCantCompute() || coefficient->IsCantCompute()) + return CreateCantComputeNode(); + + const Loop* loop_to_use = nullptr; + if (pretend_equal_[loop]) { + loop_to_use = pretend_equal_[loop]; + } else { + loop_to_use = loop; + } + + std::unique_ptr phi_node{ + new SERecurrentNode(this, loop_to_use)}; + phi_node->AddOffset(offset); + phi_node->AddCoefficient(coefficient); + + return GetCachedOrAdd(std::move(phi_node)); +} + +SENode* ScalarEvolutionAnalysis::AnalyzeMultiplyOp( + const Instruction* multiply) { + assert(multiply->opcode() == SpvOp::SpvOpIMul && + "Multiply node did not come from a multiply instruction"); + analysis::DefUseManager* def_use = context_->get_def_use_mgr(); + + SENode* op1 = + AnalyzeInstruction(def_use->GetDef(multiply->GetSingleWordInOperand(0))); + SENode* op2 = + AnalyzeInstruction(def_use->GetDef(multiply->GetSingleWordInOperand(1))); + + return CreateMultiplyNode(op1, op2); +} + +SENode* ScalarEvolutionAnalysis::CreateMultiplyNode(SENode* operand_1, + SENode* operand_2) { + // If operands are can't compute then the whole graph is can't compute. + if (operand_1->IsCantCompute() || operand_2->IsCantCompute()) + return CreateCantComputeNode(); + + if (operand_1->GetType() == SENode::Constant && + operand_2->GetType() == SENode::Constant) { + return CreateConstant(operand_1->AsSEConstantNode()->FoldToSingleValue() * + operand_2->AsSEConstantNode()->FoldToSingleValue()); + } + + std::unique_ptr multiply_node{new SEMultiplyNode(this)}; + + multiply_node->AddChild(operand_1); + multiply_node->AddChild(operand_2); + + return GetCachedOrAdd(std::move(multiply_node)); +} + +SENode* ScalarEvolutionAnalysis::CreateSubtraction(SENode* operand_1, + SENode* operand_2) { + // Fold if both operands are constant. + if (operand_1->GetType() == SENode::Constant && + operand_2->GetType() == SENode::Constant) { + return CreateConstant(operand_1->AsSEConstantNode()->FoldToSingleValue() - + operand_2->AsSEConstantNode()->FoldToSingleValue()); + } + + return CreateAddNode(operand_1, CreateNegation(operand_2)); +} + +SENode* ScalarEvolutionAnalysis::CreateAddNode(SENode* operand_1, + SENode* operand_2) { + // Fold if both operands are constant and the |simplify| flag is true. + if (operand_1->GetType() == SENode::Constant && + operand_2->GetType() == SENode::Constant) { + return CreateConstant(operand_1->AsSEConstantNode()->FoldToSingleValue() + + operand_2->AsSEConstantNode()->FoldToSingleValue()); + } + + // If operands are can't compute then the whole graph is can't compute. + if (operand_1->IsCantCompute() || operand_2->IsCantCompute()) + return CreateCantComputeNode(); + + std::unique_ptr add_node{new SEAddNode(this)}; + + add_node->AddChild(operand_1); + add_node->AddChild(operand_2); + + return GetCachedOrAdd(std::move(add_node)); +} + +SENode* ScalarEvolutionAnalysis::AnalyzeInstruction(const Instruction* inst) { + auto itr = recurrent_node_map_.find(inst); + if (itr != recurrent_node_map_.end()) return itr->second; + + SENode* output = nullptr; + switch (inst->opcode()) { + case SpvOp::SpvOpPhi: { + output = AnalyzePhiInstruction(inst); + break; + } + case SpvOp::SpvOpConstant: + case SpvOp::SpvOpConstantNull: { + output = AnalyzeConstant(inst); + break; + } + case SpvOp::SpvOpISub: + case SpvOp::SpvOpIAdd: { + output = AnalyzeAddOp(inst); + break; + } + case SpvOp::SpvOpIMul: { + output = AnalyzeMultiplyOp(inst); + break; + } + default: { + output = CreateValueUnknownNode(inst); + break; + } + } + + return output; +} + +SENode* ScalarEvolutionAnalysis::AnalyzeConstant(const Instruction* inst) { + if (inst->opcode() == SpvOp::SpvOpConstantNull) return CreateConstant(0); + + assert(inst->opcode() == SpvOp::SpvOpConstant); + assert(inst->NumInOperands() == 1); + int64_t value = 0; + + // Look up the instruction in the constant manager. + const analysis::Constant* constant = + context_->get_constant_mgr()->FindDeclaredConstant(inst->result_id()); + + if (!constant) return CreateCantComputeNode(); + + const analysis::IntConstant* int_constant = constant->AsIntConstant(); + + // Exit out if it is a 64 bit integer. + if (!int_constant || int_constant->words().size() != 1) + return CreateCantComputeNode(); + + if (int_constant->type()->AsInteger()->IsSigned()) { + value = int_constant->GetS32BitValue(); + } else { + value = int_constant->GetU32BitValue(); + } + + return CreateConstant(value); +} + +// Handles both addition and subtraction. If the |sub| flag is set then the +// addition will be op1+(-op2) otherwise op1+op2. +SENode* ScalarEvolutionAnalysis::AnalyzeAddOp(const Instruction* inst) { + assert((inst->opcode() == SpvOp::SpvOpIAdd || + inst->opcode() == SpvOp::SpvOpISub) && + "Add node must be created from a OpIAdd or OpISub instruction"); + + analysis::DefUseManager* def_use = context_->get_def_use_mgr(); + + SENode* op1 = + AnalyzeInstruction(def_use->GetDef(inst->GetSingleWordInOperand(0))); + + SENode* op2 = + AnalyzeInstruction(def_use->GetDef(inst->GetSingleWordInOperand(1))); + + // To handle subtraction we wrap the second operand in a unary negation node. + if (inst->opcode() == SpvOp::SpvOpISub) { + op2 = CreateNegation(op2); + } + + return CreateAddNode(op1, op2); +} + +SENode* ScalarEvolutionAnalysis::AnalyzePhiInstruction(const Instruction* phi) { + // The phi should only have two incoming value pairs. + if (phi->NumInOperands() != 4) { + return CreateCantComputeNode(); + } + + analysis::DefUseManager* def_use = context_->get_def_use_mgr(); + + // Get the basic block this instruction belongs to. + BasicBlock* basic_block = + context_->get_instr_block(const_cast(phi)); + + // And then the function that the basic blocks belongs to. + Function* function = basic_block->GetParent(); + + // Use the function to get the loop descriptor. + LoopDescriptor* loop_descriptor = context_->GetLoopDescriptor(function); + + // We only handle phis in loops at the moment. + if (!loop_descriptor) return CreateCantComputeNode(); + + // Get the innermost loop which this block belongs to. + Loop* loop = (*loop_descriptor)[basic_block->id()]; + + // If the loop doesn't exist or doesn't have a preheader or latch block, exit + // out. + if (!loop || !loop->GetLatchBlock() || !loop->GetPreHeaderBlock() || + loop->GetHeaderBlock() != basic_block) + return recurrent_node_map_[phi] = CreateCantComputeNode(); + + const Loop* loop_to_use = nullptr; + if (pretend_equal_[loop]) { + loop_to_use = pretend_equal_[loop]; + } else { + loop_to_use = loop; + } + std::unique_ptr phi_node{ + new SERecurrentNode(this, loop_to_use)}; + + // We add the node to this map to allow it to be returned before the node is + // fully built. This is needed as the subsequent call to AnalyzeInstruction + // could lead back to this |phi| instruction so we return the pointer + // immediately in AnalyzeInstruction to break the recursion. + recurrent_node_map_[phi] = phi_node.get(); + + // Traverse the operands of the instruction an create new nodes for each one. + for (uint32_t i = 0; i < phi->NumInOperands(); i += 2) { + uint32_t value_id = phi->GetSingleWordInOperand(i); + uint32_t incoming_label_id = phi->GetSingleWordInOperand(i + 1); + + Instruction* value_inst = def_use->GetDef(value_id); + SENode* value_node = AnalyzeInstruction(value_inst); + + // If any operand is CantCompute then the whole graph is CantCompute. + if (value_node->IsCantCompute()) + return recurrent_node_map_[phi] = CreateCantComputeNode(); + + // If the value is coming from the preheader block then the value is the + // initial value of the phi. + if (incoming_label_id == loop->GetPreHeaderBlock()->id()) { + phi_node->AddOffset(value_node); + } else if (incoming_label_id == loop->GetLatchBlock()->id()) { + // Assumed to be in the form of step + phi. + if (value_node->GetType() != SENode::Add) + return recurrent_node_map_[phi] = CreateCantComputeNode(); + + SENode* step_node = nullptr; + SENode* phi_operand = nullptr; + SENode* operand_1 = value_node->GetChild(0); + SENode* operand_2 = value_node->GetChild(1); + + // Find which node is the step term. + if (!operand_1->AsSERecurrentNode()) + step_node = operand_1; + else if (!operand_2->AsSERecurrentNode()) + step_node = operand_2; + + // Find which node is the recurrent expression. + if (operand_1->AsSERecurrentNode()) + phi_operand = operand_1; + else if (operand_2->AsSERecurrentNode()) + phi_operand = operand_2; + + // If it is not in the form step + phi exit out. + if (!(step_node && phi_operand)) + return recurrent_node_map_[phi] = CreateCantComputeNode(); + + // If the phi operand is not the same phi node exit out. + if (phi_operand != phi_node.get()) + return recurrent_node_map_[phi] = CreateCantComputeNode(); + + if (!IsLoopInvariant(loop, step_node)) + return recurrent_node_map_[phi] = CreateCantComputeNode(); + + phi_node->AddCoefficient(step_node); + } + } + + // Once the node is fully built we update the map with the version from the + // cache (if it has already been added to the cache). + return recurrent_node_map_[phi] = GetCachedOrAdd(std::move(phi_node)); +} + +SENode* ScalarEvolutionAnalysis::CreateValueUnknownNode( + const Instruction* inst) { + std::unique_ptr load_node{ + new SEValueUnknown(this, inst->result_id())}; + return GetCachedOrAdd(std::move(load_node)); +} + +SENode* ScalarEvolutionAnalysis::CreateCantComputeNode() { + return cached_cant_compute_; +} + +// Add the created node into the cache of nodes. If it already exists return it. +SENode* ScalarEvolutionAnalysis::GetCachedOrAdd( + std::unique_ptr prospective_node) { + auto itr = node_cache_.find(prospective_node); + if (itr != node_cache_.end()) { + return (*itr).get(); + } + + SENode* raw_ptr_to_node = prospective_node.get(); + node_cache_.insert(std::move(prospective_node)); + return raw_ptr_to_node; +} + +bool ScalarEvolutionAnalysis::IsLoopInvariant(const Loop* loop, + const SENode* node) const { + for (auto itr = node->graph_cbegin(); itr != node->graph_cend(); ++itr) { + if (const SERecurrentNode* rec = itr->AsSERecurrentNode()) { + const BasicBlock* header = rec->GetLoop()->GetHeaderBlock(); + + // If the loop which the recurrent expression belongs to is either |loop + // or a nested loop inside |loop| then we assume it is variant. + if (loop->IsInsideLoop(header)) { + return false; + } + } else if (const SEValueUnknown* unknown = itr->AsSEValueUnknown()) { + // If the instruction is inside the loop we conservatively assume it is + // loop variant. + if (loop->IsInsideLoop(unknown->ResultId())) return false; + } + } + + return true; +} + +SENode* ScalarEvolutionAnalysis::GetCoefficientFromRecurrentTerm( + SENode* node, const Loop* loop) { + // Traverse the DAG to find the recurrent expression belonging to |loop|. + for (auto itr = node->graph_begin(); itr != node->graph_end(); ++itr) { + SERecurrentNode* rec = itr->AsSERecurrentNode(); + if (rec && rec->GetLoop() == loop) { + return rec->GetCoefficient(); + } + } + return CreateConstant(0); +} + +SENode* ScalarEvolutionAnalysis::UpdateChildNode(SENode* parent, + SENode* old_child, + SENode* new_child) { + // Only handles add. + if (parent->GetType() != SENode::Add) return parent; + + std::vector new_children; + for (SENode* child : *parent) { + if (child == old_child) { + new_children.push_back(new_child); + } else { + new_children.push_back(child); + } + } + + std::unique_ptr add_node{new SEAddNode(this)}; + for (SENode* child : new_children) { + add_node->AddChild(child); + } + + return SimplifyExpression(GetCachedOrAdd(std::move(add_node))); +} + +// Rebuild the |node| eliminating, if it exists, the recurrent term which +// belongs to the |loop|. +SENode* ScalarEvolutionAnalysis::BuildGraphWithoutRecurrentTerm( + SENode* node, const Loop* loop) { + // If the node is already a recurrent expression belonging to loop then just + // return the offset. + SERecurrentNode* recurrent = node->AsSERecurrentNode(); + if (recurrent) { + if (recurrent->GetLoop() == loop) { + return recurrent->GetOffset(); + } else { + return node; + } + } + + std::vector new_children; + // Otherwise find the recurrent node in the children of this node. + for (auto itr : *node) { + recurrent = itr->AsSERecurrentNode(); + if (recurrent && recurrent->GetLoop() == loop) { + new_children.push_back(recurrent->GetOffset()); + } else { + new_children.push_back(itr); + } + } + + std::unique_ptr add_node{new SEAddNode(this)}; + for (SENode* child : new_children) { + add_node->AddChild(child); + } + + return SimplifyExpression(GetCachedOrAdd(std::move(add_node))); +} + +// Return the recurrent term belonging to |loop| if it appears in the graph +// starting at |node| or null if it doesn't. +SERecurrentNode* ScalarEvolutionAnalysis::GetRecurrentTerm(SENode* node, + const Loop* loop) { + for (auto itr = node->graph_begin(); itr != node->graph_end(); ++itr) { + SERecurrentNode* rec = itr->AsSERecurrentNode(); + if (rec && rec->GetLoop() == loop) { + return rec; + } + } + return nullptr; +} +std::string SENode::AsString() const { + switch (GetType()) { + case Constant: + return "Constant"; + case RecurrentAddExpr: + return "RecurrentAddExpr"; + case Add: + return "Add"; + case Negative: + return "Negative"; + case Multiply: + return "Multiply"; + case ValueUnknown: + return "Value Unknown"; + case CanNotCompute: + return "Can not compute"; + } + return "NULL"; +} + +bool SENode::operator==(const SENode& other) const { + if (GetType() != other.GetType()) return false; + + if (other.GetChildren().size() != children_.size()) return false; + + const SERecurrentNode* this_as_recurrent = AsSERecurrentNode(); + + // Check the children are the same, for SERecurrentNodes we need to check the + // offset and coefficient manually as the child vector is sorted by ids so the + // offset/coefficient information is lost. + if (!this_as_recurrent) { + for (size_t index = 0; index < children_.size(); ++index) { + if (other.GetChildren()[index] != children_[index]) return false; + } + } else { + const SERecurrentNode* other_as_recurrent = other.AsSERecurrentNode(); + + // We've already checked the types are the same, this should not fail if + // this->AsSERecurrentNode() succeeded. + assert(other_as_recurrent); + + if (this_as_recurrent->GetCoefficient() != + other_as_recurrent->GetCoefficient()) + return false; + + if (this_as_recurrent->GetOffset() != other_as_recurrent->GetOffset()) + return false; + + if (this_as_recurrent->GetLoop() != other_as_recurrent->GetLoop()) + return false; + } + + // If we're dealing with a value unknown node check both nodes were created by + // the same instruction. + if (GetType() == SENode::ValueUnknown) { + if (AsSEValueUnknown()->ResultId() != + other.AsSEValueUnknown()->ResultId()) { + return false; + } + } + + if (AsSEConstantNode()) { + if (AsSEConstantNode()->FoldToSingleValue() != + other.AsSEConstantNode()->FoldToSingleValue()) + return false; + } + + return true; +} + +bool SENode::operator!=(const SENode& other) const { return !(*this == other); } + +namespace { +// Helper functions to insert 32/64 bit values into the 32 bit hash string. This +// allows us to add pointers to the string by reinterpreting the pointers as +// uintptr_t. PushToString will deduce the type, call sizeof on it and use +// that size to call into the correct PushToStringImpl functor depending on +// whether it is 32 or 64 bit. + +template +struct PushToStringImpl; + +template +struct PushToStringImpl { + void operator()(T id, std::u32string* str) { + str->push_back(static_cast(id >> 32)); + str->push_back(static_cast(id)); + } +}; + +template +struct PushToStringImpl { + void operator()(T id, std::u32string* str) { + str->push_back(static_cast(id)); + } +}; + +template +static void PushToString(T id, std::u32string* str) { + PushToStringImpl{}(id, str); +} + +} // namespace + +// Implements the hashing of SENodes. +size_t SENodeHash::operator()(const SENode* node) const { + // Concatinate the terms into a string which we can hash. + std::u32string hash_string{}; + + // Hashing the type as a string is safer than hashing the enum as the enum is + // very likely to collide with constants. + for (char ch : node->AsString()) { + hash_string.push_back(static_cast(ch)); + } + + // We just ignore the literal value unless it is a constant. + if (node->GetType() == SENode::Constant) + PushToString(node->AsSEConstantNode()->FoldToSingleValue(), &hash_string); + + const SERecurrentNode* recurrent = node->AsSERecurrentNode(); + + // If we're dealing with a recurrent expression hash the loop as well so that + // nested inductions like i=0,i++ and j=0,j++ correspond to different nodes. + if (recurrent) { + PushToString(reinterpret_cast(recurrent->GetLoop()), + &hash_string); + + // Recurrent expressions can't be hashed using the normal method as the + // order of coefficient and offset matters to the hash. + PushToString(reinterpret_cast(recurrent->GetCoefficient()), + &hash_string); + PushToString(reinterpret_cast(recurrent->GetOffset()), + &hash_string); + + return std::hash{}(hash_string); + } + + // Hash the result id of the original instruction which created this node if + // it is a value unknown node. + if (node->GetType() == SENode::ValueUnknown) { + PushToString(node->AsSEValueUnknown()->ResultId(), &hash_string); + } + + // Hash the pointers of the child nodes, each SENode has a unique pointer + // associated with it. + const std::vector& children = node->GetChildren(); + for (const SENode* child : children) { + PushToString(reinterpret_cast(child), &hash_string); + } + + return std::hash{}(hash_string); +} + +// This overload is the actual overload used by the node_cache_ set. +size_t SENodeHash::operator()(const std::unique_ptr& node) const { + return this->operator()(node.get()); +} + +void SENode::DumpDot(std::ostream& out, bool recurse) const { + size_t unique_id = std::hash{}(this); + out << unique_id << " [label=\"" << AsString() << " "; + if (GetType() == SENode::Constant) { + out << "\nwith value: " << this->AsSEConstantNode()->FoldToSingleValue(); + } + out << "\"]\n"; + for (const SENode* child : children_) { + size_t child_unique_id = std::hash{}(child); + out << unique_id << " -> " << child_unique_id << " \n"; + if (recurse) child->DumpDot(out, true); + } +} + +namespace { +class IsGreaterThanZero { + public: + explicit IsGreaterThanZero(IRContext* context) : context_(context) {} + + // Determine if the value of |node| is always strictly greater than zero if + // |or_equal_zero| is false or greater or equal to zero if |or_equal_zero| is + // true. It returns true is the evaluation was able to conclude something, in + // which case the result is stored in |result|. + // The algorithm work by going through all the nodes and determine the + // sign of each of them. + bool Eval(const SENode* node, bool or_equal_zero, bool* result) { + *result = false; + switch (Visit(node)) { + case Signedness::kPositiveOrNegative: { + return false; + } + case Signedness::kStrictlyNegative: { + *result = false; + break; + } + case Signedness::kNegative: { + if (!or_equal_zero) { + return false; + } + *result = false; + break; + } + case Signedness::kStrictlyPositive: { + *result = true; + break; + } + case Signedness::kPositive: { + if (!or_equal_zero) { + return false; + } + *result = true; + break; + } + } + return true; + } + + private: + enum class Signedness { + kPositiveOrNegative, // Yield a value positive or negative. + kStrictlyNegative, // Yield a value strictly less than 0. + kNegative, // Yield a value less or equal to 0. + kStrictlyPositive, // Yield a value strictly greater than 0. + kPositive // Yield a value greater or equal to 0. + }; + + // Combine the signedness according to arithmetic rules of a given operator. + using Combiner = std::function; + + // Returns a functor to interpret the signedness of 2 expressions as if they + // were added. + Combiner GetAddCombiner() const { + return [](Signedness lhs, Signedness rhs) { + switch (lhs) { + case Signedness::kPositiveOrNegative: + break; + case Signedness::kStrictlyNegative: + if (rhs == Signedness::kStrictlyNegative || + rhs == Signedness::kNegative) + return lhs; + break; + case Signedness::kNegative: { + if (rhs == Signedness::kStrictlyNegative) + return Signedness::kStrictlyNegative; + if (rhs == Signedness::kNegative) return Signedness::kNegative; + break; + } + case Signedness::kStrictlyPositive: { + if (rhs == Signedness::kStrictlyPositive || + rhs == Signedness::kPositive) { + return Signedness::kStrictlyPositive; + } + break; + } + case Signedness::kPositive: { + if (rhs == Signedness::kStrictlyPositive) + return Signedness::kStrictlyPositive; + if (rhs == Signedness::kPositive) return Signedness::kPositive; + break; + } + } + return Signedness::kPositiveOrNegative; + }; + } + + // Returns a functor to interpret the signedness of 2 expressions as if they + // were multiplied. + Combiner GetMulCombiner() const { + return [](Signedness lhs, Signedness rhs) { + switch (lhs) { + case Signedness::kPositiveOrNegative: + break; + case Signedness::kStrictlyNegative: { + switch (rhs) { + case Signedness::kPositiveOrNegative: { + break; + } + case Signedness::kStrictlyNegative: { + return Signedness::kStrictlyPositive; + } + case Signedness::kNegative: { + return Signedness::kPositive; + } + case Signedness::kStrictlyPositive: { + return Signedness::kStrictlyNegative; + } + case Signedness::kPositive: { + return Signedness::kNegative; + } + } + break; + } + case Signedness::kNegative: { + switch (rhs) { + case Signedness::kPositiveOrNegative: { + break; + } + case Signedness::kStrictlyNegative: + case Signedness::kNegative: { + return Signedness::kPositive; + } + case Signedness::kStrictlyPositive: + case Signedness::kPositive: { + return Signedness::kNegative; + } + } + break; + } + case Signedness::kStrictlyPositive: { + return rhs; + } + case Signedness::kPositive: { + switch (rhs) { + case Signedness::kPositiveOrNegative: { + break; + } + case Signedness::kStrictlyNegative: + case Signedness::kNegative: { + return Signedness::kNegative; + } + case Signedness::kStrictlyPositive: + case Signedness::kPositive: { + return Signedness::kPositive; + } + } + break; + } + } + return Signedness::kPositiveOrNegative; + }; + } + + Signedness Visit(const SENode* node) { + switch (node->GetType()) { + case SENode::Constant: + return Visit(node->AsSEConstantNode()); + break; + case SENode::RecurrentAddExpr: + return Visit(node->AsSERecurrentNode()); + break; + case SENode::Negative: + return Visit(node->AsSENegative()); + break; + case SENode::CanNotCompute: + return Visit(node->AsSECantCompute()); + break; + case SENode::ValueUnknown: + return Visit(node->AsSEValueUnknown()); + break; + case SENode::Add: + return VisitExpr(node, GetAddCombiner()); + break; + case SENode::Multiply: + return VisitExpr(node, GetMulCombiner()); + break; + } + return Signedness::kPositiveOrNegative; + } + + // Returns the signedness of a constant |node|. + Signedness Visit(const SEConstantNode* node) { + if (0 == node->FoldToSingleValue()) return Signedness::kPositive; + if (0 < node->FoldToSingleValue()) return Signedness::kStrictlyPositive; + if (0 > node->FoldToSingleValue()) return Signedness::kStrictlyNegative; + return Signedness::kPositiveOrNegative; + } + + // Returns the signedness of an unknown |node| based on its type. + Signedness Visit(const SEValueUnknown* node) { + Instruction* insn = context_->get_def_use_mgr()->GetDef(node->ResultId()); + analysis::Type* type = context_->get_type_mgr()->GetType(insn->type_id()); + assert(type && "Can't retrieve a type for the instruction"); + analysis::Integer* int_type = type->AsInteger(); + assert(type && "Can't retrieve an integer type for the instruction"); + return int_type->IsSigned() ? Signedness::kPositiveOrNegative + : Signedness::kPositive; + } + + // Returns the signedness of a recurring expression. + Signedness Visit(const SERecurrentNode* node) { + Signedness coeff_sign = Visit(node->GetCoefficient()); + // SERecurrentNode represent an affine expression in the range [0, + // loop_bound], so the result cannot be strictly positive or negative. + switch (coeff_sign) { + default: + break; + case Signedness::kStrictlyNegative: + coeff_sign = Signedness::kNegative; + break; + case Signedness::kStrictlyPositive: + coeff_sign = Signedness::kPositive; + break; + } + return GetAddCombiner()(coeff_sign, Visit(node->GetOffset())); + } + + // Returns the signedness of a negation |node|. + Signedness Visit(const SENegative* node) { + switch (Visit(*node->begin())) { + case Signedness::kPositiveOrNegative: { + return Signedness::kPositiveOrNegative; + } + case Signedness::kStrictlyNegative: { + return Signedness::kStrictlyPositive; + } + case Signedness::kNegative: { + return Signedness::kPositive; + } + case Signedness::kStrictlyPositive: { + return Signedness::kStrictlyNegative; + } + case Signedness::kPositive: { + return Signedness::kNegative; + } + } + return Signedness::kPositiveOrNegative; + } + + Signedness Visit(const SECantCompute*) { + return Signedness::kPositiveOrNegative; + } + + // Returns the signedness of a binary expression by using the combiner + // |reduce|. + Signedness VisitExpr( + const SENode* node, + std::function reduce) { + Signedness result = Visit(*node->begin()); + for (const SENode* operand : make_range(++node->begin(), node->end())) { + if (result == Signedness::kPositiveOrNegative) { + return Signedness::kPositiveOrNegative; + } + result = reduce(result, Visit(operand)); + } + return result; + } + + IRContext* context_; +}; +} // namespace + +bool ScalarEvolutionAnalysis::IsAlwaysGreaterThanZero(SENode* node, + bool* is_gt_zero) const { + return IsGreaterThanZero(context_).Eval(node, false, is_gt_zero); +} + +bool ScalarEvolutionAnalysis::IsAlwaysGreaterOrEqualToZero( + SENode* node, bool* is_ge_zero) const { + return IsGreaterThanZero(context_).Eval(node, true, is_ge_zero); +} + +namespace { + +// Remove |node| from the |mul| chain (of the form A * ... * |node| * ... * Z), +// if |node| is not in the chain, returns the original chain. +static SENode* RemoveOneNodeFromMultiplyChain(SEMultiplyNode* mul, + const SENode* node) { + SENode* lhs = mul->GetChildren()[0]; + SENode* rhs = mul->GetChildren()[1]; + if (lhs == node) { + return rhs; + } + if (rhs == node) { + return lhs; + } + if (lhs->AsSEMultiplyNode()) { + SENode* res = RemoveOneNodeFromMultiplyChain(lhs->AsSEMultiplyNode(), node); + if (res != lhs) + return mul->GetParentAnalysis()->CreateMultiplyNode(res, rhs); + } + if (rhs->AsSEMultiplyNode()) { + SENode* res = RemoveOneNodeFromMultiplyChain(rhs->AsSEMultiplyNode(), node); + if (res != rhs) + return mul->GetParentAnalysis()->CreateMultiplyNode(res, rhs); + } + + return mul; +} +} // namespace + +std::pair SExpression::operator/( + SExpression rhs_wrapper) const { + SENode* lhs = node_; + SENode* rhs = rhs_wrapper.node_; + // Check for division by 0. + if (rhs->AsSEConstantNode() && + !rhs->AsSEConstantNode()->FoldToSingleValue()) { + return {scev_->CreateCantComputeNode(), 0}; + } + + // Trivial case. + if (lhs->AsSEConstantNode() && rhs->AsSEConstantNode()) { + int64_t lhs_value = lhs->AsSEConstantNode()->FoldToSingleValue(); + int64_t rhs_value = rhs->AsSEConstantNode()->FoldToSingleValue(); + return {scev_->CreateConstant(lhs_value / rhs_value), + lhs_value % rhs_value}; + } + + // look for a "c U / U" pattern. + if (lhs->AsSEMultiplyNode()) { + assert(lhs->GetChildren().size() == 2 && + "More than 2 operand for a multiply node."); + SENode* res = RemoveOneNodeFromMultiplyChain(lhs->AsSEMultiplyNode(), rhs); + if (res != lhs) { + return {res, 0}; + } + } + + return {scev_->CreateCantComputeNode(), 0}; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.h new file mode 100644 index 00000000000..fb6d631f565 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis.h @@ -0,0 +1,314 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_SCALAR_ANALYSIS_H_ +#define SOURCE_OPT_SCALAR_ANALYSIS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/instruction.h" +#include "source/opt/scalar_analysis_nodes.h" + +namespace spvtools { +namespace opt { + +class IRContext; +class Loop; + +// Manager for the Scalar Evolution analysis. Creates and maintains a DAG of +// scalar operations generated from analysing the use def graph from incoming +// instructions. Each node is hashed as it is added so like node (for instance, +// two induction variables i=0,i++ and j=0,j++) become the same node. After +// creating a DAG with AnalyzeInstruction it can the be simplified into a more +// usable form with SimplifyExpression. +class ScalarEvolutionAnalysis { + public: + explicit ScalarEvolutionAnalysis(IRContext* context); + + // Create a unary negative node on |operand|. + SENode* CreateNegation(SENode* operand); + + // Creates a subtraction between the two operands by adding |operand_1| to the + // negation of |operand_2|. + SENode* CreateSubtraction(SENode* operand_1, SENode* operand_2); + + // Create an addition node between two operands. The |simplify| when set will + // allow the function to return an SEConstant instead of an addition if the + // two input operands are also constant. + SENode* CreateAddNode(SENode* operand_1, SENode* operand_2); + + // Create a multiply node between two operands. + SENode* CreateMultiplyNode(SENode* operand_1, SENode* operand_2); + + // Create a node representing a constant integer. + SENode* CreateConstant(int64_t integer); + + // Create a value unknown node, such as a load. + SENode* CreateValueUnknownNode(const Instruction* inst); + + // Create a CantComputeNode. Used to exit out of analysis. + SENode* CreateCantComputeNode(); + + // Create a new recurrent node with |offset| and |coefficient|, with respect + // to |loop|. + SENode* CreateRecurrentExpression(const Loop* loop, SENode* offset, + SENode* coefficient); + + // Construct the DAG by traversing use def chain of |inst|. + SENode* AnalyzeInstruction(const Instruction* inst); + + // Simplify the |node| by grouping like terms or if contains a recurrent + // expression, rewrite the graph so the whole DAG (from |node| down) is in + // terms of that recurrent expression. + // + // For example. + // Induction variable i=0, i++ would produce Rec(0,1) so i+1 could be + // transformed into Rec(1,1). + // + // X+X*2+Y-Y+34-17 would be transformed into 3*X + 17, where X and Y are + // ValueUnknown nodes (such as a load instruction). + SENode* SimplifyExpression(SENode* node); + + // Add |prospective_node| into the cache and return a raw pointer to it. If + // |prospective_node| is already in the cache just return the raw pointer. + SENode* GetCachedOrAdd(std::unique_ptr prospective_node); + + // Checks that the graph starting from |node| is invariant to the |loop|. + bool IsLoopInvariant(const Loop* loop, const SENode* node) const; + + // Sets |is_gt_zero| to true if |node| represent a value always strictly + // greater than 0. The result of |is_gt_zero| is valid only if the function + // returns true. + bool IsAlwaysGreaterThanZero(SENode* node, bool* is_gt_zero) const; + + // Sets |is_ge_zero| to true if |node| represent a value greater or equals to + // 0. The result of |is_ge_zero| is valid only if the function returns true. + bool IsAlwaysGreaterOrEqualToZero(SENode* node, bool* is_ge_zero) const; + + // Find the recurrent term belonging to |loop| in the graph starting from + // |node| and return the coefficient of that recurrent term. Constant zero + // will be returned if no recurrent could be found. |node| should be in + // simplest form. + SENode* GetCoefficientFromRecurrentTerm(SENode* node, const Loop* loop); + + // Return a rebuilt graph starting from |node| with the recurrent expression + // belonging to |loop| being zeroed out. Returned node will be simplified. + SENode* BuildGraphWithoutRecurrentTerm(SENode* node, const Loop* loop); + + // Return the recurrent term belonging to |loop| if it appears in the graph + // starting at |node| or null if it doesn't. + SERecurrentNode* GetRecurrentTerm(SENode* node, const Loop* loop); + + SENode* UpdateChildNode(SENode* parent, SENode* child, SENode* new_child); + + // The loops in |loop_pair| will be considered the same when constructing + // SERecurrentNode objects. This enables analysing dependencies that will be + // created during loop fusion. + void AddLoopsToPretendAreTheSame( + const std::pair& loop_pair) { + pretend_equal_[std::get<1>(loop_pair)] = std::get<0>(loop_pair); + } + + private: + SENode* AnalyzeConstant(const Instruction* inst); + + // Handles both addition and subtraction. If the |instruction| is OpISub + // then the resulting node will be op1+(-op2) otherwise if it is OpIAdd then + // the result will be op1+op2. |instruction| must be OpIAdd or OpISub. + SENode* AnalyzeAddOp(const Instruction* instruction); + + SENode* AnalyzeMultiplyOp(const Instruction* multiply); + + SENode* AnalyzePhiInstruction(const Instruction* phi); + + IRContext* context_; + + // A map of instructions to SENodes. This is used to track recurrent + // expressions as they are added when analyzing instructions. Recurrent + // expressions come from phi nodes which by nature can include recursion so we + // check if nodes have already been built when analyzing instructions. + std::map recurrent_node_map_; + + // On creation we create and cache the CantCompute node so we not need to + // perform a needless create step. + SENode* cached_cant_compute_; + + // Helper functor to allow two unique_ptr to nodes to be compare. Only + // needed + // for the unordered_set implementation. + struct NodePointersEquality { + bool operator()(const std::unique_ptr& lhs, + const std::unique_ptr& rhs) const { + return *lhs == *rhs; + } + }; + + // Cache of nodes. All pointers to the nodes are references to the memory + // managed by they set. + std::unordered_set, SENodeHash, NodePointersEquality> + node_cache_; + + // Loops that should be considered the same for performing analysis for loop + // fusion. + std::map pretend_equal_; +}; + +// Wrapping class to manipulate SENode pointer using + - * / operators. +class SExpression { + public: + // Implicit on purpose ! + SExpression(SENode* node) + : node_(node->GetParentAnalysis()->SimplifyExpression(node)), + scev_(node->GetParentAnalysis()) {} + + inline operator SENode*() const { return node_; } + inline SENode* operator->() const { return node_; } + const SENode& operator*() const { return *node_; } + + inline ScalarEvolutionAnalysis* GetScalarEvolutionAnalysis() const { + return scev_; + } + + inline SExpression operator+(SENode* rhs) const; + template ::value, int>::type = 0> + inline SExpression operator+(T integer) const; + inline SExpression operator+(SExpression rhs) const; + + inline SExpression operator-() const; + inline SExpression operator-(SENode* rhs) const; + template ::value, int>::type = 0> + inline SExpression operator-(T integer) const; + inline SExpression operator-(SExpression rhs) const; + + inline SExpression operator*(SENode* rhs) const; + template ::value, int>::type = 0> + inline SExpression operator*(T integer) const; + inline SExpression operator*(SExpression rhs) const; + + template ::value, int>::type = 0> + inline std::pair operator/(T integer) const; + // Try to perform a division. Returns the pair . If it fails to simplify it, the function returns a + // CanNotCompute node. + std::pair operator/(SExpression rhs) const; + + private: + SENode* node_; + ScalarEvolutionAnalysis* scev_; +}; + +inline SExpression SExpression::operator+(SENode* rhs) const { + return scev_->CreateAddNode(node_, rhs); +} + +template ::value, int>::type> +inline SExpression SExpression::operator+(T integer) const { + return *this + scev_->CreateConstant(integer); +} + +inline SExpression SExpression::operator+(SExpression rhs) const { + return *this + rhs.node_; +} + +inline SExpression SExpression::operator-() const { + return scev_->CreateNegation(node_); +} + +inline SExpression SExpression::operator-(SENode* rhs) const { + return *this + scev_->CreateNegation(rhs); +} + +template ::value, int>::type> +inline SExpression SExpression::operator-(T integer) const { + return *this - scev_->CreateConstant(integer); +} + +inline SExpression SExpression::operator-(SExpression rhs) const { + return *this - rhs.node_; +} + +inline SExpression SExpression::operator*(SENode* rhs) const { + return scev_->CreateMultiplyNode(node_, rhs); +} + +template ::value, int>::type> +inline SExpression SExpression::operator*(T integer) const { + return *this * scev_->CreateConstant(integer); +} + +inline SExpression SExpression::operator*(SExpression rhs) const { + return *this * rhs.node_; +} + +template ::value, int>::type> +inline std::pair SExpression::operator/(T integer) const { + return *this / scev_->CreateConstant(integer); +} + +template ::value, int>::type> +inline SExpression operator+(T lhs, SExpression rhs) { + return rhs + lhs; +} +inline SExpression operator+(SENode* lhs, SExpression rhs) { return rhs + lhs; } + +template ::value, int>::type> +inline SExpression operator-(T lhs, SExpression rhs) { + // NOLINTNEXTLINE(whitespace/braces) + return SExpression{rhs.GetScalarEvolutionAnalysis()->CreateConstant(lhs)} - + rhs; +} +inline SExpression operator-(SENode* lhs, SExpression rhs) { + // NOLINTNEXTLINE(whitespace/braces) + return SExpression{lhs} - rhs; +} + +template ::value, int>::type> +inline SExpression operator*(T lhs, SExpression rhs) { + return rhs * lhs; +} +inline SExpression operator*(SENode* lhs, SExpression rhs) { return rhs * lhs; } + +template ::value, int>::type> +inline std::pair operator/(T lhs, SExpression rhs) { + // NOLINTNEXTLINE(whitespace/braces) + return SExpression{rhs.GetScalarEvolutionAnalysis()->CreateConstant(lhs)} / + rhs; +} +inline std::pair operator/(SENode* lhs, SExpression rhs) { + // NOLINTNEXTLINE(whitespace/braces) + return SExpression{lhs} / rhs; +} + +} // namespace opt +} // namespace spvtools +#endif // SOURCE_OPT_SCALAR_ANALYSIS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_nodes.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_nodes.h new file mode 100644 index 00000000000..450522ec3f0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_nodes.h @@ -0,0 +1,345 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASI, +// WITHOUT 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 SOURCE_OPT_SCALAR_ANALYSIS_NODES_H_ +#define SOURCE_OPT_SCALAR_ANALYSIS_NODES_H_ + +#include +#include +#include +#include + +#include "source/opt/tree_iterator.h" + +namespace spvtools { +namespace opt { + +class Loop; +class ScalarEvolutionAnalysis; +class SEConstantNode; +class SERecurrentNode; +class SEAddNode; +class SEMultiplyNode; +class SENegative; +class SEValueUnknown; +class SECantCompute; + +// Abstract class representing a node in the scalar evolution DAG. Each node +// contains a vector of pointers to its children and each subclass of SENode +// implements GetType and an As method to allow casting. SENodes can be hashed +// using the SENodeHash functor. The vector of children is sorted when a node is +// added. This is important as it allows the hash of X+Y to be the same as Y+X. +class SENode { + public: + enum SENodeType { + Constant, + RecurrentAddExpr, + Add, + Multiply, + Negative, + ValueUnknown, + CanNotCompute + }; + + using ChildContainerType = std::vector; + + explicit SENode(ScalarEvolutionAnalysis* parent_analysis) + : parent_analysis_(parent_analysis), unique_id_(++NumberOfNodes) {} + + virtual SENodeType GetType() const = 0; + + virtual ~SENode() {} + + virtual inline void AddChild(SENode* child) { + // If this is a constant node, assert. + if (AsSEConstantNode()) { + assert(false && "Trying to add a child node to a constant!"); + } + + // Find the first point in the vector where |child| is greater than the node + // currently in the vector. + auto find_first_less_than = [child](const SENode* node) { + return child->unique_id_ <= node->unique_id_; + }; + + auto position = std::find_if_not(children_.begin(), children_.end(), + find_first_less_than); + // Children are sorted so the hashing and equality operator will be the same + // for a node with the same children. X+Y should be the same as Y+X. + children_.insert(position, child); + } + + // Get the type as an std::string. This is used to represent the node in the + // dot output and is used to hash the type as well. + std::string AsString() const; + + // Dump the SENode and its immediate children, if |recurse| is true then it + // will recurse through all children to print the DAG starting from this node + // as a root. + void DumpDot(std::ostream& out, bool recurse = false) const; + + // Checks if two nodes are the same by hashing them. + bool operator==(const SENode& other) const; + + // Checks if two nodes are not the same by comparing the hashes. + bool operator!=(const SENode& other) const; + + // Return the child node at |index|. + inline SENode* GetChild(size_t index) { return children_[index]; } + inline const SENode* GetChild(size_t index) const { return children_[index]; } + + // Iterator to iterate over the child nodes. + using iterator = ChildContainerType::iterator; + using const_iterator = ChildContainerType::const_iterator; + + // Iterate over immediate child nodes. + iterator begin() { return children_.begin(); } + iterator end() { return children_.end(); } + + // Constant overloads for iterating over immediate child nodes. + const_iterator begin() const { return children_.cbegin(); } + const_iterator end() const { return children_.cend(); } + const_iterator cbegin() { return children_.cbegin(); } + const_iterator cend() { return children_.cend(); } + + // Collect all the recurrent nodes in this SENode + std::vector CollectRecurrentNodes() { + std::vector recurrent_nodes{}; + + if (auto recurrent_node = AsSERecurrentNode()) { + recurrent_nodes.push_back(recurrent_node); + } + + for (auto child : GetChildren()) { + auto child_recurrent_nodes = child->CollectRecurrentNodes(); + recurrent_nodes.insert(recurrent_nodes.end(), + child_recurrent_nodes.begin(), + child_recurrent_nodes.end()); + } + + return recurrent_nodes; + } + + // Collect all the value unknown nodes in this SENode + std::vector CollectValueUnknownNodes() { + std::vector value_unknown_nodes{}; + + if (auto value_unknown_node = AsSEValueUnknown()) { + value_unknown_nodes.push_back(value_unknown_node); + } + + for (auto child : GetChildren()) { + auto child_value_unknown_nodes = child->CollectValueUnknownNodes(); + value_unknown_nodes.insert(value_unknown_nodes.end(), + child_value_unknown_nodes.begin(), + child_value_unknown_nodes.end()); + } + + return value_unknown_nodes; + } + + // Iterator to iterate over the entire DAG. Even though we are using the tree + // iterator it should still be safe to iterate over. However, nodes with + // multiple parents will be visited multiple times, unlike in a tree. + using dag_iterator = TreeDFIterator; + using const_dag_iterator = TreeDFIterator; + + // Iterate over all child nodes in the graph. + dag_iterator graph_begin() { return dag_iterator(this); } + dag_iterator graph_end() { return dag_iterator(); } + const_dag_iterator graph_begin() const { return graph_cbegin(); } + const_dag_iterator graph_end() const { return graph_cend(); } + const_dag_iterator graph_cbegin() const { return const_dag_iterator(this); } + const_dag_iterator graph_cend() const { return const_dag_iterator(); } + + // Return the vector of immediate children. + const ChildContainerType& GetChildren() const { return children_; } + ChildContainerType& GetChildren() { return children_; } + + // Return true if this node is a cant compute node. + bool IsCantCompute() const { return GetType() == CanNotCompute; } + +// Implements a casting method for each type. +#define DeclareCastMethod(target) \ + virtual target* As##target() { return nullptr; } \ + virtual const target* As##target() const { return nullptr; } + DeclareCastMethod(SEConstantNode); + DeclareCastMethod(SERecurrentNode); + DeclareCastMethod(SEAddNode); + DeclareCastMethod(SEMultiplyNode); + DeclareCastMethod(SENegative); + DeclareCastMethod(SEValueUnknown); + DeclareCastMethod(SECantCompute); +#undef DeclareCastMethod + + // Get the analysis which has this node in its cache. + inline ScalarEvolutionAnalysis* GetParentAnalysis() const { + return parent_analysis_; + } + + protected: + ChildContainerType children_; + + ScalarEvolutionAnalysis* parent_analysis_; + + // The unique id of this node, assigned on creation by incrementing the static + // node count. + uint32_t unique_id_; + + // The number of nodes created. + static uint32_t NumberOfNodes; +}; + +// Function object to handle the hashing of SENodes. Hashing algorithm hashes +// the type (as a string), the literal value of any constants, and the child +// pointers which are assumed to be unique. +struct SENodeHash { + size_t operator()(const std::unique_ptr& node) const; + size_t operator()(const SENode* node) const; +}; + +// A node representing a constant integer. +class SEConstantNode : public SENode { + public: + SEConstantNode(ScalarEvolutionAnalysis* parent_analysis, int64_t value) + : SENode(parent_analysis), literal_value_(value) {} + + SENodeType GetType() const final { return Constant; } + + int64_t FoldToSingleValue() const { return literal_value_; } + + SEConstantNode* AsSEConstantNode() override { return this; } + const SEConstantNode* AsSEConstantNode() const override { return this; } + + inline void AddChild(SENode*) final { + assert(false && "Attempting to add a child to a constant node!"); + } + + protected: + int64_t literal_value_; +}; + +// A node representing a recurrent expression in the code. A recurrent +// expression is an expression whose value can be expressed as a linear +// expression of the loop iterations. Such as an induction variable. The actual +// value of a recurrent expression is coefficent_ * iteration + offset_, hence +// an induction variable i=0, i++ becomes a recurrent expression with an offset +// of zero and a coefficient of one. +class SERecurrentNode : public SENode { + public: + SERecurrentNode(ScalarEvolutionAnalysis* parent_analysis, const Loop* loop) + : SENode(parent_analysis), loop_(loop) {} + + SENodeType GetType() const final { return RecurrentAddExpr; } + + inline void AddCoefficient(SENode* child) { + coefficient_ = child; + SENode::AddChild(child); + } + + inline void AddOffset(SENode* child) { + offset_ = child; + SENode::AddChild(child); + } + + inline const SENode* GetCoefficient() const { return coefficient_; } + inline SENode* GetCoefficient() { return coefficient_; } + + inline const SENode* GetOffset() const { return offset_; } + inline SENode* GetOffset() { return offset_; } + + // Return the loop which this recurrent expression is recurring within. + const Loop* GetLoop() const { return loop_; } + + SERecurrentNode* AsSERecurrentNode() override { return this; } + const SERecurrentNode* AsSERecurrentNode() const override { return this; } + + private: + SENode* coefficient_; + SENode* offset_; + const Loop* loop_; +}; + +// A node representing an addition operation between child nodes. +class SEAddNode : public SENode { + public: + explicit SEAddNode(ScalarEvolutionAnalysis* parent_analysis) + : SENode(parent_analysis) {} + + SENodeType GetType() const final { return Add; } + + SEAddNode* AsSEAddNode() override { return this; } + const SEAddNode* AsSEAddNode() const override { return this; } +}; + +// A node representing a multiply operation between child nodes. +class SEMultiplyNode : public SENode { + public: + explicit SEMultiplyNode(ScalarEvolutionAnalysis* parent_analysis) + : SENode(parent_analysis) {} + + SENodeType GetType() const final { return Multiply; } + + SEMultiplyNode* AsSEMultiplyNode() override { return this; } + const SEMultiplyNode* AsSEMultiplyNode() const override { return this; } +}; + +// A node representing a unary negative operation. +class SENegative : public SENode { + public: + explicit SENegative(ScalarEvolutionAnalysis* parent_analysis) + : SENode(parent_analysis) {} + + SENodeType GetType() const final { return Negative; } + + SENegative* AsSENegative() override { return this; } + const SENegative* AsSENegative() const override { return this; } +}; + +// A node representing a value which we do not know the value of, such as a load +// instruction. +class SEValueUnknown : public SENode { + public: + // SEValueUnknowns must come from an instruction |unique_id| is the unique id + // of that instruction. This is so we cancompare value unknowns and have a + // unique value unknown for each instruction. + SEValueUnknown(ScalarEvolutionAnalysis* parent_analysis, uint32_t result_id) + : SENode(parent_analysis), result_id_(result_id) {} + + SENodeType GetType() const final { return ValueUnknown; } + + SEValueUnknown* AsSEValueUnknown() override { return this; } + const SEValueUnknown* AsSEValueUnknown() const override { return this; } + + inline uint32_t ResultId() const { return result_id_; } + + private: + uint32_t result_id_; +}; + +// A node which we cannot reason about at all. +class SECantCompute : public SENode { + public: + explicit SECantCompute(ScalarEvolutionAnalysis* parent_analysis) + : SENode(parent_analysis) {} + + SENodeType GetType() const final { return CanNotCompute; } + + SECantCompute* AsSECantCompute() override { return this; } + const SECantCompute* AsSECantCompute() const override { return this; } +}; + +} // namespace opt +} // namespace spvtools +#endif // SOURCE_OPT_SCALAR_ANALYSIS_NODES_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp new file mode 100644 index 00000000000..52f2d6ad90a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_analysis_simplification.cpp @@ -0,0 +1,539 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/scalar_analysis.h" + +#include +#include +#include +#include +#include +#include +#include + +// Simplifies scalar analysis DAGs. +// +// 1. Given a node passed to SimplifyExpression we first simplify the graph by +// calling SimplifyPolynomial. This groups like nodes following basic arithmetic +// rules, so multiple adds of the same load instruction could be grouped into a +// single multiply of that instruction. SimplifyPolynomial will traverse the DAG +// and build up an accumulator buffer for each class of instruction it finds. +// For example take the loop: +// for (i=0, i accumulators_; +}; + +// From a |multiply| build up the accumulator objects. +bool SENodeSimplifyImpl::AccumulatorsFromMultiply(SENode* multiply, + bool negation) { + if (multiply->GetChildren().size() != 2 || + multiply->GetType() != SENode::Multiply) + return false; + + SENode* operand_1 = multiply->GetChild(0); + SENode* operand_2 = multiply->GetChild(1); + + SENode* value_unknown = nullptr; + SENode* constant = nullptr; + + // Work out which operand is the unknown value. + if (operand_1->GetType() == SENode::ValueUnknown || + operand_1->GetType() == SENode::RecurrentAddExpr) + value_unknown = operand_1; + else if (operand_2->GetType() == SENode::ValueUnknown || + operand_2->GetType() == SENode::RecurrentAddExpr) + value_unknown = operand_2; + + // Work out which operand is the constant coefficient. + if (operand_1->GetType() == SENode::Constant) + constant = operand_1; + else if (operand_2->GetType() == SENode::Constant) + constant = operand_2; + + // If the expression is not a variable multiplied by a constant coefficient, + // exit out. + if (!(value_unknown && constant)) { + return false; + } + + int64_t sign = negation ? -1 : 1; + + auto iterator = accumulators_.find(value_unknown); + int64_t new_value = constant->AsSEConstantNode()->FoldToSingleValue() * sign; + // Add the result of the multiplication to the accumulators. + if (iterator != accumulators_.end()) { + (*iterator).second += new_value; + } else { + accumulators_.insert({value_unknown, new_value}); + } + + return true; +} + +SENode* SENodeSimplifyImpl::Simplify() { + // We only handle graphs with an addition, multiplication, or negation, at the + // root. + if (node_->GetType() != SENode::Add && node_->GetType() != SENode::Multiply && + node_->GetType() != SENode::Negative) + return node_; + + SENode* simplified_polynomial = SimplifyPolynomial(); + + SERecurrentNode* recurrent_expr = nullptr; + node_ = simplified_polynomial; + + // Fold recurrent expressions which are with respect to the same loop into a + // single recurrent expression. + simplified_polynomial = FoldRecurrentAddExpressions(simplified_polynomial); + + simplified_polynomial = + EliminateZeroCoefficientRecurrents(simplified_polynomial); + + // Traverse the immediate children of the new node to find the recurrent + // expression. If there is more than one there is nothing further we can do. + for (SENode* child : simplified_polynomial->GetChildren()) { + if (child->GetType() == SENode::RecurrentAddExpr) { + recurrent_expr = child->AsSERecurrentNode(); + } + } + + // We need to count the number of unique recurrent expressions in the DAG to + // ensure there is only one. + for (auto child_iterator = simplified_polynomial->graph_begin(); + child_iterator != simplified_polynomial->graph_end(); ++child_iterator) { + if (child_iterator->GetType() == SENode::RecurrentAddExpr && + recurrent_expr != child_iterator->AsSERecurrentNode()) { + return simplified_polynomial; + } + } + + if (recurrent_expr) { + return SimplifyRecurrentAddExpression(recurrent_expr); + } + + return simplified_polynomial; +} + +// Traverse the graph to build up the accumulator objects. +void SENodeSimplifyImpl::GatherAccumulatorsFromChildNodes(SENode* new_node, + SENode* child, + bool negation) { + int32_t sign = negation ? -1 : 1; + + if (child->GetType() == SENode::Constant) { + // Collect all the constants and add them together. + constant_accumulator_ += + child->AsSEConstantNode()->FoldToSingleValue() * sign; + + } else if (child->GetType() == SENode::ValueUnknown || + child->GetType() == SENode::RecurrentAddExpr) { + // To rebuild the graph of X+X+X*2 into 4*X we count the occurrences of X + // and create a new node of count*X after. X can either be a ValueUnknown or + // a RecurrentAddExpr. The count for each X is stored in the accumulators_ + // map. + + auto iterator = accumulators_.find(child); + // If we've encountered this term before add to the accumulator for it. + if (iterator == accumulators_.end()) + accumulators_.insert({child, sign}); + else + iterator->second += sign; + + } else if (child->GetType() == SENode::Multiply) { + if (!AccumulatorsFromMultiply(child, negation)) { + new_node->AddChild(child); + } + + } else if (child->GetType() == SENode::Add) { + for (SENode* next_child : *child) { + GatherAccumulatorsFromChildNodes(new_node, next_child, negation); + } + + } else if (child->GetType() == SENode::Negative) { + SENode* negated_node = child->GetChild(0); + GatherAccumulatorsFromChildNodes(new_node, negated_node, !negation); + } else { + // If we can't work out how to fold the expression just add it back into + // the graph. + new_node->AddChild(child); + } +} + +SERecurrentNode* SENodeSimplifyImpl::UpdateCoefficient( + SERecurrentNode* recurrent, int64_t coefficient_update) const { + std::unique_ptr new_recurrent_node{new SERecurrentNode( + recurrent->GetParentAnalysis(), recurrent->GetLoop())}; + + SENode* new_coefficient = analysis_.CreateMultiplyNode( + recurrent->GetCoefficient(), + analysis_.CreateConstant(coefficient_update)); + + // See if the node can be simplified. + SENode* simplified = analysis_.SimplifyExpression(new_coefficient); + if (simplified->GetType() != SENode::CanNotCompute) + new_coefficient = simplified; + + if (coefficient_update < 0) { + new_recurrent_node->AddOffset( + analysis_.CreateNegation(recurrent->GetOffset())); + } else { + new_recurrent_node->AddOffset(recurrent->GetOffset()); + } + + new_recurrent_node->AddCoefficient(new_coefficient); + + return analysis_.GetCachedOrAdd(std::move(new_recurrent_node)) + ->AsSERecurrentNode(); +} + +// Simplify all the terms in the polynomial function. +SENode* SENodeSimplifyImpl::SimplifyPolynomial() { + std::unique_ptr new_add{new SEAddNode(node_->GetParentAnalysis())}; + + // Traverse the graph and gather the accumulators from it. + GatherAccumulatorsFromChildNodes(new_add.get(), node_, false); + + // Fold all the constants into a single constant node. + if (constant_accumulator_ != 0) { + new_add->AddChild(analysis_.CreateConstant(constant_accumulator_)); + } + + for (auto& pair : accumulators_) { + SENode* term = pair.first; + int64_t count = pair.second; + + // We can eliminate the term completely. + if (count == 0) continue; + + if (count == 1) { + new_add->AddChild(term); + } else if (count == -1 && term->GetType() != SENode::RecurrentAddExpr) { + // If the count is -1 we can just add a negative version of that node, + // unless it is a recurrent expression as we would rather the negative + // goes on the recurrent expressions children. This makes it easier to + // work with in other places. + new_add->AddChild(analysis_.CreateNegation(term)); + } else { + // Output value unknown terms as count*term and output recurrent + // expression terms as rec(offset, coefficient + count) offset and + // coefficient are the same as in the original expression. + if (term->GetType() == SENode::ValueUnknown) { + SENode* count_as_constant = analysis_.CreateConstant(count); + new_add->AddChild( + analysis_.CreateMultiplyNode(count_as_constant, term)); + } else { + assert(term->GetType() == SENode::RecurrentAddExpr && + "We only handle value unknowns or recurrent expressions"); + + // Create a new recurrent expression by adding the count to the + // coefficient of the old one. + new_add->AddChild(UpdateCoefficient(term->AsSERecurrentNode(), count)); + } + } + } + + // If there is only one term in the addition left just return that term. + if (new_add->GetChildren().size() == 1) { + return new_add->GetChild(0); + } + + // If there are no terms left in the addition just return 0. + if (new_add->GetChildren().size() == 0) { + return analysis_.CreateConstant(0); + } + + return analysis_.GetCachedOrAdd(std::move(new_add)); +} + +SENode* SENodeSimplifyImpl::FoldRecurrentAddExpressions(SENode* root) { + std::unique_ptr new_node{new SEAddNode(&analysis_)}; + + // A mapping of loops to the list of recurrent expressions which are with + // respect to those loops. + std::map>> + loops_to_recurrent{}; + + bool has_multiple_same_loop_recurrent_terms = false; + + for (SENode* child : *root) { + bool negation = false; + + if (child->GetType() == SENode::Negative) { + child = child->GetChild(0); + negation = true; + } + + if (child->GetType() == SENode::RecurrentAddExpr) { + const Loop* loop = child->AsSERecurrentNode()->GetLoop(); + + SERecurrentNode* rec = child->AsSERecurrentNode(); + if (loops_to_recurrent.find(loop) == loops_to_recurrent.end()) { + loops_to_recurrent[loop] = {std::make_pair(rec, negation)}; + } else { + loops_to_recurrent[loop].push_back(std::make_pair(rec, negation)); + has_multiple_same_loop_recurrent_terms = true; + } + } else { + new_node->AddChild(child); + } + } + + if (!has_multiple_same_loop_recurrent_terms) return root; + + for (auto pair : loops_to_recurrent) { + std::vector>& recurrent_expressions = + pair.second; + const Loop* loop = pair.first; + + std::unique_ptr new_coefficient{new SEAddNode(&analysis_)}; + std::unique_ptr new_offset{new SEAddNode(&analysis_)}; + + for (auto node_pair : recurrent_expressions) { + SERecurrentNode* node = node_pair.first; + bool negative = node_pair.second; + + if (!negative) { + new_coefficient->AddChild(node->GetCoefficient()); + new_offset->AddChild(node->GetOffset()); + } else { + new_coefficient->AddChild( + analysis_.CreateNegation(node->GetCoefficient())); + new_offset->AddChild(analysis_.CreateNegation(node->GetOffset())); + } + } + + std::unique_ptr new_recurrent{ + new SERecurrentNode(&analysis_, loop)}; + + SENode* new_coefficient_simplified = + analysis_.SimplifyExpression(new_coefficient.get()); + + SENode* new_offset_simplified = + analysis_.SimplifyExpression(new_offset.get()); + + if (new_coefficient_simplified->GetType() == SENode::Constant && + new_coefficient_simplified->AsSEConstantNode()->FoldToSingleValue() == + 0) { + return new_offset_simplified; + } + + new_recurrent->AddCoefficient(new_coefficient_simplified); + new_recurrent->AddOffset(new_offset_simplified); + + new_node->AddChild(analysis_.GetCachedOrAdd(std::move(new_recurrent))); + } + + // If we only have one child in the add just return that. + if (new_node->GetChildren().size() == 1) { + return new_node->GetChild(0); + } + + return analysis_.GetCachedOrAdd(std::move(new_node)); +} + +SENode* SENodeSimplifyImpl::EliminateZeroCoefficientRecurrents(SENode* node) { + if (node->GetType() != SENode::Add) return node; + + bool has_change = false; + + std::vector new_children{}; + for (SENode* child : *node) { + if (child->GetType() == SENode::RecurrentAddExpr) { + SENode* coefficient = child->AsSERecurrentNode()->GetCoefficient(); + // If coefficient is zero then we can eliminate the recurrent expression + // entirely and just return the offset as the recurrent expression is + // representing the equation coefficient*iterations + offset. + if (coefficient->GetType() == SENode::Constant && + coefficient->AsSEConstantNode()->FoldToSingleValue() == 0) { + new_children.push_back(child->AsSERecurrentNode()->GetOffset()); + has_change = true; + } else { + new_children.push_back(child); + } + } else { + new_children.push_back(child); + } + } + + if (!has_change) return node; + + std::unique_ptr new_add{new SEAddNode(node_->GetParentAnalysis())}; + + for (SENode* child : new_children) { + new_add->AddChild(child); + } + + return analysis_.GetCachedOrAdd(std::move(new_add)); +} + +SENode* SENodeSimplifyImpl::SimplifyRecurrentAddExpression( + SERecurrentNode* recurrent_expr) { + const std::vector& children = node_->GetChildren(); + + std::unique_ptr recurrent_node{new SERecurrentNode( + recurrent_expr->GetParentAnalysis(), recurrent_expr->GetLoop())}; + + // Create and simplify the new offset node. + std::unique_ptr new_offset{ + new SEAddNode(recurrent_expr->GetParentAnalysis())}; + new_offset->AddChild(recurrent_expr->GetOffset()); + + for (SENode* child : children) { + if (child->GetType() != SENode::RecurrentAddExpr) { + new_offset->AddChild(child); + } + } + + // Simplify the new offset. + SENode* simplified_child = analysis_.SimplifyExpression(new_offset.get()); + + // If the child can be simplified, add the simplified form otherwise, add it + // via the usual caching mechanism. + if (simplified_child->GetType() != SENode::CanNotCompute) { + recurrent_node->AddOffset(simplified_child); + } else { + recurrent_expr->AddOffset(analysis_.GetCachedOrAdd(std::move(new_offset))); + } + + recurrent_node->AddCoefficient(recurrent_expr->GetCoefficient()); + + return analysis_.GetCachedOrAdd(std::move(recurrent_node)); +} + +/* + * Scalar Analysis simplification public methods. + */ + +SENode* ScalarEvolutionAnalysis::SimplifyExpression(SENode* node) { + SENodeSimplifyImpl impl{this, node}; + + return impl.Simplify(); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp new file mode 100644 index 00000000000..d51dd8ef2c5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.cpp @@ -0,0 +1,806 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/scalar_replacement_pass.h" + +#include +#include +#include +#include + +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/opt/reflect.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +Pass::Status ScalarReplacementPass::Process() { + Status status = Status::SuccessWithoutChange; + for (auto& f : *get_module()) { + Status functionStatus = ProcessFunction(&f); + if (functionStatus == Status::Failure) + return functionStatus; + else if (functionStatus == Status::SuccessWithChange) + status = functionStatus; + } + + return status; +} + +Pass::Status ScalarReplacementPass::ProcessFunction(Function* function) { + std::queue worklist; + BasicBlock& entry = *function->begin(); + for (auto iter = entry.begin(); iter != entry.end(); ++iter) { + // Function storage class OpVariables must appear as the first instructions + // of the entry block. + if (iter->opcode() != SpvOpVariable) break; + + Instruction* varInst = &*iter; + if (CanReplaceVariable(varInst)) { + worklist.push(varInst); + } + } + + Status status = Status::SuccessWithoutChange; + while (!worklist.empty()) { + Instruction* varInst = worklist.front(); + worklist.pop(); + + if (!ReplaceVariable(varInst, &worklist)) + return Status::Failure; + else + status = Status::SuccessWithChange; + } + + return status; +} + +bool ScalarReplacementPass::ReplaceVariable( + Instruction* inst, std::queue* worklist) { + std::vector replacements; + CreateReplacementVariables(inst, &replacements); + + std::vector dead; + dead.push_back(inst); + if (!get_def_use_mgr()->WhileEachUser( + inst, [this, &replacements, &dead](Instruction* user) { + if (!IsAnnotationInst(user->opcode())) { + switch (user->opcode()) { + case SpvOpLoad: + ReplaceWholeLoad(user, replacements); + dead.push_back(user); + break; + case SpvOpStore: + ReplaceWholeStore(user, replacements); + dead.push_back(user); + break; + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + if (!ReplaceAccessChain(user, replacements)) return false; + dead.push_back(user); + break; + case SpvOpName: + case SpvOpMemberName: + break; + default: + assert(false && "Unexpected opcode"); + break; + } + } + return true; + })) + return false; + + // Clean up some dead code. + while (!dead.empty()) { + Instruction* toKill = dead.back(); + dead.pop_back(); + context()->KillInst(toKill); + } + + // Attempt to further scalarize. + for (auto var : replacements) { + if (var->opcode() == SpvOpVariable) { + if (get_def_use_mgr()->NumUsers(var) == 0) { + context()->KillInst(var); + } else if (CanReplaceVariable(var)) { + worklist->push(var); + } + } + } + + return true; +} + +void ScalarReplacementPass::ReplaceWholeLoad( + Instruction* load, const std::vector& replacements) { + // Replaces the load of the entire composite with a load from each replacement + // variable followed by a composite construction. + BasicBlock* block = context()->get_instr_block(load); + std::vector loads; + loads.reserve(replacements.size()); + BasicBlock::iterator where(load); + for (auto var : replacements) { + // Create a load of each replacement variable. + if (var->opcode() != SpvOpVariable) { + loads.push_back(var); + continue; + } + + Instruction* type = GetStorageType(var); + uint32_t loadId = TakeNextId(); + std::unique_ptr newLoad( + new Instruction(context(), SpvOpLoad, type->result_id(), loadId, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); + // Copy memory access attributes which start at index 1. Index 0 is the + // pointer to load. + for (uint32_t i = 1; i < load->NumInOperands(); ++i) { + Operand copy(load->GetInOperand(i)); + newLoad->AddOperand(std::move(copy)); + } + where = where.InsertBefore(std::move(newLoad)); + get_def_use_mgr()->AnalyzeInstDefUse(&*where); + context()->set_instr_block(&*where, block); + loads.push_back(&*where); + } + + // Construct a new composite. + uint32_t compositeId = TakeNextId(); + where = load; + std::unique_ptr compositeConstruct(new Instruction( + context(), SpvOpCompositeConstruct, load->type_id(), compositeId, {})); + for (auto l : loads) { + Operand op(SPV_OPERAND_TYPE_ID, + std::initializer_list{l->result_id()}); + compositeConstruct->AddOperand(std::move(op)); + } + where = where.InsertBefore(std::move(compositeConstruct)); + get_def_use_mgr()->AnalyzeInstDefUse(&*where); + context()->set_instr_block(&*where, block); + context()->ReplaceAllUsesWith(load->result_id(), compositeId); +} + +void ScalarReplacementPass::ReplaceWholeStore( + Instruction* store, const std::vector& replacements) { + // Replaces a store to the whole composite with a series of extract and stores + // to each element. + uint32_t storeInput = store->GetSingleWordInOperand(1u); + BasicBlock* block = context()->get_instr_block(store); + BasicBlock::iterator where(store); + uint32_t elementIndex = 0; + for (auto var : replacements) { + // Create the extract. + if (var->opcode() != SpvOpVariable) { + elementIndex++; + continue; + } + + Instruction* type = GetStorageType(var); + uint32_t extractId = TakeNextId(); + std::unique_ptr extract(new Instruction( + context(), SpvOpCompositeExtract, type->result_id(), extractId, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {storeInput}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {elementIndex++}}})); + auto iter = where.InsertBefore(std::move(extract)); + get_def_use_mgr()->AnalyzeInstDefUse(&*iter); + context()->set_instr_block(&*iter, block); + + // Create the store. + std::unique_ptr newStore( + new Instruction(context(), SpvOpStore, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}, + {SPV_OPERAND_TYPE_ID, {extractId}}})); + // Copy memory access attributes which start at index 2. Index 0 is the + // pointer and index 1 is the data. + for (uint32_t i = 2; i < store->NumInOperands(); ++i) { + Operand copy(store->GetInOperand(i)); + newStore->AddOperand(std::move(copy)); + } + iter = where.InsertBefore(std::move(newStore)); + get_def_use_mgr()->AnalyzeInstDefUse(&*iter); + context()->set_instr_block(&*iter, block); + } +} + +bool ScalarReplacementPass::ReplaceAccessChain( + Instruction* chain, const std::vector& replacements) { + // Replaces the access chain with either another access chain (with one fewer + // indexes) or a direct use of the replacement variable. + uint32_t indexId = chain->GetSingleWordInOperand(1u); + const Instruction* index = get_def_use_mgr()->GetDef(indexId); + size_t indexValue = GetConstantInteger(index); + if (indexValue > replacements.size()) { + // Out of bounds access, this is illegal IR. + return false; + } else { + const Instruction* var = replacements[indexValue]; + if (chain->NumInOperands() > 2) { + // Replace input access chain with another access chain. + BasicBlock::iterator chainIter(chain); + uint32_t replacementId = TakeNextId(); + std::unique_ptr replacementChain(new Instruction( + context(), chain->opcode(), chain->type_id(), replacementId, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}})); + // Add the remaining indexes. + for (uint32_t i = 2; i < chain->NumInOperands(); ++i) { + Operand copy(chain->GetInOperand(i)); + replacementChain->AddOperand(std::move(copy)); + } + auto iter = chainIter.InsertBefore(std::move(replacementChain)); + get_def_use_mgr()->AnalyzeInstDefUse(&*iter); + context()->set_instr_block(&*iter, context()->get_instr_block(chain)); + context()->ReplaceAllUsesWith(chain->result_id(), replacementId); + } else { + // Replace with a use of the variable. + context()->ReplaceAllUsesWith(chain->result_id(), var->result_id()); + } + } + + return true; +} + +void ScalarReplacementPass::CreateReplacementVariables( + Instruction* inst, std::vector* replacements) { + Instruction* type = GetStorageType(inst); + + std::unique_ptr> components_used = + GetUsedComponents(inst); + + uint32_t elem = 0; + switch (type->opcode()) { + case SpvOpTypeStruct: + type->ForEachInOperand( + [this, inst, &elem, replacements, &components_used](uint32_t* id) { + if (!components_used || components_used->count(elem)) { + CreateVariable(*id, inst, elem, replacements); + } else { + replacements->push_back(CreateNullConstant(*id)); + } + elem++; + }); + break; + case SpvOpTypeArray: + for (uint32_t i = 0; i != GetArrayLength(type); ++i) { + if (!components_used || components_used->count(i)) { + CreateVariable(type->GetSingleWordInOperand(0u), inst, i, + replacements); + } else { + replacements->push_back( + CreateNullConstant(type->GetSingleWordInOperand(0u))); + } + } + break; + + case SpvOpTypeMatrix: + case SpvOpTypeVector: + for (uint32_t i = 0; i != GetNumElements(type); ++i) { + CreateVariable(type->GetSingleWordInOperand(0u), inst, i, replacements); + } + break; + + default: + assert(false && "Unexpected type."); + break; + } + + TransferAnnotations(inst, replacements); +} + +void ScalarReplacementPass::TransferAnnotations( + const Instruction* source, std::vector* replacements) { + // Only transfer invariant and restrict decorations on the variable. There are + // no type or member decorations that are necessary to transfer. + for (auto inst : + get_decoration_mgr()->GetDecorationsFor(source->result_id(), false)) { + assert(inst->opcode() == SpvOpDecorate); + uint32_t decoration = inst->GetSingleWordInOperand(1u); + if (decoration == SpvDecorationInvariant || + decoration == SpvDecorationRestrict) { + for (auto var : *replacements) { + std::unique_ptr annotation( + new Instruction(context(), SpvOpDecorate, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {var->result_id()}}, + {SPV_OPERAND_TYPE_DECORATION, {decoration}}})); + for (uint32_t i = 2; i < inst->NumInOperands(); ++i) { + Operand copy(inst->GetInOperand(i)); + annotation->AddOperand(std::move(copy)); + } + context()->AddAnnotationInst(std::move(annotation)); + get_def_use_mgr()->AnalyzeInstUse(&*--context()->annotation_end()); + } + } + } +} + +void ScalarReplacementPass::CreateVariable( + uint32_t typeId, Instruction* varInst, uint32_t index, + std::vector* replacements) { + uint32_t ptrId = GetOrCreatePointerType(typeId); + uint32_t id = TakeNextId(); + std::unique_ptr variable(new Instruction( + context(), SpvOpVariable, ptrId, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}})); + + BasicBlock* block = context()->get_instr_block(varInst); + block->begin().InsertBefore(std::move(variable)); + Instruction* inst = &*block->begin(); + + // If varInst was initialized, make sure to initialize its replacement. + GetOrCreateInitialValue(varInst, index, inst); + get_def_use_mgr()->AnalyzeInstDefUse(inst); + context()->set_instr_block(inst, block); + + replacements->push_back(inst); +} + +uint32_t ScalarReplacementPass::GetOrCreatePointerType(uint32_t id) { + auto iter = pointee_to_pointer_.find(id); + if (iter != pointee_to_pointer_.end()) return iter->second; + + analysis::Type* pointeeTy; + std::unique_ptr pointerTy; + std::tie(pointeeTy, pointerTy) = + context()->get_type_mgr()->GetTypeAndPointerType(id, + SpvStorageClassFunction); + uint32_t ptrId = 0; + if (id == context()->get_type_mgr()->GetId(pointeeTy)) { + // Non-ambiguous type, just ask the type manager for an id. + ptrId = context()->get_type_mgr()->GetTypeInstruction(pointerTy.get()); + pointee_to_pointer_[id] = ptrId; + return ptrId; + } + + // Ambiguous type. We must perform a linear search to try and find the right + // type. + for (auto global : context()->types_values()) { + if (global.opcode() == SpvOpTypePointer && + global.GetSingleWordInOperand(0u) == SpvStorageClassFunction && + global.GetSingleWordInOperand(1u) == id) { + if (get_decoration_mgr()->GetDecorationsFor(id, false).empty()) { + // Only reuse a decoration-less pointer of the correct type. + ptrId = global.result_id(); + break; + } + } + } + + if (ptrId != 0) { + pointee_to_pointer_[id] = ptrId; + return ptrId; + } + + ptrId = TakeNextId(); + context()->AddType(MakeUnique( + context(), SpvOpTypePointer, 0, ptrId, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, {SpvStorageClassFunction}}, + {SPV_OPERAND_TYPE_ID, {id}}})); + Instruction* ptr = &*--context()->types_values_end(); + get_def_use_mgr()->AnalyzeInstDefUse(ptr); + pointee_to_pointer_[id] = ptrId; + // Register with the type manager if necessary. + context()->get_type_mgr()->RegisterType(ptrId, *pointerTy); + + return ptrId; +} + +void ScalarReplacementPass::GetOrCreateInitialValue(Instruction* source, + uint32_t index, + Instruction* newVar) { + assert(source->opcode() == SpvOpVariable); + if (source->NumInOperands() < 2) return; + + uint32_t initId = source->GetSingleWordInOperand(1u); + uint32_t storageId = GetStorageType(newVar)->result_id(); + Instruction* init = get_def_use_mgr()->GetDef(initId); + uint32_t newInitId = 0; + // TODO(dnovillo): Refactor this with constant propagation. + if (init->opcode() == SpvOpConstantNull) { + // Initialize to appropriate NULL. + auto iter = type_to_null_.find(storageId); + if (iter == type_to_null_.end()) { + newInitId = TakeNextId(); + type_to_null_[storageId] = newInitId; + context()->AddGlobalValue( + MakeUnique(context(), SpvOpConstantNull, storageId, + newInitId, std::initializer_list{})); + Instruction* newNull = &*--context()->types_values_end(); + get_def_use_mgr()->AnalyzeInstDefUse(newNull); + } else { + newInitId = iter->second; + } + } else if (IsSpecConstantInst(init->opcode())) { + // Create a new constant extract. + newInitId = TakeNextId(); + context()->AddGlobalValue(MakeUnique( + context(), SpvOpSpecConstantOp, storageId, newInitId, + std::initializer_list{ + {SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER, {SpvOpCompositeExtract}}, + {SPV_OPERAND_TYPE_ID, {init->result_id()}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {index}}})); + Instruction* newSpecConst = &*--context()->types_values_end(); + get_def_use_mgr()->AnalyzeInstDefUse(newSpecConst); + } else if (init->opcode() == SpvOpConstantComposite) { + // Get the appropriate index constant. + newInitId = init->GetSingleWordInOperand(index); + Instruction* element = get_def_use_mgr()->GetDef(newInitId); + if (element->opcode() == SpvOpUndef) { + // Undef is not a valid initializer for a variable. + newInitId = 0; + } + } else { + assert(false); + } + + if (newInitId != 0) { + newVar->AddOperand({SPV_OPERAND_TYPE_ID, {newInitId}}); + } +} + +size_t ScalarReplacementPass::GetIntegerLiteral(const Operand& op) const { + assert(op.words.size() <= 2); + size_t len = 0; + for (uint32_t i = 0; i != op.words.size(); ++i) { + len |= (op.words[i] << (32 * i)); + } + return len; +} + +size_t ScalarReplacementPass::GetConstantInteger( + const Instruction* constant) const { + assert(get_def_use_mgr()->GetDef(constant->type_id())->opcode() == + SpvOpTypeInt); + assert(constant->opcode() == SpvOpConstant || + constant->opcode() == SpvOpConstantNull); + if (constant->opcode() == SpvOpConstantNull) { + return 0; + } + + const Operand& op = constant->GetInOperand(0u); + return GetIntegerLiteral(op); +} + +size_t ScalarReplacementPass::GetArrayLength( + const Instruction* arrayType) const { + assert(arrayType->opcode() == SpvOpTypeArray); + const Instruction* length = + get_def_use_mgr()->GetDef(arrayType->GetSingleWordInOperand(1u)); + return GetConstantInteger(length); +} + +size_t ScalarReplacementPass::GetNumElements(const Instruction* type) const { + assert(type->opcode() == SpvOpTypeVector || + type->opcode() == SpvOpTypeMatrix); + const Operand& op = type->GetInOperand(1u); + assert(op.words.size() <= 2); + size_t len = 0; + for (uint32_t i = 0; i != op.words.size(); ++i) { + len |= (op.words[i] << (32 * i)); + } + return len; +} + +Instruction* ScalarReplacementPass::GetStorageType( + const Instruction* inst) const { + assert(inst->opcode() == SpvOpVariable); + + uint32_t ptrTypeId = inst->type_id(); + uint32_t typeId = + get_def_use_mgr()->GetDef(ptrTypeId)->GetSingleWordInOperand(1u); + return get_def_use_mgr()->GetDef(typeId); +} + +bool ScalarReplacementPass::CanReplaceVariable( + const Instruction* varInst) const { + assert(varInst->opcode() == SpvOpVariable); + + // Can only replace function scope variables. + if (varInst->GetSingleWordInOperand(0u) != SpvStorageClassFunction) + return false; + + if (!CheckTypeAnnotations(get_def_use_mgr()->GetDef(varInst->type_id()))) + return false; + + const Instruction* typeInst = GetStorageType(varInst); + return CheckType(typeInst) && CheckAnnotations(varInst) && CheckUses(varInst); +} + +bool ScalarReplacementPass::CheckType(const Instruction* typeInst) const { + if (!CheckTypeAnnotations(typeInst)) return false; + + switch (typeInst->opcode()) { + case SpvOpTypeStruct: + // Don't bother with empty structs or very large structs. + if (typeInst->NumInOperands() == 0 || + IsLargerThanSizeLimit(typeInst->NumInOperands())) + return false; + return true; + case SpvOpTypeArray: + if (IsLargerThanSizeLimit(GetArrayLength(typeInst))) return false; + return true; + // TODO(alanbaker): Develop some heuristics for when this should be + // re-enabled. + //// Specifically including matrix and vector in an attempt to reduce the + //// number of vector registers required. + // case SpvOpTypeMatrix: + // case SpvOpTypeVector: + // if (IsLargerThanSizeLimit(GetNumElements(typeInst))) return false; + // return true; + + case SpvOpTypeRuntimeArray: + default: + return false; + } +} + +bool ScalarReplacementPass::CheckTypeAnnotations( + const Instruction* typeInst) const { + for (auto inst : + get_decoration_mgr()->GetDecorationsFor(typeInst->result_id(), false)) { + uint32_t decoration; + if (inst->opcode() == SpvOpDecorate) { + decoration = inst->GetSingleWordInOperand(1u); + } else { + assert(inst->opcode() == SpvOpMemberDecorate); + decoration = inst->GetSingleWordInOperand(2u); + } + + switch (decoration) { + case SpvDecorationRowMajor: + case SpvDecorationColMajor: + case SpvDecorationArrayStride: + case SpvDecorationMatrixStride: + case SpvDecorationCPacked: + case SpvDecorationInvariant: + case SpvDecorationRestrict: + case SpvDecorationOffset: + case SpvDecorationAlignment: + case SpvDecorationAlignmentId: + case SpvDecorationMaxByteOffset: + break; + default: + return false; + } + } + + return true; +} + +bool ScalarReplacementPass::CheckAnnotations(const Instruction* varInst) const { + for (auto inst : + get_decoration_mgr()->GetDecorationsFor(varInst->result_id(), false)) { + assert(inst->opcode() == SpvOpDecorate); + uint32_t decoration = inst->GetSingleWordInOperand(1u); + switch (decoration) { + case SpvDecorationInvariant: + case SpvDecorationRestrict: + case SpvDecorationAlignment: + case SpvDecorationAlignmentId: + case SpvDecorationMaxByteOffset: + break; + default: + return false; + } + } + + return true; +} + +bool ScalarReplacementPass::CheckUses(const Instruction* inst) const { + VariableStats stats = {0, 0}; + bool ok = CheckUses(inst, &stats); + + // TODO(alanbaker/greg-lunarg): Add some meaningful heuristics about when + // SRoA is costly, such as when the structure has many (unaccessed?) + // members. + + return ok; +} + +bool ScalarReplacementPass::CheckUses(const Instruction* inst, + VariableStats* stats) const { + bool ok = true; + get_def_use_mgr()->ForEachUse( + inst, [this, stats, &ok](const Instruction* user, uint32_t index) { + // Annotations are check as a group separately. + if (!IsAnnotationInst(user->opcode())) { + switch (user->opcode()) { + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + if (index == 2u) { + uint32_t id = user->GetSingleWordOperand(3u); + const Instruction* opInst = get_def_use_mgr()->GetDef(id); + if (!IsCompileTimeConstantInst(opInst->opcode())) { + ok = false; + } else { + if (!CheckUsesRelaxed(user)) ok = false; + } + stats->num_partial_accesses++; + } else { + ok = false; + } + break; + case SpvOpLoad: + if (!CheckLoad(user, index)) ok = false; + stats->num_full_accesses++; + break; + case SpvOpStore: + if (!CheckStore(user, index)) ok = false; + stats->num_full_accesses++; + break; + case SpvOpName: + case SpvOpMemberName: + break; + default: + ok = false; + break; + } + } + }); + + return ok; +} + +bool ScalarReplacementPass::CheckUsesRelaxed(const Instruction* inst) const { + bool ok = true; + get_def_use_mgr()->ForEachUse( + inst, [this, &ok](const Instruction* user, uint32_t index) { + switch (user->opcode()) { + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + if (index != 2u) { + ok = false; + } else { + if (!CheckUsesRelaxed(user)) ok = false; + } + break; + case SpvOpLoad: + if (!CheckLoad(user, index)) ok = false; + break; + case SpvOpStore: + if (!CheckStore(user, index)) ok = false; + break; + default: + ok = false; + break; + } + }); + + return ok; +} + +bool ScalarReplacementPass::CheckLoad(const Instruction* inst, + uint32_t index) const { + if (index != 2u) return false; + if (inst->NumInOperands() >= 2 && + inst->GetSingleWordInOperand(1u) & SpvMemoryAccessVolatileMask) + return false; + return true; +} + +bool ScalarReplacementPass::CheckStore(const Instruction* inst, + uint32_t index) const { + if (index != 0u) return false; + if (inst->NumInOperands() >= 3 && + inst->GetSingleWordInOperand(2u) & SpvMemoryAccessVolatileMask) + return false; + return true; +} +bool ScalarReplacementPass::IsLargerThanSizeLimit(size_t length) const { + if (max_num_elements_ == 0) { + return false; + } + return length > max_num_elements_; +} + +std::unique_ptr> +ScalarReplacementPass::GetUsedComponents(Instruction* inst) { + std::unique_ptr> result( + new std::unordered_set()); + + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + def_use_mgr->WhileEachUser(inst, [&result, def_use_mgr, + this](Instruction* use) { + switch (use->opcode()) { + case SpvOpLoad: { + // Look for extract from the load. + std::vector t; + if (def_use_mgr->WhileEachUser(use, [&t](Instruction* use2) { + if (use2->opcode() != SpvOpCompositeExtract) { + return false; + } + t.push_back(use2->GetSingleWordInOperand(1)); + return true; + })) { + result->insert(t.begin(), t.end()); + return true; + } else { + result.reset(nullptr); + return false; + } + } + case SpvOpStore: + // No components are used. Things are just stored to. + return true; + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: { + // Add the first index it if is a constant. + // TODO: Could be improved by checking if the address is used in a load. + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + uint32_t index_id = use->GetSingleWordInOperand(1); + const analysis::Constant* index_const = + const_mgr->FindDeclaredConstant(index_id); + if (index_const) { + const analysis::Integer* index_type = + index_const->type()->AsInteger(); + assert(index_type); + if (index_type->width() == 32) { + result->insert(index_const->GetU32()); + return true; + } else if (index_type->width() == 64) { + result->insert(index_const->GetU64()); + return true; + } + result.reset(nullptr); + return false; + } else { + // Could be any element. Assuming all are used. + result.reset(nullptr); + return false; + } + } + case SpvOpCopyObject: { + // Follow the copy to see which components are used. + auto t = GetUsedComponents(use); + if (!t) { + result.reset(nullptr); + return false; + } + result->insert(t->begin(), t->end()); + return true; + } + default: + // We do not know what is happening. Have to assume the worst. + result.reset(nullptr); + return false; + } + }); + + return result; +} + +Instruction* ScalarReplacementPass::CreateNullConstant(uint32_t type_id) { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::ConstantManager* const_mgr = context()->get_constant_mgr(); + + const analysis::Type* type = type_mgr->GetType(type_id); + const analysis::Constant* null_const = const_mgr->GetConstant(type, {}); + Instruction* null_inst = + const_mgr->GetDefiningInstruction(null_const, type_id); + context()->UpdateDefUse(null_inst); + return null_inst; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h new file mode 100644 index 00000000000..c89bbc40159 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/scalar_replacement_pass.h @@ -0,0 +1,232 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_SCALAR_REPLACEMENT_PASS_H_ +#define SOURCE_OPT_SCALAR_REPLACEMENT_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/function.h" +#include "source/opt/pass.h" +#include "source/opt/type_manager.h" + +namespace spvtools { +namespace opt { + +// Documented in optimizer.hpp +class ScalarReplacementPass : public Pass { + private: + static const uint32_t kDefaultLimit = 100; + + public: + ScalarReplacementPass(uint32_t limit = kDefaultLimit) + : max_num_elements_(limit) { + name_[0] = '\0'; + strcat(name_, "scalar-replacement="); + sprintf(&name_[strlen(name_)], "%d", max_num_elements_); + } + + const char* name() const override { return name_; } + + // Attempts to scalarize all appropriate function scope variables. Returns + // SuccessWithChange if any change is made. + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisNameMap; + } + + private: + // Small container for tracking statistics about variables. + // + // TODO(alanbaker): Develop some useful heuristics to tune this pass. + struct VariableStats { + uint32_t num_partial_accesses; + uint32_t num_full_accesses; + }; + + // Attempts to scalarize all appropriate function scope variables in + // |function|. Returns SuccessWithChange if any changes are mode. + Status ProcessFunction(Function* function); + + // Returns true if |varInst| can be scalarized. + // + // Examines the use chain of |varInst| to verify all uses are valid for + // scalarization. + bool CanReplaceVariable(const Instruction* varInst) const; + + // Returns true if |typeInst| is an acceptable type to scalarize. + // + // Allows all aggregate types except runtime arrays. Additionally, checks the + // that the number of elements that would be scalarized is within bounds. + bool CheckType(const Instruction* typeInst) const; + + // Returns true if all the decorations for |varInst| are acceptable for + // scalarization. + bool CheckAnnotations(const Instruction* varInst) const; + + // Returns true if all the decorations for |typeInst| are acceptable for + // scalarization. + bool CheckTypeAnnotations(const Instruction* typeInst) const; + + // Returns true if the uses of |inst| are acceptable for scalarization. + // + // Recursively checks all the uses of |inst|. For |inst| specifically, only + // allows SpvOpAccessChain, SpvOpInBoundsAccessChain, SpvOpLoad and + // SpvOpStore. Access chains must have the first index be a compile-time + // constant. Subsequent uses of access chains (including other access chains) + // are checked in a more relaxed manner. + bool CheckUses(const Instruction* inst) const; + + // Helper function for the above |CheckUses|. + // + // This version tracks some stats about the current OpVariable. These stats + // are used to drive heuristics about when to scalarize. + bool CheckUses(const Instruction* inst, VariableStats* stats) const; + + // Relaxed helper function for |CheckUses|. + bool CheckUsesRelaxed(const Instruction* inst) const; + + // Transfers appropriate decorations from |source| to |replacements|. + void TransferAnnotations(const Instruction* source, + std::vector* replacements); + + // Scalarizes |inst| and updates its uses. + // + // |inst| must be an OpVariable. It is replaced with an OpVariable for each + // for element of the composite type. Uses of |inst| are updated as + // appropriate. If the replacement variables are themselves scalarizable, they + // get added to |worklist| for further processing. If any replacement + // variable ends up with no uses it is erased. Returns false if any + // subsequent access chain is out of bounds. + bool ReplaceVariable(Instruction* inst, std::queue* worklist); + + // Returns the underlying storage type for |inst|. + // + // |inst| must be an OpVariable. Returns the type that is pointed to by + // |inst|. + Instruction* GetStorageType(const Instruction* inst) const; + + // Returns true if the load can be scalarized. + // + // |inst| must be an OpLoad. Returns true if |index| is the pointer operand of + // |inst| and the load is not from volatile memory. + bool CheckLoad(const Instruction* inst, uint32_t index) const; + + // Returns true if the store can be scalarized. + // + // |inst| must be an OpStore. Returns true if |index| is the pointer operand + // of |inst| and the store is not to volatile memory. + bool CheckStore(const Instruction* inst, uint32_t index) const; + + // Creates a variable of type |typeId| from the |index|'th element of + // |varInst|. The new variable is added to |replacements|. + void CreateVariable(uint32_t typeId, Instruction* varInst, uint32_t index, + std::vector* replacements); + + // Populates |replacements| with a new OpVariable for each element of |inst|. + // + // |inst| must be an OpVariable of a composite type. New variables are + // initialized the same as the corresponding index in |inst|. |replacements| + // will contain a variable for each element of the composite with matching + // indexes (i.e. the 0'th element of |inst| is the 0'th entry of + // |replacements|). + void CreateReplacementVariables(Instruction* inst, + std::vector* replacements); + + // Returns the value of an OpConstant of integer type. + // + // |constant| must use two or fewer words to generate the value. + size_t GetConstantInteger(const Instruction* constant) const; + + // Returns the integer literal for |op|. + size_t GetIntegerLiteral(const Operand& op) const; + + // Returns the array length for |arrayInst|. + size_t GetArrayLength(const Instruction* arrayInst) const; + + // Returns the number of elements in |type|. + // + // |type| must be a vector or matrix type. + size_t GetNumElements(const Instruction* type) const; + + // Returns an id for a pointer to |id|. + uint32_t GetOrCreatePointerType(uint32_t id); + + // Creates the initial value for the |index| element of |source| in |newVar|. + // + // If there is an initial value for |source| for element |index|, it is + // appended as an operand on |newVar|. If the initial value is OpUndef, no + // initial value is added to |newVar|. + void GetOrCreateInitialValue(Instruction* source, uint32_t index, + Instruction* newVar); + + // Replaces the load to the entire composite. + // + // Generates a load for each replacement variable and then creates a new + // composite by combining all of the loads. + // + // |load| must be a load. + void ReplaceWholeLoad(Instruction* load, + const std::vector& replacements); + + // Replaces the store to the entire composite. + // + // Generates a composite extract and store for each element in the scalarized + // variable from the original store data input. + void ReplaceWholeStore(Instruction* store, + const std::vector& replacements); + + // Replaces an access chain to the composite variable with either a direct use + // of the appropriate replacement variable or another access chain with the + // replacement variable as the base and one fewer indexes. Returns false if + // the chain has an out of bounds access. + bool ReplaceAccessChain(Instruction* chain, + const std::vector& replacements); + + // Returns a set containing the which components of the result of |inst| are + // potentially used. If the return value is |nullptr|, then every components + // is possibly used. + std::unique_ptr> GetUsedComponents( + Instruction* inst); + + // Returns an instruction defining a null constant with type |type_id|. If + // one already exists, it is returned. Otherwise a new one is created. + Instruction* CreateNullConstant(uint32_t type_id); + + // Maps storage type to a pointer type enclosing that type. + std::unordered_map pointee_to_pointer_; + + // Maps type id to OpConstantNull for that type. + std::unordered_map type_to_null_; + + // Limit on the number of members in an object that will be replaced. + // 0 means there is no limit. + uint32_t max_num_elements_; + bool IsLargerThanSizeLimit(size_t length) const; + char name_[55]; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_SCALAR_REPLACEMENT_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp new file mode 100644 index 00000000000..4c8d116f763 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp @@ -0,0 +1,368 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/set_spec_constant_default_value_pass.h" + +#include +#include +#include +#include +#include + +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/type_manager.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" +#include "source/util/parse_number.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace opt { + +namespace { +using utils::EncodeNumberStatus; +using utils::NumberType; +using utils::ParseAndEncodeNumber; +using utils::ParseNumber; + +// Given a numeric value in a null-terminated c string and the expected type of +// the value, parses the string and encodes it in a vector of words. If the +// value is a scalar integer or floating point value, encodes the value in +// SPIR-V encoding format. If the value is 'false' or 'true', returns a vector +// with single word with value 0 or 1 respectively. Returns the vector +// containing the encoded value on success. Otherwise returns an empty vector. +std::vector ParseDefaultValueStr(const char* text, + const analysis::Type* type) { + std::vector result; + if (!strcmp(text, "true") && type->AsBool()) { + result.push_back(1u); + } else if (!strcmp(text, "false") && type->AsBool()) { + result.push_back(0u); + } else { + NumberType number_type = {32, SPV_NUMBER_UNSIGNED_INT}; + if (const auto* IT = type->AsInteger()) { + number_type.bitwidth = IT->width(); + number_type.kind = + IT->IsSigned() ? SPV_NUMBER_SIGNED_INT : SPV_NUMBER_UNSIGNED_INT; + } else if (const auto* FT = type->AsFloat()) { + number_type.bitwidth = FT->width(); + number_type.kind = SPV_NUMBER_FLOATING; + } else { + // Does not handle types other then boolean, integer or float. Returns + // empty vector. + result.clear(); + return result; + } + EncodeNumberStatus rc = ParseAndEncodeNumber( + text, number_type, [&result](uint32_t word) { result.push_back(word); }, + nullptr); + // Clear the result vector on failure. + if (rc != EncodeNumberStatus::kSuccess) { + result.clear(); + } + } + return result; +} + +// Given a bit pattern and a type, checks if the bit pattern is compatible +// with the type. If so, returns the bit pattern, otherwise returns an empty +// bit pattern. If the given bit pattern is empty, returns an empty bit +// pattern. If the given type represents a SPIR-V Boolean type, the bit pattern +// to be returned is determined with the following standard: +// If any words in the input bit pattern are non zero, returns a bit pattern +// with 0x1, which represents a 'true'. +// If all words in the bit pattern are zero, returns a bit pattern with 0x0, +// which represents a 'false'. +std::vector ParseDefaultValueBitPattern( + const std::vector& input_bit_pattern, + const analysis::Type* type) { + std::vector result; + if (type->AsBool()) { + if (std::any_of(input_bit_pattern.begin(), input_bit_pattern.end(), + [](uint32_t i) { return i != 0; })) { + result.push_back(1u); + } else { + result.push_back(0u); + } + return result; + } else if (const auto* IT = type->AsInteger()) { + if (IT->width() == input_bit_pattern.size() * sizeof(uint32_t) * 8) { + return std::vector(input_bit_pattern); + } + } else if (const auto* FT = type->AsFloat()) { + if (FT->width() == input_bit_pattern.size() * sizeof(uint32_t) * 8) { + return std::vector(input_bit_pattern); + } + } + result.clear(); + return result; +} + +// Returns true if the given instruction's result id could have a SpecId +// decoration. +bool CanHaveSpecIdDecoration(const Instruction& inst) { + switch (inst.opcode()) { + case SpvOp::SpvOpSpecConstant: + case SpvOp::SpvOpSpecConstantFalse: + case SpvOp::SpvOpSpecConstantTrue: + return true; + default: + return false; + } +} + +// Given a decoration group defining instruction that is decorated with SpecId +// decoration, finds the spec constant defining instruction which is the real +// target of the SpecId decoration. Returns the spec constant defining +// instruction if such an instruction is found, otherwise returns a nullptr. +Instruction* GetSpecIdTargetFromDecorationGroup( + const Instruction& decoration_group_defining_inst, + analysis::DefUseManager* def_use_mgr) { + // Find the OpGroupDecorate instruction which consumes the given decoration + // group. Note that the given decoration group has SpecId decoration, which + // is unique for different spec constants. So the decoration group cannot be + // consumed by different OpGroupDecorate instructions. Therefore we only need + // the first OpGroupDecoration instruction that uses the given decoration + // group. + Instruction* group_decorate_inst = nullptr; + if (def_use_mgr->WhileEachUser(&decoration_group_defining_inst, + [&group_decorate_inst](Instruction* user) { + if (user->opcode() == + SpvOp::SpvOpGroupDecorate) { + group_decorate_inst = user; + return false; + } + return true; + })) + return nullptr; + + // Scan through the target ids of the OpGroupDecorate instruction. There + // should be only one spec constant target consumes the SpecId decoration. + // If multiple target ids are presented in the OpGroupDecorate instruction, + // they must be the same one that defined by an eligible spec constant + // instruction. If the OpGroupDecorate instruction has different target ids + // or a target id is not defined by an eligible spec cosntant instruction, + // returns a nullptr. + Instruction* target_inst = nullptr; + for (uint32_t i = 1; i < group_decorate_inst->NumInOperands(); i++) { + // All the operands of a OpGroupDecorate instruction should be of type + // SPV_OPERAND_TYPE_ID. + uint32_t candidate_id = group_decorate_inst->GetSingleWordInOperand(i); + Instruction* candidate_inst = def_use_mgr->GetDef(candidate_id); + + if (!candidate_inst) { + continue; + } + + if (!target_inst) { + // If the spec constant target has not been found yet, check if the + // candidate instruction is the target. + if (CanHaveSpecIdDecoration(*candidate_inst)) { + target_inst = candidate_inst; + } else { + // Spec id decoration should not be applied on other instructions. + // TODO(qining): Emit an error message in the invalid case once the + // error handling is done. + return nullptr; + } + } else { + // If the spec constant target has been found, check if the candidate + // instruction is the same one as the target. The module is invalid if + // the candidate instruction is different with the found target. + // TODO(qining): Emit an error messaage in the invalid case once the + // error handling is done. + if (candidate_inst != target_inst) return nullptr; + } + } + return target_inst; +} +} // namespace + +Pass::Status SetSpecConstantDefaultValuePass::Process() { + // The operand index of decoration target in an OpDecorate instruction. + const uint32_t kTargetIdOperandIndex = 0; + // The operand index of the decoration literal in an OpDecorate instruction. + const uint32_t kDecorationOperandIndex = 1; + // The operand index of Spec id literal value in an OpDecorate SpecId + // instruction. + const uint32_t kSpecIdLiteralOperandIndex = 2; + // The number of operands in an OpDecorate SpecId instruction. + const uint32_t kOpDecorateSpecIdNumOperands = 3; + // The in-operand index of the default value in a OpSpecConstant instruction. + const uint32_t kOpSpecConstantLiteralInOperandIndex = 0; + + bool modified = false; + // Scan through all the annotation instructions to find 'OpDecorate SpecId' + // instructions. Then extract the decoration target of those instructions. + // The decoration targets should be spec constant defining instructions with + // opcode: OpSpecConstant{|True|False}. The spec id of those spec constants + // will be used to look up their new default values in the mapping from + // spec id to new default value strings. Once a new default value string + // is found for a spec id, the string will be parsed according to the target + // spec constant type. The parsed value will be used to replace the original + // default value of the target spec constant. + for (Instruction& inst : context()->annotations()) { + // Only process 'OpDecorate SpecId' instructions + if (inst.opcode() != SpvOp::SpvOpDecorate) continue; + if (inst.NumOperands() != kOpDecorateSpecIdNumOperands) continue; + if (inst.GetSingleWordInOperand(kDecorationOperandIndex) != + uint32_t(SpvDecoration::SpvDecorationSpecId)) { + continue; + } + + // 'inst' is an OpDecorate SpecId instruction. + uint32_t spec_id = inst.GetSingleWordOperand(kSpecIdLiteralOperandIndex); + uint32_t target_id = inst.GetSingleWordOperand(kTargetIdOperandIndex); + + // Find the spec constant defining instruction. Note that the + // target_id might be a decoration group id. + Instruction* spec_inst = nullptr; + if (Instruction* target_inst = get_def_use_mgr()->GetDef(target_id)) { + if (target_inst->opcode() == SpvOp::SpvOpDecorationGroup) { + spec_inst = + GetSpecIdTargetFromDecorationGroup(*target_inst, get_def_use_mgr()); + } else { + spec_inst = target_inst; + } + } else { + continue; + } + if (!spec_inst) continue; + + // Get the default value bit pattern for this spec id. + std::vector bit_pattern; + + if (spec_id_to_value_str_.size() != 0) { + // Search for the new string-form default value for this spec id. + auto iter = spec_id_to_value_str_.find(spec_id); + if (iter == spec_id_to_value_str_.end()) { + continue; + } + + // Gets the string of the default value and parses it to bit pattern + // with the type of the spec constant. + const std::string& default_value_str = iter->second; + bit_pattern = ParseDefaultValueStr( + default_value_str.c_str(), + context()->get_type_mgr()->GetType(spec_inst->type_id())); + + } else { + // Search for the new bit-pattern-form default value for this spec id. + auto iter = spec_id_to_value_bit_pattern_.find(spec_id); + if (iter == spec_id_to_value_bit_pattern_.end()) { + continue; + } + + // Gets the bit-pattern of the default value from the map directly. + bit_pattern = ParseDefaultValueBitPattern( + iter->second, + context()->get_type_mgr()->GetType(spec_inst->type_id())); + } + + if (bit_pattern.empty()) continue; + + // Update the operand bit patterns of the spec constant defining + // instruction. + switch (spec_inst->opcode()) { + case SpvOp::SpvOpSpecConstant: + // If the new value is the same with the original value, no + // need to do anything. Otherwise update the operand words. + if (spec_inst->GetInOperand(kOpSpecConstantLiteralInOperandIndex) + .words != bit_pattern) { + spec_inst->SetInOperand(kOpSpecConstantLiteralInOperandIndex, + std::move(bit_pattern)); + modified = true; + } + break; + case SpvOp::SpvOpSpecConstantTrue: + // If the new value is also 'true', no need to change anything. + // Otherwise, set the opcode to OpSpecConstantFalse; + if (!static_cast(bit_pattern.front())) { + spec_inst->SetOpcode(SpvOp::SpvOpSpecConstantFalse); + modified = true; + } + break; + case SpvOp::SpvOpSpecConstantFalse: + // If the new value is also 'false', no need to change anything. + // Otherwise, set the opcode to OpSpecConstantTrue; + if (static_cast(bit_pattern.front())) { + spec_inst->SetOpcode(SpvOp::SpvOpSpecConstantTrue); + modified = true; + } + break; + default: + break; + } + // No need to update the DefUse manager, as this pass does not change any + // ids. + } + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +// Returns true if the given char is ':', '\0' or considered as blank space +// (i.e.: '\n', '\r', '\v', '\t', '\f' and ' '). +bool IsSeparator(char ch) { + return std::strchr(":\0", ch) || std::isspace(ch) != 0; +} + +std::unique_ptr +SetSpecConstantDefaultValuePass::ParseDefaultValuesString(const char* str) { + if (!str) return nullptr; + + auto spec_id_to_value = MakeUnique(); + + // The parsing loop, break when points to the end. + while (*str) { + // Find the spec id. + while (std::isspace(*str)) str++; // skip leading spaces. + const char* entry_begin = str; + while (!IsSeparator(*str)) str++; + const char* entry_end = str; + std::string spec_id_str(entry_begin, entry_end - entry_begin); + uint32_t spec_id = 0; + if (!ParseNumber(spec_id_str.c_str(), &spec_id)) { + // The spec id is not a valid uint32 number. + return nullptr; + } + auto iter = spec_id_to_value->find(spec_id); + if (iter != spec_id_to_value->end()) { + // Same spec id has been defined before + return nullptr; + } + // Find the ':', spaces between the spec id and the ':' are not allowed. + if (*str++ != ':') { + // ':' not found + return nullptr; + } + // Find the value string + const char* val_begin = str; + while (!IsSeparator(*str)) str++; + const char* val_end = str; + if (val_end == val_begin) { + // Value string is empty. + return nullptr; + } + // Update the mapping with spec id and value string. + (*spec_id_to_value)[spec_id] = std::string(val_begin, val_end - val_begin); + + // Skip trailing spaces. + while (std::isspace(*str)) str++; + } + + return spec_id_to_value; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.h new file mode 100644 index 00000000000..8bd1787cc26 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/set_spec_constant_default_value_pass.h @@ -0,0 +1,114 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ +#define SOURCE_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class SetSpecConstantDefaultValuePass : public Pass { + public: + using SpecIdToValueStrMap = std::unordered_map; + using SpecIdToValueBitPatternMap = + std::unordered_map>; + using SpecIdToInstMap = std::unordered_map; + + // Constructs a pass instance with a map from spec ids to default values + // in the form of string. + explicit SetSpecConstantDefaultValuePass( + const SpecIdToValueStrMap& default_values) + : spec_id_to_value_str_(default_values), + spec_id_to_value_bit_pattern_() {} + explicit SetSpecConstantDefaultValuePass(SpecIdToValueStrMap&& default_values) + : spec_id_to_value_str_(std::move(default_values)), + spec_id_to_value_bit_pattern_() {} + + // Constructs a pass instance with a map from spec ids to default values in + // the form of bit pattern. + explicit SetSpecConstantDefaultValuePass( + const SpecIdToValueBitPatternMap& default_values) + : spec_id_to_value_str_(), + spec_id_to_value_bit_pattern_(default_values) {} + explicit SetSpecConstantDefaultValuePass( + SpecIdToValueBitPatternMap&& default_values) + : spec_id_to_value_str_(), + spec_id_to_value_bit_pattern_(std::move(default_values)) {} + + const char* name() const override { return "set-spec-const-default-value"; } + Status Process() override; + + // Parses the given null-terminated C string to get a mapping from Spec Id to + // default value strings. Returns a unique pointer of the mapping from spec + // ids to spec constant default value strings built from the given |str| on + // success. Returns a nullptr if the given string is not valid for building + // the mapping. + // A valid string for building the mapping should follow the rule below: + // + // ": : ..." + // Example: + // "200:0x11 201:3.14 202:1.4728" + // + // Entries are separated with blank spaces (i.e.:' ', '\n', '\r', '\t', + // '\f', '\v'). Each entry corresponds to a Spec Id and default value pair. + // Multiple spaces between, before or after entries are allowed. However, + // spaces are not allowed within spec id or the default value string because + // spaces are always considered as delimiter to separate entries. + // + // In each entry, the spec id and value string is separated by ':'. Missing + // ':' in any entry is invalid. And it is invalid to have blank spaces in + // between the spec id and ':' or the default value and ':'. + // + // : specifies the spec id value. + // The text must represent a valid uint32_t number. + // Hex format with '0x' prefix is allowed. + // Empty is not allowed. + // One spec id value can only be defined once, multiple default values + // defined for the same spec id is not allowed. Spec ids with same value + // but different formats (e.g. 0x100 and 256) are considered the same. + // + // : the default value string. + // Spaces before and after default value text is allowed. + // Spaces within the text is not allowed. + // Empty is not allowed. + static std::unique_ptr ParseDefaultValuesString( + const char* str); + + private: + // The mappings from spec ids to default values. Two maps are defined here, + // each to be used for one specific form of the default values. Only one of + // them will be populated in practice. + + // The mapping from spec ids to their string-form default values to be set. + const SpecIdToValueStrMap spec_id_to_value_str_; + // The mapping from spec ids to their bitpattern-form default values to be + // set. + const SpecIdToValueBitPatternMap spec_id_to_value_bit_pattern_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_SET_SPEC_CONSTANT_DEFAULT_VALUE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp new file mode 100644 index 00000000000..5fbafbdd1cc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.cpp @@ -0,0 +1,120 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/simplification_pass.h" + +#include +#include +#include + +#include "source/opt/fold.h" + +namespace spvtools { +namespace opt { + +Pass::Status SimplificationPass::Process() { + bool modified = false; + + for (Function& function : *get_module()) { + modified |= SimplifyFunction(&function); + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool SimplificationPass::SimplifyFunction(Function* function) { + bool modified = false; + // Phase 1: Traverse all instructions in dominance order. + // The second phase will only be on the instructions whose inputs have changed + // after being processed during phase 1. Since OpPhi instructions are the + // only instructions whose inputs do not necessarily dominate the use, we keep + // track of the OpPhi instructions already seen, and add them to the work list + // for phase 2 when needed. + std::vector work_list; + std::unordered_set process_phis; + std::unordered_set inst_to_kill; + std::unordered_set in_work_list; + const InstructionFolder& folder = context()->get_instruction_folder(); + + cfg()->ForEachBlockInReversePostOrder( + function->entry().get(), + [&modified, &process_phis, &work_list, &in_work_list, &inst_to_kill, + folder, this](BasicBlock* bb) { + for (Instruction* inst = &*bb->begin(); inst; inst = inst->NextNode()) { + if (inst->opcode() == SpvOpPhi) { + process_phis.insert(inst); + } + + if (inst->opcode() == SpvOpCopyObject || + folder.FoldInstruction(inst)) { + modified = true; + context()->AnalyzeUses(inst); + get_def_use_mgr()->ForEachUser(inst, [&work_list, &process_phis, + &in_work_list]( + Instruction* use) { + if (process_phis.count(use) && in_work_list.insert(use).second) { + work_list.push_back(use); + } + }); + if (inst->opcode() == SpvOpCopyObject) { + context()->ReplaceAllUsesWith(inst->result_id(), + inst->GetSingleWordInOperand(0)); + inst_to_kill.insert(inst); + in_work_list.insert(inst); + } else if (inst->opcode() == SpvOpNop) { + inst_to_kill.insert(inst); + in_work_list.insert(inst); + } + } + } + }); + + // Phase 2: process the instructions in the work list until all of the work is + // done. This time we add all users to the work list because phase 1 + // has already finished. + for (size_t i = 0; i < work_list.size(); ++i) { + Instruction* inst = work_list[i]; + in_work_list.erase(inst); + if (inst->opcode() == SpvOpCopyObject || folder.FoldInstruction(inst)) { + modified = true; + context()->AnalyzeUses(inst); + get_def_use_mgr()->ForEachUser( + inst, [&work_list, &in_work_list](Instruction* use) { + if (!use->IsDecoration() && use->opcode() != SpvOpName && + in_work_list.insert(use).second) { + work_list.push_back(use); + } + }); + + if (inst->opcode() == SpvOpCopyObject) { + context()->ReplaceAllUsesWith(inst->result_id(), + inst->GetSingleWordInOperand(0)); + inst_to_kill.insert(inst); + in_work_list.insert(inst); + } else if (inst->opcode() == SpvOpNop) { + inst_to_kill.insert(inst); + in_work_list.insert(inst); + } + } + } + + // Phase 3: Kill instructions we know are no longer needed. + for (Instruction* inst : inst_to_kill) { + context()->KillInst(inst); + } + + return modified; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.h new file mode 100644 index 00000000000..348c96a0330 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/simplification_pass.h @@ -0,0 +1,49 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_SIMPLIFICATION_PASS_H_ +#define SOURCE_OPT_SIMPLIFICATION_PASS_H_ + +#include "source/opt/function.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class SimplificationPass : public Pass { + public: + const char* name() const override { return "simplify-instructions"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisDecorations | IRContext::kAnalysisCombinators | + IRContext::kAnalysisCFG | IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisNameMap; + } + + private: + // Returns true if the module was changed. The simplifier is called on every + // instruction in |function| until nothing else in the function can be + // simplified. + bool SimplifyFunction(Function* function); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_SIMPLIFICATION_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp new file mode 100644 index 00000000000..83d24331116 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.cpp @@ -0,0 +1,585 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file implements the SSA rewriting algorithm proposed in +// +// Simple and Efficient Construction of Static Single Assignment Form. +// Braun M., Buchwald S., Hack S., Leißa R., Mallon C., Zwinkau A. (2013) +// In: Jhala R., De Bosschere K. (eds) +// Compiler Construction. CC 2013. +// Lecture Notes in Computer Science, vol 7791. +// Springer, Berlin, Heidelberg +// +// https://link.springer.com/chapter/10.1007/978-3-642-37051-9_6 +// +// In contrast to common eager algorithms based on dominance and dominance +// frontier information, this algorithm works backwards from load operations. +// +// When a target variable is loaded, it queries the variable's reaching +// definition. If the reaching definition is unknown at the current location, +// it searches backwards in the CFG, inserting Phi instructions at join points +// in the CFG along the way until it finds the desired store instruction. +// +// The algorithm avoids repeated lookups using memoization. +// +// For reducible CFGs, which are a superset of the structured CFGs in SPIRV, +// this algorithm is proven to produce minimal SSA. That is, it inserts the +// minimal number of Phi instructions required to ensure the SSA property, but +// some Phi instructions may be dead +// (https://en.wikipedia.org/wiki/Static_single_assignment_form). + +#include "source/opt/ssa_rewrite_pass.h" + +#include +#include + +#include "source/opcode.h" +#include "source/opt/cfg.h" +#include "source/opt/mem_pass.h" +#include "source/util/make_unique.h" + +// Debug logging (0: Off, 1-N: Verbosity level). Replace this with the +// implementation done for +// https://github.com/KhronosGroup/SPIRV-Tools/issues/1351 +// #define SSA_REWRITE_DEBUGGING_LEVEL 3 + +#ifdef SSA_REWRITE_DEBUGGING_LEVEL +#include +#else +#define SSA_REWRITE_DEBUGGING_LEVEL 0 +#endif + +namespace spvtools { +namespace opt { + +namespace { +const uint32_t kStoreValIdInIdx = 1; +const uint32_t kVariableInitIdInIdx = 1; +} // namespace + +std::string SSARewriter::PhiCandidate::PrettyPrint(const CFG* cfg) const { + std::ostringstream str; + str << "%" << result_id_ << " = Phi[%" << var_id_ << ", BB %" << bb_->id() + << "]("; + if (phi_args_.size() > 0) { + uint32_t arg_ix = 0; + for (uint32_t pred_label : cfg->preds(bb_->id())) { + uint32_t arg_id = phi_args_[arg_ix++]; + str << "[%" << arg_id << ", bb(%" << pred_label << ")] "; + } + } + str << ")"; + if (copy_of_ != 0) { + str << " [COPY OF " << copy_of_ << "]"; + } + str << ((is_complete_) ? " [COMPLETE]" : " [INCOMPLETE]"); + + return str.str(); +} + +SSARewriter::PhiCandidate& SSARewriter::CreatePhiCandidate(uint32_t var_id, + BasicBlock* bb) { + uint32_t phi_result_id = pass_->context()->TakeNextId(); + auto result = phi_candidates_.emplace( + phi_result_id, PhiCandidate(var_id, phi_result_id, bb)); + PhiCandidate& phi_candidate = result.first->second; + return phi_candidate; +} + +void SSARewriter::ReplacePhiUsersWith(const PhiCandidate& phi_to_remove, + uint32_t repl_id) { + for (uint32_t user_id : phi_to_remove.users()) { + PhiCandidate* user_phi = GetPhiCandidate(user_id); + if (user_phi) { + // If the user is a Phi candidate, replace all arguments that refer to + // |phi_to_remove.result_id()| with |repl_id|. + for (uint32_t& arg : user_phi->phi_args()) { + if (arg == phi_to_remove.result_id()) { + arg = repl_id; + } + } + } else { + // For regular loads, traverse the |load_replacement_| table looking for + // instances of |phi_to_remove|. + for (auto& it : load_replacement_) { + if (it.second == phi_to_remove.result_id()) { + it.second = repl_id; + } + } + } + } +} + +uint32_t SSARewriter::TryRemoveTrivialPhi(PhiCandidate* phi_candidate) { + uint32_t same_id = 0; + for (uint32_t arg_id : phi_candidate->phi_args()) { + if (arg_id == same_id || arg_id == phi_candidate->result_id()) { + // This is a self-reference operand or a reference to the same value ID. + continue; + } + if (same_id != 0) { + // This Phi candidate merges at least two values. Therefore, it is not + // trivial. + assert(phi_candidate->copy_of() == 0 && + "Phi candidate transitioning from copy to non-copy."); + return phi_candidate->result_id(); + } + same_id = arg_id; + } + + // The previous logic has determined that this Phi candidate |phi_candidate| + // is trivial. It is essentially the copy operation phi_candidate->phi_result + // = Phi(same, same, same, ...). Since it is not necessary, we can re-route + // all the users of |phi_candidate->phi_result| to all its users, and remove + // |phi_candidate|. + + // Mark the Phi candidate as a trivial copy of |same_id|, so it won't be + // generated. + phi_candidate->MarkCopyOf(same_id); + + assert(same_id != 0 && "Completed Phis cannot have %0 in their arguments"); + + // Since |phi_candidate| always produces |same_id|, replace all the users of + // |phi_candidate| with |same_id|. + ReplacePhiUsersWith(*phi_candidate, same_id); + + return same_id; +} + +uint32_t SSARewriter::AddPhiOperands(PhiCandidate* phi_candidate) { + assert(phi_candidate->phi_args().size() == 0 && + "Phi candidate already has arguments"); + + bool found_0_arg = false; + for (uint32_t pred : pass_->cfg()->preds(phi_candidate->bb()->id())) { + BasicBlock* pred_bb = pass_->cfg()->block(pred); + + // If |pred_bb| is not sealed, use %0 to indicate that + // |phi_candidate| needs to be completed after the whole CFG has + // been processed. + // + // Note that we cannot call GetReachingDef() in these cases + // because this would generate an empty Phi candidate in + // |pred_bb|. When |pred_bb| is later processed, a new definition + // for |phi_candidate->var_id_| will be lost because + // |phi_candidate| will still be reached by the empty Phi. + // + // Consider: + // + // BB %23: + // %38 = Phi[%i](%int_0[%1], %39[%25]) + // + // ... + // + // BB %25: [Starts unsealed] + // %39 = Phi[%i]() + // %34 = ... + // OpStore %i %34 -> Currdef(%i) at %25 is %34 + // OpBranch %23 + // + // When we first create the Phi in %38, we add an operandless Phi in + // %39 to hold the unknown reaching def for %i. + // + // But then, when we go to complete %39 at the end. The reaching def + // for %i in %25's predecessor is %38 itself. So we miss the fact + // that %25 has a def for %i that should be used. + // + // By making the argument %0, we make |phi_candidate| incomplete, + // which will cause it to be completed after the whole CFG has + // been scanned. + uint32_t arg_id = IsBlockSealed(pred_bb) + ? GetReachingDef(phi_candidate->var_id(), pred_bb) + : 0; + phi_candidate->phi_args().push_back(arg_id); + + if (arg_id == 0) { + found_0_arg = true; + } else { + // If this argument is another Phi candidate, add |phi_candidate| to the + // list of users for the defining Phi. + PhiCandidate* defining_phi = GetPhiCandidate(arg_id); + if (defining_phi && defining_phi != phi_candidate) { + defining_phi->AddUser(phi_candidate->result_id()); + } + } + } + + // If we could not fill-in all the arguments of this Phi, mark it incomplete + // so it gets completed after the whole CFG has been processed. + if (found_0_arg) { + phi_candidate->MarkIncomplete(); + incomplete_phis_.push(phi_candidate); + return phi_candidate->result_id(); + } + + // Try to remove |phi_candidate|, if it's trivial. + uint32_t repl_id = TryRemoveTrivialPhi(phi_candidate); + if (repl_id == phi_candidate->result_id()) { + // |phi_candidate| is complete and not trivial. Add it to the + // list of Phi candidates to generate. + phi_candidate->MarkComplete(); + phis_to_generate_.push_back(phi_candidate); + } + + return repl_id; +} + +uint32_t SSARewriter::GetReachingDef(uint32_t var_id, BasicBlock* bb) { + // If |var_id| has a definition in |bb|, return it. + const auto& bb_it = defs_at_block_.find(bb); + if (bb_it != defs_at_block_.end()) { + const auto& current_defs = bb_it->second; + const auto& var_it = current_defs.find(var_id); + if (var_it != current_defs.end()) { + return var_it->second; + } + } + + // Otherwise, look up the value for |var_id| in |bb|'s predecessors. + uint32_t val_id = 0; + auto& predecessors = pass_->cfg()->preds(bb->id()); + if (predecessors.size() == 1) { + // If |bb| has exactly one predecessor, we look for |var_id|'s definition + // there. + val_id = GetReachingDef(var_id, pass_->cfg()->block(predecessors[0])); + } else if (predecessors.size() > 1) { + // If there is more than one predecessor, this is a join block which may + // require a Phi instruction. This will act as |var_id|'s current + // definition to break potential cycles. + PhiCandidate& phi_candidate = CreatePhiCandidate(var_id, bb); + WriteVariable(var_id, bb, phi_candidate.result_id()); + val_id = AddPhiOperands(&phi_candidate); + } + + // If we could not find a store for this variable in the path from the root + // of the CFG, the variable is not defined, so we use undef. + if (val_id == 0) { + val_id = pass_->GetUndefVal(var_id); + } + + WriteVariable(var_id, bb, val_id); + + return val_id; +} + +void SSARewriter::SealBlock(BasicBlock* bb) { + auto result = sealed_blocks_.insert(bb); + (void)result; + assert(result.second == true && + "Tried to seal the same basic block more than once."); +} + +void SSARewriter::ProcessStore(Instruction* inst, BasicBlock* bb) { + auto opcode = inst->opcode(); + assert((opcode == SpvOpStore || opcode == SpvOpVariable) && + "Expecting a store or a variable definition instruction."); + + uint32_t var_id = 0; + uint32_t val_id = 0; + if (opcode == SpvOpStore) { + (void)pass_->GetPtr(inst, &var_id); + val_id = inst->GetSingleWordInOperand(kStoreValIdInIdx); + } else if (inst->NumInOperands() >= 2) { + var_id = inst->result_id(); + val_id = inst->GetSingleWordInOperand(kVariableInitIdInIdx); + } + if (pass_->IsTargetVar(var_id)) { + WriteVariable(var_id, bb, val_id); + +#if SSA_REWRITE_DEBUGGING_LEVEL > 1 + std::cerr << "\tFound store '%" << var_id << " = %" << val_id << "': " + << inst->PrettyPrint(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) + << "\n"; +#endif + } +} + +void SSARewriter::ProcessLoad(Instruction* inst, BasicBlock* bb) { + uint32_t var_id = 0; + (void)pass_->GetPtr(inst, &var_id); + if (pass_->IsTargetVar(var_id)) { + // Get the immediate reaching definition for |var_id|. + uint32_t val_id = GetReachingDef(var_id, bb); + + // Schedule a replacement for the result of this load instruction with + // |val_id|. After all the rewriting decisions are made, every use of + // this load will be replaced with |val_id|. + const uint32_t load_id = inst->result_id(); + assert(load_replacement_.count(load_id) == 0); + load_replacement_[load_id] = val_id; + PhiCandidate* defining_phi = GetPhiCandidate(val_id); + if (defining_phi) { + defining_phi->AddUser(load_id); + } + +#if SSA_REWRITE_DEBUGGING_LEVEL > 1 + std::cerr << "\tFound load: " + << inst->PrettyPrint(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) + << " (replacement for %" << load_id << " is %" << val_id << ")\n"; +#endif + } +} + +void SSARewriter::PrintPhiCandidates() const { + std::cerr << "\nPhi candidates:\n"; + for (const auto& phi_it : phi_candidates_) { + std::cerr << "\tBB %" << phi_it.second.bb()->id() << ": " + << phi_it.second.PrettyPrint(pass_->cfg()) << "\n"; + } + std::cerr << "\n"; +} + +void SSARewriter::PrintReplacementTable() const { + std::cerr << "\nLoad replacement table\n"; + for (const auto& it : load_replacement_) { + std::cerr << "\t%" << it.first << " -> %" << it.second << "\n"; + } + std::cerr << "\n"; +} + +void SSARewriter::GenerateSSAReplacements(BasicBlock* bb) { +#if SSA_REWRITE_DEBUGGING_LEVEL > 1 + std::cerr << "Generating SSA replacements for block: " << bb->id() << "\n"; + std::cerr << bb->PrettyPrint(SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) + << "\n"; +#endif + + for (auto& inst : *bb) { + auto opcode = inst.opcode(); + if (opcode == SpvOpStore || opcode == SpvOpVariable) { + ProcessStore(&inst, bb); + } else if (inst.opcode() == SpvOpLoad) { + ProcessLoad(&inst, bb); + } + } + + // Seal |bb|. This means that all the stores in it have been scanned and it's + // ready to feed them into its successors. + SealBlock(bb); + +#if SSA_REWRITE_DEBUGGING_LEVEL > 1 + PrintPhiCandidates(); + PrintReplacementTable(); + std::cerr << "\n\n"; +#endif +} + +uint32_t SSARewriter::GetReplacement(std::pair repl) { + uint32_t val_id = repl.second; + auto it = load_replacement_.find(val_id); + while (it != load_replacement_.end()) { + val_id = it->second; + it = load_replacement_.find(val_id); + } + return val_id; +} + +uint32_t SSARewriter::GetPhiArgument(const PhiCandidate* phi_candidate, + uint32_t ix) { + assert(phi_candidate->IsReady() && + "Tried to get the final argument from an incomplete/trivial Phi"); + + uint32_t arg_id = phi_candidate->phi_args()[ix]; + while (arg_id != 0) { + PhiCandidate* phi_user = GetPhiCandidate(arg_id); + if (phi_user == nullptr || phi_user->IsReady()) { + // If the argument is not a Phi or it's a Phi candidate ready to be + // emitted, return it. + return arg_id; + } + arg_id = phi_user->copy_of(); + } + + assert(false && + "No Phi candidates in the copy-of chain are ready to be generated"); + + return 0; +} + +bool SSARewriter::ApplyReplacements() { + bool modified = false; + +#if SSA_REWRITE_DEBUGGING_LEVEL > 2 + std::cerr << "\n\nApplying replacement decisions to IR\n\n"; + PrintPhiCandidates(); + PrintReplacementTable(); + std::cerr << "\n\n"; +#endif + + // Add Phi instructions from completed Phi candidates. + std::vector generated_phis; + for (const PhiCandidate* phi_candidate : phis_to_generate_) { +#if SSA_REWRITE_DEBUGGING_LEVEL > 2 + std::cerr << "Phi candidate: " << phi_candidate->PrettyPrint(pass_->cfg()) + << "\n"; +#endif + + assert(phi_candidate->is_complete() && + "Tried to instantiate a Phi instruction from an incomplete Phi " + "candidate"); + + // Build the vector of operands for the new OpPhi instruction. + uint32_t type_id = pass_->GetPointeeTypeId( + pass_->get_def_use_mgr()->GetDef(phi_candidate->var_id())); + std::vector phi_operands; + uint32_t arg_ix = 0; + for (uint32_t pred_label : pass_->cfg()->preds(phi_candidate->bb()->id())) { + uint32_t op_val_id = GetPhiArgument(phi_candidate, arg_ix++); + phi_operands.push_back( + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {op_val_id}}); + phi_operands.push_back( + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {pred_label}}); + } + + // Generate a new OpPhi instruction and insert it in its basic + // block. + std::unique_ptr phi_inst( + new Instruction(pass_->context(), SpvOpPhi, type_id, + phi_candidate->result_id(), phi_operands)); + generated_phis.push_back(phi_inst.get()); + pass_->get_def_use_mgr()->AnalyzeInstDef(&*phi_inst); + pass_->context()->set_instr_block(&*phi_inst, phi_candidate->bb()); + auto insert_it = phi_candidate->bb()->begin(); + insert_it.InsertBefore(std::move(phi_inst)); + + pass_->context()->get_decoration_mgr()->CloneDecorations( + phi_candidate->var_id(), phi_candidate->result_id(), + {SpvDecorationRelaxedPrecision}); + + modified = true; + } + + // Scan uses for all inserted Phi instructions. Do this separately from the + // registration of the Phi instruction itself to avoid trying to analyze uses + // of Phi instructions that have not been registered yet. + for (Instruction* phi_inst : generated_phis) { + pass_->get_def_use_mgr()->AnalyzeInstUse(&*phi_inst); + } + +#if SSA_REWRITE_DEBUGGING_LEVEL > 1 + std::cerr << "\n\nReplacing the result of load instructions with the " + "corresponding SSA id\n\n"; +#endif + + // Apply replacements from the load replacement table. + for (auto& repl : load_replacement_) { + uint32_t load_id = repl.first; + uint32_t val_id = GetReplacement(repl); + Instruction* load_inst = + pass_->context()->get_def_use_mgr()->GetDef(load_id); + +#if SSA_REWRITE_DEBUGGING_LEVEL > 2 + std::cerr << "\t" + << load_inst->PrettyPrint( + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES) + << " (%" << load_id << " -> %" << val_id << ")\n"; +#endif + + // Remove the load instruction and replace all the uses of this load's + // result with |val_id|. Kill any names or decorates using the load's + // result before replacing to prevent incorrect replacement in those + // instructions. + pass_->context()->KillNamesAndDecorates(load_id); + pass_->context()->ReplaceAllUsesWith(load_id, val_id); + pass_->context()->KillInst(load_inst); + modified = true; + } + + return modified; +} + +void SSARewriter::FinalizePhiCandidate(PhiCandidate* phi_candidate) { + assert(phi_candidate->phi_args().size() > 0 && + "Phi candidate should have arguments"); + + uint32_t ix = 0; + for (uint32_t pred : pass_->cfg()->preds(phi_candidate->bb()->id())) { + BasicBlock* pred_bb = pass_->cfg()->block(pred); + uint32_t& arg_id = phi_candidate->phi_args()[ix++]; + if (arg_id == 0) { + // If |pred_bb| is still not sealed, it means it's unreachable. In this + // case, we just use Undef as an argument. + arg_id = IsBlockSealed(pred_bb) + ? GetReachingDef(phi_candidate->var_id(), pred_bb) + : pass_->GetUndefVal(phi_candidate->var_id()); + } + } + + // This candidate is now completed. + phi_candidate->MarkComplete(); + + // If |phi_candidate| is not trivial, add it to the list of Phis to generate. + if (TryRemoveTrivialPhi(phi_candidate) == phi_candidate->result_id()) { + // If we could not remove |phi_candidate|, it means that it is complete + // and not trivial. Add it to the list of Phis to generate. + assert(!phi_candidate->copy_of() && "A completed Phi cannot be trivial."); + phis_to_generate_.push_back(phi_candidate); + } +} + +void SSARewriter::FinalizePhiCandidates() { +#if SSA_REWRITE_DEBUGGING_LEVEL > 1 + std::cerr << "Finalizing Phi candidates:\n\n"; + PrintPhiCandidates(); + std::cerr << "\n"; +#endif + + // Now, complete the collected candidates. + while (incomplete_phis_.size() > 0) { + PhiCandidate* phi_candidate = incomplete_phis_.front(); + incomplete_phis_.pop(); + FinalizePhiCandidate(phi_candidate); + } +} + +bool SSARewriter::RewriteFunctionIntoSSA(Function* fp) { +#if SSA_REWRITE_DEBUGGING_LEVEL > 0 + std::cerr << "Function before SSA rewrite:\n" + << fp->PrettyPrint(0) << "\n\n\n"; +#endif + + // Collect variables that can be converted into SSA IDs. + pass_->CollectTargetVars(fp); + + // Generate all the SSA replacements and Phi candidates. This will + // generate incomplete and trivial Phis. + pass_->cfg()->ForEachBlockInReversePostOrder( + fp->entry().get(), + [this](BasicBlock* bb) { GenerateSSAReplacements(bb); }); + + // Remove trivial Phis and add arguments to incomplete Phis. + FinalizePhiCandidates(); + + // Finally, apply all the replacements in the IR. + bool modified = ApplyReplacements(); + +#if SSA_REWRITE_DEBUGGING_LEVEL > 0 + std::cerr << "\n\n\nFunction after SSA rewrite:\n" + << fp->PrettyPrint(0) << "\n"; +#endif + + return modified; +} + +Pass::Status SSARewritePass::Process() { + bool modified = false; + for (auto& fn : *get_module()) { + modified |= SSARewriter(this).RewriteFunctionIntoSSA(&fn); + } + return modified ? Pass::Status::SuccessWithChange + : Pass::Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.h new file mode 100644 index 00000000000..c0373dc0676 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/ssa_rewrite_pass.h @@ -0,0 +1,304 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_SSA_REWRITE_PASS_H_ +#define SOURCE_OPT_SSA_REWRITE_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "source/opt/basic_block.h" +#include "source/opt/ir_context.h" +#include "source/opt/mem_pass.h" + +namespace spvtools { +namespace opt { + +// Utility class for passes that need to rewrite a function into SSA. This +// converts load/store operations on function-local variables into SSA IDs, +// which allows them to be the target of optimizing transformations. +// +// Store and load operations to these variables are converted into +// operations on SSA IDs. Phi instructions are added when needed. See the +// SSA construction paper for algorithmic details +// (https://link.springer.com/chapter/10.1007/978-3-642-37051-9_6) +class SSARewriter { + public: + SSARewriter(MemPass* pass) + : pass_(pass), first_phi_id_(pass_->get_module()->IdBound()) {} + + // Rewrites SSA-target variables in function |fp| into SSA. This is the + // entry point for the SSA rewrite algorithm. SSA-target variables are + // locally defined variables that meet the criteria set by IsSSATargetVar. + // + // It returns true if function |fp| was modified. Otherwise, it returns + // false. + bool RewriteFunctionIntoSSA(Function* fp); + + private: + class PhiCandidate { + public: + explicit PhiCandidate(uint32_t var, uint32_t result, BasicBlock* block) + : var_id_(var), + result_id_(result), + bb_(block), + phi_args_(), + copy_of_(0), + is_complete_(false), + users_() {} + + uint32_t var_id() const { return var_id_; } + uint32_t result_id() const { return result_id_; } + BasicBlock* bb() const { return bb_; } + std::vector& phi_args() { return phi_args_; } + const std::vector& phi_args() const { return phi_args_; } + uint32_t copy_of() const { return copy_of_; } + bool is_complete() const { return is_complete_; } + std::vector& users() { return users_; } + const std::vector& users() const { return users_; } + + // Marks this phi candidate as a trivial copy of |orig_id|. + void MarkCopyOf(uint32_t orig_id) { copy_of_ = orig_id; } + + // Marks this phi candidate as incomplete. + void MarkIncomplete() { is_complete_ = false; } + + // Marks this phi candidate as complete. + void MarkComplete() { is_complete_ = true; } + + // Returns true if this Phi candidate is ready to be emitted. + bool IsReady() const { return is_complete() && copy_of() == 0; } + + // Pretty prints this Phi candidate into a string and returns it. |cfg| is + // needed to lookup basic block predecessors. + std::string PrettyPrint(const CFG* cfg) const; + + // Registers |operand_id| as a user of this Phi candidate. + void AddUser(uint32_t operand_id) { users_.push_back(operand_id); } + + private: + // Variable ID that this Phi is merging. + uint32_t var_id_; + + // SSA ID generated by this Phi (i.e., this is the result ID of the eventual + // Phi instruction). + uint32_t result_id_; + + // Basic block to hold this Phi. + BasicBlock* bb_; + + // Vector of operands for every predecessor block of |bb|. This vector is + // organized so that the Ith slot contains the argument coming from the Ith + // predecessor of |bb|. + std::vector phi_args_; + + // If this Phi is a trivial copy of another Phi, this is the ID of the + // original. If this is 0, it means that this is not a trivial Phi. + uint32_t copy_of_; + + // False, if this Phi candidate has no arguments or at least one argument is + // %0. + bool is_complete_; + + // List of all users for this Phi instruction. Each element is the result ID + // of the load instruction replaced by this Phi, or the result ID of a Phi + // candidate that has this Phi in its list of operands. + std::vector users_; + }; + + // Type used to keep track of store operations in each basic block. + typedef std::unordered_map> + BlockDefsMap; + + // Generates all the SSA rewriting decisions for basic block |bb|. This + // populates the Phi candidate table (|phi_candidate_|) and the load + // replacement table (|load_replacement_). + void GenerateSSAReplacements(BasicBlock* bb); + + // Seals block |bb|. Sealing a basic block means |bb| and all its + // predecessors of |bb| have been scanned for loads/stores. + void SealBlock(BasicBlock* bb); + + // Returns true if |bb| has been sealed. + bool IsBlockSealed(BasicBlock* bb) { return sealed_blocks_.count(bb) != 0; } + + // Returns the Phi candidate with result ID |id| if it exists in the table + // |phi_candidates_|. If no such Phi candidate exists, it returns nullptr. + PhiCandidate* GetPhiCandidate(uint32_t id) { + auto it = phi_candidates_.find(id); + return (it != phi_candidates_.end()) ? &it->second : nullptr; + } + + // Replaces all the users of Phi candidate |phi_cand| to be users of + // |repl_id|. + void ReplacePhiUsersWith(const PhiCandidate& phi_cand, uint32_t repl_id); + + // Returns the value ID that should replace the load ID in the given + // replacement pair |repl|. The replacement is a pair (|load_id|, |val_id|). + // If |val_id| is itself replaced by another value in the table, this function + // will look the replacement for |val_id| until it finds one that is not + // itself replaced. For instance, given: + // + // %34 = OpLoad %float %f1 + // OpStore %t %34 + // %36 = OpLoad %float %t + // + // Assume that %f1 is reached by a Phi candidate %42, the load + // replacement table will have the following entries: + // + // %34 -> %42 + // %36 -> %34 + // + // So, when looking for the replacement for %36, we should not use + // %34. Rather, we should use %42. To do this, the chain of + // replacements must be followed until we reach an element that has + // no replacement. + uint32_t GetReplacement(std::pair repl); + + // Returns the argument at index |ix| from |phi_candidate|. If argument |ix| + // comes from a trivial Phi, it follows the copy-of chain from that trivial + // Phi until it finds the original Phi candidate. + // + // This is only valid after all Phi candidates have been completed. It can + // only be called when generating the IR for these Phis. + uint32_t GetPhiArgument(const PhiCandidate* phi_candidate, uint32_t ix); + + // Applies all the SSA replacement decisions. This replaces loads/stores to + // SSA target variables with their corresponding SSA IDs, and inserts Phi + // instructions for them. + bool ApplyReplacements(); + + // Registers a definition for variable |var_id| in basic block |bb| with + // value |val_id|. + void WriteVariable(uint32_t var_id, BasicBlock* bb, uint32_t val_id) { + defs_at_block_[bb][var_id] = val_id; + } + + // Processes the store operation |inst| in basic block |bb|. This extracts + // the variable ID being stored into, determines whether the variable is an + // SSA-target variable, and, if it is, it stores its value in the + // |defs_at_block_| map. + void ProcessStore(Instruction* inst, BasicBlock* bb); + + // Processes the load operation |inst| in basic block |bb|. This extracts + // the variable ID being stored into, determines whether the variable is an + // SSA-target variable, and, if it is, it reads its reaching definition by + // calling |GetReachingDef|. + void ProcessLoad(Instruction* inst, BasicBlock* bb); + + // Reads the current definition for variable |var_id| in basic block |bb|. + // If |var_id| is not defined in block |bb| it walks up the predecessors of + // |bb|, creating new Phi candidates along the way, if needed. + // + // It returns the value for |var_id| from the RHS of the current reaching + // definition for |var_id|. + uint32_t GetReachingDef(uint32_t var_id, BasicBlock* bb); + + // Adds arguments to |phi_candidate| by getting the reaching definition of + // |phi_candidate|'s variable on each of the predecessors of its basic + // block. After populating the argument list, it determines whether all its + // arguments are the same. If so, it returns the ID of the argument that + // this Phi copies. + uint32_t AddPhiOperands(PhiCandidate* phi_candidate); + + // Creates a Phi candidate instruction for variable |var_id| in basic block + // |bb|. + // + // Since the rewriting algorithm may remove Phi candidates when it finds + // them to be trivial, we avoid the expense of creating actual Phi + // instructions by keeping a pool of Phi candidates (|phi_candidates_|) + // during rewriting. + // + // Once the candidate Phi is created, it returns its ID. + PhiCandidate& CreatePhiCandidate(uint32_t var_id, BasicBlock* bb); + + // Attempts to remove a trivial Phi candidate |phi_cand|. Trivial Phis are + // those that only reference themselves and one other value |val| any number + // of times. This will try to remove any other Phis that become trivial + // after |phi_cand| is removed. + // + // If |phi_cand| is trivial, it returns the SSA ID for the value that should + // replace it. Otherwise, it returns the SSA ID for |phi_cand|. + uint32_t TryRemoveTrivialPhi(PhiCandidate* phi_cand); + + // Finalizes |phi_candidate| by replacing every argument that is still %0 + // with its reaching definition. + void FinalizePhiCandidate(PhiCandidate* phi_candidate); + + // Finalizes processing of Phi candidates. Once the whole function has been + // scanned for loads and stores, the CFG will still have some incomplete and + // trivial Phis. This will add missing arguments and remove trivial Phi + // candidates. + void FinalizePhiCandidates(); + + // Prints the table of Phi candidates to std::cerr. + void PrintPhiCandidates() const; + + // Prints the load replacement table to std::cerr. + void PrintReplacementTable() const; + + // Map holding the value of every SSA-target variable at every basic block + // where the variable is stored. defs_at_block_[block][var_id] = val_id + // means that there is a store or Phi instruction for variable |var_id| at + // basic block |block| with value |val_id|. + BlockDefsMap defs_at_block_; + + // Map, indexed by Phi ID, holding all the Phi candidates created during SSA + // rewriting. |phi_candidates_[id]| returns the Phi candidate whose result + // is |id|. + std::unordered_map phi_candidates_; + + // Queue of incomplete Phi candidates. These are Phi candidates created at + // unsealed blocks. They need to be completed before they are instantiated + // in ApplyReplacements. + std::queue incomplete_phis_; + + // List of completed Phi candidates. These are the only candidates that + // will become real Phi instructions. + std::vector phis_to_generate_; + + // SSA replacement table. This maps variable IDs, resulting from a load + // operation, to the value IDs that will replace them after SSA rewriting. + // After all the rewriting decisions are made, a final scan through the IR + // is done to replace all uses of the original load ID with the value ID. + std::unordered_map load_replacement_; + + // Set of blocks that have been sealed already. + std::unordered_set sealed_blocks_; + + // Memory pass requesting the SSA rewriter. + MemPass* pass_; + + // ID of the first Phi created by the SSA rewriter. During rewriting, any + // ID bigger than this corresponds to a Phi candidate. + uint32_t first_phi_id_; +}; + +class SSARewritePass : public MemPass { + public: + SSARewritePass() = default; + + const char* name() const override { return "ssa-rewrite"; } + Status Process() override; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_SSA_REWRITE_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp new file mode 100644 index 00000000000..ab7c4eb8dd0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.cpp @@ -0,0 +1,200 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/strength_reduction_pass.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" + +namespace { +// Count the number of trailing zeros in the binary representation of +// |constVal|. +uint32_t CountTrailingZeros(uint32_t constVal) { + // Faster if we use the hardware count trailing zeros instruction. + // If not available, we could create a table. + uint32_t shiftAmount = 0; + while ((constVal & 1) == 0) { + ++shiftAmount; + constVal = (constVal >> 1); + } + return shiftAmount; +} + +// Return true if |val| is a power of 2. +bool IsPowerOf2(uint32_t val) { + // The idea is that the & will clear out the least + // significant 1 bit. If it is a power of 2, then + // there is exactly 1 bit set, and the value becomes 0. + if (val == 0) return false; + return ((val - 1) & val) == 0; +} + +} // namespace + +namespace spvtools { +namespace opt { + +Pass::Status StrengthReductionPass::Process() { + // Initialize the member variables on a per module basis. + bool modified = false; + int32_type_id_ = 0; + uint32_type_id_ = 0; + std::memset(constant_ids_, 0, sizeof(constant_ids_)); + + FindIntTypesAndConstants(); + modified = ScanFunctions(); + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool StrengthReductionPass::ReplaceMultiplyByPowerOf2( + BasicBlock::iterator* inst) { + assert((*inst)->opcode() == SpvOp::SpvOpIMul && + "Only works for multiplication of integers."); + bool modified = false; + + // Currently only works on 32-bit integers. + if ((*inst)->type_id() != int32_type_id_ && + (*inst)->type_id() != uint32_type_id_) { + return modified; + } + + // Check the operands for a constant that is a power of 2. + for (int i = 0; i < 2; i++) { + uint32_t opId = (*inst)->GetSingleWordInOperand(i); + Instruction* opInst = get_def_use_mgr()->GetDef(opId); + if (opInst->opcode() == SpvOp::SpvOpConstant) { + // We found a constant operand. + uint32_t constVal = opInst->GetSingleWordOperand(2); + + if (IsPowerOf2(constVal)) { + modified = true; + uint32_t shiftAmount = CountTrailingZeros(constVal); + uint32_t shiftConstResultId = GetConstantId(shiftAmount); + + // Create the new instruction. + uint32_t newResultId = TakeNextId(); + std::vector newOperands; + newOperands.push_back((*inst)->GetInOperand(1 - i)); + Operand shiftOperand(spv_operand_type_t::SPV_OPERAND_TYPE_ID, + {shiftConstResultId}); + newOperands.push_back(shiftOperand); + std::unique_ptr newInstruction( + new Instruction(context(), SpvOp::SpvOpShiftLeftLogical, + (*inst)->type_id(), newResultId, newOperands)); + + // Insert the new instruction and update the data structures. + (*inst) = (*inst).InsertBefore(std::move(newInstruction)); + get_def_use_mgr()->AnalyzeInstDefUse(&*(*inst)); + ++(*inst); + context()->ReplaceAllUsesWith((*inst)->result_id(), newResultId); + + // Remove the old instruction. + Instruction* inst_to_delete = &*(*inst); + --(*inst); + context()->KillInst(inst_to_delete); + + // We do not want to replace the instruction twice if both operands + // are constants that are a power of 2. So we break here. + break; + } + } + } + + return modified; +} + +void StrengthReductionPass::FindIntTypesAndConstants() { + analysis::Integer int32(32, true); + int32_type_id_ = context()->get_type_mgr()->GetId(&int32); + analysis::Integer uint32(32, false); + uint32_type_id_ = context()->get_type_mgr()->GetId(&uint32); + for (auto iter = get_module()->types_values_begin(); + iter != get_module()->types_values_end(); ++iter) { + switch (iter->opcode()) { + case SpvOp::SpvOpConstant: + if (iter->type_id() == uint32_type_id_) { + uint32_t value = iter->GetSingleWordOperand(2); + if (value <= 32) constant_ids_[value] = iter->result_id(); + } + break; + default: + break; + } + } +} + +uint32_t StrengthReductionPass::GetConstantId(uint32_t val) { + assert(val <= 32 && + "This function does not handle constants larger than 32."); + + if (constant_ids_[val] == 0) { + if (uint32_type_id_ == 0) { + analysis::Integer uint(32, false); + uint32_type_id_ = context()->get_type_mgr()->GetTypeInstruction(&uint); + } + + // Construct the constant. + uint32_t resultId = TakeNextId(); + Operand constant(spv_operand_type_t::SPV_OPERAND_TYPE_LITERAL_INTEGER, + {val}); + std::unique_ptr newConstant( + new Instruction(context(), SpvOp::SpvOpConstant, uint32_type_id_, + resultId, {constant})); + get_module()->AddGlobalValue(std::move(newConstant)); + + // Notify the DefUseManager about this constant. + auto constantIter = --get_module()->types_values_end(); + get_def_use_mgr()->AnalyzeInstDef(&*constantIter); + + // Store the result id for next time. + constant_ids_[val] = resultId; + } + + return constant_ids_[val]; +} + +bool StrengthReductionPass::ScanFunctions() { + // I did not use |ForEachInst| in the module because the function that acts on + // the instruction gets a pointer to the instruction. We cannot use that to + // insert a new instruction. I want an iterator. + bool modified = false; + for (auto& func : *get_module()) { + for (auto& bb : func) { + for (auto inst = bb.begin(); inst != bb.end(); ++inst) { + switch (inst->opcode()) { + case SpvOp::SpvOpIMul: + if (ReplaceMultiplyByPowerOf2(&inst)) modified = true; + break; + default: + break; + } + } + } + } + return modified; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h new file mode 100644 index 00000000000..8dfeb307bff --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strength_reduction_pass.h @@ -0,0 +1,65 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_STRENGTH_REDUCTION_PASS_H_ +#define SOURCE_OPT_STRENGTH_REDUCTION_PASS_H_ + +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class StrengthReductionPass : public Pass { + public: + const char* name() const override { return "strength-reduction"; } + Status Process() override; + + private: + // Replaces multiple by power of 2 with an equivalent bit shift. + // Returns true if something changed. + bool ReplaceMultiplyByPowerOf2(BasicBlock::iterator*); + + // Scan the types and constants in the module looking for the the integer + // types that we are + // interested in. The shift operation needs a small unsigned integer. We + // need to find + // them or create them. We do not want duplicates. + void FindIntTypesAndConstants(); + + // Get the id for the given constant. If it does not exist, it will be + // created. The parameter must be between 0 and 32 inclusive. + uint32_t GetConstantId(uint32_t); + + // Replaces certain instructions in function bodies with presumably cheaper + // ones. Returns true if something changed. + bool ScanFunctions(); + + // Type ids for the types of interest, or 0 if they do not exist. + uint32_t int32_type_id_; + uint32_t uint32_type_id_; + + // constant_ids[i] is the id for unsigned integer constant i. + // We set the limit at 32 because a bit shift of a 32-bit integer does not + // need a value larger than 32. + uint32_t constant_ids_[33]; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_STRENGTH_REDUCTION_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp new file mode 100644 index 00000000000..5d9c5fec8ad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.cpp @@ -0,0 +1,36 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/strip_debug_info_pass.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status StripDebugInfoPass::Process() { + bool modified = !context()->debugs1().empty() || + !context()->debugs2().empty() || + !context()->debugs3().empty(); + context()->debug_clear(); + + context()->module()->ForEachInst([&modified](Instruction* inst) { + modified |= !inst->dbg_line_insts().empty(); + inst->dbg_line_insts().clear(); + }); + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.h new file mode 100644 index 00000000000..47a2cd4090b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_debug_info_pass.h @@ -0,0 +1,35 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_STRIP_DEBUG_INFO_PASS_H_ +#define SOURCE_OPT_STRIP_DEBUG_INFO_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class StripDebugInfoPass : public Pass { + public: + const char* name() const override { return "strip-debug"; } + Status Process() override; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_STRIP_DEBUG_INFO_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_reflect_info_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_reflect_info_pass.cpp new file mode 100644 index 00000000000..14ce31ff329 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_reflect_info_pass.cpp @@ -0,0 +1,74 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/strip_reflect_info_pass.h" + +#include +#include + +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +Pass::Status StripReflectInfoPass::Process() { + bool modified = false; + + std::vector to_remove; + + bool other_uses_for_decorate_string = false; + for (auto& inst : context()->module()->annotations()) { + switch (inst.opcode()) { + case SpvOpDecorateStringGOOGLE: + if (inst.GetSingleWordInOperand(1) == SpvDecorationHlslSemanticGOOGLE) { + to_remove.push_back(&inst); + } else { + other_uses_for_decorate_string = true; + } + break; + + case SpvOpDecorateId: + if (inst.GetSingleWordInOperand(1) == + SpvDecorationHlslCounterBufferGOOGLE) { + to_remove.push_back(&inst); + } + break; + + default: + break; + } + } + + for (auto& inst : context()->module()->extensions()) { + const char* ext_name = + reinterpret_cast(&inst.GetInOperand(0).words[0]); + if (0 == std::strcmp(ext_name, "SPV_GOOGLE_hlsl_functionality1")) { + to_remove.push_back(&inst); + } else if (!other_uses_for_decorate_string && + 0 == std::strcmp(ext_name, "SPV_GOOGLE_decorate_string")) { + to_remove.push_back(&inst); + } + } + + for (auto* inst : to_remove) { + modified = true; + context()->KillInst(inst); + } + + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_reflect_info_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_reflect_info_pass.h new file mode 100644 index 00000000000..935a605e391 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/strip_reflect_info_pass.h @@ -0,0 +1,43 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_STRIP_REFLECT_INFO_PASS_H_ +#define SOURCE_OPT_STRIP_REFLECT_INFO_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class StripReflectInfoPass : public Pass { + public: + const char* name() const override { return "strip-reflect"; } + Status Process() override; + + // Return the mask of preserved Analyses. + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisCombinators | IRContext::kAnalysisCFG | + IRContext::kAnalysisDominatorAnalysis | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisNameMap; + } +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_STRIP_REFLECT_INFO_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/tree_iterator.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/tree_iterator.h new file mode 100644 index 00000000000..05f42bc5bd0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/tree_iterator.h @@ -0,0 +1,246 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_TREE_ITERATOR_H_ +#define SOURCE_OPT_TREE_ITERATOR_H_ + +#include +#include +#include + +namespace spvtools { +namespace opt { + +// Helper class to iterate over a tree in a depth first order. +// The class assumes the data structure is a tree, tree node type implements a +// forward iterator. +// At each step, the iterator holds the pointer to the current node and state of +// the walk. +// The state is recorded by stacking the iteration position of the node +// children. To move to the next node, the iterator: +// - Looks at the top of the stack; +// - Sets the node behind the iterator as the current node; +// - Increments the iterator if it has more children to visit, pops otherwise; +// - If the current node has children, the children iterator is pushed into the +// stack. +template +class TreeDFIterator { + static_assert(!std::is_pointer::value && + !std::is_reference::value, + "NodeTy should be a class"); + // Type alias to keep track of the const qualifier. + using NodeIterator = + typename std::conditional::value, + typename NodeTy::const_iterator, + typename NodeTy::iterator>::type; + + // Type alias to keep track of the const qualifier. + using NodePtr = NodeTy*; + + public: + // Standard iterator interface. + using reference = NodeTy&; + using value_type = NodeTy; + + explicit inline TreeDFIterator(NodePtr top_node) : current_(top_node) { + if (current_ && current_->begin() != current_->end()) + parent_iterators_.emplace(make_pair(current_, current_->begin())); + } + + // end() iterator. + inline TreeDFIterator() : TreeDFIterator(nullptr) {} + + bool operator==(const TreeDFIterator& x) const { + return current_ == x.current_; + } + + bool operator!=(const TreeDFIterator& x) const { return !(*this == x); } + + reference operator*() const { return *current_; } + + NodePtr operator->() const { return current_; } + + TreeDFIterator& operator++() { + MoveToNextNode(); + return *this; + } + + TreeDFIterator operator++(int) { + TreeDFIterator tmp = *this; + ++*this; + return tmp; + } + + private: + // Moves the iterator to the next node in the tree. + // If we are at the end, do nothing, otherwise + // if our current node has children, use the children iterator and push the + // current node into the stack. + // If we reach the end of the local iterator, pop it. + inline void MoveToNextNode() { + if (!current_) return; + if (parent_iterators_.empty()) { + current_ = nullptr; + return; + } + std::pair& next_it = parent_iterators_.top(); + // Set the new node. + current_ = *next_it.second; + // Update the iterator for the next child. + ++next_it.second; + // If we finished with node, pop it. + if (next_it.first->end() == next_it.second) parent_iterators_.pop(); + // If our current node is not a leaf, store the iteration state for later. + if (current_->begin() != current_->end()) + parent_iterators_.emplace(make_pair(current_, current_->begin())); + } + + // The current node of the tree. + NodePtr current_; + // State of the tree walk: each pair contains the parent node (which has been + // already visited) and the iterator of the next children to visit. + // When all the children has been visited, we pop the entry, get the next + // child and push back the pair if the children iterator is not end(). + std::stack> parent_iterators_; +}; + +// Helper class to iterate over a tree in a depth first post-order. +// The class assumes the data structure is a tree, tree node type implements a +// forward iterator. +// At each step, the iterator holds the pointer to the current node and state of +// the walk. +// The state is recorded by stacking the iteration position of the node +// children. To move to the next node, the iterator: +// - Looks at the top of the stack; +// - If the children iterator has reach the end, then the node become the +// current one and we pop the stack; +// - Otherwise, we save the child and increment the iterator; +// - We walk the child sub-tree until we find a leaf, stacking all non-leaves +// states (pair of node pointer and child iterator) as we walk it. +template +class PostOrderTreeDFIterator { + static_assert(!std::is_pointer::value && + !std::is_reference::value, + "NodeTy should be a class"); + // Type alias to keep track of the const qualifier. + using NodeIterator = + typename std::conditional::value, + typename NodeTy::const_iterator, + typename NodeTy::iterator>::type; + + // Type alias to keep track of the const qualifier. + using NodePtr = NodeTy*; + + public: + // Standard iterator interface. + using reference = NodeTy&; + using value_type = NodeTy; + + static inline PostOrderTreeDFIterator begin(NodePtr top_node) { + return PostOrderTreeDFIterator(top_node); + } + + static inline PostOrderTreeDFIterator end(NodePtr sentinel_node) { + return PostOrderTreeDFIterator(sentinel_node, false); + } + + bool operator==(const PostOrderTreeDFIterator& x) const { + return current_ == x.current_; + } + + bool operator!=(const PostOrderTreeDFIterator& x) const { + return !(*this == x); + } + + reference operator*() const { return *current_; } + + NodePtr operator->() const { return current_; } + + PostOrderTreeDFIterator& operator++() { + MoveToNextNode(); + return *this; + } + + PostOrderTreeDFIterator operator++(int) { + PostOrderTreeDFIterator tmp = *this; + ++*this; + return tmp; + } + + private: + explicit inline PostOrderTreeDFIterator(NodePtr top_node) + : current_(top_node) { + if (current_) WalkToLeaf(); + } + + // Constructor for the "end()" iterator. + // |end_sentinel| is the value that acts as end value (can be null). The bool + // parameters is to distinguish from the start() Ctor. + inline PostOrderTreeDFIterator(NodePtr sentinel_node, bool) + : current_(sentinel_node) {} + + // Moves the iterator to the next node in the tree. + // If we are at the end, do nothing, otherwise + // if our current node has children, use the children iterator and push the + // current node into the stack. + // If we reach the end of the local iterator, pop it. + inline void MoveToNextNode() { + if (!current_) return; + if (parent_iterators_.empty()) { + current_ = nullptr; + return; + } + std::pair& next_it = parent_iterators_.top(); + // If we visited all children, the current node is the top of the stack. + if (next_it.second == next_it.first->end()) { + // Set the new node. + current_ = next_it.first; + parent_iterators_.pop(); + return; + } + // We have more children to visit, set the current node to the first child + // and dive to leaf. + current_ = *next_it.second; + // Update the iterator for the next child (avoid unneeded pop). + ++next_it.second; + WalkToLeaf(); + } + + // Moves the iterator to the next node in the tree. + // If we are at the end, do nothing, otherwise + // if our current node has children, use the children iterator and push the + // current node into the stack. + // If we reach the end of the local iterator, pop it. + inline void WalkToLeaf() { + while (current_->begin() != current_->end()) { + NodeIterator next = ++current_->begin(); + parent_iterators_.emplace(make_pair(current_, next)); + // Set the first child as the new node. + current_ = *current_->begin(); + } + } + + // The current node of the tree. + NodePtr current_; + // State of the tree walk: each pair contains the parent node and the iterator + // of the next children to visit. + // When all the children has been visited, we pop the first entry and the + // parent node become the current node. + std::stack> parent_iterators_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_TREE_ITERATOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp new file mode 100644 index 00000000000..bd5221b0438 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/type_manager.cpp @@ -0,0 +1,926 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/type_manager.h" + +#include +#include +#include +#include + +#include "source/opt/ir_context.h" +#include "source/opt/log.h" +#include "source/opt/reflect.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { + +const int kSpvTypePointerStorageClass = 1; +const int kSpvTypePointerTypeIdInIdx = 2; + +} // namespace + +TypeManager::TypeManager(const MessageConsumer& consumer, IRContext* c) + : consumer_(consumer), context_(c) { + AnalyzeTypes(*c->module()); +} + +Type* TypeManager::GetType(uint32_t id) const { + auto iter = id_to_type_.find(id); + if (iter != id_to_type_.end()) return (*iter).second; + iter = id_to_incomplete_type_.find(id); + if (iter != id_to_incomplete_type_.end()) return (*iter).second; + return nullptr; +} + +std::pair> TypeManager::GetTypeAndPointerType( + uint32_t id, SpvStorageClass sc) const { + Type* type = GetType(id); + if (type) { + return std::make_pair(type, MakeUnique(type, sc)); + } else { + return std::make_pair(type, std::unique_ptr()); + } +} + +uint32_t TypeManager::GetId(const Type* type) const { + auto iter = type_to_id_.find(type); + if (iter != type_to_id_.end()) return (*iter).second; + return 0; +} + +void TypeManager::AnalyzeTypes(const Module& module) { + // First pass through the types. Any types that reference a forward pointer + // (directly or indirectly) are incomplete, and are added to incomplete types. + for (const auto* inst : module.GetTypes()) { + RecordIfTypeDefinition(*inst); + } + + if (incomplete_types_.empty()) { + return; + } + + // Get the real pointer definition for all of the forward pointers. + for (auto& type : incomplete_types_) { + if (type.type()->kind() == Type::kForwardPointer) { + auto* t = GetType(type.id()); + assert(t); + auto* p = t->AsPointer(); + assert(p); + type.type()->AsForwardPointer()->SetTargetPointer(p); + } + } + + // Replaces the references to the forward pointers in the incomplete types. + for (auto& type : incomplete_types_) { + ReplaceForwardPointers(type.type()); + } + + // Delete the forward pointers now that they are not referenced anymore. + for (auto& type : incomplete_types_) { + if (type.type()->kind() == Type::kForwardPointer) { + type.ResetType(nullptr); + } + } + + // Compare the complete types looking for types that are the same. If there + // are two types that are the same, then replace one with the other. + // Continue until we reach a fixed point. + bool restart = true; + while (restart) { + restart = false; + for (auto it1 = incomplete_types_.begin(); it1 != incomplete_types_.end(); + ++it1) { + uint32_t id1 = it1->id(); + Type* type1 = it1->type(); + if (!type1) { + continue; + } + + for (auto it2 = it1 + 1; it2 != incomplete_types_.end(); ++it2) { + uint32_t id2 = it2->id(); + (void)(id2 + id1); + Type* type2 = it2->type(); + if (!type2) { + continue; + } + + if (type1->IsSame(type2)) { + ReplaceType(type1, type2); + it2->ResetType(nullptr); + id_to_incomplete_type_[it2->id()] = type1; + restart = true; + } + } + } + } + + // Add the remaining incomplete types to the type pool. + for (auto& type : incomplete_types_) { + if (type.type() && !type.type()->AsForwardPointer()) { + std::vector decorations = + context()->get_decoration_mgr()->GetDecorationsFor(type.id(), true); + for (auto dec : decorations) { + AttachDecoration(*dec, type.type()); + } + auto pair = type_pool_.insert(type.ReleaseType()); + id_to_type_[type.id()] = pair.first->get(); + type_to_id_[pair.first->get()] = type.id(); + id_to_incomplete_type_.erase(type.id()); + } + } + + // Add a mapping for any ids that whose original type was replaced by an + // equivalent type. + for (auto& type : id_to_incomplete_type_) { + id_to_type_[type.first] = type.second; + } + +#ifndef NDEBUG + // Check if the type pool contains two types that are the same. This + // is an indication that the hashing and comparision are wrong. It + // will cause a problem if the type pool gets resized and everything + // is rehashed. + for (auto& i : type_pool_) { + for (auto& j : type_pool_) { + Type* ti = i.get(); + Type* tj = j.get(); + assert((ti == tj || !ti->IsSame(tj)) && + "Type pool contains two types that are the same."); + } + } +#endif +} + +void TypeManager::RemoveId(uint32_t id) { + auto iter = id_to_type_.find(id); + if (iter == id_to_type_.end()) return; + + auto& type = iter->second; + if (!type->IsUniqueType(true)) { + auto tIter = type_to_id_.find(type); + if (tIter != type_to_id_.end() && tIter->second == id) { + // |type| currently maps to |id|. + // Search for an equivalent type to re-map. + bool found = false; + for (auto& pair : id_to_type_) { + if (pair.first != id && *pair.second == *type) { + // Equivalent ambiguous type, re-map type. + type_to_id_.erase(type); + type_to_id_[pair.second] = pair.first; + found = true; + break; + } + } + // No equivalent ambiguous type, remove mapping. + if (!found) type_to_id_.erase(tIter); + } + } else { + // Unique type, so just erase the entry. + type_to_id_.erase(type); + } + + // Erase the entry for |id|. + id_to_type_.erase(iter); +} + +uint32_t TypeManager::GetTypeInstruction(const Type* type) { + uint32_t id = GetId(type); + if (id != 0) return id; + + std::unique_ptr typeInst; + id = context()->TakeNextId(); + RegisterType(id, *type); + switch (type->kind()) { +#define DefineParameterlessCase(kind) \ + case Type::k##kind: \ + typeInst = MakeUnique(context(), SpvOpType##kind, 0, id, \ + std::initializer_list{}); \ + break; + DefineParameterlessCase(Void); + DefineParameterlessCase(Bool); + DefineParameterlessCase(Sampler); + DefineParameterlessCase(Event); + DefineParameterlessCase(DeviceEvent); + DefineParameterlessCase(ReserveId); + DefineParameterlessCase(Queue); + DefineParameterlessCase(PipeStorage); + DefineParameterlessCase(NamedBarrier); +#undef DefineParameterlessCase + case Type::kInteger: + typeInst = MakeUnique( + context(), SpvOpTypeInt, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsInteger()->width()}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {(type->AsInteger()->IsSigned() ? 1u : 0u)}}}); + break; + case Type::kFloat: + typeInst = MakeUnique( + context(), SpvOpTypeFloat, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {type->AsFloat()->width()}}}); + break; + case Type::kVector: { + uint32_t subtype = GetTypeInstruction(type->AsVector()->element_type()); + typeInst = + MakeUnique(context(), SpvOpTypeVector, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {subtype}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {type->AsVector()->element_count()}}}); + break; + } + case Type::kMatrix: { + uint32_t subtype = GetTypeInstruction(type->AsMatrix()->element_type()); + typeInst = + MakeUnique(context(), SpvOpTypeMatrix, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {subtype}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {type->AsMatrix()->element_count()}}}); + break; + } + case Type::kImage: { + const Image* image = type->AsImage(); + uint32_t subtype = GetTypeInstruction(image->sampled_type()); + typeInst = MakeUnique( + context(), SpvOpTypeImage, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {subtype}}, + {SPV_OPERAND_TYPE_DIMENSIONALITY, + {static_cast(image->dim())}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {image->depth()}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {(image->is_arrayed() ? 1u : 0u)}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, + {(image->is_multisampled() ? 1u : 0u)}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {image->sampled()}}, + {SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, + {static_cast(image->format())}}, + {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, + {static_cast(image->access_qualifier())}}}); + break; + } + case Type::kSampledImage: { + uint32_t subtype = + GetTypeInstruction(type->AsSampledImage()->image_type()); + typeInst = MakeUnique( + context(), SpvOpTypeSampledImage, 0, id, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}}); + break; + } + case Type::kArray: { + uint32_t subtype = GetTypeInstruction(type->AsArray()->element_type()); + typeInst = MakeUnique( + context(), SpvOpTypeArray, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {subtype}}, + {SPV_OPERAND_TYPE_ID, {type->AsArray()->LengthId()}}}); + break; + } + case Type::kRuntimeArray: { + uint32_t subtype = + GetTypeInstruction(type->AsRuntimeArray()->element_type()); + typeInst = MakeUnique( + context(), SpvOpTypeRuntimeArray, 0, id, + std::initializer_list{{SPV_OPERAND_TYPE_ID, {subtype}}}); + break; + } + case Type::kStruct: { + std::vector ops; + const Struct* structTy = type->AsStruct(); + for (auto ty : structTy->element_types()) { + ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {GetTypeInstruction(ty)})); + } + typeInst = + MakeUnique(context(), SpvOpTypeStruct, 0, id, ops); + break; + } + case Type::kOpaque: { + const Opaque* opaque = type->AsOpaque(); + size_t size = opaque->name().size(); + // Convert to null-terminated packed UTF-8 string. + std::vector words(size / 4 + 1, 0); + char* dst = reinterpret_cast(words.data()); + strncpy(dst, opaque->name().c_str(), size); + typeInst = MakeUnique( + context(), SpvOpTypeOpaque, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_LITERAL_STRING, words}}); + break; + } + case Type::kPointer: { + const Pointer* pointer = type->AsPointer(); + uint32_t subtype = GetTypeInstruction(pointer->pointee_type()); + typeInst = MakeUnique( + context(), SpvOpTypePointer, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_STORAGE_CLASS, + {static_cast(pointer->storage_class())}}, + {SPV_OPERAND_TYPE_ID, {subtype}}}); + break; + } + case Type::kFunction: { + std::vector ops; + const Function* function = type->AsFunction(); + ops.push_back(Operand(SPV_OPERAND_TYPE_ID, + {GetTypeInstruction(function->return_type())})); + for (auto ty : function->param_types()) { + ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {GetTypeInstruction(ty)})); + } + typeInst = + MakeUnique(context(), SpvOpTypeFunction, 0, id, ops); + break; + } + case Type::kPipe: + typeInst = MakeUnique( + context(), SpvOpTypePipe, 0, id, + std::initializer_list{ + {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, + {static_cast(type->AsPipe()->access_qualifier())}}}); + break; + case Type::kForwardPointer: + typeInst = MakeUnique( + context(), SpvOpTypeForwardPointer, 0, 0, + std::initializer_list{ + {SPV_OPERAND_TYPE_ID, {type->AsForwardPointer()->target_id()}}, + {SPV_OPERAND_TYPE_STORAGE_CLASS, + {static_cast( + type->AsForwardPointer()->storage_class())}}}); + break; + default: + assert(false && "Unexpected type"); + break; + } + context()->AddType(std::move(typeInst)); + context()->AnalyzeDefUse(&*--context()->types_values_end()); + AttachDecorations(id, type); + return id; +} + +uint32_t TypeManager::FindPointerToType(uint32_t type_id, + SpvStorageClass storage_class) { + Type* pointeeTy = GetType(type_id); + Pointer pointerTy(pointeeTy, storage_class); + if (pointeeTy->IsUniqueType(true)) { + // Non-ambiguous type. Get the pointer type through the type manager. + return GetTypeInstruction(&pointerTy); + } + + // Ambiguous type, do a linear search. + Module::inst_iterator type_itr = context()->module()->types_values_begin(); + for (; type_itr != context()->module()->types_values_end(); ++type_itr) { + const Instruction* type_inst = &*type_itr; + if (type_inst->opcode() == SpvOpTypePointer && + type_inst->GetSingleWordOperand(kSpvTypePointerTypeIdInIdx) == + type_id && + type_inst->GetSingleWordOperand(kSpvTypePointerStorageClass) == + storage_class) + return type_inst->result_id(); + } + + // Must create the pointer type. + uint32_t resultId = context()->TakeNextId(); + std::unique_ptr type_inst( + new Instruction(context(), SpvOpTypePointer, 0, resultId, + {{spv_operand_type_t::SPV_OPERAND_TYPE_STORAGE_CLASS, + {uint32_t(storage_class)}}, + {spv_operand_type_t::SPV_OPERAND_TYPE_ID, {type_id}}})); + context()->AddType(std::move(type_inst)); + context()->get_type_mgr()->RegisterType(resultId, pointerTy); + return resultId; +} + +void TypeManager::AttachDecorations(uint32_t id, const Type* type) { + for (auto vec : type->decorations()) { + CreateDecoration(id, vec); + } + if (const Struct* structTy = type->AsStruct()) { + for (auto pair : structTy->element_decorations()) { + uint32_t element = pair.first; + for (auto vec : pair.second) { + CreateDecoration(id, vec, element); + } + } + } +} + +void TypeManager::CreateDecoration(uint32_t target, + const std::vector& decoration, + uint32_t element) { + std::vector ops; + ops.push_back(Operand(SPV_OPERAND_TYPE_ID, {target})); + if (element != 0) { + ops.push_back(Operand(SPV_OPERAND_TYPE_LITERAL_INTEGER, {element})); + } + ops.push_back(Operand(SPV_OPERAND_TYPE_DECORATION, {decoration[0]})); + for (size_t i = 1; i < decoration.size(); ++i) { + ops.push_back(Operand(SPV_OPERAND_TYPE_LITERAL_INTEGER, {decoration[i]})); + } + context()->AddAnnotationInst(MakeUnique( + context(), (element == 0 ? SpvOpDecorate : SpvOpMemberDecorate), 0, 0, + ops)); + Instruction* inst = &*--context()->annotation_end(); + context()->get_def_use_mgr()->AnalyzeInstUse(inst); +} + +Type* TypeManager::RebuildType(const Type& type) { + // The comparison and hash on the type pool will avoid inserting the rebuilt + // type if an equivalent type already exists. The rebuilt type will be deleted + // when it goes out of scope at the end of the function in that case. Repeated + // insertions of the same Type will, at most, keep one corresponding object in + // the type pool. + std::unique_ptr rebuilt_ty; + switch (type.kind()) { +#define DefineNoSubtypeCase(kind) \ + case Type::k##kind: \ + rebuilt_ty.reset(type.Clone().release()); \ + return type_pool_.insert(std::move(rebuilt_ty)).first->get(); + + DefineNoSubtypeCase(Void); + DefineNoSubtypeCase(Bool); + DefineNoSubtypeCase(Integer); + DefineNoSubtypeCase(Float); + DefineNoSubtypeCase(Sampler); + DefineNoSubtypeCase(Opaque); + DefineNoSubtypeCase(Event); + DefineNoSubtypeCase(DeviceEvent); + DefineNoSubtypeCase(ReserveId); + DefineNoSubtypeCase(Queue); + DefineNoSubtypeCase(Pipe); + DefineNoSubtypeCase(PipeStorage); + DefineNoSubtypeCase(NamedBarrier); +#undef DefineNoSubtypeCase + case Type::kVector: { + const Vector* vec_ty = type.AsVector(); + const Type* ele_ty = vec_ty->element_type(); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), vec_ty->element_count()); + break; + } + case Type::kMatrix: { + const Matrix* mat_ty = type.AsMatrix(); + const Type* ele_ty = mat_ty->element_type(); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), mat_ty->element_count()); + break; + } + case Type::kImage: { + const Image* image_ty = type.AsImage(); + const Type* ele_ty = image_ty->sampled_type(); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), image_ty->dim(), + image_ty->depth(), image_ty->is_arrayed(), + image_ty->is_multisampled(), image_ty->sampled(), + image_ty->format(), image_ty->access_qualifier()); + break; + } + case Type::kSampledImage: { + const SampledImage* image_ty = type.AsSampledImage(); + const Type* ele_ty = image_ty->image_type(); + rebuilt_ty = MakeUnique(RebuildType(*ele_ty)); + break; + } + case Type::kArray: { + const Array* array_ty = type.AsArray(); + const Type* ele_ty = array_ty->element_type(); + rebuilt_ty = + MakeUnique(RebuildType(*ele_ty), array_ty->LengthId()); + break; + } + case Type::kRuntimeArray: { + const RuntimeArray* array_ty = type.AsRuntimeArray(); + const Type* ele_ty = array_ty->element_type(); + rebuilt_ty = MakeUnique(RebuildType(*ele_ty)); + break; + } + case Type::kStruct: { + const Struct* struct_ty = type.AsStruct(); + std::vector subtypes; + subtypes.reserve(struct_ty->element_types().size()); + for (const auto* ele_ty : struct_ty->element_types()) { + subtypes.push_back(RebuildType(*ele_ty)); + } + rebuilt_ty = MakeUnique(subtypes); + Struct* rebuilt_struct = rebuilt_ty->AsStruct(); + for (auto pair : struct_ty->element_decorations()) { + uint32_t index = pair.first; + for (const auto& dec : pair.second) { + // Explicit copy intended. + std::vector copy(dec); + rebuilt_struct->AddMemberDecoration(index, std::move(copy)); + } + } + break; + } + case Type::kPointer: { + const Pointer* pointer_ty = type.AsPointer(); + const Type* ele_ty = pointer_ty->pointee_type(); + rebuilt_ty = MakeUnique(RebuildType(*ele_ty), + pointer_ty->storage_class()); + break; + } + case Type::kFunction: { + const Function* function_ty = type.AsFunction(); + const Type* ret_ty = function_ty->return_type(); + std::vector param_types; + param_types.reserve(function_ty->param_types().size()); + for (const auto* param_ty : function_ty->param_types()) { + param_types.push_back(RebuildType(*param_ty)); + } + rebuilt_ty = MakeUnique(RebuildType(*ret_ty), param_types); + break; + } + case Type::kForwardPointer: { + const ForwardPointer* forward_ptr_ty = type.AsForwardPointer(); + rebuilt_ty = MakeUnique(forward_ptr_ty->target_id(), + forward_ptr_ty->storage_class()); + const Pointer* target_ptr = forward_ptr_ty->target_pointer(); + if (target_ptr) { + rebuilt_ty->AsForwardPointer()->SetTargetPointer( + RebuildType(*target_ptr)->AsPointer()); + } + break; + } + default: + assert(false && "Unhandled type"); + return nullptr; + } + for (const auto& dec : type.decorations()) { + // Explicit copy intended. + std::vector copy(dec); + rebuilt_ty->AddDecoration(std::move(copy)); + } + + return type_pool_.insert(std::move(rebuilt_ty)).first->get(); +} + +void TypeManager::RegisterType(uint32_t id, const Type& type) { + // Rebuild |type| so it and all its constituent types are owned by the type + // pool. + Type* rebuilt = RebuildType(type); + assert(rebuilt->IsSame(&type)); + id_to_type_[id] = rebuilt; + if (GetId(rebuilt) == 0) { + type_to_id_[rebuilt] = id; + } +} + +Type* TypeManager::GetRegisteredType(const Type* type) { + uint32_t id = GetTypeInstruction(type); + return GetType(id); +} + +Type* TypeManager::RecordIfTypeDefinition(const Instruction& inst) { + if (!IsTypeInst(inst.opcode())) return nullptr; + + Type* type = nullptr; + switch (inst.opcode()) { + case SpvOpTypeVoid: + type = new Void(); + break; + case SpvOpTypeBool: + type = new Bool(); + break; + case SpvOpTypeInt: + type = new Integer(inst.GetSingleWordInOperand(0), + inst.GetSingleWordInOperand(1)); + break; + case SpvOpTypeFloat: + type = new Float(inst.GetSingleWordInOperand(0)); + break; + case SpvOpTypeVector: + type = new Vector(GetType(inst.GetSingleWordInOperand(0)), + inst.GetSingleWordInOperand(1)); + break; + case SpvOpTypeMatrix: + type = new Matrix(GetType(inst.GetSingleWordInOperand(0)), + inst.GetSingleWordInOperand(1)); + break; + case SpvOpTypeImage: { + const SpvAccessQualifier access = + inst.NumInOperands() < 8 + ? SpvAccessQualifierReadOnly + : static_cast(inst.GetSingleWordInOperand(7)); + type = new Image( + GetType(inst.GetSingleWordInOperand(0)), + static_cast(inst.GetSingleWordInOperand(1)), + inst.GetSingleWordInOperand(2), inst.GetSingleWordInOperand(3) == 1, + inst.GetSingleWordInOperand(4) == 1, inst.GetSingleWordInOperand(5), + static_cast(inst.GetSingleWordInOperand(6)), access); + } break; + case SpvOpTypeSampler: + type = new Sampler(); + break; + case SpvOpTypeSampledImage: + type = new SampledImage(GetType(inst.GetSingleWordInOperand(0))); + break; + case SpvOpTypeArray: + type = new Array(GetType(inst.GetSingleWordInOperand(0)), + inst.GetSingleWordInOperand(1)); + if (id_to_incomplete_type_.count(inst.GetSingleWordInOperand(0))) { + incomplete_types_.emplace_back(inst.result_id(), type); + id_to_incomplete_type_[inst.result_id()] = type; + return type; + } + break; + case SpvOpTypeRuntimeArray: + type = new RuntimeArray(GetType(inst.GetSingleWordInOperand(0))); + if (id_to_incomplete_type_.count(inst.GetSingleWordInOperand(0))) { + incomplete_types_.emplace_back(inst.result_id(), type); + id_to_incomplete_type_[inst.result_id()] = type; + return type; + } + break; + case SpvOpTypeStruct: { + std::vector element_types; + bool incomplete_type = false; + for (uint32_t i = 0; i < inst.NumInOperands(); ++i) { + uint32_t type_id = inst.GetSingleWordInOperand(i); + element_types.push_back(GetType(type_id)); + if (id_to_incomplete_type_.count(type_id)) { + incomplete_type = true; + } + } + type = new Struct(element_types); + + if (incomplete_type) { + incomplete_types_.emplace_back(inst.result_id(), type); + id_to_incomplete_type_[inst.result_id()] = type; + return type; + } + } break; + case SpvOpTypeOpaque: { + const uint32_t* data = inst.GetInOperand(0).words.data(); + type = new Opaque(reinterpret_cast(data)); + } break; + case SpvOpTypePointer: { + uint32_t pointee_type_id = inst.GetSingleWordInOperand(1); + type = new Pointer( + GetType(pointee_type_id), + static_cast(inst.GetSingleWordInOperand(0))); + + if (id_to_incomplete_type_.count(pointee_type_id)) { + incomplete_types_.emplace_back(inst.result_id(), type); + id_to_incomplete_type_[inst.result_id()] = type; + return type; + } + id_to_incomplete_type_.erase(inst.result_id()); + + } break; + case SpvOpTypeFunction: { + bool incomplete_type = false; + uint32_t return_type_id = inst.GetSingleWordInOperand(0); + if (id_to_incomplete_type_.count(return_type_id)) { + incomplete_type = true; + } + Type* return_type = GetType(return_type_id); + std::vector param_types; + for (uint32_t i = 1; i < inst.NumInOperands(); ++i) { + uint32_t param_type_id = inst.GetSingleWordInOperand(i); + param_types.push_back(GetType(param_type_id)); + if (id_to_incomplete_type_.count(param_type_id)) { + incomplete_type = true; + } + } + + type = new Function(return_type, param_types); + + if (incomplete_type) { + incomplete_types_.emplace_back(inst.result_id(), type); + id_to_incomplete_type_[inst.result_id()] = type; + return type; + } + } break; + case SpvOpTypeEvent: + type = new Event(); + break; + case SpvOpTypeDeviceEvent: + type = new DeviceEvent(); + break; + case SpvOpTypeReserveId: + type = new ReserveId(); + break; + case SpvOpTypeQueue: + type = new Queue(); + break; + case SpvOpTypePipe: + type = new Pipe( + static_cast(inst.GetSingleWordInOperand(0))); + break; + case SpvOpTypeForwardPointer: { + // Handling of forward pointers is different from the other types. + uint32_t target_id = inst.GetSingleWordInOperand(0); + type = new ForwardPointer(target_id, static_cast( + inst.GetSingleWordInOperand(1))); + incomplete_types_.emplace_back(target_id, type); + id_to_incomplete_type_[target_id] = type; + return type; + } + case SpvOpTypePipeStorage: + type = new PipeStorage(); + break; + case SpvOpTypeNamedBarrier: + type = new NamedBarrier(); + break; + default: + SPIRV_UNIMPLEMENTED(consumer_, "unhandled type"); + break; + } + + uint32_t id = inst.result_id(); + SPIRV_ASSERT(consumer_, id != 0, "instruction without result id found"); + SPIRV_ASSERT(consumer_, type != nullptr, + "type should not be nullptr at this point"); + std::vector decorations = + context()->get_decoration_mgr()->GetDecorationsFor(id, true); + for (auto dec : decorations) { + AttachDecoration(*dec, type); + } + std::unique_ptr unique(type); + auto pair = type_pool_.insert(std::move(unique)); + id_to_type_[id] = pair.first->get(); + type_to_id_[pair.first->get()] = id; + return type; +} + +void TypeManager::AttachDecoration(const Instruction& inst, Type* type) { + const SpvOp opcode = inst.opcode(); + if (!IsAnnotationInst(opcode)) return; + + switch (opcode) { + case SpvOpDecorate: { + const auto count = inst.NumOperands(); + std::vector data; + for (uint32_t i = 1; i < count; ++i) { + data.push_back(inst.GetSingleWordOperand(i)); + } + type->AddDecoration(std::move(data)); + } break; + case SpvOpMemberDecorate: { + const auto count = inst.NumOperands(); + const uint32_t index = inst.GetSingleWordOperand(1); + std::vector data; + for (uint32_t i = 2; i < count; ++i) { + data.push_back(inst.GetSingleWordOperand(i)); + } + if (Struct* st = type->AsStruct()) { + st->AddMemberDecoration(index, std::move(data)); + } else { + SPIRV_UNIMPLEMENTED(consumer_, "OpMemberDecorate non-struct type"); + } + } break; + default: + SPIRV_UNREACHABLE(consumer_); + break; + } +} + +const Type* TypeManager::GetMemberType( + const Type* parent_type, const std::vector& access_chain) { + for (uint32_t element_index : access_chain) { + if (const Struct* struct_type = parent_type->AsStruct()) { + parent_type = struct_type->element_types()[element_index]; + } else if (const Array* array_type = parent_type->AsArray()) { + parent_type = array_type->element_type(); + } else if (const RuntimeArray* runtime_array_type = + parent_type->AsRuntimeArray()) { + parent_type = runtime_array_type->element_type(); + } else if (const Vector* vector_type = parent_type->AsVector()) { + parent_type = vector_type->element_type(); + } else if (const Matrix* matrix_type = parent_type->AsMatrix()) { + parent_type = matrix_type->element_type(); + } else { + assert(false && "Trying to get a member of a type without members."); + } + } + return parent_type; +} + +void TypeManager::ReplaceForwardPointers(Type* type) { + switch (type->kind()) { + case Type::kArray: { + const ForwardPointer* element_type = + type->AsArray()->element_type()->AsForwardPointer(); + if (element_type) { + type->AsArray()->ReplaceElementType(element_type->target_pointer()); + } + } break; + case Type::kRuntimeArray: { + const ForwardPointer* element_type = + type->AsRuntimeArray()->element_type()->AsForwardPointer(); + if (element_type) { + type->AsRuntimeArray()->ReplaceElementType( + element_type->target_pointer()); + } + } break; + case Type::kStruct: { + auto& member_types = type->AsStruct()->element_types(); + for (auto& member_type : member_types) { + if (member_type->AsForwardPointer()) { + member_type = member_type->AsForwardPointer()->target_pointer(); + assert(member_type); + } + } + } break; + case Type::kPointer: { + const ForwardPointer* pointee_type = + type->AsPointer()->pointee_type()->AsForwardPointer(); + if (pointee_type) { + type->AsPointer()->SetPointeeType(pointee_type->target_pointer()); + } + } break; + case Type::kFunction: { + Function* func_type = type->AsFunction(); + const ForwardPointer* return_type = + func_type->return_type()->AsForwardPointer(); + if (return_type) { + func_type->SetReturnType(return_type->target_pointer()); + } + + auto& param_types = func_type->param_types(); + for (auto& param_type : param_types) { + if (param_type->AsForwardPointer()) { + param_type = param_type->AsForwardPointer()->target_pointer(); + } + } + } break; + default: + break; + } +} + +void TypeManager::ReplaceType(Type* new_type, Type* original_type) { + assert(original_type->kind() == new_type->kind() && + "Types must be the same for replacement.\n"); + for (auto& p : incomplete_types_) { + Type* type = p.type(); + if (!type) { + continue; + } + + switch (type->kind()) { + case Type::kArray: { + const Type* element_type = type->AsArray()->element_type(); + if (element_type == original_type) { + type->AsArray()->ReplaceElementType(new_type); + } + } break; + case Type::kRuntimeArray: { + const Type* element_type = type->AsRuntimeArray()->element_type(); + if (element_type == original_type) { + type->AsRuntimeArray()->ReplaceElementType(new_type); + } + } break; + case Type::kStruct: { + auto& member_types = type->AsStruct()->element_types(); + for (auto& member_type : member_types) { + if (member_type == original_type) { + member_type = new_type; + } + } + } break; + case Type::kPointer: { + const Type* pointee_type = type->AsPointer()->pointee_type(); + if (pointee_type == original_type) { + type->AsPointer()->SetPointeeType(new_type); + } + } break; + case Type::kFunction: { + Function* func_type = type->AsFunction(); + const Type* return_type = func_type->return_type(); + if (return_type == original_type) { + func_type->SetReturnType(new_type); + } + + auto& param_types = func_type->param_types(); + for (auto& param_type : param_types) { + if (param_type == original_type) { + param_type = new_type; + } + } + } break; + default: + break; + } + } +} + +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h new file mode 100644 index 00000000000..c44969e84f9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/type_manager.h @@ -0,0 +1,218 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_TYPE_MANAGER_H_ +#define SOURCE_OPT_TYPE_MANAGER_H_ + +#include +#include +#include +#include +#include + +#include "source/opt/module.h" +#include "source/opt/types.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace opt { + +class IRContext; + +namespace analysis { + +// Hashing functor. +// +// All type pointers must be non-null. +struct HashTypePointer { + size_t operator()(const Type* type) const { + assert(type); + return type->HashValue(); + } +}; +struct HashTypeUniquePointer { + size_t operator()(const std::unique_ptr& type) const { + assert(type); + return type->HashValue(); + } +}; + +// Equality functor. +// +// Checks if two types pointers are the same type. +// +// All type pointers must be non-null. +struct CompareTypePointers { + bool operator()(const Type* lhs, const Type* rhs) const { + assert(lhs && rhs); + return lhs->IsSame(rhs); + } +}; +struct CompareTypeUniquePointers { + bool operator()(const std::unique_ptr& lhs, + const std::unique_ptr& rhs) const { + assert(lhs && rhs); + return lhs->IsSame(rhs.get()); + } +}; + +// A class for managing the SPIR-V type hierarchy. +class TypeManager { + public: + using IdToTypeMap = std::unordered_map; + + // Constructs a type manager from the given |module|. All internal messages + // will be communicated to the outside via the given message |consumer|. + // This instance only keeps a reference to the |consumer|, so the |consumer| + // should outlive this instance. + TypeManager(const MessageConsumer& consumer, IRContext* c); + + TypeManager(const TypeManager&) = delete; + TypeManager(TypeManager&&) = delete; + TypeManager& operator=(const TypeManager&) = delete; + TypeManager& operator=(TypeManager&&) = delete; + + // Returns the type for the given type |id|. Returns nullptr if the given |id| + // does not define a type. + Type* GetType(uint32_t id) const; + // Returns the id for the given |type|. Returns 0 if can not find the given + // |type|. + uint32_t GetId(const Type* type) const; + // Returns the number of types hold in this manager. + size_t NumTypes() const { return id_to_type_.size(); } + // Iterators for all types contained in this manager. + IdToTypeMap::const_iterator begin() const { return id_to_type_.cbegin(); } + IdToTypeMap::const_iterator end() const { return id_to_type_.cend(); } + + // Returns a pair of the type and pointer to the type in |sc|. + // + // |id| must be a registered type. + std::pair> GetTypeAndPointerType( + uint32_t id, SpvStorageClass sc) const; + + // Returns an id for a declaration representing |type|. + // + // If |type| is registered, then the registered id is returned. Otherwise, + // this function recursively adds type and annotation instructions as + // necessary to fully define |type|. + uint32_t GetTypeInstruction(const Type* type); + + // Find pointer to type and storage in module, return its resultId. If it is + // not found, a new type is created, and its id is returned. + uint32_t FindPointerToType(uint32_t type_id, SpvStorageClass storage_class); + + // Registers |id| to |type|. + // + // If GetId(|type|) already returns a non-zero id, that mapping will be + // unchanged. + void RegisterType(uint32_t id, const Type& type); + + Type* GetRegisteredType(const Type* type); + + // Removes knowledge of |id| from the manager. + // + // If |id| is an ambiguous type the multiple ids may be registered to |id|'s + // type (e.g. %struct1 and %struct1 might hash to the same type). In that + // case, calling GetId() with |id|'s type will return another suitable id + // defining that type. + void RemoveId(uint32_t id); + + // Returns the type of the member of |parent_type| that is identified by + // |access_chain|. The vector |access_chain| is a series of integers that are + // used to pick members as in the |OpCompositeExtract| instructions. If you + // want a member of an array, vector, or matrix that does not have a constant + // index, you can use 0 in that position. All elements have the same type. + const Type* GetMemberType(const Type* parent_type, + const std::vector& access_chain); + + private: + using TypeToIdMap = std::unordered_map; + using TypePool = + std::unordered_set, HashTypeUniquePointer, + CompareTypeUniquePointers>; + + class UnresolvedType { + public: + UnresolvedType(uint32_t i, Type* t) : id_(i), type_(t) {} + UnresolvedType(const UnresolvedType&) = delete; + UnresolvedType(UnresolvedType&& that) + : id_(that.id_), type_(std::move(that.type_)) {} + + uint32_t id() { return id_; } + Type* type() { return type_.get(); } + std::unique_ptr&& ReleaseType() { return std::move(type_); } + void ResetType(Type* t) { type_.reset(t); } + + private: + uint32_t id_; + std::unique_ptr type_; + }; + using IdToUnresolvedType = std::vector; + + // Analyzes the types and decorations on types in the given |module|. + void AnalyzeTypes(const Module& module); + + IRContext* context() { return context_; } + + // Attaches the decorations on |type| to |id|. + void AttachDecorations(uint32_t id, const Type* type); + + // Create the annotation instruction. + // + // If |element| is zero, an OpDecorate is created, other an OpMemberDecorate + // is created. The annotation is registered with the DefUseManager and the + // DecorationManager. + void CreateDecoration(uint32_t id, const std::vector& decoration, + uint32_t element = 0); + + // Creates and returns a type from the given SPIR-V |inst|. Returns nullptr if + // the given instruction is not for defining a type. + Type* RecordIfTypeDefinition(const Instruction& inst); + // Attaches the decoration encoded in |inst| to |type|. Does nothing if the + // given instruction is not a decoration instruction. Assumes the target is + // |type| (e.g. should be called in loop of |type|'s decorations). + void AttachDecoration(const Instruction& inst, Type* type); + + // Returns an equivalent pointer to |type| built in terms of pointers owned by + // |type_pool_|. For example, if |type| is a vec3 of bool, it will be rebuilt + // replacing the bool subtype with one owned by |type_pool_|. + Type* RebuildType(const Type& type); + + // Completes the incomplete type |type|, by replaces all references to + // ForwardPointer by the defining Pointer. + void ReplaceForwardPointers(Type* type); + + // Replaces all references to |original_type| in |incomplete_types_| by + // |new_type|. + void ReplaceType(Type* new_type, Type* original_type); + + const MessageConsumer& consumer_; // Message consumer. + IRContext* context_; + IdToTypeMap id_to_type_; // Mapping from ids to their type representations. + TypeToIdMap type_to_id_; // Mapping from types to their defining ids. + TypePool type_pool_; // Memory owner of type pointers. + IdToUnresolvedType incomplete_types_; // All incomplete types. Stored in an + // std::vector to make traversals + // deterministic. + + IdToTypeMap id_to_incomplete_type_; // Maps ids to their type representations + // for incomplete types. +}; + +} // namespace analysis +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_TYPE_MANAGER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/types.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/types.cpp new file mode 100644 index 00000000000..15cff548647 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/types.cpp @@ -0,0 +1,636 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include + +#include "source/opt/types.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { +namespace analysis { + +using U32VecVec = std::vector>; + +namespace { + +// Returns true if the two vector of vectors are identical. +bool CompareTwoVectors(const U32VecVec a, const U32VecVec b) { + const auto size = a.size(); + if (size != b.size()) return false; + + if (size == 0) return true; + if (size == 1) return a.front() == b.front(); + + std::vector*> a_ptrs, b_ptrs; + a_ptrs.reserve(size); + a_ptrs.reserve(size); + for (uint32_t i = 0; i < size; ++i) { + a_ptrs.push_back(&a[i]); + b_ptrs.push_back(&b[i]); + } + + const auto cmp = [](const std::vector* m, + const std::vector* n) { + return m->front() < n->front(); + }; + + std::sort(a_ptrs.begin(), a_ptrs.end(), cmp); + std::sort(b_ptrs.begin(), b_ptrs.end(), cmp); + + for (uint32_t i = 0; i < size; ++i) { + if (*a_ptrs[i] != *b_ptrs[i]) return false; + } + return true; +} + +} // anonymous namespace + +std::string Type::GetDecorationStr() const { + std::ostringstream oss; + oss << "[["; + for (const auto& decoration : decorations_) { + oss << "("; + for (size_t i = 0; i < decoration.size(); ++i) { + oss << (i > 0 ? ", " : ""); + oss << decoration.at(i); + } + oss << ")"; + } + oss << "]]"; + return oss.str(); +} + +bool Type::HasSameDecorations(const Type* that) const { + return CompareTwoVectors(decorations_, that->decorations_); +} + +bool Type::IsUniqueType(bool allowVariablePointers) const { + switch (kind_) { + case kPointer: + return !allowVariablePointers; + case kStruct: + case kArray: + case kRuntimeArray: + return false; + default: + return true; + } +} + +std::unique_ptr Type::Clone() const { + std::unique_ptr type; + switch (kind_) { +#define DeclareKindCase(kind) \ + case k##kind: \ + type = MakeUnique(*this->As##kind()); \ + break; + DeclareKindCase(Void); + DeclareKindCase(Bool); + DeclareKindCase(Integer); + DeclareKindCase(Float); + DeclareKindCase(Vector); + DeclareKindCase(Matrix); + DeclareKindCase(Image); + DeclareKindCase(Sampler); + DeclareKindCase(SampledImage); + DeclareKindCase(Array); + DeclareKindCase(RuntimeArray); + DeclareKindCase(Struct); + DeclareKindCase(Opaque); + DeclareKindCase(Pointer); + DeclareKindCase(Function); + DeclareKindCase(Event); + DeclareKindCase(DeviceEvent); + DeclareKindCase(ReserveId); + DeclareKindCase(Queue); + DeclareKindCase(Pipe); + DeclareKindCase(ForwardPointer); + DeclareKindCase(PipeStorage); + DeclareKindCase(NamedBarrier); +#undef DeclareKindCase + default: + assert(false && "Unhandled type"); + } + return type; +} + +std::unique_ptr Type::RemoveDecorations() const { + std::unique_ptr type(Clone()); + type->ClearDecorations(); + return type; +} + +bool Type::operator==(const Type& other) const { + if (kind_ != other.kind_) return false; + + switch (kind_) { +#define DeclareKindCase(kind) \ + case k##kind: \ + return As##kind()->IsSame(&other); + DeclareKindCase(Void); + DeclareKindCase(Bool); + DeclareKindCase(Integer); + DeclareKindCase(Float); + DeclareKindCase(Vector); + DeclareKindCase(Matrix); + DeclareKindCase(Image); + DeclareKindCase(Sampler); + DeclareKindCase(SampledImage); + DeclareKindCase(Array); + DeclareKindCase(RuntimeArray); + DeclareKindCase(Struct); + DeclareKindCase(Opaque); + DeclareKindCase(Pointer); + DeclareKindCase(Function); + DeclareKindCase(Event); + DeclareKindCase(DeviceEvent); + DeclareKindCase(ReserveId); + DeclareKindCase(Queue); + DeclareKindCase(Pipe); + DeclareKindCase(ForwardPointer); + DeclareKindCase(PipeStorage); + DeclareKindCase(NamedBarrier); +#undef DeclareKindCase + default: + assert(false && "Unhandled type"); + return false; + } +} + +void Type::GetHashWords(std::vector* words, + std::unordered_set* seen) const { + if (!seen->insert(this).second) { + return; + } + + words->push_back(kind_); + for (const auto& d : decorations_) { + for (auto w : d) { + words->push_back(w); + } + } + + switch (kind_) { +#define DeclareKindCase(type) \ + case k##type: \ + As##type()->GetExtraHashWords(words, seen); \ + break; + DeclareKindCase(Void); + DeclareKindCase(Bool); + DeclareKindCase(Integer); + DeclareKindCase(Float); + DeclareKindCase(Vector); + DeclareKindCase(Matrix); + DeclareKindCase(Image); + DeclareKindCase(Sampler); + DeclareKindCase(SampledImage); + DeclareKindCase(Array); + DeclareKindCase(RuntimeArray); + DeclareKindCase(Struct); + DeclareKindCase(Opaque); + DeclareKindCase(Pointer); + DeclareKindCase(Function); + DeclareKindCase(Event); + DeclareKindCase(DeviceEvent); + DeclareKindCase(ReserveId); + DeclareKindCase(Queue); + DeclareKindCase(Pipe); + DeclareKindCase(ForwardPointer); + DeclareKindCase(PipeStorage); + DeclareKindCase(NamedBarrier); +#undef DeclareKindCase + default: + assert(false && "Unhandled type"); + break; + } + + seen->erase(this); +} + +size_t Type::HashValue() const { + std::u32string h; + std::vector words; + GetHashWords(&words); + for (auto w : words) { + h.push_back(w); + } + + return std::hash()(h); +} + +bool Integer::IsSameImpl(const Type* that, IsSameCache*) const { + const Integer* it = that->AsInteger(); + return it && width_ == it->width_ && signed_ == it->signed_ && + HasSameDecorations(that); +} + +std::string Integer::str() const { + std::ostringstream oss; + oss << (signed_ ? "s" : "u") << "int" << width_; + return oss.str(); +} + +void Integer::GetExtraHashWords(std::vector* words, + std::unordered_set*) const { + words->push_back(width_); + words->push_back(signed_); +} + +bool Float::IsSameImpl(const Type* that, IsSameCache*) const { + const Float* ft = that->AsFloat(); + return ft && width_ == ft->width_ && HasSameDecorations(that); +} + +std::string Float::str() const { + std::ostringstream oss; + oss << "float" << width_; + return oss.str(); +} + +void Float::GetExtraHashWords(std::vector* words, + std::unordered_set*) const { + words->push_back(width_); +} + +Vector::Vector(Type* type, uint32_t count) + : Type(kVector), element_type_(type), count_(count) { + assert(type->AsBool() || type->AsInteger() || type->AsFloat()); +} + +bool Vector::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Vector* vt = that->AsVector(); + if (!vt) return false; + return count_ == vt->count_ && + element_type_->IsSameImpl(vt->element_type_, seen) && + HasSameDecorations(that); +} + +std::string Vector::str() const { + std::ostringstream oss; + oss << "<" << element_type_->str() << ", " << count_ << ">"; + return oss.str(); +} + +void Vector::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + element_type_->GetHashWords(words, seen); + words->push_back(count_); +} + +Matrix::Matrix(Type* type, uint32_t count) + : Type(kMatrix), element_type_(type), count_(count) { + assert(type->AsVector()); +} + +bool Matrix::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Matrix* mt = that->AsMatrix(); + if (!mt) return false; + return count_ == mt->count_ && + element_type_->IsSameImpl(mt->element_type_, seen) && + HasSameDecorations(that); +} + +std::string Matrix::str() const { + std::ostringstream oss; + oss << "<" << element_type_->str() << ", " << count_ << ">"; + return oss.str(); +} + +void Matrix::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + element_type_->GetHashWords(words, seen); + words->push_back(count_); +} + +Image::Image(Type* type, SpvDim dimen, uint32_t d, bool array, bool multisample, + uint32_t sampling, SpvImageFormat f, SpvAccessQualifier qualifier) + : Type(kImage), + sampled_type_(type), + dim_(dimen), + depth_(d), + arrayed_(array), + ms_(multisample), + sampled_(sampling), + format_(f), + access_qualifier_(qualifier) { + // TODO(antiagainst): check sampled_type +} + +bool Image::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Image* it = that->AsImage(); + if (!it) return false; + return dim_ == it->dim_ && depth_ == it->depth_ && arrayed_ == it->arrayed_ && + ms_ == it->ms_ && sampled_ == it->sampled_ && format_ == it->format_ && + access_qualifier_ == it->access_qualifier_ && + sampled_type_->IsSameImpl(it->sampled_type_, seen) && + HasSameDecorations(that); +} + +std::string Image::str() const { + std::ostringstream oss; + oss << "image(" << sampled_type_->str() << ", " << dim_ << ", " << depth_ + << ", " << arrayed_ << ", " << ms_ << ", " << sampled_ << ", " << format_ + << ", " << access_qualifier_ << ")"; + return oss.str(); +} + +void Image::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + sampled_type_->GetHashWords(words, seen); + words->push_back(dim_); + words->push_back(depth_); + words->push_back(arrayed_); + words->push_back(ms_); + words->push_back(sampled_); + words->push_back(format_); + words->push_back(access_qualifier_); +} + +bool SampledImage::IsSameImpl(const Type* that, IsSameCache* seen) const { + const SampledImage* sit = that->AsSampledImage(); + if (!sit) return false; + return image_type_->IsSameImpl(sit->image_type_, seen) && + HasSameDecorations(that); +} + +std::string SampledImage::str() const { + std::ostringstream oss; + oss << "sampled_image(" << image_type_->str() << ")"; + return oss.str(); +} + +void SampledImage::GetExtraHashWords( + std::vector* words, std::unordered_set* seen) const { + image_type_->GetHashWords(words, seen); +} + +Array::Array(Type* type, uint32_t length_id) + : Type(kArray), element_type_(type), length_id_(length_id) { + assert(!type->AsVoid()); +} + +bool Array::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Array* at = that->AsArray(); + if (!at) return false; + return length_id_ == at->length_id_ && + element_type_->IsSameImpl(at->element_type_, seen) && + HasSameDecorations(that); +} + +std::string Array::str() const { + std::ostringstream oss; + oss << "[" << element_type_->str() << ", id(" << length_id_ << ")]"; + return oss.str(); +} + +void Array::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + element_type_->GetHashWords(words, seen); + words->push_back(length_id_); +} + +void Array::ReplaceElementType(const Type* type) { element_type_ = type; } + +RuntimeArray::RuntimeArray(Type* type) + : Type(kRuntimeArray), element_type_(type) { + assert(!type->AsVoid()); +} + +bool RuntimeArray::IsSameImpl(const Type* that, IsSameCache* seen) const { + const RuntimeArray* rat = that->AsRuntimeArray(); + if (!rat) return false; + return element_type_->IsSameImpl(rat->element_type_, seen) && + HasSameDecorations(that); +} + +std::string RuntimeArray::str() const { + std::ostringstream oss; + oss << "[" << element_type_->str() << "]"; + return oss.str(); +} + +void RuntimeArray::GetExtraHashWords( + std::vector* words, std::unordered_set* seen) const { + element_type_->GetHashWords(words, seen); +} + +void RuntimeArray::ReplaceElementType(const Type* type) { + element_type_ = type; +} + +Struct::Struct(const std::vector& types) + : Type(kStruct), element_types_(types) { + for (const auto* t : types) { + (void)t; + assert(!t->AsVoid()); + } +} + +void Struct::AddMemberDecoration(uint32_t index, + std::vector&& decoration) { + if (index >= element_types_.size()) { + assert(0 && "index out of bound"); + return; + } + + element_decorations_[index].push_back(std::move(decoration)); +} + +bool Struct::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Struct* st = that->AsStruct(); + if (!st) return false; + if (element_types_.size() != st->element_types_.size()) return false; + const auto size = element_decorations_.size(); + if (size != st->element_decorations_.size()) return false; + if (!HasSameDecorations(that)) return false; + + for (size_t i = 0; i < element_types_.size(); ++i) { + if (!element_types_[i]->IsSameImpl(st->element_types_[i], seen)) + return false; + } + for (const auto& p : element_decorations_) { + if (st->element_decorations_.count(p.first) == 0) return false; + if (!CompareTwoVectors(p.second, st->element_decorations_.at(p.first))) + return false; + } + return true; +} + +std::string Struct::str() const { + std::ostringstream oss; + oss << "{"; + const size_t count = element_types_.size(); + for (size_t i = 0; i < count; ++i) { + oss << element_types_[i]->str(); + if (i + 1 != count) oss << ", "; + } + oss << "}"; + return oss.str(); +} + +void Struct::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + for (auto* t : element_types_) { + t->GetHashWords(words, seen); + } + for (const auto& pair : element_decorations_) { + words->push_back(pair.first); + for (const auto& d : pair.second) { + for (auto w : d) { + words->push_back(w); + } + } + } +} + +bool Opaque::IsSameImpl(const Type* that, IsSameCache*) const { + const Opaque* ot = that->AsOpaque(); + if (!ot) return false; + return name_ == ot->name_ && HasSameDecorations(that); +} + +std::string Opaque::str() const { + std::ostringstream oss; + oss << "opaque('" << name_ << "')"; + return oss.str(); +} + +void Opaque::GetExtraHashWords(std::vector* words, + std::unordered_set*) const { + for (auto c : name_) { + words->push_back(static_cast(c)); + } +} + +Pointer::Pointer(const Type* type, SpvStorageClass sc) + : Type(kPointer), pointee_type_(type), storage_class_(sc) {} + +bool Pointer::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Pointer* pt = that->AsPointer(); + if (!pt) return false; + if (storage_class_ != pt->storage_class_) return false; + auto p = seen->insert(std::make_pair(this, that->AsPointer())); + if (!p.second) { + return true; + } + bool same_pointee = pointee_type_->IsSameImpl(pt->pointee_type_, seen); + seen->erase(p.first); + if (!same_pointee) { + return false; + } + return HasSameDecorations(that); +} + +std::string Pointer::str() const { return pointee_type_->str() + "*"; } + +void Pointer::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + pointee_type_->GetHashWords(words, seen); + words->push_back(storage_class_); +} + +void Pointer::SetPointeeType(const Type* type) { pointee_type_ = type; } + +Function::Function(Type* ret_type, const std::vector& params) + : Type(kFunction), return_type_(ret_type), param_types_(params) { + for (auto* t : params) { + (void)t; + assert(!t->AsVoid()); + } +} + +bool Function::IsSameImpl(const Type* that, IsSameCache* seen) const { + const Function* ft = that->AsFunction(); + if (!ft) return false; + if (!return_type_->IsSameImpl(ft->return_type_, seen)) return false; + if (param_types_.size() != ft->param_types_.size()) return false; + for (size_t i = 0; i < param_types_.size(); ++i) { + if (!param_types_[i]->IsSameImpl(ft->param_types_[i], seen)) return false; + } + return HasSameDecorations(that); +} + +std::string Function::str() const { + std::ostringstream oss; + const size_t count = param_types_.size(); + oss << "("; + for (size_t i = 0; i < count; ++i) { + oss << param_types_[i]->str(); + if (i + 1 != count) oss << ", "; + } + oss << ") -> " << return_type_->str(); + return oss.str(); +} + +void Function::GetExtraHashWords(std::vector* words, + std::unordered_set* seen) const { + return_type_->GetHashWords(words, seen); + for (const auto* t : param_types_) { + t->GetHashWords(words, seen); + } +} + +void Function::SetReturnType(const Type* type) { return_type_ = type; } + +bool Pipe::IsSameImpl(const Type* that, IsSameCache*) const { + const Pipe* pt = that->AsPipe(); + if (!pt) return false; + return access_qualifier_ == pt->access_qualifier_ && HasSameDecorations(that); +} + +std::string Pipe::str() const { + std::ostringstream oss; + oss << "pipe(" << access_qualifier_ << ")"; + return oss.str(); +} + +void Pipe::GetExtraHashWords(std::vector* words, + std::unordered_set*) const { + words->push_back(access_qualifier_); +} + +bool ForwardPointer::IsSameImpl(const Type* that, IsSameCache*) const { + const ForwardPointer* fpt = that->AsForwardPointer(); + if (!fpt) return false; + return target_id_ == fpt->target_id_ && + storage_class_ == fpt->storage_class_ && HasSameDecorations(that); +} + +std::string ForwardPointer::str() const { + std::ostringstream oss; + oss << "forward_pointer("; + if (pointer_ != nullptr) { + oss << pointer_->str(); + } else { + oss << target_id_; + } + oss << ")"; + return oss.str(); +} + +void ForwardPointer::GetExtraHashWords( + std::vector* words, std::unordered_set* seen) const { + words->push_back(target_id_); + words->push_back(storage_class_); + if (pointer_) pointer_->GetHashWords(words, seen); +} + +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/types.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/types.h new file mode 100644 index 00000000000..625f342a689 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/types.h @@ -0,0 +1,603 @@ +// Copyright (c) 2016 Google 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. + +// This file provides a class hierarchy for representing SPIR-V types. + +#ifndef SOURCE_OPT_TYPES_H_ +#define SOURCE_OPT_TYPES_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/latest_version_spirv_header.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace opt { +namespace analysis { + +class Void; +class Bool; +class Integer; +class Float; +class Vector; +class Matrix; +class Image; +class Sampler; +class SampledImage; +class Array; +class RuntimeArray; +class Struct; +class Opaque; +class Pointer; +class Function; +class Event; +class DeviceEvent; +class ReserveId; +class Queue; +class Pipe; +class ForwardPointer; +class PipeStorage; +class NamedBarrier; + +// Abstract class for a SPIR-V type. It has a bunch of As() methods, +// which is used as a way to probe the actual . +class Type { + public: + typedef std::set> IsSameCache; + + // Available subtypes. + // + // When adding a new derived class of Type, please add an entry to the enum. + enum Kind { + kVoid, + kBool, + kInteger, + kFloat, + kVector, + kMatrix, + kImage, + kSampler, + kSampledImage, + kArray, + kRuntimeArray, + kStruct, + kOpaque, + kPointer, + kFunction, + kEvent, + kDeviceEvent, + kReserveId, + kQueue, + kPipe, + kForwardPointer, + kPipeStorage, + kNamedBarrier, + }; + + Type(Kind k) : kind_(k) {} + + virtual ~Type() {} + + // Attaches a decoration directly on this type. + void AddDecoration(std::vector&& d) { + decorations_.push_back(std::move(d)); + } + // Returns the decorations on this type as a string. + std::string GetDecorationStr() const; + // Returns true if this type has exactly the same decorations as |that| type. + bool HasSameDecorations(const Type* that) const; + // Returns true if this type is exactly the same as |that| type, including + // decorations. + bool IsSame(const Type* that) const { + IsSameCache seen; + return IsSameImpl(that, &seen); + } + + // Returns true if this type is exactly the same as |that| type, including + // decorations. |seen| is the set of |Pointer*| pair that are currently being + // compared in a parent call to |IsSameImpl|. + virtual bool IsSameImpl(const Type* that, IsSameCache* seen) const = 0; + + // Returns a human-readable string to represent this type. + virtual std::string str() const = 0; + + Kind kind() const { return kind_; } + const std::vector>& decorations() const { + return decorations_; + } + + // Returns true if there is no decoration on this type. For struct types, + // returns true only when there is no decoration for both the struct type + // and the struct members. + virtual bool decoration_empty() const { return decorations_.empty(); } + + // Creates a clone of |this|. + std::unique_ptr Clone() const; + + // Returns a clone of |this| minus any decorations. + std::unique_ptr RemoveDecorations() const; + + // Returns true if this type must be unique. + // + // If variable pointers are allowed, then pointers are not required to be + // unique. + // TODO(alanbaker): Update this if variable pointers become a core feature. + bool IsUniqueType(bool allowVariablePointers = false) const; + +// A bunch of methods for casting this type to a given type. Returns this if the +// cast can be done, nullptr otherwise. +#define DeclareCastMethod(target) \ + virtual target* As##target() { return nullptr; } \ + virtual const target* As##target() const { return nullptr; } + DeclareCastMethod(Void); + DeclareCastMethod(Bool); + DeclareCastMethod(Integer); + DeclareCastMethod(Float); + DeclareCastMethod(Vector); + DeclareCastMethod(Matrix); + DeclareCastMethod(Image); + DeclareCastMethod(Sampler); + DeclareCastMethod(SampledImage); + DeclareCastMethod(Array); + DeclareCastMethod(RuntimeArray); + DeclareCastMethod(Struct); + DeclareCastMethod(Opaque); + DeclareCastMethod(Pointer); + DeclareCastMethod(Function); + DeclareCastMethod(Event); + DeclareCastMethod(DeviceEvent); + DeclareCastMethod(ReserveId); + DeclareCastMethod(Queue); + DeclareCastMethod(Pipe); + DeclareCastMethod(ForwardPointer); + DeclareCastMethod(PipeStorage); + DeclareCastMethod(NamedBarrier); +#undef DeclareCastMethod + + bool operator==(const Type& other) const; + + // Returns the hash value of this type. + size_t HashValue() const; + + // Adds the necessary words to compute a hash value of this type to |words|. + void GetHashWords(std::vector* words) const { + std::unordered_set seen; + GetHashWords(words, &seen); + } + + // Adds the necessary words to compute a hash value of this type to |words|. + void GetHashWords(std::vector* words, + std::unordered_set* seen) const; + + // Adds necessary extra words for a subtype to calculate a hash value into + // |words|. + virtual void GetExtraHashWords( + std::vector* words, + std::unordered_set* pSet) const = 0; + + protected: + // Decorations attached to this type. Each decoration is encoded as a vector + // of uint32_t numbers. The first uint32_t number is the decoration value, + // and the rest are the parameters to the decoration (if exists). + std::vector> decorations_; + + private: + // Removes decorations on this type. For struct types, also removes element + // decorations. + virtual void ClearDecorations() { decorations_.clear(); } + + Kind kind_; +}; + +class Integer : public Type { + public: + Integer(uint32_t w, bool is_signed) + : Type(kInteger), width_(w), signed_(is_signed) {} + Integer(const Integer&) = default; + + std::string str() const override; + + Integer* AsInteger() override { return this; } + const Integer* AsInteger() const override { return this; } + uint32_t width() const { return width_; } + bool IsSigned() const { return signed_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + uint32_t width_; // bit width + bool signed_; // true if this integer is signed +}; + +class Float : public Type { + public: + Float(uint32_t w) : Type(kFloat), width_(w) {} + Float(const Float&) = default; + + std::string str() const override; + + Float* AsFloat() override { return this; } + const Float* AsFloat() const override { return this; } + uint32_t width() const { return width_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + uint32_t width_; // bit width +}; + +class Vector : public Type { + public: + Vector(Type* element_type, uint32_t count); + Vector(const Vector&) = default; + + std::string str() const override; + const Type* element_type() const { return element_type_; } + uint32_t element_count() const { return count_; } + + Vector* AsVector() override { return this; } + const Vector* AsVector() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* element_type_; + uint32_t count_; +}; + +class Matrix : public Type { + public: + Matrix(Type* element_type, uint32_t count); + Matrix(const Matrix&) = default; + + std::string str() const override; + const Type* element_type() const { return element_type_; } + uint32_t element_count() const { return count_; } + + Matrix* AsMatrix() override { return this; } + const Matrix* AsMatrix() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* element_type_; + uint32_t count_; +}; + +class Image : public Type { + public: + Image(Type* type, SpvDim dimen, uint32_t d, bool array, bool multisample, + uint32_t sampling, SpvImageFormat f, + SpvAccessQualifier qualifier = SpvAccessQualifierReadOnly); + Image(const Image&) = default; + + std::string str() const override; + + Image* AsImage() override { return this; } + const Image* AsImage() const override { return this; } + + const Type* sampled_type() const { return sampled_type_; } + SpvDim dim() const { return dim_; } + uint32_t depth() const { return depth_; } + bool is_arrayed() const { return arrayed_; } + bool is_multisampled() const { return ms_; } + uint32_t sampled() const { return sampled_; } + SpvImageFormat format() const { return format_; } + SpvAccessQualifier access_qualifier() const { return access_qualifier_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + Type* sampled_type_; + SpvDim dim_; + uint32_t depth_; + bool arrayed_; + bool ms_; + uint32_t sampled_; + SpvImageFormat format_; + SpvAccessQualifier access_qualifier_; +}; + +class SampledImage : public Type { + public: + SampledImage(Type* image) : Type(kSampledImage), image_type_(image) {} + SampledImage(const SampledImage&) = default; + + std::string str() const override; + + SampledImage* AsSampledImage() override { return this; } + const SampledImage* AsSampledImage() const override { return this; } + + const Type* image_type() const { return image_type_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + Type* image_type_; +}; + +class Array : public Type { + public: + Array(Type* element_type, uint32_t length_id); + Array(const Array&) = default; + + std::string str() const override; + const Type* element_type() const { return element_type_; } + uint32_t LengthId() const { return length_id_; } + + Array* AsArray() override { return this; } + const Array* AsArray() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + void ReplaceElementType(const Type* element_type); + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* element_type_; + uint32_t length_id_; +}; + +class RuntimeArray : public Type { + public: + RuntimeArray(Type* element_type); + RuntimeArray(const RuntimeArray&) = default; + + std::string str() const override; + const Type* element_type() const { return element_type_; } + + RuntimeArray* AsRuntimeArray() override { return this; } + const RuntimeArray* AsRuntimeArray() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + void ReplaceElementType(const Type* element_type); + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* element_type_; +}; + +class Struct : public Type { + public: + Struct(const std::vector& element_types); + Struct(const Struct&) = default; + + // Adds a decoration to the member at the given index. The first word is the + // decoration enum, and the remaining words, if any, are its operands. + void AddMemberDecoration(uint32_t index, std::vector&& decoration); + + std::string str() const override; + const std::vector& element_types() const { + return element_types_; + } + std::vector& element_types() { return element_types_; } + bool decoration_empty() const override { + return decorations_.empty() && element_decorations_.empty(); + } + + const std::map>>& + element_decorations() const { + return element_decorations_; + } + + Struct* AsStruct() override { return this; } + const Struct* AsStruct() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + void ClearDecorations() override { + decorations_.clear(); + element_decorations_.clear(); + } + + std::vector element_types_; + // We can attach decorations to struct members and that should not affect the + // underlying element type. So we need an extra data structure here to keep + // track of element type decorations. They must be stored in an ordered map + // because |GetExtraHashWords| will traverse the structure. It must have a + // fixed order in order to hash to the same value every time. + std::map>> element_decorations_; +}; + +class Opaque : public Type { + public: + Opaque(std::string n) : Type(kOpaque), name_(std::move(n)) {} + Opaque(const Opaque&) = default; + + std::string str() const override; + + Opaque* AsOpaque() override { return this; } + const Opaque* AsOpaque() const override { return this; } + + const std::string& name() const { return name_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + std::string name_; +}; + +class Pointer : public Type { + public: + Pointer(const Type* pointee, SpvStorageClass sc); + Pointer(const Pointer&) = default; + + std::string str() const override; + const Type* pointee_type() const { return pointee_type_; } + SpvStorageClass storage_class() const { return storage_class_; } + + Pointer* AsPointer() override { return this; } + const Pointer* AsPointer() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + void SetPointeeType(const Type* type); + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* pointee_type_; + SpvStorageClass storage_class_; +}; + +class Function : public Type { + public: + Function(Type* ret_type, const std::vector& params); + Function(const Function&) = default; + + std::string str() const override; + + Function* AsFunction() override { return this; } + const Function* AsFunction() const override { return this; } + + const Type* return_type() const { return return_type_; } + const std::vector& param_types() const { return param_types_; } + std::vector& param_types() { return param_types_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set*) const override; + + void SetReturnType(const Type* type); + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + const Type* return_type_; + std::vector param_types_; +}; + +class Pipe : public Type { + public: + Pipe(SpvAccessQualifier qualifier) + : Type(kPipe), access_qualifier_(qualifier) {} + Pipe(const Pipe&) = default; + + std::string str() const override; + + Pipe* AsPipe() override { return this; } + const Pipe* AsPipe() const override { return this; } + + SpvAccessQualifier access_qualifier() const { return access_qualifier_; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + SpvAccessQualifier access_qualifier_; +}; + +class ForwardPointer : public Type { + public: + ForwardPointer(uint32_t id, SpvStorageClass sc) + : Type(kForwardPointer), + target_id_(id), + storage_class_(sc), + pointer_(nullptr) {} + ForwardPointer(const ForwardPointer&) = default; + + uint32_t target_id() const { return target_id_; } + void SetTargetPointer(const Pointer* pointer) { pointer_ = pointer; } + SpvStorageClass storage_class() const { return storage_class_; } + const Pointer* target_pointer() const { return pointer_; } + + std::string str() const override; + + ForwardPointer* AsForwardPointer() override { return this; } + const ForwardPointer* AsForwardPointer() const override { return this; } + + void GetExtraHashWords(std::vector* words, + std::unordered_set* pSet) const override; + + private: + bool IsSameImpl(const Type* that, IsSameCache*) const override; + + uint32_t target_id_; + SpvStorageClass storage_class_; + const Pointer* pointer_; +}; + +#define DefineParameterlessType(type, name) \ + class type : public Type { \ + public: \ + type() : Type(k##type) {} \ + type(const type&) = default; \ + \ + std::string str() const override { return #name; } \ + \ + type* As##type() override { return this; } \ + const type* As##type() const override { return this; } \ + \ + void GetExtraHashWords(std::vector*, \ + std::unordered_set*) const override {} \ + \ + private: \ + bool IsSameImpl(const Type* that, IsSameCache*) const override { \ + return that->As##type() && HasSameDecorations(that); \ + } \ + } +DefineParameterlessType(Void, void); +DefineParameterlessType(Bool, bool); +DefineParameterlessType(Sampler, sampler); +DefineParameterlessType(Event, event); +DefineParameterlessType(DeviceEvent, device_event); +DefineParameterlessType(ReserveId, reserve_id); +DefineParameterlessType(Queue, queue); +DefineParameterlessType(PipeStorage, pipe_storage); +DefineParameterlessType(NamedBarrier, named_barrier); +#undef DefineParameterlessType + +} // namespace analysis +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_TYPES_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp new file mode 100644 index 00000000000..227fd61da2b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.cpp @@ -0,0 +1,177 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/unify_const_pass.h" + +#include +#include +#include +#include + +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { + +namespace { + +// The trie that stores a bunch of result ids and, for a given instruction, +// searches the result id that has been defined with the same opcode, type and +// operands. +class ResultIdTrie { + public: + ResultIdTrie() : root_(new Node) {} + + // For a given instruction, extracts its opcode, type id and operand words + // as an array of keys, looks up the trie to find a result id which is stored + // with the same opcode, type id and operand words. If none of such result id + // is found, creates a trie node with those keys, stores the instruction's + // result id and returns that result id. If an existing result id is found, + // returns the existing result id. + uint32_t LookupEquivalentResultFor(const Instruction& inst) { + auto keys = GetLookUpKeys(inst); + auto* node = root_.get(); + for (uint32_t key : keys) { + node = node->GetOrCreateTrieNodeFor(key); + } + if (node->result_id() == 0) { + node->SetResultId(inst.result_id()); + } + return node->result_id(); + } + + private: + // The trie node to store result ids. + class Node { + public: + using TrieNodeMap = std::unordered_map>; + + Node() : result_id_(0), next_() {} + uint32_t result_id() const { return result_id_; } + + // Sets the result id stored in this node. + void SetResultId(uint32_t id) { result_id_ = id; } + + // Searches for the child trie node with the given key. If the node is + // found, returns that node. Otherwise creates an empty child node with + // that key and returns that newly created node. + Node* GetOrCreateTrieNodeFor(uint32_t key) { + auto iter = next_.find(key); + if (iter == next_.end()) { + // insert a new node and return the node. + return next_.insert(std::make_pair(key, MakeUnique())) + .first->second.get(); + } + return iter->second.get(); + } + + private: + // The result id stored in this node. 0 means this node is empty. + uint32_t result_id_; + // The mapping from the keys to the child nodes of this node. + TrieNodeMap next_; + }; + + // Returns a vector of the opcode followed by the words in the raw SPIR-V + // instruction encoding but without the result id. + std::vector GetLookUpKeys(const Instruction& inst) { + std::vector keys; + // Need to use the opcode, otherwise there might be a conflict with the + // following case when 's binary value equals xx's id: + // OpSpecConstantOp tt yy zz + // OpSpecConstantComposite tt xx yy zz; + keys.push_back(static_cast(inst.opcode())); + for (const auto& operand : inst) { + if (operand.type == SPV_OPERAND_TYPE_RESULT_ID) continue; + keys.insert(keys.end(), operand.words.cbegin(), operand.words.cend()); + } + return keys; + } + + std::unique_ptr root_; // The root node of the trie. +}; +} // anonymous namespace + +Pass::Status UnifyConstantPass::Process() { + bool modified = false; + ResultIdTrie defined_constants; + + for (Instruction *next_instruction, + *inst = &*(context()->types_values_begin()); + inst; inst = next_instruction) { + next_instruction = inst->NextNode(); + + // Do not handle the instruction when there are decorations upon the result + // id. + if (get_def_use_mgr()->GetAnnotations(inst->result_id()).size() != 0) { + continue; + } + + // The overall algorithm is to store the result ids of all the eligible + // constants encountered so far in a trie. For a constant defining + // instruction under consideration, use its opcode, result type id and + // words in operands as an array of keys to lookup the trie. If a result id + // can be found for that array of keys, a constant with exactly the same + // value must has been defined before, the constant under processing + // should be replaced by the constant previously defined. If no such result + // id can be found for that array of keys, this must be the first time a + // constant with its value be defined, we then create a new trie node to + // store the result id with the keys. When replacing a duplicated constant + // with a previously defined constant, all the uses of the duplicated + // constant, which must be placed after the duplicated constant defining + // instruction, will be updated. This way, the descendants of the + // previously defined constant and the duplicated constant will both refer + // to the previously defined constant. So that the operand ids which are + // used in key arrays will be the ids of the unified constants, when + // processing is up to a descendant. This makes comparing the key array + // always valid for judging duplication. + switch (inst->opcode()) { + case SpvOp::SpvOpConstantTrue: + case SpvOp::SpvOpConstantFalse: + case SpvOp::SpvOpConstant: + case SpvOp::SpvOpConstantNull: + case SpvOp::SpvOpConstantSampler: + case SpvOp::SpvOpConstantComposite: + // Only spec constants defined with OpSpecConstantOp and + // OpSpecConstantComposite should be processed in this pass. Spec + // constants defined with OpSpecConstant{|True|False} are decorated with + // 'SpecId' decoration and all of them should be treated as unique. + // 'SpecId' is not applicable to SpecConstants defined with + // OpSpecConstant{Op|Composite}, their values are not necessary to be + // unique. When all the operands/compoents are the same between two + // OpSpecConstant{Op|Composite} results, their result values must be the + // same so are unifiable. + case SpvOp::SpvOpSpecConstantOp: + case SpvOp::SpvOpSpecConstantComposite: { + uint32_t id = defined_constants.LookupEquivalentResultFor(*inst); + if (id != inst->result_id()) { + // The constant is a duplicated one, use the cached constant to + // replace the uses of this duplicated one, then turn it to nop. + context()->ReplaceAllUsesWith(inst->result_id(), id); + context()->KillInst(inst); + modified = true; + } + break; + } + default: + break; + } + } + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.h new file mode 100644 index 00000000000..f2b7897ccd2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/unify_const_pass.h @@ -0,0 +1,35 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_OPT_UNIFY_CONST_PASS_H_ +#define SOURCE_OPT_UNIFY_CONST_PASS_H_ + +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class UnifyConstantPass : public Pass { + public: + const char* name() const override { return "unify-const"; } + Status Process() override; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_UNIFY_CONST_PASS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp new file mode 100644 index 00000000000..1bac63fabe2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.cpp @@ -0,0 +1,227 @@ +// Copyright (c) 2017 Google 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. + +#include "source/opt/value_number_table.h" + +#include + +#include "source/opt/cfg.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { + +uint32_t ValueNumberTable::GetValueNumber(Instruction* inst) const { + assert(inst->result_id() != 0 && + "inst must have a result id to get a value number."); + + // Check if this instruction already has a value. + auto result_id_to_val = id_to_value_.find(inst->result_id()); + if (result_id_to_val != id_to_value_.end()) { + return result_id_to_val->second; + } + return 0; +} + +uint32_t ValueNumberTable::GetValueNumber(uint32_t id) const { + return GetValueNumber(context()->get_def_use_mgr()->GetDef(id)); +} + +uint32_t ValueNumberTable::AssignValueNumber(Instruction* inst) { + // If it already has a value return that. + uint32_t value = GetValueNumber(inst); + if (value != 0) { + return value; + } + + // If the instruction has other side effects, then it must + // have its own value number. + // OpSampledImage and OpImage must remain in the same basic block in which + // they are used, because of this we will assign each one it own value number. + if (!context()->IsCombinatorInstruction(inst)) { + value = TakeNextValueNumber(); + id_to_value_[inst->result_id()] = value; + return value; + } + + switch (inst->opcode()) { + case SpvOpSampledImage: + case SpvOpImage: + case SpvOpVariable: + value = TakeNextValueNumber(); + id_to_value_[inst->result_id()] = value; + return value; + default: + break; + } + + // If it is a load from memory that can be modified, we have to assume the + // memory has been modified, so we give it a new value number. + // + // Note that this test will also handle volatile loads because they are not + // read only. However, if this is ever relaxed because we analyze stores, we + // will have to add a new case for volatile loads. + if (inst->IsLoad() && !inst->IsReadOnlyLoad()) { + value = TakeNextValueNumber(); + id_to_value_[inst->result_id()] = value; + return value; + } + + // When we copy an object, the value numbers should be the same. + if (inst->opcode() == SpvOpCopyObject) { + value = GetValueNumber(inst->GetSingleWordInOperand(0)); + if (value != 0) { + id_to_value_[inst->result_id()] = value; + return value; + } + } + + // Phi nodes are a type of copy. If all of the inputs have the same value + // number, then we can assign the result of the phi the same value number. + if (inst->opcode() == SpvOpPhi) { + value = GetValueNumber(inst->GetSingleWordInOperand(0)); + if (value != 0) { + for (uint32_t op = 2; op < inst->NumInOperands(); op += 2) { + if (value != GetValueNumber(inst->GetSingleWordInOperand(op))) { + value = 0; + break; + } + } + if (value != 0) { + id_to_value_[inst->result_id()] = value; + return value; + } + } + } + + // Replace all of the operands by their value number. The sign bit will be + // set to distinguish between an id and a value number. + Instruction value_ins(context(), inst->opcode(), inst->type_id(), + inst->result_id(), {}); + for (uint32_t o = 0; o < inst->NumInOperands(); ++o) { + const Operand& op = inst->GetInOperand(o); + if (spvIsIdType(op.type)) { + uint32_t id_value = op.words[0]; + auto use_id_to_val = id_to_value_.find(id_value); + if (use_id_to_val != id_to_value_.end()) { + id_value = (1 << 31) | use_id_to_val->second; + } + value_ins.AddOperand(Operand(op.type, {id_value})); + } else { + value_ins.AddOperand(Operand(op.type, op.words)); + } + } + + // TODO: Implement a normal form for opcodes that commute like integer + // addition. This will let us know that a+b is the same value as b+a. + + // Otherwise, we check if this value has been computed before. + auto value_iterator = instruction_to_value_.find(value_ins); + if (value_iterator != instruction_to_value_.end()) { + value = id_to_value_[value_iterator->first.result_id()]; + id_to_value_[inst->result_id()] = value; + return value; + } + + // If not, assign it a new value number. + value = TakeNextValueNumber(); + id_to_value_[inst->result_id()] = value; + instruction_to_value_[value_ins] = value; + return value; +} + +void ValueNumberTable::BuildDominatorTreeValueNumberTable() { + // First value number the headers. + for (auto& inst : context()->annotations()) { + if (inst.result_id() != 0) { + AssignValueNumber(&inst); + } + } + + for (auto& inst : context()->capabilities()) { + if (inst.result_id() != 0) { + AssignValueNumber(&inst); + } + } + + for (auto& inst : context()->types_values()) { + if (inst.result_id() != 0) { + AssignValueNumber(&inst); + } + } + + for (auto& inst : context()->module()->ext_inst_imports()) { + if (inst.result_id() != 0) { + AssignValueNumber(&inst); + } + } + + for (Function& func : *context()->module()) { + // For best results we want to traverse the code in reverse post order. + // This happens naturally because of the forward referencing rules. + for (BasicBlock& block : func) { + for (Instruction& inst : block) { + if (inst.result_id() != 0) { + AssignValueNumber(&inst); + } + } + } + } +} + +bool ComputeSameValue::operator()(const Instruction& lhs, + const Instruction& rhs) const { + if (lhs.result_id() == 0 || rhs.result_id() == 0) { + return false; + } + + if (lhs.opcode() != rhs.opcode()) { + return false; + } + + if (lhs.type_id() != rhs.type_id()) { + return false; + } + + if (lhs.NumInOperands() != rhs.NumInOperands()) { + return false; + } + + for (uint32_t i = 0; i < lhs.NumInOperands(); ++i) { + if (lhs.GetInOperand(i) != rhs.GetInOperand(i)) { + return false; + } + } + + return lhs.context()->get_decoration_mgr()->HaveTheSameDecorations( + lhs.result_id(), rhs.result_id()); +} + +std::size_t ValueTableHash::operator()(const Instruction& inst) const { + // We hash the opcode and in-operands, not the result, because we want + // instructions that are the same except for the result to hash to the + // same value. + std::u32string h; + h.push_back(inst.opcode()); + h.push_back(inst.type_id()); + for (uint32_t i = 0; i < inst.NumInOperands(); ++i) { + const auto& opnd = inst.GetInOperand(i); + for (uint32_t word : opnd.words) { + h.push_back(word); + } + } + return std::hash()(h); +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.h new file mode 100644 index 00000000000..39129ffa353 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/value_number_table.h @@ -0,0 +1,91 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_OPT_VALUE_NUMBER_TABLE_H_ +#define SOURCE_OPT_VALUE_NUMBER_TABLE_H_ + +#include +#include + +#include "source/opt/instruction.h" + +namespace spvtools { +namespace opt { + +class IRContext; + +// Returns true if the two instructions compute the same value. Used by the +// value number table to compare two instructions. +class ComputeSameValue { + public: + bool operator()(const Instruction& lhs, const Instruction& rhs) const; +}; + +// The hash function used in the value number table. +class ValueTableHash { + public: + std::size_t operator()(const Instruction& inst) const; +}; + +// This class implements the value number analysis. It is using a hash-based +// approach to value numbering. It is essentially doing dominator-tree value +// numbering described in +// +// Preston Briggs, Keith D. Cooper, and L. Taylor Simpson. 1997. Value +// numbering. Softw. Pract. Exper. 27, 6 (June 1997), 701-724. +// https://www.cs.rice.edu/~keith/Promo/CRPC-TR94517.pdf.gz +// +// The main difference is that because we do not perform redundancy elimination +// as we build the value number table, we do not have to deal with cleaning up +// the scope. +class ValueNumberTable { + public: + ValueNumberTable(IRContext* ctx) : context_(ctx), next_value_number_(1) { + BuildDominatorTreeValueNumberTable(); + } + + // Returns the value number of the value computed by |inst|. |inst| must have + // a result id that will hold the computed value. If no value number has been + // assigned to the result id, then the return value is 0. + uint32_t GetValueNumber(Instruction* inst) const; + + // Returns the value number of the value contain in |id|. Returns 0 if it + // has not been assigned a value number. + uint32_t GetValueNumber(uint32_t id) const; + + IRContext* context() const { return context_; } + + private: + // Assigns a value number to every result id in the module. + void BuildDominatorTreeValueNumberTable(); + + // Returns the new value number. + uint32_t TakeNextValueNumber() { return next_value_number_++; } + + // Assigns a new value number to the result of |inst| if it does not already + // have one. Return the value number for |inst|. |inst| must have a result + // id. + uint32_t AssignValueNumber(Instruction* inst); + + std::unordered_map + instruction_to_value_; + std::unordered_map id_to_value_; + IRContext* context_; + uint32_t next_value_number_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_VALUE_NUMBER_TABLE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp new file mode 100644 index 00000000000..911242e058a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.cpp @@ -0,0 +1,367 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/opt/vector_dce.h" + +#include + +namespace spvtools { +namespace opt { +namespace { + +const uint32_t kExtractCompositeIdInIdx = 0; +const uint32_t kInsertObjectIdInIdx = 0; +const uint32_t kInsertCompositeIdInIdx = 1; + +} // namespace + +Pass::Status VectorDCE::Process() { + bool modified = false; + for (Function& function : *get_module()) { + modified |= VectorDCEFunction(&function); + } + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool VectorDCE::VectorDCEFunction(Function* function) { + LiveComponentMap live_components; + FindLiveComponents(function, &live_components); + return RewriteInstructions(function, live_components); +} + +void VectorDCE::FindLiveComponents(Function* function, + LiveComponentMap* live_components) { + std::vector work_list; + + // Prime the work list. We will assume that any instruction that does + // not result in a vector is live. + // + // Extending to structures and matrices is not as straight forward because of + // the nesting. We cannot simply us a bit vector to keep track of which + // components are live because of arbitrary nesting of structs. + function->ForEachInst( + [&work_list, this, live_components](Instruction* current_inst) { + if (!HasVectorOrScalarResult(current_inst) || + !context()->IsCombinatorInstruction(current_inst)) { + MarkUsesAsLive(current_inst, all_components_live_, live_components, + &work_list); + } + }); + + // Process the work list propagating liveness. + for (uint32_t i = 0; i < work_list.size(); i++) { + WorkListItem current_item = work_list[i]; + Instruction* current_inst = current_item.instruction; + + switch (current_inst->opcode()) { + case SpvOpCompositeExtract: + MarkExtractUseAsLive(current_inst, live_components, &work_list); + break; + case SpvOpCompositeInsert: + MarkInsertUsesAsLive(current_item, live_components, &work_list); + break; + case SpvOpVectorShuffle: + MarkVectorShuffleUsesAsLive(current_item, live_components, &work_list); + break; + case SpvOpCompositeConstruct: + MarkCompositeContructUsesAsLive(current_item, live_components, + &work_list); + break; + default: + if (current_inst->IsScalarizable()) { + MarkUsesAsLive(current_inst, current_item.components, live_components, + &work_list); + } else { + MarkUsesAsLive(current_inst, all_components_live_, live_components, + &work_list); + } + break; + } + } +} + +void VectorDCE::MarkExtractUseAsLive(const Instruction* current_inst, + LiveComponentMap* live_components, + std::vector* work_list) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + uint32_t operand_id = + current_inst->GetSingleWordInOperand(kExtractCompositeIdInIdx); + Instruction* operand_inst = def_use_mgr->GetDef(operand_id); + + if (HasVectorOrScalarResult(operand_inst)) { + WorkListItem new_item; + new_item.instruction = operand_inst; + new_item.components.Set(current_inst->GetSingleWordInOperand(1)); + AddItemToWorkListIfNeeded(new_item, live_components, work_list); + } +} + +void VectorDCE::MarkInsertUsesAsLive( + const VectorDCE::WorkListItem& current_item, + LiveComponentMap* live_components, + std::vector* work_list) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + uint32_t insert_position = + current_item.instruction->GetSingleWordInOperand(2); + + // Add the elements of the composite object that are used. + uint32_t operand_id = + current_item.instruction->GetSingleWordInOperand(kInsertCompositeIdInIdx); + Instruction* operand_inst = def_use_mgr->GetDef(operand_id); + + WorkListItem new_item; + new_item.instruction = operand_inst; + new_item.components = current_item.components; + new_item.components.Clear(insert_position); + + AddItemToWorkListIfNeeded(new_item, live_components, work_list); + + // Add the element being inserted if it is used. + if (current_item.components.Get(insert_position)) { + uint32_t obj_operand_id = + current_item.instruction->GetSingleWordInOperand(kInsertObjectIdInIdx); + Instruction* obj_operand_inst = def_use_mgr->GetDef(obj_operand_id); + WorkListItem new_item_for_obj; + new_item_for_obj.instruction = obj_operand_inst; + new_item_for_obj.components.Set(0); + AddItemToWorkListIfNeeded(new_item_for_obj, live_components, work_list); + } +} + +void VectorDCE::MarkVectorShuffleUsesAsLive( + const WorkListItem& current_item, + VectorDCE::LiveComponentMap* live_components, + std::vector* work_list) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + WorkListItem first_operand; + first_operand.instruction = + def_use_mgr->GetDef(current_item.instruction->GetSingleWordInOperand(0)); + WorkListItem second_operand; + second_operand.instruction = + def_use_mgr->GetDef(current_item.instruction->GetSingleWordInOperand(1)); + + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + analysis::Vector* first_type = + type_mgr->GetType(first_operand.instruction->type_id())->AsVector(); + uint32_t size_of_first_operand = first_type->element_count(); + + for (uint32_t in_op = 2; in_op < current_item.instruction->NumInOperands(); + ++in_op) { + uint32_t index = current_item.instruction->GetSingleWordInOperand(in_op); + if (current_item.components.Get(in_op - 2)) { + if (index < size_of_first_operand) { + first_operand.components.Set(index); + } else { + second_operand.components.Set(index - size_of_first_operand); + } + } + } + + AddItemToWorkListIfNeeded(first_operand, live_components, work_list); + AddItemToWorkListIfNeeded(second_operand, live_components, work_list); +} + +void VectorDCE::MarkCompositeContructUsesAsLive( + VectorDCE::WorkListItem work_item, + VectorDCE::LiveComponentMap* live_components, + std::vector* work_list) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + + uint32_t current_component = 0; + Instruction* current_inst = work_item.instruction; + uint32_t num_in_operands = current_inst->NumInOperands(); + for (uint32_t i = 0; i < num_in_operands; ++i) { + uint32_t id = current_inst->GetSingleWordInOperand(i); + Instruction* op_inst = def_use_mgr->GetDef(id); + + if (HasScalarResult(op_inst)) { + WorkListItem new_work_item; + new_work_item.instruction = op_inst; + if (work_item.components.Get(current_component)) { + new_work_item.components.Set(0); + } + AddItemToWorkListIfNeeded(new_work_item, live_components, work_list); + current_component++; + } else { + assert(HasVectorResult(op_inst)); + WorkListItem new_work_item; + new_work_item.instruction = op_inst; + uint32_t op_vector_size = + type_mgr->GetType(op_inst->type_id())->AsVector()->element_count(); + + for (uint32_t op_vector_idx = 0; op_vector_idx < op_vector_size; + op_vector_idx++, current_component++) { + if (work_item.components.Get(current_component)) { + new_work_item.components.Set(op_vector_idx); + } + } + AddItemToWorkListIfNeeded(new_work_item, live_components, work_list); + } + } +} + +void VectorDCE::MarkUsesAsLive( + Instruction* current_inst, const utils::BitVector& live_elements, + LiveComponentMap* live_components, + std::vector* work_list) { + analysis::DefUseManager* def_use_mgr = context()->get_def_use_mgr(); + + current_inst->ForEachInId([&work_list, &live_elements, this, live_components, + def_use_mgr](uint32_t* operand_id) { + Instruction* operand_inst = def_use_mgr->GetDef(*operand_id); + + if (HasVectorResult(operand_inst)) { + WorkListItem new_item; + new_item.instruction = operand_inst; + new_item.components = live_elements; + AddItemToWorkListIfNeeded(new_item, live_components, work_list); + } else if (HasScalarResult(operand_inst)) { + WorkListItem new_item; + new_item.instruction = operand_inst; + new_item.components.Set(0); + AddItemToWorkListIfNeeded(new_item, live_components, work_list); + } + }); +} + +bool VectorDCE::HasVectorOrScalarResult(const Instruction* inst) const { + return HasScalarResult(inst) || HasVectorResult(inst); +} + +bool VectorDCE::HasVectorResult(const Instruction* inst) const { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + if (inst->type_id() == 0) { + return false; + } + + const analysis::Type* current_type = type_mgr->GetType(inst->type_id()); + switch (current_type->kind()) { + case analysis::Type::kVector: + return true; + default: + return false; + } +} + +bool VectorDCE::HasScalarResult(const Instruction* inst) const { + analysis::TypeManager* type_mgr = context()->get_type_mgr(); + if (inst->type_id() == 0) { + return false; + } + + const analysis::Type* current_type = type_mgr->GetType(inst->type_id()); + switch (current_type->kind()) { + case analysis::Type::kBool: + case analysis::Type::kInteger: + case analysis::Type::kFloat: + return true; + default: + return false; + } +} + +bool VectorDCE::RewriteInstructions( + Function* function, const VectorDCE::LiveComponentMap& live_components) { + bool modified = false; + function->ForEachInst( + [&modified, this, live_components](Instruction* current_inst) { + if (!context()->IsCombinatorInstruction(current_inst)) { + return; + } + + auto live_component = live_components.find(current_inst->result_id()); + if (live_component == live_components.end()) { + // If this instruction is not in live_components then it does not + // produce a vector, or it is never referenced and ADCE will remove + // it. No point in trying to differentiate. + return; + } + + // If no element in the current instruction is used replace it with an + // OpUndef. + if (live_component->second.Empty()) { + modified = true; + uint32_t undef_id = this->Type2Undef(current_inst->type_id()); + context()->KillNamesAndDecorates(current_inst); + context()->ReplaceAllUsesWith(current_inst->result_id(), undef_id); + context()->KillInst(current_inst); + return; + } + + switch (current_inst->opcode()) { + case SpvOpCompositeInsert: + modified |= + RewriteInsertInstruction(current_inst, live_component->second); + break; + case SpvOpCompositeConstruct: + // TODO: The members that are not live can be replaced by an undef + // or constant. This will remove uses of those values, and possibly + // create opportunities for ADCE. + break; + default: + // Do nothing. + break; + } + }); + return modified; +} + +bool VectorDCE::RewriteInsertInstruction( + Instruction* current_inst, const utils::BitVector& live_components) { + // If the value being inserted is not live, then we can skip the insert. + bool modified = false; + uint32_t insert_index = current_inst->GetSingleWordInOperand(2); + if (!live_components.Get(insert_index)) { + modified = true; + context()->KillNamesAndDecorates(current_inst->result_id()); + uint32_t composite_id = + current_inst->GetSingleWordInOperand(kInsertCompositeIdInIdx); + context()->ReplaceAllUsesWith(current_inst->result_id(), composite_id); + } + + // If the values already in the composite are not used, then replace it with + // an undef. + utils::BitVector temp = live_components; + temp.Clear(insert_index); + if (temp.Empty()) { + context()->ForgetUses(current_inst); + uint32_t undef_id = Type2Undef(current_inst->type_id()); + current_inst->SetInOperand(kInsertCompositeIdInIdx, {undef_id}); + context()->AnalyzeUses(current_inst); + } + + return modified; +} + +void VectorDCE::AddItemToWorkListIfNeeded( + WorkListItem work_item, VectorDCE::LiveComponentMap* live_components, + std::vector* work_list) { + Instruction* current_inst = work_item.instruction; + auto it = live_components->find(current_inst->result_id()); + if (it == live_components->end()) { + live_components->emplace( + std::make_pair(current_inst->result_id(), work_item.components)); + work_list->emplace_back(work_item); + } else { + if (it->second.Or(work_item.components)) { + work_list->emplace_back(work_item); + } + } +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.h new file mode 100644 index 00000000000..48886998da6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/vector_dce.h @@ -0,0 +1,149 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_OPT_VECTOR_DCE_H_ +#define SOURCE_OPT_VECTOR_DCE_H_ + +#include +#include + +#include "source/opt/mem_pass.h" +#include "source/util/bit_vector.h" + +namespace spvtools { +namespace opt { + +class VectorDCE : public MemPass { + private: + using LiveComponentMap = std::unordered_map; + + // According to the SPEC the maximum size for a vector is 16. See the data + // rules in the universal validation rules (section 2.16.1). + enum { kMaxVectorSize = 16 }; + + struct WorkListItem { + WorkListItem() : instruction(nullptr), components(kMaxVectorSize) {} + + Instruction* instruction; + utils::BitVector components; + }; + + public: + VectorDCE() : all_components_live_(kMaxVectorSize) { + for (uint32_t i = 0; i < kMaxVectorSize; i++) { + all_components_live_.Set(i); + } + } + + const char* name() const override { return "vector-dce"; } + Status Process() override; + + IRContext::Analysis GetPreservedAnalyses() override { + return IRContext::kAnalysisDefUse | IRContext::kAnalysisCFG | + IRContext::kAnalysisInstrToBlockMapping | + IRContext::kAnalysisLoopAnalysis | IRContext::kAnalysisDecorations | + IRContext::kAnalysisDominatorAnalysis | IRContext::kAnalysisNameMap; + } + + private: + // Runs the vector dce pass on |function|. Returns true if |function| was + // modified. + bool VectorDCEFunction(Function* function); + + // Identifies the live components of the vectors that are results of + // instructions in |function|. The results are stored in |live_components|. + void FindLiveComponents(Function* function, + LiveComponentMap* live_components); + + // Rewrites instructions in |function| that are dead or partially dead. If an + // instruction does not have an entry in |live_components|, then it is not + // changed. Returns true if |function| was modified. + bool RewriteInstructions(Function* function, + const LiveComponentMap& live_components); + + // Rewrites the OpCompositeInsert instruction |current_inst| to avoid + // unnecessary computes given that the only components of the result that are + // live are |live_components|. + // + // If the value being inserted is not live, then the result of |current_inst| + // is replaced by the composite input to |current_inst|. + // + // If the composite input to |current_inst| is not live, then it is replaced + // by and OpUndef in |current_inst|. + bool RewriteInsertInstruction(Instruction* current_inst, + const utils::BitVector& live_components); + + // Returns true if the result of |inst| is a vector or a scalar. + bool HasVectorOrScalarResult(const Instruction* inst) const; + + // Returns true if the result of |inst| is a scalar. + bool HasVectorResult(const Instruction* inst) const; + + // Returns true if the result of |inst| is a vector. + bool HasScalarResult(const Instruction* inst) const; + + // Adds |work_item| to |work_list| if it is not already live according to + // |live_components|. |live_components| is updated to indicate that + // |work_item| is now live. + void AddItemToWorkListIfNeeded(WorkListItem work_item, + LiveComponentMap* live_components, + std::vector* work_list); + + // Marks the components |live_elements| of the uses in |current_inst| as live + // according to |live_components|. If they were not live before, then they are + // added to |work_list|. + void MarkUsesAsLive(Instruction* current_inst, + const utils::BitVector& live_elements, + LiveComponentMap* live_components, + std::vector* work_list); + + // Marks the uses in the OpVectorShuffle instruction in |current_item| as live + // based on the live components in |current_item|. If anything becomes live + // they are added to |work_list| and |live_components| is updated + // accordingly. + void MarkVectorShuffleUsesAsLive(const WorkListItem& current_item, + VectorDCE::LiveComponentMap* live_components, + std::vector* work_list); + + // Marks the uses in the OpCompositeInsert instruction in |current_item| as + // live based on the live components in |current_item|. If anything becomes + // live they are added to |work_list| and |live_components| is updated + // accordingly. + void MarkInsertUsesAsLive(const WorkListItem& current_item, + LiveComponentMap* live_components, + std::vector* work_list); + + // Marks the uses in the OpCompositeExtract instruction |current_inst| as + // live. If anything becomes live they are added to |work_list| and + // |live_components| is updated accordingly. + void MarkExtractUseAsLive(const Instruction* current_inst, + LiveComponentMap* live_components, + std::vector* work_list); + + // Marks the uses in the OpCompositeConstruct instruction |current_inst| as + // live. If anything becomes live they are added to |work_list| and + // |live_components| is updated accordingly. + void MarkCompositeContructUsesAsLive(WorkListItem work_item, + LiveComponentMap* live_components, + std::vector* work_list); + + // A BitVector that can always be used to say that all components of a vector + // are live. + utils::BitVector all_components_live_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_VECTOR_DCE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp new file mode 100644 index 00000000000..d6e9d2cf720 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.cpp @@ -0,0 +1,69 @@ +// Copyright (c) 2018 Google 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. + +#include "source/opt/workaround1209.h" + +#include +#include +#include +#include + +namespace spvtools { +namespace opt { + +Pass::Status Workaround1209::Process() { + bool modified = false; + modified = RemoveOpUnreachableInLoops(); + return (modified ? Status::SuccessWithChange : Status::SuccessWithoutChange); +} + +bool Workaround1209::RemoveOpUnreachableInLoops() { + bool modified = false; + for (auto& func : *get_module()) { + std::list structured_order; + cfg()->ComputeStructuredOrder(&func, &*func.begin(), &structured_order); + + // Keep track of the loop merges. The top of the stack will always be the + // loop merge for the loop that immediately contains the basic block being + // processed. + std::stack loop_merges; + for (BasicBlock* bb : structured_order) { + if (!loop_merges.empty() && bb->id() == loop_merges.top()) { + loop_merges.pop(); + } + + if (bb->tail()->opcode() == SpvOpUnreachable) { + if (!loop_merges.empty()) { + // We found an OpUnreachable inside a loop. + // Replace it with an unconditional branch to the loop merge. + context()->KillInst(&*bb->tail()); + std::unique_ptr new_branch( + new Instruction(context(), SpvOpBranch, 0, 0, + {{spv_operand_type_t::SPV_OPERAND_TYPE_ID, + {loop_merges.top()}}})); + context()->AnalyzeDefUse(&*new_branch); + bb->AddInstruction(std::move(new_branch)); + modified = true; + } + } else { + if (bb->GetLoopMergeInst()) { + loop_merges.push(bb->MergeBlockIdIfAny()); + } + } + } + } + return modified; +} +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.h new file mode 100644 index 00000000000..9a1f88d93ca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/opt/workaround1209.h @@ -0,0 +1,41 @@ +// Copyright (c) 2018 Google 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. + +#ifndef SOURCE_OPT_WORKAROUND1209_H_ +#define SOURCE_OPT_WORKAROUND1209_H_ + +#include "source/opt/pass.h" + +namespace spvtools { +namespace opt { + +// See optimizer.hpp for documentation. +class Workaround1209 : public Pass { + public: + const char* name() const override { return "workaround-1209"; } + Status Process() override; + + private: + // There is at least one driver where an OpUnreachable found in a loop is not + // handled correctly. Workaround that by changing the OpUnreachable into a + // branch to the loop merge. + // + // Returns true if the code changed. + bool RemoveOpUnreachableInLoops(); +}; + +} // namespace opt +} // namespace spvtools + +#endif // SOURCE_OPT_WORKAROUND1209_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp new file mode 100644 index 00000000000..7ad369cdb22 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/parsed_operand.cpp @@ -0,0 +1,74 @@ +// Copyright (c) 2016 Google 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. + +// This file contains utility functions for spv_parsed_operand_t. + +#include "source/parsed_operand.h" + +#include +#include "source/util/hex_float.h" + +namespace spvtools { + +void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, + const spv_parsed_operand_t& operand) { + if (operand.type != SPV_OPERAND_TYPE_LITERAL_INTEGER && + operand.type != SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER) + return; + if (operand.num_words < 1) return; + // TODO(dneto): Support more than 64-bits at a time. + if (operand.num_words > 2) return; + + const uint32_t word = inst.words[operand.offset]; + if (operand.num_words == 1) { + switch (operand.number_kind) { + case SPV_NUMBER_SIGNED_INT: + *out << int32_t(word); + break; + case SPV_NUMBER_UNSIGNED_INT: + *out << word; + break; + case SPV_NUMBER_FLOATING: + if (operand.number_bit_width == 16) { + *out << spvtools::utils::FloatProxy( + uint16_t(word & 0xFFFF)); + } else { + // Assume 32-bit floats. + *out << spvtools::utils::FloatProxy(word); + } + break; + default: + break; + } + } else if (operand.num_words == 2) { + // Multi-word numbers are presented with lower order words first. + uint64_t bits = + uint64_t(word) | (uint64_t(inst.words[operand.offset + 1]) << 32); + switch (operand.number_kind) { + case SPV_NUMBER_SIGNED_INT: + *out << int64_t(bits); + break; + case SPV_NUMBER_UNSIGNED_INT: + *out << bits; + break; + case SPV_NUMBER_FLOATING: + // Assume only 64-bit floats. + *out << spvtools::utils::FloatProxy(bits); + break; + default: + break; + } + } +} +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/parsed_operand.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/parsed_operand.h new file mode 100644 index 00000000000..bab86110775 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/parsed_operand.h @@ -0,0 +1,33 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_PARSED_OPERAND_H_ +#define SOURCE_PARSED_OPERAND_H_ + +#include + +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// Emits the numeric literal representation of the given instruction operand +// to the stream. The operand must be of numeric type. If integral it may +// be up to 64 bits wide. If floating point, then it must be 16, 32, or 64 +// bits wide. +void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst, + const spv_parsed_operand_t& operand); + +} // namespace spvtools + +#endif // SOURCE_PARSED_OPERAND_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/print.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/print.cpp new file mode 100644 index 00000000000..f75e2d45735 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/print.cpp @@ -0,0 +1,125 @@ +// Copyright (c) 2015-2016 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. + +#include "source/print.h" + +#if defined(SPIRV_ANDROID) || defined(SPIRV_LINUX) || defined(SPIRV_MAC) || \ + defined(SPIRV_FREEBSD) +namespace spvtools { + +clr::reset::operator const char*() { return "\x1b[0m"; } + +clr::grey::operator const char*() { return "\x1b[1;30m"; } + +clr::red::operator const char*() { return "\x1b[31m"; } + +clr::green::operator const char*() { return "\x1b[32m"; } + +clr::yellow::operator const char*() { return "\x1b[33m"; } + +clr::blue::operator const char*() { return "\x1b[34m"; } + +} // namespace spvtools +#elif defined(SPIRV_WINDOWS) +#include + +namespace spvtools { + +static void SetConsoleForegroundColorPrimary(HANDLE hConsole, WORD color) { + // Get screen buffer information from console handle + CONSOLE_SCREEN_BUFFER_INFO bufInfo; + GetConsoleScreenBufferInfo(hConsole, &bufInfo); + + // Get background color + color = WORD(color | (bufInfo.wAttributes & 0xfff0)); + + // Set foreground color + SetConsoleTextAttribute(hConsole, color); +} + +static void SetConsoleForegroundColor(WORD color) { + SetConsoleForegroundColorPrimary(GetStdHandle(STD_OUTPUT_HANDLE), color); + SetConsoleForegroundColorPrimary(GetStdHandle(STD_ERROR_HANDLE), color); +} + +clr::reset::operator const char*() { + if (isPrint) { + SetConsoleForegroundColor(0xf); + return ""; + } + return "\x1b[0m"; +} + +clr::grey::operator const char*() { + if (isPrint) { + SetConsoleForegroundColor(FOREGROUND_INTENSITY); + return ""; + } + return "\x1b[1;30m"; +} + +clr::red::operator const char*() { + if (isPrint) { + SetConsoleForegroundColor(FOREGROUND_RED); + return ""; + } + return "\x1b[31m"; +} + +clr::green::operator const char*() { + if (isPrint) { + SetConsoleForegroundColor(FOREGROUND_GREEN); + return ""; + } + return "\x1b[32m"; +} + +clr::yellow::operator const char*() { + if (isPrint) { + SetConsoleForegroundColor(FOREGROUND_RED | FOREGROUND_GREEN); + return ""; + } + return "\x1b[33m"; +} + +clr::blue::operator const char*() { + // Blue all by itself is hard to see against a black background (the + // default on command shell), or a medium blue background (the default + // on PowerShell). So increase its intensity. + + if (isPrint) { + SetConsoleForegroundColor(FOREGROUND_BLUE | FOREGROUND_INTENSITY); + return ""; + } + return "\x1b[94m"; +} + +} // namespace spvtools +#else +namespace spvtools { + +clr::reset::operator const char*() { return ""; } + +clr::grey::operator const char*() { return ""; } + +clr::red::operator const char*() { return ""; } + +clr::green::operator const char*() { return ""; } + +clr::yellow::operator const char*() { return ""; } + +clr::blue::operator const char*() { return ""; } + +} // namespace spvtools +#endif diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/print.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/print.h new file mode 100644 index 00000000000..f31ba38e70a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/print.h @@ -0,0 +1,75 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_PRINT_H_ +#define SOURCE_PRINT_H_ + +#include +#include + +namespace spvtools { + +// Wrapper for out stream selection. +class out_stream { + public: + out_stream() : pStream(nullptr) {} + explicit out_stream(std::stringstream& stream) : pStream(&stream) {} + + std::ostream& get() { + if (pStream) { + return *pStream; + } + return std::cout; + } + + private: + std::stringstream* pStream; +}; + +namespace clr { +// Resets console color. +struct reset { + operator const char*(); + bool isPrint; +}; +// Sets console color to grey. +struct grey { + operator const char*(); + bool isPrint; +}; +// Sets console color to red. +struct red { + operator const char*(); + bool isPrint; +}; +// Sets console color to green. +struct green { + operator const char*(); + bool isPrint; +}; +// Sets console color to yellow. +struct yellow { + operator const char*(); + bool isPrint; +}; +// Sets console color to blue. +struct blue { + operator const char*(); + bool isPrint; +}; +} // namespace clr + +} // namespace spvtools + +#endif // SOURCE_PRINT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/software_version.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/software_version.cpp new file mode 100644 index 00000000000..b258ebe90d4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/software_version.cpp @@ -0,0 +1,27 @@ +// Copyright (c) 2015-2016 Google 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. + +#include "spirv-tools/libspirv.h" + +namespace { + +const char* kBuildVersions[] = { +#include "build-version.inc" +}; + +} // anonymous namespace + +const char* spvSoftwareVersionString(void) { return kBuildVersions[0]; } + +const char* spvSoftwareVersionDetailsString(void) { return kBuildVersions[1]; } diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_constant.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_constant.h new file mode 100644 index 00000000000..39771ccb262 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_constant.h @@ -0,0 +1,100 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_SPIRV_CONSTANT_H_ +#define SOURCE_SPIRV_CONSTANT_H_ + +#include "source/latest_version_spirv_header.h" +#include "spirv-tools/libspirv.h" + +// Version number macros. + +// Evaluates to a well-formed version header word, given valid +// SPIR-V version major and minor version numbers. +#define SPV_SPIRV_VERSION_WORD(MAJOR, MINOR) \ + ((uint32_t(uint8_t(MAJOR)) << 16) | (uint32_t(uint8_t(MINOR)) << 8)) +// Returns the major version extracted from a version header word. +#define SPV_SPIRV_VERSION_MAJOR_PART(WORD) ((uint32_t(WORD) >> 16) & 0xff) +// Returns the minor version extracted from a version header word. +#define SPV_SPIRV_VERSION_MINOR_PART(WORD) ((uint32_t(WORD) >> 8) & 0xff) + +// Header indices + +#define SPV_INDEX_MAGIC_NUMBER 0u +#define SPV_INDEX_VERSION_NUMBER 1u +#define SPV_INDEX_GENERATOR_NUMBER 2u +#define SPV_INDEX_BOUND 3u +#define SPV_INDEX_SCHEMA 4u +#define SPV_INDEX_INSTRUCTION 5u + +// Universal limits + +// SPIR-V 1.0 limits +#define SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX 0xffff +#define SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX 0xffff + +// A single Unicode character in UTF-8 encoding can take +// up 4 bytes. +#define SPV_LIMIT_LITERAL_STRING_BYTES_MAX \ + (SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX * 4) + +// NOTE: These are set to the minimum maximum values +// TODO(dneto): Check these. + +// libspirv limits. +#define SPV_LIMIT_RESULT_ID_BOUND 0x00400000 +#define SPV_LIMIT_CONTROL_FLOW_NEST_DEPTH 0x00000400 +#define SPV_LIMIT_GLOBAL_VARIABLES_MAX 0x00010000 +#define SPV_LIMIT_LOCAL_VARIABLES_MAX 0x00080000 +// TODO: Decorations per target ID max, depends on decoration table size +#define SPV_LIMIT_EXECUTION_MODE_PER_ENTRY_POINT_MAX 0x00000100 +#define SPV_LIMIT_INDICIES_MAX_ACCESS_CHAIN_COMPOSITE_MAX 0x00000100 +#define SPV_LIMIT_FUNCTION_PARAMETERS_PER_FUNCTION_DECL 0x00000100 +#define SPV_LIMIT_FUNCTION_CALL_ARGUMENTS_MAX 0x00000100 +#define SPV_LIMIT_EXT_FUNCTION_CALL_ARGUMENTS_MAX 0x00000100 +#define SPV_LIMIT_SWITCH_LITERAL_LABEL_PAIRS_MAX 0x00004000 +#define SPV_LIMIT_STRUCT_MEMBERS_MAX 0x0000400 +#define SPV_LIMIT_STRUCT_NESTING_DEPTH_MAX 0x00000100 + +// Enumerations + +// Values mapping to registered tools. See the registry at +// https://www.khronos.org/registry/spir-v/api/spir-v.xml +// These values occupy the higher order 16 bits of the generator magic word. +typedef enum spv_generator_t { + // TODO(dneto) Values 0 through 5 were registered only as vendor. + SPV_GENERATOR_KHRONOS = 0, + SPV_GENERATOR_LUNARG = 1, + SPV_GENERATOR_VALVE = 2, + SPV_GENERATOR_CODEPLAY = 3, + SPV_GENERATOR_NVIDIA = 4, + SPV_GENERATOR_ARM = 5, + // These are vendor and tool. + SPV_GENERATOR_KHRONOS_LLVM_TRANSLATOR = 6, + SPV_GENERATOR_KHRONOS_ASSEMBLER = 7, + SPV_GENERATOR_KHRONOS_GLSLANG = 8, + SPV_GENERATOR_NUM_ENTRIES, + SPV_FORCE_16_BIT_ENUM(spv_generator_t) +} spv_generator_t; + +// Evaluates to a well-formed generator magic word from a tool value and +// miscellaneous 16-bit value. +#define SPV_GENERATOR_WORD(TOOL, MISC) \ + ((uint32_t(uint16_t(TOOL)) << 16) | uint16_t(MISC)) +// Returns the tool component of the generator word. +#define SPV_GENERATOR_TOOL_PART(WORD) (uint32_t(WORD) >> 16) +// Returns the misc part of the generator word. +#define SPV_GENERATOR_MISC_PART(WORD) (uint32_t(WORD) & 0xFFFF) + +#endif // SOURCE_SPIRV_CONSTANT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_definition.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_definition.h new file mode 100644 index 00000000000..63a4ef0db29 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_definition.h @@ -0,0 +1,33 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_SPIRV_DEFINITION_H_ +#define SOURCE_SPIRV_DEFINITION_H_ + +#include + +#include "source/latest_version_spirv_header.h" + +#define spvIsInBitfield(value, bitfield) ((value) == ((value)&bitfield)) + +typedef struct spv_header_t { + uint32_t magic; + uint32_t version; + uint32_t generator; + uint32_t bound; + uint32_t schema; // NOTE: Reserved + const uint32_t* instructions; // NOTE: Unfixed pointer to instruciton stream +} spv_header_t; + +#endif // SOURCE_SPIRV_DEFINITION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_endian.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_endian.cpp new file mode 100644 index 00000000000..1d770917848 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_endian.cpp @@ -0,0 +1,77 @@ +// Copyright (c) 2015-2016 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. + +#include "source/spirv_endian.h" + +#include + +enum { + I32_ENDIAN_LITTLE = 0x03020100ul, + I32_ENDIAN_BIG = 0x00010203ul, +}; + +// This constant value allows the detection of the host machine's endianness. +// Accessing it through the "value" member is valid due to C++11 section 3.10 +// paragraph 10. +static const union { + unsigned char bytes[4]; + uint32_t value; +} o32_host_order = {{0, 1, 2, 3}}; + +#define I32_ENDIAN_HOST (o32_host_order.value) + +uint32_t spvFixWord(const uint32_t word, const spv_endianness_t endian) { + if ((SPV_ENDIANNESS_LITTLE == endian && I32_ENDIAN_HOST == I32_ENDIAN_BIG) || + (SPV_ENDIANNESS_BIG == endian && I32_ENDIAN_HOST == I32_ENDIAN_LITTLE)) { + return (word & 0x000000ff) << 24 | (word & 0x0000ff00) << 8 | + (word & 0x00ff0000) >> 8 | (word & 0xff000000) >> 24; + } + + return word; +} + +uint64_t spvFixDoubleWord(const uint32_t low, const uint32_t high, + const spv_endianness_t endian) { + return (uint64_t(spvFixWord(high, endian)) << 32) | spvFixWord(low, endian); +} + +spv_result_t spvBinaryEndianness(spv_const_binary binary, + spv_endianness_t* pEndian) { + if (!binary->code || !binary->wordCount) return SPV_ERROR_INVALID_BINARY; + if (!pEndian) return SPV_ERROR_INVALID_POINTER; + + uint8_t bytes[4]; + memcpy(bytes, binary->code, sizeof(uint32_t)); + + if (0x03 == bytes[0] && 0x02 == bytes[1] && 0x23 == bytes[2] && + 0x07 == bytes[3]) { + *pEndian = SPV_ENDIANNESS_LITTLE; + return SPV_SUCCESS; + } + + if (0x07 == bytes[0] && 0x23 == bytes[1] && 0x02 == bytes[2] && + 0x03 == bytes[3]) { + *pEndian = SPV_ENDIANNESS_BIG; + return SPV_SUCCESS; + } + + return SPV_ERROR_INVALID_BINARY; +} + +bool spvIsHostEndian(spv_endianness_t endian) { + return ((SPV_ENDIANNESS_LITTLE == endian) && + (I32_ENDIAN_LITTLE == I32_ENDIAN_HOST)) || + ((SPV_ENDIANNESS_BIG == endian) && + (I32_ENDIAN_BIG == I32_ENDIAN_HOST)); +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_endian.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_endian.h new file mode 100644 index 00000000000..c2540bec925 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_endian.h @@ -0,0 +1,37 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_SPIRV_ENDIAN_H_ +#define SOURCE_SPIRV_ENDIAN_H_ + +#include "spirv-tools/libspirv.h" + +// Converts a word in the specified endianness to the host native endianness. +uint32_t spvFixWord(const uint32_t word, const spv_endianness_t endianness); + +// Converts a pair of words in the specified endianness to the host native +// endianness. +uint64_t spvFixDoubleWord(const uint32_t low, const uint32_t high, + const spv_endianness_t endianness); + +// Gets the endianness of the SPIR-V module given in the binary parameter. +// Returns SPV_ENDIANNESS_UNKNOWN if the SPIR-V magic number is invalid, +// otherwise writes the determined endianness into *endian. +spv_result_t spvBinaryEndianness(const spv_const_binary binary, + spv_endianness_t* endian); + +// Returns true if the given endianness matches the host's native endiannes. +bool spvIsHostEndian(spv_endianness_t endian); + +#endif // SOURCE_SPIRV_ENDIAN_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp new file mode 100644 index 00000000000..7a11630c724 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_target_env.cpp @@ -0,0 +1,197 @@ +// Copyright (c) 2015-2016 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. + +#include "source/spirv_target_env.h" + +#include +#include + +#include "source/spirv_constant.h" +#include "spirv-tools/libspirv.h" + +const char* spvTargetEnvDescription(spv_target_env env) { + switch (env) { + case SPV_ENV_UNIVERSAL_1_0: + return "SPIR-V 1.0"; + case SPV_ENV_VULKAN_1_0: + return "SPIR-V 1.0 (under Vulkan 1.0 semantics)"; + case SPV_ENV_UNIVERSAL_1_1: + return "SPIR-V 1.1"; + case SPV_ENV_OPENCL_1_2: + return "SPIR-V 1.0 (under OpenCL 1.2 Full Profile semantics)"; + case SPV_ENV_OPENCL_EMBEDDED_1_2: + return "SPIR-V 1.0 (under OpenCL 1.2 Embedded Profile semantics)"; + case SPV_ENV_OPENCL_2_0: + return "SPIR-V 1.0 (under OpenCL 2.0 Full Profile semantics)"; + case SPV_ENV_OPENCL_EMBEDDED_2_0: + return "SPIR-V 1.0 (under OpenCL 2.0 Embedded Profile semantics)"; + case SPV_ENV_OPENCL_2_1: + return "SPIR-V 1.0 (under OpenCL 2.1 Full Profile semantics)"; + case SPV_ENV_OPENCL_EMBEDDED_2_1: + return "SPIR-V 1.0 (under OpenCL 2.1 Embedded Profile semantics)"; + case SPV_ENV_OPENCL_2_2: + return "SPIR-V 1.2 (under OpenCL 2.2 Full Profile semantics)"; + case SPV_ENV_OPENCL_EMBEDDED_2_2: + return "SPIR-V 1.2 (under OpenCL 2.2 Embedded Profile semantics)"; + case SPV_ENV_OPENGL_4_0: + return "SPIR-V 1.0 (under OpenGL 4.0 semantics)"; + case SPV_ENV_OPENGL_4_1: + return "SPIR-V 1.0 (under OpenGL 4.1 semantics)"; + case SPV_ENV_OPENGL_4_2: + return "SPIR-V 1.0 (under OpenGL 4.2 semantics)"; + case SPV_ENV_OPENGL_4_3: + return "SPIR-V 1.0 (under OpenGL 4.3 semantics)"; + case SPV_ENV_OPENGL_4_5: + return "SPIR-V 1.0 (under OpenGL 4.5 semantics)"; + case SPV_ENV_UNIVERSAL_1_2: + return "SPIR-V 1.2"; + case SPV_ENV_UNIVERSAL_1_3: + return "SPIR-V 1.3"; + case SPV_ENV_VULKAN_1_1: + return "SPIR-V 1.3 (under Vulkan 1.1 semantics)"; + case SPV_ENV_WEBGPU_0: + return "SPIR-V 1.3 (under WIP WebGPU semantics)"; + } + assert(0 && "Unhandled SPIR-V target environment"); + return ""; +} + +uint32_t spvVersionForTargetEnv(spv_target_env env) { + switch (env) { + case SPV_ENV_UNIVERSAL_1_0: + case SPV_ENV_VULKAN_1_0: + case SPV_ENV_OPENCL_1_2: + case SPV_ENV_OPENCL_EMBEDDED_1_2: + case SPV_ENV_OPENCL_2_0: + case SPV_ENV_OPENCL_EMBEDDED_2_0: + case SPV_ENV_OPENCL_2_1: + case SPV_ENV_OPENCL_EMBEDDED_2_1: + case SPV_ENV_OPENGL_4_0: + case SPV_ENV_OPENGL_4_1: + case SPV_ENV_OPENGL_4_2: + case SPV_ENV_OPENGL_4_3: + case SPV_ENV_OPENGL_4_5: + return SPV_SPIRV_VERSION_WORD(1, 0); + case SPV_ENV_UNIVERSAL_1_1: + return SPV_SPIRV_VERSION_WORD(1, 1); + case SPV_ENV_UNIVERSAL_1_2: + case SPV_ENV_OPENCL_2_2: + case SPV_ENV_OPENCL_EMBEDDED_2_2: + return SPV_SPIRV_VERSION_WORD(1, 2); + case SPV_ENV_UNIVERSAL_1_3: + case SPV_ENV_VULKAN_1_1: + case SPV_ENV_WEBGPU_0: + return SPV_SPIRV_VERSION_WORD(1, 3); + } + assert(0 && "Unhandled SPIR-V target environment"); + return SPV_SPIRV_VERSION_WORD(0, 0); +} + +bool spvParseTargetEnv(const char* s, spv_target_env* env) { + auto match = [s](const char* b) { + return s && (0 == strncmp(s, b, strlen(b))); + }; + if (match("vulkan1.0")) { + if (env) *env = SPV_ENV_VULKAN_1_0; + return true; + } else if (match("vulkan1.1")) { + if (env) *env = SPV_ENV_VULKAN_1_1; + return true; + } else if (match("spv1.0")) { + if (env) *env = SPV_ENV_UNIVERSAL_1_0; + return true; + } else if (match("spv1.1")) { + if (env) *env = SPV_ENV_UNIVERSAL_1_1; + return true; + } else if (match("spv1.2")) { + if (env) *env = SPV_ENV_UNIVERSAL_1_2; + return true; + } else if (match("spv1.3")) { + if (env) *env = SPV_ENV_UNIVERSAL_1_3; + return true; + } else if (match("opencl1.2embedded")) { + if (env) *env = SPV_ENV_OPENCL_EMBEDDED_1_2; + return true; + } else if (match("opencl1.2")) { + if (env) *env = SPV_ENV_OPENCL_1_2; + return true; + } else if (match("opencl2.0embedded")) { + if (env) *env = SPV_ENV_OPENCL_EMBEDDED_2_0; + return true; + } else if (match("opencl2.0")) { + if (env) *env = SPV_ENV_OPENCL_2_0; + return true; + } else if (match("opencl2.1embedded")) { + if (env) *env = SPV_ENV_OPENCL_EMBEDDED_2_1; + return true; + } else if (match("opencl2.1")) { + if (env) *env = SPV_ENV_OPENCL_2_1; + return true; + } else if (match("opencl2.2embedded")) { + if (env) *env = SPV_ENV_OPENCL_EMBEDDED_2_2; + return true; + } else if (match("opencl2.2")) { + if (env) *env = SPV_ENV_OPENCL_2_2; + return true; + } else if (match("opengl4.0")) { + if (env) *env = SPV_ENV_OPENGL_4_0; + return true; + } else if (match("opengl4.1")) { + if (env) *env = SPV_ENV_OPENGL_4_1; + return true; + } else if (match("opengl4.2")) { + if (env) *env = SPV_ENV_OPENGL_4_2; + return true; + } else if (match("opengl4.3")) { + if (env) *env = SPV_ENV_OPENGL_4_3; + return true; + } else if (match("opengl4.5")) { + if (env) *env = SPV_ENV_OPENGL_4_5; + return true; + } else if (match("webgpu0")) { + if (env) *env = SPV_ENV_WEBGPU_0; + return true; + } else { + if (env) *env = SPV_ENV_UNIVERSAL_1_0; + return false; + } +} + +bool spvIsVulkanEnv(spv_target_env env) { + switch (env) { + case SPV_ENV_UNIVERSAL_1_0: + case SPV_ENV_OPENCL_1_2: + case SPV_ENV_OPENCL_EMBEDDED_1_2: + case SPV_ENV_OPENCL_2_0: + case SPV_ENV_OPENCL_EMBEDDED_2_0: + case SPV_ENV_OPENCL_2_1: + case SPV_ENV_OPENCL_EMBEDDED_2_1: + case SPV_ENV_OPENGL_4_0: + case SPV_ENV_OPENGL_4_1: + case SPV_ENV_OPENGL_4_2: + case SPV_ENV_OPENGL_4_3: + case SPV_ENV_OPENGL_4_5: + case SPV_ENV_UNIVERSAL_1_1: + case SPV_ENV_UNIVERSAL_1_2: + case SPV_ENV_OPENCL_2_2: + case SPV_ENV_OPENCL_EMBEDDED_2_2: + case SPV_ENV_UNIVERSAL_1_3: + case SPV_ENV_WEBGPU_0: + return false; + case SPV_ENV_VULKAN_1_0: + case SPV_ENV_VULKAN_1_1: + return true; + } + return false; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_target_env.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_target_env.h new file mode 100644 index 00000000000..7dc7be1d87e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_target_env.h @@ -0,0 +1,30 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_SPIRV_TARGET_ENV_H_ +#define SOURCE_SPIRV_TARGET_ENV_H_ + +#include "spirv-tools/libspirv.h" + +// Parses s into *env and returns true if successful. If unparsable, returns +// false and sets *env to SPV_ENV_UNIVERSAL_1_0. +bool spvParseTargetEnv(const char* s, spv_target_env* env); + +// Returns true if |env| is a VULKAN environment, false otherwise. +bool spvIsVulkanEnv(spv_target_env env); + +// Returns the version number for the given SPIR-V target environment. +uint32_t spvVersionForTargetEnv(spv_target_env env); + +#endif // SOURCE_SPIRV_TARGET_ENV_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_validator_options.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_validator_options.cpp new file mode 100644 index 00000000000..0c06253649b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_validator_options.cpp @@ -0,0 +1,98 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "source/spirv_validator_options.h" + +bool spvParseUniversalLimitsOptions(const char* s, spv_validator_limit* type) { + auto match = [s](const char* b) { + return s && (0 == strncmp(s, b, strlen(b))); + }; + if (match("--max-struct-members")) { + *type = spv_validator_limit_max_struct_members; + } else if (match("--max-struct_depth")) { + *type = spv_validator_limit_max_struct_depth; + } else if (match("--max-local-variables")) { + *type = spv_validator_limit_max_local_variables; + } else if (match("--max-global-variables")) { + *type = spv_validator_limit_max_global_variables; + } else if (match("--max-switch-branches")) { + *type = spv_validator_limit_max_global_variables; + } else if (match("--max-function-args")) { + *type = spv_validator_limit_max_function_args; + } else if (match("--max-control-flow-nesting-depth")) { + *type = spv_validator_limit_max_control_flow_nesting_depth; + } else if (match("--max-access-chain-indexes")) { + *type = spv_validator_limit_max_access_chain_indexes; + } else { + // The command line option for this validator limit has not been added. + // Therefore we return false. + return false; + } + + return true; +} + +spv_validator_options spvValidatorOptionsCreate(void) { + return new spv_validator_options_t; +} + +void spvValidatorOptionsDestroy(spv_validator_options options) { + delete options; +} + +void spvValidatorOptionsSetUniversalLimit(spv_validator_options options, + spv_validator_limit limit_type, + uint32_t limit) { + assert(options && "Validator options object may not be Null"); + switch (limit_type) { +#define LIMIT(TYPE, FIELD) \ + case TYPE: \ + options->universal_limits_.FIELD = limit; \ + break; + LIMIT(spv_validator_limit_max_struct_members, max_struct_members) + LIMIT(spv_validator_limit_max_struct_depth, max_struct_depth) + LIMIT(spv_validator_limit_max_local_variables, max_local_variables) + LIMIT(spv_validator_limit_max_global_variables, max_global_variables) + LIMIT(spv_validator_limit_max_switch_branches, max_switch_branches) + LIMIT(spv_validator_limit_max_function_args, max_function_args) + LIMIT(spv_validator_limit_max_control_flow_nesting_depth, + max_control_flow_nesting_depth) + LIMIT(spv_validator_limit_max_access_chain_indexes, + max_access_chain_indexes) +#undef LIMIT + } +} + +void spvValidatorOptionsSetRelaxStoreStruct(spv_validator_options options, + bool val) { + options->relax_struct_store = val; +} + +void spvValidatorOptionsSetRelaxLogicalPointer(spv_validator_options options, + bool val) { + options->relax_logical_pointer = val; +} + +void spvValidatorOptionsSetRelaxBlockLayout(spv_validator_options options, + bool val) { + options->relax_block_layout = val; +} + +void spvValidatorOptionsSetSkipBlockLayout(spv_validator_options options, + bool val) { + options->skip_block_layout = val; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_validator_options.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_validator_options.h new file mode 100644 index 00000000000..d264a7e0b02 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/spirv_validator_options.h @@ -0,0 +1,54 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_SPIRV_VALIDATOR_OPTIONS_H_ +#define SOURCE_SPIRV_VALIDATOR_OPTIONS_H_ + +#include "spirv-tools/libspirv.h" + +// Return true if the command line option for the validator limit is valid (Also +// returns the Enum for option in this case). Returns false otherwise. +bool spvParseUniversalLimitsOptions(const char* s, spv_validator_limit* limit); + +// Default initialization of this structure is to the default Universal Limits +// described in the SPIR-V Spec. +struct validator_universal_limits_t { + uint32_t max_struct_members{16383}; + uint32_t max_struct_depth{255}; + uint32_t max_local_variables{524287}; + uint32_t max_global_variables{65535}; + uint32_t max_switch_branches{16383}; + uint32_t max_function_args{255}; + uint32_t max_control_flow_nesting_depth{1023}; + uint32_t max_access_chain_indexes{255}; +}; + +// Manages command line options passed to the SPIR-V Validator. New struct +// members may be added for any new option. +struct spv_validator_options_t { + spv_validator_options_t() + : universal_limits_(), + relax_struct_store(false), + relax_logical_pointer(false), + relax_block_layout(false), + skip_block_layout(false) {} + + validator_universal_limits_t universal_limits_; + bool relax_struct_store; + bool relax_logical_pointer; + bool relax_block_layout; + bool skip_block_layout; +}; + +#endif // SOURCE_SPIRV_VALIDATOR_OPTIONS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/table.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/table.cpp new file mode 100644 index 00000000000..b10d776da45 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/table.cpp @@ -0,0 +1,63 @@ +// Copyright (c) 2015-2016 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. + +#include "source/table.h" + +#include + +spv_context spvContextCreate(spv_target_env env) { + switch (env) { + case SPV_ENV_UNIVERSAL_1_0: + case SPV_ENV_VULKAN_1_0: + case SPV_ENV_UNIVERSAL_1_1: + case SPV_ENV_OPENCL_1_2: + case SPV_ENV_OPENCL_EMBEDDED_1_2: + case SPV_ENV_OPENCL_2_0: + case SPV_ENV_OPENCL_EMBEDDED_2_0: + case SPV_ENV_OPENCL_2_1: + case SPV_ENV_OPENCL_EMBEDDED_2_1: + case SPV_ENV_OPENCL_2_2: + case SPV_ENV_OPENCL_EMBEDDED_2_2: + case SPV_ENV_OPENGL_4_0: + case SPV_ENV_OPENGL_4_1: + case SPV_ENV_OPENGL_4_2: + case SPV_ENV_OPENGL_4_3: + case SPV_ENV_OPENGL_4_5: + case SPV_ENV_UNIVERSAL_1_2: + case SPV_ENV_UNIVERSAL_1_3: + case SPV_ENV_VULKAN_1_1: + case SPV_ENV_WEBGPU_0: + break; + default: + return nullptr; + } + + spv_opcode_table opcode_table; + spv_operand_table operand_table; + spv_ext_inst_table ext_inst_table; + + spvOpcodeTableGet(&opcode_table, env); + spvOperandTableGet(&operand_table, env); + spvExtInstTableGet(&ext_inst_table, env); + + return new spv_context_t{env, opcode_table, operand_table, ext_inst_table, + nullptr /* a null default consumer */}; +} + +void spvContextDestroy(spv_context context) { delete context; } + +void spvtools::SetContextMessageConsumer(spv_context context, + spvtools::MessageConsumer consumer) { + context->consumer = std::move(consumer); +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/table.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/table.h new file mode 100644 index 00000000000..64d73dbb96c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/table.h @@ -0,0 +1,132 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_TABLE_H_ +#define SOURCE_TABLE_H_ + +#include "source/latest_version_spirv_header.h" + +#include "source/extensions.h" +#include "spirv-tools/libspirv.hpp" + +typedef struct spv_opcode_desc_t { + const char* name; + const SpvOp opcode; + const uint32_t numCapabilities; + const SpvCapability* capabilities; + // operandTypes[0..numTypes-1] describe logical operands for the instruction. + // The operand types include result id and result-type id, followed by + // the types of arguments. + const uint16_t numTypes; + spv_operand_type_t operandTypes[16]; // TODO: Smaller/larger? + const bool hasResult; // Does the instruction have a result ID operand? + const bool hasType; // Does the instruction have a type ID operand? + // A set of extensions that enable this feature. If empty then this operand + // value is in core and its availability is subject to minVersion. The + // assembler, binary parser, and disassembler ignore this rule, so you can + // freely process invalid modules. + const uint32_t numExtensions; + const spvtools::Extension* extensions; + // Minimal core SPIR-V version required for this feature, if without + // extensions. ~0u means reserved for future use. ~0u and non-empty extension + // lists means only available in extensions. + const uint32_t minVersion; +} spv_opcode_desc_t; + +typedef struct spv_operand_desc_t { + const char* name; + const uint32_t value; + const uint32_t numCapabilities; + const SpvCapability* capabilities; + // A set of extensions that enable this feature. If empty then this operand + // value is in core and its availability is subject to minVersion. The + // assembler, binary parser, and disassembler ignore this rule, so you can + // freely process invalid modules. + const uint32_t numExtensions; + const spvtools::Extension* extensions; + const spv_operand_type_t operandTypes[16]; // TODO: Smaller/larger? + // Minimal core SPIR-V version required for this feature, if without + // extensions. ~0u means reserved for future use. ~0u and non-empty extension + // lists means only available in extensions. + const uint32_t minVersion; +} spv_operand_desc_t; + +typedef struct spv_operand_desc_group_t { + const spv_operand_type_t type; + const uint32_t count; + const spv_operand_desc_t* entries; +} spv_operand_desc_group_t; + +typedef struct spv_ext_inst_desc_t { + const char* name; + const uint32_t ext_inst; + const uint32_t numCapabilities; + const SpvCapability* capabilities; + const spv_operand_type_t operandTypes[16]; // TODO: Smaller/larger? +} spv_ext_inst_desc_t; + +typedef struct spv_ext_inst_group_t { + const spv_ext_inst_type_t type; + const uint32_t count; + const spv_ext_inst_desc_t* entries; +} spv_ext_inst_group_t; + +typedef struct spv_opcode_table_t { + const uint32_t count; + const spv_opcode_desc_t* entries; +} spv_opcode_table_t; + +typedef struct spv_operand_table_t { + const uint32_t count; + const spv_operand_desc_group_t* types; +} spv_operand_table_t; + +typedef struct spv_ext_inst_table_t { + const uint32_t count; + const spv_ext_inst_group_t* groups; +} spv_ext_inst_table_t; + +typedef const spv_opcode_desc_t* spv_opcode_desc; +typedef const spv_operand_desc_t* spv_operand_desc; +typedef const spv_ext_inst_desc_t* spv_ext_inst_desc; + +typedef const spv_opcode_table_t* spv_opcode_table; +typedef const spv_operand_table_t* spv_operand_table; +typedef const spv_ext_inst_table_t* spv_ext_inst_table; + +struct spv_context_t { + const spv_target_env target_env; + const spv_opcode_table opcode_table; + const spv_operand_table operand_table; + const spv_ext_inst_table ext_inst_table; + spvtools::MessageConsumer consumer; +}; + +namespace spvtools { + +// Sets the message consumer to |consumer| in the given |context|. The original +// message consumer will be overwritten. +void SetContextMessageConsumer(spv_context context, MessageConsumer consumer); +} // namespace spvtools + +// Populates *table with entries for env. +spv_result_t spvOpcodeTableGet(spv_opcode_table* table, spv_target_env env); + +// Populates *table with entries for env. +spv_result_t spvOperandTableGet(spv_operand_table* table, spv_target_env env); + +// Populates *table with entries for env. +spv_result_t spvExtInstTableGet(spv_ext_inst_table* table, spv_target_env env); + +#endif // SOURCE_TABLE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/text.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/text.cpp new file mode 100644 index 00000000000..adaf796520a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/text.cpp @@ -0,0 +1,811 @@ +// Copyright (c) 2015-2016 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. + +#include "source/text.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/ext_inst.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "source/spirv_target_env.h" +#include "source/table.h" +#include "source/text_handler.h" +#include "source/util/bitutils.h" +#include "source/util/parse_number.h" +#include "spirv-tools/libspirv.h" + +bool spvIsValidIDCharacter(const char value) { + return value == '_' || 0 != ::isalnum(value); +} + +// Returns true if the given string represents a valid ID name. +bool spvIsValidID(const char* textValue) { + const char* c = textValue; + for (; *c != '\0'; ++c) { + if (!spvIsValidIDCharacter(*c)) { + return false; + } + } + // If the string was empty, then the ID also is not valid. + return c != textValue; +} + +// Text API + +spv_result_t spvTextToLiteral(const char* textValue, spv_literal_t* pLiteral) { + bool isSigned = false; + int numPeriods = 0; + bool isString = false; + + const size_t len = strlen(textValue); + if (len == 0) return SPV_FAILED_MATCH; + + for (uint64_t index = 0; index < len; ++index) { + switch (textValue[index]) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + break; + case '.': + numPeriods++; + break; + case '-': + if (index == 0) { + isSigned = true; + } else { + isString = true; + } + break; + default: + isString = true; + index = len; // break out of the loop too. + break; + } + } + + pLiteral->type = spv_literal_type_t(99); + + if (isString || numPeriods > 1 || (isSigned && len == 1)) { + if (len < 2 || textValue[0] != '"' || textValue[len - 1] != '"') + return SPV_FAILED_MATCH; + bool escaping = false; + for (const char* val = textValue + 1; val != textValue + len - 1; ++val) { + if ((*val == '\\') && (!escaping)) { + escaping = true; + } else { + // Have to save space for the null-terminator + if (pLiteral->str.size() >= SPV_LIMIT_LITERAL_STRING_BYTES_MAX) + return SPV_ERROR_OUT_OF_MEMORY; + pLiteral->str.push_back(*val); + escaping = false; + } + } + + pLiteral->type = SPV_LITERAL_TYPE_STRING; + } else if (numPeriods == 1) { + double d = std::strtod(textValue, nullptr); + float f = (float)d; + if (d == (double)f) { + pLiteral->type = SPV_LITERAL_TYPE_FLOAT_32; + pLiteral->value.f = f; + } else { + pLiteral->type = SPV_LITERAL_TYPE_FLOAT_64; + pLiteral->value.d = d; + } + } else if (isSigned) { + int64_t i64 = strtoll(textValue, nullptr, 10); + int32_t i32 = (int32_t)i64; + if (i64 == (int64_t)i32) { + pLiteral->type = SPV_LITERAL_TYPE_INT_32; + pLiteral->value.i32 = i32; + } else { + pLiteral->type = SPV_LITERAL_TYPE_INT_64; + pLiteral->value.i64 = i64; + } + } else { + uint64_t u64 = strtoull(textValue, nullptr, 10); + uint32_t u32 = (uint32_t)u64; + if (u64 == (uint64_t)u32) { + pLiteral->type = SPV_LITERAL_TYPE_UINT_32; + pLiteral->value.u32 = u32; + } else { + pLiteral->type = SPV_LITERAL_TYPE_UINT_64; + pLiteral->value.u64 = u64; + } + } + + return SPV_SUCCESS; +} + +namespace { + +/// Parses an immediate integer from text, guarding against overflow. If +/// successful, adds the parsed value to pInst, advances the context past it, +/// and returns SPV_SUCCESS. Otherwise, leaves pInst alone, emits diagnostics, +/// and returns SPV_ERROR_INVALID_TEXT. +spv_result_t encodeImmediate(spvtools::AssemblyContext* context, + const char* text, spv_instruction_t* pInst) { + assert(*text == '!'); + uint32_t parse_result; + if (!spvtools::utils::ParseNumber(text + 1, &parse_result)) { + return context->diagnostic(SPV_ERROR_INVALID_TEXT) + << "Invalid immediate integer: !" << text + 1; + } + context->binaryEncodeU32(parse_result, pInst); + context->seekForward(static_cast(strlen(text))); + return SPV_SUCCESS; +} + +} // anonymous namespace + +/// @brief Translate an Opcode operand to binary form +/// +/// @param[in] grammar the grammar to use for compilation +/// @param[in, out] context the dynamic compilation info +/// @param[in] type of the operand +/// @param[in] textValue word of text to be parsed +/// @param[out] pInst return binary Opcode +/// @param[in,out] pExpectedOperands the operand types expected +/// +/// @return result code +spv_result_t spvTextEncodeOperand(const spvtools::AssemblyGrammar& grammar, + spvtools::AssemblyContext* context, + const spv_operand_type_t type, + const char* textValue, + spv_instruction_t* pInst, + spv_operand_pattern_t* pExpectedOperands) { + // NOTE: Handle immediate int in the stream + if ('!' == textValue[0]) { + if (auto error = encodeImmediate(context, textValue, pInst)) { + return error; + } + *pExpectedOperands = + spvAlternatePatternFollowingImmediate(*pExpectedOperands); + return SPV_SUCCESS; + } + + // Optional literal operands can fail to parse. In that case use + // SPV_FAILED_MATCH to avoid emitting a diagostic. Use the following + // for those situations. + spv_result_t error_code_for_literals = + spvOperandIsOptional(type) ? SPV_FAILED_MATCH : SPV_ERROR_INVALID_TEXT; + + switch (type) { + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_TYPE_ID: + case SPV_OPERAND_TYPE_RESULT_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + case SPV_OPERAND_TYPE_OPTIONAL_ID: { + if ('%' == textValue[0]) { + textValue++; + } else { + return context->diagnostic() << "Expected id to start with %."; + } + if (!spvIsValidID(textValue)) { + return context->diagnostic() << "Invalid ID " << textValue; + } + const uint32_t id = context->spvNamedIdAssignOrGet(textValue); + if (type == SPV_OPERAND_TYPE_TYPE_ID) pInst->resultTypeId = id; + spvInstructionAddWord(pInst, id); + + // Set the extended instruction type. + // The import set id is the 3rd operand of OpExtInst. + if (pInst->opcode == SpvOpExtInst && pInst->words.size() == 4) { + auto ext_inst_type = context->getExtInstTypeForId(pInst->words[3]); + if (ext_inst_type == SPV_EXT_INST_TYPE_NONE) { + return context->diagnostic() + << "Invalid extended instruction import Id " + << pInst->words[2]; + } + pInst->extInstType = ext_inst_type; + } + } break; + + case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: { + // The assembler accepts the symbolic name for an extended instruction, + // and emits its corresponding number. + spv_ext_inst_desc extInst; + if (grammar.lookupExtInst(pInst->extInstType, textValue, &extInst)) { + return context->diagnostic() + << "Invalid extended instruction name '" << textValue << "'."; + } + spvInstructionAddWord(pInst, extInst->ext_inst); + + // Prepare to parse the operands for the extended instructions. + spvPushOperandTypes(extInst->operandTypes, pExpectedOperands); + } break; + + case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: { + // The assembler accepts the symbolic name for the opcode, but without + // the "Op" prefix. For example, "IAdd" is accepted. The number + // of the opcode is emitted. + SpvOp opcode; + if (grammar.lookupSpecConstantOpcode(textValue, &opcode)) { + return context->diagnostic() << "Invalid " << spvOperandTypeStr(type) + << " '" << textValue << "'."; + } + spv_opcode_desc opcodeEntry = nullptr; + if (grammar.lookupOpcode(opcode, &opcodeEntry)) { + return context->diagnostic(SPV_ERROR_INTERNAL) + << "OpSpecConstant opcode table out of sync"; + } + spvInstructionAddWord(pInst, uint32_t(opcodeEntry->opcode)); + + // Prepare to parse the operands for the opcode. Except skip the + // type Id and result Id, since they've already been processed. + assert(opcodeEntry->hasType); + assert(opcodeEntry->hasResult); + assert(opcodeEntry->numTypes >= 2); + spvPushOperandTypes(opcodeEntry->operandTypes + 2, pExpectedOperands); + } break; + + case SPV_OPERAND_TYPE_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: { + // The current operand is an *unsigned* 32-bit integer. + // That's just how the grammar works. + spvtools::IdType expected_type = { + 32, false, spvtools::IdTypeClass::kScalarIntegerType}; + if (auto error = context->binaryEncodeNumericLiteral( + textValue, error_code_for_literals, expected_type, pInst)) { + return error; + } + } break; + + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER: + // This is a context-independent literal number which can be a 32-bit + // number of floating point value. + if (auto error = context->binaryEncodeNumericLiteral( + textValue, error_code_for_literals, spvtools::kUnknownType, + pInst)) { + return error; + } + break; + + case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: + case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: { + spvtools::IdType expected_type = spvtools::kUnknownType; + // The encoding for OpConstant, OpSpecConstant and OpSwitch all + // depend on either their own result-id or the result-id of + // one of their parameters. + if (SpvOpConstant == pInst->opcode || + SpvOpSpecConstant == pInst->opcode) { + // The type of the literal is determined by the type Id of the + // instruction. + expected_type = + context->getTypeOfTypeGeneratingValue(pInst->resultTypeId); + if (!spvtools::isScalarFloating(expected_type) && + !spvtools::isScalarIntegral(expected_type)) { + spv_opcode_desc d; + const char* opcode_name = "opcode"; + if (SPV_SUCCESS == grammar.lookupOpcode(pInst->opcode, &d)) { + opcode_name = d->name; + } + return context->diagnostic() + << "Type for " << opcode_name + << " must be a scalar floating point or integer type"; + } + } else if (pInst->opcode == SpvOpSwitch) { + // The type of the literal is the same as the type of the selector. + expected_type = context->getTypeOfValueInstruction(pInst->words[1]); + if (!spvtools::isScalarIntegral(expected_type)) { + return context->diagnostic() + << "The selector operand for OpSwitch must be the result" + " of an instruction that generates an integer scalar"; + } + } + if (auto error = context->binaryEncodeNumericLiteral( + textValue, error_code_for_literals, expected_type, pInst)) { + return error; + } + } break; + + case SPV_OPERAND_TYPE_LITERAL_STRING: + case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: { + spv_literal_t literal = {}; + spv_result_t error = spvTextToLiteral(textValue, &literal); + if (error != SPV_SUCCESS) { + if (error == SPV_ERROR_OUT_OF_MEMORY) return error; + return context->diagnostic(error_code_for_literals) + << "Invalid literal string '" << textValue << "'."; + } + if (literal.type != SPV_LITERAL_TYPE_STRING) { + return context->diagnostic() + << "Expected literal string, found literal number '" << textValue + << "'."; + } + + // NOTE: Special case for extended instruction library import + if (SpvOpExtInstImport == pInst->opcode) { + const spv_ext_inst_type_t ext_inst_type = + spvExtInstImportTypeGet(literal.str.c_str()); + if (SPV_EXT_INST_TYPE_NONE == ext_inst_type) { + return context->diagnostic() + << "Invalid extended instruction import '" << literal.str + << "'"; + } + if ((error = context->recordIdAsExtInstImport(pInst->words[1], + ext_inst_type))) + return error; + } + + if (context->binaryEncodeString(literal.str.c_str(), pInst)) + return SPV_ERROR_INVALID_TEXT; + } break; + + // Masks. + case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: + case SPV_OPERAND_TYPE_FUNCTION_CONTROL: + case SPV_OPERAND_TYPE_LOOP_CONTROL: + case SPV_OPERAND_TYPE_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: + case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: + case SPV_OPERAND_TYPE_SELECTION_CONTROL: + case SPV_OPERAND_TYPE_DEBUG_INFO_FLAGS: { + uint32_t value; + if (grammar.parseMaskOperand(type, textValue, &value)) { + return context->diagnostic() << "Invalid " << spvOperandTypeStr(type) + << " operand '" << textValue << "'."; + } + if (auto error = context->binaryEncodeU32(value, pInst)) return error; + // Prepare to parse the operands for this logical operand. + grammar.pushOperandTypesForMask(type, value, pExpectedOperands); + } break; + case SPV_OPERAND_TYPE_OPTIONAL_CIV: { + auto error = spvTextEncodeOperand( + grammar, context, SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER, textValue, + pInst, pExpectedOperands); + if (error == SPV_FAILED_MATCH) { + // It's not a literal number -- is it a literal string? + error = spvTextEncodeOperand(grammar, context, + SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING, + textValue, pInst, pExpectedOperands); + } + if (error == SPV_FAILED_MATCH) { + // It's not a literal -- is it an ID? + error = + spvTextEncodeOperand(grammar, context, SPV_OPERAND_TYPE_OPTIONAL_ID, + textValue, pInst, pExpectedOperands); + } + if (error) { + return context->diagnostic(error) + << "Invalid word following !: " << textValue; + } + if (pExpectedOperands->empty()) { + pExpectedOperands->push_back(SPV_OPERAND_TYPE_OPTIONAL_CIV); + } + } break; + default: { + // NOTE: All non literal operands are handled here using the operand + // table. + spv_operand_desc entry; + if (grammar.lookupOperand(type, textValue, strlen(textValue), &entry)) { + return context->diagnostic() << "Invalid " << spvOperandTypeStr(type) + << " '" << textValue << "'."; + } + if (context->binaryEncodeU32(entry->value, pInst)) { + return context->diagnostic() << "Invalid " << spvOperandTypeStr(type) + << " '" << textValue << "'."; + } + + // Prepare to parse the operands for this logical operand. + spvPushOperandTypes(entry->operandTypes, pExpectedOperands); + } break; + } + return SPV_SUCCESS; +} + +namespace { + +/// Encodes an instruction started by ! at the given position in text. +/// +/// Puts the encoded words into *pInst. If successful, moves position past the +/// instruction and returns SPV_SUCCESS. Otherwise, returns an error code and +/// leaves position pointing to the error in text. +spv_result_t encodeInstructionStartingWithImmediate( + const spvtools::AssemblyGrammar& grammar, + spvtools::AssemblyContext* context, spv_instruction_t* pInst) { + std::string firstWord; + spv_position_t nextPosition = {}; + auto error = context->getWord(&firstWord, &nextPosition); + if (error) return context->diagnostic(error) << "Internal Error"; + + if ((error = encodeImmediate(context, firstWord.c_str(), pInst))) { + return error; + } + while (context->advance() != SPV_END_OF_STREAM) { + // A beginning of a new instruction means we're done. + if (context->isStartOfNewInst()) return SPV_SUCCESS; + + // Otherwise, there must be an operand that's either a literal, an ID, or + // an immediate. + std::string operandValue; + if ((error = context->getWord(&operandValue, &nextPosition))) + return context->diagnostic(error) << "Internal Error"; + + if (operandValue == "=") + return context->diagnostic() << firstWord << " not allowed before =."; + + // Needed to pass to spvTextEncodeOpcode(), but it shouldn't ever be + // expanded. + spv_operand_pattern_t dummyExpectedOperands; + error = spvTextEncodeOperand( + grammar, context, SPV_OPERAND_TYPE_OPTIONAL_CIV, operandValue.c_str(), + pInst, &dummyExpectedOperands); + if (error) return error; + context->setPosition(nextPosition); + } + return SPV_SUCCESS; +} + +/// @brief Translate single Opcode and operands to binary form +/// +/// @param[in] grammar the grammar to use for compilation +/// @param[in, out] context the dynamic compilation info +/// @param[in] text stream to translate +/// @param[out] pInst returned binary Opcode +/// @param[in,out] pPosition in the text stream +/// +/// @return result code +spv_result_t spvTextEncodeOpcode(const spvtools::AssemblyGrammar& grammar, + spvtools::AssemblyContext* context, + spv_instruction_t* pInst) { + // Check for ! first. + if ('!' == context->peek()) { + return encodeInstructionStartingWithImmediate(grammar, context, pInst); + } + + std::string firstWord; + spv_position_t nextPosition = {}; + spv_result_t error = context->getWord(&firstWord, &nextPosition); + if (error) return context->diagnostic() << "Internal Error"; + + std::string opcodeName; + std::string result_id; + spv_position_t result_id_position = {}; + if (context->startsWithOp()) { + opcodeName = firstWord; + } else { + result_id = firstWord; + if ('%' != result_id.front()) { + return context->diagnostic() + << "Expected or at the beginning " + "of an instruction, found '" + << result_id << "'."; + } + result_id_position = context->position(); + + // The '=' sign. + context->setPosition(nextPosition); + if (context->advance()) + return context->diagnostic() << "Expected '=', found end of stream."; + std::string equal_sign; + error = context->getWord(&equal_sign, &nextPosition); + if ("=" != equal_sign) + return context->diagnostic() << "'=' expected after result id."; + + // The after the '=' sign. + context->setPosition(nextPosition); + if (context->advance()) + return context->diagnostic() << "Expected opcode, found end of stream."; + error = context->getWord(&opcodeName, &nextPosition); + if (error) return context->diagnostic(error) << "Internal Error"; + if (!context->startsWithOp()) { + return context->diagnostic() + << "Invalid Opcode prefix '" << opcodeName << "'."; + } + } + + // NOTE: The table contains Opcode names without the "Op" prefix. + const char* pInstName = opcodeName.data() + 2; + + spv_opcode_desc opcodeEntry; + error = grammar.lookupOpcode(pInstName, &opcodeEntry); + if (error) { + return context->diagnostic(error) + << "Invalid Opcode name '" << opcodeName << "'"; + } + if (opcodeEntry->hasResult && result_id.empty()) { + return context->diagnostic() + << "Expected at the beginning of an instruction, found '" + << firstWord << "'."; + } + pInst->opcode = opcodeEntry->opcode; + context->setPosition(nextPosition); + // Reserve the first word for the instruction. + spvInstructionAddWord(pInst, 0); + + // Maintains the ordered list of expected operand types. + // For many instructions we only need the {numTypes, operandTypes} + // entries in opcodeEntry. However, sometimes we need to modify + // the list as we parse the operands. This occurs when an operand + // has its own logical operands (such as the LocalSize operand for + // ExecutionMode), or for extended instructions that may have their + // own operands depending on the selected extended instruction. + spv_operand_pattern_t expectedOperands; + expectedOperands.reserve(opcodeEntry->numTypes); + for (auto i = 0; i < opcodeEntry->numTypes; i++) + expectedOperands.push_back( + opcodeEntry->operandTypes[opcodeEntry->numTypes - i - 1]); + + while (!expectedOperands.empty()) { + const spv_operand_type_t type = expectedOperands.back(); + expectedOperands.pop_back(); + + // Expand optional tuples lazily. + if (spvExpandOperandSequenceOnce(type, &expectedOperands)) continue; + + if (type == SPV_OPERAND_TYPE_RESULT_ID && !result_id.empty()) { + // Handle the for value generating instructions. + // We've already consumed it from the text stream. Here + // we inject its words into the instruction. + spv_position_t temp_pos = context->position(); + error = spvTextEncodeOperand(grammar, context, SPV_OPERAND_TYPE_RESULT_ID, + result_id.c_str(), pInst, nullptr); + result_id_position = context->position(); + // Because we are injecting we have to reset the position afterwards. + context->setPosition(temp_pos); + if (error) return error; + } else { + // Find the next word. + error = context->advance(); + if (error == SPV_END_OF_STREAM) { + if (spvOperandIsOptional(type)) { + // This would have been the last potential operand for the + // instruction, + // and we didn't find one. We're finished parsing this instruction. + break; + } else { + return context->diagnostic() + << "Expected operand, found end of stream."; + } + } + assert(error == SPV_SUCCESS && "Somebody added another way to fail"); + + if (context->isStartOfNewInst()) { + if (spvOperandIsOptional(type)) { + break; + } else { + return context->diagnostic() + << "Expected operand, found next instruction instead."; + } + } + + std::string operandValue; + error = context->getWord(&operandValue, &nextPosition); + if (error) return context->diagnostic(error) << "Internal Error"; + + error = spvTextEncodeOperand(grammar, context, type, operandValue.c_str(), + pInst, &expectedOperands); + + if (error == SPV_FAILED_MATCH && spvOperandIsOptional(type)) + return SPV_SUCCESS; + + if (error) return error; + + context->setPosition(nextPosition); + } + } + + if (spvOpcodeGeneratesType(pInst->opcode)) { + if (context->recordTypeDefinition(pInst) != SPV_SUCCESS) { + return SPV_ERROR_INVALID_TEXT; + } + } else if (opcodeEntry->hasType) { + // SPIR-V dictates that if an instruction has both a return value and a + // type ID then the type id is first, and the return value is second. + assert(opcodeEntry->hasResult && + "Unknown opcode: has a type but no result."); + context->recordTypeIdForValue(pInst->words[2], pInst->words[1]); + } + + if (pInst->words.size() > SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX) { + return context->diagnostic() + << "Instruction too long: " << pInst->words.size() + << " words, but the limit is " + << SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX; + } + + pInst->words[0] = + spvOpcodeMake(uint16_t(pInst->words.size()), opcodeEntry->opcode); + + return SPV_SUCCESS; +} + +enum { kAssemblerVersion = 0 }; + +// Populates a binary stream's |header|. The target environment is specified via +// |env| and Id bound is via |bound|. +spv_result_t SetHeader(spv_target_env env, const uint32_t bound, + uint32_t* header) { + if (!header) return SPV_ERROR_INVALID_BINARY; + + header[SPV_INDEX_MAGIC_NUMBER] = SpvMagicNumber; + header[SPV_INDEX_VERSION_NUMBER] = spvVersionForTargetEnv(env); + header[SPV_INDEX_GENERATOR_NUMBER] = + SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, kAssemblerVersion); + header[SPV_INDEX_BOUND] = bound; + header[SPV_INDEX_SCHEMA] = 0; // NOTE: Reserved + + return SPV_SUCCESS; +} + +// Collects all numeric ids in the module source into |numeric_ids|. +// This function is essentially a dry-run of spvTextToBinary. +spv_result_t GetNumericIds(const spvtools::AssemblyGrammar& grammar, + const spvtools::MessageConsumer& consumer, + const spv_text text, + std::set* numeric_ids) { + spvtools::AssemblyContext context(text, consumer); + + if (!text->str) return context.diagnostic() << "Missing assembly text."; + + if (!grammar.isValid()) { + return SPV_ERROR_INVALID_TABLE; + } + + // Skip past whitespace and comments. + context.advance(); + + while (context.hasText()) { + spv_instruction_t inst; + + if (spvTextEncodeOpcode(grammar, &context, &inst)) { + return SPV_ERROR_INVALID_TEXT; + } + + if (context.advance()) break; + } + + *numeric_ids = context.GetNumericIds(); + return SPV_SUCCESS; +} + +// Translates a given assembly language module into binary form. +// If a diagnostic is generated, it is not yet marked as being +// for a text-based input. +spv_result_t spvTextToBinaryInternal(const spvtools::AssemblyGrammar& grammar, + const spvtools::MessageConsumer& consumer, + const spv_text text, + const uint32_t options, + spv_binary* pBinary) { + // The ids in this set will have the same values both in source and binary. + // All other ids will be generated by filling in the gaps. + std::set ids_to_preserve; + + if (options & SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS) { + // Collect all numeric ids from the source into ids_to_preserve. + const spv_result_t result = + GetNumericIds(grammar, consumer, text, &ids_to_preserve); + if (result != SPV_SUCCESS) return result; + } + + spvtools::AssemblyContext context(text, consumer, std::move(ids_to_preserve)); + + if (!text->str) return context.diagnostic() << "Missing assembly text."; + + if (!grammar.isValid()) { + return SPV_ERROR_INVALID_TABLE; + } + if (!pBinary) return SPV_ERROR_INVALID_POINTER; + + std::vector instructions; + + // Skip past whitespace and comments. + context.advance(); + + while (context.hasText()) { + instructions.push_back({}); + spv_instruction_t& inst = instructions.back(); + + if (spvTextEncodeOpcode(grammar, &context, &inst)) { + return SPV_ERROR_INVALID_TEXT; + } + + if (context.advance()) break; + } + + size_t totalSize = SPV_INDEX_INSTRUCTION; + for (auto& inst : instructions) { + totalSize += inst.words.size(); + } + + uint32_t* data = new uint32_t[totalSize]; + if (!data) return SPV_ERROR_OUT_OF_MEMORY; + uint64_t currentIndex = SPV_INDEX_INSTRUCTION; + for (auto& inst : instructions) { + memcpy(data + currentIndex, inst.words.data(), + sizeof(uint32_t) * inst.words.size()); + currentIndex += inst.words.size(); + } + + if (auto error = SetHeader(grammar.target_env(), context.getBound(), data)) + return error; + + spv_binary binary = new spv_binary_t(); + if (!binary) { + delete[] data; + return SPV_ERROR_OUT_OF_MEMORY; + } + binary->code = data; + binary->wordCount = totalSize; + + *pBinary = binary; + + return SPV_SUCCESS; +} + +} // anonymous namespace + +spv_result_t spvTextToBinary(const spv_const_context context, + const char* input_text, + const size_t input_text_size, spv_binary* pBinary, + spv_diagnostic* pDiagnostic) { + return spvTextToBinaryWithOptions(context, input_text, input_text_size, + SPV_BINARY_TO_TEXT_OPTION_NONE, pBinary, + pDiagnostic); +} + +spv_result_t spvTextToBinaryWithOptions(const spv_const_context context, + const char* input_text, + const size_t input_text_size, + const uint32_t options, + spv_binary* pBinary, + spv_diagnostic* pDiagnostic) { + spv_context_t hijack_context = *context; + if (pDiagnostic) { + *pDiagnostic = nullptr; + spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, pDiagnostic); + } + + spv_text_t text = {input_text, input_text_size}; + spvtools::AssemblyGrammar grammar(&hijack_context); + + spv_result_t result = spvTextToBinaryInternal( + grammar, hijack_context.consumer, &text, options, pBinary); + if (pDiagnostic && *pDiagnostic) (*pDiagnostic)->isTextSource = true; + + return result; +} + +void spvTextDestroy(spv_text text) { + if (!text) return; + delete[] text->str; + delete text; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/text.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/text.h new file mode 100644 index 00000000000..fa34ee16be1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/text.h @@ -0,0 +1,53 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_TEXT_H_ +#define SOURCE_TEXT_H_ + +#include + +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "spirv-tools/libspirv.h" + +typedef enum spv_literal_type_t { + SPV_LITERAL_TYPE_INT_32, + SPV_LITERAL_TYPE_INT_64, + SPV_LITERAL_TYPE_UINT_32, + SPV_LITERAL_TYPE_UINT_64, + SPV_LITERAL_TYPE_FLOAT_32, + SPV_LITERAL_TYPE_FLOAT_64, + SPV_LITERAL_TYPE_STRING, + SPV_FORCE_32_BIT_ENUM(spv_literal_type_t) +} spv_literal_type_t; + +typedef struct spv_literal_t { + spv_literal_type_t type; + union value_t { + int32_t i32; + int64_t i64; + uint32_t u32; + uint64_t u64; + float f; + double d; + } value; + std::string str; // Special field for literal string. +} spv_literal_t; + +// Converts the given text string to a number/string literal and writes the +// result to *literal. String literals must be surrounded by double-quotes ("), +// which are then stripped. +spv_result_t spvTextToLiteral(const char* text, spv_literal_t* literal); + +#endif // SOURCE_TEXT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/text_handler.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/text_handler.cpp new file mode 100644 index 00000000000..5f6e8c41f17 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/text_handler.cpp @@ -0,0 +1,397 @@ +// Copyright (c) 2015-2016 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. + +#include "source/text_handler.h" + +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/ext_inst.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/text.h" +#include "source/util/bitutils.h" +#include "source/util/hex_float.h" +#include "source/util/parse_number.h" + +namespace spvtools { +namespace { + +// Advances |text| to the start of the next line and writes the new position to +// |position|. +spv_result_t advanceLine(spv_text text, spv_position position) { + while (true) { + if (position->index >= text->length) return SPV_END_OF_STREAM; + switch (text->str[position->index]) { + case '\0': + return SPV_END_OF_STREAM; + case '\n': + position->column = 0; + position->line++; + position->index++; + return SPV_SUCCESS; + default: + position->column++; + position->index++; + break; + } + } +} + +// Advances |text| to first non white space character and writes the new +// position to |position|. +// If a null terminator is found during the text advance, SPV_END_OF_STREAM is +// returned, SPV_SUCCESS otherwise. No error checking is performed on the +// parameters, its the users responsibility to ensure these are non null. +spv_result_t advance(spv_text text, spv_position position) { + // NOTE: Consume white space, otherwise don't advance. + if (position->index >= text->length) return SPV_END_OF_STREAM; + switch (text->str[position->index]) { + case '\0': + return SPV_END_OF_STREAM; + case ';': + if (spv_result_t error = advanceLine(text, position)) return error; + return advance(text, position); + case ' ': + case '\t': + case '\r': + position->column++; + position->index++; + return advance(text, position); + case '\n': + position->column = 0; + position->line++; + position->index++; + return advance(text, position); + default: + break; + } + return SPV_SUCCESS; +} + +// Fetches the next word from the given text stream starting from the given +// *position. On success, writes the decoded word into *word and updates +// *position to the location past the returned word. +// +// A word ends at the next comment or whitespace. However, double-quoted +// strings remain intact, and a backslash always escapes the next character. +spv_result_t getWord(spv_text text, spv_position position, std::string* word) { + if (!text->str || !text->length) return SPV_ERROR_INVALID_TEXT; + if (!position) return SPV_ERROR_INVALID_POINTER; + + const size_t start_index = position->index; + + bool quoting = false; + bool escaping = false; + + // NOTE: Assumes first character is not white space! + while (true) { + if (position->index >= text->length) { + word->assign(text->str + start_index, text->str + position->index); + return SPV_SUCCESS; + } + const char ch = text->str[position->index]; + if (ch == '\\') { + escaping = !escaping; + } else { + switch (ch) { + case '"': + if (!escaping) quoting = !quoting; + break; + case ' ': + case ';': + case '\t': + case '\n': + case '\r': + if (escaping || quoting) break; + // Fall through. + case '\0': { // NOTE: End of word found! + word->assign(text->str + start_index, text->str + position->index); + return SPV_SUCCESS; + } + default: + break; + } + escaping = false; + } + + position->column++; + position->index++; + } +} + +// Returns true if the characters in the text as position represent +// the start of an Opcode. +bool startsWithOp(spv_text text, spv_position position) { + if (text->length < position->index + 3) return false; + char ch0 = text->str[position->index]; + char ch1 = text->str[position->index + 1]; + char ch2 = text->str[position->index + 2]; + return ('O' == ch0 && 'p' == ch1 && ('A' <= ch2 && ch2 <= 'Z')); +} + +} // namespace + +const IdType kUnknownType = {0, false, IdTypeClass::kBottom}; + +// TODO(dneto): Reorder AssemblyContext definitions to match declaration order. + +// This represents all of the data that is only valid for the duration of +// a single compilation. +uint32_t AssemblyContext::spvNamedIdAssignOrGet(const char* textValue) { + if (!ids_to_preserve_.empty()) { + uint32_t id = 0; + if (spvtools::utils::ParseNumber(textValue, &id)) { + if (ids_to_preserve_.find(id) != ids_to_preserve_.end()) { + bound_ = std::max(bound_, id + 1); + return id; + } + } + } + + const auto it = named_ids_.find(textValue); + if (it == named_ids_.end()) { + uint32_t id = next_id_++; + if (!ids_to_preserve_.empty()) { + while (ids_to_preserve_.find(id) != ids_to_preserve_.end()) { + id = next_id_++; + } + } + + named_ids_.emplace(textValue, id); + bound_ = std::max(bound_, id + 1); + return id; + } + + return it->second; +} + +uint32_t AssemblyContext::getBound() const { return bound_; } + +spv_result_t AssemblyContext::advance() { + return spvtools::advance(text_, ¤t_position_); +} + +spv_result_t AssemblyContext::getWord(std::string* word, + spv_position next_position) { + *next_position = current_position_; + return spvtools::getWord(text_, next_position, word); +} + +bool AssemblyContext::startsWithOp() { + return spvtools::startsWithOp(text_, ¤t_position_); +} + +bool AssemblyContext::isStartOfNewInst() { + spv_position_t pos = current_position_; + if (spvtools::advance(text_, &pos)) return false; + if (spvtools::startsWithOp(text_, &pos)) return true; + + std::string word; + pos = current_position_; + if (spvtools::getWord(text_, &pos, &word)) return false; + if ('%' != word.front()) return false; + + if (spvtools::advance(text_, &pos)) return false; + if (spvtools::getWord(text_, &pos, &word)) return false; + if ("=" != word) return false; + + if (spvtools::advance(text_, &pos)) return false; + if (spvtools::startsWithOp(text_, &pos)) return true; + return false; +} + +char AssemblyContext::peek() const { + return text_->str[current_position_.index]; +} + +bool AssemblyContext::hasText() const { + return text_->length > current_position_.index; +} + +void AssemblyContext::seekForward(uint32_t size) { + current_position_.index += size; + current_position_.column += size; +} + +spv_result_t AssemblyContext::binaryEncodeU32(const uint32_t value, + spv_instruction_t* pInst) { + pInst->words.insert(pInst->words.end(), value); + return SPV_SUCCESS; +} + +spv_result_t AssemblyContext::binaryEncodeNumericLiteral( + const char* val, spv_result_t error_code, const IdType& type, + spv_instruction_t* pInst) { + using spvtools::utils::EncodeNumberStatus; + // Populate the NumberType from the IdType for parsing. + spvtools::utils::NumberType number_type; + switch (type.type_class) { + case IdTypeClass::kOtherType: + return diagnostic(SPV_ERROR_INTERNAL) + << "Unexpected numeric literal type"; + case IdTypeClass::kScalarIntegerType: + if (type.isSigned) { + number_type = {type.bitwidth, SPV_NUMBER_SIGNED_INT}; + } else { + number_type = {type.bitwidth, SPV_NUMBER_UNSIGNED_INT}; + } + break; + case IdTypeClass::kScalarFloatType: + number_type = {type.bitwidth, SPV_NUMBER_FLOATING}; + break; + case IdTypeClass::kBottom: + // kBottom means the type is unknown and we need to infer the type before + // parsing the number. The rule is: If there is a decimal point, treat + // the value as a floating point value, otherwise a integer value, then + // if the first char of the integer text is '-', treat the integer as a + // signed integer, otherwise an unsigned integer. + uint32_t bitwidth = static_cast(assumedBitWidth(type)); + if (strchr(val, '.')) { + number_type = {bitwidth, SPV_NUMBER_FLOATING}; + } else if (type.isSigned || val[0] == '-') { + number_type = {bitwidth, SPV_NUMBER_SIGNED_INT}; + } else { + number_type = {bitwidth, SPV_NUMBER_UNSIGNED_INT}; + } + break; + } + + std::string error_msg; + EncodeNumberStatus parse_status = ParseAndEncodeNumber( + val, number_type, + [this, pInst](uint32_t d) { this->binaryEncodeU32(d, pInst); }, + &error_msg); + switch (parse_status) { + case EncodeNumberStatus::kSuccess: + return SPV_SUCCESS; + case EncodeNumberStatus::kInvalidText: + return diagnostic(error_code) << error_msg; + case EncodeNumberStatus::kUnsupported: + return diagnostic(SPV_ERROR_INTERNAL) << error_msg; + case EncodeNumberStatus::kInvalidUsage: + return diagnostic(SPV_ERROR_INVALID_TEXT) << error_msg; + } + // This line is not reachable, only added to satisfy the compiler. + return diagnostic(SPV_ERROR_INTERNAL) + << "Unexpected result code from ParseAndEncodeNumber()"; +} + +spv_result_t AssemblyContext::binaryEncodeString(const char* value, + spv_instruction_t* pInst) { + const size_t length = strlen(value); + const size_t wordCount = (length / 4) + 1; + const size_t oldWordCount = pInst->words.size(); + const size_t newWordCount = oldWordCount + wordCount; + + // TODO(dneto): We can just defer this check until later. + if (newWordCount > SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX) { + return diagnostic() << "Instruction too long: more than " + << SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX << " words."; + } + + pInst->words.resize(newWordCount); + + // Make sure all the bytes in the last word are 0, in case we only + // write a partial word at the end. + pInst->words.back() = 0; + + char* dest = (char*)&pInst->words[oldWordCount]; + strncpy(dest, value, length); + + return SPV_SUCCESS; +} + +spv_result_t AssemblyContext::recordTypeDefinition( + const spv_instruction_t* pInst) { + uint32_t value = pInst->words[1]; + if (types_.find(value) != types_.end()) { + return diagnostic() << "Value " << value + << " has already been used to generate a type"; + } + + if (pInst->opcode == SpvOpTypeInt) { + if (pInst->words.size() != 4) + return diagnostic() << "Invalid OpTypeInt instruction"; + types_[value] = {pInst->words[2], pInst->words[3] != 0, + IdTypeClass::kScalarIntegerType}; + } else if (pInst->opcode == SpvOpTypeFloat) { + if (pInst->words.size() != 3) + return diagnostic() << "Invalid OpTypeFloat instruction"; + types_[value] = {pInst->words[2], false, IdTypeClass::kScalarFloatType}; + } else { + types_[value] = {0, false, IdTypeClass::kOtherType}; + } + return SPV_SUCCESS; +} + +IdType AssemblyContext::getTypeOfTypeGeneratingValue(uint32_t value) const { + auto type = types_.find(value); + if (type == types_.end()) { + return kUnknownType; + } + return std::get<1>(*type); +} + +IdType AssemblyContext::getTypeOfValueInstruction(uint32_t value) const { + auto type_value = value_types_.find(value); + if (type_value == value_types_.end()) { + return {0, false, IdTypeClass::kBottom}; + } + return getTypeOfTypeGeneratingValue(std::get<1>(*type_value)); +} + +spv_result_t AssemblyContext::recordTypeIdForValue(uint32_t value, + uint32_t type) { + bool successfully_inserted = false; + std::tie(std::ignore, successfully_inserted) = + value_types_.insert(std::make_pair(value, type)); + if (!successfully_inserted) + return diagnostic() << "Value is being defined a second time"; + return SPV_SUCCESS; +} + +spv_result_t AssemblyContext::recordIdAsExtInstImport( + uint32_t id, spv_ext_inst_type_t type) { + bool successfully_inserted = false; + std::tie(std::ignore, successfully_inserted) = + import_id_to_ext_inst_type_.insert(std::make_pair(id, type)); + if (!successfully_inserted) + return diagnostic() << "Import Id is being defined a second time"; + return SPV_SUCCESS; +} + +spv_ext_inst_type_t AssemblyContext::getExtInstTypeForId(uint32_t id) const { + auto type = import_id_to_ext_inst_type_.find(id); + if (type == import_id_to_ext_inst_type_.end()) { + return SPV_EXT_INST_TYPE_NONE; + } + return std::get<1>(*type); +} + +std::set AssemblyContext::GetNumericIds() const { + std::set ids; + for (const auto& kv : named_ids_) { + uint32_t id; + if (spvtools::utils::ParseNumber(kv.first.c_str(), &id)) ids.insert(id); + } + return ids; +} + +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/text_handler.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/text_handler.h new file mode 100644 index 00000000000..19972e95194 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/text_handler.h @@ -0,0 +1,264 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_TEXT_HANDLER_H_ +#define SOURCE_TEXT_HANDLER_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/instruction.h" +#include "source/text.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { + +// Structures + +// This is a lattice for tracking types. +enum class IdTypeClass { + kBottom = 0, // We have no information yet. + kScalarIntegerType, + kScalarFloatType, + kOtherType +}; + +// Contains ID type information that needs to be tracked across all Ids. +// Bitwidth is only valid when type_class is kScalarIntegerType or +// kScalarFloatType. +struct IdType { + uint32_t bitwidth; // Safe to assume that we will not have > 2^32 bits. + bool isSigned; // This is only significant if type_class is integral. + IdTypeClass type_class; +}; + +// Default equality operator for IdType. Tests if all members are the same. +inline bool operator==(const IdType& first, const IdType& second) { + return (first.bitwidth == second.bitwidth) && + (first.isSigned == second.isSigned) && + (first.type_class == second.type_class); +} + +// Tests whether any member of the IdTypes do not match. +inline bool operator!=(const IdType& first, const IdType& second) { + return !(first == second); +} + +// A value representing an unknown type. +extern const IdType kUnknownType; + +// Returns true if the type is a scalar integer type. +inline bool isScalarIntegral(const IdType& type) { + return type.type_class == IdTypeClass::kScalarIntegerType; +} + +// Returns true if the type is a scalar floating point type. +inline bool isScalarFloating(const IdType& type) { + return type.type_class == IdTypeClass::kScalarFloatType; +} + +// Returns the number of bits in the type. +// This is only valid for bottom, scalar integer, and scalar floating +// classes. For bottom, assume 32 bits. +inline int assumedBitWidth(const IdType& type) { + switch (type.type_class) { + case IdTypeClass::kBottom: + return 32; + case IdTypeClass::kScalarIntegerType: + case IdTypeClass::kScalarFloatType: + return type.bitwidth; + default: + break; + } + // We don't care about this case. + return 0; +} + +// A templated class with a static member function Clamp, where Clamp +// sets a referenced value of type T to 0 if T is an unsigned +// integer type, and returns true if it modified the referenced +// value. +template +class ClampToZeroIfUnsignedType { + public: + // The default specialization does not clamp the value. + static bool Clamp(T*) { return false; } +}; + +// The specialization of ClampToZeroIfUnsignedType for unsigned integer +// types. +template +class ClampToZeroIfUnsignedType< + T, typename std::enable_if::value>::type> { + public: + static bool Clamp(T* value_pointer) { + if (*value_pointer) { + *value_pointer = 0; + return true; + } + return false; + } +}; + +// Encapsulates the data used during the assembly of a SPIR-V module. +class AssemblyContext { + public: + AssemblyContext(spv_text text, const MessageConsumer& consumer, + std::set&& ids_to_preserve = std::set()) + : current_position_({}), + consumer_(consumer), + text_(text), + bound_(1), + next_id_(1), + ids_to_preserve_(std::move(ids_to_preserve)) {} + + // Assigns a new integer value to the given text ID, or returns the previously + // assigned integer value if the ID has been seen before. + uint32_t spvNamedIdAssignOrGet(const char* textValue); + + // Returns the largest largest numeric ID that has been assigned. + uint32_t getBound() const; + + // Advances position to point to the next word in the input stream. + // Returns SPV_SUCCESS on success. + spv_result_t advance(); + + // Sets word to the next word in the input text. Fills next_position with + // the next location past the end of the word. + spv_result_t getWord(std::string* word, spv_position next_position); + + // Returns true if the next word in the input is the start of a new Opcode. + bool startsWithOp(); + + // Returns true if the next word in the input is the start of a new + // instruction. + bool isStartOfNewInst(); + + // Returns a diagnostic object initialized with current position in the input + // stream, and for the given error code. Any data written to this object will + // show up in pDiagnsotic on destruction. + DiagnosticStream diagnostic(spv_result_t error) { + return DiagnosticStream(current_position_, consumer_, "", error); + } + + // Returns a diagnostic object with the default assembly error code. + DiagnosticStream diagnostic() { + // The default failure for assembly is invalid text. + return diagnostic(SPV_ERROR_INVALID_TEXT); + } + + // Returns then next character in the input stream. + char peek() const; + + // Returns true if there is more text in the input stream. + bool hasText() const; + + // Seeks the input stream forward by 'size' characters. + void seekForward(uint32_t size); + + // Sets the current position in the input stream to the given position. + void setPosition(const spv_position_t& newPosition) { + current_position_ = newPosition; + } + + // Returns the current position in the input stream. + const spv_position_t& position() const { return current_position_; } + + // Appends the given 32-bit value to the given instruction. + // Returns SPV_SUCCESS if the value could be correctly inserted in the + // instruction. + spv_result_t binaryEncodeU32(const uint32_t value, spv_instruction_t* pInst); + + // Appends the given string to the given instruction. + // Returns SPV_SUCCESS if the value could be correctly inserted in the + // instruction. + spv_result_t binaryEncodeString(const char* value, spv_instruction_t* pInst); + + // Appends the given numeric literal to the given instruction. + // Validates and respects the bitwidth supplied in the IdType argument. + // If the type is of class kBottom the value will be encoded as a + // 32-bit integer. + // Returns SPV_SUCCESS if the value could be correctly added to the + // instruction. Returns the given error code on failure, and emits + // a diagnostic if that error code is not SPV_FAILED_MATCH. + spv_result_t binaryEncodeNumericLiteral(const char* numeric_literal, + spv_result_t error_code, + const IdType& type, + spv_instruction_t* pInst); + + // Returns the IdType associated with this type-generating value. + // If the type has not been previously recorded with recordTypeDefinition, + // kUnknownType will be returned. + IdType getTypeOfTypeGeneratingValue(uint32_t value) const; + + // Returns the IdType that represents the return value of this Value + // generating instruction. + // If the value has not been recorded with recordTypeIdForValue, or the type + // could not be determined kUnknownType will be returned. + IdType getTypeOfValueInstruction(uint32_t value) const; + + // Tracks the type-defining instruction. The result of the tracking can + // later be queried using getValueType. + // pInst is expected to be completely filled in by the time this instruction + // is called. + // Returns SPV_SUCCESS on success, or SPV_ERROR_INVALID_VALUE on error. + spv_result_t recordTypeDefinition(const spv_instruction_t* pInst); + + // Tracks the relationship between the value and its type. + spv_result_t recordTypeIdForValue(uint32_t value, uint32_t type); + + // Records the given Id as being the import of the given extended instruction + // type. + spv_result_t recordIdAsExtInstImport(uint32_t id, spv_ext_inst_type_t type); + + // Returns the extended instruction type corresponding to the import with + // the given Id, if it exists. Returns SPV_EXT_INST_TYPE_NONE if the + // id is not the id for an extended instruction type. + spv_ext_inst_type_t getExtInstTypeForId(uint32_t id) const; + + // Returns a set consisting of each ID generated by spvNamedIdAssignOrGet from + // a numeric ID text representation. For example, generated from "%12" but not + // from "%foo". + std::set GetNumericIds() const; + + private: + // Maps ID names to their corresponding numerical ids. + using spv_named_id_table = std::unordered_map; + // Maps type-defining IDs to their IdType. + using spv_id_to_type_map = std::unordered_map; + // Maps Ids to the id of their type. + using spv_id_to_type_id = std::unordered_map; + + spv_named_id_table named_ids_; + spv_id_to_type_map types_; + spv_id_to_type_id value_types_; + // Maps an extended instruction import Id to the extended instruction type. + std::unordered_map import_id_to_ext_inst_type_; + spv_position_t current_position_; + MessageConsumer consumer_; + spv_text text_; + uint32_t bound_; + uint32_t next_id_; + std::set ids_to_preserve_; +}; + +} // namespace spvtools + +#endif // SOURCE_TEXT_HANDLER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bit_vector.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bit_vector.cpp new file mode 100644 index 00000000000..47e275bf461 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bit_vector.cpp @@ -0,0 +1,82 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/util/bit_vector.h" + +#include +#include + +namespace spvtools { +namespace utils { + +void BitVector::ReportDensity(std::ostream& out) { + uint32_t count = 0; + + for (BitContainer e : bits_) { + while (e != 0) { + if ((e & 1) != 0) { + ++count; + } + e = e >> 1; + } + } + + out << "count=" << count + << ", total size (bytes)=" << bits_.size() * sizeof(BitContainer) + << ", bytes per element=" + << (double)(bits_.size() * sizeof(BitContainer)) / (double)(count); +} + +bool BitVector::Or(const BitVector& other) { + auto this_it = this->bits_.begin(); + auto other_it = other.bits_.begin(); + bool modified = false; + + while (this_it != this->bits_.end() && other_it != other.bits_.end()) { + auto temp = *this_it | *other_it; + if (temp != *this_it) { + modified = true; + *this_it = temp; + } + ++this_it; + ++other_it; + } + + if (other_it != other.bits_.end()) { + modified = true; + this->bits_.insert(this->bits_.end(), other_it, other.bits_.end()); + } + + return modified; +} + +std::ostream& operator<<(std::ostream& out, const BitVector& bv) { + out << "{"; + for (uint32_t i = 0; i < bv.bits_.size(); ++i) { + BitVector::BitContainer b = bv.bits_[i]; + uint32_t j = 0; + while (b != 0) { + if (b & 1) { + out << ' ' << i * BitVector::kBitContainerSize + j; + } + ++j; + b = b >> 1; + } + } + out << "}"; + return out; +} + +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bit_vector.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bit_vector.h new file mode 100644 index 00000000000..3e189cb10d2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bit_vector.h @@ -0,0 +1,119 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_UTIL_BIT_VECTOR_H_ +#define SOURCE_UTIL_BIT_VECTOR_H_ + +#include +#include +#include + +namespace spvtools { +namespace utils { + +// Implements a bit vector class. +// +// All bits default to zero, and the upper bound is 2^32-1. +class BitVector { + private: + using BitContainer = uint64_t; + enum { kBitContainerSize = 64 }; + enum { kInitialNumBits = 1024 }; + + public: + // Creates a bit vector contianing 0s. + BitVector(uint32_t reserved_size = kInitialNumBits) + : bits_((reserved_size - 1) / kBitContainerSize + 1, 0) {} + + // Sets the |i|th bit to 1. Returns the |i|th bit before it was set. + bool Set(uint32_t i) { + uint32_t element_index = i / kBitContainerSize; + uint32_t bit_in_element = i % kBitContainerSize; + + if (element_index >= bits_.size()) { + bits_.resize(element_index + 1, 0); + } + + BitContainer original = bits_[element_index]; + BitContainer ith_bit = static_cast(1) << bit_in_element; + + if ((original & ith_bit) != 0) { + return true; + } else { + bits_[element_index] = original | ith_bit; + return false; + } + } + + // Sets the |i|th bit to 0. Return the |i|th bit before it was cleared. + bool Clear(uint32_t i) { + uint32_t element_index = i / kBitContainerSize; + uint32_t bit_in_element = i % kBitContainerSize; + + if (element_index >= bits_.size()) { + return false; + } + + BitContainer original = bits_[element_index]; + BitContainer ith_bit = static_cast(1) << bit_in_element; + + if ((original & ith_bit) == 0) { + return false; + } else { + bits_[element_index] = original & (~ith_bit); + return true; + } + } + + // Returns the |i|th bit. + bool Get(uint32_t i) const { + uint32_t element_index = i / kBitContainerSize; + uint32_t bit_in_element = i % kBitContainerSize; + + if (element_index >= bits_.size()) { + return false; + } + + return (bits_[element_index] & + (static_cast(1) << bit_in_element)) != 0; + } + + // Returns true if every bit is 0. + bool Empty() const { + for (BitContainer b : bits_) { + if (b != 0) { + return false; + } + } + return true; + } + + // Print a report on the densicy of the bit vector, number of 1 bits, number + // of bytes, and average bytes for 1 bit, to |out|. + void ReportDensity(std::ostream& out); + + friend std::ostream& operator<<(std::ostream&, const BitVector&); + + // Performs a bitwise-or operation on |this| and |that|, storing the result in + // |this|. Return true if |this| changed. + bool Or(const BitVector& that); + + private: + std::vector bits_; +}; + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_BIT_VECTOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bitutils.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bitutils.h new file mode 100644 index 00000000000..17d61df90ab --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/bitutils.h @@ -0,0 +1,96 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_UTIL_BITUTILS_H_ +#define SOURCE_UTIL_BITUTILS_H_ + +#include +#include + +namespace spvtools { +namespace utils { + +// Performs a bitwise copy of source to the destination type Dest. +template +Dest BitwiseCast(Src source) { + Dest dest; + static_assert(sizeof(source) == sizeof(dest), + "BitwiseCast: Source and destination must have the same size"); + std::memcpy(&dest, &source, sizeof(dest)); + return dest; +} + +// SetBits returns an integer of type with bits set +// for position through , counting from the least +// significant bit. In particular when Num == 0, no positions are set to 1. +// A static assert will be triggered if First + Num > sizeof(T) * 8, that is, +// a bit that will not fit in the underlying type is set. +template +struct SetBits { + static_assert(First < sizeof(T) * 8, + "Tried to set a bit that is shifted too far."); + const static T get = (T(1) << First) | SetBits::get; +}; + +template +struct SetBits { + const static T get = T(0); +}; + +// This is all compile-time so we can put our tests right here. +static_assert(SetBits::get == uint32_t(0x00000000), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0x00000001), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0x80000000), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0x00000006), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0xc0000000), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0x7FFFFFFF), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0xFFFFFFFF), + "SetBits failed"); +static_assert(SetBits::get == uint32_t(0xFFFF0000), + "SetBits failed"); + +static_assert(SetBits::get == uint64_t(0x0000000000000001LL), + "SetBits failed"); +static_assert(SetBits::get == uint64_t(0x8000000000000000LL), + "SetBits failed"); +static_assert(SetBits::get == uint64_t(0xc000000000000000LL), + "SetBits failed"); +static_assert(SetBits::get == uint64_t(0x0000000080000000LL), + "SetBits failed"); +static_assert(SetBits::get == uint64_t(0x00000000FFFF0000LL), + "SetBits failed"); + +// Returns number of '1' bits in a word. +template +size_t CountSetBits(T word) { + static_assert(std::is_integral::value, + "CountSetBits requires integer type"); + size_t count = 0; + while (word) { + word &= word - 1; + ++count; + } + return count; +} + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_BITUTILS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/hex_float.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/hex_float.h new file mode 100644 index 00000000000..b7baf093b40 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/hex_float.h @@ -0,0 +1,1150 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_UTIL_HEX_FLOAT_H_ +#define SOURCE_UTIL_HEX_FLOAT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/util/bitutils.h" + +#ifndef __GNUC__ +#define GCC_VERSION 0 +#else +#define GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif + +namespace spvtools { +namespace utils { + +class Float16 { + public: + Float16(uint16_t v) : val(v) {} + Float16() = default; + static bool isNan(const Float16& val) { + return ((val.val & 0x7C00) == 0x7C00) && ((val.val & 0x3FF) != 0); + } + // Returns true if the given value is any kind of infinity. + static bool isInfinity(const Float16& val) { + return ((val.val & 0x7C00) == 0x7C00) && ((val.val & 0x3FF) == 0); + } + Float16(const Float16& other) { val = other.val; } + uint16_t get_value() const { return val; } + + // Returns the maximum normal value. + static Float16 max() { return Float16(0x7bff); } + // Returns the lowest normal value. + static Float16 lowest() { return Float16(0xfbff); } + + private: + uint16_t val; +}; + +// To specialize this type, you must override uint_type to define +// an unsigned integer that can fit your floating point type. +// You must also add a isNan function that returns true if +// a value is Nan. +template +struct FloatProxyTraits { + using uint_type = void; +}; + +template <> +struct FloatProxyTraits { + using uint_type = uint32_t; + static bool isNan(float f) { return std::isnan(f); } + // Returns true if the given value is any kind of infinity. + static bool isInfinity(float f) { return std::isinf(f); } + // Returns the maximum normal value. + static float max() { return std::numeric_limits::max(); } + // Returns the lowest normal value. + static float lowest() { return std::numeric_limits::lowest(); } + // Returns the value as the native floating point format. + static float getAsFloat(const uint_type& t) { return BitwiseCast(t); } + // Returns the bits from the given floating pointer number. + static uint_type getBitsFromFloat(const float& t) { + return BitwiseCast(t); + } + // Returns the bitwidth. + static uint32_t width() { return 32u; } +}; + +template <> +struct FloatProxyTraits { + using uint_type = uint64_t; + static bool isNan(double f) { return std::isnan(f); } + // Returns true if the given value is any kind of infinity. + static bool isInfinity(double f) { return std::isinf(f); } + // Returns the maximum normal value. + static double max() { return std::numeric_limits::max(); } + // Returns the lowest normal value. + static double lowest() { return std::numeric_limits::lowest(); } + // Returns the value as the native floating point format. + static double getAsFloat(const uint_type& t) { + return BitwiseCast(t); + } + // Returns the bits from the given floating pointer number. + static uint_type getBitsFromFloat(const double& t) { + return BitwiseCast(t); + } + // Returns the bitwidth. + static uint32_t width() { return 64u; } +}; + +template <> +struct FloatProxyTraits { + using uint_type = uint16_t; + static bool isNan(Float16 f) { return Float16::isNan(f); } + // Returns true if the given value is any kind of infinity. + static bool isInfinity(Float16 f) { return Float16::isInfinity(f); } + // Returns the maximum normal value. + static Float16 max() { return Float16::max(); } + // Returns the lowest normal value. + static Float16 lowest() { return Float16::lowest(); } + // Returns the value as the native floating point format. + static Float16 getAsFloat(const uint_type& t) { return Float16(t); } + // Returns the bits from the given floating pointer number. + static uint_type getBitsFromFloat(const Float16& t) { return t.get_value(); } + // Returns the bitwidth. + static uint32_t width() { return 16u; } +}; + +// Since copying a floating point number (especially if it is NaN) +// does not guarantee that bits are preserved, this class lets us +// store the type and use it as a float when necessary. +template +class FloatProxy { + public: + using uint_type = typename FloatProxyTraits::uint_type; + + // Since this is to act similar to the normal floats, + // do not initialize the data by default. + FloatProxy() = default; + + // Intentionally non-explicit. This is a proxy type so + // implicit conversions allow us to use it more transparently. + FloatProxy(T val) { data_ = FloatProxyTraits::getBitsFromFloat(val); } + + // Intentionally non-explicit. This is a proxy type so + // implicit conversions allow us to use it more transparently. + FloatProxy(uint_type val) { data_ = val; } + + // This is helpful to have and is guaranteed not to stomp bits. + FloatProxy operator-() const { + return static_cast(data_ ^ + (uint_type(0x1) << (sizeof(T) * 8 - 1))); + } + + // Returns the data as a floating point value. + T getAsFloat() const { return FloatProxyTraits::getAsFloat(data_); } + + // Returns the raw data. + uint_type data() const { return data_; } + + // Returns a vector of words suitable for use in an Operand. + std::vector GetWords() const { + std::vector words; + if (FloatProxyTraits::width() == 64) { + FloatProxyTraits::uint_type d = data(); + words.push_back(static_cast(d)); + words.push_back(static_cast(d >> 32)); + } else { + words.push_back(static_cast(data())); + } + return words; + } + + // Returns true if the value represents any type of NaN. + bool isNan() { return FloatProxyTraits::isNan(getAsFloat()); } + // Returns true if the value represents any type of infinity. + bool isInfinity() { return FloatProxyTraits::isInfinity(getAsFloat()); } + + // Returns the maximum normal value. + static FloatProxy max() { + return FloatProxy(FloatProxyTraits::max()); + } + // Returns the lowest normal value. + static FloatProxy lowest() { + return FloatProxy(FloatProxyTraits::lowest()); + } + + private: + uint_type data_; +}; + +template +bool operator==(const FloatProxy& first, const FloatProxy& second) { + return first.data() == second.data(); +} + +// Reads a FloatProxy value as a normal float from a stream. +template +std::istream& operator>>(std::istream& is, FloatProxy& value) { + T float_val; + is >> float_val; + value = FloatProxy(float_val); + return is; +} + +// This is an example traits. It is not meant to be used in practice, but will +// be the default for any non-specialized type. +template +struct HexFloatTraits { + // Integer type that can store this hex-float. + using uint_type = void; + // Signed integer type that can store this hex-float. + using int_type = void; + // The numerical type that this HexFloat represents. + using underlying_type = void; + // The type needed to construct the underlying type. + using native_type = void; + // The number of bits that are actually relevant in the uint_type. + // This allows us to deal with, for example, 24-bit values in a 32-bit + // integer. + static const uint32_t num_used_bits = 0; + // Number of bits that represent the exponent. + static const uint32_t num_exponent_bits = 0; + // Number of bits that represent the fractional part. + static const uint32_t num_fraction_bits = 0; + // The bias of the exponent. (How much we need to subtract from the stored + // value to get the correct value.) + static const uint32_t exponent_bias = 0; +}; + +// Traits for IEEE float. +// 1 sign bit, 8 exponent bits, 23 fractional bits. +template <> +struct HexFloatTraits> { + using uint_type = uint32_t; + using int_type = int32_t; + using underlying_type = FloatProxy; + using native_type = float; + static const uint_type num_used_bits = 32; + static const uint_type num_exponent_bits = 8; + static const uint_type num_fraction_bits = 23; + static const uint_type exponent_bias = 127; +}; + +// Traits for IEEE double. +// 1 sign bit, 11 exponent bits, 52 fractional bits. +template <> +struct HexFloatTraits> { + using uint_type = uint64_t; + using int_type = int64_t; + using underlying_type = FloatProxy; + using native_type = double; + static const uint_type num_used_bits = 64; + static const uint_type num_exponent_bits = 11; + static const uint_type num_fraction_bits = 52; + static const uint_type exponent_bias = 1023; +}; + +// Traits for IEEE half. +// 1 sign bit, 5 exponent bits, 10 fractional bits. +template <> +struct HexFloatTraits> { + using uint_type = uint16_t; + using int_type = int16_t; + using underlying_type = uint16_t; + using native_type = uint16_t; + static const uint_type num_used_bits = 16; + static const uint_type num_exponent_bits = 5; + static const uint_type num_fraction_bits = 10; + static const uint_type exponent_bias = 15; +}; + +enum class round_direction { + kToZero, + kToNearestEven, + kToPositiveInfinity, + kToNegativeInfinity, + max = kToNegativeInfinity +}; + +// Template class that houses a floating pointer number. +// It exposes a number of constants based on the provided traits to +// assist in interpreting the bits of the value. +template > +class HexFloat { + public: + using uint_type = typename Traits::uint_type; + using int_type = typename Traits::int_type; + using underlying_type = typename Traits::underlying_type; + using native_type = typename Traits::native_type; + + explicit HexFloat(T f) : value_(f) {} + + T value() const { return value_; } + void set_value(T f) { value_ = f; } + + // These are all written like this because it is convenient to have + // compile-time constants for all of these values. + + // Pass-through values to save typing. + static const uint32_t num_used_bits = Traits::num_used_bits; + static const uint32_t exponent_bias = Traits::exponent_bias; + static const uint32_t num_exponent_bits = Traits::num_exponent_bits; + static const uint32_t num_fraction_bits = Traits::num_fraction_bits; + + // Number of bits to shift left to set the highest relevant bit. + static const uint32_t top_bit_left_shift = num_used_bits - 1; + // How many nibbles (hex characters) the fractional part takes up. + static const uint32_t fraction_nibbles = (num_fraction_bits + 3) / 4; + // If the fractional part does not fit evenly into a hex character (4-bits) + // then we have to left-shift to get rid of leading 0s. This is the amount + // we have to shift (might be 0). + static const uint32_t num_overflow_bits = + fraction_nibbles * 4 - num_fraction_bits; + + // The representation of the fraction, not the actual bits. This + // includes the leading bit that is usually implicit. + static const uint_type fraction_represent_mask = + SetBits::get; + + // The topmost bit in the nibble-aligned fraction. + static const uint_type fraction_top_bit = + uint_type(1) << (num_fraction_bits + num_overflow_bits - 1); + + // The least significant bit in the exponent, which is also the bit + // immediately to the left of the significand. + static const uint_type first_exponent_bit = uint_type(1) + << (num_fraction_bits); + + // The mask for the encoded fraction. It does not include the + // implicit bit. + static const uint_type fraction_encode_mask = + SetBits::get; + + // The bit that is used as a sign. + static const uint_type sign_mask = uint_type(1) << top_bit_left_shift; + + // The bits that represent the exponent. + static const uint_type exponent_mask = + SetBits::get; + + // How far left the exponent is shifted. + static const uint32_t exponent_left_shift = num_fraction_bits; + + // How far from the right edge the fraction is shifted. + static const uint32_t fraction_right_shift = + static_cast(sizeof(uint_type) * 8) - num_fraction_bits; + + // The maximum representable unbiased exponent. + static const int_type max_exponent = + (exponent_mask >> num_fraction_bits) - exponent_bias; + // The minimum representable exponent for normalized numbers. + static const int_type min_exponent = -static_cast(exponent_bias); + + // Returns the bits associated with the value. + uint_type getBits() const { return value_.data(); } + + // Returns the bits associated with the value, without the leading sign bit. + uint_type getUnsignedBits() const { + return static_cast(value_.data() & ~sign_mask); + } + + // Returns the bits associated with the exponent, shifted to start at the + // lsb of the type. + const uint_type getExponentBits() const { + return static_cast((getBits() & exponent_mask) >> + num_fraction_bits); + } + + // Returns the exponent in unbiased form. This is the exponent in the + // human-friendly form. + const int_type getUnbiasedExponent() const { + return static_cast(getExponentBits() - exponent_bias); + } + + // Returns just the significand bits from the value. + const uint_type getSignificandBits() const { + return getBits() & fraction_encode_mask; + } + + // If the number was normalized, returns the unbiased exponent. + // If the number was denormal, normalize the exponent first. + const int_type getUnbiasedNormalizedExponent() const { + if ((getBits() & ~sign_mask) == 0) { // special case if everything is 0 + return 0; + } + int_type exp = getUnbiasedExponent(); + if (exp == min_exponent) { // We are in denorm land. + uint_type significand_bits = getSignificandBits(); + while ((significand_bits & (first_exponent_bit >> 1)) == 0) { + significand_bits = static_cast(significand_bits << 1); + exp = static_cast(exp - 1); + } + significand_bits &= fraction_encode_mask; + } + return exp; + } + + // Returns the signficand after it has been normalized. + const uint_type getNormalizedSignificand() const { + int_type unbiased_exponent = getUnbiasedNormalizedExponent(); + uint_type significand = getSignificandBits(); + for (int_type i = unbiased_exponent; i <= min_exponent; ++i) { + significand = static_cast(significand << 1); + } + significand &= fraction_encode_mask; + return significand; + } + + // Returns true if this number represents a negative value. + bool isNegative() const { return (getBits() & sign_mask) != 0; } + + // Sets this HexFloat from the individual components. + // Note this assumes EVERY significand is normalized, and has an implicit + // leading one. This means that the only way that this method will set 0, + // is if you set a number so denormalized that it underflows. + // Do not use this method with raw bits extracted from a subnormal number, + // since subnormals do not have an implicit leading 1 in the significand. + // The significand is also expected to be in the + // lowest-most num_fraction_bits of the uint_type. + // The exponent is expected to be unbiased, meaning an exponent of + // 0 actually means 0. + // If underflow_round_up is set, then on underflow, if a number is non-0 + // and would underflow, we round up to the smallest denorm. + void setFromSignUnbiasedExponentAndNormalizedSignificand( + bool negative, int_type exponent, uint_type significand, + bool round_denorm_up) { + bool significand_is_zero = significand == 0; + + if (exponent <= min_exponent) { + // If this was denormalized, then we have to shift the bit on, meaning + // the significand is not zero. + significand_is_zero = false; + significand |= first_exponent_bit; + significand = static_cast(significand >> 1); + } + + while (exponent < min_exponent) { + significand = static_cast(significand >> 1); + ++exponent; + } + + if (exponent == min_exponent) { + if (significand == 0 && !significand_is_zero && round_denorm_up) { + significand = static_cast(0x1); + } + } + + uint_type new_value = 0; + if (negative) { + new_value = static_cast(new_value | sign_mask); + } + exponent = static_cast(exponent + exponent_bias); + assert(exponent >= 0); + + // put it all together + exponent = static_cast((exponent << exponent_left_shift) & + exponent_mask); + significand = static_cast(significand & fraction_encode_mask); + new_value = static_cast(new_value | (exponent | significand)); + value_ = T(new_value); + } + + // Increments the significand of this number by the given amount. + // If this would spill the significand into the implicit bit, + // carry is set to true and the significand is shifted to fit into + // the correct location, otherwise carry is set to false. + // All significands and to_increment are assumed to be within the bounds + // for a valid significand. + static uint_type incrementSignificand(uint_type significand, + uint_type to_increment, bool* carry) { + significand = static_cast(significand + to_increment); + *carry = false; + if (significand & first_exponent_bit) { + *carry = true; + // The implicit 1-bit will have carried, so we should zero-out the + // top bit and shift back. + significand = static_cast(significand & ~first_exponent_bit); + significand = static_cast(significand >> 1); + } + return significand; + } + +#if GCC_VERSION == 40801 + // These exist because MSVC throws warnings on negative right-shifts + // even if they are not going to be executed. Eg: + // constant_number < 0? 0: constant_number + // These convert the negative left-shifts into right shifts. + template + struct negatable_left_shift { + static uint_type val(uint_type val) { + if (N > 0) { + return static_cast(val << N); + } else { + return static_cast(val >> N); + } + } + }; + + template + struct negatable_right_shift { + static uint_type val(uint_type val) { + if (N > 0) { + return static_cast(val >> N); + } else { + return static_cast(val << N); + } + } + }; + +#else + // These exist because MSVC throws warnings on negative right-shifts + // even if they are not going to be executed. Eg: + // constant_number < 0? 0: constant_number + // These convert the negative left-shifts into right shifts. + template + struct negatable_left_shift { + static uint_type val(uint_type val) { + return static_cast(val >> -N); + } + }; + + template + struct negatable_left_shift= 0>::type> { + static uint_type val(uint_type val) { + return static_cast(val << N); + } + }; + + template + struct negatable_right_shift { + static uint_type val(uint_type val) { + return static_cast(val << -N); + } + }; + + template + struct negatable_right_shift= 0>::type> { + static uint_type val(uint_type val) { + return static_cast(val >> N); + } + }; +#endif + + // Returns the significand, rounded to fit in a significand in + // other_T. This is shifted so that the most significant + // bit of the rounded number lines up with the most significant bit + // of the returned significand. + template + typename other_T::uint_type getRoundedNormalizedSignificand( + round_direction dir, bool* carry_bit) { + using other_uint_type = typename other_T::uint_type; + static const int_type num_throwaway_bits = + static_cast(num_fraction_bits) - + static_cast(other_T::num_fraction_bits); + + static const uint_type last_significant_bit = + (num_throwaway_bits < 0) + ? 0 + : negatable_left_shift::val(1u); + static const uint_type first_rounded_bit = + (num_throwaway_bits < 1) + ? 0 + : negatable_left_shift::val(1u); + + static const uint_type throwaway_mask_bits = + num_throwaway_bits > 0 ? num_throwaway_bits : 0; + static const uint_type throwaway_mask = + SetBits::get; + + *carry_bit = false; + other_uint_type out_val = 0; + uint_type significand = getNormalizedSignificand(); + // If we are up-casting, then we just have to shift to the right location. + if (num_throwaway_bits <= 0) { + out_val = static_cast(significand); + uint_type shift_amount = static_cast(-num_throwaway_bits); + out_val = static_cast(out_val << shift_amount); + return out_val; + } + + // If every non-representable bit is 0, then we don't have any casting to + // do. + if ((significand & throwaway_mask) == 0) { + return static_cast( + negatable_right_shift::val(significand)); + } + + bool round_away_from_zero = false; + // We actually have to narrow the significand here, so we have to follow the + // rounding rules. + switch (dir) { + case round_direction::kToZero: + break; + case round_direction::kToPositiveInfinity: + round_away_from_zero = !isNegative(); + break; + case round_direction::kToNegativeInfinity: + round_away_from_zero = isNegative(); + break; + case round_direction::kToNearestEven: + // Have to round down, round bit is 0 + if ((first_rounded_bit & significand) == 0) { + break; + } + if (((significand & throwaway_mask) & ~first_rounded_bit) != 0) { + // If any subsequent bit of the rounded portion is non-0 then we round + // up. + round_away_from_zero = true; + break; + } + // We are exactly half-way between 2 numbers, pick even. + if ((significand & last_significant_bit) != 0) { + // 1 for our last bit, round up. + round_away_from_zero = true; + break; + } + break; + } + + if (round_away_from_zero) { + return static_cast( + negatable_right_shift::val(incrementSignificand( + significand, last_significant_bit, carry_bit))); + } else { + return static_cast( + negatable_right_shift::val(significand)); + } + } + + // Casts this value to another HexFloat. If the cast is widening, + // then round_dir is ignored. If the cast is narrowing, then + // the result is rounded in the direction specified. + // This number will retain Nan and Inf values. + // It will also saturate to Inf if the number overflows, and + // underflow to (0 or min depending on rounding) if the number underflows. + template + void castTo(other_T& other, round_direction round_dir) { + other = other_T(static_cast(0)); + bool negate = isNegative(); + if (getUnsignedBits() == 0) { + if (negate) { + other.set_value(-other.value()); + } + return; + } + uint_type significand = getSignificandBits(); + bool carried = false; + typename other_T::uint_type rounded_significand = + getRoundedNormalizedSignificand(round_dir, &carried); + + int_type exponent = getUnbiasedExponent(); + if (exponent == min_exponent) { + // If we are denormal, normalize the exponent, so that we can encode + // easily. + exponent = static_cast(exponent + 1); + for (uint_type check_bit = first_exponent_bit >> 1; check_bit != 0; + check_bit = static_cast(check_bit >> 1)) { + exponent = static_cast(exponent - 1); + if (check_bit & significand) break; + } + } + + bool is_nan = + (getBits() & exponent_mask) == exponent_mask && significand != 0; + bool is_inf = + !is_nan && + ((exponent + carried) > static_cast(other_T::exponent_bias) || + (significand == 0 && (getBits() & exponent_mask) == exponent_mask)); + + // If we are Nan or Inf we should pass that through. + if (is_inf) { + other.set_value(BitwiseCast( + static_cast( + (negate ? other_T::sign_mask : 0) | other_T::exponent_mask))); + return; + } + if (is_nan) { + typename other_T::uint_type shifted_significand; + shifted_significand = static_cast( + negatable_left_shift< + static_cast(other_T::num_fraction_bits) - + static_cast(num_fraction_bits)>::val(significand)); + + // We are some sort of Nan. We try to keep the bit-pattern of the Nan + // as close as possible. If we had to shift off bits so we are 0, then we + // just set the last bit. + other.set_value(BitwiseCast( + static_cast( + (negate ? other_T::sign_mask : 0) | other_T::exponent_mask | + (shifted_significand == 0 ? 0x1 : shifted_significand)))); + return; + } + + bool round_underflow_up = + isNegative() ? round_dir == round_direction::kToNegativeInfinity + : round_dir == round_direction::kToPositiveInfinity; + using other_int_type = typename other_T::int_type; + // setFromSignUnbiasedExponentAndNormalizedSignificand will + // zero out any underflowing value (but retain the sign). + other.setFromSignUnbiasedExponentAndNormalizedSignificand( + negate, static_cast(exponent), rounded_significand, + round_underflow_up); + return; + } + + private: + T value_; + + static_assert(num_used_bits == + Traits::num_exponent_bits + Traits::num_fraction_bits + 1, + "The number of bits do not fit"); + static_assert(sizeof(T) == sizeof(uint_type), "The type sizes do not match"); +}; + +// Returns 4 bits represented by the hex character. +inline uint8_t get_nibble_from_character(int character) { + const char* dec = "0123456789"; + const char* lower = "abcdef"; + const char* upper = "ABCDEF"; + const char* p = nullptr; + if ((p = strchr(dec, character))) { + return static_cast(p - dec); + } else if ((p = strchr(lower, character))) { + return static_cast(p - lower + 0xa); + } else if ((p = strchr(upper, character))) { + return static_cast(p - upper + 0xa); + } + + assert(false && "This was called with a non-hex character"); + return 0; +} + +// Outputs the given HexFloat to the stream. +template +std::ostream& operator<<(std::ostream& os, const HexFloat& value) { + using HF = HexFloat; + using uint_type = typename HF::uint_type; + using int_type = typename HF::int_type; + + static_assert(HF::num_used_bits != 0, + "num_used_bits must be non-zero for a valid float"); + static_assert(HF::num_exponent_bits != 0, + "num_exponent_bits must be non-zero for a valid float"); + static_assert(HF::num_fraction_bits != 0, + "num_fractin_bits must be non-zero for a valid float"); + + const uint_type bits = value.value().data(); + const char* const sign = (bits & HF::sign_mask) ? "-" : ""; + const uint_type exponent = static_cast( + (bits & HF::exponent_mask) >> HF::num_fraction_bits); + + uint_type fraction = static_cast((bits & HF::fraction_encode_mask) + << HF::num_overflow_bits); + + const bool is_zero = exponent == 0 && fraction == 0; + const bool is_denorm = exponent == 0 && !is_zero; + + // exponent contains the biased exponent we have to convert it back into + // the normal range. + int_type int_exponent = static_cast(exponent - HF::exponent_bias); + // If the number is all zeros, then we actually have to NOT shift the + // exponent. + int_exponent = is_zero ? 0 : int_exponent; + + // If we are denorm, then start shifting, and decreasing the exponent until + // our leading bit is 1. + + if (is_denorm) { + while ((fraction & HF::fraction_top_bit) == 0) { + fraction = static_cast(fraction << 1); + int_exponent = static_cast(int_exponent - 1); + } + // Since this is denormalized, we have to consume the leading 1 since it + // will end up being implicit. + fraction = static_cast(fraction << 1); // eat the leading 1 + fraction &= HF::fraction_represent_mask; + } + + uint_type fraction_nibbles = HF::fraction_nibbles; + // We do not have to display any trailing 0s, since this represents the + // fractional part. + while (fraction_nibbles > 0 && (fraction & 0xF) == 0) { + // Shift off any trailing values; + fraction = static_cast(fraction >> 4); + --fraction_nibbles; + } + + const auto saved_flags = os.flags(); + const auto saved_fill = os.fill(); + + os << sign << "0x" << (is_zero ? '0' : '1'); + if (fraction_nibbles) { + // Make sure to keep the leading 0s in place, since this is the fractional + // part. + os << "." << std::setw(static_cast(fraction_nibbles)) + << std::setfill('0') << std::hex << fraction; + } + os << "p" << std::dec << (int_exponent >= 0 ? "+" : "") << int_exponent; + + os.flags(saved_flags); + os.fill(saved_fill); + + return os; +} + +// Returns true if negate_value is true and the next character on the +// input stream is a plus or minus sign. In that case we also set the fail bit +// on the stream and set the value to the zero value for its type. +template +inline bool RejectParseDueToLeadingSign(std::istream& is, bool negate_value, + HexFloat& value) { + if (negate_value) { + auto next_char = is.peek(); + if (next_char == '-' || next_char == '+') { + // Fail the parse. Emulate standard behaviour by setting the value to + // the zero value, and set the fail bit on the stream. + value = HexFloat(typename HexFloat::uint_type{0}); + is.setstate(std::ios_base::failbit); + return true; + } + } + return false; +} + +// Parses a floating point number from the given stream and stores it into the +// value parameter. +// If negate_value is true then the number may not have a leading minus or +// plus, and if it successfully parses, then the number is negated before +// being stored into the value parameter. +// If the value cannot be correctly parsed or overflows the target floating +// point type, then set the fail bit on the stream. +// TODO(dneto): Promise C++11 standard behavior in how the value is set in +// the error case, but only after all target platforms implement it correctly. +// In particular, the Microsoft C++ runtime appears to be out of spec. +template +inline std::istream& ParseNormalFloat(std::istream& is, bool negate_value, + HexFloat& value) { + if (RejectParseDueToLeadingSign(is, negate_value, value)) { + return is; + } + T val; + is >> val; + if (negate_value) { + val = -val; + } + value.set_value(val); + // In the failure case, map -0.0 to 0.0. + if (is.fail() && value.getUnsignedBits() == 0u) { + value = HexFloat(typename HexFloat::uint_type{0}); + } + if (val.isInfinity()) { + // Fail the parse. Emulate standard behaviour by setting the value to + // the closest normal value, and set the fail bit on the stream. + value.set_value((value.isNegative() | negate_value) ? T::lowest() + : T::max()); + is.setstate(std::ios_base::failbit); + } + return is; +} + +// Specialization of ParseNormalFloat for FloatProxy values. +// This will parse the float as it were a 32-bit floating point number, +// and then round it down to fit into a Float16 value. +// The number is rounded towards zero. +// If negate_value is true then the number may not have a leading minus or +// plus, and if it successfully parses, then the number is negated before +// being stored into the value parameter. +// If the value cannot be correctly parsed or overflows the target floating +// point type, then set the fail bit on the stream. +// TODO(dneto): Promise C++11 standard behavior in how the value is set in +// the error case, but only after all target platforms implement it correctly. +// In particular, the Microsoft C++ runtime appears to be out of spec. +template <> +inline std::istream& +ParseNormalFloat, HexFloatTraits>>( + std::istream& is, bool negate_value, + HexFloat, HexFloatTraits>>& value) { + // First parse as a 32-bit float. + HexFloat> float_val(0.0f); + ParseNormalFloat(is, negate_value, float_val); + + // Then convert to 16-bit float, saturating at infinities, and + // rounding toward zero. + float_val.castTo(value, round_direction::kToZero); + + // Overflow on 16-bit behaves the same as for 32- and 64-bit: set the + // fail bit and set the lowest or highest value. + if (Float16::isInfinity(value.value().getAsFloat())) { + value.set_value(value.isNegative() ? Float16::lowest() : Float16::max()); + is.setstate(std::ios_base::failbit); + } + return is; +} + +// Reads a HexFloat from the given stream. +// If the float is not encoded as a hex-float then it will be parsed +// as a regular float. +// This may fail if your stream does not support at least one unget. +// Nan values can be encoded with "0x1.p+exponent_bias". +// This would normally overflow a float and round to +// infinity but this special pattern is the exact representation for a NaN, +// and therefore is actually encoded as the correct NaN. To encode inf, +// either 0x0p+exponent_bias can be specified or any exponent greater than +// exponent_bias. +// Examples using IEEE 32-bit float encoding. +// 0x1.0p+128 (+inf) +// -0x1.0p-128 (-inf) +// +// 0x1.1p+128 (+Nan) +// -0x1.1p+128 (-Nan) +// +// 0x1p+129 (+inf) +// -0x1p+129 (-inf) +template +std::istream& operator>>(std::istream& is, HexFloat& value) { + using HF = HexFloat; + using uint_type = typename HF::uint_type; + using int_type = typename HF::int_type; + + value.set_value(static_cast(0.f)); + + if (is.flags() & std::ios::skipws) { + // If the user wants to skip whitespace , then we should obey that. + while (std::isspace(is.peek())) { + is.get(); + } + } + + auto next_char = is.peek(); + bool negate_value = false; + + if (next_char != '-' && next_char != '0') { + return ParseNormalFloat(is, negate_value, value); + } + + if (next_char == '-') { + negate_value = true; + is.get(); + next_char = is.peek(); + } + + if (next_char == '0') { + is.get(); // We may have to unget this. + auto maybe_hex_start = is.peek(); + if (maybe_hex_start != 'x' && maybe_hex_start != 'X') { + is.unget(); + return ParseNormalFloat(is, negate_value, value); + } else { + is.get(); // Throw away the 'x'; + } + } else { + return ParseNormalFloat(is, negate_value, value); + } + + // This "looks" like a hex-float so treat it as one. + bool seen_p = false; + bool seen_dot = false; + uint_type fraction_index = 0; + + uint_type fraction = 0; + int_type exponent = HF::exponent_bias; + + // Strip off leading zeros so we don't have to special-case them later. + while ((next_char = is.peek()) == '0') { + is.get(); + } + + bool is_denorm = + true; // Assume denorm "representation" until we hear otherwise. + // NB: This does not mean the value is actually denorm, + // it just means that it was written 0. + bool bits_written = false; // Stays false until we write a bit. + while (!seen_p && !seen_dot) { + // Handle characters that are left of the fractional part. + if (next_char == '.') { + seen_dot = true; + } else if (next_char == 'p') { + seen_p = true; + } else if (::isxdigit(next_char)) { + // We know this is not denormalized since we have stripped all leading + // zeroes and we are not a ".". + is_denorm = false; + int number = get_nibble_from_character(next_char); + for (int i = 0; i < 4; ++i, number <<= 1) { + uint_type write_bit = (number & 0x8) ? 0x1 : 0x0; + if (bits_written) { + // If we are here the bits represented belong in the fractional + // part of the float, and we have to adjust the exponent accordingly. + fraction = static_cast( + fraction | + static_cast( + write_bit << (HF::top_bit_left_shift - fraction_index++))); + exponent = static_cast(exponent + 1); + } + bits_written |= write_bit != 0; + } + } else { + // We have not found our exponent yet, so we have to fail. + is.setstate(std::ios::failbit); + return is; + } + is.get(); + next_char = is.peek(); + } + bits_written = false; + while (seen_dot && !seen_p) { + // Handle only fractional parts now. + if (next_char == 'p') { + seen_p = true; + } else if (::isxdigit(next_char)) { + int number = get_nibble_from_character(next_char); + for (int i = 0; i < 4; ++i, number <<= 1) { + uint_type write_bit = (number & 0x8) ? 0x01 : 0x00; + bits_written |= write_bit != 0; + if (is_denorm && !bits_written) { + // Handle modifying the exponent here this way we can handle + // an arbitrary number of hex values without overflowing our + // integer. + exponent = static_cast(exponent - 1); + } else { + fraction = static_cast( + fraction | + static_cast( + write_bit << (HF::top_bit_left_shift - fraction_index++))); + } + } + } else { + // We still have not found our 'p' exponent yet, so this is not a valid + // hex-float. + is.setstate(std::ios::failbit); + return is; + } + is.get(); + next_char = is.peek(); + } + + bool seen_sign = false; + int8_t exponent_sign = 1; + int_type written_exponent = 0; + while (true) { + if ((next_char == '-' || next_char == '+')) { + if (seen_sign) { + is.setstate(std::ios::failbit); + return is; + } + seen_sign = true; + exponent_sign = (next_char == '-') ? -1 : 1; + } else if (::isdigit(next_char)) { + // Hex-floats express their exponent as decimal. + written_exponent = static_cast(written_exponent * 10); + written_exponent = + static_cast(written_exponent + (next_char - '0')); + } else { + break; + } + is.get(); + next_char = is.peek(); + } + + written_exponent = static_cast(written_exponent * exponent_sign); + exponent = static_cast(exponent + written_exponent); + + bool is_zero = is_denorm && (fraction == 0); + if (is_denorm && !is_zero) { + fraction = static_cast(fraction << 1); + exponent = static_cast(exponent - 1); + } else if (is_zero) { + exponent = 0; + } + + if (exponent <= 0 && !is_zero) { + fraction = static_cast(fraction >> 1); + fraction |= static_cast(1) << HF::top_bit_left_shift; + } + + fraction = (fraction >> HF::fraction_right_shift) & HF::fraction_encode_mask; + + const int_type max_exponent = + SetBits::get; + + // Handle actual denorm numbers + while (exponent < 0 && !is_zero) { + fraction = static_cast(fraction >> 1); + exponent = static_cast(exponent + 1); + + fraction &= HF::fraction_encode_mask; + if (fraction == 0) { + // We have underflowed our fraction. We should clamp to zero. + is_zero = true; + exponent = 0; + } + } + + // We have overflowed so we should be inf/-inf. + if (exponent > max_exponent) { + exponent = max_exponent; + fraction = 0; + } + + uint_type output_bits = static_cast( + static_cast(negate_value ? 1 : 0) << HF::top_bit_left_shift); + output_bits |= fraction; + + uint_type shifted_exponent = static_cast( + static_cast(exponent << HF::exponent_left_shift) & + HF::exponent_mask); + output_bits |= shifted_exponent; + + T output_float(output_bits); + value.set_value(output_float); + + return is; +} + +// Writes a FloatProxy value to a stream. +// Zero and normal numbers are printed in the usual notation, but with +// enough digits to fully reproduce the value. Other values (subnormal, +// NaN, and infinity) are printed as a hex float. +template +std::ostream& operator<<(std::ostream& os, const FloatProxy& value) { + auto float_val = value.getAsFloat(); + switch (std::fpclassify(float_val)) { + case FP_ZERO: + case FP_NORMAL: { + auto saved_precision = os.precision(); + os.precision(std::numeric_limits::max_digits10); + os << float_val; + os.precision(saved_precision); + } break; + default: + os << HexFloat>(value); + break; + } + return os; +} + +template <> +inline std::ostream& operator<<(std::ostream& os, + const FloatProxy& value) { + os << HexFloat>(value); + return os; +} + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_HEX_FLOAT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/ilist.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/ilist.h new file mode 100644 index 00000000000..9837b09b32b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/ilist.h @@ -0,0 +1,365 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_UTIL_ILIST_H_ +#define SOURCE_UTIL_ILIST_H_ + +#include +#include +#include +#include + +#include "source/util/ilist_node.h" + +namespace spvtools { +namespace utils { + +// An IntrusiveList is a generic implementation of a doubly-linked list. The +// intended convention for using this container is: +// +// class Node : public IntrusiveNodeBase { +// // Note that "Node", the class being defined is the template. +// // Must have a default constructor accessible to List. +// // Add whatever data is needed in the node +// }; +// +// using List = IntrusiveList; +// +// You can also inherit from IntrusiveList instead of a typedef if you want to +// add more functionality. +// +// The condition on the template for IntrusiveNodeBase is there to add some type +// checking to the container. The compiler will still allow inserting elements +// of type IntrusiveNodeBase, but that would be an error. This assumption +// allows NextNode and PreviousNode to return pointers to Node, and casting will +// not be required by the user. + +template +class IntrusiveList { + public: + static_assert( + std::is_base_of, NodeType>::value, + "The type from the node must be derived from IntrusiveNodeBase, with " + "itself in the template."); + + // Creates an empty list. + inline IntrusiveList(); + + // Moves the contents of the given list to the list being constructed. + IntrusiveList(IntrusiveList&&); + + // Destorys the list. Note that the elements of the list will not be deleted, + // but they will be removed from the list. + virtual ~IntrusiveList(); + + // Moves all of the elements in the list on the RHS to the list on the LHS. + IntrusiveList& operator=(IntrusiveList&&); + + // Basetype for iterators so an IntrusiveList can be traversed like STL + // containers. + template + class iterator_template { + public: + iterator_template(const iterator_template& i) : node_(i.node_) {} + + iterator_template& operator++() { + node_ = node_->next_node_; + return *this; + } + + iterator_template& operator--() { + node_ = node_->previous_node_; + return *this; + } + + iterator_template& operator=(const iterator_template& i) { + node_ = i.node_; + return *this; + } + + T& operator*() const { return *node_; } + T* operator->() const { return node_; } + + friend inline bool operator==(const iterator_template& lhs, + const iterator_template& rhs) { + return lhs.node_ == rhs.node_; + } + friend inline bool operator!=(const iterator_template& lhs, + const iterator_template& rhs) { + return !(lhs == rhs); + } + + // Moves the nodes in |list| to the list that |this| points to. The + // positions of the nodes will be immediately before the element pointed to + // by the iterator. The return value will be an iterator pointing to the + // first of the newly inserted elements. + iterator_template MoveBefore(IntrusiveList* list) { + if (list->empty()) return *this; + + NodeType* first_node = list->sentinel_.next_node_; + NodeType* last_node = list->sentinel_.previous_node_; + + this->node_->previous_node_->next_node_ = first_node; + first_node->previous_node_ = this->node_->previous_node_; + + last_node->next_node_ = this->node_; + this->node_->previous_node_ = last_node; + + list->sentinel_.next_node_ = &list->sentinel_; + list->sentinel_.previous_node_ = &list->sentinel_; + + return iterator(first_node); + } + + // Define standard iterator types needs so this class can be + // used with . + using iterator_category = std::bidirectional_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = T; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using size_type = size_t; + + protected: + iterator_template() = delete; + inline iterator_template(T* node) { node_ = node; } + T* node_; + + friend IntrusiveList; + }; + + using iterator = iterator_template; + using const_iterator = iterator_template; + + // Various types of iterators for the start (begin) and one past the end (end) + // of the list. + // + // Decrementing |end()| iterator will give and iterator pointing to the last + // element in the list, if one exists. + // + // Incrementing |end()| iterator will give |begin()|. + // + // Decrementing |begin()| will give |end()|. + // + // TODO: Not marking these functions as noexcept because Visual Studio 2013 + // does not support it. When we no longer care about that compiler, we should + // mark these as noexcept. + iterator begin(); + iterator end(); + const_iterator begin() const; + const_iterator end() const; + const_iterator cbegin() const; + const_iterator cend() const; + + // Appends |node| to the end of the list. If |node| is already in a list, it + // will be removed from that list first. + void push_back(NodeType* node); + + // Returns true if the list is empty. + bool empty() const; + + // Makes the current list empty. + inline void clear(); + + // Returns references to the first or last element in the list. It is an + // error to call these functions on an empty list. + NodeType& front(); + NodeType& back(); + const NodeType& front() const; + const NodeType& back() const; + + // Transfers [|first|, |last|) from |other| into the list at |where|. + // + // If |other| is |this|, no change is made. + void Splice(iterator where, IntrusiveList* other, iterator first, + iterator last); + + protected: + // Doing a deep copy of the list does not make sense if the list does not own + // the data. It is not clear who will own the newly created data. Making + // copies illegal for that reason. + IntrusiveList(const IntrusiveList&) = delete; + IntrusiveList& operator=(const IntrusiveList&) = delete; + + // This function will assert if it finds the list containing |node| is not in + // a valid state. + static void Check(NodeType* node); + + // A special node used to represent both the start and end of the list, + // without being part of the list. + NodeType sentinel_; +}; + +// Implementation of IntrusiveList + +template +inline IntrusiveList::IntrusiveList() : sentinel_() { + sentinel_.next_node_ = &sentinel_; + sentinel_.previous_node_ = &sentinel_; + sentinel_.is_sentinel_ = true; +} + +template +IntrusiveList::IntrusiveList(IntrusiveList&& list) : sentinel_() { + sentinel_.next_node_ = &sentinel_; + sentinel_.previous_node_ = &sentinel_; + sentinel_.is_sentinel_ = true; + list.sentinel_.ReplaceWith(&sentinel_); +} + +template +IntrusiveList::~IntrusiveList() { + clear(); +} + +template +IntrusiveList& IntrusiveList::operator=( + IntrusiveList&& list) { + list.sentinel_.ReplaceWith(&sentinel_); + return *this; +} + +template +inline typename IntrusiveList::iterator +IntrusiveList::begin() { + return iterator(sentinel_.next_node_); +} + +template +inline typename IntrusiveList::iterator +IntrusiveList::end() { + return iterator(&sentinel_); +} + +template +inline typename IntrusiveList::const_iterator +IntrusiveList::begin() const { + return const_iterator(sentinel_.next_node_); +} + +template +inline typename IntrusiveList::const_iterator +IntrusiveList::end() const { + return const_iterator(&sentinel_); +} + +template +inline typename IntrusiveList::const_iterator +IntrusiveList::cbegin() const { + return const_iterator(sentinel_.next_node_); +} + +template +inline typename IntrusiveList::const_iterator +IntrusiveList::cend() const { + return const_iterator(&sentinel_); +} + +template +void IntrusiveList::push_back(NodeType* node) { + node->InsertBefore(&sentinel_); +} + +template +bool IntrusiveList::empty() const { + return sentinel_.NextNode() == nullptr; +} + +template +void IntrusiveList::clear() { + while (!empty()) { + front().RemoveFromList(); + } +} + +template +NodeType& IntrusiveList::front() { + NodeType* node = sentinel_.NextNode(); + assert(node != nullptr && "Can't get the front of an empty list."); + return *node; +} + +template +NodeType& IntrusiveList::back() { + NodeType* node = sentinel_.PreviousNode(); + assert(node != nullptr && "Can't get the back of an empty list."); + return *node; +} + +template +const NodeType& IntrusiveList::front() const { + NodeType* node = sentinel_.NextNode(); + assert(node != nullptr && "Can't get the front of an empty list."); + return *node; +} + +template +const NodeType& IntrusiveList::back() const { + NodeType* node = sentinel_.PreviousNode(); + assert(node != nullptr && "Can't get the back of an empty list."); + return *node; +} + +template +void IntrusiveList::Splice(iterator where, + IntrusiveList* other, + iterator first, iterator last) { + if (first == last) return; + if (other == this) return; + + NodeType* first_prev = first.node_->previous_node_; + NodeType* where_next = where.node_->next_node_; + + // Attach first. + where.node_->next_node_ = first.node_; + first.node_->previous_node_ = where.node_; + + // Attach last. + where_next->previous_node_ = last.node_->previous_node_; + last.node_->previous_node_->next_node_ = where_next; + + // Fixup other. + first_prev->next_node_ = last.node_; + last.node_->previous_node_ = first_prev; +} + +template +void IntrusiveList::Check(NodeType* start) { + int sentinel_count = 0; + NodeType* p = start; + do { + assert(p != nullptr); + assert(p->next_node_->previous_node_ == p); + assert(p->previous_node_->next_node_ == p); + if (p->is_sentinel_) sentinel_count++; + p = p->next_node_; + } while (p != start); + assert(sentinel_count == 1 && "List should have exactly 1 sentinel node."); + + p = start; + do { + assert(p != nullptr); + assert(p->previous_node_->next_node_ == p); + assert(p->next_node_->previous_node_ == p); + if (p->is_sentinel_) sentinel_count++; + p = p->previous_node_; + } while (p != start); +} + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_ILIST_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/ilist_node.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/ilist_node.h new file mode 100644 index 00000000000..0579534b89f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/ilist_node.h @@ -0,0 +1,265 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_UTIL_ILIST_NODE_H_ +#define SOURCE_UTIL_ILIST_NODE_H_ + +#include + +namespace spvtools { +namespace utils { + +template +class IntrusiveList; + +// IntrusiveNodeBase is the base class for nodes in an IntrusiveList. +// See the comments in ilist.h on how to use the class. + +template +class IntrusiveNodeBase { + public: + // Creates a new node that is not in a list. + inline IntrusiveNodeBase(); + inline IntrusiveNodeBase(const IntrusiveNodeBase&); + inline IntrusiveNodeBase& operator=(const IntrusiveNodeBase&); + inline IntrusiveNodeBase(IntrusiveNodeBase&& that); + + // Destroys a node. It is an error to destroy a node that is part of a + // list, unless it is a sentinel. + virtual ~IntrusiveNodeBase(); + + IntrusiveNodeBase& operator=(IntrusiveNodeBase&& that); + + // Returns true if |this| is in a list. + inline bool IsInAList() const; + + // Returns the node that comes after the given node in the list, if one + // exists. If the given node is not in a list or is at the end of the list, + // the return value is nullptr. + inline NodeType* NextNode() const; + + // Returns the node that comes before the given node in the list, if one + // exists. If the given node is not in a list or is at the start of the + // list, the return value is nullptr. + inline NodeType* PreviousNode() const; + + // Inserts the given node immediately before |pos| in the list. + // If the given node is already in a list, it will first be removed + // from that list. + // + // It is assumed that the given node is of type NodeType. It is an error if + // |pos| is not already in a list. + inline void InsertBefore(NodeType* pos); + + // Inserts the given node immediately after |pos| in the list. + // If the given node is already in a list, it will first be removed + // from that list. + // + // It is assumed that the given node is of type NodeType. It is an error if + // |pos| is not already in a list, or if |pos| is equal to |this|. + inline void InsertAfter(NodeType* pos); + + // Removes the given node from the list. It is assumed that the node is + // in a list. Note that this does not free any storage related to the node, + // it becomes the caller's responsibility to free the storage. + inline void RemoveFromList(); + + protected: + // Replaces |this| with |target|. |this| is a sentinel if and only if + // |target| is also a sentinel. + // + // If neither node is a sentinel, |target| takes + // the place of |this|. It is assumed that |target| is not in a list. + // + // If both are sentinels, then it will cause all of the + // nodes in the list containing |this| to be moved to the list containing + // |target|. In this case, it is assumed that |target| is an empty list. + // + // No storage will be deleted. + void ReplaceWith(NodeType* target); + + // Returns true if |this| is the sentinel node of an empty list. + bool IsEmptyList(); + + // The pointers to the next and previous nodes in the list. + // If the current node is not part of a list, then |next_node_| and + // |previous_node_| are equal to |nullptr|. + NodeType* next_node_; + NodeType* previous_node_; + + // Only true for the sentinel node stored in the list itself. + bool is_sentinel_; + + friend IntrusiveList; +}; + +// Implementation of IntrusiveNodeBase + +template +inline IntrusiveNodeBase::IntrusiveNodeBase() + : next_node_(nullptr), previous_node_(nullptr), is_sentinel_(false) {} + +template +inline IntrusiveNodeBase::IntrusiveNodeBase( + const IntrusiveNodeBase&) { + next_node_ = nullptr; + previous_node_ = nullptr; + is_sentinel_ = false; +} + +template +inline IntrusiveNodeBase& IntrusiveNodeBase::operator=( + const IntrusiveNodeBase&) { + assert(!is_sentinel_); + if (IsInAList()) { + RemoveFromList(); + } + return *this; +} + +template +inline IntrusiveNodeBase::IntrusiveNodeBase(IntrusiveNodeBase&& that) + : next_node_(nullptr), + previous_node_(nullptr), + is_sentinel_(that.is_sentinel_) { + if (is_sentinel_) { + next_node_ = this; + previous_node_ = this; + } + that.ReplaceWith(this); +} + +template +IntrusiveNodeBase::~IntrusiveNodeBase() { + assert(is_sentinel_ || !IsInAList()); +} + +template +IntrusiveNodeBase& IntrusiveNodeBase::operator=( + IntrusiveNodeBase&& that) { + that.ReplaceWith(this); + return *this; +} + +template +inline bool IntrusiveNodeBase::IsInAList() const { + return next_node_ != nullptr; +} + +template +inline NodeType* IntrusiveNodeBase::NextNode() const { + if (!next_node_->is_sentinel_) return next_node_; + return nullptr; +} + +template +inline NodeType* IntrusiveNodeBase::PreviousNode() const { + if (!previous_node_->is_sentinel_) return previous_node_; + return nullptr; +} + +template +inline void IntrusiveNodeBase::InsertBefore(NodeType* pos) { + assert(!this->is_sentinel_ && "Sentinel nodes cannot be moved around."); + assert(pos->IsInAList() && "Pos should already be in a list."); + if (this->IsInAList()) this->RemoveFromList(); + + this->next_node_ = pos; + this->previous_node_ = pos->previous_node_; + pos->previous_node_ = static_cast(this); + this->previous_node_->next_node_ = static_cast(this); +} + +template +inline void IntrusiveNodeBase::InsertAfter(NodeType* pos) { + assert(!this->is_sentinel_ && "Sentinel nodes cannot be moved around."); + assert(pos->IsInAList() && "Pos should already be in a list."); + assert(this != pos && "Can't insert a node after itself."); + + if (this->IsInAList()) { + this->RemoveFromList(); + } + + this->previous_node_ = pos; + this->next_node_ = pos->next_node_; + pos->next_node_ = static_cast(this); + this->next_node_->previous_node_ = static_cast(this); +} + +template +inline void IntrusiveNodeBase::RemoveFromList() { + assert(!this->is_sentinel_ && "Sentinel nodes cannot be moved around."); + assert(this->IsInAList() && + "Cannot remove a node from a list if it is not in a list."); + + this->next_node_->previous_node_ = this->previous_node_; + this->previous_node_->next_node_ = this->next_node_; + this->next_node_ = nullptr; + this->previous_node_ = nullptr; +} + +template +void IntrusiveNodeBase::ReplaceWith(NodeType* target) { + if (this->is_sentinel_) { + assert(target->IsEmptyList() && + "If target is not an empty list, the nodes in that list would not " + "be linked to a sentinel."); + } else { + assert(IsInAList() && "The node being replaced must be in a list."); + assert(!target->is_sentinel_ && + "Cannot turn a sentinel node into one that is not."); + } + + if (!this->IsEmptyList()) { + // Link target into the same position that |this| was in. + target->next_node_ = this->next_node_; + target->previous_node_ = this->previous_node_; + target->next_node_->previous_node_ = target; + target->previous_node_->next_node_ = target; + + // Reset |this| to itself default value. + if (!this->is_sentinel_) { + // Reset |this| so that it is not in a list. + this->next_node_ = nullptr; + this->previous_node_ = nullptr; + } else { + // Set |this| so that it is the head of an empty list. + // We cannot treat sentinel nodes like others because it is invalid for + // a sentinel node to not be in a list. + this->next_node_ = static_cast(this); + this->previous_node_ = static_cast(this); + } + } else { + // If |this| points to itself, it must be a sentinel node with an empty + // list. Reset |this| so that it is the head of an empty list. We want + // |target| to be the same. The asserts above guarantee that. + } +} + +template +bool IntrusiveNodeBase::IsEmptyList() { + if (next_node_ == this) { + assert(is_sentinel_ && + "None sentinel nodes should never point to themselves."); + assert(previous_node_ == this && + "Inconsistency with the previous and next nodes."); + return true; + } + return false; +} + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_ILIST_NODE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/make_unique.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/make_unique.h new file mode 100644 index 00000000000..ad7976c3495 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/make_unique.h @@ -0,0 +1,30 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_UTIL_MAKE_UNIQUE_H_ +#define SOURCE_UTIL_MAKE_UNIQUE_H_ + +#include +#include + +namespace spvtools { + +template +std::unique_ptr MakeUnique(Args&&... args) { + return std::unique_ptr(new T(std::forward(args)...)); +} + +} // namespace spvtools + +#endif // SOURCE_UTIL_MAKE_UNIQUE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/parse_number.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/parse_number.cpp new file mode 100644 index 00000000000..c3351c23651 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/parse_number.cpp @@ -0,0 +1,217 @@ +// Copyright (c) 2016 Google 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. + +#include "source/util/parse_number.h" + +#include +#include +#include +#include +#include +#include + +#include "source/util/hex_float.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace utils { +namespace { + +// A helper class that temporarily stores error messages and dump the messages +// to a string which given as as pointer when it is destructed. If the given +// pointer is a nullptr, this class does not store error message. +class ErrorMsgStream { + public: + explicit ErrorMsgStream(std::string* error_msg_sink) + : error_msg_sink_(error_msg_sink) { + if (error_msg_sink_) stream_ = MakeUnique(); + } + ~ErrorMsgStream() { + if (error_msg_sink_ && stream_) *error_msg_sink_ = stream_->str(); + } + template + ErrorMsgStream& operator<<(T val) { + if (stream_) *stream_ << val; + return *this; + } + + private: + std::unique_ptr stream_; + // The destination string to which this class dump the error message when + // destructor is called. + std::string* error_msg_sink_; +}; +} // namespace + +EncodeNumberStatus ParseAndEncodeIntegerNumber( + const char* text, const NumberType& type, + std::function emit, std::string* error_msg) { + if (!text) { + ErrorMsgStream(error_msg) << "The given text is a nullptr"; + return EncodeNumberStatus::kInvalidText; + } + + if (!IsIntegral(type)) { + ErrorMsgStream(error_msg) << "The expected type is not a integer type"; + return EncodeNumberStatus::kInvalidUsage; + } + + const uint32_t bit_width = AssumedBitWidth(type); + + if (bit_width > 64) { + ErrorMsgStream(error_msg) + << "Unsupported " << bit_width << "-bit integer literals"; + return EncodeNumberStatus::kUnsupported; + } + + // Either we are expecting anything or integer. + bool is_negative = text[0] == '-'; + bool can_be_signed = IsSigned(type); + + if (is_negative && !can_be_signed) { + ErrorMsgStream(error_msg) + << "Cannot put a negative number in an unsigned literal"; + return EncodeNumberStatus::kInvalidUsage; + } + + const bool is_hex = text[0] == '0' && (text[1] == 'x' || text[1] == 'X'); + + uint64_t decoded_bits; + if (is_negative) { + int64_t decoded_signed = 0; + + if (!ParseNumber(text, &decoded_signed)) { + ErrorMsgStream(error_msg) << "Invalid signed integer literal: " << text; + return EncodeNumberStatus::kInvalidText; + } + + if (!CheckRangeAndIfHexThenSignExtend(decoded_signed, type, is_hex, + &decoded_signed)) { + ErrorMsgStream(error_msg) + << "Integer " << (is_hex ? std::hex : std::dec) << std::showbase + << decoded_signed << " does not fit in a " << std::dec << bit_width + << "-bit " << (IsSigned(type) ? "signed" : "unsigned") << " integer"; + return EncodeNumberStatus::kInvalidText; + } + decoded_bits = decoded_signed; + } else { + // There's no leading minus sign, so parse it as an unsigned integer. + if (!ParseNumber(text, &decoded_bits)) { + ErrorMsgStream(error_msg) << "Invalid unsigned integer literal: " << text; + return EncodeNumberStatus::kInvalidText; + } + if (!CheckRangeAndIfHexThenSignExtend(decoded_bits, type, is_hex, + &decoded_bits)) { + ErrorMsgStream(error_msg) + << "Integer " << (is_hex ? std::hex : std::dec) << std::showbase + << decoded_bits << " does not fit in a " << std::dec << bit_width + << "-bit " << (IsSigned(type) ? "signed" : "unsigned") << " integer"; + return EncodeNumberStatus::kInvalidText; + } + } + if (bit_width > 32) { + uint32_t low = uint32_t(0x00000000ffffffff & decoded_bits); + uint32_t high = uint32_t((0xffffffff00000000 & decoded_bits) >> 32); + emit(low); + emit(high); + } else { + emit(uint32_t(decoded_bits)); + } + return EncodeNumberStatus::kSuccess; +} + +EncodeNumberStatus ParseAndEncodeFloatingPointNumber( + const char* text, const NumberType& type, + std::function emit, std::string* error_msg) { + if (!text) { + ErrorMsgStream(error_msg) << "The given text is a nullptr"; + return EncodeNumberStatus::kInvalidText; + } + + if (!IsFloating(type)) { + ErrorMsgStream(error_msg) << "The expected type is not a float type"; + return EncodeNumberStatus::kInvalidUsage; + } + + const auto bit_width = AssumedBitWidth(type); + switch (bit_width) { + case 16: { + HexFloat> hVal(0); + if (!ParseNumber(text, &hVal)) { + ErrorMsgStream(error_msg) << "Invalid 16-bit float literal: " << text; + return EncodeNumberStatus::kInvalidText; + } + // getAsFloat will return the Float16 value, and get_value + // will return a uint16_t representing the bits of the float. + // The encoding is therefore correct from the perspective of the SPIR-V + // spec since the top 16 bits will be 0. + emit(static_cast(hVal.value().getAsFloat().get_value())); + return EncodeNumberStatus::kSuccess; + } break; + case 32: { + HexFloat> fVal(0.0f); + if (!ParseNumber(text, &fVal)) { + ErrorMsgStream(error_msg) << "Invalid 32-bit float literal: " << text; + return EncodeNumberStatus::kInvalidText; + } + emit(BitwiseCast(fVal)); + return EncodeNumberStatus::kSuccess; + } break; + case 64: { + HexFloat> dVal(0.0); + if (!ParseNumber(text, &dVal)) { + ErrorMsgStream(error_msg) << "Invalid 64-bit float literal: " << text; + return EncodeNumberStatus::kInvalidText; + } + uint64_t decoded_val = BitwiseCast(dVal); + uint32_t low = uint32_t(0x00000000ffffffff & decoded_val); + uint32_t high = uint32_t((0xffffffff00000000 & decoded_val) >> 32); + emit(low); + emit(high); + return EncodeNumberStatus::kSuccess; + } break; + default: + break; + } + ErrorMsgStream(error_msg) + << "Unsupported " << bit_width << "-bit float literals"; + return EncodeNumberStatus::kUnsupported; +} + +EncodeNumberStatus ParseAndEncodeNumber(const char* text, + const NumberType& type, + std::function emit, + std::string* error_msg) { + if (!text) { + ErrorMsgStream(error_msg) << "The given text is a nullptr"; + return EncodeNumberStatus::kInvalidText; + } + + if (IsUnknown(type)) { + ErrorMsgStream(error_msg) + << "The expected type is not a integer or float type"; + return EncodeNumberStatus::kInvalidUsage; + } + + // If we explicitly expect a floating-point number, we should handle that + // first. + if (IsFloating(type)) { + return ParseAndEncodeFloatingPointNumber(text, type, emit, error_msg); + } + + return ParseAndEncodeIntegerNumber(text, type, emit, error_msg); +} + +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/parse_number.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/parse_number.h new file mode 100644 index 00000000000..729aac54bf9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/parse_number.h @@ -0,0 +1,252 @@ +// Copyright (c) 2016 Google 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. + +#ifndef SOURCE_UTIL_PARSE_NUMBER_H_ +#define SOURCE_UTIL_PARSE_NUMBER_H_ + +#include +#include +#include + +#include "source/util/hex_float.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace utils { + +// A struct to hold the expected type information for the number in text to be +// parsed. +struct NumberType { + uint32_t bitwidth; + // SPV_NUMBER_NONE means the type is unknown and is invalid to be used with + // ParseAndEncode{|Integer|Floating}Number(). + spv_number_kind_t kind; +}; + +// Returns true if the type is a scalar integer type. +inline bool IsIntegral(const NumberType& type) { + return type.kind == SPV_NUMBER_UNSIGNED_INT || + type.kind == SPV_NUMBER_SIGNED_INT; +} + +// Returns true if the type is a scalar floating point type. +inline bool IsFloating(const NumberType& type) { + return type.kind == SPV_NUMBER_FLOATING; +} + +// Returns true if the type is a signed value. +inline bool IsSigned(const NumberType& type) { + return type.kind == SPV_NUMBER_FLOATING || type.kind == SPV_NUMBER_SIGNED_INT; +} + +// Returns true if the type is unknown. +inline bool IsUnknown(const NumberType& type) { + return type.kind == SPV_NUMBER_NONE; +} + +// Returns the number of bits in the type. This is only valid for integer and +// floating types. +inline int AssumedBitWidth(const NumberType& type) { + switch (type.kind) { + case SPV_NUMBER_SIGNED_INT: + case SPV_NUMBER_UNSIGNED_INT: + case SPV_NUMBER_FLOATING: + return type.bitwidth; + default: + break; + } + // We don't care about this case. + return 0; +} + +// A templated class with a static member function Clamp, where Clamp sets a +// referenced value of type T to 0 if T is an unsigned integer type, and +// returns true if it modified the referenced value. +template +class ClampToZeroIfUnsignedType { + public: + // The default specialization does not clamp the value. + static bool Clamp(T*) { return false; } +}; + +// The specialization of ClampToZeroIfUnsignedType for unsigned integer types. +template +class ClampToZeroIfUnsignedType< + T, typename std::enable_if::value>::type> { + public: + static bool Clamp(T* value_pointer) { + if (*value_pointer) { + *value_pointer = 0; + return true; + } + return false; + } +}; + +// Returns true if the given value fits within the target scalar integral type. +// The target type may have an unusual bit width. If the value was originally +// specified as a hexadecimal number, then the overflow bits should be zero. +// If it was hex and the target type is signed, then return the sign-extended +// value through the updated_value_for_hex pointer argument. On failure, +// returns false. +template +bool CheckRangeAndIfHexThenSignExtend(T value, const NumberType& type, + bool is_hex, T* updated_value_for_hex) { + // The encoded result has three regions of bits that are of interest, from + // least to most significant: + // - magnitude bits, where the magnitude of the number would be stored if + // we were using a signed-magnitude representation. + // - an optional sign bit + // - overflow bits, up to bit 63 of a 64-bit number + // For example: + // Type Overflow Sign Magnitude + // --------------- -------- ---- --------- + // unsigned 8 bit 8-63 n/a 0-7 + // signed 8 bit 8-63 7 0-6 + // unsigned 16 bit 16-63 n/a 0-15 + // signed 16 bit 16-63 15 0-14 + + // We'll use masks to define the three regions. + // At first we'll assume the number is unsigned. + const uint32_t bit_width = AssumedBitWidth(type); + uint64_t magnitude_mask = + (bit_width == 64) ? -1 : ((uint64_t(1) << bit_width) - 1); + uint64_t sign_mask = 0; + uint64_t overflow_mask = ~magnitude_mask; + + if (value < 0 || IsSigned(type)) { + // Accommodate the sign bit. + magnitude_mask >>= 1; + sign_mask = magnitude_mask + 1; + } + + bool failed = false; + if (value < 0) { + // The top bits must all be 1 for a negative signed value. + failed = ((value & overflow_mask) != overflow_mask) || + ((value & sign_mask) != sign_mask); + } else { + if (is_hex) { + // Hex values are a bit special. They decode as unsigned values, but may + // represent a negative number. In this case, the overflow bits should + // be zero. + failed = (value & overflow_mask) != 0; + } else { + const uint64_t value_as_u64 = static_cast(value); + // Check overflow in the ordinary case. + failed = (value_as_u64 & magnitude_mask) != value_as_u64; + } + } + + if (failed) { + return false; + } + + // Sign extend hex the number. + if (is_hex && (value & sign_mask)) + *updated_value_for_hex = (value | overflow_mask); + + return true; +} + +// Parses a numeric value of a given type from the given text. The number +// should take up the entire string, and should be within bounds for the target +// type. On success, returns true and populates the object referenced by +// value_pointer. On failure, returns false. +template +bool ParseNumber(const char* text, T* value_pointer) { + // C++11 doesn't define std::istringstream(int8_t&), so calling this method + // with a single-byte type leads to implementation-defined behaviour. + // Similarly for uint8_t. + static_assert(sizeof(T) > 1, + "Single-byte types are not supported in this parse method"); + + if (!text) return false; + std::istringstream text_stream(text); + // Allow both decimal and hex input for integers. + // It also allows octal input, but we don't care about that case. + text_stream >> std::setbase(0); + text_stream >> *value_pointer; + + // We should have read something. + bool ok = (text[0] != 0) && !text_stream.bad(); + // It should have been all the text. + ok = ok && text_stream.eof(); + // It should have been in range. + ok = ok && !text_stream.fail(); + + // Work around a bug in the GNU C++11 library. It will happily parse + // "-1" for uint16_t as 65535. + if (ok && text[0] == '-') + ok = !ClampToZeroIfUnsignedType::Clamp(value_pointer); + + return ok; +} + +// Enum to indicate the parsing and encoding status. +enum class EncodeNumberStatus { + kSuccess = 0, + // Unsupported bit width etc. + kUnsupported, + // Expected type (NumberType) is not a scalar int or float, or putting a + // negative number in an unsigned literal. + kInvalidUsage, + // Number value does not fit the bit width of the expected type etc. + kInvalidText, +}; + +// Parses an integer value of a given |type| from the given |text| and encodes +// the number by the given |emit| function. On success, returns +// EncodeNumberStatus::kSuccess and the parsed number will be consumed by the +// given |emit| function word by word (least significant word first). On +// failure, this function returns the error code of the encoding status and +// |emit| function will not be called. If the string pointer |error_msg| is not +// a nullptr, it will be overwritten with error messages in case of failure. In +// case of success, |error_msg| will not be touched. Integers up to 64 bits are +// supported. +EncodeNumberStatus ParseAndEncodeIntegerNumber( + const char* text, const NumberType& type, + std::function emit, std::string* error_msg); + +// Parses a floating point value of a given |type| from the given |text| and +// encodes the number by the given |emit| funciton. On success, returns +// EncodeNumberStatus::kSuccess and the parsed number will be consumed by the +// given |emit| function word by word (least significant word first). On +// failure, this function returns the error code of the encoding status and +// |emit| function will not be called. If the string pointer |error_msg| is not +// a nullptr, it will be overwritten with error messages in case of failure. In +// case of success, |error_msg| will not be touched. Only 16, 32 and 64 bit +// floating point numbers are supported. +EncodeNumberStatus ParseAndEncodeFloatingPointNumber( + const char* text, const NumberType& type, + std::function emit, std::string* error_msg); + +// Parses an integer or floating point number of a given |type| from the given +// |text| and encodes the number by the given |emit| function. On success, +// returns EncodeNumberStatus::kSuccess and the parsed number will be consumed +// by the given |emit| function word by word (least significant word first). On +// failure, this function returns the error code of the encoding status and +// |emit| function will not be called. If the string pointer |error_msg| is not +// a nullptr, it will be overwritten with error messages in case of failure. In +// case of success, |error_msg| will not be touched. Integers up to 64 bits +// and 16/32/64 bit floating point values are supported. +EncodeNumberStatus ParseAndEncodeNumber(const char* text, + const NumberType& type, + std::function emit, + std::string* error_msg); + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_PARSE_NUMBER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/small_vector.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/small_vector.h new file mode 100644 index 00000000000..f2c1147bede --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/small_vector.h @@ -0,0 +1,466 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_UTIL_SMALL_VECTOR_H_ +#define SOURCE_UTIL_SMALL_VECTOR_H_ + +#include +#include +#include +#include +#include + +#include "source/util/make_unique.h" + +namespace spvtools { +namespace utils { + +// The |SmallVector| class is intended to be a drop-in replacement for +// |std::vector|. The difference is in the implementation. A |SmallVector| is +// optimized for when the number of elements in the vector are small. Small is +// defined by the template parameter |small_size|. +// +// Note that |SmallVector| is not always faster than an |std::vector|, so you +// should experiment with different values for |small_size| and compare to +// using and |std::vector|. +// +// TODO: I have implemented the public member functions from |std::vector| that +// I needed. If others are needed they should be implemented. Do not implement +// public member functions that are not defined by std::vector. +template +class SmallVector { + public: + using iterator = T*; + using const_iterator = const T*; + + SmallVector() + : size_(0), + small_data_(reinterpret_cast(buffer)), + large_data_(nullptr) {} + + SmallVector(const SmallVector& that) : SmallVector() { *this = that; } + + SmallVector(SmallVector&& that) : SmallVector() { *this = std::move(that); } + + SmallVector(const std::vector& vec) : SmallVector() { + if (vec.size() > small_size) { + large_data_ = MakeUnique>(vec); + } else { + size_ = vec.size(); + for (uint32_t i = 0; i < size_; i++) { + new (small_data_ + i) T(vec[i]); + } + } + } + + SmallVector(std::vector&& vec) : SmallVector() { + if (vec.size() > small_size) { + large_data_ = MakeUnique>(std::move(vec)); + } else { + size_ = vec.size(); + for (uint32_t i = 0; i < size_; i++) { + new (small_data_ + i) T(std::move(vec[i])); + } + } + vec.clear(); + } + + SmallVector(std::initializer_list init_list) : SmallVector() { + if (init_list.size() < small_size) { + for (auto it = init_list.begin(); it != init_list.end(); ++it) { + new (small_data_ + (size_++)) T(std::move(*it)); + } + } else { + large_data_ = MakeUnique>(std::move(init_list)); + } + } + + SmallVector(size_t s, const T& v) : SmallVector() { resize(s, v); } + + virtual ~SmallVector() { + for (T* p = small_data_; p < small_data_ + size_; ++p) { + p->~T(); + } + } + + SmallVector& operator=(const SmallVector& that) { + assert(small_data_); + if (that.large_data_) { + if (large_data_) { + *large_data_ = *that.large_data_; + } else { + large_data_ = MakeUnique>(*that.large_data_); + } + } else { + large_data_.reset(nullptr); + size_t i = 0; + // Do a copy for any element in |this| that is already constructed. + for (; i < size_ && i < that.size_; ++i) { + small_data_[i] = that.small_data_[i]; + } + + if (i >= that.size_) { + // If the size of |this| becomes smaller after the assignment, then + // destroy any extra elements. + for (; i < size_; ++i) { + small_data_[i].~T(); + } + } else { + // If the size of |this| becomes larger after the assignement, copy + // construct the new elements that are needed. + for (; i < that.size_; ++i) { + new (small_data_ + i) T(that.small_data_[i]); + } + } + size_ = that.size_; + } + return *this; + } + + SmallVector& operator=(SmallVector&& that) { + if (that.large_data_) { + large_data_.reset(that.large_data_.release()); + } else { + large_data_.reset(nullptr); + size_t i = 0; + // Do a move for any element in |this| that is already constructed. + for (; i < size_ && i < that.size_; ++i) { + small_data_[i] = std::move(that.small_data_[i]); + } + + if (i >= that.size_) { + // If the size of |this| becomes smaller after the assignment, then + // destroy any extra elements. + for (; i < size_; ++i) { + small_data_[i].~T(); + } + } else { + // If the size of |this| becomes larger after the assignement, move + // construct the new elements that are needed. + for (; i < that.size_; ++i) { + new (small_data_ + i) T(std::move(that.small_data_[i])); + } + } + size_ = that.size_; + } + + // Reset |that| because all of the data has been moved to |this|. + that.DestructSmallData(); + return *this; + } + + template + friend bool operator==(const SmallVector& lhs, const OtherVector& rhs) { + if (lhs.size() != rhs.size()) { + return false; + } + + auto rit = rhs.begin(); + for (auto lit = lhs.begin(); lit != lhs.end(); ++lit, ++rit) { + if (*lit != *rit) { + return false; + } + } + return true; + } + + friend bool operator==(const std::vector& lhs, const SmallVector& rhs) { + return rhs == lhs; + } + + friend bool operator!=(const SmallVector& lhs, const std::vector& rhs) { + return !(lhs == rhs); + } + + friend bool operator!=(const std::vector& lhs, const SmallVector& rhs) { + return rhs != lhs; + } + + T& operator[](size_t i) { + if (!large_data_) { + return small_data_[i]; + } else { + return (*large_data_)[i]; + } + } + + const T& operator[](size_t i) const { + if (!large_data_) { + return small_data_[i]; + } else { + return (*large_data_)[i]; + } + } + + size_t size() const { + if (!large_data_) { + return size_; + } else { + return large_data_->size(); + } + } + + iterator begin() { + if (large_data_) { + return large_data_->data(); + } else { + return small_data_; + } + } + + const_iterator begin() const { + if (large_data_) { + return large_data_->data(); + } else { + return small_data_; + } + } + + const_iterator cbegin() const { return begin(); } + + iterator end() { + if (large_data_) { + return large_data_->data() + large_data_->size(); + } else { + return small_data_ + size_; + } + } + + const_iterator end() const { + if (large_data_) { + return large_data_->data() + large_data_->size(); + } else { + return small_data_ + size_; + } + } + + const_iterator cend() const { return end(); } + + T* data() { return begin(); } + + const T* data() const { return cbegin(); } + + T& front() { return (*this)[0]; } + + const T& front() const { return (*this)[0]; } + + iterator erase(const_iterator pos) { return erase(pos, pos + 1); } + + iterator erase(const_iterator first, const_iterator last) { + if (large_data_) { + size_t start_index = first - large_data_->data(); + size_t end_index = last - large_data_->data(); + auto r = large_data_->erase(large_data_->begin() + start_index, + large_data_->begin() + end_index); + return large_data_->data() + (r - large_data_->begin()); + } + + // Since C++11, std::vector has |const_iterator| for the parameters, so I + // follow that. However, I need iterators to modify the current container, + // which is not const. This is why I cast away the const. + iterator f = const_cast(first); + iterator l = const_cast(last); + iterator e = end(); + + size_t num_of_del_elements = last - first; + iterator ret = f; + if (first == last) { + return ret; + } + + // Move |last| and any elements after it their earlier position. + while (l != e) { + *f = std::move(*l); + ++f; + ++l; + } + + // Destroy the elements that were supposed to be deleted. + while (f != l) { + f->~T(); + ++f; + } + + // Update the size. + size_ -= num_of_del_elements; + return ret; + } + + void push_back(const T& value) { + if (!large_data_ && size_ == small_size) { + MoveToLargeData(); + } + + if (large_data_) { + large_data_->push_back(value); + return; + } + + new (small_data_ + size_) T(value); + ++size_; + } + + void push_back(T&& value) { + if (!large_data_ && size_ == small_size) { + MoveToLargeData(); + } + + if (large_data_) { + large_data_->push_back(std::move(value)); + return; + } + + new (small_data_ + size_) T(std::move(value)); + ++size_; + } + + template + iterator insert(iterator pos, InputIt first, InputIt last) { + size_t element_idx = (pos - begin()); + size_t num_of_new_elements = std::distance(first, last); + size_t new_size = size_ + num_of_new_elements; + if (!large_data_ && new_size > small_size) { + MoveToLargeData(); + } + + if (large_data_) { + typename std::vector::iterator new_pos = + large_data_->begin() + element_idx; + large_data_->insert(new_pos, first, last); + return begin() + element_idx; + } + + // Move |pos| and all of the elements after it over |num_of_new_elements| + // places. We start at the end and work backwards, to make sure we do not + // overwrite data that we have not moved yet. + for (iterator i = begin() + new_size - 1, j = end() - 1; j >= pos; + --i, --j) { + if (i >= begin() + size_) { + new (i) T(std::move(*j)); + } else { + *i = std::move(*j); + } + } + + // Copy the new elements into position. + iterator p = pos; + for (; first != last; ++p, ++first) { + if (p >= small_data_ + size_) { + new (p) T(*first); + } else { + *p = *first; + } + } + + // Upate the size. + size_ += num_of_new_elements; + return pos; + } + + bool empty() const { + if (large_data_) { + return large_data_->empty(); + } + return size_ == 0; + } + + void clear() { + if (large_data_) { + large_data_->clear(); + } else { + DestructSmallData(); + } + } + + template + void emplace_back(Args&&... args) { + if (!large_data_ && size_ == small_size) { + MoveToLargeData(); + } + + if (large_data_) { + large_data_->emplace_back(std::forward(args)...); + } else { + new (small_data_ + size_) T(std::forward(args)...); + ++size_; + } + } + + void resize(size_t new_size, const T& v) { + if (!large_data_ && new_size > small_size) { + MoveToLargeData(); + } + + if (large_data_) { + large_data_->resize(new_size, v); + return; + } + + // If |new_size| < |size_|, then destroy the extra elements. + for (size_t i = new_size; i < size_; ++i) { + small_data_[i].~T(); + } + + // If |new_size| > |size_|, the copy construct the new elements. + for (size_t i = size_; i < new_size; ++i) { + new (small_data_ + i) T(v); + } + + // Update the size. + size_ = new_size; + } + + private: + // Moves all of the element from |small_data_| into a new std::vector that can + // be access through |large_data|. + void MoveToLargeData() { + assert(!large_data_); + large_data_ = MakeUnique>(); + for (size_t i = 0; i < size_; ++i) { + large_data_->emplace_back(std::move(small_data_[i])); + } + DestructSmallData(); + } + + // Destroys all of the elements in |small_data_| that have been constructed. + void DestructSmallData() { + for (size_t i = 0; i < size_; ++i) { + small_data_[i].~T(); + } + size_ = 0; + } + + // The number of elements in |small_data_| that have been constructed. + size_t size_; + + // The pointed used to access the array of elements when the number of + // elements is small. + T* small_data_; + + // The actual data used to store the array elements. It must never be used + // directly, but must only be accesed through |small_data_|. + typename std::aligned_storage::value>::type + buffer[small_size]; + + // A pointer to a vector that is used to store the elements of the vector when + // this size exceeds |small_size|. If |large_data_| is nullptr, then the data + // is stored in |small_data_|. Otherwise, the data is stored in + // |large_data_|. + std::unique_ptr> large_data_; +}; // namespace utils + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_SMALL_VECTOR_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/string_utils.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/string_utils.cpp new file mode 100644 index 00000000000..29ce2aa4a96 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/string_utils.cpp @@ -0,0 +1,41 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "source/util/string_utils.h" + +namespace spvtools { +namespace utils { + +std::string CardinalToOrdinal(size_t cardinal) { + const size_t mod10 = cardinal % 10; + const size_t mod100 = cardinal % 100; + std::string suffix; + if (mod10 == 1 && mod100 != 11) + suffix = "st"; + else if (mod10 == 2 && mod100 != 12) + suffix = "nd"; + else if (mod10 == 3 && mod100 != 13) + suffix = "rd"; + else + suffix = "th"; + + return ToString(cardinal) + suffix; +} + +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/string_utils.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/string_utils.h new file mode 100644 index 00000000000..322c574fb69 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/string_utils.h @@ -0,0 +1,43 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_UTIL_STRING_UTILS_H_ +#define SOURCE_UTIL_STRING_UTILS_H_ + +#include +#include + +#include "source/util/string_utils.h" + +namespace spvtools { +namespace utils { + +// Converts arithmetic value |val| to its default string representation. +template +std::string ToString(T val) { + static_assert( + std::is_arithmetic::value, + "spvtools::utils::ToString is restricted to only arithmetic values"); + std::stringstream os; + os << val; + return os.str(); +} + +// Converts cardinal number to ordinal number string. +std::string CardinalToOrdinal(size_t cardinal); + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_STRING_UTILS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/timer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/timer.cpp new file mode 100644 index 00000000000..c8b8d5b61f4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/timer.cpp @@ -0,0 +1,102 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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(SPIRV_TIMER_ENABLED) + +#include "source/util/timer.h" + +#include +#include +#include +#include +#include + +namespace spvtools { +namespace utils { + +void PrintTimerDescription(std::ostream* out, bool measure_mem_usage) { + if (out) { + *out << std::setw(30) << "PASS name" << std::setw(12) << "CPU time" + << std::setw(12) << "WALL time" << std::setw(12) << "USR time" + << std::setw(12) << "SYS time"; + if (measure_mem_usage) { + *out << std::setw(12) << "RSS delta" << std::setw(16) << "PGFault delta"; + } + *out << std::endl; + } +} + +// Do not change the order of invoking system calls. We want to make CPU/Wall +// time correct as much as possible. Calling functions to get CPU/Wall time must +// closely surround the target code of measuring. +void Timer::Start() { + if (report_stream_) { + if (getrusage(RUSAGE_SELF, &usage_before_) == -1) + usage_status_ |= kGetrusageFailed; + if (clock_gettime(CLOCK_MONOTONIC, &wall_before_) == -1) + usage_status_ |= kClockGettimeWalltimeFailed; + if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &cpu_before_) == -1) + usage_status_ |= kClockGettimeCPUtimeFailed; + } +} + +// The order of invoking system calls is important with the same reason as +// Timer::Start(). +void Timer::Stop() { + if (report_stream_ && usage_status_ == kSucceeded) { + if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &cpu_after_) == -1) + usage_status_ |= kClockGettimeCPUtimeFailed; + if (clock_gettime(CLOCK_MONOTONIC, &wall_after_) == -1) + usage_status_ |= kClockGettimeWalltimeFailed; + if (getrusage(RUSAGE_SELF, &usage_after_) == -1) + usage_status_ = kGetrusageFailed; + } +} + +void Timer::Report(const char* tag) { + if (!report_stream_) return; + + report_stream_->precision(2); + *report_stream_ << std::fixed << std::setw(30) << tag; + + if (usage_status_ & kClockGettimeCPUtimeFailed) + *report_stream_ << std::setw(12) << "Failed"; + else + *report_stream_ << std::setw(12) << CPUTime(); + + if (usage_status_ & kClockGettimeWalltimeFailed) + *report_stream_ << std::setw(12) << "Failed"; + else + *report_stream_ << std::setw(12) << WallTime(); + + if (usage_status_ & kGetrusageFailed) { + *report_stream_ << std::setw(12) << "Failed" << std::setw(12) << "Failed"; + if (measure_mem_usage_) { + *report_stream_ << std::setw(12) << "Failed" << std::setw(12) << "Failed"; + } + } else { + *report_stream_ << std::setw(12) << UserTime() << std::setw(12) + << SystemTime(); + if (measure_mem_usage_) { + *report_stream_ << std::fixed << std::setw(12) << RSS() << std::setw(16) + << PageFault(); + } + } + *report_stream_ << std::endl; +} + +} // namespace utils +} // namespace spvtools + +#endif // defined(SPIRV_TIMER_ENABLED) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/util/timer.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/timer.h new file mode 100644 index 00000000000..fc4b747b987 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/util/timer.h @@ -0,0 +1,392 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Contains utils for getting resource utilization + +#ifndef SOURCE_UTIL_TIMER_H_ +#define SOURCE_UTIL_TIMER_H_ + +#if defined(SPIRV_TIMER_ENABLED) + +#include +#include +#include + +// A macro to call spvtools::utils::PrintTimerDescription(std::ostream*, bool). +// The first argument must be given as std::ostream*. If it is NULL, the +// function does nothing. Otherwise, it prints resource types measured by Timer +// class. The second is optional and if it is true, the function also prints +// resource type fields related to memory. Otherwise, it does not print memory +// related fields. Its default is false. In usual, this must be placed before +// calling Timer::Report() to inform what those fields printed by +// Timer::Report() indicate (or spvtools::utils::PrintTimerDescription() must be +// used instead). +#define SPIRV_TIMER_DESCRIPTION(...) \ + spvtools::utils::PrintTimerDescription(__VA_ARGS__) + +// Creates an object of ScopedTimer to measure the resource utilization for the +// scope surrounding it as the following example: +// +// { // <-- beginning of this scope +// +// /* ... code out of interest ... */ +// +// SPIRV_TIMER_SCOPED(std::cout, tag); +// +// /* ... lines of code that we want to know its resource usage ... */ +// +// } // <-- end of this scope. The destructor of ScopedTimer prints tag and +// the resource utilization to std::cout. +#define SPIRV_TIMER_SCOPED(...) \ + spvtools::utils::ScopedTimer timer##__LINE__( \ + __VA_ARGS__) + +namespace spvtools { +namespace utils { + +// Prints the description of resource types measured by Timer class. If |out| is +// NULL, it does nothing. Otherwise, it prints resource types. The second is +// optional and if it is true, the function also prints resource type fields +// related to memory. Its default is false. In usual, this must be placed before +// calling Timer::Report() to inform what those fields printed by +// Timer::Report() indicate. +void PrintTimerDescription(std::ostream*, bool = false); + +// Status of Timer. kGetrusageFailed means it failed in calling getrusage(). +// kClockGettimeWalltimeFailed means it failed in getting wall time when calling +// clock_gettime(). kClockGettimeCPUtimeFailed means it failed in getting CPU +// time when calling clock_gettime(). +enum UsageStatus { + kSucceeded = 0, + kGetrusageFailed = 1 << 0, + kClockGettimeWalltimeFailed = 1 << 1, + kClockGettimeCPUtimeFailed = 1 << 2, +}; + +// Timer measures the resource utilization for a range of code. The resource +// utilization consists of CPU time (i.e., process time), WALL time (elapsed +// time), USR time, SYS time, RSS delta, and the delta of the number of page +// faults. RSS delta and the delta of the number of page faults are measured +// only when |measure_mem_usage| given to the constructor is true. This class +// should be used as the following example: +// +// spvtools::utils::Timer timer(std::cout); +// timer.Start(); // <-- set |usage_before_|, |wall_before_|, +// and |cpu_before_| +// +// /* ... lines of code that we want to know its resource usage ... */ +// +// timer.Stop(); // <-- set |cpu_after_|, |wall_after_|, and +// |usage_after_| +// timer.Report(tag); // <-- print tag and the resource utilization to +// std::cout. +class Timer { + public: + Timer(std::ostream* out, bool measure_mem_usage = false) + : report_stream_(out), + usage_status_(kSucceeded), + measure_mem_usage_(measure_mem_usage) {} + + // Sets |usage_before_|, |wall_before_|, and |cpu_before_| as results of + // getrusage(), clock_gettime() for the wall time, and clock_gettime() for the + // CPU time respectively. Note that this method erases all previous state of + // |usage_before_|, |wall_before_|, |cpu_before_|. + virtual void Start(); + + // Sets |cpu_after_|, |wall_after_|, and |usage_after_| as results of + // clock_gettime() for the wall time, and clock_gettime() for the CPU time, + // getrusage() respectively. Note that this method erases all previous state + // of |cpu_after_|, |wall_after_|, |usage_after_|. + virtual void Stop(); + + // If |report_stream_| is NULL, it does nothing. Otherwise, it prints the + // resource utilization (i.e., CPU/WALL/USR/SYS time, RSS delta) between the + // time of calling Timer::Start() and the time of calling Timer::Stop(). If we + // cannot get a resource usage because of failures, it prints "Failed" instead + // for the resource. + void Report(const char* tag); + + // Returns the measured CPU Time (i.e., process time) for a range of code + // execution. If kClockGettimeCPUtimeFailed is set by the failure of calling + // clock_gettime(), it returns -1. + virtual double CPUTime() { + if (usage_status_ & kClockGettimeCPUtimeFailed) return -1; + return TimeDifference(cpu_before_, cpu_after_); + } + + // Returns the measured Wall Time (i.e., elapsed time) for a range of code + // execution. If kClockGettimeWalltimeFailed is set by the failure of + // calling clock_gettime(), it returns -1. + virtual double WallTime() { + if (usage_status_ & kClockGettimeWalltimeFailed) return -1; + return TimeDifference(wall_before_, wall_after_); + } + + // Returns the measured USR Time for a range of code execution. If + // kGetrusageFailed is set because of the failure of calling getrusage(), it + // returns -1. + virtual double UserTime() { + if (usage_status_ & kGetrusageFailed) return -1; + return TimeDifference(usage_before_.ru_utime, usage_after_.ru_utime); + } + + // Returns the measured SYS Time for a range of code execution. If + // kGetrusageFailed is set because of the failure of calling getrusage(), it + // returns -1. + virtual double SystemTime() { + if (usage_status_ & kGetrusageFailed) return -1; + return TimeDifference(usage_before_.ru_stime, usage_after_.ru_stime); + } + + // Returns the measured RSS delta for a range of code execution. If + // kGetrusageFailed is set because of the failure of calling getrusage(), it + // returns -1. + virtual long RSS() const { + if (usage_status_ & kGetrusageFailed) return -1; + return usage_after_.ru_maxrss - usage_before_.ru_maxrss; + } + + // Returns the measured the delta of the number of page faults for a range of + // code execution. If kGetrusageFailed is set because of the failure of + // calling getrusage(), it returns -1. + virtual long PageFault() const { + if (usage_status_ & kGetrusageFailed) return -1; + return (usage_after_.ru_minflt - usage_before_.ru_minflt) + + (usage_after_.ru_majflt - usage_before_.ru_majflt); + } + + virtual ~Timer() {} + + private: + // Returns the time gap between |from| and |to| in seconds. + static double TimeDifference(const timeval& from, const timeval& to) { + assert((to.tv_sec > from.tv_sec) || + (to.tv_sec == from.tv_sec && to.tv_usec >= from.tv_usec)); + return static_cast(to.tv_sec - from.tv_sec) + + static_cast(to.tv_usec - from.tv_usec) * .000001; + } + + // Returns the time gap between |from| and |to| in seconds. + static double TimeDifference(const timespec& from, const timespec& to) { + assert((to.tv_sec > from.tv_sec) || + (to.tv_sec == from.tv_sec && to.tv_nsec >= from.tv_nsec)); + return static_cast(to.tv_sec - from.tv_sec) + + static_cast(to.tv_nsec - from.tv_nsec) * .000000001; + } + + // Output stream to print out the resource utilization. If it is NULL, + // Report() does nothing. + std::ostream* report_stream_; + + // Status to stop measurement if a system call returns an error. + unsigned usage_status_; + + // Variable to save the result of clock_gettime(CLOCK_PROCESS_CPUTIME_ID) when + // Timer::Start() is called. It is used as the base status of CPU time. + timespec cpu_before_; + + // Variable to save the result of clock_gettime(CLOCK_MONOTONIC) when + // Timer::Start() is called. It is used as the base status of WALL time. + timespec wall_before_; + + // Variable to save the result of getrusage() when Timer::Start() is called. + // It is used as the base status of USR time, SYS time, and RSS. + rusage usage_before_; + + // Variable to save the result of clock_gettime(CLOCK_PROCESS_CPUTIME_ID) when + // Timer::Stop() is called. It is used as the last status of CPU time. The + // resouce usage is measured by subtracting |cpu_before_| from it. + timespec cpu_after_; + + // Variable to save the result of clock_gettime(CLOCK_MONOTONIC) when + // Timer::Stop() is called. It is used as the last status of WALL time. The + // resouce usage is measured by subtracting |wall_before_| from it. + timespec wall_after_; + + // Variable to save the result of getrusage() when Timer::Stop() is called. It + // is used as the last status of USR time, SYS time, and RSS. Those resouce + // usages are measured by subtracting |usage_before_| from it. + rusage usage_after_; + + // If true, Timer reports the memory usage information too. Otherwise, Timer + // reports only USR time, WALL time, SYS time. + bool measure_mem_usage_; +}; + +// The purpose of ScopedTimer is to measure the resource utilization for a +// scope. Simply creating a local variable of ScopedTimer will call +// Timer::Start() and it calls Timer::Stop() and Timer::Report() at the end of +// the scope by its destructor. When we use this class, we must choose the +// proper Timer class (for class TimerType template) in advance. This class +// should be used as the following example: +// +// { // <-- beginning of this scope +// +// /* ... code out of interest ... */ +// +// spvtools::utils::ScopedTimer +// scopedtimer(std::cout, tag); +// +// /* ... lines of code that we want to know its resource usage ... */ +// +// } // <-- end of this scope. The destructor of ScopedTimer prints tag and +// the resource utilization to std::cout. +// +// The template is used to choose a Timer class. Currently, +// only options for the Timer class are Timer and MockTimer in the unit test. +template +class ScopedTimer { + public: + ScopedTimer(std::ostream* out, const char* tag, + bool measure_mem_usage = false) + : timer(new TimerType(out, measure_mem_usage)), tag_(tag) { + timer->Start(); + } + + // At the end of the scope surrounding the instance of this class, this + // destructor saves the last status of resource usage and reports it. + virtual ~ScopedTimer() { + timer->Stop(); + timer->Report(tag_); + delete timer; + } + + private: + // Actual timer that measures the resource utilization. It must be an instance + // of Timer class if there is no special reason to use other class. + TimerType* timer; + + // A tag that will be printed in front of the trace reported by Timer class. + const char* tag_; +}; + +// CumulativeTimer is the same as Timer class, but it supports a cumulative +// measurement as the following example: +// +// CumulativeTimer *ctimer = new CumulativeTimer(std::cout); +// ctimer->Start(); +// +// /* ... lines of code that we want to know its resource usage ... */ +// +// ctimer->Stop(); +// +// /* ... code out of interest ... */ +// +// ctimer->Start(); +// +// /* ... lines of code that we want to know its resource usage ... */ +// +// ctimer->Stop(); +// ctimer->Report(tag); +// delete ctimer; +// +class CumulativeTimer : public Timer { + public: + CumulativeTimer(std::ostream* out, bool measure_mem_usage = false) + : Timer(out, measure_mem_usage), + cpu_time_(0), + wall_time_(0), + usr_time_(0), + sys_time_(0), + rss_(0), + pgfaults_(0) {} + + // If we cannot get a resource usage because of failures, it sets -1 for the + // resource usage. + void Stop() override { + Timer::Stop(); + + if (cpu_time_ >= 0 && Timer::CPUTime() >= 0) + cpu_time_ += Timer::CPUTime(); + else + cpu_time_ = -1; + + if (wall_time_ >= 0 && Timer::WallTime() >= 0) + wall_time_ += Timer::WallTime(); + else + wall_time_ = -1; + + if (usr_time_ >= 0 && Timer::UserTime() >= 0) + usr_time_ += Timer::UserTime(); + else + usr_time_ = -1; + + if (sys_time_ >= 0 && Timer::SystemTime() >= 0) + sys_time_ += Timer::SystemTime(); + else + sys_time_ = -1; + + if (rss_ >= 0 && Timer::RSS() >= 0) + rss_ += Timer::RSS(); + else + rss_ = -1; + + if (pgfaults_ >= 0 && Timer::PageFault() >= 0) + pgfaults_ += Timer::PageFault(); + else + pgfaults_ = -1; + } + + // Returns the cumulative CPU Time (i.e., process time) for a range of code + // execution. + double CPUTime() override { return cpu_time_; } + + // Returns the cumulative Wall Time (i.e., elapsed time) for a range of code + // execution. + double WallTime() override { return wall_time_; } + + // Returns the cumulative USR Time for a range of code execution. + double UserTime() override { return usr_time_; } + + // Returns the cumulative SYS Time for a range of code execution. + double SystemTime() override { return sys_time_; } + + // Returns the cumulative RSS delta for a range of code execution. + long RSS() const override { return rss_; } + + // Returns the cumulative delta of number of page faults for a range of code + // execution. + long PageFault() const override { return pgfaults_; } + + private: + // Variable to save the cumulative CPU time (i.e., process time). + double cpu_time_; + + // Variable to save the cumulative wall time (i.e., elapsed time). + double wall_time_; + + // Variable to save the cumulative user time. + double usr_time_; + + // Variable to save the cumulative system time. + double sys_time_; + + // Variable to save the cumulative RSS delta. + long rss_; + + // Variable to save the cumulative delta of the number of page faults. + long pgfaults_; +}; + +} // namespace utils +} // namespace spvtools + +#else // defined(SPIRV_TIMER_ENABLED) + +#define SPIRV_TIMER_DESCRIPTION(...) +#define SPIRV_TIMER_SCOPED(...) + +#endif // defined(SPIRV_TIMER_ENABLED) + +#endif // SOURCE_UTIL_TIMER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp new file mode 100644 index 00000000000..a53103c8a64 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/basic_block.cpp @@ -0,0 +1,149 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/basic_block.h" + +#include +#include +#include + +namespace spvtools { +namespace val { + +BasicBlock::BasicBlock(uint32_t label_id) + : id_(label_id), + immediate_dominator_(nullptr), + immediate_post_dominator_(nullptr), + predecessors_(), + successors_(), + type_(0), + reachable_(false), + label_(nullptr), + terminator_(nullptr) {} + +void BasicBlock::SetImmediateDominator(BasicBlock* dom_block) { + immediate_dominator_ = dom_block; +} + +void BasicBlock::SetImmediatePostDominator(BasicBlock* pdom_block) { + immediate_post_dominator_ = pdom_block; +} + +const BasicBlock* BasicBlock::immediate_dominator() const { + return immediate_dominator_; +} + +const BasicBlock* BasicBlock::immediate_post_dominator() const { + return immediate_post_dominator_; +} + +BasicBlock* BasicBlock::immediate_dominator() { return immediate_dominator_; } +BasicBlock* BasicBlock::immediate_post_dominator() { + return immediate_post_dominator_; +} + +void BasicBlock::RegisterSuccessors( + const std::vector& next_blocks) { + for (auto& block : next_blocks) { + block->predecessors_.push_back(this); + successors_.push_back(block); + if (block->reachable_ == false) block->set_reachable(reachable_); + } +} + +void BasicBlock::RegisterBranchInstruction(SpvOp branch_instruction) { + if (branch_instruction == SpvOpUnreachable) reachable_ = false; + return; +} + +bool BasicBlock::dominates(const BasicBlock& other) const { + return (this == &other) || + !(other.dom_end() == + std::find(other.dom_begin(), other.dom_end(), this)); +} + +bool BasicBlock::postdominates(const BasicBlock& other) const { + return (this == &other) || + !(other.pdom_end() == + std::find(other.pdom_begin(), other.pdom_end(), this)); +} + +BasicBlock::DominatorIterator::DominatorIterator() : current_(nullptr) {} + +BasicBlock::DominatorIterator::DominatorIterator( + const BasicBlock* block, + std::function dominator_func) + : current_(block), dom_func_(dominator_func) {} + +BasicBlock::DominatorIterator& BasicBlock::DominatorIterator::operator++() { + if (current_ == dom_func_(current_)) { + current_ = nullptr; + } else { + current_ = dom_func_(current_); + } + return *this; +} + +const BasicBlock::DominatorIterator BasicBlock::dom_begin() const { + return DominatorIterator( + this, [](const BasicBlock* b) { return b->immediate_dominator(); }); +} + +BasicBlock::DominatorIterator BasicBlock::dom_begin() { + return DominatorIterator( + this, [](const BasicBlock* b) { return b->immediate_dominator(); }); +} + +const BasicBlock::DominatorIterator BasicBlock::dom_end() const { + return DominatorIterator(); +} + +BasicBlock::DominatorIterator BasicBlock::dom_end() { + return DominatorIterator(); +} + +const BasicBlock::DominatorIterator BasicBlock::pdom_begin() const { + return DominatorIterator( + this, [](const BasicBlock* b) { return b->immediate_post_dominator(); }); +} + +BasicBlock::DominatorIterator BasicBlock::pdom_begin() { + return DominatorIterator( + this, [](const BasicBlock* b) { return b->immediate_post_dominator(); }); +} + +const BasicBlock::DominatorIterator BasicBlock::pdom_end() const { + return DominatorIterator(); +} + +BasicBlock::DominatorIterator BasicBlock::pdom_end() { + return DominatorIterator(); +} + +bool operator==(const BasicBlock::DominatorIterator& lhs, + const BasicBlock::DominatorIterator& rhs) { + return lhs.current_ == rhs.current_; +} + +bool operator!=(const BasicBlock::DominatorIterator& lhs, + const BasicBlock::DominatorIterator& rhs) { + return !(lhs == rhs); +} + +const BasicBlock*& BasicBlock::DominatorIterator::operator*() { + return current_; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/basic_block.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/basic_block.h new file mode 100644 index 00000000000..efbd243b67a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/basic_block.h @@ -0,0 +1,247 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_VAL_BASIC_BLOCK_H_ +#define SOURCE_VAL_BASIC_BLOCK_H_ + +#include +#include +#include +#include +#include + +#include "source/latest_version_spirv_header.h" + +namespace spvtools { +namespace val { + +enum BlockType : uint32_t { + kBlockTypeUndefined, + kBlockTypeHeader, + kBlockTypeLoop, + kBlockTypeMerge, + kBlockTypeBreak, + kBlockTypeContinue, + kBlockTypeReturn, + kBlockTypeCOUNT ///< Total number of block types. (must be the last element) +}; + +class Instruction; + +// This class represents a basic block in a SPIR-V module +class BasicBlock { + public: + /// Constructor for a BasicBlock + /// + /// @param[in] id The ID of the basic block + explicit BasicBlock(uint32_t id); + + /// Returns the id of the BasicBlock + uint32_t id() const { return id_; } + + /// Returns the predecessors of the BasicBlock + const std::vector* predecessors() const { + return &predecessors_; + } + + /// Returns the predecessors of the BasicBlock + std::vector* predecessors() { return &predecessors_; } + + /// Returns the successors of the BasicBlock + const std::vector* successors() const { return &successors_; } + + /// Returns the successors of the BasicBlock + std::vector* successors() { return &successors_; } + + /// Returns true if the block is reachable in the CFG + bool reachable() const { return reachable_; } + + /// Returns true if BasicBlock is of the given type + bool is_type(BlockType type) const { + if (type == kBlockTypeUndefined) return type_.none(); + return type_.test(type); + } + + /// Sets the reachability of the basic block in the CFG + void set_reachable(bool reachability) { reachable_ = reachability; } + + /// Sets the type of the BasicBlock + void set_type(BlockType type) { + if (type == kBlockTypeUndefined) + type_.reset(); + else + type_.set(type); + } + + /// Sets the immedate dominator of this basic block + /// + /// @param[in] dom_block The dominator block + void SetImmediateDominator(BasicBlock* dom_block); + + /// Sets the immedate post dominator of this basic block + /// + /// @param[in] pdom_block The post dominator block + void SetImmediatePostDominator(BasicBlock* pdom_block); + + /// Returns the immedate dominator of this basic block + BasicBlock* immediate_dominator(); + + /// Returns the immedate dominator of this basic block + const BasicBlock* immediate_dominator() const; + + /// Returns the immedate post dominator of this basic block + BasicBlock* immediate_post_dominator(); + + /// Returns the immedate post dominator of this basic block + const BasicBlock* immediate_post_dominator() const; + + /// Ends the block without a successor + void RegisterBranchInstruction(SpvOp branch_instruction); + + /// Returns the label instruction for the block, or nullptr if not set. + const Instruction* label() const { return label_; } + + //// Registers the label instruction for the block. + void set_label(const Instruction* t) { label_ = t; } + + /// Registers the terminator instruction for the block. + void set_terminator(const Instruction* t) { terminator_ = t; } + + /// Returns the terminator instruction for the block. + const Instruction* terminator() const { return terminator_; } + + /// Adds @p next BasicBlocks as successors of this BasicBlock + void RegisterSuccessors( + const std::vector& next = std::vector()); + + /// Returns true if the id of the BasicBlock matches + bool operator==(const BasicBlock& other) const { return other.id_ == id_; } + + /// Returns true if the id of the BasicBlock matches + bool operator==(const uint32_t& other_id) const { return other_id == id_; } + + /// Returns true if this block dominates the other block. + /// Assumes dominators have been computed. + bool dominates(const BasicBlock& other) const; + + /// Returns true if this block postdominates the other block. + /// Assumes dominators have been computed. + bool postdominates(const BasicBlock& other) const; + + /// @brief A BasicBlock dominator iterator class + /// + /// This iterator will iterate over the (post)dominators of the block + class DominatorIterator + : public std::iterator { + public: + /// @brief Constructs the end of dominator iterator + /// + /// This will create an iterator which will represent the element + /// before the root node of the dominator tree + DominatorIterator(); + + /// @brief Constructs an iterator for the given block which points to + /// @p block + /// + /// @param block The block which is referenced by the iterator + /// @param dominator_func This function will be called to get the immediate + /// (post)dominator of the current block + DominatorIterator( + const BasicBlock* block, + std::function dominator_func); + + /// @brief Advances the iterator + DominatorIterator& operator++(); + + /// @brief Returns the current element + const BasicBlock*& operator*(); + + friend bool operator==(const DominatorIterator& lhs, + const DominatorIterator& rhs); + + private: + const BasicBlock* current_; + std::function dom_func_; + }; + + /// Returns a dominator iterator which points to the current block + const DominatorIterator dom_begin() const; + + /// Returns a dominator iterator which points to the current block + DominatorIterator dom_begin(); + + /// Returns a dominator iterator which points to one element past the first + /// block + const DominatorIterator dom_end() const; + + /// Returns a dominator iterator which points to one element past the first + /// block + DominatorIterator dom_end(); + + /// Returns a post dominator iterator which points to the current block + const DominatorIterator pdom_begin() const; + /// Returns a post dominator iterator which points to the current block + DominatorIterator pdom_begin(); + + /// Returns a post dominator iterator which points to one element past the + /// last block + const DominatorIterator pdom_end() const; + + /// Returns a post dominator iterator which points to one element past the + /// last block + DominatorIterator pdom_end(); + + private: + /// Id of the BasicBlock + const uint32_t id_; + + /// Pointer to the immediate dominator of the BasicBlock + BasicBlock* immediate_dominator_; + + /// Pointer to the immediate dominator of the BasicBlock + BasicBlock* immediate_post_dominator_; + + /// The set of predecessors of the BasicBlock + std::vector predecessors_; + + /// The set of successors of the BasicBlock + std::vector successors_; + + /// The type of the block + std::bitset type_; + + /// True if the block is reachable in the CFG + bool reachable_; + + /// label of this block, if any. + const Instruction* label_; + + /// Terminator of this block. + const Instruction* terminator_; +}; + +/// @brief Returns true if the iterators point to the same element or if both +/// iterators point to the @p dom_end block +bool operator==(const BasicBlock::DominatorIterator& lhs, + const BasicBlock::DominatorIterator& rhs); + +/// @brief Returns true if the iterators point to different elements and they +/// do not both point to the @p dom_end block +bool operator!=(const BasicBlock::DominatorIterator& lhs, + const BasicBlock::DominatorIterator& rhs); + +} // namespace val +} // namespace spvtools + +#endif // SOURCE_VAL_BASIC_BLOCK_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/construct.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/construct.cpp new file mode 100644 index 00000000000..c11a065b7f9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/construct.cpp @@ -0,0 +1,128 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/construct.h" + +#include +#include +#include + +#include "source/val/function.h" + +namespace spvtools { +namespace val { + +Construct::Construct(ConstructType construct_type, BasicBlock* entry, + BasicBlock* exit, std::vector constructs) + : type_(construct_type), + corresponding_constructs_(constructs), + entry_block_(entry), + exit_block_(exit) {} + +ConstructType Construct::type() const { return type_; } + +const std::vector& Construct::corresponding_constructs() const { + return corresponding_constructs_; +} +std::vector& Construct::corresponding_constructs() { + return corresponding_constructs_; +} + +bool ValidateConstructSize(ConstructType type, size_t size) { + switch (type) { + case ConstructType::kSelection: + return size == 0; + case ConstructType::kContinue: + return size == 1; + case ConstructType::kLoop: + return size == 1; + case ConstructType::kCase: + return size >= 1; + default: + assert(1 == 0 && "Type not defined"); + } + return false; +} + +void Construct::set_corresponding_constructs( + std::vector constructs) { + assert(ValidateConstructSize(type_, constructs.size())); + corresponding_constructs_ = constructs; +} + +const BasicBlock* Construct::entry_block() const { return entry_block_; } +BasicBlock* Construct::entry_block() { return entry_block_; } + +const BasicBlock* Construct::exit_block() const { return exit_block_; } +BasicBlock* Construct::exit_block() { return exit_block_; } + +void Construct::set_exit(BasicBlock* block) { exit_block_ = block; } + +Construct::ConstructBlockSet Construct::blocks(Function* function) const { + auto header = entry_block(); + auto merge = exit_block(); + assert(header); + assert(merge); + int header_depth = function->GetBlockDepth(const_cast(header)); + ConstructBlockSet construct_blocks; + std::unordered_set corresponding_headers; + for (auto& other : corresponding_constructs()) { + corresponding_headers.insert(other->entry_block()); + } + std::vector stack; + stack.push_back(const_cast(header)); + while (!stack.empty()) { + BasicBlock* block = stack.back(); + stack.pop_back(); + + if (merge == block && ExitBlockIsMergeBlock()) { + // Merge block is not part of the construct. + continue; + } + + if (corresponding_headers.count(block)) { + // Entered a corresponding construct. + continue; + } + + int block_depth = function->GetBlockDepth(block); + if (block_depth < header_depth) { + // Broke to outer construct. + continue; + } + + // In a loop, the continue target is at a depth of the loop construct + 1. + // A selection construct nested directly within the loop construct is also + // at the same depth. It is valid, however, to branch directly to the + // continue target from within the selection construct. + if (block_depth == header_depth && type() == ConstructType::kSelection && + block->is_type(kBlockTypeContinue)) { + // Continued to outer construct. + continue; + } + + if (!construct_blocks.insert(block).second) continue; + + if (merge != block) { + for (auto succ : *block->successors()) { + stack.push_back(succ); + } + } + } + + return construct_blocks; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/construct.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/construct.h new file mode 100644 index 00000000000..c7e7a780d6e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/construct.h @@ -0,0 +1,151 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_VAL_CONSTRUCT_H_ +#define SOURCE_VAL_CONSTRUCT_H_ + +#include +#include +#include + +#include "source/val/basic_block.h" + +namespace spvtools { +namespace val { + +/// Functor for ordering BasicBlocks. BasicBlock pointers must not be null. +struct less_than_id { + bool operator()(const BasicBlock* lhs, const BasicBlock* rhs) const { + return lhs->id() < rhs->id(); + } +}; + +enum class ConstructType : int { + kNone = 0, + /// The set of blocks dominated by a selection header, minus the set of blocks + /// dominated by the header's merge block + kSelection, + /// The set of blocks dominated by an OpLoopMerge's Continue Target and post + /// dominated by the corresponding back + kContinue, + /// The set of blocks dominated by a loop header, minus the set of blocks + /// dominated by the loop's merge block, minus the loop's corresponding + /// continue construct + kLoop, + /// The set of blocks dominated by an OpSwitch's Target or Default, minus the + /// set of blocks dominated by the OpSwitch's merge block (this construct is + /// only defined for those OpSwitch Target or Default that are not equal to + /// the OpSwitch's corresponding merge block) + kCase +}; + +class Function; + +/// @brief This class tracks the CFG constructs as defined in the SPIR-V spec +class Construct { + public: + Construct(ConstructType type, BasicBlock* dominator, + BasicBlock* exit = nullptr, + std::vector constructs = std::vector()); + + /// Returns the type of the construct + ConstructType type() const; + + const std::vector& corresponding_constructs() const; + std::vector& corresponding_constructs(); + void set_corresponding_constructs(std::vector constructs); + + /// Returns the dominator block of the construct. + /// + /// This is usually the header block or the first block of the construct. + const BasicBlock* entry_block() const; + + /// Returns the dominator block of the construct. + /// + /// This is usually the header block or the first block of the construct. + BasicBlock* entry_block(); + + /// Returns the exit block of the construct. + /// + /// For a continue construct it is the backedge block of the corresponding + /// loop construct. For the case construct it is the block that branches to + /// the OpSwitch merge block or other case blocks. Otherwise it is the merge + /// block of the corresponding header block + const BasicBlock* exit_block() const; + + /// Returns the exit block of the construct. + /// + /// For a continue construct it is the backedge block of the corresponding + /// loop construct. For the case construct it is the block that branches to + /// the OpSwitch merge block or other case blocks. Otherwise it is the merge + /// block of the corresponding header block + BasicBlock* exit_block(); + + /// Sets the exit block for this construct. This is useful for continue + /// constructs which do not know the back-edge block during construction + void set_exit(BasicBlock* exit_block); + + // Returns whether the exit block of this construct is the merge block + // for an OpLoopMerge or OpSelectionMerge + bool ExitBlockIsMergeBlock() const { + return type_ == ConstructType::kLoop || type_ == ConstructType::kSelection; + } + + using ConstructBlockSet = std::set; + + // Returns the basic blocks in this construct. This function should not + // be called before the exit block is set and dominators have been + // calculated. + ConstructBlockSet blocks(Function* function) const; + + private: + /// The type of the construct + ConstructType type_; + + /// These are the constructs that are related to this construct. These + /// constructs can be the continue construct, for the corresponding loop + /// construct, the case construct that are part of the same OpSwitch + /// instruction + /// + /// Here is a table that describes what constructs are included in + /// @p corresponding_constructs_ + /// | this construct | corresponding construct | + /// |----------------|----------------------------------| + /// | loop | continue | + /// | continue | loop | + /// | case | other cases in the same OpSwitch | + /// + /// kContinue and kLoop constructs will always have corresponding + /// constructs even if they are represented by the same block + std::vector corresponding_constructs_; + + /// @brief Dominator block for the construct + /// + /// The dominator block for the construct. Depending on the construct this may + /// be a selection header, a continue target of a loop, a loop header or a + /// Target or Default block of a switch + BasicBlock* entry_block_; + + /// @brief Exiting block for the construct + /// + /// The exit block for the construct. This can be a merge block for the loop + /// and selection constructs, a back-edge block for a continue construct, or + /// the branching block for the case construct + BasicBlock* exit_block_; +}; + +} // namespace val +} // namespace spvtools + +#endif // SOURCE_VAL_CONSTRUCT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/decoration.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/decoration.h new file mode 100644 index 00000000000..ed3320f87ab --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/decoration.h @@ -0,0 +1,89 @@ +// Copyright (c) 2017 Google 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. + +#ifndef SOURCE_VAL_DECORATION_H_ +#define SOURCE_VAL_DECORATION_H_ + +#include +#include +#include + +#include "source/latest_version_spirv_header.h" + +namespace spvtools { +namespace val { + +// An object of this class represents a specific decoration including its +// parameters (if any). Decorations are used by OpDecorate and OpMemberDecorate, +// and they describe certain properties that can be assigned to one or several +// s. +// +// A Decoration object contains the decoration type (an enum), associated +// literal parameters, and struct member index. If the decoration does not apply +// to a struct member, then the index is kInvalidIndex. A Decoration object does +// not store the target Id, i.e. the Id to which it applies. It is +// possible for the same decoration to be applied to several s (and they +// might be assigned using separate SPIR-V instructions, possibly using an +// assignment through GroupDecorate). +// +// Example 1: Decoration for an object with no parameters: +// OpDecorate %obj Flat +// dec_type_ = SpvDecorationFlat +// params_ = empty vector +// struct_member_index_ = kInvalidMember +// +// Example 2: Decoration for an object with two parameters: +// OpDecorate %obj LinkageAttributes "link" Import +// dec_type_ = SpvDecorationLinkageAttributes +// params_ = vector { link, Import } +// struct_member_index_ = kInvalidMember +// +// Example 3: Decoration for a member of a structure with one parameter: +// OpMemberDecorate %struct 2 Offset 2 +// dec_type_ = SpvDecorationOffset +// params_ = vector { 2 } +// struct_member_index_ = 2 +// +class Decoration { + public: + enum { kInvalidMember = -1 }; + Decoration(SpvDecoration t, + const std::vector& parameters = std::vector(), + uint32_t member_index = kInvalidMember) + : dec_type_(t), params_(parameters), struct_member_index_(member_index) {} + + void set_struct_member_index(uint32_t index) { struct_member_index_ = index; } + int struct_member_index() const { return struct_member_index_; } + SpvDecoration dec_type() const { return dec_type_; } + std::vector& params() { return params_; } + const std::vector& params() const { return params_; } + + inline bool operator==(const Decoration& rhs) const { + return (dec_type_ == rhs.dec_type_ && params_ == rhs.params_ && + struct_member_index_ == rhs.struct_member_index_); + } + + private: + SpvDecoration dec_type_; + std::vector params_; + + // If the decoration applies to a member of a structure type, then the index + // of the member is stored here. Otherwise, this is kInvalidIndex. + int struct_member_index_; +}; + +} // namespace val +} // namespace spvtools + +#endif // SOURCE_VAL_DECORATION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/function.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/function.cpp new file mode 100644 index 00000000000..f638fb5b4e2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/function.cpp @@ -0,0 +1,387 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/function.h" + +#include + +#include +#include +#include +#include +#include + +#include "source/cfa.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" +#include "source/val/validate.h" + +namespace spvtools { +namespace val { + +// Universal Limit of ResultID + 1 +static const uint32_t kInvalidId = 0x400000; + +Function::Function(uint32_t function_id, uint32_t result_type_id, + SpvFunctionControlMask function_control, + uint32_t function_type_id) + : id_(function_id), + function_type_id_(function_type_id), + result_type_id_(result_type_id), + function_control_(function_control), + declaration_type_(FunctionDecl::kFunctionDeclUnknown), + end_has_been_registered_(false), + blocks_(), + current_block_(nullptr), + pseudo_entry_block_(0), + pseudo_exit_block_(kInvalidId), + cfg_constructs_(), + variable_ids_(), + parameter_ids_() {} + +bool Function::IsFirstBlock(uint32_t block_id) const { + return !ordered_blocks_.empty() && *first_block() == block_id; +} + +spv_result_t Function::RegisterFunctionParameter(uint32_t parameter_id, + uint32_t type_id) { + assert(current_block_ == nullptr && + "RegisterFunctionParameter can only be called when parsing the binary " + "ouside of a block"); + // TODO(umar): Validate function parameter type order and count + // TODO(umar): Use these variables to validate parameter type + (void)parameter_id; + (void)type_id; + return SPV_SUCCESS; +} + +spv_result_t Function::RegisterLoopMerge(uint32_t merge_id, + uint32_t continue_id) { + RegisterBlock(merge_id, false); + RegisterBlock(continue_id, false); + BasicBlock& merge_block = blocks_.at(merge_id); + BasicBlock& continue_target_block = blocks_.at(continue_id); + assert(current_block_ && + "RegisterLoopMerge must be called when called within a block"); + + current_block_->set_type(kBlockTypeLoop); + merge_block.set_type(kBlockTypeMerge); + continue_target_block.set_type(kBlockTypeContinue); + Construct& loop_construct = + AddConstruct({ConstructType::kLoop, current_block_, &merge_block}); + Construct& continue_construct = + AddConstruct({ConstructType::kContinue, &continue_target_block}); + + continue_construct.set_corresponding_constructs({&loop_construct}); + loop_construct.set_corresponding_constructs({&continue_construct}); + merge_block_header_[&merge_block] = current_block_; + + return SPV_SUCCESS; +} + +spv_result_t Function::RegisterSelectionMerge(uint32_t merge_id) { + RegisterBlock(merge_id, false); + BasicBlock& merge_block = blocks_.at(merge_id); + current_block_->set_type(kBlockTypeHeader); + merge_block.set_type(kBlockTypeMerge); + merge_block_header_[&merge_block] = current_block_; + + AddConstruct({ConstructType::kSelection, current_block(), &merge_block}); + + return SPV_SUCCESS; +} + +spv_result_t Function::RegisterSetFunctionDeclType(FunctionDecl type) { + assert(declaration_type_ == FunctionDecl::kFunctionDeclUnknown); + declaration_type_ = type; + return SPV_SUCCESS; +} + +spv_result_t Function::RegisterBlock(uint32_t block_id, bool is_definition) { + assert( + declaration_type_ == FunctionDecl::kFunctionDeclDefinition && + "RegisterBlocks can only be called after declaration_type_ is defined"); + + std::unordered_map::iterator inserted_block; + bool success = false; + tie(inserted_block, success) = + blocks_.insert({block_id, BasicBlock(block_id)}); + if (is_definition) { // new block definition + assert(current_block_ == nullptr && + "Register Block can only be called when parsing a binary outside of " + "a BasicBlock"); + + undefined_blocks_.erase(block_id); + current_block_ = &inserted_block->second; + ordered_blocks_.push_back(current_block_); + if (IsFirstBlock(block_id)) current_block_->set_reachable(true); + } else if (success) { // Block doesn't exsist but this is not a definition + undefined_blocks_.insert(block_id); + } + + return SPV_SUCCESS; +} + +void Function::RegisterBlockEnd(std::vector next_list, + SpvOp branch_instruction) { + assert( + current_block_ && + "RegisterBlockEnd can only be called when parsing a binary in a block"); + std::vector next_blocks; + next_blocks.reserve(next_list.size()); + + std::unordered_map::iterator inserted_block; + bool success; + for (uint32_t successor_id : next_list) { + tie(inserted_block, success) = + blocks_.insert({successor_id, BasicBlock(successor_id)}); + if (success) { + undefined_blocks_.insert(successor_id); + } + next_blocks.push_back(&inserted_block->second); + } + + if (current_block_->is_type(kBlockTypeLoop)) { + // For each loop header, record the set of its successors, and include + // its continue target if the continue target is not the loop header + // itself. + std::vector& next_blocks_plus_continue_target = + loop_header_successors_plus_continue_target_map_[current_block_]; + next_blocks_plus_continue_target = next_blocks; + auto continue_target = + FindConstructForEntryBlock(current_block_, ConstructType::kLoop) + .corresponding_constructs() + .back() + ->entry_block(); + if (continue_target != current_block_) { + next_blocks_plus_continue_target.push_back(continue_target); + } + } + + current_block_->RegisterBranchInstruction(branch_instruction); + current_block_->RegisterSuccessors(next_blocks); + current_block_ = nullptr; + return; +} + +void Function::RegisterFunctionEnd() { + if (!end_has_been_registered_) { + end_has_been_registered_ = true; + + ComputeAugmentedCFG(); + } +} + +size_t Function::block_count() const { return blocks_.size(); } + +size_t Function::undefined_block_count() const { + return undefined_blocks_.size(); +} + +const std::vector& Function::ordered_blocks() const { + return ordered_blocks_; +} +std::vector& Function::ordered_blocks() { return ordered_blocks_; } + +const BasicBlock* Function::current_block() const { return current_block_; } +BasicBlock* Function::current_block() { return current_block_; } + +const std::list& Function::constructs() const { + return cfg_constructs_; +} +std::list& Function::constructs() { return cfg_constructs_; } + +const BasicBlock* Function::first_block() const { + if (ordered_blocks_.empty()) return nullptr; + return ordered_blocks_[0]; +} +BasicBlock* Function::first_block() { + if (ordered_blocks_.empty()) return nullptr; + return ordered_blocks_[0]; +} + +bool Function::IsBlockType(uint32_t merge_block_id, BlockType type) const { + bool ret = false; + const BasicBlock* block; + std::tie(block, std::ignore) = GetBlock(merge_block_id); + if (block) { + ret = block->is_type(type); + } + return ret; +} + +std::pair Function::GetBlock(uint32_t block_id) const { + const auto b = blocks_.find(block_id); + if (b != end(blocks_)) { + const BasicBlock* block = &(b->second); + bool defined = + undefined_blocks_.find(block->id()) == std::end(undefined_blocks_); + return std::make_pair(block, defined); + } else { + return std::make_pair(nullptr, false); + } +} + +std::pair Function::GetBlock(uint32_t block_id) { + const BasicBlock* out; + bool defined; + std::tie(out, defined) = + const_cast(this)->GetBlock(block_id); + return std::make_pair(const_cast(out), defined); +} + +Function::GetBlocksFunction Function::AugmentedCFGSuccessorsFunction() const { + return [this](const BasicBlock* block) { + auto where = augmented_successors_map_.find(block); + return where == augmented_successors_map_.end() ? block->successors() + : &(*where).second; + }; +} + +Function::GetBlocksFunction +Function::AugmentedCFGSuccessorsFunctionIncludingHeaderToContinueEdge() const { + return [this](const BasicBlock* block) { + auto where = loop_header_successors_plus_continue_target_map_.find(block); + return where == loop_header_successors_plus_continue_target_map_.end() + ? AugmentedCFGSuccessorsFunction()(block) + : &(*where).second; + }; +} + +Function::GetBlocksFunction Function::AugmentedCFGPredecessorsFunction() const { + return [this](const BasicBlock* block) { + auto where = augmented_predecessors_map_.find(block); + return where == augmented_predecessors_map_.end() ? block->predecessors() + : &(*where).second; + }; +} + +void Function::ComputeAugmentedCFG() { + // Compute the successors of the pseudo-entry block, and + // the predecessors of the pseudo exit block. + auto succ_func = [](const BasicBlock* b) { return b->successors(); }; + auto pred_func = [](const BasicBlock* b) { return b->predecessors(); }; + CFA::ComputeAugmentedCFG( + ordered_blocks_, &pseudo_entry_block_, &pseudo_exit_block_, + &augmented_successors_map_, &augmented_predecessors_map_, succ_func, + pred_func); +} + +Construct& Function::AddConstruct(const Construct& new_construct) { + cfg_constructs_.push_back(new_construct); + auto& result = cfg_constructs_.back(); + entry_block_to_construct_[std::make_pair(new_construct.entry_block(), + new_construct.type())] = &result; + return result; +} + +Construct& Function::FindConstructForEntryBlock(const BasicBlock* entry_block, + ConstructType type) { + auto where = + entry_block_to_construct_.find(std::make_pair(entry_block, type)); + assert(where != entry_block_to_construct_.end()); + auto construct_ptr = (*where).second; + assert(construct_ptr); + return *construct_ptr; +} + +int Function::GetBlockDepth(BasicBlock* bb) { + // Guard against nullptr. + if (!bb) { + return 0; + } + // Only calculate the depth if it's not already calculated. + // This function uses memoization to avoid duplicate CFG depth calculations. + if (block_depth_.find(bb) != block_depth_.end()) { + return block_depth_[bb]; + } + + BasicBlock* bb_dom = bb->immediate_dominator(); + if (!bb_dom || bb == bb_dom) { + // This block has no dominator, so it's at depth 0. + block_depth_[bb] = 0; + } else if (bb->is_type(kBlockTypeMerge)) { + // If this is a merge block, its depth is equal to the block before + // branching. + BasicBlock* header = merge_block_header_[bb]; + assert(header); + block_depth_[bb] = GetBlockDepth(header); + } else if (bb->is_type(kBlockTypeContinue)) { + // The depth of the continue block entry point is 1 + loop header depth. + Construct* continue_construct = + entry_block_to_construct_[std::make_pair(bb, ConstructType::kContinue)]; + assert(continue_construct); + // Continue construct has only 1 corresponding construct (loop header). + Construct* loop_construct = + continue_construct->corresponding_constructs()[0]; + assert(loop_construct); + BasicBlock* loop_header = loop_construct->entry_block(); + // The continue target may be the loop itself (while 1). + // In such cases, the depth of the continue block is: 1 + depth of the + // loop's dominator block. + if (loop_header == bb) { + block_depth_[bb] = 1 + GetBlockDepth(bb_dom); + } else { + block_depth_[bb] = 1 + GetBlockDepth(loop_header); + } + } else if (bb_dom->is_type(kBlockTypeHeader) || + bb_dom->is_type(kBlockTypeLoop)) { + // The dominator of the given block is a header block. So, the nesting + // depth of this block is: 1 + nesting depth of the header. + block_depth_[bb] = 1 + GetBlockDepth(bb_dom); + } else { + block_depth_[bb] = GetBlockDepth(bb_dom); + } + return block_depth_[bb]; +} + +void Function::RegisterExecutionModelLimitation(SpvExecutionModel model, + const std::string& message) { + execution_model_limitations_.push_back( + [model, message](SpvExecutionModel in_model, std::string* out_message) { + if (model != in_model) { + if (out_message) { + *out_message = message; + } + return false; + } + return true; + }); +} + +bool Function::IsCompatibleWithExecutionModel(SpvExecutionModel model, + std::string* reason) const { + bool return_value = true; + std::stringstream ss_reason; + + for (const auto& is_compatible : execution_model_limitations_) { + std::string message; + if (!is_compatible(model, &message)) { + if (!reason) return false; + return_value = false; + if (!message.empty()) { + ss_reason << message << "\n"; + } + } + } + + if (!return_value && reason) { + *reason = ss_reason.str(); + } + + return return_value; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/function.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/function.h new file mode 100644 index 00000000000..a052bbda0ba --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/function.h @@ -0,0 +1,360 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_VAL_FUNCTION_H_ +#define SOURCE_VAL_FUNCTION_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/latest_version_spirv_header.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { + +struct bb_constr_type_pair_hash { + std::size_t operator()( + const std::pair& p) const { + auto h1 = std::hash{}(p.first); + auto h2 = std::hash::type>{}( + static_cast::type>(p.second)); + return (h1 ^ h2); + } +}; + +enum class FunctionDecl { + kFunctionDeclUnknown, /// < Unknown function declaration + kFunctionDeclDeclaration, /// < Function declaration + kFunctionDeclDefinition /// < Function definition +}; + +/// This class manages all function declaration and definitions in a module. It +/// handles the state and id information while parsing a function in the SPIR-V +/// binary. +class Function { + public: + Function(uint32_t id, uint32_t result_type_id, + SpvFunctionControlMask function_control, uint32_t function_type_id); + + /// Registers a function parameter in the current function + /// @return Returns SPV_SUCCESS if the call was successful + spv_result_t RegisterFunctionParameter(uint32_t id, uint32_t type_id); + + /// Sets the declaration type of the current function + /// @return Returns SPV_SUCCESS if the call was successful + spv_result_t RegisterSetFunctionDeclType(FunctionDecl type); + + /// Registers a block in the current function. Subsequent block instructions + /// will target this block + /// @param id The ID of the label of the block + /// @return Returns SPV_SUCCESS if the call was successful + spv_result_t RegisterBlock(uint32_t id, bool is_definition = true); + + /// Registers a variable in the current block + /// + /// @param[in] type_id The type ID of the varaible + /// @param[in] id The ID of the varaible + /// @param[in] storage The storage of the variable + /// @param[in] init_id The initializer ID of the variable + /// + /// @return Returns SPV_SUCCESS if the call was successful + spv_result_t RegisterBlockVariable(uint32_t type_id, uint32_t id, + SpvStorageClass storage, uint32_t init_id); + + /// Registers a loop merge construct in the function + /// + /// @param[in] merge_id The merge block ID of the loop + /// @param[in] continue_id The continue block ID of the loop + /// + /// @return Returns SPV_SUCCESS if the call was successful + spv_result_t RegisterLoopMerge(uint32_t merge_id, uint32_t continue_id); + + /// Registers a selection merge construct in the function + /// @return Returns SPV_SUCCESS if the call was successful + spv_result_t RegisterSelectionMerge(uint32_t merge_id); + + /// Registers the end of the block + /// + /// @param[in] successors_list A list of ids to the block's successors + /// @param[in] branch_instruction the branch instruction that ended the block + void RegisterBlockEnd(std::vector successors_list, + SpvOp branch_instruction); + + /// Registers the end of the function. This is idempotent. + void RegisterFunctionEnd(); + + /// Returns true if the \p id block is the first block of this function + bool IsFirstBlock(uint32_t id) const; + + /// Returns true if the \p merge_block_id is a BlockType of \p type + bool IsBlockType(uint32_t merge_block_id, BlockType type) const; + + /// Returns a pair consisting of the BasicBlock with \p id and a bool + /// which is true if the block has been defined, and false if it is + /// declared but not defined. This function will return nullptr if the + /// \p id was not declared and not defined at the current point in the binary + std::pair GetBlock(uint32_t id) const; + std::pair GetBlock(uint32_t id); + + /// Returns the first block of the current function + const BasicBlock* first_block() const; + + /// Returns the first block of the current function + BasicBlock* first_block(); + + /// Returns a vector of all the blocks in the function + const std::vector& ordered_blocks() const; + + /// Returns a vector of all the blocks in the function + std::vector& ordered_blocks(); + + /// Returns a list of all the cfg constructs in the function + const std::list& constructs() const; + + /// Returns a list of all the cfg constructs in the function + std::list& constructs(); + + /// Returns the number of blocks in the current function being parsed + size_t block_count() const; + + /// Returns the id of the function + uint32_t id() const { return id_; } + + /// Returns return type id of the function + uint32_t GetResultTypeId() const { return result_type_id_; } + + /// Returns the number of blocks in the current function being parsed + size_t undefined_block_count() const; + const std::unordered_set& undefined_blocks() const { + return undefined_blocks_; + } + + /// Returns the block that is currently being parsed in the binary + BasicBlock* current_block(); + + /// Returns the block that is currently being parsed in the binary + const BasicBlock* current_block() const; + + // For dominance calculations, we want to analyze all the + // blocks in the function, even in degenerate control flow cases + // including unreachable blocks. We therefore make an "augmented CFG" + // which is the same as the ordinary CFG but adds: + // - A pseudo-entry node. + // - A pseudo-exit node. + // - A minimal set of edges so that a forward traversal from the + // pseudo-entry node will visit all nodes. + // - A minimal set of edges so that a backward traversal from the + // pseudo-exit node will visit all nodes. + // In particular, the pseudo-entry node is the unique source of the + // augmented CFG, and the psueo-exit node is the unique sink of the + // augmented CFG. + + /// Returns the pseudo exit block + BasicBlock* pseudo_entry_block() { return &pseudo_entry_block_; } + + /// Returns the pseudo exit block + const BasicBlock* pseudo_entry_block() const { return &pseudo_entry_block_; } + + /// Returns the pseudo exit block + BasicBlock* pseudo_exit_block() { return &pseudo_exit_block_; } + + /// Returns the pseudo exit block + const BasicBlock* pseudo_exit_block() const { return &pseudo_exit_block_; } + + using GetBlocksFunction = + std::function*(const BasicBlock*)>; + /// Returns the block successors function for the augmented CFG. + GetBlocksFunction AugmentedCFGSuccessorsFunction() const; + /// Like AugmentedCFGSuccessorsFunction, but also includes a forward edge from + /// a loop header block to its continue target, if they are different blocks. + GetBlocksFunction + AugmentedCFGSuccessorsFunctionIncludingHeaderToContinueEdge() const; + /// Returns the block predecessors function for the augmented CFG. + GetBlocksFunction AugmentedCFGPredecessorsFunction() const; + + /// Returns the control flow nesting depth of the given basic block. + /// This function only works when you have structured control flow. + /// This function should only be called after the control flow constructs have + /// been identified and dominators have been computed. + int GetBlockDepth(BasicBlock* bb); + + /// Prints a GraphViz digraph of the CFG of the current funciton + void PrintDotGraph() const; + + /// Prints a directed graph of the CFG of the current funciton + void PrintBlocks() const; + + /// Registers execution model limitation such as "Feature X is only available + /// with Execution Model Y". + void RegisterExecutionModelLimitation(SpvExecutionModel model, + const std::string& message); + + /// Registers execution model limitation with an |is_compatible| functor. + void RegisterExecutionModelLimitation( + std::function is_compatible) { + execution_model_limitations_.push_back(is_compatible); + } + + /// Returns true if the given execution model passes the limitations stored in + /// execution_model_limitations_. Returns false otherwise and fills optional + /// |reason| parameter. + bool IsCompatibleWithExecutionModel(SpvExecutionModel model, + std::string* reason = nullptr) const; + + // Inserts id to the set of functions called from this function. + void AddFunctionCallTarget(uint32_t call_target_id) { + function_call_targets_.insert(call_target_id); + } + + // Returns a set with ids of all functions called from this function. + const std::set function_call_targets() const { + return function_call_targets_; + } + + private: + // Computes the representation of the augmented CFG. + // Populates augmented_successors_map_ and augmented_predecessors_map_. + void ComputeAugmentedCFG(); + + // Adds a copy of the given Construct, and tracks it by its entry block. + // Returns a reference to the stored construct. + Construct& AddConstruct(const Construct& new_construct); + + // Returns a reference to the construct corresponding to the given entry + // block. + Construct& FindConstructForEntryBlock(const BasicBlock* entry_block, + ConstructType t); + + /// The result id of the OpLabel that defined this block + uint32_t id_; + + /// The type of the function + uint32_t function_type_id_; + + /// The type of the return value + uint32_t result_type_id_; + + /// The control fo the funciton + SpvFunctionControlMask function_control_; + + /// The type of declaration of each function + FunctionDecl declaration_type_; + + // Have we finished parsing this function? + bool end_has_been_registered_; + + /// The blocks in the function mapped by block ID + std::unordered_map blocks_; + + /// A list of blocks in the order they appeared in the binary + std::vector ordered_blocks_; + + /// Blocks which are forward referenced by blocks but not defined + std::unordered_set undefined_blocks_; + + /// The block that is currently being parsed + BasicBlock* current_block_; + + /// A pseudo entry node used in dominance analysis. + /// After the function end has been registered, the successor list of the + /// pseudo entry node is the minimal set of nodes such that all nodes in the + /// CFG can be reached by following successor lists. That is, the successors + /// will be: + /// - Any basic block without predecessors. This includes the entry + /// block to the function. + /// - A single node from each otherwise unreachable cycle in the CFG, if + /// such cycles exist. + /// The pseudo entry node does not appear in the predecessor or successor + /// list of any ordinary block. + /// It has no predecessors. + /// It has Id 0. + BasicBlock pseudo_entry_block_; + + /// A pseudo exit block used in dominance analysis. + /// After the function end has been registered, the predecessor list of the + /// pseudo exit node is the minimal set of nodes such that all nodes in the + /// CFG can be reached by following predecessor lists. That is, the + /// predecessors will be: + /// - Any basic block without successors. This includes any basic block + /// ending with an OpReturn, OpReturnValue or similar instructions. + /// - A single node from each otherwise unreachable cycle in the CFG, if + /// such cycles exist. + /// The pseudo exit node does not appear in the predecessor or successor + /// list of any ordinary block. + /// It has no successors. + BasicBlock pseudo_exit_block_; + + // Maps a block to its successors in the augmented CFG, if that set is + // different from its successors in the ordinary CFG. + std::unordered_map> + augmented_successors_map_; + // Maps a block to its predecessors in the augmented CFG, if that set is + // different from its predecessors in the ordinary CFG. + std::unordered_map> + augmented_predecessors_map_; + + // Maps a structured loop header to its CFG successors and also its + // continue target if that continue target is not the loop header + // itself. This might have duplicates. + std::unordered_map> + loop_header_successors_plus_continue_target_map_; + + /// The constructs that are available in this function + std::list cfg_constructs_; + + /// The variable IDs of the functions + std::vector variable_ids_; + + /// The function parameter ids of the functions + std::vector parameter_ids_; + + /// Maps a construct's entry block to the construct(s). + /// Since a basic block may be the entry block of different types of + /// constructs, the type of the construct should also be specified in order to + /// get the unique construct. + std::unordered_map, Construct*, + bb_constr_type_pair_hash> + entry_block_to_construct_; + + /// This map provides the header block for a given merge block. + std::unordered_map merge_block_header_; + + /// Stores the control flow nesting depth of a given basic block + std::unordered_map block_depth_; + + /// Stores execution model limitations imposed by instructions used within the + /// function. The functor stored in the list return true if execution model + /// is compatible, false otherwise. If the functor returns false, it can also + /// optionally fill the string parameter with the reason for incompatibility. + std::list> + execution_model_limitations_; + + /// Stores ids of all functions called from this function. + std::set function_call_targets_; +}; + +} // namespace val +} // namespace spvtools + +#endif // SOURCE_VAL_FUNCTION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/instruction.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/instruction.cpp new file mode 100644 index 00000000000..b9155898ac8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/instruction.cpp @@ -0,0 +1,45 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/instruction.h" + +#include + +namespace spvtools { +namespace val { + +Instruction::Instruction(const spv_parsed_instruction_t* inst) + : words_(inst->words, inst->words + inst->num_words), + operands_(inst->operands, inst->operands + inst->num_operands), + inst_({words_.data(), inst->num_words, inst->opcode, inst->ext_inst_type, + inst->type_id, inst->result_id, operands_.data(), + inst->num_operands}) {} + +void Instruction::RegisterUse(const Instruction* inst, uint32_t index) { + uses_.push_back(std::make_pair(inst, index)); +} + +bool operator<(const Instruction& lhs, const Instruction& rhs) { + return lhs.id() < rhs.id(); +} +bool operator<(const Instruction& lhs, uint32_t rhs) { return lhs.id() < rhs; } +bool operator==(const Instruction& lhs, const Instruction& rhs) { + return lhs.id() == rhs.id(); +} +bool operator==(const Instruction& lhs, uint32_t rhs) { + return lhs.id() == rhs; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/instruction.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/instruction.h new file mode 100644 index 00000000000..1fa855fca9d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/instruction.h @@ -0,0 +1,140 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_VAL_INSTRUCTION_H_ +#define SOURCE_VAL_INSTRUCTION_H_ + +#include +#include +#include +#include +#include + +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { + +class BasicBlock; +class Function; + +/// Wraps the spv_parsed_instruction struct along with use and definition of the +/// instruction's result id +class Instruction { + public: + explicit Instruction(const spv_parsed_instruction_t* inst); + + /// Registers the use of the Instruction in instruction \p inst at \p index + void RegisterUse(const Instruction* inst, uint32_t index); + + uint32_t id() const { return inst_.result_id; } + uint32_t type_id() const { return inst_.type_id; } + SpvOp opcode() const { return static_cast(inst_.opcode); } + + /// Returns the Function where the instruction was defined. nullptr if it was + /// defined outside of a Function + const Function* function() const { return function_; } + void set_function(Function* func) { function_ = func; } + + /// Returns the BasicBlock where the instruction was defined. nullptr if it + /// was defined outside of a BasicBlock + const BasicBlock* block() const { return block_; } + void set_block(BasicBlock* b) { block_ = b; } + + /// Returns a vector of pairs of all references to this instruction's result + /// id. The first element is the instruction in which this result id was + /// referenced and the second is the index of the word in that instruction + /// where this result id appeared + const std::vector>& uses() const { + return uses_; + } + + /// The word used to define the Instruction + uint32_t word(size_t index) const { return words_[index]; } + + /// The words used to define the Instruction + const std::vector& words() const { return words_; } + + /// Returns the operand at |idx|. + const spv_parsed_operand_t& operand(size_t idx) const { + return operands_[idx]; + } + + /// The operands of the Instruction + const std::vector& operands() const { + return operands_; + } + + /// Provides direct access to the stored C instruction object. + const spv_parsed_instruction_t& c_inst() const { return inst_; } + + /// Provides direct access to instructions spv_ext_inst_type_t object. + const spv_ext_inst_type_t& ext_inst_type() const { + return inst_.ext_inst_type; + } + + // Casts the words belonging to the operand under |index| to |T| and returns. + template + T GetOperandAs(size_t index) const { + const spv_parsed_operand_t& o = operands_.at(index); + assert(o.num_words * 4 >= sizeof(T)); + assert(o.offset + o.num_words <= inst_.num_words); + return *reinterpret_cast(&words_[o.offset]); + } + + size_t LineNum() const { return line_num_; } + void SetLineNum(size_t pos) { line_num_ = pos; } + + private: + const std::vector words_; + const std::vector operands_; + spv_parsed_instruction_t inst_; + size_t line_num_ = 0; + + /// The function in which this instruction was declared + Function* function_ = nullptr; + + /// The basic block in which this instruction was declared + BasicBlock* block_ = nullptr; + + /// This is a vector of pairs of all references to this instruction's result + /// id. The first element is the instruction in which this result id was + /// referenced and the second is the index of the word in the referencing + /// instruction where this instruction appeared + std::vector> uses_; +}; + +bool operator<(const Instruction& lhs, const Instruction& rhs); +bool operator<(const Instruction& lhs, uint32_t rhs); +bool operator==(const Instruction& lhs, const Instruction& rhs); +bool operator==(const Instruction& lhs, uint32_t rhs); + +} // namespace val +} // namespace spvtools + +// custom specialization of std::hash for Instruction +namespace std { +template <> +struct hash { + typedef spvtools::val::Instruction argument_type; + typedef std::size_t result_type; + result_type operator()(const argument_type& inst) const { + return hash()(inst.id()); + } +}; + +} // namespace std + +#endif // SOURCE_VAL_INSTRUCTION_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate.cpp new file mode 100644 index 00000000000..84ec193a1e6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate.cpp @@ -0,0 +1,429 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/validate.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "source/spirv_endian.h" +#include "source/spirv_target_env.h" +#include "source/spirv_validator_options.h" +#include "source/val/construct.h" +#include "source/val/function.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { +namespace { + +// TODO(umar): Validate header +// TODO(umar): The binary parser validates the magic word, and the length of the +// header, but nothing else. +spv_result_t setHeader(void* user_data, spv_endianness_t, uint32_t, + uint32_t version, uint32_t generator, uint32_t id_bound, + uint32_t) { + // Record the ID bound so that the validator can ensure no ID is out of bound. + ValidationState_t& _ = *(reinterpret_cast(user_data)); + _.setIdBound(id_bound); + _.setGenerator(generator); + _.setVersion(version); + + return SPV_SUCCESS; +} + +// Parses OpExtension instruction and registers extension. +void RegisterExtension(ValidationState_t& _, + const spv_parsed_instruction_t* inst) { + const std::string extension_str = spvtools::GetExtensionString(inst); + Extension extension; + if (!GetExtensionFromString(extension_str.c_str(), &extension)) { + // The error will be logged in the ProcessInstruction pass. + return; + } + + _.RegisterExtension(extension); +} + +// Parses the beginning of the module searching for OpExtension instructions. +// Registers extensions if recognized. Returns SPV_REQUESTED_TERMINATION +// once an instruction which is not SpvOpCapability and SpvOpExtension is +// encountered. According to the SPIR-V spec extensions are declared after +// capabilities and before everything else. +spv_result_t ProcessExtensions(void* user_data, + const spv_parsed_instruction_t* inst) { + const SpvOp opcode = static_cast(inst->opcode); + if (opcode == SpvOpCapability) return SPV_SUCCESS; + + if (opcode == SpvOpExtension) { + ValidationState_t& _ = *(reinterpret_cast(user_data)); + RegisterExtension(_, inst); + return SPV_SUCCESS; + } + + // OpExtension block is finished, requesting termination. + return SPV_REQUESTED_TERMINATION; +} + +spv_result_t ProcessInstruction(void* user_data, + const spv_parsed_instruction_t* inst) { + ValidationState_t& _ = *(reinterpret_cast(user_data)); + + auto* instruction = _.AddOrderedInstruction(inst); + _.RegisterDebugInstruction(instruction); + + return SPV_SUCCESS; +} + +void printDot(const ValidationState_t& _, const BasicBlock& other) { + std::string block_string; + if (other.successors()->empty()) { + block_string += "end "; + } else { + for (auto block : *other.successors()) { + block_string += _.getIdOrName(block->id()) + " "; + } + } + printf("%10s -> {%s\b}\n", _.getIdOrName(other.id()).c_str(), + block_string.c_str()); +} + +void PrintBlocks(ValidationState_t& _, Function func) { + assert(func.first_block()); + + printf("%10s -> %s\n", _.getIdOrName(func.id()).c_str(), + _.getIdOrName(func.first_block()->id()).c_str()); + for (const auto& block : func.ordered_blocks()) { + printDot(_, *block); + } +} + +#ifdef __clang__ +#define UNUSED(func) [[gnu::unused]] func +#elif defined(__GNUC__) +#define UNUSED(func) \ + func __attribute__((unused)); \ + func +#elif defined(_MSC_VER) +#define UNUSED(func) func +#endif + +UNUSED(void PrintDotGraph(ValidationState_t& _, Function func)) { + if (func.first_block()) { + std::string func_name(_.getIdOrName(func.id())); + printf("digraph %s {\n", func_name.c_str()); + PrintBlocks(_, func); + printf("}\n"); + } +} + +spv_result_t ValidateForwardDecls(ValidationState_t& _) { + if (_.unresolved_forward_id_count() == 0) return SPV_SUCCESS; + + std::stringstream ss; + std::vector ids = _.UnresolvedForwardIds(); + + std::transform( + std::begin(ids), std::end(ids), + std::ostream_iterator(ss, " "), + bind(&ValidationState_t::getIdName, std::ref(_), std::placeholders::_1)); + + auto id_str = ss.str(); + return _.diag(SPV_ERROR_INVALID_ID, nullptr) + << "The following forward referenced IDs have not been defined:\n" + << id_str.substr(0, id_str.size() - 1); +} + +// Entry point validation. Based on 2.16.1 (Universal Validation Rules) of the +// SPIRV spec: +// * There is at least one OpEntryPoint instruction, unless the Linkage +// capability is being used. +// * No function can be targeted by both an OpEntryPoint instruction and an +// OpFunctionCall instruction. +spv_result_t ValidateEntryPoints(ValidationState_t& _) { + _.ComputeFunctionToEntryPointMapping(); + + if (_.entry_points().empty() && !_.HasCapability(SpvCapabilityLinkage)) { + return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) + << "No OpEntryPoint instruction was found. This is only allowed if " + "the Linkage capability is being used."; + } + for (const auto& entry_point : _.entry_points()) { + if (_.IsFunctionCallTarget(entry_point)) { + return _.diag(SPV_ERROR_INVALID_BINARY, _.FindDef(entry_point)) + << "A function (" << entry_point + << ") may not be targeted by both an OpEntryPoint instruction and " + "an OpFunctionCall instruction."; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateBinaryUsingContextAndValidationState( + const spv_context_t& context, const uint32_t* words, const size_t num_words, + spv_diagnostic* pDiagnostic, ValidationState_t* vstate) { + auto binary = std::unique_ptr( + new spv_const_binary_t{words, num_words}); + + spv_endianness_t endian; + spv_position_t position = {}; + if (spvBinaryEndianness(binary.get(), &endian)) { + return DiagnosticStream(position, context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Invalid SPIR-V magic number."; + } + + spv_header_t header; + if (spvBinaryHeaderGet(binary.get(), endian, &header)) { + return DiagnosticStream(position, context.consumer, "", + SPV_ERROR_INVALID_BINARY) + << "Invalid SPIR-V header."; + } + + if (header.version > spvVersionForTargetEnv(context.target_env)) { + return DiagnosticStream(position, context.consumer, "", + SPV_ERROR_WRONG_VERSION) + << "Invalid SPIR-V binary version " + << SPV_SPIRV_VERSION_MAJOR_PART(header.version) << "." + << SPV_SPIRV_VERSION_MINOR_PART(header.version) + << " for target environment " + << spvTargetEnvDescription(context.target_env) << "."; + } + + // Look for OpExtension instructions and register extensions. + spvBinaryParse(&context, vstate, words, num_words, + /* parsed_header = */ nullptr, ProcessExtensions, + /* diagnostic = */ nullptr); + + // Parse the module and perform inline validation checks. These checks do + // not require the the knowledge of the whole module. + if (auto error = spvBinaryParse(&context, vstate, words, num_words, setHeader, + ProcessInstruction, pDiagnostic)) { + return error; + } + + for (auto& instruction : vstate->ordered_instructions()) { + { + // In order to do this work outside of Process Instruction we need to be + // able to, briefly, de-const the instruction. + Instruction* inst = const_cast(&instruction); + + if (inst->opcode() == SpvOpEntryPoint) { + const auto entry_point = inst->GetOperandAs(1); + const auto execution_model = inst->GetOperandAs(0); + const char* str = reinterpret_cast( + inst->words().data() + inst->operand(2).offset); + + ValidationState_t::EntryPointDescription desc; + desc.name = str; + + std::vector interfaces; + for (size_t j = 3; j < inst->operands().size(); ++j) + desc.interfaces.push_back(inst->word(inst->operand(j).offset)); + + vstate->RegisterEntryPoint(entry_point, execution_model, + std::move(desc)); + } + if (inst->opcode() == SpvOpFunctionCall) { + if (!vstate->in_function_body()) { + return vstate->diag(SPV_ERROR_INVALID_LAYOUT, &instruction) + << "A FunctionCall must happen within a function body."; + } + + vstate->AddFunctionCallTarget(inst->GetOperandAs(2)); + } + + if (vstate->in_function_body()) { + inst->set_function(&(vstate->current_function())); + inst->set_block(vstate->current_function().current_block()); + + if (vstate->in_block() && spvOpcodeIsBlockTerminator(inst->opcode())) { + vstate->current_function().current_block()->set_terminator(inst); + } + } + + if (auto error = IdPass(*vstate, inst)) return error; + } + + if (auto error = CapabilityPass(*vstate, &instruction)) return error; + if (auto error = DataRulesPass(*vstate, &instruction)) return error; + if (auto error = ModuleLayoutPass(*vstate, &instruction)) return error; + if (auto error = CfgPass(*vstate, &instruction)) return error; + if (auto error = InstructionPass(*vstate, &instruction)) return error; + + // Now that all of the checks are done, update the state. + { + Instruction* inst = const_cast(&instruction); + vstate->RegisterInstruction(inst); + } + if (auto error = UpdateIdUse(*vstate, &instruction)) return error; + } + + if (!vstate->has_memory_model_specified()) + return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) + << "Missing required OpMemoryModel instruction."; + + if (vstate->in_function_body()) + return vstate->diag(SPV_ERROR_INVALID_LAYOUT, nullptr) + << "Missing OpFunctionEnd at end of module."; + + // Catch undefined forward references before performing further checks. + if (auto error = ValidateForwardDecls(*vstate)) return error; + + // Validate individual opcodes. + for (size_t i = 0; i < vstate->ordered_instructions().size(); ++i) { + auto& instruction = vstate->ordered_instructions()[i]; + + // Keep these passes in the order they appear in the SPIR-V specification + // sections to maintain test consistency. + // Miscellaneous + if (auto error = DebugPass(*vstate, &instruction)) return error; + if (auto error = AnnotationPass(*vstate, &instruction)) return error; + if (auto error = ExtInstPass(*vstate, &instruction)) return error; + if (auto error = ModeSettingPass(*vstate, &instruction)) return error; + if (auto error = TypePass(*vstate, &instruction)) return error; + if (auto error = ConstantPass(*vstate, &instruction)) return error; + if (auto error = ValidateMemoryInstructions(*vstate, &instruction)) + return error; + if (auto error = FunctionPass(*vstate, &instruction)) return error; + if (auto error = ImagePass(*vstate, &instruction)) return error; + if (auto error = ConversionPass(*vstate, &instruction)) return error; + if (auto error = CompositesPass(*vstate, &instruction)) return error; + if (auto error = ArithmeticsPass(*vstate, &instruction)) return error; + if (auto error = BitwisePass(*vstate, &instruction)) return error; + if (auto error = LogicalsPass(*vstate, &instruction)) return error; + if (auto error = ControlFlowPass(*vstate, &instruction)) return error; + if (auto error = DerivativesPass(*vstate, &instruction)) return error; + if (auto error = AtomicsPass(*vstate, &instruction)) return error; + if (auto error = PrimitivesPass(*vstate, &instruction)) return error; + if (auto error = BarriersPass(*vstate, &instruction)) return error; + // Group + // Device-Side Enqueue + // Pipe + if (auto error = NonUniformPass(*vstate, &instruction)) return error; + + if (auto error = LiteralsPass(*vstate, &instruction)) return error; + // Validate the preconditions involving adjacent instructions. e.g. SpvOpPhi + // must only be preceeded by SpvOpLabel, SpvOpPhi, or SpvOpLine. + if (auto error = ValidateAdjacency(*vstate, i)) return error; + } + + if (auto error = ValidateEntryPoints(*vstate)) return error; + // CFG checks are performed after the binary has been parsed + // and the CFGPass has collected information about the control flow + if (auto error = PerformCfgChecks(*vstate)) return error; + if (auto error = CheckIdDefinitionDominateUse(*vstate)) return error; + if (auto error = ValidateDecorations(*vstate)) return error; + if (auto error = ValidateInterfaces(*vstate)) return error; + // TODO(dsinclair): Restructure ValidateBuiltins so we can move into the + // for() above as it loops over all ordered_instructions internally. + if (auto error = ValidateBuiltIns(*vstate)) return error; + // These checks must be performed after individual opcode checks because + // those checks register the limitation checked here. + for (const auto inst : vstate->ordered_instructions()) { + if (auto error = ValidateExecutionLimitations(*vstate, &inst)) return error; + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ValidateBinaryAndKeepValidationState( + const spv_const_context context, spv_const_validator_options options, + const uint32_t* words, const size_t num_words, spv_diagnostic* pDiagnostic, + std::unique_ptr* vstate) { + spv_context_t hijack_context = *context; + if (pDiagnostic) { + *pDiagnostic = nullptr; + UseDiagnosticAsMessageConsumer(&hijack_context, pDiagnostic); + } + + vstate->reset( + new ValidationState_t(&hijack_context, options, words, num_words)); + + return ValidateBinaryUsingContextAndValidationState( + hijack_context, words, num_words, pDiagnostic, vstate->get()); +} + +} // namespace val +} // namespace spvtools + +spv_result_t spvValidate(const spv_const_context context, + const spv_const_binary binary, + spv_diagnostic* pDiagnostic) { + return spvValidateBinary(context, binary->code, binary->wordCount, + pDiagnostic); +} + +spv_result_t spvValidateBinary(const spv_const_context context, + const uint32_t* words, const size_t num_words, + spv_diagnostic* pDiagnostic) { + spv_context_t hijack_context = *context; + if (pDiagnostic) { + *pDiagnostic = nullptr; + spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, pDiagnostic); + } + + // This interface is used for default command line options. + spv_validator_options default_options = spvValidatorOptionsCreate(); + + // Create the ValidationState using the context and default options. + spvtools::val::ValidationState_t vstate(&hijack_context, default_options, + words, num_words); + + spv_result_t result = + spvtools::val::ValidateBinaryUsingContextAndValidationState( + hijack_context, words, num_words, pDiagnostic, &vstate); + + spvValidatorOptionsDestroy(default_options); + return result; +} + +spv_result_t spvValidateWithOptions(const spv_const_context context, + spv_const_validator_options options, + const spv_const_binary binary, + spv_diagnostic* pDiagnostic) { + spv_context_t hijack_context = *context; + if (pDiagnostic) { + *pDiagnostic = nullptr; + spvtools::UseDiagnosticAsMessageConsumer(&hijack_context, pDiagnostic); + } + + // Create the ValidationState using the context. + spvtools::val::ValidationState_t vstate(&hijack_context, options, + binary->code, binary->wordCount); + + return spvtools::val::ValidateBinaryUsingContextAndValidationState( + hijack_context, binary->code, binary->wordCount, pDiagnostic, &vstate); +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate.h new file mode 100644 index 00000000000..4599c4a8604 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate.h @@ -0,0 +1,234 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_VAL_VALIDATE_H_ +#define SOURCE_VAL_VALIDATE_H_ + +#include +#include +#include +#include + +#include "source/instruction.h" +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { + +class ValidationState_t; +class BasicBlock; +class Instruction; + +/// A function that returns a vector of BasicBlocks given a BasicBlock. Used to +/// get the successor and predecessor nodes of a CFG block +using get_blocks_func = + std::function*(const BasicBlock*)>; + +/// @brief Performs the Control Flow Graph checks +/// +/// @param[in] _ the validation state of the module +/// +/// @return SPV_SUCCESS if no errors are found. SPV_ERROR_INVALID_CFG otherwise +spv_result_t PerformCfgChecks(ValidationState_t& _); + +/// @brief Updates the use vectors of all instructions that can be referenced +/// +/// This function will update the vector which define where an instruction was +/// referenced in the binary. +/// +/// @param[in] _ the validation state of the module +/// +/// @return SPV_SUCCESS if no errors are found. +spv_result_t UpdateIdUse(ValidationState_t& _, const Instruction* inst); + +/// @brief This function checks all ID definitions dominate their use in the +/// CFG. +/// +/// This function will iterate over all ID definitions that are defined in the +/// functions of a module and make sure that the definitions appear in a +/// block that dominates their use. +/// +/// @param[in] _ the validation state of the module +/// +/// @return SPV_SUCCESS if no errors are found. SPV_ERROR_INVALID_ID otherwise +spv_result_t CheckIdDefinitionDominateUse(const ValidationState_t& _); + +/// @brief This function checks for preconditions involving the adjacent +/// instructions. +/// +/// This function will iterate over all instructions and check for any required +/// predecessor and/or successor instructions. e.g. SpvOpPhi must only be +/// preceeded by SpvOpLabel, SpvOpPhi, or SpvOpLine. +/// +/// @param[in] _ the validation state of the module +/// +/// @return SPV_SUCCESS if no errors are found. SPV_ERROR_INVALID_DATA otherwise +spv_result_t ValidateAdjacency(ValidationState_t& _, size_t idx); + +/// @brief Validates static uses of input and output variables +/// +/// Checks that any entry point that uses a input or output variable lists that +/// variable in its interface. +/// +/// @param[in] _ the validation state of the module +/// +/// @return SPV_SUCCESS if no errors are found. +spv_result_t ValidateInterfaces(ValidationState_t& _); + +/// @brief Validates memory instructions +/// +/// @param[in] _ the validation state of the module +/// @return SPV_SUCCESS if no errors are found. +spv_result_t ValidateMemoryInstructions(ValidationState_t& _, + const Instruction* inst); + +/// @brief Updates the immediate dominator for each of the block edges +/// +/// Updates the immediate dominator of the blocks for each of the edges +/// provided by the @p dom_edges parameter +/// +/// @param[in,out] dom_edges The edges of the dominator tree +/// @param[in] set_func This function will be called to updated the Immediate +/// dominator +void UpdateImmediateDominators( + const std::vector>& dom_edges, + std::function set_func); + +/// @brief Prints all of the dominators of a BasicBlock +/// +/// @param[in] block The dominators of this block will be printed +void printDominatorList(BasicBlock& block); + +/// Performs logical layout validation as described in section 2.4 of the SPIR-V +/// spec. +spv_result_t ModuleLayoutPass(ValidationState_t& _, const Instruction* inst); + +/// Performs Control Flow Graph validation and construction. +spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst); + +/// Validates Control Flow Graph instructions. +spv_result_t ControlFlowPass(ValidationState_t& _, const Instruction* inst); + +/// Performs Id and SSA validation of a module +spv_result_t IdPass(ValidationState_t& _, Instruction* inst); + +/// Performs validation of the Data Rules subsection of 2.16.1 Universal +/// Validation Rules. +/// TODO(ehsann): add more comments here as more validation code is added. +spv_result_t DataRulesPass(ValidationState_t& _, const Instruction* inst); + +/// Performs instruction validation. +spv_result_t InstructionPass(ValidationState_t& _, const Instruction* inst); + +/// Performs decoration validation. +spv_result_t ValidateDecorations(ValidationState_t& _); + +/// Performs validation of built-in variables. +spv_result_t ValidateBuiltIns(const ValidationState_t& _); + +/// Validates type instructions. +spv_result_t TypePass(ValidationState_t& _, const Instruction* inst); + +/// Validates constant instructions. +spv_result_t ConstantPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of arithmetic instructions. +spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of composite instructions. +spv_result_t CompositesPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of conversion instructions. +spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of derivative instructions. +spv_result_t DerivativesPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of logical instructions. +spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of bitwise instructions. +spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of image instructions. +spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of atomic instructions. +spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of barrier instructions. +spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of literal numbers. +spv_result_t LiteralsPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of ExtInst instructions. +spv_result_t ExtInstPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of annotation instructions. +spv_result_t AnnotationPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of non-uniform group instructions. +spv_result_t NonUniformPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of debug instructions. +spv_result_t DebugPass(ValidationState_t& _, const Instruction* inst); + +// Validates that capability declarations use operands allowed in the current +// context. +spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of primitive instructions. +spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of mode setting instructions. +spv_result_t ModeSettingPass(ValidationState_t& _, const Instruction* inst); + +/// Validates correctness of function instructions. +spv_result_t FunctionPass(ValidationState_t& _, const Instruction* inst); + +/// Validates execution limitations. +/// +/// Verifies execution models are allowed for all functionality they contain. +spv_result_t ValidateExecutionLimitations(ValidationState_t& _, + const Instruction* inst); + +/// @brief Validate the ID's within a SPIR-V binary +/// +/// @param[in] pInstructions array of instructions +/// @param[in] count number of elements in instruction array +/// @param[in] bound the binary header +/// @param[in,out] position current word in the binary +/// @param[in] consumer message consumer callback +/// +/// @return result code +spv_result_t spvValidateIDs(const spv_instruction_t* pInstructions, + const uint64_t count, const uint32_t bound, + spv_position position, + const MessageConsumer& consumer); + +// Performs validation for the SPIRV-V module binary. +// The main difference between this API and spvValidateBinary is that the +// "Validation State" is not destroyed upon function return; it lives on and is +// pointed to by the vstate unique_ptr. +spv_result_t ValidateBinaryAndKeepValidationState( + const spv_const_context context, spv_const_validator_options options, + const uint32_t* words, const size_t num_words, spv_diagnostic* pDiagnostic, + std::unique_ptr* vstate); + +} // namespace val +} // namespace spvtools + +#endif // SOURCE_VAL_VALIDATE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp new file mode 100644 index 00000000000..5ef56be9913 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_adjacency.cpp @@ -0,0 +1,86 @@ +// Copyright (c) 2018 LunarG 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. + +// Validates correctness of the intra-block preconditions of SPIR-V +// instructions. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +spv_result_t ValidateAdjacency(ValidationState_t& _, size_t idx) { + const auto& instructions = _.ordered_instructions(); + const auto& inst = instructions[idx]; + + switch (inst.opcode()) { + case SpvOpPhi: + if (idx > 0) { + switch (instructions[idx - 1].opcode()) { + case SpvOpLabel: + case SpvOpPhi: + case SpvOpLine: + break; + default: + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "OpPhi must appear before all non-OpPhi instructions " + << "(except for OpLine, which can be mixed with OpPhi)."; + } + } + break; + case SpvOpLoopMerge: + if (idx != (instructions.size() - 1)) { + switch (instructions[idx + 1].opcode()) { + case SpvOpBranch: + case SpvOpBranchConditional: + break; + default: + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "OpLoopMerge must immediately precede either an " + << "OpBranch or OpBranchConditional instruction. " + << "OpLoopMerge must be the second-to-last instruction in " + << "its block."; + } + } + break; + case SpvOpSelectionMerge: + if (idx != (instructions.size() - 1)) { + switch (instructions[idx + 1].opcode()) { + case SpvOpBranchConditional: + case SpvOpSwitch: + break; + default: + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "OpSelectionMerge must immediately precede either an " + << "OpBranchConditional or OpSwitch instruction. " + << "OpSelectionMerge must be the second-to-last " + << "instruction in its block."; + } + } + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp new file mode 100644 index 00000000000..f1758391d85 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_annotation.cpp @@ -0,0 +1,158 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { + const auto decoration = inst->GetOperandAs(1); + if (decoration == SpvDecorationSpecId) { + const auto target_id = inst->GetOperandAs(0); + const auto target = _.FindDef(target_id); + if (!target || !spvOpcodeIsScalarSpecConstant(target->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpDecorate SpecId decoration target '" + << _.getIdName(decoration) + << "' is not a scalar specialization constant."; + } + } + // TODO: Add validations for all decorations. + return SPV_SUCCESS; +} + +spv_result_t ValidateMemberDecorate(ValidationState_t& _, + const Instruction* inst) { + const auto struct_type_id = inst->GetOperandAs(0); + const auto struct_type = _.FindDef(struct_type_id); + if (!struct_type || SpvOpTypeStruct != struct_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberDecorate Structure type '" + << _.getIdName(struct_type_id) << "' is not a struct type."; + } + const auto member = inst->GetOperandAs(1); + const auto member_count = + static_cast(struct_type->words().size() - 2); + if (member_count < member) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Index " << member + << " provided in OpMemberDecorate for struct " + << _.getIdName(struct_type_id) + << " is out of bounds. The structure has " << member_count + << " members. Largest valid index is " << member_count - 1 << "."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateDecorationGroup(ValidationState_t& _, + const Instruction* inst) { + const auto decoration_group_id = inst->GetOperandAs(0); + const auto decoration_group = _.FindDef(decoration_group_id); + for (auto pair : decoration_group->uses()) { + auto use = pair.first; + if (use->opcode() != SpvOpDecorate && use->opcode() != SpvOpGroupDecorate && + use->opcode() != SpvOpGroupMemberDecorate && + use->opcode() != SpvOpName) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Result id of OpDecorationGroup can only " + << "be targeted by OpName, OpGroupDecorate, " + << "OpDecorate, and OpGroupMemberDecorate"; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupDecorate(ValidationState_t& _, + const Instruction* inst) { + const auto decoration_group_id = inst->GetOperandAs(0); + auto decoration_group = _.FindDef(decoration_group_id); + if (!decoration_group || SpvOpDecorationGroup != decoration_group->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpGroupDecorate Decoration group '" + << _.getIdName(decoration_group_id) + << "' is not a decoration group."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateGroupMemberDecorate(ValidationState_t& _, + const Instruction* inst) { + const auto decoration_group_id = inst->GetOperandAs(0); + const auto decoration_group = _.FindDef(decoration_group_id); + if (!decoration_group || SpvOpDecorationGroup != decoration_group->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpGroupMemberDecorate Decoration group '" + << _.getIdName(decoration_group_id) + << "' is not a decoration group."; + } + // Grammar checks ensures that the number of arguments to this instruction + // is an odd number: 1 decoration group + (id,literal) pairs. + for (size_t i = 1; i + 1 < inst->operands().size(); i += 2) { + const uint32_t struct_id = inst->GetOperandAs(i); + const uint32_t index = inst->GetOperandAs(i + 1); + auto struct_instr = _.FindDef(struct_id); + if (!struct_instr || SpvOpTypeStruct != struct_instr->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpGroupMemberDecorate Structure type '" + << _.getIdName(struct_id) << "' is not a struct type."; + } + const uint32_t num_struct_members = + static_cast(struct_instr->words().size() - 2); + if (index >= num_struct_members) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Index " << index + << " provided in OpGroupMemberDecorate for struct " + << _.getIdName(struct_id) + << " is out of bounds. The structure has " << num_struct_members + << " members. Largest valid index is " << num_struct_members - 1 + << "."; + } + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t AnnotationPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpDecorate: + if (auto error = ValidateDecorate(_, inst)) return error; + break; + case SpvOpMemberDecorate: + if (auto error = ValidateMemberDecorate(_, inst)) return error; + break; + case SpvOpDecorationGroup: + if (auto error = ValidateDecorationGroup(_, inst)) return error; + break; + case SpvOpGroupDecorate: + if (auto error = ValidateGroupDecorate(_, inst)) return error; + break; + case SpvOpGroupMemberDecorate: + if (auto error = ValidateGroupMemberDecorate(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp new file mode 100644 index 00000000000..2314e7dfcb9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_arithmetics.cpp @@ -0,0 +1,453 @@ +// Copyright (c) 2017 Google 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. + +// Performs validation of arithmetic instructions. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates correctness of arithmetic instructions. +spv_result_t ArithmeticsPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + switch (opcode) { + case SpvOpFAdd: + case SpvOpFSub: + case SpvOpFMul: + case SpvOpFDiv: + case SpvOpFRem: + case SpvOpFMod: + case SpvOpFNegate: { + if (!_.IsFloatScalarType(result_type) && + !_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected floating scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + for (size_t operand_index = 2; operand_index < inst->operands().size(); + ++operand_index) { + if (_.GetOperandTypeId(inst, operand_index) != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to be of Result Type: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + } + break; + } + + case SpvOpUDiv: + case SpvOpUMod: { + if (!_.IsUnsignedIntScalarType(result_type) && + !_.IsUnsignedIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected unsigned int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + for (size_t operand_index = 2; operand_index < inst->operands().size(); + ++operand_index) { + if (_.GetOperandTypeId(inst, operand_index) != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to be of Result Type: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + } + break; + } + + case SpvOpISub: + case SpvOpIAdd: + case SpvOpIMul: + case SpvOpSDiv: + case SpvOpSMod: + case SpvOpSRem: + case SpvOpSNegate: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t dimension = _.GetDimension(result_type); + const uint32_t bit_width = _.GetBitWidth(result_type); + + for (size_t operand_index = 2; operand_index < inst->operands().size(); + ++operand_index) { + const uint32_t type_id = _.GetOperandTypeId(inst, operand_index); + if (!type_id || + (!_.IsIntScalarType(type_id) && !_.IsIntVectorType(type_id))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as operand: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + + if (_.GetDimension(type_id) != dimension) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to have the same dimension " + << "as Result Type: " << spvOpcodeString(opcode) + << " operand index " << operand_index; + + if (_.GetBitWidth(type_id) != bit_width) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected arithmetic operands to have the same bit width " + << "as Result Type: " << spvOpcodeString(opcode) + << " operand index " << operand_index; + } + break; + } + + case SpvOpDot: { + if (!_.IsFloatScalarType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float scalar type as Result Type: " + << spvOpcodeString(opcode); + + uint32_t first_vector_num_components = 0; + + for (size_t operand_index = 2; operand_index < inst->operands().size(); + ++operand_index) { + const uint32_t type_id = _.GetOperandTypeId(inst, operand_index); + + if (!type_id || !_.IsFloatVectorType(type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector as operand: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + + const uint32_t component_type = _.GetComponentType(type_id); + if (component_type != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component type to be equal to Result Type: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + + const uint32_t num_components = _.GetDimension(type_id); + if (operand_index == 2) { + first_vector_num_components = num_components; + } else if (num_components != first_vector_num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operands to have the same number of componenets: " + << spvOpcodeString(opcode); + } + } + break; + } + + case SpvOpVectorTimesScalar: { + if (!_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t vector_type_id = _.GetOperandTypeId(inst, 2); + if (result_type != vector_type_id) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected vector operand type to be equal to Result Type: " + << spvOpcodeString(opcode); + + const uint32_t component_type = _.GetComponentType(vector_type_id); + + const uint32_t scalar_type_id = _.GetOperandTypeId(inst, 3); + if (component_type != scalar_type_id) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected scalar operand type to be equal to the component " + << "type of the vector operand: " << spvOpcodeString(opcode); + + break; + } + + case SpvOpMatrixTimesScalar: { + if (!_.IsFloatMatrixType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t matrix_type_id = _.GetOperandTypeId(inst, 2); + if (result_type != matrix_type_id) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected matrix operand type to be equal to Result Type: " + << spvOpcodeString(opcode); + + const uint32_t component_type = _.GetComponentType(matrix_type_id); + + const uint32_t scalar_type_id = _.GetOperandTypeId(inst, 3); + if (component_type != scalar_type_id) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected scalar operand type to be equal to the component " + << "type of the matrix operand: " << spvOpcodeString(opcode); + + break; + } + + case SpvOpVectorTimesMatrix: { + const uint32_t vector_type_id = _.GetOperandTypeId(inst, 2); + const uint32_t matrix_type_id = _.GetOperandTypeId(inst, 3); + + if (!_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t res_component_type = _.GetComponentType(result_type); + + if (!vector_type_id || !_.IsFloatVectorType(vector_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector type as left operand: " + << spvOpcodeString(opcode); + + if (res_component_type != _.GetComponentType(vector_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component types of Result Type and vector to be " + << "equal: " << spvOpcodeString(opcode); + + uint32_t matrix_num_rows = 0; + uint32_t matrix_num_cols = 0; + uint32_t matrix_col_type = 0; + uint32_t matrix_component_type = 0; + if (!_.GetMatrixTypeInfo(matrix_type_id, &matrix_num_rows, + &matrix_num_cols, &matrix_col_type, + &matrix_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as right operand: " + << spvOpcodeString(opcode); + + if (res_component_type != matrix_component_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component types of Result Type and matrix to be " + << "equal: " << spvOpcodeString(opcode); + + if (matrix_num_cols != _.GetDimension(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of columns of the matrix to be equal to " + << "Result Type vector size: " << spvOpcodeString(opcode); + + if (matrix_num_rows != _.GetDimension(vector_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of rows of the matrix to be equal to the " + << "vector operand size: " << spvOpcodeString(opcode); + + break; + } + + case SpvOpMatrixTimesVector: { + const uint32_t matrix_type_id = _.GetOperandTypeId(inst, 2); + const uint32_t vector_type_id = _.GetOperandTypeId(inst, 3); + + if (!_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector type as Result Type: " + << spvOpcodeString(opcode); + + uint32_t matrix_num_rows = 0; + uint32_t matrix_num_cols = 0; + uint32_t matrix_col_type = 0; + uint32_t matrix_component_type = 0; + if (!_.GetMatrixTypeInfo(matrix_type_id, &matrix_num_rows, + &matrix_num_cols, &matrix_col_type, + &matrix_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as left operand: " + << spvOpcodeString(opcode); + + if (result_type != matrix_col_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected column type of the matrix to be equal to Result " + "Type: " + << spvOpcodeString(opcode); + + if (!vector_type_id || !_.IsFloatVectorType(vector_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector type as right operand: " + << spvOpcodeString(opcode); + + if (matrix_component_type != _.GetComponentType(vector_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component types of the operands to be equal: " + << spvOpcodeString(opcode); + + if (matrix_num_cols != _.GetDimension(vector_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of columns of the matrix to be equal to the " + << "vector size: " << spvOpcodeString(opcode); + + break; + } + + case SpvOpMatrixTimesMatrix: { + const uint32_t left_type_id = _.GetOperandTypeId(inst, 2); + const uint32_t right_type_id = _.GetOperandTypeId(inst, 3); + + uint32_t res_num_rows = 0; + uint32_t res_num_cols = 0; + uint32_t res_col_type = 0; + uint32_t res_component_type = 0; + if (!_.GetMatrixTypeInfo(result_type, &res_num_rows, &res_num_cols, + &res_col_type, &res_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as Result Type: " + << spvOpcodeString(opcode); + + uint32_t left_num_rows = 0; + uint32_t left_num_cols = 0; + uint32_t left_col_type = 0; + uint32_t left_component_type = 0; + if (!_.GetMatrixTypeInfo(left_type_id, &left_num_rows, &left_num_cols, + &left_col_type, &left_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as left operand: " + << spvOpcodeString(opcode); + + uint32_t right_num_rows = 0; + uint32_t right_num_cols = 0; + uint32_t right_col_type = 0; + uint32_t right_component_type = 0; + if (!_.GetMatrixTypeInfo(right_type_id, &right_num_rows, &right_num_cols, + &right_col_type, &right_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as right operand: " + << spvOpcodeString(opcode); + + if (!_.IsFloatScalarType(res_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as Result Type: " + << spvOpcodeString(opcode); + + if (res_col_type != left_col_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected column types of Result Type and left matrix to be " + << "equal: " << spvOpcodeString(opcode); + + if (res_component_type != right_component_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component types of Result Type and right matrix to " + "be " + << "equal: " << spvOpcodeString(opcode); + + if (res_num_cols != right_num_cols) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of columns of Result Type and right matrix " + "to " + << "be equal: " << spvOpcodeString(opcode); + + if (left_num_cols != right_num_rows) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of columns of left matrix and number of " + "rows " + << "of right matrix to be equal: " << spvOpcodeString(opcode); + + assert(left_num_rows == res_num_rows); + break; + } + + case SpvOpOuterProduct: { + const uint32_t left_type_id = _.GetOperandTypeId(inst, 2); + const uint32_t right_type_id = _.GetOperandTypeId(inst, 3); + + uint32_t res_num_rows = 0; + uint32_t res_num_cols = 0; + uint32_t res_col_type = 0; + uint32_t res_component_type = 0; + if (!_.GetMatrixTypeInfo(result_type, &res_num_rows, &res_num_cols, + &res_col_type, &res_component_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float matrix type as Result Type: " + << spvOpcodeString(opcode); + + if (left_type_id != res_col_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected column type of Result Type to be equal to the type " + << "of the left operand: " << spvOpcodeString(opcode); + + if (!right_type_id || !_.IsFloatVectorType(right_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float vector type as right operand: " + << spvOpcodeString(opcode); + + if (res_component_type != _.GetComponentType(right_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component types of the operands to be equal: " + << spvOpcodeString(opcode); + + if (res_num_cols != _.GetDimension(right_type_id)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of columns of the matrix to be equal to the " + << "vector size of the right operand: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpIAddCarry: + case SpvOpISubBorrow: + case SpvOpUMulExtended: + case SpvOpSMulExtended: { + std::vector result_types; + if (!_.GetStructMemberTypes(result_type, &result_types)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected a struct as Result Type: " + << spvOpcodeString(opcode); + + if (result_types.size() != 2) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type struct to have two members: " + << spvOpcodeString(opcode); + + if (opcode == SpvOpSMulExtended) { + if (!_.IsIntScalarType(result_types[0]) && + !_.IsIntVectorType(result_types[0])) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type struct member types to be integer " + "scalar " + << "or vector: " << spvOpcodeString(opcode); + } else { + if (!_.IsUnsignedIntScalarType(result_types[0]) && + !_.IsUnsignedIntVectorType(result_types[0])) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type struct member types to be unsigned " + << "integer scalar or vector: " << spvOpcodeString(opcode); + } + + if (result_types[0] != result_types[1]) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type struct member types to be identical: " + << spvOpcodeString(opcode); + + const uint32_t left_type_id = _.GetOperandTypeId(inst, 2); + const uint32_t right_type_id = _.GetOperandTypeId(inst, 3); + + if (left_type_id != result_types[0] || right_type_id != result_types[0]) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected both operands to be of Result Type member type: " + << spvOpcodeString(opcode); + + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp new file mode 100644 index 00000000000..becb87200c5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_atomics.cpp @@ -0,0 +1,319 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of atomic SPIR-V instructions. + +#include "source/val/validate.h" + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/spirv_target_env.h" +#include "source/util/bitutils.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates Memory Scope operand. +spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, + uint32_t id) { + const SpvOp opcode = inst->opcode(); + bool is_int32 = false, is_const_int32 = false; + uint32_t value = 0; + std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); + + if (!is_int32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) << ": expected Scope to be 32-bit int"; + } + + if (!is_const_int32) { + return SPV_SUCCESS; + } + +#if 0 + // TODO(atgoo@github.com): this check fails Vulkan CTS, reenable once fixed. + if (spvIsVulkanEnv(_.context()->target_env)) { + if (value != SpvScopeDevice && value != SpvScopeWorkgroup && + value != SpvScopeInvocation) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": in Vulkan environment memory scope is limited to Device, " + "Workgroup and Invocation"; + } + } +#endif + + // TODO(atgoo@github.com) Add checks for OpenCL and OpenGL environments. + + return SPV_SUCCESS; +} + +// Validates a Memory Semantics operand. +spv_result_t ValidateMemorySemantics(ValidationState_t& _, + const Instruction* inst, + uint32_t operand_index) { + const SpvOp opcode = inst->opcode(); + bool is_int32 = false, is_const_int32 = false; + uint32_t flags = 0; + auto memory_semantics_id = inst->GetOperandAs(operand_index); + std::tie(is_int32, is_const_int32, flags) = + _.EvalInt32IfConst(memory_semantics_id); + + if (!is_int32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Memory Semantics to be 32-bit int"; + } + + if (!is_const_int32) { + return SPV_SUCCESS; + } + + if (spvtools::utils::CountSetBits( + flags & + (SpvMemorySemanticsAcquireMask | SpvMemorySemanticsReleaseMask | + SpvMemorySemanticsAcquireReleaseMask | + SpvMemorySemanticsSequentiallyConsistentMask)) > 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": no more than one of the following Memory Semantics bits can " + "be set at the same time: Acquire, Release, AcquireRelease or " + "SequentiallyConsistent"; + } + + if (flags & SpvMemorySemanticsUniformMemoryMask && + !_.HasCapability(SpvCapabilityShader)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics UniformMemory requires capability Shader"; + } + + if (flags & SpvMemorySemanticsAtomicCounterMemoryMask && + !_.HasCapability(SpvCapabilityAtomicStorage)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics UniformMemory requires capability " + "AtomicStorage"; + } + + if (opcode == SpvOpAtomicFlagClear && + (flags & SpvMemorySemanticsAcquireMask || + flags & SpvMemorySemanticsAcquireReleaseMask)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Memory Semantics Acquire and AcquireRelease cannot be used with " + << spvOpcodeString(opcode); + } + + if (opcode == SpvOpAtomicCompareExchange && operand_index == 5 && + (flags & SpvMemorySemanticsReleaseMask || + flags & SpvMemorySemanticsAcquireReleaseMask)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics Release and AcquireRelease cannot be used " + "for operand Unequal"; + } + + if (spvIsVulkanEnv(_.context()->target_env)) { + if (opcode == SpvOpAtomicLoad && + (flags & SpvMemorySemanticsReleaseMask || + flags & SpvMemorySemanticsAcquireReleaseMask || + flags & SpvMemorySemanticsSequentiallyConsistentMask)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Vulkan spec disallows OpAtomicLoad with Memory Semantics " + "Release, AcquireRelease and SequentiallyConsistent"; + } + + if (opcode == SpvOpAtomicStore && + (flags & SpvMemorySemanticsAcquireMask || + flags & SpvMemorySemanticsAcquireReleaseMask || + flags & SpvMemorySemanticsSequentiallyConsistentMask)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Vulkan spec disallows OpAtomicStore with Memory Semantics " + "Acquire, AcquireRelease and SequentiallyConsistent"; + } + } + + // TODO(atgoo@github.com) Add checks for OpenCL and OpenGL environments. + + return SPV_SUCCESS; +} + +// Validates correctness of atomic instructions. +spv_result_t AtomicsPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + 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: { + if (_.HasCapability(SpvCapabilityKernel) && + (opcode == SpvOpAtomicLoad || opcode == SpvOpAtomicExchange || + opcode == SpvOpAtomicCompareExchange)) { + if (!_.IsFloatScalarType(result_type) && + !_.IsIntScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Result Type to be int or float scalar type"; + } + } else if (opcode == SpvOpAtomicFlagTestAndSet) { + if (!_.IsBoolScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Result Type to be bool scalar type"; + } + } else if (opcode == SpvOpAtomicFlagClear || opcode == SpvOpAtomicStore) { + assert(result_type == 0); + } else { + if (!_.IsIntScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Result Type to be int scalar type"; + } + if (spvIsVulkanEnv(_.context()->target_env) && + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": according to the Vulkan spec atomic Result Type needs " + "to be a 32-bit int scalar type"; + } + } + + uint32_t operand_index = + opcode == SpvOpAtomicFlagClear || opcode == SpvOpAtomicStore ? 0 : 2; + const uint32_t pointer_type = _.GetOperandTypeId(inst, operand_index++); + + uint32_t data_type = 0; + uint32_t storage_class = 0; + if (!_.GetPointerTypeInfo(pointer_type, &data_type, &storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Pointer to be of type OpTypePointer"; + } + + switch (storage_class) { + case SpvStorageClassUniform: + case SpvStorageClassWorkgroup: + case SpvStorageClassCrossWorkgroup: + case SpvStorageClassGeneric: + case SpvStorageClassAtomicCounter: + case SpvStorageClassImage: + case SpvStorageClassStorageBuffer: + break; + default: + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Pointer Storage Class to be Uniform, " + "Workgroup, CrossWorkgroup, Generic, AtomicCounter, Image " + "or StorageBuffer"; + } + + if (opcode == SpvOpAtomicFlagTestAndSet || + opcode == SpvOpAtomicFlagClear) { + if (!_.IsIntScalarType(data_type) || _.GetBitWidth(data_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Pointer to point to a value of 32-bit int type"; + } + } else if (opcode == SpvOpAtomicStore) { + if (!_.IsFloatScalarType(data_type) && !_.IsIntScalarType(data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Pointer to be a pointer to int or float " + << "scalar type"; + } + } else { + if (data_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Pointer to point to a value of type Result " + "Type"; + } + } + + auto memory_scope = inst->GetOperandAs(operand_index++); + if (auto error = ValidateMemoryScope(_, inst, memory_scope)) { + return error; + } + + if (auto error = ValidateMemorySemantics(_, inst, operand_index++)) + return error; + + if (opcode == SpvOpAtomicCompareExchange || + opcode == SpvOpAtomicCompareExchangeWeak) { + if (auto error = ValidateMemorySemantics(_, inst, operand_index++)) + return error; + } + + if (opcode == SpvOpAtomicStore) { + const uint32_t value_type = _.GetOperandTypeId(inst, 3); + if (value_type != data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Value type and the type pointed to by Pointer " + "to" + << " be the same"; + } + } else if (opcode != SpvOpAtomicLoad && opcode != SpvOpAtomicIIncrement && + opcode != SpvOpAtomicIDecrement && + opcode != SpvOpAtomicFlagTestAndSet && + opcode != SpvOpAtomicFlagClear) { + const uint32_t value_type = _.GetOperandTypeId(inst, operand_index++); + if (value_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Value to be of type Result Type"; + } + } + + if (opcode == SpvOpAtomicCompareExchange || + opcode == SpvOpAtomicCompareExchangeWeak) { + const uint32_t comparator_type = + _.GetOperandTypeId(inst, operand_index++); + if (comparator_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Comparator to be of type Result Type"; + } + } + + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp new file mode 100644 index 00000000000..0771f2d28a1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_barriers.cpp @@ -0,0 +1,300 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Validates correctness of barrier SPIR-V instructions. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/spirv_constant.h" +#include "source/spirv_target_env.h" +#include "source/util/bitutils.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Validates Execution Scope operand. +spv_result_t ValidateExecutionScope(ValidationState_t& _, + const Instruction* inst, uint32_t id) { + const SpvOp opcode = inst->opcode(); + bool is_int32 = false, is_const_int32 = false; + uint32_t value = 0; + std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); + + if (!is_int32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Execution Scope to be a 32-bit int"; + } + + if (!is_const_int32) { + return SPV_SUCCESS; + } + + if (spvIsVulkanEnv(_.context()->target_env)) { + if (value != SpvScopeWorkgroup && value != SpvScopeSubgroup) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": in Vulkan environment Execution Scope is limited to " + "Workgroup and Subgroup"; + } + + if (_.context()->target_env != SPV_ENV_VULKAN_1_0 && + value != SpvScopeSubgroup) { + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation([](SpvExecutionModel model, + std::string* message) { + if (model == SpvExecutionModelFragment || + model == SpvExecutionModelVertex || + model == SpvExecutionModelGeometry || + model == SpvExecutionModelTessellationEvaluation) { + if (message) { + *message = + "in Vulkan evironment, OpControlBarrier execution scope " + "must be Subgroup for Fragment, Vertex, Geometry and " + "TessellationEvaluation execution models"; + } + return false; + } + return true; + }); + } + } + + // TODO(atgoo@github.com) Add checks for OpenCL and OpenGL environments. + + return SPV_SUCCESS; +} + +// Validates Memory Scope operand. +spv_result_t ValidateMemoryScope(ValidationState_t& _, const Instruction* inst, + uint32_t id) { + const SpvOp opcode = inst->opcode(); + bool is_int32 = false, is_const_int32 = false; + uint32_t value = 0; + std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); + + if (!is_int32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Memory Scope to be a 32-bit int"; + } + + if (!is_const_int32) { + return SPV_SUCCESS; + } + + if (spvIsVulkanEnv(_.context()->target_env)) { + if (value == SpvScopeCrossDevice) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": in Vulkan environment, Memory Scope cannot be CrossDevice"; + } + if (_.context()->target_env == SPV_ENV_VULKAN_1_0 && + value != SpvScopeDevice && value != SpvScopeWorkgroup && + value != SpvScopeInvocation) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": in Vulkan 1.0 environment Memory Scope is limited to " + "Device, " + "Workgroup and Invocation"; + } + } + + // TODO(atgoo@github.com) Add checks for OpenCL and OpenGL environments. + + return SPV_SUCCESS; +} + +// Validates Memory Semantics operand. +spv_result_t ValidateMemorySemantics(ValidationState_t& _, + const Instruction* inst, uint32_t id) { + const SpvOp opcode = inst->opcode(); + bool is_int32 = false, is_const_int32 = false; + uint32_t value = 0; + std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(id); + + if (!is_int32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Memory Semantics to be a 32-bit int"; + } + + if (!is_const_int32) { + return SPV_SUCCESS; + } + + const size_t num_memory_order_set_bits = spvtools::utils::CountSetBits( + value & (SpvMemorySemanticsAcquireMask | SpvMemorySemanticsReleaseMask | + SpvMemorySemanticsAcquireReleaseMask | + SpvMemorySemanticsSequentiallyConsistentMask)); + + if (num_memory_order_set_bits > 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Memory Semantics can have at most one of the following bits " + "set: Acquire, Release, AcquireRelease or SequentiallyConsistent"; + } + + if (spvIsVulkanEnv(_.context()->target_env)) { + const bool includes_storage_class = + value & (SpvMemorySemanticsUniformMemoryMask | + SpvMemorySemanticsWorkgroupMemoryMask | + SpvMemorySemanticsImageMemoryMask); + + if (opcode == SpvOpMemoryBarrier && !num_memory_order_set_bits) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Vulkan specification requires Memory Semantics to have one " + "of the following bits set: Acquire, Release, AcquireRelease " + "or SequentiallyConsistent"; + } + + if (opcode == SpvOpMemoryBarrier && !includes_storage_class) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Memory Semantics to include a Vulkan-supported " + "storage class"; + } + +#if 0 + // TODO(atgoo@github.com): this check fails Vulkan CTS, reenable once fixed. + if (opcode == SpvOpControlBarrier && value && !includes_storage_class) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Memory Semantics to include a Vulkan-supported " + "storage class if Memory Semantics is not None"; + } +#endif + } + + // TODO(atgoo@github.com) Add checks for OpenCL and OpenGL environments. + + return SPV_SUCCESS; +} + +} // namespace + +// Validates correctness of barrier instructions. +spv_result_t BarriersPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + switch (opcode) { + case SpvOpControlBarrier: { + if (spvVersionForTargetEnv(_.context()->target_env) < + SPV_SPIRV_VERSION_WORD(1, 3)) { + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + [](SpvExecutionModel model, std::string* message) { + if (model != SpvExecutionModelTessellationControl && + model != SpvExecutionModelGLCompute && + model != SpvExecutionModelKernel) { + if (message) { + *message = + "OpControlBarrier requires one of the following " + "Execution " + "Models: TessellationControl, GLCompute or Kernel"; + } + return false; + } + return true; + }); + } + + const uint32_t execution_scope = inst->word(1); + const uint32_t memory_scope = inst->word(2); + const uint32_t memory_semantics = inst->word(3); + + if (auto error = ValidateExecutionScope(_, inst, execution_scope)) { + return error; + } + + if (auto error = ValidateMemoryScope(_, inst, memory_scope)) { + return error; + } + + if (auto error = ValidateMemorySemantics(_, inst, memory_semantics)) { + return error; + } + break; + } + + case SpvOpMemoryBarrier: { + const uint32_t memory_scope = inst->word(1); + const uint32_t memory_semantics = inst->word(2); + + if (auto error = ValidateMemoryScope(_, inst, memory_scope)) { + return error; + } + + if (auto error = ValidateMemorySemantics(_, inst, memory_semantics)) { + return error; + } + break; + } + + case SpvOpNamedBarrierInitialize: { + if (_.GetIdOpcode(result_type) != SpvOpTypeNamedBarrier) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Result Type to be OpTypeNamedBarrier"; + } + + const uint32_t subgroup_count_type = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(subgroup_count_type) || + _.GetBitWidth(subgroup_count_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Subgroup Count to be a 32-bit int"; + } + break; + } + + case SpvOpMemoryNamedBarrier: { + const uint32_t named_barrier_type = _.GetOperandTypeId(inst, 0); + if (_.GetIdOpcode(named_barrier_type) != SpvOpTypeNamedBarrier) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Named Barrier to be of type OpTypeNamedBarrier"; + } + + const uint32_t memory_scope = inst->word(2); + const uint32_t memory_semantics = inst->word(3); + + if (auto error = ValidateMemoryScope(_, inst, memory_scope)) { + return error; + } + + if (auto error = ValidateMemorySemantics(_, inst, memory_semantics)) { + return error; + } + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp new file mode 100644 index 00000000000..d46b3fcabb3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_bitwise.cpp @@ -0,0 +1,219 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of bitwise instructions. + +#include "source/val/validate.h" + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates correctness of bitwise instructions. +spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + switch (opcode) { + case SpvOpShiftRightLogical: + case SpvOpShiftRightArithmetic: + case SpvOpShiftLeftLogical: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t result_dimension = _.GetDimension(result_type); + const uint32_t base_type = _.GetOperandTypeId(inst, 2); + const uint32_t shift_type = _.GetOperandTypeId(inst, 3); + + if (!base_type || + (!_.IsIntScalarType(base_type) && !_.IsIntVectorType(base_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base to be int scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(base_type) != result_dimension) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base to have the same dimension " + << "as Result Type: " << spvOpcodeString(opcode); + + if (_.GetBitWidth(base_type) != _.GetBitWidth(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base to have the same bit width " + << "as Result Type: " << spvOpcodeString(opcode); + + if (!shift_type || + (!_.IsIntScalarType(shift_type) && !_.IsIntVectorType(shift_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Shift to be int scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(shift_type) != result_dimension) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Shift to have the same dimension " + << "as Result Type: " << spvOpcodeString(opcode); + break; + } + + case SpvOpBitwiseOr: + case SpvOpBitwiseXor: + case SpvOpBitwiseAnd: + case SpvOpNot: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t result_dimension = _.GetDimension(result_type); + const uint32_t result_bit_width = _.GetBitWidth(result_type); + + for (size_t operand_index = 2; operand_index < inst->operands().size(); + ++operand_index) { + const uint32_t type_id = _.GetOperandTypeId(inst, operand_index); + if (!type_id || + (!_.IsIntScalarType(type_id) && !_.IsIntVectorType(type_id))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector as operand: " + << spvOpcodeString(opcode) << " operand index " + << operand_index; + + if (_.GetDimension(type_id) != result_dimension) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operands to have the same dimension " + << "as Result Type: " << spvOpcodeString(opcode) + << " operand index " << operand_index; + + if (_.GetBitWidth(type_id) != result_bit_width) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operands to have the same bit width " + << "as Result Type: " << spvOpcodeString(opcode) + << " operand index " << operand_index; + } + break; + } + + case SpvOpBitFieldInsert: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t base_type = _.GetOperandTypeId(inst, 2); + const uint32_t insert_type = _.GetOperandTypeId(inst, 3); + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t count_type = _.GetOperandTypeId(inst, 5); + + if (base_type != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base Type to be equal to Result Type: " + << spvOpcodeString(opcode); + + if (insert_type != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Insert Type to be equal to Result Type: " + << spvOpcodeString(opcode); + + if (!offset_type || !_.IsIntScalarType(offset_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Offset Type to be int scalar: " + << spvOpcodeString(opcode); + + if (!count_type || !_.IsIntScalarType(count_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Count Type to be int scalar: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpBitFieldSExtract: + case SpvOpBitFieldUExtract: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t base_type = _.GetOperandTypeId(inst, 2); + const uint32_t offset_type = _.GetOperandTypeId(inst, 3); + const uint32_t count_type = _.GetOperandTypeId(inst, 4); + + if (base_type != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base Type to be equal to Result Type: " + << spvOpcodeString(opcode); + + if (!offset_type || !_.IsIntScalarType(offset_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Offset Type to be int scalar: " + << spvOpcodeString(opcode); + + if (!count_type || !_.IsIntScalarType(count_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Count Type to be int scalar: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpBitReverse: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t base_type = _.GetOperandTypeId(inst, 2); + + if (base_type != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base Type to be equal to Result Type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpBitCount: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t base_type = _.GetOperandTypeId(inst, 2); + if (!base_type || + (!_.IsIntScalarType(base_type) && !_.IsIntVectorType(base_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base Type to be int scalar or vector: " + << spvOpcodeString(opcode); + + const uint32_t base_dimension = _.GetDimension(base_type); + const uint32_t result_dimension = _.GetDimension(result_type); + + if (base_dimension != result_dimension) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Base dimension to be equal to Result Type " + "dimension: " + << spvOpcodeString(opcode); + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp new file mode 100644 index 00000000000..c791e428fb0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_builtins.cpp @@ -0,0 +1,2574 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Validates correctness of built-in variables. + +#include "source/val/validate.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/spirv_target_env.h" +#include "source/util/bitutils.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Returns a short textual description of the id defined by the given +// instruction. +std::string GetIdDesc(const Instruction& inst) { + std::ostringstream ss; + ss << "ID <" << inst.id() << "> (Op" << spvOpcodeString(inst.opcode()) << ")"; + return ss.str(); +} + +// Gets underlying data type which is +// - member type if instruction is OpTypeStruct +// (member index is taken from decoration). +// - data type if id creates a pointer. +// - type of the constant if instruction is OpConst or OpSpecConst. +// +// Fails in any other case. The function is based on built-ins allowed by +// the Vulkan spec. +// TODO: If non-Vulkan validation rules are added then it might need +// to be refactored. +spv_result_t GetUnderlyingType(const ValidationState_t& _, + const Decoration& decoration, + const Instruction& inst, + uint32_t* underlying_type) { + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + assert(inst.opcode() == SpvOpTypeStruct); + *underlying_type = inst.word(decoration.struct_member_index() + 2); + return SPV_SUCCESS; + } + + assert(inst.opcode() != SpvOpTypeStruct); + + if (spvOpcodeIsConstant(inst.opcode())) { + *underlying_type = inst.type_id(); + return SPV_SUCCESS; + } + + uint32_t storage_class = 0; + if (!_.GetPointerTypeInfo(inst.type_id(), underlying_type, &storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << GetIdDesc(inst) + << " is decorated with BuiltIn. BuiltIn decoration should only be " + "applied to struct types, variables and constants."; + } + return SPV_SUCCESS; +} + +// Returns Storage Class used by the instruction if applicable. +// Returns SpvStorageClassMax if not. +SpvStorageClass GetStorageClass(const Instruction& inst) { + switch (inst.opcode()) { + case SpvOpTypePointer: + case SpvOpTypeForwardPointer: { + return SpvStorageClass(inst.word(2)); + } + case SpvOpVariable: { + return SpvStorageClass(inst.word(3)); + } + case SpvOpGenericCastToPtrExplicit: { + return SpvStorageClass(inst.word(4)); + } + default: { break; } + } + return SpvStorageClassMax; +} + +// Helper class managing validation of built-ins. +// TODO: Generic functionality of this class can be moved into +// ValidationState_t to be made available to other users. +class BuiltInsValidator { + public: + BuiltInsValidator(const ValidationState_t& vstate) : _(vstate) {} + + // Run validation. + spv_result_t Run(); + + private: + // Goes through all decorations in the module, if decoration is BuiltIn + // calls ValidateSingleBuiltInAtDefinition(). + spv_result_t ValidateBuiltInsAtDefinition(); + + // Validates the instruction defining an id with built-in decoration. + // Can be called multiple times for the same id, if multiple built-ins are + // specified. Seeds id_to_at_reference_checks_ with decorated ids if needed. + spv_result_t ValidateSingleBuiltInAtDefinition(const Decoration& decoration, + const Instruction& inst); + + // The following section contains functions which are called when id defined + // by |inst| is decorated with BuiltIn |decoration|. + // Most functions are specific to a single built-in and have naming scheme: + // ValidateXYZAtDefinition. Some functions are common to multiple kinds of + // BuiltIn. + spv_result_t ValidateClipOrCullDistanceAtDefinition( + const Decoration& decoration, const Instruction& inst); + spv_result_t ValidateFragCoordAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateFragDepthAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateFrontFacingAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateHelperInvocationAtDefinition( + const Decoration& decoration, const Instruction& inst); + spv_result_t ValidateInvocationIdAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateInstanceIndexAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateLayerOrViewportIndexAtDefinition( + const Decoration& decoration, const Instruction& inst); + spv_result_t ValidatePatchVerticesAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidatePointCoordAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidatePointSizeAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidatePositionAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidatePrimitiveIdAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateSampleIdAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateSampleMaskAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateSamplePositionAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateTessCoordAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateTessLevelOuterAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateTessLevelInnerAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateVertexIndexAtDefinition(const Decoration& decoration, + const Instruction& inst); + spv_result_t ValidateWorkgroupSizeAtDefinition(const Decoration& decoration, + const Instruction& inst); + // Used for GlobalInvocationId, LocalInvocationId, NumWorkgroups, WorkgroupId. + spv_result_t ValidateComputeShaderI32Vec3InputAtDefinition( + const Decoration& decoration, const Instruction& inst); + + // The following section contains functions which are called when id defined + // by |referenced_inst| is + // 1. referenced by |referenced_from_inst| + // 2. dependent on |built_in_inst| which is decorated with BuiltIn + // |decoration|. Most functions are specific to a single built-in and have + // naming scheme: ValidateXYZAtReference. Some functions are common to + // multiple kinds of BuiltIn. + spv_result_t ValidateFragCoordAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateFragDepthAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateFrontFacingAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateHelperInvocationAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateInvocationIdAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateInstanceIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidatePatchVerticesAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidatePointCoordAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidatePointSizeAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidatePositionAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidatePrimitiveIdAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateSampleIdAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateSampleMaskAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateSamplePositionAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateTessCoordAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateTessLevelAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateVertexIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateLayerOrViewportIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateWorkgroupSizeAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + spv_result_t ValidateClipOrCullDistanceAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + // Used for GlobalInvocationId, LocalInvocationId, NumWorkgroups, WorkgroupId. + spv_result_t ValidateComputeShaderI32Vec3InputAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + // Validates that |built_in_inst| is not (even indirectly) referenced from + // within a function which can be called with |execution_model|. + // + // |comment| - text explaining why the restriction was imposed. + // |decoration| - BuiltIn decoration which causes the restriction. + // |referenced_inst| - instruction which is dependent on |built_in_inst| and + // defines the id which was referenced. + // |referenced_from_inst| - instruction which references id defined by + // |referenced_inst| from within a function. + spv_result_t ValidateNotCalledWithExecutionModel( + const char* comment, SpvExecutionModel execution_model, + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + + // The following section contains functions which check that the decorated + // variable has the type specified in the function name. |diag| would be + // called with a corresponding error message, if validation is not successful. + spv_result_t ValidateBool( + const Decoration& decoration, const Instruction& inst, + const std::function& diag); + spv_result_t ValidateI32( + const Decoration& decoration, const Instruction& inst, + const std::function& diag); + spv_result_t ValidateI32Vec( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag); + spv_result_t ValidateI32Arr( + const Decoration& decoration, const Instruction& inst, + const std::function& diag); + spv_result_t ValidateF32( + const Decoration& decoration, const Instruction& inst, + const std::function& diag); + spv_result_t ValidateOptionalArrayedF32( + const Decoration& decoration, const Instruction& inst, + const std::function& diag); + spv_result_t ValidateF32Helper( + const Decoration& decoration, const Instruction& inst, + const std::function& diag, + uint32_t underlying_type); + spv_result_t ValidateF32Vec( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag); + spv_result_t ValidateOptionalArrayedF32Vec( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag); + spv_result_t ValidateF32VecHelper( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag, + uint32_t underlying_type); + // If |num_components| is zero, the number of components is not checked. + spv_result_t ValidateF32Arr( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag); + spv_result_t ValidateOptionalArrayedF32Arr( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag); + spv_result_t ValidateF32ArrHelper( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag, + uint32_t underlying_type); + + // Generates strings like "Member #0 of struct ID <2>". + std::string GetDefinitionDesc(const Decoration& decoration, + const Instruction& inst) const; + + // Generates strings like "ID <51> (OpTypePointer) is referencing ID <2> + // (OpTypeStruct) which is decorated with BuiltIn Position". + std::string GetReferenceDesc( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst, + SpvExecutionModel execution_model = SpvExecutionModelMax) const; + + // Generates strings like "ID <51> (OpTypePointer) uses storage class + // UniformConstant". + std::string GetStorageClassDesc(const Instruction& inst) const; + + // Updates inner working of the class. Is called sequentially for every + // instruction. + void Update(const Instruction& inst); + + const ValidationState_t& _; + + // Mapping id -> list of rules which validate instruction referencing the + // id. Rules can create new rules and add them to this container. + // Using std::map, and not std::unordered_map to avoid iterator invalidation + // during rehashing. + std::map>> + id_to_at_reference_checks_; + + // Id of the function we are currently inside. 0 if not inside a function. + uint32_t function_id_ = 0; + + // Entry points which can (indirectly) call the current function. + // The pointer either points to a vector inside to function_to_entry_points_ + // or to no_entry_points_. The pointer is guaranteed to never be null. + const std::vector no_entry_points; + const std::vector* entry_points_ = &no_entry_points; + + // Execution models with which the current function can be called. + std::set execution_models_; +}; + +void BuiltInsValidator::Update(const Instruction& inst) { + const SpvOp opcode = inst.opcode(); + if (opcode == SpvOpFunction) { + // Entering a function. + assert(function_id_ == 0); + function_id_ = inst.id(); + execution_models_.clear(); + entry_points_ = &_.FunctionEntryPoints(function_id_); + // Collect execution models from all entry points from which the current + // function can be called. + for (const uint32_t entry_point : *entry_points_) { + if (const auto* models = _.GetExecutionModels(entry_point)) { + execution_models_.insert(models->begin(), models->end()); + } + } + } + + if (opcode == SpvOpFunctionEnd) { + // Exiting a function. + assert(function_id_ != 0); + function_id_ = 0; + entry_points_ = &no_entry_points; + execution_models_.clear(); + } +} + +std::string BuiltInsValidator::GetDefinitionDesc( + const Decoration& decoration, const Instruction& inst) const { + std::ostringstream ss; + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + assert(inst.opcode() == SpvOpTypeStruct); + ss << "Member #" << decoration.struct_member_index(); + ss << " of struct ID <" << inst.id() << ">"; + } else { + ss << GetIdDesc(inst); + } + return ss.str(); +} + +std::string BuiltInsValidator::GetReferenceDesc( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, const Instruction& referenced_from_inst, + SpvExecutionModel execution_model) const { + std::ostringstream ss; + ss << GetIdDesc(referenced_from_inst) << " is referencing " + << GetIdDesc(referenced_inst); + if (built_in_inst.id() != referenced_inst.id()) { + ss << " which is dependent on " << GetIdDesc(built_in_inst); + } + + ss << " which is decorated with BuiltIn "; + ss << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]); + if (function_id_) { + ss << " in function <" << function_id_ << ">"; + if (execution_model != SpvExecutionModelMax) { + ss << " called with execution model "; + ss << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_EXECUTION_MODEL, + execution_model); + } + } + ss << "."; + return ss.str(); +} + +std::string BuiltInsValidator::GetStorageClassDesc( + const Instruction& inst) const { + std::ostringstream ss; + ss << GetIdDesc(inst) << " uses storage class "; + ss << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_STORAGE_CLASS, + GetStorageClass(inst)); + ss << "."; + return ss.str(); +} + +spv_result_t BuiltInsValidator::ValidateBool( + const Decoration& decoration, const Instruction& inst, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + if (!_.IsBoolScalarType(underlying_type)) { + return diag(GetDefinitionDesc(decoration, inst) + " is not a bool scalar."); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateI32( + const Decoration& decoration, const Instruction& inst, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + if (!_.IsIntScalarType(underlying_type)) { + return diag(GetDefinitionDesc(decoration, inst) + " is not an int scalar."); + } + + const uint32_t bit_width = _.GetBitWidth(underlying_type); + if (bit_width != 32) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) << " has bit width " << bit_width + << "."; + return diag(ss.str()); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateOptionalArrayedF32( + const Decoration& decoration, const Instruction& inst, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + // Strip the array, if present. + if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + underlying_type = _.FindDef(underlying_type)->word(2u); + } + + return ValidateF32Helper(decoration, inst, diag, underlying_type); +} + +spv_result_t BuiltInsValidator::ValidateF32( + const Decoration& decoration, const Instruction& inst, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + return ValidateF32Helper(decoration, inst, diag, underlying_type); +} + +spv_result_t BuiltInsValidator::ValidateF32Helper( + const Decoration& decoration, const Instruction& inst, + const std::function& diag, + uint32_t underlying_type) { + if (!_.IsFloatScalarType(underlying_type)) { + return diag(GetDefinitionDesc(decoration, inst) + + " is not a float scalar."); + } + + const uint32_t bit_width = _.GetBitWidth(underlying_type); + if (bit_width != 32) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) << " has bit width " << bit_width + << "."; + return diag(ss.str()); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateI32Vec( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + if (!_.IsIntVectorType(underlying_type)) { + return diag(GetDefinitionDesc(decoration, inst) + " is not an int vector."); + } + + const uint32_t actual_num_components = _.GetDimension(underlying_type); + if (_.GetDimension(underlying_type) != num_components) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) << " has " + << actual_num_components << " components."; + return diag(ss.str()); + } + + const uint32_t bit_width = _.GetBitWidth(underlying_type); + if (bit_width != 32) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) + << " has components with bit width " << bit_width << "."; + return diag(ss.str()); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateOptionalArrayedF32Vec( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + // Strip the array, if present. + if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + underlying_type = _.FindDef(underlying_type)->word(2u); + } + + return ValidateF32VecHelper(decoration, inst, num_components, diag, + underlying_type); +} + +spv_result_t BuiltInsValidator::ValidateF32Vec( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + return ValidateF32VecHelper(decoration, inst, num_components, diag, + underlying_type); +} + +spv_result_t BuiltInsValidator::ValidateF32VecHelper( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag, + uint32_t underlying_type) { + if (!_.IsFloatVectorType(underlying_type)) { + return diag(GetDefinitionDesc(decoration, inst) + + " is not a float vector."); + } + + const uint32_t actual_num_components = _.GetDimension(underlying_type); + if (_.GetDimension(underlying_type) != num_components) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) << " has " + << actual_num_components << " components."; + return diag(ss.str()); + } + + const uint32_t bit_width = _.GetBitWidth(underlying_type); + if (bit_width != 32) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) + << " has components with bit width " << bit_width << "."; + return diag(ss.str()); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateI32Arr( + const Decoration& decoration, const Instruction& inst, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + const Instruction* const type_inst = _.FindDef(underlying_type); + if (type_inst->opcode() != SpvOpTypeArray) { + return diag(GetDefinitionDesc(decoration, inst) + " is not an array."); + } + + const uint32_t component_type = type_inst->word(2); + if (!_.IsIntScalarType(component_type)) { + return diag(GetDefinitionDesc(decoration, inst) + + " components are not int scalar."); + } + + const uint32_t bit_width = _.GetBitWidth(component_type); + if (bit_width != 32) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) + << " has components with bit width " << bit_width << "."; + return diag(ss.str()); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateF32Arr( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + return ValidateF32ArrHelper(decoration, inst, num_components, diag, + underlying_type); +} + +spv_result_t BuiltInsValidator::ValidateOptionalArrayedF32Arr( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag) { + uint32_t underlying_type = 0; + if (spv_result_t error = + GetUnderlyingType(_, decoration, inst, &underlying_type)) { + return error; + } + + // Strip an extra layer of arraying if present. + if (_.GetIdOpcode(underlying_type) == SpvOpTypeArray) { + uint32_t subtype = _.FindDef(underlying_type)->word(2u); + if (_.GetIdOpcode(subtype) == SpvOpTypeArray) { + underlying_type = subtype; + } + } + + return ValidateF32ArrHelper(decoration, inst, num_components, diag, + underlying_type); +} + +spv_result_t BuiltInsValidator::ValidateF32ArrHelper( + const Decoration& decoration, const Instruction& inst, + uint32_t num_components, + const std::function& diag, + uint32_t underlying_type) { + const Instruction* const type_inst = _.FindDef(underlying_type); + if (type_inst->opcode() != SpvOpTypeArray) { + return diag(GetDefinitionDesc(decoration, inst) + " is not an array."); + } + + const uint32_t component_type = type_inst->word(2); + if (!_.IsFloatScalarType(component_type)) { + return diag(GetDefinitionDesc(decoration, inst) + + " components are not float scalar."); + } + + const uint32_t bit_width = _.GetBitWidth(component_type); + if (bit_width != 32) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) + << " has components with bit width " << bit_width << "."; + return diag(ss.str()); + } + + if (num_components != 0) { + uint64_t actual_num_components = 0; + if (!_.GetConstantValUint64(type_inst->word(3), &actual_num_components)) { + assert(0 && "Array type definition is corrupt"); + } + if (actual_num_components != num_components) { + std::ostringstream ss; + ss << GetDefinitionDesc(decoration, inst) << " has " + << actual_num_components << " components."; + return diag(ss.str()); + } + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateNotCalledWithExecutionModel( + const char* comment, SpvExecutionModel execution_model, + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (function_id_) { + if (execution_models_.count(execution_model)) { + const char* execution_model_str = _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_EXECUTION_MODEL, execution_model); + const char* built_in_str = _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]); + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << comment << " " << GetIdDesc(referenced_inst) << " depends on " + << GetIdDesc(built_in_inst) << " which is decorated with BuiltIn " + << built_in_str << "." + << " Id <" << referenced_inst.id() << "> is later referenced by " + << GetIdDesc(referenced_from_inst) << " in function <" + << function_id_ << "> which is called with execution model " + << execution_model_str << "."; + } + } else { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + comment, execution_model, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtDefinition( + const Decoration& decoration, const Instruction& inst) { + // Seed at reference checks with this built-in. + return ValidateClipOrCullDistanceAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be only used for variables with Input or Output storage " + "class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + if (storage_class == SpvStorageClassInput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be " + "used for variables with Input storage class if execution model is " + "Vertex.", + SpvExecutionModelVertex, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + if (storage_class == SpvStorageClassOutput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance to be " + "used for variables with Output storage class if execution model is " + "Fragment.", + SpvExecutionModelFragment, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + switch (execution_model) { + case SpvExecutionModelFragment: + case SpvExecutionModelVertex: { + if (spv_result_t error = ValidateF32Arr( + decoration, built_in_inst, /* Any number of components */ 0, + [this, &decoration, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " variable needs to be a 32-bit float array. " + << message; + })) { + return error; + } + break; + } + case SpvExecutionModelTessellationControl: + case SpvExecutionModelTessellationEvaluation: + case SpvExecutionModelGeometry: { + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + // The outer level of array is applied on the variable. + if (spv_result_t error = ValidateF32Arr( + decoration, built_in_inst, /* Any number of components */ 0, + [this, &decoration, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, + &referenced_from_inst) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " variable needs to be a 32-bit float array. " + << message; + })) { + return error; + } + } else { + if (spv_result_t error = ValidateOptionalArrayedF32Arr( + decoration, built_in_inst, /* Any number of components */ 0, + [this, &decoration, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, + &referenced_from_inst) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName( + SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " variable needs to be a 32-bit float array. " + << message; + })) { + return error; + } + } + break; + } + + default: { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be used only with Fragment, Vertex, " + "TessellationControl, TessellationEvaluation or Geometry " + "execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateClipOrCullDistanceAtReference, + this, decoration, built_in_inst, referenced_from_inst, + std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateFragCoordAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32Vec( + decoration, inst, 4, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn FragCoord " + "variable needs to be a 4-component 32-bit float " + "vector. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateFragCoordAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateFragCoordAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn FragCoord to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn FragCoord to be used only with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateFragCoordAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateFragDepthAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn FragDepth " + "variable needs to be a 32-bit float scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateFragDepthAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn FragDepth to be only used for " + "variables with Output storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn FragDepth to be used only with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + + for (const uint32_t entry_point : *entry_points_) { + // Every entry point from which this function is called needs to have + // Execution Mode DepthReplacing. + const auto* modes = _.GetExecutionModes(entry_point); + if (!modes || !modes->count(SpvExecutionModeDepthReplacing)) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec requires DepthReplacing execution mode to be " + "declared when using BuiltIn FragDepth. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateFragDepthAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateFrontFacingAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateBool( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn FrontFacing " + "variable needs to be a bool scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateFrontFacingAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateFrontFacingAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn FrontFacing to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn FrontFacing to be used only with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateFrontFacingAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateHelperInvocationAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateBool( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn HelperInvocation " + "variable needs to be a bool scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateHelperInvocationAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateHelperInvocationAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn HelperInvocation to be only used " + "for variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn HelperInvocation to be used only " + "with Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateHelperInvocationAtReference, this, + decoration, built_in_inst, referenced_from_inst, + std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateInvocationIdAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn InvocationId " + "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateInvocationIdAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateInvocationIdAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn InvocationId to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelTessellationControl && + execution_model != SpvExecutionModelGeometry) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn InvocationId to be used only " + "with TessellationControl or Geometry execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateInvocationIdAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateInstanceIndexAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn InstanceIndex " + "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateInstanceIndexAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateInstanceIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn InstanceIndex to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelVertex) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn InstanceIndex to be used only " + "with Vertex execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateInstanceIndexAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidatePatchVerticesAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn PatchVertices " + "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidatePatchVerticesAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidatePatchVerticesAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PatchVertices to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelTessellationControl && + execution_model != SpvExecutionModelTessellationEvaluation) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PatchVertices to be used only " + "with TessellationControl or TessellationEvaluation " + "execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePatchVerticesAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidatePointCoordAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32Vec( + decoration, inst, 2, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn PointCoord " + "variable needs to be a 2-component 32-bit float " + "vector. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidatePointCoordAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidatePointCoordAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PointCoord to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PointCoord to be used only with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePointCoordAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidatePointSizeAtDefinition( + const Decoration& decoration, const Instruction& inst) { + // Seed at reference checks with this built-in. + return ValidatePointSizeAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidatePointSizeAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PointSize to be only used for " + "variables with Input or Output storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + if (storage_class == SpvStorageClassInput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn PointSize to be used for " + "variables with Input storage class if execution model is Vertex.", + SpvExecutionModelVertex, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + switch (execution_model) { + case SpvExecutionModelVertex: { + if (spv_result_t error = ValidateF32( + decoration, built_in_inst, + [this, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "According to the Vulkan spec BuiltIn PointSize " + "variable needs to be a 32-bit float scalar. " + << message; + })) { + return error; + } + break; + } + case SpvExecutionModelTessellationControl: + case SpvExecutionModelTessellationEvaluation: + case SpvExecutionModelGeometry: { + // PointSize can be a per-vertex variable for tessellation control, + // tessellation evaluation and geometry shader stages. In such cases + // variables will have an array of 32-bit floats. + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + // The array is on the variable, so this must be a 32-bit float. + if (spv_result_t error = ValidateF32( + decoration, built_in_inst, + [this, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, + &referenced_from_inst) + << "According to the Vulkan spec BuiltIn " + "PointSize variable needs to be a 32-bit " + "float scalar. " + << message; + })) { + return error; + } + } else { + if (spv_result_t error = ValidateOptionalArrayedF32( + decoration, built_in_inst, + [this, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, + &referenced_from_inst) + << "According to the Vulkan spec BuiltIn " + "PointSize variable needs to be a 32-bit " + "float scalar. " + << message; + })) { + return error; + } + } + break; + } + + default: { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PointSize to be used only with " + "Vertex, TessellationControl, TessellationEvaluation or " + "Geometry execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePointSizeAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidatePositionAtDefinition( + const Decoration& decoration, const Instruction& inst) { + // Seed at reference checks with this built-in. + return ValidatePositionAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidatePositionAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn Position to be only used for " + "variables with Input or Output storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + if (storage_class == SpvStorageClassInput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn Position to be used for variables " + "with Input storage class if execution model is Vertex.", + SpvExecutionModelVertex, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + switch (execution_model) { + case SpvExecutionModelVertex: { + if (spv_result_t error = ValidateF32Vec( + decoration, built_in_inst, 4, + [this, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "According to the Vulkan spec BuiltIn Position " + "variable needs to be a 4-component 32-bit float " + "vector. " + << message; + })) { + return error; + } + break; + } + case SpvExecutionModelGeometry: + case SpvExecutionModelTessellationControl: + case SpvExecutionModelTessellationEvaluation: { + // Position can be a per-vertex variable for tessellation control, + // tessellation evaluation and geometry shader stages. In such cases + // variables will have an array of 4-component 32-bit float vectors. + if (decoration.struct_member_index() != Decoration::kInvalidMember) { + // The array is on the variable, so this must be a 4-component + // 32-bit float vector. + if (spv_result_t error = ValidateF32Vec( + decoration, built_in_inst, 4, + [this, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, + &referenced_from_inst) + << "According to the Vulkan spec BuiltIn Position " + "variable needs to be a 4-component 32-bit " + "float vector. " + << message; + })) { + return error; + } + } else { + if (spv_result_t error = ValidateOptionalArrayedF32Vec( + decoration, built_in_inst, 4, + [this, &referenced_from_inst]( + const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, + &referenced_from_inst) + << "According to the Vulkan spec BuiltIn Position " + "variable needs to be a 4-component 32-bit " + "float vector. " + << message; + })) { + return error; + } + } + break; + } + + default: { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn Position to be used only " + "with Vertex, TessellationControl, TessellationEvaluation" + " or Geometry execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePositionAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidatePrimitiveIdAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn PrimitiveId " + "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidatePrimitiveIdAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidatePrimitiveIdAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PrimitiveId to be only used for " + "variables with Input or Output storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + if (storage_class == SpvStorageClassOutput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " + "variables with Output storage class if execution model is " + "TessellationControl.", + SpvExecutionModelTessellationControl, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " + "variables with Output storage class if execution model is " + "TessellationEvaluation.", + SpvExecutionModelTessellationEvaluation, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn PrimitiveId to be used for " + "variables with Output storage class if execution model is " + "Fragment.", + SpvExecutionModelFragment, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + switch (execution_model) { + case SpvExecutionModelFragment: + case SpvExecutionModelTessellationControl: + case SpvExecutionModelTessellationEvaluation: + case SpvExecutionModelGeometry: { + // Ok. + break; + } + + default: { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn PrimitiveId to be used only " + "with Fragment, TessellationControl, " + "TessellationEvaluation or Geometry execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidatePrimitiveIdAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateSampleIdAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn SampleId " + "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateSampleIdAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateSampleIdAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn SampleId to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn SampleId to be used only with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateSampleIdAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateSampleMaskAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32Arr( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn SampleMask " + "variable needs to be a 32-bit int array. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateSampleMaskAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateSampleMaskAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn SampleMask to be only used for " + "variables with Input or Output storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn SampleMask to be used only " + "with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateSampleMaskAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateSamplePositionAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32Vec( + decoration, inst, 2, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn SamplePosition " + "variable needs to be a 2-component 32-bit float " + "vector. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateSamplePositionAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateSamplePositionAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn SamplePosition to be only used " + "for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelFragment) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn SamplePosition to be used only " + "with " + "Fragment execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateSamplePositionAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateTessCoordAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32Vec( + decoration, inst, 3, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn TessCoord " + "variable needs to be a 3-component 32-bit float " + "vector. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateTessCoordAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateTessCoordAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn TessCoord to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelTessellationEvaluation) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn TessCoord to be used only with " + "TessellationEvaluation execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateTessCoordAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateTessLevelOuterAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32Arr( + decoration, inst, 4, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn TessLevelOuter " + "variable needs to be a 4-component 32-bit float " + "array. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateTessLevelAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateTessLevelInnerAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateF32Arr( + decoration, inst, 2, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn TessLevelOuter " + "variable needs to be a 2-component 32-bit float " + "array. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateTessLevelAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateTessLevelAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be only used for variables with Input or Output storage " + "class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + if (storage_class == SpvStorageClassInput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " + "used " + "for variables with Input storage class if execution model is " + "TessellationControl.", + SpvExecutionModelTessellationControl, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + if (storage_class == SpvStorageClassOutput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " + "used " + "for variables with Output storage class if execution model is " + "TessellationEvaluation.", + SpvExecutionModelTessellationEvaluation, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + switch (execution_model) { + case SpvExecutionModelTessellationControl: + case SpvExecutionModelTessellationEvaluation: { + // Ok. + break; + } + + default: { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be used only with TessellationControl or " + "TessellationEvaluation execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateTessLevelAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateVertexIndexAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn VertexIndex " + "variable needs to be a 32-bit int scalar. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateVertexIndexAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn VertexIndex to be only used for " + "variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelVertex) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn VertexIndex to be used only " + "with " + "Vertex execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateVertexIndexAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &decoration, + &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << "variable needs to be a 32-bit int scalar. " << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateLayerOrViewportIndexAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be only used for variables with Input or Output storage " + "class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + if (storage_class == SpvStorageClassInput) { + assert(function_id_ == 0); + for (const auto em : + {SpvExecutionModelVertex, SpvExecutionModelTessellationEvaluation, + SpvExecutionModelGeometry}) { + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateNotCalledWithExecutionModel, + this, + "Vulkan spec doesn't allow BuiltIn Layer and " + "ViewportIndex to be " + "used for variables with Input storage class if " + "execution model is Vertex, TessellationEvaluation, or " + "Geometry.", + em, decoration, built_in_inst, referenced_from_inst, + std::placeholders::_1)); + } + } + + if (storage_class == SpvStorageClassOutput) { + assert(function_id_ == 0); + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateNotCalledWithExecutionModel, this, + "Vulkan spec doesn't allow BuiltIn Layer and " + "ViewportIndex to be " + "used for variables with Output storage class if " + "execution model is " + "Fragment.", + SpvExecutionModelFragment, decoration, built_in_inst, + referenced_from_inst, std::placeholders::_1)); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + switch (execution_model) { + case SpvExecutionModelGeometry: + case SpvExecutionModelFragment: { + // Ok. + break; + case SpvExecutionModelVertex: + case SpvExecutionModelTessellationEvaluation: + if (!_.HasCapability(SpvCapabilityShaderViewportIndexLayerEXT)) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Using BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " in Vertex or Tessellation execution model requires " + "the ShaderViewportIndexLayerEXT capability."; + } + break; + } + default: { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be used only with Vertex, TessellationEvaluation, " + "Geometry, or Fragment execution models. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateLayerOrViewportIndexAtReference, + this, decoration, built_in_inst, referenced_from_inst, + std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32Vec( + decoration, inst, 3, + [this, &decoration, + &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " variable needs to be a 3-component 32-bit int " + "vector. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateComputeShaderI32Vec3InputAtReference(decoration, inst, inst, + inst); +} + +spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be only used for variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelGLCompute) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be used only with GLCompute execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference, this, + decoration, built_in_inst, referenced_from_inst, + std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + if (!spvOpcodeIsConstant(inst.opcode())) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "Vulkan spec requires BuiltIn WorkgroupSize to be a " + "constant. " + << GetIdDesc(inst) << " is not a constant."; + } + + if (spv_result_t error = ValidateI32Vec( + decoration, inst, 3, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the Vulkan spec BuiltIn WorkgroupSize " + "variable " + "needs to be a 3-component 32-bit int vector. " + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateWorkgroupSizeAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanEnv(_.context()->target_env)) { + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelGLCompute) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "Vulkan spec allows BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]) + << " to be used only with GLCompute execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back(std::bind( + &BuiltInsValidator::ValidateWorkgroupSizeAtReference, this, decoration, + built_in_inst, referenced_from_inst, std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( + const Decoration& decoration, const Instruction& inst) { + const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]); + // If you are adding a new BuiltIn enum, please register it here. + // If the newly added enum has validation rules associated with it + // consider leaving a TODO and/or creating an issue. + switch (label) { + case SpvBuiltInClipDistance: + case SpvBuiltInCullDistance: { + return ValidateClipOrCullDistanceAtDefinition(decoration, inst); + } + case SpvBuiltInFragCoord: { + return ValidateFragCoordAtDefinition(decoration, inst); + } + case SpvBuiltInFragDepth: { + return ValidateFragDepthAtDefinition(decoration, inst); + } + case SpvBuiltInFrontFacing: { + return ValidateFrontFacingAtDefinition(decoration, inst); + } + case SpvBuiltInGlobalInvocationId: + case SpvBuiltInLocalInvocationId: + case SpvBuiltInNumWorkgroups: + case SpvBuiltInWorkgroupId: { + return ValidateComputeShaderI32Vec3InputAtDefinition(decoration, inst); + } + case SpvBuiltInHelperInvocation: { + return ValidateHelperInvocationAtDefinition(decoration, inst); + } + case SpvBuiltInInvocationId: { + return ValidateInvocationIdAtDefinition(decoration, inst); + } + case SpvBuiltInInstanceIndex: { + return ValidateInstanceIndexAtDefinition(decoration, inst); + } + case SpvBuiltInLayer: + case SpvBuiltInViewportIndex: { + return ValidateLayerOrViewportIndexAtDefinition(decoration, inst); + } + case SpvBuiltInPatchVertices: { + return ValidatePatchVerticesAtDefinition(decoration, inst); + } + case SpvBuiltInPointCoord: { + return ValidatePointCoordAtDefinition(decoration, inst); + } + case SpvBuiltInPointSize: { + return ValidatePointSizeAtDefinition(decoration, inst); + } + case SpvBuiltInPosition: { + return ValidatePositionAtDefinition(decoration, inst); + } + case SpvBuiltInPrimitiveId: { + return ValidatePrimitiveIdAtDefinition(decoration, inst); + } + case SpvBuiltInSampleId: { + return ValidateSampleIdAtDefinition(decoration, inst); + } + case SpvBuiltInSampleMask: { + return ValidateSampleMaskAtDefinition(decoration, inst); + } + case SpvBuiltInSamplePosition: { + return ValidateSamplePositionAtDefinition(decoration, inst); + } + case SpvBuiltInTessCoord: { + return ValidateTessCoordAtDefinition(decoration, inst); + } + case SpvBuiltInTessLevelOuter: { + return ValidateTessLevelOuterAtDefinition(decoration, inst); + } + case SpvBuiltInTessLevelInner: { + return ValidateTessLevelInnerAtDefinition(decoration, inst); + } + case SpvBuiltInVertexIndex: { + return ValidateVertexIndexAtDefinition(decoration, inst); + } + case SpvBuiltInWorkgroupSize: { + return ValidateWorkgroupSizeAtDefinition(decoration, inst); + } + case SpvBuiltInVertexId: + case SpvBuiltInInstanceId: + case SpvBuiltInLocalInvocationIndex: + case SpvBuiltInWorkDim: + case SpvBuiltInGlobalSize: + case SpvBuiltInEnqueuedWorkgroupSize: + case SpvBuiltInGlobalOffset: + case SpvBuiltInGlobalLinearId: + case SpvBuiltInSubgroupSize: + case SpvBuiltInSubgroupMaxSize: + case SpvBuiltInNumSubgroups: + case SpvBuiltInNumEnqueuedSubgroups: + case SpvBuiltInSubgroupId: + case SpvBuiltInSubgroupLocalInvocationId: + case SpvBuiltInSubgroupEqMaskKHR: + case SpvBuiltInSubgroupGeMaskKHR: + case SpvBuiltInSubgroupGtMaskKHR: + case SpvBuiltInSubgroupLeMaskKHR: + case SpvBuiltInSubgroupLtMaskKHR: + case SpvBuiltInBaseVertex: + case SpvBuiltInBaseInstance: + case SpvBuiltInDrawIndex: + case SpvBuiltInDeviceIndex: + case SpvBuiltInViewIndex: + case SpvBuiltInBaryCoordNoPerspAMD: + case SpvBuiltInBaryCoordNoPerspCentroidAMD: + case SpvBuiltInBaryCoordNoPerspSampleAMD: + case SpvBuiltInBaryCoordSmoothAMD: + case SpvBuiltInBaryCoordSmoothCentroidAMD: + case SpvBuiltInBaryCoordSmoothSampleAMD: + case SpvBuiltInBaryCoordPullModelAMD: + case SpvBuiltInFragStencilRefEXT: + case SpvBuiltInViewportMaskNV: + case SpvBuiltInSecondaryPositionNV: + case SpvBuiltInSecondaryViewportMaskNV: + case SpvBuiltInPositionPerViewNV: + case SpvBuiltInViewportMaskPerViewNV: + case SpvBuiltInFullyCoveredEXT: + case SpvBuiltInMax: { + // No validation rules (for the moment). + break; + } + } + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateBuiltInsAtDefinition() { + for (const auto& kv : _.id_decorations()) { + const uint32_t id = kv.first; + const auto& decorations = kv.second; + if (decorations.empty()) { + continue; + } + + const Instruction* inst = _.FindDef(id); + assert(inst); + + for (const auto& decoration : kv.second) { + if (decoration.dec_type() != SpvDecorationBuiltIn) { + continue; + } + + if (spv_result_t error = + ValidateSingleBuiltInAtDefinition(decoration, *inst)) { + return error; + } + } + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::Run() { + // First pass: validate all built-ins at definition and seed + // id_to_at_reference_checks_ with built-ins. + if (auto error = ValidateBuiltInsAtDefinition()) { + return error; + } + + if (id_to_at_reference_checks_.empty()) { + // No validation tasks were seeded. Nothing else to do. + return SPV_SUCCESS; + } + + // Second pass: validate every id reference in the module using + // rules in id_to_at_reference_checks_. + for (const Instruction& inst : _.ordered_instructions()) { + Update(inst); + + std::set already_checked; + + for (const auto& operand : inst.operands()) { + if (!spvIsIdType(operand.type)) { + // Not id. + continue; + } + + const uint32_t id = inst.word(operand.offset); + if (id == inst.id()) { + // No need to check result id. + continue; + } + + if (!already_checked.insert(id).second) { + // The instruction has already referenced this id. + continue; + } + + // Instruction references the id. Run all checks associated with the id + // on the instruction. id_to_at_reference_checks_ can be modified in the + // process, iterators are safe because it's a tree-based map. + const auto it = id_to_at_reference_checks_.find(id); + if (it != id_to_at_reference_checks_.end()) { + for (const auto& check : it->second) { + if (spv_result_t error = check(inst)) { + return error; + } + } + } + } + } + + return SPV_SUCCESS; +} + +} // namespace + +// Validates correctness of built-in variables. +spv_result_t ValidateBuiltIns(const ValidationState_t& _) { + if (!spvIsVulkanEnv(_.context()->target_env)) { + // Early return. All currently implemented rules are based on Vulkan spec. + // + // TODO: If you are adding validation rules for environments other than + // Vulkan (or general rules which are not environment independent), then you + // need to modify or remove this condition. Consider also adding early + // returns into BuiltIn-specific rules, so that the system doesn't spawn new + // rules which don't do anything. + return SPV_SUCCESS; + } + + BuiltInsValidator validator(_); + return validator.Run(); +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp new file mode 100644 index 00000000000..4724b9f79df --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_capability.cpp @@ -0,0 +1,309 @@ +// Copyright (c) 2017 Google 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. + +// Validates OpCapability instruction. + +#include "source/val/validate.h" + +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +bool IsSupportGuaranteedVulkan_1_0(uint32_t capability) { + switch (capability) { + case SpvCapabilityMatrix: + case SpvCapabilityShader: + case SpvCapabilityInputAttachment: + case SpvCapabilitySampled1D: + case SpvCapabilityImage1D: + case SpvCapabilitySampledBuffer: + case SpvCapabilityImageBuffer: + case SpvCapabilityImageQuery: + case SpvCapabilityDerivativeControl: + return true; + } + return false; +} + +bool IsSupportGuaranteedVulkan_1_1(uint32_t capability) { + if (IsSupportGuaranteedVulkan_1_0(capability)) return true; + switch (capability) { + case SpvCapabilityDeviceGroup: + case SpvCapabilityMultiView: + return true; + } + return false; +} + +bool IsSupportOptionalVulkan_1_0(uint32_t capability) { + switch (capability) { + case SpvCapabilityGeometry: + case SpvCapabilityTessellation: + case SpvCapabilityFloat64: + case SpvCapabilityInt64: + case SpvCapabilityInt16: + case SpvCapabilityTessellationPointSize: + case SpvCapabilityGeometryPointSize: + case SpvCapabilityImageGatherExtended: + case SpvCapabilityStorageImageMultisample: + case SpvCapabilityUniformBufferArrayDynamicIndexing: + case SpvCapabilitySampledImageArrayDynamicIndexing: + case SpvCapabilityStorageBufferArrayDynamicIndexing: + case SpvCapabilityStorageImageArrayDynamicIndexing: + case SpvCapabilityClipDistance: + case SpvCapabilityCullDistance: + case SpvCapabilityImageCubeArray: + case SpvCapabilitySampleRateShading: + case SpvCapabilitySparseResidency: + case SpvCapabilityMinLod: + case SpvCapabilitySampledCubeArray: + case SpvCapabilityImageMSArray: + case SpvCapabilityStorageImageExtendedFormats: + case SpvCapabilityInterpolationFunction: + case SpvCapabilityStorageImageReadWithoutFormat: + case SpvCapabilityStorageImageWriteWithoutFormat: + case SpvCapabilityMultiViewport: + return true; + } + return false; +} + +bool IsSupportOptionalVulkan_1_1(uint32_t capability) { + if (IsSupportOptionalVulkan_1_0(capability)) return true; + + switch (capability) { + case SpvCapabilityGroupNonUniform: + case SpvCapabilityGroupNonUniformVote: + case SpvCapabilityGroupNonUniformArithmetic: + case SpvCapabilityGroupNonUniformBallot: + case SpvCapabilityGroupNonUniformShuffle: + case SpvCapabilityGroupNonUniformShuffleRelative: + case SpvCapabilityGroupNonUniformClustered: + case SpvCapabilityGroupNonUniformQuad: + case SpvCapabilityDrawParameters: + // Alias SpvCapabilityStorageBuffer16BitAccess. + case SpvCapabilityStorageUniformBufferBlock16: + // Alias SpvCapabilityUniformAndStorageBuffer16BitAccess. + case SpvCapabilityStorageUniform16: + case SpvCapabilityStoragePushConstant16: + case SpvCapabilityStorageInputOutput16: + case SpvCapabilityDeviceGroup: + case SpvCapabilityMultiView: + case SpvCapabilityVariablePointersStorageBuffer: + case SpvCapabilityVariablePointers: + return true; + } + return false; +} + +bool IsSupportGuaranteedOpenCL_1_2(uint32_t capability, bool embedded_profile) { + switch (capability) { + case SpvCapabilityAddresses: + case SpvCapabilityFloat16Buffer: + case SpvCapabilityGroups: + case SpvCapabilityInt16: + case SpvCapabilityInt8: + case SpvCapabilityKernel: + case SpvCapabilityLinkage: + case SpvCapabilityVector16: + return true; + case SpvCapabilityInt64: + return !embedded_profile; + case SpvCapabilityPipes: + return embedded_profile; + } + return false; +} + +bool IsSupportGuaranteedOpenCL_2_0(uint32_t capability, bool embedded_profile) { + if (IsSupportGuaranteedOpenCL_1_2(capability, embedded_profile)) return true; + + switch (capability) { + case SpvCapabilityDeviceEnqueue: + case SpvCapabilityGenericPointer: + case SpvCapabilityPipes: + return true; + } + return false; +} + +bool IsSupportGuaranteedOpenCL_2_2(uint32_t capability, bool embedded_profile) { + if (IsSupportGuaranteedOpenCL_2_0(capability, embedded_profile)) return true; + + switch (capability) { + case SpvCapabilitySubgroupDispatch: + case SpvCapabilityPipeStorage: + return true; + } + return false; +} + +bool IsSupportOptionalOpenCL_1_2(uint32_t capability) { + switch (capability) { + case SpvCapabilityImageBasic: + case SpvCapabilityFloat64: + return true; + } + return false; +} + +// Checks if |capability| was enabled by extension. +bool IsEnabledByExtension(ValidationState_t& _, uint32_t capability) { + spv_operand_desc operand_desc = nullptr; + _.grammar().lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, capability, + &operand_desc); + + // operand_desc is expected to be not null, otherwise validator would have + // failed at an earlier stage. This 'assert' is 'just in case'. + assert(operand_desc); + + ExtensionSet operand_exts(operand_desc->numExtensions, + operand_desc->extensions); + if (operand_exts.IsEmpty()) return false; + + return _.HasAnyOfExtensions(operand_exts); +} + +bool IsEnabledByCapabilityOpenCL_1_2(ValidationState_t& _, + uint32_t capability) { + if (_.HasCapability(SpvCapabilityImageBasic)) { + switch (capability) { + case SpvCapabilityLiteralSampler: + case SpvCapabilitySampled1D: + case SpvCapabilityImage1D: + case SpvCapabilitySampledBuffer: + case SpvCapabilityImageBuffer: + return true; + } + return false; + } + return false; +} + +bool IsEnabledByCapabilityOpenCL_2_0(ValidationState_t& _, + uint32_t capability) { + if (_.HasCapability(SpvCapabilityImageBasic)) { + switch (capability) { + case SpvCapabilityImageReadWrite: + case SpvCapabilityLiteralSampler: + case SpvCapabilitySampled1D: + case SpvCapabilityImage1D: + case SpvCapabilitySampledBuffer: + case SpvCapabilityImageBuffer: + return true; + } + return false; + } + return false; +} + +} // namespace + +// Validates that capability declarations use operands allowed in the current +// context. +spv_result_t CapabilityPass(ValidationState_t& _, const Instruction* inst) { + if (inst->opcode() != SpvOpCapability) return SPV_SUCCESS; + + assert(inst->operands().size() == 1); + + const spv_parsed_operand_t& operand = inst->operand(0); + + assert(operand.num_words == 1); + assert(operand.offset < inst->words().size()); + + const uint32_t capability = inst->word(operand.offset); + const auto capability_str = [&_, capability]() { + spv_operand_desc desc = nullptr; + if (_.grammar().lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, capability, + &desc) != SPV_SUCCESS || + !desc) { + return std::string("Unknown"); + } + return std::string(desc->name); + }; + + const auto env = _.context()->target_env; + const bool opencl_embedded = env == SPV_ENV_OPENCL_EMBEDDED_1_2 || + env == SPV_ENV_OPENCL_EMBEDDED_2_0 || + env == SPV_ENV_OPENCL_EMBEDDED_2_1 || + env == SPV_ENV_OPENCL_EMBEDDED_2_2; + const std::string opencl_profile = opencl_embedded ? "Embedded" : "Full"; + if (env == SPV_ENV_VULKAN_1_0) { + if (!IsSupportGuaranteedVulkan_1_0(capability) && + !IsSupportOptionalVulkan_1_0(capability) && + !IsEnabledByExtension(_, capability)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Capability " << capability_str() + << " is not allowed by Vulkan 1.0 specification" + << " (or requires extension)"; + } + } else if (env == SPV_ENV_VULKAN_1_1) { + if (!IsSupportGuaranteedVulkan_1_1(capability) && + !IsSupportOptionalVulkan_1_1(capability) && + !IsEnabledByExtension(_, capability)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Capability " << capability_str() + << " is not allowed by Vulkan 1.1 specification" + << " (or requires extension)"; + } + } else if (env == SPV_ENV_OPENCL_1_2 || env == SPV_ENV_OPENCL_EMBEDDED_1_2) { + if (!IsSupportGuaranteedOpenCL_1_2(capability, opencl_embedded) && + !IsSupportOptionalOpenCL_1_2(capability) && + !IsEnabledByExtension(_, capability) && + !IsEnabledByCapabilityOpenCL_1_2(_, capability)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Capability " << capability_str() + << " is not allowed by OpenCL 1.2 " << opencl_profile + << " Profile specification" + << " (or requires extension or capability)"; + } + } else if (env == SPV_ENV_OPENCL_2_0 || env == SPV_ENV_OPENCL_EMBEDDED_2_0 || + env == SPV_ENV_OPENCL_2_1 || env == SPV_ENV_OPENCL_EMBEDDED_2_1) { + if (!IsSupportGuaranteedOpenCL_2_0(capability, opencl_embedded) && + !IsSupportOptionalOpenCL_1_2(capability) && + !IsEnabledByExtension(_, capability) && + !IsEnabledByCapabilityOpenCL_2_0(_, capability)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Capability " << capability_str() + << " is not allowed by OpenCL 2.0/2.1 " << opencl_profile + << " Profile specification" + << " (or requires extension or capability)"; + } + } else if (env == SPV_ENV_OPENCL_2_2 || env == SPV_ENV_OPENCL_EMBEDDED_2_2) { + if (!IsSupportGuaranteedOpenCL_2_2(capability, opencl_embedded) && + !IsSupportOptionalOpenCL_1_2(capability) && + !IsEnabledByExtension(_, capability) && + !IsEnabledByCapabilityOpenCL_2_0(_, capability)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Capability " << capability_str() + << " is not allowed by OpenCL 2.2 " << opencl_profile + << " Profile specification" + << " (or requires extension or capability)"; + } + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp new file mode 100644 index 00000000000..744641e9761 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_cfg.cpp @@ -0,0 +1,765 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/validate.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/cfa.h" +#include "source/opcode.h" +#include "source/spirv_validator_options.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" +#include "source/val/function.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidatePhi(ValidationState_t& _, const Instruction* inst) { + auto block = inst->block(); + size_t num_in_ops = inst->words().size() - 3; + if (num_in_ops % 2 != 0) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi does not have an equal number of incoming values and " + "basic blocks."; + } + + // Create a uniqued vector of predecessor ids for comparison against + // incoming values. OpBranchConditional %cond %label %label produces two + // predecessors in the CFG. + std::vector pred_ids; + std::transform(block->predecessors()->begin(), block->predecessors()->end(), + std::back_inserter(pred_ids), + [](const BasicBlock* b) { return b->id(); }); + std::sort(pred_ids.begin(), pred_ids.end()); + pred_ids.erase(std::unique(pred_ids.begin(), pred_ids.end()), pred_ids.end()); + + size_t num_edges = num_in_ops / 2; + if (num_edges != pred_ids.size()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's number of incoming blocks (" << num_edges + << ") does not match block's predecessor count (" + << block->predecessors()->size() << ")."; + } + + for (size_t i = 3; i < inst->words().size(); ++i) { + auto inc_id = inst->word(i); + if (i % 2 == 1) { + // Incoming value type must match the phi result type. + auto inc_type_id = _.GetTypeId(inc_id); + if (inst->type_id() != inc_type_id) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's result type " << _.getIdName(inst->type_id()) + << " does not match incoming value " << _.getIdName(inc_id) + << " type " << _.getIdName(inc_type_id) << "."; + } + } else { + if (_.GetIdOpcode(inc_id) != SpvOpLabel) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's incoming basic block " << _.getIdName(inc_id) + << " is not an OpLabel."; + } + + // Incoming basic block must be an immediate predecessor of the phi's + // block. + if (!std::binary_search(pred_ids.begin(), pred_ids.end(), inc_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpPhi's incoming basic block " << _.getIdName(inc_id) + << " is not a predecessor of " << _.getIdName(block->id()) + << "."; + } + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateBranchConditional(ValidationState_t& _, + const Instruction* inst) { + // num_operands is either 3 or 5 --- if 5, the last two need to be literal + // integers + const auto num_operands = inst->operands().size(); + if (num_operands != 3 && num_operands != 5) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpBranchConditional requires either 3 or 5 parameters"; + } + + // grab the condition operand and check that it is a bool + const auto cond_id = inst->GetOperandAs(0); + const auto cond_op = _.FindDef(cond_id); + if (!cond_op || !_.IsBoolScalarType(cond_op->type_id())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) << "Condition operand for " + "OpBranchConditional must be " + "of boolean type"; + } + + // target operands must be OpLabel + // note that we don't need to check that the target labels are in the same + // function, + // PerformCfgChecks already checks for that + const auto true_id = inst->GetOperandAs(1); + const auto true_target = _.FindDef(true_id); + if (!true_target || SpvOpLabel != true_target->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The 'True Label' operand for OpBranchConditional must be the " + "ID of an OpLabel instruction"; + } + + const auto false_id = inst->GetOperandAs(2); + const auto false_target = _.FindDef(false_id); + if (!false_target || SpvOpLabel != false_target->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The 'False Label' operand for OpBranchConditional must be the " + "ID of an OpLabel instruction"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateReturnValue(ValidationState_t& _, + const Instruction* inst) { + const auto value_id = inst->GetOperandAs(0); + const auto value = _.FindDef(value_id); + if (!value || !value->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue Value '" << _.getIdName(value_id) + << "' does not represent a value."; + } + auto value_type = _.FindDef(value->type_id()); + if (!value_type || SpvOpTypeVoid == value_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue value's type '" + << _.getIdName(value->type_id()) << "' is missing or void."; + } + + const bool uses_variable_pointer = + _.features().variable_pointers || + _.features().variable_pointers_storage_buffer; + + if (_.addressing_model() == SpvAddressingModelLogical && + SpvOpTypePointer == value_type->opcode() && !uses_variable_pointer && + !_.options()->relax_logical_pointer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue value's type '" + << _.getIdName(value->type_id()) + << "' is a pointer, which is invalid in the Logical addressing " + "model."; + } + + const auto function = inst->function(); + const auto return_type = _.FindDef(function->GetResultTypeId()); + if (!return_type || return_type->id() != value_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpReturnValue Value '" << _.getIdName(value_id) + << "'s type does not match OpFunction's return type."; + } + + return SPV_SUCCESS; +} + +} // namespace + +void printDominatorList(const BasicBlock& b) { + std::cout << b.id() << " is dominated by: "; + const BasicBlock* bb = &b; + while (bb->immediate_dominator() != bb) { + bb = bb->immediate_dominator(); + std::cout << bb->id() << " "; + } +} + +#define CFG_ASSERT(ASSERT_FUNC, TARGET) \ + if (spv_result_t rcode = ASSERT_FUNC(_, TARGET)) return rcode + +spv_result_t FirstBlockAssert(ValidationState_t& _, uint32_t target) { + if (_.current_function().IsFirstBlock(target)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(_.current_function().id())) + << "First block " << _.getIdName(target) << " of function " + << _.getIdName(_.current_function().id()) << " is targeted by block " + << _.getIdName(_.current_function().current_block()->id()); + } + return SPV_SUCCESS; +} + +spv_result_t MergeBlockAssert(ValidationState_t& _, uint32_t merge_block) { + if (_.current_function().IsBlockType(merge_block, kBlockTypeMerge)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(_.current_function().id())) + << "Block " << _.getIdName(merge_block) + << " is already a merge block for another header"; + } + return SPV_SUCCESS; +} + +/// Update the continue construct's exit blocks once the backedge blocks are +/// identified in the CFG. +void UpdateContinueConstructExitBlocks( + Function& function, + const std::vector>& back_edges) { + auto& constructs = function.constructs(); + // TODO(umar): Think of a faster way to do this + for (auto& edge : back_edges) { + uint32_t back_edge_block_id; + uint32_t loop_header_block_id; + std::tie(back_edge_block_id, loop_header_block_id) = edge; + auto is_this_header = [=](Construct& c) { + return c.type() == ConstructType::kLoop && + c.entry_block()->id() == loop_header_block_id; + }; + + for (auto construct : constructs) { + if (is_this_header(construct)) { + Construct* continue_construct = + construct.corresponding_constructs().back(); + assert(continue_construct->type() == ConstructType::kContinue); + + BasicBlock* back_edge_block; + std::tie(back_edge_block, std::ignore) = + function.GetBlock(back_edge_block_id); + continue_construct->set_exit(back_edge_block); + } + } + } +} + +std::tuple ConstructNames( + ConstructType type) { + std::string construct_name, header_name, exit_name; + + switch (type) { + case ConstructType::kSelection: + construct_name = "selection"; + header_name = "selection header"; + exit_name = "merge block"; + break; + case ConstructType::kLoop: + construct_name = "loop"; + header_name = "loop header"; + exit_name = "merge block"; + break; + case ConstructType::kContinue: + construct_name = "continue"; + header_name = "continue target"; + exit_name = "back-edge block"; + break; + case ConstructType::kCase: + construct_name = "case"; + header_name = "case entry block"; + exit_name = "case exit block"; + break; + default: + assert(1 == 0 && "Not defined type"); + } + + return std::make_tuple(construct_name, header_name, exit_name); +} + +/// Constructs an error message for construct validation errors +std::string ConstructErrorString(const Construct& construct, + const std::string& header_string, + const std::string& exit_string, + const std::string& dominate_text) { + std::string construct_name, header_name, exit_name; + std::tie(construct_name, header_name, exit_name) = + ConstructNames(construct.type()); + + // TODO(umar): Add header block for continue constructs to error message + return "The " + construct_name + " construct with the " + header_name + " " + + header_string + " " + dominate_text + " the " + exit_name + " " + + exit_string; +} + +// Finds the fall through case construct of |target_block| and records it in +// |case_fall_through|. Returns SPV_ERROR_INVALID_CFG if the case construct +// headed by |target_block| branches to multiple case constructs. +spv_result_t FindCaseFallThrough( + const ValidationState_t& _, BasicBlock* target_block, + uint32_t* case_fall_through, const BasicBlock* merge, + const std::unordered_set& case_targets, Function* function) { + std::vector stack; + stack.push_back(target_block); + std::unordered_set visited; + bool target_reachable = target_block->reachable(); + int target_depth = function->GetBlockDepth(target_block); + while (!stack.empty()) { + auto block = stack.back(); + stack.pop_back(); + + if (block == merge) continue; + + if (!visited.insert(block).second) continue; + + if (target_reachable && block->reachable() && + target_block->dominates(*block)) { + // Still in the case construct. + for (auto successor : *block->successors()) { + stack.push_back(successor); + } + } else { + // Exiting the case construct to non-merge block. + if (!case_targets.count(block->id())) { + int depth = function->GetBlockDepth(block); + if ((depth < target_depth) || + (depth == target_depth && block->is_type(kBlockTypeContinue))) { + continue; + } + + return _.diag(SPV_ERROR_INVALID_CFG, target_block->label()) + << "Case construct that targets " + << _.getIdName(target_block->id()) + << " has invalid branch to block " << _.getIdName(block->id()) + << " (not another case construct, corresponding merge, outer " + "loop merge or outer loop continue)"; + } + + if (*case_fall_through == 0u) { + *case_fall_through = block->id(); + } else if (*case_fall_through != block->id()) { + // Case construct has at most one branch to another case construct. + return _.diag(SPV_ERROR_INVALID_CFG, target_block->label()) + << "Case construct that targets " + << _.getIdName(target_block->id()) + << " has branches to multiple other case construct targets " + << _.getIdName(*case_fall_through) << " and " + << _.getIdName(block->id()); + } + } + } + + return SPV_SUCCESS; +} + +spv_result_t StructuredSwitchChecks(const ValidationState_t& _, + Function* function, + const Instruction* switch_inst, + const BasicBlock* header, + const BasicBlock* merge) { + std::unordered_set case_targets; + for (uint32_t i = 1; i < switch_inst->operands().size(); i += 2) { + uint32_t target = switch_inst->GetOperandAs(i); + if (target != merge->id()) case_targets.insert(target); + } + // Tracks how many times each case construct is targeted by another case + // construct. + std::map num_fall_through_targeted; + uint32_t default_case_fall_through = 0u; + uint32_t default_target = switch_inst->GetOperandAs(1u); + std::unordered_set seen; + for (uint32_t i = 1; i < switch_inst->operands().size(); i += 2) { + uint32_t target = switch_inst->GetOperandAs(i); + if (target == merge->id()) continue; + + if (!seen.insert(target).second) continue; + + const auto target_block = function->GetBlock(target).first; + // OpSwitch must dominate all its case constructs. + if (header->reachable() && target_block->reachable() && + !header->dominates(*target_block)) { + return _.diag(SPV_ERROR_INVALID_CFG, header->label()) + << "Selection header " << _.getIdName(header->id()) + << " does not dominate its case construct " << _.getIdName(target); + } + + uint32_t case_fall_through = 0u; + if (auto error = FindCaseFallThrough(_, target_block, &case_fall_through, + merge, case_targets, function)) { + return error; + } + + // Track how many time the fall through case has been targeted. + if (case_fall_through != 0u) { + auto where = num_fall_through_targeted.lower_bound(case_fall_through); + if (where == num_fall_through_targeted.end() || + where->first != case_fall_through) { + num_fall_through_targeted.insert(where, + std::make_pair(case_fall_through, 1)); + } else { + where->second++; + } + } + + if (case_fall_through == default_target) { + case_fall_through = default_case_fall_through; + } + if (case_fall_through != 0u) { + bool is_default = i == 1; + if (is_default) { + default_case_fall_through = case_fall_through; + } else { + // Allow code like: + // case x: + // case y: + // ... + // case z: + // + // Where x and y target the same block and fall through to z. + uint32_t j = i; + while ((j + 2 < switch_inst->operands().size()) && + target == switch_inst->GetOperandAs(j + 2)) { + j += 2; + } + // If Target T1 branches to Target T2, or if Target T1 branches to the + // Default target and the Default target branches to Target T2, then T1 + // must immediately precede T2 in the list of OpSwitch Target operands. + if ((switch_inst->operands().size() < j + 2) || + (case_fall_through != switch_inst->GetOperandAs(j + 2))) { + return _.diag(SPV_ERROR_INVALID_CFG, switch_inst) + << "Case construct that targets " << _.getIdName(target) + << " has branches to the case construct that targets " + << _.getIdName(case_fall_through) + << ", but does not immediately precede it in the " + "OpSwitch's target list"; + } + } + } + } + + // Each case construct must be branched to by at most one other case + // construct. + for (const auto& pair : num_fall_through_targeted) { + if (pair.second > 1) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(pair.first)) + << "Multiple case constructs have branches to the case construct " + "that targets " + << _.getIdName(pair.first); + } + } + + return SPV_SUCCESS; +} + +spv_result_t StructuredControlFlowChecks( + const ValidationState_t& _, Function* function, + const std::vector>& back_edges) { + /// Check all backedges target only loop headers and have exactly one + /// back-edge branching to it + + // Map a loop header to blocks with back-edges to the loop header. + std::map> loop_latch_blocks; + for (auto back_edge : back_edges) { + uint32_t back_edge_block; + uint32_t header_block; + std::tie(back_edge_block, header_block) = back_edge; + if (!function->IsBlockType(header_block, kBlockTypeLoop)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(back_edge_block)) + << "Back-edges (" << _.getIdName(back_edge_block) << " -> " + << _.getIdName(header_block) + << ") can only be formed between a block and a loop header."; + } + loop_latch_blocks[header_block].insert(back_edge_block); + } + + // Check the loop headers have exactly one back-edge branching to it + for (BasicBlock* loop_header : function->ordered_blocks()) { + if (!loop_header->reachable()) continue; + if (!loop_header->is_type(kBlockTypeLoop)) continue; + auto loop_header_id = loop_header->id(); + auto num_latch_blocks = loop_latch_blocks[loop_header_id].size(); + if (num_latch_blocks != 1) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(loop_header_id)) + << "Loop header " << _.getIdName(loop_header_id) + << " is targeted by " << num_latch_blocks + << " back-edge blocks but the standard requires exactly one"; + } + } + + // Check construct rules + for (const Construct& construct : function->constructs()) { + auto header = construct.entry_block(); + auto merge = construct.exit_block(); + + if (header->reachable() && !merge) { + std::string construct_name, header_name, exit_name; + std::tie(construct_name, header_name, exit_name) = + ConstructNames(construct.type()); + return _.diag(SPV_ERROR_INTERNAL, _.FindDef(header->id())) + << "Construct " + construct_name + " with " + header_name + " " + + _.getIdName(header->id()) + " does not have a " + + exit_name + ". This may be a bug in the validator."; + } + + // If the exit block is reachable then it's dominated by the + // header. + if (merge && merge->reachable()) { + if (!header->dominates(*merge)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(merge->id())) + << ConstructErrorString(construct, _.getIdName(header->id()), + _.getIdName(merge->id()), + "does not dominate"); + } + // If it's really a merge block for a selection or loop, then it must be + // *strictly* dominated by the header. + if (construct.ExitBlockIsMergeBlock() && (header == merge)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(merge->id())) + << ConstructErrorString(construct, _.getIdName(header->id()), + _.getIdName(merge->id()), + "does not strictly dominate"); + } + } + // Check post-dominance for continue constructs. But dominance and + // post-dominance only make sense when the construct is reachable. + if (header->reachable() && construct.type() == ConstructType::kContinue) { + if (!merge->postdominates(*header)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(merge->id())) + << ConstructErrorString(construct, _.getIdName(header->id()), + _.getIdName(merge->id()), + "is not post dominated by"); + } + } + + // Check that for all non-header blocks, all predecessors are within this + // construct. + Construct::ConstructBlockSet construct_blocks = construct.blocks(function); + for (auto block : construct_blocks) { + if (block == header) continue; + for (auto pred : *block->predecessors()) { + if (pred->reachable() && !construct_blocks.count(pred)) { + std::string construct_name, header_name, exit_name; + std::tie(construct_name, header_name, exit_name) = + ConstructNames(construct.type()); + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(pred->id())) + << "block " << pred->id() << " branches to the " + << construct_name << " construct, but not to the " + << header_name << " " << header->id(); + } + } + } + + // Checks rules for case constructs. + if (construct.type() == ConstructType::kSelection && + header->terminator()->opcode() == SpvOpSwitch) { + const auto terminator = header->terminator(); + if (auto error = + StructuredSwitchChecks(_, function, terminator, header, merge)) { + return error; + } + } + } + return SPV_SUCCESS; +} + +spv_result_t PerformCfgChecks(ValidationState_t& _) { + for (auto& function : _.functions()) { + // Check all referenced blocks are defined within a function + if (function.undefined_block_count() != 0) { + std::string undef_blocks("{"); + bool first = true; + for (auto undefined_block : function.undefined_blocks()) { + undef_blocks += _.getIdName(undefined_block); + if (!first) { + undef_blocks += " "; + } + first = false; + } + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(function.id())) + << "Block(s) " << undef_blocks << "}" + << " are referenced but not defined in function " + << _.getIdName(function.id()); + } + + // Set each block's immediate dominator and immediate postdominator, + // and find all back-edges. + // + // We want to analyze all the blocks in the function, even in degenerate + // control flow cases including unreachable blocks. So use the augmented + // CFG to ensure we cover all the blocks. + std::vector postorder; + std::vector postdom_postorder; + std::vector> back_edges; + auto ignore_block = [](const BasicBlock*) {}; + auto ignore_edge = [](const BasicBlock*, const BasicBlock*) {}; + if (!function.ordered_blocks().empty()) { + /// calculate dominators + CFA::DepthFirstTraversal( + function.first_block(), function.AugmentedCFGSuccessorsFunction(), + ignore_block, [&](const BasicBlock* b) { postorder.push_back(b); }, + ignore_edge); + auto edges = CFA::CalculateDominators( + postorder, function.AugmentedCFGPredecessorsFunction()); + for (auto edge : edges) { + edge.first->SetImmediateDominator(edge.second); + } + + /// calculate post dominators + CFA::DepthFirstTraversal( + function.pseudo_exit_block(), + function.AugmentedCFGPredecessorsFunction(), ignore_block, + [&](const BasicBlock* b) { postdom_postorder.push_back(b); }, + ignore_edge); + auto postdom_edges = CFA::CalculateDominators( + postdom_postorder, function.AugmentedCFGSuccessorsFunction()); + for (auto edge : postdom_edges) { + edge.first->SetImmediatePostDominator(edge.second); + } + /// calculate back edges. + CFA::DepthFirstTraversal( + function.pseudo_entry_block(), + function + .AugmentedCFGSuccessorsFunctionIncludingHeaderToContinueEdge(), + ignore_block, ignore_block, + [&](const BasicBlock* from, const BasicBlock* to) { + back_edges.emplace_back(from->id(), to->id()); + }); + } + UpdateContinueConstructExitBlocks(function, back_edges); + + auto& blocks = function.ordered_blocks(); + if (!blocks.empty()) { + // Check if the order of blocks in the binary appear before the blocks + // they dominate + for (auto block = begin(blocks) + 1; block != end(blocks); ++block) { + if (auto idom = (*block)->immediate_dominator()) { + if (idom != function.pseudo_entry_block() && + block == std::find(begin(blocks), block, idom)) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef(idom->id())) + << "Block " << _.getIdName((*block)->id()) + << " appears in the binary before its dominator " + << _.getIdName(idom->id()); + } + } + } + // If we have structed control flow, check that no block has a control + // flow nesting depth larger than the limit. + if (_.HasCapability(SpvCapabilityShader)) { + const int control_flow_nesting_depth_limit = + _.options()->universal_limits_.max_control_flow_nesting_depth; + for (auto block = begin(blocks); block != end(blocks); ++block) { + if (function.GetBlockDepth(*block) > + control_flow_nesting_depth_limit) { + return _.diag(SPV_ERROR_INVALID_CFG, _.FindDef((*block)->id())) + << "Maximum Control Flow nesting depth exceeded."; + } + } + } + } + + /// Structured control flow checks are only required for shader capabilities + if (_.HasCapability(SpvCapabilityShader)) { + if (auto error = StructuredControlFlowChecks(_, &function, back_edges)) + return error; + } + } + return SPV_SUCCESS; +} + +spv_result_t CfgPass(ValidationState_t& _, const Instruction* inst) { + SpvOp opcode = inst->opcode(); + switch (opcode) { + case SpvOpLabel: + if (auto error = _.current_function().RegisterBlock(inst->id())) + return error; + + // TODO(github:1661) This should be done in the + // ValidationState::RegisterInstruction method but because of the order of + // passes the OpLabel ends up not being part of the basic block it starts. + _.current_function().current_block()->set_label(inst); + break; + case SpvOpLoopMerge: { + uint32_t merge_block = inst->GetOperandAs(0); + uint32_t continue_block = inst->GetOperandAs(1); + CFG_ASSERT(MergeBlockAssert, merge_block); + + if (auto error = _.current_function().RegisterLoopMerge(merge_block, + continue_block)) + return error; + } break; + case SpvOpSelectionMerge: { + uint32_t merge_block = inst->GetOperandAs(0); + CFG_ASSERT(MergeBlockAssert, merge_block); + + if (auto error = _.current_function().RegisterSelectionMerge(merge_block)) + return error; + } break; + case SpvOpBranch: { + uint32_t target = inst->GetOperandAs(0); + CFG_ASSERT(FirstBlockAssert, target); + + _.current_function().RegisterBlockEnd({target}, opcode); + } break; + case SpvOpBranchConditional: { + uint32_t tlabel = inst->GetOperandAs(1); + uint32_t flabel = inst->GetOperandAs(2); + CFG_ASSERT(FirstBlockAssert, tlabel); + CFG_ASSERT(FirstBlockAssert, flabel); + + _.current_function().RegisterBlockEnd({tlabel, flabel}, opcode); + } break; + + case SpvOpSwitch: { + std::vector cases; + for (size_t i = 1; i < inst->operands().size(); i += 2) { + uint32_t target = inst->GetOperandAs(i); + CFG_ASSERT(FirstBlockAssert, target); + cases.push_back(target); + } + _.current_function().RegisterBlockEnd({cases}, opcode); + } break; + case SpvOpReturn: { + const uint32_t return_type = _.current_function().GetResultTypeId(); + const Instruction* return_type_inst = _.FindDef(return_type); + assert(return_type_inst); + if (return_type_inst->opcode() != SpvOpTypeVoid) + return _.diag(SPV_ERROR_INVALID_CFG, inst) + << "OpReturn can only be called from a function with void " + << "return type."; + } + // Fallthrough. + case SpvOpKill: + case SpvOpReturnValue: + case SpvOpUnreachable: + _.current_function().RegisterBlockEnd(std::vector(), opcode); + if (opcode == SpvOpKill) { + _.current_function().RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + "OpKill requires Fragment execution model"); + } + break; + default: + break; + } + return SPV_SUCCESS; +} + +spv_result_t ControlFlowPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpPhi: + if (auto error = ValidatePhi(_, inst)) return error; + break; + case SpvOpBranchConditional: + if (auto error = ValidateBranchConditional(_, inst)) return error; + break; + case SpvOpReturnValue: + if (auto error = ValidateReturnValue(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp new file mode 100644 index 00000000000..6be60261e00 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_composites.cpp @@ -0,0 +1,512 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of composite SPIR-V instructions. + +#include "source/val/validate.h" + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Returns the type of the value accessed by OpCompositeExtract or +// OpCompositeInsert instruction. The function traverses the hierarchy of +// nested data structures (structs, arrays, vectors, matrices) as directed by +// the sequence of indices in the instruction. May return error if traversal +// fails (encountered non-composite, out of bounds, nesting too deep). +// Returns the type of Composite operand if the instruction has no indices. +spv_result_t GetExtractInsertValueType(ValidationState_t& _, + const Instruction* inst, + uint32_t* member_type) { + const SpvOp opcode = inst->opcode(); + assert(opcode == SpvOpCompositeExtract || opcode == SpvOpCompositeInsert); + uint32_t word_index = opcode == SpvOpCompositeExtract ? 4 : 5; + const uint32_t num_words = static_cast(inst->words().size()); + const uint32_t composite_id_index = word_index - 1; + + const uint32_t num_indices = num_words - word_index; + const uint32_t kCompositeExtractInsertMaxNumIndices = 255; + if (num_indices > kCompositeExtractInsertMaxNumIndices) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The number of indexes in Op" << spvOpcodeString(opcode) + << " may not exceed " << kCompositeExtractInsertMaxNumIndices + << ". Found " << num_indices << " indexes."; + } + + *member_type = _.GetTypeId(inst->word(composite_id_index)); + if (*member_type == 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Composite to be an object of composite type"; + } + + for (; word_index < num_words; ++word_index) { + const uint32_t component_index = inst->word(word_index); + const Instruction* const type_inst = _.FindDef(*member_type); + assert(type_inst); + switch (type_inst->opcode()) { + case SpvOpTypeVector: { + *member_type = type_inst->word(2); + const uint32_t vector_size = type_inst->word(3); + if (component_index >= vector_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Vector access is out of bounds, vector size is " + << vector_size << ", but access index is " << component_index; + } + break; + } + case SpvOpTypeMatrix: { + *member_type = type_inst->word(2); + const uint32_t num_cols = type_inst->word(3); + if (component_index >= num_cols) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Matrix access is out of bounds, matrix has " << num_cols + << " columns, but access index is " << component_index; + } + break; + } + case SpvOpTypeArray: { + uint64_t array_size = 0; + auto size = _.FindDef(type_inst->word(3)); + *member_type = type_inst->word(2); + if (spvOpcodeIsSpecConstant(size->opcode())) { + // Cannot verify against the size of this array. + break; + } + + if (!_.GetConstantValUint64(type_inst->word(3), &array_size)) { + assert(0 && "Array type definition is corrupt"); + } + if (component_index >= array_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Array access is out of bounds, array size is " + << array_size << ", but access index is " << component_index; + } + break; + } + case SpvOpTypeRuntimeArray: { + *member_type = type_inst->word(2); + // Array size is unknown. + break; + } + case SpvOpTypeStruct: { + const size_t num_struct_members = type_inst->words().size() - 2; + if (component_index >= num_struct_members) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Index is out of bounds, can not find index " + << component_index << " in the structure '" + << type_inst->id() << "'. This structure has " + << num_struct_members << " members. Largest valid index is " + << num_struct_members - 1 << "."; + } + *member_type = type_inst->word(component_index + 2); + break; + } + default: + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Reached non-composite type while indexes still remain to " + "be traversed."; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateVectorExtractDynamic(ValidationState_t& _, + const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + const SpvOp result_opcode = _.GetIdOpcode(result_type); + if (!spvOpcodeIsScalarType(result_opcode)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a scalar type"; + } + + const uint32_t vector_type = _.GetOperandTypeId(inst, 2); + const SpvOp vector_opcode = _.GetIdOpcode(vector_type); + if (vector_opcode != SpvOpTypeVector) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Vector type to be OpTypeVector"; + } + + if (_.GetComponentType(vector_type) != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Vector component type to be equal to Result Type"; + } + + const uint32_t index_type = _.GetOperandTypeId(inst, 3); + if (!_.IsIntScalarType(index_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Index to be int scalar"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateVectorInsertDyanmic(ValidationState_t& _, + const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + const SpvOp result_opcode = _.GetIdOpcode(result_type); + if (result_opcode != SpvOpTypeVector) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be OpTypeVector"; + } + + const uint32_t vector_type = _.GetOperandTypeId(inst, 2); + if (vector_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Vector type to be equal to Result Type"; + } + + const uint32_t component_type = _.GetOperandTypeId(inst, 3); + if (_.GetComponentType(result_type) != component_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Component type to be equal to Result Type " + << "component type"; + } + + const uint32_t index_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarType(index_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Index to be int scalar"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateCompositeConstruct(ValidationState_t& _, + const Instruction* inst) { + const uint32_t num_operands = static_cast(inst->operands().size()); + const uint32_t result_type = inst->type_id(); + const SpvOp result_opcode = _.GetIdOpcode(result_type); + switch (result_opcode) { + case SpvOpTypeVector: { + const uint32_t num_result_components = _.GetDimension(result_type); + const uint32_t result_component_type = _.GetComponentType(result_type); + uint32_t given_component_count = 0; + + if (num_operands <= 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of constituents to be at least 2"; + } + + for (uint32_t operand_index = 2; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (operand_type == result_component_type) { + ++given_component_count; + } else { + if (_.GetIdOpcode(operand_type) != SpvOpTypeVector || + _.GetComponentType(operand_type) != result_component_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Constituents to be scalars or vectors of" + << " the same type as Result Type components"; + } + + given_component_count += _.GetDimension(operand_type); + } + } + + if (num_result_components != given_component_count) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected total number of given components to be equal " + << "to the size of Result Type vector"; + } + + break; + } + case SpvOpTypeMatrix: { + uint32_t result_num_rows = 0; + uint32_t result_num_cols = 0; + uint32_t result_col_type = 0; + uint32_t result_component_type = 0; + if (!_.GetMatrixTypeInfo(result_type, &result_num_rows, &result_num_cols, + &result_col_type, &result_component_type)) { + assert(0); + } + + if (result_num_cols + 2 != num_operands) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected total number of Constituents to be equal " + << "to the number of columns of Result Type matrix"; + } + + for (uint32_t operand_index = 2; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (operand_type != result_col_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Constituent type to be equal to the column " + << "type Result Type matrix"; + } + } + + break; + } + case SpvOpTypeArray: { + const Instruction* const array_inst = _.FindDef(result_type); + assert(array_inst); + assert(array_inst->opcode() == SpvOpTypeArray); + + auto size = _.FindDef(array_inst->word(3)); + if (spvOpcodeIsSpecConstant(size->opcode())) { + // Cannot verify against the size of this array. + break; + } + + uint64_t array_size = 0; + if (!_.GetConstantValUint64(array_inst->word(3), &array_size)) { + assert(0 && "Array type definition is corrupt"); + } + + if (array_size + 2 != num_operands) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected total number of Constituents to be equal " + << "to the number of elements of Result Type array"; + } + + const uint32_t result_component_type = array_inst->word(2); + for (uint32_t operand_index = 2; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (operand_type != result_component_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Constituent type to be equal to the column " + << "type Result Type array"; + } + } + + break; + } + case SpvOpTypeStruct: { + const Instruction* const struct_inst = _.FindDef(result_type); + assert(struct_inst); + assert(struct_inst->opcode() == SpvOpTypeStruct); + + if (struct_inst->operands().size() + 1 != num_operands) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected total number of Constituents to be equal " + << "to the number of members of Result Type struct"; + } + + for (uint32_t operand_index = 2; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + const uint32_t member_type = struct_inst->word(operand_index); + if (operand_type != member_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Constituent type to be equal to the " + << "corresponding member type of Result Type struct"; + } + } + + break; + } + default: { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a composite type"; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateCompositeExtract(ValidationState_t& _, + const Instruction* inst) { + uint32_t member_type = 0; + if (spv_result_t error = GetExtractInsertValueType(_, inst, &member_type)) { + return error; + } + + const uint32_t result_type = inst->type_id(); + if (result_type != member_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result type (Op" << spvOpcodeString(_.GetIdOpcode(result_type)) + << ") does not match the type that results from indexing into " + "the composite (Op" + << spvOpcodeString(_.GetIdOpcode(member_type)) << ")."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateCompositeInsert(ValidationState_t& _, + const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t object_type = _.GetOperandTypeId(inst, 2); + const uint32_t composite_type = _.GetOperandTypeId(inst, 3); + const uint32_t result_type = inst->type_id(); + if (result_type != composite_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The Result Type must be the same as Composite type in Op" + << spvOpcodeString(opcode) << " yielding Result Id " << result_type + << "."; + } + + uint32_t member_type = 0; + if (spv_result_t error = GetExtractInsertValueType(_, inst, &member_type)) { + return error; + } + + if (object_type != member_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "The Object type (Op" + << spvOpcodeString(_.GetIdOpcode(object_type)) + << ") does not match the type that results from indexing into the " + "Composite (Op" + << spvOpcodeString(_.GetIdOpcode(member_type)) << ")."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateCopyObject(ValidationState_t& _, const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + const uint32_t operand_type = _.GetOperandTypeId(inst, 2); + if (operand_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type and Operand type to be the same"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTranspose(ValidationState_t& _, const Instruction* inst) { + uint32_t result_num_rows = 0; + uint32_t result_num_cols = 0; + uint32_t result_col_type = 0; + uint32_t result_component_type = 0; + const uint32_t result_type = inst->type_id(); + if (!_.GetMatrixTypeInfo(result_type, &result_num_rows, &result_num_cols, + &result_col_type, &result_component_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a matrix type"; + } + + const uint32_t matrix_type = _.GetOperandTypeId(inst, 2); + uint32_t matrix_num_rows = 0; + uint32_t matrix_num_cols = 0; + uint32_t matrix_col_type = 0; + uint32_t matrix_component_type = 0; + if (!_.GetMatrixTypeInfo(matrix_type, &matrix_num_rows, &matrix_num_cols, + &matrix_col_type, &matrix_component_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Matrix to be of type OpTypeMatrix"; + } + + if (result_component_type != matrix_component_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected component types of Matrix and Result Type to be " + << "identical"; + } + + if (result_num_rows != matrix_num_cols || + result_num_cols != matrix_num_rows) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected number of columns and the column size of Matrix " + << "to be the reverse of those of Result Type"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateVectorShuffle(ValidationState_t& _, + const Instruction* inst) { + auto resultType = _.FindDef(inst->type_id()); + if (!resultType || resultType->opcode() != SpvOpTypeVector) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The Result Type of OpVectorShuffle must be" + << " OpTypeVector. Found Op" + << spvOpcodeString(static_cast(resultType->opcode())) << "."; + } + + // The number of components in Result Type must be the same as the number of + // Component operands. + auto componentCount = inst->operands().size() - 4; + auto resultVectorDimension = resultType->GetOperandAs(2); + if (componentCount != resultVectorDimension) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpVectorShuffle component literals count does not match " + "Result Type '" + << _.getIdName(resultType->id()) << "'s vector component count."; + } + + // Vector 1 and Vector 2 must both have vector types, with the same Component + // Type as Result Type. + auto vector1Object = _.FindDef(inst->GetOperandAs(2)); + auto vector1Type = _.FindDef(vector1Object->type_id()); + auto vector2Object = _.FindDef(inst->GetOperandAs(3)); + auto vector2Type = _.FindDef(vector2Object->type_id()); + if (!vector1Type || vector1Type->opcode() != SpvOpTypeVector) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The type of Vector 1 must be OpTypeVector."; + } + if (!vector2Type || vector2Type->opcode() != SpvOpTypeVector) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The type of Vector 2 must be OpTypeVector."; + } + + auto resultComponentType = resultType->GetOperandAs(1); + if (vector1Type->GetOperandAs(1) != resultComponentType) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The Component Type of Vector 1 must be the same as ResultType."; + } + if (vector2Type->GetOperandAs(1) != resultComponentType) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "The Component Type of Vector 2 must be the same as ResultType."; + } + + // All Component literals must either be FFFFFFFF or in [0, N - 1]. + auto vector1ComponentCount = vector1Type->GetOperandAs(2); + auto vector2ComponentCount = vector2Type->GetOperandAs(2); + auto N = vector1ComponentCount + vector2ComponentCount; + auto firstLiteralIndex = 4; + for (size_t i = firstLiteralIndex; i < inst->operands().size(); ++i) { + auto literal = inst->GetOperandAs(i); + if (literal != 0xFFFFFFFF && literal >= N) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Component index " << literal << " is out of bounds for " + << "combined (Vector1 + Vector2) size of " << N << "."; + } + } + + return SPV_SUCCESS; +} + +} // anonymous namespace + +// Validates correctness of composite instructions. +spv_result_t CompositesPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpVectorExtractDynamic: + return ValidateVectorExtractDynamic(_, inst); + case SpvOpVectorInsertDynamic: + return ValidateVectorInsertDyanmic(_, inst); + case SpvOpVectorShuffle: + return ValidateVectorShuffle(_, inst); + case SpvOpCompositeConstruct: + return ValidateCompositeConstruct(_, inst); + case SpvOpCompositeExtract: + return ValidateCompositeExtract(_, inst); + case SpvOpCompositeInsert: + return ValidateCompositeInsert(_, inst); + case SpvOpCopyObject: + return ValidateCopyObject(_, inst); + case SpvOpTranspose: + return ValidateTranspose(_, inst); + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp new file mode 100644 index 00000000000..5dbe6c6df22 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_constants.cpp @@ -0,0 +1,346 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateConstantBool(ValidationState_t& _, + const Instruction* inst) { + auto type = _.FindDef(inst->type_id()); + if (!type || type->opcode() != SpvOpTypeBool) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Op" << spvOpcodeString(inst->opcode()) << " Result Type '" + << _.getIdName(inst->type_id()) << "' is not a boolean type."; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateConstantComposite(ValidationState_t& _, + const Instruction* inst) { + std::string opcode_name = std::string("Op") + spvOpcodeString(inst->opcode()); + + const auto result_type = _.FindDef(inst->type_id()); + if (!result_type || !spvOpcodeIsComposite(result_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Result Type '" + << _.getIdName(inst->type_id()) << "' is not a composite type."; + } + + const auto constituent_count = inst->words().size() - 3; + switch (result_type->opcode()) { + case SpvOpTypeVector: { + const auto component_count = result_type->GetOperandAs(2); + if (component_count != constituent_count) { + // TODO: Output ID's on diagnostic + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name + << " Constituent count does not match " + "Result Type '" + << _.getIdName(result_type->id()) + << "'s vector component count."; + } + const auto component_type = + _.FindDef(result_type->GetOperandAs(1)); + if (!component_type) { + return _.diag(SPV_ERROR_INVALID_ID, result_type) + << "Component type is not defined."; + } + for (size_t constituent_index = 2; + constituent_index < inst->operands().size(); constituent_index++) { + const auto constituent_id = + inst->GetOperandAs(constituent_index); + const auto constituent = _.FindDef(constituent_id); + if (!constituent || + !spvOpcodeIsConstantOrUndef(constituent->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' is not a constant or undef."; + } + const auto constituent_result_type = _.FindDef(constituent->type_id()); + if (!constituent_result_type || + component_type->opcode() != constituent_result_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "'s type does not match Result Type '" + << _.getIdName(result_type->id()) << "'s vector element type."; + } + } + } break; + case SpvOpTypeMatrix: { + const auto column_count = result_type->GetOperandAs(2); + if (column_count != constituent_count) { + // TODO: Output ID's on diagnostic + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name + << " Constituent count does not match " + "Result Type '" + << _.getIdName(result_type->id()) << "'s matrix column count."; + } + + const auto column_type = _.FindDef(result_type->words()[2]); + if (!column_type) { + return _.diag(SPV_ERROR_INVALID_ID, result_type) + << "Column type is not defined."; + } + const auto component_count = column_type->GetOperandAs(2); + const auto component_type = + _.FindDef(column_type->GetOperandAs(1)); + if (!component_type) { + return _.diag(SPV_ERROR_INVALID_ID, column_type) + << "Component type is not defined."; + } + + for (size_t constituent_index = 2; + constituent_index < inst->operands().size(); constituent_index++) { + const auto constituent_id = + inst->GetOperandAs(constituent_index); + const auto constituent = _.FindDef(constituent_id); + if (!constituent || + !(SpvOpConstantComposite == constituent->opcode() || + SpvOpSpecConstantComposite == constituent->opcode() || + SpvOpUndef == constituent->opcode())) { + // The message says "... or undef" because the spec does not say + // undef is a constant. + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' is not a constant composite or undef."; + } + const auto vector = _.FindDef(constituent->type_id()); + if (!vector) { + return _.diag(SPV_ERROR_INVALID_ID, constituent) + << "Result type is not defined."; + } + if (column_type->opcode() != vector->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' type does not match Result Type '" + << _.getIdName(result_type->id()) << "'s matrix column type."; + } + const auto vector_component_type = + _.FindDef(vector->GetOperandAs(1)); + if (component_type->id() != vector_component_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' component type does not match Result Type '" + << _.getIdName(result_type->id()) + << "'s matrix column component type."; + } + if (component_count != vector->words()[3]) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' vector component count does not match Result Type '" + << _.getIdName(result_type->id()) + << "'s vector component count."; + } + } + } break; + case SpvOpTypeArray: { + auto element_type = _.FindDef(result_type->GetOperandAs(1)); + if (!element_type) { + return _.diag(SPV_ERROR_INVALID_ID, result_type) + << "Element type is not defined."; + } + const auto length = _.FindDef(result_type->GetOperandAs(2)); + if (!length) { + return _.diag(SPV_ERROR_INVALID_ID, result_type) + << "Length is not defined."; + } + bool is_int32; + bool is_const; + uint32_t value; + std::tie(is_int32, is_const, value) = _.EvalInt32IfConst(length->id()); + if (is_int32 && is_const && !spvOpcodeIsSpecConstant(length->opcode()) && + value != constituent_count) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name + << " Constituent count does not match " + "Result Type '" + << _.getIdName(result_type->id()) << "'s array length."; + } + for (size_t constituent_index = 2; + constituent_index < inst->operands().size(); constituent_index++) { + const auto constituent_id = + inst->GetOperandAs(constituent_index); + const auto constituent = _.FindDef(constituent_id); + if (!constituent || + !spvOpcodeIsConstantOrUndef(constituent->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' is not a constant or undef."; + } + const auto constituent_type = _.FindDef(constituent->type_id()); + if (!constituent_type) { + return _.diag(SPV_ERROR_INVALID_ID, constituent) + << "Result type is not defined."; + } + if (element_type->id() != constituent_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "'s type does not match Result Type '" + << _.getIdName(result_type->id()) << "'s array element type."; + } + } + } break; + case SpvOpTypeStruct: { + const auto member_count = result_type->words().size() - 2; + if (member_count != constituent_count) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(inst->type_id()) + << "' count does not match Result Type '" + << _.getIdName(result_type->id()) << "'s struct member count."; + } + for (uint32_t constituent_index = 2, member_index = 1; + constituent_index < inst->operands().size(); + constituent_index++, member_index++) { + const auto constituent_id = + inst->GetOperandAs(constituent_index); + const auto constituent = _.FindDef(constituent_id); + if (!constituent || + !spvOpcodeIsConstantOrUndef(constituent->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' is not a constant or undef."; + } + const auto constituent_type = _.FindDef(constituent->type_id()); + if (!constituent_type) { + return _.diag(SPV_ERROR_INVALID_ID, constituent) + << "Result type is not defined."; + } + + const auto member_type_id = + result_type->GetOperandAs(member_index); + const auto member_type = _.FindDef(member_type_id); + if (!member_type || member_type->id() != constituent_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << opcode_name << " Constituent '" + << _.getIdName(constituent_id) + << "' type does not match the Result Type '" + << _.getIdName(result_type->id()) << "'s member type."; + } + } + } break; + default: + break; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateConstantSampler(ValidationState_t& _, + const Instruction* inst) { + const auto result_type = _.FindDef(inst->type_id()); + if (!result_type || result_type->opcode() != SpvOpTypeSampler) { + return _.diag(SPV_ERROR_INVALID_ID, result_type) + << "OpConstantSampler Result Type '" + << _.getIdName(inst->type_id()) << "' is not a sampler type."; + } + + return SPV_SUCCESS; +} + +// True if instruction defines a type that can have a null value, as defined by +// the SPIR-V spec. Tracks composite-type components through module to check +// nullability transitively. +bool IsTypeNullable(const std::vector& instruction, + const ValidationState_t& _) { + uint16_t opcode; + uint16_t word_count; + spvOpcodeSplit(instruction[0], &word_count, &opcode); + switch (static_cast(opcode)) { + case SpvOpTypeBool: + case SpvOpTypeInt: + case SpvOpTypeFloat: + case SpvOpTypePointer: + case SpvOpTypeEvent: + case SpvOpTypeDeviceEvent: + case SpvOpTypeReserveId: + case SpvOpTypeQueue: + return true; + case SpvOpTypeArray: + case SpvOpTypeMatrix: + case SpvOpTypeVector: { + auto base_type = _.FindDef(instruction[2]); + return base_type && IsTypeNullable(base_type->words(), _); + } + case SpvOpTypeStruct: { + for (size_t elementIndex = 2; elementIndex < instruction.size(); + ++elementIndex) { + auto element = _.FindDef(instruction[elementIndex]); + if (!element || !IsTypeNullable(element->words(), _)) return false; + } + return true; + } + default: + return false; + } +} + +spv_result_t ValidateConstantNull(ValidationState_t& _, + const Instruction* inst) { + const auto result_type = _.FindDef(inst->type_id()); + if (!result_type || !IsTypeNullable(result_type->words(), _)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpConstantNull Result Type '" + << _.getIdName(inst->type_id()) << "' cannot have a null value."; + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ConstantPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpConstantTrue: + case SpvOpConstantFalse: + case SpvOpSpecConstantTrue: + case SpvOpSpecConstantFalse: + if (auto error = ValidateConstantBool(_, inst)) return error; + break; + case SpvOpConstantComposite: + case SpvOpSpecConstantComposite: + if (auto error = ValidateConstantComposite(_, inst)) return error; + break; + case SpvOpConstantSampler: + if (auto error = ValidateConstantSampler(_, inst)) return error; + break; + case SpvOpConstantNull: + if (auto error = ValidateConstantNull(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp new file mode 100644 index 00000000000..9c6f68c6f51 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_conversion.cpp @@ -0,0 +1,413 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of conversion instructions. + +#include "source/val/validate.h" + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates correctness of conversion instructions. +spv_result_t ConversionPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + switch (opcode) { + case SpvOpConvertFToU: { + if (!_.IsUnsignedIntScalarType(result_type) && + !_.IsUnsignedIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected unsigned int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || (!_.IsFloatScalarType(input_type) && + !_.IsFloatVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be float scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpConvertFToS: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || (!_.IsFloatScalarType(input_type) && + !_.IsFloatVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be float scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpConvertSToF: + case SpvOpConvertUToF: { + if (!_.IsFloatScalarType(result_type) && + !_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || + (!_.IsIntScalarType(input_type) && !_.IsIntVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be int scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpUConvert: { + if (!_.IsUnsignedIntScalarType(result_type) && + !_.IsUnsignedIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected unsigned int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || + (!_.IsIntScalarType(input_type) && !_.IsIntVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be int scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + + if (_.GetBitWidth(result_type) == _.GetBitWidth(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have different bit width from Result " + "Type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpSConvert: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || + (!_.IsIntScalarType(input_type) && !_.IsIntVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be int scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + + if (_.GetBitWidth(result_type) == _.GetBitWidth(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have different bit width from Result " + "Type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpFConvert: { + if (!_.IsFloatScalarType(result_type) && + !_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected float scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || (!_.IsFloatScalarType(input_type) && + !_.IsFloatVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be float scalar or vector: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + + if (_.GetBitWidth(result_type) == _.GetBitWidth(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have different bit width from Result " + "Type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpQuantizeToF16: { + if ((!_.IsFloatScalarType(result_type) && + !_.IsFloatVectorType(result_type)) || + _.GetBitWidth(result_type) != 32) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected 32-bit float scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (input_type != result_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input type to be equal to Result Type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpConvertPtrToU: { + if (!_.IsUnsignedIntScalarType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected unsigned int scalar type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!_.IsPointerType(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be a pointer: " << spvOpcodeString(opcode); + break; + } + + case SpvOpSatConvertSToU: + case SpvOpSatConvertUToS: { + if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type || + (!_.IsIntScalarType(input_type) && !_.IsIntVectorType(input_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar or vector as input: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same dimension as Result Type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpConvertUToPtr: { + if (!_.IsPointerType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a pointer: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected int scalar as input: " << spvOpcodeString(opcode); + break; + } + + case SpvOpPtrCastToGeneric: { + uint32_t result_storage_class = 0; + uint32_t result_data_type = 0; + if (!_.GetPointerTypeInfo(result_type, &result_data_type, + &result_storage_class)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a pointer: " + << spvOpcodeString(opcode); + + if (result_storage_class != SpvStorageClassGeneric) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to have storage class Generic: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + uint32_t input_storage_class = 0; + uint32_t input_data_type = 0; + if (!_.GetPointerTypeInfo(input_type, &input_data_type, + &input_storage_class)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be a pointer: " << spvOpcodeString(opcode); + + if (input_storage_class != SpvStorageClassWorkgroup && + input_storage_class != SpvStorageClassCrossWorkgroup && + input_storage_class != SpvStorageClassFunction) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have storage class Workgroup, " + << "CrossWorkgroup or Function: " << spvOpcodeString(opcode); + + if (result_data_type != input_data_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input and Result Type to point to the same type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpGenericCastToPtr: { + uint32_t result_storage_class = 0; + uint32_t result_data_type = 0; + if (!_.GetPointerTypeInfo(result_type, &result_data_type, + &result_storage_class)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a pointer: " + << spvOpcodeString(opcode); + + if (result_storage_class != SpvStorageClassWorkgroup && + result_storage_class != SpvStorageClassCrossWorkgroup && + result_storage_class != SpvStorageClassFunction) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to have storage class Workgroup, " + << "CrossWorkgroup or Function: " << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + uint32_t input_storage_class = 0; + uint32_t input_data_type = 0; + if (!_.GetPointerTypeInfo(input_type, &input_data_type, + &input_storage_class)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be a pointer: " << spvOpcodeString(opcode); + + if (input_storage_class != SpvStorageClassGeneric) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have storage class Generic: " + << spvOpcodeString(opcode); + + if (result_data_type != input_data_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input and Result Type to point to the same type: " + << spvOpcodeString(opcode); + break; + } + + case SpvOpGenericCastToPtrExplicit: { + uint32_t result_storage_class = 0; + uint32_t result_data_type = 0; + if (!_.GetPointerTypeInfo(result_type, &result_data_type, + &result_storage_class)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a pointer: " + << spvOpcodeString(opcode); + + const uint32_t target_storage_class = inst->word(4); + if (result_storage_class != target_storage_class) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be of target storage class: " + << spvOpcodeString(opcode); + + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + uint32_t input_storage_class = 0; + uint32_t input_data_type = 0; + if (!_.GetPointerTypeInfo(input_type, &input_data_type, + &input_storage_class)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be a pointer: " << spvOpcodeString(opcode); + + if (input_storage_class != SpvStorageClassGeneric) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have storage class Generic: " + << spvOpcodeString(opcode); + + if (result_data_type != input_data_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input and Result Type to point to the same type: " + << spvOpcodeString(opcode); + + if (target_storage_class != SpvStorageClassWorkgroup && + target_storage_class != SpvStorageClassCrossWorkgroup && + target_storage_class != SpvStorageClassFunction) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected target storage class to be Workgroup, " + << "CrossWorkgroup or Function: " << spvOpcodeString(opcode); + break; + } + + case SpvOpBitcast: { + const uint32_t input_type = _.GetOperandTypeId(inst, 2); + if (!input_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have a type: " << spvOpcodeString(opcode); + + const bool result_is_pointer = _.IsPointerType(result_type); + const bool result_is_int_scalar = _.IsIntScalarType(result_type); + const bool input_is_pointer = _.IsPointerType(input_type); + const bool input_is_int_scalar = _.IsIntScalarType(input_type); + + if (!result_is_pointer && !result_is_int_scalar && + !_.IsIntVectorType(result_type) && + !_.IsFloatScalarType(result_type) && + !_.IsFloatVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a pointer or int or float vector " + << "or scalar type: " << spvOpcodeString(opcode); + + if (!input_is_pointer && !input_is_int_scalar && + !_.IsIntVectorType(input_type) && !_.IsFloatScalarType(input_type) && + !_.IsFloatVectorType(input_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be a pointer or int or float vector " + << "or scalar: " << spvOpcodeString(opcode); + + if (result_is_pointer && !input_is_pointer && !input_is_int_scalar) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to be a pointer or int scalar if Result Type " + << "is pointer: " << spvOpcodeString(opcode); + + if (input_is_pointer && !result_is_pointer && !result_is_int_scalar) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Pointer can only be converted to another pointer or int " + << "scalar: " << spvOpcodeString(opcode); + + if (!result_is_pointer && !input_is_pointer) { + const uint32_t result_size = + _.GetBitWidth(result_type) * _.GetDimension(result_type); + const uint32_t input_size = + _.GetBitWidth(input_type) * _.GetDimension(input_type); + if (result_size != input_size) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected input to have the same total bit width as " + << "Result Type: " << spvOpcodeString(opcode); + } + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_datarules.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_datarules.cpp new file mode 100644 index 00000000000..129b6bbf98b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_datarules.cpp @@ -0,0 +1,267 @@ +// Copyright (c) 2016 Google 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. + +// Ensures Data Rules are followed according to the specifications. + +#include "source/val/validate.h" + +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Validates that the number of components in the vector is valid. +// Vector types can only be parameterized as having 2, 3, or 4 components. +// If the Vector16 capability is added, 8 and 16 components are also allowed. +spv_result_t ValidateVecNumComponents(ValidationState_t& _, + const Instruction* inst) { + // Operand 2 specifies the number of components in the vector. + auto num_components = inst->GetOperandAs(2); + if (num_components == 2 || num_components == 3 || num_components == 4) { + return SPV_SUCCESS; + } + if (num_components == 8 || num_components == 16) { + if (_.HasCapability(SpvCapabilityVector16)) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Having " << num_components << " components for " + << spvOpcodeString(inst->opcode()) + << " requires the Vector16 capability"; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Illegal number of components (" << num_components << ") for " + << spvOpcodeString(inst->opcode()); +} + +// Validates that the number of bits specifed for a float type is valid. +// Scalar floating-point types can be parameterized only with 32-bits. +// Float16 capability allows using a 16-bit OpTypeFloat. +// Float16Buffer capability allows creation of a 16-bit OpTypeFloat. +// Float64 capability allows using a 64-bit OpTypeFloat. +spv_result_t ValidateFloatSize(ValidationState_t& _, const Instruction* inst) { + // Operand 1 is the number of bits for this float + auto num_bits = inst->GetOperandAs(1); + if (num_bits == 32) { + return SPV_SUCCESS; + } + if (num_bits == 16) { + if (_.features().declare_float16_type) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Using a 16-bit floating point " + << "type requires the Float16 or Float16Buffer capability," + " or an extension that explicitly enables 16-bit floating point."; + } + if (num_bits == 64) { + if (_.HasCapability(SpvCapabilityFloat64)) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Using a 64-bit floating point " + << "type requires the Float64 capability."; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Invalid number of bits (" << num_bits << ") used for OpTypeFloat."; +} + +// Validates that the number of bits specified for an Int type is valid. +// Scalar integer types can be parameterized only with 32-bits. +// Int8, Int16, and Int64 capabilities allow using 8-bit, 16-bit, and 64-bit +// integers, respectively. +spv_result_t ValidateIntSize(ValidationState_t& _, const Instruction* inst) { + // Operand 1 is the number of bits for this integer. + auto num_bits = inst->GetOperandAs(1); + if (num_bits == 32) { + return SPV_SUCCESS; + } + if (num_bits == 8) { + if (_.features().declare_int8_type) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Using an 8-bit integer type requires the Int8 capability," + " or an extension that explicitly enables 8-bit integers."; + } + if (num_bits == 16) { + if (_.features().declare_int16_type) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Using a 16-bit integer type requires the Int16 capability," + " or an extension that explicitly enables 16-bit integers."; + } + if (num_bits == 64) { + if (_.HasCapability(SpvCapabilityInt64)) { + return SPV_SUCCESS; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Using a 64-bit integer type requires the Int64 capability."; + } + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Invalid number of bits (" << num_bits << ") used for OpTypeInt."; +} + +// Validates that the matrix is parameterized with floating-point types. +spv_result_t ValidateMatrixColumnType(ValidationState_t& _, + const Instruction* inst) { + // Find the component type of matrix columns (must be vector). + // Operand 1 is the of the type specified for matrix columns. + auto type_id = inst->GetOperandAs(1); + auto col_type_instr = _.FindDef(type_id); + if (col_type_instr->opcode() != SpvOpTypeVector) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Columns in a matrix must be of type vector."; + } + + // Trace back once more to find out the type of components in the vector. + // Operand 1 is the of the type of data in the vector. + auto comp_type_id = + col_type_instr->words()[col_type_instr->operands()[1].offset]; + auto comp_type_instruction = _.FindDef(comp_type_id); + if (comp_type_instruction->opcode() != SpvOpTypeFloat) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Matrix types can only be " + "parameterized with " + "floating-point types."; + } + return SPV_SUCCESS; +} + +// Validates that the matrix has 2,3, or 4 columns. +spv_result_t ValidateMatrixNumCols(ValidationState_t& _, + const Instruction* inst) { + // Operand 2 is the number of columns in the matrix. + auto num_cols = inst->GetOperandAs(2); + if (num_cols != 2 && num_cols != 3 && num_cols != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Matrix types can only be " + "parameterized as having " + "only 2, 3, or 4 columns."; + } + return SPV_SUCCESS; +} + +// Validates that OpSpecConstant specializes to either int or float type. +spv_result_t ValidateSpecConstNumerical(ValidationState_t& _, + const Instruction* inst) { + // Operand 0 is the of the type that we're specializing to. + auto type_id = inst->GetOperandAs(0); + auto type_instruction = _.FindDef(type_id); + auto type_opcode = type_instruction->opcode(); + if (type_opcode != SpvOpTypeInt && type_opcode != SpvOpTypeFloat) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Specialization constant " + "must be an integer or " + "floating-point number."; + } + return SPV_SUCCESS; +} + +// Validates that OpSpecConstantTrue and OpSpecConstantFalse specialize to bool. +spv_result_t ValidateSpecConstBoolean(ValidationState_t& _, + const Instruction* inst) { + // Find out the type that we're specializing to. + auto type_instruction = _.FindDef(inst->type_id()); + if (type_instruction->opcode() != SpvOpTypeBool) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Specialization constant must be a boolean type."; + } + return SPV_SUCCESS; +} + +// Records the of the forward pointer to be used for validation. +spv_result_t ValidateForwardPointer(ValidationState_t& _, + const Instruction* inst) { + // Record the (which is operand 0) to ensure it's used properly. + // OpTypeStruct can only include undefined pointers that are + // previously declared as a ForwardPointer + return (_.RegisterForwardPointer(inst->GetOperandAs(0))); +} + +// Validates that any undefined component of the struct is a forward pointer. +// It is valid to declare a forward pointer, and use its as one of the +// components of a struct. +spv_result_t ValidateStruct(ValidationState_t& _, const Instruction* inst) { + // Struct components are operands 1, 2, etc. + for (unsigned i = 1; i < inst->operands().size(); i++) { + auto type_id = inst->GetOperandAs(i); + auto type_instruction = _.FindDef(type_id); + if (type_instruction == nullptr && !_.IsForwardPointer(type_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Forward reference operands in an OpTypeStruct must first be " + "declared using OpTypeForwardPointer."; + } + } + return SPV_SUCCESS; +} + +} // namespace + +// Validates that Data Rules are followed according to the specifications. +// (Data Rules subsection of 2.16.1 Universal Validation Rules) +spv_result_t DataRulesPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpTypeVector: { + if (auto error = ValidateVecNumComponents(_, inst)) return error; + break; + } + case SpvOpTypeFloat: { + if (auto error = ValidateFloatSize(_, inst)) return error; + break; + } + case SpvOpTypeInt: { + if (auto error = ValidateIntSize(_, inst)) return error; + break; + } + case SpvOpTypeMatrix: { + if (auto error = ValidateMatrixColumnType(_, inst)) return error; + if (auto error = ValidateMatrixNumCols(_, inst)) return error; + break; + } + // TODO(ehsan): Add OpSpecConstantComposite validation code. + // TODO(ehsan): Add OpSpecConstantOp validation code (if any). + case SpvOpSpecConstant: { + if (auto error = ValidateSpecConstNumerical(_, inst)) return error; + break; + } + case SpvOpSpecConstantFalse: + case SpvOpSpecConstantTrue: { + if (auto error = ValidateSpecConstBoolean(_, inst)) return error; + break; + } + case SpvOpTypeForwardPointer: { + if (auto error = ValidateForwardPointer(_, inst)) return error; + break; + } + case SpvOpTypeStruct: { + if (auto error = ValidateStruct(_, inst)) return error; + break; + } + // TODO(ehsan): add more data rules validation here. + default: { break; } + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp new file mode 100644 index 00000000000..d84ed3801fe --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_debug.cpp @@ -0,0 +1,72 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateMemberName(ValidationState_t& _, const Instruction* inst) { + const auto type_id = inst->GetOperandAs(0); + const auto type = _.FindDef(type_id); + if (!type || SpvOpTypeStruct != type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberName Type '" << _.getIdName(type_id) + << "' is not a struct type."; + } + const auto member_id = inst->GetOperandAs(1); + const auto member_count = (uint32_t)(type->words().size() - 2); + if (member_count <= member_id) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberName Member '" << _.getIdName(member_id) + << "' index is larger than Type '" << _.getIdName(type->id()) + << "'s member count."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateLine(ValidationState_t& _, const Instruction* inst) { + const auto file_id = inst->GetOperandAs(0); + const auto file = _.FindDef(file_id); + if (!file || SpvOpString != file->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpLine Target '" << _.getIdName(file_id) + << "' is not an OpString."; + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t DebugPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpMemberName: + if (auto error = ValidateMemberName(_, inst)) return error; + break; + case SpvOpLine: + if (auto error = ValidateLine(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp new file mode 100644 index 00000000000..ed312f73f73 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_decorations.cpp @@ -0,0 +1,856 @@ +// Copyright (c) 2017 Google 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. + +#include "source/val/validate.h" + +#include +#include +#include +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/spirv_target_env.h" +#include "source/spirv_validator_options.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Distinguish between row and column major matrix layouts. +enum MatrixLayout { kRowMajor, kColumnMajor }; + +// A functor for hashing a pair of integers. +struct PairHash { + std::size_t operator()(const std::pair pair) const { + const uint32_t a = pair.first; + const uint32_t b = pair.second; + const uint32_t rotated_b = (b >> 2) | ((b & 3) << 30); + return a ^ rotated_b; + } +}; + +// Struct member layout attributes that are inherited through arrays. +struct LayoutConstraints { + explicit LayoutConstraints( + MatrixLayout the_majorness = MatrixLayout::kColumnMajor, + uint32_t stride = 0) + : majorness(the_majorness), matrix_stride(stride) {} + MatrixLayout majorness; + uint32_t matrix_stride; +}; + +// A type for mapping (struct id, member id) to layout constraints. +using MemberConstraints = std::unordered_map, + LayoutConstraints, PairHash>; + +// Returns the array stride of the given array type. +uint32_t GetArrayStride(uint32_t array_id, ValidationState_t& vstate) { + for (auto& decoration : vstate.id_decorations(array_id)) { + if (SpvDecorationArrayStride == decoration.dec_type()) { + return decoration.params()[0]; + } + } + return 0; +} + +// Returns true if the given variable has a BuiltIn decoration. +bool isBuiltInVar(uint32_t var_id, ValidationState_t& vstate) { + const auto& decorations = vstate.id_decorations(var_id); + return std::any_of( + decorations.begin(), decorations.end(), + [](const Decoration& d) { return SpvDecorationBuiltIn == d.dec_type(); }); +} + +// Returns true if the given structure type has any members with BuiltIn +// decoration. +bool isBuiltInStruct(uint32_t struct_id, ValidationState_t& vstate) { + const auto& decorations = vstate.id_decorations(struct_id); + return std::any_of( + decorations.begin(), decorations.end(), [](const Decoration& d) { + return SpvDecorationBuiltIn == d.dec_type() && + Decoration::kInvalidMember != d.struct_member_index(); + }); +} + +// Returns true if the given ID has the Import LinkageAttributes decoration. +bool hasImportLinkageAttribute(uint32_t id, ValidationState_t& vstate) { + const auto& decorations = vstate.id_decorations(id); + return std::any_of(decorations.begin(), decorations.end(), + [](const Decoration& d) { + return SpvDecorationLinkageAttributes == d.dec_type() && + d.params().size() >= 2u && + d.params().back() == SpvLinkageTypeImport; + }); +} + +// Returns a vector of all members of a structure. +std::vector getStructMembers(uint32_t struct_id, + ValidationState_t& vstate) { + const auto inst = vstate.FindDef(struct_id); + return std::vector(inst->words().begin() + 2, inst->words().end()); +} + +// Returns a vector of all members of a structure that have specific type. +std::vector getStructMembers(uint32_t struct_id, SpvOp type, + ValidationState_t& vstate) { + std::vector members; + for (auto id : getStructMembers(struct_id, vstate)) { + if (type == vstate.FindDef(id)->opcode()) { + members.push_back(id); + } + } + return members; +} + +// Returns whether the given structure is missing Offset decoration for any +// member. Handles also nested structures. +bool isMissingOffsetInStruct(uint32_t struct_id, ValidationState_t& vstate) { + std::vector hasOffset(getStructMembers(struct_id, vstate).size(), + false); + // Check offsets of member decorations + for (auto& decoration : vstate.id_decorations(struct_id)) { + if (SpvDecorationOffset == decoration.dec_type() && + Decoration::kInvalidMember != decoration.struct_member_index()) { + hasOffset[decoration.struct_member_index()] = true; + } + } + // Check also nested structures + bool nestedStructsMissingOffset = false; + for (auto id : getStructMembers(struct_id, SpvOpTypeStruct, vstate)) { + if (isMissingOffsetInStruct(id, vstate)) { + nestedStructsMissingOffset = true; + break; + } + } + return nestedStructsMissingOffset || + !std::all_of(hasOffset.begin(), hasOffset.end(), + [](const bool b) { return b; }); +} + +// Rounds x up to the next alignment. Assumes alignment is a power of two. +uint32_t align(uint32_t x, uint32_t alignment) { + return (x + alignment - 1) & ~(alignment - 1); +} + +// Returns base alignment of struct member. If |roundUp| is true, also +// ensure that structs and arrays are aligned at least to a multiple of 16 +// bytes. +uint32_t getBaseAlignment(uint32_t member_id, bool roundUp, + const LayoutConstraints& inherited, + MemberConstraints& constraints, + ValidationState_t& vstate) { + const auto inst = vstate.FindDef(member_id); + const auto& words = inst->words(); + uint32_t baseAlignment = 0; + switch (inst->opcode()) { + case SpvOpTypeInt: + case SpvOpTypeFloat: + baseAlignment = words[2] / 8; + break; + case SpvOpTypeVector: { + const auto componentId = words[2]; + const auto numComponents = words[3]; + const auto componentAlignment = getBaseAlignment( + componentId, roundUp, inherited, constraints, vstate); + baseAlignment = + componentAlignment * (numComponents == 3 ? 4 : numComponents); + break; + } + case SpvOpTypeMatrix: { + const auto column_type = words[2]; + if (inherited.majorness == kColumnMajor) { + baseAlignment = getBaseAlignment(column_type, roundUp, inherited, + constraints, vstate); + } else { + // A row-major matrix of C columns has a base alignment equal to the + // base alignment of a vector of C matrix components. + const auto num_columns = words[3]; + const auto component_inst = vstate.FindDef(column_type); + const auto component_id = component_inst->words()[2]; + const auto componentAlignment = getBaseAlignment( + component_id, roundUp, inherited, constraints, vstate); + baseAlignment = + componentAlignment * (num_columns == 3 ? 4 : num_columns); + } + } break; + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: + baseAlignment = + getBaseAlignment(words[2], roundUp, inherited, constraints, vstate); + if (roundUp) baseAlignment = align(baseAlignment, 16u); + break; + case SpvOpTypeStruct: { + const auto members = getStructMembers(member_id, vstate); + for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); + memberIdx < numMembers; ++memberIdx) { + const auto id = members[memberIdx]; + const auto& constraint = + constraints[std::make_pair(member_id, memberIdx)]; + baseAlignment = std::max( + baseAlignment, + getBaseAlignment(id, roundUp, constraint, constraints, vstate)); + } + if (roundUp) baseAlignment = align(baseAlignment, 16u); + break; + } + default: + assert(0); + break; + } + + return baseAlignment; +} + +// Returns size of a struct member. Doesn't include padding at the end of struct +// or array. Assumes that in the struct case, all members have offsets. +uint32_t getSize(uint32_t member_id, bool roundUp, + const LayoutConstraints& inherited, + MemberConstraints& constraints, ValidationState_t& vstate) { + const auto inst = vstate.FindDef(member_id); + const auto& words = inst->words(); + switch (inst->opcode()) { + case SpvOpTypeInt: + case SpvOpTypeFloat: + return getBaseAlignment(member_id, roundUp, inherited, constraints, + vstate); + case SpvOpTypeVector: { + const auto componentId = words[2]; + const auto numComponents = words[3]; + const auto componentSize = + getSize(componentId, roundUp, inherited, constraints, vstate); + const auto size = componentSize * numComponents; + return size; + } + case SpvOpTypeArray: { + const auto sizeInst = vstate.FindDef(words[3]); + if (spvOpcodeIsSpecConstant(sizeInst->opcode())) return 0; + assert(SpvOpConstant == sizeInst->opcode()); + const uint32_t num_elem = sizeInst->words()[3]; + const uint32_t elem_type = words[2]; + const uint32_t elem_size = + getSize(elem_type, roundUp, inherited, constraints, vstate); + // Account for gaps due to alignments in the first N-1 elements, + // then add the size of the last element. + const auto size = + (num_elem - 1) * GetArrayStride(member_id, vstate) + elem_size; + return size; + } + case SpvOpTypeRuntimeArray: + return 0; + case SpvOpTypeMatrix: { + const auto num_columns = words[3]; + if (inherited.majorness == kColumnMajor) { + return num_columns * inherited.matrix_stride; + } else { + // Row major case. + const auto column_type = words[2]; + const auto component_inst = vstate.FindDef(column_type); + const auto num_rows = component_inst->words()[3]; + const auto scalar_elem_type = component_inst->words()[2]; + const uint32_t scalar_elem_size = + getSize(scalar_elem_type, roundUp, inherited, constraints, vstate); + return (num_rows - 1) * inherited.matrix_stride + + num_columns * scalar_elem_size; + } + } + case SpvOpTypeStruct: { + const auto& members = getStructMembers(member_id, vstate); + if (members.empty()) return 0; + const auto lastIdx = uint32_t(members.size() - 1); + const auto& lastMember = members.back(); + uint32_t offset = 0xffffffff; + // Find the offset of the last element and add the size. + for (auto& decoration : vstate.id_decorations(member_id)) { + if (SpvDecorationOffset == decoration.dec_type() && + decoration.struct_member_index() == (int)lastIdx) { + offset = decoration.params()[0]; + } + } + // This check depends on the fact that all members have offsets. This + // has been checked earlier in the flow. + assert(offset != 0xffffffff); + const auto& constraint = constraints[std::make_pair(lastMember, lastIdx)]; + return offset + + getSize(lastMember, roundUp, constraint, constraints, vstate); + } + default: + assert(0); + return 0; + } +} + +// A member is defined to improperly straddle if either of the following are +// true: +// - It is a vector with total size less than or equal to 16 bytes, and has +// Offset decorations placing its first byte at F and its last byte at L, where +// floor(F / 16) != floor(L / 16). +// - It is a vector with total size greater than 16 bytes and has its Offset +// decorations placing its first byte at a non-integer multiple of 16. +bool hasImproperStraddle(uint32_t id, uint32_t offset, + const LayoutConstraints& inherited, + MemberConstraints& constraints, + ValidationState_t& vstate) { + const auto size = getSize(id, false, inherited, constraints, vstate); + const auto F = offset; + const auto L = offset + size - 1; + if (size <= 16) { + if ((F >> 4) != (L >> 4)) return true; + } else { + if (F % 16 != 0) return true; + } + return false; +} + +// Returns true if |offset| satsifies an alignment to |alignment|. In the case +// of |alignment| of zero, the |offset| must also be zero. +bool IsAlignedTo(uint32_t offset, uint32_t alignment) { + if (alignment == 0) return offset == 0; + return 0 == (offset % alignment); +} + +// Returns SPV_SUCCESS if the given struct satisfies standard layout rules for +// Block or BufferBlocks in Vulkan. Otherwise emits a diagnostic and returns +// something other than SPV_SUCCESS. Matrices inherit the specified column +// or row major-ness. +spv_result_t checkLayout(uint32_t struct_id, const char* storage_class_str, + const char* decoration_str, bool blockRules, + MemberConstraints& constraints, + ValidationState_t& vstate) { + if (vstate.options()->skip_block_layout) return SPV_SUCCESS; + + auto fail = [&vstate, struct_id, storage_class_str, decoration_str, + blockRules](uint32_t member_idx) -> DiagnosticStream { + DiagnosticStream ds = + std::move(vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(struct_id)) + << "Structure id " << struct_id << " decorated as " + << decoration_str << " for variable in " << storage_class_str + << " storage class must follow standard " + << (blockRules ? "uniform buffer" : "storage buffer") + << " layout rules: member " << member_idx << " "); + return ds; + }; + + const bool relaxed_block_layout = vstate.IsRelaxedBlockLayout(); + const auto& members = getStructMembers(struct_id, vstate); + + // To check for member overlaps, we want to traverse the members in + // offset order. + struct MemberOffsetPair { + uint32_t member; + uint32_t offset; + }; + std::vector member_offsets; + member_offsets.reserve(members.size()); + for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); + memberIdx < numMembers; memberIdx++) { + uint32_t offset = 0xffffffff; + for (auto& decoration : vstate.id_decorations(struct_id)) { + if (decoration.struct_member_index() == (int)memberIdx) { + switch (decoration.dec_type()) { + case SpvDecorationOffset: + offset = decoration.params()[0]; + break; + default: + break; + } + } + } + member_offsets.push_back(MemberOffsetPair{memberIdx, offset}); + } + std::stable_sort( + member_offsets.begin(), member_offsets.end(), + [](const MemberOffsetPair& lhs, const MemberOffsetPair& rhs) { + return lhs.offset < rhs.offset; + }); + + // Now scan from lowest offest to highest offset. + uint32_t nextValidOffset = 0; + for (size_t ordered_member_idx = 0; + ordered_member_idx < member_offsets.size(); ordered_member_idx++) { + const auto& member_offset = member_offsets[ordered_member_idx]; + const auto memberIdx = member_offset.member; + const auto offset = member_offset.offset; + auto id = members[member_offset.member]; + const LayoutConstraints& constraint = + constraints[std::make_pair(struct_id, uint32_t(memberIdx))]; + const auto alignment = + getBaseAlignment(id, blockRules, constraint, constraints, vstate); + const auto inst = vstate.FindDef(id); + const auto opcode = inst->opcode(); + const auto size = getSize(id, blockRules, constraint, constraints, vstate); + // Check offset. + if (offset == 0xffffffff) + return fail(memberIdx) << "is missing an Offset decoration"; + if (relaxed_block_layout && opcode == SpvOpTypeVector) { + // In relaxed block layout, the vector offset must be aligned to the + // vector's scalar element type. + const auto componentId = inst->words()[2]; + const auto scalar_alignment = getBaseAlignment( + componentId, blockRules, constraint, constraints, vstate); + if (!IsAlignedTo(offset, scalar_alignment)) { + return fail(memberIdx) + << "at offset " << offset + << " is not aligned to scalar element size " << scalar_alignment; + } + } else { + // Without relaxed block layout, the offset must be divisible by the + // base alignment. + if (!IsAlignedTo(offset, alignment)) { + return fail(memberIdx) + << "at offset " << offset << " is not aligned to " << alignment; + } + } + if (offset < nextValidOffset) + return fail(memberIdx) << "at offset " << offset + << " overlaps previous member ending at offset " + << nextValidOffset - 1; + if (relaxed_block_layout) { + // Check improper straddle of vectors. + if (SpvOpTypeVector == opcode && + hasImproperStraddle(id, offset, constraint, constraints, vstate)) + return fail(memberIdx) + << "is an improperly straddling vector at offset " << offset; + } + // Check struct members recursively. + spv_result_t recursive_status = SPV_SUCCESS; + if (SpvOpTypeStruct == opcode && + SPV_SUCCESS != (recursive_status = + checkLayout(id, storage_class_str, decoration_str, + blockRules, constraints, vstate))) + return recursive_status; + // Check matrix stride. + if (SpvOpTypeMatrix == opcode) { + for (auto& decoration : vstate.id_decorations(id)) { + if (SpvDecorationMatrixStride == decoration.dec_type() && + !IsAlignedTo(decoration.params()[0], alignment)) + return fail(memberIdx) + << "is a matrix with stride " << decoration.params()[0] + << " not satisfying alignment to " << alignment; + } + } + // Check arrays. + if (SpvOpTypeArray == opcode) { + const auto typeId = inst->word(2); + const auto arrayInst = vstate.FindDef(typeId); + if (SpvOpTypeStruct == arrayInst->opcode() && + SPV_SUCCESS != (recursive_status = checkLayout( + typeId, storage_class_str, decoration_str, + blockRules, constraints, vstate))) + return recursive_status; + // Check array stride. + for (auto& decoration : vstate.id_decorations(id)) { + if (SpvDecorationArrayStride == decoration.dec_type() && + !IsAlignedTo(decoration.params()[0], alignment)) + return fail(memberIdx) + << "is an array with stride " << decoration.params()[0] + << " not satisfying alignment to " << alignment; + } + } + nextValidOffset = offset + size; + if (blockRules && (SpvOpTypeArray == opcode || SpvOpTypeStruct == opcode)) { + // Uniform block rules don't permit anything in the padding of a struct + // or array. + nextValidOffset = align(nextValidOffset, alignment); + } + } + return SPV_SUCCESS; +} + +// Returns true if structure id has given decoration. Handles also nested +// structures. +bool hasDecoration(uint32_t struct_id, SpvDecoration decoration, + ValidationState_t& vstate) { + for (auto& dec : vstate.id_decorations(struct_id)) { + if (decoration == dec.dec_type()) return true; + } + for (auto id : getStructMembers(struct_id, SpvOpTypeStruct, vstate)) { + if (hasDecoration(id, decoration, vstate)) { + return true; + } + } + return false; +} + +// Returns true if all ids of given type have a specified decoration. +bool checkForRequiredDecoration(uint32_t struct_id, SpvDecoration decoration, + SpvOp type, ValidationState_t& vstate) { + const auto& members = getStructMembers(struct_id, vstate); + for (size_t memberIdx = 0; memberIdx < members.size(); memberIdx++) { + const auto id = members[memberIdx]; + if (type != vstate.FindDef(id)->opcode()) continue; + bool found = false; + for (auto& dec : vstate.id_decorations(id)) { + if (decoration == dec.dec_type()) found = true; + } + for (auto& dec : vstate.id_decorations(struct_id)) { + if (decoration == dec.dec_type() && + (int)memberIdx == dec.struct_member_index()) { + found = true; + } + } + if (!found) { + return false; + } + } + for (auto id : getStructMembers(struct_id, SpvOpTypeStruct, vstate)) { + if (!checkForRequiredDecoration(id, decoration, type, vstate)) { + return false; + } + } + return true; +} + +spv_result_t CheckLinkageAttrOfFunctions(ValidationState_t& vstate) { + for (const auto& function : vstate.functions()) { + if (function.block_count() == 0u) { + // A function declaration (an OpFunction with no basic blocks), must have + // a Linkage Attributes Decoration with the Import Linkage Type. + if (!hasImportLinkageAttribute(function.id(), vstate)) { + return vstate.diag(SPV_ERROR_INVALID_BINARY, + vstate.FindDef(function.id())) + << "Function declaration (id " << function.id() + << ") must have a LinkageAttributes decoration with the Import " + "Linkage type."; + } + } else { + if (hasImportLinkageAttribute(function.id(), vstate)) { + return vstate.diag(SPV_ERROR_INVALID_BINARY, + vstate.FindDef(function.id())) + << "Function definition (id " << function.id() + << ") may not be decorated with Import Linkage type."; + } + } + } + return SPV_SUCCESS; +} + +// Checks whether an imported variable is initialized by this module. +spv_result_t CheckImportedVariableInitialization(ValidationState_t& vstate) { + // According the SPIR-V Spec 2.16.1, it is illegal to initialize an imported + // variable. This means that a module-scope OpVariable with initialization + // value cannot be marked with the Import Linkage Type (import type id = 1). + for (auto global_var_id : vstate.global_vars()) { + // Initializer is an optional argument for OpVariable. If initializer + // is present, the instruction will have 5 words. + auto variable_instr = vstate.FindDef(global_var_id); + if (variable_instr->words().size() == 5u && + hasImportLinkageAttribute(global_var_id, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, variable_instr) + << "A module-scope OpVariable with initialization value " + "cannot be marked with the Import Linkage Type."; + } + } + return SPV_SUCCESS; +} + +// Checks whether a builtin variable is valid. +spv_result_t CheckBuiltInVariable(uint32_t var_id, ValidationState_t& vstate) { + const auto& decorations = vstate.id_decorations(var_id); + for (const auto& d : decorations) { + if (spvIsVulkanEnv(vstate.context()->target_env)) { + if (d.dec_type() == SpvDecorationLocation || + d.dec_type() == SpvDecorationComponent) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(var_id)) + << "A BuiltIn variable (id " << var_id + << ") cannot have any Location or Component decorations"; + } + } + } + return SPV_SUCCESS; +} + +// Checks whether proper decorations have been appied to the entry points. +spv_result_t CheckDecorationsOfEntryPoints(ValidationState_t& vstate) { + for (uint32_t entry_point : vstate.entry_points()) { + const auto& descs = vstate.entry_point_descriptions(entry_point); + int num_builtin_inputs = 0; + int num_builtin_outputs = 0; + for (const auto& desc : descs) { + for (auto interface : desc.interfaces) { + Instruction* var_instr = vstate.FindDef(interface); + if (!var_instr || SpvOpVariable != var_instr->opcode()) { + return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) + << "Interfaces passed to OpEntryPoint must be of type " + "OpTypeVariable. Found Op" + << spvOpcodeString(var_instr->opcode()) << "."; + } + const SpvStorageClass storage_class = + var_instr->GetOperandAs(2); + if (storage_class != SpvStorageClassInput && + storage_class != SpvStorageClassOutput) { + return vstate.diag(SPV_ERROR_INVALID_ID, var_instr) + << "OpEntryPoint interfaces must be OpVariables with " + "Storage Class of Input(1) or Output(3). Found Storage " + "Class " + << storage_class << " for Entry Point id " << entry_point + << "."; + } + + const uint32_t ptr_id = var_instr->word(1); + Instruction* ptr_instr = vstate.FindDef(ptr_id); + // It is guaranteed (by validator ID checks) that ptr_instr is + // OpTypePointer. Word 3 of this instruction is the type being pointed + // to. + const uint32_t type_id = ptr_instr->word(3); + Instruction* type_instr = vstate.FindDef(type_id); + if (type_instr && SpvOpTypeStruct == type_instr->opcode() && + isBuiltInStruct(type_id, vstate)) { + if (storage_class == SpvStorageClassInput) ++num_builtin_inputs; + if (storage_class == SpvStorageClassOutput) ++num_builtin_outputs; + if (num_builtin_inputs > 1 || num_builtin_outputs > 1) break; + if (auto error = CheckBuiltInVariable(interface, vstate)) + return error; + } else if (isBuiltInVar(interface, vstate)) { + if (auto error = CheckBuiltInVariable(interface, vstate)) + return error; + } + } + if (num_builtin_inputs > 1 || num_builtin_outputs > 1) { + return vstate.diag(SPV_ERROR_INVALID_BINARY, + vstate.FindDef(entry_point)) + << "There must be at most one object per Storage Class that can " + "contain a structure type containing members decorated with " + "BuiltIn, consumed per entry-point. Entry Point id " + << entry_point << " does not meet this requirement."; + } + // The LinkageAttributes Decoration cannot be applied to functions + // targeted by an OpEntryPoint instruction + for (auto& decoration : vstate.id_decorations(entry_point)) { + if (SpvDecorationLinkageAttributes == decoration.dec_type()) { + const char* linkage_name = + reinterpret_cast(&decoration.params()[0]); + return vstate.diag(SPV_ERROR_INVALID_BINARY, + vstate.FindDef(entry_point)) + << "The LinkageAttributes Decoration (Linkage name: " + << linkage_name << ") cannot be applied to function id " + << entry_point + << " because it is targeted by an OpEntryPoint instruction."; + } + } + } + } + return SPV_SUCCESS; +} + +spv_result_t CheckDescriptorSetArrayOfArrays(ValidationState_t& vstate) { + for (const auto& inst : vstate.ordered_instructions()) { + if (SpvOpVariable != inst.opcode()) continue; + + // Verify this variable is a DescriptorSet + bool has_descriptor_set = false; + for (const auto& decoration : vstate.id_decorations(inst.id())) { + if (SpvDecorationDescriptorSet == decoration.dec_type()) { + has_descriptor_set = true; + break; + } + } + if (!has_descriptor_set) continue; + + const auto* ptrInst = vstate.FindDef(inst.word(1)); + assert(SpvOpTypePointer == ptrInst->opcode()); + + // Check for a first level array + const auto typePtr = vstate.FindDef(ptrInst->word(3)); + if (SpvOpTypeRuntimeArray != typePtr->opcode() && + SpvOpTypeArray != typePtr->opcode()) { + continue; + } + + // Check for a second level array + const auto secondaryTypePtr = vstate.FindDef(typePtr->word(2)); + if (SpvOpTypeRuntimeArray == secondaryTypePtr->opcode() || + SpvOpTypeArray == secondaryTypePtr->opcode()) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << "Only a single level of array is allowed for descriptor " + "set variables"; + } + } + return SPV_SUCCESS; +} + +// Load |constraints| with all the member constraints for structs contained +// within the given array type. +void ComputeMemberConstraintsForArray(MemberConstraints* constraints, + uint32_t array_id, + const LayoutConstraints& inherited, + ValidationState_t& vstate); + +// Load |constraints| with all the member constraints for the given struct, +// and all its contained structs. +void ComputeMemberConstraintsForStruct(MemberConstraints* constraints, + uint32_t struct_id, + const LayoutConstraints& inherited, + ValidationState_t& vstate) { + assert(constraints); + const auto& members = getStructMembers(struct_id, vstate); + for (uint32_t memberIdx = 0, numMembers = uint32_t(members.size()); + memberIdx < numMembers; memberIdx++) { + LayoutConstraints& constraint = + (*constraints)[std::make_pair(struct_id, memberIdx)]; + constraint = inherited; + for (auto& decoration : vstate.id_decorations(struct_id)) { + if (decoration.struct_member_index() == (int)memberIdx) { + switch (decoration.dec_type()) { + case SpvDecorationRowMajor: + constraint.majorness = kRowMajor; + break; + case SpvDecorationColMajor: + constraint.majorness = kColumnMajor; + break; + case SpvDecorationMatrixStride: + constraint.matrix_stride = decoration.params()[0]; + break; + default: + break; + } + } + } + + // Now recurse + auto member_type_id = members[memberIdx]; + const auto member_type_inst = vstate.FindDef(member_type_id); + const auto opcode = member_type_inst->opcode(); + switch (opcode) { + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: + ComputeMemberConstraintsForArray(constraints, member_type_id, inherited, + vstate); + break; + case SpvOpTypeStruct: + ComputeMemberConstraintsForStruct(constraints, member_type_id, + inherited, vstate); + break; + default: + break; + } + } +} + +void ComputeMemberConstraintsForArray(MemberConstraints* constraints, + uint32_t array_id, + const LayoutConstraints& inherited, + ValidationState_t& vstate) { + assert(constraints); + auto elem_type_id = vstate.FindDef(array_id)->words()[2]; + const auto elem_type_inst = vstate.FindDef(elem_type_id); + const auto opcode = elem_type_inst->opcode(); + switch (opcode) { + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: + ComputeMemberConstraintsForArray(constraints, elem_type_id, inherited, + vstate); + break; + case SpvOpTypeStruct: + ComputeMemberConstraintsForStruct(constraints, elem_type_id, inherited, + vstate); + break; + default: + break; + } +} + +spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { + for (const auto& inst : vstate.ordered_instructions()) { + const auto& words = inst.words(); + if (SpvOpVariable == inst.opcode()) { + // For storage class / decoration combinations, see Vulkan 14.5.4 "Offset + // and Stride Assignment". + const auto storageClass = words[3]; + const bool uniform = storageClass == SpvStorageClassUniform; + const bool push_constant = storageClass == SpvStorageClassPushConstant; + const bool storage_buffer = storageClass == SpvStorageClassStorageBuffer; + if (uniform || push_constant || storage_buffer) { + const auto ptrInst = vstate.FindDef(words[1]); + assert(SpvOpTypePointer == ptrInst->opcode()); + const auto id = ptrInst->words()[3]; + if (SpvOpTypeStruct != vstate.FindDef(id)->opcode()) continue; + MemberConstraints constraints; + ComputeMemberConstraintsForStruct(&constraints, id, LayoutConstraints(), + vstate); + // Prepare for messages + const char* sc_str = + uniform ? "Uniform" + : (push_constant ? "PushConstant" : "StorageBuffer"); + for (const auto& dec : vstate.id_decorations(id)) { + const bool blockDeco = SpvDecorationBlock == dec.dec_type(); + const bool bufferDeco = SpvDecorationBufferBlock == dec.dec_type(); + const bool blockRules = uniform && blockDeco; + const bool bufferRules = (uniform && bufferDeco) || + (push_constant && blockDeco) || + (storage_buffer && blockDeco); + if (blockRules || bufferRules) { + const char* deco_str = blockDeco ? "Block" : "BufferBlock"; + spv_result_t recursive_status = SPV_SUCCESS; + if (isMissingOffsetInStruct(id, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) + << "Structure id " << id << " decorated as " << deco_str + << " must be explicitly laid out with Offset decorations."; + } else if (hasDecoration(id, SpvDecorationGLSLShared, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) + << "Structure id " << id << " decorated as " << deco_str + << " must not use GLSLShared decoration."; + } else if (hasDecoration(id, SpvDecorationGLSLPacked, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) + << "Structure id " << id << " decorated as " << deco_str + << " must not use GLSLPacked decoration."; + } else if (!checkForRequiredDecoration(id, SpvDecorationArrayStride, + SpvOpTypeArray, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) + << "Structure id " << id << " decorated as " << deco_str + << " must be explicitly laid out with ArrayStride " + "decorations."; + } else if (!checkForRequiredDecoration(id, + SpvDecorationMatrixStride, + SpvOpTypeMatrix, vstate)) { + return vstate.diag(SPV_ERROR_INVALID_ID, vstate.FindDef(id)) + << "Structure id " << id << " decorated as " << deco_str + << " must be explicitly laid out with MatrixStride " + "decorations."; + } else if (blockRules && + (SPV_SUCCESS != (recursive_status = checkLayout( + id, sc_str, deco_str, true, + constraints, vstate)))) { + return recursive_status; + } else if (bufferRules && + (SPV_SUCCESS != (recursive_status = checkLayout( + id, sc_str, deco_str, false, + constraints, vstate)))) { + return recursive_status; + } + } + } + } + } + } + return SPV_SUCCESS; +} + +} // namespace + +// Validates that decorations have been applied properly. +spv_result_t ValidateDecorations(ValidationState_t& vstate) { + if (auto error = CheckImportedVariableInitialization(vstate)) return error; + if (auto error = CheckDecorationsOfEntryPoints(vstate)) return error; + if (auto error = CheckDecorationsOfBuffers(vstate)) return error; + if (auto error = CheckLinkageAttrOfFunctions(vstate)) return error; + if (auto error = CheckDescriptorSetArrayOfArrays(vstate)) return error; + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp new file mode 100644 index 00000000000..0e0dbbe3d23 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_derivatives.cpp @@ -0,0 +1,74 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of derivative SPIR-V instructions. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates correctness of derivative instructions. +spv_result_t DerivativesPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + switch (opcode) { + case SpvOpDPdx: + case SpvOpDPdy: + case SpvOpFwidth: + case SpvOpDPdxFine: + case SpvOpDPdyFine: + case SpvOpFwidthFine: + case SpvOpDPdxCoarse: + case SpvOpDPdyCoarse: + case SpvOpFwidthCoarse: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be float scalar or vector type: " + << spvOpcodeString(opcode); + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 2); + if (p_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected P type and Result Type to be the same: " + << spvOpcodeString(opcode); + } + + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + std::string("Derivative instructions require Fragment execution " + "model: ") + + spvOpcodeString(opcode)); + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp new file mode 100644 index 00000000000..d4493077011 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_execution_limitations.cpp @@ -0,0 +1,61 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include "source/val/function.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +spv_result_t ValidateExecutionLimitations(ValidationState_t& _, + const Instruction* inst) { + if (inst->opcode() != SpvOpFunction) { + return SPV_SUCCESS; + } + + const auto func = _.function(inst->id()); + if (!func) { + return _.diag(SPV_ERROR_INTERNAL, inst) + << "Internal error: missing function id " << inst->id() << "."; + } + + for (uint32_t entry_id : _.FunctionEntryPoints(inst->id())) { + const auto* models = _.GetExecutionModels(entry_id); + if (models) { + if (models->empty()) { + return _.diag(SPV_ERROR_INTERNAL, inst) + << "Internal error: empty execution models for function id " + << entry_id << "."; + } + for (const auto model : *models) { + std::string reason; + if (!func->IsCompatibleWithExecutionModel(model, &reason)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_id) + << "'s callgraph contains function " + << _.getIdName(inst->id()) + << ", which cannot be used with the current execution " + "model:\n" + << reason; + } + } + } + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_ext_inst.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_ext_inst.cpp new file mode 100644 index 00000000000..eb3427090e9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_ext_inst.cpp @@ -0,0 +1,1990 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of ExtInst SPIR-V instructions. + +#include "source/val/validate.h" + +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +uint32_t GetSizeTBitWidth(const ValidationState_t& _) { + if (_.addressing_model() == SpvAddressingModelPhysical32) return 32; + + if (_.addressing_model() == SpvAddressingModelPhysical64) return 64; + + return 0; +} + +} // anonymous namespace + +// Validates correctness of ExtInst instructions. +spv_result_t ExtInstPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + const uint32_t num_operands = static_cast(inst->operands().size()); + + if (opcode != SpvOpExtInst) return SPV_SUCCESS; + + const uint32_t ext_inst_set = inst->word(3); + const uint32_t ext_inst_index = inst->word(4); + const spv_ext_inst_type_t ext_inst_type = + spv_ext_inst_type_t(inst->ext_inst_type()); + + auto ext_inst_name = [&_, ext_inst_set, ext_inst_type, ext_inst_index]() { + spv_ext_inst_desc desc = nullptr; + if (_.grammar().lookupExtInst(ext_inst_type, ext_inst_index, &desc) != + SPV_SUCCESS || + !desc) { + return std::string("Unknown ExtInst"); + } + + auto* import_inst = _.FindDef(ext_inst_set); + assert(import_inst); + + std::ostringstream ss; + ss << reinterpret_cast(import_inst->words().data() + 2); + ss << " "; + ss << desc->name; + + return ss.str(); + }; + + if (ext_inst_type == SPV_EXT_INST_TYPE_GLSL_STD_450) { + const GLSLstd450 ext_inst_key = GLSLstd450(ext_inst_index); + switch (ext_inst_key) { + case GLSLstd450Round: + case GLSLstd450RoundEven: + case GLSLstd450FAbs: + case GLSLstd450Trunc: + case GLSLstd450FSign: + case GLSLstd450Floor: + case GLSLstd450Ceil: + case GLSLstd450Fract: + case GLSLstd450Sqrt: + case GLSLstd450InverseSqrt: + case GLSLstd450FMin: + case GLSLstd450FMax: + case GLSLstd450FClamp: + case GLSLstd450FMix: + case GLSLstd450Step: + case GLSLstd450SmoothStep: + case GLSLstd450Fma: + case GLSLstd450Normalize: + case GLSLstd450FaceForward: + case GLSLstd450Reflect: + case GLSLstd450NMin: + case GLSLstd450NMax: + case GLSLstd450NClamp: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case GLSLstd450SAbs: + case GLSLstd450SSign: + case GLSLstd450UMin: + case GLSLstd450SMin: + case GLSLstd450UMax: + case GLSLstd450SMax: + case GLSLstd450UClamp: + case GLSLstd450SClamp: + case GLSLstd450FindILsb: + case GLSLstd450FindUMsb: + case GLSLstd450FindSMsb: { + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int scalar or vector type"; + } + + const uint32_t result_type_bit_width = _.GetBitWidth(result_type); + const uint32_t result_type_dimension = _.GetDimension(result_type); + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (!_.IsIntScalarOrVectorType(operand_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected all operands to be int scalars or vectors"; + } + + if (result_type_dimension != _.GetDimension(operand_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected all operands to have the same dimension as " + << "Result Type"; + } + + if (result_type_bit_width != _.GetBitWidth(operand_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected all operands to have the same bit width as " + << "Result Type"; + } + + if (ext_inst_key == GLSLstd450FindUMsb || + ext_inst_key == GLSLstd450FindSMsb) { + if (result_type_bit_width != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "this instruction is currently limited to 32-bit width " + << "components"; + } + } + } + break; + } + + case GLSLstd450Radians: + case GLSLstd450Degrees: + case GLSLstd450Sin: + case GLSLstd450Cos: + case GLSLstd450Tan: + case GLSLstd450Asin: + case GLSLstd450Acos: + case GLSLstd450Atan: + case GLSLstd450Sinh: + case GLSLstd450Cosh: + case GLSLstd450Tanh: + case GLSLstd450Asinh: + case GLSLstd450Acosh: + case GLSLstd450Atanh: + case GLSLstd450Exp: + case GLSLstd450Exp2: + case GLSLstd450Log: + case GLSLstd450Log2: + case GLSLstd450Atan2: + case GLSLstd450Pow: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 16 or 32-bit scalar or " + "vector float type"; + } + + const uint32_t result_type_bit_width = _.GetBitWidth(result_type); + if (result_type_bit_width != 16 && result_type_bit_width != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 16 or 32-bit scalar or " + "vector float type"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case GLSLstd450Determinant: { + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + uint32_t num_rows = 0; + uint32_t num_cols = 0; + uint32_t col_type = 0; + uint32_t component_type = 0; + if (!_.GetMatrixTypeInfo(x_type, &num_rows, &num_cols, &col_type, + &component_type) || + num_rows != num_cols) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X to be a square matrix"; + } + + if (result_type != component_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X component type to be equal to " + << "Result Type"; + } + break; + } + + case GLSLstd450MatrixInverse: { + uint32_t num_rows = 0; + uint32_t num_cols = 0; + uint32_t col_type = 0; + uint32_t component_type = 0; + if (!_.GetMatrixTypeInfo(result_type, &num_rows, &num_cols, &col_type, + &component_type) || + num_rows != num_cols) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a square matrix"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to Result Type"; + } + break; + } + + case GLSLstd450Modf: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or vector float type"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t i_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to Result Type"; + } + + uint32_t i_storage_class = 0; + uint32_t i_data_type = 0; + if (!_.GetPointerTypeInfo(i_type, &i_data_type, &i_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand I to be a pointer"; + } + + if (i_data_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand I data type to be equal to Result Type"; + } + + break; + } + + case GLSLstd450ModfStruct: { + std::vector result_types; + if (!_.GetStructMemberTypes(result_type, &result_types) || + result_types.size() != 2 || + !_.IsFloatScalarOrVectorType(result_types[0]) || + result_types[1] != result_types[0]) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a struct with two identical " + << "scalar or vector float type members"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (x_type != result_types[0]) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to members of " + << "Result Type struct"; + } + break; + } + + case GLSLstd450Frexp: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or vector float type"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t exp_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to Result Type"; + } + + uint32_t exp_storage_class = 0; + uint32_t exp_data_type = 0; + if (!_.GetPointerTypeInfo(exp_type, &exp_data_type, + &exp_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Exp to be a pointer"; + } + + if (!_.IsIntScalarOrVectorType(exp_data_type) || + (!_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(exp_data_type) != 32) || + (_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(exp_data_type) != 16 && + _.GetBitWidth(exp_data_type) != 32)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Exp data type to be a " + << (_.HasExtension(kSPV_AMD_gpu_shader_int16) + ? "16-bit or 32-bit " + : "32-bit ") + << "int scalar or vector type"; + } + + if (_.GetDimension(result_type) != _.GetDimension(exp_data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Exp data type to have the same component " + << "number as Result Type"; + } + + break; + } + + case GLSLstd450Ldexp: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or vector float type"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t exp_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to Result Type"; + } + + if (!_.IsIntScalarOrVectorType(exp_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Exp to be a 32-bit int scalar " + << "or vector type"; + } + + if (_.GetDimension(result_type) != _.GetDimension(exp_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Exp to have the same component " + << "number as Result Type"; + } + + break; + } + + case GLSLstd450FrexpStruct: { + std::vector result_types; + if (!_.GetStructMemberTypes(result_type, &result_types) || + result_types.size() != 2 || + !_.IsFloatScalarOrVectorType(result_types[0]) || + !_.IsIntScalarOrVectorType(result_types[1]) || + (!_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(result_types[1]) != 32) || + (_.HasExtension(kSPV_AMD_gpu_shader_int16) && + _.GetBitWidth(result_types[1]) != 16 && + _.GetBitWidth(result_types[1]) != 32) || + _.GetDimension(result_types[0]) != + _.GetDimension(result_types[1])) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a struct with two members, " + << "first member a float scalar or vector, second member a " + << (_.HasExtension(kSPV_AMD_gpu_shader_int16) + ? "16-bit or 32-bit " + : "32-bit ") + << "int scalar or vector with the same number of " + << "components as the first member"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (x_type != result_types[0]) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to the first member " + << "of Result Type struct"; + } + break; + } + + case GLSLstd450PackSnorm4x8: + case GLSLstd450PackUnorm4x8: { + if (!_.IsIntScalarType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be 32-bit int scalar type"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatVectorType(v_type) || _.GetDimension(v_type) != 4 || + _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand V to be a 32-bit float vector of size 4"; + } + break; + } + + case GLSLstd450PackSnorm2x16: + case GLSLstd450PackUnorm2x16: + case GLSLstd450PackHalf2x16: { + if (!_.IsIntScalarType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be 32-bit int scalar type"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatVectorType(v_type) || _.GetDimension(v_type) != 2 || + _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand V to be a 32-bit float vector of size 2"; + } + break; + } + + case GLSLstd450PackDouble2x32: { + if (!_.IsFloatScalarType(result_type) || + _.GetBitWidth(result_type) != 64) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be 64-bit float scalar type"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntVectorType(v_type) || _.GetDimension(v_type) != 2 || + _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand V to be a 32-bit int vector of size 2"; + } + break; + } + + case GLSLstd450UnpackSnorm4x8: + case GLSLstd450UnpackUnorm4x8: { + if (!_.IsFloatVectorType(result_type) || + _.GetDimension(result_type) != 4 || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit float vector of size " + "4"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarType(v_type) || _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a 32-bit int scalar"; + } + break; + } + + case GLSLstd450UnpackSnorm2x16: + case GLSLstd450UnpackUnorm2x16: + case GLSLstd450UnpackHalf2x16: { + if (!_.IsFloatVectorType(result_type) || + _.GetDimension(result_type) != 2 || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit float vector of size " + "2"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarType(v_type) || _.GetBitWidth(v_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a 32-bit int scalar"; + } + break; + } + + case GLSLstd450UnpackDouble2x32: { + if (!_.IsIntVectorType(result_type) || + _.GetDimension(result_type) != 2 || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit int vector of size " + "2"; + } + + const uint32_t v_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarType(v_type) || _.GetBitWidth(v_type) != 64) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand V to be a 64-bit float scalar"; + } + break; + } + + case GLSLstd450Length: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X to be of float scalar or vector type"; + } + + if (result_type != _.GetComponentType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X component type to be equal to Result " + "Type"; + } + break; + } + + case GLSLstd450Distance: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t p0_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P0 to be of float scalar or vector type"; + } + + if (result_type != _.GetComponentType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P0 component type to be equal to " + << "Result Type"; + } + + const uint32_t p1_type = _.GetOperandTypeId(inst, 5); + if (!_.IsFloatScalarOrVectorType(p1_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P1 to be of float scalar or vector type"; + } + + if (result_type != _.GetComponentType(p1_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P1 component type to be equal to " + << "Result Type"; + } + + if (_.GetDimension(p0_type) != _.GetDimension(p1_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operands P0 and P1 to have the same number of " + << "components"; + } + break; + } + + case GLSLstd450Cross: { + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float vector type"; + } + + if (_.GetDimension(result_type) != 3) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to have 3 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t y_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to Result Type"; + } + + if (y_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Y type to be equal to Result Type"; + } + break; + } + + case GLSLstd450Refract: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t i_type = _.GetOperandTypeId(inst, 4); + const uint32_t n_type = _.GetOperandTypeId(inst, 5); + const uint32_t eta_type = _.GetOperandTypeId(inst, 6); + + if (result_type != i_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand I to be of type equal to Result Type"; + } + + if (result_type != n_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand N to be of type equal to Result Type"; + } + + if (!_.IsFloatScalarType(eta_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Eta to be a float scalar"; + } + break; + } + + case GLSLstd450InterpolateAtCentroid: + case GLSLstd450InterpolateAtSample: + case GLSLstd450InterpolateAtOffset: { + if (!_.HasCapability(SpvCapabilityInterpolationFunction)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << ext_inst_name() + << " requires capability InterpolationFunction"; + } + + if (!_.IsFloatScalarOrVectorType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit float scalar " + << "or vector type"; + } + + const uint32_t interpolant_type = _.GetOperandTypeId(inst, 4); + uint32_t interpolant_storage_class = 0; + uint32_t interpolant_data_type = 0; + if (!_.GetPointerTypeInfo(interpolant_type, &interpolant_data_type, + &interpolant_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Interpolant to be a pointer"; + } + + if (result_type != interpolant_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Interpolant data type to be equal to Result Type"; + } + + if (interpolant_storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Interpolant storage class to be Input"; + } + + if (ext_inst_key == GLSLstd450InterpolateAtSample) { + const uint32_t sample_type = _.GetOperandTypeId(inst, 5); + if (!_.IsIntScalarType(sample_type) || + _.GetBitWidth(sample_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Sample to be 32-bit integer"; + } + } + + if (ext_inst_key == GLSLstd450InterpolateAtOffset) { + const uint32_t offset_type = _.GetOperandTypeId(inst, 5); + if (!_.IsFloatVectorType(offset_type) || + _.GetDimension(offset_type) != 2 || + _.GetBitWidth(offset_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Offset to be a vector of 2 32-bit floats"; + } + } + + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + ext_inst_name() + + std::string(" requires Fragment execution model")); + break; + } + + case GLSLstd450IMix: { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Extended instruction GLSLstd450IMix is not supported"; + } + + case GLSLstd450Bad: { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Encountered extended instruction GLSLstd450Bad"; + } + + case GLSLstd450Count: { + assert(0); + break; + } + } + } else if (ext_inst_type == SPV_EXT_INST_TYPE_OPENCL_STD) { + const OpenCLLIB::Entrypoints ext_inst_key = + OpenCLLIB::Entrypoints(ext_inst_index); + switch (ext_inst_key) { + case OpenCLLIB::Acos: + case OpenCLLIB::Acosh: + case OpenCLLIB::Acospi: + case OpenCLLIB::Asin: + case OpenCLLIB::Asinh: + case OpenCLLIB::Asinpi: + case OpenCLLIB::Atan: + case OpenCLLIB::Atan2: + case OpenCLLIB::Atanh: + case OpenCLLIB::Atanpi: + case OpenCLLIB::Atan2pi: + case OpenCLLIB::Cbrt: + case OpenCLLIB::Ceil: + case OpenCLLIB::Copysign: + case OpenCLLIB::Cos: + case OpenCLLIB::Cosh: + case OpenCLLIB::Cospi: + case OpenCLLIB::Erfc: + case OpenCLLIB::Erf: + case OpenCLLIB::Exp: + case OpenCLLIB::Exp2: + case OpenCLLIB::Exp10: + case OpenCLLIB::Expm1: + case OpenCLLIB::Fabs: + case OpenCLLIB::Fdim: + case OpenCLLIB::Floor: + case OpenCLLIB::Fma: + case OpenCLLIB::Fmax: + case OpenCLLIB::Fmin: + case OpenCLLIB::Fmod: + case OpenCLLIB::Hypot: + case OpenCLLIB::Lgamma: + case OpenCLLIB::Log: + case OpenCLLIB::Log2: + case OpenCLLIB::Log10: + case OpenCLLIB::Log1p: + case OpenCLLIB::Logb: + case OpenCLLIB::Mad: + case OpenCLLIB::Maxmag: + case OpenCLLIB::Minmag: + case OpenCLLIB::Nextafter: + case OpenCLLIB::Pow: + case OpenCLLIB::Powr: + case OpenCLLIB::Remainder: + case OpenCLLIB::Rint: + case OpenCLLIB::Round: + case OpenCLLIB::Rsqrt: + case OpenCLLIB::Sin: + case OpenCLLIB::Sinh: + case OpenCLLIB::Sinpi: + case OpenCLLIB::Sqrt: + case OpenCLLIB::Tan: + case OpenCLLIB::Tanh: + case OpenCLLIB::Tanpi: + case OpenCLLIB::Tgamma: + case OpenCLLIB::Trunc: + case OpenCLLIB::Half_cos: + case OpenCLLIB::Half_divide: + case OpenCLLIB::Half_exp: + case OpenCLLIB::Half_exp2: + case OpenCLLIB::Half_exp10: + case OpenCLLIB::Half_log: + case OpenCLLIB::Half_log2: + case OpenCLLIB::Half_log10: + case OpenCLLIB::Half_powr: + case OpenCLLIB::Half_recip: + case OpenCLLIB::Half_rsqrt: + case OpenCLLIB::Half_sin: + case OpenCLLIB::Half_sqrt: + case OpenCLLIB::Half_tan: + case OpenCLLIB::Native_cos: + case OpenCLLIB::Native_divide: + case OpenCLLIB::Native_exp: + case OpenCLLIB::Native_exp2: + case OpenCLLIB::Native_exp10: + case OpenCLLIB::Native_log: + case OpenCLLIB::Native_log2: + case OpenCLLIB::Native_log10: + case OpenCLLIB::Native_powr: + case OpenCLLIB::Native_recip: + case OpenCLLIB::Native_rsqrt: + case OpenCLLIB::Native_sin: + case OpenCLLIB::Native_sqrt: + case OpenCLLIB::Native_tan: + case OpenCLLIB::FClamp: + case OpenCLLIB::Degrees: + case OpenCLLIB::FMax_common: + case OpenCLLIB::FMin_common: + case OpenCLLIB::Mix: + case OpenCLLIB::Radians: + case OpenCLLIB::Step: + case OpenCLLIB::Smoothstep: + case OpenCLLIB::Sign: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::Fract: + case OpenCLLIB::Modf: + case OpenCLLIB::Sincos: + case OpenCLLIB::Remquo: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + uint32_t operand_index = 4; + const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected type of operand X to be equal to Result Type"; + } + + if (ext_inst_key == OpenCLLIB::Remquo) { + const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++); + if (result_type != y_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected type of operand Y to be equal to Result Type"; + } + } + + const uint32_t p_type = _.GetOperandTypeId(inst, operand_index++); + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected the last operand to be a pointer"; + } + + if (p_storage_class != SpvStorageClassGeneric && + p_storage_class != SpvStorageClassCrossWorkgroup && + p_storage_class != SpvStorageClassWorkgroup && + p_storage_class != SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected storage class of the pointer to be Generic, " + "CrossWorkgroup, Workgroup or Function"; + } + + if (result_type != p_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected data type of the pointer to be equal to Result " + "Type"; + } + break; + } + + case OpenCLLIB::Frexp: + case OpenCLLIB::Lgamma_r: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected type of operand X to be equal to Result Type"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected the last operand to be a pointer"; + } + + if (p_storage_class != SpvStorageClassGeneric && + p_storage_class != SpvStorageClassCrossWorkgroup && + p_storage_class != SpvStorageClassWorkgroup && + p_storage_class != SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected storage class of the pointer to be Generic, " + "CrossWorkgroup, Workgroup or Function"; + } + + if (!_.IsIntScalarOrVectorType(p_data_type) || + _.GetBitWidth(p_data_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected data type of the pointer to be a 32-bit int " + "scalar or vector type"; + } + + if (_.GetDimension(p_data_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected data type of the pointer to have the same number " + "of components as Result Type"; + } + break; + } + + case OpenCLLIB::Ilogb: { + if (!_.IsIntScalarOrVectorType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit int scalar or vector " + "type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X to be a float scalar or vector"; + } + + if (_.GetDimension(x_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X to have the same number of components " + "as Result Type"; + } + break; + } + + case OpenCLLIB::Ldexp: + case OpenCLLIB::Pown: + case OpenCLLIB::Rootn: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + if (result_type != x_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected type of operand X to be equal to Result Type"; + } + + const uint32_t exp_type = _.GetOperandTypeId(inst, 5); + if (!_.IsIntScalarOrVectorType(exp_type) || + _.GetBitWidth(exp_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected the exponent to be a 32-bit int scalar or vector"; + } + + if (_.GetDimension(exp_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected the exponent to have the same number of " + "components as Result Type"; + } + break; + } + + case OpenCLLIB::Nan: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t nancode_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarOrVectorType(nancode_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Nancode to be an int scalar or vector type"; + } + + if (_.GetDimension(nancode_type) != num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Nancode to have the same number of components as " + "Result Type"; + } + + if (_.GetBitWidth(result_type) != _.GetBitWidth(nancode_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Nancode to have the same bit width as Result " + "Type"; + } + break; + } + + case OpenCLLIB::SAbs: + case OpenCLLIB::SAbs_diff: + case OpenCLLIB::SAdd_sat: + case OpenCLLIB::UAdd_sat: + case OpenCLLIB::SHadd: + case OpenCLLIB::UHadd: + case OpenCLLIB::SRhadd: + case OpenCLLIB::URhadd: + case OpenCLLIB::SClamp: + case OpenCLLIB::UClamp: + case OpenCLLIB::Clz: + case OpenCLLIB::Ctz: + case OpenCLLIB::SMad_hi: + case OpenCLLIB::UMad_sat: + case OpenCLLIB::SMad_sat: + case OpenCLLIB::SMax: + case OpenCLLIB::UMax: + case OpenCLLIB::SMin: + case OpenCLLIB::UMin: + case OpenCLLIB::SMul_hi: + case OpenCLLIB::Rotate: + case OpenCLLIB::SSub_sat: + case OpenCLLIB::USub_sat: + case OpenCLLIB::Popcount: + case OpenCLLIB::UAbs: + case OpenCLLIB::UAbs_diff: + case OpenCLLIB::UMul_hi: + case OpenCLLIB::UMad_hi: { + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::U_Upsample: + case OpenCLLIB::S_Upsample: { + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int scalar or vector " + "type"; + } + + const uint32_t result_num_components = _.GetDimension(result_type); + if (result_num_components > 4 && result_num_components != 8 && + result_num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t result_bit_width = _.GetBitWidth(result_type); + if (result_bit_width != 16 && result_bit_width != 32 && + result_bit_width != 64) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected bit width of Result Type components to be 16, 32 " + "or 64"; + } + + const uint32_t hi_type = _.GetOperandTypeId(inst, 4); + const uint32_t lo_type = _.GetOperandTypeId(inst, 5); + + if (hi_type != lo_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Hi and Lo operands to have the same type"; + } + + if (result_num_components != _.GetDimension(hi_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Hi and Lo operands to have the same number of " + "components as Result Type"; + } + + if (result_bit_width != 2 * _.GetBitWidth(hi_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected bit width of components of Hi and Lo operands to " + "be half of the bit width of components of Result Type"; + } + break; + } + + case OpenCLLIB::SMad24: + case OpenCLLIB::UMad24: + case OpenCLLIB::SMul24: + case OpenCLLIB::UMul24: { + if (!_.IsIntScalarOrVectorType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit int scalar or vector " + "type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::Cross: { + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components != 3 && num_components != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to have 3 or 4 components"; + } + + const uint32_t x_type = _.GetOperandTypeId(inst, 4); + const uint32_t y_type = _.GetOperandTypeId(inst, 5); + + if (x_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X type to be equal to Result Type"; + } + + if (y_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Y type to be equal to Result Type"; + } + break; + } + + case OpenCLLIB::Distance: + case OpenCLLIB::Fast_distance: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t p0_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P0 to be of float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(p0_type); + if (num_components > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P0 to have no more than 4 components"; + } + + if (result_type != _.GetComponentType(p0_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P0 component type to be equal to " + << "Result Type"; + } + + const uint32_t p1_type = _.GetOperandTypeId(inst, 5); + if (p0_type != p1_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operands P0 and P1 to be of the same type"; + } + break; + } + + case OpenCLLIB::Length: + case OpenCLLIB::Fast_length: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarOrVectorType(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a float scalar or vector"; + } + + const uint32_t num_components = _.GetDimension(p_type); + if (num_components > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to have no more than 4 components"; + } + + if (result_type != _.GetComponentType(p_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P component type to be equal to Result " + "Type"; + } + break; + } + + case OpenCLLIB::Normalize: + case OpenCLLIB::Fast_normalize: { + if (!_.IsFloatScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar or vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to have no more than 4 components"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 4); + if (p_type != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P type to be equal to Result Type"; + } + break; + } + + case OpenCLLIB::Bitselect: { + if (!_.IsFloatScalarOrVectorType(result_type) && + !_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int or float scalar or " + "vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + for (uint32_t operand_index = 4; operand_index < num_operands; + ++operand_index) { + const uint32_t operand_type = _.GetOperandTypeId(inst, operand_index); + if (result_type != operand_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected types of all operands to be equal to Result " + "Type"; + } + } + break; + } + + case OpenCLLIB::Select: { + if (!_.IsFloatScalarOrVectorType(result_type) && + !_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int or float scalar or " + "vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t a_type = _.GetOperandTypeId(inst, 4); + const uint32_t b_type = _.GetOperandTypeId(inst, 5); + const uint32_t c_type = _.GetOperandTypeId(inst, 6); + + if (result_type != a_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand A type to be equal to Result Type"; + } + + if (result_type != b_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand B type to be equal to Result Type"; + } + + if (!_.IsIntScalarOrVectorType(c_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand C to be an int scalar or vector"; + } + + if (num_components != _.GetDimension(c_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand C to have the same number of components " + "as Result Type"; + } + + if (_.GetBitWidth(result_type) != _.GetBitWidth(c_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand C to have the same bit width as Result " + "Type"; + } + break; + } + + case OpenCLLIB::Vloadn: { + if (!_.IsFloatVectorType(result_type) && + !_.IsIntVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int or float vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to have 2, 3, 4, 8 or 16 components"; + } + + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type) || + _.GetBitWidth(offset_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != SpvStorageClassUniformConstant && + p_storage_class != SpvStorageClassGeneric) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P storage class to be UniformConstant or " + "Generic"; + } + + if (_.GetComponentType(result_type) != p_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P data type to be equal to component " + "type of Result Type"; + } + + const uint32_t n_value = inst->word(7); + if (num_components != n_value) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected literal N to be equal to the number of " + "components of Result Type"; + } + break; + } + + case OpenCLLIB::Vstoren: { + if (_.GetIdOpcode(result_type) != SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": expected Result Type to be void"; + } + + const uint32_t data_type = _.GetOperandTypeId(inst, 4); + const uint32_t offset_type = _.GetOperandTypeId(inst, 5); + const uint32_t p_type = _.GetOperandTypeId(inst, 6); + + if (!_.IsFloatVectorType(data_type) && !_.IsIntVectorType(data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Data to be an int or float vector"; + } + + const uint32_t num_components = _.GetDimension(data_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Data to have 2, 3, 4, 8 or 16 components"; + } + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type) || + _.GetBitWidth(offset_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != SpvStorageClassGeneric) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P storage class to be Generic"; + } + + if (_.GetComponentType(data_type) != p_data_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P data type to be equal to the type of " + "operand Data components"; + } + break; + } + + case OpenCLLIB::Vload_half: { + if (!_.IsFloatScalarType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float scalar type"; + } + + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type) || + _.GetBitWidth(offset_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != SpvStorageClassUniformConstant && + p_storage_class != SpvStorageClassGeneric && + p_storage_class != SpvStorageClassCrossWorkgroup && + p_storage_class != SpvStorageClassWorkgroup && + p_storage_class != SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P storage class to be UniformConstant, " + "Generic, CrossWorkgroup, Workgroup or Function"; + } + + if (!_.IsFloatScalarType(p_data_type) || + _.GetBitWidth(p_data_type) != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P data type to be 16-bit float scalar"; + } + break; + } + + case OpenCLLIB::Vload_halfn: + case OpenCLLIB::Vloada_halfn: { + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a float vector type"; + } + + const uint32_t num_components = _.GetDimension(result_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to have 2, 3, 4, 8 or 16 components"; + } + + const uint32_t offset_type = _.GetOperandTypeId(inst, 4); + const uint32_t p_type = _.GetOperandTypeId(inst, 5); + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type) || + _.GetBitWidth(offset_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != SpvStorageClassUniformConstant && + p_storage_class != SpvStorageClassGeneric && + p_storage_class != SpvStorageClassCrossWorkgroup && + p_storage_class != SpvStorageClassWorkgroup && + p_storage_class != SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P storage class to be UniformConstant, " + "Generic, CrossWorkgroup, Workgroup or Function"; + } + + if (!_.IsFloatScalarType(p_data_type) || + _.GetBitWidth(p_data_type) != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P data type to be 16-bit float scalar"; + } + + const uint32_t n_value = inst->word(7); + if (num_components != n_value) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected literal N to be equal to the number of " + "components of Result Type"; + } + break; + } + + case OpenCLLIB::Vstore_half: + case OpenCLLIB::Vstore_half_r: + case OpenCLLIB::Vstore_halfn: + case OpenCLLIB::Vstore_halfn_r: + case OpenCLLIB::Vstorea_halfn: + case OpenCLLIB::Vstorea_halfn_r: { + if (_.GetIdOpcode(result_type) != SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": expected Result Type to be void"; + } + + const uint32_t data_type = _.GetOperandTypeId(inst, 4); + const uint32_t offset_type = _.GetOperandTypeId(inst, 5); + const uint32_t p_type = _.GetOperandTypeId(inst, 6); + const uint32_t data_type_bit_width = _.GetBitWidth(data_type); + + if (ext_inst_key == OpenCLLIB::Vstore_half || + ext_inst_key == OpenCLLIB::Vstore_half_r) { + if (!_.IsFloatScalarType(data_type) || + (data_type_bit_width != 32 && data_type_bit_width != 64)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Data to be a 32 or 64-bit float scalar"; + } + } else { + if (!_.IsFloatVectorType(data_type) || + (data_type_bit_width != 32 && data_type_bit_width != 64)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Data to be a 32 or 64-bit float vector"; + } + + const uint32_t num_components = _.GetDimension(data_type); + if (num_components > 4 && num_components != 8 && + num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Data to have 2, 3, 4, 8 or 16 components"; + } + } + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(offset_type) || + _.GetBitWidth(offset_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Offset to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P to be a pointer"; + } + + if (p_storage_class != SpvStorageClassGeneric && + p_storage_class != SpvStorageClassCrossWorkgroup && + p_storage_class != SpvStorageClassWorkgroup && + p_storage_class != SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P storage class to be Generic, " + "CrossWorkgroup, Workgroup or Function"; + } + + if (!_.IsFloatScalarType(p_data_type) || + _.GetBitWidth(p_data_type) != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand P data type to be 16-bit float scalar"; + } + + // Rounding mode enum is checked by assembler. + break; + } + + case OpenCLLIB::Shuffle: + case OpenCLLIB::Shuffle2: { + if (!_.IsFloatVectorType(result_type) && + !_.IsIntVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be an int or float vector type"; + } + + const uint32_t result_num_components = _.GetDimension(result_type); + if (result_num_components != 2 && result_num_components != 4 && + result_num_components != 8 && result_num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to have 2, 4, 8 or 16 components"; + } + + uint32_t operand_index = 4; + const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++); + + if (ext_inst_key == OpenCLLIB::Shuffle2) { + const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++); + if (x_type != y_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operands X and Y to be of the same type"; + } + } + + const uint32_t shuffle_mask_type = + _.GetOperandTypeId(inst, operand_index++); + + if (!_.IsFloatVectorType(x_type) && !_.IsIntVectorType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X to be an int or float vector"; + } + + const uint32_t x_num_components = _.GetDimension(x_type); + if (x_num_components != 2 && x_num_components != 4 && + x_num_components != 8 && x_num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X to have 2, 4, 8 or 16 components"; + } + + const uint32_t result_component_type = _.GetComponentType(result_type); + + if (result_component_type != _.GetComponentType(x_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand X and Result Type to have equal " + "component types"; + } + + if (!_.IsIntVectorType(shuffle_mask_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Shuffle Mask to be an int vector"; + } + + if (result_num_components != _.GetDimension(shuffle_mask_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Shuffle Mask to have the same number of " + "components as Result Type"; + } + + if (_.GetBitWidth(result_component_type) != + _.GetBitWidth(shuffle_mask_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Shuffle Mask components to have the same " + "bit width as Result Type components"; + } + break; + } + + case OpenCLLIB::Printf: { + if (!_.IsIntScalarType(result_type) || + _.GetBitWidth(result_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a 32-bit int type"; + } + + const uint32_t format_type = _.GetOperandTypeId(inst, 4); + uint32_t format_storage_class = 0; + uint32_t format_data_type = 0; + if (!_.GetPointerTypeInfo(format_type, &format_data_type, + &format_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Format to be a pointer"; + } + + if (format_storage_class != SpvStorageClassUniformConstant) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Format storage class to be UniformConstant"; + } + + if (!_.IsIntScalarType(format_data_type) || + _.GetBitWidth(format_data_type) != 8) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Format data type to be 8-bit int"; + } + break; + } + + case OpenCLLIB::Prefetch: { + if (_.GetIdOpcode(result_type) != SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": expected Result Type to be void"; + } + + const uint32_t p_type = _.GetOperandTypeId(inst, 4); + const uint32_t num_elements_type = _.GetOperandTypeId(inst, 5); + + uint32_t p_storage_class = 0; + uint32_t p_data_type = 0; + if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Ptr to be a pointer"; + } + + if (p_storage_class != SpvStorageClassCrossWorkgroup) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Ptr storage class to be CrossWorkgroup"; + } + + if (!_.IsFloatScalarOrVectorType(p_data_type) && + !_.IsIntScalarOrVectorType(p_data_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Ptr data type to be int or float scalar or " + "vector"; + } + + const uint32_t num_components = _.GetDimension(p_data_type); + if (num_components > 4 && num_components != 8 && num_components != 16) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected Result Type to be a scalar or a vector with 2, " + "3, 4, 8 or 16 components"; + } + + const uint32_t size_t_bit_width = GetSizeTBitWidth(_); + if (!size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() + << " can only be used with physical addressing models"; + } + + if (!_.IsIntScalarType(num_elements_type) || + _.GetBitWidth(num_elements_type) != size_t_bit_width) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << ext_inst_name() << ": " + << "expected operand Num Elements to be of type size_t (" + << size_t_bit_width + << "-bit integer for the addressing model used in the module)"; + } + break; + } + } + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp new file mode 100644 index 00000000000..39f00fedc73 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_function.cpp @@ -0,0 +1,202 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateFunction(ValidationState_t& _, const Instruction* inst) { + const auto function_type_id = inst->GetOperandAs(3); + const auto function_type = _.FindDef(function_type_id); + if (!function_type || SpvOpTypeFunction != function_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunction Function Type '" << _.getIdName(function_type_id) + << "' is not a function type."; + } + + const auto return_id = function_type->GetOperandAs(1); + if (return_id != inst->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunction Result Type '" << _.getIdName(inst->type_id()) + << "' does not match the Function Type's return type '" + << _.getIdName(return_id) << "'."; + } + + for (auto& pair : inst->uses()) { + const auto* use = pair.first; + const std::vector acceptable = { + SpvOpFunctionCall, + SpvOpEntryPoint, + SpvOpEnqueueKernel, + SpvOpGetKernelNDrangeSubGroupCount, + SpvOpGetKernelNDrangeMaxSubGroupSize, + SpvOpGetKernelWorkGroupSize, + SpvOpGetKernelPreferredWorkGroupSizeMultiple, + SpvOpGetKernelLocalSizeForSubgroupCount, + SpvOpGetKernelMaxNumSubgroups}; + if (std::find(acceptable.begin(), acceptable.end(), use->opcode()) == + acceptable.end()) { + return _.diag(SPV_ERROR_INVALID_ID, use) + << "Invalid use of function result id " << _.getIdName(inst->id()) + << "."; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateFunctionParameter(ValidationState_t& _, + const Instruction* inst) { + // NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place. + size_t param_index = 0; + size_t inst_num = inst->LineNum() - 1; + if (inst_num == 0) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function parameter cannot be the first instruction."; + } + + auto func_inst = &_.ordered_instructions()[inst_num]; + while (--inst_num) { + func_inst = &_.ordered_instructions()[inst_num]; + if (func_inst->opcode() == SpvOpFunction) { + break; + } else if (func_inst->opcode() == SpvOpFunctionParameter) { + ++param_index; + } + } + + if (func_inst->opcode() != SpvOpFunction) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function parameter must be preceded by a function."; + } + + const auto function_type_id = func_inst->GetOperandAs(3); + const auto function_type = _.FindDef(function_type_id); + if (!function_type) { + return _.diag(SPV_ERROR_INVALID_ID, func_inst) + << "Missing function type definition."; + } + if (param_index >= function_type->words().size() - 3) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Too many OpFunctionParameters for " << func_inst->id() + << ": expected " << function_type->words().size() - 3 + << " based on the function's type"; + } + + const auto param_type = + _.FindDef(function_type->GetOperandAs(param_index + 2)); + if (!param_type || inst->type_id() != param_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionParameter Result Type '" + << _.getIdName(inst->type_id()) + << "' does not match the OpTypeFunction parameter " + "type of the same index."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateFunctionCall(ValidationState_t& _, + const Instruction* inst) { + const auto function_id = inst->GetOperandAs(2); + const auto function = _.FindDef(function_id); + if (!function || SpvOpFunction != function->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Function '" << _.getIdName(function_id) + << "' is not a function."; + } + + auto return_type = _.FindDef(function->type_id()); + if (!return_type || return_type->id() != inst->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Result Type '" + << _.getIdName(inst->type_id()) + << "'s type does not match Function '" + << _.getIdName(return_type->id()) << "'s return type."; + } + + const auto function_type_id = function->GetOperandAs(3); + const auto function_type = _.FindDef(function_type_id); + if (!function_type || function_type->opcode() != SpvOpTypeFunction) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Missing function type definition."; + } + + const auto function_call_arg_count = inst->words().size() - 4; + const auto function_param_count = function_type->words().size() - 3; + if (function_param_count != function_call_arg_count) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Function 's parameter count does not match " + "the argument count."; + } + + for (size_t argument_index = 3, param_index = 2; + argument_index < inst->operands().size(); + argument_index++, param_index++) { + const auto argument_id = inst->GetOperandAs(argument_index); + const auto argument = _.FindDef(argument_id); + if (!argument) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Missing argument " << argument_index - 3 << " definition."; + } + + const auto argument_type = _.FindDef(argument->type_id()); + if (!argument_type) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Missing argument " << argument_index - 3 + << " type definition."; + } + + const auto parameter_type_id = + function_type->GetOperandAs(param_index); + const auto parameter_type = _.FindDef(parameter_type_id); + if (!parameter_type || argument_type->id() != parameter_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpFunctionCall Argument '" << _.getIdName(argument_id) + << "'s type does not match Function '" + << _.getIdName(parameter_type_id) << "'s parameter type."; + } + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t FunctionPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpFunction: + if (auto error = ValidateFunction(_, inst)) return error; + break; + case SpvOpFunctionParameter: + if (auto error = ValidateFunctionParameter(_, inst)) return error; + break; + case SpvOpFunctionCall: + if (auto error = ValidateFunctionCall(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp new file mode 100644 index 00000000000..6359ab60046 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_id.cpp @@ -0,0 +1,204 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/validate.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_validator_options.h" +#include "source/val/function.h" +#include "source/val/validation_state.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { + +spv_result_t UpdateIdUse(ValidationState_t& _, const Instruction* inst) { + for (auto& operand : inst->operands()) { + const spv_operand_type_t& type = operand.type; + const uint32_t operand_id = inst->word(operand.offset); + if (spvIsIdType(type) && type != SPV_OPERAND_TYPE_RESULT_ID) { + if (auto def = _.FindDef(operand_id)) + def->RegisterUse(inst, operand.offset); + } + } + + return SPV_SUCCESS; +} + +/// This function checks all ID definitions dominate their use in the CFG. +/// +/// This function will iterate over all ID definitions that are defined in the +/// functions of a module and make sure that the definitions appear in a +/// block that dominates their use. +/// +/// NOTE: This function does NOT check module scoped functions which are +/// checked during the initial binary parse in the IdPass below +spv_result_t CheckIdDefinitionDominateUse(const ValidationState_t& _) { + std::vector phi_instructions; + std::unordered_set phi_ids; + for (const auto& inst : _.ordered_instructions()) { + if (inst.id() == 0) continue; + if (const Function* func = inst.function()) { + if (const BasicBlock* block = inst.block()) { + if (!block->reachable()) continue; + // If the Id is defined within a block then make sure all references to + // that Id appear in a blocks that are dominated by the defining block + for (auto& use_index_pair : inst.uses()) { + const Instruction* use = use_index_pair.first; + if (const BasicBlock* use_block = use->block()) { + if (use_block->reachable() == false) continue; + if (use->opcode() == SpvOpPhi) { + if (phi_ids.insert(use->id()).second) { + phi_instructions.push_back(use); + } + } else if (!block->dominates(*use->block())) { + return _.diag(SPV_ERROR_INVALID_ID, use_block->label()) + << "ID " << _.getIdName(inst.id()) << " defined in block " + << _.getIdName(block->id()) + << " does not dominate its use in block " + << _.getIdName(use_block->id()); + } + } + } + } else { + // If the Ids defined within a function but not in a block(i.e. function + // parameters, block ids), then make sure all references to that Id + // appear within the same function + for (auto use : inst.uses()) { + const Instruction* user = use.first; + if (user->function() && user->function() != func) { + return _.diag(SPV_ERROR_INVALID_ID, _.FindDef(func->id())) + << "ID " << _.getIdName(inst.id()) << " used in function " + << _.getIdName(user->function()->id()) + << " is used outside of it's defining function " + << _.getIdName(func->id()); + } + } + } + } + // NOTE: Ids defined outside of functions must appear before they are used + // This check is being performed in the IdPass function + } + + // Check all OpPhi parent blocks are dominated by the variable's defining + // blocks + for (const Instruction* phi : phi_instructions) { + if (phi->block()->reachable() == false) continue; + for (size_t i = 3; i < phi->operands().size(); i += 2) { + const Instruction* variable = _.FindDef(phi->word(i)); + const BasicBlock* parent = + phi->function()->GetBlock(phi->word(i + 1)).first; + if (variable->block() && parent->reachable() && + !variable->block()->dominates(*parent)) { + return _.diag(SPV_ERROR_INVALID_ID, phi) + << "In OpPhi instruction " << _.getIdName(phi->id()) << ", ID " + << _.getIdName(variable->id()) + << " definition does not dominate its parent " + << _.getIdName(parent->id()); + } + } + } + + return SPV_SUCCESS; +} + +// Performs SSA validation on the IDs of an instruction. The +// can_have_forward_declared_ids functor should return true if the +// instruction operand's ID can be forward referenced. +spv_result_t IdPass(ValidationState_t& _, Instruction* inst) { + auto can_have_forward_declared_ids = + spvOperandCanBeForwardDeclaredFunction(inst->opcode()); + + // Keep track of a result id defined by this instruction. 0 means it + // does not define an id. + uint32_t result_id = 0; + + for (unsigned i = 0; i < inst->operands().size(); i++) { + const spv_parsed_operand_t& operand = inst->operand(i); + const spv_operand_type_t& type = operand.type; + // We only care about Id operands, which are a single word. + const uint32_t operand_word = inst->word(operand.offset); + + auto ret = SPV_ERROR_INTERNAL; + switch (type) { + case SPV_OPERAND_TYPE_RESULT_ID: + // NOTE: Multiple Id definitions are being checked by the binary parser. + // + // Defer undefined-forward-reference removal until after we've analyzed + // the remaining operands to this instruction. Deferral only matters + // for OpPhi since it's the only case where it defines its own forward + // reference. Other instructions that can have forward references + // either don't define a value or the forward reference is to a function + // Id (and hence defined outside of a function body). + result_id = operand_word; + // NOTE: The result Id is added (in RegisterInstruction) *after* all of + // the other Ids have been checked to avoid premature use in the same + // instruction. + ret = SPV_SUCCESS; + break; + case SPV_OPERAND_TYPE_ID: + case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: + case SPV_OPERAND_TYPE_SCOPE_ID: + if (_.IsDefinedId(operand_word)) { + ret = SPV_SUCCESS; + } else if (can_have_forward_declared_ids(i)) { + ret = _.ForwardDeclareId(operand_word); + } else { + ret = _.diag(SPV_ERROR_INVALID_ID, inst) + << "ID " << _.getIdName(operand_word) + << " has not been defined"; + } + break; + case SPV_OPERAND_TYPE_TYPE_ID: + if (_.IsDefinedId(operand_word)) { + auto* def = _.FindDef(operand_word); + if (!spvOpcodeGeneratesType(def->opcode())) { + ret = _.diag(SPV_ERROR_INVALID_ID, inst) + << "ID " << _.getIdName(operand_word) << " is not a type id"; + } else { + ret = SPV_SUCCESS; + } + } else { + ret = _.diag(SPV_ERROR_INVALID_ID, inst) + << "ID " << _.getIdName(operand_word) + << " has not been defined"; + } + break; + default: + ret = SPV_SUCCESS; + break; + } + if (SPV_SUCCESS != ret) return ret; + } + if (result_id) _.RemoveIfForwardDeclared(result_id); + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp new file mode 100644 index 00000000000..2c020ed1bb5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_image.cpp @@ -0,0 +1,1640 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of image instructions. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/spirv_target_env.h" +#include "source/util/bitutils.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Performs compile time check that all SpvImageOperandsXXX cases are handled in +// this module. If SpvImageOperandsXXX list changes, this function will fail the +// build. +// For all other purposes this is a dummy function. +bool CheckAllImageOperandsHandled() { + SpvImageOperandsMask enum_val = SpvImageOperandsBiasMask; + + // Some improvised code to prevent the compiler from considering enum_val + // constant and optimizing the switch away. + uint32_t stack_var = 0; + if (reinterpret_cast(&stack_var) % 256) + enum_val = SpvImageOperandsLodMask; + + switch (enum_val) { + // Please update the validation rules in this module if you are changing + // the list of image operands, and add new enum values to this switch. + case SpvImageOperandsMaskNone: + return false; + case SpvImageOperandsBiasMask: + case SpvImageOperandsLodMask: + case SpvImageOperandsGradMask: + case SpvImageOperandsConstOffsetMask: + case SpvImageOperandsOffsetMask: + case SpvImageOperandsConstOffsetsMask: + case SpvImageOperandsSampleMask: + case SpvImageOperandsMinLodMask: + return true; + } + return false; +} + +// Used by GetImageTypeInfo. See OpTypeImage spec for more information. +struct ImageTypeInfo { + uint32_t sampled_type = 0; + SpvDim dim = SpvDimMax; + uint32_t depth = 0; + uint32_t arrayed = 0; + uint32_t multisampled = 0; + uint32_t sampled = 0; + SpvImageFormat format = SpvImageFormatMax; + SpvAccessQualifier access_qualifier = SpvAccessQualifierMax; +}; + +// Provides information on image type. |id| should be object of either +// OpTypeImage or OpTypeSampledImage type. Returns false in case of failure +// (not a valid id, failed to parse the instruction, etc). +bool GetImageTypeInfo(const ValidationState_t& _, uint32_t id, + ImageTypeInfo* info) { + if (!id || !info) return false; + + const Instruction* inst = _.FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeSampledImage) { + inst = _.FindDef(inst->word(2)); + assert(inst); + } + + if (inst->opcode() != SpvOpTypeImage) return false; + + const size_t num_words = inst->words().size(); + if (num_words != 9 && num_words != 10) return false; + + info->sampled_type = inst->word(2); + info->dim = static_cast(inst->word(3)); + info->depth = inst->word(4); + info->arrayed = inst->word(5); + info->multisampled = inst->word(6); + info->sampled = inst->word(7); + info->format = static_cast(inst->word(8)); + info->access_qualifier = num_words < 10 + ? SpvAccessQualifierMax + : static_cast(inst->word(9)); + return true; +} + +bool IsImplicitLod(SpvOp opcode) { + switch (opcode) { + case SpvOpImageSampleImplicitLod: + case SpvOpImageSampleDrefImplicitLod: + case SpvOpImageSampleProjImplicitLod: + case SpvOpImageSampleProjDrefImplicitLod: + case SpvOpImageSparseSampleImplicitLod: + case SpvOpImageSparseSampleDrefImplicitLod: + case SpvOpImageSparseSampleProjImplicitLod: + case SpvOpImageSparseSampleProjDrefImplicitLod: + return true; + default: + break; + } + return false; +} + +bool IsExplicitLod(SpvOp opcode) { + switch (opcode) { + case SpvOpImageSampleExplicitLod: + case SpvOpImageSampleDrefExplicitLod: + case SpvOpImageSampleProjExplicitLod: + case SpvOpImageSampleProjDrefExplicitLod: + case SpvOpImageSparseSampleExplicitLod: + case SpvOpImageSparseSampleDrefExplicitLod: + case SpvOpImageSparseSampleProjExplicitLod: + case SpvOpImageSparseSampleProjDrefExplicitLod: + return true; + default: + break; + } + return false; +} + +// Returns true if the opcode is a Image instruction which applies +// homogenous projection to the coordinates. +bool IsProj(SpvOp opcode) { + switch (opcode) { + case SpvOpImageSampleProjImplicitLod: + case SpvOpImageSampleProjDrefImplicitLod: + case SpvOpImageSparseSampleProjImplicitLod: + case SpvOpImageSparseSampleProjDrefImplicitLod: + case SpvOpImageSampleProjExplicitLod: + case SpvOpImageSampleProjDrefExplicitLod: + case SpvOpImageSparseSampleProjExplicitLod: + case SpvOpImageSparseSampleProjDrefExplicitLod: + return true; + default: + break; + } + return false; +} + +// Returns the number of components in a coordinate used to access a texel in +// a single plane of an image with the given parameters. +uint32_t GetPlaneCoordSize(const ImageTypeInfo& info) { + uint32_t plane_size = 0; + // If this switch breaks your build, please add new values below. + switch (info.dim) { + case SpvDim1D: + case SpvDimBuffer: + plane_size = 1; + break; + case SpvDim2D: + case SpvDimRect: + case SpvDimSubpassData: + plane_size = 2; + break; + case SpvDim3D: + case SpvDimCube: + // For Cube direction vector is used instead of UV. + plane_size = 3; + break; + case SpvDimMax: + assert(0); + break; + } + + return plane_size; +} + +// Returns minimal number of coordinates based on image dim, arrayed and whether +// the instruction uses projection coordinates. +uint32_t GetMinCoordSize(SpvOp opcode, const ImageTypeInfo& info) { + if (info.dim == SpvDimCube && + (opcode == SpvOpImageRead || opcode == SpvOpImageWrite || + opcode == SpvOpImageSparseRead)) { + // These opcodes use UV for Cube, not direction vector. + return 3; + } + + return GetPlaneCoordSize(info) + info.arrayed + (IsProj(opcode) ? 1 : 0); +} + +// Checks ImageOperand bitfield and respective operands. +spv_result_t ValidateImageOperands(ValidationState_t& _, + const Instruction* inst, + const ImageTypeInfo& info, uint32_t mask, + uint32_t word_index) { + static const bool kAllImageOperandsHandled = CheckAllImageOperandsHandled(); + (void)kAllImageOperandsHandled; + + const SpvOp opcode = inst->opcode(); + const size_t num_words = inst->words().size(); + + size_t expected_num_image_operand_words = spvtools::utils::CountSetBits(mask); + if (mask & SpvImageOperandsGradMask) { + // Grad uses two words. + ++expected_num_image_operand_words; + } + + if (expected_num_image_operand_words != num_words - word_index) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Number of image operand ids doesn't correspond to the bit mask"; + } + + if (spvtools::utils::CountSetBits( + mask & (SpvImageOperandsOffsetMask | SpvImageOperandsConstOffsetMask | + SpvImageOperandsConstOffsetsMask)) > 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operands Offset, ConstOffset, ConstOffsets cannot be used " + << "together"; + } + + const bool is_implicit_lod = IsImplicitLod(opcode); + const bool is_explicit_lod = IsExplicitLod(opcode); + + // The checks should be done in the order of definition of OperandImage. + + if (mask & SpvImageOperandsBiasMask) { + if (!is_implicit_lod) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Bias can only be used with ImplicitLod opcodes"; + } + + const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsFloatScalarType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Bias to be float scalar"; + } + + if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && + info.dim != SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Bias requires 'Dim' parameter to be 1D, 2D, 3D " + "or Cube"; + } + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Bias requires 'MS' parameter to be 0"; + } + } + + if (mask & SpvImageOperandsLodMask) { + if (!is_explicit_lod && opcode != SpvOpImageFetch && + opcode != SpvOpImageSparseFetch) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Lod can only be used with ExplicitLod opcodes " + << "and OpImageFetch"; + } + + if (mask & SpvImageOperandsGradMask) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand bits Lod and Grad cannot be set at the same " + "time"; + } + + const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); + if (is_explicit_lod) { + if (!_.IsFloatScalarType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Lod to be float scalar when used " + << "with ExplicitLod"; + } + } else { + if (!_.IsIntScalarType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Lod to be int scalar when used with " + << "OpImageFetch"; + } + } + + if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && + info.dim != SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Lod requires 'Dim' parameter to be 1D, 2D, 3D " + "or Cube"; + } + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Lod requires 'MS' parameter to be 0"; + } + } + + if (mask & SpvImageOperandsGradMask) { + if (!is_explicit_lod) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Grad can only be used with ExplicitLod opcodes"; + } + + const uint32_t dx_type_id = _.GetTypeId(inst->word(word_index++)); + const uint32_t dy_type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsFloatScalarOrVectorType(dx_type_id) || + !_.IsFloatScalarOrVectorType(dy_type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected both Image Operand Grad ids to be float scalars or " + << "vectors"; + } + + const uint32_t plane_size = GetPlaneCoordSize(info); + const uint32_t dx_size = _.GetDimension(dx_type_id); + const uint32_t dy_size = _.GetDimension(dy_type_id); + if (plane_size != dx_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Grad dx to have " << plane_size + << " components, but given " << dx_size; + } + + if (plane_size != dy_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Grad dy to have " << plane_size + << " components, but given " << dy_size; + } + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Grad requires 'MS' parameter to be 0"; + } + } + + if (mask & SpvImageOperandsConstOffsetMask) { + if (info.dim == SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand ConstOffset cannot be used with Cube Image " + "'Dim'"; + } + + const uint32_t id = inst->word(word_index++); + const uint32_t type_id = _.GetTypeId(id); + if (!_.IsIntScalarOrVectorType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffset to be int scalar or " + << "vector"; + } + + if (!spvOpcodeIsConstant(_.GetIdOpcode(id))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffset to be a const object"; + } + + const uint32_t plane_size = GetPlaneCoordSize(info); + const uint32_t offset_size = _.GetDimension(type_id); + if (plane_size != offset_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffset to have " << plane_size + << " components, but given " << offset_size; + } + } + + if (mask & SpvImageOperandsOffsetMask) { + if (info.dim == SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Offset cannot be used with Cube Image 'Dim'"; + } + + const uint32_t id = inst->word(word_index++); + const uint32_t type_id = _.GetTypeId(id); + if (!_.IsIntScalarOrVectorType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Offset to be int scalar or " + << "vector"; + } + + const uint32_t plane_size = GetPlaneCoordSize(info); + const uint32_t offset_size = _.GetDimension(type_id); + if (plane_size != offset_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Offset to have " << plane_size + << " components, but given " << offset_size; + } + } + + if (mask & SpvImageOperandsConstOffsetsMask) { + if (opcode != SpvOpImageGather && opcode != SpvOpImageDrefGather && + opcode != SpvOpImageSparseGather && + opcode != SpvOpImageSparseDrefGather) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand ConstOffsets can only be used with " + "OpImageGather and OpImageDrefGather"; + } + + if (info.dim == SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand ConstOffsets cannot be used with Cube Image " + "'Dim'"; + } + + const uint32_t id = inst->word(word_index++); + const uint32_t type_id = _.GetTypeId(id); + const Instruction* type_inst = _.FindDef(type_id); + assert(type_inst); + + if (type_inst->opcode() != SpvOpTypeArray) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffsets to be an array of size 4"; + } + + uint64_t array_size = 0; + if (!_.GetConstantValUint64(type_inst->word(3), &array_size)) { + assert(0 && "Array type definition is corrupt"); + } + + if (array_size != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffsets to be an array of size 4"; + } + + const uint32_t component_type = type_inst->word(2); + if (!_.IsIntVectorType(component_type) || + _.GetDimension(component_type) != 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffsets array componenets to be " + "int vectors of size 2"; + } + + if (!spvOpcodeIsConstant(_.GetIdOpcode(id))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand ConstOffsets to be a const object"; + } + } + + if (mask & SpvImageOperandsSampleMask) { + if (opcode != SpvOpImageFetch && opcode != SpvOpImageRead && + opcode != SpvOpImageWrite && opcode != SpvOpImageSparseFetch && + opcode != SpvOpImageSparseRead) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Sample can only be used with OpImageFetch, " + << "OpImageRead, OpImageWrite, OpImageSparseFetch and " + << "OpImageSparseRead"; + } + + if (info.multisampled == 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand Sample requires non-zero 'MS' parameter"; + } + + const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsIntScalarType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand Sample to be int scalar"; + } + } + + if (mask & SpvImageOperandsMinLodMask) { + if (!is_implicit_lod && !(mask & SpvImageOperandsGradMask)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand MinLod can only be used with ImplicitLod " + << "opcodes or together with Image Operand Grad"; + } + + const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); + if (!_.IsFloatScalarType(type_id)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image Operand MinLod to be float scalar"; + } + + if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && + info.dim != SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand MinLod requires 'Dim' parameter to be 1D, 2D, " + "3D or Cube"; + } + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Operand MinLod requires 'MS' parameter to be 0"; + } + } + + return SPV_SUCCESS; +} + +// Checks some of the validation rules which are common to multiple opcodes. +spv_result_t ValidateImageCommon(ValidationState_t& _, const Instruction* inst, + const ImageTypeInfo& info) { + const SpvOp opcode = inst->opcode(); + if (IsProj(opcode)) { + if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && + info.dim != SpvDimRect) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Dim' parameter to be 1D, 2D, 3D or Rect"; + } + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Image 'MS' parameter to be 0"; + } + + if (info.arrayed != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Image 'arrayed' parameter to be 0"; + } + } + + if (opcode == SpvOpImageRead || opcode == SpvOpImageSparseRead || + opcode == SpvOpImageWrite) { + if (info.sampled == 0) { + } else if (info.sampled == 2) { + if (info.dim == SpvDim1D && !_.HasCapability(SpvCapabilityImage1D)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability Image1D is required to access storage image"; + } else if (info.dim == SpvDimRect && + !_.HasCapability(SpvCapabilityImageRect)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability ImageRect is required to access storage image"; + } else if (info.dim == SpvDimBuffer && + !_.HasCapability(SpvCapabilityImageBuffer)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability ImageBuffer is required to access storage image"; + } else if (info.dim == SpvDimCube && info.arrayed == 1 && + !_.HasCapability(SpvCapabilityImageCubeArray)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability ImageCubeArray is required to access " + << "storage image"; + } + + if (info.multisampled == 1 && + !_.HasCapability(SpvCapabilityImageMSArray)) { +#if 0 + // TODO(atgoo@github.com) The description of this rule in the spec + // is unclear and Glslang doesn't declare ImageMSArray. Need to clarify + // and reenable. + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability ImageMSArray is required to access storage " + << "image"; +#endif + } + } else { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled' parameter to be 0 or 2"; + } + } + + return SPV_SUCCESS; +} + +// Returns true if opcode is *ImageSparse*, false otherwise. +bool IsSparse(SpvOp opcode) { + switch (opcode) { + case SpvOpImageSparseSampleImplicitLod: + case SpvOpImageSparseSampleExplicitLod: + case SpvOpImageSparseSampleDrefImplicitLod: + case SpvOpImageSparseSampleDrefExplicitLod: + case SpvOpImageSparseSampleProjImplicitLod: + case SpvOpImageSparseSampleProjExplicitLod: + case SpvOpImageSparseSampleProjDrefImplicitLod: + case SpvOpImageSparseSampleProjDrefExplicitLod: + case SpvOpImageSparseFetch: + case SpvOpImageSparseGather: + case SpvOpImageSparseDrefGather: + case SpvOpImageSparseTexelsResident: + case SpvOpImageSparseRead: { + return true; + } + + default: { return false; } + } + + return false; +} + +// Checks sparse image opcode result type and returns the second struct member. +// Returns inst.type_id for non-sparse image opcodes. +// Not valid for sparse image opcodes which do not return a struct. +spv_result_t GetActualResultType(ValidationState_t& _, const Instruction* inst, + uint32_t* actual_result_type) { + const SpvOp opcode = inst->opcode(); + + if (IsSparse(opcode)) { + const Instruction* const type_inst = _.FindDef(inst->type_id()); + assert(type_inst); + + if (!type_inst || type_inst->opcode() != SpvOpTypeStruct) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be OpTypeStruct"; + } + + if (type_inst->words().size() != 4 || + !_.IsIntScalarType(type_inst->word(2))) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be a struct containing an int " + "scalar and a texel"; + } + + *actual_result_type = type_inst->word(3); + } else { + *actual_result_type = inst->type_id(); + } + + return SPV_SUCCESS; +} + +// Returns a string describing actual result type of an opcode. +// Not valid for sparse image opcodes which do not return a struct. +const char* GetActualResultTypeStr(SpvOp opcode) { + if (IsSparse(opcode)) return "Result Type's second member"; + return "Result Type"; +} + +spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { + assert(inst->type_id() == 0); + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, inst->word(1), &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (spvIsVulkanEnv(_.context()->target_env)) { + if ((!_.IsFloatScalarType(info.sampled_type) && + !_.IsIntScalarType(info.sampled_type)) || + 32 != _.GetBitWidth(info.sampled_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sampled Type to be a 32-bit int or float " + "scalar type for Vulkan environment"; + } + } else { + const SpvOp sampled_type_opcode = _.GetIdOpcode(info.sampled_type); + if (sampled_type_opcode != SpvOpTypeVoid && + sampled_type_opcode != SpvOpTypeInt && + sampled_type_opcode != SpvOpTypeFloat) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sampled Type to be either void or" + << " numerical scalar type"; + } + } + + // Dim is checked elsewhere. + + if (info.depth > 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Invalid Depth " << info.depth << " (must be 0, 1 or 2)"; + } + + if (info.arrayed > 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Invalid Arrayed " << info.arrayed << " (must be 0 or 1)"; + } + + if (info.multisampled > 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Invalid MS " << info.multisampled << " (must be 0 or 1)"; + } + + if (info.sampled > 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Invalid Sampled " << info.sampled << " (must be 0, 1 or 2)"; + } + + if (info.dim == SpvDimSubpassData) { + if (info.sampled != 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim SubpassData requires Sampled to be 2"; + } + + if (info.format != SpvImageFormatUnknown) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Dim SubpassData requires format Unknown"; + } + } + + // Format and Access Qualifier are checked elsewhere. + + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeSampledImage(ValidationState_t& _, + const Instruction* inst) { + const uint32_t image_type = inst->word(2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateSampledImage(ValidationState_t& _, + const Instruction* inst) { + if (_.GetIdOpcode(inst->type_id()) != SpvOpTypeSampledImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be OpTypeSampledImage."; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage."; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + // TODO(atgoo@github.com) Check compatibility of result type and received + // image. + + if (spvIsVulkanEnv(_.context()->target_env)) { + if (info.sampled != 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled' parameter to be 1 " + << "for Vulkan environment."; + } + } else { + if (info.sampled != 0 && info.sampled != 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled' parameter to be 0 or 1"; + } + } + + if (info.dim == SpvDimSubpassData) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Dim' parameter to be not SubpassData."; + } + + if (_.GetIdOpcode(_.GetOperandTypeId(inst, 3)) != SpvOpTypeSampler) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sampler to be of type OpTypeSampler"; + } + + // We need to validate 2 things: + // * All OpSampledImage instructions must be in the same block in which their + // Result are consumed. + // * Result from OpSampledImage instructions must not appear as operands + // to OpPhi instructions or OpSelect instructions, or any instructions other + // than the image lookup and query instructions specified to take an operand + // whose type is OpTypeSampledImage. + std::vector consumers = _.getSampledImageConsumers(inst->id()); + if (!consumers.empty()) { + for (auto consumer_id : consumers) { + const auto consumer_instr = _.FindDef(consumer_id); + const auto consumer_opcode = consumer_instr->opcode(); + if (consumer_instr->block() != inst->block()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "All OpSampledImage instructions must be in the same block " + "in " + "which their Result are consumed. OpSampledImage Result " + "Type '" + << _.getIdName(inst->id()) + << "' has a consumer in a different basic " + "block. The consumer instruction is '" + << _.getIdName(consumer_id) << "'."; + } + // TODO: The following check is incomplete. We should also check that the + // Sampled Image is not used by instructions that should not take + // SampledImage as an argument. We could find the list of valid + // instructions by scanning for "Sampled Image" in the operand description + // field in the grammar file. + if (consumer_opcode == SpvOpPhi || consumer_opcode == SpvOpSelect) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Result from OpSampledImage instruction must not appear " + "as " + "operands of Op" + << spvOpcodeString(static_cast(consumer_opcode)) << "." + << " Found result '" << _.getIdName(inst->id()) + << "' as an operand of '" << _.getIdName(consumer_id) + << "'."; + } + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + uint32_t actual_result_type = 0; + if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { + return error; + } + + if (!_.IsIntVectorType(actual_result_type) && + !_.IsFloatVectorType(actual_result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to be int or float vector type"; + } + + if (_.GetDimension(actual_result_type) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to have 4 components"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sampled Image to be of type OpTypeSampledImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; + + if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + const uint32_t texel_component_type = + _.GetComponentType(actual_result_type); + if (texel_component_type != info.sampled_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled Type' to be the same as " + << GetActualResultTypeStr(opcode) << " components"; + } + } + + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); + if ((opcode == SpvOpImageSampleExplicitLod || + opcode == SpvOpImageSparseSampleExplicitLod) && + _.HasCapability(SpvCapabilityKernel)) { + if (!_.IsFloatScalarOrVectorType(coord_type) && + !_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be int or float scalar or vector"; + } + } else { + if (!_.IsFloatScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be float scalar or vector"; + } + } + + const uint32_t min_coord_size = GetMinCoordSize(opcode, info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + if (inst->words().size() <= 5) { + assert(IsImplicitLod(opcode)); + return SPV_SUCCESS; + } + + const uint32_t mask = inst->word(5); + if (spv_result_t result = + ValidateImageOperands(_, inst, info, mask, /* word_index = */ 6)) + return result; + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageDrefLod(ValidationState_t& _, + const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + uint32_t actual_result_type = 0; + if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { + return error; + } + + if (!_.IsIntScalarType(actual_result_type) && + !_.IsFloatScalarType(actual_result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to be int or float scalar type"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sampled Image to be of type OpTypeSampledImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; + + if (actual_result_type != info.sampled_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled Type' to be the same as " + << GetActualResultTypeStr(opcode); + } + + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); + if (!_.IsFloatScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be float scalar or vector"; + } + + const uint32_t min_coord_size = GetMinCoordSize(opcode, info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + const uint32_t dref_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarType(dref_type) || _.GetBitWidth(dref_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Dref to be of 32-bit float type"; + } + + if (inst->words().size() <= 6) { + assert(IsImplicitLod(opcode)); + return SPV_SUCCESS; + } + + const uint32_t mask = inst->word(6); + if (spv_result_t result = + ValidateImageOperands(_, inst, info, mask, /* word_index = */ 7)) + return result; + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { + uint32_t actual_result_type = 0; + if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { + return error; + } + + const SpvOp opcode = inst->opcode(); + if (!_.IsIntVectorType(actual_result_type) && + !_.IsFloatVectorType(actual_result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to be int or float vector type"; + } + + if (_.GetDimension(actual_result_type) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to have 4 components"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + const uint32_t result_component_type = + _.GetComponentType(actual_result_type); + if (result_component_type != info.sampled_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled Type' to be the same as " + << GetActualResultTypeStr(opcode) << " components"; + } + } + + if (info.dim == SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' cannot be Cube"; + } + + if (info.sampled != 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled' parameter to be 1"; + } + + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); + if (!_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be int scalar or vector"; + } + + const uint32_t min_coord_size = GetMinCoordSize(opcode, info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + if (inst->words().size() <= 5) return SPV_SUCCESS; + + const uint32_t mask = inst->word(5); + if (spv_result_t result = + ValidateImageOperands(_, inst, info, mask, /* word_index = */ 6)) + return result; + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageGather(ValidationState_t& _, + const Instruction* inst) { + uint32_t actual_result_type = 0; + if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) + return error; + + const SpvOp opcode = inst->opcode(); + if (!_.IsIntVectorType(actual_result_type) && + !_.IsFloatVectorType(actual_result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to be int or float vector type"; + } + + if (_.GetDimension(actual_result_type) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to have 4 components"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sampled Image to be of type OpTypeSampledImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (opcode == SpvOpImageDrefGather || opcode == SpvOpImageSparseDrefGather || + _.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + const uint32_t result_component_type = + _.GetComponentType(actual_result_type); + if (result_component_type != info.sampled_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled Type' to be the same as " + << GetActualResultTypeStr(opcode) << " components"; + } + } + + if (info.dim != SpvDim2D && info.dim != SpvDimCube && + info.dim != SpvDimRect) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Dim' cannot be Cube"; + } + + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); + if (!_.IsFloatScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be float scalar or vector"; + } + + const uint32_t min_coord_size = GetMinCoordSize(opcode, info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + if (opcode == SpvOpImageGather || opcode == SpvOpImageSparseGather) { + const uint32_t component_index_type = _.GetOperandTypeId(inst, 4); + if (!_.IsIntScalarType(component_index_type) || + _.GetBitWidth(component_index_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Component to be 32-bit int scalar"; + } + } else { + assert(opcode == SpvOpImageDrefGather || + opcode == SpvOpImageSparseDrefGather); + const uint32_t dref_type = _.GetOperandTypeId(inst, 4); + if (!_.IsFloatScalarType(dref_type) || _.GetBitWidth(dref_type) != 32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Dref to be of 32-bit float type"; + } + } + + if (inst->words().size() <= 6) return SPV_SUCCESS; + + const uint32_t mask = inst->word(6); + if (spv_result_t result = + ValidateImageOperands(_, inst, info, mask, /* word_index = */ 7)) + return result; + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + uint32_t actual_result_type = 0; + if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { + return error; + } + + if (!_.IsIntScalarOrVectorType(actual_result_type) && + !_.IsFloatScalarOrVectorType(actual_result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to be int or float scalar or vector type"; + } + +#if 0 + // TODO(atgoo@github.com) Disabled until the spec is clarified. + if (_.GetDimension(actual_result_type) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected " << GetActualResultTypeStr(opcode) + << " to have 4 components"; + } +#endif + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (info.dim == SpvDimSubpassData) { + if (opcode == SpvOpImageSparseRead) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image Dim SubpassData cannot be used with ImageSparseRead"; + } + + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + std::string("Dim SubpassData requires Fragment execution model: ") + + spvOpcodeString(opcode)); + } + + if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + const uint32_t result_component_type = + _.GetComponentType(actual_result_type); + if (result_component_type != info.sampled_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled Type' to be the same as " + << GetActualResultTypeStr(opcode) << " components"; + } + } + + if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; + + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); + if (!_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be int scalar or vector"; + } + + const uint32_t min_coord_size = GetMinCoordSize(opcode, info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + if (info.format == SpvImageFormatUnknown && info.dim != SpvDimSubpassData && + !_.HasCapability(SpvCapabilityStorageImageReadWithoutFormat)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability StorageImageReadWithoutFormat is required to " + << "read storage image"; + } + + if (inst->words().size() <= 5) return SPV_SUCCESS; + + const uint32_t mask = inst->word(5); + if (spv_result_t result = + ValidateImageOperands(_, inst, info, mask, /* word_index = */ 6)) + return result; + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { + const uint32_t image_type = _.GetOperandTypeId(inst, 0); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (info.dim == SpvDimSubpassData) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' cannot be SubpassData"; + } + + if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; + + const uint32_t coord_type = _.GetOperandTypeId(inst, 1); + if (!_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be int scalar or vector"; + } + + const uint32_t min_coord_size = GetMinCoordSize(inst->opcode(), info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + + // TODO(atgoo@github.com) The spec doesn't explicitely say what the type + // of texel should be. + const uint32_t texel_type = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarOrVectorType(texel_type) && + !_.IsFloatScalarOrVectorType(texel_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Texel to be int or float vector or scalar"; + } + +#if 0 + // TODO: See above. + if (_.GetDimension(texel_type) != 4) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Texel to have 4 components"; + } +#endif + + if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { + const uint32_t texel_component_type = _.GetComponentType(texel_type); + if (texel_component_type != info.sampled_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image 'Sampled Type' to be the same as Texel " + << "components"; + } + } + + if (info.format == SpvImageFormatUnknown && info.dim != SpvDimSubpassData && + !_.HasCapability(SpvCapabilityStorageImageWriteWithoutFormat)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Capability StorageImageWriteWithoutFormat is required to " + "write " + << "to storage image"; + } + + if (inst->words().size() <= 4) return SPV_SUCCESS; + + const uint32_t mask = inst->word(4); + if (spv_result_t result = + ValidateImageOperands(_, inst, info, mask, /* word_index = */ 5)) + return result; + + return SPV_SUCCESS; +} + +spv_result_t ValidateImage(ValidationState_t& _, const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + if (_.GetIdOpcode(result_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be OpTypeImage"; + } + + const uint32_t sampled_image_type = _.GetOperandTypeId(inst, 2); + const Instruction* sampled_image_type_inst = _.FindDef(sampled_image_type); + assert(sampled_image_type_inst); + + if (sampled_image_type_inst->opcode() != SpvOpTypeSampledImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sample Image to be of type OpTypeSampleImage"; + } + + if (sampled_image_type_inst->word(2) != result_type) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Sample Image image type to be equal to Result Type"; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, + const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be int scalar or vector type"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + uint32_t expected_num_components = info.arrayed; + switch (info.dim) { + case SpvDim1D: + expected_num_components += 1; + break; + case SpvDim2D: + case SpvDimCube: + expected_num_components += 2; + break; + case SpvDim3D: + expected_num_components += 3; + break; + default: + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' must be 1D, 2D, 3D or Cube"; + } + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'MS' must be 0"; + } + + uint32_t result_num_components = _.GetDimension(result_type); + if (result_num_components != expected_num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result Type has " << result_num_components << " components, " + << "but " << expected_num_components << " expected"; + } + + const uint32_t lod_type = _.GetOperandTypeId(inst, 3); + if (!_.IsIntScalarType(lod_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Level of Detail to be int scalar"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateImageQuerySize(ValidationState_t& _, + const Instruction* inst) { + const uint32_t result_type = inst->type_id(); + if (!_.IsIntScalarOrVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be int scalar or vector type"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + +#if 0 + // TODO(atgoo@github.com) The spec doesn't whitelist all Dims supported by + // GLSL. Need to verify if there is an error and reenable. + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + uint32_t expected_num_components = info.arrayed; + switch (info.dim) { + case SpvDimBuffer: + expected_num_components += 1; + break; + case SpvDim2D: + if (info.multisampled != 1 && info.sampled != 0 && + info.sampled != 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected either 'MS'=1 or 'Sampled'=0 or 'Sampled'=2 " + << "for 2D dim"; + } + case SpvDimRect: + expected_num_components += 2; + break; + case SpvDim3D: + expected_num_components += 3; + if (info.sampled != 0 && + info.sampled != 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected either 'Sampled'=0 or 'Sampled'=2 " + << "for 3D dim"; + } + break; + default: + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' must be Buffer, 2D, 3D or Rect"; + } + + + if (info.multisampled != 0) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'MS' must be 0"; + } + + uint32_t result_num_components = _.GetDimension(result_type); + if (result_num_components != expected_num_components) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Result Type has " << result_num_components << " components, " + << "but " << expected_num_components << " expected"; + } +#endif + + return SPV_SUCCESS; +} + +spv_result_t ValidateImageQueryFormatOrOrder(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsIntScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be int scalar type"; + } + + if (_.GetIdOpcode(_.GetOperandTypeId(inst, 2)) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operand to be of type OpTypeImage"; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateImageQueryLod(ValidationState_t& _, + const Instruction* inst) { + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + "OpImageQueryLod requires Fragment execution model"); + + const uint32_t result_type = inst->type_id(); + if (!_.IsFloatVectorType(result_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be float vector type"; + } + + if (_.GetDimension(result_type) != 2) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to have 2 components"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image operand to be of type OpTypeSampledImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && + info.dim != SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' must be 1D, 2D, 3D or Cube"; + } + + const uint32_t coord_type = _.GetOperandTypeId(inst, 3); + if (_.HasCapability(SpvCapabilityKernel)) { + if (!_.IsFloatScalarOrVectorType(coord_type) && + !_.IsIntScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be int or float scalar or vector"; + } + } else { + if (!_.IsFloatScalarOrVectorType(coord_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to be float scalar or vector"; + } + } + + const uint32_t min_coord_size = GetPlaneCoordSize(info); + const uint32_t actual_coord_size = _.GetDimension(coord_type); + if (min_coord_size > actual_coord_size) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Coordinate to have at least " << min_coord_size + << " components, but given only " << actual_coord_size; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateImageSparseLod(ValidationState_t& _, + const Instruction* inst) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Instruction reserved for future use, use of this instruction " + << "is invalid"; +} + +spv_result_t ValidateImageQueryLevelsOrSamples(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsIntScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be int scalar type"; + } + + const uint32_t image_type = _.GetOperandTypeId(inst, 2); + if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Image to be of type OpTypeImage"; + } + + ImageTypeInfo info; + if (!GetImageTypeInfo(_, image_type, &info)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Corrupt image type definition"; + } + + const SpvOp opcode = inst->opcode(); + if (opcode == SpvOpImageQueryLevels) { + if (info.dim != SpvDim1D && info.dim != SpvDim2D && info.dim != SpvDim3D && + info.dim != SpvDimCube) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Image 'Dim' must be 1D, 2D, 3D or Cube"; + } + } else { + assert(opcode == SpvOpImageQuerySamples); + if (info.dim != SpvDim2D) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be 2D"; + } + + if (info.multisampled != 1) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'MS' must be 1"; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateImageSparseTexelsResident(ValidationState_t& _, + const Instruction* inst) { + if (!_.IsBoolScalarType(inst->type_id())) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Result Type to be bool scalar type"; + } + + const uint32_t resident_code_type = _.GetOperandTypeId(inst, 2); + if (!_.IsIntScalarType(resident_code_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected Resident Code to be int scalar"; + } + + return SPV_SUCCESS; +} + +} // namespace + +// Validates correctness of image instructions. +spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + if (IsImplicitLod(opcode)) { + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelFragment, + "ImplicitLod instructions require Fragment execution model"); + } + + switch (opcode) { + case SpvOpTypeImage: + return ValidateTypeImage(_, inst); + case SpvOpTypeSampledImage: + return ValidateTypeSampledImage(_, inst); + case SpvOpSampledImage: + return ValidateSampledImage(_, inst); + + case SpvOpImageSampleImplicitLod: + case SpvOpImageSampleExplicitLod: + case SpvOpImageSampleProjImplicitLod: + case SpvOpImageSampleProjExplicitLod: + case SpvOpImageSparseSampleImplicitLod: + case SpvOpImageSparseSampleExplicitLod: + return ValidateImageLod(_, inst); + + case SpvOpImageSampleDrefImplicitLod: + case SpvOpImageSampleDrefExplicitLod: + case SpvOpImageSampleProjDrefImplicitLod: + case SpvOpImageSampleProjDrefExplicitLod: + case SpvOpImageSparseSampleDrefImplicitLod: + case SpvOpImageSparseSampleDrefExplicitLod: + return ValidateImageDrefLod(_, inst); + + case SpvOpImageFetch: + case SpvOpImageSparseFetch: + return ValidateImageFetch(_, inst); + + case SpvOpImageGather: + case SpvOpImageDrefGather: + case SpvOpImageSparseGather: + case SpvOpImageSparseDrefGather: + return ValidateImageGather(_, inst); + + case SpvOpImageRead: + case SpvOpImageSparseRead: + return ValidateImageRead(_, inst); + + case SpvOpImageWrite: + return ValidateImageWrite(_, inst); + + case SpvOpImage: + return ValidateImage(_, inst); + + case SpvOpImageQueryFormat: + case SpvOpImageQueryOrder: + return ValidateImageQueryFormatOrOrder(_, inst); + + case SpvOpImageQuerySizeLod: + return ValidateImageQuerySizeLod(_, inst); + case SpvOpImageQuerySize: + return ValidateImageQuerySize(_, inst); + case SpvOpImageQueryLod: + return ValidateImageQueryLod(_, inst); + + case SpvOpImageQueryLevels: + case SpvOpImageQuerySamples: + return ValidateImageQueryLevelsOrSamples(_, inst); + + case SpvOpImageSparseSampleProjImplicitLod: + case SpvOpImageSparseSampleProjExplicitLod: + case SpvOpImageSparseSampleProjDrefImplicitLod: + case SpvOpImageSparseSampleProjDrefExplicitLod: + return ValidateImageSparseLod(_, inst); + + case SpvOpImageSparseTexelsResident: + return ValidateImageSparseTexelsResident(_, inst); + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp new file mode 100644 index 00000000000..85995caa3ee --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_instruction.cpp @@ -0,0 +1,593 @@ +// Copyright (c) 2015-2016 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. + +// Performs validation on instructions that appear inside of a SPIR-V block. + +#include "source/val/validate.h" + +#include +#include +#include +#include +#include + +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/enum_set.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" +#include "source/spirv_definition.h" +#include "source/spirv_target_env.h" +#include "source/spirv_validator_options.h" +#include "source/util/string_utils.h" +#include "source/val/function.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +std::string ToString(const CapabilitySet& capabilities, + const AssemblyGrammar& grammar) { + std::stringstream ss; + capabilities.ForEach([&grammar, &ss](SpvCapability cap) { + spv_operand_desc desc; + if (SPV_SUCCESS == + grammar.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc)) + ss << desc->name << " "; + else + ss << cap << " "; + }); + return ss.str(); +} + +// Returns capabilities that enable an opcode. An empty result is interpreted +// as no prohibition of use of the opcode. If the result is non-empty, then +// the opcode may only be used if at least one of the capabilities is specified +// by the module. +CapabilitySet EnablingCapabilitiesForOp(const ValidationState_t& state, + SpvOp opcode) { + // Exceptions for SPV_AMD_shader_ballot + switch (opcode) { + // Normally these would require Group capability + case SpvOpGroupIAddNonUniformAMD: + case SpvOpGroupFAddNonUniformAMD: + case SpvOpGroupFMinNonUniformAMD: + case SpvOpGroupUMinNonUniformAMD: + case SpvOpGroupSMinNonUniformAMD: + case SpvOpGroupFMaxNonUniformAMD: + case SpvOpGroupUMaxNonUniformAMD: + case SpvOpGroupSMaxNonUniformAMD: + if (state.HasExtension(kSPV_AMD_shader_ballot)) return CapabilitySet(); + break; + default: + break; + } + // Look it up in the grammar + spv_opcode_desc opcode_desc = {}; + if (SPV_SUCCESS == state.grammar().lookupOpcode(opcode, &opcode_desc)) { + return state.grammar().filterCapsAgainstTargetEnv( + opcode_desc->capabilities, opcode_desc->numCapabilities); + } + return CapabilitySet(); +} + +// Returns SPV_SUCCESS if the given operand is enabled by capabilities declared +// in the module. Otherwise issues an error message and returns +// SPV_ERROR_INVALID_CAPABILITY. +spv_result_t CheckRequiredCapabilities(const ValidationState_t& state, + const Instruction* inst, + size_t which_operand, + spv_operand_type_t type, + uint32_t operand) { + // Mere mention of PointSize, ClipDistance, or CullDistance in a Builtin + // decoration does not require the associated capability. The use of such + // a variable value should trigger the capability requirement, but that's + // not implemented yet. This rule is independent of target environment. + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/365 + if (type == SPV_OPERAND_TYPE_BUILT_IN) { + switch (operand) { + case SpvBuiltInPointSize: + case SpvBuiltInClipDistance: + case SpvBuiltInCullDistance: + return SPV_SUCCESS; + default: + break; + } + } else if (type == SPV_OPERAND_TYPE_FP_ROUNDING_MODE) { + // Allow all FP rounding modes if requested + if (state.features().free_fp_rounding_mode) { + return SPV_SUCCESS; + } + } else if (type == SPV_OPERAND_TYPE_GROUP_OPERATION && + state.features().group_ops_reduce_and_scans && + (operand <= uint32_t(SpvGroupOperationExclusiveScan))) { + // Allow certain group operations if requested. + return SPV_SUCCESS; + } + + CapabilitySet enabling_capabilities; + spv_operand_desc operand_desc = nullptr; + const auto lookup_result = + state.grammar().lookupOperand(type, operand, &operand_desc); + if (lookup_result == SPV_SUCCESS) { + // Allow FPRoundingMode decoration if requested. + if (type == SPV_OPERAND_TYPE_DECORATION && + operand_desc->value == SpvDecorationFPRoundingMode) { + if (state.features().free_fp_rounding_mode) return SPV_SUCCESS; + + // Vulkan API requires more capabilities on rounding mode. + if (spvIsVulkanEnv(state.context()->target_env)) { + enabling_capabilities.Add(SpvCapabilityStorageUniformBufferBlock16); + enabling_capabilities.Add(SpvCapabilityStorageUniform16); + enabling_capabilities.Add(SpvCapabilityStoragePushConstant16); + enabling_capabilities.Add(SpvCapabilityStorageInputOutput16); + } + } else { + enabling_capabilities = state.grammar().filterCapsAgainstTargetEnv( + operand_desc->capabilities, operand_desc->numCapabilities); + } + + if (!state.HasAnyOfCapabilities(enabling_capabilities)) { + return state.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Operand " << which_operand << " of " + << spvOpcodeString(inst->opcode()) + << " requires one of these capabilities: " + << ToString(enabling_capabilities, state.grammar()); + } + } + + return SPV_SUCCESS; +} + +// Returns operand's required extensions. +ExtensionSet RequiredExtensions(const ValidationState_t& state, + spv_operand_type_t type, uint32_t operand) { + spv_operand_desc operand_desc; + if (state.grammar().lookupOperand(type, operand, &operand_desc) == + SPV_SUCCESS) { + assert(operand_desc); + // If this operand is incorporated into core SPIR-V before or in the current + // target environment, we don't require extensions anymore. + if (spvVersionForTargetEnv(state.grammar().target_env()) >= + operand_desc->minVersion) + return {}; + return {operand_desc->numExtensions, operand_desc->extensions}; + } + + return {}; +} + +// Returns SPV_ERROR_INVALID_BINARY and emits a diagnostic if the instruction +// is explicitly reserved in the SPIR-V core spec. Otherwise return +// SPV_SUCCESS. +spv_result_t ReservedCheck(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + switch (opcode) { + // These instructions are enabled by a capability, but should never + // be used anyway. + case SpvOpImageSparseSampleProjImplicitLod: + case SpvOpImageSparseSampleProjExplicitLod: + case SpvOpImageSparseSampleProjDrefImplicitLod: + case SpvOpImageSparseSampleProjDrefExplicitLod: { + spv_opcode_desc inst_desc; + _.grammar().lookupOpcode(opcode, &inst_desc); + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "Invalid Opcode name 'Op" << inst_desc->name << "'"; + } + default: + break; + } + return SPV_SUCCESS; +} + +// Returns SPV_ERROR_INVALID_BINARY and emits a diagnostic if the instruction +// is invalid because of an execution environment constraint. +spv_result_t EnvironmentCheck(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + switch (opcode) { + case SpvOpUndef: + if (_.features().bans_op_undef) { + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "OpUndef is disallowed"; + } + break; + default: + break; + } + return SPV_SUCCESS; +} + +// Returns SPV_ERROR_INVALID_CAPABILITY and emits a diagnostic if the +// instruction is invalid because the required capability isn't declared +// in the module. +spv_result_t CapabilityCheck(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + CapabilitySet opcode_caps = EnablingCapabilitiesForOp(_, opcode); + if (!_.HasAnyOfCapabilities(opcode_caps)) { + return _.diag(SPV_ERROR_INVALID_CAPABILITY, inst) + << "Opcode " << spvOpcodeString(opcode) + << " requires one of these capabilities: " + << ToString(opcode_caps, _.grammar()); + } + for (size_t i = 0; i < inst->operands().size(); ++i) { + const auto& operand = inst->operand(i); + const auto word = inst->word(operand.offset); + if (spvOperandIsConcreteMask(operand.type)) { + // Check for required capabilities for each bit position of the mask. + for (uint32_t mask_bit = 0x80000000; mask_bit; mask_bit >>= 1) { + if (word & mask_bit) { + spv_result_t status = + CheckRequiredCapabilities(_, inst, i + 1, operand.type, mask_bit); + if (status != SPV_SUCCESS) return status; + } + } + } else if (spvIsIdType(operand.type)) { + // TODO(dneto): Check the value referenced by this Id, if we can compute + // it. For now, just punt, to fix issue 248: + // https://github.com/KhronosGroup/SPIRV-Tools/issues/248 + } else { + // Check the operand word as a whole. + spv_result_t status = + CheckRequiredCapabilities(_, inst, i + 1, operand.type, word); + if (status != SPV_SUCCESS) return status; + } + } + return SPV_SUCCESS; +} + +// Checks that all extensions required by the given instruction's operands were +// declared in the module. +spv_result_t ExtensionCheck(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + for (size_t operand_index = 0; operand_index < inst->operands().size(); + ++operand_index) { + const auto& operand = inst->operand(operand_index); + const uint32_t word = inst->word(operand.offset); + const ExtensionSet required_extensions = + RequiredExtensions(_, operand.type, word); + if (!_.HasAnyOfExtensions(required_extensions)) { + return _.diag(SPV_ERROR_MISSING_EXTENSION, inst) + << spvtools::utils::CardinalToOrdinal(operand_index + 1) + << " operand of " << spvOpcodeString(opcode) << ": operand " + << word << " requires one of these extensions: " + << ExtensionSetToString(required_extensions); + } + } + return SPV_SUCCESS; +} + +// Checks that the instruction can be used in this target environment's base +// version. Assumes that CapabilityCheck has checked direct capability +// dependencies for the opcode. +spv_result_t VersionCheck(ValidationState_t& _, const Instruction* inst) { + const auto opcode = inst->opcode(); + spv_opcode_desc inst_desc; + const spv_result_t r = _.grammar().lookupOpcode(opcode, &inst_desc); + assert(r == SPV_SUCCESS); + (void)r; + + const auto min_version = inst_desc->minVersion; + + if (inst_desc->numCapabilities > 0u) { + // We already checked that the direct capability dependency has been + // satisfied. We don't need to check any further. + return SPV_SUCCESS; + } + + ExtensionSet exts(inst_desc->numExtensions, inst_desc->extensions); + if (exts.IsEmpty()) { + // If no extensions can enable this instruction, then emit error messages + // only concerning core SPIR-V versions if errors happen. + if (min_version == ~0u) { + return _.diag(SPV_ERROR_WRONG_VERSION, inst) + << spvOpcodeString(opcode) << " is reserved for future use."; + } + + if (spvVersionForTargetEnv(_.grammar().target_env()) < min_version) { + return _.diag(SPV_ERROR_WRONG_VERSION, inst) + << spvOpcodeString(opcode) << " requires " + << spvTargetEnvDescription( + static_cast(min_version)) + << " at minimum."; + } + // Otherwise, we only error out when no enabling extensions are registered. + } else if (!_.HasAnyOfExtensions(exts)) { + if (min_version == ~0u) { + return _.diag(SPV_ERROR_MISSING_EXTENSION, inst) + << spvOpcodeString(opcode) + << " requires one of the following extensions: " + << ExtensionSetToString(exts); + } + + if (static_cast(_.grammar().target_env()) < min_version) { + return _.diag(SPV_ERROR_WRONG_VERSION, inst) + << spvOpcodeString(opcode) << " requires " + << spvTargetEnvDescription( + static_cast(min_version)) + << " at minimum or one of the following extensions: " + << ExtensionSetToString(exts); + } + } + + return SPV_SUCCESS; +} + +// Checks that the Resuld is within the valid bound. +spv_result_t LimitCheckIdBound(ValidationState_t& _, const Instruction* inst) { + if (inst->id() >= _.getIdBound()) { + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "Result '" << inst->id() + << "' must be less than the ID bound '" << _.getIdBound() << "'."; + } + return SPV_SUCCESS; +} + +// Checks that the number of OpTypeStruct members is within the limit. +spv_result_t LimitCheckStruct(ValidationState_t& _, const Instruction* inst) { + if (SpvOpTypeStruct != inst->opcode()) { + return SPV_SUCCESS; + } + + // Number of members is the number of operands of the instruction minus 1. + // One operand is the result ID. + const uint16_t limit = + static_cast(_.options()->universal_limits_.max_struct_members); + if (inst->operands().size() - 1 > limit) { + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "Number of OpTypeStruct members (" << inst->operands().size() - 1 + << ") has exceeded the limit (" << limit << ")."; + } + + // Section 2.17 of SPIRV Spec specifies that the "Structure Nesting Depth" + // must be less than or equal to 255. + // This is interpreted as structures including other structures as members. + // The code does not follow pointers or look into arrays to see if we reach a + // structure downstream. + // The nesting depth of a struct is 1+(largest depth of any member). + // Scalars are at depth 0. + uint32_t max_member_depth = 0; + // Struct members start at word 2 of OpTypeStruct instruction. + for (size_t word_i = 2; word_i < inst->words().size(); ++word_i) { + auto member = inst->word(word_i); + auto memberTypeInstr = _.FindDef(member); + if (memberTypeInstr && SpvOpTypeStruct == memberTypeInstr->opcode()) { + max_member_depth = std::max( + max_member_depth, _.struct_nesting_depth(memberTypeInstr->id())); + } + } + + const uint32_t depth_limit = _.options()->universal_limits_.max_struct_depth; + const uint32_t cur_depth = 1 + max_member_depth; + _.set_struct_nesting_depth(inst->id(), cur_depth); + if (cur_depth > depth_limit) { + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "Structure Nesting Depth may not be larger than " << depth_limit + << ". Found " << cur_depth << "."; + } + return SPV_SUCCESS; +} + +// Checks that the number of (literal, label) pairs in OpSwitch is within the +// limit. +spv_result_t LimitCheckSwitch(ValidationState_t& _, const Instruction* inst) { + if (SpvOpSwitch == inst->opcode()) { + // The instruction syntax is as follows: + // OpSwitch literal label literal label ... + // literal,label pairs come after the first 2 operands. + // It is guaranteed at this point that num_operands is an even numner. + size_t num_pairs = (inst->operands().size() - 2) / 2; + const unsigned int num_pairs_limit = + _.options()->universal_limits_.max_switch_branches; + if (num_pairs > num_pairs_limit) { + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "Number of (literal, label) pairs in OpSwitch (" << num_pairs + << ") exceeds the limit (" << num_pairs_limit << ")."; + } + } + return SPV_SUCCESS; +} + +// Ensure the number of variables of the given class does not exceed the limit. +spv_result_t LimitCheckNumVars(ValidationState_t& _, const uint32_t var_id, + const SpvStorageClass storage_class) { + if (SpvStorageClassFunction == storage_class) { + _.registerLocalVariable(var_id); + const uint32_t num_local_vars_limit = + _.options()->universal_limits_.max_local_variables; + if (_.num_local_vars() > num_local_vars_limit) { + return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) + << "Number of local variables ('Function' Storage Class) " + "exceeded the valid limit (" + << num_local_vars_limit << ")."; + } + } else { + _.registerGlobalVariable(var_id); + const uint32_t num_global_vars_limit = + _.options()->universal_limits_.max_global_variables; + if (_.num_global_vars() > num_global_vars_limit) { + return _.diag(SPV_ERROR_INVALID_BINARY, nullptr) + << "Number of Global Variables (Storage Class other than " + "'Function') exceeded the valid limit (" + << num_global_vars_limit << ")."; + } + } + return SPV_SUCCESS; +} + +// Registers necessary decoration(s) for the appropriate IDs based on the +// instruction. +spv_result_t RegisterDecorations(ValidationState_t& _, + const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpDecorate: { + const uint32_t target_id = inst->word(1); + const SpvDecoration dec_type = static_cast(inst->word(2)); + std::vector dec_params; + if (inst->words().size() > 3) { + dec_params.insert(dec_params.end(), inst->words().begin() + 3, + inst->words().end()); + } + _.RegisterDecorationForId(target_id, Decoration(dec_type, dec_params)); + break; + } + case SpvOpMemberDecorate: { + const uint32_t struct_id = inst->word(1); + const uint32_t index = inst->word(2); + const SpvDecoration dec_type = static_cast(inst->word(3)); + std::vector dec_params; + if (inst->words().size() > 4) { + dec_params.insert(dec_params.end(), inst->words().begin() + 4, + inst->words().end()); + } + _.RegisterDecorationForId(struct_id, + Decoration(dec_type, dec_params, index)); + break; + } + case SpvOpDecorationGroup: { + // We don't need to do anything right now. Assigning decorations to groups + // will be taken care of via OpGroupDecorate. + break; + } + case SpvOpGroupDecorate: { + // Word 1 is the group . All subsequent words are target s that + // are going to be decorated with the decorations. + const uint32_t decoration_group_id = inst->word(1); + std::vector& group_decorations = + _.id_decorations(decoration_group_id); + for (size_t i = 2; i < inst->words().size(); ++i) { + const uint32_t target_id = inst->word(i); + _.RegisterDecorationsForId(target_id, group_decorations.begin(), + group_decorations.end()); + } + break; + } + case SpvOpGroupMemberDecorate: { + // Word 1 is the Decoration Group followed by (struct,literal) + // pairs. All decorations of the group should be applied to all the struct + // members that are specified in the instructions. + const uint32_t decoration_group_id = inst->word(1); + std::vector& group_decorations = + _.id_decorations(decoration_group_id); + // Grammar checks ensures that the number of arguments to this instruction + // is an odd number: 1 decoration group + (id,literal) pairs. + for (size_t i = 2; i + 1 < inst->words().size(); i = i + 2) { + const uint32_t struct_id = inst->word(i); + const uint32_t index = inst->word(i + 1); + // ID validation phase ensures this is in fact a struct instruction and + // that the index is not out of bound. + _.RegisterDecorationsForStructMember(struct_id, index, + group_decorations.begin(), + group_decorations.end()); + } + break; + } + default: + break; + } + return SPV_SUCCESS; +} + +// Parses OpExtension instruction and logs warnings if unsuccessful. +void CheckIfKnownExtension(ValidationState_t& _, const Instruction* inst) { + const std::string extension_str = GetExtensionString(&(inst->c_inst())); + Extension extension; + if (!GetExtensionFromString(extension_str.c_str(), &extension)) { + _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "Found unrecognized extension " << extension_str; + return; + } +} + +} // namespace + +spv_result_t InstructionPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + if (opcode == SpvOpExtension) { + CheckIfKnownExtension(_, inst); + } else if (opcode == SpvOpCapability) { + _.RegisterCapability(inst->GetOperandAs(0)); + } else if (opcode == SpvOpMemoryModel) { + if (_.has_memory_model_specified()) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "OpMemoryModel should only be provided once."; + } + _.set_addressing_model(inst->GetOperandAs(0)); + _.set_memory_model(inst->GetOperandAs(1)); + } else if (opcode == SpvOpExecutionMode) { + const uint32_t entry_point = inst->word(1); + _.RegisterExecutionModeForEntryPoint(entry_point, + SpvExecutionMode(inst->word(2))); + } else if (opcode == SpvOpVariable) { + const auto storage_class = inst->GetOperandAs(2); + if (auto error = LimitCheckNumVars(_, inst->id(), storage_class)) { + return error; + } + if (storage_class == SpvStorageClassGeneric) + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "OpVariable storage class cannot be Generic"; + if (_.current_layout_section() == kLayoutFunctionDefinitions) { + if (storage_class != SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Variables must have a function[7] storage class inside" + " of a function"; + } + if (_.current_function().IsFirstBlock( + _.current_function().current_block()->id()) == false) { + return _.diag(SPV_ERROR_INVALID_CFG, inst) + << "Variables can only be defined " + "in the first block of a " + "function"; + } + } else { + if (storage_class == SpvStorageClassFunction) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Variables can not have a function[7] storage class " + "outside of a function"; + } + } + } + + // SPIR-V Spec 2.16.3: Validation Rules for Kernel Capabilities: The + // Signedness in OpTypeInt must always be 0. + if (SpvOpTypeInt == inst->opcode() && _.HasCapability(SpvCapabilityKernel) && + inst->GetOperandAs(2) != 0u) { + return _.diag(SPV_ERROR_INVALID_BINARY, inst) + << "The Signedness in OpTypeInt " + "must always be 0 when Kernel " + "capability is used."; + } + + // In order to validate decoration rules, we need to know all the decorations + // that are applied to any given . + RegisterDecorations(_, inst); + + if (auto error = ExtensionCheck(_, inst)) return error; + if (auto error = ReservedCheck(_, inst)) return error; + if (auto error = EnvironmentCheck(_, inst)) return error; + if (auto error = CapabilityCheck(_, inst)) return error; + if (auto error = LimitCheckIdBound(_, inst)) return error; + if (auto error = LimitCheckStruct(_, inst)) return error; + if (auto error = LimitCheckSwitch(_, inst)) return error; + if (auto error = VersionCheck(_, inst)) return error; + + // All instruction checks have passed. + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp new file mode 100644 index 00000000000..fffc6da1aef --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_interfaces.cpp @@ -0,0 +1,114 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include +#include + +#include "source/diagnostic.h" +#include "source/val/function.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Returns true if \c inst is an input or output variable. +bool is_interface_variable(const Instruction* inst) { + return inst->opcode() == SpvOpVariable && + (inst->word(3u) == SpvStorageClassInput || + inst->word(3u) == SpvStorageClassOutput); +} + +// Checks that \c var is listed as an interface in all the entry points that use +// it. +spv_result_t check_interface_variable(ValidationState_t& _, + const Instruction* var) { + std::vector functions; + std::vector uses; + for (auto use : var->uses()) { + uses.push_back(use.first); + } + for (uint32_t i = 0; i < uses.size(); ++i) { + const auto user = uses[i]; + if (const Function* func = user->function()) { + functions.push_back(func); + } else { + // In the rare case that the variable is used by another instruction in + // the global scope, continue searching for an instruction used in a + // function. + for (auto use : user->uses()) { + uses.push_back(use.first); + } + } + } + + std::sort(functions.begin(), functions.end(), + [](const Function* lhs, const Function* rhs) { + return lhs->id() < rhs->id(); + }); + functions.erase(std::unique(functions.begin(), functions.end()), + functions.end()); + + std::vector entry_points; + for (const auto func : functions) { + for (auto id : _.FunctionEntryPoints(func->id())) { + entry_points.push_back(id); + } + } + + std::sort(entry_points.begin(), entry_points.end()); + entry_points.erase(std::unique(entry_points.begin(), entry_points.end()), + entry_points.end()); + + for (auto id : entry_points) { + for (const auto& desc : _.entry_point_descriptions(id)) { + bool found = false; + for (auto interface : desc.interfaces) { + if (var->id() == interface) { + found = true; + break; + } + } + if (!found) { + return _.diag(SPV_ERROR_INVALID_ID, var) + << (var->word(3u) == SpvStorageClassInput ? "Input" : "Output") + << " variable id <" << var->id() << "> is used by entry point '" + << desc.name << "' id <" << id + << ">, but is not listed as an interface"; + } + } + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ValidateInterfaces(ValidationState_t& _) { + for (auto& inst : _.ordered_instructions()) { + if (is_interface_variable(&inst)) { + if (auto error = check_interface_variable(_, &inst)) { + return error; + } + } + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp new file mode 100644 index 00000000000..53c28355fe9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_layout.cpp @@ -0,0 +1,202 @@ +// Copyright (c) 2015-2016 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. + +// Source code for logical layout validation as described in section 2.4 + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/val/function.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Module scoped instructions are processed by determining if the opcode +// is part of the current layout section. If it is not then the next sections is +// checked. +spv_result_t ModuleScopedInstructions(ValidationState_t& _, + const Instruction* inst, SpvOp opcode) { + while (_.IsOpcodeInCurrentLayoutSection(opcode) == false) { + _.ProgressToNextLayoutSectionOrder(); + + switch (_.current_layout_section()) { + case kLayoutMemoryModel: + if (opcode != SpvOpMemoryModel) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << spvOpcodeString(opcode) + << " cannot appear before the memory model instruction"; + } + break; + case kLayoutFunctionDeclarations: + // All module sections have been processed. Recursively call + // ModuleLayoutPass to process the next section of the module + return ModuleLayoutPass(_, inst); + default: + break; + } + } + return SPV_SUCCESS; +} + +// Function declaration validation is performed by making sure that the +// FunctionParameter and FunctionEnd instructions only appear inside of +// functions. It also ensures that the Function instruction does not appear +// inside of another function. This stage ends when the first label is +// encountered inside of a function. +spv_result_t FunctionScopedInstructions(ValidationState_t& _, + const Instruction* inst, SpvOp opcode) { + if (_.IsOpcodeInCurrentLayoutSection(opcode)) { + switch (opcode) { + case SpvOpFunction: { + if (_.in_function_body()) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Cannot declare a function in a function body"; + } + auto control_mask = inst->GetOperandAs(2); + if (auto error = + _.RegisterFunction(inst->id(), inst->type_id(), control_mask, + inst->GetOperandAs(3))) + return error; + if (_.current_layout_section() == kLayoutFunctionDefinitions) { + if (auto error = _.current_function().RegisterSetFunctionDeclType( + FunctionDecl::kFunctionDeclDefinition)) + return error; + } + } break; + + case SpvOpFunctionParameter: + if (_.in_function_body() == false) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function parameter instructions must be in a " + "function body"; + } + if (_.current_function().block_count() != 0) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function parameters must only appear immediately after " + "the function definition"; + } + if (auto error = _.current_function().RegisterFunctionParameter( + inst->id(), inst->type_id())) + return error; + break; + + case SpvOpFunctionEnd: + if (_.in_function_body() == false) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function end instructions must be in a function body"; + } + if (_.in_block()) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function end cannot be called in blocks"; + } + if (_.current_function().block_count() == 0 && + _.current_layout_section() == kLayoutFunctionDefinitions) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Function declarations must appear before " + "function definitions."; + } + if (_.current_layout_section() == kLayoutFunctionDeclarations) { + if (auto error = _.current_function().RegisterSetFunctionDeclType( + FunctionDecl::kFunctionDeclDeclaration)) + return error; + } + if (auto error = _.RegisterFunctionEnd()) return error; + break; + + case SpvOpLine: + case SpvOpNoLine: + break; + case SpvOpLabel: + // If the label is encountered then the current function is a + // definition so set the function to a declaration and update the + // module section + if (_.in_function_body() == false) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "Label instructions must be in a function body"; + } + if (_.in_block()) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "A block must end with a branch instruction."; + } + if (_.current_layout_section() == kLayoutFunctionDeclarations) { + _.ProgressToNextLayoutSectionOrder(); + if (auto error = _.current_function().RegisterSetFunctionDeclType( + FunctionDecl::kFunctionDeclDefinition)) + return error; + } + break; + + default: + if (_.current_layout_section() == kLayoutFunctionDeclarations && + _.in_function_body()) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << "A function must begin with a label"; + } else { + if (_.in_block() == false) { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << spvOpcodeString(opcode) << " must appear in a block"; + } + } + break; + } + } else { + return _.diag(SPV_ERROR_INVALID_LAYOUT, inst) + << spvOpcodeString(opcode) + << " cannot appear in a function declaration"; + } + return SPV_SUCCESS; +} + +} // namespace + +// TODO(umar): Check linkage capabilities for function declarations +// TODO(umar): Better error messages +// NOTE: This function does not handle CFG related validation +// Performs logical layout validation. See Section 2.4 +spv_result_t ModuleLayoutPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + + switch (_.current_layout_section()) { + case kLayoutCapabilities: + case kLayoutExtensions: + case kLayoutExtInstImport: + case kLayoutMemoryModel: + case kLayoutEntryPoint: + case kLayoutExecutionMode: + case kLayoutDebug1: + case kLayoutDebug2: + case kLayoutDebug3: + case kLayoutAnnotations: + case kLayoutTypes: + if (auto error = ModuleScopedInstructions(_, inst, opcode)) return error; + break; + case kLayoutFunctionDeclarations: + case kLayoutFunctionDefinitions: + if (auto error = FunctionScopedInstructions(_, inst, opcode)) { + return error; + } + break; + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp new file mode 100644 index 00000000000..53aae0767a9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_literals.cpp @@ -0,0 +1,99 @@ +// Copyright (c) 2017 Google 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. + +// Validates literal numbers. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// Returns true if the operand holds a literal number +bool IsLiteralNumber(const spv_parsed_operand_t& operand) { + switch (operand.number_kind) { + case SPV_NUMBER_SIGNED_INT: + case SPV_NUMBER_UNSIGNED_INT: + case SPV_NUMBER_FLOATING: + return true; + default: + return false; + } +} + +// Verifies that the upper bits of the given upper |word| with given +// lower |width| are zero- or sign-extended when |signed_int| is true +bool VerifyUpperBits(uint32_t word, uint32_t width, bool signed_int) { + assert(width < 32); + assert(0 < width); + const uint32_t upper_mask = 0xFFFFFFFFu << width; + const uint32_t upper_bits = word & upper_mask; + + bool result = false; + if (signed_int) { + const uint32_t sign_bit = word & (1u << (width - 1)); + if (sign_bit) { + result = upper_bits == upper_mask; + } else { + result = upper_bits == 0; + } + } else { + result = upper_bits == 0; + } + return result; +} + +} // namespace + +// Validates that literal numbers are represented according to the spec +spv_result_t LiteralsPass(ValidationState_t& _, const Instruction* inst) { + // For every operand that is a literal number + for (size_t i = 0; i < inst->operands().size(); i++) { + const spv_parsed_operand_t& operand = inst->operand(i); + if (!IsLiteralNumber(operand)) continue; + + // The upper bits are always in the last word (little-endian) + int last_index = operand.offset + operand.num_words - 1; + const uint32_t upper_word = inst->word(last_index); + + // TODO(jcaraban): is the |word size| defined in some header? + const uint32_t word_size = 32; + uint32_t bit_width = operand.number_bit_width; + + // Bit widths that are a multiple of the word size have no upper bits + const auto remaining_value_bits = bit_width % word_size; + if (remaining_value_bits == 0) continue; + + const bool signedness = operand.number_kind == SPV_NUMBER_SIGNED_INT; + + if (!VerifyUpperBits(upper_word, remaining_value_bits, signedness)) { + return _.diag(SPV_ERROR_INVALID_VALUE, inst) + << "The high-order bits of a literal number in instruction " + << inst->id() << " must be 0 for a floating-point type, " + << "or 0 for an integer type with Signedness of 0, " + << "or sign extended when Signedness is 1"; + } + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp new file mode 100644 index 00000000000..9c637c42330 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_logicals.cpp @@ -0,0 +1,264 @@ +// Copyright (c) 2017 Google 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. + +// Validates correctness of logical SPIR-V instructions. + +#include "source/val/validate.h" + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates correctness of logical instructions. +spv_result_t LogicalsPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + const uint32_t result_type = inst->type_id(); + + switch (opcode) { + case SpvOpAny: + case SpvOpAll: { + if (!_.IsBoolScalarType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t vector_type = _.GetOperandTypeId(inst, 2); + if (!vector_type || !_.IsBoolVectorType(vector_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operand to be vector bool: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpIsNan: + case SpvOpIsInf: + case SpvOpIsFinite: + case SpvOpIsNormal: + case SpvOpSignBitSet: { + if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t operand_type = _.GetOperandTypeId(inst, 2); + if (!operand_type || (!_.IsFloatScalarType(operand_type) && + !_.IsFloatVectorType(operand_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operand to be scalar or vector float: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(operand_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected vector sizes of Result Type and the operand to be " + "equal: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpFOrdEqual: + case SpvOpFUnordEqual: + case SpvOpFOrdNotEqual: + case SpvOpFUnordNotEqual: + case SpvOpFOrdLessThan: + case SpvOpFUnordLessThan: + case SpvOpFOrdGreaterThan: + case SpvOpFUnordGreaterThan: + case SpvOpFOrdLessThanEqual: + case SpvOpFUnordLessThanEqual: + case SpvOpFOrdGreaterThanEqual: + case SpvOpFUnordGreaterThanEqual: + case SpvOpLessOrGreater: + case SpvOpOrdered: + case SpvOpUnordered: { + if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t left_operand_type = _.GetOperandTypeId(inst, 2); + if (!left_operand_type || (!_.IsFloatScalarType(left_operand_type) && + !_.IsFloatVectorType(left_operand_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operands to be scalar or vector float: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(left_operand_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected vector sizes of Result Type and the operands to be " + "equal: " + << spvOpcodeString(opcode); + + if (left_operand_type != _.GetOperandTypeId(inst, 3)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected left and right operands to have the same type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpLogicalEqual: + case SpvOpLogicalNotEqual: + case SpvOpLogicalOr: + case SpvOpLogicalAnd: { + if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + if (result_type != _.GetOperandTypeId(inst, 2) || + result_type != _.GetOperandTypeId(inst, 3)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected both operands to be of Result Type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpLogicalNot: { + if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + if (result_type != _.GetOperandTypeId(inst, 2)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operand to be of Result Type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpSelect: { + uint32_t dimension = 1; + { + const Instruction* type_inst = _.FindDef(result_type); + assert(type_inst); + + const SpvOp type_opcode = type_inst->opcode(); + switch (type_opcode) { + case SpvOpTypePointer: { + if (!_.features().variable_pointers && + !_.features().variable_pointers_storage_buffer) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Using pointers with OpSelect requires capability " + << "VariablePointers or VariablePointersStorageBuffer"; + break; + } + + case SpvOpTypeVector: { + dimension = type_inst->word(3); + break; + } + + case SpvOpTypeBool: + case SpvOpTypeInt: + case SpvOpTypeFloat: { + break; + } + + default: { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + } + } + } + + const uint32_t condition_type = _.GetOperandTypeId(inst, 2); + const uint32_t left_type = _.GetOperandTypeId(inst, 3); + const uint32_t right_type = _.GetOperandTypeId(inst, 4); + + if (!condition_type || (!_.IsBoolScalarType(condition_type) && + !_.IsBoolVectorType(condition_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar or vector type as condition: " + << spvOpcodeString(opcode); + + if (_.GetDimension(condition_type) != dimension) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected vector sizes of Result Type and the condition to be" + << " equal: " << spvOpcodeString(opcode); + + if (result_type != left_type || result_type != right_type) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected both objects to be of Result Type: " + << spvOpcodeString(opcode); + + break; + } + + case SpvOpIEqual: + case SpvOpINotEqual: + case SpvOpUGreaterThan: + case SpvOpUGreaterThanEqual: + case SpvOpULessThan: + case SpvOpULessThanEqual: + case SpvOpSGreaterThan: + case SpvOpSGreaterThanEqual: + case SpvOpSLessThan: + case SpvOpSLessThanEqual: { + if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected bool scalar or vector type as Result Type: " + << spvOpcodeString(opcode); + + const uint32_t left_type = _.GetOperandTypeId(inst, 2); + const uint32_t right_type = _.GetOperandTypeId(inst, 3); + + if (!left_type || + (!_.IsIntScalarType(left_type) && !_.IsIntVectorType(left_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operands to be scalar or vector int: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(left_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected vector sizes of Result Type and the operands to be" + << " equal: " << spvOpcodeString(opcode); + + if (!right_type || + (!_.IsIntScalarType(right_type) && !_.IsIntVectorType(right_type))) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected operands to be scalar or vector int: " + << spvOpcodeString(opcode); + + if (_.GetDimension(result_type) != _.GetDimension(right_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected vector sizes of Result Type and the operands to be" + << " equal: " << spvOpcodeString(opcode); + + if (_.GetBitWidth(left_type) != _.GetBitWidth(right_type)) + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Expected both operands to have the same component bit " + "width: " + << spvOpcodeString(opcode); + + break; + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp new file mode 100644 index 00000000000..18c3cca0f33 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_memory.cpp @@ -0,0 +1,590 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include +#include +#include + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +bool AreLayoutCompatibleStructs(ValidationState_t&, const Instruction*, + const Instruction*); +bool HaveLayoutCompatibleMembers(ValidationState_t&, const Instruction*, + const Instruction*); +bool HaveSameLayoutDecorations(ValidationState_t&, const Instruction*, + const Instruction*); +bool HasConflictingMemberOffsets(const std::vector&, + const std::vector&); + +// Returns true if the two instructions represent structs that, as far as the +// validator can tell, have the exact same data layout. +bool AreLayoutCompatibleStructs(ValidationState_t& _, const Instruction* type1, + const Instruction* type2) { + if (type1->opcode() != SpvOpTypeStruct) { + return false; + } + if (type2->opcode() != SpvOpTypeStruct) { + return false; + } + + if (!HaveLayoutCompatibleMembers(_, type1, type2)) return false; + + return HaveSameLayoutDecorations(_, type1, type2); +} + +// Returns true if the operands to the OpTypeStruct instruction defining the +// types are the same or are layout compatible types. |type1| and |type2| must +// be OpTypeStruct instructions. +bool HaveLayoutCompatibleMembers(ValidationState_t& _, const Instruction* type1, + const Instruction* type2) { + assert(type1->opcode() == SpvOpTypeStruct && + "type1 must be and OpTypeStruct instruction."); + assert(type2->opcode() == SpvOpTypeStruct && + "type2 must be and OpTypeStruct instruction."); + const auto& type1_operands = type1->operands(); + const auto& type2_operands = type2->operands(); + if (type1_operands.size() != type2_operands.size()) { + return false; + } + + for (size_t operand = 2; operand < type1_operands.size(); ++operand) { + if (type1->word(operand) != type2->word(operand)) { + auto def1 = _.FindDef(type1->word(operand)); + auto def2 = _.FindDef(type2->word(operand)); + if (!AreLayoutCompatibleStructs(_, def1, def2)) { + return false; + } + } + } + return true; +} + +// Returns true if all decorations that affect the data layout of the struct +// (like Offset), are the same for the two types. |type1| and |type2| must be +// OpTypeStruct instructions. +bool HaveSameLayoutDecorations(ValidationState_t& _, const Instruction* type1, + const Instruction* type2) { + assert(type1->opcode() == SpvOpTypeStruct && + "type1 must be and OpTypeStruct instruction."); + assert(type2->opcode() == SpvOpTypeStruct && + "type2 must be and OpTypeStruct instruction."); + const std::vector& type1_decorations = + _.id_decorations(type1->id()); + const std::vector& type2_decorations = + _.id_decorations(type2->id()); + + // TODO: Will have to add other check for arrays an matricies if we want to + // handle them. + if (HasConflictingMemberOffsets(type1_decorations, type2_decorations)) { + return false; + } + + return true; +} + +bool HasConflictingMemberOffsets( + const std::vector& type1_decorations, + const std::vector& type2_decorations) { + { + // We are interested in conflicting decoration. If a decoration is in one + // list but not the other, then we will assume the code is correct. We are + // looking for things we know to be wrong. + // + // We do not have to traverse type2_decoration because, after traversing + // type1_decorations, anything new will not be found in + // type1_decoration. Therefore, it cannot lead to a conflict. + for (const Decoration& decoration : type1_decorations) { + switch (decoration.dec_type()) { + case SpvDecorationOffset: { + // Since these affect the layout of the struct, they must be present + // in both structs. + auto compare = [&decoration](const Decoration& rhs) { + if (rhs.dec_type() != SpvDecorationOffset) return false; + return decoration.struct_member_index() == + rhs.struct_member_index(); + }; + auto i = std::find_if(type2_decorations.begin(), + type2_decorations.end(), compare); + if (i != type2_decorations.end() && + decoration.params().front() != i->params().front()) { + return true; + } + } break; + default: + // This decoration does not affect the layout of the structure, so + // just moving on. + break; + } + } + } + return false; +} + +spv_result_t ValidateVariable(ValidationState_t& _, const Instruction& inst) { + auto result_type = _.FindDef(inst.type_id()); + if (!result_type || result_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpVariable Result Type '" << _.getIdName(inst.type_id()) + << "' is not a pointer type."; + } + + const auto initializer_index = 3; + if (initializer_index < inst.operands().size()) { + const auto initializer_id = inst.GetOperandAs(initializer_index); + const auto initializer = _.FindDef(initializer_id); + const auto storage_class_index = 2; + const auto is_module_scope_var = + initializer && (initializer->opcode() == SpvOpVariable) && + (initializer->GetOperandAs(storage_class_index) != + SpvStorageClassFunction); + const auto is_constant = + initializer && spvOpcodeIsConstant(initializer->opcode()); + if (!initializer || !(is_constant || is_module_scope_var)) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpVariable Initializer '" << _.getIdName(initializer_id) + << "' is not a constant or module-scope variable."; + } + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateLoad(ValidationState_t& _, const Instruction& inst) { + const auto result_type = _.FindDef(inst.type_id()); + if (!result_type) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpLoad Result Type '" << _.getIdName(inst.type_id()) + << "' is not defined."; + } + + const bool uses_variable_pointers = + _.features().variable_pointers || + _.features().variable_pointers_storage_buffer; + const auto pointer_index = 2; + const auto pointer_id = inst.GetOperandAs(pointer_index); + const auto pointer = _.FindDef(pointer_id); + if (!pointer || + ((_.addressing_model() == SpvAddressingModelLogical) && + ((!uses_variable_pointers && + !spvOpcodeReturnsLogicalPointer(pointer->opcode())) || + (uses_variable_pointers && + !spvOpcodeReturnsLogicalVariablePointer(pointer->opcode()))))) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpLoad Pointer '" << _.getIdName(pointer_id) + << "' is not a logical pointer."; + } + + const auto pointer_type = _.FindDef(pointer->type_id()); + if (!pointer_type || pointer_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpLoad type for pointer '" << _.getIdName(pointer_id) + << "' is not a pointer type."; + } + + const auto pointee_type = _.FindDef(pointer_type->GetOperandAs(2)); + if (!pointee_type || result_type->id() != pointee_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpLoad Result Type '" << _.getIdName(inst.type_id()) + << "' does not match Pointer '" << _.getIdName(pointer->id()) + << "'s type."; + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateStore(ValidationState_t& _, const Instruction& inst) { + const bool uses_variable_pointer = + _.features().variable_pointers || + _.features().variable_pointers_storage_buffer; + const auto pointer_index = 0; + const auto pointer_id = inst.GetOperandAs(pointer_index); + const auto pointer = _.FindDef(pointer_id); + if (!pointer || + (_.addressing_model() == SpvAddressingModelLogical && + ((!uses_variable_pointer && + !spvOpcodeReturnsLogicalPointer(pointer->opcode())) || + (uses_variable_pointer && + !spvOpcodeReturnsLogicalVariablePointer(pointer->opcode()))))) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Pointer '" << _.getIdName(pointer_id) + << "' is not a logical pointer."; + } + const auto pointer_type = _.FindDef(pointer->type_id()); + if (!pointer_type || pointer_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore type for pointer '" << _.getIdName(pointer_id) + << "' is not a pointer type."; + } + const auto type_id = pointer_type->GetOperandAs(2); + const auto type = _.FindDef(type_id); + if (!type || SpvOpTypeVoid == type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Pointer '" << _.getIdName(pointer_id) + << "'s type is void."; + } + + // validate storage class + { + uint32_t data_type; + uint32_t storage_class; + if (!_.GetPointerTypeInfo(pointer_type->id(), &data_type, &storage_class)) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Pointer '" << _.getIdName(pointer_id) + << "' is not pointer type"; + } + + if (storage_class == SpvStorageClassUniformConstant || + storage_class == SpvStorageClassInput || + storage_class == SpvStorageClassPushConstant) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Pointer '" << _.getIdName(pointer_id) + << "' storage class is read-only"; + } + } + + const auto object_index = 1; + const auto object_id = inst.GetOperandAs(object_index); + const auto object = _.FindDef(object_id); + if (!object || !object->type_id()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Object '" << _.getIdName(object_id) + << "' is not an object."; + } + const auto object_type = _.FindDef(object->type_id()); + if (!object_type || SpvOpTypeVoid == object_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Object '" << _.getIdName(object_id) + << "'s type is void."; + } + + if (type->id() != object_type->id()) { + if (!_.options()->relax_struct_store || type->opcode() != SpvOpTypeStruct || + object_type->opcode() != SpvOpTypeStruct) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Pointer '" << _.getIdName(pointer_id) + << "'s type does not match Object '" + << _.getIdName(object->id()) << "'s type."; + } + + // TODO: Check for layout compatible matricies and arrays as well. + if (!AreLayoutCompatibleStructs(_, type, object_type)) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "OpStore Pointer '" << _.getIdName(pointer_id) + << "'s layout does not match Object '" + << _.getIdName(object->id()) << "'s layout."; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction& inst) { + const auto target_index = 0; + const auto target_id = inst.GetOperandAs(target_index); + const auto target = _.FindDef(target_id); + if (!target) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target operand '" << _.getIdName(target_id) + << "' is not defined."; + } + + const auto source_index = 1; + const auto source_id = inst.GetOperandAs(source_index); + const auto source = _.FindDef(source_id); + if (!source) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Source operand '" << _.getIdName(source_id) + << "' is not defined."; + } + + const auto target_pointer_type = _.FindDef(target->type_id()); + if (!target_pointer_type || + target_pointer_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target operand '" << _.getIdName(target_id) + << "' is not a pointer."; + } + + const auto source_pointer_type = _.FindDef(source->type_id()); + if (!source_pointer_type || + source_pointer_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Source operand '" << _.getIdName(source_id) + << "' is not a pointer."; + } + + if (inst.opcode() == SpvOpCopyMemory) { + const auto target_type = + _.FindDef(target_pointer_type->GetOperandAs(2)); + if (!target_type || target_type->opcode() == SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target operand '" << _.getIdName(target_id) + << "' cannot be a void pointer."; + } + + const auto source_type = + _.FindDef(source_pointer_type->GetOperandAs(2)); + if (!source_type || source_type->opcode() == SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Source operand '" << _.getIdName(source_id) + << "' cannot be a void pointer."; + } + + if (target_type->id() != source_type->id()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target '" << _.getIdName(source_id) + << "'s type does not match Source '" + << _.getIdName(source_type->id()) << "'s type."; + } + } else { + const auto size_id = inst.GetOperandAs(2); + const auto size = _.FindDef(size_id); + if (!size) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' is not defined."; + } + + const auto size_type = _.FindDef(size->type_id()); + if (!_.IsIntScalarType(size_type->id())) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' must be a scalar integer type."; + } + + bool is_zero = true; + switch (size->opcode()) { + case SpvOpConstantNull: + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' cannot be a constant zero."; + case SpvOpConstant: + if (size_type->word(3) == 1 && + size->word(size->words().size() - 1) & 0x80000000) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' cannot have the sign bit set to 1."; + } + for (size_t i = 3; is_zero && i < size->words().size(); ++i) { + is_zero &= (size->word(i) == 0); + } + if (is_zero) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Size operand '" << _.getIdName(size_id) + << "' cannot be a constant zero."; + } + break; + default: + // Cannot infer any other opcodes. + break; + } + } + return SPV_SUCCESS; +} + +spv_result_t ValidateAccessChain(ValidationState_t& _, + const Instruction& inst) { + std::string instr_name = + "Op" + std::string(spvOpcodeString(static_cast(inst.opcode()))); + + // The result type must be OpTypePointer. + auto result_type = _.FindDef(inst.type_id()); + if (SpvOpTypePointer != result_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "The Result Type of " << instr_name << " '" + << _.getIdName(inst.id()) << "' must be OpTypePointer. Found Op" + << spvOpcodeString(static_cast(result_type->opcode())) << "."; + } + + // Result type is a pointer. Find out what it's pointing to. + // This will be used to make sure the indexing results in the same type. + // OpTypePointer word 3 is the type being pointed to. + const auto result_type_pointee = _.FindDef(result_type->word(3)); + + // Base must be a pointer, pointing to the base of a composite object. + const auto base_index = 2; + const auto base_id = inst.GetOperandAs(base_index); + const auto base = _.FindDef(base_id); + const auto base_type = _.FindDef(base->type_id()); + if (!base_type || SpvOpTypePointer != base_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "The Base '" << _.getIdName(base_id) << "' in " << instr_name + << " instruction must be a pointer."; + } + + // The result pointer storage class and base pointer storage class must match. + // Word 2 of OpTypePointer is the Storage Class. + auto result_type_storage_class = result_type->word(2); + auto base_type_storage_class = base_type->word(2); + if (result_type_storage_class != base_type_storage_class) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "The result pointer storage class and base " + "pointer storage class in " + << instr_name << " do not match."; + } + + // The type pointed to by OpTypePointer (word 3) must be a composite type. + auto type_pointee = _.FindDef(base_type->word(3)); + + // Check Universal Limit (SPIR-V Spec. Section 2.17). + // The number of indexes passed to OpAccessChain may not exceed 255 + // The instruction includes 4 words + N words (for N indexes) + size_t num_indexes = inst.words().size() - 4; + if (inst.opcode() == SpvOpPtrAccessChain || + inst.opcode() == SpvOpInBoundsPtrAccessChain) { + // In pointer access chains, the element operand is required, but not + // counted as an index. + --num_indexes; + } + const size_t num_indexes_limit = + _.options()->universal_limits_.max_access_chain_indexes; + if (num_indexes > num_indexes_limit) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "The number of indexes in " << instr_name << " may not exceed " + << num_indexes_limit << ". Found " << num_indexes << " indexes."; + } + // Indexes walk the type hierarchy to the desired depth, potentially down to + // scalar granularity. The first index in Indexes will select the top-level + // member/element/component/element of the base composite. All composite + // constituents use zero-based numbering, as described by their OpType... + // instruction. The second index will apply similarly to that result, and so + // on. Once any non-composite type is reached, there must be no remaining + // (unused) indexes. + auto starting_index = 4; + if (inst.opcode() == SpvOpPtrAccessChain || + inst.opcode() == SpvOpInBoundsPtrAccessChain) { + ++starting_index; + } + for (size_t i = starting_index; i < inst.words().size(); ++i) { + const uint32_t cur_word = inst.words()[i]; + // Earlier ID checks ensure that cur_word definition exists. + auto cur_word_instr = _.FindDef(cur_word); + // The index must be a scalar integer type (See OpAccessChain in the Spec.) + auto index_type = _.FindDef(cur_word_instr->type_id()); + if (!index_type || SpvOpTypeInt != index_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << "Indexes passed to " << instr_name + << " must be of type integer."; + } + switch (type_pointee->opcode()) { + case SpvOpTypeMatrix: + case SpvOpTypeVector: + case SpvOpTypeArray: + case SpvOpTypeRuntimeArray: { + // In OpTypeMatrix, OpTypeVector, OpTypeArray, and OpTypeRuntimeArray, + // word 2 is the Element Type. + type_pointee = _.FindDef(type_pointee->word(2)); + break; + } + case SpvOpTypeStruct: { + // In case of structures, there is an additional constraint on the + // index: the index must be an OpConstant. + if (SpvOpConstant != cur_word_instr->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, cur_word_instr) + << "The passed to " << instr_name + << " to index into a " + "structure must be an OpConstant."; + } + // Get the index value from the OpConstant (word 3 of OpConstant). + // OpConstant could be a signed integer. But it's okay to treat it as + // unsigned because a negative constant int would never be seen as + // correct as a struct offset, since structs can't have more than 2 + // billion members. + const uint32_t cur_index = cur_word_instr->word(3); + // The index points to the struct member we want, therefore, the index + // should be less than the number of struct members. + const uint32_t num_struct_members = + static_cast(type_pointee->words().size() - 2); + if (cur_index >= num_struct_members) { + return _.diag(SPV_ERROR_INVALID_ID, cur_word_instr) + << "Index is out of bounds: " << instr_name + << " can not find index " << cur_index + << " into the structure '" + << _.getIdName(type_pointee->id()) << "'. This structure has " + << num_struct_members << " members. Largest valid index is " + << num_struct_members - 1 << "."; + } + // Struct members IDs start at word 2 of OpTypeStruct. + auto structMemberId = type_pointee->word(cur_index + 2); + type_pointee = _.FindDef(structMemberId); + break; + } + default: { + // Give an error. reached non-composite type while indexes still remain. + return _.diag(SPV_ERROR_INVALID_ID, cur_word_instr) + << instr_name + << " reached non-composite type while indexes " + "still remain to be traversed."; + } + } + } + // At this point, we have fully walked down from the base using the indeces. + // The type being pointed to should be the same as the result type. + if (type_pointee->id() != result_type_pointee->id()) { + return _.diag(SPV_ERROR_INVALID_ID, &inst) + << instr_name << " result type (Op" + << spvOpcodeString(static_cast(result_type_pointee->opcode())) + << ") does not match the type that results from indexing into the " + "base " + " (Op" + << spvOpcodeString(static_cast(type_pointee->opcode())) + << ")."; + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ValidateMemoryInstructions(ValidationState_t& _, + const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpVariable: + if (auto error = ValidateVariable(_, *inst)) return error; + break; + case SpvOpLoad: + if (auto error = ValidateLoad(_, *inst)) return error; + break; + case SpvOpStore: + if (auto error = ValidateStore(_, *inst)) return error; + break; + case SpvOpCopyMemory: + case SpvOpCopyMemorySized: + if (auto error = ValidateCopyMemory(_, *inst)) return error; + break; + case SpvOpAccessChain: + case SpvOpInBoundsAccessChain: + case SpvOpPtrAccessChain: + case SpvOpInBoundsPtrAccessChain: + if (auto error = ValidateAccessChain(_, *inst)) return error; + break; + case SpvOpImageTexelPointer: + case SpvOpArrayLength: + case SpvOpGenericPtrMemSemantics: + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp new file mode 100644 index 00000000000..60e7c0a1d18 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_mode_setting.cpp @@ -0,0 +1,91 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/val/validate.h" + +#include + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateEntryPoint(ValidationState_t& _, const Instruction* inst) { + const auto entry_point_id = inst->GetOperandAs(1); + auto entry_point = _.FindDef(entry_point_id); + if (!entry_point || SpvOpFunction != entry_point->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_point_id) + << "' is not a function."; + } + // don't check kernel function signatures + const SpvExecutionModel execution_model = + inst->GetOperandAs(0); + if (execution_model != SpvExecutionModelKernel) { + // TODO: Check the entry point signature is void main(void), may be subject + // to change + const auto entry_point_type_id = entry_point->GetOperandAs(3); + const auto entry_point_type = _.FindDef(entry_point_type_id); + if (!entry_point_type || 3 != entry_point_type->words().size()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_point_id) + << "'s function parameter count is not zero."; + } + } + + auto return_type = _.FindDef(entry_point->type_id()); + if (!return_type || SpvOpTypeVoid != return_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpEntryPoint Entry Point '" << _.getIdName(entry_point_id) + << "'s function return type is not void."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateExecutionMode(ValidationState_t& _, + const Instruction* inst) { + const auto entry_point_id = inst->GetOperandAs(0); + const auto found = std::find(_.entry_points().cbegin(), + _.entry_points().cend(), entry_point_id); + if (found == _.entry_points().cend()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpExecutionMode Entry Point '" + << _.getIdName(entry_point_id) + << "' is not the Entry Point " + "operand of an OpEntryPoint."; + } + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t ModeSettingPass(ValidationState_t& _, const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpEntryPoint: + if (auto error = ValidateEntryPoint(_, inst)) return error; + break; + case SpvOpExecutionMode: + if (auto error = ValidateExecutionMode(_, inst)) return error; + break; + default: + break; + } + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp new file mode 100644 index 00000000000..89e82c6162a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_non_uniform.cpp @@ -0,0 +1,83 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Validates correctness of barrier SPIR-V instructions. + +#include "source/val/validate.h" + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/spirv_constant.h" +#include "source/spirv_target_env.h" +#include "source/util/bitutils.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +spv_result_t ValidateExecutionScope(ValidationState_t& _, + const Instruction* inst, uint32_t scope) { + SpvOp opcode = inst->opcode(); + bool is_int32 = false, is_const_int32 = false; + uint32_t value = 0; + std::tie(is_int32, is_const_int32, value) = _.EvalInt32IfConst(scope); + + if (!is_int32) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Execution Scope to be a 32-bit int"; + } + + if (!is_const_int32) { + return SPV_SUCCESS; + } + + if (spvIsVulkanEnv(_.context()->target_env) && + _.context()->target_env != SPV_ENV_VULKAN_1_0 && + value != SpvScopeSubgroup) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": in Vulkan environment Execution scope is limited to " + "Subgroup"; + } + + if (value != SpvScopeSubgroup && value != SpvScopeWorkgroup) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": Execution scope is limited to Subgroup or Workgroup"; + } + + return SPV_SUCCESS; +} + +} // namespace + +// Validates correctness of non-uniform group instructions. +spv_result_t NonUniformPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + + if (spvOpcodeIsNonUniformGroupOperation(opcode)) { + const uint32_t execution_scope = inst->word(3); + if (auto error = ValidateExecutionScope(_, inst, execution_scope)) { + return error; + } + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp new file mode 100644 index 00000000000..7d11f2e7a98 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_primitives.cpp @@ -0,0 +1,75 @@ +// Copyright (c) 2017 LunarG 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. + +// Validates correctness of primitive SPIR-V instructions. + +#include "source/val/validate.h" + +#include + +#include "source/diagnostic.h" +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { + +// Validates correctness of primitive instructions. +spv_result_t PrimitivesPass(ValidationState_t& _, const Instruction* inst) { + const SpvOp opcode = inst->opcode(); + + switch (opcode) { + case SpvOpEmitVertex: + case SpvOpEndPrimitive: + case SpvOpEmitStreamVertex: + case SpvOpEndStreamPrimitive: + _.function(inst->function()->id()) + ->RegisterExecutionModelLimitation( + SpvExecutionModelGeometry, + std::string(spvOpcodeString(opcode)) + + " instructions require Geometry execution model"); + break; + default: + break; + } + + switch (opcode) { + case SpvOpEmitStreamVertex: + case SpvOpEndStreamPrimitive: { + const uint32_t stream_id = inst->word(1); + const uint32_t stream_type = _.GetTypeId(stream_id); + if (!_.IsIntScalarType(stream_type)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Stream to be int scalar"; + } + + const SpvOp stream_opcode = _.GetIdOpcode(stream_id); + if (!spvOpcodeIsConstant(stream_opcode)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << spvOpcodeString(opcode) + << ": expected Stream to be constant instruction"; + } + } + + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp new file mode 100644 index 00000000000..b6942272e84 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validate_type.cpp @@ -0,0 +1,316 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Ensures type declarations are unique unless allowed by the specification. + +#include "source/val/validate.h" + +#include "source/opcode.h" +#include "source/val/instruction.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// True if the integer constant is > 0. |const_words| are words of the +// constant-defining instruction (either OpConstant or +// OpSpecConstant). typeWords are the words of the constant's-type-defining +// OpTypeInt. +bool AboveZero(const std::vector& const_words, + const std::vector& type_words) { + const uint32_t width = type_words[2]; + const bool is_signed = type_words[3] > 0; + const uint32_t lo_word = const_words[3]; + if (width > 32) { + // The spec currently doesn't allow integers wider than 64 bits. + const uint32_t hi_word = const_words[4]; // Must exist, per spec. + if (is_signed && (hi_word >> 31)) return false; + return (lo_word | hi_word) > 0; + } else { + if (is_signed && (lo_word >> 31)) return false; + return lo_word > 0; + } +} + +// Validates that type declarations are unique, unless multiple declarations +// of the same data type are allowed by the specification. +// (see section 2.8 Types and Variables) +// Doesn't do anything if SPV_VAL_ignore_type_decl_unique was declared in the +// module. +spv_result_t ValidateUniqueness(ValidationState_t& _, const Instruction* inst) { + if (_.HasExtension(Extension::kSPV_VALIDATOR_ignore_type_decl_unique)) + return SPV_SUCCESS; + + const auto opcode = inst->opcode(); + if (opcode != SpvOpTypeArray && opcode != SpvOpTypeRuntimeArray && + opcode != SpvOpTypeStruct && opcode != SpvOpTypePointer && + !_.RegisterUniqueTypeDeclaration(inst)) { + return _.diag(SPV_ERROR_INVALID_DATA, inst) + << "Duplicate non-aggregate type declarations are not allowed. " + "Opcode: " + << spvOpcodeString(opcode) << " id: " << inst->id(); + } + + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeVector(ValidationState_t& _, const Instruction* inst) { + const auto component_index = 1; + const auto component_id = inst->GetOperandAs(component_index); + const auto component_type = _.FindDef(component_id); + if (!component_type || !spvOpcodeIsScalarType(component_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeVector Component Type '" << _.getIdName(component_id) + << "' is not a scalar type."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeMatrix(ValidationState_t& _, const Instruction* inst) { + const auto column_type_index = 1; + const auto column_type_id = inst->GetOperandAs(column_type_index); + const auto column_type = _.FindDef(column_type_id); + if (!column_type || SpvOpTypeVector != column_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeMatrix Column Type '" << _.getIdName(column_type_id) + << "' is not a vector."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeArray(ValidationState_t& _, const Instruction* inst) { + const auto element_type_index = 1; + const auto element_type_id = inst->GetOperandAs(element_type_index); + const auto element_type = _.FindDef(element_type_id); + if (!element_type || !spvOpcodeGeneratesType(element_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Element Type '" << _.getIdName(element_type_id) + << "' is not a type."; + } + const auto length_index = 2; + const auto length_id = inst->GetOperandAs(length_index); + const auto length = _.FindDef(length_id); + if (!length || !spvOpcodeIsConstant(length->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Length '" << _.getIdName(length_id) + << "' is not a scalar constant type."; + } + + // NOTE: Check the initialiser value of the constant + const auto const_inst = length->words(); + const auto const_result_type_index = 1; + const auto const_result_type = _.FindDef(const_inst[const_result_type_index]); + if (!const_result_type || SpvOpTypeInt != const_result_type->opcode()) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Length '" << _.getIdName(length_id) + << "' is not a constant integer type."; + } + + switch (length->opcode()) { + case SpvOpSpecConstant: + case SpvOpConstant: + if (AboveZero(length->words(), const_result_type->words())) break; + // Else fall through! + case SpvOpConstantNull: { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeArray Length '" << _.getIdName(length_id) + << "' default value must be at least 1."; + } + case SpvOpSpecConstantOp: + // Assume it's OK, rather than try to evaluate the operation. + break; + default: + assert(0 && "bug in spvOpcodeIsConstant() or result type isn't int"); + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeRuntimeArray(ValidationState_t& _, + const Instruction* inst) { + const auto element_type_index = 1; + const auto element_id = inst->GetOperandAs(element_type_index); + const auto element_type = _.FindDef(element_id); + if (!element_type || !spvOpcodeGeneratesType(element_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeRuntimeArray Element Type '" + << _.getIdName(element_id) << "' is not a type."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeStruct(ValidationState_t& _, const Instruction* inst) { + const uint32_t struct_id = inst->GetOperandAs(0); + for (size_t member_type_index = 1; + member_type_index < inst->operands().size(); ++member_type_index) { + auto member_type_id = inst->GetOperandAs(member_type_index); + auto member_type = _.FindDef(member_type_id); + if (!member_type || !spvOpcodeGeneratesType(member_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeStruct Member Type '" << _.getIdName(member_type_id) + << "' is not a type."; + } + if (member_type->opcode() == SpvOpTypeVoid) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Structures cannot contain a void type."; + } + if (SpvOpTypeStruct == member_type->opcode() && + _.IsStructTypeWithBuiltInMember(member_type_id)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Structure " << _.getIdName(member_type_id) + << " contains members with BuiltIn decoration. Therefore this " + "structure may not be contained as a member of another " + "structure " + "type. Structure " + << _.getIdName(struct_id) << " contains structure " + << _.getIdName(member_type_id) << "."; + } + if (_.IsForwardPointer(member_type_id)) { + if (member_type->opcode() != SpvOpTypePointer) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "Found a forward reference to a non-pointer " + "type in OpTypeStruct instruction."; + } + // If we're dealing with a forward pointer: + // Find out the type that the pointer is pointing to (must be struct) + // word 3 is the of the type being pointed to. + auto type_pointing_to = _.FindDef(member_type->words()[3]); + if (type_pointing_to && type_pointing_to->opcode() != SpvOpTypeStruct) { + // Forward declared operands of a struct may only point to a struct. + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "A forward reference operand in an OpTypeStruct must be an " + "OpTypePointer that points to an OpTypeStruct. " + "Found OpTypePointer that points to Op" + << spvOpcodeString( + static_cast(type_pointing_to->opcode())) + << "."; + } + } + } + std::unordered_set built_in_members; + for (auto decoration : _.id_decorations(struct_id)) { + if (decoration.dec_type() == SpvDecorationBuiltIn && + decoration.struct_member_index() != Decoration::kInvalidMember) { + built_in_members.insert(decoration.struct_member_index()); + } + } + int num_struct_members = static_cast(inst->operands().size() - 1); + int num_builtin_members = static_cast(built_in_members.size()); + if (num_builtin_members > 0 && num_builtin_members != num_struct_members) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "When BuiltIn decoration is applied to a structure-type member, " + "all members of that structure type must also be decorated with " + "BuiltIn (No allowed mixing of built-in variables and " + "non-built-in variables within a single structure). Structure id " + << struct_id << " does not meet this requirement."; + } + if (num_builtin_members > 0) { + _.RegisterStructTypeWithBuiltInMember(struct_id); + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypePointer(ValidationState_t& _, + const Instruction* inst) { + const auto type_id = inst->GetOperandAs(2); + const auto type = _.FindDef(type_id); + if (!type || !spvOpcodeGeneratesType(type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypePointer Type '" << _.getIdName(type_id) + << "' is not a type."; + } + return SPV_SUCCESS; +} + +spv_result_t ValidateTypeFunction(ValidationState_t& _, + const Instruction* inst) { + const auto return_type_id = inst->GetOperandAs(1); + const auto return_type = _.FindDef(return_type_id); + if (!return_type || !spvOpcodeGeneratesType(return_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeFunction Return Type '" << _.getIdName(return_type_id) + << "' is not a type."; + } + size_t num_args = 0; + for (size_t param_type_index = 2; param_type_index < inst->operands().size(); + ++param_type_index, ++num_args) { + const auto param_id = inst->GetOperandAs(param_type_index); + const auto param_type = _.FindDef(param_id); + if (!param_type || !spvOpcodeGeneratesType(param_type->opcode())) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeFunction Parameter Type '" << _.getIdName(param_id) + << "' is not a type."; + } + } + const uint32_t num_function_args_limit = + _.options()->universal_limits_.max_function_args; + if (num_args > num_function_args_limit) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpTypeFunction may not take more than " + << num_function_args_limit << " arguments. OpTypeFunction '" + << _.getIdName(inst->GetOperandAs(0)) << "' has " + << num_args << " arguments."; + } + + // The only valid uses of OpTypeFunction are in an OpFunction instruction. + for (auto& pair : inst->uses()) { + const auto* use = pair.first; + if (use->opcode() != SpvOpFunction) { + return _.diag(SPV_ERROR_INVALID_ID, use) + << "Invalid use of function type result id " + << _.getIdName(inst->id()) << "."; + } + } + + return SPV_SUCCESS; +} + +} // namespace + +spv_result_t TypePass(ValidationState_t& _, const Instruction* inst) { + if (!spvOpcodeGeneratesType(inst->opcode())) return SPV_SUCCESS; + + if (auto error = ValidateUniqueness(_, inst)) return error; + + switch (inst->opcode()) { + case SpvOpTypeVector: + if (auto error = ValidateTypeVector(_, inst)) return error; + break; + case SpvOpTypeMatrix: + if (auto error = ValidateTypeMatrix(_, inst)) return error; + break; + case SpvOpTypeArray: + if (auto error = ValidateTypeArray(_, inst)) return error; + break; + case SpvOpTypeRuntimeArray: + if (auto error = ValidateTypeRuntimeArray(_, inst)) return error; + break; + case SpvOpTypeStruct: + if (auto error = ValidateTypeStruct(_, inst)) return error; + break; + case SpvOpTypePointer: + if (auto error = ValidateTypePointer(_, inst)) return error; + break; + case SpvOpTypeFunction: + if (auto error = ValidateTypeFunction(_, inst)) return error; + break; + default: + break; + } + + return SPV_SUCCESS; +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp new file mode 100644 index 00000000000..dec25b1c3b3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validation_state.cpp @@ -0,0 +1,923 @@ +// Copyright (c) 2015-2016 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. + +#include "source/val/validation_state.h" + +#include +#include +#include + +#include "source/opcode.h" +#include "source/spirv_target_env.h" +#include "source/val/basic_block.h" +#include "source/val/construct.h" +#include "source/val/function.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { +namespace { + +bool IsInstructionInLayoutSection(ModuleLayoutSection layout, SpvOp op) { + // See Section 2.4 + bool out = false; + // clang-format off + switch (layout) { + case kLayoutCapabilities: out = op == SpvOpCapability; break; + case kLayoutExtensions: out = op == SpvOpExtension; break; + case kLayoutExtInstImport: out = op == SpvOpExtInstImport; break; + case kLayoutMemoryModel: out = op == SpvOpMemoryModel; break; + case kLayoutEntryPoint: out = op == SpvOpEntryPoint; break; + case kLayoutExecutionMode: + out = op == SpvOpExecutionMode || op == SpvOpExecutionModeId; + break; + case kLayoutDebug1: + switch (op) { + case SpvOpSourceContinued: + case SpvOpSource: + case SpvOpSourceExtension: + case SpvOpString: + out = true; + break; + default: break; + } + break; + case kLayoutDebug2: + switch (op) { + case SpvOpName: + case SpvOpMemberName: + out = true; + break; + default: break; + } + break; + case kLayoutDebug3: + // Only OpModuleProcessed is allowed here. + out = (op == SpvOpModuleProcessed); + break; + case kLayoutAnnotations: + switch (op) { + case SpvOpDecorate: + case SpvOpMemberDecorate: + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: + case SpvOpDecorationGroup: + case SpvOpDecorateId: + case SpvOpDecorateStringGOOGLE: + case SpvOpMemberDecorateStringGOOGLE: + out = true; + break; + default: break; + } + break; + case kLayoutTypes: + if (spvOpcodeGeneratesType(op) || spvOpcodeIsConstant(op)) { + out = true; + break; + } + switch (op) { + case SpvOpTypeForwardPointer: + case SpvOpVariable: + case SpvOpLine: + case SpvOpNoLine: + case SpvOpUndef: + out = true; + break; + default: break; + } + break; + case kLayoutFunctionDeclarations: + case kLayoutFunctionDefinitions: + // NOTE: These instructions should NOT be in these layout sections + if (spvOpcodeGeneratesType(op) || spvOpcodeIsConstant(op)) { + out = false; + break; + } + switch (op) { + case SpvOpCapability: + case SpvOpExtension: + case SpvOpExtInstImport: + case SpvOpMemoryModel: + case SpvOpEntryPoint: + case SpvOpExecutionMode: + case SpvOpExecutionModeId: + case SpvOpSourceContinued: + case SpvOpSource: + case SpvOpSourceExtension: + case SpvOpString: + case SpvOpName: + case SpvOpMemberName: + case SpvOpModuleProcessed: + case SpvOpDecorate: + case SpvOpMemberDecorate: + case SpvOpGroupDecorate: + case SpvOpGroupMemberDecorate: + case SpvOpDecorationGroup: + case SpvOpTypeForwardPointer: + out = false; + break; + default: + out = true; + break; + } + } + // clang-format on + return out; +} + +// Counts the number of instructions and functions in the file. +spv_result_t CountInstructions(void* user_data, + const spv_parsed_instruction_t* inst) { + ValidationState_t& _ = *(reinterpret_cast(user_data)); + if (inst->opcode == SpvOpFunction) _.increment_total_functions(); + _.increment_total_instructions(); + + return SPV_SUCCESS; +} + +} // namespace + +ValidationState_t::ValidationState_t(const spv_const_context ctx, + const spv_const_validator_options opt, + const uint32_t* words, + const size_t num_words) + : context_(ctx), + options_(opt), + words_(words), + num_words_(num_words), + unresolved_forward_ids_{}, + operand_names_{}, + current_layout_section_(kLayoutCapabilities), + module_functions_(), + module_capabilities_(), + module_extensions_(), + ordered_instructions_(), + all_definitions_(), + global_vars_(), + local_vars_(), + struct_nesting_depth_(), + grammar_(ctx), + addressing_model_(SpvAddressingModelMax), + memory_model_(SpvMemoryModelMax), + in_function_(false) { + assert(opt && "Validator options may not be Null."); + + const auto env = context_->target_env; + + if (spvIsVulkanEnv(env)) { + // Vulkan 1.1 includes VK_KHR_relaxed_block_layout in core. + if (env != SPV_ENV_VULKAN_1_0) { + features_.env_relaxed_block_layout = true; + } + } + + switch (env) { + case SPV_ENV_WEBGPU_0: + features_.bans_op_undef = true; + break; + default: + break; + } + + // Only attempt to count if we have words, otherwise let the other validation + // fail and generate an error. + if (num_words > 0) { + // Count the number of instructions in the binary. + spvBinaryParse(ctx, this, words, num_words, + /* parsed_header = */ nullptr, CountInstructions, + /* diagnostic = */ nullptr); + preallocateStorage(); + } +} + +void ValidationState_t::preallocateStorage() { + ordered_instructions_.reserve(total_instructions_); + module_functions_.reserve(total_functions_); +} + +spv_result_t ValidationState_t::ForwardDeclareId(uint32_t id) { + unresolved_forward_ids_.insert(id); + return SPV_SUCCESS; +} + +spv_result_t ValidationState_t::RemoveIfForwardDeclared(uint32_t id) { + unresolved_forward_ids_.erase(id); + return SPV_SUCCESS; +} + +spv_result_t ValidationState_t::RegisterForwardPointer(uint32_t id) { + forward_pointer_ids_.insert(id); + return SPV_SUCCESS; +} + +bool ValidationState_t::IsForwardPointer(uint32_t id) const { + return (forward_pointer_ids_.find(id) != forward_pointer_ids_.end()); +} + +void ValidationState_t::AssignNameToId(uint32_t id, std::string name) { + operand_names_[id] = name; +} + +std::string ValidationState_t::getIdName(uint32_t id) const { + std::stringstream out; + out << id; + if (operand_names_.find(id) != end(operand_names_)) { + out << "[" << operand_names_.at(id) << "]"; + } + return out.str(); +} + +std::string ValidationState_t::getIdOrName(uint32_t id) const { + std::stringstream out; + if (operand_names_.find(id) != std::end(operand_names_)) { + out << operand_names_.at(id); + } else { + out << id; + } + return out.str(); +} + +size_t ValidationState_t::unresolved_forward_id_count() const { + return unresolved_forward_ids_.size(); +} + +std::vector ValidationState_t::UnresolvedForwardIds() const { + std::vector out(std::begin(unresolved_forward_ids_), + std::end(unresolved_forward_ids_)); + return out; +} + +bool ValidationState_t::IsDefinedId(uint32_t id) const { + return all_definitions_.find(id) != std::end(all_definitions_); +} + +const Instruction* ValidationState_t::FindDef(uint32_t id) const { + auto it = all_definitions_.find(id); + if (it == all_definitions_.end()) return nullptr; + return it->second; +} + +Instruction* ValidationState_t::FindDef(uint32_t id) { + auto it = all_definitions_.find(id); + if (it == all_definitions_.end()) return nullptr; + return it->second; +} + +ModuleLayoutSection ValidationState_t::current_layout_section() const { + return current_layout_section_; +} + +void ValidationState_t::ProgressToNextLayoutSectionOrder() { + // Guard against going past the last element(kLayoutFunctionDefinitions) + if (current_layout_section_ <= kLayoutFunctionDefinitions) { + current_layout_section_ = + static_cast(current_layout_section_ + 1); + } +} + +bool ValidationState_t::IsOpcodeInCurrentLayoutSection(SpvOp op) { + return IsInstructionInLayoutSection(current_layout_section_, op); +} + +DiagnosticStream ValidationState_t::diag(spv_result_t error_code, + const Instruction* inst) const { + std::string disassembly; + if (inst) disassembly = Disassemble(*inst); + + return DiagnosticStream({0, 0, inst ? inst->LineNum() : 0}, + context_->consumer, disassembly, error_code); +} + +std::vector& ValidationState_t::functions() { + return module_functions_; +} + +Function& ValidationState_t::current_function() { + assert(in_function_body()); + return module_functions_.back(); +} + +const Function& ValidationState_t::current_function() const { + assert(in_function_body()); + return module_functions_.back(); +} + +const Function* ValidationState_t::function(uint32_t id) const { + const auto it = id_to_function_.find(id); + if (it == id_to_function_.end()) return nullptr; + return it->second; +} + +Function* ValidationState_t::function(uint32_t id) { + auto it = id_to_function_.find(id); + if (it == id_to_function_.end()) return nullptr; + return it->second; +} + +bool ValidationState_t::in_function_body() const { return in_function_; } + +bool ValidationState_t::in_block() const { + return module_functions_.empty() == false && + module_functions_.back().current_block() != nullptr; +} + +void ValidationState_t::RegisterCapability(SpvCapability cap) { + // Avoid redundant work. Otherwise the recursion could induce work + // quadrdatic in the capability dependency depth. (Ok, not much, but + // it's something.) + if (module_capabilities_.Contains(cap)) return; + + module_capabilities_.Add(cap); + spv_operand_desc desc; + if (SPV_SUCCESS == + grammar_.lookupOperand(SPV_OPERAND_TYPE_CAPABILITY, cap, &desc)) { + CapabilitySet(desc->numCapabilities, desc->capabilities) + .ForEach([this](SpvCapability c) { RegisterCapability(c); }); + } + + switch (cap) { + case SpvCapabilityKernel: + features_.group_ops_reduce_and_scans = true; + break; + case SpvCapabilityInt8: + case SpvCapabilityStorageBuffer8BitAccess: + case SpvCapabilityUniformAndStorageBuffer8BitAccess: + case SpvCapabilityStoragePushConstant8: + features_.declare_int8_type = true; + break; + case SpvCapabilityInt16: + features_.declare_int16_type = true; + break; + case SpvCapabilityFloat16: + case SpvCapabilityFloat16Buffer: + features_.declare_float16_type = true; + break; + case SpvCapabilityStorageUniformBufferBlock16: + case SpvCapabilityStorageUniform16: + case SpvCapabilityStoragePushConstant16: + case SpvCapabilityStorageInputOutput16: + features_.declare_int16_type = true; + features_.declare_float16_type = true; + features_.free_fp_rounding_mode = true; + break; + case SpvCapabilityVariablePointers: + features_.variable_pointers = true; + features_.variable_pointers_storage_buffer = true; + break; + case SpvCapabilityVariablePointersStorageBuffer: + features_.variable_pointers_storage_buffer = true; + break; + default: + break; + } +} + +void ValidationState_t::RegisterExtension(Extension ext) { + if (module_extensions_.Contains(ext)) return; + + module_extensions_.Add(ext); + + switch (ext) { + case kSPV_AMD_gpu_shader_half_float: + // SPV_AMD_gpu_shader_half_float enables float16 type. + // https://github.com/KhronosGroup/SPIRV-Tools/issues/1375 + features_.declare_float16_type = true; + break; + case kSPV_AMD_shader_ballot: + // The grammar doesn't encode the fact that SPV_AMD_shader_ballot + // enables the use of group operations Reduce, InclusiveScan, + // and ExclusiveScan. Enable it manually. + // https://github.com/KhronosGroup/SPIRV-Tools/issues/991 + features_.group_ops_reduce_and_scans = true; + break; + default: + break; + } +} + +bool ValidationState_t::HasAnyOfCapabilities( + const CapabilitySet& capabilities) const { + return module_capabilities_.HasAnyOf(capabilities); +} + +bool ValidationState_t::HasAnyOfExtensions( + const ExtensionSet& extensions) const { + return module_extensions_.HasAnyOf(extensions); +} + +void ValidationState_t::set_addressing_model(SpvAddressingModel am) { + addressing_model_ = am; +} + +SpvAddressingModel ValidationState_t::addressing_model() const { + return addressing_model_; +} + +void ValidationState_t::set_memory_model(SpvMemoryModel mm) { + memory_model_ = mm; +} + +SpvMemoryModel ValidationState_t::memory_model() const { return memory_model_; } + +spv_result_t ValidationState_t::RegisterFunction( + uint32_t id, uint32_t ret_type_id, SpvFunctionControlMask function_control, + uint32_t function_type_id) { + assert(in_function_body() == false && + "RegisterFunction can only be called when parsing the binary outside " + "of another function"); + in_function_ = true; + module_functions_.emplace_back(id, ret_type_id, function_control, + function_type_id); + id_to_function_.emplace(id, ¤t_function()); + + // TODO(umar): validate function type and type_id + + return SPV_SUCCESS; +} + +spv_result_t ValidationState_t::RegisterFunctionEnd() { + assert(in_function_body() == true && + "RegisterFunctionEnd can only be called when parsing the binary " + "inside of another function"); + assert(in_block() == false && + "RegisterFunctionParameter can only be called when parsing the binary " + "ouside of a block"); + current_function().RegisterFunctionEnd(); + in_function_ = false; + return SPV_SUCCESS; +} + +Instruction* ValidationState_t::AddOrderedInstruction( + const spv_parsed_instruction_t* inst) { + ordered_instructions_.emplace_back(inst); + ordered_instructions_.back().SetLineNum(ordered_instructions_.size()); + return &ordered_instructions_.back(); +} + +// Improves diagnostic messages by collecting names of IDs +void ValidationState_t::RegisterDebugInstruction(const Instruction* inst) { + switch (inst->opcode()) { + case SpvOpName: { + const auto target = inst->GetOperandAs(0); + const auto* str = reinterpret_cast(inst->words().data() + + inst->operand(1).offset); + AssignNameToId(target, str); + break; + } + case SpvOpMemberName: { + const auto target = inst->GetOperandAs(0); + const auto* str = reinterpret_cast(inst->words().data() + + inst->operand(2).offset); + AssignNameToId(target, str); + break; + } + case SpvOpSourceContinued: + case SpvOpSource: + case SpvOpSourceExtension: + case SpvOpString: + case SpvOpLine: + case SpvOpNoLine: + default: + break; + } +} + +void ValidationState_t::RegisterInstruction(Instruction* inst) { + if (inst->id()) all_definitions_.insert(std::make_pair(inst->id(), inst)); + + // If the instruction is using an OpTypeSampledImage as an operand, it should + // be recorded. The validator will ensure that all usages of an + // OpTypeSampledImage and its definition are in the same basic block. + for (uint16_t i = 0; i < inst->operands().size(); ++i) { + const spv_parsed_operand_t& operand = inst->operand(i); + if (SPV_OPERAND_TYPE_ID == operand.type) { + const uint32_t operand_word = inst->word(operand.offset); + Instruction* operand_inst = FindDef(operand_word); + if (operand_inst && SpvOpSampledImage == operand_inst->opcode()) { + RegisterSampledImageConsumer(operand_word, inst->id()); + } + } + } +} + +std::vector ValidationState_t::getSampledImageConsumers( + uint32_t sampled_image_id) const { + std::vector result; + auto iter = sampled_image_consumers_.find(sampled_image_id); + if (iter != sampled_image_consumers_.end()) { + result = iter->second; + } + return result; +} + +void ValidationState_t::RegisterSampledImageConsumer(uint32_t sampled_image_id, + uint32_t consumer_id) { + sampled_image_consumers_[sampled_image_id].push_back(consumer_id); +} + +uint32_t ValidationState_t::getIdBound() const { return id_bound_; } + +void ValidationState_t::setIdBound(const uint32_t bound) { id_bound_ = bound; } + +bool ValidationState_t::RegisterUniqueTypeDeclaration(const Instruction* inst) { + std::vector key; + key.push_back(static_cast(inst->opcode())); + for (size_t index = 0; index < inst->operands().size(); ++index) { + const spv_parsed_operand_t& operand = inst->operand(index); + + if (operand.type == SPV_OPERAND_TYPE_RESULT_ID) continue; + + const int words_begin = operand.offset; + const int words_end = words_begin + operand.num_words; + assert(words_end <= static_cast(inst->words().size())); + + key.insert(key.end(), inst->words().begin() + words_begin, + inst->words().begin() + words_end); + } + + return unique_type_declarations_.insert(std::move(key)).second; +} + +uint32_t ValidationState_t::GetTypeId(uint32_t id) const { + const Instruction* inst = FindDef(id); + return inst ? inst->type_id() : 0; +} + +SpvOp ValidationState_t::GetIdOpcode(uint32_t id) const { + const Instruction* inst = FindDef(id); + return inst ? inst->opcode() : SpvOpNop; +} + +uint32_t ValidationState_t::GetComponentType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + switch (inst->opcode()) { + case SpvOpTypeFloat: + case SpvOpTypeInt: + case SpvOpTypeBool: + return id; + + case SpvOpTypeVector: + return inst->word(2); + + case SpvOpTypeMatrix: + return GetComponentType(inst->word(2)); + + default: + break; + } + + if (inst->type_id()) return GetComponentType(inst->type_id()); + + assert(0); + return 0; +} + +uint32_t ValidationState_t::GetDimension(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + switch (inst->opcode()) { + case SpvOpTypeFloat: + case SpvOpTypeInt: + case SpvOpTypeBool: + return 1; + + case SpvOpTypeVector: + case SpvOpTypeMatrix: + return inst->word(3); + + default: + break; + } + + if (inst->type_id()) return GetDimension(inst->type_id()); + + assert(0); + return 0; +} + +uint32_t ValidationState_t::GetBitWidth(uint32_t id) const { + const uint32_t component_type_id = GetComponentType(id); + const Instruction* inst = FindDef(component_type_id); + assert(inst); + + if (inst->opcode() == SpvOpTypeFloat || inst->opcode() == SpvOpTypeInt) + return inst->word(2); + + if (inst->opcode() == SpvOpTypeBool) return 1; + + assert(0); + return 0; +} + +bool ValidationState_t::IsFloatScalarType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + return inst->opcode() == SpvOpTypeFloat; +} + +bool ValidationState_t::IsFloatVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeVector) { + return IsFloatScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsFloatScalarOrVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeFloat) { + return true; + } + + if (inst->opcode() == SpvOpTypeVector) { + return IsFloatScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsIntScalarType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + return inst->opcode() == SpvOpTypeInt; +} + +bool ValidationState_t::IsIntVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeVector) { + return IsIntScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsIntScalarOrVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeInt) { + return true; + } + + if (inst->opcode() == SpvOpTypeVector) { + return IsIntScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsUnsignedIntScalarType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + return inst->opcode() == SpvOpTypeInt && inst->word(3) == 0; +} + +bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeVector) { + return IsUnsignedIntScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsSignedIntScalarType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + return inst->opcode() == SpvOpTypeInt && inst->word(3) == 1; +} + +bool ValidationState_t::IsSignedIntVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeVector) { + return IsSignedIntScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsBoolScalarType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + return inst->opcode() == SpvOpTypeBool; +} + +bool ValidationState_t::IsBoolVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeVector) { + return IsBoolScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsBoolScalarOrVectorType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeBool) { + return true; + } + + if (inst->opcode() == SpvOpTypeVector) { + return IsBoolScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::IsFloatMatrixType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + + if (inst->opcode() == SpvOpTypeMatrix) { + return IsFloatScalarType(GetComponentType(id)); + } + + return false; +} + +bool ValidationState_t::GetMatrixTypeInfo(uint32_t id, uint32_t* num_rows, + uint32_t* num_cols, + uint32_t* column_type, + uint32_t* component_type) const { + if (!id) return false; + + const Instruction* mat_inst = FindDef(id); + assert(mat_inst); + if (mat_inst->opcode() != SpvOpTypeMatrix) return false; + + const uint32_t vec_type = mat_inst->word(2); + const Instruction* vec_inst = FindDef(vec_type); + assert(vec_inst); + + if (vec_inst->opcode() != SpvOpTypeVector) { + assert(0); + return false; + } + + *num_cols = mat_inst->word(3); + *num_rows = vec_inst->word(3); + *column_type = mat_inst->word(2); + *component_type = vec_inst->word(2); + + return true; +} + +bool ValidationState_t::GetStructMemberTypes( + uint32_t struct_type_id, std::vector* member_types) const { + member_types->clear(); + if (!struct_type_id) return false; + + const Instruction* inst = FindDef(struct_type_id); + assert(inst); + if (inst->opcode() != SpvOpTypeStruct) return false; + + *member_types = + std::vector(inst->words().cbegin() + 2, inst->words().cend()); + + if (member_types->empty()) return false; + + return true; +} + +bool ValidationState_t::IsPointerType(uint32_t id) const { + const Instruction* inst = FindDef(id); + assert(inst); + return inst->opcode() == SpvOpTypePointer; +} + +bool ValidationState_t::GetPointerTypeInfo(uint32_t id, uint32_t* data_type, + uint32_t* storage_class) const { + if (!id) return false; + + const Instruction* inst = FindDef(id); + assert(inst); + if (inst->opcode() != SpvOpTypePointer) return false; + + *storage_class = inst->word(2); + *data_type = inst->word(3); + return true; +} + +uint32_t ValidationState_t::GetOperandTypeId(const Instruction* inst, + size_t operand_index) const { + return GetTypeId(inst->GetOperandAs(operand_index)); +} + +bool ValidationState_t::GetConstantValUint64(uint32_t id, uint64_t* val) const { + const Instruction* inst = FindDef(id); + if (!inst) { + assert(0 && "Instruction not found"); + return false; + } + + if (inst->opcode() != SpvOpConstant && inst->opcode() != SpvOpSpecConstant) + return false; + + if (!IsIntScalarType(inst->type_id())) return false; + + if (inst->words().size() == 4) { + *val = inst->word(3); + } else { + assert(inst->words().size() == 5); + *val = inst->word(3); + *val |= uint64_t(inst->word(4)) << 32; + } + return true; +} + +std::tuple ValidationState_t::EvalInt32IfConst( + uint32_t id) { + const Instruction* const inst = FindDef(id); + assert(inst); + const uint32_t type = inst->type_id(); + + if (type == 0 || !IsIntScalarType(type) || GetBitWidth(type) != 32) { + return std::make_tuple(false, false, 0); + } + + if (inst->opcode() != SpvOpConstant && inst->opcode() != SpvOpSpecConstant) { + return std::make_tuple(true, false, 0); + } + + assert(inst->words().size() == 4); + return std::make_tuple(true, true, inst->word(3)); +} + +void ValidationState_t::ComputeFunctionToEntryPointMapping() { + for (const uint32_t entry_point : entry_points()) { + std::stack call_stack; + std::set visited; + call_stack.push(entry_point); + while (!call_stack.empty()) { + const uint32_t called_func_id = call_stack.top(); + call_stack.pop(); + if (!visited.insert(called_func_id).second) continue; + + function_to_entry_points_[called_func_id].push_back(entry_point); + + const Function* called_func = function(called_func_id); + if (called_func) { + // Other checks should error out on this invalid SPIR-V. + for (const uint32_t new_call : called_func->function_call_targets()) { + call_stack.push(new_call); + } + } + } + } +} + +const std::vector& ValidationState_t::FunctionEntryPoints( + uint32_t func) const { + auto iter = function_to_entry_points_.find(func); + if (iter == function_to_entry_points_.end()) { + return empty_ids_; + } else { + return iter->second; + } +} + +std::string ValidationState_t::Disassemble(const Instruction& inst) const { + const spv_parsed_instruction_t& c_inst(inst.c_inst()); + return Disassemble(c_inst.words, c_inst.num_words); +} + +std::string ValidationState_t::Disassemble(const uint32_t* words, + uint16_t num_words) const { + uint32_t disassembly_options = SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES; + + return spvInstructionBinaryToText(context()->target_env, words, num_words, + words_, num_words_, disassembly_options); +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validation_state.h b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validation_state.h new file mode 100644 index 00000000000..8c8b5319628 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/source/val/validation_state.h @@ -0,0 +1,648 @@ +// Copyright (c) 2015-2016 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. + +#ifndef SOURCE_VAL_VALIDATION_STATE_H_ +#define SOURCE_VAL_VALIDATION_STATE_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/diagnostic.h" +#include "source/disassemble.h" +#include "source/enum_set.h" +#include "source/latest_version_spirv_header.h" +#include "source/spirv_definition.h" +#include "source/spirv_validator_options.h" +#include "source/val/decoration.h" +#include "source/val/function.h" +#include "source/val/instruction.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace val { + +/// This enum represents the sections of a SPIRV module. See section 2.4 +/// of the SPIRV spec for additional details of the order. The enumerant values +/// are in the same order as the vector returned by GetModuleOrder +enum ModuleLayoutSection { + kLayoutCapabilities, /// < Section 2.4 #1 + kLayoutExtensions, /// < Section 2.4 #2 + kLayoutExtInstImport, /// < Section 2.4 #3 + kLayoutMemoryModel, /// < Section 2.4 #4 + kLayoutEntryPoint, /// < Section 2.4 #5 + kLayoutExecutionMode, /// < Section 2.4 #6 + kLayoutDebug1, /// < Section 2.4 #7 > 1 + kLayoutDebug2, /// < Section 2.4 #7 > 2 + kLayoutDebug3, /// < Section 2.4 #7 > 3 + kLayoutAnnotations, /// < Section 2.4 #8 + kLayoutTypes, /// < Section 2.4 #9 + kLayoutFunctionDeclarations, /// < Section 2.4 #10 + kLayoutFunctionDefinitions /// < Section 2.4 #11 +}; + +/// This class manages the state of the SPIR-V validation as it is being parsed. +class ValidationState_t { + public: + // Features that can optionally be turned on by a capability or environment. + struct Feature { + bool declare_int16_type = false; // Allow OpTypeInt with 16 bit width? + bool declare_float16_type = false; // Allow OpTypeFloat with 16 bit width? + bool free_fp_rounding_mode = false; // Allow the FPRoundingMode decoration + // and its vaules to be used without + // requiring any capability + + // Allow functionalities enabled by VariablePointers capability. + bool variable_pointers = false; + // Allow functionalities enabled by VariablePointersStorageBuffer + // capability. + bool variable_pointers_storage_buffer = false; + + // Permit group oerations Reduce, InclusiveScan, ExclusiveScan + bool group_ops_reduce_and_scans = false; + + // Disallows the use of OpUndef + bool bans_op_undef = false; + + // Allow OpTypeInt with 8 bit width? + bool declare_int8_type = false; + + // Target environment uses relaxed block layout. + // This is true for Vulkan 1.1 or later. + bool env_relaxed_block_layout = false; + }; + + ValidationState_t(const spv_const_context context, + const spv_const_validator_options opt, + const uint32_t* words, const size_t num_words); + + /// Returns the context + spv_const_context context() const { return context_; } + + /// Returns the command line options + spv_const_validator_options options() const { return options_; } + + /// Sets the ID of the generator for this module. + void setGenerator(uint32_t gen) { generator_ = gen; } + + /// Returns the ID of the generator for this module. + uint32_t generator() const { return generator_; } + + /// Sets the SPIR-V version of this module. + void setVersion(uint32_t ver) { version_ = ver; } + + /// Gets the SPIR-V version of this module. + uint32_t version() const { return version_; } + + /// Forward declares the id in the module + spv_result_t ForwardDeclareId(uint32_t id); + + /// Removes a forward declared ID if it has been defined + spv_result_t RemoveIfForwardDeclared(uint32_t id); + + /// Registers an ID as a forward pointer + spv_result_t RegisterForwardPointer(uint32_t id); + + /// Returns whether or not an ID is a forward pointer + bool IsForwardPointer(uint32_t id) const; + + /// Assigns a name to an ID + void AssignNameToId(uint32_t id, std::string name); + + /// Returns a string representation of the ID in the format [Name] where + /// the is the numeric valid of the id and the Name is a name assigned by + /// the OpName instruction + std::string getIdName(uint32_t id) const; + + /// Accessor function for ID bound. + uint32_t getIdBound() const; + + /// Mutator function for ID bound. + void setIdBound(uint32_t bound); + + /// Like getIdName but does not display the id if the \p id has a name + std::string getIdOrName(uint32_t id) const; + + /// Returns the number of ID which have been forward referenced but not + /// defined + size_t unresolved_forward_id_count() const; + + /// Returns a vector of unresolved forward ids. + std::vector UnresolvedForwardIds() const; + + /// Returns true if the id has been defined + bool IsDefinedId(uint32_t id) const; + + /// Increments the total number of instructions in the file. + void increment_total_instructions() { total_instructions_++; } + + /// Increments the total number of functions in the file. + void increment_total_functions() { total_functions_++; } + + /// Allocates internal storage. Note, calling this will invalidate any + /// pointers to |ordered_instructions_| or |module_functions_| and, hence, + /// should only be called at the beginning of validation. + void preallocateStorage(); + + /// Returns the current layout section which is being processed + ModuleLayoutSection current_layout_section() const; + + /// Increments the module_layout_order_section_ + void ProgressToNextLayoutSectionOrder(); + + /// Determines if the op instruction is part of the current section + bool IsOpcodeInCurrentLayoutSection(SpvOp op); + + DiagnosticStream diag(spv_result_t error_code, const Instruction* inst) const; + + /// Returns the function states + std::vector& functions(); + + /// Returns the function states + Function& current_function(); + const Function& current_function() const; + + /// Returns function state with the given id, or nullptr if no such function. + const Function* function(uint32_t id) const; + Function* function(uint32_t id); + + /// Returns true if the called after a function instruction but before the + /// function end instruction + bool in_function_body() const; + + /// Returns true if called after a label instruction but before a branch + /// instruction + bool in_block() const; + + struct EntryPointDescription { + std::string name; + std::vector interfaces; + }; + + /// Registers |id| as an entry point with |execution_model| and |interfaces|. + void RegisterEntryPoint(const uint32_t id, SpvExecutionModel execution_model, + EntryPointDescription&& desc) { + entry_points_.push_back(id); + entry_point_to_execution_models_[id].insert(execution_model); + entry_point_descriptions_[id].emplace_back(desc); + } + + /// Returns a list of entry point function ids + const std::vector& entry_points() const { return entry_points_; } + + /// Registers execution mode for the given entry point. + void RegisterExecutionModeForEntryPoint(uint32_t entry_point, + SpvExecutionMode execution_mode) { + entry_point_to_execution_modes_[entry_point].insert(execution_mode); + } + + /// Returns the interface descriptions of a given entry point. + const std::vector& entry_point_descriptions( + uint32_t entry_point) { + return entry_point_descriptions_.at(entry_point); + } + + /// Returns Execution Models for the given Entry Point. + /// Returns nullptr if none found (would trigger assertion). + const std::set* GetExecutionModels( + uint32_t entry_point) const { + const auto it = entry_point_to_execution_models_.find(entry_point); + if (it == entry_point_to_execution_models_.end()) { + assert(0); + return nullptr; + } + return &it->second; + } + + /// Returns Execution Modes for the given Entry Point. + /// Returns nullptr if none found. + const std::set* GetExecutionModes( + uint32_t entry_point) const { + const auto it = entry_point_to_execution_modes_.find(entry_point); + if (it == entry_point_to_execution_modes_.end()) { + return nullptr; + } + return &it->second; + } + + /// Traverses call tree and computes function_to_entry_points_. + /// Note: called after fully parsing the binary. + void ComputeFunctionToEntryPointMapping(); + + /// Returns all the entry points that can call |func|. + const std::vector& FunctionEntryPoints(uint32_t func) const; + + /// Inserts an to the set of functions that are target of OpFunctionCall. + void AddFunctionCallTarget(const uint32_t id) { + function_call_targets_.insert(id); + current_function().AddFunctionCallTarget(id); + } + + /// Returns whether or not a function is the target of OpFunctionCall. + bool IsFunctionCallTarget(const uint32_t id) { + return (function_call_targets_.find(id) != function_call_targets_.end()); + } + + /// Registers the capability and its dependent capabilities + void RegisterCapability(SpvCapability cap); + + /// Registers the extension. + void RegisterExtension(Extension ext); + + /// Registers the function in the module. Subsequent instructions will be + /// called against this function + spv_result_t RegisterFunction(uint32_t id, uint32_t ret_type_id, + SpvFunctionControlMask function_control, + uint32_t function_type_id); + + /// Register a function end instruction + spv_result_t RegisterFunctionEnd(); + + /// Returns true if the capability is enabled in the module. + bool HasCapability(SpvCapability cap) const { + return module_capabilities_.Contains(cap); + } + + /// Returns true if the extension is enabled in the module. + bool HasExtension(Extension ext) const { + return module_extensions_.Contains(ext); + } + + /// Returns true if any of the capabilities is enabled, or if |capabilities| + /// is an empty set. + bool HasAnyOfCapabilities(const CapabilitySet& capabilities) const; + + /// Returns true if any of the extensions is enabled, or if |extensions| + /// is an empty set. + bool HasAnyOfExtensions(const ExtensionSet& extensions) const; + + /// Sets the addressing model of this module (logical/physical). + void set_addressing_model(SpvAddressingModel am); + + /// Returns true if the OpMemoryModel was found. + bool has_memory_model_specified() const { + return addressing_model_ != SpvAddressingModelMax && + memory_model_ != SpvMemoryModelMax; + } + + /// Returns the addressing model of this module, or Logical if uninitialized. + SpvAddressingModel addressing_model() const; + + /// Sets the memory model of this module. + void set_memory_model(SpvMemoryModel mm); + + /// Returns the memory model of this module, or Simple if uninitialized. + SpvMemoryModel memory_model() const; + + const AssemblyGrammar& grammar() const { return grammar_; } + + /// Inserts the instruction into the list of ordered instructions in the file. + Instruction* AddOrderedInstruction(const spv_parsed_instruction_t* inst); + + /// Registers the instruction. This will add the instruction to the list of + /// definitions and register sampled image consumers. + void RegisterInstruction(Instruction* inst); + + /// Registers the debug instruction information. + void RegisterDebugInstruction(const Instruction* inst); + + /// Registers the decoration for the given + void RegisterDecorationForId(uint32_t id, const Decoration& dec) { + id_decorations_[id].push_back(dec); + } + + /// Registers the list of decorations for the given + template + void RegisterDecorationsForId(uint32_t id, InputIt begin, InputIt end) { + std::vector& cur_decs = id_decorations_[id]; + cur_decs.insert(cur_decs.end(), begin, end); + } + + /// Registers the list of decorations for the given member of the given + /// structure. + template + void RegisterDecorationsForStructMember(uint32_t struct_id, + uint32_t member_index, InputIt begin, + InputIt end) { + RegisterDecorationsForId(struct_id, begin, end); + for (auto& decoration : id_decorations_[struct_id]) { + decoration.set_struct_member_index(member_index); + } + } + + /// Returns all the decorations for the given . If no decorations exist + /// for the , it registers an empty vector for it in the map and + /// returns the empty vector. + std::vector& id_decorations(uint32_t id) { + return id_decorations_[id]; + } + const std::vector& id_decorations(uint32_t id) const { + // TODO: This would throw or generate SIGABRT if id has no + // decorations. Remove/refactor this function. + return id_decorations_.at(id); + } + + // Returns const pointer to the internal decoration container. + const std::map>& id_decorations() const { + return id_decorations_; + } + + /// Finds id's def, if it exists. If found, returns the definition otherwise + /// nullptr + const Instruction* FindDef(uint32_t id) const; + + /// Finds id's def, if it exists. If found, returns the definition otherwise + /// nullptr + Instruction* FindDef(uint32_t id); + + /// Returns the instructions in the order they appear in the binary + const std::vector& ordered_instructions() const { + return ordered_instructions_; + } + + /// Returns a map of instructions mapped by their result id + const std::unordered_map& all_definitions() const { + return all_definitions_; + } + + /// Returns a vector containing the Ids of instructions that consume the given + /// SampledImage id. + std::vector getSampledImageConsumers(uint32_t id) const; + + /// Records cons_id as a consumer of sampled_image_id. + void RegisterSampledImageConsumer(uint32_t sampled_image_id, + uint32_t cons_id); + + /// Returns the set of Global Variables. + std::unordered_set& global_vars() { return global_vars_; } + + /// Returns the set of Local Variables. + std::unordered_set& local_vars() { return local_vars_; } + + /// Returns the number of Global Variables. + size_t num_global_vars() { return global_vars_.size(); } + + /// Returns the number of Local Variables. + size_t num_local_vars() { return local_vars_.size(); } + + /// Inserts a new to the set of Global Variables. + void registerGlobalVariable(const uint32_t id) { global_vars_.insert(id); } + + /// Inserts a new to the set of Local Variables. + void registerLocalVariable(const uint32_t id) { local_vars_.insert(id); } + + // Returns true if using relaxed block layout, equivalent to + // VK_KHR_relaxed_block_layout. + bool IsRelaxedBlockLayout() const { + return features_.env_relaxed_block_layout || options()->relax_block_layout; + } + + /// Sets the struct nesting depth for a given struct ID + void set_struct_nesting_depth(uint32_t id, uint32_t depth) { + struct_nesting_depth_[id] = depth; + } + + /// Returns the nesting depth of a given structure ID + uint32_t struct_nesting_depth(uint32_t id) { + return struct_nesting_depth_[id]; + } + + /// Records that the structure type has a member decorated with a built-in. + void RegisterStructTypeWithBuiltInMember(uint32_t id) { + builtin_structs_.insert(id); + } + + /// Returns true if the struct type with the given Id has a BuiltIn member. + bool IsStructTypeWithBuiltInMember(uint32_t id) const { + return (builtin_structs_.find(id) != builtin_structs_.end()); + } + + // Returns the state of optional features. + const Feature& features() const { return features_; } + + /// Adds the instruction data to unique_type_declarations_. + /// Returns false if an identical type declaration already exists. + bool RegisterUniqueTypeDeclaration(const Instruction* inst); + + // Returns type_id of the scalar component of |id|. + // |id| can be either + // - scalar, vector or matrix type + // - object of either scalar, vector or matrix type + uint32_t GetComponentType(uint32_t id) const; + + // Returns + // - 1 for scalar types or objects + // - vector size for vector types or objects + // - num columns for matrix types or objects + // Should not be called with any other arguments (will return zero and invoke + // assertion). + uint32_t GetDimension(uint32_t id) const; + + // Returns bit width of scalar or component. + // |id| can be + // - scalar, vector or matrix type + // - object of either scalar, vector or matrix type + // Will invoke assertion and return 0 if |id| is none of the above. + uint32_t GetBitWidth(uint32_t id) const; + + // Provides detailed information on matrix type. + // Returns false iff |id| is not matrix type. + bool GetMatrixTypeInfo(uint32_t id, uint32_t* num_rows, uint32_t* num_cols, + uint32_t* column_type, uint32_t* component_type) const; + + // Collects struct member types into |member_types|. + // Returns false iff not struct type or has no members. + // Deletes prior contents of |member_types|. + bool GetStructMemberTypes(uint32_t struct_type_id, + std::vector* member_types) const; + + // Returns true iff |id| is a type corresponding to the name of the function. + // Only works for types not for objects. + bool IsFloatScalarType(uint32_t id) const; + bool IsFloatVectorType(uint32_t id) const; + bool IsFloatScalarOrVectorType(uint32_t id) const; + bool IsFloatMatrixType(uint32_t id) const; + bool IsIntScalarType(uint32_t id) const; + bool IsIntVectorType(uint32_t id) const; + bool IsIntScalarOrVectorType(uint32_t id) const; + bool IsUnsignedIntScalarType(uint32_t id) const; + bool IsUnsignedIntVectorType(uint32_t id) const; + bool IsSignedIntScalarType(uint32_t id) const; + bool IsSignedIntVectorType(uint32_t id) const; + bool IsBoolScalarType(uint32_t id) const; + bool IsBoolVectorType(uint32_t id) const; + bool IsBoolScalarOrVectorType(uint32_t id) const; + bool IsPointerType(uint32_t id) const; + + // Gets value from OpConstant and OpSpecConstant as uint64. + // Returns false on failure (no instruction, wrong instruction, not int). + bool GetConstantValUint64(uint32_t id, uint64_t* val) const; + + // Returns type_id if id has type or zero otherwise. + uint32_t GetTypeId(uint32_t id) const; + + // Returns opcode of the instruction which issued the id or OpNop if the + // instruction is not registered. + SpvOp GetIdOpcode(uint32_t id) const; + + // Returns type_id for given id operand if it has a type or zero otherwise. + // |operand_index| is expected to be pointing towards an operand which is an + // id. + uint32_t GetOperandTypeId(const Instruction* inst, + size_t operand_index) const; + + // Provides information on pointer type. Returns false iff not pointer type. + bool GetPointerTypeInfo(uint32_t id, uint32_t* data_type, + uint32_t* storage_class) const; + + // Tries to evaluate a 32-bit signed or unsigned scalar integer constant. + // Returns tuple . + std::tuple EvalInt32IfConst(uint32_t id); + + // Returns the disassembly string for the given instruction. + std::string Disassemble(const Instruction& inst) const; + + // Returns the disassembly string for the given instruction. + std::string Disassemble(const uint32_t* words, uint16_t num_words) const; + + private: + ValidationState_t(const ValidationState_t&); + + const spv_const_context context_; + + /// Stores the Validator command line options. Must be a valid options object. + const spv_const_validator_options options_; + + /// The SPIR-V binary module we're validating. + const uint32_t* words_; + const size_t num_words_; + + /// The generator of the SPIR-V. + uint32_t generator_ = 0; + + /// The version of the SPIR-V. + uint32_t version_ = 0; + + /// The total number of instructions in the binary. + size_t total_instructions_ = 0; + /// The total number of functions in the binary. + size_t total_functions_ = 0; + + /// IDs which have been forward declared but have not been defined + std::unordered_set unresolved_forward_ids_; + + /// IDs that have been declared as forward pointers. + std::unordered_set forward_pointer_ids_; + + /// Stores a vector of instructions that use the result of a given + /// OpSampledImage instruction. + std::unordered_map> sampled_image_consumers_; + + /// A map of operand IDs and their names defined by the OpName instruction + std::unordered_map operand_names_; + + /// The section of the code being processed + ModuleLayoutSection current_layout_section_; + + /// A list of functions in the module. + /// Pointers to objects in this container are guaranteed to be stable and + /// valid until the end of lifetime of the validation state. + std::vector module_functions_; + + /// Capabilities declared in the module + CapabilitySet module_capabilities_; + + /// Extensions declared in the module + ExtensionSet module_extensions_; + + /// List of all instructions in the order they appear in the binary + std::vector ordered_instructions_; + + /// Instructions that can be referenced by Ids + std::unordered_map all_definitions_; + + /// IDs that are entry points, ie, arguments to OpEntryPoint. + std::vector entry_points_; + + /// Maps an entry point id to its desciptions. + std::unordered_map> + entry_point_descriptions_; + + /// Functions IDs that are target of OpFunctionCall. + std::unordered_set function_call_targets_; + + /// ID Bound from the Header + uint32_t id_bound_; + + /// Set of Global Variable IDs (Storage Class other than 'Function') + std::unordered_set global_vars_; + + /// Set of Local Variable IDs ('Function' Storage Class) + std::unordered_set local_vars_; + + /// Set of struct types that have members with a BuiltIn decoration. + std::unordered_set builtin_structs_; + + /// Structure Nesting Depth + std::unordered_map struct_nesting_depth_; + + /// Stores the list of decorations for a given + std::map> id_decorations_; + + /// Stores type declarations which need to be unique (i.e. non-aggregates), + /// in the form [opcode, operand words], result_id is not stored. + /// Using ordered set to avoid the need for a vector hash function. + /// The size of this container is expected not to exceed double-digits. + std::set> unique_type_declarations_; + + AssemblyGrammar grammar_; + + SpvAddressingModel addressing_model_; + SpvMemoryModel memory_model_; + + /// NOTE: See correspoding getter functions + bool in_function_; + + /// The state of optional features. These are determined by capabilities + /// declared by the module and the environment. + Feature features_; + + /// Maps function ids to function stat objects. + std::unordered_map id_to_function_; + + /// Mapping entry point -> execution models. It is presumed that the same + /// function could theoretically be used as 'main' by multiple OpEntryPoint + /// instructions. + std::unordered_map> + entry_point_to_execution_models_; + + /// Mapping entry point -> execution modes. + std::unordered_map> + entry_point_to_execution_modes_; + + /// Mapping function -> array of entry points inside this + /// module which can (indirectly) call the function. + std::unordered_map> function_to_entry_points_; + const std::vector empty_ids_; +}; + +} // namespace val +} // namespace spvtools + +#endif // SOURCE_VAL_VALIDATION_STATE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/syntax.md b/3rdparty/bgfx/3rdparty/spirv-tools/syntax.md new file mode 100644 index 00000000000..be3a5d5ad11 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/syntax.md @@ -0,0 +1,238 @@ +# SPIR-V Assembly language syntax + +## Overview + +The assembly attempts to adhere to the binary form from Section 3 of the SPIR-V +spec as closely as possible, with one exception aiming at improving the text's +readability. The `` generated by an instruction is moved to the +beginning of that instruction and followed by an `=` sign. This allows us to +distinguish between variable definitions and uses and locate value definitions +more easily. + +Here is an example: + +``` + OpCapability Shader + OpMemoryModel Logical Simple + OpEntryPoint GLCompute %3 "main" + OpExecutionMode %3 LocalSize 64 64 1 +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +``` + +A module is a sequence of instructions, separated by whitespace. +An instruction is an opcode name followed by operands, separated by +whitespace. Typically each instruction is presented on its own line, +but the assembler does not enforce this rule. + +The opcode names and expected operands are described in Section 3 of +the SPIR-V specification. An operand is one of: +* a literal integer: A decimal integer, or a hexadecimal integer. + A hexadecimal integer is indicated by a leading `0x` or `0X`. A hex + integer supplied for a signed integer value will be sign-extended. + For example, `0xffff` supplied as the literal for an `OpConstant` + on a signed 16-bit integer type will be interpreted as the value `-1`. +* a literal floating point number, in decimal or hexadecimal form. + See [below](#floats). +* a literal string. + * A literal string is everything following a double-quote `"` until the + following un-escaped double-quote. This includes special characters such + as newlines. + * A backslash `\` may be used to escape characters in the string. The `\` + may be used to escape a double-quote or a `\` but is simply ignored when + preceding any other character. +* a named enumerated value, specific to that operand position. For example, + the `OpMemoryModel` takes a named Addressing Model operand (e.g. `Logical` or + `Physical32`), and a named Memory Model operand (e.g. `Simple` or `OpenCL`). + Named enumerated values are only meaningful in specific positions, and will + otherwise generate an error. +* a mask expression, consisting of one or more mask enum names separated + by `|`. For example, the expression `NotNaN|NotInf|NSZ` denotes the mask + which is the combination of the `NotNaN`, `NotInf`, and `NSZ` flags. +* an injected immediate integer: `!`. See [below](#immediate). +* an ID, e.g. `%foo`. See [below](#id). +* the name of an extended instruction. For example, `sqrt` in an extended + instruction such as `%f = OpExtInst %f32 %OpenCLImport sqrt %arg` +* the name of an opcode for OpSpecConstantOp, but where the `Op` prefix + is removed. For example, the following indicates the use of an integer + addition in a specialization constant computation: + `%sum = OpSpecConstantOp %i32 IAdd %a %b` + +## ID Definitions & Usage + + +An ID _definition_ pertains to the `` of an instruction, and ID +_usage_ is a use of an ID as an input to an instruction. + +An ID in the assembly language begins with `%` and must be followed by a name +consisting of one or more letters, numbers or underscore characters. + +For every ID in the assembly program, the assembler generates a unique number +called the ID's internal number. Then each ID reference translates into its +internal number in the SPIR-V output. Internal numbers are unique within the +compilation unit: no two IDs in the same unit will share internal numbers. + +The disassembler generates IDs where the name is always a decimal number +greater than 0. + +So the example can be rewritten using more user-friendly names, as follows: +``` + OpCapability Shader + OpMemoryModel Logical Simple + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 64 64 1 + %void = OpTypeVoid +%fnMain = OpTypeFunction %void + %main = OpFunction %void None %fnMain +%lbMain = OpLabel + OpReturn + OpFunctionEnd +``` + +## Floating point literals + + +The assembler and disassembler support floating point literals in both +decimal and hexadecimal form. + +The syntax for a floating point literal is the same as floating point +constants in the C programming language, except: +* An optional leading minus (`-`) is part of the literal. +* An optional type specifier suffix is not allowed. +Infinity and NaN values are expressed in hexadecimal float literals +by using the maximum representable exponent for the bit width. + +For example, in 32-bit floating point, 8 bits are used for the exponent, and the +exponent bias is 127. So the maximum representable unbiased exponent is 128. +Therefore, we represent the infinities and some NaNs as follows: + +``` +%float32 = OpTypeFloat 32 +%inf = OpConstant %float32 0x1p+128 +%neginf = OpConstant %float32 -0x1p+128 +%aNaN = OpConstant %float32 0x1.8p+128 +%moreNaN = OpConstant %float32 -0x1.0002p+128 +``` +The assembler preserves all the bits of a NaN value. For example, the encoding +of `%aNaN` in the previous example is the same as the word with bits +`0x7fc00000`, and `%moreNaN` is encoded as `0xff800100`. + +The disassembler prints infinite, NaN, and subnormal values in hexadecimal form. +Zero and normal values are printed in decimal form with enough digits +to preserve all significand bits. + +## Arbitrary Integers + + +When writing tests it can be useful to emit an invalid 32 bit word into the +binary stream at arbitrary positions within the assembly. To specify an +arbitrary word into the stream the prefix `!` is used, this takes the form +`!`. Here is an example. + +``` +OpCapability !0x0000FF00 +``` + +Any token in a valid assembly program may be replaced by `!` -- even +tokens that dictate how the rest of the instruction is parsed. Consider, for +example, the following assembly program: + +``` +%4 = OpConstant %1 123 456 789 OpExecutionMode %2 LocalSize 11 22 33 +OpExecutionMode %3 InputLines +``` + +The tokens `OpConstant`, `LocalSize`, and `InputLines` may be replaced by random +`!` values, and the assembler will still assemble an output binary with +three instructions. It will not necessarily be valid SPIR-V, but it will +faithfully reflect the input text. + +You may wonder how the assembler recognizes the instruction structure (including +instruction boundaries) in the text with certain crucial tokens replaced by +arbitrary integers. If, say, `OpConstant` becomes a `!` whose value +differs from the binary representation of `OpConstant` (remember that this +feature is intended for fine-grain control in SPIR-V testing), the assembler +generally has no idea what that value stands for. So how does it know there is +exactly one `` and three number literals following in that instruction, +before the next one begins? And if `LocalSize` is replaced by an arbitrary +`!`, how does it know to take the next three tokens (instead of zero or +one, both of which are possible in the absence of certainty that `LocalSize` +provided)? The answer is a simple rule governing the parsing of instructions +with `!` in them: + +When a token in the assembly program is a `!`, that integer value is +emitted into the binary output, and parsing proceeds differently than before: +each subsequent token not recognized as an OpCode or a is emitted +into the binary output without any checking; when a recognizable OpCode or a + is eventually encountered, it begins a new instruction and parsing +returns to normal. (If a subsequent OpCode is never found, then this alternate +parsing mode handles all the remaining tokens in the program.) + +The assembler processes the tokens encountered in alternate parsing mode as +follows: + +* If the token is a number literal, since context may be lost, the number + is interpreted as a 32-bit value and output as a single word. In order to + specify multiple-word literals in alternate-parsing mode, further uses of + `!` tokens may be required. + All formats supported by `strtoul()` are accepted. +* If the token is a string literal, it outputs a sequence of words representing + the string as defined in the SPIR-V specification for Literal String. +* If the token is an ID, it outputs the ID's internal number. +* If the token is another `!`, it outputs that integer. +* Any other token causes the assembler to quit with an error. + +Note that this has some interesting consequences, including: + +* When an OpCode is replaced by `!`, the integer value should encode + the instruction's word count, as specified in the physical-layout section of + the SPIR-V specification. + +* Consecutive instructions may have their OpCode replaced by `!` and + still produce valid SPIR-V. For example, `!262187 %1 %2 "abc" !327739 %1 %3 6 + %2` will successfully assemble into SPIR-V declaring a constant and a + PrivateGlobal variable. + +* Enums (such as `DontInline` or `SubgroupMemory`, for instance) are not handled + by the alternate parsing mode. They must be replaced by `!` for + successful assembly. + +* The `` on the left-hand side of an assignment cannot be a + `!`. The `` can be still be manually controlled if desired + by expressing the entire instruction as `!` tokens for its opcode and + operands. + +* The `=` sign cannot be processed by the alternate parsing mode if the OpCode + following it is a `!`. + +* When replacing a named ID with `!`, it is possible to generate + unintentionally valid SPIR-V. If the integer provided happens to equal a + number generated for an existing named ID, it will result in a reference to + that named ID being output. This may be valid SPIR-V, contrary to the + presumed intention of the writer. + +## Notes + +* Some enumerants cannot be used by name, because the target instruction +in which they are meaningful take an ID reference instead of a literal value. +For example: + * Named enumerated value `CmdExecTime` from section 3.30 Kernel + Profiling Info is used in constructing a mask value supplied as + an ID for `OpCaptureEventProfilingInfo`. But no other instruction + has enough context to bring the enumerant names from section 3.30 + into scope. + * Similarly, the names in section 3.29 Kernel Enqueue Flags are used to + construct a value supplied as an ID to the Flags argument of + OpEnqueueKernel. + * Similarly for the names in section 3.25 Memory Semantics. + * Similarly for the names in section 3.27 Scope. +* Some enumerants cannot be used by name, because they only name values +returned by an instruction: + * Enumerants from 3.12 Image Channel Order name possible values returned + by the `OpImageQueryOrder` instruction. + * Enumerants from 3.13 Image Channel Data Type name possible values + returned by the `OpImageQueryFormat` instruction. diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/CMakeLists.txt new file mode 100644 index 00000000000..1fdf5a2122e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/CMakeLists.txt @@ -0,0 +1,226 @@ +# Copyright (c) 2015-2016 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. + +# Add a SPIR-V Tools unit test. Signature: +# add_spvtools_unittest( +# TARGET target_name +# SRCS src_file.h src_file.cpp +# LIBS lib1 lib2 +# ) + +if (NOT "${SPIRV_SKIP_TESTS}") + if (TARGET gmock_main) + message(STATUS "Found Google Mock, building tests.") + else() + message(STATUS "Did not find googletest, tests will not be built. " + "To enable tests place googletest in '/external/googletest'.") + endif() +endif() + +function(add_spvtools_unittest) + if (NOT "${SPIRV_SKIP_TESTS}" AND TARGET gmock_main) + set(one_value_args TARGET) + set(multi_value_args SRCS LIBS ENVIRONMENT) + cmake_parse_arguments( + ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) + set(target test_${ARG_TARGET}) + add_executable(${target} ${ARG_SRCS}) + spvtools_default_compile_options(${target}) + if(${COMPILER_IS_LIKE_GNU}) + target_compile_options(${target} PRIVATE -Wno-undef) + # Effcee and RE2 headers exhibit shadowing. + target_compile_options(${target} PRIVATE -Wno-shadow) + endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # Disable C4503 "decorated name length exceeded" warning, + # triggered by some heavily templated types. + # We don't care much about that in test code. + # Important to do since we have warnings-as-errors. + target_compile_options(${target} PRIVATE /wd4503) + # Googletest accidentally turns off support for ::testing::Combine + # in VS 2017. See https://github.com/google/googletest/issues/1352 + # Forcibly turn it on again. + target_compile_options(${target} PRIVATE /DGTEST_HAS_COMBINE=1) + endif() + target_include_directories(${target} PRIVATE + ${SPIRV_HEADER_INCLUDE_DIR} + ${spirv-tools_SOURCE_DIR} + ${spirv-tools_SOURCE_DIR}/include + ${spirv-tools_SOURCE_DIR}/test + ${spirv-tools_BINARY_DIR} + ${gtest_SOURCE_DIR}/include + ${gmock_SOURCE_DIR}/include + ) + if (TARGET effcee) + # If using Effcee for testing, then add its include directory. + target_include_directories(${target} PRIVATE ${effcee_SOURCE_DIR}) + endif() + target_link_libraries(${target} PRIVATE ${ARG_LIBS}) + if (TARGET effcee) + target_link_libraries(${target} PRIVATE effcee) + endif() + target_link_libraries(${target} PRIVATE gmock_main) + add_test(NAME spirv-tools-${target} COMMAND ${target}) + if (DEFINED ARG_ENVIRONMENT) + set_tests_properties(spirv-tools-${target} PROPERTIES ENVIRONMENT ${ARG_ENVIRONMENT}) + endif() + set_property(TARGET ${target} PROPERTY FOLDER "SPIRV-Tools tests") + endif() +endfunction() + +set(TEST_SOURCES + test_fixture.h + unit_spirv.h + + assembly_context_test.cpp + assembly_format_test.cpp + binary_destroy_test.cpp + binary_endianness_test.cpp + binary_header_get_test.cpp + binary_parse_test.cpp + binary_strnlen_s_test.cpp + binary_to_text_test.cpp + binary_to_text.literal_test.cpp + comment_test.cpp + enum_string_mapping_test.cpp + enum_set_test.cpp + ext_inst.debuginfo_test.cpp + ext_inst.glsl_test.cpp + ext_inst.opencl_test.cpp + fix_word_test.cpp + generator_magic_number_test.cpp + hex_float_test.cpp + immediate_int_test.cpp + libspirv_macros_test.cpp + named_id_test.cpp + name_mapper_test.cpp + opcode_make_test.cpp + opcode_require_capabilities_test.cpp + opcode_split_test.cpp + opcode_table_get_test.cpp + operand_capabilities_test.cpp + operand_test.cpp + operand_pattern_test.cpp + software_version_test.cpp + target_env_test.cpp + text_advance_test.cpp + text_destroy_test.cpp + text_literal_test.cpp + text_start_new_inst_test.cpp + text_to_binary.annotation_test.cpp + text_to_binary.barrier_test.cpp + text_to_binary.constant_test.cpp + text_to_binary.control_flow_test.cpp + text_to_binary_test.cpp + text_to_binary.debug_test.cpp + text_to_binary.device_side_enqueue_test.cpp + text_to_binary.extension_test.cpp + text_to_binary.function_test.cpp + text_to_binary.group_test.cpp + text_to_binary.image_test.cpp + text_to_binary.literal_test.cpp + text_to_binary.memory_test.cpp + text_to_binary.misc_test.cpp + text_to_binary.mode_setting_test.cpp + text_to_binary.pipe_storage_test.cpp + text_to_binary.type_declaration_test.cpp + text_to_binary.subgroup_dispatch_test.cpp + text_to_binary.reserved_sampling_test.cpp + text_word_get_test.cpp + + unit_spirv.cpp +) + +add_spvtools_unittest( + TARGET spirv_unit_tests + SRCS ${TEST_SOURCES} + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET diagnostic + SRCS diagnostic_test.cpp + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET c_interface + SRCS c_interface_test.cpp + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET c_interface_shared + SRCS c_interface_test.cpp + LIBS ${SPIRV_TOOLS}-shared + ENVIRONMENT PATH=$) + +add_spvtools_unittest( + TARGET cpp_interface + SRCS cpp_interface_test.cpp + LIBS SPIRV-Tools-opt) + +add_spvtools_unittest( + TARGET parse_number + SRCS parse_number_test.cpp + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET string_utils + SRCS string_utils_test.cpp + LIBS ${SPIRV_TOOLS}) + +if (${SPIRV_TIMER_ENABLED}) +add_spvtools_unittest( + TARGET timer + SRCS timer_test.cpp + LIBS ${SPIRV_TOOLS}) +endif() + +add_spvtools_unittest( + TARGET log + SRCS log_test.cpp + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET preserve_numeric_ids + SRCS preserve_numeric_ids_test.cpp + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET bit_stream + SRCS bit_stream.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.h + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET huffman_codec + SRCS huffman_codec.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/bit_stream.h + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/huffman_codec.h + LIBS ${SPIRV_TOOLS}) + +add_spvtools_unittest( + TARGET move_to_front + SRCS move_to_front_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/move_to_front.h + ${CMAKE_CURRENT_SOURCE_DIR}/../source/comp/move_to_front.cpp + LIBS ${SPIRV_TOOLS}) + +add_subdirectory(comp) +add_subdirectory(link) +add_subdirectory(opt) +add_subdirectory(stats) +add_subdirectory(tools) +add_subdirectory(util) +add_subdirectory(val) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/assembly_context_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/assembly_context_test.cpp new file mode 100644 index 00000000000..b6d60b95d95 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/assembly_context_test.cpp @@ -0,0 +1,77 @@ +// Copyright (c) 2015-2016 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. + +#include +#include + +#include "gmock/gmock.h" +#include "source/instruction.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::AutoText; +using spvtest::Concatenate; +using ::testing::Eq; + +struct EncodeStringCase { + std::string str; + std::vector initial_contents; +}; + +using EncodeStringTest = ::testing::TestWithParam; + +TEST_P(EncodeStringTest, Sample) { + AssemblyContext context(AutoText(""), nullptr); + spv_instruction_t inst; + inst.words = GetParam().initial_contents; + ASSERT_EQ(SPV_SUCCESS, + context.binaryEncodeString(GetParam().str.c_str(), &inst)); + // We already trust MakeVector + EXPECT_THAT(inst.words, + Eq(Concatenate({GetParam().initial_contents, + spvtest::MakeVector(GetParam().str)}))); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + BinaryEncodeString, EncodeStringTest, + ::testing::ValuesIn(std::vector{ + // Use cases that exercise at least one to two words, + // and both empty and non-empty initial contents. + {"", {}}, + {"", {1,2,3}}, + {"a", {}}, + {"a", {4}}, + {"ab", {4}}, + {"abc", {}}, + {"abc", {18}}, + {"abcd", {}}, + {"abcd", {22}}, + {"abcde", {4}}, + {"abcdef", {}}, + {"abcdef", {99,42}}, + {"abcdefg", {}}, + {"abcdefg", {101}}, + {"abcdefgh", {}}, + {"abcdefgh", {102, 103, 104}}, + // A very long string, encoded after an initial word. + // SPIR-V limits strings to 65535 characters. + {std::string(65535, 'a'), {1}}, + }),); +// clang-format on + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/assembly_format_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/assembly_format_test.cpp new file mode 100644 index 00000000000..59e500b8131 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/assembly_format_test.cpp @@ -0,0 +1,37 @@ +// Copyright (c) 2015-2016 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. + +#include "test/test_fixture.h" + +namespace svptools { +namespace { + +using spvtest::ScopedContext; +using spvtest::TextToBinaryTest; + +TEST_F(TextToBinaryTest, NotPlacingResultIDAtTheBeginning) { + SetText("OpTypeMatrix %1 %2 1000"); + EXPECT_EQ(SPV_ERROR_INVALID_TEXT, + spvTextToBinary(ScopedContext().context, text.str, text.length, + &binary, &diagnostic)); + ASSERT_NE(nullptr, diagnostic); + EXPECT_STREQ( + "Expected at the beginning of an instruction, found " + "'OpTypeMatrix'.", + diagnostic->error); + EXPECT_EQ(0u, diagnostic->position.line); +} + +} // namespace +} // namespace svptools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_destroy_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_destroy_test.cpp new file mode 100644 index 00000000000..e3870c9f0be --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_destroy_test.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using spvtest::ScopedContext; + +TEST(BinaryDestroy, Null) { + // There is no state or return value to check. Just check + // for the ability to call the API without abnormal termination. + spvBinaryDestroy(nullptr); +} + +using BinaryDestroySomething = spvtest::TextToBinaryTest; + +// Checks safety of destroying a validly constructed binary. +TEST_F(BinaryDestroySomething, Default) { + // Use a binary object constructed by the API instead of rolling our own. + SetText("OpSource OpenCL_C 120"); + spv_binary my_binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(ScopedContext().context, text.str, + text.length, &my_binary, &diagnostic)); + ASSERT_NE(nullptr, my_binary); + spvBinaryDestroy(my_binary); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_endianness_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_endianness_test.cpp new file mode 100644 index 00000000000..3cd405d52d6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_endianness_test.cpp @@ -0,0 +1,54 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +TEST(BinaryEndianness, InvalidCode) { + uint32_t invalidMagicNumber[] = {0}; + spv_const_binary_t binary = {invalidMagicNumber, 1}; + spv_endianness_t endian; + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, spvBinaryEndianness(&binary, &endian)); +} + +TEST(BinaryEndianness, Little) { + uint32_t magicNumber; + if (I32_ENDIAN_HOST == I32_ENDIAN_LITTLE) { + magicNumber = 0x07230203; + } else { + magicNumber = 0x03022307; + } + spv_const_binary_t binary = {&magicNumber, 1}; + spv_endianness_t endian; + ASSERT_EQ(SPV_SUCCESS, spvBinaryEndianness(&binary, &endian)); + ASSERT_EQ(SPV_ENDIANNESS_LITTLE, endian); +} + +TEST(BinaryEndianness, Big) { + uint32_t magicNumber; + if (I32_ENDIAN_HOST == I32_ENDIAN_BIG) { + magicNumber = 0x07230203; + } else { + magicNumber = 0x03022307; + } + spv_const_binary_t binary = {&magicNumber, 1}; + spv_endianness_t endian; + ASSERT_EQ(SPV_SUCCESS, spvBinaryEndianness(&binary, &endian)); + ASSERT_EQ(SPV_ENDIANNESS_BIG, endian); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_header_get_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_header_get_test.cpp new file mode 100644 index 00000000000..e771f1a39c6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_header_get_test.cpp @@ -0,0 +1,84 @@ +// Copyright (c) 2015-2016 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. + +#include "source/spirv_constant.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +class BinaryHeaderGet : public ::testing::Test { + public: + BinaryHeaderGet() { memset(code, 0, sizeof(code)); } + + virtual void SetUp() { + code[0] = SpvMagicNumber; + code[1] = SpvVersion; + code[2] = SPV_GENERATOR_CODEPLAY; + code[3] = 1; // NOTE: Bound + code[4] = 0; // NOTE: Schema; reserved + code[5] = 0; // NOTE: Instructions + + binary.code = code; + binary.wordCount = 6; + } + spv_const_binary_t get_const_binary() { + return spv_const_binary_t{binary.code, binary.wordCount}; + } + virtual void TearDown() {} + + uint32_t code[6]; + spv_binary_t binary; +}; + +TEST_F(BinaryHeaderGet, Default) { + spv_endianness_t endian; + spv_const_binary_t const_bin = get_const_binary(); + ASSERT_EQ(SPV_SUCCESS, spvBinaryEndianness(&const_bin, &endian)); + + spv_header_t header; + ASSERT_EQ(SPV_SUCCESS, spvBinaryHeaderGet(&const_bin, endian, &header)); + + ASSERT_EQ(static_cast(SpvMagicNumber), header.magic); + ASSERT_EQ(0x00010300u, header.version); + ASSERT_EQ(static_cast(SPV_GENERATOR_CODEPLAY), header.generator); + ASSERT_EQ(1u, header.bound); + ASSERT_EQ(0u, header.schema); + ASSERT_EQ(&code[5], header.instructions); +} + +TEST_F(BinaryHeaderGet, InvalidCode) { + spv_const_binary_t my_binary = {nullptr, 0}; + spv_header_t header; + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryHeaderGet(&my_binary, SPV_ENDIANNESS_LITTLE, &header)); +} + +TEST_F(BinaryHeaderGet, InvalidPointerHeader) { + spv_const_binary_t const_bin = get_const_binary(); + ASSERT_EQ(SPV_ERROR_INVALID_POINTER, + spvBinaryHeaderGet(&const_bin, SPV_ENDIANNESS_LITTLE, nullptr)); +} + +TEST_F(BinaryHeaderGet, TruncatedHeader) { + for (uint8_t i = 1; i < SPV_INDEX_INSTRUCTION; i++) { + binary.wordCount = i; + spv_const_binary_t const_bin = get_const_binary(); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryHeaderGet(&const_bin, SPV_ENDIANNESS_LITTLE, nullptr)); + } +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_parse_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_parse_test.cpp new file mode 100644 index 00000000000..7d97001586f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_parse_test.cpp @@ -0,0 +1,900 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/latest_version_opencl_std_header.h" +#include "source/table.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +// Returns true if two spv_parsed_operand_t values are equal. +// To use this operator, this definition must appear in the same namespace +// as spv_parsed_operand_t. +static bool operator==(const spv_parsed_operand_t& a, + const spv_parsed_operand_t& b) { + return a.offset == b.offset && a.num_words == b.num_words && + a.type == b.type && a.number_kind == b.number_kind && + a.number_bit_width == b.number_bit_width; +} + +namespace spvtools { +namespace { + +using ::spvtest::Concatenate; +using ::spvtest::MakeInstruction; +using ::spvtest::MakeVector; +using ::spvtest::ScopedContext; +using ::testing::_; +using ::testing::AnyOf; +using ::testing::Eq; +using ::testing::InSequence; +using ::testing::Return; + +// An easily-constructible and comparable object for the contents of an +// spv_parsed_instruction_t. Unlike spv_parsed_instruction_t, owns the memory +// of its components. +struct ParsedInstruction { + explicit ParsedInstruction(const spv_parsed_instruction_t& inst) + : words(inst.words, inst.words + inst.num_words), + opcode(static_cast(inst.opcode)), + ext_inst_type(inst.ext_inst_type), + type_id(inst.type_id), + result_id(inst.result_id), + operands(inst.operands, inst.operands + inst.num_operands) {} + + std::vector words; + SpvOp opcode; + spv_ext_inst_type_t ext_inst_type; + uint32_t type_id; + uint32_t result_id; + std::vector operands; + + bool operator==(const ParsedInstruction& b) const { + return words == b.words && opcode == b.opcode && + ext_inst_type == b.ext_inst_type && type_id == b.type_id && + result_id == b.result_id && operands == b.operands; + } +}; + +// Prints a ParsedInstruction object to the given output stream, and returns +// the stream. +std::ostream& operator<<(std::ostream& os, const ParsedInstruction& inst) { + os << "\nParsedInstruction( {"; + spvtest::PrintTo(spvtest::WordVector(inst.words), &os); + os << "}, opcode: " << int(inst.opcode) + << " ext_inst_type: " << int(inst.ext_inst_type) + << " type_id: " << inst.type_id << " result_id: " << inst.result_id; + for (const auto& operand : inst.operands) { + os << " { offset: " << operand.offset << " num_words: " << operand.num_words + << " type: " << int(operand.type) + << " number_kind: " << int(operand.number_kind) + << " number_bit_width: " << int(operand.number_bit_width) << "}"; + } + os << ")"; + return os; +} + +// Sanity check for the equality operator on ParsedInstruction. +TEST(ParsedInstruction, ZeroInitializedAreEqual) { + spv_parsed_instruction_t pi = {}; + ParsedInstruction a(pi); + ParsedInstruction b(pi); + EXPECT_THAT(a, ::testing::TypedEq(b)); +} + +// Googlemock class receiving Header/Instruction calls from spvBinaryParse(). +class MockParseClient { + public: + MOCK_METHOD6(Header, spv_result_t(spv_endianness_t endian, uint32_t magic, + uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t reserved)); + MOCK_METHOD1(Instruction, spv_result_t(const ParsedInstruction&)); +}; + +// Casts user_data as MockParseClient and invokes its Header(). +spv_result_t invoke_header(void* user_data, spv_endianness_t endian, + uint32_t magic, uint32_t version, uint32_t generator, + uint32_t id_bound, uint32_t reserved) { + return static_cast(user_data)->Header( + endian, magic, version, generator, id_bound, reserved); +} + +// Casts user_data as MockParseClient and invokes its Instruction(). +spv_result_t invoke_instruction( + void* user_data, const spv_parsed_instruction_t* parsed_instruction) { + return static_cast(user_data)->Instruction( + ParsedInstruction(*parsed_instruction)); +} + +// The SPIR-V module header words for the Khronos Assembler generator, +// for a module with an ID bound of 1. +const uint32_t kHeaderForBound1[] = { + SpvMagicNumber, SpvVersion, + SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, 0), 1 /*bound*/, + 0 /*schema*/}; + +// Returns the expected SPIR-V module header words for the Khronos +// Assembler generator, and with a given Id bound. +std::vector ExpectedHeaderForBound(uint32_t bound) { + return {SpvMagicNumber, 0x10000, + SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, 0), bound, 0}; +} + +// Returns a parsed operand for a non-number value at the given word offset +// within an instruction. +spv_parsed_operand_t MakeSimpleOperand(uint16_t offset, + spv_operand_type_t type) { + return {offset, 1, type, SPV_NUMBER_NONE, 0}; +} + +// Returns a parsed operand for a literal unsigned integer value at the given +// word offset within an instruction. +spv_parsed_operand_t MakeLiteralNumberOperand(uint16_t offset) { + return {offset, 1, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_NUMBER_UNSIGNED_INT, + 32}; +} + +// Returns a parsed operand for a literal string value at the given +// word offset within an instruction. +spv_parsed_operand_t MakeLiteralStringOperand(uint16_t offset, + uint16_t length) { + return {offset, length, SPV_OPERAND_TYPE_LITERAL_STRING, SPV_NUMBER_NONE, 0}; +} + +// Returns a ParsedInstruction for an OpTypeVoid instruction that would +// generate the given result Id. +ParsedInstruction MakeParsedVoidTypeInstruction(uint32_t result_id) { + const auto void_inst = MakeInstruction(SpvOpTypeVoid, {result_id}); + const auto void_operands = std::vector{ + MakeSimpleOperand(1, SPV_OPERAND_TYPE_RESULT_ID)}; + const spv_parsed_instruction_t parsed_void_inst = { + void_inst.data(), + static_cast(void_inst.size()), + SpvOpTypeVoid, + SPV_EXT_INST_TYPE_NONE, + 0, // type id + result_id, + void_operands.data(), + static_cast(void_operands.size())}; + return ParsedInstruction(parsed_void_inst); +} + +// Returns a ParsedInstruction for an OpTypeInt instruction that generates +// the given result Id for a 32-bit signed integer scalar type. +ParsedInstruction MakeParsedInt32TypeInstruction(uint32_t result_id) { + const auto i32_inst = MakeInstruction(SpvOpTypeInt, {result_id, 32, 1}); + const auto i32_operands = std::vector{ + MakeSimpleOperand(1, SPV_OPERAND_TYPE_RESULT_ID), + MakeLiteralNumberOperand(2), MakeLiteralNumberOperand(3)}; + spv_parsed_instruction_t parsed_i32_inst = { + i32_inst.data(), + static_cast(i32_inst.size()), + SpvOpTypeInt, + SPV_EXT_INST_TYPE_NONE, + 0, // type id + result_id, + i32_operands.data(), + static_cast(i32_operands.size())}; + return ParsedInstruction(parsed_i32_inst); +} + +class BinaryParseTest : public spvtest::TextToBinaryTestBase<::testing::Test> { + protected: + void Parse(const SpirvVector& words, spv_result_t expected_result, + bool flip_words = false) { + SpirvVector flipped_words(words); + SCOPED_TRACE(flip_words ? "Flipped Endianness" : "Normal Endianness"); + if (flip_words) { + std::transform(flipped_words.begin(), flipped_words.end(), + flipped_words.begin(), [](const uint32_t raw_word) { + return spvFixWord(raw_word, + I32_ENDIAN_HOST == I32_ENDIAN_BIG + ? SPV_ENDIANNESS_LITTLE + : SPV_ENDIANNESS_BIG); + }); + } + EXPECT_EQ(expected_result, + spvBinaryParse(ScopedContext().context, &client_, + flipped_words.data(), flipped_words.size(), + invoke_header, invoke_instruction, &diagnostic_)); + } + + spv_diagnostic diagnostic_ = nullptr; + MockParseClient client_; +}; + +// Adds an EXPECT_CALL to client_->Header() with appropriate parameters, +// including bound. Returns the EXPECT_CALL result. +#define EXPECT_HEADER(bound) \ + EXPECT_CALL( \ + client_, \ + Header(AnyOf(SPV_ENDIANNESS_LITTLE, SPV_ENDIANNESS_BIG), SpvMagicNumber, \ + 0x10000, SPV_GENERATOR_WORD(SPV_GENERATOR_KHRONOS_ASSEMBLER, 0), \ + bound, 0 /*reserved*/)) + +static const bool kSwapEndians[] = {false, true}; + +TEST_F(BinaryParseTest, EmptyModuleHasValidHeaderAndNoInstructionCallbacks) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully(""); + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + Parse(words, SPV_SUCCESS, endian_swap); + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, NullDiagnosticsIsOkForGoodParse) { + const auto words = CompileSuccessfully(""); + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ( + SPV_SUCCESS, + spvBinaryParse(ScopedContext().context, &client_, words.data(), + words.size(), invoke_header, invoke_instruction, nullptr)); +} + +TEST_F(BinaryParseTest, NullDiagnosticsIsOkForBadParse) { + auto words = CompileSuccessfully(""); + words.push_back(0xffffffff); // Certainly invalid instruction header. + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ( + SPV_ERROR_INVALID_BINARY, + spvBinaryParse(ScopedContext().context, &client_, words.data(), + words.size(), invoke_header, invoke_instruction, nullptr)); +} + +// Make sure that we don't blow up when both the consumer and the diagnostic are +// null. +TEST_F(BinaryParseTest, NullConsumerNullDiagnosticsForBadParse) { + auto words = CompileSuccessfully(""); + + auto ctx = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + SetContextMessageConsumer(ctx, nullptr); + + words.push_back(0xffffffff); // Certainly invalid instruction header. + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryParse(ctx, &client_, words.data(), words.size(), + invoke_header, invoke_instruction, nullptr)); + + spvContextDestroy(ctx); +} + +TEST_F(BinaryParseTest, SpecifyConsumerNullDiagnosticsForGoodParse) { + const auto words = CompileSuccessfully(""); + + auto ctx = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + ctx, [&invocation](spv_message_level_t, const char*, + const spv_position_t&, const char*) { ++invocation; }); + + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ(SPV_SUCCESS, + spvBinaryParse(ctx, &client_, words.data(), words.size(), + invoke_header, invoke_instruction, nullptr)); + EXPECT_EQ(0, invocation); + + spvContextDestroy(ctx); +} + +TEST_F(BinaryParseTest, SpecifyConsumerNullDiagnosticsForBadParse) { + auto words = CompileSuccessfully(""); + + auto ctx = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + ctx, [&invocation](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + ++invocation; + EXPECT_EQ(SPV_MSG_ERROR, level); + EXPECT_STREQ("input", source); + EXPECT_EQ(0u, position.line); + EXPECT_EQ(0u, position.column); + EXPECT_EQ(5u, position.index); + EXPECT_STREQ("Invalid opcode: 65535", message); + }); + + words.push_back(0xffffffff); // Certainly invalid instruction header. + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryParse(ctx, &client_, words.data(), words.size(), + invoke_header, invoke_instruction, nullptr)); + EXPECT_EQ(1, invocation); + + spvContextDestroy(ctx); +} + +TEST_F(BinaryParseTest, SpecifyConsumerSpecifyDiagnosticsForGoodParse) { + const auto words = CompileSuccessfully(""); + + auto ctx = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + ctx, [&invocation](spv_message_level_t, const char*, + const spv_position_t&, const char*) { ++invocation; }); + + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ(SPV_SUCCESS, + spvBinaryParse(ctx, &client_, words.data(), words.size(), + invoke_header, invoke_instruction, &diagnostic_)); + EXPECT_EQ(0, invocation); + EXPECT_EQ(nullptr, diagnostic_); + + spvContextDestroy(ctx); +} + +TEST_F(BinaryParseTest, SpecifyConsumerSpecifyDiagnosticsForBadParse) { + auto words = CompileSuccessfully(""); + + auto ctx = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + ctx, [&invocation](spv_message_level_t, const char*, + const spv_position_t&, const char*) { ++invocation; }); + + words.push_back(0xffffffff); // Certainly invalid instruction header. + EXPECT_HEADER(1).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryParse(ctx, &client_, words.data(), words.size(), + invoke_header, invoke_instruction, &diagnostic_)); + EXPECT_EQ(0, invocation); + EXPECT_STREQ("Invalid opcode: 65535", diagnostic_->error); + + spvContextDestroy(ctx); +} + +TEST_F(BinaryParseTest, + ModuleWithSingleInstructionHasValidHeaderAndInstructionCallback) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully("%1 = OpTypeVoid"); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(2).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(MakeParsedVoidTypeInstruction(1))) + .WillOnce(Return(SPV_SUCCESS)); + Parse(words, SPV_SUCCESS, endian_swap); + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, NullHeaderCallbackIsIgnored) { + const auto words = CompileSuccessfully("%1 = OpTypeVoid"); + EXPECT_CALL(client_, Header(_, _, _, _, _, _)) + .Times(0); // No header callback. + EXPECT_CALL(client_, Instruction(MakeParsedVoidTypeInstruction(1))) + .WillOnce(Return(SPV_SUCCESS)); + EXPECT_EQ(SPV_SUCCESS, spvBinaryParse(ScopedContext().context, &client_, + words.data(), words.size(), nullptr, + invoke_instruction, &diagnostic_)); + EXPECT_EQ(nullptr, diagnostic_); +} + +TEST_F(BinaryParseTest, NullInstructionCallbackIsIgnored) { + const auto words = CompileSuccessfully("%1 = OpTypeVoid"); + EXPECT_HEADER((2)).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).Times(0); // No instruction callback. + EXPECT_EQ(SPV_SUCCESS, + spvBinaryParse(ScopedContext().context, &client_, words.data(), + words.size(), invoke_header, nullptr, &diagnostic_)); + EXPECT_EQ(nullptr, diagnostic_); +} + +// Check the result of multiple instruction callbacks. +// +// This test exercises non-default values for the following members of the +// spv_parsed_instruction_t struct: words, num_words, opcode, result_id, +// operands, num_operands. +TEST_F(BinaryParseTest, TwoScalarTypesGenerateTwoInstructionCallbacks) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully( + "%1 = OpTypeVoid " + "%2 = OpTypeInt 32 1"); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(3).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(MakeParsedVoidTypeInstruction(1))) + .WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(MakeParsedInt32TypeInstruction(2))) + .WillOnce(Return(SPV_SUCCESS)); + Parse(words, SPV_SUCCESS, endian_swap); + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, EarlyReturnWithZeroPassingCallbacks) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully( + "%1 = OpTypeVoid " + "%2 = OpTypeInt 32 1"); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(3).WillOnce(Return(SPV_ERROR_INVALID_BINARY)); + // Early exit means no calls to Instruction(). + EXPECT_CALL(client_, Instruction(_)).Times(0); + Parse(words, SPV_ERROR_INVALID_BINARY, endian_swap); + // On error, the binary parser doesn't generate its own diagnostics. + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, + EarlyReturnWithZeroPassingCallbacksAndSpecifiedResultCode) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully( + "%1 = OpTypeVoid " + "%2 = OpTypeInt 32 1"); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(3).WillOnce(Return(SPV_REQUESTED_TERMINATION)); + // Early exit means no calls to Instruction(). + EXPECT_CALL(client_, Instruction(_)).Times(0); + Parse(words, SPV_REQUESTED_TERMINATION, endian_swap); + // On early termination, the binary parser doesn't generate its own + // diagnostics. + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, EarlyReturnWithOnePassingCallback) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully( + "%1 = OpTypeVoid " + "%2 = OpTypeInt 32 1 " + "%3 = OpTypeFloat 32"); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(4).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(MakeParsedVoidTypeInstruction(1))) + .WillOnce(Return(SPV_REQUESTED_TERMINATION)); + Parse(words, SPV_REQUESTED_TERMINATION, endian_swap); + // On early termination, the binary parser doesn't generate its own + // diagnostics. + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, EarlyReturnWithTwoPassingCallbacks) { + for (bool endian_swap : kSwapEndians) { + const auto words = CompileSuccessfully( + "%1 = OpTypeVoid " + "%2 = OpTypeInt 32 1 " + "%3 = OpTypeFloat 32"); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(4).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(MakeParsedVoidTypeInstruction(1))) + .WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(MakeParsedInt32TypeInstruction(2))) + .WillOnce(Return(SPV_REQUESTED_TERMINATION)); + Parse(words, SPV_REQUESTED_TERMINATION, endian_swap); + // On early termination, the binary parser doesn't generate its own + // diagnostics. + EXPECT_EQ(nullptr, diagnostic_); + } +} + +TEST_F(BinaryParseTest, InstructionWithStringOperand) { + const std::string str = + "the future is already here, it's just not evenly distributed"; + const auto str_words = MakeVector(str); + const auto instruction = MakeInstruction(SpvOpName, {99}, str_words); + const auto words = Concatenate({ExpectedHeaderForBound(100), instruction}); + InSequence calls_expected_in_specific_order; + EXPECT_HEADER(100).WillOnce(Return(SPV_SUCCESS)); + const auto operands = std::vector{ + MakeSimpleOperand(1, SPV_OPERAND_TYPE_ID), + MakeLiteralStringOperand(2, static_cast(str_words.size()))}; + EXPECT_CALL(client_, + Instruction(ParsedInstruction(spv_parsed_instruction_t{ + instruction.data(), static_cast(instruction.size()), + SpvOpName, SPV_EXT_INST_TYPE_NONE, 0 /*type id*/, + 0 /* No result id for OpName*/, operands.data(), + static_cast(operands.size())}))) + .WillOnce(Return(SPV_SUCCESS)); + // Since we are actually checking the output, don't test the + // endian-swapped version. + Parse(words, SPV_SUCCESS, false); + EXPECT_EQ(nullptr, diagnostic_); +} + +// Checks for non-zero values for the result_id and ext_inst_type members +// spv_parsed_instruction_t. +TEST_F(BinaryParseTest, ExtendedInstruction) { + const auto words = CompileSuccessfully( + "%extcl = OpExtInstImport \"OpenCL.std\" " + "%result = OpExtInst %float %extcl sqrt %x"); + EXPECT_HEADER(5).WillOnce(Return(SPV_SUCCESS)); + EXPECT_CALL(client_, Instruction(_)).WillOnce(Return(SPV_SUCCESS)); + // We're only interested in the second call to Instruction(): + const auto operands = std::vector{ + MakeSimpleOperand(1, SPV_OPERAND_TYPE_TYPE_ID), + MakeSimpleOperand(2, SPV_OPERAND_TYPE_RESULT_ID), + MakeSimpleOperand(3, + SPV_OPERAND_TYPE_ID), // Extended instruction set Id + MakeSimpleOperand(4, SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER), + MakeSimpleOperand(5, SPV_OPERAND_TYPE_ID), // Id of the argument + }; + const auto instruction = MakeInstruction( + SpvOpExtInst, + {2, 3, 1, static_cast(OpenCLLIB::Entrypoints::Sqrt), 4}); + EXPECT_CALL(client_, + Instruction(ParsedInstruction(spv_parsed_instruction_t{ + instruction.data(), static_cast(instruction.size()), + SpvOpExtInst, SPV_EXT_INST_TYPE_OPENCL_STD, 2 /*type id*/, + 3 /*result id*/, operands.data(), + static_cast(operands.size())}))) + .WillOnce(Return(SPV_SUCCESS)); + // Since we are actually checking the output, don't test the + // endian-swapped version. + Parse(words, SPV_SUCCESS, false); + EXPECT_EQ(nullptr, diagnostic_); +} + +// A binary parser diagnostic test case where we provide the words array +// pointer and word count explicitly. +struct WordsAndCountDiagnosticCase { + const uint32_t* words; + size_t num_words; + std::string expected_diagnostic; +}; + +using BinaryParseWordsAndCountDiagnosticTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(BinaryParseWordsAndCountDiagnosticTest, WordAndCountCases) { + EXPECT_EQ( + SPV_ERROR_INVALID_BINARY, + spvBinaryParse(ScopedContext().context, nullptr, GetParam().words, + GetParam().num_words, nullptr, nullptr, &diagnostic)); + ASSERT_NE(nullptr, diagnostic); + EXPECT_THAT(diagnostic->error, Eq(GetParam().expected_diagnostic)); +} + +INSTANTIATE_TEST_CASE_P( + BinaryParseDiagnostic, BinaryParseWordsAndCountDiagnosticTest, + ::testing::ValuesIn(std::vector{ + {nullptr, 0, "Missing module."}, + {kHeaderForBound1, 0, + "Module has incomplete header: only 0 words instead of 5"}, + {kHeaderForBound1, 1, + "Module has incomplete header: only 1 words instead of 5"}, + {kHeaderForBound1, 2, + "Module has incomplete header: only 2 words instead of 5"}, + {kHeaderForBound1, 3, + "Module has incomplete header: only 3 words instead of 5"}, + {kHeaderForBound1, 4, + "Module has incomplete header: only 4 words instead of 5"}, + }), ); + +// A binary parser diagnostic test case where a vector of words is +// provided. We'll use this to express cases that can't be created +// via the assembler. Either we want to make a malformed instruction, +// or an invalid case the assembler would reject. +struct WordVectorDiagnosticCase { + std::vector words; + std::string expected_diagnostic; +}; + +using BinaryParseWordVectorDiagnosticTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(BinaryParseWordVectorDiagnosticTest, WordVectorCases) { + const auto& words = GetParam().words; + EXPECT_THAT(spvBinaryParse(ScopedContext().context, nullptr, words.data(), + words.size(), nullptr, nullptr, &diagnostic), + AnyOf(SPV_ERROR_INVALID_BINARY, SPV_ERROR_INVALID_ID)); + ASSERT_NE(nullptr, diagnostic); + EXPECT_THAT(diagnostic->error, Eq(GetParam().expected_diagnostic)); +} + +INSTANTIATE_TEST_CASE_P( + BinaryParseDiagnostic, BinaryParseWordVectorDiagnosticTest, + ::testing::ValuesIn(std::vector{ + {Concatenate({ExpectedHeaderForBound(1), {spvOpcodeMake(0, SpvOpNop)}}), + "Invalid instruction word count: 0"}, + {Concatenate( + {ExpectedHeaderForBound(1), + {spvOpcodeMake(1, static_cast( + std::numeric_limits::max()))}}), + "Invalid opcode: 65535"}, + {Concatenate({ExpectedHeaderForBound(1), + MakeInstruction(SpvOpNop, {42})}), + "Invalid instruction OpNop starting at word 5: expected " + "no more operands after 1 words, but stated word count is 2."}, + // Supply several more unexpectd words. + {Concatenate({ExpectedHeaderForBound(1), + MakeInstruction(SpvOpNop, {42, 43, 44, 45, 46, 47})}), + "Invalid instruction OpNop starting at word 5: expected " + "no more operands after 1 words, but stated word count is 7."}, + {Concatenate({ExpectedHeaderForBound(1), + MakeInstruction(SpvOpTypeVoid, {1, 2})}), + "Invalid instruction OpTypeVoid starting at word 5: expected " + "no more operands after 2 words, but stated word count is 3."}, + {Concatenate({ExpectedHeaderForBound(1), + MakeInstruction(SpvOpTypeVoid, {1, 2, 5, 9, 10})}), + "Invalid instruction OpTypeVoid starting at word 5: expected " + "no more operands after 2 words, but stated word count is 6."}, + {Concatenate({ExpectedHeaderForBound(1), + MakeInstruction(SpvOpTypeInt, {1, 32, 1, 9})}), + "Invalid instruction OpTypeInt starting at word 5: expected " + "no more operands after 4 words, but stated word count is 5."}, + {Concatenate({ExpectedHeaderForBound(1), + MakeInstruction(SpvOpTypeInt, {1})}), + "End of input reached while decoding OpTypeInt starting at word 5:" + " expected more operands after 2 words."}, + + // Check several cases for running off the end of input. + + // Detect a missing single word operand. + {Concatenate({ExpectedHeaderForBound(1), + {spvOpcodeMake(2, SpvOpTypeStruct)}}), + "End of input reached while decoding OpTypeStruct starting at word" + " 5: missing result ID operand at word offset 1."}, + // Detect this a missing a multi-word operand to OpConstant. + // We also lie and say the OpConstant instruction has 5 words when + // it only has 3. Corresponds to something like this: + // %1 = OpTypeInt 64 0 + // %2 = OpConstant %1 + {Concatenate({ExpectedHeaderForBound(3), + {MakeInstruction(SpvOpTypeInt, {1, 64, 0})}, + {spvOpcodeMake(5, SpvOpConstant), 1, 2}}), + "End of input reached while decoding OpConstant starting at word" + " 9: missing possibly multi-word literal number operand at word " + "offset 3."}, + // Detect when we provide only one word from the 64-bit literal, + // and again lie about the number of words in the instruction. + {Concatenate({ExpectedHeaderForBound(3), + {MakeInstruction(SpvOpTypeInt, {1, 64, 0})}, + {spvOpcodeMake(5, SpvOpConstant), 1, 2, 42}}), + "End of input reached while decoding OpConstant starting at word" + " 9: truncated possibly multi-word literal number operand at word " + "offset 3."}, + // Detect when a required string operand is missing. + // Also, lie about the length of the instruction. + {Concatenate({ExpectedHeaderForBound(3), + {spvOpcodeMake(3, SpvOpString), 1}}), + "End of input reached while decoding OpString starting at word" + " 5: missing literal string operand at word offset 2."}, + // Detect when a required string operand is truncated: it's missing + // a null terminator. Catching the error avoids a buffer overrun. + {Concatenate({ExpectedHeaderForBound(3), + {spvOpcodeMake(4, SpvOpString), 1, 0x41414141, + 0x41414141}}), + "End of input reached while decoding OpString starting at word" + " 5: truncated literal string operand at word offset 2."}, + // Detect when an optional string operand is truncated: it's missing + // a null terminator. Catching the error avoids a buffer overrun. + // (It is valid for an optional string operand to be absent.) + {Concatenate({ExpectedHeaderForBound(3), + {spvOpcodeMake(6, SpvOpSource), + static_cast(SpvSourceLanguageOpenCL_C), 210, + 1 /* file id */, + /*start of string*/ 0x41414141, 0x41414141}}), + "End of input reached while decoding OpSource starting at word" + " 5: truncated literal string operand at word offset 4."}, + + // (End of input exhaustion test cases.) + + // In this case the instruction word count is too small, where + // it would truncate a multi-word operand to OpConstant. + {Concatenate({ExpectedHeaderForBound(3), + {MakeInstruction(SpvOpTypeInt, {1, 64, 0})}, + {spvOpcodeMake(4, SpvOpConstant), 1, 2, 44, 44}}), + "Invalid word count: OpConstant starting at word 9 says it has 4" + " words, but found 5 words instead."}, + // Word count is to small, where it would truncate a literal string. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(3, SpvOpString), 1, 0x41414141, 0}}), + "Invalid word count: OpString starting at word 5 says it has 3" + " words, but found 4 words instead."}, + // Word count is too large. The string terminates before the last + // word. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(4, SpvOpString), 1 /* result id */}, + MakeVector("abc"), + {0 /* this word does not belong*/}}), + "Invalid instruction OpString starting at word 5: expected no more" + " operands after 3 words, but stated word count is 4."}, + // Word count is too large. There are too many words after the string + // literal. A linkage attribute decoration is the only case in SPIR-V + // where a string operand is followed by another operand. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(6, SpvOpDecorate), 1 /* target id */, + static_cast(SpvDecorationLinkageAttributes)}, + MakeVector("abc"), + {static_cast(SpvLinkageTypeImport), + 0 /* does not belong */}}), + "Invalid instruction OpDecorate starting at word 5: expected no more" + " operands after 5 words, but stated word count is 6."}, + // Like the previous case, but with 5 extra words. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(10, SpvOpDecorate), 1 /* target id */, + static_cast(SpvDecorationLinkageAttributes)}, + MakeVector("abc"), + {static_cast(SpvLinkageTypeImport), + /* don't belong */ 0, 1, 2, 3, 4}}), + "Invalid instruction OpDecorate starting at word 5: expected no more" + " operands after 5 words, but stated word count is 10."}, + // Like the previous two cases, but with OpMemberDecorate. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(7, SpvOpMemberDecorate), 1 /* target id */, + 42 /* member index */, + static_cast(SpvDecorationLinkageAttributes)}, + MakeVector("abc"), + {static_cast(SpvLinkageTypeImport), + 0 /* does not belong */}}), + "Invalid instruction OpMemberDecorate starting at word 5: expected no" + " more operands after 6 words, but stated word count is 7."}, + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(11, SpvOpMemberDecorate), + 1 /* target id */, 42 /* member index */, + static_cast(SpvDecorationLinkageAttributes)}, + MakeVector("abc"), + {static_cast(SpvLinkageTypeImport), + /* don't belong */ 0, 1, 2, 3, 4}}), + "Invalid instruction OpMemberDecorate starting at word 5: expected no" + " more operands after 6 words, but stated word count is 11."}, + // Word count is too large. There should be no more words + // after the RelaxedPrecision decoration. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(4, SpvOpDecorate), 1 /* target id */, + static_cast(SpvDecorationRelaxedPrecision), + 0 /* does not belong */}}), + "Invalid instruction OpDecorate starting at word 5: expected no" + " more operands after 3 words, but stated word count is 4."}, + // Word count is too large. There should be only one word after + // the SpecId decoration enum word. + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(5, SpvOpDecorate), 1 /* target id */, + static_cast(SpvDecorationSpecId), + 42 /* the spec id */, 0 /* does not belong */}}), + "Invalid instruction OpDecorate starting at word 5: expected no" + " more operands after 4 words, but stated word count is 5."}, + {Concatenate({ExpectedHeaderForBound(2), + {spvOpcodeMake(2, SpvOpTypeVoid), 0}}), + "Error: Result Id is 0"}, + {Concatenate({ + ExpectedHeaderForBound(2), + {spvOpcodeMake(2, SpvOpTypeVoid), 1}, + {spvOpcodeMake(2, SpvOpTypeBool), 1}, + }), + "Id 1 is defined more than once"}, + {Concatenate({ExpectedHeaderForBound(3), + MakeInstruction(SpvOpExtInst, {2, 3, 100, 4, 5})}), + "OpExtInst set Id 100 does not reference an OpExtInstImport result " + "Id"}, + {Concatenate({ExpectedHeaderForBound(101), + MakeInstruction(SpvOpExtInstImport, {100}, + MakeVector("OpenCL.std")), + // OpenCL cos is #14 + MakeInstruction(SpvOpExtInst, {2, 3, 100, 14, 5, 999})}), + "Invalid instruction OpExtInst starting at word 10: expected no " + "more operands after 6 words, but stated word count is 7."}, + // In this case, the OpSwitch selector refers to an invalid ID. + {Concatenate({ExpectedHeaderForBound(3), + MakeInstruction(SpvOpSwitch, {1, 2, 42, 3})}), + "Invalid OpSwitch: selector id 1 has no type"}, + // In this case, the OpSwitch selector refers to an ID that has + // no type. + {Concatenate({ExpectedHeaderForBound(3), + MakeInstruction(SpvOpLabel, {1}), + MakeInstruction(SpvOpSwitch, {1, 2, 42, 3})}), + "Invalid OpSwitch: selector id 1 has no type"}, + {Concatenate({ExpectedHeaderForBound(3), + MakeInstruction(SpvOpTypeInt, {1, 32, 0}), + MakeInstruction(SpvOpSwitch, {1, 3, 42, 3})}), + "Invalid OpSwitch: selector id 1 is a type, not a value"}, + {Concatenate({ExpectedHeaderForBound(3), + MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0x78f00000}), + MakeInstruction(SpvOpSwitch, {2, 3, 42, 3})}), + "Invalid OpSwitch: selector id 2 is not a scalar integer"}, + {Concatenate({ExpectedHeaderForBound(3), + MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("invalid-import"))}), + "Invalid extended instruction import 'invalid-import'"}, + {Concatenate({ + ExpectedHeaderForBound(3), + MakeInstruction(SpvOpTypeInt, {1, 32, 0}), + MakeInstruction(SpvOpConstant, {2, 2, 42}), + }), + "Type Id 2 is not a type"}, + {Concatenate({ + ExpectedHeaderForBound(3), + MakeInstruction(SpvOpTypeBool, {1}), + MakeInstruction(SpvOpConstant, {1, 2, 42}), + }), + "Type Id 1 is not a scalar numeric type"}, + }), ); + +// A binary parser diagnostic case generated from an assembly text input. +struct AssemblyDiagnosticCase { + std::string assembly; + std::string expected_diagnostic; +}; + +using BinaryParseAssemblyDiagnosticTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(BinaryParseAssemblyDiagnosticTest, AssemblyCases) { + auto words = CompileSuccessfully(GetParam().assembly); + EXPECT_THAT(spvBinaryParse(ScopedContext().context, nullptr, words.data(), + words.size(), nullptr, nullptr, &diagnostic), + AnyOf(SPV_ERROR_INVALID_BINARY, SPV_ERROR_INVALID_ID)); + ASSERT_NE(nullptr, diagnostic); + EXPECT_THAT(diagnostic->error, Eq(GetParam().expected_diagnostic)); +} + +INSTANTIATE_TEST_CASE_P( + BinaryParseDiagnostic, BinaryParseAssemblyDiagnosticTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpConstant !0 42", "Error: Type Id is 0"}, + // A required id is 0. + {"OpName !0 \"foo\"", "Id is 0"}, + // An optional id is 0, in this case the optional + // initializer. + {"%2 = OpVariable %1 CrossWorkgroup !0", "Id is 0"}, + {"OpControlBarrier !0 %1 %2", "scope ID is 0"}, + {"OpControlBarrier %1 !0 %2", "scope ID is 0"}, + {"OpControlBarrier %1 %2 !0", "memory semantics ID is 0"}, + {"%import = OpExtInstImport \"GLSL.std.450\" " + "%result = OpExtInst %type %import !999999 %x", + "Invalid extended instruction number: 999999"}, + {"%2 = OpSpecConstantOp %1 !1000 %2", + "Invalid OpSpecConstantOp opcode: 1000"}, + {"OpCapability !9999", "Invalid capability operand: 9999"}, + {"OpSource !9999 100", "Invalid source language operand: 9999"}, + {"OpEntryPoint !9999", "Invalid execution model operand: 9999"}, + {"OpMemoryModel !9999", "Invalid addressing model operand: 9999"}, + {"OpMemoryModel Logical !9999", "Invalid memory model operand: 9999"}, + {"OpExecutionMode %1 !9999", "Invalid execution mode operand: 9999"}, + {"OpTypeForwardPointer %1 !9999", + "Invalid storage class operand: 9999"}, + {"%2 = OpTypeImage %1 !9999", "Invalid dimensionality operand: 9999"}, + {"%2 = OpTypeImage %1 1D 0 0 0 0 !9999", + "Invalid image format operand: 9999"}, + {"OpDecorate %1 FPRoundingMode !9999", + "Invalid floating-point rounding mode operand: 9999"}, + {"OpDecorate %1 LinkageAttributes \"C\" !9999", + "Invalid linkage type operand: 9999"}, + {"%1 = OpTypePipe !9999", "Invalid access qualifier operand: 9999"}, + {"OpDecorate %1 FuncParamAttr !9999", + "Invalid function parameter attribute operand: 9999"}, + {"OpDecorate %1 !9999", "Invalid decoration operand: 9999"}, + {"OpDecorate %1 BuiltIn !9999", "Invalid built-in operand: 9999"}, + {"%2 = OpGroupIAdd %1 %3 !9999", + "Invalid group operation operand: 9999"}, + {"OpDecorate %1 FPFastMathMode !63", + "Invalid floating-point fast math mode operand: 63 has invalid mask " + "component 32"}, + {"%2 = OpFunction %2 !31", + "Invalid function control operand: 31 has invalid mask component 16"}, + {"OpLoopMerge %1 %2 !1027", + "Invalid loop control operand: 1027 has invalid mask component 1024"}, + {"%2 = OpImageFetch %1 %image %coord !511", + "Invalid image operand: 511 has invalid mask component 256"}, + {"OpSelectionMerge %1 !7", + "Invalid selection control operand: 7 has invalid mask component 4"}, + }), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_strnlen_s_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_strnlen_s_test.cpp new file mode 100644 index 00000000000..5f43bde6782 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_strnlen_s_test.cpp @@ -0,0 +1,32 @@ +// Copyright (c) 2016 Google 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +TEST(Strnlen, Samples) { + EXPECT_EQ(0u, spv_strnlen_s(nullptr, 0)); + EXPECT_EQ(0u, spv_strnlen_s(nullptr, 5)); + EXPECT_EQ(0u, spv_strnlen_s("abc", 0)); + EXPECT_EQ(1u, spv_strnlen_s("abc", 1)); + EXPECT_EQ(3u, spv_strnlen_s("abc", 3)); + EXPECT_EQ(3u, spv_strnlen_s("abc\0", 5)); + EXPECT_EQ(0u, spv_strnlen_s("\0", 5)); + EXPECT_EQ(1u, spv_strnlen_s("a\0c", 5)); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp new file mode 100644 index 00000000000..bcfb0f016da --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp @@ -0,0 +1,76 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::testing::Eq; +using RoundTripLiteralsTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(RoundTripLiteralsTest, Sample) { + EXPECT_THAT(EncodeAndDecodeSuccessfully(GetParam()), Eq(GetParam())); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + StringLiterals, RoundTripLiteralsTest, + ::testing::ValuesIn(std::vector{ + "OpName %1 \"\"\n", // empty + "OpName %1 \"foo\"\n", // normal + "OpName %1 \"foo bar\"\n", // string with spaces + "OpName %1 \"foo\tbar\"\n", // string with tab + "OpName %1 \"\tfoo\"\n", // starts with tab + "OpName %1 \" foo\"\n", // starts with space + "OpName %1 \"foo \"\n", // ends with space + "OpName %1 \"foo\t\"\n", // ends with tab + "OpName %1 \"foo\nbar\"\n", // contains newline + "OpName %1 \"\nfoo\nbar\"\n", // starts with newline + "OpName %1 \"\n\n\nfoo\nbar\"\n", // multiple newlines + "OpName %1 \"\\\"foo\nbar\\\"\"\n", // escaped quote + "OpName %1 \"\\\\foo\nbar\\\\\"\n", // escaped backslash + "OpName %1 \"\xE4\xBA\xB2\"\n", // UTF-8 + }),); +// clang-format on + +using RoundTripSpecialCaseLiteralsTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +// Test case where the generated disassembly is not the same as the +// assembly passed in. +TEST_P(RoundTripSpecialCaseLiteralsTest, Sample) { + EXPECT_THAT(EncodeAndDecodeSuccessfully(std::get<0>(GetParam())), + Eq(std::get<1>(GetParam()))); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + StringLiterals, RoundTripSpecialCaseLiteralsTest, + ::testing::ValuesIn(std::vector>{ + {"OpName %1 \"\\foo\"\n", "OpName %1 \"foo\"\n"}, // Escape f + {"OpName %1 \"\\\nfoo\"\n", "OpName %1 \"\nfoo\"\n"}, // Escape newline + {"OpName %1 \"\\\xE4\xBA\xB2\"\n", "OpName %1 \"\xE4\xBA\xB2\"\n"}, // Escape utf-8 + }),); +// clang-format on + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_to_text_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_to_text_test.cpp new file mode 100644 index 00000000000..016041f4925 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/binary_to_text_test.cpp @@ -0,0 +1,554 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/spirv_constant.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::AutoText; +using spvtest::ScopedContext; +using spvtest::TextToBinaryTest; +using ::testing::Combine; +using ::testing::Eq; +using ::testing::HasSubstr; + +class BinaryToText : public ::testing::Test { + public: + BinaryToText() : context(spvContextCreate(SPV_ENV_UNIVERSAL_1_0)) {} + ~BinaryToText() { spvContextDestroy(context); } + + virtual void SetUp() { + const char* textStr = R"( + OpSource OpenCL_C 12 + OpMemoryModel Physical64 OpenCL + OpSourceExtension "PlaceholderExtensionName" + OpEntryPoint Kernel %1 "foo" + OpExecutionMode %1 LocalSizeHint 1 1 1 + %2 = OpTypeVoid + %3 = OpTypeBool + %4 = OpTypeInt 8 0 + %5 = OpTypeInt 8 1 + %6 = OpTypeInt 16 0 + %7 = OpTypeInt 16 1 + %8 = OpTypeInt 32 0 + %9 = OpTypeInt 32 1 +%10 = OpTypeInt 64 0 +%11 = OpTypeInt 64 1 +%12 = OpTypeFloat 16 +%13 = OpTypeFloat 32 +%14 = OpTypeFloat 64 +%15 = OpTypeVector %4 2 +)"; + spv_text_t text = {textStr, strlen(textStr)}; + spv_diagnostic diagnostic = nullptr; + spv_result_t error = + spvTextToBinary(context, text.str, text.length, &binary, &diagnostic); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + ASSERT_EQ(SPV_SUCCESS, error); + } + } + + virtual void TearDown() { spvBinaryDestroy(binary); } + + // Compiles the given assembly text, and saves it into 'binary'. + void CompileSuccessfully(std::string text) { + spv_diagnostic diagnostic = nullptr; + EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(context, text.c_str(), text.size(), + &binary, &diagnostic)); + } + + spv_context context; + spv_binary binary; +}; + +TEST_F(BinaryToText, Default) { + spv_text text = nullptr; + spv_diagnostic diagnostic = nullptr; + ASSERT_EQ( + SPV_SUCCESS, + spvBinaryToText(context, binary->code, binary->wordCount, + SPV_BINARY_TO_TEXT_OPTION_NONE, &text, &diagnostic)); + printf("%s", text->str); + spvTextDestroy(text); +} + +TEST_F(BinaryToText, MissingModule) { + spv_text text; + spv_diagnostic diagnostic = nullptr; + EXPECT_EQ( + SPV_ERROR_INVALID_BINARY, + spvBinaryToText(context, nullptr, 42, SPV_BINARY_TO_TEXT_OPTION_NONE, + &text, &diagnostic)); + EXPECT_THAT(diagnostic->error, Eq(std::string("Missing module."))); + if (diagnostic) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + } +} + +TEST_F(BinaryToText, TruncatedModule) { + // Make a valid module with zero instructions. + CompileSuccessfully(""); + EXPECT_EQ(SPV_INDEX_INSTRUCTION, binary->wordCount); + + for (size_t length = 0; length < SPV_INDEX_INSTRUCTION; length++) { + spv_text text = nullptr; + spv_diagnostic diagnostic = nullptr; + EXPECT_EQ( + SPV_ERROR_INVALID_BINARY, + spvBinaryToText(context, binary->code, length, + SPV_BINARY_TO_TEXT_OPTION_NONE, &text, &diagnostic)); + ASSERT_NE(nullptr, diagnostic); + std::stringstream expected; + expected << "Module has incomplete header: only " << length + << " words instead of " << SPV_INDEX_INSTRUCTION; + EXPECT_THAT(diagnostic->error, Eq(expected.str())); + spvDiagnosticDestroy(diagnostic); + } +} + +TEST_F(BinaryToText, InvalidMagicNumber) { + CompileSuccessfully(""); + std::vector damaged_binary(binary->code, + binary->code + binary->wordCount); + damaged_binary[SPV_INDEX_MAGIC_NUMBER] ^= 123; + + spv_diagnostic diagnostic = nullptr; + spv_text text; + EXPECT_EQ( + SPV_ERROR_INVALID_BINARY, + spvBinaryToText(context, damaged_binary.data(), damaged_binary.size(), + SPV_BINARY_TO_TEXT_OPTION_NONE, &text, &diagnostic)); + ASSERT_NE(nullptr, diagnostic); + std::stringstream expected; + expected << "Invalid SPIR-V magic number '" << std::hex + << damaged_binary[SPV_INDEX_MAGIC_NUMBER] << "'."; + EXPECT_THAT(diagnostic->error, Eq(expected.str())); + spvDiagnosticDestroy(diagnostic); +} + +struct FailedDecodeCase { + std::string source_text; + std::vector appended_instruction; + std::string expected_error_message; +}; + +using BinaryToTextFail = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(BinaryToTextFail, EncodeSuccessfullyDecodeFailed) { + EXPECT_THAT(EncodeSuccessfullyDecodeFailed(GetParam().source_text, + GetParam().appended_instruction), + Eq(GetParam().expected_error_message)); +} + +INSTANTIATE_TEST_CASE_P( + InvalidIds, BinaryToTextFail, + ::testing::ValuesIn(std::vector{ + {"", spvtest::MakeInstruction(SpvOpTypeVoid, {0}), + "Error: Result Id is 0"}, + {"", spvtest::MakeInstruction(SpvOpConstant, {0, 1, 42}), + "Error: Type Id is 0"}, + {"%1 = OpTypeVoid", spvtest::MakeInstruction(SpvOpTypeVoid, {1}), + "Id 1 is defined more than once"}, + {"%1 = OpTypeVoid\n" + "%2 = OpNot %1 %foo", + spvtest::MakeInstruction(SpvOpNot, {1, 2, 3}), + "Id 2 is defined more than once"}, + {"%1 = OpTypeVoid\n" + "%2 = OpNot %1 %foo", + spvtest::MakeInstruction(SpvOpNot, {1, 1, 3}), + "Id 1 is defined more than once"}, + // The following are the two failure cases for + // Parser::setNumericTypeInfoForType. + {"", spvtest::MakeInstruction(SpvOpConstant, {500, 1, 42}), + "Type Id 500 is not a type"}, + {"%1 = OpTypeInt 32 0\n" + "%2 = OpTypeVector %1 4", + spvtest::MakeInstruction(SpvOpConstant, {2, 3, 999}), + "Type Id 2 is not a scalar numeric type"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + InvalidIdsCheckedDuringLiteralCaseParsing, BinaryToTextFail, + ::testing::ValuesIn(std::vector{ + {"", spvtest::MakeInstruction(SpvOpSwitch, {1, 2, 3, 4}), + "Invalid OpSwitch: selector id 1 has no type"}, + {"%1 = OpTypeVoid\n", + spvtest::MakeInstruction(SpvOpSwitch, {1, 2, 3, 4}), + "Invalid OpSwitch: selector id 1 is a type, not a value"}, + {"%1 = OpConstantTrue !500", + spvtest::MakeInstruction(SpvOpSwitch, {1, 2, 3, 4}), + "Type Id 500 is not a type"}, + {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 1.5", + spvtest::MakeInstruction(SpvOpSwitch, {2, 3, 4, 5}), + "Invalid OpSwitch: selector id 2 is not a scalar integer"}, + }), ); + +TEST_F(TextToBinaryTest, OneInstruction) { + const std::string input = "OpSource OpenCL_C 12\n"; + EXPECT_EQ(input, EncodeAndDecodeSuccessfully(input)); +} + +// Exercise the case where an operand itself has operands. +// This could detect problems in updating the expected-set-of-operands +// list. +TEST_F(TextToBinaryTest, OperandWithOperands) { + const std::string input = R"(OpEntryPoint Kernel %1 "foo" +OpExecutionMode %1 LocalSizeHint 100 200 300 +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%1 = OpFunction %1 None %3 +)"; + EXPECT_EQ(input, EncodeAndDecodeSuccessfully(input)); +} + +using RoundTripInstructionsTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(RoundTripInstructionsTest, Sample) { + EXPECT_THAT(EncodeAndDecodeSuccessfully(std::get<1>(GetParam()), + SPV_BINARY_TO_TEXT_OPTION_NONE, + std::get<0>(GetParam())), + Eq(std::get<1>(GetParam()))); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + NumericLiterals, RoundTripInstructionsTest, + // This test is independent of environment, so just test the one. + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "%1 = OpTypeInt 12 0\n%2 = OpConstant %1 1867\n", + "%1 = OpTypeInt 12 1\n%2 = OpConstant %1 1867\n", + "%1 = OpTypeInt 12 1\n%2 = OpConstant %1 -1867\n", + "%1 = OpTypeInt 32 0\n%2 = OpConstant %1 1867\n", + "%1 = OpTypeInt 32 1\n%2 = OpConstant %1 1867\n", + "%1 = OpTypeInt 32 1\n%2 = OpConstant %1 -1867\n", + "%1 = OpTypeInt 64 0\n%2 = OpConstant %1 18446744073709551615\n", + "%1 = OpTypeInt 64 1\n%2 = OpConstant %1 9223372036854775807\n", + "%1 = OpTypeInt 64 1\n%2 = OpConstant %1 -9223372036854775808\n", + // 16-bit floats print as hex floats. + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.ff4p+16\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.d2cp-10\n", + // 32-bit floats + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -3.125\n", + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.8p+128\n", // NaN + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.0002p+128\n", // NaN + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1p+128\n", // Inf + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1p+128\n", // -Inf + // 64-bit floats + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -3.125\n", + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.ffffffffffffap-1023\n", // small normal + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.ffffffffffffap-1023\n", + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.8p+1024\n", // NaN + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.0002p+1024\n", // NaN + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1p+1024\n", // Inf + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1p+1024\n", // -Inf + })), ); +// clang-format on + +INSTANTIATE_TEST_CASE_P( + MemoryAccessMasks, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "OpStore %1 %2\n", // 3 words long. + "OpStore %1 %2 None\n", // 4 words long, explicit final 0. + "OpStore %1 %2 Volatile\n", + "OpStore %1 %2 Aligned 8\n", + "OpStore %1 %2 Nontemporal\n", + // Combinations show the names from LSB to MSB + "OpStore %1 %2 Volatile|Aligned 16\n", + "OpStore %1 %2 Volatile|Nontemporal\n", + "OpStore %1 %2 Volatile|Aligned|Nontemporal 32\n", + })), ); + +INSTANTIATE_TEST_CASE_P( + FPFastMathModeMasks, RoundTripInstructionsTest, + Combine( + ::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "OpDecorate %1 FPFastMathMode None\n", + "OpDecorate %1 FPFastMathMode NotNaN\n", + "OpDecorate %1 FPFastMathMode NotInf\n", + "OpDecorate %1 FPFastMathMode NSZ\n", + "OpDecorate %1 FPFastMathMode AllowRecip\n", + "OpDecorate %1 FPFastMathMode Fast\n", + // Combinations show the names from LSB to MSB + "OpDecorate %1 FPFastMathMode NotNaN|NotInf\n", + "OpDecorate %1 FPFastMathMode NSZ|AllowRecip\n", + "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|Fast\n", + })), ); + +INSTANTIATE_TEST_CASE_P( + LoopControlMasks, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_2), + ::testing::ValuesIn(std::vector{ + "OpLoopMerge %1 %2 None\n", + "OpLoopMerge %1 %2 Unroll\n", + "OpLoopMerge %1 %2 DontUnroll\n", + "OpLoopMerge %1 %2 Unroll|DontUnroll\n", + })), ); + +INSTANTIATE_TEST_CASE_P(LoopControlMasksV11, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, + SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "OpLoopMerge %1 %2 DependencyInfinite\n", + "OpLoopMerge %1 %2 DependencyLength 8\n", + })), ); + +INSTANTIATE_TEST_CASE_P( + SelectionControlMasks, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_2), + ::testing::ValuesIn(std::vector{ + "OpSelectionMerge %1 None\n", + "OpSelectionMerge %1 Flatten\n", + "OpSelectionMerge %1 DontFlatten\n", + "OpSelectionMerge %1 Flatten|DontFlatten\n", + })), ); + +INSTANTIATE_TEST_CASE_P( + FunctionControlMasks, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "%2 = OpFunction %1 None %3\n", + "%2 = OpFunction %1 Inline %3\n", + "%2 = OpFunction %1 DontInline %3\n", + "%2 = OpFunction %1 Pure %3\n", + "%2 = OpFunction %1 Const %3\n", + "%2 = OpFunction %1 Inline|Pure|Const %3\n", + "%2 = OpFunction %1 DontInline|Const %3\n", + })), ); + +INSTANTIATE_TEST_CASE_P( + ImageMasks, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "%2 = OpImageFetch %1 %3 %4\n", + "%2 = OpImageFetch %1 %3 %4 None\n", + "%2 = OpImageFetch %1 %3 %4 Bias %5\n", + "%2 = OpImageFetch %1 %3 %4 Lod %5\n", + "%2 = OpImageFetch %1 %3 %4 Grad %5 %6\n", + "%2 = OpImageFetch %1 %3 %4 ConstOffset %5\n", + "%2 = OpImageFetch %1 %3 %4 Offset %5\n", + "%2 = OpImageFetch %1 %3 %4 ConstOffsets %5\n", + "%2 = OpImageFetch %1 %3 %4 Sample %5\n", + "%2 = OpImageFetch %1 %3 %4 MinLod %5\n", + "%2 = OpImageFetch %1 %3 %4 Bias|Lod|Grad %5 %6 %7 %8\n", + "%2 = OpImageFetch %1 %3 %4 ConstOffset|Offset|ConstOffsets" + " %5 %6 %7\n", + "%2 = OpImageFetch %1 %3 %4 Sample|MinLod %5 %6\n", + "%2 = OpImageFetch %1 %3 %4" + " Bias|Lod|Grad|ConstOffset|Offset|ConstOffsets|Sample|MinLod" + " %5 %6 %7 %8 %9 %10 %11 %12 %13\n"})), ); + +INSTANTIATE_TEST_CASE_P( + NewInstructionsInSPIRV1_2, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "OpExecutionModeId %1 SubgroupsPerWorkgroupId %2\n", + "OpExecutionModeId %1 LocalSizeId %2 %3 %4\n", + "OpExecutionModeId %1 LocalSizeHintId %2\n", + "OpDecorateId %1 AlignmentId %2\n", + "OpDecorateId %1 MaxByteOffsetId %2\n", + })), ); + +using MaskSorting = TextToBinaryTest; + +TEST_F(MaskSorting, MasksAreSortedFromLSBToMSB) { + EXPECT_THAT(EncodeAndDecodeSuccessfully( + "OpStore %1 %2 Nontemporal|Aligned|Volatile 32"), + Eq("OpStore %1 %2 Volatile|Aligned|Nontemporal 32\n")); + EXPECT_THAT( + EncodeAndDecodeSuccessfully( + "OpDecorate %1 FPFastMathMode NotInf|Fast|AllowRecip|NotNaN|NSZ"), + Eq("OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|Fast\n")); + EXPECT_THAT( + EncodeAndDecodeSuccessfully("OpLoopMerge %1 %2 DontUnroll|Unroll"), + Eq("OpLoopMerge %1 %2 Unroll|DontUnroll\n")); + EXPECT_THAT( + EncodeAndDecodeSuccessfully("OpSelectionMerge %1 DontFlatten|Flatten"), + Eq("OpSelectionMerge %1 Flatten|DontFlatten\n")); + EXPECT_THAT(EncodeAndDecodeSuccessfully( + "%2 = OpFunction %1 DontInline|Const|Pure|Inline %3"), + Eq("%2 = OpFunction %1 Inline|DontInline|Pure|Const %3\n")); + EXPECT_THAT(EncodeAndDecodeSuccessfully( + "%2 = OpImageFetch %1 %3 %4" + " MinLod|Sample|Offset|Lod|Grad|ConstOffsets|ConstOffset|Bias" + " %5 %6 %7 %8 %9 %10 %11 %12 %13\n"), + Eq("%2 = OpImageFetch %1 %3 %4" + " Bias|Lod|Grad|ConstOffset|Offset|ConstOffsets|Sample|MinLod" + " %5 %6 %7 %8 %9 %10 %11 %12 %13\n")); +} + +using OperandTypeTest = TextToBinaryTest; + +TEST_F(OperandTypeTest, OptionalTypedLiteralNumber) { + const std::string input = + "%1 = OpTypeInt 32 0\n" + "%2 = OpConstant %1 42\n" + "OpSwitch %2 %3 100 %4\n"; + EXPECT_EQ(input, EncodeAndDecodeSuccessfully(input)); +} + +using IndentTest = spvtest::TextToBinaryTest; + +TEST_F(IndentTest, Sample) { + const std::string input = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 %3 %4 %5 %6 %7 %8 %9 %10 ; force IDs into double digits +%11 = OpConstant %1 42 +OpStore %2 %3 Aligned|Volatile 4 ; bogus, but not indented +)"; + const std::string expected = + R"( OpCapability Shader + OpMemoryModel Logical GLSL450 + %1 = OpTypeInt 32 0 + %2 = OpTypeStruct %1 %3 %4 %5 %6 %7 %8 %9 %10 + %11 = OpConstant %1 42 + OpStore %2 %3 Volatile|Aligned 4 +)"; + EXPECT_THAT( + EncodeAndDecodeSuccessfully(input, SPV_BINARY_TO_TEXT_OPTION_INDENT), + expected); +} + +using FriendlyNameDisassemblyTest = spvtest::TextToBinaryTest; + +TEST_F(FriendlyNameDisassemblyTest, Sample) { + const std::string input = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 %3 %4 %5 %6 %7 %8 %9 %10 ; force IDs into double digits +%11 = OpConstant %1 42 +)"; + const std::string expected = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +%uint = OpTypeInt 32 0 +%_struct_2 = OpTypeStruct %uint %3 %4 %5 %6 %7 %8 %9 %10 +%uint_42 = OpConstant %uint 42 +)"; + EXPECT_THAT(EncodeAndDecodeSuccessfully( + input, SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES), + expected); +} + +TEST_F(TextToBinaryTest, ShowByteOffsetsWhenRequested) { + const std::string input = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeVoid +)"; + const std::string expected = + R"(OpCapability Shader ; 0x00000014 +OpMemoryModel Logical GLSL450 ; 0x0000001c +%1 = OpTypeInt 32 0 ; 0x00000028 +%2 = OpTypeVoid ; 0x00000038 +)"; + EXPECT_THAT(EncodeAndDecodeSuccessfully( + input, SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET), + expected); +} + +// Test version string. +TEST_F(TextToBinaryTest, VersionString) { + auto words = CompileSuccessfully(""); + spv_text decoded_text = nullptr; + EXPECT_THAT(spvBinaryToText(ScopedContext().context, words.data(), + words.size(), SPV_BINARY_TO_TEXT_OPTION_NONE, + &decoded_text, &diagnostic), + Eq(SPV_SUCCESS)); + EXPECT_EQ(nullptr, diagnostic); + + EXPECT_THAT(decoded_text->str, HasSubstr("Version: 1.0\n")) + << EncodeAndDecodeSuccessfully(""); + spvTextDestroy(decoded_text); +} + +// Test generator string. + +// A test case for the generator string. This allows us to +// test both of the 16-bit components of the generator word. +struct GeneratorStringCase { + uint16_t generator; + uint16_t misc; + std::string expected; +}; + +using GeneratorStringTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(GeneratorStringTest, Sample) { + auto words = CompileSuccessfully(""); + EXPECT_EQ(2u, SPV_INDEX_GENERATOR_NUMBER); + words[SPV_INDEX_GENERATOR_NUMBER] = + SPV_GENERATOR_WORD(GetParam().generator, GetParam().misc); + + spv_text decoded_text = nullptr; + EXPECT_THAT(spvBinaryToText(ScopedContext().context, words.data(), + words.size(), SPV_BINARY_TO_TEXT_OPTION_NONE, + &decoded_text, &diagnostic), + Eq(SPV_SUCCESS)); + EXPECT_THAT(diagnostic, Eq(nullptr)); + EXPECT_THAT(std::string(decoded_text->str), HasSubstr(GetParam().expected)); + spvTextDestroy(decoded_text); +} + +INSTANTIATE_TEST_CASE_P(GeneratorStrings, GeneratorStringTest, + ::testing::ValuesIn(std::vector{ + {SPV_GENERATOR_KHRONOS, 12, "Khronos; 12"}, + {SPV_GENERATOR_LUNARG, 99, "LunarG; 99"}, + {SPV_GENERATOR_VALVE, 1, "Valve; 1"}, + {SPV_GENERATOR_CODEPLAY, 65535, "Codeplay; 65535"}, + {SPV_GENERATOR_NVIDIA, 19, "NVIDIA; 19"}, + {SPV_GENERATOR_ARM, 1000, "ARM; 1000"}, + {SPV_GENERATOR_KHRONOS_LLVM_TRANSLATOR, 38, + "Khronos LLVM/SPIR-V Translator; 38"}, + {SPV_GENERATOR_KHRONOS_ASSEMBLER, 2, + "Khronos SPIR-V Tools Assembler; 2"}, + {SPV_GENERATOR_KHRONOS_GLSLANG, 1, + "Khronos Glslang Reference Front End; 1"}, + {1000, 18, "Unknown(1000); 18"}, + {65535, 32767, "Unknown(65535); 32767"}, + }), ); + +// TODO(dneto): Test new instructions and enums in SPIR-V 1.3 + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/bit_stream.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/bit_stream.cpp new file mode 100644 index 00000000000..f02faf3c6e1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/bit_stream.cpp @@ -0,0 +1,1025 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/comp/bit_stream.h" + +namespace spvtools { +namespace comp { +namespace { + +// Converts |buffer| to a stream of '0' and '1'. +template +std::string BufferToStream(const std::vector& buffer) { + std::stringstream ss; + for (auto it = buffer.begin(); it != buffer.end(); ++it) { + std::string str = std::bitset(*it).to_string(); + // Strings generated by std::bitset::to_string are read right to left. + // Reversing to left to right. + std::reverse(str.begin(), str.end()); + ss << str; + } + return ss.str(); +} + +// Converts a left-to-right input string of '0' and '1' to a buffer of |T| +// words. +template +std::vector StreamToBuffer(std::string str) { + // The input string is left-to-right, the input argument of std::bitset needs + // to right-to-left. Instead of reversing tokens, reverse the entire string + // and iterate tokens from end to begin. + std::reverse(str.begin(), str.end()); + const int word_size = static_cast(sizeof(T) * 8); + const int str_length = static_cast(str.length()); + std::vector buffer; + buffer.reserve(NumBitsToNumWords(str.length())); + for (int index = str_length - word_size; index >= 0; index -= word_size) { + buffer.push_back(static_cast( + std::bitset(str, index, word_size).to_ullong())); + } + const size_t suffix_length = str.length() % word_size; + if (suffix_length != 0) { + buffer.push_back(static_cast( + std::bitset(str, 0, suffix_length).to_ullong())); + } + return buffer; +} + +// Adds '0' chars at the end of the string until the size is a multiple of N. +template +std::string PadToWord(std::string&& str) { + const size_t tail_length = str.size() % N; + if (tail_length != 0) str += std::string(N - tail_length, '0'); + return std::move(str); +} + +// Adds '0' chars at the end of the string until the size is a multiple of N. +template +std::string PadToWord(const std::string& str) { + return PadToWord(std::string(str)); +} + +// Converts a left-to-right stream of bits to std::bitset. +template +std::bitset StreamToBitset(std::string str) { + std::reverse(str.begin(), str.end()); + return std::bitset(str); +} + +// Converts a left-to-right stream of bits to uint64. +uint64_t StreamToBits(std::string str) { + std::reverse(str.begin(), str.end()); + return std::bitset<64>(str).to_ullong(); +} + +// A simple and inefficient implementatition of BitWriterInterface, +// using std::stringstream. Intended for tests only. +class BitWriterStringStream : public BitWriterInterface { + public: + void WriteBits(uint64_t bits, size_t num_bits) override { + assert(num_bits <= 64); + ss_ << BitsToStream(bits, num_bits); + } + + size_t GetNumBits() const override { return ss_.str().size(); } + + std::vector GetDataCopy() const override { + return StreamToBuffer(ss_.str()); + } + + std::string GetStreamRaw() const { return ss_.str(); } + + private: + std::stringstream ss_; +}; + +// A simple and inefficient implementatition of BitReaderInterface. +// Intended for tests only. +class BitReaderFromString : public BitReaderInterface { + public: + explicit BitReaderFromString(std::string&& str) + : str_(std::move(str)), pos_(0) {} + + explicit BitReaderFromString(const std::vector& buffer) + : str_(BufferToStream(buffer)), pos_(0) {} + + explicit BitReaderFromString(const std::vector& buffer) + : str_(PadToWord<64>(BufferToStream(buffer))), pos_(0) {} + + size_t ReadBits(uint64_t* bits, size_t num_bits) override { + if (ReachedEnd()) return 0; + std::string sub = str_.substr(pos_, num_bits); + *bits = StreamToBits(sub); + pos_ += sub.length(); + return sub.length(); + } + + size_t GetNumReadBits() const override { return pos_; } + + bool ReachedEnd() const override { return pos_ >= str_.length(); } + + private: + std::string str_; + size_t pos_; +}; + +TEST(NumBitsToNumWords, Word8) { + EXPECT_EQ(0u, NumBitsToNumWords<8>(0)); + EXPECT_EQ(1u, NumBitsToNumWords<8>(1)); + EXPECT_EQ(1u, NumBitsToNumWords<8>(7)); + EXPECT_EQ(1u, NumBitsToNumWords<8>(8)); + EXPECT_EQ(2u, NumBitsToNumWords<8>(9)); + EXPECT_EQ(2u, NumBitsToNumWords<8>(16)); + EXPECT_EQ(3u, NumBitsToNumWords<8>(17)); + EXPECT_EQ(3u, NumBitsToNumWords<8>(23)); + EXPECT_EQ(3u, NumBitsToNumWords<8>(24)); + EXPECT_EQ(4u, NumBitsToNumWords<8>(25)); +} + +TEST(NumBitsToNumWords, Word64) { + EXPECT_EQ(0u, NumBitsToNumWords<64>(0)); + EXPECT_EQ(1u, NumBitsToNumWords<64>(1)); + EXPECT_EQ(1u, NumBitsToNumWords<64>(64)); + EXPECT_EQ(2u, NumBitsToNumWords<64>(65)); + EXPECT_EQ(2u, NumBitsToNumWords<64>(128)); + EXPECT_EQ(3u, NumBitsToNumWords<64>(129)); +} + +TEST(ZigZagCoding, Encode0) { + EXPECT_EQ(0u, EncodeZigZag(0, 0)); + EXPECT_EQ(1u, EncodeZigZag(-1, 0)); + EXPECT_EQ(2u, EncodeZigZag(1, 0)); + EXPECT_EQ(3u, EncodeZigZag(-2, 0)); + EXPECT_EQ(std::numeric_limits::max() - 1, + EncodeZigZag(std::numeric_limits::max(), 0)); + EXPECT_EQ(std::numeric_limits::max(), + EncodeZigZag(std::numeric_limits::min(), 0)); +} + +TEST(ZigZagCoding, Decode0) { + EXPECT_EQ(0, DecodeZigZag(0, 0)); + EXPECT_EQ(-1, DecodeZigZag(1, 0)); + EXPECT_EQ(1, DecodeZigZag(2, 0)); + EXPECT_EQ(-2, DecodeZigZag(3, 0)); + EXPECT_EQ(std::numeric_limits::min(), + DecodeZigZag(std::numeric_limits::max(), 0)); + EXPECT_EQ(std::numeric_limits::max(), + DecodeZigZag(std::numeric_limits::max() - 1, 0)); +} + +TEST(ZigZagCoding, Encode1) { + EXPECT_EQ(0u, EncodeZigZag(0, 1)); + EXPECT_EQ(1u, EncodeZigZag(1, 1)); + EXPECT_EQ(2u, EncodeZigZag(-1, 1)); + EXPECT_EQ(3u, EncodeZigZag(-2, 1)); + EXPECT_EQ(4u, EncodeZigZag(2, 1)); + EXPECT_EQ(5u, EncodeZigZag(3, 1)); + EXPECT_EQ(6u, EncodeZigZag(-3, 1)); + EXPECT_EQ(7u, EncodeZigZag(-4, 1)); + EXPECT_EQ(std::numeric_limits::max() - 2, + EncodeZigZag(std::numeric_limits::max(), 1)); + EXPECT_EQ(std::numeric_limits::max() - 1, + EncodeZigZag(std::numeric_limits::min() + 1, 1)); + EXPECT_EQ(std::numeric_limits::max(), + EncodeZigZag(std::numeric_limits::min(), 1)); +} + +TEST(ZigZagCoding, Decode1) { + EXPECT_EQ(0, DecodeZigZag(0, 1)); + EXPECT_EQ(1, DecodeZigZag(1, 1)); + EXPECT_EQ(-1, DecodeZigZag(2, 1)); + EXPECT_EQ(-2, DecodeZigZag(3, 1)); + EXPECT_EQ(2, DecodeZigZag(4, 1)); + EXPECT_EQ(3, DecodeZigZag(5, 1)); + EXPECT_EQ(-3, DecodeZigZag(6, 1)); + EXPECT_EQ(-4, DecodeZigZag(7, 1)); + EXPECT_EQ(std::numeric_limits::min(), + DecodeZigZag(std::numeric_limits::max(), 1)); + EXPECT_EQ(std::numeric_limits::min() + 1, + DecodeZigZag(std::numeric_limits::max() - 1, 1)); + EXPECT_EQ(std::numeric_limits::max(), + DecodeZigZag(std::numeric_limits::max() - 2, 1)); +} + +TEST(ZigZagCoding, Encode2) { + EXPECT_EQ(0u, EncodeZigZag(0, 2)); + EXPECT_EQ(1u, EncodeZigZag(1, 2)); + EXPECT_EQ(2u, EncodeZigZag(2, 2)); + EXPECT_EQ(3u, EncodeZigZag(3, 2)); + EXPECT_EQ(4u, EncodeZigZag(-1, 2)); + EXPECT_EQ(5u, EncodeZigZag(-2, 2)); + EXPECT_EQ(6u, EncodeZigZag(-3, 2)); + EXPECT_EQ(7u, EncodeZigZag(-4, 2)); + EXPECT_EQ(8u, EncodeZigZag(4, 2)); + EXPECT_EQ(9u, EncodeZigZag(5, 2)); + EXPECT_EQ(10u, EncodeZigZag(6, 2)); + EXPECT_EQ(11u, EncodeZigZag(7, 2)); + EXPECT_EQ(12u, EncodeZigZag(-5, 2)); + EXPECT_EQ(13u, EncodeZigZag(-6, 2)); + EXPECT_EQ(14u, EncodeZigZag(-7, 2)); + EXPECT_EQ(15u, EncodeZigZag(-8, 2)); + EXPECT_EQ(std::numeric_limits::max() - 4, + EncodeZigZag(std::numeric_limits::max(), 2)); + EXPECT_EQ(std::numeric_limits::max() - 3, + EncodeZigZag(std::numeric_limits::min() + 3, 2)); + EXPECT_EQ(std::numeric_limits::max() - 2, + EncodeZigZag(std::numeric_limits::min() + 2, 2)); + EXPECT_EQ(std::numeric_limits::max() - 1, + EncodeZigZag(std::numeric_limits::min() + 1, 2)); + EXPECT_EQ(std::numeric_limits::max(), + EncodeZigZag(std::numeric_limits::min(), 2)); +} + +TEST(ZigZagCoding, Decode2) { + EXPECT_EQ(0, DecodeZigZag(0, 2)); + EXPECT_EQ(1, DecodeZigZag(1, 2)); + EXPECT_EQ(2, DecodeZigZag(2, 2)); + EXPECT_EQ(3, DecodeZigZag(3, 2)); + EXPECT_EQ(-1, DecodeZigZag(4, 2)); + EXPECT_EQ(-2, DecodeZigZag(5, 2)); + EXPECT_EQ(-3, DecodeZigZag(6, 2)); + EXPECT_EQ(-4, DecodeZigZag(7, 2)); + EXPECT_EQ(4, DecodeZigZag(8, 2)); + EXPECT_EQ(5, DecodeZigZag(9, 2)); + EXPECT_EQ(6, DecodeZigZag(10, 2)); + EXPECT_EQ(7, DecodeZigZag(11, 2)); + EXPECT_EQ(-5, DecodeZigZag(12, 2)); + EXPECT_EQ(-6, DecodeZigZag(13, 2)); + EXPECT_EQ(-7, DecodeZigZag(14, 2)); + EXPECT_EQ(-8, DecodeZigZag(15, 2)); + EXPECT_EQ(std::numeric_limits::min(), + DecodeZigZag(std::numeric_limits::max(), 2)); + EXPECT_EQ(std::numeric_limits::min() + 1, + DecodeZigZag(std::numeric_limits::max() - 1, 2)); + EXPECT_EQ(std::numeric_limits::min() + 2, + DecodeZigZag(std::numeric_limits::max() - 2, 2)); + EXPECT_EQ(std::numeric_limits::min() + 3, + DecodeZigZag(std::numeric_limits::max() - 3, 2)); + EXPECT_EQ(std::numeric_limits::max(), + DecodeZigZag(std::numeric_limits::max() - 4, 2)); +} + +TEST(ZigZagCoding, Encode63) { + EXPECT_EQ(0u, EncodeZigZag(0, 63)); + + for (int64_t i = 0; i < 0xFFFFFFFF; i += 1234567) { + const int64_t positive_val = GetLowerBits(i * i * i + i * i, 63) | 1UL; + ASSERT_EQ(static_cast(positive_val), + EncodeZigZag(positive_val, 63)); + ASSERT_EQ((1ULL << 63) - 1 + positive_val, EncodeZigZag(-positive_val, 63)); + } + + EXPECT_EQ((1ULL << 63) - 1, + EncodeZigZag(std::numeric_limits::max(), 63)); + EXPECT_EQ(std::numeric_limits::max() - 1, + EncodeZigZag(std::numeric_limits::min() + 1, 63)); + EXPECT_EQ(std::numeric_limits::max(), + EncodeZigZag(std::numeric_limits::min(), 63)); +} + +TEST(BufToStream, UInt8_Empty) { + const std::string expected_bits = ""; + std::vector buffer = StreamToBuffer(expected_bits); + EXPECT_TRUE(buffer.empty()); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(expected_bits, result_bits); +} + +TEST(BufToStream, UInt8_OneWord) { + const std::string expected_bits = "00101100"; + std::vector buffer = StreamToBuffer(expected_bits); + EXPECT_EQ(std::vector({static_cast( + StreamToBitset<8>(expected_bits).to_ulong())}), + buffer); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(expected_bits, result_bits); +} + +TEST(BufToStream, UInt8_MultipleWords) { + const std::string expected_bits = + "00100010" + "01101010" + "01111101" + "00100010"; + std::vector buffer = StreamToBuffer(expected_bits); + EXPECT_EQ(std::vector({ + static_cast(StreamToBitset<8>("00100010").to_ulong()), + static_cast(StreamToBitset<8>("01101010").to_ulong()), + static_cast(StreamToBitset<8>("01111101").to_ulong()), + static_cast(StreamToBitset<8>("00100010").to_ulong()), + }), + buffer); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(expected_bits, result_bits); +} + +TEST(BufToStream, UInt64_Empty) { + const std::string expected_bits = ""; + std::vector buffer = StreamToBuffer(expected_bits); + EXPECT_TRUE(buffer.empty()); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(expected_bits, result_bits); +} + +TEST(BufToStream, UInt64_OneWord) { + const std::string expected_bits = + "0001000111101110011001101010101000100010110011000100010010001000"; + std::vector buffer = StreamToBuffer(expected_bits); + ASSERT_EQ(1u, buffer.size()); + EXPECT_EQ(0x1122334455667788u, buffer[0]); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(expected_bits, result_bits); +} + +TEST(BufToStream, UInt64_Unaligned) { + const std::string expected_bits = + "0010001001101010011111010010001001001010000111110010010010010101" + "0010001001101010011111111111111111111111"; + std::vector buffer = StreamToBuffer(expected_bits); + EXPECT_EQ(std::vector({ + StreamToBits(expected_bits.substr(0, 64)), + StreamToBits(expected_bits.substr(64, 64)), + }), + buffer); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(PadToWord<64>(expected_bits), result_bits); +} + +TEST(BufToStream, UInt64_MultipleWords) { + const std::string expected_bits = + "0010001001101010011111010010001001001010000111110010010010010101" + "0010001001101010011111111111111111111111000111110010010010010111" + "0000000000000000000000000000000000000000000000000010010011111111"; + std::vector buffer = StreamToBuffer(expected_bits); + EXPECT_EQ(std::vector({ + StreamToBits(expected_bits.substr(0, 64)), + StreamToBits(expected_bits.substr(64, 64)), + StreamToBits(expected_bits.substr(128, 64)), + }), + buffer); + const std::string result_bits = BufferToStream(buffer); + EXPECT_EQ(expected_bits, result_bits); +} + +TEST(PadToWord, Test) { + EXPECT_EQ("10100000", PadToWord<8>("101")); + EXPECT_EQ( + "10100000" + "00000000", + PadToWord<16>("101")); + EXPECT_EQ( + "10100000" + "00000000" + "00000000" + "00000000", + PadToWord<32>("101")); + EXPECT_EQ( + "10100000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000", + PadToWord<64>("101")); +} + +TEST(BitWriterStringStream, Empty) { + BitWriterStringStream writer; + EXPECT_EQ(0u, writer.GetNumBits()); + EXPECT_EQ(0u, writer.GetDataSizeBytes()); + EXPECT_EQ("", writer.GetStreamRaw()); +} + +TEST(BitWriterStringStream, WriteBits) { + BitWriterStringStream writer; + const uint64_t bits1 = 0x1 | 0x2 | 0x10; + writer.WriteBits(bits1, 5); + EXPECT_EQ(5u, writer.GetNumBits()); + EXPECT_EQ(1u, writer.GetDataSizeBytes()); + EXPECT_EQ("11001", writer.GetStreamRaw()); +} + +TEST(BitWriterStringStream, WriteUnencodedU8) { + BitWriterStringStream writer; + const uint8_t bits = 127; + writer.WriteUnencoded(bits); + EXPECT_EQ(8u, writer.GetNumBits()); + EXPECT_EQ("11111110", writer.GetStreamRaw()); +} + +TEST(BitWriterStringStream, WriteUnencodedS64) { + BitWriterStringStream writer; + const int64_t bits = std::numeric_limits::min() + 7; + writer.WriteUnencoded(bits); + EXPECT_EQ(64u, writer.GetNumBits()); + EXPECT_EQ("1110000000000000000000000000000000000000000000000000000000000001", + writer.GetStreamRaw()); +} + +TEST(BitWriterStringStream, WriteMultiple) { + BitWriterStringStream writer; + + std::string expected_result; + + const uint64_t b2_val = 0x4 | 0x2 | 0x40; + const std::string bits2 = BitsToStream(b2_val, 8); + writer.WriteBits(b2_val, 8); + + const uint64_t val = 0x1 | 0x2 | 0x10; + const std::string bits3 = BitsToStream(val, 8); + writer.WriteBits(val, 8); + + const std::string expected = bits2 + bits3; + + EXPECT_EQ(expected.length(), writer.GetNumBits()); + EXPECT_EQ(2u, writer.GetDataSizeBytes()); + EXPECT_EQ(expected, writer.GetStreamRaw()); + + EXPECT_EQ(PadToWord<8>(expected), BufferToStream(writer.GetDataCopy())); +} + +TEST(BitWriterWord64, Empty) { + BitWriterWord64 writer; + EXPECT_EQ(0u, writer.GetNumBits()); + EXPECT_EQ(0u, writer.GetDataSizeBytes()); +} + +TEST(BitWriterWord64, WriteBits) { + BitWriterWord64 writer; + const uint64_t bits1 = 0x1 | 0x2 | 0x10; + writer.WriteBits(bits1, 5); + writer.WriteBits(bits1, 5); + writer.WriteBits(bits1, 5); + EXPECT_EQ(15u, writer.GetNumBits()); + EXPECT_EQ(2u, writer.GetDataSizeBytes()); +} + +TEST(BitWriterWord64, WriteZeroBits) { + BitWriterWord64 writer; + writer.WriteBits(0, 0); + writer.WriteBits(1, 0); + EXPECT_EQ(0u, writer.GetNumBits()); + writer.WriteBits(1, 1); + writer.WriteBits(0, 0); + writer.WriteBits(0, 63); + EXPECT_EQ(64u, writer.GetNumBits()); + writer.WriteBits(0, 0); + writer.WriteBits(7, 3); + writer.WriteBits(0, 0); +} + +TEST(BitWriterWord64, ComparisonTestWriteLotsOfBits) { + BitWriterStringStream writer1; + BitWriterWord64 writer2(16384); + + for (uint64_t i = 0; i < 65000; i += 25) { + writer1.WriteBits(i, 16); + writer2.WriteBits(i, 16); + ASSERT_EQ(writer1.GetNumBits(), writer2.GetNumBits()); + } +} + +TEST(GetLowerBits, Test) { + EXPECT_EQ(0u, GetLowerBits(255, 0)); + EXPECT_EQ(1u, GetLowerBits(255, 1)); + EXPECT_EQ(3u, GetLowerBits(255, 2)); + EXPECT_EQ(7u, GetLowerBits(255, 3)); + EXPECT_EQ(15u, GetLowerBits(255, 4)); + EXPECT_EQ(31u, GetLowerBits(255, 5)); + EXPECT_EQ(63u, GetLowerBits(255, 6)); + EXPECT_EQ(127u, GetLowerBits(255, 7)); + EXPECT_EQ(255u, GetLowerBits(255, 8)); + EXPECT_EQ(0xFFu, GetLowerBits(0xFFFFFFFF, 8)); + EXPECT_EQ(0xFFFFu, GetLowerBits(0xFFFFFFFF, 16)); + EXPECT_EQ(0xFFFFFFu, GetLowerBits(0xFFFFFFFF, 24)); + EXPECT_EQ(0xFFFFFFu, GetLowerBits(0xFFFFFFFFFFFF, 24)); + EXPECT_EQ(0xFFFFFFFFFFFFFFFFu, + GetLowerBits(0xFFFFFFFFFFFFFFFFu, 64)); + EXPECT_EQ(StreamToBits("1010001110"), + GetLowerBits(StreamToBits("1010001110111101111111"), 10)); +} + +TEST(BitReaderFromString, FromU8) { + std::vector buffer = { + 0xAA, + 0xBB, + 0xCC, + 0xDD, + }; + + const std::string total_stream = + "01010101" + "11011101" + "00110011" + "10111011"; + + BitReaderFromString reader(buffer); + + uint64_t bits = 0; + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(PadToWord<64>("01"), BitsToStream(bits)); + EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); + EXPECT_EQ(PadToWord<64>("01010111011101001100"), BitsToStream(bits)); + EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); + EXPECT_EQ(PadToWord<64>("11101110110000000000"), BitsToStream(bits)); + EXPECT_EQ(22u, reader.ReadBits(&bits, 30)); + EXPECT_EQ(PadToWord<64>("0000000000000000000000"), BitsToStream(bits)); + EXPECT_TRUE(reader.ReachedEnd()); +} + +TEST(BitReaderFromString, FromU64) { + std::vector buffer = { + 0xAAAAAAAAAAAAAAAA, + 0xBBBBBBBBBBBBBBBB, + 0xCCCCCCCCCCCCCCCC, + 0xDDDDDDDDDDDDDDDD, + }; + + const std::string total_stream = + "0101010101010101010101010101010101010101010101010101010101010101" + "1101110111011101110111011101110111011101110111011101110111011101" + "0011001100110011001100110011001100110011001100110011001100110011" + "1011101110111011101110111011101110111011101110111011101110111011"; + + BitReaderFromString reader(buffer); + + uint64_t bits = 0; + size_t pos = 0; + size_t to_read = 5; + while (reader.ReadBits(&bits, to_read) > 0) { + EXPECT_EQ(BitsToStream(bits), + PadToWord<64>(total_stream.substr(pos, to_read))); + pos += to_read; + to_read = (to_read + 35) % 64 + 1; + } + EXPECT_TRUE(reader.ReachedEnd()); +} + +TEST(BitReaderWord64, ReadBitsSingleByte) { + BitReaderWord64 reader(std::vector({uint8_t(0xF0)})); + EXPECT_FALSE(reader.ReachedEnd()); + + uint64_t bits = 0; + EXPECT_EQ(1u, reader.ReadBits(&bits, 1)); + EXPECT_EQ(0u, bits); + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(0u, bits); + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(2u, bits); + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(3u, bits); + EXPECT_FALSE(reader.OnlyZeroesLeft()); + EXPECT_FALSE(reader.ReachedEnd()); + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(1u, bits); + EXPECT_TRUE(reader.OnlyZeroesLeft()); + EXPECT_FALSE(reader.ReachedEnd()); + EXPECT_EQ(55u, reader.ReadBits(&bits, 64)); + EXPECT_EQ(0u, bits); + EXPECT_TRUE(reader.ReachedEnd()); +} + +TEST(BitReaderWord64, ReadBitsTwoWords) { + std::vector buffer = {0x0000000000000001, 0x0000000000FFFFFF}; + + BitReaderWord64 reader(std::move(buffer)); + + uint64_t bits = 0; + EXPECT_EQ(1u, reader.ReadBits(&bits, 1)); + EXPECT_EQ(1u, bits); + EXPECT_EQ(62u, reader.ReadBits(&bits, 62)); + EXPECT_EQ(0u, bits); + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(2u, bits); + EXPECT_EQ(3u, reader.ReadBits(&bits, 3)); + EXPECT_EQ(7u, bits); + EXPECT_FALSE(reader.OnlyZeroesLeft()); + EXPECT_EQ(32u, reader.ReadBits(&bits, 32)); + EXPECT_EQ(0xFFFFFu, bits); + EXPECT_TRUE(reader.OnlyZeroesLeft()); + EXPECT_FALSE(reader.ReachedEnd()); + EXPECT_EQ(28u, reader.ReadBits(&bits, 32)); + EXPECT_EQ(0u, bits); + EXPECT_TRUE(reader.ReachedEnd()); +} + +TEST(BitReaderFromString, ReadUnencodedU8) { + BitReaderFromString reader("11111110"); + uint8_t val = 0; + ASSERT_TRUE(reader.ReadUnencoded(&val)); + EXPECT_EQ(8u, reader.GetNumReadBits()); + EXPECT_EQ(127, val); +} + +TEST(BitReaderFromString, ReadUnencodedU16Fail) { + BitReaderFromString reader("11111110"); + uint16_t val = 0; + ASSERT_FALSE(reader.ReadUnencoded(&val)); +} + +TEST(BitReaderFromString, ReadUnencodedS64) { + BitReaderFromString reader( + "1110000000000000000000000000000000000000000000000000000000000001"); + int64_t val = 0; + ASSERT_TRUE(reader.ReadUnencoded(&val)); + EXPECT_EQ(64u, reader.GetNumReadBits()); + EXPECT_EQ(std::numeric_limits::min() + 7, val); +} + +TEST(BitReaderWord64, FromU8) { + std::vector buffer = { + 0xAA, + 0xBB, + 0xCC, + 0xDD, + }; + + BitReaderWord64 reader(std::move(buffer)); + + uint64_t bits = 0; + EXPECT_EQ(2u, reader.ReadBits(&bits, 2)); + EXPECT_EQ(PadToWord<64>("01"), BitsToStream(bits)); + EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); + EXPECT_EQ(PadToWord<64>("01010111011101001100"), BitsToStream(bits)); + EXPECT_EQ(20u, reader.ReadBits(&bits, 20)); + EXPECT_EQ(PadToWord<64>("11101110110000000000"), BitsToStream(bits)); + EXPECT_EQ(22u, reader.ReadBits(&bits, 30)); + EXPECT_EQ(PadToWord<64>("0000000000000000000000"), BitsToStream(bits)); + EXPECT_TRUE(reader.ReachedEnd()); +} + +TEST(BitReaderWord64, FromU64) { + std::vector buffer = { + 0xAAAAAAAAAAAAAAAA, + 0xBBBBBBBBBBBBBBBB, + 0xCCCCCCCCCCCCCCCC, + 0xDDDDDDDDDDDDDDDD, + }; + + const std::string total_stream = + "0101010101010101010101010101010101010101010101010101010101010101" + "1101110111011101110111011101110111011101110111011101110111011101" + "0011001100110011001100110011001100110011001100110011001100110011" + "1011101110111011101110111011101110111011101110111011101110111011"; + + BitReaderWord64 reader(std::move(buffer)); + + uint64_t bits = 0; + size_t pos = 0; + size_t to_read = 5; + while (reader.ReadBits(&bits, to_read) > 0) { + EXPECT_EQ(BitsToStream(bits), + PadToWord<64>(total_stream.substr(pos, to_read))); + pos += to_read; + to_read = (to_read + 35) % 64 + 1; + } + EXPECT_TRUE(reader.ReachedEnd()); +} + +TEST(BitReaderWord64, ComparisonLotsOfU8) { + std::vector buffer; + for (uint32_t i = 0; i < 10003; ++i) { + buffer.push_back(static_cast(i % 255)); + } + + BitReaderFromString reader1(buffer); + BitReaderWord64 reader2(std::move(buffer)); + + uint64_t bits1 = 0, bits2 = 0; + size_t to_read = 5; + while (reader1.ReadBits(&bits1, to_read) > 0) { + reader2.ReadBits(&bits2, to_read); + EXPECT_EQ(bits1, bits2); + to_read = (to_read + 35) % 64 + 1; + } + + EXPECT_EQ(0u, reader2.ReadBits(&bits2, 1)); +} + +TEST(BitReaderWord64, ComparisonLotsOfU64) { + std::vector buffer; + for (uint64_t i = 0; i < 1000; ++i) { + buffer.push_back(i); + } + + BitReaderFromString reader1(buffer); + BitReaderWord64 reader2(std::move(buffer)); + + uint64_t bits1 = 0, bits2 = 0; + size_t to_read = 5; + while (reader1.ReadBits(&bits1, to_read) > 0) { + reader2.ReadBits(&bits2, to_read); + EXPECT_EQ(bits1, bits2); + to_read = (to_read + 35) % 64 + 1; + } + + EXPECT_EQ(0u, reader2.ReadBits(&bits2, 1)); +} + +TEST(ReadWriteWord64, ReadWriteLotsOfBits) { + BitWriterWord64 writer(16384); + for (uint64_t i = 0; i < 65000; i += 25) { + const uint64_t num_bits = i % 64 + 1; + const uint64_t bits = i >> (64 - num_bits); + writer.WriteBits(bits, size_t(num_bits)); + } + + BitReaderWord64 reader(writer.GetDataCopy()); + for (uint64_t i = 0; i < 65000; i += 25) { + const uint64_t num_bits = i % 64 + 1; + const uint64_t expected_bits = i >> (64 - num_bits); + uint64_t bits = 0; + reader.ReadBits(&bits, size_t(num_bits)); + EXPECT_EQ(expected_bits, bits); + } + + EXPECT_TRUE(reader.OnlyZeroesLeft()); +} + +TEST(VariableWidthWrite, Write0U) { + BitWriterStringStream writer; + writer.WriteVariableWidthU64(0, 2); + EXPECT_EQ("000", writer.GetStreamRaw()); + writer.WriteVariableWidthU32(0, 2); + EXPECT_EQ( + "000" + "000", + writer.GetStreamRaw()); + writer.WriteVariableWidthU16(0, 2); + EXPECT_EQ( + "000" + "000" + "000", + writer.GetStreamRaw()); +} + +TEST(VariableWidthWrite, WriteSmallUnsigned) { + BitWriterStringStream writer; + writer.WriteVariableWidthU64(1, 2); + EXPECT_EQ("100", writer.GetStreamRaw()); + writer.WriteVariableWidthU32(2, 2); + EXPECT_EQ( + "100" + "010", + writer.GetStreamRaw()); + writer.WriteVariableWidthU16(3, 2); + EXPECT_EQ( + "100" + "010" + "110", + writer.GetStreamRaw()); +} + +TEST(VariableWidthWrite, WriteSmallSigned) { + BitWriterStringStream writer; + writer.WriteVariableWidthS64(1, 2, 0); + EXPECT_EQ("010", writer.GetStreamRaw()); + writer.WriteVariableWidthS64(-1, 2, 0); + EXPECT_EQ( + "010" + "100", + writer.GetStreamRaw()); +} + +TEST(VariableWidthWrite, U64Val127ChunkLength7) { + BitWriterStringStream writer; + writer.WriteVariableWidthU64(127, 7); + EXPECT_EQ( + "1111111" + "0", + writer.GetStreamRaw()); +} + +TEST(VariableWidthWrite, U32Val255ChunkLength7) { + BitWriterStringStream writer; + writer.WriteVariableWidthU32(255, 7); + EXPECT_EQ( + "1111111" + "1" + "1000000" + "0", + writer.GetStreamRaw()); +} + +TEST(VariableWidthWrite, U16Val2ChunkLength4) { + BitWriterStringStream writer; + writer.WriteVariableWidthU16(2, 4); + EXPECT_EQ( + "0100" + "0", + writer.GetStreamRaw()); +} + +TEST(VariableWidthWrite, U64ValAAAAChunkLength2) { + BitWriterStringStream writer; + writer.WriteVariableWidthU64(0xAAAA, 2); + EXPECT_EQ( + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "0", + writer.GetStreamRaw()); +} + +TEST(VariableWidthRead, U64Val127ChunkLength7) { + BitReaderFromString reader( + "1111111" + "0"); + uint64_t val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 7)); + EXPECT_EQ(127u, val); +} + +TEST(VariableWidthRead, U32Val255ChunkLength7) { + BitReaderFromString reader( + "1111111" + "1" + "1000000" + "0"); + uint32_t val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU32(&val, 7)); + EXPECT_EQ(255u, val); +} + +TEST(VariableWidthRead, U16Val2ChunkLength4) { + BitReaderFromString reader( + "0100" + "0"); + uint16_t val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU16(&val, 4)); + EXPECT_EQ(2u, val); +} + +TEST(VariableWidthRead, U64ValAAAAChunkLength2) { + BitReaderFromString reader( + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "1" + "01" + "0"); + uint64_t val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 2)); + EXPECT_EQ(0xAAAAu, val); +} + +TEST(VariableWidthRead, FailTooShort) { + BitReaderFromString reader("00000001100000"); + uint64_t val = 0; + ASSERT_FALSE(reader.ReadVariableWidthU64(&val, 7)); +} + +TEST(VariableWidthWriteRead, SingleWriteReadU64) { + for (uint64_t i = 0; i < 1000000; i += 1234) { + const uint64_t val = i * i * i; + const size_t chunk_length = size_t(i % 16 + 1); + + BitWriterWord64 writer; + writer.WriteVariableWidthU64(val, chunk_length); + + BitReaderWord64 reader(writer.GetDataCopy()); + uint64_t read_val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU64(&read_val, chunk_length)); + + ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; + } +} + +TEST(VariableWidthWriteRead, SingleWriteReadS64) { + for (int64_t i = 0; i < 1000000; i += 4321) { + const int64_t val = i * i * (i % 2 ? -i : i); + const size_t chunk_length = size_t(i % 16 + 1); + const size_t zigzag_exponent = size_t(i % 13); + + BitWriterWord64 writer; + writer.WriteVariableWidthS64(val, chunk_length, zigzag_exponent); + + BitReaderWord64 reader(writer.GetDataCopy()); + int64_t read_val = 0; + ASSERT_TRUE( + reader.ReadVariableWidthS64(&read_val, chunk_length, zigzag_exponent)); + + ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; + } +} + +TEST(VariableWidthWriteRead, SingleWriteReadU32) { + for (uint32_t i = 0; i < 100000; i += 123) { + const uint32_t val = i * i; + const size_t chunk_length = i % 16 + 1; + + BitWriterWord64 writer; + writer.WriteVariableWidthU32(val, chunk_length); + + BitReaderWord64 reader(writer.GetDataCopy()); + uint32_t read_val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU32(&read_val, chunk_length)); + + ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; + } +} + +TEST(VariableWidthWriteRead, SingleWriteReadU16) { + for (int i = 0; i < 65536; i += 123) { + const uint16_t val = static_cast(i); + const size_t chunk_length = val % 10 + 1; + + BitWriterWord64 writer; + writer.WriteVariableWidthU16(val, chunk_length); + + BitReaderWord64 reader(writer.GetDataCopy()); + uint16_t read_val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU16(&read_val, chunk_length)); + + ASSERT_EQ(val, read_val) << "Chunk length " << chunk_length; + } +} + +TEST(VariableWidthWriteRead, SmallNumbersChunkLength4) { + const std::vector expected_values = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + + BitWriterWord64 writer; + for (uint64_t val : expected_values) { + writer.WriteVariableWidthU64(val, 4); + } + + EXPECT_EQ(50u, writer.GetNumBits()); + + std::vector actual_values; + BitReaderWord64 reader(writer.GetDataCopy()); + while (!reader.OnlyZeroesLeft()) { + uint64_t val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 4)); + actual_values.push_back(val); + } + + EXPECT_EQ(expected_values, actual_values); +} + +TEST(VariableWidthWriteRead, VariedNumbersChunkLength8) { + const std::vector expected_values = {1000, 0, 255, 4294967296}; + const size_t kExpectedNumBits = 9 * (2 + 1 + 1 + 5); + + BitWriterWord64 writer; + for (uint64_t val : expected_values) { + writer.WriteVariableWidthU64(val, 8); + } + + EXPECT_EQ(kExpectedNumBits, writer.GetNumBits()); + + std::vector actual_values; + BitReaderWord64 reader(writer.GetDataCopy()); + while (!reader.OnlyZeroesLeft()) { + uint64_t val = 0; + ASSERT_TRUE(reader.ReadVariableWidthU64(&val, 8)); + actual_values.push_back(val); + } + + EXPECT_EQ(expected_values, actual_values); +} + +} // namespace +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/c_interface_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/c_interface_test.cpp new file mode 100644 index 00000000000..1b735be5d7e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/c_interface_test.cpp @@ -0,0 +1,299 @@ +// Copyright (c) 2016 Google 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. + +#include "gtest/gtest.h" +#include "source/table.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace { + +// TODO(antiagainst): Use public C API for setting the consumer once exists. +#ifndef SPIRV_TOOLS_SHAREDLIB +void SetContextMessageConsumer(spv_context context, MessageConsumer consumer) { + spvtools::SetContextMessageConsumer(context, consumer); +} +#else +void SetContextMessageConsumer(spv_context, MessageConsumer) {} +#endif + +// The default consumer is a null std::function. +TEST(CInterface, DefaultConsumerNullDiagnosticForValidInput) { + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + const char input_text[] = + "OpCapability Shader\n" + "OpCapability Linkage\n" + "OpMemoryModel Logical GLSL450"; + + spv_binary binary = nullptr; + EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + + { + // Sadly the compiler don't allow me to feed binary directly to + // spvValidate(). + spv_const_binary_t b{binary->code, binary->wordCount}; + EXPECT_EQ(SPV_SUCCESS, spvValidate(context, &b, nullptr)); + } + + spv_text text = nullptr; + EXPECT_EQ(SPV_SUCCESS, spvBinaryToText(context, binary->code, + binary->wordCount, 0, &text, nullptr)); + + spvTextDestroy(text); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +// The default consumer is a null std::function. +TEST(CInterface, DefaultConsumerNullDiagnosticForInvalidAssembling) { + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + const char input_text[] = "%1 = OpName"; + + spv_binary binary = nullptr; + EXPECT_EQ(SPV_ERROR_INVALID_TEXT, + spvTextToBinary(context, input_text, sizeof(input_text), &binary, + nullptr)); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +// The default consumer is a null std::function. +TEST(CInterface, DefaultConsumerNullDiagnosticForInvalidDiassembling) { + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + const char input_text[] = "OpNop"; + + spv_binary binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + // Change OpNop to an invalid (wordcount|opcode) word. + binary->code[binary->wordCount - 1] = 0xffffffff; + + spv_text text = nullptr; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryToText(context, binary->code, binary->wordCount, 0, &text, + nullptr)); + + spvTextDestroy(text); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +// The default consumer is a null std::function. +TEST(CInterface, DefaultConsumerNullDiagnosticForInvalidValidating) { + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + const char input_text[] = "OpNop"; + + spv_binary binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + + spv_const_binary_t b{binary->code, binary->wordCount}; + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, spvValidate(context, &b, nullptr)); + + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +TEST(CInterface, SpecifyConsumerNullDiagnosticForAssembling) { + const char input_text[] = "%1 = OpName\n"; + + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + context, + [&invocation](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + ++invocation; + EXPECT_EQ(SPV_MSG_ERROR, level); + // The error happens at scanning the begining of second line. + EXPECT_STREQ("input", source); + EXPECT_EQ(1u, position.line); + EXPECT_EQ(0u, position.column); + EXPECT_EQ(12u, position.index); + EXPECT_STREQ("Expected operand, found end of stream.", message); + }); + + spv_binary binary = nullptr; + EXPECT_EQ(SPV_ERROR_INVALID_TEXT, + spvTextToBinary(context, input_text, sizeof(input_text), &binary, + nullptr)); +#ifndef SPIRV_TOOLS_SHAREDLIB + EXPECT_EQ(1, invocation); +#endif + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +TEST(CInterface, SpecifyConsumerNullDiagnosticForDisassembling) { + const char input_text[] = "OpNop"; + + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + context, + [&invocation](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + ++invocation; + EXPECT_EQ(SPV_MSG_ERROR, level); + EXPECT_STREQ("input", source); + EXPECT_EQ(0u, position.line); + EXPECT_EQ(0u, position.column); + EXPECT_EQ(5u, position.index); + EXPECT_STREQ("Invalid opcode: 65535", message); + }); + + spv_binary binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + // Change OpNop to an invalid (wordcount|opcode) word. + binary->code[binary->wordCount - 1] = 0xffffffff; + + spv_text text = nullptr; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryToText(context, binary->code, binary->wordCount, 0, &text, + nullptr)); +#ifndef SPIRV_TOOLS_SHAREDLIB + EXPECT_EQ(1, invocation); +#endif + + spvTextDestroy(text); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +TEST(CInterface, SpecifyConsumerNullDiagnosticForValidating) { + const char input_text[] = "OpNop"; + + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + context, + [&invocation](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + ++invocation; + EXPECT_EQ(SPV_MSG_ERROR, level); + EXPECT_STREQ("input", source); + EXPECT_EQ(0u, position.line); + EXPECT_EQ(0u, position.column); + // TODO(antiagainst): what validation reports is not a word offset here. + // It is inconsistent with diassembler. Should be fixed. + EXPECT_EQ(1u, position.index); + EXPECT_STREQ( + "Nop cannot appear before the memory model instruction\n" + " OpNop\n", + message); + }); + + spv_binary binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + + spv_const_binary_t b{binary->code, binary->wordCount}; + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, spvValidate(context, &b, nullptr)); +#ifndef SPIRV_TOOLS_SHAREDLIB + EXPECT_EQ(1, invocation); +#endif + + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +// When having both a consumer and an diagnostic object, the diagnostic object +// should take priority. +TEST(CInterface, SpecifyConsumerSpecifyDiagnosticForAssembling) { + const char input_text[] = "%1 = OpName"; + + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + context, + [&invocation](spv_message_level_t, const char*, const spv_position_t&, + const char*) { ++invocation; }); + + spv_binary binary = nullptr; + spv_diagnostic diagnostic = nullptr; + EXPECT_EQ(SPV_ERROR_INVALID_TEXT, + spvTextToBinary(context, input_text, sizeof(input_text), &binary, + &diagnostic)); + EXPECT_EQ(0, invocation); // Consumer should not be invoked at all. + EXPECT_STREQ("Expected operand, found end of stream.", diagnostic->error); + + spvDiagnosticDestroy(diagnostic); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +TEST(CInterface, SpecifyConsumerSpecifyDiagnosticForDisassembling) { + const char input_text[] = "OpNop"; + + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + context, + [&invocation](spv_message_level_t, const char*, const spv_position_t&, + const char*) { ++invocation; }); + + spv_binary binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + // Change OpNop to an invalid (wordcount|opcode) word. + binary->code[binary->wordCount - 1] = 0xffffffff; + + spv_diagnostic diagnostic = nullptr; + spv_text text = nullptr; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + spvBinaryToText(context, binary->code, binary->wordCount, 0, &text, + &diagnostic)); + + EXPECT_EQ(0, invocation); // Consumer should not be invoked at all. + EXPECT_STREQ("Invalid opcode: 65535", diagnostic->error); + + spvTextDestroy(text); + spvDiagnosticDestroy(diagnostic); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +TEST(CInterface, SpecifyConsumerSpecifyDiagnosticForValidating) { + const char input_text[] = "OpNop"; + + auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); + int invocation = 0; + SetContextMessageConsumer( + context, + [&invocation](spv_message_level_t, const char*, const spv_position_t&, + const char*) { ++invocation; }); + + spv_binary binary = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, + sizeof(input_text), &binary, nullptr)); + + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t b{binary->code, binary->wordCount}; + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, spvValidate(context, &b, &diagnostic)); + + EXPECT_EQ(0, invocation); // Consumer should not be invoked at all. + EXPECT_STREQ( + "Nop cannot appear before the memory model instruction\n" + " OpNop\n", + diagnostic->error); + + spvDiagnosticDestroy(diagnostic); + spvBinaryDestroy(binary); + spvContextDestroy(context); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/comment_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/comment_test.cpp new file mode 100644 index 00000000000..f46b72ac581 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/comment_test.cpp @@ -0,0 +1,50 @@ +// Copyright (c) 2015-2016 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. + +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using spvtest::TextToBinaryTest; +using testing::Eq; + +TEST_F(TextToBinaryTest, Whitespace) { + std::string input = R"( +; I'm a proud comment at the beginning of the file +; I hide: OpCapability Shader + OpMemoryModel Logical Simple ; comment after instruction +;;;;;;;; many ;'s + %glsl450 = OpExtInstImport "GLSL.std.450" + ; comment indented +)"; + + EXPECT_THAT( + CompiledInstructions(input), + Eq(Concatenate({MakeInstruction(SpvOpMemoryModel, + {uint32_t(SpvAddressingModelLogical), + uint32_t(SpvMemoryModelSimple)}), + MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("GLSL.std.450"))}))); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/comp/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/comp/CMakeLists.txt new file mode 100644 index 00000000000..c947fde0c66 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/comp/CMakeLists.txt @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Google 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. + +set(VAL_TEST_COMMON_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/../test_fixture.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_spirv.h +) + +if(SPIRV_BUILD_COMPRESSION) + add_spvtools_unittest(TARGET markv_codec + SRCS + markv_codec_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/comp/markv_model_factory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/comp/markv_model_shader.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS SPIRV-Tools-comp ${SPIRV_TOOLS} + ) +endif(SPIRV_BUILD_COMPRESSION) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp new file mode 100644 index 00000000000..76918f7479e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp @@ -0,0 +1,829 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/comp/markv.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "tools/comp/markv_model_factory.h" + +namespace spvtools { +namespace comp { +namespace { + +using spvtest::ScopedContext; +using MarkvTest = ::testing::TestWithParam; + +void DiagnosticsMessageHandler(spv_message_level_t level, const char*, + const spv_position_t& position, + const char* message) { + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: " << position.index << ": " << message << std::endl; + break; + case SPV_MSG_WARNING: + std::cout << "warning: " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_INFO: + std::cout << "info: " << position.index << ": " << message << std::endl; + break; + default: + break; + } +} + +// Compiles |code| to SPIR-V |words|. +void Compile(const std::string& code, std::vector* words, + uint32_t options = SPV_TEXT_TO_BINARY_OPTION_NONE, + spv_target_env env = SPV_ENV_UNIVERSAL_1_2) { + ScopedContext ctx(env); + SetContextMessageConsumer(ctx.context, DiagnosticsMessageHandler); + + spv_binary spirv_binary; + ASSERT_EQ(SPV_SUCCESS, + spvTextToBinaryWithOptions(ctx.context, code.c_str(), code.size(), + options, &spirv_binary, nullptr)); + + *words = std::vector(spirv_binary->code, + spirv_binary->code + spirv_binary->wordCount); + + spvBinaryDestroy(spirv_binary); +} + +// Disassembles SPIR-V |words| to |out_text|. +void Disassemble(const std::vector& words, std::string* out_text, + spv_target_env env = SPV_ENV_UNIVERSAL_1_2) { + ScopedContext ctx(env); + SetContextMessageConsumer(ctx.context, DiagnosticsMessageHandler); + + spv_text text = nullptr; + ASSERT_EQ(SPV_SUCCESS, spvBinaryToText(ctx.context, words.data(), + words.size(), 0, &text, nullptr)); + assert(text); + + *out_text = std::string(text->str, text->length); + spvTextDestroy(text); +} + +// Encodes/decodes |original|, assembles/dissasembles |original|, then compares +// the results of the two operations. +void TestEncodeDecode(MarkvModelType model_type, + const std::string& original_text) { + ScopedContext ctx(SPV_ENV_UNIVERSAL_1_2); + std::unique_ptr model = CreateMarkvModel(model_type); + MarkvCodecOptions options; + + std::vector expected_binary; + Compile(original_text, &expected_binary); + ASSERT_FALSE(expected_binary.empty()); + + std::string expected_text; + Disassemble(expected_binary, &expected_text); + ASSERT_FALSE(expected_text.empty()); + + std::vector binary_to_encode; + Compile(original_text, &binary_to_encode, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_FALSE(binary_to_encode.empty()); + + std::stringstream encoder_comments; + const auto output_to_string_stream = + [&encoder_comments](const std::string& str) { encoder_comments << str; }; + + std::vector markv; + ASSERT_EQ(SPV_SUCCESS, + SpirvToMarkv(ctx.context, binary_to_encode, options, *model, + DiagnosticsMessageHandler, output_to_string_stream, + MarkvDebugConsumer(), &markv)); + ASSERT_FALSE(markv.empty()); + + std::vector decoded_binary; + ASSERT_EQ(SPV_SUCCESS, + MarkvToSpirv(ctx.context, markv, options, *model, + DiagnosticsMessageHandler, MarkvLogConsumer(), + MarkvDebugConsumer(), &decoded_binary)); + ASSERT_FALSE(decoded_binary.empty()); + + EXPECT_EQ(expected_binary, decoded_binary) << encoder_comments.str(); + + std::string decoded_text; + Disassemble(decoded_binary, &decoded_text); + ASSERT_FALSE(decoded_text.empty()); + + EXPECT_EQ(expected_text, decoded_text) << encoder_comments.str(); +} + +void TestEncodeDecodeShaderMainBody(MarkvModelType model_type, + const std::string& body) { + const std::string prefix = + R"( +OpCapability Shader +OpCapability Int64 +OpCapability Float64 +%ext_inst = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%boolvec2 = OpTypeVector %bool 2 +%s32vec2 = OpTypeVector %s32 2 +%u32vec2 = OpTypeVector %u32 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%s32vec3 = OpTypeVector %s32 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%s32vec4 = OpTypeVector %s32 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_pi = OpConstant %f32 3.14159 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 +%s32_4 = OpConstant %s32 4 +%s32_m1 = OpConstant %s32 -1 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 +%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string suffix = + R"( +OpReturn +OpFunctionEnd)"; + + TestEncodeDecode(model_type, prefix + body + suffix); +} + +TEST_P(MarkvTest, U32Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%u32 = OpTypeInt 32 0 +%100 = OpConstant %u32 0 +%200 = OpConstant %u32 1 +%300 = OpConstant %u32 4294967295 +)"); +} + +TEST_P(MarkvTest, S32Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%s32 = OpTypeInt 32 1 +%100 = OpConstant %s32 0 +%200 = OpConstant %s32 1 +%300 = OpConstant %s32 -1 +%400 = OpConstant %s32 2147483647 +%500 = OpConstant %s32 -2147483648 +)"); +} + +TEST_P(MarkvTest, U64Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Logical GLSL450 +%u64 = OpTypeInt 64 0 +%100 = OpConstant %u64 0 +%200 = OpConstant %u64 1 +%300 = OpConstant %u64 18446744073709551615 +)"); +} + +TEST_P(MarkvTest, S64Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Logical GLSL450 +%s64 = OpTypeInt 64 1 +%100 = OpConstant %s64 0 +%200 = OpConstant %s64 1 +%300 = OpConstant %s64 -1 +%400 = OpConstant %s64 9223372036854775807 +%500 = OpConstant %s64 -9223372036854775808 +)"); +} + +TEST_P(MarkvTest, U16Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpCapability Int16 +OpMemoryModel Logical GLSL450 +%u16 = OpTypeInt 16 0 +%100 = OpConstant %u16 0 +%200 = OpConstant %u16 1 +%300 = OpConstant %u16 65535 +)"); +} + +TEST_P(MarkvTest, S16Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpCapability Int16 +OpMemoryModel Logical GLSL450 +%s16 = OpTypeInt 16 1 +%100 = OpConstant %s16 0 +%200 = OpConstant %s16 1 +%300 = OpConstant %s16 -1 +%400 = OpConstant %s16 32767 +%500 = OpConstant %s16 -32768 +)"); +} + +TEST_P(MarkvTest, F32Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%f32 = OpTypeFloat 32 +%100 = OpConstant %f32 0 +%200 = OpConstant %f32 1 +%300 = OpConstant %f32 0.1 +%400 = OpConstant %f32 -0.1 +)"); +} + +TEST_P(MarkvTest, F64Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpCapability Float64 +OpMemoryModel Logical GLSL450 +%f64 = OpTypeFloat 64 +%100 = OpConstant %f64 0 +%200 = OpConstant %f64 1 +%300 = OpConstant %f64 0.1 +%400 = OpConstant %f64 -0.1 +)"); +} + +TEST_P(MarkvTest, F16Literal) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpCapability Float16 +OpMemoryModel Logical GLSL450 +%f16 = OpTypeFloat 16 +%100 = OpConstant %f16 0 +%200 = OpConstant %f16 1 +%300 = OpConstant %f16 0.1 +%400 = OpConstant %f16 -0.1 +)"); +} + +TEST_P(MarkvTest, StringLiteral) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_KHR_16bit_storage" +OpExtension "xxx" +OpExtension "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +OpExtension "" +OpMemoryModel Logical GLSL450 +)"); +} + +TEST_P(MarkvTest, WithFunction) { + TestEncodeDecode(GetParam(), R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpExtension "SPV_KHR_16bit_storage" +OpMemoryModel Physical32 OpenCL +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%void = OpTypeVoid +%void_func = OpTypeFunction %void +%100 = OpConstant %u32 1 +%200 = OpConstant %u32 2 +%main = OpFunction %void None %void_func +%entry_main = OpLabel +%300 = OpIAdd %u32 %100 %200 +OpReturn +OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, WithMultipleFunctions) { + TestEncodeDecode(GetParam(), R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%f32 = OpTypeFloat 32 +%one = OpConstant %f32 1 +%void = OpTypeVoid +%void_func = OpTypeFunction %void +%f32_func = OpTypeFunction %f32 %f32 +%sqr_plus_one = OpFunction %f32 None %f32_func +%x = OpFunctionParameter %f32 +%100 = OpLabel +%x2 = OpFMul %f32 %x %x +%x2p1 = OpFunctionCall %f32 %plus_one %x2 +OpReturnValue %x2p1 +OpFunctionEnd +%plus_one = OpFunction %f32 None %f32_func +%y = OpFunctionParameter %f32 +%200 = OpLabel +%yp1 = OpFAdd %f32 %y %one +OpReturnValue %yp1 +OpFunctionEnd +%main = OpFunction %void None %void_func +%entry_main = OpLabel +%1p1 = OpFunctionCall %f32 %sqr_plus_one %one +OpReturn +OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, ForwardDeclaredId) { + TestEncodeDecode(GetParam(), R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %1 "simple_kernel" +%2 = OpTypeInt 32 0 +%3 = OpTypeVector %2 2 +%4 = OpConstant %2 2 +%5 = OpTypeArray %2 %4 +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%1 = OpFunction %6 None %7 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, WithSwitch) { + TestEncodeDecode(GetParam(), R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Physical32 OpenCL +%u64 = OpTypeInt 64 0 +%void = OpTypeVoid +%void_func = OpTypeFunction %void +%val = OpConstant %u64 1 +%main = OpFunction %void None %void_func +%entry_main = OpLabel +OpSwitch %val %default 1 %case1 1000000000000 %case2 +%case1 = OpLabel +OpNop +OpBranch %after_switch +%case2 = OpLabel +OpNop +OpBranch %after_switch +%default = OpLabel +OpNop +OpBranch %after_switch +%after_switch = OpLabel +OpReturn +OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, WithLoop) { + TestEncodeDecode(GetParam(), R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%void = OpTypeVoid +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%entry_main = OpLabel +OpLoopMerge %merge %continue DontUnroll|DependencyLength 10 +OpBranch %begin_loop +%begin_loop = OpLabel +OpNop +OpBranch %continue +%continue = OpLabel +OpNop +OpBranch %begin_loop +%merge = OpLabel +OpReturn +OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, WithDecorate) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 ArrayStride 4 +OpDecorate %1 Uniform +%2 = OpTypeFloat 32 +%1 = OpTypeRuntimeArray %2 +)"); +} + +TEST_P(MarkvTest, WithExtInst) { + TestEncodeDecode(GetParam(), R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +%opencl = OpExtInstImport "OpenCL.std" +OpMemoryModel Physical32 OpenCL +%f32 = OpTypeFloat 32 +%void = OpTypeVoid +%void_func = OpTypeFunction %void +%100 = OpConstant %f32 1.1 +%main = OpFunction %void None %void_func +%entry_main = OpLabel +%200 = OpExtInst %f32 %opencl cos %100 +OpReturn +OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, F32Mul) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%val1 = OpFMul %f32 %f32_0 %f32_1 +%val2 = OpFMul %f32 %f32_2 %f32_0 +%val3 = OpFMul %f32 %f32_pi %f32_2 +%val4 = OpFMul %f32 %f32_1 %f32_1 +)"); +} + +TEST_P(MarkvTest, U32Mul) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%val1 = OpIMul %u32 %u32_0 %u32_1 +%val2 = OpIMul %u32 %u32_2 %u32_0 +%val3 = OpIMul %u32 %u32_3 %u32_2 +%val4 = OpIMul %u32 %u32_1 %u32_1 +)"); +} + +TEST_P(MarkvTest, S32Mul) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%val1 = OpIMul %s32 %s32_0 %s32_1 +%val2 = OpIMul %s32 %s32_2 %s32_0 +%val3 = OpIMul %s32 %s32_m1 %s32_2 +%val4 = OpIMul %s32 %s32_1 %s32_1 +)"); +} + +TEST_P(MarkvTest, F32Add) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%val1 = OpFAdd %f32 %f32_0 %f32_1 +%val2 = OpFAdd %f32 %f32_2 %f32_0 +%val3 = OpFAdd %f32 %f32_pi %f32_2 +%val4 = OpFAdd %f32 %f32_1 %f32_1 +)"); +} + +TEST_P(MarkvTest, U32Add) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%val1 = OpIAdd %u32 %u32_0 %u32_1 +%val2 = OpIAdd %u32 %u32_2 %u32_0 +%val3 = OpIAdd %u32 %u32_3 %u32_2 +%val4 = OpIAdd %u32 %u32_1 %u32_1 +)"); +} + +TEST_P(MarkvTest, S32Add) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%val1 = OpIAdd %s32 %s32_0 %s32_1 +%val2 = OpIAdd %s32 %s32_2 %s32_0 +%val3 = OpIAdd %s32 %s32_m1 %s32_2 +%val4 = OpIAdd %s32 %s32_1 %s32_1 +)"); +} + +TEST_P(MarkvTest, F32Dot) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%dot2_1 = OpDot %f32 %f32vec2_01 %f32vec2_12 +%dot2_2 = OpDot %f32 %f32vec2_01 %f32vec2_01 +%dot2_3 = OpDot %f32 %f32vec2_12 %f32vec2_12 +%dot3_1 = OpDot %f32 %f32vec3_012 %f32vec3_123 +%dot3_2 = OpDot %f32 %f32vec3_012 %f32vec3_012 +%dot3_3 = OpDot %f32 %f32vec3_123 %f32vec3_123 +%dot4_1 = OpDot %f32 %f32vec4_0123 %f32vec4_1234 +%dot4_2 = OpDot %f32 %f32vec4_0123 %f32vec4_0123 +%dot4_3 = OpDot %f32 %f32vec4_1234 %f32vec4_1234 +)"); +} + +TEST_P(MarkvTest, F32VectorCompositeConstruct) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%cc1 = OpCompositeConstruct %f32vec4 %f32vec2_01 %f32vec2_12 +%cc2 = OpCompositeConstruct %f32vec3 %f32vec2_01 %f32_2 +%cc3 = OpCompositeConstruct %f32vec2 %f32_1 %f32_2 +%cc4 = OpCompositeConstruct %f32vec4 %f32_1 %f32_2 %cc3 +)"); +} + +TEST_P(MarkvTest, U32VectorCompositeConstruct) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%cc1 = OpCompositeConstruct %u32vec4 %u32vec2_01 %u32vec2_12 +%cc2 = OpCompositeConstruct %u32vec3 %u32vec2_01 %u32_2 +%cc3 = OpCompositeConstruct %u32vec2 %u32_1 %u32_2 +%cc4 = OpCompositeConstruct %u32vec4 %u32_1 %u32_2 %cc3 +)"); +} + +TEST_P(MarkvTest, S32VectorCompositeConstruct) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%cc1 = OpCompositeConstruct %u32vec4 %u32vec2_01 %u32vec2_12 +%cc2 = OpCompositeConstruct %u32vec3 %u32vec2_01 %u32_2 +%cc3 = OpCompositeConstruct %u32vec2 %u32_1 %u32_2 +%cc4 = OpCompositeConstruct %u32vec4 %u32_1 %u32_2 %cc3 +)"); +} + +TEST_P(MarkvTest, F32VectorCompositeExtract) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 +%f32vec3_013 = OpCompositeExtract %f32vec3 %f32vec4_0123 0 1 3 +)"); +} + +TEST_P(MarkvTest, F32VectorComparison) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 +%c1 = OpFOrdEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c2 = OpFUnordEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c3 = OpFOrdNotEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c4 = OpFUnordNotEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c5 = OpFOrdLessThan %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c6 = OpFUnordLessThan %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c7 = OpFOrdGreaterThan %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c8 = OpFUnordGreaterThan %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c9 = OpFOrdLessThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c10 = OpFUnordLessThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c11 = OpFOrdGreaterThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +%c12 = OpFUnordGreaterThanEqual %boolvec4 %f32vec4_0123 %f32vec4_3210 +)"); +} + +TEST_P(MarkvTest, VectorShuffle) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 +%sh1 = OpVectorShuffle %f32vec2 %f32vec4_0123 %f32vec4_3210 3 6 +%sh2 = OpVectorShuffle %f32vec3 %f32vec2_01 %f32vec4_3210 0 3 4 +)"); +} + +TEST_P(MarkvTest, VectorTimesScalar) { + TestEncodeDecodeShaderMainBody(GetParam(), R"( +%f32vec4_3210 = OpCompositeConstruct %f32vec4 %f32_3 %f32_2 %f32_1 %f32_0 +%res1 = OpVectorTimesScalar %f32vec4 %f32vec4_0123 %f32_2 +%res2 = OpVectorTimesScalar %f32vec4 %f32vec4_3210 %f32_2 +)"); +} + +TEST_P(MarkvTest, SpirvSpecSample) { + TestEncodeDecode(GetParam(), R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %31 %33 %42 %57 + OpExecutionMode %4 OriginLowerLeft + +; Debug information + OpSource GLSL 450 + OpName %4 "main" + OpName %9 "scale" + OpName %17 "S" + OpMemberName %17 0 "b" + OpMemberName %17 1 "v" + OpMemberName %17 2 "i" + OpName %18 "blockName" + OpMemberName %18 0 "s" + OpMemberName %18 1 "cond" + OpName %20 "" + OpName %31 "color" + OpName %33 "color1" + OpName %42 "color2" + OpName %48 "i" + OpName %57 "multiplier" + +; Annotations (non-debug) + OpDecorate %15 ArrayStride 16 + OpMemberDecorate %17 0 Offset 0 + OpMemberDecorate %17 1 Offset 16 + OpMemberDecorate %17 2 Offset 96 + OpMemberDecorate %18 0 Offset 0 + OpMemberDecorate %18 1 Offset 112 + OpDecorate %18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %42 NoPerspective + +; All types, variables, and constants + %2 = OpTypeVoid + %3 = OpTypeFunction %2 ; void () + %6 = OpTypeFloat 32 ; 32-bit float + %7 = OpTypeVector %6 4 ; vec4 + %8 = OpTypePointer Function %7 ; function-local vec4* + %10 = OpConstant %6 1 + %11 = OpConstant %6 2 + %12 = OpConstantComposite %7 %10 %10 %11 %10 ; vec4(1.0, 1.0, 2.0, 1.0) + %13 = OpTypeInt 32 0 ; 32-bit int, sign-less + %14 = OpConstant %13 5 + %15 = OpTypeArray %7 %14 + %16 = OpTypeInt 32 1 + %17 = OpTypeStruct %13 %15 %16 + %18 = OpTypeStruct %17 %13 + %19 = OpTypePointer Uniform %18 + %20 = OpVariable %19 Uniform + %21 = OpConstant %16 1 + %22 = OpTypePointer Uniform %13 + %25 = OpTypeBool + %26 = OpConstant %13 0 + %30 = OpTypePointer Output %7 + %31 = OpVariable %30 Output + %32 = OpTypePointer Input %7 + %33 = OpVariable %32 Input + %35 = OpConstant %16 0 + %36 = OpConstant %16 2 + %37 = OpTypePointer Uniform %7 + %42 = OpVariable %32 Input + %47 = OpTypePointer Function %16 + %55 = OpConstant %16 4 + %57 = OpVariable %32 Input + +; All functions + %4 = OpFunction %2 None %3 ; main() + %5 = OpLabel + %9 = OpVariable %8 Function + %48 = OpVariable %47 Function + OpStore %9 %12 + %23 = OpAccessChain %22 %20 %21 ; location of cond + %24 = OpLoad %13 %23 ; load 32-bit int from cond + %27 = OpINotEqual %25 %24 %26 ; convert to bool + OpSelectionMerge %29 None ; structured if + OpBranchConditional %27 %28 %41 ; if cond + %28 = OpLabel ; then + %34 = OpLoad %7 %33 + %38 = OpAccessChain %37 %20 %35 %21 %36 ; s.v[2] + %39 = OpLoad %7 %38 + %40 = OpFAdd %7 %34 %39 + OpStore %31 %40 + OpBranch %29 + %41 = OpLabel ; else + %43 = OpLoad %7 %42 + %44 = OpExtInst %7 %1 Sqrt %43 ; extended instruction sqrt + %45 = OpLoad %7 %9 + %46 = OpFMul %7 %44 %45 + OpStore %31 %46 + OpBranch %29 + %29 = OpLabel ; endif + OpStore %48 %35 + OpBranch %49 + %49 = OpLabel + OpLoopMerge %51 %52 None ; structured loop + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %16 %48 + %56 = OpSLessThan %25 %54 %55 ; i < 4 ? + OpBranchConditional %56 %50 %51 ; body or break + %50 = OpLabel ; body + %58 = OpLoad %7 %57 + %59 = OpLoad %7 %31 + %60 = OpFMul %7 %59 %58 + OpStore %31 %60 + OpBranch %52 + %52 = OpLabel ; continue target + %61 = OpLoad %16 %48 + %62 = OpIAdd %16 %61 %21 ; ++i + OpStore %48 %62 + OpBranch %49 ; loop back + %51 = OpLabel ; loop merge point + OpReturn + OpFunctionEnd +)"); +} + +TEST_P(MarkvTest, SampleFromDeadBranchEliminationTest) { + TestEncodeDecode(GetParam(), R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%main = OpFunction %void None %5 +%17 = OpLabel +OpSelectionMerge %18 None +OpBranchConditional %true %19 %20 +%19 = OpLabel +OpBranch %18 +%20 = OpLabel +OpBranch %18 +%18 = OpLabel +%21 = OpPhi %v4float %12 %19 %14 %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"); +} + +INSTANTIATE_TEST_CASE_P(AllMarkvModels, MarkvTest, + ::testing::ValuesIn(std::vector{ + kMarkvModelShaderLite, + kMarkvModelShaderMid, + kMarkvModelShaderMax, + }), ); + +} // namespace +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/cpp_interface_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/cpp_interface_test.cpp new file mode 100644 index 00000000000..bcc2cd6c75c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/cpp_interface_test.cpp @@ -0,0 +1,323 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "spirv-tools/optimizer.hpp" +#include "spirv/1.1/spirv.h" + +namespace spvtools { +namespace { + +using ::testing::ContainerEq; +using ::testing::HasSubstr; + +// Return a string that contains the minimum instructions needed to form +// a valid module. Other instructions can be appended to this string. +std::string Header() { + return R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; +} + +TEST(CppInterface, SuccessfulRoundTrip) { + const std::string input_text = "%2 = OpSizeOf %1 %3\n"; + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + + std::vector binary; + EXPECT_TRUE(t.Assemble(input_text, &binary)); + EXPECT_TRUE(binary.size() > 5u); + EXPECT_EQ(SpvMagicNumber, binary[0]); + EXPECT_EQ(SpvVersion, binary[1]); + + // This cannot pass validation since %1 is not defined. + t.SetMessageConsumer([](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + EXPECT_EQ(SPV_MSG_ERROR, level); + EXPECT_STREQ("input", source); + EXPECT_EQ(0u, position.line); + EXPECT_EQ(0u, position.column); + EXPECT_EQ(1u, position.index); + EXPECT_STREQ("ID 1 has not been defined\n %2 = OpSizeOf %1 %3\n", message); + }); + EXPECT_FALSE(t.Validate(binary)); + + std::string output_text; + EXPECT_TRUE(t.Disassemble(binary, &output_text)); + EXPECT_EQ(input_text, output_text); +} + +TEST(CppInterface, AssembleEmptyModule) { + std::vector binary(10, 42); + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + EXPECT_TRUE(t.Assemble("", &binary)); + // We only have the header. + EXPECT_EQ(5u, binary.size()); + EXPECT_EQ(SpvMagicNumber, binary[0]); + EXPECT_EQ(SpvVersion, binary[1]); +} + +TEST(CppInterface, AssembleOverloads) { + const std::string input_text = "%2 = OpSizeOf %1 %3\n"; + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + { + std::vector binary; + EXPECT_TRUE(t.Assemble(input_text, &binary)); + EXPECT_TRUE(binary.size() > 5u); + EXPECT_EQ(SpvMagicNumber, binary[0]); + EXPECT_EQ(SpvVersion, binary[1]); + } + { + std::vector binary; + EXPECT_TRUE(t.Assemble(input_text.data(), input_text.size(), &binary)); + EXPECT_TRUE(binary.size() > 5u); + EXPECT_EQ(SpvMagicNumber, binary[0]); + EXPECT_EQ(SpvVersion, binary[1]); + } + { // Ignore the last newline. + std::vector binary; + EXPECT_TRUE(t.Assemble(input_text.data(), input_text.size() - 1, &binary)); + EXPECT_TRUE(binary.size() > 5u); + EXPECT_EQ(SpvMagicNumber, binary[0]); + EXPECT_EQ(SpvVersion, binary[1]); + } +} + +TEST(CppInterface, DisassembleEmptyModule) { + std::string text(10, 'x'); + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + int invocation_count = 0; + t.SetMessageConsumer( + [&invocation_count](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + ++invocation_count; + EXPECT_EQ(SPV_MSG_ERROR, level); + EXPECT_STREQ("input", source); + EXPECT_EQ(0u, position.line); + EXPECT_EQ(0u, position.column); + EXPECT_EQ(0u, position.index); + EXPECT_STREQ("Missing module.", message); + }); + EXPECT_FALSE(t.Disassemble({}, &text)); + EXPECT_EQ("xxxxxxxxxx", text); // The original string is unmodified. + EXPECT_EQ(1, invocation_count); +} + +TEST(CppInterface, DisassembleOverloads) { + const std::string input_text = "%2 = OpSizeOf %1 %3\n"; + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + + std::vector binary; + EXPECT_TRUE(t.Assemble(input_text, &binary)); + + { + std::string output_text; + EXPECT_TRUE(t.Disassemble(binary, &output_text)); + EXPECT_EQ(input_text, output_text); + } + { + std::string output_text; + EXPECT_TRUE(t.Disassemble(binary.data(), binary.size(), &output_text)); + EXPECT_EQ(input_text, output_text); + } +} + +TEST(CppInterface, SuccessfulValidation) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + int invocation_count = 0; + t.SetMessageConsumer([&invocation_count](spv_message_level_t, const char*, + const spv_position_t&, const char*) { + ++invocation_count; + }); + + std::vector binary; + EXPECT_TRUE(t.Assemble(Header(), &binary)); + EXPECT_TRUE(t.Validate(binary)); + EXPECT_EQ(0, invocation_count); +} + +TEST(CppInterface, ValidateOverloads) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::vector binary; + EXPECT_TRUE(t.Assemble(Header(), &binary)); + + { EXPECT_TRUE(t.Validate(binary)); } + { EXPECT_TRUE(t.Validate(binary.data(), binary.size())); } +} + +TEST(CppInterface, ValidateEmptyModule) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + int invocation_count = 0; + t.SetMessageConsumer( + [&invocation_count](spv_message_level_t level, const char* source, + const spv_position_t& position, const char* message) { + ++invocation_count; + EXPECT_EQ(SPV_MSG_ERROR, level); + EXPECT_STREQ("input", source); + EXPECT_EQ(0u, position.line); + EXPECT_EQ(0u, position.column); + EXPECT_EQ(0u, position.index); + EXPECT_STREQ("Invalid SPIR-V magic number.", message); + }); + EXPECT_FALSE(t.Validate({})); + EXPECT_EQ(1, invocation_count); +} + +// Returns the assembly for a SPIR-V module with a struct declaration +// with the given number of members. +std::string MakeModuleHavingStruct(int num_members) { + std::stringstream os; + os << Header(); + os << R"(%1 = OpTypeInt 32 0 + %2 = OpTypeStruct)"; + for (int i = 0; i < num_members; i++) os << " %1"; + return os.str(); +} + +TEST(CppInterface, ValidateWithOptionsPass) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::vector binary; + EXPECT_TRUE(t.Assemble(MakeModuleHavingStruct(10), &binary)); + const ValidatorOptions opts; + + EXPECT_TRUE(t.Validate(binary.data(), binary.size(), opts)); +} + +TEST(CppInterface, ValidateWithOptionsFail) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::vector binary; + EXPECT_TRUE(t.Assemble(MakeModuleHavingStruct(10), &binary)); + ValidatorOptions opts; + opts.SetUniversalLimit(spv_validator_limit_max_struct_members, 9); + std::stringstream os; + t.SetMessageConsumer([&os](spv_message_level_t, const char*, + const spv_position_t&, + const char* message) { os << message; }); + + EXPECT_FALSE(t.Validate(binary.data(), binary.size(), opts)); + EXPECT_THAT( + os.str(), + HasSubstr( + "Number of OpTypeStruct members (10) has exceeded the limit (9)")); +} + +// Checks that after running the given optimizer |opt| on the given |original| +// source code, we can get the given |optimized| source code. +void CheckOptimization(const std::string& original, + const std::string& optimized, const Optimizer& opt) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::vector original_binary; + ASSERT_TRUE(t.Assemble(original, &original_binary)); + + std::vector optimized_binary; + EXPECT_TRUE(opt.Run(original_binary.data(), original_binary.size(), + &optimized_binary)); + + std::string optimized_text; + EXPECT_TRUE(t.Disassemble(optimized_binary, &optimized_text)); + EXPECT_EQ(optimized, optimized_text); +} + +TEST(CppInterface, OptimizeEmptyModule) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::vector binary; + EXPECT_TRUE(t.Assemble("", &binary)); + + Optimizer o(SPV_ENV_UNIVERSAL_1_1); + o.RegisterPass(CreateStripDebugInfoPass()); + + // Fails to validate. + EXPECT_FALSE(o.Run(binary.data(), binary.size(), &binary)); +} + +TEST(CppInterface, OptimizeModifiedModule) { + Optimizer o(SPV_ENV_UNIVERSAL_1_1); + o.RegisterPass(CreateStripDebugInfoPass()); + CheckOptimization(Header() + "OpSource GLSL 450", Header(), o); +} + +TEST(CppInterface, OptimizeMulitplePasses) { + std::string original_text = Header() + + "OpSource GLSL 450 " + "OpDecorate %true SpecId 1 " + "%bool = OpTypeBool " + "%true = OpSpecConstantTrue %bool"; + + Optimizer o(SPV_ENV_UNIVERSAL_1_1); + o.RegisterPass(CreateStripDebugInfoPass()) + .RegisterPass(CreateFreezeSpecConstantValuePass()); + + std::string expected_text = Header() + + "%bool = OpTypeBool\n" + "%true = OpConstantTrue %bool\n"; + + CheckOptimization(original_text, expected_text, o); +} + +TEST(CppInterface, OptimizeDoNothingWithPassToken) { + CreateFreezeSpecConstantValuePass(); + auto token = CreateUnifyConstantPass(); +} + +TEST(CppInterface, OptimizeReassignPassToken) { + auto token = CreateNullPass(); + token = CreateStripDebugInfoPass(); + + CheckOptimization( + Header() + "OpSource GLSL 450", Header(), + Optimizer(SPV_ENV_UNIVERSAL_1_1).RegisterPass(std::move(token))); +} + +TEST(CppInterface, OptimizeMoveConstructPassToken) { + auto token1 = CreateStripDebugInfoPass(); + Optimizer::PassToken token2(std::move(token1)); + + CheckOptimization( + Header() + "OpSource GLSL 450", Header(), + Optimizer(SPV_ENV_UNIVERSAL_1_1).RegisterPass(std::move(token2))); +} + +TEST(CppInterface, OptimizeMoveAssignPassToken) { + auto token1 = CreateStripDebugInfoPass(); + auto token2 = CreateNullPass(); + token2 = std::move(token1); + + CheckOptimization( + Header() + "OpSource GLSL 450", Header(), + Optimizer(SPV_ENV_UNIVERSAL_1_1).RegisterPass(std::move(token2))); +} + +TEST(CppInterface, OptimizeSameAddressForOriginalOptimizedBinary) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::vector binary; + ASSERT_TRUE(t.Assemble(Header() + "OpSource GLSL 450", &binary)); + + EXPECT_TRUE(Optimizer(SPV_ENV_UNIVERSAL_1_1) + .RegisterPass(CreateStripDebugInfoPass()) + .Run(binary.data(), binary.size(), &binary)); + + std::string optimized_text; + EXPECT_TRUE(t.Disassemble(binary, &optimized_text)); + EXPECT_EQ(Header(), optimized_text); +} + +// TODO(antiagainst): tests for SetMessageConsumer(). + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/diagnostic_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/diagnostic_test.cpp new file mode 100644 index 00000000000..f86bae11300 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/diagnostic_test.cpp @@ -0,0 +1,150 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::testing::Eq; + +// Returns a newly created diagnostic value. +spv_diagnostic MakeValidDiagnostic() { + spv_position_t position = {}; + spv_diagnostic diagnostic = spvDiagnosticCreate(&position, ""); + EXPECT_NE(nullptr, diagnostic); + return diagnostic; +} + +TEST(Diagnostic, DestroyNull) { spvDiagnosticDestroy(nullptr); } + +TEST(Diagnostic, DestroyValidDiagnostic) { + spv_diagnostic diagnostic = MakeValidDiagnostic(); + spvDiagnosticDestroy(diagnostic); + // We aren't allowed to use the diagnostic pointer anymore. + // So we can't test its behaviour. +} + +TEST(Diagnostic, DestroyValidDiagnosticAfterReassignment) { + spv_diagnostic diagnostic = MakeValidDiagnostic(); + spv_diagnostic second_diagnostic = MakeValidDiagnostic(); + EXPECT_TRUE(diagnostic != second_diagnostic); + spvDiagnosticDestroy(diagnostic); + diagnostic = second_diagnostic; + spvDiagnosticDestroy(diagnostic); +} + +TEST(Diagnostic, PrintDefault) { + char message[] = "Test Diagnostic!"; + spv_diagnostic_t diagnostic = {{2, 3, 5}, message}; + // TODO: Redirect stderr + ASSERT_EQ(SPV_SUCCESS, spvDiagnosticPrint(&diagnostic)); + // TODO: Validate the output of spvDiagnosticPrint() + // TODO: Remove the redirection of stderr +} + +TEST(Diagnostic, PrintInvalidDiagnostic) { + ASSERT_EQ(SPV_ERROR_INVALID_DIAGNOSTIC, spvDiagnosticPrint(nullptr)); +} + +// TODO(dneto): We should be able to redirect the diagnostic printing. +// Once we do that, we can test diagnostic corner cases. + +TEST(DiagnosticStream, ConversionToResultType) { + // Check after the DiagnosticStream object is destroyed. + spv_result_t value; + { value = DiagnosticStream({}, nullptr, "", SPV_ERROR_INVALID_TEXT); } + EXPECT_EQ(SPV_ERROR_INVALID_TEXT, value); + + // Check implicit conversion via plain assignment. + value = DiagnosticStream({}, nullptr, "", SPV_SUCCESS); + EXPECT_EQ(SPV_SUCCESS, value); + + // Check conversion via constructor. + EXPECT_EQ(SPV_FAILED_MATCH, + spv_result_t(DiagnosticStream({}, nullptr, "", SPV_FAILED_MATCH))); +} + +TEST( + DiagnosticStream, + MoveConstructorPreservesPreviousMessagesAndPreventsOutputFromExpiringValue) { + std::ostringstream messages; + int message_count = 0; + auto consumer = [&messages, &message_count](spv_message_level_t, const char*, + const spv_position_t&, + const char* msg) { + message_count++; + messages << msg; + }; + + // Enclose the DiagnosticStream variables in a scope to force destruction. + { + DiagnosticStream ds0({}, consumer, "", SPV_ERROR_INVALID_BINARY); + ds0 << "First"; + DiagnosticStream ds1(std::move(ds0)); + ds1 << "Second"; + } + EXPECT_THAT(message_count, Eq(1)); + EXPECT_THAT(messages.str(), Eq("FirstSecond")); +} + +TEST(DiagnosticStream, MoveConstructorCanBeDirectlyShiftedTo) { + std::ostringstream messages; + int message_count = 0; + auto consumer = [&messages, &message_count](spv_message_level_t, const char*, + const spv_position_t&, + const char* msg) { + message_count++; + messages << msg; + }; + + // Enclose the DiagnosticStream variables in a scope to force destruction. + { + DiagnosticStream ds0({}, consumer, "", SPV_ERROR_INVALID_BINARY); + ds0 << "First"; + std::move(ds0) << "Second"; + } + EXPECT_THAT(message_count, Eq(1)); + EXPECT_THAT(messages.str(), Eq("FirstSecond")); +} + +TEST(DiagnosticStream, DiagnosticFromLambdaReturnCanStillBeUsed) { + std::ostringstream messages; + int message_count = 0; + auto consumer = [&messages, &message_count](spv_message_level_t, const char*, + const spv_position_t&, + const char* msg) { + message_count++; + messages << msg; + }; + + { + auto emitter = [&consumer]() -> DiagnosticStream { + DiagnosticStream ds0({}, consumer, "", SPV_ERROR_INVALID_BINARY); + ds0 << "First"; + return ds0; + }; + emitter() << "Second"; + } + EXPECT_THAT(message_count, Eq(1)); + EXPECT_THAT(messages.str(), Eq("FirstSecond")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/enum_set_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/enum_set_test.cpp new file mode 100644 index 00000000000..ddacd421477 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/enum_set_test.cpp @@ -0,0 +1,290 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/enum_set.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::ElementsIn; +using ::testing::Eq; +using ::testing::ValuesIn; + +TEST(EnumSet, IsEmpty1) { + EnumSet set; + EXPECT_TRUE(set.IsEmpty()); + set.Add(0); + EXPECT_FALSE(set.IsEmpty()); +} + +TEST(EnumSet, IsEmpty2) { + EnumSet set; + EXPECT_TRUE(set.IsEmpty()); + set.Add(150); + EXPECT_FALSE(set.IsEmpty()); +} + +TEST(EnumSet, IsEmpty3) { + EnumSet set(4); + EXPECT_FALSE(set.IsEmpty()); +} + +TEST(EnumSet, IsEmpty4) { + EnumSet set(300); + EXPECT_FALSE(set.IsEmpty()); +} + +TEST(EnumSetHasAnyOf, EmptySetEmptyQuery) { + const EnumSet set; + const EnumSet empty; + EXPECT_TRUE(set.HasAnyOf(empty)); + EXPECT_TRUE(EnumSet().HasAnyOf(EnumSet())); +} + +TEST(EnumSetHasAnyOf, MaskSetEmptyQuery) { + EnumSet set; + const EnumSet empty; + set.Add(5); + set.Add(8); + EXPECT_TRUE(set.HasAnyOf(empty)); +} + +TEST(EnumSetHasAnyOf, OverflowSetEmptyQuery) { + EnumSet set; + const EnumSet empty; + set.Add(200); + set.Add(300); + EXPECT_TRUE(set.HasAnyOf(empty)); +} + +TEST(EnumSetHasAnyOf, EmptyQuery) { + EnumSet set; + const EnumSet empty; + set.Add(5); + set.Add(8); + set.Add(200); + set.Add(300); + EXPECT_TRUE(set.HasAnyOf(empty)); +} + +TEST(EnumSetHasAnyOf, EmptyQueryAlwaysTrue) { + EnumSet set; + const EnumSet empty; + EXPECT_TRUE(set.HasAnyOf(empty)); + set.Add(5); + EXPECT_TRUE(set.HasAnyOf(empty)); + + EXPECT_TRUE(EnumSet(100).HasAnyOf(EnumSet())); +} + +TEST(EnumSetHasAnyOf, ReflexiveMask) { + EnumSet set(3); + set.Add(24); + set.Add(30); + EXPECT_TRUE(set.HasAnyOf(set)); +} + +TEST(EnumSetHasAnyOf, ReflexiveOverflow) { + EnumSet set(200); + set.Add(300); + set.Add(400); + EXPECT_TRUE(set.HasAnyOf(set)); +} + +TEST(EnumSetHasAnyOf, Reflexive) { + EnumSet set(3); + set.Add(24); + set.Add(300); + set.Add(400); + EXPECT_TRUE(set.HasAnyOf(set)); +} + +TEST(EnumSetHasAnyOf, EmptySetHasNone) { + EnumSet set; + EnumSet items; + for (uint32_t i = 0; i < 200; ++i) { + items.Add(i); + EXPECT_FALSE(set.HasAnyOf(items)); + EXPECT_FALSE(set.HasAnyOf(EnumSet(i))); + } +} + +TEST(EnumSetHasAnyOf, MaskSetMaskQuery) { + EnumSet set(0); + EnumSet items(1); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(2); + items.Add(3); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(3); + EXPECT_TRUE(set.HasAnyOf(items)); + set.Add(4); + EXPECT_TRUE(set.HasAnyOf(items)); +} + +TEST(EnumSetHasAnyOf, OverflowSetOverflowQuery) { + EnumSet set(100); + EnumSet items(200); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(300); + items.Add(400); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(200); + EXPECT_TRUE(set.HasAnyOf(items)); + set.Add(500); + EXPECT_TRUE(set.HasAnyOf(items)); +} + +TEST(EnumSetHasAnyOf, GeneralCase) { + EnumSet set(0); + EnumSet items(100); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(300); + items.Add(4); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(5); + items.Add(500); + EXPECT_FALSE(set.HasAnyOf(items)); + set.Add(500); + EXPECT_TRUE(set.HasAnyOf(items)); + EXPECT_FALSE(set.HasAnyOf(EnumSet(20))); + EXPECT_FALSE(set.HasAnyOf(EnumSet(600))); + EXPECT_TRUE(set.HasAnyOf(EnumSet(5))); + EXPECT_TRUE(set.HasAnyOf(EnumSet(300))); + EXPECT_TRUE(set.HasAnyOf(EnumSet(0))); +} + +TEST(EnumSet, DefaultIsEmpty) { + EnumSet set; + for (uint32_t i = 0; i < 1000; ++i) { + EXPECT_FALSE(set.Contains(i)); + } +} + +TEST(CapabilitySet, ConstructSingleMemberMatrix) { + CapabilitySet s(SpvCapabilityMatrix); + EXPECT_TRUE(s.Contains(SpvCapabilityMatrix)); + EXPECT_FALSE(s.Contains(SpvCapabilityShader)); + EXPECT_FALSE(s.Contains(static_cast(1000))); +} + +TEST(CapabilitySet, ConstructSingleMemberMaxInMask) { + CapabilitySet s(static_cast(63)); + EXPECT_FALSE(s.Contains(SpvCapabilityMatrix)); + EXPECT_FALSE(s.Contains(SpvCapabilityShader)); + EXPECT_TRUE(s.Contains(static_cast(63))); + EXPECT_FALSE(s.Contains(static_cast(64))); + EXPECT_FALSE(s.Contains(static_cast(1000))); +} + +TEST(CapabilitySet, ConstructSingleMemberMinOverflow) { + // Check the first one that forces overflow beyond the mask. + CapabilitySet s(static_cast(64)); + EXPECT_FALSE(s.Contains(SpvCapabilityMatrix)); + EXPECT_FALSE(s.Contains(SpvCapabilityShader)); + EXPECT_FALSE(s.Contains(static_cast(63))); + EXPECT_TRUE(s.Contains(static_cast(64))); + EXPECT_FALSE(s.Contains(static_cast(1000))); +} + +TEST(CapabilitySet, ConstructSingleMemberMaxOverflow) { + // Check the max 32-bit signed int. + CapabilitySet s(static_cast(0x7fffffffu)); + EXPECT_FALSE(s.Contains(SpvCapabilityMatrix)); + EXPECT_FALSE(s.Contains(SpvCapabilityShader)); + EXPECT_FALSE(s.Contains(static_cast(1000))); + EXPECT_TRUE(s.Contains(static_cast(0x7fffffffu))); +} + +TEST(CapabilitySet, AddEnum) { + CapabilitySet s(SpvCapabilityShader); + s.Add(SpvCapabilityKernel); + s.Add(static_cast(42)); + EXPECT_FALSE(s.Contains(SpvCapabilityMatrix)); + EXPECT_TRUE(s.Contains(SpvCapabilityShader)); + EXPECT_TRUE(s.Contains(SpvCapabilityKernel)); + EXPECT_TRUE(s.Contains(static_cast(42))); +} + +TEST(CapabilitySet, InitializerListEmpty) { + CapabilitySet s{}; + for (uint32_t i = 0; i < 1000; i++) { + EXPECT_FALSE(s.Contains(static_cast(i))); + } +} + +struct ForEachCase { + CapabilitySet capabilities; + std::vector expected; +}; + +using CapabilitySetForEachTest = ::testing::TestWithParam; + +TEST_P(CapabilitySetForEachTest, CallsAsExpected) { + EXPECT_THAT(ElementsIn(GetParam().capabilities), Eq(GetParam().expected)); +} + +TEST_P(CapabilitySetForEachTest, CopyConstructor) { + CapabilitySet copy(GetParam().capabilities); + EXPECT_THAT(ElementsIn(copy), Eq(GetParam().expected)); +} + +TEST_P(CapabilitySetForEachTest, MoveConstructor) { + // We need a writable copy to move from. + CapabilitySet copy(GetParam().capabilities); + CapabilitySet moved(std::move(copy)); + EXPECT_THAT(ElementsIn(moved), Eq(GetParam().expected)); + + // The moved-from set is empty. + EXPECT_THAT(ElementsIn(copy), Eq(std::vector{})); +} + +TEST_P(CapabilitySetForEachTest, OperatorEquals) { + CapabilitySet assigned = GetParam().capabilities; + EXPECT_THAT(ElementsIn(assigned), Eq(GetParam().expected)); +} + +TEST_P(CapabilitySetForEachTest, OperatorEqualsSelfAssign) { + CapabilitySet assigned{GetParam().capabilities}; + assigned = assigned; + EXPECT_THAT(ElementsIn(assigned), Eq(GetParam().expected)); +} + +INSTANTIATE_TEST_CASE_P(Samples, CapabilitySetForEachTest, + ValuesIn(std::vector{ + {{}, {}}, + {{SpvCapabilityMatrix}, {SpvCapabilityMatrix}}, + {{SpvCapabilityKernel, SpvCapabilityShader}, + {SpvCapabilityShader, SpvCapabilityKernel}}, + {{static_cast(999)}, + {static_cast(999)}}, + {{static_cast(0x7fffffff)}, + {static_cast(0x7fffffff)}}, + // Mixture and out of order + {{static_cast(0x7fffffff), + static_cast(100), + SpvCapabilityShader, SpvCapabilityMatrix}, + {SpvCapabilityMatrix, SpvCapabilityShader, + static_cast(100), + static_cast(0x7fffffff)}}, + }), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp new file mode 100644 index 00000000000..b525d6014ae --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp @@ -0,0 +1,195 @@ +// Copyright (c) 2017 Google 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. + +// Tests for OpExtension validator rules. + +#include +#include +#include + +#include "gtest/gtest.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" + +namespace spvtools { +namespace { + +using ::testing::Values; +using ::testing::ValuesIn; + +using ExtensionTest = + ::testing::TestWithParam>; +using UnknownExtensionTest = ::testing::TestWithParam; +using CapabilityTest = + ::testing::TestWithParam>; + +TEST_P(ExtensionTest, TestExtensionFromString) { + const std::pair& param = GetParam(); + const Extension extension = param.first; + const std::string extension_str = param.second; + Extension result_extension; + ASSERT_TRUE(GetExtensionFromString(extension_str.c_str(), &result_extension)); + EXPECT_EQ(extension, result_extension); +} + +TEST_P(ExtensionTest, TestExtensionToString) { + const std::pair& param = GetParam(); + const Extension extension = param.first; + const std::string extension_str = param.second; + const std::string result_str = ExtensionToString(extension); + EXPECT_EQ(extension_str, result_str); +} + +TEST_P(UnknownExtensionTest, TestExtensionFromStringFails) { + Extension result_extension; + ASSERT_FALSE(GetExtensionFromString(GetParam().c_str(), &result_extension)); +} + +TEST_P(CapabilityTest, TestCapabilityToString) { + const std::pair& param = GetParam(); + const SpvCapability capability = param.first; + const std::string capability_str = param.second; + const std::string result_str = CapabilityToString(capability); + EXPECT_EQ(capability_str, result_str); +} + +INSTANTIATE_TEST_CASE_P( + AllExtensions, ExtensionTest, + ValuesIn(std::vector>({ + {Extension::kSPV_KHR_16bit_storage, "SPV_KHR_16bit_storage"}, + {Extension::kSPV_KHR_device_group, "SPV_KHR_device_group"}, + {Extension::kSPV_KHR_multiview, "SPV_KHR_multiview"}, + {Extension::kSPV_KHR_shader_ballot, "SPV_KHR_shader_ballot"}, + {Extension::kSPV_KHR_shader_draw_parameters, + "SPV_KHR_shader_draw_parameters"}, + {Extension::kSPV_KHR_subgroup_vote, "SPV_KHR_subgroup_vote"}, + {Extension::kSPV_NVX_multiview_per_view_attributes, + "SPV_NVX_multiview_per_view_attributes"}, + {Extension::kSPV_NV_geometry_shader_passthrough, + "SPV_NV_geometry_shader_passthrough"}, + {Extension::kSPV_NV_sample_mask_override_coverage, + "SPV_NV_sample_mask_override_coverage"}, + {Extension::kSPV_NV_stereo_view_rendering, + "SPV_NV_stereo_view_rendering"}, + {Extension::kSPV_NV_viewport_array2, "SPV_NV_viewport_array2"}, + {Extension::kSPV_GOOGLE_decorate_string, "SPV_GOOGLE_decorate_string"}, + {Extension::kSPV_GOOGLE_hlsl_functionality1, + "SPV_GOOGLE_hlsl_functionality1"}, + {Extension::kSPV_KHR_8bit_storage, "SPV_KHR_8bit_storage"}, + }))); + +INSTANTIATE_TEST_CASE_P(UnknownExtensions, UnknownExtensionTest, + Values("", "SPV_KHR_", "SPV_KHR_device_group_ERROR", + /*alphabetically before all extensions*/ "A", + /*alphabetically after all extensions*/ "Z", + "SPV_ERROR_random_string_hfsdklhlktherh")); + +INSTANTIATE_TEST_CASE_P( + AllCapabilities, CapabilityTest, + ValuesIn(std::vector>( + {{SpvCapabilityMatrix, "Matrix"}, + {SpvCapabilityShader, "Shader"}, + {SpvCapabilityGeometry, "Geometry"}, + {SpvCapabilityTessellation, "Tessellation"}, + {SpvCapabilityAddresses, "Addresses"}, + {SpvCapabilityLinkage, "Linkage"}, + {SpvCapabilityKernel, "Kernel"}, + {SpvCapabilityVector16, "Vector16"}, + {SpvCapabilityFloat16Buffer, "Float16Buffer"}, + {SpvCapabilityFloat16, "Float16"}, + {SpvCapabilityFloat64, "Float64"}, + {SpvCapabilityInt64, "Int64"}, + {SpvCapabilityInt64Atomics, "Int64Atomics"}, + {SpvCapabilityImageBasic, "ImageBasic"}, + {SpvCapabilityImageReadWrite, "ImageReadWrite"}, + {SpvCapabilityImageMipmap, "ImageMipmap"}, + {SpvCapabilityPipes, "Pipes"}, + {SpvCapabilityGroups, "Groups"}, + {SpvCapabilityDeviceEnqueue, "DeviceEnqueue"}, + {SpvCapabilityLiteralSampler, "LiteralSampler"}, + {SpvCapabilityAtomicStorage, "AtomicStorage"}, + {SpvCapabilityInt16, "Int16"}, + {SpvCapabilityTessellationPointSize, "TessellationPointSize"}, + {SpvCapabilityGeometryPointSize, "GeometryPointSize"}, + {SpvCapabilityImageGatherExtended, "ImageGatherExtended"}, + {SpvCapabilityStorageImageMultisample, "StorageImageMultisample"}, + {SpvCapabilityUniformBufferArrayDynamicIndexing, + "UniformBufferArrayDynamicIndexing"}, + {SpvCapabilitySampledImageArrayDynamicIndexing, + "SampledImageArrayDynamicIndexing"}, + {SpvCapabilityStorageBufferArrayDynamicIndexing, + "StorageBufferArrayDynamicIndexing"}, + {SpvCapabilityStorageImageArrayDynamicIndexing, + "StorageImageArrayDynamicIndexing"}, + {SpvCapabilityClipDistance, "ClipDistance"}, + {SpvCapabilityCullDistance, "CullDistance"}, + {SpvCapabilityImageCubeArray, "ImageCubeArray"}, + {SpvCapabilitySampleRateShading, "SampleRateShading"}, + {SpvCapabilityImageRect, "ImageRect"}, + {SpvCapabilitySampledRect, "SampledRect"}, + {SpvCapabilityGenericPointer, "GenericPointer"}, + {SpvCapabilityInt8, "Int8"}, + {SpvCapabilityInputAttachment, "InputAttachment"}, + {SpvCapabilitySparseResidency, "SparseResidency"}, + {SpvCapabilityMinLod, "MinLod"}, + {SpvCapabilitySampled1D, "Sampled1D"}, + {SpvCapabilityImage1D, "Image1D"}, + {SpvCapabilitySampledCubeArray, "SampledCubeArray"}, + {SpvCapabilitySampledBuffer, "SampledBuffer"}, + {SpvCapabilityImageBuffer, "ImageBuffer"}, + {SpvCapabilityImageMSArray, "ImageMSArray"}, + {SpvCapabilityStorageImageExtendedFormats, + "StorageImageExtendedFormats"}, + {SpvCapabilityImageQuery, "ImageQuery"}, + {SpvCapabilityDerivativeControl, "DerivativeControl"}, + {SpvCapabilityInterpolationFunction, "InterpolationFunction"}, + {SpvCapabilityTransformFeedback, "TransformFeedback"}, + {SpvCapabilityGeometryStreams, "GeometryStreams"}, + {SpvCapabilityStorageImageReadWithoutFormat, + "StorageImageReadWithoutFormat"}, + {SpvCapabilityStorageImageWriteWithoutFormat, + "StorageImageWriteWithoutFormat"}, + {SpvCapabilityMultiViewport, "MultiViewport"}, + {SpvCapabilitySubgroupDispatch, "SubgroupDispatch"}, + {SpvCapabilityNamedBarrier, "NamedBarrier"}, + {SpvCapabilityPipeStorage, "PipeStorage"}, + {SpvCapabilitySubgroupBallotKHR, "SubgroupBallotKHR"}, + {SpvCapabilityDrawParameters, "DrawParameters"}, + {SpvCapabilitySubgroupVoteKHR, "SubgroupVoteKHR"}, + {SpvCapabilityStorageBuffer16BitAccess, "StorageBuffer16BitAccess"}, + {SpvCapabilityStorageUniformBufferBlock16, + "StorageBuffer16BitAccess"}, // Preferred name + {SpvCapabilityUniformAndStorageBuffer16BitAccess, + "UniformAndStorageBuffer16BitAccess"}, + {SpvCapabilityStorageUniform16, + "UniformAndStorageBuffer16BitAccess"}, // Preferred name + {SpvCapabilityStoragePushConstant16, "StoragePushConstant16"}, + {SpvCapabilityStorageInputOutput16, "StorageInputOutput16"}, + {SpvCapabilityDeviceGroup, "DeviceGroup"}, + {SpvCapabilityMultiView, "MultiView"}, + {SpvCapabilitySampleMaskOverrideCoverageNV, + "SampleMaskOverrideCoverageNV"}, + {SpvCapabilityGeometryShaderPassthroughNV, + "GeometryShaderPassthroughNV"}, + // The next two are different names for the same token. + {SpvCapabilityShaderViewportIndexLayerNV, + "ShaderViewportIndexLayerEXT"}, + {SpvCapabilityShaderViewportIndexLayerEXT, + "ShaderViewportIndexLayerEXT"}, + {SpvCapabilityShaderViewportMaskNV, "ShaderViewportMaskNV"}, + {SpvCapabilityShaderStereoViewNV, "ShaderStereoViewNV"}, + {SpvCapabilityPerViewAttributesNV, "PerViewAttributesNV"}})), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp new file mode 100644 index 00000000000..15fa8f76565 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp @@ -0,0 +1,812 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "DebugInfo.h" +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +// This file tests the correctness of encoding and decoding of instructions +// involving the DebugInfo extended instruction set. +// Semantic correctness should be the responsibility of validator. +// +// See https://www.khronos.org/registry/spir-v/specs/1.0/DebugInfo.html + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using testing::Eq; + +struct InstructionCase { + uint32_t opcode; + std::string name; + std::string operands; + std::vector expected_operands; +}; + +using ExtInstDebugInfoRoundTripTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; +using ExtInstDebugInfoRoundTripTestExplicit = spvtest::TextToBinaryTest; + +TEST_P(ExtInstDebugInfoRoundTripTest, ParameterizedExtInst) { + const std::string input = + "%1 = OpExtInstImport \"DebugInfo\"\n" + "%3 = OpExtInst %2 %1 " + + GetParam().name + GetParam().operands + "\n"; + // First make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(input), + Eq(Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("DebugInfo")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, GetParam().opcode}, + GetParam().expected_operands)}))) + << input; + // Now check the round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), input) << input; +} + +#define CASE_0(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, "", {} \ + } + +#define CASE_ILL(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 " #L0 " " #L1, { \ + 4, L0, L1 \ + } \ + } + +#define CASE_IL(Enum, L0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 " #L0, { 4, L0 } \ + } + +#define CASE_I(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4", { 4 } \ + } + +#define CASE_II(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5", { 4, 5 } \ + } + +#define CASE_III(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6", { 4, 5, 6 } \ + } + +#define CASE_IIII(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6 %7", { \ + 4, 5, 6, 7 \ + } \ + } + +#define CASE_IIIII(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6 %7 %8", { \ + 4, 5, 6, 7, 8 \ + } \ + } + +#define CASE_IIIIII(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6 %7 %8 %9", { \ + 4, 5, 6, 7, 8, 9 \ + } \ + } + +#define CASE_IIIIIII(Enum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6 %7 %8 %9 %10", { \ + 4, 5, 6, 7, 8, 9, 10 \ + } \ + } + +#define CASE_IIILLI(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7", { \ + 4, 5, 6, L0, L1, 7 \ + } \ + } + +#define CASE_IIILLIL(Enum, L0, L1, L2) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 " #L2, { \ + 4, 5, 6, L0, L1, 7, L2 \ + } \ + } + +#define CASE_IE(Enum, E0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 " #E0, { \ + 4, uint32_t(DebugInfo##E0) \ + } \ + } + +#define CASE_IIE(Enum, E0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 " #E0, { \ + 4, 5, uint32_t(DebugInfo##E0) \ + } \ + } + +#define CASE_ISF(Enum, S0, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 " #S0 " " Fstr, { \ + 4, uint32_t(SpvStorageClass##S0), Fnum \ + } \ + } + +#define CASE_LII(Enum, L0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " " #L0 " %4 %5", { \ + L0, 4, 5 \ + } \ + } + +#define CASE_ILI(Enum, L0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 " #L0 " %5", { \ + 4, L0, 5 \ + } \ + } + +#define CASE_ILII(Enum, L0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 " #L0 " %5 %6", { \ + 4, L0, 5, 6 \ + } \ + } + +#define CASE_ILLII(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 " #L0 " " #L1 " %5 %6", { \ + 4, L0, L1, 5, 6 \ + } \ + } + +#define CASE_IIILLIIF(Enum, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr, { \ + 4, 5, 6, L0, L1, 7, 8, Fnum \ + } \ + } + +#define CASE_IIILLIIFII(Enum, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " %9 %10", { \ + 4, 5, 6, L0, L1, 7, 8, Fnum, 9, 10 \ + } \ + } + +#define CASE_IIILLIIFIIII(Enum, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " %9 %10 %11 %12", { \ + 4, 5, 6, L0, L1, 7, 8, Fnum, 9, 10, 11, 12 \ + } \ + } + +#define CASE_IIILLIIFIIIIII(Enum, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " %9 %10 %11 %12 %13 %14", { \ + 4, 5, 6, L0, L1, 7, 8, Fnum, 9, 10, 11, 12, 13, 14 \ + } \ + } + +#define CASE_IEILLIIF(Enum, E0, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 " Fstr, { \ + 4, uint32_t(DebugInfo##E0), 5, L0, L1, 6, 7, Fnum \ + } \ + } + +#define CASE_IEILLIIFI(Enum, E0, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 " Fstr " %8", { \ + 4, uint32_t(DebugInfo##E0), 5, L0, L1, 6, 7, Fnum, 8 \ + } \ + } + +#define CASE_IEILLIIFII(Enum, E0, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 " Fstr " %8 %9", { \ + 4, uint32_t(DebugInfo##E0), 5, L0, L1, 6, 7, Fnum, 8, 9 \ + } \ + } + +#define CASE_IEILLIIFIII(Enum, E0, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 " Fstr " %8 %9 %10", { \ + 4, uint32_t(DebugInfo##E0), 5, L0, L1, 6, 7, Fnum, 8, 9, 10 \ + } \ + } + +#define CASE_IEILLIIFIIII(Enum, E0, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 " #E0 " %5 " #L0 " " #L1 " %6 %7 " Fstr " %8 %9 %10 %11", { \ + 4, uint32_t(DebugInfo##E0), 5, L0, L1, 6, 7, Fnum, 8, 9, 10, 11 \ + } \ + } + +#define CASE_IIILLIIIF(Enum, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 %9 " Fstr, { \ + 4, 5, 6, L0, L1, 7, 8, 9, Fnum \ + } \ + } + +#define CASE_IIILLIIIFI(Enum, L0, L1, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 %9 " Fstr " %10", { \ + 4, 5, 6, L0, L1, 7, 8, 9, Fnum, 10 \ + } \ + } + +#define CASE_IIIIF(Enum, Fstr, Fnum) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6 %7 " Fstr, { \ + 4, 5, 6, 7, Fnum \ + } \ + } + +#define CASE_IIILL(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " %4 %5 %6 " #L0 " " #L1, { \ + 4, 5, 6, L0, L1 \ + } \ + } + +#define CASE_IIIILL(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 %7 " #L0 " " #L1, { \ + 4, 5, 6, 7, L0, L1 \ + } \ + } + +#define CASE_IILLI(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 " #L0 " " #L1 " %6", { \ + 4, 5, L0, L1, 6 \ + } \ + } + +#define CASE_IILLII(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 " #L0 " " #L1 " %6 %7", { \ + 4, 5, L0, L1, 6, 7 \ + } \ + } + +#define CASE_IILLIII(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 " #L0 " " #L1 " %6 %7 %8", { \ + 4, 5, L0, L1, 6, 7, 8 \ + } \ + } + +#define CASE_IILLIIII(Enum, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 " #L0 " " #L1 " %6 %7 %8 %9", { \ + 4, 5, L0, L1, 6, 7, 8, 9 \ + } \ + } + +#define CASE_IIILLIIFLI(Enum, L0, L1, Fstr, Fnum, L2) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " " #L2 " %9", { \ + 4, 5, 6, L0, L1, 7, 8, Fnum, L2, 9 \ + } \ + } + +#define CASE_IIILLIIFLII(Enum, L0, L1, Fstr, Fnum, L2) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, \ + " %4 %5 %6 " #L0 " " #L1 " %7 %8 " Fstr " " #L2 " %9 %10", { \ + 4, 5, 6, L0, L1, 7, 8, Fnum, L2, 9, 10 \ + } \ + } + +#define CASE_E(Enum, E0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " " #E0, { \ + uint32_t(DebugInfo##E0) \ + } \ + } + +#define CASE_EL(Enum, E0, L0) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " " #E0 " " #L0, { \ + uint32_t(DebugInfo##E0), L0 \ + } \ + } + +#define CASE_ELL(Enum, E0, L0, L1) \ + { \ + uint32_t(DebugInfoDebug##Enum), "Debug" #Enum, " " #E0 " " #L0 " " #L1, { \ + uint32_t(DebugInfo##E0), L0, L1 \ + } \ + } + +// DebugInfo 4.1 Absent Debugging Information +INSTANTIATE_TEST_CASE_P(DebugInfoDebugInfoNone, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_0(InfoNone), // enum value 0 + })), ); + +// DebugInfo 4.2 Compilation Unit +INSTANTIATE_TEST_CASE_P(DebugInfoDebugCompilationUnit, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILL(CompilationUnit, 100, 42), + })), ); + +// DebugInfo 4.3 Type instructions +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeBasic, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIE(TypeBasic, Unspecified), + CASE_IIE(TypeBasic, Address), + CASE_IIE(TypeBasic, Boolean), + CASE_IIE(TypeBasic, Float), + CASE_IIE(TypeBasic, Signed), + CASE_IIE(TypeBasic, SignedChar), + CASE_IIE(TypeBasic, Unsigned), + CASE_IIE(TypeBasic, UnsignedChar), + })), ); + +// The FlagIsPublic is value is (1 << 0) | (1 << 2) which is the same +// as the bitwise-OR of FlagIsProtected and FlagIsPrivate. +// The disassembler will emit the compound expression instead. +// There is no simple fix for this. This enum is not really a mask +// for the bottom two bits. +TEST_F(ExtInstDebugInfoRoundTripTestExplicit, FlagIsPublic) { + const std::string prefix = + "%1 = OpExtInstImport \"DebugInfo\"\n" + "%3 = OpExtInst %2 %1 DebugTypePointer %4 Private "; + const std::string input = prefix + "FlagIsPublic\n"; + const std::string expected = prefix + "FlagIsProtected|FlagIsPrivate\n"; + // First make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(input), + Eq(Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("DebugInfo")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, DebugInfoDebugTypePointer, 4, + uint32_t(SpvStorageClassPrivate), + DebugInfoFlagIsPublic})}))) + << input; + // Now check the round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(expected)) << input; +} + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugTypePointer, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + + //// Use each flag independently. + CASE_ISF(TypePointer, Private, "FlagIsProtected", + uint32_t(DebugInfoFlagIsProtected)), + CASE_ISF(TypePointer, Private, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + + // FlagIsPublic is tested above. + + CASE_ISF(TypePointer, Private, "FlagIsLocal", + uint32_t(DebugInfoFlagIsLocal)), + CASE_ISF(TypePointer, Private, "FlagIsDefinition", + uint32_t(DebugInfoFlagIsDefinition)), + CASE_ISF(TypePointer, Private, "FlagFwdDecl", + uint32_t(DebugInfoFlagFwdDecl)), + CASE_ISF(TypePointer, Private, "FlagArtificial", + uint32_t(DebugInfoFlagArtificial)), + CASE_ISF(TypePointer, Private, "FlagExplicit", + uint32_t(DebugInfoFlagExplicit)), + CASE_ISF(TypePointer, Private, "FlagPrototyped", + uint32_t(DebugInfoFlagPrototyped)), + CASE_ISF(TypePointer, Private, "FlagObjectPointer", + uint32_t(DebugInfoFlagObjectPointer)), + CASE_ISF(TypePointer, Private, "FlagStaticMember", + uint32_t(DebugInfoFlagStaticMember)), + CASE_ISF(TypePointer, Private, "FlagIndirectVariable", + uint32_t(DebugInfoFlagIndirectVariable)), + CASE_ISF(TypePointer, Private, "FlagLValueReference", + uint32_t(DebugInfoFlagLValueReference)), + CASE_ISF(TypePointer, Private, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized)), + + //// Use flags in combination, and try different storage classes. + CASE_ISF(TypePointer, Function, "FlagIsProtected|FlagIsPrivate", + uint32_t(DebugInfoFlagIsProtected) | + uint32_t(DebugInfoFlagIsPrivate)), + CASE_ISF( + TypePointer, Workgroup, + "FlagIsPrivate|FlagFwdDecl|FlagIndirectVariable|FlagIsOptimized", + uint32_t(DebugInfoFlagIsPrivate) | uint32_t(DebugInfoFlagFwdDecl) | + uint32_t(DebugInfoFlagIndirectVariable) | + uint32_t(DebugInfoFlagIsOptimized)), + + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeQualifier, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IE(TypeQualifier, ConstType), + CASE_IE(TypeQualifier, VolatileType), + CASE_IE(TypeQualifier, RestrictType), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeArray, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(TypeArray), + CASE_III(TypeArray), + CASE_IIII(TypeArray), + CASE_IIIII(TypeArray), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeVector, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IL(TypeVector, 2), + CASE_IL(TypeVector, 3), + CASE_IL(TypeVector, 4), + CASE_IL(TypeVector, 16), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypedef, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLI(Typedef, 12, 13), + CASE_IIILLI(Typedef, 14, 99), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeFunction, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_I(TypeFunction), + CASE_II(TypeFunction), + CASE_III(TypeFunction), + CASE_IIII(TypeFunction), + CASE_IIIII(TypeFunction), + })), ); + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugTypeEnum, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLIIFII( + TypeEnum, 12, 13, + "FlagIsPrivate|FlagFwdDecl|FlagIndirectVariable|FlagIsOptimized", + uint32_t(DebugInfoFlagIsPrivate) | uint32_t(DebugInfoFlagFwdDecl) | + uint32_t(DebugInfoFlagIndirectVariable) | + uint32_t(DebugInfoFlagIsOptimized)), + CASE_IIILLIIFIIII(TypeEnum, 17, 18, "FlagStaticMember", + uint32_t(DebugInfoFlagStaticMember)), + CASE_IIILLIIFIIIIII(TypeEnum, 99, 1, "FlagStaticMember", + uint32_t(DebugInfoFlagStaticMember)), + })), ); + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugTypeComposite, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IEILLIIF( + TypeComposite, Class, 12, 13, + "FlagIsPrivate|FlagFwdDecl|FlagIndirectVariable|FlagIsOptimized", + uint32_t(DebugInfoFlagIsPrivate) | uint32_t(DebugInfoFlagFwdDecl) | + uint32_t(DebugInfoFlagIndirectVariable) | + uint32_t(DebugInfoFlagIsOptimized)), + // Cover all tag values: Class, Structure, Union + CASE_IEILLIIF(TypeComposite, Class, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IEILLIIF(TypeComposite, Structure, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IEILLIIF(TypeComposite, Union, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + // Now add members + CASE_IEILLIIFI(TypeComposite, Class, 9, 10, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IEILLIIFII(TypeComposite, Class, 9, 10, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IEILLIIFIII(TypeComposite, Class, 9, 10, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IEILLIIFIIII(TypeComposite, Class, 9, 10, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeMember, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLIIIF(TypeMember, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IIILLIIIF(TypeMember, 99, 100, + "FlagIsPrivate|FlagFwdDecl", + uint32_t(DebugInfoFlagIsPrivate) | + uint32_t(DebugInfoFlagFwdDecl)), + // Add the optional Id argument. + CASE_IIILLIIIFI(TypeMember, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + })), ); + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugTypeInheritance, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIIIF(TypeInheritance, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IIIIF(TypeInheritance, "FlagIsPrivate|FlagFwdDecl", + uint32_t(DebugInfoFlagIsPrivate) | + uint32_t(DebugInfoFlagFwdDecl)), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypePtrToMember, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(TypePtrToMember), + })), ); + +// DebugInfo 4.4 Templates + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplate, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(TypeTemplate), + CASE_III(TypeTemplate), + CASE_IIII(TypeTemplate), + CASE_IIIII(TypeTemplate), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplateParameter, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIIILL(TypeTemplateParameter, 1, 2), + CASE_IIIILL(TypeTemplateParameter, 99, 102), + CASE_IIIILL(TypeTemplateParameter, 10, 7), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplateTemplateParameter, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILL(TypeTemplateTemplateParameter, 1, 2), + CASE_IIILL(TypeTemplateTemplateParameter, 99, 102), + CASE_IIILL(TypeTemplateTemplateParameter, 10, 7), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplateParameterPack, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IILLI(TypeTemplateParameterPack, 1, 2), + CASE_IILLII(TypeTemplateParameterPack, 99, 102), + CASE_IILLIII(TypeTemplateParameterPack, 10, 7), + CASE_IILLIIII(TypeTemplateParameterPack, 10, 7), + })), ); + +// DebugInfo 4.5 Global Variables + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugGlobalVariable, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLIIIF(GlobalVariable, 1, 2, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized)), + CASE_IIILLIIIF(GlobalVariable, 42, 43, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized)), + CASE_IIILLIIIFI(GlobalVariable, 1, 2, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized)), + CASE_IIILLIIIFI(GlobalVariable, 42, 43, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized)), + })), ); + +// DebugInfo 4.6 Functions + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugFunctionDeclaration, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLIIF(FunctionDeclaration, 1, 2, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized)), + CASE_IIILLIIF(FunctionDeclaration, 42, 43, "FlagFwdDecl", + uint32_t(DebugInfoFlagFwdDecl)), + })), ); + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugFunction, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLIIFLI(Function, 1, 2, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized), 3), + CASE_IIILLIIFLI(Function, 42, 43, "FlagFwdDecl", + uint32_t(DebugInfoFlagFwdDecl), 44), + // Add the optional declaration Id. + CASE_IIILLIIFLII(Function, 1, 2, "FlagIsOptimized", + uint32_t(DebugInfoFlagIsOptimized), 3), + CASE_IIILLIIFLII(Function, 42, 43, "FlagFwdDecl", + uint32_t(DebugInfoFlagFwdDecl), 44), + })), ); + +// DebugInfo 4.7 Local Information + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugLexicalBlock, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILLII(LexicalBlock, 1, 2), + CASE_ILLII(LexicalBlock, 42, 43), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugLexicalBlockDiscriminator, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILI(LexicalBlockDiscriminator, 1), + CASE_ILI(LexicalBlockDiscriminator, 42), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugScope, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_I(Scope), + CASE_II(Scope), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugNoScope, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_0(NoScope), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugInlinedAt, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_LII(InlinedAt, 1), + CASE_LII(InlinedAt, 42), + })), ); + +// DebugInfo 4.8 Local Variables + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugLocalVariable, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLI(LocalVariable, 1, 2), + CASE_IIILLI(LocalVariable, 42, 43), + CASE_IIILLIL(LocalVariable, 1, 2, 3), + CASE_IIILLIL(LocalVariable, 42, 43, 44), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugInlinedVariable, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(InlinedVariable), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugDebugDeclare, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_III(Declare), + })), ); + +INSTANTIATE_TEST_CASE_P( + DebugInfoDebugDebugValue, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_III(Value), + CASE_IIII(Value), + CASE_IIIII(Value), + CASE_IIIIII(Value), + // Test up to 4 id parameters. We can always try more. + CASE_IIIIIII(Value), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugDebugOperation, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_E(Operation, Deref), + CASE_E(Operation, Plus), + CASE_E(Operation, Minus), + CASE_EL(Operation, PlusUconst, 1), + CASE_EL(Operation, PlusUconst, 42), + CASE_ELL(Operation, BitPiece, 1, 2), + CASE_ELL(Operation, BitPiece, 4, 5), + CASE_E(Operation, Swap), + CASE_E(Operation, Xderef), + CASE_E(Operation, StackValue), + CASE_EL(Operation, Constu, 1), + CASE_EL(Operation, Constu, 42), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugDebugExpression, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_0(Expression), + CASE_I(Expression), + CASE_II(Expression), + CASE_III(Expression), + CASE_IIII(Expression), + CASE_IIIII(Expression), + CASE_IIIIII(Expression), + CASE_IIIIIII(Expression), + })), ); + +// DebugInfo 4.9 Macros + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugMacroDef, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILI(MacroDef, 1), + CASE_ILI(MacroDef, 42), + CASE_ILII(MacroDef, 1), + CASE_ILII(MacroDef, 42), + })), ); + +INSTANTIATE_TEST_CASE_P(DebugInfoDebugMacroUndef, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILI(MacroUndef, 1), + CASE_ILI(MacroUndef, 42), + })), ); + +#undef CASE_0 +#undef CASE_ILL +#undef CASE_IL +#undef CASE_I +#undef CASE_II +#undef CASE_III +#undef CASE_IIII +#undef CASE_IIIII +#undef CASE_IIIIII +#undef CASE_IIIIIII +#undef CASE_IIILLI +#undef CASE_IIILLIL +#undef CASE_IE +#undef CASE_IIE +#undef CASE_ISF +#undef CASE_LII +#undef CASE_ILI +#undef CASE_ILII +#undef CASE_ILLII +#undef CASE_IIILLIIF +#undef CASE_IIILLIIFII +#undef CASE_IIILLIIFIIII +#undef CASE_IIILLIIFIIIIII +#undef CASE_IEILLIIF +#undef CASE_IEILLIIFI +#undef CASE_IEILLIIFII +#undef CASE_IEILLIIFIII +#undef CASE_IEILLIIFIIII +#undef CASE_IIILLIIIF +#undef CASE_IIILLIIIFI +#undef CASE_IIIIF +#undef CASE_IIILL +#undef CASE_IIIILL +#undef CASE_IILLI +#undef CASE_IILLII +#undef CASE_IILLIII +#undef CASE_IILLIIII +#undef CASE_IIILLIIFLI +#undef CASE_IIILLIIFLII +#undef CASE_E +#undef CASE_EL +#undef CASE_ELL + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp new file mode 100644 index 00000000000..991c487f1ad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp @@ -0,0 +1,203 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "source/latest_version_glsl_std_450_header.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +/// Context for an extended instruction. +/// +/// Information about a GLSL extended instruction (including its opname, return +/// type, etc.) and related instructions used to generate the return type and +/// constant as the operands. Used in generating extended instruction tests. +struct ExtInstContext { + const char* extInstOpName; + const char* extInstOperandVars; + /// The following fields are used to check the SPIR-V binary representation + /// of this instruction. + uint32_t extInstOpcode; ///< Opcode value for this extended instruction. + uint32_t extInstLength; ///< Wordcount of this extended instruction. + std::vector extInstOperandIds; ///< Ids for operands. +}; + +using ExtInstGLSLstd450RoundTripTest = ::testing::TestWithParam; + +TEST_P(ExtInstGLSLstd450RoundTripTest, ParameterizedExtInst) { + spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_0); + const std::string spirv = R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical Simple +OpEntryPoint Vertex %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%2 = OpFunction %3 None %5 +%6 = OpLabel +%8 = OpExtInst %7 %1 )" + std::string(GetParam().extInstOpName) + + " " + GetParam().extInstOperandVars + R"( +OpReturn +OpFunctionEnd +)"; + const std::string spirv_header = + R"(; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 9 +; Schema: 0)"; + spv_binary binary; + spv_diagnostic diagnostic; + spv_result_t error = spvTextToBinary(context, spirv.c_str(), spirv.size(), + &binary, &diagnostic); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + ASSERT_EQ(SPV_SUCCESS, error) + << "Source was: " << std::endl + << spirv << std::endl + << "Test case for : " << GetParam().extInstOpName << std::endl; + } + + // Check we do have the extended instruction's corresponding binary code in + // the generated SPIR-V binary. + std::vector expected_contains( + {12 /*OpExtInst*/ | GetParam().extInstLength << 16, 7 /*return type*/, + 8 /*result id*/, 1 /*glsl450 import*/, GetParam().extInstOpcode}); + for (uint32_t operand : GetParam().extInstOperandIds) { + expected_contains.push_back(operand); + } + EXPECT_NE(binary->code + binary->wordCount, + std::search(binary->code, binary->code + binary->wordCount, + expected_contains.begin(), expected_contains.end())) + << "Cannot find\n" + << spvtest::WordVector(expected_contains).str() << "in\n" + << spvtest::WordVector(*binary).str(); + + // Check round trip gives the same text. + spv_text output_text = nullptr; + error = spvBinaryToText(context, binary->code, binary->wordCount, + SPV_BINARY_TO_TEXT_OPTION_NONE, &output_text, + &diagnostic); + + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + ASSERT_EQ(SPV_SUCCESS, error); + } + EXPECT_EQ(spirv_header + spirv, output_text->str); + spvTextDestroy(output_text); + spvContextDestroy(context); +} + +INSTANTIATE_TEST_CASE_P( + ExtInstParameters, ExtInstGLSLstd450RoundTripTest, + ::testing::ValuesIn(std::vector({ + // We are only testing the correctness of encoding and decoding here. + // Semantic correctness should be the responsibility of validator. So + // some of the instructions below have incorrect operand and/or return + // types, e.g, Modf, ModfStruct, etc. + {"Round", "%5", 1, 6, {5}}, + {"RoundEven", "%5", 2, 6, {5}}, + {"Trunc", "%5", 3, 6, {5}}, + {"FAbs", "%5", 4, 6, {5}}, + {"SAbs", "%5", 5, 6, {5}}, + {"FSign", "%5", 6, 6, {5}}, + {"SSign", "%5", 7, 6, {5}}, + {"Floor", "%5", 8, 6, {5}}, + {"Ceil", "%5", 9, 6, {5}}, + {"Fract", "%5", 10, 6, {5}}, + {"Radians", "%5", 11, 6, {5}}, + {"Degrees", "%5", 12, 6, {5}}, + {"Sin", "%5", 13, 6, {5}}, + {"Cos", "%5", 14, 6, {5}}, + {"Tan", "%5", 15, 6, {5}}, + {"Asin", "%5", 16, 6, {5}}, + {"Acos", "%5", 17, 6, {5}}, + {"Atan", "%5", 18, 6, {5}}, + {"Sinh", "%5", 19, 6, {5}}, + {"Cosh", "%5", 20, 6, {5}}, + {"Tanh", "%5", 21, 6, {5}}, + {"Asinh", "%5", 22, 6, {5}}, + {"Acosh", "%5", 23, 6, {5}}, + {"Atanh", "%5", 24, 6, {5}}, + {"Atan2", "%5 %5", 25, 7, {5, 5}}, + {"Pow", "%5 %5", 26, 7, {5, 5}}, + {"Exp", "%5", 27, 6, {5}}, + {"Log", "%5", 28, 6, {5}}, + {"Exp2", "%5", 29, 6, {5}}, + {"Log2", "%5", 30, 6, {5}}, + {"Sqrt", "%5", 31, 6, {5}}, + {"InverseSqrt", "%5", 32, 6, {5}}, + {"Determinant", "%5", 33, 6, {5}}, + {"MatrixInverse", "%5", 34, 6, {5}}, + {"Modf", "%5 %5", 35, 7, {5, 5}}, + {"ModfStruct", "%5", 36, 6, {5}}, + {"FMin", "%5 %5", 37, 7, {5, 5}}, + {"UMin", "%5 %5", 38, 7, {5, 5}}, + {"SMin", "%5 %5", 39, 7, {5, 5}}, + {"FMax", "%5 %5", 40, 7, {5, 5}}, + {"UMax", "%5 %5", 41, 7, {5, 5}}, + {"SMax", "%5 %5", 42, 7, {5, 5}}, + {"FClamp", "%5 %5 %5", 43, 8, {5, 5, 5}}, + {"UClamp", "%5 %5 %5", 44, 8, {5, 5, 5}}, + {"SClamp", "%5 %5 %5", 45, 8, {5, 5, 5}}, + {"FMix", "%5 %5 %5", 46, 8, {5, 5, 5}}, + {"IMix", "%5 %5 %5", 47, 8, {5, 5, 5}}, // Bug 15452. Reserved. + {"Step", "%5 %5", 48, 7, {5, 5}}, + {"SmoothStep", "%5 %5 %5", 49, 8, {5, 5, 5}}, + {"Fma", "%5 %5 %5", 50, 8, {5, 5, 5}}, + {"Frexp", "%5 %5", 51, 7, {5, 5}}, + {"FrexpStruct", "%5", 52, 6, {5}}, + {"Ldexp", "%5 %5", 53, 7, {5, 5}}, + {"PackSnorm4x8", "%5", 54, 6, {5}}, + {"PackUnorm4x8", "%5", 55, 6, {5}}, + {"PackSnorm2x16", "%5", 56, 6, {5}}, + {"PackUnorm2x16", "%5", 57, 6, {5}}, + {"PackHalf2x16", "%5", 58, 6, {5}}, + {"PackDouble2x32", "%5", 59, 6, {5}}, + {"UnpackSnorm2x16", "%5", 60, 6, {5}}, + {"UnpackUnorm2x16", "%5", 61, 6, {5}}, + {"UnpackHalf2x16", "%5", 62, 6, {5}}, + {"UnpackSnorm4x8", "%5", 63, 6, {5}}, + {"UnpackUnorm4x8", "%5", 64, 6, {5}}, + {"UnpackDouble2x32", "%5", 65, 6, {5}}, + {"Length", "%5", 66, 6, {5}}, + {"Distance", "%5 %5", 67, 7, {5, 5}}, + {"Cross", "%5 %5", 68, 7, {5, 5}}, + {"Normalize", "%5", 69, 6, {5}}, + // clang-format off + {"FaceForward", "%5 %5 %5", 70, 8, {5, 5, 5}}, + // clang-format on + {"Reflect", "%5 %5", 71, 7, {5, 5}}, + {"Refract", "%5 %5 %5", 72, 8, {5, 5, 5}}, + {"FindILsb", "%5", 73, 6, {5}}, + {"FindSMsb", "%5", 74, 6, {5}}, + {"FindUMsb", "%5", 75, 6, {5}}, + {"InterpolateAtCentroid", "%5", 76, 6, {5}}, + // clang-format off + {"InterpolateAtSample", "%5 %5", 77, 7, {5, 5}}, + {"InterpolateAtOffset", "%5 %5", 78, 7, {5, 5}}, + // clang-format on + {"NMin", "%5 %5", 79, 7, {5, 5}}, + {"NMax", "%5 %5", 80, 7, {5, 5}}, + {"NClamp", "%5 %5 %5", 81, 8, {5, 5, 5}}, + })), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp new file mode 100644 index 00000000000..06bc5e848a7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp @@ -0,0 +1,373 @@ +// Copyright (c) 2015-2016 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. + +#include +#include + +#include "gmock/gmock.h" +#include "source/latest_version_opencl_std_header.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using spvtest::TextToBinaryTest; +using testing::Eq; + +struct InstructionCase { + uint32_t opcode; + std::string name; + std::string operands; + std::vector expected_operands; +}; + +using ExtInstOpenCLStdRoundTripTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(ExtInstOpenCLStdRoundTripTest, ParameterizedExtInst) { + // This example should not validate. + const std::string input = + "%1 = OpExtInstImport \"OpenCL.std\"\n" + "%3 = OpExtInst %2 %1 " + + GetParam().name + " " + GetParam().operands + "\n"; + // First make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(input), + Eq(Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("OpenCL.std")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, GetParam().opcode}, + GetParam().expected_operands)}))) + << input; + // Now check the round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), input) << input; +} + +#define CASE1(Enum, Name) \ + { \ + uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4", { 4 } \ + } +#define CASE2(Enum, Name) \ + { \ + uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5", { 4, 5 } \ + } +#define CASE3(Enum, Name) \ + { \ + uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5 %6", { 4, 5, 6 } \ + } +#define CASE4(Enum, Name) \ + { \ + uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5 %6 %7", { \ + 4, 5, 6, 7 \ + } \ + } +#define CASE2Lit(Enum, Name, LiteralNumber) \ + { \ + uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5 " #LiteralNumber, { \ + 4, 5, LiteralNumber \ + } \ + } +#define CASE3Round(Enum, Name, Mode) \ + { \ + uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5 %6 " #Mode, { \ + 4, 5, 6, uint32_t(SpvFPRoundingMode##Mode) \ + } \ + } + +// clang-format off +// OpenCL.std: 2.1 Math extended instructions +INSTANTIATE_TEST_CASE_P( + OpenCLMath, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + // We are only testing the correctness of encoding and decoding here. + // Semantic correctness should be the responsibility of validator. + CASE1(Acos, acos), // enum value 0 + CASE1(Acosh, acosh), + CASE1(Acospi, acospi), + CASE1(Asin, asin), + CASE1(Asinh, asinh), + CASE1(Asinh, asinh), + CASE1(Asinpi, asinpi), + CASE1(Atan, atan), + CASE2(Atan2, atan2), + CASE1(Atanh, atanh), + CASE1(Atanpi, atanpi), + CASE2(Atan2pi, atan2pi), + CASE1(Cbrt, cbrt), + CASE1(Ceil, ceil), + CASE1(Ceil, ceil), + CASE2(Copysign, copysign), + CASE1(Cos, cos), + CASE1(Cosh, cosh), + CASE1(Cospi, cospi), + CASE1(Erfc, erfc), + CASE1(Erf, erf), + CASE1(Exp, exp), + CASE1(Exp2, exp2), + CASE1(Exp10, exp10), + CASE1(Expm1, expm1), + CASE1(Fabs, fabs), + CASE2(Fdim, fdim), + CASE1(Floor, floor), + CASE3(Fma, fma), + CASE2(Fmax, fmax), + CASE2(Fmin, fmin), + CASE2(Fmod, fmod), + CASE2(Fract, fract), + CASE2(Frexp, frexp), + CASE2(Hypot, hypot), + CASE1(Ilogb, ilogb), + CASE2(Ldexp, ldexp), + CASE1(Lgamma, lgamma), + CASE2(Lgamma_r, lgamma_r), + CASE1(Log, log), + CASE1(Log2, log2), + CASE1(Log10, log10), + CASE1(Log1p, log1p), + CASE3(Mad, mad), + CASE2(Maxmag, maxmag), + CASE2(Minmag, minmag), + CASE2(Modf, modf), + CASE1(Nan, nan), + CASE2(Nextafter, nextafter), + CASE2(Pow, pow), + CASE2(Pown, pown), + CASE2(Powr, powr), + CASE2(Remainder, remainder), + CASE3(Remquo, remquo), + CASE1(Rint, rint), + CASE2(Rootn, rootn), + CASE1(Round, round), + CASE1(Rsqrt, rsqrt), + CASE1(Sin, sin), + CASE2(Sincos, sincos), + CASE1(Sinh, sinh), + CASE1(Sinpi, sinpi), + CASE1(Sqrt, sqrt), + CASE1(Tan, tan), + CASE1(Tanh, tanh), + CASE1(Tanpi, tanpi), + CASE1(Tgamma, tgamma), + CASE1(Trunc, trunc), + CASE1(Half_cos, half_cos), + CASE2(Half_divide, half_divide), + CASE1(Half_exp, half_exp), + CASE1(Half_exp2, half_exp2), + CASE1(Half_exp10, half_exp10), + CASE1(Half_log, half_log), + CASE1(Half_log2, half_log2), + CASE1(Half_log10, half_log10), + CASE2(Half_powr, half_powr), + CASE1(Half_recip, half_recip), + CASE1(Half_rsqrt, half_rsqrt), + CASE1(Half_sin, half_sin), + CASE1(Half_sqrt, half_sqrt), + CASE1(Half_tan, half_tan), + CASE1(Native_cos, native_cos), + CASE2(Native_divide, native_divide), + CASE1(Native_exp, native_exp), + CASE1(Native_exp2, native_exp2), + CASE1(Native_exp10, native_exp10), + CASE1(Native_log, native_log), + CASE1(Native_log10, native_log10), + CASE2(Native_powr, native_powr), + CASE1(Native_recip, native_recip), + CASE1(Native_rsqrt, native_rsqrt), + CASE1(Native_sin, native_sin), + CASE1(Native_sqrt, native_sqrt), + CASE1(Native_tan, native_tan), // enum value 94 + })),); + +// OpenCL.std: 2.1 Integer instructions +INSTANTIATE_TEST_CASE_P( + OpenCLInteger, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE1(SAbs, s_abs), // enum value 141 + CASE2(SAbs_diff, s_abs_diff), + CASE2(SAdd_sat, s_add_sat), + CASE2(UAdd_sat, u_add_sat), + CASE2(SHadd, s_hadd), + CASE2(UHadd, u_hadd), + CASE2(SRhadd, s_rhadd), + CASE2(SRhadd, s_rhadd), + CASE3(SClamp, s_clamp), + CASE3(UClamp, u_clamp), + CASE1(Clz, clz), + CASE1(Ctz, ctz), + CASE3(SMad_hi, s_mad_hi), + CASE3(UMad_sat, u_mad_sat), + CASE3(SMad_sat, s_mad_sat), + CASE2(SMax, s_max), + CASE2(UMax, u_max), + CASE2(SMin, s_min), + CASE2(UMin, u_min), + CASE2(SMul_hi, s_mul_hi), + CASE2(Rotate, rotate), + CASE2(SSub_sat, s_sub_sat), + CASE2(USub_sat, u_sub_sat), + CASE2(U_Upsample, u_upsample), + CASE2(S_Upsample, s_upsample), + CASE1(Popcount, popcount), + CASE3(SMad24, s_mad24), + CASE3(UMad24, u_mad24), + CASE2(SMul24, s_mul24), + CASE2(UMul24, u_mul24), // enum value 170 + CASE1(UAbs, u_abs), // enum value 201 + CASE2(UAbs_diff, u_abs_diff), + CASE2(UMul_hi, u_mul_hi), + CASE3(UMad_hi, u_mad_hi), // enum value 204 + })),); + +// OpenCL.std: 2.3 Common instrucitons +INSTANTIATE_TEST_CASE_P( + OpenCLCommon, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE3(FClamp, fclamp), // enum value 95 + CASE1(Degrees, degrees), + CASE2(FMax_common, fmax_common), + CASE2(FMin_common, fmin_common), + CASE3(Mix, mix), + CASE1(Radians, radians), + CASE2(Step, step), + CASE3(Smoothstep, smoothstep), + CASE1(Sign, sign), // enum value 103 + })),); + +// OpenCL.std: 2.4 Geometric instructions +INSTANTIATE_TEST_CASE_P( + OpenCLGeometric, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE2(Cross, cross), // enum value 104 + CASE2(Distance, distance), + CASE1(Length, length), + CASE1(Normalize, normalize), + CASE2(Fast_distance, fast_distance), + CASE1(Fast_length, fast_length), + CASE1(Fast_normalize, fast_normalize), // enum value 110 + })),); + +// OpenCL.std: 2.5 Relational instructions +INSTANTIATE_TEST_CASE_P( + OpenCLRelational, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE3(Bitselect, bitselect), // enum value 186 + CASE3(Select, select), // enum value 187 + })),); + +// OpenCL.std: 2.6 Vector data load and store instructions +INSTANTIATE_TEST_CASE_P( + OpenCLVectorLoadStore, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + // The last argument to Vloadn must be one of 2, 3, 4, 8, 16. + CASE2Lit(Vloadn, vloadn, 2), + CASE2Lit(Vloadn, vloadn, 3), + CASE2Lit(Vloadn, vloadn, 4), + CASE2Lit(Vloadn, vloadn, 8), + CASE2Lit(Vloadn, vloadn, 16), + CASE3(Vstoren, vstoren), + CASE2(Vload_half, vload_half), + CASE2Lit(Vload_halfn, vload_halfn, 2), + CASE2Lit(Vload_halfn, vload_halfn, 3), + CASE2Lit(Vload_halfn, vload_halfn, 4), + CASE2Lit(Vload_halfn, vload_halfn, 8), + CASE2Lit(Vload_halfn, vload_halfn, 16), + CASE3(Vstore_half, vstore_half), + // Try all the rounding modes. + CASE3Round(Vstore_half_r, vstore_half_r, RTE), + CASE3Round(Vstore_half_r, vstore_half_r, RTZ), + CASE3Round(Vstore_half_r, vstore_half_r, RTP), + CASE3Round(Vstore_half_r, vstore_half_r, RTN), + CASE3(Vstore_halfn, vstore_halfn), + CASE3Round(Vstore_halfn_r, vstore_halfn_r, RTE), + CASE3Round(Vstore_halfn_r, vstore_halfn_r, RTZ), + CASE3Round(Vstore_halfn_r, vstore_halfn_r, RTP), + CASE3Round(Vstore_halfn_r, vstore_halfn_r, RTN), + CASE2Lit(Vloada_halfn, vloada_halfn, 2), + CASE2Lit(Vloada_halfn, vloada_halfn, 3), + CASE2Lit(Vloada_halfn, vloada_halfn, 4), + CASE2Lit(Vloada_halfn, vloada_halfn, 8), + CASE2Lit(Vloada_halfn, vloada_halfn, 16), + CASE3(Vstorea_halfn, vstorea_halfn), + CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTE), + CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTZ), + CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTP), + CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTN), + })),); + +// OpenCL.std: 2.7 Miscellaneous vector instructions +INSTANTIATE_TEST_CASE_P( + OpenCLMiscellaneousVector, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE2(Shuffle, shuffle), + CASE3(Shuffle2, shuffle2), + })),); + +// OpenCL.std: 2.8 Miscellaneous instructions + +#define PREFIX uint32_t(OpenCLLIB::Entrypoints::Printf), "printf" +INSTANTIATE_TEST_CASE_P( + OpenCLMiscPrintf, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + // Printf is interesting because it takes a variable number of arguments. + // Start with zero optional arguments. + {PREFIX, "%4", {4}}, + {PREFIX, "%4 %5", {4, 5}}, + {PREFIX, "%4 %5 %6", {4, 5, 6}}, + {PREFIX, "%4 %5 %6 %7", {4, 5, 6, 7}}, + {PREFIX, "%4 %5 %6 %7 %8", {4, 5, 6, 7, 8}}, + {PREFIX, "%4 %5 %6 %7 %8 %9", {4, 5, 6, 7, 8, 9}}, + {PREFIX, "%4 %5 %6 %7 %8 %9 %10", {4, 5, 6, 7, 8, 9, 10}}, + {PREFIX, "%4 %5 %6 %7 %8 %9 %10 %11", {4, 5, 6, 7, 8, 9, 10, 11}}, + {PREFIX, "%4 %5 %6 %7 %8 %9 %10 %11 %12", + {4, 5, 6, 7, 8, 9, 10, 11, 12}}, + {PREFIX, "%4 %5 %6 %7 %8 %9 %10 %11 %12 %13", + {4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, + {PREFIX, "%4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14", + {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}}, + })),); +#undef PREFIX + +INSTANTIATE_TEST_CASE_P( + OpenCLMiscPrefetch, ExtInstOpenCLStdRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE2(Prefetch, prefetch), + })),); + +// OpenCL.std: 2.9.1 Image encoding +// No new instructions defined in this section. + +// OpenCL.std: 2.9.2 Sampler encoding +// No new instructions defined in this section. + +// OpenCL.std: 2.9.3 Image read +// No new instructions defined in this section. +// Use core instruction OpImageSampleExplicitLod instead. + +// OpenCL.std: 2.9.4 Image write +// No new instructions defined in this section. + +// clang-format on + +#undef CASE1 +#undef CASE2 +#undef CASE3 +#undef CASE4 +#undef CASE2Lit +#undef CASE3Round + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fix_word_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/fix_word_test.cpp new file mode 100644 index 00000000000..b8c3a33d534 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/fix_word_test.cpp @@ -0,0 +1,64 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +TEST(FixWord, Default) { + spv_endianness_t endian; + if (I32_ENDIAN_HOST == I32_ENDIAN_LITTLE) { + endian = SPV_ENDIANNESS_LITTLE; + } else { + endian = SPV_ENDIANNESS_BIG; + } + uint32_t word = 0x53780921; + ASSERT_EQ(word, spvFixWord(word, endian)); +} + +TEST(FixWord, Reorder) { + spv_endianness_t endian; + if (I32_ENDIAN_HOST == I32_ENDIAN_LITTLE) { + endian = SPV_ENDIANNESS_BIG; + } else { + endian = SPV_ENDIANNESS_LITTLE; + } + uint32_t word = 0x53780921; + uint32_t result = 0x21097853; + ASSERT_EQ(result, spvFixWord(word, endian)); +} + +TEST(FixDoubleWord, Default) { + spv_endianness_t endian = + (I32_ENDIAN_HOST == I32_ENDIAN_LITTLE ? SPV_ENDIANNESS_LITTLE + : SPV_ENDIANNESS_BIG); + uint32_t low = 0x53780921; + uint32_t high = 0xdeadbeef; + uint64_t result = 0xdeadbeef53780921; + ASSERT_EQ(result, spvFixDoubleWord(low, high, endian)); +} + +TEST(FixDoubleWord, Reorder) { + spv_endianness_t endian = + (I32_ENDIAN_HOST == I32_ENDIAN_LITTLE ? SPV_ENDIANNESS_BIG + : SPV_ENDIANNESS_LITTLE); + uint32_t low = 0x53780921; + uint32_t high = 0xdeadbeef; + uint64_t result = 0xefbeadde21097853; + ASSERT_EQ(result, spvFixDoubleWord(low, high, endian)); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/BUILD.gn b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/BUILD.gn new file mode 100644 index 00000000000..df8291a563e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/BUILD.gn @@ -0,0 +1,121 @@ +# Copyright 2018 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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("//testing/libfuzzer/fuzzer_test.gni") +import("//testing/test.gni") + +config("fuzzer_config") { + configs = [ "../..:spvtools_config" ] +} + +group("fuzzers") { + testonly = true + deps = [] + + if (!build_with_chromium || use_fuzzing_engine) { + deps += [ ":fuzzers_bin" ] + } +} + +if (!build_with_chromium || use_fuzzing_engine) { + group("fuzzers_bin") { + testonly = true + + deps = [ + ":spvtools_val_fuzzer", + ":spvtools_opt_legalization_fuzzer", + ":spvtools_opt_performance_fuzzer", + ":spvtools_opt_size_fuzzer", + ] + } +} + +template("spvtools_fuzzer") { + source_set(target_name) { + testonly = true + sources = invoker.sources + deps = [ + "../..:spvtools", + "../..:spvtools_opt", + "../..:spvtools_val", + ] + if (defined(invoker.deps)) { + deps += invoker.deps + } + + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ + "//build/config/compiler:no_chromium_code", + ":fuzzer_config", + ] + } +} + +spvtools_fuzzer("spvtools_opt_performance_fuzzer_src") { + sources = [ + "spvtools_opt_performance_fuzzer.cpp", + ] +} + +spvtools_fuzzer("spvtools_opt_legalization_fuzzer_src") { + sources = [ + "spvtools_opt_legalization_fuzzer.cpp", + ] +} + +spvtools_fuzzer("spvtools_opt_size_fuzzer_src") { + sources = [ + "spvtools_opt_size_fuzzer.cpp", + ] +} + +spvtools_fuzzer("spvtools_val_fuzzer_src") { + sources = [ + "spvtools_val_fuzzer.cpp", + ] +} + +if (!build_with_chromium || use_fuzzing_engine) { + fuzzer_test("spvtools_opt_performance_fuzzer") { + sources = [] + deps = [ + ":spvtools_opt_performance_fuzzer_src", + ] + seed_corpus = "corpora/spv" + } + + fuzzer_test("spvtools_opt_legalization_fuzzer") { + sources = [] + deps = [ + ":spvtools_opt_legalization_fuzzer_src", + ] + seed_corpus = "corpora/spv" + } + + fuzzer_test("spvtools_opt_size_fuzzer") { + sources = [] + deps = [ + ":spvtools_opt_size_fuzzer_src", + ] + seed_corpus = "corpora/spv" + } + + fuzzer_test("spvtools_val_fuzzer") { + sources = [] + deps = [ + ":spvtools_val_fuzzer_src", + ] + seed_corpus = "corpora/spv" + } +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/corpora/spv/simple.spv b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/corpora/spv/simple.spv new file mode 100644 index 00000000000..f972a56fd96 Binary files /dev/null and b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/corpora/spv/simple.spv differ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp new file mode 100644 index 00000000000..b45a98c370f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_legalization_fuzzer.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2018 Google 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. + +#include +#include + +#include "spirv-tools/optimizer.hpp" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + spvtools::Optimizer optimizer(SPV_ENV_UNIVERSAL_1_3); + optimizer.SetMessageConsumer([](spv_message_level_t, const char*, + const spv_position_t&, const char*) {}); + + std::vector input; + input.resize(size >> 2); + + size_t count = 0; + for (size_t i = 0; (i + 3) < size; i += 4) { + input[count++] = data[i] | (data[i + 1] << 8) | (data[i + 2] << 16) | + (data[i + 3]) << 24; + } + + optimizer.RegisterLegalizationPasses(); + optimizer.Run(input.data(), input.size(), &input); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_performance_fuzzer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_performance_fuzzer.cpp new file mode 100644 index 00000000000..6c3bd6aba8b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_performance_fuzzer.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2018 Google 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. + +#include +#include + +#include "spirv-tools/optimizer.hpp" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + spvtools::Optimizer optimizer(SPV_ENV_UNIVERSAL_1_3); + optimizer.SetMessageConsumer([](spv_message_level_t, const char*, + const spv_position_t&, const char*) {}); + + std::vector input; + input.resize(size >> 2); + + size_t count = 0; + for (size_t i = 0; (i + 3) < size; i += 4) { + input[count++] = data[i] | (data[i + 1] << 8) | (data[i + 2] << 16) | + (data[i + 3]) << 24; + } + + optimizer.RegisterPerformancePasses(); + optimizer.Run(input.data(), input.size(), &input); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp new file mode 100644 index 00000000000..68c79747740 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_opt_size_fuzzer.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2018 Google 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. + +#include +#include + +#include "spirv-tools/optimizer.hpp" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + spvtools::Optimizer optimizer(SPV_ENV_UNIVERSAL_1_3); + optimizer.SetMessageConsumer([](spv_message_level_t, const char*, + const spv_position_t&, const char*) {}); + + std::vector input; + input.resize(size >> 2); + + size_t count = 0; + for (size_t i = 0; (i + 3) < size; i += 4) { + input[count++] = data[i] | (data[i + 1] << 8) | (data[i + 2] << 16) | + (data[i + 3]) << 24; + } + + optimizer.RegisterSizePasses(); + optimizer.Run(input.data(), input.size(), &input); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_val_fuzzer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_val_fuzzer.cpp new file mode 100644 index 00000000000..5dc4303b454 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/fuzzers/spvtools_val_fuzzer.cpp @@ -0,0 +1,36 @@ +// Copyright (c) 2018 Google 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. + +#include +#include + +#include "spirv-tools/libspirv.hpp" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + spvtools::SpirvTools tools(SPV_ENV_UNIVERSAL_1_3); + tools.SetMessageConsumer([](spv_message_level_t, const char*, + const spv_position_t&, const char*) {}); + + std::vector input; + input.resize(size >> 2); + + size_t count = 0; + for (size_t i = 0; (i + 3) < size; i += 4) { + input[count++] = data[i] | (data[i + 1] << 8) | (data[i + 2] << 16) | + (data[i + 3]) << 24; + } + + tools.Validate(input); + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/generator_magic_number_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/generator_magic_number_test.cpp new file mode 100644 index 00000000000..bc5fdf57a56 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/generator_magic_number_test.cpp @@ -0,0 +1,62 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opcode.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::spvtest::EnumCase; +using ::testing::Eq; +using GeneratorMagicNumberTest = + ::testing::TestWithParam>; + +TEST_P(GeneratorMagicNumberTest, Single) { + EXPECT_THAT(std::string(spvGeneratorStr(GetParam().value())), + GetParam().name()); +} + +INSTANTIATE_TEST_CASE_P( + Registered, GeneratorMagicNumberTest, + ::testing::ValuesIn(std::vector>{ + {SPV_GENERATOR_KHRONOS, "Khronos"}, + {SPV_GENERATOR_LUNARG, "LunarG"}, + {SPV_GENERATOR_VALVE, "Valve"}, + {SPV_GENERATOR_CODEPLAY, "Codeplay"}, + {SPV_GENERATOR_NVIDIA, "NVIDIA"}, + {SPV_GENERATOR_ARM, "ARM"}, + {SPV_GENERATOR_KHRONOS_LLVM_TRANSLATOR, + "Khronos LLVM/SPIR-V Translator"}, + {SPV_GENERATOR_KHRONOS_ASSEMBLER, "Khronos SPIR-V Tools Assembler"}, + {SPV_GENERATOR_KHRONOS_GLSLANG, "Khronos Glslang Reference Front End"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + Unregistered, GeneratorMagicNumberTest, + ::testing::ValuesIn(std::vector>{ + // We read registered entries from the SPIR-V XML Registry file + // which can change over time. + {spv_generator_t(1000), "Unknown"}, + {spv_generator_t(9999), "Unknown"}, + }), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/hex_float_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/hex_float_test.cpp new file mode 100644 index 00000000000..87450609fe3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/hex_float_test.cpp @@ -0,0 +1,1331 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/util/hex_float.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace utils { +namespace { + +using ::testing::Eq; + +// In this file "encode" means converting a number into a string, +// and "decode" means converting a string into a number. + +using HexFloatTest = + ::testing::TestWithParam, std::string>>; +using DecodeHexFloatTest = + ::testing::TestWithParam>>; +using HexDoubleTest = + ::testing::TestWithParam, std::string>>; +using DecodeHexDoubleTest = + ::testing::TestWithParam>>; +using RoundTripFloatTest = ::testing::TestWithParam; +using RoundTripDoubleTest = ::testing::TestWithParam; + +// Hex-encodes a float value. +template +std::string EncodeViaHexFloat(const T& value) { + std::stringstream ss; + ss << HexFloat(value); + return ss.str(); +} + +// The following two tests can't be DRY because they take different parameter +// types. + +TEST_P(HexFloatTest, EncodeCorrectly) { + EXPECT_THAT(EncodeViaHexFloat(GetParam().first), Eq(GetParam().second)); +} + +TEST_P(HexDoubleTest, EncodeCorrectly) { + EXPECT_THAT(EncodeViaHexFloat(GetParam().first), Eq(GetParam().second)); +} + +// Decodes a hex-float string. +template +FloatProxy Decode(const std::string& str) { + HexFloat> decoded(0.f); + EXPECT_TRUE((std::stringstream(str) >> decoded).eof()); + return decoded.value(); +} + +TEST_P(HexFloatTest, DecodeCorrectly) { + EXPECT_THAT(Decode(GetParam().second), Eq(GetParam().first)); +} + +TEST_P(HexDoubleTest, DecodeCorrectly) { + EXPECT_THAT(Decode(GetParam().second), Eq(GetParam().first)); +} + +INSTANTIATE_TEST_CASE_P( + Float32Tests, HexFloatTest, + ::testing::ValuesIn(std::vector, std::string>>({ + {0.f, "0x0p+0"}, + {1.f, "0x1p+0"}, + {2.f, "0x1p+1"}, + {3.f, "0x1.8p+1"}, + {0.5f, "0x1p-1"}, + {0.25f, "0x1p-2"}, + {0.75f, "0x1.8p-1"}, + {-0.f, "-0x0p+0"}, + {-1.f, "-0x1p+0"}, + {-0.5f, "-0x1p-1"}, + {-0.25f, "-0x1p-2"}, + {-0.75f, "-0x1.8p-1"}, + + // Larger numbers + {512.f, "0x1p+9"}, + {-512.f, "-0x1p+9"}, + {1024.f, "0x1p+10"}, + {-1024.f, "-0x1p+10"}, + {1024.f + 8.f, "0x1.02p+10"}, + {-1024.f - 8.f, "-0x1.02p+10"}, + + // Small numbers + {1.0f / 512.f, "0x1p-9"}, + {1.0f / -512.f, "-0x1p-9"}, + {1.0f / 1024.f, "0x1p-10"}, + {1.0f / -1024.f, "-0x1p-10"}, + {1.0f / 1024.f + 1.0f / 8.f, "0x1.02p-3"}, + {1.0f / -1024.f - 1.0f / 8.f, "-0x1.02p-3"}, + + // lowest non-denorm + {float(ldexp(1.0f, -126)), "0x1p-126"}, + {float(ldexp(-1.0f, -126)), "-0x1p-126"}, + + // Denormalized values + {float(ldexp(1.0f, -127)), "0x1p-127"}, + {float(ldexp(1.0f, -127) / 2.0f), "0x1p-128"}, + {float(ldexp(1.0f, -127) / 4.0f), "0x1p-129"}, + {float(ldexp(1.0f, -127) / 8.0f), "0x1p-130"}, + {float(ldexp(-1.0f, -127)), "-0x1p-127"}, + {float(ldexp(-1.0f, -127) / 2.0f), "-0x1p-128"}, + {float(ldexp(-1.0f, -127) / 4.0f), "-0x1p-129"}, + {float(ldexp(-1.0f, -127) / 8.0f), "-0x1p-130"}, + + {float(ldexp(1.0, -127) + (ldexp(1.0, -127) / 2.0f)), "0x1.8p-127"}, + {float(ldexp(1.0, -127) / 2.0 + (ldexp(1.0, -127) / 4.0f)), + "0x1.8p-128"}, + + })), ); + +INSTANTIATE_TEST_CASE_P( + Float32NanTests, HexFloatTest, + ::testing::ValuesIn(std::vector, std::string>>({ + // Various NAN and INF cases + {uint32_t(0xFF800000), "-0x1p+128"}, // -inf + {uint32_t(0x7F800000), "0x1p+128"}, // inf + {uint32_t(0xFFC00000), "-0x1.8p+128"}, // -nan + {uint32_t(0xFF800100), "-0x1.0002p+128"}, // -nan + {uint32_t(0xFF800c00), "-0x1.0018p+128"}, // -nan + {uint32_t(0xFF80F000), "-0x1.01ep+128"}, // -nan + {uint32_t(0xFFFFFFFF), "-0x1.fffffep+128"}, // -nan + {uint32_t(0x7FC00000), "0x1.8p+128"}, // +nan + {uint32_t(0x7F800100), "0x1.0002p+128"}, // +nan + {uint32_t(0x7f800c00), "0x1.0018p+128"}, // +nan + {uint32_t(0x7F80F000), "0x1.01ep+128"}, // +nan + {uint32_t(0x7FFFFFFF), "0x1.fffffep+128"}, // +nan + })), ); + +INSTANTIATE_TEST_CASE_P( + Float64Tests, HexDoubleTest, + ::testing::ValuesIn( + std::vector, std::string>>({ + {0., "0x0p+0"}, + {1., "0x1p+0"}, + {2., "0x1p+1"}, + {3., "0x1.8p+1"}, + {0.5, "0x1p-1"}, + {0.25, "0x1p-2"}, + {0.75, "0x1.8p-1"}, + {-0., "-0x0p+0"}, + {-1., "-0x1p+0"}, + {-0.5, "-0x1p-1"}, + {-0.25, "-0x1p-2"}, + {-0.75, "-0x1.8p-1"}, + + // Larger numbers + {512., "0x1p+9"}, + {-512., "-0x1p+9"}, + {1024., "0x1p+10"}, + {-1024., "-0x1p+10"}, + {1024. + 8., "0x1.02p+10"}, + {-1024. - 8., "-0x1.02p+10"}, + + // Large outside the range of normal floats + {ldexp(1.0, 128), "0x1p+128"}, + {ldexp(1.0, 129), "0x1p+129"}, + {ldexp(-1.0, 128), "-0x1p+128"}, + {ldexp(-1.0, 129), "-0x1p+129"}, + {ldexp(1.0, 128) + ldexp(1.0, 90), "0x1.0000000004p+128"}, + {ldexp(1.0, 129) + ldexp(1.0, 120), "0x1.008p+129"}, + {ldexp(-1.0, 128) + ldexp(1.0, 90), "-0x1.fffffffff8p+127"}, + {ldexp(-1.0, 129) + ldexp(1.0, 120), "-0x1.ffp+128"}, + + // Small numbers + {1.0 / 512., "0x1p-9"}, + {1.0 / -512., "-0x1p-9"}, + {1.0 / 1024., "0x1p-10"}, + {1.0 / -1024., "-0x1p-10"}, + {1.0 / 1024. + 1.0 / 8., "0x1.02p-3"}, + {1.0 / -1024. - 1.0 / 8., "-0x1.02p-3"}, + + // Small outside the range of normal floats + {ldexp(1.0, -128), "0x1p-128"}, + {ldexp(1.0, -129), "0x1p-129"}, + {ldexp(-1.0, -128), "-0x1p-128"}, + {ldexp(-1.0, -129), "-0x1p-129"}, + {ldexp(1.0, -128) + ldexp(1.0, -90), "0x1.0000000004p-90"}, + {ldexp(1.0, -129) + ldexp(1.0, -120), "0x1.008p-120"}, + {ldexp(-1.0, -128) + ldexp(1.0, -90), "0x1.fffffffff8p-91"}, + {ldexp(-1.0, -129) + ldexp(1.0, -120), "0x1.ffp-121"}, + + // lowest non-denorm + {ldexp(1.0, -1022), "0x1p-1022"}, + {ldexp(-1.0, -1022), "-0x1p-1022"}, + + // Denormalized values + {ldexp(1.0, -1023), "0x1p-1023"}, + {ldexp(1.0, -1023) / 2.0, "0x1p-1024"}, + {ldexp(1.0, -1023) / 4.0, "0x1p-1025"}, + {ldexp(1.0, -1023) / 8.0, "0x1p-1026"}, + {ldexp(-1.0, -1024), "-0x1p-1024"}, + {ldexp(-1.0, -1024) / 2.0, "-0x1p-1025"}, + {ldexp(-1.0, -1024) / 4.0, "-0x1p-1026"}, + {ldexp(-1.0, -1024) / 8.0, "-0x1p-1027"}, + + {ldexp(1.0, -1023) + (ldexp(1.0, -1023) / 2.0), "0x1.8p-1023"}, + {ldexp(1.0, -1023) / 2.0 + (ldexp(1.0, -1023) / 4.0), + "0x1.8p-1024"}, + + })), ); + +INSTANTIATE_TEST_CASE_P( + Float64NanTests, HexDoubleTest, + ::testing::ValuesIn(std::vector< + std::pair, std::string>>({ + // Various NAN and INF cases + {uint64_t(0xFFF0000000000000LL), "-0x1p+1024"}, // -inf + {uint64_t(0x7FF0000000000000LL), "0x1p+1024"}, // +inf + {uint64_t(0xFFF8000000000000LL), "-0x1.8p+1024"}, // -nan + {uint64_t(0xFFF0F00000000000LL), "-0x1.0fp+1024"}, // -nan + {uint64_t(0xFFF0000000000001LL), "-0x1.0000000000001p+1024"}, // -nan + {uint64_t(0xFFF0000300000000LL), "-0x1.00003p+1024"}, // -nan + {uint64_t(0xFFFFFFFFFFFFFFFFLL), "-0x1.fffffffffffffp+1024"}, // -nan + {uint64_t(0x7FF8000000000000LL), "0x1.8p+1024"}, // +nan + {uint64_t(0x7FF0F00000000000LL), "0x1.0fp+1024"}, // +nan + {uint64_t(0x7FF0000000000001LL), "0x1.0000000000001p+1024"}, // -nan + {uint64_t(0x7FF0000300000000LL), "0x1.00003p+1024"}, // -nan + {uint64_t(0x7FFFFFFFFFFFFFFFLL), "0x1.fffffffffffffp+1024"}, // -nan + })), ); + +// Tests that encoding a value and decoding it again restores +// the same value. +TEST_P(RoundTripFloatTest, CanStoreAccurately) { + std::stringstream ss; + ss << FloatProxy(GetParam()); + ss.seekg(0); + FloatProxy res; + ss >> res; + EXPECT_THAT(GetParam(), Eq(res.getAsFloat())); +} + +TEST_P(RoundTripDoubleTest, CanStoreAccurately) { + std::stringstream ss; + ss << FloatProxy(GetParam()); + ss.seekg(0); + FloatProxy res; + ss >> res; + EXPECT_THAT(GetParam(), Eq(res.getAsFloat())); +} + +INSTANTIATE_TEST_CASE_P( + Float32StoreTests, RoundTripFloatTest, + ::testing::ValuesIn(std::vector( + {// Value requiring more than 6 digits of precision to be + // represented accurately. + 3.0000002f}))); + +INSTANTIATE_TEST_CASE_P( + Float64StoreTests, RoundTripDoubleTest, + ::testing::ValuesIn(std::vector( + {// Value requiring more than 15 digits of precision to be + // represented accurately. + 1.5000000000000002}))); + +TEST(HexFloatStreamTest, OperatorLeftShiftPreservesFloatAndFill) { + std::stringstream s; + s << std::setw(4) << std::oct << std::setfill('x') << 8 << " " + << FloatProxy(uint32_t(0xFF800100)) << " " << std::setw(4) << 9; + EXPECT_THAT(s.str(), Eq(std::string("xx10 -0x1.0002p+128 xx11"))); +} + +TEST(HexDoubleStreamTest, OperatorLeftShiftPreservesFloatAndFill) { + std::stringstream s; + s << std::setw(4) << std::oct << std::setfill('x') << 8 << " " + << FloatProxy(uint64_t(0x7FF0F00000000000LL)) << " " << std::setw(4) + << 9; + EXPECT_THAT(s.str(), Eq(std::string("xx10 0x1.0fp+1024 xx11"))); +} + +TEST_P(DecodeHexFloatTest, DecodeCorrectly) { + EXPECT_THAT(Decode(GetParam().first), Eq(GetParam().second)); +} + +TEST_P(DecodeHexDoubleTest, DecodeCorrectly) { + EXPECT_THAT(Decode(GetParam().first), Eq(GetParam().second)); +} + +INSTANTIATE_TEST_CASE_P( + Float32DecodeTests, DecodeHexFloatTest, + ::testing::ValuesIn(std::vector>>({ + {"0x0p+000", 0.f}, + {"0x0p0", 0.f}, + {"0x0p-0", 0.f}, + + // flush to zero cases + {"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}, // Fraction causes additional underflow. + {"0x0.01p-142", 0.f}, + + // Some floats that do not encode the same way as they decode. + {"0x2p+0", 2.f}, + {"0xFFp+0", 255.f}, + {"0x0.8p+0", 0.5f}, + {"0x0.4p+0", 0.25f}, + })), ); + +INSTANTIATE_TEST_CASE_P( + Float32DecodeInfTests, DecodeHexFloatTest, + ::testing::ValuesIn(std::vector>>({ + // inf cases + {"-0x1p+128", uint32_t(0xFF800000)}, // -inf + {"0x32p+127", uint32_t(0x7F800000)}, // inf + {"0x32p+500", uint32_t(0x7F800000)}, // inf + {"-0x32p+127", uint32_t(0xFF800000)}, // -inf + })), ); + +INSTANTIATE_TEST_CASE_P( + Float64DecodeTests, DecodeHexDoubleTest, + ::testing::ValuesIn( + std::vector>>({ + {"0x0p+000", 0.}, + {"0x0p0", 0.}, + {"0x0p-0", 0.}, + + // flush to zero cases + {"0x1p-5000", 0.}, // Exponent underflows. + {"-0x1p-5000", -0.}, + {"0x0.0000000000000001p-1023", 0.}, // Fraction causes underflow. + {"-0x0.000000000000001p-1024", -0.}, + {"-0x0.01p-1090", -0.f}, // Fraction causes additional underflow. + {"0x0.01p-1090", 0.}, + + // Some floats that do not encode the same way as they decode. + {"0x2p+0", 2.}, + {"0xFFp+0", 255.}, + {"0x0.8p+0", 0.5}, + {"0x0.4p+0", 0.25}, + })), ); + +INSTANTIATE_TEST_CASE_P( + Float64DecodeInfTests, DecodeHexDoubleTest, + ::testing::ValuesIn( + std::vector>>({ + // inf cases + {"-0x1p+1024", uint64_t(0xFFF0000000000000)}, // -inf + {"0x32p+1023", uint64_t(0x7FF0000000000000)}, // inf + {"0x32p+5000", uint64_t(0x7FF0000000000000)}, // inf + {"-0x32p+1023", uint64_t(0xFFF0000000000000)}, // -inf + })), ); + +TEST(FloatProxy, ValidConversion) { + EXPECT_THAT(FloatProxy(1.f).getAsFloat(), Eq(1.0f)); + EXPECT_THAT(FloatProxy(32.f).getAsFloat(), Eq(32.0f)); + EXPECT_THAT(FloatProxy(-1.f).getAsFloat(), Eq(-1.0f)); + EXPECT_THAT(FloatProxy(0.f).getAsFloat(), Eq(0.0f)); + EXPECT_THAT(FloatProxy(-0.f).getAsFloat(), Eq(-0.0f)); + EXPECT_THAT(FloatProxy(1.2e32f).getAsFloat(), Eq(1.2e32f)); + + EXPECT_TRUE(std::isinf(FloatProxy(uint32_t(0xFF800000)).getAsFloat())); + EXPECT_TRUE(std::isinf(FloatProxy(uint32_t(0x7F800000)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0xFFC00000)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0xFF800100)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0xFF800c00)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0xFF80F000)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0xFFFFFFFF)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0x7FC00000)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0x7F800100)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0x7f800c00)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0x7F80F000)).getAsFloat())); + EXPECT_TRUE(std::isnan(FloatProxy(uint32_t(0x7FFFFFFF)).getAsFloat())); + + EXPECT_THAT(FloatProxy(uint32_t(0xFF800000)).data(), Eq(0xFF800000u)); + EXPECT_THAT(FloatProxy(uint32_t(0x7F800000)).data(), Eq(0x7F800000u)); + EXPECT_THAT(FloatProxy(uint32_t(0xFFC00000)).data(), Eq(0xFFC00000u)); + EXPECT_THAT(FloatProxy(uint32_t(0xFF800100)).data(), Eq(0xFF800100u)); + EXPECT_THAT(FloatProxy(uint32_t(0xFF800c00)).data(), Eq(0xFF800c00u)); + EXPECT_THAT(FloatProxy(uint32_t(0xFF80F000)).data(), Eq(0xFF80F000u)); + EXPECT_THAT(FloatProxy(uint32_t(0xFFFFFFFF)).data(), Eq(0xFFFFFFFFu)); + EXPECT_THAT(FloatProxy(uint32_t(0x7FC00000)).data(), Eq(0x7FC00000u)); + EXPECT_THAT(FloatProxy(uint32_t(0x7F800100)).data(), Eq(0x7F800100u)); + EXPECT_THAT(FloatProxy(uint32_t(0x7f800c00)).data(), Eq(0x7f800c00u)); + EXPECT_THAT(FloatProxy(uint32_t(0x7F80F000)).data(), Eq(0x7F80F000u)); + EXPECT_THAT(FloatProxy(uint32_t(0x7FFFFFFF)).data(), Eq(0x7FFFFFFFu)); +} + +TEST(FloatProxy, Nan) { + EXPECT_TRUE(FloatProxy(uint32_t(0xFFC00000)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0xFF800100)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0xFF800c00)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0xFF80F000)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0xFFFFFFFF)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0x7FC00000)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0x7F800100)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0x7f800c00)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0x7F80F000)).isNan()); + EXPECT_TRUE(FloatProxy(uint32_t(0x7FFFFFFF)).isNan()); +} + +TEST(FloatProxy, Negation) { + EXPECT_THAT((-FloatProxy(1.f)).getAsFloat(), Eq(-1.0f)); + EXPECT_THAT((-FloatProxy(0.f)).getAsFloat(), Eq(-0.0f)); + + EXPECT_THAT((-FloatProxy(-1.f)).getAsFloat(), Eq(1.0f)); + EXPECT_THAT((-FloatProxy(-0.f)).getAsFloat(), Eq(0.0f)); + + EXPECT_THAT((-FloatProxy(32.f)).getAsFloat(), Eq(-32.0f)); + EXPECT_THAT((-FloatProxy(-32.f)).getAsFloat(), Eq(32.0f)); + + EXPECT_THAT((-FloatProxy(1.2e32f)).getAsFloat(), Eq(-1.2e32f)); + EXPECT_THAT((-FloatProxy(-1.2e32f)).getAsFloat(), Eq(1.2e32f)); + + EXPECT_THAT( + (-FloatProxy(std::numeric_limits::infinity())).getAsFloat(), + Eq(-std::numeric_limits::infinity())); + EXPECT_THAT((-FloatProxy(-std::numeric_limits::infinity())) + .getAsFloat(), + Eq(std::numeric_limits::infinity())); +} + +// Test conversion of FloatProxy values to strings. +// +// In previous cases, we always wrapped the FloatProxy value in a HexFloat +// before conversion to a string. In the following cases, the FloatProxy +// decides for itself whether to print as a regular number or as a hex float. + +using FloatProxyFloatTest = + ::testing::TestWithParam, std::string>>; +using FloatProxyDoubleTest = + ::testing::TestWithParam, std::string>>; + +// Converts a float value to a string via a FloatProxy. +template +std::string EncodeViaFloatProxy(const T& value) { + std::stringstream ss; + ss << value; + return ss.str(); +} + +// Converts a floating point string so that the exponent prefix +// is 'e', and the exponent value does not have leading zeros. +// The Microsoft runtime library likes to write things like "2.5E+010". +// Convert that to "2.5e+10". +// We don't care what happens to strings that are not floating point +// strings. +std::string NormalizeExponentInFloatString(std::string in) { + std::string result; + // Reserve one spot for the terminating null, even when the sscanf fails. + std::vector prefix(in.size() + 1); + char e; + char plus_or_minus; + int exponent; // in base 10 + if ((4 == std::sscanf(in.c_str(), "%[-+.0123456789]%c%c%d", prefix.data(), &e, + &plus_or_minus, &exponent)) && + (e == 'e' || e == 'E') && + (plus_or_minus == '-' || plus_or_minus == '+')) { + // It looks like a floating point value with exponent. + std::stringstream out; + out << prefix.data() << 'e' << plus_or_minus << exponent; + result = out.str(); + } else { + result = in; + } + return result; +} + +TEST(NormalizeFloat, Sample) { + EXPECT_THAT(NormalizeExponentInFloatString(""), Eq("")); + EXPECT_THAT(NormalizeExponentInFloatString("1e-12"), Eq("1e-12")); + EXPECT_THAT(NormalizeExponentInFloatString("1E+14"), Eq("1e+14")); + EXPECT_THAT(NormalizeExponentInFloatString("1e-0012"), Eq("1e-12")); + EXPECT_THAT(NormalizeExponentInFloatString("1.263E+014"), Eq("1.263e+14")); +} + +// The following two tests can't be DRY because they take different parameter +// types. +TEST_P(FloatProxyFloatTest, EncodeCorrectly) { + EXPECT_THAT( + NormalizeExponentInFloatString(EncodeViaFloatProxy(GetParam().first)), + Eq(GetParam().second)); +} + +TEST_P(FloatProxyDoubleTest, EncodeCorrectly) { + EXPECT_THAT( + NormalizeExponentInFloatString(EncodeViaFloatProxy(GetParam().first)), + Eq(GetParam().second)); +} + +INSTANTIATE_TEST_CASE_P( + Float32Tests, FloatProxyFloatTest, + ::testing::ValuesIn(std::vector, std::string>>({ + // Zero + {0.f, "0"}, + // Normal numbers + {1.f, "1"}, + {-0.25f, "-0.25"}, + {1000.0f, "1000"}, + + // Still normal numbers, but with large magnitude exponents. + {float(ldexp(1.f, 126)), "8.50705917e+37"}, + {float(ldexp(-1.f, -126)), "-1.17549435e-38"}, + + // denormalized values are printed as hex floats. + {float(ldexp(1.0f, -127)), "0x1p-127"}, + {float(ldexp(1.5f, -128)), "0x1.8p-128"}, + {float(ldexp(1.25, -129)), "0x1.4p-129"}, + {float(ldexp(1.125, -130)), "0x1.2p-130"}, + {float(ldexp(-1.0f, -127)), "-0x1p-127"}, + {float(ldexp(-1.0f, -128)), "-0x1p-128"}, + {float(ldexp(-1.0f, -129)), "-0x1p-129"}, + {float(ldexp(-1.5f, -130)), "-0x1.8p-130"}, + + // NaNs + {FloatProxy(uint32_t(0xFFC00000)), "-0x1.8p+128"}, + {FloatProxy(uint32_t(0xFF800100)), "-0x1.0002p+128"}, + + {std::numeric_limits::infinity(), "0x1p+128"}, + {-std::numeric_limits::infinity(), "-0x1p+128"}, + })), ); + +INSTANTIATE_TEST_CASE_P( + Float64Tests, FloatProxyDoubleTest, + ::testing::ValuesIn( + std::vector, std::string>>({ + {0., "0"}, + {1., "1"}, + {-0.25, "-0.25"}, + {1000.0, "1000"}, + + // Large outside the range of normal floats + {ldexp(1.0, 128), "3.4028236692093846e+38"}, + {ldexp(1.5, 129), "1.0208471007628154e+39"}, + {ldexp(-1.0, 128), "-3.4028236692093846e+38"}, + {ldexp(-1.5, 129), "-1.0208471007628154e+39"}, + + // Small outside the range of normal floats + {ldexp(1.5, -129), "2.2040519077917891e-39"}, + {ldexp(-1.5, -129), "-2.2040519077917891e-39"}, + + // lowest non-denorm + {ldexp(1.0, -1022), "2.2250738585072014e-308"}, + {ldexp(-1.0, -1022), "-2.2250738585072014e-308"}, + + // Denormalized values + {ldexp(1.125, -1023), "0x1.2p-1023"}, + {ldexp(-1.375, -1024), "-0x1.6p-1024"}, + + // NaNs + {uint64_t(0x7FF8000000000000LL), "0x1.8p+1024"}, + {uint64_t(0xFFF0F00000000000LL), "-0x1.0fp+1024"}, + + // Infinity + {std::numeric_limits::infinity(), "0x1p+1024"}, + {-std::numeric_limits::infinity(), "-0x1p+1024"}, + + })), ); + +// double is used so that unbiased_exponent can be used with the output +// of ldexp directly. +int32_t unbiased_exponent(double f) { + return HexFloat>(static_cast(f)) + .getUnbiasedNormalizedExponent(); +} + +int16_t unbiased_half_exponent(uint16_t f) { + return HexFloat>(f).getUnbiasedNormalizedExponent(); +} + +TEST(HexFloatOperationTest, UnbiasedExponent) { + // Float cases + EXPECT_EQ(0, unbiased_exponent(ldexp(1.0f, 0))); + EXPECT_EQ(-32, unbiased_exponent(ldexp(1.0f, -32))); + EXPECT_EQ(42, unbiased_exponent(ldexp(1.0f, 42))); + EXPECT_EQ(125, unbiased_exponent(ldexp(1.0f, 125))); + + EXPECT_EQ(128, + HexFloat>(std::numeric_limits::infinity()) + .getUnbiasedNormalizedExponent()); + + EXPECT_EQ(-100, unbiased_exponent(ldexp(1.0f, -100))); + EXPECT_EQ(-127, unbiased_exponent(ldexp(1.0f, -127))); // First denorm + EXPECT_EQ(-128, unbiased_exponent(ldexp(1.0f, -128))); + EXPECT_EQ(-129, unbiased_exponent(ldexp(1.0f, -129))); + EXPECT_EQ(-140, unbiased_exponent(ldexp(1.0f, -140))); + // Smallest representable number + EXPECT_EQ(-126 - 23, unbiased_exponent(ldexp(1.0f, -126 - 23))); + // Should get rounded to 0 first. + EXPECT_EQ(0, unbiased_exponent(ldexp(1.0f, -127 - 23))); + + // Float16 cases + // The exponent is represented in the bits 0x7C00 + // The offset is -15 + EXPECT_EQ(0, unbiased_half_exponent(0x3C00)); + EXPECT_EQ(3, unbiased_half_exponent(0x4800)); + EXPECT_EQ(-1, unbiased_half_exponent(0x3800)); + EXPECT_EQ(-14, unbiased_half_exponent(0x0400)); + EXPECT_EQ(16, unbiased_half_exponent(0x7C00)); + EXPECT_EQ(10, unbiased_half_exponent(0x6400)); + + // Smallest representable number + EXPECT_EQ(-24, unbiased_half_exponent(0x0001)); +} + +// Creates a float that is the sum of 1/(2 ^ fractions[i]) for i in factions +float float_fractions(const std::vector& fractions) { + float f = 0; + for (int32_t i : fractions) { + f += std::ldexp(1.0f, -i); + } + return f; +} + +// Returns the normalized significand of a HexFloat> +// that was created by calling float_fractions with the input fractions, +// raised to the power of exp. +uint32_t normalized_significand(const std::vector& fractions, + uint32_t exp) { + return HexFloat>( + static_cast(ldexp(float_fractions(fractions), exp))) + .getNormalizedSignificand(); +} + +// Sets the bits from MSB to LSB of the significand part of a float. +// For example 0 would set the bit 23 (counting from LSB to MSB), +// and 1 would set the 22nd bit. +uint32_t bits_set(const std::vector& bits) { + const uint32_t top_bit = 1u << 22u; + uint32_t val = 0; + for (uint32_t i : bits) { + val |= top_bit >> i; + } + return val; +} + +// The same as bits_set but for a Float16 value instead of 32-bit floating +// point. +uint16_t half_bits_set(const std::vector& bits) { + const uint32_t top_bit = 1u << 9u; + uint32_t val = 0; + for (uint32_t i : bits) { + val |= top_bit >> i; + } + return static_cast(val); +} + +TEST(HexFloatOperationTest, NormalizedSignificand) { + // For normalized numbers (the following) it should be a simple matter + // of getting rid of the top implicit bit + EXPECT_EQ(bits_set({}), normalized_significand({0}, 0)); + EXPECT_EQ(bits_set({0}), normalized_significand({0, 1}, 0)); + EXPECT_EQ(bits_set({0, 1}), normalized_significand({0, 1, 2}, 0)); + EXPECT_EQ(bits_set({1}), normalized_significand({0, 2}, 0)); + EXPECT_EQ(bits_set({1}), normalized_significand({0, 2}, 32)); + EXPECT_EQ(bits_set({1}), normalized_significand({0, 2}, 126)); + + // For denormalized numbers we expect the normalized significand to + // shift as if it were normalized. This means, in practice that the + // top_most set bit will be cut off. Looks very similar to above (on purpose) + EXPECT_EQ(bits_set({}), + normalized_significand({0}, static_cast(-127))); + EXPECT_EQ(bits_set({3}), + normalized_significand({0, 4}, static_cast(-128))); + EXPECT_EQ(bits_set({3}), + normalized_significand({0, 4}, static_cast(-127))); + EXPECT_EQ(bits_set({}), + normalized_significand({22}, static_cast(-127))); + EXPECT_EQ(bits_set({0}), + normalized_significand({21, 22}, static_cast(-127))); +} + +// Returns the 32-bit floating point value created by +// calling setFromSignUnbiasedExponentAndNormalizedSignificand +// on a HexFloat> +float set_from_sign(bool negative, int32_t unbiased_exponent, + uint32_t significand, bool round_denorm_up) { + HexFloat> f(0.f); + f.setFromSignUnbiasedExponentAndNormalizedSignificand( + negative, unbiased_exponent, significand, round_denorm_up); + return f.value().getAsFloat(); +} + +TEST(HexFloatOperationTests, + SetFromSignUnbiasedExponentAndNormalizedSignificand) { + EXPECT_EQ(1.f, set_from_sign(false, 0, 0, false)); + + // Tests insertion of various denormalized numbers with and without round up. + EXPECT_EQ(static_cast(ldexp(1.f, -149)), + set_from_sign(false, -149, 0, false)); + EXPECT_EQ(static_cast(ldexp(1.f, -149)), + set_from_sign(false, -149, 0, true)); + EXPECT_EQ(0.f, set_from_sign(false, -150, 1, false)); + EXPECT_EQ(static_cast(ldexp(1.f, -149)), + set_from_sign(false, -150, 1, true)); + + EXPECT_EQ(ldexp(1.0f, -127), set_from_sign(false, -127, 0, false)); + EXPECT_EQ(ldexp(1.0f, -128), set_from_sign(false, -128, 0, false)); + EXPECT_EQ(float_fractions({0, 1, 2, 5}), + set_from_sign(false, 0, bits_set({0, 1, 4}), false)); + EXPECT_EQ(ldexp(float_fractions({0, 1, 2, 5}), -32), + set_from_sign(false, -32, bits_set({0, 1, 4}), false)); + EXPECT_EQ(ldexp(float_fractions({0, 1, 2, 5}), -128), + set_from_sign(false, -128, bits_set({0, 1, 4}), false)); + + // The negative cases from above. + EXPECT_EQ(-1.f, set_from_sign(true, 0, 0, false)); + EXPECT_EQ(-ldexp(1.0, -127), set_from_sign(true, -127, 0, false)); + EXPECT_EQ(-ldexp(1.0, -128), set_from_sign(true, -128, 0, false)); + EXPECT_EQ(-float_fractions({0, 1, 2, 5}), + set_from_sign(true, 0, bits_set({0, 1, 4}), false)); + EXPECT_EQ(-ldexp(float_fractions({0, 1, 2, 5}), -32), + set_from_sign(true, -32, bits_set({0, 1, 4}), false)); + EXPECT_EQ(-ldexp(float_fractions({0, 1, 2, 5}), -128), + set_from_sign(true, -128, bits_set({0, 1, 4}), false)); +} + +TEST(HexFloatOperationTests, NonRounding) { + // Rounding from 32-bit hex-float to 32-bit hex-float should be trivial, + // except in the denorm case which is a bit more complex. + using HF = HexFloat>; + bool carry_bit = false; + + round_direction rounding[] = {round_direction::kToZero, + round_direction::kToNearestEven, + round_direction::kToPositiveInfinity, + round_direction::kToNegativeInfinity}; + + // Everything fits, so this should be straight-forward + for (round_direction round : rounding) { + EXPECT_EQ(bits_set({}), + HF(0.f).getRoundedNormalizedSignificand(round, &carry_bit)); + EXPECT_FALSE(carry_bit); + + EXPECT_EQ(bits_set({0}), + HF(float_fractions({0, 1})) + .getRoundedNormalizedSignificand(round, &carry_bit)); + EXPECT_FALSE(carry_bit); + + EXPECT_EQ(bits_set({1, 3}), + HF(float_fractions({0, 2, 4})) + .getRoundedNormalizedSignificand(round, &carry_bit)); + EXPECT_FALSE(carry_bit); + + EXPECT_EQ( + bits_set({0, 1, 4}), + HF(static_cast(-ldexp(float_fractions({0, 1, 2, 5}), -128))) + .getRoundedNormalizedSignificand(round, &carry_bit)); + EXPECT_FALSE(carry_bit); + + EXPECT_EQ(bits_set({0, 1, 4, 22}), + HF(static_cast(float_fractions({0, 1, 2, 5, 23}))) + .getRoundedNormalizedSignificand(round, &carry_bit)); + EXPECT_FALSE(carry_bit); + } +} + +using RD = round_direction; +struct RoundSignificandCase { + float source_float; + std::pair expected_results; + round_direction round; +}; + +using HexFloatRoundTest = ::testing::TestWithParam; + +TEST_P(HexFloatRoundTest, RoundDownToFP16) { + using HF = HexFloat>; + using HF16 = HexFloat>; + + HF input_value(GetParam().source_float); + bool carry_bit = false; + EXPECT_EQ(GetParam().expected_results.first, + input_value.getRoundedNormalizedSignificand(GetParam().round, + &carry_bit)); + EXPECT_EQ(carry_bit, GetParam().expected_results.second); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(F32ToF16, HexFloatRoundTest, + ::testing::ValuesIn(std::vector( + { + {float_fractions({0}), std::make_pair(half_bits_set({}), false), RD::kToZero}, + {float_fractions({0}), std::make_pair(half_bits_set({}), false), RD::kToNearestEven}, + {float_fractions({0}), std::make_pair(half_bits_set({}), false), RD::kToPositiveInfinity}, + {float_fractions({0}), std::make_pair(half_bits_set({}), false), RD::kToNegativeInfinity}, + {float_fractions({0, 1}), std::make_pair(half_bits_set({0}), false), RD::kToZero}, + + {float_fractions({0, 1, 11}), std::make_pair(half_bits_set({0}), false), RD::kToZero}, + {float_fractions({0, 1, 11}), std::make_pair(half_bits_set({0, 9}), false), RD::kToPositiveInfinity}, + {float_fractions({0, 1, 11}), std::make_pair(half_bits_set({0}), false), RD::kToNegativeInfinity}, + {float_fractions({0, 1, 11}), std::make_pair(half_bits_set({0}), false), RD::kToNearestEven}, + + {float_fractions({0, 1, 10, 11}), std::make_pair(half_bits_set({0, 9}), false), RD::kToZero}, + {float_fractions({0, 1, 10, 11}), std::make_pair(half_bits_set({0, 8}), false), RD::kToPositiveInfinity}, + {float_fractions({0, 1, 10, 11}), std::make_pair(half_bits_set({0, 9}), false), RD::kToNegativeInfinity}, + {float_fractions({0, 1, 10, 11}), std::make_pair(half_bits_set({0, 8}), false), RD::kToNearestEven}, + + {float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0}), false), RD::kToZero}, + {float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0, 9}), false), RD::kToPositiveInfinity}, + {float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0}), false), RD::kToNegativeInfinity}, + {float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0, 9}), false), RD::kToNearestEven}, + + {-float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0}), false), RD::kToZero}, + {-float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0}), false), RD::kToPositiveInfinity}, + {-float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0, 9}), false), RD::kToNegativeInfinity}, + {-float_fractions({0, 1, 11, 12}), std::make_pair(half_bits_set({0, 9}), false), RD::kToNearestEven}, + + {float_fractions({0, 1, 11, 22}), std::make_pair(half_bits_set({0}), false), RD::kToZero}, + {float_fractions({0, 1, 11, 22}), std::make_pair(half_bits_set({0, 9}), false), RD::kToPositiveInfinity}, + {float_fractions({0, 1, 11, 22}), std::make_pair(half_bits_set({0}), false), RD::kToNegativeInfinity}, + {float_fractions({0, 1, 11, 22}), std::make_pair(half_bits_set({0, 9}), false), RD::kToNearestEven}, + + // Carries + {float_fractions({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}), std::make_pair(half_bits_set({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), false), RD::kToZero}, + {float_fractions({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}), std::make_pair(half_bits_set({}), true), RD::kToPositiveInfinity}, + {float_fractions({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}), std::make_pair(half_bits_set({0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), false), RD::kToNegativeInfinity}, + {float_fractions({0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}), std::make_pair(half_bits_set({}), true), RD::kToNearestEven}, + + // Cases where original number was denorm. Note: this should have no effect + // the number is pre-normalized. + {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -128)), std::make_pair(half_bits_set({0}), false), RD::kToZero}, + {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -129)), std::make_pair(half_bits_set({0, 9}), false), RD::kToPositiveInfinity}, + {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -131)), std::make_pair(half_bits_set({0}), false), RD::kToNegativeInfinity}, + {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -130)), std::make_pair(half_bits_set({0, 9}), false), RD::kToNearestEven}, + })),); +// clang-format on + +struct UpCastSignificandCase { + uint16_t source_half; + uint32_t expected_result; +}; + +using HexFloatRoundUpSignificandTest = + ::testing::TestWithParam; +TEST_P(HexFloatRoundUpSignificandTest, Widening) { + using HF = HexFloat>; + using HF16 = HexFloat>; + bool carry_bit = false; + + round_direction rounding[] = {round_direction::kToZero, + round_direction::kToNearestEven, + round_direction::kToPositiveInfinity, + round_direction::kToNegativeInfinity}; + + // Everything fits, so everything should just be bit-shifts. + for (round_direction round : rounding) { + carry_bit = false; + HF16 input_value(GetParam().source_half); + EXPECT_EQ( + GetParam().expected_result, + input_value.getRoundedNormalizedSignificand(round, &carry_bit)) + << std::hex << "0x" + << input_value.getRoundedNormalizedSignificand(round, &carry_bit) + << " 0x" << GetParam().expected_result; + EXPECT_FALSE(carry_bit); + } +} + +INSTANTIATE_TEST_CASE_P( + F16toF32, HexFloatRoundUpSignificandTest, + // 0xFC00 of the source 16-bit hex value cover the sign and the exponent. + // They are ignored for this test. + ::testing::ValuesIn(std::vector({ + {0x3F00, 0x600000}, + {0x0F00, 0x600000}, + {0x0F01, 0x602000}, + {0x0FFF, 0x7FE000}, + })), ); + +struct DownCastTest { + float source_float; + uint16_t expected_half; + std::vector directions; +}; + +std::string get_round_text(round_direction direction) { +#define CASE(round_direction) \ + case round_direction: \ + return #round_direction + + switch (direction) { + CASE(round_direction::kToZero); + CASE(round_direction::kToPositiveInfinity); + CASE(round_direction::kToNegativeInfinity); + CASE(round_direction::kToNearestEven); + } +#undef CASE + return ""; +} + +using HexFloatFP32To16Tests = ::testing::TestWithParam; + +TEST_P(HexFloatFP32To16Tests, NarrowingCasts) { + using HF = HexFloat>; + using HF16 = HexFloat>; + HF f(GetParam().source_float); + for (auto round : GetParam().directions) { + HF16 half(0); + f.castTo(half, round); + EXPECT_EQ(GetParam().expected_half, half.value().getAsFloat().get_value()) + << get_round_text(round) << " " << std::hex + << BitwiseCast(GetParam().source_float) + << " cast to: " << half.value().getAsFloat().get_value(); + } +} + +const uint16_t positive_infinity = 0x7C00; +const uint16_t negative_infinity = 0xFC00; + +INSTANTIATE_TEST_CASE_P( + F32ToF16, HexFloatFP32To16Tests, + ::testing::ValuesIn(std::vector({ + // Exactly representable as half. + {0.f, + 0x0, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {-0.f, + 0x8000, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {1.0f, + 0x3C00, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {-1.0f, + 0xBC00, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + + {float_fractions({0, 1, 10}), + 0x3E01, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {-float_fractions({0, 1, 10}), + 0xBE01, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(ldexp(float_fractions({0, 1, 10}), 3)), + 0x4A01, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(-ldexp(float_fractions({0, 1, 10}), 3)), + 0xCA01, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + + // Underflow + {static_cast(ldexp(1.0f, -25)), + 0x0, + {RD::kToZero, RD::kToNegativeInfinity, RD::kToNearestEven}}, + {static_cast(ldexp(1.0f, -25)), 0x1, {RD::kToPositiveInfinity}}, + {static_cast(-ldexp(1.0f, -25)), + 0x8000, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNearestEven}}, + {static_cast(-ldexp(1.0f, -25)), + 0x8001, + {RD::kToNegativeInfinity}}, + {static_cast(ldexp(1.0f, -24)), + 0x1, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + + // Overflow + {static_cast(ldexp(1.0f, 16)), + positive_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(ldexp(1.0f, 18)), + positive_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(ldexp(1.3f, 16)), + positive_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(-ldexp(1.0f, 16)), + negative_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(-ldexp(1.0f, 18)), + negative_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {static_cast(-ldexp(1.3f, 16)), + negative_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + + // Transfer of Infinities + {std::numeric_limits::infinity(), + positive_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + {-std::numeric_limits::infinity(), + negative_infinity, + {RD::kToZero, RD::kToPositiveInfinity, RD::kToNegativeInfinity, + RD::kToNearestEven}}, + + // Nans are below because we cannot test for equality. + })), ); + +struct UpCastCase { + uint16_t source_half; + float expected_float; +}; + +using HexFloatFP16To32Tests = ::testing::TestWithParam; +TEST_P(HexFloatFP16To32Tests, WideningCasts) { + using HF = HexFloat>; + using HF16 = HexFloat>; + HF16 f(GetParam().source_half); + + round_direction rounding[] = {round_direction::kToZero, + round_direction::kToNearestEven, + round_direction::kToPositiveInfinity, + round_direction::kToNegativeInfinity}; + + // Everything fits, so everything should just be bit-shifts. + for (round_direction round : rounding) { + HF flt(0.f); + f.castTo(flt, round); + EXPECT_EQ(GetParam().expected_float, flt.value().getAsFloat()) + << get_round_text(round) << " " << std::hex + << BitwiseCast(GetParam().source_half) + << " cast to: " << flt.value().getAsFloat(); + } +} + +INSTANTIATE_TEST_CASE_P( + F16ToF32, HexFloatFP16To32Tests, + ::testing::ValuesIn(std::vector({ + {0x0000, 0.f}, + {0x8000, -0.f}, + {0x3C00, 1.0f}, + {0xBC00, -1.0f}, + {0x3F00, float_fractions({0, 1, 2})}, + {0xBF00, -float_fractions({0, 1, 2})}, + {0x3F01, float_fractions({0, 1, 2, 10})}, + {0xBF01, -float_fractions({0, 1, 2, 10})}, + + // denorm + {0x0001, static_cast(ldexp(1.0, -24))}, + {0x0002, static_cast(ldexp(1.0, -23))}, + {0x8001, static_cast(-ldexp(1.0, -24))}, + {0x8011, static_cast(-ldexp(1.0, -20) + -ldexp(1.0, -24))}, + + // inf + {0x7C00, std::numeric_limits::infinity()}, + {0xFC00, -std::numeric_limits::infinity()}, + })), ); + +TEST(HexFloatOperationTests, NanTests) { + using HF = HexFloat>; + using HF16 = HexFloat>; + round_direction rounding[] = {round_direction::kToZero, + round_direction::kToNearestEven, + round_direction::kToPositiveInfinity, + round_direction::kToNegativeInfinity}; + + // Everything fits, so everything should just be bit-shifts. + for (round_direction round : rounding) { + HF16 f16(0); + HF f(0.f); + HF(std::numeric_limits::quiet_NaN()).castTo(f16, round); + EXPECT_TRUE(f16.value().isNan()); + HF(std::numeric_limits::signaling_NaN()).castTo(f16, round); + EXPECT_TRUE(f16.value().isNan()); + + HF16(0x7C01).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + HF16(0x7C11).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + HF16(0xFC01).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + HF16(0x7C10).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + HF16(0xFF00).castTo(f, round); + EXPECT_TRUE(f.value().isNan()); + } +} + +// A test case for parsing good and bad HexFloat> literals. +template +struct FloatParseCase { + std::string literal; + bool negate_value; + bool expect_success; + HexFloat> expected_value; +}; + +using ParseNormalFloatTest = ::testing::TestWithParam>; + +TEST_P(ParseNormalFloatTest, Samples) { + std::stringstream input(GetParam().literal); + HexFloat> parsed_value(0.0f); + ParseNormalFloat(input, GetParam().negate_value, parsed_value); + EXPECT_NE(GetParam().expect_success, input.fail()) + << " literal: " << GetParam().literal + << " negate: " << GetParam().negate_value; + if (GetParam().expect_success) { + EXPECT_THAT(parsed_value.value(), Eq(GetParam().expected_value.value())) + << " literal: " << GetParam().literal + << " negate: " << GetParam().negate_value; + } +} + +// Returns a FloatParseCase with expected failure. +template +FloatParseCase BadFloatParseCase(std::string literal, bool negate_value, + T expected_value) { + HexFloat> proxy_expected_value(expected_value); + return FloatParseCase{literal, negate_value, false, proxy_expected_value}; +} + +// Returns a FloatParseCase that should successfully parse to a given value. +template +FloatParseCase GoodFloatParseCase(std::string literal, bool negate_value, + T expected_value) { + HexFloat> proxy_expected_value(expected_value); + return FloatParseCase{literal, negate_value, true, proxy_expected_value}; +} + +INSTANTIATE_TEST_CASE_P( + FloatParse, ParseNormalFloatTest, + ::testing::ValuesIn(std::vector>{ + // Failing cases due to trivially incorrect syntax. + BadFloatParseCase("abc", false, 0.0f), + BadFloatParseCase("abc", true, 0.0f), + + // Valid cases. + GoodFloatParseCase("0", false, 0.0f), + GoodFloatParseCase("0.0", false, 0.0f), + GoodFloatParseCase("-0.0", false, -0.0f), + GoodFloatParseCase("2.0", false, 2.0f), + GoodFloatParseCase("-2.0", false, -2.0f), + GoodFloatParseCase("+2.0", false, 2.0f), + // Cases with negate_value being true. + GoodFloatParseCase("0.0", true, -0.0f), + GoodFloatParseCase("2.0", true, -2.0f), + + // When negate_value is true, we should not accept a + // leading minus or plus. + BadFloatParseCase("-0.0", true, 0.0f), + BadFloatParseCase("-2.0", true, 0.0f), + BadFloatParseCase("+0.0", true, 0.0f), + BadFloatParseCase("+2.0", true, 0.0f), + + // Overflow is an error for 32-bit float parsing. + BadFloatParseCase("1e40", false, FLT_MAX), + BadFloatParseCase("1e40", true, -FLT_MAX), + BadFloatParseCase("-1e40", false, -FLT_MAX), + // We can't have -1e40 and negate_value == true since + // that represents an original case of "--1e40" which + // is invalid. + }), ); + +using ParseNormalFloat16Test = + ::testing::TestWithParam>; + +TEST_P(ParseNormalFloat16Test, Samples) { + std::stringstream input(GetParam().literal); + HexFloat> parsed_value(0); + ParseNormalFloat(input, GetParam().negate_value, parsed_value); + EXPECT_NE(GetParam().expect_success, input.fail()) + << " literal: " << GetParam().literal + << " negate: " << GetParam().negate_value; + if (GetParam().expect_success) { + EXPECT_THAT(parsed_value.value(), Eq(GetParam().expected_value.value())) + << " literal: " << GetParam().literal + << " negate: " << GetParam().negate_value; + } +} + +INSTANTIATE_TEST_CASE_P( + Float16Parse, ParseNormalFloat16Test, + ::testing::ValuesIn(std::vector>{ + // Failing cases due to trivially incorrect syntax. + BadFloatParseCase("abc", false, uint16_t{0}), + BadFloatParseCase("abc", true, uint16_t{0}), + + // Valid cases. + GoodFloatParseCase("0", false, uint16_t{0}), + GoodFloatParseCase("0.0", false, uint16_t{0}), + GoodFloatParseCase("-0.0", false, uint16_t{0x8000}), + GoodFloatParseCase("2.0", false, uint16_t{0x4000}), + GoodFloatParseCase("-2.0", false, uint16_t{0xc000}), + GoodFloatParseCase("+2.0", false, uint16_t{0x4000}), + // Cases with negate_value being true. + GoodFloatParseCase("0.0", true, uint16_t{0x8000}), + GoodFloatParseCase("2.0", true, uint16_t{0xc000}), + + // When negate_value is true, we should not accept a leading minus or + // plus. + BadFloatParseCase("-0.0", true, uint16_t{0}), + BadFloatParseCase("-2.0", true, uint16_t{0}), + BadFloatParseCase("+0.0", true, uint16_t{0}), + BadFloatParseCase("+2.0", true, uint16_t{0}), + }), ); + +// A test case for detecting infinities. +template +struct OverflowParseCase { + std::string input; + bool expect_success; + T expected_value; +}; + +using FloatProxyParseOverflowFloatTest = + ::testing::TestWithParam>; + +TEST_P(FloatProxyParseOverflowFloatTest, Sample) { + std::istringstream input(GetParam().input); + HexFloat> value(0.0f); + input >> value; + EXPECT_NE(GetParam().expect_success, input.fail()); + if (GetParam().expect_success) { + EXPECT_THAT(value.value().getAsFloat(), GetParam().expected_value); + } +} + +INSTANTIATE_TEST_CASE_P( + FloatOverflow, FloatProxyParseOverflowFloatTest, + ::testing::ValuesIn(std::vector>({ + {"0", true, 0.0f}, + {"0.0", true, 0.0f}, + {"1.0", true, 1.0f}, + {"1e38", true, 1e38f}, + {"-1e38", true, -1e38f}, + {"1e40", false, FLT_MAX}, + {"-1e40", false, -FLT_MAX}, + {"1e400", false, FLT_MAX}, + {"-1e400", false, -FLT_MAX}, + })), ); + +using FloatProxyParseOverflowDoubleTest = + ::testing::TestWithParam>; + +TEST_P(FloatProxyParseOverflowDoubleTest, Sample) { + std::istringstream input(GetParam().input); + HexFloat> value(0.0); + input >> value; + EXPECT_NE(GetParam().expect_success, input.fail()); + if (GetParam().expect_success) { + EXPECT_THAT(value.value().getAsFloat(), Eq(GetParam().expected_value)); + } +} + +INSTANTIATE_TEST_CASE_P( + DoubleOverflow, FloatProxyParseOverflowDoubleTest, + ::testing::ValuesIn(std::vector>({ + {"0", true, 0.0}, + {"0.0", true, 0.0}, + {"1.0", true, 1.0}, + {"1e38", true, 1e38}, + {"-1e38", true, -1e38}, + {"1e40", true, 1e40}, + {"-1e40", true, -1e40}, + {"1e400", false, DBL_MAX}, + {"-1e400", false, -DBL_MAX}, + })), ); + +using FloatProxyParseOverflowFloat16Test = + ::testing::TestWithParam>; + +TEST_P(FloatProxyParseOverflowFloat16Test, Sample) { + std::istringstream input(GetParam().input); + HexFloat> value(0); + input >> value; + EXPECT_NE(GetParam().expect_success, input.fail()) + << " literal: " << GetParam().input; + if (GetParam().expect_success) { + EXPECT_THAT(value.value().data(), Eq(GetParam().expected_value)) + << " literal: " << GetParam().input; + } +} + +INSTANTIATE_TEST_CASE_P( + Float16Overflow, FloatProxyParseOverflowFloat16Test, + ::testing::ValuesIn(std::vector>({ + {"0", true, uint16_t{0}}, + {"0.0", true, uint16_t{0}}, + {"1.0", true, uint16_t{0x3c00}}, + // Overflow for 16-bit float is an error, and returns max or + // lowest value. + {"1e38", false, uint16_t{0x7bff}}, + {"1e40", false, uint16_t{0x7bff}}, + {"1e400", false, uint16_t{0x7bff}}, + {"-1e38", false, uint16_t{0xfbff}}, + {"-1e40", false, uint16_t{0xfbff}}, + {"-1e400", false, uint16_t{0xfbff}}, + })), ); + +TEST(FloatProxy, Max) { + EXPECT_THAT(FloatProxy::max().getAsFloat().get_value(), + Eq(uint16_t{0x7bff})); + EXPECT_THAT(FloatProxy::max().getAsFloat(), + Eq(std::numeric_limits::max())); + EXPECT_THAT(FloatProxy::max().getAsFloat(), + Eq(std::numeric_limits::max())); +} + +TEST(FloatProxy, Lowest) { + EXPECT_THAT(FloatProxy::lowest().getAsFloat().get_value(), + Eq(uint16_t{0xfbff})); + EXPECT_THAT(FloatProxy::lowest().getAsFloat(), + Eq(std::numeric_limits::lowest())); + EXPECT_THAT(FloatProxy::lowest().getAsFloat(), + Eq(std::numeric_limits::lowest())); +} + +// TODO(awoloszyn): Add fp16 tests and HexFloatTraits. +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/huffman_codec.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/huffman_codec.cpp new file mode 100644 index 00000000000..58a78106133 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/huffman_codec.cpp @@ -0,0 +1,317 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/comp/bit_stream.h" +#include "source/comp/huffman_codec.h" + +namespace spvtools { +namespace comp { +namespace { + +const std::map& GetTestSet() { + static const std::map hist = { + {"a", 4}, {"e", 7}, {"f", 3}, {"h", 2}, {"i", 3}, + {"m", 2}, {"n", 2}, {"s", 2}, {"t", 2}, {"l", 1}, + {"o", 2}, {"p", 1}, {"r", 1}, {"u", 1}, {"x", 1}, + }; + + return hist; +} + +class TestBitReader { + public: + TestBitReader(const std::string& bits) : bits_(bits) {} + + bool ReadBit(bool* bit) { + if (pos_ < bits_.length()) { + *bit = bits_[pos_++] == '0' ? false : true; + return true; + } + return false; + } + + private: + std::string bits_; + size_t pos_ = 0; +}; + +TEST(Huffman, PrintTree) { + HuffmanCodec huffman(GetTestSet()); + std::stringstream ss; + huffman.PrintTree(ss); + + // clang-format off + const std::string expected = std::string(R"( +15-----7------e + 8------4------a + 4------2------m + 2------n +19-----8------4------2------o + 2------s + 4------2------t + 2------1------l + 1------p + 11-----5------2------1------r + 1------u + 3------f + 6------3------i + 3------1------x + 2------h +)").substr(1); + // clang-format on + + EXPECT_EQ(expected, ss.str()); +} + +TEST(Huffman, PrintTable) { + HuffmanCodec huffman(GetTestSet()); + std::stringstream ss; + huffman.PrintTable(ss); + + const std::string expected = std::string(R"( +e 7 11 +a 4 101 +i 3 0001 +f 3 0010 +t 2 0101 +s 2 0110 +o 2 0111 +n 2 1000 +m 2 1001 +h 2 00000 +x 1 00001 +u 1 00110 +r 1 00111 +p 1 01000 +l 1 01001 +)") + .substr(1); + + EXPECT_EQ(expected, ss.str()); +} + +TEST(Huffman, TestValidity) { + HuffmanCodec huffman(GetTestSet()); + const auto& encoding_table = huffman.GetEncodingTable(); + std::vector codes; + for (const auto& entry : encoding_table) { + codes.push_back(BitsToStream(entry.second.first, entry.second.second)); + } + + std::sort(codes.begin(), codes.end()); + + ASSERT_LT(codes.size(), 20u) << "Inefficient test ahead"; + + for (size_t i = 0; i < codes.size(); ++i) { + for (size_t j = i + 1; j < codes.size(); ++j) { + ASSERT_FALSE(codes[i] == codes[j].substr(0, codes[i].length())) + << codes[i] << " is prefix of " << codes[j]; + } + } +} + +TEST(Huffman, TestEncode) { + HuffmanCodec huffman(GetTestSet()); + + uint64_t bits = 0; + size_t num_bits = 0; + + EXPECT_TRUE(huffman.Encode("e", &bits, &num_bits)); + EXPECT_EQ(2u, num_bits); + EXPECT_EQ("11", BitsToStream(bits, num_bits)); + + EXPECT_TRUE(huffman.Encode("a", &bits, &num_bits)); + EXPECT_EQ(3u, num_bits); + EXPECT_EQ("101", BitsToStream(bits, num_bits)); + + EXPECT_TRUE(huffman.Encode("x", &bits, &num_bits)); + EXPECT_EQ(5u, num_bits); + EXPECT_EQ("00001", BitsToStream(bits, num_bits)); + + EXPECT_FALSE(huffman.Encode("y", &bits, &num_bits)); +} + +TEST(Huffman, TestDecode) { + HuffmanCodec huffman(GetTestSet()); + TestBitReader bit_reader( + "01001" + "0001" + "1000" + "00110" + "00001" + "00"); + auto read_bit = [&bit_reader](bool* bit) { return bit_reader.ReadBit(bit); }; + + std::string decoded; + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ("l", decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ("i", decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ("n", decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ("u", decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ("x", decoded); + + ASSERT_FALSE(huffman.DecodeFromStream(read_bit, &decoded)); +} + +TEST(Huffman, TestDecodeNumbers) { + const std::map hist = {{1, 10}, {2, 5}, {3, 15}}; + HuffmanCodec huffman(hist); + + TestBitReader bit_reader( + "1" + "1" + "01" + "00" + "01" + "1"); + auto read_bit = [&bit_reader](bool* bit) { return bit_reader.ReadBit(bit); }; + + uint32_t decoded; + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(3u, decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(3u, decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(2u, decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(1u, decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(2u, decoded); + + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(3u, decoded); +} + +TEST(Huffman, SerializeToTextU64) { + const std::map hist = {{1001, 10}, {1002, 5}, {1003, 15}}; + HuffmanCodec huffman(hist); + + const std::string code = huffman.SerializeToText(2); + + const std::string expected = R"((5, { + {0, 0, 0}, + {1001, 0, 0}, + {1002, 0, 0}, + {1003, 0, 0}, + {0, 1, 2}, + {0, 4, 3}, + }))"; + + ASSERT_EQ(expected, code); +} + +TEST(Huffman, SerializeToTextString) { + const std::map hist = { + {"aaa", 10}, {"bbb", 20}, {"ccc", 15}}; + HuffmanCodec huffman(hist); + + const std::string code = huffman.SerializeToText(4); + + const std::string expected = R"((5, { + {"", 0, 0}, + {"aaa", 0, 0}, + {"bbb", 0, 0}, + {"ccc", 0, 0}, + {"", 3, 1}, + {"", 4, 2}, + }))"; + + ASSERT_EQ(expected, code); +} + +TEST(Huffman, CreateFromTextString) { + std::vector::Node> nodes = { + {}, + {"root", 2, 3}, + {"left", 0, 0}, + {"right", 0, 0}, + }; + + HuffmanCodec huffman(1, std::move(nodes)); + + std::stringstream ss; + huffman.PrintTree(ss); + + const std::string expected = std::string(R"( +0------right +0------left +)") + .substr(1); + + EXPECT_EQ(expected, ss.str()); +} + +TEST(Huffman, CreateFromTextU64) { + HuffmanCodec huffman(5, { + {0, 0, 0}, + {1001, 0, 0}, + {1002, 0, 0}, + {1003, 0, 0}, + {0, 1, 2}, + {0, 4, 3}, + }); + + std::stringstream ss; + huffman.PrintTree(ss); + + const std::string expected = std::string(R"( +0------1003 +0------0------1002 + 0------1001 +)") + .substr(1); + + EXPECT_EQ(expected, ss.str()); + + TestBitReader bit_reader("01"); + auto read_bit = [&bit_reader](bool* bit) { return bit_reader.ReadBit(bit); }; + + uint64_t decoded = 0; + ASSERT_TRUE(huffman.DecodeFromStream(read_bit, &decoded)); + EXPECT_EQ(1002u, decoded); + + uint64_t bits = 0; + size_t num_bits = 0; + + EXPECT_TRUE(huffman.Encode(1001, &bits, &num_bits)); + EXPECT_EQ(2u, num_bits); + EXPECT_EQ("00", BitsToStream(bits, num_bits)); +} + +} // namespace +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/immediate_int_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/immediate_int_test.cpp new file mode 100644 index 00000000000..393075a4e71 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/immediate_int_test.cpp @@ -0,0 +1,291 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/util/bitutils.h" +#include "test/test_fixture.h" + +namespace spvtools { +namespace utils { +namespace { + +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::ScopedContext; +using spvtest::TextToBinaryTest; +using ::testing::ElementsAre; +using ::testing::Eq; +using ::testing::HasSubstr; +using ::testing::StrEq; + +TEST_F(TextToBinaryTest, ImmediateIntOpCode) { + SetText("!0x00FF00FF"); + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(ScopedContext().context, text.str, + text.length, &binary, &diagnostic)); + EXPECT_EQ(0x00FF00FFu, binary->code[5]); + if (diagnostic) { + spvDiagnosticPrint(diagnostic); + } +} + +TEST_F(TextToBinaryTest, ImmediateIntOperand) { + SetText("OpCapability !0x00FF00FF"); + EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(ScopedContext().context, text.str, + text.length, &binary, &diagnostic)); + EXPECT_EQ(0x00FF00FFu, binary->code[6]); + if (diagnostic) { + spvDiagnosticPrint(diagnostic); + } +} + +using ImmediateIntTest = TextToBinaryTest; + +TEST_F(ImmediateIntTest, AnyWordInSimpleStatement) { + EXPECT_THAT(CompiledInstructions("!0x00040018 %a %b %123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 3}))); + EXPECT_THAT(CompiledInstructions("!0x00040018 !1 %b %123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 1, 2}))); + EXPECT_THAT(CompiledInstructions("%a = OpTypeMatrix !2 %123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 2}))); + EXPECT_THAT(CompiledInstructions("%a = OpTypeMatrix %b !123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 123}))); + EXPECT_THAT(CompiledInstructions("!0x00040018 %a !2 %123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 2}))); + EXPECT_THAT(CompiledInstructions("!0x00040018 !1 %b !123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 1, 123}))); + EXPECT_THAT(CompiledInstructions("!0x00040018 !1 !2 !123"), + Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 123}))); +} + +TEST_F(ImmediateIntTest, AnyWordAfterEqualsAndOpCode) { + EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 %c 123"), + Eq(MakeInstruction(SpvOpArrayLength, {2, 1, 2, 123}))); + EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b !3 123"), + Eq(MakeInstruction(SpvOpArrayLength, {1, 2, 3, 123}))); + EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b %c !123"), + Eq(MakeInstruction(SpvOpArrayLength, {1, 2, 3, 123}))); + EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b !3 !123"), + Eq(MakeInstruction(SpvOpArrayLength, {1, 2, 3, 123}))); + EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 !3 123"), + Eq(MakeInstruction(SpvOpArrayLength, {2, 1, 3, 123}))); + EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 !3 !123"), + Eq(MakeInstruction(SpvOpArrayLength, {2, 1, 3, 123}))); +} + +TEST_F(ImmediateIntTest, ResultIdInAssignment) { + EXPECT_EQ("!2 not allowed before =.", + CompileFailure("!2 = OpArrayLength %12 %1 123")); + EXPECT_EQ("!2 not allowed before =.", + CompileFailure("!2 = !0x00040044 %12 %1 123")); +} + +TEST_F(ImmediateIntTest, OpCodeInAssignment) { + EXPECT_EQ("Invalid Opcode prefix '!0x00040044'.", + CompileFailure("%2 = !0x00040044 %12 %1 123")); +} + +// Literal integers after ! are handled correctly. +TEST_F(ImmediateIntTest, IntegerFollowingImmediate) { + const SpirvVector original = CompiledInstructions("%1 = OpTypeInt 8 1"); + EXPECT_EQ(original, CompiledInstructions("!0x00040015 1 8 1")); + EXPECT_EQ(original, CompiledInstructions("!0x00040015 !1 8 1")); + + // With !, we can (and can only) accept 32-bit number literals, + // even when we declare the return type is 64-bit. + EXPECT_EQ(Concatenate({ + MakeInstruction(SpvOpTypeInt, {1, 64, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 4294967295}), + }), + CompiledInstructions("%i64 = OpTypeInt 64 0\n" + "!0x0004002b %i64 !2 4294967295")); + // 64-bit integer literal. + EXPECT_EQ("Invalid word following !: 5000000000", + CompileFailure("%2 = OpConstant !1 5000000000")); + EXPECT_EQ("Invalid word following !: 5000000000", + CompileFailure("%i64 = OpTypeInt 64 0\n" + "!0x0005002b %i64 !2 5000000000")); + + // Negative integer. + EXPECT_EQ(CompiledInstructions("%i64 = OpTypeInt 32 1\n" + "%2 = OpConstant %i64 -123"), + CompiledInstructions("%i64 = OpTypeInt 32 1\n" + "!0x0004002b %i64 !2 -123")); + + // TODO(deki): uncomment assertions below and make them pass. + // Hex value(s). + // EXPECT_EQ(CompileSuccessfully("%1 = OpConstant %10 0x12345678"), + // CompileSuccessfully("OpConstant %10 !1 0x12345678", kCAF)); + // EXPECT_EQ( + // CompileSuccessfully("%1 = OpConstant %10 0x12345678 0x87654321"), + // CompileSuccessfully("OpConstant %10 !1 0x12345678 0x87654321", kCAF)); +} + +// Literal floats after ! are handled correctly. +TEST_F(ImmediateIntTest, FloatFollowingImmediate) { + EXPECT_EQ( + CompiledInstructions("%1 = OpTypeFloat 32\n%2 = OpConstant %1 0.123"), + CompiledInstructions("%1 = OpTypeFloat 32\n!0x0004002b %1 !2 0.123")); + EXPECT_EQ( + CompiledInstructions("%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0.5"), + CompiledInstructions("%1 = OpTypeFloat 32\n!0x0004002b %1 !2 -0.5")); + EXPECT_EQ( + CompiledInstructions("%1 = OpTypeFloat 32\n%2 = OpConstant %1 0.123"), + CompiledInstructions("%1 = OpTypeFloat 32\n!0x0004002b %1 %2 0.123")); + EXPECT_EQ( + CompiledInstructions("%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0.5"), + CompiledInstructions("%1 = OpTypeFloat 32\n!0x0004002b %1 %2 -0.5")); + + EXPECT_EQ(Concatenate({ + MakeInstruction(SpvOpTypeInt, {1, 64, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0xb, 0xa}), + MakeInstruction(SpvOpSwitch, + {2, 1234, BitwiseCast(2.5f), 3}), + }), + CompiledInstructions("%i64 = OpTypeInt 64 0\n" + "%big = OpConstant %i64 0xa0000000b\n" + "OpSwitch %big !1234 2.5 %target\n")); +} + +// Literal strings after ! are handled correctly. +TEST_F(ImmediateIntTest, StringFollowingImmediate) { + // Try a variety of strings, including empty and single-character. + for (std::string name : {"", "s", "longish", "really looooooooooooooooong"}) { + const SpirvVector original = + CompiledInstructions("OpMemberName %10 4 \"" + name + "\""); + EXPECT_EQ(original, + CompiledInstructions("OpMemberName %10 !4 \"" + name + "\"")) + << name; + EXPECT_EQ(original, + CompiledInstructions("OpMemberName !1 !4 \"" + name + "\"")) + << name; + const uint16_t wordCount = static_cast(4 + name.size() / 4); + const uint32_t firstWord = spvOpcodeMake(wordCount, SpvOpMemberName); + EXPECT_EQ(original, CompiledInstructions("!" + std::to_string(firstWord) + + " %10 !4 \"" + name + "\"")) + << name; + } +} + +// IDs after ! are handled correctly. +TEST_F(ImmediateIntTest, IdFollowingImmediate) { + EXPECT_EQ(CompileSuccessfully("%123 = OpDecorationGroup"), + CompileSuccessfully("!0x00020049 %123")); + EXPECT_EQ(CompileSuccessfully("%group = OpDecorationGroup"), + CompileSuccessfully("!0x00020049 %group")); +} + +// ! after ! is handled correctly. +TEST_F(ImmediateIntTest, ImmediateFollowingImmediate) { + const SpirvVector original = CompiledInstructions("%a = OpTypeMatrix %b 7"); + EXPECT_EQ(original, CompiledInstructions("%a = OpTypeMatrix !2 !7")); + EXPECT_EQ(original, CompiledInstructions("!0x00040018 %a !2 !7")); +} + +TEST_F(ImmediateIntTest, InvalidStatement) { + EXPECT_THAT(Subvector(CompileSuccessfully("!4 !3 !2 !1"), kFirstInstruction), + ElementsAre(4, 3, 2, 1)); +} + +TEST_F(ImmediateIntTest, InvalidStatementBetweenValidOnes) { + EXPECT_THAT(Subvector(CompileSuccessfully( + "%10 = OpTypeFloat 32 !5 !6 !7 OpEmitVertex"), + kFirstInstruction), + ElementsAre(spvOpcodeMake(3, SpvOpTypeFloat), 1, 32, 5, 6, 7, + spvOpcodeMake(1, SpvOpEmitVertex))); +} + +TEST_F(ImmediateIntTest, NextOpcodeRecognized) { + const SpirvVector original = CompileSuccessfully(R"( +%1 = OpLoad %10 %2 Volatile +%4 = OpCompositeInsert %11 %1 %3 0 1 2 +)"); + const SpirvVector alternate = CompileSuccessfully(R"( +%1 = OpLoad %10 %2 !1 +%4 = OpCompositeInsert %11 %1 %3 0 1 2 +)"); + EXPECT_EQ(original, alternate); +} + +TEST_F(ImmediateIntTest, WrongLengthButNextOpcodeStillRecognized) { + const SpirvVector original = CompileSuccessfully(R"( +%1 = OpLoad %10 %2 Volatile +OpCopyMemorySized %3 %4 %1 +)"); + const SpirvVector alternate = CompileSuccessfully(R"( +!0x0002003D %10 %1 %2 !1 +OpCopyMemorySized %3 %4 %1 +)"); + EXPECT_EQ(0x0002003Du, alternate[kFirstInstruction]); + EXPECT_EQ(Subvector(original, kFirstInstruction + 1), + Subvector(alternate, kFirstInstruction + 1)); +} + +// Like NextOpcodeRecognized, but next statement is in assignment form. +TEST_F(ImmediateIntTest, NextAssignmentRecognized) { + const SpirvVector original = CompileSuccessfully(R"( +%1 = OpLoad %10 %2 None +%4 = OpFunctionCall %10 %3 %123 +)"); + const SpirvVector alternate = CompileSuccessfully(R"( +%1 = OpLoad %10 %2 !0 +%4 = OpFunctionCall %10 %3 %123 +)"); + EXPECT_EQ(original, alternate); +} + +// Two instructions in a row each have ! opcode. +TEST_F(ImmediateIntTest, ConsecutiveImmediateOpcodes) { + const SpirvVector original = CompileSuccessfully(R"( +%1 = OpConstantSampler %10 Clamp 78 Linear +%4 = OpFRem %11 %3 %2 +%5 = OpIsValidEvent %12 %2 +)"); + const SpirvVector alternate = CompileSuccessfully(R"( +!0x0006002D %10 %1 !2 78 !1 +!0x0005008C %11 %4 %3 %2 +%5 = OpIsValidEvent %12 %2 +)"); + EXPECT_EQ(original, alternate); +} + +// ! followed by, eg, an enum or '=' or a random bareword. +TEST_F(ImmediateIntTest, ForbiddenOperands) { + EXPECT_THAT(CompileFailure("OpMemoryModel !0 OpenCL"), HasSubstr("OpenCL")); + EXPECT_THAT(CompileFailure("!1 %0 = !2"), HasSubstr("=")); + EXPECT_THAT(CompileFailure("OpMemoryModel !0 random_bareword"), + HasSubstr("random_bareword")); + // Immediate integers longer than one 32-bit word. + EXPECT_THAT(CompileFailure("!5000000000"), HasSubstr("5000000000")); + EXPECT_THAT(CompileFailure("!999999999999999999"), + HasSubstr("999999999999999999")); + EXPECT_THAT(CompileFailure("!0x00020049 !5000000000"), + HasSubstr("5000000000")); + // Negative numbers. + EXPECT_THAT(CompileFailure("!0x00020049 !-123"), HasSubstr("-123")); +} + +TEST_F(ImmediateIntTest, NotInteger) { + EXPECT_THAT(CompileFailure("!abc"), StrEq("Invalid immediate integer: !abc")); + EXPECT_THAT(CompileFailure("!12.3"), + StrEq("Invalid immediate integer: !12.3")); + EXPECT_THAT(CompileFailure("!12K"), StrEq("Invalid immediate integer: !12K")); +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/libspirv_macros_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/libspirv_macros_test.cpp new file mode 100644 index 00000000000..bf5add671a7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/libspirv_macros_test.cpp @@ -0,0 +1,25 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +TEST(Macros, BitShiftInnerParens) { ASSERT_EQ(65536, SPV_BIT(2 << 3)); } + +TEST(Macros, BitShiftOuterParens) { ASSERT_EQ(15, SPV_BIT(4) - 1); } + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/CMakeLists.txt new file mode 100644 index 00000000000..06aeb916495 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (c) 2017 Pierre Moreau +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +add_spvtools_unittest(TARGET link + SRCS + binary_version_test.cpp + entry_points_test.cpp + global_values_amount_test.cpp + ids_limit_test.cpp + matching_imports_to_exports_test.cpp + memory_model_test.cpp + partial_linkage_test.cpp + unique_ids_test.cpp + LIBS SPIRV-Tools-opt SPIRV-Tools-link +) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/binary_version_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/binary_version_test.cpp new file mode 100644 index 00000000000..0ceeebae259 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/binary_version_test.cpp @@ -0,0 +1,60 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using BinaryVersion = spvtest::LinkerTest; + +TEST_F(BinaryVersion, LinkerChoosesMaxSpirvVersion) { + // clang-format off + spvtest::Binaries binaries = { + { + SpvMagicNumber, + 0x00000300u, + SPV_GENERATOR_CODEPLAY, + 1u, // NOTE: Bound + 0u // NOTE: Schema; reserved + }, + { + SpvMagicNumber, + 0x00000600u, + SPV_GENERATOR_CODEPLAY, + 1u, // NOTE: Bound + 0u // NOTE: Schema; reserved + }, + { + SpvMagicNumber, + 0x00000100u, + SPV_GENERATOR_CODEPLAY, + 1u, // NOTE: Bound + 0u // NOTE: Schema; reserved + } + }; + // clang-format on + spvtest::Binary linked_binary; + + ASSERT_EQ(SPV_SUCCESS, Link(binaries, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), std::string()); + + EXPECT_EQ(0x00000600u, linked_binary[1]); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/entry_points_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/entry_points_test.cpp new file mode 100644 index 00000000000..bac8e02ef60 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/entry_points_test.cpp @@ -0,0 +1,94 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using ::testing::HasSubstr; + +class EntryPoints : public spvtest::LinkerTest {}; + +TEST_F(EntryPoints, SameModelDifferentName) { + const std::string body1 = R"( +OpEntryPoint GLCompute %3 "foo" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +OpFunctionEnd +)"; + const std::string body2 = R"( +OpEntryPoint GLCompute %3 "bar" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +OpFunctionEnd +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), std::string()); +} + +TEST_F(EntryPoints, DifferentModelSameName) { + const std::string body1 = R"( +OpEntryPoint GLCompute %3 "foo" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +OpFunctionEnd +)"; + const std::string body2 = R"( +OpEntryPoint Vertex %3 "foo" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +OpFunctionEnd +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), std::string()); +} + +TEST_F(EntryPoints, SameModelAndName) { + const std::string body1 = R"( +OpEntryPoint GLCompute %3 "foo" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +OpFunctionEnd +)"; + const std::string body2 = R"( +OpEntryPoint GLCompute %3 "foo" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +OpFunctionEnd +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INTERNAL, + AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("The entry point \"foo\", with execution model " + "GLCompute, was already defined.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/global_values_amount_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/global_values_amount_test.cpp new file mode 100644 index 00000000000..2c4ee1f03d0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/global_values_amount_test.cpp @@ -0,0 +1,153 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using ::testing::HasSubstr; + +class EntryPointsAmountTest : public spvtest::LinkerTest { + public: + EntryPointsAmountTest() { binaries.reserve(0xFFFF); } + + void SetUp() override { + binaries.push_back({SpvMagicNumber, + SpvVersion, + SPV_GENERATOR_CODEPLAY, + 10u, // NOTE: Bound + 0u, // NOTE: Schema; reserved + + 3u << SpvWordCountShift | SpvOpTypeFloat, + 1u, // NOTE: Result ID + 32u, // NOTE: Width + + 4u << SpvWordCountShift | SpvOpTypePointer, + 2u, // NOTE: Result ID + SpvStorageClassInput, + 1u, // NOTE: Type ID + + 2u << SpvWordCountShift | SpvOpTypeVoid, + 3u, // NOTE: Result ID + + 3u << SpvWordCountShift | SpvOpTypeFunction, + 4u, // NOTE: Result ID + 3u, // NOTE: Return type + + 5u << SpvWordCountShift | SpvOpFunction, + 3u, // NOTE: Result type + 5u, // NOTE: Result ID + SpvFunctionControlMaskNone, + 4u, // NOTE: Function type + + 2u << SpvWordCountShift | SpvOpLabel, + 6u, // NOTE: Result ID + + 4u << SpvWordCountShift | SpvOpVariable, + 2u, // NOTE: Type ID + 7u, // NOTE: Result ID + SpvStorageClassFunction, + + 4u << SpvWordCountShift | SpvOpVariable, + 2u, // NOTE: Type ID + 8u, // NOTE: Result ID + SpvStorageClassFunction, + + 4u << SpvWordCountShift | SpvOpVariable, + 2u, // NOTE: Type ID + 9u, // NOTE: Result ID + SpvStorageClassFunction, + + 1u << SpvWordCountShift | SpvOpReturn, + + 1u << SpvWordCountShift | SpvOpFunctionEnd}); + for (size_t i = 0u; i < 2u; ++i) { + spvtest::Binary binary = { + SpvMagicNumber, + SpvVersion, + SPV_GENERATOR_CODEPLAY, + 103u, // NOTE: Bound + 0u, // NOTE: Schema; reserved + + 3u << SpvWordCountShift | SpvOpTypeFloat, + 1u, // NOTE: Result ID + 32u, // NOTE: Width + + 4u << SpvWordCountShift | SpvOpTypePointer, + 2u, // NOTE: Result ID + SpvStorageClassInput, + 1u // NOTE: Type ID + }; + + for (uint32_t j = 0u; j < 0xFFFFu / 2u; ++j) { + binary.push_back(4u << SpvWordCountShift | SpvOpVariable); + binary.push_back(2u); // NOTE: Type ID + binary.push_back(j + 3u); // NOTE: Result ID + binary.push_back(SpvStorageClassInput); + } + binaries.push_back(binary); + } + } + void TearDown() override { binaries.clear(); } + + spvtest::Binaries binaries; +}; + +TEST_F(EntryPointsAmountTest, UnderLimit) { + spvtest::Binary linked_binary; + + EXPECT_EQ(SPV_SUCCESS, Link(binaries, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), std::string()); +} + +TEST_F(EntryPointsAmountTest, OverLimit) { + binaries.push_back({SpvMagicNumber, + SpvVersion, + SPV_GENERATOR_CODEPLAY, + 5u, // NOTE: Bound + 0u, // NOTE: Schema; reserved + + 3u << SpvWordCountShift | SpvOpTypeFloat, + 1u, // NOTE: Result ID + 32u, // NOTE: Width + + 4u << SpvWordCountShift | SpvOpTypePointer, + 2u, // NOTE: Result ID + SpvStorageClassInput, + 1u, // NOTE: Type ID + + 4u << SpvWordCountShift | SpvOpVariable, + 2u, // NOTE: Type ID + 3u, // NOTE: Result ID + SpvStorageClassInput, + + 4u << SpvWordCountShift | SpvOpVariable, + 2u, // NOTE: Type ID + 4u, // NOTE: Result ID + SpvStorageClassInput}); + + spvtest::Binary linked_binary; + + EXPECT_EQ(SPV_ERROR_INTERNAL, Link(binaries, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("The limit of global values, 65535, was exceeded; " + "65536 global values were found.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/ids_limit_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/ids_limit_test.cpp new file mode 100644 index 00000000000..6d7815a24d7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/ids_limit_test.cpp @@ -0,0 +1,72 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using ::testing::HasSubstr; +using IdsLimit = spvtest::LinkerTest; + +TEST_F(IdsLimit, UnderLimit) { + spvtest::Binaries binaries = { + { + SpvMagicNumber, SpvVersion, SPV_GENERATOR_CODEPLAY, + 0x2FFFFFu, // NOTE: Bound + 0u, // NOTE: Schema; reserved + }, + { + SpvMagicNumber, SpvVersion, SPV_GENERATOR_CODEPLAY, + 0x100000u, // NOTE: Bound + 0u, // NOTE: Schema; reserved + }}; + spvtest::Binary linked_binary; + + ASSERT_EQ(SPV_SUCCESS, Link(binaries, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), std::string()); + EXPECT_EQ(0x3FFFFEu, linked_binary[3]); +} + +TEST_F(IdsLimit, OverLimit) { + spvtest::Binaries binaries = { + { + SpvMagicNumber, SpvVersion, SPV_GENERATOR_CODEPLAY, + 0x2FFFFFu, // NOTE: Bound + 0u, // NOTE: Schema; reserved + }, + { + SpvMagicNumber, SpvVersion, SPV_GENERATOR_CODEPLAY, + 0x100000u, // NOTE: Bound + 0u, // NOTE: Schema; reserved + }, + { + SpvMagicNumber, SpvVersion, SPV_GENERATOR_CODEPLAY, + 3u, // NOTE: Bound + 0u, // NOTE: Schema; reserved + }}; + + spvtest::Binary linked_binary; + + EXPECT_EQ(SPV_ERROR_INVALID_ID, Link(binaries, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("The limit of IDs, 4194303, was exceeded: 4194304 is " + "the current ID bound.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/linker_fixture.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/linker_fixture.h new file mode 100644 index 00000000000..303f1bfd572 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/linker_fixture.h @@ -0,0 +1,125 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 TEST_LINK_LINKER_FIXTURE_H_ +#define TEST_LINK_LINKER_FIXTURE_H_ + +#include +#include +#include + +#include "source/spirv_constant.h" +#include "spirv-tools/linker.hpp" +#include "test/unit_spirv.h" + +namespace spvtest { + +using Binary = std::vector; +using Binaries = std::vector; + +class LinkerTest : public ::testing::Test { + public: + LinkerTest() + : context_(SPV_ENV_UNIVERSAL_1_2), + tools_(SPV_ENV_UNIVERSAL_1_2), + assemble_options_(spvtools::SpirvTools::kDefaultAssembleOption), + disassemble_options_(spvtools::SpirvTools::kDefaultDisassembleOption) { + const auto consumer = [this](spv_message_level_t level, const char*, + const spv_position_t& position, + const char* message) { + if (!error_message_.empty()) error_message_ += "\n"; + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + error_message_ += "ERROR"; + break; + case SPV_MSG_WARNING: + error_message_ += "WARNING"; + break; + case SPV_MSG_INFO: + error_message_ += "INFO"; + break; + case SPV_MSG_DEBUG: + error_message_ += "DEBUG"; + break; + } + error_message_ += ": " + std::to_string(position.index) + ": " + message; + }; + context_.SetMessageConsumer(consumer); + tools_.SetMessageConsumer(consumer); + } + + void TearDown() override { error_message_.clear(); } + + // Assembles each of the given strings into SPIR-V binaries before linking + // them together. SPV_ERROR_INVALID_TEXT is returned if the assembling failed + // for any of the input strings, and SPV_ERROR_INVALID_POINTER if + // |linked_binary| is a null pointer. + spv_result_t AssembleAndLink( + const std::vector& bodies, spvtest::Binary* linked_binary, + spvtools::LinkerOptions options = spvtools::LinkerOptions()) { + if (!linked_binary) return SPV_ERROR_INVALID_POINTER; + + spvtest::Binaries binaries(bodies.size()); + for (size_t i = 0u; i < bodies.size(); ++i) + if (!tools_.Assemble(bodies[i], binaries.data() + i, assemble_options_)) + return SPV_ERROR_INVALID_TEXT; + + return spvtools::Link(context_, binaries, linked_binary, options); + } + + // Links the given SPIR-V binaries together; SPV_ERROR_INVALID_POINTER is + // returned if |linked_binary| is a null pointer. + spv_result_t Link( + const spvtest::Binaries& binaries, spvtest::Binary* linked_binary, + spvtools::LinkerOptions options = spvtools::LinkerOptions()) { + if (!linked_binary) return SPV_ERROR_INVALID_POINTER; + return spvtools::Link(context_, binaries, linked_binary, options); + } + + // Disassembles |binary| and outputs the result in |text|. If |text| is a + // null pointer, SPV_ERROR_INVALID_POINTER is returned. + spv_result_t Disassemble(const spvtest::Binary& binary, std::string* text) { + if (!text) return SPV_ERROR_INVALID_POINTER; + return tools_.Disassemble(binary, text, disassemble_options_) + ? SPV_SUCCESS + : SPV_ERROR_INVALID_BINARY; + } + + // Sets the options for the assembler. + void SetAssembleOptions(uint32_t assemble_options) { + assemble_options_ = assemble_options; + } + + // Sets the options used by the disassembler. + void SetDisassembleOptions(uint32_t disassemble_options) { + disassemble_options_ = disassemble_options; + } + + // Returns the accumulated error messages for the test. + std::string GetErrorMessage() const { return error_message_; } + + private: + spvtools::Context context_; + spvtools::SpirvTools + tools_; // An instance for calling SPIRV-Tools functionalities. + uint32_t assemble_options_; + uint32_t disassemble_options_; + std::string error_message_; +}; + +} // namespace spvtest + +#endif // TEST_LINK_LINKER_FIXTURE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/matching_imports_to_exports_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/matching_imports_to_exports_test.cpp new file mode 100644 index 00000000000..59e62d51b8a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/matching_imports_to_exports_test.cpp @@ -0,0 +1,403 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using ::testing::HasSubstr; +using MatchingImportsToExports = spvtest::LinkerTest; + +TEST_F(MatchingImportsToExports, Default) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +%3 = OpVariable %2 Input +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 42 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)) + << GetErrorMessage(); + + const std::string expected_res = + R"(OpModuleProcessed "Linked by SPIR-V Tools Linker" +%1 = OpTypeFloat 32 +%2 = OpVariable %1 Input +%3 = OpConstant %1 42 +%4 = OpVariable %1 Uniform %3 +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + EXPECT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +TEST_F(MatchingImportsToExports, NotALibraryExtraExports) { + const std::string body = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body}, &linked_binary)) + << GetErrorMessage(); + + const std::string expected_res = + R"(OpModuleProcessed "Linked by SPIR-V Tools Linker" +%1 = OpTypeFloat 32 +%2 = OpVariable %1 Uniform +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + EXPECT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +TEST_F(MatchingImportsToExports, LibraryExtraExports) { + const std::string body = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +)"; + + spvtest::Binary linked_binary; + LinkerOptions options; + options.SetCreateLibrary(true); + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body}, &linked_binary, options)) + << GetErrorMessage(); + + const std::string expected_res = R"(OpCapability Linkage +OpModuleProcessed "Linked by SPIR-V Tools Linker" +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + EXPECT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +TEST_F(MatchingImportsToExports, UnresolvedImports) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +)"; + const std::string body2 = R"()"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("Unresolved external reference to \"foo\".")); +} + +TEST_F(MatchingImportsToExports, TypeMismatch) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +%3 = OpVariable %2 Input +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 42 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + AssembleAndLink({body1, body2}, &linked_binary)) + << GetErrorMessage(); + EXPECT_THAT( + GetErrorMessage(), + HasSubstr("Type mismatch on symbol \"foo\" between imported " + "variable/function %1 and exported variable/function %4")); +} + +TEST_F(MatchingImportsToExports, MultipleDefinitions) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +%3 = OpVariable %2 Input +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 42 +%1 = OpVariable %2 Uniform %3 +)"; + const std::string body3 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 -1 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + AssembleAndLink({body1, body2, body3}, &linked_binary)) + << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("Too many external references, 2, were found " + "for \"foo\".")); +} + +TEST_F(MatchingImportsToExports, SameNameDifferentTypes) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +%3 = OpVariable %2 Input +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 42 +%1 = OpVariable %2 Uniform %3 +)"; + const std::string body3 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 12 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + AssembleAndLink({body1, body2, body3}, &linked_binary)) + << GetErrorMessage(); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("Too many external references, 2, were found " + "for \"foo\".")); +} + +TEST_F(MatchingImportsToExports, DecorationMismatch) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +OpDecorate %2 Constant +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +%3 = OpVariable %2 Input +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 42 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + AssembleAndLink({body1, body2}, &linked_binary)) + << GetErrorMessage(); + EXPECT_THAT( + GetErrorMessage(), + HasSubstr("Type mismatch on symbol \"foo\" between imported " + "variable/function %1 and exported variable/function %4")); +} + +TEST_F(MatchingImportsToExports, + FuncParamAttrDifferButStillMatchExportToImport) { + const std::string body1 = R"( +OpCapability Kernel +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +OpDecorate %2 FuncParamAttr Zext +%3 = OpTypeVoid +%4 = OpTypeInt 32 0 +%5 = OpTypeFunction %3 %4 +%1 = OpFunction %3 None %5 +%2 = OpFunctionParameter %4 +OpFunctionEnd +)"; + const std::string body2 = R"( +OpCapability Kernel +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +OpDecorate %2 FuncParamAttr Sext +%3 = OpTypeVoid +%4 = OpTypeInt 32 0 +%5 = OpTypeFunction %3 %4 +%1 = OpFunction %3 None %5 +%2 = OpFunctionParameter %4 +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)) + << GetErrorMessage(); + + const std::string expected_res = R"(OpCapability Kernel +OpModuleProcessed "Linked by SPIR-V Tools Linker" +OpDecorate %1 FuncParamAttr Sext +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypeFunction %2 %3 +%5 = OpFunction %2 None %4 +%1 = OpFunctionParameter %3 +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + EXPECT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +TEST_F(MatchingImportsToExports, FunctionCtrl) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%4 = OpTypeFloat 32 +%5 = OpVariable %4 Uniform +%1 = OpFunction %2 None %3 +OpFunctionEnd +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%1 = OpFunction %2 Inline %3 +%4 = OpLabel +OpReturn +OpFunctionEnd +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)) + << GetErrorMessage(); + + const std::string expected_res = + R"(OpModuleProcessed "Linked by SPIR-V Tools Linker" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypeFloat 32 +%4 = OpVariable %3 Uniform +%5 = OpFunction %1 Inline %2 +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + EXPECT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +TEST_F(MatchingImportsToExports, UseExportedFuncParamAttr) { + const std::string body1 = R"( +OpCapability Kernel +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +OpDecorate %2 FuncParamAttr Zext +%2 = OpDecorationGroup +OpGroupDecorate %2 %3 %4 +%5 = OpTypeVoid +%6 = OpTypeInt 32 0 +%7 = OpTypeFunction %5 %6 +%1 = OpFunction %5 None %7 +%3 = OpFunctionParameter %6 +OpFunctionEnd +%8 = OpFunction %5 None %7 +%4 = OpFunctionParameter %6 +OpFunctionEnd +)"; + const std::string body2 = R"( +OpCapability Kernel +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Export +OpDecorate %2 FuncParamAttr Sext +%3 = OpTypeVoid +%4 = OpTypeInt 32 0 +%5 = OpTypeFunction %3 %4 +%1 = OpFunction %3 None %5 +%2 = OpFunctionParameter %4 +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)) + << GetErrorMessage(); + + const std::string expected_res = R"(OpCapability Kernel +OpModuleProcessed "Linked by SPIR-V Tools Linker" +OpDecorate %1 FuncParamAttr Zext +%1 = OpDecorationGroup +OpGroupDecorate %1 %2 +OpDecorate %3 FuncParamAttr Sext +%4 = OpTypeVoid +%5 = OpTypeInt 32 0 +%6 = OpTypeFunction %4 %5 +%7 = OpFunction %4 None %6 +%2 = OpFunctionParameter %5 +OpFunctionEnd +%8 = OpFunction %4 None %6 +%3 = OpFunctionParameter %5 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + EXPECT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/memory_model_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/memory_model_test.cpp new file mode 100644 index 00000000000..2add5046c71 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/memory_model_test.cpp @@ -0,0 +1,74 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using ::testing::HasSubstr; +using MemoryModel = spvtest::LinkerTest; + +TEST_F(MemoryModel, Default) { + const std::string body1 = R"( +OpMemoryModel Logical Simple +)"; + const std::string body2 = R"( +OpMemoryModel Logical Simple +)"; + + spvtest::Binary linked_binary; + ASSERT_EQ(SPV_SUCCESS, AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), std::string()); + + EXPECT_EQ(SpvAddressingModelLogical, linked_binary[6]); + EXPECT_EQ(SpvMemoryModelSimple, linked_binary[7]); +} + +TEST_F(MemoryModel, AddressingMismatch) { + const std::string body1 = R"( +OpMemoryModel Logical Simple +)"; + const std::string body2 = R"( +OpMemoryModel Physical32 Simple +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INTERNAL, + AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT( + GetErrorMessage(), + HasSubstr("Conflicting addressing models: Logical vs Physical32.")); +} + +TEST_F(MemoryModel, MemoryMismatch) { + const std::string body1 = R"( +OpMemoryModel Logical Simple +)"; + const std::string body2 = R"( +OpMemoryModel Logical GLSL450 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INTERNAL, + AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("Conflicting memory models: Simple vs GLSL450.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/partial_linkage_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/partial_linkage_test.cpp new file mode 100644 index 00000000000..c43b06e55a0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/partial_linkage_test.cpp @@ -0,0 +1,89 @@ +// Copyright (c) 2018 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using ::testing::HasSubstr; +using PartialLinkage = spvtest::LinkerTest; + +TEST_F(PartialLinkage, Allowed) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +OpDecorate %2 LinkageAttributes "bar" Import +%3 = OpTypeFloat 32 +%1 = OpVariable %3 Uniform +%2 = OpVariable %3 Uniform +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "bar" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 3.1415 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + LinkerOptions linker_options; + linker_options.SetAllowPartialLinkage(true); + ASSERT_EQ(SPV_SUCCESS, + AssembleAndLink({body1, body2}, &linked_binary, linker_options)); + + const std::string expected_res = R"(OpCapability Linkage +OpModuleProcessed "Linked by SPIR-V Tools Linker" +OpDecorate %1 LinkageAttributes "foo" Import +%2 = OpTypeFloat 32 +%1 = OpVariable %2 Uniform +%3 = OpConstant %2 3.1415 +%4 = OpVariable %2 Uniform %3 +)"; + std::string res_body; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + ASSERT_EQ(SPV_SUCCESS, Disassemble(linked_binary, &res_body)) + << GetErrorMessage(); + EXPECT_EQ(expected_res, res_body); +} + +TEST_F(PartialLinkage, Disallowed) { + const std::string body1 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "foo" Import +OpDecorate %2 LinkageAttributes "bar" Import +%3 = OpTypeFloat 32 +%1 = OpVariable %3 Uniform +%2 = OpVariable %3 Uniform +)"; + const std::string body2 = R"( +OpCapability Linkage +OpDecorate %1 LinkageAttributes "bar" Export +%2 = OpTypeFloat 32 +%3 = OpConstant %2 3.1415 +%1 = OpVariable %2 Uniform %3 +)"; + + spvtest::Binary linked_binary; + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, + AssembleAndLink({body1, body2}, &linked_binary)); + EXPECT_THAT(GetErrorMessage(), + HasSubstr("Unresolved external reference to \"foo\".")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/link/unique_ids_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/unique_ids_test.cpp new file mode 100644 index 00000000000..55c70ea6707 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/link/unique_ids_test.cpp @@ -0,0 +1,142 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/link/linker_fixture.h" + +namespace spvtools { +namespace { + +using UniqueIds = spvtest::LinkerTest; + +TEST_F(UniqueIds, UniquelyMerged) { + std::vector bodies(2); + bodies[0] = + // clang-format off + "OpCapability Shader\n" + "%1 = OpExtInstImport \"GLSL.std.450\"\n" + "OpMemoryModel Logical GLSL450\n" + "OpEntryPoint Vertex %main \"main\"\n" + "OpSource ESSL 310\n" + "OpName %main \"main\"\n" + "OpName %f_ \"f(\"\n" + "OpName %gv1 \"gv1\"\n" + "OpName %gv2 \"gv2\"\n" + "OpName %lv1 \"lv1\"\n" + "OpName %lv2 \"lv2\"\n" + "OpName %lv1_0 \"lv1\"\n" + "%void = OpTypeVoid\n" + "%10 = OpTypeFunction %void\n" + "%float = OpTypeFloat 32\n" + "%12 = OpTypeFunction %float\n" + "%_ptr_Private_float = OpTypePointer Private %float\n" + "%gv1 = OpVariable %_ptr_Private_float Private\n" + "%float_10 = OpConstant %float 10\n" + "%gv2 = OpVariable %_ptr_Private_float Private\n" + "%float_100 = OpConstant %float 100\n" + "%_ptr_Function_float = OpTypePointer Function %float\n" + "%main = OpFunction %void None %10\n" + "%17 = OpLabel\n" + "%lv1_0 = OpVariable %_ptr_Function_float Function\n" + "OpStore %gv1 %float_10\n" + "OpStore %gv2 %float_100\n" + "%18 = OpLoad %float %gv1\n" + "%19 = OpLoad %float %gv2\n" + "%20 = OpFSub %float %18 %19\n" + "OpStore %lv1_0 %20\n" + "OpReturn\n" + "OpFunctionEnd\n" + "%f_ = OpFunction %float None %12\n" + "%21 = OpLabel\n" + "%lv1 = OpVariable %_ptr_Function_float Function\n" + "%lv2 = OpVariable %_ptr_Function_float Function\n" + "%22 = OpLoad %float %gv1\n" + "%23 = OpLoad %float %gv2\n" + "%24 = OpFAdd %float %22 %23\n" + "OpStore %lv1 %24\n" + "%25 = OpLoad %float %gv1\n" + "%26 = OpLoad %float %gv2\n" + "%27 = OpFMul %float %25 %26\n" + "OpStore %lv2 %27\n" + "%28 = OpLoad %float %lv1\n" + "%29 = OpLoad %float %lv2\n" + "%30 = OpFDiv %float %28 %29\n" + "OpReturnValue %30\n" + "OpFunctionEnd\n"; + // clang-format on + bodies[1] = + // clang-format off + "OpCapability Shader\n" + "%1 = OpExtInstImport \"GLSL.std.450\"\n" + "OpMemoryModel Logical GLSL450\n" + "OpSource ESSL 310\n" + "OpName %main \"main2\"\n" + "OpName %f_ \"f(\"\n" + "OpName %gv1 \"gv12\"\n" + "OpName %gv2 \"gv22\"\n" + "OpName %lv1 \"lv12\"\n" + "OpName %lv2 \"lv22\"\n" + "OpName %lv1_0 \"lv12\"\n" + "%void = OpTypeVoid\n" + "%10 = OpTypeFunction %void\n" + "%float = OpTypeFloat 32\n" + "%12 = OpTypeFunction %float\n" + "%_ptr_Private_float = OpTypePointer Private %float\n" + "%gv1 = OpVariable %_ptr_Private_float Private\n" + "%float_10 = OpConstant %float 10\n" + "%gv2 = OpVariable %_ptr_Private_float Private\n" + "%float_100 = OpConstant %float 100\n" + "%_ptr_Function_float = OpTypePointer Function %float\n" + "%main = OpFunction %void None %10\n" + "%17 = OpLabel\n" + "%lv1_0 = OpVariable %_ptr_Function_float Function\n" + "OpStore %gv1 %float_10\n" + "OpStore %gv2 %float_100\n" + "%18 = OpLoad %float %gv1\n" + "%19 = OpLoad %float %gv2\n" + "%20 = OpFSub %float %18 %19\n" + "OpStore %lv1_0 %20\n" + "OpReturn\n" + "OpFunctionEnd\n" + "%f_ = OpFunction %float None %12\n" + "%21 = OpLabel\n" + "%lv1 = OpVariable %_ptr_Function_float Function\n" + "%lv2 = OpVariable %_ptr_Function_float Function\n" + "%22 = OpLoad %float %gv1\n" + "%23 = OpLoad %float %gv2\n" + "%24 = OpFAdd %float %22 %23\n" + "OpStore %lv1 %24\n" + "%25 = OpLoad %float %gv1\n" + "%26 = OpLoad %float %gv2\n" + "%27 = OpFMul %float %25 %26\n" + "OpStore %lv2 %27\n" + "%28 = OpLoad %float %lv1\n" + "%29 = OpLoad %float %lv2\n" + "%30 = OpFDiv %float %28 %29\n" + "OpReturnValue %30\n" + "OpFunctionEnd\n"; + // clang-format on + + spvtest::Binary linked_binary; + LinkerOptions options; + options.SetVerifyIds(true); + spv_result_t res = AssembleAndLink(bodies, &linked_binary, options); + EXPECT_EQ(SPV_SUCCESS, res); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/log_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/log_test.cpp new file mode 100644 index 00000000000..ec66aa1ece3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/log_test.cpp @@ -0,0 +1,53 @@ +// Copyright (c) 2016 Google 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. + +#include "source/opt/log.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +namespace spvtools { +namespace { + +using ::testing::MatchesRegex; + +TEST(Log, Unimplemented) { + int invocation = 0; + auto consumer = [&invocation](spv_message_level_t level, const char* source, + const spv_position_t&, const char* message) { + ++invocation; + EXPECT_EQ(SPV_MSG_INTERNAL_ERROR, level); + EXPECT_THAT(source, MatchesRegex(".*log_test.cpp$")); + EXPECT_STREQ("unimplemented: the-ultimite-feature", message); + }; + + SPIRV_UNIMPLEMENTED(consumer, "the-ultimite-feature"); + EXPECT_EQ(1, invocation); +} + +TEST(Log, Unreachable) { + int invocation = 0; + auto consumer = [&invocation](spv_message_level_t level, const char* source, + const spv_position_t&, const char* message) { + ++invocation; + EXPECT_EQ(SPV_MSG_INTERNAL_ERROR, level); + EXPECT_THAT(source, MatchesRegex(".*log_test.cpp$")); + EXPECT_STREQ("unreachable", message); + }; + + SPIRV_UNREACHABLE(consumer); + EXPECT_EQ(1, invocation); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/move_to_front_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/move_to_front_test.cpp new file mode 100644 index 00000000000..c95d38656c0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/move_to_front_test.cpp @@ -0,0 +1,828 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/comp/move_to_front.h" + +namespace spvtools { +namespace comp { +namespace { + +// Class used to test the inner workings of MoveToFront. +class MoveToFrontTester : public MoveToFront { + public: + // Inserts the value in the internal tree data structure. For testing only. + void TestInsert(uint32_t val) { InsertNode(CreateNode(val, val)); } + + // Removes the value from the internal tree data structure. For testing only. + void TestRemove(uint32_t val) { + const auto it = value_to_node_.find(val); + assert(it != value_to_node_.end()); + RemoveNode(it->second); + } + + // Prints the internal tree data structure to |out|. For testing only. + void PrintTree(std::ostream& out, bool print_timestamp = false) const { + if (root_) PrintTreeInternal(out, root_, 1, print_timestamp); + } + + // Returns node handle corresponding to the value. The value may not be in the + // tree. + uint32_t GetNodeHandle(uint32_t value) const { + const auto it = value_to_node_.find(value); + if (it == value_to_node_.end()) return 0; + + return it->second; + } + + // Returns total node count (both those in the tree and removed, + // but not the NIL singleton). + size_t GetTotalNodeCount() const { + assert(nodes_.size()); + return nodes_.size() - 1; + } + + uint32_t GetLastAccessedValue() const { return last_accessed_value_; } + + private: + // Prints the internal tree data structure for debug purposes in the following + // format: + // 10H3S4----5H1S1-----D2 + // 15H2S2----12H1S1----D3 + // Right links are horizontal, left links step down one line. + // 5H1S1 is read as value 5, height 1, size 1. Optionally node label can also + // contain timestamp (5H1S1T15). D3 stands for depth 3. + void PrintTreeInternal(std::ostream& out, uint32_t node, size_t depth, + bool print_timestamp) const; +}; + +void MoveToFrontTester::PrintTreeInternal(std::ostream& out, uint32_t node, + size_t depth, + bool print_timestamp) const { + if (!node) { + out << "D" << depth - 1 << std::endl; + return; + } + + const size_t kTextFieldWvaluethWithoutTimestamp = 10; + const size_t kTextFieldWvaluethWithTimestamp = 14; + const size_t text_field_wvalueth = print_timestamp + ? kTextFieldWvaluethWithTimestamp + : kTextFieldWvaluethWithoutTimestamp; + + std::stringstream label; + label << ValueOf(node) << "H" << HeightOf(node) << "S" << SizeOf(node); + if (print_timestamp) label << "T" << TimestampOf(node); + const size_t label_length = label.str().length(); + if (label_length < text_field_wvalueth) + label << std::string(text_field_wvalueth - label_length, '-'); + + out << label.str(); + + PrintTreeInternal(out, RightOf(node), depth + 1, print_timestamp); + + if (LeftOf(node)) { + out << std::string(depth * text_field_wvalueth, ' '); + PrintTreeInternal(out, LeftOf(node), depth + 1, print_timestamp); + } +} + +void CheckTree(const MoveToFrontTester& mtf, const std::string& expected, + bool print_timestamp = false) { + std::stringstream ss; + mtf.PrintTree(ss, print_timestamp); + EXPECT_EQ(expected, ss.str()); +} + +TEST(MoveToFront, EmptyTree) { + MoveToFrontTester mtf; + CheckTree(mtf, std::string()); +} + +TEST(MoveToFront, InsertLeftRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(30); + mtf.TestInsert(20); + + CheckTree(mtf, std::string(R"( +30H2S2----20H1S1----D2 +)") + .substr(1)); + + mtf.TestInsert(10); + CheckTree(mtf, std::string(R"( +20H2S3----10H1S1----D2 + 30H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, InsertRightRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(20); + + CheckTree(mtf, std::string(R"( +10H2S2----D1 + 20H1S1----D2 +)") + .substr(1)); + + mtf.TestInsert(30); + CheckTree(mtf, std::string(R"( +20H2S3----10H1S1----D2 + 30H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, InsertRightLeftRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(30); + mtf.TestInsert(20); + + CheckTree(mtf, std::string(R"( +30H2S2----20H1S1----D2 +)") + .substr(1)); + + mtf.TestInsert(25); + CheckTree(mtf, std::string(R"( +25H2S3----20H1S1----D2 + 30H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, InsertLeftRightRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(20); + + CheckTree(mtf, std::string(R"( +10H2S2----D1 + 20H1S1----D2 +)") + .substr(1)); + + mtf.TestInsert(15); + CheckTree(mtf, std::string(R"( +15H2S3----10H1S1----D2 + 20H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, RemoveSingleton) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + CheckTree(mtf, std::string(R"( +10H1S1----D1 +)") + .substr(1)); + + mtf.TestRemove(10); + CheckTree(mtf, ""); +} + +TEST(MoveToFront, RemoveRootWithScapegoat) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(5); + mtf.TestInsert(15); + CheckTree(mtf, std::string(R"( +10H2S3----5H1S1-----D2 + 15H1S1----D2 +)") + .substr(1)); + + mtf.TestRemove(10); + CheckTree(mtf, std::string(R"( +15H2S2----5H1S1-----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, RemoveRightRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(5); + mtf.TestInsert(15); + mtf.TestInsert(20); + CheckTree(mtf, std::string(R"( +10H3S4----5H1S1-----D2 + 15H2S2----D2 + 20H1S1----D3 +)") + .substr(1)); + + mtf.TestRemove(5); + + CheckTree(mtf, std::string(R"( +15H2S3----10H1S1----D2 + 20H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, RemoveLeftRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(15); + mtf.TestInsert(5); + mtf.TestInsert(1); + CheckTree(mtf, std::string(R"( +10H3S4----5H2S2-----1H1S1-----D3 + 15H1S1----D2 +)") + .substr(1)); + + mtf.TestRemove(15); + + CheckTree(mtf, std::string(R"( +5H2S3-----1H1S1-----D2 + 10H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, RemoveLeftRightRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(15); + mtf.TestInsert(5); + mtf.TestInsert(12); + CheckTree(mtf, std::string(R"( +10H3S4----5H1S1-----D2 + 15H2S2----12H1S1----D3 +)") + .substr(1)); + + mtf.TestRemove(5); + + CheckTree(mtf, std::string(R"( +12H2S3----10H1S1----D2 + 15H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, RemoveRightLeftRotation) { + MoveToFrontTester mtf; + + mtf.TestInsert(10); + mtf.TestInsert(15); + mtf.TestInsert(5); + mtf.TestInsert(8); + CheckTree(mtf, std::string(R"( +10H3S4----5H2S2-----D2 + 8H1S1-----D3 + 15H1S1----D2 +)") + .substr(1)); + + mtf.TestRemove(15); + + CheckTree(mtf, std::string(R"( +8H2S3-----5H1S1-----D2 + 10H1S1----D2 +)") + .substr(1)); +} + +TEST(MoveToFront, MultipleOperations) { + MoveToFrontTester mtf; + std::vector vals = {5, 11, 12, 16, 15, 6, 14, 2, + 7, 10, 4, 8, 9, 3, 1, 13}; + + for (uint32_t i : vals) { + mtf.TestInsert(i); + } + + CheckTree(mtf, std::string(R"( +11H5S16---5H4S10----3H3S4-----2H2S2-----1H1S1-----D5 + 4H1S1-----D4 + 7H3S5-----6H1S1-----D4 + 9H2S3-----8H1S1-----D5 + 10H1S1----D5 + 15H3S5----13H2S3----12H1S1----D4 + 14H1S1----D4 + 16H1S1----D3 +)") + .substr(1)); + + mtf.TestRemove(11); + + CheckTree(mtf, std::string(R"( +10H5S15---5H4S9-----3H3S4-----2H2S2-----1H1S1-----D5 + 4H1S1-----D4 + 7H3S4-----6H1S1-----D4 + 9H2S2-----8H1S1-----D5 + 15H3S5----13H2S3----12H1S1----D4 + 14H1S1----D4 + 16H1S1----D3 +)") + .substr(1)); + + mtf.TestInsert(11); + + CheckTree(mtf, std::string(R"( +10H5S16---5H4S9-----3H3S4-----2H2S2-----1H1S1-----D5 + 4H1S1-----D4 + 7H3S4-----6H1S1-----D4 + 9H2S2-----8H1S1-----D5 + 13H3S6----12H2S2----11H1S1----D4 + 15H2S3----14H1S1----D4 + 16H1S1----D4 +)") + .substr(1)); + + mtf.TestRemove(5); + + CheckTree(mtf, std::string(R"( +10H5S15---6H4S8-----3H3S4-----2H2S2-----1H1S1-----D5 + 4H1S1-----D4 + 8H2S3-----7H1S1-----D4 + 9H1S1-----D4 + 13H3S6----12H2S2----11H1S1----D4 + 15H2S3----14H1S1----D4 + 16H1S1----D4 +)") + .substr(1)); + + mtf.TestInsert(5); + + CheckTree(mtf, std::string(R"( +10H5S16---6H4S9-----3H3S5-----2H2S2-----1H1S1-----D5 + 4H2S2-----D4 + 5H1S1-----D5 + 8H2S3-----7H1S1-----D4 + 9H1S1-----D4 + 13H3S6----12H2S2----11H1S1----D4 + 15H2S3----14H1S1----D4 + 16H1S1----D4 +)") + .substr(1)); + + mtf.TestRemove(2); + mtf.TestRemove(1); + mtf.TestRemove(4); + mtf.TestRemove(3); + mtf.TestRemove(6); + mtf.TestRemove(5); + mtf.TestRemove(7); + mtf.TestRemove(9); + + CheckTree(mtf, std::string(R"( +13H4S8----10H3S4----8H1S1-----D3 + 12H2S2----11H1S1----D4 + 15H2S3----14H1S1----D3 + 16H1S1----D3 +)") + .substr(1)); +} + +TEST(MoveToFront, BiggerScaleTreeTest) { + MoveToFrontTester mtf; + std::set all_vals; + + const uint32_t kMagic1 = 2654435761; + const uint32_t kMagic2 = 10000; + + for (uint32_t i = 1; i < 1000; ++i) { + const uint32_t val = (i * kMagic1) % kMagic2; + if (!all_vals.count(val)) { + mtf.TestInsert(val); + all_vals.insert(val); + } + } + + for (uint32_t i = 1; i < 1000; ++i) { + const uint32_t val = (i * kMagic1) % kMagic2; + if (val % 2 == 0) { + mtf.TestRemove(val); + all_vals.erase(val); + } + } + + for (uint32_t i = 1000; i < 2000; ++i) { + const uint32_t val = (i * kMagic1) % kMagic2; + if (!all_vals.count(val)) { + mtf.TestInsert(val); + all_vals.insert(val); + } + } + + for (uint32_t i = 1; i < 2000; ++i) { + const uint32_t val = (i * kMagic1) % kMagic2; + if (val > 50) { + mtf.TestRemove(val); + all_vals.erase(val); + } + } + + EXPECT_EQ(all_vals, std::set({2, 4, 11, 13, 24, 33, 35, 37, 46})); + + CheckTree(mtf, std::string(R"( +33H4S9----11H3S5----2H2S2-----D3 + 4H1S1-----D4 + 13H2S2----D3 + 24H1S1----D4 + 37H2S3----35H1S1----D3 + 46H1S1----D3 +)") + .substr(1)); +} + +TEST(MoveToFront, RankFromValue) { + MoveToFrontTester mtf; + + uint32_t rank = 0; + EXPECT_FALSE(mtf.RankFromValue(1, &rank)); + + EXPECT_TRUE(mtf.Insert(1)); + EXPECT_TRUE(mtf.Insert(2)); + EXPECT_TRUE(mtf.Insert(3)); + EXPECT_FALSE(mtf.Insert(2)); + CheckTree(mtf, + std::string(R"( +2H2S3T2-------1H1S1T1-------D2 + 3H1S1T3-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_FALSE(mtf.RankFromValue(4, &rank)); + + EXPECT_TRUE(mtf.RankFromValue(1, &rank)); + EXPECT_EQ(3u, rank); + + CheckTree(mtf, + std::string(R"( +3H2S3T3-------2H1S1T2-------D2 + 1H1S1T4-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.RankFromValue(1, &rank)); + EXPECT_EQ(1u, rank); + + EXPECT_TRUE(mtf.RankFromValue(3, &rank)); + EXPECT_EQ(2u, rank); + + EXPECT_TRUE(mtf.RankFromValue(2, &rank)); + EXPECT_EQ(3u, rank); + + EXPECT_TRUE(mtf.Insert(40)); + + EXPECT_TRUE(mtf.RankFromValue(1, &rank)); + EXPECT_EQ(4u, rank); + + EXPECT_TRUE(mtf.Insert(50)); + + EXPECT_TRUE(mtf.RankFromValue(1, &rank)); + EXPECT_EQ(2u, rank); + + CheckTree(mtf, + std::string(R"( +2H3S5T6-------3H1S1T5-------D2 + 50H2S3T9------40H1S1T7------D3 + 1H1S1T10------D3 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.RankFromValue(50, &rank)); + EXPECT_EQ(2u, rank); + + EXPECT_EQ(5u, mtf.GetSize()); + CheckTree(mtf, + std::string(R"( +2H3S5T6-------3H1S1T5-------D2 + 1H2S3T10------40H1S1T7------D3 + 50H1S1T11-----D3 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_FALSE(mtf.RankFromValue(0, &rank)); + EXPECT_FALSE(mtf.RankFromValue(20, &rank)); +} + +TEST(MoveToFront, ValueFromRank) { + MoveToFrontTester mtf; + + uint32_t value = 0; + EXPECT_FALSE(mtf.ValueFromRank(0, &value)); + EXPECT_FALSE(mtf.ValueFromRank(1, &value)); + + EXPECT_TRUE(mtf.Insert(1)); + EXPECT_EQ(1u, mtf.GetLastAccessedValue()); + EXPECT_TRUE(mtf.Insert(2)); + EXPECT_EQ(2u, mtf.GetLastAccessedValue()); + EXPECT_TRUE(mtf.Insert(3)); + EXPECT_EQ(3u, mtf.GetLastAccessedValue()); + + EXPECT_TRUE(mtf.ValueFromRank(3, &value)); + EXPECT_EQ(1u, value); + EXPECT_EQ(1u, mtf.GetLastAccessedValue()); + + EXPECT_TRUE(mtf.ValueFromRank(1, &value)); + EXPECT_EQ(1u, value); + EXPECT_EQ(1u, mtf.GetLastAccessedValue()); + + CheckTree(mtf, + std::string(R"( +3H2S3T3-------2H1S1T2-------D2 + 1H1S1T4-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.ValueFromRank(2, &value)); + EXPECT_EQ(3u, value); + + EXPECT_EQ(3u, mtf.GetSize()); + + CheckTree(mtf, + std::string(R"( +1H2S3T4-------2H1S1T2-------D2 + 3H1S1T5-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.ValueFromRank(3, &value)); + EXPECT_EQ(2u, value); + + CheckTree(mtf, + std::string(R"( +3H2S3T5-------1H1S1T4-------D2 + 2H1S1T6-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.Insert(10)); + CheckTree(mtf, + std::string(R"( +3H3S4T5-------1H1S1T4-------D2 + 2H2S2T6-------D2 + 10H1S1T7------D3 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.ValueFromRank(1, &value)); + EXPECT_EQ(10u, value); +} + +TEST(MoveToFront, Remove) { + MoveToFrontTester mtf; + + EXPECT_FALSE(mtf.Remove(1)); + EXPECT_EQ(0u, mtf.GetTotalNodeCount()); + + EXPECT_TRUE(mtf.Insert(1)); + EXPECT_TRUE(mtf.Insert(2)); + EXPECT_TRUE(mtf.Insert(3)); + + CheckTree(mtf, + std::string(R"( +2H2S3T2-------1H1S1T1-------D2 + 3H1S1T3-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_EQ(1u, mtf.GetNodeHandle(1)); + EXPECT_EQ(3u, mtf.GetTotalNodeCount()); + EXPECT_TRUE(mtf.Remove(1)); + EXPECT_EQ(3u, mtf.GetTotalNodeCount()); + + CheckTree(mtf, + std::string(R"( +2H2S2T2-------D1 + 3H1S1T3-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + uint32_t value = 0; + EXPECT_TRUE(mtf.ValueFromRank(2, &value)); + EXPECT_EQ(2u, value); + + CheckTree(mtf, + std::string(R"( +3H2S2T3-------D1 + 2H1S1T4-------D2 +)") + .substr(1), + /* print_timestamp = */ true); + + EXPECT_TRUE(mtf.Insert(1)); + EXPECT_EQ(1u, mtf.GetNodeHandle(1)); + EXPECT_EQ(3u, mtf.GetTotalNodeCount()); +} + +TEST(MoveToFront, LargerScale) { + MoveToFrontTester mtf; + uint32_t value = 0; + uint32_t rank = 0; + + for (uint32_t i = 1; i < 1000; ++i) { + ASSERT_TRUE(mtf.Insert(i)); + ASSERT_EQ(i, mtf.GetSize()); + + ASSERT_TRUE(mtf.RankFromValue(i, &rank)); + ASSERT_EQ(1u, rank); + + ASSERT_TRUE(mtf.ValueFromRank(1, &value)); + ASSERT_EQ(i, value); + } + + ASSERT_TRUE(mtf.ValueFromRank(999, &value)); + ASSERT_EQ(1u, value); + + ASSERT_TRUE(mtf.ValueFromRank(999, &value)); + ASSERT_EQ(2u, value); + + ASSERT_TRUE(mtf.ValueFromRank(999, &value)); + ASSERT_EQ(3u, value); + + ASSERT_TRUE(mtf.ValueFromRank(999, &value)); + ASSERT_EQ(4u, value); + + ASSERT_TRUE(mtf.ValueFromRank(999, &value)); + ASSERT_EQ(5u, value); + + ASSERT_TRUE(mtf.ValueFromRank(999, &value)); + ASSERT_EQ(6u, value); + + ASSERT_TRUE(mtf.ValueFromRank(101, &value)); + ASSERT_EQ(905u, value); + + ASSERT_TRUE(mtf.ValueFromRank(101, &value)); + ASSERT_EQ(906u, value); + + ASSERT_TRUE(mtf.ValueFromRank(101, &value)); + ASSERT_EQ(907u, value); + + ASSERT_TRUE(mtf.ValueFromRank(201, &value)); + ASSERT_EQ(805u, value); + + ASSERT_TRUE(mtf.ValueFromRank(201, &value)); + ASSERT_EQ(806u, value); + + ASSERT_TRUE(mtf.ValueFromRank(201, &value)); + ASSERT_EQ(807u, value); + + ASSERT_TRUE(mtf.ValueFromRank(301, &value)); + ASSERT_EQ(705u, value); + + ASSERT_TRUE(mtf.ValueFromRank(301, &value)); + ASSERT_EQ(706u, value); + + ASSERT_TRUE(mtf.ValueFromRank(301, &value)); + ASSERT_EQ(707u, value); + + ASSERT_TRUE(mtf.RankFromValue(605, &rank)); + ASSERT_EQ(401u, rank); + + ASSERT_TRUE(mtf.RankFromValue(606, &rank)); + ASSERT_EQ(401u, rank); + + ASSERT_TRUE(mtf.RankFromValue(607, &rank)); + ASSERT_EQ(401u, rank); + + ASSERT_TRUE(mtf.ValueFromRank(1, &value)); + ASSERT_EQ(607u, value); + + ASSERT_TRUE(mtf.ValueFromRank(2, &value)); + ASSERT_EQ(606u, value); + + ASSERT_TRUE(mtf.ValueFromRank(3, &value)); + ASSERT_EQ(605u, value); + + ASSERT_TRUE(mtf.ValueFromRank(4, &value)); + ASSERT_EQ(707u, value); + + ASSERT_TRUE(mtf.ValueFromRank(5, &value)); + ASSERT_EQ(706u, value); + + ASSERT_TRUE(mtf.ValueFromRank(6, &value)); + ASSERT_EQ(705u, value); + + ASSERT_TRUE(mtf.ValueFromRank(7, &value)); + ASSERT_EQ(807u, value); + + ASSERT_TRUE(mtf.ValueFromRank(8, &value)); + ASSERT_EQ(806u, value); + + ASSERT_TRUE(mtf.ValueFromRank(9, &value)); + ASSERT_EQ(805u, value); + + ASSERT_TRUE(mtf.ValueFromRank(10, &value)); + ASSERT_EQ(907u, value); + + ASSERT_TRUE(mtf.ValueFromRank(11, &value)); + ASSERT_EQ(906u, value); + + ASSERT_TRUE(mtf.ValueFromRank(12, &value)); + ASSERT_EQ(905u, value); + + ASSERT_TRUE(mtf.ValueFromRank(13, &value)); + ASSERT_EQ(6u, value); + + ASSERT_TRUE(mtf.ValueFromRank(14, &value)); + ASSERT_EQ(5u, value); + + ASSERT_TRUE(mtf.ValueFromRank(15, &value)); + ASSERT_EQ(4u, value); + + ASSERT_TRUE(mtf.ValueFromRank(16, &value)); + ASSERT_EQ(3u, value); + + ASSERT_TRUE(mtf.ValueFromRank(17, &value)); + ASSERT_EQ(2u, value); + + ASSERT_TRUE(mtf.ValueFromRank(18, &value)); + ASSERT_EQ(1u, value); + + ASSERT_TRUE(mtf.ValueFromRank(19, &value)); + ASSERT_EQ(999u, value); + + ASSERT_TRUE(mtf.ValueFromRank(20, &value)); + ASSERT_EQ(998u, value); + + ASSERT_TRUE(mtf.ValueFromRank(21, &value)); + ASSERT_EQ(997u, value); + + ASSERT_TRUE(mtf.RankFromValue(997, &rank)); + ASSERT_EQ(1u, rank); + + ASSERT_TRUE(mtf.RankFromValue(998, &rank)); + ASSERT_EQ(2u, rank); + + ASSERT_TRUE(mtf.RankFromValue(996, &rank)); + ASSERT_EQ(22u, rank); + + ASSERT_TRUE(mtf.Remove(995)); + + ASSERT_TRUE(mtf.RankFromValue(994, &rank)); + ASSERT_EQ(23u, rank); + + for (uint32_t i = 10; i < 1000; ++i) { + if (i != 995) { + ASSERT_TRUE(mtf.Remove(i)); + } else { + ASSERT_FALSE(mtf.Remove(i)); + } + } + + CheckTree(mtf, + std::string(R"( +6H4S9T1029----8H2S3T8-------7H1S1T7-------D3 + 9H1S1T9-------D3 + 2H3S5T1033----4H2S3T1031----5H1S1T1030----D4 + 3H1S1T1032----D4 + 1H1S1T1034----D3 +)") + .substr(1), + /* print_timestamp = */ true); + + ASSERT_TRUE(mtf.Insert(1000)); + ASSERT_TRUE(mtf.ValueFromRank(1, &value)); + ASSERT_EQ(1000u, value); +} + +} // namespace +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/name_mapper_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/name_mapper_test.cpp new file mode 100644 index 00000000000..9a9ee8aa016 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/name_mapper_test.cpp @@ -0,0 +1,347 @@ +// Copyright (c) 2016 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "source/name_mapper.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::ScopedContext; +using ::testing::Eq; + +TEST(TrivialNameTest, Samples) { + auto mapper = GetTrivialNameMapper(); + EXPECT_EQ(mapper(1), "1"); + EXPECT_EQ(mapper(1999), "1999"); + EXPECT_EQ(mapper(1024), "1024"); +} + +// A test case for the name mappers that actually look at an assembled module. +struct NameIdCase { + std::string assembly; // Input assembly text + uint32_t id; + std::string expected_name; +}; + +using FriendlyNameTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(FriendlyNameTest, SingleMapping) { + ScopedContext context(SPV_ENV_UNIVERSAL_1_1); + auto words = CompileSuccessfully(GetParam().assembly, SPV_ENV_UNIVERSAL_1_1); + auto friendly_mapper = + FriendlyNameMapper(context.context, words.data(), words.size()); + NameMapper mapper = friendly_mapper.GetNameMapper(); + EXPECT_THAT(mapper(GetParam().id), Eq(GetParam().expected_name)) + << GetParam().assembly << std::endl + << " for id " << GetParam().id; +} + +INSTANTIATE_TEST_CASE_P(ScalarType, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeVoid", 1, "void"}, + {"%1 = OpTypeBool", 1, "bool"}, + {"%1 = OpTypeInt 8 0", 1, "uchar"}, + {"%1 = OpTypeInt 8 1", 1, "char"}, + {"%1 = OpTypeInt 16 0", 1, "ushort"}, + {"%1 = OpTypeInt 16 1", 1, "short"}, + {"%1 = OpTypeInt 32 0", 1, "uint"}, + {"%1 = OpTypeInt 32 1", 1, "int"}, + {"%1 = OpTypeInt 64 0", 1, "ulong"}, + {"%1 = OpTypeInt 64 1", 1, "long"}, + {"%1 = OpTypeInt 1 0", 1, "u1"}, + {"%1 = OpTypeInt 1 1", 1, "i1"}, + {"%1 = OpTypeInt 33 0", 1, "u33"}, + {"%1 = OpTypeInt 33 1", 1, "i33"}, + + {"%1 = OpTypeFloat 16", 1, "half"}, + {"%1 = OpTypeFloat 32", 1, "float"}, + {"%1 = OpTypeFloat 64", 1, "double"}, + {"%1 = OpTypeFloat 10", 1, "fp10"}, + {"%1 = OpTypeFloat 55", 1, "fp55"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + VectorType, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeBool %2 = OpTypeVector %1 1", 2, "v1bool"}, + {"%1 = OpTypeBool %2 = OpTypeVector %1 2", 2, "v2bool"}, + {"%1 = OpTypeBool %2 = OpTypeVector %1 3", 2, "v3bool"}, + {"%1 = OpTypeBool %2 = OpTypeVector %1 4", 2, "v4bool"}, + + {"%1 = OpTypeInt 8 0 %2 = OpTypeVector %1 2", 2, "v2uchar"}, + {"%1 = OpTypeInt 16 1 %2 = OpTypeVector %1 3", 2, "v3short"}, + {"%1 = OpTypeInt 32 0 %2 = OpTypeVector %1 4", 2, "v4uint"}, + {"%1 = OpTypeInt 64 1 %2 = OpTypeVector %1 3", 2, "v3long"}, + {"%1 = OpTypeInt 20 0 %2 = OpTypeVector %1 4", 2, "v4u20"}, + {"%1 = OpTypeInt 21 1 %2 = OpTypeVector %1 3", 2, "v3i21"}, + + {"%1 = OpTypeFloat 32 %2 = OpTypeVector %1 2", 2, "v2float"}, + // OpName overrides the element name. + {"OpName %1 \"time\" %1 = OpTypeFloat 32 %2 = OpTypeVector %1 2", 2, + "v2time"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + MatrixType, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeBool %2 = OpTypeVector %1 2 %3 = OpTypeMatrix %2 2", 3, + "mat2v2bool"}, + {"%1 = OpTypeFloat 32 %2 = OpTypeVector %1 2 %3 = OpTypeMatrix %2 3", 3, + "mat3v2float"}, + {"%1 = OpTypeFloat 32 %2 = OpTypeVector %1 2 %3 = OpTypeMatrix %2 4", 3, + "mat4v2float"}, + {"OpName %1 \"time\" %1 = OpTypeFloat 32 %2 = OpTypeVector %1 2 %3 = " + "OpTypeMatrix %2 4", + 3, "mat4v2time"}, + {"OpName %2 \"lat_long\" %1 = OpTypeFloat 32 %2 = OpTypeVector %1 2 %3 " + "= OpTypeMatrix %2 4", + 3, "mat4lat_long"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + OpName, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"OpName %1 \"abcdefg\"", 1, "abcdefg"}, + {"OpName %1 \"Hello world!\"", 1, "Hello_world_"}, + {"OpName %1 \"0123456789\"", 1, "0123456789"}, + {"OpName %1 \"_\"", 1, "_"}, + // An empty string is not valid for SPIR-V assembly IDs. + {"OpName %1 \"\"", 1, "_"}, + // Test uniqueness when presented with things mapping to "_" + {"OpName %1 \"\" OpName %2 \"\"", 1, "_"}, + {"OpName %1 \"\" OpName %2 \"\"", 2, "__0"}, + {"OpName %1 \"\" OpName %2 \"\" OpName %3 \"_\"", 3, "__1"}, + // Test uniqueness of names that are forced to be + // numbers. + {"OpName %1 \"2\" OpName %2 \"2\"", 1, "2"}, + {"OpName %1 \"2\" OpName %2 \"2\"", 2, "2_0"}, + // Test uniqueness in the face of forward references + // for Ids that don't already have friendly names. + // In particular, the first OpDecorate assigns the name, and + // the second one can't override it. + {"OpDecorate %1 Volatile OpDecorate %1 Restrict", 1, "1"}, + // But a forced name can override the name that + // would have been assigned via the OpDecorate + // forward reference. + {"OpName %1 \"mememe\" OpDecorate %1 Volatile OpDecorate %1 Restrict", + 1, "mememe"}, + // OpName can override other inferences. We assume valid instruction + // ordering, where OpName precedes type definitions. + {"OpName %1 \"myfloat\" %1 = OpTypeFloat 32", 1, "myfloat"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + UniquenessHeuristic, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeVoid %2 = OpTypeVoid %3 = OpTypeVoid", 1, "void"}, + {"%1 = OpTypeVoid %2 = OpTypeVoid %3 = OpTypeVoid", 2, "void_0"}, + {"%1 = OpTypeVoid %2 = OpTypeVoid %3 = OpTypeVoid", 3, "void_1"}, + }), ); + +INSTANTIATE_TEST_CASE_P(Arrays, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"OpName %2 \"FortyTwo\" %1 = OpTypeFloat 32 " + "%2 = OpConstant %1 42 %3 = OpTypeArray %1 %2", + 3, "_arr_float_FortyTwo"}, + {"%1 = OpTypeInt 32 0 " + "%2 = OpTypeRuntimeArray %1", + 2, "_runtimearr_uint"}, + }), ); + +INSTANTIATE_TEST_CASE_P(Structs, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeBool " + "%2 = OpTypeStruct %1 %1 %1", + 2, "_struct_2"}, + {"%1 = OpTypeBool " + "%2 = OpTypeStruct %1 %1 %1 " + "%3 = OpTypeStruct %2 %2", + 3, "_struct_3"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + Pointer, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeFloat 32 %2 = OpTypePointer Workgroup %1", 2, + "_ptr_Workgroup_float"}, + {"%1 = OpTypeBool %2 = OpTypePointer Private %1", 2, + "_ptr_Private_bool"}, + // OpTypeForwardPointer doesn't force generation of the name for its + // target type. + {"%1 = OpTypeBool OpTypeForwardPointer %2 Private %2 = OpTypePointer " + "Private %1", + 2, "_ptr_Private_bool"}, + }), ); + +INSTANTIATE_TEST_CASE_P(ExoticTypes, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeEvent", 1, "Event"}, + {"%1 = OpTypeDeviceEvent", 1, "DeviceEvent"}, + {"%1 = OpTypeReserveId", 1, "ReserveId"}, + {"%1 = OpTypeQueue", 1, "Queue"}, + {"%1 = OpTypeOpaque \"hello world!\"", 1, + "Opaque_hello_world_"}, + {"%1 = OpTypePipe ReadOnly", 1, "PipeReadOnly"}, + {"%1 = OpTypePipe WriteOnly", 1, "PipeWriteOnly"}, + {"%1 = OpTypePipe ReadWrite", 1, "PipeReadWrite"}, + {"%1 = OpTypePipeStorage", 1, "PipeStorage"}, + {"%1 = OpTypeNamedBarrier", 1, "NamedBarrier"}, + }), ); + +// Makes a test case for a BuiltIn variable declaration. +NameIdCase BuiltInCase(std::string assembly_name, std::string expected) { + return NameIdCase{std::string("OpDecorate %1 BuiltIn ") + assembly_name + + " %1 = OpVariable %2 Input", + 1, expected}; +} + +// Makes a test case for a BuiltIn variable declaration. In this overload, +// the expected result is the same as the assembly name. +NameIdCase BuiltInCase(std::string assembly_name) { + return BuiltInCase(assembly_name, assembly_name); +} + +// Makes a test case for a BuiltIn variable declaration. In this overload, +// the expected result is the same as the assembly name, but with a "gl_" +// prefix. +NameIdCase BuiltInGLCase(std::string assembly_name) { + return BuiltInCase(assembly_name, std::string("gl_") + assembly_name); +} + +INSTANTIATE_TEST_CASE_P( + BuiltIns, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + BuiltInGLCase("Position"), + BuiltInGLCase("PointSize"), + BuiltInGLCase("ClipDistance"), + BuiltInGLCase("CullDistance"), + BuiltInCase("VertexId", "gl_VertexID"), + BuiltInCase("InstanceId", "gl_InstanceID"), + BuiltInCase("PrimitiveId", "gl_PrimitiveID"), + BuiltInCase("InvocationId", "gl_InvocationID"), + BuiltInGLCase("Layer"), + BuiltInGLCase("ViewportIndex"), + BuiltInGLCase("TessLevelOuter"), + BuiltInGLCase("TessLevelInner"), + BuiltInGLCase("TessCoord"), + BuiltInGLCase("PatchVertices"), + BuiltInGLCase("FragCoord"), + BuiltInGLCase("PointCoord"), + BuiltInGLCase("FrontFacing"), + BuiltInCase("SampleId", "gl_SampleID"), + BuiltInGLCase("SamplePosition"), + BuiltInGLCase("SampleMask"), + BuiltInGLCase("FragDepth"), + BuiltInGLCase("HelperInvocation"), + BuiltInCase("NumWorkgroups", "gl_NumWorkGroups"), + BuiltInCase("WorkgroupSize", "gl_WorkGroupSize"), + BuiltInCase("WorkgroupId", "gl_WorkGroupID"), + BuiltInCase("LocalInvocationId", "gl_LocalInvocationID"), + BuiltInCase("GlobalInvocationId", "gl_GlobalInvocationID"), + BuiltInGLCase("LocalInvocationIndex"), + BuiltInCase("WorkDim"), + BuiltInCase("GlobalSize"), + BuiltInCase("EnqueuedWorkgroupSize"), + BuiltInCase("GlobalOffset"), + BuiltInCase("GlobalLinearId"), + BuiltInCase("SubgroupSize"), + BuiltInCase("SubgroupMaxSize"), + BuiltInCase("NumSubgroups"), + BuiltInCase("NumEnqueuedSubgroups"), + BuiltInCase("SubgroupId"), + BuiltInCase("SubgroupLocalInvocationId"), + BuiltInGLCase("VertexIndex"), + BuiltInGLCase("InstanceIndex"), + BuiltInCase("SubgroupEqMaskKHR"), + BuiltInCase("SubgroupGeMaskKHR"), + BuiltInCase("SubgroupGtMaskKHR"), + BuiltInCase("SubgroupLeMaskKHR"), + BuiltInCase("SubgroupLtMaskKHR"), + }), ); + +INSTANTIATE_TEST_CASE_P(DebugNameOverridesBuiltin, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"OpName %1 \"foo\" OpDecorate %1 BuiltIn WorkDim " + "%1 = OpVariable %2 Input", + 1, "foo"}}), ); + +INSTANTIATE_TEST_CASE_P( + SimpleIntegralConstants, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeInt 32 0 %2 = OpConstant %1 0", 2, "uint_0"}, + {"%1 = OpTypeInt 32 0 %2 = OpConstant %1 1", 2, "uint_1"}, + {"%1 = OpTypeInt 32 0 %2 = OpConstant %1 2", 2, "uint_2"}, + {"%1 = OpTypeInt 32 0 %2 = OpConstant %1 9", 2, "uint_9"}, + {"%1 = OpTypeInt 32 0 %2 = OpConstant %1 42", 2, "uint_42"}, + {"%1 = OpTypeInt 32 1 %2 = OpConstant %1 0", 2, "int_0"}, + {"%1 = OpTypeInt 32 1 %2 = OpConstant %1 1", 2, "int_1"}, + {"%1 = OpTypeInt 32 1 %2 = OpConstant %1 2", 2, "int_2"}, + {"%1 = OpTypeInt 32 1 %2 = OpConstant %1 9", 2, "int_9"}, + {"%1 = OpTypeInt 32 1 %2 = OpConstant %1 42", 2, "int_42"}, + {"%1 = OpTypeInt 32 1 %2 = OpConstant %1 -42", 2, "int_n42"}, + // Exotic bit widths + {"%1 = OpTypeInt 33 0 %2 = OpConstant %1 0", 2, "u33_0"}, + {"%1 = OpTypeInt 33 1 %2 = OpConstant %1 10", 2, "i33_10"}, + {"%1 = OpTypeInt 33 1 %2 = OpConstant %1 -19", 2, "i33_n19"}, + }), ); + +INSTANTIATE_TEST_CASE_P( + SimpleFloatConstants, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.ff4p+16", 2, + "half_0x1_ff4p_16"}, + {"%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.d2cp-10", 2, + "half_n0x1_d2cpn10"}, + // 32-bit floats + {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 -3.125", 2, "float_n3_125"}, + {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.8p+128", 2, + "float_0x1_8p_128"}, // NaN + {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.0002p+128", 2, + "float_n0x1_0002p_128"}, // NaN + {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1p+128", 2, + "float_0x1p_128"}, // Inf + {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1p+128", 2, + "float_n0x1p_128"}, // -Inf + // 64-bit floats + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 -3.125", 2, "double_n3_125"}, + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.ffffffffffffap-1023", 2, + "double_0x1_ffffffffffffapn1023"}, // small normal + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.ffffffffffffap-1023", 2, + "double_n0x1_ffffffffffffapn1023"}, + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.8p+1024", 2, + "double_0x1_8p_1024"}, // NaN + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.0002p+1024", 2, + "double_n0x1_0002p_1024"}, // NaN + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1p+1024", 2, + "double_0x1p_1024"}, // Inf + {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1p+1024", 2, + "double_n0x1p_1024"}, // -Inf + }), ); + +INSTANTIATE_TEST_CASE_P( + BooleanConstants, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeBool\n%2 = OpConstantTrue %1", 2, "true"}, + {"%1 = OpTypeBool\n%2 = OpConstantFalse %1", 2, "false"}, + }), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/named_id_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/named_id_test.cpp new file mode 100644 index 00000000000..4ba54adc3a6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/named_id_test.cpp @@ -0,0 +1,87 @@ +// Copyright (c) 2015-2016 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. + +#include +#include + +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using NamedIdTest = spvtest::TextToBinaryTest; + +TEST_F(NamedIdTest, Default) { + const std::string input = R"( + OpCapability Shader + OpMemoryModel Logical Simple + OpEntryPoint Vertex %main "foo" + %void = OpTypeVoid +%fnMain = OpTypeFunction %void + %main = OpFunction %void None %fnMain +%lbMain = OpLabel + OpReturn + OpFunctionEnd)"; + const std::string output = + "OpCapability Shader\n" + "OpMemoryModel Logical Simple\n" + "OpEntryPoint Vertex %1 \"foo\"\n" + "%2 = OpTypeVoid\n" + "%3 = OpTypeFunction %2\n" + "%1 = OpFunction %2 None %3\n" + "%4 = OpLabel\n" + "OpReturn\n" + "OpFunctionEnd\n"; + EXPECT_EQ(output, EncodeAndDecodeSuccessfully(input)); +} + +struct IdCheckCase { + std::string id; + bool valid; +}; + +using IdValidityTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(IdValidityTest, IdTypes) { + const std::string input = GetParam().id + " = OpTypeVoid"; + SetText(input); + if (GetParam().valid) { + CompileSuccessfully(input); + } else { + CompileFailure(input); + } +} + +INSTANTIATE_TEST_CASE_P( + ValidAndInvalidIds, IdValidityTest, + ::testing::ValuesIn(std::vector( + {{"%1", true}, {"%2abc", true}, {"%3Def", true}, + {"%4GHI", true}, {"%5_j_k", true}, {"%6J_M", true}, + {"%n", true}, {"%O", true}, {"%p7", true}, + {"%Q8", true}, {"%R_S", true}, {"%T_10_U", true}, + {"%V_11", true}, {"%W_X_13", true}, {"%_A", true}, + {"%_", true}, {"%__", true}, {"%A_", true}, + {"%_A_", true}, + + {"%@", false}, {"%!", false}, {"%ABC!", false}, + {"%__A__@", false}, {"%%", false}, {"%-", false}, + {"%foo_@_bar", false}, {"%", false}, + + {"5", false}, {"32", false}, {"foo", false}, + {"a%bar", false}})), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_make_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_make_test.cpp new file mode 100644 index 00000000000..6481ef326de --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_make_test.cpp @@ -0,0 +1,44 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +// A sampling of word counts. Covers extreme points well, and all bit +// positions, and some combinations of bit positions. +const uint16_t kSampleWordCounts[] = { + 0, 1, 2, 3, 4, 8, 16, 32, 64, 127, 128, + 256, 511, 512, 1024, 2048, 4096, 8192, 16384, 32768, 0xfffe, 0xffff}; + +// A sampling of opcode values. Covers the lower values well, a few samples +// around the number of core instructions (as of this writing), and some +// higher values. +const uint16_t kSampleOpcodes[] = {0, 1, 2, 3, 4, 100, + 300, 305, 1023, 0xfffe, 0xffff}; + +TEST(OpcodeMake, Samples) { + for (auto wordCount : kSampleWordCounts) { + for (auto opcode : kSampleOpcodes) { + uint32_t word = 0; + word |= uint32_t(opcode); + word |= uint32_t(wordCount) << 16; + EXPECT_EQ(word, spvOpcodeMake(wordCount, SpvOp(opcode))); + } + } +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp new file mode 100644 index 00000000000..32bf1dc085a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp @@ -0,0 +1,78 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +#include "source/enum_set.h" + +namespace spvtools { +namespace { + +using spvtest::ElementsIn; + +// Capabilities required by an Opcode. +struct ExpectedOpCodeCapabilities { + SpvOp opcode; + CapabilitySet capabilities; +}; + +using OpcodeTableCapabilitiesTest = + ::testing::TestWithParam; + +TEST_P(OpcodeTableCapabilitiesTest, TableEntryMatchesExpectedCapabilities) { + auto env = SPV_ENV_UNIVERSAL_1_1; + spv_opcode_table opcodeTable; + ASSERT_EQ(SPV_SUCCESS, spvOpcodeTableGet(&opcodeTable, env)); + spv_opcode_desc entry; + ASSERT_EQ(SPV_SUCCESS, spvOpcodeTableValueLookup(env, opcodeTable, + GetParam().opcode, &entry)); + EXPECT_EQ( + ElementsIn(GetParam().capabilities), + ElementsIn(CapabilitySet(entry->numCapabilities, entry->capabilities))); +} + +INSTANTIATE_TEST_CASE_P( + TableRowTest, OpcodeTableCapabilitiesTest, + // Spot-check a few opcodes. + ::testing::Values( + ExpectedOpCodeCapabilities{ + SpvOpImageQuerySize, + CapabilitySet{SpvCapabilityKernel, SpvCapabilityImageQuery}}, + ExpectedOpCodeCapabilities{ + SpvOpImageQuerySizeLod, + CapabilitySet{SpvCapabilityKernel, SpvCapabilityImageQuery}}, + ExpectedOpCodeCapabilities{ + SpvOpImageQueryLevels, + CapabilitySet{SpvCapabilityKernel, SpvCapabilityImageQuery}}, + ExpectedOpCodeCapabilities{ + SpvOpImageQuerySamples, + CapabilitySet{SpvCapabilityKernel, SpvCapabilityImageQuery}}, + ExpectedOpCodeCapabilities{SpvOpImageSparseSampleImplicitLod, + CapabilitySet{SpvCapabilitySparseResidency}}, + ExpectedOpCodeCapabilities{SpvOpCopyMemorySized, + CapabilitySet{SpvCapabilityAddresses}}, + ExpectedOpCodeCapabilities{SpvOpArrayLength, + CapabilitySet{SpvCapabilityShader}}, + ExpectedOpCodeCapabilities{SpvOpFunction, CapabilitySet()}, + ExpectedOpCodeCapabilities{SpvOpConvertFToS, CapabilitySet()}, + ExpectedOpCodeCapabilities{SpvOpEmitStreamVertex, + CapabilitySet{SpvCapabilityGeometryStreams}}, + ExpectedOpCodeCapabilities{SpvOpTypeNamedBarrier, + CapabilitySet{SpvCapabilityNamedBarrier}}, + ExpectedOpCodeCapabilities{ + SpvOpGetKernelMaxNumSubgroups, + CapabilitySet{SpvCapabilitySubgroupDispatch}}), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_split_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_split_test.cpp new file mode 100644 index 00000000000..43fedb3855c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_split_test.cpp @@ -0,0 +1,30 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +TEST(OpcodeSplit, Default) { + uint32_t word = spvOpcodeMake(42, (SpvOp)23); + uint16_t wordCount = 0; + uint16_t opcode; + spvOpcodeSplit(word, &wordCount, &opcode); + ASSERT_EQ(42, wordCount); + ASSERT_EQ(23, opcode); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_table_get_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_table_get_test.cpp new file mode 100644 index 00000000000..6f80ad7d8ca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opcode_table_get_test.cpp @@ -0,0 +1,39 @@ +// Copyright (c) 2015-2016 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. + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using GetTargetOpcodeTableGetTest = ::testing::TestWithParam; +using ::testing::ValuesIn; + +TEST_P(GetTargetOpcodeTableGetTest, SanityCheck) { + spv_opcode_table table; + ASSERT_EQ(SPV_SUCCESS, spvOpcodeTableGet(&table, GetParam())); + ASSERT_NE(0u, table->count); + ASSERT_NE(nullptr, table->entries); +} + +TEST_P(GetTargetOpcodeTableGetTest, InvalidPointerTable) { + ASSERT_EQ(SPV_ERROR_INVALID_POINTER, spvOpcodeTableGet(nullptr, GetParam())); +} + +INSTANTIATE_TEST_CASE_P(OpcodeTableGet, GetTargetOpcodeTableGetTest, + ValuesIn(spvtest::AllTargetEnvironments())); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/operand-class-test-coverage.csv b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand-class-test-coverage.csv new file mode 100644 index 00000000000..116fdfeee1e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand-class-test-coverage.csv @@ -0,0 +1,43 @@ +Operand class,Example instruction,Notes,example unit test,negative-enum coverage location +" OperandNone,",UNUSED,not in grammar,,not enum +" OperandId,",many,ID,too many to count,not enum +" OperandOptionalId,","Source, Variable",OPTIONAL_ID,OpSourceAcceptsOptionalFileId,not enum +" OperandOptionalImage,",ImageFetch,,ImageOperandsTest,"TEST_F(ImageOperandsTest, WrongOperand)" +" OperandVariableIds,",ExtInst,,,not enum +" OperandOptionalLiteral,",ExecutionMode,,AnyExecutionMode,not enum +" OperandOptionalLiteralString,",Source,,OpSourceAcceptsOptionalSourceText,not enum +" OperandVariableLiterals,",Decorate,,OpDecorateSimpleTest,not enum +" OperandVariableIdLiteral,",GroupMemberDecorate,,GroupMemberDecorate*,not enum +" OperandVariableLiteralId,",Switch,,Switch*,not enum +" OperandLiteralNumber,","Source, Switch, ...",,Switch*,not enum +" OperandLiteralString,",SourceContinued,,OpSourceContinued,not enum +" OperandSource,",Source,,OpSource,not enum +" OperandExecutionModel,",EntryPoint,,OpEntryPointTest,"TEST_F(OpEntryPointTest, WrongModel)" +" OperandAddressing,",OpMemoryModel,,OpMemoryModelTest,"TEST_F(OpMemoryModelTest, WrongModel)" +" OperandMemory,",OpMemoryModel,,OpMemoryModelTest,"TEST_F(OpMemoryModelTest, WrongModel)" +" OperandExecutionMode,",OpExecutionMode,,OpExecutionModeTest,"TEST_F(OpExecutionModeTest, WrongMode)" +" OperandStorage,","TypePointer, TypeForwardPointer, Variable",,StorageClassTest,"TEST_F(OpTypeForwardPointerTest, WrongClass)" +" OperandDimensionality,",TypeImage,,DimTest/AnyDim,"TEST_F(DimTest, WrongDim)" +" OperandSamplerAddressingMode,",ConstantSampler,,SamplerAddressingModeTest,"TEST_F(SamplerAddressingModeTest, WrongMode)" +" OperandSamplerFilterMode,",ConstantSampler,,AnySamplerFilterMode,"TEST_F(SamplerFilterModeTest, WrongMode)" +" OperandSamplerImageFormat,",TypeImage,SAMPLER_IMAGE_FORMAT,ImageFormatTest,"TEST_F(ImageFormatTest, WrongFormat)" +" OperandImageChannelOrder,",UNUSED,returned as result value only,, +" OperandImageChannelDataType,",UNUSED,returned as result value only,, +" OperandImageOperands,",UNUSED,used to make a spec section,,see OperandOptionalImage +" OperandFPFastMath,",OpDecorate,,CombinedFPFastMathMask,"TEST_F(OpDecorateEnumTest, WrongFPFastMathMode)" +" OperandFPRoundingMode,",OpDecorate,,,"TEST_F(OpDecorateEnumTest, WrongFPRoundingMode)" +" OperandLinkageType,",OpDecorate,,OpDecorateLinkageTest,"TEST_F(OpDecorateLinkageTest, WrongType)" +" OperandAccessQualifier,",OpTypePipe,,AnyAccessQualifier,"TEST_F(OpTypePipeTest, WrongAccessQualifier)" +" OperandFuncParamAttr,",OpDecorate,,TextToBinaryDecorateFuncParamAttr,"TEST_F(OpDecorateEnumTest, WrongFuncParamAttr)" +" OperandDecoration,",OpDecorate,,AnyAccessQualifier,"TEST_F(OpTypePipeTest, WrongAccessQualifier)" +" OperandBuiltIn,",OpDecorate,,TextToBinaryDecorateBultIn,"TEST_F(OpDecorateEnumTest, WrongBuiltIn)" +" OperandSelect,",SelectionMerge,,TextToBinarySelectionMerge,"TEST_F(OpSelectionMergeTest, WrongSelectionControl)" +" OperandLoop,",LoopMerge,,CombinedLoopControlMask,"TEST_F(OpLoopMergeTest, WrongLoopControl)" +" OperandFunction,",Function,,AnySingleFunctionControlMask,"TEST_F(OpFunctionControlTest, WrongFunctionControl)" +" OperandMemorySemantics,",OpMemoryBarrier,"it's an ID, not in grammar",OpMemoryBarrier*,not enum +" OperandMemoryAccess,",UNUSED,"should be on opstore, but hacked in opcode.cpp",,not enum +" OperandScope,",MemoryBarrier,"it's an ID, not in grammar",OpMemoryBarrier*,not enum +" OperandGroupOperation,",GroupIAdd,,GroupOperationTest,"TEST_F(GroupOperationTest, WrongGroupOperation)" +" OperandKernelEnqueueFlags,",OpEnqueueKernel,"it's an ID, not in grammar",should not have one,not enum +" OperandKernelProfilingInfo,",OpCaptureEventProfilingInfo,"it's an ID, not in grammar",should not have one,not enum +" OperandCapability,",Capability,,OpCapabilityTest,"TEST_F(TextToBinaryCapability, BadInvalidCapability)" diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_capabilities_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_capabilities_test.cpp new file mode 100644 index 00000000000..0aeb505f0c3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_capabilities_test.cpp @@ -0,0 +1,732 @@ +// Copyright (c) 2015-2016 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. + +// Test capability dependencies for enums. + +#include +#include + +#include "gmock/gmock.h" +#include "source/enum_set.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::ElementsIn; +using ::testing::Combine; +using ::testing::Eq; +using ::testing::TestWithParam; +using ::testing::Values; +using ::testing::ValuesIn; + +// A test case for mapping an enum to a capability mask. +struct EnumCapabilityCase { + spv_operand_type_t type; + uint32_t value; + CapabilitySet expected_capabilities; +}; + +// Test fixture for testing EnumCapabilityCases. +using EnumCapabilityTest = + TestWithParam>; + +TEST_P(EnumCapabilityTest, Sample) { + const auto env = std::get<0>(GetParam()); + const auto context = spvContextCreate(env); + const AssemblyGrammar grammar(context); + spv_operand_desc entry; + + ASSERT_EQ(SPV_SUCCESS, + grammar.lookupOperand(std::get<1>(GetParam()).type, + std::get<1>(GetParam()).value, &entry)); + const auto cap_set = grammar.filterCapsAgainstTargetEnv( + entry->capabilities, entry->numCapabilities); + + EXPECT_THAT(ElementsIn(cap_set), + Eq(ElementsIn(std::get<1>(GetParam()).expected_capabilities))) + << " capability value " << std::get<1>(GetParam()).value; + spvContextDestroy(context); +} + +#define CASE0(TYPE, VALUE) \ + { \ + SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), {} \ + } +#define CASE1(TYPE, VALUE, CAP) \ + { \ + SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), CapabilitySet { \ + SpvCapability##CAP \ + } \ + } +#define CASE2(TYPE, VALUE, CAP1, CAP2) \ + { \ + SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), CapabilitySet { \ + SpvCapability##CAP1, SpvCapability##CAP2 \ + } \ + } +#define CASE3(TYPE, VALUE, CAP1, CAP2, CAP3) \ + { \ + SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), CapabilitySet { \ + SpvCapability##CAP1, SpvCapability##CAP2, SpvCapability##CAP3 \ + } \ + } +#define CASE5(TYPE, VALUE, CAP1, CAP2, CAP3, CAP4, CAP5) \ + { \ + SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), CapabilitySet { \ + SpvCapability##CAP1, SpvCapability##CAP2, SpvCapability##CAP3, \ + SpvCapability##CAP4, SpvCapability##CAP5 \ + } \ + } + +// See SPIR-V Section 3.3 Execution Model +INSTANTIATE_TEST_CASE_P( + ExecutionModel, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(EXECUTION_MODEL, ExecutionModelVertex, Shader), + CASE1(EXECUTION_MODEL, ExecutionModelTessellationControl, + Tessellation), + CASE1(EXECUTION_MODEL, ExecutionModelTessellationEvaluation, + Tessellation), + CASE1(EXECUTION_MODEL, ExecutionModelGeometry, Geometry), + CASE1(EXECUTION_MODEL, ExecutionModelFragment, Shader), + CASE1(EXECUTION_MODEL, ExecutionModelGLCompute, Shader), + CASE1(EXECUTION_MODEL, ExecutionModelKernel, Kernel), + })), ); + +// See SPIR-V Section 3.4 Addressing Model +INSTANTIATE_TEST_CASE_P( + AddressingModel, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(ADDRESSING_MODEL, AddressingModelLogical), + CASE1(ADDRESSING_MODEL, AddressingModelPhysical32, Addresses), + CASE1(ADDRESSING_MODEL, AddressingModelPhysical64, Addresses), + })), ); + +// See SPIR-V Section 3.5 Memory Model +INSTANTIATE_TEST_CASE_P( + MemoryModel, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(MEMORY_MODEL, MemoryModelSimple, Shader), + CASE1(MEMORY_MODEL, MemoryModelGLSL450, Shader), + CASE1(MEMORY_MODEL, MemoryModelOpenCL, Kernel), + })), ); + +// See SPIR-V Section 3.6 Execution Mode +INSTANTIATE_TEST_CASE_P( + ExecutionMode, EnumCapabilityTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(EXECUTION_MODE, ExecutionModeInvocations, Geometry), + CASE1(EXECUTION_MODE, ExecutionModeSpacingEqual, Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeSpacingFractionalEven, + Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeSpacingFractionalOdd, + Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeVertexOrderCw, Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeVertexOrderCcw, Tessellation), + CASE1(EXECUTION_MODE, ExecutionModePixelCenterInteger, Shader), + CASE1(EXECUTION_MODE, ExecutionModeOriginUpperLeft, Shader), + CASE1(EXECUTION_MODE, ExecutionModeOriginLowerLeft, Shader), + CASE1(EXECUTION_MODE, ExecutionModeEarlyFragmentTests, Shader), + CASE1(EXECUTION_MODE, ExecutionModePointMode, Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeXfb, TransformFeedback), + CASE1(EXECUTION_MODE, ExecutionModeDepthReplacing, Shader), + CASE1(EXECUTION_MODE, ExecutionModeDepthGreater, Shader), + CASE1(EXECUTION_MODE, ExecutionModeDepthLess, Shader), + CASE1(EXECUTION_MODE, ExecutionModeDepthUnchanged, Shader), + CASE0(EXECUTION_MODE, ExecutionModeLocalSize), + CASE1(EXECUTION_MODE, ExecutionModeLocalSizeHint, Kernel), + CASE1(EXECUTION_MODE, ExecutionModeInputPoints, Geometry), + CASE1(EXECUTION_MODE, ExecutionModeInputLines, Geometry), + CASE1(EXECUTION_MODE, ExecutionModeInputLinesAdjacency, Geometry), + CASE2(EXECUTION_MODE, ExecutionModeTriangles, Geometry, + Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeInputTrianglesAdjacency, + Geometry), + CASE1(EXECUTION_MODE, ExecutionModeQuads, Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeIsolines, Tessellation), + CASE2(EXECUTION_MODE, ExecutionModeOutputVertices, Geometry, + Tessellation), + CASE1(EXECUTION_MODE, ExecutionModeOutputPoints, Geometry), + CASE1(EXECUTION_MODE, ExecutionModeOutputLineStrip, Geometry), + CASE1(EXECUTION_MODE, ExecutionModeOutputTriangleStrip, Geometry), + CASE1(EXECUTION_MODE, ExecutionModeVecTypeHint, Kernel), + CASE1(EXECUTION_MODE, ExecutionModeContractionOff, Kernel), + })), ); + +INSTANTIATE_TEST_CASE_P( + ExecutionModeV11, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(EXECUTION_MODE, ExecutionModeInitializer, Kernel), + CASE1(EXECUTION_MODE, ExecutionModeFinalizer, Kernel), + CASE1(EXECUTION_MODE, ExecutionModeSubgroupSize, + SubgroupDispatch), + CASE1(EXECUTION_MODE, ExecutionModeSubgroupsPerWorkgroup, + SubgroupDispatch)})), ); + +// See SPIR-V Section 3.7 Storage Class +INSTANTIATE_TEST_CASE_P( + StorageClass, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(STORAGE_CLASS, StorageClassUniformConstant), + CASE1(STORAGE_CLASS, StorageClassUniform, Shader), + CASE1(STORAGE_CLASS, StorageClassOutput, Shader), + CASE0(STORAGE_CLASS, StorageClassWorkgroup), + CASE0(STORAGE_CLASS, StorageClassCrossWorkgroup), + CASE1(STORAGE_CLASS, StorageClassPrivate, Shader), + CASE0(STORAGE_CLASS, StorageClassFunction), + CASE1(STORAGE_CLASS, StorageClassGeneric, + GenericPointer), // Bug 14287 + CASE1(STORAGE_CLASS, StorageClassPushConstant, Shader), + CASE1(STORAGE_CLASS, StorageClassAtomicCounter, AtomicStorage), + CASE0(STORAGE_CLASS, StorageClassImage), + })), ); + +// See SPIR-V Section 3.8 Dim +INSTANTIATE_TEST_CASE_P( + Dim, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(DIMENSIONALITY, Dim1D, Sampled1D), + CASE0(DIMENSIONALITY, Dim2D), + CASE0(DIMENSIONALITY, Dim3D), + CASE1(DIMENSIONALITY, DimCube, Shader), + CASE1(DIMENSIONALITY, DimRect, SampledRect), + CASE1(DIMENSIONALITY, DimBuffer, SampledBuffer), + CASE1(DIMENSIONALITY, DimSubpassData, InputAttachment), + })), ); + +// See SPIR-V Section 3.9 Sampler Addressing Mode +INSTANTIATE_TEST_CASE_P( + SamplerAddressingMode, EnumCapabilityTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeNone, Kernel), + CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeClampToEdge, + Kernel), + CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeClamp, Kernel), + CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeRepeat, Kernel), + CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeRepeatMirrored, + Kernel), + })), ); + +// See SPIR-V Section 3.10 Sampler Filter Mode +INSTANTIATE_TEST_CASE_P( + SamplerFilterMode, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(SAMPLER_FILTER_MODE, SamplerFilterModeNearest, Kernel), + CASE1(SAMPLER_FILTER_MODE, SamplerFilterModeLinear, Kernel), + })), ); + +// See SPIR-V Section 3.11 Image Format +INSTANTIATE_TEST_CASE_P( + ImageFormat, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + // clang-format off + CASE0(SAMPLER_IMAGE_FORMAT, ImageFormatUnknown), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba32f, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba16f, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR32f, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba8, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba8Snorm, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg32f, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg16f, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR11fG11fB10f, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16f, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba16, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgb10A2, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg16, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg8, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR8, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba16Snorm, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg16Snorm, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg8Snorm, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16Snorm, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR8Snorm, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba32i, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba16i, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba8i, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR32i, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg32i, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg16i, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg8i, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16i, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR8i, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba32ui, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba16ui, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba8ui, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgba8ui, Shader), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRgb10a2ui, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg32ui, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg16ui, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatRg8ui, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16ui, StorageImageExtendedFormats), + CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR8ui, StorageImageExtendedFormats), + // clang-format on + })), ); + +// See SPIR-V Section 3.12 Image Channel Order +INSTANTIATE_TEST_CASE_P( + ImageChannelOrder, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderR, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderA, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRG, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRA, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRGB, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRGBA, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderBGRA, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderARGB, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderIntensity, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderLuminance, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRx, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRGx, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderRGBx, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderDepth, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderDepthStencil, + Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersRGB, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersRGBx, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersRGBA, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersBGRA, Kernel), + CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderABGR, Kernel), + })), ); + +// See SPIR-V Section 3.13 Image Channel Data Type +INSTANTIATE_TEST_CASE_P( + ImageChannelDataType, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + // clang-format off + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeSnormInt8, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeSnormInt16, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt8, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt16, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormShort565, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormShort555, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt101010, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeSignedInt8, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeSignedInt16, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeSignedInt32, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnsignedInt8, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnsignedInt16, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnsignedInt32, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeHalfFloat, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeFloat, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt24, Kernel), + CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt101010_2, Kernel), + // clang-format on + })), ); + +// See SPIR-V Section 3.14 Image Operands +INSTANTIATE_TEST_CASE_P( + ImageOperands, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + // clang-format off + CASE0(OPTIONAL_IMAGE, ImageOperandsMaskNone), + CASE1(OPTIONAL_IMAGE, ImageOperandsBiasMask, Shader), + CASE0(OPTIONAL_IMAGE, ImageOperandsLodMask), + CASE0(OPTIONAL_IMAGE, ImageOperandsGradMask), + CASE0(OPTIONAL_IMAGE, ImageOperandsConstOffsetMask), + CASE1(OPTIONAL_IMAGE, ImageOperandsOffsetMask, ImageGatherExtended), + CASE1(OPTIONAL_IMAGE, ImageOperandsConstOffsetsMask, ImageGatherExtended), + CASE0(OPTIONAL_IMAGE, ImageOperandsSampleMask), + CASE1(OPTIONAL_IMAGE, ImageOperandsMinLodMask, MinLod), + // clang-format on + })), ); + +// See SPIR-V Section 3.15 FP Fast Math Mode +INSTANTIATE_TEST_CASE_P( + FPFastMathMode, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(FP_FAST_MATH_MODE, FPFastMathModeMaskNone), + CASE1(FP_FAST_MATH_MODE, FPFastMathModeNotNaNMask, Kernel), + CASE1(FP_FAST_MATH_MODE, FPFastMathModeNotInfMask, Kernel), + CASE1(FP_FAST_MATH_MODE, FPFastMathModeNSZMask, Kernel), + CASE1(FP_FAST_MATH_MODE, FPFastMathModeAllowRecipMask, Kernel), + CASE1(FP_FAST_MATH_MODE, FPFastMathModeFastMask, Kernel), + })), ); + +// See SPIR-V Section 3.17 Linkage Type +INSTANTIATE_TEST_CASE_P( + LinkageType, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(LINKAGE_TYPE, LinkageTypeExport, Linkage), + CASE1(LINKAGE_TYPE, LinkageTypeImport, Linkage), + })), ); + +// See SPIR-V Section 3.18 Access Qualifier +INSTANTIATE_TEST_CASE_P( + AccessQualifier, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(ACCESS_QUALIFIER, AccessQualifierReadOnly, Kernel), + CASE1(ACCESS_QUALIFIER, AccessQualifierWriteOnly, Kernel), + CASE1(ACCESS_QUALIFIER, AccessQualifierReadWrite, Kernel), + })), ); + +// See SPIR-V Section 3.19 Function Parameter Attribute +INSTANTIATE_TEST_CASE_P( + FunctionParameterAttribute, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + // clang-format off + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeZext, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeSext, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeByVal, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeSret, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeNoAlias, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeNoCapture, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeNoWrite, Kernel), + CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeNoReadWrite, Kernel), + // clang-format on + })), ); + +// See SPIR-V Section 3.20 Decoration +INSTANTIATE_TEST_CASE_P( + Decoration, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(DECORATION, DecorationRelaxedPrecision, Shader), + // DecorationSpecId handled below. + CASE1(DECORATION, DecorationBlock, Shader), + CASE1(DECORATION, DecorationBufferBlock, Shader), + CASE1(DECORATION, DecorationRowMajor, Matrix), + CASE1(DECORATION, DecorationColMajor, Matrix), + CASE1(DECORATION, DecorationArrayStride, Shader), + CASE1(DECORATION, DecorationMatrixStride, Matrix), // Bug 15234 + CASE1(DECORATION, DecorationGLSLShared, Shader), + CASE1(DECORATION, DecorationGLSLPacked, Shader), + CASE1(DECORATION, DecorationCPacked, Kernel), + CASE0(DECORATION, DecorationBuiltIn), // Bug 15248 + // Value 12 placeholder + CASE1(DECORATION, DecorationNoPerspective, Shader), + CASE1(DECORATION, DecorationFlat, Shader), + CASE1(DECORATION, DecorationPatch, Tessellation), + CASE1(DECORATION, DecorationCentroid, Shader), + CASE1(DECORATION, DecorationSample, + SampleRateShading), // Bug 15234 + CASE1(DECORATION, DecorationInvariant, Shader), + CASE0(DECORATION, DecorationRestrict), + CASE0(DECORATION, DecorationAliased), + CASE0(DECORATION, DecorationVolatile), + CASE1(DECORATION, DecorationConstant, Kernel), + CASE0(DECORATION, DecorationCoherent), + CASE0(DECORATION, DecorationNonWritable), + CASE0(DECORATION, DecorationNonReadable), + CASE1(DECORATION, DecorationUniform, Shader), + // Value 27 is an intentional gap in the spec numbering. + CASE1(DECORATION, DecorationSaturatedConversion, Kernel), + CASE1(DECORATION, DecorationStream, GeometryStreams), + CASE1(DECORATION, DecorationLocation, Shader), + CASE1(DECORATION, DecorationComponent, Shader), + CASE1(DECORATION, DecorationIndex, Shader), + CASE1(DECORATION, DecorationBinding, Shader), + CASE1(DECORATION, DecorationDescriptorSet, Shader), + CASE1(DECORATION, DecorationOffset, Shader), // Bug 15268 + CASE1(DECORATION, DecorationXfbBuffer, TransformFeedback), + CASE1(DECORATION, DecorationXfbStride, TransformFeedback), + CASE1(DECORATION, DecorationFuncParamAttr, Kernel), + CASE1(DECORATION, DecorationFPFastMathMode, Kernel), + CASE1(DECORATION, DecorationLinkageAttributes, Linkage), + CASE1(DECORATION, DecorationNoContraction, Shader), + CASE1(DECORATION, DecorationInputAttachmentIndex, + InputAttachment), + CASE1(DECORATION, DecorationAlignment, Kernel), + })), ); + +#if 0 +// SpecId has different requirements in v1.0 and v1.1: +INSTANTIATE_TEST_CASE_P(DecorationSpecIdV10, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0), + ValuesIn(std::vector{CASE1( + DECORATION, DecorationSpecId, Shader)})), ); +#endif + +INSTANTIATE_TEST_CASE_P( + DecorationV11, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE2(DECORATION, DecorationSpecId, Shader, Kernel), + CASE1(DECORATION, DecorationMaxByteOffset, Addresses)})), ); + +// See SPIR-V Section 3.21 BuiltIn +INSTANTIATE_TEST_CASE_P( + BuiltIn, EnumCapabilityTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + // clang-format off + CASE1(BUILT_IN, BuiltInPosition, Shader), + CASE1(BUILT_IN, BuiltInPointSize, Shader), + // 2 is an intentional gap in the spec numbering. + CASE1(BUILT_IN, BuiltInClipDistance, ClipDistance), // Bug 1407, 15234 + CASE1(BUILT_IN, BuiltInCullDistance, CullDistance), // Bug 1407, 15234 + CASE1(BUILT_IN, BuiltInVertexId, Shader), + CASE1(BUILT_IN, BuiltInInstanceId, Shader), + CASE2(BUILT_IN, BuiltInPrimitiveId, Geometry, Tessellation), + CASE2(BUILT_IN, BuiltInInvocationId, Geometry, Tessellation), + CASE1(BUILT_IN, BuiltInLayer, Geometry), + CASE1(BUILT_IN, BuiltInViewportIndex, MultiViewport), // Bug 15234 + CASE1(BUILT_IN, BuiltInTessLevelOuter, Tessellation), + CASE1(BUILT_IN, BuiltInTessLevelInner, Tessellation), + CASE1(BUILT_IN, BuiltInTessCoord, Tessellation), + CASE1(BUILT_IN, BuiltInPatchVertices, Tessellation), + CASE1(BUILT_IN, BuiltInFragCoord, Shader), + CASE1(BUILT_IN, BuiltInPointCoord, Shader), + CASE1(BUILT_IN, BuiltInFrontFacing, Shader), + CASE1(BUILT_IN, BuiltInSampleId, SampleRateShading), // Bug 15234 + CASE1(BUILT_IN, BuiltInSamplePosition, SampleRateShading), // Bug 15234 + CASE1(BUILT_IN, BuiltInSampleMask, Shader), // Bug 15234, Issue 182 + // Value 21 intentionally missing + CASE1(BUILT_IN, BuiltInFragDepth, Shader), + CASE1(BUILT_IN, BuiltInHelperInvocation, Shader), + CASE0(BUILT_IN, BuiltInNumWorkgroups), + CASE0(BUILT_IN, BuiltInWorkgroupSize), + CASE0(BUILT_IN, BuiltInWorkgroupId), + CASE0(BUILT_IN, BuiltInLocalInvocationId), + CASE0(BUILT_IN, BuiltInGlobalInvocationId), + CASE0(BUILT_IN, BuiltInLocalInvocationIndex), + CASE1(BUILT_IN, BuiltInWorkDim, Kernel), + CASE1(BUILT_IN, BuiltInGlobalSize, Kernel), + CASE1(BUILT_IN, BuiltInEnqueuedWorkgroupSize, Kernel), + CASE1(BUILT_IN, BuiltInGlobalOffset, Kernel), + CASE1(BUILT_IN, BuiltInGlobalLinearId, Kernel), + // Value 35 intentionally missing + CASE2(BUILT_IN, BuiltInSubgroupSize, Kernel, SubgroupBallotKHR), + CASE1(BUILT_IN, BuiltInSubgroupMaxSize, Kernel), + CASE1(BUILT_IN, BuiltInNumSubgroups, Kernel), + CASE1(BUILT_IN, BuiltInNumEnqueuedSubgroups, Kernel), + CASE1(BUILT_IN, BuiltInSubgroupId, Kernel), + CASE2(BUILT_IN, BuiltInSubgroupLocalInvocationId, Kernel, SubgroupBallotKHR), + CASE1(BUILT_IN, BuiltInVertexIndex, Shader), + CASE1(BUILT_IN, BuiltInInstanceIndex, Shader), + // clang-format on + })), ); + +// See SPIR-V Section 3.22 Selection Control +INSTANTIATE_TEST_CASE_P( + SelectionControl, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(SELECTION_CONTROL, SelectionControlMaskNone), + CASE0(SELECTION_CONTROL, SelectionControlFlattenMask), + CASE0(SELECTION_CONTROL, SelectionControlDontFlattenMask), + })), ); + +// See SPIR-V Section 3.23 Loop Control +INSTANTIATE_TEST_CASE_P( + LoopControl, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(LOOP_CONTROL, LoopControlMaskNone), + CASE0(LOOP_CONTROL, LoopControlUnrollMask), + CASE0(LOOP_CONTROL, LoopControlDontUnrollMask), + })), ); + +INSTANTIATE_TEST_CASE_P( + LoopControlV11, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(LOOP_CONTROL, LoopControlDependencyInfiniteMask), + CASE0(LOOP_CONTROL, LoopControlDependencyLengthMask), + })), ); + +// See SPIR-V Section 3.24 Function Control +INSTANTIATE_TEST_CASE_P( + FunctionControl, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(FUNCTION_CONTROL, FunctionControlMaskNone), + CASE0(FUNCTION_CONTROL, FunctionControlInlineMask), + CASE0(FUNCTION_CONTROL, FunctionControlDontInlineMask), + CASE0(FUNCTION_CONTROL, FunctionControlPureMask), + CASE0(FUNCTION_CONTROL, FunctionControlConstMask), + })), ); + +// See SPIR-V Section 3.25 Memory Semantics +INSTANTIATE_TEST_CASE_P( + MemorySemantics, EnumCapabilityTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsMaskNone), + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsAcquireMask), + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsReleaseMask), + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsAcquireReleaseMask), + CASE0(MEMORY_SEMANTICS_ID, + MemorySemanticsSequentiallyConsistentMask), + CASE1(MEMORY_SEMANTICS_ID, MemorySemanticsUniformMemoryMask, + Shader), + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsSubgroupMemoryMask), + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsWorkgroupMemoryMask), + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsCrossWorkgroupMemoryMask), + CASE1(MEMORY_SEMANTICS_ID, MemorySemanticsAtomicCounterMemoryMask, + AtomicStorage), // Bug 15234 + CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsImageMemoryMask), + })), ); + +// See SPIR-V Section 3.26 Memory Access +INSTANTIATE_TEST_CASE_P( + MemoryAccess, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessMaskNone), + CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessVolatileMask), + CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessAlignedMask), + CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessNontemporalMask), + })), ); + +// See SPIR-V Section 3.27 Scope +INSTANTIATE_TEST_CASE_P(Scope, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, + SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(SCOPE_ID, ScopeCrossDevice), + CASE0(SCOPE_ID, ScopeDevice), + CASE0(SCOPE_ID, ScopeWorkgroup), + CASE0(SCOPE_ID, ScopeSubgroup), + CASE0(SCOPE_ID, ScopeInvocation), + })), ); + +// See SPIR-V Section 3.28 Group Operation +INSTANTIATE_TEST_CASE_P( + GroupOperation, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE3(GROUP_OPERATION, GroupOperationReduce, Kernel, + GroupNonUniformArithmetic, GroupNonUniformBallot), + CASE3(GROUP_OPERATION, GroupOperationInclusiveScan, Kernel, + GroupNonUniformArithmetic, GroupNonUniformBallot), + CASE3(GROUP_OPERATION, GroupOperationExclusiveScan, Kernel, + GroupNonUniformArithmetic, GroupNonUniformBallot), + })), ); + +// See SPIR-V Section 3.29 Kernel Enqueue Flags +INSTANTIATE_TEST_CASE_P( + KernelEnqueueFlags, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsNoWait, Kernel), + CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsWaitKernel, Kernel), + CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsWaitWorkGroup, + Kernel), + })), ); + +// See SPIR-V Section 3.30 Kernel Profiling Info +INSTANTIATE_TEST_CASE_P( + KernelProfilingInfo, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE0(KERNEL_PROFILING_INFO, KernelProfilingInfoMaskNone), + CASE1(KERNEL_PROFILING_INFO, KernelProfilingInfoCmdExecTimeMask, + Kernel), + })), ); + +// See SPIR-V Section 3.31 Capability +INSTANTIATE_TEST_CASE_P( + CapabilityDependsOn, EnumCapabilityTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + // clang-format off + CASE0(CAPABILITY, CapabilityMatrix), + CASE1(CAPABILITY, CapabilityShader, Matrix), + CASE1(CAPABILITY, CapabilityGeometry, Shader), + CASE1(CAPABILITY, CapabilityTessellation, Shader), + CASE0(CAPABILITY, CapabilityAddresses), + CASE0(CAPABILITY, CapabilityLinkage), + CASE0(CAPABILITY, CapabilityKernel), + CASE1(CAPABILITY, CapabilityVector16, Kernel), + CASE1(CAPABILITY, CapabilityFloat16Buffer, Kernel), + CASE0(CAPABILITY, CapabilityFloat16), // Bug 15234 + CASE0(CAPABILITY, CapabilityFloat64), + CASE0(CAPABILITY, CapabilityInt64), + CASE1(CAPABILITY, CapabilityInt64Atomics, Int64), + CASE1(CAPABILITY, CapabilityImageBasic, Kernel), + CASE1(CAPABILITY, CapabilityImageReadWrite, ImageBasic), + CASE1(CAPABILITY, CapabilityImageMipmap, ImageBasic), + // Value 16 intentionally missing. + CASE1(CAPABILITY, CapabilityPipes, Kernel), + CASE0(CAPABILITY, CapabilityGroups), + CASE1(CAPABILITY, CapabilityDeviceEnqueue, Kernel), + CASE1(CAPABILITY, CapabilityLiteralSampler, Kernel), + CASE1(CAPABILITY, CapabilityAtomicStorage, Shader), + CASE0(CAPABILITY, CapabilityInt16), + CASE1(CAPABILITY, CapabilityTessellationPointSize, Tessellation), + CASE1(CAPABILITY, CapabilityGeometryPointSize, Geometry), + CASE1(CAPABILITY, CapabilityImageGatherExtended, Shader), + // Value 26 intentionally missing. + CASE1(CAPABILITY, CapabilityStorageImageMultisample, Shader), + CASE1(CAPABILITY, CapabilityUniformBufferArrayDynamicIndexing, Shader), + CASE1(CAPABILITY, CapabilitySampledImageArrayDynamicIndexing, Shader), + CASE1(CAPABILITY, CapabilityStorageBufferArrayDynamicIndexing, Shader), + CASE1(CAPABILITY, CapabilityStorageImageArrayDynamicIndexing, Shader), + CASE1(CAPABILITY, CapabilityClipDistance, Shader), + CASE1(CAPABILITY, CapabilityCullDistance, Shader), + CASE1(CAPABILITY, CapabilityImageCubeArray, SampledCubeArray), + CASE1(CAPABILITY, CapabilitySampleRateShading, Shader), + CASE1(CAPABILITY, CapabilityImageRect, SampledRect), + CASE1(CAPABILITY, CapabilitySampledRect, Shader), + CASE1(CAPABILITY, CapabilityGenericPointer, Addresses), + CASE0(CAPABILITY, CapabilityInt8), + CASE1(CAPABILITY, CapabilityInputAttachment, Shader), + CASE1(CAPABILITY, CapabilitySparseResidency, Shader), + CASE1(CAPABILITY, CapabilityMinLod, Shader), + CASE1(CAPABILITY, CapabilityImage1D, Sampled1D), + CASE1(CAPABILITY, CapabilitySampledCubeArray, Shader), + CASE1(CAPABILITY, CapabilityImageBuffer, SampledBuffer), + CASE1(CAPABILITY, CapabilityImageMSArray, Shader), + CASE1(CAPABILITY, CapabilityStorageImageExtendedFormats, Shader), + CASE1(CAPABILITY, CapabilityImageQuery, Shader), + CASE1(CAPABILITY, CapabilityDerivativeControl, Shader), + CASE1(CAPABILITY, CapabilityInterpolationFunction, Shader), + CASE1(CAPABILITY, CapabilityTransformFeedback, Shader), + CASE1(CAPABILITY, CapabilityGeometryStreams, Geometry), + CASE1(CAPABILITY, CapabilityStorageImageReadWithoutFormat, Shader), + CASE1(CAPABILITY, CapabilityStorageImageWriteWithoutFormat, Shader), + CASE1(CAPABILITY, CapabilityMultiViewport, Geometry), + // clang-format on + })), ); + +INSTANTIATE_TEST_CASE_P( + CapabilityDependsOnV11, EnumCapabilityTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector{ + CASE1(CAPABILITY, CapabilitySubgroupDispatch, DeviceEnqueue), + CASE1(CAPABILITY, CapabilityNamedBarrier, Kernel), + CASE1(CAPABILITY, CapabilityPipeStorage, Pipes), + })), ); + +#undef CASE0 +#undef CASE1 +#undef CASE2 + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_pattern_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_pattern_test.cpp new file mode 100644 index 00000000000..b3e30249080 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_pattern_test.cpp @@ -0,0 +1,268 @@ +// Copyright (c) 2015-2016 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. + +#include + +#include "gmock/gmock.h" +#include "source/operand.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::testing::Eq; + +TEST(OperandPattern, InitiallyEmpty) { + spv_operand_pattern_t empty; + EXPECT_THAT(empty, Eq(spv_operand_pattern_t{})); + EXPECT_EQ(0u, empty.size()); + EXPECT_TRUE(empty.empty()); +} + +TEST(OperandPattern, PushBacksAreOnTheRight) { + spv_operand_pattern_t pattern; + + pattern.push_back(SPV_OPERAND_TYPE_ID); + EXPECT_THAT(pattern, Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_ID})); + EXPECT_EQ(1u, pattern.size()); + EXPECT_TRUE(!pattern.empty()); + EXPECT_EQ(SPV_OPERAND_TYPE_ID, pattern.back()); + + pattern.push_back(SPV_OPERAND_TYPE_NONE); + EXPECT_THAT(pattern, Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_ID, + SPV_OPERAND_TYPE_NONE})); + EXPECT_EQ(2u, pattern.size()); + EXPECT_TRUE(!pattern.empty()); + EXPECT_EQ(SPV_OPERAND_TYPE_NONE, pattern.back()); +} + +TEST(OperandPattern, PopBacksAreOnTheRight) { + spv_operand_pattern_t pattern{SPV_OPERAND_TYPE_ID, + SPV_OPERAND_TYPE_LITERAL_INTEGER}; + + pattern.pop_back(); + EXPECT_THAT(pattern, Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_ID})); + + pattern.pop_back(); + EXPECT_THAT(pattern, Eq(spv_operand_pattern_t{})); +} + +// A test case for typed mask expansion +struct MaskExpansionCase { + spv_operand_type_t type; + uint32_t mask; + spv_operand_pattern_t initial; + spv_operand_pattern_t expected; +}; + +using MaskExpansionTest = ::testing::TestWithParam; + +TEST_P(MaskExpansionTest, Sample) { + spv_operand_table operandTable = nullptr; + auto env = SPV_ENV_UNIVERSAL_1_0; + ASSERT_EQ(SPV_SUCCESS, spvOperandTableGet(&operandTable, env)); + + spv_operand_pattern_t pattern(GetParam().initial); + spvPushOperandTypesForMask(env, operandTable, GetParam().type, + GetParam().mask, &pattern); + EXPECT_THAT(pattern, Eq(GetParam().expected)); +} + +// These macros let us write non-trivial examples without too much text. +#define PREFIX0 SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE +#define PREFIX1 \ + SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE, \ + SPV_OPERAND_TYPE_ID +INSTANTIATE_TEST_CASE_P( + OperandPattern, MaskExpansionTest, + ::testing::ValuesIn(std::vector{ + // No bits means no change. + {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, 0, {PREFIX0}, {PREFIX0}}, + // Unknown bits means no change. + {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, + 0xfffffffc, + {PREFIX1}, + {PREFIX1}}, + // Volatile has no operands. + {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, + SpvMemoryAccessVolatileMask, + {PREFIX0}, + {PREFIX0}}, + // Aligned has one literal number operand. + {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, + SpvMemoryAccessAlignedMask, + {PREFIX1}, + {PREFIX1, SPV_OPERAND_TYPE_LITERAL_INTEGER}}, + // Volatile with Aligned still has just one literal number operand. + {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, + SpvMemoryAccessVolatileMask | SpvMemoryAccessAlignedMask, + {PREFIX1}, + {PREFIX1, SPV_OPERAND_TYPE_LITERAL_INTEGER}}, + }), ); +#undef PREFIX0 +#undef PREFIX1 + +// Returns a vector of all operand types that can be used in a pattern. +std::vector allOperandTypes() { + std::vector result; + for (int i = 0; i < SPV_OPERAND_TYPE_NUM_OPERAND_TYPES; i++) { + result.push_back(spv_operand_type_t(i)); + } + return result; +} + +using MatchableOperandExpansionTest = + ::testing::TestWithParam; + +TEST_P(MatchableOperandExpansionTest, MatchableOperandsDontExpand) { + const spv_operand_type_t type = GetParam(); + if (!spvOperandIsVariable(type)) { + spv_operand_pattern_t pattern; + const bool did_expand = spvExpandOperandSequenceOnce(type, &pattern); + EXPECT_FALSE(did_expand); + EXPECT_THAT(pattern, Eq(spv_operand_pattern_t{})); + } +} + +INSTANTIATE_TEST_CASE_P(MatchableOperandExpansion, + MatchableOperandExpansionTest, + ::testing::ValuesIn(allOperandTypes()), ); + +using VariableOperandExpansionTest = + ::testing::TestWithParam; + +TEST_P(VariableOperandExpansionTest, NonMatchableOperandsExpand) { + const spv_operand_type_t type = GetParam(); + if (spvOperandIsVariable(type)) { + spv_operand_pattern_t pattern; + const bool did_expand = spvExpandOperandSequenceOnce(type, &pattern); + EXPECT_TRUE(did_expand); + EXPECT_FALSE(pattern.empty()); + // For the existing rules, the first expansion of a zero-or-more operand + // type yields a matchable operand type. This isn't strictly necessary. + EXPECT_FALSE(spvOperandIsVariable(pattern.back())); + } +} + +INSTANTIATE_TEST_CASE_P(NonMatchableOperandExpansion, + VariableOperandExpansionTest, + ::testing::ValuesIn(allOperandTypes()), ); + +TEST(AlternatePatternFollowingImmediate, Empty) { + EXPECT_THAT(spvAlternatePatternFollowingImmediate({}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); +} + +TEST(AlternatePatternFollowingImmediate, SingleElement) { + // Spot-check a random selection of types. + EXPECT_THAT(spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT( + spvAlternatePatternFollowingImmediate({SPV_OPERAND_TYPE_CAPABILITY}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT( + spvAlternatePatternFollowingImmediate({SPV_OPERAND_TYPE_LOOP_CONTROL}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT(spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT(spvAlternatePatternFollowingImmediate({SPV_OPERAND_TYPE_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); +} + +TEST(AlternatePatternFollowingImmediate, SingleResultId) { + EXPECT_THAT( + spvAlternatePatternFollowingImmediate({SPV_OPERAND_TYPE_RESULT_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_RESULT_ID})); +} + +TEST(AlternatePatternFollowingImmediate, MultipleNonResultIds) { + EXPECT_THAT( + spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER, + SPV_OPERAND_TYPE_CAPABILITY, SPV_OPERAND_TYPE_LOOP_CONTROL, + SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER, SPV_OPERAND_TYPE_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV})); +} + +TEST(AlternatePatternFollowingImmediate, ResultIdFront) { + EXPECT_THAT(spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT( + spvAlternatePatternFollowingImmediate({SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_FP_ROUNDING_MODE, + SPV_OPERAND_TYPE_ID}), + Eq(spv_operand_pattern_t{ + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT( + spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_DIMENSIONALITY, + SPV_OPERAND_TYPE_LINKAGE_TYPE, + SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, + SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_ID, + SPV_OPERAND_TYPE_VARIABLE_ID}), + Eq(spv_operand_pattern_t{ + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_OPTIONAL_CIV})); +} + +TEST(AlternatePatternFollowingImmediate, ResultIdMiddle) { + EXPECT_THAT(spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, + SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_OPTIONAL_CIV})); + EXPECT_THAT( + spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_DIMENSIONALITY, SPV_OPERAND_TYPE_LINKAGE_TYPE, + SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, + SPV_OPERAND_TYPE_RESULT_ID, SPV_OPERAND_TYPE_FP_ROUNDING_MODE, + SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_VARIABLE_ID}), + Eq(spv_operand_pattern_t{ + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_RESULT_ID, + SPV_OPERAND_TYPE_OPTIONAL_CIV, SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_OPTIONAL_CIV})); +} + +TEST(AlternatePatternFollowingImmediate, ResultIdBack) { + EXPECT_THAT(spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_RESULT_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_RESULT_ID})); + EXPECT_THAT(spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_ID, + SPV_OPERAND_TYPE_RESULT_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_RESULT_ID})); + EXPECT_THAT( + spvAlternatePatternFollowingImmediate( + {SPV_OPERAND_TYPE_DIMENSIONALITY, SPV_OPERAND_TYPE_LINKAGE_TYPE, + SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, + SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_ID, + SPV_OPERAND_TYPE_VARIABLE_ID, SPV_OPERAND_TYPE_RESULT_ID}), + Eq(spv_operand_pattern_t{SPV_OPERAND_TYPE_OPTIONAL_CIV, + SPV_OPERAND_TYPE_RESULT_ID})); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_test.cpp new file mode 100644 index 00000000000..08522c323ef --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/operand_test.cpp @@ -0,0 +1,75 @@ +// Copyright (c) 2015-2016 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. + +#include + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using GetTargetTest = ::testing::TestWithParam; +using ::testing::ValuesIn; + +TEST_P(GetTargetTest, Default) { + spv_operand_table table; + ASSERT_EQ(SPV_SUCCESS, spvOperandTableGet(&table, GetParam())); + ASSERT_NE(0u, table->count); + ASSERT_NE(nullptr, table->types); +} + +TEST_P(GetTargetTest, InvalidPointerTable) { + ASSERT_EQ(SPV_ERROR_INVALID_POINTER, spvOperandTableGet(nullptr, GetParam())); +} + +INSTANTIATE_TEST_CASE_P(OperandTableGet, GetTargetTest, + ValuesIn(std::vector{ + SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0}), ); + +TEST(OperandString, AllAreDefinedExceptVariable) { + // None has no string, so don't test it. + EXPECT_EQ(0u, SPV_OPERAND_TYPE_NONE); + // Start testing at enum with value 1, skipping None. + for (int i = 1; i < int(SPV_OPERAND_TYPE_FIRST_VARIABLE_TYPE); i++) { + EXPECT_NE(nullptr, spvOperandTypeStr(static_cast(i))) + << " Operand type " << i; + } +} + +TEST(OperandIsConcreteMask, Sample) { + // Check a few operand types preceding the concrete mask types. + EXPECT_FALSE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_NONE)); + EXPECT_FALSE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_ID)); + EXPECT_FALSE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_LITERAL_INTEGER)); + EXPECT_FALSE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_CAPABILITY)); + + // Check all the concrete mask operand types. + EXPECT_TRUE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_IMAGE)); + EXPECT_TRUE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_FP_FAST_MATH_MODE)); + EXPECT_TRUE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_SELECTION_CONTROL)); + EXPECT_TRUE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_LOOP_CONTROL)); + EXPECT_TRUE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_FUNCTION_CONTROL)); + EXPECT_TRUE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_MEMORY_ACCESS)); + + // Check a few operand types after the concrete mask types, including the + // optional forms for Image and MemoryAccess. + EXPECT_FALSE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_OPTIONAL_ID)); + EXPECT_FALSE(spvOperandIsConcreteMask(SPV_OPERAND_TYPE_OPTIONAL_IMAGE)); + EXPECT_FALSE( + spvOperandIsConcreteMask(SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS)); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/CMakeLists.txt new file mode 100644 index 00000000000..f2741f67351 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/CMakeLists.txt @@ -0,0 +1,339 @@ +# Copyright (c) 2016 Google 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. + +add_subdirectory(dominator_tree) +add_subdirectory(loop_optimizations) + +add_spvtools_unittest(TARGET instruction + SRCS instruction_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET instruction_list + SRCS instruction_list_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET ir_loader + SRCS ir_loader_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_manager + SRCS module_utils.h + pass_manager_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET optimizer + SRCS optimizer_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_strip_debug_info + SRCS strip_debug_info_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_strip_reflect_info + SRCS strip_reflect_info_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_compact_ids + SRCS compact_ids_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_flatten_decoration + SRCS flatten_decoration_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_freeze_spec_const + SRCS freeze_spec_const_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_block_merge + SRCS block_merge_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_inline + SRCS inline_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_inline_opaque + SRCS inline_opaque_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_insert_extract_elim + SRCS insert_extract_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_dead_insert_elim + SRCS dead_insert_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_local_ssa_elim + SRCS local_ssa_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_local_single_block_elim + SRCS local_single_block_elim.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_local_access_chain_convert + SRCS local_access_chain_convert_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_local_single_store_elim + SRCS local_single_store_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_dead_branch_elim + SRCS dead_branch_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_dead_variable_elim + SRCS dead_variable_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_aggressive_dce + SRCS aggressive_dead_code_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_common_uniform_elim + SRCS common_uniform_elim_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_eliminate_dead_const + SRCS eliminate_dead_const_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_eliminate_dead_functions + SRCS eliminate_dead_functions_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_pass + SRCS pass_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_utils + SRCS utils_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET def_use + SRCS def_use_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET assembly_builder + SRCS assembly_builder_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET types + SRCS types_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET type_manager + SRCS type_manager_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET iterator + SRCS iterator_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET module + SRCS module_utils.h + module_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_fold_spec_const_op_composite + SRCS fold_spec_const_op_composite_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_unify_const + SRCS unify_const_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_set_spec_const_default_value + SRCS set_spec_const_default_value_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET line_debug_info + SRCS line_debug_info_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_strength_reduction + SRCS strength_reduction_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_scalar_replacement + SRCS scalar_replacement_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET cfg_cleanup + SRCS cfg_cleanup_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET ir_context + SRCS ir_context_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET feature_manager + SRCS feature_manager_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_merge_return + SRCS pass_merge_return_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET value_table + SRCS value_table_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET local_redundancy_elimination + SRCS local_redundancy_elimination_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET propagator + SRCS propagator_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET redundancy_elimination + SRCS redundancy_elimination_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET private_to_local + SRCS private_to_local_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET decoration_manager + SRCS decoration_manager_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_remove_duplicates + SRCS pass_remove_duplicates_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET ccp + SRCS ccp_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_workaround1209 + SRCS workaround1209_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET pass_if_conversion + SRCS if_conversion_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET ir_builder + SRCS ir_builder.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET instruction_folding + SRCS fold_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET replace_invalid_opc + SRCS replace_invalid_opc_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET register_liveness + SRCS register_liveness.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET simplification + SRCS simplification_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET copy_prop_array + SRCS copy_prop_array_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET scalar_analysis + SRCS scalar_analysis.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET vector_dce + SRCS vector_dce_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET reduce_load_size + SRCS reduce_load_size_test.cpp pass_utils.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET constant_manager + SRCS constant_manager_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET combine_access_chains + SRCS combine_access_chains_test.cpp + LIBS SPIRV-Tools-opt +) + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp new file mode 100644 index 00000000000..287fcef0f6b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp @@ -0,0 +1,5823 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include +#include + +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using AggressiveDCETest = PassTest<::testing::Test>; + +TEST_F(AggressiveDCETest, EliminateExtendedInst) { + // #version 140 + // + // in vec4 BaseColor; + // in vec4 Dead; + // + // void main() + // { + // vec4 v = BaseColor; + // vec4 dv = sqrt(Dead); + // gl_FragColor = v; + // } + + const std::string predefs1 = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +)"; + + const std::string names_before = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string names_after = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string predefs2 = + R"(%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%dv = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%17 = OpLoad %v4float %Dead +%18 = OpExtInst %v4float %1 Sqrt %17 +OpStore %dv %18 +%19 = OpLoad %v4float %v +OpStore %gl_FragColor %19 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%19 = OpLoad %v4float %v +OpStore %gl_FragColor %19 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs1 + names_before + predefs2 + func_before, + predefs1 + names_after + predefs2 + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateFrexp) { + // Note: SPIR-V hand-edited to utilize Frexp + // + // #version 450 + // + // in vec4 BaseColor; + // in vec4 Dead; + // out vec4 Color; + // out ivec4 iv2; + // + // void main() + // { + // vec4 v = BaseColor; + // vec4 dv = frexp(Dead, iv2); + // Color = v; + // } + + const std::string predefs1 = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %iv2 %Color +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +)"; + + const std::string names_before = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %iv2 "iv2" +OpName %ResType "ResType" +OpName %Color "Color" +)"; + + const std::string names_after = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %iv2 "iv2" +OpName %Color "Color" +)"; + + const std::string predefs2_before = + R"(%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%int = OpTypeInt 32 1 +%v4int = OpTypeVector %int 4 +%_ptr_Output_v4int = OpTypePointer Output %v4int +%iv2 = OpVariable %_ptr_Output_v4int Output +%ResType = OpTypeStruct %v4float %v4int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%Color = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs2_after = + R"(%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%int = OpTypeInt 32 1 +%v4int = OpTypeVector %int 4 +%_ptr_Output_v4int = OpTypePointer Output %v4int +%iv2 = OpVariable %_ptr_Output_v4int Output +%_ptr_Output_v4float = OpTypePointer Output %v4float +%Color = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %11 +%20 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%dv = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %v4float %BaseColor +OpStore %v %21 +%22 = OpLoad %v4float %Dead +%23 = OpExtInst %v4float %1 Frexp %22 %iv2 +OpStore %dv %23 +%24 = OpLoad %v4float %v +OpStore %Color %24 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %11 +%20 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %v4float %BaseColor +OpStore %v %21 +%22 = OpLoad %v4float %Dead +%23 = OpExtInst %v4float %1 Frexp %22 %iv2 +%24 = OpLoad %v4float %v +OpStore %Color %24 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs1 + names_before + predefs2_before + func_before, + predefs1 + names_after + predefs2_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateDecorate) { + // Note: The SPIR-V was hand-edited to add the OpDecorate + // + // #version 140 + // + // in vec4 BaseColor; + // in vec4 Dead; + // + // void main() + // { + // vec4 v = BaseColor; + // vec4 dv = Dead * 0.5; + // gl_FragColor = v; + // } + + const std::string predefs1 = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +)"; + + const std::string names_before = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %8 RelaxedPrecision +)"; + + const std::string names_after = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string predefs2_before = + R"(%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%float_0_5 = OpConstant %float 0.5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs2_after = + R"(%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %10 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%dv = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpLoad %v4float %Dead +%8 = OpVectorTimesScalar %v4float %19 %float_0_5 +OpStore %dv %8 +%20 = OpLoad %v4float %v +OpStore %gl_FragColor %20 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %10 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%20 = OpLoad %v4float %v +OpStore %gl_FragColor %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs1 + names_before + predefs2_before + func_before, + predefs1 + names_after + predefs2_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, Simple) { + // #version 140 + // + // in vec4 BaseColor; + // in vec4 Dead; + // + // void main() + // { + // vec4 v = BaseColor; + // vec4 dv = Dead; + // gl_FragColor = v; + // } + + const std::string predefs1 = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +)"; + + const std::string names_before = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string names_after = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string predefs2 = + R"(%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%dv = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%17 = OpLoad %v4float %Dead +OpStore %dv %17 +%18 = OpLoad %v4float %v +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%18 = OpLoad %v4float %v +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs1 + names_before + predefs2 + func_before, + predefs1 + names_after + predefs2 + func_after, true, true); +} + +TEST_F(AggressiveDCETest, OptWhitelistExtension) { + // #version 140 + // + // in vec4 BaseColor; + // in vec4 Dead; + // + // void main() + // { + // vec4 v = BaseColor; + // vec4 dv = Dead; + // gl_FragColor = v; + // } + + const std::string predefs1 = + R"(OpCapability Shader +OpExtension "SPV_AMD_gpu_shader_int16" +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +)"; + + const std::string names_before = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string names_after = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string predefs2 = + R"(%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%dv = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%17 = OpLoad %v4float %Dead +OpStore %dv %17 +%18 = OpLoad %v4float %v +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%18 = OpLoad %v4float %v +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs1 + names_before + predefs2 + func_before, + predefs1 + names_after + predefs2 + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoOptBlacklistExtension) { + // #version 140 + // + // in vec4 BaseColor; + // in vec4 Dead; + // + // void main() + // { + // vec4 v = BaseColor; + // vec4 dv = Dead; + // gl_FragColor = v; + // } + + const std::string assembly = + R"(OpCapability Shader +OpExtension "SPV_KHR_variable_pointers" +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %9 +%15 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%dv = OpVariable %_ptr_Function_v4float Function +%16 = OpLoad %v4float %BaseColor +OpStore %v %16 +%17 = OpLoad %v4float %Dead +OpStore %dv %17 +%18 = OpLoad %v4float %v +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, ElimWithCall) { + // This demonstrates that "dead" function calls are not eliminated. + // Also demonstrates that DCE will happen in presence of function call. + // #version 140 + // in vec4 i1; + // in vec4 i2; + // + // void nothing(vec4 v) + // { + // } + // + // void main() + // { + // vec4 v1 = i1; + // vec4 v2 = i2; + // nothing(v1); + // gl_FragColor = vec4(0.0); + // } + + const std::string defs_before = + R"( OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %i1 %i2 %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %nothing_vf4_ "nothing(vf4;" +OpName %v "v" +OpName %v1 "v1" +OpName %i1 "i1" +OpName %v2 "v2" +OpName %i2 "i2" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%16 = OpTypeFunction %void %_ptr_Function_v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%i1 = OpVariable %_ptr_Input_v4float Input +%i2 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +%20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +)"; + + const std::string defs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %i1 %i2 %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %nothing_vf4_ "nothing(vf4;" +OpName %v "v" +OpName %v1 "v1" +OpName %i1 "i1" +OpName %i2 "i2" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%16 = OpTypeFunction %void %_ptr_Function_v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%i1 = OpVariable %_ptr_Input_v4float Input +%i2 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +%20 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %12 +%21 = OpLabel +%v1 = OpVariable %_ptr_Function_v4float Function +%v2 = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %i1 +OpStore %v1 %22 +%23 = OpLoad %v4float %i2 +OpStore %v2 %23 +%24 = OpLoad %v4float %v1 +OpStore %param %24 +%25 = OpFunctionCall %void %nothing_vf4_ %param +OpStore %gl_FragColor %20 +OpReturn +OpFunctionEnd +%nothing_vf4_ = OpFunction %void None %16 +%v = OpFunctionParameter %_ptr_Function_v4float +%26 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %12 +%21 = OpLabel +%v1 = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %i1 +OpStore %v1 %22 +%24 = OpLoad %v4float %v1 +OpStore %param %24 +%25 = OpFunctionCall %void %nothing_vf4_ %param +OpStore %gl_FragColor %20 +OpReturn +OpFunctionEnd +%nothing_vf4_ = OpFunction %void None %16 +%v = OpFunctionParameter %_ptr_Function_v4float +%26 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(defs_before + func_before, + defs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoParamElim) { + // This demonstrates that unused parameters are not eliminated, but + // dead uses of them are. + // #version 140 + // + // in vec4 BaseColor; + // + // vec4 foo(vec4 v1, vec4 v2) + // { + // vec4 t = -v1; + // return v2; + // } + // + // void main() + // { + // vec4 dead; + // gl_FragColor = foo(dead, BaseColor); + // } + + const std::string defs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_vf4_ "foo(vf4;vf4;" +OpName %v1 "v1" +OpName %v2 "v2" +OpName %t "t" +OpName %gl_FragColor "gl_FragColor" +OpName %dead "dead" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %param_0 "param" +%void = OpTypeVoid +%13 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%17 = OpTypeFunction %v4float %_ptr_Function_v4float %_ptr_Function_v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %13 +%20 = OpLabel +%dead = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%param_0 = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %v4float %dead +OpStore %param %21 +%22 = OpLoad %v4float %BaseColor +OpStore %param_0 %22 +%23 = OpFunctionCall %v4float %foo_vf4_vf4_ %param %param_0 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string defs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_vf4_ "foo(vf4;vf4;" +OpName %v1 "v1" +OpName %v2 "v2" +OpName %gl_FragColor "gl_FragColor" +OpName %dead "dead" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %param_0 "param" +%void = OpTypeVoid +%13 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%17 = OpTypeFunction %v4float %_ptr_Function_v4float %_ptr_Function_v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %13 +%20 = OpLabel +%dead = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%param_0 = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %v4float %dead +OpStore %param %21 +%22 = OpLoad %v4float %BaseColor +OpStore %param_0 %22 +%23 = OpFunctionCall %v4float %foo_vf4_vf4_ %param %param_0 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string func_before = + R"(%foo_vf4_vf4_ = OpFunction %v4float None %17 +%v1 = OpFunctionParameter %_ptr_Function_v4float +%v2 = OpFunctionParameter %_ptr_Function_v4float +%24 = OpLabel +%t = OpVariable %_ptr_Function_v4float Function +%25 = OpLoad %v4float %v1 +%26 = OpFNegate %v4float %25 +OpStore %t %26 +%27 = OpLoad %v4float %v2 +OpReturnValue %27 +OpFunctionEnd +)"; + + const std::string func_after = + R"(%foo_vf4_vf4_ = OpFunction %v4float None %17 +%v1 = OpFunctionParameter %_ptr_Function_v4float +%v2 = OpFunctionParameter %_ptr_Function_v4float +%24 = OpLabel +%27 = OpLoad %v4float %v2 +OpReturnValue %27 +OpFunctionEnd +)"; + + SinglePassRunAndCheck(defs_before + func_before, + defs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, ElimOpaque) { + // SPIR-V not representable from GLSL; not generatable from HLSL + // for the moment. + + const std::string defs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpMemberName %S_t 2 "smp" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %s0 "s0" +OpName %texCoords "texCoords" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%14 = OpTypeImage %float 2D 0 0 0 1 Unknown +%15 = OpTypeSampledImage %14 +%S_t = OpTypeStruct %v2float %v2float %15 +%_ptr_Function_S_t = OpTypePointer Function %S_t +%17 = OpTypeFunction %void %_ptr_Function_S_t +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 +%_ptr_Function_15 = OpTypePointer Function %15 +%sampler15 = OpVariable %_ptr_UniformConstant_15 UniformConstant +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string defs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %texCoords "texCoords" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%14 = OpTypeImage %float 2D 0 0 0 1 Unknown +%15 = OpTypeSampledImage %14 +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 +%sampler15 = OpVariable %_ptr_UniformConstant_15 UniformConstant +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %9 +%25 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%26 = OpLoad %v2float %texCoords +%27 = OpLoad %S_t %s0 +%28 = OpCompositeInsert %S_t %26 %27 0 +%29 = OpLoad %15 %sampler15 +%30 = OpCompositeInsert %S_t %29 %28 2 +OpStore %s0 %30 +%31 = OpImageSampleImplicitLod %v4float %29 %26 +OpStore %outColor %31 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %9 +%25 = OpLabel +%26 = OpLoad %v2float %texCoords +%29 = OpLoad %15 %sampler15 +%31 = OpImageSampleImplicitLod %v4float %29 %26 +OpStore %outColor %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(defs_before + func_before, + defs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoParamStoreElim) { + // Should not eliminate stores to params + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void foo(in vec4 v1, out vec4 v2) + // { + // v2 = -v1; + // } + // + // void main() + // { + // foo(BaseColor, OutColor); + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %foo_vf4_vf4_ "foo(vf4;vf4;" +OpName %v1 "v1" +OpName %v2 "v2" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpName %param "param" +OpName %param_0 "param" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%15 = OpTypeFunction %void %_ptr_Function_v4float %_ptr_Function_v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %11 +%18 = OpLabel +%param = OpVariable %_ptr_Function_v4float Function +%param_0 = OpVariable %_ptr_Function_v4float Function +%19 = OpLoad %v4float %BaseColor +OpStore %param %19 +%20 = OpFunctionCall %void %foo_vf4_vf4_ %param %param_0 +%21 = OpLoad %v4float %param_0 +OpStore %OutColor %21 +OpReturn +OpFunctionEnd +%foo_vf4_vf4_ = OpFunction %void None %15 +%v1 = OpFunctionParameter %_ptr_Function_v4float +%v2 = OpFunctionParameter %_ptr_Function_v4float +%22 = OpLabel +%23 = OpLoad %v4float %v1 +%24 = OpFNegate %v4float %23 +OpStore %v2 %24 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, PrivateStoreElimInEntryNoCalls) { + // Eliminate stores to private in entry point with no calls + // Note: Not legal GLSL + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 1) in vec4 Dead; + // layout(location = 0) out vec4 OutColor; + // + // private vec4 dv; + // + // void main() + // { + // vec4 v = BaseColor; + // dv = Dead; + // OutColor = v; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %Dead Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%dv = OpVariable %_ptr_Private_v4float Private +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %Dead Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string main_before = + R"(%main = OpFunction %void None %9 +%16 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%17 = OpLoad %v4float %BaseColor +OpStore %v %17 +%18 = OpLoad %v4float %Dead +OpStore %dv %18 +%19 = OpLoad %v4float %v +%20 = OpFNegate %v4float %19 +OpStore %OutColor %20 +OpReturn +OpFunctionEnd +)"; + + const std::string main_after = + R"(%main = OpFunction %void None %9 +%16 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%17 = OpLoad %v4float %BaseColor +OpStore %v %17 +%19 = OpLoad %v4float %v +%20 = OpFNegate %v4float %19 +OpStore %OutColor %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + main_before, predefs_after + main_after, true, true); +} + +TEST_F(AggressiveDCETest, NoPrivateStoreElimIfLoad) { + // Should not eliminate stores to private when there is a load + // Note: Not legal GLSL + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // private vec4 pv; + // + // void main() + // { + // pv = BaseColor; + // OutColor = pv; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %pv "pv" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%pv = OpVariable %_ptr_Private_v4float Private +%main = OpFunction %void None %7 +%13 = OpLabel +%14 = OpLoad %v4float %BaseColor +OpStore %pv %14 +%15 = OpLoad %v4float %pv +%16 = OpFNegate %v4float %15 +OpStore %OutColor %16 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoPrivateStoreElimWithCall) { + // Should not eliminate stores to private when function contains call + // Note: Not legal GLSL + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // private vec4 v1; + // + // void foo() + // { + // OutColor = -v1; + // } + // + // void main() + // { + // v1 = BaseColor; + // foo(); + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %OutColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %foo_ "foo(" +OpName %OutColor "OutColor" +OpName %v1 "v1" +OpName %BaseColor "BaseColor" +OpDecorate %OutColor Location 0 +OpDecorate %BaseColor Location 0 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%v1 = OpVariable %_ptr_Private_v4float Private +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %8 +%14 = OpLabel +%15 = OpLoad %v4float %BaseColor +OpStore %v1 %15 +%16 = OpFunctionCall %void %foo_ +OpReturn +OpFunctionEnd +%foo_ = OpFunction %void None %8 +%17 = OpLabel +%18 = OpLoad %v4float %v1 +%19 = OpFNegate %v4float %18 +OpStore %OutColor %19 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoPrivateStoreElimInNonEntry) { + // Should not eliminate stores to private when function is not entry point + // Note: Not legal GLSL + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // private vec4 v1; + // + // void foo() + // { + // v1 = BaseColor; + // } + // + // void main() + // { + // foo(); + // OutColor = -v1; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %foo_ "foo(" +OpName %v1 "v1" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Private_v4float = OpTypePointer Private %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%v1 = OpVariable %_ptr_Private_v4float Private +%OutColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %8 +%14 = OpLabel +%15 = OpFunctionCall %void %foo_ +%16 = OpLoad %v4float %v1 +%17 = OpFNegate %v4float %16 +OpStore %OutColor %17 +OpReturn +OpFunctionEnd +%foo_ = OpFunction %void None %8 +%18 = OpLabel +%19 = OpLoad %v4float %BaseColor +OpStore %v1 %19 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, WorkgroupStoreElimInEntryNoCalls) { + // Eliminate stores to private in entry point with no calls + // Note: Not legal GLSL + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 1) in vec4 Dead; + // layout(location = 0) out vec4 OutColor; + // + // workgroup vec4 dv; + // + // void main() + // { + // vec4 v = BaseColor; + // dv = Dead; + // OutColor = v; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %dv "dv" +OpName %Dead "Dead" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %Dead Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Workgroup_v4float = OpTypePointer Workgroup %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%dv = OpVariable %_ptr_Workgroup_v4float Workgroup +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Dead %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Dead "Dead" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %Dead Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%Dead = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string main_before = + R"(%main = OpFunction %void None %9 +%16 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%17 = OpLoad %v4float %BaseColor +OpStore %v %17 +%18 = OpLoad %v4float %Dead +OpStore %dv %18 +%19 = OpLoad %v4float %v +%20 = OpFNegate %v4float %19 +OpStore %OutColor %20 +OpReturn +OpFunctionEnd +)"; + + const std::string main_after = + R"(%main = OpFunction %void None %9 +%16 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%17 = OpLoad %v4float %BaseColor +OpStore %v %17 +%19 = OpLoad %v4float %v +%20 = OpFNegate %v4float %19 +OpStore %OutColor %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + main_before, predefs_after + main_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateDeadIfThenElse) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float d; + // if (BaseColor.x == 0) + // d = BaseColor.y; + // else + // d = BaseColor.z; + // OutColor = vec4(1.0,1.0,1.0,1.0); + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %d "d" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%21 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%21 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %7 +%22 = OpLabel +%d = OpVariable %_ptr_Function_float Function +%23 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%24 = OpLoad %float %23 +%25 = OpFOrdEqual %bool %24 %float_0 +OpSelectionMerge %26 None +OpBranchConditional %25 %27 %28 +%27 = OpLabel +%29 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%30 = OpLoad %float %29 +OpStore %d %30 +OpBranch %26 +%28 = OpLabel +%31 = OpAccessChain %_ptr_Input_float %BaseColor %uint_2 +%32 = OpLoad %float %31 +OpStore %d %32 +OpBranch %26 +%26 = OpLabel +OpStore %OutColor %21 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %7 +%22 = OpLabel +OpBranch %26 +%26 = OpLabel +OpStore %OutColor %21 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateDeadIfThen) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float d; + // if (BaseColor.x == 0) + // d = BaseColor.y; + // OutColor = vec4(1.0,1.0,1.0,1.0); + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %d "d" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%20 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %7 +%21 = OpLabel +%d = OpVariable %_ptr_Function_float Function +%22 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%23 = OpLoad %float %22 +%24 = OpFOrdEqual %bool %23 %float_0 +OpSelectionMerge %25 None +OpBranchConditional %24 %26 %25 +%26 = OpLabel +%27 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%28 = OpLoad %float %27 +OpStore %d %28 +OpBranch %25 +%25 = OpLabel +OpStore %OutColor %20 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %7 +%21 = OpLabel +OpBranch %25 +%25 = OpLabel +OpStore %OutColor %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateDeadSwitch) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 1) in flat int x; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float d; + // switch (x) { + // case 0: + // d = BaseColor.y; + // } + // OutColor = vec4(1.0,1.0,1.0,1.0); + // } + const std::string before = + R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %x %BaseColor %OutColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %x "x" + OpName %d "d" + OpName %BaseColor "BaseColor" + OpName %OutColor "OutColor" + OpDecorate %x Flat + OpDecorate %x Location 1 + OpDecorate %BaseColor Location 0 + OpDecorate %OutColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %x = OpVariable %_ptr_Input_int Input + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %BaseColor = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %OutColor = OpVariable %_ptr_Output_v4float Output + %float_1 = OpConstant %float 1 + %27 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %3 + %5 = OpLabel + %d = OpVariable %_ptr_Function_float Function + %9 = OpLoad %int %x + OpSelectionMerge %11 None + OpSwitch %9 %11 0 %10 + %10 = OpLabel + %21 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 + %22 = OpLoad %float %21 + OpStore %d %22 + OpBranch %11 + %11 = OpLabel + OpStore %OutColor %27 + OpReturn + OpFunctionEnd)"; + + const std::string after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %x %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %x "x" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %x Flat +OpDecorate %x Location 1 +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%x = OpVariable %_ptr_Input_int Input +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%27 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%main = OpFunction %void None %3 +%5 = OpLabel +OpBranch %11 +%11 = OpLabel +OpStore %OutColor %27 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateDeadIfThenElseNested) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float d; + // if (BaseColor.x == 0) + // if (BaseColor.y == 0) + // d = 0.0; + // else + // d = 0.25; + // else + // if (BaseColor.y == 0) + // d = 0.5; + // else + // d = 0.75; + // OutColor = vec4(1.0,1.0,1.0,1.0); + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %d "d" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%float_0_25 = OpConstant %float 0.25 +%float_0_5 = OpConstant %float 0.5 +%float_0_75 = OpConstant %float 0.75 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_1 = OpConstant %float 1 +%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %7 +%24 = OpLabel +%d = OpVariable %_ptr_Function_float Function +%25 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%26 = OpLoad %float %25 +%27 = OpFOrdEqual %bool %26 %float_0 +OpSelectionMerge %28 None +OpBranchConditional %27 %29 %30 +%29 = OpLabel +%31 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%32 = OpLoad %float %31 +%33 = OpFOrdEqual %bool %32 %float_0 +OpSelectionMerge %34 None +OpBranchConditional %33 %35 %36 +%35 = OpLabel +OpStore %d %float_0 +OpBranch %34 +%36 = OpLabel +OpStore %d %float_0_25 +OpBranch %34 +%34 = OpLabel +OpBranch %28 +%30 = OpLabel +%37 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%38 = OpLoad %float %37 +%39 = OpFOrdEqual %bool %38 %float_0 +OpSelectionMerge %40 None +OpBranchConditional %39 %41 %42 +%41 = OpLabel +OpStore %d %float_0_5 +OpBranch %40 +%42 = OpLabel +OpStore %d %float_0_75 +OpBranch %40 +%40 = OpLabel +OpBranch %28 +%28 = OpLabel +OpStore %OutColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %7 +%24 = OpLabel +OpBranch %28 +%28 = OpLabel +OpStore %OutColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateLiveIfThenElse) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float t; + // if (BaseColor.x == 0) + // t = BaseColor.y; + // else + // t = BaseColor.z; + // OutColor = vec4(t); + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %t "t" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%20 = OpLabel +%t = OpVariable %_ptr_Function_float Function +%21 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%22 = OpLoad %float %21 +%23 = OpFOrdEqual %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %26 +%25 = OpLabel +%27 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%28 = OpLoad %float %27 +OpStore %t %28 +OpBranch %24 +%26 = OpLabel +%29 = OpAccessChain %_ptr_Input_float %BaseColor %uint_2 +%30 = OpLoad %float %29 +OpStore %t %30 +OpBranch %24 +%24 = OpLabel +%31 = OpLoad %float %t +%32 = OpCompositeConstruct %v4float %31 %31 %31 %31 +OpStore %OutColor %32 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateLiveIfThenElseNested) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float t; + // if (BaseColor.x == 0) + // if (BaseColor.y == 0) + // t = 0.0; + // else + // t = 0.25; + // else + // if (BaseColor.y == 0) + // t = 0.5; + // else + // t = 0.75; + // OutColor = vec4(t); + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %t "t" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%float_0_25 = OpConstant %float 0.25 +%float_0_5 = OpConstant %float 0.5 +%float_0_75 = OpConstant %float 0.75 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%22 = OpLabel +%t = OpVariable %_ptr_Function_float Function +%23 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%24 = OpLoad %float %23 +%25 = OpFOrdEqual %bool %24 %float_0 +OpSelectionMerge %26 None +OpBranchConditional %25 %27 %28 +%27 = OpLabel +%29 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%30 = OpLoad %float %29 +%31 = OpFOrdEqual %bool %30 %float_0 +OpSelectionMerge %32 None +OpBranchConditional %31 %33 %34 +%33 = OpLabel +OpStore %t %float_0 +OpBranch %32 +%34 = OpLabel +OpStore %t %float_0_25 +OpBranch %32 +%32 = OpLabel +OpBranch %26 +%28 = OpLabel +%35 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%36 = OpLoad %float %35 +%37 = OpFOrdEqual %bool %36 %float_0 +OpSelectionMerge %38 None +OpBranchConditional %37 %39 %40 +%39 = OpLabel +OpStore %t %float_0_5 +OpBranch %38 +%40 = OpLabel +OpStore %t %float_0_75 +OpBranch %38 +%38 = OpLabel +OpBranch %26 +%26 = OpLabel +%41 = OpLoad %float %t +%42 = OpCompositeConstruct %v4float %41 %41 %41 %41 +OpStore %OutColor %42 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateIfWithPhi) { + // Note: Assembly hand-optimized from GLSL + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float t; + // if (BaseColor.x == 0) + // t = 0.0; + // else + // t = 1.0; + // OutColor = vec4(t); + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %6 +%17 = OpLabel +%18 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%19 = OpLoad %float %18 +%20 = OpFOrdEqual %bool %19 %float_0 +OpSelectionMerge %21 None +OpBranchConditional %20 %22 %23 +%22 = OpLabel +OpBranch %21 +%23 = OpLabel +OpBranch %21 +%21 = OpLabel +%24 = OpPhi %float %float_0 %22 %float_1 %23 +%25 = OpCompositeConstruct %v4float %24 %24 %24 %24 +OpStore %OutColor %25 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateIfBreak) { + // Note: Assembly optimized from GLSL + // + // #version 450 + // + // layout(location=0) in vec4 InColor; + // layout(location=0) out vec4 OutColor; + // + // void main() + // { + // float f = 0.0; + // for (;;) { + // f += 2.0; + // if (f > 20.0) + // break; + // } + // + // OutColor = InColor / f; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %OutColor %InColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %f "f" +OpName %OutColor "OutColor" +OpName %InColor "InColor" +OpDecorate %OutColor Location 0 +OpDecorate %InColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%float_2 = OpConstant %float 2 +%float_20 = OpConstant %float 20 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%InColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %7 +%17 = OpLabel +%f = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpBranch %18 +%18 = OpLabel +OpLoopMerge %19 %20 None +OpBranch %21 +%21 = OpLabel +%22 = OpLoad %float %f +%23 = OpFAdd %float %22 %float_2 +OpStore %f %23 +%24 = OpLoad %float %f +%25 = OpFOrdGreaterThan %bool %24 %float_20 +OpSelectionMerge %26 None +OpBranchConditional %25 %27 %26 +%27 = OpLabel +OpBranch %19 +%26 = OpLabel +OpBranch %20 +%20 = OpLabel +OpBranch %18 +%19 = OpLabel +%28 = OpLoad %v4float %InColor +%29 = OpLoad %float %f +%30 = OpCompositeConstruct %v4float %29 %29 %29 %29 +%31 = OpFDiv %v4float %28 %30 +OpStore %OutColor %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateIfBreak2) { + // Do not eliminate break as conditional branch with merge instruction + // Note: SPIR-V edited to add merge instruction before break. + // + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) + // s += g_F[i]; + // o = s; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %10 +%25 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %26 +%26 = OpLabel +OpLoopMerge %27 %28 None +OpBranch %29 +%29 = OpLabel +%30 = OpLoad %int %i +%31 = OpSLessThan %bool %30 %int_10 +OpSelectionMerge %32 None +OpBranchConditional %31 %32 %27 +%32 = OpLabel +%33 = OpLoad %int %i +%34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %33 +%35 = OpLoad %float %34 +%36 = OpLoad %float %s +%37 = OpFAdd %float %36 %35 +OpStore %s %37 +OpBranch %28 +%28 = OpLabel +%38 = OpLoad %int %i +%39 = OpIAdd %int %38 %int_1 +OpStore %i %39 +OpBranch %26 +%27 = OpLabel +%40 = OpLoad %float %s +OpStore %o %40 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, EliminateEntireUselessLoop) { + // #version 140 + // in vec4 BaseColor; + // + // layout(std140) uniform U_t + // { + // int g_I ; + // } ; + // + // void main() + // { + // vec4 v = BaseColor; + // float df = 0.0; + // int i = 0; + // while (i < g_I) { + // df = df * 0.5; + // i = i + 1; + // } + // gl_FragColor = v; + // } + + const std::string predefs1 = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +)"; + + const std::string names_before = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %df "df" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_I" +OpName %_ "" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string names_after = + R"(OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +)"; + + const std::string predefs2_before = + R"(OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%U_t = OpTypeStruct %int +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%bool = OpTypeBool +%float_0_5 = OpConstant %float 0.5 +%int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs2_after = + R"(%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %11 +%27 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%df = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%28 = OpLoad %v4float %BaseColor +OpStore %v %28 +OpStore %df %float_0 +OpStore %i %int_0 +OpBranch %29 +%29 = OpLabel +OpLoopMerge %30 %31 None +OpBranch %32 +%32 = OpLabel +%33 = OpLoad %int %i +%34 = OpAccessChain %_ptr_Uniform_int %_ %int_0 +%35 = OpLoad %int %34 +%36 = OpSLessThan %bool %33 %35 +OpBranchConditional %36 %37 %30 +%37 = OpLabel +%38 = OpLoad %float %df +%39 = OpFMul %float %38 %float_0_5 +OpStore %df %39 +%40 = OpLoad %int %i +%41 = OpIAdd %int %40 %int_1 +OpStore %i %41 +OpBranch %31 +%31 = OpLabel +OpBranch %29 +%30 = OpLabel +%42 = OpLoad %v4float %v +OpStore %gl_FragColor %42 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %11 +%27 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%28 = OpLoad %v4float %BaseColor +OpStore %v %28 +OpBranch %29 +%29 = OpLabel +OpBranch %30 +%30 = OpLabel +%42 = OpLoad %v4float %v +OpStore %gl_FragColor %42 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs1 + names_before + predefs2_before + func_before, + predefs1 + names_after + predefs2_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateBusyLoop) { + // Note: SPIR-V edited to replace AtomicAdd(i,0) with AtomicLoad(i) + // + // #version 450 + // + // layout(std430) buffer I_t + // { + // int g_I; + // int g_I2; + // }; + // + // layout(location = 0) out int o; + // + // void main(void) + // { + // while (atomicAdd(g_I, 0) == 0) {} + // o = g_I2; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %I_t "I_t" +OpMemberName %I_t 0 "g_I" +OpMemberName %I_t 1 "g_I2" +OpName %_ "" +OpName %o "o" +OpMemberDecorate %I_t 0 Offset 0 +OpMemberDecorate %I_t 1 Offset 4 +OpDecorate %I_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%I_t = OpTypeStruct %int %int +%_ptr_Uniform_I_t = OpTypePointer Uniform %I_t +%_ = OpVariable %_ptr_Uniform_I_t Uniform +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_0 = OpConstant %uint 0 +%bool = OpTypeBool +%_ptr_Output_int = OpTypePointer Output %int +%o = OpVariable %_ptr_Output_int Output +%main = OpFunction %void None %7 +%18 = OpLabel +OpBranch %19 +%19 = OpLabel +OpLoopMerge %20 %21 None +OpBranch %22 +%22 = OpLabel +%23 = OpAccessChain %_ptr_Uniform_int %_ %int_0 +%24 = OpAtomicLoad %int %23 %uint_1 %uint_0 +%25 = OpIEqual %bool %24 %int_0 +OpBranchConditional %25 %26 %20 +%26 = OpLabel +OpBranch %21 +%21 = OpLabel +OpBranch %19 +%20 = OpLabel +%27 = OpAccessChain %_ptr_Uniform_int %_ %int_1 +%28 = OpLoad %int %27 +OpStore %o %28 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateLiveLoop) { + // Note: SPIR-V optimized + // + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) + // s += g_F[i]; + // o = s; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %8 +%21 = OpLabel +OpBranch %22 +%22 = OpLabel +%23 = OpPhi %float %float_0 %21 %24 %25 +%26 = OpPhi %int %int_0 %21 %27 %25 +OpLoopMerge %28 %25 None +OpBranch %29 +%29 = OpLabel +%30 = OpSLessThan %bool %26 %int_10 +OpBranchConditional %30 %31 %28 +%31 = OpLabel +%32 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %26 +%33 = OpLoad %float %32 +%24 = OpFAdd %float %23 %33 +OpBranch %25 +%25 = OpLabel +%27 = OpIAdd %int %26 %int_1 +OpBranch %22 +%28 = OpLabel +OpStore %o %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, EliminateEntireFunctionBody) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // float d; + // if (BaseColor.x == 0) + // d = BaseColor.y; + // else + // d = BaseColor.z; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %d "d" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %7 +%20 = OpLabel +%d = OpVariable %_ptr_Function_float Function +%21 = OpAccessChain %_ptr_Input_float %BaseColor %uint_0 +%22 = OpLoad %float %21 +%23 = OpFOrdEqual %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %26 +%25 = OpLabel +%27 = OpAccessChain %_ptr_Input_float %BaseColor %uint_1 +%28 = OpLoad %float %27 +OpStore %d %28 +OpBranch %24 +%26 = OpLabel +%29 = OpAccessChain %_ptr_Input_float %BaseColor %uint_2 +%30 = OpLoad %float %29 +OpStore %d %30 +OpBranch %24 +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %7 +%20 = OpLabel +OpBranch %24 +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateUselessInnerLoop) { + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // for (int j=0; j<10; j++) { + // } + // s += g_F[i]; + // } + // o = s; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %j "j" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_1 = OpConstant %int 1 +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_1 = OpConstant %int 1 +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %11 +%26 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%j = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +%31 = OpLoad %int %i +%32 = OpSLessThan %bool %31 %int_10 +OpBranchConditional %32 %33 %28 +%33 = OpLabel +OpStore %j %int_0 +OpBranch %34 +%34 = OpLabel +OpLoopMerge %35 %36 None +OpBranch %37 +%37 = OpLabel +%38 = OpLoad %int %j +%39 = OpSLessThan %bool %38 %int_10 +OpBranchConditional %39 %40 %35 +%40 = OpLabel +OpBranch %36 +%36 = OpLabel +%41 = OpLoad %int %j +%42 = OpIAdd %int %41 %int_1 +OpStore %j %42 +OpBranch %34 +%35 = OpLabel +%43 = OpLoad %int %i +%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %43 +%45 = OpLoad %float %44 +%46 = OpLoad %float %s +%47 = OpFAdd %float %46 %45 +OpStore %s %47 +OpBranch %29 +%29 = OpLabel +%48 = OpLoad %int %i +%49 = OpIAdd %int %48 %int_1 +OpStore %i %49 +OpBranch %27 +%28 = OpLabel +%50 = OpLoad %float %s +OpStore %o %50 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %11 +%26 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +%31 = OpLoad %int %i +%32 = OpSLessThan %bool %31 %int_10 +OpBranchConditional %32 %33 %28 +%33 = OpLabel +OpBranch %34 +%34 = OpLabel +OpBranch %35 +%35 = OpLabel +%43 = OpLoad %int %i +%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %43 +%45 = OpLoad %float %44 +%46 = OpLoad %float %s +%47 = OpFAdd %float %46 %45 +OpStore %s %47 +OpBranch %29 +%29 = OpLabel +%48 = OpLoad %int %i +%49 = OpIAdd %int %48 %int_1 +OpStore %i %49 +OpBranch %27 +%28 = OpLabel +%50 = OpLoad %float %s +OpStore %o %50 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateUselessNestedLoopWithIf) { + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10][10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // for (int j=0; j<10; j++) { + // float t = g_F[i][j]; + // if (t > 0.0) + // s += t; + // } + // } + // o = 0.0; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %j "j" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpDecorate %_arr__arr_float_uint_10_uint_10 ArrayStride 40 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_arr__arr_float_uint_10_uint_10 = OpTypeArray %_arr_float_uint_10 %uint_10 +%U_t = OpTypeStruct %_arr__arr_float_uint_10_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %o "o" +OpDecorate %o Location 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%float_0 = OpConstant %float 0 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %12 +%27 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%j = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %28 +%28 = OpLabel +OpLoopMerge %29 %30 None +OpBranch %31 +%31 = OpLabel +%32 = OpLoad %int %i +%33 = OpSLessThan %bool %32 %int_10 +OpBranchConditional %33 %34 %29 +%34 = OpLabel +OpStore %j %int_0 +OpBranch %35 +%35 = OpLabel +OpLoopMerge %36 %37 None +OpBranch %38 +%38 = OpLabel +%39 = OpLoad %int %j +%40 = OpSLessThan %bool %39 %int_10 +OpBranchConditional %40 %41 %36 +%41 = OpLabel +%42 = OpLoad %int %i +%43 = OpLoad %int %j +%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %42 %43 +%45 = OpLoad %float %44 +%46 = OpFOrdGreaterThan %bool %45 %float_0 +OpSelectionMerge %47 None +OpBranchConditional %46 %48 %47 +%48 = OpLabel +%49 = OpLoad %float %s +%50 = OpFAdd %float %49 %45 +OpStore %s %50 +OpBranch %47 +%47 = OpLabel +OpBranch %37 +%37 = OpLabel +%51 = OpLoad %int %j +%52 = OpIAdd %int %51 %int_1 +OpStore %j %52 +OpBranch %35 +%36 = OpLabel +OpBranch %30 +%30 = OpLabel +%53 = OpLoad %int %i +%54 = OpIAdd %int %53 %int_1 +OpStore %i %54 +OpBranch %28 +%29 = OpLabel +OpStore %o %float_0 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %12 +%27 = OpLabel +OpBranch %28 +%28 = OpLabel +OpBranch %29 +%29 = OpLabel +OpStore %o %float_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, EliminateEmptyIfBeforeContinue) { + // #version 430 + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // s += 1.0; + // if (i > s) {} + // } + // o = s; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %3 +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" +OpSourceExtension "GL_GOOGLE_include_directive" +OpName %main "main" +OpDecorate %3 Location 0 +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%3 = OpVariable %_ptr_Output_float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %3 +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" +OpSourceExtension "GL_GOOGLE_include_directive" +OpName %main "main" +OpDecorate %3 Location 0 +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%3 = OpVariable %_ptr_Output_float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %5 +%16 = OpLabel +OpBranch %17 +%17 = OpLabel +%18 = OpPhi %float %float_0 %16 %19 %20 +%21 = OpPhi %int %int_0 %16 %22 %20 +OpLoopMerge %23 %20 None +OpBranch %24 +%24 = OpLabel +%25 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %25 %26 %23 +%26 = OpLabel +%19 = OpFAdd %float %18 %float_1 +%27 = OpConvertFToS %int %19 +%28 = OpSGreaterThan %bool %21 %27 +OpSelectionMerge %20 None +OpBranchConditional %28 %29 %20 +%29 = OpLabel +OpBranch %20 +%20 = OpLabel +%22 = OpIAdd %int %21 %int_1 +OpBranch %17 +%23 = OpLabel +OpStore %3 %18 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %5 +%16 = OpLabel +OpBranch %17 +%17 = OpLabel +%18 = OpPhi %float %float_0 %16 %19 %20 +%21 = OpPhi %int %int_0 %16 %22 %20 +OpLoopMerge %23 %20 None +OpBranch %24 +%24 = OpLabel +%25 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %25 %26 %23 +%26 = OpLabel +%19 = OpFAdd %float %18 %float_1 +OpBranch %20 +%20 = OpLabel +%22 = OpIAdd %int %21 %int_1 +OpBranch %17 +%23 = OpLabel +OpStore %3 %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + func_before, predefs_after + func_after, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateLiveNestedLoopWithIf) { + // Note: SPIR-V optimized + // + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10][10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // for (int j=0; j<10; j++) { + // float t = g_F[i][j]; + // if (t > 0.0) + // s += t; + // } + // } + // o = s; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %j "j" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpDecorate %_arr__arr_float_uint_10_uint_10 ArrayStride 40 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%_arr__arr_float_uint_10_uint_10 = OpTypeArray %_arr_float_uint_10 %uint_10 +%U_t = OpTypeStruct %_arr__arr_float_uint_10_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %12 +%27 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%j = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %28 +%28 = OpLabel +OpLoopMerge %29 %30 None +OpBranch %31 +%31 = OpLabel +%32 = OpLoad %int %i +%33 = OpSLessThan %bool %32 %int_10 +OpBranchConditional %33 %34 %29 +%34 = OpLabel +OpStore %j %int_0 +OpBranch %35 +%35 = OpLabel +OpLoopMerge %36 %37 None +OpBranch %38 +%38 = OpLabel +%39 = OpLoad %int %j +%40 = OpSLessThan %bool %39 %int_10 +OpBranchConditional %40 %41 %36 +%41 = OpLabel +%42 = OpLoad %int %i +%43 = OpLoad %int %j +%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %42 %43 +%45 = OpLoad %float %44 +%46 = OpFOrdGreaterThan %bool %45 %float_0 +OpSelectionMerge %47 None +OpBranchConditional %46 %48 %47 +%48 = OpLabel +%49 = OpLoad %float %s +%50 = OpFAdd %float %49 %45 +OpStore %s %50 +OpBranch %47 +%47 = OpLabel +OpBranch %37 +%37 = OpLabel +%51 = OpLoad %int %j +%52 = OpIAdd %int %51 %int_1 +OpStore %j %52 +OpBranch %35 +%36 = OpLabel +OpBranch %30 +%30 = OpLabel +%53 = OpLoad %int %i +%54 = OpIAdd %int %53 %int_1 +OpStore %i %54 +OpBranch %28 +%29 = OpLabel +%55 = OpLoad %float %s +OpStore %o %55 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateIfContinue) { + // Do not eliminate continue embedded in if construct + // + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // if (i % 2 == 0) continue; + // s += g_F[i]; + // } + // o = s; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_2 = OpConstant %int 2 +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %10 +%26 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +%31 = OpLoad %int %i +%32 = OpSLessThan %bool %31 %int_10 +OpBranchConditional %32 %33 %28 +%33 = OpLabel +%34 = OpLoad %int %i +%35 = OpSMod %int %34 %int_2 +%36 = OpIEqual %bool %35 %int_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %38 %37 +%38 = OpLabel +OpBranch %29 +%37 = OpLabel +%39 = OpLoad %int %i +%40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %39 +%41 = OpLoad %float %40 +%42 = OpLoad %float %s +%43 = OpFAdd %float %42 %41 +OpStore %s %43 +OpBranch %29 +%29 = OpLabel +%44 = OpLoad %int %i +%45 = OpIAdd %int %44 %int_1 +OpStore %i %45 +OpBranch %27 +%28 = OpLabel +%46 = OpLoad %float %s +OpStore %o %46 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateIfContinue2) { + // Do not eliminate continue not embedded in if construct + // + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // if (i % 2 == 0) continue; + // s += g_F[i]; + // } + // o = s; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_2 = OpConstant %int 2 +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %10 +%26 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +%31 = OpLoad %int %i +%32 = OpSLessThan %bool %31 %int_10 +OpBranchConditional %32 %33 %28 +%33 = OpLabel +%34 = OpLoad %int %i +%35 = OpSMod %int %34 %int_2 +%36 = OpIEqual %bool %35 %int_0 +OpBranchConditional %36 %29 %37 +%37 = OpLabel +%38 = OpLoad %int %i +%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %38 +%40 = OpLoad %float %39 +%41 = OpLoad %float %s +%42 = OpFAdd %float %41 %40 +OpStore %s %42 +OpBranch %29 +%29 = OpLabel +%43 = OpLoad %int %i +%44 = OpIAdd %int %43 %int_1 +OpStore %i %44 +OpBranch %27 +%28 = OpLabel +%45 = OpLoad %float %s +OpStore %o %45 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, NoEliminateIfContinue3) { + // Do not eliminate continue as conditional branch with merge instruction + // Note: SPIR-V edited to add merge instruction before continue. + // + // #version 430 + // + // layout(std430) buffer U_t + // { + // float g_F[10]; + // }; + // + // layout(location = 0)out float o; + // + // void main(void) + // { + // float s = 0.0; + // for (int i=0; i<10; i++) { + // if (i % 2 == 0) continue; + // s += g_F[i]; + // } + // o = s; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %o +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %s "s" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %o "o" +OpDecorate %_arr_float_uint_10 ArrayStride 4 +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpDecorate %o Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_2 = OpConstant %int 2 +%uint = OpTypeInt 32 0 +%uint_10 = OpConstant %uint 10 +%_arr_float_uint_10 = OpTypeArray %float %uint_10 +%U_t = OpTypeStruct %_arr_float_uint_10 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%o = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %10 +%26 = OpLabel +%s = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %s %float_0 +OpStore %i %int_0 +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +%31 = OpLoad %int %i +%32 = OpSLessThan %bool %31 %int_10 +OpBranchConditional %32 %33 %28 +%33 = OpLabel +%34 = OpLoad %int %i +%35 = OpSMod %int %34 %int_2 +%36 = OpIEqual %bool %35 %int_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %29 %37 +%37 = OpLabel +%38 = OpLoad %int %i +%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %38 +%40 = OpLoad %float %39 +%41 = OpLoad %float %s +%42 = OpFAdd %float %41 %40 +OpStore %s %42 +OpBranch %29 +%29 = OpLabel +%43 = OpLoad %int %i +%44 = OpIAdd %int %43 %int_1 +OpStore %i %44 +OpBranch %27 +%28 = OpLabel +%45 = OpLoad %float %s +OpStore %o %45 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(AggressiveDCETest, PointerVariable) { + // ADCE is able to handle code that contains a load whose base address + // comes from a load and not an OpVariable. I want to see an instruction + // removed to be sure that ADCE is not exiting early. + + const std::string before = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +OpDecorate %8 DescriptorSet 0 +OpDecorate %8 Binding 1 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%8 = OpVariable %_ptr_Uniform__struct_6 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%26 = OpLoad %_ptr_Uniform__struct_5 %24 +%27 = OpAccessChain %_ptr_Uniform_v4float %26 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%25 = OpLoad %_ptr_Uniform__struct_5 %24 +%26 = OpAccessChain %_ptr_Uniform_v4float %25 %int_0 %uint_0 %int_0 +%27 = OpLoad %v4float %26 +OpStore %2 %27 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, true, true); +} + +// %dead is unused. Make sure we remove it along with its name. +TEST_F(AggressiveDCETest, RemoveUnreferenced) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %dead "dead" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%dead = OpVariable %_ptr_Private_float Private +%main = OpFunction %void None %5 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%main = OpFunction %void None %5 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +// Delete %dead because it is unreferenced. Then %initializer becomes +// unreferenced, so remove it as well. +TEST_F(AggressiveDCETest, RemoveUnreferencedWithInit1) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %dead "dead" +OpName %initializer "initializer" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%initializer = OpVariable %_ptr_Private_float Private +%dead = OpVariable %_ptr_Private_float Private %initializer +%main = OpFunction %void None %6 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%main = OpFunction %void None %6 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +// Keep %live because it is used, and its initializer. +TEST_F(AggressiveDCETest, KeepReferenced) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %output +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %live "live" +OpName %initializer "initializer" +OpName %output "output" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%initializer = OpVariable %_ptr_Private_float Private +%live = OpVariable %_ptr_Private_float Private %initializer +%_ptr_Output_float = OpTypePointer Output %float +%output = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %6 +%9 = OpLabel +%10 = OpLoad %float %live +OpStore %output %10 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, before, true, true); +} + +// This test that the decoration associated with a variable are removed when the +// variable is removed. +TEST_F(AggressiveDCETest, RemoveVariableAndDecorations) { + const std::string before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 450 +OpName %main "main" +OpName %B "B" +OpMemberName %B 0 "a" +OpName %Bdat "Bdat" +OpMemberDecorate %B 0 Offset 0 +OpDecorate %B BufferBlock +OpDecorate %Bdat DescriptorSet 0 +OpDecorate %Bdat Binding 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%B = OpTypeStruct %uint +%_ptr_Uniform_B = OpTypePointer Uniform %B +%Bdat = OpVariable %_ptr_Uniform_B Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%main = OpFunction %void None %6 +%13 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 450 +OpName %main "main" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%main = OpFunction %void None %6 +%13 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(AggressiveDCETest, DeadNestedSwitch) { + const std::string text = R"( +; CHECK: OpLabel +; CHECK: OpBranch [[block:%\w+]] +; CHECK-NOT: OpSwitch +; CHECK-NEXT: [[block]] = OpLabel +; CHECK: OpBranch [[block:%\w+]] +; CHECK-NOT: OpSwitch +; CHECK-NEXT: [[block]] = OpLabel +; CHECK-NEXT: OpStore +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" %x +OpExecutionMode %func OriginUpperLeft +OpName %func "func" +%void = OpTypeVoid +%1 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_ptr_Output = OpTypePointer Output %uint +%uint_ptr_Input = OpTypePointer Input %uint +%x = OpVariable %uint_ptr_Output Output +%a = OpVariable %uint_ptr_Input Input +%func = OpFunction %void None %1 +%entry = OpLabel +OpBranch %header +%header = OpLabel +%ld = OpLoad %uint %a +OpLoopMerge %merge %continue None +OpBranch %postheader +%postheader = OpLabel +; This switch doesn't require an OpSelectionMerge and is nested in the dead loop. +OpSwitch %ld %merge 0 %extra 1 %continue +%extra = OpLabel +OpBranch %continue +%continue = OpLabel +OpBranch %header +%merge = OpLabel +OpStore %x %uint_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +TEST_F(AggressiveDCETest, LiveNestedSwitch) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" %3 %10 +OpExecutionMode %func OriginUpperLeft +OpName %func "func" +%void = OpTypeVoid +%1 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%_ptr_Input_uint = OpTypePointer Input %uint +%3 = OpVariable %_ptr_Output_uint Output +%10 = OpVariable %_ptr_Input_uint Input +%func = OpFunction %void None %1 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +%13 = OpLoad %uint %10 +OpLoopMerge %14 %15 None +OpBranch %16 +%16 = OpLabel +OpSwitch %13 %14 0 %17 1 %15 +%17 = OpLabel +OpStore %3 %uint_1 +OpBranch %15 +%15 = OpLabel +OpBranch %12 +%14 = OpLabel +OpStore %3 %uint_0 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(text, text, false, true); +} + +TEST_F(AggressiveDCETest, BasicDeleteDeadFunction) { + // The function Dead should be removed because it is never called. + const std::vector common_code = { + // clang-format off + "OpCapability Shader", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\"", + "OpName %main \"main\"", + "OpName %Live \"Live\"", + "%void = OpTypeVoid", + "%7 = OpTypeFunction %void", + "%main = OpFunction %void None %7", + "%15 = OpLabel", + "%16 = OpFunctionCall %void %Live", + "%17 = OpFunctionCall %void %Live", + "OpReturn", + "OpFunctionEnd", + "%Live = OpFunction %void None %7", + "%20 = OpLabel", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + const std::vector dead_function = { + // clang-format off + "%Dead = OpFunction %void None %7", + "%19 = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + JoinAllInsts(Concat(common_code, dead_function)), + JoinAllInsts(common_code), /* skip_nop = */ true); +} + +TEST_F(AggressiveDCETest, BasicKeepLiveFunction) { + // Everything is reachable from an entry point, so no functions should be + // deleted. + const std::vector text = { + // clang-format off + "OpCapability Shader", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\"", + "OpName %main \"main\"", + "OpName %Live1 \"Live1\"", + "OpName %Live2 \"Live2\"", + "%void = OpTypeVoid", + "%7 = OpTypeFunction %void", + "%main = OpFunction %void None %7", + "%15 = OpLabel", + "%16 = OpFunctionCall %void %Live2", + "%17 = OpFunctionCall %void %Live1", + "OpReturn", + "OpFunctionEnd", + "%Live1 = OpFunction %void None %7", + "%19 = OpLabel", + "OpReturn", + "OpFunctionEnd", + "%Live2 = OpFunction %void None %7", + "%20 = OpLabel", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + std::string assembly = JoinAllInsts(text); + auto result = SinglePassRunAndDisassemble( + assembly, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); + EXPECT_EQ(assembly, std::get<0>(result)); +} + +TEST_F(AggressiveDCETest, BasicRemoveDecorationsAndNames) { + // We want to remove the names and decorations associated with results that + // are removed. This test will check for that. + const std::string text = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + OpName %Dead "Dead" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpDecorate %x RelaxedPrecision + OpDecorate %y RelaxedPrecision + OpDecorate %z RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %10 + %14 = OpLabel + OpReturn + OpFunctionEnd + %Dead = OpFunction %void None %10 + %15 = OpLabel + %x = OpVariable %_ptr_Function_float Function + %y = OpVariable %_ptr_Function_float Function + %z = OpVariable %_ptr_Function_float Function + OpStore %x %float_1 + OpStore %y %float_1 + %6 = OpLoad %float %x + %7 = OpLoad %float %y + %8 = OpFAdd %float %6 %7 + OpStore %z %8 + OpReturn + OpFunctionEnd)"; + + const std::string expected_output = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpName %main "main" +%void = OpTypeVoid +%10 = OpTypeFunction %void +%main = OpFunction %void None %10 +%14 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(text, expected_output, + /* skip_nop = */ true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(AggressiveDCETest, BasicAllDeadConstants) { + const std::string text = R"( + ; CHECK-NOT: OpConstant + OpCapability Shader + OpCapability Float64 + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + %void = OpTypeVoid + %4 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %false = OpConstantFalse %bool + %int = OpTypeInt 32 1 + %9 = OpConstant %int 1 + %uint = OpTypeInt 32 0 + %11 = OpConstant %uint 2 + %float = OpTypeFloat 32 + %13 = OpConstant %float 3.1415 + %double = OpTypeFloat 64 + %15 = OpConstant %double 3.14159265358979 + %main = OpFunction %void None %4 + %16 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +TEST_F(AggressiveDCETest, BasicNoneDeadConstants) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\" %btv %bfv %iv %uv %fv %dv", + "OpName %main \"main\"", + "OpName %btv \"btv\"", + "OpName %bfv \"bfv\"", + "OpName %iv \"iv\"", + "OpName %uv \"uv\"", + "OpName %fv \"fv\"", + "OpName %dv \"dv\"", + "%void = OpTypeVoid", + "%10 = OpTypeFunction %void", + "%bool = OpTypeBool", + "%_ptr_Output_bool = OpTypePointer Output %bool", + "%true = OpConstantTrue %bool", + "%false = OpConstantFalse %bool", + "%int = OpTypeInt 32 1", + "%_ptr_Output_int = OpTypePointer Output %int", + "%int_1 = OpConstant %int 1", + "%uint = OpTypeInt 32 0", + "%_ptr_Output_uint = OpTypePointer Output %uint", + "%uint_2 = OpConstant %uint 2", + "%float = OpTypeFloat 32", + "%_ptr_Output_float = OpTypePointer Output %float", + "%float_3_1415 = OpConstant %float 3.1415", + "%double = OpTypeFloat 64", + "%_ptr_Output_double = OpTypePointer Output %double", + "%double_3_14159265358979 = OpConstant %double 3.14159265358979", + "%btv = OpVariable %_ptr_Output_bool Output", + "%bfv = OpVariable %_ptr_Output_bool Output", + "%iv = OpVariable %_ptr_Output_int Output", + "%uv = OpVariable %_ptr_Output_uint Output", + "%fv = OpVariable %_ptr_Output_float Output", + "%dv = OpVariable %_ptr_Output_double Output", + "%main = OpFunction %void None %10", + "%27 = OpLabel", + "OpStore %btv %true", + "OpStore %bfv %false", + "OpStore %iv %int_1", + "OpStore %uv %uint_2", + "OpStore %fv %float_3_1415", + "OpStore %dv %double_3_14159265358979", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + // All constants are used, so none of them should be eliminated. + SinglePassRunAndCheck( + JoinAllInsts(text), JoinAllInsts(text), /* skip_nop = */ true); +} + +struct EliminateDeadConstantTestCase { + // Type declarations and constants that should be kept. + std::vector used_consts; + // Instructions that refer to constants, this is added to create uses for + // some constants so they won't be treated as dead constants. + std::vector main_insts; + // Dead constants that should be removed. + std::vector dead_consts; + // Expectations + std::vector checks; +}; + +// All types that are potentially required in EliminateDeadConstantTest. +const std::vector CommonTypes = { + // clang-format off + // scalar types + "%bool = OpTypeBool", + "%uint = OpTypeInt 32 0", + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%double = OpTypeFloat 64", + // vector types + "%v2bool = OpTypeVector %bool 2", + "%v2uint = OpTypeVector %uint 2", + "%v2int = OpTypeVector %int 2", + "%v3int = OpTypeVector %int 3", + "%v4int = OpTypeVector %int 4", + "%v2float = OpTypeVector %float 2", + "%v3float = OpTypeVector %float 3", + "%v2double = OpTypeVector %double 2", + // variable pointer types + "%_pf_bool = OpTypePointer Output %bool", + "%_pf_uint = OpTypePointer Output %uint", + "%_pf_int = OpTypePointer Output %int", + "%_pf_float = OpTypePointer Output %float", + "%_pf_double = OpTypePointer Output %double", + "%_pf_v2int = OpTypePointer Output %v2int", + "%_pf_v3int = OpTypePointer Output %v3int", + "%_pf_v2float = OpTypePointer Output %v2float", + "%_pf_v3float = OpTypePointer Output %v3float", + "%_pf_v2double = OpTypePointer Output %v2double", + // struct types + "%inner_struct = OpTypeStruct %bool %int %float %double", + "%outer_struct = OpTypeStruct %inner_struct %int %double", + "%flat_struct = OpTypeStruct %bool %int %float %double", + // clang-format on +}; + +using EliminateDeadConstantTest = + PassTest<::testing::TestWithParam>; + +#ifdef SPIRV_EFFCEE +TEST_P(EliminateDeadConstantTest, Custom) { + auto& tc = GetParam(); + AssemblyBuilder builder; + builder.AppendTypesConstantsGlobals(CommonTypes) + .AppendTypesConstantsGlobals(tc.used_consts) + .AppendInMain(tc.main_insts); + const std::string expected = builder.GetCode(); + builder.AppendTypesConstantsGlobals(tc.dead_consts); + builder.PrependPreamble(tc.checks); + const std::string assembly_with_dead_const = builder.GetCode(); + + // Do not enable validation. As the input code is invalid from the base + // tests (ported from other passes). + SinglePassRunAndMatch(assembly_with_dead_const, false); +} + +INSTANTIATE_TEST_CASE_P( + ScalarTypeConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Scalar type constants, one dead constant and one used constant. + { + /* .used_consts = */ + { + "%used_const_int = OpConstant %int 1", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "OpStore %int_var %used_const_int", + }, + /* .dead_consts = */ + { + "%dead_const_int = OpConstant %int 1", + }, + /* .checks = */ + { + "; CHECK: [[const:%\\w+]] = OpConstant %int 1", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + { + /* .used_consts = */ + { + "%used_const_uint = OpConstant %uint 1", + }, + /* .main_insts = */ + { + "%uint_var = OpVariable %_pf_uint Output", + "OpStore %uint_var %used_const_uint", + }, + /* .dead_consts = */ + { + "%dead_const_uint = OpConstant %uint 1", + }, + /* .checks = */ + { + "; CHECK: [[const:%\\w+]] = OpConstant %uint 1", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + { + /* .used_consts = */ + { + "%used_const_float = OpConstant %float 3.1415", + }, + /* .main_insts = */ + { + "%float_var = OpVariable %_pf_float Output", + "OpStore %float_var %used_const_float", + }, + /* .dead_consts = */ + { + "%dead_const_float = OpConstant %float 3.1415", + }, + /* .checks = */ + { + "; CHECK: [[const:%\\w+]] = OpConstant %float 3.1415", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + { + /* .used_consts = */ + { + "%used_const_double = OpConstant %double 3.14", + }, + /* .main_insts = */ + { + "%double_var = OpVariable %_pf_double Output", + "OpStore %double_var %used_const_double", + }, + /* .dead_consts = */ + { + "%dead_const_double = OpConstant %double 3.14", + }, + /* .checks = */ + { + "; CHECK: [[const:%\\w+]] = OpConstant %double 3.14", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + VectorTypeConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Tests eliminating dead constant type ivec2. One dead constant vector + // and one used constant vector, each built from its own group of + // scalar constants. + { + /* .used_consts = */ + { + "%used_int_x = OpConstant %int 1", + "%used_int_y = OpConstant %int 2", + "%used_v2int = OpConstantComposite %v2int %used_int_x %used_int_y", + }, + /* .main_insts = */ + { + "%v2int_var = OpVariable %_pf_v2int Output", + "OpStore %v2int_var %used_v2int", + }, + /* .dead_consts = */ + { + "%dead_int_x = OpConstant %int 1", + "%dead_int_y = OpConstant %int 2", + "%dead_v2int = OpConstantComposite %v2int %dead_int_x %dead_int_y", + }, + /* .checks = */ + { + "; CHECK: [[constx:%\\w+]] = OpConstant %int 1", + "; CHECK: [[consty:%\\w+]] = OpConstant %int 2", + "; CHECK: [[const:%\\w+]] = OpConstantComposite %v2int [[constx]] [[consty]]", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + // Tests eliminating dead constant ivec3. One dead constant vector and + // one used constant vector. But both built from a same group of + // scalar constants. + { + /* .used_consts = */ + { + "%used_int_x = OpConstant %int 1", + "%used_int_y = OpConstant %int 2", + "%used_int_z = OpConstant %int 3", + "%used_v3int = OpConstantComposite %v3int %used_int_x %used_int_y %used_int_z", + }, + /* .main_insts = */ + { + "%v3int_var = OpVariable %_pf_v3int Output", + "OpStore %v3int_var %used_v3int", + }, + /* .dead_consts = */ + { + "%dead_v3int = OpConstantComposite %v3int %used_int_x %used_int_y %used_int_z", + }, + /* .checks = */ + { + "; CHECK: [[constx:%\\w+]] = OpConstant %int 1", + "; CHECK: [[consty:%\\w+]] = OpConstant %int 2", + "; CHECK: [[constz:%\\w+]] = OpConstant %int 3", + "; CHECK: [[const:%\\w+]] = OpConstantComposite %v3int [[constx]] [[consty]] [[constz]]", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + // Tests eliminating dead constant vec2. One dead constant vector and + // one used constant vector. Each built from its own group of scalar + // constants. + { + /* .used_consts = */ + { + "%used_float_x = OpConstant %float 3.1415", + "%used_float_y = OpConstant %float 4.13", + "%used_v2float = OpConstantComposite %v2float %used_float_x %used_float_y", + }, + /* .main_insts = */ + { + "%v2float_var = OpVariable %_pf_v2float Output", + "OpStore %v2float_var %used_v2float", + }, + /* .dead_consts = */ + { + "%dead_float_x = OpConstant %float 3.1415", + "%dead_float_y = OpConstant %float 4.13", + "%dead_v2float = OpConstantComposite %v2float %dead_float_x %dead_float_y", + }, + /* .checks = */ + { + "; CHECK: [[constx:%\\w+]] = OpConstant %float 3.1415", + "; CHECK: [[consty:%\\w+]] = OpConstant %float 4.13", + "; CHECK: [[const:%\\w+]] = OpConstantComposite %v2float [[constx]] [[consty]]", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + // Tests eliminating dead constant vec3. One dead constant vector and + // one used constant vector. Both built from a same group of scalar + // constants. + { + /* .used_consts = */ + { + "%used_float_x = OpConstant %float 3.1415", + "%used_float_y = OpConstant %float 4.25", + "%used_float_z = OpConstant %float 4.75", + "%used_v3float = OpConstantComposite %v3float %used_float_x %used_float_y %used_float_z", + }, + /* .main_insts = */ + { + "%v3float_var = OpVariable %_pf_v3float Output", + "OpStore %v3float_var %used_v3float", + }, + /* .dead_consts = */ + { + "%dead_v3float = OpConstantComposite %v3float %used_float_x %used_float_y %used_float_z", + }, + /* .checks = */ + { + "; CHECK: [[constx:%\\w+]] = OpConstant %float 3.1415", + "; CHECK: [[consty:%\\w+]] = OpConstant %float 4.25", + "; CHECK: [[constz:%\\w+]] = OpConstant %float 4.75", + "; CHECK: [[const:%\\w+]] = OpConstantComposite %v3float [[constx]] [[consty]]", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[const]]", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + StructTypeConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // A plain struct type dead constants. All of its components are dead + // constants too. + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_int = OpConstant %int 1", + "%dead_float = OpConstant %float 2.5", + "%dead_double = OpConstant %double 3.14159265358979", + "%dead_struct = OpConstantComposite %flat_struct %dead_bool %dead_int %dead_float %dead_double", + }, + /* .checks = */ + { + "; CHECK-NOT: OpConstant", + }, + }, + // A plain struct type dead constants. Some of its components are dead + // constants while others are not. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 1", + "%used_double = OpConstant %double 3.14159265358979", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "OpStore %int_var %used_int", + "%double_var = OpVariable %_pf_double Output", + "OpStore %double_var %used_double", + }, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_float = OpConstant %float 2.5", + "%dead_struct = OpConstantComposite %flat_struct %dead_bool %used_int %dead_float %used_double", + }, + /* .checks = */ + { + "; CHECK: [[int:%\\w+]] = OpConstant %int 1", + "; CHECK: [[double:%\\w+]] = OpConstant %double 3.14159265358979", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[int]]", + "; CHECK: OpStore {{%\\w+}} [[double]]", + }, + }, + // A nesting struct type dead constants. All components of both outer + // and inner structs are dead and should be removed after dead constant + // elimination. + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_int = OpConstant %int 1", + "%dead_float = OpConstant %float 2.5", + "%dead_double = OpConstant %double 3.1415926535", + "%dead_inner_struct = OpConstantComposite %inner_struct %dead_bool %dead_int %dead_float %dead_double", + "%dead_int2 = OpConstant %int 2", + "%dead_double2 = OpConstant %double 1.428571428514", + "%dead_outer_struct = OpConstantComposite %outer_struct %dead_inner_struct %dead_int2 %dead_double2", + }, + /* .checks = */ + { + "; CHECK-NOT: OpConstant", + }, + }, + // A nesting struct type dead constants. Some of its components are + // dead constants while others are not. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 1", + "%used_double = OpConstant %double 3.14159265358979", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "OpStore %int_var %used_int", + "%double_var = OpVariable %_pf_double Output", + "OpStore %double_var %used_double", + }, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_float = OpConstant %float 2.5", + "%dead_inner_struct = OpConstantComposite %inner_struct %dead_bool %used_int %dead_float %used_double", + "%dead_int = OpConstant %int 2", + "%dead_outer_struct = OpConstantComposite %outer_struct %dead_inner_struct %dead_int %used_double", + }, + /* .checks = */ + { + "; CHECK: [[int:%\\w+]] = OpConstant %int 1", + "; CHECK: [[double:%\\w+]] = OpConstant %double 3.14159265358979", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[int]]", + "; CHECK: OpStore {{%\\w+}} [[double]]", + }, + }, + // A nesting struct case. The inner struct is used while the outer struct is not + { + /* .used_const = */ + { + "%used_bool = OpConstantTrue %bool", + "%used_int = OpConstant %int 1", + "%used_float = OpConstant %float 1.23", + "%used_double = OpConstant %double 1.2345678901234", + "%used_inner_struct = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double", + }, + /* .main_insts = */ + { + "%bool_var = OpVariable %_pf_bool Output", + "%bool_from_inner_struct = OpCompositeExtract %bool %used_inner_struct 0", + "OpStore %bool_var %bool_from_inner_struct", + }, + /* .dead_consts = */ + { + "%dead_int = OpConstant %int 2", + "%dead_outer_struct = OpConstantComposite %outer_struct %used_inner_struct %dead_int %used_double" + }, + /* .checks = */ + { + "; CHECK: [[bool:%\\w+]] = OpConstantTrue", + "; CHECK: [[int:%\\w+]] = OpConstant %int 1", + "; CHECK: [[float:%\\w+]] = OpConstant %float 1.23", + "; CHECK: [[double:%\\w+]] = OpConstant %double 1.2345678901234", + "; CHECK: [[struct:%\\w+]] = OpConstantComposite %inner_struct [[bool]] [[int]] [[float]] [[double]]", + "; CHECK-NOT: OpConstant", + "; CHECK: OpCompositeExtract %bool [[struct]]", + } + }, + // A nesting struct case. The outer struct is used, so the inner struct should not + // be removed even though it is not used anywhere. + { + /* .used_const = */ + { + "%used_bool = OpConstantTrue %bool", + "%used_int = OpConstant %int 1", + "%used_float = OpConstant %float 1.23", + "%used_double = OpConstant %double 1.2345678901234", + "%used_inner_struct = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double", + "%used_outer_struct = OpConstantComposite %outer_struct %used_inner_struct %used_int %used_double" + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "%int_from_outer_struct = OpCompositeExtract %int %used_outer_struct 1", + "OpStore %int_var %int_from_outer_struct", + }, + /* .dead_consts = */ {}, + /* .checks = */ + { + "; CHECK: [[bool:%\\w+]] = OpConstantTrue %bool", + "; CHECK: [[int:%\\w+]] = OpConstant %int 1", + "; CHECK: [[float:%\\w+]] = OpConstant %float 1.23", + "; CHECK: [[double:%\\w+]] = OpConstant %double 1.2345678901234", + "; CHECK: [[inner_struct:%\\w+]] = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double", + "; CHECK: [[outer_struct:%\\w+]] = OpConstantComposite %outer_struct %used_inner_struct %used_int %used_double", + "; CHECK: OpCompositeExtract %int [[outer_struct]]", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + ScalarTypeSpecConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // All scalar type spec constants. + { + /* .used_consts = */ + { + "%used_bool = OpSpecConstantTrue %bool", + "%used_uint = OpSpecConstant %uint 2", + "%used_int = OpSpecConstant %int 2", + "%used_float = OpSpecConstant %float 2.5", + "%used_double = OpSpecConstant %double 1.428571428514", + }, + /* .main_insts = */ + { + "%bool_var = OpVariable %_pf_bool Output", + "%uint_var = OpVariable %_pf_uint Output", + "%int_var = OpVariable %_pf_int Output", + "%float_var = OpVariable %_pf_float Output", + "%double_var = OpVariable %_pf_double Output", + "OpStore %bool_var %used_bool", + "OpStore %uint_var %used_uint", + "OpStore %int_var %used_int", + "OpStore %float_var %used_float", + "OpStore %double_var %used_double", + }, + /* .dead_consts = */ + { + "%dead_bool = OpSpecConstantTrue %bool", + "%dead_uint = OpSpecConstant %uint 2", + "%dead_int = OpSpecConstant %int 2", + "%dead_float = OpSpecConstant %float 2.5", + "%dead_double = OpSpecConstant %double 1.428571428514", + }, + /* .checks = */ + { + "; CHECK: [[bool:%\\w+]] = OpSpecConstantTrue %bool", + "; CHECK: [[uint:%\\w+]] = OpSpecConstant %uint 2", + "; CHECK: [[int:%\\w+]] = OpSpecConstant %int 2", + "; CHECK: [[float:%\\w+]] = OpSpecConstant %float 2.5", + "; CHECK: [[double:%\\w+]] = OpSpecConstant %double 1.428571428514", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[bool]]", + "; CHECK: OpStore {{%\\w+}} [[uint]]", + "; CHECK: OpStore {{%\\w+}} [[int]]", + "; CHECK: OpStore {{%\\w+}} [[float]]", + "; CHECK: OpStore {{%\\w+}} [[double]]", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + VectorTypeSpecConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Bool vector type spec constants. One vector has all component dead, + // another vector has one dead boolean and one used boolean. + { + /* .used_consts = */ + { + "%used_bool = OpSpecConstantTrue %bool", + }, + /* .main_insts = */ + { + "%bool_var = OpVariable %_pf_bool Output", + "OpStore %bool_var %used_bool", + }, + /* .dead_consts = */ + { + "%dead_bool = OpSpecConstantFalse %bool", + "%dead_bool_vec1 = OpSpecConstantComposite %v2bool %dead_bool %dead_bool", + "%dead_bool_vec2 = OpSpecConstantComposite %v2bool %dead_bool %used_bool", + }, + /* .checks = */ + { + "; CHECK: [[bool:%\\w+]] = OpSpecConstantTrue %bool", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[bool]]", + }, + }, + + // Uint vector type spec constants. One vector has all component dead, + // another vector has one dead unsigend integer and one used unsigned + // integer. + { + /* .used_consts = */ + { + "%used_uint = OpSpecConstant %uint 3", + }, + /* .main_insts = */ + { + "%uint_var = OpVariable %_pf_uint Output", + "OpStore %uint_var %used_uint", + }, + /* .dead_consts = */ + { + "%dead_uint = OpSpecConstant %uint 1", + "%dead_uint_vec1 = OpSpecConstantComposite %v2uint %dead_uint %dead_uint", + "%dead_uint_vec2 = OpSpecConstantComposite %v2uint %dead_uint %used_uint", + }, + /* .checks = */ + { + "; CHECK: [[uint:%\\w+]] = OpSpecConstant %uint 3", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[uint]]", + }, + }, + + // Int vector type spec constants. One vector has all component dead, + // another vector has one dead integer and one used integer. + { + /* .used_consts = */ + { + "%used_int = OpSpecConstant %int 3", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "OpStore %int_var %used_int", + }, + /* .dead_consts = */ + { + "%dead_int = OpSpecConstant %int 1", + "%dead_int_vec1 = OpSpecConstantComposite %v2int %dead_int %dead_int", + "%dead_int_vec2 = OpSpecConstantComposite %v2int %dead_int %used_int", + }, + /* .checks = */ + { + "; CHECK: [[int:%\\w+]] = OpSpecConstant %int 3", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[int]]", + }, + }, + + // Int vector type spec constants built with both spec constants and + // front-end constants. + { + /* .used_consts = */ + { + "%used_spec_int = OpSpecConstant %int 3", + "%used_front_end_int = OpConstant %int 3", + }, + /* .main_insts = */ + { + "%int_var1 = OpVariable %_pf_int Output", + "OpStore %int_var1 %used_spec_int", + "%int_var2 = OpVariable %_pf_int Output", + "OpStore %int_var2 %used_front_end_int", + }, + /* .dead_consts = */ + { + "%dead_spec_int = OpSpecConstant %int 1", + "%dead_front_end_int = OpConstant %int 1", + // Dead front-end and dead spec constants + "%dead_int_vec1 = OpSpecConstantComposite %v2int %dead_spec_int %dead_front_end_int", + // Used front-end and dead spec constants + "%dead_int_vec2 = OpSpecConstantComposite %v2int %dead_spec_int %used_front_end_int", + // Dead front-end and used spec constants + "%dead_int_vec3 = OpSpecConstantComposite %v2int %dead_front_end_int %used_spec_int", + }, + /* .checks = */ + { + "; CHECK: [[int1:%\\w+]] = OpSpecConstant %int 3", + "; CHECK: [[int2:%\\w+]] = OpConstant %int 3", + "; CHECK-NOT: OpSpecConstant", + "; CHECK-NOT: OpConstant", + "; CHECK: OpStore {{%\\w+}} [[int1]]", + "; CHECK: OpStore {{%\\w+}} [[int2]]", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + SpecConstantOp, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Cast operations: uint <-> int <-> bool + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + // Assistant constants, only used in dead spec constant + // operations. + "%signed_zero = OpConstant %int 0", + "%signed_zero_vec = OpConstantComposite %v2int %signed_zero %signed_zero", + "%unsigned_zero = OpConstant %uint 0", + "%unsigned_zero_vec = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + "%signed_one = OpConstant %int 1", + "%signed_one_vec = OpConstantComposite %v2int %signed_one %signed_one", + "%unsigned_one = OpConstant %uint 1", + "%unsigned_one_vec = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + + // Spec constants that support casting to each other. + "%dead_bool = OpSpecConstantTrue %bool", + "%dead_uint = OpSpecConstant %uint 1", + "%dead_int = OpSpecConstant %int 2", + "%dead_bool_vec = OpSpecConstantComposite %v2bool %dead_bool %dead_bool", + "%dead_uint_vec = OpSpecConstantComposite %v2uint %dead_uint %dead_uint", + "%dead_int_vec = OpSpecConstantComposite %v2int %dead_int %dead_int", + + // Scalar cast to boolean spec constant. + "%int_to_bool = OpSpecConstantOp %bool INotEqual %dead_int %signed_zero", + "%uint_to_bool = OpSpecConstantOp %bool INotEqual %dead_uint %unsigned_zero", + + // Vector cast to boolean spec constant. + "%int_to_bool_vec = OpSpecConstantOp %v2bool INotEqual %dead_int_vec %signed_zero_vec", + "%uint_to_bool_vec = OpSpecConstantOp %v2bool INotEqual %dead_uint_vec %unsigned_zero_vec", + + // Scalar cast to int spec constant. + "%bool_to_int = OpSpecConstantOp %int Select %dead_bool %signed_one %signed_zero", + "%uint_to_int = OpSpecConstantOp %uint IAdd %dead_uint %unsigned_zero", + + // Vector cast to int spec constant. + "%bool_to_int_vec = OpSpecConstantOp %v2int Select %dead_bool_vec %signed_one_vec %signed_zero_vec", + "%uint_to_int_vec = OpSpecConstantOp %v2uint IAdd %dead_uint_vec %unsigned_zero_vec", + + // Scalar cast to uint spec constant. + "%bool_to_uint = OpSpecConstantOp %uint Select %dead_bool %unsigned_one %unsigned_zero", + "%int_to_uint_vec = OpSpecConstantOp %uint IAdd %dead_int %signed_zero", + + // Vector cast to uint spec constant. + "%bool_to_uint_vec = OpSpecConstantOp %v2uint Select %dead_bool_vec %unsigned_one_vec %unsigned_zero_vec", + "%int_to_uint = OpSpecConstantOp %v2uint IAdd %dead_int_vec %signed_zero_vec", + }, + /* .checks = */ + { + "; CHECK-NOT: OpConstant", + "; CHECK-NOT: OpSpecConstant", + }, + }, + + // Add, sub, mul, div, rem. + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + "%dead_spec_int_a = OpSpecConstant %int 1", + "%dead_spec_int_a_vec = OpSpecConstantComposite %v2int %dead_spec_int_a %dead_spec_int_a", + + "%dead_spec_int_b = OpSpecConstant %int 2", + "%dead_spec_int_b_vec = OpSpecConstantComposite %v2int %dead_spec_int_b %dead_spec_int_b", + + "%dead_const_int_c = OpConstant %int 3", + "%dead_const_int_c_vec = OpConstantComposite %v2int %dead_const_int_c %dead_const_int_c", + + // Add + "%add_a_b = OpSpecConstantOp %int IAdd %dead_spec_int_a %dead_spec_int_b", + "%add_a_b_vec = OpSpecConstantOp %v2int IAdd %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Sub + "%sub_a_b = OpSpecConstantOp %int ISub %dead_spec_int_a %dead_spec_int_b", + "%sub_a_b_vec = OpSpecConstantOp %v2int ISub %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Mul + "%mul_a_b = OpSpecConstantOp %int IMul %dead_spec_int_a %dead_spec_int_b", + "%mul_a_b_vec = OpSpecConstantOp %v2int IMul %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Div + "%div_a_b = OpSpecConstantOp %int SDiv %dead_spec_int_a %dead_spec_int_b", + "%div_a_b_vec = OpSpecConstantOp %v2int SDiv %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Bitwise Xor + "%xor_a_b = OpSpecConstantOp %int BitwiseXor %dead_spec_int_a %dead_spec_int_b", + "%xor_a_b_vec = OpSpecConstantOp %v2int BitwiseXor %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Scalar Comparison + "%less_a_b = OpSpecConstantOp %bool SLessThan %dead_spec_int_a %dead_spec_int_b", + }, + /* .checks = */ + { + "; CHECK-NOT: OpConstant", + "; CHECK-NOT: OpSpecConstant", + }, + }, + + // Vectors without used swizzles should be removed. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 3", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "OpStore %int_var %used_int", + }, + /* .dead_consts = */ + { + "%dead_int = OpConstant %int 3", + + "%dead_spec_int_a = OpSpecConstant %int 1", + "%vec_a = OpSpecConstantComposite %v4int %dead_spec_int_a %dead_spec_int_a %dead_int %dead_int", + + "%dead_spec_int_b = OpSpecConstant %int 2", + "%vec_b = OpSpecConstantComposite %v4int %dead_spec_int_b %dead_spec_int_b %used_int %used_int", + + // Extract scalar + "%a_x = OpSpecConstantOp %int CompositeExtract %vec_a 0", + "%b_x = OpSpecConstantOp %int CompositeExtract %vec_b 0", + + // Extract vector + "%a_xy = OpSpecConstantOp %v2int VectorShuffle %vec_a %vec_a 0 1", + "%b_xy = OpSpecConstantOp %v2int VectorShuffle %vec_b %vec_b 0 1", + }, + /* .checks = */ + { + "; CHECK: [[int:%\\w+]] = OpConstant %int 3", + "; CHECK-NOT: OpConstant", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[int]]", + }, + }, + // Vectors with used swizzles should not be removed. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 3", + "%used_spec_int_a = OpSpecConstant %int 1", + "%used_spec_int_b = OpSpecConstant %int 2", + // Create vectors + "%vec_a = OpSpecConstantComposite %v4int %used_spec_int_a %used_spec_int_a %used_int %used_int", + "%vec_b = OpSpecConstantComposite %v4int %used_spec_int_b %used_spec_int_b %used_int %used_int", + // Extract vector + "%a_xy = OpSpecConstantOp %v2int VectorShuffle %vec_a %vec_a 0 1", + "%b_xy = OpSpecConstantOp %v2int VectorShuffle %vec_b %vec_b 0 1", + }, + /* .main_insts = */ + { + "%v2int_var_a = OpVariable %_pf_v2int Output", + "%v2int_var_b = OpVariable %_pf_v2int Output", + "OpStore %v2int_var_a %a_xy", + "OpStore %v2int_var_b %b_xy", + }, + /* .dead_consts = */ {}, + /* .checks = */ + { + "; CHECK: [[int:%\\w+]] = OpConstant %int 3", + "; CHECK: [[a:%\\w+]] = OpSpecConstant %int 1", + "; CHECK: [[b:%\\w+]] = OpSpecConstant %int 2", + "; CHECK: [[veca:%\\w+]] = OpSpecConstantComposite %v4int [[a]] [[a]] [[int]] [[int]]", + "; CHECK: [[vecb:%\\w+]] = OpSpecConstantComposite %v4int [[b]] [[b]] [[int]] [[int]]", + "; CHECK: [[exa:%\\w+]] = OpSpecConstantOp %v2int VectorShuffle [[veca]] [[veca]] 0 1", + "; CHECK: [[exb:%\\w+]] = OpSpecConstantOp %v2int VectorShuffle [[vecb]] [[vecb]] 0 1", + "; CHECK-NOT: OpConstant", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[exa]]", + "; CHECK: OpStore {{%\\w+}} [[exb]]", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + LongDefUseChain, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Long Def-Use chain with binary operations. + { + /* .used_consts = */ + { + "%array_size = OpConstant %int 4", + "%type_arr_int_4 = OpTypeArray %int %array_size", + "%used_int_0 = OpConstant %int 100", + "%used_int_1 = OpConstant %int 1", + "%used_int_2 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_1", + "%used_int_3 = OpSpecConstantOp %int ISub %used_int_0 %used_int_2", + "%used_int_4 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_3", + "%used_int_5 = OpSpecConstantOp %int ISub %used_int_0 %used_int_4", + "%used_int_6 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_5", + "%used_int_7 = OpSpecConstantOp %int ISub %used_int_0 %used_int_6", + "%used_int_8 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_7", + "%used_int_9 = OpSpecConstantOp %int ISub %used_int_0 %used_int_8", + "%used_int_10 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_9", + "%used_int_11 = OpSpecConstantOp %int ISub %used_int_0 %used_int_10", + "%used_int_12 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_11", + "%used_int_13 = OpSpecConstantOp %int ISub %used_int_0 %used_int_12", + "%used_int_14 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_13", + "%used_int_15 = OpSpecConstantOp %int ISub %used_int_0 %used_int_14", + "%used_int_16 = OpSpecConstantOp %int ISub %used_int_0 %used_int_15", + "%used_int_17 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_16", + "%used_int_18 = OpSpecConstantOp %int ISub %used_int_0 %used_int_17", + "%used_int_19 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_18", + "%used_int_20 = OpSpecConstantOp %int ISub %used_int_0 %used_int_19", + "%used_vec_a = OpSpecConstantComposite %v2int %used_int_18 %used_int_19", + "%used_vec_b = OpSpecConstantOp %v2int IMul %used_vec_a %used_vec_a", + "%used_int_21 = OpSpecConstantOp %int CompositeExtract %used_vec_b 0", + "%used_array = OpConstantComposite %type_arr_int_4 %used_int_20 %used_int_20 %used_int_21 %used_int_21", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Output", + "%used_array_2 = OpCompositeExtract %int %used_array 2", + "OpStore %int_var %used_array_2", + }, + /* .dead_consts = */ + { + "%dead_int_1 = OpConstant %int 2", + "%dead_int_2 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_1", + "%dead_int_3 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_2", + "%dead_int_4 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_3", + "%dead_int_5 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_4", + "%dead_int_6 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_5", + "%dead_int_7 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_6", + "%dead_int_8 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_7", + "%dead_int_9 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_8", + "%dead_int_10 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_9", + "%dead_int_11 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_10", + "%dead_int_12 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_11", + "%dead_int_13 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_12", + "%dead_int_14 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_13", + "%dead_int_15 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_14", + "%dead_int_16 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_15", + "%dead_int_17 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_16", + "%dead_int_18 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_17", + "%dead_int_19 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_18", + "%dead_int_20 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_19", + "%dead_vec_a = OpSpecConstantComposite %v2int %dead_int_18 %dead_int_19", + "%dead_vec_b = OpSpecConstantOp %v2int IMul %dead_vec_a %dead_vec_a", + "%dead_int_21 = OpSpecConstantOp %int CompositeExtract %dead_vec_b 0", + "%dead_array = OpConstantComposite %type_arr_int_4 %dead_int_20 %used_int_20 %dead_int_19 %used_int_19", + }, + /* .checks = */ + { + "; CHECK: OpConstant %int 4", + "; CHECK: [[array:%\\w+]] = OpConstantComposite %type_arr_int_4 %used_int_20 %used_int_20 %used_int_21 %used_int_21", + "; CHECK-NOT: OpConstant", + "; CHECK-NOT: OpSpecConstant", + "; CHECK: OpStore {{%\\w+}} [[array]]", + }, + }, + // Long Def-Use chain with swizzle + // clang-format on + }))); + +TEST_F(AggressiveDCETest, DeadDecorationGroup) { + // The decoration group should be eliminated because the target of group + // decorate is dead. + const std::string text = R"( +; CHECK-NOT: OpDecorat +; CHECK-NOT: OpGroupDecorate +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpDecorate %1 Restrict +OpDecorate %1 Aliased +%1 = OpDecorationGroup +OpGroupDecorate %1 %var +%void = OpTypeVoid +%func = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_ptr = OpTypePointer Function %uint +%main = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %uint_ptr Function +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(AggressiveDCETest, ParitallyDeadDecorationGroup) { + const std::string text = R"( +; CHECK: OpDecorate [[grp:%\w+]] Restrict +; CHECK: OpDecorate [[grp]] Aliased +; CHECK: [[grp]] = OpDecorationGroup +; CHECK: OpGroupDecorate [[grp]] [[output:%\w+]] +; CHECK: [[output]] = OpVariable {{%\w+}} Output +; CHECK-NOT: OpVariable {{%\w+}} Function +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %output +OpExecutionMode %main OriginUpperLeft +OpDecorate %1 Restrict +OpDecorate %1 Aliased +%1 = OpDecorationGroup +OpGroupDecorate %1 %var %output +%void = OpTypeVoid +%func = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_ptr_Function = OpTypePointer Function %uint +%uint_ptr_Output = OpTypePointer Output %uint +%uint_0 = OpConstant %uint 0 +%output = OpVariable %uint_ptr_Output Output +%main = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %uint_ptr_Function Function +OpStore %output %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(AggressiveDCETest, ParitallyDeadDecorationGroupDifferentGroupDecorate) { + const std::string text = R"( +; CHECK: OpDecorate [[grp:%\w+]] Restrict +; CHECK: OpDecorate [[grp]] Aliased +; CHECK: [[grp]] = OpDecorationGroup +; CHECK: OpGroupDecorate [[grp]] [[output:%\w+]] +; CHECK-NOT: OpGroupDecorate +; CHECK: [[output]] = OpVariable {{%\w+}} Output +; CHECK-NOT: OpVariable {{%\w+}} Function +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %output +OpExecutionMode %main OriginUpperLeft +OpDecorate %1 Restrict +OpDecorate %1 Aliased +%1 = OpDecorationGroup +OpGroupDecorate %1 %output +OpGroupDecorate %1 %var +%void = OpTypeVoid +%func = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%uint_ptr_Function = OpTypePointer Function %uint +%uint_ptr_Output = OpTypePointer Output %uint +%uint_0 = OpConstant %uint 0 +%output = OpVariable %uint_ptr_Output Output +%main = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %uint_ptr_Function Function +OpStore %output %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(AggressiveDCETest, DeadGroupMemberDecorate) { + const std::string text = R"( +; CHECK-NOT: OpDec +; CHECK-NOT: OpGroup +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpDecorate %1 Offset 0 +OpDecorate %1 Uniform +%1 = OpDecorationGroup +OpGroupMemberDecorate %1 %var 0 +%void = OpTypeVoid +%func = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%struct = OpTypeStruct %uint %uint +%struct_ptr = OpTypePointer Function %struct +%main = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct_ptr Function +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(AggressiveDCETest, PartiallyDeadGroupMemberDecorate) { + const std::string text = R"( +; CHECK: OpDecorate [[grp:%\w+]] Offset 0 +; CHECK: OpDecorate [[grp]] Uniform +; CHECK: [[grp]] = OpDecorationGroup +; CHECK: OpGroupMemberDecorate [[grp]] [[output:%\w+]] 1 +; CHECK: [[output]] = OpTypeStruct +; CHECK-NOT: OpTypeStruct +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %output +OpExecutionMode %main OriginUpperLeft +OpDecorate %1 Offset 0 +OpDecorate %1 Uniform +%1 = OpDecorationGroup +OpGroupMemberDecorate %1 %var_struct 0 %output_struct 1 +%void = OpTypeVoid +%func = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%var_struct = OpTypeStruct %uint %uint +%output_struct = OpTypeStruct %uint %uint +%struct_ptr_Function = OpTypePointer Function %var_struct +%struct_ptr_Output = OpTypePointer Output %output_struct +%uint_ptr_Output = OpTypePointer Output %uint +%output = OpVariable %struct_ptr_Output Output +%uint_0 = OpConstant %uint 0 +%main = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct_ptr_Function Function +%3 = OpAccessChain %uint_ptr_Output %output %uint_0 +OpStore %3 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(AggressiveDCETest, + PartiallyDeadGroupMemberDecorateDifferentGroupDecorate) { + const std::string text = R"( +; CHECK: OpDecorate [[grp:%\w+]] Offset 0 +; CHECK: OpDecorate [[grp]] Uniform +; CHECK: [[grp]] = OpDecorationGroup +; CHECK: OpGroupMemberDecorate [[grp]] [[output:%\w+]] 1 +; CHECK-NOT: OpGroupMemberDecorate +; CHECK: [[output]] = OpTypeStruct +; CHECK-NOT: OpTypeStruct +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %output +OpExecutionMode %main OriginUpperLeft +OpDecorate %1 Offset 0 +OpDecorate %1 Uniform +%1 = OpDecorationGroup +OpGroupMemberDecorate %1 %var_struct 0 +OpGroupMemberDecorate %1 %output_struct 1 +%void = OpTypeVoid +%func = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%var_struct = OpTypeStruct %uint %uint +%output_struct = OpTypeStruct %uint %uint +%struct_ptr_Function = OpTypePointer Function %var_struct +%struct_ptr_Output = OpTypePointer Output %output_struct +%uint_ptr_Output = OpTypePointer Output %uint +%output = OpVariable %struct_ptr_Output Output +%uint_0 = OpConstant %uint 0 +%main = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct_ptr_Function Function +%3 = OpAccessChain %uint_ptr_Output %output %uint_0 +OpStore %3 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +// Test for #1404 +TEST_F(AggressiveDCETest, DontRemoveWorkgroupSize) { + const std::string text = R"( +; CHECK: OpDecorate [[wgs:%\w+]] BuiltIn WorkgroupSize +; CHECK: [[wgs]] = OpSpecConstantComposite +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %func "func" +OpExecutionMode %func LocalSize 1 1 1 +OpDecorate %1 BuiltIn WorkgroupSize +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%functy = OpTypeFunction %void +%v3int = OpTypeVector %int 3 +%2 = OpSpecConstant %int 1 +%1 = OpSpecConstantComposite %v3int %2 %2 %2 +%func = OpFunction %void None %functy +%3 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +// Test for #1214 +TEST_F(AggressiveDCETest, LoopHeaderIsAlsoAnotherLoopMerge) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" %2 +OpExecutionMode %1 OriginUpperLeft +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%uint_0 = OpConstant %uint 0 +%9 = OpTypeFunction %void +%1 = OpFunction %void None %9 +%10 = OpLabel +OpBranch %11 +%11 = OpLabel +OpLoopMerge %12 %13 None +OpBranchConditional %true %14 %13 +%14 = OpLabel +OpStore %2 %uint_0 +OpLoopMerge %15 %16 None +OpBranchConditional %true %15 %16 +%16 = OpLabel +OpBranch %14 +%15 = OpLabel +OpBranchConditional %true %12 %13 +%13 = OpLabel +OpBranch %11 +%12 = OpLabel +%17 = OpPhi %uint %uint_0 %15 %uint_0 %18 +OpStore %2 %17 +OpLoopMerge %19 %18 None +OpBranchConditional %true %19 %18 +%18 = OpLabel +OpBranch %12 +%19 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(AggressiveDCETest, BreaksDontVisitPhis) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" %var +OpExecutionMode %func OriginUpperLeft +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int = OpTypeInt 32 0 +%int_ptr_Output = OpTypePointer Output %int +%var = OpVariable %int_ptr_Output Output +%int0 = OpConstant %int 0 +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpBranch %outer_header +%outer_header = OpLabel +OpLoopMerge %outer_merge %outer_continue None +OpBranchConditional %true %inner_header %outer_continue +%inner_header = OpLabel +%phi = OpPhi %int %int0 %outer_header %int0 %inner_continue +OpStore %var %phi +OpLoopMerge %inner_merge %inner_continue None +OpBranchConditional %true %inner_merge %inner_continue +%inner_continue = OpLabel +OpBranch %inner_header +%inner_merge = OpLabel +OpBranch %outer_continue +%outer_continue = OpLabel +%p = OpPhi %int %int0 %outer_header %int0 %inner_merge +OpStore %var %p +OpBranch %outer_header +%outer_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, + std::get<1>(SinglePassRunAndDisassemble( + text, false, true))); +} + +// Test for #1212 +TEST_F(AggressiveDCETest, ConstStoreInnerLoop) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "main" %2 +%void = OpTypeVoid +%4 = OpTypeFunction %void +%float = OpTypeFloat 32 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%_ptr_Output_float = OpTypePointer Output %float +%2 = OpVariable %_ptr_Output_float Output +%float_3 = OpConstant %float 3 +%1 = OpFunction %void None %4 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +OpLoopMerge %15 %16 None +OpBranchConditional %true %17 %15 +%17 = OpLabel +OpStore %2 %float_3 +OpLoopMerge %18 %17 None +OpBranchConditional %true %18 %17 +%18 = OpLabel +OpBranch %15 +%16 = OpLabel +OpBranch %14 +%15 = OpLabel +OpBranch %20 +%20 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(text, text, true, true); +} + +// Test for #1212 +TEST_F(AggressiveDCETest, InnerLoopCopy) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "main" %2 %3 +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%_ptr_Output_float = OpTypePointer Output %float +%_ptr_Input_float = OpTypePointer Input %float +%2 = OpVariable %_ptr_Output_float Output +%3 = OpVariable %_ptr_Input_float Input +%1 = OpFunction %void None %5 +%14 = OpLabel +OpBranch %15 +%15 = OpLabel +OpLoopMerge %16 %17 None +OpBranchConditional %true %18 %16 +%18 = OpLabel +%19 = OpLoad %float %3 +OpStore %2 %19 +OpLoopMerge %20 %18 None +OpBranchConditional %true %20 %18 +%20 = OpLabel +OpBranch %16 +%17 = OpLabel +OpBranch %15 +%16 = OpLabel +OpBranch %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(AggressiveDCETest, AtomicAdd) { + const std::string text = R"(OpCapability SampledBuffer +OpCapability StorageImageExtendedFormats +OpCapability ImageBuffer +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %2 "min" %gl_GlobalInvocationID +OpExecutionMode %2 LocalSize 64 1 1 +OpSource HLSL 600 +OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId +OpDecorate %4 DescriptorSet 4 +OpDecorate %4 Binding 70 +%uint = OpTypeInt 32 0 +%6 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6 +%_ptr_Private_6 = OpTypePointer Private %6 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Image_uint = OpTypePointer Image %uint +%4 = OpVariable %_ptr_UniformConstant_6 UniformConstant +%16 = OpVariable %_ptr_Private_6 Private +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%2 = OpFunction %void None %10 +%17 = OpLabel +%18 = OpLoad %6 %4 +OpStore %16 %18 +%19 = OpImageTexelPointer %_ptr_Image_uint %16 %uint_0 %uint_0 +%20 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %uint_1 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(AggressiveDCETest, SafelyRemoveDecorateString) { + const std::string preamble = R"(OpCapability Shader +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" +)"; + + const std::string body_before = + R"(OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "FOOBAR" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint +%2 = OpVariable %_ptr_StorageBuffer_uint StorageBuffer +%1 = OpFunction %void None %4 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string body_after = R"(%void = OpTypeVoid +%4 = OpTypeFunction %void +%1 = OpFunction %void None %4 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(preamble + body_before, + preamble + body_after, true, true); +} + +TEST_F(AggressiveDCETest, CopyMemoryToGlobal) { + // |local| is loaded in an OpCopyMemory instruction. So the store must be + // kept alive. + const std::string test = + R"(OpCapability Geometry +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Geometry %main "main" %global +OpExecutionMode %main Triangles +OpExecutionMode %main Invocations 1 +OpExecutionMode %main OutputTriangleStrip +OpExecutionMode %main OutputVertices 5 +OpSource GLSL 440 +OpName %main "main" +OpName %local "local" +OpName %global "global" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%12 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%global = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%19 = OpLabel +%local = OpVariable %_ptr_Function_v4float Function +OpStore %local %12 +OpCopyMemory %global %local +OpEndPrimitive +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(test, test, true, true); +} + +TEST_F(AggressiveDCETest, CopyMemoryToLocal) { + // Make sure the store to |local2| using OpCopyMemory is kept and keeps + // |local1| alive. + const std::string test = + R"(OpCapability Geometry +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Geometry %main "main" %global +OpExecutionMode %main Triangles +OpExecutionMode %main Invocations 1 +OpExecutionMode %main OutputTriangleStrip +OpExecutionMode %main OutputVertices 5 +OpSource GLSL 440 +OpName %main "main" +OpName %local1 "local1" +OpName %local2 "local2" +OpName %global "global" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%12 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%global = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%19 = OpLabel +%local1 = OpVariable %_ptr_Function_v4float Function +%local2 = OpVariable %_ptr_Function_v4float Function +OpStore %local1 %12 +OpCopyMemory %local2 %local1 +OpCopyMemory %global %local2 +OpEndPrimitive +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(test, test, true, true); +} + +TEST_F(AggressiveDCETest, RemoveCopyMemoryToLocal) { + // Test that we remove function scope variables that are stored to using + // OpCopyMemory, but are never loaded. We can remove both |local1| and + // |local2|. + const std::string test = + R"(OpCapability Geometry +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Geometry %main "main" %global +OpExecutionMode %main Triangles +OpExecutionMode %main Invocations 1 +OpExecutionMode %main OutputTriangleStrip +OpExecutionMode %main OutputVertices 5 +OpSource GLSL 440 +OpName %main "main" +OpName %local1 "local1" +OpName %local2 "local2" +OpName %global "global" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%12 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%global = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%19 = OpLabel +%local1 = OpVariable %_ptr_Function_v4float Function +%local2 = OpVariable %_ptr_Function_v4float Function +OpStore %local1 %12 +OpCopyMemory %local2 %local1 +OpEndPrimitive +OpReturn +OpFunctionEnd +)"; + + const std::string result = + R"(OpCapability Geometry +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Geometry %main "main" %global +OpExecutionMode %main Triangles +OpExecutionMode %main Invocations 1 +OpExecutionMode %main OutputTriangleStrip +OpExecutionMode %main OutputVertices 5 +OpSource GLSL 440 +OpName %main "main" +OpName %global "global" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%global = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%19 = OpLabel +OpEndPrimitive +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(test, result, true, true); +} + +TEST_F(AggressiveDCETest, RemoveCopyMemoryToLocal2) { + // We are able to remove "local2" because it is not loaded, but have to keep + // the stores to "local1". + const std::string test = + R"(OpCapability Geometry +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Geometry %main "main" %global +OpExecutionMode %main Triangles +OpExecutionMode %main Invocations 1 +OpExecutionMode %main OutputTriangleStrip +OpExecutionMode %main OutputVertices 5 +OpSource GLSL 440 +OpName %main "main" +OpName %local1 "local1" +OpName %local2 "local2" +OpName %global "global" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%12 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%global = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%19 = OpLabel +%local1 = OpVariable %_ptr_Function_v4float Function +%local2 = OpVariable %_ptr_Function_v4float Function +OpStore %local1 %12 +OpCopyMemory %local2 %local1 +OpCopyMemory %global %local1 +OpEndPrimitive +OpReturn +OpFunctionEnd +)"; + + const std::string result = + R"(OpCapability Geometry +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Geometry %main "main" %global +OpExecutionMode %main Triangles +OpExecutionMode %main Invocations 1 +OpExecutionMode %main OutputTriangleStrip +OpExecutionMode %main OutputVertices 5 +OpSource GLSL 440 +OpName %main "main" +OpName %local1 "local1" +OpName %global "global" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%12 = OpConstantNull %v4float +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%global = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %7 +%19 = OpLabel +%local1 = OpVariable %_ptr_Function_v4float Function +OpStore %local1 %12 +OpCopyMemory %global %local1 +OpEndPrimitive +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(test, result, true, true); +} + +TEST_F(AggressiveDCETest, StructuredIfWithConditionalExit) { + // We are able to remove "local2" because it is not loaded, but have to keep + // the stores to "local1". + const std::string test = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" +OpSourceExtension "GL_GOOGLE_include_directive" +OpName %main "main" +OpName %a "a" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Uniform_int = OpTypePointer Uniform %int +%int_0 = OpConstant %int 0 +%bool = OpTypeBool +%int_100 = OpConstant %int 100 +%int_1 = OpConstant %int 1 +%a = OpVariable %_ptr_Uniform_int Uniform +%main = OpFunction %void None %5 +%12 = OpLabel +%13 = OpLoad %int %a +%14 = OpSGreaterThan %bool %13 %int_0 +OpSelectionMerge %15 None +OpBranchConditional %14 %16 %15 +%16 = OpLabel +%17 = OpLoad %int %a +%18 = OpSLessThan %bool %17 %int_100 +OpBranchConditional %18 %19 %15 +%19 = OpLabel +OpStore %a %int_1 +OpBranch %15 +%15 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(test, test, true, true); +} +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// Check that logical addressing required +// Check that function calls inhibit optimization +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/assembly_builder.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/assembly_builder.h new file mode 100644 index 00000000000..1673c092be4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/assembly_builder.h @@ -0,0 +1,266 @@ +// Copyright (c) 2016 Google 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. + +#ifndef TEST_OPT_ASSEMBLY_BUILDER_H_ +#define TEST_OPT_ASSEMBLY_BUILDER_H_ + +#include +#include +#include +#include +#include +#include + +namespace spvtools { +namespace opt { + +// A simple SPIR-V assembly code builder for test uses. It builds an SPIR-V +// assembly module from vectors of assembly strings. It allows users to add +// instructions to the main function and the type-constants-globals section +// directly. It relies on OpName instructions and friendly-name disassembling +// to keep the ID names unchanged after assembling. +// +// An assembly module is divided into several sections, matching with the +// SPIR-V Logical Layout: +// Global Preamble: +// OpCapability instructions; +// OpExtension instructions and OpExtInstImport instructions; +// OpMemoryModel instruction; +// OpEntryPoint and OpExecutionMode instruction; +// OpString, OpSourceExtension, OpSource and OpSourceContinued instructions. +// Names: +// OpName instructions. +// Annotations: +// OpDecorate, OpMemberDecorate, OpGroupDecorate, OpGroupMemberDecorate and +// OpDecorationGroup. +// Types, Constants and Global variables: +// Types, constants and global variables declaration instructions. +// Main Function: +// Main function instructions. +// Main Function Postamble: +// The return and function end instructions. +// +// The assembly code is built by concatenating all the strings in the above +// sections. +// +// Users define the contents in section +// and
. The section is to hold the names for IDs to +// keep them unchanged before and after assembling. All defined IDs to be added +// to this code builder will be assigned with a global name through OpName +// instruction. The name is extracted from the definition instruction. +// E.g. adding instruction: %var_a = OpConstant %int 2, will also add an +// instruction: OpName %var_a, "var_a". +// +// Note that the name must not be used on more than one defined IDs and +// friendly-name disassembling must be enabled so that OpName instructions will +// be respected. +class AssemblyBuilder { + // The base ID value for spec constants. + static const uint32_t SPEC_ID_BASE = 200; + + public: + // Initalize a minimal SPIR-V assembly code as the template. The minimal + // module contains an empty main function and some predefined names for the + // main function. + AssemblyBuilder() + : spec_id_counter_(SPEC_ID_BASE), + global_preamble_({ + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + // clang-format on + }), + names_(), + annotations_(), + types_consts_globals_(), + main_func_(), + main_func_postamble_({ + "OpReturn", + "OpFunctionEnd", + }) { + AppendTypesConstantsGlobals({ + "%void = OpTypeVoid", + "%main_func_type = OpTypeFunction %void", + }); + AppendInMain({ + "%main = OpFunction %void None %main_func_type", + "%main_func_entry_block = OpLabel", + }); + } + + // Appends OpName instructions to this builder. Instrcution strings that do + // not start with 'OpName ' will be skipped. Returns the references of this + // assembly builder. + AssemblyBuilder& AppendNames(const std::vector& vec_asm_code) { + for (auto& inst_str : vec_asm_code) { + if (inst_str.find("OpName ") == 0) { + names_.push_back(inst_str); + } + } + return *this; + } + + // Appends instructions to the types-constants-globals section and returns + // the reference of this assembly builder. IDs defined in the given code will + // be added to the Names section and then be registered with OpName + // instruction. Corresponding decoration instruction will be added for spec + // constants defined with opcode: 'OpSpecConstant'. + AssemblyBuilder& AppendTypesConstantsGlobals( + const std::vector& vec_asm_code) { + AddNamesForResultIDsIn(vec_asm_code); + // Check spec constants defined with OpSpecConstant. + for (auto& inst_str : vec_asm_code) { + if (inst_str.find("= OpSpecConstant ") != std::string::npos || + inst_str.find("= OpSpecConstantTrue ") != std::string::npos || + inst_str.find("= OpSpecConstantFalse ") != std::string::npos) { + AddSpecIDFor(GetResultIDName(inst_str)); + } + } + types_consts_globals_.insert(types_consts_globals_.end(), + vec_asm_code.begin(), vec_asm_code.end()); + return *this; + } + + // Appends instructions to the main function block, which is already labelled + // with "main_func_entry_block". Returns the reference of this assembly + // builder. IDs defined in the given code will be added to the Names section + // and then be registered with OpName instruction. + AssemblyBuilder& AppendInMain(const std::vector& vec_asm_code) { + AddNamesForResultIDsIn(vec_asm_code); + main_func_.insert(main_func_.end(), vec_asm_code.begin(), + vec_asm_code.end()); + return *this; + } + + // Appends annotation instructions to the annotation section, and returns the + // reference of this assembly builder. + AssemblyBuilder& AppendAnnotations( + const std::vector& vec_annotations) { + annotations_.insert(annotations_.end(), vec_annotations.begin(), + vec_annotations.end()); + return *this; + } + + // Pre-pends string to the preamble of the module. Useful for EFFCEE checks. + AssemblyBuilder& PrependPreamble(const std::vector& preamble) { + preamble_.insert(preamble_.end(), preamble.begin(), preamble.end()); + return *this; + } + + // Get the SPIR-V assembly code as string. + std::string GetCode() const { + std::ostringstream ss; + for (const auto& line : preamble_) { + ss << line << std::endl; + } + for (const auto& line : global_preamble_) { + ss << line << std::endl; + } + for (const auto& line : names_) { + ss << line << std::endl; + } + for (const auto& line : annotations_) { + ss << line << std::endl; + } + for (const auto& line : types_consts_globals_) { + ss << line << std::endl; + } + for (const auto& line : main_func_) { + ss << line << std::endl; + } + for (const auto& line : main_func_postamble_) { + ss << line << std::endl; + } + return ss.str(); + } + + private: + // Adds a given name to the Name section with OpName. If the given name has + // been added before, does nothing. + void AddOpNameIfNotExist(const std::string& id_name) { + if (!used_names_.count(id_name)) { + std::stringstream opname_inst; + opname_inst << "OpName " + << "%" << id_name << " \"" << id_name << "\""; + names_.emplace_back(opname_inst.str()); + used_names_.insert(id_name); + } + } + + // Adds the names in a vector of assembly code strings to the Names section. + // If a '=' sign is found in an instruction, this instruction will be treated + // as an ID defining instruction. The ID name used in the instruction will be + // extracted and added to the Names section. + void AddNamesForResultIDsIn(const std::vector& vec_asm_code) { + for (const auto& line : vec_asm_code) { + std::string name = GetResultIDName(line); + if (!name.empty()) { + AddOpNameIfNotExist(name); + } + } + } + + // Adds an OpDecorate SpecId instruction for the given ID name. + void AddSpecIDFor(const std::string& id_name) { + std::stringstream decorate_inst; + decorate_inst << "OpDecorate " + << "%" << id_name << " SpecId " << spec_id_counter_; + spec_id_counter_ += 1; + annotations_.emplace_back(decorate_inst.str()); + } + + // Extracts the ID name from a SPIR-V assembly instruction string. If the + // instruction is an ID-defining instruction (has result ID), returns the + // name of the result ID in string. If the instruction does not have result + // ID, returns an empty string. + std::string GetResultIDName(const std::string inst_str) { + std::string name; + if (inst_str.find('=') != std::string::npos) { + size_t assign_sign = inst_str.find('='); + name = inst_str.substr(0, assign_sign); + name.erase(remove_if(name.begin(), name.end(), + [](char c) { return c == ' ' || c == '%'; }), + name.end()); + } + return name; + } + + uint32_t spec_id_counter_; + // User-defined preamble. + std::vector preamble_; + // The vector that contains common preambles shared across all test SPIR-V + // code. + std::vector global_preamble_; + // The vector that contains OpName instructions. + std::vector names_; + // The vector that contains annotation instructions. + std::vector annotations_; + // The vector that contains the code to declare types, constants and global + // variables (aka. the Types-Constants-Globals section). + std::vector types_consts_globals_; + // The vector that contains the code in main function's entry block. + std::vector main_func_; + // The vector that contains the postamble of main function body. + std::vector main_func_postamble_; + // All of the defined variable names. + std::unordered_set used_names_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // TEST_OPT_ASSEMBLY_BUILDER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/assembly_builder_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/assembly_builder_test.cpp new file mode 100644 index 00000000000..55fbbe90462 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/assembly_builder_test.cpp @@ -0,0 +1,283 @@ +// Copyright (c) 2016 Google 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. + +#include "test/opt/assembly_builder.h" + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using AssemblyBuilderTest = PassTest<::testing::Test>; + +TEST_F(AssemblyBuilderTest, MinimalShader) { + AssemblyBuilder builder; + std::vector expected = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %void \"void\"", + "OpName %main_func_type \"main_func_type\"", + "OpName %main \"main\"", + "OpName %main_func_entry_block \"main_func_entry_block\"", + "%void = OpTypeVoid", + "%main_func_type = OpTypeFunction %void", + "%main = OpFunction %void None %main_func_type", +"%main_func_entry_block = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + SinglePassRunAndCheck(builder.GetCode(), JoinAllInsts(expected), + /* skip_nop = */ false); +} + +TEST_F(AssemblyBuilderTest, ShaderWithConstants) { + AssemblyBuilder builder; + builder + .AppendTypesConstantsGlobals({ + // clang-format off + "%bool = OpTypeBool", + "%_PF_bool = OpTypePointer Function %bool", + "%bt = OpConstantTrue %bool", + "%bf = OpConstantFalse %bool", + "%int = OpTypeInt 32 1", + "%_PF_int = OpTypePointer Function %int", + "%si = OpConstant %int 1", + "%uint = OpTypeInt 32 0", + "%_PF_uint = OpTypePointer Function %uint", + "%ui = OpConstant %uint 2", + "%float = OpTypeFloat 32", + "%_PF_float = OpTypePointer Function %float", + "%f = OpConstant %float 3.1415", + "%double = OpTypeFloat 64", + "%_PF_double = OpTypePointer Function %double", + "%d = OpConstant %double 3.14159265358979", + // clang-format on + }) + .AppendInMain({ + // clang-format off + "%btv = OpVariable %_PF_bool Function", + "%bfv = OpVariable %_PF_bool Function", + "%iv = OpVariable %_PF_int Function", + "%uv = OpVariable %_PF_uint Function", + "%fv = OpVariable %_PF_float Function", + "%dv = OpVariable %_PF_double Function", + "OpStore %btv %bt", + "OpStore %bfv %bf", + "OpStore %iv %si", + "OpStore %uv %ui", + "OpStore %fv %f", + "OpStore %dv %d", + // clang-format on + }); + + std::vector expected = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %void \"void\"", + "OpName %main_func_type \"main_func_type\"", + "OpName %main \"main\"", + "OpName %main_func_entry_block \"main_func_entry_block\"", + "OpName %bool \"bool\"", + "OpName %_PF_bool \"_PF_bool\"", + "OpName %bt \"bt\"", + "OpName %bf \"bf\"", + "OpName %int \"int\"", + "OpName %_PF_int \"_PF_int\"", + "OpName %si \"si\"", + "OpName %uint \"uint\"", + "OpName %_PF_uint \"_PF_uint\"", + "OpName %ui \"ui\"", + "OpName %float \"float\"", + "OpName %_PF_float \"_PF_float\"", + "OpName %f \"f\"", + "OpName %double \"double\"", + "OpName %_PF_double \"_PF_double\"", + "OpName %d \"d\"", + "OpName %btv \"btv\"", + "OpName %bfv \"bfv\"", + "OpName %iv \"iv\"", + "OpName %uv \"uv\"", + "OpName %fv \"fv\"", + "OpName %dv \"dv\"", + "%void = OpTypeVoid", +"%main_func_type = OpTypeFunction %void", + "%bool = OpTypeBool", + "%_PF_bool = OpTypePointer Function %bool", + "%bt = OpConstantTrue %bool", + "%bf = OpConstantFalse %bool", + "%int = OpTypeInt 32 1", + "%_PF_int = OpTypePointer Function %int", + "%si = OpConstant %int 1", + "%uint = OpTypeInt 32 0", + "%_PF_uint = OpTypePointer Function %uint", + "%ui = OpConstant %uint 2", + "%float = OpTypeFloat 32", + "%_PF_float = OpTypePointer Function %float", + "%f = OpConstant %float 3.1415", + "%double = OpTypeFloat 64", + "%_PF_double = OpTypePointer Function %double", + "%d = OpConstant %double 3.14159265358979", + "%main = OpFunction %void None %main_func_type", +"%main_func_entry_block = OpLabel", + "%btv = OpVariable %_PF_bool Function", + "%bfv = OpVariable %_PF_bool Function", + "%iv = OpVariable %_PF_int Function", + "%uv = OpVariable %_PF_uint Function", + "%fv = OpVariable %_PF_float Function", + "%dv = OpVariable %_PF_double Function", + "OpStore %btv %bt", + "OpStore %bfv %bf", + "OpStore %iv %si", + "OpStore %uv %ui", + "OpStore %fv %f", + "OpStore %dv %d", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck(builder.GetCode(), JoinAllInsts(expected), + /* skip_nop = */ false); +} + +TEST_F(AssemblyBuilderTest, SpecConstants) { + AssemblyBuilder builder; + builder.AppendTypesConstantsGlobals({ + "%bool = OpTypeBool", + "%uint = OpTypeInt 32 0", + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%double = OpTypeFloat 64", + "%v2int = OpTypeVector %int 2", + + "%spec_true = OpSpecConstantTrue %bool", + "%spec_false = OpSpecConstantFalse %bool", + "%spec_uint = OpSpecConstant %uint 1", + "%spec_int = OpSpecConstant %int 1", + "%spec_float = OpSpecConstant %float 1.25", + "%spec_double = OpSpecConstant %double 1.2345678", + + // Spec constants defined below should not have SpecID. + "%spec_add_op = OpSpecConstantOp %int IAdd %spec_int %spec_int", + "%spec_vec = OpSpecConstantComposite %v2int %spec_int %spec_int", + "%spec_vec_x = OpSpecConstantOp %int CompositeExtract %spec_vec 0", + }); + std::vector expected = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %void \"void\"", + "OpName %main_func_type \"main_func_type\"", + "OpName %main \"main\"", + "OpName %main_func_entry_block \"main_func_entry_block\"", + "OpName %bool \"bool\"", + "OpName %uint \"uint\"", + "OpName %int \"int\"", + "OpName %float \"float\"", + "OpName %double \"double\"", + "OpName %v2int \"v2int\"", + "OpName %spec_true \"spec_true\"", + "OpName %spec_false \"spec_false\"", + "OpName %spec_uint \"spec_uint\"", + "OpName %spec_int \"spec_int\"", + "OpName %spec_float \"spec_float\"", + "OpName %spec_double \"spec_double\"", + "OpName %spec_add_op \"spec_add_op\"", + "OpName %spec_vec \"spec_vec\"", + "OpName %spec_vec_x \"spec_vec_x\"", + "OpDecorate %spec_true SpecId 200", + "OpDecorate %spec_false SpecId 201", + "OpDecorate %spec_uint SpecId 202", + "OpDecorate %spec_int SpecId 203", + "OpDecorate %spec_float SpecId 204", + "OpDecorate %spec_double SpecId 205", + "%void = OpTypeVoid", + "%main_func_type = OpTypeFunction %void", + "%bool = OpTypeBool", + "%uint = OpTypeInt 32 0", + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%double = OpTypeFloat 64", + "%v2int = OpTypeVector %int 2", + "%spec_true = OpSpecConstantTrue %bool", + "%spec_false = OpSpecConstantFalse %bool", + "%spec_uint = OpSpecConstant %uint 1", + "%spec_int = OpSpecConstant %int 1", + "%spec_float = OpSpecConstant %float 1.25", + "%spec_double = OpSpecConstant %double 1.2345678", + "%spec_add_op = OpSpecConstantOp %int IAdd %spec_int %spec_int", + "%spec_vec = OpSpecConstantComposite %v2int %spec_int %spec_int", + "%spec_vec_x = OpSpecConstantOp %int CompositeExtract %spec_vec 0", + "%main = OpFunction %void None %main_func_type", +"%main_func_entry_block = OpLabel", + "OpReturn", + "OpFunctionEnd", + + // clang-format on + }; + + SinglePassRunAndCheck(builder.GetCode(), JoinAllInsts(expected), + /* skip_nop = */ false); +} + +TEST_F(AssemblyBuilderTest, AppendNames) { + AssemblyBuilder builder; + builder.AppendNames({ + "OpName %void \"another_name_for_void\"", + "I am an invalid OpName instruction and should not be added", + "OpName %main \"another name for main\"", + }); + std::vector expected = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %void \"void\"", + "OpName %main_func_type \"main_func_type\"", + "OpName %main \"main\"", + "OpName %main_func_entry_block \"main_func_entry_block\"", + "OpName %void \"another_name_for_void\"", + "OpName %main \"another name for main\"", + "%void = OpTypeVoid", + "%main_func_type = OpTypeFunction %void", + "%main = OpFunction %void None %main_func_type", +"%main_func_entry_block = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + SinglePassRunAndCheck(builder.GetCode(), JoinAllInsts(expected), + /* skip_nop = */ false); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/block_merge_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/block_merge_test.cpp new file mode 100644 index 00000000000..aaa70cd4a72 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/block_merge_test.cpp @@ -0,0 +1,703 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using BlockMergeTest = PassTest<::testing::Test>; + +TEST_F(BlockMergeTest, Simple) { + // Note: SPIR-V hand edited to insert block boundary + // between two statements in main. + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpBranch %15 +%15 = OpLabel +%16 = OpLoad %v4float %v +OpStore %gl_FragColor %16 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +%16 = OpLoad %v4float %v +OpStore %gl_FragColor %16 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, true, + true); +} + +TEST_F(BlockMergeTest, EmptyBlock) { + // Note: SPIR-V hand edited to insert empty block + // after two statements in main. + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpBranch %15 +%15 = OpLabel +%16 = OpLoad %v4float %v +OpStore %gl_FragColor %16 +OpBranch %17 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +%16 = OpLoad %v4float %v +OpStore %gl_FragColor %16 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, true, + true); +} + +TEST_F(BlockMergeTest, NestedInControlFlow) { + // Note: SPIR-V hand edited to insert block boundary + // between OpFMul and OpStore in then-part. + // + // #version 140 + // in vec4 BaseColor; + // + // layout(std140) uniform U_t + // { + // bool g_B ; + // } ; + // + // void main() + // { + // vec4 v = BaseColor; + // if (g_B) + // vec4 v = v * 0.25; + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_B" +OpName %_ "" +OpName %v_0 "v" +OpName %gl_FragColor "gl_FragColor" +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%U_t = OpTypeStruct %uint +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_0_25 = OpConstant %float 0.25 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%24 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%v_0 = OpVariable %_ptr_Function_v4float Function +%25 = OpLoad %v4float %BaseColor +OpStore %v %25 +%26 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%27 = OpLoad %uint %26 +%28 = OpINotEqual %bool %27 %uint_0 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +%31 = OpLoad %v4float %v +%32 = OpVectorTimesScalar %v4float %31 %float_0_25 +OpBranch %33 +%33 = OpLabel +OpStore %v_0 %32 +OpBranch %29 +%29 = OpLabel +%34 = OpLoad %v4float %v +OpStore %gl_FragColor %34 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%24 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%v_0 = OpVariable %_ptr_Function_v4float Function +%25 = OpLoad %v4float %BaseColor +OpStore %v %25 +%26 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%27 = OpLoad %uint %26 +%28 = OpINotEqual %bool %27 %uint_0 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +%31 = OpLoad %v4float %v +%32 = OpVectorTimesScalar %v4float %31 %float_0_25 +OpStore %v_0 %32 +OpBranch %29 +%29 = OpLabel +%34 = OpLoad %v4float %v +OpStore %gl_FragColor %34 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, true, + true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(BlockMergeTest, PhiInSuccessorOfMergedBlock) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[then:%\w+]] [[else:%\w+]] +; CHECK: [[then]] = OpLabel +; CHECK-NEXT: OpBranch [[merge]] +; CHECK: [[else]] = OpLabel +; CHECK-NEXT: OpBranch [[merge]] +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpPhi {{%\w+}} %true [[then]] %false [[else]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpSelectionMerge %merge None +OpBranchConditional %true %then %else +%then = OpLabel +OpBranch %then_next +%then_next = OpLabel +OpBranch %merge +%else = OpLabel +OpBranch %merge +%merge = OpLabel +%phi = OpPhi %bool %true %then_next %false %else +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, UpdateMergeInstruction) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[then:%\w+]] [[else:%\w+]] +; CHECK: [[then]] = OpLabel +; CHECK-NEXT: OpBranch [[merge]] +; CHECK: [[else]] = OpLabel +; CHECK-NEXT: OpBranch [[merge]] +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpReturn +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpSelectionMerge %real_merge None +OpBranchConditional %true %then %else +%then = OpLabel +OpBranch %merge +%else = OpLabel +OpBranch %merge +%merge = OpLabel +OpBranch %real_merge +%real_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, TwoMergeBlocksCannotBeMerged) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[outer_merge:%\w+]] None +; CHECK: OpSelectionMerge [[inner_merge:%\w+]] None +; CHECK: [[inner_merge]] = OpLabel +; CHECK-NEXT: OpBranch [[outer_merge]] +; CHECK: [[outer_merge]] = OpLabel +; CHECK-NEXT: OpReturn +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpSelectionMerge %outer_merge None +OpBranchConditional %true %then %else +%then = OpLabel +OpBranch %inner_header +%else = OpLabel +OpBranch %inner_header +%inner_header = OpLabel +OpSelectionMerge %inner_merge None +OpBranchConditional %true %inner_then %inner_else +%inner_then = OpLabel +OpBranch %inner_merge +%inner_else = OpLabel +OpBranch %inner_merge +%inner_merge = OpLabel +OpBranch %outer_merge +%outer_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, MergeContinue) { + const std::string text = R"( +; CHECK: OpBranch [[header:%\w+]] +; CHECK: [[header]] = OpLabel +; CHECK-NEXT: OpLogicalAnd +; CHECK-NEXT: OpLoopMerge {{%\w+}} [[header]] None +; CHECK-NEXT: OpBranch [[header]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpBranch %header +%header = OpLabel +OpLoopMerge %merge %continue None +OpBranch %continue +%continue = OpLabel +%op = OpLogicalAnd %bool %true %false +OpBranch %header +%merge = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, TwoHeadersCannotBeMerged) { + const std::string text = R"( +; CHECK: OpBranch [[loop_header:%\w+]] +; CHECK: [[loop_header]] = OpLabel +; CHECK-NEXT: OpLoopMerge +; CHECK-NEXT: OpBranch [[if_header:%\w+]] +; CHECK: [[if_header]] = OpLabel +; CHECK-NEXT: OpSelectionMerge +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpBranch %header +%header = OpLabel +OpLoopMerge %merge %continue None +OpBranch %inner_header +%inner_header = OpLabel +OpSelectionMerge %continue None +OpBranchConditional %true %then %continue +%then = OpLabel +OpBranch %continue +%continue = OpLabel +OpBranchConditional %false %merge %header +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, RemoveStructuredDeclaration) { + // Note: SPIR-V hand edited remove dead branch and add block + // before continue block + // + // #version 140 + // in vec4 BaseColor; + // + // void main() + // { + // while (true) { + // break; + // } + // gl_FragColor = BaseColor; + // } + + const std::string assembly = + R"( +; CHECK: OpLabel +; CHECK: [[header:%\w+]] = OpLabel +; CHECK-NOT: OpLoopMerge +; CHECK: OpReturn +; CHECK: [[continue:%\w+]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %6 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +OpLoopMerge %15 %16 None +OpBranch %17 +%17 = OpLabel +OpBranch %15 +%18 = OpLabel +OpBranch %16 +%16 = OpLabel +OpBranch %14 +%15 = OpLabel +%19 = OpLoad %v4float %BaseColor +OpStore %gl_FragColor %19 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(assembly, true); +} + +TEST_F(BlockMergeTest, DontMergeKill) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] [[cont:%\w+]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK: [[ret:%\w+]] = OpLabel +; CHECK-NEXT: OpKill +; CHECK-DAG: [[cont]] = OpLabel +; CHECK-DAG: [[merge]] = OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %5 +%5 = OpLabel +OpKill +%4 = OpLabel +OpBranch %2 +%3 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, DontMergeUnreachable) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] [[cont:%\w+]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK: [[ret:%\w+]] = OpLabel +; CHECK-NEXT: OpUnreachable +; CHECK-DAG: [[cont]] = OpLabel +; CHECK-DAG: [[merge]] = OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %5 +%5 = OpLabel +OpUnreachable +%4 = OpLabel +OpBranch %2 +%3 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, DontMergeReturn) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] [[cont:%\w+]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK: [[ret:%\w+]] = OpLabel +; CHECK-NEXT: OpReturn +; CHECK-DAG: [[cont]] = OpLabel +; CHECK-DAG: [[merge]] = OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %5 +%5 = OpLabel +OpReturn +%4 = OpLabel +OpBranch %2 +%3 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, DontMergeSwitch) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] [[cont:%\w+]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK: [[ret:%\w+]] = OpLabel +; CHECK-NEXT: OpSwitch +; CHECK-DAG: [[cont]] = OpLabel +; CHECK-DAG: [[merge]] = OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %5 +%5 = OpLabel +OpSwitch %int_0 %6 +%6 = OpLabel +OpReturn +%4 = OpLabel +OpBranch %2 +%3 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(BlockMergeTest, DontMergeReturnValue) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] [[cont:%\w+]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK: [[ret:%\w+]] = OpLabel +; CHECK-NEXT: OpReturn +; CHECK-DAG: [[cont]] = OpLabel +; CHECK-DAG: [[merge]] = OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%functy = OpTypeFunction %void +%otherfuncty = OpTypeFunction %bool +%true = OpConstantTrue %bool +%func = OpFunction %void None %functy +%1 = OpLabel +%2 = OpFunctionCall %bool %3 +OpReturn +OpFunctionEnd +%3 = OpFunction %bool None %otherfuncty +%4 = OpLabel +OpBranch %5 +%5 = OpLabel +OpLoopMerge %6 %7 None +OpBranch %8 +%8 = OpLabel +OpReturnValue %true +%7 = OpLabel +OpBranch %5 +%6 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// More complex control flow +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ccp_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ccp_test.cpp new file mode 100644 index 00000000000..5ccea71fba2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ccp_test.cpp @@ -0,0 +1,898 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/ccp_pass.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using CCPTest = PassTest<::testing::Test>; + +// TODO(dneto): Add Effcee as required dependency, and make this unconditional. +#ifdef SPIRV_EFFCEE +TEST_F(CCPTest, PropagateThroughPhis) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %x %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %x "x" + OpName %outparm "outparm" + OpDecorate %x Flat + OpDecorate %x Location 0 + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 +%_ptr_Input_int = OpTypePointer Input %int + %x = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %4 = OpLabel + %5 = OpLoad %int %x + %9 = OpIAdd %int %int_1 %int_3 + %6 = OpSGreaterThan %bool %5 %int_3 + OpSelectionMerge %25 None + OpBranchConditional %6 %22 %23 + %22 = OpLabel + +; CHECK: OpCopyObject %int %int_4 + %7 = OpCopyObject %int %9 + + OpBranch %25 + %23 = OpLabel + %8 = OpCopyObject %int %int_4 + OpBranch %25 + %25 = OpLabel + +; %int_4 should have propagated to both OpPhi operands. +; CHECK: OpPhi %int %int_4 {{%\d+}} %int_4 {{%\d+}} + %35 = OpPhi %int %7 %22 %8 %23 + +; This function always returns 4. DCE should get rid of everything else. +; CHECK OpStore %outparm %int_4 + OpStore %outparm %35 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, SimplifyConditionals) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %outparm "outparm" + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %4 = OpLabel + %9 = OpIAdd %int %int_4 %int_3 + %6 = OpSGreaterThan %bool %9 %int_3 + OpSelectionMerge %25 None +; CHECK: OpBranchConditional %true [[bb_taken:%\d+]] [[bb_not_taken:%\d+]] + OpBranchConditional %6 %22 %23 +; CHECK: [[bb_taken]] = OpLabel + %22 = OpLabel +; CHECK: OpCopyObject %int %int_7 + %7 = OpCopyObject %int %9 + OpBranch %25 +; CHECK: [[bb_not_taken]] = OpLabel + %23 = OpLabel +; CHECK: [[id_not_evaluated:%\d+]] = OpCopyObject %int %int_4 + %8 = OpCopyObject %int %int_4 + OpBranch %25 + %25 = OpLabel + +; %int_7 should have propagated to the first OpPhi operand. But the else branch +; is not executable (conditional is always true), so no values should be +; propagated there and the value of the OpPhi should always be %int_7. +; CHECK: OpPhi %int %int_7 [[bb_taken]] [[id_not_evaluated]] [[bb_not_taken]] + %35 = OpPhi %int %7 %22 %8 %23 + +; Only the true path of the conditional is ever executed. The output of this +; function is always %int_7. +; CHECK: OpStore %outparm %int_7 + OpStore %outparm %35 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, SimplifySwitches) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %outparm "outparm" + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_23 = OpConstant %int 23 + %int_42 = OpConstant %int 42 + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_4 = OpConstant %int 4 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %6 + %15 = OpLabel + OpSelectionMerge %17 None + OpSwitch %int_23 %17 10 %18 13 %19 23 %20 + %18 = OpLabel + OpBranch %17 + %19 = OpLabel + OpBranch %17 + %20 = OpLabel + OpBranch %17 + %17 = OpLabel + %24 = OpPhi %int %int_23 %15 %int_42 %18 %int_14 %19 %int_15 %20 + +; The switch will always jump to label %20, which carries the value %int_15. +; CHECK: OpIAdd %int %int_15 %int_4 + %22 = OpIAdd %int %24 %int_4 + +; Consequently, the return value will always be %int_19. +; CHECK: OpStore %outparm %int_19 + OpStore %outparm %22 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, SimplifySwitchesDefaultBranch) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %outparm "outparm" + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_42 = OpConstant %int 42 + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %6 + %13 = OpLabel + %15 = OpIAdd %int %int_42 %int_4 + OpSelectionMerge %16 None + +; CHECK: OpSwitch %int_46 {{%\d+}} 10 {{%\d+}} + OpSwitch %15 %17 10 %18 + %18 = OpLabel + OpBranch %16 + %17 = OpLabel + OpBranch %16 + %16 = OpLabel + %22 = OpPhi %int %int_42 %18 %int_1 %17 + +; The switch will always jump to the default label %17. This carries the value +; %int_1. +; CHECK: OpIAdd %int %int_1 %int_4 + %20 = OpIAdd %int %22 %int_4 + +; Resulting in a return value of %int_5. +; CHECK: OpStore %outparm %int_5 + OpStore %outparm %20 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, SimplifyIntVector) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %OutColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %v "v" + OpName %OutColor "OutColor" + OpDecorate %OutColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 +%_ptr_Function_v4int = OpTypePointer Function %v4int + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %int_3 = OpConstant %int 3 + %int_4 = OpConstant %int 4 + %14 = OpConstantComposite %v4int %int_1 %int_2 %int_3 %int_4 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Output_v4int = OpTypePointer Output %v4int + %OutColor = OpVariable %_ptr_Output_v4int Output + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v4int Function + OpStore %v %14 + %18 = OpAccessChain %_ptr_Function_int %v %uint_0 + %19 = OpLoad %int %18 + +; The constant folder does not see through access chains. To get this, the +; vector would have to be scalarized. +; CHECK: [[result_id:%\d+]] = OpIAdd %int {{%\d+}} %int_1 + %20 = OpIAdd %int %19 %int_1 + %21 = OpAccessChain %_ptr_Function_int %v %uint_0 + +; CHECK: OpStore {{%\d+}} [[result_id]] + OpStore %21 %20 + %24 = OpLoad %v4int %v + OpStore %OutColor %24 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, BadSimplifyFloatVector) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %OutColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %v "v" + OpName %OutColor "OutColor" + OpDecorate %OutColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %float_3 = OpConstant %float 3 + %float_4 = OpConstant %float 4 + %14 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float + %OutColor = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + OpStore %v %14 + %18 = OpAccessChain %_ptr_Function_float %v %uint_0 + %19 = OpLoad %float %18 + +; NOTE: This test should start failing once floating point folding is +; implemented (https://github.com/KhronosGroup/SPIRV-Tools/issues/943). +; This should be checking that we are adding %float_1 + %float_1. +; CHECK: [[result_id:%\d+]] = OpFAdd %float {{%\d+}} %float_1 + %20 = OpFAdd %float %19 %float_1 + %21 = OpAccessChain %_ptr_Function_float %v %uint_0 + +; This should be checkint that we are storing %float_2 instead of result_it. +; CHECK: OpStore {{%\d+}} [[result_id]] + OpStore %21 %20 + %24 = OpLoad %v4float %v + OpStore %OutColor %24 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, NoLoadStorePropagation) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %x "x" + OpName %outparm "outparm" + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_23 = OpConstant %int 23 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %5 = OpLabel + %x = OpVariable %_ptr_Function_int Function + OpStore %x %int_23 + +; int_23 should not propagate into this load. +; CHECK: [[load_id:%\d+]] = OpLoad %int %x + %12 = OpLoad %int %x + +; Nor into this copy operation. +; CHECK: [[copy_id:%\d+]] = OpCopyObject %int [[load_id]] + %13 = OpCopyObject %int %12 + +; Likewise here. +; CHECK: OpStore %outparm [[copy_id]] + OpStore %outparm %13 + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, HandleAbortInstructions) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool +; CHECK: %true = OpConstantTrue %bool + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %4 = OpLabel + %9 = OpIAdd %int %int_3 %int_1 + %6 = OpSGreaterThan %bool %9 %int_3 + OpSelectionMerge %23 None +; CHECK: OpBranchConditional %true {{%\d+}} {{%\d+}} + OpBranchConditional %6 %22 %23 + %22 = OpLabel + OpKill + %23 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, SSAWebCycles) { + // Test reduced from https://github.com/KhronosGroup/SPIRV-Tools/issues/1159 + // When there is a cycle in the SSA def-use web, the propagator was getting + // into an infinite loop. SSA edges for Phi instructions should not be + // added to the edges to simulate. + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_4 = OpConstant %int 4 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Output_int = OpTypePointer Output %int + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %11 + %11 = OpLabel + %29 = OpPhi %int %int_0 %5 %22 %14 + %30 = OpPhi %int %int_0 %5 %25 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %bool %30 %int_4 +; CHECK: OpBranchConditional %true {{%\d+}} {{%\d+}} + OpBranchConditional %19 %12 %13 + %12 = OpLabel +; CHECK: OpIAdd %int %int_0 %int_0 + %22 = OpIAdd %int %29 %30 + OpBranch %14 + %14 = OpLabel +; CHECK: OpPhi %int %int_0 {{%\d+}} + %25 = OpPhi %int %30 %12 + OpBranch %11 + %13 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, LoopInductionVariables) { + // Test reduced from https://github.com/KhronosGroup/SPIRV-Tools/issues/1143 + // We are failing to properly consider the induction variable for this loop + // as Varying. + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpName %main "main" + %void = OpTypeVoid + %5 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %5 + %12 = OpLabel + OpBranch %13 + %13 = OpLabel + +; This Phi should not have all constant arguments: +; CHECK: [[phi_id:%\d+]] = OpPhi %int %int_0 {{%\d+}} {{%\d+}} {{%\d+}} + %22 = OpPhi %int %int_0 %12 %21 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + +; The Phi should never be considered to have the value %int_0. +; CHECK: [[branch_selector:%\d+]] = OpSLessThan %bool [[phi_id]] %int_10 + %18 = OpSLessThan %bool %22 %int_10 + +; This conditional was wrongly converted into an always-true jump due to the +; bad meet evaluation of %22. +; CHECK: OpBranchConditional [[branch_selector]] {{%\d+}} {{%\d+}} + OpBranchConditional %18 %19 %14 + %19 = OpLabel + OpBranch %15 + %15 = OpLabel +; CHECK: OpIAdd %int [[phi_id]] %int_1 + %21 = OpIAdd %int %22 %int_1 + OpBranch %13 + %14 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(spv_asm, true); +} + +TEST_F(CCPTest, HandleCompositeWithUndef) { + // Check to make sure that CCP does not crash when given a "constant" struct + // with an undef. If at a later time CCP is enhanced to optimize this case, + // it is not wrong. + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + %void = OpTypeVoid + %4 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool + %_struct_7 = OpTypeStruct %int %int + %int_1 = OpConstant %int 1 + %9 = OpUndef %int + %10 = OpConstantComposite %_struct_7 %int_1 %9 + %main = OpFunction %void None %4 + %11 = OpLabel + %12 = OpCompositeExtract %int %10 0 + %13 = OpCopyObject %int %12 + OpReturn + OpFunctionEnd + )"; + + auto res = SinglePassRunToBinary(spv_asm, true); + EXPECT_EQ(std::get<1>(res), Pass::Status::SuccessWithoutChange); +} + +TEST_F(CCPTest, SkipSpecConstantInstrucitons) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 500 + OpName %main "main" + %void = OpTypeVoid + %4 = OpTypeFunction %void + %bool = OpTypeBool + %10 = OpSpecConstantFalse %bool + %main = OpFunction %void None %4 + %11 = OpLabel + %12 = OpBranchConditional %10 %l1 %l2 + %l1 = OpLabel + OpReturn + %l2 = OpLabel + OpReturn + OpFunctionEnd + )"; + + auto res = SinglePassRunToBinary(spv_asm, true); + EXPECT_EQ(std::get<1>(res), Pass::Status::SuccessWithoutChange); +} + +TEST_F(CCPTest, UpdateSubsequentPhisToVarying) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" %in +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%false = OpConstantFalse %bool +%int0 = OpConstant %int 0 +%int1 = OpConstant %int 1 +%int6 = OpConstant %int 6 +%int_ptr_Input = OpTypePointer Input %int +%in = OpVariable %int_ptr_Input Input +%undef = OpUndef %int +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +%outer_phi = OpPhi %int %int0 %1 %outer_add %15 +%cond1 = OpSLessThanEqual %bool %outer_phi %int6 +OpLoopMerge %3 %15 None +OpBranchConditional %cond1 %4 %3 +%4 = OpLabel +%ld = OpLoad %int %in +%cond2 = OpSGreaterThanEqual %bool %int1 %ld +OpSelectionMerge %10 None +OpBranchConditional %cond2 %8 %9 +%8 = OpLabel +OpBranch %10 +%9 = OpLabel +OpBranch %10 +%10 = OpLabel +%extra_phi = OpPhi %int %outer_phi %8 %outer_phi %9 +OpBranch %11 +%11 = OpLabel +%inner_phi = OpPhi %int %int0 %10 %inner_add %13 +%cond3 = OpSLessThanEqual %bool %inner_phi %int6 +OpLoopMerge %14 %13 None +OpBranchConditional %cond3 %12 %14 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%inner_add = OpIAdd %int %inner_phi %int1 +OpBranch %11 +%14 = OpLabel +OpBranch %15 +%15 = OpLabel +%outer_add = OpIAdd %int %extra_phi %int1 +OpBranch %2 +%3 = OpLabel +OpReturn +OpFunctionEnd +)"; + + auto res = SinglePassRunToBinary(text, true); + EXPECT_EQ(std::get<1>(res), Pass::Status::SuccessWithoutChange); +} + +TEST_F(CCPTest, UndefInPhi) { + const std::string text = R"( +; CHECK: [[uint1:%\w+]] = OpConstant {{%\w+}} 1 +; CHECK: [[phi:%\w+]] = OpPhi +; CHECK: OpIAdd {{%\w+}} [[phi]] [[uint1]] + OpCapability Kernel + OpCapability Linkage + OpMemoryModel Logical OpenCL + OpDecorate %1 LinkageAttributes "func" Export + %void = OpTypeVoid + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %7 = OpUndef %uint + %8 = OpTypeFunction %void %bool + %1 = OpFunction %void None %8 + %9 = OpFunctionParameter %bool + %10 = OpLabel + OpBranchConditional %9 %11 %12 + %11 = OpLabel + OpBranch %13 + %12 = OpLabel + OpBranch %14 + %14 = OpLabel + OpBranchConditional %9 %13 %15 + %15 = OpLabel + OpBranch %13 + %13 = OpLabel + %16 = OpPhi %uint %uint_0 %11 %7 %14 %uint_1 %15 + %17 = OpIAdd %uint %16 %uint_1 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +// Just test to make sure the constant fold rules are being used. Will rely on +// the folding test for specific testing of specific rules. +TEST_F(CCPTest, UseConstantFoldingRules) { + const std::string text = R"( +; CHECK: [[float1:%\w+]] = OpConstant {{%\w+}} 1 +; CHECK: OpReturnValue [[float1]] + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %1 LinkageAttributes "func" Export + %void = OpTypeVoid + %bool = OpTypeBool + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %float_1 = OpConstant %float 1 + %8 = OpTypeFunction %float + %1 = OpFunction %float None %8 + %10 = OpLabel + %17 = OpFAdd %float %float_0 %float_1 + OpReturnValue %17 + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +// Test for #1300. Previously value for %5 would not settle during simulation. +TEST_F(CCPTest, SettlePhiLatticeValue) { + const std::string text = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranchConditional %true %2 %3 +%3 = OpLabel +OpBranch %2 +%2 = OpLabel +%5 = OpPhi %bool %true %1 %false %3 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunToBinary(text, true); +} + +TEST_F(CCPTest, NullBranchCondition) { + const std::string text = R"( +; CHECK: [[int1:%\w+]] = OpConstant {{%\w+}} 1 +; CHECK: [[int2:%\w+]] = OpConstant {{%\w+}} 2 +; CHECK: OpIAdd {{%\w+}} [[int1]] [[int2]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%null = OpConstantNull %bool +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpSelectionMerge %2 None +OpBranchConditional %null %2 %3 +%3 = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %int %int_1 %1 %int_2 %3 +%add = OpIAdd %int %int_1 %phi +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CCPTest, UndefBranchCondition) { + const std::string text = R"( +; CHECK: [[int1:%\w+]] = OpConstant {{%\w+}} 1 +; CHECK: [[phi:%\w+]] = OpPhi +; CHECK: OpIAdd {{%\w+}} [[int1]] [[phi]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%undef = OpUndef %bool +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpSelectionMerge %2 None +OpBranchConditional %undef %2 %3 +%3 = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %int %int_1 %1 %int_2 %3 +%add = OpIAdd %int %int_1 %phi +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CCPTest, NullSwitchCondition) { + const std::string text = R"( +; CHECK: [[int1:%\w+]] = OpConstant {{%\w+}} 1 +; CHECK: [[int2:%\w+]] = OpConstant {{%\w+}} 2 +; CHECK: OpIAdd {{%\w+}} [[int1]] [[int2]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%int = OpTypeInt 32 1 +%null = OpConstantNull %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpSelectionMerge %2 None +OpSwitch %null %2 0 %3 +%3 = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %int %int_1 %1 %int_2 %3 +%add = OpIAdd %int %int_1 %phi +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CCPTest, UndefSwitchCondition) { + const std::string text = R"( +; CHECK: [[int1:%\w+]] = OpConstant {{%\w+}} 1 +; CHECK: [[phi:%\w+]] = OpPhi +; CHECK: OpIAdd {{%\w+}} [[int1]] [[phi]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%int = OpTypeInt 32 1 +%undef = OpUndef %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpSelectionMerge %2 None +OpSwitch %undef %2 0 %3 +%3 = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %int %int_1 %1 %int_2 %3 +%add = OpIAdd %int %int_1 %phi +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +// Test for #1361. +TEST_F(CCPTest, CompositeConstructOfGlobalValue) { + const std::string text = R"( +; CHECK: [[phi:%\w+]] = OpPhi +; CHECK-NEXT: OpCompositeExtract {{%\w+}} [[phi]] 0 +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" %in +%void = OpTypeVoid +%int = OpTypeInt 32 1 +%bool = OpTypeBool +%functy = OpTypeFunction %void +%ptr_int_Input = OpTypePointer Input %int +%in = OpVariable %ptr_int_Input Input +%struct = OpTypeStruct %ptr_int_Input %ptr_int_Input +%struct_null = OpConstantNull %struct +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %struct %struct_null %1 %5 %4 +%extract = OpCompositeExtract %ptr_int_Input %phi 0 +OpLoopMerge %3 %4 None +OpBranch %4 +%4 = OpLabel +%5 = OpCompositeConstruct %struct %in %in +OpBranch %2 +%3 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/cfg_cleanup_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/cfg_cleanup_test.cpp new file mode 100644 index 00000000000..369c7667063 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/cfg_cleanup_test.cpp @@ -0,0 +1,448 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using CFGCleanupTest = PassTest<::testing::Test>; + +TEST_F(CFGCleanupTest, RemoveUnreachableBlocks) { + const std::string declarations = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %inf %outf4 +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %inf "inf" +OpName %outf4 "outf4" +OpDecorate %inf Location 0 +OpDecorate %outf4 Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Input_float = OpTypePointer Input %float +%inf = OpVariable %_ptr_Input_float Input +%float_2 = OpConstant %float 2 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outf4 = OpVariable %_ptr_Output_v4float Output +%float_n0_5 = OpConstant %float -0.5 +)"; + + const std::string body_before = R"(%main = OpFunction %void None %6 +%14 = OpLabel +OpBranch %18 +%19 = OpLabel +%20 = OpLoad %float %inf +%21 = OpCompositeConstruct %v4float %20 %20 %20 %20 +OpStore %outf4 %21 +OpBranch %17 +%18 = OpLabel +%22 = OpLoad %float %inf +%23 = OpFAdd %float %22 %float_n0_5 +%24 = OpCompositeConstruct %v4float %23 %23 %23 %23 +OpStore %outf4 %24 +OpBranch %17 +%17 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string body_after = R"(%main = OpFunction %void None %6 +%14 = OpLabel +OpBranch %15 +%15 = OpLabel +%20 = OpLoad %float %inf +%21 = OpFAdd %float %20 %float_n0_5 +%22 = OpCompositeConstruct %v4float %21 %21 %21 %21 +OpStore %outf4 %22 +OpBranch %19 +%19 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(declarations + body_before, + declarations + body_after, true, true); +} + +TEST_F(CFGCleanupTest, RemoveDecorations) { + const std::string before = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpName %main "main" + OpName %x "x" + OpName %dead "dead" + OpDecorate %x RelaxedPrecision + OpDecorate %dead RelaxedPrecision + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_2 = OpConstant %float 2 + %float_4 = OpConstant %float 4 + + %main = OpFunction %void None %6 + %14 = OpLabel + %x = OpVariable %_ptr_Function_float Function + OpBranch %18 + %19 = OpLabel + %dead = OpVariable %_ptr_Function_float Function + OpStore %dead %float_2 + OpBranch %17 + %18 = OpLabel + OpStore %x %float_4 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd +)"; + + const std::string after = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpName %main "main" +OpName %x "x" +OpDecorate %x RelaxedPrecision +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_2 = OpConstant %float 2 +%float_4 = OpConstant %float 4 +%main = OpFunction %void None %6 +%11 = OpLabel +%x = OpVariable %_ptr_Function_float Function +OpBranch %12 +%12 = OpLabel +OpStore %x %float_4 +OpBranch %14 +%14 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, true, true); +} + +TEST_F(CFGCleanupTest, UpdatePhis) { + const std::string before = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %y %outparm + OpName %main "main" + OpName %y "y" + OpName %outparm "outparm" + OpDecorate %y Flat + OpDecorate %y Location 0 + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %y = OpVariable %_ptr_Input_int Input + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_42 = OpConstant %int 42 + %int_23 = OpConstant %int 23 + %int_5 = OpConstant %int 5 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %5 = OpLabel + %11 = OpLoad %int %y + OpBranch %21 + %16 = OpLabel + %20 = OpIAdd %int %11 %int_42 + OpBranch %17 + %21 = OpLabel + %24 = OpISub %int %11 %int_23 + OpBranch %17 + %17 = OpLabel + %31 = OpPhi %int %20 %16 %24 %21 + %27 = OpIAdd %int %31 %int_5 + OpStore %outparm %27 + OpReturn + OpFunctionEnd +)"; + + const std::string after = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %y %outparm +OpName %main "main" +OpName %y "y" +OpName %outparm "outparm" +OpDecorate %y Flat +OpDecorate %y Location 0 +OpDecorate %outparm Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int +%y = OpVariable %_ptr_Input_int Input +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_42 = OpConstant %int 42 +%int_23 = OpConstant %int 23 +%int_5 = OpConstant %int 5 +%_ptr_Output_int = OpTypePointer Output %int +%outparm = OpVariable %_ptr_Output_int Output +%main = OpFunction %void None %6 +%16 = OpLabel +%17 = OpLoad %int %y +OpBranch %18 +%18 = OpLabel +%22 = OpISub %int %17 %int_23 +OpBranch %21 +%21 = OpLabel +%23 = OpPhi %int %22 %18 +%24 = OpIAdd %int %23 %int_5 +OpStore %outparm %24 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, true, true); +} + +TEST_F(CFGCleanupTest, RemoveNamedLabels) { + const std::string before = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 430 + OpName %main "main" + OpName %dead "dead" + %void = OpTypeVoid + %5 = OpTypeFunction %void + %main = OpFunction %void None %5 + %6 = OpLabel + OpReturn + %dead = OpLabel + OpReturn + OpFunctionEnd)"; + + const std::string after = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 430 +OpName %main "main" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%main = OpFunction %void None %5 +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, true, true); +} + +TEST_F(CFGCleanupTest, RemovePhiArgsFromFarBlocks) { + const std::string before = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %y %outparm + OpName %main "main" + OpName %y "y" + OpName %outparm "outparm" + OpDecorate %y Flat + OpDecorate %y Location 0 + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %y = OpVariable %_ptr_Input_int Input + %int_42 = OpConstant %int 42 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %int_14 = OpConstant %int 14 + %int_15 = OpConstant %int 15 + %int_5 = OpConstant %int 5 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %40 + %41 = OpLabel + %11 = OpLoad %int %y + OpBranch %40 + %40 = OpLabel + %12 = OpLoad %int %y + OpSelectionMerge %16 None + OpSwitch %12 %16 10 %13 13 %14 18 %15 + %13 = OpLabel + OpBranch %16 + %14 = OpLabel + OpStore %outparm %int_14 + OpBranch %16 + %15 = OpLabel + OpStore %outparm %int_15 + OpBranch %16 + %16 = OpLabel + %30 = OpPhi %int %11 %40 %int_42 %13 %11 %14 %11 %15 + %28 = OpIAdd %int %30 %int_5 + OpStore %outparm %28 + OpReturn + OpFunctionEnd)"; + + const std::string after = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %y %outparm +OpName %main "main" +OpName %y "y" +OpName %outparm "outparm" +OpDecorate %y Flat +OpDecorate %y Location 0 +OpDecorate %outparm Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int +%y = OpVariable %_ptr_Input_int Input +%int_42 = OpConstant %int 42 +%_ptr_Output_int = OpTypePointer Output %int +%outparm = OpVariable %_ptr_Output_int Output +%int_14 = OpConstant %int 14 +%int_15 = OpConstant %int 15 +%int_5 = OpConstant %int 5 +%26 = OpUndef %int +%main = OpFunction %void None %6 +%15 = OpLabel +OpBranch %16 +%16 = OpLabel +%19 = OpLoad %int %y +OpSelectionMerge %20 None +OpSwitch %19 %20 10 %21 13 %22 18 %23 +%21 = OpLabel +OpBranch %20 +%22 = OpLabel +OpStore %outparm %int_14 +OpBranch %20 +%23 = OpLabel +OpStore %outparm %int_15 +OpBranch %20 +%20 = OpLabel +%24 = OpPhi %int %26 %16 %int_42 %21 %26 %22 %26 %23 +%25 = OpIAdd %int %24 %int_5 +OpStore %outparm %25 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, true, true); +} + +TEST_F(CFGCleanupTest, RemovePhiConstantArgs) { + const std::string before = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %y %outparm + OpName %main "main" + OpName %y "y" + OpName %outparm "outparm" + OpDecorate %y Flat + OpDecorate %y Location 0 + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %y = OpVariable %_ptr_Input_int Input + %int_10 = OpConstant %int 10 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_23 = OpConstant %int 23 + %int_5 = OpConstant %int 5 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %24 = OpUndef %int + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %14 + %40 = OpLabel + %9 = OpLoad %int %y + %12 = OpSGreaterThan %bool %9 %int_10 + OpSelectionMerge %14 None + OpBranchConditional %12 %13 %14 + %13 = OpLabel + OpBranch %14 + %14 = OpLabel + %25 = OpPhi %int %24 %5 %int_23 %13 + %20 = OpIAdd %int %25 %int_5 + OpStore %outparm %20 + OpReturn + OpFunctionEnd)"; + + const std::string after = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %y %outparm +OpName %main "main" +OpName %y "y" +OpName %outparm "outparm" +OpDecorate %y Flat +OpDecorate %y Location 0 +OpDecorate %outparm Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%y = OpVariable %_ptr_Input_int Input +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int +%int_23 = OpConstant %int 23 +%int_5 = OpConstant %int 5 +%_ptr_Output_int = OpTypePointer Output %int +%outparm = OpVariable %_ptr_Output_int Output +%15 = OpUndef %int +%main = OpFunction %void None %6 +%16 = OpLabel +OpBranch %17 +%17 = OpLabel +%22 = OpPhi %int %15 %16 +%23 = OpIAdd %int %22 %int_5 +OpStore %outparm %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, true, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/combine_access_chains_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/combine_access_chains_test.cpp new file mode 100644 index 00000000000..ab9e185b68c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/combine_access_chains_test.cpp @@ -0,0 +1,754 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using CombineAccessChainsTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(CombineAccessChainsTest, PtrAccessChainFromAccessChainConstant) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpAccessChain [[ptr_int]] [[var]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpAccessChain %ptr_Workgroup_uint %var %uint_0 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, PtrAccessChainFromInBoundsAccessChainConstant) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpAccessChain [[ptr_int]] [[var]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpInBoundsAccessChain %ptr_Workgroup_uint %var %uint_0 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, PtrAccessChainFromAccessChainCombineConstant) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[int2:%\w+]] = OpConstant [[int]] 2 +; CHECK: OpAccessChain [[ptr_int]] [[var]] [[int2]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpAccessChain %ptr_Workgroup_uint %var %uint_1 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %uint_1 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, PtrAccessChainFromAccessChainNonConstant) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[ld1:%\w+]] = OpLoad +; CHECK: [[ld2:%\w+]] = OpLoad +; CHECK: [[add:%\w+]] = OpIAdd [[int]] [[ld1]] [[ld2]] +; CHECK: OpAccessChain [[ptr_int]] [[var]] [[add]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Function_uint = OpTypePointer Function %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%local_var = OpVariable %ptr_Function_uint Function +%ld1 = OpLoad %uint %local_var +%gep = OpAccessChain %ptr_Workgroup_uint %var %ld1 +%ld2 = OpLoad %uint %local_var +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %ld2 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, PtrAccessChainFromAccessChainExtraIndices) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int1:%\w+]] = OpConstant [[int]] 1 +; CHECK: [[int2:%\w+]] = OpConstant [[int]] 2 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpAccessChain [[ptr_int]] [[var]] [[int1]] [[int2]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%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_array_4 = OpTypeArray %uint %uint_4 +%uint_array_4_array_4 = OpTypeArray %uint_array_4 %uint_4 +%uint_array_4_array_4_array_4 = OpTypeArray %uint_array_4_array_4 %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Function_uint = OpTypePointer Function %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%ptr_Workgroup_uint_array_4_array_4 = OpTypePointer Workgroup %uint_array_4_array_4 +%ptr_Workgroup_uint_array_4_array_4_array_4 = OpTypePointer Workgroup %uint_array_4_array_4_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4_array_4_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpAccessChain %ptr_Workgroup_uint_array_4 %var %uint_1 %uint_0 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %uint_2 %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, + PtrAccessChainFromPtrAccessChainCombineElementOperand) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[int6:%\w+]] = OpConstant [[int]] 6 +; CHECK: OpPtrAccessChain [[ptr_int]] [[var]] [[int6]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %uint_3 %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, + PtrAccessChainFromPtrAccessChainOnlyElementOperand) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int4:%\w+]] = OpConstant [[int]] 4 +; CHECK: [[array:%\w+]] = OpTypeArray [[int]] [[int4]] +; CHECK: [[ptr_array:%\w+]] = OpTypePointer Workgroup [[array]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[int6:%\w+]] = OpConstant [[int]] 6 +; CHECK: OpPtrAccessChain [[ptr_array]] [[var]] [[int6]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, + PtrAccessChainFromPtrAccessCombineNonElementIndex) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpPtrAccessChain [[ptr_int]] [[var]] [[int3]] [[int3]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%uint_array_4_array_4 = OpTypeArray %uint_array_4 %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Function_uint = OpTypePointer Function %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%ptr_Workgroup_uint_array_4_array_4 = OpTypePointer Workgroup %uint_array_4_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 %uint_0 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %uint_3 %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, + AccessChainFromPtrAccessChainOnlyElementOperand) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpPtrAccessChain [[ptr_int]] [[var]] [[int3]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 +%gep = OpAccessChain %ptr_Workgroup_uint %ptr_gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, AccessChainFromPtrAccessChainAppend) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int1:%\w+]] = OpConstant [[int]] 1 +; CHECK: [[int2:%\w+]] = OpConstant [[int]] 2 +; CHECK: [[int3:%\w+]] = OpConstant [[int]] 3 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpPtrAccessChain [[ptr_int]] [[var]] [[int1]] [[int2]] [[int3]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%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_array_4 = OpTypeArray %uint %uint_4 +%uint_array_4_array_4 = OpTypeArray %uint_array_4 %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%ptr_Workgroup_uint_array_4_array_4 = OpTypePointer Workgroup %uint_array_4_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_1 %uint_2 +%gep = OpAccessChain %ptr_Workgroup_uint %ptr_gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, AccessChainFromAccessChainAppend) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int1:%\w+]] = OpConstant [[int]] 1 +; CHECK: [[int2:%\w+]] = OpConstant [[int]] 2 +; CHECK: [[ptr_int:%\w+]] = OpTypePointer Workgroup [[int]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: OpAccessChain [[ptr_int]] [[var]] [[int1]] [[int2]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%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_array_4 = OpTypeArray %uint %uint_4 +%uint_array_4_array_4 = OpTypeArray %uint_array_4 %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%ptr_Workgroup_uint_array_4_array_4 = OpTypePointer Workgroup %uint_array_4_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%ptr_gep = OpAccessChain %ptr_Workgroup_uint_array_4 %var %uint_1 +%gep = OpAccessChain %ptr_Workgroup_uint %ptr_gep %uint_2 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, NonConstantStructSlide) { + const std::string text = R"( +; CHECK: [[int0:%\w+]] = OpConstant {{%\w+}} 0 +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[ld:%\w+]] = OpLoad +; CHECK: OpPtrAccessChain {{%\w+}} [[var]] [[ld]] [[int0]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%struct = OpTypeStruct %uint %uint +%ptr_Workgroup_struct = OpTypePointer Workgroup %struct +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Function_uint = OpTypePointer Function %uint +%wg_var = OpVariable %ptr_Workgroup_struct Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%1 = OpLabel +%func_var = OpVariable %ptr_Function_uint Function +%ld = OpLoad %uint %func_var +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_struct %wg_var %ld +%gep = OpAccessChain %ptr_Workgroup_uint %ptr_gep %uint_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, DontCombineNonConstantStructSlide) { + const std::string text = R"( +; CHECK: [[int0:%\w+]] = OpConstant {{%\w+}} 0 +; CHECK: [[ld:%\w+]] = OpLoad +; CHECK: [[gep:%\w+]] = OpAccessChain +; CHECK: OpPtrAccessChain {{%\w+}} [[gep]] [[ld]] [[int0]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_4 = OpConstant %uint 4 +%struct = OpTypeStruct %uint %uint +%struct_array_4 = OpTypeArray %struct %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Function_uint = OpTypePointer Function %uint +%ptr_Workgroup_struct = OpTypePointer Workgroup %struct +%ptr_Workgroup_struct_array_4 = OpTypePointer Workgroup %struct_array_4 +%wg_var = OpVariable %ptr_Workgroup_struct_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%1 = OpLabel +%func_var = OpVariable %ptr_Function_uint Function +%ld = OpLoad %uint %func_var +%gep = OpAccessChain %ptr_Workgroup_struct %wg_var %uint_0 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %ld %uint_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, CombineNonConstantStructSlideElement) { + const std::string text = R"( +; CHECK: [[int0:%\w+]] = OpConstant {{%\w+}} 0 +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[ld:%\w+]] = OpLoad +; CHECK: [[add:%\w+]] = OpIAdd {{%\w+}} [[ld]] [[ld]] +; CHECK: OpPtrAccessChain {{%\w+}} [[var]] [[add]] [[int0]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_4 = OpConstant %uint 4 +%struct = OpTypeStruct %uint %uint +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Function_uint = OpTypePointer Function %uint +%ptr_Workgroup_struct = OpTypePointer Workgroup %struct +%wg_var = OpVariable %ptr_Workgroup_struct Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%1 = OpLabel +%func_var = OpVariable %ptr_Function_uint Function +%ld = OpLoad %uint %func_var +%gep = OpPtrAccessChain %ptr_Workgroup_struct %wg_var %ld +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint %gep %ld %uint_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, PtrAccessChainFromInBoundsPtrAccessChain) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int4:%\w+]] = OpConstant [[int]] 4 +; CHECK: [[array:%\w+]] = OpTypeArray [[int]] [[int4]] +; CHECK: [[ptr_array:%\w+]] = OpTypePointer Workgroup [[array]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[int6:%\w+]] = OpConstant [[int]] 6 +; CHECK: OpPtrAccessChain [[ptr_array]] [[var]] [[int6]] +OpCapability Shader +OpCapability VariablePointers +OpCapability Addresses +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpInBoundsPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 +%ptr_gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, InBoundsPtrAccessChainFromPtrAccessChain) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int4:%\w+]] = OpConstant [[int]] 4 +; CHECK: [[array:%\w+]] = OpTypeArray [[int]] [[int4]] +; CHECK: [[ptr_array:%\w+]] = OpTypePointer Workgroup [[array]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[int6:%\w+]] = OpConstant [[int]] 6 +; CHECK: OpPtrAccessChain [[ptr_array]] [[var]] [[int6]] +OpCapability Shader +OpCapability VariablePointers +OpCapability Addresses +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 +%ptr_gep = OpInBoundsPtrAccessChain %ptr_Workgroup_uint_array_4 %gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, + InBoundsPtrAccessChainFromInBoundsPtrAccessChain) { + const std::string text = R"( +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[int4:%\w+]] = OpConstant [[int]] 4 +; CHECK: [[array:%\w+]] = OpTypeArray [[int]] [[int4]] +; CHECK: [[ptr_array:%\w+]] = OpTypePointer Workgroup [[array]] +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Workgroup +; CHECK: [[int6:%\w+]] = OpConstant [[int]] 6 +; CHECK: OpInBoundsPtrAccessChain [[ptr_array]] [[var]] [[int6]] +OpCapability Shader +OpCapability VariablePointers +OpCapability Addresses +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_3 = OpConstant %uint 3 +%uint_4 = OpConstant %uint 4 +%uint_array_4 = OpTypeArray %uint %uint_4 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%ptr_Workgroup_uint_array_4 = OpTypePointer Workgroup %uint_array_4 +%var = OpVariable %ptr_Workgroup_uint_array_4 Workgroup +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +%gep = OpInBoundsPtrAccessChain %ptr_Workgroup_uint_array_4 %var %uint_3 +%ptr_gep = OpInBoundsPtrAccessChain %ptr_Workgroup_uint_array_4 %gep %uint_3 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, NoIndexAccessChains) { + const std::string text = R"( +; CHECK: [[var:%\w+]] = OpVariable +; CHECK-NOT: OpConstant +; CHECK: [[gep:%\w+]] = OpAccessChain {{%\w+}} [[var]] +; CHECK: OpAccessChain {{%\w+}} [[var]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%var = OpVariable %ptr_Workgroup_uint Workgroup +%void_func = OpTypeFunction %void +%func = OpFunction %void None %void_func +%1 = OpLabel +%gep1 = OpAccessChain %ptr_Workgroup_uint %var +%gep2 = OpAccessChain %ptr_Workgroup_uint %gep1 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, NoIndexPtrAccessChains) { + const std::string text = R"( +; CHECK: [[int0:%\w+]] = OpConstant {{%\w+}} 0 +; CHECK: [[var:%\w+]] = OpVariable +; CHECK: [[gep:%\w+]] = OpPtrAccessChain {{%\w+}} [[var]] [[int0]] +; CHECK: OpCopyObject {{%\w+}} [[gep]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%var = OpVariable %ptr_Workgroup_uint Workgroup +%void_func = OpTypeFunction %void +%func = OpFunction %void None %void_func +%1 = OpLabel +%gep1 = OpPtrAccessChain %ptr_Workgroup_uint %var %uint_0 +%gep2 = OpAccessChain %ptr_Workgroup_uint %gep1 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, NoIndexPtrAccessChains2) { + const std::string text = R"( +; CHECK: [[int0:%\w+]] = OpConstant {{%\w+}} 0 +; CHECK: [[var:%\w+]] = OpVariable +; CHECK: OpPtrAccessChain {{%\w+}} [[var]] [[int0]] +OpCapability Shader +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%var = OpVariable %ptr_Workgroup_uint Workgroup +%void_func = OpTypeFunction %void +%func = OpFunction %void None %void_func +%1 = OpLabel +%gep1 = OpAccessChain %ptr_Workgroup_uint %var +%gep2 = OpPtrAccessChain %ptr_Workgroup_uint %gep1 %uint_0 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(CombineAccessChainsTest, CombineMixedSign) { + const std::string text = R"( +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[var:%\w+]] = OpVariable +; CHECK: [[uint2:%\w+]] = OpConstant [[uint]] 2 +; CHECK: OpInBoundsPtrAccessChain {{%\w+}} [[var]] [[uint2]] +OpCapability Shader +OpCapability VariablePointers +OpCapability Addresses +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%uint_1 = OpConstant %uint 1 +%int_1 = OpConstant %int 1 +%ptr_Workgroup_uint = OpTypePointer Workgroup %uint +%var = OpVariable %ptr_Workgroup_uint Workgroup +%void_func = OpTypeFunction %void +%func = OpFunction %void None %void_func +%1 = OpLabel +%gep1 = OpInBoundsPtrAccessChain %ptr_Workgroup_uint %var %uint_1 +%gep2 = OpInBoundsPtrAccessChain %ptr_Workgroup_uint %gep1 %int_1 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/common_uniform_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/common_uniform_elim_test.cpp new file mode 100644 index 00000000000..f5199ed8757 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/common_uniform_elim_test.cpp @@ -0,0 +1,1341 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using CommonUniformElimTest = PassTest<::testing::Test>; + +TEST_F(CommonUniformElimTest, Basic1) { + // Note: This test exemplifies the following: + // - Common uniform (%_) load floated to nearest non-controlled block + // - Common extract (g_F) floated to non-controlled block + // - Non-common extract (g_F2) not floated, but common uniform load shared + // + // #version 140 + // in vec4 BaseColor; + // in float fi; + // + // layout(std140) uniform U_t + // { + // float g_F; + // float g_F2; + // } ; + // + // void main() + // { + // vec4 v = BaseColor; + // if (fi > 0) { + // v = v * g_F; + // } + // else { + // float f2 = g_F2 - g_F; + // v = v * f2; + // } + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpMemberName %U_t 1 "g_F2" +OpName %_ "" +OpName %f2 "f2" +OpName %gl_FragColor "gl_FragColor" +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%U_t = OpTypeStruct %float %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f2 = OpVariable %_ptr_Function_float Function +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%28 = OpLoad %float %fi +%29 = OpFOrdGreaterThan %bool %28 %float_0 +OpSelectionMerge %30 None +OpBranchConditional %29 %31 %32 +%31 = OpLabel +%33 = OpLoad %v4float %v +%34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%35 = OpLoad %float %34 +%36 = OpVectorTimesScalar %v4float %33 %35 +OpStore %v %36 +OpBranch %30 +%32 = OpLabel +%37 = OpAccessChain %_ptr_Uniform_float %_ %int_1 +%38 = OpLoad %float %37 +%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%40 = OpLoad %float %39 +%41 = OpFSub %float %38 %40 +OpStore %f2 %41 +%42 = OpLoad %v4float %v +%43 = OpLoad %float %f2 +%44 = OpVectorTimesScalar %v4float %42 %43 +OpStore %v %44 +OpBranch %30 +%30 = OpLabel +%45 = OpLoad %v4float %v +OpStore %gl_FragColor %45 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %11 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f2 = OpVariable %_ptr_Function_float Function +%52 = OpLoad %U_t %_ +%53 = OpCompositeExtract %float %52 0 +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%28 = OpLoad %float %fi +%29 = OpFOrdGreaterThan %bool %28 %float_0 +OpSelectionMerge %30 None +OpBranchConditional %29 %31 %32 +%31 = OpLabel +%33 = OpLoad %v4float %v +%36 = OpVectorTimesScalar %v4float %33 %53 +OpStore %v %36 +OpBranch %30 +%32 = OpLabel +%49 = OpCompositeExtract %float %52 1 +%41 = OpFSub %float %49 %53 +OpStore %f2 %41 +%42 = OpLoad %v4float %v +%43 = OpLoad %float %f2 +%44 = OpVectorTimesScalar %v4float %42 %43 +OpStore %v %44 +OpBranch %30 +%30 = OpLabel +%45 = OpLoad %v4float %v +OpStore %gl_FragColor %45 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(CommonUniformElimTest, Basic2) { + // Note: This test exemplifies the following: + // - Common uniform (%_) load floated to nearest non-controlled block + // - Common extract (g_F) floated to non-controlled block + // - Non-common extract (g_F2) not floated, but common uniform load shared + // + // #version 140 + // in vec4 BaseColor; + // in float fi; + // in float fi2; + // + // layout(std140) uniform U_t + // { + // float g_F; + // float g_F2; + // } ; + // + // void main() + // { + // float f = fi; + // if (f < 0) + // f = -f; + // if (fi2 > 0) { + // f = f * g_F; + // } + // else { + // f = g_F2 - g_F; + // } + // gl_FragColor = f * BaseColor; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %fi %fi2 %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %fi "fi" +OpName %fi2 "fi2" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpMemberName %U_t 1 "g_F2" +OpName %_ "" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%fi2 = OpVariable %_ptr_Input_float Input +%U_t = OpTypeStruct %float %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%25 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%26 = OpLoad %float %fi +OpStore %f %26 +%27 = OpLoad %float %f +%28 = OpFOrdLessThan %bool %27 %float_0 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +%31 = OpLoad %float %f +%32 = OpFNegate %float %31 +OpStore %f %32 +OpBranch %29 +%29 = OpLabel +%33 = OpLoad %float %fi2 +%34 = OpFOrdGreaterThan %bool %33 %float_0 +OpSelectionMerge %35 None +OpBranchConditional %34 %36 %37 +%36 = OpLabel +%38 = OpLoad %float %f +%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%40 = OpLoad %float %39 +%41 = OpFMul %float %38 %40 +OpStore %f %41 +OpBranch %35 +%37 = OpLabel +%42 = OpAccessChain %_ptr_Uniform_float %_ %int_1 +%43 = OpLoad %float %42 +%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%45 = OpLoad %float %44 +%46 = OpFSub %float %43 %45 +OpStore %f %46 +OpBranch %35 +%35 = OpLabel +%47 = OpLoad %v4float %BaseColor +%48 = OpLoad %float %f +%49 = OpVectorTimesScalar %v4float %47 %48 +OpStore %gl_FragColor %49 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %11 +%25 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%26 = OpLoad %float %fi +OpStore %f %26 +%27 = OpLoad %float %f +%28 = OpFOrdLessThan %bool %27 %float_0 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +%31 = OpLoad %float %f +%32 = OpFNegate %float %31 +OpStore %f %32 +OpBranch %29 +%29 = OpLabel +%56 = OpLoad %U_t %_ +%57 = OpCompositeExtract %float %56 0 +%33 = OpLoad %float %fi2 +%34 = OpFOrdGreaterThan %bool %33 %float_0 +OpSelectionMerge %35 None +OpBranchConditional %34 %36 %37 +%36 = OpLabel +%38 = OpLoad %float %f +%41 = OpFMul %float %38 %57 +OpStore %f %41 +OpBranch %35 +%37 = OpLabel +%53 = OpCompositeExtract %float %56 1 +%46 = OpFSub %float %53 %57 +OpStore %f %46 +OpBranch %35 +%35 = OpLabel +%47 = OpLoad %v4float %BaseColor +%48 = OpLoad %float %f +%49 = OpVectorTimesScalar %v4float %47 %48 +OpStore %gl_FragColor %49 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(CommonUniformElimTest, Basic3) { + // Note: This test exemplifies the following: + // - Existing common uniform (%_) load kept in place and shared + // + // #version 140 + // in vec4 BaseColor; + // in float fi; + // + // layout(std140) uniform U_t + // { + // bool g_B; + // float g_F; + // } ; + // + // void main() + // { + // vec4 v = BaseColor; + // if (g_B) + // v = v * g_F; + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor %fi +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_B" +OpMemberName %U_t 1 "g_F" +OpName %_ "" +OpName %gl_FragColor "gl_FragColor" +OpName %fi "fi" +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%U_t = OpTypeStruct %uint %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%29 = OpLoad %uint %28 +%30 = OpINotEqual %bool %29 %uint_0 +OpSelectionMerge %31 None +OpBranchConditional %30 %32 %31 +%32 = OpLabel +%33 = OpLoad %v4float %v +%34 = OpAccessChain %_ptr_Uniform_float %_ %int_1 +%35 = OpLoad %float %34 +%36 = OpVectorTimesScalar %v4float %33 %35 +OpStore %v %36 +OpBranch %31 +%31 = OpLabel +%37 = OpLoad %v4float %v +OpStore %gl_FragColor %37 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%38 = OpLoad %U_t %_ +%39 = OpCompositeExtract %uint %38 0 +%30 = OpINotEqual %bool %39 %uint_0 +OpSelectionMerge %31 None +OpBranchConditional %30 %32 %31 +%32 = OpLabel +%33 = OpLoad %v4float %v +%41 = OpCompositeExtract %float %38 1 +%36 = OpVectorTimesScalar %v4float %33 %41 +OpStore %v %36 +OpBranch %31 +%31 = OpLabel +%37 = OpLoad %v4float %v +OpStore %gl_FragColor %37 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(CommonUniformElimTest, Loop) { + // Note: This test exemplifies the following: + // - Common extract (g_F) shared between two loops + // #version 140 + // in vec4 BC; + // in vec4 BC2; + // + // layout(std140) uniform U_t + // { + // float g_F; + // } ; + // + // void main() + // { + // vec4 v = BC; + // for (int i = 0; i < 4; i++) + // v[i] = v[i] / g_F; + // vec4 v2 = BC2; + // for (int i = 0; i < 4; i++) + // v2[i] = v2[i] * g_F; + // gl_FragColor = v + v2; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %BC2 %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BC "BC" +OpName %i "i" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpName %_ "" +OpName %v2 "v2" +OpName %BC2 "BC2" +OpName %i_0 "i" +OpName %gl_FragColor "gl_FragColor" +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%13 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BC = OpVariable %_ptr_Input_v4float Input +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%U_t = OpTypeStruct %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%_ptr_Uniform_float = OpTypePointer Uniform %float +%int_1 = OpConstant %int 1 +%BC2 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %13 +%28 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%v2 = OpVariable %_ptr_Function_v4float Function +%i_0 = OpVariable %_ptr_Function_int Function +%29 = OpLoad %v4float %BC +OpStore %v %29 +OpStore %i %int_0 +OpBranch %30 +%30 = OpLabel +OpLoopMerge %31 %32 None +OpBranch %33 +%33 = OpLabel +%34 = OpLoad %int %i +%35 = OpSLessThan %bool %34 %int_4 +OpBranchConditional %35 %36 %31 +%36 = OpLabel +%37 = OpLoad %int %i +%38 = OpLoad %int %i +%39 = OpAccessChain %_ptr_Function_float %v %38 +%40 = OpLoad %float %39 +%41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%42 = OpLoad %float %41 +%43 = OpFDiv %float %40 %42 +%44 = OpAccessChain %_ptr_Function_float %v %37 +OpStore %44 %43 +OpBranch %32 +%32 = OpLabel +%45 = OpLoad %int %i +%46 = OpIAdd %int %45 %int_1 +OpStore %i %46 +OpBranch %30 +%31 = OpLabel +%47 = OpLoad %v4float %BC2 +OpStore %v2 %47 +OpStore %i_0 %int_0 +OpBranch %48 +%48 = OpLabel +OpLoopMerge %49 %50 None +OpBranch %51 +%51 = OpLabel +%52 = OpLoad %int %i_0 +%53 = OpSLessThan %bool %52 %int_4 +OpBranchConditional %53 %54 %49 +%54 = OpLabel +%55 = OpLoad %int %i_0 +%56 = OpLoad %int %i_0 +%57 = OpAccessChain %_ptr_Function_float %v2 %56 +%58 = OpLoad %float %57 +%59 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%60 = OpLoad %float %59 +%61 = OpFMul %float %58 %60 +%62 = OpAccessChain %_ptr_Function_float %v2 %55 +OpStore %62 %61 +OpBranch %50 +%50 = OpLabel +%63 = OpLoad %int %i_0 +%64 = OpIAdd %int %63 %int_1 +OpStore %i_0 %64 +OpBranch %48 +%49 = OpLabel +%65 = OpLoad %v4float %v +%66 = OpLoad %v4float %v2 +%67 = OpFAdd %v4float %65 %66 +OpStore %gl_FragColor %67 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %13 +%28 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%v2 = OpVariable %_ptr_Function_v4float Function +%i_0 = OpVariable %_ptr_Function_int Function +%72 = OpLoad %U_t %_ +%73 = OpCompositeExtract %float %72 0 +%29 = OpLoad %v4float %BC +OpStore %v %29 +OpStore %i %int_0 +OpBranch %30 +%30 = OpLabel +OpLoopMerge %31 %32 None +OpBranch %33 +%33 = OpLabel +%34 = OpLoad %int %i +%35 = OpSLessThan %bool %34 %int_4 +OpBranchConditional %35 %36 %31 +%36 = OpLabel +%37 = OpLoad %int %i +%38 = OpLoad %int %i +%39 = OpAccessChain %_ptr_Function_float %v %38 +%40 = OpLoad %float %39 +%43 = OpFDiv %float %40 %73 +%44 = OpAccessChain %_ptr_Function_float %v %37 +OpStore %44 %43 +OpBranch %32 +%32 = OpLabel +%45 = OpLoad %int %i +%46 = OpIAdd %int %45 %int_1 +OpStore %i %46 +OpBranch %30 +%31 = OpLabel +%47 = OpLoad %v4float %BC2 +OpStore %v2 %47 +OpStore %i_0 %int_0 +OpBranch %48 +%48 = OpLabel +OpLoopMerge %49 %50 None +OpBranch %51 +%51 = OpLabel +%52 = OpLoad %int %i_0 +%53 = OpSLessThan %bool %52 %int_4 +OpBranchConditional %53 %54 %49 +%54 = OpLabel +%55 = OpLoad %int %i_0 +%56 = OpLoad %int %i_0 +%57 = OpAccessChain %_ptr_Function_float %v2 %56 +%58 = OpLoad %float %57 +%61 = OpFMul %float %58 %73 +%62 = OpAccessChain %_ptr_Function_float %v2 %55 +OpStore %62 %61 +OpBranch %50 +%50 = OpLabel +%63 = OpLoad %int %i_0 +%64 = OpIAdd %int %63 %int_1 +OpStore %i_0 %64 +OpBranch %48 +%49 = OpLabel +%65 = OpLoad %v4float %v +%66 = OpLoad %v4float %v2 +%67 = OpFAdd %v4float %65 %66 +OpStore %gl_FragColor %67 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(CommonUniformElimTest, Volatile1) { + // Note: This test exemplifies the following: + // - Same test as Basic1 with the exception that + // the Load of g_F in else-branch is volatile + // - Common uniform (%_) load floated to nearest non-controlled block + // + // #version 140 + // in vec4 BaseColor; + // in float fi; + // + // layout(std140) uniform U_t + // { + // float g_F; + // float g_F2; + // } ; + // + // void main() + // { + // vec4 v = BaseColor; + // if (fi > 0) { + // v = v * g_F; + // } + // else { + // float f2 = g_F2 - g_F; + // v = v * f2; + // } + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpMemberName %U_t 1 "g_F2" +OpName %_ "" +OpName %f2 "f2" +OpName %gl_FragColor "gl_FragColor" +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%U_t = OpTypeStruct %float %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f2 = OpVariable %_ptr_Function_float Function +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%28 = OpLoad %float %fi +%29 = OpFOrdGreaterThan %bool %28 %float_0 +OpSelectionMerge %30 None +OpBranchConditional %29 %31 %32 +%31 = OpLabel +%33 = OpLoad %v4float %v +%34 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%35 = OpLoad %float %34 +%36 = OpVectorTimesScalar %v4float %33 %35 +OpStore %v %36 +OpBranch %30 +%32 = OpLabel +%37 = OpAccessChain %_ptr_Uniform_float %_ %int_1 +%38 = OpLoad %float %37 +%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%40 = OpLoad %float %39 Volatile +%41 = OpFSub %float %38 %40 +OpStore %f2 %41 +%42 = OpLoad %v4float %v +%43 = OpLoad %float %f2 +%44 = OpVectorTimesScalar %v4float %42 %43 +OpStore %v %44 +OpBranch %30 +%30 = OpLabel +%45 = OpLoad %v4float %v +OpStore %gl_FragColor %45 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %11 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f2 = OpVariable %_ptr_Function_float Function +%50 = OpLoad %U_t %_ +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%28 = OpLoad %float %fi +%29 = OpFOrdGreaterThan %bool %28 %float_0 +OpSelectionMerge %30 None +OpBranchConditional %29 %31 %32 +%31 = OpLabel +%33 = OpLoad %v4float %v +%47 = OpCompositeExtract %float %50 0 +%36 = OpVectorTimesScalar %v4float %33 %47 +OpStore %v %36 +OpBranch %30 +%32 = OpLabel +%49 = OpCompositeExtract %float %50 1 +%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%40 = OpLoad %float %39 Volatile +%41 = OpFSub %float %49 %40 +OpStore %f2 %41 +%42 = OpLoad %v4float %v +%43 = OpLoad %float %f2 +%44 = OpVectorTimesScalar %v4float %42 %43 +OpStore %v %44 +OpBranch %30 +%30 = OpLabel +%45 = OpLoad %v4float %v +OpStore %gl_FragColor %45 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(CommonUniformElimTest, Volatile2) { + // Note: This test exemplifies the following: + // - Same test as Basic1 with the exception that + // U_t is Volatile. + // - No optimizations are applied + // + // #version 430 + // in vec4 BaseColor; + // in float fi; + // + // layout(std430) volatile buffer U_t + // { + // float g_F; + // float g_F2; + // }; + // + // + // void main(void) + // { + // vec4 v = BaseColor; + // if (fi > 0) { + // v = v * g_F; + // } else { + // float f2 = g_F2 - g_F; + // v = v * f2; + // } + // } + + const std::string text = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpMemberName %U_t 1 "g_F2" +OpName %_ "" +OpName %f2 "f2" +OpDecorate %BaseColor Location 0 +OpDecorate %fi Location 0 +OpMemberDecorate %U_t 0 Volatile +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Volatile +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%U_t = OpTypeStruct %float %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%int_1 = OpConstant %int 1 +%main = OpFunction %void None %3 +%5 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f2 = OpVariable %_ptr_Function_float Function +%12 = OpLoad %v4float %BaseColor +OpStore %v %12 +%15 = OpLoad %float %fi +%18 = OpFOrdGreaterThan %bool %15 %float_0 +OpSelectionMerge %20 None +OpBranchConditional %18 %19 %31 +%19 = OpLabel +%21 = OpLoad %v4float %v +%28 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%29 = OpLoad %float %28 +%30 = OpVectorTimesScalar %v4float %21 %29 +OpStore %v %30 +OpBranch %20 +%31 = OpLabel +%35 = OpAccessChain %_ptr_Uniform_float %_ %int_1 +%36 = OpLoad %float %35 +%37 = OpAccessChain %_ptr_Uniform_float %_ %int_0 +%38 = OpLoad %float %37 +%39 = OpFSub %float %36 %38 +OpStore %f2 %39 +%40 = OpLoad %v4float %v +%41 = OpLoad %float %f2 +%42 = OpVectorTimesScalar %v4float %40 %41 +OpStore %v %42 +OpBranch %20 +%20 = OpLabel +OpReturn +OpFunctionEnd +)"; + + Pass::Status res = std::get<1>( + SinglePassRunAndDisassemble(text, true, false)); + EXPECT_EQ(res, Pass::Status::SuccessWithoutChange); +} + +TEST_F(CommonUniformElimTest, Volatile3) { + // Note: This test exemplifies the following: + // - Same test as Volatile2 with the exception that + // the nested struct S is volatile + // - No optimizations are applied + // + // #version 430 + // in vec4 BaseColor; + // in float fi; + // + // struct S { + // volatile float a; + // }; + // + // layout(std430) buffer U_t + // { + // S g_F; + // S g_F2; + // }; + // + // + // void main(void) + // { + // vec4 v = BaseColor; + // if (fi > 0) { + // v = v * g_F.a; + // } else { + // float f2 = g_F2.a - g_F.a; + // v = v * f2; + // } + // } + + const std::string text = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %S "S" +OpMemberName %S 0 "a" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_F" +OpMemberName %U_t 1 "g_F2" +OpName %_ "" +OpName %f2 "f2" +OpDecorate %BaseColor Location 0 +OpDecorate %fi Location 0 +OpMemberDecorate %S 0 Offset 0 +OpMemberDecorate %S 0 Volatile +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%S = OpTypeStruct %float +%U_t = OpTypeStruct %S %S +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_float = OpTypePointer Function %float +%int_1 = OpConstant %int 1 +%main = OpFunction %void None %3 +%5 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f2 = OpVariable %_ptr_Function_float Function +%12 = OpLoad %v4float %BaseColor +OpStore %v %12 +%15 = OpLoad %float %fi +%18 = OpFOrdGreaterThan %bool %15 %float_0 +OpSelectionMerge %20 None +OpBranchConditional %18 %19 %32 +%19 = OpLabel +%21 = OpLoad %v4float %v +%29 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 +%30 = OpLoad %float %29 +%31 = OpVectorTimesScalar %v4float %21 %30 +OpStore %v %31 +OpBranch %20 +%32 = OpLabel +%36 = OpAccessChain %_ptr_Uniform_float %_ %int_1 %int_0 +%37 = OpLoad %float %36 +%38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0 +%39 = OpLoad %float %38 +%40 = OpFSub %float %37 %39 +OpStore %f2 %40 +%41 = OpLoad %v4float %v +%42 = OpLoad %float %f2 +%43 = OpVectorTimesScalar %v4float %41 %42 +OpStore %v %43 +OpBranch %20 +%20 = OpLabel +OpReturn +OpFunctionEnd +)"; + + Pass::Status res = std::get<1>( + SinglePassRunAndDisassemble(text, true, false)); + EXPECT_EQ(res, Pass::Status::SuccessWithoutChange); +} + +TEST_F(CommonUniformElimTest, IteratorDanglingPointer) { + // Note: This test exemplifies the following: + // - Existing common uniform (%_) load kept in place and shared + // + // #version 140 + // in vec4 BaseColor; + // in float fi; + // + // layout(std140) uniform U_t + // { + // bool g_B; + // float g_F; + // } ; + // + // uniform float alpha; + // uniform bool alpha_B; + // + // void main() + // { + // vec4 v = BaseColor; + // if (g_B) { + // v = v * g_F; + // if (alpha_B) + // v = v * alpha; + // else + // v = v * fi; + // } + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor %fi +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_B" +OpMemberName %U_t 1 "g_F" +OpName %alpha "alpha" +OpName %alpha_B "alpha_B" +OpName %_ "" +OpName %gl_FragColor "gl_FragColor" +OpName %fi "fi" +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 4 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%U_t = OpTypeStruct %uint %float +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%int_1 = OpConstant %int 1 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%alpha = OpVariable %_ptr_Uniform_float Uniform +%alpha_B = OpVariable %_ptr_Uniform_uint Uniform +)"; + + const std::string before = + R"(%main = OpFunction %void None %12 +%26 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%27 = OpLoad %v4float %BaseColor +OpStore %v %27 +%28 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%29 = OpLoad %uint %28 +%30 = OpINotEqual %bool %29 %uint_0 +OpSelectionMerge %31 None +OpBranchConditional %30 %31 %32 +%32 = OpLabel +%47 = OpLoad %v4float %v +OpStore %gl_FragColor %47 +OpReturn +%31 = OpLabel +%33 = OpAccessChain %_ptr_Uniform_float %_ %int_1 +%34 = OpLoad %float %33 +%35 = OpLoad %v4float %v +%36 = OpVectorTimesScalar %v4float %35 %34 +OpStore %v %36 +%37 = OpLoad %uint %alpha_B +%38 = OpIEqual %bool %37 %uint_0 +OpSelectionMerge %43 None +OpBranchConditional %38 %43 %39 +%39 = OpLabel +%40 = OpLoad %float %alpha +%41 = OpLoad %v4float %v +%42 = OpVectorTimesScalar %v4float %41 %40 +OpStore %v %42 +OpBranch %50 +%50 = OpLabel +%51 = OpLoad %v4float %v +OpStore %gl_FragColor %51 +OpReturn +%43 = OpLabel +%44 = OpLoad %float %fi +%45 = OpLoad %v4float %v +%46 = OpVectorTimesScalar %v4float %45 %44 +OpStore %v %46 +OpBranch %60 +%60 = OpLabel +%61 = OpLoad %v4float %v +OpStore %gl_FragColor %61 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %12 +%28 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%29 = OpLoad %v4float %BaseColor +OpStore %v %29 +%54 = OpLoad %U_t %_ +%55 = OpCompositeExtract %uint %54 0 +%32 = OpINotEqual %bool %55 %uint_0 +OpSelectionMerge %33 None +OpBranchConditional %32 %33 %34 +%34 = OpLabel +%35 = OpLoad %v4float %v +OpStore %gl_FragColor %35 +OpReturn +%33 = OpLabel +%58 = OpLoad %float %alpha +%57 = OpCompositeExtract %float %54 1 +%38 = OpLoad %v4float %v +%39 = OpVectorTimesScalar %v4float %38 %57 +OpStore %v %39 +%40 = OpLoad %uint %alpha_B +%41 = OpIEqual %bool %40 %uint_0 +OpSelectionMerge %42 None +OpBranchConditional %41 %42 %43 +%43 = OpLabel +%45 = OpLoad %v4float %v +%46 = OpVectorTimesScalar %v4float %45 %58 +OpStore %v %46 +OpBranch %47 +%47 = OpLabel +%48 = OpLoad %v4float %v +OpStore %gl_FragColor %48 +OpReturn +%42 = OpLabel +%49 = OpLoad %float %fi +%50 = OpLoad %v4float %v +%51 = OpVectorTimesScalar %v4float %50 %49 +OpStore %v %51 +OpBranch %52 +%52 = OpLabel +%53 = OpLoad %v4float %v +OpStore %gl_FragColor %53 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(CommonUniformElimTest, MixedConstantAndNonConstantIndexes) { + const std::string text = R"( +; CHECK: [[var:%\w+]] = OpVariable {{%\w+}} Uniform +; CHECK: %501 = OpLabel +; CHECK: [[ld:%\w+]] = OpLoad +; CHECK-NOT: OpCompositeExtract {{%\w+}} {{%\w+}} 0 2 484 +; CHECK: OpAccessChain {{%\w+}} [[var]] %int_0 %int_2 [[ld]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "ringeffectLayer_px" %gl_FragCoord %178 %182 + OpExecutionMode %4 OriginUpperLeft + OpSource HLSL 500 + OpDecorate %_arr_v4float_uint_10 ArrayStride 16 + OpMemberDecorate %_struct_20 0 Offset 0 + OpMemberDecorate %_struct_20 1 Offset 16 + OpMemberDecorate %_struct_20 2 Offset 32 + OpMemberDecorate %_struct_21 0 Offset 0 + OpDecorate %_struct_21 Block + OpDecorate %23 DescriptorSet 0 + OpDecorate %gl_FragCoord BuiltIn FragCoord + OpDecorate %178 Location 0 + OpDecorate %182 Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_v4float_uint_10 = OpTypeArray %v4float %uint_10 + %_struct_20 = OpTypeStruct %v4float %v4float %_arr_v4float_uint_10 + %_struct_21 = OpTypeStruct %_struct_20 +%_ptr_Uniform__struct_21 = OpTypePointer Uniform %_struct_21 + %23 = OpVariable %_ptr_Uniform__struct_21 Uniform + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_ptr_Uniform_float = OpTypePointer Uniform %float + %uint_3 = OpConstant %uint 3 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %float_0 = OpConstant %float 0 + %43 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Function_int = OpTypePointer Function %int + %int_5 = OpConstant %int 5 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %uint_5 = OpConstant %uint 5 +%_arr_v2float_uint_5 = OpTypeArray %v2float %uint_5 +%_ptr_Function__arr_v2float_uint_5 = OpTypePointer Function %_arr_v2float_uint_5 + %82 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_82 = OpTypePointer UniformConstant %82 + %86 = OpTypeSampler +%_ptr_UniformConstant_86 = OpTypePointer UniformConstant %86 + %90 = OpTypeSampledImage %82 + %v3float = OpTypeVector %float 3 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input + %178 = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float + %182 = OpVariable %_ptr_Output_v4float Output + %4 = OpFunction %void None %3 + %5 = OpLabel + %483 = OpVariable %_ptr_Function_v4float Function + %484 = OpVariable %_ptr_Function_int Function + %486 = OpVariable %_ptr_Function__arr_v2float_uint_5 Function + %179 = OpLoad %v4float %178 + %493 = OpAccessChain %_ptr_Uniform_float %23 %int_0 %int_0 %uint_3 + %494 = OpLoad %float %493 + OpStore %483 %43 + OpStore %484 %int_0 + OpBranch %495 + %495 = OpLabel + OpLoopMerge %496 %497 None + OpBranch %498 + %498 = OpLabel + %499 = OpLoad %int %484 + %500 = OpSLessThan %bool %499 %int_5 + OpBranchConditional %500 %501 %496 + %501 = OpLabel + %504 = OpVectorShuffle %v2float %179 %179 0 1 + %505 = OpLoad %int %484 + %506 = OpAccessChain %_ptr_Uniform_v4float %23 %int_0 %int_2 %505 + %507 = OpLoad %v4float %506 + %508 = OpVectorShuffle %v2float %507 %507 0 1 + %509 = OpFAdd %v2float %504 %508 + %512 = OpAccessChain %_ptr_Uniform_v4float %23 %int_0 %int_1 + %513 = OpLoad %v4float %512 + %514 = OpVectorShuffle %v2float %513 %513 0 1 + %517 = OpVectorShuffle %v2float %513 %513 2 3 + %518 = OpExtInst %v2float %1 FClamp %509 %514 %517 + %519 = OpAccessChain %_ptr_Function_v2float %486 %505 + OpStore %519 %518 + OpBranch %497 + %497 = OpLabel + %520 = OpLoad %int %484 + %521 = OpIAdd %int %520 %int_1 + OpStore %484 %521 + OpBranch %495 + %496 = OpLabel + OpReturn + OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// Disqualifying cases: extensions, decorations, non-logical addressing, +// non-structured control flow +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/compact_ids_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/compact_ids_test.cpp new file mode 100644 index 00000000000..b1e4b2cbb10 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/compact_ids_test.cpp @@ -0,0 +1,279 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/optimizer.hpp" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using CompactIdsTest = PassTest<::testing::Test>; + +TEST_F(CompactIdsTest, PassOff) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%99 = OpTypeInt 32 0 +%10 = OpTypeVector %99 2 +%20 = OpConstant %99 2 +%30 = OpTypeArray %99 %20 +)"; + + const std::string after = before; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, false); +} + +TEST_F(CompactIdsTest, PassOn) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %3 "simple_kernel" +%99 = OpTypeInt 32 0 +%10 = OpTypeVector %99 2 +%20 = OpConstant %99 2 +%30 = OpTypeArray %99 %20 +%40 = OpTypeVoid +%50 = OpTypeFunction %40 + %3 = OpFunction %40 None %50 +%70 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %1 "simple_kernel" +%2 = OpTypeInt 32 0 +%3 = OpTypeVector %2 2 +%4 = OpConstant %2 2 +%5 = OpTypeArray %2 %4 +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%1 = OpFunction %6 None %7 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, false); +} + +TEST(CompactIds, InstructionResultIsUpdated) { + // For https://github.com/KhronosGroup/SPIRV-Tools/issues/827 + // In that bug, the compact Ids pass was directly updating the result Id + // word for an OpFunction instruction, but not updating the cached + // result_id_ in that Instruction object. + // + // This test is a bit cheesy. We don't expose internal interfaces enough + // to see the inconsistency. So reproduce the original scenario, with + // compact ids followed by a pass that trips up on the inconsistency. + + const std::string input(R"(OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %100 "main" +%200 = OpTypeVoid +%300 = OpTypeFunction %200 +%100 = OpFunction %200 None %300 +%400 = OpLabel +OpReturn +OpFunctionEnd +)"); + + std::vector binary; + const spv_target_env env = SPV_ENV_UNIVERSAL_1_0; + spvtools::SpirvTools tools(env); + auto assembled = tools.Assemble( + input, &binary, SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_TRUE(assembled); + + spvtools::Optimizer optimizer(env); + optimizer.RegisterPass(CreateCompactIdsPass()); + // The exhaustive inliner will use the result_id + optimizer.RegisterPass(CreateInlineExhaustivePass()); + + // This should not crash! + optimizer.Run(binary.data(), binary.size(), &binary); + + std::string disassembly; + tools.Disassemble(binary, &disassembly, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + const std::string expected(R"(OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %1 "main" +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%1 = OpFunction %2 None %3 +%4 = OpLabel +OpReturn +OpFunctionEnd +)"); + + EXPECT_THAT(disassembly, ::testing::Eq(expected)); +} + +TEST(CompactIds, HeaderIsUpdated) { + const std::string input(R"(OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %100 "main" +%200 = OpTypeVoid +%300 = OpTypeFunction %200 +%100 = OpFunction %200 None %300 +%400 = OpLabel +OpReturn +OpFunctionEnd +)"); + + std::vector binary; + const spv_target_env env = SPV_ENV_UNIVERSAL_1_0; + spvtools::SpirvTools tools(env); + auto assembled = tools.Assemble( + input, &binary, SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_TRUE(assembled); + + spvtools::Optimizer optimizer(env); + optimizer.RegisterPass(CreateCompactIdsPass()); + // The exhaustive inliner will use the result_id + optimizer.RegisterPass(CreateInlineExhaustivePass()); + + // This should not crash! + optimizer.Run(binary.data(), binary.size(), &binary); + + std::string disassembly; + tools.Disassemble(binary, &disassembly, SPV_BINARY_TO_TEXT_OPTION_NONE); + + const std::string expected(R"(; SPIR-V +; Version: 1.0 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 5 +; Schema: 0 +OpCapability Shader +OpMemoryModel Logical Simple +OpEntryPoint GLCompute %1 "main" +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%1 = OpFunction %2 None %3 +%4 = OpLabel +OpReturn +OpFunctionEnd +)"); + + EXPECT_THAT(disassembly, ::testing::Eq(expected)); +} + +// Test context consistency check after invalidating +// CFG and others by compact IDs Pass. +// Uses a GLSL shader with named labels for variety +TEST(CompactIds, ConsistentCheck) { + const std::string input(R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_A %out_var_SV_TARGET +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %main "main" +OpName %in_var_A "in.var.A" +OpName %out_var_SV_TARGET "out.var.SV_TARGET" +OpDecorate %in_var_A Location 0 +OpDecorate %out_var_SV_TARGET Location 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%in_var_A = OpVariable %_ptr_Input_v4float Input +%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %3 +%5 = OpLabel +%12 = OpLoad %v4float %in_var_A +%23 = OpVectorShuffle %v4float %12 %12 0 0 0 1 +OpStore %out_var_SV_TARGET %23 +OpReturn +OpFunctionEnd +)"); + + spvtools::SpirvTools tools(SPV_ENV_UNIVERSAL_1_1); + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, input, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(context, nullptr); + + CompactIdsPass compact_id_pass; + context->BuildInvalidAnalyses(compact_id_pass.GetPreservedAnalyses()); + const auto status = compact_id_pass.Run(context.get()); + ASSERT_NE(status, Pass::Status::Failure); + EXPECT_TRUE(context->IsConsistent()); + + // Test output just in case + std::vector binary; + context->module()->ToBinary(&binary, false); + std::string disassembly; + tools.Disassemble(binary, &disassembly, + SpirvTools::kDefaultDisassembleOption); + + const std::string expected(R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_A %out_var_SV_TARGET +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %main "main" +OpName %in_var_A "in.var.A" +OpName %out_var_SV_TARGET "out.var.SV_TARGET" +OpDecorate %in_var_A Location 0 +OpDecorate %out_var_SV_TARGET Location 0 +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%in_var_A = OpVariable %_ptr_Input_v4float Input +%out_var_SV_TARGET = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %5 +%10 = OpLabel +%11 = OpLoad %v4float %in_var_A +%12 = OpVectorShuffle %v4float %11 %11 0 0 0 1 +OpStore %out_var_SV_TARGET %12 +OpReturn +OpFunctionEnd +)"); + + EXPECT_THAT(disassembly, ::testing::Eq(expected)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/constant_manager_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/constant_manager_test.cpp new file mode 100644 index 00000000000..57dea651201 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/constant_manager_test.cpp @@ -0,0 +1,88 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/constants.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { + +using ConstantManagerTest = ::testing::Test; + +TEST_F(ConstantManagerTest, GetDefiningInstruction) { + const std::string text = R"( +%int = OpTypeInt 32 0 +%1 = OpTypeStruct %int +%2 = OpTypeStruct %int + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(context, nullptr); + + Type* struct_type_1 = context->get_type_mgr()->GetType(1); + StructConstant struct_const_1(struct_type_1->AsStruct()); + Instruction* const_inst_1 = + context->get_constant_mgr()->GetDefiningInstruction(&struct_const_1, 1); + EXPECT_EQ(const_inst_1->type_id(), 1); + + Type* struct_type_2 = context->get_type_mgr()->GetType(2); + StructConstant struct_const_2(struct_type_2->AsStruct()); + Instruction* const_inst_2 = + context->get_constant_mgr()->GetDefiningInstruction(&struct_const_2, 2); + EXPECT_EQ(const_inst_2->type_id(), 2); +} + +TEST_F(ConstantManagerTest, GetDefiningInstruction2) { + const std::string text = R"( +%int = OpTypeInt 32 0 +%1 = OpTypeStruct %int +%2 = OpTypeStruct %int +%3 = OpConstantNull %1 +%4 = OpConstantNull %2 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(context, nullptr); + + Type* struct_type_1 = context->get_type_mgr()->GetType(1); + NullConstant struct_const_1(struct_type_1->AsStruct()); + Instruction* const_inst_1 = + context->get_constant_mgr()->GetDefiningInstruction(&struct_const_1, 1); + EXPECT_EQ(const_inst_1->type_id(), 1); + EXPECT_EQ(const_inst_1->result_id(), 3); + + Type* struct_type_2 = context->get_type_mgr()->GetType(2); + NullConstant struct_const_2(struct_type_2->AsStruct()); + Instruction* const_inst_2 = + context->get_constant_mgr()->GetDefiningInstruction(&struct_const_2, 2); + EXPECT_EQ(const_inst_2->type_id(), 2); + EXPECT_EQ(const_inst_2->result_id(), 4); +} + +} // namespace +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/copy_prop_array_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/copy_prop_array_test.cpp new file mode 100644 index 00000000000..dcce77d2241 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/copy_prop_array_test.cpp @@ -0,0 +1,1271 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using CopyPropArrayPassTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(CopyPropArrayPassTest, BasicPropagateArray) { + const std::string before = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: OpVariable +; CHECK: OpAccessChain +; CHECK: [[new_address:%\w+]] = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +; CHECK: [[element_ptr:%\w+]] = OpAccessChain %_ptr_Uniform_v4float [[new_address]] %24 +; CHECK: [[load:%\w+]] = OpLoad %v4float [[element_ptr]] +; CHECK: OpStore %out_var_SV_Target [[load]] +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%28 = OpCompositeExtract %v4float %26 1 +%29 = OpCompositeExtract %v4float %26 2 +%30 = OpCompositeExtract %v4float %26 3 +%31 = OpCompositeExtract %v4float %26 4 +%32 = OpCompositeExtract %v4float %26 5 +%33 = OpCompositeExtract %v4float %26 6 +%34 = OpCompositeExtract %v4float %26 7 +%35 = OpCompositeConstruct %_arr_v4float_uint_8_0 %27 %28 %29 %30 %31 %32 %33 %34 +OpStore %23 %35 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(before, false); +} + +TEST_F(CopyPropArrayPassTest, BasicPropagateArrayWithName) { + const std::string before = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %local "local" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: OpVariable +; CHECK: OpAccessChain +; CHECK: [[new_address:%\w+]] = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +; CHECK: [[element_ptr:%\w+]] = OpAccessChain %_ptr_Uniform_v4float [[new_address]] %24 +; CHECK: [[load:%\w+]] = OpLoad %v4float [[element_ptr]] +; CHECK: OpStore %out_var_SV_Target [[load]] +%main = OpFunction %void None %13 +%22 = OpLabel +%local = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%28 = OpCompositeExtract %v4float %26 1 +%29 = OpCompositeExtract %v4float %26 2 +%30 = OpCompositeExtract %v4float %26 3 +%31 = OpCompositeExtract %v4float %26 4 +%32 = OpCompositeExtract %v4float %26 5 +%33 = OpCompositeExtract %v4float %26 6 +%34 = OpCompositeExtract %v4float %26 7 +%35 = OpCompositeConstruct %_arr_v4float_uint_8_0 %27 %28 %29 %30 %31 %32 %33 %34 +OpStore %local %35 +%36 = OpAccessChain %_ptr_Function_v4float %local %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(before, false); +} + +// Propagate 2d array. This test identifying a copy through multiple levels. +// Also has to traverse multiple OpAccessChains. +TEST_F(CopyPropArrayPassTest, Propagate2DArray) { + const std::string text = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_2 ArrayStride 16 +OpDecorate %_arr__arr_v4float_uint_2_uint_2 ArrayStride 32 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr__arr_v4float_uint_2_uint_2 = OpTypeArray %_arr_v4float_uint_2 %uint_2 +%type_MyCBuffer = OpTypeStruct %_arr__arr_v4float_uint_2_uint_2 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%14 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_2_0 = OpTypeArray %v4float %uint_2 +%_arr__arr_v4float_uint_2_0_uint_2 = OpTypeArray %_arr_v4float_uint_2_0 %uint_2 +%_ptr_Function__arr__arr_v4float_uint_2_0_uint_2 = OpTypePointer Function %_arr__arr_v4float_uint_2_0_uint_2 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 = OpTypePointer Uniform %_arr__arr_v4float_uint_2_uint_2 +%_ptr_Function__arr_v4float_uint_2_0 = OpTypePointer Function %_arr_v4float_uint_2_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: OpVariable +; CHECK: OpVariable +; CHECK: OpAccessChain +; CHECK: [[new_address:%\w+]] = OpAccessChain %_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 %MyCBuffer %int_0 +%main = OpFunction %void None %14 +%25 = OpLabel +%26 = OpVariable %_ptr_Function__arr_v4float_uint_2_0 Function +%27 = OpVariable %_ptr_Function__arr__arr_v4float_uint_2_0_uint_2 Function +%28 = OpLoad %int %in_var_INDEX +%29 = OpAccessChain %_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 %MyCBuffer %int_0 +%30 = OpLoad %_arr__arr_v4float_uint_2_uint_2 %29 +%31 = OpCompositeExtract %_arr_v4float_uint_2 %30 0 +%32 = OpCompositeExtract %v4float %31 0 +%33 = OpCompositeExtract %v4float %31 1 +%34 = OpCompositeConstruct %_arr_v4float_uint_2_0 %32 %33 +%35 = OpCompositeExtract %_arr_v4float_uint_2 %30 1 +%36 = OpCompositeExtract %v4float %35 0 +%37 = OpCompositeExtract %v4float %35 1 +%38 = OpCompositeConstruct %_arr_v4float_uint_2_0 %36 %37 +%39 = OpCompositeConstruct %_arr__arr_v4float_uint_2_0_uint_2 %34 %38 +; CHECK: OpStore +OpStore %27 %39 +%40 = OpAccessChain %_ptr_Function__arr_v4float_uint_2_0 %27 %28 +%42 = OpAccessChain %_ptr_Function_v4float %40 %28 +%43 = OpLoad %v4float %42 +; CHECK: [[ac1:%\w+]] = OpAccessChain %_ptr_Uniform__arr_v4float_uint_2 [[new_address]] %28 +; CHECK: [[ac2:%\w+]] = OpAccessChain %_ptr_Uniform_v4float [[ac1]] %28 +; CHECK: [[load:%\w+]] = OpLoad %v4float [[ac2]] +; CHECK: OpStore %out_var_SV_Target [[load]] +OpStore %out_var_SV_Target %43 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(text, false); +} + +// Propagate 2d array. This test identifying a copy through multiple levels. +// Also has to traverse multiple OpAccessChains. +TEST_F(CopyPropArrayPassTest, Propagate2DArrayWithMultiLevelExtract) { + const std::string text = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_2 ArrayStride 16 +OpDecorate %_arr__arr_v4float_uint_2_uint_2 ArrayStride 32 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr__arr_v4float_uint_2_uint_2 = OpTypeArray %_arr_v4float_uint_2 %uint_2 +%type_MyCBuffer = OpTypeStruct %_arr__arr_v4float_uint_2_uint_2 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%14 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_2_0 = OpTypeArray %v4float %uint_2 +%_arr__arr_v4float_uint_2_0_uint_2 = OpTypeArray %_arr_v4float_uint_2_0 %uint_2 +%_ptr_Function__arr__arr_v4float_uint_2_0_uint_2 = OpTypePointer Function %_arr__arr_v4float_uint_2_0_uint_2 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 = OpTypePointer Uniform %_arr__arr_v4float_uint_2_uint_2 +%_ptr_Function__arr_v4float_uint_2_0 = OpTypePointer Function %_arr_v4float_uint_2_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: OpVariable +; CHECK: OpVariable +; CHECK: OpAccessChain +; CHECK: [[new_address:%\w+]] = OpAccessChain %_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 %MyCBuffer %int_0 +%main = OpFunction %void None %14 +%25 = OpLabel +%26 = OpVariable %_ptr_Function__arr_v4float_uint_2_0 Function +%27 = OpVariable %_ptr_Function__arr__arr_v4float_uint_2_0_uint_2 Function +%28 = OpLoad %int %in_var_INDEX +%29 = OpAccessChain %_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 %MyCBuffer %int_0 +%30 = OpLoad %_arr__arr_v4float_uint_2_uint_2 %29 +%32 = OpCompositeExtract %v4float %30 0 0 +%33 = OpCompositeExtract %v4float %30 0 1 +%34 = OpCompositeConstruct %_arr_v4float_uint_2_0 %32 %33 +%36 = OpCompositeExtract %v4float %30 1 0 +%37 = OpCompositeExtract %v4float %30 1 1 +%38 = OpCompositeConstruct %_arr_v4float_uint_2_0 %36 %37 +%39 = OpCompositeConstruct %_arr__arr_v4float_uint_2_0_uint_2 %34 %38 +; CHECK: OpStore +OpStore %27 %39 +%40 = OpAccessChain %_ptr_Function__arr_v4float_uint_2_0 %27 %28 +%42 = OpAccessChain %_ptr_Function_v4float %40 %28 +%43 = OpLoad %v4float %42 +; CHECK: [[ac1:%\w+]] = OpAccessChain %_ptr_Uniform__arr_v4float_uint_2 [[new_address]] %28 +; CHECK: [[ac2:%\w+]] = OpAccessChain %_ptr_Uniform_v4float [[ac1]] %28 +; CHECK: [[load:%\w+]] = OpLoad %v4float [[ac2]] +; CHECK: OpStore %out_var_SV_Target [[load]] +OpStore %out_var_SV_Target %43 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(text, false); +} + +// Test decomposing an object when we need to "rewrite" a store. +TEST_F(CopyPropArrayPassTest, DecomposeObjectForArrayStore) { + const std::string text = + R"( OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_MyCBuffer "type.MyCBuffer" + OpMemberName %type_MyCBuffer 0 "Data" + OpName %MyCBuffer "MyCBuffer" + OpName %main "main" + OpName %in_var_INDEX "in.var.INDEX" + OpName %out_var_SV_Target "out.var.SV_Target" + OpDecorate %_arr_v4float_uint_2 ArrayStride 16 + OpDecorate %_arr__arr_v4float_uint_2_uint_2 ArrayStride 32 + OpMemberDecorate %type_MyCBuffer 0 Offset 0 + OpDecorate %type_MyCBuffer Block + OpDecorate %in_var_INDEX Flat + OpDecorate %in_var_INDEX Location 0 + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %MyCBuffer DescriptorSet 0 + OpDecorate %MyCBuffer Binding 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2 +%_arr__arr_v4float_uint_2_uint_2 = OpTypeArray %_arr_v4float_uint_2 %uint_2 +%type_MyCBuffer = OpTypeStruct %_arr__arr_v4float_uint_2_uint_2 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_2_0 = OpTypeArray %v4float %uint_2 +%_arr__arr_v4float_uint_2_0_uint_2 = OpTypeArray %_arr_v4float_uint_2_0 %uint_2 +%_ptr_Function__arr__arr_v4float_uint_2_0_uint_2 = OpTypePointer Function %_arr__arr_v4float_uint_2_0_uint_2 + %int_0 = OpConstant %int 0 +%_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 = OpTypePointer Uniform %_arr__arr_v4float_uint_2_uint_2 +%_ptr_Function__arr_v4float_uint_2_0 = OpTypePointer Function %_arr_v4float_uint_2_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %25 = OpLabel + %26 = OpVariable %_ptr_Function__arr_v4float_uint_2_0 Function + %27 = OpVariable %_ptr_Function__arr__arr_v4float_uint_2_0_uint_2 Function + %28 = OpLoad %int %in_var_INDEX + %29 = OpAccessChain %_ptr_Uniform__arr__arr_v4float_uint_2_uint_2 %MyCBuffer %int_0 + %30 = OpLoad %_arr__arr_v4float_uint_2_uint_2 %29 + %31 = OpCompositeExtract %_arr_v4float_uint_2 %30 0 + %32 = OpCompositeExtract %v4float %31 0 + %33 = OpCompositeExtract %v4float %31 1 + %34 = OpCompositeConstruct %_arr_v4float_uint_2_0 %32 %33 + %35 = OpCompositeExtract %_arr_v4float_uint_2 %30 1 + %36 = OpCompositeExtract %v4float %35 0 + %37 = OpCompositeExtract %v4float %35 1 + %38 = OpCompositeConstruct %_arr_v4float_uint_2_0 %36 %37 + %39 = OpCompositeConstruct %_arr__arr_v4float_uint_2_0_uint_2 %34 %38 + OpStore %27 %39 +; CHECK: [[access_chain:%\w+]] = OpAccessChain %_ptr_Uniform__arr_v4float_uint_2 + %40 = OpAccessChain %_ptr_Function__arr_v4float_uint_2_0 %27 %28 +; CHECK: [[load:%\w+]] = OpLoad %_arr_v4float_uint_2 [[access_chain]] + %41 = OpLoad %_arr_v4float_uint_2_0 %40 +; CHECK: [[extract1:%\w+]] = OpCompositeExtract %v4float [[load]] 0 +; CHECK: [[extract2:%\w+]] = OpCompositeExtract %v4float [[load]] 1 +; CHECK: [[construct:%\w+]] = OpCompositeConstruct %_arr_v4float_uint_2_0 [[extract1]] [[extract2]] +; CHEKC: OpStore %26 [[construct]] + OpStore %26 %41 + %42 = OpAccessChain %_ptr_Function_v4float %26 %28 + %43 = OpLoad %v4float %42 + OpStore %out_var_SV_Target %43 + OpReturn + OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(text, false); +} + +// Test decomposing an object when we need to "rewrite" a store. +TEST_F(CopyPropArrayPassTest, DecomposeObjectForStructStore) { + const std::string text = + R"( OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target + OpExecutionMode %main OriginUpperLeft + OpSource HLSL 600 + OpName %type_MyCBuffer "type.MyCBuffer" + OpMemberName %type_MyCBuffer 0 "Data" + OpName %MyCBuffer "MyCBuffer" + OpName %main "main" + OpName %in_var_INDEX "in.var.INDEX" + OpName %out_var_SV_Target "out.var.SV_Target" + OpMemberDecorate %type_MyCBuffer 0 Offset 0 + OpDecorate %type_MyCBuffer Block + OpDecorate %in_var_INDEX Flat + OpDecorate %in_var_INDEX Location 0 + OpDecorate %out_var_SV_Target Location 0 + OpDecorate %MyCBuffer DescriptorSet 0 + OpDecorate %MyCBuffer Binding 0 +; CHECK: OpDecorate [[decorated_type:%\w+]] GLSLPacked + OpDecorate %struct GLSLPacked + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +; CHECK: [[decorated_type]] = OpTypeStruct +%struct = OpTypeStruct %float %uint +%_arr_struct_uint_2 = OpTypeArray %struct %uint_2 +%type_MyCBuffer = OpTypeStruct %_arr_struct_uint_2 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer + %void = OpTypeVoid + %14 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +; CHECK: [[struct:%\w+]] = OpTypeStruct %float %uint +%struct_0 = OpTypeStruct %float %uint +%_arr_struct_0_uint_2 = OpTypeArray %struct_0 %uint_2 +%_ptr_Function__arr_struct_0_uint_2 = OpTypePointer Function %_arr_struct_0_uint_2 + %int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_struct_uint_2 = OpTypePointer Uniform %_arr_struct_uint_2 +; CHECK: [[decorated_ptr:%\w+]] = OpTypePointer Uniform [[decorated_type]] +%_ptr_Function_struct_0 = OpTypePointer Function %struct_0 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output + %main = OpFunction %void None %14 + %25 = OpLabel + %26 = OpVariable %_ptr_Function_struct_0 Function + %27 = OpVariable %_ptr_Function__arr_struct_0_uint_2 Function + %28 = OpLoad %int %in_var_INDEX + %29 = OpAccessChain %_ptr_Uniform__arr_struct_uint_2 %MyCBuffer %int_0 + %30 = OpLoad %_arr_struct_uint_2 %29 + %31 = OpCompositeExtract %struct %30 0 + %32 = OpCompositeExtract %v4float %31 0 + %33 = OpCompositeExtract %v4float %31 1 + %34 = OpCompositeConstruct %struct_0 %32 %33 + %35 = OpCompositeExtract %struct %30 1 + %36 = OpCompositeExtract %float %35 0 + %37 = OpCompositeExtract %uint %35 1 + %38 = OpCompositeConstruct %struct_0 %36 %37 + %39 = OpCompositeConstruct %_arr_struct_0_uint_2 %34 %38 + OpStore %27 %39 +; CHECK: [[access_chain:%\w+]] = OpAccessChain [[decorated_ptr]] + %40 = OpAccessChain %_ptr_Function_struct_0 %27 %28 +; CHECK: [[load:%\w+]] = OpLoad [[decorated_type]] [[access_chain]] + %41 = OpLoad %struct_0 %40 +; CHECK: [[extract1:%\w+]] = OpCompositeExtract %float [[load]] 0 +; CHECK: [[extract2:%\w+]] = OpCompositeExtract %uint [[load]] 1 +; CHECK: [[construct:%\w+]] = OpCompositeConstruct [[struct]] [[extract1]] [[extract2]] +; CHEKC: OpStore %26 [[construct]] + OpStore %26 %41 + %42 = OpAccessChain %_ptr_Function_v4float %26 %28 + %43 = OpLoad %v4float %42 + OpStore %out_var_SV_Target %43 + OpReturn + OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(text, false); +} + +TEST_F(CopyPropArrayPassTest, CopyViaInserts) { + const std::string before = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: OpVariable +; CHECK: OpAccessChain +; CHECK: [[new_address:%\w+]] = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +; CHECK: [[element_ptr:%\w+]] = OpAccessChain %_ptr_Uniform_v4float [[new_address]] %24 +; CHECK: [[load:%\w+]] = OpLoad %v4float [[element_ptr]] +; CHECK: OpStore %out_var_SV_Target [[load]] +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%undef = OpUndef %_arr_v4float_uint_8_0 +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%i0 = OpCompositeInsert %_arr_v4float_uint_8_0 %27 %undef 0 +%28 = OpCompositeExtract %v4float %26 1 +%i1 = OpCompositeInsert %_arr_v4float_uint_8_0 %28 %i0 1 +%29 = OpCompositeExtract %v4float %26 2 +%i2 = OpCompositeInsert %_arr_v4float_uint_8_0 %29 %i1 2 +%30 = OpCompositeExtract %v4float %26 3 +%i3 = OpCompositeInsert %_arr_v4float_uint_8_0 %30 %i2 3 +%31 = OpCompositeExtract %v4float %26 4 +%i4 = OpCompositeInsert %_arr_v4float_uint_8_0 %31 %i3 4 +%32 = OpCompositeExtract %v4float %26 5 +%i5 = OpCompositeInsert %_arr_v4float_uint_8_0 %32 %i4 5 +%33 = OpCompositeExtract %v4float %26 6 +%i6 = OpCompositeInsert %_arr_v4float_uint_8_0 %33 %i5 6 +%34 = OpCompositeExtract %v4float %26 7 +%i7 = OpCompositeInsert %_arr_v4float_uint_8_0 %34 %i6 7 +OpStore %23 %i7 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(before, false); +} +#endif // SPIRV_EFFCEE + +// This test will place a load before the store. We cannot propagate in this +// case. +TEST_F(CopyPropArrayPassTest, LoadBeforeStore) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%38 = OpAccessChain %_ptr_Function_v4float %23 %24 +%39 = OpLoad %v4float %36 +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%28 = OpCompositeExtract %v4float %26 1 +%29 = OpCompositeExtract %v4float %26 2 +%30 = OpCompositeExtract %v4float %26 3 +%31 = OpCompositeExtract %v4float %26 4 +%32 = OpCompositeExtract %v4float %26 5 +%33 = OpCompositeExtract %v4float %26 6 +%34 = OpCompositeExtract %v4float %26 7 +%35 = OpCompositeConstruct %_arr_v4float_uint_8_0 %27 %28 %29 %30 %31 %32 %33 %34 +OpStore %23 %35 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// This test will place a load where it is not dominated by the store. We +// cannot propagate in this case. +TEST_F(CopyPropArrayPassTest, LoadNotDominated) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +OpSelectionMerge %merge None +OpBranchConditional %true %if %else +%if = OpLabel +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%28 = OpCompositeExtract %v4float %26 1 +%29 = OpCompositeExtract %v4float %26 2 +%30 = OpCompositeExtract %v4float %26 3 +%31 = OpCompositeExtract %v4float %26 4 +%32 = OpCompositeExtract %v4float %26 5 +%33 = OpCompositeExtract %v4float %26 6 +%34 = OpCompositeExtract %v4float %26 7 +%35 = OpCompositeConstruct %_arr_v4float_uint_8_0 %27 %28 %29 %30 %31 %32 %33 %34 +OpStore %23 %35 +%38 = OpAccessChain %_ptr_Function_v4float %23 %24 +%39 = OpLoad %v4float %36 +OpBranch %merge +%else = OpLabel +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpBranch %merge +%merge = OpLabel +%phi = OpPhi %out_var_SV_Target %39 %if %37 %else +OpStore %out_var_SV_Target %phi +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// This test has a partial store to the variable. We cannot propagate in this +// case. +TEST_F(CopyPropArrayPassTest, PartialStore) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%f0 = OpConstant %float 0 +%v4const = OpConstantComposite %v4float %f0 %f0 %f0 %f0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%28 = OpCompositeExtract %v4float %26 1 +%29 = OpCompositeExtract %v4float %26 2 +%30 = OpCompositeExtract %v4float %26 3 +%31 = OpCompositeExtract %v4float %26 4 +%32 = OpCompositeExtract %v4float %26 5 +%33 = OpCompositeExtract %v4float %26 6 +%34 = OpCompositeExtract %v4float %26 7 +%35 = OpCompositeConstruct %_arr_v4float_uint_8_0 %27 %28 %29 %30 %31 %32 %33 %34 +OpStore %23 %35 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +%39 = OpStore %36 %v4const +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// This test does not have a proper copy of an object. We cannot propagate in +// this case. +TEST_F(CopyPropArrayPassTest, NotACopy) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%f0 = OpConstant %float 0 +%v4const = OpConstantComposite %v4float %f0 %f0 %f0 %f0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%28 = OpCompositeExtract %v4float %26 0 +%29 = OpCompositeExtract %v4float %26 2 +%30 = OpCompositeExtract %v4float %26 3 +%31 = OpCompositeExtract %v4float %26 4 +%32 = OpCompositeExtract %v4float %26 5 +%33 = OpCompositeExtract %v4float %26 6 +%34 = OpCompositeExtract %v4float %26 7 +%35 = OpCompositeConstruct %_arr_v4float_uint_8_0 %27 %28 %29 %30 %31 %32 %33 %34 +OpStore %23 %35 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(CopyPropArrayPassTest, BadCopyViaInserts1) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%undef = OpUndef %_arr_v4float_uint_8_0 +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%i0 = OpCompositeInsert %_arr_v4float_uint_8_0 %27 %undef 0 +%28 = OpCompositeExtract %v4float %26 1 +%i1 = OpCompositeInsert %_arr_v4float_uint_8_0 %28 %i0 1 +%29 = OpCompositeExtract %v4float %26 2 +%i2 = OpCompositeInsert %_arr_v4float_uint_8_0 %29 %i1 3 +%30 = OpCompositeExtract %v4float %26 3 +%i3 = OpCompositeInsert %_arr_v4float_uint_8_0 %30 %i2 3 +%31 = OpCompositeExtract %v4float %26 4 +%i4 = OpCompositeInsert %_arr_v4float_uint_8_0 %31 %i3 4 +%32 = OpCompositeExtract %v4float %26 5 +%i5 = OpCompositeInsert %_arr_v4float_uint_8_0 %32 %i4 5 +%33 = OpCompositeExtract %v4float %26 6 +%i6 = OpCompositeInsert %_arr_v4float_uint_8_0 %33 %i5 6 +%34 = OpCompositeExtract %v4float %26 7 +%i7 = OpCompositeInsert %_arr_v4float_uint_8_0 %34 %i6 7 +OpStore %23 %i7 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(CopyPropArrayPassTest, BadCopyViaInserts2) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%undef = OpUndef %_arr_v4float_uint_8_0 +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%27 = OpCompositeExtract %v4float %26 0 +%i0 = OpCompositeInsert %_arr_v4float_uint_8_0 %27 %undef 0 +%28 = OpCompositeExtract %v4float %26 1 +%i1 = OpCompositeInsert %_arr_v4float_uint_8_0 %28 %i0 1 +%29 = OpCompositeExtract %v4float %26 3 +%i2 = OpCompositeInsert %_arr_v4float_uint_8_0 %29 %i1 2 +%30 = OpCompositeExtract %v4float %26 3 +%i3 = OpCompositeInsert %_arr_v4float_uint_8_0 %30 %i2 3 +%31 = OpCompositeExtract %v4float %26 4 +%i4 = OpCompositeInsert %_arr_v4float_uint_8_0 %31 %i3 4 +%32 = OpCompositeExtract %v4float %26 5 +%i5 = OpCompositeInsert %_arr_v4float_uint_8_0 %32 %i4 5 +%33 = OpCompositeExtract %v4float %26 6 +%i6 = OpCompositeInsert %_arr_v4float_uint_8_0 %33 %i5 6 +%34 = OpCompositeExtract %v4float %26 7 +%i7 = OpCompositeInsert %_arr_v4float_uint_8_0 %34 %i6 7 +OpStore %23 %i7 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(CopyPropArrayPassTest, BadCopyViaInserts3) { + const std::string text = + R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %in_var_INDEX %out_var_SV_Target +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 600 +OpName %type_MyCBuffer "type.MyCBuffer" +OpMemberName %type_MyCBuffer 0 "Data" +OpName %MyCBuffer "MyCBuffer" +OpName %main "main" +OpName %in_var_INDEX "in.var.INDEX" +OpName %out_var_SV_Target "out.var.SV_Target" +OpDecorate %_arr_v4float_uint_8 ArrayStride 16 +OpMemberDecorate %type_MyCBuffer 0 Offset 0 +OpDecorate %type_MyCBuffer Block +OpDecorate %in_var_INDEX Flat +OpDecorate %in_var_INDEX Location 0 +OpDecorate %out_var_SV_Target Location 0 +OpDecorate %MyCBuffer DescriptorSet 0 +OpDecorate %MyCBuffer Binding 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%uint = OpTypeInt 32 0 +%uint_8 = OpConstant %uint 8 +%_arr_v4float_uint_8 = OpTypeArray %v4float %uint_8 +%type_MyCBuffer = OpTypeStruct %_arr_v4float_uint_8 +%_ptr_Uniform_type_MyCBuffer = OpTypePointer Uniform %type_MyCBuffer +%void = OpTypeVoid +%13 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v4float_uint_8_0 = OpTypeArray %v4float %uint_8 +%_ptr_Function__arr_v4float_uint_8_0 = OpTypePointer Function %_arr_v4float_uint_8_0 +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_v4float_uint_8 = OpTypePointer Uniform %_arr_v4float_uint_8 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%MyCBuffer = OpVariable %_ptr_Uniform_type_MyCBuffer Uniform +%in_var_INDEX = OpVariable %_ptr_Input_int Input +%out_var_SV_Target = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %13 +%22 = OpLabel +%23 = OpVariable %_ptr_Function__arr_v4float_uint_8_0 Function +%undef = OpUndef %_arr_v4float_uint_8_0 +%24 = OpLoad %int %in_var_INDEX +%25 = OpAccessChain %_ptr_Uniform__arr_v4float_uint_8 %MyCBuffer %int_0 +%26 = OpLoad %_arr_v4float_uint_8 %25 +%28 = OpCompositeExtract %v4float %26 1 +%i1 = OpCompositeInsert %_arr_v4float_uint_8_0 %28 %undef 1 +%29 = OpCompositeExtract %v4float %26 2 +%i2 = OpCompositeInsert %_arr_v4float_uint_8_0 %29 %i1 2 +%30 = OpCompositeExtract %v4float %26 3 +%i3 = OpCompositeInsert %_arr_v4float_uint_8_0 %30 %i2 3 +%31 = OpCompositeExtract %v4float %26 4 +%i4 = OpCompositeInsert %_arr_v4float_uint_8_0 %31 %i3 4 +%32 = OpCompositeExtract %v4float %26 5 +%i5 = OpCompositeInsert %_arr_v4float_uint_8_0 %32 %i4 5 +%33 = OpCompositeExtract %v4float %26 6 +%i6 = OpCompositeInsert %_arr_v4float_uint_8_0 %33 %i5 6 +%34 = OpCompositeExtract %v4float %26 7 +%i7 = OpCompositeInsert %_arr_v4float_uint_8_0 %34 %i6 7 +OpStore %23 %i7 +%36 = OpAccessChain %_ptr_Function_v4float %23 %24 +%37 = OpLoad %v4float %36 +OpStore %out_var_SV_Target %37 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(CopyPropArrayPassTest, AtomicAdd) { + const std::string before = R"(OpCapability SampledBuffer +OpCapability StorageImageExtendedFormats +OpCapability ImageBuffer +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %2 "min" %gl_GlobalInvocationID +OpExecutionMode %2 LocalSize 64 1 1 +OpSource HLSL 600 +OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId +OpDecorate %4 DescriptorSet 4 +OpDecorate %4 Binding 70 +%uint = OpTypeInt 32 0 +%6 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6 +%_ptr_Function_6 = OpTypePointer Function %6 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Image_uint = OpTypePointer Image %uint +%4 = OpVariable %_ptr_UniformConstant_6 UniformConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%2 = OpFunction %void None %10 +%17 = OpLabel +%16 = OpVariable %_ptr_Function_6 Function +%18 = OpLoad %6 %4 +OpStore %16 %18 +%19 = OpImageTexelPointer %_ptr_Image_uint %16 %uint_0 %uint_0 +%20 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %uint_1 +OpReturn +OpFunctionEnd +)"; + + const std::string after = R"(OpCapability SampledBuffer +OpCapability StorageImageExtendedFormats +OpCapability ImageBuffer +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %2 "min" %gl_GlobalInvocationID +OpExecutionMode %2 LocalSize 64 1 1 +OpSource HLSL 600 +OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId +OpDecorate %4 DescriptorSet 4 +OpDecorate %4 Binding 70 +%uint = OpTypeInt 32 0 +%6 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6 +%_ptr_Function_6 = OpTypePointer Function %6 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Image_uint = OpTypePointer Image %uint +%4 = OpVariable %_ptr_UniformConstant_6 UniformConstant +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input +%2 = OpFunction %void None %10 +%17 = OpLabel +%16 = OpVariable %_ptr_Function_6 Function +%18 = OpLoad %6 %4 +OpStore %16 %18 +%19 = OpImageTexelPointer %_ptr_Image_uint %4 %uint_0 %uint_0 +%20 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %uint_1 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_branch_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_branch_elim_test.cpp new file mode 100644 index 00000000000..29084e3bb30 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_branch_elim_test.cpp @@ -0,0 +1,2205 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using DeadBranchElimTest = PassTest<::testing::Test>; + +TEST_F(DeadBranchElimTest, IfThenElseTrue) { + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v; + // if (true) + // v = vec4(0.0,0.0,0.0,0.0); + // else + // v = vec4(1.0,1.0,1.0,1.0); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%14 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +OpSelectionMerge %20 None +OpBranchConditional %true %21 %22 +%21 = OpLabel +OpStore %v %14 +OpBranch %20 +%22 = OpLabel +OpStore %v %16 +OpBranch %20 +%20 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +OpBranch %21 +%21 = OpLabel +OpStore %v %14 +OpBranch %20 +%20 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, IfThenElseFalse) { + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v; + // if (false) + // v = vec4(0.0,0.0,0.0,0.0); + // else + // v = vec4(1.0,1.0,1.0,1.0); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%bool = OpTypeBool +%false = OpConstantFalse %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%14 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +OpSelectionMerge %20 None +OpBranchConditional %false %21 %22 +%21 = OpLabel +OpStore %v %14 +OpBranch %20 +%22 = OpLabel +OpStore %v %16 +OpBranch %20 +%20 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +OpBranch %22 +%22 = OpLabel +OpStore %v %16 +OpBranch %20 +%20 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, IfThenTrue) { + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // if (true) + // v = v * vec4(0.5,0.5,0.5,0.5); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float_0_5 = OpConstant %float 0.5 +%15 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +OpSelectionMerge %19 None +OpBranchConditional %true %20 %19 +%20 = OpLabel +%21 = OpLoad %v4float %v +%22 = OpFMul %v4float %21 %15 +OpStore %v %22 +OpBranch %19 +%19 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +OpBranch %20 +%20 = OpLabel +%21 = OpLoad %v4float %v +%22 = OpFMul %v4float %21 %15 +OpStore %v %22 +OpBranch %19 +%19 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, IfThenFalse) { + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // if (false) + // v = v * vec4(0.5,0.5,0.5,0.5); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%bool = OpTypeBool +%false = OpConstantFalse %bool +%float_0_5 = OpConstant %float 0.5 +%15 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +OpSelectionMerge %19 None +OpBranchConditional %false %20 %19 +%20 = OpLabel +%21 = OpLoad %v4float %v +%22 = OpFMul %v4float %21 %15 +OpStore %v %22 +OpBranch %19 +%19 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +OpBranch %19 +%19 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, IfThenElsePhiTrue) { + // Test handling of phi in merge block after dead branch elimination. + // Note: The SPIR-V has had store/load elimination and phi insertion + // + // #version 140 + // + // void main() + // { + // vec4 v; + // if (true) + // v = vec4(0.0,0.0,0.0,0.0); + // else + // v = vec4(1.0,1.0,1.0,1.0); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +)"; + + const std::string before = + R"(%main = OpFunction %void None %5 +%17 = OpLabel +OpSelectionMerge %18 None +OpBranchConditional %true %19 %20 +%19 = OpLabel +OpBranch %18 +%20 = OpLabel +OpBranch %18 +%18 = OpLabel +%21 = OpPhi %v4float %12 %19 %14 %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %5 +%17 = OpLabel +OpBranch %19 +%19 = OpLabel +OpBranch %18 +%18 = OpLabel +OpStore %gl_FragColor %12 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, IfThenElsePhiFalse) { + // Test handling of phi in merge block after dead branch elimination. + // Note: The SPIR-V has had store/load elimination and phi insertion + // + // #version 140 + // + // void main() + // { + // vec4 v; + // if (true) + // v = vec4(0.0,0.0,0.0,0.0); + // else + // v = vec4(1.0,1.0,1.0,1.0); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%bool = OpTypeBool +%false = OpConstantFalse %bool +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +)"; + + const std::string before = + R"(%main = OpFunction %void None %5 +%17 = OpLabel +OpSelectionMerge %18 None +OpBranchConditional %false %19 %20 +%19 = OpLabel +OpBranch %18 +%20 = OpLabel +OpBranch %18 +%18 = OpLabel +%21 = OpPhi %v4float %12 %19 %14 %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %5 +%17 = OpLabel +OpBranch %20 +%20 = OpLabel +OpBranch %18 +%18 = OpLabel +OpStore %gl_FragColor %14 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, CompoundIfThenElseFalse) { + // #version 140 + // + // layout(std140) uniform U_t + // { + // bool g_B ; + // } ; + // + // void main() + // { + // vec4 v; + // if (false) { + // if (g_B) + // v = vec4(0.0,0.0,0.0,0.0); + // else + // v = vec4(1.0,1.0,1.0,1.0); + // } else { + // if (g_B) + // v = vec4(1.0,1.0,1.0,1.0); + // else + // v = vec4(0.0,0.0,0.0,0.0); + // } + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_B" +OpName %_ "" +OpName %v "v" +OpName %gl_FragColor "gl_FragColor" +OpMemberDecorate %U_t 0 Offset 0 +OpDecorate %U_t Block +OpDecorate %_ DescriptorSet 0 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%bool = OpTypeBool +%false = OpConstantFalse %bool +%uint = OpTypeInt 32 0 +%U_t = OpTypeStruct %uint +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%uint_0 = OpConstant %uint 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%21 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%25 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +OpSelectionMerge %26 None +OpBranchConditional %false %27 %28 +%27 = OpLabel +%29 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%30 = OpLoad %uint %29 +%31 = OpINotEqual %bool %30 %uint_0 +OpSelectionMerge %32 None +OpBranchConditional %31 %33 %34 +%33 = OpLabel +OpStore %v %21 +OpBranch %32 +%34 = OpLabel +OpStore %v %23 +OpBranch %32 +%32 = OpLabel +OpBranch %26 +%28 = OpLabel +%35 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%36 = OpLoad %uint %35 +%37 = OpINotEqual %bool %36 %uint_0 +OpSelectionMerge %38 None +OpBranchConditional %37 %39 %40 +%39 = OpLabel +OpStore %v %23 +OpBranch %38 +%40 = OpLabel +OpStore %v %21 +OpBranch %38 +%38 = OpLabel +OpBranch %26 +%26 = OpLabel +%41 = OpLoad %v4float %v +OpStore %gl_FragColor %41 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%25 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +OpBranch %28 +%28 = OpLabel +%35 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%36 = OpLoad %uint %35 +%37 = OpINotEqual %bool %36 %uint_0 +OpSelectionMerge %38 None +OpBranchConditional %37 %39 %40 +%40 = OpLabel +OpStore %v %21 +OpBranch %38 +%39 = OpLabel +OpStore %v %23 +OpBranch %38 +%38 = OpLabel +OpBranch %26 +%26 = OpLabel +%41 = OpLoad %v4float %v +OpStore %gl_FragColor %41 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, PreventOrphanMerge) { + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float_0_5 = OpConstant %float 0.5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%16 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%17 = OpLoad %v4float %BaseColor +OpStore %v %17 +OpSelectionMerge %18 None +OpBranchConditional %true %19 %20 +%19 = OpLabel +OpKill +%20 = OpLabel +%21 = OpLoad %v4float %v +%22 = OpVectorTimesScalar %v4float %21 %float_0_5 +OpStore %v %22 +OpBranch %18 +%18 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%16 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%17 = OpLoad %v4float %BaseColor +OpStore %v %17 +OpBranch %19 +%19 = OpLabel +OpKill +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, HandleOrphanMerge) { + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_ "foo(" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %gl_FragColor Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%9 = OpTypeFunction %v4float +%bool = OpTypeBool +%true = OpConstantTrue %bool +%float_0 = OpConstant %float 0 +%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %6 +%17 = OpLabel +%18 = OpFunctionCall %v4float %foo_ +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%foo_ = OpFunction %v4float None %9 +%19 = OpLabel +OpSelectionMerge %20 None +OpBranchConditional %true %21 %22 +%21 = OpLabel +OpReturnValue %13 +%22 = OpLabel +OpReturnValue %15 +%20 = OpLabel +%23 = OpUndef %v4float +OpReturnValue %23 +OpFunctionEnd +)"; + + const std::string after = + R"(%foo_ = OpFunction %v4float None %9 +%19 = OpLabel +OpBranch %21 +%21 = OpLabel +OpReturnValue %13 +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, KeepContinueTargetWhenKillAfterMerge) { + // #version 450 + // void main() { + // bool c; + // bool d; + // while(c) { + // if(d) { + // continue; + // } + // if(false) { + // continue; + // } + // discard; + // } + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %c "c" +OpName %d "d" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool +%false = OpConstantFalse %bool +)"; + + const std::string before = + R"(%main = OpFunction %void None %6 +%10 = OpLabel +%c = OpVariable %_ptr_Function_bool Function +%d = OpVariable %_ptr_Function_bool Function +OpBranch %11 +%11 = OpLabel +OpLoopMerge %12 %13 None +OpBranch %14 +%14 = OpLabel +%15 = OpLoad %bool %c +OpBranchConditional %15 %16 %12 +%16 = OpLabel +%17 = OpLoad %bool %d +OpSelectionMerge %18 None +OpBranchConditional %17 %19 %18 +%19 = OpLabel +OpBranch %13 +%18 = OpLabel +OpSelectionMerge %20 None +OpBranchConditional %false %21 %20 +%21 = OpLabel +OpBranch %13 +%20 = OpLabel +OpKill +%13 = OpLabel +OpBranch %11 +%12 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %6 +%10 = OpLabel +%c = OpVariable %_ptr_Function_bool Function +%d = OpVariable %_ptr_Function_bool Function +OpBranch %11 +%11 = OpLabel +OpLoopMerge %12 %13 None +OpBranch %14 +%14 = OpLabel +%15 = OpLoad %bool %c +OpBranchConditional %15 %16 %12 +%16 = OpLabel +%17 = OpLoad %bool %d +OpSelectionMerge %18 None +OpBranchConditional %17 %19 %18 +%19 = OpLabel +OpBranch %13 +%18 = OpLabel +OpBranch %20 +%20 = OpLabel +OpKill +%13 = OpLabel +OpBranch %11 +%12 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, DecorateDeleted) { + // Note: SPIR-V hand-edited to add decoration + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // if (false) + // v = v * vec4(0.5,0.5,0.5,0.5); + // gl_FragColor = v; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %22 RelaxedPrecision +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%bool = OpTypeBool +%false = OpConstantFalse %bool +%float_0_5 = OpConstant %float 0.5 +%15 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%bool = OpTypeBool +%false = OpConstantFalse %bool +%float_0_5 = OpConstant %float 0.5 +%16 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +OpSelectionMerge %19 None +OpBranchConditional %false %20 %19 +%20 = OpLabel +%21 = OpLoad %v4float %v +%22 = OpFMul %v4float %21 %15 +OpStore %v %22 +OpBranch %19 +%19 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%18 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%19 = OpLoad %v4float %BaseColor +OpStore %v %19 +OpBranch %20 +%20 = OpLabel +%23 = OpLoad %v4float %v +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs_before + before, + predefs_after + after, true, true); +} + +TEST_F(DeadBranchElimTest, LoopInDeadBranch) { + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // vec4 v = BaseColor; + // if (false) + // for (int i=0; i<3; i++) + // v = v * 0.5; + // OutColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %i "i" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%bool = OpTypeBool +%false = OpConstantFalse %bool +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_3 = OpConstant %int 3 +%float_0_5 = OpConstant %float 0.5 +%int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%23 = OpLoad %v4float %BaseColor +OpStore %v %23 +OpSelectionMerge %24 None +OpBranchConditional %false %25 %24 +%25 = OpLabel +OpStore %i %int_0 +OpBranch %26 +%26 = OpLabel +OpLoopMerge %27 %28 None +OpBranch %29 +%29 = OpLabel +%30 = OpLoad %int %i +%31 = OpSLessThan %bool %30 %int_3 +OpBranchConditional %31 %32 %27 +%32 = OpLabel +%33 = OpLoad %v4float %v +%34 = OpVectorTimesScalar %v4float %33 %float_0_5 +OpStore %v %34 +OpBranch %28 +%28 = OpLabel +%35 = OpLoad %int %i +%36 = OpIAdd %int %35 %int_1 +OpStore %i %36 +OpBranch %26 +%27 = OpLabel +OpBranch %24 +%24 = OpLabel +%37 = OpLoad %v4float %v +OpStore %OutColor %37 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%23 = OpLoad %v4float %BaseColor +OpStore %v %23 +OpBranch %24 +%24 = OpLabel +%37 = OpLoad %v4float %v +OpStore %OutColor %37 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, SwitchLiveCase) { + // #version 450 + // + // layout (location=0) in vec4 BaseColor; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // switch (1) { + // case 0: + // OutColor = vec4(0.0,0.0,0.0,0.0); + // break; + // case 1: + // OutColor = vec4(0.125,0.125,0.125,0.125); + // break; + // case 2: + // OutColor = vec4(0.25,0.25,0.25,0.25); + // break; + // default: + // OutColor = vec4(1.0,1.0,1.0,1.0); + // } + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %OutColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %OutColor "OutColor" +OpName %BaseColor "BaseColor" +OpDecorate %OutColor Location 0 +OpDecorate %BaseColor Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_125 = OpConstant %float 0.125 +%15 = OpConstantComposite %v4float %float_0_125 %float_0_125 %float_0_125 %float_0_125 +%float_0_25 = OpConstant %float 0.25 +%17 = OpConstantComposite %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 +%float_1 = OpConstant %float 1 +%19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %6 +%21 = OpLabel +OpSelectionMerge %22 None +OpSwitch %int_1 %23 0 %24 1 %25 2 %26 +%23 = OpLabel +OpStore %OutColor %19 +OpBranch %22 +%24 = OpLabel +OpStore %OutColor %13 +OpBranch %22 +%25 = OpLabel +OpStore %OutColor %15 +OpBranch %22 +%26 = OpLabel +OpStore %OutColor %17 +OpBranch %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %6 +%21 = OpLabel +OpBranch %25 +%25 = OpLabel +OpStore %OutColor %15 +OpBranch %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, SwitchLiveDefault) { + // #version 450 + // + // layout (location=0) in vec4 BaseColor; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // switch (7) { + // case 0: + // OutColor = vec4(0.0,0.0,0.0,0.0); + // break; + // case 1: + // OutColor = vec4(0.125,0.125,0.125,0.125); + // break; + // case 2: + // OutColor = vec4(0.25,0.25,0.25,0.25); + // break; + // default: + // OutColor = vec4(1.0,1.0,1.0,1.0); + // } + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %OutColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %OutColor "OutColor" +OpName %BaseColor "BaseColor" +OpDecorate %OutColor Location 0 +OpDecorate %BaseColor Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%int_7 = OpConstant %int 7 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_125 = OpConstant %float 0.125 +%15 = OpConstantComposite %v4float %float_0_125 %float_0_125 %float_0_125 %float_0_125 +%float_0_25 = OpConstant %float 0.25 +%17 = OpConstantComposite %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 +%float_1 = OpConstant %float 1 +%19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %6 +%21 = OpLabel +OpSelectionMerge %22 None +OpSwitch %int_7 %23 0 %24 1 %25 2 %26 +%23 = OpLabel +OpStore %OutColor %19 +OpBranch %22 +%24 = OpLabel +OpStore %OutColor %13 +OpBranch %22 +%25 = OpLabel +OpStore %OutColor %15 +OpBranch %22 +%26 = OpLabel +OpStore %OutColor %17 +OpBranch %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %6 +%21 = OpLabel +OpBranch %23 +%23 = OpLabel +OpStore %OutColor %19 +OpBranch %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(DeadBranchElimTest, SwitchLiveCaseBreakFromLoop) { + // This sample does not directly translate to GLSL/HLSL as + // direct breaks from a loop cannot be made from a switch. + // This construct is currently formed by inlining a function + // containing early returns from the cases of a switch. The + // function is wrapped in a one-trip loop and returns are + // translated to branches to the loop's merge block. + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %OutColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %oc "oc" +OpName %OutColor "OutColor" +OpName %BaseColor "BaseColor" +OpDecorate %OutColor Location 0 +OpDecorate %BaseColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%17 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_0_125 = OpConstant %float 0.125 +%19 = OpConstantComposite %v4float %float_0_125 %float_0_125 %float_0_125 %float_0_125 +%float_0_25 = OpConstant %float 0.25 +%21 = OpConstantComposite %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 +%float_1 = OpConstant %float 1 +%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%26 = OpLabel +%oc = OpVariable %_ptr_Function_v4float Function +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +OpSelectionMerge %31 None +OpSwitch %int_1 %31 0 %32 1 %33 2 %34 +%32 = OpLabel +OpStore %oc %17 +OpBranch %28 +%33 = OpLabel +OpStore %oc %19 +OpBranch %28 +%34 = OpLabel +OpStore %oc %21 +OpBranch %28 +%31 = OpLabel +OpStore %oc %23 +OpBranch %28 +%29 = OpLabel +OpBranchConditional %false %27 %28 +%28 = OpLabel +%35 = OpLoad %v4float %oc +OpStore %OutColor %35 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%26 = OpLabel +%oc = OpVariable %_ptr_Function_v4float Function +OpBranch %27 +%27 = OpLabel +OpLoopMerge %28 %29 None +OpBranch %30 +%30 = OpLabel +OpBranch %33 +%33 = OpLabel +OpStore %oc %19 +OpBranch %28 +%29 = OpLabel +OpBranch %27 +%28 = OpLabel +%35 = OpLoad %v4float %oc +OpStore %OutColor %35 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(DeadBranchElimTest, LeaveContinueBackedge) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None +; CHECK: [[continue]] = OpLabel +; CHECK-NEXT: OpBranchConditional {{%\w+}} {{%\w+}} [[merge]] +; CHECK-NEXT: [[merge]] = OpLabel +; CHECK-NEXT: OpReturn +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +%bool = OpTypeBool +%false = OpConstantFalse %bool +%void = OpTypeVoid +%funcTy = OpTypeFunction %void +%func = OpFunction %void None %funcTy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %4 +%4 = OpLabel +; Be careful we don't remove the backedge to %2 despite never taking it. +OpBranchConditional %false %2 %3 +%3 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +TEST_F(DeadBranchElimTest, LeaveContinueBackedgeExtraBlock) { + const std::string text = R"( +; CHECK: OpBranch [[header:%\w+]] +; CHECK: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None +; CHECK-NEXT: OpBranch [[continue]] +; CHECK-NEXT: [[continue]] = OpLabel +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[extra:%\w+]] [[merge]] +; CHECK-NEXT: [[extra]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +; CHECK-NEXT: [[merge]] = OpLabel +; CHECK-NEXT: OpReturn +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +%bool = OpTypeBool +%false = OpConstantFalse %bool +%void = OpTypeVoid +%funcTy = OpTypeFunction %void +%func = OpFunction %void None %funcTy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %4 +%4 = OpLabel +; Be careful we don't remove the backedge to %2 despite never taking it. +OpBranchConditional %false %5 %3 +; This block remains live despite being unreachable. +%5 = OpLabel +OpBranch %2 +%3 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, RemovePhiWithUnreachableContinue) { + const std::string text = R"( +; CHECK: [[entry:%\w+]] = OpLabel +; CHECK-NEXT: OpBranch [[header:%\w+]] +; CHECK: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK-NEXT: [[ret]] = OpLabel +; CHECK-NEXT: OpReturn +; CHECK: [[continue]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpUnreachable +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%bool = OpTypeBool +%false = OpConstantFalse %bool +%true = OpConstantTrue %bool +%void = OpTypeVoid +%funcTy = OpTypeFunction %void +%func = OpFunction %void None %funcTy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %bool %false %1 %true %continue +OpLoopMerge %merge %continue None +OpBranch %3 +%3 = OpLabel +OpReturn +%continue = OpLabel +OpBranch %2 +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, UnreachableLoopMergeAndContinueTargets) { + const std::string text = R"( +; CHECK: [[undef:%\w+]] = OpUndef %bool +; CHECK: OpSelectionMerge [[header:%\w+]] +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[if_lab:%\w+]] [[else_lab:%\w+]] +; CHECK: OpPhi %bool %false [[if_lab]] %false [[else_lab]] [[undef]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK-NEXT: OpBranch [[ret:%\w+]] +; CHECK-NEXT: [[ret]] = OpLabel +; CHECK-NEXT: OpReturn +; CHECK: [[continue]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpUnreachable +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%bool = OpTypeBool +%false = OpConstantFalse %bool +%true = OpConstantTrue %bool +%void = OpTypeVoid +%funcTy = OpTypeFunction %void +%func = OpFunction %void None %funcTy +%1 = OpLabel +%c = OpUndef %bool +OpSelectionMerge %2 None +OpBranchConditional %c %if %else +%if = OpLabel +OpBranch %2 +%else = OpLabel +OpBranch %2 +%2 = OpLabel +%phi = OpPhi %bool %false %if %false %else %true %continue +OpLoopMerge %merge %continue None +OpBranch %3 +%3 = OpLabel +OpReturn +%continue = OpLabel +OpBranch %2 +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +TEST_F(DeadBranchElimTest, EarlyReconvergence) { + const std::string text = R"( +; CHECK-NOT: OpBranchConditional +; CHECK: [[logical:%\w+]] = OpLogicalOr +; CHECK-NOT: OpPhi +; CHECK: OpLogicalAnd {{%\w+}} {{%\w+}} [[logical]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +OpExecutionMode %func OriginUpperLeft +%void = OpTypeVoid +%bool = OpTypeBool +%false = OpConstantFalse %bool +%true = OpConstantTrue %bool +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +OpSelectionMerge %2 None +OpBranchConditional %false %3 %4 +%3 = OpLabel +%12 = OpLogicalNot %bool %true +OpBranch %2 +%4 = OpLabel +OpSelectionMerge %14 None +OpBranchConditional %false %5 %6 +%5 = OpLabel +%10 = OpLogicalAnd %bool %true %false +OpBranch %7 +%6 = OpLabel +%11 = OpLogicalOr %bool %true %false +OpBranch %7 +%7 = OpLabel +; This phi is in a block preceeding the merge %14! +%8 = OpPhi %bool %10 %5 %11 %6 +OpBranch %14 +%14 = OpLabel +OpBranch %2 +%2 = OpLabel +%9 = OpPhi %bool %12 %3 %8 %14 +%13 = OpLogicalAnd %bool %true %9 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, RemoveUnreachableBlocksFloating) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%1 = OpTypeFunction %void +%func = OpFunction %void None %1 +%2 = OpLabel +OpReturn +%3 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, RemoveUnreachableBlocksFloatingJoin) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NEXT: OpFunctionParameter +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%false = OpConstantFalse %bool +%true = OpConstantTrue %bool +%1 = OpTypeFunction %void %bool +%func = OpFunction %void None %1 +%bool_param = OpFunctionParameter %bool +%2 = OpLabel +OpReturn +%3 = OpLabel +OpSelectionMerge %6 None +OpBranchConditional %bool_param %4 %5 +%4 = OpLabel +OpBranch %6 +%5 = OpLabel +OpBranch %6 +%6 = OpLabel +%7 = OpPhi %bool %true %4 %false %6 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, RemoveUnreachableBlocksDeadPhi) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NEXT: OpFunctionParameter +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpLogicalNot %bool %true +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%false = OpConstantFalse %bool +%true = OpConstantTrue %bool +%1 = OpTypeFunction %void %bool +%func = OpFunction %void None %1 +%bool_param = OpFunctionParameter %bool +%2 = OpLabel +OpBranch %3 +%4 = OpLabel +OpBranch %3 +%3 = OpLabel +%5 = OpPhi %bool %true %2 %false %4 +%6 = OpLogicalNot %bool %5 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, RemoveUnreachableBlocksPartiallyDeadPhi) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NEXT: [[param:%\w+]] = OpFunctionParameter +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpBranchConditional [[param]] [[merge:%\w+]] [[br:%\w+]] +; CHECK-NEXT: [[merge]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi %bool %true %2 %false [[br]] +; CHECK-NEXT: OpLogicalNot %bool [[phi]] +; CHECK-NEXT: OpReturn +; CHECK-NEXT: [[br]] = OpLabel +; CHECK-NEXT: OpBranch [[merge]] +; CHECK-NEXT: OpFunctionEnd +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%false = OpConstantFalse %bool +%true = OpConstantTrue %bool +%1 = OpTypeFunction %void %bool +%func = OpFunction %void None %1 +%bool_param = OpFunctionParameter %bool +%2 = OpLabel +OpBranchConditional %bool_param %3 %7 +%7 = OpLabel +OpBranch %3 +%4 = OpLabel +OpBranch %3 +%3 = OpLabel +%5 = OpPhi %bool %true %2 %false %7 %false %4 +%6 = OpLogicalNot %bool %5 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, LiveHeaderDeadPhi) { + const std::string text = R"( +; CHECK: OpLabel +; CHECK-NOT: OpBranchConditional +; CHECK-NOT: OpPhi +; CHECK: OpLogicalNot %bool %false +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +OpSelectionMerge %3 None +OpBranchConditional %true %2 %3 +%2 = OpLabel +OpBranch %3 +%3 = OpLabel +%5 = OpPhi %bool %true %3 %false %2 +%6 = OpLogicalNot %bool %5 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, ExtraBackedgeBlocksLive) { + const std::string text = R"( +; CHECK: [[entry:%\w+]] = OpLabel +; CHECK-NOT: OpSelectionMerge +; CHECK: OpBranch [[header:%\w+]] +; CHECK-NEXT: [[header]] = OpLabel +; CHECK-NEXT: OpPhi %bool %true [[entry]] %false [[backedge:%\w+]] +; CHECK-NEXT: OpLoopMerge +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%func_ty = OpTypeFunction %void %bool +%func = OpFunction %void None %func_ty +%param = OpFunctionParameter %bool +%entry = OpLabel +OpSelectionMerge %if_merge None +; This dead branch is included to ensure the pass does work. +OpBranchConditional %false %if_merge %loop_header +%loop_header = OpLabel +; Both incoming edges are live, so the phi should be untouched. +%phi = OpPhi %bool %true %entry %false %backedge +OpLoopMerge %loop_merge %continue None +OpBranchConditional %param %loop_merge %continue +%continue = OpLabel +OpBranch %backedge +%backedge = OpLabel +OpBranch %loop_header +%loop_merge = OpLabel +OpBranch %if_merge +%if_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, ExtraBackedgeBlocksUnreachable) { + const std::string text = R"( +; CHECK: [[entry:%\w+]] = OpLabel +; CHECK-NEXT: OpBranch [[header:%\w+]] +; CHECK-NEXT: [[header]] = OpLabel +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None +; CHECK-NEXT: OpBranch [[merge]] +; CHECK-NEXT: [[merge]] = OpLabel +; CHECK-NEXT: OpReturn +; CHECK-NEXT: [[continue]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%func_ty = OpTypeFunction %void %bool +%func = OpFunction %void None %func_ty +%param = OpFunctionParameter %bool +%entry = OpLabel +OpBranch %loop_header +%loop_header = OpLabel +; Since the continue is unreachable, %backedge will be removed. The phi will +; instead require an edge from %continue. +%phi = OpPhi %bool %true %entry %false %backedge +OpLoopMerge %merge %continue None +OpBranch %merge +%continue = OpLabel +OpBranch %backedge +%backedge = OpLabel +OpBranch %loop_header +%merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, NoUnnecessaryChanges) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%undef = OpUndef %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %4 %5 None +OpBranch %6 +%6 = OpLabel +OpReturn +%5 = OpLabel +OpBranch %2 +%4 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + auto result = SinglePassRunToBinary(text, true); + EXPECT_EQ(std::get<1>(result), Pass::Status::SuccessWithoutChange); +} + +TEST_F(DeadBranchElimTest, ExtraBackedgePartiallyDead) { + const std::string text = R"( +; CHECK: OpLabel +; CHECK: [[header:%\w+]] = OpLabel +; CHECK: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None +; CHECK: [[merge]] = OpLabel +; CHECK: [[continue]] = OpLabel +; CHECK: OpBranch [[extra:%\w+]] +; CHECK: [[extra]] = OpLabel +; CHECK-NOT: OpSelectionMerge +; CHECK-NEXT: OpBranch [[else:%\w+]] +; CHECK-NEXT: [[else]] = OpLabel +; CHECK-NEXT: OpLogicalOr +; CHECK-NEXT: OpBranch [[backedge:%\w+]] +; CHECK-NEXT: [[backedge:%\w+]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpName %func "func" +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%func_ty = OpTypeFunction %void %bool +%func = OpFunction %void None %func_ty +%param = OpFunctionParameter %bool +%entry = OpLabel +OpBranch %loop_header +%loop_header = OpLabel +OpLoopMerge %loop_merge %continue None +OpBranchConditional %param %loop_merge %continue +%continue = OpLabel +OpBranch %extra +%extra = OpLabel +OpSelectionMerge %backedge None +OpBranchConditional %false %then %else +%then = OpLabel +%and = OpLogicalAnd %bool %true %false +OpBranch %backedge +%else = OpLabel +%or = OpLogicalOr %bool %true %false +OpBranch %backedge +%backedge = OpLabel +OpBranch %loop_header +%loop_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, UnreachableContinuePhiInMerge) { + const std::string text = R"( +; CHECK: [[entry:%\w+]] = OpLabel +; CHECK-NEXT: OpBranch [[header:%\w+]] +; CHECK-NEXT: [[header]] = OpLabel +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue:%\w+]] None +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: [[fadd:%\w+]] = OpFAdd +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpBranch [[merge]] +; CHECK-NEXT: [[continue]] = OpLabel +; CHECK-NEXT: OpBranch [[header]] +; CHECK-NEXT: [[merge]] = OpLabel +; CHECK-NEXT: OpStore {{%\w+}} [[fadd]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %o "o" + OpName %S "S" + OpMemberName %S 0 "a" + OpName %U_t "U_t" + OpMemberName %U_t 0 "g_F" + OpMemberName %U_t 1 "g_F2" + OpDecorate %o Location 0 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %U_t 0 Volatile + OpMemberDecorate %U_t 0 Offset 0 + OpMemberDecorate %U_t 1 Offset 4 + OpDecorate %U_t BufferBlock + %void = OpTypeVoid + %7 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %float_5 = OpConstant %float 5 + %int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float + %o = OpVariable %_ptr_Output_float Output + %S = OpTypeStruct %float + %U_t = OpTypeStruct %S %S +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t + %main = OpFunction %void None %7 + %22 = OpLabel + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %float %float_0 %22 %25 %26 + %27 = OpPhi %int %int_0 %22 %28 %26 + OpLoopMerge %29 %26 None + OpBranch %40 + %40 = OpLabel + %25 = OpFAdd %float %24 %float_1 + OpSelectionMerge %30 None + OpBranchConditional %true %31 %30 + %31 = OpLabel + OpBranch %29 + %30 = OpLabel + OpBranch %26 + %26 = OpLabel + %28 = OpIAdd %int %27 %int_1 + %32 = OpSLessThan %bool %27 %int_10 +; continue block branches to the header or another none dead block. + OpBranchConditional %32 %23 %29 + %29 = OpLabel + %33 = OpPhi %float %24 %26 %25 %31 + OpStore %o %33 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, NonStructuredIf) { + const std::string text = R"( +; CHECK-NOT: OpBranchConditional +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpDecorate %func LinkageAttributes "func" Export +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpBranchConditional %true %then %else +%then = OpLabel +OpBranch %final +%else = OpLabel +OpBranch %final +%final = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, ReorderBlocks) { + const std::string text = R"( +; CHECK: OpLabel +; CHECK: OpBranch [[label:%\w+]] +; CHECK: [[label:%\w+]] = OpLabel +; CHECK-NEXT: OpLogicalNot +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK: [[label]] = OpLabel +; CHECK-NEXT: OpReturn +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +OpSelectionMerge %3 None +OpBranchConditional %true %2 %3 +%3 = OpLabel +OpReturn +%2 = OpLabel +%not = OpLogicalNot %bool %true +OpBranch %3 +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, ReorderBlocksMultiple) { + // Checks are not important. The validation post optimization is the + // important part. + const std::string text = R"( +; CHECK: OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +OpSelectionMerge %3 None +OpBranchConditional %true %2 %3 +%3 = OpLabel +OpReturn +%2 = OpLabel +OpBranch %4 +%4 = OpLabel +OpBranch %3 +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, ReorderBlocksMultiple2) { + // Checks are not important. The validation post optimization is the + // important part. + const std::string text = R"( +; CHECK: OpLabel +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +OpSelectionMerge %3 None +OpBranchConditional %true %2 %3 +%3 = OpLabel +OpBranch %5 +%5 = OpLabel +OpReturn +%2 = OpLabel +OpBranch %4 +%4 = OpLabel +OpBranch %3 +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(DeadBranchElimTest, SelectionMergeWithEarlyExit1) { + // Checks that if a selection merge construct contains a conditional branch + // to the merge node, then the OpSelectionMerge instruction is positioned + // correctly. + const std::string predefs = R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +%void = OpTypeVoid +%func_type = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%undef_bool = OpUndef %bool +)"; + + const std::string body = + R"( +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpBranch [[taken_branch:%\w+]] +; CHECK-NEXT: [[taken_branch]] = OpLabel +; CHECK-NEXT: OpSelectionMerge [[merge:%\w+]] +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[merge]] {{%\w+}} +%main = OpFunction %void None %func_type +%entry_bb = OpLabel +OpSelectionMerge %outer_merge None +OpBranchConditional %true %bb1 %bb3 +%bb1 = OpLabel +OpBranchConditional %undef_bool %outer_merge %bb2 +%bb2 = OpLabel +OpBranch %outer_merge +%bb3 = OpLabel +OpBranch %outer_merge +%outer_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs + body, true); +} + +TEST_F(DeadBranchElimTest, SelectionMergeWithEarlyExit2) { + // Checks that if a selection merge construct contains a conditional branch + // to the merge node, then the OpSelectionMerge instruction is positioned + // correctly. + const std::string predefs = R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +%void = OpTypeVoid +%func_type = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%undef_bool = OpUndef %bool +)"; + + const std::string body = + R"( +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpBranch [[bb1:%\w+]] +; CHECK-NEXT: [[bb1]] = OpLabel +; CHECK-NEXT: OpSelectionMerge [[inner_merge:%\w+]] +; CHECK: [[inner_merge]] = OpLabel +; CHECK-NEXT: OpSelectionMerge [[outer_merge:%\w+]] +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[outer_merge]:%\w+]] {{%\w+}} +; CHECK: [[outer_merge]] = OpLabel +; CHECK-NEXT: OpReturn +%main = OpFunction %void None %func_type +%entry_bb = OpLabel +OpSelectionMerge %outer_merge None +OpBranchConditional %true %bb1 %bb5 +%bb1 = OpLabel +OpSelectionMerge %inner_merge None +OpBranchConditional %undef_bool %bb2 %bb3 +%bb2 = OpLabel +OpBranch %inner_merge +%bb3 = OpLabel +OpBranch %inner_merge +%inner_merge = OpLabel +OpBranchConditional %undef_bool %outer_merge %bb4 +%bb4 = OpLabel +OpBranch %outer_merge +%bb5 = OpLabel +OpBranch %outer_merge +%outer_merge = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs + body, true); +} +#endif + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// More complex control flow +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_insert_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_insert_elim_test.cpp new file mode 100644 index 00000000000..8ae6894d8cc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_insert_elim_test.cpp @@ -0,0 +1,571 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using DeadInsertElimTest = PassTest<::testing::Test>; + +TEST_F(DeadInsertElimTest, InsertAfterInsertElim) { + // With two insertions to the same offset, the first is dead. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in float In0; + // layout (location=1) in float In1; + // layout (location=2) in vec2 In2; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec2 v = In2; + // v.x = In0 + In1; // dead + // v.x = 0.0; + // OutColor = v.xyxy; + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In2 %In0 %In1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In2 "In2" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %OutColor "OutColor" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_n" +OpName %_ "" +OpDecorate %In2 Location 2 +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %OutColor Location 0 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%In2 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_float = OpTypePointer Input %float +%In0 = OpVariable %_ptr_Input_float Input +%In1 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%int = OpTypeInt 32 1 +%_Globals_ = OpTypeStruct %uint %int +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In2 %In0 %In1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In2 "In2" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %OutColor "OutColor" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_n" +OpName %_ "" +OpDecorate %In2 Location 2 +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %OutColor Location 0 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%In2 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_float = OpTypePointer Input %float +%In0 = OpVariable %_ptr_Input_float Input +%In1 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%int = OpTypeInt 32 1 +%_Globals_ = OpTypeStruct %uint %int +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%25 = OpLabel +%26 = OpLoad %v2float %In2 +%27 = OpLoad %float %In0 +%28 = OpLoad %float %In1 +%29 = OpFAdd %float %27 %28 +%35 = OpCompositeInsert %v2float %29 %26 0 +%37 = OpCompositeInsert %v2float %float_0 %35 0 +%33 = OpVectorShuffle %v4float %37 %37 0 1 0 1 +OpStore %OutColor %33 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%23 = OpLabel +%24 = OpLoad %v2float %In2 +%29 = OpCompositeInsert %v2float %float_0 %24 0 +%30 = OpVectorShuffle %v4float %29 %29 0 1 0 1 +OpStore %OutColor %30 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +TEST_F(DeadInsertElimTest, DeadInsertInChainWithPhi) { + // Dead insert eliminated with phi in insertion chain. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in vec4 In0; + // layout (location=1) in float In1; + // layout (location=2) in float In2; + // layout (location=0) out vec4 OutColor; + // + // layout(std140, binding = 0 ) uniform _Globals_ + // { + // bool g_b; + // }; + // + // void main() + // { + // vec4 v = In0; + // v.z = In1 + In2; + // if (g_b) v.w = 1.0; + // OutColor = vec4(v.x,v.y,0.0,v.w); + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%_Globals_ = OpTypeStruct %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%_Globals_ = OpTypeStruct %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%31 = OpLabel +%32 = OpLoad %v4float %In0 +%33 = OpLoad %float %In1 +%34 = OpLoad %float %In2 +%35 = OpFAdd %float %33 %34 +%51 = OpCompositeInsert %v4float %35 %32 2 +%37 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%38 = OpLoad %uint %37 +%39 = OpINotEqual %bool %38 %uint_0 +OpSelectionMerge %40 None +OpBranchConditional %39 %41 %40 +%41 = OpLabel +%53 = OpCompositeInsert %v4float %float_1 %51 3 +OpBranch %40 +%40 = OpLabel +%60 = OpPhi %v4float %51 %31 %53 %41 +%55 = OpCompositeExtract %float %60 0 +%57 = OpCompositeExtract %float %60 1 +%59 = OpCompositeExtract %float %60 3 +%49 = OpCompositeConstruct %v4float %55 %57 %float_0 %59 +OpStore %OutColor %49 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%27 = OpLabel +%28 = OpLoad %v4float %In0 +%33 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%34 = OpLoad %uint %33 +%35 = OpINotEqual %bool %34 %uint_0 +OpSelectionMerge %36 None +OpBranchConditional %35 %37 %36 +%37 = OpLabel +%38 = OpCompositeInsert %v4float %float_1 %28 3 +OpBranch %36 +%36 = OpLabel +%39 = OpPhi %v4float %28 %27 %38 %37 +%40 = OpCompositeExtract %float %39 0 +%41 = OpCompositeExtract %float %39 1 +%42 = OpCompositeExtract %float %39 3 +%43 = OpCompositeConstruct %v4float %40 %41 %float_0 %42 +OpStore %OutColor %43 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +TEST_F(DeadInsertElimTest, DeadInsertTwoPasses) { + // Dead insert which requires two passes to eliminate + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in vec4 In0; + // layout (location=1) in float In1; + // layout (location=2) in float In2; + // layout (location=0) out vec4 OutColor; + // + // layout(std140, binding = 0 ) uniform _Globals_ + // { + // bool g_b; + // bool g_b2; + // }; + // + // void main() + // { + // vec4 v1, v2; + // v1 = In0; + // v1.y = In1 + In2; // dead, second pass + // if (g_b) v1.x = 1.0; + // v2.x = v1.x; + // v2.y = v1.y; // dead, first pass + // if (g_b2) v2.x = 0.0; + // OutColor = vec4(v2.x,v2.x,0.0,1.0); + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_b2" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_Globals_ = OpTypeStruct %uint %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%27 = OpUndef %v4float +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_b2" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_Globals_ = OpTypeStruct %uint %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%27 = OpUndef %v4float +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%28 = OpLabel +%29 = OpLoad %v4float %In0 +%30 = OpLoad %float %In1 +%31 = OpLoad %float %In2 +%32 = OpFAdd %float %30 %31 +%33 = OpCompositeInsert %v4float %32 %29 1 +%34 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%35 = OpLoad %uint %34 +%36 = OpINotEqual %bool %35 %uint_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %38 %37 +%38 = OpLabel +%39 = OpCompositeInsert %v4float %float_1 %33 0 +OpBranch %37 +%37 = OpLabel +%40 = OpPhi %v4float %33 %28 %39 %38 +%41 = OpCompositeExtract %float %40 0 +%42 = OpCompositeInsert %v4float %41 %27 0 +%43 = OpCompositeExtract %float %40 1 +%44 = OpCompositeInsert %v4float %43 %42 1 +%45 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 +%46 = OpLoad %uint %45 +%47 = OpINotEqual %bool %46 %uint_0 +OpSelectionMerge %48 None +OpBranchConditional %47 %49 %48 +%49 = OpLabel +%50 = OpCompositeInsert %v4float %float_0 %44 0 +OpBranch %48 +%48 = OpLabel +%51 = OpPhi %v4float %44 %37 %50 %49 +%52 = OpCompositeExtract %float %51 0 +%53 = OpCompositeExtract %float %51 0 +%54 = OpCompositeConstruct %v4float %52 %53 %float_0 %float_1 +OpStore %OutColor %54 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%28 = OpLabel +%29 = OpLoad %v4float %In0 +%34 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%35 = OpLoad %uint %34 +%36 = OpINotEqual %bool %35 %uint_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %38 %37 +%38 = OpLabel +%39 = OpCompositeInsert %v4float %float_1 %29 0 +OpBranch %37 +%37 = OpLabel +%40 = OpPhi %v4float %29 %28 %39 %38 +%41 = OpCompositeExtract %float %40 0 +%42 = OpCompositeInsert %v4float %41 %27 0 +%45 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 +%46 = OpLoad %uint %45 +%47 = OpINotEqual %bool %46 %uint_0 +OpSelectionMerge %48 None +OpBranchConditional %47 %49 %48 +%49 = OpLabel +%50 = OpCompositeInsert %v4float %float_0 %42 0 +OpBranch %48 +%48 = OpLabel +%51 = OpPhi %v4float %42 %37 %50 %49 +%52 = OpCompositeExtract %float %51 0 +%53 = OpCompositeExtract %float %51 0 +%54 = OpCompositeConstruct %v4float %52 %53 %float_0 %float_1 +OpStore %OutColor %54 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_variable_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_variable_elim_test.cpp new file mode 100644 index 00000000000..fca13a8e2fd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dead_variable_elim_test.cpp @@ -0,0 +1,298 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using DeadVariableElimTest = PassTest<::testing::Test>; + +// %dead is unused. Make sure we remove it along with its name. +TEST_F(DeadVariableElimTest, RemoveUnreferenced) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %dead "dead" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%dead = OpVariable %_ptr_Private_float Private +%main = OpFunction %void None %5 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%main = OpFunction %void None %5 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +// Since %dead is exported, make sure we keep it. It could be referenced +// somewhere else. +TEST_F(DeadVariableElimTest, KeepExported) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %dead "dead" +OpDecorate %dead LinkageAttributes "dead" Export +%void = OpTypeVoid +%5 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%dead = OpVariable %_ptr_Private_float Private +%main = OpFunction %void None %5 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, before, true, true); +} + +// Delete %dead because it is unreferenced. Then %initializer becomes +// unreferenced, so remove it as well. +TEST_F(DeadVariableElimTest, RemoveUnreferencedWithInit1) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %dead "dead" +OpName %initializer "initializer" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%initializer = OpVariable %_ptr_Private_float Private +%dead = OpVariable %_ptr_Private_float Private %initializer +%main = OpFunction %void None %6 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%main = OpFunction %void None %6 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +// Delete %dead because it is unreferenced. In this case, the initialized has +// another reference, and should not be removed. +TEST_F(DeadVariableElimTest, RemoveUnreferencedWithInit2) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %dead "dead" +OpName %initializer "initializer" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%initializer = OpVariable %_ptr_Private_float Private +%dead = OpVariable %_ptr_Private_float Private %initializer +%main = OpFunction %void None %6 +%9 = OpLabel +%10 = OpLoad %float %initializer +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %initializer "initializer" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%initializer = OpVariable %_ptr_Private_float Private +%main = OpFunction %void None %6 +%9 = OpLabel +%10 = OpLoad %float %initializer +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +// Keep %live because it is used, and its initializer. +TEST_F(DeadVariableElimTest, KeepReferenced) { + const std::string before = + R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 150 +OpName %main "main" +OpName %live "live" +OpName %initializer "initializer" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float +%initializer = OpVariable %_ptr_Private_float Private +%live = OpVariable %_ptr_Private_float Private %initializer +%main = OpFunction %void None %6 +%9 = OpLabel +%10 = OpLoad %float %live +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, before, true, true); +} + +// This test that the decoration associated with a variable are removed when the +// variable is removed. +TEST_F(DeadVariableElimTest, RemoveVariableAndDecorations) { + const std::string before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 450 +OpName %main "main" +OpName %B "B" +OpMemberName %B 0 "a" +OpName %Bdat "Bdat" +OpMemberDecorate %B 0 Offset 0 +OpDecorate %B BufferBlock +OpDecorate %Bdat DescriptorSet 0 +OpDecorate %Bdat Binding 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%B = OpTypeStruct %uint +%_ptr_Uniform_B = OpTypePointer Uniform %B +%Bdat = OpVariable %_ptr_Uniform_B Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%main = OpFunction %void None %6 +%13 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 450 +OpName %main "main" +OpName %B "B" +OpMemberName %B 0 "a" +OpMemberDecorate %B 0 Offset 0 +OpDecorate %B BufferBlock +%void = OpTypeVoid +%6 = OpTypeFunction %void +%uint = OpTypeInt 32 0 +%B = OpTypeStruct %uint +%_ptr_Uniform_B = OpTypePointer Uniform %B +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%main = OpFunction %void None %6 +%13 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/decoration_manager_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/decoration_manager_test.cpp new file mode 100644 index 00000000000..cf82e8e6656 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/decoration_manager_test.cpp @@ -0,0 +1,1282 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/decoration_manager.h" +#include "source/opt/ir_context.h" +#include "source/spirv_constant.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { + +using spvtest::MakeVector; + +class DecorationManagerTest : public ::testing::Test { + public: + DecorationManagerTest() + : tools_(SPV_ENV_UNIVERSAL_1_2), + context_(), + consumer_([this](spv_message_level_t level, const char*, + const spv_position_t& position, const char* message) { + if (!error_message_.empty()) error_message_ += "\n"; + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + error_message_ += "ERROR"; + break; + case SPV_MSG_WARNING: + error_message_ += "WARNING"; + break; + case SPV_MSG_INFO: + error_message_ += "INFO"; + break; + case SPV_MSG_DEBUG: + error_message_ += "DEBUG"; + break; + } + error_message_ += + ": " + std::to_string(position.index) + ": " + message; + }), + disassemble_options_(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER), + error_message_() { + tools_.SetMessageConsumer(consumer_); + } + + void TearDown() override { error_message_.clear(); } + + DecorationManager* GetDecorationManager(const std::string& text) { + context_ = BuildModule(SPV_ENV_UNIVERSAL_1_2, consumer_, text); + if (context_.get()) + return context_->get_decoration_mgr(); + else + return nullptr; + } + + // Disassembles |binary| and outputs the result in |text|. If |text| is a + // null pointer, SPV_ERROR_INVALID_POINTER is returned. + spv_result_t Disassemble(const std::vector& binary, + std::string* text) { + if (!text) return SPV_ERROR_INVALID_POINTER; + return tools_.Disassemble(binary, text, disassemble_options_) + ? SPV_SUCCESS + : SPV_ERROR_INVALID_BINARY; + } + + // Returns the accumulated error messages for the test. + std::string GetErrorMessage() const { return error_message_; } + + std::string ToText(const std::vector& inst) { + std::vector binary = {SpvMagicNumber, 0x10200, 0u, 2u, 0u}; + for (const Instruction* i : inst) + i->ToBinaryWithoutAttachedDebugInsts(&binary); + std::string text; + Disassemble(binary, &text); + return text; + } + + std::string ModuleToText() { + std::vector binary; + context_->module()->ToBinary(&binary, false); + std::string text; + Disassemble(binary, &text); + return text; + } + + spvtools::MessageConsumer GetConsumer() { return consumer_; } + + private: + // An instance for calling SPIRV-Tools functionalities. + spvtools::SpirvTools tools_; + std::unique_ptr context_; + spvtools::MessageConsumer consumer_; + uint32_t disassemble_options_; + std::string error_message_; +}; + +TEST_F(DecorationManagerTest, + ComparingDecorationsWithDiffOpcodesDecorateDecorateId) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // This parameter can be interprated both as { SpvDecorationConstant } + // and also as a list of IDs: { 22 } + const std::vector param{SpvDecorationConstant}; + // OpDecorate %1 Constant + Instruction inst1( + &ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_DECORATION, param}}); + // OpDecorateId %1 %22 ; 'Constant' is decoration number 22 + Instruction inst2( + &ir_context, SpvOpDecorateId, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_ID, param}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, + ComparingDecorationsWithDiffOpcodesDecorateDecorateString) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // This parameter can be interprated both as { SpvDecorationConstant } + // and also as a null-terminated string with a single character with value 22. + const std::vector param{SpvDecorationConstant}; + // OpDecorate %1 Constant + Instruction inst1( + &ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_DECORATION, param}}); + // OpDecorateStringGOOGLE %1 !22 + Instruction inst2( + &ir_context, SpvOpDecorateStringGOOGLE, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_LITERAL_STRING, param}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, ComparingDecorationsWithDiffDecorateParam) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpDecorate %1 Constant + Instruction inst1(&ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + // OpDecorate %1 Restrict + Instruction inst2(&ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationRestrict}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, ComparingDecorationsWithDiffDecorateIdParam) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpDecorate %1 Constant + Instruction inst1( + &ir_context, SpvOpDecorateId, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_ID, {555}}}); + // OpDecorate %1 Restrict + Instruction inst2( + &ir_context, SpvOpDecorateId, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_ID, {666}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, ComparingDecorationsWithDiffDecorateStringParam) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpDecorate %1 Constant + Instruction inst1(&ir_context, SpvOpDecorateStringGOOGLE, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_STRING, MakeVector("Hello!")}}); + // OpDecorate %1 Restrict + Instruction inst2(&ir_context, SpvOpDecorateStringGOOGLE, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_STRING, MakeVector("Hellx")}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, ComparingSameDecorationsOnDiffTargetAllowed) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpDecorate %1 Constant + Instruction inst1(&ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + // OpDecorate %2 Constant + Instruction inst2(&ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {2u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, ComparingSameDecorationIdsOnDiffTargetAllowed) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + Instruction inst1( + &ir_context, SpvOpDecorateId, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, {SPV_OPERAND_TYPE_DECORATION, {44}}}); + Instruction inst2( + &ir_context, SpvOpDecorateId, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {2u}}, {SPV_OPERAND_TYPE_DECORATION, {44}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, + ComparingSameDecorationStringsOnDiffTargetAllowed) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + Instruction inst1(&ir_context, SpvOpDecorateStringGOOGLE, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_STRING, MakeVector("hello")}}); + Instruction inst2(&ir_context, SpvOpDecorateStringGOOGLE, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {2u}}, + {SPV_OPERAND_TYPE_LITERAL_STRING, MakeVector("hello")}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, ComparingSameDecorationsOnDiffTargetDisallowed) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpDecorate %1 Constant + Instruction inst1(&ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + // OpDecorate %2 Constant + Instruction inst2(&ir_context, SpvOpDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {2u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, false)); +} + +TEST_F(DecorationManagerTest, ComparingMemberDecorationsOnSameTypeDiffMember) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpMemberDecorate %1 0 Constant + Instruction inst1(&ir_context, SpvOpMemberDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {0u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + // OpMemberDecorate %1 1 Constant + Instruction inst2(&ir_context, SpvOpMemberDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {1u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, + ComparingSameMemberDecorationsOnDiffTargetAllowed) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpMemberDecorate %1 0 Constant + Instruction inst1(&ir_context, SpvOpMemberDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {0u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + // OpMemberDecorate %2 0 Constant + Instruction inst2(&ir_context, SpvOpMemberDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {2u}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {0u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->AreDecorationsTheSame(&inst1, &inst2, true)); +} + +TEST_F(DecorationManagerTest, + ComparingSameMemberDecorationsOnDiffTargetDisallowed) { + IRContext ir_context(SPV_ENV_UNIVERSAL_1_2, GetConsumer()); + // OpMemberDecorate %1 0 Constant + Instruction inst1(&ir_context, SpvOpMemberDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {1u}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {0u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + // OpMemberDecorate %2 0 Constant + Instruction inst2(&ir_context, SpvOpMemberDecorate, 0u, 0u, + {{SPV_OPERAND_TYPE_ID, {2u}}, + {SPV_OPERAND_TYPE_LITERAL_INTEGER, {0u}}, + {SPV_OPERAND_TYPE_DECORATION, {SpvDecorationConstant}}}); + DecorationManager* decoManager = ir_context.get_decoration_mgr(); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->AreDecorationsTheSame(&inst1, &inst2, false)); +} + +TEST_F(DecorationManagerTest, RemoveDecorationFromVariable) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 %3 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Uniform +%3 = OpVariable %4 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + decoManager->RemoveDecorationsFrom(1u); + auto decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + decorations = decoManager->GetDecorationsFor(3u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + const std::string expected_decorations = R"(OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %3 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Uniform +%3 = OpVariable %4 Uniform +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, RemoveDecorationStringFromVariable) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello world" +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 %3 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Uniform +%3 = OpVariable %4 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + decoManager->RemoveDecorationsFrom(1u); + auto decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + decorations = decoManager->GetDecorationsFor(3u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + const std::string expected_decorations = R"(OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %3 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Uniform +%3 = OpVariable %4 Uniform +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, RemoveDecorationFromDecorationGroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 %3 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Uniform +%3 = OpVariable %4 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + decoManager->RemoveDecorationsFrom(2u); + auto decorations = decoManager->GetDecorationsFor(2u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + const std::string expected_decorations = R"(OpDecorate %1 Constant +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + decorations = decoManager->GetDecorationsFor(3u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_THAT(ToText(decorations), ""); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Uniform +%3 = OpVariable %4 Uniform +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, + RemoveDecorationFromDecorationGroupKeepDeadDecorations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 +%3 = OpTypeInt 32 0 +%1 = OpVariable %3 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + decoManager->RemoveDecorationsFrom(1u); + auto decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + decorations = decoManager->GetDecorationsFor(2u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + const std::string expected_decorations = R"(OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %2 Restrict +%2 = OpDecorationGroup +%3 = OpTypeInt 32 0 +%1 = OpVariable %3 Uniform +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, RemoveAllDecorationsAppliedByGroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 +OpDecorate %3 BuiltIn VertexId +%3 = OpDecorationGroup +OpGroupDecorate %3 %1 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Input +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + decoManager->RemoveDecorationsFrom(1u, [](const Instruction& inst) { + return inst.opcode() == SpvOpDecorate && + inst.GetSingleWordInOperand(0u) == 3u; + }); + auto decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + std::string expected_decorations = R"(OpDecorate %1 Constant +OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + decorations = decoManager->GetDecorationsFor(2u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + expected_decorations = R"(OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 +OpDecorate %3 BuiltIn VertexId +%3 = OpDecorationGroup +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Input +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, RemoveSomeDecorationsAppliedByGroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 +OpDecorate %3 BuiltIn VertexId +OpDecorate %3 Invariant +%3 = OpDecorationGroup +OpGroupDecorate %3 %1 +%uint = OpTypeInt 32 0 +%1 = OpVariable %uint Input +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + decoManager->RemoveDecorationsFrom(1u, [](const Instruction& inst) { + return inst.opcode() == SpvOpDecorate && + inst.GetSingleWordInOperand(0u) == 3u && + inst.GetSingleWordInOperand(1u) == SpvDecorationBuiltIn; + }); + auto decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + std::string expected_decorations = R"(OpDecorate %1 Constant +OpDecorate %1 Invariant +OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + decorations = decoManager->GetDecorationsFor(2u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + expected_decorations = R"(OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 +OpDecorate %3 BuiltIn VertexId +OpDecorate %3 Invariant +%3 = OpDecorationGroup +OpDecorate %1 Invariant +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Input +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, RemoveDecorationDecorate) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %1 Restrict +%2 = OpTypeInt 32 0 +%1 = OpVariable %2 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + auto decorations = decoManager->GetDecorationsFor(1u, false); + decoManager->RemoveDecoration(decorations.front()); + decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + const std::string expected_decorations = R"(OpDecorate %1 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); +} + +TEST_F(DecorationManagerTest, RemoveDecorationStringDecorate) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "foobar" +OpDecorate %1 Restrict +%2 = OpTypeInt 32 0 +%1 = OpVariable %2 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + auto decorations = decoManager->GetDecorationsFor(1u, false); + decoManager->RemoveDecoration(decorations.front()); + decorations = decoManager->GetDecorationsFor(1u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + const std::string expected_decorations = R"(OpDecorate %1 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); +} + +TEST_F(DecorationManagerTest, CloneDecorations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 +OpDecorate %3 BuiltIn VertexId +OpDecorate %3 Invariant +%3 = OpDecorationGroup +OpGroupDecorate %3 %1 +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Input +%5 = OpVariable %4 Input +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + + // Check cloning OpDecorate including group decorations. + auto decorations = decoManager->GetDecorationsFor(5u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + + decoManager->CloneDecorations(1u, 5u); + decorations = decoManager->GetDecorationsFor(5u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + std::string expected_decorations = R"(OpDecorate %5 Constant +OpDecorate %2 Restrict +OpDecorate %3 BuiltIn VertexId +OpDecorate %3 Invariant +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + // Check that bookkeeping for ID 2 remains the same. + decorations = decoManager->GetDecorationsFor(2u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + expected_decorations = R"(OpDecorate %2 Restrict +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %2 %1 %5 +OpDecorate %3 BuiltIn VertexId +OpDecorate %3 Invariant +%3 = OpDecorationGroup +OpGroupDecorate %3 %1 %5 +OpDecorate %5 Constant +%4 = OpTypeInt 32 0 +%1 = OpVariable %4 Input +%5 = OpVariable %4 Input +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, CloneDecorationsStringAndId) { + const std::string spirv = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "blah" +OpDecorateId %1 HlslCounterBufferGOOGLE %2 +OpDecorate %1 Aliased +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Uniform %3 +%1 = OpVariable %4 Uniform +%2 = OpVariable %4 Uniform +%5 = OpVariable %4 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + + // Check cloning OpDecorate including group decorations. + auto decorations = decoManager->GetDecorationsFor(5u, false); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + + decoManager->CloneDecorations(1u, 5u); + decorations = decoManager->GetDecorationsFor(5u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + std::string expected_decorations = + R"(OpDecorateStringGOOGLE %5 HlslSemanticGOOGLE "blah" +OpDecorateId %5 HlslCounterBufferGOOGLE %2 +OpDecorate %5 Aliased +)"; + EXPECT_THAT(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "blah" +OpDecorateId %1 HlslCounterBufferGOOGLE %2 +OpDecorate %1 Aliased +OpDecorateStringGOOGLE %5 HlslSemanticGOOGLE "blah" +OpDecorateId %5 HlslCounterBufferGOOGLE %2 +OpDecorate %5 Aliased +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Uniform %3 +%1 = OpVariable %4 Uniform +%2 = OpVariable %4 Uniform +%5 = OpVariable %4 Uniform +)"; + EXPECT_THAT(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, CloneSomeDecorations) { + const std::string spirv = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorate %1 RelaxedPrecision +OpDecorate %1 Restrict +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Function %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +%1 = OpVariable %3 Function +%8 = OpUndef %2 +OpReturn +OpFunctionEnd +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_EQ(GetErrorMessage(), ""); + + // Check cloning OpDecorate including group decorations. + auto decorations = decoManager->GetDecorationsFor(8u, false); + EXPECT_EQ(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + + decoManager->CloneDecorations(1u, 8u, {SpvDecorationRelaxedPrecision}); + decorations = decoManager->GetDecorationsFor(8u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + std::string expected_decorations = + R"(OpDecorate %8 RelaxedPrecision +)"; + EXPECT_EQ(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorate %1 RelaxedPrecision +OpDecorate %1 Restrict +OpDecorate %8 RelaxedPrecision +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Function %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +%1 = OpVariable %3 Function +%8 = OpUndef %2 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(ModuleToText(), expected_binary); +} + +// Test cloning decoration for an id that is decorated via a group decoration. +TEST_F(DecorationManagerTest, CloneSomeGroupDecorations) { + const std::string spirv = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 RelaxedPrecision +OpDecorate %1 Restrict +%1 = OpDecorationGroup +OpGroupDecorate %1 %2 +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Function %3 +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpFunction %5 None %6 +%8 = OpLabel +%2 = OpVariable %4 Function +%9 = OpUndef %3 +OpReturn +OpFunctionEnd +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_EQ(GetErrorMessage(), ""); + + // Check cloning OpDecorate including group decorations. + auto decorations = decoManager->GetDecorationsFor(9u, false); + EXPECT_EQ(GetErrorMessage(), ""); + EXPECT_TRUE(decorations.empty()); + + decoManager->CloneDecorations(2u, 9u, {SpvDecorationRelaxedPrecision}); + decorations = decoManager->GetDecorationsFor(9u, false); + EXPECT_THAT(GetErrorMessage(), ""); + + std::string expected_decorations = + R"(OpDecorate %9 RelaxedPrecision +)"; + EXPECT_EQ(ToText(decorations), expected_decorations); + + const std::string expected_binary = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 RelaxedPrecision +OpDecorate %1 Restrict +%1 = OpDecorationGroup +OpGroupDecorate %1 %2 +OpDecorate %9 RelaxedPrecision +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Function %3 +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpFunction %5 None %6 +%8 = OpLabel +%2 = OpVariable %4 Function +%9 = OpUndef %3 +OpReturn +OpFunctionEnd +)"; + EXPECT_EQ(ModuleToText(), expected_binary); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsWithoutGroupsTrue) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Restrict +OpDecorate %2 Constant +OpDecorate %2 Restrict +OpDecorate %1 Constant +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsWithoutGroupsFalse) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Restrict +OpDecorate %2 Constant +OpDecorate %2 Restrict +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsIdWithoutGroupsTrue) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorateId %1 AlignmentId %nine +OpDecorateId %3 MaxByteOffsetId %nine +OpDecorateId %3 AlignmentId %nine +OpDecorateId %1 MaxByteOffsetId %nine +%u32 = OpTypeInt 32 0 +%nine = OpConstant %u32 9 +%1 = OpVariable %u32 Uniform +%3 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 3u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsIdWithoutGroupsFalse) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorateId %1 AlignmentId %nine +OpDecorateId %2 MaxByteOffsetId %nine +OpDecorateId %2 AlignmentId %nine +%u32 = OpTypeInt 32 0 +%nine = OpConstant %u32 9 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsStringWithoutGroupsTrue) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "world" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "world" +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsStringWithoutGroupsFalse) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "world" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsWithGroupsTrue) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Restrict +OpDecorate %2 Constant +OpDecorate %1 Constant +OpDecorate %3 Restrict +%3 = OpDecorationGroup +OpGroupDecorate %3 %2 +OpDecorate %4 Invariant +%4 = OpDecorationGroup +OpGroupDecorate %4 %1 %2 +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsWithGroupsFalse) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Restrict +OpDecorate %2 Constant +OpDecorate %1 Constant +OpDecorate %4 Invariant +%4 = OpDecorationGroup +OpGroupDecorate %4 %1 %2 +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsDuplicateDecorations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %2 Constant +OpDecorate %2 Constant +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsDifferentVariations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Location 0 +OpDecorate %2 Location 1 +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, + HaveTheSameDecorationsDuplicateMemberDecorations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpMemberDecorate %1 0 Location 0 +OpMemberDecorate %2 0 Location 0 +OpMemberDecorate %2 0 Location 0 +%u32 = OpTypeInt 32 0 +%1 = OpTypeStruct %u32 %u32 +%2 = OpTypeStruct %u32 %u32 +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, + HaveTheSameDecorationsDifferentMemberSameDecoration) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpMemberDecorate %1 0 Location 0 +OpMemberDecorate %2 1 Location 0 +%u32 = OpTypeInt 32 0 +%1 = OpTypeStruct %u32 %u32 +%2 = OpTypeStruct %u32 %u32 +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsDifferentMemberVariations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpMemberDecorate %1 0 Location 0 +OpMemberDecorate %2 0 Location 1 +%u32 = OpTypeInt 32 0 +%1 = OpTypeStruct %u32 %u32 +%2 = OpTypeStruct %u32 %u32 +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsDuplicateIdDecorations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorateId %1 AlignmentId %2 +OpDecorateId %3 AlignmentId %2 +OpDecorateId %3 AlignmentId %2 +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%3 = OpVariable %u32 Uniform +%2 = OpSpecConstant %u32 0 +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 3u)); +} + +TEST_F(DecorationManagerTest, + HaveTheSameDecorationsDuplicateStringDecorations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_TRUE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsDifferentIdVariations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorateId %1 AlignmentId %2 +OpDecorateId %3 AlignmentId %4 +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%3 = OpVariable %u32 Uniform +%2 = OpSpecConstant %u32 0 +%4 = OpSpecConstant %u32 0 +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsDifferentStringVariations) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "world" +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsLeftSymmetry) { + // Left being a subset of right is not enough. + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %1 Constant +OpDecorate %2 Constant +OpDecorate %2 Restrict +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationsRightSymmetry) { + // Right being a subset of left is not enough. + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %1 Restrict +OpDecorate %2 Constant +OpDecorate %2 Constant +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationIdsLeftSymmetry) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorateId %1 AlignmentId %nine +OpDecorateId %1 AlignmentId %nine +OpDecorateId %2 AlignmentId %nine +OpDecorateId %2 MaxByteOffsetId %nine +%u32 = OpTypeInt 32 0 +%nine = OpConstant %u32 9 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationIdsRightSymmetry) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorateId %1 AlignmentId %nine +OpDecorateId %1 MaxByteOffsetId %nine +OpDecorateId %2 AlignmentId %nine +OpDecorateId %2 AlignmentId %nine +%u32 = OpTypeInt 32 0 +%nine = OpConstant %u32 9 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationStringsLeftSymmetry) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "world" +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +TEST_F(DecorationManagerTest, HaveTheSameDecorationStringsRightSymmetry) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpExtension "SPV_GOOGLE_decorate_string" +OpMemoryModel Logical GLSL450 +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE "world" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +OpDecorateStringGOOGLE %2 HlslSemanticGOOGLE "hello" +%u32 = OpTypeInt 32 0 +%1 = OpVariable %u32 Uniform +%2 = OpVariable %u32 Uniform +)"; + DecorationManager* decoManager = GetDecorationManager(spirv); + EXPECT_THAT(GetErrorMessage(), ""); + EXPECT_FALSE(decoManager->HaveTheSameDecorations(1u, 2u)); +} + +} // namespace +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/def_use_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/def_use_test.cpp new file mode 100644 index 00000000000..3b856ce7fb5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/def_use_test.cpp @@ -0,0 +1,1719 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { + +using ::testing::Contains; +using ::testing::UnorderedElementsAre; +using ::testing::UnorderedElementsAreArray; + +// Returns the number of uses of |id|. +uint32_t NumUses(const std::unique_ptr& context, uint32_t id) { + uint32_t count = 0; + context->get_def_use_mgr()->ForEachUse( + id, [&count](Instruction*, uint32_t) { ++count; }); + return count; +} + +// Returns the opcode of each use of |id|. +// +// If |id| is used multiple times in a single instruction, that instruction's +// opcode will appear a corresponding number of times. +std::vector GetUseOpcodes(const std::unique_ptr& context, + uint32_t id) { + std::vector opcodes; + context->get_def_use_mgr()->ForEachUse( + id, [&opcodes](Instruction* user, uint32_t) { + opcodes.push_back(user->opcode()); + }); + return opcodes; +} + +// Disassembles the given |inst| and returns the disassembly. +std::string DisassembleInst(Instruction* inst) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_1); + + std::vector binary; + // We need this to generate the necessary header in the binary. + tools.Assemble("", &binary); + inst->ToBinaryWithoutAttachedDebugInsts(&binary); + + std::string text; + // We'll need to check the underlying id numbers. + // So turn off friendly names for ids. + tools.Disassemble(binary, &text, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + while (!text.empty() && text.back() == '\n') text.pop_back(); + return text; +} + +// A struct for holding expected id defs and uses. +struct InstDefUse { + using IdInstPair = std::pair; + using IdInstsPair = std::pair>; + + // Ids and their corresponding def instructions. + std::vector defs; + // Ids and their corresponding use instructions. + std::vector uses; +}; + +// Checks that the |actual_defs| and |actual_uses| are in accord with +// |expected_defs_uses|. +void CheckDef(const InstDefUse& expected_defs_uses, + const DefUseManager::IdToDefMap& actual_defs) { + // Check defs. + ASSERT_EQ(expected_defs_uses.defs.size(), actual_defs.size()); + for (uint32_t i = 0; i < expected_defs_uses.defs.size(); ++i) { + const auto id = expected_defs_uses.defs[i].first; + const auto expected_def = expected_defs_uses.defs[i].second; + ASSERT_EQ(1u, actual_defs.count(id)) << "expected to def id [" << id << "]"; + auto def = actual_defs.at(id); + if (def->opcode() != SpvOpConstant) { + // Constants don't disassemble properly without a full context. + EXPECT_EQ(expected_def, DisassembleInst(actual_defs.at(id))); + } + } +} + +using UserMap = std::unordered_map>; + +// Creates a mapping of all definitions to their users (except OpConstant). +// +// OpConstants are skipped because they cannot be disassembled in isolation. +UserMap BuildAllUsers(const DefUseManager* mgr, uint32_t idBound) { + UserMap userMap; + for (uint32_t id = 0; id != idBound; ++id) { + if (mgr->GetDef(id)) { + mgr->ForEachUser(id, [id, &userMap](Instruction* user) { + if (user->opcode() != SpvOpConstant) { + userMap[id].push_back(user); + } + }); + } + } + return userMap; +} + +// Constants don't disassemble properly without a full context, so skip them as +// checks. +void CheckUse(const InstDefUse& expected_defs_uses, const DefUseManager* mgr, + uint32_t idBound) { + UserMap actual_uses = BuildAllUsers(mgr, idBound); + // Check uses. + ASSERT_EQ(expected_defs_uses.uses.size(), actual_uses.size()); + for (uint32_t i = 0; i < expected_defs_uses.uses.size(); ++i) { + const auto id = expected_defs_uses.uses[i].first; + const auto& expected_uses = expected_defs_uses.uses[i].second; + + ASSERT_EQ(1u, actual_uses.count(id)) << "expected to use id [" << id << "]"; + const auto& uses = actual_uses.at(id); + + ASSERT_EQ(expected_uses.size(), uses.size()) + << "id [" << id << "] # uses: expected: " << expected_uses.size() + << " actual: " << uses.size(); + + std::vector actual_uses_disassembled; + for (const auto actual_use : uses) { + actual_uses_disassembled.emplace_back(DisassembleInst(actual_use)); + } + EXPECT_THAT(actual_uses_disassembled, + UnorderedElementsAreArray(expected_uses)); + } +} + +// The following test case mimics how LLVM handles induction variables. +// But, yeah, it's not very readable. However, we only care about the id +// defs and uses. So, no need to make sure this is valid OpPhi construct. +const char kOpPhiTestFunction[] = + " %1 = OpTypeVoid " + " %6 = OpTypeInt 32 0 " + "%10 = OpTypeFloat 32 " + "%16 = OpTypeBool " + " %3 = OpTypeFunction %1 " + " %8 = OpConstant %6 0 " + "%18 = OpConstant %6 1 " + "%12 = OpConstant %10 1.0 " + " %2 = OpFunction %1 None %3 " + " %4 = OpLabel " + " OpBranch %5 " + + " %5 = OpLabel " + " %7 = OpPhi %6 %8 %4 %9 %5 " + "%11 = OpPhi %10 %12 %4 %13 %5 " + " %9 = OpIAdd %6 %7 %8 " + "%13 = OpFAdd %10 %11 %12 " + "%17 = OpSLessThan %16 %7 %18 " + " OpLoopMerge %19 %5 None " + " OpBranchConditional %17 %5 %19 " + + "%19 = OpLabel " + " OpReturn " + " OpFunctionEnd"; + +struct ParseDefUseCase { + const char* text; + InstDefUse du; +}; + +using ParseDefUseTest = ::testing::TestWithParam; + +TEST_P(ParseDefUseTest, Case) { + const auto& tc = GetParam(); + + // Build module. + const std::vector text = {tc.text}; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, JoinAllInsts(text), + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Analyze def and use. + DefUseManager manager(context->module()); + + CheckDef(tc.du, manager.id_to_defs()); + CheckUse(tc.du, &manager, context->module()->IdBound()); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TestCase, ParseDefUseTest, + ::testing::ValuesIn(std::vector{ + {"", {{}, {}}}, // no instruction + {"OpMemoryModel Logical GLSL450", {{}, {}}}, // no def and use + { // single def, no use + "%1 = OpString \"wow\"", + { + {{1, "%1 = OpString \"wow\""}}, // defs + {} // uses + } + }, + { // multiple def, no use + "%1 = OpString \"hello\" " + "%2 = OpString \"world\" " + "%3 = OpTypeVoid", + { + { // defs + {1, "%1 = OpString \"hello\""}, + {2, "%2 = OpString \"world\""}, + {3, "%3 = OpTypeVoid"}, + }, + {} // uses + } + }, + { // multiple def, multiple use + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 3 " + "%3 = OpTypeMatrix %2 3", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %1 3"}, + {3, "%3 = OpTypeMatrix %2 3"}, + }, + { // uses + {1, {"%2 = OpTypeVector %1 3"}}, + {2, {"%3 = OpTypeMatrix %2 3"}}, + } + } + }, + { // multiple use of the same id + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 2 " + "%3 = OpTypeVector %1 3 " + "%4 = OpTypeVector %1 4", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %1 2"}, + {3, "%3 = OpTypeVector %1 3"}, + {4, "%4 = OpTypeVector %1 4"}, + }, + { // uses + {1, + { + "%2 = OpTypeVector %1 2", + "%3 = OpTypeVector %1 3", + "%4 = OpTypeVector %1 4", + } + }, + } + } + }, + { // labels + "%1 = OpTypeVoid " + "%2 = OpTypeBool " + "%3 = OpTypeFunction %1 " + "%4 = OpConstantTrue %2 " + "%5 = OpFunction %1 None %3 " + + "%6 = OpLabel " + "OpBranchConditional %4 %7 %8 " + + "%7 = OpLabel " + "OpBranch %7 " + + "%8 = OpLabel " + "OpReturn " + + "OpFunctionEnd", + { + { // defs + {1, "%1 = OpTypeVoid"}, + {2, "%2 = OpTypeBool"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpConstantTrue %2"}, + {5, "%5 = OpFunction %1 None %3"}, + {6, "%6 = OpLabel"}, + {7, "%7 = OpLabel"}, + {8, "%8 = OpLabel"}, + }, + { // uses + {1, { + "%3 = OpTypeFunction %1", + "%5 = OpFunction %1 None %3", + } + }, + {2, {"%4 = OpConstantTrue %2"}}, + {3, {"%5 = OpFunction %1 None %3"}}, + {4, {"OpBranchConditional %4 %7 %8"}}, + {7, + { + "OpBranchConditional %4 %7 %8", + "OpBranch %7", + } + }, + {8, {"OpBranchConditional %4 %7 %8"}}, + } + } + }, + { // cross function + "%1 = OpTypeBool " + "%3 = OpTypeFunction %1 " + "%2 = OpFunction %1 None %3 " + + "%4 = OpLabel " + "%5 = OpVariable %1 Function " + "%6 = OpFunctionCall %1 %2 %5 " + "OpReturnValue %6 " + + "OpFunctionEnd", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpFunction %1 None %3"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpLabel"}, + {5, "%5 = OpVariable %1 Function"}, + {6, "%6 = OpFunctionCall %1 %2 %5"}, + }, + { // uses + {1, + { + "%2 = OpFunction %1 None %3", + "%3 = OpTypeFunction %1", + "%5 = OpVariable %1 Function", + "%6 = OpFunctionCall %1 %2 %5", + } + }, + {2, {"%6 = OpFunctionCall %1 %2 %5"}}, + {3, {"%2 = OpFunction %1 None %3"}}, + {5, {"%6 = OpFunctionCall %1 %2 %5"}}, + {6, {"OpReturnValue %6"}}, + } + } + }, + { // selection merge and loop merge + "%1 = OpTypeVoid " + "%3 = OpTypeFunction %1 " + "%10 = OpTypeBool " + "%8 = OpConstantTrue %10 " + "%2 = OpFunction %1 None %3 " + + "%4 = OpLabel " + "OpLoopMerge %5 %4 None " + "OpBranch %6 " + + "%5 = OpLabel " + "OpReturn " + + "%6 = OpLabel " + "OpSelectionMerge %7 None " + "OpBranchConditional %8 %9 %7 " + + "%7 = OpLabel " + "OpReturn " + + "%9 = OpLabel " + "OpReturn " + + "OpFunctionEnd", + { + { // defs + {1, "%1 = OpTypeVoid"}, + {2, "%2 = OpFunction %1 None %3"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpLabel"}, + {5, "%5 = OpLabel"}, + {6, "%6 = OpLabel"}, + {7, "%7 = OpLabel"}, + {8, "%8 = OpConstantTrue %10"}, + {9, "%9 = OpLabel"}, + {10, "%10 = OpTypeBool"}, + }, + { // uses + {1, + { + "%2 = OpFunction %1 None %3", + "%3 = OpTypeFunction %1", + } + }, + {3, {"%2 = OpFunction %1 None %3"}}, + {4, {"OpLoopMerge %5 %4 None"}}, + {5, {"OpLoopMerge %5 %4 None"}}, + {6, {"OpBranch %6"}}, + {7, + { + "OpSelectionMerge %7 None", + "OpBranchConditional %8 %9 %7", + } + }, + {8, {"OpBranchConditional %8 %9 %7"}}, + {9, {"OpBranchConditional %8 %9 %7"}}, + {10, {"%8 = OpConstantTrue %10"}}, + } + } + }, + { // Forward reference + "OpDecorate %1 Block " + "OpTypeForwardPointer %2 Input " + "%3 = OpTypeInt 32 0 " + "%1 = OpTypeStruct %3 " + "%2 = OpTypePointer Input %3", + { + { // defs + {1, "%1 = OpTypeStruct %3"}, + {2, "%2 = OpTypePointer Input %3"}, + {3, "%3 = OpTypeInt 32 0"}, + }, + { // uses + {1, {"OpDecorate %1 Block"}}, + {2, {"OpTypeForwardPointer %2 Input"}}, + {3, + { + "%1 = OpTypeStruct %3", + "%2 = OpTypePointer Input %3", + } + } + }, + }, + }, + { // OpPhi + kOpPhiTestFunction, + { + { // defs + {1, "%1 = OpTypeVoid"}, + {2, "%2 = OpFunction %1 None %3"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpLabel"}, + {5, "%5 = OpLabel"}, + {6, "%6 = OpTypeInt 32 0"}, + {7, "%7 = OpPhi %6 %8 %4 %9 %5"}, + {8, "%8 = OpConstant %6 0"}, + {9, "%9 = OpIAdd %6 %7 %8"}, + {10, "%10 = OpTypeFloat 32"}, + {11, "%11 = OpPhi %10 %12 %4 %13 %5"}, + {12, "%12 = OpConstant %10 1.0"}, + {13, "%13 = OpFAdd %10 %11 %12"}, + {16, "%16 = OpTypeBool"}, + {17, "%17 = OpSLessThan %16 %7 %18"}, + {18, "%18 = OpConstant %6 1"}, + {19, "%19 = OpLabel"}, + }, + { // uses + {1, + { + "%2 = OpFunction %1 None %3", + "%3 = OpTypeFunction %1", + } + }, + {3, {"%2 = OpFunction %1 None %3"}}, + {4, + { + "%7 = OpPhi %6 %8 %4 %9 %5", + "%11 = OpPhi %10 %12 %4 %13 %5", + } + }, + {5, + { + "OpBranch %5", + "%7 = OpPhi %6 %8 %4 %9 %5", + "%11 = OpPhi %10 %12 %4 %13 %5", + "OpLoopMerge %19 %5 None", + "OpBranchConditional %17 %5 %19", + } + }, + {6, + { + // Can't check constants properly + // "%8 = OpConstant %6 0", + // "%18 = OpConstant %6 1", + "%7 = OpPhi %6 %8 %4 %9 %5", + "%9 = OpIAdd %6 %7 %8", + } + }, + {7, + { + "%9 = OpIAdd %6 %7 %8", + "%17 = OpSLessThan %16 %7 %18", + } + }, + {8, + { + "%7 = OpPhi %6 %8 %4 %9 %5", + "%9 = OpIAdd %6 %7 %8", + } + }, + {9, {"%7 = OpPhi %6 %8 %4 %9 %5"}}, + {10, + { + // "%12 = OpConstant %10 1.0", + "%11 = OpPhi %10 %12 %4 %13 %5", + "%13 = OpFAdd %10 %11 %12", + } + }, + {11, {"%13 = OpFAdd %10 %11 %12"}}, + {12, + { + "%11 = OpPhi %10 %12 %4 %13 %5", + "%13 = OpFAdd %10 %11 %12", + } + }, + {13, {"%11 = OpPhi %10 %12 %4 %13 %5"}}, + {16, {"%17 = OpSLessThan %16 %7 %18"}}, + {17, {"OpBranchConditional %17 %5 %19"}}, + {18, {"%17 = OpSLessThan %16 %7 %18"}}, + {19, + { + "OpLoopMerge %19 %5 None", + "OpBranchConditional %17 %5 %19", + } + }, + }, + }, + }, + { // OpPhi defining and referencing the same id. + "%1 = OpTypeBool " + "%3 = OpTypeFunction %1 " + "%2 = OpConstantTrue %1 " + "%4 = OpFunction %1 None %3 " + "%6 = OpLabel " + " OpBranch %7 " + "%7 = OpLabel " + "%8 = OpPhi %1 %8 %7 %2 %6 " // both defines and uses %8 + " OpBranch %7 " + " OpFunctionEnd", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpConstantTrue %1"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpFunction %1 None %3"}, + {6, "%6 = OpLabel"}, + {7, "%7 = OpLabel"}, + {8, "%8 = OpPhi %1 %8 %7 %2 %6"}, + }, + { // uses + {1, + { + "%2 = OpConstantTrue %1", + "%3 = OpTypeFunction %1", + "%4 = OpFunction %1 None %3", + "%8 = OpPhi %1 %8 %7 %2 %6", + } + }, + {2, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + {3, {"%4 = OpFunction %1 None %3"}}, + {6, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + {7, + { + "OpBranch %7", + "%8 = OpPhi %1 %8 %7 %2 %6", + "OpBranch %7", + } + }, + {8, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + }, + }, + }, + }) +); +// clang-format on + +struct ReplaceUseCase { + const char* before; + std::vector> candidates; + const char* after; + InstDefUse du; +}; + +using ReplaceUseTest = ::testing::TestWithParam; + +// Disassembles the given |module| and returns the disassembly. +std::string DisassembleModule(Module* module) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_1); + + std::vector binary; + module->ToBinary(&binary, /* skip_nop = */ false); + + std::string text; + // We'll need to check the underlying id numbers. + // So turn off friendly names for ids. + tools.Disassemble(binary, &text, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + while (!text.empty() && text.back() == '\n') text.pop_back(); + return text; +} + +TEST_P(ReplaceUseTest, Case) { + const auto& tc = GetParam(); + + // Build module. + const std::vector text = {tc.before}; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, JoinAllInsts(text), + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Force a re-build of def-use manager. + context->InvalidateAnalyses(IRContext::Analysis::kAnalysisDefUse); + (void)context->get_def_use_mgr(); + + // Do the substitution. + for (const auto& candidate : tc.candidates) { + context->ReplaceAllUsesWith(candidate.first, candidate.second); + } + + EXPECT_EQ(tc.after, DisassembleModule(context->module())); + CheckDef(tc.du, context->get_def_use_mgr()->id_to_defs()); + CheckUse(tc.du, context->get_def_use_mgr(), context->module()->IdBound()); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TestCase, ReplaceUseTest, + ::testing::ValuesIn(std::vector{ + { // no use, no replace request + "", {}, "", {}, + }, + { // replace one use + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 3 " + "%3 = OpTypeInt 32 0 ", + {{1, 3}}, + "%1 = OpTypeBool\n" + "%2 = OpTypeVector %3 3\n" + "%3 = OpTypeInt 32 0", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %3 3"}, + {3, "%3 = OpTypeInt 32 0"}, + }, + { // uses + {3, {"%2 = OpTypeVector %3 3"}}, + }, + }, + }, + { // replace and then replace back + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 3 " + "%3 = OpTypeInt 32 0", + {{1, 3}, {3, 1}}, + "%1 = OpTypeBool\n" + "%2 = OpTypeVector %1 3\n" + "%3 = OpTypeInt 32 0", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %1 3"}, + {3, "%3 = OpTypeInt 32 0"}, + }, + { // uses + {1, {"%2 = OpTypeVector %1 3"}}, + }, + }, + }, + { // replace with the same id + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 3", + {{1, 1}, {2, 2}, {3, 3}}, + "%1 = OpTypeBool\n" + "%2 = OpTypeVector %1 3", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %1 3"}, + }, + { // uses + {1, {"%2 = OpTypeVector %1 3"}}, + }, + }, + }, + { // replace in sequence + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 3 " + "%3 = OpTypeInt 32 0 " + "%4 = OpTypeInt 32 1 ", + {{1, 3}, {3, 4}}, + "%1 = OpTypeBool\n" + "%2 = OpTypeVector %4 3\n" + "%3 = OpTypeInt 32 0\n" + "%4 = OpTypeInt 32 1", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %4 3"}, + {3, "%3 = OpTypeInt 32 0"}, + {4, "%4 = OpTypeInt 32 1"}, + }, + { // uses + {4, {"%2 = OpTypeVector %4 3"}}, + }, + }, + }, + { // replace multiple uses + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 2 " + "%3 = OpTypeVector %1 3 " + "%4 = OpTypeVector %1 4 " + "%5 = OpTypeMatrix %2 2 " + "%6 = OpTypeMatrix %3 3 " + "%7 = OpTypeMatrix %4 4 " + "%8 = OpTypeInt 32 0 " + "%9 = OpTypeInt 32 1 " + "%10 = OpTypeInt 64 0", + {{1, 8}, {2, 9}, {4, 10}}, + "%1 = OpTypeBool\n" + "%2 = OpTypeVector %8 2\n" + "%3 = OpTypeVector %8 3\n" + "%4 = OpTypeVector %8 4\n" + "%5 = OpTypeMatrix %9 2\n" + "%6 = OpTypeMatrix %3 3\n" + "%7 = OpTypeMatrix %10 4\n" + "%8 = OpTypeInt 32 0\n" + "%9 = OpTypeInt 32 1\n" + "%10 = OpTypeInt 64 0", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %8 2"}, + {3, "%3 = OpTypeVector %8 3"}, + {4, "%4 = OpTypeVector %8 4"}, + {5, "%5 = OpTypeMatrix %9 2"}, + {6, "%6 = OpTypeMatrix %3 3"}, + {7, "%7 = OpTypeMatrix %10 4"}, + {8, "%8 = OpTypeInt 32 0"}, + {9, "%9 = OpTypeInt 32 1"}, + {10, "%10 = OpTypeInt 64 0"}, + }, + { // uses + {8, + { + "%2 = OpTypeVector %8 2", + "%3 = OpTypeVector %8 3", + "%4 = OpTypeVector %8 4", + } + }, + {9, {"%5 = OpTypeMatrix %9 2"}}, + {3, {"%6 = OpTypeMatrix %3 3"}}, + {10, {"%7 = OpTypeMatrix %10 4"}}, + }, + }, + }, + { // OpPhi. + kOpPhiTestFunction, + // replace one id used by OpPhi, replace one id generated by OpPhi + {{9, 13}, {11, 9}}, + "%1 = OpTypeVoid\n" + "%6 = OpTypeInt 32 0\n" + "%10 = OpTypeFloat 32\n" + "%16 = OpTypeBool\n" + "%3 = OpTypeFunction %1\n" + "%8 = OpConstant %6 0\n" + "%18 = OpConstant %6 1\n" + "%12 = OpConstant %10 1\n" + "%2 = OpFunction %1 None %3\n" + "%4 = OpLabel\n" + "OpBranch %5\n" + + "%5 = OpLabel\n" + "%7 = OpPhi %6 %8 %4 %13 %5\n" // %9 -> %13 + "%11 = OpPhi %10 %12 %4 %13 %5\n" + "%9 = OpIAdd %6 %7 %8\n" + "%13 = OpFAdd %10 %9 %12\n" // %11 -> %9 + "%17 = OpSLessThan %16 %7 %18\n" + "OpLoopMerge %19 %5 None\n" + "OpBranchConditional %17 %5 %19\n" + + "%19 = OpLabel\n" + "OpReturn\n" + "OpFunctionEnd", + { + { // defs. + {1, "%1 = OpTypeVoid"}, + {2, "%2 = OpFunction %1 None %3"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpLabel"}, + {5, "%5 = OpLabel"}, + {6, "%6 = OpTypeInt 32 0"}, + {7, "%7 = OpPhi %6 %8 %4 %13 %5"}, + {8, "%8 = OpConstant %6 0"}, + {9, "%9 = OpIAdd %6 %7 %8"}, + {10, "%10 = OpTypeFloat 32"}, + {11, "%11 = OpPhi %10 %12 %4 %13 %5"}, + {12, "%12 = OpConstant %10 1.0"}, + {13, "%13 = OpFAdd %10 %9 %12"}, + {16, "%16 = OpTypeBool"}, + {17, "%17 = OpSLessThan %16 %7 %18"}, + {18, "%18 = OpConstant %6 1"}, + {19, "%19 = OpLabel"}, + }, + { // uses + {1, + { + "%2 = OpFunction %1 None %3", + "%3 = OpTypeFunction %1", + } + }, + {3, {"%2 = OpFunction %1 None %3"}}, + {4, + { + "%7 = OpPhi %6 %8 %4 %13 %5", + "%11 = OpPhi %10 %12 %4 %13 %5", + } + }, + {5, + { + "OpBranch %5", + "%7 = OpPhi %6 %8 %4 %13 %5", + "%11 = OpPhi %10 %12 %4 %13 %5", + "OpLoopMerge %19 %5 None", + "OpBranchConditional %17 %5 %19", + } + }, + {6, + { + // Can't properly check constants + // "%8 = OpConstant %6 0", + // "%18 = OpConstant %6 1", + "%7 = OpPhi %6 %8 %4 %13 %5", + "%9 = OpIAdd %6 %7 %8" + } + }, + {7, + { + "%9 = OpIAdd %6 %7 %8", + "%17 = OpSLessThan %16 %7 %18", + } + }, + {8, + { + "%7 = OpPhi %6 %8 %4 %13 %5", + "%9 = OpIAdd %6 %7 %8", + } + }, + {9, {"%13 = OpFAdd %10 %9 %12"}}, // uses of %9 changed from %7 to %13 + {10, + { + "%11 = OpPhi %10 %12 %4 %13 %5", + // "%12 = OpConstant %10 1", + "%13 = OpFAdd %10 %9 %12" + } + }, + // no more uses of %11 + {12, + { + "%11 = OpPhi %10 %12 %4 %13 %5", + "%13 = OpFAdd %10 %9 %12" + } + }, + {13, { + "%7 = OpPhi %6 %8 %4 %13 %5", + "%11 = OpPhi %10 %12 %4 %13 %5", + } + }, + {16, {"%17 = OpSLessThan %16 %7 %18"}}, + {17, {"OpBranchConditional %17 %5 %19"}}, + {18, {"%17 = OpSLessThan %16 %7 %18"}}, + {19, + { + "OpLoopMerge %19 %5 None", + "OpBranchConditional %17 %5 %19", + } + }, + }, + }, + }, + { // OpPhi defining and referencing the same id. + "%1 = OpTypeBool " + "%3 = OpTypeFunction %1 " + "%2 = OpConstantTrue %1 " + + "%4 = OpFunction %3 None %1 " + "%6 = OpLabel " + " OpBranch %7 " + "%7 = OpLabel " + "%8 = OpPhi %1 %8 %7 %2 %6 " // both defines and uses %8 + " OpBranch %7 " + " OpFunctionEnd", + {{8, 2}}, + "%1 = OpTypeBool\n" + "%3 = OpTypeFunction %1\n" + "%2 = OpConstantTrue %1\n" + + "%4 = OpFunction %3 None %1\n" + "%6 = OpLabel\n" + "OpBranch %7\n" + "%7 = OpLabel\n" + "%8 = OpPhi %1 %2 %7 %2 %6\n" // use of %8 changed to %2 + "OpBranch %7\n" + "OpFunctionEnd", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpConstantTrue %1"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpFunction %3 None %1"}, + {6, "%6 = OpLabel"}, + {7, "%7 = OpLabel"}, + {8, "%8 = OpPhi %1 %2 %7 %2 %6"}, + }, + { // uses + {1, + { + "%2 = OpConstantTrue %1", + "%3 = OpTypeFunction %1", + "%4 = OpFunction %3 None %1", + "%8 = OpPhi %1 %2 %7 %2 %6", + } + }, + {2, + { + // Only checking users + "%8 = OpPhi %1 %2 %7 %2 %6", + } + }, + {3, {"%4 = OpFunction %3 None %1"}}, + {6, {"%8 = OpPhi %1 %2 %7 %2 %6"}}, + {7, + { + "OpBranch %7", + "%8 = OpPhi %1 %2 %7 %2 %6", + "OpBranch %7", + } + }, + // {8, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + }, + }, + }, + }) +); +// clang-format on + +struct KillDefCase { + const char* before; + std::vector ids_to_kill; + const char* after; + InstDefUse du; +}; + +using KillDefTest = ::testing::TestWithParam; + +TEST_P(KillDefTest, Case) { + const auto& tc = GetParam(); + + // Build module. + const std::vector text = {tc.before}; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, JoinAllInsts(text), + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Analyze def and use. + DefUseManager manager(context->module()); + + // Do the substitution. + for (const auto id : tc.ids_to_kill) context->KillDef(id); + + EXPECT_EQ(tc.after, DisassembleModule(context->module())); + CheckDef(tc.du, context->get_def_use_mgr()->id_to_defs()); + CheckUse(tc.du, context->get_def_use_mgr(), context->module()->IdBound()); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TestCase, KillDefTest, + ::testing::ValuesIn(std::vector{ + { // no def, no use, no kill + "", {}, "", {} + }, + { // kill nothing + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 2 " + "%3 = OpTypeVector %1 3 ", + {}, + "%1 = OpTypeBool\n" + "%2 = OpTypeVector %1 2\n" + "%3 = OpTypeVector %1 3", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpTypeVector %1 2"}, + {3, "%3 = OpTypeVector %1 3"}, + }, + { // uses + {1, + { + "%2 = OpTypeVector %1 2", + "%3 = OpTypeVector %1 3", + } + }, + }, + }, + }, + { // kill id used, kill id not used, kill id not defined + "%1 = OpTypeBool " + "%2 = OpTypeVector %1 2 " + "%3 = OpTypeVector %1 3 " + "%4 = OpTypeVector %1 4 " + "%5 = OpTypeMatrix %3 3 " + "%6 = OpTypeMatrix %2 3", + {1, 3, 5, 10}, // ids to kill + "%2 = OpTypeVector %1 2\n" + "%4 = OpTypeVector %1 4\n" + "%6 = OpTypeMatrix %2 3", + { + { // defs + {2, "%2 = OpTypeVector %1 2"}, + {4, "%4 = OpTypeVector %1 4"}, + {6, "%6 = OpTypeMatrix %2 3"}, + }, + { // uses. %1 and %3 are both killed, so no uses + // recorded for them anymore. + {2, {"%6 = OpTypeMatrix %2 3"}}, + } + }, + }, + { // OpPhi. + kOpPhiTestFunction, + {9, 11}, // kill one id used by OpPhi, kill one id generated by OpPhi + "%1 = OpTypeVoid\n" + "%6 = OpTypeInt 32 0\n" + "%10 = OpTypeFloat 32\n" + "%16 = OpTypeBool\n" + "%3 = OpTypeFunction %1\n" + "%8 = OpConstant %6 0\n" + "%18 = OpConstant %6 1\n" + "%12 = OpConstant %10 1\n" + "%2 = OpFunction %1 None %3\n" + "%4 = OpLabel\n" + "OpBranch %5\n" + + "%5 = OpLabel\n" + "%7 = OpPhi %6 %8 %4 %9 %5\n" + "%13 = OpFAdd %10 %11 %12\n" + "%17 = OpSLessThan %16 %7 %18\n" + "OpLoopMerge %19 %5 None\n" + "OpBranchConditional %17 %5 %19\n" + + "%19 = OpLabel\n" + "OpReturn\n" + "OpFunctionEnd", + { + { // defs. %9 & %11 are killed. + {1, "%1 = OpTypeVoid"}, + {2, "%2 = OpFunction %1 None %3"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpLabel"}, + {5, "%5 = OpLabel"}, + {6, "%6 = OpTypeInt 32 0"}, + {7, "%7 = OpPhi %6 %8 %4 %9 %5"}, + {8, "%8 = OpConstant %6 0"}, + {10, "%10 = OpTypeFloat 32"}, + {12, "%12 = OpConstant %10 1.0"}, + {13, "%13 = OpFAdd %10 %11 %12"}, + {16, "%16 = OpTypeBool"}, + {17, "%17 = OpSLessThan %16 %7 %18"}, + {18, "%18 = OpConstant %6 1"}, + {19, "%19 = OpLabel"}, + }, + { // uses + {1, + { + "%2 = OpFunction %1 None %3", + "%3 = OpTypeFunction %1", + } + }, + {3, {"%2 = OpFunction %1 None %3"}}, + {4, + { + "%7 = OpPhi %6 %8 %4 %9 %5", + // "%11 = OpPhi %10 %12 %4 %13 %5", + } + }, + {5, + { + "OpBranch %5", + "%7 = OpPhi %6 %8 %4 %9 %5", + // "%11 = OpPhi %10 %12 %4 %13 %5", + "OpLoopMerge %19 %5 None", + "OpBranchConditional %17 %5 %19", + } + }, + {6, + { + // Can't properly check constants + // "%8 = OpConstant %6 0", + // "%18 = OpConstant %6 1", + "%7 = OpPhi %6 %8 %4 %9 %5", + // "%9 = OpIAdd %6 %7 %8" + } + }, + {7, {"%17 = OpSLessThan %16 %7 %18"}}, + {8, + { + "%7 = OpPhi %6 %8 %4 %9 %5", + // "%9 = OpIAdd %6 %7 %8", + } + }, + // {9, {"%7 = OpPhi %6 %8 %4 %13 %5"}}, + {10, + { + // "%11 = OpPhi %10 %12 %4 %13 %5", + // "%12 = OpConstant %10 1", + "%13 = OpFAdd %10 %11 %12" + } + }, + // {11, {"%13 = OpFAdd %10 %11 %12"}}, + {12, + { + // "%11 = OpPhi %10 %12 %4 %13 %5", + "%13 = OpFAdd %10 %11 %12" + } + }, + // {13, {"%11 = OpPhi %10 %12 %4 %13 %5"}}, + {16, {"%17 = OpSLessThan %16 %7 %18"}}, + {17, {"OpBranchConditional %17 %5 %19"}}, + {18, {"%17 = OpSLessThan %16 %7 %18"}}, + {19, + { + "OpLoopMerge %19 %5 None", + "OpBranchConditional %17 %5 %19", + } + }, + }, + }, + }, + { // OpPhi defining and referencing the same id. + "%1 = OpTypeBool " + "%3 = OpTypeFunction %1 " + "%2 = OpConstantTrue %1 " + "%4 = OpFunction %3 None %1 " + "%6 = OpLabel " + " OpBranch %7 " + "%7 = OpLabel " + "%8 = OpPhi %1 %8 %7 %2 %6 " // both defines and uses %8 + " OpBranch %7 " + " OpFunctionEnd", + {8}, + "%1 = OpTypeBool\n" + "%3 = OpTypeFunction %1\n" + "%2 = OpConstantTrue %1\n" + + "%4 = OpFunction %3 None %1\n" + "%6 = OpLabel\n" + "OpBranch %7\n" + "%7 = OpLabel\n" + "OpBranch %7\n" + "OpFunctionEnd", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpConstantTrue %1"}, + {3, "%3 = OpTypeFunction %1"}, + {4, "%4 = OpFunction %3 None %1"}, + {6, "%6 = OpLabel"}, + {7, "%7 = OpLabel"}, + // {8, "%8 = OpPhi %1 %8 %7 %2 %6"}, + }, + { // uses + {1, + { + "%2 = OpConstantTrue %1", + "%3 = OpTypeFunction %1", + "%4 = OpFunction %3 None %1", + // "%8 = OpPhi %1 %8 %7 %2 %6", + } + }, + // {2, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + {3, {"%4 = OpFunction %3 None %1"}}, + // {6, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + {7, + { + "OpBranch %7", + // "%8 = OpPhi %1 %8 %7 %2 %6", + "OpBranch %7", + } + }, + // {8, {"%8 = OpPhi %1 %8 %7 %2 %6"}}, + }, + }, + }, + }) +); +// clang-format on + +TEST(DefUseTest, OpSwitch) { + // Because disassembler has basic type check for OpSwitch's selector, we + // cannot use the DisassembleInst() in the above. Thus, this special spotcheck + // test case. + + const char original_text[] = + // int64 f(int64 v) { + // switch (v) { + // case 1: break; + // case -4294967296: break; + // case 9223372036854775807: break; + // default: break; + // } + // return v; + // } + " %1 = OpTypeInt 64 1 " + " %3 = OpTypePointer Input %1 " + " %2 = OpFunction %1 None %3 " // %3 is int64(int64)* + " %4 = OpFunctionParameter %1 " + " %5 = OpLabel " + " %6 = OpLoad %1 %4 " // selector value + " OpSelectionMerge %7 None " + " OpSwitch %6 %8 " + " 1 %9 " // 1 + " -4294967296 %10 " // -2^32 + " 9223372036854775807 %11 " // 2^63-1 + " %8 = OpLabel " // default + " OpBranch %7 " + " %9 = OpLabel " + " OpBranch %7 " + "%10 = OpLabel " + " OpBranch %7 " + "%11 = OpLabel " + " OpBranch %7 " + " %7 = OpLabel " + " OpReturnValue %6 " + " OpFunctionEnd"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, original_text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Force a re-build of def-use manager. + context->InvalidateAnalyses(IRContext::Analysis::kAnalysisDefUse); + (void)context->get_def_use_mgr(); + + // Do a bunch replacements. + context->ReplaceAllUsesWith(11, 7); // to existing id + context->ReplaceAllUsesWith(10, 11); // to existing id + context->ReplaceAllUsesWith(9, 10); // to existing id + + // clang-format off + const char modified_text[] = + "%1 = OpTypeInt 64 1\n" + "%3 = OpTypePointer Input %1\n" + "%2 = OpFunction %1 None %3\n" // %3 is int64(int64)* + "%4 = OpFunctionParameter %1\n" + "%5 = OpLabel\n" + "%6 = OpLoad %1 %4\n" // selector value + "OpSelectionMerge %7 None\n" + "OpSwitch %6 %8 1 %10 -4294967296 %11 9223372036854775807 %7\n" // changed! + "%8 = OpLabel\n" // default + "OpBranch %7\n" + "%9 = OpLabel\n" + "OpBranch %7\n" + "%10 = OpLabel\n" + "OpBranch %7\n" + "%11 = OpLabel\n" + "OpBranch %7\n" + "%7 = OpLabel\n" + "OpReturnValue %6\n" + "OpFunctionEnd"; + // clang-format on + + EXPECT_EQ(modified_text, DisassembleModule(context->module())); + + InstDefUse def_uses = {}; + def_uses.defs = { + {1, "%1 = OpTypeInt 64 1"}, + {2, "%2 = OpFunction %1 None %3"}, + {3, "%3 = OpTypePointer Input %1"}, + {4, "%4 = OpFunctionParameter %1"}, + {5, "%5 = OpLabel"}, + {6, "%6 = OpLoad %1 %4"}, + {7, "%7 = OpLabel"}, + {8, "%8 = OpLabel"}, + {9, "%9 = OpLabel"}, + {10, "%10 = OpLabel"}, + {11, "%11 = OpLabel"}, + }; + CheckDef(def_uses, context->get_def_use_mgr()->id_to_defs()); + + { + EXPECT_EQ(2u, NumUses(context, 6)); + std::vector opcodes = GetUseOpcodes(context, 6u); + EXPECT_THAT(opcodes, UnorderedElementsAre(SpvOpSwitch, SpvOpReturnValue)); + } + { + EXPECT_EQ(6u, NumUses(context, 7)); + std::vector opcodes = GetUseOpcodes(context, 7u); + // OpSwitch is now a user of %7. + EXPECT_THAT(opcodes, UnorderedElementsAre(SpvOpSelectionMerge, SpvOpBranch, + SpvOpBranch, SpvOpBranch, + SpvOpBranch, SpvOpSwitch)); + } + // Check all ids only used by OpSwitch after replacement. + for (const auto id : {8u, 10u, 11u}) { + EXPECT_EQ(1u, NumUses(context, id)); + EXPECT_EQ(SpvOpSwitch, GetUseOpcodes(context, id).back()); + } +} + +// Test case for analyzing individual instructions. +struct AnalyzeInstDefUseTestCase { + const char* module_text; + InstDefUse expected_define_use; +}; + +using AnalyzeInstDefUseTest = + ::testing::TestWithParam; + +// Test the analyzing result for individual instructions. +TEST_P(AnalyzeInstDefUseTest, Case) { + auto tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.module_text); + ASSERT_NE(nullptr, context); + + // Analyze the instructions. + DefUseManager manager(context->module()); + + CheckDef(tc.expected_define_use, manager.id_to_defs()); + CheckUse(tc.expected_define_use, &manager, context->module()->IdBound()); + // CheckUse(tc.expected_define_use, manager.id_to_uses()); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TestCase, AnalyzeInstDefUseTest, + ::testing::ValuesIn(std::vector{ + { // A type declaring instruction. + "%1 = OpTypeInt 32 1", + { + // defs + {{1, "%1 = OpTypeInt 32 1"}}, + {}, // no uses + }, + }, + { // A type declaring instruction and a constant value. + "%1 = OpTypeBool " + "%2 = OpConstantTrue %1", + { + { // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpConstantTrue %1"}, + }, + { // uses + {1, {"%2 = OpConstantTrue %1"}}, + }, + }, + }, + })); +// clang-format on + +using AnalyzeInstDefUse = ::testing::Test; + +TEST(AnalyzeInstDefUse, UseWithNoResultId) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + + // Analyze the instructions. + DefUseManager manager(context.module()); + + Instruction label(&context, SpvOpLabel, 0, 2, {}); + manager.AnalyzeInstDefUse(&label); + + Instruction branch(&context, SpvOpBranch, 0, 0, {{SPV_OPERAND_TYPE_ID, {2}}}); + manager.AnalyzeInstDefUse(&branch); + context.module()->SetIdBound(3); + + InstDefUse expected = { + // defs + { + {2, "%2 = OpLabel"}, + }, + // uses + {{2, {"OpBranch %2"}}}, + }; + + CheckDef(expected, manager.id_to_defs()); + CheckUse(expected, &manager, context.module()->IdBound()); +} + +TEST(AnalyzeInstDefUse, AddNewInstruction) { + const std::string input = "%1 = OpTypeBool"; + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, input); + ASSERT_NE(nullptr, context); + + // Analyze the instructions. + DefUseManager manager(context->module()); + + Instruction newInst(context.get(), SpvOpConstantTrue, 1, 2, {}); + manager.AnalyzeInstDefUse(&newInst); + + InstDefUse expected = { + { + // defs + {1, "%1 = OpTypeBool"}, + {2, "%2 = OpConstantTrue %1"}, + }, + { + // uses + {1, {"%2 = OpConstantTrue %1"}}, + }, + }; + + CheckDef(expected, manager.id_to_defs()); + CheckUse(expected, &manager, context->module()->IdBound()); +} + +struct KillInstTestCase { + const char* before; + std::unordered_set indices_for_inst_to_kill; + const char* after; + InstDefUse expected_define_use; +}; + +using KillInstTest = ::testing::TestWithParam; + +TEST_P(KillInstTest, Case) { + auto tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.before, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Force a re-build of the def-use manager. + context->InvalidateAnalyses(IRContext::Analysis::kAnalysisDefUse); + (void)context->get_def_use_mgr(); + + // KillInst + context->module()->ForEachInst([&tc, &context](Instruction* inst) { + if (tc.indices_for_inst_to_kill.count(inst->result_id())) { + context->KillInst(inst); + } + }); + + EXPECT_EQ(tc.after, DisassembleModule(context->module())); + CheckDef(tc.expected_define_use, context->get_def_use_mgr()->id_to_defs()); + CheckUse(tc.expected_define_use, context->get_def_use_mgr(), + context->module()->IdBound()); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TestCase, KillInstTest, + ::testing::ValuesIn(std::vector{ + // Kill id defining instructions. + { + "%3 = OpTypeVoid " + "%1 = OpTypeFunction %3 " + "%2 = OpFunction %1 None %3 " + "%4 = OpLabel " + " OpBranch %5 " + "%5 = OpLabel " + " OpBranch %6 " + "%6 = OpLabel " + " OpBranch %4 " + "%7 = OpLabel " + " OpReturn " + " OpFunctionEnd", + {3, 5, 7}, + "%1 = OpTypeFunction %3\n" + "%2 = OpFunction %1 None %3\n" + "%4 = OpLabel\n" + "OpBranch %5\n" + "OpNop\n" + "OpBranch %6\n" + "%6 = OpLabel\n" + "OpBranch %4\n" + "OpNop\n" + "OpReturn\n" + "OpFunctionEnd", + { + // defs + { + {1, "%1 = OpTypeFunction %3"}, + {2, "%2 = OpFunction %1 None %3"}, + {4, "%4 = OpLabel"}, + {6, "%6 = OpLabel"}, + }, + // uses + { + {1, {"%2 = OpFunction %1 None %3"}}, + {4, {"OpBranch %4"}}, + {6, {"OpBranch %6"}}, + } + } + }, + // Kill instructions that do not have result ids. + { + "%3 = OpTypeVoid " + "%1 = OpTypeFunction %3 " + "%2 = OpFunction %1 None %3 " + "%4 = OpLabel " + " OpBranch %5 " + "%5 = OpLabel " + " OpBranch %6 " + "%6 = OpLabel " + " OpBranch %4 " + "%7 = OpLabel " + " OpReturn " + " OpFunctionEnd", + {2, 4}, + "%3 = OpTypeVoid\n" + "%1 = OpTypeFunction %3\n" + "OpNop\n" + "OpNop\n" + "OpBranch %5\n" + "%5 = OpLabel\n" + "OpBranch %6\n" + "%6 = OpLabel\n" + "OpBranch %4\n" + "%7 = OpLabel\n" + "OpReturn\n" + "OpFunctionEnd", + { + // defs + { + {1, "%1 = OpTypeFunction %3"}, + {3, "%3 = OpTypeVoid"}, + {5, "%5 = OpLabel"}, + {6, "%6 = OpLabel"}, + {7, "%7 = OpLabel"}, + }, + // uses + { + {3, {"%1 = OpTypeFunction %3"}}, + {5, {"OpBranch %5"}}, + {6, {"OpBranch %6"}}, + } + } + }, + })); +// clang-format on + +struct GetAnnotationsTestCase { + const char* code; + uint32_t id; + std::vector annotations; +}; + +using GetAnnotationsTest = ::testing::TestWithParam; + +TEST_P(GetAnnotationsTest, Case) { + const GetAnnotationsTestCase& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.code); + ASSERT_NE(nullptr, context); + + // Get annotations + DefUseManager manager(context->module()); + auto insts = manager.GetAnnotations(tc.id); + + // Check + ASSERT_EQ(tc.annotations.size(), insts.size()) + << "wrong number of annotation instructions"; + auto inst_iter = insts.begin(); + for (const std::string& expected_anno_inst : tc.annotations) { + EXPECT_EQ(expected_anno_inst, DisassembleInst(*inst_iter)) + << "annotation instruction mismatch"; + inst_iter++; + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TestCase, GetAnnotationsTest, + ::testing::ValuesIn(std::vector{ + // empty + {"", 0, {}}, + // basic + { + // code + "OpDecorate %1 Block " + "OpDecorate %1 RelaxedPrecision " + "%3 = OpTypeInt 32 0 " + "%1 = OpTypeStruct %3", + // id + 1, + // annotations + { + "OpDecorate %1 Block", + "OpDecorate %1 RelaxedPrecision", + }, + }, + // with debug instructions + { + // code + "OpName %1 \"struct_type\" " + "OpName %3 \"int_type\" " + "OpDecorate %1 Block " + "OpDecorate %1 RelaxedPrecision " + "%3 = OpTypeInt 32 0 " + "%1 = OpTypeStruct %3", + // id + 1, + // annotations + { + "OpDecorate %1 Block", + "OpDecorate %1 RelaxedPrecision", + }, + }, + // no annotations + { + // code + "OpName %1 \"struct_type\" " + "OpName %3 \"int_type\" " + "OpDecorate %1 Block " + "OpDecorate %1 RelaxedPrecision " + "%3 = OpTypeInt 32 0 " + "%1 = OpTypeStruct %3", + // id + 3, + // annotations + {}, + }, + // decoration group + { + // code + "OpDecorate %1 Block " + "OpDecorate %1 RelaxedPrecision " + "%1 = OpDecorationGroup " + "OpGroupDecorate %1 %2 %3 " + "%4 = OpTypeInt 32 0 " + "%2 = OpTypeStruct %4 " + "%3 = OpTypeStruct %4 %4", + // id + 3, + // annotations + { + "OpGroupDecorate %1 %2 %3", + }, + }, + // memeber decorate + { + // code + "OpMemberDecorate %1 0 RelaxedPrecision " + "%2 = OpTypeInt 32 0 " + "%1 = OpTypeStruct %2 %2", + // id + 1, + // annotations + { + "OpMemberDecorate %1 0 RelaxedPrecision", + }, + }, + })); + +using UpdateUsesTest = PassTest<::testing::Test>; + +TEST_F(UpdateUsesTest, KeepOldUses) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "%void = OpTypeVoid", + "%4 = OpTypeFunction %void", + "%uint = OpTypeInt 32 0", + "%uint_5 = OpConstant %uint 5", + "%25 = OpConstant %uint 25", + "%main = OpFunction %void None %4", + "%8 = OpLabel", + "%9 = OpIMul %uint %uint_5 %uint_5", + "%10 = OpIMul %uint %9 %uint_5", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, JoinAllInsts(text), + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* def = def_use_mgr->GetDef(9); + Instruction* use = def_use_mgr->GetDef(10); + def->SetOpcode(SpvOpCopyObject); + def->SetInOperands({{SPV_OPERAND_TYPE_ID, {25}}}); + context->UpdateDefUse(def); + + auto users = def_use_mgr->id_to_users(); + UserEntry entry = {def, use}; + EXPECT_THAT(users, Contains(entry)); +} +// clang-format on + +} // namespace +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/CMakeLists.txt new file mode 100644 index 00000000000..f95a56da87a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (c) 2017 Google 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. + + +add_spvtools_unittest(TARGET dominator_analysis + SRCS ../function_utils.h + common_dominators.cpp + generated.cpp + nested_ifs.cpp + nested_ifs_post.cpp + nested_loops.cpp + nested_loops_with_unreachables.cpp + post.cpp + simple.cpp + switch_case_fallthrough.cpp + unreachable_for.cpp + unreachable_for_post.cpp + LIBS SPIRV-Tools-opt +) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/common_dominators.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/common_dominators.cpp new file mode 100644 index 00000000000..dfa03e986a4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/common_dominators.cpp @@ -0,0 +1,151 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { + +using CommonDominatorsTest = ::testing::Test; + +const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %3 %4 None +OpBranch %5 +%5 = OpLabel +OpBranchConditional %true %3 %4 +%4 = OpLabel +OpBranch %2 +%3 = OpLabel +OpSelectionMerge %6 None +OpBranchConditional %true %7 %8 +%7 = OpLabel +OpBranch %6 +%8 = OpLabel +OpBranch %9 +%9 = OpLabel +OpBranch %6 +%6 = OpLabel +OpBranch %10 +%11 = OpLabel +OpBranch %10 +%10 = OpLabel +OpReturn +OpFunctionEnd +)"; + +BasicBlock* GetBlock(uint32_t id, std::unique_ptr& context) { + return context->get_instr_block(context->get_def_use_mgr()->GetDef(id)); +} + +TEST(CommonDominatorsTest, SameBlock) { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, context); + + DominatorAnalysis* analysis = + context->GetDominatorAnalysis(&*context->module()->begin()); + + for (auto& block : *context->module()->begin()) { + EXPECT_EQ(&block, analysis->CommonDominator(&block, &block)); + } +} + +TEST(CommonDominatorsTest, ParentAndChild) { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, context); + + DominatorAnalysis* analysis = + context->GetDominatorAnalysis(&*context->module()->begin()); + + EXPECT_EQ( + GetBlock(1u, context), + analysis->CommonDominator(GetBlock(1u, context), GetBlock(2u, context))); + EXPECT_EQ( + GetBlock(2u, context), + analysis->CommonDominator(GetBlock(2u, context), GetBlock(5u, context))); + EXPECT_EQ( + GetBlock(1u, context), + analysis->CommonDominator(GetBlock(1u, context), GetBlock(5u, context))); +} + +TEST(CommonDominatorsTest, BranchSplit) { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, context); + + DominatorAnalysis* analysis = + context->GetDominatorAnalysis(&*context->module()->begin()); + + EXPECT_EQ( + GetBlock(3u, context), + analysis->CommonDominator(GetBlock(7u, context), GetBlock(8u, context))); + EXPECT_EQ( + GetBlock(3u, context), + analysis->CommonDominator(GetBlock(7u, context), GetBlock(9u, context))); +} + +TEST(CommonDominatorsTest, LoopContinueAndMerge) { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, context); + + DominatorAnalysis* analysis = + context->GetDominatorAnalysis(&*context->module()->begin()); + + EXPECT_EQ( + GetBlock(5u, context), + analysis->CommonDominator(GetBlock(3u, context), GetBlock(4u, context))); +} + +TEST(CommonDominatorsTest, NoCommonDominator) { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, context); + + DominatorAnalysis* analysis = + context->GetDominatorAnalysis(&*context->module()->begin()); + + EXPECT_EQ(nullptr, analysis->CommonDominator(GetBlock(10u, context), + GetBlock(11u, context))); + EXPECT_EQ(nullptr, analysis->CommonDominator(GetBlock(11u, context), + GetBlock(6u, context))); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/generated.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/generated.cpp new file mode 100644 index 00000000000..43b723e93ce --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/generated.cpp @@ -0,0 +1,900 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/iterator.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +// Check that x dominates y, and +// if x != y then +// x strictly dominates y and +// y does not dominate x and +// y does not strictly dominate x +// if x == x then +// x does not strictly dominate itself +void check_dominance(const DominatorAnalysisBase& dom_tree, const Function* fn, + uint32_t x, uint32_t y) { + SCOPED_TRACE("Check dominance properties for Basic Block " + + std::to_string(x) + " and " + std::to_string(y)); + EXPECT_TRUE(dom_tree.Dominates(spvtest::GetBasicBlock(fn, x), + spvtest::GetBasicBlock(fn, y))); + EXPECT_TRUE(dom_tree.Dominates(x, y)); + if (x == y) { + EXPECT_FALSE(dom_tree.StrictlyDominates(x, x)); + } else { + EXPECT_TRUE(dom_tree.StrictlyDominates(x, y)); + EXPECT_FALSE(dom_tree.Dominates(y, x)); + EXPECT_FALSE(dom_tree.StrictlyDominates(y, x)); + } +} + +// Check that x does not dominates y and vise versa +void check_no_dominance(const DominatorAnalysisBase& dom_tree, + const Function* fn, uint32_t x, uint32_t y) { + SCOPED_TRACE("Check no domination for Basic Block " + std::to_string(x) + + " and " + std::to_string(y)); + EXPECT_FALSE(dom_tree.Dominates(spvtest::GetBasicBlock(fn, x), + spvtest::GetBasicBlock(fn, y))); + EXPECT_FALSE(dom_tree.Dominates(x, y)); + EXPECT_FALSE(dom_tree.StrictlyDominates(spvtest::GetBasicBlock(fn, x), + spvtest::GetBasicBlock(fn, y))); + EXPECT_FALSE(dom_tree.StrictlyDominates(x, y)); + + EXPECT_FALSE(dom_tree.Dominates(spvtest::GetBasicBlock(fn, y), + spvtest::GetBasicBlock(fn, x))); + EXPECT_FALSE(dom_tree.Dominates(y, x)); + EXPECT_FALSE(dom_tree.StrictlyDominates(spvtest::GetBasicBlock(fn, y), + spvtest::GetBasicBlock(fn, x))); + EXPECT_FALSE(dom_tree.StrictlyDominates(y, x)); +} + +TEST_F(PassClassTest, DominatorSimpleCFG) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %1 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpTypeBool + %5 = OpTypeInt 32 0 + %6 = OpConstant %5 0 + %7 = OpConstantFalse %4 + %8 = OpConstantTrue %4 + %9 = OpConstant %5 1 + %1 = OpFunction %2 None %3 + %10 = OpLabel + OpBranch %11 + %11 = OpLabel + OpSwitch %6 %12 1 %13 + %12 = OpLabel + OpBranch %14 + %13 = OpLabel + OpBranch %14 + %14 = OpLabel + OpBranchConditional %8 %11 %15 + %15 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_0, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* fn = spvtest::GetFunction(module, 1); + const BasicBlock* entry = spvtest::GetBasicBlock(fn, 10); + EXPECT_EQ(entry, fn->entry().get()) + << "The entry node is not the expected one"; + + // Test normal dominator tree + { + DominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE( + dom_tree.Dominates(cfg.pseudo_entry_block()->id(), entry->id())); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12, 13, 14, 15}) + check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 10, 11); + check_dominance(dom_tree, fn, 10, 12); + check_dominance(dom_tree, fn, 10, 13); + check_dominance(dom_tree, fn, 10, 14); + check_dominance(dom_tree, fn, 10, 15); + + check_dominance(dom_tree, fn, 11, 12); + check_dominance(dom_tree, fn, 11, 13); + check_dominance(dom_tree, fn, 11, 14); + check_dominance(dom_tree, fn, 11, 15); + + check_dominance(dom_tree, fn, 14, 15); + + check_no_dominance(dom_tree, fn, 12, 13); + check_no_dominance(dom_tree, fn, 12, 14); + check_no_dominance(dom_tree, fn, 13, 14); + + // check with some invalid inputs + EXPECT_FALSE(dom_tree.Dominates(nullptr, entry)); + EXPECT_FALSE(dom_tree.Dominates(entry, nullptr)); + EXPECT_FALSE(dom_tree.Dominates(static_cast(nullptr), + static_cast(nullptr))); + EXPECT_FALSE(dom_tree.Dominates(10, 1)); + EXPECT_FALSE(dom_tree.Dominates(1, 10)); + EXPECT_FALSE(dom_tree.Dominates(1, 1)); + + EXPECT_FALSE(dom_tree.StrictlyDominates(nullptr, entry)); + EXPECT_FALSE(dom_tree.StrictlyDominates(entry, nullptr)); + EXPECT_FALSE(dom_tree.StrictlyDominates(nullptr, nullptr)); + EXPECT_FALSE(dom_tree.StrictlyDominates(10, 1)); + EXPECT_FALSE(dom_tree.StrictlyDominates(1, 10)); + EXPECT_FALSE(dom_tree.StrictlyDominates(1, 1)); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_entry_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(entry), cfg.pseudo_entry_block()); + EXPECT_EQ(dom_tree.ImmediateDominator(nullptr), nullptr); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 10)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 13)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 14)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 15)), + spvtest::GetBasicBlock(fn, 14)); + } + + // Test post dominator tree + { + PostDominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_exit_block()); + EXPECT_TRUE(dom_tree.Dominates(cfg.pseudo_exit_block()->id(), 15)); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12, 13, 14, 15}) + check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 14, 10); + check_dominance(dom_tree, fn, 14, 11); + check_dominance(dom_tree, fn, 14, 12); + check_dominance(dom_tree, fn, 14, 13); + + check_dominance(dom_tree, fn, 15, 10); + check_dominance(dom_tree, fn, 15, 11); + check_dominance(dom_tree, fn, 15, 12); + check_dominance(dom_tree, fn, 15, 13); + check_dominance(dom_tree, fn, 15, 14); + + check_no_dominance(dom_tree, fn, 13, 12); + check_no_dominance(dom_tree, fn, 12, 11); + check_no_dominance(dom_tree, fn, 13, 11); + + // check with some invalid inputs + EXPECT_FALSE(dom_tree.Dominates(nullptr, entry)); + EXPECT_FALSE(dom_tree.Dominates(entry, nullptr)); + EXPECT_FALSE(dom_tree.Dominates(static_cast(nullptr), + static_cast(nullptr))); + EXPECT_FALSE(dom_tree.Dominates(10, 1)); + EXPECT_FALSE(dom_tree.Dominates(1, 10)); + EXPECT_FALSE(dom_tree.Dominates(1, 1)); + + EXPECT_FALSE(dom_tree.StrictlyDominates(nullptr, entry)); + EXPECT_FALSE(dom_tree.StrictlyDominates(entry, nullptr)); + EXPECT_FALSE(dom_tree.StrictlyDominates(nullptr, nullptr)); + EXPECT_FALSE(dom_tree.StrictlyDominates(10, 1)); + EXPECT_FALSE(dom_tree.StrictlyDominates(1, 10)); + EXPECT_FALSE(dom_tree.StrictlyDominates(1, 1)); + + EXPECT_EQ(dom_tree.ImmediateDominator(nullptr), nullptr); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 14)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 14)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 13)), + spvtest::GetBasicBlock(fn, 14)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 14)), + spvtest::GetBasicBlock(fn, 15)); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 15)), + cfg.pseudo_exit_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_exit_block()), nullptr); + } +} + +TEST_F(PassClassTest, DominatorIrreducibleCFG) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %1 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpTypeBool + %5 = OpTypeInt 32 0 + %6 = OpConstantFalse %4 + %7 = OpConstantTrue %4 + %1 = OpFunction %2 None %3 + %8 = OpLabel + OpBranch %9 + %9 = OpLabel + OpBranchConditional %7 %10 %11 + %10 = OpLabel + OpBranch %11 + %11 = OpLabel + OpBranchConditional %7 %10 %12 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_0, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* fn = spvtest::GetFunction(module, 1); + + const BasicBlock* entry = spvtest::GetBasicBlock(fn, 8); + EXPECT_EQ(entry, fn->entry().get()) + << "The entry node is not the expected one"; + + // Check normal dominator tree + { + DominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE( + dom_tree.Dominates(cfg.pseudo_entry_block()->id(), entry->id())); + + // (strict) dominance checks + for (uint32_t id : {8, 9, 10, 11, 12}) + check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 8, 9); + check_dominance(dom_tree, fn, 8, 10); + check_dominance(dom_tree, fn, 8, 11); + check_dominance(dom_tree, fn, 8, 12); + + check_dominance(dom_tree, fn, 9, 10); + check_dominance(dom_tree, fn, 9, 11); + check_dominance(dom_tree, fn, 9, 12); + + check_dominance(dom_tree, fn, 11, 12); + + check_no_dominance(dom_tree, fn, 10, 11); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_entry_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(entry), cfg.pseudo_entry_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 9)), + spvtest::GetBasicBlock(fn, 8)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 10)), + spvtest::GetBasicBlock(fn, 9)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 9)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 11)); + } + + // Check post dominator tree + { + PostDominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_exit_block()); + EXPECT_TRUE(dom_tree.Dominates(cfg.pseudo_exit_block()->id(), 12)); + + // (strict) dominance checks + for (uint32_t id : {8, 9, 10, 11, 12}) + check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 12, 8); + check_dominance(dom_tree, fn, 12, 10); + check_dominance(dom_tree, fn, 12, 11); + check_dominance(dom_tree, fn, 12, 12); + + check_dominance(dom_tree, fn, 11, 8); + check_dominance(dom_tree, fn, 11, 9); + check_dominance(dom_tree, fn, 11, 10); + + check_dominance(dom_tree, fn, 9, 8); + + EXPECT_EQ(dom_tree.ImmediateDominator(entry), + spvtest::GetBasicBlock(fn, 9)); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 9)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 10)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 12)); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + cfg.pseudo_exit_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_exit_block()), nullptr); + } +} + +TEST_F(PassClassTest, DominatorLoopToSelf) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %1 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpTypeBool + %5 = OpTypeInt 32 0 + %6 = OpConstant %5 0 + %7 = OpConstantFalse %4 + %8 = OpConstantTrue %4 + %9 = OpConstant %5 1 + %1 = OpFunction %2 None %3 + %10 = OpLabel + OpBranch %11 + %11 = OpLabel + OpSwitch %6 %12 1 %11 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_0, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* fn = spvtest::GetFunction(module, 1); + + const BasicBlock* entry = spvtest::GetBasicBlock(fn, 10); + EXPECT_EQ(entry, fn->entry().get()) + << "The entry node is not the expected one"; + + // Check normal dominator tree + { + DominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE( + dom_tree.Dominates(cfg.pseudo_entry_block()->id(), entry->id())); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12}) check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 10, 11); + check_dominance(dom_tree, fn, 10, 12); + check_dominance(dom_tree, fn, 11, 12); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_entry_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(entry), cfg.pseudo_entry_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 10)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 11)); + + std::array node_order = {{10, 11, 12}}; + { + // Test dominator tree iteration order. + DominatorTree::iterator node_it = dom_tree.GetDomTree().begin(); + DominatorTree::iterator node_end = dom_tree.GetDomTree().end(); + for (uint32_t id : node_order) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + { + // Same as above, but with const iterators. + DominatorTree::const_iterator node_it = dom_tree.GetDomTree().cbegin(); + DominatorTree::const_iterator node_end = dom_tree.GetDomTree().cend(); + for (uint32_t id : node_order) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + { + // Test dominator tree iteration order. + DominatorTree::post_iterator node_it = dom_tree.GetDomTree().post_begin(); + DominatorTree::post_iterator node_end = dom_tree.GetDomTree().post_end(); + for (uint32_t id : make_range(node_order.rbegin(), node_order.rend())) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + { + // Same as above, but with const iterators. + DominatorTree::const_post_iterator node_it = + dom_tree.GetDomTree().post_cbegin(); + DominatorTree::const_post_iterator node_end = + dom_tree.GetDomTree().post_cend(); + for (uint32_t id : make_range(node_order.rbegin(), node_order.rend())) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + } + + // Check post dominator tree + { + PostDominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_exit_block()); + EXPECT_TRUE(dom_tree.Dominates(cfg.pseudo_exit_block()->id(), 12)); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12}) check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 12, 10); + check_dominance(dom_tree, fn, 12, 11); + check_dominance(dom_tree, fn, 12, 12); + + EXPECT_EQ(dom_tree.ImmediateDominator(entry), + spvtest::GetBasicBlock(fn, 11)); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 12)); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_exit_block()), nullptr); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + cfg.pseudo_exit_block()); + + std::array node_order = {{12, 11, 10}}; + { + // Test dominator tree iteration order. + DominatorTree::iterator node_it = tree.begin(); + DominatorTree::iterator node_end = tree.end(); + for (uint32_t id : node_order) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + { + // Same as above, but with const iterators. + DominatorTree::const_iterator node_it = tree.cbegin(); + DominatorTree::const_iterator node_end = tree.cend(); + for (uint32_t id : node_order) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + { + // Test dominator tree iteration order. + DominatorTree::post_iterator node_it = dom_tree.GetDomTree().post_begin(); + DominatorTree::post_iterator node_end = dom_tree.GetDomTree().post_end(); + for (uint32_t id : make_range(node_order.rbegin(), node_order.rend())) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + { + // Same as above, but with const iterators. + DominatorTree::const_post_iterator node_it = + dom_tree.GetDomTree().post_cbegin(); + DominatorTree::const_post_iterator node_end = + dom_tree.GetDomTree().post_cend(); + for (uint32_t id : make_range(node_order.rbegin(), node_order.rend())) { + EXPECT_NE(node_it, node_end); + EXPECT_EQ(node_it->id(), id); + node_it++; + } + EXPECT_EQ(node_it, node_end); + } + } +} + +TEST_F(PassClassTest, DominatorUnreachableInLoop) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %1 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpTypeBool + %5 = OpTypeInt 32 0 + %6 = OpConstant %5 0 + %7 = OpConstantFalse %4 + %8 = OpConstantTrue %4 + %9 = OpConstant %5 1 + %1 = OpFunction %2 None %3 + %10 = OpLabel + OpBranch %11 + %11 = OpLabel + OpSwitch %6 %12 1 %13 + %12 = OpLabel + OpBranch %14 + %13 = OpLabel + OpUnreachable + %14 = OpLabel + OpBranchConditional %8 %11 %15 + %15 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_0, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* fn = spvtest::GetFunction(module, 1); + + const BasicBlock* entry = spvtest::GetBasicBlock(fn, 10); + EXPECT_EQ(entry, fn->entry().get()) + << "The entry node is not the expected one"; + + // Check normal dominator tree + { + DominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE( + dom_tree.Dominates(cfg.pseudo_entry_block()->id(), entry->id())); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12, 13, 14, 15}) + check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 10, 11); + check_dominance(dom_tree, fn, 10, 13); + check_dominance(dom_tree, fn, 10, 12); + check_dominance(dom_tree, fn, 10, 14); + check_dominance(dom_tree, fn, 10, 15); + + check_dominance(dom_tree, fn, 11, 12); + check_dominance(dom_tree, fn, 11, 13); + check_dominance(dom_tree, fn, 11, 14); + check_dominance(dom_tree, fn, 11, 15); + + check_dominance(dom_tree, fn, 12, 14); + check_dominance(dom_tree, fn, 12, 15); + + check_dominance(dom_tree, fn, 14, 15); + + check_no_dominance(dom_tree, fn, 13, 12); + check_no_dominance(dom_tree, fn, 13, 14); + check_no_dominance(dom_tree, fn, 13, 15); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_entry_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(entry), cfg.pseudo_entry_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 10)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 13)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 14)), + spvtest::GetBasicBlock(fn, 12)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 15)), + spvtest::GetBasicBlock(fn, 14)); + } + + // Check post dominator tree. + { + PostDominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // (strict) dominance checks. + for (uint32_t id : {10, 11, 12, 13, 14, 15}) + check_dominance(dom_tree, fn, id, id); + + check_no_dominance(dom_tree, fn, 15, 10); + check_no_dominance(dom_tree, fn, 15, 11); + check_no_dominance(dom_tree, fn, 15, 12); + check_no_dominance(dom_tree, fn, 15, 13); + check_no_dominance(dom_tree, fn, 15, 14); + + check_dominance(dom_tree, fn, 14, 12); + + check_no_dominance(dom_tree, fn, 13, 10); + check_no_dominance(dom_tree, fn, 13, 11); + check_no_dominance(dom_tree, fn, 13, 12); + check_no_dominance(dom_tree, fn, 13, 14); + check_no_dominance(dom_tree, fn, 13, 15); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 10)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 14)); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_exit_block()), nullptr); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 15)), + cfg.pseudo_exit_block()); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 13)), + cfg.pseudo_exit_block()); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 14)), + cfg.pseudo_exit_block()); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + cfg.pseudo_exit_block()); + } +} + +TEST_F(PassClassTest, DominatorInfinitLoop) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %1 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpTypeBool + %5 = OpTypeInt 32 0 + %6 = OpConstant %5 0 + %7 = OpConstantFalse %4 + %8 = OpConstantTrue %4 + %9 = OpConstant %5 1 + %1 = OpFunction %2 None %3 + %10 = OpLabel + OpBranch %11 + %11 = OpLabel + OpSwitch %6 %12 1 %13 + %12 = OpLabel + OpReturn + %13 = OpLabel + OpBranch %13 + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_0, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* fn = spvtest::GetFunction(module, 1); + + const BasicBlock* entry = spvtest::GetBasicBlock(fn, 10); + EXPECT_EQ(entry, fn->entry().get()) + << "The entry node is not the expected one"; + // Check normal dominator tree + { + DominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE( + dom_tree.Dominates(cfg.pseudo_entry_block()->id(), entry->id())); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12, 13}) check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 10, 11); + check_dominance(dom_tree, fn, 10, 12); + check_dominance(dom_tree, fn, 10, 13); + + check_dominance(dom_tree, fn, 11, 12); + check_dominance(dom_tree, fn, 11, 13); + + check_no_dominance(dom_tree, fn, 13, 12); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_entry_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(entry), cfg.pseudo_entry_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 10)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + spvtest::GetBasicBlock(fn, 11)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 13)), + spvtest::GetBasicBlock(fn, 11)); + } + + // Check post dominator tree + { + PostDominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_exit_block()); + EXPECT_TRUE(dom_tree.Dominates(cfg.pseudo_exit_block()->id(), 12)); + + // (strict) dominance checks + for (uint32_t id : {10, 11, 12}) check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 12, 11); + check_dominance(dom_tree, fn, 12, 10); + + // 13 should be completely out of tree as it's unreachable from exit nodes + check_no_dominance(dom_tree, fn, 12, 13); + check_no_dominance(dom_tree, fn, 11, 13); + check_no_dominance(dom_tree, fn, 10, 13); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_exit_block()), nullptr); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 12)), + cfg.pseudo_exit_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 10)), + spvtest::GetBasicBlock(fn, 11)); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 11)), + spvtest::GetBasicBlock(fn, 12)); + } +} + +TEST_F(PassClassTest, DominatorUnreachableFromEntry) { + const std::string text = R"( + OpCapability Addresses + OpCapability Addresses + OpCapability Kernel + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %1 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpTypeBool + %5 = OpTypeInt 32 0 + %6 = OpConstantFalse %4 + %7 = OpConstantTrue %4 + %1 = OpFunction %2 None %3 + %8 = OpLabel + OpBranch %9 + %9 = OpLabel + OpReturn + %10 = OpLabel + OpBranch %9 + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_0, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* fn = spvtest::GetFunction(module, 1); + + const BasicBlock* entry = spvtest::GetBasicBlock(fn, 8); + EXPECT_EQ(entry, fn->entry().get()) + << "The entry node is not the expected one"; + + // Check dominator tree + { + DominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE( + dom_tree.Dominates(cfg.pseudo_entry_block()->id(), entry->id())); + + // (strict) dominance checks + for (uint32_t id : {8, 9}) check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 8, 9); + + check_no_dominance(dom_tree, fn, 10, 8); + check_no_dominance(dom_tree, fn, 10, 9); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_entry_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(entry), cfg.pseudo_entry_block()); + + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 9)), + spvtest::GetBasicBlock(fn, 8)); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 10)), + nullptr); + } + + // Check post dominator tree + { + PostDominatorAnalysis dom_tree; + const CFG& cfg = *context->cfg(); + dom_tree.InitializeTree(cfg, fn); + + // Inspect the actual tree + DominatorTree& tree = dom_tree.GetDomTree(); + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_exit_block()); + EXPECT_TRUE(dom_tree.Dominates(cfg.pseudo_exit_block()->id(), 9)); + + // (strict) dominance checks + for (uint32_t id : {8, 9, 10}) check_dominance(dom_tree, fn, id, id); + + check_dominance(dom_tree, fn, 9, 8); + check_dominance(dom_tree, fn, 9, 10); + + EXPECT_EQ(dom_tree.ImmediateDominator(entry), + spvtest::GetBasicBlock(fn, 9)); + + EXPECT_EQ(dom_tree.ImmediateDominator(cfg.pseudo_exit_block()), nullptr); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 9)), + cfg.pseudo_exit_block()); + EXPECT_EQ(dom_tree.ImmediateDominator(spvtest::GetBasicBlock(fn, 10)), + spvtest::GetBasicBlock(fn, 9)); + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp new file mode 100644 index 00000000000..0552b758018 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_ifs.cpp @@ -0,0 +1,153 @@ +// Copyright (c) 2017 Google 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. + + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 v; +void main(){ + if (true) { + if (true) { + v = vec4(1,1,1,1); + } else { + v = vec4(2,2,2,2); + } + } else { + if (true) { + v = vec4(3,3,3,3); + } else { + v = vec4(4,4,4,4); + } + } +} +*/ +TEST_F(PassClassTest, UnreachableNestedIfs) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 330 + OpName %4 "main" + OpName %15 "v" + OpDecorate %15 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpConstantTrue %6 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %15 = OpVariable %14 Output + %16 = OpConstant %12 1 + %17 = OpConstantComposite %13 %16 %16 %16 %16 + %19 = OpConstant %12 2 + %20 = OpConstantComposite %13 %19 %19 %19 %19 + %24 = OpConstant %12 3 + %25 = OpConstantComposite %13 %24 %24 %24 %24 + %27 = OpConstant %12 4 + %28 = OpConstantComposite %13 %27 %27 %27 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %7 %8 %21 + %8 = OpLabel + OpSelectionMerge %11 None + OpBranchConditional %7 %10 %18 + %10 = OpLabel + OpStore %15 %17 + OpBranch %11 + %18 = OpLabel + OpStore %15 %20 + OpBranch %11 + %11 = OpLabel + OpBranch %9 + %21 = OpLabel + OpSelectionMerge %23 None + OpBranchConditional %7 %22 %26 + %22 = OpLabel + OpStore %15 %25 + OpBranch %23 + %26 = OpLabel + OpStore %15 %28 + OpBranch %23 + %23 = OpLabel + OpBranch %9 + %9 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + + DominatorAnalysis* analysis = context->GetDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(5, 8)); + EXPECT_TRUE(analysis->Dominates(5, 9)); + EXPECT_TRUE(analysis->Dominates(5, 21)); + EXPECT_TRUE(analysis->Dominates(5, 18)); + EXPECT_TRUE(analysis->Dominates(5, 10)); + EXPECT_TRUE(analysis->Dominates(5, 11)); + EXPECT_TRUE(analysis->Dominates(5, 23)); + EXPECT_TRUE(analysis->Dominates(5, 22)); + EXPECT_TRUE(analysis->Dominates(5, 26)); + EXPECT_TRUE(analysis->Dominates(8, 18)); + EXPECT_TRUE(analysis->Dominates(8, 10)); + EXPECT_TRUE(analysis->Dominates(8, 11)); + EXPECT_TRUE(analysis->Dominates(21, 23)); + EXPECT_TRUE(analysis->Dominates(21, 22)); + EXPECT_TRUE(analysis->Dominates(21, 26)); + + EXPECT_TRUE(analysis->StrictlyDominates(5, 8)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 9)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 21)); + EXPECT_TRUE(analysis->StrictlyDominates(8, 18)); + EXPECT_TRUE(analysis->StrictlyDominates(8, 10)); + EXPECT_TRUE(analysis->StrictlyDominates(8, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(21, 23)); + EXPECT_TRUE(analysis->StrictlyDominates(21, 22)); + EXPECT_TRUE(analysis->StrictlyDominates(21, 26)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp new file mode 100644 index 00000000000..ad759df8683 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_ifs_post.cpp @@ -0,0 +1,156 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 v; +void main(){ + if (true) { + if (true) { + v = vec4(1,1,1,1); + } else { + v = vec4(2,2,2,2); + } + } else { + if (true) { + v = vec4(3,3,3,3); + } else { + v = vec4(4,4,4,4); + } + } +} +*/ +TEST_F(PassClassTest, UnreachableNestedIfs) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %15 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 330 + OpName %4 "main" + OpName %15 "v" + OpDecorate %15 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeBool + %7 = OpConstantTrue %6 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %15 = OpVariable %14 Output + %16 = OpConstant %12 1 + %17 = OpConstantComposite %13 %16 %16 %16 %16 + %19 = OpConstant %12 2 + %20 = OpConstantComposite %13 %19 %19 %19 %19 + %24 = OpConstant %12 3 + %25 = OpConstantComposite %13 %24 %24 %24 %24 + %27 = OpConstant %12 4 + %28 = OpConstantComposite %13 %27 %27 %27 %27 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %7 %8 %21 + %8 = OpLabel + OpSelectionMerge %11 None + OpBranchConditional %7 %10 %18 + %10 = OpLabel + OpStore %15 %17 + OpBranch %11 + %18 = OpLabel + OpStore %15 %20 + OpBranch %11 + %11 = OpLabel + OpBranch %9 + %21 = OpLabel + OpSelectionMerge %23 None + OpBranchConditional %7 %22 %26 + %22 = OpLabel + OpStore %15 %25 + OpBranch %23 + %26 = OpLabel + OpStore %15 %28 + OpBranch %23 + %23 = OpLabel + OpBranch %9 + %9 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + + PostDominatorAnalysis* analysis = context->GetPostDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(5, 5)); + EXPECT_TRUE(analysis->Dominates(8, 8)); + EXPECT_TRUE(analysis->Dominates(9, 9)); + EXPECT_TRUE(analysis->Dominates(10, 10)); + EXPECT_TRUE(analysis->Dominates(11, 11)); + EXPECT_TRUE(analysis->Dominates(18, 18)); + EXPECT_TRUE(analysis->Dominates(21, 21)); + EXPECT_TRUE(analysis->Dominates(22, 22)); + EXPECT_TRUE(analysis->Dominates(23, 23)); + EXPECT_TRUE(analysis->Dominates(26, 26)); + EXPECT_TRUE(analysis->Dominates(9, 5)); + EXPECT_TRUE(analysis->Dominates(9, 11)); + EXPECT_TRUE(analysis->Dominates(9, 23)); + EXPECT_TRUE(analysis->Dominates(11, 10)); + EXPECT_TRUE(analysis->Dominates(11, 18)); + EXPECT_TRUE(analysis->Dominates(11, 8)); + EXPECT_TRUE(analysis->Dominates(23, 22)); + EXPECT_TRUE(analysis->Dominates(23, 26)); + EXPECT_TRUE(analysis->Dominates(23, 21)); + + EXPECT_TRUE(analysis->StrictlyDominates(9, 5)); + EXPECT_TRUE(analysis->StrictlyDominates(9, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(9, 23)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 10)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 18)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 8)); + EXPECT_TRUE(analysis->StrictlyDominates(23, 22)); + EXPECT_TRUE(analysis->StrictlyDominates(23, 26)); + EXPECT_TRUE(analysis->StrictlyDominates(23, 21)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_loops.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_loops.cpp new file mode 100644 index 00000000000..7d03937b1af --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_loops.cpp @@ -0,0 +1,433 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 440 core +layout(location = 0) out vec4 v; +layout(location = 1) in vec4 in_val; +void main() { + for (int i = 0; i < in_val.x; ++i) { + for (int j = 0; j < in_val.y; j++) { + } + } + for (int i = 0; i < in_val.x; ++i) { + for (int j = 0; j < in_val.y; j++) { + } + if (in_val.z == in_val.w) { + break; + } + } + int i = 0; + while (i < in_val.x) { + ++i; + for (int j = 0; j < 1; j++) { + for (int k = 0; k < 1; k++) { + } + } + } + i = 0; + while (i < in_val.x) { + ++i; + if (in_val.z == in_val.w) { + continue; + } + for (int j = 0; j < 1; j++) { + for (int k = 0; k < 1; k++) { + } + if (in_val.z == in_val.w) { + break; + } + } + } + v = vec4(1,1,1,1); +} +*/ +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 %163 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %20 "in_val" + OpName %28 "j" + OpName %45 "i" + OpName %56 "j" + OpName %81 "i" + OpName %94 "j" + OpName %102 "k" + OpName %134 "j" + OpName %142 "k" + OpName %163 "v" + OpDecorate %20 Location 1 + OpDecorate %163 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpTypeFloat 32 + %18 = OpTypeVector %16 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %16 + %26 = OpTypeBool + %36 = OpConstant %21 1 + %41 = OpConstant %6 1 + %69 = OpConstant %21 2 + %72 = OpConstant %21 3 + %162 = OpTypePointer Output %18 + %163 = OpVariable %162 Output + %164 = OpConstant %16 1 + %165 = OpConstantComposite %18 %164 %164 %164 %164 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %28 = OpVariable %7 Function + %45 = OpVariable %7 Function + %56 = OpVariable %7 Function + %81 = OpVariable %7 Function + %94 = OpVariable %7 Function + %102 = OpVariable %7 Function + %134 = OpVariable %7 Function + %142 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %17 = OpConvertSToF %16 %15 + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %16 %24 + %27 = OpFOrdLessThan %26 %17 %25 + OpBranchConditional %27 %11 %12 + %11 = OpLabel + OpStore %28 %9 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %6 %28 + %35 = OpConvertSToF %16 %34 + %37 = OpAccessChain %23 %20 %36 + %38 = OpLoad %16 %37 + %39 = OpFOrdLessThan %26 %35 %38 + OpBranchConditional %39 %30 %31 + %30 = OpLabel + OpBranch %32 + %32 = OpLabel + %40 = OpLoad %6 %28 + %42 = OpIAdd %6 %40 %41 + OpStore %28 %42 + OpBranch %29 + %31 = OpLabel + OpBranch %13 + %13 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpIAdd %6 %43 %41 + OpStore %8 %44 + OpBranch %10 + %12 = OpLabel + OpStore %45 %9 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %45 + %52 = OpConvertSToF %16 %51 + %53 = OpAccessChain %23 %20 %22 + %54 = OpLoad %16 %53 + %55 = OpFOrdLessThan %26 %52 %54 + OpBranchConditional %55 %47 %48 + %47 = OpLabel + OpStore %56 %9 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %6 %56 + %63 = OpConvertSToF %16 %62 + %64 = OpAccessChain %23 %20 %36 + %65 = OpLoad %16 %64 + %66 = OpFOrdLessThan %26 %63 %65 + OpBranchConditional %66 %58 %59 + %58 = OpLabel + OpBranch %60 + %60 = OpLabel + %67 = OpLoad %6 %56 + %68 = OpIAdd %6 %67 %41 + OpStore %56 %68 + OpBranch %57 + %59 = OpLabel + %70 = OpAccessChain %23 %20 %69 + %71 = OpLoad %16 %70 + %73 = OpAccessChain %23 %20 %72 + %74 = OpLoad %16 %73 + %75 = OpFOrdEqual %26 %71 %74 + OpSelectionMerge %77 None + OpBranchConditional %75 %76 %77 + %76 = OpLabel + OpBranch %48 + %77 = OpLabel + OpBranch %49 + %49 = OpLabel + %79 = OpLoad %6 %45 + %80 = OpIAdd %6 %79 %41 + OpStore %45 %80 + OpBranch %46 + %48 = OpLabel + OpStore %81 %9 + OpBranch %82 + %82 = OpLabel + OpLoopMerge %84 %85 None + OpBranch %86 + %86 = OpLabel + %87 = OpLoad %6 %81 + %88 = OpConvertSToF %16 %87 + %89 = OpAccessChain %23 %20 %22 + %90 = OpLoad %16 %89 + %91 = OpFOrdLessThan %26 %88 %90 + OpBranchConditional %91 %83 %84 + %83 = OpLabel + %92 = OpLoad %6 %81 + %93 = OpIAdd %6 %92 %41 + OpStore %81 %93 + OpStore %94 %9 + OpBranch %95 + %95 = OpLabel + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %100 = OpLoad %6 %94 + %101 = OpSLessThan %26 %100 %41 + OpBranchConditional %101 %96 %97 + %96 = OpLabel + OpStore %102 %9 + OpBranch %103 + %103 = OpLabel + OpLoopMerge %105 %106 None + OpBranch %107 + %107 = OpLabel + %108 = OpLoad %6 %102 + %109 = OpSLessThan %26 %108 %41 + OpBranchConditional %109 %104 %105 + %104 = OpLabel + OpBranch %106 + %106 = OpLabel + %110 = OpLoad %6 %102 + %111 = OpIAdd %6 %110 %41 + OpStore %102 %111 + OpBranch %103 + %105 = OpLabel + OpBranch %98 + %98 = OpLabel + %112 = OpLoad %6 %94 + %113 = OpIAdd %6 %112 %41 + OpStore %94 %113 + OpBranch %95 + %97 = OpLabel + OpBranch %85 + %85 = OpLabel + OpBranch %82 + %84 = OpLabel + OpStore %81 %9 + OpBranch %114 + %114 = OpLabel + OpLoopMerge %116 %117 None + OpBranch %118 + %118 = OpLabel + %119 = OpLoad %6 %81 + %120 = OpConvertSToF %16 %119 + %121 = OpAccessChain %23 %20 %22 + %122 = OpLoad %16 %121 + %123 = OpFOrdLessThan %26 %120 %122 + OpBranchConditional %123 %115 %116 + %115 = OpLabel + %124 = OpLoad %6 %81 + %125 = OpIAdd %6 %124 %41 + OpStore %81 %125 + %126 = OpAccessChain %23 %20 %69 + %127 = OpLoad %16 %126 + %128 = OpAccessChain %23 %20 %72 + %129 = OpLoad %16 %128 + %130 = OpFOrdEqual %26 %127 %129 + OpSelectionMerge %132 None + OpBranchConditional %130 %131 %132 + %131 = OpLabel + OpBranch %117 + %132 = OpLabel + OpStore %134 %9 + OpBranch %135 + %135 = OpLabel + OpLoopMerge %137 %138 None + OpBranch %139 + %139 = OpLabel + %140 = OpLoad %6 %134 + %141 = OpSLessThan %26 %140 %41 + OpBranchConditional %141 %136 %137 + %136 = OpLabel + OpStore %142 %9 + OpBranch %143 + %143 = OpLabel + OpLoopMerge %145 %146 None + OpBranch %147 + %147 = OpLabel + %148 = OpLoad %6 %142 + %149 = OpSLessThan %26 %148 %41 + OpBranchConditional %149 %144 %145 + %144 = OpLabel + OpBranch %146 + %146 = OpLabel + %150 = OpLoad %6 %142 + %151 = OpIAdd %6 %150 %41 + OpStore %142 %151 + OpBranch %143 + %145 = OpLabel + %152 = OpAccessChain %23 %20 %69 + %153 = OpLoad %16 %152 + %154 = OpAccessChain %23 %20 %72 + %155 = OpLoad %16 %154 + %156 = OpFOrdEqual %26 %153 %155 + OpSelectionMerge %158 None + OpBranchConditional %156 %157 %158 + %157 = OpLabel + OpBranch %137 + %158 = OpLabel + OpBranch %138 + %138 = OpLabel + %160 = OpLoad %6 %134 + %161 = OpIAdd %6 %160 %41 + OpStore %134 %161 + OpBranch %135 + %137 = OpLabel + OpBranch %117 + %117 = OpLabel + OpBranch %114 + %116 = OpLabel + OpStore %163 %165 + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + DominatorAnalysis* analysis = context->GetDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(5, 10)); + EXPECT_TRUE(analysis->Dominates(5, 46)); + EXPECT_TRUE(analysis->Dominates(5, 82)); + EXPECT_TRUE(analysis->Dominates(5, 114)); + EXPECT_TRUE(analysis->Dominates(5, 116)); + + EXPECT_TRUE(analysis->Dominates(10, 14)); + EXPECT_TRUE(analysis->Dominates(10, 11)); + EXPECT_TRUE(analysis->Dominates(10, 29)); + EXPECT_TRUE(analysis->Dominates(10, 33)); + EXPECT_TRUE(analysis->Dominates(10, 30)); + EXPECT_TRUE(analysis->Dominates(10, 32)); + EXPECT_TRUE(analysis->Dominates(10, 31)); + EXPECT_TRUE(analysis->Dominates(10, 13)); + EXPECT_TRUE(analysis->Dominates(10, 12)); + + EXPECT_TRUE(analysis->Dominates(12, 46)); + + EXPECT_TRUE(analysis->Dominates(46, 50)); + EXPECT_TRUE(analysis->Dominates(46, 47)); + EXPECT_TRUE(analysis->Dominates(46, 57)); + EXPECT_TRUE(analysis->Dominates(46, 61)); + EXPECT_TRUE(analysis->Dominates(46, 58)); + EXPECT_TRUE(analysis->Dominates(46, 60)); + EXPECT_TRUE(analysis->Dominates(46, 59)); + EXPECT_TRUE(analysis->Dominates(46, 77)); + EXPECT_TRUE(analysis->Dominates(46, 49)); + EXPECT_TRUE(analysis->Dominates(46, 76)); + EXPECT_TRUE(analysis->Dominates(46, 48)); + + EXPECT_TRUE(analysis->Dominates(48, 82)); + + EXPECT_TRUE(analysis->Dominates(82, 86)); + EXPECT_TRUE(analysis->Dominates(82, 83)); + EXPECT_TRUE(analysis->Dominates(82, 95)); + EXPECT_TRUE(analysis->Dominates(82, 99)); + EXPECT_TRUE(analysis->Dominates(82, 96)); + EXPECT_TRUE(analysis->Dominates(82, 103)); + EXPECT_TRUE(analysis->Dominates(82, 107)); + EXPECT_TRUE(analysis->Dominates(82, 104)); + EXPECT_TRUE(analysis->Dominates(82, 106)); + EXPECT_TRUE(analysis->Dominates(82, 105)); + EXPECT_TRUE(analysis->Dominates(82, 98)); + EXPECT_TRUE(analysis->Dominates(82, 97)); + EXPECT_TRUE(analysis->Dominates(82, 85)); + EXPECT_TRUE(analysis->Dominates(82, 84)); + + EXPECT_TRUE(analysis->Dominates(84, 114)); + + EXPECT_TRUE(analysis->Dominates(114, 118)); + EXPECT_TRUE(analysis->Dominates(114, 116)); + EXPECT_TRUE(analysis->Dominates(114, 115)); + EXPECT_TRUE(analysis->Dominates(114, 132)); + EXPECT_TRUE(analysis->Dominates(114, 135)); + EXPECT_TRUE(analysis->Dominates(114, 139)); + EXPECT_TRUE(analysis->Dominates(114, 136)); + EXPECT_TRUE(analysis->Dominates(114, 143)); + EXPECT_TRUE(analysis->Dominates(114, 147)); + EXPECT_TRUE(analysis->Dominates(114, 144)); + EXPECT_TRUE(analysis->Dominates(114, 146)); + EXPECT_TRUE(analysis->Dominates(114, 145)); + EXPECT_TRUE(analysis->Dominates(114, 158)); + EXPECT_TRUE(analysis->Dominates(114, 138)); + EXPECT_TRUE(analysis->Dominates(114, 137)); + EXPECT_TRUE(analysis->Dominates(114, 131)); + EXPECT_TRUE(analysis->Dominates(114, 117)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp new file mode 100644 index 00000000000..e87e8ddab3d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/nested_loops_with_unreachables.cpp @@ -0,0 +1,848 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; + +using PassClassTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL +#version 440 core +layout(location = 0) out vec4 v; +layout(location = 1) in vec4 in_val; +void main() { + for (int i = 0; i < in_val.x; ++i) { + for (int j = 0; j < in_val.y; j++) { + } + } + for (int i = 0; i < in_val.x; ++i) { + for (int j = 0; j < in_val.y; j++) { + } + break; + } + int i = 0; + while (i < in_val.x) { + ++i; + for (int j = 0; j < 1; j++) { + for (int k = 0; k < 1; k++) { + } + break; + } + } + i = 0; + while (i < in_val.x) { + ++i; + continue; + for (int j = 0; j < 1; j++) { + for (int k = 0; k < 1; k++) { + } + break; + } + } + v = vec4(1,1,1,1); +} +*/ +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 %141 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %20 "in_val" + OpName %28 "j" + OpName %45 "i" + OpName %56 "j" + OpName %72 "i" + OpName %85 "j" + OpName %93 "k" + OpName %119 "j" + OpName %127 "k" + OpName %141 "v" + OpDecorate %20 Location 1 + OpDecorate %141 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpTypeFloat 32 + %18 = OpTypeVector %16 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %16 + %26 = OpTypeBool + %36 = OpConstant %21 1 + %41 = OpConstant %6 1 + %140 = OpTypePointer Output %18 + %141 = OpVariable %140 Output + %142 = OpConstant %16 1 + %143 = OpConstantComposite %18 %142 %142 %142 %142 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %28 = OpVariable %7 Function + %45 = OpVariable %7 Function + %56 = OpVariable %7 Function + %72 = OpVariable %7 Function + %85 = OpVariable %7 Function + %93 = OpVariable %7 Function + %119 = OpVariable %7 Function + %127 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %17 = OpConvertSToF %16 %15 + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %16 %24 + %27 = OpFOrdLessThan %26 %17 %25 + OpBranchConditional %27 %11 %12 + %11 = OpLabel + OpStore %28 %9 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %6 %28 + %35 = OpConvertSToF %16 %34 + %37 = OpAccessChain %23 %20 %36 + %38 = OpLoad %16 %37 + %39 = OpFOrdLessThan %26 %35 %38 + OpBranchConditional %39 %30 %31 + %30 = OpLabel + OpBranch %32 + %32 = OpLabel + %40 = OpLoad %6 %28 + %42 = OpIAdd %6 %40 %41 + OpStore %28 %42 + OpBranch %29 + %31 = OpLabel + OpBranch %13 + %13 = OpLabel + %43 = OpLoad %6 %8 + %44 = OpIAdd %6 %43 %41 + OpStore %8 %44 + OpBranch %10 + %12 = OpLabel + OpStore %45 %9 + OpBranch %46 + %46 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %6 %45 + %52 = OpConvertSToF %16 %51 + %53 = OpAccessChain %23 %20 %22 + %54 = OpLoad %16 %53 + %55 = OpFOrdLessThan %26 %52 %54 + OpBranchConditional %55 %47 %48 + %47 = OpLabel + OpStore %56 %9 + OpBranch %57 + %57 = OpLabel + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %62 = OpLoad %6 %56 + %63 = OpConvertSToF %16 %62 + %64 = OpAccessChain %23 %20 %36 + %65 = OpLoad %16 %64 + %66 = OpFOrdLessThan %26 %63 %65 + OpBranchConditional %66 %58 %59 + %58 = OpLabel + OpBranch %60 + %60 = OpLabel + %67 = OpLoad %6 %56 + %68 = OpIAdd %6 %67 %41 + OpStore %56 %68 + OpBranch %57 + %59 = OpLabel + OpBranch %48 + %49 = OpLabel + %70 = OpLoad %6 %45 + %71 = OpIAdd %6 %70 %41 + OpStore %45 %71 + OpBranch %46 + %48 = OpLabel + OpStore %72 %9 + OpBranch %73 + %73 = OpLabel + OpLoopMerge %75 %76 None + OpBranch %77 + %77 = OpLabel + %78 = OpLoad %6 %72 + %79 = OpConvertSToF %16 %78 + %80 = OpAccessChain %23 %20 %22 + %81 = OpLoad %16 %80 + %82 = OpFOrdLessThan %26 %79 %81 + OpBranchConditional %82 %74 %75 + %74 = OpLabel + %83 = OpLoad %6 %72 + %84 = OpIAdd %6 %83 %41 + OpStore %72 %84 + OpStore %85 %9 + OpBranch %86 + %86 = OpLabel + OpLoopMerge %88 %89 None + OpBranch %90 + %90 = OpLabel + %91 = OpLoad %6 %85 + %92 = OpSLessThan %26 %91 %41 + OpBranchConditional %92 %87 %88 + %87 = OpLabel + OpStore %93 %9 + OpBranch %94 + %94 = OpLabel + OpLoopMerge %96 %97 None + OpBranch %98 + %98 = OpLabel + %99 = OpLoad %6 %93 + %100 = OpSLessThan %26 %99 %41 + OpBranchConditional %100 %95 %96 + %95 = OpLabel + OpBranch %97 + %97 = OpLabel + %101 = OpLoad %6 %93 + %102 = OpIAdd %6 %101 %41 + OpStore %93 %102 + OpBranch %94 + %96 = OpLabel + OpBranch %88 + %89 = OpLabel + %104 = OpLoad %6 %85 + %105 = OpIAdd %6 %104 %41 + OpStore %85 %105 + OpBranch %86 + %88 = OpLabel + OpBranch %76 + %76 = OpLabel + OpBranch %73 + %75 = OpLabel + OpStore %72 %9 + OpBranch %106 + %106 = OpLabel + OpLoopMerge %108 %109 None + OpBranch %110 + %110 = OpLabel + %111 = OpLoad %6 %72 + %112 = OpConvertSToF %16 %111 + %113 = OpAccessChain %23 %20 %22 + %114 = OpLoad %16 %113 + %115 = OpFOrdLessThan %26 %112 %114 + OpBranchConditional %115 %107 %108 + %107 = OpLabel + %116 = OpLoad %6 %72 + %117 = OpIAdd %6 %116 %41 + OpStore %72 %117 + OpBranch %109 + %109 = OpLabel + OpBranch %106 + %108 = OpLabel + OpStore %141 %143 + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + DominatorAnalysis* analysis = context->GetDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(5, 10)); + EXPECT_TRUE(analysis->Dominates(5, 14)); + EXPECT_TRUE(analysis->Dominates(5, 11)); + EXPECT_TRUE(analysis->Dominates(5, 29)); + EXPECT_TRUE(analysis->Dominates(5, 33)); + EXPECT_TRUE(analysis->Dominates(5, 30)); + EXPECT_TRUE(analysis->Dominates(5, 32)); + EXPECT_TRUE(analysis->Dominates(5, 31)); + EXPECT_TRUE(analysis->Dominates(5, 13)); + EXPECT_TRUE(analysis->Dominates(5, 12)); + EXPECT_TRUE(analysis->Dominates(5, 46)); + EXPECT_TRUE(analysis->Dominates(5, 50)); + EXPECT_TRUE(analysis->Dominates(5, 47)); + EXPECT_TRUE(analysis->Dominates(5, 57)); + EXPECT_TRUE(analysis->Dominates(5, 61)); + EXPECT_TRUE(analysis->Dominates(5, 59)); + EXPECT_TRUE(analysis->Dominates(5, 58)); + EXPECT_TRUE(analysis->Dominates(5, 60)); + EXPECT_TRUE(analysis->Dominates(5, 48)); + EXPECT_TRUE(analysis->Dominates(5, 73)); + EXPECT_TRUE(analysis->Dominates(5, 77)); + EXPECT_TRUE(analysis->Dominates(5, 75)); + EXPECT_TRUE(analysis->Dominates(5, 106)); + EXPECT_TRUE(analysis->Dominates(5, 110)); + EXPECT_TRUE(analysis->Dominates(5, 107)); + EXPECT_TRUE(analysis->Dominates(5, 108)); + EXPECT_TRUE(analysis->Dominates(5, 109)); + EXPECT_TRUE(analysis->Dominates(5, 74)); + EXPECT_TRUE(analysis->Dominates(5, 86)); + EXPECT_TRUE(analysis->Dominates(5, 90)); + EXPECT_TRUE(analysis->Dominates(5, 87)); + EXPECT_TRUE(analysis->Dominates(5, 94)); + EXPECT_TRUE(analysis->Dominates(5, 98)); + EXPECT_TRUE(analysis->Dominates(5, 95)); + EXPECT_TRUE(analysis->Dominates(5, 97)); + EXPECT_TRUE(analysis->Dominates(5, 96)); + EXPECT_TRUE(analysis->Dominates(5, 88)); + EXPECT_TRUE(analysis->Dominates(5, 76)); + + EXPECT_TRUE(analysis->Dominates(10, 14)); + EXPECT_TRUE(analysis->Dominates(10, 11)); + EXPECT_TRUE(analysis->Dominates(10, 29)); + EXPECT_TRUE(analysis->Dominates(10, 33)); + EXPECT_TRUE(analysis->Dominates(10, 30)); + EXPECT_TRUE(analysis->Dominates(10, 32)); + EXPECT_TRUE(analysis->Dominates(10, 31)); + EXPECT_TRUE(analysis->Dominates(10, 13)); + EXPECT_TRUE(analysis->Dominates(10, 12)); + EXPECT_TRUE(analysis->Dominates(10, 46)); + EXPECT_TRUE(analysis->Dominates(10, 50)); + EXPECT_TRUE(analysis->Dominates(10, 47)); + EXPECT_TRUE(analysis->Dominates(10, 57)); + EXPECT_TRUE(analysis->Dominates(10, 61)); + EXPECT_TRUE(analysis->Dominates(10, 59)); + EXPECT_TRUE(analysis->Dominates(10, 58)); + EXPECT_TRUE(analysis->Dominates(10, 60)); + EXPECT_TRUE(analysis->Dominates(10, 48)); + EXPECT_TRUE(analysis->Dominates(10, 73)); + EXPECT_TRUE(analysis->Dominates(10, 77)); + EXPECT_TRUE(analysis->Dominates(10, 75)); + EXPECT_TRUE(analysis->Dominates(10, 106)); + EXPECT_TRUE(analysis->Dominates(10, 110)); + EXPECT_TRUE(analysis->Dominates(10, 107)); + EXPECT_TRUE(analysis->Dominates(10, 108)); + EXPECT_TRUE(analysis->Dominates(10, 109)); + EXPECT_TRUE(analysis->Dominates(10, 74)); + EXPECT_TRUE(analysis->Dominates(10, 86)); + EXPECT_TRUE(analysis->Dominates(10, 90)); + EXPECT_TRUE(analysis->Dominates(10, 87)); + EXPECT_TRUE(analysis->Dominates(10, 94)); + EXPECT_TRUE(analysis->Dominates(10, 98)); + EXPECT_TRUE(analysis->Dominates(10, 95)); + EXPECT_TRUE(analysis->Dominates(10, 97)); + EXPECT_TRUE(analysis->Dominates(10, 96)); + EXPECT_TRUE(analysis->Dominates(10, 88)); + EXPECT_TRUE(analysis->Dominates(10, 76)); + + EXPECT_TRUE(analysis->Dominates(14, 11)); + EXPECT_TRUE(analysis->Dominates(14, 29)); + EXPECT_TRUE(analysis->Dominates(14, 33)); + EXPECT_TRUE(analysis->Dominates(14, 30)); + EXPECT_TRUE(analysis->Dominates(14, 32)); + EXPECT_TRUE(analysis->Dominates(14, 31)); + + EXPECT_TRUE(analysis->Dominates(11, 29)); + EXPECT_TRUE(analysis->Dominates(11, 33)); + EXPECT_TRUE(analysis->Dominates(11, 30)); + EXPECT_TRUE(analysis->Dominates(11, 32)); + EXPECT_TRUE(analysis->Dominates(11, 31)); + + EXPECT_TRUE(analysis->Dominates(29, 33)); + EXPECT_TRUE(analysis->Dominates(29, 30)); + EXPECT_TRUE(analysis->Dominates(29, 32)); + EXPECT_TRUE(analysis->Dominates(29, 31)); + + EXPECT_TRUE(analysis->Dominates(33, 30)); + + EXPECT_TRUE(analysis->Dominates(12, 46)); + EXPECT_TRUE(analysis->Dominates(12, 50)); + EXPECT_TRUE(analysis->Dominates(12, 47)); + EXPECT_TRUE(analysis->Dominates(12, 57)); + EXPECT_TRUE(analysis->Dominates(12, 61)); + EXPECT_TRUE(analysis->Dominates(12, 59)); + EXPECT_TRUE(analysis->Dominates(12, 58)); + EXPECT_TRUE(analysis->Dominates(12, 60)); + EXPECT_TRUE(analysis->Dominates(12, 48)); + EXPECT_TRUE(analysis->Dominates(12, 73)); + EXPECT_TRUE(analysis->Dominates(12, 77)); + EXPECT_TRUE(analysis->Dominates(12, 75)); + EXPECT_TRUE(analysis->Dominates(12, 106)); + EXPECT_TRUE(analysis->Dominates(12, 110)); + EXPECT_TRUE(analysis->Dominates(12, 107)); + EXPECT_TRUE(analysis->Dominates(12, 108)); + EXPECT_TRUE(analysis->Dominates(12, 109)); + EXPECT_TRUE(analysis->Dominates(12, 74)); + EXPECT_TRUE(analysis->Dominates(12, 86)); + EXPECT_TRUE(analysis->Dominates(12, 90)); + EXPECT_TRUE(analysis->Dominates(12, 87)); + EXPECT_TRUE(analysis->Dominates(12, 94)); + EXPECT_TRUE(analysis->Dominates(12, 98)); + EXPECT_TRUE(analysis->Dominates(12, 95)); + EXPECT_TRUE(analysis->Dominates(12, 97)); + EXPECT_TRUE(analysis->Dominates(12, 96)); + EXPECT_TRUE(analysis->Dominates(12, 88)); + EXPECT_TRUE(analysis->Dominates(12, 76)); + + EXPECT_TRUE(analysis->Dominates(46, 50)); + EXPECT_TRUE(analysis->Dominates(46, 47)); + EXPECT_TRUE(analysis->Dominates(46, 57)); + EXPECT_TRUE(analysis->Dominates(46, 61)); + EXPECT_TRUE(analysis->Dominates(46, 59)); + EXPECT_TRUE(analysis->Dominates(46, 58)); + EXPECT_TRUE(analysis->Dominates(46, 60)); + EXPECT_TRUE(analysis->Dominates(46, 48)); + EXPECT_TRUE(analysis->Dominates(46, 73)); + EXPECT_TRUE(analysis->Dominates(46, 77)); + EXPECT_TRUE(analysis->Dominates(46, 75)); + EXPECT_TRUE(analysis->Dominates(46, 106)); + EXPECT_TRUE(analysis->Dominates(46, 110)); + EXPECT_TRUE(analysis->Dominates(46, 107)); + EXPECT_TRUE(analysis->Dominates(46, 108)); + EXPECT_TRUE(analysis->Dominates(46, 109)); + EXPECT_TRUE(analysis->Dominates(46, 74)); + EXPECT_TRUE(analysis->Dominates(46, 86)); + EXPECT_TRUE(analysis->Dominates(46, 90)); + EXPECT_TRUE(analysis->Dominates(46, 87)); + EXPECT_TRUE(analysis->Dominates(46, 94)); + EXPECT_TRUE(analysis->Dominates(46, 98)); + EXPECT_TRUE(analysis->Dominates(46, 95)); + EXPECT_TRUE(analysis->Dominates(46, 97)); + EXPECT_TRUE(analysis->Dominates(46, 96)); + EXPECT_TRUE(analysis->Dominates(46, 88)); + EXPECT_TRUE(analysis->Dominates(46, 76)); + + EXPECT_TRUE(analysis->Dominates(50, 47)); + EXPECT_TRUE(analysis->Dominates(50, 57)); + EXPECT_TRUE(analysis->Dominates(50, 61)); + EXPECT_TRUE(analysis->Dominates(50, 59)); + EXPECT_TRUE(analysis->Dominates(50, 58)); + EXPECT_TRUE(analysis->Dominates(50, 60)); + + EXPECT_TRUE(analysis->Dominates(47, 57)); + EXPECT_TRUE(analysis->Dominates(47, 61)); + EXPECT_TRUE(analysis->Dominates(47, 59)); + EXPECT_TRUE(analysis->Dominates(47, 58)); + EXPECT_TRUE(analysis->Dominates(47, 60)); + + EXPECT_TRUE(analysis->Dominates(57, 61)); + EXPECT_TRUE(analysis->Dominates(57, 59)); + EXPECT_TRUE(analysis->Dominates(57, 58)); + EXPECT_TRUE(analysis->Dominates(57, 60)); + + EXPECT_TRUE(analysis->Dominates(61, 59)); + + EXPECT_TRUE(analysis->Dominates(48, 73)); + EXPECT_TRUE(analysis->Dominates(48, 77)); + EXPECT_TRUE(analysis->Dominates(48, 75)); + EXPECT_TRUE(analysis->Dominates(48, 106)); + EXPECT_TRUE(analysis->Dominates(48, 110)); + EXPECT_TRUE(analysis->Dominates(48, 107)); + EXPECT_TRUE(analysis->Dominates(48, 108)); + EXPECT_TRUE(analysis->Dominates(48, 109)); + EXPECT_TRUE(analysis->Dominates(48, 74)); + EXPECT_TRUE(analysis->Dominates(48, 86)); + EXPECT_TRUE(analysis->Dominates(48, 90)); + EXPECT_TRUE(analysis->Dominates(48, 87)); + EXPECT_TRUE(analysis->Dominates(48, 94)); + EXPECT_TRUE(analysis->Dominates(48, 98)); + EXPECT_TRUE(analysis->Dominates(48, 95)); + EXPECT_TRUE(analysis->Dominates(48, 97)); + EXPECT_TRUE(analysis->Dominates(48, 96)); + EXPECT_TRUE(analysis->Dominates(48, 88)); + EXPECT_TRUE(analysis->Dominates(48, 76)); + + EXPECT_TRUE(analysis->Dominates(73, 77)); + EXPECT_TRUE(analysis->Dominates(73, 75)); + EXPECT_TRUE(analysis->Dominates(73, 106)); + EXPECT_TRUE(analysis->Dominates(73, 110)); + EXPECT_TRUE(analysis->Dominates(73, 107)); + EXPECT_TRUE(analysis->Dominates(73, 108)); + EXPECT_TRUE(analysis->Dominates(73, 109)); + EXPECT_TRUE(analysis->Dominates(73, 74)); + EXPECT_TRUE(analysis->Dominates(73, 86)); + EXPECT_TRUE(analysis->Dominates(73, 90)); + EXPECT_TRUE(analysis->Dominates(73, 87)); + EXPECT_TRUE(analysis->Dominates(73, 94)); + EXPECT_TRUE(analysis->Dominates(73, 98)); + EXPECT_TRUE(analysis->Dominates(73, 95)); + EXPECT_TRUE(analysis->Dominates(73, 97)); + EXPECT_TRUE(analysis->Dominates(73, 96)); + EXPECT_TRUE(analysis->Dominates(73, 88)); + EXPECT_TRUE(analysis->Dominates(73, 76)); + + EXPECT_TRUE(analysis->Dominates(75, 106)); + EXPECT_TRUE(analysis->Dominates(75, 110)); + EXPECT_TRUE(analysis->Dominates(75, 107)); + EXPECT_TRUE(analysis->Dominates(75, 108)); + EXPECT_TRUE(analysis->Dominates(75, 109)); + + EXPECT_TRUE(analysis->Dominates(106, 110)); + EXPECT_TRUE(analysis->Dominates(106, 107)); + EXPECT_TRUE(analysis->Dominates(106, 108)); + EXPECT_TRUE(analysis->Dominates(106, 109)); + + EXPECT_TRUE(analysis->Dominates(110, 107)); + + EXPECT_TRUE(analysis->Dominates(77, 74)); + EXPECT_TRUE(analysis->Dominates(77, 86)); + EXPECT_TRUE(analysis->Dominates(77, 90)); + EXPECT_TRUE(analysis->Dominates(77, 87)); + EXPECT_TRUE(analysis->Dominates(77, 94)); + EXPECT_TRUE(analysis->Dominates(77, 98)); + EXPECT_TRUE(analysis->Dominates(77, 95)); + EXPECT_TRUE(analysis->Dominates(77, 97)); + EXPECT_TRUE(analysis->Dominates(77, 96)); + EXPECT_TRUE(analysis->Dominates(77, 88)); + + EXPECT_TRUE(analysis->Dominates(74, 86)); + EXPECT_TRUE(analysis->Dominates(74, 90)); + EXPECT_TRUE(analysis->Dominates(74, 87)); + EXPECT_TRUE(analysis->Dominates(74, 94)); + EXPECT_TRUE(analysis->Dominates(74, 98)); + EXPECT_TRUE(analysis->Dominates(74, 95)); + EXPECT_TRUE(analysis->Dominates(74, 97)); + EXPECT_TRUE(analysis->Dominates(74, 96)); + EXPECT_TRUE(analysis->Dominates(74, 88)); + + EXPECT_TRUE(analysis->Dominates(86, 90)); + EXPECT_TRUE(analysis->Dominates(86, 87)); + EXPECT_TRUE(analysis->Dominates(86, 94)); + EXPECT_TRUE(analysis->Dominates(86, 98)); + EXPECT_TRUE(analysis->Dominates(86, 95)); + EXPECT_TRUE(analysis->Dominates(86, 97)); + EXPECT_TRUE(analysis->Dominates(86, 96)); + EXPECT_TRUE(analysis->Dominates(86, 88)); + + EXPECT_TRUE(analysis->Dominates(90, 87)); + EXPECT_TRUE(analysis->Dominates(90, 94)); + EXPECT_TRUE(analysis->Dominates(90, 98)); + EXPECT_TRUE(analysis->Dominates(90, 95)); + EXPECT_TRUE(analysis->Dominates(90, 97)); + EXPECT_TRUE(analysis->Dominates(90, 96)); + + EXPECT_TRUE(analysis->Dominates(87, 94)); + EXPECT_TRUE(analysis->Dominates(87, 98)); + EXPECT_TRUE(analysis->Dominates(87, 95)); + EXPECT_TRUE(analysis->Dominates(87, 97)); + EXPECT_TRUE(analysis->Dominates(87, 96)); + + EXPECT_TRUE(analysis->Dominates(94, 98)); + EXPECT_TRUE(analysis->Dominates(94, 95)); + EXPECT_TRUE(analysis->Dominates(94, 97)); + EXPECT_TRUE(analysis->Dominates(94, 96)); + + EXPECT_TRUE(analysis->Dominates(98, 95)); + + EXPECT_TRUE(analysis->StrictlyDominates(5, 10)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 14)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 29)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 33)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 30)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 32)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 31)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 13)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 12)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 46)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 50)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 47)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 57)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 60)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 48)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 73)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 77)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 75)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 109)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 88)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 76)); + + EXPECT_TRUE(analysis->StrictlyDominates(10, 14)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 29)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 33)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 30)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 32)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 31)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 13)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 12)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 46)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 50)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 47)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 57)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 60)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 48)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 73)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 77)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 75)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 109)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 88)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 76)); + + EXPECT_TRUE(analysis->StrictlyDominates(14, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 29)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 33)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 30)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 32)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 31)); + + EXPECT_TRUE(analysis->StrictlyDominates(11, 29)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 33)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 30)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 32)); + EXPECT_TRUE(analysis->StrictlyDominates(11, 31)); + + EXPECT_TRUE(analysis->StrictlyDominates(29, 33)); + EXPECT_TRUE(analysis->StrictlyDominates(29, 30)); + EXPECT_TRUE(analysis->StrictlyDominates(29, 32)); + EXPECT_TRUE(analysis->StrictlyDominates(29, 31)); + + EXPECT_TRUE(analysis->StrictlyDominates(33, 30)); + + EXPECT_TRUE(analysis->StrictlyDominates(12, 46)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 50)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 47)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 57)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 60)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 48)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 73)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 77)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 75)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 109)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 88)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 76)); + + EXPECT_TRUE(analysis->StrictlyDominates(46, 50)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 47)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 57)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 60)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 48)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 73)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 77)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 75)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 109)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 88)); + EXPECT_TRUE(analysis->StrictlyDominates(46, 76)); + + EXPECT_TRUE(analysis->StrictlyDominates(50, 47)); + EXPECT_TRUE(analysis->StrictlyDominates(50, 57)); + EXPECT_TRUE(analysis->StrictlyDominates(50, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(50, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(50, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(50, 60)); + + EXPECT_TRUE(analysis->StrictlyDominates(47, 57)); + EXPECT_TRUE(analysis->StrictlyDominates(47, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(47, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(47, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(47, 60)); + + EXPECT_TRUE(analysis->StrictlyDominates(57, 61)); + EXPECT_TRUE(analysis->StrictlyDominates(57, 59)); + EXPECT_TRUE(analysis->StrictlyDominates(57, 58)); + EXPECT_TRUE(analysis->StrictlyDominates(57, 60)); + + EXPECT_TRUE(analysis->StrictlyDominates(61, 59)); + + EXPECT_TRUE(analysis->StrictlyDominates(48, 73)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 77)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 75)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 109)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 88)); + EXPECT_TRUE(analysis->StrictlyDominates(48, 76)); + + EXPECT_TRUE(analysis->StrictlyDominates(73, 77)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 75)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 109)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 88)); + EXPECT_TRUE(analysis->StrictlyDominates(73, 76)); + + EXPECT_TRUE(analysis->StrictlyDominates(75, 106)); + EXPECT_TRUE(analysis->StrictlyDominates(75, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(75, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(75, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(75, 109)); + + EXPECT_TRUE(analysis->StrictlyDominates(106, 110)); + EXPECT_TRUE(analysis->StrictlyDominates(106, 107)); + EXPECT_TRUE(analysis->StrictlyDominates(106, 108)); + EXPECT_TRUE(analysis->StrictlyDominates(106, 109)); + + EXPECT_TRUE(analysis->StrictlyDominates(110, 107)); + + EXPECT_TRUE(analysis->StrictlyDominates(77, 74)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(77, 88)); + + EXPECT_TRUE(analysis->StrictlyDominates(74, 86)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(74, 88)); + + EXPECT_TRUE(analysis->StrictlyDominates(86, 90)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 96)); + EXPECT_TRUE(analysis->StrictlyDominates(86, 88)); + + EXPECT_TRUE(analysis->StrictlyDominates(90, 87)); + EXPECT_TRUE(analysis->StrictlyDominates(90, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(90, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(90, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(90, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(90, 96)); + + EXPECT_TRUE(analysis->StrictlyDominates(87, 94)); + EXPECT_TRUE(analysis->StrictlyDominates(87, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(87, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(87, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(87, 96)); + + EXPECT_TRUE(analysis->StrictlyDominates(94, 98)); + EXPECT_TRUE(analysis->StrictlyDominates(94, 95)); + EXPECT_TRUE(analysis->StrictlyDominates(94, 97)); + EXPECT_TRUE(analysis->StrictlyDominates(94, 96)); + + EXPECT_TRUE(analysis->StrictlyDominates(98, 95)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/post.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/post.cpp new file mode 100644 index 00000000000..bb10fdef1d8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/post.cpp @@ -0,0 +1,207 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 440 core +layout(location = 0) out vec4 c; +layout(location = 1)in vec4 in_val; +void main(){ + if ( in_val.x < 10) { + int z = 0; + int i = 0; + for (i = 0; i < in_val.y; ++i) { + z += i; + } + c = vec4(i,i,i,i); + } else { + c = vec4(1,1,1,1); + } +} +*/ +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %43 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %9 "in_val" + OpName %22 "z" + OpName %24 "i" + OpName %43 "c" + OpDecorate %9 Location 1 + OpDecorate %43 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %6 10 + %16 = OpTypeBool + %20 = OpTypeInt 32 1 + %21 = OpTypePointer Function %20 + %23 = OpConstant %20 0 + %32 = OpConstant %10 1 + %40 = OpConstant %20 1 + %42 = OpTypePointer Output %7 + %43 = OpVariable %42 Output + %54 = OpConstant %6 1 + %55 = OpConstantComposite %7 %54 %54 %54 %54 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %21 Function + %24 = OpVariable %21 Function + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %17 = OpFOrdLessThan %16 %14 %15 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %53 + %18 = OpLabel + OpStore %22 %23 + OpStore %24 %23 + OpStore %24 %23 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %20 %24 + %31 = OpConvertSToF %6 %30 + %33 = OpAccessChain %12 %9 %32 + %34 = OpLoad %6 %33 + %35 = OpFOrdLessThan %16 %31 %34 + OpBranchConditional %35 %26 %27 + %26 = OpLabel + %36 = OpLoad %20 %24 + %37 = OpLoad %20 %22 + %38 = OpIAdd %20 %37 %36 + OpStore %22 %38 + OpBranch %28 + %28 = OpLabel + %39 = OpLoad %20 %24 + %41 = OpIAdd %20 %39 %40 + OpStore %24 %41 + OpBranch %25 + %27 = OpLabel + %44 = OpLoad %20 %24 + %45 = OpConvertSToF %6 %44 + %46 = OpLoad %20 %24 + %47 = OpConvertSToF %6 %46 + %48 = OpLoad %20 %24 + %49 = OpConvertSToF %6 %48 + %50 = OpLoad %20 %24 + %51 = OpConvertSToF %6 %50 + %52 = OpCompositeConstruct %7 %45 %47 %49 %51 + OpStore %43 %52 + OpBranch %19 + %53 = OpLabel + OpStore %43 %55 + OpBranch %19 + %19 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + CFG cfg(module); + PostDominatorAnalysis* analysis = context->GetPostDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(19, 18)); + EXPECT_TRUE(analysis->Dominates(19, 5)); + EXPECT_TRUE(analysis->Dominates(19, 53)); + EXPECT_TRUE(analysis->Dominates(19, 19)); + EXPECT_TRUE(analysis->Dominates(19, 25)); + EXPECT_TRUE(analysis->Dominates(19, 29)); + EXPECT_TRUE(analysis->Dominates(19, 27)); + EXPECT_TRUE(analysis->Dominates(19, 26)); + EXPECT_TRUE(analysis->Dominates(19, 28)); + + EXPECT_TRUE(analysis->Dominates(27, 18)); + EXPECT_TRUE(analysis->Dominates(27, 25)); + EXPECT_TRUE(analysis->Dominates(27, 29)); + EXPECT_TRUE(analysis->Dominates(27, 27)); + EXPECT_TRUE(analysis->Dominates(27, 26)); + EXPECT_TRUE(analysis->Dominates(27, 28)); + + EXPECT_FALSE(analysis->Dominates(27, 19)); + EXPECT_FALSE(analysis->Dominates(27, 5)); + EXPECT_FALSE(analysis->Dominates(27, 53)); + + EXPECT_FALSE(analysis->StrictlyDominates(19, 19)); + + EXPECT_TRUE(analysis->StrictlyDominates(19, 18)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 5)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 53)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 25)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 29)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 27)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 26)); + EXPECT_TRUE(analysis->StrictlyDominates(19, 28)); + + // These would be expected true for a normal, non post, dominator tree + EXPECT_FALSE(analysis->Dominates(5, 18)); + EXPECT_FALSE(analysis->Dominates(5, 53)); + EXPECT_FALSE(analysis->Dominates(5, 19)); + EXPECT_FALSE(analysis->Dominates(5, 25)); + EXPECT_FALSE(analysis->Dominates(5, 29)); + EXPECT_FALSE(analysis->Dominates(5, 27)); + EXPECT_FALSE(analysis->Dominates(5, 26)); + EXPECT_FALSE(analysis->Dominates(5, 28)); + + EXPECT_FALSE(analysis->StrictlyDominates(5, 18)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 53)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 19)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 25)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 29)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 27)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 26)); + EXPECT_FALSE(analysis->StrictlyDominates(5, 28)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/simple.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/simple.cpp new file mode 100644 index 00000000000..d11854d550a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/simple.cpp @@ -0,0 +1,177 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL +#version 440 core +layout(location = 0) out vec4 c; +layout(location = 1)in vec4 in_val; +void main(){ + if ( in_val.x < 10) { + int z = 0; + int i = 0; + for (i = 0; i < in_val.y; ++i) { + z += i; + } + c = vec4(i,i,i,i); + } else { + c = vec4(1,1,1,1); + } +} +*/ +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %43 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %9 "in_val" + OpName %22 "z" + OpName %24 "i" + OpName %43 "c" + OpDecorate %9 Location 1 + OpDecorate %43 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpConstant %6 10 + %16 = OpTypeBool + %20 = OpTypeInt 32 1 + %21 = OpTypePointer Function %20 + %23 = OpConstant %20 0 + %32 = OpConstant %10 1 + %40 = OpConstant %20 1 + %42 = OpTypePointer Output %7 + %43 = OpVariable %42 Output + %54 = OpConstant %6 1 + %55 = OpConstantComposite %7 %54 %54 %54 %54 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %22 = OpVariable %21 Function + %24 = OpVariable %21 Function + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %17 = OpFOrdLessThan %16 %14 %15 + OpSelectionMerge %19 None + OpBranchConditional %17 %18 %53 + %18 = OpLabel + OpStore %22 %23 + OpStore %24 %23 + OpStore %24 %23 + OpBranch %25 + %25 = OpLabel + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %30 = OpLoad %20 %24 + %31 = OpConvertSToF %6 %30 + %33 = OpAccessChain %12 %9 %32 + %34 = OpLoad %6 %33 + %35 = OpFOrdLessThan %16 %31 %34 + OpBranchConditional %35 %26 %27 + %26 = OpLabel + %36 = OpLoad %20 %24 + %37 = OpLoad %20 %22 + %38 = OpIAdd %20 %37 %36 + OpStore %22 %38 + OpBranch %28 + %28 = OpLabel + %39 = OpLoad %20 %24 + %41 = OpIAdd %20 %39 %40 + OpStore %24 %41 + OpBranch %25 + %27 = OpLabel + %44 = OpLoad %20 %24 + %45 = OpConvertSToF %6 %44 + %46 = OpLoad %20 %24 + %47 = OpConvertSToF %6 %46 + %48 = OpLoad %20 %24 + %49 = OpConvertSToF %6 %48 + %50 = OpLoad %20 %24 + %51 = OpConvertSToF %6 %50 + %52 = OpCompositeConstruct %7 %45 %47 %49 %51 + OpStore %43 %52 + OpBranch %19 + %53 = OpLabel + OpStore %43 %55 + OpBranch %19 + %19 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + + DominatorAnalysis* analysis = context->GetDominatorAnalysis(f); + const CFG& cfg = *context->cfg(); + + DominatorTree& tree = analysis->GetDomTree(); + + EXPECT_EQ(tree.GetRoot()->bb_, cfg.pseudo_entry_block()); + EXPECT_TRUE(analysis->Dominates(5, 18)); + EXPECT_TRUE(analysis->Dominates(5, 53)); + EXPECT_TRUE(analysis->Dominates(5, 19)); + EXPECT_TRUE(analysis->Dominates(5, 25)); + EXPECT_TRUE(analysis->Dominates(5, 29)); + EXPECT_TRUE(analysis->Dominates(5, 27)); + EXPECT_TRUE(analysis->Dominates(5, 26)); + EXPECT_TRUE(analysis->Dominates(5, 28)); + + EXPECT_TRUE(analysis->StrictlyDominates(5, 18)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 53)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 19)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 25)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 29)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 27)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 26)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 28)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp new file mode 100644 index 00000000000..d9dd7d1619c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/switch_case_fallthrough.cpp @@ -0,0 +1,163 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 440 core +layout(location = 0) out vec4 v; +layout(location = 1) in vec4 in_val; +void main() { + int i; + switch (int(in_val.x)) { + case 0: + i = 0; + case 1: + i = 1; + break; + case 2: + i = 2; + case 3: + i = 3; + case 4: + i = 4; + break; + default: + i = 0; + } + v = vec4(i, i, i, i); +} +*/ +TEST_F(PassClassTest, UnreachableNestedIfs) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %9 %35 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %9 "in_val" + OpName %25 "i" + OpName %35 "v" + OpDecorate %9 Location 1 + OpDecorate %35 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Input %7 + %9 = OpVariable %8 Input + %10 = OpTypeInt 32 0 + %11 = OpConstant %10 0 + %12 = OpTypePointer Input %6 + %15 = OpTypeInt 32 1 + %24 = OpTypePointer Function %15 + %26 = OpConstant %15 0 + %27 = OpConstant %15 1 + %29 = OpConstant %15 2 + %30 = OpConstant %15 3 + %31 = OpConstant %15 4 + %34 = OpTypePointer Output %7 + %35 = OpVariable %34 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %25 = OpVariable %24 Function + %13 = OpAccessChain %12 %9 %11 + %14 = OpLoad %6 %13 + %16 = OpConvertFToS %15 %14 + OpSelectionMerge %23 None + OpSwitch %16 %22 0 %17 1 %18 2 %19 3 %20 4 %21 + %22 = OpLabel + OpStore %25 %26 + OpBranch %23 + %17 = OpLabel + OpStore %25 %26 + OpBranch %18 + %18 = OpLabel + OpStore %25 %27 + OpBranch %23 + %19 = OpLabel + OpStore %25 %29 + OpBranch %20 + %20 = OpLabel + OpStore %25 %30 + OpBranch %21 + %21 = OpLabel + OpStore %25 %31 + OpBranch %23 + %23 = OpLabel + %36 = OpLoad %15 %25 + %37 = OpConvertSToF %6 %36 + %38 = OpLoad %15 %25 + %39 = OpConvertSToF %6 %38 + %40 = OpLoad %15 %25 + %41 = OpConvertSToF %6 %40 + %42 = OpLoad %15 %25 + %43 = OpConvertSToF %6 %42 + %44 = OpCompositeConstruct %7 %37 %39 %41 %43 + OpStore %35 %44 + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + DominatorAnalysis* analysis = context->GetDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(5, 5)); + EXPECT_TRUE(analysis->Dominates(5, 17)); + EXPECT_TRUE(analysis->Dominates(5, 18)); + EXPECT_TRUE(analysis->Dominates(5, 19)); + EXPECT_TRUE(analysis->Dominates(5, 20)); + EXPECT_TRUE(analysis->Dominates(5, 21)); + EXPECT_TRUE(analysis->Dominates(5, 22)); + EXPECT_TRUE(analysis->Dominates(5, 23)); + + EXPECT_TRUE(analysis->StrictlyDominates(5, 17)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 18)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 19)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 20)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 21)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 22)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 23)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp new file mode 100644 index 00000000000..469e5c142db --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/unreachable_for.cpp @@ -0,0 +1,121 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 440 core +void main() { + for (int i = 0; i < 1; i++) { + break; + } +} +*/ +TEST_F(PassClassTest, UnreachableNestedIfs) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSLessThan %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %12 + %13 = OpLabel + %20 = OpLoad %6 %8 + %21 = OpIAdd %6 %20 %16 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + DominatorAnalysis* analysis = context->GetDominatorAnalysis(f); + EXPECT_TRUE(analysis->Dominates(5, 5)); + EXPECT_TRUE(analysis->Dominates(5, 10)); + EXPECT_TRUE(analysis->Dominates(5, 14)); + EXPECT_TRUE(analysis->Dominates(5, 11)); + EXPECT_TRUE(analysis->Dominates(5, 12)); + EXPECT_TRUE(analysis->Dominates(10, 10)); + EXPECT_TRUE(analysis->Dominates(10, 14)); + EXPECT_TRUE(analysis->Dominates(10, 11)); + EXPECT_TRUE(analysis->Dominates(10, 12)); + EXPECT_TRUE(analysis->Dominates(14, 14)); + EXPECT_TRUE(analysis->Dominates(14, 11)); + EXPECT_TRUE(analysis->Dominates(14, 12)); + EXPECT_TRUE(analysis->Dominates(11, 11)); + EXPECT_TRUE(analysis->Dominates(12, 12)); + + EXPECT_TRUE(analysis->StrictlyDominates(5, 10)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 14)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(5, 12)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 14)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 12)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 12)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp new file mode 100644 index 00000000000..8d3e37b4a4f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/dominator_tree/unreachable_for_post.cpp @@ -0,0 +1,118 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/dominator_analysis.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Generated from the following GLSL +#version 440 core +void main() { + for (int i = 0; i < 1; i++) { + break; + } +} +*/ +TEST_F(PassClassTest, UnreachableNestedIfs) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 1 + %17 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %15 = OpLoad %6 %8 + %18 = OpSLessThan %17 %15 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %12 + %13 = OpLabel + %20 = OpLoad %6 %8 + %21 = OpIAdd %6 %20 %16 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + const Function* f = spvtest::GetFunction(module, 4); + + PostDominatorAnalysis* analysis = context->GetPostDominatorAnalysis(f); + + EXPECT_TRUE(analysis->Dominates(12, 12)); + EXPECT_TRUE(analysis->Dominates(12, 14)); + EXPECT_TRUE(analysis->Dominates(12, 11)); + EXPECT_TRUE(analysis->Dominates(12, 10)); + EXPECT_TRUE(analysis->Dominates(12, 5)); + EXPECT_TRUE(analysis->Dominates(14, 14)); + EXPECT_TRUE(analysis->Dominates(14, 10)); + EXPECT_TRUE(analysis->Dominates(14, 5)); + EXPECT_TRUE(analysis->Dominates(10, 10)); + EXPECT_TRUE(analysis->Dominates(10, 5)); + EXPECT_TRUE(analysis->Dominates(5, 5)); + + EXPECT_TRUE(analysis->StrictlyDominates(12, 14)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 11)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 10)); + EXPECT_TRUE(analysis->StrictlyDominates(12, 5)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 10)); + EXPECT_TRUE(analysis->StrictlyDominates(14, 5)); + EXPECT_TRUE(analysis->StrictlyDominates(10, 5)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp new file mode 100644 index 00000000000..7fac866ceca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp @@ -0,0 +1,847 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include +#include +#include + +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using EliminateDeadConstantBasicTest = PassTest<::testing::Test>; + +TEST_F(EliminateDeadConstantBasicTest, BasicAllDeadConstants) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "%void = OpTypeVoid", + "%4 = OpTypeFunction %void", + "%bool = OpTypeBool", + "%true = OpConstantTrue %bool", + "%false = OpConstantFalse %bool", + "%int = OpTypeInt 32 1", + "%9 = OpConstant %int 1", + "%uint = OpTypeInt 32 0", + "%11 = OpConstant %uint 2", + "%float = OpTypeFloat 32", + "%13 = OpConstant %float 3.1415", + "%double = OpTypeFloat 64", + "%15 = OpConstant %double 3.14159265358979", + "%main = OpFunction %void None %4", + "%16 = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + // None of the above constants is ever used, so all of them should be + // eliminated. + const char* const_decl_opcodes[] = { + " OpConstantTrue ", + " OpConstantFalse ", + " OpConstant ", + }; + // Skip lines that have any one of const_decl_opcodes. + const std::string expected_disassembly = + SelectiveJoin(text, [&const_decl_opcodes](const char* line) { + return std::any_of( + std::begin(const_decl_opcodes), std::end(const_decl_opcodes), + [&line](const char* const_decl_op) { + return std::string(line).find(const_decl_op) != std::string::npos; + }); + }); + + SinglePassRunAndCheck( + JoinAllInsts(text), expected_disassembly, /* skip_nop = */ true); +} + +TEST_F(EliminateDeadConstantBasicTest, BasicNoneDeadConstants) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "OpName %btv \"btv\"", + "OpName %bfv \"bfv\"", + "OpName %iv \"iv\"", + "OpName %uv \"uv\"", + "OpName %fv \"fv\"", + "OpName %dv \"dv\"", + "%void = OpTypeVoid", + "%10 = OpTypeFunction %void", + "%bool = OpTypeBool", + "%_ptr_Function_bool = OpTypePointer Function %bool", + "%true = OpConstantTrue %bool", + "%false = OpConstantFalse %bool", + "%int = OpTypeInt 32 1", + "%_ptr_Function_int = OpTypePointer Function %int", + "%int_1 = OpConstant %int 1", + "%uint = OpTypeInt 32 0", + "%_ptr_Function_uint = OpTypePointer Function %uint", + "%uint_2 = OpConstant %uint 2", + "%float = OpTypeFloat 32", + "%_ptr_Function_float = OpTypePointer Function %float", + "%float_3_1415 = OpConstant %float 3.1415", + "%double = OpTypeFloat 64", + "%_ptr_Function_double = OpTypePointer Function %double", + "%double_3_14159265358979 = OpConstant %double 3.14159265358979", + "%main = OpFunction %void None %10", + "%27 = OpLabel", + "%btv = OpVariable %_ptr_Function_bool Function", + "%bfv = OpVariable %_ptr_Function_bool Function", + "%iv = OpVariable %_ptr_Function_int Function", + "%uv = OpVariable %_ptr_Function_uint Function", + "%fv = OpVariable %_ptr_Function_float Function", + "%dv = OpVariable %_ptr_Function_double Function", + "OpStore %btv %true", + "OpStore %bfv %false", + "OpStore %iv %int_1", + "OpStore %uv %uint_2", + "OpStore %fv %float_3_1415", + "OpStore %dv %double_3_14159265358979", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + // All constants are used, so none of them should be eliminated. + SinglePassRunAndCheck( + JoinAllInsts(text), JoinAllInsts(text), /* skip_nop = */ true); +} + +struct EliminateDeadConstantTestCase { + // Type declarations and constants that should be kept. + std::vector used_consts; + // Instructions that refer to constants, this is added to create uses for + // some constants so they won't be treated as dead constants. + std::vector main_insts; + // Dead constants that should be removed. + std::vector dead_consts; +}; + +// All types that are potentially required in EliminateDeadConstantTest. +const std::vector CommonTypes = { + // clang-format off + // scalar types + "%bool = OpTypeBool", + "%uint = OpTypeInt 32 0", + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%double = OpTypeFloat 64", + // vector types + "%v2bool = OpTypeVector %bool 2", + "%v2uint = OpTypeVector %uint 2", + "%v2int = OpTypeVector %int 2", + "%v3int = OpTypeVector %int 3", + "%v4int = OpTypeVector %int 4", + "%v2float = OpTypeVector %float 2", + "%v3float = OpTypeVector %float 3", + "%v2double = OpTypeVector %double 2", + // variable pointer types + "%_pf_bool = OpTypePointer Function %bool", + "%_pf_uint = OpTypePointer Function %uint", + "%_pf_int = OpTypePointer Function %int", + "%_pf_float = OpTypePointer Function %float", + "%_pf_double = OpTypePointer Function %double", + "%_pf_v2int = OpTypePointer Function %v2int", + "%_pf_v3int = OpTypePointer Function %v3int", + "%_pf_v2float = OpTypePointer Function %v2float", + "%_pf_v3float = OpTypePointer Function %v3float", + "%_pf_v2double = OpTypePointer Function %v2double", + // struct types + "%inner_struct = OpTypeStruct %bool %int %float %double", + "%outer_struct = OpTypeStruct %inner_struct %int %double", + "%flat_struct = OpTypeStruct %bool %int %float %double", + // clang-format on +}; + +using EliminateDeadConstantTest = + PassTest<::testing::TestWithParam>; + +TEST_P(EliminateDeadConstantTest, Custom) { + auto& tc = GetParam(); + AssemblyBuilder builder; + builder.AppendTypesConstantsGlobals(CommonTypes) + .AppendTypesConstantsGlobals(tc.used_consts) + .AppendInMain(tc.main_insts); + const std::string expected = builder.GetCode(); + builder.AppendTypesConstantsGlobals(tc.dead_consts); + const std::string assembly_with_dead_const = builder.GetCode(); + SinglePassRunAndCheck( + assembly_with_dead_const, expected, /* skip_nop = */ true); +} + +INSTANTIATE_TEST_CASE_P( + ScalarTypeConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Scalar type constants, one dead constant and one used constant. + { + /* .used_consts = */ + { + "%used_const_int = OpConstant %int 1", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %used_const_int", + }, + /* .dead_consts = */ + { + "%dead_const_int = OpConstant %int 1", + }, + }, + { + /* .used_consts = */ + { + "%used_const_uint = OpConstant %uint 1", + }, + /* .main_insts = */ + { + "%uint_var = OpVariable %_pf_uint Function", + "OpStore %uint_var %used_const_uint", + }, + /* .dead_consts = */ + { + "%dead_const_uint = OpConstant %uint 1", + }, + }, + { + /* .used_consts = */ + { + "%used_const_float = OpConstant %float 3.1415", + }, + /* .main_insts = */ + { + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %used_const_float", + }, + /* .dead_consts = */ + { + "%dead_const_float = OpConstant %float 3.1415", + }, + }, + { + /* .used_consts = */ + { + "%used_const_double = OpConstant %double 3.141592653", + }, + /* .main_insts = */ + { + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %used_const_double", + }, + /* .dead_consts = */ + { + "%dead_const_double = OpConstant %double 3.141592653", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + VectorTypeConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Tests eliminating dead constant type ivec2. One dead constant vector + // and one used constant vector, each built from its own group of + // scalar constants. + { + /* .used_consts = */ + { + "%used_int_x = OpConstant %int 1", + "%used_int_y = OpConstant %int 2", + "%used_v2int = OpConstantComposite %v2int %used_int_x %used_int_y", + }, + /* .main_insts = */ + { + "%v2int_var = OpVariable %_pf_v2int Function", + "OpStore %v2int_var %used_v2int", + }, + /* .dead_consts = */ + { + "%dead_int_x = OpConstant %int 1", + "%dead_int_y = OpConstant %int 2", + "%dead_v2int = OpConstantComposite %v2int %dead_int_x %dead_int_y", + }, + }, + // Tests eliminating dead constant ivec2. One dead constant vector and + // one used constant vector. But both built from a same group of + // scalar constants. + { + /* .used_consts = */ + { + "%used_int_x = OpConstant %int 1", + "%used_int_y = OpConstant %int 2", + "%used_int_z = OpConstant %int 3", + "%used_v3int = OpConstantComposite %v3int %used_int_x %used_int_y %used_int_z", + }, + /* .main_insts = */ + { + "%v3int_var = OpVariable %_pf_v3int Function", + "OpStore %v3int_var %used_v3int", + }, + /* .dead_consts = */ + { + "%dead_v3int = OpConstantComposite %v3int %used_int_x %used_int_y %used_int_z", + }, + }, + // Tests eliminating dead cosntant vec2. One dead constant vector and + // one used constant vector. Each built from its own group of scalar + // constants. + { + /* .used_consts = */ + { + "%used_float_x = OpConstant %float 3.1415", + "%used_float_y = OpConstant %float 4.25", + "%used_v2float = OpConstantComposite %v2float %used_float_x %used_float_y", + }, + /* .main_insts = */ + { + "%v2float_var = OpVariable %_pf_v2float Function", + "OpStore %v2float_var %used_v2float", + }, + /* .dead_consts = */ + { + "%dead_float_x = OpConstant %float 3.1415", + "%dead_float_y = OpConstant %float 4.25", + "%dead_v2float = OpConstantComposite %v2float %dead_float_x %dead_float_y", + }, + }, + // Tests eliminating dead cosntant vec2. One dead constant vector and + // one used constant vector. Both built from a same group of scalar + // constants. + { + /* .used_consts = */ + { + "%used_float_x = OpConstant %float 3.1415", + "%used_float_y = OpConstant %float 4.25", + "%used_float_z = OpConstant %float 4.75", + "%used_v3float = OpConstantComposite %v3float %used_float_x %used_float_y %used_float_z", + }, + /* .main_insts = */ + { + "%v3float_var = OpVariable %_pf_v3float Function", + "OpStore %v3float_var %used_v3float", + }, + /* .dead_consts = */ + { + "%dead_v3float = OpConstantComposite %v3float %used_float_x %used_float_y %used_float_z", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + StructTypeConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // A plain struct type dead constants. All of its components are dead + // constants too. + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_int = OpConstant %int 1", + "%dead_float = OpConstant %float 2.5", + "%dead_double = OpConstant %double 3.14159265358979", + "%dead_struct = OpConstantComposite %flat_struct %dead_bool %dead_int %dead_float %dead_double", + }, + }, + // A plain struct type dead constants. Some of its components are dead + // constants while others are not. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 1", + "%used_double = OpConstant %double 3.14159265358979", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %used_int", + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %used_double", + }, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_float = OpConstant %float 2.5", + "%dead_struct = OpConstantComposite %flat_struct %dead_bool %used_int %dead_float %used_double", + }, + }, + // A nesting struct type dead constants. All components of both outer + // and inner structs are dead and should be removed after dead constant + // elimination. + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_int = OpConstant %int 1", + "%dead_float = OpConstant %float 2.5", + "%dead_double = OpConstant %double 3.1415926535", + "%dead_inner_struct = OpConstantComposite %inner_struct %dead_bool %dead_int %dead_float %dead_double", + "%dead_int2 = OpConstant %int 2", + "%dead_double2 = OpConstant %double 1.428571428514", + "%dead_outer_struct = OpConstantComposite %outer_struct %dead_inner_struct %dead_int2 %dead_double2", + }, + }, + // A nesting struct type dead constants. Some of its components are + // dead constants while others are not. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 1", + "%used_double = OpConstant %double 3.14159265358979", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %used_int", + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %used_double", + }, + /* .dead_consts = */ + { + "%dead_bool = OpConstantTrue %bool", + "%dead_float = OpConstant %float 2.5", + "%dead_inner_struct = OpConstantComposite %inner_struct %dead_bool %used_int %dead_float %used_double", + "%dead_int = OpConstant %int 2", + "%dead_outer_struct = OpConstantComposite %outer_struct %dead_inner_struct %dead_int %used_double", + }, + }, + // A nesting struct case. The inner struct is used while the outer struct is not + { + /* .used_const = */ + { + "%used_bool = OpConstantTrue %bool", + "%used_int = OpConstant %int 1", + "%used_float = OpConstant %float 1.25", + "%used_double = OpConstant %double 1.23456789012345", + "%used_inner_struct = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double", + }, + /* .main_insts = */ + { + "%bool_var = OpVariable %_pf_bool Function", + "%bool_from_inner_struct = OpCompositeExtract %bool %used_inner_struct 0", + "OpStore %bool_var %bool_from_inner_struct", + }, + /* .dead_consts = */ + { + "%dead_int = OpConstant %int 2", + "%dead_outer_struct = OpConstantComposite %outer_struct %used_inner_struct %dead_int %used_double" + }, + }, + // A nesting struct case. The outer struct is used, so the inner struct should not + // be removed even though it is not used anywhere. + { + /* .used_const = */ + { + "%used_bool = OpConstantTrue %bool", + "%used_int = OpConstant %int 1", + "%used_float = OpConstant %float 1.25", + "%used_double = OpConstant %double 1.23456789012345", + "%used_inner_struct = OpConstantComposite %inner_struct %used_bool %used_int %used_float %used_double", + "%used_outer_struct = OpConstantComposite %outer_struct %used_inner_struct %used_int %used_double" + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "%int_from_outer_struct = OpCompositeExtract %int %used_outer_struct 1", + "OpStore %int_var %int_from_outer_struct", + }, + /* .dead_consts = */ {}, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + ScalarTypeSpecConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // All scalar type spec constants. + { + /* .used_consts = */ + { + "%used_bool = OpSpecConstantTrue %bool", + "%used_uint = OpSpecConstant %uint 2", + "%used_int = OpSpecConstant %int 2", + "%used_float = OpSpecConstant %float 2.5", + "%used_double = OpSpecConstant %double 1.42857142851", + }, + /* .main_insts = */ + { + "%bool_var = OpVariable %_pf_bool Function", + "%uint_var = OpVariable %_pf_uint Function", + "%int_var = OpVariable %_pf_int Function", + "%float_var = OpVariable %_pf_float Function", + "%double_var = OpVariable %_pf_double Function", + "OpStore %bool_var %used_bool", "OpStore %uint_var %used_uint", + "OpStore %int_var %used_int", "OpStore %float_var %used_float", + "OpStore %double_var %used_double", + }, + /* .dead_consts = */ + { + "%dead_bool = OpSpecConstantTrue %bool", + "%dead_uint = OpSpecConstant %uint 2", + "%dead_int = OpSpecConstant %int 2", + "%dead_float = OpSpecConstant %float 2.5", + "%dead_double = OpSpecConstant %double 1.42857142851", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + VectorTypeSpecConstants, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Bool vector type spec constants. One vector has all component dead, + // another vector has one dead boolean and one used boolean. + { + /* .used_consts = */ + { + "%used_bool = OpSpecConstantTrue %bool", + }, + /* .main_insts = */ + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %used_bool", + }, + /* .dead_consts = */ + { + "%dead_bool = OpSpecConstantFalse %bool", + "%dead_bool_vec1 = OpSpecConstantComposite %v2bool %dead_bool %dead_bool", + "%dead_bool_vec2 = OpSpecConstantComposite %v2bool %dead_bool %used_bool", + }, + }, + + // Uint vector type spec constants. One vector has all component dead, + // another vector has one dead unsigend integer and one used unsigned + // integer. + { + /* .used_consts = */ + { + "%used_uint = OpSpecConstant %uint 3", + }, + /* .main_insts = */ + { + "%uint_var = OpVariable %_pf_uint Function", + "OpStore %uint_var %used_uint", + }, + /* .dead_consts = */ + { + "%dead_uint = OpSpecConstant %uint 1", + "%dead_uint_vec1 = OpSpecConstantComposite %v2uint %dead_uint %dead_uint", + "%dead_uint_vec2 = OpSpecConstantComposite %v2uint %dead_uint %used_uint", + }, + }, + + // Int vector type spec constants. One vector has all component dead, + // another vector has one dead integer and one used integer. + { + /* .used_consts = */ + { + "%used_int = OpSpecConstant %int 3", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %used_int", + }, + /* .dead_consts = */ + { + "%dead_int = OpSpecConstant %int 1", + "%dead_int_vec1 = OpSpecConstantComposite %v2int %dead_int %dead_int", + "%dead_int_vec2 = OpSpecConstantComposite %v2int %dead_int %used_int", + }, + }, + + // Int vector type spec constants built with both spec constants and + // front-end constants. + { + /* .used_consts = */ + { + "%used_spec_int = OpSpecConstant %int 3", + "%used_front_end_int = OpConstant %int 3", + }, + /* .main_insts = */ + { + "%int_var1 = OpVariable %_pf_int Function", + "OpStore %int_var1 %used_spec_int", + "%int_var2 = OpVariable %_pf_int Function", + "OpStore %int_var2 %used_front_end_int", + }, + /* .dead_consts = */ + { + "%dead_spec_int = OpSpecConstant %int 1", + "%dead_front_end_int = OpConstant %int 1", + // Dead front-end and dead spec constants + "%dead_int_vec1 = OpSpecConstantComposite %v2int %dead_spec_int %dead_front_end_int", + // Used front-end and dead spec constants + "%dead_int_vec2 = OpSpecConstantComposite %v2int %dead_spec_int %used_front_end_int", + // Dead front-end and used spec constants + "%dead_int_vec3 = OpSpecConstantComposite %v2int %dead_front_end_int %used_spec_int", + }, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + SpecConstantOp, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Cast operations: uint <-> int <-> bool + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + // Assistant constants, only used in dead spec constant + // operations. + "%signed_zero = OpConstant %int 0", + "%signed_zero_vec = OpConstantComposite %v2int %signed_zero %signed_zero", + "%unsigned_zero = OpConstant %uint 0", + "%unsigned_zero_vec = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + "%signed_one = OpConstant %int 1", + "%signed_one_vec = OpConstantComposite %v2int %signed_one %signed_one", + "%unsigned_one = OpConstant %uint 1", + "%unsigned_one_vec = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + + // Spec constants that support casting to each other. + "%dead_bool = OpSpecConstantTrue %bool", + "%dead_uint = OpSpecConstant %uint 1", + "%dead_int = OpSpecConstant %int 2", + "%dead_bool_vec = OpSpecConstantComposite %v2bool %dead_bool %dead_bool", + "%dead_uint_vec = OpSpecConstantComposite %v2uint %dead_uint %dead_uint", + "%dead_int_vec = OpSpecConstantComposite %v2int %dead_int %dead_int", + + // Scalar cast to boolean spec constant. + "%int_to_bool = OpSpecConstantOp %bool INotEqual %dead_int %signed_zero", + "%uint_to_bool = OpSpecConstantOp %bool INotEqual %dead_uint %unsigned_zero", + + // Vector cast to boolean spec constant. + "%int_to_bool_vec = OpSpecConstantOp %v2bool INotEqual %dead_int_vec %signed_zero_vec", + "%uint_to_bool_vec = OpSpecConstantOp %v2bool INotEqual %dead_uint_vec %unsigned_zero_vec", + + // Scalar cast to int spec constant. + "%bool_to_int = OpSpecConstantOp %int Select %dead_bool %signed_one %signed_zero", + "%uint_to_int = OpSpecConstantOp %uint IAdd %dead_uint %unsigned_zero", + + // Vector cast to int spec constant. + "%bool_to_int_vec = OpSpecConstantOp %v2int Select %dead_bool_vec %signed_one_vec %signed_zero_vec", + "%uint_to_int_vec = OpSpecConstantOp %v2uint IAdd %dead_uint_vec %unsigned_zero_vec", + + // Scalar cast to uint spec constant. + "%bool_to_uint = OpSpecConstantOp %uint Select %dead_bool %unsigned_one %unsigned_zero", + "%int_to_uint_vec = OpSpecConstantOp %uint IAdd %dead_int %signed_zero", + + // Vector cast to uint spec constant. + "%bool_to_uint_vec = OpSpecConstantOp %v2uint Select %dead_bool_vec %unsigned_one_vec %unsigned_zero_vec", + "%int_to_uint = OpSpecConstantOp %v2uint IAdd %dead_int_vec %signed_zero_vec", + }, + }, + + // Add, sub, mul, div, rem. + { + /* .used_consts = */ {}, + /* .main_insts = */ {}, + /* .dead_consts = */ + { + "%dead_spec_int_a = OpSpecConstant %int 1", + "%dead_spec_int_a_vec = OpSpecConstantComposite %v2int %dead_spec_int_a %dead_spec_int_a", + + "%dead_spec_int_b = OpSpecConstant %int 2", + "%dead_spec_int_b_vec = OpSpecConstantComposite %v2int %dead_spec_int_b %dead_spec_int_b", + + "%dead_const_int_c = OpConstant %int 3", + "%dead_const_int_c_vec = OpConstantComposite %v2int %dead_const_int_c %dead_const_int_c", + + // Add + "%add_a_b = OpSpecConstantOp %int IAdd %dead_spec_int_a %dead_spec_int_b", + "%add_a_b_vec = OpSpecConstantOp %v2int IAdd %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Sub + "%sub_a_b = OpSpecConstantOp %int ISub %dead_spec_int_a %dead_spec_int_b", + "%sub_a_b_vec = OpSpecConstantOp %v2int ISub %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Mul + "%mul_a_b = OpSpecConstantOp %int IMul %dead_spec_int_a %dead_spec_int_b", + "%mul_a_b_vec = OpSpecConstantOp %v2int IMul %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Div + "%div_a_b = OpSpecConstantOp %int SDiv %dead_spec_int_a %dead_spec_int_b", + "%div_a_b_vec = OpSpecConstantOp %v2int SDiv %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Bitwise Xor + "%xor_a_b = OpSpecConstantOp %int BitwiseXor %dead_spec_int_a %dead_spec_int_b", + "%xor_a_b_vec = OpSpecConstantOp %v2int BitwiseXor %dead_spec_int_a_vec %dead_spec_int_b_vec", + + // Scalar Comparison + "%less_a_b = OpSpecConstantOp %bool SLessThan %dead_spec_int_a %dead_spec_int_b", + }, + }, + + // Vectors without used swizzles should be removed. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 3", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %used_int", + }, + /* .dead_consts = */ + { + "%dead_int = OpConstant %int 3", + + "%dead_spec_int_a = OpSpecConstant %int 1", + "%vec_a = OpSpecConstantComposite %v4int %dead_spec_int_a %dead_spec_int_a %dead_int %dead_int", + + "%dead_spec_int_b = OpSpecConstant %int 2", + "%vec_b = OpSpecConstantComposite %v4int %dead_spec_int_b %dead_spec_int_b %used_int %used_int", + + // Extract scalar + "%a_x = OpSpecConstantOp %int CompositeExtract %vec_a 0", + "%b_x = OpSpecConstantOp %int CompositeExtract %vec_b 0", + + // Extract vector + "%a_xy = OpSpecConstantOp %v2int VectorShuffle %vec_a %vec_a 0 1", + "%b_xy = OpSpecConstantOp %v2int VectorShuffle %vec_b %vec_b 0 1", + }, + }, + // Vectors with used swizzles should not be removed. + { + /* .used_consts = */ + { + "%used_int = OpConstant %int 3", + "%used_spec_int_a = OpSpecConstant %int 1", + "%used_spec_int_b = OpSpecConstant %int 2", + // Create vectors + "%vec_a = OpSpecConstantComposite %v4int %used_spec_int_a %used_spec_int_a %used_int %used_int", + "%vec_b = OpSpecConstantComposite %v4int %used_spec_int_b %used_spec_int_b %used_int %used_int", + // Extract vector + "%a_xy = OpSpecConstantOp %v2int VectorShuffle %vec_a %vec_a 0 1", + "%b_xy = OpSpecConstantOp %v2int VectorShuffle %vec_b %vec_b 0 1", + }, + /* .main_insts = */ + { + "%v2int_var_a = OpVariable %_pf_v2int Function", + "%v2int_var_b = OpVariable %_pf_v2int Function", + "OpStore %v2int_var_a %a_xy", + "OpStore %v2int_var_b %b_xy", + }, + /* .dead_consts = */ {}, + }, + // clang-format on + }))); + +INSTANTIATE_TEST_CASE_P( + LongDefUseChain, EliminateDeadConstantTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // Long Def-Use chain with binary operations. + { + /* .used_consts = */ + { + "%array_size = OpConstant %int 4", + "%type_arr_int_4 = OpTypeArray %int %array_size", + "%used_int_0 = OpConstant %int 100", + "%used_int_1 = OpConstant %int 1", + "%used_int_2 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_1", + "%used_int_3 = OpSpecConstantOp %int ISub %used_int_0 %used_int_2", + "%used_int_4 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_3", + "%used_int_5 = OpSpecConstantOp %int ISub %used_int_0 %used_int_4", + "%used_int_6 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_5", + "%used_int_7 = OpSpecConstantOp %int ISub %used_int_0 %used_int_6", + "%used_int_8 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_7", + "%used_int_9 = OpSpecConstantOp %int ISub %used_int_0 %used_int_8", + "%used_int_10 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_9", + "%used_int_11 = OpSpecConstantOp %int ISub %used_int_0 %used_int_10", + "%used_int_12 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_11", + "%used_int_13 = OpSpecConstantOp %int ISub %used_int_0 %used_int_12", + "%used_int_14 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_13", + "%used_int_15 = OpSpecConstantOp %int ISub %used_int_0 %used_int_14", + "%used_int_16 = OpSpecConstantOp %int ISub %used_int_0 %used_int_15", + "%used_int_17 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_16", + "%used_int_18 = OpSpecConstantOp %int ISub %used_int_0 %used_int_17", + "%used_int_19 = OpSpecConstantOp %int IAdd %used_int_0 %used_int_18", + "%used_int_20 = OpSpecConstantOp %int ISub %used_int_0 %used_int_19", + "%used_vec_a = OpSpecConstantComposite %v2int %used_int_18 %used_int_19", + "%used_vec_b = OpSpecConstantOp %v2int IMul %used_vec_a %used_vec_a", + "%used_int_21 = OpSpecConstantOp %int CompositeExtract %used_vec_b 0", + "%used_array = OpConstantComposite %type_arr_int_4 %used_int_20 %used_int_20 %used_int_21 %used_int_21", + }, + /* .main_insts = */ + { + "%int_var = OpVariable %_pf_int Function", + "%used_array_2 = OpCompositeExtract %int %used_array 2", + "OpStore %int_var %used_array_2", + }, + /* .dead_consts = */ + { + "%dead_int_1 = OpConstant %int 2", + "%dead_int_2 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_1", + "%dead_int_3 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_2", + "%dead_int_4 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_3", + "%dead_int_5 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_4", + "%dead_int_6 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_5", + "%dead_int_7 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_6", + "%dead_int_8 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_7", + "%dead_int_9 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_8", + "%dead_int_10 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_9", + "%dead_int_11 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_10", + "%dead_int_12 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_11", + "%dead_int_13 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_12", + "%dead_int_14 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_13", + "%dead_int_15 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_14", + "%dead_int_16 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_15", + "%dead_int_17 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_16", + "%dead_int_18 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_17", + "%dead_int_19 = OpSpecConstantOp %int IAdd %used_int_0 %dead_int_18", + "%dead_int_20 = OpSpecConstantOp %int ISub %used_int_0 %dead_int_19", + "%dead_vec_a = OpSpecConstantComposite %v2int %dead_int_18 %dead_int_19", + "%dead_vec_b = OpSpecConstantOp %v2int IMul %dead_vec_a %dead_vec_a", + "%dead_int_21 = OpSpecConstantOp %int CompositeExtract %dead_vec_b 0", + "%dead_array = OpConstantComposite %type_arr_int_4 %dead_int_20 %used_int_20 %dead_int_19 %used_int_19", + }, + }, + // Long Def-Use chain with swizzle + // clang-format on + }))); + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/eliminate_dead_functions_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/eliminate_dead_functions_test.cpp new file mode 100644 index 00000000000..0a3d490a8f8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/eliminate_dead_functions_test.cpp @@ -0,0 +1,209 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::HasSubstr; +using EliminateDeadFunctionsBasicTest = PassTest<::testing::Test>; + +TEST_F(EliminateDeadFunctionsBasicTest, BasicDeleteDeadFunction) { + // The function Dead should be removed because it is never called. + const std::vector common_code = { + // clang-format off + "OpCapability Shader", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\"", + "OpName %main \"main\"", + "OpName %Live \"Live\"", + "%void = OpTypeVoid", + "%7 = OpTypeFunction %void", + "%main = OpFunction %void None %7", + "%15 = OpLabel", + "%16 = OpFunctionCall %void %Live", + "%17 = OpFunctionCall %void %Live", + "OpReturn", + "OpFunctionEnd", + "%Live = OpFunction %void None %7", + "%20 = OpLabel", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + const std::vector dead_function = { + // clang-format off + "%Dead = OpFunction %void None %7", + "%19 = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + JoinAllInsts(Concat(common_code, dead_function)), + JoinAllInsts(common_code), /* skip_nop = */ true); +} + +TEST_F(EliminateDeadFunctionsBasicTest, BasicKeepLiveFunction) { + // Everything is reachable from an entry point, so no functions should be + // deleted. + const std::vector text = { + // clang-format off + "OpCapability Shader", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\"", + "OpName %main \"main\"", + "OpName %Live1 \"Live1\"", + "OpName %Live2 \"Live2\"", + "%void = OpTypeVoid", + "%7 = OpTypeFunction %void", + "%main = OpFunction %void None %7", + "%15 = OpLabel", + "%16 = OpFunctionCall %void %Live2", + "%17 = OpFunctionCall %void %Live1", + "OpReturn", + "OpFunctionEnd", + "%Live1 = OpFunction %void None %7", + "%19 = OpLabel", + "OpReturn", + "OpFunctionEnd", + "%Live2 = OpFunction %void None %7", + "%20 = OpLabel", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + std::string assembly = JoinAllInsts(text); + auto result = SinglePassRunAndDisassemble( + assembly, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); + EXPECT_EQ(assembly, std::get<0>(result)); +} + +TEST_F(EliminateDeadFunctionsBasicTest, BasicKeepExportFunctions) { + // All functions are reachable. In particular, ExportedFunc and Constant are + // reachable because ExportedFunc is exported. Nothing should be removed. + const std::vector text = { + // clang-format off + "OpCapability Shader", + "OpCapability Linkage", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\"", + "OpName %main \"main\"", + "OpName %ExportedFunc \"ExportedFunc\"", + "OpName %Live \"Live\"", + "OpDecorate %ExportedFunc LinkageAttributes \"ExportedFunc\" Export", + "%void = OpTypeVoid", + "%7 = OpTypeFunction %void", + "%main = OpFunction %void None %7", + "%15 = OpLabel", + "OpReturn", + "OpFunctionEnd", +"%ExportedFunc = OpFunction %void None %7", + "%19 = OpLabel", + "%16 = OpFunctionCall %void %Live", + "OpReturn", + "OpFunctionEnd", + "%Live = OpFunction %void None %7", + "%20 = OpLabel", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + std::string assembly = JoinAllInsts(text); + auto result = SinglePassRunAndDisassemble( + assembly, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); + EXPECT_EQ(assembly, std::get<0>(result)); +} + +TEST_F(EliminateDeadFunctionsBasicTest, BasicRemoveDecorationsAndNames) { + // We want to remove the names and decorations associated with results that + // are removed. This test will check for that. + const std::string text = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + OpName %Dead "Dead" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpDecorate %x RelaxedPrecision + OpDecorate %y RelaxedPrecision + OpDecorate %z RelaxedPrecision + OpDecorate %6 RelaxedPrecision + OpDecorate %7 RelaxedPrecision + OpDecorate %8 RelaxedPrecision + %void = OpTypeVoid + %10 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %10 + %14 = OpLabel + OpReturn + OpFunctionEnd + %Dead = OpFunction %void None %10 + %15 = OpLabel + %x = OpVariable %_ptr_Function_float Function + %y = OpVariable %_ptr_Function_float Function + %z = OpVariable %_ptr_Function_float Function + OpStore %x %float_1 + OpStore %y %float_1 + %6 = OpLoad %float %x + %7 = OpLoad %float %y + %8 = OpFAdd %float %6 %7 + OpStore %z %8 + OpReturn + OpFunctionEnd)"; + + const std::string expected_output = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpName %main "main" +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_1 = OpConstant %float 1 +%main = OpFunction %void None %10 +%14 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(text, expected_output, + /* skip_nop = */ true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/feature_manager_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/feature_manager_test.cpp new file mode 100644 index 00000000000..767376cf5e5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/feature_manager_test.cpp @@ -0,0 +1,142 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace opt { +namespace { + +using FeatureManagerTest = ::testing::Test; + +TEST_F(FeatureManagerTest, MissingExtension) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_FALSE(context->get_feature_mgr()->HasExtension( + Extension::kSPV_KHR_variable_pointers)); +} + +TEST_F(FeatureManagerTest, OneExtension) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpExtension "SPV_KHR_variable_pointers" + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_TRUE(context->get_feature_mgr()->HasExtension( + Extension::kSPV_KHR_variable_pointers)); +} + +TEST_F(FeatureManagerTest, NotADifferentExtension) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpExtension "SPV_KHR_variable_pointers" + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_FALSE(context->get_feature_mgr()->HasExtension( + Extension::kSPV_KHR_storage_buffer_storage_class)); +} + +TEST_F(FeatureManagerTest, TwoExtensions) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpExtension "SPV_KHR_variable_pointers" +OpExtension "SPV_KHR_storage_buffer_storage_class" + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_TRUE(context->get_feature_mgr()->HasExtension( + Extension::kSPV_KHR_variable_pointers)); + EXPECT_TRUE(context->get_feature_mgr()->HasExtension( + Extension::kSPV_KHR_storage_buffer_storage_class)); +} + +// Test capability checks. +TEST_F(FeatureManagerTest, ExplicitlyPresent1) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_TRUE(context->get_feature_mgr()->HasCapability(SpvCapabilityShader)); + EXPECT_FALSE(context->get_feature_mgr()->HasCapability(SpvCapabilityKernel)); +} + +TEST_F(FeatureManagerTest, ExplicitlyPresent2) { + const std::string text = R"( +OpCapability Kernel +OpMemoryModel Logical GLSL450 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + EXPECT_FALSE(context->get_feature_mgr()->HasCapability(SpvCapabilityShader)); + EXPECT_TRUE(context->get_feature_mgr()->HasCapability(SpvCapabilityKernel)); +} + +TEST_F(FeatureManagerTest, ImplicitlyPresent) { + const std::string text = R"( +OpCapability Tessellation +OpMemoryModel Logical GLSL450 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ASSERT_NE(context, nullptr); + + // Check multiple levels of indirection. Tessellation implies Shader, which + // implies Matrix. + EXPECT_TRUE( + context->get_feature_mgr()->HasCapability(SpvCapabilityTessellation)); + EXPECT_TRUE(context->get_feature_mgr()->HasCapability(SpvCapabilityShader)); + EXPECT_TRUE(context->get_feature_mgr()->HasCapability(SpvCapabilityMatrix)); + EXPECT_FALSE(context->get_feature_mgr()->HasCapability(SpvCapabilityKernel)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp new file mode 100644 index 00000000000..483ee6e53c9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp @@ -0,0 +1,238 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +// Returns the initial part of the assembly text for a valid +// SPIR-V module, including instructions prior to decorations. +std::string PreambleAssembly() { + return + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %hue %saturation %value +OpName %main "main" +OpName %void_fn "void_fn" +OpName %hue "hue" +OpName %saturation "saturation" +OpName %value "value" +OpName %entry "entry" +OpName %Point "Point" +OpName %Camera "Camera" +)"; +} + +// Retuns types +std::string TypesAndFunctionsAssembly() { + return + R"(%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%float = OpTypeFloat 32 +%Point = OpTypeStruct %float %float %float +%Camera = OpTypeStruct %float %float +%_ptr_Input_float = OpTypePointer Input %float +%hue = OpVariable %_ptr_Input_float Input +%saturation = OpVariable %_ptr_Input_float Input +%value = OpVariable %_ptr_Input_float Input +%main = OpFunction %void None %void_fn +%entry = OpLabel +OpReturn +OpFunctionEnd +)"; +} + +struct FlattenDecorationCase { + // Names and decorations before the pass. + std::string input; + // Names and decorations after the pass. + std::string expected; +}; + +using FlattenDecorationTest = + PassTest<::testing::TestWithParam>; + +TEST_P(FlattenDecorationTest, TransformsDecorations) { + const auto before = + PreambleAssembly() + GetParam().input + TypesAndFunctionsAssembly(); + const auto after = + PreambleAssembly() + GetParam().expected + TypesAndFunctionsAssembly(); + + SinglePassRunAndCheck(before, after, false, true); +} + +INSTANTIATE_TEST_CASE_P(NoUses, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // No OpDecorationGroup + {"", ""}, + + // OpDecorationGroup without any uses, and + // no OpName. + {"%group = OpDecorationGroup\n", ""}, + + // OpDecorationGroup without any uses, and + // with OpName targeting it. Proves you must + // remove the names as well. + {"OpName %group \"group\"\n" + "%group = OpDecorationGroup\n", + ""}, + + // OpDecorationGroup with decorations that + // target it, but no uses in OpGroupDecorate + // or OpGroupMemberDecorate instructions. + {"OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n", + ""}, + }), ); + +INSTANTIATE_TEST_CASE_P(OpGroupDecorate, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // One OpGroupDecorate + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %saturation Flat\n" + "OpDecorate %hue NoPerspective\n" + "OpDecorate %saturation NoPerspective\n"}, + // Multiple OpGroupDecorate + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %value\n" + "OpGroupDecorate %group %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %value Flat\n" + "OpDecorate %saturation Flat\n" + "OpDecorate %hue NoPerspective\n" + "OpDecorate %value NoPerspective\n" + "OpDecorate %saturation NoPerspective\n"}, + // Two group decorations, interleaved + {"OpName %group0 \"group0\"\n" + "OpName %group1 \"group1\"\n" + "OpDecorate %group0 Flat\n" + "OpDecorate %group1 NoPerspective\n" + "%group0 = OpDecorationGroup\n" + "%group1 = OpDecorationGroup\n" + "OpGroupDecorate %group0 %hue %value\n" + "OpGroupDecorate %group1 %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %value Flat\n" + "OpDecorate %saturation NoPerspective\n"}, + // Decoration with operands + {"OpName %group \"group\"\n" + "OpDecorate %group Location 42\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %saturation\n", + "OpDecorate %hue Location 42\n" + "OpDecorate %saturation Location 42\n"}, + }), ); + +INSTANTIATE_TEST_CASE_P(OpGroupMemberDecorate, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // One OpGroupMemberDecorate + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group Offset 16\n" + "%group = OpDecorationGroup\n" + "OpGroupMemberDecorate %group %Point 1\n", + "OpMemberDecorate %Point 1 Flat\n" + "OpMemberDecorate %Point 1 Offset 16\n"}, + // Multiple OpGroupMemberDecorate using the same + // decoration group. + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "OpDecorate %group Offset 8\n" + "%group = OpDecorationGroup\n" + "OpGroupMemberDecorate %group %Point 2\n" + "OpGroupMemberDecorate %group %Camera 1\n", + "OpMemberDecorate %Point 2 Flat\n" + "OpMemberDecorate %Camera 1 Flat\n" + "OpMemberDecorate %Point 2 NoPerspective\n" + "OpMemberDecorate %Camera 1 NoPerspective\n" + "OpMemberDecorate %Point 2 Offset 8\n" + "OpMemberDecorate %Camera 1 Offset 8\n"}, + // Two groups of member decorations, interleaved. + // Decoration is with and without operands. + {"OpName %group0 \"group0\"\n" + "OpName %group1 \"group1\"\n" + "OpDecorate %group0 Flat\n" + "OpDecorate %group0 Offset 8\n" + "OpDecorate %group1 NoPerspective\n" + "OpDecorate %group1 Offset 16\n" + "%group0 = OpDecorationGroup\n" + "%group1 = OpDecorationGroup\n" + "OpGroupMemberDecorate %group0 %Point 0\n" + "OpGroupMemberDecorate %group1 %Point 2\n", + "OpMemberDecorate %Point 0 Flat\n" + "OpMemberDecorate %Point 0 Offset 8\n" + "OpMemberDecorate %Point 2 NoPerspective\n" + "OpMemberDecorate %Point 2 Offset 16\n"}, + }), ); + +INSTANTIATE_TEST_CASE_P(UnrelatedDecorations, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // A non-group non-member decoration is untouched. + {"OpDecorate %hue Centroid\n" + "OpDecorate %saturation Flat\n", + "OpDecorate %hue Centroid\n" + "OpDecorate %saturation Flat\n"}, + // A non-group member decoration is untouched. + {"OpMemberDecorate %Point 0 Offset 0\n" + "OpMemberDecorate %Point 1 Offset 4\n" + "OpMemberDecorate %Point 1 Flat\n", + "OpMemberDecorate %Point 0 Offset 0\n" + "OpMemberDecorate %Point 1 Offset 4\n" + "OpMemberDecorate %Point 1 Flat\n"}, + // A non-group non-member decoration survives any + // replacement of group decorations. + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %hue Centroid\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %saturation Flat\n" + "OpDecorate %hue Centroid\n" + "OpDecorate %hue NoPerspective\n" + "OpDecorate %saturation NoPerspective\n"}, + // A non-group member decoration survives any + // replacement of group decorations. + {"OpDecorate %group Offset 0\n" + "OpDecorate %group Flat\n" + "OpMemberDecorate %Point 1 Offset 4\n" + "%group = OpDecorationGroup\n" + "OpGroupMemberDecorate %group %Point 0\n", + "OpMemberDecorate %Point 0 Offset 0\n" + "OpMemberDecorate %Point 0 Flat\n" + "OpMemberDecorate %Point 1 Offset 4\n"}, + }), ); + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp new file mode 100644 index 00000000000..8ecfd5c7882 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp @@ -0,0 +1,1394 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include + +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using FoldSpecConstantOpAndCompositePassBasicTest = PassTest<::testing::Test>; + +TEST_F(FoldSpecConstantOpAndCompositePassBasicTest, Empty) { + SinglePassRunAndCheck( + "", "", /* skip_nop = */ true); +} + +// A test of the basic functionality of FoldSpecConstantOpAndCompositePass. +// A spec constant defined with an integer addition operation should be folded +// to a normal constant with fixed value. +TEST_F(FoldSpecConstantOpAndCompositePassBasicTest, Basic) { + AssemblyBuilder builder; + builder.AppendTypesConstantsGlobals({ + // clang-format off + "%int = OpTypeInt 32 1", + "%frozen_spec_const_int = OpConstant %int 1", + "%const_int = OpConstant %int 2", + // Folding target: + "%spec_add = OpSpecConstantOp %int IAdd %frozen_spec_const_int %const_int", + // clang-format on + }); + + std::vector expected = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %void \"void\"", + "OpName %main_func_type \"main_func_type\"", + "OpName %main \"main\"", + "OpName %main_func_entry_block \"main_func_entry_block\"", + "OpName %int \"int\"", + "OpName %frozen_spec_const_int \"frozen_spec_const_int\"", + "OpName %const_int \"const_int\"", + "OpName %spec_add \"spec_add\"", + "%void = OpTypeVoid", + "%main_func_type = OpTypeFunction %void", + "%int = OpTypeInt 32 1", +"%frozen_spec_const_int = OpConstant %int 1", + "%const_int = OpConstant %int 2", + // The SpecConstantOp IAdd instruction should be replace by OpConstant + // instruction: + "%spec_add = OpConstant %int 3", + "%main = OpFunction %void None %main_func_type", +"%main_func_entry_block = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + builder.GetCode(), JoinAllInsts(expected), /* skip_nop = */ true); +} + +// A test of skipping folding an instruction when the instruction result type +// has decorations. +TEST_F(FoldSpecConstantOpAndCompositePassBasicTest, + SkipWhenTypeHasDecorations) { + AssemblyBuilder builder; + builder + .AppendAnnotations({ + // clang-format off + "OpDecorate %int RelaxedPrecision", + // clang-format on + }) + .AppendTypesConstantsGlobals({ + // clang-format off + "%int = OpTypeInt 32 1", + "%frozen_spec_const_int = OpConstant %int 1", + "%const_int = OpConstant %int 2", + // The following spec constant should not be folded as the result type + // has relaxed precision decoration. + "%spec_add = OpSpecConstantOp %int IAdd %frozen_spec_const_int %const_int", + // clang-format on + }); + + SinglePassRunAndCheck( + builder.GetCode(), builder.GetCode(), /* skip_nop = */ true); +} + +// All types and some common constants that are potentially required in +// FoldSpecConstantOpAndCompositeTest. +std::vector CommonTypesAndConstants() { + return std::vector{ + // clang-format off + // scalar types + "%bool = OpTypeBool", + "%uint = OpTypeInt 32 0", + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%double = OpTypeFloat 64", + // vector types + "%v2bool = OpTypeVector %bool 2", + "%v2uint = OpTypeVector %uint 2", + "%v2int = OpTypeVector %int 2", + "%v3int = OpTypeVector %int 3", + "%v4int = OpTypeVector %int 4", + "%v2float = OpTypeVector %float 2", + "%v2double = OpTypeVector %double 2", + // variable pointer types + "%_pf_bool = OpTypePointer Function %bool", + "%_pf_uint = OpTypePointer Function %uint", + "%_pf_int = OpTypePointer Function %int", + "%_pf_float = OpTypePointer Function %float", + "%_pf_double = OpTypePointer Function %double", + "%_pf_v2int = OpTypePointer Function %v2int", + "%_pf_v2float = OpTypePointer Function %v2float", + "%_pf_v2double = OpTypePointer Function %v2double", + // struct types + "%inner_struct = OpTypeStruct %bool %int %float", + "%outer_struct = OpTypeStruct %inner_struct %int", + "%flat_struct = OpTypeStruct %bool %int %float", + + // common constants + // scalar constants: + "%bool_true = OpConstantTrue %bool", + "%bool_false = OpConstantFalse %bool", + "%bool_null = OpConstantNull %bool", + "%signed_zero = OpConstant %int 0", + "%unsigned_zero = OpConstant %uint 0", + "%signed_one = OpConstant %int 1", + "%unsigned_one = OpConstant %uint 1", + "%signed_two = OpConstant %int 2", + "%unsigned_two = OpConstant %uint 2", + "%signed_three = OpConstant %int 3", + "%unsigned_three = OpConstant %uint 3", + "%signed_null = OpConstantNull %int", + "%unsigned_null = OpConstantNull %uint", + // vector constants: + "%bool_true_vec = OpConstantComposite %v2bool %bool_true %bool_true", + "%bool_false_vec = OpConstantComposite %v2bool %bool_false %bool_false", + "%bool_null_vec = OpConstantNull %v2bool", + "%signed_zero_vec = OpConstantComposite %v2int %signed_zero %signed_zero", + "%unsigned_zero_vec = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + "%signed_one_vec = OpConstantComposite %v2int %signed_one %signed_one", + "%unsigned_one_vec = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + "%signed_two_vec = OpConstantComposite %v2int %signed_two %signed_two", + "%unsigned_two_vec = OpConstantComposite %v2uint %unsigned_two %unsigned_two", + "%signed_three_vec = OpConstantComposite %v2int %signed_three %signed_three", + "%unsigned_three_vec = OpConstantComposite %v2uint %unsigned_three %unsigned_three", + "%signed_null_vec = OpConstantNull %v2int", + "%unsigned_null_vec = OpConstantNull %v2uint", + "%v4int_0_1_2_3 = OpConstantComposite %v4int %signed_zero %signed_one %signed_two %signed_three", + // clang-format on + }; +} + +// A helper function to strip OpName instructions from the given string of +// disassembly code. Returns the string with all OpName instruction stripped. +std::string StripOpNameInstructions(const std::string& str) { + std::stringstream ss(str); + std::ostringstream oss; + std::string inst_str; + while (std::getline(ss, inst_str, '\n')) { + if (inst_str.find("OpName %") == std::string::npos) { + oss << inst_str << '\n'; + } + } + return oss.str(); +} + +struct FoldSpecConstantOpAndCompositePassTestCase { + // Original constants with unfolded spec constants. + std::vector original; + // Expected cosntants after folding. + std::vector expected; +}; + +using FoldSpecConstantOpAndCompositePassTest = PassTest< + ::testing::TestWithParam>; + +TEST_P(FoldSpecConstantOpAndCompositePassTest, ParamTestCase) { + AssemblyBuilder test_code_builder, expected_code_builder; + const auto& tc = GetParam(); + test_code_builder.AppendTypesConstantsGlobals(CommonTypesAndConstants()); + test_code_builder.AppendTypesConstantsGlobals(tc.original); + expected_code_builder.AppendTypesConstantsGlobals(CommonTypesAndConstants()); + expected_code_builder.AppendTypesConstantsGlobals(tc.expected); + const std::string original = test_code_builder.GetCode(); + const std::string expected = expected_code_builder.GetCode(); + + // Run the optimization and get the result code in disassembly. + std::string optimized; + auto status = Pass::Status::SuccessWithoutChange; + std::tie(optimized, status) = + SinglePassRunAndDisassemble( + original, /* skip_nop = */ true, /* do_validation = */ false); + + // Check the optimized code, but ignore the OpName instructions. + EXPECT_NE(Pass::Status::Failure, status); + EXPECT_EQ( + StripOpNameInstructions(expected) == StripOpNameInstructions(original), + status == Pass::Status::SuccessWithoutChange); + EXPECT_EQ(StripOpNameInstructions(expected), + StripOpNameInstructions(optimized)); +} + +// Tests that OpSpecConstantComposite opcodes are replace with +// OpConstantComposite correctly. +INSTANTIATE_TEST_CASE_P( + Composite, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // normal vector + { + // original + { + "%spec_v2bool = OpSpecConstantComposite %v2bool %bool_true %bool_false", + "%spec_v2uint = OpSpecConstantComposite %v2uint %unsigned_one %unsigned_one", + "%spec_v2int_a = OpSpecConstantComposite %v2int %signed_one %signed_two", + // Spec constants whose value can not be fully resolved should + // not be processed. + "%spec_int = OpSpecConstant %int 99", + "%spec_v2int_b = OpSpecConstantComposite %v2int %signed_one %spec_int", + }, + // expected + { + "%spec_v2bool = OpConstantComposite %v2bool %bool_true %bool_false", + "%spec_v2uint = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + "%spec_v2int_a = OpConstantComposite %v2int %signed_one %signed_two", + "%spec_int = OpSpecConstant %int 99", + "%spec_v2int_b = OpSpecConstantComposite %v2int %signed_one %spec_int", + }, + }, + // vector with null constants + { + // original + { + "%null_bool = OpConstantNull %bool", + "%null_int = OpConstantNull %int", + "%spec_v2bool = OpSpecConstantComposite %v2bool %null_bool %null_bool", + "%spec_v3int = OpSpecConstantComposite %v3int %null_int %null_int %null_int", + "%spec_v4int = OpSpecConstantComposite %v4int %null_int %null_int %null_int %null_int", + }, + // expected + { + "%null_bool = OpConstantNull %bool", + "%null_int = OpConstantNull %int", + "%spec_v2bool = OpConstantComposite %v2bool %null_bool %null_bool", + "%spec_v3int = OpConstantComposite %v3int %null_int %null_int %null_int", + "%spec_v4int = OpConstantComposite %v4int %null_int %null_int %null_int %null_int", + }, + }, + // flat struct + { + // original + { + "%float_1 = OpConstant %float 1", + "%flat_1 = OpSpecConstantComposite %flat_struct %bool_true %signed_null %float_1", + // following struct should not be folded as the value of + // %spec_float is not determined. + "%spec_float = OpSpecConstant %float 1", + "%flat_2 = OpSpecConstantComposite %flat_struct %bool_true %signed_one %spec_float", + }, + // expected + { + "%float_1 = OpConstant %float 1", + "%flat_1 = OpConstantComposite %flat_struct %bool_true %signed_null %float_1", + "%spec_float = OpSpecConstant %float 1", + "%flat_2 = OpSpecConstantComposite %flat_struct %bool_true %signed_one %spec_float", + } + }, + // nested struct + { + // original + { + "%float_1 = OpConstant %float 1", + "%inner_1 = OpSpecConstantComposite %inner_struct %bool_true %signed_null %float_1", + "%outer_1 = OpSpecConstantComposite %outer_struct %inner_1 %signed_one", + // following structs should not be folded as the value of + // %spec_float is not determined. + "%spec_float = OpSpecConstant %float 1", + "%inner_2 = OpSpecConstantComposite %inner_struct %bool_true %signed_null %spec_float", + "%outer_2 = OpSpecConstantComposite %outer_struct %inner_2 %signed_one", + }, + // expected + { + "%float_1 = OpConstant %float 1", + "%inner_1 = OpConstantComposite %inner_struct %bool_true %signed_null %float_1", + "%outer_1 = OpConstantComposite %outer_struct %inner_1 %signed_one", + "%spec_float = OpSpecConstant %float 1", + "%inner_2 = OpSpecConstantComposite %inner_struct %bool_true %signed_null %spec_float", + "%outer_2 = OpSpecConstantComposite %outer_struct %inner_2 %signed_one", + } + }, + // composite constants touched by OpUndef should be skipped + { + // original + { + "%undef = OpUndef %float", + "%inner = OpConstantComposite %inner_struct %bool_true %signed_one %undef", + "%outer = OpSpecConstantComposite %outer_struct %inner %signed_one", + }, + // expected + { + "%undef = OpUndef %float", + "%inner = OpConstantComposite %inner_struct %bool_true %signed_one %undef", + "%outer = OpSpecConstantComposite %outer_struct %inner %signed_one", + }, + } + // clang-format on + }))); + +// Tests for operations that resulting in different types. +INSTANTIATE_TEST_CASE_P( + Cast, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn( + std::vector({ + // clang-format off + // int -> bool scalar + { + // original + { + "%spec_bool_t = OpSpecConstantOp %bool INotEqual %signed_three %signed_zero", + "%spec_bool_f = OpSpecConstantOp %bool INotEqual %signed_zero %signed_zero", + "%spec_bool_from_null = OpSpecConstantOp %bool INotEqual %signed_null %signed_zero", + }, + // expected + { + "%spec_bool_t = OpConstantTrue %bool", + "%spec_bool_f = OpConstantFalse %bool", + "%spec_bool_from_null = OpConstantFalse %bool", + }, + }, + + // uint -> bool scalar + { + // original + { + "%spec_bool_t = OpSpecConstantOp %bool INotEqual %unsigned_three %unsigned_zero", + "%spec_bool_f = OpSpecConstantOp %bool INotEqual %unsigned_zero %unsigned_zero", + "%spec_bool_from_null = OpSpecConstantOp %bool INotEqual %unsigned_null %unsigned_zero", + }, + // expected + { + "%spec_bool_t = OpConstantTrue %bool", + "%spec_bool_f = OpConstantFalse %bool", + "%spec_bool_from_null = OpConstantFalse %bool", + }, + }, + + // bool -> int scalar + { + // original + { + "%spec_int_one = OpSpecConstantOp %int Select %bool_true %signed_one %signed_zero", + "%spec_int_zero = OpSpecConstantOp %int Select %bool_false %signed_one %signed_zero", + "%spec_int_from_null = OpSpecConstantOp %int Select %bool_null %signed_one %signed_zero", + }, + // expected + { + "%spec_int_one = OpConstant %int 1", + "%spec_int_zero = OpConstant %int 0", + "%spec_int_from_null = OpConstant %int 0", + }, + }, + + // uint -> int scalar + { + // original + { + "%spec_int_one = OpSpecConstantOp %int IAdd %unsigned_one %signed_zero", + "%spec_int_zero = OpSpecConstantOp %int IAdd %unsigned_zero %signed_zero", + "%spec_int_from_null = OpSpecConstantOp %int IAdd %unsigned_null %unsigned_zero", + }, + // expected + { + "%spec_int_one = OpConstant %int 1", + "%spec_int_zero = OpConstant %int 0", + "%spec_int_from_null = OpConstant %int 0", + }, + }, + + // bool -> uint scalar + { + // original + { + "%spec_uint_one = OpSpecConstantOp %uint Select %bool_true %unsigned_one %unsigned_zero", + "%spec_uint_zero = OpSpecConstantOp %uint Select %bool_false %unsigned_one %unsigned_zero", + "%spec_uint_from_null = OpSpecConstantOp %uint Select %bool_null %unsigned_one %unsigned_zero", + }, + // expected + { + "%spec_uint_one = OpConstant %uint 1", + "%spec_uint_zero = OpConstant %uint 0", + "%spec_uint_from_null = OpConstant %uint 0", + }, + }, + + // int -> uint scalar + { + // original + { + "%spec_uint_one = OpSpecConstantOp %uint IAdd %signed_one %unsigned_zero", + "%spec_uint_zero = OpSpecConstantOp %uint IAdd %signed_zero %unsigned_zero", + "%spec_uint_from_null = OpSpecConstantOp %uint IAdd %signed_null %unsigned_zero", + }, + // expected + { + "%spec_uint_one = OpConstant %uint 1", + "%spec_uint_zero = OpConstant %uint 0", + "%spec_uint_from_null = OpConstant %uint 0", + }, + }, + + // int -> bool vector + { + // original + { + "%spec_bool_t_vec = OpSpecConstantOp %v2bool INotEqual %signed_three_vec %signed_zero_vec", + "%spec_bool_f_vec = OpSpecConstantOp %v2bool INotEqual %signed_zero_vec %signed_zero_vec", + "%spec_bool_from_null = OpSpecConstantOp %v2bool INotEqual %signed_null_vec %signed_zero_vec", + }, + // expected + { + "%true = OpConstantTrue %bool", + "%true_0 = OpConstantTrue %bool", + "%spec_bool_t_vec = OpConstantComposite %v2bool %bool_true %bool_true", + "%false = OpConstantFalse %bool", + "%false_0 = OpConstantFalse %bool", + "%spec_bool_f_vec = OpConstantComposite %v2bool %bool_false %bool_false", + "%false_1 = OpConstantFalse %bool", + "%false_2 = OpConstantFalse %bool", + "%spec_bool_from_null = OpConstantComposite %v2bool %bool_false %bool_false", + }, + }, + + // uint -> bool vector + { + // original + { + "%spec_bool_t_vec = OpSpecConstantOp %v2bool INotEqual %unsigned_three_vec %unsigned_zero_vec", + "%spec_bool_f_vec = OpSpecConstantOp %v2bool INotEqual %unsigned_zero_vec %unsigned_zero_vec", + "%spec_bool_from_null = OpSpecConstantOp %v2bool INotEqual %unsigned_null_vec %unsigned_zero_vec", + }, + // expected + { + "%true = OpConstantTrue %bool", + "%true_0 = OpConstantTrue %bool", + "%spec_bool_t_vec = OpConstantComposite %v2bool %bool_true %bool_true", + "%false = OpConstantFalse %bool", + "%false_0 = OpConstantFalse %bool", + "%spec_bool_f_vec = OpConstantComposite %v2bool %bool_false %bool_false", + "%false_1 = OpConstantFalse %bool", + "%false_2 = OpConstantFalse %bool", + "%spec_bool_from_null = OpConstantComposite %v2bool %bool_false %bool_false", + }, + }, + + // bool -> int vector + { + // original + { + "%spec_int_one_vec = OpSpecConstantOp %v2int Select %bool_true_vec %signed_one_vec %signed_zero_vec", + "%spec_int_zero_vec = OpSpecConstantOp %v2int Select %bool_false_vec %signed_one_vec %signed_zero_vec", + "%spec_int_from_null = OpSpecConstantOp %v2int Select %bool_null_vec %signed_one_vec %signed_zero_vec", + }, + // expected + { + "%int_1 = OpConstant %int 1", + "%int_1_0 = OpConstant %int 1", + "%spec_int_one_vec = OpConstantComposite %v2int %signed_one %signed_one", + "%int_0 = OpConstant %int 0", + "%int_0_0 = OpConstant %int 0", + "%spec_int_zero_vec = OpConstantComposite %v2int %signed_zero %signed_zero", + "%int_0_1 = OpConstant %int 0", + "%int_0_2 = OpConstant %int 0", + "%spec_int_from_null = OpConstantComposite %v2int %signed_zero %signed_zero", + }, + }, + + // uint -> int vector + { + // original + { + "%spec_int_one_vec = OpSpecConstantOp %v2int IAdd %unsigned_one_vec %signed_zero_vec", + "%spec_int_zero_vec = OpSpecConstantOp %v2int IAdd %unsigned_zero_vec %signed_zero_vec", + "%spec_int_from_null = OpSpecConstantOp %v2int IAdd %unsigned_null_vec %signed_zero_vec", + }, + // expected + { + "%int_1 = OpConstant %int 1", + "%int_1_0 = OpConstant %int 1", + "%spec_int_one_vec = OpConstantComposite %v2int %signed_one %signed_one", + "%int_0 = OpConstant %int 0", + "%int_0_0 = OpConstant %int 0", + "%spec_int_zero_vec = OpConstantComposite %v2int %signed_zero %signed_zero", + "%int_0_1 = OpConstant %int 0", + "%int_0_2 = OpConstant %int 0", + "%spec_int_from_null = OpConstantComposite %v2int %signed_zero %signed_zero", + }, + }, + + // bool -> uint vector + { + // original + { + "%spec_uint_one_vec = OpSpecConstantOp %v2uint Select %bool_true_vec %unsigned_one_vec %unsigned_zero_vec", + "%spec_uint_zero_vec = OpSpecConstantOp %v2uint Select %bool_false_vec %unsigned_one_vec %unsigned_zero_vec", + "%spec_uint_from_null = OpSpecConstantOp %v2uint Select %bool_null_vec %unsigned_one_vec %unsigned_zero_vec", + }, + // expected + { + "%uint_1 = OpConstant %uint 1", + "%uint_1_0 = OpConstant %uint 1", + "%spec_uint_one_vec = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + "%uint_0 = OpConstant %uint 0", + "%uint_0_0 = OpConstant %uint 0", + "%spec_uint_zero_vec = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + "%uint_0_1 = OpConstant %uint 0", + "%uint_0_2 = OpConstant %uint 0", + "%spec_uint_from_null = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + }, + }, + + // int -> uint vector + { + // original + { + "%spec_uint_one_vec = OpSpecConstantOp %v2uint IAdd %signed_one_vec %unsigned_zero_vec", + "%spec_uint_zero_vec = OpSpecConstantOp %v2uint IAdd %signed_zero_vec %unsigned_zero_vec", + "%spec_uint_from_null = OpSpecConstantOp %v2uint IAdd %signed_null_vec %unsigned_zero_vec", + }, + // expected + { + "%uint_1 = OpConstant %uint 1", + "%uint_1_0 = OpConstant %uint 1", + "%spec_uint_one_vec = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + "%uint_0 = OpConstant %uint 0", + "%uint_0_0 = OpConstant %uint 0", + "%spec_uint_zero_vec = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + "%uint_0_1 = OpConstant %uint 0", + "%uint_0_2 = OpConstant %uint 0", + "%spec_uint_from_null = OpConstantComposite %v2uint %unsigned_zero %unsigned_zero", + }, + }, + // clang-format on + }))); + +// Tests about boolean scalar logical operations and comparison operations with +// scalar int/uint type. +INSTANTIATE_TEST_CASE_P( + Logical, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // scalar integer comparison + { + // original + { + "%int_minus_1 = OpConstant %int -1", + + "%slt_0_1 = OpSpecConstantOp %bool SLessThan %signed_zero %signed_one", + "%sgt_0_1 = OpSpecConstantOp %bool SGreaterThan %signed_zero %signed_one", + "%sle_2_2 = OpSpecConstantOp %bool SLessThanEqual %signed_two %signed_two", + "%sge_2_1 = OpSpecConstantOp %bool SGreaterThanEqual %signed_two %signed_one", + "%sge_2_null = OpSpecConstantOp %bool SGreaterThanEqual %signed_two %signed_null", + "%sge_minus_1_null = OpSpecConstantOp %bool SGreaterThanEqual %int_minus_1 %signed_null", + + "%ult_0_1 = OpSpecConstantOp %bool ULessThan %unsigned_zero %unsigned_one", + "%ugt_0_1 = OpSpecConstantOp %bool UGreaterThan %unsigned_zero %unsigned_one", + "%ule_2_3 = OpSpecConstantOp %bool ULessThanEqual %unsigned_two %unsigned_three", + "%uge_1_1 = OpSpecConstantOp %bool UGreaterThanEqual %unsigned_one %unsigned_one", + "%uge_2_null = OpSpecConstantOp %bool UGreaterThanEqual %unsigned_two %unsigned_null", + "%uge_minus_1_null = OpSpecConstantOp %bool UGreaterThanEqual %int_minus_1 %unsigned_null", + }, + // expected + { + "%int_minus_1 = OpConstant %int -1", + + "%slt_0_1 = OpConstantTrue %bool", + "%sgt_0_1 = OpConstantFalse %bool", + "%sle_2_2 = OpConstantTrue %bool", + "%sge_2_1 = OpConstantTrue %bool", + "%sge_2_null = OpConstantTrue %bool", + "%sge_minus_1_null = OpConstantFalse %bool", + + "%ult_0_1 = OpConstantTrue %bool", + "%ugt_0_1 = OpConstantFalse %bool", + "%ule_2_3 = OpConstantTrue %bool", + "%uge_1_1 = OpConstantTrue %bool", + "%uge_2_null = OpConstantTrue %bool", + "%uge_minus_1_null = OpConstantTrue %bool", + }, + }, + // Logical and, or, xor. + { + // original + { + "%logical_or = OpSpecConstantOp %bool LogicalOr %bool_true %bool_false", + "%logical_and = OpSpecConstantOp %bool LogicalAnd %bool_true %bool_false", + "%logical_not = OpSpecConstantOp %bool LogicalNot %bool_true", + "%logical_eq = OpSpecConstantOp %bool LogicalEqual %bool_true %bool_true", + "%logical_neq = OpSpecConstantOp %bool LogicalNotEqual %bool_true %bool_true", + "%logical_and_null = OpSpecConstantOp %bool LogicalAnd %bool_true %bool_null", + }, + // expected + { + "%logical_or = OpConstantTrue %bool", + "%logical_and = OpConstantFalse %bool", + "%logical_not = OpConstantFalse %bool", + "%logical_eq = OpConstantTrue %bool", + "%logical_neq = OpConstantFalse %bool", + "%logical_and_null = OpConstantFalse %bool", + }, + }, + // clang-format on + }))); + +// Tests about arithmetic operations for scalar int and uint types. +INSTANTIATE_TEST_CASE_P( + ScalarArithmetic, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // scalar integer negate + { + // original + { + "%int_minus_1 = OpSpecConstantOp %int SNegate %signed_one", + "%int_minus_2 = OpSpecConstantOp %int SNegate %signed_two", + "%int_neg_null = OpSpecConstantOp %int SNegate %signed_null", + "%int_max = OpConstant %int 2147483647", + "%int_neg_max = OpSpecConstantOp %int SNegate %int_max", + }, + // expected + { + "%int_minus_1 = OpConstant %int -1", + "%int_minus_2 = OpConstant %int -2", + "%int_neg_null = OpConstant %int 0", + "%int_max = OpConstant %int 2147483647", + "%int_neg_max = OpConstant %int -2147483647", + }, + }, + // scalar integer not + { + // original + { + "%uint_4294967294 = OpSpecConstantOp %uint Not %unsigned_one", + "%uint_4294967293 = OpSpecConstantOp %uint Not %unsigned_two", + "%uint_neg_null = OpSpecConstantOp %uint Not %unsigned_null", + }, + // expected + { + "%uint_4294967294 = OpConstant %uint 4294967294", + "%uint_4294967293 = OpConstant %uint 4294967293", + "%uint_neg_null = OpConstant %uint 4294967295", + }, + }, + // scalar integer add, sub, mul, div + { + // original + { + "%signed_max = OpConstant %int 2147483647", + "%signed_min = OpConstant %int -2147483648", + + "%spec_int_iadd = OpSpecConstantOp %int IAdd %signed_three %signed_two", + "%spec_int_isub = OpSpecConstantOp %int ISub %signed_one %spec_int_iadd", + "%spec_int_sdiv = OpSpecConstantOp %int SDiv %spec_int_isub %signed_two", + "%spec_int_imul = OpSpecConstantOp %int IMul %spec_int_sdiv %signed_three", + "%spec_int_iadd_null = OpSpecConstantOp %int IAdd %spec_int_imul %signed_null", + "%spec_int_imul_null = OpSpecConstantOp %int IMul %spec_int_iadd_null %signed_null", + "%spec_int_iadd_overflow = OpSpecConstantOp %int IAdd %signed_max %signed_three", + "%spec_int_isub_overflow = OpSpecConstantOp %int ISub %signed_min %signed_three", + + "%spec_uint_iadd = OpSpecConstantOp %uint IAdd %unsigned_three %unsigned_two", + "%spec_uint_isub = OpSpecConstantOp %uint ISub %unsigned_one %spec_uint_iadd", + "%spec_uint_udiv = OpSpecConstantOp %uint UDiv %spec_uint_isub %unsigned_three", + "%spec_uint_imul = OpSpecConstantOp %uint IMul %spec_uint_udiv %unsigned_two", + "%spec_uint_isub_null = OpSpecConstantOp %uint ISub %spec_uint_imul %signed_null", + }, + // expected + { + "%signed_max = OpConstant %int 2147483647", + "%signed_min = OpConstant %int -2147483648", + + "%spec_int_iadd = OpConstant %int 5", + "%spec_int_isub = OpConstant %int -4", + "%spec_int_sdiv = OpConstant %int -2", + "%spec_int_imul = OpConstant %int -6", + "%spec_int_iadd_null = OpConstant %int -6", + "%spec_int_imul_null = OpConstant %int 0", + "%spec_int_iadd_overflow = OpConstant %int -2147483646", + "%spec_int_isub_overflow = OpConstant %int 2147483645", + + "%spec_uint_iadd = OpConstant %uint 5", + "%spec_uint_isub = OpConstant %uint 4294967292", + "%spec_uint_udiv = OpConstant %uint 1431655764", + "%spec_uint_imul = OpConstant %uint 2863311528", + "%spec_uint_isub_null = OpConstant %uint 2863311528", + }, + }, + // scalar integer rem, mod + { + // original + { + // common constants + "%int_7 = OpConstant %int 7", + "%uint_7 = OpConstant %uint 7", + "%int_minus_7 = OpConstant %int -7", + "%int_minus_3 = OpConstant %int -3", + + // srem + "%7_srem_3 = OpSpecConstantOp %int SRem %int_7 %signed_three", + "%minus_7_srem_3 = OpSpecConstantOp %int SRem %int_minus_7 %signed_three", + "%7_srem_minus_3 = OpSpecConstantOp %int SRem %int_7 %int_minus_3", + "%minus_7_srem_minus_3 = OpSpecConstantOp %int SRem %int_minus_7 %int_minus_3", + // smod + "%7_smod_3 = OpSpecConstantOp %int SMod %int_7 %signed_three", + "%minus_7_smod_3 = OpSpecConstantOp %int SMod %int_minus_7 %signed_three", + "%7_smod_minus_3 = OpSpecConstantOp %int SMod %int_7 %int_minus_3", + "%minus_7_smod_minus_3 = OpSpecConstantOp %int SMod %int_minus_7 %int_minus_3", + // umod + "%7_umod_3 = OpSpecConstantOp %uint UMod %uint_7 %unsigned_three", + // null constant + "%null_srem_3 = OpSpecConstantOp %int SRem %signed_null %signed_three", + "%null_smod_3 = OpSpecConstantOp %int SMod %signed_null %signed_three", + "%null_umod_3 = OpSpecConstantOp %uint UMod %unsigned_null %unsigned_three", + }, + // expected + { + // common constants + "%int_7 = OpConstant %int 7", + "%uint_7 = OpConstant %uint 7", + "%int_minus_7 = OpConstant %int -7", + "%int_minus_3 = OpConstant %int -3", + + // srem + "%7_srem_3 = OpConstant %int 1", + "%minus_7_srem_3 = OpConstant %int -1", + "%7_srem_minus_3 = OpConstant %int 1", + "%minus_7_srem_minus_3 = OpConstant %int -1", + // smod + "%7_smod_3 = OpConstant %int 1", + "%minus_7_smod_3 = OpConstant %int 2", + "%7_smod_minus_3 = OpConstant %int -2", + "%minus_7_smod_minus_3 = OpConstant %int -1", + // umod + "%7_umod_3 = OpConstant %uint 1", + // null constant + "%null_srem_3 = OpConstant %int 0", + "%null_smod_3 = OpConstant %int 0", + "%null_umod_3 = OpConstant %uint 0", + }, + }, + // scalar integer bitwise and shift + { + // original + { + // bitwise + "%xor_1_3 = OpSpecConstantOp %int BitwiseXor %signed_one %signed_three", + "%and_1_2 = OpSpecConstantOp %int BitwiseAnd %signed_one %xor_1_3", + "%or_1_2 = OpSpecConstantOp %int BitwiseOr %signed_one %xor_1_3", + "%xor_3_null = OpSpecConstantOp %int BitwiseXor %or_1_2 %signed_null", + + // shift + "%unsigned_31 = OpConstant %uint 31", + "%unsigned_left_shift_max = OpSpecConstantOp %uint ShiftLeftLogical %unsigned_one %unsigned_31", + "%unsigned_right_shift_logical = OpSpecConstantOp %uint ShiftRightLogical %unsigned_left_shift_max %unsigned_31", + "%signed_right_shift_arithmetic = OpSpecConstantOp %int ShiftRightArithmetic %unsigned_left_shift_max %unsigned_31", + "%left_shift_null_31 = OpSpecConstantOp %uint ShiftLeftLogical %unsigned_null %unsigned_31", + "%right_shift_31_null = OpSpecConstantOp %uint ShiftRightLogical %unsigned_31 %unsigned_null", + }, + // expected + { + "%xor_1_3 = OpConstant %int 2", + "%and_1_2 = OpConstant %int 0", + "%or_1_2 = OpConstant %int 3", + "%xor_3_null = OpConstant %int 3", + + "%unsigned_31 = OpConstant %uint 31", + "%unsigned_left_shift_max = OpConstant %uint 2147483648", + "%unsigned_right_shift_logical = OpConstant %uint 1", + "%signed_right_shift_arithmetic = OpConstant %int -1", + "%left_shift_null_31 = OpConstant %uint 0", + "%right_shift_31_null = OpConstant %uint 31", + }, + }, + // Skip folding if any operands have undetermined value. + { + // original + { + "%spec_int = OpSpecConstant %int 1", + "%spec_iadd = OpSpecConstantOp %int IAdd %signed_three %spec_int", + }, + // expected + { + "%spec_int = OpSpecConstant %int 1", + "%spec_iadd = OpSpecConstantOp %int IAdd %signed_three %spec_int", + }, + }, + // clang-format on + }))); + +// Tests about arithmetic operations for vector int and uint types. +INSTANTIATE_TEST_CASE_P( + VectorArithmetic, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // vector integer negate + { + // original + { + "%v2int_minus_1 = OpSpecConstantOp %v2int SNegate %signed_one_vec", + "%v2int_minus_2 = OpSpecConstantOp %v2int SNegate %signed_two_vec", + "%v2int_neg_null = OpSpecConstantOp %v2int SNegate %signed_null_vec", + }, + // expected + { + "%int_n1 = OpConstant %int -1", + "%int_n1_0 = OpConstant %int -1", + "%v2int_minus_1 = OpConstantComposite %v2int %int_n1 %int_n1", + "%int_n2 = OpConstant %int -2", + "%int_n2_0 = OpConstant %int -2", + "%v2int_minus_2 = OpConstantComposite %v2int %int_n2 %int_n2", + "%int_0 = OpConstant %int 0", + "%int_0_0 = OpConstant %int 0", + "%v2int_neg_null = OpConstantComposite %v2int %signed_zero %signed_zero", + }, + }, + // vector integer (including null vetors) add, sub, div, mul + { + // original + { + "%spec_v2int_iadd = OpSpecConstantOp %v2int IAdd %signed_three_vec %signed_two_vec", + "%spec_v2int_isub = OpSpecConstantOp %v2int ISub %signed_one_vec %spec_v2int_iadd", + "%spec_v2int_sdiv = OpSpecConstantOp %v2int SDiv %spec_v2int_isub %signed_two_vec", + "%spec_v2int_imul = OpSpecConstantOp %v2int IMul %spec_v2int_sdiv %signed_three_vec", + "%spec_v2int_iadd_null = OpSpecConstantOp %v2int IAdd %spec_v2int_imul %signed_null_vec", + + "%spec_v2uint_iadd = OpSpecConstantOp %v2uint IAdd %unsigned_three_vec %unsigned_two_vec", + "%spec_v2uint_isub = OpSpecConstantOp %v2uint ISub %unsigned_one_vec %spec_v2uint_iadd", + "%spec_v2uint_udiv = OpSpecConstantOp %v2uint UDiv %spec_v2uint_isub %unsigned_three_vec", + "%spec_v2uint_imul = OpSpecConstantOp %v2uint IMul %spec_v2uint_udiv %unsigned_two_vec", + "%spec_v2uint_isub_null = OpSpecConstantOp %v2uint ISub %spec_v2uint_imul %signed_null_vec", + }, + // expected + { + "%int_5 = OpConstant %int 5", + "%int_5_0 = OpConstant %int 5", + "%spec_v2int_iadd = OpConstantComposite %v2int %int_5 %int_5", + "%int_n4 = OpConstant %int -4", + "%int_n4_0 = OpConstant %int -4", + "%spec_v2int_isub = OpConstantComposite %v2int %int_n4 %int_n4", + "%int_n2 = OpConstant %int -2", + "%int_n2_0 = OpConstant %int -2", + "%spec_v2int_sdiv = OpConstantComposite %v2int %int_n2 %int_n2", + "%int_n6 = OpConstant %int -6", + "%int_n6_0 = OpConstant %int -6", + "%spec_v2int_imul = OpConstantComposite %v2int %int_n6 %int_n6", + "%int_n6_1 = OpConstant %int -6", + "%int_n6_2 = OpConstant %int -6", + "%spec_v2int_iadd_null = OpConstantComposite %v2int %int_n6 %int_n6", + + "%uint_5 = OpConstant %uint 5", + "%uint_5_0 = OpConstant %uint 5", + "%spec_v2uint_iadd = OpConstantComposite %v2uint %uint_5 %uint_5", + "%uint_4294967292 = OpConstant %uint 4294967292", + "%uint_4294967292_0 = OpConstant %uint 4294967292", + "%spec_v2uint_isub = OpConstantComposite %v2uint %uint_4294967292 %uint_4294967292", + "%uint_1431655764 = OpConstant %uint 1431655764", + "%uint_1431655764_0 = OpConstant %uint 1431655764", + "%spec_v2uint_udiv = OpConstantComposite %v2uint %uint_1431655764 %uint_1431655764", + "%uint_2863311528 = OpConstant %uint 2863311528", + "%uint_2863311528_0 = OpConstant %uint 2863311528", + "%spec_v2uint_imul = OpConstantComposite %v2uint %uint_2863311528 %uint_2863311528", + "%uint_2863311528_1 = OpConstant %uint 2863311528", + "%uint_2863311528_2 = OpConstant %uint 2863311528", + "%spec_v2uint_isub_null = OpConstantComposite %v2uint %uint_2863311528 %uint_2863311528", + }, + }, + // vector integer rem, mod + { + // original + { + // common constants + "%int_7 = OpConstant %int 7", + "%v2int_7 = OpConstantComposite %v2int %int_7 %int_7", + "%uint_7 = OpConstant %uint 7", + "%v2uint_7 = OpConstantComposite %v2uint %uint_7 %uint_7", + "%int_minus_7 = OpConstant %int -7", + "%v2int_minus_7 = OpConstantComposite %v2int %int_minus_7 %int_minus_7", + "%int_minus_3 = OpConstant %int -3", + "%v2int_minus_3 = OpConstantComposite %v2int %int_minus_3 %int_minus_3", + + // srem + "%7_srem_3 = OpSpecConstantOp %v2int SRem %v2int_7 %signed_three_vec", + "%minus_7_srem_3 = OpSpecConstantOp %v2int SRem %v2int_minus_7 %signed_three_vec", + "%7_srem_minus_3 = OpSpecConstantOp %v2int SRem %v2int_7 %v2int_minus_3", + "%minus_7_srem_minus_3 = OpSpecConstantOp %v2int SRem %v2int_minus_7 %v2int_minus_3", + // smod + "%7_smod_3 = OpSpecConstantOp %v2int SMod %v2int_7 %signed_three_vec", + "%minus_7_smod_3 = OpSpecConstantOp %v2int SMod %v2int_minus_7 %signed_three_vec", + "%7_smod_minus_3 = OpSpecConstantOp %v2int SMod %v2int_7 %v2int_minus_3", + "%minus_7_smod_minus_3 = OpSpecConstantOp %v2int SMod %v2int_minus_7 %v2int_minus_3", + // umod + "%7_umod_3 = OpSpecConstantOp %v2uint UMod %v2uint_7 %unsigned_three_vec", + }, + // expected + { + // common constants + "%int_7 = OpConstant %int 7", + "%v2int_7 = OpConstantComposite %v2int %int_7 %int_7", + "%uint_7 = OpConstant %uint 7", + "%v2uint_7 = OpConstantComposite %v2uint %uint_7 %uint_7", + "%int_minus_7 = OpConstant %int -7", + "%v2int_minus_7 = OpConstantComposite %v2int %int_minus_7 %int_minus_7", + "%int_minus_3 = OpConstant %int -3", + "%v2int_minus_3 = OpConstantComposite %v2int %int_minus_3 %int_minus_3", + + // srem + "%int_1 = OpConstant %int 1", + "%int_1_0 = OpConstant %int 1", + "%7_srem_3 = OpConstantComposite %v2int %signed_one %signed_one", + "%int_n1 = OpConstant %int -1", + "%int_n1_0 = OpConstant %int -1", + "%minus_7_srem_3 = OpConstantComposite %v2int %int_n1 %int_n1", + "%int_1_1 = OpConstant %int 1", + "%int_1_2 = OpConstant %int 1", + "%7_srem_minus_3 = OpConstantComposite %v2int %signed_one %signed_one", + "%int_n1_1 = OpConstant %int -1", + "%int_n1_2 = OpConstant %int -1", + "%minus_7_srem_minus_3 = OpConstantComposite %v2int %int_n1 %int_n1", + // smod + "%int_1_3 = OpConstant %int 1", + "%int_1_4 = OpConstant %int 1", + "%7_smod_3 = OpConstantComposite %v2int %signed_one %signed_one", + "%int_2 = OpConstant %int 2", + "%int_2_0 = OpConstant %int 2", + "%minus_7_smod_3 = OpConstantComposite %v2int %signed_two %signed_two", + "%int_n2 = OpConstant %int -2", + "%int_n2_0 = OpConstant %int -2", + "%7_smod_minus_3 = OpConstantComposite %v2int %int_n2 %int_n2", + "%int_n1_3 = OpConstant %int -1", + "%int_n1_4 = OpConstant %int -1", + "%minus_7_smod_minus_3 = OpConstantComposite %v2int %int_n1 %int_n1", + // umod + "%uint_1 = OpConstant %uint 1", + "%uint_1_0 = OpConstant %uint 1", + "%7_umod_3 = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + }, + }, + // vector integer bitwise, shift + { + // original + { + "%xor_1_3 = OpSpecConstantOp %v2int BitwiseXor %signed_one_vec %signed_three_vec", + "%and_1_2 = OpSpecConstantOp %v2int BitwiseAnd %signed_one_vec %xor_1_3", + "%or_1_2 = OpSpecConstantOp %v2int BitwiseOr %signed_one_vec %xor_1_3", + + "%unsigned_31 = OpConstant %uint 31", + "%v2unsigned_31 = OpConstantComposite %v2uint %unsigned_31 %unsigned_31", + "%unsigned_left_shift_max = OpSpecConstantOp %v2uint ShiftLeftLogical %unsigned_one_vec %v2unsigned_31", + "%unsigned_right_shift_logical = OpSpecConstantOp %v2uint ShiftRightLogical %unsigned_left_shift_max %v2unsigned_31", + "%signed_right_shift_arithmetic = OpSpecConstantOp %v2int ShiftRightArithmetic %unsigned_left_shift_max %v2unsigned_31", + }, + // expected + { + "%int_2 = OpConstant %int 2", + "%int_2_0 = OpConstant %int 2", + "%xor_1_3 = OpConstantComposite %v2int %signed_two %signed_two", + "%int_0 = OpConstant %int 0", + "%int_0_0 = OpConstant %int 0", + "%and_1_2 = OpConstantComposite %v2int %signed_zero %signed_zero", + "%int_3 = OpConstant %int 3", + "%int_3_0 = OpConstant %int 3", + "%or_1_2 = OpConstantComposite %v2int %signed_three %signed_three", + + "%unsigned_31 = OpConstant %uint 31", + "%v2unsigned_31 = OpConstantComposite %v2uint %unsigned_31 %unsigned_31", + "%uint_2147483648 = OpConstant %uint 2147483648", + "%uint_2147483648_0 = OpConstant %uint 2147483648", + "%unsigned_left_shift_max = OpConstantComposite %v2uint %uint_2147483648 %uint_2147483648", + "%uint_1 = OpConstant %uint 1", + "%uint_1_0 = OpConstant %uint 1", + "%unsigned_right_shift_logical = OpConstantComposite %v2uint %unsigned_one %unsigned_one", + "%int_n1 = OpConstant %int -1", + "%int_n1_0 = OpConstant %int -1", + "%signed_right_shift_arithmetic = OpConstantComposite %v2int %int_n1 %int_n1", + }, + }, + // Skip folding if any vector operands or components of the operands + // have undetermined value. + { + // original + { + "%spec_int = OpSpecConstant %int 1", + "%spec_vec = OpSpecConstantComposite %v2int %signed_zero %spec_int", + "%spec_iadd = OpSpecConstantOp %v2int IAdd %signed_three_vec %spec_vec", + }, + // expected + { + "%spec_int = OpSpecConstant %int 1", + "%spec_vec = OpSpecConstantComposite %v2int %signed_zero %spec_int", + "%spec_iadd = OpSpecConstantOp %v2int IAdd %signed_three_vec %spec_vec", + }, + }, + // Skip folding if any vector operands are defined by OpUndef + { + // original + { + "%undef = OpUndef %int", + "%vec = OpConstantComposite %v2int %undef %signed_one", + "%spec_iadd = OpSpecConstantOp %v2int IAdd %signed_three_vec %vec", + }, + // expected + { + "%undef = OpUndef %int", + "%vec = OpConstantComposite %v2int %undef %signed_one", + "%spec_iadd = OpSpecConstantOp %v2int IAdd %signed_three_vec %vec", + }, + }, + // clang-format on + }))); + +// Tests for SpecConstantOp CompositeExtract instruction +INSTANTIATE_TEST_CASE_P( + CompositeExtract, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // normal vector + { + // original + { + "%r = OpSpecConstantOp %int CompositeExtract %signed_three_vec 0", + "%x = OpSpecConstantOp %int CompositeExtract %v4int_0_1_2_3 0", + "%y = OpSpecConstantOp %int CompositeExtract %v4int_0_1_2_3 1", + "%z = OpSpecConstantOp %int CompositeExtract %v4int_0_1_2_3 2", + "%w = OpSpecConstantOp %int CompositeExtract %v4int_0_1_2_3 3", + }, + // expected + { + "%r = OpConstant %int 3", + "%x = OpConstant %int 0", + "%y = OpConstant %int 1", + "%z = OpConstant %int 2", + "%w = OpConstant %int 3", + }, + }, + // null vector + { + // original + { + "%x = OpSpecConstantOp %int CompositeExtract %signed_null_vec 0", + "%y = OpSpecConstantOp %int CompositeExtract %signed_null_vec 1", + "%null_v4int = OpConstantNull %v4int", + "%z = OpSpecConstantOp %int CompositeExtract %signed_null_vec 2", + }, + // expected + { + "%x = OpConstantNull %int", + "%y = OpConstantNull %int", + "%null_v4int = OpConstantNull %v4int", + "%z = OpConstantNull %int", + } + }, + // normal flat struct + { + // original + { + "%float_1 = OpConstant %float 1", + "%flat_1 = OpConstantComposite %flat_struct %bool_true %signed_null %float_1", + "%extract_bool = OpSpecConstantOp %bool CompositeExtract %flat_1 0", + "%extract_int = OpSpecConstantOp %int CompositeExtract %flat_1 1", + "%extract_float_1 = OpSpecConstantOp %float CompositeExtract %flat_1 2", + // foldable composite constants built with OpSpecConstantComposite + // should also be processed. + "%flat_2 = OpSpecConstantComposite %flat_struct %bool_true %signed_null %float_1", + "%extract_float_2 = OpSpecConstantOp %float CompositeExtract %flat_2 2", + }, + // expected + { + "%float_1 = OpConstant %float 1", + "%flat_1 = OpConstantComposite %flat_struct %bool_true %signed_null %float_1", + "%extract_bool = OpConstantTrue %bool", + "%extract_int = OpConstantNull %int", + "%extract_float_1 = OpConstant %float 1", + "%flat_2 = OpConstantComposite %flat_struct %bool_true %signed_null %float_1", + "%extract_float_2 = OpConstant %float 1", + }, + }, + // null flat struct + { + // original + { + "%flat = OpConstantNull %flat_struct", + "%extract_bool = OpSpecConstantOp %bool CompositeExtract %flat 0", + "%extract_int = OpSpecConstantOp %int CompositeExtract %flat 1", + "%extract_float = OpSpecConstantOp %float CompositeExtract %flat 2", + }, + // expected + { + "%flat = OpConstantNull %flat_struct", + "%extract_bool = OpConstantNull %bool", + "%extract_int = OpConstantNull %int", + "%extract_float = OpConstantNull %float", + }, + }, + // normal nested struct + { + // original + { + "%float_1 = OpConstant %float 1", + "%inner = OpConstantComposite %inner_struct %bool_true %signed_null %float_1", + "%outer = OpConstantComposite %outer_struct %inner %signed_one", + "%extract_inner = OpSpecConstantOp %inner_struct CompositeExtract %outer 0", + "%extract_int = OpSpecConstantOp %int CompositeExtract %outer 1", + "%extract_inner_float = OpSpecConstantOp %int CompositeExtract %outer 0 2", + }, + // expected + { + "%float_1 = OpConstant %float 1", + "%inner = OpConstantComposite %inner_struct %bool_true %signed_null %float_1", + "%outer = OpConstantComposite %outer_struct %inner %signed_one", + "%extract_inner = OpConstantComposite %flat_struct %bool_true %signed_null %float_1", + "%extract_int = OpConstant %int 1", + "%extract_inner_float = OpConstant %float 1", + }, + }, + // null nested struct + { + // original + { + "%outer = OpConstantNull %outer_struct", + "%extract_inner = OpSpecConstantOp %inner_struct CompositeExtract %outer 0", + "%extract_int = OpSpecConstantOp %int CompositeExtract %outer 1", + "%extract_inner_float = OpSpecConstantOp %float CompositeExtract %outer 0 2", + }, + // expected + { + "%outer = OpConstantNull %outer_struct", + "%extract_inner = OpConstantNull %inner_struct", + "%extract_int = OpConstantNull %int", + "%extract_inner_float = OpConstantNull %float", + }, + }, + // skip folding if the any composite constant's value are not fully + // determined, even though the extracting target might have + // determined value. + { + // original + { + "%float_1 = OpConstant %float 1", + "%spec_float = OpSpecConstant %float 1", + "%spec_inner = OpSpecConstantComposite %inner_struct %bool_true %signed_null %spec_float", + "%spec_outer = OpSpecConstantComposite %outer_struct %spec_inner %signed_one", + "%spec_vec = OpSpecConstantComposite %v2float %spec_float %float_1", + "%extract_inner = OpSpecConstantOp %int CompositeExtract %spec_inner 1", + "%extract_outer = OpSpecConstantOp %int CompositeExtract %spec_outer 1", + "%extract_vec = OpSpecConstantOp %float CompositeExtract %spec_vec 1", + }, + // expected + { + "%float_1 = OpConstant %float 1", + "%spec_float = OpSpecConstant %float 1", + "%spec_inner = OpSpecConstantComposite %inner_struct %bool_true %signed_null %spec_float", + "%spec_outer = OpSpecConstantComposite %outer_struct %spec_inner %signed_one", + "%spec_vec = OpSpecConstantComposite %v2float %spec_float %float_1", + "%extract_inner = OpSpecConstantOp %int CompositeExtract %spec_inner 1", + "%extract_outer = OpSpecConstantOp %int CompositeExtract %spec_outer 1", + "%extract_vec = OpSpecConstantOp %float CompositeExtract %spec_vec 1", + }, + }, + // skip if the composite constant depends on the result of OpUndef, + // even though the composite extract target element does not depends + // on the OpUndef. + { + // original + { + "%undef = OpUndef %float", + "%inner = OpConstantComposite %inner_struct %bool_true %signed_one %undef", + "%outer = OpConstantComposite %outer_struct %inner %signed_one", + "%extract_inner = OpSpecConstantOp %int CompositeExtract %inner 1", + "%extract_outer = OpSpecConstantOp %int CompositeExtract %outer 1", + }, + // expected + { + "%undef = OpUndef %float", + "%inner = OpConstantComposite %inner_struct %bool_true %signed_one %undef", + "%outer = OpConstantComposite %outer_struct %inner %signed_one", + "%extract_inner = OpSpecConstantOp %int CompositeExtract %inner 1", + "%extract_outer = OpSpecConstantOp %int CompositeExtract %outer 1", + }, + }, + // TODO(qining): Add tests for Array and other composite type constants. + // clang-format on + }))); + +// Tests the swizzle operations for spec const vectors. +INSTANTIATE_TEST_CASE_P( + VectorShuffle, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // normal vector + { + // original + { + "%xy = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 0 1", + "%yz = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 1 2", + "%zw = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 2 3", + "%wx = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 3 0", + "%xx = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 0 0", + "%yyy = OpSpecConstantOp %v3int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 1 1 1", + "%wwww = OpSpecConstantOp %v4int VectorShuffle %v4int_0_1_2_3 %v4int_0_1_2_3 2 2 2 2", + }, + // expected + { + "%xy = OpConstantComposite %v2int %signed_zero %signed_one", + "%yz = OpConstantComposite %v2int %signed_one %signed_two", + "%zw = OpConstantComposite %v2int %signed_two %signed_three", + "%wx = OpConstantComposite %v2int %signed_three %signed_zero", + "%xx = OpConstantComposite %v2int %signed_zero %signed_zero", + "%yyy = OpConstantComposite %v3int %signed_one %signed_one %signed_one", + "%wwww = OpConstantComposite %v4int %signed_two %signed_two %signed_two %signed_two", + }, + }, + // null vector + { + // original + { + "%a = OpSpecConstantOp %v2int VectorShuffle %signed_null_vec %v4int_0_1_2_3 0 1", + "%b = OpSpecConstantOp %v2int VectorShuffle %signed_null_vec %v4int_0_1_2_3 2 3", + "%c = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %signed_null_vec 3 4", + "%d = OpSpecConstantOp %v2int VectorShuffle %signed_null_vec %signed_null_vec 1 2", + }, + // expected + { + "%60 = OpConstantNull %int", + "%a = OpConstantComposite %v2int %signed_null %signed_null", + "%62 = OpConstantNull %int", + "%b = OpConstantComposite %v2int %signed_zero %signed_one", + "%64 = OpConstantNull %int", + "%c = OpConstantComposite %v2int %signed_three %signed_null", + "%66 = OpConstantNull %int", + "%d = OpConstantComposite %v2int %signed_null %signed_null", + } + }, + // skip if any of the components of the vector operands do not have + // determined value, even though the result vector might not be + // built with those undermined values. + { + // original + { + "%spec_int = OpSpecConstant %int 1", + "%spec_ivec = OpSpecConstantComposite %v2int %signed_null %spec_int", + "%a = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %spec_ivec 0 1", + "%b = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %spec_ivec 3 4", + }, + // expected + { + "%spec_int = OpSpecConstant %int 1", + "%spec_ivec = OpSpecConstantComposite %v2int %signed_null %spec_int", + "%a = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %spec_ivec 0 1", + "%b = OpSpecConstantOp %v2int VectorShuffle %v4int_0_1_2_3 %spec_ivec 3 4", + }, + }, + // Skip if any components of the two vector operands depend on + // the result of OpUndef. Even though the selected components do + // not depend on the OpUndef result. + { + // original + { + "%undef = OpUndef %int", + "%vec_1 = OpConstantComposite %v2int %undef %signed_one", + "%dep = OpSpecConstantOp %v2int VectorShuffle %vec_1 %signed_three_vec 0 3", + "%not_dep_element = OpSpecConstantOp %v2int VectorShuffle %vec_1 %signed_three_vec 1 3", + "%no_dep_vector = OpSpecConstantOp %v2int VectorShuffle %vec_1 %signed_three_vec 2 3", + }, + // expected + { + "%undef = OpUndef %int", + "%vec_1 = OpConstantComposite %v2int %undef %signed_one", + "%dep = OpSpecConstantOp %v2int VectorShuffle %vec_1 %signed_three_vec 0 3", + "%not_dep_element = OpSpecConstantOp %v2int VectorShuffle %vec_1 %signed_three_vec 1 3", + "%no_dep_vector = OpSpecConstantOp %v2int VectorShuffle %vec_1 %signed_three_vec 2 3", + }, + }, + // clang-format on + }))); + +// Test with long use-def chain. +INSTANTIATE_TEST_CASE_P( + LongDefUseChain, FoldSpecConstantOpAndCompositePassTest, + ::testing::ValuesIn(std::vector< + FoldSpecConstantOpAndCompositePassTestCase>({ + // clang-format off + // Long Def-Use chain with binary operations. + { + // original + { + "%array_size = OpConstant %int 4", + "%type_arr_int_4 = OpTypeArray %int %array_size", + "%spec_int_0 = OpConstant %int 100", + "%spec_int_1 = OpConstant %int 1", + "%spec_int_2 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_1", + "%spec_int_3 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_2", + "%spec_int_4 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_3", + "%spec_int_5 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_4", + "%spec_int_6 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_5", + "%spec_int_7 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_6", + "%spec_int_8 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_7", + "%spec_int_9 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_8", + "%spec_int_10 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_9", + "%spec_int_11 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_10", + "%spec_int_12 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_11", + "%spec_int_13 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_12", + "%spec_int_14 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_13", + "%spec_int_15 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_14", + "%spec_int_16 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_15", + "%spec_int_17 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_16", + "%spec_int_18 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_17", + "%spec_int_19 = OpSpecConstantOp %int IAdd %spec_int_0 %spec_int_18", + "%spec_int_20 = OpSpecConstantOp %int ISub %spec_int_0 %spec_int_19", + "%used_vec_a = OpSpecConstantComposite %v2int %spec_int_18 %spec_int_19", + "%used_vec_b = OpSpecConstantOp %v2int IMul %used_vec_a %used_vec_a", + "%spec_int_21 = OpSpecConstantOp %int CompositeExtract %used_vec_b 0", + "%array = OpConstantComposite %type_arr_int_4 %spec_int_20 %spec_int_20 %spec_int_21 %spec_int_21", + // Spec constants whose values can not be fully resolved should + // not be processed. + "%spec_int_22 = OpSpecConstant %int 123", + "%spec_int_23 = OpSpecConstantOp %int IAdd %spec_int_22 %signed_one", + }, + // expected + { + "%array_size = OpConstant %int 4", + "%type_arr_int_4 = OpTypeArray %int %array_size", + "%spec_int_0 = OpConstant %int 100", + "%spec_int_1 = OpConstant %int 1", + "%spec_int_2 = OpConstant %int 101", + "%spec_int_3 = OpConstant %int -1", + "%spec_int_4 = OpConstant %int 99", + "%spec_int_5 = OpConstant %int 1", + "%spec_int_6 = OpConstant %int 101", + "%spec_int_7 = OpConstant %int -1", + "%spec_int_8 = OpConstant %int 99", + "%spec_int_9 = OpConstant %int 1", + "%spec_int_10 = OpConstant %int 101", + "%spec_int_11 = OpConstant %int -1", + "%spec_int_12 = OpConstant %int 99", + "%spec_int_13 = OpConstant %int 1", + "%spec_int_14 = OpConstant %int 101", + "%spec_int_15 = OpConstant %int -1", + "%spec_int_16 = OpConstant %int 101", + "%spec_int_17 = OpConstant %int 201", + "%spec_int_18 = OpConstant %int -101", + "%spec_int_19 = OpConstant %int -1", + "%spec_int_20 = OpConstant %int 101", + "%used_vec_a = OpConstantComposite %v2int %spec_int_18 %spec_int_19", + "%int_10201 = OpConstant %int 10201", + "%int_1 = OpConstant %int 1", + "%used_vec_b = OpConstantComposite %v2int %int_10201 %signed_one", + "%spec_int_21 = OpConstant %int 10201", + "%array = OpConstantComposite %type_arr_int_4 %spec_int_20 %spec_int_20 %spec_int_21 %spec_int_21", + "%spec_int_22 = OpSpecConstant %int 123", + "%spec_int_23 = OpSpecConstantOp %int IAdd %spec_int_22 %signed_one", + }, + }, + // Long Def-Use chain with swizzle + }))); + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/fold_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/fold_test.cpp new file mode 100644 index 00000000000..b1e5758866a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/fold_test.cpp @@ -0,0 +1,6082 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/def_use_manager.h" +#include "source/opt/fold.h" +#include "source/opt/ir_context.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" +#include "test/opt/pass_utils.h" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::Contains; + +#ifdef SPIRV_EFFCEE +std::string Disassemble(const std::string& original, IRContext* context, + uint32_t disassemble_options = 0) { + std::vector optimized_bin; + context->module()->ToBinary(&optimized_bin, true); + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + SpirvTools tools(target_env); + std::string optimized_asm; + EXPECT_TRUE( + tools.Disassemble(optimized_bin, &optimized_asm, disassemble_options)) + << "Disassembling failed for shader:\n" + << original << std::endl; + return optimized_asm; +} + +void Match(const std::string& original, IRContext* context, + uint32_t disassemble_options = 0) { + std::string disassembly = Disassemble(original, context, disassemble_options); + auto match_result = effcee::Match(disassembly, original); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << disassembly; +} +#endif + +template +struct InstructionFoldingCase { + InstructionFoldingCase(const std::string& tb, uint32_t id, ResultType result) + : test_body(tb), id_to_fold(id), expected_result(result) {} + + std::string test_body; + uint32_t id_to_fold; + ResultType expected_result; +}; + +using IntegerInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(IntegerInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_TRUE(succeeded); + if (inst != nullptr) { + EXPECT_EQ(inst->opcode(), SpvOpCopyObject); + inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + EXPECT_EQ(inst->opcode(), SpvOpConstant); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::IntConstant* result = + const_mrg->GetConstantFromInst(inst)->AsIntConstant(); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + EXPECT_EQ(result->GetU32BitValue(), tc.expected_result); + } + } +} + +// Returns a common SPIR-V header for all of the test that follow. +#define INT_0_ID 100 +#define TRUE_ID 101 +#define VEC2_0_ID 102 +#define INT_7_ID 103 +#define FLOAT_0_ID 104 +#define DOUBLE_0_ID 105 +#define VEC4_0_ID 106 +#define DVEC4_0_ID 106 +#define HALF_0_ID 108 +const std::string& Header() { + static const std::string header = R"(OpCapability Shader +OpCapability Float16 +OpCapability Float64 +OpCapability Int16 +OpCapability Int64 +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +%void = OpTypeVoid +%void_func = OpTypeFunction %void +%bool = OpTypeBool +%float = OpTypeFloat 32 +%double = OpTypeFloat 64 +%half = OpTypeFloat 16 +%101 = OpConstantTrue %bool ; Need a def with an numerical id to define id maps. +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%bool_null = OpConstantNull %bool +%short = OpTypeInt 16 1 +%int = OpTypeInt 32 1 +%long = OpTypeInt 64 1 +%uint = OpTypeInt 32 0 +%v2int = OpTypeVector %int 2 +%v4int = OpTypeVector %int 4 +%v4float = OpTypeVector %float 4 +%v4double = OpTypeVector %double 4 +%v2float = OpTypeVector %float 2 +%v2double = OpTypeVector %double 2 +%v2bool = OpTypeVector %bool 2 +%struct_v2int_int_int = OpTypeStruct %v2int %int %int +%_ptr_int = OpTypePointer Function %int +%_ptr_uint = OpTypePointer Function %uint +%_ptr_bool = OpTypePointer Function %bool +%_ptr_float = OpTypePointer Function %float +%_ptr_double = OpTypePointer Function %double +%_ptr_half = OpTypePointer Function %half +%_ptr_long = OpTypePointer Function %long +%_ptr_v2int = OpTypePointer Function %v2int +%_ptr_v4int = OpTypePointer Function %v4int +%_ptr_v4float = OpTypePointer Function %v4float +%_ptr_v4double = OpTypePointer Function %v4double +%_ptr_struct_v2int_int_int = OpTypePointer Function %struct_v2int_int_int +%_ptr_v2float = OpTypePointer Function %v2float +%_ptr_v2double = OpTypePointer Function %v2double +%short_0 = OpConstant %short 0 +%short_2 = OpConstant %short 2 +%short_3 = OpConstant %short 3 +%100 = OpConstant %int 0 ; Need a def with an numerical id to define id maps. +%103 = OpConstant %int 7 ; Need a def with an numerical id to define id maps. +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int_min = OpConstant %int -2147483648 +%int_max = OpConstant %int 2147483647 +%long_0 = OpConstant %long 0 +%long_2 = OpConstant %long 2 +%long_3 = OpConstant %long 3 +%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_32 = OpConstant %uint 32 +%uint_max = OpConstant %uint 4294967295 +%v2int_undef = OpUndef %v2int +%v2int_0_0 = OpConstantComposite %v2int %int_0 %int_0 +%v2int_1_0 = OpConstantComposite %v2int %int_1 %int_0 +%v2int_2_2 = OpConstantComposite %v2int %int_2 %int_2 +%v2int_2_3 = OpConstantComposite %v2int %int_2 %int_3 +%v2int_3_2 = OpConstantComposite %v2int %int_3 %int_2 +%v2int_4_4 = OpConstantComposite %v2int %int_4 %int_4 +%v2bool_null = OpConstantNull %v2bool +%v2bool_true_false = OpConstantComposite %v2bool %true %false +%v2bool_false_true = OpConstantComposite %v2bool %false %true +%struct_v2int_int_int_null = OpConstantNull %struct_v2int_int_int +%v2int_null = OpConstantNull %v2int +%102 = OpConstantComposite %v2int %103 %103 +%v4int_0_0_0_0 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 +%struct_undef_0_0 = OpConstantComposite %struct_v2int_int_int %v2int_undef %int_0 %int_0 +%float_n1 = OpConstant %float -1 +%104 = OpConstant %float 0 ; Need a def with an numerical id to define id maps. +%float_null = OpConstantNull %float +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%float_3 = OpConstant %float 3 +%float_4 = OpConstant %float 4 +%float_0p5 = OpConstant %float 0.5 +%v2float_0_0 = OpConstantComposite %v2float %float_0 %float_0 +%v2float_2_2 = OpConstantComposite %v2float %float_2 %float_2 +%v2float_2_3 = OpConstantComposite %v2float %float_2 %float_3 +%v2float_3_2 = OpConstantComposite %v2float %float_3 %float_2 +%v2float_4_4 = OpConstantComposite %v2float %float_4 %float_4 +%v2float_2_0p5 = OpConstantComposite %v2float %float_2 %float_0p5 +%v2float_null = OpConstantNull %v2float +%double_n1 = OpConstant %double -1 +%105 = OpConstant %double 0 ; Need a def with an numerical id to define id maps. +%double_null = OpConstantNull %double +%double_0 = OpConstant %double 0 +%double_1 = OpConstant %double 1 +%double_2 = OpConstant %double 2 +%double_3 = OpConstant %double 3 +%double_4 = OpConstant %double 4 +%double_0p5 = OpConstant %double 0.5 +%v2double_0_0 = OpConstantComposite %v2double %double_0 %double_0 +%v2double_2_2 = OpConstantComposite %v2double %double_2 %double_2 +%v2double_2_3 = OpConstantComposite %v2double %double_2 %double_3 +%v2double_3_2 = OpConstantComposite %v2double %double_3 %double_2 +%v2double_4_4 = OpConstantComposite %v2double %double_4 %double_4 +%v2double_2_0p5 = OpConstantComposite %v2double %double_2 %double_0p5 +%v2double_null = OpConstantNull %v2double +%108 = OpConstant %half 0 +%half_1 = OpConstant %half 1 +%106 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%v4float_0_0_0_0 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%v4float_0_0_0_1 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 +%v4float_0_1_0_0 = OpConstantComposite %v4float %float_0 %float_1 %float_null %float_0 +%v4float_1_1_1_1 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%107 = OpConstantComposite %v4double %double_0 %double_0 %double_0 %double_0 +%v4double_0_0_0_0 = OpConstantComposite %v4double %double_0 %double_0 %double_0 %double_0 +%v4double_0_0_0_1 = OpConstantComposite %v4double %double_0 %double_0 %double_0 %double_1 +%v4double_0_1_0_0 = OpConstantComposite %v4double %double_0 %double_1 %double_null %double_0 +%v4double_1_1_1_1 = OpConstantComposite %v4double %double_1 %double_1 %double_1 %double_1 +%v4double_1_1_1_0p5 = OpConstantComposite %v4double %double_1 %double_1 %double_1 %double_0p5 +%v4double_null = OpConstantNull %v4double +%v4float_n1_2_1_3 = OpConstantComposite %v4float %float_n1 %float_2 %float_1 %float_3 +)"; + + return header; +} + +// Returns the header with definitions of float NaN and double NaN. Since FC +// "; CHECK: [[double_n0:%\\w+]] = OpConstant [[double]] -0\n" finds +// %double_nan = OpConstant %double -0x1.8p+1024 instead of +// %double_n0 = OpConstant %double -0, +// we separates those definitions from Header(). +const std::string& HeaderWithNaN() { + static const std::string headerWithNaN = + Header() + + R"(%float_nan = OpConstant %float -0x1.8p+128 +%double_nan = OpConstant %double -0x1.8p+1024 +)"; + + return headerWithNaN; +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(TestCase, IntegerInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold 0*n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpIMul %int %int_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: fold n*0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpIMul %int %load %int_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: fold 0/n (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSDiv %int %int_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: fold n/0 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSDiv %int %load %int_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 4: fold 0/n (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUDiv %uint %uint_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 5: fold n/0 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSDiv %int %load %int_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 6: fold 0 remainder n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSRem %int %int_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 7: fold n remainder 0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSRem %int %load %int_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 8: fold 0%n (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSMod %int %int_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 9: fold n%0 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSMod %int %load %int_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 10: fold 0%n (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUMod %uint %uint_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 11: fold n%0 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUMod %uint %load %uint_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 12: fold n << 32 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpShiftLeftLogical %uint %load %uint_32\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 13: fold n >> 32 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpShiftRightLogical %uint %load %uint_32\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 14: fold n | 0xFFFFFFFF + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpBitwiseOr %uint %load %uint_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0xFFFFFFFF), + // Test case 15: fold 0xFFFFFFFF | n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpBitwiseOr %uint %uint_max %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0xFFFFFFFF), + // Test case 16: fold n & 0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpBitwiseAnd %uint %load %uint_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) +)); +// clang-format on + +using IntVectorInstructionFoldingTest = + ::testing::TestWithParam>>; + +TEST_P(IntVectorInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + SpvOp original_opcode = inst->opcode(); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_EQ(succeeded, inst == nullptr || inst->opcode() != original_opcode); + if (succeeded && inst != nullptr) { + EXPECT_EQ(inst->opcode(), SpvOpCopyObject); + inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + std::vector opcodes = {SpvOpConstantComposite}; + EXPECT_THAT(opcodes, Contains(inst->opcode())); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::Constant* result = const_mrg->GetConstantFromInst(inst); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + const std::vector& componenets = + result->AsVectorConstant()->GetComponents(); + EXPECT_EQ(componenets.size(), tc.expected_result.size()); + for (size_t i = 0; i < componenets.size(); i++) { + EXPECT_EQ(tc.expected_result[i], componenets[i]->GetU32()); + } + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(TestCase, IntVectorInstructionFoldingTest, +::testing::Values( + // Test case 0: fold 0*n + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpVectorShuffle %v2int %v2int_2_2 %v2int_2_3 0 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {2,3}), + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpVectorShuffle %v2int %v2int_null %v2int_2_3 0 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0,3}), + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpVectorShuffle %v2int %v2int_null %v2int_2_3 4294967295 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0,0}), + InstructionFoldingCase>( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpVectorShuffle %v2int %v2int_null %v2int_2_3 0 4294967295 \n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, {0,0}) +)); +// clang-format on + +using BooleanInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(BooleanInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_TRUE(succeeded); + if (inst != nullptr) { + EXPECT_EQ(inst->opcode(), SpvOpCopyObject); + inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + std::vector bool_opcodes = {SpvOpConstantTrue, SpvOpConstantFalse}; + EXPECT_THAT(bool_opcodes, Contains(inst->opcode())); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::BoolConstant* result = + const_mrg->GetConstantFromInst(inst)->AsBoolConstant(); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + EXPECT_EQ(result->value(), tc.expected_result); + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(TestCase, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold true || n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpLogicalOr %bool %true %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 1: fold n || true + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpLogicalOr %bool %load %true\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold false && n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpLogicalAnd %bool %false %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 3: fold n && false + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpLogicalAnd %bool %load %false\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 4: fold n < 0 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpULessThan %bool %load %uint_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 5: fold UINT_MAX < n (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpULessThan %bool %uint_max %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold INT_MAX < n (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSLessThan %bool %int_max %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 7: fold n < INT_MIN (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSLessThan %bool %load %int_min\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold 0 > n (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUGreaterThan %bool %uint_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold n > UINT_MAX (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUGreaterThan %bool %load %uint_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 10: fold n > INT_MAX (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSGreaterThan %bool %load %int_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 11: fold INT_MIN > n (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpSGreaterThan %bool %int_min %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 12: fold 0 <= n (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpULessThanEqual %bool %uint_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 13: fold n <= UINT_MAX (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpULessThanEqual %bool %load %uint_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 14: fold INT_MIN <= n (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSLessThanEqual %bool %int_min %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 15: fold n <= INT_MAX (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSLessThanEqual %bool %load %int_max\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 16: fold n >= 0 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUGreaterThanEqual %bool %load %uint_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 17: fold UINT_MAX >= n (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load = OpLoad %uint %n\n" + + "%2 = OpUGreaterThanEqual %bool %uint_max %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 18: fold n >= INT_MIN (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSGreaterThanEqual %bool %load %int_min\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 19: fold INT_MAX >= n (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSGreaterThanEqual %bool %int_max %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(FClampAndCmpLHS, BooleanInstructionFoldingTest, +::testing::Values( + // Test case 0: fold 0.0 > clamp(n, 0.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFOrdGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold 0.0 > clamp(n, -1.0, -1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_n1\n" + + "%2 = OpFOrdGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold 0.0 >= clamp(n, 1, 2) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFOrdGreaterThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 3: fold 0.0 >= clamp(n, -1.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFOrdGreaterThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 4: fold 0.0 <= clamp(n, 0.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFOrdLessThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: fold 0.0 <= clamp(n, -1.0, -1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_n1\n" + + "%2 = OpFOrdLessThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold 0.0 < clamp(n, 1, 2) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFOrdLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: fold 0.0 < clamp(n, -1.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFOrdLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold 0.0 > clamp(n, 0.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFUnordGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold 0.0 > clamp(n, -1.0, -1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_n1\n" + + "%2 = OpFUnordGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 10: fold 0.0 >= clamp(n, 1, 2) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFUnordGreaterThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 11: fold 0.0 >= clamp(n, -1.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordGreaterThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: fold 0.0 <= clamp(n, 0.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFUnordLessThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 13: fold 0.0 <= clamp(n, -1.0, -1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_n1\n" + + "%2 = OpFUnordLessThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 14: fold 0.0 < clamp(n, 1, 2) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFUnordLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 15: fold 0.0 < clamp(n, -1.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false) +)); + +INSTANTIATE_TEST_CASE_P(FClampAndCmpRHS, BooleanInstructionFoldingTest, +::testing::Values( + // Test case 0: fold clamp(n, 0.0, 1.0) > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFOrdGreaterThan %bool %clamp %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold clamp(n, 1.0, 1.0) > 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_1\n" + + "%2 = OpFOrdGreaterThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold clamp(n, 1, 2) >= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFOrdGreaterThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: fold clamp(n, 1.0, 2.0) >= 3.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFOrdGreaterThanEqual %bool %clamp %float_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 4: fold clamp(n, 0.0, 1.0) <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFOrdLessThanEqual %bool %clamp %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: fold clamp(n, 1.0, 2.0) <= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFOrdLessThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold clamp(n, 1, 2) < 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFOrdLessThan %bool %clamp %float_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: fold clamp(n, -1.0, 0.0) < -1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFOrdLessThan %bool %clamp %float_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold clamp(n, 0.0, 1.0) > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFUnordGreaterThan %bool %clamp %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold clamp(n, 1.0, 2.0) > 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFUnordGreaterThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 10: fold clamp(n, 1, 2) >= 3.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFUnordGreaterThanEqual %bool %clamp %float_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 11: fold clamp(n, -1.0, 0.0) >= -1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordGreaterThanEqual %bool %clamp %float_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: fold clamp(n, 0.0, 1.0) <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFUnordLessThanEqual %bool %clamp %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 13: fold clamp(n, 1.0, 1.0) <= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_1\n" + + "%2 = OpFUnordLessThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 14: fold clamp(n, 1, 2) < 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_1 %float_2\n" + + "%2 = OpFUnordLessThan %bool %clamp %float_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 15: fold clamp(n, -1.0, 0.0) < -1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordLessThan %bool %clamp %float_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 16: fold clamp(n, -1.0, 0.0) < -1.0 (one test for double) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%ld = OpLoad %double %n\n" + + "%clamp = OpExtInst %double %1 FClamp %ld %double_n1 %double_0\n" + + "%2 = OpFUnordLessThan %bool %clamp %double_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false) +)); +// clang-format on + +using FloatInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(FloatInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_TRUE(succeeded); + if (inst != nullptr) { + EXPECT_EQ(inst->opcode(), SpvOpCopyObject); + inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + EXPECT_EQ(inst->opcode(), SpvOpConstant); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::FloatConstant* result = + const_mrg->GetConstantFromInst(inst)->AsFloatConstant(); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + EXPECT_EQ(result->GetFloatValue(), tc.expected_result); + } + } +} + +// Not testing NaNs because there are no expectations concerning NaNs according +// to the "Precision and Operation of SPIR-V Instructions" section of the Vulkan +// specification. + +// clang-format off +INSTANTIATE_TEST_CASE_P(FloatConstantFoldingTest, FloatInstructionFoldingTest, +::testing::Values( + // Test case 0: Fold 2.0 - 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFSub %float %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 1: Fold 2.0 + 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFAdd %float %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3.0), + // Test case 2: Fold 3.0 * 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFMul %float %float_3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 6.0), + // Test case 3: Fold 1.0 / 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFDiv %float %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.5), + // Test case 4: Fold 1.0 / 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFDiv %float %float_1 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, std::numeric_limits::infinity()), + // Test case 5: Fold -1.0 / 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFDiv %float %float_n1 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -std::numeric_limits::infinity()), + // Test case 6: Fold (2.0, 3.0) dot (2.0, 0.5) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpDot %float %v2float_2_3 %v2float_2_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 5.5f), + // Test case 7: Fold (0.0, 0.0) dot v + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %v\n" + + "%3 = OpDot %float %v2float_0_0 %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 8: Fold v dot (0.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %v\n" + + "%3 = OpDot %float %2 %v2float_0_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 9: Fold Null dot v + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %v\n" + + "%3 = OpDot %float %v2float_null %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 10: Fold v dot Null + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %v\n" + + "%3 = OpDot %float %2 %v2float_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 11: Fold -2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFNegate %float %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -2) +)); +// clang-format on + +using DoubleInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(DoubleInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_TRUE(succeeded); + if (inst != nullptr) { + EXPECT_EQ(inst->opcode(), SpvOpCopyObject); + inst = def_use_mgr->GetDef(inst->GetSingleWordInOperand(0)); + EXPECT_EQ(inst->opcode(), SpvOpConstant); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::FloatConstant* result = + const_mrg->GetConstantFromInst(inst)->AsFloatConstant(); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + EXPECT_EQ(result->GetDoubleValue(), tc.expected_result); + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(DoubleConstantFoldingTest, DoubleInstructionFoldingTest, +::testing::Values( + // Test case 0: Fold 2.0 - 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFSub %double %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 1.0), + // Test case 1: Fold 2.0 + 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFAdd %double %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3.0), + // Test case 2: Fold 3.0 * 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFMul %double %double_3 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 6.0), + // Test case 3: Fold 1.0 / 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFDiv %double %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0.5), + // Test case 4: Fold 1.0 / 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFDiv %double %double_1 %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, std::numeric_limits::infinity()), + // Test case 5: Fold -1.0 / 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFDiv %double %double_n1 %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -std::numeric_limits::infinity()), + // Test case 6: Fold (2.0, 3.0) dot (2.0, 0.5) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpDot %double %v2double_2_3 %v2double_2_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 5.5f), + // Test case 7: Fold (0.0, 0.0) dot v + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2double Function\n" + + "%2 = OpLoad %v2double %v\n" + + "%3 = OpDot %double %v2double_0_0 %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 8: Fold v dot (0.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2double Function\n" + + "%2 = OpLoad %v2double %v\n" + + "%3 = OpDot %double %2 %v2double_0_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 9: Fold Null dot v + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2double Function\n" + + "%2 = OpLoad %v2double %v\n" + + "%3 = OpDot %double %v2double_null %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 10: Fold v dot Null + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%v = OpVariable %_ptr_v2double Function\n" + + "%2 = OpLoad %v2double %v\n" + + "%3 = OpDot %double %2 %v2double_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 0.0f), + // Test case 11: Fold -2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFNegate %double %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, -2) +)); +// clang-format on + +// clang-format off +INSTANTIATE_TEST_CASE_P(DoubleOrderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold 1.0 == 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold 1.0 != 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdNotEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold 1.0 < 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThan %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: fold 1.0 > 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThan %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 4: fold 1.0 <= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThanEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: fold 1.0 >= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThanEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold 1.0 == 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: fold 1.0 != 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdNotEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold 1.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThan %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold 1.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThan %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 10: fold 1.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThanEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 11: fold 1.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThanEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: fold 2.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThan %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 13: fold 2.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThan %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 14: fold 2.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThanEqual %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 15: fold 2.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThanEqual %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(DoubleUnorderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold 1.0 == 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold 1.0 != 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordNotEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold 1.0 < 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThan %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: fold 1.0 > 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThan %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 4: fold 1.0 <= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThanEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: fold 1.0 >= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThanEqual %bool %double_1 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold 1.0 == 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: fold 1.0 != 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordNotEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold 1.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThan %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold 1.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThan %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 10: fold 1.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThanEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 11: fold 1.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThanEqual %bool %double_1 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: fold 2.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThan %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 13: fold 2.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThan %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 14: fold 2.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThanEqual %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 15: fold 2.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThanEqual %bool %double_2 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(FloatOrderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold 1.0 == 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold 1.0 != 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdNotEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold 1.0 < 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThan %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: fold 1.0 > 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThan %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 4: fold 1.0 <= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThanEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: fold 1.0 >= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThanEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold 1.0 == 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: fold 1.0 != 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdNotEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold 1.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThan %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold 1.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThan %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 10: fold 1.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThanEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 11: fold 1.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThanEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: fold 2.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThan %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 13: fold 2.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThan %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 14: fold 2.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdLessThanEqual %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 15: fold 2.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdGreaterThanEqual %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(FloatUnorderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold 1.0 == 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold 1.0 != 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordNotEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold 1.0 < 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThan %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: fold 1.0 > 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThan %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 4: fold 1.0 <= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThanEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: fold 1.0 >= 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThanEqual %bool %float_1 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 6: fold 1.0 == 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 7: fold 1.0 != 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordNotEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 8: fold 1.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThan %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 9: fold 1.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThan %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 10: fold 1.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThanEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 11: fold 1.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThanEqual %bool %float_1 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 12: fold 2.0 < 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThan %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 13: fold 2.0 > 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThan %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 14: fold 2.0 <= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordLessThanEqual %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 15: fold 2.0 >= 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordGreaterThanEqual %bool %float_2 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(DoubleNaNCompareConstantFoldingTest, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold NaN == 0 (ord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdEqual %bool %double_nan %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold NaN == NaN (unord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordEqual %bool %double_nan %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold NaN != NaN (ord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdNotEqual %bool %double_nan %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 3: fold NaN != NaN (unord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordNotEqual %bool %double_nan %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(FloatNaNCompareConstantFoldingTest, BooleanInstructionFoldingTest, + ::testing::Values( + // Test case 0: fold NaN == 0 (ord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdEqual %bool %float_nan %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 1: fold NaN == NaN (unord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordEqual %bool %float_nan %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: fold NaN != NaN (ord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFOrdNotEqual %bool %float_nan %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, false), + // Test case 3: fold NaN != NaN (unord) + InstructionFoldingCase( + HeaderWithNaN() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFUnordNotEqual %bool %float_nan %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); +// clang-format on + +template +struct InstructionFoldingCaseWithMap { + InstructionFoldingCaseWithMap(const std::string& tb, uint32_t id, + ResultType result, + std::function map) + : test_body(tb), id_to_fold(id), expected_result(result), id_map(map) {} + + std::string test_body; + uint32_t id_to_fold; + ResultType expected_result; + std::function id_map; +}; + +using IntegerInstructionFoldingTestWithMap = + ::testing::TestWithParam>; + +TEST_P(IntegerInstructionFoldingTestWithMap, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + inst = context->get_instruction_folder().FoldInstructionToConstant(inst, + tc.id_map); + + // Make sure the instruction folded as expected. + EXPECT_NE(inst, nullptr); + if (inst != nullptr) { + EXPECT_EQ(inst->opcode(), SpvOpConstant); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::IntConstant* result = + const_mrg->GetConstantFromInst(inst)->AsIntConstant(); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + EXPECT_EQ(result->GetU32BitValue(), tc.expected_result); + } + } +} +// clang-format off +INSTANTIATE_TEST_CASE_P(TestCase, IntegerInstructionFoldingTestWithMap, + ::testing::Values( + // Test case 0: fold %3 = 0; %3 * n + InstructionFoldingCaseWithMap( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%3 = OpCopyObject %int %int_0\n" + "%2 = OpIMul %int %3 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0, [](uint32_t id) {return (id == 3 ? INT_0_ID : id);}) + )); +// clang-format on + +using BooleanInstructionFoldingTestWithMap = + ::testing::TestWithParam>; + +TEST_P(BooleanInstructionFoldingTestWithMap, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + inst = context->get_instruction_folder().FoldInstructionToConstant(inst, + tc.id_map); + + // Make sure the instruction folded as expected. + EXPECT_NE(inst, nullptr); + if (inst != nullptr) { + std::vector bool_opcodes = {SpvOpConstantTrue, SpvOpConstantFalse}; + EXPECT_THAT(bool_opcodes, Contains(inst->opcode())); + analysis::ConstantManager* const_mrg = context->get_constant_mgr(); + const analysis::BoolConstant* result = + const_mrg->GetConstantFromInst(inst)->AsBoolConstant(); + EXPECT_NE(result, nullptr); + if (result != nullptr) { + EXPECT_EQ(result->value(), tc.expected_result); + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(TestCase, BooleanInstructionFoldingTestWithMap, + ::testing::Values( + // Test case 0: fold %3 = true; %3 || n + InstructionFoldingCaseWithMap( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%3 = OpCopyObject %bool %true\n" + + "%2 = OpLogicalOr %bool %3 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true, [](uint32_t id) {return (id == 3 ? TRUE_ID : id);}) + )); +// clang-format on + +using GeneralInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(GeneralInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + std::unique_ptr original_inst(inst->Clone(context.get())); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_EQ(inst->result_id(), original_inst->result_id()); + EXPECT_EQ(inst->type_id(), original_inst->type_id()); + EXPECT_TRUE((!succeeded) == (tc.expected_result == 0)); + if (succeeded) { + EXPECT_EQ(inst->opcode(), SpvOpCopyObject); + EXPECT_EQ(inst->GetSingleWordInOperand(0), tc.expected_result); + } else { + EXPECT_EQ(inst->NumInOperands(), original_inst->NumInOperands()); + for (uint32_t i = 0; i < inst->NumInOperands(); ++i) { + EXPECT_EQ(inst->GetOperand(i), original_inst->GetOperand(i)); + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(IntegerArithmeticTestCases, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Don't fold n * m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpIMul %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Don't fold n / m (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpUDiv %uint %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: Don't fold n / m (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpSDiv %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Don't fold n remainder m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpSRem %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 4: Don't fold n % m (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpSMod %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 5: Don't fold n % m (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpUMod %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 6: Don't fold n << m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpShiftRightLogical %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 7: Don't fold n >> m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpShiftLeftLogical %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 8: Don't fold n | m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpBitwiseOr %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 9: Don't fold n & m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpBitwiseAnd %int %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 10: Don't fold n < m (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpULessThan %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 11: Don't fold n > m (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpUGreaterThan %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 12: Don't fold n <= m (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpULessThanEqual %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 13: Don't fold n >= m (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%m = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%load_m = OpLoad %uint %m\n" + + "%2 = OpUGreaterThanEqual %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 14: Don't fold n < m (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpULessThan %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 15: Don't fold n > m (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpUGreaterThan %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 16: Don't fold n <= m (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpULessThanEqual %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 17: Don't fold n >= m (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%m = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%load_m = OpLoad %int %m\n" + + "%2 = OpUGreaterThanEqual %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 18: Don't fold n || m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%m = OpVariable %_ptr_bool Function\n" + + "%load_n = OpLoad %bool %n\n" + + "%load_m = OpLoad %bool %m\n" + + "%2 = OpLogicalOr %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 19: Don't fold n && m + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%m = OpVariable %_ptr_bool Function\n" + + "%load_n = OpLoad %bool %n\n" + + "%load_m = OpLoad %bool %m\n" + + "%2 = OpLogicalAnd %bool %load_n %load_m\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 20: Don't fold n * 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpIMul %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 21: Don't fold n / 3 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpUDiv %uint %load_n %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 22: Don't fold n / 3 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpSDiv %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 23: Don't fold n remainder 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpSRem %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 24: Don't fold n % 3 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpSMod %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 25: Don't fold n % 3 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpUMod %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 26: Don't fold n << 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpShiftRightLogical %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 27: Don't fold n >> 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpShiftLeftLogical %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 28: Don't fold n | 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpBitwiseOr %int %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 29: Don't fold n & 3 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpBitwiseAnd %uint %load_n %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 30: Don't fold n < 3 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpULessThan %bool %load_n %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 31: Don't fold n > 3 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpUGreaterThan %bool %load_n %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 32: Don't fold n <= 3 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpULessThanEqual %bool %load_n %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 33: Don't fold n >= 3 (unsigned) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%load_n = OpLoad %uint %n\n" + + "%2 = OpUGreaterThanEqual %bool %load_n %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 34: Don't fold n < 3 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpULessThan %bool %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 35: Don't fold n > 3 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpUGreaterThan %bool %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 36: Don't fold n <= 3 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpULessThanEqual %bool %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 37: Don't fold n >= 3 (signed) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load_n = OpLoad %int %n\n" + + "%2 = OpUGreaterThanEqual %bool %load_n %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 38: Don't fold 2 + 3 (long), bad length + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpIAdd %long %long_2 %long_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 39: Don't fold 2 + 3 (short), bad length + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpIAdd %short %short_2 %short_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 40: fold 1*n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%2 = OpIMul %int %int_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 41: fold n*1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%2 = OpIMul %int %3 %int_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +INSTANTIATE_TEST_CASE_P(CompositeExtractFoldingTest, GeneralInstructionFoldingTest, +::testing::Values( + // Test case 0: fold Insert feeding extract + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeInsert %v4int %2 %v4int_0_0_0_0 0\n" + + "%4 = OpCompositeInsert %v4int %int_1 %3 1\n" + + "%5 = OpCompositeInsert %v4int %int_1 %4 2\n" + + "%6 = OpCompositeInsert %v4int %int_1 %5 3\n" + + "%7 = OpCompositeExtract %int %6 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 7, 2), + // Test case 1: fold Composite construct feeding extract (position 0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeConstruct %v4int %2 %int_0 %int_0 %int_0\n" + + "%4 = OpCompositeExtract %int %3 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, 2), + // Test case 2: fold Composite construct feeding extract (position 3) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeConstruct %v4int %2 %int_0 %int_0 %100\n" + + "%4 = OpCompositeExtract %int %3 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, INT_0_ID), + // Test case 3: fold Composite construct with vectors feeding extract (scalar element) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeConstruct %v2int %2 %int_0\n" + + "%4 = OpCompositeConstruct %v4int %3 %int_0 %100\n" + + "%5 = OpCompositeExtract %int %4 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, INT_0_ID), + // Test case 4: fold Composite construct with vectors feeding extract (start of vector element) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeConstruct %v2int %2 %int_0\n" + + "%4 = OpCompositeConstruct %v4int %3 %int_0 %100\n" + + "%5 = OpCompositeExtract %int %4 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, 2), + // Test case 5: fold Composite construct with vectors feeding extract (middle of vector element) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeConstruct %v2int %int_0 %2\n" + + "%4 = OpCompositeConstruct %v4int %3 %int_0 %100\n" + + "%5 = OpCompositeExtract %int %4 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, 2), + // Test case 6: fold Composite construct with multiple indices. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %n\n" + + "%3 = OpCompositeConstruct %v2int %int_0 %2\n" + + "%4 = OpCompositeConstruct %struct_v2int_int_int %3 %int_0 %100\n" + + "%5 = OpCompositeExtract %int %4 0 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, 2), + // Test case 7: fold constant extract. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCompositeExtract %int %102 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, INT_7_ID), + // Test case 8: constant struct has OpUndef + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCompositeExtract %int %struct_undef_0_0 0 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 9: Extracting a member of element inserted via Insert + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_struct_v2int_int_int Function\n" + + "%2 = OpLoad %struct_v2int_int_int %n\n" + + "%3 = OpCompositeInsert %struct_v2int_int_int %102 %2 0\n" + + "%4 = OpCompositeExtract %int %3 0 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, 103), + // Test case 10: Extracting a element that is partially changed by Insert. (Don't fold) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_struct_v2int_int_int Function\n" + + "%2 = OpLoad %struct_v2int_int_int %n\n" + + "%3 = OpCompositeInsert %struct_v2int_int_int %int_0 %2 0 1\n" + + "%4 = OpCompositeExtract %v2int %3 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, 0), + // Test case 11: Extracting from result of vector shuffle (first input) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %n\n" + + "%3 = OpVectorShuffle %v2int %102 %2 3 0\n" + + "%4 = OpCompositeExtract %int %3 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, INT_7_ID), + // Test case 12: Extracting from result of vector shuffle (second input) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %n\n" + + "%3 = OpVectorShuffle %v2int %2 %102 2 0\n" + + "%4 = OpCompositeExtract %int %3 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, INT_7_ID) +)); + +INSTANTIATE_TEST_CASE_P(CompositeConstructFoldingTest, GeneralInstructionFoldingTest, +::testing::Values( + // Test case 0: fold Extracts feeding construct + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCopyObject %v4int %v4int_0_0_0_0\n" + + "%3 = OpCompositeExtract %int %2 0\n" + + "%4 = OpCompositeExtract %int %2 1\n" + + "%5 = OpCompositeExtract %int %2 2\n" + + "%6 = OpCompositeExtract %int %2 3\n" + + "%7 = OpCompositeConstruct %v4int %3 %4 %5 %6\n" + + "OpReturn\n" + + "OpFunctionEnd", + 7, 2), + // Test case 1: Don't fold Extracts feeding construct (Different source) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCopyObject %v4int %v4int_0_0_0_0\n" + + "%3 = OpCompositeExtract %int %2 0\n" + + "%4 = OpCompositeExtract %int %2 1\n" + + "%5 = OpCompositeExtract %int %2 2\n" + + "%6 = OpCompositeExtract %int %v4int_0_0_0_0 3\n" + + "%7 = OpCompositeConstruct %v4int %3 %4 %5 %6\n" + + "OpReturn\n" + + "OpFunctionEnd", + 7, 0), + // Test case 2: Don't fold Extracts feeding construct (bad indices) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCopyObject %v4int %v4int_0_0_0_0\n" + + "%3 = OpCompositeExtract %int %2 0\n" + + "%4 = OpCompositeExtract %int %2 0\n" + + "%5 = OpCompositeExtract %int %2 2\n" + + "%6 = OpCompositeExtract %int %2 3\n" + + "%7 = OpCompositeConstruct %v4int %3 %4 %5 %6\n" + + "OpReturn\n" + + "OpFunctionEnd", + 7, 0), + // Test case 3: Don't fold Extracts feeding construct (different type) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCopyObject %struct_v2int_int_int %struct_v2int_int_int_null\n" + + "%3 = OpCompositeExtract %v2int %2 0\n" + + "%4 = OpCompositeExtract %int %2 1\n" + + "%5 = OpCompositeExtract %int %2 2\n" + + "%7 = OpCompositeConstruct %v4int %3 %4 %5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 7, 0), + // Test case 4: Fold construct with constants to constant. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpCompositeConstruct %v2int %103 %103\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, VEC2_0_ID) +)); + +INSTANTIATE_TEST_CASE_P(PhiFoldingTest, GeneralInstructionFoldingTest, +::testing::Values( + // Test case 0: Fold phi with the same values for all edges. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + " OpBranchConditional %true %l1 %l2\n" + + "%l1 = OpLabel\n" + + " OpBranch %merge_lab\n" + + "%l2 = OpLabel\n" + + " OpBranch %merge_lab\n" + + "%merge_lab = OpLabel\n" + + "%2 = OpPhi %int %100 %l1 %100 %l2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, INT_0_ID), + // Test case 1: Fold phi in pass through loop. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + " OpBranch %l1\n" + + "%l1 = OpLabel\n" + + "%2 = OpPhi %int %100 %main_lab %2 %l1\n" + + " OpBranchConditional %true %l1 %merge_lab\n" + + "%merge_lab = OpLabel\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, INT_0_ID), + // Test case 2: Don't Fold phi because of different values. + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + " OpBranch %l1\n" + + "%l1 = OpLabel\n" + + "%2 = OpPhi %int %int_0 %main_lab %int_3 %l1\n" + + " OpBranchConditional %true %l1 %merge_lab\n" + + "%merge_lab = OpLabel\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) +)); + +INSTANTIATE_TEST_CASE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Don't fold n + 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFAdd %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Don't fold n - 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFSub %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: Don't fold n * 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFMul %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Fold n + 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFAdd %float %3 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 4: Fold 0.0 + n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFAdd %float %float_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 5: Fold n - 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFSub %float %3 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 6: Fold n * 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFMul %float %3 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 7: Fold 1.0 * n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFMul %float %float_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 8: Fold n / 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFDiv %float %3 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 9: Fold n * 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFMul %float %3 %104\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, FLOAT_0_ID), + // Test case 10: Fold 0.0 * n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFMul %float %104 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, FLOAT_0_ID), + // Test case 11: Fold 0.0 / n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFDiv %float %104 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, FLOAT_0_ID), + // Test case 12: Don't fold mix(a, b, 2.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%b = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %a\n" + + "%4 = OpLoad %float %b\n" + + "%2 = OpExtInst %float %1 FMix %3 %4 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 13: Fold mix(a, b, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%b = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %a\n" + + "%4 = OpLoad %float %b\n" + + "%2 = OpExtInst %float %1 FMix %3 %4 %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 14: Fold mix(a, b, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_float Function\n" + + "%b = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %a\n" + + "%4 = OpLoad %float %b\n" + + "%2 = OpExtInst %float %1 FMix %3 %4 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4), + // Test case 15: Fold vector fadd with null + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %a\n" + + "%3 = OpFAdd %v2float %2 %v2float_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 2), + // Test case 16: Fold vector fadd with null + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %a\n" + + "%3 = OpFAdd %v2float %v2float_null %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 2), + // Test case 15: Fold vector fsub with null + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %a\n" + + "%3 = OpFSub %v2float %2 %v2float_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, 2), + // Test case 16: Fold 0.0(half) * n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_half Function\n" + + "%3 = OpLoad %half %n\n" + + "%2 = OpFMul %half %108 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, HALF_0_ID), + // Test case 17: Don't fold 1.0(half) * n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_half Function\n" + + "%3 = OpLoad %half %n\n" + + "%2 = OpFMul %half %half_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 18: Don't fold 1.0 * 1.0 (half) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFMul %half %half_1 %half_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) +)); + +INSTANTIATE_TEST_CASE_P(DoubleRedundantFoldingTest, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Don't fold n + 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFAdd %double %3 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Don't fold n - 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFSub %double %3 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: Don't fold n * 2.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFMul %double %3 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Fold n + 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFAdd %double %3 %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 4: Fold 0.0 + n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFAdd %double %double_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 5: Fold n - 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFSub %double %3 %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 6: Fold n * 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFMul %double %3 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 7: Fold 1.0 * n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFMul %double %double_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 8: Fold n / 1.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFDiv %double %3 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 9: Fold n * 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFMul %double %3 %105\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, DOUBLE_0_ID), + // Test case 10: Fold 0.0 * n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFMul %double %105 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, DOUBLE_0_ID), + // Test case 11: Fold 0.0 / n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFDiv %double %105 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, DOUBLE_0_ID), + // Test case 12: Don't fold mix(a, b, 2.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_double Function\n" + + "%b = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %a\n" + + "%4 = OpLoad %double %b\n" + + "%2 = OpExtInst %double %1 FMix %3 %4 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 13: Fold mix(a, b, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_double Function\n" + + "%b = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %a\n" + + "%4 = OpLoad %double %b\n" + + "%2 = OpExtInst %double %1 FMix %3 %4 %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 14: Fold mix(a, b, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%a = OpVariable %_ptr_double Function\n" + + "%b = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %a\n" + + "%4 = OpLoad %double %b\n" + + "%2 = OpExtInst %double %1 FMix %3 %4 %double_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 4) +)); + +INSTANTIATE_TEST_CASE_P(FloatVectorRedundantFoldingTest, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Don't fold a * vec4(0.0, 0.0, 0.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%3 = OpLoad %v4float %n\n" + + "%2 = OpFMul %v4float %3 %v4float_0_0_0_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Fold a * vec4(0.0, 0.0, 0.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%3 = OpLoad %v4float %n\n" + + "%2 = OpFMul %v4float %3 %106\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, VEC4_0_ID), + // Test case 2: Fold a * vec4(1.0, 1.0, 1.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%3 = OpLoad %v4float %n\n" + + "%2 = OpFMul %v4float %3 %v4float_1_1_1_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +INSTANTIATE_TEST_CASE_P(DoubleVectorRedundantFoldingTest, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Don't fold a * vec4(0.0, 0.0, 0.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%3 = OpLoad %v4double %n\n" + + "%2 = OpFMul %v4double %3 %v4double_0_0_0_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Fold a * vec4(0.0, 0.0, 0.0, 0.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%3 = OpLoad %v4double %n\n" + + "%2 = OpFMul %v4double %3 %106\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, DVEC4_0_ID), + // Test case 2: Fold a * vec4(1.0, 1.0, 1.0, 1.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%3 = OpLoad %v4double %n\n" + + "%2 = OpFMul %v4double %3 %v4double_1_1_1_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +INSTANTIATE_TEST_CASE_P(IntegerRedundantFoldingTest, GeneralInstructionFoldingTest, + ::testing::Values( + // Test case 0: Don't fold n + 1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpIAdd %uint %3 %uint_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Don't fold 1 + n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpIAdd %uint %uint_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: Fold n + 0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpIAdd %uint %3 %uint_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 3: Fold 0 + n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_uint Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpIAdd %uint %uint_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 4: Don't fold n + (1,0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%3 = OpLoad %v2int %n\n" + + "%2 = OpIAdd %v2int %3 %v2int_1_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 5: Don't fold (1,0) + n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%3 = OpLoad %v2int %n\n" + + "%2 = OpIAdd %v2int %v2int_1_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 6: Fold n + (0,0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%3 = OpLoad %v2int %n\n" + + "%2 = OpIAdd %v2int %3 %v2int_0_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 7: Fold (0,0) + n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%3 = OpLoad %v2int %n\n" + + "%2 = OpIAdd %v2int %v2int_0_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +INSTANTIATE_TEST_CASE_P(ClampAndCmpLHS, GeneralInstructionFoldingTest, +::testing::Values( + // Test case 0: Don't Fold 0.0 < clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Don't Fold 0.0 < clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: Don't Fold 0.0 <= clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordLessThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Don't Fold 0.0 <= clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdLessThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 4: Don't Fold 0.0 > clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 5: Don't Fold 0.0 > clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 6: Don't Fold 0.0 >= clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordGreaterThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 7: Don't Fold 0.0 >= clamp(-1, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdGreaterThanEqual %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 8: Don't Fold 0.0 < clamp(0, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFUnordLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 9: Don't Fold 0.0 < clamp(0, 1) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFOrdLessThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 10: Don't Fold 0.0 > clamp(-1, 0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 11: Don't Fold 0.0 > clamp(-1, 0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFOrdGreaterThan %bool %float_0 %clamp\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) +)); + +INSTANTIATE_TEST_CASE_P(ClampAndCmpRHS, GeneralInstructionFoldingTest, +::testing::Values( + // Test case 0: Don't Fold clamp(-1, 1) < 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordLessThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Don't Fold clamp(-1, 1) < 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdLessThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 2: Don't Fold clamp(-1, 1) <= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordLessThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Don't Fold clamp(-1, 1) <= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdLessThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 4: Don't Fold clamp(-1, 1) > 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordGreaterThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 5: Don't Fold clamp(-1, 1) > 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdGreaterThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 6: Don't Fold clamp(-1, 1) >= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFUnordGreaterThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 7: Don't Fold clamp(-1, 1) >= 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_1\n" + + "%2 = OpFOrdGreaterThanEqual %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 8: Don't Fold clamp(-1, 0) < 0.0 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordLessThan %bool %clamp %float_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 9: Don't Fold clamp(0, 1) < 1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_0 %float_1\n" + + "%2 = OpFOrdLessThan %bool %clamp %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 10: Don't Fold clamp(-1, 0) > -1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFUnordGreaterThan %bool %clamp %float_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 11: Don't Fold clamp(-1, 0) > -1 + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%ld = OpLoad %float %n\n" + + "%clamp = OpExtInst %float %1 FClamp %ld %float_n1 %float_0\n" + + "%2 = OpFOrdGreaterThan %bool %clamp %float_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0) +)); + +INSTANTIATE_TEST_CASE_P(FToIConstantFoldingTest, IntegerInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold int(3.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpConvertFToS %int %float_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 1: Fold uint(3.0) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpConvertFToU %int %float_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +INSTANTIATE_TEST_CASE_P(IToFConstantFoldingTest, FloatInstructionFoldingTest, + ::testing::Values( + // Test case 0: Fold float(3) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpConvertSToF %float %int_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3.0), + // Test case 1: Fold float(3u) + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpConvertUToF %float %uint_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3.0) +)); +// clang-format on + +using ToNegateFoldingTest = + ::testing::TestWithParam>; + +TEST_P(ToNegateFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + std::unique_ptr original_inst(inst->Clone(context.get())); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + + // Make sure the instruction folded as expected. + EXPECT_EQ(inst->result_id(), original_inst->result_id()); + EXPECT_EQ(inst->type_id(), original_inst->type_id()); + EXPECT_TRUE((!succeeded) == (tc.expected_result == 0)); + if (succeeded) { + EXPECT_EQ(inst->opcode(), SpvOpFNegate); + EXPECT_EQ(inst->GetSingleWordInOperand(0), tc.expected_result); + } else { + EXPECT_EQ(inst->NumInOperands(), original_inst->NumInOperands()); + for (uint32_t i = 0; i < inst->NumInOperands(); ++i) { + EXPECT_EQ(inst->GetOperand(i), original_inst->GetOperand(i)); + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(FloatRedundantSubFoldingTest, ToNegateFoldingTest, + ::testing::Values( + // Test case 0: Don't fold 1.0 - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFSub %float %float_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Fold 0.0 - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_float Function\n" + + "%3 = OpLoad %float %n\n" + + "%2 = OpFSub %float %float_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 2: Don't fold (0,0,0,1) - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%3 = OpLoad %v4float %n\n" + + "%2 = OpFSub %v4float %v4float_0_0_0_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Fold (0,0,0,0) - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%3 = OpLoad %v4float %n\n" + + "%2 = OpFSub %v4float %v4float_0_0_0_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +INSTANTIATE_TEST_CASE_P(DoubleRedundantSubFoldingTest, ToNegateFoldingTest, + ::testing::Values( + // Test case 0: Don't fold 1.0 - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFSub %double %double_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 1: Fold 0.0 - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%3 = OpLoad %double %n\n" + + "%2 = OpFSub %double %double_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3), + // Test case 2: Don't fold (0,0,0,1) - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%3 = OpLoad %v4double %n\n" + + "%2 = OpFSub %v4double %v4double_0_0_0_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 0), + // Test case 3: Fold (0,0,0,0) - n + InstructionFoldingCase( + Header() + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%3 = OpLoad %v4double %n\n" + + "%2 = OpFSub %v4double %v4double_0_0_0_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, 3) +)); + +#ifdef SPIRV_EFFCEE +using MatchingInstructionFoldingTest = + ::testing::TestWithParam>; + +TEST_P(MatchingInstructionFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + analysis::DefUseManager* def_use_mgr = context->get_def_use_mgr(); + Instruction* inst = def_use_mgr->GetDef(tc.id_to_fold); + std::unique_ptr original_inst(inst->Clone(context.get())); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + EXPECT_EQ(succeeded, tc.expected_result); + if (succeeded) { + Match(tc.test_body, context.get()); + } +} + +INSTANTIATE_TEST_CASE_P(RedundantIntegerMatching, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: Fold 0 + n (change sign) + InstructionFoldingCase( + Header() + + "; CHECK: [[uint:%\\w+]] = OpTypeInt 32 0\n" + + "; CHECK: %2 = OpBitcast [[uint]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %uint %n\n" + + "%2 = OpIAdd %uint %int_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 2, true), + // Test case 0: Fold 0 + n (change sign) + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: %2 = OpBitcast [[int]] %3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%3 = OpLoad %int %n\n" + + "%2 = OpIAdd %int %uint_0 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(MergeNegateTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: fold consecutive fnegate + // -(-x) = x + InstructionFoldingCase( + Header() + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float:%\\w+]]\n" + + "; CHECK: %4 = OpCopyObject [[float]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFNegate %float %2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 1: fold fnegate(fmul with const). + // -(x * 2.0) = x * -2.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[ld]] [[float_n2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFMul %float %2 %float_2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 2: fold fnegate(fmul with const). + // -(2.0 * x) = x * 2.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[ld]] [[float_n2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFMul %float %float_2 %2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 3: fold fnegate(fdiv with const). + // -(x / 2.0) = x * -0.5 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n0p5:%\\w+]] = OpConstant [[float]] -0.5\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[ld]] [[float_n0p5]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %2 %float_2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 4: fold fnegate(fdiv with const). + // -(2.0 / x) = -2.0 / x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFDiv [[float]] [[float_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %float_2 %2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 5: fold fnegate(fadd with const). + // -(2.0 + x) = -2.0 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %float_2 %2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 6: fold fnegate(fadd with const). + // -(x + 2.0) = -2.0 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %2 %float_2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 7: fold fnegate(fsub with const). + // -(2.0 - x) = x - 2.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[ld]] [[float_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %float_2 %2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 8: fold fnegate(fsub with const). + // -(x - 2.0) = 2.0 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %2 %float_2\n" + + "%4 = OpFNegate %float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 9: fold consecutive snegate + // -(-x) = x + InstructionFoldingCase( + Header() + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int:%\\w+]]\n" + + "; CHECK: %4 = OpCopyObject [[int]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSNegate %int %2\n" + + "%4 = OpSNegate %int %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 10: fold consecutive vector negate + // -(-x) = x + InstructionFoldingCase( + Header() + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2float:%\\w+]]\n" + + "; CHECK: %4 = OpCopyObject [[v2float]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %var\n" + + "%3 = OpFNegate %v2float %2\n" + + "%4 = OpFNegate %v2float %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 11: fold snegate(iadd with const). + // -(2 + x) = -2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: OpConstant [[int]] -2147483648\n" + + "; CHECK: [[int_n2:%\\w+]] = OpConstant [[int]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpISub [[int]] [[int_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIAdd %int %int_2 %2\n" + + "%4 = OpSNegate %int %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 12: fold snegate(iadd with const). + // -(x + 2) = -2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: OpConstant [[int]] -2147483648\n" + + "; CHECK: [[int_n2:%\\w+]] = OpConstant [[int]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpISub [[int]] [[int_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIAdd %int %2 %int_2\n" + + "%4 = OpSNegate %int %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 13: fold snegate(isub with const). + // -(2 - x) = x - 2 + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int_2:%\\w+]] = OpConstant [[int]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpISub [[int]] [[ld]] [[int_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpISub %int %int_2 %2\n" + + "%4 = OpSNegate %int %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 14: fold snegate(isub with const). + // -(x - 2) = 2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int_2:%\\w+]] = OpConstant [[int]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpISub [[int]] [[int_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpISub %int %2 %int_2\n" + + "%4 = OpSNegate %int %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 15: fold snegate(iadd with const). + // -(x + 2) = -2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_n2:%\\w+]] = OpConstant [[long]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[long_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpIAdd %long %2 %long_2\n" + + "%4 = OpSNegate %long %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 16: fold snegate(isub with const). + // -(2 - x) = x - 2 + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[ld]] [[long_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpISub %long %long_2 %2\n" + + "%4 = OpSNegate %long %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 17: fold snegate(isub with const). + // -(x - 2) = 2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[long_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpISub %long %2 %long_2\n" + + "%4 = OpSNegate %long %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 18: fold -vec4(-1.0, 2.0, 1.0, 3.0) + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[v4float:%\\w+]] = OpTypeVector [[float]] 4\n" + + "; CHECK: [[float_n1:%\\w+]] = OpConstant [[float]] -1\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[float_n3:%\\w+]] = OpConstant [[float]] -3\n" + + "; CHECK: [[v4float_1_n2_n1_n3:%\\w+]] = OpConstantComposite [[v4float]] [[float_1]] [[float_n2]] [[float_n1]] [[float_n3]]\n" + + "; CHECK: %2 = OpCopyObject [[v4float]] [[v4float_1_n2_n1_n3]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFNegate %v4float %v4float_n1_2_1_3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 19: fold vector fnegate with null + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v2double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: [[double_n0:%\\w+]] = OpConstant [[double]] -0\n" + + "; CHECK: [[v2double_0_0:%\\w+]] = OpConstantComposite [[v2double]] [[double_n0]] [[double_n0]]\n" + + "; CHECK: %2 = OpCopyObject [[v2double]] [[v2double_0_0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpFNegate %v2double %v2double_null\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true) +)); + +INSTANTIATE_TEST_CASE_P(ReciprocalFDivTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: scalar reicprocal + // x / 0.5 = x * 2.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %3 = OpFMul [[float]] [[ld]] [[float_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %2 %float_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 3, true), + // Test case 1: Unfoldable + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_0:%\\w+]] = OpConstant [[float]] 0\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %3 = OpFDiv [[float]] [[ld]] [[float_0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %2 %104\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 3, false), + // Test case 2: Vector reciprocal + // x / {2.0, 0.5} = x * {0.5, 2.0} + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[v2float:%\\w+]] = OpTypeVector [[float]] 2\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[float_0p5:%\\w+]] = OpConstant [[float]] 0.5\n" + + "; CHECK: [[v2float_0p5_2:%\\w+]] = OpConstantComposite [[v2float]] [[float_0p5]] [[float_2]]\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2float]]\n" + + "; CHECK: %3 = OpFMul [[v2float]] [[ld]] [[v2float_0p5_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %var\n" + + "%3 = OpFDiv %v2float %2 %v2float_2_0p5\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 3, true), + // Test case 3: double reciprocal + // x / 2.0 = x * 0.5 + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[double_0p5:%\\w+]] = OpConstant [[double]] 0.5\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[double]]\n" + + "; CHECK: %3 = OpFMul [[double]] [[ld]] [[double_0p5]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_double Function\n" + + "%2 = OpLoad %double %var\n" + + "%3 = OpFDiv %double %2 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 3, true), + // Test case 4: don't fold x / 0. + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %var\n" + + "%3 = OpFDiv %v2float %2 %v2float_null\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 3, false) +)); + +INSTANTIATE_TEST_CASE_P(MergeMulTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: fold consecutive fmuls + // (x * 3.0) * 2.0 = x * 6.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_6:%\\w+]] = OpConstant [[float]] 6\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[ld]] [[float_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFMul %float %2 %float_3\n" + + "%4 = OpFMul %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 1: fold consecutive fmuls + // 2.0 * (x * 3.0) = x * 6.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_6:%\\w+]] = OpConstant [[float]] 6\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[ld]] [[float_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFMul %float %2 %float_3\n" + + "%4 = OpFMul %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 2: fold consecutive fmuls + // (3.0 * x) * 2.0 = x * 6.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_6:%\\w+]] = OpConstant [[float]] 6\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[ld]] [[float_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFMul %float %float_3 %2\n" + + "%4 = OpFMul %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 3: fold vector fmul + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[v2float:%\\w+]] = OpTypeVector [[float]] 2\n" + + "; CHECK: [[float_6:%\\w+]] = OpConstant [[float]] 6\n" + + "; CHECK: [[v2float_6_6:%\\w+]] = OpConstantComposite [[v2float]] [[float_6]] [[float_6]]\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2float]]\n" + + "; CHECK: %4 = OpFMul [[v2float]] [[ld]] [[v2float_6_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %var\n" + + "%3 = OpFMul %v2float %2 %v2float_2_3\n" + + "%4 = OpFMul %v2float %3 %v2float_3_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 4: fold double fmuls + // (x * 3.0) * 2.0 = x * 6.0 + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[double_6:%\\w+]] = OpConstant [[double]] 6\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[double]]\n" + + "; CHECK: %4 = OpFMul [[double]] [[ld]] [[double_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_double Function\n" + + "%2 = OpLoad %double %var\n" + + "%3 = OpFMul %double %2 %double_3\n" + + "%4 = OpFMul %double %3 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 5: fold 32 bit imuls + // (x * 3) * 2 = x * 6 + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int_6:%\\w+]] = OpConstant [[int]] 6\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpIMul [[int]] [[ld]] [[int_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIMul %int %2 %int_3\n" + + "%4 = OpIMul %int %3 %int_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 6: fold 64 bit imuls + // (x * 3) * 2 = x * 6 + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64\n" + + "; CHECK: [[long_6:%\\w+]] = OpConstant [[long]] 6\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpIMul [[long]] [[ld]] [[long_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpIMul %long %2 %long_3\n" + + "%4 = OpIMul %long %3 %long_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 7: merge vector integer mults + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[v2int:%\\w+]] = OpTypeVector [[int]] 2\n" + + "; CHECK: [[int_6:%\\w+]] = OpConstant [[int]] 6\n" + + "; CHECK: [[v2int_6_6:%\\w+]] = OpConstantComposite [[v2int]] [[int_6]] [[int_6]]\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2int]]\n" + + "; CHECK: %4 = OpIMul [[v2int]] [[ld]] [[v2int_6_6]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %var\n" + + "%3 = OpIMul %v2int %2 %v2int_2_3\n" + + "%4 = OpIMul %v2int %3 %v2int_3_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 8: merge fmul of fdiv + // 2.0 * (2.0 / x) = 4.0 / x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_4:%\\w+]] = OpConstant [[float]] 4\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFDiv [[float]] [[float_4]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %float_2 %2\n" + + "%4 = OpFMul %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 9: merge fmul of fdiv + // (2.0 / x) * 2.0 = 4.0 / x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_4:%\\w+]] = OpConstant [[float]] 4\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFDiv [[float]] [[float_4]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %float_2 %2\n" + + "%4 = OpFMul %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 10: Do not merge imul of sdiv + // 4 * (x / 2) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSDiv %int %2 %int_2\n" + + "%4 = OpIMul %int %int_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 11: Do not merge imul of sdiv + // (x / 2) * 4 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSDiv %int %2 %int_2\n" + + "%4 = OpIMul %int %3 %int_4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 12: Do not merge imul of udiv + // 4 * (x / 2) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_uint Function\n" + + "%2 = OpLoad %uint %var\n" + + "%3 = OpUDiv %uint %2 %uint_2\n" + + "%4 = OpIMul %uint %uint_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 13: Do not merge imul of udiv + // (x / 2) * 4 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_uint Function\n" + + "%2 = OpLoad %uint %var\n" + + "%3 = OpUDiv %uint %2 %uint_2\n" + + "%4 = OpIMul %uint %3 %uint_4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 14: Don't fold + // (x / 3) * 4 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_uint Function\n" + + "%2 = OpLoad %uint %var\n" + + "%3 = OpUDiv %uint %2 %uint_3\n" + + "%4 = OpIMul %uint %3 %uint_4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 15: merge vector fmul of fdiv + // (x / {2,2}) * {4,4} = x * {2,2} + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[v2float:%\\w+]] = OpTypeVector [[float]] 2\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[v2float_2_2:%\\w+]] = OpConstantComposite [[v2float]] [[float_2]] [[float_2]]\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2float]]\n" + + "; CHECK: %4 = OpFMul [[v2float]] [[ld]] [[v2float_2_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %v2float %var\n" + + "%3 = OpFDiv %v2float %2 %v2float_2_2\n" + + "%4 = OpFMul %v2float %3 %v2float_4_4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 16: merge vector imul of snegate + // (-x) * {2,2} = x * {-2,-2} + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[v2int:%\\w+]] = OpTypeVector [[int]] 2\n" + + "; CHECK: OpConstant [[int]] -2147483648\n" + + "; CHECK: [[int_n2:%\\w+]] = OpConstant [[int]] -2\n" + + "; CHECK: [[v2int_n2_n2:%\\w+]] = OpConstantComposite [[v2int]] [[int_n2]] [[int_n2]]\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2int]]\n" + + "; CHECK: %4 = OpIMul [[v2int]] [[ld]] [[v2int_n2_n2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %var\n" + + "%3 = OpSNegate %v2int %2\n" + + "%4 = OpIMul %v2int %3 %v2int_2_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 17: merge vector imul of snegate + // {2,2} * (-x) = x * {-2,-2} + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[v2int:%\\w+]] = OpTypeVector [[int]] 2\n" + + "; CHECK: OpConstant [[int]] -2147483648\n" + + "; CHECK: [[int_n2:%\\w+]] = OpConstant [[int]] -2\n" + + "; CHECK: [[v2int_n2_n2:%\\w+]] = OpConstantComposite [[v2int]] [[int_n2]] [[int_n2]]\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v2int]]\n" + + "; CHECK: %4 = OpIMul [[v2int]] [[ld]] [[v2int_n2_n2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %var\n" + + "%3 = OpSNegate %v2int %2\n" + + "%4 = OpIMul %v2int %v2int_2_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 18: Fold OpVectorTimesScalar + // {4,4} = OpVectorTimesScalar v2float {2,2} 2 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[v2float:%\\w+]] = OpTypeVector [[float]] 2\n" + + "; CHECK: [[float_4:%\\w+]] = OpConstant [[float]] 4\n" + + "; CHECK: [[v2float_4_4:%\\w+]] = OpConstantComposite [[v2float]] [[float_4]] [[float_4]]\n" + + "; CHECK: %2 = OpCopyObject [[v2float]] [[v2float_4_4]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVectorTimesScalar %v2float %v2float_2_2 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 19: Fold OpVectorTimesScalar + // {0,0} = OpVectorTimesScalar v2float v2float_null -1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[v2float:%\\w+]] = OpTypeVector [[float]] 2\n" + + "; CHECK: [[v2float_null:%\\w+]] = OpConstantNull [[v2float]]\n" + + "; CHECK: %2 = OpCopyObject [[v2float]] [[v2float_null]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVectorTimesScalar %v2float %v2float_null %float_n1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 20: Fold OpVectorTimesScalar + // {4,4} = OpVectorTimesScalar v2double {2,2} 2 + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v2double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: [[double_4:%\\w+]] = OpConstant [[double]] 4\n" + + "; CHECK: [[v2double_4_4:%\\w+]] = OpConstantComposite [[v2double]] [[double_4]] [[double_4]]\n" + + "; CHECK: %2 = OpCopyObject [[v2double]] [[v2double_4_4]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVectorTimesScalar %v2double %v2double_2_2 %double_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 21: Fold OpVectorTimesScalar + // {0,0} = OpVectorTimesScalar v2double {0,0} n + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v2double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: {{%\\w+}} = OpConstant [[double]] 0\n" + + "; CHECK: [[double_0:%\\w+]] = OpConstant [[double]] 0\n" + + "; CHECK: [[v2double_0_0:%\\w+]] = OpConstantComposite [[v2double]] [[double_0]] [[double_0]]\n" + + "; CHECK: %2 = OpCopyObject [[v2double]] [[v2double_0_0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_double Function\n" + + "%load = OpLoad %double %n\n" + + "%2 = OpVectorTimesScalar %v2double %v2double_0_0 %load\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 22: Fold OpVectorTimesScalar + // {0,0} = OpVectorTimesScalar v2double n 0 + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v2double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: [[v2double_null:%\\w+]] = OpConstantNull [[v2double]]\n" + + "; CHECK: %2 = OpCopyObject [[v2double]] [[v2double_null]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2double Function\n" + + "%load = OpLoad %v2double %n\n" + + "%2 = OpVectorTimesScalar %v2double %load %double_0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 23: merge fmul of fdiv + // x * (y / x) = y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[ldx:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[ldy:%\\w+]] = OpLoad [[float]] [[y:%\\w+]]\n" + + "; CHECK: %5 = OpCopyObject [[float]] [[ldy]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %x\n" + + "%3 = OpLoad %float %y\n" + + "%4 = OpFDiv %float %3 %2\n" + + "%5 = OpFMul %float %2 %4\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 5, true), + // Test case 24: merge fmul of fdiv + // (y / x) * x = y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[ldx:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[ldy:%\\w+]] = OpLoad [[float]] [[y:%\\w+]]\n" + + "; CHECK: %5 = OpCopyObject [[float]] [[ldy]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %x\n" + + "%3 = OpLoad %float %y\n" + + "%4 = OpFDiv %float %3 %2\n" + + "%5 = OpFMul %float %4 %2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 5, true) +)); + +INSTANTIATE_TEST_CASE_P(MergeDivTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: merge consecutive fdiv + // 4.0 / (2.0 / x) = 2.0 * x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFMul [[float]] [[float_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %float_2 %2\n" + + "%4 = OpFDiv %float %float_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 1: merge consecutive fdiv + // 4.0 / (x / 2.0) = 8.0 / x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_8:%\\w+]] = OpConstant [[float]] 8\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFDiv [[float]] [[float_8]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %2 %float_2\n" + + "%4 = OpFDiv %float %float_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 2: merge consecutive fdiv + // (4.0 / x) / 2.0 = 2.0 / x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFDiv [[float]] [[float_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %float_4 %2\n" + + "%4 = OpFDiv %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 3: Do not merge consecutive sdiv + // 4 / (2 / x) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSDiv %int %int_2 %2\n" + + "%4 = OpSDiv %int %int_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 4: Do not merge consecutive sdiv + // 4 / (x / 2) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSDiv %int %2 %int_2\n" + + "%4 = OpSDiv %int %int_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 5: Do not merge consecutive sdiv + // (4 / x) / 2 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSDiv %int %int_4 %2\n" + + "%4 = OpSDiv %int %3 %int_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 6: Do not merge consecutive sdiv + // (x / 4) / 2 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSDiv %int %2 %int_4\n" + + "%4 = OpSDiv %int %3 %int_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 7: Do not merge sdiv of imul + // 4 / (2 * x) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIMul %int %int_2 %2\n" + + "%4 = OpSDiv %int %int_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 8: Do not merge sdiv of imul + // 4 / (x * 2) + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIMul %int %2 %int_2\n" + + "%4 = OpSDiv %int %int_4 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 9: Do not merge sdiv of imul + // (4 * x) / 2 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIMul %int %int_4 %2\n" + + "%4 = OpSDiv %int %3 %int_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 10: Do not merge sdiv of imul + // (x * 4) / 2 + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpIMul %int %2 %int_4\n" + + "%4 = OpSDiv %int %3 %int_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 11: merge sdiv of snegate + // (-x) / 2 = x / -2 + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: OpConstant [[int]] -2147483648\n" + + "; CHECK: [[int_n2:%\\w+]] = OpConstant [[int]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpSDiv [[int]] [[ld]] [[int_n2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSNegate %int %2\n" + + "%4 = OpSDiv %int %3 %int_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 12: merge sdiv of snegate + // 2 / (-x) = -2 / x + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: OpConstant [[int]] -2147483648\n" + + "; CHECK: [[int_n2:%\\w+]] = OpConstant [[int]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[int]]\n" + + "; CHECK: %4 = OpSDiv [[int]] [[int_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_int Function\n" + + "%2 = OpLoad %int %var\n" + + "%3 = OpSNegate %int %2\n" + + "%4 = OpSDiv %int %int_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 13: Don't merge + // (x / {null}) / {null} + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_v2float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFDiv %float %2 %v2float_null\n" + + "%4 = OpFDiv %float %3 %v2float_null\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, false), + // Test case 14: merge fmul of fdiv + // (y * x) / x = y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[ldx:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[ldy:%\\w+]] = OpLoad [[float]] [[y:%\\w+]]\n" + + "; CHECK: %5 = OpCopyObject [[float]] [[ldy]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %x\n" + + "%3 = OpLoad %float %y\n" + + "%4 = OpFMul %float %3 %2\n" + + "%5 = OpFDiv %float %4 %2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 5, true), + // Test case 15: merge fmul of fdiv + // (x * y) / x = y + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[ldx:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: [[ldy:%\\w+]] = OpLoad [[float]] [[y:%\\w+]]\n" + + "; CHECK: %5 = OpCopyObject [[float]] [[ldy]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%x = OpVariable %_ptr_float Function\n" + + "%y = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %x\n" + + "%3 = OpLoad %float %y\n" + + "%4 = OpFMul %float %2 %3\n" + + "%5 = OpFDiv %float %4 %2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 5, true) +)); + +INSTANTIATE_TEST_CASE_P(MergeAddTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: merge add of negate + // (-x) + 2 = 2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFNegate %float %2\n" + + "%4 = OpFAdd %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 1: merge add of negate + // 2 + (-x) = 2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpSNegate %float %2\n" + + "%4 = OpIAdd %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 2: merge add of negate + // (-x) + 2 = 2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[long_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpSNegate %long %2\n" + + "%4 = OpIAdd %long %3 %long_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 3: merge add of negate + // 2 + (-x) = 2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[long_2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpSNegate %long %2\n" + + "%4 = OpIAdd %long %long_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 4: merge add of subtract + // (x - 1) + 2 = x + 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %2 %float_1\n" + + "%4 = OpFAdd %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 5: merge add of subtract + // (1 - x) + 2 = 3 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_3]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %float_1 %2\n" + + "%4 = OpFAdd %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 6: merge add of subtract + // 2 + (x - 1) = x + 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %2 %float_1\n" + + "%4 = OpFAdd %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 7: merge add of subtract + // 2 + (1 - x) = 3 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_3]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %float_1 %2\n" + + "%4 = OpFAdd %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 8: merge add of add + // (x + 1) + 2 = x + 3 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_3]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %2 %float_1\n" + + "%4 = OpFAdd %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 9: merge add of add + // (1 + x) + 2 = 3 + x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_3]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %float_1 %2\n" + + "%4 = OpFAdd %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 10: merge add of add + // 2 + (x + 1) = x + 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_3]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %2 %float_1\n" + + "%4 = OpFAdd %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 11: merge add of add + // 2 + (1 + x) = 3 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_3]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %float_1 %2\n" + + "%4 = OpFAdd %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true) +)); + +INSTANTIATE_TEST_CASE_P(MergeSubTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: merge sub of negate + // (-x) - 2 = -2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n2:%\\w+]] = OpConstant [[float]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFNegate %float %2\n" + + "%4 = OpFSub %float %3 %float_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 1: merge sub of negate + // 2 - (-x) = x + 2 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_2:%\\w+]] = OpConstant [[float]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFNegate %float %2\n" + + "%4 = OpFSub %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 2: merge sub of negate + // (-x) - 2 = -2 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_n2:%\\w+]] = OpConstant [[long]] -2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpISub [[long]] [[long_n2]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpSNegate %long %2\n" + + "%4 = OpISub %long %3 %long_2\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 3: merge sub of negate + // 2 - (-x) = x + 2 + InstructionFoldingCase( + Header() + + "; CHECK: [[long:%\\w+]] = OpTypeInt 64 1\n" + + "; CHECK: [[long_2:%\\w+]] = OpConstant [[long]] 2\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[long]]\n" + + "; CHECK: %4 = OpIAdd [[long]] [[ld]] [[long_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_long Function\n" + + "%2 = OpLoad %long %var\n" + + "%3 = OpSNegate %long %2\n" + + "%4 = OpISub %long %long_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 4: merge add of subtract + // (x + 2) - 1 = x + 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %2 %float_2\n" + + "%4 = OpFSub %float %3 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 5: merge add of subtract + // (2 + x) - 1 = x + 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %float_2 %2\n" + + "%4 = OpFSub %float %3 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 6: merge add of subtract + // 2 - (x + 1) = 1 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_1]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %2 %float_1\n" + + "%4 = OpFSub %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 7: merge add of subtract + // 2 - (1 + x) = 1 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_1]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFAdd %float %float_1 %2\n" + + "%4 = OpFSub %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 8: merge subtract of subtract + // (x - 2) - 1 = x - 3 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[ld]] [[float_3]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %2 %float_2\n" + + "%4 = OpFSub %float %3 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 9: merge subtract of subtract + // (2 - x) - 1 = 1 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_1]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %float_2 %2\n" + + "%4 = OpFSub %float %3 %float_1\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 10: merge subtract of subtract + // 2 - (x - 1) = 3 - x + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_3:%\\w+]] = OpConstant [[float]] 3\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFSub [[float]] [[float_3]] [[ld]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %2 %float_1\n" + + "%4 = OpFSub %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 11: merge subtract of subtract + // 1 - (2 - x) = x + (-1) + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_n1:%\\w+]] = OpConstant [[float]] -1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_n1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %float_2 %2\n" + + "%4 = OpFSub %float %float_1 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true), + // Test case 12: merge subtract of subtract + // 2 - (1 - x) = x + 1 + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: [[float_1:%\\w+]] = OpConstant [[float]] 1\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[float]]\n" + + "; CHECK: %4 = OpFAdd [[float]] [[ld]] [[float_1]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%var = OpVariable %_ptr_float Function\n" + + "%2 = OpLoad %float %var\n" + + "%3 = OpFSub %float %float_1 %2\n" + + "%4 = OpFSub %float %float_2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd\n", + 4, true) +)); + +INSTANTIATE_TEST_CASE_P(SelectFoldingTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: Fold select with the same values for both sides + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int0:%\\w+]] = OpConstant [[int]] 0\n" + + "; CHECK: %2 = OpCopyObject [[int]] [[int0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_bool Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpSelect %int %load %100 %100\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 1: Fold select true to left side + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int0:%\\w+]] = OpConstant [[int]] 0\n" + + "; CHECK: %2 = OpCopyObject [[int]] [[int0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpSelect %int %true %100 %n\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 2: Fold select false to right side + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int0:%\\w+]] = OpConstant [[int]] 0\n" + + "; CHECK: %2 = OpCopyObject [[int]] [[int0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %bool %n\n" + + "%2 = OpSelect %int %false %n %100\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 3: Fold select null to right side + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[int0:%\\w+]] = OpConstant [[int]] 0\n" + + "; CHECK: %2 = OpCopyObject [[int]] [[int0]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_int Function\n" + + "%load = OpLoad %int %n\n" + + "%2 = OpSelect %int %bool_null %load %100\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 4: vector null + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[v2int:%\\w+]] = OpTypeVector [[int]] 2\n" + + "; CHECK: [[int2:%\\w+]] = OpConstant [[int]] 2\n" + + "; CHECK: [[v2int2_2:%\\w+]] = OpConstantComposite [[v2int]] [[int2]] [[int2]]\n" + + "; CHECK: %2 = OpCopyObject [[v2int]] [[v2int2_2]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%load = OpLoad %v2int %n\n" + + "%2 = OpSelect %v2int %v2bool_null %load %v2int_2_2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 2, true), + // Test case 5: vector select + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[v2int:%\\w+]] = OpTypeVector [[int]] 2\n" + + "; CHECK: %4 = OpVectorShuffle [[v2int]] %2 %3 0 3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v2int Function\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %n\n" + + "%3 = OpLoad %v2int %n\n" + + "%4 = OpSelect %v2int %v2bool_true_false %2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 6: vector select + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: [[v2int:%\\w+]] = OpTypeVector [[int]] 2\n" + + "; CHECK: %4 = OpVectorShuffle [[v2int]] %2 %3 2 1\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v2int Function\n" + + "%n = OpVariable %_ptr_v2int Function\n" + + "%2 = OpLoad %v2int %n\n" + + "%3 = OpLoad %v2int %n\n" + + "%4 = OpSelect %v2int %v2bool_false_true %2 %3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true) +)); + +INSTANTIATE_TEST_CASE_P(CompositeExtractMatchingTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: Extracting from result of consecutive shuffles of differing + // size. + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: %5 = OpCompositeExtract [[int]] %2 2\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4int Function\n" + + "%2 = OpLoad %v4int %n\n" + + "%3 = OpVectorShuffle %v2int %2 %2 2 3\n" + + "%4 = OpVectorShuffle %v4int %2 %3 0 4 2 5\n" + + "%5 = OpCompositeExtract %int %4 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, true), + // Test case 1: Extracting from result of vector shuffle of differing + // input and result sizes. + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: %4 = OpCompositeExtract [[int]] %2 2\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4int Function\n" + + "%2 = OpLoad %v4int %n\n" + + "%3 = OpVectorShuffle %v2int %2 %2 2 3\n" + + "%4 = OpCompositeExtract %int %3 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 2: Extracting from result of vector shuffle of differing + // input and result sizes. + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: %4 = OpCompositeExtract [[int]] %2 3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4int Function\n" + + "%2 = OpLoad %v4int %n\n" + + "%3 = OpVectorShuffle %v2int %2 %2 2 3\n" + + "%4 = OpCompositeExtract %int %3 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true), + // Test case 3: Using fmix feeding extract with a 1 in the a position. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 4\n" + + "; CHECK: [[ptr_v4double:%\\w+]] = OpTypePointer Function [[v4double]]\n" + + "; CHECK: [[m:%\\w+]] = OpVariable [[ptr_v4double]] Function\n" + + "; CHECK: [[n:%\\w+]] = OpVariable [[ptr_v4double]] Function\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v4double]] [[n]]\n" + + "; CHECK: %5 = OpCompositeExtract [[double]] [[ld]] 1\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v4double Function\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %m\n" + + "%3 = OpLoad %v4double %n\n" + + "%4 = OpExtInst %v4double %1 FMix %2 %3 %v4double_0_1_0_0\n" + + "%5 = OpCompositeExtract %double %4 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, true), + // Test case 4: Using fmix feeding extract with a 0 in the a position. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 4\n" + + "; CHECK: [[ptr_v4double:%\\w+]] = OpTypePointer Function [[v4double]]\n" + + "; CHECK: [[m:%\\w+]] = OpVariable [[ptr_v4double]] Function\n" + + "; CHECK: [[n:%\\w+]] = OpVariable [[ptr_v4double]] Function\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v4double]] [[m]]\n" + + "; CHECK: %5 = OpCompositeExtract [[double]] [[ld]] 2\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v4double Function\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %m\n" + + "%3 = OpLoad %v4double %n\n" + + "%4 = OpExtInst %v4double %1 FMix %2 %3 %v4double_0_1_0_0\n" + + "%5 = OpCompositeExtract %double %4 2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, true), + // Test case 5: Using fmix feeding extract with a null for the alpha + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 4\n" + + "; CHECK: [[ptr_v4double:%\\w+]] = OpTypePointer Function [[v4double]]\n" + + "; CHECK: [[m:%\\w+]] = OpVariable [[ptr_v4double]] Function\n" + + "; CHECK: [[n:%\\w+]] = OpVariable [[ptr_v4double]] Function\n" + + "; CHECK: [[ld:%\\w+]] = OpLoad [[v4double]] [[m]]\n" + + "; CHECK: %5 = OpCompositeExtract [[double]] [[ld]] 0\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v4double Function\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %m\n" + + "%3 = OpLoad %v4double %n\n" + + "%4 = OpExtInst %v4double %1 FMix %2 %3 %v4double_null\n" + + "%5 = OpCompositeExtract %double %4 0\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, true), + // Test case 6: Don't fold: Using fmix feeding extract with 0.5 in the a + // position. + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%m = OpVariable %_ptr_v4double Function\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %m\n" + + "%3 = OpLoad %v4double %n\n" + + "%4 = OpExtInst %v4double %1 FMix %2 %3 %v4double_1_1_1_0p5\n" + + "%5 = OpCompositeExtract %double %4 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 5, false), + // Test case 7: Extracting the undefined literal value from a vector + // shuffle. + InstructionFoldingCase( + Header() + + "; CHECK: [[int:%\\w+]] = OpTypeInt 32 1\n" + + "; CHECK: %4 = OpUndef [[int]]\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4int Function\n" + + "%2 = OpLoad %v4int %n\n" + + "%3 = OpVectorShuffle %v2int %2 %2 2 4294967295\n" + + "%4 = OpCompositeExtract %int %3 1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 4, true) +)); + +INSTANTIATE_TEST_CASE_P(DotProductMatchingTest, MatchingInstructionFoldingTest, +::testing::Values( + // Test case 0: Using OpDot to extract last element. + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: %3 = OpCompositeExtract [[float]] %2 3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%2 = OpLoad %v4float %n\n" + + "%3 = OpDot %float %2 %v4float_0_0_0_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 1: Using OpDot to extract last element. + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: %3 = OpCompositeExtract [[float]] %2 3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%2 = OpLoad %v4float %n\n" + + "%3 = OpDot %float %v4float_0_0_0_1 %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 2: Using OpDot to extract second element. + InstructionFoldingCase( + Header() + + "; CHECK: [[float:%\\w+]] = OpTypeFloat 32\n" + + "; CHECK: %3 = OpCompositeExtract [[float]] %2 1\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4float Function\n" + + "%2 = OpLoad %v4float %n\n" + + "%3 = OpDot %float %v4float_0_1_0_0 %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 3: Using OpDot to extract last element. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: %3 = OpCompositeExtract [[double]] %2 3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %n\n" + + "%3 = OpDot %double %2 %v4double_0_0_0_1\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 4: Using OpDot to extract last element. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: %3 = OpCompositeExtract [[double]] %2 3\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %n\n" + + "%3 = OpDot %double %v4double_0_0_0_1 %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true), + // Test case 5: Using OpDot to extract second element. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: %3 = OpCompositeExtract [[double]] %2 1\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%2 = OpLoad %v4double %n\n" + + "%3 = OpDot %double %v4double_0_1_0_0 %2\n" + + "OpReturn\n" + + "OpFunctionEnd", + 3, true) +)); + +using MatchingInstructionWithNoResultFoldingTest = +::testing::TestWithParam>; + +// Test folding instructions that do not have a result. The instruction +// that will be folded is the last instruction before the return. If there +// are multiple returns, there is not guarentee which one is used. +TEST_P(MatchingInstructionWithNoResultFoldingTest, Case) { + const auto& tc = GetParam(); + + // Build module. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, tc.test_body, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + + // Fold the instruction to test. + Instruction* inst = nullptr; + Function* func = &*context->module()->begin(); + for (auto& bb : *func) { + Instruction* terminator = bb.terminator(); + if (terminator->IsReturnOrAbort()) { + inst = terminator->PreviousNode(); + break; + } + } + assert(inst && "Invalid test. Could not find instruction to fold."); + std::unique_ptr original_inst(inst->Clone(context.get())); + bool succeeded = context->get_instruction_folder().FoldInstruction(inst); + EXPECT_EQ(succeeded, tc.expected_result); + if (succeeded) { + Match(tc.test_body, context.get()); + } +} + +INSTANTIATE_TEST_CASE_P(StoreMatchingTest, MatchingInstructionWithNoResultFoldingTest, +::testing::Values( + // Test case 0: Using OpDot to extract last element. + InstructionFoldingCase( + Header() + + "; CHECK: OpLabel\n" + + "; CHECK-NOT: OpStore\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%n = OpVariable %_ptr_v4double Function\n" + + "%undef = OpUndef %v4double\n" + + "OpStore %n %undef\n" + + "OpReturn\n" + + "OpFunctionEnd", + 0 /* OpStore */, true) +)); + +INSTANTIATE_TEST_CASE_P(VectorShuffleMatchingTest, MatchingInstructionWithNoResultFoldingTest, +::testing::Values( + // Test case 0: Basic test 1 + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %7 %5 2 3 6 7\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %6 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %7 %8 2 3 4 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 1: Basic test 2 + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %6 %7 0 1 4 5\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %6 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %8 %7 2 3 4 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 2: Basic test 3 + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %5 %7 3 2 4 5\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %6 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %8 %7 1 0 4 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 3: Basic test 4 + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %7 %6 2 3 5 4\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %6 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %7 %8 2 3 7 6\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 4: Don't fold, need both operands of the feeder. + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %6 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %7 %8 2 3 7 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, false), + // Test case 5: Don't fold, need both operands of the feeder. + InstructionFoldingCase( + Header() + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %6 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %8 %7 2 0 7 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, false), + // Test case 6: Fold, need both operands of the feeder, but they are the same. + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %5 %7 0 2 7 5\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %5 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %8 %7 2 0 7 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 7: Fold, need both operands of the feeder, but they are the same. + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %7 %5 2 0 5 7\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %5 2 3 4 5\n" + + "%9 = OpVectorShuffle %v4double %7 %8 2 0 7 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 8: Replace first operand with a smaller vector. + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %5 %7 0 0 5 3\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v2double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v2double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v4double %5 %5 0 1 2 3\n" + + "%9 = OpVectorShuffle %v4double %8 %7 2 0 7 5\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 9: Replace first operand with a larger vector. + InstructionFoldingCase( + Header() + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %5 %7 3 0 7 5\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v2double %5 %5 0 3\n" + + "%9 = OpVectorShuffle %v4double %8 %7 1 0 5 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 10: Replace unused operand with null. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: [[null:%\\w+]] = OpConstantNull [[v4double]]\n" + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} [[null]] %7 4 2 5 3\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v2double %5 %5 0 3\n" + + "%9 = OpVectorShuffle %v4double %8 %7 4 2 5 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 11: Replace unused operand with null. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: [[null:%\\w+]] = OpConstantNull [[v4double]]\n" + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} [[null]] %5 2 2 5 5\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%8 = OpVectorShuffle %v2double %5 %5 0 3\n" + + "%9 = OpVectorShuffle %v4double %8 %8 2 2 3 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 12: Replace unused operand with null. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: [[null:%\\w+]] = OpConstantNull [[v4double]]\n" + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %7 [[null]] 2 0 1 3\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v2double %5 %5 0 3\n" + + "%9 = OpVectorShuffle %v4double %7 %8 2 0 1 3\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true), + // Test case 13: Shuffle with undef literal. + InstructionFoldingCase( + Header() + + "; CHECK: [[double:%\\w+]] = OpTypeFloat 64\n" + + "; CHECK: [[v4double:%\\w+]] = OpTypeVector [[double]] 2\n" + + "; CHECK: OpVectorShuffle\n" + + "; CHECK: OpVectorShuffle {{%\\w+}} %7 {{%\\w+}} 2 0 1 4294967295\n" + + "; CHECK: OpReturn\n" + + "%main = OpFunction %void None %void_func\n" + + "%main_lab = OpLabel\n" + + "%2 = OpVariable %_ptr_v4double Function\n" + + "%3 = OpVariable %_ptr_v4double Function\n" + + "%4 = OpVariable %_ptr_v4double Function\n" + + "%5 = OpLoad %v4double %2\n" + + "%6 = OpLoad %v4double %3\n" + + "%7 = OpLoad %v4double %4\n" + + "%8 = OpVectorShuffle %v2double %5 %5 0 1\n" + + "%9 = OpVectorShuffle %v4double %7 %8 2 0 1 4294967295\n" + + "OpReturn\n" + + "OpFunctionEnd", + 9, true) +)); +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp new file mode 100644 index 00000000000..5cc7843b118 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp @@ -0,0 +1,133 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +struct FreezeSpecConstantValueTypeTestCase { + const char* type_decl; + const char* spec_const; + const char* expected_frozen_const; +}; + +using FreezeSpecConstantValueTypeTest = + PassTest<::testing::TestWithParam>; + +TEST_P(FreezeSpecConstantValueTypeTest, PrimaryType) { + auto& test_case = GetParam(); + std::vector text = {"OpCapability Shader", + "OpMemoryModel Logical GLSL450", + test_case.type_decl, test_case.spec_const}; + std::vector expected = { + "OpCapability Shader", "OpMemoryModel Logical GLSL450", + test_case.type_decl, test_case.expected_frozen_const}; + SinglePassRunAndCheck( + JoinAllInsts(text), JoinAllInsts(expected), /* skip_nop = */ false); +} + +// Test each primary type. +INSTANTIATE_TEST_CASE_P( + PrimaryTypeSpecConst, FreezeSpecConstantValueTypeTest, + ::testing::ValuesIn(std::vector({ + // Type declaration, original spec constant definition, expected frozen + // spec constants. + {"%int = OpTypeInt 32 1", "%2 = OpSpecConstant %int 1", + "%int_1 = OpConstant %int 1"}, + {"%uint = OpTypeInt 32 0", "%2 = OpSpecConstant %uint 1", + "%uint_1 = OpConstant %uint 1"}, + {"%float = OpTypeFloat 32", "%2 = OpSpecConstant %float 3.1415", + "%float_3_1415 = OpConstant %float 3.1415"}, + {"%double = OpTypeFloat 64", "%2 = OpSpecConstant %double 3.141592653", + "%double_3_141592653 = OpConstant %double 3.141592653"}, + {"%bool = OpTypeBool", "%2 = OpSpecConstantTrue %bool", + "%true = OpConstantTrue %bool"}, + {"%bool = OpTypeBool", "%2 = OpSpecConstantFalse %bool", + "%false = OpConstantFalse %bool"}, + }))); + +using FreezeSpecConstantValueRemoveDecorationTest = PassTest<::testing::Test>; + +TEST_F(FreezeSpecConstantValueRemoveDecorationTest, + RemoveDecorationInstWithSpecId) { + std::vector text = { + // clang-format off + "OpCapability Shader", + "OpCapability Float64", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpSource GLSL 450", + "OpSourceExtension \"GL_GOOGLE_cpp_style_line_directive\"", + "OpSourceExtension \"GL_GOOGLE_include_directive\"", + "OpName %main \"main\"", + "OpDecorate %3 SpecId 200", + "OpDecorate %4 SpecId 201", + "OpDecorate %5 SpecId 202", + "OpDecorate %6 SpecId 203", + "%void = OpTypeVoid", + "%8 = OpTypeFunction %void", + "%int = OpTypeInt 32 1", + "%3 = OpSpecConstant %int 3", + "%float = OpTypeFloat 32", + "%4 = OpSpecConstant %float 3.1415", + "%double = OpTypeFloat 64", + "%5 = OpSpecConstant %double 3.14159265358979", + "%bool = OpTypeBool", + "%6 = OpSpecConstantTrue %bool", + "%13 = OpSpecConstantFalse %bool", + "%main = OpFunction %void None %8", + "%14 = OpLabel", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + std::string expected_disassembly = SelectiveJoin(text, [](const char* line) { + return std::string(line).find("SpecId") != std::string::npos; + }); + std::vector> replacement_pairs = { + {"%3 = OpSpecConstant %int 3", "%int_3 = OpConstant %int 3"}, + {"%4 = OpSpecConstant %float 3.1415", + "%float_3_1415 = OpConstant %float 3.1415"}, + {"%5 = OpSpecConstant %double 3.14159265358979", + "%double_3_14159265358979 = OpConstant %double 3.14159265358979"}, + {"%6 = OpSpecConstantTrue ", "%true = OpConstantTrue "}, + {"%13 = OpSpecConstantFalse ", "%false = OpConstantFalse "}, + }; + for (auto& p : replacement_pairs) { + EXPECT_TRUE(FindAndReplace(&expected_disassembly, p.first, p.second)) + << "text:\n" + << expected_disassembly << "\n" + << "find_str:\n" + << p.first << "\n" + << "replace_str:\n" + << p.second << "\n"; + } + SinglePassRunAndCheck(JoinAllInsts(text), + expected_disassembly, + /* skip_nop = */ true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/function_utils.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/function_utils.h new file mode 100644 index 00000000000..803cacdd539 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/function_utils.h @@ -0,0 +1,55 @@ +// Copyright (c) 2017 Google 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. + +#ifndef TEST_OPT_FUNCTION_UTILS_H_ +#define TEST_OPT_FUNCTION_UTILS_H_ + +#include "source/opt/function.h" +#include "source/opt/module.h" + +namespace spvtest { + +inline spvtools::opt::Function* GetFunction(spvtools::opt::Module* module, + uint32_t id) { + for (spvtools::opt::Function& f : *module) { + if (f.result_id() == id) { + return &f; + } + } + return nullptr; +} + +inline const spvtools::opt::Function* GetFunction( + const spvtools::opt::Module* module, uint32_t id) { + for (const spvtools::opt::Function& f : *module) { + if (f.result_id() == id) { + return &f; + } + } + return nullptr; +} + +inline const spvtools::opt::BasicBlock* GetBasicBlock( + const spvtools::opt::Function* fn, uint32_t id) { + for (const spvtools::opt::BasicBlock& bb : *fn) { + if (bb.id() == id) { + return &bb; + } + } + return nullptr; +} + +} // namespace spvtest + +#endif // TEST_OPT_FUNCTION_UTILS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/if_conversion_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/if_conversion_test.cpp new file mode 100644 index 00000000000..a62a15e88f6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/if_conversion_test.cpp @@ -0,0 +1,474 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using IfConversionTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(IfConversionTest, TestSimpleIfThenElse) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[merge:%\w+]] +; CHECK: [[merge]] = OpLabel +; CHECK-NOT: OpPhi +; CHECK: [[sel:%\w+]] = OpSelect %uint %true %uint_0 %uint_1 +; CHECK OpStore {{%\w+}} [[sel]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%11 = OpTypeFunction %void +%1 = OpFunction %void None %11 +%12 = OpLabel +OpSelectionMerge %14 None +OpBranchConditional %true %15 %16 +%15 = OpLabel +OpBranch %14 +%16 = OpLabel +OpBranch %14 +%14 = OpLabel +%18 = OpPhi %uint %uint_0 %15 %uint_1 %16 +OpStore %2 %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(IfConversionTest, TestSimpleHalfIfTrue) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[merge:%\w+]] +; CHECK: [[merge]] = OpLabel +; CHECK-NOT: OpPhi +; CHECK: [[sel:%\w+]] = OpSelect %uint %true %uint_0 %uint_1 +; CHECK OpStore {{%\w+}} [[sel]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%11 = OpTypeFunction %void +%1 = OpFunction %void None %11 +%12 = OpLabel +OpSelectionMerge %14 None +OpBranchConditional %true %15 %14 +%15 = OpLabel +OpBranch %14 +%14 = OpLabel +%18 = OpPhi %uint %uint_0 %15 %uint_1 %12 +OpStore %2 %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(IfConversionTest, TestSimpleHalfIfExtraBlock) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[merge:%\w+]] +; CHECK: [[merge]] = OpLabel +; CHECK-NOT: OpPhi +; CHECK: [[sel:%\w+]] = OpSelect %uint %true %uint_0 %uint_1 +; CHECK OpStore {{%\w+}} [[sel]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%11 = OpTypeFunction %void +%1 = OpFunction %void None %11 +%12 = OpLabel +OpSelectionMerge %14 None +OpBranchConditional %true %15 %14 +%15 = OpLabel +OpBranch %16 +%16 = OpLabel +OpBranch %14 +%14 = OpLabel +%18 = OpPhi %uint %uint_0 %15 %uint_1 %12 +OpStore %2 %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(IfConversionTest, TestSimpleHalfIfFalse) { + const std::string text = R"( +; CHECK: OpSelectionMerge [[merge:%\w+]] +; CHECK: [[merge]] = OpLabel +; CHECK-NOT: OpPhi +; CHECK: [[sel:%\w+]] = OpSelect %uint %true %uint_0 %uint_1 +; CHECK OpStore {{%\w+}} [[sel]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%11 = OpTypeFunction %void +%1 = OpFunction %void None %11 +%12 = OpLabel +OpSelectionMerge %14 None +OpBranchConditional %true %14 %15 +%15 = OpLabel +OpBranch %14 +%14 = OpLabel +%18 = OpPhi %uint %uint_0 %12 %uint_1 %15 +OpStore %2 %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(IfConversionTest, TestVectorSplat) { + const std::string text = R"( +; CHECK: [[bool_vec:%\w+]] = OpTypeVector %bool 2 +; CHECK: OpSelectionMerge [[merge:%\w+]] +; CHECK: [[merge]] = OpLabel +; CHECK-NOT: OpPhi +; CHECK: [[comp:%\w+]] = OpCompositeConstruct [[bool_vec]] %true %true +; CHECK: [[sel:%\w+]] = OpSelect {{%\w+}} [[comp]] +; CHECK OpStore {{%\w+}} [[sel]] +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_vec2 = OpTypeVector %uint 2 +%vec2_01 = OpConstantComposite %uint_vec2 %uint_0 %uint_1 +%vec2_10 = OpConstantComposite %uint_vec2 %uint_1 %uint_0 +%_ptr_Output_uint = OpTypePointer Output %uint_vec2 +%2 = OpVariable %_ptr_Output_uint Output +%11 = OpTypeFunction %void +%1 = OpFunction %void None %11 +%12 = OpLabel +OpSelectionMerge %14 None +OpBranchConditional %true %15 %16 +%15 = OpLabel +OpBranch %14 +%16 = OpLabel +OpBranch %14 +%14 = OpLabel +%18 = OpPhi %uint_vec2 %vec2_01 %15 %vec2_10 %16 +OpStore %2 %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(IfConversionTest, CodeMotionSameValue) { + const std::string text = R"( +; CHECK: [[var:%\w+]] = OpVariable +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK-NOT: OpLabel +; CHECK: [[add:%\w+]] = OpIAdd %uint %uint_0 %uint_1 +; CHECK: OpSelectionMerge [[merge_lab:%\w+]] None +; CHECK-NEXT: OpBranchConditional +; CHECK: [[merge_lab]] = OpLabel +; CHECK-NOT: OpLabel +; CHECK: OpStore [[var]] [[add]] + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "func" %2 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %2 = OpVariable %_ptr_Output_uint Output + %8 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %1 = OpFunction %void None %8 + %11 = OpLabel + OpSelectionMerge %12 None + OpBranchConditional %true %13 %15 + %13 = OpLabel + %14 = OpIAdd %uint %uint_0 %uint_1 + OpBranch %12 + %15 = OpLabel + %16 = OpIAdd %uint %uint_0 %uint_1 + OpBranch %12 + %12 = OpLabel + %17 = OpPhi %uint %16 %15 %14 %13 + OpStore %2 %17 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(IfConversionTest, CodeMotionMultipleInstructions) { + const std::string text = R"( +; CHECK: [[var:%\w+]] = OpVariable +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK-NOT: OpLabel +; CHECK: [[a1:%\w+]] = OpIAdd %uint %uint_0 %uint_1 +; CHECK: [[a2:%\w+]] = OpIAdd %uint [[a1]] %uint_1 +; CHECK: OpSelectionMerge [[merge_lab:%\w+]] None +; CHECK-NEXT: OpBranchConditional +; CHECK: [[merge_lab]] = OpLabel +; CHECK-NOT: OpLabel +; CHECK: OpStore [[var]] [[a2]] + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "func" %2 + %void = OpTypeVoid + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint + %2 = OpVariable %_ptr_Output_uint Output + %8 = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %1 = OpFunction %void None %8 + %11 = OpLabel + OpSelectionMerge %12 None + OpBranchConditional %true %13 %15 + %13 = OpLabel + %a1 = OpIAdd %uint %uint_0 %uint_1 + %a2 = OpIAdd %uint %a1 %uint_1 + OpBranch %12 + %15 = OpLabel + %b1 = OpIAdd %uint %uint_0 %uint_1 + %b2 = OpIAdd %uint %b1 %uint_1 + OpBranch %12 + %12 = OpLabel + %17 = OpPhi %uint %b2 %15 %a2 %13 + OpStore %2 %17 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +TEST_F(IfConversionTest, NoCommonDominator) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%8 = OpTypeFunction %void +%1 = OpFunction %void None %8 +%9 = OpLabel +OpBranch %10 +%11 = OpLabel +OpBranch %10 +%10 = OpLabel +%12 = OpPhi %uint %uint_0 %9 %uint_1 %11 +OpStore %2 %12 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(IfConversionTest, LoopUntouched) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%8 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%1 = OpFunction %void None %8 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +%13 = OpPhi %uint %uint_0 %11 %uint_1 %12 +OpLoopMerge %14 %12 None +OpBranchConditional %true %14 %12 +%14 = OpLabel +OpStore %2 %13 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(IfConversionTest, TooManyPredecessors) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%8 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%1 = OpFunction %void None %8 +%11 = OpLabel +OpSelectionMerge %12 None +OpBranchConditional %true %13 %12 +%13 = OpLabel +OpBranchConditional %true %14 %15 +%14 = OpLabel +OpBranch %12 +%15 = OpLabel +OpBranch %12 +%12 = OpLabel +%16 = OpPhi %uint %uint_0 %11 %uint_0 %14 %uint_1 %15 +OpStore %2 %16 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(IfConversionTest, NoCodeMotion) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%8 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%1 = OpFunction %void None %8 +%11 = OpLabel +OpSelectionMerge %12 None +OpBranchConditional %true %13 %12 +%13 = OpLabel +%14 = OpIAdd %uint %uint_0 %uint_1 +OpBranch %12 +%12 = OpLabel +%15 = OpPhi %uint %uint_0 %11 %14 %13 +OpStore %2 %15 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +TEST_F(IfConversionTest, NoCodeMotionImmovableInst) { + const std::string text = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "func" %2 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Output_uint = OpTypePointer Output %uint +%2 = OpVariable %_ptr_Output_uint Output +%8 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +%1 = OpFunction %void None %8 +%11 = OpLabel +OpSelectionMerge %12 None +OpBranchConditional %true %13 %14 +%13 = OpLabel +OpSelectionMerge %15 None +OpBranchConditional %true %16 %15 +%16 = OpLabel +%17 = OpIAdd %uint %uint_0 %uint_1 +OpBranch %15 +%15 = OpLabel +%18 = OpPhi %uint %uint_0 %13 %17 %16 +%19 = OpIAdd %uint %18 %uint_1 +OpBranch %12 +%14 = OpLabel +OpSelectionMerge %20 None +OpBranchConditional %true %21 %20 +%21 = OpLabel +%22 = OpIAdd %uint %uint_0 %uint_1 +OpBranch %20 +%20 = OpLabel +%23 = OpPhi %uint %uint_0 %14 %22 %21 +%24 = OpIAdd %uint %23 %uint_1 +OpBranch %12 +%12 = OpLabel +%25 = OpPhi %uint %24 %20 %19 %15 +OpStore %2 %25 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/inline_opaque_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/inline_opaque_test.cpp new file mode 100644 index 00000000000..d10913aec0a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/inline_opaque_test.cpp @@ -0,0 +1,412 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using InlineOpaqueTest = PassTest<::testing::Test>; + +TEST_F(InlineOpaqueTest, InlineCallWithStructArgContainingSampledImage) { + // Function with opaque argument is inlined. + // TODO(greg-lunarg): Add HLSL code + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpMemberName %S_t 2 "smp" +OpName %foo_struct_S_t_vf2_vf21_ "foo(struct-S_t-vf2-vf21;" +OpName %s "s" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %s0 "s0" +OpName %texCoords "texCoords" +OpName %param "param" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%17 = OpTypeImage %float 2D 0 0 0 1 Unknown +%18 = OpTypeSampledImage %17 +%S_t = OpTypeStruct %v2float %v2float %18 +%_ptr_Function_S_t = OpTypePointer Function %S_t +%20 = OpTypeFunction %void %_ptr_Function_S_t +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%_ptr_Function_18 = OpTypePointer Function %18 +%sampler15 = OpVariable %_ptr_UniformConstant_18 UniformConstant +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %12 +%28 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%29 = OpLoad %v2float %texCoords +%30 = OpAccessChain %_ptr_Function_v2float %s0 %int_0 +OpStore %30 %29 +%31 = OpLoad %18 %sampler15 +%32 = OpAccessChain %_ptr_Function_18 %s0 %int_2 +OpStore %32 %31 +%33 = OpLoad %S_t %s0 +OpStore %param %33 +%34 = OpFunctionCall %void %foo_struct_S_t_vf2_vf21_ %param +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %12 +%28 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%29 = OpLoad %v2float %texCoords +%30 = OpAccessChain %_ptr_Function_v2float %s0 %int_0 +OpStore %30 %29 +%31 = OpLoad %18 %sampler15 +%32 = OpAccessChain %_ptr_Function_18 %s0 %int_2 +OpStore %32 %31 +%33 = OpLoad %S_t %s0 +OpStore %param %33 +%41 = OpAccessChain %_ptr_Function_18 %param %int_2 +%42 = OpLoad %18 %41 +%43 = OpAccessChain %_ptr_Function_v2float %param %int_0 +%44 = OpLoad %v2float %43 +%45 = OpImageSampleImplicitLod %v4float %42 %44 +OpStore %outColor %45 +OpReturn +OpFunctionEnd +)"; + + const std::string post_defs = + R"(%foo_struct_S_t_vf2_vf21_ = OpFunction %void None %20 +%s = OpFunctionParameter %_ptr_Function_S_t +%35 = OpLabel +%36 = OpAccessChain %_ptr_Function_18 %s %int_2 +%37 = OpLoad %18 %36 +%38 = OpAccessChain %_ptr_Function_v2float %s %int_0 +%39 = OpLoad %v2float %38 +%40 = OpImageSampleImplicitLod %v4float %37 %39 +OpStore %outColor %40 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before + post_defs, predefs + after + post_defs, true, true); +} + +TEST_F(InlineOpaqueTest, InlineOpaqueReturn) { + // Function with opaque return value is inlined. + // TODO(greg-lunarg): Add HLSL code + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %texCoords %outColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_ "foo(" +OpName %texCoords "texCoords" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %sampler16 "sampler16" +OpDecorate %sampler15 DescriptorSet 0 +OpDecorate %sampler16 DescriptorSet 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%bool = OpTypeBool +%false = OpConstantFalse %bool +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +%float_0 = OpConstant %float 0 +%16 = OpConstantComposite %v2float %float_0 %float_0 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%19 = OpTypeImage %float 2D 0 0 0 1 Unknown +%20 = OpTypeSampledImage %19 +%21 = OpTypeFunction %20 +%_ptr_UniformConstant_20 = OpTypePointer UniformConstant %20 +%_ptr_Function_20 = OpTypePointer Function %20 +%sampler15 = OpVariable %_ptr_UniformConstant_20 UniformConstant +%sampler16 = OpVariable %_ptr_UniformConstant_20 UniformConstant +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%25 = OpVariable %_ptr_Function_20 Function +%26 = OpFunctionCall %20 %foo_ +OpStore %25 %26 +%27 = OpLoad %20 %25 +%28 = OpLoad %v2float %texCoords +%29 = OpImageSampleImplicitLod %v4float %27 %28 +OpStore %outColor %29 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%34 = OpVariable %_ptr_Function_20 Function +%35 = OpVariable %_ptr_Function_20 Function +%25 = OpVariable %_ptr_Function_20 Function +%36 = OpLoad %20 %sampler16 +OpStore %34 %36 +%37 = OpLoad %20 %34 +OpStore %35 %37 +%26 = OpLoad %20 %35 +OpStore %25 %26 +%27 = OpLoad %20 %25 +%28 = OpLoad %v2float %texCoords +%29 = OpImageSampleImplicitLod %v4float %27 %28 +OpStore %outColor %29 +OpReturn +OpFunctionEnd +)"; + + const std::string post_defs = + R"(%foo_ = OpFunction %20 None %21 +%30 = OpLabel +%31 = OpVariable %_ptr_Function_20 Function +%32 = OpLoad %20 %sampler16 +OpStore %31 %32 +%33 = OpLoad %20 %31 +OpReturnValue %33 +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before + post_defs, predefs + after + post_defs, true, true); +} + +TEST_F(InlineOpaqueTest, InlineInNonEntryPointFunction) { + // This demonstrates opaque inlining in a function that is not + // an entry point function (main2) but is in the call tree of an + // entry point function (main). + // TODO(greg-lunarg): Add HLSL code + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %main2 "main2" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpMemberName %S_t 2 "smp" +OpName %foo_struct_S_t_vf2_vf21_ "foo(struct-S_t-vf2-vf21;" +OpName %s "s" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %s0 "s0" +OpName %texCoords "texCoords" +OpName %param "param" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%13 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%18 = OpTypeImage %float 2D 0 0 0 1 Unknown +%19 = OpTypeSampledImage %18 +%S_t = OpTypeStruct %v2float %v2float %19 +%_ptr_Function_S_t = OpTypePointer Function %S_t +%21 = OpTypeFunction %void %_ptr_Function_S_t +%_ptr_UniformConstant_19 = OpTypePointer UniformConstant %19 +%_ptr_Function_19 = OpTypePointer Function %19 +%sampler15 = OpVariable %_ptr_UniformConstant_19 UniformConstant +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string before = + R"(%main2 = OpFunction %void None %13 +%29 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%30 = OpLoad %v2float %texCoords +%31 = OpAccessChain %_ptr_Function_v2float %s0 %int_0 +OpStore %31 %30 +%32 = OpLoad %19 %sampler15 +%33 = OpAccessChain %_ptr_Function_19 %s0 %int_2 +OpStore %33 %32 +%34 = OpLoad %S_t %s0 +OpStore %param %34 +%35 = OpFunctionCall %void %foo_struct_S_t_vf2_vf21_ %param +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main2 = OpFunction %void None %13 +%29 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%30 = OpLoad %v2float %texCoords +%31 = OpAccessChain %_ptr_Function_v2float %s0 %int_0 +OpStore %31 %30 +%32 = OpLoad %19 %sampler15 +%33 = OpAccessChain %_ptr_Function_19 %s0 %int_2 +OpStore %33 %32 +%34 = OpLoad %S_t %s0 +OpStore %param %34 +%44 = OpAccessChain %_ptr_Function_19 %param %int_2 +%45 = OpLoad %19 %44 +%46 = OpAccessChain %_ptr_Function_v2float %param %int_0 +%47 = OpLoad %v2float %46 +%48 = OpImageSampleImplicitLod %v4float %45 %47 +OpStore %outColor %48 +OpReturn +OpFunctionEnd +)"; + + const std::string post_defs = + R"(%main = OpFunction %void None %13 +%36 = OpLabel +%37 = OpFunctionCall %void %main2 +OpReturn +OpFunctionEnd +%foo_struct_S_t_vf2_vf21_ = OpFunction %void None %21 +%s = OpFunctionParameter %_ptr_Function_S_t +%38 = OpLabel +%39 = OpAccessChain %_ptr_Function_19 %s %int_2 +%40 = OpLoad %19 %39 +%41 = OpAccessChain %_ptr_Function_v2float %s %int_0 +%42 = OpLoad %v2float %41 +%43 = OpImageSampleImplicitLod %v4float %40 %42 +OpStore %outColor %43 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before + post_defs, predefs + after + post_defs, true, true); +} + +TEST_F(InlineOpaqueTest, NoInlineNoOpaque) { + // Function without opaque interface is not inlined. + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // return bar.x + bar.y; + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_ "foo(vf4;" +OpName %bar "bar" +OpName %color "color" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%14 = OpTypeFunction %float %_ptr_Function_v4float +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %10 +%21 = OpLabel +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor +OpStore %param %22 +%23 = OpFunctionCall %float %foo_vf4_ %param +%24 = OpCompositeConstruct %v4float %23 %23 %23 %23 +OpStore %color %24 +%25 = OpLoad %v4float %color +OpStore %gl_FragColor %25 +OpReturn +OpFunctionEnd +%foo_vf4_ = OpFunction %float None %14 +%bar = OpFunctionParameter %_ptr_Function_v4float +%26 = OpLabel +%27 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%28 = OpLoad %float %27 +%29 = OpAccessChain %_ptr_Function_float %bar %uint_1 +%30 = OpLoad %float %29 +%31 = OpFAdd %float %28 %30 +OpReturnValue %31 +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/inline_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/inline_test.cpp new file mode 100644 index 00000000000..4eab77da4fe --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/inline_test.cpp @@ -0,0 +1,2869 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include +#include +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using InlineTest = PassTest<::testing::Test>; + +TEST_F(InlineTest, Simple) { + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // return bar.x + bar.y; + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 140", + "OpName %main \"main\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %color \"color\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param \"param\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "%void = OpTypeVoid", + "%10 = OpTypeFunction %void", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%14 = OpTypeFunction %float %_ptr_Function_v4float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", +"%_ptr_Function_float = OpTypePointer Function %float", + "%uint_1 = OpConstant %uint 1", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_vf4_ = OpFunction %float None %14", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%26 = OpLabel", + "%27 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%28 = OpLoad %float %27", + "%29 = OpAccessChain %_ptr_Function_float %bar %uint_1", + "%30 = OpLoad %float %29", + "%31 = OpFAdd %float %28 %30", + "OpReturnValue %31", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %10", + "%21 = OpLabel", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%22 = OpLoad %v4float %BaseColor", + "OpStore %param %22", + "%23 = OpFunctionCall %float %foo_vf4_ %param", + "%24 = OpCompositeConstruct %v4float %23 %23 %23 %23", + "OpStore %color %24", + "%25 = OpLoad %v4float %color", + "OpStore %gl_FragColor %25", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %10", + "%21 = OpLabel", + "%32 = OpVariable %_ptr_Function_float Function", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%22 = OpLoad %v4float %BaseColor", + "OpStore %param %22", + "%33 = OpAccessChain %_ptr_Function_float %param %uint_0", + "%34 = OpLoad %float %33", + "%35 = OpAccessChain %_ptr_Function_float %param %uint_1", + "%36 = OpLoad %float %35", + "%37 = OpFAdd %float %34 %36", + "OpStore %32 %37", + "%23 = OpLoad %float %32", + "%24 = OpCompositeConstruct %v4float %23 %23 %23 %23", + "OpStore %color %24", + "%25 = OpLoad %v4float %color", + "OpStore %gl_FragColor %25", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, Nested) { + // #version 140 + // + // in vec4 BaseColor; + // + // float foo2(float f, float f2) + // { + // return f * f2; + // } + // + // float foo(vec4 bar) + // { + // return foo2(bar.x + bar.y, bar.z); + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 140", + "OpName %main \"main\"", + "OpName %foo2_f1_f1_ \"foo2(f1;f1;\"", + "OpName %f \"f\"", + "OpName %f2 \"f2\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %param \"param\"", + "OpName %param_0 \"param\"", + "OpName %color \"color\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param_1 \"param\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "%void = OpTypeVoid", + "%15 = OpTypeFunction %void", + "%float = OpTypeFloat 32", +"%_ptr_Function_float = OpTypePointer Function %float", + "%18 = OpTypeFunction %float %_ptr_Function_float %_ptr_Function_float", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%21 = OpTypeFunction %float %_ptr_Function_v4float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", + "%uint_1 = OpConstant %uint 1", + "%uint_2 = OpConstant %uint 2", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off +"%foo2_f1_f1_ = OpFunction %float None %18", + "%f = OpFunctionParameter %_ptr_Function_float", + "%f2 = OpFunctionParameter %_ptr_Function_float", + "%33 = OpLabel", + "%34 = OpLoad %float %f", + "%35 = OpLoad %float %f2", + "%36 = OpFMul %float %34 %35", + "OpReturnValue %36", + "OpFunctionEnd", + "%foo_vf4_ = OpFunction %float None %21", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%37 = OpLabel", + "%param = OpVariable %_ptr_Function_float Function", + "%param_0 = OpVariable %_ptr_Function_float Function", + "%38 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%39 = OpLoad %float %38", + "%40 = OpAccessChain %_ptr_Function_float %bar %uint_1", + "%41 = OpLoad %float %40", + "%42 = OpFAdd %float %39 %41", + "OpStore %param %42", + "%43 = OpAccessChain %_ptr_Function_float %bar %uint_2", + "%44 = OpLoad %float %43", + "OpStore %param_0 %44", + "%45 = OpFunctionCall %float %foo2_f1_f1_ %param %param_0", + "OpReturnValue %45", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %15", + "%28 = OpLabel", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param_1 = OpVariable %_ptr_Function_v4float Function", + "%29 = OpLoad %v4float %BaseColor", + "OpStore %param_1 %29", + "%30 = OpFunctionCall %float %foo_vf4_ %param_1", + "%31 = OpCompositeConstruct %v4float %30 %30 %30 %30", + "OpStore %color %31", + "%32 = OpLoad %v4float %color", + "OpStore %gl_FragColor %32", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %15", + "%28 = OpLabel", + "%57 = OpVariable %_ptr_Function_float Function", + "%46 = OpVariable %_ptr_Function_float Function", + "%47 = OpVariable %_ptr_Function_float Function", + "%48 = OpVariable %_ptr_Function_float Function", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param_1 = OpVariable %_ptr_Function_v4float Function", + "%29 = OpLoad %v4float %BaseColor", + "OpStore %param_1 %29", + "%49 = OpAccessChain %_ptr_Function_float %param_1 %uint_0", + "%50 = OpLoad %float %49", + "%51 = OpAccessChain %_ptr_Function_float %param_1 %uint_1", + "%52 = OpLoad %float %51", + "%53 = OpFAdd %float %50 %52", + "OpStore %46 %53", + "%54 = OpAccessChain %_ptr_Function_float %param_1 %uint_2", + "%55 = OpLoad %float %54", + "OpStore %47 %55", + "%58 = OpLoad %float %46", + "%59 = OpLoad %float %47", + "%60 = OpFMul %float %58 %59", + "OpStore %57 %60", + "%56 = OpLoad %float %57", + "OpStore %48 %56", + "%30 = OpLoad %float %48", + "%31 = OpCompositeConstruct %v4float %30 %30 %30 %30", + "OpStore %color %31", + "%32 = OpLoad %v4float %color", + "OpStore %gl_FragColor %32", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, InOutParameter) { + // #version 400 + // + // in vec4 Basecolor; + // + // void foo(inout vec4 bar) + // { + // bar.z = bar.x + bar.y; + // } + // + // void main() + // { + // vec4 b = Basecolor; + // foo(b); + // vec4 color = vec4(b.z); + // gl_FragColor = color; + // } + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %Basecolor %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 400", + "OpName %main \"main\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %b \"b\"", + "OpName %Basecolor \"Basecolor\"", + "OpName %param \"param\"", + "OpName %color \"color\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "%void = OpTypeVoid", + "%11 = OpTypeFunction %void", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%15 = OpTypeFunction %void %_ptr_Function_v4float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", +"%_ptr_Function_float = OpTypePointer Function %float", + "%uint_1 = OpConstant %uint 1", + "%uint_2 = OpConstant %uint 2", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%Basecolor = OpVariable %_ptr_Input_v4float Input", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_vf4_ = OpFunction %void None %15", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%32 = OpLabel", + "%33 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%34 = OpLoad %float %33", + "%35 = OpAccessChain %_ptr_Function_float %bar %uint_1", + "%36 = OpLoad %float %35", + "%37 = OpFAdd %float %34 %36", + "%38 = OpAccessChain %_ptr_Function_float %bar %uint_2", + "OpStore %38 %37", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %11", + "%23 = OpLabel", + "%b = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color = OpVariable %_ptr_Function_v4float Function", + "%24 = OpLoad %v4float %Basecolor", + "OpStore %b %24", + "%25 = OpLoad %v4float %b", + "OpStore %param %25", + "%26 = OpFunctionCall %void %foo_vf4_ %param", + "%27 = OpLoad %v4float %param", + "OpStore %b %27", + "%28 = OpAccessChain %_ptr_Function_float %b %uint_2", + "%29 = OpLoad %float %28", + "%30 = OpCompositeConstruct %v4float %29 %29 %29 %29", + "OpStore %color %30", + "%31 = OpLoad %v4float %color", + "OpStore %gl_FragColor %31", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %11", + "%23 = OpLabel", + "%b = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color = OpVariable %_ptr_Function_v4float Function", + "%24 = OpLoad %v4float %Basecolor", + "OpStore %b %24", + "%25 = OpLoad %v4float %b", + "OpStore %param %25", + "%39 = OpAccessChain %_ptr_Function_float %param %uint_0", + "%40 = OpLoad %float %39", + "%41 = OpAccessChain %_ptr_Function_float %param %uint_1", + "%42 = OpLoad %float %41", + "%43 = OpFAdd %float %40 %42", + "%44 = OpAccessChain %_ptr_Function_float %param %uint_2", + "OpStore %44 %43", + "%27 = OpLoad %v4float %param", + "OpStore %b %27", + "%28 = OpAccessChain %_ptr_Function_float %b %uint_2", + "%29 = OpLoad %float %28", + "%30 = OpCompositeConstruct %v4float %29 %29 %29 %29", + "OpStore %color %30", + "%31 = OpLoad %v4float %color", + "OpStore %gl_FragColor %31", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, BranchInCallee) { + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // float r = bar.x; + // if (r < 0.0) + // r = -r; + // return r; + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // + // gl_FragColor = color; + // } + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 140", + "OpName %main \"main\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %r \"r\"", + "OpName %color \"color\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param \"param\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "%void = OpTypeVoid", + "%11 = OpTypeFunction %void", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%15 = OpTypeFunction %float %_ptr_Function_v4float", +"%_ptr_Function_float = OpTypePointer Function %float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", + "%float_0 = OpConstant %float 0", + "%bool = OpTypeBool", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_vf4_ = OpFunction %float None %15", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%28 = OpLabel", + "%r = OpVariable %_ptr_Function_float Function", + "%29 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%30 = OpLoad %float %29", + "OpStore %r %30", + "%31 = OpLoad %float %r", + "%32 = OpFOrdLessThan %bool %31 %float_0", + "OpSelectionMerge %33 None", + "OpBranchConditional %32 %34 %33", + "%34 = OpLabel", + "%35 = OpLoad %float %r", + "%36 = OpFNegate %float %35", + "OpStore %r %36", + "OpBranch %33", + "%33 = OpLabel", + "%37 = OpLoad %float %r", + "OpReturnValue %37", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %11", + "%23 = OpLabel", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%24 = OpLoad %v4float %BaseColor", + "OpStore %param %24", + "%25 = OpFunctionCall %float %foo_vf4_ %param", + "%26 = OpCompositeConstruct %v4float %25 %25 %25 %25", + "OpStore %color %26", + "%27 = OpLoad %v4float %color", + "OpStore %gl_FragColor %27", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %11", + "%23 = OpLabel", + "%38 = OpVariable %_ptr_Function_float Function", + "%39 = OpVariable %_ptr_Function_float Function", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%24 = OpLoad %v4float %BaseColor", + "OpStore %param %24", + "%40 = OpAccessChain %_ptr_Function_float %param %uint_0", + "%41 = OpLoad %float %40", + "OpStore %38 %41", + "%42 = OpLoad %float %38", + "%43 = OpFOrdLessThan %bool %42 %float_0", + "OpSelectionMerge %44 None", + "OpBranchConditional %43 %45 %44", + "%45 = OpLabel", + "%46 = OpLoad %float %38", + "%47 = OpFNegate %float %46", + "OpStore %38 %47", + "OpBranch %44", + "%44 = OpLabel", + "%48 = OpLoad %float %38", + "OpStore %39 %48", + "%25 = OpLoad %float %39", + "%26 = OpCompositeConstruct %v4float %25 %25 %25 %25", + "OpStore %color %26", + "%27 = OpLoad %v4float %color", + "OpStore %gl_FragColor %27", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, PhiAfterCall) { + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(float bar) + // { + // float r = bar; + // if (r < 0.0) + // r = -r; + // return r; + // } + // + // void main() + // { + // vec4 color = BaseColor; + // if (foo(color.x) > 2.0 && foo(color.y) > 2.0) + // color = vec4(0.0); + // gl_FragColor = color; + // } + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 140", + "OpName %main \"main\"", + "OpName %foo_f1_ \"foo(f1;\"", + "OpName %bar \"bar\"", + "OpName %r \"r\"", + "OpName %color \"color\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param \"param\"", + "OpName %param_0 \"param\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "%void = OpTypeVoid", + "%12 = OpTypeFunction %void", + "%float = OpTypeFloat 32", +"%_ptr_Function_float = OpTypePointer Function %float", + "%15 = OpTypeFunction %float %_ptr_Function_float", + "%float_0 = OpConstant %float 0", + "%bool = OpTypeBool", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", + "%float_2 = OpConstant %float 2", + "%uint_1 = OpConstant %uint 1", + "%25 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_f1_ = OpFunction %float None %15", + "%bar = OpFunctionParameter %_ptr_Function_float", + "%43 = OpLabel", + "%r = OpVariable %_ptr_Function_float Function", + "%44 = OpLoad %float %bar", + "OpStore %r %44", + "%45 = OpLoad %float %r", + "%46 = OpFOrdLessThan %bool %45 %float_0", + "OpSelectionMerge %47 None", + "OpBranchConditional %46 %48 %47", + "%48 = OpLabel", + "%49 = OpLoad %float %r", + "%50 = OpFNegate %float %49", + "OpStore %r %50", + "OpBranch %47", + "%47 = OpLabel", + "%51 = OpLoad %float %r", + "OpReturnValue %51", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %12", + "%27 = OpLabel", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_float Function", + "%param_0 = OpVariable %_ptr_Function_float Function", + "%28 = OpLoad %v4float %BaseColor", + "OpStore %color %28", + "%29 = OpAccessChain %_ptr_Function_float %color %uint_0", + "%30 = OpLoad %float %29", + "OpStore %param %30", + "%31 = OpFunctionCall %float %foo_f1_ %param", + "%32 = OpFOrdGreaterThan %bool %31 %float_2", + "OpSelectionMerge %33 None", + "OpBranchConditional %32 %34 %33", + "%34 = OpLabel", + "%35 = OpAccessChain %_ptr_Function_float %color %uint_1", + "%36 = OpLoad %float %35", + "OpStore %param_0 %36", + "%37 = OpFunctionCall %float %foo_f1_ %param_0", + "%38 = OpFOrdGreaterThan %bool %37 %float_2", + "OpBranch %33", + "%33 = OpLabel", + "%39 = OpPhi %bool %32 %27 %38 %34", + "OpSelectionMerge %40 None", + "OpBranchConditional %39 %41 %40", + "%41 = OpLabel", + "OpStore %color %25", + "OpBranch %40", + "%40 = OpLabel", + "%42 = OpLoad %v4float %color", + "OpStore %gl_FragColor %42", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %12", + "%27 = OpLabel", + "%62 = OpVariable %_ptr_Function_float Function", + "%63 = OpVariable %_ptr_Function_float Function", + "%52 = OpVariable %_ptr_Function_float Function", + "%53 = OpVariable %_ptr_Function_float Function", + "%color = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_float Function", + "%param_0 = OpVariable %_ptr_Function_float Function", + "%28 = OpLoad %v4float %BaseColor", + "OpStore %color %28", + "%29 = OpAccessChain %_ptr_Function_float %color %uint_0", + "%30 = OpLoad %float %29", + "OpStore %param %30", + "%54 = OpLoad %float %param", + "OpStore %52 %54", + "%55 = OpLoad %float %52", + "%56 = OpFOrdLessThan %bool %55 %float_0", + "OpSelectionMerge %57 None", + "OpBranchConditional %56 %58 %57", + "%58 = OpLabel", + "%59 = OpLoad %float %52", + "%60 = OpFNegate %float %59", + "OpStore %52 %60", + "OpBranch %57", + "%57 = OpLabel", + "%61 = OpLoad %float %52", + "OpStore %53 %61", + "%31 = OpLoad %float %53", + "%32 = OpFOrdGreaterThan %bool %31 %float_2", + "OpSelectionMerge %33 None", + "OpBranchConditional %32 %34 %33", + "%34 = OpLabel", + "%35 = OpAccessChain %_ptr_Function_float %color %uint_1", + "%36 = OpLoad %float %35", + "OpStore %param_0 %36", + "%64 = OpLoad %float %param_0", + "OpStore %62 %64", + "%65 = OpLoad %float %62", + "%66 = OpFOrdLessThan %bool %65 %float_0", + "OpSelectionMerge %67 None", + "OpBranchConditional %66 %68 %67", + "%68 = OpLabel", + "%69 = OpLoad %float %62", + "%70 = OpFNegate %float %69", + "OpStore %62 %70", + "OpBranch %67", + "%67 = OpLabel", + "%71 = OpLoad %float %62", + "OpStore %63 %71", + "%37 = OpLoad %float %63", + "%38 = OpFOrdGreaterThan %bool %37 %float_2", + "OpBranch %33", + "%33 = OpLabel", + "%39 = OpPhi %bool %32 %57 %38 %67", + "OpSelectionMerge %40 None", + "OpBranchConditional %39 %41 %40", + "%41 = OpLabel", + "OpStore %color %25", + "OpBranch %40", + "%40 = OpLabel", + "%42 = OpLoad %v4float %color", + "OpStore %gl_FragColor %42", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, OpSampledImageOutOfBlock) { + // #version 450 + // + // uniform texture2D t2D; + // uniform sampler samp; + // out vec4 FragColor; + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // float r = bar.x; + // if (r < 0.0) + // r = -r; + // return r; + // } + // + // void main() + // { + // vec4 color1 = texture(sampler2D(t2D, samp), vec2(1.0)); + // vec4 color2 = vec4(foo(BaseColor)); + // vec4 color3 = texture(sampler2D(t2D, samp), vec2(0.5)); + // FragColor = (color1 + color2 + color3)/3; + // } + // + // Note: the before SPIR-V will need to be edited to create a use of + // the OpSampledImage across the function call. + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 450", + "OpName %main \"main\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %r \"r\"", + "OpName %color1 \"color1\"", + "OpName %t2D \"t2D\"", + "OpName %samp \"samp\"", + "OpName %color2 \"color2\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param \"param\"", + "OpName %color3 \"color3\"", + "OpName %FragColor \"FragColor\"", + "OpDecorate %t2D DescriptorSet 0", + "OpDecorate %samp DescriptorSet 0", + "%void = OpTypeVoid", + "%15 = OpTypeFunction %void", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%19 = OpTypeFunction %float %_ptr_Function_v4float", +"%_ptr_Function_float = OpTypePointer Function %float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", + "%float_0 = OpConstant %float 0", + "%bool = OpTypeBool", + "%25 = OpTypeImage %float 2D 0 0 0 1 Unknown", +"%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25", + "%t2D = OpVariable %_ptr_UniformConstant_25 UniformConstant", + "%27 = OpTypeSampler", +"%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27", + "%samp = OpVariable %_ptr_UniformConstant_27 UniformConstant", + "%29 = OpTypeSampledImage %25", + "%v2float = OpTypeVector %float 2", + "%float_1 = OpConstant %float 1", + "%32 = OpConstantComposite %v2float %float_1 %float_1", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", + "%float_0_5 = OpConstant %float 0.5", + "%35 = OpConstantComposite %v2float %float_0_5 %float_0_5", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", + "%FragColor = OpVariable %_ptr_Output_v4float Output", + "%float_3 = OpConstant %float 3", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_vf4_ = OpFunction %float None %19", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%56 = OpLabel", + "%r = OpVariable %_ptr_Function_float Function", + "%57 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%58 = OpLoad %float %57", + "OpStore %r %58", + "%59 = OpLoad %float %r", + "%60 = OpFOrdLessThan %bool %59 %float_0", + "OpSelectionMerge %61 None", + "OpBranchConditional %60 %62 %61", + "%62 = OpLabel", + "%63 = OpLoad %float %r", + "%64 = OpFNegate %float %63", + "OpStore %r %64", + "OpBranch %61", + "%61 = OpLabel", + "%65 = OpLoad %float %r", + "OpReturnValue %65", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %15", + "%38 = OpLabel", + "%color1 = OpVariable %_ptr_Function_v4float Function", + "%color2 = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color3 = OpVariable %_ptr_Function_v4float Function", + "%39 = OpLoad %25 %t2D", + "%40 = OpLoad %27 %samp", + "%41 = OpSampledImage %29 %39 %40", + "%42 = OpImageSampleImplicitLod %v4float %41 %32", + "OpStore %color1 %42", + "%43 = OpLoad %v4float %BaseColor", + "OpStore %param %43", + "%44 = OpFunctionCall %float %foo_vf4_ %param", + "%45 = OpCompositeConstruct %v4float %44 %44 %44 %44", + "OpStore %color2 %45", + "%46 = OpLoad %25 %t2D", + "%47 = OpLoad %27 %samp", + "%48 = OpImageSampleImplicitLod %v4float %41 %35", + "OpStore %color3 %48", + "%49 = OpLoad %v4float %color1", + "%50 = OpLoad %v4float %color2", + "%51 = OpFAdd %v4float %49 %50", + "%52 = OpLoad %v4float %color3", + "%53 = OpFAdd %v4float %51 %52", + "%54 = OpCompositeConstruct %v4float %float_3 %float_3 %float_3 %float_3", + "%55 = OpFDiv %v4float %53 %54", + "OpStore %FragColor %55", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %15", + "%38 = OpLabel", + "%66 = OpVariable %_ptr_Function_float Function", + "%67 = OpVariable %_ptr_Function_float Function", + "%color1 = OpVariable %_ptr_Function_v4float Function", + "%color2 = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color3 = OpVariable %_ptr_Function_v4float Function", + "%39 = OpLoad %25 %t2D", + "%40 = OpLoad %27 %samp", + "%41 = OpSampledImage %29 %39 %40", + "%42 = OpImageSampleImplicitLod %v4float %41 %32", + "OpStore %color1 %42", + "%43 = OpLoad %v4float %BaseColor", + "OpStore %param %43", + "%68 = OpAccessChain %_ptr_Function_float %param %uint_0", + "%69 = OpLoad %float %68", + "OpStore %66 %69", + "%70 = OpLoad %float %66", + "%71 = OpFOrdLessThan %bool %70 %float_0", + "OpSelectionMerge %72 None", + "OpBranchConditional %71 %73 %72", + "%73 = OpLabel", + "%74 = OpLoad %float %66", + "%75 = OpFNegate %float %74", + "OpStore %66 %75", + "OpBranch %72", + "%72 = OpLabel", + "%76 = OpLoad %float %66", + "OpStore %67 %76", + "%44 = OpLoad %float %67", + "%45 = OpCompositeConstruct %v4float %44 %44 %44 %44", + "OpStore %color2 %45", + "%46 = OpLoad %25 %t2D", + "%47 = OpLoad %27 %samp", + "%77 = OpSampledImage %29 %39 %40", + "%48 = OpImageSampleImplicitLod %v4float %77 %35", + "OpStore %color3 %48", + "%49 = OpLoad %v4float %color1", + "%50 = OpLoad %v4float %color2", + "%51 = OpFAdd %v4float %49 %50", + "%52 = OpLoad %v4float %color3", + "%53 = OpFAdd %v4float %51 %52", + "%54 = OpCompositeConstruct %v4float %float_3 %float_3 %float_3 %float_3", + "%55 = OpFDiv %v4float %53 %54", + "OpStore %FragColor %55", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, OpImageOutOfBlock) { + // #version 450 + // + // uniform texture2D t2D; + // uniform sampler samp; + // uniform sampler samp2; + // + // out vec4 FragColor; + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // float r = bar.x; + // if (r < 0.0) + // r = -r; + // return r; + // } + // + // void main() + // { + // vec4 color1 = texture(sampler2D(t2D, samp), vec2(1.0)); + // vec4 color2 = vec4(foo(BaseColor)); + // vec4 color3 = texture(sampler2D(t2D, samp2), vec2(0.5)); + // FragColor = (color1 + color2 + color3)/3; + // } + // Note: the before SPIR-V will need to be edited to create an OpImage + // from the first OpSampledImage, place it before the call and use it + // in the second OpSampledImage following the call. + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 450", + "OpName %main \"main\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %r \"r\"", + "OpName %color1 \"color1\"", + "OpName %t2D \"t2D\"", + "OpName %samp \"samp\"", + "OpName %color2 \"color2\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param \"param\"", + "OpName %color3 \"color3\"", + "OpName %samp2 \"samp2\"", + "OpName %FragColor \"FragColor\"", + "OpDecorate %t2D DescriptorSet 0", + "OpDecorate %samp DescriptorSet 0", + "OpDecorate %samp2 DescriptorSet 0", + "%void = OpTypeVoid", + "%16 = OpTypeFunction %void", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%20 = OpTypeFunction %float %_ptr_Function_v4float", +"%_ptr_Function_float = OpTypePointer Function %float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", + "%float_0 = OpConstant %float 0", + "%bool = OpTypeBool", + "%26 = OpTypeImage %float 2D 0 0 0 1 Unknown", +"%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26", + "%t2D = OpVariable %_ptr_UniformConstant_26 UniformConstant", + "%28 = OpTypeSampler", +"%_ptr_UniformConstant_28 = OpTypePointer UniformConstant %28", + "%samp = OpVariable %_ptr_UniformConstant_28 UniformConstant", + "%30 = OpTypeSampledImage %26", + "%v2float = OpTypeVector %float 2", + "%float_1 = OpConstant %float 1", + "%33 = OpConstantComposite %v2float %float_1 %float_1", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", + "%samp2 = OpVariable %_ptr_UniformConstant_28 UniformConstant", + "%float_0_5 = OpConstant %float 0.5", + "%36 = OpConstantComposite %v2float %float_0_5 %float_0_5", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", + "%FragColor = OpVariable %_ptr_Output_v4float Output", + "%float_3 = OpConstant %float 3", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_vf4_ = OpFunction %float None %20", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%58 = OpLabel", + "%r = OpVariable %_ptr_Function_float Function", + "%59 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%60 = OpLoad %float %59", + "OpStore %r %60", + "%61 = OpLoad %float %r", + "%62 = OpFOrdLessThan %bool %61 %float_0", + "OpSelectionMerge %63 None", + "OpBranchConditional %62 %64 %63", + "%64 = OpLabel", + "%65 = OpLoad %float %r", + "%66 = OpFNegate %float %65", + "OpStore %r %66", + "OpBranch %63", + "%63 = OpLabel", + "%67 = OpLoad %float %r", + "OpReturnValue %67", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %16", + "%39 = OpLabel", + "%color1 = OpVariable %_ptr_Function_v4float Function", + "%color2 = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color3 = OpVariable %_ptr_Function_v4float Function", + "%40 = OpLoad %26 %t2D", + "%41 = OpLoad %28 %samp", + "%42 = OpSampledImage %30 %40 %41", + "%43 = OpImageSampleImplicitLod %v4float %42 %33", + "%44 = OpImage %26 %42", + "%45 = OpLoad %28 %samp2", + "OpStore %color1 %43", + "%46 = OpLoad %v4float %BaseColor", + "OpStore %param %46", + "%47 = OpFunctionCall %float %foo_vf4_ %param", + "%48 = OpCompositeConstruct %v4float %47 %47 %47 %47", + "OpStore %color2 %48", + "%49 = OpSampledImage %30 %44 %45", + "%50 = OpImageSampleImplicitLod %v4float %49 %36", + "OpStore %color3 %50", + "%51 = OpLoad %v4float %color1", + "%52 = OpLoad %v4float %color2", + "%53 = OpFAdd %v4float %51 %52", + "%54 = OpLoad %v4float %color3", + "%55 = OpFAdd %v4float %53 %54", + "%56 = OpCompositeConstruct %v4float %float_3 %float_3 %float_3 %float_3", + "%57 = OpFDiv %v4float %55 %56", + "OpStore %FragColor %57", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %16", + "%39 = OpLabel", + "%68 = OpVariable %_ptr_Function_float Function", + "%69 = OpVariable %_ptr_Function_float Function", + "%color1 = OpVariable %_ptr_Function_v4float Function", + "%color2 = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color3 = OpVariable %_ptr_Function_v4float Function", + "%40 = OpLoad %26 %t2D", + "%41 = OpLoad %28 %samp", + "%42 = OpSampledImage %30 %40 %41", + "%43 = OpImageSampleImplicitLod %v4float %42 %33", + "%44 = OpImage %26 %42", + "%45 = OpLoad %28 %samp2", + "OpStore %color1 %43", + "%46 = OpLoad %v4float %BaseColor", + "OpStore %param %46", + "%70 = OpAccessChain %_ptr_Function_float %param %uint_0", + "%71 = OpLoad %float %70", + "OpStore %68 %71", + "%72 = OpLoad %float %68", + "%73 = OpFOrdLessThan %bool %72 %float_0", + "OpSelectionMerge %74 None", + "OpBranchConditional %73 %75 %74", + "%75 = OpLabel", + "%76 = OpLoad %float %68", + "%77 = OpFNegate %float %76", + "OpStore %68 %77", + "OpBranch %74", + "%74 = OpLabel", + "%78 = OpLoad %float %68", + "OpStore %69 %78", + "%47 = OpLoad %float %69", + "%48 = OpCompositeConstruct %v4float %47 %47 %47 %47", + "OpStore %color2 %48", + "%79 = OpSampledImage %30 %40 %41", + "%80 = OpImage %26 %79", + "%49 = OpSampledImage %30 %80 %45", + "%50 = OpImageSampleImplicitLod %v4float %49 %36", + "OpStore %color3 %50", + "%51 = OpLoad %v4float %color1", + "%52 = OpLoad %v4float %color2", + "%53 = OpFAdd %v4float %51 %52", + "%54 = OpLoad %v4float %color3", + "%55 = OpFAdd %v4float %53 %54", + "%56 = OpCompositeConstruct %v4float %float_3 %float_3 %float_3 %float_3", + "%57 = OpFDiv %v4float %55 %56", + "OpStore %FragColor %57", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, OpImageAndOpSampledImageOutOfBlock) { + // #version 450 + // + // uniform texture2D t2D; + // uniform sampler samp; + // uniform sampler samp2; + // + // out vec4 FragColor; + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // float r = bar.x; + // if (r < 0.0) + // r = -r; + // return r; + // } + // + // void main() + // { + // vec4 color1 = texture(sampler2D(t2D, samp), vec2(1.0)); + // vec4 color2 = vec4(foo(BaseColor)); + // vec4 color3 = texture(sampler2D(t2D, samp2), vec2(0.5)); + // FragColor = (color1 + color2 + color3)/3; + // } + // Note: the before SPIR-V will need to be edited to create an OpImage + // and subsequent OpSampledImage that is used across the function call. + const std::vector predefs = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %BaseColor %FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpSource GLSL 450", + "OpName %main \"main\"", + "OpName %foo_vf4_ \"foo(vf4;\"", + "OpName %bar \"bar\"", + "OpName %r \"r\"", + "OpName %color1 \"color1\"", + "OpName %t2D \"t2D\"", + "OpName %samp \"samp\"", + "OpName %color2 \"color2\"", + "OpName %BaseColor \"BaseColor\"", + "OpName %param \"param\"", + "OpName %color3 \"color3\"", + "OpName %samp2 \"samp2\"", + "OpName %FragColor \"FragColor\"", + "OpDecorate %t2D DescriptorSet 0", + "OpDecorate %samp DescriptorSet 0", + "OpDecorate %samp2 DescriptorSet 0", + "%void = OpTypeVoid", + "%16 = OpTypeFunction %void", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Function_v4float = OpTypePointer Function %v4float", + "%20 = OpTypeFunction %float %_ptr_Function_v4float", +"%_ptr_Function_float = OpTypePointer Function %float", + "%uint = OpTypeInt 32 0", + "%uint_0 = OpConstant %uint 0", + "%float_0 = OpConstant %float 0", + "%bool = OpTypeBool", + "%26 = OpTypeImage %float 2D 0 0 0 1 Unknown", +"%_ptr_UniformConstant_26 = OpTypePointer UniformConstant %26", + "%t2D = OpVariable %_ptr_UniformConstant_26 UniformConstant", + "%28 = OpTypeSampler", +"%_ptr_UniformConstant_28 = OpTypePointer UniformConstant %28", + "%samp = OpVariable %_ptr_UniformConstant_28 UniformConstant", + "%30 = OpTypeSampledImage %26", + "%v2float = OpTypeVector %float 2", + "%float_1 = OpConstant %float 1", + "%33 = OpConstantComposite %v2float %float_1 %float_1", +"%_ptr_Input_v4float = OpTypePointer Input %v4float", + "%BaseColor = OpVariable %_ptr_Input_v4float Input", + "%samp2 = OpVariable %_ptr_UniformConstant_28 UniformConstant", + "%float_0_5 = OpConstant %float 0.5", + "%36 = OpConstantComposite %v2float %float_0_5 %float_0_5", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", + "%FragColor = OpVariable %_ptr_Output_v4float Output", + "%float_3 = OpConstant %float 3", + // clang-format on + }; + + const std::vector nonEntryFuncs = { + // clang-format off + "%foo_vf4_ = OpFunction %float None %20", + "%bar = OpFunctionParameter %_ptr_Function_v4float", + "%58 = OpLabel", + "%r = OpVariable %_ptr_Function_float Function", + "%59 = OpAccessChain %_ptr_Function_float %bar %uint_0", + "%60 = OpLoad %float %59", + "OpStore %r %60", + "%61 = OpLoad %float %r", + "%62 = OpFOrdLessThan %bool %61 %float_0", + "OpSelectionMerge %63 None", + "OpBranchConditional %62 %64 %63", + "%64 = OpLabel", + "%65 = OpLoad %float %r", + "%66 = OpFNegate %float %65", + "OpStore %r %66", + "OpBranch %63", + "%63 = OpLabel", + "%67 = OpLoad %float %r", + "OpReturnValue %67", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector before = { + // clang-format off + "%main = OpFunction %void None %16", + "%39 = OpLabel", + "%color1 = OpVariable %_ptr_Function_v4float Function", + "%color2 = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color3 = OpVariable %_ptr_Function_v4float Function", + "%40 = OpLoad %26 %t2D", + "%41 = OpLoad %28 %samp", + "%42 = OpSampledImage %30 %40 %41", + "%43 = OpImageSampleImplicitLod %v4float %42 %33", + "%44 = OpImage %26 %42", + "%45 = OpLoad %28 %samp2", + "%46 = OpSampledImage %30 %44 %45", + "OpStore %color1 %43", + "%47 = OpLoad %v4float %BaseColor", + "OpStore %param %47", + "%48 = OpFunctionCall %float %foo_vf4_ %param", + "%49 = OpCompositeConstruct %v4float %48 %48 %48 %48", + "OpStore %color2 %49", + "%50 = OpImageSampleImplicitLod %v4float %46 %36", + "OpStore %color3 %50", + "%51 = OpLoad %v4float %color1", + "%52 = OpLoad %v4float %color2", + "%53 = OpFAdd %v4float %51 %52", + "%54 = OpLoad %v4float %color3", + "%55 = OpFAdd %v4float %53 %54", + "%56 = OpCompositeConstruct %v4float %float_3 %float_3 %float_3 %float_3", + "%57 = OpFDiv %v4float %55 %56", + "OpStore %FragColor %57", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + const std::vector after = { + // clang-format off + "%main = OpFunction %void None %16", + "%39 = OpLabel", + "%68 = OpVariable %_ptr_Function_float Function", + "%69 = OpVariable %_ptr_Function_float Function", + "%color1 = OpVariable %_ptr_Function_v4float Function", + "%color2 = OpVariable %_ptr_Function_v4float Function", + "%param = OpVariable %_ptr_Function_v4float Function", + "%color3 = OpVariable %_ptr_Function_v4float Function", + "%40 = OpLoad %26 %t2D", + "%41 = OpLoad %28 %samp", + "%42 = OpSampledImage %30 %40 %41", + "%43 = OpImageSampleImplicitLod %v4float %42 %33", + "%44 = OpImage %26 %42", + "%45 = OpLoad %28 %samp2", + "%46 = OpSampledImage %30 %44 %45", + "OpStore %color1 %43", + "%47 = OpLoad %v4float %BaseColor", + "OpStore %param %47", + "%70 = OpAccessChain %_ptr_Function_float %param %uint_0", + "%71 = OpLoad %float %70", + "OpStore %68 %71", + "%72 = OpLoad %float %68", + "%73 = OpFOrdLessThan %bool %72 %float_0", + "OpSelectionMerge %74 None", + "OpBranchConditional %73 %75 %74", + "%75 = OpLabel", + "%76 = OpLoad %float %68", + "%77 = OpFNegate %float %76", + "OpStore %68 %77", + "OpBranch %74", + "%74 = OpLabel", + "%78 = OpLoad %float %68", + "OpStore %69 %78", + "%48 = OpLoad %float %69", + "%49 = OpCompositeConstruct %v4float %48 %48 %48 %48", + "OpStore %color2 %49", + "%79 = OpSampledImage %30 %40 %41", + "%80 = OpImage %26 %79", + "%81 = OpSampledImage %30 %80 %45", + "%50 = OpImageSampleImplicitLod %v4float %81 %36", + "OpStore %color3 %50", + "%51 = OpLoad %v4float %color1", + "%52 = OpLoad %v4float %color2", + "%53 = OpFAdd %v4float %51 %52", + "%54 = OpLoad %v4float %color3", + "%55 = OpFAdd %v4float %53 %54", + "%56 = OpCompositeConstruct %v4float %float_3 %float_3 %float_3 %float_3", + "%57 = OpFDiv %v4float %55 %56", + "OpStore %FragColor %57", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck( + JoinAllInsts(Concat(Concat(predefs, before), nonEntryFuncs)), + JoinAllInsts(Concat(Concat(predefs, after), nonEntryFuncs)), + /* skip_nop = */ false, /* do_validate = */ true); +} + +TEST_F(InlineTest, EarlyReturnFunctionInlined) { + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // if (bar.x < 0.0) + // return 0.0; + // return bar.x; + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_ "foo(vf4;" +OpName %bar "bar" +OpName %color "color" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%14 = OpTypeFunction %float %_ptr_Function_v4float +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string nonEntryFuncs = + R"(%foo_vf4_ = OpFunction %float None %14 +%bar = OpFunctionParameter %_ptr_Function_v4float +%27 = OpLabel +%28 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%29 = OpLoad %float %28 +%30 = OpFOrdLessThan %bool %29 %float_0 +OpSelectionMerge %31 None +OpBranchConditional %30 %32 %31 +%32 = OpLabel +OpReturnValue %float_0 +%31 = OpLabel +%33 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%34 = OpLoad %float %33 +OpReturnValue %34 +OpFunctionEnd +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%22 = OpLabel +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%23 = OpLoad %v4float %BaseColor +OpStore %param %23 +%24 = OpFunctionCall %float %foo_vf4_ %param +%25 = OpCompositeConstruct %v4float %24 %24 %24 %24 +OpStore %color %25 +%26 = OpLoad %v4float %color +OpStore %gl_FragColor %26 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%false = OpConstantFalse %bool +%main = OpFunction %void None %10 +%22 = OpLabel +%35 = OpVariable %_ptr_Function_float Function +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%23 = OpLoad %v4float %BaseColor +OpStore %param %23 +OpBranch %36 +%36 = OpLabel +OpLoopMerge %37 %38 None +OpBranch %39 +%39 = OpLabel +%40 = OpAccessChain %_ptr_Function_float %param %uint_0 +%41 = OpLoad %float %40 +%42 = OpFOrdLessThan %bool %41 %float_0 +OpSelectionMerge %43 None +OpBranchConditional %42 %44 %43 +%44 = OpLabel +OpStore %35 %float_0 +OpBranch %37 +%43 = OpLabel +%45 = OpAccessChain %_ptr_Function_float %param %uint_0 +%46 = OpLoad %float %45 +OpStore %35 %46 +OpBranch %37 +%38 = OpLabel +OpBranchConditional %false %36 %37 +%37 = OpLabel +%24 = OpLoad %float %35 +%25 = OpCompositeConstruct %v4float %24 %24 %24 %24 +OpStore %color %25 +%26 = OpLoad %v4float %color +OpStore %gl_FragColor %26 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before + nonEntryFuncs, + predefs + after + nonEntryFuncs, + false, true); +} + +TEST_F(InlineTest, EarlyReturnNotAppearingLastInFunctionInlined) { + // Example from https://github.com/KhronosGroup/SPIRV-Tools/issues/755 + // + // Original example is derived from: + // + // #version 450 + // + // float foo() { + // if (true) { + // } + // } + // + // void main() { foo(); } + // + // But the order of basic blocks in foo is changed so that the return + // block is listed second-last. There is only one return in the callee + // but it does not appear last. + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 450 +OpName %main "main" +OpName %foo_ "foo(" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%bool = OpTypeBool +%true = OpConstantTrue %bool +)"; + + const std::string nonEntryFuncs = + R"(%foo_ = OpFunction %void None %4 +%7 = OpLabel +OpSelectionMerge %8 None +OpBranchConditional %true %9 %8 +%8 = OpLabel +OpReturn +%9 = OpLabel +OpBranch %8 +OpFunctionEnd +)"; + + const std::string before = + R"(%main = OpFunction %void None %4 +%10 = OpLabel +%11 = OpFunctionCall %void %foo_ +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %4 +%10 = OpLabel +OpSelectionMerge %12 None +OpBranchConditional %true %13 %12 +%12 = OpLabel +OpBranch %14 +%13 = OpLabel +OpBranch %12 +%14 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, ForwardReferencesInPhiInlined) { + // The basic structure of the test case is like this: + // + // int foo() { + // int result = 1; + // if (true) { + // result = 1; + // } + // return result; + // } + // + // void main() { + // int x = foo(); + // } + // + // but with modifications: Using Phi instead of load/store, and the + // return block in foo appears before the "then" block. + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpSource GLSL 450 +OpName %main "main" +OpName %foo_ "foo(" +OpName %x "x" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%8 = OpTypeFunction %int +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int_0 = OpConstant %int 0 +%_ptr_Function_int = OpTypePointer Function %int +)"; + + const std::string nonEntryFuncs = + R"(%foo_ = OpFunction %int None %8 +%13 = OpLabel +%14 = OpCopyObject %int %int_0 +OpSelectionMerge %15 None +OpBranchConditional %true %16 %15 +%15 = OpLabel +%17 = OpPhi %int %14 %13 %18 %16 +OpReturnValue %17 +%16 = OpLabel +%18 = OpCopyObject %int %int_0 +OpBranch %15 +OpFunctionEnd +)"; + + const std::string before = + R"(%main = OpFunction %void None %6 +%19 = OpLabel +%x = OpVariable %_ptr_Function_int Function +%20 = OpFunctionCall %int %foo_ +OpStore %x %20 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %6 +%19 = OpLabel +%21 = OpVariable %_ptr_Function_int Function +%x = OpVariable %_ptr_Function_int Function +%22 = OpCopyObject %int %int_0 +OpSelectionMerge %23 None +OpBranchConditional %true %24 %23 +%23 = OpLabel +%26 = OpPhi %int %22 %19 %25 %24 +OpStore %21 %26 +OpBranch %27 +%24 = OpLabel +%25 = OpCopyObject %int %int_0 +OpBranch %23 +%27 = OpLabel +%20 = OpLoad %int %21 +OpStore %x %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, EarlyReturnInLoopIsNotInlined) { + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // while (true) { + // if (bar.x < 0.0) + // return 0.0; + // return bar.x; + // } + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_ "foo(vf4;" +OpName %bar "bar" +OpName %color "color" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%14 = OpTypeFunction %float %_ptr_Function_v4float +%bool = OpTypeBool +%true = OpConstantTrue %bool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %10 +%23 = OpLabel +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%24 = OpLoad %v4float %BaseColor +OpStore %param %24 +%25 = OpFunctionCall %float %foo_vf4_ %param +%26 = OpCompositeConstruct %v4float %25 %25 %25 %25 +OpStore %color %26 +%27 = OpLoad %v4float %color +OpStore %gl_FragColor %27 +OpReturn +OpFunctionEnd +%foo_vf4_ = OpFunction %float None %14 +%bar = OpFunctionParameter %_ptr_Function_v4float +%28 = OpLabel +OpBranch %29 +%29 = OpLabel +OpLoopMerge %30 %31 None +OpBranch %32 +%32 = OpLabel +OpBranchConditional %true %33 %30 +%33 = OpLabel +%34 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%35 = OpLoad %float %34 +%36 = OpFOrdLessThan %bool %35 %float_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %38 %37 +%38 = OpLabel +OpReturnValue %float_0 +%37 = OpLabel +%39 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%40 = OpLoad %float %39 +OpReturnValue %40 +%31 = OpLabel +OpBranch %29 +%30 = OpLabel +%41 = OpUndef %float +OpReturnValue %41 +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, false, true); +} + +TEST_F(InlineTest, ExternalFunctionIsNotInlined) { + // In particular, don't crash. + // See report https://github.com/KhronosGroup/SPIRV-Tools/issues/605 + const std::string assembly = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %1 "entry_pt" +OpDecorate %2 LinkageAttributes "external" Import +%void = OpTypeVoid +%4 = OpTypeFunction %void +%2 = OpFunction %void None %4 +OpFunctionEnd +%1 = OpFunction %void None %4 +%5 = OpLabel +%6 = OpFunctionCall %void %2 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, false, true); +} + +TEST_F(InlineTest, SingleBlockLoopCallsMultiBlockCallee) { + // Example from https://github.com/KhronosGroup/SPIRV-Tools/issues/787 + // + // CFG structure is: + // foo: + // fooentry -> fooexit + // + // main: + // entry -> loop + // loop -> loop, merge + // loop calls foo() + // merge + // + // Since the callee has multiple blocks, it will split the calling block + // into at least two, resulting in a new "back-half" block that contains + // the instructions after the inlined function call. If the calling block + // has an OpLoopMerge that points back to the calling block itself, then + // the OpLoopMerge can't remain in the back-half block, but must be + // moved to the end of the original calling block, and it continue target + // operand updated to point to the back-half block. + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource OpenCL_C 120 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%void = OpTypeVoid +)"; + + const std::string nonEntryFuncs = + R"(%5 = OpTypeFunction %void +%6 = OpFunction %void None %5 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%1 = OpFunction %void None %5 +%9 = OpLabel +OpBranch %10 +%10 = OpLabel +%11 = OpFunctionCall %void %6 +OpLoopMerge %12 %10 None +OpBranchConditional %true %10 %12 +%12 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%1 = OpFunction %void None %5 +%9 = OpLabel +OpBranch %10 +%10 = OpLabel +OpLoopMerge %12 %13 None +OpBranch %13 +%13 = OpLabel +OpBranchConditional %true %10 %12 +%12 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, MultiBlockLoopHeaderCallsMultiBlockCallee) { + // Like SingleBlockLoopCallsMultiBlockCallee but the loop has several + // blocks, but the function call still occurs in the loop header. + // Example from https://github.com/KhronosGroup/SPIRV-Tools/issues/800 + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource OpenCL_C 120 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int_5 = OpConstant %int 5 +%void = OpTypeVoid +%11 = OpTypeFunction %void +)"; + + const std::string nonEntryFuncs = + R"(%12 = OpFunction %void None %11 +%13 = OpLabel +%14 = OpCopyObject %int %int_1 +OpBranch %15 +%15 = OpLabel +%16 = OpCopyObject %int %int_2 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%1 = OpFunction %void None %11 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpCopyObject %int %int_3 +%20 = OpFunctionCall %void %12 +%21 = OpCopyObject %int %int_4 +OpLoopMerge %22 %23 None +OpBranchConditional %true %23 %22 +%23 = OpLabel +%24 = OpCopyObject %int %int_5 +OpBranchConditional %true %18 %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%1 = OpFunction %void None %11 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpCopyObject %int %int_3 +%25 = OpCopyObject %int %int_1 +OpLoopMerge %22 %23 None +OpBranch %26 +%26 = OpLabel +%27 = OpCopyObject %int %int_2 +%21 = OpCopyObject %int %int_4 +OpBranchConditional %true %23 %22 +%23 = OpLabel +%24 = OpCopyObject %int %int_5 +OpBranchConditional %true %18 %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, SingleBlockLoopCallsMultiBlockCalleeHavingSelectionMerge) { + // This is similar to SingleBlockLoopCallsMultiBlockCallee except + // that calleee block also has a merge instruction in its first block. + // That merge instruction must be an OpSelectionMerge (because the entry + // block of a function can't be the header of a loop since the entry + // block can't be the target of a branch). + // + // In this case the OpLoopMerge can't be placed in the same block as + // the OpSelectionMerge, so inlining must create a new block to contain + // the callee contents. + // + // Additionally, we have two dummy OpCopyObject instructions to prove that + // the OpLoopMerge is moved to the right location. + // + // Also ensure that OpPhis within the cloned callee code are valid. + // We need to test that the predecessor blocks are remapped correctly so that + // dominance rules are satisfied + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource OpenCL_C 120 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%void = OpTypeVoid +%6 = OpTypeFunction %void +)"; + + // This callee has multiple blocks, and an OpPhi in the last block + // that references a value from the first block. This tests that + // cloned block IDs are remapped appropriately. The OpPhi dominance + // requires that the remapped %9 must be in a block that dominates + // the remapped %8. + const std::string nonEntryFuncs = + R"(%7 = OpFunction %void None %6 +%8 = OpLabel +%9 = OpCopyObject %bool %true +OpSelectionMerge %10 None +OpBranchConditional %true %10 %10 +%10 = OpLabel +%11 = OpPhi %bool %9 %8 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%1 = OpFunction %void None %6 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%14 = OpCopyObject %bool %false +%15 = OpFunctionCall %void %7 +OpLoopMerge %16 %13 None +OpBranchConditional %true %13 %16 +%16 = OpLabel +OpReturn +OpFunctionEnd +)"; + + // Note the remapped Phi uses %17 as the parent instead + // of %13, demonstrating that the parent block has been remapped + // correctly. + const std::string after = + R"(%1 = OpFunction %void None %6 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%14 = OpCopyObject %bool %false +OpLoopMerge %16 %19 None +OpBranch %17 +%17 = OpLabel +%18 = OpCopyObject %bool %true +OpSelectionMerge %19 None +OpBranchConditional %true %19 %19 +%19 = OpLabel +%20 = OpPhi %bool %18 %17 +OpBranchConditional %true %13 %16 +%16 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, + MultiBlockLoopHeaderCallsFromToMultiBlockCalleeHavingSelectionMerge) { + // This is similar to SingleBlockLoopCallsMultiBlockCalleeHavingSelectionMerge + // but the call is in the header block of a multi block loop. + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource OpenCL_C 120 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%int_5 = OpConstant %int 5 +%void = OpTypeVoid +%11 = OpTypeFunction %void +)"; + + const std::string nonEntryFuncs = + R"(%12 = OpFunction %void None %11 +%13 = OpLabel +%14 = OpCopyObject %int %int_1 +OpSelectionMerge %15 None +OpBranchConditional %true %15 %15 +%15 = OpLabel +%16 = OpCopyObject %int %int_2 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%1 = OpFunction %void None %11 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpCopyObject %int %int_3 +%20 = OpFunctionCall %void %12 +%21 = OpCopyObject %int %int_4 +OpLoopMerge %22 %23 None +OpBranchConditional %true %23 %22 +%23 = OpLabel +%24 = OpCopyObject %int %int_5 +OpBranchConditional %true %18 %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%1 = OpFunction %void None %11 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpCopyObject %int %int_3 +OpLoopMerge %22 %23 None +OpBranch %25 +%25 = OpLabel +%26 = OpCopyObject %int %int_1 +OpSelectionMerge %27 None +OpBranchConditional %true %27 %27 +%27 = OpLabel +%28 = OpCopyObject %int %int_2 +%21 = OpCopyObject %int %int_4 +OpBranchConditional %true %23 %22 +%23 = OpLabel +%24 = OpCopyObject %int %int_5 +OpBranchConditional %true %18 %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F( + InlineTest, + SingleBlockLoopCallsMultiBlockCalleeHavingSelectionMergeAndMultiReturns) { + // This is similar to SingleBlockLoopCallsMultiBlockCalleeHavingSelectionMerge + // except that in addition to starting with a selection header, the + // callee also has multi returns. + // + // So now we have to accommodate: + // - The caller's OpLoopMerge (which must move to the first block) + // - The single-trip loop to wrap the multi returns, and + // - The callee's selection merge in its first block. + // Each of these must go into their own blocks. + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource OpenCL_C 120 +%bool = OpTypeBool +%int = OpTypeInt 32 1 +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%void = OpTypeVoid +%12 = OpTypeFunction %void +)"; + + const std::string nonEntryFuncs = + R"(%13 = OpFunction %void None %12 +%14 = OpLabel +%15 = OpCopyObject %int %int_0 +OpReturn +%16 = OpLabel +%17 = OpCopyObject %int %int_1 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%1 = OpFunction %void None %12 +%18 = OpLabel +OpBranch %19 +%19 = OpLabel +%20 = OpCopyObject %int %int_2 +%21 = OpFunctionCall %void %13 +%22 = OpCopyObject %int %int_3 +OpLoopMerge %23 %19 None +OpBranchConditional %true %19 %23 +%23 = OpLabel +%24 = OpCopyObject %int %int_4 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%1 = OpFunction %void None %12 +%18 = OpLabel +OpBranch %19 +%19 = OpLabel +%20 = OpCopyObject %int %int_2 +OpLoopMerge %23 %26 None +OpBranch %25 +%25 = OpLabel +OpLoopMerge %26 %27 None +OpBranch %28 +%28 = OpLabel +%29 = OpCopyObject %int %int_0 +OpBranch %26 +%30 = OpLabel +%31 = OpCopyObject %int %int_1 +OpBranch %26 +%27 = OpLabel +OpBranchConditional %false %25 %26 +%26 = OpLabel +%22 = OpCopyObject %int %int_3 +OpBranchConditional %true %19 %23 +%23 = OpLabel +%24 = OpCopyObject %int %int_4 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, CalleeWithMultiReturnAndPhiRequiresEntryBlockRemapping) { + // The case from https://github.com/KhronosGroup/SPIRV-Tools/issues/790 + // + // The callee has multiple returns, and so must be wrapped with a single-trip + // loop. That code must remap the callee entry block ID to the introduced + // loop body's ID. Otherwise you can get a dominance error in a cloned OpPhi. + + const std::string predefs = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource OpenCL_C 120 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_4 = OpConstant %int 4 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%bool = OpTypeBool +%false = OpConstantFalse %bool +)"; + + // This callee has multiple returns, and a Phi in the second block referencing + // a value generated in the entry block. + const std::string nonEntryFuncs = + R"(%12 = OpFunction %void None %9 +%13 = OpLabel +%14 = OpCopyObject %int %int_0 +OpBranch %15 +%15 = OpLabel +%16 = OpPhi %int %14 %13 +%17 = OpCopyObject %int %int_1 +OpReturn +%18 = OpLabel +%19 = OpCopyObject %int %int_2 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%1 = OpFunction %void None %9 +%20 = OpLabel +%21 = OpCopyObject %int %int_3 +%22 = OpFunctionCall %void %12 +%23 = OpCopyObject %int %int_4 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%1 = OpFunction %void None %9 +%20 = OpLabel +%21 = OpCopyObject %int %int_3 +OpBranch %24 +%24 = OpLabel +OpLoopMerge %25 %26 None +OpBranch %27 +%27 = OpLabel +%28 = OpCopyObject %int %int_0 +OpBranch %29 +%29 = OpLabel +%30 = OpPhi %int %28 %27 +%31 = OpCopyObject %int %int_1 +OpBranch %25 +%32 = OpLabel +%33 = OpCopyObject %int %int_2 +OpBranch %25 +%26 = OpLabel +OpBranchConditional %false %24 %25 +%25 = OpLabel +%23 = OpCopyObject %int %int_4 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + nonEntryFuncs + before, + predefs + nonEntryFuncs + after, + false, true); +} + +TEST_F(InlineTest, Decorated1) { + // Same test as Simple with the difference + // that OpFAdd in the outlined function is + // decorated with RelaxedPrecision + // Expected result is an equal decoration + // of the corresponding inlined instruction + // + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // return bar.x + bar.y; + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_ "foo(vf4;" +OpName %bar "bar" +OpName %color "color" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %9 RelaxedPrecision +)"; + + const std::string before = + R"(%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%15 = OpTypeFunction %float %_ptr_Function_v4float +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %11 +%22 = OpLabel +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%23 = OpLoad %v4float %BaseColor +OpStore %param %23 +%24 = OpFunctionCall %float %foo_vf4_ %param +%25 = OpCompositeConstruct %v4float %24 %24 %24 %24 +OpStore %color %25 +%26 = OpLoad %v4float %color +OpStore %gl_FragColor %26 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpDecorate %37 RelaxedPrecision +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%15 = OpTypeFunction %float %_ptr_Function_v4float +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %11 +%22 = OpLabel +%32 = OpVariable %_ptr_Function_float Function +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%23 = OpLoad %v4float %BaseColor +OpStore %param %23 +%33 = OpAccessChain %_ptr_Function_float %param %uint_0 +%34 = OpLoad %float %33 +%35 = OpAccessChain %_ptr_Function_float %param %uint_1 +%36 = OpLoad %float %35 +%37 = OpFAdd %float %34 %36 +OpStore %32 %37 +%24 = OpLoad %float %32 +%25 = OpCompositeConstruct %v4float %24 %24 %24 %24 +OpStore %color %25 +%26 = OpLoad %v4float %color +OpStore %gl_FragColor %26 +OpReturn +OpFunctionEnd +)"; + + const std::string nonEntryFuncs = + R"(%foo_vf4_ = OpFunction %float None %15 +%bar = OpFunctionParameter %_ptr_Function_v4float +%27 = OpLabel +%28 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%29 = OpLoad %float %28 +%30 = OpAccessChain %_ptr_Function_float %bar %uint_1 +%31 = OpLoad %float %30 +%9 = OpFAdd %float %29 %31 +OpReturnValue %9 +OpFunctionEnd +)"; + SinglePassRunAndCheck(predefs + before + nonEntryFuncs, + predefs + after + nonEntryFuncs, + false, true); +} + +TEST_F(InlineTest, Decorated2) { + // Same test as Simple with the difference + // that the Result of the outlined OpFunction + // is decorated with RelaxedPrecision + // Expected result is an equal decoration + // of the created return variable + // + // #version 140 + // + // in vec4 BaseColor; + // + // float foo(vec4 bar) + // { + // return bar.x + bar.y; + // } + // + // void main() + // { + // vec4 color = vec4(foo(BaseColor)); + // gl_FragColor = color; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_ "foo(vf4;" +OpName %bar "bar" +OpName %color "color" +OpName %BaseColor "BaseColor" +OpName %param "param" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %foo_vf4_ RelaxedPrecision +)"; + + const std::string before = + R"(%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%14 = OpTypeFunction %float %_ptr_Function_v4float +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %10 +%21 = OpLabel +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor +OpStore %param %22 +%23 = OpFunctionCall %float %foo_vf4_ %param +%24 = OpCompositeConstruct %v4float %23 %23 %23 %23 +OpStore %color %24 +%25 = OpLoad %v4float %color +OpStore %gl_FragColor %25 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpDecorate %32 RelaxedPrecision +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%14 = OpTypeFunction %float %_ptr_Function_v4float +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%uint_1 = OpConstant %uint 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %10 +%21 = OpLabel +%32 = OpVariable %_ptr_Function_float Function +%color = OpVariable %_ptr_Function_v4float Function +%param = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor +OpStore %param %22 +%33 = OpAccessChain %_ptr_Function_float %param %uint_0 +%34 = OpLoad %float %33 +%35 = OpAccessChain %_ptr_Function_float %param %uint_1 +%36 = OpLoad %float %35 +%37 = OpFAdd %float %34 %36 +OpStore %32 %37 +%23 = OpLoad %float %32 +%24 = OpCompositeConstruct %v4float %23 %23 %23 %23 +OpStore %color %24 +%25 = OpLoad %v4float %color +OpStore %gl_FragColor %25 +OpReturn +OpFunctionEnd +)"; + + const std::string nonEntryFuncs = + R"(%foo_vf4_ = OpFunction %float None %14 +%bar = OpFunctionParameter %_ptr_Function_v4float +%26 = OpLabel +%27 = OpAccessChain %_ptr_Function_float %bar %uint_0 +%28 = OpLoad %float %27 +%29 = OpAccessChain %_ptr_Function_float %bar %uint_1 +%30 = OpLoad %float %29 +%31 = OpFAdd %float %28 %30 +OpReturnValue %31 +OpFunctionEnd +)"; + SinglePassRunAndCheck(predefs + before + nonEntryFuncs, + predefs + after + nonEntryFuncs, + false, true); +} + +TEST_F(InlineTest, DeleteName) { + // Test that the name of the result id of the call is deleted. + const std::string before = + R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + OpName %main_entry "main_entry" + OpName %foo_result "foo_result" + OpName %void_fn "void_fn" + OpName %foo "foo" + OpName %foo_entry "foo_entry" + %void = OpTypeVoid + %void_fn = OpTypeFunction %void + %foo = OpFunction %void None %void_fn + %foo_entry = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %void_fn + %main_entry = OpLabel + %foo_result = OpFunctionCall %void %foo + OpReturn + OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" +OpName %main "main" +OpName %main_entry "main_entry" +OpName %void_fn "void_fn" +OpName %foo "foo" +OpName %foo_entry "foo_entry" +%void = OpTypeVoid +%void_fn = OpTypeFunction %void +%foo = OpFunction %void None %void_fn +%foo_entry = OpLabel +OpReturn +OpFunctionEnd +%main = OpFunction %void None %void_fn +%main_entry = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(InlineTest, SetParent) { + // Test that after inlining all basic blocks have the correct parent. + const std::string text = + R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + OpName %main_entry "main_entry" + OpName %foo_result "foo_result" + OpName %void_fn "void_fn" + OpName %foo "foo" + OpName %foo_entry "foo_entry" + %void = OpTypeVoid + %void_fn = OpTypeFunction %void + %foo = OpFunction %void None %void_fn + %foo_entry = OpLabel + OpReturn + OpFunctionEnd + %main = OpFunction %void None %void_fn + %main_entry = OpLabel + %foo_result = OpFunctionCall %void %foo + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + InlineExhaustivePass pass; + pass.Run(context.get()); + + for (Function& func : *context->module()) { + for (BasicBlock& bb : func) { + EXPECT_TRUE(bb.GetParent() == &func); + } + } +} + +#ifdef SPIRV_EFFCEE +TEST_F(InlineTest, OpKill) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpKill +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%voidfuncty = OpTypeFunction %void +%main = OpFunction %void None %voidfuncty +%1 = OpLabel +%2 = OpFunctionCall %void %func +OpReturn +OpFunctionEnd +%func = OpFunction %void None %voidfuncty +%3 = OpLabel +OpKill +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(InlineTest, OpKillWithTrailingInstructions) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK-NEXT: [[var:%\w+]] = OpVariable +; CHECK-NEXT: OpKill +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpStore [[var]] +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%bool_func_ptr = OpTypePointer Function %bool +%voidfuncty = OpTypeFunction %void +%main = OpFunction %void None %voidfuncty +%1 = OpLabel +%2 = OpVariable %bool_func_ptr Function +%3 = OpFunctionCall %void %func +OpStore %2 %true +OpReturn +OpFunctionEnd +%func = OpFunction %void None %voidfuncty +%4 = OpLabel +OpKill +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(InlineTest, OpKillInIf) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: [[var:%\w+]] = OpVariable +; CHECK-NEXT: [[ld:%\w+]] = OpLoad {{%\w+}} [[var]] +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpLoopMerge [[loop_merge:%\w+]] [[continue:%\w+]] None +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpSelectionMerge [[sel_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional {{%\w+}} [[kill_label:%\w+]] [[label:%\w+]] +; CHECK-NEXT: [[kill_label]] = OpLabel +; CHECK-NEXT: OpKill +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpBranch [[loop_merge]] +; CHECK-NEXT: [[sel_merge]] = OpLabel +; CHECK-NEXT: OpBranch [[loop_merge]] +; CHECK-NEXT: [[continue]] = OpLabel +; CHECK-NEXT: OpBranchConditional +; CHECK-NEXT: [[loop_merge]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[ld]] +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%bool_func_ptr = OpTypePointer Function %bool +%voidfuncty = OpTypeFunction %void +%main = OpFunction %void None %voidfuncty +%1 = OpLabel +%2 = OpVariable %bool_func_ptr Function +%3 = OpLoad %bool %2 +%4 = OpFunctionCall %void %func +OpStore %2 %3 +OpReturn +OpFunctionEnd +%func = OpFunction %void None %voidfuncty +%5 = OpLabel +OpSelectionMerge %6 None +OpBranchConditional %true %7 %8 +%7 = OpLabel +OpKill +%8 = OpLabel +OpReturn +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(InlineTest, OpKillInLoop) { + const std::string text = R"( +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK: [[var:%\w+]] = OpVariable +; CHECK-NEXT: [[ld:%\w+]] = OpLoad {{%\w+}} [[var]] +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK-NEXT: [[loop]] = OpLabel +; CHECK-NEXT: OpLoopMerge [[loop_merge:%\w+]] [[continue:%\w+]] None +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpKill +; CHECK-NEXT: [[loop_merge]] = OpLabel +; CHECK-NEXT: OpBranch [[label:%\w+]] +; CHECK-NEXT: [[continue]] = OpLabel +; CHECK-NEXT: OpBranch [[loop]] +; CHECK-NEXT: [[label]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[ld]] +; CHECK-NEXT: OpReturn +; CHECK-NEXT: OpFunctionEnd +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%voidfuncty = OpTypeFunction %void +%bool_func_ptr = OpTypePointer Function %bool +%main = OpFunction %void None %voidfuncty +%1 = OpLabel +%2 = OpVariable %bool_func_ptr Function +%3 = OpLoad %bool %2 +%4 = OpFunctionCall %void %func +OpStore %2 %3 +OpReturn +OpFunctionEnd +%func = OpFunction %void None %voidfuncty +%5 = OpLabel +OpBranch %10 +%10 = OpLabel +OpLoopMerge %6 %7 None +OpBranch %8 +%8 = OpLabel +OpKill +%6 = OpLabel +OpReturn +%7 = OpLabel +OpBranch %10 +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(InlineTest, OpVariableWithInit) { + // Check that there is a store that corresponds to the initializer. This + // test makes sure that is a store to the variable in the loop and before any + // load. + const std::string text = R"( +; CHECK: OpFunction +; CHECK-NOT: OpFunctionEnd +; CHECK: [[var:%\w+]] = OpVariable %_ptr_Function_float Function %float_0 +; CHECK: OpLoopMerge [[outer_merge:%\w+]] +; CHECK-NOT: OpLoad %float [[var]] +; CHECK: OpStore [[var]] %float_0 +; CHECK: OpFunctionEnd + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpDecorate %o Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeFunction %float +%_ptr_Function_float = OpTypePointer Function %float + %float_0 = OpConstant %float 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 +%_ptr_Output_float = OpTypePointer Output %float + %o = OpVariable %_ptr_Output_float Output + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_2 = OpConstant %int 2 + %main = OpFunction %void None %3 + %5 = OpLabel + OpStore %o %float_0 + OpBranch %34 + %34 = OpLabel + %39 = OpPhi %int %int_0 %5 %47 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %41 = OpSLessThan %bool %39 %int_2 + OpBranchConditional %41 %35 %36 + %35 = OpLabel + %42 = OpFunctionCall %float %foo_ + %43 = OpLoad %float %o + %44 = OpFAdd %float %43 %42 + OpStore %o %44 + OpBranch %37 + %37 = OpLabel + %47 = OpIAdd %int %39 %int_1 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + %foo_ = OpFunction %float None %7 + %9 = OpLabel + %n = OpVariable %_ptr_Function_float Function %float_0 + %13 = OpLoad %float %n + %15 = OpFOrdEqual %bool %13 %float_0 + OpSelectionMerge %17 None + OpBranchConditional %15 %16 %17 + %16 = OpLabel + %19 = OpLoad %float %n + %20 = OpFAdd %float %19 %float_1 + OpStore %n %20 + OpBranch %17 + %17 = OpLabel + %21 = OpLoad %float %n + OpReturnValue %21 + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// Empty modules +// Modules without function definitions +// Modules in which all functions do not call other functions +// Recursive functions (calling self & calling each other) +// Caller and callee both accessing the same global variable +// Functions with OpLine & OpNoLine +// Others? + +// TODO(dneto): Test suggestions from code review +// https://github.com/KhronosGroup/SPIRV-Tools/pull/534 +// +// Callee function returns a value generated outside the callee, +// e.g. a constant value. This might exercise some logic not yet +// exercised by the current tests: the false branch in the "if" +// inside the SpvOpReturnValue case in InlinePass::GenInlineCode? +// SampledImage before function call, but callee is only single block. +// Then the SampledImage instruction is not cloned. Documents existing +// behaviour. +// SampledImage after function call. It is not cloned or changed. + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/insert_extract_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/insert_extract_elim_test.cpp new file mode 100644 index 00000000000..c5169750bdd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/insert_extract_elim_test.cpp @@ -0,0 +1,900 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "source/opt/simplification_pass.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using InsertExtractElimTest = PassTest<::testing::Test>; + +TEST_F(InsertExtractElimTest, Simple) { + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // gl_FragColor = s0.v1; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpLoad %S_t %s0 +%20 = OpCompositeInsert %S_t %18 %19 1 +OpStore %s0 %20 +%21 = OpCompositeExtract %v4float %20 1 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpLoad %S_t %s0 +%20 = OpCompositeInsert %S_t %18 %19 1 +OpStore %s0 %20 +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(InsertExtractElimTest, OptimizeAcrossNonConflictingInsert) { + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // s0.v0[2] = 0.0; + // gl_FragColor = s0.v1; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float_0 = OpConstant %float 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%18 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%19 = OpLoad %v4float %BaseColor +%20 = OpLoad %S_t %s0 +%21 = OpCompositeInsert %S_t %19 %20 1 +%22 = OpCompositeInsert %S_t %float_0 %21 0 2 +OpStore %s0 %22 +%23 = OpCompositeExtract %v4float %22 1 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%18 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%19 = OpLoad %v4float %BaseColor +%20 = OpLoad %S_t %s0 +%21 = OpCompositeInsert %S_t %19 %20 1 +%22 = OpCompositeInsert %S_t %float_0 %21 0 2 +OpStore %s0 %22 +OpStore %gl_FragColor %19 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(InsertExtractElimTest, OptimizeOpaque) { + // SPIR-V not representable in GLSL; not generatable from HLSL + // for the moment. + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpMemberName %S_t 2 "smp" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %s0 "s0" +OpName %texCoords "texCoords" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%14 = OpTypeImage %float 2D 0 0 0 1 Unknown +%15 = OpTypeSampledImage %14 +%S_t = OpTypeStruct %v2float %v2float %15 +%_ptr_Function_S_t = OpTypePointer Function %S_t +%17 = OpTypeFunction %void %_ptr_Function_S_t +%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15 +%_ptr_Function_15 = OpTypePointer Function %15 +%sampler15 = OpVariable %_ptr_UniformConstant_15 UniformConstant +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%25 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%26 = OpLoad %v2float %texCoords +%27 = OpLoad %S_t %s0 +%28 = OpCompositeInsert %S_t %26 %27 0 +%29 = OpLoad %15 %sampler15 +%30 = OpCompositeInsert %S_t %29 %28 2 +OpStore %s0 %30 +%31 = OpCompositeExtract %15 %30 2 +%32 = OpCompositeExtract %v2float %30 0 +%33 = OpImageSampleImplicitLod %v4float %31 %32 +OpStore %outColor %33 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%25 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%26 = OpLoad %v2float %texCoords +%27 = OpLoad %S_t %s0 +%28 = OpCompositeInsert %S_t %26 %27 0 +%29 = OpLoad %15 %sampler15 +%30 = OpCompositeInsert %S_t %29 %28 2 +OpStore %s0 %30 +%33 = OpImageSampleImplicitLod %v4float %29 %26 +OpStore %outColor %33 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(InsertExtractElimTest, OptimizeNestedStruct) { + // The following HLSL has been pre-optimized to get the SPIR-V: + // struct S0 + // { + // int x; + // SamplerState ss; + // }; + // + // struct S1 + // { + // float b; + // S0 s0; + // }; + // + // struct S2 + // { + // int a1; + // S1 resources; + // }; + // + // SamplerState samp; + // Texture2D tex; + // + // float4 main(float4 vpos : VPOS) : COLOR0 + // { + // S1 s1; + // S2 s2; + // s1.s0.ss = samp; + // s2.resources = s1; + // return tex.Sample(s2.resources.s0.ss, float2(0.5)); + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %_entryPointOutput +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 500 +OpName %main "main" +OpName %S0 "S0" +OpMemberName %S0 0 "x" +OpMemberName %S0 1 "ss" +OpName %S1 "S1" +OpMemberName %S1 0 "b" +OpMemberName %S1 1 "s0" +OpName %samp "samp" +OpName %S2 "S2" +OpMemberName %S2 0 "a1" +OpMemberName %S2 1 "resources" +OpName %tex "tex" +OpName %_entryPointOutput "@entryPointOutput" +OpDecorate %samp DescriptorSet 0 +OpDecorate %tex DescriptorSet 0 +OpDecorate %_entryPointOutput Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%14 = OpTypeFunction %v4float %_ptr_Function_v4float +%int = OpTypeInt 32 1 +%16 = OpTypeSampler +%S0 = OpTypeStruct %int %16 +%S1 = OpTypeStruct %float %S0 +%_ptr_Function_S1 = OpTypePointer Function %S1 +%int_1 = OpConstant %int 1 +%_ptr_UniformConstant_16 = OpTypePointer UniformConstant %16 +%samp = OpVariable %_ptr_UniformConstant_16 UniformConstant +%_ptr_Function_16 = OpTypePointer Function %16 +%S2 = OpTypeStruct %int %S1 +%_ptr_Function_S2 = OpTypePointer Function %S2 +%22 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_22 = OpTypePointer UniformConstant %22 +%tex = OpVariable %_ptr_UniformConstant_22 UniformConstant +%24 = OpTypeSampledImage %22 +%v2float = OpTypeVector %float 2 +%float_0_5 = OpConstant %float 0.5 +%27 = OpConstantComposite %v2float %float_0_5 %float_0_5 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%30 = OpLabel +%31 = OpVariable %_ptr_Function_S1 Function +%32 = OpVariable %_ptr_Function_S2 Function +%33 = OpLoad %16 %samp +%34 = OpLoad %S1 %31 +%35 = OpCompositeInsert %S1 %33 %34 1 1 +OpStore %31 %35 +%36 = OpLoad %S2 %32 +%37 = OpCompositeInsert %S2 %35 %36 1 +OpStore %32 %37 +%38 = OpLoad %22 %tex +%39 = OpCompositeExtract %16 %37 1 1 1 +%40 = OpSampledImage %24 %38 %39 +%41 = OpImageSampleImplicitLod %v4float %40 %27 +OpStore %_entryPointOutput %41 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%30 = OpLabel +%31 = OpVariable %_ptr_Function_S1 Function +%32 = OpVariable %_ptr_Function_S2 Function +%33 = OpLoad %16 %samp +%34 = OpLoad %S1 %31 +%35 = OpCompositeInsert %S1 %33 %34 1 1 +OpStore %31 %35 +%36 = OpLoad %S2 %32 +%37 = OpCompositeInsert %S2 %35 %36 1 +OpStore %32 %37 +%38 = OpLoad %22 %tex +%40 = OpSampledImage %24 %38 %33 +%41 = OpImageSampleImplicitLod %v4float %40 %27 +OpStore %_entryPointOutput %41 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(InsertExtractElimTest, ConflictingInsertPreventsOptimization) { + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // s0.v1[2] = 0.0; + // gl_FragColor = s0.v1; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float_0 = OpConstant %float 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %8 +%18 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%19 = OpLoad %v4float %BaseColor +%20 = OpLoad %S_t %s0 +%21 = OpCompositeInsert %S_t %19 %20 1 +%22 = OpCompositeInsert %S_t %float_0 %21 1 2 +OpStore %s0 %22 +%23 = OpCompositeExtract %v4float %22 1 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, true); +} + +TEST_F(InsertExtractElimTest, ConflictingInsertPreventsOptimization2) { + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1[1] = 1.0; // dead + // s0.v1 = Baseline; + // gl_FragColor = vec4(s0.v1[1], 0.0, 0.0, 0.0); + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float_1 = OpConstant %float 1 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%float_1 = OpConstant %float 1 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%23 = OpLoad %S_t %s0 +%24 = OpCompositeInsert %S_t %float_1 %23 1 1 +%25 = OpLoad %v4float %BaseColor +%26 = OpCompositeInsert %S_t %25 %24 1 +%27 = OpCompositeExtract %float %26 1 1 +%28 = OpCompositeConstruct %v4float %27 %float_0 %float_0 %float_0 +OpStore %gl_FragColor %28 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%23 = OpLoad %S_t %s0 +%24 = OpCompositeInsert %S_t %float_1 %23 1 1 +%25 = OpLoad %v4float %BaseColor +%26 = OpCompositeInsert %S_t %25 %24 1 +%27 = OpCompositeExtract %float %25 1 +%28 = OpCompositeConstruct %v4float %27 %float_0 %float_0 %float_0 +OpStore %gl_FragColor %28 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +TEST_F(InsertExtractElimTest, MixWithConstants) { + // Extract component of FMix with 0.0 or 1.0 as the a-value. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in float bc; + // layout (location=1) in float bc2; + // layout (location=2) in float m; + // layout (location=3) in float m2; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec4 bcv = vec4(bc, bc2, 0.0, 1.0); + // vec4 bcv2 = vec4(bc2, bc, 1.0, 0.0); + // vec4 v = mix(bcv, bcv2, vec4(0.0,1.0,m,m2)); + // OutColor = vec4(v.y); + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %bc %bc2 %m %m2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %bc "bc" +OpName %bc2 "bc2" +OpName %m "m" +OpName %m2 "m2" +OpName %OutColor "OutColor" +OpDecorate %bc Location 0 +OpDecorate %bc2 Location 1 +OpDecorate %m Location 2 +OpDecorate %m2 Location 3 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_float = OpTypePointer Input %float +%bc = OpVariable %_ptr_Input_float Input +%bc2 = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%m = OpVariable %_ptr_Input_float Input +%m2 = OpVariable %_ptr_Input_float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%20 = OpLoad %float %bc +%21 = OpLoad %float %bc2 +%22 = OpCompositeConstruct %v4float %20 %21 %float_0 %float_1 +%23 = OpLoad %float %bc2 +%24 = OpLoad %float %bc +%25 = OpCompositeConstruct %v4float %23 %24 %float_1 %float_0 +%26 = OpLoad %float %m +%27 = OpLoad %float %m2 +%28 = OpCompositeConstruct %v4float %float_0 %float_1 %26 %27 +%29 = OpExtInst %v4float %1 FMix %22 %25 %28 +%30 = OpCompositeExtract %float %29 1 +%31 = OpCompositeConstruct %v4float %30 %30 %30 %30 +OpStore %OutColor %31 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%20 = OpLoad %float %bc +%21 = OpLoad %float %bc2 +%22 = OpCompositeConstruct %v4float %20 %21 %float_0 %float_1 +%23 = OpLoad %float %bc2 +%24 = OpLoad %float %bc +%25 = OpCompositeConstruct %v4float %23 %24 %float_1 %float_0 +%26 = OpLoad %float %m +%27 = OpLoad %float %m2 +%28 = OpCompositeConstruct %v4float %float_0 %float_1 %26 %27 +%29 = OpExtInst %v4float %1 FMix %22 %25 %28 +%31 = OpCompositeConstruct %v4float %24 %24 %24 %24 +OpStore %OutColor %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, predefs + after, + true, true); +} + +TEST_F(InsertExtractElimTest, VectorShuffle1) { + // Extract component from first vector in VectorShuffle + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in float bc; + // layout (location=1) in float bc2; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec4 bcv = vec4(bc, bc2, 0.0, 1.0); + // vec4 v = bcv.zwxy; + // OutColor = vec4(v.y); + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %bc %bc2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %bc "bc" +OpName %bc2 "bc2" +OpName %OutColor "OutColor" +OpDecorate %bc Location 0 +OpDecorate %bc2 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_float = OpTypePointer Input %float +%bc = OpVariable %_ptr_Input_float Input +%bc2 = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +)"; + + const std::string predefs_after = predefs_before + + "%24 = OpConstantComposite %v4float " + "%float_1 %float_1 %float_1 %float_1\n"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%18 = OpLoad %float %bc +%19 = OpLoad %float %bc2 +%20 = OpCompositeConstruct %v4float %18 %19 %float_0 %float_1 +%21 = OpVectorShuffle %v4float %20 %20 2 3 0 1 +%22 = OpCompositeExtract %float %21 1 +%23 = OpCompositeConstruct %v4float %22 %22 %22 %22 +OpStore %OutColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%18 = OpLoad %float %bc +%19 = OpLoad %float %bc2 +%20 = OpCompositeConstruct %v4float %18 %19 %float_0 %float_1 +%21 = OpVectorShuffle %v4float %20 %20 2 3 0 1 +OpStore %OutColor %24 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs_before + before, + predefs_after + after, true, true); +} + +TEST_F(InsertExtractElimTest, VectorShuffle2) { + // Extract component from second vector in VectorShuffle + // Identical to test VectorShuffle1 except for the vector + // shuffle index of 7. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in float bc; + // layout (location=1) in float bc2; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec4 bcv = vec4(bc, bc2, 0.0, 1.0); + // vec4 v = bcv.zwxy; + // OutColor = vec4(v.y); + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %bc %bc2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %bc "bc" +OpName %bc2 "bc2" +OpName %OutColor "OutColor" +OpDecorate %bc Location 0 +OpDecorate %bc2 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_float = OpTypePointer Input %float +%bc = OpVariable %_ptr_Input_float Input +%bc2 = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +)"; + + const std::string predefs_after = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %bc %bc2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %bc "bc" +OpName %bc2 "bc2" +OpName %OutColor "OutColor" +OpDecorate %bc Location 0 +OpDecorate %bc2 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_float = OpTypePointer Input %float +%bc = OpVariable %_ptr_Input_float Input +%bc2 = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%24 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%18 = OpLoad %float %bc +%19 = OpLoad %float %bc2 +%20 = OpCompositeConstruct %v4float %18 %19 %float_0 %float_1 +%21 = OpVectorShuffle %v4float %20 %20 2 7 0 1 +%22 = OpCompositeExtract %float %21 1 +%23 = OpCompositeConstruct %v4float %22 %22 %22 %22 +OpStore %OutColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%17 = OpLabel +%18 = OpLoad %float %bc +%19 = OpLoad %float %bc2 +%20 = OpCompositeConstruct %v4float %18 %19 %float_0 %float_1 +%21 = OpVectorShuffle %v4float %20 %20 2 7 0 1 +OpStore %OutColor %24 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs_before + before, + predefs_after + after, true, true); +} + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/instruction_list_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/instruction_list_test.cpp new file mode 100644 index 00000000000..e745790a3b9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/instruction_list_test.cpp @@ -0,0 +1,115 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/instruction.h" +#include "source/opt/instruction_list.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::ContainerEq; +using ::testing::ElementsAre; +using InstructionListTest = ::testing::Test; + +// A class that overrides the destructor, so we can trace it. +class TestInstruction : public Instruction { + public: + TestInstruction() : Instruction() { created_instructions_.push_back(this); } + + ~TestInstruction() { deleted_instructions_.push_back(this); } + + static std::vector created_instructions_; + static std::vector deleted_instructions_; +}; + +std::vector TestInstruction::created_instructions_; +std::vector TestInstruction::deleted_instructions_; + +// Test that the destructor for InstructionList is calling the destructor +// for every element that is in the list. +TEST(InstructionListTest, Destructor) { + InstructionList* list = new InstructionList(); + list->push_back(std::unique_ptr(new Instruction())); + list->push_back(std::unique_ptr(new Instruction())); + delete list; + + // Sorting because we do not care if the order of create and destruction is + // the same. Using generic sort just incase things are changed above. + std::sort(TestInstruction::created_instructions_.begin(), + TestInstruction::created_instructions_.end()); + std::sort(TestInstruction::deleted_instructions_.begin(), + TestInstruction::deleted_instructions_.end()); + EXPECT_THAT(TestInstruction::created_instructions_, + ContainerEq(TestInstruction::deleted_instructions_)); +} + +// Test the |InsertBefore| with a single instruction in the iterator class. +// Need to make sure the elements are inserted in the correct order, and the +// return value points to the correct location. +// +// Comparing addresses to make sure they remain stable, so other data structures +// can have pointers to instructions in InstructionList. +TEST(InstructionListTest, InsertBefore1) { + InstructionList list; + std::vector inserted_instructions; + for (int i = 0; i < 4; i++) { + std::unique_ptr inst(new Instruction()); + inserted_instructions.push_back(inst.get()); + auto new_element = list.end().InsertBefore(std::move(inst)); + EXPECT_EQ(&*new_element, inserted_instructions.back()); + } + + std::vector output; + for (auto& i : list) { + output.push_back(&i); + } + EXPECT_THAT(output, ContainerEq(inserted_instructions)); +} + +// Test inserting an entire vector of instructions using InsertBefore. Checking +// the order of insertion and the return value. +// +// Comparing addresses to make sure they remain stable, so other data structures +// can have pointers to instructions in InstructionList. +TEST(InstructionListTest, InsertBefore2) { + InstructionList list; + std::vector> new_instructions; + std::vector created_instructions; + for (int i = 0; i < 4; i++) { + std::unique_ptr inst(new Instruction()); + created_instructions.push_back(inst.get()); + new_instructions.push_back(std::move(inst)); + } + auto new_element = list.begin().InsertBefore(std::move(new_instructions)); + EXPECT_TRUE(new_instructions.empty()); + EXPECT_EQ(&*new_element, created_instructions.front()); + + std::vector output; + for (auto& i : list) { + output.push_back(&i); + } + EXPECT_THAT(output, ContainerEq(created_instructions)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/instruction_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/instruction_test.cpp new file mode 100644 index 00000000000..2ace6b8acb6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/instruction_test.cpp @@ -0,0 +1,1106 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_context.h" +#include "spirv-tools/libspirv.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace opt { +namespace { + +using spvtest::MakeInstruction; +using ::testing::Eq; +using DescriptorTypeTest = PassTest<::testing::Test>; +using OpaqueTypeTest = PassTest<::testing::Test>; +using GetBaseTest = PassTest<::testing::Test>; +using ValidBasePointerTest = PassTest<::testing::Test>; + +TEST(InstructionTest, CreateTrivial) { + Instruction empty; + EXPECT_EQ(SpvOpNop, empty.opcode()); + EXPECT_EQ(0u, empty.type_id()); + EXPECT_EQ(0u, empty.result_id()); + EXPECT_EQ(0u, empty.NumOperands()); + EXPECT_EQ(0u, empty.NumOperandWords()); + EXPECT_EQ(0u, empty.NumInOperandWords()); + EXPECT_EQ(empty.cend(), empty.cbegin()); + EXPECT_EQ(empty.end(), empty.begin()); +} + +TEST(InstructionTest, CreateWithOpcodeAndNoOperands) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, SpvOpReturn); + EXPECT_EQ(SpvOpReturn, inst.opcode()); + EXPECT_EQ(0u, inst.type_id()); + EXPECT_EQ(0u, inst.result_id()); + EXPECT_EQ(0u, inst.NumOperands()); + EXPECT_EQ(0u, inst.NumOperandWords()); + EXPECT_EQ(0u, inst.NumInOperandWords()); + EXPECT_EQ(inst.cend(), inst.cbegin()); + EXPECT_EQ(inst.end(), inst.begin()); +} + +// The words for an OpTypeInt for 32-bit signed integer resulting in Id 44. +uint32_t kSampleInstructionWords[] = {(4 << 16) | uint32_t(SpvOpTypeInt), 44, + 32, 1}; +// The operands that would be parsed from kSampleInstructionWords +spv_parsed_operand_t kSampleParsedOperands[] = { + {1, 1, SPV_OPERAND_TYPE_RESULT_ID, SPV_NUMBER_NONE, 0}, + {2, 1, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_NUMBER_UNSIGNED_INT, 32}, + {3, 1, SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_NUMBER_UNSIGNED_INT, 1}, +}; + +// A valid parse of kSampleParsedOperands. +spv_parsed_instruction_t kSampleParsedInstruction = {kSampleInstructionWords, + uint16_t(4), + uint16_t(SpvOpTypeInt), + SPV_EXT_INST_TYPE_NONE, + 0, // type id + 44, // result id + kSampleParsedOperands, + 3}; + +// The words for an OpAccessChain instruction. +uint32_t kSampleAccessChainInstructionWords[] = { + (7 << 16) | uint32_t(SpvOpAccessChain), 100, 101, 102, 103, 104, 105}; + +// The operands that would be parsed from kSampleAccessChainInstructionWords. +spv_parsed_operand_t kSampleAccessChainOperands[] = { + {1, 1, SPV_OPERAND_TYPE_RESULT_ID, SPV_NUMBER_NONE, 0}, + {2, 1, SPV_OPERAND_TYPE_TYPE_ID, SPV_NUMBER_NONE, 0}, + {3, 1, SPV_OPERAND_TYPE_ID, SPV_NUMBER_NONE, 0}, + {4, 1, SPV_OPERAND_TYPE_ID, SPV_NUMBER_NONE, 0}, + {5, 1, SPV_OPERAND_TYPE_ID, SPV_NUMBER_NONE, 0}, + {6, 1, SPV_OPERAND_TYPE_ID, SPV_NUMBER_NONE, 0}, +}; + +// A valid parse of kSampleAccessChainInstructionWords +spv_parsed_instruction_t kSampleAccessChainInstruction = { + kSampleAccessChainInstructionWords, + uint16_t(7), + uint16_t(SpvOpAccessChain), + SPV_EXT_INST_TYPE_NONE, + 100, // type id + 101, // result id + kSampleAccessChainOperands, + 6}; + +// The words for an OpControlBarrier instruction. +uint32_t kSampleControlBarrierInstructionWords[] = { + (4 << 16) | uint32_t(SpvOpControlBarrier), 100, 101, 102}; + +// The operands that would be parsed from kSampleControlBarrierInstructionWords. +spv_parsed_operand_t kSampleControlBarrierOperands[] = { + {1, 1, SPV_OPERAND_TYPE_SCOPE_ID, SPV_NUMBER_NONE, 0}, // Execution + {2, 1, SPV_OPERAND_TYPE_SCOPE_ID, SPV_NUMBER_NONE, 0}, // Memory + {3, 1, SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, SPV_NUMBER_NONE, + 0}, // Semantics +}; + +// A valid parse of kSampleControlBarrierInstructionWords +spv_parsed_instruction_t kSampleControlBarrierInstruction = { + kSampleControlBarrierInstructionWords, + uint16_t(4), + uint16_t(SpvOpControlBarrier), + SPV_EXT_INST_TYPE_NONE, + 0, // type id + 0, // result id + kSampleControlBarrierOperands, + 3}; + +TEST(InstructionTest, CreateWithOpcodeAndOperands) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleParsedInstruction); + EXPECT_EQ(SpvOpTypeInt, inst.opcode()); + EXPECT_EQ(0u, inst.type_id()); + EXPECT_EQ(44u, inst.result_id()); + EXPECT_EQ(3u, inst.NumOperands()); + EXPECT_EQ(3u, inst.NumOperandWords()); + EXPECT_EQ(2u, inst.NumInOperandWords()); +} + +TEST(InstructionTest, GetOperand) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleParsedInstruction); + EXPECT_THAT(inst.GetOperand(0).words, Eq(std::vector{44})); + EXPECT_THAT(inst.GetOperand(1).words, Eq(std::vector{32})); + EXPECT_THAT(inst.GetOperand(2).words, Eq(std::vector{1})); +} + +TEST(InstructionTest, GetInOperand) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleParsedInstruction); + EXPECT_THAT(inst.GetInOperand(0).words, Eq(std::vector{32})); + EXPECT_THAT(inst.GetInOperand(1).words, Eq(std::vector{1})); +} + +TEST(InstructionTest, OperandConstIterators) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleParsedInstruction); + // Spot check iteration across operands. + auto cbegin = inst.cbegin(); + auto cend = inst.cend(); + EXPECT_NE(cend, inst.cbegin()); + + auto citer = inst.cbegin(); + for (int i = 0; i < 3; ++i, ++citer) { + const auto& operand = *citer; + EXPECT_THAT(operand.type, Eq(kSampleParsedOperands[i].type)); + EXPECT_THAT(operand.words, + Eq(std::vector{kSampleInstructionWords[i + 1]})); + EXPECT_NE(cend, citer); + } + EXPECT_EQ(cend, citer); + + // Check that cbegin and cend have not changed. + EXPECT_EQ(cbegin, inst.cbegin()); + EXPECT_EQ(cend, inst.cend()); + + // Check arithmetic. + const Operand& operand2 = *(inst.cbegin() + 2); + EXPECT_EQ(SPV_OPERAND_TYPE_LITERAL_INTEGER, operand2.type); +} + +TEST(InstructionTest, OperandIterators) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleParsedInstruction); + // Spot check iteration across operands, with mutable iterators. + auto begin = inst.begin(); + auto end = inst.end(); + EXPECT_NE(end, inst.begin()); + + auto iter = inst.begin(); + for (int i = 0; i < 3; ++i, ++iter) { + const auto& operand = *iter; + EXPECT_THAT(operand.type, Eq(kSampleParsedOperands[i].type)); + EXPECT_THAT(operand.words, + Eq(std::vector{kSampleInstructionWords[i + 1]})); + EXPECT_NE(end, iter); + } + EXPECT_EQ(end, iter); + + // Check that begin and end have not changed. + EXPECT_EQ(begin, inst.begin()); + EXPECT_EQ(end, inst.end()); + + // Check arithmetic. + Operand& operand2 = *(inst.begin() + 2); + EXPECT_EQ(SPV_OPERAND_TYPE_LITERAL_INTEGER, operand2.type); + + // Check mutation through an iterator. + operand2.type = SPV_OPERAND_TYPE_TYPE_ID; + EXPECT_EQ(SPV_OPERAND_TYPE_TYPE_ID, (*(inst.cbegin() + 2)).type); +} + +TEST(InstructionTest, ForInIdStandardIdTypes) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleAccessChainInstruction); + + std::vector ids; + inst.ForEachInId([&ids](const uint32_t* idptr) { ids.push_back(*idptr); }); + EXPECT_THAT(ids, Eq(std::vector{102, 103, 104, 105})); + + ids.clear(); + inst.ForEachInId([&ids](uint32_t* idptr) { ids.push_back(*idptr); }); + EXPECT_THAT(ids, Eq(std::vector{102, 103, 104, 105})); +} + +TEST(InstructionTest, ForInIdNonstandardIdTypes) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context, kSampleControlBarrierInstruction); + + std::vector ids; + inst.ForEachInId([&ids](const uint32_t* idptr) { ids.push_back(*idptr); }); + EXPECT_THAT(ids, Eq(std::vector{100, 101, 102})); + + ids.clear(); + inst.ForEachInId([&ids](uint32_t* idptr) { ids.push_back(*idptr); }); + EXPECT_THAT(ids, Eq(std::vector{100, 101, 102})); +} + +TEST(InstructionTest, UniqueIds) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst1(&context); + Instruction inst2(&context); + EXPECT_NE(inst1.unique_id(), inst2.unique_id()); +} + +TEST(InstructionTest, CloneUniqueIdDifferent) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&context); + std::unique_ptr clone(inst.Clone(&context)); + EXPECT_EQ(inst.context(), clone->context()); + EXPECT_NE(inst.unique_id(), clone->unique_id()); +} + +TEST(InstructionTest, CloneDifferentContext) { + IRContext c1(SPV_ENV_UNIVERSAL_1_2, nullptr); + IRContext c2(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&c1); + std::unique_ptr clone(inst.Clone(&c2)); + EXPECT_EQ(&c1, inst.context()); + EXPECT_EQ(&c2, clone->context()); + EXPECT_NE(&c1, &c2); +} + +TEST(InstructionTest, CloneDifferentContextDifferentUniqueId) { + IRContext c1(SPV_ENV_UNIVERSAL_1_2, nullptr); + IRContext c2(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction inst(&c1); + Instruction other(&c2); + std::unique_ptr clone(inst.Clone(&c2)); + EXPECT_EQ(&c2, clone->context()); + EXPECT_NE(other.unique_id(), clone->unique_id()); +} + +TEST(InstructionTest, EqualsEqualsOperator) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction i1(&context); + Instruction i2(&context); + std::unique_ptr clone(i1.Clone(&context)); + EXPECT_TRUE(i1 == i1); + EXPECT_FALSE(i1 == i2); + EXPECT_FALSE(i1 == *clone); + EXPECT_FALSE(i2 == *clone); +} + +TEST(InstructionTest, LessThanOperator) { + IRContext context(SPV_ENV_UNIVERSAL_1_2, nullptr); + Instruction i1(&context); + Instruction i2(&context); + std::unique_ptr clone(i1.Clone(&context)); + EXPECT_TRUE(i1 < i2); + EXPECT_TRUE(i1 < *clone); + EXPECT_TRUE(i2 < *clone); +} + +TEST_F(DescriptorTypeTest, StorageImage) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeImage %6 2D 0 0 0 2 R32f + %8 = OpTypePointer UniformConstant %7 + %3 = OpVariable %8 UniformConstant + %2 = OpFunction %4 None %5 + %9 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* type = context->get_def_use_mgr()->GetDef(8); + EXPECT_TRUE(type->IsVulkanStorageImage()); + EXPECT_FALSE(type->IsVulkanSampledImage()); + EXPECT_FALSE(type->IsVulkanStorageTexelBuffer()); + EXPECT_FALSE(type->IsVulkanStorageBuffer()); + EXPECT_FALSE(type->IsVulkanUniformBuffer()); + + Instruction* variable = context->get_def_use_mgr()->GetDef(3); + EXPECT_FALSE(variable->IsReadOnlyVariable()); +} + +TEST_F(DescriptorTypeTest, SampledImage) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeImage %6 2D 0 0 0 1 Unknown + %8 = OpTypePointer UniformConstant %7 + %3 = OpVariable %8 UniformConstant + %2 = OpFunction %4 None %5 + %9 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* type = context->get_def_use_mgr()->GetDef(8); + EXPECT_FALSE(type->IsVulkanStorageImage()); + EXPECT_TRUE(type->IsVulkanSampledImage()); + EXPECT_FALSE(type->IsVulkanStorageTexelBuffer()); + EXPECT_FALSE(type->IsVulkanStorageBuffer()); + EXPECT_FALSE(type->IsVulkanUniformBuffer()); + + Instruction* variable = context->get_def_use_mgr()->GetDef(3); + EXPECT_TRUE(variable->IsReadOnlyVariable()); +} + +TEST_F(DescriptorTypeTest, StorageTexelBuffer) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeImage %6 Buffer 0 0 0 2 R32f + %8 = OpTypePointer UniformConstant %7 + %3 = OpVariable %8 UniformConstant + %2 = OpFunction %4 None %5 + %9 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* type = context->get_def_use_mgr()->GetDef(8); + EXPECT_FALSE(type->IsVulkanStorageImage()); + EXPECT_FALSE(type->IsVulkanSampledImage()); + EXPECT_TRUE(type->IsVulkanStorageTexelBuffer()); + EXPECT_FALSE(type->IsVulkanStorageBuffer()); + EXPECT_FALSE(type->IsVulkanUniformBuffer()); + + Instruction* variable = context->get_def_use_mgr()->GetDef(3); + EXPECT_FALSE(variable->IsReadOnlyVariable()); +} + +TEST_F(DescriptorTypeTest, StorageBuffer) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %9 BufferBlock + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeRuntimeArray %7 + %9 = OpTypeStruct %8 + %10 = OpTypePointer Uniform %9 + %3 = OpVariable %10 Uniform + %2 = OpFunction %4 None %5 + %11 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* type = context->get_def_use_mgr()->GetDef(10); + EXPECT_FALSE(type->IsVulkanStorageImage()); + EXPECT_FALSE(type->IsVulkanSampledImage()); + EXPECT_FALSE(type->IsVulkanStorageTexelBuffer()); + EXPECT_TRUE(type->IsVulkanStorageBuffer()); + EXPECT_FALSE(type->IsVulkanUniformBuffer()); + + Instruction* variable = context->get_def_use_mgr()->GetDef(3); + EXPECT_FALSE(variable->IsReadOnlyVariable()); +} + +TEST_F(DescriptorTypeTest, UniformBuffer) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %9 Block + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeRuntimeArray %7 + %9 = OpTypeStruct %8 + %10 = OpTypePointer Uniform %9 + %3 = OpVariable %10 Uniform + %2 = OpFunction %4 None %5 + %11 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* type = context->get_def_use_mgr()->GetDef(10); + EXPECT_FALSE(type->IsVulkanStorageImage()); + EXPECT_FALSE(type->IsVulkanSampledImage()); + EXPECT_FALSE(type->IsVulkanStorageTexelBuffer()); + EXPECT_FALSE(type->IsVulkanStorageBuffer()); + EXPECT_TRUE(type->IsVulkanUniformBuffer()); + + Instruction* variable = context->get_def_use_mgr()->GetDef(3); + EXPECT_TRUE(variable->IsReadOnlyVariable()); +} + +TEST_F(DescriptorTypeTest, NonWritableIsReadOnly) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + OpDecorate %9 BufferBlock + OpDecorate %3 NonWritable + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypeRuntimeArray %7 + %9 = OpTypeStruct %8 + %10 = OpTypePointer Uniform %9 + %3 = OpVariable %10 Uniform + %2 = OpFunction %4 None %5 + %11 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* variable = context->get_def_use_mgr()->GetDef(3); + EXPECT_TRUE(variable->IsReadOnlyVariable()); +} + +TEST_F(OpaqueTypeTest, BaseOpaqueTypesShader) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypeImage %5 2D 1 0 0 1 Unknown + %7 = OpTypeSampler + %8 = OpTypeSampledImage %6 + %9 = OpTypeRuntimeArray %5 + %2 = OpFunction %3 None %4 + %10 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* image_type = context->get_def_use_mgr()->GetDef(6); + EXPECT_TRUE(image_type->IsOpaqueType()); + Instruction* sampler_type = context->get_def_use_mgr()->GetDef(7); + EXPECT_TRUE(sampler_type->IsOpaqueType()); + Instruction* sampled_image_type = context->get_def_use_mgr()->GetDef(8); + EXPECT_TRUE(sampled_image_type->IsOpaqueType()); + Instruction* runtime_array_type = context->get_def_use_mgr()->GetDef(9); + EXPECT_TRUE(runtime_array_type->IsOpaqueType()); + Instruction* float_type = context->get_def_use_mgr()->GetDef(5); + EXPECT_FALSE(float_type->IsOpaqueType()); + Instruction* void_type = context->get_def_use_mgr()->GetDef(3); + EXPECT_FALSE(void_type->IsOpaqueType()); +} + +TEST_F(OpaqueTypeTest, OpaqueStructTypes) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypeRuntimeArray %5 + %7 = OpTypeStruct %6 %6 + %8 = OpTypeStruct %5 %6 + %9 = OpTypeStruct %6 %5 + %10 = OpTypeStruct %7 + %2 = OpFunction %3 None %4 + %11 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + for (int i = 7; i <= 10; i++) { + Instruction* type = context->get_def_use_mgr()->GetDef(i); + EXPECT_TRUE(type->IsOpaqueType()); + } +} + +TEST_F(GetBaseTest, SampleImage) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 2 + %8 = OpTypeVector %6 4 + %9 = OpConstant %6 0 + %10 = OpConstantComposite %7 %9 %9 + %11 = OpTypeImage %6 2D 0 0 0 1 R32f + %12 = OpTypePointer UniformConstant %11 + %3 = OpVariable %12 UniformConstant + %13 = OpTypeSampledImage %11 + %14 = OpTypeSampler + %15 = OpTypePointer UniformConstant %14 + %16 = OpVariable %15 UniformConstant + %2 = OpFunction %4 None %5 + %17 = OpLabel + %18 = OpLoad %11 %3 + %19 = OpLoad %14 %16 + %20 = OpSampledImage %13 %18 %19 + %21 = OpImageSampleImplicitLod %8 %20 %10 + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* load = context->get_def_use_mgr()->GetDef(21); + Instruction* base = context->get_def_use_mgr()->GetDef(20); + EXPECT_TRUE(load->GetBaseAddress() == base); +} + +TEST_F(GetBaseTest, ImageRead) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "myStorageImage" + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeInt 32 0 + %7 = OpTypeVector %6 2 + %8 = OpConstant %6 0 + %9 = OpConstantComposite %7 %8 %8 + %10 = OpTypeImage %6 2D 0 0 0 2 R32f + %11 = OpTypePointer UniformConstant %10 + %3 = OpVariable %11 UniformConstant + %2 = OpFunction %4 None %5 + %12 = OpLabel + %13 = OpLoad %10 %3 + %14 = OpImageRead %6 %13 %9 + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + Instruction* load = context->get_def_use_mgr()->GetDef(14); + Instruction* base = context->get_def_use_mgr()->GetDef(13); + EXPECT_TRUE(load->GetBaseAddress() == base); +} + +TEST_F(ValidBasePointerTest, OpSelectBadNoVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpVariable %4 StorageBuffer +%6 = OpTypeFunction %2 +%7 = OpTypeBool +%8 = OpConstantTrue %7 +%1 = OpFunction %2 None %6 +%9 = OpLabel +%10 = OpSelect %4 %8 %5 %5 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* select = context->get_def_use_mgr()->GetDef(10); + EXPECT_NE(select, nullptr); + EXPECT_FALSE(select->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpSelectBadNoVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpVariable %4 Workgroup +%6 = OpTypeFunction %2 +%7 = OpTypeBool +%8 = OpConstantTrue %7 +%1 = OpFunction %2 None %6 +%9 = OpLabel +%10 = OpSelect %4 %8 %5 %5 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* select = context->get_def_use_mgr()->GetDef(10); + EXPECT_NE(select, nullptr); + EXPECT_FALSE(select->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpSelectGoodVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpVariable %4 StorageBuffer +%6 = OpTypeFunction %2 +%7 = OpTypeBool +%8 = OpConstantTrue %7 +%1 = OpFunction %2 None %6 +%9 = OpLabel +%10 = OpSelect %4 %8 %5 %5 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* select = context->get_def_use_mgr()->GetDef(10); + EXPECT_NE(select, nullptr); + EXPECT_TRUE(select->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpSelectGoodVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpVariable %4 Workgroup +%6 = OpTypeFunction %2 +%7 = OpTypeBool +%8 = OpConstantTrue %7 +%1 = OpFunction %2 None %6 +%9 = OpLabel +%10 = OpSelect %4 %8 %5 %5 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* select = context->get_def_use_mgr()->GetDef(10); + EXPECT_NE(select, nullptr); + EXPECT_TRUE(select->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpConstantNullBadNoVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(5); + EXPECT_NE(null_inst, nullptr); + EXPECT_FALSE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpConstantNullBadNoVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(5); + EXPECT_NE(null_inst, nullptr); + EXPECT_FALSE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpConstantNullGoodVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(5); + EXPECT_NE(null_inst, nullptr); + EXPECT_TRUE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpConstantNullGoodVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(5); + EXPECT_NE(null_inst, nullptr); + EXPECT_TRUE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpPhiBadNoVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpVariable %4 StorageBuffer +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %4 %5 %7 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* phi = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(phi, nullptr); + EXPECT_FALSE(phi->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpPhiBadNoVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpVariable %4 Workgroup +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %4 %5 %7 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* phi = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(phi, nullptr); + EXPECT_FALSE(phi->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpPhiGoodVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpVariable %4 StorageBuffer +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %4 %5 %7 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* phi = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(phi, nullptr); + EXPECT_TRUE(phi->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpPhiGoodVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpVariable %4 Workgroup +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %4 %5 %7 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* phi = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(phi, nullptr); + EXPECT_TRUE(phi->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpFunctionCallBadNoVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%7 = OpTypeFunction %4 +%1 = OpFunction %2 None %6 +%8 = OpLabel +%9 = OpFunctionCall %4 %10 +OpReturn +OpFunctionEnd +%10 = OpFunction %4 None %7 +%11 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(null_inst, nullptr); + EXPECT_FALSE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpFunctionCallBadNoVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%7 = OpTypeFunction %4 +%1 = OpFunction %2 None %6 +%8 = OpLabel +%9 = OpFunctionCall %4 %10 +OpReturn +OpFunctionEnd +%10 = OpFunction %4 None %7 +%11 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(null_inst, nullptr); + EXPECT_FALSE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpFunctionCallGoodVariablePointersStorageBuffer) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointersStorageBuffer +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer StorageBuffer %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%7 = OpTypeFunction %4 +%1 = OpFunction %2 None %6 +%8 = OpLabel +%9 = OpFunctionCall %4 %10 +OpReturn +OpFunctionEnd +%10 = OpFunction %4 None %7 +%11 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(null_inst, nullptr); + EXPECT_TRUE(null_inst->IsValidBasePointer()); +} + +TEST_F(ValidBasePointerTest, OpFunctionCallGoodVariablePointers) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Workgroup %3 +%5 = OpConstantNull %4 +%6 = OpTypeFunction %2 +%7 = OpTypeFunction %4 +%1 = OpFunction %2 None %6 +%8 = OpLabel +%9 = OpFunctionCall %4 %10 +OpReturn +OpFunctionEnd +%10 = OpFunction %4 None %7 +%11 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_3, nullptr, text); + EXPECT_NE(context, nullptr); + Instruction* null_inst = context->get_def_use_mgr()->GetDef(9); + EXPECT_NE(null_inst, nullptr); + EXPECT_TRUE(null_inst->IsValidBasePointer()); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_builder.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_builder.cpp new file mode 100644 index 00000000000..7eeb86dd331 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_builder.cpp @@ -0,0 +1,416 @@ +// Copyright (c) 2018 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/basic_block.h" +#include "source/opt/build_module.h" +#include "source/opt/instruction.h" +#include "source/opt/ir_builder.h" +#include "source/opt/type_manager.h" +#include "spirv-tools/libspirv.hpp" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +#ifdef SPIRV_EFFCEE + +using Analysis = IRContext::Analysis; +using IRBuilderTest = ::testing::Test; + +bool Validate(const std::vector& bin) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {bin.data(), bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + return error == 0; +} + +void Match(const std::string& original, IRContext* context, + bool do_validation = true) { + std::vector bin; + context->module()->ToBinary(&bin, true); + if (do_validation) { + EXPECT_TRUE(Validate(bin)); + } + std::string assembly; + SpirvTools tools(SPV_ENV_UNIVERSAL_1_2); + EXPECT_TRUE( + tools.Disassemble(bin, &assembly, SpirvTools::kDefaultDisassembleOption)) + << "Disassembling failed for shader:\n" + << assembly << std::endl; + auto match_result = effcee::Match(assembly, original); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << assembly; +} + +TEST_F(IRBuilderTest, TestInsnAddition) { + const std::string text = R"( +; CHECK: %18 = OpLabel +; CHECK: OpPhi %int %int_0 %14 +; CHECK: OpPhi %bool %16 %14 +; CHECK: OpBranch %17 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + OpName %3 "c" + OpDecorate %3 Location 0 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %10 = OpTypeBool + %11 = OpTypeFloat 32 + %12 = OpTypeVector %11 4 + %13 = OpTypePointer Output %12 + %3 = OpVariable %13 Output + %2 = OpFunction %5 None %6 + %14 = OpLabel + %4 = OpVariable %8 Function + OpStore %4 %9 + %15 = OpLoad %7 %4 + %16 = OpINotEqual %10 %15 %9 + OpSelectionMerge %17 None + OpBranchConditional %16 %18 %17 + %18 = OpLabel + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd +)"; + + { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + + BasicBlock* bb = context->cfg()->block(18); + + // Build managers. + context->get_def_use_mgr(); + context->get_instr_block(nullptr); + + InstructionBuilder builder(context.get(), &*bb->begin()); + Instruction* phi1 = builder.AddPhi(7, {9, 14}); + Instruction* phi2 = builder.AddPhi(10, {16, 14}); + + // Make sure the InstructionBuilder did not update the def/use manager. + EXPECT_EQ(context->get_def_use_mgr()->GetDef(phi1->result_id()), nullptr); + EXPECT_EQ(context->get_def_use_mgr()->GetDef(phi2->result_id()), nullptr); + EXPECT_EQ(context->get_instr_block(phi1), nullptr); + EXPECT_EQ(context->get_instr_block(phi2), nullptr); + + Match(text, context.get()); + } + + { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + + // Build managers. + context->get_def_use_mgr(); + context->get_instr_block(nullptr); + + BasicBlock* bb = context->cfg()->block(18); + InstructionBuilder builder( + context.get(), &*bb->begin(), + IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping); + Instruction* phi1 = builder.AddPhi(7, {9, 14}); + Instruction* phi2 = builder.AddPhi(10, {16, 14}); + + // Make sure InstructionBuilder updated the def/use manager + EXPECT_NE(context->get_def_use_mgr()->GetDef(phi1->result_id()), nullptr); + EXPECT_NE(context->get_def_use_mgr()->GetDef(phi2->result_id()), nullptr); + EXPECT_NE(context->get_instr_block(phi1), nullptr); + EXPECT_NE(context->get_instr_block(phi2), nullptr); + + Match(text, context.get()); + } +} + +TEST_F(IRBuilderTest, TestCondBranchAddition) { + const std::string text = R"( +; CHECK: %main = OpFunction %void None %6 +; CHECK-NEXT: %15 = OpLabel +; CHECK-NEXT: OpSelectionMerge %13 None +; CHECK-NEXT: OpBranchConditional %true %14 %13 +; CHECK-NEXT: %14 = OpLabel +; CHECK-NEXT: OpBranch %13 +; CHECK-NEXT: %13 = OpLabel +; CHECK-NEXT: OpReturn + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + OpName %3 "c" + OpDecorate %3 Location 0 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeBool + %8 = OpTypePointer Function %7 + %9 = OpConstantTrue %7 + %10 = OpTypeFloat 32 + %11 = OpTypeVector %10 4 + %12 = OpTypePointer Output %11 + %3 = OpVariable %12 Output + %4 = OpVariable %8 Private + %2 = OpFunction %5 None %6 + %13 = OpLabel + OpReturn + OpFunctionEnd +)"; + + { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + + Function& fn = *context->module()->begin(); + + BasicBlock& bb_merge = *fn.begin(); + + fn.begin().InsertBefore(std::unique_ptr( + new BasicBlock(std::unique_ptr(new Instruction( + context.get(), SpvOpLabel, 0, context->TakeNextId(), {}))))); + BasicBlock& bb_true = *fn.begin(); + { + InstructionBuilder builder(context.get(), &*bb_true.begin()); + builder.AddBranch(bb_merge.id()); + } + + fn.begin().InsertBefore(std::unique_ptr( + new BasicBlock(std::unique_ptr(new Instruction( + context.get(), SpvOpLabel, 0, context->TakeNextId(), {}))))); + BasicBlock& bb_cond = *fn.begin(); + + InstructionBuilder builder(context.get(), &bb_cond); + // This also test consecutive instruction insertion: merge selection + + // branch. + builder.AddConditionalBranch(9, bb_true.id(), bb_merge.id(), bb_merge.id()); + + Match(text, context.get()); + } +} + +TEST_F(IRBuilderTest, AddSelect) { + const std::string text = R"( +; CHECK: [[bool:%\w+]] = OpTypeBool +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[true:%\w+]] = OpConstantTrue [[bool]] +; CHECK: [[u0:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[u1:%\w+]] = OpConstant [[uint]] 1 +; CHECK: OpSelect [[uint]] [[true]] [[u0]] [[u1]] +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +%1 = OpTypeVoid +%2 = OpTypeBool +%3 = OpTypeInt 32 0 +%4 = OpConstantTrue %2 +%5 = OpConstant %3 0 +%6 = OpConstant %3 1 +%7 = OpTypeFunction %1 +%8 = OpFunction %1 None %7 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(nullptr, context); + + InstructionBuilder builder(context.get(), + &*context->module()->begin()->begin()->begin()); + EXPECT_NE(nullptr, builder.AddSelect(3u, 4u, 5u, 6u)); + + Match(text, context.get()); +} + +TEST_F(IRBuilderTest, AddCompositeConstruct) { + const std::string text = R"( +; CHECK: [[uint:%\w+]] = OpTypeInt +; CHECK: [[u0:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[u1:%\w+]] = OpConstant [[uint]] 1 +; CHECK: [[struct:%\w+]] = OpTypeStruct [[uint]] [[uint]] [[uint]] [[uint]] +; CHECK: OpCompositeConstruct [[struct]] [[u0]] [[u1]] [[u1]] [[u0]] +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpConstant %2 1 +%5 = OpTypeStruct %2 %2 %2 %2 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(nullptr, context); + + InstructionBuilder builder(context.get(), + &*context->module()->begin()->begin()->begin()); + std::vector ids = {3u, 4u, 4u, 3u}; + EXPECT_NE(nullptr, builder.AddCompositeConstruct(5u, ids)); + + Match(text, context.get()); +} + +TEST_F(IRBuilderTest, ConstantAdder) { + const std::string text = R"( +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: OpConstant [[uint]] 13 +; CHECK: [[sint:%\w+]] = OpTypeInt 32 1 +; CHECK: OpConstant [[sint]] -1 +; CHECK: OpConstant [[uint]] 1 +; CHECK: OpConstant [[sint]] 34 +; CHECK: OpConstant [[uint]] 0 +; CHECK: OpConstant [[sint]] 0 +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(nullptr, context); + + InstructionBuilder builder(context.get(), + &*context->module()->begin()->begin()->begin()); + EXPECT_NE(nullptr, builder.Add32BitUnsignedIntegerConstant(13)); + EXPECT_NE(nullptr, builder.Add32BitSignedIntegerConstant(-1)); + + // Try adding the same constants again to make sure they aren't added. + EXPECT_NE(nullptr, builder.Add32BitUnsignedIntegerConstant(13)); + EXPECT_NE(nullptr, builder.Add32BitSignedIntegerConstant(-1)); + + // Try adding different constants to make sure the type is reused. + EXPECT_NE(nullptr, builder.Add32BitUnsignedIntegerConstant(1)); + EXPECT_NE(nullptr, builder.Add32BitSignedIntegerConstant(34)); + + // Try adding 0 as both signed and unsigned. + EXPECT_NE(nullptr, builder.Add32BitUnsignedIntegerConstant(0)); + EXPECT_NE(nullptr, builder.Add32BitSignedIntegerConstant(0)); + + Match(text, context.get()); +} + +TEST_F(IRBuilderTest, ConstantAdderTypeAlreadyExists) { + const std::string text = R"( +; CHECK: OpConstant %uint 13 +; CHECK: OpConstant %int -1 +; CHECK: OpConstant %uint 1 +; CHECK: OpConstant %int 34 +; CHECK: OpConstant %uint 0 +; CHECK: OpConstant %int 0 +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%4 = OpTypeFunction %1 +%5 = OpFunction %1 None %4 +%6 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(nullptr, context); + + InstructionBuilder builder(context.get(), + &*context->module()->begin()->begin()->begin()); + Instruction* const_1 = builder.Add32BitUnsignedIntegerConstant(13); + Instruction* const_2 = builder.Add32BitSignedIntegerConstant(-1); + + EXPECT_NE(nullptr, const_1); + EXPECT_NE(nullptr, const_2); + + // Try adding the same constants again to make sure they aren't added. + EXPECT_EQ(const_1, builder.Add32BitUnsignedIntegerConstant(13)); + EXPECT_EQ(const_2, builder.Add32BitSignedIntegerConstant(-1)); + + Instruction* const_3 = builder.Add32BitUnsignedIntegerConstant(1); + Instruction* const_4 = builder.Add32BitSignedIntegerConstant(34); + + // Try adding different constants to make sure the type is reused. + EXPECT_NE(nullptr, const_3); + EXPECT_NE(nullptr, const_4); + + Instruction* const_5 = builder.Add32BitUnsignedIntegerConstant(0); + Instruction* const_6 = builder.Add32BitSignedIntegerConstant(0); + + // Try adding 0 as both signed and unsigned. + EXPECT_NE(nullptr, const_5); + EXPECT_NE(nullptr, const_6); + + // They have the same value but different types so should be unique. + EXPECT_NE(const_5, const_6); + + // Check the types are correct. + uint32_t type_id_unsigned = const_1->GetSingleWordOperand(0); + uint32_t type_id_signed = const_2->GetSingleWordOperand(0); + + EXPECT_NE(type_id_unsigned, type_id_signed); + + EXPECT_EQ(const_3->GetSingleWordOperand(0), type_id_unsigned); + EXPECT_EQ(const_5->GetSingleWordOperand(0), type_id_unsigned); + + EXPECT_EQ(const_4->GetSingleWordOperand(0), type_id_signed); + EXPECT_EQ(const_6->GetSingleWordOperand(0), type_id_signed); + + Match(text, context.get()); +} + +#endif // SPIRV_EFFCEE + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_context_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_context_test.cpp new file mode 100644 index 00000000000..c64e5b04ff4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_context_test.cpp @@ -0,0 +1,229 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using Analysis = IRContext::Analysis; +using ::testing::Each; + +class DummyPassPreservesNothing : public Pass { + public: + DummyPassPreservesNothing(Status s) : Pass(), status_to_return_(s) {} + + const char* name() const override { return "dummy-pass"; } + Status Process() override { return status_to_return_; } + + private: + Status status_to_return_; +}; + +class DummyPassPreservesAll : public Pass { + public: + DummyPassPreservesAll(Status s) : Pass(), status_to_return_(s) {} + + const char* name() const override { return "dummy-pass"; } + Status Process() override { return status_to_return_; } + + Analysis GetPreservedAnalyses() override { + return Analysis(IRContext::kAnalysisEnd - 1); + } + + private: + Status status_to_return_; +}; + +class DummyPassPreservesFirst : public Pass { + public: + DummyPassPreservesFirst(Status s) : Pass(), status_to_return_(s) {} + + const char* name() const override { return "dummy-pass"; } + Status Process() override { return status_to_return_; } + + Analysis GetPreservedAnalyses() override { return IRContext::kAnalysisBegin; } + + private: + Status status_to_return_; +}; + +using IRContextTest = PassTest<::testing::Test>; + +TEST_F(IRContextTest, IndividualValidAfterBuild) { + std::unique_ptr module(new Module()); + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, std::move(module), + spvtools::MessageConsumer()); + + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + localContext.BuildInvalidAnalyses(i); + EXPECT_TRUE(localContext.AreAnalysesValid(i)); + } +} + +TEST_F(IRContextTest, AllValidAfterBuild) { + std::unique_ptr module = MakeUnique(); + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, std::move(module), + spvtools::MessageConsumer()); + + Analysis built_analyses = IRContext::kAnalysisNone; + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + localContext.BuildInvalidAnalyses(i); + built_analyses |= i; + } + EXPECT_TRUE(localContext.AreAnalysesValid(built_analyses)); +} + +TEST_F(IRContextTest, AllValidAfterPassNoChange) { + std::unique_ptr module = MakeUnique(); + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, std::move(module), + spvtools::MessageConsumer()); + + Analysis built_analyses = IRContext::kAnalysisNone; + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + localContext.BuildInvalidAnalyses(i); + built_analyses |= i; + } + + DummyPassPreservesNothing pass(Pass::Status::SuccessWithoutChange); + Pass::Status s = pass.Run(&localContext); + EXPECT_EQ(s, Pass::Status::SuccessWithoutChange); + EXPECT_TRUE(localContext.AreAnalysesValid(built_analyses)); +} + +TEST_F(IRContextTest, NoneValidAfterPassWithChange) { + std::unique_ptr module = MakeUnique(); + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, std::move(module), + spvtools::MessageConsumer()); + + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + localContext.BuildInvalidAnalyses(i); + } + + DummyPassPreservesNothing pass(Pass::Status::SuccessWithChange); + Pass::Status s = pass.Run(&localContext); + EXPECT_EQ(s, Pass::Status::SuccessWithChange); + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + EXPECT_FALSE(localContext.AreAnalysesValid(i)); + } +} + +TEST_F(IRContextTest, AllPreservedAfterPassWithChange) { + std::unique_ptr module = MakeUnique(); + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, std::move(module), + spvtools::MessageConsumer()); + + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + localContext.BuildInvalidAnalyses(i); + } + + DummyPassPreservesAll pass(Pass::Status::SuccessWithChange); + Pass::Status s = pass.Run(&localContext); + EXPECT_EQ(s, Pass::Status::SuccessWithChange); + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + EXPECT_TRUE(localContext.AreAnalysesValid(i)); + } +} + +TEST_F(IRContextTest, PreserveFirstOnlyAfterPassWithChange) { + std::unique_ptr module = MakeUnique(); + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, std::move(module), + spvtools::MessageConsumer()); + + for (Analysis i = IRContext::kAnalysisBegin; i < IRContext::kAnalysisEnd; + i <<= 1) { + localContext.BuildInvalidAnalyses(i); + } + + DummyPassPreservesFirst pass(Pass::Status::SuccessWithChange); + Pass::Status s = pass.Run(&localContext); + EXPECT_EQ(s, Pass::Status::SuccessWithChange); + EXPECT_TRUE(localContext.AreAnalysesValid(IRContext::kAnalysisBegin)); + for (Analysis i = IRContext::kAnalysisBegin << 1; i < IRContext::kAnalysisEnd; + i <<= 1) { + EXPECT_FALSE(localContext.AreAnalysesValid(i)); + } +} + +TEST_F(IRContextTest, KillMemberName) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %3 "stuff" + OpMemberName %3 0 "refZ" + OpMemberDecorate %3 0 Offset 0 + OpDecorate %3 Block + %4 = OpTypeFloat 32 + %3 = OpTypeStruct %4 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %2 = OpFunction %5 None %6 + %7 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + + // Build the decoration manager. + context->get_decoration_mgr(); + + // Delete the OpTypeStruct. Should delete the OpName, OpMemberName, and + // OpMemberDecorate associated with it. + context->KillDef(3); + + // Make sure all of the name are removed. + for (auto& inst : context->debugs2()) { + EXPECT_EQ(inst.opcode(), SpvOpNop); + } + + // Make sure all of the decorations are removed. + for (auto& inst : context->annotations()) { + EXPECT_EQ(inst.opcode(), SpvOpNop); + } +} + +TEST_F(IRContextTest, TakeNextUniqueIdIncrementing) { + const uint32_t NUM_TESTS = 1000; + IRContext localContext(SPV_ENV_UNIVERSAL_1_2, nullptr); + for (uint32_t i = 1; i < NUM_TESTS; ++i) + EXPECT_EQ(i, localContext.TakeNextUniqueId()); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_loader_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_loader_test.cpp new file mode 100644 index 00000000000..ac5c52075cf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/ir_loader_test.cpp @@ -0,0 +1,451 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace opt { +namespace { + +void DoRoundTripCheck(const std::string& text) { + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + ASSERT_NE(nullptr, context) << "Failed to assemble\n" << text; + + std::vector binary; + context->module()->ToBinary(&binary, /* skip_nop = */ false); + + std::string disassembled_text; + EXPECT_TRUE(t.Disassemble(binary, &disassembled_text)); + EXPECT_EQ(text, disassembled_text); +} + +TEST(IrBuilder, RoundTrip) { + // #version 310 es + // int add(int a, int b) { return a + b; } + // void main() { add(1, 2); } + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "%1 = OpExtInstImport \"GLSL.std.450\"\n" + "OpMemoryModel Logical GLSL450\n" + "OpEntryPoint Vertex %main \"main\"\n" + "OpSource ESSL 310\n" + "OpSourceExtension \"GL_GOOGLE_cpp_style_line_directive\"\n" + "OpSourceExtension \"GL_GOOGLE_include_directive\"\n" + "OpName %main \"main\"\n" + "OpName %add_i1_i1_ \"add(i1;i1;\"\n" + "OpName %a \"a\"\n" + "OpName %b \"b\"\n" + "OpName %param \"param\"\n" + "OpName %param_0 \"param\"\n" + "%void = OpTypeVoid\n" + "%9 = OpTypeFunction %void\n" + "%int = OpTypeInt 32 1\n" + "%_ptr_Function_int = OpTypePointer Function %int\n" + "%12 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int\n" + "%int_1 = OpConstant %int 1\n" + "%int_2 = OpConstant %int 2\n" + "%main = OpFunction %void None %9\n" + "%15 = OpLabel\n" + "%param = OpVariable %_ptr_Function_int Function\n" + "%param_0 = OpVariable %_ptr_Function_int Function\n" + "OpStore %param %int_1\n" + "OpStore %param_0 %int_2\n" + "%16 = OpFunctionCall %int %add_i1_i1_ %param %param_0\n" + "OpReturn\n" + "OpFunctionEnd\n" + "%add_i1_i1_ = OpFunction %int None %12\n" + "%a = OpFunctionParameter %_ptr_Function_int\n" + "%b = OpFunctionParameter %_ptr_Function_int\n" + "%17 = OpLabel\n" + "%18 = OpLoad %int %a\n" + "%19 = OpLoad %int %b\n" + "%20 = OpIAdd %int %18 %19\n" + "OpReturnValue %20\n" + "OpFunctionEnd\n"); + // clang-format on +} + +TEST(IrBuilder, RoundTripIncompleteBasicBlock) { + DoRoundTripCheck( + "%2 = OpFunction %1 None %3\n" + "%4 = OpLabel\n" + "OpNop\n"); +} + +TEST(IrBuilder, RoundTripIncompleteFunction) { + DoRoundTripCheck("%2 = OpFunction %1 None %3\n"); +} + +TEST(IrBuilder, KeepLineDebugInfo) { + // #version 310 es + // void main() {} + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "%1 = OpExtInstImport \"GLSL.std.450\"\n" + "OpMemoryModel Logical GLSL450\n" + "OpEntryPoint Vertex %main \"main\"\n" + "%3 = OpString \"minimal.vert\"\n" + "OpSource ESSL 310\n" + "OpName %main \"main\"\n" + "OpLine %3 10 10\n" + "%void = OpTypeVoid\n" + "OpLine %3 100 100\n" + "%5 = OpTypeFunction %void\n" + "%main = OpFunction %void None %5\n" + "OpLine %3 1 1\n" + "OpNoLine\n" + "OpLine %3 2 2\n" + "OpLine %3 3 3\n" + "%6 = OpLabel\n" + "OpLine %3 4 4\n" + "OpNoLine\n" + "OpReturn\n" + "OpFunctionEnd\n"); + // clang-format on +} + +TEST(IrBuilder, LocalGlobalVariables) { + // #version 310 es + // + // float gv1 = 10.; + // float gv2 = 100.; + // + // float f() { + // float lv1 = gv1 + gv2; + // float lv2 = gv1 * gv2; + // return lv1 / lv2; + // } + // + // void main() { + // float lv1 = gv1 - gv2; + // } + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "%1 = OpExtInstImport \"GLSL.std.450\"\n" + "OpMemoryModel Logical GLSL450\n" + "OpEntryPoint Vertex %main \"main\"\n" + "OpSource ESSL 310\n" + "OpName %main \"main\"\n" + "OpName %f_ \"f(\"\n" + "OpName %gv1 \"gv1\"\n" + "OpName %gv2 \"gv2\"\n" + "OpName %lv1 \"lv1\"\n" + "OpName %lv2 \"lv2\"\n" + "OpName %lv1_0 \"lv1\"\n" + "%void = OpTypeVoid\n" + "%10 = OpTypeFunction %void\n" + "%float = OpTypeFloat 32\n" + "%12 = OpTypeFunction %float\n" + "%_ptr_Private_float = OpTypePointer Private %float\n" + "%gv1 = OpVariable %_ptr_Private_float Private\n" + "%float_10 = OpConstant %float 10\n" + "%gv2 = OpVariable %_ptr_Private_float Private\n" + "%float_100 = OpConstant %float 100\n" + "%_ptr_Function_float = OpTypePointer Function %float\n" + "%main = OpFunction %void None %10\n" + "%17 = OpLabel\n" + "%lv1_0 = OpVariable %_ptr_Function_float Function\n" + "OpStore %gv1 %float_10\n" + "OpStore %gv2 %float_100\n" + "%18 = OpLoad %float %gv1\n" + "%19 = OpLoad %float %gv2\n" + "%20 = OpFSub %float %18 %19\n" + "OpStore %lv1_0 %20\n" + "OpReturn\n" + "OpFunctionEnd\n" + "%f_ = OpFunction %float None %12\n" + "%21 = OpLabel\n" + "%lv1 = OpVariable %_ptr_Function_float Function\n" + "%lv2 = OpVariable %_ptr_Function_float Function\n" + "%22 = OpLoad %float %gv1\n" + "%23 = OpLoad %float %gv2\n" + "%24 = OpFAdd %float %22 %23\n" + "OpStore %lv1 %24\n" + "%25 = OpLoad %float %gv1\n" + "%26 = OpLoad %float %gv2\n" + "%27 = OpFMul %float %25 %26\n" + "OpStore %lv2 %27\n" + "%28 = OpLoad %float %lv1\n" + "%29 = OpLoad %float %lv2\n" + "%30 = OpFDiv %float %28 %29\n" + "OpReturnValue %30\n" + "OpFunctionEnd\n"); + // clang-format on +} + +TEST(IrBuilder, OpUndefOutsideFunction) { + // #version 310 es + // void main() {} + const std::string text = + // clang-format off + "OpMemoryModel Logical GLSL450\n" + "%int = OpTypeInt 32 1\n" + "%uint = OpTypeInt 32 0\n" + "%float = OpTypeFloat 32\n" + "%4 = OpUndef %int\n" + "%int_10 = OpConstant %int 10\n" + "%6 = OpUndef %uint\n" + "%bool = OpTypeBool\n" + "%8 = OpUndef %float\n" + "%double = OpTypeFloat 64\n"; + // clang-format on + + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + ASSERT_NE(nullptr, context); + + const auto opundef_count = std::count_if( + context->module()->types_values_begin(), + context->module()->types_values_end(), + [](const Instruction& inst) { return inst.opcode() == SpvOpUndef; }); + EXPECT_EQ(3, opundef_count); + + std::vector binary; + context->module()->ToBinary(&binary, /* skip_nop = */ false); + + std::string disassembled_text; + EXPECT_TRUE(t.Disassemble(binary, &disassembled_text)); + EXPECT_EQ(text, disassembled_text); +} + +TEST(IrBuilder, OpUndefInBasicBlock) { + DoRoundTripCheck( + // clang-format off + "OpMemoryModel Logical GLSL450\n" + "OpName %main \"main\"\n" + "%void = OpTypeVoid\n" + "%uint = OpTypeInt 32 0\n" + "%double = OpTypeFloat 64\n" + "%5 = OpTypeFunction %void\n" + "%main = OpFunction %void None %5\n" + "%6 = OpLabel\n" + "%7 = OpUndef %uint\n" + "%8 = OpUndef %double\n" + "OpReturn\n" + "OpFunctionEnd\n"); + // clang-format on +} + +TEST(IrBuilder, KeepLineDebugInfoBeforeType) { + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "OpMemoryModel Logical GLSL450\n" + "%1 = OpString \"minimal.vert\"\n" + "OpLine %1 1 1\n" + "OpNoLine\n" + "%void = OpTypeVoid\n" + "OpLine %1 2 2\n" + "%3 = OpTypeFunction %void\n"); + // clang-format on +} + +TEST(IrBuilder, KeepLineDebugInfoBeforeLabel) { + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "OpMemoryModel Logical GLSL450\n" + "%1 = OpString \"minimal.vert\"\n" + "%void = OpTypeVoid\n" + "%3 = OpTypeFunction %void\n" + "%4 = OpFunction %void None %3\n" + "%5 = OpLabel\n" + "OpBranch %6\n" + "OpLine %1 1 1\n" + "OpLine %1 2 2\n" + "%6 = OpLabel\n" + "OpBranch %7\n" + "OpLine %1 100 100\n" + "%7 = OpLabel\n" + "OpReturn\n" + "OpFunctionEnd\n"); + // clang-format on +} + +TEST(IrBuilder, KeepLineDebugInfoBeforeFunctionEnd) { + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "OpMemoryModel Logical GLSL450\n" + "%1 = OpString \"minimal.vert\"\n" + "%void = OpTypeVoid\n" + "%3 = OpTypeFunction %void\n" + "%4 = OpFunction %void None %3\n" + "OpLine %1 1 1\n" + "OpLine %1 2 2\n" + "OpFunctionEnd\n"); + // clang-format on +} + +TEST(IrBuilder, KeepModuleProcessedInRightPlace) { + DoRoundTripCheck( + // clang-format off + "OpCapability Shader\n" + "OpMemoryModel Logical GLSL450\n" + "%1 = OpString \"minimal.vert\"\n" + "OpName %void \"void\"\n" + "OpModuleProcessed \"Made it faster\"\n" + "OpModuleProcessed \".. and smaller\"\n" + "%void = OpTypeVoid\n"); + // clang-format on +} + +// Checks the given |error_message| is reported when trying to build a module +// from the given |assembly|. +void DoErrorMessageCheck(const std::string& assembly, + const std::string& error_message, uint32_t line_num) { + auto consumer = [error_message, line_num](spv_message_level_t, const char*, + const spv_position_t& position, + const char* m) { + EXPECT_EQ(error_message, m); + EXPECT_EQ(line_num, position.line); + }; + + SpirvTools t(SPV_ENV_UNIVERSAL_1_1); + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, std::move(consumer), assembly); + EXPECT_EQ(nullptr, context); +} + +TEST(IrBuilder, FunctionInsideFunction) { + DoErrorMessageCheck("%2 = OpFunction %1 None %3\n%5 = OpFunction %4 None %6", + "function inside function", 2); +} + +TEST(IrBuilder, MismatchOpFunctionEnd) { + DoErrorMessageCheck("OpFunctionEnd", + "OpFunctionEnd without corresponding OpFunction", 1); +} + +TEST(IrBuilder, OpFunctionEndInsideBasicBlock) { + DoErrorMessageCheck( + "%2 = OpFunction %1 None %3\n" + "%4 = OpLabel\n" + "OpFunctionEnd", + "OpFunctionEnd inside basic block", 3); +} + +TEST(IrBuilder, BasicBlockOutsideFunction) { + DoErrorMessageCheck("OpCapability Shader\n%1 = OpLabel", + "OpLabel outside function", 2); +} + +TEST(IrBuilder, OpLabelInsideBasicBlock) { + DoErrorMessageCheck( + "%2 = OpFunction %1 None %3\n" + "%4 = OpLabel\n" + "%5 = OpLabel", + "OpLabel inside basic block", 3); +} + +TEST(IrBuilder, TerminatorOutsideFunction) { + DoErrorMessageCheck("OpReturn", "terminator instruction outside function", 1); +} + +TEST(IrBuilder, TerminatorOutsideBasicBlock) { + DoErrorMessageCheck("%2 = OpFunction %1 None %3\nOpReturn", + "terminator instruction outside basic block", 2); +} + +TEST(IrBuilder, NotAllowedInstAppearingInFunction) { + DoErrorMessageCheck("%2 = OpFunction %1 None %3\n%5 = OpVariable %4 Function", + "Non-OpFunctionParameter (opcode: 59) found inside " + "function but outside basic block", + 2); +} + +TEST(IrBuilder, UniqueIds) { + const std::string text = + // clang-format off + "OpCapability Shader\n" + "%1 = OpExtInstImport \"GLSL.std.450\"\n" + "OpMemoryModel Logical GLSL450\n" + "OpEntryPoint Vertex %main \"main\"\n" + "OpSource ESSL 310\n" + "OpName %main \"main\"\n" + "OpName %f_ \"f(\"\n" + "OpName %gv1 \"gv1\"\n" + "OpName %gv2 \"gv2\"\n" + "OpName %lv1 \"lv1\"\n" + "OpName %lv2 \"lv2\"\n" + "OpName %lv1_0 \"lv1\"\n" + "%void = OpTypeVoid\n" + "%10 = OpTypeFunction %void\n" + "%float = OpTypeFloat 32\n" + "%12 = OpTypeFunction %float\n" + "%_ptr_Private_float = OpTypePointer Private %float\n" + "%gv1 = OpVariable %_ptr_Private_float Private\n" + "%float_10 = OpConstant %float 10\n" + "%gv2 = OpVariable %_ptr_Private_float Private\n" + "%float_100 = OpConstant %float 100\n" + "%_ptr_Function_float = OpTypePointer Function %float\n" + "%main = OpFunction %void None %10\n" + "%17 = OpLabel\n" + "%lv1_0 = OpVariable %_ptr_Function_float Function\n" + "OpStore %gv1 %float_10\n" + "OpStore %gv2 %float_100\n" + "%18 = OpLoad %float %gv1\n" + "%19 = OpLoad %float %gv2\n" + "%20 = OpFSub %float %18 %19\n" + "OpStore %lv1_0 %20\n" + "OpReturn\n" + "OpFunctionEnd\n" + "%f_ = OpFunction %float None %12\n" + "%21 = OpLabel\n" + "%lv1 = OpVariable %_ptr_Function_float Function\n" + "%lv2 = OpVariable %_ptr_Function_float Function\n" + "%22 = OpLoad %float %gv1\n" + "%23 = OpLoad %float %gv2\n" + "%24 = OpFAdd %float %22 %23\n" + "OpStore %lv1 %24\n" + "%25 = OpLoad %float %gv1\n" + "%26 = OpLoad %float %gv2\n" + "%27 = OpFMul %float %25 %26\n" + "OpStore %lv2 %27\n" + "%28 = OpLoad %float %lv1\n" + "%29 = OpLoad %float %lv2\n" + "%30 = OpFDiv %float %28 %29\n" + "OpReturnValue %30\n" + "OpFunctionEnd\n"; + // clang-format on + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + ASSERT_NE(nullptr, context); + + std::unordered_set ids; + context->module()->ForEachInst([&ids](const Instruction* inst) { + EXPECT_TRUE(ids.insert(inst->unique_id()).second); + }); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/iterator_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/iterator_test.cpp new file mode 100644 index 00000000000..d61bc1ab8e4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/iterator_test.cpp @@ -0,0 +1,267 @@ +// Copyright (c) 2016 Google 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. + +#include +#include + +#include "gmock/gmock.h" + +#include "source/opt/iterator.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::ContainerEq; + +TEST(Iterator, IncrementDeref) { + const int count = 100; + std::vector> data; + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + } + + UptrVectorIterator it(&data, data.begin()); + UptrVectorIterator end(&data, data.end()); + + EXPECT_EQ(*data[0], *it); + for (int i = 1; i < count; ++i) { + EXPECT_NE(end, it); + EXPECT_EQ(*data[i], *(++it)); + } + EXPECT_EQ(end, ++it); +} + +TEST(Iterator, DecrementDeref) { + const int count = 100; + std::vector> data; + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + } + + UptrVectorIterator begin(&data, data.begin()); + UptrVectorIterator it(&data, data.end()); + + for (int i = count - 1; i >= 0; --i) { + EXPECT_NE(begin, it); + EXPECT_EQ(*data[i], *(--it)); + } + EXPECT_EQ(begin, it); +} + +TEST(Iterator, PostIncrementDeref) { + const int count = 100; + std::vector> data; + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + } + + UptrVectorIterator it(&data, data.begin()); + UptrVectorIterator end(&data, data.end()); + + for (int i = 0; i < count; ++i) { + EXPECT_NE(end, it); + EXPECT_EQ(*data[i], *(it++)); + } + EXPECT_EQ(end, it); +} + +TEST(Iterator, PostDecrementDeref) { + const int count = 100; + std::vector> data; + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + } + + UptrVectorIterator begin(&data, data.begin()); + UptrVectorIterator end(&data, data.end()); + UptrVectorIterator it(&data, data.end()); + + EXPECT_EQ(end, it--); + for (int i = count - 1; i >= 1; --i) { + EXPECT_EQ(*data[i], *(it--)); + } + // Decrementing .begin() is undefined behavior. + EXPECT_EQ(*data[0], *it); +} + +TEST(Iterator, Access) { + const int count = 100; + std::vector> data; + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + } + + UptrVectorIterator it(&data, data.begin()); + + for (int i = 0; i < count; ++i) EXPECT_EQ(*data[i], it[i]); +} + +TEST(Iterator, Comparison) { + const int count = 100; + std::vector> data; + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + } + + UptrVectorIterator it(&data, data.begin()); + UptrVectorIterator end(&data, data.end()); + + for (int i = 0; i < count; ++i, ++it) EXPECT_TRUE(it < end); + EXPECT_EQ(end, it); +} + +TEST(Iterator, InsertBeginEnd) { + const int count = 100; + + std::vector> data; + std::vector expected; + std::vector actual; + + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + expected.push_back(i); + } + + // Insert at the beginning + expected.insert(expected.begin(), -100); + UptrVectorIterator begin(&data, data.begin()); + auto insert_point = begin.InsertBefore(MakeUnique(-100)); + for (int i = 0; i < count + 1; ++i) { + actual.push_back(*(insert_point++)); + } + EXPECT_THAT(actual, ContainerEq(expected)); + + // Insert at the end + expected.push_back(-42); + expected.push_back(-36); + expected.push_back(-77); + UptrVectorIterator end(&data, data.end()); + end = end.InsertBefore(MakeUnique(-77)); + end = end.InsertBefore(MakeUnique(-36)); + end = end.InsertBefore(MakeUnique(-42)); + + actual.clear(); + begin = UptrVectorIterator(&data, data.begin()); + for (int i = 0; i < count + 4; ++i) { + actual.push_back(*(begin++)); + } + EXPECT_THAT(actual, ContainerEq(expected)); +} + +TEST(Iterator, InsertMiddle) { + const int count = 100; + + std::vector> data; + std::vector expected; + std::vector actual; + + for (int i = 0; i < count; ++i) { + data.emplace_back(new int(i)); + expected.push_back(i); + } + + const int insert_pos = 42; + expected.insert(expected.begin() + insert_pos, -100); + expected.insert(expected.begin() + insert_pos, -42); + + UptrVectorIterator it(&data, data.begin()); + for (int i = 0; i < insert_pos; ++i) ++it; + it = it.InsertBefore(MakeUnique(-100)); + it = it.InsertBefore(MakeUnique(-42)); + auto begin = UptrVectorIterator(&data, data.begin()); + for (int i = 0; i < count + 2; ++i) { + actual.push_back(*(begin++)); + } + EXPECT_THAT(actual, ContainerEq(expected)); +} + +TEST(IteratorRange, Interface) { + const uint32_t count = 100; + + std::vector> data; + + for (uint32_t i = 0; i < count; ++i) { + data.emplace_back(new uint32_t(i)); + } + + auto b = UptrVectorIterator(&data, data.begin()); + auto e = UptrVectorIterator(&data, data.end()); + auto range = IteratorRange(b, e); + + EXPECT_EQ(b, range.begin()); + EXPECT_EQ(e, range.end()); + EXPECT_FALSE(range.empty()); + EXPECT_EQ(count, range.size()); + EXPECT_EQ(0u, *range.begin()); + EXPECT_EQ(99u, *(--range.end())); + + // IteratorRange itself is immutable. + ++b, --e; + EXPECT_EQ(count, range.size()); + ++range.begin(), --range.end(); + EXPECT_EQ(count, range.size()); +} + +TEST(Iterator, FilterIterator) { + struct Placeholder { + int val; + }; + std::vector data = {{1}, {2}, {3}, {4}, {5}, + {6}, {7}, {8}, {9}, {10}}; + + // Predicate to only consider odd values. + struct Predicate { + bool operator()(const Placeholder& data) { return data.val % 2; } + }; + Predicate pred; + + auto filter_range = MakeFilterIteratorRange(data.begin(), data.end(), pred); + + EXPECT_EQ(filter_range.begin().Get(), data.begin()); + EXPECT_EQ(filter_range.end(), filter_range.begin().GetEnd()); + + for (Placeholder& data : filter_range) { + EXPECT_EQ(data.val % 2, 1); + } + + for (auto it = filter_range.begin(); it != filter_range.end(); it++) { + EXPECT_EQ(it->val % 2, 1); + EXPECT_EQ((*it).val % 2, 1); + } + + for (auto it = filter_range.begin(); it != filter_range.end(); ++it) { + EXPECT_EQ(it->val % 2, 1); + EXPECT_EQ((*it).val % 2, 1); + } + + EXPECT_EQ(MakeFilterIterator(data.begin(), data.end(), pred).Get(), + data.begin()); + EXPECT_EQ(MakeFilterIterator(data.end(), data.end(), pred).Get(), data.end()); + EXPECT_EQ(MakeFilterIterator(data.begin(), data.end(), pred).GetEnd(), + MakeFilterIterator(data.end(), data.end(), pred)); + EXPECT_NE(MakeFilterIterator(data.begin(), data.end(), pred), + MakeFilterIterator(data.end(), data.end(), pred)); + + // Empty range: no values satisfies the predicate. + auto empty_range = MakeFilterIteratorRange( + data.begin(), data.end(), + [](const Placeholder& data) { return data.val > 10; }); + EXPECT_EQ(empty_range.begin(), empty_range.end()); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/line_debug_info_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/line_debug_info_test.cpp new file mode 100644 index 00000000000..6a20a0136d6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/line_debug_info_test.cpp @@ -0,0 +1,113 @@ +// Copyright (c) 2016 Google 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. + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +// A pass turning all none debug line instructions into Nop. +class NopifyPass : public Pass { + public: + const char* name() const override { return "NopifyPass"; } + Status Process() override { + bool modified = false; + context()->module()->ForEachInst( + [&modified](Instruction* inst) { + inst->ToNop(); + modified = true; + }, + /* run_on_debug_line_insts = */ false); + return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange; + } +}; + +using PassTestForLineDebugInfo = PassTest<::testing::Test>; + +// This test's purpose to show our implementation choice: line debug info is +// preserved even if the following instruction is killed. It serves as a guard +// of potential behavior changes. +TEST_F(PassTestForLineDebugInfo, KeepLineDebugInfo) { + // clang-format off + const char* text = + "OpCapability Shader " + "%1 = OpExtInstImport \"GLSL.std.450\" " + "OpMemoryModel Logical GLSL450 " + "OpEntryPoint Vertex %2 \"main\" " + "%3 = OpString \"minimal.vert\" " + "OpNoLine " + "OpLine %3 10 10 " + "%void = OpTypeVoid " + "OpLine %3 100 100 " + "%5 = OpTypeFunction %void " + "%2 = OpFunction %void None %5 " + "OpLine %3 1 1 " + "OpNoLine " + "OpLine %3 2 2 " + "OpLine %3 3 3 " + "%6 = OpLabel " + "OpLine %3 4 4 " + "OpNoLine " + "OpReturn " + "OpLine %3 4 4 " + "OpNoLine " + "OpFunctionEnd "; + // clang-format on + + const char* result_keep_nop = + "OpNop\n" + "OpNop\n" + "OpNop\n" + "OpNop\n" + "OpNop\n" + "OpNoLine\n" + "OpLine %3 10 10\n" + "OpNop\n" + "OpLine %3 100 100\n" + "OpNop\n" + "OpNop\n" + "OpLine %3 1 1\n" + "OpNoLine\n" + "OpLine %3 2 2\n" + "OpLine %3 3 3\n" + "OpNop\n" + "OpLine %3 4 4\n" + "OpNoLine\n" + "OpNop\n" + "OpLine %3 4 4\n" + "OpNoLine\n" + "OpNop\n"; + SinglePassRunAndCheck(text, result_keep_nop, + /* skip_nop = */ false); + const char* result_skip_nop = + "OpNoLine\n" + "OpLine %3 10 10\n" + "OpLine %3 100 100\n" + "OpLine %3 1 1\n" + "OpNoLine\n" + "OpLine %3 2 2\n" + "OpLine %3 3 3\n" + "OpLine %3 4 4\n" + "OpNoLine\n" + "OpLine %3 4 4\n" + "OpNoLine\n"; + SinglePassRunAndCheck(text, result_skip_nop, + /* skip_nop = */ true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_access_chain_convert_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_access_chain_convert_test.cpp new file mode 100644 index 00000000000..cb3572161b6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_access_chain_convert_test.cpp @@ -0,0 +1,717 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using LocalAccessChainConvertTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE + +TEST_F(LocalAccessChainConvertTest, StructOfVecsOfFloatConverted) { + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // gl_FragColor = s0.v1; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +OpStore %19 %18 +%20 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +%21 = OpLoad %v4float %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs_before + before, + true); +} + +TEST_F(LocalAccessChainConvertTest, InBoundsAccessChainsConverted) { + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // gl_FragColor = s0.v1; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpInBoundsAccessChain %_ptr_Function_v4float %s0 %int_1 +OpStore %19 %18 +%20 = OpInBoundsAccessChain %_ptr_Function_v4float %s0 %int_1 +%21 = OpLoad %v4float %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs_before + before, + true); +} + +TEST_F(LocalAccessChainConvertTest, TwoUsesofSingleChainConverted) { + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // gl_FragColor = s0.v1; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +OpStore %19 %18 +%20 = OpLoad %v4float %19 +OpStore %gl_FragColor %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs_before + before, + true); +} + +TEST_F(LocalAccessChainConvertTest, OpaqueConverted) { + // SPIR-V not representable in GLSL; not generatable from HLSL + // at the moment + + const std::string predefs = + R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpMemberName %S_t 2 "smp" +OpName %foo_struct_S_t_vf2_vf21_ "foo(struct-S_t-vf2-vf21;" +OpName %s "s" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %s0 "s0" +OpName %texCoords "texCoords" +OpName %param "param" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%17 = OpTypeImage %float 2D 0 0 0 1 Unknown +%18 = OpTypeSampledImage %17 +%S_t = OpTypeStruct %v2float %v2float %18 +%_ptr_Function_S_t = OpTypePointer Function %S_t +%20 = OpTypeFunction %void %_ptr_Function_S_t +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%_ptr_Function_18 = OpTypePointer Function %18 +%sampler15 = OpVariable %_ptr_UniformConstant_18 UniformConstant +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string before = + R"( +; CHECK: [[l1:%\w+]] = OpLoad %S_t %param +; CHECK: [[e1:%\w+]] = OpCompositeExtract {{%\w+}} [[l1]] 2 +; CHECK: [[l2:%\w+]] = OpLoad %S_t %param +; CHECK: [[e2:%\w+]] = OpCompositeExtract {{%\w+}} [[l2]] 0 +; CHECK: OpImageSampleImplicitLod {{%\w+}} [[e1]] [[e2]] +%main = OpFunction %void None %12 +%28 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%29 = OpLoad %v2float %texCoords +%30 = OpAccessChain %_ptr_Function_v2float %s0 %int_0 +OpStore %30 %29 +%31 = OpLoad %18 %sampler15 +%32 = OpAccessChain %_ptr_Function_18 %s0 %int_2 +OpStore %32 %31 +%33 = OpLoad %S_t %s0 +OpStore %param %33 +%34 = OpAccessChain %_ptr_Function_18 %param %int_2 +%35 = OpLoad %18 %34 +%36 = OpAccessChain %_ptr_Function_v2float %param %int_0 +%37 = OpLoad %v2float %36 +%38 = OpImageSampleImplicitLod %v4float %35 %37 +OpStore %outColor %38 +OpReturn +OpFunctionEnd +)"; + + const std::string remain = + R"(%foo_struct_S_t_vf2_vf21_ = OpFunction %void None %20 +%s = OpFunctionParameter %_ptr_Function_S_t +%39 = OpLabel +%40 = OpAccessChain %_ptr_Function_18 %s %int_2 +%41 = OpLoad %18 %40 +%42 = OpAccessChain %_ptr_Function_v2float %s %int_0 +%43 = OpLoad %v2float %42 +%44 = OpImageSampleImplicitLod %v4float %41 %43 +OpStore %outColor %44 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs + before + remain, + true); +} + +TEST_F(LocalAccessChainConvertTest, NestedStructsConverted) { + // #version 140 + // + // in vec4 BaseColor; + // + // struct S1_t { + // vec4 v1; + // }; + // + // struct S2_t { + // vec4 v2; + // S1_t s1; + // }; + // + // void main() + // { + // S2_t s2; + // s2.s1.v1 = BaseColor; + // gl_FragColor = s2.s1.v1; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S1_t "S1_t" +OpMemberName %S1_t 0 "v1" +OpName %S2_t "S2_t" +OpMemberName %S2_t 0 "v2" +OpMemberName %S2_t 1 "s1" +OpName %s2 "s2" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S1_t = OpTypeStruct %v4float +%S2_t = OpTypeStruct %v4float %S1_t +%_ptr_Function_S2_t = OpTypePointer Function %S2_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%int_0 = OpConstant %int 0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"( +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S2_t %s2 +; CHECK: [[ex1:%\w+]] = OpCompositeInsert %S2_t [[st_id]] [[ld1]] 1 0 +; CHECK: OpStore %s2 [[ex1]] +; CHECK: [[ld2:%\w+]] = OpLoad %S2_t %s2 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 0 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %9 +%19 = OpLabel +%s2 = OpVariable %_ptr_Function_S2_t Function +%20 = OpLoad %v4float %BaseColor +%21 = OpAccessChain %_ptr_Function_v4float %s2 %int_1 %int_0 +OpStore %21 %20 +%22 = OpAccessChain %_ptr_Function_v4float %s2 %int_1 %int_0 +%23 = OpLoad %v4float %22 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs_before + before, + true); +} + +TEST_F(LocalAccessChainConvertTest, SomeAccessChainsHaveNoUse) { + // Based on HLSL source code: + // struct S { + // float f; + // }; + + // float main(float input : A) : B { + // S local = { input }; + // return local.f; + // } + + const std::string predefs = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %main "main" %in_var_A %out_var_B +OpName %main "main" +OpName %in_var_A "in.var.A" +OpName %out_var_B "out.var.B" +OpName %S "S" +OpName %local "local" +%int = OpTypeInt 32 1 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%_ptr_Output_float = OpTypePointer Output %float +%S = OpTypeStruct %float +%_ptr_Function_S = OpTypePointer Function %S +%int_0 = OpConstant %int 0 +%in_var_A = OpVariable %_ptr_Input_float Input +%out_var_B = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %8 +%15 = OpLabel +%local = OpVariable %_ptr_Function_S Function +%16 = OpLoad %float %in_var_A +%17 = OpCompositeConstruct %S %16 +OpStore %local %17 +)"; + + const std::string before = + R"( +; CHECK: [[ld:%\w+]] = OpLoad %S %local +; CHECK: [[ex:%\w+]] = OpCompositeExtract %float [[ld]] 0 +; CHECK: OpStore %out_var_B [[ex]] +%18 = OpAccessChain %_ptr_Function_float %local %int_0 +%19 = OpAccessChain %_ptr_Function_float %local %int_0 +%20 = OpLoad %float %18 +OpStore %out_var_B %20 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs + before, true); +} + +TEST_F(LocalAccessChainConvertTest, + StructOfVecsOfFloatConvertedWithDecorationOnLoad) { + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // gl_FragColor = s0.v1; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %21 RelaxedPrecision +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"( +; CHECK: OpDecorate +; CHECK: OpDecorate [[ld2:%\w+]] RelaxedPrecision +; CHECK-NOT: OpDecorate +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ins:%\w+]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ins]] +; CHECK: [[ld2]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +OpStore %19 %18 +%20 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +%21 = OpLoad %v4float %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs_before + before, + true); +} + +TEST_F(LocalAccessChainConvertTest, + StructOfVecsOfFloatConvertedWithDecorationOnStore) { + // #version 140 + // + // in vec4 BaseColor; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // gl_FragColor = s0.v1; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %s0 RelaxedPrecision +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"( +; CHECK: OpDecorate +; CHECK: OpDecorate [[ld1:%\w+]] RelaxedPrecision +; CHECK: OpDecorate [[ins:%\w+]] RelaxedPrecision +; CHECK-NOT: OpDecorate +; CHECK: [[st_id:%\w+]] = OpLoad %v4float %BaseColor +; CHECK: [[ld1]] = OpLoad %S_t %s0 +; CHECK: [[ins]] = OpCompositeInsert %S_t [[st_id]] [[ld1]] 1 +; CHECK: OpStore %s0 [[ins]] +; CHECK: [[ld2:%\w+]] = OpLoad %S_t %s0 +; CHECK: [[ex2:%\w+]] = OpCompositeExtract %v4float [[ld2]] 1 +; CHECK: OpStore %gl_FragColor [[ex2]] +%main = OpFunction %void None %8 +%17 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%18 = OpLoad %v4float %BaseColor +%19 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +OpStore %19 %18 +%20 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +%21 = OpLoad %v4float %20 +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(predefs_before + before, + true); +} +#endif // SPIRV_EFFCEE + +TEST_F(LocalAccessChainConvertTest, DynamicallyIndexedVarNotConverted) { + // #version 140 + // + // in vec4 BaseColor; + // flat in int Idx; + // in float Bi; + // + // struct S_t { + // vec4 v0; + // vec4 v1; + // }; + // + // void main() + // { + // S_t s0; + // s0.v1 = BaseColor; + // s0.v1[Idx] = Bi; + // gl_FragColor = s0.v1; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Idx %Bi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpName %s0 "s0" +OpName %BaseColor "BaseColor" +OpName %Idx "Idx" +OpName %Bi "Bi" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %Idx Flat +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%S_t = OpTypeStruct %v4float %v4float +%_ptr_Function_S_t = OpTypePointer Function %S_t +%int = OpTypeInt 32 1 +%int_1 = OpConstant %int 1 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_int = OpTypePointer Input %int +%Idx = OpVariable %_ptr_Input_int Input +%_ptr_Input_float = OpTypePointer Input %float +%Bi = OpVariable %_ptr_Input_float Input +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %10 +%22 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%23 = OpLoad %v4float %BaseColor +%24 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +OpStore %24 %23 +%25 = OpLoad %int %Idx +%26 = OpLoad %float %Bi +%27 = OpAccessChain %_ptr_Function_float %s0 %int_1 %25 +OpStore %27 %26 +%28 = OpAccessChain %_ptr_Function_v4float %s0 %int_1 +%29 = OpLoad %v4float %28 +OpStore %gl_FragColor %29 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, false, + true); +} + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// Assorted vector and matrix types +// Assorted struct array types +// Assorted scalar types +// Assorted non-target types +// OpInBoundsAccessChain +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_redundancy_elimination_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_redundancy_elimination_test.cpp new file mode 100644 index 00000000000..bdaafb85f0f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_redundancy_elimination_test.cpp @@ -0,0 +1,161 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; +using LocalRedundancyEliminationTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +// Remove an instruction when it was already computed. +TEST_F(LocalRedundancyEliminationTest, RemoveRedundantAdd) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 +; CHECK: OpFAdd +; CHECK-NOT: OpFAdd + %11 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +// Make sure we keep instruction that are different, but look similar. +TEST_F(LocalRedundancyEliminationTest, KeepDifferentAdd) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 +; CHECK: OpFAdd + OpStore %8 %10 + %11 = OpLoad %5 %8 +; CHECK: %11 = OpLoad + %12 = OpFAdd %5 %11 %11 +; CHECK: OpFAdd [[:%\w+]] %11 %11 + OpReturn + OpFunctionEnd + )"; + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(text, false); +} + +// This test is check that the values are being propagated properly, and that +// we are able to identify sequences of instruction that are not needed. +TEST_F(LocalRedundancyEliminationTest, RemoveMultipleInstructions) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Uniform %5 + %8 = OpVariable %6 Uniform + %2 = OpFunction %3 None %4 + %7 = OpLabel +; CHECK: [[r1:%\w+]] = OpLoad + %9 = OpLoad %5 %8 +; CHECK-NEXT: [[r2:%\w+]] = OpFAdd [[:%\w+]] [[r1]] [[r1]] + %10 = OpFAdd %5 %9 %9 +; CHECK-NEXT: [[r3:%\w+]] = OpFMul [[:%\w+]] [[r2]] [[r1]] + %11 = OpFMul %5 %10 %9 +; CHECK-NOT: OpLoad + %12 = OpLoad %5 %8 +; CHECK-NOT: OpFAdd [[:\w+]] %12 %12 + %13 = OpFAdd %5 %12 %12 +; CHECK-NOT: OpFMul + %14 = OpFMul %5 %13 %12 +; CHECK-NEXT: [[:%\w+]] = OpFAdd [[:%\w+]] [[r3]] [[r3]] + %15 = OpFAdd %5 %14 %11 + OpReturn + OpFunctionEnd + )"; + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(text, false); +} + +// Redundant instructions in different blocks should be kept. +TEST_F(LocalRedundancyEliminationTest, KeepInstructionsInDifferentBlocks) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %bb1 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 +; CHECK: OpFAdd + OpBranch %bb2 + %bb2 = OpLabel +; CHECK: OpFAdd + %11 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_single_block_elim.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_single_block_elim.cpp new file mode 100644 index 00000000000..da7540e6bf8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_single_block_elim.cpp @@ -0,0 +1,1072 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using LocalSingleBlockLoadStoreElimTest = PassTest<::testing::Test>; + +TEST_F(LocalSingleBlockLoadStoreElimTest, SimpleStoreLoadElim) { + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // gl_FragColor = v; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +%15 = OpLoad %v4float %v +OpStore %gl_FragColor %15 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpStore %gl_FragColor %14 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + before, predefs_before + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, SimpleLoadLoadElim) { + // #version 140 + // + // in vec4 BaseColor; + // in float fi; + // + // void main() + // { + // vec4 v = BaseColor; + // if (fi < 0) + // v = vec4(0.0); + // gl_FragData[0] = v; + // gl_FragData[1] = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragData +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %gl_FragData "gl_FragData" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%16 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%uint = OpTypeInt 32 0 +%uint_32 = OpConstant %uint 32 +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Output__arr_v4float_uint_32 = OpTypePointer Output %_arr_v4float_uint_32 +%gl_FragData = OpVariable %_ptr_Output__arr_v4float_uint_32 Output +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%int_1 = OpConstant %int 1 +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%25 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%26 = OpLoad %v4float %BaseColor +OpStore %v %26 +%27 = OpLoad %float %fi +%28 = OpFOrdLessThan %bool %27 %float_0 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +OpStore %v %16 +OpBranch %29 +%29 = OpLabel +%31 = OpLoad %v4float %v +%32 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_0 +OpStore %32 %31 +%33 = OpLoad %v4float %v +%34 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_1 +OpStore %34 %33 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%25 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%26 = OpLoad %v4float %BaseColor +OpStore %v %26 +%27 = OpLoad %float %fi +%28 = OpFOrdLessThan %bool %27 %float_0 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +OpStore %v %16 +OpBranch %29 +%29 = OpLabel +%31 = OpLoad %v4float %v +%32 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_0 +OpStore %32 %31 +%34 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_1 +OpStore %34 %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, StoreStoreElim) { + // + // Note first store to v is eliminated + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // vec4 v = BaseColor; + // v = v * 0.5; + // OutColor = v; + // } + + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %OutColor "OutColor" +OpDecorate %BaseColor Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%float_0_5 = OpConstant %float 0.5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%14 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%15 = OpLoad %v4float %BaseColor +OpStore %v %15 +%16 = OpLoad %v4float %v +%17 = OpVectorTimesScalar %v4float %16 %float_0_5 +OpStore %v %17 +%18 = OpLoad %v4float %v +OpStore %OutColor %18 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%14 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%15 = OpLoad %v4float %BaseColor +%17 = OpVectorTimesScalar %v4float %15 %float_0_5 +OpStore %v %17 +OpStore %OutColor %17 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs_before + before, predefs_before + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, + NoStoreElimIfInterveningAccessChainLoad) { + // + // Note the first Store to %v is not eliminated due to the following access + // chain reference. + // + // #version 450 + // + // layout(location = 0) in vec4 BaseColor0; + // layout(location = 1) in vec4 BaseColor1; + // layout(location = 2) flat in int Idx; + // layout(location = 0) out vec4 OutColor; + // + // void main() + // { + // vec4 v = BaseColor0; + // float f = v[Idx]; + // v = BaseColor1 + vec4(0.1); + // OutColor = v/f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor0 %Idx %BaseColor1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor0 "BaseColor0" +OpName %f "f" +OpName %Idx "Idx" +OpName %BaseColor1 "BaseColor1" +OpName %OutColor "OutColor" +OpDecorate %BaseColor0 Location 0 +OpDecorate %Idx Flat +OpDecorate %Idx Location 2 +OpDecorate %BaseColor1 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%Idx = OpVariable %_ptr_Input_int Input +%BaseColor1 = OpVariable %_ptr_Input_v4float Input +%float_0_100000001 = OpConstant %float 0.100000001 +%19 = OpConstantComposite %v4float %float_0_100000001 %float_0_100000001 %float_0_100000001 %float_0_100000001 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%22 = OpLoad %v4float %BaseColor0 +OpStore %v %22 +%23 = OpLoad %int %Idx +%24 = OpAccessChain %_ptr_Function_float %v %23 +%25 = OpLoad %float %24 +OpStore %f %25 +%26 = OpLoad %v4float %BaseColor1 +%27 = OpFAdd %v4float %26 %19 +OpStore %v %27 +%28 = OpLoad %v4float %v +%29 = OpLoad %float %f +%30 = OpCompositeConstruct %v4float %29 %29 %29 %29 +%31 = OpFDiv %v4float %28 %30 +OpStore %OutColor %31 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%22 = OpLoad %v4float %BaseColor0 +OpStore %v %22 +%23 = OpLoad %int %Idx +%24 = OpAccessChain %_ptr_Function_float %v %23 +%25 = OpLoad %float %24 +OpStore %f %25 +%26 = OpLoad %v4float %BaseColor1 +%27 = OpFAdd %v4float %26 %19 +OpStore %v %27 +%30 = OpCompositeConstruct %v4float %25 %25 %25 %25 +%31 = OpFDiv %v4float %27 %30 +OpStore %OutColor %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, NoElimIfInterveningAccessChainStore) { + // #version 140 + // + // in vec4 BaseColor; + // flat in int Idx; + // + // void main() + // { + // vec4 v = BaseColor; + // v[Idx] = 0; + // gl_FragColor = v; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %Idx %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %Idx "Idx" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %Idx Flat +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%Idx = OpVariable %_ptr_Input_int Input +%float_0 = OpConstant %float 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %8 +%18 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%19 = OpLoad %v4float %BaseColor +OpStore %v %19 +%20 = OpLoad %int %Idx +%21 = OpAccessChain %_ptr_Function_float %v %20 +OpStore %21 %float_0 +%22 = OpLoad %v4float %v +OpStore %gl_FragColor %22 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, + false, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, NoElimIfInterveningFunctionCall) { + // #version 140 + // + // in vec4 BaseColor; + // + // void foo() { + // } + // + // void main() + // { + // vec4 v = BaseColor; + // foo(); + // gl_FragColor = v; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_ "foo(" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %8 +%14 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%15 = OpLoad %v4float %BaseColor +OpStore %v %15 +%16 = OpFunctionCall %void %foo_ +%17 = OpLoad %v4float %v +OpStore %gl_FragColor %17 +OpReturn +OpFunctionEnd +%foo_ = OpFunction %void None %8 +%18 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, + false, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, ElimIfCopyObjectInFunction) { + // Note: SPIR-V hand edited to insert CopyObject + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v1 = BaseColor; + // gl_FragData[0] = v1; + // vec4 v2 = BaseColor * 0.5; + // gl_FragData[1] = v2; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragData +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v1 "v1" +OpName %BaseColor "BaseColor" +OpName %gl_FragData "gl_FragData" +OpName %v2 "v2" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_32 = OpConstant %uint 32 +%_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32 +%_ptr_Output__arr_v4float_uint_32 = OpTypePointer Output %_arr_v4float_uint_32 +%gl_FragData = OpVariable %_ptr_Output__arr_v4float_uint_32 Output +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%float_0_5 = OpConstant %float 0.5 +%int_1 = OpConstant %int 1 +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%v1 = OpVariable %_ptr_Function_v4float Function +%v2 = OpVariable %_ptr_Function_v4float Function +%23 = OpLoad %v4float %BaseColor +OpStore %v1 %23 +%24 = OpLoad %v4float %v1 +%25 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_0 +OpStore %25 %24 +%26 = OpLoad %v4float %BaseColor +%27 = OpVectorTimesScalar %v4float %26 %float_0_5 +%28 = OpCopyObject %_ptr_Function_v4float %v2 +OpStore %28 %27 +%29 = OpLoad %v4float %28 +%30 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_1 +OpStore %30 %29 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%v1 = OpVariable %_ptr_Function_v4float Function +%v2 = OpVariable %_ptr_Function_v4float Function +%23 = OpLoad %v4float %BaseColor +OpStore %v1 %23 +%25 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_0 +OpStore %25 %23 +%26 = OpLoad %v4float %BaseColor +%27 = OpVectorTimesScalar %v4float %26 %float_0_5 +%28 = OpCopyObject %_ptr_Function_v4float %v2 +OpStore %28 %27 +%30 = OpAccessChain %_ptr_Output_v4float %gl_FragData %int_1 +OpStore %30 %27 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, ElimOpaque) { + // SPIR-V not representable in GLSL; not generatable from HLSL + // at the moment + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %outColor %texCoords +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %S_t "S_t" +OpMemberName %S_t 0 "v0" +OpMemberName %S_t 1 "v1" +OpMemberName %S_t 2 "smp" +OpName %outColor "outColor" +OpName %sampler15 "sampler15" +OpName %s0 "s0" +OpName %texCoords "texCoords" +OpName %param "param" +OpDecorate %sampler15 DescriptorSet 0 +%void = OpTypeVoid +%12 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%outColor = OpVariable %_ptr_Output_v4float Output +%17 = OpTypeImage %float 2D 0 0 0 1 Unknown +%18 = OpTypeSampledImage %17 +%S_t = OpTypeStruct %v2float %v2float %18 +%_ptr_Function_S_t = OpTypePointer Function %S_t +%20 = OpTypeFunction %void %_ptr_Function_S_t +%_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 +%_ptr_Function_18 = OpTypePointer Function %18 +%sampler15 = OpVariable %_ptr_UniformConstant_18 UniformConstant +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%texCoords = OpVariable %_ptr_Input_v2float Input +)"; + + const std::string before = + R"(%main = OpFunction %void None %12 +%28 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%29 = OpLoad %v2float %texCoords +%30 = OpLoad %S_t %s0 +%31 = OpCompositeInsert %S_t %29 %30 0 +OpStore %s0 %31 +%32 = OpLoad %18 %sampler15 +%33 = OpLoad %S_t %s0 +%34 = OpCompositeInsert %S_t %32 %33 2 +OpStore %s0 %34 +%35 = OpLoad %S_t %s0 +OpStore %param %35 +%36 = OpLoad %S_t %param +%37 = OpCompositeExtract %18 %36 2 +%38 = OpLoad %S_t %param +%39 = OpCompositeExtract %v2float %38 0 +%40 = OpImageSampleImplicitLod %v4float %37 %39 +OpStore %outColor %40 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %12 +%28 = OpLabel +%s0 = OpVariable %_ptr_Function_S_t Function +%param = OpVariable %_ptr_Function_S_t Function +%29 = OpLoad %v2float %texCoords +%30 = OpLoad %S_t %s0 +%31 = OpCompositeInsert %S_t %29 %30 0 +%32 = OpLoad %18 %sampler15 +%34 = OpCompositeInsert %S_t %32 %31 2 +OpStore %s0 %34 +OpStore %param %34 +%37 = OpCompositeExtract %18 %34 2 +%39 = OpCompositeExtract %v2float %34 0 +%40 = OpImageSampleImplicitLod %v4float %37 %39 +OpStore %outColor %40 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, PositiveAndNegativeCallTree) { + // Note that the call tree function bar is optimized, but foo is not + // + // #version 140 + // + // in vec4 BaseColor; + // + // vec4 foo(vec4 v1) + // { + // vec4 t = v1; + // return t; + // } + // + // vec4 bar(vec4 v1) + // { + // vec4 t = v1; + // return t; + // } + // + // void main() + // { + // gl_FragColor = bar(BaseColor); + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %foo_vf4_ "foo(vf4;" +OpName %v1 "v1" +OpName %bar_vf4_ "bar(vf4;" +OpName %v1_0 "v1" +OpName %t "t" +OpName %t_0 "t" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +OpName %param "param" +%void = OpTypeVoid +%13 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%17 = OpTypeFunction %v4float %_ptr_Function_v4float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %13 +%20 = OpLabel +%param = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %v4float %BaseColor +OpStore %param %21 +%22 = OpFunctionCall %v4float %bar_vf4_ %param +OpStore %gl_FragColor %22 +OpReturn +OpFunctionEnd +)"; + + const std::string before = + R"(%foo_vf4_ = OpFunction %v4float None %17 +%v1 = OpFunctionParameter %_ptr_Function_v4float +%23 = OpLabel +%t = OpVariable %_ptr_Function_v4float Function +%24 = OpLoad %v4float %v1 +OpStore %t %24 +%25 = OpLoad %v4float %t +OpReturnValue %25 +OpFunctionEnd +%bar_vf4_ = OpFunction %v4float None %17 +%v1_0 = OpFunctionParameter %_ptr_Function_v4float +%26 = OpLabel +%t_0 = OpVariable %_ptr_Function_v4float Function +%27 = OpLoad %v4float %v1_0 +OpStore %t_0 %27 +%28 = OpLoad %v4float %t_0 +OpReturnValue %28 +OpFunctionEnd +)"; + + const std::string after = + R"(%foo_vf4_ = OpFunction %v4float None %17 +%v1 = OpFunctionParameter %_ptr_Function_v4float +%23 = OpLabel +%t = OpVariable %_ptr_Function_v4float Function +%24 = OpLoad %v4float %v1 +OpStore %t %24 +%25 = OpLoad %v4float %t +OpReturnValue %25 +OpFunctionEnd +%bar_vf4_ = OpFunction %v4float None %17 +%v1_0 = OpFunctionParameter %_ptr_Function_v4float +%26 = OpLabel +%t_0 = OpVariable %_ptr_Function_v4float Function +%27 = OpLoad %v4float %v1_0 +OpStore %t_0 %27 +OpReturnValue %27 +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, PointerVariable) { + // Test that checks if a pointer variable is removed. + + const std::string before = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%26 = OpLoad %_ptr_Uniform__struct_5 %24 +%27 = OpAccessChain %_ptr_Uniform_v4float %26 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%27 = OpAccessChain %_ptr_Uniform_v4float %7 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, + true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, RedundantStore) { + // Test that checks if a pointer variable is removed. + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpBranch %16 +%16 = OpLabel +%15 = OpLoad %v4float %v +OpStore %v %15 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpBranch %16 +%16 = OpLabel +%15 = OpLoad %v4float %v +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + predefs_before + before, predefs_before + after, true, true); +} + +TEST_F(LocalSingleBlockLoadStoreElimTest, RedundantStore2) { + // Test that checks if a pointer variable is removed. + const std::string predefs_before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpBranch %16 +%16 = OpLabel +%15 = OpLoad %v4float %v +OpStore %v %15 +%17 = OpLoad %v4float %v +OpStore %v %17 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %7 +%13 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%14 = OpLoad %v4float %BaseColor +OpStore %v %14 +OpBranch %16 +%16 = OpLabel +%15 = OpLoad %v4float %v +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + predefs_before + before, predefs_before + after, true, true); +} + +// Test that that an unused OpAccessChain between two store does does not +// hinders the removal of the first store. We need to check this because +// local-access-chain-convert does always remove the OpAccessChain instructions +// that become dead. + +TEST_F(LocalSingleBlockLoadStoreElimTest, + StoreElimIfInterveningUnusedAccessChain) { + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor0 %Idx %BaseColor1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %BaseColor0 "BaseColor0" +OpName %Idx "Idx" +OpName %BaseColor1 "BaseColor1" +OpName %OutColor "OutColor" +OpDecorate %BaseColor0 Location 0 +OpDecorate %Idx Flat +OpDecorate %Idx Location 2 +OpDecorate %BaseColor1 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%Idx = OpVariable %_ptr_Input_int Input +%BaseColor1 = OpVariable %_ptr_Input_v4float Input +%float_0_100000001 = OpConstant %float 0.100000001 +%19 = OpConstantComposite %v4float %float_0_100000001 %float_0_100000001 %float_0_100000001 %float_0_100000001 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor0 +OpStore %v %22 +%23 = OpLoad %int %Idx +%24 = OpAccessChain %_ptr_Function_float %v %23 +%26 = OpLoad %v4float %BaseColor1 +%27 = OpFAdd %v4float %26 %19 +OpStore %v %27 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%22 = OpLoad %v4float %BaseColor0 +%23 = OpLoad %int %Idx +%24 = OpAccessChain %_ptr_Function_float %v %23 +%26 = OpLoad %v4float %BaseColor1 +%27 = OpFAdd %v4float %26 %19 +OpStore %v %27 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + predefs + before, predefs + after, true, true); +} +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// Other target variable types +// InBounds Access Chains +// Check for correctness in the presence of function calls +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_single_store_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_single_store_elim_test.cpp new file mode 100644 index 00000000000..23e82ba86d2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_single_store_elim_test.cpp @@ -0,0 +1,855 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using LocalSingleStoreElimTest = PassTest<::testing::Test>; + +TEST_F(LocalSingleStoreElimTest, PositiveAndNegative) { + // Single store to v is optimized. Multiple store to + // f is not optimized. + // + // #version 140 + // + // in vec4 BaseColor; + // in float fi; + // + // void main() + // { + // vec4 v = BaseColor; + // float f = fi; + // if (f < 0) + // f = 0.0; + // gl_FragColor = v + f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %f "f" +OpName %fi "fi" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +OpStore %f %21 +%22 = OpLoad %float %f +%23 = OpFOrdLessThan %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %24 +%25 = OpLabel +OpStore %f %float_0 +OpBranch %24 +%24 = OpLabel +%26 = OpLoad %v4float %v +%27 = OpLoad %float %f +%28 = OpCompositeConstruct %v4float %27 %27 %27 %27 +%29 = OpFAdd %v4float %26 %28 +OpStore %gl_FragColor %29 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +OpStore %f %21 +%22 = OpLoad %float %f +%23 = OpFOrdLessThan %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %24 +%25 = OpLabel +OpStore %f %float_0 +OpBranch %24 +%24 = OpLabel +%27 = OpLoad %float %f +%28 = OpCompositeConstruct %v4float %27 %27 %27 %27 +%29 = OpFAdd %v4float %20 %28 +OpStore %gl_FragColor %29 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSingleStoreElimTest, ThreeStores) { + // Three stores to multiple loads of v is not optimized. + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %r "r" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%r = OpVariable %_ptr_Function_v4float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +%22 = OpFOrdLessThan %bool %21 %float_0 +OpSelectionMerge %23 None +OpBranchConditional %22 %24 %25 +%24 = OpLabel +%26 = OpLoad %v4float %v +OpStore %v %26 +OpStore %r %26 +OpBranch %23 +%25 = OpLabel +%27 = OpLoad %v4float %v +%28 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 +OpStore %v %28 +%29 = OpFSub %v4float %28 %27 +OpStore %r %29 +OpBranch %23 +%23 = OpLabel +%30 = OpLoad %v4float %r +OpStore %gl_FragColor %30 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + before, true, true); +} + +TEST_F(LocalSingleStoreElimTest, MultipleLoads) { + // Single store to multiple loads of v is optimized. + // + // #version 140 + // + // in vec4 BaseColor; + // in float fi; + // + // void main() + // { + // vec4 v = BaseColor; + // float f = fi; + // if (f < 0) + // f = 0.0; + // gl_FragColor = v + f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %fi "fi" +OpName %r "r" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%r = OpVariable %_ptr_Function_v4float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +%22 = OpFOrdLessThan %bool %21 %float_0 +OpSelectionMerge %23 None +OpBranchConditional %22 %24 %25 +%24 = OpLabel +%26 = OpLoad %v4float %v +OpStore %r %26 +OpBranch %23 +%25 = OpLabel +%27 = OpLoad %v4float %v +%28 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 +%29 = OpFSub %v4float %28 %27 +OpStore %r %29 +OpBranch %23 +%23 = OpLabel +%30 = OpLoad %v4float %r +OpStore %gl_FragColor %30 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%r = OpVariable %_ptr_Function_v4float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +%22 = OpFOrdLessThan %bool %21 %float_0 +OpSelectionMerge %23 None +OpBranchConditional %22 %24 %25 +%24 = OpLabel +OpStore %r %20 +OpBranch %23 +%25 = OpLabel +%28 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1 +%29 = OpFSub %v4float %28 %20 +OpStore %r %29 +OpBranch %23 +%23 = OpLabel +%30 = OpLoad %v4float %r +OpStore %gl_FragColor %30 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSingleStoreElimTest, NoStoreElimWithInterveningAccessChainLoad) { + // Last load of v is eliminated, but access chain load and store of v isn't + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // float f = v[3]; + // gl_FragColor = v * f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %f "f" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%uint = OpTypeInt 32 0 +%uint_3 = OpConstant %uint 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpAccessChain %_ptr_Function_float %v %uint_3 +%20 = OpLoad %float %19 +OpStore %f %20 +%21 = OpLoad %v4float %v +%22 = OpLoad %float %f +%23 = OpVectorTimesScalar %v4float %21 %22 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpAccessChain %_ptr_Function_float %v %uint_3 +%20 = OpLoad %float %19 +OpStore %f %20 +%23 = OpVectorTimesScalar %v4float %18 %20 +OpStore %gl_FragColor %23 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSingleStoreElimTest, NoReplaceOfDominatingPartialStore) { + // Note: SPIR-V hand edited to initialize v to vec4(0.0) + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v; + // float v[1] = 1.0; + // gl_FragColor = v; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +%void = OpTypeVoid +%7 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%12 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%float_1 = OpConstant %float 1 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %7 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function %12 +%20 = OpAccessChain %_ptr_Function_float %v %uint_1 +OpStore %20 %float_1 +%21 = OpLoad %v4float %v +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, + true); +} + +TEST_F(LocalSingleStoreElimTest, ElimIfCopyObjectInFunction) { + // Note: hand edited to insert OpCopyObject + // + // #version 140 + // + // in vec4 BaseColor; + // in float fi; + // + // void main() + // { + // vec4 v = BaseColor; + // float f = fi; + // if (f < 0) + // f = 0.0; + // gl_FragColor = v + f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %fi %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %f "f" +OpName %fi "fi" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +OpStore %f %21 +%22 = OpLoad %float %f +%23 = OpFOrdLessThan %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %24 +%25 = OpLabel +OpStore %f %float_0 +OpBranch %24 +%24 = OpLabel +%26 = OpCopyObject %_ptr_Function_v4float %v +%27 = OpLoad %v4float %26 +%28 = OpLoad %float %f +%29 = OpCompositeConstruct %v4float %28 %28 %28 %28 +%30 = OpFAdd %v4float %27 %29 +OpStore %gl_FragColor %30 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%19 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%f = OpVariable %_ptr_Function_float Function +%20 = OpLoad %v4float %BaseColor +OpStore %v %20 +%21 = OpLoad %float %fi +OpStore %f %21 +%22 = OpLoad %float %f +%23 = OpFOrdLessThan %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %24 +%25 = OpLabel +OpStore %f %float_0 +OpBranch %24 +%24 = OpLabel +%26 = OpCopyObject %_ptr_Function_v4float %v +%28 = OpLoad %float %f +%29 = OpCompositeConstruct %v4float %28 %28 %28 %28 +%30 = OpFAdd %v4float %20 %29 +OpStore %gl_FragColor %30 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSingleStoreElimTest, NoOptIfStoreNotDominating) { + // Single store to f not optimized because it does not dominate + // the load. + // + // #version 140 + // + // in vec4 BaseColor; + // in float fi; + // + // void main() + // { + // float f; + // if (fi < 0) + // f = 0.5; + // if (fi < 0) + // gl_FragColor = BaseColor * f; + // else + // gl_FragColor = BaseColor; + // } + + const std::string assembly = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %fi %gl_FragColor %BaseColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %fi "fi" +OpName %f "f" +OpName %gl_FragColor "gl_FragColor" +OpName %BaseColor "BaseColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%_ptr_Function_float = OpTypePointer Function %float +%float_0_5 = OpConstant %float 0.5 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%main = OpFunction %void None %8 +%18 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%19 = OpLoad %float %fi +%20 = OpFOrdLessThan %bool %19 %float_0 +OpSelectionMerge %21 None +OpBranchConditional %20 %22 %21 +%22 = OpLabel +OpStore %f %float_0_5 +OpBranch %21 +%21 = OpLabel +%23 = OpLoad %float %fi +%24 = OpFOrdLessThan %bool %23 %float_0 +OpSelectionMerge %25 None +OpBranchConditional %24 %26 %27 +%26 = OpLabel +%28 = OpLoad %v4float %BaseColor +%29 = OpLoad %float %f +%30 = OpVectorTimesScalar %v4float %28 %29 +OpStore %gl_FragColor %30 +OpBranch %25 +%27 = OpLabel +%31 = OpLoad %v4float %BaseColor +OpStore %gl_FragColor %31 +OpBranch %25 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(assembly, assembly, true, + true); +} + +TEST_F(LocalSingleStoreElimTest, OptInitializedVariableLikeStore) { + // Initialized variable f is optimized like it was a store. + // Note: The SPIR-V was edited to turn the store to f to an + // an initialization. + // + // #version 140 + // + // void main() + // { + // float f = 0.0; + // gl_FragColor = vec4(f); + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %gl_FragColor "gl_FragColor" +OpDecorate %gl_FragColor Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %6 +%12 = OpLabel +%f = OpVariable %_ptr_Function_float Function %float_0 +%13 = OpLoad %float %f +%14 = OpCompositeConstruct %v4float %13 %13 %13 %13 +OpStore %gl_FragColor %14 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %6 +%12 = OpLabel +%f = OpVariable %_ptr_Function_float Function %float_0 +%14 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %float_0 +OpStore %gl_FragColor %14 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSingleStoreElimTest, PointerVariable) { + // Test that checks if a pointer variable is removed. + + const std::string before = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%26 = OpLoad %_ptr_Uniform__struct_5 %24 +%27 = OpAccessChain %_ptr_Uniform_v4float %26 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%27 = OpAccessChain %_ptr_Uniform_v4float %7 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +// Test that that an unused OpAccessChain between a store and a use does does +// not hinders the replacement of the use. We need to check this because +// local-access-chain-convert does always remove the OpAccessChain instructions +// that become dead. + +TEST_F(LocalSingleStoreElimTest, + StoreElimWithUnusedInterveningAccessChainLoad) { + // Last load of v is eliminated, but access chain load and store of v isn't + // + // #version 140 + // + // in vec4 BaseColor; + // + // void main() + // { + // vec4 v = BaseColor; + // float f = v[3]; + // gl_FragColor = v * f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Function_float = OpTypePointer Function %float +%uint = OpTypeInt 32 0 +%uint_3 = OpConstant %uint 3 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpAccessChain %_ptr_Function_float %v %uint_3 +%21 = OpLoad %v4float %v +OpStore %gl_FragColor %21 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%17 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%18 = OpLoad %v4float %BaseColor +OpStore %v %18 +%19 = OpAccessChain %_ptr_Function_float %v %uint_3 +OpStore %gl_FragColor %18 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// Other types +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_ssa_elim_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_ssa_elim_test.cpp new file mode 100644 index 00000000000..33419395b55 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/local_ssa_elim_test.cpp @@ -0,0 +1,1774 @@ +// Copyright (c) 2017 Valve Corporation +// Copyright (c) 2017 LunarG 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. + +#include +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using LocalSSAElimTest = PassTest<::testing::Test>; + +TEST_F(LocalSSAElimTest, ForLoop) { + // #version 140 + // + // in vec4 BC; + // out float fo; + // + // void main() + // { + // float f = 0.0; + // for (int i=0; i<4; i++) { + // f = f + BC[i]; + // } + // fo = f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %i "i" +OpName %BC "BC" +OpName %fo "fo" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BC = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %23 +%23 = OpLabel +OpLoopMerge %24 %25 None +OpBranch %26 +%26 = OpLabel +%27 = OpLoad %int %i +%28 = OpSLessThan %bool %27 %int_4 +OpBranchConditional %28 %29 %24 +%29 = OpLabel +%30 = OpLoad %float %f +%31 = OpLoad %int %i +%32 = OpAccessChain %_ptr_Input_float %BC %31 +%33 = OpLoad %float %32 +%34 = OpFAdd %float %30 %33 +OpStore %f %34 +OpBranch %25 +%25 = OpLabel +%35 = OpLoad %int %i +%36 = OpIAdd %int %35 %int_1 +OpStore %i %36 +OpBranch %23 +%24 = OpLabel +%37 = OpLoad %float %f +OpStore %fo %37 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%22 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %23 +%23 = OpLabel +%39 = OpPhi %float %float_0 %22 %34 %25 +%38 = OpPhi %int %int_0 %22 %36 %25 +OpLoopMerge %24 %25 None +OpBranch %26 +%26 = OpLabel +%28 = OpSLessThan %bool %38 %int_4 +OpBranchConditional %28 %29 %24 +%29 = OpLabel +%32 = OpAccessChain %_ptr_Input_float %BC %38 +%33 = OpLoad %float %32 +%34 = OpFAdd %float %39 %33 +OpStore %f %34 +OpBranch %25 +%25 = OpLabel +%36 = OpIAdd %int %38 %int_1 +OpStore %i %36 +OpBranch %23 +%24 = OpLabel +OpStore %fo %39 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, NestedForLoop) { + // #version 450 + // + // layout (location=0) in mat4 BC; + // layout (location=0) out float fo; + // + // void main() + // { + // float f = 0.0; + // for (int i=0; i<4; i++) + // for (int j=0; j<4; j++) + // f = f + BC[i][j]; + // fo = f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %f "f" +OpName %i "i" +OpName %j "j" +OpName %BC "BC" +OpName %fo "fo" +OpDecorate %BC Location 0 +OpDecorate %fo Location 0 +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Input_mat4v4float = OpTypePointer Input %mat4v4float +%BC = OpVariable %_ptr_Input_mat4v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%j = OpVariable %_ptr_Function_int Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %25 +%25 = OpLabel +%26 = OpLoad %int %i +%27 = OpSLessThan %bool %26 %int_4 +OpLoopMerge %28 %29 None +OpBranchConditional %27 %30 %28 +%30 = OpLabel +OpStore %j %int_0 +OpBranch %31 +%31 = OpLabel +%32 = OpLoad %int %j +%33 = OpSLessThan %bool %32 %int_4 +OpLoopMerge %29 %34 None +OpBranchConditional %33 %34 %29 +%34 = OpLabel +%35 = OpLoad %float %f +%36 = OpLoad %int %i +%37 = OpLoad %int %j +%38 = OpAccessChain %_ptr_Input_float %BC %36 %37 +%39 = OpLoad %float %38 +%40 = OpFAdd %float %35 %39 +OpStore %f %40 +%41 = OpLoad %int %j +%42 = OpIAdd %int %41 %int_1 +OpStore %j %42 +OpBranch %31 +%29 = OpLabel +%43 = OpLoad %int %i +%44 = OpIAdd %int %43 %int_1 +OpStore %i %44 +OpBranch %25 +%28 = OpLabel +%45 = OpLoad %float %f +OpStore %fo %45 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%j = OpVariable %_ptr_Function_int Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %25 +%25 = OpLabel +%47 = OpPhi %float %float_0 %24 %50 %29 +%46 = OpPhi %int %int_0 %24 %44 %29 +%27 = OpSLessThan %bool %46 %int_4 +OpLoopMerge %28 %29 None +OpBranchConditional %27 %30 %28 +%30 = OpLabel +OpStore %j %int_0 +OpBranch %31 +%31 = OpLabel +%50 = OpPhi %float %47 %30 %40 %34 +%48 = OpPhi %int %int_0 %30 %42 %34 +%33 = OpSLessThan %bool %48 %int_4 +OpLoopMerge %29 %34 None +OpBranchConditional %33 %34 %29 +%34 = OpLabel +%38 = OpAccessChain %_ptr_Input_float %BC %46 %48 +%39 = OpLoad %float %38 +%40 = OpFAdd %float %50 %39 +OpStore %f %40 +%42 = OpIAdd %int %48 %int_1 +OpStore %j %42 +OpBranch %31 +%29 = OpLabel +%44 = OpIAdd %int %46 %int_1 +OpStore %i %44 +OpBranch %25 +%28 = OpLabel +OpStore %fo %47 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, ForLoopWithContinue) { + // #version 140 + // + // in vec4 BC; + // out float fo; + // + // void main() + // { + // float f = 0.0; + // for (int i=0; i<4; i++) { + // float t = BC[i]; + // if (t < 0.0) + // continue; + // f = f + t; + // } + // fo = f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +)"; + + const std::string names = + R"(OpName %main "main" +OpName %f "f" +OpName %i "i" +OpName %t "t" +OpName %BC "BC" +OpName %fo "fo" +)"; + + const std::string predefs2 = + R"(%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BC = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%23 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %24 +%24 = OpLabel +OpLoopMerge %25 %26 None +OpBranch %27 +%27 = OpLabel +%28 = OpLoad %int %i +%29 = OpSLessThan %bool %28 %int_4 +OpBranchConditional %29 %30 %25 +%30 = OpLabel +%31 = OpLoad %int %i +%32 = OpAccessChain %_ptr_Input_float %BC %31 +%33 = OpLoad %float %32 +OpStore %t %33 +%34 = OpLoad %float %t +%35 = OpFOrdLessThan %bool %34 %float_0 +OpSelectionMerge %36 None +OpBranchConditional %35 %37 %36 +%37 = OpLabel +OpBranch %26 +%36 = OpLabel +%38 = OpLoad %float %f +%39 = OpLoad %float %t +%40 = OpFAdd %float %38 %39 +OpStore %f %40 +OpBranch %26 +%26 = OpLabel +%41 = OpLoad %int %i +%42 = OpIAdd %int %41 %int_1 +OpStore %i %42 +OpBranch %24 +%25 = OpLabel +%43 = OpLoad %float %f +OpStore %fo %43 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%23 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %24 +%24 = OpLabel +%45 = OpPhi %float %float_0 %23 %47 %26 +%44 = OpPhi %int %int_0 %23 %42 %26 +OpLoopMerge %25 %26 None +OpBranch %27 +%27 = OpLabel +%29 = OpSLessThan %bool %44 %int_4 +OpBranchConditional %29 %30 %25 +%30 = OpLabel +%32 = OpAccessChain %_ptr_Input_float %BC %44 +%33 = OpLoad %float %32 +OpStore %t %33 +%35 = OpFOrdLessThan %bool %33 %float_0 +OpSelectionMerge %36 None +OpBranchConditional %35 %37 %36 +%37 = OpLabel +OpBranch %26 +%36 = OpLabel +%40 = OpFAdd %float %45 %33 +OpStore %f %40 +OpBranch %26 +%26 = OpLabel +%47 = OpPhi %float %45 %37 %40 %36 +%42 = OpIAdd %int %44 %int_1 +OpStore %i %42 +OpBranch %24 +%25 = OpLabel +OpStore %fo %45 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + names + predefs2 + before, predefs + names + predefs2 + after, + true, true); +} + +TEST_F(LocalSSAElimTest, ForLoopWithBreak) { + // #version 140 + // + // in vec4 BC; + // out float fo; + // + // void main() + // { + // float f = 0.0; + // for (int i=0; i<4; i++) { + // float t = f + BC[i]; + // if (t > 1.0) + // break; + // f = t; + // } + // fo = f; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %i "i" +OpName %t "t" +OpName %BC "BC" +OpName %fo "fo" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BC = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %25 +%25 = OpLabel +OpLoopMerge %26 %27 None +OpBranch %28 +%28 = OpLabel +%29 = OpLoad %int %i +%30 = OpSLessThan %bool %29 %int_4 +OpBranchConditional %30 %31 %26 +%31 = OpLabel +%32 = OpLoad %float %f +%33 = OpLoad %int %i +%34 = OpAccessChain %_ptr_Input_float %BC %33 +%35 = OpLoad %float %34 +%36 = OpFAdd %float %32 %35 +OpStore %t %36 +%37 = OpLoad %float %t +%38 = OpFOrdGreaterThan %bool %37 %float_1 +OpSelectionMerge %39 None +OpBranchConditional %38 %40 %39 +%40 = OpLabel +OpBranch %26 +%39 = OpLabel +%41 = OpLoad %float %t +OpStore %f %41 +OpBranch %27 +%27 = OpLabel +%42 = OpLoad %int %i +%43 = OpIAdd %int %42 %int_1 +OpStore %i %43 +OpBranch %25 +%26 = OpLabel +%44 = OpLoad %float %f +OpStore %fo %44 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %25 +%25 = OpLabel +%46 = OpPhi %float %float_0 %24 %36 %27 +%45 = OpPhi %int %int_0 %24 %43 %27 +OpLoopMerge %26 %27 None +OpBranch %28 +%28 = OpLabel +%30 = OpSLessThan %bool %45 %int_4 +OpBranchConditional %30 %31 %26 +%31 = OpLabel +%34 = OpAccessChain %_ptr_Input_float %BC %45 +%35 = OpLoad %float %34 +%36 = OpFAdd %float %46 %35 +OpStore %t %36 +%38 = OpFOrdGreaterThan %bool %36 %float_1 +OpSelectionMerge %39 None +OpBranchConditional %38 %40 %39 +%40 = OpLabel +OpBranch %26 +%39 = OpLabel +OpStore %f %36 +OpBranch %27 +%27 = OpLabel +%43 = OpIAdd %int %45 %int_1 +OpStore %i %43 +OpBranch %25 +%26 = OpLabel +OpStore %fo %46 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, SwapProblem) { + // #version 140 + // + // in float fe; + // out float fo; + // + // void main() + // { + // float f1 = 0.0; + // float f2 = 1.0; + // int ie = int(fe); + // for (int i=0; i(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, LostCopyProblem) { + // #version 140 + // + // in vec4 BC; + // out float fo; + // + // void main() + // { + // float f = 0.0; + // float t; + // for (int i=0; i<4; i++) { + // t = f; + // f = f + BC[i]; + // if (f > 1.0) + // break; + // } + // fo = t; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %i "i" +OpName %t "t" +OpName %BC "BC" +OpName %fo "fo" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BC = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%24 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %25 +%25 = OpLabel +OpLoopMerge %26 %27 None +OpBranch %28 +%28 = OpLabel +%29 = OpLoad %int %i +%30 = OpSLessThan %bool %29 %int_4 +OpBranchConditional %30 %31 %26 +%31 = OpLabel +%32 = OpLoad %float %f +OpStore %t %32 +%33 = OpLoad %float %f +%34 = OpLoad %int %i +%35 = OpAccessChain %_ptr_Input_float %BC %34 +%36 = OpLoad %float %35 +%37 = OpFAdd %float %33 %36 +OpStore %f %37 +%38 = OpLoad %float %f +%39 = OpFOrdGreaterThan %bool %38 %float_1 +OpSelectionMerge %40 None +OpBranchConditional %39 %41 %40 +%41 = OpLabel +OpBranch %26 +%40 = OpLabel +OpBranch %27 +%27 = OpLabel +%42 = OpLoad %int %i +%43 = OpIAdd %int %42 %int_1 +OpStore %i %43 +OpBranch %25 +%26 = OpLabel +%44 = OpLoad %float %t +OpStore %fo %44 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%49 = OpUndef %float +%main = OpFunction %void None %9 +%24 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_float Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %25 +%25 = OpLabel +%46 = OpPhi %float %float_0 %24 %37 %27 +%45 = OpPhi %int %int_0 %24 %43 %27 +%48 = OpPhi %float %49 %24 %46 %27 +OpLoopMerge %26 %27 None +OpBranch %28 +%28 = OpLabel +%30 = OpSLessThan %bool %45 %int_4 +OpBranchConditional %30 %31 %26 +%31 = OpLabel +OpStore %t %46 +%35 = OpAccessChain %_ptr_Input_float %BC %45 +%36 = OpLoad %float %35 +%37 = OpFAdd %float %46 %36 +OpStore %f %37 +%39 = OpFOrdGreaterThan %bool %37 %float_1 +OpSelectionMerge %40 None +OpBranchConditional %39 %41 %40 +%41 = OpLabel +OpBranch %26 +%40 = OpLabel +OpBranch %27 +%27 = OpLabel +%43 = OpIAdd %int %45 %int_1 +OpStore %i %43 +OpBranch %25 +%26 = OpLabel +%47 = OpPhi %float %48 %28 %46 %41 +OpStore %fo %47 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, IfThenElse) { + // #version 140 + // + // in vec4 BaseColor; + // in float f; + // + // void main() + // { + // vec4 v; + // if (f >= 0) + // v = BaseColor * 0.5; + // else + // v = BaseColor + vec4(1.0,1.0,1.0,1.0); + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %f %BaseColor %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Input_float = OpTypePointer Input %float +%f = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%float_0_5 = OpConstant %float 0.5 +%float_1 = OpConstant %float 1 +%18 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%20 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %float %f +%22 = OpFOrdGreaterThanEqual %bool %21 %float_0 +OpSelectionMerge %23 None +OpBranchConditional %22 %24 %25 +%24 = OpLabel +%26 = OpLoad %v4float %BaseColor +%27 = OpVectorTimesScalar %v4float %26 %float_0_5 +OpStore %v %27 +OpBranch %23 +%25 = OpLabel +%28 = OpLoad %v4float %BaseColor +%29 = OpFAdd %v4float %28 %18 +OpStore %v %29 +OpBranch %23 +%23 = OpLabel +%30 = OpLoad %v4float %v +OpStore %gl_FragColor %30 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%20 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%21 = OpLoad %float %f +%22 = OpFOrdGreaterThanEqual %bool %21 %float_0 +OpSelectionMerge %23 None +OpBranchConditional %22 %24 %25 +%24 = OpLabel +%26 = OpLoad %v4float %BaseColor +%27 = OpVectorTimesScalar %v4float %26 %float_0_5 +OpStore %v %27 +OpBranch %23 +%25 = OpLabel +%28 = OpLoad %v4float %BaseColor +%29 = OpFAdd %v4float %28 %18 +OpStore %v %29 +OpBranch %23 +%23 = OpLabel +%31 = OpPhi %v4float %27 %24 %29 %25 +OpStore %gl_FragColor %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, IfThen) { + // #version 140 + // + // in vec4 BaseColor; + // in float f; + // + // void main() + // { + // vec4 v = BaseColor; + // if (f <= 0) + // v = v * 0.5; + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %f %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %f "f" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%f = OpVariable %_ptr_Input_float Input +%float_0 = OpConstant %float 0 +%bool = OpTypeBool +%float_0_5 = OpConstant %float 0.5 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %8 +%18 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%19 = OpLoad %v4float %BaseColor +OpStore %v %19 +%20 = OpLoad %float %f +%21 = OpFOrdLessThanEqual %bool %20 %float_0 +OpSelectionMerge %22 None +OpBranchConditional %21 %23 %22 +%23 = OpLabel +%24 = OpLoad %v4float %v +%25 = OpVectorTimesScalar %v4float %24 %float_0_5 +OpStore %v %25 +OpBranch %22 +%22 = OpLabel +%26 = OpLoad %v4float %v +OpStore %gl_FragColor %26 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %8 +%18 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%19 = OpLoad %v4float %BaseColor +OpStore %v %19 +%20 = OpLoad %float %f +%21 = OpFOrdLessThanEqual %bool %20 %float_0 +OpSelectionMerge %22 None +OpBranchConditional %21 %23 %22 +%23 = OpLabel +%25 = OpVectorTimesScalar %v4float %19 %float_0_5 +OpStore %v %25 +OpBranch %22 +%22 = OpLabel +%27 = OpPhi %v4float %19 %18 %25 %23 +OpStore %gl_FragColor %27 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, Switch) { + // #version 140 + // + // in vec4 BaseColor; + // in float f; + // + // void main() + // { + // vec4 v = BaseColor; + // int i = int(f); + // switch (i) { + // case 0: + // v = v * 0.25; + // break; + // case 1: + // v = v * 0.625; + // break; + // case 2: + // v = v * 0.75; + // break; + // default: + // break; + // } + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %f %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %i "i" +OpName %f "f" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_float = OpTypePointer Input %float +%f = OpVariable %_ptr_Input_float Input +%float_0_25 = OpConstant %float 0.25 +%float_0_625 = OpConstant %float 0.625 +%float_0_75 = OpConstant %float 0.75 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%22 = OpLoad %v4float %BaseColor +OpStore %v %22 +%23 = OpLoad %float %f +%24 = OpConvertFToS %int %23 +OpStore %i %24 +%25 = OpLoad %int %i +OpSelectionMerge %26 None +OpSwitch %25 %27 0 %28 1 %29 2 %30 +%27 = OpLabel +OpBranch %26 +%28 = OpLabel +%31 = OpLoad %v4float %v +%32 = OpVectorTimesScalar %v4float %31 %float_0_25 +OpStore %v %32 +OpBranch %26 +%29 = OpLabel +%33 = OpLoad %v4float %v +%34 = OpVectorTimesScalar %v4float %33 %float_0_625 +OpStore %v %34 +OpBranch %26 +%30 = OpLabel +%35 = OpLoad %v4float %v +%36 = OpVectorTimesScalar %v4float %35 %float_0_75 +OpStore %v %36 +OpBranch %26 +%26 = OpLabel +%37 = OpLoad %v4float %v +OpStore %gl_FragColor %37 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%22 = OpLoad %v4float %BaseColor +OpStore %v %22 +%23 = OpLoad %float %f +%24 = OpConvertFToS %int %23 +OpStore %i %24 +OpSelectionMerge %26 None +OpSwitch %24 %27 0 %28 1 %29 2 %30 +%27 = OpLabel +OpBranch %26 +%28 = OpLabel +%32 = OpVectorTimesScalar %v4float %22 %float_0_25 +OpStore %v %32 +OpBranch %26 +%29 = OpLabel +%34 = OpVectorTimesScalar %v4float %22 %float_0_625 +OpStore %v %34 +OpBranch %26 +%30 = OpLabel +%36 = OpVectorTimesScalar %v4float %22 %float_0_75 +OpStore %v %36 +OpBranch %26 +%26 = OpLabel +%38 = OpPhi %v4float %22 %27 %32 %28 %34 %29 %36 %30 +OpStore %gl_FragColor %38 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, SwitchWithFallThrough) { + // #version 140 + // + // in vec4 BaseColor; + // in float f; + // + // void main() + // { + // vec4 v = BaseColor; + // int i = int(f); + // switch (i) { + // case 0: + // v = v * 0.25; + // break; + // case 1: + // v = v + 0.25; + // case 2: + // v = v * 0.75; + // break; + // default: + // break; + // } + // gl_FragColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BaseColor %f %gl_FragColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %v "v" +OpName %BaseColor "BaseColor" +OpName %i "i" +OpName %f "f" +OpName %gl_FragColor "gl_FragColor" +%void = OpTypeVoid +%9 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BaseColor = OpVariable %_ptr_Input_v4float Input +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_float = OpTypePointer Input %float +%f = OpVariable %_ptr_Input_float Input +%float_0_25 = OpConstant %float 0.25 +%float_0_75 = OpConstant %float 0.75 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%gl_FragColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string before = + R"(%main = OpFunction %void None %9 +%20 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%21 = OpLoad %v4float %BaseColor +OpStore %v %21 +%22 = OpLoad %float %f +%23 = OpConvertFToS %int %22 +OpStore %i %23 +%24 = OpLoad %int %i +OpSelectionMerge %25 None +OpSwitch %24 %26 0 %27 1 %28 2 %29 +%26 = OpLabel +OpBranch %25 +%27 = OpLabel +%30 = OpLoad %v4float %v +%31 = OpVectorTimesScalar %v4float %30 %float_0_25 +OpStore %v %31 +OpBranch %25 +%28 = OpLabel +%32 = OpLoad %v4float %v +%33 = OpCompositeConstruct %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 +%34 = OpFAdd %v4float %32 %33 +OpStore %v %34 +OpBranch %29 +%29 = OpLabel +%35 = OpLoad %v4float %v +%36 = OpVectorTimesScalar %v4float %35 %float_0_75 +OpStore %v %36 +OpBranch %25 +%25 = OpLabel +%37 = OpLoad %v4float %v +OpStore %gl_FragColor %37 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %9 +%20 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function +%i = OpVariable %_ptr_Function_int Function +%21 = OpLoad %v4float %BaseColor +OpStore %v %21 +%22 = OpLoad %float %f +%23 = OpConvertFToS %int %22 +OpStore %i %23 +OpSelectionMerge %25 None +OpSwitch %23 %26 0 %27 1 %28 2 %29 +%26 = OpLabel +OpBranch %25 +%27 = OpLabel +%31 = OpVectorTimesScalar %v4float %21 %float_0_25 +OpStore %v %31 +OpBranch %25 +%28 = OpLabel +%33 = OpCompositeConstruct %v4float %float_0_25 %float_0_25 %float_0_25 %float_0_25 +%34 = OpFAdd %v4float %21 %33 +OpStore %v %34 +OpBranch %29 +%29 = OpLabel +%38 = OpPhi %v4float %21 %20 %34 %28 +%36 = OpVectorTimesScalar %v4float %38 %float_0_75 +OpStore %v %36 +OpBranch %25 +%25 = OpLabel +%39 = OpPhi %v4float %21 %26 %31 %27 %36 %29 +OpStore %gl_FragColor %39 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(predefs + before, + predefs + after, true, true); +} + +TEST_F(LocalSSAElimTest, DontPatchPhiInLoopHeaderThatIsNotAVar) { + // From https://github.com/KhronosGroup/SPIRV-Tools/issues/826 + // Don't try patching the (%16 %7) value/predecessor pair in the OpPhi. + // That OpPhi is unrelated to this optimization: we did not set that up + // in the SSA initialization for the loop header block. + // The pass should be a no-op on this module. + + const std::string before = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%float_1 = OpConstant %float 1 +%1 = OpFunction %void None %3 +%6 = OpLabel +OpBranch %7 +%7 = OpLabel +%8 = OpPhi %float %float_1 %6 %9 %7 +%9 = OpFAdd %float %8 %float_1 +OpLoopMerge %10 %7 None +OpBranch %7 +%10 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, before, true, true); +} + +TEST_F(LocalSSAElimTest, OptInitializedVariableLikeStore) { + // Note: SPIR-V edited to change store to v into variable initialization + // + // #version 450 + // + // layout (location=0) in vec4 iColor; + // layout (location=1) in float fi; + // layout (location=0) out vec4 oColor; + // + // void main() + // { + // vec4 v = vec4(0.0); + // if (fi < 0.0) + // v.x = iColor.x; + // oColor = v; + // } + + const std::string predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %fi %iColor %oColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %v "v" +OpName %fi "fi" +OpName %iColor "iColor" +OpName %oColor "oColor" +OpDecorate %fi Location 1 +OpDecorate %iColor Location 0 +OpDecorate %oColor Location 0 +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%float_0 = OpConstant %float 0 +%13 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Input_float = OpTypePointer Input %float +%fi = OpVariable %_ptr_Input_float Input +%bool = OpTypeBool +%_ptr_Input_v4float = OpTypePointer Input %v4float +%iColor = OpVariable %_ptr_Input_v4float Input +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Output_v4float = OpTypePointer Output %v4float +%oColor = OpVariable %_ptr_Output_v4float Output +)"; + + const std::string func_before = + R"(%main = OpFunction %void None %8 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function %13 +%22 = OpLoad %float %fi +%23 = OpFOrdLessThan %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %24 +%25 = OpLabel +%26 = OpAccessChain %_ptr_Input_float %iColor %uint_0 +%27 = OpLoad %float %26 +%28 = OpLoad %v4float %v +%29 = OpCompositeInsert %v4float %27 %28 0 +OpStore %v %29 +OpBranch %24 +%24 = OpLabel +%30 = OpLoad %v4float %v +OpStore %oColor %30 +OpReturn +OpFunctionEnd +)"; + + const std::string func_after = + R"(%main = OpFunction %void None %8 +%21 = OpLabel +%v = OpVariable %_ptr_Function_v4float Function %13 +%22 = OpLoad %float %fi +%23 = OpFOrdLessThan %bool %22 %float_0 +OpSelectionMerge %24 None +OpBranchConditional %23 %25 %24 +%25 = OpLabel +%26 = OpAccessChain %_ptr_Input_float %iColor %uint_0 +%27 = OpLoad %float %26 +%29 = OpCompositeInsert %v4float %27 %13 0 +OpStore %v %29 +OpBranch %24 +%24 = OpLabel +%31 = OpPhi %v4float %13 %21 %29 %25 +OpStore %oColor %31 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck( + predefs + func_before, predefs + func_after, true, true); +} + +TEST_F(LocalSSAElimTest, PointerVariable) { + // Test that checks if a pointer variable is removed. + + const std::string before = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%26 = OpLoad %_ptr_Uniform__struct_5 %24 +%27 = OpAccessChain %_ptr_Uniform_v4float %26 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpMemberDecorate %_struct_3 0 Offset 0 +OpDecorate %_runtimearr__struct_3 ArrayStride 16 +OpMemberDecorate %_struct_5 0 Offset 0 +OpDecorate %_struct_5 BufferBlock +OpMemberDecorate %_struct_6 0 Offset 0 +OpDecorate %_struct_6 BufferBlock +OpDecorate %2 Location 0 +OpDecorate %7 DescriptorSet 0 +OpDecorate %7 Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%_struct_3 = OpTypeStruct %v4float +%_runtimearr__struct_3 = OpTypeRuntimeArray %_struct_3 +%_struct_5 = OpTypeStruct %_runtimearr__struct_3 +%_ptr_Uniform__struct_5 = OpTypePointer Uniform %_struct_5 +%_struct_6 = OpTypeStruct %int +%_ptr_Uniform__struct_6 = OpTypePointer Uniform %_struct_6 +%_ptr_Function__ptr_Uniform__struct_5 = OpTypePointer Function %_ptr_Uniform__struct_5 +%_ptr_Function__ptr_Uniform__struct_6 = OpTypePointer Function %_ptr_Uniform__struct_6 +%int_0 = OpConstant %int 0 +%uint_0 = OpConstant %uint 0 +%2 = OpVariable %_ptr_Output_v4float Output +%7 = OpVariable %_ptr_Uniform__struct_5 Uniform +%1 = OpFunction %void None %10 +%23 = OpLabel +%24 = OpVariable %_ptr_Function__ptr_Uniform__struct_5 Function +OpStore %24 %7 +%27 = OpAccessChain %_ptr_Uniform_v4float %7 %int_0 %uint_0 %int_0 +%28 = OpLoad %v4float %27 +%29 = OpCopyObject %v4float %28 +OpStore %2 %28 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, true, true); +} + +TEST_F(LocalSSAElimTest, VerifyInstToBlockMap) { + // #version 140 + // + // in vec4 BC; + // out float fo; + // + // void main() + // { + // float f = 0.0; + // for (int i=0; i<4; i++) { + // f = f + BC[i]; + // } + // fo = f; + // } + + const std::string text = R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %BC %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 140 +OpName %main "main" +OpName %f "f" +OpName %i "i" +OpName %BC "BC" +OpName %fo "fo" +%void = OpTypeVoid +%8 = OpTypeFunction %void +%float = OpTypeFloat 32 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_4 = OpConstant %int 4 +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%BC = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%int_1 = OpConstant %int 1 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %8 +%22 = OpLabel +%f = OpVariable %_ptr_Function_float Function +%i = OpVariable %_ptr_Function_int Function +OpStore %f %float_0 +OpStore %i %int_0 +OpBranch %23 +%23 = OpLabel +OpLoopMerge %24 %25 None +OpBranch %26 +%26 = OpLabel +%27 = OpLoad %int %i +%28 = OpSLessThan %bool %27 %int_4 +OpBranchConditional %28 %29 %24 +%29 = OpLabel +%30 = OpLoad %float %f +%31 = OpLoad %int %i +%32 = OpAccessChain %_ptr_Input_float %BC %31 +%33 = OpLoad %float %32 +%34 = OpFAdd %float %30 %33 +OpStore %f %34 +OpBranch %25 +%25 = OpLabel +%35 = OpLoad %int %i +%36 = OpIAdd %int %35 %int_1 +OpStore %i %36 +OpBranch %23 +%24 = OpLabel +%37 = OpLoad %float %f +OpStore %fo %37 +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, context); + + // Force the instruction to block mapping to get built. + context->get_instr_block(27u); + + auto pass = MakeUnique(); + pass->SetMessageConsumer(nullptr); + const auto status = pass->Run(context.get()); + EXPECT_TRUE(status == Pass::Status::SuccessWithChange); +} + +// TODO(dneto): Add Effcee as required dependency, and make this unconditional. +#ifdef SPIRV_EFFCEE +TEST_F(LocalSSAElimTest, CompositeExtractProblem) { + const std::string spv_asm = R"( + OpCapability Tessellation + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint TessellationControl %2 "main" %16 %17 %18 %20 %22 %26 %27 %30 %31 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %uint = OpTypeInt 32 0 + %uint_3 = OpConstant %uint 3 + %v3float = OpTypeVector %float 3 + %v2float = OpTypeVector %float 2 + %_struct_11 = OpTypeStruct %v4float %v4float %v4float %v3float %v3float %v2float %v2float +%_arr__struct_11_uint_3 = OpTypeArray %_struct_11 %uint_3 +%_ptr_Function__arr__struct_11_uint_3 = OpTypePointer Function %_arr__struct_11_uint_3 +%_arr_v4float_uint_3 = OpTypeArray %v4float %uint_3 +%_ptr_Input__arr_v4float_uint_3 = OpTypePointer Input %_arr_v4float_uint_3 + %16 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input + %17 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input + %18 = OpVariable %_ptr_Input__arr_v4float_uint_3 Input +%_ptr_Input_uint = OpTypePointer Input %uint + %20 = OpVariable %_ptr_Input_uint Input +%_ptr_Output__arr_v4float_uint_3 = OpTypePointer Output %_arr_v4float_uint_3 + %22 = OpVariable %_ptr_Output__arr_v4float_uint_3 Output +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_arr_v3float_uint_3 = OpTypeArray %v3float %uint_3 +%_ptr_Input__arr_v3float_uint_3 = OpTypePointer Input %_arr_v3float_uint_3 + %26 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input + %27 = OpVariable %_ptr_Input__arr_v3float_uint_3 Input +%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3 +%_ptr_Input__arr_v2float_uint_3 = OpTypePointer Input %_arr_v2float_uint_3 + %30 = OpVariable %_ptr_Input__arr_v2float_uint_3 Input + %31 = OpVariable %_ptr_Input__arr_v2float_uint_3 Input +%_ptr_Function__struct_11 = OpTypePointer Function %_struct_11 + %2 = OpFunction %void None %4 + %33 = OpLabel + %34 = OpLoad %_arr_v4float_uint_3 %16 + %35 = OpLoad %_arr_v4float_uint_3 %17 + %36 = OpLoad %_arr_v4float_uint_3 %18 + %37 = OpLoad %_arr_v3float_uint_3 %26 + %38 = OpLoad %_arr_v3float_uint_3 %27 + %39 = OpLoad %_arr_v2float_uint_3 %30 + %40 = OpLoad %_arr_v2float_uint_3 %31 + %41 = OpCompositeExtract %v4float %34 0 + %42 = OpCompositeExtract %v4float %35 0 + %43 = OpCompositeExtract %v4float %36 0 + %44 = OpCompositeExtract %v3float %37 0 + %45 = OpCompositeExtract %v3float %38 0 + %46 = OpCompositeExtract %v2float %39 0 + %47 = OpCompositeExtract %v2float %40 0 + %48 = OpCompositeConstruct %_struct_11 %41 %42 %43 %44 %45 %46 %47 + %49 = OpCompositeExtract %v4float %34 1 + %50 = OpCompositeExtract %v4float %35 1 + %51 = OpCompositeExtract %v4float %36 1 + %52 = OpCompositeExtract %v3float %37 1 + %53 = OpCompositeExtract %v3float %38 1 + %54 = OpCompositeExtract %v2float %39 1 + %55 = OpCompositeExtract %v2float %40 1 + %56 = OpCompositeConstruct %_struct_11 %49 %50 %51 %52 %53 %54 %55 + %57 = OpCompositeExtract %v4float %34 2 + %58 = OpCompositeExtract %v4float %35 2 + %59 = OpCompositeExtract %v4float %36 2 + %60 = OpCompositeExtract %v3float %37 2 + %61 = OpCompositeExtract %v3float %38 2 + %62 = OpCompositeExtract %v2float %39 2 + %63 = OpCompositeExtract %v2float %40 2 + %64 = OpCompositeConstruct %_struct_11 %57 %58 %59 %60 %61 %62 %63 + %65 = OpCompositeConstruct %_arr__struct_11_uint_3 %48 %56 %64 + %66 = OpVariable %_ptr_Function__arr__struct_11_uint_3 Function + %67 = OpLoad %uint %20 + +; CHECK OpStore {{%\d+}} [[store_source:%\d+]] + OpStore %66 %65 + %68 = OpAccessChain %_ptr_Function__struct_11 %66 %67 + +; This load was being removed, because %_ptr_Function__struct_11 was being +; wrongfully considered an SSA target. +; CHECK OpLoad %_struct_11 %68 + %69 = OpLoad %_struct_11 %68 + +; Similarly, %69 cannot be replaced with %65. +; CHECK-NOT: OpCompositeExtract %v4float [[store_source]] 0 + %70 = OpCompositeExtract %v4float %69 0 + + %71 = OpAccessChain %_ptr_Output_v4float %22 %67 + OpStore %71 %70 + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(spv_asm, true); +} + +// Test that the RelaxedPrecision decoration on the variable to added to the +// result of the OpPhi instruction. +TEST_F(LocalSSAElimTest, DecoratedVariable) { + const std::string spv_asm = R"( +; CHECK: OpDecorate [[var:%\w+]] RelaxedPrecision +; CHECK: OpDecorate [[phi_id:%\w+]] RelaxedPrecision +; CHECK: [[phi_id]] = OpPhi + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" + OpDecorate %v RelaxedPrecision + %void = OpTypeVoid + %func_t = OpTypeFunction %void + %bool = OpTypeBool + %true = OpConstantTrue %bool + %int = OpTypeInt 32 0 + %int_p = OpTypePointer Function %int + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %2 = OpFunction %void None %func_t + %33 = OpLabel + %v = OpVariable %int_p Function + OpSelectionMerge %merge None + OpBranchConditional %true %l1 %l2 + %l1 = OpLabel + OpStore %v %int_1 + OpBranch %merge + %l2 = OpLabel + OpStore %v %int_0 + OpBranch %merge + %merge = OpLabel + %ld = OpLoad %int %v + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(spv_asm, true); +} +#endif + +// TODO(greg-lunarg): Add tests to verify handling of these cases: +// +// No optimization in the presence of +// access chains +// function calls +// OpCopyMemory? +// unsupported extensions +// Others? + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/CMakeLists.txt new file mode 100644 index 00000000000..8c7971b7fdf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/CMakeLists.txt @@ -0,0 +1,40 @@ +# Copyright (c) 2017 Google 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. + + +add_spvtools_unittest(TARGET opt_loops + SRCS ../function_utils.h + dependence_analysis.cpp + dependence_analysis_helpers.cpp + fusion_compatibility.cpp + fusion_illegal.cpp + fusion_legal.cpp + fusion_pass.cpp + hoist_all_loop_types.cpp + hoist_double_nested_loops.cpp + hoist_from_independent_loops.cpp + hoist_simple_case.cpp + hoist_single_nested_loops.cpp + hoist_without_preheader.cpp + lcssa.cpp + loop_descriptions.cpp + loop_fission.cpp + nested_loops.cpp + peeling.cpp + peeling_pass.cpp + unroll_assumptions.cpp + unroll_simple.cpp + unswitch.cpp + LIBS SPIRV-Tools-opt +) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp new file mode 100644 index 00000000000..8aeb20afc83 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/dependence_analysis.cpp @@ -0,0 +1,4205 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/tree_iterator.h" +#include "test/opt//assembly_builder.h" +#include "test/opt//function_utils.h" +#include "test/opt//pass_fixture.h" +#include "test/opt//pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using DependencyAnalysis = ::testing::Test; + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void main(){ + int[10] arr; + int[10] arr2; + int a = 2; + for (int i = 0; i < 10; i++) { + arr[a] = arr[3]; + arr[a*2] = arr[a+3]; + arr[6] = arr2[6]; + arr[a+5] = arr2[7]; + } +} +*/ +TEST(DependencyAnalysis, ZIV) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %25 "arr" + OpName %39 "arr2" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %11 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Function %23 + %27 = OpConstant %6 3 + %38 = OpConstant %6 6 + %44 = OpConstant %6 5 + %46 = OpConstant %6 7 + %51 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %25 = OpVariable %24 Function + %39 = OpVariable %24 Function + OpBranch %12 + %12 = OpLabel + %53 = OpPhi %6 %11 %5 %52 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %53 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %28 = OpAccessChain %7 %25 %27 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %7 %25 %9 + OpStore %30 %29 + %32 = OpIMul %6 %9 %9 + %34 = OpIAdd %6 %9 %27 + %35 = OpAccessChain %7 %25 %34 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %7 %25 %32 + OpStore %37 %36 + %40 = OpAccessChain %7 %39 %38 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %7 %25 %38 + OpStore %42 %41 + %45 = OpIAdd %6 %9 %44 + %47 = OpAccessChain %7 %39 %46 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %7 %25 %45 + OpStore %49 %48 + OpBranch %15 + %15 = OpLabel + %52 = OpIAdd %6 %53 %51 + OpBranch %12 + %14 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 13)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // 29 -> 30 tests looking through constants. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(29), + store[0], &distance_vector)); + } + + // 36 -> 37 tests looking through additions. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(36), + store[1], &distance_vector)); + } + + // 41 -> 42 tests looking at same index across two different arrays. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(41), + store[2], &distance_vector)); + } + + // 48 -> 49 tests looking through additions for same index in two different + // arrays. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(48), + store[3], &distance_vector)); + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +layout(location = 0) in vec4 c; +void main(){ + int[10] arr; + int[10] arr2; + int[10] arr3; + int[10] arr4; + int[10] arr5; + int N = int(c.x); + for (int i = 0; i < N; i++) { + arr[2*N] = arr[N]; + arr2[2*N+1] = arr2[N]; + arr3[2*N] = arr3[N-1]; + arr4[N] = arr5[N]; + } +} +*/ +TEST(DependencyAnalysis, SymbolicZIV) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %12 "c" + OpName %33 "arr" + OpName %41 "arr2" + OpName %50 "arr3" + OpName %58 "arr4" + OpName %60 "arr5" + OpDecorate %12 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %20 = OpConstant %6 0 + %28 = OpTypeBool + %30 = OpConstant %13 10 + %31 = OpTypeArray %6 %30 + %32 = OpTypePointer Function %31 + %34 = OpConstant %6 2 + %44 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %33 = OpVariable %32 Function + %41 = OpVariable %32 Function + %50 = OpVariable %32 Function + %58 = OpVariable %32 Function + %60 = OpVariable %32 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpBranch %21 + %21 = OpLabel + %67 = OpPhi %6 %20 %5 %66 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %29 = OpSLessThan %28 %67 %18 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %36 = OpIMul %6 %34 %18 + %38 = OpAccessChain %7 %33 %18 + %39 = OpLoad %6 %38 + %40 = OpAccessChain %7 %33 %36 + OpStore %40 %39 + %43 = OpIMul %6 %34 %18 + %45 = OpIAdd %6 %43 %44 + %47 = OpAccessChain %7 %41 %18 + %48 = OpLoad %6 %47 + %49 = OpAccessChain %7 %41 %45 + OpStore %49 %48 + %52 = OpIMul %6 %34 %18 + %54 = OpISub %6 %18 %44 + %55 = OpAccessChain %7 %50 %54 + %56 = OpLoad %6 %55 + %57 = OpAccessChain %7 %50 %52 + OpStore %57 %56 + %62 = OpAccessChain %7 %60 %18 + %63 = OpLoad %6 %62 + %64 = OpAccessChain %7 %58 %18 + OpStore %64 %63 + OpBranch %24 + %24 = OpLabel + %66 = OpIAdd %6 %67 %44 + OpBranch %21 + %23 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 22)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // independent due to loop bounds (won't enter if N <= 0). + // 39 -> 40 tests looking through symbols and multiplicaiton. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(39), + store[0], &distance_vector)); + } + + // 48 -> 49 tests looking through symbols and multiplication + addition. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(48), + store[1], &distance_vector)); + } + + // 56 -> 57 tests looking through symbols and arithmetic on load and store. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(56), + store[2], &distance_vector)); + } + + // independent as different arrays + // 63 -> 64 tests looking through symbols and load/store from/to different + // arrays. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(63), + store[3], &distance_vector)); + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void a(){ + int[10] arr; + int[11] arr2; + int[20] arr3; + int[20] arr4; + int a = 2; + for (int i = 0; i < 10; i++) { + arr[i] = arr[i]; + arr2[i] = arr2[i+1]; + arr3[i] = arr3[i-1]; + arr4[2*i] = arr4[i]; + } +} +void b(){ + int[10] arr; + int[11] arr2; + int[20] arr3; + int[20] arr4; + int a = 2; + for (int i = 10; i > 0; i--) { + arr[i] = arr[i]; + arr2[i] = arr2[i+1]; + arr3[i] = arr3[i-1]; + arr4[2*i] = arr4[i]; + } +} + +void main() { + a(); + b(); +} +*/ +TEST(DependencyAnalysis, SIV) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %12 "a" + OpName %14 "i" + OpName %29 "arr" + OpName %38 "arr2" + OpName %49 "arr3" + OpName %56 "arr4" + OpName %65 "a" + OpName %66 "i" + OpName %74 "arr" + OpName %80 "arr2" + OpName %87 "arr3" + OpName %94 "arr4" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 2 + %15 = OpConstant %10 0 + %22 = OpConstant %10 10 + %23 = OpTypeBool + %25 = OpTypeInt 32 0 + %26 = OpConstant %25 10 + %27 = OpTypeArray %10 %26 + %28 = OpTypePointer Function %27 + %35 = OpConstant %25 11 + %36 = OpTypeArray %10 %35 + %37 = OpTypePointer Function %36 + %41 = OpConstant %10 1 + %46 = OpConstant %25 20 + %47 = OpTypeArray %10 %46 + %48 = OpTypePointer Function %47 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %103 = OpFunctionCall %2 %6 + %104 = OpFunctionCall %2 %8 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %12 = OpVariable %11 Function + %14 = OpVariable %11 Function + %29 = OpVariable %28 Function + %38 = OpVariable %37 Function + %49 = OpVariable %48 Function + %56 = OpVariable %48 Function + OpStore %12 %13 + OpStore %14 %15 + OpBranch %16 + %16 = OpLabel + %105 = OpPhi %10 %15 %7 %64 %19 + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %24 = OpSLessThan %23 %105 %22 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + %32 = OpAccessChain %11 %29 %105 + %33 = OpLoad %10 %32 + %34 = OpAccessChain %11 %29 %105 + OpStore %34 %33 + %42 = OpIAdd %10 %105 %41 + %43 = OpAccessChain %11 %38 %42 + %44 = OpLoad %10 %43 + %45 = OpAccessChain %11 %38 %105 + OpStore %45 %44 + %52 = OpISub %10 %105 %41 + %53 = OpAccessChain %11 %49 %52 + %54 = OpLoad %10 %53 + %55 = OpAccessChain %11 %49 %105 + OpStore %55 %54 + %58 = OpIMul %10 %13 %105 + %60 = OpAccessChain %11 %56 %105 + %61 = OpLoad %10 %60 + %62 = OpAccessChain %11 %56 %58 + OpStore %62 %61 + OpBranch %19 + %19 = OpLabel + %64 = OpIAdd %10 %105 %41 + OpStore %14 %64 + OpBranch %16 + %18 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %65 = OpVariable %11 Function + %66 = OpVariable %11 Function + %74 = OpVariable %28 Function + %80 = OpVariable %37 Function + %87 = OpVariable %48 Function + %94 = OpVariable %48 Function + OpStore %65 %13 + OpStore %66 %22 + OpBranch %67 + %67 = OpLabel + %106 = OpPhi %10 %22 %9 %102 %70 + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %73 = OpSGreaterThan %23 %106 %15 + OpBranchConditional %73 %68 %69 + %68 = OpLabel + %77 = OpAccessChain %11 %74 %106 + %78 = OpLoad %10 %77 + %79 = OpAccessChain %11 %74 %106 + OpStore %79 %78 + %83 = OpIAdd %10 %106 %41 + %84 = OpAccessChain %11 %80 %83 + %85 = OpLoad %10 %84 + %86 = OpAccessChain %11 %80 %106 + OpStore %86 %85 + %90 = OpISub %10 %106 %41 + %91 = OpAccessChain %11 %87 %90 + %92 = OpLoad %10 %91 + %93 = OpAccessChain %11 %87 %106 + OpStore %93 %92 + %96 = OpIMul %10 %13 %106 + %98 = OpAccessChain %11 %94 %106 + %99 = OpLoad %10 %98 + %100 = OpAccessChain %11 %94 %96 + OpStore %100 %99 + OpBranch %70 + %70 = OpLabel + %102 = OpISub %10 %106 %41 + OpStore %66 %102 + OpBranch %67 + %69 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + // For the loop in function a. + { + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 17)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // = dependence + // 33 -> 34 tests looking at SIV in same array. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(33), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::EQ); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 0); + } + + // > -1 dependence + // 44 -> 45 tests looking at SIV in same array with addition. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(44), store[1], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::GT); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, -1); + } + + // < 1 dependence + // 54 -> 55 tests looking at SIV in same array with subtraction. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(54), store[2], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::LT); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 1); + } + + // <=> dependence + // 61 -> 62 tests looking at SIV in same array with multiplication. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(61), store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::UNKNOWN); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::ALL); + } + } + // For the loop in function b. + { + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 68)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // = dependence + // 78 -> 79 tests looking at SIV in same array. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(78), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::EQ); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 0); + } + + // < 1 dependence + // 85 -> 86 tests looking at SIV in same array with addition. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(85), store[1], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::LT); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 1); + } + + // > -1 dependence + // 92 -> 93 tests looking at SIV in same array with subtraction. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(92), store[2], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::GT); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, -1); + } + + // <=> dependence + // 99 -> 100 tests looking at SIV in same array with multiplication. + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(99), store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::UNKNOWN); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::ALL); + } + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +layout(location = 0) in vec4 c; +void a() { + int[13] arr; + int[15] arr2; + int[18] arr3; + int[18] arr4; + int N = int(c.x); + int C = 2; + int a = 2; + for (int i = 0; i < N; i++) { // Bounds are N - 1 + arr[i+2*N] = arr[i+N]; // |distance| = N + arr2[i+N] = arr2[i+2*N] + C; // |distance| = N + arr3[2*i+2*N+1] = arr3[2*i+N+1]; // |distance| = N + arr4[a*i+N+1] = arr4[a*i+2*N+1]; // |distance| = N + } +} +void b() { + int[13] arr; + int[15] arr2; + int[18] arr3; + int[18] arr4; + int N = int(c.x); + int C = 2; + int a = 2; + for (int i = N; i > 0; i--) { // Bounds are N - 1 + arr[i+2*N] = arr[i+N]; // |distance| = N + arr2[i+N] = arr2[i+2*N] + C; // |distance| = N + arr3[2*i+2*N+1] = arr3[2*i+N+1]; // |distance| = N + arr4[a*i+N+1] = arr4[a*i+2*N+1]; // |distance| = N + } +} +void main(){ + a(); + b(); +}*/ +TEST(DependencyAnalysis, SymbolicSIV) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %12 "N" + OpName %16 "c" + OpName %23 "C" + OpName %25 "a" + OpName %26 "i" + OpName %40 "arr" + OpName %54 "arr2" + OpName %70 "arr3" + OpName %86 "arr4" + OpName %105 "N" + OpName %109 "C" + OpName %110 "a" + OpName %111 "i" + OpName %120 "arr" + OpName %131 "arr2" + OpName %144 "arr3" + OpName %159 "arr4" + OpDecorate %16 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Input %13 + %24 = OpConstant %10 2 + %27 = OpConstant %10 0 + %35 = OpTypeBool + %37 = OpConstant %17 13 + %38 = OpTypeArray %10 %37 + %39 = OpTypePointer Function %38 + %51 = OpConstant %17 15 + %52 = OpTypeArray %10 %51 + %53 = OpTypePointer Function %52 + %67 = OpConstant %17 18 + %68 = OpTypeArray %10 %67 + %69 = OpTypePointer Function %68 + %76 = OpConstant %10 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %178 = OpFunctionCall %2 %6 + %179 = OpFunctionCall %2 %8 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %12 = OpVariable %11 Function + %23 = OpVariable %11 Function + %25 = OpVariable %11 Function + %26 = OpVariable %11 Function + %40 = OpVariable %39 Function + %54 = OpVariable %53 Function + %70 = OpVariable %69 Function + %86 = OpVariable %69 Function + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %13 %20 + %22 = OpConvertFToS %10 %21 + OpStore %12 %22 + OpStore %23 %24 + OpStore %25 %24 + OpStore %26 %27 + OpBranch %28 + %28 = OpLabel + %180 = OpPhi %10 %27 %7 %104 %31 + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %36 = OpSLessThan %35 %180 %22 + OpBranchConditional %36 %29 %30 + %29 = OpLabel + %43 = OpIMul %10 %24 %22 + %44 = OpIAdd %10 %180 %43 + %47 = OpIAdd %10 %180 %22 + %48 = OpAccessChain %11 %40 %47 + %49 = OpLoad %10 %48 + %50 = OpAccessChain %11 %40 %44 + OpStore %50 %49 + %57 = OpIAdd %10 %180 %22 + %60 = OpIMul %10 %24 %22 + %61 = OpIAdd %10 %180 %60 + %62 = OpAccessChain %11 %54 %61 + %63 = OpLoad %10 %62 + %65 = OpIAdd %10 %63 %24 + %66 = OpAccessChain %11 %54 %57 + OpStore %66 %65 + %72 = OpIMul %10 %24 %180 + %74 = OpIMul %10 %24 %22 + %75 = OpIAdd %10 %72 %74 + %77 = OpIAdd %10 %75 %76 + %79 = OpIMul %10 %24 %180 + %81 = OpIAdd %10 %79 %22 + %82 = OpIAdd %10 %81 %76 + %83 = OpAccessChain %11 %70 %82 + %84 = OpLoad %10 %83 + %85 = OpAccessChain %11 %70 %77 + OpStore %85 %84 + %89 = OpIMul %10 %24 %180 + %91 = OpIAdd %10 %89 %22 + %92 = OpIAdd %10 %91 %76 + %95 = OpIMul %10 %24 %180 + %97 = OpIMul %10 %24 %22 + %98 = OpIAdd %10 %95 %97 + %99 = OpIAdd %10 %98 %76 + %100 = OpAccessChain %11 %86 %99 + %101 = OpLoad %10 %100 + %102 = OpAccessChain %11 %86 %92 + OpStore %102 %101 + OpBranch %31 + %31 = OpLabel + %104 = OpIAdd %10 %180 %76 + OpStore %26 %104 + OpBranch %28 + %30 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %105 = OpVariable %11 Function + %109 = OpVariable %11 Function + %110 = OpVariable %11 Function + %111 = OpVariable %11 Function + %120 = OpVariable %39 Function + %131 = OpVariable %53 Function + %144 = OpVariable %69 Function + %159 = OpVariable %69 Function + %106 = OpAccessChain %19 %16 %18 + %107 = OpLoad %13 %106 + %108 = OpConvertFToS %10 %107 + OpStore %105 %108 + OpStore %109 %24 + OpStore %110 %24 + OpStore %111 %108 + OpBranch %113 + %113 = OpLabel + %181 = OpPhi %10 %108 %9 %177 %116 + OpLoopMerge %115 %116 None + OpBranch %117 + %117 = OpLabel + %119 = OpSGreaterThan %35 %181 %27 + OpBranchConditional %119 %114 %115 + %114 = OpLabel + %123 = OpIMul %10 %24 %108 + %124 = OpIAdd %10 %181 %123 + %127 = OpIAdd %10 %181 %108 + %128 = OpAccessChain %11 %120 %127 + %129 = OpLoad %10 %128 + %130 = OpAccessChain %11 %120 %124 + OpStore %130 %129 + %134 = OpIAdd %10 %181 %108 + %137 = OpIMul %10 %24 %108 + %138 = OpIAdd %10 %181 %137 + %139 = OpAccessChain %11 %131 %138 + %140 = OpLoad %10 %139 + %142 = OpIAdd %10 %140 %24 + %143 = OpAccessChain %11 %131 %134 + OpStore %143 %142 + %146 = OpIMul %10 %24 %181 + %148 = OpIMul %10 %24 %108 + %149 = OpIAdd %10 %146 %148 + %150 = OpIAdd %10 %149 %76 + %152 = OpIMul %10 %24 %181 + %154 = OpIAdd %10 %152 %108 + %155 = OpIAdd %10 %154 %76 + %156 = OpAccessChain %11 %144 %155 + %157 = OpLoad %10 %156 + %158 = OpAccessChain %11 %144 %150 + OpStore %158 %157 + %162 = OpIMul %10 %24 %181 + %164 = OpIAdd %10 %162 %108 + %165 = OpIAdd %10 %164 %76 + %168 = OpIMul %10 %24 %181 + %170 = OpIMul %10 %24 %108 + %171 = OpIAdd %10 %168 %170 + %172 = OpIAdd %10 %171 %76 + %173 = OpAccessChain %11 %159 %172 + %174 = OpLoad %10 %173 + %175 = OpAccessChain %11 %159 %165 + OpStore %175 %174 + OpBranch %116 + %116 = OpLabel + %177 = OpISub %10 %181 %76 + OpStore %111 %177 + OpBranch %113 + %115 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + // For the loop in function a. + { + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 29)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // independent due to loop bounds (won't enter when N <= 0) + // 49 -> 50 tests looking through SIV and symbols with multiplication + { + DistanceVector distance_vector{loops.size()}; + // Independent but not yet supported. + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(49), store[0], &distance_vector)); + } + + // 63 -> 66 tests looking through SIV and symbols with multiplication and + + // C + { + DistanceVector distance_vector{loops.size()}; + // Independent. + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(63), + store[1], &distance_vector)); + } + + // 84 -> 85 tests looking through arithmetic on SIV and symbols + { + DistanceVector distance_vector{loops.size()}; + // Independent but not yet supported. + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(84), store[2], &distance_vector)); + } + + // 101 -> 102 tests looking through symbol arithmetic on SIV and symbols + { + DistanceVector distance_vector{loops.size()}; + // Independent. + EXPECT_TRUE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(101), store[3], &distance_vector)); + } + } + // For the loop in function b. + { + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 114)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // independent due to loop bounds (won't enter when N <= 0). + // 129 -> 130 tests looking through SIV and symbols with multiplication. + { + DistanceVector distance_vector{loops.size()}; + // Independent but not yet supported. + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(129), store[0], &distance_vector)); + } + + // 140 -> 143 tests looking through SIV and symbols with multiplication and + // + C. + { + DistanceVector distance_vector{loops.size()}; + // Independent. + EXPECT_TRUE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(140), store[1], &distance_vector)); + } + + // 157 -> 158 tests looking through arithmetic on SIV and symbols. + { + DistanceVector distance_vector{loops.size()}; + // Independent but not yet supported. + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(157), store[2], &distance_vector)); + } + + // 174 -> 175 tests looking through symbol arithmetic on SIV and symbols. + { + DistanceVector distance_vector{loops.size()}; + // Independent. + EXPECT_TRUE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(174), store[3], &distance_vector)); + } + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void a() { + int[6] arr; + int N = 5; + for (int i = 1; i < N; i++) { + arr[i] = arr[N-i]; + } +} +void b() { + int[6] arr; + int N = 5; + for (int i = 1; i < N; i++) { + arr[N-i] = arr[i]; + } +} +void c() { + int[11] arr; + int N = 10; + for (int i = 1; i < N; i++) { + arr[i] = arr[N-i+1]; + } +} +void d() { + int[11] arr; + int N = 10; + for (int i = 1; i < N; i++) { + arr[N-i+1] = arr[i]; + } +} +void e() { + int[6] arr; + int N = 5; + for (int i = N; i > 0; i--) { + arr[i] = arr[N-i]; + } +} +void f() { + int[6] arr; + int N = 5; + for (int i = N; i > 0; i--) { + arr[N-i] = arr[i]; + } +} +void g() { + int[11] arr; + int N = 10; + for (int i = N; i > 0; i--) { + arr[i] = arr[N-i+1]; + } +} +void h() { + int[11] arr; + int N = 10; + for (int i = N; i > 0; i--) { + arr[N-i+1] = arr[i]; + } +} +void main(){ + a(); + b(); + c(); + d(); + e(); + f(); + g(); + h(); +} +*/ +TEST(DependencyAnalysis, Crossing) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %14 "e(" + OpName %16 "f(" + OpName %18 "g(" + OpName %20 "h(" + OpName %24 "N" + OpName %26 "i" + OpName %41 "arr" + OpName %51 "N" + OpName %52 "i" + OpName %61 "arr" + OpName %71 "N" + OpName %73 "i" + OpName %85 "arr" + OpName %96 "N" + OpName %97 "i" + OpName %106 "arr" + OpName %117 "N" + OpName %118 "i" + OpName %128 "arr" + OpName %138 "N" + OpName %139 "i" + OpName %148 "arr" + OpName %158 "N" + OpName %159 "i" + OpName %168 "arr" + OpName %179 "N" + OpName %180 "i" + OpName %189 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %22 = OpTypeInt 32 1 + %23 = OpTypePointer Function %22 + %25 = OpConstant %22 5 + %27 = OpConstant %22 1 + %35 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 6 + %39 = OpTypeArray %22 %38 + %40 = OpTypePointer Function %39 + %72 = OpConstant %22 10 + %82 = OpConstant %37 11 + %83 = OpTypeArray %22 %82 + %84 = OpTypePointer Function %83 + %126 = OpConstant %22 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %200 = OpFunctionCall %2 %6 + %201 = OpFunctionCall %2 %8 + %202 = OpFunctionCall %2 %10 + %203 = OpFunctionCall %2 %12 + %204 = OpFunctionCall %2 %14 + %205 = OpFunctionCall %2 %16 + %206 = OpFunctionCall %2 %18 + %207 = OpFunctionCall %2 %20 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %24 = OpVariable %23 Function + %26 = OpVariable %23 Function + %41 = OpVariable %40 Function + OpStore %24 %25 + OpStore %26 %27 + OpBranch %28 + %28 = OpLabel + %208 = OpPhi %22 %27 %7 %50 %31 + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %36 = OpSLessThan %35 %208 %25 + OpBranchConditional %36 %29 %30 + %29 = OpLabel + %45 = OpISub %22 %25 %208 + %46 = OpAccessChain %23 %41 %45 + %47 = OpLoad %22 %46 + %48 = OpAccessChain %23 %41 %208 + OpStore %48 %47 + OpBranch %31 + %31 = OpLabel + %50 = OpIAdd %22 %208 %27 + OpStore %26 %50 + OpBranch %28 + %30 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %51 = OpVariable %23 Function + %52 = OpVariable %23 Function + %61 = OpVariable %40 Function + OpStore %51 %25 + OpStore %52 %27 + OpBranch %53 + %53 = OpLabel + %209 = OpPhi %22 %27 %9 %70 %56 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %60 = OpSLessThan %35 %209 %25 + OpBranchConditional %60 %54 %55 + %54 = OpLabel + %64 = OpISub %22 %25 %209 + %66 = OpAccessChain %23 %61 %209 + %67 = OpLoad %22 %66 + %68 = OpAccessChain %23 %61 %64 + OpStore %68 %67 + OpBranch %56 + %56 = OpLabel + %70 = OpIAdd %22 %209 %27 + OpStore %52 %70 + OpBranch %53 + %55 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %71 = OpVariable %23 Function + %73 = OpVariable %23 Function + %85 = OpVariable %84 Function + OpStore %71 %72 + OpStore %73 %27 + OpBranch %74 + %74 = OpLabel + %210 = OpPhi %22 %27 %11 %95 %77 + OpLoopMerge %76 %77 None + OpBranch %78 + %78 = OpLabel + %81 = OpSLessThan %35 %210 %72 + OpBranchConditional %81 %75 %76 + %75 = OpLabel + %89 = OpISub %22 %72 %210 + %90 = OpIAdd %22 %89 %27 + %91 = OpAccessChain %23 %85 %90 + %92 = OpLoad %22 %91 + %93 = OpAccessChain %23 %85 %210 + OpStore %93 %92 + OpBranch %77 + %77 = OpLabel + %95 = OpIAdd %22 %210 %27 + OpStore %73 %95 + OpBranch %74 + %76 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %96 = OpVariable %23 Function + %97 = OpVariable %23 Function + %106 = OpVariable %84 Function + OpStore %96 %72 + OpStore %97 %27 + OpBranch %98 + %98 = OpLabel + %211 = OpPhi %22 %27 %13 %116 %101 + OpLoopMerge %100 %101 None + OpBranch %102 + %102 = OpLabel + %105 = OpSLessThan %35 %211 %72 + OpBranchConditional %105 %99 %100 + %99 = OpLabel + %109 = OpISub %22 %72 %211 + %110 = OpIAdd %22 %109 %27 + %112 = OpAccessChain %23 %106 %211 + %113 = OpLoad %22 %112 + %114 = OpAccessChain %23 %106 %110 + OpStore %114 %113 + OpBranch %101 + %101 = OpLabel + %116 = OpIAdd %22 %211 %27 + OpStore %97 %116 + OpBranch %98 + %100 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %117 = OpVariable %23 Function + %118 = OpVariable %23 Function + %128 = OpVariable %40 Function + OpStore %117 %25 + OpStore %118 %25 + OpBranch %120 + %120 = OpLabel + %212 = OpPhi %22 %25 %15 %137 %123 + OpLoopMerge %122 %123 None + OpBranch %124 + %124 = OpLabel + %127 = OpSGreaterThan %35 %212 %126 + OpBranchConditional %127 %121 %122 + %121 = OpLabel + %132 = OpISub %22 %25 %212 + %133 = OpAccessChain %23 %128 %132 + %134 = OpLoad %22 %133 + %135 = OpAccessChain %23 %128 %212 + OpStore %135 %134 + OpBranch %123 + %123 = OpLabel + %137 = OpISub %22 %212 %27 + OpStore %118 %137 + OpBranch %120 + %122 = OpLabel + OpReturn + OpFunctionEnd + %16 = OpFunction %2 None %3 + %17 = OpLabel + %138 = OpVariable %23 Function + %139 = OpVariable %23 Function + %148 = OpVariable %40 Function + OpStore %138 %25 + OpStore %139 %25 + OpBranch %141 + %141 = OpLabel + %213 = OpPhi %22 %25 %17 %157 %144 + OpLoopMerge %143 %144 None + OpBranch %145 + %145 = OpLabel + %147 = OpSGreaterThan %35 %213 %126 + OpBranchConditional %147 %142 %143 + %142 = OpLabel + %151 = OpISub %22 %25 %213 + %153 = OpAccessChain %23 %148 %213 + %154 = OpLoad %22 %153 + %155 = OpAccessChain %23 %148 %151 + OpStore %155 %154 + OpBranch %144 + %144 = OpLabel + %157 = OpISub %22 %213 %27 + OpStore %139 %157 + OpBranch %141 + %143 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %158 = OpVariable %23 Function + %159 = OpVariable %23 Function + %168 = OpVariable %84 Function + OpStore %158 %72 + OpStore %159 %72 + OpBranch %161 + %161 = OpLabel + %214 = OpPhi %22 %72 %19 %178 %164 + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %167 = OpSGreaterThan %35 %214 %126 + OpBranchConditional %167 %162 %163 + %162 = OpLabel + %172 = OpISub %22 %72 %214 + %173 = OpIAdd %22 %172 %27 + %174 = OpAccessChain %23 %168 %173 + %175 = OpLoad %22 %174 + %176 = OpAccessChain %23 %168 %214 + OpStore %176 %175 + OpBranch %164 + %164 = OpLabel + %178 = OpISub %22 %214 %27 + OpStore %159 %178 + OpBranch %161 + %163 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpFunction %2 None %3 + %21 = OpLabel + %179 = OpVariable %23 Function + %180 = OpVariable %23 Function + %189 = OpVariable %84 Function + OpStore %179 %72 + OpStore %180 %72 + OpBranch %182 + %182 = OpLabel + %215 = OpPhi %22 %72 %21 %199 %185 + OpLoopMerge %184 %185 None + OpBranch %186 + %186 = OpLabel + %188 = OpSGreaterThan %35 %215 %126 + OpBranchConditional %188 %183 %184 + %183 = OpLabel + %192 = OpISub %22 %72 %215 + %193 = OpIAdd %22 %192 %27 + %195 = OpAccessChain %23 %189 %215 + %196 = OpLoad %22 %195 + %197 = OpAccessChain %23 %189 %193 + OpStore %197 %196 + OpBranch %185 + %185 = OpLabel + %199 = OpISub %22 %215 %27 + OpStore %180 %199 + OpBranch %182 + %184 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + // First two tests can be split into two loops. + // Tests even crossing subscripts from low to high indexes. + // 47 -> 48 + { + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 29)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(47), + store, &distance_vector)); + } + + // Tests even crossing subscripts from high to low indexes. + // 67 -> 68 + { + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 54)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(67), + store, &distance_vector)); + } + + // Next two tests can have an end peeled, then be split. + // Tests uneven crossing subscripts from low to high indexes. + // 92 -> 93 + { + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 75)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(92), + store, &distance_vector)); + } + + // Tests uneven crossing subscripts from high to low indexes. + // 113 -> 114 + { + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 99)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(113), + store, &distance_vector)); + } + + // First two tests can be split into two loops. + // Tests even crossing subscripts from low to high indexes. + // 134 -> 135 + { + const Function* f = spvtest::GetFunction(module, 14); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 121)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(134), + store, &distance_vector)); + } + + // Tests even crossing subscripts from high to low indexes. + // 154 -> 155 + { + const Function* f = spvtest::GetFunction(module, 16); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 142)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(154), + store, &distance_vector)); + } + + // Next two tests can have an end peeled, then be split. + // Tests uneven crossing subscripts from low to high indexes. + // 175 -> 176 + { + const Function* f = spvtest::GetFunction(module, 18); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 162)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(175), + store, &distance_vector)); + } + + // Tests uneven crossing subscripts from high to low indexes. + // 196 -> 197 + { + const Function* f = spvtest::GetFunction(module, 20); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 183)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + } + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(196), + store, &distance_vector)); + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void a() { + int[10] arr; + for (int i = 0; i < 10; i++) { + arr[0] = arr[i]; // peel first + arr[i] = arr[0]; // peel first + arr[9] = arr[i]; // peel last + arr[i] = arr[9]; // peel last + } +} +void b() { + int[11] arr; + for (int i = 0; i <= 10; i++) { + arr[0] = arr[i]; // peel first + arr[i] = arr[0]; // peel first + arr[10] = arr[i]; // peel last + arr[i] = arr[10]; // peel last + + } +} +void c() { + int[11] arr; + for (int i = 10; i > 0; i--) { + arr[10] = arr[i]; // peel first + arr[i] = arr[10]; // peel first + arr[1] = arr[i]; // peel last + arr[i] = arr[1]; // peel last + + } +} +void d() { + int[11] arr; + for (int i = 10; i >= 0; i--) { + arr[10] = arr[i]; // peel first + arr[i] = arr[10]; // peel first + arr[0] = arr[i]; // peel last + arr[i] = arr[0]; // peel last + + } +} +void main(){ + a(); + b(); + c(); + d(); +} +*/ +TEST(DependencyAnalysis, WeakZeroSIV) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %16 "i" + OpName %31 "arr" + OpName %52 "i" + OpName %63 "arr" + OpName %82 "i" + OpName %90 "arr" + OpName %109 "i" + OpName %117 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %14 = OpTypeInt 32 1 + %15 = OpTypePointer Function %14 + %17 = OpConstant %14 0 + %24 = OpConstant %14 10 + %25 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %14 %28 + %30 = OpTypePointer Function %29 + %40 = OpConstant %14 9 + %50 = OpConstant %14 1 + %60 = OpConstant %27 11 + %61 = OpTypeArray %14 %60 + %62 = OpTypePointer Function %61 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %136 = OpFunctionCall %2 %6 + %137 = OpFunctionCall %2 %8 + %138 = OpFunctionCall %2 %10 + %139 = OpFunctionCall %2 %12 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpVariable %15 Function + %31 = OpVariable %30 Function + OpStore %16 %17 + OpBranch %18 + %18 = OpLabel + %140 = OpPhi %14 %17 %7 %51 %21 + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %26 = OpSLessThan %25 %140 %24 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + %33 = OpAccessChain %15 %31 %140 + %34 = OpLoad %14 %33 + %35 = OpAccessChain %15 %31 %17 + OpStore %35 %34 + %37 = OpAccessChain %15 %31 %17 + %38 = OpLoad %14 %37 + %39 = OpAccessChain %15 %31 %140 + OpStore %39 %38 + %42 = OpAccessChain %15 %31 %140 + %43 = OpLoad %14 %42 + %44 = OpAccessChain %15 %31 %40 + OpStore %44 %43 + %46 = OpAccessChain %15 %31 %40 + %47 = OpLoad %14 %46 + %48 = OpAccessChain %15 %31 %140 + OpStore %48 %47 + OpBranch %21 + %21 = OpLabel + %51 = OpIAdd %14 %140 %50 + OpStore %16 %51 + OpBranch %18 + %20 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %52 = OpVariable %15 Function + %63 = OpVariable %62 Function + OpStore %52 %17 + OpBranch %53 + %53 = OpLabel + %141 = OpPhi %14 %17 %9 %81 %56 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %59 = OpSLessThanEqual %25 %141 %24 + OpBranchConditional %59 %54 %55 + %54 = OpLabel + %65 = OpAccessChain %15 %63 %141 + %66 = OpLoad %14 %65 + %67 = OpAccessChain %15 %63 %17 + OpStore %67 %66 + %69 = OpAccessChain %15 %63 %17 + %70 = OpLoad %14 %69 + %71 = OpAccessChain %15 %63 %141 + OpStore %71 %70 + %73 = OpAccessChain %15 %63 %141 + %74 = OpLoad %14 %73 + %75 = OpAccessChain %15 %63 %24 + OpStore %75 %74 + %77 = OpAccessChain %15 %63 %24 + %78 = OpLoad %14 %77 + %79 = OpAccessChain %15 %63 %141 + OpStore %79 %78 + OpBranch %56 + %56 = OpLabel + %81 = OpIAdd %14 %141 %50 + OpStore %52 %81 + OpBranch %53 + %55 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %82 = OpVariable %15 Function + %90 = OpVariable %62 Function + OpStore %82 %24 + OpBranch %83 + %83 = OpLabel + %142 = OpPhi %14 %24 %11 %108 %86 + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %89 = OpSGreaterThan %25 %142 %17 + OpBranchConditional %89 %84 %85 + %84 = OpLabel + %92 = OpAccessChain %15 %90 %142 + %93 = OpLoad %14 %92 + %94 = OpAccessChain %15 %90 %24 + OpStore %94 %93 + %96 = OpAccessChain %15 %90 %24 + %97 = OpLoad %14 %96 + %98 = OpAccessChain %15 %90 %142 + OpStore %98 %97 + %100 = OpAccessChain %15 %90 %142 + %101 = OpLoad %14 %100 + %102 = OpAccessChain %15 %90 %50 + OpStore %102 %101 + %104 = OpAccessChain %15 %90 %50 + %105 = OpLoad %14 %104 + %106 = OpAccessChain %15 %90 %142 + OpStore %106 %105 + OpBranch %86 + %86 = OpLabel + %108 = OpISub %14 %142 %50 + OpStore %82 %108 + OpBranch %83 + %85 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %109 = OpVariable %15 Function + %117 = OpVariable %62 Function + OpStore %109 %24 + OpBranch %110 + %110 = OpLabel + %143 = OpPhi %14 %24 %13 %135 %113 + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %116 = OpSGreaterThanEqual %25 %143 %17 + OpBranchConditional %116 %111 %112 + %111 = OpLabel + %119 = OpAccessChain %15 %117 %143 + %120 = OpLoad %14 %119 + %121 = OpAccessChain %15 %117 %24 + OpStore %121 %120 + %123 = OpAccessChain %15 %117 %24 + %124 = OpLoad %14 %123 + %125 = OpAccessChain %15 %117 %143 + OpStore %125 %124 + %127 = OpAccessChain %15 %117 %143 + %128 = OpLoad %14 %127 + %129 = OpAccessChain %15 %117 %17 + OpStore %129 %128 + %131 = OpAccessChain %15 %117 %17 + %132 = OpLoad %14 %131 + %133 = OpAccessChain %15 %117 %143 + OpStore %133 %132 + OpBranch %113 + %113 = OpLabel + %135 = OpISub %14 %143 %50 + OpStore %109 %135 + OpBranch %110 + %112 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + // For the loop in function a + { + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 19)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 34 -> 35 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(34), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 38 -> 39 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(38), store[1], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 43 -> 44 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(43), store[2], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 47 -> 48 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(47), store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + } + // For the loop in function b + { + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 54)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 66 -> 67 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(66), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 70 -> 71 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(70), store[1], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 74 -> 75 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(74), store[2], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 78 -> 79 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(78), store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + } + // For the loop in function c + { + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 84)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 93 -> 94 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(93), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 97 -> 98 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(97), store[1], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 101 -> 102 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(101), store[2], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 105 -> 106 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(105), store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + } + // For the loop in function d + { + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[4]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 111)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 4; ++i) { + EXPECT_TRUE(store[i]); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 120 -> 121 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(120), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 124 -> 125 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(124), store[1], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_first); + } + + // Tests identifying peel first with weak zero with destination as zero + // index. + // 128 -> 129 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(128), store[2], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + + // Tests identifying peel first with weak zero with source as zero index. + // 132 -> 133 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(132), store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::PEEL); + EXPECT_TRUE(distance_vector.GetEntries()[0].peel_last); + } + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void main(){ + int[10][10] arr; + for (int i = 0; i < 10; i++) { + arr[i][i] = arr[i][i]; + arr[0][i] = arr[1][i]; + arr[1][i] = arr[0][i]; + arr[i][0] = arr[i][1]; + arr[i][1] = arr[i][0]; + arr[0][1] = arr[1][0]; + } +} +*/ +TEST(DependencyAnalysis, MultipleSubscriptZIVSIV) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %24 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypeArray %21 %20 + %23 = OpTypePointer Function %22 + %33 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %24 = OpVariable %23 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %58 = OpPhi %6 %9 %5 %57 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %58 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %29 = OpAccessChain %7 %24 %58 %58 + %30 = OpLoad %6 %29 + %31 = OpAccessChain %7 %24 %58 %58 + OpStore %31 %30 + %35 = OpAccessChain %7 %24 %33 %58 + %36 = OpLoad %6 %35 + %37 = OpAccessChain %7 %24 %9 %58 + OpStore %37 %36 + %40 = OpAccessChain %7 %24 %9 %58 + %41 = OpLoad %6 %40 + %42 = OpAccessChain %7 %24 %33 %58 + OpStore %42 %41 + %45 = OpAccessChain %7 %24 %58 %33 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %7 %24 %58 %9 + OpStore %47 %46 + %50 = OpAccessChain %7 %24 %58 %9 + %51 = OpLoad %6 %50 + %52 = OpAccessChain %7 %24 %58 %33 + OpStore %52 %51 + %53 = OpAccessChain %7 %24 %33 %9 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %7 %24 %9 %33 + OpStore %55 %54 + OpBranch %13 + %13 = OpLabel + %57 = OpIAdd %6 %58 %33 + OpStore %8 %57 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[6]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 11)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 6; ++i) { + EXPECT_TRUE(store[i]); + } + + // 30 -> 31 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(30), + store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::EQ); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 0); + } + + // 36 -> 37 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(36), + store[1], &distance_vector)); + } + + // 41 -> 42 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(41), + store[2], &distance_vector)); + } + + // 46 -> 47 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(46), + store[3], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::EQ); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 0); + } + + // 51 -> 52 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(51), + store[4], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::EQ); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 0); + } + + // 54 -> 55 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_TRUE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(54), + store[5], &distance_vector)); + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void a(){ + int[10] arr; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + arr[j] = arr[j]; + } + } +} +void b(){ + int[10] arr; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + arr[i] = arr[i]; + } + } +} +void main() { + a(); + b(); +} +*/ +TEST(DependencyAnalysis, IrrelevantSubscripts) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %12 "i" + OpName %23 "j" + OpName %35 "arr" + OpName %46 "i" + OpName %54 "j" + OpName %62 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 0 + %20 = OpConstant %10 10 + %21 = OpTypeBool + %31 = OpTypeInt 32 0 + %32 = OpConstant %31 10 + %33 = OpTypeArray %10 %32 + %34 = OpTypePointer Function %33 + %42 = OpConstant %10 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %72 = OpFunctionCall %2 %6 + %73 = OpFunctionCall %2 %8 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %12 = OpVariable %11 Function + %23 = OpVariable %11 Function + %35 = OpVariable %34 Function + OpStore %12 %13 + OpBranch %14 + %14 = OpLabel + %74 = OpPhi %10 %13 %7 %45 %17 + OpLoopMerge %16 %17 None + OpBranch %18 + %18 = OpLabel + %22 = OpSLessThan %21 %74 %20 + OpBranchConditional %22 %15 %16 + %15 = OpLabel + OpStore %23 %13 + OpBranch %24 + %24 = OpLabel + %75 = OpPhi %10 %13 %15 %43 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %30 = OpSLessThan %21 %75 %20 + OpBranchConditional %30 %25 %26 + %25 = OpLabel + %38 = OpAccessChain %11 %35 %75 + %39 = OpLoad %10 %38 + %40 = OpAccessChain %11 %35 %75 + OpStore %40 %39 + OpBranch %27 + %27 = OpLabel + %43 = OpIAdd %10 %75 %42 + OpStore %23 %43 + OpBranch %24 + %26 = OpLabel + OpBranch %17 + %17 = OpLabel + %45 = OpIAdd %10 %74 %42 + OpStore %12 %45 + OpBranch %14 + %16 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %46 = OpVariable %11 Function + %54 = OpVariable %11 Function + %62 = OpVariable %34 Function + OpStore %46 %13 + OpBranch %47 + %47 = OpLabel + %77 = OpPhi %10 %13 %9 %71 %50 + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %53 = OpSLessThan %21 %77 %20 + OpBranchConditional %53 %48 %49 + %48 = OpLabel + OpStore %54 %13 + OpBranch %55 + %55 = OpLabel + %78 = OpPhi %10 %13 %48 %69 %58 + OpLoopMerge %57 %58 None + OpBranch %59 + %59 = OpLabel + %61 = OpSLessThan %21 %78 %20 + OpBranchConditional %61 %56 %57 + %56 = OpLabel + %65 = OpAccessChain %11 %62 %77 + %66 = OpLoad %10 %65 + %67 = OpAccessChain %11 %62 %77 + OpStore %67 %66 + OpBranch %58 + %58 = OpLabel + %69 = OpIAdd %10 %78 %42 + OpStore %54 %69 + OpBranch %55 + %57 = OpLabel + OpBranch %50 + %50 = OpLabel + %71 = OpIAdd %10 %77 %42 + OpStore %46 %71 + OpBranch %47 + %49 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + // For the loop in function a + { + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + std::vector loops{&ld.GetLoopByIndex(1), + &ld.GetLoopByIndex(0)}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[1]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 25)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 1; ++i) { + EXPECT_TRUE(store[i]); + } + + // 39 -> 40 + { + DistanceVector distance_vector{loops.size()}; + analysis.SetDebugStream(std::cout); + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(39), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::IRRELEVANT); + EXPECT_EQ(distance_vector.GetEntries()[1].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[1].distance, 0); + } + } + + // For the loop in function b + { + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + std::vector loops{&ld.GetLoopByIndex(1), + &ld.GetLoopByIndex(0)}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[1]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 56)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 1; ++i) { + EXPECT_TRUE(store[i]); + } + + // 66 -> 67 + { + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.GetDependence( + context->get_def_use_mgr()->GetDef(66), store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::DISTANCE); + EXPECT_EQ(distance_vector.GetEntries()[0].distance, 0); + EXPECT_EQ(distance_vector.GetEntries()[1].dependence_information, + DistanceEntry::DependenceInformation::IRRELEVANT); + } + } +} + +void CheckDependenceAndDirection(const Instruction* source, + const Instruction* destination, + bool expected_dependence, + DistanceVector expected_distance, + LoopDependenceAnalysis* analysis) { + DistanceVector dv_entry(2); + EXPECT_EQ(expected_dependence, + analysis->GetDependence(source, destination, &dv_entry)); + EXPECT_EQ(expected_distance, dv_entry); +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +layout(location = 0) in vec4 c; +void main(){ + int[10] arr; + int a = 2; + int b = 3; + int N = int(c.x); + for (int i = 0; i < 10; i++) { + for (int j = 2; j < 10; j++) { + arr[i] = arr[j]; // 0 + arr[j] = arr[i]; // 1 + arr[j-2] = arr[i+3]; // 2 + arr[j-a] = arr[i+b]; // 3 + arr[2*i] = arr[4*j+3]; // 4, independent + arr[2*i] = arr[4*j]; // 5 + arr[i+j] = arr[i+j]; // 6 + arr[10*i+j] = arr[10*i+j]; // 7 + arr[10*i+10*j] = arr[10*i+10*j+3]; // 8, independent + arr[10*i+10*j] = arr[10*i+N*j+3]; // 9, bail out because of N coefficient + arr[10*i+10*j] = arr[10*i+10*j+N]; // 10, bail out because of N constant + // term + arr[10*i+N*j] = arr[10*i+10*j+3]; // 11, bail out because of N coefficient + arr[10*i+10*j+N] = arr[10*i+10*j]; // 12, bail out because of N constant + // term + arr[10*i] = arr[5*j]; // 13, independent + arr[5*i] = arr[10*j]; // 14, independent + arr[9*i] = arr[3*j]; // 15, independent + arr[3*i] = arr[9*j]; // 16, independent + } + } +} +*/ +TEST(DependencyAnalysis, MIV) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "a" + OpName %10 "b" + OpName %12 "N" + OpName %16 "c" + OpName %23 "i" + OpName %34 "j" + OpName %45 "arr" + OpDecorate %16 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 2 + %11 = OpConstant %6 3 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Input %13 + %24 = OpConstant %6 0 + %31 = OpConstant %6 10 + %32 = OpTypeBool + %42 = OpConstant %17 10 + %43 = OpTypeArray %6 %42 + %44 = OpTypePointer Function %43 + %74 = OpConstant %6 4 + %184 = OpConstant %6 5 + %197 = OpConstant %6 9 + %213 = OpConstant %6 1 + %218 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %12 = OpVariable %7 Function + %23 = OpVariable %7 Function + %34 = OpVariable %7 Function + %45 = OpVariable %44 Function + OpStore %8 %9 + OpStore %10 %11 + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %13 %20 + %22 = OpConvertFToS %6 %21 + OpStore %12 %22 + OpStore %23 %24 + OpBranch %25 + %25 = OpLabel + %217 = OpPhi %6 %24 %5 %216 %28 + %219 = OpPhi %6 %218 %5 %220 %28 + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %33 = OpSLessThan %32 %217 %31 + OpBranchConditional %33 %26 %27 + %26 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %220 = OpPhi %6 %9 %26 %214 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %32 %220 %31 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %48 = OpAccessChain %7 %45 %220 + %49 = OpLoad %6 %48 + %50 = OpAccessChain %7 %45 %217 + OpStore %50 %49 + %53 = OpAccessChain %7 %45 %217 + %54 = OpLoad %6 %53 + %55 = OpAccessChain %7 %45 %220 + OpStore %55 %54 + %57 = OpISub %6 %220 %9 + %59 = OpIAdd %6 %217 %11 + %60 = OpAccessChain %7 %45 %59 + %61 = OpLoad %6 %60 + %62 = OpAccessChain %7 %45 %57 + OpStore %62 %61 + %65 = OpISub %6 %220 %9 + %68 = OpIAdd %6 %217 %11 + %69 = OpAccessChain %7 %45 %68 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %7 %45 %65 + OpStore %71 %70 + %73 = OpIMul %6 %9 %217 + %76 = OpIMul %6 %74 %220 + %77 = OpIAdd %6 %76 %11 + %78 = OpAccessChain %7 %45 %77 + %79 = OpLoad %6 %78 + %80 = OpAccessChain %7 %45 %73 + OpStore %80 %79 + %82 = OpIMul %6 %9 %217 + %84 = OpIMul %6 %74 %220 + %85 = OpAccessChain %7 %45 %84 + %86 = OpLoad %6 %85 + %87 = OpAccessChain %7 %45 %82 + OpStore %87 %86 + %90 = OpIAdd %6 %217 %220 + %93 = OpIAdd %6 %217 %220 + %94 = OpAccessChain %7 %45 %93 + %95 = OpLoad %6 %94 + %96 = OpAccessChain %7 %45 %90 + OpStore %96 %95 + %98 = OpIMul %6 %31 %217 + %100 = OpIAdd %6 %98 %220 + %102 = OpIMul %6 %31 %217 + %104 = OpIAdd %6 %102 %220 + %105 = OpAccessChain %7 %45 %104 + %106 = OpLoad %6 %105 + %107 = OpAccessChain %7 %45 %100 + OpStore %107 %106 + %109 = OpIMul %6 %31 %217 + %111 = OpIMul %6 %31 %220 + %112 = OpIAdd %6 %109 %111 + %114 = OpIMul %6 %31 %217 + %116 = OpIMul %6 %31 %220 + %117 = OpIAdd %6 %114 %116 + %118 = OpIAdd %6 %117 %11 + %119 = OpAccessChain %7 %45 %118 + %120 = OpLoad %6 %119 + %121 = OpAccessChain %7 %45 %112 + OpStore %121 %120 + %123 = OpIMul %6 %31 %217 + %125 = OpIMul %6 %31 %220 + %126 = OpIAdd %6 %123 %125 + %128 = OpIMul %6 %31 %217 + %131 = OpIMul %6 %22 %220 + %132 = OpIAdd %6 %128 %131 + %133 = OpIAdd %6 %132 %11 + %134 = OpAccessChain %7 %45 %133 + %135 = OpLoad %6 %134 + %136 = OpAccessChain %7 %45 %126 + OpStore %136 %135 + %138 = OpIMul %6 %31 %217 + %140 = OpIMul %6 %31 %220 + %141 = OpIAdd %6 %138 %140 + %143 = OpIMul %6 %31 %217 + %145 = OpIMul %6 %31 %220 + %146 = OpIAdd %6 %143 %145 + %148 = OpIAdd %6 %146 %22 + %149 = OpAccessChain %7 %45 %148 + %150 = OpLoad %6 %149 + %151 = OpAccessChain %7 %45 %141 + OpStore %151 %150 + %153 = OpIMul %6 %31 %217 + %156 = OpIMul %6 %22 %220 + %157 = OpIAdd %6 %153 %156 + %159 = OpIMul %6 %31 %217 + %161 = OpIMul %6 %31 %220 + %162 = OpIAdd %6 %159 %161 + %163 = OpIAdd %6 %162 %11 + %164 = OpAccessChain %7 %45 %163 + %165 = OpLoad %6 %164 + %166 = OpAccessChain %7 %45 %157 + OpStore %166 %165 + %168 = OpIMul %6 %31 %217 + %170 = OpIMul %6 %31 %220 + %171 = OpIAdd %6 %168 %170 + %173 = OpIAdd %6 %171 %22 + %175 = OpIMul %6 %31 %217 + %177 = OpIMul %6 %31 %220 + %178 = OpIAdd %6 %175 %177 + %179 = OpAccessChain %7 %45 %178 + %180 = OpLoad %6 %179 + %181 = OpAccessChain %7 %45 %173 + OpStore %181 %180 + %183 = OpIMul %6 %31 %217 + %186 = OpIMul %6 %184 %220 + %187 = OpAccessChain %7 %45 %186 + %188 = OpLoad %6 %187 + %189 = OpAccessChain %7 %45 %183 + OpStore %189 %188 + %191 = OpIMul %6 %184 %217 + %193 = OpIMul %6 %31 %220 + %194 = OpAccessChain %7 %45 %193 + %195 = OpLoad %6 %194 + %196 = OpAccessChain %7 %45 %191 + OpStore %196 %195 + %199 = OpIMul %6 %197 %217 + %201 = OpIMul %6 %11 %220 + %202 = OpAccessChain %7 %45 %201 + %203 = OpLoad %6 %202 + %204 = OpAccessChain %7 %45 %199 + OpStore %204 %203 + %206 = OpIMul %6 %11 %217 + %208 = OpIMul %6 %197 %220 + %209 = OpAccessChain %7 %45 %208 + %210 = OpLoad %6 %209 + %211 = OpAccessChain %7 %45 %206 + OpStore %211 %210 + OpBranch %38 + %38 = OpLabel + %214 = OpIAdd %6 %220 %213 + OpStore %34 %214 + OpBranch %35 + %37 = OpLabel + OpBranch %28 + %28 = OpLabel + %216 = OpIAdd %6 %217 %213 + OpStore %23 %216 + OpBranch %25 + %27 = OpLabel + OpReturn + OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + std::vector loops{&ld.GetLoopByIndex(0), &ld.GetLoopByIndex(1)}; + + LoopDependenceAnalysis analysis{context.get(), loops}; + + const int instructions_expected = 17; + const Instruction* store[instructions_expected]; + const Instruction* load[instructions_expected]; + int stores_found = 0; + int loads_found = 0; + + int block_id = 36; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load[loads_found] = &inst; + ++loads_found; + } + } + + EXPECT_EQ(instructions_expected, stores_found); + EXPECT_EQ(instructions_expected, loads_found); + + auto directions_all = DistanceEntry(DistanceEntry::Directions::ALL); + auto directions_none = DistanceEntry(DistanceEntry::Directions::NONE); + + auto dependent = DistanceVector({directions_all, directions_all}); + auto independent = DistanceVector({directions_none, directions_none}); + + CheckDependenceAndDirection(load[0], store[0], false, dependent, &analysis); + CheckDependenceAndDirection(load[1], store[1], false, dependent, &analysis); + CheckDependenceAndDirection(load[2], store[2], false, dependent, &analysis); + CheckDependenceAndDirection(load[3], store[3], false, dependent, &analysis); + CheckDependenceAndDirection(load[4], store[4], true, independent, &analysis); + CheckDependenceAndDirection(load[5], store[5], false, dependent, &analysis); + CheckDependenceAndDirection(load[6], store[6], false, dependent, &analysis); + CheckDependenceAndDirection(load[7], store[7], false, dependent, &analysis); + CheckDependenceAndDirection(load[8], store[8], true, independent, &analysis); + CheckDependenceAndDirection(load[9], store[9], false, dependent, &analysis); + CheckDependenceAndDirection(load[10], store[10], false, dependent, &analysis); + CheckDependenceAndDirection(load[11], store[11], false, dependent, &analysis); + CheckDependenceAndDirection(load[12], store[12], false, dependent, &analysis); + CheckDependenceAndDirection(load[13], store[13], true, independent, + &analysis); + CheckDependenceAndDirection(load[14], store[14], true, independent, + &analysis); + CheckDependenceAndDirection(load[15], store[15], true, independent, + &analysis); + CheckDependenceAndDirection(load[16], store[16], true, independent, + &analysis); +} + +void PartitionSubscripts(const Instruction* instruction_0, + const Instruction* instruction_1, + LoopDependenceAnalysis* analysis, + std::vector> expected_ids) { + auto subscripts_0 = analysis->GetSubscripts(instruction_0); + auto subscripts_1 = analysis->GetSubscripts(instruction_1); + + std::vector>> + expected_partition{}; + + for (const auto& partition : expected_ids) { + expected_partition.push_back( + std::set>{}); + for (auto id : partition) { + expected_partition.back().insert({subscripts_0[id], subscripts_1[id]}); + } + } + + EXPECT_EQ(expected_partition, + analysis->PartitionSubscripts(subscripts_0, subscripts_1)); +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void main(){ + int[10][10][10][10] arr; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + for (int k = 0; k < 10; k++) { + for (int l = 0; l < 10; l++) { + arr[i][j][k][l] = arr[i][j][k][l]; // 0, all independent + arr[i][j][k][l] = arr[i][j][l][0]; // 1, last 2 coupled + arr[i][j][k][l] = arr[j][i][k][l]; // 2, first 2 coupled + arr[i][j][k][l] = arr[l][j][k][i]; // 3, first & last coupled + arr[i][j][k][l] = arr[i][k][j][l]; // 4, middle 2 coupled + arr[i+j][j][k][l] = arr[i][j][k][l]; // 5, first 2 coupled + arr[i+j+k][j][k][l] = arr[i][j][k][l]; // 6, first 3 coupled + arr[i+j+k+l][j][k][l] = arr[i][j][k][l]; // 7, all 4 coupled + arr[i][j][k][l] = arr[i][l][j][k]; // 8, last 3 coupled + arr[i][j-k][k][l] = arr[i][j][l][k]; // 9, last 3 coupled + arr[i][j][k][l] = arr[l][i][j][k]; // 10, all 4 coupled + arr[i][j][k][l] = arr[j][i][l][k]; // 11, 2 coupled partitions (i,j) & +(l&k) + arr[i][j][k][l] = arr[k][l][i][j]; // 12, 2 coupled partitions (i,k) & +(j&l) + } + } + } + } +} +*/ +TEST(DependencyAnalysis, SubscriptPartitioning) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %27 "k" + OpName %35 "l" + OpName %50 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %43 = OpTypeInt 32 0 + %44 = OpConstant %43 10 + %45 = OpTypeArray %6 %44 + %46 = OpTypeArray %45 %44 + %47 = OpTypeArray %46 %44 + %48 = OpTypeArray %47 %44 + %49 = OpTypePointer Function %48 + %208 = OpConstant %6 1 + %217 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %27 = OpVariable %7 Function + %35 = OpVariable %7 Function + %50 = OpVariable %49 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %216 = OpPhi %6 %9 %5 %215 %13 + %218 = OpPhi %6 %217 %5 %221 %13 + %219 = OpPhi %6 %217 %5 %222 %13 + %220 = OpPhi %6 %217 %5 %223 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %216 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %221 = OpPhi %6 %9 %11 %213 %23 + %222 = OpPhi %6 %219 %11 %224 %23 + %223 = OpPhi %6 %220 %11 %225 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %221 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + OpStore %27 %9 + OpBranch %28 + %28 = OpLabel + %224 = OpPhi %6 %9 %21 %211 %31 + %225 = OpPhi %6 %223 %21 %226 %31 + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %34 = OpSLessThan %17 %224 %16 + OpBranchConditional %34 %29 %30 + %29 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + %226 = OpPhi %6 %9 %29 %209 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %17 %226 %16 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %59 = OpAccessChain %7 %50 %216 %221 %224 %226 + %60 = OpLoad %6 %59 + %61 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %61 %60 + %69 = OpAccessChain %7 %50 %216 %221 %226 %9 + %70 = OpLoad %6 %69 + %71 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %71 %70 + %80 = OpAccessChain %7 %50 %221 %216 %224 %226 + %81 = OpLoad %6 %80 + %82 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %82 %81 + %91 = OpAccessChain %7 %50 %226 %221 %224 %216 + %92 = OpLoad %6 %91 + %93 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %93 %92 + %102 = OpAccessChain %7 %50 %216 %224 %221 %226 + %103 = OpLoad %6 %102 + %104 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %104 %103 + %107 = OpIAdd %6 %216 %221 + %115 = OpAccessChain %7 %50 %216 %221 %224 %226 + %116 = OpLoad %6 %115 + %117 = OpAccessChain %7 %50 %107 %221 %224 %226 + OpStore %117 %116 + %120 = OpIAdd %6 %216 %221 + %122 = OpIAdd %6 %120 %224 + %130 = OpAccessChain %7 %50 %216 %221 %224 %226 + %131 = OpLoad %6 %130 + %132 = OpAccessChain %7 %50 %122 %221 %224 %226 + OpStore %132 %131 + %135 = OpIAdd %6 %216 %221 + %137 = OpIAdd %6 %135 %224 + %139 = OpIAdd %6 %137 %226 + %147 = OpAccessChain %7 %50 %216 %221 %224 %226 + %148 = OpLoad %6 %147 + %149 = OpAccessChain %7 %50 %139 %221 %224 %226 + OpStore %149 %148 + %158 = OpAccessChain %7 %50 %216 %226 %221 %224 + %159 = OpLoad %6 %158 + %160 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %160 %159 + %164 = OpISub %6 %221 %224 + %171 = OpAccessChain %7 %50 %216 %221 %226 %224 + %172 = OpLoad %6 %171 + %173 = OpAccessChain %7 %50 %216 %164 %224 %226 + OpStore %173 %172 + %182 = OpAccessChain %7 %50 %226 %216 %221 %224 + %183 = OpLoad %6 %182 + %184 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %184 %183 + %193 = OpAccessChain %7 %50 %221 %216 %226 %224 + %194 = OpLoad %6 %193 + %195 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %195 %194 + %204 = OpAccessChain %7 %50 %224 %226 %216 %221 + %205 = OpLoad %6 %204 + %206 = OpAccessChain %7 %50 %216 %221 %224 %226 + OpStore %206 %205 + OpBranch %39 + %39 = OpLabel + %209 = OpIAdd %6 %226 %208 + OpStore %35 %209 + OpBranch %36 + %38 = OpLabel + OpBranch %31 + %31 = OpLabel + %211 = OpIAdd %6 %224 %208 + OpStore %27 %211 + OpBranch %28 + %30 = OpLabel + OpBranch %23 + %23 = OpLabel + %213 = OpIAdd %6 %221 %208 + OpStore %19 %213 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %215 = OpIAdd %6 %216 %208 + OpStore %8 %215 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + std::vector loop_nest{ + &ld.GetLoopByIndex(0), &ld.GetLoopByIndex(1), &ld.GetLoopByIndex(2), + &ld.GetLoopByIndex(3)}; + LoopDependenceAnalysis analysis{context.get(), loop_nest}; + + const int instructions_expected = 13; + const Instruction* store[instructions_expected]; + const Instruction* load[instructions_expected]; + int stores_found = 0; + int loads_found = 0; + + int block_id = 37; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load[loads_found] = &inst; + ++loads_found; + } + } + + EXPECT_EQ(instructions_expected, stores_found); + EXPECT_EQ(instructions_expected, loads_found); + + PartitionSubscripts(load[0], store[0], &analysis, {{0}, {1}, {2}, {3}}); + PartitionSubscripts(load[1], store[1], &analysis, {{0}, {1}, {2, 3}}); + PartitionSubscripts(load[2], store[2], &analysis, {{0, 1}, {2}, {3}}); + PartitionSubscripts(load[3], store[3], &analysis, {{0, 3}, {1}, {2}}); + PartitionSubscripts(load[4], store[4], &analysis, {{0}, {1, 2}, {3}}); + PartitionSubscripts(load[5], store[5], &analysis, {{0, 1}, {2}, {3}}); + PartitionSubscripts(load[6], store[6], &analysis, {{0, 1, 2}, {3}}); + PartitionSubscripts(load[7], store[7], &analysis, {{0, 1, 2, 3}}); + PartitionSubscripts(load[8], store[8], &analysis, {{0}, {1, 2, 3}}); + PartitionSubscripts(load[9], store[9], &analysis, {{0}, {1, 2, 3}}); + PartitionSubscripts(load[10], store[10], &analysis, {{0, 1, 2, 3}}); + PartitionSubscripts(load[11], store[11], &analysis, {{0, 1}, {2, 3}}); + PartitionSubscripts(load[12], store[12], &analysis, {{0, 2}, {1, 3}}); +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store + +#version 440 core +void a() { + int[10][10] arr; + for (int i = 0; i < 10; ++i) { + for (int j = 0; j < 10; ++j) { + // Dependent, distance vector (1, -1) + arr[i+1][i+j] = arr[i][i+j]; + } + } +} + +void b() { + int[10][10] arr; + for (int i = 0; i < 10; ++i) { + // Independent + arr[i+1][i+2] = arr[i][i] + 2; + } +} + +void c() { + int[10][10] arr; + for (int i = 0; i < 10; ++i) { + // Dependence point (1,2) + arr[i][i] = arr[1][i-1] + 2; + } +} + +void d() { + int[10][10][10] arr; + for (int i = 0; i < 10; ++i) { + for (int j = 0; j < 10; ++j) { + for (int k = 0; k < 10; ++k) { + // Dependent, distance vector (1,1,-1) + arr[j-i][i+1][j+k] = arr[j-i][i][j+k]; + } + } + } +} + +void e() { + int[10][10] arr; + for (int i = 0; i < 10; ++i) { + for (int j = 0; j < 10; ++j) { + // Independent with GCD after propagation + arr[i][2*j+i] = arr[i][2*j-i+5]; + } + } +} + +void main(){ + a(); + b(); + c(); + d(); + e(); +} +*/ +TEST(DependencyAnalysis, Delta) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %14 "e(" + OpName %18 "i" + OpName %29 "j" + OpName %42 "arr" + OpName %60 "i" + OpName %68 "arr" + OpName %82 "i" + OpName %90 "arr" + OpName %101 "i" + OpName %109 "j" + OpName %117 "k" + OpName %127 "arr" + OpName %152 "i" + OpName %160 "j" + OpName %168 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %16 = OpTypeInt 32 1 + %17 = OpTypePointer Function %16 + %19 = OpConstant %16 0 + %26 = OpConstant %16 10 + %27 = OpTypeBool + %37 = OpTypeInt 32 0 + %38 = OpConstant %37 10 + %39 = OpTypeArray %16 %38 + %40 = OpTypeArray %39 %38 + %41 = OpTypePointer Function %40 + %44 = OpConstant %16 1 + %72 = OpConstant %16 2 + %125 = OpTypeArray %40 %38 + %126 = OpTypePointer Function %125 + %179 = OpConstant %16 5 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %188 = OpFunctionCall %2 %6 + %189 = OpFunctionCall %2 %8 + %190 = OpFunctionCall %2 %10 + %191 = OpFunctionCall %2 %12 + %192 = OpFunctionCall %2 %14 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %18 = OpVariable %17 Function + %29 = OpVariable %17 Function + %42 = OpVariable %41 Function + OpStore %18 %19 + OpBranch %20 + %20 = OpLabel + %193 = OpPhi %16 %19 %7 %59 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %28 = OpSLessThan %27 %193 %26 + OpBranchConditional %28 %21 %22 + %21 = OpLabel + OpStore %29 %19 + OpBranch %30 + %30 = OpLabel + %194 = OpPhi %16 %19 %21 %57 %33 + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %36 = OpSLessThan %27 %194 %26 + OpBranchConditional %36 %31 %32 + %31 = OpLabel + %45 = OpIAdd %16 %193 %44 + %48 = OpIAdd %16 %193 %194 + %52 = OpIAdd %16 %193 %194 + %53 = OpAccessChain %17 %42 %193 %52 + %54 = OpLoad %16 %53 + %55 = OpAccessChain %17 %42 %45 %48 + OpStore %55 %54 + OpBranch %33 + %33 = OpLabel + %57 = OpIAdd %16 %194 %44 + OpStore %29 %57 + OpBranch %30 + %32 = OpLabel + OpBranch %23 + %23 = OpLabel + %59 = OpIAdd %16 %193 %44 + OpStore %18 %59 + OpBranch %20 + %22 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %60 = OpVariable %17 Function + %68 = OpVariable %41 Function + OpStore %60 %19 + OpBranch %61 + %61 = OpLabel + %196 = OpPhi %16 %19 %9 %81 %64 + OpLoopMerge %63 %64 None + OpBranch %65 + %65 = OpLabel + %67 = OpSLessThan %27 %196 %26 + OpBranchConditional %67 %62 %63 + %62 = OpLabel + %70 = OpIAdd %16 %196 %44 + %73 = OpIAdd %16 %196 %72 + %76 = OpAccessChain %17 %68 %196 %196 + %77 = OpLoad %16 %76 + %78 = OpIAdd %16 %77 %72 + %79 = OpAccessChain %17 %68 %70 %73 + OpStore %79 %78 + OpBranch %64 + %64 = OpLabel + %81 = OpIAdd %16 %196 %44 + OpStore %60 %81 + OpBranch %61 + %63 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %82 = OpVariable %17 Function + %90 = OpVariable %41 Function + OpStore %82 %19 + OpBranch %83 + %83 = OpLabel + %197 = OpPhi %16 %19 %11 %100 %86 + OpLoopMerge %85 %86 None + OpBranch %87 + %87 = OpLabel + %89 = OpSLessThan %27 %197 %26 + OpBranchConditional %89 %84 %85 + %84 = OpLabel + %94 = OpISub %16 %197 %44 + %95 = OpAccessChain %17 %90 %44 %94 + %96 = OpLoad %16 %95 + %97 = OpIAdd %16 %96 %72 + %98 = OpAccessChain %17 %90 %197 %197 + OpStore %98 %97 + OpBranch %86 + %86 = OpLabel + %100 = OpIAdd %16 %197 %44 + OpStore %82 %100 + OpBranch %83 + %85 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %101 = OpVariable %17 Function + %109 = OpVariable %17 Function + %117 = OpVariable %17 Function + %127 = OpVariable %126 Function + OpStore %101 %19 + OpBranch %102 + %102 = OpLabel + %198 = OpPhi %16 %19 %13 %151 %105 + OpLoopMerge %104 %105 None + OpBranch %106 + %106 = OpLabel + %108 = OpSLessThan %27 %198 %26 + OpBranchConditional %108 %103 %104 + %103 = OpLabel + OpStore %109 %19 + OpBranch %110 + %110 = OpLabel + %199 = OpPhi %16 %19 %103 %149 %113 + OpLoopMerge %112 %113 None + OpBranch %114 + %114 = OpLabel + %116 = OpSLessThan %27 %199 %26 + OpBranchConditional %116 %111 %112 + %111 = OpLabel + OpStore %117 %19 + OpBranch %118 + %118 = OpLabel + %201 = OpPhi %16 %19 %111 %147 %121 + OpLoopMerge %120 %121 None + OpBranch %122 + %122 = OpLabel + %124 = OpSLessThan %27 %201 %26 + OpBranchConditional %124 %119 %120 + %119 = OpLabel + %130 = OpISub %16 %199 %198 + %132 = OpIAdd %16 %198 %44 + %135 = OpIAdd %16 %199 %201 + %138 = OpISub %16 %199 %198 + %142 = OpIAdd %16 %199 %201 + %143 = OpAccessChain %17 %127 %138 %198 %142 + %144 = OpLoad %16 %143 + %145 = OpAccessChain %17 %127 %130 %132 %135 + OpStore %145 %144 + OpBranch %121 + %121 = OpLabel + %147 = OpIAdd %16 %201 %44 + OpStore %117 %147 + OpBranch %118 + %120 = OpLabel + OpBranch %113 + %113 = OpLabel + %149 = OpIAdd %16 %199 %44 + OpStore %109 %149 + OpBranch %110 + %112 = OpLabel + OpBranch %105 + %105 = OpLabel + %151 = OpIAdd %16 %198 %44 + OpStore %101 %151 + OpBranch %102 + %104 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %152 = OpVariable %17 Function + %160 = OpVariable %17 Function + %168 = OpVariable %41 Function + OpStore %152 %19 + OpBranch %153 + %153 = OpLabel + %204 = OpPhi %16 %19 %15 %187 %156 + OpLoopMerge %155 %156 None + OpBranch %157 + %157 = OpLabel + %159 = OpSLessThan %27 %204 %26 + OpBranchConditional %159 %154 %155 + %154 = OpLabel + OpStore %160 %19 + OpBranch %161 + %161 = OpLabel + %205 = OpPhi %16 %19 %154 %185 %164 + OpLoopMerge %163 %164 None + OpBranch %165 + %165 = OpLabel + %167 = OpSLessThan %27 %205 %26 + OpBranchConditional %167 %162 %163 + %162 = OpLabel + %171 = OpIMul %16 %72 %205 + %173 = OpIAdd %16 %171 %204 + %176 = OpIMul %16 %72 %205 + %178 = OpISub %16 %176 %204 + %180 = OpIAdd %16 %178 %179 + %181 = OpAccessChain %17 %168 %204 %180 + %182 = OpLoad %16 %181 + %183 = OpAccessChain %17 %168 %204 %173 + OpStore %183 %182 + OpBranch %164 + %164 = OpLabel + %185 = OpIAdd %16 %205 %44 + OpStore %160 %185 + OpBranch %161 + %163 = OpLabel + OpBranch %156 + %156 = OpLabel + %187 = OpIAdd %16 %204 %44 + OpStore %152 %187 + OpBranch %153 + %155 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + ASSERT_NE(nullptr, context); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + { + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + const Instruction* store = nullptr; + const Instruction* load = nullptr; + + int block_id = 31; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(nullptr, store); + EXPECT_NE(nullptr, load); + + std::vector loop_nest{&ld.GetLoopByIndex(0), + &ld.GetLoopByIndex(1)}; + LoopDependenceAnalysis analysis{context.get(), loop_nest}; + + DistanceVector dv_entry(loop_nest.size()); + + std::vector expected_entries{ + DistanceEntry(DistanceEntry::Directions::LT, 1), + DistanceEntry(DistanceEntry::Directions::LT, 1)}; + + DistanceVector expected_distance_vector(expected_entries); + + auto is_independent = analysis.GetDependence(load, store, &dv_entry); + + EXPECT_FALSE(is_independent); + EXPECT_EQ(expected_distance_vector, dv_entry); + } + + { + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + const Instruction* store = nullptr; + const Instruction* load = nullptr; + + int block_id = 62; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(nullptr, store); + EXPECT_NE(nullptr, load); + + std::vector loop_nest{&ld.GetLoopByIndex(0)}; + LoopDependenceAnalysis analysis{context.get(), loop_nest}; + + DistanceVector dv_entry(loop_nest.size()); + auto is_independent = analysis.GetDependence(load, store, &dv_entry); + + EXPECT_TRUE(is_independent); + } + + { + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + const Instruction* store = nullptr; + const Instruction* load = nullptr; + + int block_id = 84; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(nullptr, store); + EXPECT_NE(nullptr, load); + + std::vector loop_nest{&ld.GetLoopByIndex(0)}; + LoopDependenceAnalysis analysis{context.get(), loop_nest}; + + DistanceVector dv_entry(loop_nest.size()); + auto is_independent = analysis.GetDependence(load, store, &dv_entry); + + DistanceVector expected_distance_vector({DistanceEntry(1, 2)}); + + EXPECT_FALSE(is_independent); + EXPECT_EQ(expected_distance_vector, dv_entry); + } + + { + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + const Instruction* store = nullptr; + const Instruction* load = nullptr; + + int block_id = 119; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(nullptr, store); + EXPECT_NE(nullptr, load); + + std::vector loop_nest{ + &ld.GetLoopByIndex(0), &ld.GetLoopByIndex(1), &ld.GetLoopByIndex(2)}; + LoopDependenceAnalysis analysis{context.get(), loop_nest}; + + DistanceVector dv_entry(loop_nest.size()); + + std::vector expected_entries{ + DistanceEntry(DistanceEntry::Directions::LT, 1), + DistanceEntry(DistanceEntry::Directions::LT, 1), + DistanceEntry(DistanceEntry::Directions::GT, -1)}; + + DistanceVector expected_distance_vector(expected_entries); + + auto is_independent = analysis.GetDependence(store, load, &dv_entry); + + EXPECT_FALSE(is_independent); + EXPECT_EQ(expected_distance_vector, dv_entry); + } + + { + const Function* f = spvtest::GetFunction(module, 14); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + const Instruction* store = nullptr; + const Instruction* load = nullptr; + + int block_id = 162; + ASSERT_TRUE(spvtest::GetBasicBlock(f, block_id)); + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, block_id)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(nullptr, store); + EXPECT_NE(nullptr, load); + + std::vector loop_nest{&ld.GetLoopByIndex(0), + &ld.GetLoopByIndex(1)}; + LoopDependenceAnalysis analysis{context.get(), loop_nest}; + + DistanceVector dv_entry(loop_nest.size()); + auto is_independent = analysis.GetDependence(load, store, &dv_entry); + + EXPECT_TRUE(is_independent); + } +} + +TEST(DependencyAnalysis, ConstraintIntersection) { + LoopDependenceAnalysis analysis{nullptr, std::vector{}}; + auto scalar_evolution = analysis.GetScalarEvolution(); + { + // One is none. Other should be returned + auto none = analysis.make_constraint(); + auto x = scalar_evolution->CreateConstant(1); + auto y = scalar_evolution->CreateConstant(10); + auto point = analysis.make_constraint(x, y, nullptr); + + auto ret_0 = analysis.IntersectConstraints(none, point, nullptr, nullptr); + + auto ret_point_0 = ret_0->AsDependencePoint(); + ASSERT_NE(nullptr, ret_point_0); + EXPECT_EQ(*x, *ret_point_0->GetSource()); + EXPECT_EQ(*y, *ret_point_0->GetDestination()); + + auto ret_1 = analysis.IntersectConstraints(point, none, nullptr, nullptr); + + auto ret_point_1 = ret_1->AsDependencePoint(); + ASSERT_NE(nullptr, ret_point_1); + EXPECT_EQ(*x, *ret_point_1->GetSource()); + EXPECT_EQ(*y, *ret_point_1->GetDestination()); + } + + { + // Both distances + auto x = scalar_evolution->CreateConstant(1); + auto y = scalar_evolution->CreateConstant(10); + + auto distance_0 = analysis.make_constraint(x, nullptr); + auto distance_1 = analysis.make_constraint(y, nullptr); + + // Equal distances + auto ret_0 = + analysis.IntersectConstraints(distance_1, distance_1, nullptr, nullptr); + + auto ret_distance = ret_0->AsDependenceDistance(); + ASSERT_NE(nullptr, ret_distance); + EXPECT_EQ(*y, *ret_distance->GetDistance()); + + // Non-equal distances + auto ret_1 = + analysis.IntersectConstraints(distance_0, distance_1, nullptr, nullptr); + EXPECT_NE(nullptr, ret_1->AsDependenceEmpty()); + } + + { + // Both points + auto x = scalar_evolution->CreateConstant(1); + auto y = scalar_evolution->CreateConstant(10); + + auto point_0 = analysis.make_constraint(x, y, nullptr); + auto point_1 = analysis.make_constraint(x, y, nullptr); + auto point_2 = analysis.make_constraint(y, y, nullptr); + + // Equal points + auto ret_0 = + analysis.IntersectConstraints(point_0, point_1, nullptr, nullptr); + auto ret_point_0 = ret_0->AsDependencePoint(); + ASSERT_NE(nullptr, ret_point_0); + EXPECT_EQ(*x, *ret_point_0->GetSource()); + EXPECT_EQ(*y, *ret_point_0->GetDestination()); + + // Non-equal points + auto ret_1 = + analysis.IntersectConstraints(point_0, point_2, nullptr, nullptr); + EXPECT_NE(nullptr, ret_1->AsDependenceEmpty()); + } + + { + // Both lines, parallel + auto a0 = scalar_evolution->CreateConstant(3); + auto b0 = scalar_evolution->CreateConstant(6); + auto c0 = scalar_evolution->CreateConstant(9); + + auto a1 = scalar_evolution->CreateConstant(6); + auto b1 = scalar_evolution->CreateConstant(12); + auto c1 = scalar_evolution->CreateConstant(18); + + auto line_0 = analysis.make_constraint(a0, b0, c0, nullptr); + auto line_1 = analysis.make_constraint(a1, b1, c1, nullptr); + + // Same line, both ways + auto ret_0 = + analysis.IntersectConstraints(line_0, line_1, nullptr, nullptr); + auto ret_1 = + analysis.IntersectConstraints(line_1, line_0, nullptr, nullptr); + + auto ret_line_0 = ret_0->AsDependenceLine(); + auto ret_line_1 = ret_1->AsDependenceLine(); + + EXPECT_NE(nullptr, ret_line_0); + EXPECT_NE(nullptr, ret_line_1); + + // Non-intersecting parallel lines + auto c2 = scalar_evolution->CreateConstant(12); + auto line_2 = analysis.make_constraint(a1, b1, c2, nullptr); + + auto ret_2 = + analysis.IntersectConstraints(line_0, line_2, nullptr, nullptr); + auto ret_3 = + analysis.IntersectConstraints(line_2, line_0, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_2->AsDependenceEmpty()); + EXPECT_NE(nullptr, ret_3->AsDependenceEmpty()); + + auto c3 = scalar_evolution->CreateConstant(20); + auto line_3 = analysis.make_constraint(a1, b1, c3, nullptr); + + auto ret_4 = + analysis.IntersectConstraints(line_0, line_3, nullptr, nullptr); + auto ret_5 = + analysis.IntersectConstraints(line_3, line_0, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_4->AsDependenceEmpty()); + EXPECT_NE(nullptr, ret_5->AsDependenceEmpty()); + } + + { + // Non-constant line + auto unknown = scalar_evolution->CreateCantComputeNode(); + auto constant = scalar_evolution->CreateConstant(10); + + auto line_0 = analysis.make_constraint(constant, constant, + constant, nullptr); + auto line_1 = analysis.make_constraint(unknown, unknown, + unknown, nullptr); + + auto ret_0 = + analysis.IntersectConstraints(line_0, line_1, nullptr, nullptr); + auto ret_1 = + analysis.IntersectConstraints(line_1, line_0, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_0->AsDependenceNone()); + EXPECT_NE(nullptr, ret_1->AsDependenceNone()); + } + + { + auto bound_0 = scalar_evolution->CreateConstant(0); + auto bound_1 = scalar_evolution->CreateConstant(20); + + auto a0 = scalar_evolution->CreateConstant(1); + auto b0 = scalar_evolution->CreateConstant(2); + auto c0 = scalar_evolution->CreateConstant(6); + + auto a1 = scalar_evolution->CreateConstant(-1); + auto b1 = scalar_evolution->CreateConstant(2); + auto c1 = scalar_evolution->CreateConstant(2); + + auto line_0 = analysis.make_constraint(a0, b0, c0, nullptr); + auto line_1 = analysis.make_constraint(a1, b1, c1, nullptr); + + // Intersecting lines, has integer solution, in bounds + auto ret_0 = + analysis.IntersectConstraints(line_0, line_1, bound_0, bound_1); + auto ret_1 = + analysis.IntersectConstraints(line_1, line_0, bound_0, bound_1); + + auto ret_point_0 = ret_0->AsDependencePoint(); + auto ret_point_1 = ret_1->AsDependencePoint(); + + EXPECT_NE(nullptr, ret_point_0); + EXPECT_NE(nullptr, ret_point_1); + + auto const_2 = scalar_evolution->CreateConstant(2); + + EXPECT_EQ(*const_2, *ret_point_0->GetSource()); + EXPECT_EQ(*const_2, *ret_point_0->GetDestination()); + + EXPECT_EQ(*const_2, *ret_point_1->GetSource()); + EXPECT_EQ(*const_2, *ret_point_1->GetDestination()); + + // Intersecting lines, has integer solution, out of bounds + auto ret_2 = + analysis.IntersectConstraints(line_0, line_1, bound_0, bound_0); + auto ret_3 = + analysis.IntersectConstraints(line_1, line_0, bound_0, bound_0); + + EXPECT_NE(nullptr, ret_2->AsDependenceEmpty()); + EXPECT_NE(nullptr, ret_3->AsDependenceEmpty()); + + auto a2 = scalar_evolution->CreateConstant(-4); + auto b2 = scalar_evolution->CreateConstant(1); + auto c2 = scalar_evolution->CreateConstant(0); + + auto a3 = scalar_evolution->CreateConstant(4); + auto b3 = scalar_evolution->CreateConstant(1); + auto c3 = scalar_evolution->CreateConstant(4); + + auto line_2 = analysis.make_constraint(a2, b2, c2, nullptr); + auto line_3 = analysis.make_constraint(a3, b3, c3, nullptr); + + // Intersecting, no integer solution + auto ret_4 = + analysis.IntersectConstraints(line_2, line_3, bound_0, bound_1); + auto ret_5 = + analysis.IntersectConstraints(line_3, line_2, bound_0, bound_1); + + EXPECT_NE(nullptr, ret_4->AsDependenceEmpty()); + EXPECT_NE(nullptr, ret_5->AsDependenceEmpty()); + + auto unknown = scalar_evolution->CreateCantComputeNode(); + + // Non-constant bound + auto ret_6 = + analysis.IntersectConstraints(line_0, line_1, unknown, bound_1); + auto ret_7 = + analysis.IntersectConstraints(line_1, line_0, bound_0, unknown); + + EXPECT_NE(nullptr, ret_6->AsDependenceNone()); + EXPECT_NE(nullptr, ret_7->AsDependenceNone()); + } + + { + auto constant_0 = scalar_evolution->CreateConstant(0); + auto constant_1 = scalar_evolution->CreateConstant(1); + auto constant_neg_1 = scalar_evolution->CreateConstant(-1); + auto constant_2 = scalar_evolution->CreateConstant(2); + auto constant_neg_2 = scalar_evolution->CreateConstant(-2); + + auto point_0_0 = analysis.make_constraint( + constant_0, constant_0, nullptr); + auto point_0_1 = analysis.make_constraint( + constant_0, constant_1, nullptr); + auto point_1_0 = analysis.make_constraint( + constant_1, constant_0, nullptr); + auto point_1_1 = analysis.make_constraint( + constant_1, constant_1, nullptr); + auto point_1_2 = analysis.make_constraint( + constant_1, constant_2, nullptr); + auto point_1_neg_1 = analysis.make_constraint( + constant_1, constant_neg_1, nullptr); + auto point_neg_1_1 = analysis.make_constraint( + constant_neg_1, constant_1, nullptr); + + auto line_y_0 = analysis.make_constraint( + constant_0, constant_1, constant_0, nullptr); + auto line_y_1 = analysis.make_constraint( + constant_0, constant_1, constant_1, nullptr); + auto line_y_2 = analysis.make_constraint( + constant_0, constant_1, constant_2, nullptr); + + // Parallel horizontal lines, y = 0 & y = 1, should return no intersection + auto ret = + analysis.IntersectConstraints(line_y_0, line_y_1, nullptr, nullptr); + + EXPECT_NE(nullptr, ret->AsDependenceEmpty()); + + // Parallel horizontal lines, y = 1 & y = 2, should return no intersection + auto ret_y_12 = + analysis.IntersectConstraints(line_y_1, line_y_2, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_y_12->AsDependenceEmpty()); + + // Same horizontal lines, y = 0 & y = 0, should return the line + auto ret_y_same_0 = + analysis.IntersectConstraints(line_y_0, line_y_0, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_y_same_0->AsDependenceLine()); + + // Same horizontal lines, y = 1 & y = 1, should return the line + auto ret_y_same_1 = + analysis.IntersectConstraints(line_y_1, line_y_1, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_y_same_1->AsDependenceLine()); + + auto line_x_0 = analysis.make_constraint( + constant_1, constant_0, constant_0, nullptr); + auto line_x_1 = analysis.make_constraint( + constant_1, constant_0, constant_1, nullptr); + auto line_x_2 = analysis.make_constraint( + constant_1, constant_0, constant_2, nullptr); + auto line_2x_1 = analysis.make_constraint( + constant_2, constant_0, constant_1, nullptr); + auto line_2x_2 = analysis.make_constraint( + constant_2, constant_0, constant_2, nullptr); + + // Parallel vertical lines, x = 0 & x = 1, should return no intersection + auto ret_x = + analysis.IntersectConstraints(line_x_0, line_x_1, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_x->AsDependenceEmpty()); + + // Parallel vertical lines, x = 1 & x = 2, should return no intersection + auto ret_x_12 = + analysis.IntersectConstraints(line_x_1, line_x_2, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_x_12->AsDependenceEmpty()); + + // Parallel vertical lines, 2x = 1 & 2x = 2, should return no intersection + auto ret_2x_2_2x_1 = + analysis.IntersectConstraints(line_2x_2, line_2x_1, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_2x_2_2x_1->AsDependenceEmpty()); + + // same line, 2x=2 & x = 1 + auto ret_2x_2_x_1 = + analysis.IntersectConstraints(line_2x_2, line_x_1, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_2x_2_x_1->AsDependenceLine()); + + // Same vertical lines, x = 0 & x = 0, should return the line + auto ret_x_same_0 = + analysis.IntersectConstraints(line_x_0, line_x_0, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_x_same_0->AsDependenceLine()); + // EXPECT_EQ(*line_x_0, *ret_x_same_0->AsDependenceLine()); + + // Same vertical lines, x = 1 & x = 1, should return the line + auto ret_x_same_1 = + analysis.IntersectConstraints(line_x_1, line_x_1, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_x_same_1->AsDependenceLine()); + EXPECT_EQ(*line_x_1, *ret_x_same_1->AsDependenceLine()); + + // x=1 & y = 0, intersect at (1, 0) + auto ret_1_0 = analysis.IntersectConstraints(line_x_1, line_y_0, + constant_neg_1, constant_2); + + auto ret_point_1_0 = ret_1_0->AsDependencePoint(); + EXPECT_NE(nullptr, ret_point_1_0); + EXPECT_EQ(*point_1_0, *ret_point_1_0); + + // x=1 & y = 1, intersect at (1, 1) + auto ret_1_1 = analysis.IntersectConstraints(line_x_1, line_y_1, + constant_neg_1, constant_2); + + auto ret_point_1_1 = ret_1_1->AsDependencePoint(); + EXPECT_NE(nullptr, ret_point_1_1); + EXPECT_EQ(*point_1_1, *ret_point_1_1); + + // x=0 & y = 0, intersect at (0, 0) + auto ret_0_0 = analysis.IntersectConstraints(line_x_0, line_y_0, + constant_neg_1, constant_2); + + auto ret_point_0_0 = ret_0_0->AsDependencePoint(); + EXPECT_NE(nullptr, ret_point_0_0); + EXPECT_EQ(*point_0_0, *ret_point_0_0); + + // x=0 & y = 1, intersect at (0, 1) + auto ret_0_1 = analysis.IntersectConstraints(line_x_0, line_y_1, + constant_neg_1, constant_2); + auto ret_point_0_1 = ret_0_1->AsDependencePoint(); + EXPECT_NE(nullptr, ret_point_0_1); + EXPECT_EQ(*point_0_1, *ret_point_0_1); + + // x = 1 & y = 2 + auto ret_1_2 = analysis.IntersectConstraints(line_x_1, line_y_2, + constant_neg_1, constant_2); + auto ret_point_1_2 = ret_1_2->AsDependencePoint(); + EXPECT_NE(nullptr, ret_point_1_2); + EXPECT_EQ(*point_1_2, *ret_point_1_2); + + auto line_x_y_0 = analysis.make_constraint( + constant_1, constant_1, constant_0, nullptr); + auto line_x_y_1 = analysis.make_constraint( + constant_1, constant_1, constant_1, nullptr); + + // x+y=0 & x=0, intersect (0, 0) + auto ret_xy_0_x_0 = analysis.IntersectConstraints( + line_x_y_0, line_x_0, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_xy_0_x_0->AsDependencePoint()); + EXPECT_EQ(*point_0_0, *ret_xy_0_x_0); + + // x+y=0 & y=0, intersect (0, 0) + auto ret_xy_0_y_0 = analysis.IntersectConstraints( + line_x_y_0, line_y_0, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_xy_0_y_0->AsDependencePoint()); + EXPECT_EQ(*point_0_0, *ret_xy_0_y_0); + + // x+y=0 & x=1, intersect (1, -1) + auto ret_xy_0_x_1 = analysis.IntersectConstraints( + line_x_y_0, line_x_1, constant_neg_2, constant_2); + + EXPECT_NE(nullptr, ret_xy_0_x_1->AsDependencePoint()); + EXPECT_EQ(*point_1_neg_1, *ret_xy_0_x_1); + + // x+y=0 & y=1, intersect (-1, 1) + auto ret_xy_0_y_1 = analysis.IntersectConstraints( + line_x_y_0, line_y_1, constant_neg_2, constant_2); + + EXPECT_NE(nullptr, ret_xy_0_y_1->AsDependencePoint()); + EXPECT_EQ(*point_neg_1_1, *ret_xy_0_y_1); + + // x=0 & x+y=0, intersect (0, 0) + auto ret_x_0_xy_0 = analysis.IntersectConstraints( + line_x_0, line_x_y_0, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_x_0_xy_0->AsDependencePoint()); + EXPECT_EQ(*point_0_0, *ret_x_0_xy_0); + + // y=0 & x+y=0, intersect (0, 0) + auto ret_y_0_xy_0 = analysis.IntersectConstraints( + line_y_0, line_x_y_0, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_y_0_xy_0->AsDependencePoint()); + EXPECT_EQ(*point_0_0, *ret_y_0_xy_0); + + // x=1 & x+y=0, intersect (1, -1) + auto ret_x_1_xy_0 = analysis.IntersectConstraints( + line_x_1, line_x_y_0, constant_neg_2, constant_2); + + EXPECT_NE(nullptr, ret_x_1_xy_0->AsDependencePoint()); + EXPECT_EQ(*point_1_neg_1, *ret_x_1_xy_0); + + // y=1 & x+y=0, intersect (-1, 1) + auto ret_y_1_xy_0 = analysis.IntersectConstraints( + line_y_1, line_x_y_0, constant_neg_2, constant_2); + + EXPECT_NE(nullptr, ret_y_1_xy_0->AsDependencePoint()); + EXPECT_EQ(*point_neg_1_1, *ret_y_1_xy_0); + + // x+y=1 & x=0, intersect (0, 1) + auto ret_xy_1_x_0 = analysis.IntersectConstraints( + line_x_y_1, line_x_0, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_xy_1_x_0->AsDependencePoint()); + EXPECT_EQ(*point_0_1, *ret_xy_1_x_0); + + // x+y=1 & y=0, intersect (1, 0) + auto ret_xy_1_y_0 = analysis.IntersectConstraints( + line_x_y_1, line_y_0, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_xy_1_y_0->AsDependencePoint()); + EXPECT_EQ(*point_1_0, *ret_xy_1_y_0); + + // x+y=1 & x=1, intersect (1, 0) + auto ret_xy_1_x_1 = analysis.IntersectConstraints( + line_x_y_1, line_x_1, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_xy_1_x_1->AsDependencePoint()); + EXPECT_EQ(*point_1_0, *ret_xy_1_x_1); + + // x+y=1 & y=1, intersect (0, 1) + auto ret_xy_1_y_1 = analysis.IntersectConstraints( + line_x_y_1, line_y_1, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_xy_1_y_1->AsDependencePoint()); + EXPECT_EQ(*point_0_1, *ret_xy_1_y_1); + + // x=0 & x+y=1, intersect (0, 1) + auto ret_x_0_xy_1 = analysis.IntersectConstraints( + line_x_0, line_x_y_1, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_x_0_xy_1->AsDependencePoint()); + EXPECT_EQ(*point_0_1, *ret_x_0_xy_1); + + // y=0 & x+y=1, intersect (1, 0) + auto ret_y_0_xy_1 = analysis.IntersectConstraints( + line_y_0, line_x_y_1, constant_neg_1, constant_2); + + EXPECT_NE(nullptr, ret_y_0_xy_1->AsDependencePoint()); + EXPECT_EQ(*point_1_0, *ret_y_0_xy_1); + + // x=1 & x+y=1, intersect (1, 0) + auto ret_x_1_xy_1 = analysis.IntersectConstraints( + line_x_1, line_x_y_1, constant_neg_2, constant_2); + + EXPECT_NE(nullptr, ret_x_1_xy_1->AsDependencePoint()); + EXPECT_EQ(*point_1_0, *ret_x_1_xy_1); + + // y=1 & x+y=1, intersect (0, 1) + auto ret_y_1_xy_1 = analysis.IntersectConstraints( + line_y_1, line_x_y_1, constant_neg_2, constant_2); + + EXPECT_NE(nullptr, ret_y_1_xy_1->AsDependencePoint()); + EXPECT_EQ(*point_0_1, *ret_y_1_xy_1); + } + + { + // Line and point + auto a = scalar_evolution->CreateConstant(3); + auto b = scalar_evolution->CreateConstant(10); + auto c = scalar_evolution->CreateConstant(16); + + auto line = analysis.make_constraint(a, b, c, nullptr); + + // Point on line + auto x = scalar_evolution->CreateConstant(2); + auto y = scalar_evolution->CreateConstant(1); + auto point_0 = analysis.make_constraint(x, y, nullptr); + + auto ret_0 = analysis.IntersectConstraints(line, point_0, nullptr, nullptr); + auto ret_1 = analysis.IntersectConstraints(point_0, line, nullptr, nullptr); + + auto ret_point_0 = ret_0->AsDependencePoint(); + auto ret_point_1 = ret_1->AsDependencePoint(); + ASSERT_NE(nullptr, ret_point_0); + ASSERT_NE(nullptr, ret_point_1); + + EXPECT_EQ(*x, *ret_point_0->GetSource()); + EXPECT_EQ(*y, *ret_point_0->GetDestination()); + + EXPECT_EQ(*x, *ret_point_1->GetSource()); + EXPECT_EQ(*y, *ret_point_1->GetDestination()); + + // Point not on line + auto point_1 = analysis.make_constraint(a, a, nullptr); + + auto ret_2 = analysis.IntersectConstraints(line, point_1, nullptr, nullptr); + auto ret_3 = analysis.IntersectConstraints(point_1, line, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_2->AsDependenceEmpty()); + EXPECT_NE(nullptr, ret_3->AsDependenceEmpty()); + + // Non-constant + auto unknown = scalar_evolution->CreateCantComputeNode(); + + auto point_2 = + analysis.make_constraint(unknown, x, nullptr); + + auto ret_4 = analysis.IntersectConstraints(line, point_2, nullptr, nullptr); + auto ret_5 = analysis.IntersectConstraints(point_2, line, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_4->AsDependenceNone()); + EXPECT_NE(nullptr, ret_5->AsDependenceNone()); + } + + { + // Distance and point + auto d = scalar_evolution->CreateConstant(5); + auto distance = analysis.make_constraint(d, nullptr); + + // Point on line + auto x = scalar_evolution->CreateConstant(10); + auto point_0 = analysis.make_constraint(d, x, nullptr); + + auto ret_0 = + analysis.IntersectConstraints(distance, point_0, nullptr, nullptr); + auto ret_1 = + analysis.IntersectConstraints(point_0, distance, nullptr, nullptr); + + auto ret_point_0 = ret_0->AsDependencePoint(); + auto ret_point_1 = ret_1->AsDependencePoint(); + ASSERT_NE(nullptr, ret_point_0); + ASSERT_NE(nullptr, ret_point_1); + + // Point not on line + auto point_1 = analysis.make_constraint(x, x, nullptr); + + auto ret_2 = + analysis.IntersectConstraints(distance, point_1, nullptr, nullptr); + auto ret_3 = + analysis.IntersectConstraints(point_1, distance, nullptr, nullptr); + + EXPECT_NE(nullptr, ret_2->AsDependenceEmpty()); + EXPECT_NE(nullptr, ret_3->AsDependenceEmpty()); + + // Non-constant + auto unknown = scalar_evolution->CreateCantComputeNode(); + auto unknown_distance = + analysis.make_constraint(unknown, nullptr); + + auto ret_4 = analysis.IntersectConstraints(unknown_distance, point_1, + nullptr, nullptr); + auto ret_5 = analysis.IntersectConstraints(point_1, unknown_distance, + nullptr, nullptr); + + EXPECT_NE(nullptr, ret_4->AsDependenceNone()); + EXPECT_NE(nullptr, ret_5->AsDependenceNone()); + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp new file mode 100644 index 00000000000..715cf541dd3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/dependence_analysis_helpers.cpp @@ -0,0 +1,3017 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_dependence.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/tree_iterator.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using DependencyAnalysisHelpers = ::testing::Test; + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void a() { + int[10][10] arr; + int i = 0; + int j = 0; + for (; i < 10 && j < 10; i++, j++) { + arr[i][j] = arr[i][j]; + } +} +void b() { + int[10] arr; + for (int i = 0; i < 10; i+=2) { + arr[i] = arr[i]; + } +} +void main(){ + a(); + b(); +} +*/ +TEST(DependencyAnalysisHelpers, UnsupportedLoops) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %12 "i" + OpName %14 "j" + OpName %32 "arr" + OpName %45 "i" + OpName %54 "arr" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %13 = OpConstant %10 0 + %21 = OpConstant %10 10 + %22 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %10 %28 + %30 = OpTypeArray %29 %28 + %31 = OpTypePointer Function %30 + %41 = OpConstant %10 1 + %53 = OpTypePointer Function %29 + %60 = OpConstant %10 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %63 = OpFunctionCall %2 %6 + %64 = OpFunctionCall %2 %8 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %12 = OpVariable %11 Function + %14 = OpVariable %11 Function + %32 = OpVariable %31 Function + OpStore %12 %13 + OpStore %14 %13 + OpBranch %15 + %15 = OpLabel + %65 = OpPhi %10 %13 %7 %42 %18 + %66 = OpPhi %10 %13 %7 %44 %18 + OpLoopMerge %17 %18 None + OpBranch %19 + %19 = OpLabel + %23 = OpSLessThan %22 %65 %21 + %25 = OpSLessThan %22 %66 %21 + %26 = OpLogicalAnd %22 %23 %25 + OpBranchConditional %26 %16 %17 + %16 = OpLabel + %37 = OpAccessChain %11 %32 %65 %66 + %38 = OpLoad %10 %37 + %39 = OpAccessChain %11 %32 %65 %66 + OpStore %39 %38 + OpBranch %18 + %18 = OpLabel + %42 = OpIAdd %10 %65 %41 + OpStore %12 %42 + %44 = OpIAdd %10 %66 %41 + OpStore %14 %44 + OpBranch %15 + %17 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %45 = OpVariable %11 Function + %54 = OpVariable %53 Function + OpStore %45 %13 + OpBranch %46 + %46 = OpLabel + %67 = OpPhi %10 %13 %9 %62 %49 + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %52 = OpSLessThan %22 %67 %21 + OpBranchConditional %52 %47 %48 + %47 = OpLabel + %57 = OpAccessChain %11 %54 %67 + %58 = OpLoad %10 %57 + %59 = OpAccessChain %11 %54 %67 + OpStore %59 %58 + OpBranch %49 + %49 = OpLabel + %62 = OpIAdd %10 %67 %60 + OpStore %45 %62 + OpBranch %46 + %48 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + { + // Function a + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[1] = {nullptr}; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 16)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + // 38 -> 39 + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.IsSupportedLoop(loops[0])); + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(38), + store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::UNKNOWN); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::ALL); + } + { + // Function b + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* store[1] = {nullptr}; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 47)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store[stores_found] = &inst; + ++stores_found; + } + } + // 58 -> 59 + DistanceVector distance_vector{loops.size()}; + EXPECT_FALSE(analysis.IsSupportedLoop(loops[0])); + EXPECT_FALSE(analysis.GetDependence(context->get_def_use_mgr()->GetDef(58), + store[0], &distance_vector)); + EXPECT_EQ(distance_vector.GetEntries()[0].dependence_information, + DistanceEntry::DependenceInformation::UNKNOWN); + EXPECT_EQ(distance_vector.GetEntries()[0].direction, + DistanceEntry::Directions::ALL); + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void a() { + for (int i = -10; i < 0; i++) { + + } +} +void b() { + for (int i = -5; i < 5; i++) { + + } +} +void c() { + for (int i = 0; i < 10; i++) { + + } +} +void d() { + for (int i = 5; i < 15; i++) { + + } +} +void e() { + for (int i = -10; i <= 0; i++) { + + } +} +void f() { + for (int i = -5; i <= 5; i++) { + + } +} +void g() { + for (int i = 0; i <= 10; i++) { + + } +} +void h() { + for (int i = 5; i <= 15; i++) { + + } +} +void i() { + for (int i = 0; i > -10; i--) { + + } +} +void j() { + for (int i = 5; i > -5; i--) { + + } +} +void k() { + for (int i = 10; i > 0; i--) { + + } +} +void l() { + for (int i = 15; i > 5; i--) { + + } +} +void m() { + for (int i = 0; i >= -10; i--) { + + } +} +void n() { + for (int i = 5; i >= -5; i--) { + + } +} +void o() { + for (int i = 10; i >= 0; i--) { + + } +} +void p() { + for (int i = 15; i >= 5; i--) { + + } +} +void main(){ + a(); + b(); + c(); + d(); + e(); + f(); + g(); + h(); + i(); + j(); + k(); + l(); + m(); + n(); + o(); + p(); +} +*/ +TEST(DependencyAnalysisHelpers, loop_information) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %14 "e(" + OpName %16 "f(" + OpName %18 "g(" + OpName %20 "h(" + OpName %22 "i(" + OpName %24 "j(" + OpName %26 "k(" + OpName %28 "l(" + OpName %30 "m(" + OpName %32 "n(" + OpName %34 "o(" + OpName %36 "p(" + OpName %40 "i" + OpName %54 "i" + OpName %66 "i" + OpName %77 "i" + OpName %88 "i" + OpName %98 "i" + OpName %108 "i" + OpName %118 "i" + OpName %128 "i" + OpName %138 "i" + OpName %148 "i" + OpName %158 "i" + OpName %168 "i" + OpName %178 "i" + OpName %188 "i" + OpName %198 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %38 = OpTypeInt 32 1 + %39 = OpTypePointer Function %38 + %41 = OpConstant %38 -10 + %48 = OpConstant %38 0 + %49 = OpTypeBool + %52 = OpConstant %38 1 + %55 = OpConstant %38 -5 + %62 = OpConstant %38 5 + %73 = OpConstant %38 10 + %84 = OpConstant %38 15 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %208 = OpFunctionCall %2 %6 + %209 = OpFunctionCall %2 %8 + %210 = OpFunctionCall %2 %10 + %211 = OpFunctionCall %2 %12 + %212 = OpFunctionCall %2 %14 + %213 = OpFunctionCall %2 %16 + %214 = OpFunctionCall %2 %18 + %215 = OpFunctionCall %2 %20 + %216 = OpFunctionCall %2 %22 + %217 = OpFunctionCall %2 %24 + %218 = OpFunctionCall %2 %26 + %219 = OpFunctionCall %2 %28 + %220 = OpFunctionCall %2 %30 + %221 = OpFunctionCall %2 %32 + %222 = OpFunctionCall %2 %34 + %223 = OpFunctionCall %2 %36 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %40 = OpVariable %39 Function + OpStore %40 %41 + OpBranch %42 + %42 = OpLabel + %224 = OpPhi %38 %41 %7 %53 %45 + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %50 = OpSLessThan %49 %224 %48 + OpBranchConditional %50 %43 %44 + %43 = OpLabel + OpBranch %45 + %45 = OpLabel + %53 = OpIAdd %38 %224 %52 + OpStore %40 %53 + OpBranch %42 + %44 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %54 = OpVariable %39 Function + OpStore %54 %55 + OpBranch %56 + %56 = OpLabel + %225 = OpPhi %38 %55 %9 %65 %59 + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %63 = OpSLessThan %49 %225 %62 + OpBranchConditional %63 %57 %58 + %57 = OpLabel + OpBranch %59 + %59 = OpLabel + %65 = OpIAdd %38 %225 %52 + OpStore %54 %65 + OpBranch %56 + %58 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %66 = OpVariable %39 Function + OpStore %66 %48 + OpBranch %67 + %67 = OpLabel + %226 = OpPhi %38 %48 %11 %76 %70 + OpLoopMerge %69 %70 None + OpBranch %71 + %71 = OpLabel + %74 = OpSLessThan %49 %226 %73 + OpBranchConditional %74 %68 %69 + %68 = OpLabel + OpBranch %70 + %70 = OpLabel + %76 = OpIAdd %38 %226 %52 + OpStore %66 %76 + OpBranch %67 + %69 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %77 = OpVariable %39 Function + OpStore %77 %62 + OpBranch %78 + %78 = OpLabel + %227 = OpPhi %38 %62 %13 %87 %81 + OpLoopMerge %80 %81 None + OpBranch %82 + %82 = OpLabel + %85 = OpSLessThan %49 %227 %84 + OpBranchConditional %85 %79 %80 + %79 = OpLabel + OpBranch %81 + %81 = OpLabel + %87 = OpIAdd %38 %227 %52 + OpStore %77 %87 + OpBranch %78 + %80 = OpLabel + OpReturn + OpFunctionEnd + %14 = OpFunction %2 None %3 + %15 = OpLabel + %88 = OpVariable %39 Function + OpStore %88 %41 + OpBranch %89 + %89 = OpLabel + %228 = OpPhi %38 %41 %15 %97 %92 + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %95 = OpSLessThanEqual %49 %228 %48 + OpBranchConditional %95 %90 %91 + %90 = OpLabel + OpBranch %92 + %92 = OpLabel + %97 = OpIAdd %38 %228 %52 + OpStore %88 %97 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %16 = OpFunction %2 None %3 + %17 = OpLabel + %98 = OpVariable %39 Function + OpStore %98 %55 + OpBranch %99 + %99 = OpLabel + %229 = OpPhi %38 %55 %17 %107 %102 + OpLoopMerge %101 %102 None + OpBranch %103 + %103 = OpLabel + %105 = OpSLessThanEqual %49 %229 %62 + OpBranchConditional %105 %100 %101 + %100 = OpLabel + OpBranch %102 + %102 = OpLabel + %107 = OpIAdd %38 %229 %52 + OpStore %98 %107 + OpBranch %99 + %101 = OpLabel + OpReturn + OpFunctionEnd + %18 = OpFunction %2 None %3 + %19 = OpLabel + %108 = OpVariable %39 Function + OpStore %108 %48 + OpBranch %109 + %109 = OpLabel + %230 = OpPhi %38 %48 %19 %117 %112 + OpLoopMerge %111 %112 None + OpBranch %113 + %113 = OpLabel + %115 = OpSLessThanEqual %49 %230 %73 + OpBranchConditional %115 %110 %111 + %110 = OpLabel + OpBranch %112 + %112 = OpLabel + %117 = OpIAdd %38 %230 %52 + OpStore %108 %117 + OpBranch %109 + %111 = OpLabel + OpReturn + OpFunctionEnd + %20 = OpFunction %2 None %3 + %21 = OpLabel + %118 = OpVariable %39 Function + OpStore %118 %62 + OpBranch %119 + %119 = OpLabel + %231 = OpPhi %38 %62 %21 %127 %122 + OpLoopMerge %121 %122 None + OpBranch %123 + %123 = OpLabel + %125 = OpSLessThanEqual %49 %231 %84 + OpBranchConditional %125 %120 %121 + %120 = OpLabel + OpBranch %122 + %122 = OpLabel + %127 = OpIAdd %38 %231 %52 + OpStore %118 %127 + OpBranch %119 + %121 = OpLabel + OpReturn + OpFunctionEnd + %22 = OpFunction %2 None %3 + %23 = OpLabel + %128 = OpVariable %39 Function + OpStore %128 %48 + OpBranch %129 + %129 = OpLabel + %232 = OpPhi %38 %48 %23 %137 %132 + OpLoopMerge %131 %132 None + OpBranch %133 + %133 = OpLabel + %135 = OpSGreaterThan %49 %232 %41 + OpBranchConditional %135 %130 %131 + %130 = OpLabel + OpBranch %132 + %132 = OpLabel + %137 = OpISub %38 %232 %52 + OpStore %128 %137 + OpBranch %129 + %131 = OpLabel + OpReturn + OpFunctionEnd + %24 = OpFunction %2 None %3 + %25 = OpLabel + %138 = OpVariable %39 Function + OpStore %138 %62 + OpBranch %139 + %139 = OpLabel + %233 = OpPhi %38 %62 %25 %147 %142 + OpLoopMerge %141 %142 None + OpBranch %143 + %143 = OpLabel + %145 = OpSGreaterThan %49 %233 %55 + OpBranchConditional %145 %140 %141 + %140 = OpLabel + OpBranch %142 + %142 = OpLabel + %147 = OpISub %38 %233 %52 + OpStore %138 %147 + OpBranch %139 + %141 = OpLabel + OpReturn + OpFunctionEnd + %26 = OpFunction %2 None %3 + %27 = OpLabel + %148 = OpVariable %39 Function + OpStore %148 %73 + OpBranch %149 + %149 = OpLabel + %234 = OpPhi %38 %73 %27 %157 %152 + OpLoopMerge %151 %152 None + OpBranch %153 + %153 = OpLabel + %155 = OpSGreaterThan %49 %234 %48 + OpBranchConditional %155 %150 %151 + %150 = OpLabel + OpBranch %152 + %152 = OpLabel + %157 = OpISub %38 %234 %52 + OpStore %148 %157 + OpBranch %149 + %151 = OpLabel + OpReturn + OpFunctionEnd + %28 = OpFunction %2 None %3 + %29 = OpLabel + %158 = OpVariable %39 Function + OpStore %158 %84 + OpBranch %159 + %159 = OpLabel + %235 = OpPhi %38 %84 %29 %167 %162 + OpLoopMerge %161 %162 None + OpBranch %163 + %163 = OpLabel + %165 = OpSGreaterThan %49 %235 %62 + OpBranchConditional %165 %160 %161 + %160 = OpLabel + OpBranch %162 + %162 = OpLabel + %167 = OpISub %38 %235 %52 + OpStore %158 %167 + OpBranch %159 + %161 = OpLabel + OpReturn + OpFunctionEnd + %30 = OpFunction %2 None %3 + %31 = OpLabel + %168 = OpVariable %39 Function + OpStore %168 %48 + OpBranch %169 + %169 = OpLabel + %236 = OpPhi %38 %48 %31 %177 %172 + OpLoopMerge %171 %172 None + OpBranch %173 + %173 = OpLabel + %175 = OpSGreaterThanEqual %49 %236 %41 + OpBranchConditional %175 %170 %171 + %170 = OpLabel + OpBranch %172 + %172 = OpLabel + %177 = OpISub %38 %236 %52 + OpStore %168 %177 + OpBranch %169 + %171 = OpLabel + OpReturn + OpFunctionEnd + %32 = OpFunction %2 None %3 + %33 = OpLabel + %178 = OpVariable %39 Function + OpStore %178 %62 + OpBranch %179 + %179 = OpLabel + %237 = OpPhi %38 %62 %33 %187 %182 + OpLoopMerge %181 %182 None + OpBranch %183 + %183 = OpLabel + %185 = OpSGreaterThanEqual %49 %237 %55 + OpBranchConditional %185 %180 %181 + %180 = OpLabel + OpBranch %182 + %182 = OpLabel + %187 = OpISub %38 %237 %52 + OpStore %178 %187 + OpBranch %179 + %181 = OpLabel + OpReturn + OpFunctionEnd + %34 = OpFunction %2 None %3 + %35 = OpLabel + %188 = OpVariable %39 Function + OpStore %188 %73 + OpBranch %189 + %189 = OpLabel + %238 = OpPhi %38 %73 %35 %197 %192 + OpLoopMerge %191 %192 None + OpBranch %193 + %193 = OpLabel + %195 = OpSGreaterThanEqual %49 %238 %48 + OpBranchConditional %195 %190 %191 + %190 = OpLabel + OpBranch %192 + %192 = OpLabel + %197 = OpISub %38 %238 %52 + OpStore %188 %197 + OpBranch %189 + %191 = OpLabel + OpReturn + OpFunctionEnd + %36 = OpFunction %2 None %3 + %37 = OpLabel + %198 = OpVariable %39 Function + OpStore %198 %84 + OpBranch %199 + %199 = OpLabel + %239 = OpPhi %38 %84 %37 %207 %202 + OpLoopMerge %201 %202 None + OpBranch %203 + %203 = OpLabel + %205 = OpSGreaterThanEqual %49 %239 %62 + OpBranchConditional %205 %200 %201 + %200 = OpLabel + OpBranch %202 + %202 = OpLabel + %207 = OpISub %38 %239 %52 + OpStore %198 %207 + OpBranch %199 + %201 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + { + // Function a + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -10); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -1); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(-10)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(-1)); + } + { + // Function b + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -5); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 4); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(-5)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(4)); + } + { + // Function c + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 0); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 9); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(0)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(9)); + } + { + // Function d + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 5); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 14); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(5)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(14)); + } + { + // Function e + const Function* f = spvtest::GetFunction(module, 14); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -10); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 0); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(-10)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(0)); + } + { + // Function f + const Function* f = spvtest::GetFunction(module, 16); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -5); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 5); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(-5)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(5)); + } + { + // Function g + const Function* f = spvtest::GetFunction(module, 18); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 0); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(0)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(10)); + } + { + // Function h + const Function* f = spvtest::GetFunction(module, 20); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 5); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 15); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(5)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(1)), + analysis.GetScalarEvolution()->CreateConstant(15)); + } + { + // Function i + const Function* f = spvtest::GetFunction(module, 22); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 0); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -9); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(0)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(-9)); + } + { + // Function j + const Function* f = spvtest::GetFunction(module, 24); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 5); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -4); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(5)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(-4)); + } + { + // Function k + const Function* f = spvtest::GetFunction(module, 26); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 1); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(10)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(1)); + } + { + // Function l + const Function* f = spvtest::GetFunction(module, 28); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 15); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 6); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(15)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(6)); + } + { + // Function m + const Function* f = spvtest::GetFunction(module, 30); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 0); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -10); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(0)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(-10)); + } + { + // Function n + const Function* f = spvtest::GetFunction(module, 32); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 5); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + -5); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(5)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(-5)); + } + { + // Function o + const Function* f = spvtest::GetFunction(module, 34); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 10); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 0); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(10)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(0)); + } + { + // Function p + const Function* f = spvtest::GetFunction(module, 36); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_EQ( + analysis.GetLowerBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 15); + EXPECT_EQ( + analysis.GetUpperBound(loop)->AsSEConstantNode()->FoldToSingleValue(), + 5); + + EXPECT_EQ( + analysis.GetTripCount(loop)->AsSEConstantNode()->FoldToSingleValue(), + 11); + + EXPECT_EQ(analysis.GetFirstTripInductionNode(loop), + analysis.GetScalarEvolution()->CreateConstant(15)); + + EXPECT_EQ(analysis.GetFinalTripInductionNode( + loop, analysis.GetScalarEvolution()->CreateConstant(-1)), + analysis.GetScalarEvolution()->CreateConstant(5)); + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +void main(){ + for (int i = 0; i < 10; i++) { + + } +} +*/ +TEST(DependencyAnalysisHelpers, bounds_checks) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %22 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %22 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %22 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + // We need a shader that includes a loop for this test so we can build a + // LoopDependenceAnalaysis + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + EXPECT_TRUE(analysis.IsWithinBounds(0, 0, 0)); + EXPECT_TRUE(analysis.IsWithinBounds(0, -1, 0)); + EXPECT_TRUE(analysis.IsWithinBounds(0, 0, 1)); + EXPECT_TRUE(analysis.IsWithinBounds(0, -1, 1)); + EXPECT_TRUE(analysis.IsWithinBounds(-2, -2, -2)); + EXPECT_TRUE(analysis.IsWithinBounds(-2, -3, 0)); + EXPECT_TRUE(analysis.IsWithinBounds(-2, 0, -3)); + EXPECT_TRUE(analysis.IsWithinBounds(2, 2, 2)); + EXPECT_TRUE(analysis.IsWithinBounds(2, 3, 0)); + + EXPECT_FALSE(analysis.IsWithinBounds(2, 3, 3)); + EXPECT_FALSE(analysis.IsWithinBounds(0, 1, 5)); + EXPECT_FALSE(analysis.IsWithinBounds(0, -1, -4)); + EXPECT_FALSE(analysis.IsWithinBounds(-2, -4, -3)); +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +layout(location = 0) in vec4 in_vec; +// Loop iterates from constant to symbolic +void a() { + int N = int(in_vec.x); + int arr[10]; + for (int i = 0; i < N; i++) { // Bounds are N - 0 - 1 + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void b() { + int N = int(in_vec.x); + int arr[10]; + for (int i = 0; i <= N; i++) { // Bounds are N - 0 + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void c() { + int N = int(in_vec.x); + int arr[10]; + for (int i = 9; i > N; i--) { // Bounds are 9 - N - 1 + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void d() { + int N = int(in_vec.x); + int arr[10]; + for (int i = 9; i >= N; i--) { // Bounds are 9 - N + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void main(){ + a(); + b(); + c(); + d(); +} +*/ +TEST(DependencyAnalysisHelpers, const_to_symbolic) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %16 "N" + OpName %20 "in_vec" + OpName %27 "i" + OpName %41 "arr" + OpName %59 "N" + OpName %63 "i" + OpName %72 "arr" + OpName %89 "N" + OpName %93 "i" + OpName %103 "arr" + OpName %120 "N" + OpName %124 "i" + OpName %133 "arr" + OpDecorate %20 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %14 = OpTypeInt 32 1 + %15 = OpTypePointer Function %14 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %17 + %28 = OpConstant %14 0 + %36 = OpTypeBool + %38 = OpConstant %21 10 + %39 = OpTypeArray %14 %38 + %40 = OpTypePointer Function %39 + %57 = OpConstant %14 1 + %94 = OpConstant %14 9 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %150 = OpFunctionCall %2 %6 + %151 = OpFunctionCall %2 %8 + %152 = OpFunctionCall %2 %10 + %153 = OpFunctionCall %2 %12 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpVariable %15 Function + %27 = OpVariable %15 Function + %41 = OpVariable %40 Function + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %17 %24 + %26 = OpConvertFToS %14 %25 + OpStore %16 %26 + OpStore %27 %28 + OpBranch %29 + %29 = OpLabel + %154 = OpPhi %14 %28 %7 %58 %32 + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %37 = OpSLessThan %36 %154 %26 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + %45 = OpIAdd %14 %154 %26 + %46 = OpAccessChain %15 %41 %45 + %47 = OpLoad %14 %46 + %48 = OpAccessChain %15 %41 %154 + OpStore %48 %47 + %51 = OpIAdd %14 %154 %26 + %53 = OpAccessChain %15 %41 %154 + %54 = OpLoad %14 %53 + %55 = OpAccessChain %15 %41 %51 + OpStore %55 %54 + OpBranch %32 + %32 = OpLabel + %58 = OpIAdd %14 %154 %57 + OpStore %27 %58 + OpBranch %29 + %31 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %59 = OpVariable %15 Function + %63 = OpVariable %15 Function + %72 = OpVariable %40 Function + %60 = OpAccessChain %23 %20 %22 + %61 = OpLoad %17 %60 + %62 = OpConvertFToS %14 %61 + OpStore %59 %62 + OpStore %63 %28 + OpBranch %64 + %64 = OpLabel + %155 = OpPhi %14 %28 %9 %88 %67 + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %71 = OpSLessThanEqual %36 %155 %62 + OpBranchConditional %71 %65 %66 + %65 = OpLabel + %76 = OpIAdd %14 %155 %62 + %77 = OpAccessChain %15 %72 %76 + %78 = OpLoad %14 %77 + %79 = OpAccessChain %15 %72 %155 + OpStore %79 %78 + %82 = OpIAdd %14 %155 %62 + %84 = OpAccessChain %15 %72 %155 + %85 = OpLoad %14 %84 + %86 = OpAccessChain %15 %72 %82 + OpStore %86 %85 + OpBranch %67 + %67 = OpLabel + %88 = OpIAdd %14 %155 %57 + OpStore %63 %88 + OpBranch %64 + %66 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %89 = OpVariable %15 Function + %93 = OpVariable %15 Function + %103 = OpVariable %40 Function + %90 = OpAccessChain %23 %20 %22 + %91 = OpLoad %17 %90 + %92 = OpConvertFToS %14 %91 + OpStore %89 %92 + OpStore %93 %94 + OpBranch %95 + %95 = OpLabel + %156 = OpPhi %14 %94 %11 %119 %98 + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %102 = OpSGreaterThan %36 %156 %92 + OpBranchConditional %102 %96 %97 + %96 = OpLabel + %107 = OpIAdd %14 %156 %92 + %108 = OpAccessChain %15 %103 %107 + %109 = OpLoad %14 %108 + %110 = OpAccessChain %15 %103 %156 + OpStore %110 %109 + %113 = OpIAdd %14 %156 %92 + %115 = OpAccessChain %15 %103 %156 + %116 = OpLoad %14 %115 + %117 = OpAccessChain %15 %103 %113 + OpStore %117 %116 + OpBranch %98 + %98 = OpLabel + %119 = OpISub %14 %156 %57 + OpStore %93 %119 + OpBranch %95 + %97 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %120 = OpVariable %15 Function + %124 = OpVariable %15 Function + %133 = OpVariable %40 Function + %121 = OpAccessChain %23 %20 %22 + %122 = OpLoad %17 %121 + %123 = OpConvertFToS %14 %122 + OpStore %120 %123 + OpStore %124 %94 + OpBranch %125 + %125 = OpLabel + %157 = OpPhi %14 %94 %13 %149 %128 + OpLoopMerge %127 %128 None + OpBranch %129 + %129 = OpLabel + %132 = OpSGreaterThanEqual %36 %157 %123 + OpBranchConditional %132 %126 %127 + %126 = OpLabel + %137 = OpIAdd %14 %157 %123 + %138 = OpAccessChain %15 %133 %137 + %139 = OpLoad %14 %138 + %140 = OpAccessChain %15 %133 %157 + OpStore %140 %139 + %143 = OpIAdd %14 %157 %123 + %145 = OpAccessChain %15 %133 %157 + %146 = OpLoad %14 %145 + %147 = OpAccessChain %15 %133 %143 + OpStore %147 %146 + OpBranch %128 + %128 = OpLabel + %149 = OpISub %14 %157 %57 + OpStore %124 %149 + OpBranch %125 + %127 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + { + // Function a + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 30)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 47 -> 48 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(47) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent and supported. + EXPECT_TRUE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 54 -> 55 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(54) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent but not supported. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function b + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 65)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 78 -> 79 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(78) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 85 -> 86 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(85) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function c + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 96)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 109 -> 110 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(109) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent but not supported. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 116 -> 117 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(116) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent but not supported. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function d + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 126)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 139 -> 140 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(139) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 146 -> 147 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(146) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +layout(location = 0) in vec4 in_vec; +// Loop iterates from symbolic to constant +void a() { + int N = int(in_vec.x); + int arr[10]; + for (int i = N; i < 9; i++) { // Bounds are 9 - N - 1 + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void b() { + int N = int(in_vec.x); + int arr[10]; + for (int i = N; i <= 9; i++) { // Bounds are 9 - N + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void c() { + int N = int(in_vec.x); + int arr[10]; + for (int i = N; i > 0; i--) { // Bounds are N - 0 - 1 + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void d() { + int N = int(in_vec.x); + int arr[10]; + for (int i = N; i >= 0; i--) { // Bounds are N - 0 + arr[i] = arr[i+N]; // |distance| = N + arr[i+N] = arr[i]; // |distance| = N + } +} +void main(){ + a(); + b(); + c(); + d(); +} +*/ +TEST(DependencyAnalysisHelpers, symbolic_to_const) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %16 "N" + OpName %20 "in_vec" + OpName %27 "i" + OpName %41 "arr" + OpName %59 "N" + OpName %63 "i" + OpName %72 "arr" + OpName %89 "N" + OpName %93 "i" + OpName %103 "arr" + OpName %120 "N" + OpName %124 "i" + OpName %133 "arr" + OpDecorate %20 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %14 = OpTypeInt 32 1 + %15 = OpTypePointer Function %14 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %17 + %35 = OpConstant %14 9 + %36 = OpTypeBool + %38 = OpConstant %21 10 + %39 = OpTypeArray %14 %38 + %40 = OpTypePointer Function %39 + %57 = OpConstant %14 1 + %101 = OpConstant %14 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %150 = OpFunctionCall %2 %6 + %151 = OpFunctionCall %2 %8 + %152 = OpFunctionCall %2 %10 + %153 = OpFunctionCall %2 %12 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpVariable %15 Function + %27 = OpVariable %15 Function + %41 = OpVariable %40 Function + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %17 %24 + %26 = OpConvertFToS %14 %25 + OpStore %16 %26 + OpStore %27 %26 + OpBranch %29 + %29 = OpLabel + %154 = OpPhi %14 %26 %7 %58 %32 + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %37 = OpSLessThan %36 %154 %35 + OpBranchConditional %37 %30 %31 + %30 = OpLabel + %45 = OpIAdd %14 %154 %26 + %46 = OpAccessChain %15 %41 %45 + %47 = OpLoad %14 %46 + %48 = OpAccessChain %15 %41 %154 + OpStore %48 %47 + %51 = OpIAdd %14 %154 %26 + %53 = OpAccessChain %15 %41 %154 + %54 = OpLoad %14 %53 + %55 = OpAccessChain %15 %41 %51 + OpStore %55 %54 + OpBranch %32 + %32 = OpLabel + %58 = OpIAdd %14 %154 %57 + OpStore %27 %58 + OpBranch %29 + %31 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %59 = OpVariable %15 Function + %63 = OpVariable %15 Function + %72 = OpVariable %40 Function + %60 = OpAccessChain %23 %20 %22 + %61 = OpLoad %17 %60 + %62 = OpConvertFToS %14 %61 + OpStore %59 %62 + OpStore %63 %62 + OpBranch %65 + %65 = OpLabel + %155 = OpPhi %14 %62 %9 %88 %68 + OpLoopMerge %67 %68 None + OpBranch %69 + %69 = OpLabel + %71 = OpSLessThanEqual %36 %155 %35 + OpBranchConditional %71 %66 %67 + %66 = OpLabel + %76 = OpIAdd %14 %155 %62 + %77 = OpAccessChain %15 %72 %76 + %78 = OpLoad %14 %77 + %79 = OpAccessChain %15 %72 %155 + OpStore %79 %78 + %82 = OpIAdd %14 %155 %62 + %84 = OpAccessChain %15 %72 %155 + %85 = OpLoad %14 %84 + %86 = OpAccessChain %15 %72 %82 + OpStore %86 %85 + OpBranch %68 + %68 = OpLabel + %88 = OpIAdd %14 %155 %57 + OpStore %63 %88 + OpBranch %65 + %67 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %89 = OpVariable %15 Function + %93 = OpVariable %15 Function + %103 = OpVariable %40 Function + %90 = OpAccessChain %23 %20 %22 + %91 = OpLoad %17 %90 + %92 = OpConvertFToS %14 %91 + OpStore %89 %92 + OpStore %93 %92 + OpBranch %95 + %95 = OpLabel + %156 = OpPhi %14 %92 %11 %119 %98 + OpLoopMerge %97 %98 None + OpBranch %99 + %99 = OpLabel + %102 = OpSGreaterThan %36 %156 %101 + OpBranchConditional %102 %96 %97 + %96 = OpLabel + %107 = OpIAdd %14 %156 %92 + %108 = OpAccessChain %15 %103 %107 + %109 = OpLoad %14 %108 + %110 = OpAccessChain %15 %103 %156 + OpStore %110 %109 + %113 = OpIAdd %14 %156 %92 + %115 = OpAccessChain %15 %103 %156 + %116 = OpLoad %14 %115 + %117 = OpAccessChain %15 %103 %113 + OpStore %117 %116 + OpBranch %98 + %98 = OpLabel + %119 = OpISub %14 %156 %57 + OpStore %93 %119 + OpBranch %95 + %97 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %120 = OpVariable %15 Function + %124 = OpVariable %15 Function + %133 = OpVariable %40 Function + %121 = OpAccessChain %23 %20 %22 + %122 = OpLoad %17 %121 + %123 = OpConvertFToS %14 %122 + OpStore %120 %123 + OpStore %124 %123 + OpBranch %126 + %126 = OpLabel + %157 = OpPhi %14 %123 %13 %149 %129 + OpLoopMerge %128 %129 None + OpBranch %130 + %130 = OpLabel + %132 = OpSGreaterThanEqual %36 %157 %101 + OpBranchConditional %132 %127 %128 + %127 = OpLabel + %137 = OpIAdd %14 %157 %123 + %138 = OpAccessChain %15 %133 %137 + %139 = OpLoad %14 %138 + %140 = OpAccessChain %15 %133 %157 + OpStore %140 %139 + %143 = OpIAdd %14 %157 %123 + %145 = OpAccessChain %15 %133 %157 + %146 = OpLoad %14 %145 + %147 = OpAccessChain %15 %133 %143 + OpStore %147 %146 + OpBranch %129 + %129 = OpLabel + %149 = OpISub %14 %157 %57 + OpStore %124 %149 + OpBranch %126 + %128 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + { + // Function a + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 30)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 47 -> 48 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(47) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent but not supported. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 54 -> 55 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(54) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent but not supported. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function b + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 66)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 78 -> 79 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(78) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 85 -> 86 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(85) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function c + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 96)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 109 -> 110 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(109) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent and supported. + EXPECT_TRUE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 116 -> 117 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(116) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Independent but not supported. + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function d + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 127)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 139 -> 140 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(139) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 146 -> 147 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(146) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + // Dependent + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } +} + +/* + Generated from the following GLSL fragment shader + with --eliminate-local-multi-store +#version 440 core +layout(location = 0) in vec4 in_vec; +// Loop iterates from symbolic to symbolic +void a() { + int M = int(in_vec.x); + int N = int(in_vec.y); + int arr[10]; + for (int i = M; i < N; i++) { // Bounds are N - M - 1 + arr[i+M+N] = arr[i+M+2*N]; // |distance| = N + arr[i+M+2*N] = arr[i+M+N]; // |distance| = N + } +} +void b() { + int M = int(in_vec.x); + int N = int(in_vec.y); + int arr[10]; + for (int i = M; i <= N; i++) { // Bounds are N - M + arr[i+M+N] = arr[i+M+2*N]; // |distance| = N + arr[i+M+2*N] = arr[i+M+N]; // |distance| = N + } +} +void c() { + int M = int(in_vec.x); + int N = int(in_vec.y); + int arr[10]; + for (int i = M; i > N; i--) { // Bounds are M - N - 1 + arr[i+M+N] = arr[i+M+2*N]; // |distance| = N + arr[i+M+2*N] = arr[i+M+N]; // |distance| = N + } +} +void d() { + int M = int(in_vec.x); + int N = int(in_vec.y); + int arr[10]; + for (int i = M; i >= N; i--) { // Bounds are M - N + arr[i+M+N] = arr[i+M+2*N]; // |distance| = N + arr[i+M+2*N] = arr[i+M+N]; // |distance| = N + } +} +void main(){ + a(); + b(); + c(); + d(); +} +*/ +TEST(DependencyAnalysisHelpers, symbolic_to_symbolic) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %20 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %6 "a(" + OpName %8 "b(" + OpName %10 "c(" + OpName %12 "d(" + OpName %16 "M" + OpName %20 "in_vec" + OpName %27 "N" + OpName %32 "i" + OpName %46 "arr" + OpName %79 "M" + OpName %83 "N" + OpName %87 "i" + OpName %97 "arr" + OpName %128 "M" + OpName %132 "N" + OpName %136 "i" + OpName %146 "arr" + OpName %177 "M" + OpName %181 "N" + OpName %185 "i" + OpName %195 "arr" + OpDecorate %20 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %14 = OpTypeInt 32 1 + %15 = OpTypePointer Function %14 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Input %18 + %20 = OpVariable %19 Input + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 0 + %23 = OpTypePointer Input %17 + %28 = OpConstant %21 1 + %41 = OpTypeBool + %43 = OpConstant %21 10 + %44 = OpTypeArray %14 %43 + %45 = OpTypePointer Function %44 + %55 = OpConstant %14 2 + %77 = OpConstant %14 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %226 = OpFunctionCall %2 %6 + %227 = OpFunctionCall %2 %8 + %228 = OpFunctionCall %2 %10 + %229 = OpFunctionCall %2 %12 + OpReturn + OpFunctionEnd + %6 = OpFunction %2 None %3 + %7 = OpLabel + %16 = OpVariable %15 Function + %27 = OpVariable %15 Function + %32 = OpVariable %15 Function + %46 = OpVariable %45 Function + %24 = OpAccessChain %23 %20 %22 + %25 = OpLoad %17 %24 + %26 = OpConvertFToS %14 %25 + OpStore %16 %26 + %29 = OpAccessChain %23 %20 %28 + %30 = OpLoad %17 %29 + %31 = OpConvertFToS %14 %30 + OpStore %27 %31 + OpStore %32 %26 + OpBranch %34 + %34 = OpLabel + %230 = OpPhi %14 %26 %7 %78 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %42 = OpSLessThan %41 %230 %31 + OpBranchConditional %42 %35 %36 + %35 = OpLabel + %49 = OpIAdd %14 %230 %26 + %51 = OpIAdd %14 %49 %31 + %54 = OpIAdd %14 %230 %26 + %57 = OpIMul %14 %55 %31 + %58 = OpIAdd %14 %54 %57 + %59 = OpAccessChain %15 %46 %58 + %60 = OpLoad %14 %59 + %61 = OpAccessChain %15 %46 %51 + OpStore %61 %60 + %64 = OpIAdd %14 %230 %26 + %66 = OpIMul %14 %55 %31 + %67 = OpIAdd %14 %64 %66 + %70 = OpIAdd %14 %230 %26 + %72 = OpIAdd %14 %70 %31 + %73 = OpAccessChain %15 %46 %72 + %74 = OpLoad %14 %73 + %75 = OpAccessChain %15 %46 %67 + OpStore %75 %74 + OpBranch %37 + %37 = OpLabel + %78 = OpIAdd %14 %230 %77 + OpStore %32 %78 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %2 None %3 + %9 = OpLabel + %79 = OpVariable %15 Function + %83 = OpVariable %15 Function + %87 = OpVariable %15 Function + %97 = OpVariable %45 Function + %80 = OpAccessChain %23 %20 %22 + %81 = OpLoad %17 %80 + %82 = OpConvertFToS %14 %81 + OpStore %79 %82 + %84 = OpAccessChain %23 %20 %28 + %85 = OpLoad %17 %84 + %86 = OpConvertFToS %14 %85 + OpStore %83 %86 + OpStore %87 %82 + OpBranch %89 + %89 = OpLabel + %231 = OpPhi %14 %82 %9 %127 %92 + OpLoopMerge %91 %92 None + OpBranch %93 + %93 = OpLabel + %96 = OpSLessThanEqual %41 %231 %86 + OpBranchConditional %96 %90 %91 + %90 = OpLabel + %100 = OpIAdd %14 %231 %82 + %102 = OpIAdd %14 %100 %86 + %105 = OpIAdd %14 %231 %82 + %107 = OpIMul %14 %55 %86 + %108 = OpIAdd %14 %105 %107 + %109 = OpAccessChain %15 %97 %108 + %110 = OpLoad %14 %109 + %111 = OpAccessChain %15 %97 %102 + OpStore %111 %110 + %114 = OpIAdd %14 %231 %82 + %116 = OpIMul %14 %55 %86 + %117 = OpIAdd %14 %114 %116 + %120 = OpIAdd %14 %231 %82 + %122 = OpIAdd %14 %120 %86 + %123 = OpAccessChain %15 %97 %122 + %124 = OpLoad %14 %123 + %125 = OpAccessChain %15 %97 %117 + OpStore %125 %124 + OpBranch %92 + %92 = OpLabel + %127 = OpIAdd %14 %231 %77 + OpStore %87 %127 + OpBranch %89 + %91 = OpLabel + OpReturn + OpFunctionEnd + %10 = OpFunction %2 None %3 + %11 = OpLabel + %128 = OpVariable %15 Function + %132 = OpVariable %15 Function + %136 = OpVariable %15 Function + %146 = OpVariable %45 Function + %129 = OpAccessChain %23 %20 %22 + %130 = OpLoad %17 %129 + %131 = OpConvertFToS %14 %130 + OpStore %128 %131 + %133 = OpAccessChain %23 %20 %28 + %134 = OpLoad %17 %133 + %135 = OpConvertFToS %14 %134 + OpStore %132 %135 + OpStore %136 %131 + OpBranch %138 + %138 = OpLabel + %232 = OpPhi %14 %131 %11 %176 %141 + OpLoopMerge %140 %141 None + OpBranch %142 + %142 = OpLabel + %145 = OpSGreaterThan %41 %232 %135 + OpBranchConditional %145 %139 %140 + %139 = OpLabel + %149 = OpIAdd %14 %232 %131 + %151 = OpIAdd %14 %149 %135 + %154 = OpIAdd %14 %232 %131 + %156 = OpIMul %14 %55 %135 + %157 = OpIAdd %14 %154 %156 + %158 = OpAccessChain %15 %146 %157 + %159 = OpLoad %14 %158 + %160 = OpAccessChain %15 %146 %151 + OpStore %160 %159 + %163 = OpIAdd %14 %232 %131 + %165 = OpIMul %14 %55 %135 + %166 = OpIAdd %14 %163 %165 + %169 = OpIAdd %14 %232 %131 + %171 = OpIAdd %14 %169 %135 + %172 = OpAccessChain %15 %146 %171 + %173 = OpLoad %14 %172 + %174 = OpAccessChain %15 %146 %166 + OpStore %174 %173 + OpBranch %141 + %141 = OpLabel + %176 = OpISub %14 %232 %77 + OpStore %136 %176 + OpBranch %138 + %140 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %13 = OpLabel + %177 = OpVariable %15 Function + %181 = OpVariable %15 Function + %185 = OpVariable %15 Function + %195 = OpVariable %45 Function + %178 = OpAccessChain %23 %20 %22 + %179 = OpLoad %17 %178 + %180 = OpConvertFToS %14 %179 + OpStore %177 %180 + %182 = OpAccessChain %23 %20 %28 + %183 = OpLoad %17 %182 + %184 = OpConvertFToS %14 %183 + OpStore %181 %184 + OpStore %185 %180 + OpBranch %187 + %187 = OpLabel + %233 = OpPhi %14 %180 %13 %225 %190 + OpLoopMerge %189 %190 None + OpBranch %191 + %191 = OpLabel + %194 = OpSGreaterThanEqual %41 %233 %184 + OpBranchConditional %194 %188 %189 + %188 = OpLabel + %198 = OpIAdd %14 %233 %180 + %200 = OpIAdd %14 %198 %184 + %203 = OpIAdd %14 %233 %180 + %205 = OpIMul %14 %55 %184 + %206 = OpIAdd %14 %203 %205 + %207 = OpAccessChain %15 %195 %206 + %208 = OpLoad %14 %207 + %209 = OpAccessChain %15 %195 %200 + OpStore %209 %208 + %212 = OpIAdd %14 %233 %180 + %214 = OpIMul %14 %55 %184 + %215 = OpIAdd %14 %212 %214 + %218 = OpIAdd %14 %233 %180 + %220 = OpIAdd %14 %218 %184 + %221 = OpAccessChain %15 %195 %220 + %222 = OpLoad %14 %221 + %223 = OpAccessChain %15 %195 %215 + OpStore %223 %222 + OpBranch %190 + %190 = OpLabel + %225 = OpISub %14 %233 %77 + OpStore %185 %225 + OpBranch %187 + %189 = OpLabel + OpReturn + OpFunctionEnd +)"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + { + // Function a + const Function* f = spvtest::GetFunction(module, 6); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 35)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 60 -> 61 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(60) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 74 -> 75 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(74) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function b + const Function* f = spvtest::GetFunction(module, 8); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 90)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 110 -> 111 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(110) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 124 -> 125 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(124) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function c + const Function* f = spvtest::GetFunction(module, 10); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 139)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 159 -> 160 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(159) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 173 -> 174 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(173) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } + { + // Function d + const Function* f = spvtest::GetFunction(module, 12); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + Loop* loop = &ld.GetLoopByIndex(0); + std::vector loops{loop}; + LoopDependenceAnalysis analysis{context.get(), loops}; + + const Instruction* stores[2]; + int stores_found = 0; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 188)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[stores_found] = &inst; + ++stores_found; + } + } + + for (int i = 0; i < 2; ++i) { + EXPECT_TRUE(stores[i]); + } + + // 208 -> 209 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(208) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[0]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + + // 222 -> 223 + { + // Analyse and simplify the instruction behind the access chain of this + // load. + Instruction* load_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(context->get_def_use_mgr() + ->GetDef(222) + ->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* load = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(load_var)); + + // Analyse and simplify the instruction behind the access chain of this + // store. + Instruction* store_var = context->get_def_use_mgr()->GetDef( + context->get_def_use_mgr() + ->GetDef(stores[1]->GetSingleWordInOperand(0)) + ->GetSingleWordInOperand(1)); + SENode* store = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->AnalyzeInstruction(store_var)); + + SENode* delta = analysis.GetScalarEvolution()->SimplifyExpression( + analysis.GetScalarEvolution()->CreateSubtraction(load, store)); + + EXPECT_FALSE(analysis.IsProvablyOutsideOfLoopBounds( + loop, delta, store->AsSERecurrentNode()->GetCoefficient())); + } + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp new file mode 100644 index 00000000000..cda8576c5dd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_compatibility.cpp @@ -0,0 +1,1785 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using FusionCompatibilityTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int i = 0; // Can't fuse, i=0 in first & i=10 in second + for (; i < 10; i++) {} + for (; i < 10; i++) {} +} +*/ +TEST_F(FusionCompatibilityTest, SameInductionVariableDifferentBounds) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %31 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %31 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %31 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpBranch %22 + %22 = OpLabel + %32 = OpPhi %6 %31 %12 %30 %25 + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %28 = OpSLessThan %17 %32 %16 + OpBranchConditional %28 %23 %24 + %23 = OpLabel + OpBranch %25 + %25 = OpLabel + %30 = OpIAdd %6 %32 %20 + OpStore %8 %30 + OpBranch %22 + %24 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 1 +#version 440 core +void main() { + for (int i = 0; i < 10; i++) {} + for (int i = 0; i < 10; i++) {} +} +*/ +TEST_F(FusionCompatibilityTest, Compatible) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %32 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %32 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %32 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %9 + OpBranch %23 + %23 = OpLabel + %33 = OpPhi %6 %9 %12 %31 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %17 %33 %16 + OpBranchConditional %29 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %31 = OpIAdd %6 %33 %20 + OpStore %22 %31 + OpBranch %23 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 2 +#version 440 core +void main() { + for (int i = 0; i < 10; i++) {} + for (int j = 0; j < 10; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, DifferentName) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %32 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %32 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %32 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %9 + OpBranch %23 + %23 = OpLabel + %33 = OpPhi %6 %9 %12 %31 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %17 %33 %16 + OpBranchConditional %29 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %31 = OpIAdd %6 %33 %20 + OpStore %22 %31 + OpBranch %23 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + // Can't fuse, different step + for (int i = 0; i < 10; i++) {} + for (int j = 0; j < 10; j=j+2) {} +} + +*/ +TEST_F(FusionCompatibilityTest, SameBoundsDifferentStep) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %31 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %33 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %33 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %33 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %9 + OpBranch %23 + %23 = OpLabel + %34 = OpPhi %6 %9 %12 %32 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %17 %34 %16 + OpBranchConditional %29 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %32 = OpIAdd %6 %34 %31 + OpStore %22 %32 + OpBranch %23 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 4 +#version 440 core +void main() { + // Can't fuse, different upper bound + for (int i = 0; i < 10; i++) {} + for (int j = 0; j < 20; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, DifferentUpperBound) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %29 = OpConstant %6 20 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %33 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %33 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %33 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %9 + OpBranch %23 + %23 = OpLabel + %34 = OpPhi %6 %9 %12 %32 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %30 = OpSLessThan %17 %34 %29 + OpBranchConditional %30 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %32 = OpIAdd %6 %34 %20 + OpStore %22 %32 + OpBranch %23 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 5 +#version 440 core +void main() { + // Can't fuse, different lower bound + for (int i = 5; i < 10; i++) {} + for (int j = 0; j < 10; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, DifferentLowerBound) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 5 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %23 = OpConstant %6 0 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %33 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %33 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %33 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %23 + OpBranch %24 + %24 = OpLabel + %34 = OpPhi %6 %23 %12 %32 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %30 = OpSLessThan %17 %34 %16 + OpBranchConditional %30 %25 %26 + %25 = OpLabel + OpBranch %27 + %27 = OpLabel + %32 = OpIAdd %6 %34 %20 + OpStore %22 %32 + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 6 +#version 440 core +void main() { + // Can't fuse, break in first loop + for (int i = 0; i < 10; i++) { + if (i == 5) { + break; + } + } + for (int j = 0; j < 10; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, Break) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %28 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 5 + %26 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %28 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %38 = OpPhi %6 %9 %5 %27 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %38 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %21 = OpIEqual %17 %38 %20 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + OpBranch %12 + %23 = OpLabel + OpBranch %13 + %13 = OpLabel + %27 = OpIAdd %6 %38 %26 + OpStore %8 %27 + OpBranch %10 + %12 = OpLabel + OpStore %28 %9 + OpBranch %29 + %29 = OpLabel + %39 = OpPhi %6 %9 %12 %37 %32 + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %35 = OpSLessThan %17 %39 %16 + OpBranchConditional %35 %30 %31 + %30 = OpLabel + OpBranch %32 + %32 = OpLabel + %37 = OpIAdd %6 %39 %26 + OpStore %28 %37 + OpBranch %29 + %31 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +layout(location = 0) in vec4 c; +void main() { + int N = int(c.x); + for (int i = 0; i < N; i++) {} + for (int j = 0; j < N; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, UnknownButSameUpperBound) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "N" + OpName %12 "c" + OpName %19 "i" + OpName %33 "j" + OpDecorate %12 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %20 = OpConstant %6 0 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %33 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + OpStore %19 %20 + OpBranch %21 + %21 = OpLabel + %44 = OpPhi %6 %20 %5 %32 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %29 = OpSLessThan %28 %44 %18 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + OpBranch %24 + %24 = OpLabel + %32 = OpIAdd %6 %44 %31 + OpStore %19 %32 + OpBranch %21 + %23 = OpLabel + OpStore %33 %20 + OpBranch %34 + %34 = OpLabel + %46 = OpPhi %6 %20 %23 %43 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %41 = OpSLessThan %28 %46 %18 + OpBranchConditional %41 %35 %36 + %35 = OpLabel + OpBranch %37 + %37 = OpLabel + %43 = OpIAdd %6 %46 %31 + OpStore %33 %43 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +layout(location = 0) in vec4 c; +void main() { + int N = int(c.x); + for (int i = 0; N > j; i++) {} + for (int j = 0; N > j; j++) {} +} +*/ +TEST_F(FusionCompatibilityTest, UnknownButSameUpperBoundReverseCondition) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "N" + OpName %12 "c" + OpName %19 "i" + OpName %33 "j" + OpDecorate %12 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %20 = OpConstant %6 0 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %33 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + OpStore %19 %20 + OpBranch %21 + %21 = OpLabel + %45 = OpPhi %6 %20 %5 %32 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %29 = OpSGreaterThan %28 %18 %45 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + OpBranch %24 + %24 = OpLabel + %32 = OpIAdd %6 %45 %31 + OpStore %19 %32 + OpBranch %21 + %23 = OpLabel + OpStore %33 %20 + OpBranch %34 + %34 = OpLabel + %47 = OpPhi %6 %20 %23 %43 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %41 = OpSGreaterThan %28 %18 %47 + OpBranchConditional %41 %35 %36 + %35 = OpLabel + OpBranch %37 + %37 = OpLabel + %43 = OpIAdd %6 %47 %31 + OpStore %33 %43 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +layout(location = 0) in vec4 c; +void main() { + // Can't fuse different bound + int N = int(c.x); + for (int i = 0; i < N; i++) {} + for (int j = 0; j < N+1; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, UnknownUpperBoundAddition) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "N" + OpName %12 "c" + OpName %19 "i" + OpName %33 "j" + OpDecorate %12 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %20 = OpConstant %6 0 + %28 = OpTypeBool + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %33 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + OpStore %19 %20 + OpBranch %21 + %21 = OpLabel + %45 = OpPhi %6 %20 %5 %32 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %29 = OpSLessThan %28 %45 %18 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + OpBranch %24 + %24 = OpLabel + %32 = OpIAdd %6 %45 %31 + OpStore %19 %32 + OpBranch %21 + %23 = OpLabel + OpStore %33 %20 + OpBranch %34 + %34 = OpLabel + %47 = OpPhi %6 %20 %23 %44 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %41 = OpIAdd %6 %18 %31 + %42 = OpSLessThan %28 %47 %41 + OpBranchConditional %42 %35 %36 + %35 = OpLabel + OpBranch %37 + %37 = OpLabel + %44 = OpIAdd %6 %47 %31 + OpStore %33 %44 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 10 +#version 440 core +void main() { + for (int i = 0; i < 10; i++) {} + for (int j = 0; j < 10; j++) {} + for (int k = 0; k < 10; k++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, SeveralAdjacentLoops) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "j" + OpName %32 "k" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + %32 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %42 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %42 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %42 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %9 + OpBranch %23 + %23 = OpLabel + %43 = OpPhi %6 %9 %12 %31 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %17 %43 %16 + OpBranchConditional %29 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %31 = OpIAdd %6 %43 %20 + OpStore %22 %31 + OpBranch %23 + %25 = OpLabel + OpStore %32 %9 + OpBranch %33 + %33 = OpLabel + %44 = OpPhi %6 %9 %25 %41 %36 + OpLoopMerge %35 %36 None + OpBranch %37 + %37 = OpLabel + %39 = OpSLessThan %17 %44 %16 + OpBranchConditional %39 %34 %35 + %34 = OpLabel + OpBranch %36 + %36 = OpLabel + %41 = OpIAdd %6 %44 %20 + OpStore %32 %41 + OpBranch %33 + %35 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + EXPECT_FALSE(LoopFusion(context.get(), loop_0, loop_0).AreCompatible()); + EXPECT_FALSE(LoopFusion(context.get(), loop_0, loop_2).AreCompatible()); + EXPECT_FALSE(LoopFusion(context.get(), loop_1, loop_0).AreCompatible()); + EXPECT_TRUE(LoopFusion(context.get(), loop_0, loop_1).AreCompatible()); + EXPECT_TRUE(LoopFusion(context.get(), loop_1, loop_2).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + // Can't fuse, not adjacent + int x = 0; + for (int i = 0; i < 10; i++) { + if (i > 10) { + x++; + } + } + x++; + for (int j = 0; j < 10; j++) {} + for (int k = 0; k < 10; k++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, NonAdjacentLoops) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "x" + OpName %10 "i" + OpName %31 "j" + OpName %41 "k" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %25 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %31 = OpVariable %7 Function + %41 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %52 = OpPhi %6 %9 %5 %56 %14 + %51 = OpPhi %6 %9 %5 %28 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %51 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %21 = OpSGreaterThan %18 %52 %17 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + %26 = OpIAdd %6 %52 %25 + OpStore %8 %26 + OpBranch %23 + %23 = OpLabel + %56 = OpPhi %6 %52 %12 %26 %22 + OpBranch %14 + %14 = OpLabel + %28 = OpIAdd %6 %51 %25 + OpStore %10 %28 + OpBranch %11 + %13 = OpLabel + %30 = OpIAdd %6 %52 %25 + OpStore %8 %30 + OpStore %31 %9 + OpBranch %32 + %32 = OpLabel + %53 = OpPhi %6 %9 %13 %40 %35 + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %38 = OpSLessThan %18 %53 %17 + OpBranchConditional %38 %33 %34 + %33 = OpLabel + OpBranch %35 + %35 = OpLabel + %40 = OpIAdd %6 %53 %25 + OpStore %31 %40 + OpBranch %32 + %34 = OpLabel + OpStore %41 %9 + OpBranch %42 + %42 = OpLabel + %54 = OpPhi %6 %9 %34 %50 %45 + OpLoopMerge %44 %45 None + OpBranch %46 + %46 = OpLabel + %48 = OpSLessThan %18 %54 %17 + OpBranchConditional %48 %43 %44 + %43 = OpLabel + OpBranch %45 + %45 = OpLabel + %50 = OpIAdd %6 %54 %25 + OpStore %41 %50 + OpBranch %42 + %44 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + EXPECT_FALSE(LoopFusion(context.get(), loop_0, loop_0).AreCompatible()); + EXPECT_FALSE(LoopFusion(context.get(), loop_0, loop_2).AreCompatible()); + EXPECT_FALSE(LoopFusion(context.get(), loop_0, loop_1).AreCompatible()); + EXPECT_TRUE(LoopFusion(context.get(), loop_1, loop_2).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 12 +#version 440 core +void main() { + int j = 0; + int i = 0; + for (; i < 10; i++) {} + for (; j < 10; j++) {} +} + +*/ +TEST_F(FusionCompatibilityTest, CompatibleInitDeclaredBeforeLoops) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "j" + OpName %10 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %21 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %32 = OpPhi %6 %9 %5 %22 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %32 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + OpBranch %14 + %14 = OpLabel + %22 = OpIAdd %6 %32 %21 + OpStore %10 %22 + OpBranch %11 + %13 = OpLabel + OpBranch %23 + %23 = OpLabel + %33 = OpPhi %6 %9 %13 %31 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %18 %33 %17 + OpBranchConditional %29 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %31 = OpIAdd %6 %33 %21 + OpStore %8 %31 + OpBranch %23 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + EXPECT_TRUE(LoopFusion(context.get(), loops[0], loops[1]).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 13 regenerate! +#version 440 core +void main() { + int[10] a; + int[10] b; + // Can't fuse, several induction variables + for (int j = 0; j < 10; j++) { + b[i] = a[i]; + } + for (int i = 0, j = 0; i < 10; i++, j = j+2) { + } +} + +*/ +TEST_F(FusionCompatibilityTest, SeveralInductionVariables) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "j" + OpName %23 "b" + OpName %25 "a" + OpName %33 "i" + OpName %34 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %31 = OpConstant %6 1 + %48 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %33 = OpVariable %7 Function + %34 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %50 = OpPhi %6 %9 %5 %32 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %50 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %50 + %28 = OpLoad %6 %27 + %29 = OpAccessChain %7 %23 %50 + OpStore %29 %28 + OpBranch %13 + %13 = OpLabel + %32 = OpIAdd %6 %50 %31 + OpStore %8 %32 + OpBranch %10 + %12 = OpLabel + OpStore %33 %9 + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %52 = OpPhi %6 %9 %12 %49 %38 + %51 = OpPhi %6 %9 %12 %46 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %51 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %44 = OpAccessChain %7 %25 %52 + OpStore %44 %51 + OpBranch %38 + %38 = OpLabel + %46 = OpIAdd %6 %51 %31 + OpStore %33 %46 + %49 = OpIAdd %6 %52 %48 + OpStore %34 %49 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + EXPECT_FALSE(LoopFusion(context.get(), loops[0], loops[1]).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 14 +#version 440 core +void main() { + // Fine + for (int i = 0; i < 10; i = i + 2) {} + for (int j = 0; j < 10; j = j + 2) {} +} + +*/ +TEST_F(FusionCompatibilityTest, CompatibleNonIncrementStep) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "j" + OpName %10 "i" + OpName %11 "i" + OpName %24 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %22 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %11 = OpVariable %7 Function + %24 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + %34 = OpPhi %6 %9 %5 %23 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %34 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + OpBranch %15 + %15 = OpLabel + %23 = OpIAdd %6 %34 %22 + OpStore %11 %23 + OpBranch %12 + %14 = OpLabel + OpStore %24 %9 + OpBranch %25 + %25 = OpLabel + %35 = OpPhi %6 %9 %14 %33 %28 + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %31 = OpSLessThan %19 %35 %18 + OpBranchConditional %31 %26 %27 + %26 = OpLabel + OpBranch %28 + %28 = OpLabel + %33 = OpIAdd %6 %35 %22 + OpStore %24 %33 + OpBranch %25 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + EXPECT_TRUE(LoopFusion(context.get(), loops[0], loops[1]).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 15 +#version 440 core + +int j = 0; + +void main() { + // Not compatible, unknown init for second. + for (int i = 0; i < 10; i = i + 2) {} + for (; j < 10; j = j + 2) {} +} + +*/ +TEST_F(FusionCompatibilityTest, UnknonInitForSecondLoop) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "j" + OpName %11 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Private %6 + %8 = OpVariable %7 Private + %9 = OpConstant %6 0 + %10 = OpTypePointer Function %6 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %22 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpVariable %10 Function + OpStore %8 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + %33 = OpPhi %6 %9 %5 %23 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %33 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + OpBranch %15 + %15 = OpLabel + %23 = OpIAdd %6 %33 %22 + OpStore %11 %23 + OpBranch %12 + %14 = OpLabel + OpBranch %24 + %24 = OpLabel + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %6 %8 + %30 = OpSLessThan %19 %29 %18 + OpBranchConditional %30 %25 %26 + %25 = OpLabel + OpBranch %27 + %27 = OpLabel + %31 = OpLoad %6 %8 + %32 = OpIAdd %6 %31 %22 + OpStore %8 %32 + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + EXPECT_FALSE(LoopFusion(context.get(), loops[0], loops[1]).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 16 +#version 440 core +void main() { + // Not compatible, continue in loop 0 + for (int i = 0; i < 10; ++i) { + if (i % 2 == 1) { + continue; + } + } + for (int j = 0; j < 10; ++j) {} +} + +*/ +TEST_F(FusionCompatibilityTest, Continue) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %29 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 2 + %22 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %29 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %39 = OpPhi %6 %9 %5 %28 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %39 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %21 = OpSMod %6 %39 %20 + %23 = OpIEqual %17 %21 %22 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + OpBranch %13 + %25 = OpLabel + OpBranch %13 + %13 = OpLabel + %28 = OpIAdd %6 %39 %22 + OpStore %8 %28 + OpBranch %10 + %12 = OpLabel + OpStore %29 %9 + OpBranch %30 + %30 = OpLabel + %40 = OpPhi %6 %9 %12 %38 %33 + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %36 = OpSLessThan %17 %40 %16 + OpBranchConditional %36 %31 %32 + %31 = OpLabel + OpBranch %33 + %33 = OpLabel + %38 = OpIAdd %6 %40 %22 + OpStore %29 %38 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + EXPECT_FALSE(LoopFusion(context.get(), loops[0], loops[1]).AreCompatible()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + // Compatible + for (int i = 0; i < 10; ++i) { + if (i % 2 == 1) { + } else { + a[i] = i; + } + } + for (int j = 0; j < 10; ++j) {} +} + +*/ +TEST_F(FusionCompatibilityTest, IfElseInLoop) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %31 "a" + OpName %37 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 2 + %22 = OpConstant %6 1 + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypePointer Function %29 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %31 = OpVariable %30 Function + %37 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %47 = OpPhi %6 %9 %5 %36 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %47 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %21 = OpSMod %6 %47 %20 + %23 = OpIEqual %17 %21 %22 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %26 + %24 = OpLabel + OpBranch %25 + %26 = OpLabel + %34 = OpAccessChain %7 %31 %47 + OpStore %34 %47 + OpBranch %25 + %25 = OpLabel + OpBranch %13 + %13 = OpLabel + %36 = OpIAdd %6 %47 %22 + OpStore %8 %36 + OpBranch %10 + %12 = OpLabel + OpStore %37 %9 + OpBranch %38 + %38 = OpLabel + %48 = OpPhi %6 %9 %12 %46 %41 + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpSLessThan %17 %48 %16 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + OpBranch %41 + %41 = OpLabel + %46 = OpIAdd %6 %48 %22 + OpStore %37 %46 + OpBranch %38 + %40 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + EXPECT_TRUE(LoopFusion(context.get(), loops[0], loops[1]).AreCompatible()); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp new file mode 100644 index 00000000000..26d54457d2a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_illegal.cpp @@ -0,0 +1,1592 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using FusionIllegalTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Illegal, loop-independent dependence will become a + // backward loop-carried antidependence + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i+1] + 2; + } +} + +*/ +TEST_F(FusionIllegalTest, PositiveDistanceCreatedRAW) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %42 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %48 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %53 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %53 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %53 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %53 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %53 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %54 = OpPhi %6 %9 %12 %52 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %54 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpIAdd %6 %54 %29 + %46 = OpAccessChain %7 %23 %45 + %47 = OpLoad %6 %46 + %49 = OpIAdd %6 %47 %48 + %50 = OpAccessChain %7 %42 %54 + OpStore %50 %49 + OpBranch %38 + %38 = OpLabel + %52 = OpIAdd %6 %54 %29 + OpStore %34 %52 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core + +int func() { + return 10; +} + +void main() { + int[10] a; + int[10] b; + // Illegal, function call + for (int i = 0; i < 10; i++) { + a[i] = func(); + } + for (int i = 0; i < 10; i++) { + b[i] = a[i]; + } +} +*/ +TEST_F(FusionIllegalTest, FunctionCall) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "func(" + OpName %14 "i" + OpName %28 "a" + OpName %35 "i" + OpName %43 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpConstant %6 10 + %13 = OpTypePointer Function %6 + %15 = OpConstant %6 0 + %22 = OpTypeBool + %24 = OpTypeInt 32 0 + %25 = OpConstant %24 10 + %26 = OpTypeArray %6 %25 + %27 = OpTypePointer Function %26 + %33 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %14 = OpVariable %13 Function + %28 = OpVariable %27 Function + %35 = OpVariable %13 Function + %43 = OpVariable %27 Function + OpStore %14 %15 + OpBranch %16 + %16 = OpLabel + %51 = OpPhi %6 %15 %5 %34 %19 + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %23 = OpSLessThan %22 %51 %10 + OpBranchConditional %23 %17 %18 + %17 = OpLabel + %30 = OpFunctionCall %6 %8 + %31 = OpAccessChain %13 %28 %51 + OpStore %31 %30 + OpBranch %19 + %19 = OpLabel + %34 = OpIAdd %6 %51 %33 + OpStore %14 %34 + OpBranch %16 + %18 = OpLabel + OpStore %35 %15 + OpBranch %36 + %36 = OpLabel + %52 = OpPhi %6 %15 %18 %50 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %22 %52 %10 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %46 = OpAccessChain %13 %28 %52 + %47 = OpLoad %6 %46 + %48 = OpAccessChain %13 %43 %52 + OpStore %48 %47 + OpBranch %39 + %39 = OpLabel + %50 = OpIAdd %6 %52 %33 + OpStore %35 %50 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + OpReturnValue %10 + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 16 +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Illegal outer. + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + c[i][j] = a[i][j] + 2; + } + } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + b[i][j] = c[i+1][j] + 10; + } + } +} + +*/ +TEST_F(FusionIllegalTest, PositiveDistanceCreatedRAWOuterLoop) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %32 "c" + OpName %35 "a" + OpName %48 "i" + OpName %56 "j" + OpName %64 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypeArray %29 %28 + %31 = OpTypePointer Function %30 + %40 = OpConstant %6 2 + %44 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %32 = OpVariable %31 Function + %35 = OpVariable %31 Function + %48 = OpVariable %7 Function + %56 = OpVariable %7 Function + %64 = OpVariable %31 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %78 = OpPhi %6 %9 %5 %47 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %78 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %82 = OpPhi %6 %9 %11 %45 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %82 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %38 = OpAccessChain %7 %35 %78 %82 + %39 = OpLoad %6 %38 + %41 = OpIAdd %6 %39 %40 + %42 = OpAccessChain %7 %32 %78 %82 + OpStore %42 %41 + OpBranch %23 + %23 = OpLabel + %45 = OpIAdd %6 %82 %44 + OpStore %19 %45 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %47 = OpIAdd %6 %78 %44 + OpStore %8 %47 + OpBranch %10 + %12 = OpLabel + OpStore %48 %9 + OpBranch %49 + %49 = OpLabel + %79 = OpPhi %6 %9 %12 %77 %52 + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %55 = OpSLessThan %17 %79 %16 + OpBranchConditional %55 %50 %51 + %50 = OpLabel + OpStore %56 %9 + OpBranch %57 + %57 = OpLabel + %80 = OpPhi %6 %9 %50 %75 %60 + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %63 = OpSLessThan %17 %80 %16 + OpBranchConditional %63 %58 %59 + %58 = OpLabel + %68 = OpIAdd %6 %79 %44 + %70 = OpAccessChain %7 %32 %68 %80 + %71 = OpLoad %6 %70 + %72 = OpIAdd %6 %71 %16 + %73 = OpAccessChain %7 %64 %79 %80 + OpStore %73 %72 + OpBranch %60 + %60 = OpLabel + %75 = OpIAdd %6 %80 %44 + OpStore %56 %75 + OpBranch %57 + %59 = OpLabel + OpBranch %52 + %52 = OpLabel + %77 = OpIAdd %6 %79 %44 + OpStore %48 %77 + OpBranch %49 + %51 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 4u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + auto loop_3 = loops[3]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_2, loop_3); + EXPECT_FALSE(fusion.AreCompatible()); + } + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 19 +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Illegal, would create a backward loop-carried anti-dependence. + for (int i = 0; i < 10; i++) { + c[i] = a[i] + 1; + } + for (int i = 0; i < 10; i++) { + a[i+1] = c[i] + 2; + } +} + +*/ +TEST_F(FusionIllegalTest, PositiveDistanceCreatedWAR) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "c" + OpName %25 "a" + OpName %34 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %47 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %52 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %52 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %52 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %52 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %52 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %53 = OpPhi %6 %9 %12 %51 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %53 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %43 = OpIAdd %6 %53 %29 + %45 = OpAccessChain %7 %23 %53 + %46 = OpLoad %6 %45 + %48 = OpIAdd %6 %46 %47 + %49 = OpAccessChain %7 %25 %43 + OpStore %49 %48 + OpBranch %38 + %38 = OpLabel + %51 = OpIAdd %6 %53 %29 + OpStore %34 %51 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 21 +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Illegal, would create a backward loop-carried anti-dependence. + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + a[i+1] = c[i+1] + 2; + } +} + +*/ +TEST_F(FusionIllegalTest, PositiveDistanceCreatedWAW) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %44 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %49 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %44 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %54 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %54 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %54 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %54 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %54 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %55 = OpPhi %6 %9 %12 %53 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %55 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %43 = OpIAdd %6 %55 %29 + %46 = OpIAdd %6 %55 %29 + %47 = OpAccessChain %7 %44 %46 + %48 = OpLoad %6 %47 + %50 = OpIAdd %6 %48 %49 + %51 = OpAccessChain %7 %23 %43 + OpStore %51 %50 + OpBranch %38 + %38 = OpLabel + %53 = OpIAdd %6 %55 %29 + OpStore %34 %53 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 28 +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum_0 = 0; + + // Illegal + for (int i = 0; i < 10; i++) { + sum_0 += a[i]; + } + for (int j = 0; j < 10; j++) { + sum_0 += b[j]; + } +} + +*/ +TEST_F(FusionIllegalTest, SameReductionVariable) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum_0" + OpName %10 "i" + OpName %24 "a" + OpName %33 "j" + OpName %41 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 10 + %22 = OpTypeArray %6 %21 + %23 = OpTypePointer Function %22 + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %24 = OpVariable %23 Function + %33 = OpVariable %7 Function + %41 = OpVariable %23 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %52 = OpPhi %6 %9 %5 %29 %14 + %49 = OpPhi %6 %9 %5 %32 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %49 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %26 = OpAccessChain %7 %24 %49 + %27 = OpLoad %6 %26 + %29 = OpIAdd %6 %52 %27 + OpStore %8 %29 + OpBranch %14 + %14 = OpLabel + %32 = OpIAdd %6 %49 %31 + OpStore %10 %32 + OpBranch %11 + %13 = OpLabel + OpStore %33 %9 + OpBranch %34 + %34 = OpLabel + %51 = OpPhi %6 %52 %13 %46 %37 + %50 = OpPhi %6 %9 %13 %48 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %18 %50 %17 + OpBranchConditional %40 %35 %36 + %35 = OpLabel + %43 = OpAccessChain %7 %41 %50 + %44 = OpLoad %6 %43 + %46 = OpIAdd %6 %51 %44 + OpStore %8 %46 + OpBranch %37 + %37 = OpLabel + %48 = OpIAdd %6 %50 %31 + OpStore %33 %48 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 28 +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum_0 = 0; + + // Illegal + for (int i = 0; i < 10; i++) { + sum_0 += a[i]; + } + for (int j = 0; j < 10; j++) { + sum_0 += b[j]; + } +} + +*/ +TEST_F(FusionIllegalTest, SameReductionVariableLCSSA) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum_0" + OpName %10 "i" + OpName %24 "a" + OpName %33 "j" + OpName %41 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 10 + %22 = OpTypeArray %6 %21 + %23 = OpTypePointer Function %22 + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %24 = OpVariable %23 Function + %33 = OpVariable %7 Function + %41 = OpVariable %23 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %52 = OpPhi %6 %9 %5 %29 %14 + %49 = OpPhi %6 %9 %5 %32 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %49 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %26 = OpAccessChain %7 %24 %49 + %27 = OpLoad %6 %26 + %29 = OpIAdd %6 %52 %27 + OpStore %8 %29 + OpBranch %14 + %14 = OpLabel + %32 = OpIAdd %6 %49 %31 + OpStore %10 %32 + OpBranch %11 + %13 = OpLabel + OpStore %33 %9 + OpBranch %34 + %34 = OpLabel + %51 = OpPhi %6 %52 %13 %46 %37 + %50 = OpPhi %6 %9 %13 %48 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %18 %50 %17 + OpBranchConditional %40 %35 %36 + %35 = OpLabel + %43 = OpAccessChain %7 %41 %50 + %44 = OpLoad %6 %43 + %46 = OpIAdd %6 %51 %44 + OpStore %8 %46 + OpBranch %37 + %37 = OpLabel + %48 = OpIAdd %6 %50 %31 + OpStore %33 %48 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopUtils utils_0(context.get(), loops[0]); + utils_0.MakeLoopClosedSSA(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 30 +#version 440 core +int x; +void main() { + int[10] a; + int[10] b; + + // Illegal, x is unknown. + for (int i = 0; i < 10; i++) { + a[x] = a[i]; + } + for (int j = 0; j < 10; j++) { + a[j] = b[j]; + } +} + +*/ +TEST_F(FusionIllegalTest, UnknownIndexVariable) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "x" + OpName %34 "j" + OpName %43 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %24 = OpTypePointer Private %6 + %25 = OpVariable %24 Private + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %34 = OpVariable %7 Function + %43 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %50 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %50 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpLoad %6 %25 + %28 = OpAccessChain %7 %23 %50 + %29 = OpLoad %6 %28 + %30 = OpAccessChain %7 %23 %26 + OpStore %30 %29 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %50 %32 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %51 = OpPhi %6 %9 %12 %49 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %51 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %43 %51 + %46 = OpLoad %6 %45 + %47 = OpAccessChain %7 %23 %51 + OpStore %47 %46 + OpBranch %38 + %38 = OpLabel + %49 = OpIAdd %6 %51 %32 + OpStore %34 %49 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum = 0; + + // Illegal, accumulator used for indexing. + for (int i = 0; i < 10; i++) { + sum += a[i]; + b[sum] = a[i]; + } + for (int j = 0; j < 10; j++) { + b[j] = b[j]+1; + } +} + +*/ +TEST_F(FusionIllegalTest, AccumulatorIndexing) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum" + OpName %10 "i" + OpName %24 "a" + OpName %30 "b" + OpName %39 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 10 + %22 = OpTypeArray %6 %21 + %23 = OpTypePointer Function %22 + %37 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %24 = OpVariable %23 Function + %30 = OpVariable %23 Function + %39 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %57 = OpPhi %6 %9 %5 %29 %14 + %55 = OpPhi %6 %9 %5 %38 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %55 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %26 = OpAccessChain %7 %24 %55 + %27 = OpLoad %6 %26 + %29 = OpIAdd %6 %57 %27 + OpStore %8 %29 + %33 = OpAccessChain %7 %24 %55 + %34 = OpLoad %6 %33 + %35 = OpAccessChain %7 %30 %29 + OpStore %35 %34 + OpBranch %14 + %14 = OpLabel + %38 = OpIAdd %6 %55 %37 + OpStore %10 %38 + OpBranch %11 + %13 = OpLabel + OpStore %39 %9 + OpBranch %40 + %40 = OpLabel + %56 = OpPhi %6 %9 %13 %54 %43 + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %46 = OpSLessThan %18 %56 %17 + OpBranchConditional %46 %41 %42 + %41 = OpLabel + %49 = OpAccessChain %7 %30 %56 + %50 = OpLoad %6 %49 + %51 = OpIAdd %6 %50 %37 + %52 = OpAccessChain %7 %30 %56 + OpStore %52 %51 + OpBranch %43 + %43 = OpLabel + %54 = OpIAdd %6 %56 %37 + OpStore %39 %54 + OpBranch %40 + %42 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 33 +#version 440 core +void main() { + int[10] a; + int[10] b; + + // Illegal, barrier. + for (int i = 0; i < 10; i++) { + a[i] = a[i] * 2; + memoryBarrier(); + } + for (int j = 0; j < 10; j++) { + b[j] = b[j] + 1; + } +} + +*/ +TEST_F(FusionIllegalTest, Barrier) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %36 "j" + OpName %44 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %28 = OpConstant %6 2 + %31 = OpConstant %19 1 + %32 = OpConstant %19 3400 + %34 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %36 = OpVariable %7 Function + %44 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %53 = OpPhi %6 %9 %5 %35 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %53 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpAccessChain %7 %23 %53 + %27 = OpLoad %6 %26 + %29 = OpIMul %6 %27 %28 + %30 = OpAccessChain %7 %23 %53 + OpStore %30 %29 + OpMemoryBarrier %31 %32 + OpBranch %13 + %13 = OpLabel + %35 = OpIAdd %6 %53 %34 + OpStore %8 %35 + OpBranch %10 + %12 = OpLabel + OpStore %36 %9 + OpBranch %37 + %37 = OpLabel + %54 = OpPhi %6 %9 %12 %52 %40 + OpLoopMerge %39 %40 None + OpBranch %41 + %41 = OpLabel + %43 = OpSLessThan %17 %54 %16 + OpBranchConditional %43 %38 %39 + %38 = OpLabel + %47 = OpAccessChain %7 %44 %54 + %48 = OpLoad %6 %47 + %49 = OpIAdd %6 %48 %34 + %50 = OpAccessChain %7 %44 %54 + OpStore %50 %49 + OpBranch %40 + %40 = OpLabel + %52 = OpIAdd %6 %54 %34 + OpStore %36 %52 + OpBranch %37 + %39 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +struct TestStruct { + int[10] a; + int b; +}; + +void main() { + TestStruct test_0; + TestStruct test_1; + + for (int i = 0; i < 10; i++) { + test_0.a[i] = i; + } + for (int j = 0; j < 10; j++) { + test_0 = test_1; + } +} + +*/ +TEST_F(FusionIllegalTest, ArrayInStruct) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "TestStruct" + OpMemberName %22 0 "a" + OpMemberName %22 1 "b" + OpName %24 "test_0" + OpName %31 "j" + OpName %39 "test_1" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypeStruct %21 %6 + %23 = OpTypePointer Function %22 + %29 = OpConstant %6 1 + %47 = OpUndef %22 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %24 = OpVariable %23 Function + %31 = OpVariable %7 Function + %39 = OpVariable %23 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %43 = OpPhi %6 %9 %5 %30 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %43 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %24 %9 %43 + OpStore %27 %43 + OpBranch %13 + %13 = OpLabel + %30 = OpIAdd %6 %43 %29 + OpStore %8 %30 + OpBranch %10 + %12 = OpLabel + OpStore %31 %9 + OpBranch %32 + %32 = OpLabel + %44 = OpPhi %6 %9 %12 %42 %35 + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel + %38 = OpSLessThan %17 %44 %16 + OpBranchConditional %38 %33 %34 + %33 = OpLabel + OpStore %24 %47 + OpBranch %35 + %35 = OpLabel + %42 = OpIAdd %6 %44 %29 + OpStore %31 %42 + OpBranch %32 + %34 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 450 + +struct P {float x,y,z;}; +uniform G { int a; P b[2]; int c; } g; +layout(location = 0) out float o; + +void main() +{ + P p[2]; + for (int i = 0; i < 2; ++i) { + p = g.b; + } + for (int j = 0; j < 2; ++j) { + o = p[g.a].x; + } +} + +*/ +TEST_F(FusionIllegalTest, NestedAccessChain) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %64 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 450 + OpName %4 "main" + OpName %8 "i" + OpName %20 "P" + OpMemberName %20 0 "x" + OpMemberName %20 1 "y" + OpMemberName %20 2 "z" + OpName %25 "p" + OpName %26 "P" + OpMemberName %26 0 "x" + OpMemberName %26 1 "y" + OpMemberName %26 2 "z" + OpName %28 "G" + OpMemberName %28 0 "a" + OpMemberName %28 1 "b" + OpMemberName %28 2 "c" + OpName %30 "g" + OpName %55 "j" + OpName %64 "o" + OpMemberDecorate %26 0 Offset 0 + OpMemberDecorate %26 1 Offset 4 + OpMemberDecorate %26 2 Offset 8 + OpDecorate %27 ArrayStride 16 + OpMemberDecorate %28 0 Offset 0 + OpMemberDecorate %28 1 Offset 16 + OpMemberDecorate %28 2 Offset 48 + OpDecorate %28 Block + OpDecorate %30 DescriptorSet 0 + OpDecorate %64 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeStruct %19 %19 %19 + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 2 + %23 = OpTypeArray %20 %22 + %24 = OpTypePointer Function %23 + %26 = OpTypeStruct %19 %19 %19 + %27 = OpTypeArray %26 %22 + %28 = OpTypeStruct %6 %27 %6 + %29 = OpTypePointer Uniform %28 + %30 = OpVariable %29 Uniform + %31 = OpConstant %6 1 + %32 = OpTypePointer Uniform %27 + %36 = OpTypePointer Function %20 + %39 = OpTypePointer Function %19 + %63 = OpTypePointer Output %19 + %64 = OpVariable %63 Output + %65 = OpTypePointer Uniform %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %25 = OpVariable %24 Function + %55 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %72 = OpPhi %6 %9 %5 %54 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %72 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %33 = OpAccessChain %32 %30 %31 + %34 = OpLoad %27 %33 + %35 = OpCompositeExtract %26 %34 0 + %37 = OpAccessChain %36 %25 %9 + %38 = OpCompositeExtract %19 %35 0 + %40 = OpAccessChain %39 %37 %9 + OpStore %40 %38 + %41 = OpCompositeExtract %19 %35 1 + %42 = OpAccessChain %39 %37 %31 + OpStore %42 %41 + %43 = OpCompositeExtract %19 %35 2 + %44 = OpAccessChain %39 %37 %16 + OpStore %44 %43 + %45 = OpCompositeExtract %26 %34 1 + %46 = OpAccessChain %36 %25 %31 + %47 = OpCompositeExtract %19 %45 0 + %48 = OpAccessChain %39 %46 %9 + OpStore %48 %47 + %49 = OpCompositeExtract %19 %45 1 + %50 = OpAccessChain %39 %46 %31 + OpStore %50 %49 + %51 = OpCompositeExtract %19 %45 2 + %52 = OpAccessChain %39 %46 %16 + OpStore %52 %51 + OpBranch %13 + %13 = OpLabel + %54 = OpIAdd %6 %72 %31 + OpStore %8 %54 + OpBranch %10 + %12 = OpLabel + OpStore %55 %9 + OpBranch %56 + %56 = OpLabel + %73 = OpPhi %6 %9 %12 %71 %59 + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %62 = OpSLessThan %17 %73 %16 + OpBranchConditional %62 %57 %58 + %57 = OpLabel + %66 = OpAccessChain %65 %30 %9 + %67 = OpLoad %6 %66 + %68 = OpAccessChain %39 %25 %67 %9 + %69 = OpLoad %19 %68 + OpStore %64 %69 + OpBranch %59 + %59 = OpLabel + %71 = OpIAdd %6 %73 %31 + OpStore %55 %71 + OpBranch %56 + %58 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_FALSE(fusion.IsLegal()); + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp new file mode 100644 index 00000000000..509516f80d7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_legal.cpp @@ -0,0 +1,4587 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_fusion.h" +#include "test/opt/pass_fixture.h" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +using FusionLegalTest = PassTest<::testing::Test>; + +bool Validate(const std::vector& bin) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {bin.data(), bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + return error == 0; +} + +void Match(const std::string& checks, IRContext* context) { + // Silence unused warnings with !defined(SPIRV_EFFCE) + (void)checks; + + std::vector bin; + context->module()->ToBinary(&bin, true); + EXPECT_TRUE(Validate(bin)); +#ifdef SPIRV_EFFCEE + std::string assembly; + SpirvTools tools(SPV_ENV_UNIVERSAL_1_2); + EXPECT_TRUE( + tools.Disassemble(bin, &assembly, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)) + << "Disassembling failed for shader:\n" + << assembly << std::endl; + auto match_result = effcee::Match(assembly, checks); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << assembly; +#else // ! SPIRV_EFFCEE + (void)checks; +#endif +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + // No dependence, legal + for (int i = 0; i < 10; i++) { + a[i] = a[i]*2; + } + for (int i = 0; i < 10; i++) { + b[i] = b[i]+2; + } +} + +*/ +TEST_F(FusionLegalTest, DifferentArraysInLoops) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %34 "i" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %28 = OpConstant %6 2 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpAccessChain %7 %23 %51 + %27 = OpLoad %6 %26 + %29 = OpIMul %6 %27 %28 + %30 = OpAccessChain %7 %23 %51 + OpStore %30 %29 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %51 %32 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %52 = OpPhi %6 %9 %12 %50 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %52 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %42 %52 + %46 = OpLoad %6 %45 + %47 = OpIAdd %6 %46 %28 + %48 = OpAccessChain %7 %42 %52 + OpStore %48 %47 + OpBranch %38 + %38 = OpLabel + %50 = OpIAdd %6 %52 %32 + OpStore %34 %50 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Only loads to the same array, legal + for (int i = 0; i < 10; i++) { + b[i] = a[i]*2; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i]+2; + } +} + +*/ +TEST_F(FusionLegalTest, OnlyLoadsToSameArray) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "b" + OpName %25 "a" + OpName %35 "i" + OpName %43 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 2 + %33 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %35 = OpVariable %7 Function + %43 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %52 = OpPhi %6 %9 %5 %34 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %52 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %52 + %28 = OpLoad %6 %27 + %30 = OpIMul %6 %28 %29 + %31 = OpAccessChain %7 %23 %52 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %34 = OpIAdd %6 %52 %33 + OpStore %8 %34 + OpBranch %10 + %12 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + %53 = OpPhi %6 %9 %12 %51 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %17 %53 %16 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %46 = OpAccessChain %7 %25 %53 + %47 = OpLoad %6 %46 + %48 = OpIAdd %6 %47 %29 + %49 = OpAccessChain %7 %43 %53 + OpStore %49 %48 + OpBranch %39 + %39 = OpLabel + %51 = OpIAdd %6 %53 %33 + OpStore %35 %51 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + // No loop-carried dependences, legal + for (int i = 0; i < 10; i++) { + a[i] = a[i]*2; + } + for (int i = 0; i < 10; i++) { + b[i] = a[i]+2; + } +} + +*/ +TEST_F(FusionLegalTest, NoLoopCarriedDependences) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %34 "i" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %28 = OpConstant %6 2 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpAccessChain %7 %23 %51 + %27 = OpLoad %6 %26 + %29 = OpIMul %6 %27 %28 + %30 = OpAccessChain %7 %23 %51 + OpStore %30 %29 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %51 %32 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %52 = OpPhi %6 %9 %12 %50 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %52 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %23 %52 + %46 = OpLoad %6 %45 + %47 = OpIAdd %6 %46 %28 + %48 = OpAccessChain %7 %42 %52 + OpStore %48 %47 + OpBranch %38 + %38 = OpLabel + %50 = OpIAdd %6 %52 %32 + OpStore %34 %50 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Parallelism inhibiting, but legal. + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i] + c[i-1]; + } +} + +*/ +TEST_F(FusionLegalTest, ExistingLoopCarriedDependence) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %42 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %55 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %55 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %55 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %55 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %55 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %56 = OpPhi %6 %9 %12 %54 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %56 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %23 %56 + %46 = OpLoad %6 %45 + %48 = OpISub %6 %56 %29 + %49 = OpAccessChain %7 %42 %48 + %50 = OpLoad %6 %49 + %51 = OpIAdd %6 %46 %50 + %52 = OpAccessChain %7 %42 %56 + OpStore %52 %51 + OpBranch %38 + %38 = OpLabel + %54 = OpIAdd %6 %56 %29 + OpStore %34 %54 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[I_1:%\w+]] = OpISub {{%\w+}} [[PHI]] {{%\w+}} +CHECK-NEXT: [[LOAD_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_2]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Creates a loop-carried dependence, but negative, so legal + for (int i = 0; i < 10; i++) { + a[i+1] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, NegativeDistanceCreatedRAW) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %27 "b" + OpName %35 "i" + OpName %43 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %25 = OpConstant %6 1 + %48 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %27 = OpVariable %22 Function + %35 = OpVariable %7 Function + %43 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %53 = OpPhi %6 %9 %5 %34 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %53 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpIAdd %6 %53 %25 + %29 = OpAccessChain %7 %27 %53 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %30 %25 + %32 = OpAccessChain %7 %23 %26 + OpStore %32 %31 + OpBranch %13 + %13 = OpLabel + %34 = OpIAdd %6 %53 %25 + OpStore %8 %34 + OpBranch %10 + %12 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + %54 = OpPhi %6 %9 %12 %52 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %17 %54 %16 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %46 = OpAccessChain %7 %23 %54 + %47 = OpLoad %6 %46 + %49 = OpIAdd %6 %47 %48 + %50 = OpAccessChain %7 %43 %54 + OpStore %50 %49 + OpBranch %39 + %39 = OpLabel + %52 = OpIAdd %6 %54 %25 + OpStore %35 %52 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + auto& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal + for (int i = 0; i < 10; i++) { + a[i+1] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i+1] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, NoLoopCarriedDependencesAdjustedIndex) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %27 "b" + OpName %35 "i" + OpName %43 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %25 = OpConstant %6 1 + %49 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %27 = OpVariable %22 Function + %35 = OpVariable %7 Function + %43 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %54 = OpPhi %6 %9 %5 %34 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %54 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpIAdd %6 %54 %25 + %29 = OpAccessChain %7 %27 %54 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %30 %25 + %32 = OpAccessChain %7 %23 %26 + OpStore %32 %31 + OpBranch %13 + %13 = OpLabel + %34 = OpIAdd %6 %54 %25 + OpStore %8 %34 + OpBranch %10 + %12 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + %55 = OpPhi %6 %9 %12 %53 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %17 %55 %16 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %46 = OpIAdd %6 %55 %25 + %47 = OpAccessChain %7 %23 %46 + %48 = OpLoad %6 %47 + %50 = OpIAdd %6 %48 %49 + %51 = OpAccessChain %7 %43 %55 + OpStore %51 %50 + OpBranch %39 + %39 = OpLabel + %53 = OpIAdd %6 %55 %25 + OpStore %35 %53 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK-NEXT: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal, independent locations in |a|, SIV + for (int i = 0; i < 10; i++) { + a[2*i+1] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[2*i] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, IndependentSIV) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %29 "b" + OpName %37 "i" + OpName %45 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %24 = OpConstant %6 2 + %27 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %29 = OpVariable %22 Function + %37 = OpVariable %7 Function + %45 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %55 = OpPhi %6 %9 %5 %36 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %55 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpIMul %6 %24 %55 + %28 = OpIAdd %6 %26 %27 + %31 = OpAccessChain %7 %29 %55 + %32 = OpLoad %6 %31 + %33 = OpIAdd %6 %32 %27 + %34 = OpAccessChain %7 %23 %28 + OpStore %34 %33 + OpBranch %13 + %13 = OpLabel + %36 = OpIAdd %6 %55 %27 + OpStore %8 %36 + OpBranch %10 + %12 = OpLabel + OpStore %37 %9 + OpBranch %38 + %38 = OpLabel + %56 = OpPhi %6 %9 %12 %54 %41 + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpSLessThan %17 %56 %16 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + %48 = OpIMul %6 %24 %56 + %49 = OpAccessChain %7 %23 %48 + %50 = OpLoad %6 %49 + %51 = OpIAdd %6 %50 %24 + %52 = OpAccessChain %7 %45 %56 + OpStore %52 %51 + OpBranch %41 + %41 = OpLabel + %54 = OpIAdd %6 %56 %27 + OpStore %37 %54 + OpBranch %38 + %40 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[I_2:%\w+]] = OpIMul {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[I_2_1:%\w+]] = OpIAdd {{%\w+}} [[I_2]] {{%\w+}} +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_2_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[I_2:%\w+]] = OpIMul {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_2]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal, independent locations in |a|, ZIV + for (int i = 0; i < 10; i++) { + a[1] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[9] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, IndependentZIV) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %33 "i" + OpName %41 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %24 = OpConstant %6 1 + %43 = OpConstant %6 9 + %46 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %33 = OpVariable %7 Function + %41 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %32 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %51 + %28 = OpLoad %6 %27 + %29 = OpIAdd %6 %28 %24 + %30 = OpAccessChain %7 %23 %24 + OpStore %30 %29 + OpBranch %13 + %13 = OpLabel + %32 = OpIAdd %6 %51 %24 + OpStore %8 %32 + OpBranch %10 + %12 = OpLabel + OpStore %33 %9 + OpBranch %34 + %34 = OpLabel + %52 = OpPhi %6 %9 %12 %50 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %17 %52 %16 + OpBranchConditional %40 %35 %36 + %35 = OpLabel + %44 = OpAccessChain %7 %23 %43 + %45 = OpLoad %6 %44 + %47 = OpIAdd %6 %45 %46 + %48 = OpAccessChain %7 %41 %52 + OpStore %48 %47 + OpBranch %37 + %37 = OpLabel + %50 = OpIAdd %6 %52 %24 + OpStore %33 %50 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK-NOT: OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK: OpStore +CHECK-NOT: OpPhi +CHECK-NOT: OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK: OpLoad +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[20] a; + int[10] b; + int[10] c; + // Legal, non-overlapping sections in |a| + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i+10] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, NonOverlappingAccesses) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %28 "b" + OpName %37 "i" + OpName %45 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 20 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %25 = OpConstant %19 10 + %26 = OpTypeArray %6 %25 + %27 = OpTypePointer Function %26 + %32 = OpConstant %6 1 + %51 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %28 = OpVariable %27 Function + %37 = OpVariable %7 Function + %45 = OpVariable %27 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %56 = OpPhi %6 %9 %5 %36 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %56 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %30 = OpAccessChain %7 %28 %56 + %31 = OpLoad %6 %30 + %33 = OpIAdd %6 %31 %32 + %34 = OpAccessChain %7 %23 %56 + OpStore %34 %33 + OpBranch %13 + %13 = OpLabel + %36 = OpIAdd %6 %56 %32 + OpStore %8 %36 + OpBranch %10 + %12 = OpLabel + OpStore %37 %9 + OpBranch %38 + %38 = OpLabel + %57 = OpPhi %6 %9 %12 %55 %41 + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel + %44 = OpSLessThan %17 %57 %16 + OpBranchConditional %44 %39 %40 + %39 = OpLabel + %48 = OpIAdd %6 %57 %16 + %49 = OpAccessChain %7 %23 %48 + %50 = OpLoad %6 %49 + %52 = OpIAdd %6 %50 %51 + %53 = OpAccessChain %7 %45 %57 + OpStore %53 %52 + OpBranch %41 + %41 = OpLabel + %55 = OpIAdd %6 %57 %32 + OpStore %37 %55 + OpBranch %38 + %40 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NOT: OpPhi +CHECK: [[I_10:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK-NEXT: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_10]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +)"; + + Match(checks, context.get()); + + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal, 3 adjacent loops + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i] + 2; + } + for (int i = 0; i < 10; i++) { + b[i] = c[i] + 10; + } +} + +*/ +TEST_F(FusionLegalTest, AdjacentLoops) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %42 "c" + OpName %52 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %47 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + %52 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %68 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %68 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %68 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %68 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %68 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %69 = OpPhi %6 %9 %12 %51 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %69 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %23 %69 + %46 = OpLoad %6 %45 + %48 = OpIAdd %6 %46 %47 + %49 = OpAccessChain %7 %42 %69 + OpStore %49 %48 + OpBranch %38 + %38 = OpLabel + %51 = OpIAdd %6 %69 %29 + OpStore %34 %51 + OpBranch %35 + %37 = OpLabel + OpStore %52 %9 + OpBranch %53 + %53 = OpLabel + %70 = OpPhi %6 %9 %37 %67 %56 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %59 = OpSLessThan %17 %70 %16 + OpBranchConditional %59 %54 %55 + %54 = OpLabel + %62 = OpAccessChain %7 %42 %70 + %63 = OpLoad %6 %62 + %64 = OpIAdd %6 %63 %16 + %65 = OpAccessChain %7 %25 %70 + OpStore %65 %64 + OpBranch %56 + %56 = OpLabel + %67 = OpIAdd %6 %70 %29 + OpStore %52 %67 + OpBranch %53 + %55 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[1], loops[2]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_1]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_2]] +CHECK: [[STORE_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_2]] + )"; + + Match(checks, context.get()); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + std::string checks_ = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_2]] +CHECK: [[STORE_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_2]] + )"; + + Match(checks_, context.get()); + + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Legal inner loop fusion + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + c[i][j] = a[i][j] + 2; + } + for (int j = 0; j < 10; j++) { + b[i][j] = c[i][j] + 10; + } + } +} + +*/ +TEST_F(FusionLegalTest, InnerLoopFusion) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %32 "c" + OpName %35 "a" + OpName %46 "j" + OpName %54 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypeArray %29 %28 + %31 = OpTypePointer Function %30 + %40 = OpConstant %6 2 + %44 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %32 = OpVariable %31 Function + %35 = OpVariable %31 Function + %46 = OpVariable %7 Function + %54 = OpVariable %31 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %67 = OpPhi %6 %9 %5 %66 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %67 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %68 = OpPhi %6 %9 %11 %45 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %68 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %38 = OpAccessChain %7 %35 %67 %68 + %39 = OpLoad %6 %38 + %41 = OpIAdd %6 %39 %40 + %42 = OpAccessChain %7 %32 %67 %68 + OpStore %42 %41 + OpBranch %23 + %23 = OpLabel + %45 = OpIAdd %6 %68 %44 + OpStore %19 %45 + OpBranch %20 + %22 = OpLabel + OpStore %46 %9 + OpBranch %47 + %47 = OpLabel + %69 = OpPhi %6 %9 %22 %64 %50 + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %53 = OpSLessThan %17 %69 %16 + OpBranchConditional %53 %48 %49 + %48 = OpLabel + %59 = OpAccessChain %7 %32 %67 %69 + %60 = OpLoad %6 %59 + %61 = OpIAdd %6 %60 %16 + %62 = OpAccessChain %7 %54 %67 %69 + OpStore %62 %61 + OpBranch %50 + %50 = OpLabel + %64 = OpIAdd %6 %69 %44 + OpStore %46 %64 + OpBranch %47 + %49 = OpLabel + OpBranch %13 + %13 = OpLabel + %66 = OpIAdd %6 %67 %44 + OpStore %8 %66 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + + auto& ld_final = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld_final.NumLoops(), 2u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// 12 +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Legal both + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + c[i][j] = a[i][j] + 2; + } + } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + b[i][j] = c[i][j] + 10; + } + } +} + +*/ +TEST_F(FusionLegalTest, OuterAndInnerLoop) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %32 "c" + OpName %35 "a" + OpName %48 "i" + OpName %56 "j" + OpName %64 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypeArray %29 %28 + %31 = OpTypePointer Function %30 + %40 = OpConstant %6 2 + %44 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %32 = OpVariable %31 Function + %35 = OpVariable %31 Function + %48 = OpVariable %7 Function + %56 = OpVariable %7 Function + %64 = OpVariable %31 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %77 = OpPhi %6 %9 %5 %47 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %77 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %81 = OpPhi %6 %9 %11 %45 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %81 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %38 = OpAccessChain %7 %35 %77 %81 + %39 = OpLoad %6 %38 + %41 = OpIAdd %6 %39 %40 + %42 = OpAccessChain %7 %32 %77 %81 + OpStore %42 %41 + OpBranch %23 + %23 = OpLabel + %45 = OpIAdd %6 %81 %44 + OpStore %19 %45 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %47 = OpIAdd %6 %77 %44 + OpStore %8 %47 + OpBranch %10 + %12 = OpLabel + OpStore %48 %9 + OpBranch %49 + %49 = OpLabel + %78 = OpPhi %6 %9 %12 %76 %52 + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %55 = OpSLessThan %17 %78 %16 + OpBranchConditional %55 %50 %51 + %50 = OpLabel + OpStore %56 %9 + OpBranch %57 + %57 = OpLabel + %79 = OpPhi %6 %9 %50 %74 %60 + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %63 = OpSLessThan %17 %79 %16 + OpBranchConditional %63 %58 %59 + %58 = OpLabel + %69 = OpAccessChain %7 %32 %78 %79 + %70 = OpLoad %6 %69 + %71 = OpIAdd %6 %70 %16 + %72 = OpAccessChain %7 %64 %78 %79 + OpStore %72 %71 + OpBranch %60 + %60 = OpLabel + %74 = OpIAdd %6 %79 %44 + OpStore %56 %74 + OpBranch %57 + %59 = OpLabel + OpBranch %52 + %52 = OpLabel + %76 = OpIAdd %6 %78 %44 + OpStore %48 %76 + OpBranch %49 + %51 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 4u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + auto loop_3 = loops[3]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_2, loop_3); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_3); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK: [[PHI_2:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_2]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_2]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + auto& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + auto& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Legal both, more complex + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + if (i % 2 == 0 && j % 2 == 0) { + c[i][j] = a[i][j] + 2; + } + } + } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + b[i][j] = c[i][j] + 10; + } + } +} + +*/ +TEST_F(FusionLegalTest, OuterAndInnerLoopMoreComplex) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %44 "c" + OpName %47 "a" + OpName %59 "i" + OpName %67 "j" + OpName %75 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %28 = OpConstant %6 2 + %39 = OpTypeInt 32 0 + %40 = OpConstant %39 10 + %41 = OpTypeArray %6 %40 + %42 = OpTypeArray %41 %40 + %43 = OpTypePointer Function %42 + %55 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %44 = OpVariable %43 Function + %47 = OpVariable %43 Function + %59 = OpVariable %7 Function + %67 = OpVariable %7 Function + %75 = OpVariable %43 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %88 = OpPhi %6 %9 %5 %58 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %88 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %92 = OpPhi %6 %9 %11 %56 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %92 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %29 = OpSMod %6 %88 %28 + %30 = OpIEqual %17 %29 %9 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %34 = OpSMod %6 %92 %28 + %35 = OpIEqual %17 %34 %9 + OpBranch %32 + %32 = OpLabel + %36 = OpPhi %17 %30 %21 %35 %31 + OpSelectionMerge %38 None + OpBranchConditional %36 %37 %38 + %37 = OpLabel + %50 = OpAccessChain %7 %47 %88 %92 + %51 = OpLoad %6 %50 + %52 = OpIAdd %6 %51 %28 + %53 = OpAccessChain %7 %44 %88 %92 + OpStore %53 %52 + OpBranch %38 + %38 = OpLabel + OpBranch %23 + %23 = OpLabel + %56 = OpIAdd %6 %92 %55 + OpStore %19 %56 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %58 = OpIAdd %6 %88 %55 + OpStore %8 %58 + OpBranch %10 + %12 = OpLabel + OpStore %59 %9 + OpBranch %60 + %60 = OpLabel + %89 = OpPhi %6 %9 %12 %87 %63 + OpLoopMerge %62 %63 None + OpBranch %64 + %64 = OpLabel + %66 = OpSLessThan %17 %89 %16 + OpBranchConditional %66 %61 %62 + %61 = OpLabel + OpStore %67 %9 + OpBranch %68 + %68 = OpLabel + %90 = OpPhi %6 %9 %61 %85 %71 + OpLoopMerge %70 %71 None + OpBranch %72 + %72 = OpLabel + %74 = OpSLessThan %17 %90 %16 + OpBranchConditional %74 %69 %70 + %69 = OpLabel + %80 = OpAccessChain %7 %44 %89 %90 + %81 = OpLoad %6 %80 + %82 = OpIAdd %6 %81 %16 + %83 = OpAccessChain %7 %75 %89 %90 + OpStore %83 %82 + OpBranch %71 + %71 = OpLabel + %85 = OpIAdd %6 %90 %55 + OpStore %67 %85 + OpBranch %68 + %70 = OpLabel + OpBranch %63 + %63 = OpLabel + %87 = OpIAdd %6 %89 %55 + OpStore %59 %87 + OpBranch %60 + %62 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 4u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + auto loop_3 = loops[3]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_2, loop_3); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_3); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: OpPhi +CHECK-NEXT: OpSelectionMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK: [[PHI_2:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_2]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_2]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: OpPhi +CHECK-NEXT: OpSelectionMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Outer would have been illegal to fuse, but since written + // like this, inner loop fusion is legal. + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + c[i][j] = a[i][j] + 2; + } + for (int j = 0; j < 10; j++) { + b[i][j] = c[i+1][j] + 10; + } + } +} + +*/ +TEST_F(FusionLegalTest, InnerWithExistingDependenceOnOuter) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %32 "c" + OpName %35 "a" + OpName %46 "j" + OpName %54 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypeArray %29 %28 + %31 = OpTypePointer Function %30 + %40 = OpConstant %6 2 + %44 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %32 = OpVariable %31 Function + %35 = OpVariable %31 Function + %46 = OpVariable %7 Function + %54 = OpVariable %31 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %68 = OpPhi %6 %9 %5 %67 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %68 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %69 = OpPhi %6 %9 %11 %45 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %69 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %38 = OpAccessChain %7 %35 %68 %69 + %39 = OpLoad %6 %38 + %41 = OpIAdd %6 %39 %40 + %42 = OpAccessChain %7 %32 %68 %69 + OpStore %42 %41 + OpBranch %23 + %23 = OpLabel + %45 = OpIAdd %6 %69 %44 + OpStore %19 %45 + OpBranch %20 + %22 = OpLabel + OpStore %46 %9 + OpBranch %47 + %47 = OpLabel + %70 = OpPhi %6 %9 %22 %65 %50 + OpLoopMerge %49 %50 None + OpBranch %51 + %51 = OpLabel + %53 = OpSLessThan %17 %70 %16 + OpBranchConditional %53 %48 %49 + %48 = OpLabel + %58 = OpIAdd %6 %68 %44 + %60 = OpAccessChain %7 %32 %58 %70 + %61 = OpLoad %6 %60 + %62 = OpIAdd %6 %61 %16 + %63 = OpAccessChain %7 %54 %68 %70 + OpStore %63 %62 + OpBranch %50 + %50 = OpLabel + %65 = OpIAdd %6 %70 %44 + OpStore %46 %65 + OpBranch %47 + %49 = OpLabel + OpBranch %13 + %13 = OpLabel + %67 = OpIAdd %6 %68 %44 + OpStore %8 %67 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI_0]] {{%\w+}} +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // One dimensional arrays. Legal, outer dist 0, inner independent. + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + c[i] = a[j] + 2; + } + } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + b[j] = c[i] + 10; + } + } +} + +*/ +TEST_F(FusionLegalTest, OuterAndInnerLoopOneDimArrays) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %31 "c" + OpName %33 "a" + OpName %45 "i" + OpName %53 "j" + OpName %61 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypePointer Function %29 + %37 = OpConstant %6 2 + %41 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %31 = OpVariable %30 Function + %33 = OpVariable %30 Function + %45 = OpVariable %7 Function + %53 = OpVariable %7 Function + %61 = OpVariable %30 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %72 = OpPhi %6 %9 %5 %44 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %72 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %76 = OpPhi %6 %9 %11 %42 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %76 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %35 = OpAccessChain %7 %33 %76 + %36 = OpLoad %6 %35 + %38 = OpIAdd %6 %36 %37 + %39 = OpAccessChain %7 %31 %72 + OpStore %39 %38 + OpBranch %23 + %23 = OpLabel + %42 = OpIAdd %6 %76 %41 + OpStore %19 %42 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %44 = OpIAdd %6 %72 %41 + OpStore %8 %44 + OpBranch %10 + %12 = OpLabel + OpStore %45 %9 + OpBranch %46 + %46 = OpLabel + %73 = OpPhi %6 %9 %12 %71 %49 + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %52 = OpSLessThan %17 %73 %16 + OpBranchConditional %52 %47 %48 + %47 = OpLabel + OpStore %53 %9 + OpBranch %54 + %54 = OpLabel + %74 = OpPhi %6 %9 %47 %69 %57 + OpLoopMerge %56 %57 None + OpBranch %58 + %58 = OpLabel + %60 = OpSLessThan %17 %74 %16 + OpBranchConditional %60 %55 %56 + %55 = OpLabel + %64 = OpAccessChain %7 %31 %73 + %65 = OpLoad %6 %64 + %66 = OpIAdd %6 %65 %16 + %67 = OpAccessChain %7 %61 %74 + OpStore %67 %66 + OpBranch %57 + %57 = OpLabel + %69 = OpIAdd %6 %74 %41 + OpStore %53 %69 + OpBranch %54 + %56 = OpLabel + OpBranch %49 + %49 = OpLabel + %71 = OpIAdd %6 %73 %41 + OpStore %45 %71 + OpBranch %46 + %48 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 4u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + auto loop_3 = loops[3]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_2, loop_3); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK: [[PHI_2:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_2]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + auto loop_0 = loops[0]; + auto loop_1 = loops[1]; + auto loop_2 = loops[2]; + + { + LoopFusion fusion(context.get(), loop_0, loop_1); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_0, loop_2); + EXPECT_FALSE(fusion.AreCompatible()); + } + + { + LoopFusion fusion(context.get(), loop_1, loop_2); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal, creates a loop-carried dependence, but has negative distance + for (int i = 0; i < 10; i++) { + c[i] = a[i+1] + 1; + } + for (int i = 0; i < 10; i++) { + a[i] = c[i] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, NegativeDistanceCreatedWAR) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "c" + OpName %25 "a" + OpName %35 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %27 = OpConstant %6 1 + %47 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %35 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %52 = OpPhi %6 %9 %5 %34 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %52 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %28 = OpIAdd %6 %52 %27 + %29 = OpAccessChain %7 %25 %28 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %30 %27 + %32 = OpAccessChain %7 %23 %52 + OpStore %32 %31 + OpBranch %13 + %13 = OpLabel + %34 = OpIAdd %6 %52 %27 + OpStore %8 %34 + OpBranch %10 + %12 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + %53 = OpPhi %6 %9 %12 %51 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %17 %53 %16 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %45 = OpAccessChain %7 %23 %53 + %46 = OpLoad %6 %45 + %48 = OpIAdd %6 %46 %47 + %49 = OpAccessChain %7 %25 %53 + OpStore %49 %48 + OpBranch %39 + %39 = OpLabel + %51 = OpIAdd %6 %53 %27 + OpStore %35 %51 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK-NEXT: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } + + { + auto& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal, creates a loop-carried dependence, but has negative distance + for (int i = 0; i < 10; i++) { + a[i+1] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + a[i] = c[i+1] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, NegativeDistanceCreatedWAW) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %27 "b" + OpName %35 "i" + OpName %44 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %25 = OpConstant %6 1 + %49 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %27 = OpVariable %22 Function + %35 = OpVariable %7 Function + %44 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %54 = OpPhi %6 %9 %5 %34 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %54 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpIAdd %6 %54 %25 + %29 = OpAccessChain %7 %27 %54 + %30 = OpLoad %6 %29 + %31 = OpIAdd %6 %30 %25 + %32 = OpAccessChain %7 %23 %26 + OpStore %32 %31 + OpBranch %13 + %13 = OpLabel + %34 = OpIAdd %6 %54 %25 + OpStore %8 %34 + OpBranch %10 + %12 = OpLabel + OpStore %35 %9 + OpBranch %36 + %36 = OpLabel + %55 = OpPhi %6 %9 %12 %53 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %17 %55 %16 + OpBranchConditional %42 %37 %38 + %37 = OpLabel + %46 = OpIAdd %6 %55 %25 + %47 = OpAccessChain %7 %44 %46 + %48 = OpLoad %6 %47 + %50 = OpIAdd %6 %48 %49 + %51 = OpAccessChain %7 %23 %55 + OpStore %51 %50 + OpBranch %39 + %39 = OpLabel + %53 = OpIAdd %6 %55 %25 + OpStore %35 %53 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpStore +CHECK-NOT: OpPhi +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK-NEXT: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Legal, no loop-carried dependence + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + a[i] = c[i+1] + 2; + } +} + +*/ +TEST_F(FusionLegalTest, NoLoopCarriedDependencesWAW) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %43 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %48 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %43 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %53 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %53 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %53 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %53 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %53 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %54 = OpPhi %6 %9 %12 %52 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %54 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpIAdd %6 %54 %29 + %46 = OpAccessChain %7 %43 %45 + %47 = OpLoad %6 %46 + %49 = OpIAdd %6 %47 %48 + %50 = OpAccessChain %7 %23 %54 + OpStore %50 %49 + OpBranch %38 + %38 = OpLabel + %52 = OpIAdd %6 %54 %29 + OpStore %34 %52 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[I_1:%\w+]] = OpIAdd {{%\w+}} [[PHI]] {{%\w+}} +CHECK-NEXT: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[I_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Legal outer. Continue and break are fine if nested in inner loops + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + if (j % 2 == 0) { + c[i][j] = a[i][j] + 2; + } else { + continue; + } + } + } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + if (j % 2 == 0) { + b[i][j] = c[i][j] + 10; + } else { + break; + } + } + } +} + +*/ +TEST_F(FusionLegalTest, OuterloopWithBreakContinueInInner) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %38 "c" + OpName %41 "a" + OpName %55 "i" + OpName %63 "j" + OpName %76 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %28 = OpConstant %6 2 + %33 = OpTypeInt 32 0 + %34 = OpConstant %33 10 + %35 = OpTypeArray %6 %34 + %36 = OpTypeArray %35 %34 + %37 = OpTypePointer Function %36 + %51 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %38 = OpVariable %37 Function + %41 = OpVariable %37 Function + %55 = OpVariable %7 Function + %63 = OpVariable %7 Function + %76 = OpVariable %37 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %91 = OpPhi %6 %9 %5 %54 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %91 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %96 = OpPhi %6 %9 %11 %52 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %96 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %29 = OpSMod %6 %96 %28 + %30 = OpIEqual %17 %29 %9 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %48 + %31 = OpLabel + %44 = OpAccessChain %7 %41 %91 %96 + %45 = OpLoad %6 %44 + %46 = OpIAdd %6 %45 %28 + %47 = OpAccessChain %7 %38 %91 %96 + OpStore %47 %46 + OpBranch %32 + %48 = OpLabel + OpBranch %23 + %32 = OpLabel + OpBranch %23 + %23 = OpLabel + %52 = OpIAdd %6 %96 %51 + OpStore %19 %52 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %54 = OpIAdd %6 %91 %51 + OpStore %8 %54 + OpBranch %10 + %12 = OpLabel + OpStore %55 %9 + OpBranch %56 + %56 = OpLabel + %92 = OpPhi %6 %9 %12 %90 %59 + OpLoopMerge %58 %59 None + OpBranch %60 + %60 = OpLabel + %62 = OpSLessThan %17 %92 %16 + OpBranchConditional %62 %57 %58 + %57 = OpLabel + OpStore %63 %9 + OpBranch %64 + %64 = OpLabel + %93 = OpPhi %6 %9 %57 %88 %67 + OpLoopMerge %66 %67 None + OpBranch %68 + %68 = OpLabel + %70 = OpSLessThan %17 %93 %16 + OpBranchConditional %70 %65 %66 + %65 = OpLabel + %72 = OpSMod %6 %93 %28 + %73 = OpIEqual %17 %72 %9 + OpSelectionMerge %75 None + OpBranchConditional %73 %74 %85 + %74 = OpLabel + %81 = OpAccessChain %7 %38 %92 %93 + %82 = OpLoad %6 %81 + %83 = OpIAdd %6 %82 %16 + %84 = OpAccessChain %7 %76 %92 %93 + OpStore %84 %83 + OpBranch %75 + %85 = OpLabel + OpBranch %66 + %75 = OpLabel + OpBranch %67 + %67 = OpLabel + %88 = OpIAdd %6 %93 %51 + OpStore %63 %88 + OpBranch %64 + %66 = OpLabel + OpBranch %59 + %59 = OpLabel + %90 = OpIAdd %6 %92 %51 + OpStore %55 %90 + OpBranch %56 + %58 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 4u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[2]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[1], loops[2]); + EXPECT_FALSE(fusion.AreCompatible()); + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK: [[PHI_2:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_2]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] [[PHI_2]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// j loop preheader removed manually +#version 440 core +void main() { + int[10] a; + int[10] b; + int i = 0; + int j = 0; + // No loop-carried dependences, legal + for (; i < 10; i++) { + a[i] = a[i]*2; + } + for (; j < 10; j++) { + b[j] = a[j]+2; + } +} + +*/ +TEST_F(FusionLegalTest, DifferentArraysInLoopsNoPreheader) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %10 "j" + OpName %24 "a" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 10 + %22 = OpTypeArray %6 %21 + %23 = OpTypePointer Function %22 + %29 = OpConstant %6 2 + %33 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %24 = OpVariable %23 Function + %42 = OpVariable %23 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %51 = OpPhi %6 %9 %5 %34 %14 + OpLoopMerge %35 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %51 %17 + OpBranchConditional %19 %12 %35 + %12 = OpLabel + %27 = OpAccessChain %7 %24 %51 + %28 = OpLoad %6 %27 + %30 = OpIMul %6 %28 %29 + %31 = OpAccessChain %7 %24 %51 + OpStore %31 %30 + OpBranch %14 + %14 = OpLabel + %34 = OpIAdd %6 %51 %33 + OpStore %8 %34 + OpBranch %11 + %35 = OpLabel + %52 = OpPhi %6 %9 %15 %50 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %18 %52 %17 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %24 %52 + %46 = OpLoad %6 %45 + %47 = OpIAdd %6 %46 %29 + %48 = OpAccessChain %7 %42 %52 + OpStore %48 %47 + OpBranch %38 + %38 = OpLabel + %50 = OpIAdd %6 %52 %33 + OpStore %10 %50 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + { + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); + } + + ld.CreatePreHeaderBlocksIfMissing(); + + { + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +// j & k loop preheaders removed manually +#version 440 core +void main() { + int[10] a; + int[10] b; + int i = 0; + int j = 0; + int k = 0; + // No loop-carried dependences, legal + for (; i < 10; i++) { + a[i] = a[i]*2; + } + for (; j < 10; j++) { + b[j] = a[j]+2; + } + for (; k < 10; k++) { + a[k] = a[k]*2; + } +} + +*/ +TEST_F(FusionLegalTest, AdjacentLoopsNoPreheaders) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %10 "j" + OpName %11 "k" + OpName %25 "a" + OpName %43 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Function %23 + %30 = OpConstant %6 2 + %34 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %11 = OpVariable %7 Function + %25 = OpVariable %24 Function + %43 = OpVariable %24 Function + OpStore %8 %9 + OpStore %10 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + %67 = OpPhi %6 %9 %5 %35 %15 + OpLoopMerge %36 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %67 %18 + OpBranchConditional %20 %13 %36 + %13 = OpLabel + %28 = OpAccessChain %7 %25 %67 + %29 = OpLoad %6 %28 + %31 = OpIMul %6 %29 %30 + %32 = OpAccessChain %7 %25 %67 + OpStore %32 %31 + OpBranch %15 + %15 = OpLabel + %35 = OpIAdd %6 %67 %34 + OpStore %8 %35 + OpBranch %12 + %36 = OpLabel + %68 = OpPhi %6 %9 %16 %51 %39 + OpLoopMerge %52 %39 None + OpBranch %40 + %40 = OpLabel + %42 = OpSLessThan %19 %68 %18 + OpBranchConditional %42 %37 %52 + %37 = OpLabel + %46 = OpAccessChain %7 %25 %68 + %47 = OpLoad %6 %46 + %48 = OpIAdd %6 %47 %30 + %49 = OpAccessChain %7 %43 %68 + OpStore %49 %48 + OpBranch %39 + %39 = OpLabel + %51 = OpIAdd %6 %68 %34 + OpStore %10 %51 + OpBranch %36 + %52 = OpLabel + %70 = OpPhi %6 %9 %40 %66 %55 + OpLoopMerge %54 %55 None + OpBranch %56 + %56 = OpLabel + %58 = OpSLessThan %19 %70 %18 + OpBranchConditional %58 %53 %54 + %53 = OpLabel + %61 = OpAccessChain %7 %25 %70 + %62 = OpLoad %6 %61 + %63 = OpIMul %6 %62 %30 + %64 = OpAccessChain %7 %25 %70 + OpStore %64 %63 + OpBranch %55 + %55 = OpLabel + %66 = OpIAdd %6 %70 %34 + OpStore %11 %66 + OpBranch %52 + %54 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 3u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + { + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_FALSE(fusion.AreCompatible()); + } + + ld.CreatePreHeaderBlocksIfMissing(); + + { + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + std::string checks = R"( +CHECK: [[PHI_0:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_0]] +CHECK-NEXT: OpStore [[STORE_1]] +CHECK: [[PHI_1:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_2]] +CHECK: [[STORE_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI_1]] +CHECK-NEXT: OpStore [[STORE_2]] + )"; + + Match(checks, context.get()); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_0]] +CHECK: [[STORE_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpLoad {{%\w+}} [[LOAD_2]] +CHECK: [[STORE_2:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_2]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum_0 = 0; + int sum_1 = 0; + + // No loop-carried dependences, legal + for (int i = 0; i < 10; i++) { + sum_0 += a[i]; + } + for (int j = 0; j < 10; j++) { + sum_1 += b[j]; + } + + int total = sum_0 + sum_1; +} + +*/ +TEST_F(FusionLegalTest, IndependentReductions) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum_0" + OpName %10 "sum_1" + OpName %11 "i" + OpName %25 "a" + OpName %34 "j" + OpName %42 "b" + OpName %50 "total" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Function %23 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %11 = OpVariable %7 Function + %25 = OpVariable %24 Function + %34 = OpVariable %7 Function + %42 = OpVariable %24 Function + %50 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + %57 = OpPhi %6 %9 %5 %30 %15 + %54 = OpPhi %6 %9 %5 %33 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %54 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %27 = OpAccessChain %7 %25 %54 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %57 %28 + OpStore %8 %30 + OpBranch %15 + %15 = OpLabel + %33 = OpIAdd %6 %54 %32 + OpStore %11 %33 + OpBranch %12 + %14 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %58 = OpPhi %6 %9 %14 %47 %38 + %55 = OpPhi %6 %9 %14 %49 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %19 %55 %18 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %44 = OpAccessChain %7 %42 %55 + %45 = OpLoad %6 %44 + %47 = OpIAdd %6 %58 %45 + OpStore %10 %47 + OpBranch %38 + %38 = OpLabel + %49 = OpIAdd %6 %55 %32 + OpStore %34 %49 + OpBranch %35 + %37 = OpLabel + %53 = OpIAdd %6 %57 %58 + OpStore %50 %53 + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[SUM_0:%\w+]] = OpPhi +CHECK-NEXT: [[SUM_1:%\w+]] = OpPhi +CHECK-NEXT: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_0:%\w+]] = OpLoad {{%\w+}} [[LOAD_0]] +CHECK-NEXT: [[ADD_RES_0:%\w+]] = OpIAdd {{%\w+}} [[SUM_0]] [[LOAD_RES_0]] +CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_1:%\w+]] = OpLoad {{%\w+}} [[LOAD_1]] +CHECK-NEXT: [[ADD_RES_1:%\w+]] = OpIAdd {{%\w+}} [[SUM_1]] [[LOAD_RES_1]] +CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum_0 = 0; + int sum_1 = 0; + + // No loop-carried dependences, legal + for (int i = 0; i < 10; i++) { + sum_0 += a[i]; + } + for (int j = 0; j < 10; j++) { + sum_1 += b[j]; + } + + int total = sum_0 + sum_1; +} + +*/ +TEST_F(FusionLegalTest, IndependentReductionsOneLCSSA) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum_0" + OpName %10 "sum_1" + OpName %11 "i" + OpName %25 "a" + OpName %34 "j" + OpName %42 "b" + OpName %50 "total" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Function %23 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %11 = OpVariable %7 Function + %25 = OpVariable %24 Function + %34 = OpVariable %7 Function + %42 = OpVariable %24 Function + %50 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + %57 = OpPhi %6 %9 %5 %30 %15 + %54 = OpPhi %6 %9 %5 %33 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %54 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %27 = OpAccessChain %7 %25 %54 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %57 %28 + OpStore %8 %30 + OpBranch %15 + %15 = OpLabel + %33 = OpIAdd %6 %54 %32 + OpStore %11 %33 + OpBranch %12 + %14 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %58 = OpPhi %6 %9 %14 %47 %38 + %55 = OpPhi %6 %9 %14 %49 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %19 %55 %18 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %44 = OpAccessChain %7 %42 %55 + %45 = OpLoad %6 %44 + %47 = OpIAdd %6 %58 %45 + OpStore %10 %47 + OpBranch %38 + %38 = OpLabel + %49 = OpIAdd %6 %55 %32 + OpStore %34 %49 + OpBranch %35 + %37 = OpLabel + %53 = OpIAdd %6 %57 %58 + OpStore %50 %53 + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopUtils utils_0(context.get(), loops[0]); + utils_0.MakeLoopClosedSSA(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[SUM_0:%\w+]] = OpPhi +CHECK-NEXT: [[SUM_1:%\w+]] = OpPhi +CHECK-NEXT: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_0:%\w+]] = OpLoad {{%\w+}} [[LOAD_0]] +CHECK-NEXT: [[ADD_RES_0:%\w+]] = OpIAdd {{%\w+}} [[SUM_0]] [[LOAD_RES_0]] +CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_1:%\w+]] = OpLoad {{%\w+}} [[LOAD_1]] +CHECK-NEXT: [[ADD_RES_1:%\w+]] = OpIAdd {{%\w+}} [[SUM_1]] [[LOAD_RES_1]] +CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum_0 = 0; + int sum_1 = 0; + + // No loop-carried dependences, legal + for (int i = 0; i < 10; i++) { + sum_0 += a[i]; + } + for (int j = 0; j < 10; j++) { + sum_1 += b[j]; + } + + int total = sum_0 + sum_1; +} + +*/ +TEST_F(FusionLegalTest, IndependentReductionsBothLCSSA) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum_0" + OpName %10 "sum_1" + OpName %11 "i" + OpName %25 "a" + OpName %34 "j" + OpName %42 "b" + OpName %50 "total" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Function %23 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %11 = OpVariable %7 Function + %25 = OpVariable %24 Function + %34 = OpVariable %7 Function + %42 = OpVariable %24 Function + %50 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %9 + OpStore %11 %9 + OpBranch %12 + %12 = OpLabel + %57 = OpPhi %6 %9 %5 %30 %15 + %54 = OpPhi %6 %9 %5 %33 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %19 %54 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %27 = OpAccessChain %7 %25 %54 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %57 %28 + OpStore %8 %30 + OpBranch %15 + %15 = OpLabel + %33 = OpIAdd %6 %54 %32 + OpStore %11 %33 + OpBranch %12 + %14 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %58 = OpPhi %6 %9 %14 %47 %38 + %55 = OpPhi %6 %9 %14 %49 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %19 %55 %18 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %44 = OpAccessChain %7 %42 %55 + %45 = OpLoad %6 %44 + %47 = OpIAdd %6 %58 %45 + OpStore %10 %47 + OpBranch %38 + %38 = OpLabel + %49 = OpIAdd %6 %55 %32 + OpStore %34 %49 + OpBranch %35 + %37 = OpLabel + %53 = OpIAdd %6 %57 %58 + OpStore %50 %53 + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopUtils utils_0(context.get(), loops[0]); + utils_0.MakeLoopClosedSSA(); + LoopUtils utils_1(context.get(), loops[1]); + utils_1.MakeLoopClosedSSA(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: [[SUM_0:%\w+]] = OpPhi +CHECK-NEXT: [[SUM_1:%\w+]] = OpPhi +CHECK-NEXT: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_0:%\w+]] = OpLoad {{%\w+}} [[LOAD_0]] +CHECK-NEXT: [[ADD_RES_0:%\w+]] = OpIAdd {{%\w+}} [[SUM_0]] [[LOAD_RES_0]] +CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_1:%\w+]] = OpLoad {{%\w+}} [[LOAD_1]] +CHECK-NEXT: [[ADD_RES_1:%\w+]] = OpIAdd {{%\w+}} [[SUM_1]] [[LOAD_RES_1]] +CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + + int sum_0 = 0; + + // No loop-carried dependences, legal + for (int i = 0; i < 10; i++) { + sum_0 += a[i]; + } + for (int j = 0; j < 10; j++) { + a[j] = b[j]; + } +} + +*/ +TEST_F(FusionLegalTest, LoadStoreReductionAndNonLoopCarriedDependence) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "sum_0" + OpName %10 "i" + OpName %24 "a" + OpName %33 "j" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 10 + %18 = OpTypeBool + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 10 + %22 = OpTypeArray %6 %21 + %23 = OpTypePointer Function %22 + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %24 = OpVariable %23 Function + %33 = OpVariable %7 Function + %42 = OpVariable %23 Function + OpStore %8 %9 + OpStore %10 %9 + OpBranch %11 + %11 = OpLabel + %51 = OpPhi %6 %9 %5 %29 %14 + %49 = OpPhi %6 %9 %5 %32 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %18 %49 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %26 = OpAccessChain %7 %24 %49 + %27 = OpLoad %6 %26 + %29 = OpIAdd %6 %51 %27 + OpStore %8 %29 + OpBranch %14 + %14 = OpLabel + %32 = OpIAdd %6 %49 %31 + OpStore %10 %32 + OpBranch %11 + %13 = OpLabel + OpStore %33 %9 + OpBranch %34 + %34 = OpLabel + %50 = OpPhi %6 %9 %13 %48 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %18 %50 %17 + OpBranchConditional %40 %35 %36 + %35 = OpLabel + %44 = OpAccessChain %7 %42 %50 + %45 = OpLoad %6 %44 + %46 = OpAccessChain %7 %24 %50 + OpStore %46 %45 + OpBranch %37 + %37 = OpLabel + %48 = OpIAdd %6 %50 %31 + OpStore %33 %48 + OpBranch %34 + %36 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + // TODO: Loop descriptor doesn't return induction variables but all OpPhi + // in the header and LoopDependenceAnalysis falls over. + // EXPECT_TRUE(fusion.IsLegal()); + + // fusion.Fuse(); + } + + { + // LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + // EXPECT_EQ(ld.NumLoops(), 1u); + + // std::string checks = R"( + // CHECK: [[SUM_0:%\w+]] = OpPhi + // CHECK-NEXT: [[PHI:%\w+]] = OpPhi + // CHECK-NEXT: OpLoopMerge + // CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] + // CHECK-NEXT: [[LOAD_RES_0:%\w+]] = OpLoad {{%\w+}} [[LOAD_0]] + // CHECK-NEXT: [[ADD_RES_0:%\w+]] = OpIAdd {{%\w+}} [[SUM_0]] [[LOAD_RES_0]] + // CHECK-NEXT: OpStore {{%\w+}} [[ADD_RES_0]] + // CHECK-NOT: OpPhi + // CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] + // CHECK-NEXT: [[LOAD_RES_1:%\w+]] = OpLoad {{%\w+}} [[LOAD_1]] + // CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] + // CHECK-NEXT: OpStore [[STORE_1]] [[LOAD_RES_1]] + // )"; + + // Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +int x; +void main() { + int[10] a; + int[10] b; + + // Legal. + for (int i = 0; i < 10; i++) { + x += a[i]; + } + for (int j = 0; j < 10; j++) { + b[j] = b[j]+1; + } +} + +*/ +TEST_F(FusionLegalTest, ReductionAndNonLoopCarriedDependence) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %20 "x" + OpName %25 "a" + OpName %34 "j" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypePointer Private %6 + %20 = OpVariable %19 Private + %21 = OpTypeInt 32 0 + %22 = OpConstant %21 10 + %23 = OpTypeArray %6 %22 + %24 = OpTypePointer Function %23 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %25 = OpVariable %24 Function + %34 = OpVariable %7 Function + %42 = OpVariable %24 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %51 + %28 = OpLoad %6 %27 + %29 = OpLoad %6 %20 + %30 = OpIAdd %6 %29 %28 + OpStore %20 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %51 %32 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %52 = OpPhi %6 %9 %12 %50 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %52 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %42 %52 + %46 = OpLoad %6 %45 + %47 = OpIAdd %6 %46 %32 + %48 = OpAccessChain %7 %42 %52 + OpStore %48 %47 + OpBranch %38 + %38 = OpLabel + %50 = OpIAdd %6 %52 %32 + OpStore %34 %50 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + std::string checks = R"( +CHECK: OpName [[X:%\w+]] "x" +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[LOAD_0:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: [[LOAD_RES_0:%\w+]] = OpLoad {{%\w+}} [[LOAD_0]] +CHECK-NEXT: [[X_LOAD:%\w+]] = OpLoad {{%\w+}} [[X]] +CHECK-NEXT: [[ADD_RES_0:%\w+]] = OpIAdd {{%\w+}} [[X_LOAD]] [[LOAD_RES_0]] +CHECK-NEXT: OpStore [[X]] [[ADD_RES_0]] +CHECK-NOT: OpPhi +CHECK: [[LOAD_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: {{%\w+}} = OpLoad {{%\w+}} [[LOAD_1]] +CHECK: [[STORE_1:%\w+]] = OpAccessChain {{%\w+}} {{%\w+}} [[PHI]] +CHECK-NEXT: OpStore [[STORE_1]] + )"; + + Match(checks, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +struct TestStruct { + int[10] a; + int b; +}; + +void main() { + TestStruct test_0; + TestStruct test_1; + TestStruct test_2; + + test_1.b = 2; + + for (int i = 0; i < 10; i++) { + test_0.a[i] = i; + } + for (int j = 0; j < 10; j++) { + test_2 = test_1; + } +} + +*/ +TEST_F(FusionLegalTest, ArrayInStruct) { + std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %10 "TestStruct" + OpMemberName %10 0 "a" + OpMemberName %10 1 "b" + OpName %12 "test_1" + OpName %17 "i" + OpName %28 "test_0" + OpName %34 "j" + OpName %42 "test_2" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeInt 32 0 + %8 = OpConstant %7 10 + %9 = OpTypeArray %6 %8 + %10 = OpTypeStruct %9 %6 + %11 = OpTypePointer Function %10 + %13 = OpConstant %6 1 + %14 = OpConstant %6 2 + %15 = OpTypePointer Function %6 + %18 = OpConstant %6 0 + %25 = OpConstant %6 10 + %26 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpVariable %11 Function + %17 = OpVariable %15 Function + %28 = OpVariable %11 Function + %34 = OpVariable %15 Function + %42 = OpVariable %11 Function + %16 = OpAccessChain %15 %12 %13 + OpStore %16 %14 + OpStore %17 %18 + OpBranch %19 + %19 = OpLabel + %46 = OpPhi %6 %18 %5 %33 %22 + OpLoopMerge %21 %22 None + OpBranch %23 + %23 = OpLabel + %27 = OpSLessThan %26 %46 %25 + OpBranchConditional %27 %20 %21 + %20 = OpLabel + %31 = OpAccessChain %15 %28 %18 %46 + OpStore %31 %46 + OpBranch %22 + %22 = OpLabel + %33 = OpIAdd %6 %46 %13 + OpStore %17 %33 + OpBranch %19 + %21 = OpLabel + OpStore %34 %18 + OpBranch %35 + %35 = OpLabel + %47 = OpPhi %6 %18 %21 %45 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %26 %47 %25 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %43 = OpLoad %10 %12 + OpStore %42 %43 + OpBranch %38 + %38 = OpLabel + %45 = OpIAdd %6 %47 %13 + OpStore %34 %45 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 2u); + + auto loops = ld.GetLoopsInBinaryLayoutOrder(); + + LoopFusion fusion(context.get(), loops[0], loops[1]); + EXPECT_TRUE(fusion.AreCompatible()); + EXPECT_TRUE(fusion.IsLegal()); + + fusion.Fuse(); + } + + { + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), 1u); + + // clang-format off + std::string checks = R"( +CHECK: OpName [[TEST_1:%\w+]] "test_1" +CHECK: OpName [[TEST_0:%\w+]] "test_0" +CHECK: OpName [[TEST_2:%\w+]] "test_2" +CHECK: [[PHI:%\w+]] = OpPhi +CHECK-NEXT: OpLoopMerge +CHECK: [[TEST_0_STORE:%\w+]] = OpAccessChain {{%\w+}} [[TEST_0]] {{%\w+}} {{%\w+}} +CHECK-NEXT: OpStore [[TEST_0_STORE]] [[PHI]] +CHECK-NOT: OpPhi +CHECK: [[TEST_1_LOAD:%\w+]] = OpLoad {{%\w+}} [[TEST_1]] +CHECK: OpStore [[TEST_2]] [[TEST_1_LOAD]] + )"; + // clang-format on + + Match(checks, context.get()); + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp new file mode 100644 index 00000000000..857ada93935 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/fusion_pass.cpp @@ -0,0 +1,724 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/opt/pass_fixture.h" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +using FusionPassTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + for (int i = 0; i < 10; i++) { + a[i] = a[i]*2; + } + for (int i = 0; i < 10; i++) { + b[i] = a[i]+2; + } +} + +*/ +TEST_F(FusionPassTest, SimpleFusion) { + const std::string text = R"( +; CHECK: OpPhi +; CHECK: OpLoad +; CHECK: OpStore +; CHECK-NOT: OpPhi +; CHECK: OpLoad +; CHECK: OpStore + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %34 "i" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %28 = OpConstant %6 2 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpAccessChain %7 %23 %51 + %27 = OpLoad %6 %26 + %29 = OpIMul %6 %27 %28 + %30 = OpAccessChain %7 %23 %51 + OpStore %30 %29 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %51 %32 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %52 = OpPhi %6 %9 %12 %50 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %52 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %23 %52 + %46 = OpLoad %6 %45 + %47 = OpIAdd %6 %46 %28 + %48 = OpAccessChain %7 %42 %52 + OpStore %48 %47 + OpBranch %38 + %38 = OpLabel + %50 = OpIAdd %6 %52 %32 + OpStore %34 %50 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true, 20); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i] + 2; + } + for (int i = 0; i < 10; i++) { + b[i] = c[i] + 10; + } +} + +*/ +TEST_F(FusionPassTest, ThreeLoopsFused) { + const std::string text = R"( +; CHECK: OpPhi +; CHECK: OpLoad +; CHECK: OpStore +; CHECK-NOT: OpPhi +; CHECK: OpLoad +; CHECK: OpStore +; CHECK-NOT: OpPhi +; CHECK: OpLoad +; CHECK: OpStore + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %42 "c" + OpName %52 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %47 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + %52 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %68 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %68 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %68 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %68 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %68 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %69 = OpPhi %6 %9 %12 %51 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %69 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %23 %69 + %46 = OpLoad %6 %45 + %48 = OpIAdd %6 %46 %47 + %49 = OpAccessChain %7 %42 %69 + OpStore %49 %48 + OpBranch %38 + %38 = OpLabel + %51 = OpIAdd %6 %69 %29 + OpStore %34 %51 + OpBranch %35 + %37 = OpLabel + OpStore %52 %9 + OpBranch %53 + %53 = OpLabel + %70 = OpPhi %6 %9 %37 %67 %56 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %59 = OpSLessThan %17 %70 %16 + OpBranchConditional %59 %54 %55 + %54 = OpLabel + %62 = OpAccessChain %7 %42 %70 + %63 = OpLoad %6 %62 + %64 = OpIAdd %6 %63 %16 + %65 = OpAccessChain %7 %25 %70 + OpStore %65 %64 + OpBranch %56 + %56 = OpLabel + %67 = OpIAdd %6 %70 %29 + OpStore %52 %67 + OpBranch %53 + %55 = OpLabel + OpReturn + OpFunctionEnd + + )"; + + SinglePassRunAndMatch(text, true, 20); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10][10] a; + int[10][10] b; + int[10][10] c; + // Legal both + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + c[i][j] = a[i][j] + 2; + } + } + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + b[i][j] = c[i][j] + 10; + } + } +} + +*/ +TEST_F(FusionPassTest, NestedLoopsFused) { + const std::string text = R"( +; CHECK: OpPhi +; CHECK: OpPhi +; CHECK: OpLoad +; CHECK: OpStore +; CHECK-NOT: OpPhi +; CHECK: OpLoad +; CHECK: OpStore + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %19 "j" + OpName %32 "c" + OpName %35 "a" + OpName %48 "i" + OpName %56 "j" + OpName %64 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %27 = OpTypeInt 32 0 + %28 = OpConstant %27 10 + %29 = OpTypeArray %6 %28 + %30 = OpTypeArray %29 %28 + %31 = OpTypePointer Function %30 + %40 = OpConstant %6 2 + %44 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %32 = OpVariable %31 Function + %35 = OpVariable %31 Function + %48 = OpVariable %7 Function + %56 = OpVariable %7 Function + %64 = OpVariable %31 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %77 = OpPhi %6 %9 %5 %47 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %77 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpStore %19 %9 + OpBranch %20 + %20 = OpLabel + %81 = OpPhi %6 %9 %11 %45 %23 + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %26 = OpSLessThan %17 %81 %16 + OpBranchConditional %26 %21 %22 + %21 = OpLabel + %38 = OpAccessChain %7 %35 %77 %81 + %39 = OpLoad %6 %38 + %41 = OpIAdd %6 %39 %40 + %42 = OpAccessChain %7 %32 %77 %81 + OpStore %42 %41 + OpBranch %23 + %23 = OpLabel + %45 = OpIAdd %6 %81 %44 + OpStore %19 %45 + OpBranch %20 + %22 = OpLabel + OpBranch %13 + %13 = OpLabel + %47 = OpIAdd %6 %77 %44 + OpStore %8 %47 + OpBranch %10 + %12 = OpLabel + OpStore %48 %9 + OpBranch %49 + %49 = OpLabel + %78 = OpPhi %6 %9 %12 %76 %52 + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %55 = OpSLessThan %17 %78 %16 + OpBranchConditional %55 %50 %51 + %50 = OpLabel + OpStore %56 %9 + OpBranch %57 + %57 = OpLabel + %79 = OpPhi %6 %9 %50 %74 %60 + OpLoopMerge %59 %60 None + OpBranch %61 + %61 = OpLabel + %63 = OpSLessThan %17 %79 %16 + OpBranchConditional %63 %58 %59 + %58 = OpLabel + %69 = OpAccessChain %7 %32 %78 %79 + %70 = OpLoad %6 %69 + %71 = OpIAdd %6 %70 %16 + %72 = OpAccessChain %7 %64 %78 %79 + OpStore %72 %71 + OpBranch %60 + %60 = OpLabel + %74 = OpIAdd %6 %79 %44 + OpStore %56 %74 + OpBranch %57 + %59 = OpLabel + OpBranch %52 + %52 = OpLabel + %76 = OpIAdd %6 %78 %44 + OpStore %48 %76 + OpBranch %49 + %51 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true, 20); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + // Can't fuse, different step + for (int i = 0; i < 10; i++) {} + for (int j = 0; j < 10; j=j+2) {} +} + +*/ +TEST_F(FusionPassTest, Incompatible) { + const std::string text = R"( +; CHECK: OpPhi +; CHECK-NEXT: OpLoopMerge +; CHECK: OpPhi +; CHECK-NEXT: OpLoopMerge + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %22 "j" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %20 = OpConstant %6 1 + %31 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %22 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %33 = OpPhi %6 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %33 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %6 %33 %20 + OpStore %8 %21 + OpBranch %10 + %12 = OpLabel + OpStore %22 %9 + OpBranch %23 + %23 = OpLabel + %34 = OpPhi %6 %9 %12 %32 %26 + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %17 %34 %16 + OpBranchConditional %29 %24 %25 + %24 = OpLabel + OpBranch %26 + %26 = OpLabel + %32 = OpIAdd %6 %34 %31 + OpStore %22 %32 + OpBranch %23 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true, 20); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + int[10] c; + // Illegal, loop-independent dependence will become a + // backward loop-carried antidependence + for (int i = 0; i < 10; i++) { + a[i] = b[i] + 1; + } + for (int i = 0; i < 10; i++) { + c[i] = a[i+1] + 2; + } +} + +*/ +TEST_F(FusionPassTest, Illegal) { + std::string text = R"( +; CHECK: OpPhi +; CHECK-NEXT: OpLoopMerge +; CHECK: OpLoad +; CHECK: OpStore +; CHECK: OpPhi +; CHECK-NEXT: OpLoopMerge +; CHECK: OpLoad +; CHECK: OpStore + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %25 "b" + OpName %34 "i" + OpName %42 "c" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %29 = OpConstant %6 1 + %48 = OpConstant %6 2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %25 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %53 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %53 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpAccessChain %7 %25 %53 + %28 = OpLoad %6 %27 + %30 = OpIAdd %6 %28 %29 + %31 = OpAccessChain %7 %23 %53 + OpStore %31 %30 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %53 %29 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %54 = OpPhi %6 %9 %12 %52 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %54 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpIAdd %6 %54 %29 + %46 = OpAccessChain %7 %23 %45 + %47 = OpLoad %6 %46 + %49 = OpIAdd %6 %47 %48 + %50 = OpAccessChain %7 %42 %54 + OpStore %50 %49 + OpBranch %38 + %38 = OpLabel + %52 = OpIAdd %6 %54 %29 + OpStore %34 %52 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true, 20); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +void main() { + int[10] a; + int[10] b; + for (int i = 0; i < 10; i++) { + a[i] = a[i]*2; + } + for (int i = 0; i < 10; i++) { + b[i] = a[i]+2; + } +} + +*/ +TEST_F(FusionPassTest, TooManyRegisters) { + const std::string text = R"( +; CHECK: OpPhi +; CHECK-NEXT: OpLoopMerge +; CHECK: OpLoad +; CHECK: OpStore +; CHECK: OpPhi +; CHECK-NEXT: OpLoopMerge +; CHECK: OpLoad +; CHECK: OpStore + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + OpName %8 "i" + OpName %23 "a" + OpName %34 "i" + OpName %42 "b" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 10 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %28 = OpConstant %6 2 + %32 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %23 = OpVariable %22 Function + %34 = OpVariable %7 Function + %42 = OpVariable %22 Function + OpStore %8 %9 + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %33 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpAccessChain %7 %23 %51 + %27 = OpLoad %6 %26 + %29 = OpIMul %6 %27 %28 + %30 = OpAccessChain %7 %23 %51 + OpStore %30 %29 + OpBranch %13 + %13 = OpLabel + %33 = OpIAdd %6 %51 %32 + OpStore %8 %33 + OpBranch %10 + %12 = OpLabel + OpStore %34 %9 + OpBranch %35 + %35 = OpLabel + %52 = OpPhi %6 %9 %12 %50 %38 + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %41 = OpSLessThan %17 %52 %16 + OpBranchConditional %41 %36 %37 + %36 = OpLabel + %45 = OpAccessChain %7 %23 %52 + %46 = OpLoad %6 %45 + %47 = OpIAdd %6 %46 %28 + %48 = OpAccessChain %7 %42 %52 + OpStore %48 %47 + OpBranch %38 + %38 = OpLabel + %50 = OpIAdd %6 %52 %32 + OpStore %34 %50 + OpBranch %35 + %37 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true, 5); +} + +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp new file mode 100644 index 00000000000..27e0a0d9174 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_all_loop_types.cpp @@ -0,0 +1,285 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Tests that all loop types are handled appropriately by the LICM pass. + + Generated from the following GLSL fragment shader +--eliminate-local-multi-store has also been run on the spv binary +#version 440 core +void main(){ + int i_1 = 0; + for (i_1 = 0; i_1 < 10; i_1++) { + } + int i_2 = 0; + while (i_2 < 10) { + i_2++; + } + int i_3 = 0; + do { + i_3++; + } while (i_3 < 10); + int hoist = 0; + int i_4 = 0; + int i_5 = 0; + int i_6 = 0; + for (i_4 = 0; i_4 < 10; i_4++) { + while (i_5 < 10) { + do { + hoist = i_1 + i_2 + i_3; + i_6++; + } while (i_6 < 10); + i_5++; + } + } +} +*/ +TEST_F(PassClassTest, AllLoopTypes) { + const std::string before_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_1 = OpConstant %int 1 +%main = OpFunction %void None %4 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +%13 = OpPhi %int %int_0 %11 %14 %15 +OpLoopMerge %16 %15 None +OpBranch %17 +%17 = OpLabel +%18 = OpSLessThan %bool %13 %int_10 +OpBranchConditional %18 %19 %16 +%19 = OpLabel +OpBranch %15 +%15 = OpLabel +%14 = OpIAdd %int %13 %int_1 +OpBranch %12 +%16 = OpLabel +OpBranch %20 +%20 = OpLabel +%21 = OpPhi %int %int_0 %16 %22 %23 +OpLoopMerge %24 %23 None +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%22 = OpIAdd %int %21 %int_1 +OpBranch %23 +%23 = OpLabel +OpBranch %20 +%24 = OpLabel +OpBranch %28 +%28 = OpLabel +%29 = OpPhi %int %int_0 %24 %30 %31 +OpLoopMerge %32 %31 None +OpBranch %33 +%33 = OpLabel +%30 = OpIAdd %int %29 %int_1 +OpBranch %31 +%31 = OpLabel +%34 = OpSLessThan %bool %30 %int_10 +OpBranchConditional %34 %28 %32 +%32 = OpLabel +OpBranch %35 +%35 = OpLabel +%36 = OpPhi %int %int_0 %32 %37 %38 +%39 = OpPhi %int %int_0 %32 %40 %38 +%41 = OpPhi %int %int_0 %32 %42 %38 +%43 = OpPhi %int %int_0 %32 %44 %38 +OpLoopMerge %45 %38 None +OpBranch %46 +%46 = OpLabel +%47 = OpSLessThan %bool %39 %int_10 +OpBranchConditional %47 %48 %45 +%48 = OpLabel +OpBranch %49 +%49 = OpLabel +%37 = OpPhi %int %36 %48 %50 %51 +%42 = OpPhi %int %41 %48 %52 %51 +%44 = OpPhi %int %43 %48 %53 %51 +OpLoopMerge %54 %51 None +OpBranch %55 +%55 = OpLabel +%56 = OpSLessThan %bool %42 %int_10 +OpBranchConditional %56 %57 %54 +%57 = OpLabel +OpBranch %58 +%58 = OpLabel +%59 = OpPhi %int %37 %57 %50 %60 +%61 = OpPhi %int %44 %57 %53 %60 +OpLoopMerge %62 %60 None +OpBranch %63 +%63 = OpLabel +%64 = OpIAdd %int %13 %21 +%50 = OpIAdd %int %64 %30 +%53 = OpIAdd %int %61 %int_1 +OpBranch %60 +%60 = OpLabel +%65 = OpSLessThan %bool %53 %int_10 +OpBranchConditional %65 %58 %62 +%62 = OpLabel +%52 = OpIAdd %int %42 %int_1 +OpBranch %51 +%51 = OpLabel +OpBranch %49 +%54 = OpLabel +OpBranch %38 +%38 = OpLabel +%40 = OpIAdd %int %39 %int_1 +OpBranch %35 +%45 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_1 = OpConstant %int 1 +%main = OpFunction %void None %4 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +%13 = OpPhi %int %int_0 %11 %14 %15 +OpLoopMerge %16 %15 None +OpBranch %17 +%17 = OpLabel +%18 = OpSLessThan %bool %13 %int_10 +OpBranchConditional %18 %19 %16 +%19 = OpLabel +OpBranch %15 +%15 = OpLabel +%14 = OpIAdd %int %13 %int_1 +OpBranch %12 +%16 = OpLabel +OpBranch %20 +%20 = OpLabel +%21 = OpPhi %int %int_0 %16 %22 %23 +OpLoopMerge %24 %23 None +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%22 = OpIAdd %int %21 %int_1 +OpBranch %23 +%23 = OpLabel +OpBranch %20 +%24 = OpLabel +OpBranch %28 +%28 = OpLabel +%29 = OpPhi %int %int_0 %24 %30 %31 +OpLoopMerge %32 %31 None +OpBranch %33 +%33 = OpLabel +%30 = OpIAdd %int %29 %int_1 +OpBranch %31 +%31 = OpLabel +%34 = OpSLessThan %bool %30 %int_10 +OpBranchConditional %34 %28 %32 +%32 = OpLabel +%64 = OpIAdd %int %13 %21 +%50 = OpIAdd %int %64 %30 +OpBranch %35 +%35 = OpLabel +%36 = OpPhi %int %int_0 %32 %37 %38 +%39 = OpPhi %int %int_0 %32 %40 %38 +%41 = OpPhi %int %int_0 %32 %42 %38 +%43 = OpPhi %int %int_0 %32 %44 %38 +OpLoopMerge %45 %38 None +OpBranch %46 +%46 = OpLabel +%47 = OpSLessThan %bool %39 %int_10 +OpBranchConditional %47 %48 %45 +%48 = OpLabel +OpBranch %49 +%49 = OpLabel +%37 = OpPhi %int %36 %48 %50 %51 +%42 = OpPhi %int %41 %48 %52 %51 +%44 = OpPhi %int %43 %48 %53 %51 +OpLoopMerge %54 %51 None +OpBranch %55 +%55 = OpLabel +%56 = OpSLessThan %bool %42 %int_10 +OpBranchConditional %56 %57 %54 +%57 = OpLabel +OpBranch %58 +%58 = OpLabel +%59 = OpPhi %int %37 %57 %50 %60 +%61 = OpPhi %int %44 %57 %53 %60 +OpLoopMerge %62 %60 None +OpBranch %63 +%63 = OpLabel +%53 = OpIAdd %int %61 %int_1 +OpBranch %60 +%60 = OpLabel +%65 = OpSLessThan %bool %53 %int_10 +OpBranchConditional %65 %58 %62 +%62 = OpLabel +%52 = OpIAdd %int %42 %int_1 +OpBranch %51 +%51 = OpLabel +OpBranch %49 +%54 = OpLabel +OpBranch %38 +%38 = OpLabel +%40 = OpIAdd %int %39 %int_1 +OpBranch %35 +%45 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_hoist, after_hoist, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp new file mode 100644 index 00000000000..ea1949658d0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_double_nested_loops.cpp @@ -0,0 +1,162 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Tests that the LICM pass will move invariants through multiple loops + + Generated from the following GLSL fragment shader +--eliminate-local-multi-store has also been run on the spv binary +#version 440 core +void main(){ + int a = 2; + int b = 1; + int hoist = 0; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + // hoist 'hoist = a - b' out of both loops + hoist = a - b; + } + } +} +*/ +TEST_F(PassClassTest, NestedDoubleHoist) { + const std::string before_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_2 = OpConstant %int 2 +%int_1 = OpConstant %int 1 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%12 = OpUndef %int +%main = OpFunction %void None %4 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +%15 = OpPhi %int %int_0 %13 %16 %17 +%18 = OpPhi %int %int_0 %13 %19 %17 +%20 = OpPhi %int %12 %13 %21 %17 +OpLoopMerge %22 %17 None +OpBranch %23 +%23 = OpLabel +%24 = OpSLessThan %bool %18 %int_10 +OpBranchConditional %24 %25 %22 +%25 = OpLabel +OpBranch %26 +%26 = OpLabel +%16 = OpPhi %int %15 %25 %27 %28 +%21 = OpPhi %int %int_0 %25 %29 %28 +OpLoopMerge %30 %28 None +OpBranch %31 +%31 = OpLabel +%32 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %32 %33 %30 +%33 = OpLabel +%27 = OpISub %int %int_2 %int_1 +OpBranch %28 +%28 = OpLabel +%29 = OpIAdd %int %21 %int_1 +OpBranch %26 +%30 = OpLabel +OpBranch %17 +%17 = OpLabel +%19 = OpIAdd %int %18 %int_1 +OpBranch %14 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_2 = OpConstant %int 2 +%int_1 = OpConstant %int 1 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%12 = OpUndef %int +%main = OpFunction %void None %4 +%13 = OpLabel +%27 = OpISub %int %int_2 %int_1 +OpBranch %14 +%14 = OpLabel +%15 = OpPhi %int %int_0 %13 %16 %17 +%18 = OpPhi %int %int_0 %13 %19 %17 +%20 = OpPhi %int %12 %13 %21 %17 +OpLoopMerge %22 %17 None +OpBranch %23 +%23 = OpLabel +%24 = OpSLessThan %bool %18 %int_10 +OpBranchConditional %24 %25 %22 +%25 = OpLabel +OpBranch %26 +%26 = OpLabel +%16 = OpPhi %int %15 %25 %27 %28 +%21 = OpPhi %int %int_0 %25 %29 %28 +OpLoopMerge %30 %28 None +OpBranch %31 +%31 = OpLabel +%32 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %32 %33 %30 +%33 = OpLabel +OpBranch %28 +%28 = OpLabel +%29 = OpIAdd %int %21 %int_1 +OpBranch %26 +%30 = OpLabel +OpBranch %17 +%17 = OpLabel +%19 = OpIAdd %int %18 %int_1 +OpBranch %14 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_hoist, after_hoist, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp new file mode 100644 index 00000000000..abc79e37c5f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_from_independent_loops.cpp @@ -0,0 +1,201 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Tests that the LICM pass will analyse multiple independent loops in a function + + Generated from the following GLSL fragment shader +--eliminate-local-multi-store has also been run on the spv binary +#version 440 core +void main(){ + int a = 1; + int b = 2; + int hoist = 0; + for (int i = 0; i < 10; i++) { + // invariant + hoist = a + b; + } + for (int i = 0; i < 10; i++) { + // invariant + hoist = a + b; + } + int c = 1; + int d = 2; + int hoist2 = 0; + for (int i = 0; i < 10; i++) { + // invariant + hoist2 = c + d; + } +} +*/ +TEST_F(PassClassTest, HoistFromIndependentLoops) { + const std::string before_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%main = OpFunction %void None %4 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%14 = OpPhi %int %int_0 %12 %15 %16 +%17 = OpPhi %int %int_0 %12 %18 %16 +OpLoopMerge %19 %16 None +OpBranch %20 +%20 = OpLabel +%21 = OpSLessThan %bool %17 %int_10 +OpBranchConditional %21 %22 %19 +%22 = OpLabel +%15 = OpIAdd %int %int_1 %int_2 +OpBranch %16 +%16 = OpLabel +%18 = OpIAdd %int %17 %int_1 +OpBranch %13 +%19 = OpLabel +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %int %14 %19 %25 %26 +%27 = OpPhi %int %int_0 %19 %28 %26 +OpLoopMerge %29 %26 None +OpBranch %30 +%30 = OpLabel +%31 = OpSLessThan %bool %27 %int_10 +OpBranchConditional %31 %32 %29 +%32 = OpLabel +%25 = OpIAdd %int %int_1 %int_2 +OpBranch %26 +%26 = OpLabel +%28 = OpIAdd %int %27 %int_1 +OpBranch %23 +%29 = OpLabel +OpBranch %33 +%33 = OpLabel +%34 = OpPhi %int %int_0 %29 %35 %36 +%37 = OpPhi %int %int_0 %29 %38 %36 +OpLoopMerge %39 %36 None +OpBranch %40 +%40 = OpLabel +%41 = OpSLessThan %bool %37 %int_10 +OpBranchConditional %41 %42 %39 +%42 = OpLabel +%35 = OpIAdd %int %int_1 %int_2 +OpBranch %36 +%36 = OpLabel +%38 = OpIAdd %int %37 %int_1 +OpBranch %33 +%39 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%main = OpFunction %void None %4 +%12 = OpLabel +%15 = OpIAdd %int %int_1 %int_2 +OpBranch %13 +%13 = OpLabel +%14 = OpPhi %int %int_0 %12 %15 %16 +%17 = OpPhi %int %int_0 %12 %18 %16 +OpLoopMerge %19 %16 None +OpBranch %20 +%20 = OpLabel +%21 = OpSLessThan %bool %17 %int_10 +OpBranchConditional %21 %22 %19 +%22 = OpLabel +OpBranch %16 +%16 = OpLabel +%18 = OpIAdd %int %17 %int_1 +OpBranch %13 +%19 = OpLabel +%25 = OpIAdd %int %int_1 %int_2 +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %int %14 %19 %25 %26 +%27 = OpPhi %int %int_0 %19 %28 %26 +OpLoopMerge %29 %26 None +OpBranch %30 +%30 = OpLabel +%31 = OpSLessThan %bool %27 %int_10 +OpBranchConditional %31 %32 %29 +%32 = OpLabel +OpBranch %26 +%26 = OpLabel +%28 = OpIAdd %int %27 %int_1 +OpBranch %23 +%29 = OpLabel +%35 = OpIAdd %int %int_1 %int_2 +OpBranch %33 +%33 = OpLabel +%34 = OpPhi %int %int_0 %29 %35 %36 +%37 = OpPhi %int %int_0 %29 %38 %36 +OpLoopMerge %39 %36 None +OpBranch %40 +%40 = OpLabel +%41 = OpSLessThan %bool %37 %int_10 +OpBranchConditional %41 %42 %39 +%42 = OpLabel +OpBranch %36 +%36 = OpLabel +%38 = OpIAdd %int %37 %int_1 +OpBranch %33 +%39 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_hoist, after_hoist, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp new file mode 100644 index 00000000000..e973d9d2981 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_simple_case.cpp @@ -0,0 +1,126 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + A simple test for the LICM pass + + Generated from the following GLSL fragment shader +--eliminate-local-multi-store has also been run on the spv binary +#version 440 core +void main(){ + int a = 1; + int b = 2; + int hoist = 0; + for (int i = 0; i < 10; i++) { + // invariant + hoist = a + b; + } +} +*/ +TEST_F(PassClassTest, SimpleHoist) { + const std::string before_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%main = OpFunction %void None %4 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%14 = OpPhi %int %int_0 %12 %15 %16 +%17 = OpPhi %int %int_0 %12 %18 %16 +OpLoopMerge %19 %16 None +OpBranch %20 +%20 = OpLabel +%21 = OpSLessThan %bool %17 %int_10 +OpBranchConditional %21 %22 %19 +%22 = OpLabel +%15 = OpIAdd %int %int_1 %int_2 +OpBranch %16 +%16 = OpLabel +%18 = OpIAdd %int %17 %int_1 +OpBranch %13 +%19 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%main = OpFunction %void None %4 +%12 = OpLabel +%15 = OpIAdd %int %int_1 %int_2 +OpBranch %13 +%13 = OpLabel +%14 = OpPhi %int %int_0 %12 %15 %16 +%17 = OpPhi %int %int_0 %12 %18 %16 +OpLoopMerge %19 %16 None +OpBranch %20 +%20 = OpLabel +%21 = OpSLessThan %bool %17 %int_10 +OpBranchConditional %21 %22 %19 +%22 = OpLabel +OpBranch %16 +%16 = OpLabel +%18 = OpIAdd %int %17 %int_1 +OpBranch %13 +%19 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_hoist, after_hoist, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp new file mode 100644 index 00000000000..7fa1fb0a0d4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_single_nested_loops.cpp @@ -0,0 +1,163 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; + +using PassClassTest = PassTest<::testing::Test>; + +/* + Tests that the LICM pass will detect an move an invariant from a nested loop, + but not it's parent loop + + Generated from the following GLSL fragment shader +--eliminate-local-multi-store has also been run on the spv binary +#version 440 core +void main(){ + int a = 2; + int hoist = 0; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + // hoist 'hoist = a - i' out of j loop, but not i loop + hoist = a - i; + } + } +} +*/ +TEST_F(PassClassTest, NestedSingleHoist) { + const std::string before_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_1 = OpConstant %int 1 +%12 = OpUndef %int +%main = OpFunction %void None %4 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +%15 = OpPhi %int %int_0 %13 %16 %17 +%18 = OpPhi %int %int_0 %13 %19 %17 +%20 = OpPhi %int %12 %13 %21 %17 +OpLoopMerge %22 %17 None +OpBranch %23 +%23 = OpLabel +%24 = OpSLessThan %bool %18 %int_10 +OpBranchConditional %24 %25 %22 +%25 = OpLabel +OpBranch %26 +%26 = OpLabel +%16 = OpPhi %int %15 %25 %27 %28 +%21 = OpPhi %int %int_0 %25 %29 %28 +OpLoopMerge %30 %28 None +OpBranch %31 +%31 = OpLabel +%32 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %32 %33 %30 +%33 = OpLabel +%27 = OpISub %int %int_2 %18 +OpBranch %28 +%28 = OpLabel +%29 = OpIAdd %int %21 %int_1 +OpBranch %26 +%30 = OpLabel +OpBranch %17 +%17 = OpLabel +%19 = OpIAdd %int %18 %int_1 +OpBranch %14 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after_hoist = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_1 = OpConstant %int 1 +%12 = OpUndef %int +%main = OpFunction %void None %4 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +%15 = OpPhi %int %int_0 %13 %16 %17 +%18 = OpPhi %int %int_0 %13 %19 %17 +%20 = OpPhi %int %12 %13 %21 %17 +OpLoopMerge %22 %17 None +OpBranch %23 +%23 = OpLabel +%24 = OpSLessThan %bool %18 %int_10 +OpBranchConditional %24 %25 %22 +%25 = OpLabel +%27 = OpISub %int %int_2 %18 +OpBranch %26 +%26 = OpLabel +%16 = OpPhi %int %15 %25 %27 %28 +%21 = OpPhi %int %int_0 %25 %29 %28 +OpLoopMerge %30 %28 None +OpBranch %31 +%31 = OpLabel +%32 = OpSLessThan %bool %21 %int_10 +OpBranchConditional %32 %33 %30 +%33 = OpLabel +OpBranch %28 +%28 = OpLabel +%29 = OpIAdd %int %21 %int_1 +OpBranch %26 +%30 = OpLabel +OpBranch %17 +%17 = OpLabel +%19 = OpIAdd %int %18 %int_1 +OpBranch %14 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_hoist, after_hoist, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp new file mode 100644 index 00000000000..9e8d02fac5c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/hoist_without_preheader.cpp @@ -0,0 +1,124 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/licm_pass.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* + Tests that the LICM pass will generate a preheader when one is not present + + Generated from the following GLSL fragment shader +--eliminate-local-multi-store has also been run on the spv binary +#version 440 core +void main(){ + int a = 1; + int b = 2; + int hoist = 0; + for (int i = 0; i < 10; i++) { + if (i == 5) { + break; + } + } + for (int i = 0; i < 10; i++) { + hoist = a + b; + } +} +*/ +#ifdef SPIRV_EFFCEE +TEST_F(PassClassTest, HoistWithoutPreheader) { + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 440 +OpName %main "main" +%void = OpTypeVoid +%4 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_0 = OpConstant %int 0 +%int_10 = OpConstant %int 10 +%bool = OpTypeBool +%int_5 = OpConstant %int 5 +%main = OpFunction %void None %4 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +%15 = OpPhi %int %int_0 %13 %16 %17 +; CHECK: OpLoopMerge [[preheader:%\w+]] +OpLoopMerge %25 %17 None +OpBranch %19 +%19 = OpLabel +%20 = OpSLessThan %bool %15 %int_10 +OpBranchConditional %20 %21 %25 +%21 = OpLabel +%22 = OpIEqual %bool %15 %int_5 +OpSelectionMerge %23 None +OpBranchConditional %22 %24 %23 +%24 = OpLabel +OpBranch %25 +%23 = OpLabel +OpBranch %17 +%17 = OpLabel +%16 = OpIAdd %int %15 %int_1 +OpBranch %14 +; Check that we hoisted the code to the preheader +; CHECK: [[preheader]] = OpLabel +; CHECK-NEXT: OpPhi +; CHECK-NEXT: OpPhi +; CHECK-NEXT: OpIAdd +; CHECK-NEXT: OpBranch [[header:%\w+]] +; CHECK: [[header]] = OpLabel +; CHECK-NEXT: OpPhi +; CHECK-NEXT: OpPhi +; CHECK: OpLoopMerge +%25 = OpLabel +%26 = OpPhi %int %int_0 %24 %int_0 %19 %27 %28 +%29 = OpPhi %int %int_0 %24 %int_0 %19 %30 %28 +OpLoopMerge %31 %28 None +OpBranch %32 +%32 = OpLabel +%33 = OpSLessThan %bool %29 %int_10 +OpBranchConditional %33 %34 %31 +%34 = OpLabel +%27 = OpIAdd %int %int_1 %int_2 +OpBranch %28 +%28 = OpLabel +%30 = OpIAdd %int %29 %int_1 +OpBranch %25 +%31 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, false); +} +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/lcssa.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/lcssa.cpp new file mode 100644 index 00000000000..220772652b8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/lcssa.cpp @@ -0,0 +1,614 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt//assembly_builder.h" +#include "test/opt/function_utils.h" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +#ifdef SPIRV_EFFCEE + +bool Validate(const std::vector& bin) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {bin.data(), bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + return error == 0; +} + +void Match(const std::string& original, IRContext* context, + bool do_validation = true) { + std::vector bin; + context->module()->ToBinary(&bin, true); + if (do_validation) { + EXPECT_TRUE(Validate(bin)); + } + std::string assembly; + SpirvTools tools(SPV_ENV_UNIVERSAL_1_2); + EXPECT_TRUE( + tools.Disassemble(bin, &assembly, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)) + << "Disassembling failed for shader:\n" + << assembly << std::endl; + auto match_result = effcee::Match(assembly, original); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << assembly; +} + +using LCSSATest = ::testing::Test; + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + for (; i < 10; i++) { + } + if (i != 0) { + i = 1; + } +} +*/ +TEST_F(LCSSATest, SimpleLCSSA) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] %19 None +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi {{%\w+}} %30 %20 +; CHECK-NEXT: %27 = OpINotEqual {{%\w+}} [[phi]] %9 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %3 "c" + OpDecorate %3 Location 0 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %10 = OpConstant %7 10 + %11 = OpTypeBool + %12 = OpConstant %7 1 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Output %14 + %3 = OpVariable %15 Output + %2 = OpFunction %5 None %6 + %16 = OpLabel + OpBranch %17 + %17 = OpLabel + %30 = OpPhi %7 %9 %16 %25 %19 + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %22 = OpSLessThan %11 %30 %10 + OpBranchConditional %22 %23 %18 + %23 = OpLabel + OpBranch %19 + %19 = OpLabel + %25 = OpIAdd %7 %30 %12 + OpBranch %17 + %18 = OpLabel + %27 = OpINotEqual %11 %30 %9 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpBranch %28 + %28 = OpLabel + %31 = OpPhi %7 %30 %18 %12 %29 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + Loop* loop = ld[17]; + EXPECT_FALSE(loop->IsLCSSA()); + LoopUtils Util(context.get(), loop); + Util.MakeLoopClosedSSA(); + EXPECT_TRUE(loop->IsLCSSA()); + Match(text, context.get()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + for (; i < 10; i++) { + } + if (i != 0) { + i = 1; + } +} +*/ +// Same test as above, but should reuse an existing phi. +TEST_F(LCSSATest, PhiReuseLCSSA) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] %19 None +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi {{%\w+}} %30 %20 +; CHECK-NEXT: %27 = OpINotEqual {{%\w+}} [[phi]] %9 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %3 "c" + OpDecorate %3 Location 0 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %10 = OpConstant %7 10 + %11 = OpTypeBool + %12 = OpConstant %7 1 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Output %14 + %3 = OpVariable %15 Output + %2 = OpFunction %5 None %6 + %16 = OpLabel + OpBranch %17 + %17 = OpLabel + %30 = OpPhi %7 %9 %16 %25 %19 + OpLoopMerge %18 %19 None + OpBranch %20 + %20 = OpLabel + %22 = OpSLessThan %11 %30 %10 + OpBranchConditional %22 %23 %18 + %23 = OpLabel + OpBranch %19 + %19 = OpLabel + %25 = OpIAdd %7 %30 %12 + OpBranch %17 + %18 = OpLabel + %32 = OpPhi %7 %30 %20 + %27 = OpINotEqual %11 %30 %9 + OpSelectionMerge %28 None + OpBranchConditional %27 %29 %28 + %29 = OpLabel + OpBranch %28 + %28 = OpLabel + %31 = OpPhi %7 %30 %18 %12 %29 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + Loop* loop = ld[17]; + EXPECT_FALSE(loop->IsLCSSA()); + LoopUtils Util(context.get(), loop); + Util.MakeLoopClosedSSA(); + EXPECT_TRUE(loop->IsLCSSA()); + Match(text, context.get()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + int j = 0; + for (; i < 10; i++) {} + for (; j < 10; j++) {} + if (j != 0) { + i = 1; + } +} +*/ +TEST_F(LCSSATest, DualLoopLCSSA) { + const std::string text = R"( +; CHECK: %20 = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi %6 %17 %21 +; CHECK: %33 = OpLabel +; CHECK-NEXT: {{%\w+}} = OpPhi {{%\w+}} [[phi]] %28 %11 %34 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %3 "c" + OpDecorate %3 Location 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpConstant %6 0 + %9 = OpConstant %6 10 + %10 = OpTypeBool + %11 = OpConstant %6 1 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %3 = OpVariable %14 Output + %2 = OpFunction %4 None %5 + %15 = OpLabel + OpBranch %16 + %16 = OpLabel + %17 = OpPhi %6 %8 %15 %18 %19 + OpLoopMerge %20 %19 None + OpBranch %21 + %21 = OpLabel + %22 = OpSLessThan %10 %17 %9 + OpBranchConditional %22 %23 %20 + %23 = OpLabel + OpBranch %19 + %19 = OpLabel + %18 = OpIAdd %6 %17 %11 + OpBranch %16 + %20 = OpLabel + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %6 %8 %20 %26 %27 + OpLoopMerge %28 %27 None + OpBranch %29 + %29 = OpLabel + %30 = OpSLessThan %10 %25 %9 + OpBranchConditional %30 %31 %28 + %31 = OpLabel + OpBranch %27 + %27 = OpLabel + %26 = OpIAdd %6 %25 %11 + OpBranch %24 + %28 = OpLabel + %32 = OpINotEqual %10 %25 %8 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %33 + %34 = OpLabel + OpBranch %33 + %33 = OpLabel + %35 = OpPhi %6 %17 %28 %11 %34 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + Loop* loop = ld[16]; + EXPECT_FALSE(loop->IsLCSSA()); + LoopUtils Util(context.get(), loop); + Util.MakeLoopClosedSSA(); + EXPECT_TRUE(loop->IsLCSSA()); + Match(text, context.get()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + if (i != 0) { + for (; i < 10; i++) {} + } + if (i != 0) { + i = 1; + } +} +*/ +TEST_F(LCSSATest, PhiUserLCSSA) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] %22 None +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi {{%\w+}} %20 %24 +; CHECK: %17 = OpLabel +; CHECK-NEXT: {{%\w+}} = OpPhi {{%\w+}} %8 %15 [[phi]] %23 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %3 "c" + OpDecorate %3 Location 0 + %4 = OpTypeVoid + %5 = OpTypeFunction %4 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %8 = OpConstant %6 0 + %9 = OpTypeBool + %10 = OpConstant %6 10 + %11 = OpConstant %6 1 + %12 = OpTypeFloat 32 + %13 = OpTypeVector %12 4 + %14 = OpTypePointer Output %13 + %3 = OpVariable %14 Output + %2 = OpFunction %4 None %5 + %15 = OpLabel + %16 = OpINotEqual %9 %8 %8 + OpSelectionMerge %17 None + OpBranchConditional %16 %18 %17 + %18 = OpLabel + OpBranch %19 + %19 = OpLabel + %20 = OpPhi %6 %8 %18 %21 %22 + OpLoopMerge %23 %22 None + OpBranch %24 + %24 = OpLabel + %25 = OpSLessThan %9 %20 %10 + OpBranchConditional %25 %26 %23 + %26 = OpLabel + OpBranch %22 + %22 = OpLabel + %21 = OpIAdd %6 %20 %11 + OpBranch %19 + %23 = OpLabel + OpBranch %17 + %17 = OpLabel + %27 = OpPhi %6 %8 %15 %20 %23 + %28 = OpINotEqual %9 %27 %8 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + OpBranch %29 + %29 = OpLabel + %31 = OpPhi %6 %27 %17 %11 %30 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + Loop* loop = ld[19]; + EXPECT_FALSE(loop->IsLCSSA()); + LoopUtils Util(context.get(), loop); + Util.MakeLoopClosedSSA(); + EXPECT_TRUE(loop->IsLCSSA()); + Match(text, context.get()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +void main() { + int i = 0; + if (i != 0) { + for (; i < 10; i++) { + if (i > 5) break; + } + } + if (i != 0) { + i = 1; + } +} +*/ +TEST_F(LCSSATest, LCSSAWithBreak) { + const std::string text = R"( +; CHECK: OpLoopMerge [[merge:%\w+]] %19 None +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi {{%\w+}} %17 %21 %17 %26 +; CHECK: %14 = OpLabel +; CHECK-NEXT: {{%\w+}} = OpPhi {{%\w+}} %7 %12 [[phi]] [[merge]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeInt 32 1 + %6 = OpTypePointer Function %5 + %7 = OpConstant %5 0 + %8 = OpTypeBool + %9 = OpConstant %5 10 + %10 = OpConstant %5 5 + %11 = OpConstant %5 1 + %2 = OpFunction %3 None %4 + %12 = OpLabel + %13 = OpINotEqual %8 %7 %7 + OpSelectionMerge %14 None + OpBranchConditional %13 %15 %14 + %15 = OpLabel + OpBranch %16 + %16 = OpLabel + %17 = OpPhi %5 %7 %15 %18 %19 + OpLoopMerge %20 %19 None + OpBranch %21 + %21 = OpLabel + %22 = OpSLessThan %8 %17 %9 + OpBranchConditional %22 %23 %20 + %23 = OpLabel + %24 = OpSGreaterThan %8 %17 %10 + OpSelectionMerge %25 None + OpBranchConditional %24 %26 %25 + %26 = OpLabel + OpBranch %20 + %25 = OpLabel + OpBranch %19 + %19 = OpLabel + %18 = OpIAdd %5 %17 %11 + OpBranch %16 + %20 = OpLabel + OpBranch %14 + %14 = OpLabel + %27 = OpPhi %5 %7 %12 %17 %20 + %28 = OpINotEqual %8 %27 %7 + OpSelectionMerge %29 None + OpBranchConditional %28 %30 %29 + %30 = OpLabel + OpBranch %29 + %29 = OpLabel + %31 = OpPhi %5 %27 %14 %11 %30 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + Loop* loop = ld[19]; + EXPECT_FALSE(loop->IsLCSSA()); + LoopUtils Util(context.get(), loop); + Util.MakeLoopClosedSSA(); + EXPECT_TRUE(loop->IsLCSSA()); + Match(text, context.get()); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +void main() { + int i = 0; + for (; i < 10; i++) {} + for (int j = i; j < 10;) { j = i + j; } +} +*/ +TEST_F(LCSSATest, LCSSAUseInNonEligiblePhi) { + const std::string text = R"( +; CHECK: %12 = OpLabel +; CHECK-NEXT: [[def_to_close:%\w+]] = OpPhi {{%\w+}} {{%\w+}} {{%\w+}} {{%\w+}} [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: [[closing_phi:%\w+]] = OpPhi {{%\w+}} [[def_to_close]] %17 +; CHECK: %16 = OpLabel +; CHECK-NEXT: [[use_in_phi:%\w+]] = OpPhi {{%\w+}} %21 %22 [[closing_phi]] [[merge]] +; CHECK: OpIAdd {{%\w+}} [[closing_phi]] [[use_in_phi]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeInt 32 1 + %6 = OpTypePointer Function %5 + %7 = OpConstant %5 0 + %8 = OpConstant %5 10 + %9 = OpTypeBool + %10 = OpConstant %5 1 + %2 = OpFunction %3 None %4 + %11 = OpLabel + OpBranch %12 + %12 = OpLabel + %13 = OpPhi %5 %7 %11 %14 %15 + OpLoopMerge %16 %15 None + OpBranch %17 + %17 = OpLabel + %18 = OpSLessThan %9 %13 %8 + OpBranchConditional %18 %19 %16 + %19 = OpLabel + OpBranch %15 + %15 = OpLabel + %14 = OpIAdd %5 %13 %10 + OpBranch %12 + %16 = OpLabel + %20 = OpPhi %5 %13 %17 %21 %22 + OpLoopMerge %23 %22 None + OpBranch %24 + %24 = OpLabel + %25 = OpSLessThan %9 %20 %8 + OpBranchConditional %25 %26 %23 + %26 = OpLabel + %21 = OpIAdd %5 %13 %20 + OpBranch %22 + %22 = OpLabel + OpBranch %16 + %23 = OpLabel + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + Loop* loop = ld[12]; + EXPECT_FALSE(loop->IsLCSSA()); + LoopUtils Util(context.get(), loop); + Util.MakeLoopClosedSSA(); + EXPECT_TRUE(loop->IsLCSSA()); + Match(text, context.get()); +} + +#endif // SPIRV_EFFCEE + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp new file mode 100644 index 00000000000..91dbdc6b548 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/loop_descriptions.cpp @@ -0,0 +1,384 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + for(; i < 10; ++i) { + } +} +*/ +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %5 "i" + OpName %3 "c" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpConstant %8 1 + %14 = OpTypeFloat 32 + %15 = OpTypeVector %14 4 + %16 = OpTypePointer Output %15 + %3 = OpVariable %16 Output + %2 = OpFunction %6 None %7 + %17 = OpLabel + %5 = OpVariable %9 Function + OpStore %5 %10 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %19 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %8 %5 + %23 = OpSLessThan %12 %22 %11 + OpBranchConditional %23 %24 %19 + %24 = OpLabel + OpBranch %20 + %20 = OpLabel + %25 = OpLoad %8 %5 + %26 = OpIAdd %8 %25 %13 + OpStore %5 %26 + OpBranch %18 + %19 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + Loop& loop = ld.GetLoopByIndex(0); + EXPECT_EQ(loop.GetHeaderBlock(), spvtest::GetBasicBlock(f, 18)); + EXPECT_EQ(loop.GetLatchBlock(), spvtest::GetBasicBlock(f, 20)); + EXPECT_EQ(loop.GetMergeBlock(), spvtest::GetBasicBlock(f, 19)); + + EXPECT_FALSE(loop.HasNestedLoops()); + EXPECT_FALSE(loop.IsNested()); + EXPECT_EQ(loop.GetDepth(), 1u); +} + +/* +Generated from the following GLSL: +#version 330 core +layout(location = 0) out vec4 c; +void main() { + for(int i = 0; i < 10; ++i) {} + for(int i = 0; i < 10; ++i) {} +} + +But it was "hacked" to make the first loop merge block the second loop header. +*/ +TEST_F(PassClassTest, LoopWithNoPreHeader) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + OpName %5 "i" + OpName %3 "c" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpConstant %8 1 + %14 = OpTypeFloat 32 + %15 = OpTypeVector %14 4 + %16 = OpTypePointer Output %15 + %3 = OpVariable %16 Output + %2 = OpFunction %6 None %7 + %17 = OpLabel + %4 = OpVariable %9 Function + %5 = OpVariable %9 Function + OpStore %4 %10 + OpStore %5 %10 + OpBranch %18 + %18 = OpLabel + OpLoopMerge %27 %20 None + OpBranch %21 + %21 = OpLabel + %22 = OpLoad %8 %4 + %23 = OpSLessThan %12 %22 %11 + OpBranchConditional %23 %24 %27 + %24 = OpLabel + OpBranch %20 + %20 = OpLabel + %25 = OpLoad %8 %4 + %26 = OpIAdd %8 %25 %13 + OpStore %4 %26 + OpBranch %18 + %27 = OpLabel + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %31 = OpLoad %8 %5 + %32 = OpSLessThan %12 %31 %11 + OpBranchConditional %32 %33 %28 + %33 = OpLabel + OpBranch %29 + %29 = OpLabel + %34 = OpLoad %8 %5 + %35 = OpIAdd %8 %34 %13 + OpStore %5 %35 + OpBranch %27 + %28 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + EXPECT_EQ(ld.NumLoops(), 2u); + + Loop* loop = ld[27]; + EXPECT_EQ(loop->GetPreHeaderBlock(), nullptr); + EXPECT_NE(loop->GetOrCreatePreHeaderBlock(), nullptr); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +in vec4 c; +void main() { + int i = 0; + bool cond = c[0] == 0; + for (; i < 10; i++) { + if (cond) { + return; + } + else { + return; + } + } + bool cond2 = i == 9; +} +*/ +TEST_F(PassClassTest, NoLoop) { + const std::string text = R"(; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 3 +; Bound: 47 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %16 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 330 + OpName %4 "main" + OpName %16 "c" + OpDecorate %16 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %10 = OpTypeBool + %11 = OpTypePointer Function %10 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Input %14 + %16 = OpVariable %15 Input + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 0 + %19 = OpTypePointer Input %13 + %22 = OpConstant %13 0 + %30 = OpConstant %6 10 + %39 = OpConstant %6 1 + %46 = OpUndef %6 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %20 = OpAccessChain %19 %16 %18 + %21 = OpLoad %13 %20 + %23 = OpFOrdEqual %10 %21 %22 + OpBranch %24 + %24 = OpLabel + %45 = OpPhi %6 %9 %5 %40 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpSLessThan %10 %45 %30 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %23 %33 %36 + %33 = OpLabel + OpReturn + %36 = OpLabel + OpReturn + %34 = OpLabel + OpBranch %27 + %27 = OpLabel + %40 = OpIAdd %6 %46 %39 + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor ld{context.get(), f}; + + EXPECT_EQ(ld.NumLoops(), 0u); +} + +/* +Generated from following GLSL with latch block artificially inserted to be +seperate from continue. +#version 430 +void main(void) { + float x[10]; + for (int i = 0; i < 10; ++i) { + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, LoopLatchNotContinue) { + const std::string text = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "x" + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %10 = OpConstant %7 10 + %11 = OpTypeBool + %12 = OpTypeFloat 32 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %12 %14 + %16 = OpTypePointer Function %15 + %17 = OpTypePointer Function %12 + %18 = OpConstant %7 1 + %2 = OpFunction %5 None %6 + %19 = OpLabel + %3 = OpVariable %8 Function + %4 = OpVariable %16 Function + OpStore %3 %9 + OpBranch %20 + %20 = OpLabel + %21 = OpPhi %7 %9 %19 %22 %30 + OpLoopMerge %24 %23 None + OpBranch %25 + %25 = OpLabel + %26 = OpSLessThan %11 %21 %10 + OpBranchConditional %26 %27 %24 + %27 = OpLabel + %28 = OpConvertSToF %12 %21 + %29 = OpAccessChain %17 %4 %21 + OpStore %29 %28 + OpBranch %23 + %23 = OpLabel + %22 = OpIAdd %7 %21 %18 + OpStore %3 %22 + OpBranch %30 + %30 = OpLabel + OpBranch %20 + %24 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + EXPECT_EQ(ld.NumLoops(), 1u); + + Loop& loop = ld.GetLoopByIndex(0u); + + EXPECT_NE(loop.GetLatchBlock(), loop.GetContinueBlock()); + + EXPECT_EQ(loop.GetContinueBlock()->id(), 23u); + EXPECT_EQ(loop.GetLatchBlock()->id(), 30u); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp new file mode 100644 index 00000000000..e513f4253a0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/loop_fission.cpp @@ -0,0 +1,3491 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/loop_fission.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using FissionClassTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL + +#version 430 + +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + A[i] = B[i]; + B[i] = A[i]; + } +} + +Result should be equivalent to: + +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + A[i] = B[i]; + } + + for (int i = 0; i < 10; i++) { + B[i] = A[i]; + } +} +*/ +TEST_F(FissionClassTest, SimpleFission) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "A" +OpName %5 "B" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %20 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%29 = OpAccessChain %18 %5 %22 +%30 = OpLoad %13 %29 +%31 = OpAccessChain %18 %4 %22 +OpStore %31 %30 +%32 = OpAccessChain %18 %4 %22 +%33 = OpLoad %13 %32 +%34 = OpAccessChain %18 %5 %22 +OpStore %34 %33 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + +const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "A" +OpName %5 "B" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpBranch %35 +%35 = OpLabel +%36 = OpPhi %8 %10 %20 %47 %46 +OpLoopMerge %48 %46 None +OpBranch %37 +%37 = OpLabel +%38 = OpSLessThan %12 %36 %11 +OpBranchConditional %38 %39 %48 +%39 = OpLabel +%40 = OpAccessChain %18 %5 %36 +%41 = OpLoad %13 %40 +%42 = OpAccessChain %18 %4 %36 +OpStore %42 %41 +OpBranch %46 +%46 = OpLabel +%47 = OpIAdd %8 %36 %19 +OpBranch %35 +%48 = OpLabel +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %48 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%32 = OpAccessChain %18 %4 %22 +%33 = OpLoad %13 %32 +%34 = OpAccessChain %18 %5 %22 +OpStore %34 %33 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); + + // Check that the loop will NOT be split when provided with a pass-through + // register pressure functor which just returns false. + SinglePassRunAndCheck( + source, source, true, + [](const RegisterLiveness::RegionRegisterLiveness&) { return false; }); +} + +/* +Generated from the following GLSL + +#version 430 + +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + A[i] = B[i]; + B[i] = A[i+1]; + } +} + +This loop should not be split, as the i+1 dependence would be broken by +splitting the loop. +*/ + +TEST_F(FissionClassTest, FissionInterdependency) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "A" +OpName %5 "B" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %20 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%29 = OpAccessChain %18 %5 %22 +%30 = OpLoad %13 %29 +%31 = OpAccessChain %18 %4 %22 +OpStore %31 %30 +%32 = OpIAdd %8 %22 %19 +%33 = OpAccessChain %18 %4 %32 +%34 = OpLoad %13 %33 +%35 = OpAccessChain %18 %5 %22 +OpStore %35 %34 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +Generated from the following GLSL + +#version 430 + +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + A[i] = B[i]; + B[i+1] = A[i]; + } +} + + +This should not be split as the load B[i] is dependent on the store B[i+1] +*/ +TEST_F(FissionClassTest, FissionInterdependency2) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "A" +OpName %5 "B" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %20 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%29 = OpAccessChain %18 %5 %22 +%30 = OpLoad %13 %29 +%31 = OpAccessChain %18 %4 %22 +OpStore %31 %30 +%32 = OpIAdd %8 %22 %19 +%33 = OpAccessChain %18 %4 %22 +%34 = OpLoad %13 %33 +%35 = OpAccessChain %18 %5 %32 +OpStore %35 %34 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +void main(void) { + float A[10]; + float B[10]; + float C[10] + float D[10] + for (int i = 0; i < 10; i++) { + A[i] = B[i]; + B[i] = A[i]; + C[i] = D[i]; + D[i] = C[i]; + } +} + +This should be split into the equivalent of: + + for (int i = 0; i < 10; i++) { + A[i] = B[i]; + B[i] = A[i]; + } + for (int i = 0; i < 10; i++) { + C[i] = D[i]; + D[i] = C[i]; + } + +We then check that the loop is broken into four for loops like so, if the pass +is run twice: + for (int i = 0; i < 10; i++) + A[i] = B[i]; + for (int i = 0; i < 10; i++) + B[i] = A[i]; + for (int i = 0; i < 10; i++) + C[i] = D[i]; + for (int i = 0; i < 10; i++) + D[i] = C[i]; + +*/ + +TEST_F(FissionClassTest, FissionMultipleLoadStores) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "A" + OpName %5 "B" + OpName %6 "C" + OpName %7 "D" + %8 = OpTypeVoid + %9 = OpTypeFunction %8 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %12 = OpConstant %10 0 + %13 = OpConstant %10 10 + %14 = OpTypeBool + %15 = OpTypeFloat 32 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 10 + %18 = OpTypeArray %15 %17 + %19 = OpTypePointer Function %18 + %20 = OpTypePointer Function %15 + %21 = OpConstant %10 1 + %2 = OpFunction %8 None %9 + %22 = OpLabel + %3 = OpVariable %11 Function + %4 = OpVariable %19 Function + %5 = OpVariable %19 Function + %6 = OpVariable %19 Function + %7 = OpVariable %19 Function + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %10 %12 %22 %25 %26 + OpLoopMerge %27 %26 None + OpBranch %28 + %28 = OpLabel + %29 = OpSLessThan %14 %24 %13 + OpBranchConditional %29 %30 %27 + %30 = OpLabel + %31 = OpAccessChain %20 %5 %24 + %32 = OpLoad %15 %31 + %33 = OpAccessChain %20 %4 %24 + OpStore %33 %32 + %34 = OpAccessChain %20 %4 %24 + %35 = OpLoad %15 %34 + %36 = OpAccessChain %20 %5 %24 + OpStore %36 %35 + %37 = OpAccessChain %20 %7 %24 + %38 = OpLoad %15 %37 + %39 = OpAccessChain %20 %6 %24 + OpStore %39 %38 + %40 = OpAccessChain %20 %6 %24 + %41 = OpLoad %15 %40 + %42 = OpAccessChain %20 %7 %24 + OpStore %42 %41 + OpBranch %26 + %26 = OpLabel + %25 = OpIAdd %10 %24 %21 + OpBranch %23 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "A" +OpName %5 "B" +OpName %6 "C" +OpName %7 "D" +%8 = OpTypeVoid +%9 = OpTypeFunction %8 +%10 = OpTypeInt 32 1 +%11 = OpTypePointer Function %10 +%12 = OpConstant %10 0 +%13 = OpConstant %10 10 +%14 = OpTypeBool +%15 = OpTypeFloat 32 +%16 = OpTypeInt 32 0 +%17 = OpConstant %16 10 +%18 = OpTypeArray %15 %17 +%19 = OpTypePointer Function %18 +%20 = OpTypePointer Function %15 +%21 = OpConstant %10 1 +%2 = OpFunction %8 None %9 +%22 = OpLabel +%3 = OpVariable %11 Function +%4 = OpVariable %19 Function +%5 = OpVariable %19 Function +%6 = OpVariable %19 Function +%7 = OpVariable %19 Function +OpBranch %43 +%43 = OpLabel +%44 = OpPhi %10 %12 %22 %61 %60 +OpLoopMerge %62 %60 None +OpBranch %45 +%45 = OpLabel +%46 = OpSLessThan %14 %44 %13 +OpBranchConditional %46 %47 %62 +%47 = OpLabel +%48 = OpAccessChain %20 %5 %44 +%49 = OpLoad %15 %48 +%50 = OpAccessChain %20 %4 %44 +OpStore %50 %49 +%51 = OpAccessChain %20 %4 %44 +%52 = OpLoad %15 %51 +%53 = OpAccessChain %20 %5 %44 +OpStore %53 %52 +OpBranch %60 +%60 = OpLabel +%61 = OpIAdd %10 %44 %21 +OpBranch %43 +%62 = OpLabel +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %10 %12 %62 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %14 %24 %13 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +%37 = OpAccessChain %20 %7 %24 +%38 = OpLoad %15 %37 +%39 = OpAccessChain %20 %6 %24 +OpStore %39 %38 +%40 = OpAccessChain %20 %6 %24 +%41 = OpLoad %15 %40 +%42 = OpAccessChain %20 %7 %24 +OpStore %42 %41 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %10 %24 %21 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + +const std::string expected_multiple_passes = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "A" +OpName %5 "B" +OpName %6 "C" +OpName %7 "D" +%8 = OpTypeVoid +%9 = OpTypeFunction %8 +%10 = OpTypeInt 32 1 +%11 = OpTypePointer Function %10 +%12 = OpConstant %10 0 +%13 = OpConstant %10 10 +%14 = OpTypeBool +%15 = OpTypeFloat 32 +%16 = OpTypeInt 32 0 +%17 = OpConstant %16 10 +%18 = OpTypeArray %15 %17 +%19 = OpTypePointer Function %18 +%20 = OpTypePointer Function %15 +%21 = OpConstant %10 1 +%2 = OpFunction %8 None %9 +%22 = OpLabel +%3 = OpVariable %11 Function +%4 = OpVariable %19 Function +%5 = OpVariable %19 Function +%6 = OpVariable %19 Function +%7 = OpVariable %19 Function +OpBranch %63 +%63 = OpLabel +%64 = OpPhi %10 %12 %22 %75 %74 +OpLoopMerge %76 %74 None +OpBranch %65 +%65 = OpLabel +%66 = OpSLessThan %14 %64 %13 +OpBranchConditional %66 %67 %76 +%67 = OpLabel +%68 = OpAccessChain %20 %5 %64 +%69 = OpLoad %15 %68 +%70 = OpAccessChain %20 %4 %64 +OpStore %70 %69 +OpBranch %74 +%74 = OpLabel +%75 = OpIAdd %10 %64 %21 +OpBranch %63 +%76 = OpLabel +OpBranch %43 +%43 = OpLabel +%44 = OpPhi %10 %12 %76 %61 %60 +OpLoopMerge %62 %60 None +OpBranch %45 +%45 = OpLabel +%46 = OpSLessThan %14 %44 %13 +OpBranchConditional %46 %47 %62 +%47 = OpLabel +%51 = OpAccessChain %20 %4 %44 +%52 = OpLoad %15 %51 +%53 = OpAccessChain %20 %5 %44 +OpStore %53 %52 +OpBranch %60 +%60 = OpLabel +%61 = OpIAdd %10 %44 %21 +OpBranch %43 +%62 = OpLabel +OpBranch %77 +%77 = OpLabel +%78 = OpPhi %10 %12 %62 %89 %88 +OpLoopMerge %90 %88 None +OpBranch %79 +%79 = OpLabel +%80 = OpSLessThan %14 %78 %13 +OpBranchConditional %80 %81 %90 +%81 = OpLabel +%82 = OpAccessChain %20 %7 %78 +%83 = OpLoad %15 %82 +%84 = OpAccessChain %20 %6 %78 +OpStore %84 %83 +OpBranch %88 +%88 = OpLabel +%89 = OpIAdd %10 %78 %21 +OpBranch %77 +%90 = OpLabel +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %10 %12 %90 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %14 %24 %13 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +%40 = OpAccessChain %20 %6 %24 +%41 = OpLoad %15 %40 +%42 = OpAccessChain %20 %7 %24 +OpStore %42 %41 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %10 %24 %21 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on +std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); +Module* module = context->module(); +EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + +SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); +SinglePassRunAndCheck(source, expected, true); + +// By passing 1 as argument we are using the constructor which makes the +// critera to split the loop be if the registers in the loop exceede 1. By +// using this constructor we are also enabling multiple passes (disabled by +// default). +SinglePassRunAndCheck(source, expected_multiple_passes, true, + 1); +} + +/* +#version 430 +void main(void) { + int accumulator = 0; + float X[10]; + float Y[10]; + + for (int i = 0; i < 10; i++) { + X[i] = Y[i]; + Y[i] = X[i]; + accumulator += i; + } +} + +This should be split into the equivalent of: + +#version 430 +void main(void) { + int accumulator = 0; + float X[10]; + float Y[10]; + + for (int i = 0; i < 10; i++) { + X[i] = Y[i]; + } + for (int i = 0; i < 10; i++) { + Y[i] = X[i]; + accumulator += i; + } +} +*/ +TEST_F(FissionClassTest, FissionWithAccumulator) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "accumulator" + OpName %4 "i" + OpName %5 "X" + OpName %6 "Y" + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeInt 32 1 + %10 = OpTypePointer Function %9 + %11 = OpConstant %9 0 + %12 = OpConstant %9 10 + %13 = OpTypeBool + %14 = OpTypeFloat 32 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 10 + %17 = OpTypeArray %14 %16 + %18 = OpTypePointer Function %17 + %19 = OpTypePointer Function %14 + %20 = OpConstant %9 1 + %2 = OpFunction %7 None %8 + %21 = OpLabel + %3 = OpVariable %10 Function + %4 = OpVariable %10 Function + %5 = OpVariable %18 Function + %6 = OpVariable %18 Function + OpBranch %22 + %22 = OpLabel + %23 = OpPhi %9 %11 %21 %24 %25 + %26 = OpPhi %9 %11 %21 %27 %25 + OpLoopMerge %28 %25 None + OpBranch %29 + %29 = OpLabel + %30 = OpSLessThan %13 %26 %12 + OpBranchConditional %30 %31 %28 + %31 = OpLabel + %32 = OpAccessChain %19 %6 %26 + %33 = OpLoad %14 %32 + %34 = OpAccessChain %19 %5 %26 + OpStore %34 %33 + %35 = OpAccessChain %19 %5 %26 + %36 = OpLoad %14 %35 + %37 = OpAccessChain %19 %6 %26 + OpStore %37 %36 + %24 = OpIAdd %9 %23 %26 + OpBranch %25 + %25 = OpLabel + %27 = OpIAdd %9 %26 %20 + OpBranch %22 + %28 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "accumulator" +OpName %4 "i" +OpName %5 "X" +OpName %6 "Y" +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypePointer Function %17 +%19 = OpTypePointer Function %14 +%20 = OpConstant %9 1 +%2 = OpFunction %7 None %8 +%21 = OpLabel +%3 = OpVariable %10 Function +%4 = OpVariable %10 Function +%5 = OpVariable %18 Function +%6 = OpVariable %18 Function +OpBranch %38 +%38 = OpLabel +%40 = OpPhi %9 %11 %21 %52 %51 +OpLoopMerge %53 %51 None +OpBranch %41 +%41 = OpLabel +%42 = OpSLessThan %13 %40 %12 +OpBranchConditional %42 %43 %53 +%43 = OpLabel +%44 = OpAccessChain %19 %6 %40 +%45 = OpLoad %14 %44 +%46 = OpAccessChain %19 %5 %40 +OpStore %46 %45 +OpBranch %51 +%51 = OpLabel +%52 = OpIAdd %9 %40 %20 +OpBranch %38 +%53 = OpLabel +OpBranch %22 +%22 = OpLabel +%23 = OpPhi %9 %11 %53 %24 %25 +%26 = OpPhi %9 %11 %53 %27 %25 +OpLoopMerge %28 %25 None +OpBranch %29 +%29 = OpLabel +%30 = OpSLessThan %13 %26 %12 +OpBranchConditional %30 %31 %28 +%31 = OpLabel +%35 = OpAccessChain %19 %5 %26 +%36 = OpLoad %14 %35 +%37 = OpAccessChain %19 %6 %26 +OpStore %37 %36 +%24 = OpIAdd %9 %23 %26 +OpBranch %25 +%25 = OpLabel +%27 = OpIAdd %9 %26 %20 +OpBranch %22 +%28 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +/* +Generated from the following glsl: + +#version 430 +layout(location=0) out float x; +layout(location=1) out float y; + +void main(void) { + float accumulator_1 = 0; + float accumulator_2 = 0; + for (int i = 0; i < 10; i++) { + accumulator_1 += i; + accumulator_2 += i; + } + + x = accumulator_1; + y = accumulator_2; +} + +Should be split into equivalent of: + +void main(void) { + float accumulator_1 = 0; + float accumulator_2 = 0; + for (int i = 0; i < 10; i++) { + accumulator_1 += i; + } + + for (int i = 0; i < 10; i++) { + accumulator_2 += i; + } + x = accumulator_1; + y = accumulator_2; +} + +*/ +TEST_F(FissionClassTest, FissionWithPhisUsedOutwithLoop) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %5 "accumulator_1" + OpName %6 "accumulator_2" + OpName %7 "i" + OpName %3 "x" + OpName %4 "y" + OpDecorate %3 Location 0 + OpDecorate %4 Location 1 + %8 = OpTypeVoid + %9 = OpTypeFunction %8 + %10 = OpTypeFloat 32 + %11 = OpTypePointer Function %10 + %12 = OpConstant %10 0 + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Function %13 + %15 = OpConstant %13 0 + %16 = OpConstant %13 10 + %17 = OpTypeBool + %18 = OpConstant %13 1 + %19 = OpTypePointer Output %10 + %3 = OpVariable %19 Output + %4 = OpVariable %19 Output + %2 = OpFunction %8 None %9 + %20 = OpLabel + %5 = OpVariable %11 Function + %6 = OpVariable %11 Function + %7 = OpVariable %14 Function + OpBranch %21 + %21 = OpLabel + %22 = OpPhi %10 %12 %20 %23 %24 + %25 = OpPhi %10 %12 %20 %26 %24 + %27 = OpPhi %13 %15 %20 %28 %24 + OpLoopMerge %29 %24 None + OpBranch %30 + %30 = OpLabel + %31 = OpSLessThan %17 %27 %16 + OpBranchConditional %31 %32 %29 + %32 = OpLabel + %33 = OpConvertSToF %10 %27 + %26 = OpFAdd %10 %25 %33 + %34 = OpConvertSToF %10 %27 + %23 = OpFAdd %10 %22 %34 + OpBranch %24 + %24 = OpLabel + %28 = OpIAdd %13 %27 %18 + OpStore %7 %28 + OpBranch %21 + %29 = OpLabel + OpStore %3 %25 + OpStore %4 %22 + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 %4 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %5 "accumulator_1" +OpName %6 "accumulator_2" +OpName %7 "i" +OpName %3 "x" +OpName %4 "y" +OpDecorate %3 Location 0 +OpDecorate %4 Location 1 +%8 = OpTypeVoid +%9 = OpTypeFunction %8 +%10 = OpTypeFloat 32 +%11 = OpTypePointer Function %10 +%12 = OpConstant %10 0 +%13 = OpTypeInt 32 1 +%14 = OpTypePointer Function %13 +%15 = OpConstant %13 0 +%16 = OpConstant %13 10 +%17 = OpTypeBool +%18 = OpConstant %13 1 +%19 = OpTypePointer Output %10 +%3 = OpVariable %19 Output +%4 = OpVariable %19 Output +%2 = OpFunction %8 None %9 +%20 = OpLabel +%5 = OpVariable %11 Function +%6 = OpVariable %11 Function +%7 = OpVariable %14 Function +OpBranch %35 +%35 = OpLabel +%37 = OpPhi %10 %12 %20 %43 %46 +%38 = OpPhi %13 %15 %20 %47 %46 +OpLoopMerge %48 %46 None +OpBranch %39 +%39 = OpLabel +%40 = OpSLessThan %17 %38 %16 +OpBranchConditional %40 %41 %48 +%41 = OpLabel +%42 = OpConvertSToF %10 %38 +%43 = OpFAdd %10 %37 %42 +OpBranch %46 +%46 = OpLabel +%47 = OpIAdd %13 %38 %18 +OpStore %7 %47 +OpBranch %35 +%48 = OpLabel +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %10 %12 %48 %23 %24 +%27 = OpPhi %13 %15 %48 %28 %24 +OpLoopMerge %29 %24 None +OpBranch %30 +%30 = OpLabel +%31 = OpSLessThan %17 %27 %16 +OpBranchConditional %31 %32 %29 +%32 = OpLabel +%34 = OpConvertSToF %10 %27 +%23 = OpFAdd %10 %22 %34 +OpBranch %24 +%24 = OpLabel +%28 = OpIAdd %13 %27 %18 +OpStore %7 %28 +OpBranch %21 +%29 = OpLabel +OpStore %3 %37 +OpStore %4 %22 +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +/* +#version 430 +void main(void) { + float A[10][10]; + float B[10][10]; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + A[i][j] = B[i][j]; + B[i][j] = A[i][j]; + } + } +} + +Should be split into equivalent of: + +#version 430 +void main(void) { + float A[10][10]; + float B[10][10]; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + A[i][j] = B[i][j]; + } + for (int j = 0; j < 10; j++) { + B[i][j] = A[i][j]; + } + } +} + + +*/ +TEST_F(FissionClassTest, FissionNested) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "j" + OpName %5 "A" + OpName %6 "B" + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeInt 32 1 + %10 = OpTypePointer Function %9 + %11 = OpConstant %9 0 + %12 = OpConstant %9 10 + %13 = OpTypeBool + %14 = OpTypeFloat 32 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 10 + %17 = OpTypeArray %14 %16 + %18 = OpTypeArray %17 %16 + %19 = OpTypePointer Function %18 + %20 = OpTypePointer Function %14 + %21 = OpConstant %9 1 + %2 = OpFunction %7 None %8 + %22 = OpLabel + %3 = OpVariable %10 Function + %4 = OpVariable %10 Function + %5 = OpVariable %19 Function + %6 = OpVariable %19 Function + OpStore %3 %11 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %9 %11 %22 %25 %26 + OpLoopMerge %27 %26 None + OpBranch %28 + %28 = OpLabel + %29 = OpSLessThan %13 %24 %12 + OpBranchConditional %29 %30 %27 + %30 = OpLabel + OpStore %4 %11 + OpBranch %31 + %31 = OpLabel + %32 = OpPhi %9 %11 %30 %33 %34 + OpLoopMerge %35 %34 None + OpBranch %36 + %36 = OpLabel + %37 = OpSLessThan %13 %32 %12 + OpBranchConditional %37 %38 %35 + %38 = OpLabel + %39 = OpAccessChain %20 %6 %24 %32 + %40 = OpLoad %14 %39 + %41 = OpAccessChain %20 %5 %24 %32 + OpStore %41 %40 + %42 = OpAccessChain %20 %5 %24 %32 + %43 = OpLoad %14 %42 + %44 = OpAccessChain %20 %6 %24 %32 + OpStore %44 %43 + OpBranch %34 + %34 = OpLabel + %33 = OpIAdd %9 %32 %21 + OpStore %4 %33 + OpBranch %31 + %35 = OpLabel + OpBranch %26 + %26 = OpLabel + %25 = OpIAdd %9 %24 %21 + OpStore %3 %25 + OpBranch %23 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "j" +OpName %5 "A" +OpName %6 "B" +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypeArray %17 %16 +%19 = OpTypePointer Function %18 +%20 = OpTypePointer Function %14 +%21 = OpConstant %9 1 +%2 = OpFunction %7 None %8 +%22 = OpLabel +%3 = OpVariable %10 Function +%4 = OpVariable %10 Function +%5 = OpVariable %19 Function +%6 = OpVariable %19 Function +OpStore %3 %11 +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %9 %11 %22 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %13 %24 %12 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +OpStore %4 %11 +OpBranch %45 +%45 = OpLabel +%46 = OpPhi %9 %11 %30 %57 %56 +OpLoopMerge %58 %56 None +OpBranch %47 +%47 = OpLabel +%48 = OpSLessThan %13 %46 %12 +OpBranchConditional %48 %49 %58 +%49 = OpLabel +%50 = OpAccessChain %20 %6 %24 %46 +%51 = OpLoad %14 %50 +%52 = OpAccessChain %20 %5 %24 %46 +OpStore %52 %51 +OpBranch %56 +%56 = OpLabel +%57 = OpIAdd %9 %46 %21 +OpStore %4 %57 +OpBranch %45 +%58 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpPhi %9 %11 %58 %33 %34 +OpLoopMerge %35 %34 None +OpBranch %36 +%36 = OpLabel +%37 = OpSLessThan %13 %32 %12 +OpBranchConditional %37 %38 %35 +%38 = OpLabel +%42 = OpAccessChain %20 %5 %24 %32 +%43 = OpLoad %14 %42 +%44 = OpAccessChain %20 %6 %24 %32 +OpStore %44 %43 +OpBranch %34 +%34 = OpLabel +%33 = OpIAdd %9 %32 %21 +OpStore %4 %33 +OpBranch %31 +%35 = OpLabel +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %9 %24 %21 +OpStore %3 %25 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +/* +#version 430 +void main(void) { + int accumulator = 0; + float A[10]; + float B[10]; + float C[10]; + + for (int i = 0; i < 10; i++) { + int c = C[i]; + A[i] = B[i]; + B[i] = A[i] + c; + } +} + +This loop should not be split as we would have to break the order of the loads +to do so. It would be grouped into two sets: + +1 + int c = C[i]; + B[i] = A[i] + c; + +2 + A[i] = B[i]; + +To keep the load C[i] in the same order we would need to put B[i] ahead of that +*/ +TEST_F(FissionClassTest, FissionLoad) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "c" +OpName %5 "C" +OpName %6 "A" +OpName %7 "B" +%8 = OpTypeVoid +%9 = OpTypeFunction %8 +%10 = OpTypeInt 32 1 +%11 = OpTypePointer Function %10 +%12 = OpConstant %10 0 +%13 = OpConstant %10 10 +%14 = OpTypeBool +%15 = OpTypeFloat 32 +%16 = OpTypePointer Function %15 +%17 = OpTypeInt 32 0 +%18 = OpConstant %17 10 +%19 = OpTypeArray %15 %18 +%20 = OpTypePointer Function %19 +%21 = OpConstant %10 1 +%2 = OpFunction %8 None %9 +%22 = OpLabel +%3 = OpVariable %11 Function +%4 = OpVariable %16 Function +%5 = OpVariable %20 Function +%6 = OpVariable %20 Function +%7 = OpVariable %20 Function +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %10 %12 %22 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %14 %24 %13 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +%31 = OpAccessChain %16 %5 %24 +%32 = OpLoad %15 %31 +OpStore %4 %32 +%33 = OpAccessChain %16 %7 %24 +%34 = OpLoad %15 %33 +%35 = OpAccessChain %16 %6 %24 +OpStore %35 %34 +%36 = OpAccessChain %16 %6 %24 +%37 = OpLoad %15 %36 +%38 = OpFAdd %15 %37 %32 +%39 = OpAccessChain %16 %7 %24 +OpStore %39 %38 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %10 %24 %21 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +layout(location=0) flat in int condition; +void main(void) { + float A[10]; + float B[10]; + + for (int i = 0; i < 10; i++) { + if (condition == 1) + A[i] = B[i]; + else + B[i] = A[i]; + } +} + + +When this is split we leave the condition check and control flow inplace and +leave its removal for dead code elimination. + +#version 430 +layout(location=0) flat in int condition; +void main(void) { + float A[10]; + float B[10]; + + for (int i = 0; i < 10; i++) { + if (condition == 1) + A[i] = B[i]; + else + ; + } + for (int i = 0; i < 10; i++) { + if (condition == 1) + ; + else + B[i] = A[i]; + } +} + + +*/ +TEST_F(FissionClassTest, FissionControlFlow) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %4 "i" + OpName %3 "condition" + OpName %5 "A" + OpName %6 "B" + OpDecorate %3 Flat + OpDecorate %3 Location 0 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeInt 32 1 + %10 = OpTypePointer Function %9 + %11 = OpConstant %9 0 + %12 = OpConstant %9 10 + %13 = OpTypeBool + %14 = OpTypePointer Input %9 + %3 = OpVariable %14 Input + %15 = OpConstant %9 1 + %16 = OpTypeFloat 32 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 10 + %19 = OpTypeArray %16 %18 + %20 = OpTypePointer Function %19 + %21 = OpTypePointer Function %16 + %2 = OpFunction %7 None %8 + %22 = OpLabel + %4 = OpVariable %10 Function + %5 = OpVariable %20 Function + %6 = OpVariable %20 Function + %31 = OpLoad %9 %3 + OpStore %4 %11 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %9 %11 %22 %25 %26 + OpLoopMerge %27 %26 None + OpBranch %28 + %28 = OpLabel + %29 = OpSLessThan %13 %24 %12 + OpBranchConditional %29 %30 %27 + %30 = OpLabel + %32 = OpIEqual %13 %31 %15 + OpSelectionMerge %33 None + OpBranchConditional %32 %34 %35 + %34 = OpLabel + %36 = OpAccessChain %21 %6 %24 + %37 = OpLoad %16 %36 + %38 = OpAccessChain %21 %5 %24 + OpStore %38 %37 + OpBranch %33 + %35 = OpLabel + %39 = OpAccessChain %21 %5 %24 + %40 = OpLoad %16 %39 + %41 = OpAccessChain %21 %6 %24 + OpStore %41 %40 + OpBranch %33 + %33 = OpLabel + OpBranch %26 + %26 = OpLabel + %25 = OpIAdd %9 %24 %15 + OpStore %4 %25 + OpBranch %23 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %4 "i" +OpName %3 "condition" +OpName %5 "A" +OpName %6 "B" +OpDecorate %3 Flat +OpDecorate %3 Location 0 +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypePointer Input %9 +%3 = OpVariable %14 Input +%15 = OpConstant %9 1 +%16 = OpTypeFloat 32 +%17 = OpTypeInt 32 0 +%18 = OpConstant %17 10 +%19 = OpTypeArray %16 %18 +%20 = OpTypePointer Function %19 +%21 = OpTypePointer Function %16 +%2 = OpFunction %7 None %8 +%22 = OpLabel +%4 = OpVariable %10 Function +%5 = OpVariable %20 Function +%6 = OpVariable %20 Function +%23 = OpLoad %9 %3 +OpStore %4 %11 +OpBranch %42 +%42 = OpLabel +%43 = OpPhi %9 %11 %22 %58 %57 +OpLoopMerge %59 %57 None +OpBranch %44 +%44 = OpLabel +%45 = OpSLessThan %13 %43 %12 +OpBranchConditional %45 %46 %59 +%46 = OpLabel +%47 = OpIEqual %13 %23 %15 +OpSelectionMerge %56 None +OpBranchConditional %47 %52 %48 +%48 = OpLabel +OpBranch %56 +%52 = OpLabel +%53 = OpAccessChain %21 %6 %43 +%54 = OpLoad %16 %53 +%55 = OpAccessChain %21 %5 %43 +OpStore %55 %54 +OpBranch %56 +%56 = OpLabel +OpBranch %57 +%57 = OpLabel +%58 = OpIAdd %9 %43 %15 +OpStore %4 %58 +OpBranch %42 +%59 = OpLabel +OpBranch %24 +%24 = OpLabel +%25 = OpPhi %9 %11 %59 %26 %27 +OpLoopMerge %28 %27 None +OpBranch %29 +%29 = OpLabel +%30 = OpSLessThan %13 %25 %12 +OpBranchConditional %30 %31 %28 +%31 = OpLabel +%32 = OpIEqual %13 %23 %15 +OpSelectionMerge %33 None +OpBranchConditional %32 %34 %35 +%34 = OpLabel +OpBranch %33 +%35 = OpLabel +%39 = OpAccessChain %21 %5 %25 +%40 = OpLoad %16 %39 +%41 = OpAccessChain %21 %6 %25 +OpStore %41 %40 +OpBranch %33 +%33 = OpLabel +OpBranch %27 +%27 = OpLabel +%26 = OpIAdd %9 %25 %15 +OpStore %4 %26 +OpBranch %24 +%28 = OpLabel +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +/* +#version 430 +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + if (i == 1) + B[i] = A[i]; + else if (i == 2) + A[i] = B[i]; + else + A[i] = 0; + } +} + +After running the pass with multiple splits enabled (via register threshold of +1) we expect the equivalent of: + +#version 430 +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + if (i == 1) + B[i] = A[i]; + else if (i == 2) + else + } + for (int i = 0; i < 10; i++) { + if (i == 1) + else if (i == 2) + A[i] = B[i]; + else + } + for (int i = 0; i < 10; i++) { + if (i == 1) + else if (i == 2) + else + A[i] = 0; + } + +} + +*/ +TEST_F(FissionClassTest, FissionControlFlow2) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string source = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "B" + OpName %5 "A" + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpConstant %8 1 + %14 = OpTypeFloat 32 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 10 + %17 = OpTypeArray %14 %16 + %18 = OpTypePointer Function %17 + %19 = OpTypePointer Function %14 + %20 = OpConstant %8 2 + %21 = OpConstant %14 0 + %2 = OpFunction %6 None %7 + %22 = OpLabel + %3 = OpVariable %9 Function + %4 = OpVariable %18 Function + %5 = OpVariable %18 Function + OpStore %3 %10 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %8 %10 %22 %25 %26 + OpLoopMerge %27 %26 None + OpBranch %28 + %28 = OpLabel + %29 = OpSLessThan %12 %24 %11 + OpBranchConditional %29 %30 %27 + %30 = OpLabel + %31 = OpIEqual %12 %24 %13 + OpSelectionMerge %32 None + OpBranchConditional %31 %33 %34 + %33 = OpLabel + %35 = OpAccessChain %19 %5 %24 + %36 = OpLoad %14 %35 + %37 = OpAccessChain %19 %4 %24 + OpStore %37 %36 + OpBranch %32 + %34 = OpLabel + %38 = OpIEqual %12 %24 %20 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %41 + %40 = OpLabel + %42 = OpAccessChain %19 %4 %24 + %43 = OpLoad %14 %42 + %44 = OpAccessChain %19 %5 %24 + OpStore %44 %43 + OpBranch %39 + %41 = OpLabel + %45 = OpAccessChain %19 %5 %24 + OpStore %45 %21 + OpBranch %39 + %39 = OpLabel + OpBranch %32 + %32 = OpLabel + OpBranch %26 + %26 = OpLabel + %25 = OpIAdd %8 %24 %13 + OpStore %3 %25 + OpBranch %23 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpConstant %8 1 +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypePointer Function %17 +%19 = OpTypePointer Function %14 +%20 = OpConstant %8 2 +%21 = OpConstant %14 0 +%2 = OpFunction %6 None %7 +%22 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %18 Function +%5 = OpVariable %18 Function +OpStore %3 %10 +OpBranch %46 +%46 = OpLabel +%47 = OpPhi %8 %10 %22 %67 %66 +OpLoopMerge %68 %66 None +OpBranch %48 +%48 = OpLabel +%49 = OpSLessThan %12 %47 %11 +OpBranchConditional %49 %50 %68 +%50 = OpLabel +%51 = OpIEqual %12 %47 %13 +OpSelectionMerge %65 None +OpBranchConditional %51 %61 %52 +%52 = OpLabel +%53 = OpIEqual %12 %47 %20 +OpSelectionMerge %60 None +OpBranchConditional %53 %56 %54 +%54 = OpLabel +OpBranch %60 +%56 = OpLabel +OpBranch %60 +%60 = OpLabel +OpBranch %65 +%61 = OpLabel +%62 = OpAccessChain %19 %5 %47 +%63 = OpLoad %14 %62 +%64 = OpAccessChain %19 %4 %47 +OpStore %64 %63 +OpBranch %65 +%65 = OpLabel +OpBranch %66 +%66 = OpLabel +%67 = OpIAdd %8 %47 %13 +OpStore %3 %67 +OpBranch %46 +%68 = OpLabel +OpBranch %69 +%69 = OpLabel +%70 = OpPhi %8 %10 %68 %87 %86 +OpLoopMerge %88 %86 None +OpBranch %71 +%71 = OpLabel +%72 = OpSLessThan %12 %70 %11 +OpBranchConditional %72 %73 %88 +%73 = OpLabel +%74 = OpIEqual %12 %70 %13 +OpSelectionMerge %85 None +OpBranchConditional %74 %84 %75 +%75 = OpLabel +%76 = OpIEqual %12 %70 %20 +OpSelectionMerge %83 None +OpBranchConditional %76 %79 %77 +%77 = OpLabel +OpBranch %83 +%79 = OpLabel +%80 = OpAccessChain %19 %4 %70 +%81 = OpLoad %14 %80 +%82 = OpAccessChain %19 %5 %70 +OpStore %82 %81 +OpBranch %83 +%83 = OpLabel +OpBranch %85 +%84 = OpLabel +OpBranch %85 +%85 = OpLabel +OpBranch %86 +%86 = OpLabel +%87 = OpIAdd %8 %70 %13 +OpStore %3 %87 +OpBranch %69 +%88 = OpLabel +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %8 %10 %88 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %12 %24 %11 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +%31 = OpIEqual %12 %24 %13 +OpSelectionMerge %32 None +OpBranchConditional %31 %33 %34 +%33 = OpLabel +OpBranch %32 +%34 = OpLabel +%38 = OpIEqual %12 %24 %20 +OpSelectionMerge %39 None +OpBranchConditional %38 %40 %41 +%40 = OpLabel +OpBranch %39 +%41 = OpLabel +%45 = OpAccessChain %19 %5 %24 +OpStore %45 %21 +OpBranch %39 +%39 = OpLabel +OpBranch %32 +%32 = OpLabel +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %8 %24 %13 +OpStore %3 %25 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true, 1); +} + +/* +#version 430 +layout(location=0) flat in int condition; +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + B[i] = A[i]; + memoryBarrier(); + A[i] = B[i]; + } +} + +This should not be split due to the memory barrier. +*/ +TEST_F(FissionClassTest, FissionBarrier) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %4 "i" +OpName %5 "B" +OpName %6 "A" +OpName %3 "condition" +OpDecorate %3 Flat +OpDecorate %3 Location 0 +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypePointer Function %17 +%19 = OpTypePointer Function %14 +%20 = OpConstant %15 1 +%21 = OpConstant %15 4048 +%22 = OpConstant %9 1 +%23 = OpTypePointer Input %9 +%3 = OpVariable %23 Input +%2 = OpFunction %7 None %8 +%24 = OpLabel +%4 = OpVariable %10 Function +%5 = OpVariable %18 Function +%6 = OpVariable %18 Function +OpStore %4 %11 +OpBranch %25 +%25 = OpLabel +%26 = OpPhi %9 %11 %24 %27 %28 +OpLoopMerge %29 %28 None +OpBranch %30 +%30 = OpLabel +%31 = OpSLessThan %13 %26 %12 +OpBranchConditional %31 %32 %29 +%32 = OpLabel +%33 = OpAccessChain %19 %6 %26 +%34 = OpLoad %14 %33 +%35 = OpAccessChain %19 %5 %26 +OpStore %35 %34 +OpMemoryBarrier %20 %21 +%36 = OpAccessChain %19 %5 %26 +%37 = OpLoad %14 %36 +%38 = OpAccessChain %19 %6 %26 +OpStore %38 %37 +OpBranch %28 +%28 = OpLabel +%27 = OpIAdd %9 %26 %22 +OpStore %4 %27 +OpBranch %25 +%29 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + B[i] = A[i]; + if ( i== 1) + break; + A[i] = B[i]; + } +} + +This should not be split due to the break. +*/ +TEST_F(FissionClassTest, FissionBreak) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpStore %3 %10 +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %20 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%29 = OpAccessChain %18 %5 %22 +%30 = OpLoad %13 %29 +%31 = OpAccessChain %18 %4 %22 +OpStore %31 %30 +%32 = OpIEqual %12 %22 %19 +OpSelectionMerge %33 None +OpBranchConditional %32 %34 %33 +%34 = OpLabel +OpBranch %25 +%33 = OpLabel +%35 = OpAccessChain %18 %4 %22 +%36 = OpLoad %13 %35 +%37 = OpAccessChain %18 %5 %22 +OpStore %37 %36 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpStore %3 %23 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; i++) { + B[i] = A[i]; + if ( i== 1) + continue; + A[i] = B[i]; + } +} + +This loop should be split into: + + for (int i = 0; i < 10; i++) { + B[i] = A[i]; + if ( i== 1) + continue; + } + for (int i = 0; i < 10; i++) { + if ( i== 1) + continue; + A[i] = B[i]; + } +The continue block in the first loop is left to DCE. +} + + +*/ +TEST_F(FissionClassTest, FissionContinue) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpStore %3 %10 +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %20 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%29 = OpAccessChain %18 %5 %22 +%30 = OpLoad %13 %29 +%31 = OpAccessChain %18 %4 %22 +OpStore %31 %30 +%32 = OpIEqual %12 %22 %19 +OpSelectionMerge %33 None +OpBranchConditional %32 %34 %33 +%34 = OpLabel +OpBranch %24 +%33 = OpLabel +%35 = OpAccessChain %18 %4 %22 +%36 = OpLoad %13 %35 +%37 = OpAccessChain %18 %5 %22 +OpStore %37 %36 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpStore %3 %23 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + +const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpStore %3 %10 +OpBranch %38 +%38 = OpLabel +%39 = OpPhi %8 %10 %20 %53 %52 +OpLoopMerge %54 %52 None +OpBranch %40 +%40 = OpLabel +%41 = OpSLessThan %12 %39 %11 +OpBranchConditional %41 %42 %54 +%42 = OpLabel +%43 = OpAccessChain %18 %5 %39 +%44 = OpLoad %13 %43 +%45 = OpAccessChain %18 %4 %39 +OpStore %45 %44 +%46 = OpIEqual %12 %39 %19 +OpSelectionMerge %47 None +OpBranchConditional %46 %51 %47 +%47 = OpLabel +OpBranch %52 +%51 = OpLabel +OpBranch %52 +%52 = OpLabel +%53 = OpIAdd %8 %39 %19 +OpStore %3 %53 +OpBranch %38 +%54 = OpLabel +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %54 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%32 = OpIEqual %12 %22 %19 +OpSelectionMerge %33 None +OpBranchConditional %32 %34 %33 +%34 = OpLabel +OpBranch %24 +%33 = OpLabel +%35 = OpAccessChain %18 %4 %22 +%36 = OpLoad %13 %35 +%37 = OpAccessChain %18 %5 %22 +OpStore %37 %36 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpStore %3 %23 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +/* +#version 430 +void main(void) { + float A[10]; + float B[10]; + int i = 0; + do { + B[i] = A[i]; + A[i] = B[i]; + ++i; + } while (i < 10); +} + + +Check that this is split into: + int i = 0; + do { + B[i] = A[i]; + ++i; + } while (i < 10); + + i = 0; + do { + A[i] = B[i]; + ++i; + } while (i < 10); + + +*/ +TEST_F(FissionClassTest, FissionDoWhile) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpTypeFloat 32 +%12 = OpTypeInt 32 0 +%13 = OpConstant %12 10 +%14 = OpTypeArray %11 %13 +%15 = OpTypePointer Function %14 +%16 = OpTypePointer Function %11 +%17 = OpConstant %8 1 +%18 = OpConstant %8 10 +%19 = OpTypeBool +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %15 Function +%5 = OpVariable %15 Function +OpStore %3 %10 +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %20 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpAccessChain %16 %5 %22 +%28 = OpLoad %11 %27 +%29 = OpAccessChain %16 %4 %22 +OpStore %29 %28 +%30 = OpAccessChain %16 %4 %22 +%31 = OpLoad %11 %30 +%32 = OpAccessChain %16 %5 %22 +OpStore %32 %31 +%23 = OpIAdd %8 %22 %17 +OpStore %3 %23 +OpBranch %24 +%24 = OpLabel +%33 = OpSLessThan %19 %23 %18 +OpBranchConditional %33 %21 %25 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + +const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpTypeFloat 32 +%12 = OpTypeInt 32 0 +%13 = OpConstant %12 10 +%14 = OpTypeArray %11 %13 +%15 = OpTypePointer Function %14 +%16 = OpTypePointer Function %11 +%17 = OpConstant %8 1 +%18 = OpConstant %8 10 +%19 = OpTypeBool +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %15 Function +%5 = OpVariable %15 Function +OpStore %3 %10 +OpBranch %34 +%34 = OpLabel +%35 = OpPhi %8 %10 %20 %43 %44 +OpLoopMerge %46 %44 None +OpBranch %36 +%36 = OpLabel +%37 = OpAccessChain %16 %5 %35 +%38 = OpLoad %11 %37 +%39 = OpAccessChain %16 %4 %35 +OpStore %39 %38 +%43 = OpIAdd %8 %35 %17 +OpStore %3 %43 +OpBranch %44 +%44 = OpLabel +%45 = OpSLessThan %19 %43 %18 +OpBranchConditional %45 %34 %46 +%46 = OpLabel +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %46 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%30 = OpAccessChain %16 %4 %22 +%31 = OpLoad %11 %30 +%32 = OpAccessChain %16 %5 %22 +OpStore %32 %31 +%23 = OpIAdd %8 %22 %17 +OpStore %3 %23 +OpBranch %24 +%24 = OpLabel +%33 = OpSLessThan %19 %23 %18 +OpBranchConditional %33 %21 %25 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +/* + +#version 430 +void main(void) { + float A[10][10]; + float B[10][10]; + for (int j = 0; j < 10; ++j) { + for (int i = 0; i < 10; ++i) { + B[i][j] = A[i][i]; + A[i][i] = B[i][j + 1]; + } + } +} + + +This loop can't be split because the load B[i][j + 1] is dependent on the store +B[i][j]. + +*/ +TEST_F(FissionClassTest, FissionNestedDependency) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "j" +OpName %4 "i" +OpName %5 "B" +OpName %6 "A" +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypeArray %17 %16 +%19 = OpTypePointer Function %18 +%20 = OpTypePointer Function %14 +%21 = OpConstant %9 1 +%2 = OpFunction %7 None %8 +%22 = OpLabel +%3 = OpVariable %10 Function +%4 = OpVariable %10 Function +%5 = OpVariable %19 Function +%6 = OpVariable %19 Function +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %9 %11 %22 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %13 %24 %12 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpPhi %9 %11 %30 %33 %34 +OpLoopMerge %35 %34 None +OpBranch %36 +%36 = OpLabel +%37 = OpSLessThan %13 %32 %12 +OpBranchConditional %37 %38 %35 +%38 = OpLabel +%39 = OpAccessChain %20 %6 %32 %32 +%40 = OpLoad %14 %39 +%41 = OpAccessChain %20 %5 %32 %24 +OpStore %41 %40 +%42 = OpIAdd %9 %24 %21 +%43 = OpAccessChain %20 %5 %32 %42 +%44 = OpLoad %14 %43 +%45 = OpAccessChain %20 %6 %32 %32 +OpStore %45 %44 +OpBranch %34 +%34 = OpLabel +%33 = OpIAdd %9 %32 %21 +OpBranch %31 +%35 = OpLabel +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %9 %24 %21 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +void main(void) { + float A[10][10]; + float B[10][10]; + for (int j = 0; j < 10; ++j) { + for (int i = 0; i < 10; ++i) { + B[i][i] = A[i][j]; + A[i][j+1] = B[i][i]; + } + } +} + +This loop should not be split as the load A[i][j+1] would be reading a value +written in the store A[i][j] which would be hit before A[i][j+1] if the loops +where split but would not get hit before the read currently. + +*/ +TEST_F(FissionClassTest, FissionNestedDependency2) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "j" +OpName %4 "i" +OpName %5 "B" +OpName %6 "A" +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypeArray %17 %16 +%19 = OpTypePointer Function %18 +%20 = OpTypePointer Function %14 +%21 = OpConstant %9 1 +%2 = OpFunction %7 None %8 +%22 = OpLabel +%3 = OpVariable %10 Function +%4 = OpVariable %10 Function +%5 = OpVariable %19 Function +%6 = OpVariable %19 Function +OpStore %3 %11 +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %9 %11 %22 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %13 %24 %12 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +OpStore %4 %11 +OpBranch %31 +%31 = OpLabel +%32 = OpPhi %9 %11 %30 %33 %34 +OpLoopMerge %35 %34 None +OpBranch %36 +%36 = OpLabel +%37 = OpSLessThan %13 %32 %12 +OpBranchConditional %37 %38 %35 +%38 = OpLabel +%39 = OpAccessChain %20 %6 %32 %24 +%40 = OpLoad %14 %39 +%41 = OpAccessChain %20 %5 %32 %32 +OpStore %41 %40 +%42 = OpIAdd %9 %24 %21 +%43 = OpAccessChain %20 %5 %32 %32 +%44 = OpLoad %14 %43 +%45 = OpAccessChain %20 %6 %32 %42 +OpStore %45 %44 +OpBranch %34 +%34 = OpLabel +%33 = OpIAdd %9 %32 %21 +OpStore %4 %33 +OpBranch %31 +%35 = OpLabel +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %9 %24 %21 +OpStore %3 %25 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +void main(void) { + float A[10][10]; + float B[10][10]; + for (int j = 0; j < 10; ++j) { + for (int i = 0; i < 10; ++i) { + B[i][j] = A[i][j]; + A[i][j] = B[i][j]; + } + for (int i = 0; i < 10; ++i) { + B[i][j] = A[i][j]; + A[i][j] = B[i][j]; + } + } +} + + + +Should be split into: + +for (int j = 0; j < 10; ++j) { + for (int i = 0; i < 10; ++i) + B[i][j] = A[i][j]; + for (int i = 0; i < 10; ++i) + A[i][j] = B[i][j]; + for (int i = 0; i < 10; ++i) + B[i][j] = A[i][j]; + for (int i = 0; i < 10; ++i) + A[i][j] = B[i][j]; +*/ +TEST_F(FissionClassTest, FissionMultipleLoopsNested) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "j" + OpName %4 "i" + OpName %5 "B" + OpName %6 "A" + OpName %7 "i" + %8 = OpTypeVoid + %9 = OpTypeFunction %8 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %12 = OpConstant %10 0 + %13 = OpConstant %10 10 + %14 = OpTypeBool + %15 = OpTypeFloat 32 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 10 + %18 = OpTypeArray %15 %17 + %19 = OpTypeArray %18 %17 + %20 = OpTypePointer Function %19 + %21 = OpTypePointer Function %15 + %22 = OpConstant %10 1 + %2 = OpFunction %8 None %9 + %23 = OpLabel + %3 = OpVariable %11 Function + %4 = OpVariable %11 Function + %5 = OpVariable %20 Function + %6 = OpVariable %20 Function + %7 = OpVariable %11 Function + OpStore %3 %12 + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %10 %12 %23 %26 %27 + OpLoopMerge %28 %27 None + OpBranch %29 + %29 = OpLabel + %30 = OpSLessThan %14 %25 %13 + OpBranchConditional %30 %31 %28 + %31 = OpLabel + OpStore %4 %12 + OpBranch %32 + %32 = OpLabel + %33 = OpPhi %10 %12 %31 %34 %35 + OpLoopMerge %36 %35 None + OpBranch %37 + %37 = OpLabel + %38 = OpSLessThan %14 %33 %13 + OpBranchConditional %38 %39 %36 + %39 = OpLabel + %40 = OpAccessChain %21 %6 %33 %25 + %41 = OpLoad %15 %40 + %42 = OpAccessChain %21 %5 %33 %25 + OpStore %42 %41 + %43 = OpAccessChain %21 %5 %33 %25 + %44 = OpLoad %15 %43 + %45 = OpAccessChain %21 %6 %33 %25 + OpStore %45 %44 + OpBranch %35 + %35 = OpLabel + %34 = OpIAdd %10 %33 %22 + OpStore %4 %34 + OpBranch %32 + %36 = OpLabel + OpStore %7 %12 + OpBranch %46 + %46 = OpLabel + %47 = OpPhi %10 %12 %36 %48 %49 + OpLoopMerge %50 %49 None + OpBranch %51 + %51 = OpLabel + %52 = OpSLessThan %14 %47 %13 + OpBranchConditional %52 %53 %50 + %53 = OpLabel + %54 = OpAccessChain %21 %6 %47 %25 + %55 = OpLoad %15 %54 + %56 = OpAccessChain %21 %5 %47 %25 + OpStore %56 %55 + %57 = OpAccessChain %21 %5 %47 %25 + %58 = OpLoad %15 %57 + %59 = OpAccessChain %21 %6 %47 %25 + OpStore %59 %58 + OpBranch %49 + %49 = OpLabel + %48 = OpIAdd %10 %47 %22 + OpStore %7 %48 + OpBranch %46 + %50 = OpLabel + OpBranch %27 + %27 = OpLabel + %26 = OpIAdd %10 %25 %22 + OpStore %3 %26 + OpBranch %24 + %28 = OpLabel + OpReturn + OpFunctionEnd +)"; + +const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "j" +OpName %4 "i" +OpName %5 "B" +OpName %6 "A" +OpName %7 "i" +%8 = OpTypeVoid +%9 = OpTypeFunction %8 +%10 = OpTypeInt 32 1 +%11 = OpTypePointer Function %10 +%12 = OpConstant %10 0 +%13 = OpConstant %10 10 +%14 = OpTypeBool +%15 = OpTypeFloat 32 +%16 = OpTypeInt 32 0 +%17 = OpConstant %16 10 +%18 = OpTypeArray %15 %17 +%19 = OpTypeArray %18 %17 +%20 = OpTypePointer Function %19 +%21 = OpTypePointer Function %15 +%22 = OpConstant %10 1 +%2 = OpFunction %8 None %9 +%23 = OpLabel +%3 = OpVariable %11 Function +%4 = OpVariable %11 Function +%5 = OpVariable %20 Function +%6 = OpVariable %20 Function +%7 = OpVariable %11 Function +OpStore %3 %12 +OpBranch %24 +%24 = OpLabel +%25 = OpPhi %10 %12 %23 %26 %27 +OpLoopMerge %28 %27 None +OpBranch %29 +%29 = OpLabel +%30 = OpSLessThan %14 %25 %13 +OpBranchConditional %30 %31 %28 +%31 = OpLabel +OpStore %4 %12 +OpBranch %60 +%60 = OpLabel +%61 = OpPhi %10 %12 %31 %72 %71 +OpLoopMerge %73 %71 None +OpBranch %62 +%62 = OpLabel +%63 = OpSLessThan %14 %61 %13 +OpBranchConditional %63 %64 %73 +%64 = OpLabel +%65 = OpAccessChain %21 %6 %61 %25 +%66 = OpLoad %15 %65 +%67 = OpAccessChain %21 %5 %61 %25 +OpStore %67 %66 +OpBranch %71 +%71 = OpLabel +%72 = OpIAdd %10 %61 %22 +OpStore %4 %72 +OpBranch %60 +%73 = OpLabel +OpBranch %32 +%32 = OpLabel +%33 = OpPhi %10 %12 %73 %34 %35 +OpLoopMerge %36 %35 None +OpBranch %37 +%37 = OpLabel +%38 = OpSLessThan %14 %33 %13 +OpBranchConditional %38 %39 %36 +%39 = OpLabel +%43 = OpAccessChain %21 %5 %33 %25 +%44 = OpLoad %15 %43 +%45 = OpAccessChain %21 %6 %33 %25 +OpStore %45 %44 +OpBranch %35 +%35 = OpLabel +%34 = OpIAdd %10 %33 %22 +OpStore %4 %34 +OpBranch %32 +%36 = OpLabel +OpStore %7 %12 +OpBranch %74 +%74 = OpLabel +%75 = OpPhi %10 %12 %36 %86 %85 +OpLoopMerge %87 %85 None +OpBranch %76 +%76 = OpLabel +%77 = OpSLessThan %14 %75 %13 +OpBranchConditional %77 %78 %87 +%78 = OpLabel +%79 = OpAccessChain %21 %6 %75 %25 +%80 = OpLoad %15 %79 +%81 = OpAccessChain %21 %5 %75 %25 +OpStore %81 %80 +OpBranch %85 +%85 = OpLabel +%86 = OpIAdd %10 %75 %22 +OpStore %7 %86 +OpBranch %74 +%87 = OpLabel +OpBranch %46 +%46 = OpLabel +%47 = OpPhi %10 %12 %87 %48 %49 +OpLoopMerge %50 %49 None +OpBranch %51 +%51 = OpLabel +%52 = OpSLessThan %14 %47 %13 +OpBranchConditional %52 %53 %50 +%53 = OpLabel +%57 = OpAccessChain %21 %5 %47 %25 +%58 = OpLoad %15 %57 +%59 = OpAccessChain %21 %6 %47 %25 +OpStore %59 %58 +OpBranch %49 +%49 = OpLabel +%48 = OpIAdd %10 %47 %22 +OpStore %7 %48 +OpBranch %46 +%50 = OpLabel +OpBranch %27 +%27 = OpLabel +%26 = OpIAdd %10 %25 %22 +OpStore %3 %26 +OpBranch %24 +%28 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + const Function* function = spvtest::GetFunction(module, 2); + LoopDescriptor& pre_pass_descriptor = *context->GetLoopDescriptor(function); + EXPECT_EQ(pre_pass_descriptor.NumLoops(), 3u); + EXPECT_EQ(pre_pass_descriptor.pre_begin()->NumImmediateChildren(), 2u); + + // Test that the pass transforms the ir into the expected output. + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); + + // Test that the loop descriptor is correctly maintained and updated by the + // pass. + LoopFissionPass loop_fission; + loop_fission.SetContextForTesting(context.get()); + loop_fission.Process(); + + function = spvtest::GetFunction(module, 2); + LoopDescriptor& post_pass_descriptor = *context->GetLoopDescriptor(function); + EXPECT_EQ(post_pass_descriptor.NumLoops(), 5u); + EXPECT_EQ(post_pass_descriptor.pre_begin()->NumImmediateChildren(), 4u); +} + +/* +#version 430 +void main(void) { + float A[10][10]; + float B[10][10]; + for (int i = 0; i < 10; ++i) { + B[i][i] = A[i][i]; + A[i][i] = B[i][i]; + } + for (int i = 0; i < 10; ++i) { + B[i][i] = A[i][i]; + A[i][i] = B[i][i] + } +} + + + +Should be split into: + + for (int i = 0; i < 10; ++i) + B[i][i] = A[i][i]; + for (int i = 0; i < 10; ++i) + A[i][i] = B[i][i]; + for (int i = 0; i < 10; ++i) + B[i][i] = A[i][i]; + for (int i = 0; i < 10; ++i) + A[i][i] = B[i][i]; +*/ +TEST_F(FissionClassTest, FissionMultipleLoops) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "B" + OpName %5 "A" + OpName %6 "i" + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeInt 32 1 + %10 = OpTypePointer Function %9 + %11 = OpConstant %9 0 + %12 = OpConstant %9 10 + %13 = OpTypeBool + %14 = OpTypeFloat 32 + %15 = OpTypeInt 32 0 + %16 = OpConstant %15 10 + %17 = OpTypeArray %14 %16 + %18 = OpTypePointer Function %17 + %19 = OpTypePointer Function %14 + %20 = OpConstant %9 1 + %2 = OpFunction %7 None %8 + %21 = OpLabel + %3 = OpVariable %10 Function + %4 = OpVariable %18 Function + %5 = OpVariable %18 Function + %6 = OpVariable %10 Function + OpStore %3 %11 + OpBranch %22 + %22 = OpLabel + %23 = OpPhi %9 %11 %21 %24 %25 + OpLoopMerge %26 %25 None + OpBranch %27 + %27 = OpLabel + %28 = OpSLessThan %13 %23 %12 + OpBranchConditional %28 %29 %26 + %29 = OpLabel + %30 = OpAccessChain %19 %5 %23 + %31 = OpLoad %14 %30 + %32 = OpAccessChain %19 %4 %23 + OpStore %32 %31 + %33 = OpAccessChain %19 %4 %23 + %34 = OpLoad %14 %33 + %35 = OpAccessChain %19 %5 %23 + OpStore %35 %34 + OpBranch %25 + %25 = OpLabel + %24 = OpIAdd %9 %23 %20 + OpStore %3 %24 + OpBranch %22 + %26 = OpLabel + OpStore %6 %11 + OpBranch %36 + %36 = OpLabel + %37 = OpPhi %9 %11 %26 %38 %39 + OpLoopMerge %40 %39 None + OpBranch %41 + %41 = OpLabel + %42 = OpSLessThan %13 %37 %12 + OpBranchConditional %42 %43 %40 + %43 = OpLabel + %44 = OpAccessChain %19 %5 %37 + %45 = OpLoad %14 %44 + %46 = OpAccessChain %19 %4 %37 + OpStore %46 %45 + %47 = OpAccessChain %19 %4 %37 + %48 = OpLoad %14 %47 + %49 = OpAccessChain %19 %5 %37 + OpStore %49 %48 + OpBranch %39 + %39 = OpLabel + %38 = OpIAdd %9 %37 %20 + OpStore %6 %38 + OpBranch %36 + %40 = OpLabel + OpReturn + OpFunctionEnd +)"; + +const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +OpName %6 "i" +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpTypeFloat 32 +%15 = OpTypeInt 32 0 +%16 = OpConstant %15 10 +%17 = OpTypeArray %14 %16 +%18 = OpTypePointer Function %17 +%19 = OpTypePointer Function %14 +%20 = OpConstant %9 1 +%2 = OpFunction %7 None %8 +%21 = OpLabel +%3 = OpVariable %10 Function +%4 = OpVariable %18 Function +%5 = OpVariable %18 Function +%6 = OpVariable %10 Function +OpStore %3 %11 +OpBranch %64 +%64 = OpLabel +%65 = OpPhi %9 %11 %21 %76 %75 +OpLoopMerge %77 %75 None +OpBranch %66 +%66 = OpLabel +%67 = OpSLessThan %13 %65 %12 +OpBranchConditional %67 %68 %77 +%68 = OpLabel +%69 = OpAccessChain %19 %5 %65 +%70 = OpLoad %14 %69 +%71 = OpAccessChain %19 %4 %65 +OpStore %71 %70 +OpBranch %75 +%75 = OpLabel +%76 = OpIAdd %9 %65 %20 +OpStore %3 %76 +OpBranch %64 +%77 = OpLabel +OpBranch %22 +%22 = OpLabel +%23 = OpPhi %9 %11 %77 %24 %25 +OpLoopMerge %26 %25 None +OpBranch %27 +%27 = OpLabel +%28 = OpSLessThan %13 %23 %12 +OpBranchConditional %28 %29 %26 +%29 = OpLabel +%33 = OpAccessChain %19 %4 %23 +%34 = OpLoad %14 %33 +%35 = OpAccessChain %19 %5 %23 +OpStore %35 %34 +OpBranch %25 +%25 = OpLabel +%24 = OpIAdd %9 %23 %20 +OpStore %3 %24 +OpBranch %22 +%26 = OpLabel +OpStore %6 %11 +OpBranch %50 +%50 = OpLabel +%51 = OpPhi %9 %11 %26 %62 %61 +OpLoopMerge %63 %61 None +OpBranch %52 +%52 = OpLabel +%53 = OpSLessThan %13 %51 %12 +OpBranchConditional %53 %54 %63 +%54 = OpLabel +%55 = OpAccessChain %19 %5 %51 +%56 = OpLoad %14 %55 +%57 = OpAccessChain %19 %4 %51 +OpStore %57 %56 +OpBranch %61 +%61 = OpLabel +%62 = OpIAdd %9 %51 %20 +OpStore %6 %62 +OpBranch %50 +%63 = OpLabel +OpBranch %36 +%36 = OpLabel +%37 = OpPhi %9 %11 %63 %38 %39 +OpLoopMerge %40 %39 None +OpBranch %41 +%41 = OpLabel +%42 = OpSLessThan %13 %37 %12 +OpBranchConditional %42 %43 %40 +%43 = OpLabel +%47 = OpAccessChain %19 %4 %37 +%48 = OpLoad %14 %47 +%49 = OpAccessChain %19 %5 %37 +OpStore %49 %48 +OpBranch %39 +%39 = OpLabel +%38 = OpIAdd %9 %37 %20 +OpStore %6 %38 +OpBranch %36 +%40 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); + + const Function* function = spvtest::GetFunction(module, 2); + LoopDescriptor& pre_pass_descriptor = *context->GetLoopDescriptor(function); + EXPECT_EQ(pre_pass_descriptor.NumLoops(), 2u); + EXPECT_EQ(pre_pass_descriptor.pre_begin()->NumImmediateChildren(), 0u); + + // Test that the pass transforms the ir into the expected output. + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); + + // Test that the loop descriptor is correctly maintained and updated by the + // pass. + LoopFissionPass loop_fission; + loop_fission.SetContextForTesting(context.get()); + loop_fission.Process(); + + function = spvtest::GetFunction(module, 2); + LoopDescriptor& post_pass_descriptor = *context->GetLoopDescriptor(function); + EXPECT_EQ(post_pass_descriptor.NumLoops(), 4u); + EXPECT_EQ(post_pass_descriptor.pre_begin()->NumImmediateChildren(), 0u); +} + +/* +#version 430 +int foo() { return 1; } +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; ++i) { + B[i] = A[i]; + foo(); + A[i] = B[i]; + } +} + +This should not be split as it has a function call in it so we can't determine +if it has side effects. +*/ +TEST_F(FissionClassTest, FissionFunctionCall) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "foo(" +OpName %4 "i" +OpName %5 "B" +OpName %6 "A" +%7 = OpTypeVoid +%8 = OpTypeFunction %7 +%9 = OpTypeInt 32 1 +%10 = OpTypeFunction %9 +%11 = OpConstant %9 1 +%12 = OpTypePointer Function %9 +%13 = OpConstant %9 0 +%14 = OpConstant %9 10 +%15 = OpTypeBool +%16 = OpTypeFloat 32 +%17 = OpTypeInt 32 0 +%18 = OpConstant %17 10 +%19 = OpTypeArray %16 %18 +%20 = OpTypePointer Function %19 +%21 = OpTypePointer Function %16 +%2 = OpFunction %7 None %8 +%22 = OpLabel +%4 = OpVariable %12 Function +%5 = OpVariable %20 Function +%6 = OpVariable %20 Function +OpStore %4 %13 +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %9 %13 %22 %25 %26 +OpLoopMerge %27 %26 None +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %15 %24 %14 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +%31 = OpAccessChain %21 %6 %24 +%32 = OpLoad %16 %31 +%33 = OpAccessChain %21 %5 %24 +OpStore %33 %32 +%34 = OpFunctionCall %9 %3 +%35 = OpAccessChain %21 %5 %24 +%36 = OpLoad %16 %35 +%37 = OpAccessChain %21 %6 %24 +OpStore %37 %36 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %9 %24 %11 +OpStore %4 %25 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +%3 = OpFunction %9 None %10 +%38 = OpLabel +OpReturnValue %11 +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, source, true); +} + +/* +#version 430 +void main(void) { + float A[10]; + float B[10]; + for (int i = 0; i < 10; ++i) { + switch (i) { + case 1: + B[i] = A[i]; + break; + default: + A[i] = B[i]; + } + } +} + +This should be split into: + for (int i = 0; i < 10; ++i) { + switch (i) { + case 1: + break; + default: + A[i] = B[i]; + } + } + + for (int i = 0; i < 10; ++i) { + switch (i) { + case 1: + B[i] = A[i]; + break; + default: + break; + } + } + +*/ +TEST_F(FissionClassTest, FissionSwitchStatement) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string source = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "B" + OpName %5 "A" + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Function %16 + %18 = OpTypePointer Function %13 + %19 = OpConstant %8 1 + %2 = OpFunction %6 None %7 + %20 = OpLabel + %3 = OpVariable %9 Function + %4 = OpVariable %17 Function + %5 = OpVariable %17 Function + OpStore %3 %10 + OpBranch %21 + %21 = OpLabel + %22 = OpPhi %8 %10 %20 %23 %24 + OpLoopMerge %25 %24 None + OpBranch %26 + %26 = OpLabel + %27 = OpSLessThan %12 %22 %11 + OpBranchConditional %27 %28 %25 + %28 = OpLabel + OpSelectionMerge %29 None + OpSwitch %22 %30 1 %31 + %30 = OpLabel + %32 = OpAccessChain %18 %4 %22 + %33 = OpLoad %13 %32 + %34 = OpAccessChain %18 %5 %22 + OpStore %34 %33 + OpBranch %29 + %31 = OpLabel + %35 = OpAccessChain %18 %5 %22 + %36 = OpLoad %13 %35 + %37 = OpAccessChain %18 %4 %22 + OpStore %37 %36 + OpBranch %29 + %29 = OpLabel + OpBranch %24 + %24 = OpLabel + %23 = OpIAdd %8 %22 %19 + OpStore %3 %23 + OpBranch %21 + %25 = OpLabel + OpReturn + OpFunctionEnd +)"; + +const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "B" +OpName %5 "A" +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %8 10 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 1 +%2 = OpFunction %6 None %7 +%20 = OpLabel +%3 = OpVariable %9 Function +%4 = OpVariable %17 Function +%5 = OpVariable %17 Function +OpStore %3 %10 +OpBranch %38 +%38 = OpLabel +%39 = OpPhi %8 %10 %20 %53 %52 +OpLoopMerge %54 %52 None +OpBranch %40 +%40 = OpLabel +%41 = OpSLessThan %12 %39 %11 +OpBranchConditional %41 %42 %54 +%42 = OpLabel +OpSelectionMerge %51 None +OpSwitch %39 %47 1 %43 +%43 = OpLabel +OpBranch %51 +%47 = OpLabel +%48 = OpAccessChain %18 %4 %39 +%49 = OpLoad %13 %48 +%50 = OpAccessChain %18 %5 %39 +OpStore %50 %49 +OpBranch %51 +%51 = OpLabel +OpBranch %52 +%52 = OpLabel +%53 = OpIAdd %8 %39 %19 +OpStore %3 %53 +OpBranch %38 +%54 = OpLabel +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %8 %10 %54 %23 %24 +OpLoopMerge %25 %24 None +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %22 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +OpSelectionMerge %29 None +OpSwitch %22 %30 1 %31 +%30 = OpLabel +OpBranch %29 +%31 = OpLabel +%35 = OpAccessChain %18 %5 %22 +%36 = OpLoad %13 %35 +%37 = OpAccessChain %18 %4 %22 +OpStore %37 %36 +OpBranch %29 +%29 = OpLabel +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %8 %22 %19 +OpStore %3 %23 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(source, expected, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp new file mode 100644 index 00000000000..651cdef44b3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/nested_loops.cpp @@ -0,0 +1,795 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/tree_iterator.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; + +bool Validate(const std::vector& bin) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {bin.data(), bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + return error == 0; +} + +using PassClassTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + for (; i < 10; ++i) { + int j = 0; + int k = 0; + for (; j < 11; ++j) {} + for (; k < 12; ++k) {} + } +} +*/ +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + OpName %5 "j" + OpName %6 "k" + OpName %3 "c" + OpDecorate %3 Location 0 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeInt 32 1 + %10 = OpTypePointer Function %9 + %11 = OpConstant %9 0 + %12 = OpConstant %9 10 + %13 = OpTypeBool + %14 = OpConstant %9 11 + %15 = OpConstant %9 1 + %16 = OpConstant %9 12 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %17 4 + %19 = OpTypePointer Output %18 + %3 = OpVariable %19 Output + %2 = OpFunction %7 None %8 + %20 = OpLabel + %4 = OpVariable %10 Function + %5 = OpVariable %10 Function + %6 = OpVariable %10 Function + OpStore %4 %11 + OpBranch %21 + %21 = OpLabel + OpLoopMerge %22 %23 None + OpBranch %24 + %24 = OpLabel + %25 = OpLoad %9 %4 + %26 = OpSLessThan %13 %25 %12 + OpBranchConditional %26 %27 %22 + %27 = OpLabel + OpStore %5 %11 + OpStore %6 %11 + OpBranch %28 + %28 = OpLabel + OpLoopMerge %29 %30 None + OpBranch %31 + %31 = OpLabel + %32 = OpLoad %9 %5 + %33 = OpSLessThan %13 %32 %14 + OpBranchConditional %33 %34 %29 + %34 = OpLabel + OpBranch %30 + %30 = OpLabel + %35 = OpLoad %9 %5 + %36 = OpIAdd %9 %35 %15 + OpStore %5 %36 + OpBranch %28 + %29 = OpLabel + OpBranch %37 + %37 = OpLabel + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %41 = OpLoad %9 %6 + %42 = OpSLessThan %13 %41 %16 + OpBranchConditional %42 %43 %38 + %43 = OpLabel + OpBranch %39 + %39 = OpLabel + %44 = OpLoad %9 %6 + %45 = OpIAdd %9 %44 %15 + OpStore %6 %45 + OpBranch %37 + %38 = OpLabel + OpBranch %23 + %23 = OpLabel + %46 = OpLoad %9 %4 + %47 = OpIAdd %9 %46 %15 + OpStore %4 %47 + OpBranch %21 + %22 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + EXPECT_EQ(ld.NumLoops(), 3u); + + // Invalid basic block id. + EXPECT_EQ(ld[0u], nullptr); + // Not a loop header. + EXPECT_EQ(ld[20], nullptr); + + Loop& parent_loop = *ld[21]; + EXPECT_TRUE(parent_loop.HasNestedLoops()); + EXPECT_FALSE(parent_loop.IsNested()); + EXPECT_EQ(parent_loop.GetDepth(), 1u); + EXPECT_EQ(std::distance(parent_loop.begin(), parent_loop.end()), 2u); + EXPECT_EQ(parent_loop.GetHeaderBlock(), spvtest::GetBasicBlock(f, 21)); + EXPECT_EQ(parent_loop.GetLatchBlock(), spvtest::GetBasicBlock(f, 23)); + EXPECT_EQ(parent_loop.GetMergeBlock(), spvtest::GetBasicBlock(f, 22)); + + Loop& child_loop_1 = *ld[28]; + EXPECT_FALSE(child_loop_1.HasNestedLoops()); + EXPECT_TRUE(child_loop_1.IsNested()); + EXPECT_EQ(child_loop_1.GetDepth(), 2u); + EXPECT_EQ(std::distance(child_loop_1.begin(), child_loop_1.end()), 0u); + EXPECT_EQ(child_loop_1.GetHeaderBlock(), spvtest::GetBasicBlock(f, 28)); + EXPECT_EQ(child_loop_1.GetLatchBlock(), spvtest::GetBasicBlock(f, 30)); + EXPECT_EQ(child_loop_1.GetMergeBlock(), spvtest::GetBasicBlock(f, 29)); + + Loop& child_loop_2 = *ld[37]; + EXPECT_FALSE(child_loop_2.HasNestedLoops()); + EXPECT_TRUE(child_loop_2.IsNested()); + EXPECT_EQ(child_loop_2.GetDepth(), 2u); + EXPECT_EQ(std::distance(child_loop_2.begin(), child_loop_2.end()), 0u); + EXPECT_EQ(child_loop_2.GetHeaderBlock(), spvtest::GetBasicBlock(f, 37)); + EXPECT_EQ(child_loop_2.GetLatchBlock(), spvtest::GetBasicBlock(f, 39)); + EXPECT_EQ(child_loop_2.GetMergeBlock(), spvtest::GetBasicBlock(f, 38)); +} + +static void CheckLoopBlocks(Loop* loop, + std::unordered_set* expected_ids) { + SCOPED_TRACE("Check loop " + std::to_string(loop->GetHeaderBlock()->id())); + for (uint32_t bb_id : loop->GetBlocks()) { + EXPECT_EQ(expected_ids->count(bb_id), 1u); + expected_ids->erase(bb_id); + } + EXPECT_FALSE(loop->IsInsideLoop(loop->GetMergeBlock())); + EXPECT_EQ(expected_ids->size(), 0u); +} + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + int i = 0; + for (; i < 10; ++i) { + for (int j = 0; j < 11; ++j) { + if (j < 5) { + for (int k = 0; k < 12; ++k) {} + } + else {} + for (int k = 0; k < 12; ++k) {} + } + } +}*/ +TEST_F(PassClassTest, TripleNestedLoop) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + OpName %5 "j" + OpName %6 "k" + OpName %7 "k" + OpName %3 "c" + OpDecorate %3 Location 0 + %8 = OpTypeVoid + %9 = OpTypeFunction %8 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %12 = OpConstant %10 0 + %13 = OpConstant %10 10 + %14 = OpTypeBool + %15 = OpConstant %10 11 + %16 = OpConstant %10 5 + %17 = OpConstant %10 12 + %18 = OpConstant %10 1 + %19 = OpTypeFloat 32 + %20 = OpTypeVector %19 4 + %21 = OpTypePointer Output %20 + %3 = OpVariable %21 Output + %2 = OpFunction %8 None %9 + %22 = OpLabel + %4 = OpVariable %11 Function + %5 = OpVariable %11 Function + %6 = OpVariable %11 Function + %7 = OpVariable %11 Function + OpStore %4 %12 + OpBranch %23 + %23 = OpLabel + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %27 = OpLoad %10 %4 + %28 = OpSLessThan %14 %27 %13 + OpBranchConditional %28 %29 %24 + %29 = OpLabel + OpStore %5 %12 + OpBranch %30 + %30 = OpLabel + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel + %34 = OpLoad %10 %5 + %35 = OpSLessThan %14 %34 %15 + OpBranchConditional %35 %36 %31 + %36 = OpLabel + %37 = OpLoad %10 %5 + %38 = OpSLessThan %14 %37 %16 + OpSelectionMerge %39 None + OpBranchConditional %38 %40 %39 + %40 = OpLabel + OpStore %6 %12 + OpBranch %41 + %41 = OpLabel + OpLoopMerge %42 %43 None + OpBranch %44 + %44 = OpLabel + %45 = OpLoad %10 %6 + %46 = OpSLessThan %14 %45 %17 + OpBranchConditional %46 %47 %42 + %47 = OpLabel + OpBranch %43 + %43 = OpLabel + %48 = OpLoad %10 %6 + %49 = OpIAdd %10 %48 %18 + OpStore %6 %49 + OpBranch %41 + %42 = OpLabel + OpBranch %39 + %39 = OpLabel + OpStore %7 %12 + OpBranch %50 + %50 = OpLabel + OpLoopMerge %51 %52 None + OpBranch %53 + %53 = OpLabel + %54 = OpLoad %10 %7 + %55 = OpSLessThan %14 %54 %17 + OpBranchConditional %55 %56 %51 + %56 = OpLabel + OpBranch %52 + %52 = OpLabel + %57 = OpLoad %10 %7 + %58 = OpIAdd %10 %57 %18 + OpStore %7 %58 + OpBranch %50 + %51 = OpLabel + OpBranch %32 + %32 = OpLabel + %59 = OpLoad %10 %5 + %60 = OpIAdd %10 %59 %18 + OpStore %5 %60 + OpBranch %30 + %31 = OpLabel + OpBranch %25 + %25 = OpLabel + %61 = OpLoad %10 %4 + %62 = OpIAdd %10 %61 %18 + OpStore %4 %62 + OpBranch %23 + %24 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + EXPECT_EQ(ld.NumLoops(), 4u); + + // Invalid basic block id. + EXPECT_EQ(ld[0u], nullptr); + // Not in a loop. + EXPECT_EQ(ld[22], nullptr); + + // Check that we can map basic block to the correct loop. + // The following block ids do not belong to a loop. + for (uint32_t bb_id : {22, 24}) EXPECT_EQ(ld[bb_id], nullptr); + + { + std::unordered_set basic_block_in_loop = { + {23, 26, 29, 30, 33, 36, 40, 41, 44, 47, 43, + 42, 39, 50, 53, 56, 52, 51, 32, 31, 25}}; + Loop* loop = ld[23]; + CheckLoopBlocks(loop, &basic_block_in_loop); + + EXPECT_TRUE(loop->HasNestedLoops()); + EXPECT_FALSE(loop->IsNested()); + EXPECT_EQ(loop->GetDepth(), 1u); + EXPECT_EQ(std::distance(loop->begin(), loop->end()), 1u); + EXPECT_EQ(loop->GetPreHeaderBlock(), spvtest::GetBasicBlock(f, 22)); + EXPECT_EQ(loop->GetHeaderBlock(), spvtest::GetBasicBlock(f, 23)); + EXPECT_EQ(loop->GetLatchBlock(), spvtest::GetBasicBlock(f, 25)); + EXPECT_EQ(loop->GetMergeBlock(), spvtest::GetBasicBlock(f, 24)); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetMergeBlock())); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetPreHeaderBlock())); + } + + { + std::unordered_set basic_block_in_loop = { + {30, 33, 36, 40, 41, 44, 47, 43, 42, 39, 50, 53, 56, 52, 51, 32}}; + Loop* loop = ld[30]; + CheckLoopBlocks(loop, &basic_block_in_loop); + + EXPECT_TRUE(loop->HasNestedLoops()); + EXPECT_TRUE(loop->IsNested()); + EXPECT_EQ(loop->GetDepth(), 2u); + EXPECT_EQ(std::distance(loop->begin(), loop->end()), 2u); + EXPECT_EQ(loop->GetPreHeaderBlock(), spvtest::GetBasicBlock(f, 29)); + EXPECT_EQ(loop->GetHeaderBlock(), spvtest::GetBasicBlock(f, 30)); + EXPECT_EQ(loop->GetLatchBlock(), spvtest::GetBasicBlock(f, 32)); + EXPECT_EQ(loop->GetMergeBlock(), spvtest::GetBasicBlock(f, 31)); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetMergeBlock())); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetPreHeaderBlock())); + } + + { + std::unordered_set basic_block_in_loop = {{41, 44, 47, 43}}; + Loop* loop = ld[41]; + CheckLoopBlocks(loop, &basic_block_in_loop); + + EXPECT_FALSE(loop->HasNestedLoops()); + EXPECT_TRUE(loop->IsNested()); + EXPECT_EQ(loop->GetDepth(), 3u); + EXPECT_EQ(std::distance(loop->begin(), loop->end()), 0u); + EXPECT_EQ(loop->GetPreHeaderBlock(), spvtest::GetBasicBlock(f, 40)); + EXPECT_EQ(loop->GetHeaderBlock(), spvtest::GetBasicBlock(f, 41)); + EXPECT_EQ(loop->GetLatchBlock(), spvtest::GetBasicBlock(f, 43)); + EXPECT_EQ(loop->GetMergeBlock(), spvtest::GetBasicBlock(f, 42)); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetMergeBlock())); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetPreHeaderBlock())); + } + + { + std::unordered_set basic_block_in_loop = {{50, 53, 56, 52}}; + Loop* loop = ld[50]; + CheckLoopBlocks(loop, &basic_block_in_loop); + + EXPECT_FALSE(loop->HasNestedLoops()); + EXPECT_TRUE(loop->IsNested()); + EXPECT_EQ(loop->GetDepth(), 3u); + EXPECT_EQ(std::distance(loop->begin(), loop->end()), 0u); + EXPECT_EQ(loop->GetPreHeaderBlock(), spvtest::GetBasicBlock(f, 39)); + EXPECT_EQ(loop->GetHeaderBlock(), spvtest::GetBasicBlock(f, 50)); + EXPECT_EQ(loop->GetLatchBlock(), spvtest::GetBasicBlock(f, 52)); + EXPECT_EQ(loop->GetMergeBlock(), spvtest::GetBasicBlock(f, 51)); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetMergeBlock())); + EXPECT_FALSE(loop->IsInsideLoop(loop->GetPreHeaderBlock())); + } + + // Make sure LoopDescriptor gives us the inner most loop when we query for + // loops. + for (const BasicBlock& bb : *f) { + if (Loop* loop = ld[&bb]) { + for (Loop& sub_loop : + make_range(++TreeDFIterator(loop), TreeDFIterator())) { + EXPECT_FALSE(sub_loop.IsInsideLoop(bb.id())); + } + } + } +} + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + for (int i = 0; i < 10; ++i) { + for (int j = 0; j < 11; ++j) { + for (int k = 0; k < 11; ++k) {} + } + for (int k = 0; k < 12; ++k) {} + } +} +*/ +TEST_F(PassClassTest, LoopParentTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + OpName %5 "j" + OpName %6 "k" + OpName %7 "k" + OpName %3 "c" + OpDecorate %3 Location 0 + %8 = OpTypeVoid + %9 = OpTypeFunction %8 + %10 = OpTypeInt 32 1 + %11 = OpTypePointer Function %10 + %12 = OpConstant %10 0 + %13 = OpConstant %10 10 + %14 = OpTypeBool + %15 = OpConstant %10 11 + %16 = OpConstant %10 1 + %17 = OpConstant %10 12 + %18 = OpTypeFloat 32 + %19 = OpTypeVector %18 4 + %20 = OpTypePointer Output %19 + %3 = OpVariable %20 Output + %2 = OpFunction %8 None %9 + %21 = OpLabel + %4 = OpVariable %11 Function + %5 = OpVariable %11 Function + %6 = OpVariable %11 Function + %7 = OpVariable %11 Function + OpStore %4 %12 + OpBranch %22 + %22 = OpLabel + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %10 %4 + %27 = OpSLessThan %14 %26 %13 + OpBranchConditional %27 %28 %23 + %28 = OpLabel + OpStore %5 %12 + OpBranch %29 + %29 = OpLabel + OpLoopMerge %30 %31 None + OpBranch %32 + %32 = OpLabel + %33 = OpLoad %10 %5 + %34 = OpSLessThan %14 %33 %15 + OpBranchConditional %34 %35 %30 + %35 = OpLabel + OpStore %6 %12 + OpBranch %36 + %36 = OpLabel + OpLoopMerge %37 %38 None + OpBranch %39 + %39 = OpLabel + %40 = OpLoad %10 %6 + %41 = OpSLessThan %14 %40 %15 + OpBranchConditional %41 %42 %37 + %42 = OpLabel + OpBranch %38 + %38 = OpLabel + %43 = OpLoad %10 %6 + %44 = OpIAdd %10 %43 %16 + OpStore %6 %44 + OpBranch %36 + %37 = OpLabel + OpBranch %31 + %31 = OpLabel + %45 = OpLoad %10 %5 + %46 = OpIAdd %10 %45 %16 + OpStore %5 %46 + OpBranch %29 + %30 = OpLabel + OpStore %7 %12 + OpBranch %47 + %47 = OpLabel + OpLoopMerge %48 %49 None + OpBranch %50 + %50 = OpLabel + %51 = OpLoad %10 %7 + %52 = OpSLessThan %14 %51 %17 + OpBranchConditional %52 %53 %48 + %53 = OpLabel + OpBranch %49 + %49 = OpLabel + %54 = OpLoad %10 %7 + %55 = OpIAdd %10 %54 %16 + OpStore %7 %55 + OpBranch %47 + %48 = OpLabel + OpBranch %24 + %24 = OpLabel + %56 = OpLoad %10 %4 + %57 = OpIAdd %10 %56 %16 + OpStore %4 %57 + OpBranch %22 + %23 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + EXPECT_EQ(ld.NumLoops(), 4u); + + { + Loop& loop = *ld[22]; + EXPECT_TRUE(loop.HasNestedLoops()); + EXPECT_FALSE(loop.IsNested()); + EXPECT_EQ(loop.GetDepth(), 1u); + EXPECT_EQ(loop.GetParent(), nullptr); + } + + { + Loop& loop = *ld[29]; + EXPECT_TRUE(loop.HasNestedLoops()); + EXPECT_TRUE(loop.IsNested()); + EXPECT_EQ(loop.GetDepth(), 2u); + EXPECT_EQ(loop.GetParent(), ld[22]); + } + + { + Loop& loop = *ld[36]; + EXPECT_FALSE(loop.HasNestedLoops()); + EXPECT_TRUE(loop.IsNested()); + EXPECT_EQ(loop.GetDepth(), 3u); + EXPECT_EQ(loop.GetParent(), ld[29]); + } + + { + Loop& loop = *ld[47]; + EXPECT_FALSE(loop.HasNestedLoops()); + EXPECT_TRUE(loop.IsNested()); + EXPECT_EQ(loop.GetDepth(), 2u); + EXPECT_EQ(loop.GetParent(), ld[22]); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store +The preheader of loop %33 and %41 were removed as well. + +#version 330 core +void main() { + int a = 0; + for (int i = 0; i < 10; ++i) { + if (i == 0) { + a = 1; + } else { + a = 2; + } + for (int j = 0; j < 11; ++j) { + a++; + } + } + for (int k = 0; k < 12; ++k) {} +} +*/ +TEST_F(PassClassTest, CreatePreheaderTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeInt 32 1 + %6 = OpTypePointer Function %5 + %7 = OpConstant %5 0 + %8 = OpConstant %5 10 + %9 = OpTypeBool + %10 = OpConstant %5 1 + %11 = OpConstant %5 2 + %12 = OpConstant %5 11 + %13 = OpConstant %5 12 + %14 = OpUndef %5 + %2 = OpFunction %3 None %4 + %15 = OpLabel + OpBranch %16 + %16 = OpLabel + %17 = OpPhi %5 %7 %15 %18 %19 + %20 = OpPhi %5 %7 %15 %21 %19 + %22 = OpPhi %5 %14 %15 %23 %19 + OpLoopMerge %41 %19 None + OpBranch %25 + %25 = OpLabel + %26 = OpSLessThan %9 %20 %8 + OpBranchConditional %26 %27 %41 + %27 = OpLabel + %28 = OpIEqual %9 %20 %7 + OpSelectionMerge %33 None + OpBranchConditional %28 %30 %31 + %30 = OpLabel + OpBranch %33 + %31 = OpLabel + OpBranch %33 + %33 = OpLabel + %18 = OpPhi %5 %10 %30 %11 %31 %34 %35 + %23 = OpPhi %5 %7 %30 %7 %31 %36 %35 + OpLoopMerge %37 %35 None + OpBranch %38 + %38 = OpLabel + %39 = OpSLessThan %9 %23 %12 + OpBranchConditional %39 %40 %37 + %40 = OpLabel + %34 = OpIAdd %5 %18 %10 + OpBranch %35 + %35 = OpLabel + %36 = OpIAdd %5 %23 %10 + OpBranch %33 + %37 = OpLabel + OpBranch %19 + %19 = OpLabel + %21 = OpIAdd %5 %20 %10 + OpBranch %16 + %41 = OpLabel + %42 = OpPhi %5 %7 %25 %43 %44 + OpLoopMerge %45 %44 None + OpBranch %46 + %46 = OpLabel + %47 = OpSLessThan %9 %42 %13 + OpBranchConditional %47 %48 %45 + %48 = OpLabel + OpBranch %44 + %44 = OpLabel + %43 = OpIAdd %5 %42 %10 + OpBranch %41 + %45 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + // No invalidation of the cfg should occur during this test. + CFG* cfg = context->cfg(); + + EXPECT_EQ(ld.NumLoops(), 3u); + + { + Loop& loop = *ld[16]; + EXPECT_TRUE(loop.HasNestedLoops()); + EXPECT_FALSE(loop.IsNested()); + EXPECT_EQ(loop.GetDepth(), 1u); + EXPECT_EQ(loop.GetParent(), nullptr); + } + + { + Loop& loop = *ld[33]; + EXPECT_EQ(loop.GetPreHeaderBlock(), nullptr); + EXPECT_NE(loop.GetOrCreatePreHeaderBlock(), nullptr); + // Make sure the loop descriptor was properly updated. + EXPECT_EQ(ld[loop.GetPreHeaderBlock()], ld[16]); + { + const std::vector& preds = + cfg->preds(loop.GetPreHeaderBlock()->id()); + std::unordered_set pred_set(preds.begin(), preds.end()); + EXPECT_EQ(pred_set.size(), 2u); + EXPECT_TRUE(pred_set.count(30)); + EXPECT_TRUE(pred_set.count(31)); + // Check the phi instructions. + loop.GetPreHeaderBlock()->ForEachPhiInst([&pred_set](Instruction* phi) { + for (uint32_t i = 1; i < phi->NumInOperands(); i += 2) { + EXPECT_TRUE(pred_set.count(phi->GetSingleWordInOperand(i))); + } + }); + } + { + const std::vector& preds = + cfg->preds(loop.GetHeaderBlock()->id()); + std::unordered_set pred_set(preds.begin(), preds.end()); + EXPECT_EQ(pred_set.size(), 2u); + EXPECT_TRUE(pred_set.count(loop.GetPreHeaderBlock()->id())); + EXPECT_TRUE(pred_set.count(35)); + // Check the phi instructions. + loop.GetHeaderBlock()->ForEachPhiInst([&pred_set](Instruction* phi) { + for (uint32_t i = 1; i < phi->NumInOperands(); i += 2) { + EXPECT_TRUE(pred_set.count(phi->GetSingleWordInOperand(i))); + } + }); + } + } + + { + Loop& loop = *ld[41]; + EXPECT_EQ(loop.GetPreHeaderBlock(), nullptr); + EXPECT_NE(loop.GetOrCreatePreHeaderBlock(), nullptr); + EXPECT_EQ(ld[loop.GetPreHeaderBlock()], nullptr); + EXPECT_EQ(cfg->preds(loop.GetPreHeaderBlock()->id()).size(), 1u); + EXPECT_EQ(cfg->preds(loop.GetPreHeaderBlock()->id())[0], 25u); + // Check the phi instructions. + loop.GetPreHeaderBlock()->ForEachPhiInst([](Instruction* phi) { + EXPECT_EQ(phi->NumInOperands(), 2u); + EXPECT_EQ(phi->GetSingleWordInOperand(1), 25u); + }); + { + const std::vector& preds = + cfg->preds(loop.GetHeaderBlock()->id()); + std::unordered_set pred_set(preds.begin(), preds.end()); + EXPECT_EQ(pred_set.size(), 2u); + EXPECT_TRUE(pred_set.count(loop.GetPreHeaderBlock()->id())); + EXPECT_TRUE(pred_set.count(44)); + // Check the phi instructions. + loop.GetHeaderBlock()->ForEachPhiInst([&pred_set](Instruction* phi) { + for (uint32_t i = 1; i < phi->NumInOperands(); i += 2) { + EXPECT_TRUE(pred_set.count(phi->GetSingleWordInOperand(i))); + } + }); + } + } + + // Make sure pre-header insertion leaves the module valid. + std::vector bin; + context->module()->ToBinary(&bin, true); + EXPECT_TRUE(Validate(bin)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/peeling.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/peeling.cpp new file mode 100644 index 00000000000..e5db20b4083 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/peeling.cpp @@ -0,0 +1,1193 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/ir_builder.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_peeling.h" +#include "test/opt/pass_fixture.h" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +using PeelingTest = PassTest<::testing::Test>; + +bool Validate(const std::vector& bin) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {bin.data(), bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + return error == 0; +} + +void Match(const std::string& checks, IRContext* context) { + // Silence unused warnings with !defined(SPIRV_EFFCE) + (void)checks; + + std::vector bin; + context->module()->ToBinary(&bin, true); + EXPECT_TRUE(Validate(bin)); +#ifdef SPIRV_EFFCEE + std::string assembly; + SpirvTools tools(SPV_ENV_UNIVERSAL_1_2); + EXPECT_TRUE( + tools.Disassemble(bin, &assembly, SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)) + << "Disassembling failed for shader:\n" + << assembly << std::endl; + auto match_result = effcee::Match(assembly, checks); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << assembly; +#else // ! SPIRV_EFFCEE + (void)checks; +#endif +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +First test: +#version 330 core +void main() { + for(int i = 0; i < 10; ++i) { + if (i < 4) + break; + } +} + +Second test (with a common sub-expression elimination): +#version 330 core +void main() { + for(int i = 0; i + 1 < 10; ++i) { + } +} + +Third test: +#version 330 core +void main() { + int a[10]; + for (int i = 0; a[i] != 0; i++) {} +} + +Forth test: +#version 330 core +void main() { + for (long i = 0; i < 10; i++) {} +} + +Fifth test: +#version 330 core +void main() { + for (float i = 0; i < 10; i++) {} +} + +Sixth test: +#version 450 +layout(location = 0)out float o; +void main() { + o = 0.0; + for( int i = 0; true; i++ ) { + o += 1.0; + if (i > 10) break; + } +} +*/ +TEST_F(PeelingTest, CannotPeel) { + // Build the given SPIR-V program in |text|, take the first loop in the first + // function and test that it is not peelable. |loop_count_id| is the id + // representing the loop count, if equals to 0, then the function build a 10 + // constant as loop count. + auto test_cannot_peel = [](const std::string& text, uint32_t loop_count_id) { + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + Instruction* loop_count = nullptr; + if (loop_count_id) { + loop_count = context->get_def_use_mgr()->GetDef(loop_count_id); + } else { + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + loop_count = builder.Add32BitSignedIntegerConstant(10); + } + + LoopPeeling peel(&*ld.begin(), loop_count); + EXPECT_FALSE(peel.CanPeelLoop()); + }; + { + SCOPED_TRACE("loop with break"); + + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_4 = OpConstant %int 4 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %28 = OpPhi %int %int_0 %5 %27 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %bool %28 %int_10 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %21 = OpSLessThan %bool %28 %int_4 + OpSelectionMerge %23 None + OpBranchConditional %21 %22 %23 + %22 = OpLabel + OpBranch %12 + %23 = OpLabel + OpBranch %13 + %13 = OpLabel + %27 = OpIAdd %int %28 %int_1 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + test_cannot_peel(text, 0); + } + + { + SCOPED_TRACE("Ambiguous iterator update"); + + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %23 = OpPhi %int %int_0 %5 %17 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %17 = OpIAdd %int %23 %int_1 + %20 = OpSLessThan %bool %17 %int_10 + OpBranchConditional %20 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + test_cannot_peel(text, 0); + } + + { + SCOPED_TRACE("No loop static bounds"); + + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + OpName %i "i" + OpName %a "a" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + %a = OpVariable %_ptr_Function__arr_int_uint_10 Function + OpStore %i %int_0 + OpBranch %10 + %10 = OpLabel + %28 = OpPhi %int %int_0 %5 %27 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %21 = OpAccessChain %_ptr_Function_int %a %28 + %22 = OpLoad %int %21 + %24 = OpINotEqual %bool %22 %int_0 + OpBranchConditional %24 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %27 = OpIAdd %int %28 %int_1 + OpStore %i %27 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + test_cannot_peel(text, 22); + } + { + SCOPED_TRACE("Int 64 type for conditions"); + + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginLowerLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + %6 = OpTypeVoid + %3 = OpTypeFunction %6 + %7 = OpTypeInt 64 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %15 = OpConstant %7 10 + %16 = OpTypeBool + %17 = OpConstant %7 1 + %2 = OpFunction %6 None %3 + %5 = OpLabel + %4 = OpVariable %8 Function + OpStore %4 %9 + OpBranch %10 + %10 = OpLabel + %22 = OpPhi %7 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %16 %22 %15 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %7 %22 %17 + OpStore %4 %21 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + // %15 is a constant for a 64 int. Currently rejected. + test_cannot_peel(text, 15); + } + { + SCOPED_TRACE("Float type for conditions"); + + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginLowerLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %4 "i" + %6 = OpTypeVoid + %3 = OpTypeFunction %6 + %7 = OpTypeFloat 32 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %15 = OpConstant %7 10 + %16 = OpTypeBool + %17 = OpConstant %7 1 + %2 = OpFunction %6 None %3 + %5 = OpLabel + %4 = OpVariable %8 Function + OpStore %4 %9 + OpBranch %10 + %10 = OpLabel + %22 = OpPhi %7 %9 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpFOrdLessThan %16 %22 %15 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpFAdd %7 %22 %17 + OpStore %4 %21 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + // %15 is a constant for a float. Currently rejected. + test_cannot_peel(text, 15); + } + { + SCOPED_TRACE("Side effect before exit"); + + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 450 + OpName %main "main" + OpName %o "o" + OpName %i "i" + OpDecorate %o Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %o = OpVariable %_ptr_Output_float Output + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %true = OpConstantTrue %bool + %float_1 = OpConstant %float 1 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %i = OpVariable %_ptr_Function_int Function + OpStore %o %float_0 + OpStore %i %int_0 + OpBranch %14 + %14 = OpLabel + %33 = OpPhi %int %int_0 %5 %32 %17 + OpLoopMerge %16 %17 None + OpBranch %15 + %15 = OpLabel + %22 = OpLoad %float %o + %23 = OpFAdd %float %22 %float_1 + OpStore %o %23 + %26 = OpSGreaterThan %bool %33 %int_10 + OpSelectionMerge %28 None + OpBranchConditional %26 %27 %28 + %27 = OpLabel + OpBranch %16 + %28 = OpLabel + OpBranch %17 + %17 = OpLabel + %32 = OpIAdd %int %33 %int_1 + OpStore %i %32 + OpBranch %14 + %16 = OpLabel + OpReturn + OpFunctionEnd + )"; + test_cannot_peel(text, 0); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +void main() { + int i = 0; + for (; i < 10; i++) {} +} +*/ +TEST_F(PeelingTest, SimplePeeling) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %22 = OpPhi %int %int_0 %5 %21 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %bool %22 %int_10 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %13 + %13 = OpLabel + %21 = OpIAdd %int %22 %int_1 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + // Peel before. + { + SCOPED_TRACE("Peel before"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + Instruction* ten_cst = builder.Add32BitSignedIntegerConstant(10); + + LoopPeeling peel(&*ld.begin(), ten_cst); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelBefore(2); + + const std::string check = R"( +CHECK: [[CST_TEN:%\w+]] = OpConstant {{%\w+}} 10 +CHECK: [[CST_TWO:%\w+]] = OpConstant {{%\w+}} 2 +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} [[CST_TWO]] [[CST_TEN]] +CHECK-NEXT: [[LOOP_COUNT:%\w+]] = OpSelect {{%\w+}} [[MIN_LOOP_COUNT]] [[CST_TWO]] [[CST_TEN]] +CHECK: [[BEFORE_LOOP:%\w+]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[i:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[AFTER_LOOP_PREHEADER:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[AFTER_LOOP_PREHEADER]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[i]] +CHECK-NEXT: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[AFTER_LOOP_PREHEADER]] = OpLabel +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[AFTER_LOOP:%\w+]] [[IF_MERGE]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[i]] [[AFTER_LOOP_PREHEADER]] +CHECK-NEXT: OpLoopMerge +)"; + + Match(check, context.get()); + } + + // Peel after. + { + SCOPED_TRACE("Peel after"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + Instruction* ten_cst = builder.Add32BitSignedIntegerConstant(10); + + LoopPeeling peel(&*ld.begin(), ten_cst); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelAfter(2); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[BEFORE_LOOP:%\w+]] [[IF_MERGE]] +CHECK: [[BEFORE_LOOP]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[I:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[BEFORE_LOOP_MERGE:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[TMP:%\w+]] = OpIAdd {{%\w+}} [[DUMMY_IT]] {{%\w+}} +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[TMP]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[BEFORE_LOOP_MERGE]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[I]] +CHECK-NEXT: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[IF_MERGE]] = OpLabel +CHECK-NEXT: [[TMP:%\w+]] = OpPhi {{%\w+}} [[I]] [[BEFORE_LOOP_MERGE]] +CHECK-NEXT: OpBranch [[AFTER_LOOP:%\w+]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[TMP]] [[IF_MERGE]] +CHECK-NEXT: OpLoopMerge + +)"; + + Match(check, context.get()); + } + + // Same as above, but reuse the induction variable. + // Peel before. + { + SCOPED_TRACE("Peel before with IV reuse"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + Instruction* ten_cst = builder.Add32BitSignedIntegerConstant(10); + + LoopPeeling peel(&*ld.begin(), ten_cst, + context->get_def_use_mgr()->GetDef(22)); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelBefore(2); + + const std::string check = R"( +CHECK: [[CST_TEN:%\w+]] = OpConstant {{%\w+}} 10 +CHECK: [[CST_TWO:%\w+]] = OpConstant {{%\w+}} 2 +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} [[CST_TWO]] [[CST_TEN]] +CHECK-NEXT: [[LOOP_COUNT:%\w+]] = OpSelect {{%\w+}} [[MIN_LOOP_COUNT]] [[CST_TWO]] [[CST_TEN]] +CHECK: [[BEFORE_LOOP:%\w+]] = OpLabel +CHECK-NEXT: [[i:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: OpLoopMerge [[AFTER_LOOP_PREHEADER:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[i]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[AFTER_LOOP_PREHEADER]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[i]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[AFTER_LOOP_PREHEADER]] = OpLabel +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[AFTER_LOOP:%\w+]] [[IF_MERGE]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[i]] [[AFTER_LOOP_PREHEADER]] +CHECK-NEXT: OpLoopMerge +)"; + + Match(check, context.get()); + } + + // Peel after. + { + SCOPED_TRACE("Peel after IV reuse"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + Instruction* ten_cst = builder.Add32BitSignedIntegerConstant(10); + + LoopPeeling peel(&*ld.begin(), ten_cst, + context->get_def_use_mgr()->GetDef(22)); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelAfter(2); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[BEFORE_LOOP:%\w+]] [[IF_MERGE]] +CHECK: [[BEFORE_LOOP]] = OpLabel +CHECK-NEXT: [[I:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: OpLoopMerge [[BEFORE_LOOP_MERGE:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[TMP:%\w+]] = OpIAdd {{%\w+}} [[I]] {{%\w+}} +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[TMP]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[BEFORE_LOOP_MERGE]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[I]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[IF_MERGE]] = OpLabel +CHECK-NEXT: [[TMP:%\w+]] = OpPhi {{%\w+}} [[I]] [[BEFORE_LOOP_MERGE]] +CHECK-NEXT: OpBranch [[AFTER_LOOP:%\w+]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[TMP]] [[IF_MERGE]] +CHECK-NEXT: OpLoopMerge + +)"; + + Match(check, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +void main() { + int a[10]; + int n = a[0]; + for(int i = 0; i < n; ++i) {} +} +*/ +TEST_F(PeelingTest, PeelingUncountable) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + OpName %a "a" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %uint = OpTypeInt 32 0 + %uint_10 = OpConstant %uint 10 +%_arr_int_uint_10 = OpTypeArray %int %uint_10 +%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10 + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function__arr_int_uint_10 Function + %15 = OpAccessChain %_ptr_Function_int %a %int_0 + %16 = OpLoad %int %15 + OpBranch %18 + %18 = OpLabel + %30 = OpPhi %int %int_0 %5 %29 %21 + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %26 = OpSLessThan %bool %30 %16 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + OpBranch %21 + %21 = OpLabel + %29 = OpIAdd %int %30 %int_1 + OpBranch %18 + %20 = OpLabel + OpReturn + OpFunctionEnd + )"; + + // Peel before. + { + SCOPED_TRACE("Peel before"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + Instruction* loop_count = context->get_def_use_mgr()->GetDef(16); + EXPECT_EQ(loop_count->opcode(), SpvOpLoad); + + LoopPeeling peel(&*ld.begin(), loop_count); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelBefore(1); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[LOOP_COUNT:%\w+]] = OpLoad +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} {{%\w+}} [[LOOP_COUNT]] +CHECK-NEXT: [[LOOP_COUNT:%\w+]] = OpSelect {{%\w+}} [[MIN_LOOP_COUNT]] {{%\w+}} [[LOOP_COUNT]] +CHECK: [[BEFORE_LOOP:%\w+]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[i:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[AFTER_LOOP_PREHEADER:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[AFTER_LOOP_PREHEADER]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[i]] +CHECK-NEXT: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[AFTER_LOOP_PREHEADER]] = OpLabel +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[AFTER_LOOP:%\w+]] [[IF_MERGE]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[i]] [[AFTER_LOOP_PREHEADER]] +CHECK-NEXT: OpLoopMerge +)"; + + Match(check, context.get()); + } + + // Peel after. + { + SCOPED_TRACE("Peel after"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + Instruction* loop_count = context->get_def_use_mgr()->GetDef(16); + EXPECT_EQ(loop_count->opcode(), SpvOpLoad); + + LoopPeeling peel(&*ld.begin(), loop_count); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelAfter(1); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[BEFORE_LOOP:%\w+]] [[IF_MERGE]] +CHECK: [[BEFORE_LOOP]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[I:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[BEFORE_LOOP_MERGE:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[TMP:%\w+]] = OpIAdd {{%\w+}} [[DUMMY_IT]] {{%\w+}} +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[TMP]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[BEFORE_LOOP_MERGE]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[I]] +CHECK-NEXT: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[IF_MERGE]] = OpLabel +CHECK-NEXT: [[TMP:%\w+]] = OpPhi {{%\w+}} [[I]] [[BEFORE_LOOP_MERGE]] +CHECK-NEXT: OpBranch [[AFTER_LOOP:%\w+]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[TMP]] [[IF_MERGE]] +CHECK-NEXT: OpLoopMerge + +)"; + + Match(check, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +void main() { + int i = 0; + do { + i++; + } while (i < 10); +} +*/ +TEST_F(PeelingTest, DoWhilePeeling) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %21 = OpPhi %int %int_0 %5 %16 %13 + OpLoopMerge %12 %13 None + OpBranch %11 + %11 = OpLabel + %16 = OpIAdd %int %21 %int_1 + OpBranch %13 + %13 = OpLabel + %20 = OpSLessThan %bool %16 %int_10 + OpBranchConditional %20 %10 %12 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + // Peel before. + { + SCOPED_TRACE("Peel before"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + Instruction* ten_cst = builder.Add32BitUnsignedIntegerConstant(10); + + LoopPeeling peel(&*ld.begin(), ten_cst); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelBefore(2); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpULessThan {{%\w+}} +CHECK-NEXT: [[LOOP_COUNT:%\w+]] = OpSelect {{%\w+}} [[MIN_LOOP_COUNT]] +CHECK: [[BEFORE_LOOP:%\w+]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[i:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[AFTER_LOOP_PREHEADER:%\w+]] [[BE]] None +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[i]] +CHECK: [[BE]] = OpLabel +CHECK: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpULessThan {{%\w+}} [[DUMMY_IT_1]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] [[BEFORE_LOOP]] [[AFTER_LOOP_PREHEADER]] + +CHECK: [[AFTER_LOOP_PREHEADER]] = OpLabel +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[AFTER_LOOP:%\w+]] [[IF_MERGE]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[I_1]] [[AFTER_LOOP_PREHEADER]] +CHECK-NEXT: OpLoopMerge +)"; + + Match(check, context.get()); + } + + // Peel after. + { + SCOPED_TRACE("Peel after"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + InstructionBuilder builder(context.get(), &*f.begin()); + // Exit condition. + Instruction* ten_cst = builder.Add32BitUnsignedIntegerConstant(10); + + LoopPeeling peel(&*ld.begin(), ten_cst); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelAfter(2); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpULessThan {{%\w+}} +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[BEFORE_LOOP:%\w+]] [[IF_MERGE]] +CHECK: [[BEFORE_LOOP]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[I:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[BEFORE_LOOP_MERGE:%\w+]] [[BE]] None +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[I]] +CHECK: [[BE]] = OpLabel +CHECK: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: [[EXIT_VAL:%\w+]] = OpIAdd {{%\w+}} [[DUMMY_IT_1]] +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpULessThan {{%\w+}} [[EXIT_VAL]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] [[BEFORE_LOOP]] [[BEFORE_LOOP_MERGE]] + +CHECK: [[IF_MERGE]] = OpLabel +CHECK-NEXT: [[TMP:%\w+]] = OpPhi {{%\w+}} [[I_1]] [[BEFORE_LOOP_MERGE]] +CHECK-NEXT: OpBranch [[AFTER_LOOP:%\w+]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[TMP]] [[IF_MERGE]] +CHECK-NEXT: OpLoopMerge +)"; + + Match(check, context.get()); + } +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +void main() { + int a[10]; + int n = a[0]; + for(int i = 0; i < n; ++i) {} +} +*/ +TEST_F(PeelingTest, PeelingLoopWithStore) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o %n + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 450 + OpName %main "main" + OpName %o "o" + OpName %end "end" + OpName %n "n" + OpName %i "i" + OpDecorate %o Location 0 + OpDecorate %n Flat + OpDecorate %n Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %o = OpVariable %_ptr_Output_float Output + %float_0 = OpConstant %float 0 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%_ptr_Input_int = OpTypePointer Input %int + %n = OpVariable %_ptr_Input_int Input + %int_0 = OpConstant %int 0 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %end = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %o %float_0 + %15 = OpLoad %int %n + OpStore %end %15 + OpStore %i %int_0 + OpBranch %18 + %18 = OpLabel + %33 = OpPhi %int %int_0 %5 %32 %21 + OpLoopMerge %20 %21 None + OpBranch %22 + %22 = OpLabel + %26 = OpSLessThan %bool %33 %15 + OpBranchConditional %26 %19 %20 + %19 = OpLabel + %28 = OpLoad %float %o + %29 = OpFAdd %float %28 %float_1 + OpStore %o %29 + OpBranch %21 + %21 = OpLabel + %32 = OpIAdd %int %33 %int_1 + OpStore %i %32 + OpBranch %18 + %20 = OpLabel + OpReturn + OpFunctionEnd + )"; + + // Peel before. + { + SCOPED_TRACE("Peel before"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + Instruction* loop_count = context->get_def_use_mgr()->GetDef(15); + EXPECT_EQ(loop_count->opcode(), SpvOpLoad); + + LoopPeeling peel(&*ld.begin(), loop_count); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelBefore(1); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[LOOP_COUNT:%\w+]] = OpLoad +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} {{%\w+}} [[LOOP_COUNT]] +CHECK-NEXT: [[LOOP_COUNT:%\w+]] = OpSelect {{%\w+}} [[MIN_LOOP_COUNT]] {{%\w+}} [[LOOP_COUNT]] +CHECK: [[BEFORE_LOOP:%\w+]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[i:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[AFTER_LOOP_PREHEADER:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[AFTER_LOOP_PREHEADER]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[i]] +CHECK: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[AFTER_LOOP_PREHEADER]] = OpLabel +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[AFTER_LOOP:%\w+]] [[IF_MERGE]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[i]] [[AFTER_LOOP_PREHEADER]] +CHECK-NEXT: OpLoopMerge +)"; + + Match(check, context.get()); + } + + // Peel after. + { + SCOPED_TRACE("Peel after"); + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function& f = *module->begin(); + LoopDescriptor& ld = *context->GetLoopDescriptor(&f); + + EXPECT_EQ(ld.NumLoops(), 1u); + + Instruction* loop_count = context->get_def_use_mgr()->GetDef(15); + EXPECT_EQ(loop_count->opcode(), SpvOpLoad); + + LoopPeeling peel(&*ld.begin(), loop_count); + EXPECT_TRUE(peel.CanPeelLoop()); + peel.PeelAfter(1); + + const std::string check = R"( +CHECK: OpFunction +CHECK-NEXT: [[ENTRY:%\w+]] = OpLabel +CHECK: [[MIN_LOOP_COUNT:%\w+]] = OpSLessThan {{%\w+}} +CHECK-NEXT: OpSelectionMerge [[IF_MERGE:%\w+]] +CHECK-NEXT: OpBranchConditional [[MIN_LOOP_COUNT]] [[BEFORE_LOOP:%\w+]] [[IF_MERGE]] +CHECK: [[BEFORE_LOOP]] = OpLabel +CHECK-NEXT: [[DUMMY_IT:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[DUMMY_IT_1:%\w+]] [[BE:%\w+]] +CHECK-NEXT: [[I:%\w+]] = OpPhi {{%\w+}} {{%\w+}} [[ENTRY]] [[I_1:%\w+]] [[BE]] +CHECK-NEXT: OpLoopMerge [[BEFORE_LOOP_MERGE:%\w+]] [[BE]] None +CHECK: [[COND_BLOCK:%\w+]] = OpLabel +CHECK-NEXT: OpSLessThan +CHECK-NEXT: [[TMP:%\w+]] = OpIAdd {{%\w+}} [[DUMMY_IT]] {{%\w+}} +CHECK-NEXT: [[EXIT_COND:%\w+]] = OpSLessThan {{%\w+}} [[TMP]] +CHECK-NEXT: OpBranchConditional [[EXIT_COND]] {{%\w+}} [[BEFORE_LOOP_MERGE]] +CHECK: [[I_1]] = OpIAdd {{%\w+}} [[I]] +CHECK: [[DUMMY_IT_1]] = OpIAdd {{%\w+}} [[DUMMY_IT]] +CHECK-NEXT: OpBranch [[BEFORE_LOOP]] + +CHECK: [[IF_MERGE]] = OpLabel +CHECK-NEXT: [[TMP:%\w+]] = OpPhi {{%\w+}} [[I]] [[BEFORE_LOOP_MERGE]] +CHECK-NEXT: OpBranch [[AFTER_LOOP:%\w+]] + +CHECK: [[AFTER_LOOP]] = OpLabel +CHECK-NEXT: OpPhi {{%\w+}} {{%\w+}} {{%\w+}} [[TMP]] [[IF_MERGE]] +CHECK-NEXT: OpLoopMerge + +)"; + + Match(check, context.get()); + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp new file mode 100644 index 00000000000..284ad838d41 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/peeling_pass.cpp @@ -0,0 +1,1099 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/ir_builder.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/loop_peeling.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +class PeelingPassTest : public PassTest<::testing::Test> { + public: + // Generic routine to run the loop peeling pass and check + LoopPeelingPass::LoopPeelingStats AssembleAndRunPeelingTest( + const std::string& text_head, const std::string& text_tail, SpvOp opcode, + const std::string& res_id, const std::string& op1, + const std::string& op2) { + std::string opcode_str; + switch (opcode) { + case SpvOpSLessThan: + opcode_str = "OpSLessThan"; + break; + case SpvOpSGreaterThan: + opcode_str = "OpSGreaterThan"; + break; + case SpvOpSLessThanEqual: + opcode_str = "OpSLessThanEqual"; + break; + case SpvOpSGreaterThanEqual: + opcode_str = "OpSGreaterThanEqual"; + break; + case SpvOpIEqual: + opcode_str = "OpIEqual"; + break; + case SpvOpINotEqual: + opcode_str = "OpINotEqual"; + break; + default: + assert(false && "Unhandled"); + break; + } + std::string test_cond = + res_id + " = " + opcode_str + " %bool " + op1 + " " + op2 + "\n"; + + LoopPeelingPass::LoopPeelingStats stats; + SinglePassRunAndDisassemble( + text_head + test_cond + text_tail, true, true, &stats); + + return stats; + } + + // Generic routine to run the loop peeling pass and check + LoopPeelingPass::LoopPeelingStats RunPeelingTest( + const std::string& text_head, const std::string& text_tail, SpvOp opcode, + const std::string& res_id, const std::string& op1, const std::string& op2, + size_t nb_of_loops) { + LoopPeelingPass::LoopPeelingStats stats = AssembleAndRunPeelingTest( + text_head, text_tail, opcode, res_id, op1, op2); + + Function& f = *context()->module()->begin(); + LoopDescriptor& ld = *context()->GetLoopDescriptor(&f); + EXPECT_EQ(ld.NumLoops(), nb_of_loops); + + return stats; + } + + using PeelTraceType = + std::vector>; + + void BuildAndCheckTrace(const std::string& text_head, + const std::string& text_tail, SpvOp opcode, + const std::string& res_id, const std::string& op1, + const std::string& op2, + const PeelTraceType& expected_peel_trace, + size_t expected_nb_of_loops) { + auto stats = RunPeelingTest(text_head, text_tail, opcode, res_id, op1, op2, + expected_nb_of_loops); + + EXPECT_EQ(stats.peeled_loops_.size(), expected_peel_trace.size()); + if (stats.peeled_loops_.size() != expected_peel_trace.size()) { + return; + } + + PeelTraceType::const_iterator expected_trace_it = + expected_peel_trace.begin(); + decltype(stats.peeled_loops_)::const_iterator stats_it = + stats.peeled_loops_.begin(); + + while (expected_trace_it != expected_peel_trace.end()) { + EXPECT_EQ(expected_trace_it->first, std::get<1>(*stats_it)); + EXPECT_EQ(expected_trace_it->second, std::get<2>(*stats_it)); + ++expected_trace_it; + ++stats_it; + } + } +}; + +/* +Test are derivation of the following generated test from the following GLSL + +--eliminate-local-multi-store + +#version 330 core +void main() { + int a = 0; + for(int i = 1; i < 10; i += 2) { + if (i < 3) { + a += 2; + } + } +} + +The condition is interchanged to test < > <= >= == and peel before/after +opportunities. +*/ +TEST_F(PeelingPassTest, PeelingPassBasic) { + const std::string text_head = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + OpName %a "a" + OpName %i "i" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_20 = OpConstant %int 20 + %int_19 = OpConstant %int 19 + %int_18 = OpConstant %int 18 + %int_17 = OpConstant %int 17 + %int_16 = OpConstant %int 16 + %int_15 = OpConstant %int 15 + %int_14 = OpConstant %int 14 + %int_13 = OpConstant %int 13 + %int_12 = OpConstant %int 12 + %int_11 = OpConstant %int 11 + %int_10 = OpConstant %int 10 + %int_9 = OpConstant %int 9 + %int_8 = OpConstant %int 8 + %int_7 = OpConstant %int 7 + %int_6 = OpConstant %int 6 + %int_5 = OpConstant %int 5 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %11 + %11 = OpLabel + %31 = OpPhi %int %int_0 %5 %33 %14 + %32 = OpPhi %int %int_1 %5 %30 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %bool %32 %int_20 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + )"; + const std::string text_tail = R"( + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %27 = OpIAdd %int %31 %int_2 + OpStore %a %27 + OpBranch %24 + %24 = OpLabel + %33 = OpPhi %int %31 %12 %27 %23 + OpBranch %14 + %14 = OpLabel + %30 = OpIAdd %int %32 %int_2 + OpStore %i %30 + OpBranch %11 + %13 = OpLabel + OpReturn + OpFunctionEnd + )"; + + auto run_test = [&text_head, &text_tail, this](SpvOp opcode, + const std::string& op1, + const std::string& op2) { + auto stats = + RunPeelingTest(text_head, text_tail, opcode, "%22", op1, op2, 2); + + EXPECT_EQ(stats.peeled_loops_.size(), 1u); + if (stats.peeled_loops_.size() != 1u) + return std::pair{ + LoopPeelingPass::PeelDirection::kNone, 0}; + + return std::pair{ + std::get<1>(*stats.peeled_loops_.begin()), + std::get<2>(*stats.peeled_loops_.begin())}; + }; + + // Test LT + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv < 4"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%32", "%int_4"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 4 > iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%int_4", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before iv < 5"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%32", "%int_5"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 5 > iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%int_5", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv < 16"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%32", "%int_16"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 16 > iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%int_16", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after iv < 17"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%32", "%int_17"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 17 > iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%int_17", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + + // Test GT + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv > 5"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%32", "%int_5"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 5 < iv"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%int_5", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before iv > 4"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%32", "%int_4"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 4 < iv"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%int_4", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv > 16"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%32", "%int_16"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 16 < iv"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%int_16", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after iv > 17"); + + std::pair peel_info = + run_test(SpvOpSGreaterThan, "%32", "%int_17"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 17 < iv"); + + std::pair peel_info = + run_test(SpvOpSLessThan, "%int_17", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + + // Test LE + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv <= 4"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%32", "%int_4"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 4 => iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%int_4", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before iv <= 3"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%32", "%int_3"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 3 => iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%int_3", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv <= 16"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%32", "%int_16"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 16 => iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%int_16", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after iv <= 15"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%32", "%int_15"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 15 => iv"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%int_15", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + + // Test GE + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv >= 5"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%32", "%int_5"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 35 >= iv"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%int_5", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before iv >= 4"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%32", "%int_4"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel before 4 <= iv"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%int_4", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 2u); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv >= 17"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%32", "%int_17"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 17 <= iv"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%int_17", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after iv >= 16"); + + std::pair peel_info = + run_test(SpvOpSGreaterThanEqual, "%32", "%int_16"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + { + SCOPED_TRACE("Peel after 16 <= iv"); + + std::pair peel_info = + run_test(SpvOpSLessThanEqual, "%int_16", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 2u); + } + + // Test EQ + // Peel before by a factor of 1. + { + SCOPED_TRACE("Peel before iv == 1"); + + std::pair peel_info = + run_test(SpvOpIEqual, "%32", "%int_1"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 1u); + } + { + SCOPED_TRACE("Peel before 1 == iv"); + + std::pair peel_info = + run_test(SpvOpIEqual, "%int_1", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 1u); + } + + // Peel after by a factor of 1. + { + SCOPED_TRACE("Peel after iv == 19"); + + std::pair peel_info = + run_test(SpvOpIEqual, "%32", "%int_19"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 1u); + } + { + SCOPED_TRACE("Peel after 19 == iv"); + + std::pair peel_info = + run_test(SpvOpIEqual, "%int_19", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 1u); + } + + // Test NE + // Peel before by a factor of 1. + { + SCOPED_TRACE("Peel before iv != 1"); + + std::pair peel_info = + run_test(SpvOpINotEqual, "%32", "%int_1"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 1u); + } + { + SCOPED_TRACE("Peel before 1 != iv"); + + std::pair peel_info = + run_test(SpvOpINotEqual, "%int_1", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kBefore); + EXPECT_EQ(peel_info.second, 1u); + } + + // Peel after by a factor of 1. + { + SCOPED_TRACE("Peel after iv != 19"); + + std::pair peel_info = + run_test(SpvOpINotEqual, "%32", "%int_19"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 1u); + } + { + SCOPED_TRACE("Peel after 19 != iv"); + + std::pair peel_info = + run_test(SpvOpINotEqual, "%int_19", "%32"); + EXPECT_EQ(peel_info.first, LoopPeelingPass::PeelDirection::kAfter); + EXPECT_EQ(peel_info.second, 1u); + } + + // No peel. + { + SCOPED_TRACE("No Peel: 20 => iv"); + + auto stats = RunPeelingTest(text_head, text_tail, SpvOpSLessThanEqual, + "%22", "%int_20", "%32", 1); + + EXPECT_EQ(stats.peeled_loops_.size(), 0u); + } +} + +/* +Test are derivation of the following generated test from the following GLSL + +--eliminate-local-multi-store + +#version 330 core +void main() { + int a = 0; + for(int i = 0; i < 10; ++i) { + if (i < 3) { + a += 2; + } + if (i < 1) { + a += 2; + } + } +} + +The condition is interchanged to test < > <= >= == and peel before/after +opportunities. +*/ +TEST_F(PeelingPassTest, MultiplePeelingPass) { + const std::string text_head = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + OpName %a "a" + OpName %i "i" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %bool = OpTypeBool + %int_10 = OpConstant %int 10 + %int_9 = OpConstant %int 9 + %int_8 = OpConstant %int 8 + %int_7 = OpConstant %int 7 + %int_6 = OpConstant %int 6 + %int_5 = OpConstant %int 5 + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %int_0 = OpConstant %int 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %11 + %11 = OpLabel + %37 = OpPhi %int %int_0 %5 %40 %14 + %38 = OpPhi %int %int_0 %5 %36 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %bool %38 %int_10 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + )"; + const std::string text_tail = R"( + OpSelectionMerge %24 None + OpBranchConditional %22 %23 %24 + %23 = OpLabel + %27 = OpIAdd %int %37 %int_2 + OpStore %a %27 + OpBranch %24 + %24 = OpLabel + %39 = OpPhi %int %37 %12 %27 %23 + %30 = OpSLessThan %bool %38 %int_1 + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %34 = OpIAdd %int %39 %int_2 + OpStore %a %34 + OpBranch %32 + %32 = OpLabel + %40 = OpPhi %int %39 %24 %34 %31 + OpBranch %14 + %14 = OpLabel + %36 = OpIAdd %int %38 %int_1 + OpStore %i %36 + OpBranch %11 + %13 = OpLabel + OpReturn + OpFunctionEnd + )"; + + auto run_test = [&text_head, &text_tail, this]( + SpvOp opcode, const std::string& op1, + const std::string& op2, + const PeelTraceType& expected_peel_trace) { + BuildAndCheckTrace(text_head, text_tail, opcode, "%22", op1, op2, + expected_peel_trace, expected_peel_trace.size() + 1); + }; + + // Test LT + // Peel before by a factor of 3. + { + SCOPED_TRACE("Peel before iv < 3"); + + run_test(SpvOpSLessThan, "%38", "%int_3", + {{LoopPeelingPass::PeelDirection::kBefore, 3u}}); + } + { + SCOPED_TRACE("Peel before 3 > iv"); + + run_test(SpvOpSGreaterThan, "%int_3", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 3u}}); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv < 8"); + + run_test(SpvOpSLessThan, "%38", "%int_8", + {{LoopPeelingPass::PeelDirection::kAfter, 2u}}); + } + { + SCOPED_TRACE("Peel after 8 > iv"); + + run_test(SpvOpSGreaterThan, "%int_8", "%38", + {{LoopPeelingPass::PeelDirection::kAfter, 2u}}); + } + + // Test GT + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv > 2"); + + run_test(SpvOpSGreaterThan, "%38", "%int_2", + {{LoopPeelingPass::PeelDirection::kBefore, 2u}}); + } + { + SCOPED_TRACE("Peel before 2 < iv"); + + run_test(SpvOpSLessThan, "%int_2", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 2u}}); + } + + // Peel after by a factor of 3. + { + SCOPED_TRACE("Peel after iv > 7"); + + run_test(SpvOpSGreaterThan, "%38", "%int_7", + {{LoopPeelingPass::PeelDirection::kAfter, 3u}}); + } + { + SCOPED_TRACE("Peel after 7 < iv"); + + run_test(SpvOpSLessThan, "%int_7", "%38", + {{LoopPeelingPass::PeelDirection::kAfter, 3u}}); + } + + // Test LE + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv <= 1"); + + run_test(SpvOpSLessThanEqual, "%38", "%int_1", + {{LoopPeelingPass::PeelDirection::kBefore, 2u}}); + } + { + SCOPED_TRACE("Peel before 1 => iv"); + + run_test(SpvOpSGreaterThanEqual, "%int_1", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 2u}}); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv <= 7"); + + run_test(SpvOpSLessThanEqual, "%38", "%int_7", + {{LoopPeelingPass::PeelDirection::kAfter, 2u}}); + } + { + SCOPED_TRACE("Peel after 7 => iv"); + + run_test(SpvOpSGreaterThanEqual, "%int_7", "%38", + {{LoopPeelingPass::PeelDirection::kAfter, 2u}}); + } + + // Test GE + // Peel before by a factor of 2. + { + SCOPED_TRACE("Peel before iv >= 2"); + + run_test(SpvOpSGreaterThanEqual, "%38", "%int_2", + {{LoopPeelingPass::PeelDirection::kBefore, 2u}}); + } + { + SCOPED_TRACE("Peel before 2 <= iv"); + + run_test(SpvOpSLessThanEqual, "%int_2", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 2u}}); + } + + // Peel after by a factor of 2. + { + SCOPED_TRACE("Peel after iv >= 8"); + + run_test(SpvOpSGreaterThanEqual, "%38", "%int_8", + {{LoopPeelingPass::PeelDirection::kAfter, 2u}}); + } + { + SCOPED_TRACE("Peel after 8 <= iv"); + + run_test(SpvOpSLessThanEqual, "%int_8", "%38", + {{LoopPeelingPass::PeelDirection::kAfter, 2u}}); + } + // Test EQ + // Peel before by a factor of 1. + { + SCOPED_TRACE("Peel before iv == 0"); + + run_test(SpvOpIEqual, "%38", "%int_0", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + { + SCOPED_TRACE("Peel before 0 == iv"); + + run_test(SpvOpIEqual, "%int_0", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + + // Peel after by a factor of 1. + { + SCOPED_TRACE("Peel after iv == 9"); + + run_test(SpvOpIEqual, "%38", "%int_9", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + { + SCOPED_TRACE("Peel after 9 == iv"); + + run_test(SpvOpIEqual, "%int_9", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + + // Test NE + // Peel before by a factor of 1. + { + SCOPED_TRACE("Peel before iv != 0"); + + run_test(SpvOpINotEqual, "%38", "%int_0", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + { + SCOPED_TRACE("Peel before 0 != iv"); + + run_test(SpvOpINotEqual, "%int_0", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + + // Peel after by a factor of 1. + { + SCOPED_TRACE("Peel after iv != 9"); + + run_test(SpvOpINotEqual, "%38", "%int_9", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } + { + SCOPED_TRACE("Peel after 9 != iv"); + + run_test(SpvOpINotEqual, "%int_9", "%38", + {{LoopPeelingPass::PeelDirection::kBefore, 1u}}); + } +} + +/* +Test are derivation of the following generated test from the following GLSL + +--eliminate-local-multi-store + +#version 330 core +void main() { + int a = 0; + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 10; j++) { + if (i < 3) { + a += 2; + } + } + } +} +*/ +TEST_F(PeelingPassTest, PeelingNestedPass) { + const std::string text_head = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %j "j" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_7 = OpConstant %int 7 + %int_3 = OpConstant %int 3 + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %43 = OpUndef %int + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpBranch %11 + %11 = OpLabel + %41 = OpPhi %int %int_0 %5 %45 %14 + %42 = OpPhi %int %int_0 %5 %40 %14 + %44 = OpPhi %int %43 %5 %46 %14 + OpLoopMerge %13 %14 None + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThan %bool %42 %int_10 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + OpStore %j %int_0 + OpBranch %21 + %21 = OpLabel + %45 = OpPhi %int %41 %12 %47 %24 + %46 = OpPhi %int %int_0 %12 %38 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %27 = OpSLessThan %bool %46 %int_10 + OpBranchConditional %27 %22 %23 + %22 = OpLabel + )"; + + const std::string text_tail = R"( + OpSelectionMerge %32 None + OpBranchConditional %30 %31 %32 + %31 = OpLabel + %35 = OpIAdd %int %45 %int_2 + OpStore %a %35 + OpBranch %32 + %32 = OpLabel + %47 = OpPhi %int %45 %22 %35 %31 + OpBranch %24 + %24 = OpLabel + %38 = OpIAdd %int %46 %int_1 + OpStore %j %38 + OpBranch %21 + %23 = OpLabel + OpBranch %14 + %14 = OpLabel + %40 = OpIAdd %int %42 %int_1 + OpStore %i %40 + OpBranch %11 + %13 = OpLabel + OpReturn + OpFunctionEnd + )"; + + auto run_test = + [&text_head, &text_tail, this]( + SpvOp opcode, const std::string& op1, const std::string& op2, + const PeelTraceType& expected_peel_trace, size_t nb_of_loops) { + BuildAndCheckTrace(text_head, text_tail, opcode, "%30", op1, op2, + expected_peel_trace, nb_of_loops); + }; + + // Peeling outer before by a factor of 3. + { + SCOPED_TRACE("Peel before iv_i < 3"); + + // Expect peel before by a factor of 3 and 4 loops at the end. + run_test(SpvOpSLessThan, "%42", "%int_3", + {{LoopPeelingPass::PeelDirection::kBefore, 3u}}, 4); + } + // Peeling outer loop after by a factor of 3. + { + SCOPED_TRACE("Peel after iv_i < 7"); + + // Expect peel after by a factor of 3 and 4 loops at the end. + run_test(SpvOpSLessThan, "%42", "%int_7", + {{LoopPeelingPass::PeelDirection::kAfter, 3u}}, 4); + } + + // Peeling inner loop before by a factor of 3. + { + SCOPED_TRACE("Peel before iv_j < 3"); + + // Expect peel before by a factor of 3 and 3 loops at the end. + run_test(SpvOpSLessThan, "%46", "%int_3", + {{LoopPeelingPass::PeelDirection::kBefore, 3u}}, 3); + } + // Peeling inner loop after by a factor of 3. + { + SCOPED_TRACE("Peel after iv_j < 7"); + + // Expect peel after by a factor of 3 and 3 loops at the end. + run_test(SpvOpSLessThan, "%46", "%int_7", + {{LoopPeelingPass::PeelDirection::kAfter, 3u}}, 3); + } + + // Not unworkable condition. + { + SCOPED_TRACE("No peel"); + + // Expect no peeling and 2 loops at the end. + run_test(SpvOpSLessThan, "%46", "%42", {}, 2); + } + + // Could do a peeling of 3, but the goes over the threshold. + { + SCOPED_TRACE("Over threshold"); + + size_t current_threshold = LoopPeelingPass::GetLoopPeelingThreshold(); + LoopPeelingPass::SetLoopPeelingThreshold(1u); + // Expect no peeling and 2 loops at the end. + run_test(SpvOpSLessThan, "%46", "%int_7", {}, 2); + LoopPeelingPass::SetLoopPeelingThreshold(current_threshold); + } +} +/* +Test are derivation of the following generated test from the following GLSL + +--eliminate-local-multi-store + +#version 330 core +void main() { + int a = 0; + for (int i = 0, j = 0; i < 10; j++, i++) { + if (i < j) { + a += 2; + } + } +} +*/ +TEST_F(PeelingPassTest, PeelingNoChanges) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 330 + OpName %main "main" + OpName %a "a" + OpName %i "i" + OpName %j "j" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_2 = OpConstant %int 2 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %a = OpVariable %_ptr_Function_int Function + %i = OpVariable %_ptr_Function_int Function + %j = OpVariable %_ptr_Function_int Function + OpStore %a %int_0 + OpStore %i %int_0 + OpStore %j %int_0 + OpBranch %12 + %12 = OpLabel + %34 = OpPhi %int %int_0 %5 %37 %15 + %35 = OpPhi %int %int_0 %5 %33 %15 + %36 = OpPhi %int %int_0 %5 %31 %15 + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %20 = OpSLessThan %bool %35 %int_10 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %23 = OpSLessThan %bool %35 %36 + OpSelectionMerge %25 None + OpBranchConditional %23 %24 %25 + %24 = OpLabel + %28 = OpIAdd %int %34 %int_2 + OpStore %a %28 + OpBranch %25 + %25 = OpLabel + %37 = OpPhi %int %34 %13 %28 %24 + OpBranch %15 + %15 = OpLabel + %31 = OpIAdd %int %36 %int_1 + OpStore %j %31 + %33 = OpIAdd %int %35 %int_1 + OpStore %i %33 + OpBranch %12 + %14 = OpLabel + OpReturn + OpFunctionEnd + )"; + + { + auto result = + SinglePassRunAndDisassemble(text, true, false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp new file mode 100644 index 00000000000..62f77d78224 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unroll_assumptions.cpp @@ -0,0 +1,1448 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +template +class PartialUnrollerTestPass : public Pass { + public: + PartialUnrollerTestPass() : Pass() {} + + const char* name() const override { return "Loop unroller"; } + + Status Process() override { + bool changed = false; + for (Function& f : *context()->module()) { + LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(&f); + for (auto& loop : loop_descriptor) { + LoopUtils loop_utils{context(), &loop}; + if (loop_utils.PartiallyUnroll(factor)) { + changed = true; + } + } + } + + if (changed) return Pass::Status::SuccessWithChange; + return Pass::Status::SuccessWithoutChange; + } +}; + +/* +Generated from the following GLSL +#version 410 core +layout(location = 0) flat in int in_upper_bound; +void main() { + for (int i = 0; i < in_upper_bound; ++i) { + x[i] = 1.0f; + } +} +*/ +TEST_F(PassClassTest, CheckUpperBound) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "in_upper_bound" +OpName %4 "x" +OpDecorate %3 Flat +OpDecorate %3 Location 0 +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpTypeInt 32 1 +%8 = OpTypePointer Function %7 +%9 = OpConstant %7 0 +%10 = OpTypePointer Input %7 +%3 = OpVariable %10 Input +%11 = OpTypeBool +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpConstant %12 1 +%18 = OpTypePointer Function %12 +%19 = OpConstant %7 1 +%2 = OpFunction %5 None %6 +%20 = OpLabel +%4 = OpVariable %16 Function +OpBranch %21 +%21 = OpLabel +%22 = OpPhi %7 %9 %20 %23 %24 +OpLoopMerge %25 %24 Unroll +OpBranch %26 +%26 = OpLabel +%27 = OpLoad %7 %3 +%28 = OpSLessThan %11 %22 %27 +OpBranchConditional %28 %29 %25 +%29 = OpLabel +%30 = OpAccessChain %18 %4 %22 +OpStore %30 %17 +OpBranch %24 +%24 = OpLabel +%23 = OpIAdd %7 %22 %19 +OpBranch %21 +%25 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[10]; + for (uint i = 0; i < 2; i++) { + for (float x = 0; x < 5; ++x) { + out_array[x + i*5] = i; + } + } +} +*/ +TEST_F(PassClassTest, UnrollNestedLoopsInvalid) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 0 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpConstant %6 2 +%10 = OpTypeBool +%11 = OpTypeInt 32 1 +%12 = OpTypePointer Function %11 +%13 = OpConstant %11 0 +%14 = OpConstant %11 5 +%15 = OpTypeFloat 32 +%16 = OpConstant %6 10 +%17 = OpTypeArray %15 %16 +%18 = OpTypePointer Function %17 +%19 = OpConstant %6 5 +%20 = OpTypePointer Function %15 +%21 = OpConstant %11 1 +%22 = OpUndef %11 +%2 = OpFunction %4 None %5 +%23 = OpLabel +%3 = OpVariable %18 Function +OpBranch %24 +%24 = OpLabel +%25 = OpPhi %6 %8 %23 %26 %27 +%28 = OpPhi %11 %22 %23 %29 %27 +OpLoopMerge %30 %27 Unroll +OpBranch %31 +%31 = OpLabel +%32 = OpULessThan %10 %25 %9 +OpBranchConditional %32 %33 %30 +%33 = OpLabel +OpBranch %34 +%34 = OpLabel +%29 = OpPhi %11 %13 %33 %35 %36 +OpLoopMerge %37 %36 None +OpBranch %38 +%38 = OpLabel +%39 = OpSLessThan %10 %29 %14 +OpBranchConditional %39 %40 %37 +%40 = OpLabel +%41 = OpBitcast %6 %29 +%42 = OpIMul %6 %25 %19 +%43 = OpIAdd %6 %41 %42 +%44 = OpConvertUToF %15 %25 +%45 = OpAccessChain %20 %3 %43 +OpStore %45 %44 +OpBranch %36 +%36 = OpLabel +%35 = OpIAdd %11 %29 %21 +OpBranch %34 +%37 = OpLabel +OpBranch %27 +%27 = OpLabel +%26 = OpIAdd %6 %25 %21 +OpBranch %24 +%30 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main(){ + float x[10]; + for (int i = 0; i < 10; i++) { + if (i == 5) { + break; + } + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, BreakInBody) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +OpName %3 "x" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpConstant %6 10 +%10 = OpTypeBool +%11 = OpConstant %6 5 +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpTypePointer Function %12 +%18 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%19 = OpLabel +%3 = OpVariable %16 Function +OpBranch %20 +%20 = OpLabel +%21 = OpPhi %6 %8 %19 %22 %23 +OpLoopMerge %24 %23 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %10 %21 %9 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%28 = OpIEqual %10 %21 %11 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +OpBranch %24 +%29 = OpLabel +%31 = OpConvertSToF %12 %21 +%32 = OpAccessChain %17 %3 %21 +OpStore %32 %31 +OpBranch %23 +%23 = OpLabel +%22 = OpIAdd %6 %21 %18 +OpBranch %20 +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main(){ + float x[10]; + for (int i = 0; i < 10; i++) { + if (i == 5) { + continue; + } + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, ContinueInBody) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +OpName %3 "x" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpConstant %6 10 +%10 = OpTypeBool +%11 = OpConstant %6 5 +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpTypePointer Function %12 +%18 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%19 = OpLabel +%3 = OpVariable %16 Function +OpBranch %20 +%20 = OpLabel +%21 = OpPhi %6 %8 %19 %22 %23 +OpLoopMerge %24 %23 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %10 %21 %9 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%28 = OpIEqual %10 %21 %11 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +OpBranch %23 +%29 = OpLabel +%31 = OpConvertSToF %12 %21 +%32 = OpAccessChain %17 %3 %21 +OpStore %32 %31 +OpBranch %23 +%23 = OpLabel +%22 = OpIAdd %6 %21 %18 +OpBranch %20 +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main(){ + float x[10]; + for (int i = 0; i < 10; i++) { + if (i == 5) { + return; + } + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, ReturnInBody) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +OpName %3 "x" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpConstant %6 10 +%10 = OpTypeBool +%11 = OpConstant %6 5 +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpTypePointer Function %12 +%18 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%19 = OpLabel +%3 = OpVariable %16 Function +OpBranch %20 +%20 = OpLabel +%21 = OpPhi %6 %8 %19 %22 %23 +OpLoopMerge %24 %23 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %10 %21 %9 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%28 = OpIEqual %10 %21 %11 +OpSelectionMerge %29 None +OpBranchConditional %28 %30 %29 +%30 = OpLabel +OpReturn +%29 = OpLabel +%31 = OpConvertSToF %12 %21 +%32 = OpAccessChain %17 %3 %21 +OpStore %32 %31 +OpBranch %23 +%23 = OpLabel +%22 = OpIAdd %6 %21 %18 +OpBranch %20 +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main() { + int j = 0; + for (int i = 0; i < 10 && i > 0; i++) { + j++; + } +} +*/ +TEST_F(PassClassTest, MultipleConditionsSingleVariable) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpTypePointer Function %5 +%7 = OpConstant %5 0 +%8 = OpConstant %5 10 +%9 = OpTypeBool +%10 = OpConstant %5 1 +%2 = OpFunction %3 None %4 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +%13 = OpPhi %5 %7 %11 %14 %15 +%16 = OpPhi %5 %7 %11 %17 %15 +OpLoopMerge %18 %15 Unroll +OpBranch %19 +%19 = OpLabel +%20 = OpSLessThan %9 %16 %8 +%21 = OpSGreaterThan %9 %16 %7 +%22 = OpLogicalAnd %9 %20 %21 +OpBranchConditional %22 %23 %18 +%23 = OpLabel +%14 = OpIAdd %5 %13 %10 +OpBranch %15 +%15 = OpLabel +%17 = OpIAdd %5 %16 %10 +OpBranch %12 +%18 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main() { + int i = 0; + int j = 0; + int k = 0; + for (; i < 10 && j > 0; i++, j++) { + k++; + } +} +*/ +TEST_F(PassClassTest, MultipleConditionsMultipleVariables) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpTypePointer Function %5 +%7 = OpConstant %5 0 +%8 = OpConstant %5 10 +%9 = OpTypeBool +%10 = OpConstant %5 1 +%2 = OpFunction %3 None %4 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +%13 = OpPhi %5 %7 %11 %14 %15 +%16 = OpPhi %5 %7 %11 %17 %15 +%18 = OpPhi %5 %7 %11 %19 %15 +OpLoopMerge %20 %15 Unroll +OpBranch %21 +%21 = OpLabel +%22 = OpSLessThan %9 %13 %8 +%23 = OpSGreaterThan %9 %16 %7 +%24 = OpLogicalAnd %9 %22 %23 +OpBranchConditional %24 %25 %20 +%25 = OpLabel +%19 = OpIAdd %5 %18 %10 +OpBranch %15 +%15 = OpLabel +%14 = OpIAdd %5 %13 %10 +%17 = OpIAdd %5 %16 %10 +OpBranch %12 +%20 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main() { + float i = 0.0; + int j = 0; + for (; i < 10; i++) { + j++; + } +} +*/ +TEST_F(PassClassTest, FloatingPointLoop) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeFloat 32 +%6 = OpTypePointer Function %5 +%7 = OpConstant %5 0 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 0 +%11 = OpConstant %5 10 +%12 = OpTypeBool +%13 = OpConstant %8 1 +%14 = OpConstant %5 1 +%2 = OpFunction %3 None %4 +%15 = OpLabel +OpBranch %16 +%16 = OpLabel +%17 = OpPhi %5 %7 %15 %18 %19 +%20 = OpPhi %8 %10 %15 %21 %19 +OpLoopMerge %22 %19 Unroll +OpBranch %23 +%23 = OpLabel +%24 = OpFOrdLessThan %12 %17 %11 +OpBranchConditional %24 %25 %22 +%25 = OpLabel +%21 = OpIAdd %8 %20 %13 +OpBranch %19 +%19 = OpLabel +%18 = OpFAdd %5 %17 %14 +OpBranch %16 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main() { + int i = 2; + int j = 0; + if (j == 0) { i = 5; } + for (; i < 3; ++i) { + j++; + } +} +*/ +TEST_F(PassClassTest, InductionPhiOutsideLoop) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpTypePointer Function %5 +%7 = OpConstant %5 2 +%8 = OpConstant %5 0 +%9 = OpTypeBool +%10 = OpConstant %5 5 +%11 = OpConstant %5 3 +%12 = OpConstant %5 1 +%2 = OpFunction %3 None %4 +%13 = OpLabel +%14 = OpIEqual %9 %8 %8 +OpSelectionMerge %15 None +OpBranchConditional %14 %16 %15 +%16 = OpLabel +OpBranch %15 +%15 = OpLabel +%17 = OpPhi %5 %7 %13 %10 %16 +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %5 %17 %15 %20 %21 +%22 = OpPhi %5 %8 %15 %23 %21 +OpLoopMerge %24 %21 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %9 %19 %11 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%23 = OpIAdd %5 %22 %12 +OpBranch %21 +%21 = OpLabel +%20 = OpIAdd %5 %19 %12 +OpBranch %18 +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main() { + int j = 0; + for (int i = 0; i == 0; ++i) { + ++j; + } + for (int i = 0; i != 3; ++i) { + ++j; + } + for (int i = 0; i < 3; i *= 2) { + ++j; + } + for (int i = 10; i > 3; i /= 2) { + ++j; + } + for (int i = 10; i > 3; i |= 2) { + ++j; + } + for (int i = 10; i > 3; i &= 2) { + ++j; + } + for (int i = 10; i > 3; i ^= 2) { + ++j; + } + for (int i = 0; i < 3; i << 2) { + ++j; + } + for (int i = 10; i > 3; i >> 2) { + ++j; + } +} +*/ +TEST_F(PassClassTest, UnsupportedLoopTypes) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpTypePointer Function %5 +%7 = OpConstant %5 0 +%8 = OpTypeBool +%9 = OpConstant %5 1 +%10 = OpConstant %5 3 +%11 = OpConstant %5 2 +%12 = OpConstant %5 10 +%2 = OpFunction %3 None %4 +%13 = OpLabel +OpBranch %14 +%14 = OpLabel +%15 = OpPhi %5 %7 %13 %16 %17 +%18 = OpPhi %5 %7 %13 %19 %17 +OpLoopMerge %20 %17 Unroll +OpBranch %21 +%21 = OpLabel +%22 = OpIEqual %8 %18 %7 +OpBranchConditional %22 %23 %20 +%23 = OpLabel +%16 = OpIAdd %5 %15 %9 +OpBranch %17 +%17 = OpLabel +%19 = OpIAdd %5 %18 %9 +OpBranch %14 +%20 = OpLabel +OpBranch %24 +%24 = OpLabel +%25 = OpPhi %5 %15 %20 %26 %27 +%28 = OpPhi %5 %7 %20 %29 %27 +OpLoopMerge %30 %27 Unroll +OpBranch %31 +%31 = OpLabel +%32 = OpINotEqual %8 %28 %10 +OpBranchConditional %32 %33 %30 +%33 = OpLabel +%26 = OpIAdd %5 %25 %9 +OpBranch %27 +%27 = OpLabel +%29 = OpIAdd %5 %28 %9 +OpBranch %24 +%30 = OpLabel +OpBranch %34 +%34 = OpLabel +%35 = OpPhi %5 %25 %30 %36 %37 +%38 = OpPhi %5 %7 %30 %39 %37 +OpLoopMerge %40 %37 Unroll +OpBranch %41 +%41 = OpLabel +%42 = OpSLessThan %8 %38 %10 +OpBranchConditional %42 %43 %40 +%43 = OpLabel +%36 = OpIAdd %5 %35 %9 +OpBranch %37 +%37 = OpLabel +%39 = OpIMul %5 %38 %11 +OpBranch %34 +%40 = OpLabel +OpBranch %44 +%44 = OpLabel +%45 = OpPhi %5 %35 %40 %46 %47 +%48 = OpPhi %5 %12 %40 %49 %47 +OpLoopMerge %50 %47 Unroll +OpBranch %51 +%51 = OpLabel +%52 = OpSGreaterThan %8 %48 %10 +OpBranchConditional %52 %53 %50 +%53 = OpLabel +%46 = OpIAdd %5 %45 %9 +OpBranch %47 +%47 = OpLabel +%49 = OpSDiv %5 %48 %11 +OpBranch %44 +%50 = OpLabel +OpBranch %54 +%54 = OpLabel +%55 = OpPhi %5 %45 %50 %56 %57 +%58 = OpPhi %5 %12 %50 %59 %57 +OpLoopMerge %60 %57 Unroll +OpBranch %61 +%61 = OpLabel +%62 = OpSGreaterThan %8 %58 %10 +OpBranchConditional %62 %63 %60 +%63 = OpLabel +%56 = OpIAdd %5 %55 %9 +OpBranch %57 +%57 = OpLabel +%59 = OpBitwiseOr %5 %58 %11 +OpBranch %54 +%60 = OpLabel +OpBranch %64 +%64 = OpLabel +%65 = OpPhi %5 %55 %60 %66 %67 +%68 = OpPhi %5 %12 %60 %69 %67 +OpLoopMerge %70 %67 Unroll +OpBranch %71 +%71 = OpLabel +%72 = OpSGreaterThan %8 %68 %10 +OpBranchConditional %72 %73 %70 +%73 = OpLabel +%66 = OpIAdd %5 %65 %9 +OpBranch %67 +%67 = OpLabel +%69 = OpBitwiseAnd %5 %68 %11 +OpBranch %64 +%70 = OpLabel +OpBranch %74 +%74 = OpLabel +%75 = OpPhi %5 %65 %70 %76 %77 +%78 = OpPhi %5 %12 %70 %79 %77 +OpLoopMerge %80 %77 Unroll +OpBranch %81 +%81 = OpLabel +%82 = OpSGreaterThan %8 %78 %10 +OpBranchConditional %82 %83 %80 +%83 = OpLabel +%76 = OpIAdd %5 %75 %9 +OpBranch %77 +%77 = OpLabel +%79 = OpBitwiseXor %5 %78 %11 +OpBranch %74 +%80 = OpLabel +OpBranch %84 +%84 = OpLabel +%85 = OpPhi %5 %75 %80 %86 %87 +OpLoopMerge %88 %87 Unroll +OpBranch %89 +%89 = OpLabel +%90 = OpSLessThan %8 %7 %10 +OpBranchConditional %90 %91 %88 +%91 = OpLabel +%86 = OpIAdd %5 %85 %9 +OpBranch %87 +%87 = OpLabel +%92 = OpShiftLeftLogical %5 %7 %11 +OpBranch %84 +%88 = OpLabel +OpBranch %93 +%93 = OpLabel +%94 = OpPhi %5 %85 %88 %95 %96 +OpLoopMerge %97 %96 Unroll +OpBranch %98 +%98 = OpLabel +%99 = OpSGreaterThan %8 %12 %10 +OpBranchConditional %99 %100 %97 +%100 = OpLabel +%95 = OpIAdd %5 %94 %9 +OpBranch %96 +%96 = OpLabel +%101 = OpShiftRightArithmetic %5 %12 %11 +OpBranch %93 +%97 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +#version 430 + +layout(location = 0) out float o; + +void main(void) { + for (int j = 2; j < 0; j += 1) { + o += 1.0; + } +} +*/ +TEST_F(PassClassTest, NegativeNumberOfIterations) { + // clang-format off + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "o" +OpDecorate %3 Location 0 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 2 +%9 = OpConstant %6 0 +%10 = OpTypeBool +%11 = OpTypeFloat 32 +%12 = OpTypePointer Output %11 +%3 = OpVariable %12 Output +%13 = OpConstant %11 1 +%14 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%15 = OpLabel +OpBranch %16 +%16 = OpLabel +%17 = OpPhi %6 %8 %15 %18 %19 +OpLoopMerge %20 %19 None +OpBranch %21 +%21 = OpLabel +%22 = OpSLessThan %10 %17 %9 +OpBranchConditional %22 %23 %20 +%23 = OpLabel +%24 = OpLoad %11 %3 +%25 = OpFAdd %11 %24 %13 +OpStore %3 %25 +OpBranch %19 +%19 = OpLabel +%18 = OpIAdd %6 %17 %14 +OpBranch %16 +%20 = OpLabel +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +#version 430 + +layout(location = 0) out float o; + +void main(void) { + float s = 0.0; + for (int j = 0; j < 3; j += 1) { + s += 1.0; + j += 1; + } + o = s; +} +*/ +TEST_F(PassClassTest, MultipleStepOperations) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "o" +OpDecorate %3 Location 0 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeFloat 32 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 0 +%12 = OpConstant %9 3 +%13 = OpTypeBool +%14 = OpConstant %6 1 +%15 = OpConstant %9 1 +%16 = OpTypePointer Output %6 +%3 = OpVariable %16 Output +%2 = OpFunction %4 None %5 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %6 %8 %17 %20 %21 +%22 = OpPhi %9 %11 %17 %23 %21 +OpLoopMerge %24 %21 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %13 %22 %12 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%20 = OpFAdd %6 %19 %14 +%28 = OpIAdd %9 %22 %15 +OpBranch %21 +%21 = OpLabel +%23 = OpIAdd %9 %28 %15 +OpBranch %18 +%24 = OpLabel +OpStore %3 %19 +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +#version 430 + +layout(location = 0) out float o; + +void main(void) { + float s = 0.0; + for (int j = 10; j > 20; j -= 1) { + s += 1.0; + } + o = s; +} +*/ + +TEST_F(PassClassTest, ConditionFalseFromStartGreaterThan) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "o" +OpDecorate %3 Location 0 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeFloat 32 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 10 +%12 = OpConstant %9 20 +%13 = OpTypeBool +%14 = OpConstant %6 1 +%15 = OpConstant %9 1 +%16 = OpTypePointer Output %6 +%3 = OpVariable %16 Output +%2 = OpFunction %4 None %5 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %6 %8 %17 %20 %21 +%22 = OpPhi %9 %11 %17 %23 %21 +OpLoopMerge %24 %21 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSGreaterThan %13 %22 %12 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%20 = OpFAdd %6 %19 %14 +OpBranch %21 +%21 = OpLabel +%23 = OpISub %9 %22 %15 +OpBranch %18 +%24 = OpLabel +OpStore %3 %19 +OpReturn +OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +#version 430 + +layout(location = 0) out float o; + +void main(void) { + float s = 0.0; + for (int j = 10; j >= 20; j -= 1) { + s += 1.0; + } + o = s; +} +*/ +TEST_F(PassClassTest, ConditionFalseFromStartGreaterThanOrEqual) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "o" +OpDecorate %3 Location 0 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeFloat 32 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 10 +%12 = OpConstant %9 20 +%13 = OpTypeBool +%14 = OpConstant %6 1 +%15 = OpConstant %9 1 +%16 = OpTypePointer Output %6 +%3 = OpVariable %16 Output +%2 = OpFunction %4 None %5 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %6 %8 %17 %20 %21 +%22 = OpPhi %9 %11 %17 %23 %21 +OpLoopMerge %24 %21 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSGreaterThanEqual %13 %22 %12 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%20 = OpFAdd %6 %19 %14 +OpBranch %21 +%21 = OpLabel +%23 = OpISub %9 %22 %15 +OpBranch %18 +%24 = OpLabel +OpStore %3 %19 +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +#version 430 + +layout(location = 0) out float o; + +void main(void) { + float s = 0.0; + for (int j = 20; j < 10; j -= 1) { + s += 1.0; + } + o = s; +} +*/ +TEST_F(PassClassTest, ConditionFalseFromStartLessThan) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "o" +OpDecorate %3 Location 0 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeFloat 32 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 20 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpConstant %6 1 +%15 = OpConstant %9 1 +%16 = OpTypePointer Output %6 +%3 = OpVariable %16 Output +%2 = OpFunction %4 None %5 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %6 %8 %17 %20 %21 +%22 = OpPhi %9 %11 %17 %23 %21 +OpLoopMerge %24 %21 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThan %13 %22 %12 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%20 = OpFAdd %6 %19 %14 +OpBranch %21 +%21 = OpLabel +%23 = OpISub %9 %22 %15 +OpBranch %18 +%24 = OpLabel +OpStore %3 %19 +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +/* +#version 430 + +layout(location = 0) out float o; + +void main(void) { + float s = 0.0; + for (int j = 20; j <= 10; j -= 1) { + s += 1.0; + } + o = s; +} +*/ +TEST_F(PassClassTest, ConditionFalseFromStartLessThanEqual) { + // clang-format off + // With LocalMultiStoreElimPass +const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "o" +OpDecorate %3 Location 0 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeFloat 32 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpTypeInt 32 1 +%10 = OpTypePointer Function %9 +%11 = OpConstant %9 20 +%12 = OpConstant %9 10 +%13 = OpTypeBool +%14 = OpConstant %6 1 +%15 = OpConstant %9 1 +%16 = OpTypePointer Output %6 +%3 = OpVariable %16 Output +%2 = OpFunction %4 None %5 +%17 = OpLabel +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %6 %8 %17 %20 %21 +%22 = OpPhi %9 %11 %17 %23 %21 +OpLoopMerge %24 %21 Unroll +OpBranch %25 +%25 = OpLabel +%26 = OpSLessThanEqual %13 %22 %12 +OpBranchConditional %26 %27 %24 +%27 = OpLabel +%20 = OpFAdd %6 %19 %14 +OpBranch %21 +%21 = OpLabel +%23 = OpISub %9 %22 %15 +OpBranch %18 +%24 = OpLabel +OpStore %3 %19 +OpReturn +OpFunctionEnd +)"; + + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + // Make sure the pass doesn't run + SinglePassRunAndCheck(text, text, false); + SinglePassRunAndCheck>(text, text, false); + SinglePassRunAndCheck>(text, text, false); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp new file mode 100644 index 00000000000..3b01fdc317b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unroll_simple.cpp @@ -0,0 +1,2957 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/loop_unroller.h" +#include "source/opt/loop_utils.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + float x[4]; + for (int i = 0; i < 4; ++i) { + x[i] = 1.0f; + } +} +*/ +TEST_F(PassClassTest, SimpleFullyUnrollTest) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %5 "x" + OpName %3 "c" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 4 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 4 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Function %16 + %18 = OpConstant %13 1 + %19 = OpTypePointer Function %13 + %20 = OpConstant %8 1 + %21 = OpTypeVector %13 4 + %22 = OpTypePointer Output %21 + %3 = OpVariable %22 Output + %2 = OpFunction %6 None %7 + %23 = OpLabel + %5 = OpVariable %17 Function + OpBranch %24 + %24 = OpLabel + %35 = OpPhi %8 %10 %23 %34 %26 + OpLoopMerge %25 %26 Unroll + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %12 %35 %11 + OpBranchConditional %29 %30 %25 + %30 = OpLabel + %32 = OpAccessChain %19 %5 %35 + OpStore %32 %18 + OpBranch %26 + %26 = OpLabel + %34 = OpIAdd %8 %35 %20 + OpBranch %24 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 330 +OpName %2 "main" +OpName %4 "x" +OpName %3 "c" +OpDecorate %3 Location 0 +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpTypeInt 32 1 +%8 = OpTypePointer Function %7 +%9 = OpConstant %7 0 +%10 = OpConstant %7 4 +%11 = OpTypeBool +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 4 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpConstant %12 1 +%18 = OpTypePointer Function %12 +%19 = OpConstant %7 1 +%20 = OpTypeVector %12 4 +%21 = OpTypePointer Output %20 +%3 = OpVariable %21 Output +%2 = OpFunction %5 None %6 +%22 = OpLabel +%4 = OpVariable %16 Function +OpBranch %23 +%23 = OpLabel +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %11 %9 %10 +OpBranch %30 +%30 = OpLabel +%31 = OpAccessChain %18 %4 %9 +OpStore %31 %17 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %7 %9 %19 +OpBranch %32 +%32 = OpLabel +OpBranch %34 +%34 = OpLabel +%35 = OpSLessThan %11 %25 %10 +OpBranch %36 +%36 = OpLabel +%37 = OpAccessChain %18 %4 %25 +OpStore %37 %17 +OpBranch %38 +%38 = OpLabel +%39 = OpIAdd %7 %25 %19 +OpBranch %40 +%40 = OpLabel +OpBranch %42 +%42 = OpLabel +%43 = OpSLessThan %11 %39 %10 +OpBranch %44 +%44 = OpLabel +%45 = OpAccessChain %18 %4 %39 +OpStore %45 %17 +OpBranch %46 +%46 = OpLabel +%47 = OpIAdd %7 %39 %19 +OpBranch %48 +%48 = OpLabel +OpBranch %50 +%50 = OpLabel +%51 = OpSLessThan %11 %47 %10 +OpBranch %52 +%52 = OpLabel +%53 = OpAccessChain %18 %4 %47 +OpStore %53 %17 +OpBranch %54 +%54 = OpLabel +%55 = OpIAdd %7 %47 %19 +OpBranch %27 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +template +class PartialUnrollerTestPass : public Pass { + public: + PartialUnrollerTestPass() : Pass() {} + + const char* name() const override { return "Loop unroller"; } + + Status Process() override { + for (Function& f : *context()->module()) { + LoopDescriptor& loop_descriptor = *context()->GetLoopDescriptor(&f); + for (auto& loop : loop_descriptor) { + LoopUtils loop_utils{context(), &loop}; + loop_utils.PartiallyUnroll(factor); + } + } + + return Pass::Status::SuccessWithChange; + } +}; + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + float x[10]; + for (int i = 0; i < 10; ++i) { + x[i] = 1.0f; + } +} +*/ +TEST_F(PassClassTest, SimplePartialUnroll) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %5 "x" + OpName %3 "c" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Function %16 + %18 = OpConstant %13 1 + %19 = OpTypePointer Function %13 + %20 = OpConstant %8 1 + %21 = OpTypeVector %13 4 + %22 = OpTypePointer Output %21 + %3 = OpVariable %22 Output + %2 = OpFunction %6 None %7 + %23 = OpLabel + %5 = OpVariable %17 Function + OpBranch %24 + %24 = OpLabel + %35 = OpPhi %8 %10 %23 %34 %26 + OpLoopMerge %25 %26 Unroll + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %12 %35 %11 + OpBranchConditional %29 %30 %25 + %30 = OpLabel + %32 = OpAccessChain %19 %5 %35 + OpStore %32 %18 + OpBranch %26 + %26 = OpLabel + %34 = OpIAdd %8 %35 %20 + OpBranch %24 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 330 +OpName %2 "main" +OpName %4 "x" +OpName %3 "c" +OpDecorate %3 Location 0 +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpTypeInt 32 1 +%8 = OpTypePointer Function %7 +%9 = OpConstant %7 0 +%10 = OpConstant %7 10 +%11 = OpTypeBool +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpConstant %12 1 +%18 = OpTypePointer Function %12 +%19 = OpConstant %7 1 +%20 = OpTypeVector %12 4 +%21 = OpTypePointer Output %20 +%3 = OpVariable %21 Output +%2 = OpFunction %5 None %6 +%22 = OpLabel +%4 = OpVariable %16 Function +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %7 %9 %22 %39 %38 +OpLoopMerge %27 %38 DontUnroll +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %11 %24 %10 +OpBranchConditional %29 %30 %27 +%30 = OpLabel +%31 = OpAccessChain %18 %4 %24 +OpStore %31 %17 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %7 %24 %19 +OpBranch %32 +%32 = OpLabel +OpBranch %34 +%34 = OpLabel +%35 = OpSLessThan %11 %25 %10 +OpBranch %36 +%36 = OpLabel +%37 = OpAccessChain %18 %4 %25 +OpStore %37 %17 +OpBranch %38 +%38 = OpLabel +%39 = OpIAdd %7 %25 %19 +OpBranch %23 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck>(text, output, false); +} + +/* +Generated from the following GLSL +#version 330 core +layout(location = 0) out vec4 c; +void main() { + float x[10]; + for (int i = 0; i < 10; ++i) { + x[i] = 1.0f; + } +} +*/ +TEST_F(PassClassTest, SimpleUnevenPartialUnroll) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 330 + OpName %2 "main" + OpName %5 "x" + OpName %3 "c" + OpDecorate %3 Location 0 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Function %16 + %18 = OpConstant %13 1 + %19 = OpTypePointer Function %13 + %20 = OpConstant %8 1 + %21 = OpTypeVector %13 4 + %22 = OpTypePointer Output %21 + %3 = OpVariable %22 Output + %2 = OpFunction %6 None %7 + %23 = OpLabel + %5 = OpVariable %17 Function + OpBranch %24 + %24 = OpLabel + %35 = OpPhi %8 %10 %23 %34 %26 + OpLoopMerge %25 %26 Unroll + OpBranch %27 + %27 = OpLabel + %29 = OpSLessThan %12 %35 %11 + OpBranchConditional %29 %30 %25 + %30 = OpLabel + %32 = OpAccessChain %19 %5 %35 + OpStore %32 %18 + OpBranch %26 + %26 = OpLabel + %34 = OpIAdd %8 %35 %20 + OpBranch %24 + %25 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 330 +OpName %2 "main" +OpName %4 "x" +OpName %3 "c" +OpDecorate %3 Location 0 +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpTypeInt 32 1 +%8 = OpTypePointer Function %7 +%9 = OpConstant %7 0 +%10 = OpConstant %7 10 +%11 = OpTypeBool +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpConstant %12 1 +%18 = OpTypePointer Function %12 +%19 = OpConstant %7 1 +%20 = OpTypeVector %12 4 +%21 = OpTypePointer Output %20 +%3 = OpVariable %21 Output +%58 = OpConstant %13 1 +%2 = OpFunction %5 None %6 +%22 = OpLabel +%4 = OpVariable %16 Function +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %7 %9 %22 %25 %26 +OpLoopMerge %32 %26 Unroll +OpBranch %28 +%28 = OpLabel +%29 = OpSLessThan %11 %24 %58 +OpBranchConditional %29 %30 %32 +%30 = OpLabel +%31 = OpAccessChain %18 %4 %24 +OpStore %31 %17 +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %7 %24 %19 +OpBranch %23 +%32 = OpLabel +OpBranch %33 +%33 = OpLabel +%34 = OpPhi %7 %24 %32 %57 %56 +OpLoopMerge %41 %56 DontUnroll +OpBranch %35 +%35 = OpLabel +%36 = OpSLessThan %11 %34 %10 +OpBranchConditional %36 %37 %41 +%37 = OpLabel +%38 = OpAccessChain %18 %4 %34 +OpStore %38 %17 +OpBranch %39 +%39 = OpLabel +%40 = OpIAdd %7 %34 %19 +OpBranch %42 +%42 = OpLabel +OpBranch %44 +%44 = OpLabel +%45 = OpSLessThan %11 %40 %10 +OpBranch %46 +%46 = OpLabel +%47 = OpAccessChain %18 %4 %40 +OpStore %47 %17 +OpBranch %48 +%48 = OpLabel +%49 = OpIAdd %7 %40 %19 +OpBranch %50 +%50 = OpLabel +OpBranch %52 +%52 = OpLabel +%53 = OpSLessThan %11 %49 %10 +OpBranch %54 +%54 = OpLabel +%55 = OpAccessChain %18 %4 %49 +OpStore %55 %17 +OpBranch %56 +%56 = OpLabel +%57 = OpIAdd %7 %49 %19 +OpBranch %33 +%41 = OpLabel +OpReturn +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + // By unrolling by a factor that doesn't divide evenly into the number of loop + // iterations we perfom an additional transform when partially unrolling to + // account for the remainder. + SinglePassRunAndCheck>(text, output, false); +} + +/* Generated from +#version 410 core +layout(location=0) flat in int upper_bound; +void main() { + float x[10]; + for (int i = 2; i < 8; i+=2) { + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, SimpleLoopIterationsCheck) { + // With LocalMultiStoreElimPass + const std::string text = R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %5 "x" +OpName %3 "upper_bound" +OpDecorate %3 Flat +OpDecorate %3 Location 0 +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 2 +%11 = OpConstant %8 8 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpTypePointer Input %8 +%3 = OpVariable %19 Input +%2 = OpFunction %6 None %7 +%20 = OpLabel +%5 = OpVariable %17 Function +OpBranch %21 +%21 = OpLabel +%34 = OpPhi %8 %10 %20 %33 %23 +OpLoopMerge %22 %23 Unroll +OpBranch %24 +%24 = OpLabel +%26 = OpSLessThan %12 %34 %11 +OpBranchConditional %26 %27 %22 +%27 = OpLabel +%30 = OpConvertSToF %13 %34 +%31 = OpAccessChain %18 %5 %34 +OpStore %31 %30 +OpBranch %23 +%23 = OpLabel +%33 = OpIAdd %8 %34 %10 +OpBranch %21 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + Function* f = spvtest::GetFunction(module, 2); + + LoopDescriptor& loop_descriptor = *context->GetLoopDescriptor(f); + EXPECT_EQ(loop_descriptor.NumLoops(), 1u); + + Loop& loop = loop_descriptor.GetLoopByIndex(0); + + EXPECT_TRUE(loop.HasUnrollLoopControl()); + + BasicBlock* condition = loop.FindConditionBlock(); + EXPECT_EQ(condition->id(), 24u); + + Instruction* induction = loop.FindConditionVariable(condition); + EXPECT_EQ(induction->result_id(), 34u); + + LoopUtils loop_utils{context.get(), &loop}; + EXPECT_TRUE(loop_utils.CanPerformUnroll()); + + size_t iterations = 0; + EXPECT_TRUE(loop.FindNumberOfIterations(induction, &*condition->ctail(), + &iterations)); + EXPECT_EQ(iterations, 3u); +} + +/* Generated from +#version 410 core +void main() { + float x[10]; + for (int i = -1; i < 6; i+=3) { + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, SimpleLoopIterationsCheckSignedInit) { + // With LocalMultiStoreElimPass + const std::string text = R"( +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" %3 +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %5 "x" +OpName %3 "upper_bound" +OpDecorate %3 Flat +OpDecorate %3 Location 0 +%6 = OpTypeVoid +%7 = OpTypeFunction %6 +%8 = OpTypeInt 32 1 +%9 = OpTypePointer Function %8 +%10 = OpConstant %8 -1 +%11 = OpConstant %8 6 +%12 = OpTypeBool +%13 = OpTypeFloat 32 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 10 +%16 = OpTypeArray %13 %15 +%17 = OpTypePointer Function %16 +%18 = OpTypePointer Function %13 +%19 = OpConstant %8 3 +%20 = OpTypePointer Input %8 +%3 = OpVariable %20 Input +%2 = OpFunction %6 None %7 +%21 = OpLabel +%5 = OpVariable %17 Function +OpBranch %22 +%22 = OpLabel +%35 = OpPhi %8 %10 %21 %34 %24 +OpLoopMerge %23 %24 None +OpBranch %25 +%25 = OpLabel +%27 = OpSLessThan %12 %35 %11 +OpBranchConditional %27 %28 %23 +%28 = OpLabel +%31 = OpConvertSToF %13 %35 +%32 = OpAccessChain %18 %5 %35 +OpStore %32 %31 +OpBranch %24 +%24 = OpLabel +%34 = OpIAdd %8 %35 %19 +OpBranch %22 +%23 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + Function* f = spvtest::GetFunction(module, 2); + + LoopDescriptor& loop_descriptor = *context->GetLoopDescriptor(f); + + EXPECT_EQ(loop_descriptor.NumLoops(), 1u); + + Loop& loop = loop_descriptor.GetLoopByIndex(0); + + EXPECT_FALSE(loop.HasUnrollLoopControl()); + + BasicBlock* condition = loop.FindConditionBlock(); + EXPECT_EQ(condition->id(), 25u); + + Instruction* induction = loop.FindConditionVariable(condition); + EXPECT_EQ(induction->result_id(), 35u); + + LoopUtils loop_utils{context.get(), &loop}; + EXPECT_TRUE(loop_utils.CanPerformUnroll()); + + size_t iterations = 0; + EXPECT_TRUE(loop.FindNumberOfIterations(induction, &*condition->ctail(), + &iterations)); + EXPECT_EQ(iterations, 3u); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[6]; + for (uint i = 0; i < 2; i++) { + for (int x = 0; x < 3; ++x) { + out_array[x + i*3] = i; + } + } +} +*/ +TEST_F(PassClassTest, UnrollNestedLoops) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %35 "out_array" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypeBool + %19 = OpTypeInt 32 1 + %20 = OpTypePointer Function %19 + %22 = OpConstant %19 0 + %29 = OpConstant %19 3 + %31 = OpTypeFloat 32 + %32 = OpConstant %6 6 + %33 = OpTypeArray %31 %32 + %34 = OpTypePointer Function %33 + %39 = OpConstant %6 3 + %44 = OpTypePointer Function %31 + %47 = OpConstant %19 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %50 %13 + OpLoopMerge %12 %13 Unroll + OpBranch %14 + %14 = OpLabel + %18 = OpULessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %23 + %23 = OpLabel + %54 = OpPhi %19 %22 %11 %48 %26 + OpLoopMerge %25 %26 Unroll + OpBranch %27 + %27 = OpLabel + %30 = OpSLessThan %17 %54 %29 + OpBranchConditional %30 %24 %25 + %24 = OpLabel + %37 = OpBitcast %6 %54 + %40 = OpIMul %6 %51 %39 + %41 = OpIAdd %6 %37 %40 + %43 = OpConvertUToF %31 %51 + %45 = OpAccessChain %44 %35 %41 + OpStore %45 %43 + OpBranch %26 + %26 = OpLabel + %48 = OpIAdd %19 %54 %47 + OpBranch %23 + %25 = OpLabel + OpBranch %13 + %13 = OpLabel + %50 = OpIAdd %6 %51 %47 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 0 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpConstant %6 2 +%10 = OpTypeBool +%11 = OpTypeInt 32 1 +%12 = OpTypePointer Function %11 +%13 = OpConstant %11 0 +%14 = OpConstant %11 3 +%15 = OpTypeFloat 32 +%16 = OpConstant %6 6 +%17 = OpTypeArray %15 %16 +%18 = OpTypePointer Function %17 +%19 = OpConstant %6 3 +%20 = OpTypePointer Function %15 +%21 = OpConstant %11 1 +%2 = OpFunction %4 None %5 +%22 = OpLabel +%3 = OpVariable %18 Function +OpBranch %23 +%23 = OpLabel +OpBranch %28 +%28 = OpLabel +%29 = OpULessThan %10 %8 %9 +OpBranch %30 +%30 = OpLabel +OpBranch %31 +%31 = OpLabel +OpBranch %36 +%36 = OpLabel +%37 = OpSLessThan %10 %13 %14 +OpBranch %38 +%38 = OpLabel +%39 = OpBitcast %6 %13 +%40 = OpIMul %6 %8 %19 +%41 = OpIAdd %6 %39 %40 +%42 = OpConvertUToF %15 %8 +%43 = OpAccessChain %20 %3 %41 +OpStore %43 %42 +OpBranch %34 +%34 = OpLabel +%33 = OpIAdd %11 %13 %21 +OpBranch %44 +%44 = OpLabel +OpBranch %46 +%46 = OpLabel +%47 = OpSLessThan %10 %33 %14 +OpBranch %48 +%48 = OpLabel +%49 = OpBitcast %6 %33 +%50 = OpIMul %6 %8 %19 +%51 = OpIAdd %6 %49 %50 +%52 = OpConvertUToF %15 %8 +%53 = OpAccessChain %20 %3 %51 +OpStore %53 %52 +OpBranch %54 +%54 = OpLabel +%55 = OpIAdd %11 %33 %21 +OpBranch %56 +%56 = OpLabel +OpBranch %58 +%58 = OpLabel +%59 = OpSLessThan %10 %55 %14 +OpBranch %60 +%60 = OpLabel +%61 = OpBitcast %6 %55 +%62 = OpIMul %6 %8 %19 +%63 = OpIAdd %6 %61 %62 +%64 = OpConvertUToF %15 %8 +%65 = OpAccessChain %20 %3 %63 +OpStore %65 %64 +OpBranch %66 +%66 = OpLabel +%67 = OpIAdd %11 %55 %21 +OpBranch %35 +%35 = OpLabel +OpBranch %26 +%26 = OpLabel +%25 = OpIAdd %6 %8 %21 +OpBranch %68 +%68 = OpLabel +OpBranch %70 +%70 = OpLabel +%71 = OpULessThan %10 %25 %9 +OpBranch %72 +%72 = OpLabel +OpBranch %73 +%73 = OpLabel +OpBranch %74 +%74 = OpLabel +%75 = OpSLessThan %10 %13 %14 +OpBranch %76 +%76 = OpLabel +%77 = OpBitcast %6 %13 +%78 = OpIMul %6 %25 %19 +%79 = OpIAdd %6 %77 %78 +%80 = OpConvertUToF %15 %25 +%81 = OpAccessChain %20 %3 %79 +OpStore %81 %80 +OpBranch %82 +%82 = OpLabel +%83 = OpIAdd %11 %13 %21 +OpBranch %84 +%84 = OpLabel +OpBranch %85 +%85 = OpLabel +%86 = OpSLessThan %10 %83 %14 +OpBranch %87 +%87 = OpLabel +%88 = OpBitcast %6 %83 +%89 = OpIMul %6 %25 %19 +%90 = OpIAdd %6 %88 %89 +%91 = OpConvertUToF %15 %25 +%92 = OpAccessChain %20 %3 %90 +OpStore %92 %91 +OpBranch %93 +%93 = OpLabel +%94 = OpIAdd %11 %83 %21 +OpBranch %95 +%95 = OpLabel +OpBranch %96 +%96 = OpLabel +%97 = OpSLessThan %10 %94 %14 +OpBranch %98 +%98 = OpLabel +%99 = OpBitcast %6 %94 +%100 = OpIMul %6 %25 %19 +%101 = OpIAdd %6 %99 %100 +%102 = OpConvertUToF %15 %25 +%103 = OpAccessChain %20 %3 %101 +OpStore %103 %102 +OpBranch %104 +%104 = OpLabel +%105 = OpIAdd %11 %94 %21 +OpBranch %106 +%106 = OpLabel +OpBranch %107 +%107 = OpLabel +%108 = OpIAdd %6 %25 %21 +OpBranch %27 +%27 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[2]; + for (int i = -3; i < -1; i++) { + out_array[3 + i] = i; + } +} +*/ +TEST_F(PassClassTest, NegativeConditionAndInit) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %23 "out_array" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -3 + %16 = OpConstant %6 -1 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 2 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %25 = OpConstant %6 3 + %30 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %23 = OpVariable %22 Function + OpBranch %10 + %10 = OpLabel + %32 = OpPhi %6 %9 %5 %31 %13 + OpLoopMerge %12 %13 Unroll + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %32 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpIAdd %6 %32 %25 + %28 = OpAccessChain %7 %23 %26 + OpStore %28 %32 + OpBranch %13 + %13 = OpLabel + %31 = OpIAdd %6 %32 %30 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 -3 +%9 = OpConstant %6 -1 +%10 = OpTypeBool +%11 = OpTypeInt 32 0 +%12 = OpConstant %11 2 +%13 = OpTypeArray %6 %12 +%14 = OpTypePointer Function %13 +%15 = OpConstant %6 3 +%16 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%17 = OpLabel +%3 = OpVariable %14 Function +OpBranch %18 +%18 = OpLabel +OpBranch %23 +%23 = OpLabel +%24 = OpSLessThan %10 %8 %9 +OpBranch %25 +%25 = OpLabel +%26 = OpIAdd %6 %8 %15 +%27 = OpAccessChain %7 %3 %26 +OpStore %27 %8 +OpBranch %21 +%21 = OpLabel +%20 = OpIAdd %6 %8 %16 +OpBranch %28 +%28 = OpLabel +OpBranch %30 +%30 = OpLabel +%31 = OpSLessThan %10 %20 %9 +OpBranch %32 +%32 = OpLabel +%33 = OpIAdd %6 %20 %15 +%34 = OpAccessChain %7 %3 %33 +OpStore %34 %20 +OpBranch %35 +%35 = OpLabel +%36 = OpIAdd %6 %20 %16 +OpBranch %22 +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + // SinglePassRunAndCheck(text, expected, false); + + Function* f = spvtest::GetFunction(module, 4); + + LoopDescriptor& loop_descriptor = *context->GetLoopDescriptor(f); + EXPECT_EQ(loop_descriptor.NumLoops(), 1u); + + Loop& loop = loop_descriptor.GetLoopByIndex(0); + + EXPECT_TRUE(loop.HasUnrollLoopControl()); + + BasicBlock* condition = loop.FindConditionBlock(); + EXPECT_EQ(condition->id(), 14u); + + Instruction* induction = loop.FindConditionVariable(condition); + EXPECT_EQ(induction->result_id(), 32u); + + LoopUtils loop_utils{context.get(), &loop}; + EXPECT_TRUE(loop_utils.CanPerformUnroll()); + + size_t iterations = 0; + EXPECT_TRUE(loop.FindNumberOfIterations(induction, &*condition->ctail(), + &iterations)); + EXPECT_EQ(iterations, 2u); + SinglePassRunAndCheck(text, expected, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[9]; + for (int i = -10; i < -1; i++) { + out_array[i] = i; + } +} +*/ +TEST_F(PassClassTest, NegativeConditionAndInitResidualUnroll) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %23 "out_array" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 -10 + %16 = OpConstant %6 -1 + %17 = OpTypeBool + %19 = OpTypeInt 32 0 + %20 = OpConstant %19 9 + %21 = OpTypeArray %6 %20 + %22 = OpTypePointer Function %21 + %25 = OpConstant %6 10 + %30 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %23 = OpVariable %22 Function + OpBranch %10 + %10 = OpLabel + %32 = OpPhi %6 %9 %5 %31 %13 + OpLoopMerge %12 %13 Unroll + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %32 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %26 = OpIAdd %6 %32 %25 + %28 = OpAccessChain %7 %23 %26 + OpStore %28 %32 + OpBranch %13 + %13 = OpLabel + %31 = OpIAdd %6 %32 %30 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd +)"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 -10 +%9 = OpConstant %6 -1 +%10 = OpTypeBool +%11 = OpTypeInt 32 0 +%12 = OpConstant %11 9 +%13 = OpTypeArray %6 %12 +%14 = OpTypePointer Function %13 +%15 = OpConstant %6 10 +%16 = OpConstant %6 1 +%48 = OpConstant %6 -9 +%2 = OpFunction %4 None %5 +%17 = OpLabel +%3 = OpVariable %14 Function +OpBranch %18 +%18 = OpLabel +%19 = OpPhi %6 %8 %17 %20 %21 +OpLoopMerge %28 %21 Unroll +OpBranch %23 +%23 = OpLabel +%24 = OpSLessThan %10 %19 %48 +OpBranchConditional %24 %25 %28 +%25 = OpLabel +%26 = OpIAdd %6 %19 %15 +%27 = OpAccessChain %7 %3 %26 +OpStore %27 %19 +OpBranch %21 +%21 = OpLabel +%20 = OpIAdd %6 %19 %16 +OpBranch %18 +%28 = OpLabel +OpBranch %29 +%29 = OpLabel +%30 = OpPhi %6 %19 %28 %47 %46 +OpLoopMerge %38 %46 DontUnroll +OpBranch %31 +%31 = OpLabel +%32 = OpSLessThan %10 %30 %9 +OpBranchConditional %32 %33 %38 +%33 = OpLabel +%34 = OpIAdd %6 %30 %15 +%35 = OpAccessChain %7 %3 %34 +OpStore %35 %30 +OpBranch %36 +%36 = OpLabel +%37 = OpIAdd %6 %30 %16 +OpBranch %39 +%39 = OpLabel +OpBranch %41 +%41 = OpLabel +%42 = OpSLessThan %10 %37 %9 +OpBranch %43 +%43 = OpLabel +%44 = OpIAdd %6 %37 %15 +%45 = OpAccessChain %7 %3 %44 +OpStore %45 %37 +OpBranch %46 +%46 = OpLabel +%47 = OpIAdd %6 %37 %16 +OpBranch %29 +%38 = OpLabel +OpReturn +%22 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + Function* f = spvtest::GetFunction(module, 4); + + LoopDescriptor& loop_descriptor = *context->GetLoopDescriptor(f); + EXPECT_EQ(loop_descriptor.NumLoops(), 1u); + + Loop& loop = loop_descriptor.GetLoopByIndex(0); + + EXPECT_TRUE(loop.HasUnrollLoopControl()); + + BasicBlock* condition = loop.FindConditionBlock(); + EXPECT_EQ(condition->id(), 14u); + + Instruction* induction = loop.FindConditionVariable(condition); + EXPECT_EQ(induction->result_id(), 32u); + + LoopUtils loop_utils{context.get(), &loop}; + EXPECT_TRUE(loop_utils.CanPerformUnroll()); + + size_t iterations = 0; + EXPECT_TRUE(loop.FindNumberOfIterations(induction, &*condition->ctail(), + &iterations)); + EXPECT_EQ(iterations, 9u); + SinglePassRunAndCheck>(text, expected, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[10]; + for (uint i = 0; i < 2; i++) { + for (int x = 0; x < 5; ++x) { + out_array[x + i*5] = i; + } + } +} +*/ +TEST_F(PassClassTest, UnrollNestedLoopsValidateDescriptor) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %35 "out_array" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 0 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 2 + %17 = OpTypeBool + %19 = OpTypeInt 32 1 + %20 = OpTypePointer Function %19 + %22 = OpConstant %19 0 + %29 = OpConstant %19 5 + %31 = OpTypeFloat 32 + %32 = OpConstant %6 10 + %33 = OpTypeArray %31 %32 + %34 = OpTypePointer Function %33 + %39 = OpConstant %6 5 + %44 = OpTypePointer Function %31 + %47 = OpConstant %19 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %35 = OpVariable %34 Function + OpBranch %10 + %10 = OpLabel + %51 = OpPhi %6 %9 %5 %50 %13 + OpLoopMerge %12 %13 Unroll + OpBranch %14 + %14 = OpLabel + %18 = OpULessThan %17 %51 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + OpBranch %23 + %23 = OpLabel + %54 = OpPhi %19 %22 %11 %48 %26 + OpLoopMerge %25 %26 Unroll + OpBranch %27 + %27 = OpLabel + %30 = OpSLessThan %17 %54 %29 + OpBranchConditional %30 %24 %25 + %24 = OpLabel + %37 = OpBitcast %6 %54 + %40 = OpIMul %6 %51 %39 + %41 = OpIAdd %6 %37 %40 + %43 = OpConvertUToF %31 %51 + %45 = OpAccessChain %44 %35 %41 + OpStore %45 %43 + OpBranch %26 + %26 = OpLabel + %48 = OpIAdd %19 %54 %47 + OpBranch %23 + %25 = OpLabel + OpBranch %13 + %13 = OpLabel + %50 = OpIAdd %6 %51 %47 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + { // Test fully unroll + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& loop_descriptor = *context->GetLoopDescriptor(f); + EXPECT_EQ(loop_descriptor.NumLoops(), 2u); + + Loop& outer_loop = loop_descriptor.GetLoopByIndex(1); + + EXPECT_TRUE(outer_loop.HasUnrollLoopControl()); + + Loop& inner_loop = loop_descriptor.GetLoopByIndex(0); + + EXPECT_TRUE(inner_loop.HasUnrollLoopControl()); + + EXPECT_EQ(outer_loop.GetBlocks().size(), 9u); + + EXPECT_EQ(inner_loop.GetBlocks().size(), 4u); + EXPECT_EQ(outer_loop.NumImmediateChildren(), 1u); + EXPECT_EQ(inner_loop.NumImmediateChildren(), 0u); + + { + LoopUtils loop_utils{context.get(), &inner_loop}; + loop_utils.FullyUnroll(); + loop_utils.Finalize(); + } + + EXPECT_EQ(loop_descriptor.NumLoops(), 1u); + EXPECT_EQ(outer_loop.GetBlocks().size(), 25u); + EXPECT_EQ(outer_loop.NumImmediateChildren(), 0u); + { + LoopUtils loop_utils{context.get(), &outer_loop}; + loop_utils.FullyUnroll(); + loop_utils.Finalize(); + } + EXPECT_EQ(loop_descriptor.NumLoops(), 0u); + } + + { // Test partially unroll + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + + Function* f = spvtest::GetFunction(module, 4); + LoopDescriptor& loop_descriptor = *context->GetLoopDescriptor(f); + EXPECT_EQ(loop_descriptor.NumLoops(), 2u); + + Loop& outer_loop = loop_descriptor.GetLoopByIndex(1); + + EXPECT_TRUE(outer_loop.HasUnrollLoopControl()); + + Loop& inner_loop = loop_descriptor.GetLoopByIndex(0); + + EXPECT_TRUE(inner_loop.HasUnrollLoopControl()); + + EXPECT_EQ(outer_loop.GetBlocks().size(), 9u); + + EXPECT_EQ(inner_loop.GetBlocks().size(), 4u); + + EXPECT_EQ(outer_loop.NumImmediateChildren(), 1u); + EXPECT_EQ(inner_loop.NumImmediateChildren(), 0u); + + LoopUtils loop_utils{context.get(), &inner_loop}; + loop_utils.PartiallyUnroll(2); + loop_utils.Finalize(); + + // The number of loops should actually grow. + EXPECT_EQ(loop_descriptor.NumLoops(), 3u); + EXPECT_EQ(outer_loop.GetBlocks().size(), 18u); + EXPECT_EQ(outer_loop.NumImmediateChildren(), 2u); + } +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[3]; + for (int i = 3; i > 0; --i) { + out_array[i] = i; + } +} +*/ +TEST_F(PassClassTest, FullyUnrollNegativeStepLoopTest) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %24 "out_array" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 3 + %16 = OpConstant %6 0 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 3 + %22 = OpTypeArray %19 %21 + %23 = OpTypePointer Function %22 + %28 = OpTypePointer Function %19 + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + OpBranch %10 + %10 = OpLabel + %33 = OpPhi %6 %9 %5 %32 %13 + OpLoopMerge %12 %13 Unroll + OpBranch %14 + %14 = OpLabel + %18 = OpSGreaterThan %17 %33 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpConvertSToF %19 %33 + %29 = OpAccessChain %28 %24 %33 + OpStore %29 %27 + OpBranch %13 + %13 = OpLabel + %32 = OpISub %6 %33 %31 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 3 +%9 = OpConstant %6 0 +%10 = OpTypeBool +%11 = OpTypeFloat 32 +%12 = OpTypeInt 32 0 +%13 = OpConstant %12 3 +%14 = OpTypeArray %11 %13 +%15 = OpTypePointer Function %14 +%16 = OpTypePointer Function %11 +%17 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%18 = OpLabel +%3 = OpVariable %15 Function +OpBranch %19 +%19 = OpLabel +OpBranch %24 +%24 = OpLabel +%25 = OpSGreaterThan %10 %8 %9 +OpBranch %26 +%26 = OpLabel +%27 = OpConvertSToF %11 %8 +%28 = OpAccessChain %16 %3 %8 +OpStore %28 %27 +OpBranch %22 +%22 = OpLabel +%21 = OpISub %6 %8 %17 +OpBranch %29 +%29 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpSGreaterThan %10 %21 %9 +OpBranch %33 +%33 = OpLabel +%34 = OpConvertSToF %11 %21 +%35 = OpAccessChain %16 %3 %21 +OpStore %35 %34 +OpBranch %36 +%36 = OpLabel +%37 = OpISub %6 %21 %17 +OpBranch %38 +%38 = OpLabel +OpBranch %40 +%40 = OpLabel +%41 = OpSGreaterThan %10 %37 %9 +OpBranch %42 +%42 = OpLabel +%43 = OpConvertSToF %11 %37 +%44 = OpAccessChain %16 %3 %37 +OpStore %44 %43 +OpBranch %45 +%45 = OpLabel +%46 = OpISub %6 %37 %17 +OpBranch %23 +%23 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[3]; + for (int i = 9; i > 0; i-=3) { + out_array[i] = i; + } +} +*/ +TEST_F(PassClassTest, FullyUnrollNegativeNonOneStepLoop) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %24 "out_array" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 9 + %16 = OpConstant %6 0 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 3 + %22 = OpTypeArray %19 %21 + %23 = OpTypePointer Function %22 + %28 = OpTypePointer Function %19 + %30 = OpConstant %6 3 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %24 = OpVariable %23 Function + OpBranch %10 + %10 = OpLabel + %33 = OpPhi %6 %9 %5 %32 %13 + OpLoopMerge %12 %13 Unroll + OpBranch %14 + %14 = OpLabel + %18 = OpSGreaterThan %17 %33 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %27 = OpConvertSToF %19 %33 + %29 = OpAccessChain %28 %24 %33 + OpStore %29 %27 + OpBranch %13 + %13 = OpLabel + %32 = OpISub %6 %33 %30 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 9 +%9 = OpConstant %6 0 +%10 = OpTypeBool +%11 = OpTypeFloat 32 +%12 = OpTypeInt 32 0 +%13 = OpConstant %12 3 +%14 = OpTypeArray %11 %13 +%15 = OpTypePointer Function %14 +%16 = OpTypePointer Function %11 +%17 = OpConstant %6 3 +%2 = OpFunction %4 None %5 +%18 = OpLabel +%3 = OpVariable %15 Function +OpBranch %19 +%19 = OpLabel +OpBranch %24 +%24 = OpLabel +%25 = OpSGreaterThan %10 %8 %9 +OpBranch %26 +%26 = OpLabel +%27 = OpConvertSToF %11 %8 +%28 = OpAccessChain %16 %3 %8 +OpStore %28 %27 +OpBranch %22 +%22 = OpLabel +%21 = OpISub %6 %8 %17 +OpBranch %29 +%29 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpSGreaterThan %10 %21 %9 +OpBranch %33 +%33 = OpLabel +%34 = OpConvertSToF %11 %21 +%35 = OpAccessChain %16 %3 %21 +OpStore %35 %34 +OpBranch %36 +%36 = OpLabel +%37 = OpISub %6 %21 %17 +OpBranch %38 +%38 = OpLabel +OpBranch %40 +%40 = OpLabel +%41 = OpSGreaterThan %10 %37 %9 +OpBranch %42 +%42 = OpLabel +%43 = OpConvertSToF %11 %37 +%44 = OpAccessChain %16 %3 %37 +OpStore %44 %43 +OpBranch %45 +%45 = OpLabel +%46 = OpISub %6 %37 %17 +OpBranch %23 +%23 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[3]; + for (int i = 0; i < 7; i+=3) { + out_array[i] = i; + } +} +*/ +TEST_F(PassClassTest, FullyUnrollNonDivisibleStepLoop) { + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %4 "main" +OpExecutionMode %4 OriginUpperLeft +OpSource GLSL 410 +OpName %4 "main" +OpName %24 "out_array" +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%9 = OpConstant %6 0 +%16 = OpConstant %6 7 +%17 = OpTypeBool +%19 = OpTypeFloat 32 +%20 = OpTypeInt 32 0 +%21 = OpConstant %20 3 +%22 = OpTypeArray %19 %21 +%23 = OpTypePointer Function %22 +%28 = OpTypePointer Function %19 +%30 = OpConstant %6 3 +%4 = OpFunction %2 None %3 +%5 = OpLabel +%24 = OpVariable %23 Function +OpBranch %10 +%10 = OpLabel +%33 = OpPhi %6 %9 %5 %32 %13 +OpLoopMerge %12 %13 Unroll +OpBranch %14 +%14 = OpLabel +%18 = OpSLessThan %17 %33 %16 +OpBranchConditional %18 %11 %12 +%11 = OpLabel +%27 = OpConvertSToF %19 %33 +%29 = OpAccessChain %28 %24 %33 +OpStore %29 %27 +OpBranch %13 +%13 = OpLabel +%32 = OpIAdd %6 %33 %30 +OpBranch %10 +%12 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 0 +%9 = OpConstant %6 7 +%10 = OpTypeBool +%11 = OpTypeFloat 32 +%12 = OpTypeInt 32 0 +%13 = OpConstant %12 3 +%14 = OpTypeArray %11 %13 +%15 = OpTypePointer Function %14 +%16 = OpTypePointer Function %11 +%17 = OpConstant %6 3 +%2 = OpFunction %4 None %5 +%18 = OpLabel +%3 = OpVariable %15 Function +OpBranch %19 +%19 = OpLabel +OpBranch %24 +%24 = OpLabel +%25 = OpSLessThan %10 %8 %9 +OpBranch %26 +%26 = OpLabel +%27 = OpConvertSToF %11 %8 +%28 = OpAccessChain %16 %3 %8 +OpStore %28 %27 +OpBranch %22 +%22 = OpLabel +%21 = OpIAdd %6 %8 %17 +OpBranch %29 +%29 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpSLessThan %10 %21 %9 +OpBranch %33 +%33 = OpLabel +%34 = OpConvertSToF %11 %21 +%35 = OpAccessChain %16 %3 %21 +OpStore %35 %34 +OpBranch %36 +%36 = OpLabel +%37 = OpIAdd %6 %21 %17 +OpBranch %38 +%38 = OpLabel +OpBranch %40 +%40 = OpLabel +%41 = OpSLessThan %10 %37 %9 +OpBranch %42 +%42 = OpLabel +%43 = OpConvertSToF %11 %37 +%44 = OpAccessChain %16 %3 %37 +OpStore %44 %43 +OpBranch %45 +%45 = OpLabel +%46 = OpIAdd %6 %37 %17 +OpBranch %23 +%23 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +/* +Generated from the following GLSL +#version 410 core +void main() { + float out_array[4]; + for (int i = 11; i > 0; i-=3) { + out_array[i] = i; + } +} +*/ +TEST_F(PassClassTest, FullyUnrollNegativeNonDivisibleStepLoop) { + // With LocalMultiStoreElimPass + const std::string text = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %4 "main" +OpExecutionMode %4 OriginUpperLeft +OpSource GLSL 410 +OpName %4 "main" +OpName %24 "out_array" +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%9 = OpConstant %6 11 +%16 = OpConstant %6 0 +%17 = OpTypeBool +%19 = OpTypeFloat 32 +%20 = OpTypeInt 32 0 +%21 = OpConstant %20 4 +%22 = OpTypeArray %19 %21 +%23 = OpTypePointer Function %22 +%28 = OpTypePointer Function %19 +%30 = OpConstant %6 3 +%4 = OpFunction %2 None %3 +%5 = OpLabel +%24 = OpVariable %23 Function +OpBranch %10 +%10 = OpLabel +%33 = OpPhi %6 %9 %5 %32 %13 +OpLoopMerge %12 %13 Unroll +OpBranch %14 +%14 = OpLabel +%18 = OpSGreaterThan %17 %33 %16 +OpBranchConditional %18 %11 %12 +%11 = OpLabel +%27 = OpConvertSToF %19 %33 +%29 = OpAccessChain %28 %24 %33 +OpStore %29 %27 +OpBranch %13 +%13 = OpLabel +%32 = OpISub %6 %33 %30 +OpBranch %10 +%12 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "out_array" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypePointer Function %6 +%8 = OpConstant %6 11 +%9 = OpConstant %6 0 +%10 = OpTypeBool +%11 = OpTypeFloat 32 +%12 = OpTypeInt 32 0 +%13 = OpConstant %12 4 +%14 = OpTypeArray %11 %13 +%15 = OpTypePointer Function %14 +%16 = OpTypePointer Function %11 +%17 = OpConstant %6 3 +%2 = OpFunction %4 None %5 +%18 = OpLabel +%3 = OpVariable %15 Function +OpBranch %19 +%19 = OpLabel +OpBranch %24 +%24 = OpLabel +%25 = OpSGreaterThan %10 %8 %9 +OpBranch %26 +%26 = OpLabel +%27 = OpConvertSToF %11 %8 +%28 = OpAccessChain %16 %3 %8 +OpStore %28 %27 +OpBranch %22 +%22 = OpLabel +%21 = OpISub %6 %8 %17 +OpBranch %29 +%29 = OpLabel +OpBranch %31 +%31 = OpLabel +%32 = OpSGreaterThan %10 %21 %9 +OpBranch %33 +%33 = OpLabel +%34 = OpConvertSToF %11 %21 +%35 = OpAccessChain %16 %3 %21 +OpStore %35 %34 +OpBranch %36 +%36 = OpLabel +%37 = OpISub %6 %21 %17 +OpBranch %38 +%38 = OpLabel +OpBranch %40 +%40 = OpLabel +%41 = OpSGreaterThan %10 %37 %9 +OpBranch %42 +%42 = OpLabel +%43 = OpConvertSToF %11 %37 +%44 = OpAccessChain %16 %3 %37 +OpStore %44 %43 +OpBranch %45 +%45 = OpLabel +%46 = OpISub %6 %37 %17 +OpBranch %47 +%47 = OpLabel +OpBranch %49 +%49 = OpLabel +%50 = OpSGreaterThan %10 %46 %9 +OpBranch %51 +%51 = OpLabel +%52 = OpConvertSToF %11 %46 +%53 = OpAccessChain %16 %3 %46 +OpStore %53 %52 +OpBranch %54 +%54 = OpLabel +%55 = OpISub %6 %46 %17 +OpBranch %23 +%23 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +// With LocalMultiStoreElimPass +static const std::string multiple_phi_shader = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %8 "foo(" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypeFunction %6 + %10 = OpTypePointer Function %6 + %12 = OpConstant %6 0 + %14 = OpConstant %6 3 + %22 = OpConstant %6 6 + %23 = OpTypeBool + %31 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %40 = OpFunctionCall %6 %8 + OpReturn + OpFunctionEnd + %8 = OpFunction %6 None %7 + %9 = OpLabel + OpBranch %16 + %16 = OpLabel + %41 = OpPhi %6 %12 %9 %34 %19 + %42 = OpPhi %6 %14 %9 %29 %19 + %43 = OpPhi %6 %12 %9 %32 %19 + OpLoopMerge %18 %19 Unroll + OpBranch %20 + %20 = OpLabel + %24 = OpSLessThan %23 %43 %22 + OpBranchConditional %24 %17 %18 + %17 = OpLabel + %27 = OpIMul %6 %43 %41 + %29 = OpIAdd %6 %42 %27 + OpBranch %19 + %19 = OpLabel + %32 = OpIAdd %6 %43 %31 + %34 = OpISub %6 %41 %31 + OpBranch %16 + %18 = OpLabel + %37 = OpIAdd %6 %42 %41 + OpReturnValue %37 + OpFunctionEnd + )"; + +TEST_F(PassClassTest, PartiallyUnrollResidualMultipleInductionVariables) { + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "foo(" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypeFunction %6 +%8 = OpTypePointer Function %6 +%9 = OpConstant %6 0 +%10 = OpConstant %6 3 +%11 = OpConstant %6 6 +%12 = OpTypeBool +%13 = OpConstant %6 1 +%82 = OpTypeInt 32 0 +%83 = OpConstant %82 2 +%2 = OpFunction %4 None %5 +%14 = OpLabel +%15 = OpFunctionCall %6 %3 +OpReturn +OpFunctionEnd +%3 = OpFunction %6 None %7 +%16 = OpLabel +OpBranch %17 +%17 = OpLabel +%18 = OpPhi %6 %9 %16 %19 %20 +%21 = OpPhi %6 %10 %16 %22 %20 +%23 = OpPhi %6 %9 %16 %24 %20 +OpLoopMerge %31 %20 Unroll +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %23 %83 +OpBranchConditional %27 %28 %31 +%28 = OpLabel +%29 = OpIMul %6 %23 %18 +%22 = OpIAdd %6 %21 %29 +OpBranch %20 +%20 = OpLabel +%24 = OpIAdd %6 %23 %13 +%19 = OpISub %6 %18 %13 +OpBranch %17 +%31 = OpLabel +OpBranch %32 +%32 = OpLabel +%33 = OpPhi %6 %18 %31 %81 %79 +%34 = OpPhi %6 %21 %31 %78 %79 +%35 = OpPhi %6 %23 %31 %80 %79 +OpLoopMerge %44 %79 DontUnroll +OpBranch %36 +%36 = OpLabel +%37 = OpSLessThan %12 %35 %11 +OpBranchConditional %37 %38 %44 +%38 = OpLabel +%39 = OpIMul %6 %35 %33 +%40 = OpIAdd %6 %34 %39 +OpBranch %41 +%41 = OpLabel +%42 = OpIAdd %6 %35 %13 +%43 = OpISub %6 %33 %13 +OpBranch %46 +%46 = OpLabel +OpBranch %50 +%50 = OpLabel +%51 = OpSLessThan %12 %42 %11 +OpBranch %52 +%52 = OpLabel +%53 = OpIMul %6 %42 %43 +%54 = OpIAdd %6 %40 %53 +OpBranch %55 +%55 = OpLabel +%56 = OpIAdd %6 %42 %13 +%57 = OpISub %6 %43 %13 +OpBranch %58 +%58 = OpLabel +OpBranch %62 +%62 = OpLabel +%63 = OpSLessThan %12 %56 %11 +OpBranch %64 +%64 = OpLabel +%65 = OpIMul %6 %56 %57 +%66 = OpIAdd %6 %54 %65 +OpBranch %67 +%67 = OpLabel +%68 = OpIAdd %6 %56 %13 +%69 = OpISub %6 %57 %13 +OpBranch %70 +%70 = OpLabel +OpBranch %74 +%74 = OpLabel +%75 = OpSLessThan %12 %68 %11 +OpBranch %76 +%76 = OpLabel +%77 = OpIMul %6 %68 %69 +%78 = OpIAdd %6 %66 %77 +OpBranch %79 +%79 = OpLabel +%80 = OpIAdd %6 %68 %13 +%81 = OpISub %6 %69 %13 +OpBranch %32 +%44 = OpLabel +%45 = OpIAdd %6 %34 %33 +OpReturnValue %45 +%25 = OpLabel +%30 = OpIAdd %6 %34 %33 +OpReturnValue %30 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, multiple_phi_shader, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << multiple_phi_shader << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck>(multiple_phi_shader, output, + false); +} + +TEST_F(PassClassTest, PartiallyUnrollMultipleInductionVariables) { + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "foo(" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypeFunction %6 +%8 = OpTypePointer Function %6 +%9 = OpConstant %6 0 +%10 = OpConstant %6 3 +%11 = OpConstant %6 6 +%12 = OpTypeBool +%13 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%14 = OpLabel +%15 = OpFunctionCall %6 %3 +OpReturn +OpFunctionEnd +%3 = OpFunction %6 None %7 +%16 = OpLabel +OpBranch %17 +%17 = OpLabel +%18 = OpPhi %6 %9 %16 %42 %40 +%21 = OpPhi %6 %10 %16 %39 %40 +%23 = OpPhi %6 %9 %16 %41 %40 +OpLoopMerge %25 %40 DontUnroll +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %23 %11 +OpBranchConditional %27 %28 %25 +%28 = OpLabel +%29 = OpIMul %6 %23 %18 +%22 = OpIAdd %6 %21 %29 +OpBranch %20 +%20 = OpLabel +%24 = OpIAdd %6 %23 %13 +%19 = OpISub %6 %18 %13 +OpBranch %31 +%31 = OpLabel +OpBranch %35 +%35 = OpLabel +%36 = OpSLessThan %12 %24 %11 +OpBranch %37 +%37 = OpLabel +%38 = OpIMul %6 %24 %19 +%39 = OpIAdd %6 %22 %38 +OpBranch %40 +%40 = OpLabel +%41 = OpIAdd %6 %24 %13 +%42 = OpISub %6 %19 %13 +OpBranch %17 +%25 = OpLabel +%30 = OpIAdd %6 %21 %18 +OpReturnValue %30 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, multiple_phi_shader, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << multiple_phi_shader << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck>(multiple_phi_shader, output, + false); +} + +TEST_F(PassClassTest, FullyUnrollMultipleInductionVariables) { + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 410 +OpName %2 "main" +OpName %3 "foo(" +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpTypeInt 32 1 +%7 = OpTypeFunction %6 +%8 = OpTypePointer Function %6 +%9 = OpConstant %6 0 +%10 = OpConstant %6 3 +%11 = OpConstant %6 6 +%12 = OpTypeBool +%13 = OpConstant %6 1 +%2 = OpFunction %4 None %5 +%14 = OpLabel +%15 = OpFunctionCall %6 %3 +OpReturn +OpFunctionEnd +%3 = OpFunction %6 None %7 +%16 = OpLabel +OpBranch %17 +%17 = OpLabel +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %12 %9 %11 +OpBranch %28 +%28 = OpLabel +%29 = OpIMul %6 %9 %9 +%22 = OpIAdd %6 %10 %29 +OpBranch %20 +%20 = OpLabel +%24 = OpIAdd %6 %9 %13 +%19 = OpISub %6 %9 %13 +OpBranch %31 +%31 = OpLabel +OpBranch %35 +%35 = OpLabel +%36 = OpSLessThan %12 %24 %11 +OpBranch %37 +%37 = OpLabel +%38 = OpIMul %6 %24 %19 +%39 = OpIAdd %6 %22 %38 +OpBranch %40 +%40 = OpLabel +%41 = OpIAdd %6 %24 %13 +%42 = OpISub %6 %19 %13 +OpBranch %43 +%43 = OpLabel +OpBranch %47 +%47 = OpLabel +%48 = OpSLessThan %12 %41 %11 +OpBranch %49 +%49 = OpLabel +%50 = OpIMul %6 %41 %42 +%51 = OpIAdd %6 %39 %50 +OpBranch %52 +%52 = OpLabel +%53 = OpIAdd %6 %41 %13 +%54 = OpISub %6 %42 %13 +OpBranch %55 +%55 = OpLabel +OpBranch %59 +%59 = OpLabel +%60 = OpSLessThan %12 %53 %11 +OpBranch %61 +%61 = OpLabel +%62 = OpIMul %6 %53 %54 +%63 = OpIAdd %6 %51 %62 +OpBranch %64 +%64 = OpLabel +%65 = OpIAdd %6 %53 %13 +%66 = OpISub %6 %54 %13 +OpBranch %67 +%67 = OpLabel +OpBranch %71 +%71 = OpLabel +%72 = OpSLessThan %12 %65 %11 +OpBranch %73 +%73 = OpLabel +%74 = OpIMul %6 %65 %66 +%75 = OpIAdd %6 %63 %74 +OpBranch %76 +%76 = OpLabel +%77 = OpIAdd %6 %65 %13 +%78 = OpISub %6 %66 %13 +OpBranch %79 +%79 = OpLabel +OpBranch %83 +%83 = OpLabel +%84 = OpSLessThan %12 %77 %11 +OpBranch %85 +%85 = OpLabel +%86 = OpIMul %6 %77 %78 +%87 = OpIAdd %6 %75 %86 +OpBranch %88 +%88 = OpLabel +%89 = OpIAdd %6 %77 %13 +%90 = OpISub %6 %78 %13 +OpBranch %25 +%25 = OpLabel +%30 = OpIAdd %6 %87 %90 +OpReturnValue %30 +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, multiple_phi_shader, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << multiple_phi_shader << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(multiple_phi_shader, output, false); +} + +/* +Generated from the following GLSL +#version 440 core +void main() +{ + int j = 0; + for (int i = 0; i <= 2; ++i) + ++j; + + for (int i = 1; i >= 0; --i) + ++j; +} +*/ +TEST_F(PassClassTest, FullyUnrollEqualToOperations) { + // With LocalMultiStoreElimPass + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 440 + OpName %4 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %17 = OpConstant %6 2 + %18 = OpTypeBool + %21 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %11 + %11 = OpLabel + %37 = OpPhi %6 %9 %5 %22 %14 + %38 = OpPhi %6 %9 %5 %24 %14 + OpLoopMerge %13 %14 Unroll + OpBranch %15 + %15 = OpLabel + %19 = OpSLessThanEqual %18 %38 %17 + OpBranchConditional %19 %12 %13 + %12 = OpLabel + %22 = OpIAdd %6 %37 %21 + OpBranch %14 + %14 = OpLabel + %24 = OpIAdd %6 %38 %21 + OpBranch %11 + %13 = OpLabel + OpBranch %26 + %26 = OpLabel + %39 = OpPhi %6 %37 %13 %34 %29 + %40 = OpPhi %6 %21 %13 %36 %29 + OpLoopMerge %28 %29 Unroll + OpBranch %30 + %30 = OpLabel + %32 = OpSGreaterThanEqual %18 %40 %9 + OpBranchConditional %32 %27 %28 + %27 = OpLabel + %34 = OpIAdd %6 %39 %21 + OpBranch %29 + %29 = OpLabel + %36 = OpISub %6 %40 %21 + OpBranch %26 + %28 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string output = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 440 +OpName %2 "main" +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpTypePointer Function %5 +%7 = OpConstant %5 0 +%8 = OpConstant %5 2 +%9 = OpTypeBool +%10 = OpConstant %5 1 +%2 = OpFunction %3 None %4 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +OpBranch %19 +%19 = OpLabel +%20 = OpSLessThanEqual %9 %7 %8 +OpBranch %21 +%21 = OpLabel +%14 = OpIAdd %5 %7 %10 +OpBranch %15 +%15 = OpLabel +%17 = OpIAdd %5 %7 %10 +OpBranch %41 +%41 = OpLabel +OpBranch %44 +%44 = OpLabel +%45 = OpSLessThanEqual %9 %17 %8 +OpBranch %46 +%46 = OpLabel +%47 = OpIAdd %5 %14 %10 +OpBranch %48 +%48 = OpLabel +%49 = OpIAdd %5 %17 %10 +OpBranch %50 +%50 = OpLabel +OpBranch %53 +%53 = OpLabel +%54 = OpSLessThanEqual %9 %49 %8 +OpBranch %55 +%55 = OpLabel +%56 = OpIAdd %5 %47 %10 +OpBranch %57 +%57 = OpLabel +%58 = OpIAdd %5 %49 %10 +OpBranch %18 +%18 = OpLabel +OpBranch %22 +%22 = OpLabel +OpBranch %29 +%29 = OpLabel +%30 = OpSGreaterThanEqual %9 %10 %7 +OpBranch %31 +%31 = OpLabel +%24 = OpIAdd %5 %56 %10 +OpBranch %25 +%25 = OpLabel +%27 = OpISub %5 %10 %10 +OpBranch %32 +%32 = OpLabel +OpBranch %35 +%35 = OpLabel +%36 = OpSGreaterThanEqual %9 %27 %7 +OpBranch %37 +%37 = OpLabel +%38 = OpIAdd %5 %24 %10 +OpBranch %39 +%39 = OpLabel +%40 = OpISub %5 %27 %10 +OpBranch %28 +%28 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << text << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(text, output, false); +} + +// With LocalMultiStoreElimPass +const std::string condition_in_header = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpDecorate %o Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %int_n2 = OpConstant %int -2 + %int_2 = OpConstant %int 2 + %bool = OpTypeBool + %float = OpTypeFloat 32 +%_ptr_Output_float = OpTypePointer Output %float + %o = OpVariable %_ptr_Output_float Output + %float_1 = OpConstant %float 1 + %main = OpFunction %void None %6 + %15 = OpLabel + OpBranch %16 + %16 = OpLabel + %27 = OpPhi %int %int_n2 %15 %26 %18 + %21 = OpSLessThanEqual %bool %27 %int_2 + OpLoopMerge %17 %18 Unroll + OpBranchConditional %21 %22 %17 + %22 = OpLabel + %23 = OpLoad %float %o + %24 = OpFAdd %float %23 %float_1 + OpStore %o %24 + OpBranch %18 + %18 = OpLabel + %26 = OpIAdd %int %27 %int_2 + OpBranch %16 + %17 = OpLabel + OpReturn + OpFunctionEnd + )"; + +TEST_F(PassClassTest, FullyUnrollConditionIsInHeaderBlock) { + const std::string output = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpSource GLSL 430 +OpDecorate %2 Location 0 +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpConstant %5 -2 +%7 = OpConstant %5 2 +%8 = OpTypeBool +%9 = OpTypeFloat 32 +%10 = OpTypePointer Output %9 +%2 = OpVariable %10 Output +%11 = OpConstant %9 1 +%1 = OpFunction %3 None %4 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%17 = OpSLessThanEqual %8 %6 %7 +OpBranch %19 +%19 = OpLabel +%20 = OpLoad %9 %2 +%21 = OpFAdd %9 %20 %11 +OpStore %2 %21 +OpBranch %16 +%16 = OpLabel +%15 = OpIAdd %5 %6 %7 +OpBranch %22 +%22 = OpLabel +%24 = OpSLessThanEqual %8 %15 %7 +OpBranch %25 +%25 = OpLabel +%26 = OpLoad %9 %2 +%27 = OpFAdd %9 %26 %11 +OpStore %2 %27 +OpBranch %28 +%28 = OpLabel +%29 = OpIAdd %5 %15 %7 +OpBranch %30 +%30 = OpLabel +%32 = OpSLessThanEqual %8 %29 %7 +OpBranch %33 +%33 = OpLabel +%34 = OpLoad %9 %2 +%35 = OpFAdd %9 %34 %11 +OpStore %2 %35 +OpBranch %36 +%36 = OpLabel +%37 = OpIAdd %5 %29 %7 +OpBranch %18 +%18 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, condition_in_header, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << condition_in_header << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(condition_in_header, output, false); +} + +TEST_F(PassClassTest, PartiallyUnrollResidualConditionIsInHeaderBlock) { + const std::string output = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "main" %2 +OpExecutionMode %1 OriginUpperLeft +OpSource GLSL 430 +OpDecorate %2 Location 0 +%3 = OpTypeVoid +%4 = OpTypeFunction %3 +%5 = OpTypeInt 32 1 +%6 = OpConstant %5 -2 +%7 = OpConstant %5 2 +%8 = OpTypeBool +%9 = OpTypeFloat 32 +%10 = OpTypePointer Output %9 +%2 = OpVariable %10 Output +%11 = OpConstant %9 1 +%40 = OpTypeInt 32 0 +%41 = OpConstant %40 1 +%1 = OpFunction %3 None %4 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%14 = OpPhi %5 %6 %12 %15 %16 +%17 = OpSLessThanEqual %8 %14 %41 +OpLoopMerge %22 %16 Unroll +OpBranchConditional %17 %19 %22 +%19 = OpLabel +%20 = OpLoad %9 %2 +%21 = OpFAdd %9 %20 %11 +OpStore %2 %21 +OpBranch %16 +%16 = OpLabel +%15 = OpIAdd %5 %14 %7 +OpBranch %13 +%22 = OpLabel +OpBranch %23 +%23 = OpLabel +%24 = OpPhi %5 %14 %22 %39 %38 +%25 = OpSLessThanEqual %8 %24 %7 +OpLoopMerge %31 %38 DontUnroll +OpBranchConditional %25 %26 %31 +%26 = OpLabel +%27 = OpLoad %9 %2 +%28 = OpFAdd %9 %27 %11 +OpStore %2 %28 +OpBranch %29 +%29 = OpLabel +%30 = OpIAdd %5 %24 %7 +OpBranch %32 +%32 = OpLabel +%34 = OpSLessThanEqual %8 %30 %7 +OpBranch %35 +%35 = OpLabel +%36 = OpLoad %9 %2 +%37 = OpFAdd %9 %36 %11 +OpStore %2 %37 +OpBranch %38 +%38 = OpLabel +%39 = OpIAdd %5 %30 %7 +OpBranch %23 +%31 = OpLabel +OpReturn +%18 = OpLabel +OpReturn +OpFunctionEnd +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, condition_in_header, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for ushader:\n" + << condition_in_header << std::endl; + + LoopUnroller loop_unroller; + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck>(condition_in_header, output, + false); +} + +/* +Generated from following GLSL with latch block artificially inserted to be +seperate from continue. +#version 430 +void main(void) { + float x[10]; + for (int i = 0; i < 10; ++i) { + x[i] = i; + } +} +*/ +TEST_F(PassClassTest, PartiallyUnrollLatchNotContinue) { + const std::string text = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "x" + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %10 = OpConstant %7 10 + %11 = OpTypeBool + %12 = OpTypeFloat 32 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %12 %14 + %16 = OpTypePointer Function %15 + %17 = OpTypePointer Function %12 + %18 = OpConstant %7 1 + %2 = OpFunction %5 None %6 + %19 = OpLabel + %3 = OpVariable %8 Function + %4 = OpVariable %16 Function + OpStore %3 %9 + OpBranch %20 + %20 = OpLabel + %21 = OpPhi %7 %9 %19 %22 %30 + OpLoopMerge %24 %23 Unroll + OpBranch %25 + %25 = OpLabel + %26 = OpSLessThan %11 %21 %10 + OpBranchConditional %26 %27 %24 + %27 = OpLabel + %28 = OpConvertSToF %12 %21 + %29 = OpAccessChain %17 %4 %21 + OpStore %29 %28 + OpBranch %23 + %23 = OpLabel + %22 = OpIAdd %7 %21 %18 + OpStore %3 %22 + OpBranch %30 + %30 = OpLabel + OpBranch %20 + %24 = OpLabel + OpReturn + OpFunctionEnd + )"; + + const std::string expected = R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %2 "main" +OpExecutionMode %2 OriginUpperLeft +OpSource GLSL 430 +OpName %2 "main" +OpName %3 "i" +OpName %4 "x" +%5 = OpTypeVoid +%6 = OpTypeFunction %5 +%7 = OpTypeInt 32 1 +%8 = OpTypePointer Function %7 +%9 = OpConstant %7 0 +%10 = OpConstant %7 10 +%11 = OpTypeBool +%12 = OpTypeFloat 32 +%13 = OpTypeInt 32 0 +%14 = OpConstant %13 10 +%15 = OpTypeArray %12 %14 +%16 = OpTypePointer Function %15 +%17 = OpTypePointer Function %12 +%18 = OpConstant %7 1 +%63 = OpConstant %13 1 +%2 = OpFunction %5 None %6 +%19 = OpLabel +%3 = OpVariable %8 Function +%4 = OpVariable %16 Function +OpStore %3 %9 +OpBranch %20 +%20 = OpLabel +%21 = OpPhi %7 %9 %19 %22 %23 +OpLoopMerge %31 %25 Unroll +OpBranch %26 +%26 = OpLabel +%27 = OpSLessThan %11 %21 %63 +OpBranchConditional %27 %28 %31 +%28 = OpLabel +%29 = OpConvertSToF %12 %21 +%30 = OpAccessChain %17 %4 %21 +OpStore %30 %29 +OpBranch %25 +%25 = OpLabel +%22 = OpIAdd %7 %21 %18 +OpStore %3 %22 +OpBranch %23 +%23 = OpLabel +OpBranch %20 +%31 = OpLabel +OpBranch %32 +%32 = OpLabel +%33 = OpPhi %7 %21 %31 %61 %62 +OpLoopMerge %42 %60 DontUnroll +OpBranch %34 +%34 = OpLabel +%35 = OpSLessThan %11 %33 %10 +OpBranchConditional %35 %36 %42 +%36 = OpLabel +%37 = OpConvertSToF %12 %33 +%38 = OpAccessChain %17 %4 %33 +OpStore %38 %37 +OpBranch %39 +%39 = OpLabel +%40 = OpIAdd %7 %33 %18 +OpStore %3 %40 +OpBranch %41 +%41 = OpLabel +OpBranch %43 +%43 = OpLabel +OpBranch %45 +%45 = OpLabel +%46 = OpSLessThan %11 %40 %10 +OpBranch %47 +%47 = OpLabel +%48 = OpConvertSToF %12 %40 +%49 = OpAccessChain %17 %4 %40 +OpStore %49 %48 +OpBranch %50 +%50 = OpLabel +%51 = OpIAdd %7 %40 %18 +OpStore %3 %51 +OpBranch %52 +%52 = OpLabel +OpBranch %53 +%53 = OpLabel +OpBranch %55 +%55 = OpLabel +%56 = OpSLessThan %11 %51 %10 +OpBranch %57 +%57 = OpLabel +%58 = OpConvertSToF %12 %51 +%59 = OpAccessChain %17 %4 %51 +OpStore %59 %58 +OpBranch %60 +%60 = OpLabel +%61 = OpIAdd %7 %51 %18 +OpStore %3 %61 +OpBranch %62 +%62 = OpLabel +OpBranch %32 +%42 = OpLabel +OpReturn +%24 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck>(text, expected, true); + + // Make sure the latch block information is preserved and propagated correctly + // by the pass. + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + + PartialUnrollerTestPass<3> unroller; + unroller.SetContextForTesting(context.get()); + unroller.Process(); + + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + LoopDescriptor ld{context.get(), f}; + + EXPECT_EQ(ld.NumLoops(), 2u); + + Loop& loop_1 = ld.GetLoopByIndex(0u); + EXPECT_NE(loop_1.GetLatchBlock(), loop_1.GetContinueBlock()); + + Loop& loop_2 = ld.GetLoopByIndex(1u); + EXPECT_NE(loop_2.GetLatchBlock(), loop_2.GetContinueBlock()); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unswitch.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unswitch.cpp new file mode 100644 index 00000000000..96a7fc010bd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/loop_optimizations/unswitch.cpp @@ -0,0 +1,917 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/opt/pass_fixture.h" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace { + +using UnswitchTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 450 core +uniform vec4 c; +void main() { + int i = 0; + int j = 0; + bool cond = c[0] == 0; + for (; i < 10; i++, j++) { + if (cond) { + i++; + } + else { + j++; + } + } +} +*/ +TEST_F(UnswitchTest, SimpleUnswitch) { + const std::string text = R"( +; CHECK: [[cst_cond:%\w+]] = OpFOrdEqual +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional [[cst_cond]] [[loop_t:%\w+]] [[loop_f:%\w+]] + +; Loop specialized for false. +; CHECK: [[loop_f]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_f]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: [[phi_j:%\w+]] = OpPhi %int %int_0 [[loop_f]] [[iv_j:%\w+]] [[continue]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=1 and j+=2. +; CHECK: [[phi_j:%\w+]] = OpIAdd %int [[phi_j]] %int_1 +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[iv_j]] = OpIAdd %int [[phi_j]] %int_1 +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; Loop specialized for true. +; CHECK: [[loop_t]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: [[phi_j:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_j:%\w+]] [[continue]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=2 and j+=1. +; CHECK: [[phi_i:%\w+]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[iv_j]] = OpIAdd %int [[phi_j]] %int_1 +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpReturn + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginLowerLeft + OpSource GLSL 450 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + OpDecorate %c DescriptorSet 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_UniformConstant_v4float = OpTypePointer UniformConstant %v4float + %c = OpVariable %_ptr_UniformConstant_v4float UniformConstant + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_UniformConstant_float = OpTypePointer UniformConstant %float + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %21 = OpAccessChain %_ptr_UniformConstant_float %c %uint_0 + %22 = OpLoad %float %21 + %24 = OpFOrdEqual %bool %22 %float_0 + OpBranch %25 + %25 = OpLabel + %46 = OpPhi %int %int_0 %5 %43 %28 + %47 = OpPhi %int %int_0 %5 %45 %28 + OpLoopMerge %27 %28 None + OpBranch %29 + %29 = OpLabel + %32 = OpSLessThan %bool %46 %int_10 + OpBranchConditional %32 %26 %27 + %26 = OpLabel + OpSelectionMerge %35 None + OpBranchConditional %24 %34 %39 + %34 = OpLabel + %38 = OpIAdd %int %46 %int_1 + OpBranch %35 + %39 = OpLabel + %41 = OpIAdd %int %47 %int_1 + OpBranch %35 + %35 = OpLabel + %48 = OpPhi %int %38 %34 %46 %39 + %49 = OpPhi %int %47 %34 %41 %39 + OpBranch %28 + %28 = OpLabel + %43 = OpIAdd %int %48 %int_1 + %45 = OpIAdd %int %49 %int_1 + OpBranch %25 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +in vec4 c; +void main() { + int i = 0; + bool cond = c[0] == 0; + for (; i < 10; i++) { + if (cond) { + i++; + } + else { + return; + } + } +} +*/ +TEST_F(UnswitchTest, UnswitchExit) { + const std::string text = R"( +; CHECK: [[cst_cond:%\w+]] = OpFOrdEqual +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional [[cst_cond]] [[loop_t:%\w+]] [[loop_f:%\w+]] + +; Loop specialized for false. +; CHECK: [[loop_f]] = OpLabel +; CHECK: OpReturn + +; Loop specialized for true. +; CHECK: [[loop_t]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=2. +; CHECK: [[phi_i:%\w+]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpReturn + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + OpDecorate %23 Uniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_float %c %uint_0 + %21 = OpLoad %float %20 + %23 = OpFOrdEqual %bool %21 %float_0 + OpBranch %24 + %24 = OpLabel + %42 = OpPhi %int %int_0 %5 %41 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpSLessThan %bool %42 %int_10 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %23 %33 %38 + %33 = OpLabel + %37 = OpIAdd %int %42 %int_1 + OpBranch %34 + %38 = OpLabel + OpReturn + %34 = OpLabel + OpBranch %27 + %27 = OpLabel + %41 = OpIAdd %int %37 %int_1 + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +in vec4 c; +void main() { + int i = 0; + bool cond = c[0] == 0; + for (; i < 10; i++) { + if (cond) { + continue; + } + else { + i++; + } + } +} +*/ +TEST_F(UnswitchTest, UnswitchContinue) { + const std::string text = R"( +; CHECK: [[cst_cond:%\w+]] = OpFOrdEqual +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional [[cst_cond]] [[loop_t:%\w+]] [[loop_f:%\w+]] + +; Loop specialized for false. +; CHECK: [[loop_f]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_f]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=2. +; CHECK: [[phi_i:%\w+]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; Loop specialized for true. +; CHECK: [[loop_t]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=1. +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpReturn + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + OpDecorate %23 Uniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_float %c %uint_0 + %21 = OpLoad %float %20 + %23 = OpFOrdEqual %bool %21 %float_0 + OpBranch %24 + %24 = OpLabel + %42 = OpPhi %int %int_0 %5 %41 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpSLessThan %bool %42 %int_10 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %23 %33 %36 + %33 = OpLabel + OpBranch %27 + %36 = OpLabel + %39 = OpIAdd %int %42 %int_1 + OpBranch %34 + %34 = OpLabel + OpBranch %27 + %27 = OpLabel + %43 = OpPhi %int %42 %33 %39 %34 + %41 = OpIAdd %int %43 %int_1 + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +in vec4 c; +void main() { + int i = 0; + bool cond = c[0] == 0; + for (; i < 10; i++) { + if (cond) { + i++; + } + else { + break; + } + } +} +*/ +TEST_F(UnswitchTest, UnswitchKillLoop) { + const std::string text = R"( +; CHECK: [[cst_cond:%\w+]] = OpFOrdEqual +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional [[cst_cond]] [[loop_t:%\w+]] [[loop_f:%\w+]] + +; Loop specialized for false. +; CHECK: [[loop_f]] = OpLabel +; CHECK: OpBranch [[if_merge]] + +; Loop specialized for true. +; CHECK: [[loop_t]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=2. +; CHECK: [[phi_i:%\w+]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpReturn + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + OpDecorate %23 Uniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %20 = OpAccessChain %_ptr_Input_float %c %uint_0 + %21 = OpLoad %float %20 + %23 = OpFOrdEqual %bool %21 %float_0 + OpBranch %24 + %24 = OpLabel + %42 = OpPhi %int %int_0 %5 %41 %27 + OpLoopMerge %26 %27 None + OpBranch %28 + %28 = OpLabel + %31 = OpSLessThan %bool %42 %int_10 + OpBranchConditional %31 %25 %26 + %25 = OpLabel + OpSelectionMerge %34 None + OpBranchConditional %23 %33 %38 + %33 = OpLabel + %37 = OpIAdd %int %42 %int_1 + OpBranch %34 + %38 = OpLabel + OpBranch %26 + %34 = OpLabel + OpBranch %27 + %27 = OpLabel + %41 = OpIAdd %int %37 %int_1 + OpBranch %24 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +in vec4 c; +void main() { + int i = 0; + int cond = int(c[0]); + for (; i < 10; i++) { + switch (cond) { + case 0: + return; + case 1: + discard; + case 2: + break; + default: + break; + } + } + bool cond2 = i == 9; +} +*/ +TEST_F(UnswitchTest, UnswitchSwitch) { + const std::string text = R"( +; CHECK: [[cst_cond:%\w+]] = OpConvertFToS +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpSwitch [[cst_cond]] [[default:%\w+]] 0 [[loop_0:%\w+]] 1 [[loop_1:%\w+]] 2 [[loop_2:%\w+]] + +; Loop specialized for 2. +; CHECK: [[loop_2]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_2]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=1. +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: OpBranch [[loop]] + +; Loop specialized for 1. +; CHECK: [[loop_1]] = OpLabel +; CHECK: OpKill + +; Loop specialized for 0. +; CHECK: [[loop_0]] = OpLabel +; CHECK: OpReturn + +; Loop specialized for the default case. +; CHECK: [[default]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[default]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have i+=1. +; CHECK: [[phi_i:%\w+]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK: OpBranch [[loop]] + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpReturn + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + OpDecorate %20 Uniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Function_bool = OpTypePointer Function %bool + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpAccessChain %_ptr_Input_float %c %uint_0 + %19 = OpLoad %float %18 + %20 = OpConvertFToS %int %19 + OpBranch %21 + %21 = OpLabel + %49 = OpPhi %int %int_0 %5 %43 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %29 = OpSLessThan %bool %49 %int_10 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + OpSelectionMerge %35 None + OpSwitch %20 %34 0 %31 1 %32 2 %33 + %34 = OpLabel + OpBranch %35 + %31 = OpLabel + OpReturn + %32 = OpLabel + OpKill + %33 = OpLabel + OpBranch %35 + %35 = OpLabel + OpBranch %24 + %24 = OpLabel + %43 = OpIAdd %int %49 %int_1 + OpBranch %21 + %23 = OpLabel + OpReturn + OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 440 core +layout(location = 0)in vec4 c; +void main() { + int i = 0; + int j = 0; + int k = 0; + bool cond = c[0] == 0; + for (; i < 10; i++) { + for (; j < 10; j++) { + if (cond) { + i++; + } else { + j++; + } + } + } + for (; k < 10; k++) { + if (cond) { + k++; + } + } +} +*/ +TEST_F(UnswitchTest, UnSwitchNested) { + const std::string text = R"( +; CHECK: [[cst_cond:%\w+]] = OpFOrdEqual +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional [[cst_cond]] [[loop_t:%\w+]] [[loop_f:%\w+]] + +; Loop specialized for false, one loop is killed, j won't change anymore. +; CHECK: [[loop_f]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_f]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: [[phi_j:%\w+]] = OpPhi %int %int_0 [[loop_f]] [[iv_j:%\w+]] [[continue]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[iv_i]] = OpIAdd %int [[phi_i]] %int_1 +; CHECK-NEXT: OpBranch [[loop]] +; CHECK: OpReturn + +; Loop specialized for true. +; CHECK: [[loop_t]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_i:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_i:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: [[phi_j:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_j:%\w+]] [[continue]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_i]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] [[pre_loop_inner:%\w+]] [[merge]] + +; CHECK: [[pre_loop_inner]] = OpLabel +; CHECK-NEXT: OpBranch [[loop_inner:%\w+]] +; CHECK-NEXT: [[loop_inner]] = OpLabel +; CHECK-NEXT: [[phi2_i:%\w+]] = OpPhi %int [[phi_i]] [[pre_loop_inner]] [[iv2_i:%\w+]] [[continue2:%\w+]] +; CHECK-NEXT: [[phi2_j:%\w+]] = OpPhi %int [[phi_j]] [[pre_loop_inner]] [[iv2_j:%\w+]] [[continue2]] +; CHECK-NEXT: OpLoopMerge [[merge2:%\w+]] [[continue2]] None + +; CHECK: OpBranch [[continue2]] +; CHECK: [[merge2]] = OpLabel +; CHECK: OpBranch [[continue]] +; CHECK: [[merge]] = OpLabel + +; Unswitched double nested loop is done. Test the single remaining one. + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpSelectionMerge [[if_merge:%\w+]] None +; CHECK-NEXT: OpBranchConditional [[cst_cond]] [[loop_t:%\w+]] [[loop_f:%\w+]] + +; Loop specialized for false. +; CHECK: [[loop_f]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_k:%\w+]] = OpPhi %int %int_0 [[loop_f]] [[iv_k:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_k]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have k+=1 +; CHECK: [[iv_k]] = OpIAdd %int [[phi_k]] %int_1 +; CHECK: OpBranch [[loop]] +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; Loop specialized for true. +; CHECK: [[loop_t]] = OpLabel +; CHECK-NEXT: OpBranch [[loop:%\w+]] +; CHECK: [[loop]] = OpLabel +; CHECK-NEXT: [[phi_k:%\w+]] = OpPhi %int %int_0 [[loop_t]] [[iv_k:%\w+]] [[continue:%\w+]] +; CHECK-NEXT: OpLoopMerge [[merge:%\w+]] [[continue]] None +; CHECK: [[loop_exit:%\w+]] = OpSLessThan {{%\w+}} [[phi_k]] {{%\w+}} +; CHECK-NEXT: OpBranchConditional [[loop_exit]] {{%\w+}} [[merge]] +; Check that we have k+=2. +; CHECK: [[tmp_k:%\w+]] = OpIAdd %int [[phi_k]] %int_1 +; CHECK: [[iv_k]] = OpIAdd %int [[tmp_k]] %int_1 +; CHECK: OpBranch [[loop]] +; CHECK: [[merge]] = OpLabel +; CHECK-NEXT: OpBranch [[if_merge]] + +; CHECK: [[if_merge]] = OpLabel +; CHECK-NEXT: OpReturn + + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 440 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + OpDecorate %25 Uniform + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %22 = OpAccessChain %_ptr_Input_float %c %uint_0 + %23 = OpLoad %float %22 + %25 = OpFOrdEqual %bool %23 %float_0 + OpBranch %26 + %26 = OpLabel + %67 = OpPhi %int %int_0 %5 %52 %29 + %68 = OpPhi %int %int_0 %5 %70 %29 + OpLoopMerge %28 %29 None + OpBranch %30 + %30 = OpLabel + %33 = OpSLessThan %bool %67 %int_10 + OpBranchConditional %33 %27 %28 + %27 = OpLabel + OpBranch %34 + %34 = OpLabel + %69 = OpPhi %int %67 %27 %46 %37 + %70 = OpPhi %int %68 %27 %50 %37 + OpLoopMerge %36 %37 None + OpBranch %38 + %38 = OpLabel + %40 = OpSLessThan %bool %70 %int_10 + OpBranchConditional %40 %35 %36 + %35 = OpLabel + OpSelectionMerge %43 None + OpBranchConditional %25 %42 %47 + %42 = OpLabel + %46 = OpIAdd %int %69 %int_1 + OpBranch %43 + %47 = OpLabel + OpReturn + %43 = OpLabel + OpBranch %37 + %37 = OpLabel + %50 = OpIAdd %int %70 %int_1 + OpBranch %34 + %36 = OpLabel + OpBranch %29 + %29 = OpLabel + %52 = OpIAdd %int %69 %int_1 + OpBranch %26 + %28 = OpLabel + OpBranch %53 + %53 = OpLabel + %71 = OpPhi %int %int_0 %28 %66 %56 + OpLoopMerge %55 %56 None + OpBranch %57 + %57 = OpLabel + %59 = OpSLessThan %bool %71 %int_10 + OpBranchConditional %59 %54 %55 + %54 = OpLabel + OpSelectionMerge %62 None + OpBranchConditional %25 %61 %62 + %61 = OpLabel + %64 = OpIAdd %int %71 %int_1 + OpBranch %62 + %62 = OpLabel + %72 = OpPhi %int %71 %54 %64 %61 + OpBranch %56 + %56 = OpLabel + %66 = OpIAdd %int %72 %int_1 + OpBranch %53 + %55 = OpLabel + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 330 core +in vec4 c; +void main() { + bool cond = false; + if (c[0] == 0) { + cond = c[1] == 0; + } else { + cond = c[2] == 0; + } + for (int i = 0; i < 10; i++) { + if (cond) { + i++; + } + } +} +*/ +TEST_F(UnswitchTest, UnswitchNotUniform) { + // Check that the unswitch is not triggered (condition loop invariant but not + // uniform) + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %c + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 330 + OpName %main "main" + OpName %c "c" + OpDecorate %c Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool +%_ptr_Function_bool = OpTypePointer Function %bool + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %c = OpVariable %_ptr_Input_v4float Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_float = OpTypePointer Input %float + %float_0 = OpConstant %float 0 + %uint_1 = OpConstant %uint 1 + %uint_2 = OpConstant %uint 2 + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_0 = OpConstant %int 0 + %int_10 = OpConstant %int 10 + %int_1 = OpConstant %int 1 + %main = OpFunction %void None %3 + %5 = OpLabel + %17 = OpAccessChain %_ptr_Input_float %c %uint_0 + %18 = OpLoad %float %17 + %20 = OpFOrdEqual %bool %18 %float_0 + OpSelectionMerge %22 None + OpBranchConditional %20 %21 %27 + %21 = OpLabel + %24 = OpAccessChain %_ptr_Input_float %c %uint_1 + %25 = OpLoad %float %24 + %26 = OpFOrdEqual %bool %25 %float_0 + OpBranch %22 + %27 = OpLabel + %29 = OpAccessChain %_ptr_Input_float %c %uint_2 + %30 = OpLoad %float %29 + %31 = OpFOrdEqual %bool %30 %float_0 + OpBranch %22 + %22 = OpLabel + %52 = OpPhi %bool %26 %21 %31 %27 + OpBranch %36 + %36 = OpLabel + %53 = OpPhi %int %int_0 %22 %51 %39 + OpLoopMerge %38 %39 None + OpBranch %40 + %40 = OpLabel + %43 = OpSLessThan %bool %53 %int_10 + OpBranchConditional %43 %37 %38 + %37 = OpLabel + OpSelectionMerge %46 None + OpBranchConditional %52 %45 %46 + %45 = OpLabel + %49 = OpIAdd %int %53 %int_1 + OpBranch %46 + %46 = OpLabel + %54 = OpPhi %int %53 %37 %49 %45 + OpBranch %39 + %39 = OpLabel + %51 = OpIAdd %int %54 %int_1 + OpBranch %36 + %38 = OpLabel + OpReturn + OpFunctionEnd + )"; + + auto result = + SinglePassRunAndDisassemble(text, true, false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/module_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/module_test.cpp new file mode 100644 index 00000000000..c4f450ea958 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/module_test.cpp @@ -0,0 +1,144 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/module.h" +#include "spirv-tools/libspirv.hpp" +#include "test/opt/module_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::Eq; +using spvtest::GetIdBound; + +TEST(ModuleTest, SetIdBound) { + Module m; + // It's initialized to 0. + EXPECT_EQ(0u, GetIdBound(m)); + + m.SetIdBound(19); + EXPECT_EQ(19u, GetIdBound(m)); + + m.SetIdBound(102); + EXPECT_EQ(102u, GetIdBound(m)); +} + +// Returns an IRContext owning the module formed by assembling the given text, +// then loading the result. +inline std::unique_ptr BuildModule(std::string text) { + return spvtools::BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); +} + +TEST(ModuleTest, ComputeIdBound) { + // Emtpy module case. + EXPECT_EQ(1u, BuildModule("")->module()->ComputeIdBound()); + // Sensitive to result id + EXPECT_EQ(2u, BuildModule("%void = OpTypeVoid")->module()->ComputeIdBound()); + // Sensitive to type id + EXPECT_EQ(1000u, + BuildModule("%a = OpTypeArray !999 3")->module()->ComputeIdBound()); + // Sensitive to a regular Id parameter + EXPECT_EQ(2000u, + BuildModule("OpDecorate !1999 0")->module()->ComputeIdBound()); + // Sensitive to a scope Id parameter. + EXPECT_EQ(3000u, + BuildModule("%f = OpFunction %void None %fntype %a = OpLabel " + "OpMemoryBarrier !2999 %b\n") + ->module() + ->ComputeIdBound()); + // Sensitive to a semantics Id parameter + EXPECT_EQ(4000u, + BuildModule("%f = OpFunction %void None %fntype %a = OpLabel " + "OpMemoryBarrier %b !3999\n") + ->module() + ->ComputeIdBound()); +} + +TEST(ModuleTest, OstreamOperator) { + const std::string text = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %7 "restrict" +OpDecorate %8 Restrict +%9 = OpTypeVoid +%10 = OpTypeInt 32 0 +%11 = OpTypeStruct %10 %10 +%12 = OpTypePointer Function %10 +%13 = OpTypePointer Function %11 +%14 = OpConstant %10 0 +%15 = OpConstant %10 1 +%7 = OpTypeFunction %9 +%1 = OpFunction %9 None %7 +%2 = OpLabel +%8 = OpVariable %13 Function +%3 = OpAccessChain %12 %8 %14 +%4 = OpLoad %10 %3 +%5 = OpAccessChain %12 %8 %15 +%6 = OpLoad %10 %5 +OpReturn +OpFunctionEnd)"; + + std::string s; + std::ostringstream str(s); + str << *BuildModule(text)->module(); + EXPECT_EQ(text, str.str()); +} + +TEST(ModuleTest, OstreamOperatorInt64) { + const std::string text = R"(OpCapability Shader +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Logical GLSL450 +OpName %7 "restrict" +OpDecorate %5 Restrict +%9 = OpTypeVoid +%10 = OpTypeInt 64 0 +%11 = OpTypeStruct %10 %10 +%12 = OpTypePointer Function %10 +%13 = OpTypePointer Function %11 +%14 = OpConstant %10 0 +%15 = OpConstant %10 1 +%16 = OpConstant %10 4294967297 +%7 = OpTypeFunction %9 +%1 = OpFunction %9 None %7 +%2 = OpLabel +%5 = OpVariable %12 Function +%6 = OpLoad %10 %5 +OpSelectionMerge %3 None +OpSwitch %6 %3 4294967297 %4 +%4 = OpLabel +OpBranch %3 +%3 = OpLabel +OpReturn +OpFunctionEnd)"; + + std::string s; + std::ostringstream str(s); + str << *BuildModule(text)->module(); + EXPECT_EQ(text, str.str()); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/module_utils.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/module_utils.h new file mode 100644 index 00000000000..007f132c255 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/module_utils.h @@ -0,0 +1,34 @@ +// Copyright (c) 2016 Google 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. + +#ifndef TEST_OPT_MODULE_UTILS_H_ +#define TEST_OPT_MODULE_UTILS_H_ + +#include +#include "source/opt/module.h" + +namespace spvtest { + +inline uint32_t GetIdBound(const spvtools::opt::Module& m) { + std::vector binary; + m.ToBinary(&binary, false); + // The 5-word header must always exist. + EXPECT_LE(5u, binary.size()); + // The bound is the fourth word. + return binary[3]; +} + +} // namespace spvtest + +#endif // TEST_OPT_MODULE_UTILS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/optimizer_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/optimizer_test.cpp new file mode 100644 index 00000000000..90abc00d0d2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/optimizer_test.cpp @@ -0,0 +1,227 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/optimizer.hpp" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::Eq; + +// Return a string that contains the minimum instructions needed to form +// a valid module. Other instructions can be appended to this string. +std::string Header() { + return R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; +} + +TEST(Optimizer, CanRunNullPassWithDistinctInputOutputVectors) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); + std::vector binary_in; + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", + &binary_in); + + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + opt.RegisterPass(CreateNullPass()); + std::vector binary_out; + opt.Run(binary_in.data(), binary_in.size(), &binary_out); + + std::string disassembly; + tools.Disassemble(binary_out.data(), binary_out.size(), &disassembly); + EXPECT_THAT(disassembly, + Eq(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); +} + +TEST(Optimizer, CanRunTransformingPassWithDistinctInputOutputVectors) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); + std::vector binary_in; + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", + &binary_in); + + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + opt.RegisterPass(CreateStripDebugInfoPass()); + std::vector binary_out; + opt.Run(binary_in.data(), binary_in.size(), &binary_out); + + std::string disassembly; + tools.Disassemble(binary_out.data(), binary_out.size(), &disassembly); + EXPECT_THAT(disassembly, Eq(Header() + "%void = OpTypeVoid\n")); +} + +TEST(Optimizer, CanRunNullPassWithAliasedVectors) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); + std::vector binary; + tools.Assemble("OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); + + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + opt.RegisterPass(CreateNullPass()); + opt.Run(binary.data(), binary.size(), &binary); // This is the key. + + std::string disassembly; + tools.Disassemble(binary.data(), binary.size(), &disassembly); + EXPECT_THAT(disassembly, Eq("OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); +} + +TEST(Optimizer, CanRunNullPassWithAliasedVectorDataButDifferentSize) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); + std::vector binary; + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); + + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + opt.RegisterPass(CreateNullPass()); + auto orig_size = binary.size(); + // Now change the size. Add a word that will be ignored + // by the optimizer. + binary.push_back(42); + EXPECT_THAT(orig_size + 1, Eq(binary.size())); + opt.Run(binary.data(), orig_size, &binary); // This is the key. + // The binary vector should have been rewritten. + EXPECT_THAT(binary.size(), Eq(orig_size)); + + std::string disassembly; + tools.Disassemble(binary.data(), binary.size(), &disassembly); + EXPECT_THAT(disassembly, + Eq(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid\n")); +} + +TEST(Optimizer, CanRunTransformingPassWithAliasedVectors) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); + std::vector binary; + tools.Assemble(Header() + "OpName %foo \"foo\"\n%foo = OpTypeVoid", &binary); + + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + opt.RegisterPass(CreateStripDebugInfoPass()); + opt.Run(binary.data(), binary.size(), &binary); // This is the key + + std::string disassembly; + tools.Disassemble(binary.data(), binary.size(), &disassembly); + EXPECT_THAT(disassembly, Eq(Header() + "%void = OpTypeVoid\n")); +} + +TEST(Optimizer, CanValidateFlags) { + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + EXPECT_FALSE(opt.FlagHasValidForm("bad-flag")); + EXPECT_TRUE(opt.FlagHasValidForm("-O")); + EXPECT_TRUE(opt.FlagHasValidForm("-Os")); + EXPECT_FALSE(opt.FlagHasValidForm("-O2")); + EXPECT_TRUE(opt.FlagHasValidForm("--this_flag")); +} + +TEST(Optimizer, CanRegisterPassesFromFlags) { + SpirvTools tools(SPV_ENV_UNIVERSAL_1_0); + Optimizer opt(SPV_ENV_UNIVERSAL_1_0); + + spv_message_level_t msg_level; + const char* msg_fname; + spv_position_t msg_position; + const char* msg; + auto examine_message = [&msg_level, &msg_fname, &msg_position, &msg]( + spv_message_level_t ml, const char* f, + const spv_position_t& p, const char* m) { + msg_level = ml; + msg_fname = f; + msg_position = p; + msg = m; + }; + opt.SetMessageConsumer(examine_message); + + std::vector pass_flags = { + "--strip-debug", + "--strip-reflect", + "--set-spec-const-default-value=23:42 21:12", + "--if-conversion", + "--freeze-spec-const", + "--inline-entry-points-exhaustive", + "--inline-entry-points-opaque", + "--convert-local-access-chains", + "--eliminate-dead-code-aggressive", + "--eliminate-insert-extract", + "--eliminate-local-single-block", + "--eliminate-local-single-store", + "--merge-blocks", + "--merge-return", + "--eliminate-dead-branches", + "--eliminate-dead-functions", + "--eliminate-local-multi-store", + "--eliminate-common-uniform", + "--eliminate-dead-const", + "--eliminate-dead-inserts", + "--eliminate-dead-variables", + "--fold-spec-const-op-composite", + "--loop-unswitch", + "--scalar-replacement=300", + "--scalar-replacement", + "--strength-reduction", + "--unify-const", + "--flatten-decorations", + "--compact-ids", + "--cfg-cleanup", + "--local-redundancy-elimination", + "--loop-invariant-code-motion", + "--reduce-load-size", + "--redundancy-elimination", + "--private-to-local", + "--remove-duplicates", + "--workaround-1209", + "--replace-invalid-opcode", + "--simplify-instructions", + "--ssa-rewrite", + "--copy-propagate-arrays", + "--loop-fission=20", + "--loop-fusion=2", + "--loop-unroll", + "--vector-dce", + "--loop-unroll-partial=3", + "--loop-peeling", + "--ccp", + "-O", + "-Os", + "--legalize-hlsl"}; + EXPECT_TRUE(opt.RegisterPassesFromFlags(pass_flags)); + + // Test some invalid flags. + EXPECT_FALSE(opt.RegisterPassFromFlag("-O2")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); + + EXPECT_FALSE(opt.RegisterPassFromFlag("-loop-unroll")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); + + EXPECT_FALSE(opt.RegisterPassFromFlag("--set-spec-const-default-value")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); + + EXPECT_FALSE(opt.RegisterPassFromFlag("--scalar-replacement=s")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); + + EXPECT_FALSE(opt.RegisterPassFromFlag("--loop-fission=-4")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); + + EXPECT_FALSE(opt.RegisterPassFromFlag("--loop-fusion=xx")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); + + EXPECT_FALSE(opt.RegisterPassFromFlag("--loop-unroll-partial")); + EXPECT_EQ(msg_level, SPV_MSG_ERROR); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_fixture.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_fixture.h new file mode 100644 index 00000000000..9d9eb3661c0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_fixture.h @@ -0,0 +1,246 @@ +// Copyright (c) 2016 Google 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. + +#ifndef TEST_OPT_PASS_FIXTURE_H_ +#define TEST_OPT_PASS_FIXTURE_H_ + +#include +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/pass_manager.h" +#include "source/opt/passes.h" +#include "source/util/make_unique.h" +#include "spirv-tools/libspirv.hpp" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { + +// Template class for testing passes. It contains some handy utility methods for +// running passes and checking results. +// +// To write value-Parameterized tests: +// using ValueParamTest = PassTest<::testing::TestWithParam>; +// To use as normal fixture: +// using FixtureTest = PassTest<::testing::Test>; +template +class PassTest : public TestT { + public: + PassTest() + : consumer_(nullptr), + context_(nullptr), + tools_(SPV_ENV_UNIVERSAL_1_1), + manager_(new PassManager()), + assemble_options_(SpirvTools::kDefaultAssembleOption), + disassemble_options_(SpirvTools::kDefaultDisassembleOption) {} + + // Runs the given |pass| on the binary assembled from the |original|. + // Returns a tuple of the optimized binary and the boolean value returned + // from pass Process() function. + std::tuple, Pass::Status> OptimizeToBinary( + Pass* pass, const std::string& original, bool skip_nop) { + context_ = std::move(BuildModule(SPV_ENV_UNIVERSAL_1_1, consumer_, original, + assemble_options_)); + EXPECT_NE(nullptr, context()) << "Assembling failed for shader:\n" + << original << std::endl; + if (!context()) { + return std::make_tuple(std::vector(), Pass::Status::Failure); + } + + const auto status = pass->Run(context()); + + std::vector binary; + context()->module()->ToBinary(&binary, skip_nop); + return std::make_tuple(binary, status); + } + + // Runs a single pass of class |PassT| on the binary assembled from the + // |assembly|. Returns a tuple of the optimized binary and the boolean value + // from the pass Process() function. + template + std::tuple, Pass::Status> SinglePassRunToBinary( + const std::string& assembly, bool skip_nop, Args&&... args) { + auto pass = MakeUnique(std::forward(args)...); + pass->SetMessageConsumer(consumer_); + return OptimizeToBinary(pass.get(), assembly, skip_nop); + } + + // Runs a single pass of class |PassT| on the binary assembled from the + // |assembly|, disassembles the optimized binary. Returns a tuple of + // disassembly string and the boolean value from the pass Process() function. + template + std::tuple SinglePassRunAndDisassemble( + const std::string& assembly, bool skip_nop, bool do_validation, + Args&&... args) { + std::vector optimized_bin; + auto status = Pass::Status::SuccessWithoutChange; + std::tie(optimized_bin, status) = SinglePassRunToBinary( + assembly, skip_nop, std::forward(args)...); + if (do_validation) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_1; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {optimized_bin.data(), optimized_bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + EXPECT_EQ(error, 0); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + } + std::string optimized_asm; + EXPECT_TRUE( + tools_.Disassemble(optimized_bin, &optimized_asm, disassemble_options_)) + << "Disassembling failed for shader:\n" + << assembly << std::endl; + return std::make_tuple(optimized_asm, status); + } + + // Runs a single pass of class |PassT| on the binary assembled from the + // |original| assembly, and checks whether the optimized binary can be + // disassembled to the |expected| assembly. Optionally will also validate + // the optimized binary. This does *not* involve pass manager. Callers + // are suggested to use SCOPED_TRACE() for better messages. + template + void SinglePassRunAndCheck(const std::string& original, + const std::string& expected, bool skip_nop, + bool do_validation, Args&&... args) { + std::vector optimized_bin; + auto status = Pass::Status::SuccessWithoutChange; + std::tie(optimized_bin, status) = SinglePassRunToBinary( + original, skip_nop, std::forward(args)...); + // Check whether the pass returns the correct modification indication. + EXPECT_NE(Pass::Status::Failure, status); + EXPECT_EQ(original == expected, + status == Pass::Status::SuccessWithoutChange); + if (do_validation) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_1; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {optimized_bin.data(), optimized_bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + EXPECT_EQ(error, 0); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + } + std::string optimized_asm; + EXPECT_TRUE( + tools_.Disassemble(optimized_bin, &optimized_asm, disassemble_options_)) + << "Disassembling failed for shader:\n" + << original << std::endl; + EXPECT_EQ(expected, optimized_asm); + } + + // Runs a single pass of class |PassT| on the binary assembled from the + // |original| assembly, and checks whether the optimized binary can be + // disassembled to the |expected| assembly. This does *not* involve pass + // manager. Callers are suggested to use SCOPED_TRACE() for better messages. + template + void SinglePassRunAndCheck(const std::string& original, + const std::string& expected, bool skip_nop, + Args&&... args) { + SinglePassRunAndCheck(original, expected, skip_nop, false, + std::forward(args)...); + } + +#ifdef SPIRV_EFFCEE + // Runs a single pass of class |PassT| on the binary assembled from the + // |original| assembly, then runs an Effcee matcher over the disassembled + // result, using checks parsed from |original|. Always skips OpNop. + // This does *not* involve pass manager. Callers are suggested to use + // SCOPED_TRACE() for better messages. + template + void SinglePassRunAndMatch(const std::string& original, bool do_validation, + Args&&... args) { + const bool skip_nop = true; + auto pass_result = SinglePassRunAndDisassemble( + original, skip_nop, do_validation, std::forward(args)...); + auto disassembly = std::get<0>(pass_result); + auto match_result = effcee::Match(disassembly, original); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << disassembly; + } +#endif + + // Adds a pass to be run. + template + void AddPass(Args&&... args) { + manager_->AddPass(std::forward(args)...); + } + + // Renews the pass manager, including clearing all previously added passes. + void RenewPassManger() { + manager_ = MakeUnique(); + manager_->SetMessageConsumer(consumer_); + } + + // Runs the passes added thus far using a pass manager on the binary assembled + // from the |original| assembly, and checks whether the optimized binary can + // be disassembled to the |expected| assembly. Callers are suggested to use + // SCOPED_TRACE() for better messages. + void RunAndCheck(const std::string& original, const std::string& expected) { + assert(manager_->NumPasses()); + + context_ = std::move(BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, original, + assemble_options_)); + ASSERT_NE(nullptr, context()); + + manager_->Run(context()); + + std::vector binary; + context()->module()->ToBinary(&binary, /* skip_nop = */ false); + + std::string optimized; + EXPECT_TRUE(tools_.Disassemble(binary, &optimized, disassemble_options_)); + EXPECT_EQ(expected, optimized); + } + + void SetAssembleOptions(uint32_t assemble_options) { + assemble_options_ = assemble_options; + } + + void SetDisassembleOptions(uint32_t disassemble_options) { + disassemble_options_ = disassemble_options; + } + + MessageConsumer consumer() { return consumer_; } + IRContext* context() { return context_.get(); } + + void SetMessageConsumer(MessageConsumer msg_consumer) { + consumer_ = msg_consumer; + } + + private: + MessageConsumer consumer_; // Message consumer. + std::unique_ptr context_; // IR context + SpirvTools tools_; // An instance for calling SPIRV-Tools functionalities. + std::unique_ptr manager_; // The pass manager. + uint32_t assemble_options_; + uint32_t disassemble_options_; +}; + +} // namespace opt +} // namespace spvtools + +#endif // TEST_OPT_PASS_FIXTURE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_manager_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_manager_test.cpp new file mode 100644 index 00000000000..c7273e9c18d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_manager_test.cpp @@ -0,0 +1,192 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/util/make_unique.h" +#include "test/opt/module_utils.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using spvtest::GetIdBound; +using ::testing::Eq; + +// A null pass whose construtors accept arguments +class NullPassWithArgs : public NullPass { + public: + NullPassWithArgs(uint32_t) {} + NullPassWithArgs(std::string) {} + NullPassWithArgs(const std::vector&) {} + NullPassWithArgs(const std::vector&, uint32_t) {} + + const char* name() const override { return "null-with-args"; } +}; + +TEST(PassManager, Interface) { + PassManager manager; + EXPECT_EQ(0u, manager.NumPasses()); + + manager.AddPass(); + EXPECT_EQ(1u, manager.NumPasses()); + EXPECT_STREQ("strip-debug", manager.GetPass(0)->name()); + + manager.AddPass(MakeUnique()); + EXPECT_EQ(2u, manager.NumPasses()); + EXPECT_STREQ("strip-debug", manager.GetPass(0)->name()); + EXPECT_STREQ("null", manager.GetPass(1)->name()); + + manager.AddPass(); + EXPECT_EQ(3u, manager.NumPasses()); + EXPECT_STREQ("strip-debug", manager.GetPass(0)->name()); + EXPECT_STREQ("null", manager.GetPass(1)->name()); + EXPECT_STREQ("strip-debug", manager.GetPass(2)->name()); + + manager.AddPass(1u); + manager.AddPass("null pass args"); + manager.AddPass(std::initializer_list{1, 2}); + manager.AddPass(std::initializer_list{1, 2}, 3); + EXPECT_EQ(7u, manager.NumPasses()); + EXPECT_STREQ("strip-debug", manager.GetPass(0)->name()); + EXPECT_STREQ("null", manager.GetPass(1)->name()); + EXPECT_STREQ("strip-debug", manager.GetPass(2)->name()); + EXPECT_STREQ("null-with-args", manager.GetPass(3)->name()); + EXPECT_STREQ("null-with-args", manager.GetPass(4)->name()); + EXPECT_STREQ("null-with-args", manager.GetPass(5)->name()); + EXPECT_STREQ("null-with-args", manager.GetPass(6)->name()); +} + +// A pass that appends an OpNop instruction to the debug1 section. +class AppendOpNopPass : public Pass { + public: + const char* name() const override { return "AppendOpNop"; } + Status Process() override { + context()->AddDebug1Inst(MakeUnique(context())); + return Status::SuccessWithChange; + } +}; + +// A pass that appends specified number of OpNop instructions to the debug1 +// section. +class AppendMultipleOpNopPass : public Pass { + public: + explicit AppendMultipleOpNopPass(uint32_t num_nop) : num_nop_(num_nop) {} + + const char* name() const override { return "AppendOpNop"; } + Status Process() override { + for (uint32_t i = 0; i < num_nop_; i++) { + context()->AddDebug1Inst(MakeUnique(context())); + } + return Status::SuccessWithChange; + } + + private: + uint32_t num_nop_; +}; + +// A pass that duplicates the last instruction in the debug1 section. +class DuplicateInstPass : public Pass { + public: + const char* name() const override { return "DuplicateInst"; } + Status Process() override { + auto inst = + MakeUnique(*(--context()->debug1_end())->Clone(context())); + context()->AddDebug1Inst(std::move(inst)); + return Status::SuccessWithChange; + } +}; + +using PassManagerTest = PassTest<::testing::Test>; + +TEST_F(PassManagerTest, Run) { + const std::string text = "OpMemoryModel Logical GLSL450\nOpSource ESSL 310\n"; + + AddPass(); + AddPass(); + RunAndCheck(text.c_str(), (text + "OpNop\nOpNop\n").c_str()); + + RenewPassManger(); + AddPass(); + AddPass(); + RunAndCheck(text.c_str(), (text + "OpNop\nOpNop\n").c_str()); + + RenewPassManger(); + AddPass(); + AddPass(); + RunAndCheck(text.c_str(), (text + "OpSource ESSL 310\nOpNop\n").c_str()); + + RenewPassManger(); + AddPass(3); + RunAndCheck(text.c_str(), (text + "OpNop\nOpNop\nOpNop\n").c_str()); +} + +// A pass that appends an OpTypeVoid instruction that uses a given id. +class AppendTypeVoidInstPass : public Pass { + public: + explicit AppendTypeVoidInstPass(uint32_t result_id) : result_id_(result_id) {} + + const char* name() const override { return "AppendTypeVoidInstPass"; } + Status Process() override { + auto inst = MakeUnique(context(), SpvOpTypeVoid, 0, result_id_, + std::vector{}); + context()->AddType(std::move(inst)); + return Status::SuccessWithChange; + } + + private: + uint32_t result_id_; +}; + +TEST(PassManager, RecomputeIdBoundAutomatically) { + PassManager manager; + std::unique_ptr module(new Module()); + IRContext context(SPV_ENV_UNIVERSAL_1_2, std::move(module), + manager.consumer()); + EXPECT_THAT(GetIdBound(*context.module()), Eq(0u)); + + manager.Run(&context); + manager.AddPass(); + // With no ID changes, the ID bound does not change. + EXPECT_THAT(GetIdBound(*context.module()), Eq(0u)); + + // Now we force an Id of 100 to be used. + manager.AddPass(MakeUnique(100)); + EXPECT_THAT(GetIdBound(*context.module()), Eq(0u)); + manager.Run(&context); + // The Id has been updated automatically, even though the pass + // did not update it. + EXPECT_THAT(GetIdBound(*context.module()), Eq(101u)); + + // Try one more time! + manager.AddPass(MakeUnique(200)); + manager.Run(&context); + EXPECT_THAT(GetIdBound(*context.module()), Eq(201u)); + + // Add another pass, but which uses a lower Id. + manager.AddPass(MakeUnique(10)); + manager.Run(&context); + // The Id stays high. + EXPECT_THAT(GetIdBound(*context.module()), Eq(201u)); +} + +} // anonymous namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_merge_return_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_merge_return_test.cpp new file mode 100644 index 00000000000..4dd4b6b285a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_merge_return_test.cpp @@ -0,0 +1,1159 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/optimizer.hpp" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using MergeReturnPassTest = PassTest<::testing::Test>; + +TEST_F(MergeReturnPassTest, OneReturn) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %1 "simple_kernel" +%2 = OpTypeVoid +%3 = OpTypeFunction %2 +%1 = OpFunction %2 None %3 +%4 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = before; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(MergeReturnPassTest, TwoReturnsNoValue) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %6 "simple_kernel" +%2 = OpTypeVoid +%3 = OpTypeBool +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpBranchConditional %4 %8 %9 +%8 = OpLabel +OpReturn +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %6 "simple_kernel" +%2 = OpTypeVoid +%3 = OpTypeBool +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpBranchConditional %4 %8 %9 +%8 = OpLabel +OpBranch %10 +%9 = OpLabel +OpBranch %10 +%10 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(MergeReturnPassTest, TwoReturnsWithValues) { + const std::string before = + R"(OpCapability Linkage +OpCapability Kernel +OpMemoryModel Logical OpenCL +%1 = OpTypeInt 32 0 +%2 = OpTypeBool +%3 = OpConstantFalse %2 +%4 = OpConstant %1 0 +%5 = OpConstant %1 1 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +OpBranchConditional %3 %9 %10 +%9 = OpLabel +OpReturnValue %4 +%10 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Linkage +OpCapability Kernel +OpMemoryModel Logical OpenCL +%1 = OpTypeInt 32 0 +%2 = OpTypeBool +%3 = OpConstantFalse %2 +%4 = OpConstant %1 0 +%5 = OpConstant %1 1 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +OpBranchConditional %3 %9 %10 +%9 = OpLabel +OpBranch %11 +%10 = OpLabel +OpBranch %11 +%11 = OpLabel +%12 = OpPhi %1 %4 %9 %5 %10 +OpReturnValue %12 +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(MergeReturnPassTest, UnreachableReturnsNoValue) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %6 "simple_kernel" +%2 = OpTypeVoid +%3 = OpTypeBool +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpReturn +%8 = OpLabel +OpBranchConditional %4 %9 %10 +%9 = OpLabel +OpReturn +%10 = OpLabel +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %6 "simple_kernel" +%2 = OpTypeVoid +%3 = OpTypeBool +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpBranch %11 +%8 = OpLabel +OpBranchConditional %4 %9 %10 +%9 = OpLabel +OpBranch %11 +%10 = OpLabel +OpBranch %11 +%11 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(MergeReturnPassTest, UnreachableReturnsWithValues) { + const std::string before = + R"(OpCapability Linkage +OpCapability Kernel +OpMemoryModel Logical OpenCL +%1 = OpTypeInt 32 0 +%2 = OpTypeBool +%3 = OpConstantFalse %2 +%4 = OpConstant %1 0 +%5 = OpConstant %1 1 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +%9 = OpIAdd %1 %4 %5 +OpReturnValue %9 +%10 = OpLabel +OpBranchConditional %3 %11 %12 +%11 = OpLabel +OpReturnValue %4 +%12 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Linkage +OpCapability Kernel +OpMemoryModel Logical OpenCL +%1 = OpTypeInt 32 0 +%2 = OpTypeBool +%3 = OpConstantFalse %2 +%4 = OpConstant %1 0 +%5 = OpConstant %1 1 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +%9 = OpIAdd %1 %4 %5 +OpBranch %13 +%10 = OpLabel +OpBranchConditional %3 %11 %12 +%11 = OpLabel +OpBranch %13 +%12 = OpLabel +OpBranch %13 +%13 = OpLabel +%14 = OpPhi %1 %9 %8 %4 %11 %5 %12 +OpReturnValue %14 +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(MergeReturnPassTest, StructuredControlFlowWithUnreachableMerge) { + const std::string before = + R"( +; CHECK: [[false:%\w+]] = OpConstantFalse +; CHECK: [[true:%\w+]] = OpConstantTrue +; CHECK: OpFunction +; CHECK: [[var:%\w+]] = OpVariable [[:%\w+]] Function [[false]] +; CHECK: OpSelectionMerge [[merge_lab:%\w+]] +; CHECK: OpBranchConditional [[cond:%\w+]] [[if_lab:%\w+]] [[then_lab:%\w+]] +; CHECK: [[if_lab]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[true]] +; CHECK-NEXT: OpBranch +; CHECK: [[then_lab]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[true]] +; CHECK-NEXT: OpBranch [[merge_lab]] +; CHECK: OpReturn +OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %6 "simple_shader" +%2 = OpTypeVoid +%3 = OpTypeBool +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpSelectionMerge %10 None +OpBranchConditional %4 %8 %9 +%8 = OpLabel +OpReturn +%9 = OpLabel +OpReturn +%10 = OpLabel +OpUnreachable +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(before, false); +} + +TEST_F(MergeReturnPassTest, StructuredControlFlowAddPhi) { + const std::string before = + R"( +; CHECK: [[false:%\w+]] = OpConstantFalse +; CHECK: [[true:%\w+]] = OpConstantTrue +; CHECK: OpFunction +; CHECK: [[var:%\w+]] = OpVariable [[:%\w+]] Function [[false]] +; CHECK: OpSelectionMerge [[merge_lab:%\w+]] +; CHECK: OpBranchConditional [[cond:%\w+]] [[if_lab:%\w+]] [[then_lab:%\w+]] +; CHECK: [[if_lab]] = OpLabel +; CHECK-NEXT: [[add:%\w+]] = OpIAdd [[type:%\w+]] +; CHECK-NEXT: OpBranch +; CHECK: [[then_lab]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[true]] +; CHECK-NEXT: OpBranch [[merge_lab]] +; CHECK: [[merge_lab]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi [[type]] [[add]] [[if_lab]] [[undef:%\w+]] [[then_lab]] +; CHECK: OpIAdd [[type]] [[phi]] [[phi]] +; CHECK: OpReturn +OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %6 "simple_shader" +%2 = OpTypeVoid +%3 = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpSelectionMerge %10 None +OpBranchConditional %4 %8 %9 +%8 = OpLabel +%11 = OpIAdd %int %int_0 %int_0 +OpBranch %10 +%9 = OpLabel +OpReturn +%10 = OpLabel +%12 = OpIAdd %int %11 %11 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndMatch(before, false); +} + +TEST_F(MergeReturnPassTest, StructuredControlDecoration) { + const std::string before = + R"( +; CHECK: OpDecorate [[dec_id:%\w+]] RelaxedPrecision +; CHECK: [[false:%\w+]] = OpConstantFalse +; CHECK: [[true:%\w+]] = OpConstantTrue +; CHECK: OpFunction +; CHECK: [[var:%\w+]] = OpVariable [[:%\w+]] Function [[false]] +; CHECK: OpSelectionMerge [[merge_lab:%\w+]] +; CHECK: OpBranchConditional [[cond:%\w+]] [[if_lab:%\w+]] [[then_lab:%\w+]] +; CHECK: [[if_lab]] = OpLabel +; CHECK-NEXT: [[dec_id]] = OpIAdd [[type:%\w+]] +; CHECK-NEXT: OpBranch +; CHECK: [[then_lab]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[true]] +; CHECK-NEXT: OpBranch [[merge_lab]] +; CHECK: [[merge_lab]] = OpLabel +; CHECK: OpReturn +OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %6 "simple_shader" +OpDecorate %11 RelaxedPrecision +%2 = OpTypeVoid +%3 = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpSelectionMerge %10 None +OpBranchConditional %4 %8 %9 +%8 = OpLabel +%11 = OpIAdd %int %int_0 %int_0 +OpBranch %10 +%9 = OpLabel +OpReturn +%10 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(before, false); +} + +TEST_F(MergeReturnPassTest, StructuredControlDecoration2) { + const std::string before = + R"( +; CHECK: OpDecorate [[dec_id:%\w+]] RelaxedPrecision +; CHECK: [[false:%\w+]] = OpConstantFalse +; CHECK: [[true:%\w+]] = OpConstantTrue +; CHECK: OpFunction +; CHECK: [[var:%\w+]] = OpVariable [[:%\w+]] Function [[false]] +; CHECK: OpSelectionMerge [[merge_lab:%\w+]] +; CHECK: OpBranchConditional [[cond:%\w+]] [[if_lab:%\w+]] [[then_lab:%\w+]] +; CHECK: [[if_lab]] = OpLabel +; CHECK-NEXT: [[dec_id]] = OpIAdd [[type:%\w+]] +; CHECK-NEXT: OpBranch +; CHECK: [[then_lab]] = OpLabel +; CHECK-NEXT: OpStore [[var]] [[true]] +; CHECK-NEXT: OpBranch [[merge_lab]] +; CHECK: [[merge_lab]] = OpLabel +; CHECK-NEXT: [[phi:%\w+]] = OpPhi [[type]] [[dec_id]] [[if_lab]] [[undef:%\w+]] [[then_lab]] +; CHECK: OpIAdd [[type]] [[phi]] [[phi]] +; CHECK: OpReturn +OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %6 "simple_shader" +OpDecorate %11 RelaxedPrecision +%2 = OpTypeVoid +%3 = OpTypeBool +%int = OpTypeInt 32 0 +%int_0 = OpConstant %int 0 +%4 = OpConstantFalse %3 +%1 = OpTypeFunction %2 +%6 = OpFunction %2 None %1 +%7 = OpLabel +OpSelectionMerge %10 None +OpBranchConditional %4 %8 %9 +%8 = OpLabel +%11 = OpIAdd %int %int_0 %int_0 +OpBranch %10 +%9 = OpLabel +OpReturn +%10 = OpLabel +%12 = OpIAdd %int %11 %11 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(before, false); +} + +TEST_F(MergeReturnPassTest, SplitBlockUsedInPhi) { + const std::string before = + R"( +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK: OpSelectionMerge [[merge1:%\w+]] None +; CHECK: [[merge1]] = OpLabel +; CHECK: OpBranchConditional %{{\w+}} %{{\w+}} [[old_merge:%\w+]] +; CHECK: [[old_merge]] = OpLabel +; CHECK-NEXT: OpSelectionMerge [[merge2:%\w+]] +; CHECK-NEXT: OpBranchConditional %false [[side_node:%\w+]] [[merge2]] +; CHECK: [[merge2]] = OpLabel +; CHECK-NEXT: OpPhi %bool %false [[old_merge]] %true [[side_node]] + OpCapability Addresses + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "simple_shader" + %void = OpTypeVoid + %bool = OpTypeBool + %false = OpConstantFalse %bool + %true = OpConstantTrue %bool + %6 = OpTypeFunction %void + %1 = OpFunction %void None %6 + %7 = OpLabel + OpSelectionMerge %8 None + OpBranchConditional %false %9 %8 + %9 = OpLabel + OpReturn + %8 = OpLabel + OpSelectionMerge %10 None + OpBranchConditional %false %11 %10 + %11 = OpLabel + OpBranch %10 + %10 = OpLabel + %12 = OpPhi %bool %false %8 %true %11 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(before, false); +} + +// TODO(#1861): Reenable these test when the breaks from selection constructs +// are reenabled. +/* +TEST_F(MergeReturnPassTest, UpdateOrderWhenPredicating) { + const std::string before = + R"( +; CHECK: OpFunction +; CHECK: OpFunction +; CHECK: OpSelectionMerge [[m1:%\w+]] None +; CHECK-NOT: OpReturn +; CHECK: [[m1]] = OpLabel +; CHECK: OpSelectionMerge [[m2:%\w+]] None +; CHECK: OpSelectionMerge [[m3:%\w+]] None +; CHECK: OpSelectionMerge [[m4:%\w+]] None +; CHECK: OpLabel +; CHECK-NEXT: OpStore +; CHECK-NEXT: OpBranch [[m4]] +; CHECK: [[m4]] = OpLabel +; CHECK-NEXT: [[ld4:%\w+]] = OpLoad %bool +; CHECK-NEXT: OpBranchConditional [[ld4]] [[m3]] +; CHECK: [[m3]] = OpLabel +; CHECK-NEXT: [[ld3:%\w+]] = OpLoad %bool +; CHECK-NEXT: OpBranchConditional [[ld3]] [[m2]] +; CHECK: [[m2]] = OpLabel + OpCapability SampledBuffer + OpCapability StorageImageExtendedFormats + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "PS_DebugTiles" + OpExecutionMode %1 OriginUpperLeft + OpSource HLSL 600 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool + %1 = OpFunction %void None %3 + %5 = OpLabel + %6 = OpFunctionCall %void %7 + OpReturn + OpFunctionEnd + %7 = OpFunction %void None %3 + %8 = OpLabel + %9 = OpUndef %bool + OpSelectionMerge %10 None + OpBranchConditional %9 %11 %10 + %11 = OpLabel + OpReturn + %10 = OpLabel + %12 = OpUndef %bool + OpSelectionMerge %13 None + OpBranchConditional %12 %14 %15 + %15 = OpLabel + %16 = OpUndef %bool + OpSelectionMerge %17 None + OpBranchConditional %16 %18 %17 + %18 = OpLabel + OpReturn + %17 = OpLabel + OpBranch %13 + %14 = OpLabel + OpReturn + %13 = OpLabel + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(before, false); +} +*/ +#endif + +TEST_F(MergeReturnPassTest, StructuredControlFlowBothMergeAndHeader) { + const std::string before = + R"(OpCapability Addresses + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "simple_shader" + %2 = OpTypeVoid + %3 = OpTypeBool + %4 = OpTypeInt 32 0 + %5 = OpConstant %4 0 + %6 = OpConstantFalse %3 + %7 = OpTypeFunction %2 + %1 = OpFunction %2 None %7 + %8 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %6 %10 %11 + %10 = OpLabel + OpReturn + %11 = OpLabel + OpBranch %9 + %9 = OpLabel + OpLoopMerge %12 %13 None + OpBranch %13 + %13 = OpLabel + %14 = OpIAdd %4 %5 %5 + OpBranchConditional %6 %9 %12 + %12 = OpLabel + %15 = OpIAdd %4 %14 %14 + OpReturn + OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "simple_shader" +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%false = OpConstantFalse %bool +%7 = OpTypeFunction %void +%_ptr_Function_bool = OpTypePointer Function %bool +%true = OpConstantTrue %bool +%1 = OpFunction %void None %7 +%8 = OpLabel +%18 = OpVariable %_ptr_Function_bool Function %false +OpSelectionMerge %9 None +OpBranchConditional %false %10 %11 +%10 = OpLabel +OpStore %18 %true +OpBranch %9 +%11 = OpLabel +OpBranch %9 +%9 = OpLabel +%23 = OpLoad %bool %18 +OpSelectionMerge %22 None +OpBranchConditional %23 %22 %21 +%21 = OpLabel +OpBranch %20 +%20 = OpLabel +OpLoopMerge %12 %13 None +OpBranch %13 +%13 = OpLabel +%14 = OpIAdd %uint %uint_0 %uint_0 +OpBranchConditional %false %20 %12 +%12 = OpLabel +%15 = OpIAdd %uint %14 %14 +OpStore %18 %true +OpBranch %22 +%22 = OpLabel +OpBranch %16 +%16 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, false, true); +} + +// TODO(#1861): Reenable these test when the breaks from selection constructs +// are reenabled. +/* +TEST_F(MergeReturnPassTest, NestedSelectionMerge) { + const std::string before = + R"( + OpCapability Addresses + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "simple_shader" + %void = OpTypeVoid + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %7 = OpTypeFunction %void + %1 = OpFunction %void None %7 + %8 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %false %10 %11 + %10 = OpLabel + OpReturn + %11 = OpLabel + OpSelectionMerge %12 None + OpBranchConditional %false %13 %14 + %13 = OpLabel + %15 = OpIAdd %uint %uint_0 %uint_0 + OpBranch %12 + %14 = OpLabel + OpReturn + %12 = OpLabel + OpBranch %9 + %9 = OpLabel + %16 = OpIAdd %uint %15 %15 + OpReturn + OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "simple_shader" +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%false = OpConstantFalse %bool +%7 = OpTypeFunction %void +%_ptr_Function_bool = OpTypePointer Function %bool +%true = OpConstantTrue %bool +%26 = OpUndef %uint +%1 = OpFunction %void None %7 +%8 = OpLabel +%19 = OpVariable %_ptr_Function_bool Function %false +OpSelectionMerge %9 None +OpBranchConditional %false %10 %11 +%10 = OpLabel +OpStore %19 %true +OpBranch %9 +%11 = OpLabel +OpSelectionMerge %12 None +OpBranchConditional %false %13 %14 +%13 = OpLabel +%15 = OpIAdd %uint %uint_0 %uint_0 +OpBranch %12 +%14 = OpLabel +OpStore %19 %true +OpBranch %12 +%12 = OpLabel +%27 = OpPhi %uint %15 %13 %26 %14 +%22 = OpLoad %bool %19 +OpBranchConditional %22 %9 %21 +%21 = OpLabel +OpBranch %9 +%9 = OpLabel +%28 = OpPhi %uint %27 %21 %26 %10 %26 %12 +%25 = OpLoad %bool %19 +OpSelectionMerge %24 None +OpBranchConditional %25 %24 %23 +%23 = OpLabel +%16 = OpIAdd %uint %28 %28 +OpStore %19 %true +OpBranch %24 +%24 = OpLabel +OpBranch %17 +%17 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, after, false, true); +} + +// This is essentially the same as NestedSelectionMerge, except +// the order of the first branch is changed. This is to make sure things +// work even if the order of the traversals change. +TEST_F(MergeReturnPassTest, NestedSelectionMerge2) { + const std::string before = + R"( OpCapability Addresses + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "simple_shader" + %void = OpTypeVoid + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %7 = OpTypeFunction %void + %1 = OpFunction %void None %7 + %8 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %false %10 %11 + %11 = OpLabel + OpReturn + %10 = OpLabel + OpSelectionMerge %12 None + OpBranchConditional %false %13 %14 + %13 = OpLabel + %15 = OpIAdd %uint %uint_0 %uint_0 + OpBranch %12 + %14 = OpLabel + OpReturn + %12 = OpLabel + OpBranch %9 + %9 = OpLabel + %16 = OpIAdd %uint %15 %15 + OpReturn + OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "simple_shader" +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%false = OpConstantFalse %bool +%7 = OpTypeFunction %void +%_ptr_Function_bool = OpTypePointer Function %bool +%true = OpConstantTrue %bool +%26 = OpUndef %uint +%1 = OpFunction %void None %7 +%8 = OpLabel +%19 = OpVariable %_ptr_Function_bool Function %false +OpSelectionMerge %9 None +OpBranchConditional %false %10 %11 +%11 = OpLabel +OpStore %19 %true +OpBranch %9 +%10 = OpLabel +OpSelectionMerge %12 None +OpBranchConditional %false %13 %14 +%13 = OpLabel +%15 = OpIAdd %uint %uint_0 %uint_0 +OpBranch %12 +%14 = OpLabel +OpStore %19 %true +OpBranch %12 +%12 = OpLabel +%27 = OpPhi %uint %15 %13 %26 %14 +%25 = OpLoad %bool %19 +OpBranchConditional %25 %9 %24 +%24 = OpLabel +OpBranch %9 +%9 = OpLabel +%28 = OpPhi %uint %27 %24 %26 %11 %26 %12 +%23 = OpLoad %bool %19 +OpSelectionMerge %22 None +OpBranchConditional %23 %22 %21 +%21 = OpLabel +%16 = OpIAdd %uint %28 %28 +OpStore %19 %true +OpBranch %22 +%22 = OpLabel +OpBranch %17 +%17 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(MergeReturnPassTest, NestedSelectionMerge3) { + const std::string before = + R"( OpCapability Addresses + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "simple_shader" + %void = OpTypeVoid + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %false = OpConstantFalse %bool + %7 = OpTypeFunction %void + %1 = OpFunction %void None %7 + %8 = OpLabel + OpSelectionMerge %9 None + OpBranchConditional %false %10 %11 + %11 = OpLabel + OpReturn + %10 = OpLabel + %12 = OpIAdd %uint %uint_0 %uint_0 + OpSelectionMerge %13 None + OpBranchConditional %false %14 %15 + %14 = OpLabel + OpBranch %13 + %15 = OpLabel + OpReturn + %13 = OpLabel + OpBranch %9 + %9 = OpLabel + %16 = OpIAdd %uint %12 %12 + OpReturn + OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Addresses +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "simple_shader" +%void = OpTypeVoid +%bool = OpTypeBool +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%false = OpConstantFalse %bool +%7 = OpTypeFunction %void +%_ptr_Function_bool = OpTypePointer Function %bool +%true = OpConstantTrue %bool +%26 = OpUndef %uint +%1 = OpFunction %void None %7 +%8 = OpLabel +%19 = OpVariable %_ptr_Function_bool Function %false +OpSelectionMerge %9 None +OpBranchConditional %false %10 %11 +%11 = OpLabel +OpStore %19 %true +OpBranch %9 +%10 = OpLabel +%12 = OpIAdd %uint %uint_0 %uint_0 +OpSelectionMerge %13 None +OpBranchConditional %false %14 %15 +%14 = OpLabel +OpBranch %13 +%15 = OpLabel +OpStore %19 %true +OpBranch %13 +%13 = OpLabel +%25 = OpLoad %bool %19 +OpBranchConditional %25 %9 %24 +%24 = OpLabel +OpBranch %9 +%9 = OpLabel +%27 = OpPhi %uint %12 %24 %26 %11 %26 %13 +%23 = OpLoad %bool %19 +OpSelectionMerge %22 None +OpBranchConditional %23 %22 %21 +%21 = OpLabel +%16 = OpIAdd %uint %27 %27 +OpStore %19 %true +OpBranch %22 +%22 = OpLabel +OpBranch %17 +%17 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, false, true); +} +*/ + +TEST_F(MergeReturnPassTest, NestedLoopMerge) { + const std::string before = + R"( OpCapability SampledBuffer + OpCapability StorageImageExtendedFormats + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "CS" + OpExecutionMode %2 LocalSize 8 8 1 + OpSource HLSL 600 + OpName %function "function" + %uint = OpTypeInt 32 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 + %bool = OpTypeBool + %true = OpConstantTrue %bool +%_ptr_Function_uint = OpTypePointer Function %uint + %_struct_13 = OpTypeStruct %v3uint %v3uint %v3uint %uint %uint %uint %uint %uint %uint + %2 = OpFunction %void None %6 + %14 = OpLabel + %15 = OpFunctionCall %void %function + OpReturn + OpFunctionEnd + %function = OpFunction %void None %6 + %16 = OpLabel + %17 = OpVariable %_ptr_Function_uint Function + %18 = OpVariable %_ptr_Function_uint Function + OpStore %17 %uint_0 + OpBranch %19 + %19 = OpLabel + %20 = OpLoad %uint %17 + %21 = OpULessThan %bool %20 %uint_1 + OpLoopMerge %22 %23 DontUnroll + OpBranchConditional %21 %24 %22 + %24 = OpLabel + OpStore %18 %uint_1 + OpBranch %25 + %25 = OpLabel + %26 = OpLoad %uint %18 + %27 = OpINotEqual %bool %26 %uint_0 + OpLoopMerge %28 %29 DontUnroll + OpBranchConditional %27 %30 %28 + %30 = OpLabel + OpSelectionMerge %31 None + OpBranchConditional %true %32 %31 + %32 = OpLabel + OpReturn + %31 = OpLabel + OpStore %18 %uint_1 + OpBranch %29 + %29 = OpLabel + OpBranch %25 + %28 = OpLabel + OpBranch %23 + %23 = OpLabel + %33 = OpLoad %uint %17 + %34 = OpIAdd %uint %33 %uint_1 + OpStore %17 %34 + OpBranch %19 + %22 = OpLabel + OpReturn + OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability SampledBuffer +OpCapability StorageImageExtendedFormats +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %2 "CS" +OpExecutionMode %2 LocalSize 8 8 1 +OpSource HLSL 600 +OpName %function "function" +%uint = OpTypeInt 32 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%v3uint = OpTypeVector %uint 3 +%bool = OpTypeBool +%true = OpConstantTrue %bool +%_ptr_Function_uint = OpTypePointer Function %uint +%_struct_13 = OpTypeStruct %v3uint %v3uint %v3uint %uint %uint %uint %uint %uint %uint +%false = OpConstantFalse %bool +%_ptr_Function_bool = OpTypePointer Function %bool +%2 = OpFunction %void None %6 +%14 = OpLabel +%15 = OpFunctionCall %void %function +OpReturn +OpFunctionEnd +%function = OpFunction %void None %6 +%16 = OpLabel +%38 = OpVariable %_ptr_Function_bool Function %false +%17 = OpVariable %_ptr_Function_uint Function +%18 = OpVariable %_ptr_Function_uint Function +OpStore %17 %uint_0 +OpBranch %19 +%19 = OpLabel +%20 = OpLoad %uint %17 +%21 = OpULessThan %bool %20 %uint_1 +OpLoopMerge %22 %23 DontUnroll +OpBranchConditional %21 %24 %22 +%24 = OpLabel +OpStore %18 %uint_1 +OpBranch %25 +%25 = OpLabel +%26 = OpLoad %uint %18 +%27 = OpINotEqual %bool %26 %uint_0 +OpLoopMerge %28 %29 DontUnroll +OpBranchConditional %27 %30 %28 +%30 = OpLabel +OpSelectionMerge %31 None +OpBranchConditional %true %32 %31 +%32 = OpLabel +OpStore %38 %true +OpBranch %28 +%31 = OpLabel +OpStore %18 %uint_1 +OpBranch %29 +%29 = OpLabel +OpBranch %25 +%28 = OpLabel +%40 = OpLoad %bool %38 +OpBranchConditional %40 %22 %39 +%39 = OpLabel +OpBranch %23 +%23 = OpLabel +%33 = OpLoad %uint %17 +%34 = OpIAdd %uint %33 %uint_1 +OpStore %17 %34 +OpBranch %19 +%22 = OpLabel +%43 = OpLoad %bool %38 +OpSelectionMerge %42 None +OpBranchConditional %43 %42 %41 +%41 = OpLabel +OpStore %38 %true +OpBranch %42 +%42 = OpLabel +OpBranch %35 +%35 = OpLabel +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before, after, false, true); +} + +TEST_F(MergeReturnPassTest, ReturnValueDecoration) { + const std::string before = + R"(OpCapability Linkage +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %11 "simple_shader" +OpDecorate %7 RelaxedPrecision +%12 = OpTypeVoid +%1 = OpTypeInt 32 0 +%2 = OpTypeBool +%3 = OpConstantFalse %2 +%4 = OpConstant %1 0 +%5 = OpConstant %1 1 +%6 = OpTypeFunction %1 +%13 = OpTypeFunction %12 +%11 = OpFunction %12 None %13 +%l1 = OpLabel +OpReturn +OpFunctionEnd +%7 = OpFunction %1 None %6 +%8 = OpLabel +OpBranchConditional %3 %9 %10 +%9 = OpLabel +OpReturnValue %4 +%10 = OpLabel +OpReturnValue %5 +OpFunctionEnd +)"; + + const std::string after = + R"(OpCapability Linkage +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %11 "simple_shader" +OpDecorate %7 RelaxedPrecision +OpDecorate %17 RelaxedPrecision +OpDecorate %18 RelaxedPrecision +%12 = OpTypeVoid +%1 = OpTypeInt 32 0 +%2 = OpTypeBool +%3 = OpConstantFalse %2 +%4 = OpConstant %1 0 +%5 = OpConstant %1 1 +%6 = OpTypeFunction %1 +%13 = OpTypeFunction %12 +%16 = OpTypePointer Function %1 +%19 = OpTypePointer Function %2 +%21 = OpConstantTrue %2 +%11 = OpFunction %12 None %13 +%14 = OpLabel +OpReturn +OpFunctionEnd +%7 = OpFunction %1 None %6 +%8 = OpLabel +%20 = OpVariable %19 Function %3 +%17 = OpVariable %16 Function +OpBranchConditional %3 %9 %10 +%9 = OpLabel +OpStore %20 %21 +OpStore %17 %4 +OpBranch %15 +%10 = OpLabel +OpStore %20 %21 +OpStore %17 %5 +OpBranch %15 +%15 = OpLabel +%18 = OpLoad %1 %17 +OpReturnValue %18 +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER); + SinglePassRunAndCheck(before, after, false, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_remove_duplicates_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_remove_duplicates_test.cpp new file mode 100644 index 00000000000..887fdfdb4ed --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_remove_duplicates_test.cpp @@ -0,0 +1,646 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass_manager.h" +#include "source/opt/remove_duplicates_pass.h" +#include "source/spirv_constant.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace opt { +namespace { + +class RemoveDuplicatesTest : public ::testing::Test { + public: + RemoveDuplicatesTest() + : tools_(SPV_ENV_UNIVERSAL_1_2), + context_(), + consumer_([this](spv_message_level_t level, const char*, + const spv_position_t& position, const char* message) { + if (!error_message_.empty()) error_message_ += "\n"; + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + error_message_ += "ERROR"; + break; + case SPV_MSG_WARNING: + error_message_ += "WARNING"; + break; + case SPV_MSG_INFO: + error_message_ += "INFO"; + break; + case SPV_MSG_DEBUG: + error_message_ += "DEBUG"; + break; + } + error_message_ += + ": " + std::to_string(position.index) + ": " + message; + }), + disassemble_options_(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER), + error_message_() { + tools_.SetMessageConsumer(consumer_); + } + + void TearDown() override { error_message_.clear(); } + + std::string RunPass(const std::string& text) { + context_ = spvtools::BuildModule(SPV_ENV_UNIVERSAL_1_2, consumer_, text); + if (!context_.get()) return std::string(); + + PassManager manager; + manager.SetMessageConsumer(consumer_); + manager.AddPass(); + + Pass::Status pass_res = manager.Run(context_.get()); + if (pass_res == Pass::Status::Failure) return std::string(); + + return ModuleToText(); + } + + // Disassembles |binary| and outputs the result in |text|. If |text| is a + // null pointer, SPV_ERROR_INVALID_POINTER is returned. + spv_result_t Disassemble(const std::vector& binary, + std::string* text) { + if (!text) return SPV_ERROR_INVALID_POINTER; + return tools_.Disassemble(binary, text, disassemble_options_) + ? SPV_SUCCESS + : SPV_ERROR_INVALID_BINARY; + } + + // Returns the accumulated error messages for the test. + std::string GetErrorMessage() const { return error_message_; } + + std::string ToText(const std::vector& inst) { + std::vector binary = {SpvMagicNumber, 0x10200, 0u, 2u, 0u}; + for (const Instruction* i : inst) + i->ToBinaryWithoutAttachedDebugInsts(&binary); + std::string text; + Disassemble(binary, &text); + return text; + } + + std::string ModuleToText() { + std::vector binary; + context_->module()->ToBinary(&binary, false); + std::string text; + Disassemble(binary, &text); + return text; + } + + private: + spvtools::SpirvTools + tools_; // An instance for calling SPIRV-Tools functionalities. + std::unique_ptr context_; + spvtools::MessageConsumer consumer_; + uint32_t disassemble_options_; + std::string error_message_; +}; + +TEST_F(RemoveDuplicatesTest, DuplicateCapabilities) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpCapability Shader +OpMemoryModel Logical GLSL450 +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, DuplicateExtInstImports) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "OpenCL.std" +%2 = OpExtInstImport "OpenCL.std" +%3 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +%1 = OpExtInstImport "OpenCL.std" +%3 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, DuplicateTypes) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %1 %2 +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%3 = OpTypeStruct %1 %1 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, SameTypeDifferentMemberDecoration) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 GLSLPacked +%2 = OpTypeInt 32 0 +%1 = OpTypeStruct %2 %2 +%3 = OpTypeStruct %2 %2 +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 GLSLPacked +%2 = OpTypeInt 32 0 +%1 = OpTypeStruct %2 %2 +%3 = OpTypeStruct %2 %2 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, SameTypeAndMemberDecoration) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 GLSLPacked +OpDecorate %2 GLSLPacked +%3 = OpTypeInt 32 0 +%1 = OpTypeStruct %3 %3 +%2 = OpTypeStruct %3 %3 +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 GLSLPacked +%3 = OpTypeInt 32 0 +%1 = OpTypeStruct %3 %3 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, SameTypeAndDifferentName) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %1 "Type1" +OpName %2 "Type2" +%3 = OpTypeInt 32 0 +%1 = OpTypeStruct %3 %3 +%2 = OpTypeStruct %3 %3 +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %1 "Type1" +%3 = OpTypeInt 32 0 +%1 = OpTypeStruct %3 %3 +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// Check that #1033 has been fixed. +TEST_F(RemoveDuplicatesTest, DoNotRemoveDifferentOpDecorationGroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +%1 = OpDecorationGroup +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %3 %1 %2 +%4 = OpTypeInt 32 0 +%3 = OpVariable %4 Uniform +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +%1 = OpDecorationGroup +OpDecorate %2 Restrict +%2 = OpDecorationGroup +OpGroupDecorate %3 %1 %2 +%4 = OpTypeInt 32 0 +%3 = OpVariable %4 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +TEST_F(RemoveDuplicatesTest, DifferentDecorationGroup) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %1 Restrict +%1 = OpDecorationGroup +OpDecorate %2 Constant +%2 = OpDecorationGroup +OpGroupDecorate %1 %3 +OpGroupDecorate %2 %4 +%5 = OpTypeInt 32 0 +%3 = OpVariable %5 Uniform +%4 = OpVariable %5 Uniform +)"; + const std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpDecorate %1 Constant +OpDecorate %1 Restrict +%1 = OpDecorationGroup +OpDecorate %2 Constant +%2 = OpDecorationGroup +OpGroupDecorate %1 %3 +OpGroupDecorate %2 %4 +%5 = OpTypeInt 32 0 +%3 = OpVariable %5 Uniform +%4 = OpVariable %5 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), after); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// Test what happens when a type is a resource type. For now we are merging +// them, but, if we want to merge types and make reflection work (issue #1372), +// we will not be able to merge %2 and %3 below. +TEST_F(RemoveDuplicatesTest, DontMergeNestedResourceTypes) { + const std::string spirv = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %2 "NormalAdjust" +OpMemberName %2 0 "XDir" +OpMemberName %3 0 "AdjustXYZ" +OpMemberName %3 1 "AdjustDir" +OpName %4 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpMemberDecorate %2 0 Offset 0 +OpMemberDecorate %3 0 Offset 0 +OpMemberDecorate %3 1 Offset 16 +OpDecorate %3 Block +OpDecorate %4 DescriptorSet 0 +OpDecorate %4 Binding 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 3 +%1 = OpTypeStruct %6 +%2 = OpTypeStruct %6 +%3 = OpTypeStruct %1 %2 +%7 = OpTypePointer Uniform %3 +%4 = OpVariable %7 Uniform +)"; + + const std::string result = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpMemberName %3 0 "AdjustXYZ" +OpMemberName %3 1 "AdjustDir" +OpName %4 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpMemberDecorate %3 0 Offset 0 +OpMemberDecorate %3 1 Offset 16 +OpDecorate %3 Block +OpDecorate %4 DescriptorSet 0 +OpDecorate %4 Binding 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 3 +%1 = OpTypeStruct %6 +%3 = OpTypeStruct %1 %1 +%7 = OpTypePointer Uniform %3 +%4 = OpVariable %7 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), result); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// See comment for DontMergeNestedResourceTypes. +TEST_F(RemoveDuplicatesTest, DontMergeResourceTypes) { + const std::string spirv = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %2 "NormalAdjust" +OpMemberName %2 0 "XDir" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpMemberDecorate %2 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +OpDecorate %4 DescriptorSet 1 +OpDecorate %4 Binding 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 3 +%1 = OpTypeStruct %6 +%2 = OpTypeStruct %6 +%7 = OpTypePointer Uniform %1 +%8 = OpTypePointer Uniform %2 +%3 = OpVariable %7 Uniform +%4 = OpVariable %8 Uniform +)"; + + const std::string result = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +OpDecorate %4 DescriptorSet 1 +OpDecorate %4 Binding 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 3 +%1 = OpTypeStruct %6 +%7 = OpTypePointer Uniform %1 +%3 = OpVariable %7 Uniform +%4 = OpVariable %7 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), result); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// See comment for DontMergeNestedResourceTypes. +TEST_F(RemoveDuplicatesTest, DontMergeResourceTypesContainingArray) { + const std::string spirv = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %2 "NormalAdjust" +OpMemberName %2 0 "XDir" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpMemberDecorate %2 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +OpDecorate %4 DescriptorSet 1 +OpDecorate %4 Binding 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 3 +%1 = OpTypeStruct %6 +%2 = OpTypeStruct %6 +%7 = OpTypeInt 32 0 +%8 = OpConstant %7 4 +%9 = OpTypeArray %1 %8 +%10 = OpTypeArray %2 %8 +%11 = OpTypePointer Uniform %9 +%12 = OpTypePointer Uniform %10 +%3 = OpVariable %11 Uniform +%4 = OpVariable %12 Uniform +)"; + + const std::string result = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +OpDecorate %4 DescriptorSet 1 +OpDecorate %4 Binding 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 3 +%1 = OpTypeStruct %6 +%7 = OpTypeInt 32 0 +%8 = OpConstant %7 4 +%9 = OpTypeArray %1 %8 +%11 = OpTypePointer Uniform %9 +%3 = OpVariable %11 Uniform +%4 = OpVariable %11 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), result); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// Test that we merge the type of a resource with a type that is not the type +// a resource. The resource type appears first in this case. We must keep +// the resource type. +TEST_F(RemoveDuplicatesTest, MergeResourceTypeWithNonresourceType1) { + const std::string spirv = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %2 "NormalAdjust" +OpMemberName %2 0 "XDir" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpMemberDecorate %2 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 3 +%1 = OpTypeStruct %5 +%2 = OpTypeStruct %5 +%6 = OpTypePointer Uniform %1 +%7 = OpTypePointer Uniform %2 +%3 = OpVariable %6 Uniform +%8 = OpVariable %7 Uniform +)"; + + const std::string result = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 3 +%1 = OpTypeStruct %5 +%6 = OpTypePointer Uniform %1 +%3 = OpVariable %6 Uniform +%8 = OpVariable %6 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), result); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// Test that we merge the type of a resource with a type that is not the type +// a resource. The resource type appears second in this case. We must keep +// the resource type. +// +// See comment for DontMergeNestedResourceTypes. +TEST_F(RemoveDuplicatesTest, MergeResourceTypeWithNonresourceType2) { + const std::string spirv = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %2 "NormalAdjust" +OpMemberName %2 0 "XDir" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpMemberDecorate %2 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 3 +%1 = OpTypeStruct %5 +%2 = OpTypeStruct %5 +%6 = OpTypePointer Uniform %1 +%7 = OpTypePointer Uniform %2 +%8 = OpVariable %6 Uniform +%3 = OpVariable %7 Uniform +)"; + + const std::string result = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpSource HLSL 600 +OpName %1 "PositionAdjust" +OpMemberName %1 0 "XAdjust" +OpName %3 "Constants" +OpMemberDecorate %1 0 Offset 0 +OpDecorate %3 DescriptorSet 0 +OpDecorate %3 Binding 0 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 3 +%1 = OpTypeStruct %5 +%6 = OpTypePointer Uniform %1 +%8 = OpVariable %6 Uniform +%3 = OpVariable %6 Uniform +)"; + + EXPECT_EQ(RunPass(spirv), result); + EXPECT_EQ(GetErrorMessage(), ""); +} + +// In this test, %8 and %9 are the same and only %9 is used in a resource. +// However, we cannot merge them unless we also merge %2 and %3, which cannot +// happen because both are used in resources. +// +// If we try to avoid replaces resource types, then remove duplicates should +// have not change in this case. That is not currently implemented. +TEST_F(RemoveDuplicatesTest, MergeResourceTypeWithNonresourceType3) { + const std::string spirv = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource HLSL 600 +OpName %2 "PositionAdjust" +OpMemberName %2 0 "XAdjust" +OpName %3 "NormalAdjust" +OpMemberName %3 0 "XDir" +OpName %4 "Constants" +OpMemberDecorate %2 0 Offset 0 +OpMemberDecorate %3 0 Offset 0 +OpDecorate %4 DescriptorSet 0 +OpDecorate %4 Binding 0 +OpDecorate %5 DescriptorSet 1 +OpDecorate %5 Binding 0 +%6 = OpTypeFloat 32 +%7 = OpTypeVector %6 3 +%2 = OpTypeStruct %7 +%3 = OpTypeStruct %7 +%8 = OpTypePointer Uniform %3 +%9 = OpTypePointer Uniform %2 +%10 = OpTypeStruct %3 +%11 = OpTypePointer Uniform %10 +%5 = OpVariable %9 Uniform +%4 = OpVariable %11 Uniform +%12 = OpTypeVoid +%13 = OpTypeFunction %12 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 0 +%1 = OpFunction %12 None %13 +%16 = OpLabel +%17 = OpAccessChain %8 %4 %15 +OpReturn +OpFunctionEnd +)"; + + const std::string result = R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %1 "main" +OpSource HLSL 600 +OpName %2 "PositionAdjust" +OpMemberName %2 0 "XAdjust" +OpName %4 "Constants" +OpMemberDecorate %2 0 Offset 0 +OpDecorate %4 DescriptorSet 0 +OpDecorate %4 Binding 0 +OpDecorate %5 DescriptorSet 1 +OpDecorate %5 Binding 0 +%6 = OpTypeFloat 32 +%7 = OpTypeVector %6 3 +%2 = OpTypeStruct %7 +%8 = OpTypePointer Uniform %2 +%10 = OpTypeStruct %2 +%11 = OpTypePointer Uniform %10 +%5 = OpVariable %8 Uniform +%4 = OpVariable %11 Uniform +%12 = OpTypeVoid +%13 = OpTypeFunction %12 +%14 = OpTypeInt 32 0 +%15 = OpConstant %14 0 +%1 = OpFunction %12 None %13 +%16 = OpLabel +%17 = OpAccessChain %8 %4 %15 +OpReturn +OpFunctionEnd +)"; + + EXPECT_EQ(RunPass(spirv), result); + EXPECT_EQ(GetErrorMessage(), ""); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_test.cpp new file mode 100644 index 00000000000..bce05b67902 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_test.cpp @@ -0,0 +1,242 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/opt/pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +class DummyPass : public Pass { + public: + const char* name() const override { return "dummy-pass"; } + Status Process() override { return Status::SuccessWithoutChange; } +}; + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +TEST_F(PassClassTest, BasicVisitFromEntryPoint) { + // Make sure we visit the entry point, and the function it calls. + // Do not visit Dead or Exported. + const std::string text = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %10 "main" + OpName %10 "main" + OpName %Dead "Dead" + OpName %11 "Constant" + OpName %ExportedFunc "ExportedFunc" + OpDecorate %ExportedFunc LinkageAttributes "ExportedFunc" Export + %void = OpTypeVoid + %6 = OpTypeFunction %void + %10 = OpFunction %void None %6 + %14 = OpLabel + %15 = OpFunctionCall %void %11 + %16 = OpFunctionCall %void %11 + OpReturn + OpFunctionEnd + %11 = OpFunction %void None %6 + %18 = OpLabel + OpReturn + OpFunctionEnd + %Dead = OpFunction %void None %6 + %19 = OpLabel + OpReturn + OpFunctionEnd +%ExportedFunc = OpFunction %void None %7 + %20 = OpLabel + %21 = OpFunctionCall %void %11 + OpReturn + OpFunctionEnd +)"; + // clang-format on + + std::unique_ptr localContext = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, localContext) << "Assembling failed for shader:\n" + << text << std::endl; + DummyPass testPass; + std::vector processed; + Pass::ProcessFunction mark_visited = [&processed](Function* fp) { + processed.push_back(fp->result_id()); + return false; + }; + testPass.ProcessEntryPointCallTree(mark_visited, localContext->module()); + EXPECT_THAT(processed, UnorderedElementsAre(10, 11)); +} + +TEST_F(PassClassTest, BasicVisitReachable) { + // Make sure we visit the entry point, exported function, and the function + // they call. Do not visit Dead. + const std::string text = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %10 "main" + OpName %10 "main" + OpName %Dead "Dead" + OpName %11 "Constant" + OpName %12 "ExportedFunc" + OpName %13 "Constant2" + OpDecorate %12 LinkageAttributes "ExportedFunc" Export + %void = OpTypeVoid + %6 = OpTypeFunction %void + %10 = OpFunction %void None %6 + %14 = OpLabel + %15 = OpFunctionCall %void %11 + %16 = OpFunctionCall %void %11 + OpReturn + OpFunctionEnd + %11 = OpFunction %void None %6 + %18 = OpLabel + OpReturn + OpFunctionEnd + %Dead = OpFunction %void None %6 + %19 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %void None %9 + %20 = OpLabel + %21 = OpFunctionCall %void %13 + OpReturn + OpFunctionEnd + %13 = OpFunction %void None %6 + %22 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + + std::unique_ptr localContext = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, localContext) << "Assembling failed for shader:\n" + << text << std::endl; + + DummyPass testPass; + std::vector processed; + Pass::ProcessFunction mark_visited = [&processed](Function* fp) { + processed.push_back(fp->result_id()); + return false; + }; + testPass.ProcessReachableCallTree(mark_visited, localContext.get()); + EXPECT_THAT(processed, UnorderedElementsAre(10, 11, 12, 13)); +} + +TEST_F(PassClassTest, BasicVisitOnlyOnce) { + // Make sure we visit %11 only once, even if it is called from two different + // functions. + const std::string text = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %10 "main" %gl_FragColor + OpName %10 "main" + OpName %Dead "Dead" + OpName %11 "Constant" + OpName %12 "ExportedFunc" + OpDecorate %12 LinkageAttributes "ExportedFunc" Export + %void = OpTypeVoid + %6 = OpTypeFunction %void + %10 = OpFunction %void None %6 + %14 = OpLabel + %15 = OpFunctionCall %void %11 + %16 = OpFunctionCall %void %12 + OpReturn + OpFunctionEnd + %11 = OpFunction %void None %6 + %18 = OpLabel + %19 = OpFunctionCall %void %12 + OpReturn + OpFunctionEnd + %Dead = OpFunction %void None %6 + %20 = OpLabel + OpReturn + OpFunctionEnd + %12 = OpFunction %void None %9 + %21 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + + std::unique_ptr localContext = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, localContext) << "Assembling failed for shader:\n" + << text << std::endl; + + DummyPass testPass; + std::vector processed; + Pass::ProcessFunction mark_visited = [&processed](Function* fp) { + processed.push_back(fp->result_id()); + return false; + }; + testPass.ProcessReachableCallTree(mark_visited, localContext.get()); + EXPECT_THAT(processed, UnorderedElementsAre(10, 11, 12)); +} + +TEST_F(PassClassTest, BasicDontVisitExportedVariable) { + // Make sure we only visit functions and not exported variables. + const std::string text = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %10 "main" %gl_FragColor + OpExecutionMode %10 OriginUpperLeft + OpSource GLSL 150 + OpName %10 "main" + OpName %Dead "Dead" + OpName %11 "Constant" + OpName %12 "export_var" + OpDecorate %12 LinkageAttributes "export_var" Export + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_1 = OpConstant %float 1 + %12 = OpVariable %float Output + %10 = OpFunction %void None %6 + %14 = OpLabel + OpStore %12 %float_1 + OpReturn + OpFunctionEnd +)"; + // clang-format on + + std::unique_ptr localContext = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(nullptr, localContext) << "Assembling failed for shader:\n" + << text << std::endl; + + DummyPass testPass; + std::vector processed; + Pass::ProcessFunction mark_visited = [&processed](Function* fp) { + processed.push_back(fp->result_id()); + return false; + }; + testPass.ProcessReachableCallTree(mark_visited, localContext.get()); + EXPECT_THAT(processed, UnorderedElementsAre(10)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_utils.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_utils.cpp new file mode 100644 index 00000000000..ceb9996102c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_utils.cpp @@ -0,0 +1,82 @@ +// Copyright (c) 2016 Google 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. + +#include "test/opt/pass_utils.h" + +#include +#include + +namespace spvtools { +namespace opt { +namespace { + +// Well, this is another place requiring the knowledge of the grammar and can be +// stale when SPIR-V is updated. It would be nice to automatically generate +// this, but the cost is just too high. + +const char* kDebugOpcodes[] = { + // clang-format off + "OpSourceContinued", "OpSource", "OpSourceExtension", + "OpName", "OpMemberName", "OpString", + "OpLine", "OpNoLine", "OpModuleProcessed" + // clang-format on +}; + +} // anonymous namespace + +bool FindAndReplace(std::string* process_str, const std::string find_str, + const std::string replace_str) { + if (process_str->empty() || find_str.empty()) { + return false; + } + bool replaced = false; + // Note this algorithm has quadratic time complexity. It is OK for test cases + // with short strings, but might not fit in other contexts. + for (size_t pos = process_str->find(find_str, 0); pos != std::string::npos; + pos = process_str->find(find_str, pos)) { + process_str->replace(pos, find_str.length(), replace_str); + pos += replace_str.length(); + replaced = true; + } + return replaced; +} + +bool ContainsDebugOpcode(const char* inst) { + return std::any_of(std::begin(kDebugOpcodes), std::end(kDebugOpcodes), + [inst](const char* op) { + return std::string(inst).find(op) != std::string::npos; + }); +} + +std::string SelectiveJoin(const std::vector& strings, + const std::function& skip_dictator, + char delimiter) { + std::ostringstream oss; + for (const auto* str : strings) { + if (!skip_dictator(str)) oss << str << delimiter; + } + return oss.str(); +} + +std::string JoinAllInsts(const std::vector& insts) { + return SelectiveJoin(insts, [](const char*) { return false; }); +} + +std::string JoinNonDebugInsts(const std::vector& insts) { + return SelectiveJoin( + insts, [](const char* inst) { return ContainsDebugOpcode(inst); }); +} + +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_utils.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_utils.h new file mode 100644 index 00000000000..37406842a97 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/pass_utils.h @@ -0,0 +1,68 @@ +// Copyright (c) 2016 Google 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. + +#ifndef TEST_OPT_PASS_UTILS_H_ +#define TEST_OPT_PASS_UTILS_H_ + +#include +#include +#include +#include +#include + +namespace spvtools { +namespace opt { + +// In-place substring replacement. Finds the |find_str| in the |process_str| +// and replaces the found substring with |replace_str|. Returns true if at +// least one replacement is done successfully, returns false otherwise. The +// replaced substring won't be processed again, which means: If the +// |replace_str| has |find_str| as its substring, that newly replaced part of +// |process_str| won't be processed again. +bool FindAndReplace(std::string* process_str, const std::string find_str, + const std::string replace_str); + +// Returns true if the given string contains any debug opcode substring. +bool ContainsDebugOpcode(const char* inst); + +// Returns the concatenated string from a vector of |strings|, with postfixing +// each string with the given |delimiter|. if the |skip_dictator| returns true +// for an original string, that string will be omitted. +std::string SelectiveJoin(const std::vector& strings, + const std::function& skip_dictator, + char delimiter = '\n'); + +// Concatenates a vector of strings into one string. Each string is postfixed +// with '\n'. +std::string JoinAllInsts(const std::vector& insts); + +// Concatenates a vector of strings into one string. Each string is postfixed +// with '\n'. If a string contains opcode for debug instruction, that string +// will be ignored. +std::string JoinNonDebugInsts(const std::vector& insts); + +// Returns a vector that contains the contents of |a| followed by the contents +// of |b|. +template +std::vector Concat(const std::vector& a, const std::vector& b) { + std::vector ret; + std::copy(a.begin(), a.end(), back_inserter(ret)); + std::copy(b.begin(), b.end(), back_inserter(ret)); + return ret; +} + +} // namespace opt +} // namespace spvtools + +#endif // TEST_OPT_PASS_UTILS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/private_to_local_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/private_to_local_test.cpp new file mode 100644 index 00000000000..d7eb37e511d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/private_to_local_test.cpp @@ -0,0 +1,316 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; +using PrivateToLocalTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(PrivateToLocalTest, ChangeToLocal) { + // Change the private variable to a local, and change the types accordingly. + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 +; CHECK: [[float:%[a-zA-Z_\d]+]] = OpTypeFloat 32 + %5 = OpTypeFloat 32 +; CHECK: [[newtype:%[a-zA-Z_\d]+]] = OpTypePointer Function [[float]] + %6 = OpTypePointer Private %5 +; CHECK-NOT: OpVariable [[.+]] Private + %8 = OpVariable %6 Private +; CHECK: OpFunction + %2 = OpFunction %3 None %4 +; CHECK: OpLabel + %7 = OpLabel +; CHECK-NEXT: [[newvar:%[a-zA-Z_\d]+]] = OpVariable [[newtype]] Function +; CHECK: OpLoad [[float]] [[newvar]] + %9 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +TEST_F(PrivateToLocalTest, ReuseExistingType) { + // Change the private variable to a local, and change the types accordingly. + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 +; CHECK: [[float:%[a-zA-Z_\d]+]] = OpTypeFloat 32 + %5 = OpTypeFloat 32 + %func_ptr = OpTypePointer Function %5 +; CHECK: [[newtype:%[a-zA-Z_\d]+]] = OpTypePointer Function [[float]] +; CHECK-NOT: [[%[a-zA-Z_\d]+]] = OpTypePointer Function [[float]] + %6 = OpTypePointer Private %5 +; CHECK-NOT: OpVariable [[.+]] Private + %8 = OpVariable %6 Private +; CHECK: OpFunction + %2 = OpFunction %3 None %4 +; CHECK: OpLabel + %7 = OpLabel +; CHECK-NEXT: [[newvar:%[a-zA-Z_\d]+]] = OpVariable [[newtype]] Function +; CHECK: OpLoad [[float]] [[newvar]] + %9 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +TEST_F(PrivateToLocalTest, UpdateAccessChain) { + // Change the private variable to a local, and change the AccessChain. + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void +; CHECK: [[float:%[a-zA-Z_\d]+]] = OpTypeFloat + %float = OpTypeFloat 32 +; CHECK: [[struct:%[a-zA-Z_\d]+]] = OpTypeStruct + %_struct_8 = OpTypeStruct %float +%_ptr_Private_float = OpTypePointer Private %float +; CHECK: [[new_struct_type:%[a-zA-Z_\d]+]] = OpTypePointer Function [[struct]] +; CHECK: [[new_float_type:%[a-zA-Z_\d]+]] = OpTypePointer Function [[float]] +%_ptr_Private__struct_8 = OpTypePointer Private %_struct_8 +; CHECK-NOT: OpVariable [[.+]] Private + %11 = OpVariable %_ptr_Private__struct_8 Private +; CHECK: OpFunction + %2 = OpFunction %void None %6 +; CHECK: OpLabel + %12 = OpLabel +; CHECK-NEXT: [[newvar:%[a-zA-Z_\d]+]] = OpVariable [[new_struct_type]] Function +; CHECK: [[member:%[a-zA-Z_\d]+]] = OpAccessChain [[new_float_type]] [[newvar]] + %13 = OpAccessChain %_ptr_Private_float %11 %uint_0 +; CHECK: OpLoad [[float]] [[member]] + %14 = OpLoad %float %13 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +TEST_F(PrivateToLocalTest, UseTexelPointer) { + // Change the private variable to a local, and change the OpImageTexelPointer. + const std::string text = R"( +OpCapability SampledBuffer + OpCapability StorageImageExtendedFormats + OpCapability ImageBuffer + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "min" %gl_GlobalInvocationID + OpExecutionMode %2 LocalSize 64 1 1 + OpSource HLSL 600 + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + OpDecorate %4 DescriptorSet 4 + OpDecorate %4 Binding 70 + %uint = OpTypeInt 32 0 + %6 = OpTypeImage %uint Buffer 0 0 0 2 R32ui +%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6 +%_ptr_Private_6 = OpTypePointer Private %6 + %void = OpTypeVoid + %10 = OpTypeFunction %void + %uint_0 = OpConstant %uint 0 + %uint_1 = OpConstant %uint 1 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%_ptr_Image_uint = OpTypePointer Image %uint + %4 = OpVariable %_ptr_UniformConstant_6 UniformConstant + %16 = OpVariable %_ptr_Private_6 Private +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + %2 = OpFunction %void None %10 + %17 = OpLabel +; Make sure the variable was moved. +; CHECK: OpFunction +; CHECK-NEXT: OpLabel +; CHECK-NEXT: OpVariable %_ptr_Function_6 Function + %18 = OpLoad %6 %4 + OpStore %16 %18 + %19 = OpImageTexelPointer %_ptr_Image_uint %16 %uint_0 %uint_0 + %20 = OpAtomicIAdd %uint %19 %uint_1 %uint_0 %uint_1 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +TEST_F(PrivateToLocalTest, UsedInTwoFunctions) { + // Should not change because it is used in multiple functions. + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Private %5 + %8 = OpVariable %6 Private + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + %10 = OpFunction %3 None %4 + %11 = OpLabel + %12 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(PrivateToLocalTest, UsedInFunctionCall) { + // Should not change because it is used in a function call. Changing the + // signature of the function would require cloning the function, which is not + // worth it. + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 +%_ptr_Private_float = OpTypePointer Private %float + %7 = OpTypeFunction %void %_ptr_Private_float + %8 = OpVariable %_ptr_Private_float Private + %2 = OpFunction %void None %4 + %9 = OpLabel + %10 = OpFunctionCall %void %11 %8 + OpReturn + OpFunctionEnd + %11 = OpFunction %void None %7 + %12 = OpFunctionParameter %_ptr_Private_float + %13 = OpLabel + %14 = OpLoad %float %12 + OpReturn + OpFunctionEnd + )"; + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(PrivateToLocalTest, CreatePointerToAmbiguousStruct1) { + // Test that the correct pointer type is picked up. + const std::string text = R"( +; CHECK: [[struct1:%[a-zA-Z_\d]+]] = OpTypeStruct +; CHECK: [[struct2:%[a-zA-Z_\d]+]] = OpTypeStruct +; CHECK: [[priv_ptr:%[\w]+]] = OpTypePointer Private [[struct1]] +; CHECK: [[fuct_ptr2:%[\w]+]] = OpTypePointer Function [[struct2]] +; CHECK: [[fuct_ptr1:%[\w]+]] = OpTypePointer Function [[struct1]] +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK-NEXT: [[newvar:%[a-zA-Z_\d]+]] = OpVariable [[fuct_ptr1]] Function +; CHECK: OpLoad [[struct1]] [[newvar]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %struct1 = OpTypeStruct %5 + %struct2 = OpTypeStruct %5 + %6 = OpTypePointer Private %struct1 + %func_ptr2 = OpTypePointer Function %struct2 + %8 = OpVariable %6 Private + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %struct1 %8 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +TEST_F(PrivateToLocalTest, CreatePointerToAmbiguousStruct2) { + // Test that the correct pointer type is picked up. + const std::string text = R"( +; CHECK: [[struct1:%[a-zA-Z_\d]+]] = OpTypeStruct +; CHECK: [[struct2:%[a-zA-Z_\d]+]] = OpTypeStruct +; CHECK: [[priv_ptr:%[\w]+]] = OpTypePointer Private [[struct2]] +; CHECK: [[fuct_ptr1:%[\w]+]] = OpTypePointer Function [[struct1]] +; CHECK: [[fuct_ptr2:%[\w]+]] = OpTypePointer Function [[struct2]] +; CHECK: OpFunction +; CHECK: OpLabel +; CHECK-NEXT: [[newvar:%[a-zA-Z_\d]+]] = OpVariable [[fuct_ptr2]] Function +; CHECK: OpLoad [[struct2]] [[newvar]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %struct1 = OpTypeStruct %5 + %struct2 = OpTypeStruct %5 + %6 = OpTypePointer Private %struct2 + %func_ptr2 = OpTypePointer Function %struct1 + %8 = OpVariable %6 Private + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %struct2 %8 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/propagator_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/propagator_test.cpp new file mode 100644 index 00000000000..fb8e487cc71 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/propagator_test.cpp @@ -0,0 +1,219 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/cfg.h" +#include "source/opt/ir_context.h" +#include "source/opt/pass.h" +#include "source/opt/propagator.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; + +class PropagatorTest : public testing::Test { + protected: + virtual void TearDown() { + ctx_.reset(nullptr); + values_.clear(); + values_vec_.clear(); + } + + void Assemble(const std::string& input) { + ctx_ = BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, input); + ASSERT_NE(nullptr, ctx_) << "Assembling failed for shader:\n" + << input << "\n"; + } + + bool Propagate(const SSAPropagator::VisitFunction& visit_fn) { + SSAPropagator propagator(ctx_.get(), visit_fn); + bool retval = false; + for (auto& fn : *ctx_->module()) { + retval |= propagator.Run(&fn); + } + return retval; + } + + const std::vector& GetValues() { + values_vec_.clear(); + for (const auto& it : values_) { + values_vec_.push_back(it.second); + } + return values_vec_; + } + + std::unique_ptr ctx_; + std::map values_; + std::vector values_vec_; +}; + +TEST_F(PropagatorTest, LocalPropagate) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %x "x" + OpName %y "y" + OpName %z "z" + OpName %outparm "outparm" + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %5 = OpLabel + %x = OpVariable %_ptr_Function_int Function + %y = OpVariable %_ptr_Function_int Function + %z = OpVariable %_ptr_Function_int Function + OpStore %x %int_4 + OpStore %y %int_3 + OpStore %z %int_1 + %20 = OpLoad %int %z + OpStore %outparm %20 + OpReturn + OpFunctionEnd + )"; + Assemble(spv_asm); + + const auto visit_fn = [this](Instruction* instr, BasicBlock** dest_bb) { + *dest_bb = nullptr; + if (instr->opcode() == SpvOpStore) { + uint32_t lhs_id = instr->GetSingleWordOperand(0); + uint32_t rhs_id = instr->GetSingleWordOperand(1); + Instruction* rhs_def = ctx_->get_def_use_mgr()->GetDef(rhs_id); + if (rhs_def->opcode() == SpvOpConstant) { + uint32_t val = rhs_def->GetSingleWordOperand(2); + values_[lhs_id] = val; + return SSAPropagator::kInteresting; + } + } + return SSAPropagator::kVarying; + }; + + EXPECT_TRUE(Propagate(visit_fn)); + EXPECT_THAT(GetValues(), UnorderedElementsAre(4, 3, 1)); +} + +TEST_F(PropagatorTest, PropagateThroughPhis) { + const std::string spv_asm = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %x %outparm + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpName %main "main" + OpName %x "x" + OpName %outparm "outparm" + OpDecorate %x Flat + OpDecorate %x Location 0 + OpDecorate %outparm Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %bool = OpTypeBool +%_ptr_Function_int = OpTypePointer Function %int + %int_4 = OpConstant %int 4 + %int_3 = OpConstant %int 3 + %int_1 = OpConstant %int 1 +%_ptr_Input_int = OpTypePointer Input %int + %x = OpVariable %_ptr_Input_int Input +%_ptr_Output_int = OpTypePointer Output %int + %outparm = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %3 + %4 = OpLabel + %5 = OpLoad %int %x + %6 = OpSGreaterThan %bool %5 %int_3 + OpSelectionMerge %25 None + OpBranchConditional %6 %22 %23 + %22 = OpLabel + %7 = OpLoad %int %int_4 + OpBranch %25 + %23 = OpLabel + %8 = OpLoad %int %int_4 + OpBranch %25 + %25 = OpLabel + %35 = OpPhi %int %7 %22 %8 %23 + OpStore %outparm %35 + OpReturn + OpFunctionEnd + )"; + + Assemble(spv_asm); + + Instruction* phi_instr = nullptr; + const auto visit_fn = [this, &phi_instr](Instruction* instr, + BasicBlock** dest_bb) { + *dest_bb = nullptr; + if (instr->opcode() == SpvOpLoad) { + uint32_t rhs_id = instr->GetSingleWordOperand(2); + Instruction* rhs_def = ctx_->get_def_use_mgr()->GetDef(rhs_id); + if (rhs_def->opcode() == SpvOpConstant) { + uint32_t val = rhs_def->GetSingleWordOperand(2); + values_[instr->result_id()] = val; + return SSAPropagator::kInteresting; + } + } else if (instr->opcode() == SpvOpPhi) { + phi_instr = instr; + SSAPropagator::PropStatus retval; + for (uint32_t i = 2; i < instr->NumOperands(); i += 2) { + uint32_t phi_arg_id = instr->GetSingleWordOperand(i); + auto it = values_.find(phi_arg_id); + if (it != values_.end()) { + EXPECT_EQ(it->second, 4u); + retval = SSAPropagator::kInteresting; + values_[instr->result_id()] = it->second; + } else { + retval = SSAPropagator::kNotInteresting; + break; + } + } + return retval; + } + + return SSAPropagator::kVarying; + }; + + EXPECT_TRUE(Propagate(visit_fn)); + + // The propagator should've concluded that the Phi instruction has a constant + // value of 4. + EXPECT_NE(phi_instr, nullptr); + EXPECT_EQ(values_[phi_instr->result_id()], 4u); + + EXPECT_THAT(GetValues(), UnorderedElementsAre(4u, 4u, 4u)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/reduce_load_size_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/reduce_load_size_test.cpp new file mode 100644 index 00000000000..1d367e101bf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/reduce_load_size_test.cpp @@ -0,0 +1,328 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ReduceLoadSizeTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(ReduceLoadSizeTest, cbuffer_load_extract) { + // Originally from the following HLSL: + // struct S { + // uint f; + // }; + // + // + // cbuffer gBuffer { uint a[32]; }; + // + // RWStructuredBuffer gRWSBuffer; + // + // uint foo(uint p[32]) { + // return p[1]; + // } + // + // [numthreads(1,1,1)] + // void main() { + // gRWSBuffer[0].f = foo(a); + // } + const std::string test = + R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource HLSL 600 + OpName %type_gBuffer "type.gBuffer" + OpMemberName %type_gBuffer 0 "a" + OpName %gBuffer "gBuffer" + OpName %S "S" + OpMemberName %S 0 "f" + OpName %type_RWStructuredBuffer_S "type.RWStructuredBuffer.S" + OpName %gRWSBuffer "gRWSBuffer" + OpName %main "main" + OpDecorate %_arr_uint_uint_32 ArrayStride 16 + OpMemberDecorate %type_gBuffer 0 Offset 0 + OpDecorate %type_gBuffer Block + OpMemberDecorate %S 0 Offset 0 + OpDecorate %_runtimearr_S ArrayStride 4 + OpMemberDecorate %type_RWStructuredBuffer_S 0 Offset 0 + OpDecorate %type_RWStructuredBuffer_S BufferBlock + OpDecorate %gBuffer DescriptorSet 0 + OpDecorate %gBuffer Binding 0 + OpDecorate %gRWSBuffer DescriptorSet 0 + OpDecorate %gRWSBuffer Binding 1 + %uint = OpTypeInt 32 0 + %uint_32 = OpConstant %uint 32 +%_arr_uint_uint_32 = OpTypeArray %uint %uint_32 +%type_gBuffer = OpTypeStruct %_arr_uint_uint_32 +%_ptr_Uniform_type_gBuffer = OpTypePointer Uniform %type_gBuffer + %S = OpTypeStruct %uint +%_runtimearr_S = OpTypeRuntimeArray %S +%type_RWStructuredBuffer_S = OpTypeStruct %_runtimearr_S +%_ptr_Uniform_type_RWStructuredBuffer_S = OpTypePointer Uniform %type_RWStructuredBuffer_S + %int = OpTypeInt 32 1 + %void = OpTypeVoid + %15 = OpTypeFunction %void + %int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_uint_uint_32 = OpTypePointer Uniform %_arr_uint_uint_32 + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint + %gBuffer = OpVariable %_ptr_Uniform_type_gBuffer Uniform + %gRWSBuffer = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_S Uniform + %main = OpFunction %void None %15 + %20 = OpLabel +; CHECK: [[ac1:%\w+]] = OpAccessChain {{%\w+}} %gBuffer %int_0 +; CHECK: [[ac2:%\w+]] = OpAccessChain {{%\w+}} [[ac1]] %uint_1 +; CHECK: [[ld:%\w+]] = OpLoad {{%\w+}} [[ac2]] +; CHECK: OpStore {{%\w+}} [[ld]] + %21 = OpAccessChain %_ptr_Uniform__arr_uint_uint_32 %gBuffer %int_0 + %22 = OpLoad %_arr_uint_uint_32 %21 ; Load of 32-element array. + %23 = OpCompositeExtract %uint %22 1 + %24 = OpAccessChain %_ptr_Uniform_uint %gRWSBuffer %int_0 %uint_0 %int_0 + OpStore %24 %23 + OpReturn + OpFunctionEnd + )"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndMatch(test, false); +} +#endif + +TEST_F(ReduceLoadSizeTest, cbuffer_load_extract_vector) { + // Originally from the following HLSL: + // struct S { + // uint f; + // }; + // + // + // cbuffer gBuffer { uint4 a; }; + // + // RWStructuredBuffer gRWSBuffer; + // + // uint foo(uint p[32]) { + // return p[1]; + // } + // + // [numthreads(1,1,1)] + // void main() { + // gRWSBuffer[0].f = foo(a); + // } + const std::string test = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpSource HLSL 600 +OpName %type_gBuffer "type.gBuffer" +OpMemberName %type_gBuffer 0 "a" +OpName %gBuffer "gBuffer" +OpName %S "S" +OpMemberName %S 0 "f" +OpName %type_RWStructuredBuffer_S "type.RWStructuredBuffer.S" +OpName %gRWSBuffer "gRWSBuffer" +OpName %main "main" +OpMemberDecorate %type_gBuffer 0 Offset 0 +OpDecorate %type_gBuffer Block +OpMemberDecorate %S 0 Offset 0 +OpDecorate %_runtimearr_S ArrayStride 4 +OpMemberDecorate %type_RWStructuredBuffer_S 0 Offset 0 +OpDecorate %type_RWStructuredBuffer_S BufferBlock +OpDecorate %gBuffer DescriptorSet 0 +OpDecorate %gBuffer Binding 0 +OpDecorate %gRWSBuffer DescriptorSet 0 +OpDecorate %gRWSBuffer Binding 1 +%uint = OpTypeInt 32 0 +%uint_32 = OpConstant %uint 32 +%v4uint = OpTypeVector %uint 4 +%type_gBuffer = OpTypeStruct %v4uint +%_ptr_Uniform_type_gBuffer = OpTypePointer Uniform %type_gBuffer +%S = OpTypeStruct %uint +%_runtimearr_S = OpTypeRuntimeArray %S +%type_RWStructuredBuffer_S = OpTypeStruct %_runtimearr_S +%_ptr_Uniform_type_RWStructuredBuffer_S = OpTypePointer Uniform %type_RWStructuredBuffer_S +%int = OpTypeInt 32 1 +%void = OpTypeVoid +%15 = OpTypeFunction %void +%int_0 = OpConstant %int 0 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%gBuffer = OpVariable %_ptr_Uniform_type_gBuffer Uniform +%gRWSBuffer = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_S Uniform +%main = OpFunction %void None %15 +%20 = OpLabel +%21 = OpAccessChain %_ptr_Uniform_v4uint %gBuffer %int_0 +%22 = OpLoad %v4uint %21 +%23 = OpCompositeExtract %uint %22 1 +%24 = OpAccessChain %_ptr_Uniform_uint %gRWSBuffer %int_0 %uint_0 %int_0 +OpStore %24 %23 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndCheck(test, test, true, false); +} + +TEST_F(ReduceLoadSizeTest, cbuffer_load_5_extract) { + // All of the elements of the value loaded are used, so we should not + // change the load. + const std::string test = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpSource HLSL 600 +OpName %type_gBuffer "type.gBuffer" +OpMemberName %type_gBuffer 0 "a" +OpName %gBuffer "gBuffer" +OpName %S "S" +OpMemberName %S 0 "f" +OpName %type_RWStructuredBuffer_S "type.RWStructuredBuffer.S" +OpName %gRWSBuffer "gRWSBuffer" +OpName %main "main" +OpDecorate %_arr_uint_uint_5 ArrayStride 16 +OpMemberDecorate %type_gBuffer 0 Offset 0 +OpDecorate %type_gBuffer Block +OpMemberDecorate %S 0 Offset 0 +OpDecorate %_runtimearr_S ArrayStride 4 +OpMemberDecorate %type_RWStructuredBuffer_S 0 Offset 0 +OpDecorate %type_RWStructuredBuffer_S BufferBlock +OpDecorate %gBuffer DescriptorSet 0 +OpDecorate %gBuffer Binding 0 +OpDecorate %gRWSBuffer DescriptorSet 0 +OpDecorate %gRWSBuffer Binding 1 +%uint = OpTypeInt 32 0 +%uint_5 = OpConstant %uint 5 +%_arr_uint_uint_5 = OpTypeArray %uint %uint_5 +%type_gBuffer = OpTypeStruct %_arr_uint_uint_5 +%_ptr_Uniform_type_gBuffer = OpTypePointer Uniform %type_gBuffer +%S = OpTypeStruct %uint +%_runtimearr_S = OpTypeRuntimeArray %S +%type_RWStructuredBuffer_S = OpTypeStruct %_runtimearr_S +%_ptr_Uniform_type_RWStructuredBuffer_S = OpTypePointer Uniform %type_RWStructuredBuffer_S +%int = OpTypeInt 32 1 +%void = OpTypeVoid +%15 = OpTypeFunction %void +%int_0 = OpConstant %int 0 +%_ptr_Uniform__arr_uint_uint_5 = OpTypePointer Uniform %_arr_uint_uint_5 +%uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%gBuffer = OpVariable %_ptr_Uniform_type_gBuffer Uniform +%gRWSBuffer = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_S Uniform +%main = OpFunction %void None %15 +%20 = OpLabel +%21 = OpAccessChain %_ptr_Uniform__arr_uint_uint_5 %gBuffer %int_0 +%22 = OpLoad %_arr_uint_uint_5 %21 +%23 = OpCompositeExtract %uint %22 0 +%24 = OpCompositeExtract %uint %22 1 +%25 = OpCompositeExtract %uint %22 2 +%26 = OpCompositeExtract %uint %22 3 +%27 = OpCompositeExtract %uint %22 4 +%28 = OpIAdd %uint %23 %24 +%29 = OpIAdd %uint %28 %25 +%30 = OpIAdd %uint %29 %26 +%31 = OpIAdd %uint %20 %27 +%32 = OpAccessChain %_ptr_Uniform_uint %gRWSBuffer %int_0 %uint_0 %int_0 +OpStore %32 %31 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndCheck(test, test, true, false); +} + +TEST_F(ReduceLoadSizeTest, cbuffer_load_fully_used) { + // The result of the load (%22) is used in an instruction that uses the whole + // load and has only 1 in operand. This trigger issue #1559. + const std::string test = + R"(OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" +OpExecutionMode %main LocalSize 1 1 1 +OpSource HLSL 600 +OpName %type_gBuffer "type.gBuffer" +OpMemberName %type_gBuffer 0 "a" +OpName %gBuffer "gBuffer" +OpName %S "S" +OpMemberName %S 0 "f" +OpName %type_RWStructuredBuffer_S "type.RWStructuredBuffer.S" +OpName %gRWSBuffer "gRWSBuffer" +OpName %main "main" +OpMemberDecorate %type_gBuffer 0 Offset 0 +OpDecorate %type_gBuffer Block +OpMemberDecorate %S 0 Offset 0 +OpDecorate %_runtimearr_S ArrayStride 4 +OpMemberDecorate %type_RWStructuredBuffer_S 0 Offset 0 +OpDecorate %type_RWStructuredBuffer_S BufferBlock +OpDecorate %gBuffer DescriptorSet 0 +OpDecorate %gBuffer Binding 0 +OpDecorate %gRWSBuffer DescriptorSet 0 +OpDecorate %gRWSBuffer Binding 1 +%uint = OpTypeInt 32 0 +%uint_32 = OpConstant %uint 32 +%v4uint = OpTypeVector %uint 4 +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%type_gBuffer = OpTypeStruct %v4uint +%_ptr_Uniform_type_gBuffer = OpTypePointer Uniform %type_gBuffer +%S = OpTypeStruct %uint +%_runtimearr_S = OpTypeRuntimeArray %S +%type_RWStructuredBuffer_S = OpTypeStruct %_runtimearr_S +%_ptr_Uniform_type_RWStructuredBuffer_S = OpTypePointer Uniform %type_RWStructuredBuffer_S +%int = OpTypeInt 32 1 +%void = OpTypeVoid +%15 = OpTypeFunction %void +%int_0 = OpConstant %int 0 +%_ptr_Uniform_v4uint = OpTypePointer Uniform %v4uint +%uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%gBuffer = OpVariable %_ptr_Uniform_type_gBuffer Uniform +%gRWSBuffer = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_S Uniform +%main = OpFunction %void None %15 +%20 = OpLabel +%21 = OpAccessChain %_ptr_Uniform_v4uint %gBuffer %int_0 +%22 = OpLoad %v4uint %21 +%23 = OpCompositeExtract %uint %22 1 +%24 = OpConvertUToF %v4float %22 +%25 = OpAccessChain %_ptr_Uniform_uint %gRWSBuffer %int_0 %uint_0 %int_0 +OpStore %25 %23 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SetDisassembleOptions(SPV_BINARY_TO_TEXT_OPTION_NO_HEADER | + SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); + SinglePassRunAndCheck(test, test, true, false); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/redundancy_elimination_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/redundancy_elimination_test.cpp new file mode 100644 index 00000000000..a6e8c4f28ab --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/redundancy_elimination_test.cpp @@ -0,0 +1,280 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; +using RedundancyEliminationTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +// Test that it can get a simple case of local redundancy elimination. +// The rest of the test check for extra functionality. +TEST_F(RedundancyEliminationTest, RemoveRedundantLocalAdd) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 +; CHECK: OpFAdd +; CHECK-NOT: OpFAdd + %11 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +// Remove a redundant add across basic blocks. +TEST_F(RedundancyEliminationTest, RemoveRedundantAdd) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 + OpBranch %11 + %11 = OpLabel +; CHECK: OpFAdd +; CHECK-NOT: OpFAdd + %12 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + SinglePassRunAndMatch(text, false); +} + +// Remove a redundant add going through a multiple basic blocks. +TEST_F(RedundancyEliminationTest, RemoveRedundantAddDiamond) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpVariable %6 Function + %11 = OpLoad %5 %10 + %12 = OpFAdd %5 %11 %11 +; CHECK: OpFAdd +; CHECK-NOT: OpFAdd + OpBranchConditional %8 %13 %14 + %13 = OpLabel + OpBranch %15 + %14 = OpLabel + OpBranch %15 + %15 = OpLabel + %16 = OpFAdd %5 %11 %11 + OpReturn + OpFunctionEnd + + )"; + SinglePassRunAndMatch(text, false); +} + +// Remove a redundant add in a side node. +TEST_F(RedundancyEliminationTest, RemoveRedundantAddInSideNode) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpVariable %6 Function + %11 = OpLoad %5 %10 + %12 = OpFAdd %5 %11 %11 +; CHECK: OpFAdd +; CHECK-NOT: OpFAdd + OpBranchConditional %8 %13 %14 + %13 = OpLabel + OpBranch %15 + %14 = OpLabel + %16 = OpFAdd %5 %11 %11 + OpBranch %15 + %15 = OpLabel + OpReturn + OpFunctionEnd + + )"; + SinglePassRunAndMatch(text, false); +} + +// Remove a redundant add whose value is in the result of a phi node. +TEST_F(RedundancyEliminationTest, RemoveRedundantAddWithPhi) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpVariable %6 Function + %11 = OpLoad %5 %10 + OpBranchConditional %8 %13 %14 + %13 = OpLabel + %add1 = OpFAdd %5 %11 %11 +; CHECK: OpFAdd + OpBranch %15 + %14 = OpLabel + %add2 = OpFAdd %5 %11 %11 +; CHECK: OpFAdd + OpBranch %15 + %15 = OpLabel +; CHECK: OpPhi + %phi = OpPhi %5 %add1 %13 %add2 %14 +; CHECK-NOT: OpFAdd + %16 = OpFAdd %5 %11 %11 + OpReturn + OpFunctionEnd + + )"; + SinglePassRunAndMatch(text, false); +} + +// Keep the add because it is redundant on some paths, but not all paths. +TEST_F(RedundancyEliminationTest, KeepPartiallyRedundantAdd) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpVariable %6 Function + %11 = OpLoad %5 %10 + OpBranchConditional %8 %13 %14 + %13 = OpLabel + %add = OpFAdd %5 %11 %11 + OpBranch %15 + %14 = OpLabel + OpBranch %15 + %15 = OpLabel + %16 = OpFAdd %5 %11 %11 + OpReturn + OpFunctionEnd + + )"; + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// Keep the add. Even if it is redundant on all paths, there is no single id +// whose definition dominates the add and contains the same value. +TEST_F(RedundancyEliminationTest, KeepRedundantAddWithoutPhi) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpVariable %6 Function + %11 = OpLoad %5 %10 + OpBranchConditional %8 %13 %14 + %13 = OpLabel + %add1 = OpFAdd %5 %11 %11 + OpBranch %15 + %14 = OpLabel + %add2 = OpFAdd %5 %11 %11 + OpBranch %15 + %15 = OpLabel + %16 = OpFAdd %5 %11 %11 + OpReturn + OpFunctionEnd + + )"; + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/register_liveness.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/register_liveness.cpp new file mode 100644 index 00000000000..cb973d2e6bd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/register_liveness.cpp @@ -0,0 +1,1282 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/register_pressure.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using PassClassTest = PassTest<::testing::Test>; + +void CompareSets(const std::unordered_set& computed, + const std::unordered_set& expected) { + for (Instruction* insn : computed) { + EXPECT_TRUE(expected.count(insn->result_id())) + << "Unexpected instruction in live set: " << *insn; + } + EXPECT_EQ(computed.size(), expected.size()); +} + +/* +Generated from the following GLSL + +#version 330 +in vec4 BaseColor; +flat in int Count; +void main() +{ + vec4 color = BaseColor; + vec4 acc; + if (Count == 0) { + acc = color; + } + else { + acc = color + vec4(0,1,2,0); + } + gl_FragColor = acc + color; +} +*/ +TEST_F(PassClassTest, LivenessWithIf) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 %15 %32 + OpExecutionMode %4 OriginLowerLeft + OpSource GLSL 330 + OpName %4 "main" + OpName %11 "BaseColor" + OpName %15 "Count" + OpName %32 "gl_FragColor" + OpDecorate %11 Location 0 + OpDecorate %15 Flat + OpDecorate %15 Location 0 + OpDecorate %32 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %13 = OpTypeInt 32 1 + %14 = OpTypePointer Input %13 + %15 = OpVariable %14 Input + %17 = OpConstant %13 0 + %18 = OpTypeBool + %26 = OpConstant %6 0 + %27 = OpConstant %6 1 + %28 = OpConstant %6 2 + %29 = OpConstantComposite %7 %26 %27 %28 %26 + %31 = OpTypePointer Output %7 + %32 = OpVariable %31 Output + %4 = OpFunction %2 None %3 + %5 = OpLabel + %12 = OpLoad %7 %11 + %16 = OpLoad %13 %15 + %19 = OpIEqual %18 %16 %17 + OpSelectionMerge %21 None + OpBranchConditional %19 %20 %24 + %20 = OpLabel + OpBranch %21 + %24 = OpLabel + %30 = OpFAdd %7 %12 %29 + OpBranch %21 + %21 = OpLabel + %36 = OpPhi %7 %12 %20 %30 %24 + %35 = OpFAdd %7 %36 %12 + OpStore %32 %35 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function* f = &*module->begin(); + LivenessAnalysis* liveness_analysis = context->GetLivenessAnalysis(); + const RegisterLiveness* register_liveness = liveness_analysis->Get(f); + { + SCOPED_TRACE("Block 5"); + auto live_sets = register_liveness->Get(5); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 15, // %15 = OpVariable %14 Input + 32, // %32 = OpVariable %31 Output + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 12, // %12 = OpLoad %7 %11 + 32, // %32 = OpVariable %31 Output + }; + CompareSets(live_sets->live_out_, live_out); + } + { + SCOPED_TRACE("Block 20"); + auto live_sets = register_liveness->Get(20); + std::unordered_set live_inout{ + 12, // %12 = OpLoad %7 %11 + 32, // %32 = OpVariable %31 Output + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + } + { + SCOPED_TRACE("Block 24"); + auto live_sets = register_liveness->Get(24); + std::unordered_set live_in{ + 12, // %12 = OpLoad %7 %11 + 32, // %32 = OpVariable %31 Output + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 12, // %12 = OpLoad %7 %11 + 30, // %30 = OpFAdd %7 %12 %29 + 32, // %32 = OpVariable %31 Output + }; + CompareSets(live_sets->live_out_, live_out); + } + { + SCOPED_TRACE("Block 21"); + auto live_sets = register_liveness->Get(21); + std::unordered_set live_in{ + 12, // %12 = OpLoad %7 %11 + 32, // %32 = OpVariable %31 Output + 36, // %36 = OpPhi %7 %12 %20 %30 %24 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{}; + CompareSets(live_sets->live_out_, live_out); + } +} + +/* +Generated from the following GLSL +#version 330 +in vec4 bigColor; +in vec4 BaseColor; +in float f; +flat in int Count; +flat in uvec4 v4; +void main() +{ + vec4 color = BaseColor; + for (int i = 0; i < Count; ++i) + color += bigColor; + float sum = 0.0; + for (int i = 0; i < 4; ++i) { + float acc = 0.0; + if (sum == 0.0) { + acc = v4[i]; + } + else { + acc = BaseColor[i]; + } + sum += acc + v4[i]; + } + vec4 tv4; + for (int i = 0; i < 4; ++i) + tv4[i] = v4[i] * 4u; + color += vec4(sum) + tv4; + vec4 r; + r.xyz = BaseColor.xyz; + for (int i = 0; i < Count; ++i) + r.w = f; + color.xyz += r.xyz; + for (int i = 0; i < 16; i += 4) + for (int j = 0; j < 4; j++) + color *= f; + gl_FragColor = color + tv4; +} +*/ +TEST_F(PassClassTest, RegisterLiveness) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %11 %24 %28 %55 %124 %176 + OpExecutionMode %4 OriginLowerLeft + OpSource GLSL 330 + OpName %4 "main" + OpName %11 "BaseColor" + OpName %24 "Count" + OpName %28 "bigColor" + OpName %55 "v4" + OpName %84 "tv4" + OpName %124 "f" + OpName %176 "gl_FragColor" + OpDecorate %11 Location 0 + OpDecorate %24 Flat + OpDecorate %24 Location 0 + OpDecorate %28 Location 0 + OpDecorate %55 Flat + OpDecorate %55 Location 0 + OpDecorate %124 Location 0 + OpDecorate %176 Location 0 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypeVector %6 4 + %8 = OpTypePointer Function %7 + %10 = OpTypePointer Input %7 + %11 = OpVariable %10 Input + %13 = OpTypeInt 32 1 + %16 = OpConstant %13 0 + %23 = OpTypePointer Input %13 + %24 = OpVariable %23 Input + %26 = OpTypeBool + %28 = OpVariable %10 Input + %33 = OpConstant %13 1 + %35 = OpTypePointer Function %6 + %37 = OpConstant %6 0 + %45 = OpConstant %13 4 + %52 = OpTypeInt 32 0 + %53 = OpTypeVector %52 4 + %54 = OpTypePointer Input %53 + %55 = OpVariable %54 Input + %57 = OpTypePointer Input %52 + %63 = OpTypePointer Input %6 + %89 = OpConstant %52 4 + %102 = OpTypeVector %6 3 + %124 = OpVariable %63 Input + %158 = OpConstant %13 16 + %175 = OpTypePointer Output %7 + %176 = OpVariable %175 Output + %195 = OpUndef %7 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %84 = OpVariable %8 Function + %12 = OpLoad %7 %11 + OpBranch %17 + %17 = OpLabel + %191 = OpPhi %7 %12 %5 %31 %18 + %184 = OpPhi %13 %16 %5 %34 %18 + %25 = OpLoad %13 %24 + %27 = OpSLessThan %26 %184 %25 + OpLoopMerge %19 %18 None + OpBranchConditional %27 %18 %19 + %18 = OpLabel + %29 = OpLoad %7 %28 + %31 = OpFAdd %7 %191 %29 + %34 = OpIAdd %13 %184 %33 + OpBranch %17 + %19 = OpLabel + OpBranch %39 + %39 = OpLabel + %188 = OpPhi %6 %37 %19 %73 %51 + %185 = OpPhi %13 %16 %19 %75 %51 + %46 = OpSLessThan %26 %185 %45 + OpLoopMerge %41 %51 None + OpBranchConditional %46 %40 %41 + %40 = OpLabel + %49 = OpFOrdEqual %26 %188 %37 + OpSelectionMerge %51 None + OpBranchConditional %49 %50 %61 + %50 = OpLabel + %58 = OpAccessChain %57 %55 %185 + %59 = OpLoad %52 %58 + %60 = OpConvertUToF %6 %59 + OpBranch %51 + %61 = OpLabel + %64 = OpAccessChain %63 %11 %185 + %65 = OpLoad %6 %64 + OpBranch %51 + %51 = OpLabel + %210 = OpPhi %6 %60 %50 %65 %61 + %68 = OpAccessChain %57 %55 %185 + %69 = OpLoad %52 %68 + %70 = OpConvertUToF %6 %69 + %71 = OpFAdd %6 %210 %70 + %73 = OpFAdd %6 %188 %71 + %75 = OpIAdd %13 %185 %33 + OpBranch %39 + %41 = OpLabel + OpBranch %77 + %77 = OpLabel + %186 = OpPhi %13 %16 %41 %94 %78 + %83 = OpSLessThan %26 %186 %45 + OpLoopMerge %79 %78 None + OpBranchConditional %83 %78 %79 + %78 = OpLabel + %87 = OpAccessChain %57 %55 %186 + %88 = OpLoad %52 %87 + %90 = OpIMul %52 %88 %89 + %91 = OpConvertUToF %6 %90 + %92 = OpAccessChain %35 %84 %186 + OpStore %92 %91 + %94 = OpIAdd %13 %186 %33 + OpBranch %77 + %79 = OpLabel + %96 = OpCompositeConstruct %7 %188 %188 %188 %188 + %97 = OpLoad %7 %84 + %98 = OpFAdd %7 %96 %97 + %100 = OpFAdd %7 %191 %98 + %104 = OpVectorShuffle %102 %12 %12 0 1 2 + %106 = OpVectorShuffle %7 %195 %104 4 5 6 3 + OpBranch %108 + %108 = OpLabel + %197 = OpPhi %7 %106 %79 %208 %133 + %196 = OpPhi %13 %16 %79 %143 %133 + %115 = OpSLessThan %26 %196 %25 + OpLoopMerge %110 %133 None + OpBranchConditional %115 %109 %110 + %109 = OpLabel + OpBranch %117 + %117 = OpLabel + %209 = OpPhi %7 %197 %109 %181 %118 + %204 = OpPhi %13 %16 %109 %129 %118 + %123 = OpSLessThan %26 %204 %45 + OpLoopMerge %119 %118 None + OpBranchConditional %123 %118 %119 + %118 = OpLabel + %125 = OpLoad %6 %124 + %181 = OpCompositeInsert %7 %125 %209 3 + %129 = OpIAdd %13 %204 %33 + OpBranch %117 + %119 = OpLabel + OpBranch %131 + %131 = OpLabel + %208 = OpPhi %7 %209 %119 %183 %132 + %205 = OpPhi %13 %16 %119 %141 %132 + %137 = OpSLessThan %26 %205 %45 + OpLoopMerge %133 %132 None + OpBranchConditional %137 %132 %133 + %132 = OpLabel + %138 = OpLoad %6 %124 + %183 = OpCompositeInsert %7 %138 %208 3 + %141 = OpIAdd %13 %205 %33 + OpBranch %131 + %133 = OpLabel + %143 = OpIAdd %13 %196 %33 + OpBranch %108 + %110 = OpLabel + %145 = OpVectorShuffle %102 %197 %197 0 1 2 + %147 = OpVectorShuffle %102 %100 %100 0 1 2 + %148 = OpFAdd %102 %147 %145 + %150 = OpVectorShuffle %7 %100 %148 4 5 6 3 + OpBranch %152 + %152 = OpLabel + %200 = OpPhi %7 %150 %110 %203 %163 + %199 = OpPhi %13 %16 %110 %174 %163 + %159 = OpSLessThan %26 %199 %158 + OpLoopMerge %154 %163 None + OpBranchConditional %159 %153 %154 + %153 = OpLabel + OpBranch %161 + %161 = OpLabel + %203 = OpPhi %7 %200 %153 %170 %162 + %201 = OpPhi %13 %16 %153 %172 %162 + %167 = OpSLessThan %26 %201 %45 + OpLoopMerge %163 %162 None + OpBranchConditional %167 %162 %163 + %162 = OpLabel + %168 = OpLoad %6 %124 + %170 = OpVectorTimesScalar %7 %203 %168 + %172 = OpIAdd %13 %201 %33 + OpBranch %161 + %163 = OpLabel + %174 = OpIAdd %13 %199 %45 + OpBranch %152 + %154 = OpLabel + %178 = OpLoad %7 %84 + %179 = OpFAdd %7 %200 %178 + OpStore %176 %179 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + Function* f = &*module->begin(); + LivenessAnalysis* liveness_analysis = context->GetLivenessAnalysis(); + const RegisterLiveness* register_liveness = liveness_analysis->Get(f); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + + { + SCOPED_TRACE("Block 5"); + auto live_sets = register_liveness->Get(5); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 24, // %24 = OpVariable %23 Input + 28, // %28 = OpVariable %10 Input + 55, // %55 = OpVariable %54 Input + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 24, // %24 = OpVariable %23 Input + 28, // %28 = OpVariable %10 Input + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 8u); + } + { + SCOPED_TRACE("Block 17"); + auto live_sets = register_liveness->Get(17); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 24, // %24 = OpVariable %23 Input + 28, // %28 = OpVariable %10 Input + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 184, // %184 = OpPhi %13 %16 %5 %34 %18 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 28, // %28 = OpVariable %10 Input + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 184, // %184 = OpPhi %13 %16 %5 %34 %18 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 11u); + } + { + SCOPED_TRACE("Block 18"); + auto live_sets = register_liveness->Get(18); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 24, // %24 = OpVariable %23 Input + 28, // %28 = OpVariable %10 Input + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 184, // %184 = OpPhi %13 %16 %5 %34 %18 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 24, // %24 = OpVariable %23 Input + 28, // %28 = OpVariable %10 Input + 31, // %31 = OpFAdd %7 %191 %29 + 34, // %34 = OpIAdd %13 %184 %33 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 12u); + } + { + SCOPED_TRACE("Block 19"); + auto live_sets = register_liveness->Get(19); + std::unordered_set live_inout{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 8u); + } + { + SCOPED_TRACE("Block 39"); + auto live_sets = register_liveness->Get(39); + std::unordered_set live_inout{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 11u); + } + { + SCOPED_TRACE("Block 40"); + auto live_sets = register_liveness->Get(40); + std::unordered_set live_inout{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 11u); + } + { + SCOPED_TRACE("Block 50"); + auto live_sets = register_liveness->Get(50); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 60, // %60 = OpConvertUToF %6 %59 + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 12u); + } + { + SCOPED_TRACE("Block 61"); + auto live_sets = register_liveness->Get(61); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 65, // %65 = OpLoad %6 %64 + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 12u); + } + { + SCOPED_TRACE("Block 51"); + auto live_sets = register_liveness->Get(51); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + 210, // %210 = OpPhi %6 %60 %50 %65 %61 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 73, // %73 = OpFAdd %6 %188 %71 + 75, // %75 = OpIAdd %13 %185 %33 + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 13u); + } + { + SCOPED_TRACE("Block 41"); + auto live_sets = register_liveness->Get(41); + std::unordered_set live_inout{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 8u); + } + { + SCOPED_TRACE("Block 77"); + auto live_sets = register_liveness->Get(77); + std::unordered_set live_inout{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 186, // %186 = OpPhi %13 %16 %41 %94 %78 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 10u); + } + { + SCOPED_TRACE("Block 78"); + auto live_sets = register_liveness->Get(78); + std::unordered_set live_in{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 186, // %186 = OpPhi %13 %16 %41 %94 %78 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 94, // %94 = OpIAdd %13 %186 %33 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 11u); + } + { + SCOPED_TRACE("Block 79"); + auto live_sets = register_liveness->Get(79); + std::unordered_set live_in{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 106, // %106 = OpVectorShuffle %7 %195 %104 4 5 6 3 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 9u); + } + { + SCOPED_TRACE("Block 108"); + auto live_sets = register_liveness->Get(108); + std::unordered_set live_in{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 197, // %197 = OpPhi %7 %106 %79 %208 %133 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 197, // %197 = OpPhi %7 %106 %79 %208 %133 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 8u); + } + { + SCOPED_TRACE("Block 109"); + auto live_sets = register_liveness->Get(109); + std::unordered_set live_inout{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 197, // %197 = OpPhi %7 %106 %79 %208 %133 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 7u); + } + { + SCOPED_TRACE("Block 117"); + auto live_sets = register_liveness->Get(117); + std::unordered_set live_inout{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 204, // %204 = OpPhi %13 %16 %109 %129 %118 + 209, // %209 = OpPhi %7 %197 %109 %181 %118 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 9u); + } + { + SCOPED_TRACE("Block 118"); + auto live_sets = register_liveness->Get(118); + std::unordered_set live_in{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 204, // %204 = OpPhi %13 %16 %109 %129 %118 + 209, // %209 = OpPhi %7 %197 %109 %181 %118 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 129, // %129 = OpIAdd %13 %204 %33 + 176, // %176 = OpVariable %175 Output + 181, // %181 = OpCompositeInsert %7 %125 %209 3 + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 10u); + } + { + SCOPED_TRACE("Block 119"); + auto live_sets = register_liveness->Get(119); + std::unordered_set live_inout{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 209, // %209 = OpPhi %7 %197 %109 %181 %118 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 7u); + } + { + SCOPED_TRACE("Block 131"); + auto live_sets = register_liveness->Get(131); + std::unordered_set live_inout{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 205, // %205 = OpPhi %13 %16 %119 %141 %132 + 208, // %208 = OpPhi %7 %209 %119 %183 %132 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 9u); + } + { + SCOPED_TRACE("Block 132"); + auto live_sets = register_liveness->Get(132); + std::unordered_set live_in{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 205, // %205 = OpPhi %13 %16 %119 %141 %132 + 208, // %208 = OpPhi %7 %209 %119 %183 %132 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 141, // %141 = OpIAdd %13 %205 %33 + 176, // %176 = OpVariable %175 Output + 183, // %183 = OpCompositeInsert %7 %138 %208 3 + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 10u); + } + { + SCOPED_TRACE("Block 133"); + auto live_sets = register_liveness->Get(133); + std::unordered_set live_in{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 196, // %196 = OpPhi %13 %16 %79 %143 %133 + 208, // %208 = OpPhi %7 %209 %119 %183 %132 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 25, // %25 = OpLoad %13 %24 + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 143, // %143 = OpIAdd %13 %196 %33 + 176, // %176 = OpVariable %175 Output + 208, // %208 = OpPhi %7 %209 %119 %183 %132 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 8u); + } + { + SCOPED_TRACE("Block 110"); + auto live_sets = register_liveness->Get(110); + std::unordered_set live_in{ + 84, // %84 = OpVariable %8 Function + 100, // %100 = OpFAdd %7 %191 %98 + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 197, // %197 = OpPhi %7 %106 %79 %208 %133 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 150, // %150 = OpVectorShuffle %7 %100 %148 4 5 6 3 + 176, // %176 = OpVariable %175 Output + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 7u); + } + { + SCOPED_TRACE("Block 152"); + auto live_sets = register_liveness->Get(152); + std::unordered_set live_inout{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 199, // %199 = OpPhi %13 %16 %110 %174 %163 + 200, // %200 = OpPhi %7 %150 %110 %203 %163 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 6u); + } + { + SCOPED_TRACE("Block 153"); + auto live_sets = register_liveness->Get(153); + std::unordered_set live_inout{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 199, // %199 = OpPhi %13 %16 %110 %174 %163 + 200, // %200 = OpPhi %7 %150 %110 %203 %163 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 5u); + } + { + SCOPED_TRACE("Block 161"); + auto live_sets = register_liveness->Get(161); + std::unordered_set live_inout{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 199, // %199 = OpPhi %13 %16 %110 %174 %163 + 201, // %201 = OpPhi %13 %16 %153 %172 %162 + 203, // %203 = OpPhi %7 %200 %153 %170 %162 + }; + CompareSets(live_sets->live_in_, live_inout); + CompareSets(live_sets->live_out_, live_inout); + + EXPECT_EQ(live_sets->used_registers_, 7u); + } + { + SCOPED_TRACE("Block 162"); + auto live_sets = register_liveness->Get(162); + std::unordered_set live_in{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 199, // %199 = OpPhi %13 %16 %110 %174 %163 + 201, // %201 = OpPhi %13 %16 %153 %172 %162 + 203, // %203 = OpPhi %7 %200 %153 %170 %162 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 170, // %170 = OpVectorTimesScalar %7 %203 %168 + 172, // %172 = OpIAdd %13 %201 %33 + 176, // %176 = OpVariable %175 Output + 199, // %199 = OpPhi %13 %16 %110 %174 %163 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 8u); + } + { + SCOPED_TRACE("Block 163"); + auto live_sets = register_liveness->Get(163); + std::unordered_set live_in{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 199, // %199 = OpPhi %13 %16 %110 %174 %163 + 203, // %203 = OpPhi %7 %200 %153 %170 %162 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{ + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 174, // %174 = OpIAdd %13 %199 %45 + 176, // %176 = OpVariable %175 Output + 203, // %203 = OpPhi %7 %200 %153 %170 %162 + }; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 6u); + } + { + SCOPED_TRACE("Block 154"); + auto live_sets = register_liveness->Get(154); + std::unordered_set live_in{ + 84, // %84 = OpVariable %8 Function + 176, // %176 = OpVariable %175 Output + 200, // %200 = OpPhi %7 %150 %110 %203 %163 + }; + CompareSets(live_sets->live_in_, live_in); + + std::unordered_set live_out{}; + CompareSets(live_sets->live_out_, live_out); + + EXPECT_EQ(live_sets->used_registers_, 4u); + } + + { + SCOPED_TRACE("Compute loop pressure"); + RegisterLiveness::RegionRegisterLiveness loop_reg_pressure; + register_liveness->ComputeLoopRegisterPressure(*ld[39], &loop_reg_pressure); + // Generate(*context->cfg()->block(39), &loop_reg_pressure); + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(loop_reg_pressure.live_in_, live_in); + + std::unordered_set live_out{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(loop_reg_pressure.live_out_, live_out); + + EXPECT_EQ(loop_reg_pressure.used_registers_, 13u); + } + + { + SCOPED_TRACE("Loop Fusion simulation"); + RegisterLiveness::RegionRegisterLiveness simulation_resut; + register_liveness->SimulateFusion(*ld[17], *ld[39], &simulation_resut); + + std::unordered_set live_in{ + 11, // %11 = OpVariable %10 Input + 12, // %12 = OpLoad %7 %11 + 24, // %24 = OpVariable %23 Input + 25, // %25 = OpLoad %13 %24 + 28, // %28 = OpVariable %10 Input + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 184, // %184 = OpPhi %13 %16 %5 %34 %18 + 185, // %185 = OpPhi %13 %16 %19 %75 %51 + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(simulation_resut.live_in_, live_in); + + std::unordered_set live_out{ + 12, // %12 = OpLoad %7 %11 + 25, // %25 = OpLoad %13 %24 + 55, // %55 = OpVariable %54 Input + 84, // %84 = OpVariable %8 Function + 124, // %124 = OpVariable %63 Input + 176, // %176 = OpVariable %175 Output + 188, // %188 = OpPhi %6 %37 %19 %73 %51 + 191, // %191 = OpPhi %7 %12 %5 %31 %18 + }; + CompareSets(simulation_resut.live_out_, live_out); + + EXPECT_EQ(simulation_resut.used_registers_, 17u); + } +} + +TEST_F(PassClassTest, FissionSimulation) { + const std::string source = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "i" + OpName %4 "A" + OpName %5 "B" + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Function %16 + %18 = OpTypePointer Function %13 + %19 = OpConstant %8 1 + %2 = OpFunction %6 None %7 + %20 = OpLabel + %3 = OpVariable %9 Function + %4 = OpVariable %17 Function + %5 = OpVariable %17 Function + OpBranch %21 + %21 = OpLabel + %22 = OpPhi %8 %10 %20 %23 %24 + OpLoopMerge %25 %24 None + OpBranch %26 + %26 = OpLabel + %27 = OpSLessThan %12 %22 %11 + OpBranchConditional %27 %28 %25 + %28 = OpLabel + %29 = OpAccessChain %18 %5 %22 + %30 = OpLoad %13 %29 + %31 = OpAccessChain %18 %4 %22 + OpStore %31 %30 + %32 = OpAccessChain %18 %4 %22 + %33 = OpLoad %13 %32 + %34 = OpAccessChain %18 %5 %22 + OpStore %34 %33 + OpBranch %24 + %24 = OpLabel + %23 = OpIAdd %8 %22 %19 + OpBranch %21 + %25 = OpLabel + OpStore %3 %22 + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, source, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << source << std::endl; + Function* f = &*module->begin(); + LivenessAnalysis* liveness_analysis = context->GetLivenessAnalysis(); + const RegisterLiveness* register_liveness = liveness_analysis->Get(f); + LoopDescriptor& ld = *context->GetLoopDescriptor(f); + analysis::DefUseManager& def_use_mgr = *context->get_def_use_mgr(); + + { + RegisterLiveness::RegionRegisterLiveness l1_sim_resut; + RegisterLiveness::RegionRegisterLiveness l2_sim_resut; + std::unordered_set moved_instructions{ + def_use_mgr.GetDef(29), def_use_mgr.GetDef(30), def_use_mgr.GetDef(31), + def_use_mgr.GetDef(31)->NextNode()}; + std::unordered_set copied_instructions{ + def_use_mgr.GetDef(22), def_use_mgr.GetDef(27), + def_use_mgr.GetDef(27)->NextNode(), def_use_mgr.GetDef(23)}; + + register_liveness->SimulateFission(*ld[21], moved_instructions, + copied_instructions, &l1_sim_resut, + &l2_sim_resut); + { + SCOPED_TRACE("L1 simulation"); + std::unordered_set live_in{ + 3, // %3 = OpVariable %9 Function + 4, // %4 = OpVariable %17 Function + 5, // %5 = OpVariable %17 Function + 22, // %22 = OpPhi %8 %10 %20 %23 %24 + }; + CompareSets(l1_sim_resut.live_in_, live_in); + + std::unordered_set live_out{ + 3, // %3 = OpVariable %9 Function + 4, // %4 = OpVariable %17 Function + 5, // %5 = OpVariable %17 Function + 22, // %22 = OpPhi %8 %10 %20 %23 %24 + }; + CompareSets(l1_sim_resut.live_out_, live_out); + + EXPECT_EQ(l1_sim_resut.used_registers_, 6u); + } + { + SCOPED_TRACE("L2 simulation"); + std::unordered_set live_in{ + 3, // %3 = OpVariable %9 Function + 4, // %4 = OpVariable %17 Function + 5, // %5 = OpVariable %17 Function + 22, // %22 = OpPhi %8 %10 %20 %23 %24 + }; + CompareSets(l2_sim_resut.live_in_, live_in); + + std::unordered_set live_out{ + 3, // %3 = OpVariable %9 Function + 22, // %22 = OpPhi %8 %10 %20 %23 %24 + }; + CompareSets(l2_sim_resut.live_out_, live_out); + + EXPECT_EQ(l2_sim_resut.used_registers_, 6u); + } + } +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/replace_invalid_opc_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/replace_invalid_opc_test.cpp new file mode 100644 index 00000000000..adfe2ee1e9f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/replace_invalid_opc_test.cpp @@ -0,0 +1,596 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ReplaceInvalidOpcodeTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(ReplaceInvalidOpcodeTest, ReplaceInstruction) { + const std::string text = R"( +; CHECK: [[special_const:%\w+]] = OpConstant %float -6.2598534e+18 +; CHECK: [[constant:%\w+]] = OpConstantComposite %v4float [[special_const]] [[special_const]] [[special_const]] [[special_const]] +; CHECK-NOT: OpImageSampleImplicitLod +; CHECK: OpStore [[:%\w+]] [[constant]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %14 = OpTypeSampledImage %10 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %24 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %25 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %main = OpFunction %void None %8 + %26 = OpLabel + %27 = OpLoad %12 %25 + %28 = OpLoad %10 %24 + %29 = OpSampledImage %14 %28 %27 + %30 = OpImageSampleImplicitLod %v4float %29 %23 + %31 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(ReplaceInvalidOpcodeTest, ReplaceInstructionInNonEntryPoint) { + const std::string text = R"( +; CHECK: [[special_const:%\w+]] = OpConstant %float -6.2598534e+18 +; CHECK: [[constant:%\w+]] = OpConstantComposite %v4float [[special_const]] [[special_const]] [[special_const]] [[special_const]] +; CHECK-NOT: OpImageSampleImplicitLod +; CHECK: OpStore [[:%\w+]] [[constant]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %14 = OpTypeSampledImage %10 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %24 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %25 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %main = OpFunction %void None %8 + %26 = OpLabel + %27 = OpFunctionCall %void %28 + OpReturn + OpFunctionEnd + %28 = OpFunction %void None %8 + %29 = OpLabel + %30 = OpLoad %12 %25 + %31 = OpLoad %10 %24 + %32 = OpSampledImage %14 %31 %30 + %33 = OpImageSampleImplicitLod %v4float %32 %23 + %34 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %34 %33 + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(ReplaceInvalidOpcodeTest, ReplaceInstructionMultipleEntryPoints) { + const std::string text = R"( +; CHECK: [[special_const:%\w+]] = OpConstant %float -6.2598534e+18 +; CHECK: [[constant:%\w+]] = OpConstantComposite %v4float [[special_const]] [[special_const]] [[special_const]] [[special_const]] +; CHECK-NOT: OpImageSampleImplicitLod +; CHECK: OpStore [[:%\w+]] [[constant]] +; CHECK-NOT: OpImageSampleImplicitLod +; CHECK: OpStore [[:%\w+]] [[constant]] + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpEntryPoint Vertex %main2 "main2" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpName %main2 "main2" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %14 = OpTypeSampledImage %10 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %24 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %25 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %main = OpFunction %void None %8 + %26 = OpLabel + %27 = OpLoad %12 %25 + %28 = OpLoad %10 %24 + %29 = OpSampledImage %14 %28 %27 + %30 = OpImageSampleImplicitLod %v4float %29 %23 + %31 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %8 + %46 = OpLabel + %47 = OpLoad %12 %25 + %48 = OpLoad %10 %24 + %49 = OpSampledImage %14 %48 %47 + %50 = OpImageSampleImplicitLod %v4float %49 %23 + %51 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %51 %50 + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} +TEST_F(ReplaceInvalidOpcodeTest, DontReplaceInstruction) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %14 = OpTypeSampledImage %10 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %24 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %25 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %main = OpFunction %void None %8 + %26 = OpLabel + %27 = OpLoad %12 %25 + %28 = OpLoad %10 %24 + %29 = OpSampledImage %14 %28 %27 + %30 = OpImageSampleImplicitLod %v4float %29 %23 + %31 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd)"; + + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(ReplaceInvalidOpcodeTest, MultipleEntryPointsDifferentStage) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpEntryPoint Fragment %main2 "main2" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpName %main2 "main2" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %14 = OpTypeSampledImage %10 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %24 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %25 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %main = OpFunction %void None %8 + %26 = OpLabel + %27 = OpLoad %12 %25 + %28 = OpLoad %10 %24 + %29 = OpSampledImage %14 %28 %27 + %30 = OpImageSampleImplicitLod %v4float %29 %23 + %31 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd + %main2 = OpFunction %void None %8 + %46 = OpLabel + %47 = OpLoad %12 %25 + %48 = OpLoad %10 %24 + %49 = OpSampledImage %14 %48 %47 + %50 = OpImageSampleImplicitLod %v4float %49 %23 + %51 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %51 %50 + OpReturn + OpFunctionEnd)"; + + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(ReplaceInvalidOpcodeTest, DontReplaceLinkage) { + const std::string text = R"( + OpCapability Shader + OpCapability Linkage + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_6 0 BuiltIn Position + OpDecorate %_struct_6 Block + %void = OpTypeVoid + %8 = OpTypeFunction %void + %float = OpTypeFloat 32 + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %12 = OpTypeSampler +%_ptr_UniformConstant_12 = OpTypePointer UniformConstant %12 + %14 = OpTypeSampledImage %10 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_6 = OpTypeStruct %v4float +%_ptr_Output__struct_6 = OpTypePointer Output %_struct_6 + %5 = OpVariable %_ptr_Output__struct_6 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %23 = OpConstantComposite %v2float %float_0 %float_0 + %24 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %25 = OpVariable %_ptr_UniformConstant_12 UniformConstant + %main = OpFunction %void None %8 + %26 = OpLabel + %27 = OpLoad %12 %25 + %28 = OpLoad %10 %24 + %29 = OpSampledImage %14 %28 %27 + %30 = OpImageSampleImplicitLod %v4float %29 %23 + %31 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %31 %30 + OpReturn + OpFunctionEnd)"; + + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(ReplaceInvalidOpcodeTest, BarrierDontReplace) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%uint_264 = OpConstant %uint 264 + %main = OpFunction %void None %3 + %5 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd)"; + + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +TEST_F(ReplaceInvalidOpcodeTest, BarrierReplace) { + const std::string text = R"( +; CHECK-NOT: OpControlBarrier + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%uint_264 = OpConstant %uint 264 + %main = OpFunction %void None %3 + %5 = OpLabel + OpControlBarrier %uint_2 %uint_2 %uint_264 + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} + +struct Message { + spv_message_level_t level; + const char* source_file; + uint32_t line_number; + uint32_t column_number; + const char* message; +}; + +MessageConsumer GetTestMessageConsumer( + std::vector& expected_messages) { + return [&expected_messages](spv_message_level_t level, const char* source, + const spv_position_t& position, + const char* message) { + EXPECT_TRUE(!expected_messages.empty()); + if (expected_messages.empty()) { + return; + } + + EXPECT_EQ(expected_messages[0].level, level); + EXPECT_EQ(expected_messages[0].line_number, position.line); + EXPECT_EQ(expected_messages[0].column_number, position.column); + EXPECT_STREQ(expected_messages[0].source_file, source); + EXPECT_STREQ(expected_messages[0].message, message); + + expected_messages.erase(expected_messages.begin()); + }; +} + +TEST_F(ReplaceInvalidOpcodeTest, MessageTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + %6 = OpString "test.hlsl" + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_7 0 BuiltIn Position + OpDecorate %_struct_7 Block + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %13 = OpTypeSampler +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %15 = OpTypeSampledImage %11 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_7 = OpTypeStruct %v4float +%_ptr_Output__struct_7 = OpTypePointer Output %_struct_7 + %5 = OpVariable %_ptr_Output__struct_7 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v2float %float_0 %float_0 + %25 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %26 = OpVariable %_ptr_UniformConstant_13 UniformConstant + %main = OpFunction %void None %9 + %27 = OpLabel + OpLine %6 2 4 + %28 = OpLoad %13 %26 + %29 = OpLoad %11 %25 + %30 = OpSampledImage %15 %29 %28 + %31 = OpImageSampleImplicitLod %v4float %30 %24 + %32 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %32 %31 + OpReturn + OpFunctionEnd)"; + + std::vector messages = { + {SPV_MSG_WARNING, "test.hlsl", 2, 4, + "Removing ImageSampleImplicitLod instruction because of incompatible " + "execution model."}}; + SetMessageConsumer(GetTestMessageConsumer(messages)); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); +} + +TEST_F(ReplaceInvalidOpcodeTest, MultipleMessageTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %3 %gl_VertexIndex %5 + OpSource GLSL 400 + %6 = OpString "test.hlsl" + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpDecorate %3 Location 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %_struct_7 0 BuiltIn Position + OpDecorate %_struct_7 Block + %void = OpTypeVoid + %9 = OpTypeFunction %void + %float = OpTypeFloat 32 + %11 = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %13 = OpTypeSampler +%_ptr_UniformConstant_13 = OpTypePointer UniformConstant %13 + %15 = OpTypeSampledImage %11 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %3 = OpVariable %_ptr_Output_v4float Output + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input + %_struct_7 = OpTypeStruct %v4float +%_ptr_Output__struct_7 = OpTypePointer Output %_struct_7 + %5 = OpVariable %_ptr_Output__struct_7 Output + %int_0 = OpConstant %int 0 + %float_0 = OpConstant %float 0 + %24 = OpConstantComposite %v2float %float_0 %float_0 + %25 = OpVariable %_ptr_UniformConstant_11 UniformConstant + %26 = OpVariable %_ptr_UniformConstant_13 UniformConstant + %main = OpFunction %void None %9 + %27 = OpLabel + OpLine %6 2 4 + %28 = OpLoad %13 %26 + %29 = OpLoad %11 %25 + %30 = OpSampledImage %15 %29 %28 + %31 = OpImageSampleImplicitLod %v4float %30 %24 + OpLine %6 12 4 + %41 = OpImageSampleProjImplicitLod %v4float %30 %24 + %32 = OpAccessChain %_ptr_Output_v4float %5 %int_0 + OpStore %32 %31 + OpReturn + OpFunctionEnd)"; + + std::vector messages = { + {SPV_MSG_WARNING, "test.hlsl", 2, 4, + "Removing ImageSampleImplicitLod instruction because of incompatible " + "execution model."}, + {SPV_MSG_WARNING, "test.hlsl", 12, 4, + "Removing ImageSampleProjImplicitLod instruction because of " + "incompatible " + "execution model."}}; + SetMessageConsumer(GetTestMessageConsumer(messages)); + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); +} + +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/scalar_analysis.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/scalar_analysis.cpp new file mode 100644 index 00000000000..598d8c7b73d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/scalar_analysis.cpp @@ -0,0 +1,1221 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/iterator.h" +#include "source/opt/loop_descriptor.h" +#include "source/opt/pass.h" +#include "source/opt/scalar_analysis.h" +#include "source/opt/tree_iterator.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/function_utils.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::UnorderedElementsAre; +using ScalarAnalysisTest = PassTest<::testing::Test>; + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 410 core +layout (location = 1) out float array[10]; +void main() { + for (int i = 0; i < 10; ++i) { + array[i] = array[i+1]; + } +} +*/ +TEST_F(ScalarAnalysisTest, BasicEvolutionTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %24 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %24 "array" + OpDecorate %24 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 0 + %16 = OpConstant %6 10 + %17 = OpTypeBool + %19 = OpTypeFloat 32 + %20 = OpTypeInt 32 0 + %21 = OpConstant %20 10 + %22 = OpTypeArray %19 %21 + %23 = OpTypePointer Output %22 + %24 = OpVariable %23 Output + %27 = OpConstant %6 1 + %29 = OpTypePointer Output %19 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpBranch %10 + %10 = OpLabel + %35 = OpPhi %6 %9 %5 %34 %13 + OpLoopMerge %12 %13 None + OpBranch %14 + %14 = OpLabel + %18 = OpSLessThan %17 %35 %16 + OpBranchConditional %18 %11 %12 + %11 = OpLabel + %28 = OpIAdd %6 %35 %27 + %30 = OpAccessChain %29 %24 %28 + %31 = OpLoad %19 %30 + %32 = OpAccessChain %29 %24 %35 + OpStore %32 %31 + OpBranch %13 + %13 = OpLabel + %34 = OpIAdd %6 %35 %27 + OpBranch %10 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + ScalarEvolutionAnalysis analysis{context.get()}; + + const Instruction* store = nullptr; + const Instruction* load = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 11)) { + if (inst.opcode() == SpvOp::SpvOpStore) { + store = &inst; + } + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(load, nullptr); + EXPECT_NE(store, nullptr); + + Instruction* access_chain = + context->get_def_use_mgr()->GetDef(load->GetSingleWordInOperand(0)); + + Instruction* child = context->get_def_use_mgr()->GetDef( + access_chain->GetSingleWordInOperand(1)); + const SENode* node = analysis.AnalyzeInstruction(child); + + EXPECT_NE(node, nullptr); + + // Unsimplified node should have the form of ADD(REC(0,1), 1) + EXPECT_EQ(node->GetType(), SENode::Add); + + const SENode* child_1 = node->GetChild(0); + EXPECT_TRUE(child_1->GetType() == SENode::Constant || + child_1->GetType() == SENode::RecurrentAddExpr); + + const SENode* child_2 = node->GetChild(1); + EXPECT_TRUE(child_2->GetType() == SENode::Constant || + child_2->GetType() == SENode::RecurrentAddExpr); + + SENode* simplified = analysis.SimplifyExpression(const_cast(node)); + // Simplified should be in the form of REC(1,1) + EXPECT_EQ(simplified->GetType(), SENode::RecurrentAddExpr); + + EXPECT_EQ(simplified->GetChild(0)->GetType(), SENode::Constant); + EXPECT_EQ(simplified->GetChild(0)->AsSEConstantNode()->FoldToSingleValue(), + 1); + + EXPECT_EQ(simplified->GetChild(1)->GetType(), SENode::Constant); + EXPECT_EQ(simplified->GetChild(1)->AsSEConstantNode()->FoldToSingleValue(), + 1); + + EXPECT_EQ(simplified->GetChild(0), simplified->GetChild(1)); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 410 core +layout (location = 1) out float array[10]; +layout (location = 2) flat in int loop_invariant; +void main() { + for (int i = 0; i < 10; ++i) { + array[i] = array[i+loop_invariant]; + } +} + +*/ +TEST_F(ScalarAnalysisTest, LoadTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "array" + OpName %4 "loop_invariant" + OpDecorate %3 Location 1 + OpDecorate %4 Flat + OpDecorate %4 Location 2 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeInt 32 1 + %8 = OpTypePointer Function %7 + %9 = OpConstant %7 0 + %10 = OpConstant %7 10 + %11 = OpTypeBool + %12 = OpTypeFloat 32 + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 10 + %15 = OpTypeArray %12 %14 + %16 = OpTypePointer Output %15 + %3 = OpVariable %16 Output + %17 = OpTypePointer Input %7 + %4 = OpVariable %17 Input + %18 = OpTypePointer Output %12 + %19 = OpConstant %7 1 + %2 = OpFunction %5 None %6 + %20 = OpLabel + OpBranch %21 + %21 = OpLabel + %22 = OpPhi %7 %9 %20 %23 %24 + OpLoopMerge %25 %24 None + OpBranch %26 + %26 = OpLabel + %27 = OpSLessThan %11 %22 %10 + OpBranchConditional %27 %28 %25 + %28 = OpLabel + %29 = OpLoad %7 %4 + %30 = OpIAdd %7 %22 %29 + %31 = OpAccessChain %18 %3 %30 + %32 = OpLoad %12 %31 + %33 = OpAccessChain %18 %3 %22 + OpStore %33 %32 + OpBranch %24 + %24 = OpLabel + %23 = OpIAdd %7 %22 %19 + OpBranch %21 + %25 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + ScalarEvolutionAnalysis analysis{context.get()}; + + const Instruction* load = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 28)) { + if (inst.opcode() == SpvOp::SpvOpLoad) { + load = &inst; + } + } + + EXPECT_NE(load, nullptr); + + Instruction* access_chain = + context->get_def_use_mgr()->GetDef(load->GetSingleWordInOperand(0)); + + Instruction* child = context->get_def_use_mgr()->GetDef( + access_chain->GetSingleWordInOperand(1)); + // const SENode* node = + // analysis.GetNodeFromInstruction(child->unique_id()); + + const SENode* node = analysis.AnalyzeInstruction(child); + + EXPECT_NE(node, nullptr); + + // Unsimplified node should have the form of ADD(REC(0,1), X) + EXPECT_EQ(node->GetType(), SENode::Add); + + const SENode* child_1 = node->GetChild(0); + EXPECT_TRUE(child_1->GetType() == SENode::ValueUnknown || + child_1->GetType() == SENode::RecurrentAddExpr); + + const SENode* child_2 = node->GetChild(1); + EXPECT_TRUE(child_2->GetType() == SENode::ValueUnknown || + child_2->GetType() == SENode::RecurrentAddExpr); + + SENode* simplified = analysis.SimplifyExpression(const_cast(node)); + EXPECT_EQ(simplified->GetType(), SENode::RecurrentAddExpr); + + const SERecurrentNode* rec = simplified->AsSERecurrentNode(); + + EXPECT_NE(rec->GetChild(0), rec->GetChild(1)); + + EXPECT_EQ(rec->GetOffset()->GetType(), SENode::ValueUnknown); + + EXPECT_EQ(rec->GetCoefficient()->GetType(), SENode::Constant); + EXPECT_EQ(rec->GetCoefficient()->AsSEConstantNode()->FoldToSingleValue(), 1u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 410 core +layout (location = 1) out float array[10]; +layout (location = 2) flat in int loop_invariant; +void main() { + array[0] = array[loop_invariant * 2 + 4 + 5 - 24 - loop_invariant - +loop_invariant+ 16 * 3]; +} + +*/ +TEST_F(ScalarAnalysisTest, SimplifySimple) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "array" + OpName %4 "loop_invariant" + OpDecorate %3 Location 1 + OpDecorate %4 Flat + OpDecorate %4 Location 2 + %5 = OpTypeVoid + %6 = OpTypeFunction %5 + %7 = OpTypeFloat 32 + %8 = OpTypeInt 32 0 + %9 = OpConstant %8 10 + %10 = OpTypeArray %7 %9 + %11 = OpTypePointer Output %10 + %3 = OpVariable %11 Output + %12 = OpTypeInt 32 1 + %13 = OpConstant %12 0 + %14 = OpTypePointer Input %12 + %4 = OpVariable %14 Input + %15 = OpConstant %12 2 + %16 = OpConstant %12 4 + %17 = OpConstant %12 5 + %18 = OpConstant %12 24 + %19 = OpConstant %12 48 + %20 = OpTypePointer Output %7 + %2 = OpFunction %5 None %6 + %21 = OpLabel + %22 = OpLoad %12 %4 + %23 = OpIMul %12 %22 %15 + %24 = OpIAdd %12 %23 %16 + %25 = OpIAdd %12 %24 %17 + %26 = OpISub %12 %25 %18 + %28 = OpISub %12 %26 %22 + %30 = OpISub %12 %28 %22 + %31 = OpIAdd %12 %30 %19 + %32 = OpAccessChain %20 %3 %31 + %33 = OpLoad %7 %32 + %34 = OpAccessChain %20 %3 %13 + OpStore %34 %33 + OpReturn + OpFunctionEnd + )"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + ScalarEvolutionAnalysis analysis{context.get()}; + + const Instruction* load = nullptr; + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 21)) { + if (inst.opcode() == SpvOp::SpvOpLoad && inst.result_id() == 33) { + load = &inst; + } + } + + EXPECT_NE(load, nullptr); + + Instruction* access_chain = + context->get_def_use_mgr()->GetDef(load->GetSingleWordInOperand(0)); + + Instruction* child = context->get_def_use_mgr()->GetDef( + access_chain->GetSingleWordInOperand(1)); + + const SENode* node = analysis.AnalyzeInstruction(child); + + // Unsimplified is a very large graph with an add at the top. + EXPECT_NE(node, nullptr); + EXPECT_EQ(node->GetType(), SENode::Add); + + // Simplified node should resolve down to a constant expression as the loads + // will eliminate themselves. + SENode* simplified = analysis.SimplifyExpression(const_cast(node)); + + EXPECT_EQ(simplified->GetType(), SENode::Constant); + EXPECT_EQ(simplified->AsSEConstantNode()->FoldToSingleValue(), 33u); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 410 core +layout(location = 0) in vec4 c; +layout (location = 1) out float array[10]; +void main() { + int N = int(c.x); + for (int i = 0; i < 10; ++i) { + array[i] = array[i]; + array[i] = array[i-1]; + array[i] = array[i+1]; + array[i+1] = array[i+1]; + array[i+N] = array[i+N]; + array[i] = array[i+N]; + } +} + +*/ +TEST_F(ScalarAnalysisTest, Simplify) { + const std::string text = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" %12 %33 + OpExecutionMode %4 OriginUpperLeft + OpSource GLSL 410 + OpName %4 "main" + OpName %8 "N" + OpName %12 "c" + OpName %19 "i" + OpName %33 "array" + OpDecorate %12 Location 0 + OpDecorate %33 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpTypeFloat 32 + %10 = OpTypeVector %9 4 + %11 = OpTypePointer Input %10 + %12 = OpVariable %11 Input + %13 = OpTypeInt 32 0 + %14 = OpConstant %13 0 + %15 = OpTypePointer Input %9 + %20 = OpConstant %6 0 + %27 = OpConstant %6 10 + %28 = OpTypeBool + %30 = OpConstant %13 10 + %31 = OpTypeArray %9 %30 + %32 = OpTypePointer Output %31 + %33 = OpVariable %32 Output + %36 = OpTypePointer Output %9 + %42 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %19 = OpVariable %7 Function + %16 = OpAccessChain %15 %12 %14 + %17 = OpLoad %9 %16 + %18 = OpConvertFToS %6 %17 + OpStore %8 %18 + OpStore %19 %20 + OpBranch %21 + %21 = OpLabel + %78 = OpPhi %6 %20 %5 %77 %24 + OpLoopMerge %23 %24 None + OpBranch %25 + %25 = OpLabel + %29 = OpSLessThan %28 %78 %27 + OpBranchConditional %29 %22 %23 + %22 = OpLabel + %37 = OpAccessChain %36 %33 %78 + %38 = OpLoad %9 %37 + %39 = OpAccessChain %36 %33 %78 + OpStore %39 %38 + %43 = OpISub %6 %78 %42 + %44 = OpAccessChain %36 %33 %43 + %45 = OpLoad %9 %44 + %46 = OpAccessChain %36 %33 %78 + OpStore %46 %45 + %49 = OpIAdd %6 %78 %42 + %50 = OpAccessChain %36 %33 %49 + %51 = OpLoad %9 %50 + %52 = OpAccessChain %36 %33 %78 + OpStore %52 %51 + %54 = OpIAdd %6 %78 %42 + %56 = OpIAdd %6 %78 %42 + %57 = OpAccessChain %36 %33 %56 + %58 = OpLoad %9 %57 + %59 = OpAccessChain %36 %33 %54 + OpStore %59 %58 + %62 = OpIAdd %6 %78 %18 + %65 = OpIAdd %6 %78 %18 + %66 = OpAccessChain %36 %33 %65 + %67 = OpLoad %9 %66 + %68 = OpAccessChain %36 %33 %62 + OpStore %68 %67 + %72 = OpIAdd %6 %78 %18 + %73 = OpAccessChain %36 %33 %72 + %74 = OpLoad %9 %73 + %75 = OpAccessChain %36 %33 %78 + OpStore %75 %74 + OpBranch %24 + %24 = OpLabel + %77 = OpIAdd %6 %78 %42 + OpStore %19 %77 + OpBranch %21 + %23 = OpLabel + OpReturn + OpFunctionEnd +)"; + // clang-format on + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 4); + ScalarEvolutionAnalysis analysis{context.get()}; + + const Instruction* loads[6]; + const Instruction* stores[6]; + int load_count = 0; + int store_count = 0; + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 22)) { + if (inst.opcode() == SpvOp::SpvOpLoad) { + loads[load_count] = &inst; + ++load_count; + } + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[store_count] = &inst; + ++store_count; + } + } + + EXPECT_EQ(load_count, 6); + EXPECT_EQ(store_count, 6); + + Instruction* load_access_chain; + Instruction* store_access_chain; + Instruction* load_child; + Instruction* store_child; + SENode* load_node; + SENode* store_node; + SENode* subtract_node; + SENode* simplified_node; + + // Testing [i] - [i] == 0 + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[0]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[0]->GetSingleWordInOperand(0)); + + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + load_node = analysis.AnalyzeInstruction(load_child); + store_node = analysis.AnalyzeInstruction(store_child); + + subtract_node = analysis.CreateSubtraction(store_node, load_node); + simplified_node = analysis.SimplifyExpression(subtract_node); + EXPECT_EQ(simplified_node->GetType(), SENode::Constant); + EXPECT_EQ(simplified_node->AsSEConstantNode()->FoldToSingleValue(), 0u); + + // Testing [i] - [i-1] == 1 + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[1]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[1]->GetSingleWordInOperand(0)); + + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + load_node = analysis.AnalyzeInstruction(load_child); + store_node = analysis.AnalyzeInstruction(store_child); + + subtract_node = analysis.CreateSubtraction(store_node, load_node); + simplified_node = analysis.SimplifyExpression(subtract_node); + + EXPECT_EQ(simplified_node->GetType(), SENode::Constant); + EXPECT_EQ(simplified_node->AsSEConstantNode()->FoldToSingleValue(), 1u); + + // Testing [i] - [i+1] == -1 + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[2]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[2]->GetSingleWordInOperand(0)); + + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + load_node = analysis.AnalyzeInstruction(load_child); + store_node = analysis.AnalyzeInstruction(store_child); + + subtract_node = analysis.CreateSubtraction(store_node, load_node); + simplified_node = analysis.SimplifyExpression(subtract_node); + EXPECT_EQ(simplified_node->GetType(), SENode::Constant); + EXPECT_EQ(simplified_node->AsSEConstantNode()->FoldToSingleValue(), -1); + + // Testing [i+1] - [i+1] == 0 + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[3]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[3]->GetSingleWordInOperand(0)); + + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + load_node = analysis.AnalyzeInstruction(load_child); + store_node = analysis.AnalyzeInstruction(store_child); + + subtract_node = analysis.CreateSubtraction(store_node, load_node); + simplified_node = analysis.SimplifyExpression(subtract_node); + EXPECT_EQ(simplified_node->GetType(), SENode::Constant); + EXPECT_EQ(simplified_node->AsSEConstantNode()->FoldToSingleValue(), 0u); + + // Testing [i+N] - [i+N] == 0 + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[4]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[4]->GetSingleWordInOperand(0)); + + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + load_node = analysis.AnalyzeInstruction(load_child); + store_node = analysis.AnalyzeInstruction(store_child); + + subtract_node = analysis.CreateSubtraction(store_node, load_node); + + simplified_node = analysis.SimplifyExpression(subtract_node); + EXPECT_EQ(simplified_node->GetType(), SENode::Constant); + EXPECT_EQ(simplified_node->AsSEConstantNode()->FoldToSingleValue(), 0u); + + // Testing [i] - [i+N] == -N + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[5]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[5]->GetSingleWordInOperand(0)); + + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + load_node = analysis.AnalyzeInstruction(load_child); + store_node = analysis.AnalyzeInstruction(store_child); + + subtract_node = analysis.CreateSubtraction(store_node, load_node); + simplified_node = analysis.SimplifyExpression(subtract_node); + EXPECT_EQ(simplified_node->GetType(), SENode::Negative); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 430 +layout(location = 1) out float array[10]; +layout(location = 2) flat in int loop_invariant; +void main(void) { + for (int i = 0; i < 10; ++i) { + array[i * 2 + i * 5] = array[i * i * 2]; + array[i * 2] = array[i * 5]; + } +} + +*/ + +TEST_F(ScalarAnalysisTest, SimplifyMultiplyInductions) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %5 "i" + OpName %3 "array" + OpName %4 "loop_invariant" + OpDecorate %3 Location 1 + OpDecorate %4 Flat + OpDecorate %4 Location 2 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Output %16 + %3 = OpVariable %17 Output + %18 = OpConstant %8 2 + %19 = OpConstant %8 5 + %20 = OpTypePointer Output %13 + %21 = OpConstant %8 1 + %22 = OpTypePointer Input %8 + %4 = OpVariable %22 Input + %2 = OpFunction %6 None %7 + %23 = OpLabel + %5 = OpVariable %9 Function + OpStore %5 %10 + OpBranch %24 + %24 = OpLabel + %25 = OpPhi %8 %10 %23 %26 %27 + OpLoopMerge %28 %27 None + OpBranch %29 + %29 = OpLabel + %30 = OpSLessThan %12 %25 %11 + OpBranchConditional %30 %31 %28 + %31 = OpLabel + %32 = OpIMul %8 %25 %18 + %33 = OpIMul %8 %25 %19 + %34 = OpIAdd %8 %32 %33 + %35 = OpIMul %8 %25 %25 + %36 = OpIMul %8 %35 %18 + %37 = OpAccessChain %20 %3 %36 + %38 = OpLoad %13 %37 + %39 = OpAccessChain %20 %3 %34 + OpStore %39 %38 + %40 = OpIMul %8 %25 %18 + %41 = OpIMul %8 %25 %19 + %42 = OpAccessChain %20 %3 %41 + %43 = OpLoad %13 %42 + %44 = OpAccessChain %20 %3 %40 + OpStore %44 %43 + OpBranch %27 + %27 = OpLabel + %26 = OpIAdd %8 %25 %21 + OpStore %5 %26 + OpBranch %24 + %28 = OpLabel + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + ScalarEvolutionAnalysis analysis{context.get()}; + + const Instruction* loads[2] = {nullptr, nullptr}; + const Instruction* stores[2] = {nullptr, nullptr}; + int load_count = 0; + int store_count = 0; + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 31)) { + if (inst.opcode() == SpvOp::SpvOpLoad) { + loads[load_count] = &inst; + ++load_count; + } + if (inst.opcode() == SpvOp::SpvOpStore) { + stores[store_count] = &inst; + ++store_count; + } + } + + EXPECT_EQ(load_count, 2); + EXPECT_EQ(store_count, 2); + + Instruction* load_access_chain = + context->get_def_use_mgr()->GetDef(loads[0]->GetSingleWordInOperand(0)); + Instruction* store_access_chain = + context->get_def_use_mgr()->GetDef(stores[0]->GetSingleWordInOperand(0)); + + Instruction* load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + Instruction* store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + SENode* store_node = analysis.AnalyzeInstruction(store_child); + + SENode* store_simplified = analysis.SimplifyExpression(store_node); + + load_access_chain = + context->get_def_use_mgr()->GetDef(loads[1]->GetSingleWordInOperand(0)); + store_access_chain = + context->get_def_use_mgr()->GetDef(stores[1]->GetSingleWordInOperand(0)); + load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + SENode* second_store = + analysis.SimplifyExpression(analysis.AnalyzeInstruction(store_child)); + SENode* second_load = + analysis.SimplifyExpression(analysis.AnalyzeInstruction(load_child)); + SENode* combined_add = analysis.SimplifyExpression( + analysis.CreateAddNode(second_load, second_store)); + + // We're checking that the two recurrent expression have been correctly + // folded. In store_simplified they will have been folded as the entire + // expression was simplified as one. In combined_add the two expressions have + // been simplified one after the other which means the recurrent expressions + // aren't exactly the same but should still be folded as they are with respect + // to the same loop. + EXPECT_EQ(combined_add, store_simplified); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 430 +void main(void) { + for (int i = 0; i < 10; --i) { + array[i] = array[i]; + } +} + +*/ + +TEST_F(ScalarAnalysisTest, SimplifyNegativeSteps) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %5 "i" + OpName %3 "array" + OpName %4 "loop_invariant" + OpDecorate %3 Location 1 + OpDecorate %4 Flat + OpDecorate %4 Location 2 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Output %16 + %3 = OpVariable %17 Output + %18 = OpTypePointer Output %13 + %19 = OpConstant %8 1 + %20 = OpTypePointer Input %8 + %4 = OpVariable %20 Input + %2 = OpFunction %6 None %7 + %21 = OpLabel + %5 = OpVariable %9 Function + OpStore %5 %10 + OpBranch %22 + %22 = OpLabel + %23 = OpPhi %8 %10 %21 %24 %25 + OpLoopMerge %26 %25 None + OpBranch %27 + %27 = OpLabel + %28 = OpSLessThan %12 %23 %11 + OpBranchConditional %28 %29 %26 + %29 = OpLabel + %30 = OpAccessChain %18 %3 %23 + %31 = OpLoad %13 %30 + %32 = OpAccessChain %18 %3 %23 + OpStore %32 %31 + OpBranch %25 + %25 = OpLabel + %24 = OpISub %8 %23 %19 + OpStore %5 %24 + OpBranch %22 + %26 = OpLabel + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + ScalarEvolutionAnalysis analysis{context.get()}; + + const Instruction* loads[1] = {nullptr}; + int load_count = 0; + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 29)) { + if (inst.opcode() == SpvOp::SpvOpLoad) { + loads[load_count] = &inst; + ++load_count; + } + } + + EXPECT_EQ(load_count, 1); + + Instruction* load_access_chain = + context->get_def_use_mgr()->GetDef(loads[0]->GetSingleWordInOperand(0)); + Instruction* load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + + SENode* load_node = analysis.AnalyzeInstruction(load_child); + + EXPECT_TRUE(load_node); + EXPECT_EQ(load_node->GetType(), SENode::RecurrentAddExpr); + EXPECT_TRUE(load_node->AsSERecurrentNode()); + + SENode* child_1 = load_node->AsSERecurrentNode()->GetCoefficient(); + SENode* child_2 = load_node->AsSERecurrentNode()->GetOffset(); + + EXPECT_EQ(child_1->GetType(), SENode::Constant); + EXPECT_EQ(child_2->GetType(), SENode::Constant); + + EXPECT_EQ(child_1->AsSEConstantNode()->FoldToSingleValue(), -1); + EXPECT_EQ(child_2->AsSEConstantNode()->FoldToSingleValue(), 0u); + + SERecurrentNode* load_simplified = + analysis.SimplifyExpression(load_node)->AsSERecurrentNode(); + + EXPECT_TRUE(load_simplified); + EXPECT_EQ(load_node, load_simplified); + + EXPECT_EQ(load_simplified->GetType(), SENode::RecurrentAddExpr); + EXPECT_TRUE(load_simplified->AsSERecurrentNode()); + + SENode* simplified_child_1 = + load_simplified->AsSERecurrentNode()->GetCoefficient(); + SENode* simplified_child_2 = + load_simplified->AsSERecurrentNode()->GetOffset(); + + EXPECT_EQ(child_1, simplified_child_1); + EXPECT_EQ(child_2, simplified_child_2); +} + +/* +Generated from the following GLSL + --eliminate-local-multi-store + +#version 430 +void main(void) { + for (int i = 0; i < 10; --i) { + array[i] = array[i]; + } +} + +*/ + +TEST_F(ScalarAnalysisTest, SimplifyInductionsAndLoads) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %5 "i" + OpName %3 "array" + OpName %4 "N" + OpDecorate %3 Location 1 + OpDecorate %4 Flat + OpDecorate %4 Location 2 + %6 = OpTypeVoid + %7 = OpTypeFunction %6 + %8 = OpTypeInt 32 1 + %9 = OpTypePointer Function %8 + %10 = OpConstant %8 0 + %11 = OpConstant %8 10 + %12 = OpTypeBool + %13 = OpTypeFloat 32 + %14 = OpTypeInt 32 0 + %15 = OpConstant %14 10 + %16 = OpTypeArray %13 %15 + %17 = OpTypePointer Output %16 + %3 = OpVariable %17 Output + %18 = OpConstant %8 2 + %19 = OpTypePointer Input %8 + %4 = OpVariable %19 Input + %20 = OpTypePointer Output %13 + %21 = OpConstant %8 1 + %2 = OpFunction %6 None %7 + %22 = OpLabel + %5 = OpVariable %9 Function + OpStore %5 %10 + OpBranch %23 + %23 = OpLabel + %24 = OpPhi %8 %10 %22 %25 %26 + OpLoopMerge %27 %26 None + OpBranch %28 + %28 = OpLabel + %29 = OpSLessThan %12 %24 %11 + OpBranchConditional %29 %30 %27 + %30 = OpLabel + %31 = OpLoad %8 %4 + %32 = OpIMul %8 %18 %31 + %33 = OpIAdd %8 %24 %32 + %35 = OpIAdd %8 %24 %31 + %36 = OpAccessChain %20 %3 %35 + %37 = OpLoad %13 %36 + %38 = OpAccessChain %20 %3 %33 + OpStore %38 %37 + %39 = OpIMul %8 %18 %24 + %41 = OpIMul %8 %18 %31 + %42 = OpIAdd %8 %39 %41 + %43 = OpIAdd %8 %42 %21 + %44 = OpIMul %8 %18 %24 + %46 = OpIAdd %8 %44 %31 + %47 = OpIAdd %8 %46 %21 + %48 = OpAccessChain %20 %3 %47 + %49 = OpLoad %13 %48 + %50 = OpAccessChain %20 %3 %43 + OpStore %50 %49 + OpBranch %26 + %26 = OpLabel + %25 = OpISub %8 %24 %21 + OpStore %5 %25 + OpBranch %23 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + ScalarEvolutionAnalysis analysis{context.get()}; + + std::vector loads{}; + std::vector stores{}; + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 30)) { + if (inst.opcode() == SpvOp::SpvOpLoad) { + loads.push_back(&inst); + } + if (inst.opcode() == SpvOp::SpvOpStore) { + stores.push_back(&inst); + } + } + + EXPECT_EQ(loads.size(), 3u); + EXPECT_EQ(stores.size(), 2u); + { + Instruction* store_access_chain = context->get_def_use_mgr()->GetDef( + stores[0]->GetSingleWordInOperand(0)); + + Instruction* store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + + SENode* store_node = analysis.AnalyzeInstruction(store_child); + + SENode* store_simplified = analysis.SimplifyExpression(store_node); + + Instruction* load_access_chain = + context->get_def_use_mgr()->GetDef(loads[1]->GetSingleWordInOperand(0)); + + Instruction* load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + + SENode* load_node = analysis.AnalyzeInstruction(load_child); + + SENode* load_simplified = analysis.SimplifyExpression(load_node); + + SENode* difference = + analysis.CreateSubtraction(store_simplified, load_simplified); + + SENode* difference_simplified = analysis.SimplifyExpression(difference); + + // Check that i+2*N - i*N, turns into just N when both sides have already + // been simplified into a single recurrent expression. + EXPECT_EQ(difference_simplified->GetType(), SENode::ValueUnknown); + + // Check that the inverse, i*N - i+2*N turns into -N. + SENode* difference_inverse = analysis.SimplifyExpression( + analysis.CreateSubtraction(load_simplified, store_simplified)); + + EXPECT_EQ(difference_inverse->GetType(), SENode::Negative); + EXPECT_EQ(difference_inverse->GetChild(0)->GetType(), SENode::ValueUnknown); + EXPECT_EQ(difference_inverse->GetChild(0), difference_simplified); + } + + { + Instruction* store_access_chain = context->get_def_use_mgr()->GetDef( + stores[1]->GetSingleWordInOperand(0)); + + Instruction* store_child = context->get_def_use_mgr()->GetDef( + store_access_chain->GetSingleWordInOperand(1)); + SENode* store_node = analysis.AnalyzeInstruction(store_child); + SENode* store_simplified = analysis.SimplifyExpression(store_node); + + Instruction* load_access_chain = + context->get_def_use_mgr()->GetDef(loads[2]->GetSingleWordInOperand(0)); + + Instruction* load_child = context->get_def_use_mgr()->GetDef( + load_access_chain->GetSingleWordInOperand(1)); + + SENode* load_node = analysis.AnalyzeInstruction(load_child); + + SENode* load_simplified = analysis.SimplifyExpression(load_node); + + SENode* difference = + analysis.CreateSubtraction(store_simplified, load_simplified); + SENode* difference_simplified = analysis.SimplifyExpression(difference); + + // Check that 2*i + 2*N + 1 - 2*i + N + 1, turns into just N when both + // sides have already been simplified into a single recurrent expression. + EXPECT_EQ(difference_simplified->GetType(), SENode::ValueUnknown); + + // Check that the inverse, (2*i + N + 1) - (2*i + 2*N + 1) turns into -N. + SENode* difference_inverse = analysis.SimplifyExpression( + analysis.CreateSubtraction(load_simplified, store_simplified)); + + EXPECT_EQ(difference_inverse->GetType(), SENode::Negative); + EXPECT_EQ(difference_inverse->GetChild(0)->GetType(), SENode::ValueUnknown); + EXPECT_EQ(difference_inverse->GetChild(0), difference_simplified); + } +} + +/* Generated from the following GLSL + --eliminate-local-multi-store + + #version 430 + layout(location = 1) out float array[10]; + layout(location = 2) flat in int N; + void main(void) { + int step = 0; + for (int i = 0; i < N; i += step) { + step++; + } + } +*/ +TEST_F(ScalarAnalysisTest, InductionWithVariantStep) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" %3 %4 + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + OpName %2 "main" + OpName %5 "step" + OpName %6 "i" + OpName %3 "N" + OpName %4 "array" + OpDecorate %3 Flat + OpDecorate %3 Location 2 + OpDecorate %4 Location 1 + %7 = OpTypeVoid + %8 = OpTypeFunction %7 + %9 = OpTypeInt 32 1 + %10 = OpTypePointer Function %9 + %11 = OpConstant %9 0 + %12 = OpTypePointer Input %9 + %3 = OpVariable %12 Input + %13 = OpTypeBool + %14 = OpConstant %9 1 + %15 = OpTypeFloat 32 + %16 = OpTypeInt 32 0 + %17 = OpConstant %16 10 + %18 = OpTypeArray %15 %17 + %19 = OpTypePointer Output %18 + %4 = OpVariable %19 Output + %2 = OpFunction %7 None %8 + %20 = OpLabel + %5 = OpVariable %10 Function + %6 = OpVariable %10 Function + OpStore %5 %11 + OpStore %6 %11 + OpBranch %21 + %21 = OpLabel + %22 = OpPhi %9 %11 %20 %23 %24 + %25 = OpPhi %9 %11 %20 %26 %24 + OpLoopMerge %27 %24 None + OpBranch %28 + %28 = OpLabel + %29 = OpLoad %9 %3 + %30 = OpSLessThan %13 %25 %29 + OpBranchConditional %30 %31 %27 + %31 = OpLabel + %23 = OpIAdd %9 %22 %14 + OpStore %5 %23 + OpBranch %24 + %24 = OpLabel + %26 = OpIAdd %9 %25 %23 + OpStore %6 %26 + OpBranch %21 + %27 = OpLabel + OpReturn + OpFunctionEnd + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + Module* module = context->module(); + EXPECT_NE(nullptr, module) << "Assembling failed for shader:\n" + << text << std::endl; + const Function* f = spvtest::GetFunction(module, 2); + ScalarEvolutionAnalysis analysis{context.get()}; + + std::vector phis{}; + + for (const Instruction& inst : *spvtest::GetBasicBlock(f, 21)) { + if (inst.opcode() == SpvOp::SpvOpPhi) { + phis.push_back(&inst); + } + } + + EXPECT_EQ(phis.size(), 2u); + SENode* phi_node_1 = analysis.AnalyzeInstruction(phis[0]); + SENode* phi_node_2 = analysis.AnalyzeInstruction(phis[1]); + phi_node_1->DumpDot(std::cout, true); + EXPECT_NE(phi_node_1, nullptr); + EXPECT_NE(phi_node_2, nullptr); + + EXPECT_EQ(phi_node_1->GetType(), SENode::RecurrentAddExpr); + EXPECT_EQ(phi_node_2->GetType(), SENode::CanNotCompute); + + SENode* simplified_1 = analysis.SimplifyExpression(phi_node_1); + SENode* simplified_2 = analysis.SimplifyExpression(phi_node_2); + + EXPECT_EQ(simplified_1->GetType(), SENode::RecurrentAddExpr); + EXPECT_EQ(simplified_2->GetType(), SENode::CanNotCompute); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/scalar_replacement_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/scalar_replacement_test.cpp new file mode 100644 index 00000000000..652978bb068 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/scalar_replacement_test.cpp @@ -0,0 +1,1527 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ScalarReplacementTest = PassTest<::testing::Test>; + +// TODO(dneto): Add Effcee as required dependency, and make this unconditional. +#ifdef SPIRV_EFFCEE +TEST_F(ScalarReplacementTest, SimpleStruct) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct [[elem:%\w+]] +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: [[elem_ptr:%\w+]] = OpTypePointer Function [[elem]] +; CHECK: OpConstantNull [[struct]] +; CHECK: [[null:%\w+]] = OpConstantNull [[elem]] +; CHECK-NOT: OpVariable [[struct_ptr]] +; CHECK: [[one:%\w+]] = OpVariable [[elem_ptr]] Function [[null]] +; CHECK-NEXT: [[two:%\w+]] = OpVariable [[elem_ptr]] Function [[null]] +; CHECK-NOT: OpVariable [[elem_ptr]] Function [[null]] +; CHECK-NOT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpInBoundsAccessChain +; CHECK: [[l1:%\w+]] = OpLoad [[elem]] [[two]] +; CHECK-NOT: OpAccessChain +; CHECK: [[l2:%\w+]] = OpLoad [[elem]] [[one]] +; CHECK: OpIAdd [[elem]] [[l1]] [[l2]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "simple_struct" +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %2 %2 %2 %2 +%4 = OpTypePointer Function %3 +%5 = OpTypePointer Function %2 +%6 = OpTypeFunction %2 +%7 = OpConstantNull %3 +%8 = OpConstant %2 0 +%9 = OpConstant %2 1 +%10 = OpConstant %2 2 +%11 = OpConstant %2 3 +%12 = OpFunction %2 None %6 +%13 = OpLabel +%14 = OpVariable %4 Function %7 +%15 = OpInBoundsAccessChain %5 %14 %8 +%16 = OpLoad %2 %15 +%17 = OpAccessChain %5 %14 %10 +%18 = OpLoad %2 %17 +%19 = OpIAdd %2 %16 %18 +OpReturnValue %19 +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, StructInitialization) { + const std::string text = R"( +; +; CHECK: [[elem:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct:%\w+]] = OpTypeStruct [[elem]] [[elem]] [[elem]] [[elem]] +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: [[elem_ptr:%\w+]] = OpTypePointer Function [[elem]] +; CHECK: [[zero:%\w+]] = OpConstant [[elem]] 0 +; CHECK: [[undef:%\w+]] = OpUndef [[elem]] +; CHECK: [[two:%\w+]] = OpConstant [[elem]] 2 +; CHECK: [[null:%\w+]] = OpConstantNull [[elem]] +; CHECK-NOT: OpVariable [[struct_ptr]] +; CHECK: OpVariable [[elem_ptr]] Function [[null]] +; CHECK-NEXT: OpVariable [[elem_ptr]] Function [[two]] +; CHECK-NOT: OpVariable [[elem_ptr]] Function [[undef]] +; CHECK-NEXT: OpVariable [[elem_ptr]] Function +; CHECK-NEXT: OpVariable [[elem_ptr]] Function [[zero]] +; CHECK-NOT: OpVariable [[elem_ptr]] Function [[undef]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "struct_init" +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %2 %2 %2 %2 +%4 = OpTypePointer Function %3 +%20 = OpTypePointer Function %2 +%6 = OpTypeFunction %1 +%7 = OpConstant %2 0 +%8 = OpUndef %2 +%9 = OpConstant %2 2 +%30 = OpConstant %2 1 +%31 = OpConstant %2 3 +%10 = OpConstantNull %2 +%11 = OpConstantComposite %3 %7 %8 %9 %10 +%12 = OpFunction %1 None %6 +%13 = OpLabel +%14 = OpVariable %4 Function %11 +%15 = OpAccessChain %20 %14 %7 +OpStore %15 %10 +%16 = OpAccessChain %20 %14 %9 +OpStore %16 %10 +%17 = OpAccessChain %20 %14 %30 +OpStore %17 %10 +%18 = OpAccessChain %20 %14 %31 +OpStore %18 %10 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, SpecConstantInitialization) { + const std::string text = R"( +; +; CHECK: [[int:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct:%\w+]] = OpTypeStruct [[int]] [[int]] +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: [[int_ptr:%\w+]] = OpTypePointer Function [[int]] +; CHECK: [[spec_comp:%\w+]] = OpSpecConstantComposite [[struct]] +; CHECK: [[ex0:%\w+]] = OpSpecConstantOp [[int]] CompositeExtract [[spec_comp]] 0 +; CHECK: [[ex1:%\w+]] = OpSpecConstantOp [[int]] CompositeExtract [[spec_comp]] 1 +; CHECK-NOT: OpVariable [[struct]] +; CHECK: OpVariable [[int_ptr]] Function [[ex1]] +; CHECK-NEXT: OpVariable [[int_ptr]] Function [[ex0]] +; CHECK-NOT: OpVariable [[struct]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "spec_const" +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %2 %2 +%4 = OpTypePointer Function %3 +%20 = OpTypePointer Function %2 +%5 = OpTypeFunction %1 +%6 = OpConstant %2 0 +%30 = OpConstant %2 1 +%7 = OpSpecConstant %2 0 +%8 = OpSpecConstantOp %2 IAdd %7 %7 +%9 = OpSpecConstantComposite %3 %7 %8 +%10 = OpFunction %1 None %5 +%11 = OpLabel +%12 = OpVariable %4 Function %9 +%13 = OpAccessChain %20 %12 %6 +%14 = OpLoad %2 %13 +%15 = OpAccessChain %20 %12 %30 +%16 = OpLoad %2 %15 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +// TODO(alanbaker): Re-enable when vector and matrix scalarization is supported. +// TEST_F(ScalarReplacementTest, VectorInitialization) { +// const std::string text = R"( +// ; +// ; CHECK: [[elem:%\w+]] = OpTypeInt 32 0 +// ; CHECK: [[vector:%\w+]] = OpTypeVector [[elem]] 4 +// ; CHECK: [[vector_ptr:%\w+]] = OpTypePointer Function [[vector]] +// ; CHECK: [[elem_ptr:%\w+]] = OpTypePointer Function [[elem]] +// ; CHECK: [[zero:%\w+]] = OpConstant [[elem]] 0 +// ; CHECK: [[undef:%\w+]] = OpUndef [[elem]] +// ; CHECK: [[two:%\w+]] = OpConstant [[elem]] 2 +// ; CHECK: [[null:%\w+]] = OpConstantNull [[elem]] +// ; CHECK-NOT: OpVariable [[vector_ptr]] +// ; CHECK: OpVariable [[elem_ptr]] Function [[zero]] +// ; CHECK-NOT: OpVariable [[elem_ptr]] Function [[undef]] +// ; CHECK-NEXT: OpVariable [[elem_ptr]] Function +// ; CHECK-NEXT: OpVariable [[elem_ptr]] Function [[two]] +// ; CHECK-NEXT: OpVariable [[elem_ptr]] Function [[null]] +// ; CHECK-NOT: OpVariable [[elem_ptr]] Function [[undef]] +// ; +// OpCapability Shader +// OpCapability Linkage +// OpMemoryModel Logical GLSL450 +// OpName %6 "vector_init" +// %1 = OpTypeVoid +// %2 = OpTypeInt 32 0 +// %3 = OpTypeVector %2 4 +// %4 = OpTypePointer Function %3 +// %20 = OpTypePointer Function %2 +// %6 = OpTypeFunction %1 +// %7 = OpConstant %2 0 +// %8 = OpUndef %2 +// %9 = OpConstant %2 2 +// %30 = OpConstant %2 1 +// %31 = OpConstant %2 3 +// %10 = OpConstantNull %2 +// %11 = OpConstantComposite %3 %10 %9 %8 %7 +// %12 = OpFunction %1 None %6 +// %13 = OpLabel +// %14 = OpVariable %4 Function %11 +// %15 = OpAccessChain %20 %14 %7 +// OpStore %15 %10 +// %16 = OpAccessChain %20 %14 %9 +// OpStore %16 %10 +// %17 = OpAccessChain %20 %14 %30 +// OpStore %17 %10 +// %18 = OpAccessChain %20 %14 %31 +// OpStore %18 %10 +// OpReturn +// OpFunctionEnd +// )"; +// +// SinglePassRunAndMatch(text, true); +// } +// +// TEST_F(ScalarReplacementTest, MatrixInitialization) { +// const std::string text = R"( +// ; +// ; CHECK: [[float:%\w+]] = OpTypeFloat 32 +// ; CHECK: [[vector:%\w+]] = OpTypeVector [[float]] 2 +// ; CHECK: [[matrix:%\w+]] = OpTypeMatrix [[vector]] 2 +// ; CHECK: [[matrix_ptr:%\w+]] = OpTypePointer Function [[matrix]] +// ; CHECK: [[float_ptr:%\w+]] = OpTypePointer Function [[float]] +// ; CHECK: [[vec_ptr:%\w+]] = OpTypePointer Function [[vector]] +// ; CHECK: [[zerof:%\w+]] = OpConstant [[float]] 0 +// ; CHECK: [[onef:%\w+]] = OpConstant [[float]] 1 +// ; CHECK: [[one_zero:%\w+]] = OpConstantComposite [[vector]] [[onef]] +// [[zerof]] ; CHECK: [[zero_one:%\w+]] = OpConstantComposite [[vector]] +// [[zerof]] [[onef]] ; CHECK: [[const_mat:%\w+]] = OpConstantComposite +// [[matrix]] [[one_zero]] +// [[zero_one]] ; CHECK-NOT: OpVariable [[matrix]] ; CHECK-NOT: OpVariable +// [[vector]] Function [[one_zero]] ; CHECK: [[f1:%\w+]] = OpVariable +// [[float_ptr]] Function [[zerof]] ; CHECK-NEXT: [[f2:%\w+]] = OpVariable +// [[float_ptr]] Function [[onef]] ; CHECK-NEXT: [[vec_var:%\w+]] = OpVariable +// [[vec_ptr]] Function [[zero_one]] ; CHECK-NOT: OpVariable [[matrix]] ; +// CHECK-NOT: OpVariable [[vector]] Function [[one_zero]] +// ; +// OpCapability Shader +// OpCapability Linkage +// OpMemoryModel Logical GLSL450 +// OpName %7 "matrix_init" +// %1 = OpTypeVoid +// %2 = OpTypeFloat 32 +// %3 = OpTypeVector %2 2 +// %4 = OpTypeMatrix %3 2 +// %5 = OpTypePointer Function %4 +// %6 = OpTypePointer Function %2 +// %30 = OpTypePointer Function %3 +// %10 = OpTypeInt 32 0 +// %7 = OpTypeFunction %1 %10 +// %8 = OpConstant %2 0.0 +// %9 = OpConstant %2 1.0 +// %11 = OpConstant %10 0 +// %12 = OpConstant %10 1 +// %13 = OpConstantComposite %3 %9 %8 +// %14 = OpConstantComposite %3 %8 %9 +// %15 = OpConstantComposite %4 %13 %14 +// %16 = OpFunction %1 None %7 +// %31 = OpFunctionParameter %10 +// %17 = OpLabel +// %18 = OpVariable %5 Function %15 +// %19 = OpAccessChain %6 %18 %11 %12 +// OpStore %19 %8 +// %20 = OpAccessChain %6 %18 %11 %11 +// OpStore %20 %8 +// %21 = OpAccessChain %30 %18 %12 +// OpStore %21 %14 +// OpReturn +// OpFunctionEnd +// )"; +// +// SinglePassRunAndMatch(text, true); +// } + +TEST_F(ScalarReplacementTest, ElideAccessChain) { + const std::string text = R"( +; +; CHECK: [[var:%\w+]] = OpVariable +; CHECK-NOT: OpAccessChain +; CHECK: OpStore [[var]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "elide_access_chain" +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %2 %2 %2 %2 +%4 = OpTypePointer Function %3 +%20 = OpTypePointer Function %2 +%6 = OpTypeFunction %1 +%7 = OpConstant %2 0 +%8 = OpUndef %2 +%9 = OpConstant %2 2 +%10 = OpConstantNull %2 +%11 = OpConstantComposite %3 %7 %8 %9 %10 +%12 = OpFunction %1 None %6 +%13 = OpLabel +%14 = OpVariable %4 Function %11 +%15 = OpAccessChain %20 %14 %7 +OpStore %15 %10 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ElideMultipleAccessChains) { + const std::string text = R"( +; +; CHECK: [[var:%\w+]] = OpVariable +; CHECK-NOT: OpInBoundsAccessChain +; CHECK OpStore [[var]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "elide_two_access_chains" +%1 = OpTypeVoid +%2 = OpTypeFloat 32 +%3 = OpTypeStruct %2 %2 +%4 = OpTypeStruct %3 %3 +%5 = OpTypePointer Function %4 +%6 = OpTypePointer Function %2 +%7 = OpTypeFunction %1 +%8 = OpConstant %2 0.0 +%9 = OpConstant %2 1.0 +%10 = OpTypeInt 32 0 +%11 = OpConstant %10 0 +%12 = OpConstant %10 1 +%13 = OpConstantComposite %3 %9 %8 +%14 = OpConstantComposite %3 %8 %9 +%15 = OpConstantComposite %4 %13 %14 +%16 = OpFunction %1 None %7 +%17 = OpLabel +%18 = OpVariable %5 Function %15 +%19 = OpInBoundsAccessChain %6 %18 %11 %12 +OpStore %19 %8 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceAccessChain) { + const std::string text = R"( +; +; CHECK: [[param:%\w+]] = OpFunctionParameter +; CHECK: [[var:%\w+]] = OpVariable +; CHECK: [[access:%\w+]] = OpAccessChain {{%\w+}} [[var]] [[param]] +; CHECK: OpStore [[access]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %7 "replace_access_chain" +%1 = OpTypeVoid +%2 = OpTypeFloat 32 +%10 = OpTypeInt 32 0 +%uint_2 = OpConstant %10 2 +%3 = OpTypeArray %2 %uint_2 +%4 = OpTypeStruct %3 %3 +%5 = OpTypePointer Function %4 +%20 = OpTypePointer Function %3 +%6 = OpTypePointer Function %2 +%7 = OpTypeFunction %1 %10 +%8 = OpConstant %2 0.0 +%9 = OpConstant %2 1.0 +%11 = OpConstant %10 0 +%12 = OpConstant %10 1 +%13 = OpConstantComposite %3 %9 %8 +%14 = OpConstantComposite %3 %8 %9 +%15 = OpConstantComposite %4 %13 %14 +%16 = OpFunction %1 None %7 +%32 = OpFunctionParameter %10 +%17 = OpLabel +%18 = OpVariable %5 Function %15 +%19 = OpAccessChain %6 %18 %11 %32 +OpStore %19 %8 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ArrayInitialization) { + const std::string text = R"( +; +; CHECK: [[float:%\w+]] = OpTypeFloat 32 +; CHECK: [[array:%\w+]] = OpTypeArray +; CHECK: [[array_ptr:%\w+]] = OpTypePointer Function [[array]] +; CHECK: [[float_ptr:%\w+]] = OpTypePointer Function [[float]] +; CHECK: [[float0:%\w+]] = OpConstant [[float]] 0 +; CHECK: [[float1:%\w+]] = OpConstant [[float]] 1 +; CHECK: [[float2:%\w+]] = OpConstant [[float]] 2 +; CHECK-NOT: OpVariable [[array_ptr]] +; CHECK: [[var0:%\w+]] = OpVariable [[float_ptr]] Function [[float0]] +; CHECK-NEXT: [[var1:%\w+]] = OpVariable [[float_ptr]] Function [[float1]] +; CHECK-NEXT: [[var2:%\w+]] = OpVariable [[float_ptr]] Function [[float2]] +; CHECK-NOT: OpVariable [[array_ptr]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "array_init" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 +%uint_3 = OpConstant %uint 3 +%float_array = OpTypeArray %float %uint_3 +%array_ptr = OpTypePointer Function %float_array +%float_ptr = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%const_array = OpConstantComposite %float_array %float_2 %float_1 %float_0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%3 = OpVariable %array_ptr Function %const_array +%4 = OpInBoundsAccessChain %float_ptr %3 %uint_0 +OpStore %4 %float_0 +%5 = OpInBoundsAccessChain %float_ptr %3 %uint_1 +OpStore %5 %float_0 +%6 = OpInBoundsAccessChain %float_ptr %3 %uint_2 +OpStore %6 %float_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, NonUniformCompositeInitialization) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[long:%\w+]] = OpTypeInt 64 1 +; CHECK: [[dvector:%\w+]] = OpTypeVector +; CHECK: [[vector:%\w+]] = OpTypeVector +; CHECK: [[array:%\w+]] = OpTypeArray +; CHECK: [[matrix:%\w+]] = OpTypeMatrix +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[vector]] +; CHECK: [[struct2:%\w+]] = OpTypeStruct [[struct1]] [[matrix]] [[array]] [[uint]] +; CHECK: [[struct1_ptr:%\w+]] = OpTypePointer Function [[struct1]] +; CHECK: [[matrix_ptr:%\w+]] = OpTypePointer Function [[matrix]] +; CHECK: [[array_ptr:%\w+]] = OpTypePointer Function [[array]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[struct2_ptr:%\w+]] = OpTypePointer Function [[struct2]] +; CHECK: [[const_array:%\w+]] = OpConstantComposite [[array]] +; CHECK: [[const_matrix:%\w+]] = OpConstantNull [[matrix]] +; CHECK: [[const_struct1:%\w+]] = OpConstantComposite [[struct1]] +; CHECK: OpConstantNull [[uint]] +; CHECK: OpConstantNull [[vector]] +; CHECK: OpConstantNull [[long]] +; CHECK: OpFunction +; CHECK-NOT: OpVariable [[struct2_ptr]] Function +; CHECK: OpVariable [[uint_ptr]] Function +; CHECK-NEXT: OpVariable [[matrix_ptr]] Function [[const_matrix]] +; CHECK-NOT: OpVariable [[struct1_ptr]] Function [[const_struct1]] +; CHECK-NOT: OpVariable [[struct2_ptr]] Function +; +OpCapability Shader +OpCapability Linkage +OpCapability Int64 +OpCapability Float64 +OpMemoryModel Logical GLSL450 +OpName %func "non_uniform_composite_init" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%int64 = OpTypeInt 64 1 +%float = OpTypeFloat 32 +%double = OpTypeFloat 64 +%double2 = OpTypeVector %double 2 +%float4 = OpTypeVector %float 4 +%int64_0 = OpConstant %int64 0 +%int64_1 = OpConstant %int64 1 +%int64_2 = OpConstant %int64 2 +%int64_3 = OpConstant %int64 3 +%int64_array3 = OpTypeArray %int64 %int64_3 +%matrix_double2 = OpTypeMatrix %double2 2 +%struct1 = OpTypeStruct %uint %float4 +%struct2 = OpTypeStruct %struct1 %matrix_double2 %int64_array3 %uint +%struct1_ptr = OpTypePointer Function %struct1 +%matrix_double2_ptr = OpTypePointer Function %matrix_double2 +%int64_array_ptr = OpTypePointer Function %int64_array3 +%uint_ptr = OpTypePointer Function %uint +%struct2_ptr = OpTypePointer Function %struct2 +%const_uint = OpConstant %uint 0 +%const_int64_array = OpConstantComposite %int64_array3 %int64_0 %int64_1 %int64_2 +%const_double2 = OpConstantNull %double2 +%const_matrix_double2 = OpConstantNull %matrix_double2 +%undef_float4 = OpUndef %float4 +%const_struct1 = OpConstantComposite %struct1 %const_uint %undef_float4 +%const_struct2 = OpConstantComposite %struct2 %const_struct1 %const_matrix_double2 %const_int64_array %const_uint +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct2_ptr Function %const_struct2 +%3 = OpAccessChain %struct1_ptr %var %int64_0 +OpStore %3 %const_struct1 +%4 = OpAccessChain %matrix_double2_ptr %var %int64_1 +OpStore %4 %const_matrix_double2 +%5 = OpAccessChain %int64_array_ptr %var %int64_2 +OpStore %5 %const_int64_array +%6 = OpAccessChain %uint_ptr %var %int64_3 +OpStore %6 %const_uint +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ElideUncombinedAccessChains) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[var:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK-NOT: OpAccessChain +; CHECK: OpStore [[var]] [[const]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "elide_uncombined_access_chains" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%struct2 = OpTypeStruct %struct1 +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%struct2_ptr = OpTypePointer Function %struct2 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct2_ptr Function +%3 = OpAccessChain %struct1_ptr %var %uint_0 +%4 = OpAccessChain %uint_ptr %3 %uint_0 +OpStore %4 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ElideSingleUncombinedAccessChains) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[array:%\w+]] = OpTypeArray [[uint]] +; CHECK: [[array_ptr:%\w+]] = OpTypePointer Function [[array]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[param:%\w+]] = OpFunctionParameter [[uint]] +; CHECK: [[var:%\w+]] = OpVariable [[array_ptr]] Function +; CHECK: [[access:%\w+]] = OpAccessChain {{.*}} [[var]] [[param]] +; CHECK: OpStore [[access]] [[const]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "elide_single_uncombined_access_chains" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%array = OpTypeArray %uint %uint_1 +%struct2 = OpTypeStruct %array +%uint_ptr = OpTypePointer Function %uint +%array_ptr = OpTypePointer Function %array +%struct2_ptr = OpTypePointer Function %struct2 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void %uint +%1 = OpFunction %void None %func +%param = OpFunctionParameter %uint +%2 = OpLabel +%var = OpVariable %struct2_ptr Function +%3 = OpAccessChain %array_ptr %var %uint_0 +%4 = OpAccessChain %uint_ptr %3 %param +OpStore %4 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceWholeLoad) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[var1:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var0:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[l1:%\w+]] = OpLoad [[uint]] [[var1]] +; CHECK: [[l0:%\w+]] = OpLoad [[uint]] [[var0]] +; CHECK: OpCompositeConstruct [[struct1]] [[l0]] [[l1]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_load" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%load = OpLoad %struct1 %var +%3 = OpAccessChain %uint_ptr %var %uint_0 +OpStore %3 %uint_0 +%4 = OpAccessChain %uint_ptr %var %uint_1 +OpStore %4 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceWholeLoadCopyMemoryAccess) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[null:%\w+]] = OpConstantNull [[uint]] +; CHECK: [[var0:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[l0:%\w+]] = OpLoad [[uint]] [[var0]] Nontemporal +; CHECK: OpCompositeConstruct [[struct1]] [[l0]] [[null]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_load_copy_memory_access" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%load = OpLoad %struct1 %var Nontemporal +%3 = OpAccessChain %uint_ptr %var %uint_0 +OpStore %3 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceWholeStore) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[const_struct:%\w+]] = OpConstantComposite [[struct1]] [[const]] [[const]] +; CHECK: [[var0:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[ex0:%\w+]] = OpCompositeExtract [[uint]] [[const_struct]] 0 +; CHECK: OpStore [[var0]] [[ex0]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_store" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%const_struct = OpConstantComposite %struct1 %uint_0 %uint_0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +OpStore %var %const_struct +%3 = OpAccessChain %uint_ptr %var %uint_0 +%4 = OpLoad %uint %3 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceWholeStoreCopyMemoryAccess) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[const_struct:%\w+]] = OpConstantComposite [[struct1]] [[const]] [[const]] +; CHECK: [[var0:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK-NOT: OpVariable +; CHECK: [[ex0:%\w+]] = OpCompositeExtract [[uint]] [[const_struct]] 0 +; CHECK: OpStore [[var0]] [[ex0]] Aligned 4 +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_store_copy_memory_access" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%const_struct = OpConstantComposite %struct1 %uint_0 %uint_0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +OpStore %var %const_struct Aligned 4 +%3 = OpAccessChain %uint_ptr %var %uint_0 +%4 = OpLoad %uint %3 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontTouchVolatileLoad) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "dont_touch_volatile_load" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpAccessChain %uint_ptr %var %uint_0 +%4 = OpLoad %uint %3 Volatile +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontTouchVolatileStore) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "dont_touch_volatile_store" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpAccessChain %uint_ptr %var %uint_0 +OpStore %3 %uint_0 Volatile +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontTouchSpecNonFunctionVariable) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Uniform [[struct]] +; CHECK: OpConstant +; CHECK-NEXT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "dont_touch_spec_constant_access_chain" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Uniform %uint +%struct1_ptr = OpTypePointer Uniform %struct1 +%uint_0 = OpConstant %uint 0 +%var = OpVariable %struct1_ptr Uniform +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%3 = OpAccessChain %uint_ptr %var %uint_0 +OpStore %3 %uint_0 Volatile +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontTouchSpecConstantAccessChain) { + const std::string text = R"( +; +; CHECK: [[array:%\w+]] = OpTypeArray +; CHECK: [[array_ptr:%\w+]] = OpTypePointer Function [[array]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[array_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "dont_touch_spec_constant_access_chain" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%array = OpTypeArray %uint %uint_1 +%uint_ptr = OpTypePointer Function %uint +%array_ptr = OpTypePointer Function %array +%uint_0 = OpConstant %uint 0 +%spec_const = OpSpecConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %array_ptr Function +%3 = OpAccessChain %uint_ptr %var %spec_const +OpStore %3 %uint_0 Volatile +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, NoPartialAccesses) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: OpLabel +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "no_partial_accesses" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%const = OpConstantNull %struct1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +OpStore %var %const +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontTouchPtrAccessChain) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "dont_touch_ptr_access_chain" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpPtrAccessChain %uint_ptr %var %uint_0 %uint_0 +OpStore %3 %uint_0 +%4 = OpAccessChain %uint_ptr %var %uint_0 +OpStore %4 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(ScalarReplacementTest, DontTouchInBoundsPtrAccessChain) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "dont_touch_in_bounds_ptr_access_chain" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpInBoundsPtrAccessChain %uint_ptr %var %uint_0 %uint_0 +OpStore %3 %uint_0 +%4 = OpInBoundsAccessChain %uint_ptr %var %uint_0 +OpStore %4 %uint_0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(ScalarReplacementTest, DonTouchAliasedDecoration) { + const std::string text = R"( +; +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[struct_ptr]] +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "aliased" +OpDecorate %var Aliased +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpAccessChain %uint_ptr %var %uint_0 +%4 = OpLoad %uint %3 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, CopyRestrictDecoration) { + const std::string text = R"( +; +; CHECK: OpName +; CHECK-NEXT: OpDecorate [[var0:%\w+]] Restrict +; CHECK-NEXT: OpDecorate [[var1:%\w+]] Restrict +; CHECK: [[int:%\w+]] = OpTypeInt +; CHECK: [[struct:%\w+]] = OpTypeStruct +; CHECK: [[int_ptr:%\w+]] = OpTypePointer Function [[int]] +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: [[var1]] = OpVariable [[int_ptr]] +; CHECK-NEXT: [[var0]] = OpVariable [[int_ptr]] +; CHECK-NOT: OpVariable [[struct_ptr]] +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "restrict" +OpDecorate %var Restrict +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpAccessChain %uint_ptr %var %uint_0 +%4 = OpLoad %uint %3 +%5 = OpAccessChain %uint_ptr %var %uint_1 +%6 = OpLoad %uint %5 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontClobberDecoratesOnSubtypes) { + const std::string text = R"( +; +; CHECK: OpDecorate [[array:%\w+]] ArrayStride 1 +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[array]] = OpTypeArray [[uint]] +; CHECK: [[array_ptr:%\w+]] = OpTypePointer Function [[array]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[array_ptr]] Function +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "array_stride" +OpDecorate %array ArrayStride 1 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%array = OpTypeArray %uint %uint_1 +%struct1 = OpTypeStruct %array +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void %uint +%1 = OpFunction %void None %func +%param = OpFunctionParameter %uint +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpAccessChain %uint_ptr %var %uint_0 %param +%4 = OpLoad %uint %3 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, DontCopyMemberDecorate) { + const std::string text = R"( +; +; CHECK-NOT: OpDecorate +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct:%\w+]] = OpTypeStruct [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[struct_ptr:%\w+]] = OpTypePointer Function [[struct]] +; CHECK: OpLabel +; CHECK-NEXT: OpVariable [[uint_ptr]] Function +; CHECK-NOT: OpVariable +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "member_decorate" +OpMemberDecorate %struct1 0 Offset 1 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%struct1 = OpTypeStruct %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%func = OpTypeFunction %void %uint +%1 = OpFunction %void None %func +%2 = OpLabel +%var = OpVariable %struct1_ptr Function +%3 = OpAccessChain %uint_ptr %var %uint_0 +%4 = OpLoad %uint %3 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, NoPartialAccesses2) { + const std::string text = R"( +; +; CHECK: [[float:%\w+]] = OpTypeFloat 32 +; CHECK: [[float_ptr:%\w+]] = OpTypePointer Function [[float]] +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK: OpVariable [[float_ptr]] Function +; CHECK-NOT: OpVariable +; +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %fo +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 430 +OpName %main "main" +OpName %S "S" +OpMemberName %S 0 "x" +OpMemberName %S 1 "y" +OpName %ts1 "ts1" +OpName %S_0 "S" +OpMemberName %S_0 0 "x" +OpMemberName %S_0 1 "y" +OpName %U_t "U_t" +OpMemberName %U_t 0 "g_s1" +OpMemberName %U_t 1 "g_s2" +OpMemberName %U_t 2 "g_s3" +OpName %_ "" +OpName %ts2 "ts2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpName %__0 "" +OpName %ts3 "ts3" +OpName %ts4 "ts4" +OpName %fo "fo" +OpMemberDecorate %S_0 0 Offset 0 +OpMemberDecorate %S_0 1 Offset 4 +OpMemberDecorate %U_t 0 Offset 0 +OpMemberDecorate %U_t 1 Offset 8 +OpMemberDecorate %U_t 2 Offset 16 +OpDecorate %U_t BufferBlock +OpDecorate %_ DescriptorSet 0 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpDecorate %_Globals_ Block +OpDecorate %__0 DescriptorSet 0 +OpDecorate %__0 Binding 0 +OpDecorate %fo Location 0 +%void = OpTypeVoid +%15 = OpTypeFunction %void +%float = OpTypeFloat 32 +%S = OpTypeStruct %float %float +%_ptr_Function_S = OpTypePointer Function %S +%S_0 = OpTypeStruct %float %float +%U_t = OpTypeStruct %S_0 %S_0 %S_0 +%_ptr_Uniform_U_t = OpTypePointer Uniform %U_t +%_ = OpVariable %_ptr_Uniform_U_t Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_S_0 = OpTypePointer Uniform %S_0 +%_ptr_Function_float = OpTypePointer Function %float +%int_1 = OpConstant %int 1 +%uint = OpTypeInt 32 0 +%_Globals_ = OpTypeStruct %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%__0 = OpVariable %_ptr_Uniform__Globals_ Uniform +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%_ptr_Output_float = OpTypePointer Output %float +%fo = OpVariable %_ptr_Output_float Output +%main = OpFunction %void None %15 +%30 = OpLabel +%ts1 = OpVariable %_ptr_Function_S Function +%ts2 = OpVariable %_ptr_Function_S Function +%ts3 = OpVariable %_ptr_Function_S Function +%ts4 = OpVariable %_ptr_Function_S Function +%31 = OpAccessChain %_ptr_Uniform_S_0 %_ %int_0 +%32 = OpLoad %S_0 %31 +%33 = OpCompositeExtract %float %32 0 +%34 = OpAccessChain %_ptr_Function_float %ts1 %int_0 +OpStore %34 %33 +%35 = OpCompositeExtract %float %32 1 +%36 = OpAccessChain %_ptr_Function_float %ts1 %int_1 +OpStore %36 %35 +%37 = OpAccessChain %_ptr_Uniform_S_0 %_ %int_1 +%38 = OpLoad %S_0 %37 +%39 = OpCompositeExtract %float %38 0 +%40 = OpAccessChain %_ptr_Function_float %ts2 %int_0 +OpStore %40 %39 +%41 = OpCompositeExtract %float %38 1 +%42 = OpAccessChain %_ptr_Function_float %ts2 %int_1 +OpStore %42 %41 +%43 = OpAccessChain %_ptr_Uniform_uint %__0 %int_0 +%44 = OpLoad %uint %43 +%45 = OpINotEqual %bool %44 %uint_0 +OpSelectionMerge %46 None +OpBranchConditional %45 %47 %48 +%47 = OpLabel +%49 = OpLoad %S %ts1 +OpStore %ts3 %49 +OpBranch %46 +%48 = OpLabel +%50 = OpLoad %S %ts2 +OpStore %ts3 %50 +OpBranch %46 +%46 = OpLabel +%51 = OpLoad %S %ts3 +OpStore %ts4 %51 +%52 = OpAccessChain %_ptr_Function_float %ts4 %int_1 +%53 = OpLoad %float %52 +OpStore %fo %53 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceWholeLoadAndStore) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[null:%\w+]] = OpConstantNull [[uint]] +; CHECK: [[var0:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var1:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK-NOT: OpVariable +; CHECK: [[l0:%\w+]] = OpLoad [[uint]] [[var0]] +; CHECK: [[c0:%\w+]] = OpCompositeConstruct [[struct1]] [[l0]] [[null]] +; CHECK: [[e0:%\w+]] = OpCompositeExtract [[uint]] [[c0]] 0 +; CHECK: OpStore [[var1]] [[e0]] +; CHECK: [[l1:%\w+]] = OpLoad [[uint]] [[var1]] +; CHECK: [[c1:%\w+]] = OpCompositeConstruct [[struct1]] [[l1]] [[null]] +; CHECK: [[e1:%\w+]] = OpCompositeExtract [[uint]] [[c1]] 0 +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_load" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var2 = OpVariable %struct1_ptr Function +%var1 = OpVariable %struct1_ptr Function +%load1 = OpLoad %struct1 %var1 +OpStore %var2 %load1 +%load2 = OpLoad %struct1 %var2 +%3 = OpCompositeExtract %uint %load2 0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, ReplaceWholeLoadAndStore2) { + // TODO: We can improve this case by ensuring that |var2| is processed first. + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[uint]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[null:%\w+]] = OpConstantNull [[uint]] +; CHECK: [[var1:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var0a:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var0b:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK-NOT: OpVariable +; CHECK: [[l0a:%\w+]] = OpLoad [[uint]] [[var0a]] +; CHECK: [[l0b:%\w+]] = OpLoad [[uint]] [[var0b]] +; CHECK: [[c0:%\w+]] = OpCompositeConstruct [[struct1]] [[l0b]] [[l0a]] +; CHECK: [[e0:%\w+]] = OpCompositeExtract [[uint]] [[c0]] 0 +; CHECK: OpStore [[var1]] [[e0]] +; CHECK: [[l1:%\w+]] = OpLoad [[uint]] [[var1]] +; CHECK: [[c1:%\w+]] = OpCompositeConstruct [[struct1]] [[l1]] [[null]] +; CHECK: [[e1:%\w+]] = OpCompositeExtract [[uint]] [[c1]] 0 +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_load" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct1 = OpTypeStruct %uint %uint +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var1 = OpVariable %struct1_ptr Function +%var2 = OpVariable %struct1_ptr Function +%load1 = OpLoad %struct1 %var1 +OpStore %var2 %load1 +%load2 = OpLoad %struct1 %var2 +%3 = OpCompositeExtract %uint %load2 0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, CreateAmbiguousNullConstant1) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[struct_member:%\w+]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[null:%\w+]] = OpConstantNull [[struct_member]] +; CHECK: [[var0a:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var1:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var0b:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK-NOT: OpVariable +; CHECK: OpStore [[var1]] +; CHECK: [[l1:%\w+]] = OpLoad [[uint]] [[var1]] +; CHECK: [[c1:%\w+]] = OpCompositeConstruct [[struct1]] [[l1]] [[null]] +; CHECK: [[e1:%\w+]] = OpCompositeExtract [[uint]] [[c1]] 0 +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_load" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct2 = OpTypeStruct %uint +%struct3 = OpTypeStruct %uint +%struct1 = OpTypeStruct %uint %struct2 +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var1 = OpVariable %struct1_ptr Function +%var2 = OpVariable %struct1_ptr Function +%load1 = OpLoad %struct1 %var1 +OpStore %var2 %load1 +%load2 = OpLoad %struct1 %var2 +%3 = OpCompositeExtract %uint %load2 0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} + +TEST_F(ScalarReplacementTest, CreateAmbiguousNullConstant2) { + const std::string text = R"( +; +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct1:%\w+]] = OpTypeStruct [[uint]] [[struct_member:%\w+]] +; CHECK: [[uint_ptr:%\w+]] = OpTypePointer Function [[uint]] +; CHECK: [[const:%\w+]] = OpConstant [[uint]] 0 +; CHECK: [[null:%\w+]] = OpConstantNull [[struct_member]] +; CHECK: [[var0a:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var1:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: [[var0b:%\w+]] = OpVariable [[uint_ptr]] Function +; CHECK: OpStore [[var1]] +; CHECK: [[l1:%\w+]] = OpLoad [[uint]] [[var1]] +; CHECK: [[c1:%\w+]] = OpCompositeConstruct [[struct1]] [[l1]] [[null]] +; CHECK: [[e1:%\w+]] = OpCompositeExtract [[uint]] [[c1]] 0 +; +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %func "replace_whole_load" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%struct3 = OpTypeStruct %uint +%struct2 = OpTypeStruct %uint +%struct1 = OpTypeStruct %uint %struct2 +%uint_ptr = OpTypePointer Function %uint +%struct1_ptr = OpTypePointer Function %struct1 +%uint_0 = OpConstant %uint 0 +%uint_1 = OpConstant %uint 1 +%func = OpTypeFunction %void +%1 = OpFunction %void None %func +%2 = OpLabel +%var1 = OpVariable %struct1_ptr Function +%var2 = OpVariable %struct1_ptr Function +%load1 = OpLoad %struct1 %var1 +OpStore %var2 %load1 +%load2 = OpLoad %struct1 %var2 +%3 = OpCompositeExtract %uint %load2 0 +OpReturn +OpFunctionEnd + )"; + + SinglePassRunAndMatch(text, true); +} +#endif // SPIRV_EFFCEE + +// Test that a struct of size 4 is not replaced when there is a limit of 2. +TEST_F(ScalarReplacementTest, TestLimit) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "simple_struct" +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %2 %2 %2 %2 +%4 = OpTypePointer Function %3 +%5 = OpTypePointer Function %2 +%6 = OpTypeFunction %2 +%7 = OpConstantNull %3 +%8 = OpConstant %2 0 +%9 = OpConstant %2 1 +%10 = OpConstant %2 2 +%11 = OpConstant %2 3 +%12 = OpFunction %2 None %6 +%13 = OpLabel +%14 = OpVariable %4 Function %7 +%15 = OpInBoundsAccessChain %5 %14 %8 +%16 = OpLoad %2 %15 +%17 = OpAccessChain %5 %14 %10 +%18 = OpLoad %2 %17 +%19 = OpIAdd %2 %16 %18 +OpReturnValue %19 +OpFunctionEnd + )"; + + auto result = + SinglePassRunAndDisassemble(text, true, false, 2); + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// Test that a struct of size 4 is replaced when there is a limit of 0 (no +// limit). This is the same spir-v as a test above, so we do not check that it +// is correctly transformed. We leave that to the test above. +TEST_F(ScalarReplacementTest, TestUnimited) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +OpName %6 "simple_struct" +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeStruct %2 %2 %2 %2 +%4 = OpTypePointer Function %3 +%5 = OpTypePointer Function %2 +%6 = OpTypeFunction %2 +%7 = OpConstantNull %3 +%8 = OpConstant %2 0 +%9 = OpConstant %2 1 +%10 = OpConstant %2 2 +%11 = OpConstant %2 3 +%12 = OpFunction %2 None %6 +%13 = OpLabel +%14 = OpVariable %4 Function %7 +%15 = OpInBoundsAccessChain %5 %14 %8 +%16 = OpLoad %2 %15 +%17 = OpAccessChain %5 %14 %10 +%18 = OpLoad %2 %17 +%19 = OpIAdd %2 %16 %18 +OpReturnValue %19 +OpFunctionEnd + )"; + + auto result = + SinglePassRunAndDisassemble(text, true, false, 0); + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp new file mode 100644 index 00000000000..161674fe027 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp @@ -0,0 +1,1077 @@ +// Copyright (c) 2016 Google 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. + +#include + +#include "gmock/gmock.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using testing::Eq; +using SpecIdToValueStrMap = + SetSpecConstantDefaultValuePass::SpecIdToValueStrMap; +using SpecIdToValueBitPatternMap = + SetSpecConstantDefaultValuePass::SpecIdToValueBitPatternMap; + +struct DefaultValuesStringParsingTestCase { + const char* default_values_str; + bool expect_success; + SpecIdToValueStrMap expected_map; +}; + +using DefaultValuesStringParsingTest = + ::testing::TestWithParam; + +TEST_P(DefaultValuesStringParsingTest, TestCase) { + const auto& tc = GetParam(); + auto actual_map = SetSpecConstantDefaultValuePass::ParseDefaultValuesString( + tc.default_values_str); + if (tc.expect_success) { + EXPECT_NE(nullptr, actual_map); + if (actual_map) { + EXPECT_THAT(*actual_map, Eq(tc.expected_map)); + } + } else { + EXPECT_EQ(nullptr, actual_map); + } +} + +INSTANTIATE_TEST_CASE_P( + ValidString, DefaultValuesStringParsingTest, + ::testing::ValuesIn(std::vector{ + // 0. empty map + {"", true, SpecIdToValueStrMap{}}, + // 1. one pair + {"100:1024", true, SpecIdToValueStrMap{{100, "1024"}}}, + // 2. two pairs + {"100:1024 200:2048", true, + SpecIdToValueStrMap{{100, "1024"}, {200, "2048"}}}, + // 3. spaces between entries + {"100:1024 \n \r \t \v \f 200:2048", true, + SpecIdToValueStrMap{{100, "1024"}, {200, "2048"}}}, + // 4. \t, \n, \r and spaces before spec id + {" \n \r\t \t \v \f 100:1024", true, + SpecIdToValueStrMap{{100, "1024"}}}, + // 5. \t, \n, \r and spaces after value string + {"100:1024 \n \r\t \t \v \f ", true, + SpecIdToValueStrMap{{100, "1024"}}}, + // 6. maximum spec id + {"4294967295:0", true, SpecIdToValueStrMap{{4294967295, "0"}}}, + // 7. minimum spec id + {"0:100", true, SpecIdToValueStrMap{{0, "100"}}}, + // 8. random content without spaces are allowed + {"200:random_stuff", true, SpecIdToValueStrMap{{200, "random_stuff"}}}, + // 9. support hex format spec id (just because we use the + // ParseNumber() utility) + {"0x100:1024", true, SpecIdToValueStrMap{{256, "1024"}}}, + // 10. multiple entries + {"101:1 102:2 103:3 104:4 200:201 9999:1000 0x100:333", true, + SpecIdToValueStrMap{{101, "1"}, + {102, "2"}, + {103, "3"}, + {104, "4"}, + {200, "201"}, + {9999, "1000"}, + {256, "333"}}}, + // 11. default value in hex float format + {"100:0x0.3p10", true, SpecIdToValueStrMap{{100, "0x0.3p10"}}}, + // 12. default value in decimal float format + {"100:1.5e-13", true, SpecIdToValueStrMap{{100, "1.5e-13"}}}, + })); + +INSTANTIATE_TEST_CASE_P( + InvalidString, DefaultValuesStringParsingTest, + ::testing::ValuesIn(std::vector{ + // 0. missing default value + {"100:", false, SpecIdToValueStrMap{}}, + // 1. spec id is not an integer + {"100.0:200", false, SpecIdToValueStrMap{}}, + // 2. spec id is not a number + {"something_not_a_number:1", false, SpecIdToValueStrMap{}}, + // 3. only spec id number + {"100", false, SpecIdToValueStrMap{}}, + // 4. same spec id defined multiple times + {"100:20 100:21", false, SpecIdToValueStrMap{}}, + // 5. Multiple definition of an identical spec id in different forms + // is not allowed + {"0x100:100 256:200", false, SpecIdToValueStrMap{}}, + // 6. empty spec id + {":3", false, SpecIdToValueStrMap{}}, + // 7. only colon + {":", false, SpecIdToValueStrMap{}}, + // 8. spec id overflow + {"4294967296:200", false, SpecIdToValueStrMap{}}, + // 9. spec id less than 0 + {"-1:200", false, SpecIdToValueStrMap{}}, + // 10. nullptr + {nullptr, false, SpecIdToValueStrMap{}}, + // 11. only a number is invalid + {"1234", false, SpecIdToValueStrMap{}}, + // 12. invalid entry separator + {"12:34;23:14", false, SpecIdToValueStrMap{}}, + // 13. invalid spec id and default value separator + {"12@34", false, SpecIdToValueStrMap{}}, + // 14. spaces before colon + {"100 :1024", false, SpecIdToValueStrMap{}}, + // 15. spaces after colon + {"100: 1024", false, SpecIdToValueStrMap{}}, + // 16. spec id represented in hex float format is invalid + {"0x3p10:200", false, SpecIdToValueStrMap{}}, + })); + +struct SetSpecConstantDefaultValueInStringFormTestCase { + const char* code; + SpecIdToValueStrMap default_values; + const char* expected; +}; + +using SetSpecConstantDefaultValueInStringFormParamTest = PassTest< + ::testing::TestWithParam>; + +TEST_P(SetSpecConstantDefaultValueInStringFormParamTest, TestCase) { + const auto& tc = GetParam(); + SinglePassRunAndCheck( + tc.code, tc.expected, /* skip_nop = */ false, tc.default_values); +} + +INSTANTIATE_TEST_CASE_P( + ValidCases, SetSpecConstantDefaultValueInStringFormParamTest, + ::testing::ValuesIn(std::vector< + SetSpecConstantDefaultValueInStringFormTestCase>{ + // 0. Empty. + {"", SpecIdToValueStrMap{}, ""}, + // 1. Empty with non-empty values to set. + {"", SpecIdToValueStrMap{{1, "100"}, {2, "200"}}, ""}, + // 2. Bool type. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n", + // default values + SpecIdToValueStrMap{{100, "false"}, {101, "true"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantFalse %bool\n" + "%2 = OpSpecConstantTrue %bool\n", + }, + // 3. 32-bit int type. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 10\n" + "%2 = OpSpecConstant %int 11\n" + "%3 = OpSpecConstant %int 11\n", + // default values + SpecIdToValueStrMap{ + {100, "2147483647"}, {101, "0xffffffff"}, {102, "-42"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 2147483647\n" + "%2 = OpSpecConstant %int -1\n" + "%3 = OpSpecConstant %int -42\n", + }, + // 4. 64-bit uint type. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %ulong 10\n" + "%2 = OpSpecConstant %ulong 11\n", + // default values + SpecIdToValueStrMap{{100, "18446744073709551614"}, {101, "0x100"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %ulong 18446744073709551614\n" + "%2 = OpSpecConstant %ulong 256\n", + }, + // 5. 32-bit float type. + { + // code + "OpDecorate %1 SpecId 101\n" + "OpDecorate %2 SpecId 102\n" + "%float = OpTypeFloat 32\n" + "%1 = OpSpecConstant %float 200\n" + "%2 = OpSpecConstant %float 201\n", + // default values + SpecIdToValueStrMap{{101, "-0x1.fffffep+128"}, {102, "2.5"}}, + // expected + "OpDecorate %1 SpecId 101\n" + "OpDecorate %2 SpecId 102\n" + "%float = OpTypeFloat 32\n" + "%1 = OpSpecConstant %float -0x1.fffffep+128\n" + "%2 = OpSpecConstant %float 2.5\n", + }, + // 6. 64-bit float type. + { + // code + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n" + "%2 = OpSpecConstant %double 0.14285\n", + // default values + SpecIdToValueStrMap{{201, "0x1.fffffffffffffp+1024"}, + {202, "-32.5"}}, + // expected + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 0x1.fffffffffffffp+1024\n" + "%2 = OpSpecConstant %double -32.5\n", + }, + // 7. SpecId not found, expect no modification. + { + // code + "OpDecorate %1 SpecId 201\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n", + // default values + SpecIdToValueStrMap{{8888, "0.0"}}, + // expected + "OpDecorate %1 SpecId 201\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n", + }, + // 8. Multiple types of spec constants. + { + // code + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "OpDecorate %3 SpecId 203\n" + "%bool = OpTypeBool\n" + "%int = OpTypeInt 32 1\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n" + "%2 = OpSpecConstant %int 1024\n" + "%3 = OpSpecConstantTrue %bool\n", + // default values + SpecIdToValueStrMap{ + {201, "0x1.fffffffffffffp+1024"}, + {202, "2048"}, + {203, "false"}, + }, + // expected + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "OpDecorate %3 SpecId 203\n" + "%bool = OpTypeBool\n" + "%int = OpTypeInt 32 1\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 0x1.fffffffffffffp+1024\n" + "%2 = OpSpecConstant %int 2048\n" + "%3 = OpSpecConstantFalse %bool\n", + }, + // 9. Ignore other decorations. + { + // code + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{4, "0x7fffffff"}}, + // expected + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 100\n", + }, + // 10. Distinguish from other decorations. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{4, "0x7fffffff"}, {100, "0xffffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int -1\n", + }, + // 11. Decorate through decoration group. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{100, "0x7fffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 2147483647\n", + }, + // 12. Ignore other decorations in decoration group. + { + // code + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{4, "0x7fffffff"}}, + // expected + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + }, + // 13. Distinguish from other decorations in decoration group. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{100, "0x7fffffff"}, {4, "0x00000001"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 2147483647\n", + }, + // 14. Unchanged bool default value + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n", + // default values + SpecIdToValueStrMap{{100, "true"}, {101, "false"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n", + }, + // 15. Unchanged int default values + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%int = OpTypeInt 32 1\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %int 10\n" + "%2 = OpSpecConstant %ulong 11\n", + // default values + SpecIdToValueStrMap{{100, "10"}, {101, "11"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%int = OpTypeInt 32 1\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %int 10\n" + "%2 = OpSpecConstant %ulong 11\n", + }, + // 16. Unchanged float default values + { + // code + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%float = OpTypeFloat 32\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %float 3.1415\n" + "%2 = OpSpecConstant %double 0.14285\n", + // default values + SpecIdToValueStrMap{{201, "3.1415"}, {202, "0.14285"}}, + // expected + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%float = OpTypeFloat 32\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %float 3.1415\n" + "%2 = OpSpecConstant %double 0.14285\n", + }, + // 17. OpGroupDecorate may have multiple target ids defined by the same + // eligible spec constant + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %2 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{100, "0xffffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %2 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int -1\n", + }, + })); + +INSTANTIATE_TEST_CASE_P( + InvalidCases, SetSpecConstantDefaultValueInStringFormParamTest, + ::testing::ValuesIn(std::vector< + SetSpecConstantDefaultValueInStringFormTestCase>{ + // 0. Do not crash when decoration group is not used. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueStrMap{{100, "0x7fffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 100\n", + }, + // 1. Do not crash when target does not exist. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n", + // default values + SpecIdToValueStrMap{{100, "0x7fffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n", + }, + // 2. Do nothing when SpecId decoration is not attached to a + // non-spec-constant instruction. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%int_101 = OpConstant %int 101\n", + // default values + SpecIdToValueStrMap{{100, "0x7fffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%int_101 = OpConstant %int 101\n", + }, + // 3. Do nothing when SpecId decoration is not attached to a + // OpSpecConstant{|True|False} instruction. + { + // code + "OpDecorate %1 SpecId 100\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 101\n" + "%1 = OpSpecConstantOp %int IAdd %3 %3\n", + // default values + SpecIdToValueStrMap{{100, "0x7fffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 101\n" + "%1 = OpSpecConstantOp %int IAdd %3 %3\n", + }, + // 4. Do not crash and do nothing when SpecId decoration is applied to + // multiple spec constants. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %3 %4\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n" + "%3 = OpSpecConstant %int 200\n" + "%4 = OpSpecConstant %int 300\n", + // default values + SpecIdToValueStrMap{{100, "0xffffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %3 %4\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n" + "%3 = OpSpecConstant %int 200\n" + "%4 = OpSpecConstant %int 300\n", + }, + // 5. Do not crash and do nothing when SpecId decoration is attached to + // non-spec-constants (invalid case). + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%2 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%int_100 = OpConstant %int 100\n", + // default values + SpecIdToValueStrMap{{100, "0xffffffff"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%2 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%int_100 = OpConstant %int 100\n", + }, + // 6. Boolean type spec constant cannot be set with numeric values in + // string form. i.e. only 'true' and 'false' are acceptable for setting + // boolean type spec constants. Nothing should be done if numeric values + // in string form are provided. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "OpDecorate %4 SpecId 103\n" + "OpDecorate %5 SpecId 104\n" + "OpDecorate %6 SpecId 105\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n" + "%3 = OpSpecConstantTrue %bool\n" + "%4 = OpSpecConstantTrue %bool\n" + "%5 = OpSpecConstantTrue %bool\n" + "%6 = OpSpecConstantFalse %bool\n", + // default values + SpecIdToValueStrMap{{100, "0"}, + {101, "1"}, + {102, "0x0"}, + {103, "0.0"}, + {104, "-0.0"}, + {105, "0x12345678"}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "OpDecorate %4 SpecId 103\n" + "OpDecorate %5 SpecId 104\n" + "OpDecorate %6 SpecId 105\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n" + "%3 = OpSpecConstantTrue %bool\n" + "%4 = OpSpecConstantTrue %bool\n" + "%5 = OpSpecConstantTrue %bool\n" + "%6 = OpSpecConstantFalse %bool\n", + }, + })); + +struct SetSpecConstantDefaultValueInBitPatternFormTestCase { + const char* code; + SpecIdToValueBitPatternMap default_values; + const char* expected; +}; + +using SetSpecConstantDefaultValueInBitPatternFormParamTest = + PassTest<::testing::TestWithParam< + SetSpecConstantDefaultValueInBitPatternFormTestCase>>; + +TEST_P(SetSpecConstantDefaultValueInBitPatternFormParamTest, TestCase) { + const auto& tc = GetParam(); + SinglePassRunAndCheck( + tc.code, tc.expected, /* skip_nop = */ false, tc.default_values); +} + +INSTANTIATE_TEST_CASE_P( + ValidCases, SetSpecConstantDefaultValueInBitPatternFormParamTest, + ::testing::ValuesIn(std::vector< + SetSpecConstantDefaultValueInBitPatternFormTestCase>{ + // 0. Empty. + {"", SpecIdToValueBitPatternMap{}, ""}, + // 1. Empty with non-empty values to set. + {"", SpecIdToValueBitPatternMap{{1, {100}}, {2, {200}}}, ""}, + // 2. Baisc bool type. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x0}}, {101, {0x1}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantFalse %bool\n" + "%2 = OpSpecConstantTrue %bool\n", + }, + // 3. 32-bit int type. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 10\n" + "%2 = OpSpecConstant %int 11\n" + "%3 = OpSpecConstant %int 11\n", + // default values + SpecIdToValueBitPatternMap{ + {100, {2147483647}}, {101, {0xffffffff}}, {102, {0xffffffd6}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 2147483647\n" + "%2 = OpSpecConstant %int -1\n" + "%3 = OpSpecConstant %int -42\n", + }, + // 4. 64-bit uint type. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %ulong 10\n" + "%2 = OpSpecConstant %ulong 11\n", + // default values + SpecIdToValueBitPatternMap{{100, {0xFFFFFFFE, 0xFFFFFFFF}}, + {101, {0x100, 0x0}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %ulong 18446744073709551614\n" + "%2 = OpSpecConstant %ulong 256\n", + }, + // 5. 32-bit float type. + { + // code + "OpDecorate %1 SpecId 101\n" + "OpDecorate %2 SpecId 102\n" + "%float = OpTypeFloat 32\n" + "%1 = OpSpecConstant %float 200\n" + "%2 = OpSpecConstant %float 201\n", + // default values + SpecIdToValueBitPatternMap{{101, {0xffffffff}}, + {102, {0x40200000}}}, + // expected + "OpDecorate %1 SpecId 101\n" + "OpDecorate %2 SpecId 102\n" + "%float = OpTypeFloat 32\n" + "%1 = OpSpecConstant %float -0x1.fffffep+128\n" + "%2 = OpSpecConstant %float 2.5\n", + }, + // 6. 64-bit float type. + { + // code + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n" + "%2 = OpSpecConstant %double 0.14285\n", + // default values + SpecIdToValueBitPatternMap{{201, {0xffffffff, 0x7fffffff}}, + {202, {0x00000000, 0xc0404000}}}, + // expected + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 0x1.fffffffffffffp+1024\n" + "%2 = OpSpecConstant %double -32.5\n", + }, + // 7. SpecId not found, expect no modification. + { + // code + "OpDecorate %1 SpecId 201\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n", + // default values + SpecIdToValueBitPatternMap{{8888, {0x0}}}, + // expected + "OpDecorate %1 SpecId 201\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n", + }, + // 8. Multiple types of spec constants. + { + // code + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "OpDecorate %3 SpecId 203\n" + "%bool = OpTypeBool\n" + "%int = OpTypeInt 32 1\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 3.14159265358979\n" + "%2 = OpSpecConstant %int 1024\n" + "%3 = OpSpecConstantTrue %bool\n", + // default values + SpecIdToValueBitPatternMap{ + {201, {0xffffffff, 0x7fffffff}}, + {202, {0x00000800}}, + {203, {0x0}}, + }, + // expected + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "OpDecorate %3 SpecId 203\n" + "%bool = OpTypeBool\n" + "%int = OpTypeInt 32 1\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %double 0x1.fffffffffffffp+1024\n" + "%2 = OpSpecConstant %int 2048\n" + "%3 = OpSpecConstantFalse %bool\n", + }, + // 9. Ignore other decorations. + { + // code + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{4, {0x7fffffff}}}, + // expected + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 100\n", + }, + // 10. Distinguish from other decorations. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{4, {0x7fffffff}}, {100, {0xffffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%int = OpTypeInt 32 1\n" + "%1 = OpSpecConstant %int -1\n", + }, + // 11. Decorate through decoration group. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x7fffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 2147483647\n", + }, + // 12. Ignore other decorations in decoration group. + { + // code + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{4, {0x7fffffff}}}, + // expected + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + }, + // 13. Distinguish from other decorations in decoration group. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x7fffffff}}, {4, {0x00000001}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %1 ArrayStride 4\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 2147483647\n", + }, + // 14. Unchanged bool default value + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x1}}, {101, {0x0}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n", + }, + // 15. Unchanged int default values + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%int = OpTypeInt 32 1\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %int 10\n" + "%2 = OpSpecConstant %ulong 11\n", + // default values + SpecIdToValueBitPatternMap{{100, {10}}, {101, {11, 0}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "%int = OpTypeInt 32 1\n" + "%ulong = OpTypeInt 64 0\n" + "%1 = OpSpecConstant %int 10\n" + "%2 = OpSpecConstant %ulong 11\n", + }, + // 16. Unchanged float default values + { + // code + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%float = OpTypeFloat 32\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %float 3.25\n" + "%2 = OpSpecConstant %double 1.25\n", + // default values + SpecIdToValueBitPatternMap{{201, {0x40500000}}, + {202, {0x00000000, 0x3ff40000}}}, + // expected + "OpDecorate %1 SpecId 201\n" + "OpDecorate %2 SpecId 202\n" + "%float = OpTypeFloat 32\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %float 3.25\n" + "%2 = OpSpecConstant %double 1.25\n", + }, + // 17. OpGroupDecorate may have multiple target ids defined by the same + // eligible spec constant + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %2 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{100, {0xffffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %2 %2\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int -1\n", + }, + // 18. For Boolean type spec constants,if any word in the bit pattern + // is not zero, it can be considered as a 'true', otherwise, it can be + // considered as a 'false'. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantTrue %bool\n" + "%2 = OpSpecConstantFalse %bool\n" + "%3 = OpSpecConstantFalse %bool\n", + // default values + SpecIdToValueBitPatternMap{ + {100, {0x0, 0x0, 0x0, 0x0}}, + {101, {0x10101010}}, + {102, {0x0, 0x0, 0x0, 0x2}}, + }, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%bool = OpTypeBool\n" + "%1 = OpSpecConstantFalse %bool\n" + "%2 = OpSpecConstantTrue %bool\n" + "%3 = OpSpecConstantTrue %bool\n", + }, + })); + +INSTANTIATE_TEST_CASE_P( + InvalidCases, SetSpecConstantDefaultValueInBitPatternFormParamTest, + ::testing::ValuesIn(std::vector< + SetSpecConstantDefaultValueInBitPatternFormTestCase>{ + // 0. Do not crash when decoration group is not used. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x7fffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 100\n", + }, + // 1. Do not crash when target does not exist. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x7fffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n", + }, + // 2. Do nothing when SpecId decoration is not attached to a + // non-spec-constant instruction. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%int_101 = OpConstant %int 101\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x7fffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%int = OpTypeInt 32 1\n" + "%int_101 = OpConstant %int 101\n", + }, + // 3. Do nothing when SpecId decoration is not attached to a + // OpSpecConstant{|True|False} instruction. + { + // code + "OpDecorate %1 SpecId 100\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 101\n" + "%1 = OpSpecConstantOp %int IAdd %3 %3\n", + // default values + SpecIdToValueBitPatternMap{{100, {0x7fffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%int = OpTypeInt 32 1\n" + "%3 = OpSpecConstant %int 101\n" + "%1 = OpSpecConstantOp %int IAdd %3 %3\n", + }, + // 4. Do not crash and do nothing when SpecId decoration is applied to + // multiple spec constants. + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %3 %4\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n" + "%3 = OpSpecConstant %int 200\n" + "%4 = OpSpecConstant %int 300\n", + // default values + SpecIdToValueBitPatternMap{{100, {0xffffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2 %3 %4\n" + "%int = OpTypeInt 32 1\n" + "%2 = OpSpecConstant %int 100\n" + "%3 = OpSpecConstant %int 200\n" + "%4 = OpSpecConstant %int 300\n", + }, + // 5. Do not crash and do nothing when SpecId decoration is attached to + // non-spec-constants (invalid case). + { + // code + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%2 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%int_100 = OpConstant %int 100\n", + // default values + SpecIdToValueBitPatternMap{{100, {0xffffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "%1 = OpDecorationGroup\n" + "%2 = OpDecorationGroup\n" + "OpGroupDecorate %1 %2\n" + "%int = OpTypeInt 32 1\n" + "%int_100 = OpConstant %int 100\n", + }, + // 6. Incompatible input bit pattern with the type. Nothing should be + // done in such a case. + { + // code + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%int = OpTypeInt 32 1\n" + "%ulong = OpTypeInt 64 0\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %int 100\n" + "%2 = OpSpecConstant %ulong 200\n" + "%3 = OpSpecConstant %double 3.141592653\n", + // default values + SpecIdToValueBitPatternMap{ + {100, {10, 0}}, {101, {11}}, {102, {0xffffffff}}}, + // expected + "OpDecorate %1 SpecId 100\n" + "OpDecorate %2 SpecId 101\n" + "OpDecorate %3 SpecId 102\n" + "%int = OpTypeInt 32 1\n" + "%ulong = OpTypeInt 64 0\n" + "%double = OpTypeFloat 64\n" + "%1 = OpSpecConstant %int 100\n" + "%2 = OpSpecConstant %ulong 200\n" + "%3 = OpSpecConstant %double 3.141592653\n", + }, + })); + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/simplification_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/simplification_test.cpp new file mode 100644 index 00000000000..b5ad26790a6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/simplification_test.cpp @@ -0,0 +1,210 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "source/opt/simplification_pass.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using SimplificationTest = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(SimplificationTest, StraightLineTest) { + // Testing that folding rules are combined in simple straight line code. + const std::string text = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %i %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %o "o" + OpDecorate %i Flat + OpDecorate %i Location 0 + OpDecorate %o Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 + %13 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %int_1 = OpConstant %int 1 +%_ptr_Input_v4int = OpTypePointer Input %v4int + %i = OpVariable %_ptr_Input_v4int Input +%_ptr_Output_int = OpTypePointer Output %int + %o = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %8 + %21 = OpLabel + %31 = OpCompositeInsert %v4int %int_1 %13 0 +; CHECK: [[load:%[a-zA-Z_\d]+]] = OpLoad + %23 = OpLoad %v4int %i + %33 = OpCompositeInsert %v4int %int_0 %23 0 + %35 = OpCompositeExtract %int %31 0 +; CHECK: [[extract:%[a-zA-Z_\d]+]] = OpCompositeExtract %int [[load]] 1 + %37 = OpCompositeExtract %int %33 1 +; CHECK: [[add:%[a-zA-Z_\d]+]] = OpIAdd %int %int_1 [[extract]] + %29 = OpIAdd %int %35 %37 + OpStore %o %29 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(SimplificationTest, AcrossBasicBlocks) { + // Testing that folding rules are combined across basic blocks. + const std::string text = R"(OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %i %o + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %i "i" + OpName %o "o" + OpDecorate %i Flat + OpDecorate %i Location 0 + OpDecorate %o Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 +%_ptr_Input_v4int = OpTypePointer Input %v4int + %i = OpVariable %_ptr_Input_v4int Input + %uint = OpTypeInt 32 0 + %uint_0 = OpConstant %uint 0 +%_ptr_Input_int = OpTypePointer Input %int + %int_10 = OpConstant %int 10 + %bool = OpTypeBool + %int_1 = OpConstant %int 1 +%_ptr_Output_int = OpTypePointer Output %int + %o = OpVariable %_ptr_Output_int Output + %main = OpFunction %void None %8 + %24 = OpLabel +; CHECK: [[load:%[a-zA-Z_\d]+]] = OpLoad %v4int %i + %25 = OpLoad %v4int %i + %41 = OpCompositeInsert %v4int %int_0 %25 0 + %27 = OpAccessChain %_ptr_Input_int %i %uint_0 + %28 = OpLoad %int %27 + %29 = OpSGreaterThan %bool %28 %int_10 + OpSelectionMerge %30 None + OpBranchConditional %29 %31 %32 + %31 = OpLabel + %43 = OpCopyObject %v4int %25 + OpBranch %30 + %32 = OpLabel + %45 = OpCopyObject %v4int %25 + OpBranch %30 + %30 = OpLabel + %50 = OpPhi %v4int %43 %31 %45 %32 +; CHECK: [[extract1:%[a-zA-Z_\d]+]] = OpCompositeExtract %int [[load]] 0 + %47 = OpCompositeExtract %int %50 0 +; CHECK: [[extract2:%[a-zA-Z_\d]+]] = OpCompositeExtract %int [[load]] 1 + %49 = OpCompositeExtract %int %41 1 +; CHECK: [[add:%[a-zA-Z_\d]+]] = OpIAdd %int [[extract1]] [[extract2]] + %39 = OpIAdd %int %47 %49 + OpStore %o %39 + OpReturn + OpFunctionEnd + +)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(SimplificationTest, ThroughLoops) { + // Testing that folding rules are applied multiple times to instructions + // to be able to propagate across loop iterations. + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %o %i + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 430 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %o "o" + OpName %i "i" + OpDecorate %o Location 0 + OpDecorate %i Flat + OpDecorate %i Location 0 + %void = OpTypeVoid + %8 = OpTypeFunction %void + %int = OpTypeInt 32 1 + %v4int = OpTypeVector %int 4 + %int_0 = OpConstant %int 0 +; CHECK: [[constant:%[a-zA-Z_\d]+]] = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %13 = OpConstantComposite %v4int %int_0 %int_0 %int_0 %int_0 + %bool = OpTypeBool +%_ptr_Output_int = OpTypePointer Output %int + %o = OpVariable %_ptr_Output_int Output +%_ptr_Input_v4int = OpTypePointer Input %v4int + %i = OpVariable %_ptr_Input_v4int Input + %68 = OpUndef %v4int + %main = OpFunction %void None %8 + %23 = OpLabel +; CHECK: [[load:%[a-zA-Z_\d]+]] = OpLoad %v4int %i + %load = OpLoad %v4int %i + OpBranch %24 + %24 = OpLabel + %67 = OpPhi %v4int %load %23 %64 %26 +; CHECK: OpLoopMerge [[merge_lab:%[a-zA-Z_\d]+]] + OpLoopMerge %25 %26 None + OpBranch %27 + %27 = OpLabel + %48 = OpCompositeExtract %int %67 0 + %30 = OpIEqual %bool %48 %int_0 + OpBranchConditional %30 %31 %25 + %31 = OpLabel + %50 = OpCompositeExtract %int %67 0 + %54 = OpCompositeExtract %int %67 1 + %58 = OpCompositeExtract %int %67 2 + %62 = OpCompositeExtract %int %67 3 + %64 = OpCompositeConstruct %v4int %50 %54 %58 %62 + OpBranch %26 + %26 = OpLabel + OpBranch %24 + %25 = OpLabel +; CHECK: [[merge_lab]] = OpLabel +; CHECK: [[extract:%[a-zA-Z_\d]+]] = OpCompositeExtract %int [[load]] 0 + %66 = OpCompositeExtract %int %67 0 +; CHECK-NEXT: OpStore %o [[extract]] + OpStore %o %66 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(text, false); +} + +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strength_reduction_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strength_reduction_test.cpp new file mode 100644 index 00000000000..654c90df955 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strength_reduction_test.cpp @@ -0,0 +1,440 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; +using StrengthReductionBasicTest = PassTest<::testing::Test>; + +// Test to make sure we replace 5*8. +TEST_F(StrengthReductionBasicTest, BasicReplaceMulBy8) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "%void = OpTypeVoid", + "%4 = OpTypeFunction %void", + "%uint = OpTypeInt 32 0", + "%uint_5 = OpConstant %uint 5", + "%uint_8 = OpConstant %uint 8", + "%main = OpFunction %void None %4", + "%8 = OpLabel", + "%9 = OpIMul %uint %uint_5 %uint_8", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + auto result = SinglePassRunAndDisassemble( + JoinAllInsts(text), /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); + const std::string& output = std::get<0>(result); + EXPECT_THAT(output, Not(HasSubstr("OpIMul"))); + EXPECT_THAT(output, HasSubstr("OpShiftLeftLogical %uint %uint_5 %uint_3")); +} + +// TODO(dneto): Add Effcee as required dependency, and make this unconditional. +#ifdef SPIRV_EFFCEE +// Test to make sure we replace 16*5 +// Also demonstrate use of Effcee matching. +TEST_F(StrengthReductionBasicTest, BasicReplaceMulBy16) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + %void = OpTypeVoid + %4 = OpTypeFunction %void +; We know disassembly will produce %uint here, but +; CHECK: %uint = OpTypeInt 32 0 +; CHECK-DAG: [[five:%[a-zA-Z_\d]+]] = OpConstant %uint 5 + +; We have RE2 regular expressions, so \w matches [_a-zA-Z0-9]. +; This shows the preferred pattern for matching SPIR-V identifiers. +; (We could have cheated in this case since we know the disassembler will +; generate the 'nice' name of "%uint_4". +; CHECK-DAG: [[four:%\w+]] = OpConstant %uint 4 + %uint = OpTypeInt 32 0 + %uint_5 = OpConstant %uint 5 + %uint_16 = OpConstant %uint 16 + %main = OpFunction %void None %4 +; CHECK: OpLabel + %8 = OpLabel +; CHECK-NEXT: OpShiftLeftLogical %uint [[five]] [[four]] +; The multiplication disappears. +; CHECK-NOT: OpIMul + %9 = OpIMul %uint %uint_16 %uint_5 + OpReturn +; CHECK: OpFunctionEnd + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} +#endif + +// Test to make sure we replace a multiple of 32 and 4. +TEST_F(StrengthReductionBasicTest, BasicTwoPowersOf2) { + // In this case, we have two powers of 2. Need to make sure we replace only + // one of them for the bit shift. + // clang-format off + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %main "main" + %void = OpTypeVoid + %4 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%int_32 = OpConstant %int 32 + %int_4 = OpConstant %int 4 + %main = OpFunction %void None %4 + %8 = OpLabel + %9 = OpIMul %int %int_32 %int_4 + OpReturn + OpFunctionEnd +)"; + // clang-format on + auto result = SinglePassRunAndDisassemble( + text, /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); + const std::string& output = std::get<0>(result); + EXPECT_THAT(output, Not(HasSubstr("OpIMul"))); + EXPECT_THAT(output, HasSubstr("OpShiftLeftLogical %int %int_4 %uint_5")); +} + +// Test to make sure we don't replace 0*5. +TEST_F(StrengthReductionBasicTest, BasicDontReplace0) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "%void = OpTypeVoid", + "%4 = OpTypeFunction %void", + "%int = OpTypeInt 32 1", + "%int_0 = OpConstant %int 0", + "%int_5 = OpConstant %int 5", + "%main = OpFunction %void None %4", + "%8 = OpLabel", + "%9 = OpIMul %int %int_0 %int_5", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + auto result = SinglePassRunAndDisassemble( + JoinAllInsts(text), /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// Test to make sure we do not replace a multiple of 5 and 7. +TEST_F(StrengthReductionBasicTest, BasicNoChange) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %2 \"main\"", + "OpName %2 \"main\"", + "%3 = OpTypeVoid", + "%4 = OpTypeFunction %3", + "%5 = OpTypeInt 32 1", + "%6 = OpTypeInt 32 0", + "%7 = OpConstant %5 5", + "%8 = OpConstant %5 7", + "%2 = OpFunction %3 None %4", + "%9 = OpLabel", + "%10 = OpIMul %5 %7 %8", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + auto result = SinglePassRunAndDisassemble( + JoinAllInsts(text), /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithoutChange, std::get<1>(result)); +} + +// Test to make sure constants and types are reused and not duplicated. +TEST_F(StrengthReductionBasicTest, NoDuplicateConstantsAndTypes) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "%void = OpTypeVoid", + "%4 = OpTypeFunction %void", + "%uint = OpTypeInt 32 0", + "%uint_8 = OpConstant %uint 8", + "%uint_3 = OpConstant %uint 3", + "%main = OpFunction %void None %4", + "%8 = OpLabel", + "%9 = OpIMul %uint %uint_8 %uint_3", + "OpReturn", + "OpFunctionEnd", + // clang-format on + }; + + auto result = SinglePassRunAndDisassemble( + JoinAllInsts(text), /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); + const std::string& output = std::get<0>(result); + EXPECT_THAT(output, + Not(MatchesRegex(".*OpConstant %uint 3.*OpConstant %uint 3.*"))); + EXPECT_THAT(output, Not(MatchesRegex(".*OpTypeInt 32 0.*OpTypeInt 32 0.*"))); +} + +// Test to make sure we generate the constants only once +TEST_F(StrengthReductionBasicTest, BasicCreateOneConst) { + const std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %main \"main\"", + "OpName %main \"main\"", + "%void = OpTypeVoid", + "%4 = OpTypeFunction %void", + "%uint = OpTypeInt 32 0", + "%uint_5 = OpConstant %uint 5", + "%uint_9 = OpConstant %uint 9", + "%uint_128 = OpConstant %uint 128", + "%main = OpFunction %void None %4", + "%8 = OpLabel", + "%9 = OpIMul %uint %uint_5 %uint_128", + "%10 = OpIMul %uint %uint_9 %uint_128", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + auto result = SinglePassRunAndDisassemble( + JoinAllInsts(text), /* skip_nop = */ true, /* do_validation = */ false); + + EXPECT_EQ(Pass::Status::SuccessWithChange, std::get<1>(result)); + const std::string& output = std::get<0>(result); + EXPECT_THAT(output, Not(HasSubstr("OpIMul"))); + EXPECT_THAT(output, HasSubstr("OpShiftLeftLogical %uint %uint_5 %uint_7")); + EXPECT_THAT(output, HasSubstr("OpShiftLeftLogical %uint %uint_9 %uint_7")); +} + +// Test to make sure we generate the instructions in the correct position and +// that the uses get replaced as well. Here we check that the use in the return +// is replaced, we also check that we can replace two OpIMuls when one feeds the +// other. +TEST_F(StrengthReductionBasicTest, BasicCheckPositionAndReplacement) { + // This is just the preamble to set up the test. + const std::vector common_text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpName %main \"main\"", + "OpName %foo_i1_ \"foo(i1;\"", + "OpName %n \"n\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "OpName %param \"param\"", + "OpDecorate %gl_FragColor Location 0", + "%void = OpTypeVoid", + "%3 = OpTypeFunction %void", + "%int = OpTypeInt 32 1", +"%_ptr_Function_int = OpTypePointer Function %int", + "%8 = OpTypeFunction %int %_ptr_Function_int", + "%int_256 = OpConstant %int 256", + "%int_2 = OpConstant %int 2", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + "%float_1 = OpConstant %float 1", + "%int_10 = OpConstant %int 10", + "%float_0_375 = OpConstant %float 0.375", + "%float_0_75 = OpConstant %float 0.75", + "%uint = OpTypeInt 32 0", + "%uint_8 = OpConstant %uint 8", + "%uint_1 = OpConstant %uint 1", + "%main = OpFunction %void None %3", + "%5 = OpLabel", + "%param = OpVariable %_ptr_Function_int Function", + "OpStore %param %int_10", + "%26 = OpFunctionCall %int %foo_i1_ %param", + "%27 = OpConvertSToF %float %26", + "%28 = OpFDiv %float %float_1 %27", + "%31 = OpCompositeConstruct %v4float %28 %float_0_375 %float_0_75 %float_1", + "OpStore %gl_FragColor %31", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + // This is the real test. The two OpIMul should be replaced. The expected + // output is in |foo_after|. + const std::vector foo_before = { + // clang-format off + "%foo_i1_ = OpFunction %int None %8", + "%n = OpFunctionParameter %_ptr_Function_int", + "%11 = OpLabel", + "%12 = OpLoad %int %n", + "%14 = OpIMul %int %12 %int_256", + "%16 = OpIMul %int %14 %int_2", + "OpReturnValue %16", + "OpFunctionEnd", + + // clang-format on + }; + + const std::vector foo_after = { + // clang-format off + "%foo_i1_ = OpFunction %int None %8", + "%n = OpFunctionParameter %_ptr_Function_int", + "%11 = OpLabel", + "%12 = OpLoad %int %n", + "%33 = OpShiftLeftLogical %int %12 %uint_8", + "%34 = OpShiftLeftLogical %int %33 %uint_1", + "OpReturnValue %34", + "OpFunctionEnd", + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + JoinAllInsts(Concat(common_text, foo_before)), + JoinAllInsts(Concat(common_text, foo_after)), + /* skip_nop = */ true, /* do_validate = */ true); +} + +// Test that, when the result of an OpIMul instruction has more than 1 use, and +// the instruction is replaced, all of the uses of the results are replace with +// the new result. +TEST_F(StrengthReductionBasicTest, BasicTestMultipleReplacements) { + // This is just the preamble to set up the test. + const std::vector common_text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Fragment %main \"main\" %gl_FragColor", + "OpExecutionMode %main OriginUpperLeft", + "OpName %main \"main\"", + "OpName %foo_i1_ \"foo(i1;\"", + "OpName %n \"n\"", + "OpName %gl_FragColor \"gl_FragColor\"", + "OpName %param \"param\"", + "OpDecorate %gl_FragColor Location 0", + "%void = OpTypeVoid", + "%3 = OpTypeFunction %void", + "%int = OpTypeInt 32 1", +"%_ptr_Function_int = OpTypePointer Function %int", + "%8 = OpTypeFunction %int %_ptr_Function_int", + "%int_256 = OpConstant %int 256", + "%int_2 = OpConstant %int 2", + "%float = OpTypeFloat 32", + "%v4float = OpTypeVector %float 4", +"%_ptr_Output_v4float = OpTypePointer Output %v4float", +"%gl_FragColor = OpVariable %_ptr_Output_v4float Output", + "%float_1 = OpConstant %float 1", + "%int_10 = OpConstant %int 10", + "%float_0_375 = OpConstant %float 0.375", + "%float_0_75 = OpConstant %float 0.75", + "%uint = OpTypeInt 32 0", + "%uint_8 = OpConstant %uint 8", + "%uint_1 = OpConstant %uint 1", + "%main = OpFunction %void None %3", + "%5 = OpLabel", + "%param = OpVariable %_ptr_Function_int Function", + "OpStore %param %int_10", + "%26 = OpFunctionCall %int %foo_i1_ %param", + "%27 = OpConvertSToF %float %26", + "%28 = OpFDiv %float %float_1 %27", + "%31 = OpCompositeConstruct %v4float %28 %float_0_375 %float_0_75 %float_1", + "OpStore %gl_FragColor %31", + "OpReturn", + "OpFunctionEnd" + // clang-format on + }; + + // This is the real test. The two OpIMul instructions should be replaced. In + // particular, we want to be sure that both uses of %16 are changed to use the + // new result. + const std::vector foo_before = { + // clang-format off + "%foo_i1_ = OpFunction %int None %8", + "%n = OpFunctionParameter %_ptr_Function_int", + "%11 = OpLabel", + "%12 = OpLoad %int %n", + "%14 = OpIMul %int %12 %int_256", + "%16 = OpIMul %int %14 %int_2", + "%17 = OpIAdd %int %14 %16", + "OpReturnValue %17", + "OpFunctionEnd", + + // clang-format on + }; + + const std::vector foo_after = { + // clang-format off + "%foo_i1_ = OpFunction %int None %8", + "%n = OpFunctionParameter %_ptr_Function_int", + "%11 = OpLabel", + "%12 = OpLoad %int %n", + "%34 = OpShiftLeftLogical %int %12 %uint_8", + "%35 = OpShiftLeftLogical %int %34 %uint_1", + "%17 = OpIAdd %int %34 %35", + "OpReturnValue %17", + "OpFunctionEnd", + // clang-format on + }; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck( + JoinAllInsts(Concat(common_text, foo_before)), + JoinAllInsts(Concat(common_text, foo_after)), + /* skip_nop = */ true, /* do_validate = */ true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp new file mode 100644 index 00000000000..f40ed382a6d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp @@ -0,0 +1,107 @@ +// Copyright (c) 2016 Google 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. + +#include + +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using StripLineDebugInfoTest = PassTest<::testing::Test>; + +TEST_F(StripLineDebugInfoTest, LineNoLine) { + std::vector text = { + // clang-format off + "OpCapability Shader", + "%1 = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint Vertex %2 \"main\"", + "%3 = OpString \"minimal.vert\"", + "OpModuleProcessed \"42\"", + "OpModuleProcessed \"43\"", + "OpModuleProcessed \"44\"", + "OpNoLine", + "OpLine %3 10 10", + "%void = OpTypeVoid", + "OpLine %3 100 100", + "%5 = OpTypeFunction %void", + "%2 = OpFunction %void None %5", + "OpLine %3 1 1", + "OpNoLine", + "OpLine %3 2 2", + "OpLine %3 3 3", + "%6 = OpLabel", + "OpLine %3 4 4", + "OpNoLine", + "OpReturn", + "OpLine %3 4 4", + "OpNoLine", + "OpFunctionEnd", + // clang-format on + }; + SinglePassRunAndCheck(JoinAllInsts(text), + JoinNonDebugInsts(text), + /* skip_nop = */ false); + + // Let's add more debug instruction before the "OpString" instruction. + const std::vector more_text = { + "OpSourceContinued \"I'm a happy shader! Yay! ;)\"", + "OpSourceContinued \"wahahaha\"", + "OpSource ESSL 310", + "OpSource ESSL 310", + "OpSourceContinued \"wahahaha\"", + "OpSourceContinued \"wahahaha\"", + "OpSourceExtension \"save-the-world-extension\"", + "OpName %2 \"main\"", + }; + text.insert(text.begin() + 4, more_text.cbegin(), more_text.cend()); + SinglePassRunAndCheck(JoinAllInsts(text), + JoinNonDebugInsts(text), + /* skip_nop = */ false); +} + +using StripDebugInfoTest = PassTest<::testing::TestWithParam>; + +TEST_P(StripDebugInfoTest, Kind) { + std::vector text = { + "OpCapability Shader", + "OpMemoryModel Logical GLSL450", + GetParam(), + }; + SinglePassRunAndCheck(JoinAllInsts(text), + JoinNonDebugInsts(text), + /* skip_nop = */ false); +} + +// Test each possible non-line debug instruction. +// clang-format off +INSTANTIATE_TEST_CASE_P( + SingleKindDebugInst, StripDebugInfoTest, + ::testing::ValuesIn(std::vector({ + "OpSourceContinued \"I'm a happy shader! Yay! ;)\"", + "OpSource ESSL 310", + "OpSourceExtension \"save-the-world-extension\"", + "OpName %main \"main\"", + "OpMemberName %struct 0 \"field\"", + "%1 = OpString \"name.vert\"", + "OpModuleProcessed \"42\"", + }))); +// clang-format on + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strip_reflect_info_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strip_reflect_info_test.cpp new file mode 100644 index 00000000000..088cac7aa54 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/strip_reflect_info_test.cpp @@ -0,0 +1,69 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using StripLineReflectInfoTest = PassTest<::testing::Test>; + +TEST_F(StripLineReflectInfoTest, StripHlslSemantic) { + // This is a non-sensical example, but exercises the instructions. + std::string before = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_decorate_string" +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpMemoryModel Logical Simple +OpDecorateStringGOOGLE %float HlslSemanticGOOGLE "foobar" +OpDecorateStringGOOGLE %void HlslSemanticGOOGLE "my goodness" +%void = OpTypeVoid +%float = OpTypeFloat 32 +)"; + std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical Simple +%void = OpTypeVoid +%float = OpTypeFloat 32 +)"; + + SinglePassRunAndCheck(before, after, false); +} + +TEST_F(StripLineReflectInfoTest, StripHlslCounterBuffer) { + std::string before = R"(OpCapability Shader +OpCapability Linkage +OpExtension "SPV_GOOGLE_hlsl_functionality1" +OpMemoryModel Logical Simple +OpDecorateId %void HlslCounterBufferGOOGLE %float +%void = OpTypeVoid +%float = OpTypeFloat 32 +)"; + std::string after = R"(OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical Simple +%void = OpTypeVoid +%float = OpTypeFloat 32 +)"; + + SinglePassRunAndCheck(before, after, false); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/type_manager_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/type_manager_test.cpp new file mode 100644 index 00000000000..cf1fcb583e9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/type_manager_test.cpp @@ -0,0 +1,1153 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source/opt/build_module.h" +#include "source/opt/instruction.h" +#include "source/opt/type_manager.h" +#include "spirv-tools/libspirv.hpp" + +#ifdef SPIRV_EFFCEE +#include "effcee/effcee.h" +#endif + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { + +#ifdef SPIRV_EFFCEE + +bool Validate(const std::vector& bin) { + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; + spv_context spvContext = spvContextCreate(target_env); + spv_diagnostic diagnostic = nullptr; + spv_const_binary_t binary = {bin.data(), bin.size()}; + spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); + if (error != 0) spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(spvContext); + return error == 0; +} + +void Match(const std::string& original, IRContext* context, + bool do_validation = true) { + std::vector bin; + context->module()->ToBinary(&bin, true); + if (do_validation) { + EXPECT_TRUE(Validate(bin)); + } + std::string assembly; + SpirvTools tools(SPV_ENV_UNIVERSAL_1_2); + EXPECT_TRUE( + tools.Disassemble(bin, &assembly, SpirvTools::kDefaultDisassembleOption)) + << "Disassembling failed for shader:\n" + << assembly << std::endl; + auto match_result = effcee::Match(assembly, original); + EXPECT_EQ(effcee::Result::Status::Ok, match_result.status()) + << match_result.message() << "\nChecking result:\n" + << assembly; +} + +#endif + +std::vector> GenerateAllTypes() { + // Types in this test case are only equal to themselves, nothing else. + std::vector> types; + + // Void, Bool + types.emplace_back(new Void()); + auto* voidt = types.back().get(); + types.emplace_back(new Bool()); + auto* boolt = types.back().get(); + + // Integer + types.emplace_back(new Integer(32, true)); + auto* s32 = types.back().get(); + types.emplace_back(new Integer(32, false)); + types.emplace_back(new Integer(64, true)); + types.emplace_back(new Integer(64, false)); + auto* u64 = types.back().get(); + + // Float + types.emplace_back(new Float(32)); + auto* f32 = types.back().get(); + types.emplace_back(new Float(64)); + + // Vector + types.emplace_back(new Vector(s32, 2)); + types.emplace_back(new Vector(s32, 3)); + auto* v3s32 = types.back().get(); + types.emplace_back(new Vector(u64, 4)); + types.emplace_back(new Vector(f32, 3)); + auto* v3f32 = types.back().get(); + + // Matrix + types.emplace_back(new Matrix(v3s32, 3)); + types.emplace_back(new Matrix(v3s32, 4)); + types.emplace_back(new Matrix(v3f32, 4)); + + // Images + types.emplace_back(new Image(s32, SpvDim2D, 0, 0, 0, 0, SpvImageFormatRg8, + SpvAccessQualifierReadOnly)); + auto* image1 = types.back().get(); + types.emplace_back(new Image(s32, SpvDim2D, 0, 1, 0, 0, SpvImageFormatRg8, + SpvAccessQualifierReadOnly)); + types.emplace_back(new Image(s32, SpvDim3D, 0, 1, 0, 0, SpvImageFormatRg8, + SpvAccessQualifierReadOnly)); + types.emplace_back(new Image(voidt, SpvDim3D, 0, 1, 0, 1, SpvImageFormatRg8, + SpvAccessQualifierReadWrite)); + auto* image2 = types.back().get(); + + // Sampler + types.emplace_back(new Sampler()); + + // Sampled Image + types.emplace_back(new SampledImage(image1)); + types.emplace_back(new SampledImage(image2)); + + // Array + types.emplace_back(new Array(f32, 100)); + types.emplace_back(new Array(f32, 42)); + auto* a42f32 = types.back().get(); + types.emplace_back(new Array(u64, 24)); + + // RuntimeArray + types.emplace_back(new RuntimeArray(v3f32)); + types.emplace_back(new RuntimeArray(v3s32)); + auto* rav3s32 = types.back().get(); + + // Struct + types.emplace_back(new Struct(std::vector{s32})); + types.emplace_back(new Struct(std::vector{s32, f32})); + auto* sts32f32 = types.back().get(); + types.emplace_back( + new Struct(std::vector{u64, a42f32, rav3s32})); + + // Opaque + types.emplace_back(new Opaque("")); + types.emplace_back(new Opaque("hello")); + types.emplace_back(new Opaque("world")); + + // Pointer + types.emplace_back(new Pointer(f32, SpvStorageClassInput)); + types.emplace_back(new Pointer(sts32f32, SpvStorageClassFunction)); + types.emplace_back(new Pointer(a42f32, SpvStorageClassFunction)); + + // Function + types.emplace_back(new Function(voidt, {})); + types.emplace_back(new Function(voidt, {boolt})); + types.emplace_back(new Function(voidt, {boolt, s32})); + types.emplace_back(new Function(s32, {boolt, s32})); + + // Event, Device Event, Reserve Id, Queue, + types.emplace_back(new Event()); + types.emplace_back(new DeviceEvent()); + types.emplace_back(new ReserveId()); + types.emplace_back(new Queue()); + + // Pipe, Forward Pointer, PipeStorage, NamedBarrier + types.emplace_back(new Pipe(SpvAccessQualifierReadWrite)); + types.emplace_back(new Pipe(SpvAccessQualifierReadOnly)); + types.emplace_back(new ForwardPointer(1, SpvStorageClassInput)); + types.emplace_back(new ForwardPointer(2, SpvStorageClassInput)); + types.emplace_back(new ForwardPointer(2, SpvStorageClassUniform)); + types.emplace_back(new PipeStorage()); + types.emplace_back(new NamedBarrier()); + + return types; +} + +TEST(TypeManager, TypeStrings) { + const std::string text = R"( + OpTypeForwardPointer !20 !2 ; id for %p is 20, Uniform is 2 + %void = OpTypeVoid + %bool = OpTypeBool + %u32 = OpTypeInt 32 0 + %id4 = OpConstant %u32 4 + %s32 = OpTypeInt 32 1 + %f64 = OpTypeFloat 64 + %v3u32 = OpTypeVector %u32 3 + %m3x3 = OpTypeMatrix %v3u32 3 + %img1 = OpTypeImage %s32 Cube 0 1 1 0 R32f ReadWrite + %img2 = OpTypeImage %s32 Cube 0 1 1 0 R32f + %sampler = OpTypeSampler + %si1 = OpTypeSampledImage %img1 + %si2 = OpTypeSampledImage %img2 + %a5u32 = OpTypeArray %u32 %id4 + %af64 = OpTypeRuntimeArray %f64 + %st1 = OpTypeStruct %u32 + %st2 = OpTypeStruct %f64 %s32 %v3u32 + %opaque1 = OpTypeOpaque "" + %opaque2 = OpTypeOpaque "opaque" + %p = OpTypePointer Uniform %st1 + %f = OpTypeFunction %void %u32 %u32 + %event = OpTypeEvent + %de = OpTypeDeviceEvent + %ri = OpTypeReserveId + %queue = OpTypeQueue + %pipe = OpTypePipe ReadOnly + %ps = OpTypePipeStorage + %nb = OpTypeNamedBarrier + )"; + + std::vector> type_id_strs = { + {1, "void"}, + {2, "bool"}, + {3, "uint32"}, + // Id 4 is used by the constant. + {5, "sint32"}, + {6, "float64"}, + {7, ""}, + {8, "<, 3>"}, + {9, "image(sint32, 3, 0, 1, 1, 0, 3, 2)"}, + {10, "image(sint32, 3, 0, 1, 1, 0, 3, 0)"}, + {11, "sampler"}, + {12, "sampled_image(image(sint32, 3, 0, 1, 1, 0, 3, 2))"}, + {13, "sampled_image(image(sint32, 3, 0, 1, 1, 0, 3, 0))"}, + {14, "[uint32, id(4)]"}, + {15, "[float64]"}, + {16, "{uint32}"}, + {17, "{float64, sint32, }"}, + {18, "opaque('')"}, + {19, "opaque('opaque')"}, + {20, "{uint32}*"}, + {21, "(uint32, uint32) -> void"}, + {22, "event"}, + {23, "device_event"}, + {24, "reserve_id"}, + {25, "queue"}, + {26, "pipe(0)"}, + {27, "pipe_storage"}, + {28, "named_barrier"}, + }; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + TypeManager manager(nullptr, context.get()); + + EXPECT_EQ(type_id_strs.size(), manager.NumTypes()); + + for (const auto& p : type_id_strs) { + EXPECT_EQ(p.second, manager.GetType(p.first)->str()); + EXPECT_EQ(p.first, manager.GetId(manager.GetType(p.first))); + } +} + +TEST(TypeManager, StructWithFwdPtr) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %7 "test" + OpSource OpenCL_C 102000 + OpDecorate %11 FuncParamAttr NoCapture + %11 = OpDecorationGroup + OpGroupDecorate %11 %8 %9 + OpTypeForwardPointer %100 CrossWorkgroup + %void = OpTypeVoid + %150 = OpTypeStruct %100 +%100 = OpTypePointer CrossWorkgroup %150 + %6 = OpTypeFunction %void %100 %100 + %7 = OpFunction %void Pure %6 + %8 = OpFunctionParameter %100 + %9 = OpFunctionParameter %100 + %10 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + TypeManager manager(nullptr, context.get()); + + Type* p100 = manager.GetType(100); + Type* s150 = manager.GetType(150); + + EXPECT_TRUE(p100->AsPointer()); + EXPECT_EQ(p100->AsPointer()->pointee_type(), s150); + + EXPECT_TRUE(s150->AsStruct()); + EXPECT_EQ(s150->AsStruct()->element_types()[0], p100); +} + +TEST(TypeManager, CircularFwdPtr) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %7 "test" + OpSource OpenCL_C 102000 + OpDecorate %11 FuncParamAttr NoCapture + %11 = OpDecorationGroup + OpGroupDecorate %11 %8 %9 + OpTypeForwardPointer %100 CrossWorkgroup + OpTypeForwardPointer %200 CrossWorkgroup + %void = OpTypeVoid + %int = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %150 = OpTypeStruct %200 %int + %250 = OpTypeStruct %100 %float +%100 = OpTypePointer CrossWorkgroup %150 +%200 = OpTypePointer CrossWorkgroup %250 + %6 = OpTypeFunction %void %100 %200 + %7 = OpFunction %void Pure %6 + %8 = OpFunctionParameter %100 + %9 = OpFunctionParameter %200 + %10 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + TypeManager manager(nullptr, context.get()); + + Type* p100 = manager.GetType(100); + Type* s150 = manager.GetType(150); + Type* p200 = manager.GetType(200); + Type* s250 = manager.GetType(250); + + EXPECT_TRUE(p100->AsPointer()); + EXPECT_EQ(p100->AsPointer()->pointee_type(), s150); + + EXPECT_TRUE(p200->AsPointer()); + EXPECT_EQ(p200->AsPointer()->pointee_type(), s250); + + EXPECT_TRUE(s150->AsStruct()); + EXPECT_EQ(s150->AsStruct()->element_types()[0], p200); + + EXPECT_TRUE(s250->AsStruct()); + EXPECT_EQ(s250->AsStruct()->element_types()[0], p100); +} + +TEST(TypeManager, IsomorphicStructWithFwdPtr) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %7 "test" + OpSource OpenCL_C 102000 + OpDecorate %11 FuncParamAttr NoCapture + %11 = OpDecorationGroup + OpGroupDecorate %11 %8 %9 + OpTypeForwardPointer %100 CrossWorkgroup + OpTypeForwardPointer %200 CrossWorkgroup + %void = OpTypeVoid + %_struct_1 = OpTypeStruct %100 + %_struct_2 = OpTypeStruct %200 +%100 = OpTypePointer CrossWorkgroup %_struct_1 +%200 = OpTypePointer CrossWorkgroup %_struct_2 + %6 = OpTypeFunction %void %100 %200 + %7 = OpFunction %void Pure %6 + %8 = OpFunctionParameter %100 + %9 = OpFunctionParameter %200 + %10 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + TypeManager manager(nullptr, context.get()); + + EXPECT_EQ(manager.GetType(100), manager.GetType(200)); +} + +TEST(TypeManager, IsomorphicCircularFwdPtr) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %7 "test" + OpSource OpenCL_C 102000 + OpDecorate %11 FuncParamAttr NoCapture + %11 = OpDecorationGroup + OpGroupDecorate %11 %8 %9 + OpTypeForwardPointer %100 CrossWorkgroup + OpTypeForwardPointer %200 CrossWorkgroup + OpTypeForwardPointer %300 CrossWorkgroup + OpTypeForwardPointer %400 CrossWorkgroup + %void = OpTypeVoid + %int = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %150 = OpTypeStruct %200 %int + %250 = OpTypeStruct %100 %float + %350 = OpTypeStruct %400 %int + %450 = OpTypeStruct %300 %float +%100 = OpTypePointer CrossWorkgroup %150 +%200 = OpTypePointer CrossWorkgroup %250 +%300 = OpTypePointer CrossWorkgroup %350 +%400 = OpTypePointer CrossWorkgroup %450 + %6 = OpTypeFunction %void %100 %200 + %7 = OpFunction %void Pure %6 + %8 = OpFunctionParameter %100 + %9 = OpFunctionParameter %200 + %10 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + TypeManager manager(nullptr, context.get()); + + Type* p100 = manager.GetType(100); + Type* p300 = manager.GetType(300); + EXPECT_EQ(p100, p300); + Type* p200 = manager.GetType(200); + Type* p400 = manager.GetType(400); + EXPECT_EQ(p200, p400); + + Type* p150 = manager.GetType(150); + Type* p350 = manager.GetType(350); + EXPECT_EQ(p150, p350); + Type* p250 = manager.GetType(250); + Type* p450 = manager.GetType(450); + EXPECT_EQ(p250, p450); +} + +TEST(TypeManager, PartialIsomorphicFwdPtr) { + const std::string text = R"( + OpCapability Addresses + OpCapability Kernel + %1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL + OpEntryPoint Kernel %7 "test" + OpSource OpenCL_C 102000 + OpDecorate %11 FuncParamAttr NoCapture + %11 = OpDecorationGroup + OpGroupDecorate %11 %8 %9 + OpTypeForwardPointer %100 CrossWorkgroup + OpTypeForwardPointer %200 CrossWorkgroup + %void = OpTypeVoid + %int = OpTypeInt 32 0 + %float = OpTypeFloat 32 + %150 = OpTypeStruct %200 %int + %250 = OpTypeStruct %200 %int +%100 = OpTypePointer CrossWorkgroup %150 +%200 = OpTypePointer CrossWorkgroup %250 + %6 = OpTypeFunction %void %100 %200 + %7 = OpFunction %void Pure %6 + %8 = OpFunctionParameter %100 + %9 = OpFunctionParameter %200 + %10 = OpLabel + OpReturn + OpFunctionEnd + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + TypeManager manager(nullptr, context.get()); + + Type* p100 = manager.GetType(100); + Type* p200 = manager.GetType(200); + EXPECT_EQ(p100->AsPointer()->pointee_type(), + p200->AsPointer()->pointee_type()); +} + +TEST(TypeManager, DecorationOnStruct) { + const std::string text = R"( + OpDecorate %struct1 Block + OpDecorate %struct2 Block + OpDecorate %struct3 Block + OpDecorate %struct4 Block + + %u32 = OpTypeInt 32 0 ; id: 5 + %f32 = OpTypeFloat 32 ; id: 6 + %struct1 = OpTypeStruct %u32 %f32 ; base + %struct2 = OpTypeStruct %f32 %u32 ; different member order + %struct3 = OpTypeStruct %f32 ; different member list + %struct4 = OpTypeStruct %u32 %f32 ; the same + %struct7 = OpTypeStruct %f32 ; no decoration + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + TypeManager manager(nullptr, context.get()); + + ASSERT_EQ(7u, manager.NumTypes()); + // Make sure we get ids correct. + ASSERT_EQ("uint32", manager.GetType(5)->str()); + ASSERT_EQ("float32", manager.GetType(6)->str()); + + // Try all combinations of pairs. Expect to be the same type only when the + // same id or (1, 4). + for (const auto id1 : {1, 2, 3, 4, 7}) { + for (const auto id2 : {1, 2, 3, 4, 7}) { + if (id1 == id2 || (id1 == 1 && id2 == 4) || (id1 == 4 && id2 == 1)) { + EXPECT_TRUE(manager.GetType(id1)->IsSame(manager.GetType(id2))) + << "%struct" << id1 << " is expected to be the same as %struct" + << id2; + } else { + EXPECT_FALSE(manager.GetType(id1)->IsSame(manager.GetType(id2))) + << "%struct" << id1 << " is expected to be different with %struct" + << id2; + } + } + } +} + +TEST(TypeManager, DecorationOnMember) { + const std::string text = R"( + OpMemberDecorate %struct1 0 Offset 0 + OpMemberDecorate %struct2 0 Offset 0 + OpMemberDecorate %struct3 0 Offset 0 + OpMemberDecorate %struct4 0 Offset 0 + OpMemberDecorate %struct5 1 Offset 0 + OpMemberDecorate %struct6 0 Offset 4 + + OpDecorate %struct7 Block + OpMemberDecorate %struct7 0 Offset 0 + + %u32 = OpTypeInt 32 0 ; id: 8 + %f32 = OpTypeFloat 32 ; id: 9 + %struct1 = OpTypeStruct %u32 %f32 ; base + %struct2 = OpTypeStruct %f32 %u32 ; different member order + %struct3 = OpTypeStruct %f32 ; different member list + %struct4 = OpTypeStruct %u32 %f32 ; the same + %struct5 = OpTypeStruct %u32 %f32 ; member decorate different field + %struct6 = OpTypeStruct %u32 %f32 ; different member decoration parameter + %struct7 = OpTypeStruct %u32 %f32 ; extra decoration on the struct + %struct10 = OpTypeStruct %u32 %f32 ; no member decoration + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + TypeManager manager(nullptr, context.get()); + + ASSERT_EQ(10u, manager.NumTypes()); + // Make sure we get ids correct. + ASSERT_EQ("uint32", manager.GetType(8)->str()); + ASSERT_EQ("float32", manager.GetType(9)->str()); + + // Try all combinations of pairs. Expect to be the same type only when the + // same id or (1, 4). + for (const auto id1 : {1, 2, 3, 4, 5, 6, 7, 10}) { + for (const auto id2 : {1, 2, 3, 4, 5, 6, 7, 10}) { + if (id1 == id2 || (id1 == 1 && id2 == 4) || (id1 == 4 && id2 == 1)) { + EXPECT_TRUE(manager.GetType(id1)->IsSame(manager.GetType(id2))) + << "%struct" << id1 << " is expected to be the same as %struct" + << id2; + } else { + EXPECT_FALSE(manager.GetType(id1)->IsSame(manager.GetType(id2))) + << "%struct" << id1 << " is expected to be different with %struct" + << id2; + } + } + } +} + +TEST(TypeManager, DecorationEmpty) { + const std::string text = R"( + OpDecorate %struct1 Block + OpMemberDecorate %struct2 0 Offset 0 + + %u32 = OpTypeInt 32 0 ; id: 3 + %f32 = OpTypeFloat 32 ; id: 4 + %struct1 = OpTypeStruct %u32 %f32 + %struct2 = OpTypeStruct %f32 %u32 + %struct5 = OpTypeStruct %f32 + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + TypeManager manager(nullptr, context.get()); + + ASSERT_EQ(5u, manager.NumTypes()); + // Make sure we get ids correct. + ASSERT_EQ("uint32", manager.GetType(3)->str()); + ASSERT_EQ("float32", manager.GetType(4)->str()); + + // %struct1 with decoration on itself + EXPECT_FALSE(manager.GetType(1)->decoration_empty()); + // %struct2 with decoration on its member + EXPECT_FALSE(manager.GetType(2)->decoration_empty()); + EXPECT_TRUE(manager.GetType(3)->decoration_empty()); + EXPECT_TRUE(manager.GetType(4)->decoration_empty()); + // %struct5 has no decorations + EXPECT_TRUE(manager.GetType(5)->decoration_empty()); +} + +TEST(TypeManager, BeginEndForEmptyModule) { + const std::string text = ""; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + TypeManager manager(nullptr, context.get()); + ASSERT_EQ(0u, manager.NumTypes()); + + EXPECT_EQ(manager.begin(), manager.end()); +} + +TEST(TypeManager, BeginEnd) { + const std::string text = R"( + %void1 = OpTypeVoid + %void2 = OpTypeVoid + %bool = OpTypeBool + %u32 = OpTypeInt 32 0 + %f64 = OpTypeFloat 64 + )"; + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_1, nullptr, text); + TypeManager manager(nullptr, context.get()); + ASSERT_EQ(5u, manager.NumTypes()); + + EXPECT_NE(manager.begin(), manager.end()); + for (const auto& t : manager) { + switch (t.first) { + case 1: + case 2: + EXPECT_EQ("void", t.second->str()); + break; + case 3: + EXPECT_EQ("bool", t.second->str()); + break; + case 4: + EXPECT_EQ("uint32", t.second->str()); + break; + case 5: + EXPECT_EQ("float64", t.second->str()); + break; + default: + EXPECT_TRUE(false && "unreachable"); + break; + } + } +} + +TEST(TypeManager, LookupType) { + const std::string text = R"( +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%int = OpTypeInt 32 1 +%vec2 = OpTypeVector %int 2 +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(context, nullptr); + TypeManager manager(nullptr, context.get()); + + Void voidTy; + EXPECT_EQ(manager.GetId(&voidTy), 1u); + + Integer uintTy(32, false); + EXPECT_EQ(manager.GetId(&uintTy), 2u); + + Integer intTy(32, true); + EXPECT_EQ(manager.GetId(&intTy), 3u); + + Integer intTy2(32, true); + Vector vecTy(&intTy2, 2u); + EXPECT_EQ(manager.GetId(&vecTy), 4u); +} + +TEST(TypeManager, RemoveId) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 32 1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + context->get_type_mgr()->RemoveId(1u); + ASSERT_EQ(context->get_type_mgr()->GetType(1u), nullptr); + ASSERT_NE(context->get_type_mgr()->GetType(2u), nullptr); + + context->get_type_mgr()->RemoveId(2u); + ASSERT_EQ(context->get_type_mgr()->GetType(1u), nullptr); + ASSERT_EQ(context->get_type_mgr()->GetType(2u), nullptr); +} + +TEST(TypeManager, RemoveIdNonDuplicateAmbiguousType) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + Integer u32(32, false); + Struct st({&u32}); + ASSERT_EQ(context->get_type_mgr()->GetId(&st), 2u); + context->get_type_mgr()->RemoveId(2u); + ASSERT_EQ(context->get_type_mgr()->GetType(2u), nullptr); + ASSERT_EQ(context->get_type_mgr()->GetId(&st), 0u); +} + +TEST(TypeManager, RemoveIdDuplicateAmbiguousType) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 +%3 = OpTypeStruct %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + Integer u32(32, false); + Struct st({&u32}); + uint32_t id = context->get_type_mgr()->GetId(&st); + ASSERT_NE(id, 0u); + uint32_t toRemove = id == 2u ? 2u : 3u; + uint32_t toStay = id == 2u ? 3u : 2u; + context->get_type_mgr()->RemoveId(toRemove); + ASSERT_EQ(context->get_type_mgr()->GetType(toRemove), nullptr); + ASSERT_EQ(context->get_type_mgr()->GetId(&st), toStay); +} + +TEST(TypeManager, RemoveIdDoesntUnmapOtherTypes) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 +%3 = OpTypeStruct %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + Integer u32(32, false); + Struct st({&u32}); + + EXPECT_EQ(1u, context->get_type_mgr()->GetId(&u32)); + uint32_t id = context->get_type_mgr()->GetId(&st); + ASSERT_NE(id, 0u); + uint32_t toRemove = id == 2u ? 3u : 2u; + uint32_t toStay = id == 2u ? 2u : 3u; + context->get_type_mgr()->RemoveId(toRemove); + ASSERT_EQ(context->get_type_mgr()->GetType(toRemove), nullptr); + ASSERT_EQ(context->get_type_mgr()->GetId(&st), toStay); +} + +TEST(TypeManager, GetTypeAndPointerType) { + const std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + Integer u32(32, false); + Pointer u32Ptr(&u32, SpvStorageClassFunction); + Struct st({&u32}); + Pointer stPtr(&st, SpvStorageClassInput); + + auto pair = context->get_type_mgr()->GetTypeAndPointerType( + 3u, SpvStorageClassFunction); + ASSERT_EQ(nullptr, pair.first); + ASSERT_EQ(nullptr, pair.second); + + pair = context->get_type_mgr()->GetTypeAndPointerType( + 1u, SpvStorageClassFunction); + ASSERT_TRUE(pair.first->IsSame(&u32)); + ASSERT_TRUE(pair.second->IsSame(&u32Ptr)); + + pair = + context->get_type_mgr()->GetTypeAndPointerType(2u, SpvStorageClassInput); + ASSERT_TRUE(pair.first->IsSame(&st)); + ASSERT_TRUE(pair.second->IsSame(&stPtr)); +} + +TEST(TypeManager, DuplicateType) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 32 0 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + const Type* type1 = context->get_type_mgr()->GetType(1u); + const Type* type2 = context->get_type_mgr()->GetType(2u); + EXPECT_NE(type1, nullptr); + EXPECT_NE(type2, nullptr); + EXPECT_EQ(*type1, *type2); +} + +TEST(TypeManager, MultipleStructs) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpDecorate %3 Constant +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 +%3 = OpTypeStruct %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + const Type* type1 = context->get_type_mgr()->GetType(2u); + const Type* type2 = context->get_type_mgr()->GetType(3u); + EXPECT_NE(type1, nullptr); + EXPECT_NE(type2, nullptr); + EXPECT_FALSE(type1->IsSame(type2)); +} + +TEST(TypeManager, RemovingIdAvoidsUseAfterFree) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + Integer u32(32, false); + Struct st({&u32}); + const Type* type = context->get_type_mgr()->GetType(2u); + EXPECT_NE(type, nullptr); + context->get_type_mgr()->RemoveId(1u); + EXPECT_TRUE(type->IsSame(&st)); +} + +TEST(TypeManager, RegisterAndRemoveId) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + uint32_t id = 2u; + { + // Ensure that u32 goes out of scope. + Integer u32(32, false); + Struct st({&u32}); + context->get_type_mgr()->RegisterType(id, st); + } + + context->get_type_mgr()->RemoveId(id); + EXPECT_EQ(nullptr, context->get_type_mgr()->GetType(id)); +} + +TEST(TypeManager, RegisterAndRemoveIdAllTypes) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + std::vector> types = GenerateAllTypes(); + uint32_t id = 1u; + for (auto& t : types) { + context->get_type_mgr()->RegisterType(id, *t); + EXPECT_EQ(*t, *context->get_type_mgr()->GetType(id)); + } + types.clear(); + + for (; id > 0; --id) { + context->get_type_mgr()->RemoveId(id); + EXPECT_EQ(nullptr, context->get_type_mgr()->GetType(id)); + } +} + +TEST(TypeManager, RegisterAndRemoveIdWithDecorations) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 0 +)"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + uint32_t id = 2u; + { + Integer u32(32, false); + Struct st({&u32, &u32}); + st.AddDecoration({10}); + st.AddDecoration({11}); + st.AddMemberDecoration(0, {{35, 4}}); + st.AddMemberDecoration(1, {{35, 4}}); + st.AddMemberDecoration(1, {{36, 5}}); + context->get_type_mgr()->RegisterType(id, st); + EXPECT_EQ(st, *context->get_type_mgr()->GetType(id)); + } + + context->get_type_mgr()->RemoveId(id); + EXPECT_EQ(nullptr, context->get_type_mgr()->GetType(id)); +} + +#ifdef SPIRV_EFFCEE +TEST(TypeManager, GetTypeInstructionInt) { + const std::string text = R"( +; CHECK: OpTypeInt 32 0 +; CHECK: OpTypeInt 16 1 +OpCapability Shader +OpCapability Int16 +OpCapability Linkage +OpMemoryModel Logical GLSL450 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(context, nullptr); + + Integer uint_32(32, false); + context->get_type_mgr()->GetTypeInstruction(&uint_32); + + Integer int_16(16, true); + context->get_type_mgr()->GetTypeInstruction(&int_16); + + Match(text, context.get()); +} + +TEST(TypeManager, GetTypeInstructionDuplicateInts) { + const std::string text = R"( +; CHECK: OpTypeInt 32 0 +; CHECK-NOT: OpType +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + EXPECT_NE(context, nullptr); + + Integer uint_32(32, false); + uint32_t id = context->get_type_mgr()->GetTypeInstruction(&uint_32); + + Integer other(32, false); + EXPECT_EQ(context->get_type_mgr()->GetTypeInstruction(&other), id); + + Match(text, context.get()); +} + +TEST(TypeManager, GetTypeInstructionAllTypes) { + const std::string text = R"( +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[input_ptr:%\w+]] = OpTypePointer Input [[uint]] +; CHECK: [[uniform_ptr:%\w+]] = OpTypePointer Uniform [[uint]] +; CHECK: [[uint24:%\w+]] = OpConstant [[uint]] 24 +; CHECK: [[uint42:%\w+]] = OpConstant [[uint]] 42 +; CHECK: [[uint100:%\w+]] = OpConstant [[uint]] 100 +; CHECK: [[void:%\w+]] = OpTypeVoid +; CHECK: [[bool:%\w+]] = OpTypeBool +; CHECK: [[s32:%\w+]] = OpTypeInt 32 1 +; CHECK: OpTypeInt 64 1 +; CHECK: [[u64:%\w+]] = OpTypeInt 64 0 +; CHECK: [[f32:%\w+]] = OpTypeFloat 32 +; CHECK: OpTypeFloat 64 +; CHECK: OpTypeVector [[s32]] 2 +; CHECK: [[v3s32:%\w+]] = OpTypeVector [[s32]] 3 +; CHECK: OpTypeVector [[u64]] 4 +; CHECK: [[v3f32:%\w+]] = OpTypeVector [[f32]] 3 +; CHECK: OpTypeMatrix [[v3s32]] 3 +; CHECK: OpTypeMatrix [[v3s32]] 4 +; CHECK: OpTypeMatrix [[v3f32]] 4 +; CHECK: [[image1:%\w+]] = OpTypeImage [[s32]] 2D 0 0 0 0 Rg8 ReadOnly +; CHECK: OpTypeImage [[s32]] 2D 0 1 0 0 Rg8 ReadOnly +; CHECK: OpTypeImage [[s32]] 3D 0 1 0 0 Rg8 ReadOnly +; CHECK: [[image2:%\w+]] = OpTypeImage [[void]] 3D 0 1 0 1 Rg8 ReadWrite +; CHECK: OpTypeSampler +; CHECK: OpTypeSampledImage [[image1]] +; CHECK: OpTypeSampledImage [[image2]] +; CHECK: OpTypeArray [[f32]] [[uint100]] +; CHECK: [[a42f32:%\w+]] = OpTypeArray [[f32]] [[uint42]] +; CHECK: OpTypeArray [[u64]] [[uint24]] +; CHECK: OpTypeRuntimeArray [[v3f32]] +; CHECK: [[rav3s32:%\w+]] = OpTypeRuntimeArray [[v3s32]] +; CHECK: OpTypeStruct [[s32]] +; CHECK: [[sts32f32:%\w+]] = OpTypeStruct [[s32]] [[f32]] +; CHECK: OpTypeStruct [[u64]] [[a42f32]] [[rav3s32]] +; CHECK: OpTypeOpaque "" +; CHECK: OpTypeOpaque "hello" +; CHECK: OpTypeOpaque "world" +; CHECK: OpTypePointer Input [[f32]] +; CHECK: OpTypePointer Function [[sts32f32]] +; CHECK: OpTypePointer Function [[a42f32]] +; CHECK: OpTypeFunction [[void]] +; CHECK: OpTypeFunction [[void]] [[bool]] +; CHECK: OpTypeFunction [[void]] [[bool]] [[s32]] +; CHECK: OpTypeFunction [[s32]] [[bool]] [[s32]] +; CHECK: OpTypeEvent +; CHECK: OpTypeDeviceEvent +; CHECK: OpTypeReserveId +; CHECK: OpTypeQueue +; CHECK: OpTypePipe ReadWrite +; CHECK: OpTypePipe ReadOnly +; CHECK: OpTypeForwardPointer [[input_ptr]] Input +; CHECK: OpTypeForwardPointer [[uniform_ptr]] Input +; CHECK: OpTypeForwardPointer [[uniform_ptr]] Uniform +; CHECK: OpTypePipeStorage +; CHECK: OpTypeNamedBarrier +OpCapability Shader +OpCapability Int64 +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%uint = OpTypeInt 32 0 +%1 = OpTypePointer Input %uint +%2 = OpTypePointer Uniform %uint +%24 = OpConstant %uint 24 +%42 = OpConstant %uint 42 +%100 = OpConstant %uint 100 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + std::vector> types = GenerateAllTypes(); + for (auto& t : types) { + context->get_type_mgr()->GetTypeInstruction(t.get()); + } + + Match(text, context.get(), false); +} + +TEST(TypeManager, GetTypeInstructionWithDecorations) { + const std::string text = R"( +; CHECK: OpDecorate [[struct:%\w+]] CPacked +; CHECK: OpMemberDecorate [[struct]] 1 Offset 4 +; CHECK: [[uint:%\w+]] = OpTypeInt 32 0 +; CHECK: [[struct]] = OpTypeStruct [[uint]] [[uint]] +OpCapability Shader +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%uint = OpTypeInt 32 0 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + Integer u32(32, false); + Struct st({&u32, &u32}); + st.AddDecoration({10}); + st.AddMemberDecoration(1, {{35, 4}}); + (void)context->get_def_use_mgr(); + context->get_type_mgr()->GetTypeInstruction(&st); + + Match(text, context.get()); +} + +TEST(TypeManager, GetPointerToAmbiguousType1) { + const std::string text = R"( +; CHECK: [[struct1:%\w+]] = OpTypeStruct +; CHECK: [[struct2:%\w+]] = OpTypeStruct +; CHECK: OpTypePointer Function [[struct2]] +; CHECK: OpTypePointer Function [[struct1]] +OpCapability Shader +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%uint = OpTypeInt 32 0 +%1 = OpTypeStruct %uint +%2 = OpTypeStruct %uint +%3 = OpTypePointer Function %2 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + context->get_type_mgr()->FindPointerToType(1, SpvStorageClassFunction); + Match(text, context.get()); +} + +TEST(TypeManager, GetPointerToAmbiguousType2) { + const std::string text = R"( +; CHECK: [[struct1:%\w+]] = OpTypeStruct +; CHECK: [[struct2:%\w+]] = OpTypeStruct +; CHECK: OpTypePointer Function [[struct1]] +; CHECK: OpTypePointer Function [[struct2]] +OpCapability Shader +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%uint = OpTypeInt 32 0 +%1 = OpTypeStruct %uint +%2 = OpTypeStruct %uint +%3 = OpTypePointer Function %1 + )"; + + std::unique_ptr context = + BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + EXPECT_NE(context, nullptr); + + context->get_type_mgr()->FindPointerToType(2, SpvStorageClassFunction); + Match(text, context.get()); +} +#endif // SPIRV_EFFCEE + +} // namespace +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/types_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/types_test.cpp new file mode 100644 index 00000000000..c11187e8340 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/types_test.cpp @@ -0,0 +1,344 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include + +#include "gtest/gtest.h" +#include "source/opt/types.h" +#include "source/util/make_unique.h" + +namespace spvtools { +namespace opt { +namespace analysis { +namespace { + +// Fixture class providing some element types. +class SameTypeTest : public ::testing::Test { + protected: + void SetUp() override { + void_t_ = MakeUnique(); + u32_t_ = MakeUnique(32, false); + f64_t_ = MakeUnique(64); + v3u32_t_ = MakeUnique(u32_t_.get(), 3); + image_t_ = + MakeUnique(f64_t_.get(), SpvDim2D, 1, 1, 0, 0, SpvImageFormatR16, + SpvAccessQualifierReadWrite); + } + + // Element types to be used for constructing other types for testing. + std::unique_ptr void_t_; + std::unique_ptr u32_t_; + std::unique_ptr f64_t_; + std::unique_ptr v3u32_t_; + std::unique_ptr image_t_; +}; + +#define TestMultipleInstancesOfTheSameType(ty, ...) \ + TEST_F(SameTypeTest, MultiSame##ty) { \ + std::vector> types; \ + for (int i = 0; i < 10; ++i) types.emplace_back(new ty(__VA_ARGS__)); \ + for (size_t i = 0; i < types.size(); ++i) { \ + for (size_t j = 0; j < types.size(); ++j) { \ + EXPECT_TRUE(types[i]->IsSame(types[j].get())) \ + << "expected '" << types[i]->str() << "' is the same as '" \ + << types[j]->str() << "'"; \ + EXPECT_TRUE(*types[i] == *types[j]) \ + << "expected '" << types[i]->str() << "' is the same as '" \ + << types[j]->str() << "'"; \ + } \ + } \ + } +TestMultipleInstancesOfTheSameType(Void); +TestMultipleInstancesOfTheSameType(Bool); +TestMultipleInstancesOfTheSameType(Integer, 32, true); +TestMultipleInstancesOfTheSameType(Float, 64); +TestMultipleInstancesOfTheSameType(Vector, u32_t_.get(), 3); +TestMultipleInstancesOfTheSameType(Matrix, v3u32_t_.get(), 4); +TestMultipleInstancesOfTheSameType(Image, f64_t_.get(), SpvDimCube, 0, 0, 1, 1, + SpvImageFormatRgb10A2, + SpvAccessQualifierWriteOnly); +TestMultipleInstancesOfTheSameType(Sampler); +TestMultipleInstancesOfTheSameType(SampledImage, image_t_.get()); +TestMultipleInstancesOfTheSameType(Array, u32_t_.get(), 10); +TestMultipleInstancesOfTheSameType(RuntimeArray, u32_t_.get()); +TestMultipleInstancesOfTheSameType(Struct, std::vector{ + u32_t_.get(), f64_t_.get()}); +TestMultipleInstancesOfTheSameType(Opaque, "testing rocks"); +TestMultipleInstancesOfTheSameType(Pointer, u32_t_.get(), SpvStorageClassInput); +TestMultipleInstancesOfTheSameType(Function, u32_t_.get(), + {f64_t_.get(), f64_t_.get()}); +TestMultipleInstancesOfTheSameType(Event); +TestMultipleInstancesOfTheSameType(DeviceEvent); +TestMultipleInstancesOfTheSameType(ReserveId); +TestMultipleInstancesOfTheSameType(Queue); +TestMultipleInstancesOfTheSameType(Pipe, SpvAccessQualifierReadWrite); +TestMultipleInstancesOfTheSameType(ForwardPointer, 10, SpvStorageClassUniform); +TestMultipleInstancesOfTheSameType(PipeStorage); +TestMultipleInstancesOfTheSameType(NamedBarrier); +#undef TestMultipleInstanceOfTheSameType + +std::vector> GenerateAllTypes() { + // Types in this test case are only equal to themselves, nothing else. + std::vector> types; + + // Forward Pointer + types.emplace_back(new ForwardPointer(10000, SpvStorageClassInput)); + types.emplace_back(new ForwardPointer(20000, SpvStorageClassInput)); + + // Void, Bool + types.emplace_back(new Void()); + auto* voidt = types.back().get(); + types.emplace_back(new Bool()); + auto* boolt = types.back().get(); + + // Integer + types.emplace_back(new Integer(32, true)); + auto* s32 = types.back().get(); + types.emplace_back(new Integer(32, false)); + types.emplace_back(new Integer(64, true)); + types.emplace_back(new Integer(64, false)); + auto* u64 = types.back().get(); + + // Float + types.emplace_back(new Float(32)); + auto* f32 = types.back().get(); + types.emplace_back(new Float(64)); + + // Vector + types.emplace_back(new Vector(s32, 2)); + types.emplace_back(new Vector(s32, 3)); + auto* v3s32 = types.back().get(); + types.emplace_back(new Vector(u64, 4)); + types.emplace_back(new Vector(f32, 3)); + auto* v3f32 = types.back().get(); + + // Matrix + types.emplace_back(new Matrix(v3s32, 3)); + types.emplace_back(new Matrix(v3s32, 4)); + types.emplace_back(new Matrix(v3f32, 4)); + + // Images + types.emplace_back(new Image(s32, SpvDim2D, 0, 0, 0, 0, SpvImageFormatRg8, + SpvAccessQualifierReadOnly)); + auto* image1 = types.back().get(); + types.emplace_back(new Image(s32, SpvDim2D, 0, 1, 0, 0, SpvImageFormatRg8, + SpvAccessQualifierReadOnly)); + types.emplace_back(new Image(s32, SpvDim3D, 0, 1, 0, 0, SpvImageFormatRg8, + SpvAccessQualifierReadOnly)); + types.emplace_back(new Image(voidt, SpvDim3D, 0, 1, 0, 1, SpvImageFormatRg8, + SpvAccessQualifierReadWrite)); + auto* image2 = types.back().get(); + + // Sampler + types.emplace_back(new Sampler()); + + // Sampled Image + types.emplace_back(new SampledImage(image1)); + types.emplace_back(new SampledImage(image2)); + + // Array + types.emplace_back(new Array(f32, 100)); + types.emplace_back(new Array(f32, 42)); + auto* a42f32 = types.back().get(); + types.emplace_back(new Array(u64, 24)); + + // RuntimeArray + types.emplace_back(new RuntimeArray(v3f32)); + types.emplace_back(new RuntimeArray(v3s32)); + auto* rav3s32 = types.back().get(); + + // Struct + types.emplace_back(new Struct(std::vector{s32})); + types.emplace_back(new Struct(std::vector{s32, f32})); + auto* sts32f32 = types.back().get(); + types.emplace_back( + new Struct(std::vector{u64, a42f32, rav3s32})); + + // Opaque + types.emplace_back(new Opaque("")); + types.emplace_back(new Opaque("hello")); + types.emplace_back(new Opaque("world")); + + // Pointer + types.emplace_back(new Pointer(f32, SpvStorageClassInput)); + types.emplace_back(new Pointer(sts32f32, SpvStorageClassFunction)); + types.emplace_back(new Pointer(a42f32, SpvStorageClassFunction)); + types.emplace_back(new Pointer(voidt, SpvStorageClassFunction)); + + // Function + types.emplace_back(new Function(voidt, {})); + types.emplace_back(new Function(voidt, {boolt})); + types.emplace_back(new Function(voidt, {boolt, s32})); + types.emplace_back(new Function(s32, {boolt, s32})); + + // Event, Device Event, Reserve Id, Queue, + types.emplace_back(new Event()); + types.emplace_back(new DeviceEvent()); + types.emplace_back(new ReserveId()); + types.emplace_back(new Queue()); + + // Pipe, Forward Pointer, PipeStorage, NamedBarrier + types.emplace_back(new Pipe(SpvAccessQualifierReadWrite)); + types.emplace_back(new Pipe(SpvAccessQualifierReadOnly)); + types.emplace_back(new ForwardPointer(1, SpvStorageClassInput)); + types.emplace_back(new ForwardPointer(2, SpvStorageClassInput)); + types.emplace_back(new ForwardPointer(2, SpvStorageClassUniform)); + types.emplace_back(new PipeStorage()); + types.emplace_back(new NamedBarrier()); + + return types; +} + +TEST(Types, AllTypes) { + // Types in this test case are only equal to themselves, nothing else. + std::vector> types = GenerateAllTypes(); + + for (size_t i = 0; i < types.size(); ++i) { + for (size_t j = 0; j < types.size(); ++j) { + if (i == j) { + EXPECT_TRUE(types[i]->IsSame(types[j].get())) + << "expected '" << types[i]->str() << "' is the same as '" + << types[j]->str() << "'"; + } else { + EXPECT_FALSE(types[i]->IsSame(types[j].get())) + << "expected '" << types[i]->str() << "' is different to '" + << types[j]->str() << "'"; + } + } + } +} + +TEST(Types, IntSignedness) { + std::vector signednesses = {true, false, false, true}; + std::vector> types; + for (bool s : signednesses) { + types.emplace_back(new Integer(32, s)); + } + for (size_t i = 0; i < signednesses.size(); i++) { + EXPECT_EQ(signednesses[i], types[i]->IsSigned()); + } +} + +TEST(Types, IntWidth) { + std::vector widths = {1, 2, 4, 8, 16, 32, 48, 64, 128}; + std::vector> types; + for (uint32_t w : widths) { + types.emplace_back(new Integer(w, true)); + } + for (size_t i = 0; i < widths.size(); i++) { + EXPECT_EQ(widths[i], types[i]->width()); + } +} + +TEST(Types, FloatWidth) { + std::vector widths = {1, 2, 4, 8, 16, 32, 48, 64, 128}; + std::vector> types; + for (uint32_t w : widths) { + types.emplace_back(new Float(w)); + } + for (size_t i = 0; i < widths.size(); i++) { + EXPECT_EQ(widths[i], types[i]->width()); + } +} + +TEST(Types, VectorElementCount) { + auto s32 = MakeUnique(32, true); + for (uint32_t c : {2, 3, 4}) { + auto s32v = MakeUnique(s32.get(), c); + EXPECT_EQ(c, s32v->element_count()); + } +} + +TEST(Types, MatrixElementCount) { + auto s32 = MakeUnique(32, true); + auto s32v4 = MakeUnique(s32.get(), 4); + for (uint32_t c : {1, 2, 3, 4, 10, 100}) { + auto s32m = MakeUnique(s32v4.get(), c); + EXPECT_EQ(c, s32m->element_count()); + } +} + +TEST(Types, IsUniqueType) { + std::vector> types = GenerateAllTypes(); + + for (auto& t : types) { + bool expectation = true; + // Disallowing variable pointers. + switch (t->kind()) { + case Type::kArray: + case Type::kRuntimeArray: + case Type::kStruct: + expectation = false; + break; + default: + break; + } + EXPECT_EQ(t->IsUniqueType(false), expectation) + << "expected '" << t->str() << "' to be a " + << (expectation ? "" : "non-") << "unique type"; + + // Allowing variables pointers. + if (t->AsPointer()) expectation = false; + EXPECT_EQ(t->IsUniqueType(true), expectation) + << "expected '" << t->str() << "' to be a " + << (expectation ? "" : "non-") << "unique type"; + } +} + +std::vector> GenerateAllTypesWithDecorations() { + std::vector> types = GenerateAllTypes(); + uint32_t elems = 1; + uint32_t decs = 1; + for (auto& t : types) { + for (uint32_t i = 0; i < (decs % 10); ++i) { + std::vector decoration; + for (uint32_t j = 0; j < (elems % 4) + 1; ++j) { + decoration.push_back(j); + } + t->AddDecoration(std::move(decoration)); + ++elems; + ++decs; + } + } + + return types; +} + +TEST(Types, Clone) { + std::vector> types = GenerateAllTypesWithDecorations(); + for (auto& t : types) { + auto clone = t->Clone(); + EXPECT_TRUE(*t == *clone); + EXPECT_TRUE(t->HasSameDecorations(clone.get())); + EXPECT_NE(clone.get(), t.get()); + } +} + +TEST(Types, RemoveDecorations) { + std::vector> types = GenerateAllTypesWithDecorations(); + for (auto& t : types) { + auto decorationless = t->RemoveDecorations(); + EXPECT_EQ(*t == *decorationless, t->decoration_empty()); + EXPECT_EQ(t->HasSameDecorations(decorationless.get()), + t->decoration_empty()); + EXPECT_NE(t.get(), decorationless.get()); + } +} + +} // namespace +} // namespace analysis +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/unify_const_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/unify_const_test.cpp new file mode 100644 index 00000000000..37728cc232f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/unify_const_test.cpp @@ -0,0 +1,990 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include + +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +// Returns the types defining instructions commonly used in many tests. +std::vector CommonTypes() { + return std::vector{ + // clang-format off + // scalar types + "%bool = OpTypeBool", + "%uint = OpTypeInt 32 0", + "%int = OpTypeInt 32 1", + "%uint64 = OpTypeInt 64 0", + "%int64 = OpTypeInt 64 1", + "%float = OpTypeFloat 32", + "%double = OpTypeFloat 64", + // vector types + "%v2bool = OpTypeVector %bool 2", + "%v2uint = OpTypeVector %uint 2", + "%v2int = OpTypeVector %int 2", + "%v3int = OpTypeVector %int 3", + "%v4int = OpTypeVector %int 4", + "%v2float = OpTypeVector %float 2", + "%v3float = OpTypeVector %float 3", + "%v2double = OpTypeVector %double 2", + // struct types + "%inner_struct = OpTypeStruct %bool %float", + "%outer_struct = OpTypeStruct %inner_struct %int %double", + "%flat_struct = OpTypeStruct %bool %int %float %double", + // variable pointer types + "%_pf_bool = OpTypePointer Function %bool", + "%_pf_uint = OpTypePointer Function %uint", + "%_pf_int = OpTypePointer Function %int", + "%_pf_uint64 = OpTypePointer Function %uint64", + "%_pf_int64 = OpTypePointer Function %int64", + "%_pf_float = OpTypePointer Function %float", + "%_pf_double = OpTypePointer Function %double", + "%_pf_v2int = OpTypePointer Function %v2int", + "%_pf_v3int = OpTypePointer Function %v3int", + "%_pf_v4int = OpTypePointer Function %v4int", + "%_pf_v2float = OpTypePointer Function %v2float", + "%_pf_v3float = OpTypePointer Function %v3float", + "%_pf_v2double = OpTypePointer Function %v2double", + "%_pf_inner_struct = OpTypePointer Function %inner_struct", + "%_pf_outer_struct = OpTypePointer Function %outer_struct", + "%_pf_flat_struct = OpTypePointer Function %flat_struct", + // clang-format on + }; +} + +// A helper function to strip OpName instructions from the given string of +// disassembly code and put those debug instructions to a set. Returns the +// string with all OpName instruction stripped and a set of OpName +// instructions. +std::tuple> +StripOpNameInstructionsToSet(const std::string& str) { + std::stringstream ss(str); + std::ostringstream oss; + std::string inst_str; + std::unordered_set opname_instructions; + while (std::getline(ss, inst_str, '\n')) { + if (inst_str.find("OpName %") == std::string::npos) { + oss << inst_str << '\n'; + } else { + opname_instructions.insert(inst_str); + } + } + return std::make_tuple(oss.str(), std::move(opname_instructions)); +} + +// The test fixture for all tests of UnifyConstantPass. This fixture defines +// the rule of checking: all the optimized code should be exactly the same as +// the expected code, except the OpName instructions, which can be different in +// order. +template +class UnifyConstantTest : public PassTest { + protected: + // Runs UnifyConstantPass on the code built from the given |test_builder|, + // and checks whether the optimization result matches with the code built + // from |expected_builder|. + void Check(const AssemblyBuilder& expected_builder, + const AssemblyBuilder& test_builder) { + // unoptimized code + const std::string original_before_strip = test_builder.GetCode(); + std::string original_without_opnames; + std::unordered_set original_opnames; + std::tie(original_without_opnames, original_opnames) = + StripOpNameInstructionsToSet(original_before_strip); + + // expected code + std::string expected_without_opnames; + std::unordered_set expected_opnames; + std::tie(expected_without_opnames, expected_opnames) = + StripOpNameInstructionsToSet(expected_builder.GetCode()); + + // optimized code + std::string optimized_before_strip; + auto status = Pass::Status::SuccessWithoutChange; + std::tie(optimized_before_strip, status) = + this->template SinglePassRunAndDisassemble( + test_builder.GetCode(), + /* skip_nop = */ true, /* do_validation = */ false); + std::string optimized_without_opnames; + std::unordered_set optimized_opnames; + std::tie(optimized_without_opnames, optimized_opnames) = + StripOpNameInstructionsToSet(optimized_before_strip); + + // Flag "status" should be returned correctly. + EXPECT_NE(Pass::Status::Failure, status); + EXPECT_EQ(expected_without_opnames == original_without_opnames, + status == Pass::Status::SuccessWithoutChange); + // Code except OpName instructions should be exactly the same. + EXPECT_EQ(expected_without_opnames, optimized_without_opnames); + // OpName instructions can be in different order, but the content must be + // the same. + EXPECT_EQ(expected_opnames, optimized_opnames); + } +}; + +using UnifyFrontEndConstantSingleTest = + UnifyConstantTest>; + +TEST_F(UnifyFrontEndConstantSingleTest, Basic) { + AssemblyBuilder test_builder; + AssemblyBuilder expected_builder; + + test_builder + .AppendTypesConstantsGlobals({ + "%uint = OpTypeInt 32 0", "%_pf_uint = OpTypePointer Function %uint", + "%unsigned_1 = OpConstant %uint 1", + "%unsigned_1_duplicate = OpConstant %uint 1", // duplicated constant + }) + .AppendInMain({ + "%uint_var = OpVariable %_pf_uint Function", + "OpStore %uint_var %unsigned_1_duplicate", + }); + + expected_builder + .AppendTypesConstantsGlobals({ + "%uint = OpTypeInt 32 0", + "%_pf_uint = OpTypePointer Function %uint", + "%unsigned_1 = OpConstant %uint 1", + }) + .AppendInMain({ + "%uint_var = OpVariable %_pf_uint Function", + "OpStore %uint_var %unsigned_1", + }) + .AppendNames({ + "OpName %unsigned_1 \"unsigned_1_duplicate\"", // the OpName + // instruction of the + // removed duplicated + // constant won't be + // erased. + }); + Check(expected_builder, test_builder); +} + +TEST_F(UnifyFrontEndConstantSingleTest, SkipWhenResultIdHasDecorations) { + AssemblyBuilder test_builder; + AssemblyBuilder expected_builder; + + test_builder + .AppendAnnotations({ + // So far we don't have valid decorations for constants. This is + // preparing for the future updates of SPIR-V. + // TODO(qining): change to a valid decoration once they are available. + "OpDecorate %f_1 RelaxedPrecision", + "OpDecorate %f_2_dup RelaxedPrecision", + }) + .AppendTypesConstantsGlobals({ + // clang-format off + "%float = OpTypeFloat 32", + "%_pf_float = OpTypePointer Function %float", + "%f_1 = OpConstant %float 1", + // %f_1 has decoration, so %f_1 will not be used to replace %f_1_dup. + "%f_1_dup = OpConstant %float 1", + "%f_2 = OpConstant %float 2", + // %_2_dup has decoration, so %f_2 will not replace %f_2_dup. + "%f_2_dup = OpConstant %float 2", + // no decoration for %f_3 or %f_3_dup, %f_3_dup should be replaced. + "%f_3 = OpConstant %float 3", + "%f_3_dup = OpConstant %float 3", + // clang-format on + }) + .AppendInMain({ + // clang-format off + "%f_var = OpVariable %_pf_float Function", + "OpStore %f_var %f_1_dup", + "OpStore %f_var %f_2_dup", + "OpStore %f_var %f_3_dup", + // clang-format on + }); + + expected_builder + .AppendAnnotations({ + "OpDecorate %f_1 RelaxedPrecision", + "OpDecorate %f_2_dup RelaxedPrecision", + }) + .AppendTypesConstantsGlobals({ + // clang-format off + "%float = OpTypeFloat 32", + "%_pf_float = OpTypePointer Function %float", + "%f_1 = OpConstant %float 1", + "%f_1_dup = OpConstant %float 1", + "%f_2 = OpConstant %float 2", + "%f_2_dup = OpConstant %float 2", + "%f_3 = OpConstant %float 3", + // clang-format on + }) + .AppendInMain({ + // clang-format off + "%f_var = OpVariable %_pf_float Function", + "OpStore %f_var %f_1_dup", + "OpStore %f_var %f_2_dup", + "OpStore %f_var %f_3", + // clang-format on + }) + .AppendNames({ + "OpName %f_3 \"f_3_dup\"", + }); + + Check(expected_builder, test_builder); +} + +TEST_F(UnifyFrontEndConstantSingleTest, UnifyWithDecorationOnTypes) { + AssemblyBuilder test_builder; + AssemblyBuilder expected_builder; + + test_builder + .AppendAnnotations({ + "OpMemberDecorate %flat_d 1 RelaxedPrecision", + }) + .AppendTypesConstantsGlobals({ + // clang-format off + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%flat = OpTypeStruct %int %float", + "%_pf_flat = OpTypePointer Function %flat", + // decorated flat struct + "%flat_d = OpTypeStruct %int %float", + "%_pf_flat_d = OpTypePointer Function %flat_d", + // perserved contants. %flat_1 and %flat_d has same members, but + // their type are different in decorations, so they should not be + // used to replace each other. + "%int_1 = OpConstant %int 1", + "%float_1 = OpConstant %float 1", + "%flat_1 = OpConstantComposite %flat %int_1 %float_1", + "%flat_d_1 = OpConstantComposite %flat_d %int_1 %float_1", + // duplicated constants. + "%flat_1_dup = OpConstantComposite %flat %int_1 %float_1", + "%flat_d_1_dup = OpConstantComposite %flat_d %int_1 %float_1", + // clang-format on + }) + .AppendInMain({ + "%flat_var = OpVariable %_pf_flat Function", + "OpStore %flat_var %flat_1_dup", + "%flat_d_var = OpVariable %_pf_flat_d Function", + "OpStore %flat_d_var %flat_d_1_dup", + }); + + expected_builder + .AppendAnnotations({ + "OpMemberDecorate %flat_d 1 RelaxedPrecision", + }) + .AppendTypesConstantsGlobals({ + // clang-format off + "%int = OpTypeInt 32 1", + "%float = OpTypeFloat 32", + "%flat = OpTypeStruct %int %float", + "%_pf_flat = OpTypePointer Function %flat", + // decorated flat struct + "%flat_d = OpTypeStruct %int %float", + "%_pf_flat_d = OpTypePointer Function %flat_d", + "%int_1 = OpConstant %int 1", + "%float_1 = OpConstant %float 1", + "%flat_1 = OpConstantComposite %flat %int_1 %float_1", + "%flat_d_1 = OpConstantComposite %flat_d %int_1 %float_1", + // clang-format on + }) + .AppendInMain({ + "%flat_var = OpVariable %_pf_flat Function", + "OpStore %flat_var %flat_1", + "%flat_d_var = OpVariable %_pf_flat_d Function", + "OpStore %flat_d_var %flat_d_1", + }) + .AppendNames({ + "OpName %flat_1 \"flat_1_dup\"", + "OpName %flat_d_1 \"flat_d_1_dup\"", + }); + + Check(expected_builder, test_builder); +} + +struct UnifyConstantTestCase { + // preserved constants. + std::vector preserved_consts; + // expected uses of the preserved constants. + std::vector use_preserved_consts; + // duplicated constants of the preserved constants. + std::vector duplicate_consts; + // uses of the duplicated constants, expected to be updated to use the + // preserved constants. + std::vector use_duplicate_consts; + // The updated OpName instructions that originally refer to duplicated + // constants. + std::vector remapped_names; +}; + +using UnifyFrontEndConstantParamTest = UnifyConstantTest< + PassTest<::testing::TestWithParam>>; + +TEST_P(UnifyFrontEndConstantParamTest, TestCase) { + auto& tc = GetParam(); + AssemblyBuilder test_builder; + AssemblyBuilder expected_builder; + test_builder.AppendTypesConstantsGlobals(CommonTypes()); + expected_builder.AppendTypesConstantsGlobals(CommonTypes()); + + test_builder.AppendTypesConstantsGlobals(tc.preserved_consts) + .AppendTypesConstantsGlobals(tc.duplicate_consts) + .AppendInMain(tc.use_duplicate_consts); + + // Duplicated constants are killed in the expected output, and the debug + // instructions attached to those duplicated instructions will be migrated to + // the corresponding preserved constants. + expected_builder.AppendTypesConstantsGlobals(tc.preserved_consts) + .AppendInMain(tc.use_preserved_consts) + .AppendNames(tc.remapped_names); + + Check(expected_builder, test_builder); +} + +INSTANTIATE_TEST_CASE_P(Case, UnifyFrontEndConstantParamTest, + ::testing::ValuesIn(std::vector({ + // clang-format off + // basic tests for scalar constants + { + // preserved constants + { + "%bool_true = OpConstantTrue %bool", + "%signed_1 = OpConstant %int 1", + "%signed_minus_1 = OpConstant %int64 -1", + "%unsigned_max = OpConstant %uint64 18446744073709551615", + "%float_1 = OpConstant %float 1", + "%double_1 = OpConstant %double 1", + }, + // use preserved constants in main + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %bool_true", + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %signed_1", + "%int64_var = OpVariable %_pf_int64 Function", + "OpStore %int64_var %signed_minus_1", + "%uint64_var = OpVariable %_pf_uint64 Function", + "OpStore %uint64_var %unsigned_max", + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %float_1", + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %double_1", + }, + // duplicated constants + { + "%bool_true_duplicate = OpConstantTrue %bool", + "%signed_1_duplicate = OpConstant %int 1", + "%signed_minus_1_duplicate = OpConstant %int64 -1", + "%unsigned_max_duplicate = OpConstant %uint64 18446744073709551615", + "%float_1_duplicate = OpConstant %float 1", + "%double_1_duplicate = OpConstant %double 1", + }, + // use duplicated constants in main + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %bool_true_duplicate", + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %signed_1_duplicate", + "%int64_var = OpVariable %_pf_int64 Function", + "OpStore %int64_var %signed_minus_1_duplicate", + "%uint64_var = OpVariable %_pf_uint64 Function", + "OpStore %uint64_var %unsigned_max_duplicate", + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %float_1_duplicate", + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %double_1_duplicate", + }, + // remapped names + { + "OpName %bool_true \"bool_true_duplicate\"", + "OpName %signed_1 \"signed_1_duplicate\"", + "OpName %signed_minus_1 \"signed_minus_1_duplicate\"", + "OpName %unsigned_max \"unsigned_max_duplicate\"", + "OpName %float_1 \"float_1_duplicate\"", + "OpName %double_1 \"double_1_duplicate\"", + }, + }, + // NaN in different bit patterns should not be unified, but the ones + // using same bit pattern should be unified. + { + // preserved constants + { + "%float_nan_1 = OpConstant %float 0x1.8p+128", // !2143289344, 7FC00000 + "%float_nan_2 = OpConstant %float 0x1.800002p+128",// !2143289345 7FC00001 + }, + // use preserved constants in main + { + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %float_nan_1", + "OpStore %float_var %float_nan_2", + }, + // duplicated constants + { + "%float_nan_1_duplicate = OpConstant %float 0x1.8p+128", // !2143289344, 7FC00000 + "%float_nan_2_duplicate = OpConstant %float 0x1.800002p+128",// !2143289345, 7FC00001 + }, + // use duplicated constants in main + { + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %float_nan_1_duplicate", + "OpStore %float_var %float_nan_2_duplicate", + }, + // remapped names + { + "OpName %float_nan_1 \"float_nan_1_duplicate\"", + "OpName %float_nan_2 \"float_nan_2_duplicate\"", + }, + }, + // null values + { + // preserved constants + { + "%bool_null = OpConstantNull %bool", + "%signed_null = OpConstantNull %int", + "%signed_64_null = OpConstantNull %int64", + "%float_null = OpConstantNull %float", + "%double_null = OpConstantNull %double", + // zero-valued constants will not be unified with the equivalent + // null constants. + "%signed_zero = OpConstant %int 0", + }, + // use preserved constants in main + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %bool_null", + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %signed_null", + "%int64_var = OpVariable %_pf_int64 Function", + "OpStore %int64_var %signed_64_null", + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %float_null", + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %double_null", + }, + // duplicated constants + { + "%bool_null_duplicate = OpConstantNull %bool", + "%signed_null_duplicate = OpConstantNull %int", + "%signed_64_null_duplicate = OpConstantNull %int64", + "%float_null_duplicate = OpConstantNull %float", + "%double_null_duplicate = OpConstantNull %double", + }, + // use duplicated constants in main + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %bool_null_duplicate", + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %signed_null_duplicate", + "%int64_var = OpVariable %_pf_int64 Function", + "OpStore %int64_var %signed_64_null_duplicate", + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %float_null_duplicate", + "%double_var = OpVariable %_pf_double Function", + "OpStore %double_var %double_null_duplicate", + }, + // remapped names + { + "OpName %bool_null \"bool_null_duplicate\"", + "OpName %signed_null \"signed_null_duplicate\"", + "OpName %signed_64_null \"signed_64_null_duplicate\"", + "OpName %float_null \"float_null_duplicate\"", + "OpName %double_null \"double_null_duplicate\"", + }, + }, + // constant sampler + { + // preserved constants + { + "%sampler = OpTypeSampler", + "%_pf_sampler = OpTypePointer Function %sampler", + "%sampler_1 = OpConstantSampler %sampler Repeat 0 Linear", + }, + // use preserved constants in main + { + "%sampler_var = OpVariable %_pf_sampler Function", + "OpStore %sampler_var %sampler_1", + }, + // duplicated constants + { + "%sampler_1_duplicate = OpConstantSampler %sampler Repeat 0 Linear", + }, + // use duplicated constants in main + { + "%sampler_var = OpVariable %_pf_sampler Function", + "OpStore %sampler_var %sampler_1_duplicate", + }, + // remapped names + { + "OpName %sampler_1 \"sampler_1_duplicate\"", + }, + }, + // duplicate vector built from same ids. + { + // preserved constants + { + "%signed_1 = OpConstant %int 1", + "%signed_2 = OpConstant %int 2", + "%signed_3 = OpConstant %int 3", + "%signed_4 = OpConstant %int 4", + "%vec = OpConstantComposite %v4int %signed_1 %signed_2 %signed_3 %signed_4", + }, + // use preserved constants in main + { + "%vec_var = OpVariable %_pf_v4int Function", + "OpStore %vec_var %vec", + }, + // duplicated constants + { + "%vec_duplicate = OpConstantComposite %v4int %signed_1 %signed_2 %signed_3 %signed_4", + }, + // use duplicated constants in main + { + "%vec_var = OpVariable %_pf_v4int Function", + "OpStore %vec_var %vec_duplicate", + }, + // remapped names + { + "OpName %vec \"vec_duplicate\"", + } + }, + // duplicate vector built from duplicated ids. + { + // preserved constants + { + "%signed_1 = OpConstant %int 1", + "%signed_2 = OpConstant %int 2", + "%signed_3 = OpConstant %int 3", + "%signed_4 = OpConstant %int 4", + "%vec = OpConstantComposite %v4int %signed_1 %signed_2 %signed_3 %signed_4", + }, + // use preserved constants in main + { + "%vec_var = OpVariable %_pf_v4int Function", + "OpStore %vec_var %vec", + }, + // duplicated constants + { + "%signed_3_duplicate = OpConstant %int 3", + "%signed_4_duplicate = OpConstant %int 4", + "%vec_duplicate = OpConstantComposite %v4int %signed_1 %signed_2 %signed_3_duplicate %signed_4_duplicate", + }, + // use duplicated constants in main + { + "%vec_var = OpVariable %_pf_v4int Function", + "OpStore %vec_var %vec_duplicate", + }, + // remapped names + { + "OpName %signed_3 \"signed_3_duplicate\"", + "OpName %signed_4 \"signed_4_duplicate\"", + "OpName %vec \"vec_duplicate\"", + }, + }, + // flat struct + { + // preserved constants + { + "%bool_true = OpConstantTrue %bool", + "%signed_1 = OpConstant %int 1", + "%float_1 = OpConstant %float 1", + "%double_1 = OpConstant %double 1", + "%s = OpConstantComposite %flat_struct %bool_true %signed_1 %float_1 %double_1", + }, + // use preserved constants in main + { + "%s_var = OpVariable %_pf_flat_struct Function", + "OpStore %s_var %s", + }, + // duplicated constants + { + "%float_1_duplicate = OpConstant %float 1", + "%double_1_duplicate = OpConstant %double 1", + "%s_duplicate = OpConstantComposite %flat_struct %bool_true %signed_1 %float_1_duplicate %double_1_duplicate", + }, + // use duplicated constants in main + { + "%s_var = OpVariable %_pf_flat_struct Function", + "OpStore %s_var %s_duplicate", + }, + // remapped names + { + "OpName %float_1 \"float_1_duplicate\"", + "OpName %double_1 \"double_1_duplicate\"", + "OpName %s \"s_duplicate\"", + }, + }, + // nested struct + { + // preserved constants + { + "%bool_true = OpConstantTrue %bool", + "%signed_1 = OpConstant %int 1", + "%float_1 = OpConstant %float 1", + "%double_1 = OpConstant %double 1", + "%inner = OpConstantComposite %inner_struct %bool_true %float_1", + "%outer = OpConstantComposite %outer_struct %inner %signed_1 %double_1", + }, + // use preserved constants in main + { + "%outer_var = OpVariable %_pf_outer_struct Function", + "OpStore %outer_var %outer", + }, + // duplicated constants + { + "%float_1_duplicate = OpConstant %float 1", + "%double_1_duplicate = OpConstant %double 1", + "%inner_duplicate = OpConstantComposite %inner_struct %bool_true %float_1_duplicate", + "%outer_duplicate = OpConstantComposite %outer_struct %inner_duplicate %signed_1 %double_1_duplicate", + }, + // use duplicated constants in main + { + "%outer_var = OpVariable %_pf_outer_struct Function", + "OpStore %outer_var %outer_duplicate", + }, + // remapped names + { + "OpName %float_1 \"float_1_duplicate\"", + "OpName %double_1 \"double_1_duplicate\"", + "OpName %inner \"inner_duplicate\"", + "OpName %outer \"outer_duplicate\"", + }, + }, + // composite type null constants. Null constants and zero-valued + // constants should not be used to replace each other. + { + // preserved constants + { + "%bool_zero = OpConstantFalse %bool", + "%float_zero = OpConstant %float 0", + "%int_null = OpConstantNull %int", + "%double_null = OpConstantNull %double", + // inner_struct type null constant. + "%null_inner = OpConstantNull %inner_struct", + // zero-valued composite constant built from zero-valued constant + // component. inner_zero should not be replace by null_inner. + "%inner_zero = OpConstantComposite %inner_struct %bool_zero %float_zero", + // zero-valued composite contant built from zero-valued constants + // and null constants. + "%outer_zero = OpConstantComposite %outer_struct %inner_zero %int_null %double_null", + // outer_struct type null constant, it should not be replaced by + // outer_zero. + "%null_outer = OpConstantNull %outer_struct", + }, + // use preserved constants in main + { + "%inner_var = OpVariable %_pf_inner_struct Function", + "OpStore %inner_var %inner_zero", + "OpStore %inner_var %null_inner", + "%outer_var = OpVariable %_pf_outer_struct Function", + "OpStore %outer_var %outer_zero", + "OpStore %outer_var %null_outer", + }, + // duplicated constants + { + "%null_inner_dup = OpConstantNull %inner_struct", + "%null_outer_dup = OpConstantNull %outer_struct", + "%inner_zero_dup = OpConstantComposite %inner_struct %bool_zero %float_zero", + "%outer_zero_dup = OpConstantComposite %outer_struct %inner_zero_dup %int_null %double_null", + }, + // use duplicated constants in main + { + "%inner_var = OpVariable %_pf_inner_struct Function", + "OpStore %inner_var %inner_zero_dup", + "OpStore %inner_var %null_inner_dup", + "%outer_var = OpVariable %_pf_outer_struct Function", + "OpStore %outer_var %outer_zero_dup", + "OpStore %outer_var %null_outer_dup", + }, + // remapped names + { + "OpName %null_inner \"null_inner_dup\"", + "OpName %null_outer \"null_outer_dup\"", + "OpName %inner_zero \"inner_zero_dup\"", + "OpName %outer_zero \"outer_zero_dup\"", + }, + }, + // Spec Constants with SpecId decoration should be skipped. + { + // preserved constants + { + // Assembly builder will add OpDecorate SpecId instruction for the + // following spec constant instructions automatically. + "%spec_bool_1 = OpSpecConstantTrue %bool", + "%spec_bool_2 = OpSpecConstantTrue %bool", + "%spec_int_1 = OpSpecConstant %int 1", + "%spec_int_2 = OpSpecConstant %int 1", + }, + // use preserved constants in main + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %spec_bool_1", + "OpStore %bool_var %spec_bool_2", + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %spec_int_1", + "OpStore %int_var %spec_int_2", + }, + // duplicated constants. No duplicated instruction to remove in this + // case. + {}, + // use duplicated constants in main. Same as the above 'use preserved + // constants in main' defined above, as no instruction should be + // removed in this case. + { + "%bool_var = OpVariable %_pf_bool Function", + "OpStore %bool_var %spec_bool_1", + "OpStore %bool_var %spec_bool_2", + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %spec_int_1", + "OpStore %int_var %spec_int_2", + }, + // remapped names. No duplicated instruction removed, so this is + // empty. + {} + }, + // spec constant composite + { + // preserved constants + { + "%spec_bool_true = OpSpecConstantTrue %bool", + "%spec_signed_1 = OpSpecConstant %int 1", + "%float_1 = OpConstant %float 1", + "%double_1 = OpConstant %double 1", + "%spec_inner = OpSpecConstantComposite %inner_struct %spec_bool_true %float_1", + "%spec_outer = OpSpecConstantComposite %outer_struct %spec_inner %spec_signed_1 %double_1", + "%spec_vec2 = OpSpecConstantComposite %v2float %float_1 %float_1", + }, + // use preserved constants in main + { + "%outer_var = OpVariable %_pf_outer_struct Function", + "OpStore %outer_var %spec_outer", + "%v2float_var = OpVariable %_pf_v2float Function", + "OpStore %v2float_var %spec_vec2", + }, + // duplicated constants + { + "%float_1_duplicate = OpConstant %float 1", + "%double_1_duplicate = OpConstant %double 1", + "%spec_inner_duplicate = OpSpecConstantComposite %inner_struct %spec_bool_true %float_1_duplicate", + "%spec_outer_duplicate = OpSpecConstantComposite %outer_struct %spec_inner_duplicate %spec_signed_1 %double_1_duplicate", + "%spec_vec2_duplicate = OpSpecConstantComposite %v2float %float_1 %float_1_duplicate", + }, + // use duplicated constants in main + { + "%outer_var = OpVariable %_pf_outer_struct Function", + "OpStore %outer_var %spec_outer_duplicate", + "%v2float_var = OpVariable %_pf_v2float Function", + "OpStore %v2float_var %spec_vec2_duplicate", + }, + // remapped names + { + "OpName %float_1 \"float_1_duplicate\"", + "OpName %double_1 \"double_1_duplicate\"", + "OpName %spec_inner \"spec_inner_duplicate\"", + "OpName %spec_outer \"spec_outer_duplicate\"", + "OpName %spec_vec2 \"spec_vec2_duplicate\"", + }, + }, + // spec constant op with int scalar + { + // preserved constants + { + "%spec_signed_1 = OpSpecConstant %int 1", + "%spec_signed_2 = OpSpecConstant %int 2", + "%spec_signed_add = OpSpecConstantOp %int IAdd %spec_signed_1 %spec_signed_2", + }, + // use preserved constants in main + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %spec_signed_add", + }, + // duplicated constants + { + "%spec_signed_add_duplicate = OpSpecConstantOp %int IAdd %spec_signed_1 %spec_signed_2", + }, + // use duplicated contants in main + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %spec_signed_add_duplicate", + }, + // remapped names + { + "OpName %spec_signed_add \"spec_signed_add_duplicate\"", + }, + }, + // spec constant op composite extract + { + // preserved constants + { + "%float_1 = OpConstant %float 1", + "%spec_vec2 = OpSpecConstantComposite %v2float %float_1 %float_1", + "%spec_extract = OpSpecConstantOp %float CompositeExtract %spec_vec2 1", + }, + // use preserved constants in main + { + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %spec_extract", + }, + // duplicated constants + { + "%spec_extract_duplicate = OpSpecConstantOp %float CompositeExtract %spec_vec2 1", + }, + // use duplicated constants in main + { + "%float_var = OpVariable %_pf_float Function", + "OpStore %float_var %spec_extract_duplicate", + }, + // remapped names + { + "OpName %spec_extract \"spec_extract_duplicate\"", + }, + }, + // spec constant op vector shuffle + { + // preserved constants + { + "%float_1 = OpConstant %float 1", + "%float_2 = OpConstant %float 2", + "%spec_vec2_1 = OpSpecConstantComposite %v2float %float_1 %float_1", + "%spec_vec2_2 = OpSpecConstantComposite %v2float %float_2 %float_2", + "%spec_vector_shuffle = OpSpecConstantOp %v2float VectorShuffle %spec_vec2_1 %spec_vec2_2 1 2", + }, + // use preserved constants in main + { + "%v2float_var = OpVariable %_pf_v2float Function", + "OpStore %v2float_var %spec_vector_shuffle", + }, + // duplicated constants + { + "%spec_vector_shuffle_duplicate = OpSpecConstantOp %v2float VectorShuffle %spec_vec2_1 %spec_vec2_2 1 2", + }, + // use duplicated constants in main + { + "%v2float_var = OpVariable %_pf_v2float Function", + "OpStore %v2float_var %spec_vector_shuffle_duplicate", + }, + // remapped names + { + "OpName %spec_vector_shuffle \"spec_vector_shuffle_duplicate\"", + }, + }, + // long dependency chain + { + // preserved constants + { + "%array_size = OpConstant %int 4", + "%type_arr_int_4 = OpTypeArray %int %array_size", + "%signed_0 = OpConstant %int 100", + "%signed_1 = OpConstant %int 1", + "%signed_2 = OpSpecConstantOp %int IAdd %signed_0 %signed_1", + "%signed_3 = OpSpecConstantOp %int ISub %signed_0 %signed_2", + "%signed_4 = OpSpecConstantOp %int IAdd %signed_0 %signed_3", + "%signed_5 = OpSpecConstantOp %int ISub %signed_0 %signed_4", + "%signed_6 = OpSpecConstantOp %int IAdd %signed_0 %signed_5", + "%signed_7 = OpSpecConstantOp %int ISub %signed_0 %signed_6", + "%signed_8 = OpSpecConstantOp %int IAdd %signed_0 %signed_7", + "%signed_9 = OpSpecConstantOp %int ISub %signed_0 %signed_8", + "%signed_10 = OpSpecConstantOp %int IAdd %signed_0 %signed_9", + "%signed_11 = OpSpecConstantOp %int ISub %signed_0 %signed_10", + "%signed_12 = OpSpecConstantOp %int IAdd %signed_0 %signed_11", + "%signed_13 = OpSpecConstantOp %int ISub %signed_0 %signed_12", + "%signed_14 = OpSpecConstantOp %int IAdd %signed_0 %signed_13", + "%signed_15 = OpSpecConstantOp %int ISub %signed_0 %signed_14", + "%signed_16 = OpSpecConstantOp %int ISub %signed_0 %signed_15", + "%signed_17 = OpSpecConstantOp %int IAdd %signed_0 %signed_16", + "%signed_18 = OpSpecConstantOp %int ISub %signed_0 %signed_17", + "%signed_19 = OpSpecConstantOp %int IAdd %signed_0 %signed_18", + "%signed_20 = OpSpecConstantOp %int ISub %signed_0 %signed_19", + "%signed_vec_a = OpSpecConstantComposite %v2int %signed_18 %signed_19", + "%signed_vec_b = OpSpecConstantOp %v2int IMul %signed_vec_a %signed_vec_a", + "%signed_21 = OpSpecConstantOp %int CompositeExtract %signed_vec_b 0", + "%signed_array = OpConstantComposite %type_arr_int_4 %signed_20 %signed_20 %signed_21 %signed_21", + "%signed_22 = OpSpecConstantOp %int CompositeExtract %signed_array 0", + }, + // use preserved constants in main + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %signed_22", + }, + // duplicated constants + { + "%signed_0_dup = OpConstant %int 100", + "%signed_1_dup = OpConstant %int 1", + "%signed_2_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_1_dup", + "%signed_3_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_2_dup", + "%signed_4_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_3_dup", + "%signed_5_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_4_dup", + "%signed_6_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_5_dup", + "%signed_7_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_6_dup", + "%signed_8_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_7_dup", + "%signed_9_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_8_dup", + "%signed_10_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_9_dup", + "%signed_11_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_10_dup", + "%signed_12_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_11_dup", + "%signed_13_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_12_dup", + "%signed_14_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_13_dup", + "%signed_15_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_14_dup", + "%signed_16_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_15_dup", + "%signed_17_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_16_dup", + "%signed_18_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_17_dup", + "%signed_19_dup = OpSpecConstantOp %int IAdd %signed_0_dup %signed_18_dup", + "%signed_20_dup = OpSpecConstantOp %int ISub %signed_0_dup %signed_19_dup", + "%signed_vec_a_dup = OpSpecConstantComposite %v2int %signed_18_dup %signed_19_dup", + "%signed_vec_b_dup = OpSpecConstantOp %v2int IMul %signed_vec_a_dup %signed_vec_a_dup", + "%signed_21_dup = OpSpecConstantOp %int CompositeExtract %signed_vec_b_dup 0", + "%signed_array_dup = OpConstantComposite %type_arr_int_4 %signed_20_dup %signed_20_dup %signed_21_dup %signed_21_dup", + "%signed_22_dup = OpSpecConstantOp %int CompositeExtract %signed_array_dup 0", + }, + // use duplicated constants in main + { + "%int_var = OpVariable %_pf_int Function", + "OpStore %int_var %signed_22_dup", + }, + // remapped names + { + "OpName %signed_0 \"signed_0_dup\"", + "OpName %signed_1 \"signed_1_dup\"", + "OpName %signed_2 \"signed_2_dup\"", + "OpName %signed_3 \"signed_3_dup\"", + "OpName %signed_4 \"signed_4_dup\"", + "OpName %signed_5 \"signed_5_dup\"", + "OpName %signed_6 \"signed_6_dup\"", + "OpName %signed_7 \"signed_7_dup\"", + "OpName %signed_8 \"signed_8_dup\"", + "OpName %signed_9 \"signed_9_dup\"", + "OpName %signed_10 \"signed_10_dup\"", + "OpName %signed_11 \"signed_11_dup\"", + "OpName %signed_12 \"signed_12_dup\"", + "OpName %signed_13 \"signed_13_dup\"", + "OpName %signed_14 \"signed_14_dup\"", + "OpName %signed_15 \"signed_15_dup\"", + "OpName %signed_16 \"signed_16_dup\"", + "OpName %signed_17 \"signed_17_dup\"", + "OpName %signed_18 \"signed_18_dup\"", + "OpName %signed_19 \"signed_19_dup\"", + "OpName %signed_20 \"signed_20_dup\"", + "OpName %signed_vec_a \"signed_vec_a_dup\"", + "OpName %signed_vec_b \"signed_vec_b_dup\"", + "OpName %signed_21 \"signed_21_dup\"", + "OpName %signed_array \"signed_array_dup\"", + "OpName %signed_22 \"signed_22_dup\"", + }, + }, + // clang-format on + }))); + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/utils_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/utils_test.cpp new file mode 100644 index 00000000000..9bb82a367dc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/utils_test.cpp @@ -0,0 +1,110 @@ +// Copyright (c) 2016 Google 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. + +#include +#include + +#include "gtest/gtest.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +TEST(JoinAllInsts, Cases) { + EXPECT_EQ("", JoinAllInsts({})); + EXPECT_EQ("a\n", JoinAllInsts({"a"})); + EXPECT_EQ("a\nb\n", JoinAllInsts({"a", "b"})); + EXPECT_EQ("a\nb\nc\n", JoinAllInsts({"a", "b", "c"})); + EXPECT_EQ("hello,\nworld!\n\n\n", JoinAllInsts({"hello,", "world!", "\n"})); +} + +TEST(JoinNonDebugInsts, Cases) { + EXPECT_EQ("", JoinNonDebugInsts({})); + EXPECT_EQ("a\n", JoinNonDebugInsts({"a"})); + EXPECT_EQ("", JoinNonDebugInsts({"OpName"})); + EXPECT_EQ("a\nb\n", JoinNonDebugInsts({"a", "b"})); + EXPECT_EQ("", JoinNonDebugInsts({"OpName", "%1 = OpString \"42\""})); + EXPECT_EQ("Opstring\n", JoinNonDebugInsts({"OpName", "Opstring"})); + EXPECT_EQ("the only remaining string\n", + JoinNonDebugInsts( + {"OpSourceContinued", "OpSource", "OpSourceExtension", + "lgtm OpName", "hello OpMemberName", "this is a OpString", + "lonely OpLine", "happy OpNoLine", "OpModuleProcessed", + "the only remaining string"})); +} + +struct SubstringReplacementTestCase { + const char* orig_str; + const char* find_substr; + const char* replace_substr; + const char* expected_str; + bool replace_should_succeed; +}; + +using FindAndReplaceTest = + ::testing::TestWithParam; + +TEST_P(FindAndReplaceTest, SubstringReplacement) { + auto process = std::string(GetParam().orig_str); + EXPECT_EQ(GetParam().replace_should_succeed, + FindAndReplace(&process, GetParam().find_substr, + GetParam().replace_substr)) + << "Original string: " << GetParam().orig_str + << " replace: " << GetParam().find_substr + << " to: " << GetParam().replace_substr + << " should returns: " << GetParam().replace_should_succeed; + EXPECT_STREQ(GetParam().expected_str, process.c_str()) + << "Original string: " << GetParam().orig_str + << " replace: " << GetParam().find_substr + << " to: " << GetParam().replace_substr + << " expected string: " << GetParam().expected_str; +} + +INSTANTIATE_TEST_CASE_P( + SubstringReplacement, FindAndReplaceTest, + ::testing::ValuesIn(std::vector({ + // orig string, find substring, replace substring, expected string, + // replacement happened + {"", "", "", "", false}, + {"", "b", "", "", false}, + {"", "", "c", "", false}, + {"", "a", "b", "", false}, + + {"a", "", "c", "a", false}, + {"a", "b", "c", "a", false}, + {"a", "b", "", "a", false}, + {"a", "a", "", "", true}, + {"a", "a", "b", "b", true}, + + {"ab", "a", "b", "bb", true}, + {"ab", "a", "", "b", true}, + {"ab", "b", "", "a", true}, + {"ab", "ab", "", "", true}, + {"ab", "ab", "cd", "cd", true}, + {"bc", "abc", "efg", "bc", false}, + + {"abc", "ab", "bc", "bcc", true}, + {"abc", "ab", "", "c", true}, + {"abc", "bc", "", "a", true}, + {"abc", "bc", "d", "ad", true}, + {"abc", "a", "123", "123bc", true}, + {"abc", "ab", "a", "ac", true}, + {"abc", "a", "aab", "aabbc", true}, + {"abc", "abcd", "efg", "abc", false}, + }))); + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/value_table_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/value_table_test.cpp new file mode 100644 index 00000000000..ef338ae7ecd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/value_table_test.cpp @@ -0,0 +1,591 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" +#include "source/opt/build_module.h" +#include "source/opt/value_number_table.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" + +namespace spvtools { +namespace opt { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; +using ValueTableTest = PassTest<::testing::Test>; + +TEST_F(ValueTableTest, SameInstructionSameValue) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst), vtable.GetValueNumber(inst)); +} + +TEST_F(ValueTableTest, DifferentInstructionSameValue) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 + %11 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(10); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(11); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, SameValueDifferentBlock) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 + OpBranch %11 + %11 = OpLabel + %12 = OpFAdd %5 %9 %9 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(10); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(12); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, DifferentValue) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 + %11 = OpFAdd %5 %9 %10 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(10); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(11); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, DifferentValueDifferentBlock) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpFAdd %5 %9 %9 + OpBranch %11 + %11 = OpLabel + %12 = OpFAdd %5 %9 %10 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(10); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(12); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, SameLoad) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst = context->get_def_use_mgr()->GetDef(9); + EXPECT_EQ(vtable.GetValueNumber(inst), vtable.GetValueNumber(inst)); +} + +// Two different loads, even from the same memory, must given different value +// numbers if the memory is not read-only. +TEST_F(ValueTableTest, DifferentFunctionLoad) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(9); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(10); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, DifferentUniformLoad) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Uniform %5 + %8 = OpVariable %6 Uniform + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %5 %8 + %10 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(9); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, DifferentInputLoad) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Input %5 + %8 = OpVariable %6 Input + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %5 %8 + %10 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(9); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, DifferentUniformConstantLoad) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer UniformConstant %5 + %8 = OpVariable %6 UniformConstant + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %5 %8 + %10 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(9); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, DifferentPushConstantLoad) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer PushConstant %5 + %8 = OpVariable %6 PushConstant + %2 = OpFunction %3 None %4 + %7 = OpLabel + %9 = OpLoad %5 %8 + %10 = OpLoad %5 %8 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(9); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, SameCall) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypeFunction %5 + %7 = OpTypePointer Function %5 + %8 = OpVariable %7 Private + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpFunctionCall %5 %11 + OpReturn + OpFunctionEnd + %11 = OpFunction %5 None %6 + %12 = OpLabel + %13 = OpLoad %5 %8 + OpReturnValue %13 + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst), vtable.GetValueNumber(inst)); +} + +// Function calls should be given a new value number, even if they are the same. +TEST_F(ValueTableTest, DifferentCall) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypeFunction %5 + %7 = OpTypePointer Function %5 + %8 = OpVariable %7 Private + %2 = OpFunction %3 None %4 + %9 = OpLabel + %10 = OpFunctionCall %5 %11 + %12 = OpFunctionCall %5 %11 + OpReturn + OpFunctionEnd + %11 = OpFunction %5 None %6 + %13 = OpLabel + %14 = OpLoad %5 %8 + OpReturnValue %14 + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(10); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(12); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +// It is possible to have two instruction that compute the same numerical value, +// but with different types. They should have different value numbers. +TEST_F(ValueTableTest, DifferentTypes) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeInt 32 0 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %8 = OpLabel + %9 = OpVariable %7 Function + %10 = OpLoad %5 %9 + %11 = OpIAdd %5 %10 %10 + %12 = OpIAdd %6 %10 %10 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(11); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(12); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +TEST_F(ValueTableTest, CopyObject) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Function %5 + %2 = OpFunction %3 None %4 + %7 = OpLabel + %8 = OpVariable %6 Function + %9 = OpLoad %5 %8 + %10 = OpCopyObject %5 %9 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(9); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(10); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); +} + +// Test that a phi where the operands have the same value assigned that value +// to the result of the phi. +TEST_F(ValueTableTest, PhiTest1) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Uniform %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %9 = OpVariable %6 Uniform + %2 = OpFunction %3 None %4 + %10 = OpLabel + OpBranchConditional %8 %11 %12 + %11 = OpLabel + %13 = OpLoad %5 %9 + OpBranch %14 + %12 = OpLabel + %15 = OpLoad %5 %9 + OpBranch %14 + %14 = OpLabel + %16 = OpPhi %5 %13 %11 %15 %12 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(13); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(15); + Instruction* phi = context->get_def_use_mgr()->GetDef(16); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(phi)); +} + +// When the values for the inputs to a phi do not match, then the phi should +// have its own value number. +TEST_F(ValueTableTest, PhiTest2) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Uniform %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %9 = OpVariable %6 Uniform + %10 = OpVariable %6 Uniform + %2 = OpFunction %3 None %4 + %11 = OpLabel + OpBranchConditional %8 %12 %13 + %12 = OpLabel + %14 = OpLoad %5 %9 + OpBranch %15 + %13 = OpLabel + %16 = OpLoad %5 %10 + OpBranch %15 + %15 = OpLabel + %17 = OpPhi %14 %12 %16 %13 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(14); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(16); + Instruction* phi = context->get_def_use_mgr()->GetDef(17); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(phi)); + EXPECT_NE(vtable.GetValueNumber(inst2), vtable.GetValueNumber(phi)); +} + +// Test that a phi node in a loop header gets a new value because one of its +// inputs comes from later in the loop. +TEST_F(ValueTableTest, PhiLoopTest) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %2 "main" + OpExecutionMode %2 OriginUpperLeft + OpSource GLSL 430 + %3 = OpTypeVoid + %4 = OpTypeFunction %3 + %5 = OpTypeFloat 32 + %6 = OpTypePointer Uniform %5 + %7 = OpTypeBool + %8 = OpConstantTrue %7 + %9 = OpVariable %6 Uniform + %10 = OpVariable %6 Uniform + %2 = OpFunction %3 None %4 + %11 = OpLabel + %12 = OpLoad %5 %9 + OpSelectionMerge %13 None + OpBranchConditional %8 %14 %13 + %14 = OpLabel + %15 = OpPhi %5 %12 %11 %16 %14 + %16 = OpLoad %5 %9 + OpLoopMerge %17 %14 None + OpBranchConditional %8 %14 %17 + %17 = OpLabel + OpBranch %13 + %13 = OpLabel + %18 = OpPhi %5 %12 %11 %16 %17 + OpReturn + OpFunctionEnd + )"; + auto context = BuildModule(SPV_ENV_UNIVERSAL_1_2, nullptr, text); + ValueNumberTable vtable(context.get()); + Instruction* inst1 = context->get_def_use_mgr()->GetDef(12); + Instruction* inst2 = context->get_def_use_mgr()->GetDef(16); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(inst2)); + + Instruction* phi1 = context->get_def_use_mgr()->GetDef(15); + EXPECT_NE(vtable.GetValueNumber(inst1), vtable.GetValueNumber(phi1)); + + Instruction* phi2 = context->get_def_use_mgr()->GetDef(18); + EXPECT_EQ(vtable.GetValueNumber(inst1), vtable.GetValueNumber(phi2)); + EXPECT_NE(vtable.GetValueNumber(phi1), vtable.GetValueNumber(phi2)); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/vector_dce_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/vector_dce_test.cpp new file mode 100644 index 00000000000..d1af0de19ca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/vector_dce_test.cpp @@ -0,0 +1,1158 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using VectorDCETest = PassTest<::testing::Test>; + +TEST_F(VectorDCETest, InsertAfterInsertElim) { + // With two insertions to the same offset, the first is dead. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in float In0; + // layout (location=1) in float In1; + // layout (location=2) in vec2 In2; + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec2 v = In2; + // v.x = In0 + In1; // dead + // v.x = 0.0; + // OutColor = v.xyxy; + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In2 %In0 %In1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In2 "In2" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %OutColor "OutColor" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_n" +OpName %_ "" +OpDecorate %In2 Location 2 +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %OutColor Location 0 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%In2 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_float = OpTypePointer Input %float +%In0 = OpVariable %_ptr_Input_float Input +%In1 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%int = OpTypeInt 32 1 +%_Globals_ = OpTypeStruct %uint %int +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In2 %In0 %In1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In2 "In2" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %OutColor "OutColor" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_n" +OpName %_ "" +OpDecorate %In2 Location 2 +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %OutColor Location 0 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%_ptr_Input_v2float = OpTypePointer Input %v2float +%In2 = OpVariable %_ptr_Input_v2float Input +%_ptr_Input_float = OpTypePointer Input %float +%In0 = OpVariable %_ptr_Input_float Input +%In1 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%float_0 = OpConstant %float 0 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%int = OpTypeInt 32 1 +%_Globals_ = OpTypeStruct %uint %int +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%25 = OpLabel +%26 = OpLoad %v2float %In2 +%27 = OpLoad %float %In0 +%28 = OpLoad %float %In1 +%29 = OpFAdd %float %27 %28 +%35 = OpCompositeInsert %v2float %29 %26 0 +%37 = OpCompositeInsert %v2float %float_0 %35 0 +%33 = OpVectorShuffle %v4float %37 %37 0 1 0 1 +OpStore %OutColor %33 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%23 = OpLabel +%24 = OpLoad %v2float %In2 +%25 = OpLoad %float %In0 +%26 = OpLoad %float %In1 +%27 = OpFAdd %float %25 %26 +%28 = OpCompositeInsert %v2float %27 %24 0 +%29 = OpCompositeInsert %v2float %float_0 %24 0 +%30 = OpVectorShuffle %v4float %29 %29 0 1 0 1 +OpStore %OutColor %30 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +TEST_F(VectorDCETest, DeadInsertInChainWithPhi) { + // Dead insert eliminated with phi in insertion chain. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in vec4 In0; + // layout (location=1) in float In1; + // layout (location=2) in float In2; + // layout (location=0) out vec4 OutColor; + // + // layout(std140, binding = 0 ) uniform _Globals_ + // { + // bool g_b; + // }; + // + // void main() + // { + // vec4 v = In0; + // v.z = In1 + In2; + // if (g_b) v.w = 1.0; + // OutColor = vec4(v.x,v.y,0.0,v.w); + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%11 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%_Globals_ = OpTypeStruct %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_ptr_Function_float = OpTypePointer Function %float +%_Globals_ = OpTypeStruct %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%float_0 = OpConstant %float 0 +)"; + + const std::string before = + R"(%main = OpFunction %void None %11 +%31 = OpLabel +%32 = OpLoad %v4float %In0 +%33 = OpLoad %float %In1 +%34 = OpLoad %float %In2 +%35 = OpFAdd %float %33 %34 +%51 = OpCompositeInsert %v4float %35 %32 2 +%37 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%38 = OpLoad %uint %37 +%39 = OpINotEqual %bool %38 %uint_0 +OpSelectionMerge %40 None +OpBranchConditional %39 %41 %40 +%41 = OpLabel +%53 = OpCompositeInsert %v4float %float_1 %51 3 +OpBranch %40 +%40 = OpLabel +%60 = OpPhi %v4float %51 %31 %53 %41 +%55 = OpCompositeExtract %float %60 0 +%57 = OpCompositeExtract %float %60 1 +%59 = OpCompositeExtract %float %60 3 +%49 = OpCompositeConstruct %v4float %55 %57 %float_0 %59 +OpStore %OutColor %49 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%27 = OpLabel +%28 = OpLoad %v4float %In0 +%29 = OpLoad %float %In1 +%30 = OpLoad %float %In2 +%31 = OpFAdd %float %29 %30 +%32 = OpCompositeInsert %v4float %31 %28 2 +%33 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%34 = OpLoad %uint %33 +%35 = OpINotEqual %bool %34 %uint_0 +OpSelectionMerge %36 None +OpBranchConditional %35 %37 %36 +%37 = OpLabel +%38 = OpCompositeInsert %v4float %float_1 %28 3 +OpBranch %36 +%36 = OpLabel +%39 = OpPhi %v4float %28 %27 %38 %37 +%40 = OpCompositeExtract %float %39 0 +%41 = OpCompositeExtract %float %39 1 +%42 = OpCompositeExtract %float %39 3 +%43 = OpCompositeConstruct %v4float %40 %41 %float_0 %42 +OpStore %OutColor %43 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +TEST_F(VectorDCETest, DeadInsertWithScalars) { + // Dead insert which requires two passes to eliminate + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in vec4 In0; + // layout (location=1) in float In1; + // layout (location=2) in float In2; + // layout (location=0) out vec4 OutColor; + // + // layout(std140, binding = 0 ) uniform _Globals_ + // { + // bool g_b; + // bool g_b2; + // }; + // + // void main() + // { + // vec4 v1, v2; + // v1 = In0; + // v1.y = In1 + In2; // dead, second pass + // if (g_b) v1.x = 1.0; + // v2.x = v1.x; + // v2.y = v1.y; // dead, first pass + // if (g_b2) v2.x = 0.0; + // OutColor = vec4(v2.x,v2.x,0.0,1.0); + // } + + const std::string before_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_b2" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_Globals_ = OpTypeStruct %uint %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%27 = OpUndef %v4float +)"; + + const std::string after_predefs = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %In2 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_b" +OpMemberName %_Globals_ 1 "g_b2" +OpName %_ "" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +OpMemberDecorate %_Globals_ 0 Offset 0 +OpMemberDecorate %_Globals_ 1 Offset 4 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%uint = OpTypeInt 32 0 +%_Globals_ = OpTypeStruct %uint %uint +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%bool = OpTypeBool +%uint_0 = OpConstant %uint 0 +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%float_0 = OpConstant %float 0 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%27 = OpUndef %v4float +)"; + + const std::string before = + R"(%main = OpFunction %void None %10 +%28 = OpLabel +%29 = OpLoad %v4float %In0 +%30 = OpLoad %float %In1 +%31 = OpLoad %float %In2 +%32 = OpFAdd %float %30 %31 +%33 = OpCompositeInsert %v4float %32 %29 1 +%34 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%35 = OpLoad %uint %34 +%36 = OpINotEqual %bool %35 %uint_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %38 %37 +%38 = OpLabel +%39 = OpCompositeInsert %v4float %float_1 %33 0 +OpBranch %37 +%37 = OpLabel +%40 = OpPhi %v4float %33 %28 %39 %38 +%41 = OpCompositeExtract %float %40 0 +%42 = OpCompositeInsert %v4float %41 %27 0 +%43 = OpCompositeExtract %float %40 1 +%44 = OpCompositeInsert %v4float %43 %42 1 +%45 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 +%46 = OpLoad %uint %45 +%47 = OpINotEqual %bool %46 %uint_0 +OpSelectionMerge %48 None +OpBranchConditional %47 %49 %48 +%49 = OpLabel +%50 = OpCompositeInsert %v4float %float_0 %44 0 +OpBranch %48 +%48 = OpLabel +%51 = OpPhi %v4float %44 %37 %50 %49 +%52 = OpCompositeExtract %float %51 0 +%53 = OpCompositeExtract %float %51 0 +%54 = OpCompositeConstruct %v4float %52 %53 %float_0 %float_1 +OpStore %OutColor %54 +OpReturn +OpFunctionEnd +)"; + + const std::string after = + R"(%main = OpFunction %void None %10 +%28 = OpLabel +%29 = OpLoad %v4float %In0 +%34 = OpAccessChain %_ptr_Uniform_uint %_ %int_0 +%35 = OpLoad %uint %34 +%36 = OpINotEqual %bool %35 %uint_0 +OpSelectionMerge %37 None +OpBranchConditional %36 %38 %37 +%38 = OpLabel +%39 = OpCompositeInsert %v4float %float_1 %29 0 +OpBranch %37 +%37 = OpLabel +%40 = OpPhi %v4float %29 %28 %39 %38 +%41 = OpCompositeExtract %float %40 0 +%42 = OpCompositeInsert %v4float %41 %27 0 +%45 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 +%46 = OpLoad %uint %45 +%47 = OpINotEqual %bool %46 %uint_0 +OpSelectionMerge %48 None +OpBranchConditional %47 %49 %48 +%49 = OpLabel +%50 = OpCompositeInsert %v4float %float_0 %42 0 +OpBranch %48 +%48 = OpLabel +%51 = OpPhi %v4float %42 %37 %50 %49 +%52 = OpCompositeExtract %float %51 0 +%53 = OpCompositeExtract %float %51 0 +%54 = OpCompositeConstruct %v4float %52 %53 %float_0 %float_1 +OpStore %OutColor %54 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(before_predefs + before, + after_predefs + after, true, true); +} + +TEST_F(VectorDCETest, InsertObjectLive) { + // Make sure that the object being inserted in an OpCompositeInsert + // is not removed when it is uses later on. + const std::string before = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %In1 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %10 +%28 = OpLabel +%29 = OpLoad %v4float %In0 +%30 = OpLoad %float %In1 +%33 = OpCompositeInsert %v4float %30 %29 1 +OpStore %OutColor %33 +OpReturn +OpFunctionEnd +)"; + + SetAssembleOptions(SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS); + SinglePassRunAndCheck(before, before, true, true); +} + +#ifdef SPIRV_EFFCEE +TEST_F(VectorDCETest, DeadInsertInCycle) { + // Dead insert in chain with cycle. Demonstrates analysis can handle + // cycles in chains going through scalars intermediate values. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) in vec4 In0; + // layout (location=1) in float In1; + // layout (location=2) in float In2; + // layout (location=0) out vec4 OutColor; + // + // layout(std140, binding = 0 ) uniform _Globals_ + // { + // int g_n ; + // }; + // + // void main() + // { + // vec2 v = vec2(0.0, 1.0); + // for (int i = 0; i < g_n; i++) { + // v.x = v.x + 1; + // v.y = v.y * 0.9; // dead + // } + // OutColor = vec4(v.x); + // } + + const std::string assembly = + R"( +; CHECK: [[init_val:%\w+]] = OpConstantComposite %v2float %float_0 %float_1 +; CHECK: [[undef:%\w+]] = OpUndef %v2float +; CHECK: OpFunction +; CHECK: [[entry_lab:%\w+]] = OpLabel +; CHECK: [[loop_header:%\w+]] = OpLabel +; CHECK: OpPhi %v2float [[init_val]] [[entry_lab]] [[x_insert:%\w+]] {{%\w+}} +; CHECK: [[x_insert:%\w+]] = OpCompositeInsert %v2float %43 [[undef]] 0 +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %OutColor %In0 %In1 %In2 +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpName %main "main" +OpName %_Globals_ "_Globals_" +OpMemberName %_Globals_ 0 "g_n" +OpName %_ "" +OpName %OutColor "OutColor" +OpName %In0 "In0" +OpName %In1 "In1" +OpName %In2 "In2" +OpMemberDecorate %_Globals_ 0 Offset 0 +OpDecorate %_Globals_ Block +OpDecorate %_ DescriptorSet 0 +OpDecorate %_ Binding 0 +OpDecorate %OutColor Location 0 +OpDecorate %In0 Location 0 +OpDecorate %In1 Location 1 +OpDecorate %In2 Location 2 +%void = OpTypeVoid +%10 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%16 = OpConstantComposite %v2float %float_0 %float_1 +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_0 = OpConstant %int 0 +%_Globals_ = OpTypeStruct %int +%_ptr_Uniform__Globals_ = OpTypePointer Uniform %_Globals_ +%_ = OpVariable %_ptr_Uniform__Globals_ Uniform +%_ptr_Uniform_int = OpTypePointer Uniform %int +%bool = OpTypeBool +%float_0_75 = OpConstant %float 0.75 +%int_1 = OpConstant %int 1 +%v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = OpVariable %_ptr_Input_v4float Input +%_ptr_Input_float = OpTypePointer Input %float +%In1 = OpVariable %_ptr_Input_float Input +%In2 = OpVariable %_ptr_Input_float Input +%main = OpFunction %void None %10 +%29 = OpLabel +OpBranch %30 +%30 = OpLabel +%31 = OpPhi %v2float %16 %29 %32 %33 +%34 = OpPhi %int %int_0 %29 %35 %33 +OpLoopMerge %36 %33 None +OpBranch %37 +%37 = OpLabel +%38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 +%39 = OpLoad %int %38 +%40 = OpSLessThan %bool %34 %39 +OpBranchConditional %40 %41 %36 +%41 = OpLabel +%42 = OpCompositeExtract %float %31 0 +%43 = OpFAdd %float %42 %float_1 +%44 = OpCompositeInsert %v2float %43 %31 0 +%45 = OpCompositeExtract %float %44 1 +%46 = OpFMul %float %45 %float_0_75 +%32 = OpCompositeInsert %v2float %46 %44 1 +OpBranch %33 +%33 = OpLabel +%35 = OpIAdd %int %34 %int_1 +OpBranch %30 +%36 = OpLabel +%47 = OpCompositeExtract %float %31 0 +%48 = OpCompositeConstruct %v4float %47 %47 %47 %47 +OpStore %OutColor %48 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(assembly, true); +} + +TEST_F(VectorDCETest, DeadLoadFeedingCompositeConstruct) { + // Detach the loads feeding the CompositeConstruct for the unused elements. + // TODO: Implement the rewrite for CompositeConstruct. + + const std::string assembly = + R"( +; CHECK: [[undef:%\w+]] = OpUndef %float +; CHECK: [[ac:%\w+]] = OpAccessChain %_ptr_Input_float %In0 %uint_2 +; CHECK: [[load:%\w+]] = OpLoad %float [[ac]] +; CHECK: OpCompositeConstruct %v3float [[load]] [[undef]] [[undef]] +OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %In0 %OutColor +OpExecutionMode %main OriginUpperLeft +OpSource GLSL 450 +OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" +OpSourceExtension "GL_GOOGLE_include_directive" +OpName %main "main" +OpName %In0 "In0" +OpName %OutColor "OutColor" +OpDecorate %In0 Location 0 +OpDecorate %OutColor Location 0 +%void = OpTypeVoid +%6 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%In0 = 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 +%uint_2 = OpConstant %uint 2 +%v3float = OpTypeVector %float 3 +%int = OpTypeInt 32 1 +%int_0 = OpConstant %int 0 +%int_20 = OpConstant %int 20 +%bool = OpTypeBool +%float_1 = OpConstant %float 1 +%int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float +%OutColor = OpVariable %_ptr_Output_v4float Output +%23 = OpUndef %v3float +%main = OpFunction %void None %6 +%24 = OpLabel +%25 = OpAccessChain %_ptr_Input_float %In0 %uint_0 +%26 = OpLoad %float %25 +%27 = OpAccessChain %_ptr_Input_float %In0 %uint_1 +%28 = OpLoad %float %27 +%29 = OpAccessChain %_ptr_Input_float %In0 %uint_2 +%30 = OpLoad %float %29 +%31 = OpCompositeConstruct %v3float %30 %28 %26 +OpBranch %32 +%32 = OpLabel +%33 = OpPhi %v3float %31 %24 %34 %35 +%36 = OpPhi %int %int_0 %24 %37 %35 +OpLoopMerge %38 %35 None +OpBranch %39 +%39 = OpLabel +%40 = OpSLessThan %bool %36 %int_20 +OpBranchConditional %40 %41 %38 +%41 = OpLabel +%42 = OpCompositeExtract %float %33 0 +%43 = OpFAdd %float %42 %float_1 +%34 = OpCompositeInsert %v3float %43 %33 0 +OpBranch %35 +%35 = OpLabel +%37 = OpIAdd %int %36 %int_1 +OpBranch %32 +%38 = OpLabel +%44 = OpCompositeExtract %float %33 0 +%45 = OpCompositeConstruct %v4float %44 %44 %44 %44 +OpStore %OutColor %45 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndMatch(assembly, true); +} + +TEST_F(VectorDCETest, DeadLoadFeedingVectorShuffle) { + // Detach the loads feeding the CompositeConstruct for the unused elements. + // TODO: Implement the rewrite for CompositeConstruct. + + const std::string assembly = + R"( +; MemPass Type2Undef does not reuse and already existing undef. +; CHECK: {{%\w+}} = OpUndef %v3float +; CHECK: [[undef:%\w+]] = OpUndef %v3float +; CHECK: OpFunction +; CHECK: OpVectorShuffle %v3float {{%\w+}} [[undef]] 0 4 5 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %In0 %OutColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %In0 "In0" + OpName %OutColor "OutColor" + OpDecorate %In0 Location 0 + OpDecorate %OutColor Location 0 + %void = OpTypeVoid + %6 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Input_v4float = OpTypePointer Input %v4float + %In0 = 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 + %uint_2 = OpConstant %uint 2 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_20 = OpConstant %int 20 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 + %vec_const = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %int_1 = OpConstant %int 1 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %OutColor = OpVariable %_ptr_Output_v4float Output + %23 = OpUndef %v3float + %main = OpFunction %void None %6 + %24 = OpLabel + %25 = OpAccessChain %_ptr_Input_float %In0 %uint_0 + %26 = OpLoad %float %25 + %27 = OpAccessChain %_ptr_Input_float %In0 %uint_1 + %28 = OpLoad %float %27 + %29 = OpAccessChain %_ptr_Input_float %In0 %uint_2 + %30 = OpLoad %float %29 + %31 = OpCompositeConstruct %v3float %30 %28 %26 + %sh = OpVectorShuffle %v3float %vec_const %31 0 4 5 + OpBranch %32 + %32 = OpLabel + %33 = OpPhi %v3float %sh %24 %34 %35 + %36 = OpPhi %int %int_0 %24 %37 %35 + OpLoopMerge %38 %35 None + OpBranch %39 + %39 = OpLabel + %40 = OpSLessThan %bool %36 %int_20 + OpBranchConditional %40 %41 %38 + %41 = OpLabel + %42 = OpCompositeExtract %float %33 0 + %43 = OpFAdd %float %42 %float_1 + %34 = OpCompositeInsert %v3float %43 %33 0 + OpBranch %35 + %35 = OpLabel + %37 = OpIAdd %int %36 %int_1 + OpBranch %32 + %38 = OpLabel + %44 = OpCompositeExtract %float %33 0 + %45 = OpCompositeConstruct %v4float %44 %44 %44 %44 + OpStore %OutColor %45 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(assembly, true); +} + +TEST_F(VectorDCETest, DeadInstThroughShuffle) { + // Dead insert in chain with cycle. Demonstrates analysis can handle + // cycles in chains. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec2 v; + // v.x = 0.0; + // v.y = 0.1; // dead + // for (int i = 0; i < 20; i++) { + // v.x = v.x + 1; + // v = v * 0.9; + // } + // OutColor = vec4(v.x); + // } + + const std::string assembly = + R"( +; CHECK: OpFunction +; CHECK-NOT: OpCompositeInsert %v2float {{%\w+}} 1 +; CHECK: OpFunctionEnd + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %OutColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %OutColor "OutColor" + OpDecorate %OutColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 +%float_0_100000001 = OpConstant %float 0.100000001 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_20 = OpConstant %int 20 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 +%float_0_899999976 = OpConstant %float 0.899999976 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %OutColor = OpVariable %_ptr_Output_v4float Output + %58 = OpUndef %v2float + %main = OpFunction %void None %3 + %5 = OpLabel + %49 = OpCompositeInsert %v2float %float_0 %58 0 + %51 = OpCompositeInsert %v2float %float_0_100000001 %49 1 + OpBranch %22 + %22 = OpLabel + %60 = OpPhi %v2float %51 %5 %38 %25 + %59 = OpPhi %int %int_0 %5 %41 %25 + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %30 = OpSLessThan %bool %59 %int_20 + OpBranchConditional %30 %23 %24 + %23 = OpLabel + %53 = OpCompositeExtract %float %60 0 + %34 = OpFAdd %float %53 %float_1 + %55 = OpCompositeInsert %v2float %34 %60 0 + %38 = OpVectorTimesScalar %v2float %55 %float_0_899999976 + OpBranch %25 + %25 = OpLabel + %41 = OpIAdd %int %59 %int_1 + OpBranch %22 + %24 = OpLabel + %57 = OpCompositeExtract %float %60 0 + %47 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %OutColor %47 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(assembly, true); +} + +TEST_F(VectorDCETest, DeadInsertThroughOtherInst) { + // Dead insert in chain with cycle. Demonstrates analysis can handle + // cycles in chains. + // + // Note: The SPIR-V assembly has had store/load elimination + // performed to allow the inserts and extracts to directly + // reference each other. + // + // #version 450 + // + // layout (location=0) out vec4 OutColor; + // + // void main() + // { + // vec2 v; + // v.x = 0.0; + // v.y = 0.1; // dead + // for (int i = 0; i < 20; i++) { + // v.x = v.x + 1; + // v = v * 0.9; + // } + // OutColor = vec4(v.x); + // } + + const std::string assembly = + R"( +; CHECK: OpFunction +; CHECK-NOT: OpCompositeInsert %v2float {{%\w+}} 1 +; CHECK: OpFunctionEnd + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" %OutColor + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 450 + OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" + OpSourceExtension "GL_GOOGLE_include_directive" + OpName %main "main" + OpName %OutColor "OutColor" + OpDecorate %OutColor Location 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %float_0 = OpConstant %float 0 +%float_0_100000001 = OpConstant %float 0.100000001 + %int = OpTypeInt 32 1 + %int_0 = OpConstant %int 0 + %int_20 = OpConstant %int 20 + %bool = OpTypeBool + %float_1 = OpConstant %float 1 +%float_0_899999976 = OpConstant %float 0.899999976 + %int_1 = OpConstant %int 1 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %OutColor = OpVariable %_ptr_Output_v4float Output + %58 = OpUndef %v2float + %main = OpFunction %void None %3 + %5 = OpLabel + %49 = OpCompositeInsert %v2float %float_0 %58 0 + %51 = OpCompositeInsert %v2float %float_0_100000001 %49 1 + OpBranch %22 + %22 = OpLabel + %60 = OpPhi %v2float %51 %5 %38 %25 + %59 = OpPhi %int %int_0 %5 %41 %25 + OpLoopMerge %24 %25 None + OpBranch %26 + %26 = OpLabel + %30 = OpSLessThan %bool %59 %int_20 + OpBranchConditional %30 %23 %24 + %23 = OpLabel + %53 = OpCompositeExtract %float %60 0 + %34 = OpFAdd %float %53 %float_1 + %55 = OpCompositeInsert %v2float %34 %60 0 + %38 = OpVectorTimesScalar %v2float %55 %float_0_899999976 + OpBranch %25 + %25 = OpLabel + %41 = OpIAdd %int %59 %int_1 + OpBranch %22 + %24 = OpLabel + %57 = OpCompositeExtract %float %60 0 + %47 = OpCompositeConstruct %v4float %57 %57 %57 %57 + OpStore %OutColor %47 + OpReturn + OpFunctionEnd +)"; + + SinglePassRunAndMatch(assembly, true); +} +#endif + +TEST_F(VectorDCETest, VectorIntoCompositeConstruct) { + const std::string text = R"(OpCapability Linkage +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %1 "EntryPoint_Main" %2 %3 +OpExecutionMode %1 OriginUpperLeft +OpDecorate %2 Location 0 +OpDecorate %_struct_4 Block +OpDecorate %3 Location 0 +%float = OpTypeFloat 32 +%v2float = OpTypeVector %float 2 +%_ptr_Function_v2float = OpTypePointer Function %v2float +%v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float +%mat4v4float = OpTypeMatrix %v4float 4 +%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float +%v3float = OpTypeVector %float 3 +%_ptr_Function_v3float = OpTypePointer Function %v3float +%_struct_14 = OpTypeStruct %v2float %mat4v4float %v3float %v2float %v4float +%_ptr_Function__struct_14 = OpTypePointer Function %_struct_14 +%void = OpTypeVoid +%int = OpTypeInt 32 1 +%int_2 = OpConstant %int 2 +%int_1 = OpConstant %int 1 +%int_4 = OpConstant %int 4 +%int_0 = OpConstant %int 0 +%int_3 = OpConstant %int 3 +%float_0 = OpConstant %float 0 +%float_1 = OpConstant %float 1 +%_ptr_Input_v2float = OpTypePointer Input %v2float +%2 = OpVariable %_ptr_Input_v2float Input +%_ptr_Output_v2float = OpTypePointer Output %v2float +%_struct_4 = OpTypeStruct %v2float +%_ptr_Output__struct_4 = OpTypePointer Output %_struct_4 +%3 = OpVariable %_ptr_Output__struct_4 Output +%28 = OpTypeFunction %void +%29 = OpConstantComposite %v2float %float_0 %float_0 +%30 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%31 = OpConstantComposite %mat4v4float %30 %30 %30 %30 +%32 = OpConstantComposite %v3float %float_0 %float_0 %float_0 +%1 = OpFunction %void None %28 +%33 = OpLabel +%34 = OpVariable %_ptr_Function_v4float Function +%35 = OpVariable %_ptr_Function__struct_14 Function +%36 = OpAccessChain %_ptr_Function_v2float %35 %int_0 +OpStore %36 %29 +%37 = OpAccessChain %_ptr_Function_mat4v4float %35 %int_1 +OpStore %37 %31 +%38 = OpAccessChain %_ptr_Function_v3float %35 %int_2 +OpStore %38 %32 +%39 = OpAccessChain %_ptr_Function_v2float %35 %int_3 +OpStore %39 %29 +%40 = OpAccessChain %_ptr_Function_v4float %35 %int_4 +OpStore %40 %30 +%41 = OpLoad %v2float %2 +OpStore %36 %41 +%42 = OpLoad %v3float %38 +%43 = OpCompositeConstruct %v4float %42 %float_1 +%44 = OpLoad %mat4v4float %37 +%45 = OpVectorTimesMatrix %v4float %43 %44 +OpStore %34 %45 +OpCopyMemory %40 %34 +OpCopyMemory %36 %39 +%46 = OpAccessChain %_ptr_Output_v2float %3 %int_0 +%47 = OpLoad %v2float %36 +OpStore %46 %47 +OpReturn +OpFunctionEnd +)"; + + SinglePassRunAndCheck(text, text, true, true); +} + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/workaround1209_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/workaround1209_test.cpp new file mode 100644 index 00000000000..853a01cb22d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/opt/workaround1209_test.cpp @@ -0,0 +1,425 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/opt/assembly_builder.h" +#include "test/opt/pass_fixture.h" +#include "test/opt/pass_utils.h" + +namespace spvtools { +namespace opt { +namespace { + +using Workaround1209Test = PassTest<::testing::Test>; + +#ifdef SPIRV_EFFCEE +TEST_F(Workaround1209Test, RemoveOpUnreachableInLoop) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %texcoord %gl_VertexIndex %_ + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpName %texcoord "texcoord" + OpName %buf "buf" + OpMemberName %buf 0 "MVP" + OpMemberName %buf 1 "position" + OpMemberName %buf 2 "attr" + OpName %ubuf "ubuf" + OpName %gl_VertexIndex "gl_VertexIndex" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpName %_ "" + OpDecorate %texcoord Location 0 + OpDecorate %_arr_v4float_uint_72 ArrayStride 16 + OpDecorate %_arr_v4float_uint_72_0 ArrayStride 16 + OpMemberDecorate %buf 0 ColMajor + OpMemberDecorate %buf 0 Offset 0 + OpMemberDecorate %buf 0 MatrixStride 16 + OpMemberDecorate %buf 1 Offset 64 + OpMemberDecorate %buf 2 Offset 1216 + OpDecorate %buf Block + OpDecorate %ubuf DescriptorSet 0 + OpDecorate %ubuf Binding 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %texcoord = OpVariable %_ptr_Output_v4float Output +%mat4v4float = OpTypeMatrix %v4float 4 + %uint = OpTypeInt 32 0 + %uint_72 = OpConstant %uint 72 +%_arr_v4float_uint_72 = OpTypeArray %v4float %uint_72 +%_arr_v4float_uint_72_0 = OpTypeArray %v4float %uint_72 + %buf = OpTypeStruct %mat4v4float %_arr_v4float_uint_72 %_arr_v4float_uint_72_0 +%_ptr_Uniform_buf = OpTypePointer Uniform %buf + %ubuf = OpVariable %_ptr_Uniform_buf Uniform + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%gl_PerVertex = OpTypeStruct %v4float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %12 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel +; CHECK: OpLoopMerge [[merge:%[a-zA-Z_\d]+]] + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel +; CHECK: OpSelectionMerge [[sel_merge:%[a-zA-Z_\d]+]] + OpSelectionMerge %34 None + OpSwitch %int_1 %35 + %35 = OpLabel + %36 = OpLoad %int %gl_VertexIndex + %37 = OpAccessChain %_ptr_Uniform_v4float %ubuf %int_2 %36 + %38 = OpLoad %v4float %37 + OpStore %texcoord %38 + %39 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %39 %28 + OpBranch %31 +; CHECK: [[sel_merge]] = OpLabel + %34 = OpLabel +; CHECK-NEXT: OpBranch [[merge]] + OpUnreachable + %32 = OpLabel + OpBranch %30 + %31 = OpLabel + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(Workaround1209Test, RemoveOpUnreachableInNestedLoop) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %2 "main" %3 %4 %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %2 "main" + OpName %3 "texcoord" + OpName %6 "buf" + OpMemberName %6 0 "MVP" + OpMemberName %6 1 "position" + OpMemberName %6 2 "attr" + OpName %7 "ubuf" + OpName %4 "gl_VertexIndex" + OpName %8 "gl_PerVertex" + OpMemberName %8 0 "gl_Position" + OpName %5 "" + OpDecorate %3 Location 0 + OpDecorate %9 ArrayStride 16 + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %6 0 ColMajor + OpMemberDecorate %6 0 Offset 0 + OpMemberDecorate %6 0 MatrixStride 16 + OpMemberDecorate %6 1 Offset 64 + OpMemberDecorate %6 2 Offset 1216 + OpDecorate %6 Block + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 0 + OpDecorate %4 BuiltIn VertexIndex + OpMemberDecorate %8 0 BuiltIn Position + OpDecorate %8 Block + %11 = OpTypeVoid + %12 = OpTypeFunction %11 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Output %14 + %3 = OpVariable %15 Output + %16 = OpTypeMatrix %14 4 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 72 + %9 = OpTypeArray %14 %18 + %10 = OpTypeArray %14 %18 + %6 = OpTypeStruct %16 %9 %10 + %19 = OpTypePointer Uniform %6 + %7 = OpVariable %19 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 2 + %22 = OpTypePointer Input %20 + %4 = OpVariable %22 Input + %23 = OpTypePointer Uniform %14 + %8 = OpTypeStruct %14 + %24 = OpTypePointer Output %8 + %5 = OpVariable %24 Output + %25 = OpConstant %20 0 + %26 = OpConstant %20 1 + %27 = OpConstant %13 1 + %28 = OpConstantComposite %14 %27 %27 %27 %27 + %2 = OpFunction %11 None %12 + %29 = OpLabel + OpBranch %31 + %31 = OpLabel +; CHECK: OpLoopMerge + OpLoopMerge %32 %33 None + OpBranch %30 + %30 = OpLabel +; CHECK: OpLoopMerge [[merge:%[a-zA-Z_\d]+]] + OpLoopMerge %34 %35 None + OpBranch %36 + %36 = OpLabel +; CHECK: OpSelectionMerge [[sel_merge:%[a-zA-Z_\d]+]] + OpSelectionMerge %37 None + OpSwitch %26 %38 + %38 = OpLabel + %39 = OpLoad %20 %4 + %40 = OpAccessChain %23 %7 %21 %39 + %41 = OpLoad %14 %40 + OpStore %3 %41 + %42 = OpAccessChain %15 %5 %25 + OpStore %42 %28 + OpBranch %34 +; CHECK: [[sel_merge]] = OpLabel + %37 = OpLabel +; CHECK-NEXT: OpBranch [[merge]] + OpUnreachable + %35 = OpLabel + OpBranch %30 + %34 = OpLabel + OpBranch %32 + %33 = OpLabel + OpBranch %31 + %32 = OpLabel + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(Workaround1209Test, RemoveOpUnreachableInAdjacentLoops) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %2 "main" %3 %4 %5 + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %2 "main" + OpName %3 "texcoord" + OpName %6 "buf" + OpMemberName %6 0 "MVP" + OpMemberName %6 1 "position" + OpMemberName %6 2 "attr" + OpName %7 "ubuf" + OpName %4 "gl_VertexIndex" + OpName %8 "gl_PerVertex" + OpMemberName %8 0 "gl_Position" + OpName %5 "" + OpDecorate %3 Location 0 + OpDecorate %9 ArrayStride 16 + OpDecorate %10 ArrayStride 16 + OpMemberDecorate %6 0 ColMajor + OpMemberDecorate %6 0 Offset 0 + OpMemberDecorate %6 0 MatrixStride 16 + OpMemberDecorate %6 1 Offset 64 + OpMemberDecorate %6 2 Offset 1216 + OpDecorate %6 Block + OpDecorate %7 DescriptorSet 0 + OpDecorate %7 Binding 0 + OpDecorate %4 BuiltIn VertexIndex + OpMemberDecorate %8 0 BuiltIn Position + OpDecorate %8 Block + %11 = OpTypeVoid + %12 = OpTypeFunction %11 + %13 = OpTypeFloat 32 + %14 = OpTypeVector %13 4 + %15 = OpTypePointer Output %14 + %3 = OpVariable %15 Output + %16 = OpTypeMatrix %14 4 + %17 = OpTypeInt 32 0 + %18 = OpConstant %17 72 + %9 = OpTypeArray %14 %18 + %10 = OpTypeArray %14 %18 + %6 = OpTypeStruct %16 %9 %10 + %19 = OpTypePointer Uniform %6 + %7 = OpVariable %19 Uniform + %20 = OpTypeInt 32 1 + %21 = OpConstant %20 2 + %22 = OpTypePointer Input %20 + %4 = OpVariable %22 Input + %23 = OpTypePointer Uniform %14 + %8 = OpTypeStruct %14 + %24 = OpTypePointer Output %8 + %5 = OpVariable %24 Output + %25 = OpConstant %20 0 + %26 = OpConstant %20 1 + %27 = OpConstant %13 1 + %28 = OpConstantComposite %14 %27 %27 %27 %27 + %2 = OpFunction %11 None %12 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel +; CHECK: OpLoopMerge [[merge1:%[a-zA-Z_\d]+]] + OpLoopMerge %31 %32 None + OpBranch %33 + %33 = OpLabel +; CHECK: OpSelectionMerge [[sel_merge1:%[a-zA-Z_\d]+]] + OpSelectionMerge %34 None + OpSwitch %26 %35 + %35 = OpLabel + %36 = OpLoad %20 %4 + %37 = OpAccessChain %23 %7 %21 %36 + %38 = OpLoad %14 %37 + OpStore %3 %38 + %39 = OpAccessChain %15 %5 %25 + OpStore %39 %28 + OpBranch %31 +; CHECK: [[sel_merge1]] = OpLabel + %34 = OpLabel +; CHECK-NEXT: OpBranch [[merge1]] + OpUnreachable + %32 = OpLabel + OpBranch %30 + %31 = OpLabel +; CHECK: OpLoopMerge [[merge2:%[a-zA-Z_\d]+]] + OpLoopMerge %40 %41 None + OpBranch %42 + %42 = OpLabel +; CHECK: OpSelectionMerge [[sel_merge2:%[a-zA-Z_\d]+]] + OpSelectionMerge %43 None + OpSwitch %26 %44 + %44 = OpLabel + %45 = OpLoad %20 %4 + %46 = OpAccessChain %23 %7 %21 %45 + %47 = OpLoad %14 %46 + OpStore %3 %47 + %48 = OpAccessChain %15 %5 %25 + OpStore %48 %28 + OpBranch %40 +; CHECK: [[sel_merge2]] = OpLabel + %43 = OpLabel +; CHECK-NEXT: OpBranch [[merge2]] + OpUnreachable + %41 = OpLabel + OpBranch %31 + %40 = OpLabel + OpReturn + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} + +TEST_F(Workaround1209Test, LeaveUnreachableNotInLoop) { + const std::string text = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %texcoord %gl_VertexIndex %_ + OpSource GLSL 400 + OpSourceExtension "GL_ARB_separate_shader_objects" + OpSourceExtension "GL_ARB_shading_language_420pack" + OpName %main "main" + OpName %texcoord "texcoord" + OpName %buf "buf" + OpMemberName %buf 0 "MVP" + OpMemberName %buf 1 "position" + OpMemberName %buf 2 "attr" + OpName %ubuf "ubuf" + OpName %gl_VertexIndex "gl_VertexIndex" + OpName %gl_PerVertex "gl_PerVertex" + OpMemberName %gl_PerVertex 0 "gl_Position" + OpName %_ "" + OpDecorate %texcoord Location 0 + OpDecorate %_arr_v4float_uint_72 ArrayStride 16 + OpDecorate %_arr_v4float_uint_72_0 ArrayStride 16 + OpMemberDecorate %buf 0 ColMajor + OpMemberDecorate %buf 0 Offset 0 + OpMemberDecorate %buf 0 MatrixStride 16 + OpMemberDecorate %buf 1 Offset 64 + OpMemberDecorate %buf 2 Offset 1216 + OpDecorate %buf Block + OpDecorate %ubuf DescriptorSet 0 + OpDecorate %ubuf Binding 0 + OpDecorate %gl_VertexIndex BuiltIn VertexIndex + OpMemberDecorate %gl_PerVertex 0 BuiltIn Position + OpDecorate %gl_PerVertex Block + %void = OpTypeVoid + %12 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Output_v4float = OpTypePointer Output %v4float + %texcoord = OpVariable %_ptr_Output_v4float Output +%mat4v4float = OpTypeMatrix %v4float 4 + %uint = OpTypeInt 32 0 + %uint_72 = OpConstant %uint 72 +%_arr_v4float_uint_72 = OpTypeArray %v4float %uint_72 +%_arr_v4float_uint_72_0 = OpTypeArray %v4float %uint_72 + %buf = OpTypeStruct %mat4v4float %_arr_v4float_uint_72 %_arr_v4float_uint_72_0 +%_ptr_Uniform_buf = OpTypePointer Uniform %buf + %ubuf = OpVariable %_ptr_Uniform_buf Uniform + %int = OpTypeInt 32 1 + %int_2 = OpConstant %int 2 +%_ptr_Input_int = OpTypePointer Input %int +%gl_VertexIndex = OpVariable %_ptr_Input_int Input +%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float +%gl_PerVertex = OpTypeStruct %v4float +%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex + %_ = OpVariable %_ptr_Output_gl_PerVertex Output + %int_0 = OpConstant %int 0 + %int_1 = OpConstant %int 1 + %float_1 = OpConstant %float 1 + %28 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %main = OpFunction %void None %12 + %29 = OpLabel + OpBranch %30 + %30 = OpLabel + OpSelectionMerge %34 None + OpSwitch %int_1 %35 + %35 = OpLabel + %36 = OpLoad %int %gl_VertexIndex + %37 = OpAccessChain %_ptr_Uniform_v4float %ubuf %int_2 %36 + %38 = OpLoad %v4float %37 + OpStore %texcoord %38 + %39 = OpAccessChain %_ptr_Output_v4float %_ %int_0 + OpStore %39 %28 + OpReturn + %34 = OpLabel +; CHECK: OpUnreachable + OpUnreachable + OpFunctionEnd)"; + + SinglePassRunAndMatch(text, false); +} +#endif + +} // namespace +} // namespace opt +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/parse_number_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/parse_number_test.cpp new file mode 100644 index 00000000000..c99205cf57b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/parse_number_test.cpp @@ -0,0 +1,970 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/util/parse_number.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace utils { +namespace { + +using testing::Eq; +using testing::IsNull; +using testing::NotNull; + +TEST(ParseNarrowSignedIntegers, Sample) { + int16_t i16; + + EXPECT_FALSE(ParseNumber(nullptr, &i16)); + EXPECT_FALSE(ParseNumber("", &i16)); + EXPECT_FALSE(ParseNumber("0=", &i16)); + + EXPECT_TRUE(ParseNumber("0", &i16)); + EXPECT_EQ(0, i16); + EXPECT_TRUE(ParseNumber("32767", &i16)); + EXPECT_EQ(32767, i16); + EXPECT_TRUE(ParseNumber("-32768", &i16)); + EXPECT_EQ(-32768, i16); + EXPECT_TRUE(ParseNumber("-0", &i16)); + EXPECT_EQ(0, i16); + + // These are out of range, so they should return an error. + // The error code depends on whether this is an optional value. + EXPECT_FALSE(ParseNumber("32768", &i16)); + EXPECT_FALSE(ParseNumber("65535", &i16)); + + // Check hex parsing. + EXPECT_TRUE(ParseNumber("0x7fff", &i16)); + EXPECT_EQ(32767, i16); + // This is out of range. + EXPECT_FALSE(ParseNumber("0xffff", &i16)); +} + +TEST(ParseNarrowUnsignedIntegers, Sample) { + uint16_t u16; + + EXPECT_FALSE(ParseNumber(nullptr, &u16)); + EXPECT_FALSE(ParseNumber("", &u16)); + EXPECT_FALSE(ParseNumber("0=", &u16)); + + EXPECT_TRUE(ParseNumber("0", &u16)); + EXPECT_EQ(0, u16); + EXPECT_TRUE(ParseNumber("65535", &u16)); + EXPECT_EQ(65535, u16); + EXPECT_FALSE(ParseNumber("65536", &u16)); + + // We don't care about -0 since it's rejected at a higher level. + EXPECT_FALSE(ParseNumber("-1", &u16)); + EXPECT_TRUE(ParseNumber("0xffff", &u16)); + EXPECT_EQ(0xffff, u16); + EXPECT_FALSE(ParseNumber("0x10000", &u16)); +} + +TEST(ParseSignedIntegers, Sample) { + int32_t i32; + + // Invalid parse. + EXPECT_FALSE(ParseNumber(nullptr, &i32)); + EXPECT_FALSE(ParseNumber("", &i32)); + EXPECT_FALSE(ParseNumber("0=", &i32)); + + // Decimal values. + EXPECT_TRUE(ParseNumber("0", &i32)); + EXPECT_EQ(0, i32); + EXPECT_TRUE(ParseNumber("2147483647", &i32)); + EXPECT_EQ(std::numeric_limits::max(), i32); + EXPECT_FALSE(ParseNumber("2147483648", &i32)); + EXPECT_TRUE(ParseNumber("-0", &i32)); + EXPECT_EQ(0, i32); + EXPECT_TRUE(ParseNumber("-1", &i32)); + EXPECT_EQ(-1, i32); + EXPECT_TRUE(ParseNumber("-2147483648", &i32)); + EXPECT_EQ(std::numeric_limits::min(), i32); + + // Hex values. + EXPECT_TRUE(ParseNumber("0x7fffffff", &i32)); + EXPECT_EQ(std::numeric_limits::max(), i32); + EXPECT_FALSE(ParseNumber("0x80000000", &i32)); + EXPECT_TRUE(ParseNumber("-0x000", &i32)); + EXPECT_EQ(0, i32); + EXPECT_TRUE(ParseNumber("-0x001", &i32)); + EXPECT_EQ(-1, i32); + EXPECT_TRUE(ParseNumber("-0x80000000", &i32)); + EXPECT_EQ(std::numeric_limits::min(), i32); +} + +TEST(ParseUnsignedIntegers, Sample) { + uint32_t u32; + + // Invalid parse. + EXPECT_FALSE(ParseNumber(nullptr, &u32)); + EXPECT_FALSE(ParseNumber("", &u32)); + EXPECT_FALSE(ParseNumber("0=", &u32)); + + // Valid values. + EXPECT_TRUE(ParseNumber("0", &u32)); + EXPECT_EQ(0u, u32); + EXPECT_TRUE(ParseNumber("4294967295", &u32)); + EXPECT_EQ(std::numeric_limits::max(), u32); + EXPECT_FALSE(ParseNumber("4294967296", &u32)); + + // Hex values. + EXPECT_TRUE(ParseNumber("0xffffffff", &u32)); + EXPECT_EQ(std::numeric_limits::max(), u32); + + // We don't care about -0 since it's rejected at a higher level. + EXPECT_FALSE(ParseNumber("-1", &u32)); +} + +TEST(ParseWideSignedIntegers, Sample) { + int64_t i64; + EXPECT_FALSE(ParseNumber(nullptr, &i64)); + EXPECT_FALSE(ParseNumber("", &i64)); + EXPECT_FALSE(ParseNumber("0=", &i64)); + EXPECT_TRUE(ParseNumber("0", &i64)); + EXPECT_EQ(0, i64); + EXPECT_TRUE(ParseNumber("0x7fffffffffffffff", &i64)); + EXPECT_EQ(0x7fffffffffffffff, i64); + EXPECT_TRUE(ParseNumber("-0", &i64)); + EXPECT_EQ(0, i64); + EXPECT_TRUE(ParseNumber("-1", &i64)); + EXPECT_EQ(-1, i64); +} + +TEST(ParseWideUnsignedIntegers, Sample) { + uint64_t u64; + EXPECT_FALSE(ParseNumber(nullptr, &u64)); + EXPECT_FALSE(ParseNumber("", &u64)); + EXPECT_FALSE(ParseNumber("0=", &u64)); + EXPECT_TRUE(ParseNumber("0", &u64)); + EXPECT_EQ(0u, u64); + EXPECT_TRUE(ParseNumber("0xffffffffffffffff", &u64)); + EXPECT_EQ(0xffffffffffffffffULL, u64); + + // We don't care about -0 since it's rejected at a higher level. + EXPECT_FALSE(ParseNumber("-1", &u64)); +} + +TEST(ParseFloat, Sample) { + float f; + + EXPECT_FALSE(ParseNumber(nullptr, &f)); + EXPECT_FALSE(ParseNumber("", &f)); + EXPECT_FALSE(ParseNumber("0=", &f)); + + // These values are exactly representatble. + EXPECT_TRUE(ParseNumber("0", &f)); + EXPECT_EQ(0.0f, f); + EXPECT_TRUE(ParseNumber("42", &f)); + EXPECT_EQ(42.0f, f); + EXPECT_TRUE(ParseNumber("2.5", &f)); + EXPECT_EQ(2.5f, f); + EXPECT_TRUE(ParseNumber("-32.5", &f)); + EXPECT_EQ(-32.5f, f); + EXPECT_TRUE(ParseNumber("1e38", &f)); + EXPECT_EQ(1e38f, f); + EXPECT_TRUE(ParseNumber("-1e38", &f)); + EXPECT_EQ(-1e38f, f); +} + +TEST(ParseFloat, Overflow) { + // The assembler parses using HexFloat>. Make + // sure that succeeds for in-range values, and fails for out of + // range values. When it does overflow, the value is set to the + // nearest finite value, matching C++11 behavior for operator>> + // on floating point. + HexFloat> f(0.0f); + + EXPECT_TRUE(ParseNumber("1e38", &f)); + EXPECT_EQ(1e38f, f.value().getAsFloat()); + EXPECT_TRUE(ParseNumber("-1e38", &f)); + EXPECT_EQ(-1e38f, f.value().getAsFloat()); + EXPECT_FALSE(ParseNumber("1e40", &f)); + EXPECT_FALSE(ParseNumber("-1e40", &f)); + EXPECT_FALSE(ParseNumber("1e400", &f)); + EXPECT_FALSE(ParseNumber("-1e400", &f)); +} + +TEST(ParseDouble, Sample) { + double f; + + EXPECT_FALSE(ParseNumber(nullptr, &f)); + EXPECT_FALSE(ParseNumber("", &f)); + EXPECT_FALSE(ParseNumber("0=", &f)); + + // These values are exactly representatble. + EXPECT_TRUE(ParseNumber("0", &f)); + EXPECT_EQ(0.0, f); + EXPECT_TRUE(ParseNumber("42", &f)); + EXPECT_EQ(42.0, f); + EXPECT_TRUE(ParseNumber("2.5", &f)); + EXPECT_EQ(2.5, f); + EXPECT_TRUE(ParseNumber("-32.5", &f)); + EXPECT_EQ(-32.5, f); + EXPECT_TRUE(ParseNumber("1e38", &f)); + EXPECT_EQ(1e38, f); + EXPECT_TRUE(ParseNumber("-1e38", &f)); + EXPECT_EQ(-1e38, f); + // These are out of range for 32-bit float, but in range for 64-bit float. + EXPECT_TRUE(ParseNumber("1e40", &f)); + EXPECT_EQ(1e40, f); + EXPECT_TRUE(ParseNumber("-1e40", &f)); + EXPECT_EQ(-1e40, f); +} + +TEST(ParseDouble, Overflow) { + // The assembler parses using HexFloat>. Make + // sure that succeeds for in-range values, and fails for out of + // range values. When it does overflow, the value is set to the + // nearest finite value, matching C++11 behavior for operator>> + // on floating point. + HexFloat> f(0.0); + + EXPECT_TRUE(ParseNumber("1e38", &f)); + EXPECT_EQ(1e38, f.value().getAsFloat()); + EXPECT_TRUE(ParseNumber("-1e38", &f)); + EXPECT_EQ(-1e38, f.value().getAsFloat()); + EXPECT_TRUE(ParseNumber("1e40", &f)); + EXPECT_EQ(1e40, f.value().getAsFloat()); + EXPECT_TRUE(ParseNumber("-1e40", &f)); + EXPECT_EQ(-1e40, f.value().getAsFloat()); + EXPECT_FALSE(ParseNumber("1e400", &f)); + EXPECT_FALSE(ParseNumber("-1e400", &f)); +} + +TEST(ParseFloat16, Overflow) { + // The assembler parses using HexFloat>. Make + // sure that succeeds for in-range values, and fails for out of + // range values. When it does overflow, the value is set to the + // nearest finite value, matching C++11 behavior for operator>> + // on floating point. + HexFloat> f(0); + + EXPECT_FALSE(ParseNumber(nullptr, &f)); + EXPECT_TRUE(ParseNumber("-0.0", &f)); + EXPECT_EQ(uint16_t{0x8000}, f.value().getAsFloat().get_value()); + EXPECT_TRUE(ParseNumber("1.0", &f)); + EXPECT_EQ(uint16_t{0x3c00}, f.value().getAsFloat().get_value()); + + // Overflows 16-bit but not 32-bit + EXPECT_FALSE(ParseNumber("1e38", &f)); + EXPECT_FALSE(ParseNumber("-1e38", &f)); + + // Overflows 32-bit but not 64-bit + EXPECT_FALSE(ParseNumber("1e40", &f)); + EXPECT_FALSE(ParseNumber("-1e40", &f)); + + // Overflows 64-bit + EXPECT_FALSE(ParseNumber("1e400", &f)); + EXPECT_FALSE(ParseNumber("-1e400", &f)); +} + +void AssertEmitFunc(uint32_t) { + ASSERT_FALSE(true) + << "Should not call emit() function when the number can not be parsed."; + return; +} + +TEST(ParseAndEncodeNarrowSignedIntegers, Invalid) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {16, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber(nullptr, type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("The given text is a nullptr", err_msg); + rc = ParseAndEncodeIntegerNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: ", err_msg); + rc = ParseAndEncodeIntegerNumber("=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: =", err_msg); + rc = ParseAndEncodeIntegerNumber("-", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid signed integer literal: -", err_msg); + rc = ParseAndEncodeIntegerNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 0=", err_msg); +} + +TEST(ParseAndEncodeNarrowSignedIntegers, Overflow) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {16, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber("32768", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Integer 32768 does not fit in a 16-bit signed integer", err_msg); + rc = ParseAndEncodeIntegerNumber("-32769", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Integer -32769 does not fit in a 16-bit signed integer", err_msg); +} + +TEST(ParseAndEncodeNarrowSignedIntegers, Success) { + // Don't care the error message in this case. + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + NumberType type = {16, SPV_NUMBER_SIGNED_INT}; + + // Zero, maximum, and minimum value + rc = ParseAndEncodeIntegerNumber( + "0", type, [](uint32_t word) { EXPECT_EQ(0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "-0", type, [](uint32_t word) { EXPECT_EQ(0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "32767", type, [](uint32_t word) { EXPECT_EQ(0x00007fffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "-32768", type, [](uint32_t word) { EXPECT_EQ(0xffff8000u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Hex parsing + rc = ParseAndEncodeIntegerNumber( + "0x7fff", type, [](uint32_t word) { EXPECT_EQ(0x00007fffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "0xffff", type, [](uint32_t word) { EXPECT_EQ(0xffffffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); +} + +TEST(ParseAndEncodeNarrowUnsignedIntegers, Invalid) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {16, SPV_NUMBER_UNSIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber(nullptr, type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("The given text is a nullptr", err_msg); + rc = ParseAndEncodeIntegerNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: ", err_msg); + rc = ParseAndEncodeIntegerNumber("=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: =", err_msg); + rc = ParseAndEncodeIntegerNumber("-", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); + rc = ParseAndEncodeIntegerNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 0=", err_msg); + rc = ParseAndEncodeIntegerNumber("-0", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); + rc = ParseAndEncodeIntegerNumber("-1", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); +} + +TEST(ParseAndEncodeNarrowUnsignedIntegers, Overflow) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg("random content"); + NumberType type = {16, SPV_NUMBER_UNSIGNED_INT}; + + // Overflow + rc = ParseAndEncodeIntegerNumber("65536", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Integer 65536 does not fit in a 16-bit unsigned integer", err_msg); +} + +TEST(ParseAndEncodeNarrowUnsignedIntegers, Success) { + // Don't care the error message in this case. + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + NumberType type = {16, SPV_NUMBER_UNSIGNED_INT}; + + // Zero, maximum, and minimum value + rc = ParseAndEncodeIntegerNumber( + "0", type, [](uint32_t word) { EXPECT_EQ(0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "65535", type, [](uint32_t word) { EXPECT_EQ(0x0000ffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Hex parsing + rc = ParseAndEncodeIntegerNumber( + "0xffff", type, [](uint32_t word) { EXPECT_EQ(0x0000ffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); +} + +TEST(ParseAndEncodeSignedIntegers, Invalid) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber(nullptr, type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("The given text is a nullptr", err_msg); + rc = ParseAndEncodeIntegerNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: ", err_msg); + rc = ParseAndEncodeIntegerNumber("=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: =", err_msg); + rc = ParseAndEncodeIntegerNumber("-", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid signed integer literal: -", err_msg); + rc = ParseAndEncodeIntegerNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 0=", err_msg); +} + +TEST(ParseAndEncodeSignedIntegers, Overflow) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_SIGNED_INT}; + + rc = + ParseAndEncodeIntegerNumber("2147483648", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Integer 2147483648 does not fit in a 32-bit signed integer", + err_msg); + rc = ParseAndEncodeIntegerNumber("-2147483649", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Integer -2147483649 does not fit in a 32-bit signed integer", + err_msg); +} + +TEST(ParseAndEncodeSignedIntegers, Success) { + // Don't care the error message in this case. + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + NumberType type = {32, SPV_NUMBER_SIGNED_INT}; + + // Zero, maximum, and minimum value + rc = ParseAndEncodeIntegerNumber( + "0", type, [](uint32_t word) { EXPECT_EQ(0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "-0", type, [](uint32_t word) { EXPECT_EQ(0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "2147483647", type, [](uint32_t word) { EXPECT_EQ(0x7fffffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "-2147483648", type, [](uint32_t word) { EXPECT_EQ(0x80000000u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Hex parsing + rc = ParseAndEncodeIntegerNumber( + "0x7fffffff", type, [](uint32_t word) { EXPECT_EQ(0x7fffffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "0xffffffff", type, [](uint32_t word) { EXPECT_EQ(0xffffffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); +} + +TEST(ParseAndEncodeUnsignedIntegers, Invalid) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_UNSIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber(nullptr, type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("The given text is a nullptr", err_msg); + rc = ParseAndEncodeIntegerNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: ", err_msg); + rc = ParseAndEncodeIntegerNumber("=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: =", err_msg); + rc = ParseAndEncodeIntegerNumber("-", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); + rc = ParseAndEncodeIntegerNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 0=", err_msg); + rc = ParseAndEncodeIntegerNumber("-0", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); + rc = ParseAndEncodeIntegerNumber("-1", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); +} + +TEST(ParseAndEncodeUnsignedIntegers, Overflow) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg("random content"); + NumberType type = {32, SPV_NUMBER_UNSIGNED_INT}; + + // Overflow + rc = + ParseAndEncodeIntegerNumber("4294967296", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Integer 4294967296 does not fit in a 32-bit unsigned integer", + err_msg); +} + +TEST(ParseAndEncodeUnsignedIntegers, Success) { + // Don't care the error message in this case. + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + NumberType type = {32, SPV_NUMBER_UNSIGNED_INT}; + + // Zero, maximum, and minimum value + rc = ParseAndEncodeIntegerNumber( + "0", type, [](uint32_t word) { EXPECT_EQ(0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeIntegerNumber( + "4294967295", type, [](uint32_t word) { EXPECT_EQ(0xffffffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Hex parsing + rc = ParseAndEncodeIntegerNumber( + "0xffffffff", type, [](uint32_t word) { EXPECT_EQ(0xffffffffu, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); +} + +TEST(ParseAndEncodeWideSignedIntegers, Invalid) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {64, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber(nullptr, type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("The given text is a nullptr", err_msg); + rc = ParseAndEncodeIntegerNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: ", err_msg); + rc = ParseAndEncodeIntegerNumber("=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: =", err_msg); + rc = ParseAndEncodeIntegerNumber("-", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid signed integer literal: -", err_msg); + rc = ParseAndEncodeIntegerNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 0=", err_msg); +} + +TEST(ParseAndEncodeWideSignedIntegers, Overflow) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {64, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber("9223372036854775808", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ( + "Integer 9223372036854775808 does not fit in a 64-bit signed integer", + err_msg); + rc = ParseAndEncodeIntegerNumber("-9223372036854775809", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid signed integer literal: -9223372036854775809", err_msg); +} + +TEST(ParseAndEncodeWideSignedIntegers, Success) { + // Don't care the error message in this case. + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + NumberType type = {64, SPV_NUMBER_SIGNED_INT}; + std::vector word_buffer; + auto emit = [&word_buffer](uint32_t word) { + if (word_buffer.size() == 2) word_buffer.clear(); + word_buffer.push_back(word); + }; + + // Zero, maximum, and minimum value + rc = ParseAndEncodeIntegerNumber("0", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0u})); + rc = ParseAndEncodeIntegerNumber("-0", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0u})); + rc = ParseAndEncodeIntegerNumber("9223372036854775807", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xffffffffu, 0x7fffffffu})); + rc = ParseAndEncodeIntegerNumber("-9223372036854775808", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0x80000000u})); + rc = ParseAndEncodeIntegerNumber("-1", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xffffffffu, 0xffffffffu})); + + // Hex parsing + rc = ParseAndEncodeIntegerNumber("0x7fffffffffffffff", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xffffffffu, 0x7fffffffu})); + rc = ParseAndEncodeIntegerNumber("0xffffffffffffffff", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xffffffffu, 0xffffffffu})); +} + +TEST(ParseAndEncodeWideUnsignedIntegers, Invalid) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {64, SPV_NUMBER_UNSIGNED_INT}; + + // Invalid + rc = ParseAndEncodeIntegerNumber(nullptr, type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("The given text is a nullptr", err_msg); + rc = ParseAndEncodeIntegerNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: ", err_msg); + rc = ParseAndEncodeIntegerNumber("=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: =", err_msg); + rc = ParseAndEncodeIntegerNumber("-", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); + rc = ParseAndEncodeIntegerNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 0=", err_msg); + rc = ParseAndEncodeIntegerNumber("-0", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); + rc = ParseAndEncodeIntegerNumber("-1", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("Cannot put a negative number in an unsigned literal", err_msg); +} + +TEST(ParseAndEncodeWideUnsignedIntegers, Overflow) { + // The error message should be overwritten after each parsing call. + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {64, SPV_NUMBER_UNSIGNED_INT}; + + // Overflow + rc = ParseAndEncodeIntegerNumber("18446744073709551616", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: 18446744073709551616", err_msg); +} + +TEST(ParseAndEncodeWideUnsignedIntegers, Success) { + // Don't care the error message in this case. + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + NumberType type = {64, SPV_NUMBER_UNSIGNED_INT}; + std::vector word_buffer; + auto emit = [&word_buffer](uint32_t word) { + if (word_buffer.size() == 2) word_buffer.clear(); + word_buffer.push_back(word); + }; + + // Zero, maximum, and minimum value + rc = ParseAndEncodeIntegerNumber("0", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0u})); + rc = ParseAndEncodeIntegerNumber("18446744073709551615", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xffffffffu, 0xffffffffu})); + + // Hex parsing + rc = ParseAndEncodeIntegerNumber("0xffffffffffffffff", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xffffffffu, 0xffffffffu})); +} + +TEST(ParseAndEncodeIntegerNumber, TypeNone) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_NONE}; + + rc = ParseAndEncodeIntegerNumber( + "0.0", type, [](uint32_t word) { EXPECT_EQ(0x0u, word); }, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("The expected type is not a integer type", err_msg); +} + +TEST(ParseAndEncodeIntegerNumber, InvalidCaseWithoutErrorMessageString) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + NumberType type = {32, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber("invalid", type, AssertEmitFunc, nullptr); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); +} + +TEST(ParseAndEncodeIntegerNumber, DoNotTouchErrorMessageStringOnSuccess) { + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + std::string err_msg("random content"); + NumberType type = {32, SPV_NUMBER_SIGNED_INT}; + + rc = ParseAndEncodeIntegerNumber( + "100", type, [](uint32_t word) { EXPECT_EQ(100u, word); }, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_EQ("random content", err_msg); +} + +TEST(ParseAndEncodeFloat, Sample) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_FLOATING}; + + // Invalid + rc = ParseAndEncodeFloatingPointNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 32-bit float literal: ", err_msg); + rc = ParseAndEncodeFloatingPointNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 32-bit float literal: 0=", err_msg); + + // Representative samples + rc = ParseAndEncodeFloatingPointNumber( + "0.0", type, [](uint32_t word) { EXPECT_EQ(0x0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "-0.0", type, [](uint32_t word) { EXPECT_EQ(0x80000000u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "42", type, [](uint32_t word) { EXPECT_EQ(0x42280000u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "2.5", type, [](uint32_t word) { EXPECT_EQ(0x40200000u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "-32.5", type, [](uint32_t word) { EXPECT_EQ(0xc2020000u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "1e38", type, [](uint32_t word) { EXPECT_EQ(0x7e967699u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "-1e38", type, [](uint32_t word) { EXPECT_EQ(0xfe967699u, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Overflow + rc = + ParseAndEncodeFloatingPointNumber("1e40", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 32-bit float literal: 1e40", err_msg); + rc = ParseAndEncodeFloatingPointNumber("-1e40", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 32-bit float literal: -1e40", err_msg); + rc = ParseAndEncodeFloatingPointNumber("1e400", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 32-bit float literal: 1e400", err_msg); + rc = ParseAndEncodeFloatingPointNumber("-1e400", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 32-bit float literal: -1e400", err_msg); +} + +TEST(ParseAndEncodeDouble, Sample) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {64, SPV_NUMBER_FLOATING}; + std::vector word_buffer; + auto emit = [&word_buffer](uint32_t word) { + if (word_buffer.size() == 2) word_buffer.clear(); + word_buffer.push_back(word); + }; + + // Invalid + rc = ParseAndEncodeFloatingPointNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 64-bit float literal: ", err_msg); + rc = ParseAndEncodeFloatingPointNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 64-bit float literal: 0=", err_msg); + + // Representative samples + rc = ParseAndEncodeFloatingPointNumber("0.0", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0u})); + rc = ParseAndEncodeFloatingPointNumber("-0.0", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0x80000000u})); + rc = ParseAndEncodeFloatingPointNumber("42", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0x40450000u})); + rc = ParseAndEncodeFloatingPointNumber("2.5", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0x40040000u})); + rc = ParseAndEncodeFloatingPointNumber("32.5", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0u, 0x40404000u})); + rc = ParseAndEncodeFloatingPointNumber("1e38", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0x2a16a1b1u, 0x47d2ced3u})); + rc = ParseAndEncodeFloatingPointNumber("-1e38", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0x2a16a1b1u, 0xc7d2ced3u})); + rc = ParseAndEncodeFloatingPointNumber("1e40", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xf1c35ca5u, 0x483d6329u})); + rc = ParseAndEncodeFloatingPointNumber("-1e40", type, emit, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_THAT(word_buffer, Eq(std::vector{0xf1c35ca5u, 0xc83d6329u})); + + // Overflow + rc = ParseAndEncodeFloatingPointNumber("1e400", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 64-bit float literal: 1e400", err_msg); + rc = ParseAndEncodeFloatingPointNumber("-1e400", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 64-bit float literal: -1e400", err_msg); +} + +TEST(ParseAndEncodeFloat16, Sample) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {16, SPV_NUMBER_FLOATING}; + + // Invalid + rc = ParseAndEncodeFloatingPointNumber("", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: ", err_msg); + rc = ParseAndEncodeFloatingPointNumber("0=", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: 0=", err_msg); + + // Representative samples + rc = ParseAndEncodeFloatingPointNumber( + "0.0", type, [](uint32_t word) { EXPECT_EQ(0x0u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "-0.0", type, [](uint32_t word) { EXPECT_EQ(0x8000u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "1.0", type, [](uint32_t word) { EXPECT_EQ(0x3c00u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "2.5", type, [](uint32_t word) { EXPECT_EQ(0x4100u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + rc = ParseAndEncodeFloatingPointNumber( + "32.5", type, [](uint32_t word) { EXPECT_EQ(0x5010u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Overflow + rc = + ParseAndEncodeFloatingPointNumber("1e38", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: 1e38", err_msg); + rc = ParseAndEncodeFloatingPointNumber("-1e38", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: -1e38", err_msg); + rc = + ParseAndEncodeFloatingPointNumber("1e40", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: 1e40", err_msg); + rc = ParseAndEncodeFloatingPointNumber("-1e40", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: -1e40", err_msg); + rc = ParseAndEncodeFloatingPointNumber("1e400", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: 1e400", err_msg); + rc = ParseAndEncodeFloatingPointNumber("-1e400", type, AssertEmitFunc, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid 16-bit float literal: -1e400", err_msg); +} + +TEST(ParseAndEncodeFloatingPointNumber, TypeNone) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_NONE}; + + rc = ParseAndEncodeFloatingPointNumber( + "0.0", type, [](uint32_t word) { EXPECT_EQ(0x0u, word); }, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidUsage, rc); + EXPECT_EQ("The expected type is not a float type", err_msg); +} + +TEST(ParseAndEncodeFloatingPointNumber, InvalidCaseWithoutErrorMessageString) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + NumberType type = {32, SPV_NUMBER_FLOATING}; + + rc = ParseAndEncodeFloatingPointNumber("invalid", type, AssertEmitFunc, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); +} + +TEST(ParseAndEncodeFloatingPointNumber, DoNotTouchErrorMessageStringOnSuccess) { + EncodeNumberStatus rc = EncodeNumberStatus::kInvalidText; + std::string err_msg("random content"); + NumberType type = {32, SPV_NUMBER_FLOATING}; + + rc = ParseAndEncodeFloatingPointNumber( + "0.0", type, [](uint32_t word) { EXPECT_EQ(0x0u, word); }, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_EQ("random content", err_msg); +} + +TEST(ParseAndEncodeNumber, Sample) { + EncodeNumberStatus rc = EncodeNumberStatus::kSuccess; + std::string err_msg; + NumberType type = {32, SPV_NUMBER_SIGNED_INT}; + + // Invalid with error message string + rc = ParseAndEncodeNumber("something wrong", type, AssertEmitFunc, &err_msg); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + EXPECT_EQ("Invalid unsigned integer literal: something wrong", err_msg); + + // Invalid without error message string + rc = ParseAndEncodeNumber("something wrong", type, AssertEmitFunc, nullptr); + EXPECT_EQ(EncodeNumberStatus::kInvalidText, rc); + + // Signed integer, should not touch the error message string. + err_msg = "random content"; + rc = ParseAndEncodeNumber("-1", type, + [](uint32_t word) { EXPECT_EQ(0xffffffffu, word); }, + &err_msg); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + EXPECT_EQ("random content", err_msg); + + // Unsigned integer + type = {32, SPV_NUMBER_UNSIGNED_INT}; + rc = ParseAndEncodeNumber( + "1", type, [](uint32_t word) { EXPECT_EQ(1u, word); }, nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); + + // Float + type = {32, SPV_NUMBER_FLOATING}; + rc = ParseAndEncodeNumber("-1.0", type, + [](uint32_t word) { EXPECT_EQ(0xbf800000, word); }, + nullptr); + EXPECT_EQ(EncodeNumberStatus::kSuccess, rc); +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/preserve_numeric_ids_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/preserve_numeric_ids_test.cpp new file mode 100644 index 00000000000..1c3354d55e6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/preserve_numeric_ids_test.cpp @@ -0,0 +1,159 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include + +#include "source/text.h" +#include "source/text_handler.h" +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using spvtest::ScopedContext; + +// Converts code to binary and then back to text. +spv_result_t ToBinaryAndBack( + const std::string& before, std::string* after, + uint32_t text_to_binary_options = SPV_TEXT_TO_BINARY_OPTION_NONE, + uint32_t binary_to_text_options = SPV_BINARY_TO_TEXT_OPTION_NONE, + spv_target_env env = SPV_ENV_UNIVERSAL_1_0) { + ScopedContext ctx(env); + spv_binary binary; + spv_text text; + + spv_result_t result = + spvTextToBinaryWithOptions(ctx.context, before.c_str(), before.size(), + text_to_binary_options, &binary, nullptr); + if (result != SPV_SUCCESS) { + return result; + } + + result = spvBinaryToText(ctx.context, binary->code, binary->wordCount, + binary_to_text_options, &text, nullptr); + if (result != SPV_SUCCESS) { + return result; + } + + *after = std::string(text->str, text->length); + + spvBinaryDestroy(binary); + spvTextDestroy(text); + + return SPV_SUCCESS; +} + +TEST(ToBinaryAndBack, DontPreserveNumericIds) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%i32 = OpTypeInt 32 1 +%u32 = OpTypeInt 32 0 +%f32 = OpTypeFloat 32 +%200 = OpTypeVoid +%300 = OpTypeFunction %200 +%main = OpFunction %200 None %300 +%entry = OpLabel +%100 = OpConstant %u32 100 +%1 = OpConstant %u32 200 +%2 = OpConstant %u32 300 +OpReturn +OpFunctionEnd +)"; + + const std::string expected = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%1 = OpTypeInt 32 1 +%2 = OpTypeInt 32 0 +%3 = OpTypeFloat 32 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +%8 = OpConstant %2 100 +%9 = OpConstant %2 200 +%10 = OpConstant %2 300 +OpReturn +OpFunctionEnd +)"; + + std::string after; + EXPECT_EQ(SPV_SUCCESS, + ToBinaryAndBack(before, &after, SPV_TEXT_TO_BINARY_OPTION_NONE, + SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)); + + EXPECT_EQ(expected, after); +} + +TEST(TextHandler, PreserveNumericIds) { + const std::string before = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%i32 = OpTypeInt 32 1 +%u32 = OpTypeInt 32 0 +%f32 = OpTypeFloat 32 +%200 = OpTypeVoid +%300 = OpTypeFunction %200 +%main = OpFunction %200 None %300 +%entry = OpLabel +%100 = OpConstant %u32 100 +%1 = OpConstant %u32 200 +%2 = OpConstant %u32 300 +OpReturn +OpFunctionEnd +)"; + + const std::string expected = + R"(OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%3 = OpTypeInt 32 1 +%4 = OpTypeInt 32 0 +%5 = OpTypeFloat 32 +%200 = OpTypeVoid +%300 = OpTypeFunction %200 +%6 = OpFunction %200 None %300 +%7 = OpLabel +%100 = OpConstant %4 100 +%1 = OpConstant %4 200 +%2 = OpConstant %4 300 +OpReturn +OpFunctionEnd +)"; + + std::string after; + EXPECT_EQ(SPV_SUCCESS, + ToBinaryAndBack(before, &after, + SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS, + SPV_BINARY_TO_TEXT_OPTION_NO_HEADER)); + + EXPECT_EQ(expected, after); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/scripts/test_compact_ids.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/scripts/test_compact_ids.py new file mode 100644 index 00000000000..b9b5b1bc04e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/scripts/test_compact_ids.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# Copyright (c) 2017 Google 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. +"""Tests correctness of opt pass tools/opt --compact-ids.""" + +from __future__ import print_function + +import os.path +import sys +import tempfile + +def test_spirv_file(path, temp_dir): + optimized_spv_path = os.path.join(temp_dir, 'optimized.spv') + optimized_dis_path = os.path.join(temp_dir, 'optimized.dis') + converted_spv_path = os.path.join(temp_dir, 'converted.spv') + converted_dis_path = os.path.join(temp_dir, 'converted.dis') + + os.system('tools/spirv-opt ' + path + ' -o ' + optimized_spv_path + + ' --compact-ids') + os.system('tools/spirv-dis ' + optimized_spv_path + ' -o ' + + optimized_dis_path) + + os.system('tools/spirv-dis ' + path + ' -o ' + converted_dis_path) + os.system('tools/spirv-as ' + converted_dis_path + ' -o ' + + converted_spv_path) + os.system('tools/spirv-dis ' + converted_spv_path + ' -o ' + + converted_dis_path) + + with open(converted_dis_path, 'r') as f: + converted_dis = f.readlines()[3:] + + with open(optimized_dis_path, 'r') as f: + optimized_dis = f.readlines()[3:] + + return converted_dis == optimized_dis + +def print_usage(): + template= \ +"""{script} tests correctness of opt pass tools/opt --compact-ids + +USAGE: python {script} [] + +Requires tools/spirv-dis, tools/spirv-as and tools/spirv-opt to be in path +(call the script from the SPIRV-Tools build output directory). + +TIP: In order to test all .spv files under current dir use +find -name "*.spv" -print0 | xargs -0 -s 2000000 python {script} +""" + print(template.format(script=sys.argv[0])); + +def main(): + if not os.path.isfile('tools/spirv-dis'): + print('error: tools/spirv-dis not found') + print_usage() + exit(1) + + if not os.path.isfile('tools/spirv-as'): + print('error: tools/spirv-as not found') + print_usage() + exit(1) + + if not os.path.isfile('tools/spirv-opt'): + print('error: tools/spirv-opt not found') + print_usage() + exit(1) + + paths = sys.argv[1:] + if not paths: + print_usage() + + num_failed = 0 + + temp_dir = tempfile.mkdtemp() + + for path in paths: + success = test_spirv_file(path, temp_dir) + if not success: + print('Test failed for ' + path) + num_failed += 1 + + print('Tested ' + str(len(paths)) + ' files') + + if num_failed: + print(str(num_failed) + ' tests failed') + exit(1) + else: + print('All tests successful') + exit(0) + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/software_version_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/software_version_test.cpp new file mode 100644 index 00000000000..80b944a300f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/software_version_test.cpp @@ -0,0 +1,67 @@ +// Copyright (c) 2015-2016 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::testing::AnyOf; +using ::testing::Eq; +using ::testing::Ge; +using ::testing::StartsWith; + +void CheckFormOfHighLevelVersion(const std::string& version) { + std::istringstream s(version); + char v = 'x'; + int year = -1; + char period = 'x'; + int index = -1; + s >> v >> year >> period >> index; + EXPECT_THAT(v, Eq('v')); + EXPECT_THAT(year, Ge(2016)); + EXPECT_THAT(period, Eq('.')); + EXPECT_THAT(index, Ge(0)); + EXPECT_TRUE(s.good() || s.eof()); + + std::string rest; + s >> rest; + EXPECT_THAT(rest, AnyOf("", "-dev")); +} + +TEST(SoftwareVersion, ShortIsCorrectForm) { + SCOPED_TRACE("short form"); + CheckFormOfHighLevelVersion(spvSoftwareVersionString()); +} + +TEST(SoftwareVersion, DetailedIsCorrectForm) { + const std::string detailed_version(spvSoftwareVersionDetailsString()); + EXPECT_THAT(detailed_version, StartsWith("SPIRV-Tools v")); + + // Parse the high level version. + const std::string from_v = + detailed_version.substr(detailed_version.find_first_of('v')); + const size_t first_space_after_v_or_npos = from_v.find_first_of(' '); + SCOPED_TRACE(detailed_version); + CheckFormOfHighLevelVersion(from_v.substr(0, first_space_after_v_or_npos)); + + // We don't actually care about what comes after the version number. +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/CMakeLists.txt new file mode 100644 index 00000000000..3e4a0742f8d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright (c) 2017 Google 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. + +set(VAL_TEST_COMMON_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/../test_fixture.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_spirv.h +) + +add_spvtools_unittest(TARGET stats_aggregate + SRCS stats_aggregate_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/stats/spirv_stats.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS ${SPIRV_TOOLS} +) + +add_spvtools_unittest(TARGET stats_analyzer + SRCS stats_analyzer_test.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/stats/stats_analyzer.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS ${SPIRV_TOOLS} +) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/stats_aggregate_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/stats_aggregate_test.cpp new file mode 100644 index 00000000000..505fe2d6d26 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/stats_aggregate_test.cpp @@ -0,0 +1,438 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include +#include + +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "tools/stats/spirv_stats.h" + +namespace spvtools { +namespace stats { +namespace { + +using spvtest::ScopedContext; + +void DiagnosticsMessageHandler(spv_message_level_t level, const char*, + const spv_position_t& position, + const char* message) { + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: " << position.index << ": " << message << std::endl; + break; + case SPV_MSG_WARNING: + std::cout << "warning: " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_INFO: + std::cout << "info: " << position.index << ": " << message << std::endl; + break; + default: + break; + } +} + +// Calls AggregateStats for binary compiled from |code|. +void CompileAndAggregateStats(const std::string& code, SpirvStats* stats, + spv_target_env env = SPV_ENV_UNIVERSAL_1_1) { + ScopedContext ctx(env); + SetContextMessageConsumer(ctx.context, DiagnosticsMessageHandler); + spv_binary binary; + ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(ctx.context, code.c_str(), code.size(), + &binary, nullptr)); + + ASSERT_EQ(SPV_SUCCESS, AggregateStats(*ctx.context, binary->code, + binary->wordCount, nullptr, stats)); + spvBinaryDestroy(binary); +} + +TEST(AggregateStats, CapabilityHistogram) { + const std::string code1 = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +)"; + + const std::string code2 = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; + + SpirvStats stats; + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(4u, stats.capability_hist.size()); + EXPECT_EQ(0u, stats.capability_hist.count(SpvCapabilityShader)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityAddresses)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityKernel)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityGenericPointer)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityLinkage)); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(5u, stats.capability_hist.size()); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityShader)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityAddresses)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityKernel)); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityGenericPointer)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityLinkage)); + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(5u, stats.capability_hist.size()); + EXPECT_EQ(1u, stats.capability_hist.at(SpvCapabilityShader)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityAddresses)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityKernel)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityGenericPointer)); + EXPECT_EQ(3u, stats.capability_hist.at(SpvCapabilityLinkage)); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(5u, stats.capability_hist.size()); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityShader)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityAddresses)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityKernel)); + EXPECT_EQ(2u, stats.capability_hist.at(SpvCapabilityGenericPointer)); + EXPECT_EQ(4u, stats.capability_hist.at(SpvCapabilityLinkage)); +} + +TEST(AggregateStats, ExtensionHistogram) { + const std::string code1 = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpExtension "SPV_KHR_16bit_storage" +OpMemoryModel Physical32 OpenCL +)"; + + const std::string code2 = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_NV_viewport_array2" +OpExtension "greatest_extension_ever" +OpMemoryModel Logical GLSL450 +)"; + + SpirvStats stats; + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(1u, stats.extension_hist.size()); + EXPECT_EQ(0u, stats.extension_hist.count("SPV_NV_viewport_array2")); + EXPECT_EQ(1u, stats.extension_hist.at("SPV_KHR_16bit_storage")); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(3u, stats.extension_hist.size()); + EXPECT_EQ(1u, stats.extension_hist.at("SPV_NV_viewport_array2")); + EXPECT_EQ(1u, stats.extension_hist.at("SPV_KHR_16bit_storage")); + EXPECT_EQ(1u, stats.extension_hist.at("greatest_extension_ever")); + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(3u, stats.extension_hist.size()); + EXPECT_EQ(1u, stats.extension_hist.at("SPV_NV_viewport_array2")); + EXPECT_EQ(2u, stats.extension_hist.at("SPV_KHR_16bit_storage")); + EXPECT_EQ(1u, stats.extension_hist.at("greatest_extension_ever")); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(3u, stats.extension_hist.size()); + EXPECT_EQ(2u, stats.extension_hist.at("SPV_NV_viewport_array2")); + EXPECT_EQ(2u, stats.extension_hist.at("SPV_KHR_16bit_storage")); + EXPECT_EQ(2u, stats.extension_hist.at("greatest_extension_ever")); +} + +TEST(AggregateStats, VersionHistogram) { + const std::string code1 = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; + + SpirvStats stats; + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(1u, stats.version_hist.size()); + EXPECT_EQ(1u, stats.version_hist.at(0x00010100)); + + CompileAndAggregateStats(code1, &stats, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(2u, stats.version_hist.size()); + EXPECT_EQ(1u, stats.version_hist.at(0x00010100)); + EXPECT_EQ(1u, stats.version_hist.at(0x00010000)); + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(2u, stats.version_hist.size()); + EXPECT_EQ(2u, stats.version_hist.at(0x00010100)); + EXPECT_EQ(1u, stats.version_hist.at(0x00010000)); + + CompileAndAggregateStats(code1, &stats, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(2u, stats.version_hist.size()); + EXPECT_EQ(2u, stats.version_hist.at(0x00010100)); + EXPECT_EQ(2u, stats.version_hist.at(0x00010000)); +} + +TEST(AggregateStats, GeneratorHistogram) { + const std::string code1 = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +)"; + + const uint32_t kGeneratorKhronosAssembler = SPV_GENERATOR_KHRONOS_ASSEMBLER + << 16; + + SpirvStats stats; + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(1u, stats.generator_hist.size()); + EXPECT_EQ(1u, stats.generator_hist.at(kGeneratorKhronosAssembler)); + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(1u, stats.generator_hist.size()); + EXPECT_EQ(2u, stats.generator_hist.at(kGeneratorKhronosAssembler)); +} + +TEST(AggregateStats, OpcodeHistogram) { + const std::string code1 = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Int64 +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%u64 = OpTypeInt 64 0 +%u32 = OpTypeInt 32 0 +%f32 = OpTypeFloat 32 +)"; + + const std::string code2 = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_NV_viewport_array2" +OpMemoryModel Logical GLSL450 +)"; + + SpirvStats stats; + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(4u, stats.opcode_hist.size()); + EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpCapability)); + EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpMemoryModel)); + EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeInt)); + EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpTypeFloat)); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(5u, stats.opcode_hist.size()); + EXPECT_EQ(6u, stats.opcode_hist.at(SpvOpCapability)); + EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpMemoryModel)); + EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeInt)); + EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpTypeFloat)); + EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpExtension)); + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(5u, stats.opcode_hist.size()); + EXPECT_EQ(10u, stats.opcode_hist.at(SpvOpCapability)); + EXPECT_EQ(3u, stats.opcode_hist.at(SpvOpMemoryModel)); + EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpTypeInt)); + EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeFloat)); + EXPECT_EQ(1u, stats.opcode_hist.at(SpvOpExtension)); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(5u, stats.opcode_hist.size()); + EXPECT_EQ(12u, stats.opcode_hist.at(SpvOpCapability)); + EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpMemoryModel)); + EXPECT_EQ(4u, stats.opcode_hist.at(SpvOpTypeInt)); + EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpTypeFloat)); + EXPECT_EQ(2u, stats.opcode_hist.at(SpvOpExtension)); +} + +TEST(AggregateStats, OpcodeMarkovHistogram) { + const std::string code1 = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_NV_viewport_array2" +OpMemoryModel Logical GLSL450 +)"; + + const std::string code2 = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Int64 +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +%u64 = OpTypeInt 64 0 +%u32 = OpTypeInt 32 0 +%f32 = OpTypeFloat 32 +)"; + + SpirvStats stats; + stats.opcode_markov_hist.resize(2); + + CompileAndAggregateStats(code1, &stats); + ASSERT_EQ(2u, stats.opcode_markov_hist.size()); + EXPECT_EQ(2u, stats.opcode_markov_hist[0].size()); + EXPECT_EQ(2u, stats.opcode_markov_hist[0].at(SpvOpCapability).size()); + EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpExtension).size()); + EXPECT_EQ( + 1u, stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpCapability)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpExtension)); + EXPECT_EQ( + 1u, stats.opcode_markov_hist[0].at(SpvOpExtension).at(SpvOpMemoryModel)); + + EXPECT_EQ(1u, stats.opcode_markov_hist[1].size()); + EXPECT_EQ(2u, stats.opcode_markov_hist[1].at(SpvOpCapability).size()); + EXPECT_EQ(1u, + stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpExtension)); + EXPECT_EQ( + 1u, stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpMemoryModel)); + + CompileAndAggregateStats(code2, &stats); + ASSERT_EQ(2u, stats.opcode_markov_hist.size()); + EXPECT_EQ(4u, stats.opcode_markov_hist[0].size()); + EXPECT_EQ(3u, stats.opcode_markov_hist[0].at(SpvOpCapability).size()); + EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpExtension).size()); + EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpMemoryModel).size()); + EXPECT_EQ(2u, stats.opcode_markov_hist[0].at(SpvOpTypeInt).size()); + EXPECT_EQ( + 4u, stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpCapability)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpExtension)); + EXPECT_EQ( + 1u, stats.opcode_markov_hist[0].at(SpvOpCapability).at(SpvOpMemoryModel)); + EXPECT_EQ( + 1u, stats.opcode_markov_hist[0].at(SpvOpExtension).at(SpvOpMemoryModel)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[0].at(SpvOpMemoryModel).at(SpvOpTypeInt)); + EXPECT_EQ(1u, stats.opcode_markov_hist[0].at(SpvOpTypeInt).at(SpvOpTypeInt)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[0].at(SpvOpTypeInt).at(SpvOpTypeFloat)); + + EXPECT_EQ(3u, stats.opcode_markov_hist[1].size()); + EXPECT_EQ(4u, stats.opcode_markov_hist[1].at(SpvOpCapability).size()); + EXPECT_EQ(1u, stats.opcode_markov_hist[1].at(SpvOpMemoryModel).size()); + EXPECT_EQ(1u, stats.opcode_markov_hist[1].at(SpvOpTypeInt).size()); + EXPECT_EQ( + 2u, stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpCapability)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpExtension)); + EXPECT_EQ( + 2u, stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpMemoryModel)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[1].at(SpvOpCapability).at(SpvOpTypeInt)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[1].at(SpvOpMemoryModel).at(SpvOpTypeInt)); + EXPECT_EQ(1u, + stats.opcode_markov_hist[1].at(SpvOpTypeInt).at(SpvOpTypeFloat)); +} + +TEST(AggregateStats, ConstantLiteralsHistogram) { + const std::string code1 = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpCapability Float64 +OpCapability Int16 +OpCapability Int64 +OpMemoryModel Physical32 OpenCL +%u16 = OpTypeInt 16 0 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%1 = OpConstant %f32 0.1 +%2 = OpConstant %f32 -2 +%3 = OpConstant %f64 -2 +%4 = OpConstant %u16 16 +%5 = OpConstant %u16 2 +%6 = OpConstant %u32 32 +%7 = OpConstant %u64 64 +)"; + + const std::string code2 = R"( +OpCapability Shader +OpCapability Linkage +OpCapability Int16 +OpCapability Int64 +OpMemoryModel Logical GLSL450 +%f32 = OpTypeFloat 32 +%u16 = OpTypeInt 16 0 +%s16 = OpTypeInt 16 1 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%1 = OpConstant %f32 0.1 +%2 = OpConstant %f32 -2 +%3 = OpConstant %u16 1 +%4 = OpConstant %u16 16 +%5 = OpConstant %u16 2 +%6 = OpConstant %s16 -16 +%7 = OpConstant %u32 32 +%8 = OpConstant %s32 2 +%9 = OpConstant %s32 -32 +%10 = OpConstant %u64 64 +%11 = OpConstant %s64 -64 +)"; + + SpirvStats stats; + + CompileAndAggregateStats(code1, &stats); + EXPECT_EQ(2u, stats.f32_constant_hist.size()); + EXPECT_EQ(1u, stats.f64_constant_hist.size()); + EXPECT_EQ(1u, stats.f32_constant_hist.at(0.1f)); + EXPECT_EQ(1u, stats.f32_constant_hist.at(-2.f)); + EXPECT_EQ(1u, stats.f64_constant_hist.at(-2)); + + EXPECT_EQ(2u, stats.u16_constant_hist.size()); + EXPECT_EQ(0u, stats.s16_constant_hist.size()); + EXPECT_EQ(1u, stats.u32_constant_hist.size()); + EXPECT_EQ(0u, stats.s32_constant_hist.size()); + EXPECT_EQ(1u, stats.u64_constant_hist.size()); + EXPECT_EQ(0u, stats.s64_constant_hist.size()); + EXPECT_EQ(1u, stats.u16_constant_hist.at(16)); + EXPECT_EQ(1u, stats.u16_constant_hist.at(2)); + EXPECT_EQ(1u, stats.u32_constant_hist.at(32)); + EXPECT_EQ(1u, stats.u64_constant_hist.at(64)); + + CompileAndAggregateStats(code2, &stats); + EXPECT_EQ(2u, stats.f32_constant_hist.size()); + EXPECT_EQ(1u, stats.f64_constant_hist.size()); + EXPECT_EQ(2u, stats.f32_constant_hist.at(0.1f)); + EXPECT_EQ(2u, stats.f32_constant_hist.at(-2.f)); + EXPECT_EQ(1u, stats.f64_constant_hist.at(-2)); + + EXPECT_EQ(3u, stats.u16_constant_hist.size()); + EXPECT_EQ(1u, stats.s16_constant_hist.size()); + EXPECT_EQ(1u, stats.u32_constant_hist.size()); + EXPECT_EQ(2u, stats.s32_constant_hist.size()); + EXPECT_EQ(1u, stats.u64_constant_hist.size()); + EXPECT_EQ(1u, stats.s64_constant_hist.size()); + EXPECT_EQ(2u, stats.u16_constant_hist.at(16)); + EXPECT_EQ(2u, stats.u16_constant_hist.at(2)); + EXPECT_EQ(1u, stats.u16_constant_hist.at(1)); + EXPECT_EQ(1u, stats.s16_constant_hist.at(-16)); + EXPECT_EQ(2u, stats.u32_constant_hist.at(32)); + EXPECT_EQ(1u, stats.s32_constant_hist.at(2)); + EXPECT_EQ(1u, stats.s32_constant_hist.at(-32)); + EXPECT_EQ(2u, stats.u64_constant_hist.at(64)); + EXPECT_EQ(1u, stats.s64_constant_hist.at(-64)); +} + +} // namespace +} // namespace stats +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/stats_analyzer_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/stats_analyzer_test.cpp new file mode 100644 index 00000000000..3764c5bdd26 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/stats/stats_analyzer_test.cpp @@ -0,0 +1,174 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include +#include + +#include "source/latest_version_spirv_header.h" +#include "test/test_fixture.h" +#include "tools/stats/stats_analyzer.h" + +namespace spvtools { +namespace stats { +namespace { + +// Fills |stats| with some synthetic header stats, as if aggregated from 100 +// modules (100 used for simpler percentage evaluation). +void FillDefaultStats(SpirvStats* stats) { + *stats = SpirvStats(); + stats->version_hist[0x00010000] = 40; + stats->version_hist[0x00010100] = 60; + stats->generator_hist[0x00000000] = 64; + stats->generator_hist[0x00010000] = 1; + stats->generator_hist[0x00020000] = 2; + stats->generator_hist[0x00030000] = 3; + stats->generator_hist[0x00040000] = 4; + stats->generator_hist[0x00050000] = 5; + stats->generator_hist[0x00060000] = 6; + stats->generator_hist[0x00070000] = 7; + stats->generator_hist[0x00080000] = 8; + + int num_version_entries = 0; + for (const auto& pair : stats->version_hist) { + num_version_entries += pair.second; + } + + int num_generator_entries = 0; + for (const auto& pair : stats->generator_hist) { + num_generator_entries += pair.second; + } + + EXPECT_EQ(num_version_entries, num_generator_entries); +} + +TEST(StatsAnalyzer, Version) { + SpirvStats stats; + FillDefaultStats(&stats); + + StatsAnalyzer analyzer(stats); + + std::stringstream ss; + analyzer.WriteVersion(ss); + const std::string output = ss.str(); + const std::string expected_output = "Version 1.1 60%\nVersion 1.0 40%\n"; + + EXPECT_EQ(expected_output, output); +} + +TEST(StatsAnalyzer, Generator) { + SpirvStats stats; + FillDefaultStats(&stats); + + StatsAnalyzer analyzer(stats); + + std::stringstream ss; + analyzer.WriteGenerator(ss); + const std::string output = ss.str(); + const std::string expected_output = + "Khronos 64%\nKhronos Glslang Reference Front End 8%\n" + "Khronos SPIR-V Tools Assembler 7%\nKhronos LLVM/SPIR-V Translator 6%" + "\nARM 5%\nNVIDIA 4%\nCodeplay 3%\nValve 2%\nLunarG 1%\n"; + + EXPECT_EQ(expected_output, output); +} + +TEST(StatsAnalyzer, Capability) { + SpirvStats stats; + FillDefaultStats(&stats); + + stats.capability_hist[SpvCapabilityShader] = 25; + stats.capability_hist[SpvCapabilityKernel] = 75; + + StatsAnalyzer analyzer(stats); + + std::stringstream ss; + analyzer.WriteCapability(ss); + const std::string output = ss.str(); + const std::string expected_output = "Kernel 75%\nShader 25%\n"; + + EXPECT_EQ(expected_output, output); +} + +TEST(StatsAnalyzer, Extension) { + SpirvStats stats; + FillDefaultStats(&stats); + + stats.extension_hist["greatest_extension_ever"] = 1; + stats.extension_hist["worst_extension_ever"] = 10; + + StatsAnalyzer analyzer(stats); + + std::stringstream ss; + analyzer.WriteExtension(ss); + const std::string output = ss.str(); + const std::string expected_output = + "worst_extension_ever 10%\ngreatest_extension_ever 1%\n"; + + EXPECT_EQ(expected_output, output); +} + +TEST(StatsAnalyzer, Opcode) { + SpirvStats stats; + FillDefaultStats(&stats); + + stats.opcode_hist[SpvOpCapability] = 20; + stats.opcode_hist[SpvOpConstant] = 80; + stats.opcode_hist[SpvOpDecorate] = 100; + + StatsAnalyzer analyzer(stats); + + std::stringstream ss; + analyzer.WriteOpcode(ss); + const std::string output = ss.str(); + const std::string expected_output = + "Total unique opcodes used: 3\nDecorate 50%\n" + "Constant 40%\nCapability 10%\n"; + + EXPECT_EQ(expected_output, output); +} + +TEST(StatsAnalyzer, OpcodeMarkov) { + SpirvStats stats; + FillDefaultStats(&stats); + + stats.opcode_hist[SpvOpFMul] = 400; + stats.opcode_hist[SpvOpFAdd] = 200; + stats.opcode_hist[SpvOpFSub] = 400; + + stats.opcode_markov_hist.resize(1); + auto& hist = stats.opcode_markov_hist[0]; + hist[SpvOpFMul][SpvOpFAdd] = 100; + hist[SpvOpFMul][SpvOpFSub] = 300; + hist[SpvOpFAdd][SpvOpFMul] = 100; + hist[SpvOpFAdd][SpvOpFAdd] = 100; + + StatsAnalyzer analyzer(stats); + + std::stringstream ss; + analyzer.WriteOpcodeMarkov(ss); + const std::string output = ss.str(); + const std::string expected_output = + "FMul -> FSub 75% (base rate 40%, pair occurrences 300)\n" + "FMul -> FAdd 25% (base rate 20%, pair occurrences 100)\n" + "FAdd -> FAdd 50% (base rate 20%, pair occurrences 100)\n" + "FAdd -> FMul 50% (base rate 40%, pair occurrences 100)\n"; + + EXPECT_EQ(expected_output, output); +} + +} // namespace +} // namespace stats +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/string_utils_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/string_utils_test.cpp new file mode 100644 index 00000000000..58514158f5a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/string_utils_test.cpp @@ -0,0 +1,191 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gtest/gtest.h" +#include "source/util/string_utils.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace utils { +namespace { + +TEST(ToString, Int) { + EXPECT_EQ("0", ToString(0)); + EXPECT_EQ("1000", ToString(1000)); + EXPECT_EQ("-1", ToString(-1)); + EXPECT_EQ("0", ToString(0LL)); + EXPECT_EQ("1000", ToString(1000LL)); + EXPECT_EQ("-1", ToString(-1LL)); +} + +TEST(ToString, Uint) { + EXPECT_EQ("0", ToString(0U)); + EXPECT_EQ("1000", ToString(1000U)); + EXPECT_EQ("0", ToString(0ULL)); + EXPECT_EQ("1000", ToString(1000ULL)); +} + +TEST(ToString, Float) { + EXPECT_EQ("0", ToString(0.f)); + EXPECT_EQ("1000", ToString(1000.f)); + EXPECT_EQ("-1.5", ToString(-1.5f)); +} + +TEST(ToString, Double) { + EXPECT_EQ("0", ToString(0.)); + EXPECT_EQ("1000", ToString(1000.)); + EXPECT_EQ("-1.5", ToString(-1.5)); +} + +TEST(CardinalToOrdinal, Test) { + EXPECT_EQ("1st", CardinalToOrdinal(1)); + EXPECT_EQ("2nd", CardinalToOrdinal(2)); + EXPECT_EQ("3rd", CardinalToOrdinal(3)); + EXPECT_EQ("4th", CardinalToOrdinal(4)); + EXPECT_EQ("5th", CardinalToOrdinal(5)); + EXPECT_EQ("6th", CardinalToOrdinal(6)); + EXPECT_EQ("7th", CardinalToOrdinal(7)); + EXPECT_EQ("8th", CardinalToOrdinal(8)); + EXPECT_EQ("9th", CardinalToOrdinal(9)); + EXPECT_EQ("10th", CardinalToOrdinal(10)); + EXPECT_EQ("11th", CardinalToOrdinal(11)); + EXPECT_EQ("12th", CardinalToOrdinal(12)); + EXPECT_EQ("13th", CardinalToOrdinal(13)); + EXPECT_EQ("14th", CardinalToOrdinal(14)); + EXPECT_EQ("15th", CardinalToOrdinal(15)); + EXPECT_EQ("16th", CardinalToOrdinal(16)); + EXPECT_EQ("17th", CardinalToOrdinal(17)); + EXPECT_EQ("18th", CardinalToOrdinal(18)); + EXPECT_EQ("19th", CardinalToOrdinal(19)); + EXPECT_EQ("20th", CardinalToOrdinal(20)); + EXPECT_EQ("21st", CardinalToOrdinal(21)); + EXPECT_EQ("22nd", CardinalToOrdinal(22)); + EXPECT_EQ("23rd", CardinalToOrdinal(23)); + EXPECT_EQ("24th", CardinalToOrdinal(24)); + EXPECT_EQ("25th", CardinalToOrdinal(25)); + EXPECT_EQ("26th", CardinalToOrdinal(26)); + EXPECT_EQ("27th", CardinalToOrdinal(27)); + EXPECT_EQ("28th", CardinalToOrdinal(28)); + EXPECT_EQ("29th", CardinalToOrdinal(29)); + EXPECT_EQ("30th", CardinalToOrdinal(30)); + EXPECT_EQ("31st", CardinalToOrdinal(31)); + EXPECT_EQ("32nd", CardinalToOrdinal(32)); + EXPECT_EQ("33rd", CardinalToOrdinal(33)); + EXPECT_EQ("34th", CardinalToOrdinal(34)); + EXPECT_EQ("35th", CardinalToOrdinal(35)); + EXPECT_EQ("100th", CardinalToOrdinal(100)); + EXPECT_EQ("101st", CardinalToOrdinal(101)); + EXPECT_EQ("102nd", CardinalToOrdinal(102)); + EXPECT_EQ("103rd", CardinalToOrdinal(103)); + EXPECT_EQ("104th", CardinalToOrdinal(104)); + EXPECT_EQ("105th", CardinalToOrdinal(105)); + EXPECT_EQ("106th", CardinalToOrdinal(106)); + EXPECT_EQ("107th", CardinalToOrdinal(107)); + EXPECT_EQ("108th", CardinalToOrdinal(108)); + EXPECT_EQ("109th", CardinalToOrdinal(109)); + EXPECT_EQ("110th", CardinalToOrdinal(110)); + EXPECT_EQ("111th", CardinalToOrdinal(111)); + EXPECT_EQ("112th", CardinalToOrdinal(112)); + EXPECT_EQ("113th", CardinalToOrdinal(113)); + EXPECT_EQ("114th", CardinalToOrdinal(114)); + EXPECT_EQ("115th", CardinalToOrdinal(115)); + EXPECT_EQ("116th", CardinalToOrdinal(116)); + EXPECT_EQ("117th", CardinalToOrdinal(117)); + EXPECT_EQ("118th", CardinalToOrdinal(118)); + EXPECT_EQ("119th", CardinalToOrdinal(119)); + EXPECT_EQ("120th", CardinalToOrdinal(120)); + EXPECT_EQ("121st", CardinalToOrdinal(121)); + EXPECT_EQ("122nd", CardinalToOrdinal(122)); + EXPECT_EQ("123rd", CardinalToOrdinal(123)); + EXPECT_EQ("124th", CardinalToOrdinal(124)); + EXPECT_EQ("125th", CardinalToOrdinal(125)); + EXPECT_EQ("126th", CardinalToOrdinal(126)); + EXPECT_EQ("127th", CardinalToOrdinal(127)); + EXPECT_EQ("128th", CardinalToOrdinal(128)); + EXPECT_EQ("129th", CardinalToOrdinal(129)); + EXPECT_EQ("130th", CardinalToOrdinal(130)); + EXPECT_EQ("131st", CardinalToOrdinal(131)); + EXPECT_EQ("132nd", CardinalToOrdinal(132)); + EXPECT_EQ("133rd", CardinalToOrdinal(133)); + EXPECT_EQ("134th", CardinalToOrdinal(134)); + EXPECT_EQ("135th", CardinalToOrdinal(135)); + EXPECT_EQ("1000th", CardinalToOrdinal(1000)); + EXPECT_EQ("1001st", CardinalToOrdinal(1001)); + EXPECT_EQ("1002nd", CardinalToOrdinal(1002)); + EXPECT_EQ("1003rd", CardinalToOrdinal(1003)); + EXPECT_EQ("1004th", CardinalToOrdinal(1004)); + EXPECT_EQ("1005th", CardinalToOrdinal(1005)); + EXPECT_EQ("1006th", CardinalToOrdinal(1006)); + EXPECT_EQ("1007th", CardinalToOrdinal(1007)); + EXPECT_EQ("1008th", CardinalToOrdinal(1008)); + EXPECT_EQ("1009th", CardinalToOrdinal(1009)); + EXPECT_EQ("1010th", CardinalToOrdinal(1010)); + EXPECT_EQ("1011th", CardinalToOrdinal(1011)); + EXPECT_EQ("1012th", CardinalToOrdinal(1012)); + EXPECT_EQ("1013th", CardinalToOrdinal(1013)); + EXPECT_EQ("1014th", CardinalToOrdinal(1014)); + EXPECT_EQ("1015th", CardinalToOrdinal(1015)); + EXPECT_EQ("1016th", CardinalToOrdinal(1016)); + EXPECT_EQ("1017th", CardinalToOrdinal(1017)); + EXPECT_EQ("1018th", CardinalToOrdinal(1018)); + EXPECT_EQ("1019th", CardinalToOrdinal(1019)); + EXPECT_EQ("1020th", CardinalToOrdinal(1020)); + EXPECT_EQ("1021st", CardinalToOrdinal(1021)); + EXPECT_EQ("1022nd", CardinalToOrdinal(1022)); + EXPECT_EQ("1023rd", CardinalToOrdinal(1023)); + EXPECT_EQ("1024th", CardinalToOrdinal(1024)); + EXPECT_EQ("1025th", CardinalToOrdinal(1025)); + EXPECT_EQ("1026th", CardinalToOrdinal(1026)); + EXPECT_EQ("1027th", CardinalToOrdinal(1027)); + EXPECT_EQ("1028th", CardinalToOrdinal(1028)); + EXPECT_EQ("1029th", CardinalToOrdinal(1029)); + EXPECT_EQ("1030th", CardinalToOrdinal(1030)); + EXPECT_EQ("1031st", CardinalToOrdinal(1031)); + EXPECT_EQ("1032nd", CardinalToOrdinal(1032)); + EXPECT_EQ("1033rd", CardinalToOrdinal(1033)); + EXPECT_EQ("1034th", CardinalToOrdinal(1034)); + EXPECT_EQ("1035th", CardinalToOrdinal(1035)); + EXPECT_EQ("1200th", CardinalToOrdinal(1200)); + EXPECT_EQ("1201st", CardinalToOrdinal(1201)); + EXPECT_EQ("1202nd", CardinalToOrdinal(1202)); + EXPECT_EQ("1203rd", CardinalToOrdinal(1203)); + EXPECT_EQ("1204th", CardinalToOrdinal(1204)); + EXPECT_EQ("1205th", CardinalToOrdinal(1205)); + EXPECT_EQ("1206th", CardinalToOrdinal(1206)); + EXPECT_EQ("1207th", CardinalToOrdinal(1207)); + EXPECT_EQ("1208th", CardinalToOrdinal(1208)); + EXPECT_EQ("1209th", CardinalToOrdinal(1209)); + EXPECT_EQ("1210th", CardinalToOrdinal(1210)); + EXPECT_EQ("1211th", CardinalToOrdinal(1211)); + EXPECT_EQ("1212th", CardinalToOrdinal(1212)); + EXPECT_EQ("1213th", CardinalToOrdinal(1213)); + EXPECT_EQ("1214th", CardinalToOrdinal(1214)); + EXPECT_EQ("1215th", CardinalToOrdinal(1215)); + EXPECT_EQ("1216th", CardinalToOrdinal(1216)); + EXPECT_EQ("1217th", CardinalToOrdinal(1217)); + EXPECT_EQ("1218th", CardinalToOrdinal(1218)); + EXPECT_EQ("1219th", CardinalToOrdinal(1219)); + EXPECT_EQ("1220th", CardinalToOrdinal(1220)); + EXPECT_EQ("1221st", CardinalToOrdinal(1221)); + EXPECT_EQ("1222nd", CardinalToOrdinal(1222)); + EXPECT_EQ("1223rd", CardinalToOrdinal(1223)); + EXPECT_EQ("1224th", CardinalToOrdinal(1224)); + EXPECT_EQ("1225th", CardinalToOrdinal(1225)); +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/target_env_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/target_env_test.cpp new file mode 100644 index 00000000000..f9624646dcb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/target_env_test.cpp @@ -0,0 +1,106 @@ +// Copyright (c) 2016 Google 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. + +#include + +#include "gmock/gmock.h" +#include "source/spirv_target_env.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::testing::AnyOf; +using ::testing::Eq; +using ::testing::StartsWith; +using ::testing::ValuesIn; + +using TargetEnvTest = ::testing::TestWithParam; +TEST_P(TargetEnvTest, CreateContext) { + spv_target_env env = GetParam(); + spv_context context = spvContextCreate(env); + ASSERT_NE(nullptr, context); + spvContextDestroy(context); // Avoid leaking +} + +TEST_P(TargetEnvTest, ValidDescription) { + const char* description = spvTargetEnvDescription(GetParam()); + ASSERT_NE(nullptr, description); + ASSERT_THAT(description, StartsWith("SPIR-V ")); +} + +TEST_P(TargetEnvTest, ValidSpirvVersion) { + auto spirv_version = spvVersionForTargetEnv(GetParam()); + ASSERT_THAT(spirv_version, AnyOf(0x10000, 0x10100, 0x10200, 0x10300)); +} + +INSTANTIATE_TEST_CASE_P(AllTargetEnvs, TargetEnvTest, + ValuesIn(spvtest::AllTargetEnvironments())); + +TEST(GetContextTest, InvalidTargetEnvProducesNull) { + // Use a value beyond the last valid enum value. + spv_context context = spvContextCreate(static_cast(30)); + EXPECT_EQ(context, nullptr); +} + +// A test case for parsing an environment string. +struct ParseCase { + const char* input; + bool success; // Expect to successfully parse? + spv_target_env env; // The parsed environment, if successful. +}; + +using TargetParseTest = ::testing::TestWithParam; + +TEST_P(TargetParseTest, InvalidTargetEnvProducesNull) { + spv_target_env env; + bool parsed = spvParseTargetEnv(GetParam().input, &env); + EXPECT_THAT(parsed, Eq(GetParam().success)); + EXPECT_THAT(env, Eq(GetParam().env)); +} + +INSTANTIATE_TEST_CASE_P( + TargetParsing, TargetParseTest, + ValuesIn(std::vector{ + {"spv1.0", true, SPV_ENV_UNIVERSAL_1_0}, + {"spv1.1", true, SPV_ENV_UNIVERSAL_1_1}, + {"spv1.2", true, SPV_ENV_UNIVERSAL_1_2}, + {"spv1.3", true, SPV_ENV_UNIVERSAL_1_3}, + {"vulkan1.0", true, SPV_ENV_VULKAN_1_0}, + {"vulkan1.1", true, SPV_ENV_VULKAN_1_1}, + {"opencl2.1", true, SPV_ENV_OPENCL_2_1}, + {"opencl2.2", true, SPV_ENV_OPENCL_2_2}, + {"opengl4.0", true, SPV_ENV_OPENGL_4_0}, + {"opengl4.1", true, SPV_ENV_OPENGL_4_1}, + {"opengl4.2", true, SPV_ENV_OPENGL_4_2}, + {"opengl4.3", true, SPV_ENV_OPENGL_4_3}, + {"opengl4.5", true, SPV_ENV_OPENGL_4_5}, + {"opencl1.2", true, SPV_ENV_OPENCL_1_2}, + {"opencl1.2embedded", true, SPV_ENV_OPENCL_EMBEDDED_1_2}, + {"opencl2.0", true, SPV_ENV_OPENCL_2_0}, + {"opencl2.0embedded", true, SPV_ENV_OPENCL_EMBEDDED_2_0}, + {"opencl2.1embedded", true, SPV_ENV_OPENCL_EMBEDDED_2_1}, + {"opencl2.2embedded", true, SPV_ENV_OPENCL_EMBEDDED_2_2}, + {"webgpu0", true, SPV_ENV_WEBGPU_0}, + {"opencl2.3", false, SPV_ENV_UNIVERSAL_1_0}, + {"opencl3.0", false, SPV_ENV_UNIVERSAL_1_0}, + {"vulkan1.2", false, SPV_ENV_UNIVERSAL_1_0}, + {"vulkan2.0", false, SPV_ENV_UNIVERSAL_1_0}, + {nullptr, false, SPV_ENV_UNIVERSAL_1_0}, + {"", false, SPV_ENV_UNIVERSAL_1_0}, + {"abc", false, SPV_ENV_UNIVERSAL_1_0}, + })); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/test_fixture.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/test_fixture.h new file mode 100644 index 00000000000..e85015c947f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/test_fixture.h @@ -0,0 +1,185 @@ +// Copyright (c) 2015-2016 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. + +#ifndef TEST_TEST_FIXTURE_H_ +#define TEST_TEST_FIXTURE_H_ + +#include +#include + +#include "test/unit_spirv.h" + +namespace spvtest { + +// RAII for spv_context. +struct ScopedContext { + ScopedContext(spv_target_env env = SPV_ENV_UNIVERSAL_1_0) + : context(spvContextCreate(env)) {} + ~ScopedContext() { spvContextDestroy(context); } + spv_context context; +}; + +// Common setup for TextToBinary tests. SetText() should be called to populate +// the actual test text. +template +class TextToBinaryTestBase : public T { + public: + // Shorthand for SPIR-V compilation result. + using SpirvVector = std::vector; + + // Offset into a SpirvVector at which the first instruction starts. + static const SpirvVector::size_type kFirstInstruction = 5; + + TextToBinaryTestBase() : diagnostic(nullptr), text(), binary(nullptr) { + char textStr[] = "substitute the text member variable with your test"; + text = {textStr, strlen(textStr)}; + } + + virtual ~TextToBinaryTestBase() { + DestroyBinary(); + if (diagnostic) spvDiagnosticDestroy(diagnostic); + } + + // Returns subvector v[from:end). + SpirvVector Subvector(const SpirvVector& v, SpirvVector::size_type from) { + assert(from <= v.size()); + return SpirvVector(v.begin() + from, v.end()); + } + + // Compiles SPIR-V text in the given assembly syntax format, asserting + // compilation success. Returns the compiled code. + SpirvVector CompileSuccessfully(const std::string& txt, + spv_target_env env = SPV_ENV_UNIVERSAL_1_0) { + spv_result_t status = + spvTextToBinary(ScopedContext(env).context, txt.c_str(), txt.size(), + &binary, &diagnostic); + EXPECT_EQ(SPV_SUCCESS, status) << txt; + SpirvVector code_copy; + if (status == SPV_SUCCESS) { + code_copy = SpirvVector(binary->code, binary->code + binary->wordCount); + DestroyBinary(); + } else { + spvDiagnosticPrint(diagnostic); + } + return code_copy; + } + + // Compiles SPIR-V text with the given format, asserting compilation failure. + // Returns the error message(s). + std::string CompileFailure(const std::string& txt, + spv_target_env env = SPV_ENV_UNIVERSAL_1_0) { + EXPECT_NE(SPV_SUCCESS, + spvTextToBinary(ScopedContext(env).context, txt.c_str(), + txt.size(), &binary, &diagnostic)) + << txt; + DestroyBinary(); + return diagnostic->error; + } + + // Encodes SPIR-V text into binary and then decodes the binary using + // given options. Returns the decoded text. + std::string EncodeAndDecodeSuccessfully( + const std::string& txt, + uint32_t disassemble_options = SPV_BINARY_TO_TEXT_OPTION_NONE, + spv_target_env env = SPV_ENV_UNIVERSAL_1_0) { + DestroyBinary(); + ScopedContext context(env); + disassemble_options |= SPV_BINARY_TO_TEXT_OPTION_NO_HEADER; + spv_result_t error = spvTextToBinary(context.context, txt.c_str(), + txt.size(), &binary, &diagnostic); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + } + EXPECT_EQ(SPV_SUCCESS, error); + if (!binary) return ""; + + spv_text decoded_text; + error = spvBinaryToText(context.context, binary->code, binary->wordCount, + disassemble_options, &decoded_text, &diagnostic); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + } + EXPECT_EQ(SPV_SUCCESS, error) << txt; + + const std::string decoded_string = decoded_text->str; + spvTextDestroy(decoded_text); + + return decoded_string; + } + + // Encodes SPIR-V text into binary. This is expected to succeed. + // The given words are then appended to the binary, and the result + // is then decoded. This is expected to fail. + // Returns the error message. + std::string EncodeSuccessfullyDecodeFailed( + const std::string& txt, const SpirvVector& words_to_append) { + SpirvVector code = + spvtest::Concatenate({CompileSuccessfully(txt), words_to_append}); + + spv_text decoded_text; + EXPECT_NE(SPV_SUCCESS, + spvBinaryToText(ScopedContext().context, code.data(), code.size(), + SPV_BINARY_TO_TEXT_OPTION_NONE, &decoded_text, + &diagnostic)); + if (diagnostic) { + std::string error_message = diagnostic->error; + spvDiagnosticDestroy(diagnostic); + diagnostic = nullptr; + return error_message; + } + return ""; + } + + // Compiles SPIR-V text, asserts success, and returns the words representing + // the instructions. In particular, skip the words in the SPIR-V header. + SpirvVector CompiledInstructions(const std::string& txt, + spv_target_env env = SPV_ENV_UNIVERSAL_1_0) { + const SpirvVector code = CompileSuccessfully(txt, env); + SpirvVector result; + // Extract just the instructions. + // If the code fails to compile, then return the empty vector. + // In any case, don't crash or invoke undefined behaviour. + if (code.size() >= kFirstInstruction) + result = Subvector(code, kFirstInstruction); + return result; + } + + void SetText(const std::string& code) { + textString = code; + text.str = textString.c_str(); + text.length = textString.size(); + } + + // Destroys the binary, if it exists. + void DestroyBinary() { + spvBinaryDestroy(binary); + binary = nullptr; + } + + spv_diagnostic diagnostic; + + std::string textString; + spv_text_t text; + spv_binary binary; +}; + +using TextToBinaryTest = TextToBinaryTestBase<::testing::Test>; +} // namespace spvtest + +using RoundTripTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +#endif // TEST_TEST_FIXTURE_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_advance_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_advance_test.cpp new file mode 100644 index 00000000000..9de77a83624 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_advance_test.cpp @@ -0,0 +1,134 @@ +// Copyright (c) 2015-2016 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. + +#include + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::AutoText; + +TEST(TextAdvance, LeadingNewLines) { + AutoText input("\n\nWord"); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_SUCCESS, data.advance()); + ASSERT_EQ(0u, data.position().column); + ASSERT_EQ(2u, data.position().line); + ASSERT_EQ(2u, data.position().index); +} + +TEST(TextAdvance, LeadingSpaces) { + AutoText input(" Word"); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_SUCCESS, data.advance()); + ASSERT_EQ(4u, data.position().column); + ASSERT_EQ(0u, data.position().line); + ASSERT_EQ(4u, data.position().index); +} + +TEST(TextAdvance, LeadingTabs) { + AutoText input("\t\t\tWord"); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_SUCCESS, data.advance()); + ASSERT_EQ(3u, data.position().column); + ASSERT_EQ(0u, data.position().line); + ASSERT_EQ(3u, data.position().index); +} + +TEST(TextAdvance, LeadingNewLinesSpacesAndTabs) { + AutoText input("\n\n\t Word"); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_SUCCESS, data.advance()); + ASSERT_EQ(3u, data.position().column); + ASSERT_EQ(2u, data.position().line); + ASSERT_EQ(5u, data.position().index); +} + +TEST(TextAdvance, LeadingWhitespaceAfterCommentLine) { + AutoText input("; comment\n \t \tWord"); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_SUCCESS, data.advance()); + ASSERT_EQ(4u, data.position().column); + ASSERT_EQ(1u, data.position().line); + ASSERT_EQ(14u, data.position().index); +} + +TEST(TextAdvance, EOFAfterCommentLine) { + AutoText input("; comment"); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_END_OF_STREAM, data.advance()); +} + +TEST(TextAdvance, NullTerminator) { + AutoText input(""); + AssemblyContext data(input, nullptr); + ASSERT_EQ(SPV_END_OF_STREAM, data.advance()); +} + +TEST(TextAdvance, NoNullTerminatorAfterCommentLine) { + std::string input = "; comment|padding beyond the end"; + spv_text_t text = {input.data(), 9}; + AssemblyContext data(&text, nullptr); + ASSERT_EQ(SPV_END_OF_STREAM, data.advance()); + EXPECT_EQ(9u, data.position().index); +} + +TEST(TextAdvance, NoNullTerminator) { + spv_text_t text = {"OpNop\nSomething else in memory", 6}; + AssemblyContext data(&text, nullptr); + const spv_position_t line_break = {1u, 5u, 5u}; + data.setPosition(line_break); + ASSERT_EQ(SPV_END_OF_STREAM, data.advance()); +} + +// Invokes AssemblyContext::advance() on text, asserts success, and returns +// AssemblyContext::position(). +spv_position_t PositionAfterAdvance(const char* text) { + AutoText input(text); + AssemblyContext data(input, nullptr); + EXPECT_EQ(SPV_SUCCESS, data.advance()); + return data.position(); +} + +TEST(TextAdvance, SkipOverCR) { + const auto pos = PositionAfterAdvance("\rWord"); + EXPECT_EQ(1u, pos.column); + EXPECT_EQ(0u, pos.line); + EXPECT_EQ(1u, pos.index); +} + +TEST(TextAdvance, SkipOverCRs) { + const auto pos = PositionAfterAdvance("\r\r\rWord"); + EXPECT_EQ(3u, pos.column); + EXPECT_EQ(0u, pos.line); + EXPECT_EQ(3u, pos.index); +} + +TEST(TextAdvance, SkipOverCRLF) { + const auto pos = PositionAfterAdvance("\r\nWord"); + EXPECT_EQ(0u, pos.column); + EXPECT_EQ(1u, pos.line); + EXPECT_EQ(2u, pos.index); +} + +TEST(TextAdvance, SkipOverCRLFs) { + const auto pos = PositionAfterAdvance("\r\n\r\nWord"); + EXPECT_EQ(0u, pos.column); + EXPECT_EQ(2u, pos.line); + EXPECT_EQ(4u, pos.index); +} +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_destroy_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_destroy_test.cpp new file mode 100644 index 00000000000..4c2837ba6c7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_destroy_test.cpp @@ -0,0 +1,75 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +TEST(TextDestroy, DestroyNull) { spvBinaryDestroy(nullptr); } + +TEST(TextDestroy, Default) { + spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_0); + char textStr[] = R"( + OpSource OpenCL_C 12 + OpMemoryModel Physical64 OpenCL + OpSourceExtension "PlaceholderExtensionName" + OpEntryPoint Kernel %0 "" + OpExecutionMode %0 LocalSizeHint 1 1 1 + %1 = OpTypeVoid + %2 = OpTypeBool + %3 = OpTypeInt 8 0 + %4 = OpTypeInt 8 1 + %5 = OpTypeInt 16 0 + %6 = OpTypeInt 16 1 + %7 = OpTypeInt 32 0 + %8 = OpTypeInt 32 1 + %9 = OpTypeInt 64 0 + %10 = OpTypeInt 64 1 + %11 = OpTypeFloat 16 + %12 = OpTypeFloat 32 + %13 = OpTypeFloat 64 + %14 = OpTypeVector %3 2 + )"; + + spv_binary binary = nullptr; + spv_diagnostic diagnostic = nullptr; + EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(context, textStr, strlen(textStr), + &binary, &diagnostic)); + EXPECT_NE(nullptr, binary); + EXPECT_NE(nullptr, binary->code); + EXPECT_NE(0u, binary->wordCount); + if (diagnostic) { + spvDiagnosticPrint(diagnostic); + ASSERT_TRUE(false); + } + + spv_text resultText = nullptr; + EXPECT_EQ(SPV_SUCCESS, + spvBinaryToText(context, binary->code, binary->wordCount, 0, + &resultText, &diagnostic)); + spvBinaryDestroy(binary); + if (diagnostic) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + ASSERT_TRUE(false); + } + EXPECT_NE(nullptr, resultText->str); + EXPECT_NE(0u, resultText->length); + spvTextDestroy(resultText); + spvContextDestroy(context); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_literal_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_literal_test.cpp new file mode 100644 index 00000000000..70280893172 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_literal_test.cpp @@ -0,0 +1,412 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::testing::Eq; + +TEST(TextLiteral, GoodI32) { + spv_literal_t l; + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("-0", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_INT_32, l.type); + EXPECT_EQ(0, l.value.i32); + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("-2147483648", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_INT_32, l.type); + EXPECT_EQ((-2147483647L - 1), l.value.i32); +} + +TEST(TextLiteral, GoodU32) { + spv_literal_t l; + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("0", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_UINT_32, l.type); + EXPECT_EQ(0, l.value.i32); + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("4294967295", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_UINT_32, l.type); + EXPECT_EQ(4294967295, l.value.u32); +} + +TEST(TextLiteral, GoodI64) { + spv_literal_t l; + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("-2147483649", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_INT_64, l.type); + EXPECT_EQ(-2147483649LL, l.value.i64); +} + +TEST(TextLiteral, GoodU64) { + spv_literal_t l; + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("4294967296", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_UINT_64, l.type); + EXPECT_EQ(4294967296u, l.value.u64); +} + +TEST(TextLiteral, GoodFloat) { + spv_literal_t l; + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("1.0", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_FLOAT_32, l.type); + EXPECT_EQ(1.0, l.value.f); + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("1.5", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_FLOAT_32, l.type); + EXPECT_EQ(1.5, l.value.f); + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral("-.25", &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_FLOAT_32, l.type); + EXPECT_EQ(-.25, l.value.f); +} + +TEST(TextLiteral, BadString) { + spv_literal_t l; + + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("-", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("--", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("1-2", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("123a", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("12.2.3", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("\"", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("\"z", &l)); + EXPECT_EQ(SPV_FAILED_MATCH, spvTextToLiteral("a\"", &l)); +} + +class GoodStringTest + : public ::testing::TestWithParam> {}; + +TEST_P(GoodStringTest, GoodStrings) { + spv_literal_t l; + + ASSERT_EQ(SPV_SUCCESS, spvTextToLiteral(std::get<0>(GetParam()), &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_STRING, l.type); + EXPECT_EQ(std::get<1>(GetParam()), l.str); +} + +INSTANTIATE_TEST_CASE_P( + TextLiteral, GoodStringTest, + ::testing::ValuesIn(std::vector>{ + {R"("-")", "-"}, + {R"("--")", "--"}, + {R"("1-2")", "1-2"}, + {R"("123a")", "123a"}, + {R"("12.2.3")", "12.2.3"}, + {R"("\"")", "\""}, + {R"("\\")", "\\"}, + {"\"\\foo\nbar\"", "foo\nbar"}, + {"\"\\foo\\\nbar\"", "foo\nbar"}, + {"\"\xE4\xBA\xB2\"", "\xE4\xBA\xB2"}, + {"\"\\\xE4\xBA\xB2\"", "\xE4\xBA\xB2"}, + {"\"this \\\" and this \\\\ and \\\xE4\xBA\xB2\"", + "this \" and this \\ and \xE4\xBA\xB2"}}), ); + +TEST(TextLiteral, StringTooLong) { + spv_literal_t l; + std::string too_long = + std::string("\"") + + std::string(SPV_LIMIT_LITERAL_STRING_BYTES_MAX + 1, 'a') + "\""; + EXPECT_EQ(SPV_ERROR_OUT_OF_MEMORY, spvTextToLiteral(too_long.data(), &l)); +} + +TEST(TextLiteral, GoodLongString) { + spv_literal_t l; + // The universal limit of 65535 Unicode characters might make this + // fail validation, since SPV_LIMIT_LITERAL_STRING_BYTES_MAX is 4*65535. + // However, as an implementation detail, we'll allow the assembler + // to parse it. Otherwise we'd have to scan the string for valid UTF-8 + // characters. + std::string unquoted(SPV_LIMIT_LITERAL_STRING_BYTES_MAX, 'a'); + std::string good_long = std::string("\"") + unquoted + "\""; + EXPECT_EQ(SPV_SUCCESS, spvTextToLiteral(good_long.data(), &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_STRING, l.type); + EXPECT_EQ(unquoted.data(), l.str); +} + +TEST(TextLiteral, GoodUTF8String) { + const std::string unquoted = + spvtest::MakeLongUTF8String(SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX); + const std::string good_long = std::string("\"") + unquoted + "\""; + spv_literal_t l; + EXPECT_EQ(SPV_SUCCESS, spvTextToLiteral(good_long.data(), &l)); + EXPECT_EQ(SPV_LITERAL_TYPE_STRING, l.type); + EXPECT_EQ(unquoted.data(), l.str); +} + +// A test case for parsing literal numbers. +struct TextLiteralCase { + uint32_t bitwidth; + const char* text; + bool is_signed; + bool success; + std::vector expected_values; +}; + +using IntegerTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +std::vector successfulEncode(const TextLiteralCase& test, + IdTypeClass type) { + spv_instruction_t inst; + std::string message; + auto capture_message = [&message](spv_message_level_t, const char*, + const spv_position_t&, + const char* m) { message = m; }; + IdType expected_type{test.bitwidth, test.is_signed, type}; + EXPECT_EQ(SPV_SUCCESS, + AssemblyContext(nullptr, capture_message) + .binaryEncodeNumericLiteral(test.text, SPV_ERROR_INVALID_TEXT, + expected_type, &inst)) + << message; + return inst.words; +} + +std::string failedEncode(const TextLiteralCase& test, IdTypeClass type) { + spv_instruction_t inst; + std::string message; + auto capture_message = [&message](spv_message_level_t, const char*, + const spv_position_t&, + const char* m) { message = m; }; + IdType expected_type{test.bitwidth, test.is_signed, type}; + EXPECT_EQ(SPV_ERROR_INVALID_TEXT, + AssemblyContext(nullptr, capture_message) + .binaryEncodeNumericLiteral(test.text, SPV_ERROR_INVALID_TEXT, + expected_type, &inst)); + return message; +} + +TEST_P(IntegerTest, IntegerBounds) { + if (GetParam().success) { + EXPECT_THAT(successfulEncode(GetParam(), IdTypeClass::kScalarIntegerType), + Eq(GetParam().expected_values)); + } else { + std::stringstream ss; + ss << "Integer " << GetParam().text << " does not fit in a " + << GetParam().bitwidth << "-bit " + << (GetParam().is_signed ? "signed" : "unsigned") << " integer"; + EXPECT_THAT(failedEncode(GetParam(), IdTypeClass::kScalarIntegerType), + Eq(ss.str())); + } +} + +// Four nicely named methods for making TextLiteralCase values. +// Their names have underscores in some places to make it easier +// to read the table that follows. +TextLiteralCase Make_Ok__Signed(uint32_t bitwidth, const char* text, + std::vector encoding) { + return TextLiteralCase{bitwidth, text, true, true, encoding}; +} +TextLiteralCase Make_Ok__Unsigned(uint32_t bitwidth, const char* text, + std::vector encoding) { + return TextLiteralCase{bitwidth, text, false, true, encoding}; +} +TextLiteralCase Make_Bad_Signed(uint32_t bitwidth, const char* text) { + return TextLiteralCase{bitwidth, text, true, false, {}}; +} +TextLiteralCase Make_Bad_Unsigned(uint32_t bitwidth, const char* text) { + return TextLiteralCase{bitwidth, text, false, false, {}}; +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + DecimalIntegers, IntegerTest, + ::testing::ValuesIn(std::vector{ + // Check max value and overflow value for 1-bit numbers. + Make_Ok__Signed(1, "0", {0}), + Make_Ok__Unsigned(1, "1", {1}), + Make_Bad_Signed(1, "1"), + Make_Bad_Unsigned(1, "2"), + + // Check max value and overflow value for 2-bit numbers. + Make_Ok__Signed(2, "1", {1}), + Make_Ok__Unsigned(2, "3", {3}), + Make_Bad_Signed(2, "2"), + Make_Bad_Unsigned(2, "4"), + + // Check max negative value and overflow value for signed + // 1- and 2-bit numbers. Signed negative numbers are sign-extended. + Make_Ok__Signed(1, "-0", {uint32_t(0)}), + Make_Ok__Signed(1, "-1", {uint32_t(-1)}), + Make_Ok__Signed(2, "-0", {0}), + Make_Ok__Signed(2, "-1", {uint32_t(-1)}), + Make_Ok__Signed(2, "-2", {uint32_t(-2)}), + Make_Bad_Signed(2, "-3"), + + Make_Bad_Unsigned(2, "2224323424242424"), + Make_Ok__Unsigned(16, "65535", {0xFFFF}), + Make_Bad_Unsigned(16, "65536"), + Make_Bad_Signed(16, "65535"), + Make_Ok__Signed(16, "32767", {0x7FFF}), + Make_Ok__Signed(16, "-32768", {0xFFFF8000}), + + // Check values around 32-bits in magnitude. + Make_Ok__Unsigned(33, "4294967296", {0, 1}), + Make_Ok__Unsigned(33, "4294967297", {1, 1}), + Make_Bad_Unsigned(33, "8589934592"), + Make_Bad_Signed(33, "4294967296"), + Make_Ok__Signed(33, "-4294967296", {0x0, 0xFFFFFFFF}), + Make_Ok__Unsigned(64, "4294967296", {0, 1}), + Make_Ok__Unsigned(64, "4294967297", {1, 1}), + + // Check max value and overflow value for 64-bit numbers. + Make_Ok__Signed(64, "9223372036854775807", {0xffffffff, 0x7fffffff}), + Make_Bad_Signed(64, "9223372036854775808"), + Make_Ok__Unsigned(64, "9223372036854775808", {0x00000000, 0x80000000}), + Make_Ok__Unsigned(64, "18446744073709551615", {0xffffffff, 0xffffffff}), + Make_Ok__Signed(64, "-9223372036854775808", {0x00000000, 0x80000000}), + + }),); +// clang-format on + +using IntegerLeadingMinusTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(IntegerLeadingMinusTest, CantHaveLeadingMinusOnUnsigned) { + EXPECT_FALSE(GetParam().success); + EXPECT_THAT(failedEncode(GetParam(), IdTypeClass::kScalarIntegerType), + Eq("Cannot put a negative number in an unsigned literal")); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + DecimalAndHexIntegers, IntegerLeadingMinusTest, + ::testing::ValuesIn(std::vector{ + // Unsigned numbers never allow a leading minus sign. + Make_Bad_Unsigned(16, "-0"), + Make_Bad_Unsigned(16, "-0x0"), + Make_Bad_Unsigned(16, "-0x1"), + Make_Bad_Unsigned(32, "-0"), + Make_Bad_Unsigned(32, "-0x0"), + Make_Bad_Unsigned(32, "-0x1"), + Make_Bad_Unsigned(64, "-0"), + Make_Bad_Unsigned(64, "-0x0"), + Make_Bad_Unsigned(64, "-0x1"), + }),); + +// clang-format off +INSTANTIATE_TEST_CASE_P( + HexIntegers, IntegerTest, + ::testing::ValuesIn(std::vector{ + // Check 0x and 0X prefices. + Make_Ok__Signed(16, "0x1234", {0x1234}), + Make_Ok__Signed(16, "0X1234", {0x1234}), + + // Check 1-bit numbers + Make_Ok__Signed(1, "0x0", {0}), + Make_Ok__Signed(1, "0x1", {uint32_t(-1)}), + Make_Ok__Unsigned(1, "0x0", {0}), + Make_Ok__Unsigned(1, "0x1", {1}), + Make_Bad_Signed(1, "0x2"), + Make_Bad_Unsigned(1, "0x2"), + + // Check 2-bit numbers + Make_Ok__Signed(2, "0x0", {0}), + Make_Ok__Signed(2, "0x1", {1}), + Make_Ok__Signed(2, "0x2", {uint32_t(-2)}), + Make_Ok__Signed(2, "0x3", {uint32_t(-1)}), + Make_Ok__Unsigned(2, "0x0", {0}), + Make_Ok__Unsigned(2, "0x1", {1}), + Make_Ok__Unsigned(2, "0x2", {2}), + Make_Ok__Unsigned(2, "0x3", {3}), + Make_Bad_Signed(2, "0x4"), + Make_Bad_Unsigned(2, "0x4"), + + // Check 8-bit numbers + Make_Ok__Signed(8, "0x7f", {0x7f}), + Make_Ok__Signed(8, "0x80", {0xffffff80}), + Make_Ok__Unsigned(8, "0x80", {0x80}), + Make_Ok__Unsigned(8, "0xff", {0xff}), + Make_Bad_Signed(8, "0x100"), + Make_Bad_Unsigned(8, "0x100"), + + // Check 16-bit numbers + Make_Ok__Signed(16, "0x7fff", {0x7fff}), + Make_Ok__Signed(16, "0x8000", {0xffff8000}), + Make_Ok__Unsigned(16, "0x8000", {0x8000}), + Make_Ok__Unsigned(16, "0xffff", {0xffff}), + Make_Bad_Signed(16, "0x10000"), + Make_Bad_Unsigned(16, "0x10000"), + + // Check 32-bit numbers + Make_Ok__Signed(32, "0x7fffffff", {0x7fffffff}), + Make_Ok__Signed(32, "0x80000000", {0x80000000}), + Make_Ok__Unsigned(32, "0x80000000", {0x80000000}), + Make_Ok__Unsigned(32, "0xffffffff", {0xffffffff}), + Make_Bad_Signed(32, "0x100000000"), + Make_Bad_Unsigned(32, "0x100000000"), + + // Check 48-bit numbers + Make_Ok__Unsigned(48, "0x7ffffffff", {0xffffffff, 7}), + Make_Ok__Unsigned(48, "0x800000000", {0, 8}), + Make_Ok__Signed(48, "0x7fffffffffff", {0xffffffff, 0x7fff}), + Make_Ok__Signed(48, "0x800000000000", {0, 0xffff8000}), + Make_Bad_Signed(48, "0x1000000000000"), + Make_Bad_Unsigned(48, "0x1000000000000"), + + // Check 64-bit numbers + Make_Ok__Signed(64, "0x7fffffffffffffff", {0xffffffff, 0x7fffffff}), + Make_Ok__Signed(64, "0x8000000000000000", {0x00000000, 0x80000000}), + Make_Ok__Unsigned(64, "0x7fffffffffffffff", {0xffffffff, 0x7fffffff}), + Make_Ok__Unsigned(64, "0x8000000000000000", {0x00000000, 0x80000000}), + }),); +// clang-format on + +TEST(OverflowIntegerParse, Decimal) { + std::string signed_input = "-18446744073709551616"; + std::string expected_message0 = + "Invalid signed integer literal: " + signed_input; + EXPECT_THAT(failedEncode(Make_Bad_Signed(64, signed_input.c_str()), + IdTypeClass::kScalarIntegerType), + Eq(expected_message0)); + + std::string unsigned_input = "18446744073709551616"; + std::string expected_message1 = + "Invalid unsigned integer literal: " + unsigned_input; + EXPECT_THAT(failedEncode(Make_Bad_Unsigned(64, unsigned_input.c_str()), + IdTypeClass::kScalarIntegerType), + Eq(expected_message1)); + + // TODO(dneto): When the given number doesn't have a leading sign, + // we say we're trying to parse an unsigned number, even when the caller + // asked for a signed number. This is kind of weird, but it's an + // artefact of how we do the parsing. + EXPECT_THAT(failedEncode(Make_Bad_Signed(64, unsigned_input.c_str()), + IdTypeClass::kScalarIntegerType), + Eq(expected_message1)); +} + +TEST(OverflowIntegerParse, Hex) { + std::string input = "0x10000000000000000"; + std::string expected_message = "Invalid unsigned integer literal: " + input; + EXPECT_THAT(failedEncode(Make_Bad_Signed(64, input.c_str()), + IdTypeClass::kScalarIntegerType), + Eq(expected_message)); + EXPECT_THAT(failedEncode(Make_Bad_Unsigned(64, input.c_str()), + IdTypeClass::kScalarIntegerType), + Eq(expected_message)); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_start_new_inst_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_start_new_inst_test.cpp new file mode 100644 index 00000000000..ff35ac84c7f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_start_new_inst_test.cpp @@ -0,0 +1,75 @@ +// Copyright (c) 2015-2016 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. + +#include + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::AutoText; + +TEST(TextStartsWithOp, YesAtStart) { + EXPECT_TRUE(AssemblyContext(AutoText("OpFoo"), nullptr).isStartOfNewInst()); + EXPECT_TRUE(AssemblyContext(AutoText("OpFoo"), nullptr).isStartOfNewInst()); + EXPECT_TRUE(AssemblyContext(AutoText("OpEnCL"), nullptr).isStartOfNewInst()); +} + +TEST(TextStartsWithOp, YesAtMiddle) { + { + AutoText text(" OpFoo"); + AssemblyContext dat(text, nullptr); + dat.seekForward(2); + EXPECT_TRUE(dat.isStartOfNewInst()); + } + { + AutoText text("xx OpFoo"); + AssemblyContext dat(text, nullptr); + dat.seekForward(2); + EXPECT_TRUE(dat.isStartOfNewInst()); + } +} + +TEST(TextStartsWithOp, NoIfTooFar) { + AutoText text(" OpFoo"); + AssemblyContext dat(text, nullptr); + dat.seekForward(3); + EXPECT_FALSE(dat.isStartOfNewInst()); +} + +TEST(TextStartsWithOp, NoRegular) { + EXPECT_FALSE( + AssemblyContext(AutoText("Fee Fi Fo Fum"), nullptr).isStartOfNewInst()); + EXPECT_FALSE(AssemblyContext(AutoText("123456"), nullptr).isStartOfNewInst()); + EXPECT_FALSE(AssemblyContext(AutoText("123456"), nullptr).isStartOfNewInst()); + EXPECT_FALSE(AssemblyContext(AutoText("OpenCL"), nullptr).isStartOfNewInst()); +} + +TEST(TextStartsWithOp, YesForValueGenerationForm) { + EXPECT_TRUE( + AssemblyContext(AutoText("%foo = OpAdd"), nullptr).isStartOfNewInst()); + EXPECT_TRUE( + AssemblyContext(AutoText("%foo = OpAdd"), nullptr).isStartOfNewInst()); +} + +TEST(TextStartsWithOp, NoForNearlyValueGeneration) { + EXPECT_FALSE( + AssemblyContext(AutoText("%foo = "), nullptr).isStartOfNewInst()); + EXPECT_FALSE(AssemblyContext(AutoText("%foo "), nullptr).isStartOfNewInst()); + EXPECT_FALSE(AssemblyContext(AutoText("%foo"), nullptr).isStartOfNewInst()); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp new file mode 100644 index 00000000000..7aec9055554 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp @@ -0,0 +1,510 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Annotation" section of the +// SPIR-V spec. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using spvtest::TextToBinaryTest; +using ::testing::Combine; +using ::testing::Eq; +using ::testing::Values; +using ::testing::ValuesIn; + +// Test OpDecorate + +using OpDecorateSimpleTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam< + std::tuple>>>; + +TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) { + // This string should assemble, but should not validate. + std::stringstream input; + input << "OpDecorate %1 " << std::get<1>(GetParam()).name(); + for (auto operand : std::get<1>(GetParam()).operands()) + input << " " << operand; + input << std::endl; + EXPECT_THAT(CompiledInstructions(input.str(), std::get<0>(GetParam())), + Eq(MakeInstruction(SpvOpDecorate, + {1, uint32_t(std::get<1>(GetParam()).value())}, + std::get<1>(GetParam()).operands()))); + // Also check disassembly. + EXPECT_THAT( + EncodeAndDecodeSuccessfully(input.str(), SPV_BINARY_TO_TEXT_OPTION_NONE, + std::get<0>(GetParam())), + Eq(input.str())); +} + +#define CASE(NAME) SpvDecoration##NAME, #NAME +INSTANTIATE_TEST_CASE_P( + TextToBinaryDecorateSimple, OpDecorateSimpleTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector>{ + // The operand literal values are arbitrarily chosen, + // but there are the right number of them. + {CASE(RelaxedPrecision), {}}, + {CASE(SpecId), {100}}, + {CASE(Block), {}}, + {CASE(BufferBlock), {}}, + {CASE(RowMajor), {}}, + {CASE(ColMajor), {}}, + {CASE(ArrayStride), {4}}, + {CASE(MatrixStride), {16}}, + {CASE(GLSLShared), {}}, + {CASE(GLSLPacked), {}}, + {CASE(CPacked), {}}, + // Placeholder line for enum value 12 + {CASE(NoPerspective), {}}, + {CASE(Flat), {}}, + {CASE(Patch), {}}, + {CASE(Centroid), {}}, + {CASE(Sample), {}}, + {CASE(Invariant), {}}, + {CASE(Restrict), {}}, + {CASE(Aliased), {}}, + {CASE(Volatile), {}}, + {CASE(Constant), {}}, + {CASE(Coherent), {}}, + {CASE(NonWritable), {}}, + {CASE(NonReadable), {}}, + {CASE(Uniform), {}}, + {CASE(SaturatedConversion), {}}, + {CASE(Stream), {2}}, + {CASE(Location), {6}}, + {CASE(Component), {3}}, + {CASE(Index), {14}}, + {CASE(Binding), {19}}, + {CASE(DescriptorSet), {7}}, + {CASE(Offset), {12}}, + {CASE(XfbBuffer), {1}}, + {CASE(XfbStride), {8}}, + {CASE(NoContraction), {}}, + {CASE(InputAttachmentIndex), {102}}, + {CASE(Alignment), {16}}, + })), ); + +INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateSimpleV11, OpDecorateSimpleTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + Values(EnumCase{ + CASE(MaxByteOffset), {128}})), ); +#undef CASE + +TEST_F(OpDecorateSimpleTest, WrongDecoration) { + EXPECT_THAT(CompileFailure("OpDecorate %1 xxyyzz"), + Eq("Invalid decoration 'xxyyzz'.")); +} + +TEST_F(OpDecorateSimpleTest, ExtraOperandsOnDecorationExpectingNone) { + EXPECT_THAT(CompileFailure("OpDecorate %1 RelaxedPrecision 99"), + Eq("Expected or at the beginning of an " + "instruction, found '99'.")); +} + +TEST_F(OpDecorateSimpleTest, ExtraOperandsOnDecorationExpectingOne) { + EXPECT_THAT(CompileFailure("OpDecorate %1 SpecId 99 100"), + Eq("Expected or at the beginning of an " + "instruction, found '100'.")); +} + +TEST_F(OpDecorateSimpleTest, ExtraOperandsOnDecorationExpectingTwo) { + EXPECT_THAT( + CompileFailure("OpDecorate %1 LinkageAttributes \"abc\" Import 42"), + Eq("Expected or at the beginning of an " + "instruction, found '42'.")); +} + +// A single test case for an enum decoration. +struct DecorateEnumCase { + // Place the enum value first, so it's easier to read the binary dumps when + // the test fails. + uint32_t value; // The value within the enum, e.g. Position + std::string name; + uint32_t enum_value; // Which enum, e.g. BuiltIn + std::string enum_name; +}; + +using OpDecorateEnumTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpDecorateEnumTest, AnyEnumDecoration) { + // This string should assemble, but should not validate. + const std::string input = + "OpDecorate %1 " + GetParam().enum_name + " " + GetParam().name; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpDecorate, {1, GetParam().enum_value, + GetParam().value}))); +} + +// Test OpDecorate BuiltIn. +// clang-format off +#define CASE(NAME) \ + { SpvBuiltIn##NAME, #NAME, SpvDecorationBuiltIn, "BuiltIn" } +INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest, + ::testing::ValuesIn(std::vector{ + CASE(Position), + CASE(PointSize), + CASE(ClipDistance), + CASE(CullDistance), + CASE(VertexId), + CASE(InstanceId), + CASE(PrimitiveId), + CASE(InvocationId), + CASE(Layer), + CASE(ViewportIndex), + CASE(TessLevelOuter), + CASE(TessLevelInner), + CASE(TessCoord), + CASE(PatchVertices), + CASE(FragCoord), + CASE(PointCoord), + CASE(FrontFacing), + CASE(SampleId), + CASE(SamplePosition), + CASE(SampleMask), + // Value 21 intentionally missing. + CASE(FragDepth), + CASE(HelperInvocation), + CASE(NumWorkgroups), + CASE(WorkgroupSize), + CASE(WorkgroupId), + CASE(LocalInvocationId), + CASE(GlobalInvocationId), + CASE(LocalInvocationIndex), + CASE(WorkDim), + CASE(GlobalSize), + CASE(EnqueuedWorkgroupSize), + CASE(GlobalOffset), + CASE(GlobalLinearId), + // Value 35 intentionally missing. + CASE(SubgroupSize), + CASE(SubgroupMaxSize), + CASE(NumSubgroups), + CASE(NumEnqueuedSubgroups), + CASE(SubgroupId), + CASE(SubgroupLocalInvocationId), + CASE(VertexIndex), + CASE(InstanceIndex), + }),); +#undef CASE +// clang-format on + +TEST_F(OpDecorateEnumTest, WrongBuiltIn) { + EXPECT_THAT(CompileFailure("OpDecorate %1 BuiltIn xxyyzz"), + Eq("Invalid built-in 'xxyyzz'.")); +} + +// Test OpDecorate FuncParamAttr +// clang-format off +#define CASE(NAME) \ + { SpvFunctionParameterAttribute##NAME, #NAME, SpvDecorationFuncParamAttr, "FuncParamAttr" } +INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest, + ::testing::ValuesIn(std::vector{ + CASE(Zext), + CASE(Sext), + CASE(ByVal), + CASE(Sret), + CASE(NoAlias), + CASE(NoCapture), + CASE(NoWrite), + CASE(NoReadWrite), + }),); +#undef CASE +// clang-format on + +TEST_F(OpDecorateEnumTest, WrongFuncParamAttr) { + EXPECT_THAT(CompileFailure("OpDecorate %1 FuncParamAttr xxyyzz"), + Eq("Invalid function parameter attribute 'xxyyzz'.")); +} + +// Test OpDecorate FPRoundingMode +// clang-format off +#define CASE(NAME) \ + { SpvFPRoundingMode##NAME, #NAME, SpvDecorationFPRoundingMode, "FPRoundingMode" } +INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest, + ::testing::ValuesIn(std::vector{ + CASE(RTE), + CASE(RTZ), + CASE(RTP), + CASE(RTN), + }),); +#undef CASE +// clang-format on + +TEST_F(OpDecorateEnumTest, WrongFPRoundingMode) { + EXPECT_THAT(CompileFailure("OpDecorate %1 FPRoundingMode xxyyzz"), + Eq("Invalid floating-point rounding mode 'xxyyzz'.")); +} + +// Test OpDecorate FPFastMathMode. +// These can by named enums for the single-bit masks. However, we don't support +// symbolic combinations of the masks. Rather, they can use ! +// syntax, e.g. !0x3 + +// clang-format off +#define CASE(ENUM,NAME) \ + { SpvFPFastMathMode##ENUM, #NAME, SpvDecorationFPFastMathMode, "FPFastMathMode" } +INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest, + ::testing::ValuesIn(std::vector{ + CASE(MaskNone, None), + CASE(NotNaNMask, NotNaN), + CASE(NotInfMask, NotInf), + CASE(NSZMask, NSZ), + CASE(AllowRecipMask, AllowRecip), + CASE(FastMask, Fast), + }),); +#undef CASE +// clang-format on + +TEST_F(OpDecorateEnumTest, CombinedFPFastMathMask) { + // Sample a single combination. This ensures we've integrated + // the instruction parsing logic with spvTextParseMask. + const std::string input = "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ"; + const uint32_t expected_enum = SpvDecorationFPFastMathMode; + const uint32_t expected_mask = SpvFPFastMathModeNotNaNMask | + SpvFPFastMathModeNotInfMask | + SpvFPFastMathModeNSZMask; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpDecorate, {1, expected_enum, expected_mask}))); +} + +TEST_F(OpDecorateEnumTest, WrongFPFastMathMode) { + EXPECT_THAT( + CompileFailure("OpDecorate %1 FPFastMathMode NotNaN|xxyyzz"), + Eq("Invalid floating-point fast math mode operand 'NotNaN|xxyyzz'.")); +} + +// Test OpDecorate Linkage + +// A single test case for a linkage +struct DecorateLinkageCase { + uint32_t linkage_type_value; + std::string linkage_type_name; + std::string external_name; +}; + +using OpDecorateLinkageTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) { + // This string should assemble, but should not validate. + const std::string input = "OpDecorate %1 LinkageAttributes \"" + + GetParam().external_name + "\" " + + GetParam().linkage_type_name; + std::vector expected_operands{1, SpvDecorationLinkageAttributes}; + std::vector encoded_external_name = + MakeVector(GetParam().external_name); + expected_operands.insert(expected_operands.end(), + encoded_external_name.begin(), + encoded_external_name.end()); + expected_operands.push_back(GetParam().linkage_type_value); + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpDecorate, expected_operands))); +} + +// clang-format off +#define CASE(ENUM) SpvLinkageType##ENUM, #ENUM +INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest, + ::testing::ValuesIn(std::vector{ + { CASE(Import), "a" }, + { CASE(Export), "foo" }, + { CASE(Import), "some kind of long name with spaces etc." }, + // TODO(dneto): utf-8, escaping, quoting cases. + }),); +#undef CASE +// clang-format on + +TEST_F(OpDecorateLinkageTest, WrongType) { + EXPECT_THAT(CompileFailure("OpDecorate %1 LinkageAttributes \"foo\" xxyyzz"), + Eq("Invalid linkage type 'xxyyzz'.")); +} + +// Test OpGroupMemberDecorate + +TEST_F(TextToBinaryTest, GroupMemberDecorateGoodOneTarget) { + EXPECT_THAT(CompiledInstructions("OpGroupMemberDecorate %group %id0 42"), + Eq(MakeInstruction(SpvOpGroupMemberDecorate, {1, 2, 42}))); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateGoodTwoTargets) { + EXPECT_THAT( + CompiledInstructions("OpGroupMemberDecorate %group %id0 96 %id1 42"), + Eq(MakeInstruction(SpvOpGroupMemberDecorate, {1, 2, 96, 3, 42}))); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateMissingGroupId) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidGroupId) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate 16"), + Eq("Expected id to start with %.")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidTargetId) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group 12"), + Eq("Expected id to start with %.")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateMissingTargetMemberNumber) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidTargetMemberNumber) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0 %id1"), + Eq("Invalid unsigned integer literal: %id1")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidSecondTargetId) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id1 42 12"), + Eq("Expected id to start with %.")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateMissingSecondTargetMemberNumber) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0 42 %id1"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(TextToBinaryTest, GroupMemberDecorateInvalidSecondTargetMemberNumber) { + EXPECT_THAT(CompileFailure("OpGroupMemberDecorate %group %id0 42 %id1 %id2"), + Eq("Invalid unsigned integer literal: %id2")); +} + +// Test OpMemberDecorate + +using OpMemberDecorateSimpleTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam< + std::tuple>>>; + +TEST_P(OpMemberDecorateSimpleTest, AnySimpleDecoration) { + // This string should assemble, but should not validate. + std::stringstream input; + input << "OpMemberDecorate %1 42 " << std::get<1>(GetParam()).name(); + for (auto operand : std::get<1>(GetParam()).operands()) + input << " " << operand; + input << std::endl; + EXPECT_THAT( + CompiledInstructions(input.str(), std::get<0>(GetParam())), + Eq(MakeInstruction(SpvOpMemberDecorate, + {1, 42, uint32_t(std::get<1>(GetParam()).value())}, + std::get<1>(GetParam()).operands()))); + // Also check disassembly. + EXPECT_THAT( + EncodeAndDecodeSuccessfully(input.str(), SPV_BINARY_TO_TEXT_OPTION_NONE, + std::get<0>(GetParam())), + Eq(input.str())); +} + +#define CASE(NAME) SpvDecoration##NAME, #NAME +INSTANTIATE_TEST_CASE_P( + TextToBinaryDecorateSimple, OpMemberDecorateSimpleTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector>{ + // The operand literal values are arbitrarily chosen, + // but there are the right number of them. + {CASE(RelaxedPrecision), {}}, + {CASE(SpecId), {100}}, + {CASE(Block), {}}, + {CASE(BufferBlock), {}}, + {CASE(RowMajor), {}}, + {CASE(ColMajor), {}}, + {CASE(ArrayStride), {4}}, + {CASE(MatrixStride), {16}}, + {CASE(GLSLShared), {}}, + {CASE(GLSLPacked), {}}, + {CASE(CPacked), {}}, + // Placeholder line for enum value 12 + {CASE(NoPerspective), {}}, + {CASE(Flat), {}}, + {CASE(Patch), {}}, + {CASE(Centroid), {}}, + {CASE(Sample), {}}, + {CASE(Invariant), {}}, + {CASE(Restrict), {}}, + {CASE(Aliased), {}}, + {CASE(Volatile), {}}, + {CASE(Constant), {}}, + {CASE(Coherent), {}}, + {CASE(NonWritable), {}}, + {CASE(NonReadable), {}}, + {CASE(Uniform), {}}, + {CASE(SaturatedConversion), {}}, + {CASE(Stream), {2}}, + {CASE(Location), {6}}, + {CASE(Component), {3}}, + {CASE(Index), {14}}, + {CASE(Binding), {19}}, + {CASE(DescriptorSet), {7}}, + {CASE(Offset), {12}}, + {CASE(XfbBuffer), {1}}, + {CASE(XfbStride), {8}}, + {CASE(NoContraction), {}}, + {CASE(InputAttachmentIndex), {102}}, + {CASE(Alignment), {16}}, + })), ); + +INSTANTIATE_TEST_CASE_P( + TextToBinaryDecorateSimpleV11, OpMemberDecorateSimpleTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + Values(EnumCase{CASE(MaxByteOffset), {128}})), ); +#undef CASE + +TEST_F(OpMemberDecorateSimpleTest, WrongDecoration) { + EXPECT_THAT(CompileFailure("OpMemberDecorate %1 9 xxyyzz"), + Eq("Invalid decoration 'xxyyzz'.")); +} + +TEST_F(OpMemberDecorateSimpleTest, ExtraOperandsOnDecorationExpectingNone) { + EXPECT_THAT(CompileFailure("OpMemberDecorate %1 12 RelaxedPrecision 99"), + Eq("Expected or at the beginning of an " + "instruction, found '99'.")); +} + +TEST_F(OpMemberDecorateSimpleTest, ExtraOperandsOnDecorationExpectingOne) { + EXPECT_THAT(CompileFailure("OpMemberDecorate %1 0 SpecId 99 100"), + Eq("Expected or at the beginning of an " + "instruction, found '100'.")); +} + +TEST_F(OpMemberDecorateSimpleTest, ExtraOperandsOnDecorationExpectingTwo) { + EXPECT_THAT(CompileFailure( + "OpMemberDecorate %1 1 LinkageAttributes \"abc\" Import 42"), + Eq("Expected or at the beginning of an " + "instruction, found '42'.")); +} + +// TODO(dneto): OpMemberDecorate cases for decorations with parameters which +// are: not just lists of literal numbers. + +// TODO(dneto): OpDecorationGroup +// TODO(dneto): OpGroupDecorate + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.barrier_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.barrier_test.cpp new file mode 100644 index 00000000000..545d26ff298 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.barrier_test.cpp @@ -0,0 +1,170 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Barrier Instructions" section +// of the SPIR-V spec. + +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::MakeInstruction; +using spvtest::TextToBinaryTest; +using ::testing::_; +using ::testing::ElementsAre; +using ::testing::Eq; + +// Test OpMemoryBarrier + +using OpMemoryBarrier = spvtest::TextToBinaryTest; + +TEST_F(OpMemoryBarrier, Good) { + const std::string input = "OpMemoryBarrier %1 %2\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpMemoryBarrier, {1, 2}))); + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input)); +} + +TEST_F(OpMemoryBarrier, BadMissingScopeId) { + const std::string input = "OpMemoryBarrier\n"; + EXPECT_THAT(CompileFailure(input), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpMemoryBarrier, BadInvalidScopeId) { + const std::string input = "OpMemoryBarrier 99\n"; + EXPECT_THAT(CompileFailure(input), Eq("Expected id to start with %.")); +} + +TEST_F(OpMemoryBarrier, BadMissingMemorySemanticsId) { + const std::string input = "OpMemoryBarrier %scope\n"; + EXPECT_THAT(CompileFailure(input), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpMemoryBarrier, BadInvalidMemorySemanticsId) { + const std::string input = "OpMemoryBarrier %scope 14\n"; + EXPECT_THAT(CompileFailure(input), Eq("Expected id to start with %.")); +} + +// TODO(dneto): OpControlBarrier +// TODO(dneto): OpGroupAsyncCopy +// TODO(dneto): OpGroupWaitEvents +// TODO(dneto): OpGroupAll +// TODO(dneto): OpGroupAny +// TODO(dneto): OpGroupBroadcast +// TODO(dneto): OpGroupIAdd +// TODO(dneto): OpGroupFAdd +// TODO(dneto): OpGroupFMin +// TODO(dneto): OpGroupUMin +// TODO(dneto): OpGroupSMin +// TODO(dneto): OpGroupFMax +// TODO(dneto): OpGroupUMax +// TODO(dneto): OpGroupSMax + +using NamedMemoryBarrierTest = spvtest::TextToBinaryTest; + +// OpMemoryNamedBarrier is not in 1.0, but it is enabled by a capability. +// We should be able to assemble it. Validation checks are in another test +// file. +TEST_F(NamedMemoryBarrierTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("OpMemoryNamedBarrier %bar %scope %semantics", + SPV_ENV_UNIVERSAL_1_0), + ElementsAre(spvOpcodeMake(4, SpvOpMemoryNamedBarrier), _, _, _)); +} + +TEST_F(NamedMemoryBarrierTest, ArgumentCount) { + EXPECT_THAT(CompileFailure("OpMemoryNamedBarrier", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompileFailure("OpMemoryNamedBarrier %bar", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompileFailure("OpMemoryNamedBarrier %bar %scope", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompiledInstructions("OpMemoryNamedBarrier %bar %scope %semantics", + SPV_ENV_UNIVERSAL_1_1), + ElementsAre(spvOpcodeMake(4, SpvOpMemoryNamedBarrier), _, _, _)); + EXPECT_THAT( + CompileFailure("OpMemoryNamedBarrier %bar %scope %semantics %extra", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected '=', found end of stream.")); +} + +TEST_F(NamedMemoryBarrierTest, ArgumentTypes) { + EXPECT_THAT(CompileFailure("OpMemoryNamedBarrier 123 %scope %semantics", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); + EXPECT_THAT(CompileFailure("OpMemoryNamedBarrier %bar %scope \"semantics\"", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); +} + +using TypeNamedBarrierTest = spvtest::TextToBinaryTest; + +TEST_F(TypeNamedBarrierTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("%t = OpTypeNamedBarrier", SPV_ENV_UNIVERSAL_1_0), + ElementsAre(spvOpcodeMake(2, SpvOpTypeNamedBarrier), _)); +} + +TEST_F(TypeNamedBarrierTest, ArgumentCount) { + EXPECT_THAT(CompileFailure("OpTypeNamedBarrier", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, " + "found 'OpTypeNamedBarrier'.")); + EXPECT_THAT( + CompiledInstructions("%t = OpTypeNamedBarrier", SPV_ENV_UNIVERSAL_1_1), + ElementsAre(spvOpcodeMake(2, SpvOpTypeNamedBarrier), _)); + EXPECT_THAT( + CompileFailure("%t = OpTypeNamedBarrier 1 2 3", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected or at the beginning of an instruction, " + "found '1'.")); +} + +using NamedBarrierInitializeTest = spvtest::TextToBinaryTest; + +TEST_F(NamedBarrierInitializeTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("%bar = OpNamedBarrierInitialize %type %count", + SPV_ENV_UNIVERSAL_1_0), + ElementsAre(spvOpcodeMake(4, SpvOpNamedBarrierInitialize), _, _, _)); +} + +TEST_F(NamedBarrierInitializeTest, ArgumentCount) { + EXPECT_THAT( + CompileFailure("%bar = OpNamedBarrierInitialize", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT(CompileFailure("%bar = OpNamedBarrierInitialize %ype", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompiledInstructions("%bar = OpNamedBarrierInitialize %type %count", + SPV_ENV_UNIVERSAL_1_1), + ElementsAre(spvOpcodeMake(4, SpvOpNamedBarrierInitialize), _, _, _)); + EXPECT_THAT( + CompileFailure("%bar = OpNamedBarrierInitialize %type %count \"extra\"", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected or at the beginning of an instruction, " + "found '\"extra\"'.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp new file mode 100644 index 00000000000..1a24b528f28 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp @@ -0,0 +1,830 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Group Instrucions" section of the +// SPIR-V spec. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using ::testing::Eq; + +// Test Sampler Addressing Mode enum values + +using SamplerAddressingModeTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) { + const std::string input = + "%result = OpConstantSampler %type " + GetParam().name() + " 0 Nearest"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpConstantSampler, + {1, 2, GetParam().value(), 0, 0}))); +} + +// clang-format off +#define CASE(NAME) { SpvSamplerAddressingMode##NAME, #NAME } +INSTANTIATE_TEST_CASE_P( + TextToBinarySamplerAddressingMode, SamplerAddressingModeTest, + ::testing::ValuesIn(std::vector>{ + CASE(None), + CASE(ClampToEdge), + CASE(Clamp), + CASE(Repeat), + CASE(RepeatMirrored), + }),); +#undef CASE +// clang-format on + +TEST_F(SamplerAddressingModeTest, WrongMode) { + EXPECT_THAT(CompileFailure("%r = OpConstantSampler %t xxyyzz 0 Nearest"), + Eq("Invalid sampler addressing mode 'xxyyzz'.")); +} + +// Test Sampler Filter Mode enum values + +using SamplerFilterModeTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) { + const std::string input = + "%result = OpConstantSampler %type Clamp 0 " + GetParam().name(); + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpConstantSampler, + {1, 2, 2, 0, GetParam().value()}))); +} + +// clang-format off +#define CASE(NAME) { SpvSamplerFilterMode##NAME, #NAME} +INSTANTIATE_TEST_CASE_P( + TextToBinarySamplerFilterMode, SamplerFilterModeTest, + ::testing::ValuesIn(std::vector>{ + CASE(Nearest), + CASE(Linear), + }),); +#undef CASE +// clang-format on + +TEST_F(SamplerFilterModeTest, WrongMode) { + EXPECT_THAT(CompileFailure("%r = OpConstantSampler %t Clamp 0 xxyyzz"), + Eq("Invalid sampler filter mode 'xxyyzz'.")); +} + +struct ConstantTestCase { + std::string constant_type; + std::string constant_value; + std::vector expected_instructions; +}; + +using OpConstantValidTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpConstantValidTest, ValidTypes) { + const std::string input = "%1 = " + GetParam().constant_type + + "\n" + "%2 = OpConstant %1 " + + GetParam().constant_value + "\n"; + std::vector instructions; + EXPECT_THAT(CompiledInstructions(input), Eq(GetParam().expected_instructions)) + << " type: " << GetParam().constant_type + << " literal: " << GetParam().constant_value; +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpConstantValid, OpConstantValidTest, + ::testing::ValuesIn(std::vector{ + // Check 16 bits + {"OpTypeInt 16 0", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0x1234})})}, + {"OpTypeInt 16 0", "0x8000", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0x8000})})}, + {"OpTypeInt 16 0", "0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 16 0", "65535", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 65535})})}, + {"OpTypeInt 16 0", "0xffff", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 65535})})}, + {"OpTypeInt 16 1", "0x8000", // Test sign extension. + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0xffff8000})})}, + {"OpTypeInt 16 1", "-32", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32)})})}, + {"OpTypeInt 16 1", "0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 16 1", "-0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 16 1", "-0x0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 16 1", "-32768", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32768)})})}, + // Check 32 bits + {"OpTypeInt 32 0", "42", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 42})})}, + {"OpTypeInt 32 1", "-32", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32)})})}, + {"OpTypeInt 32 1", "0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 32 1", "-0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 32 1", "-0x0", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0})})}, + {"OpTypeInt 32 1", "-0x001", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-1)})})}, + {"OpTypeInt 32 1", "2147483647", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0x7fffffffu})})}, + {"OpTypeInt 32 1", "-2147483648", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0x80000000u})})}, + {"OpTypeFloat 32", "1.0", + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0x3f800000})})}, + {"OpTypeFloat 32", "10.0", + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0x41200000})})}, + {"OpTypeFloat 32", "-0x1p+128", // -infinity + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0xFF800000})})}, + {"OpTypeFloat 32", "0x1p+128", // +infinity + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0x7F800000})})}, + {"OpTypeFloat 32", "-0x1.8p+128", // A -NaN + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0xFFC00000})})}, + {"OpTypeFloat 32", "-0x1.0002p+128", // A +NaN + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, {1, 2, 0xFF800100})})}, + // Check 48 bits + {"OpTypeInt 48 0", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0x1234, 0})})}, + {"OpTypeInt 48 0", "0x800000000001", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 1, 0x00008000})})}, + {"OpTypeInt 48 1", "0x800000000000", // Test sign extension. + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0, 0xffff8000})})}, + {"OpTypeInt 48 1", "-32", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}), + MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32), uint32_t(-1)})})}, + // Check 64 bits + {"OpTypeInt 64 0", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0x1234, 0})})}, + {"OpTypeInt 64 0", "18446744073709551615", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0xffffffffu, 0xffffffffu})})}, + {"OpTypeInt 64 0", "0xffffffffffffffff", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 0xffffffffu, 0xffffffffu})})}, + {"OpTypeInt 64 1", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0x1234, 0})})}, + {"OpTypeInt 64 1", "-42", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})}, + {"OpTypeInt 64 1", "-0x01", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0xffffffffu, 0xffffffffu})})}, + {"OpTypeInt 64 1", "9223372036854775807", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0xffffffffu, 0x7fffffffu})})}, + {"OpTypeInt 64 1", "0x7fffffff", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 0x7fffffffu, 0})})}, + }),); +// clang-format on + +// A test case for checking OpConstant with invalid literals with a leading +// minus. +struct InvalidLeadingMinusCase { + std::string type; + std::string literal; +}; + +using OpConstantInvalidLeadingMinusTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(OpConstantInvalidLeadingMinusTest, InvalidCase) { + const std::string input = "%1 = " + GetParam().type + + "\n" + "%2 = OpConstant %1 " + + GetParam().literal; + EXPECT_THAT(CompileFailure(input), + Eq("Cannot put a negative number in an unsigned literal")); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpConstantInvalidLeadingMinus, OpConstantInvalidLeadingMinusTest, + ::testing::ValuesIn(std::vector{ + {"OpTypeInt 16 0", "-0"}, + {"OpTypeInt 16 0", "-0x0"}, + {"OpTypeInt 16 0", "-1"}, + {"OpTypeInt 32 0", "-0"}, + {"OpTypeInt 32 0", "-0x0"}, + {"OpTypeInt 32 0", "-1"}, + {"OpTypeInt 64 0", "-0"}, + {"OpTypeInt 64 0", "-0x0"}, + {"OpTypeInt 64 0", "-1"}, + }),); +// clang-format on + +// A test case for invalid floating point literals. +struct InvalidFloatConstantCase { + uint32_t width; + std::string literal; +}; + +using OpConstantInvalidFloatConstant = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>; + +TEST_P(OpConstantInvalidFloatConstant, Samples) { + // Check both kinds of instructions that take literal floats. + for (const auto& instruction : {"OpConstant", "OpSpecConstant"}) { + std::stringstream input; + input << "%1 = OpTypeFloat " << GetParam().width << "\n" + << "%2 = " << instruction << " %1 " << GetParam().literal; + std::stringstream expected_error; + expected_error << "Invalid " << GetParam().width + << "-bit float literal: " << GetParam().literal; + EXPECT_THAT(CompileFailure(input.str()), Eq(expected_error.str())); + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryInvalidFloatConstant, OpConstantInvalidFloatConstant, + ::testing::ValuesIn(std::vector{ + {16, "abc"}, + {16, "--1"}, + {16, "-+1"}, + {16, "+-1"}, + {16, "++1"}, + {16, "1e30"}, // Overflow is an error for 16-bit floats. + {16, "-1e30"}, + {16, "1e40"}, + {16, "-1e40"}, + {16, "1e400"}, + {16, "-1e400"}, + {32, "abc"}, + {32, "--1"}, + {32, "-+1"}, + {32, "+-1"}, + {32, "++1"}, + {32, "1e40"}, // Overflow is an error for 32-bit floats. + {32, "-1e40"}, + {32, "1e400"}, + {32, "-1e400"}, + {64, "abc"}, + {64, "--1"}, + {64, "-+1"}, + {64, "+-1"}, + {64, "++1"}, + {32, "1e400"}, // Overflow is an error for 64-bit floats. + {32, "-1e400"}, + }),); +// clang-format on + +using OpConstantInvalidTypeTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpConstantInvalidTypeTest, InvalidTypes) { + const std::string input = "%1 = " + GetParam() + + "\n" + "%2 = OpConstant %1 0\n"; + EXPECT_THAT( + CompileFailure(input), + Eq("Type for Constant must be a scalar floating point or integer type")); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpConstantInvalidValidType, OpConstantInvalidTypeTest, + ::testing::ValuesIn(std::vector{ + {"OpTypeVoid", + "OpTypeBool", + "OpTypeVector %a 32", + "OpTypeMatrix %a 32", + "OpTypeImage %a 1D 0 0 0 0 Unknown", + "OpTypeSampler", + "OpTypeSampledImage %a", + "OpTypeArray %a %b", + "OpTypeRuntimeArray %a", + "OpTypeStruct %a", + "OpTypeOpaque \"Foo\"", + "OpTypePointer UniformConstant %a", + "OpTypeFunction %a %b", + "OpTypeEvent", + "OpTypeDeviceEvent", + "OpTypeReserveId", + "OpTypeQueue", + "OpTypePipe ReadOnly", + "OpTypeForwardPointer %a UniformConstant", + // At least one thing that isn't a type at all + "OpNot %a %b" + }, + }),); +// clang-format on + +using OpSpecConstantValidTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpSpecConstantValidTest, ValidTypes) { + const std::string input = "%1 = " + GetParam().constant_type + + "\n" + "%2 = OpSpecConstant %1 " + + GetParam().constant_value + "\n"; + std::vector instructions; + EXPECT_THAT(CompiledInstructions(input), + Eq(GetParam().expected_instructions)); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSpecConstantValid, OpSpecConstantValidTest, + ::testing::ValuesIn(std::vector{ + // Check 16 bits + {"OpTypeInt 16 0", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234})})}, + {"OpTypeInt 16 0", "0x8000", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x8000})})}, + {"OpTypeInt 16 1", "0x8000", // Test sign extension. + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0xffff8000})})}, + {"OpTypeInt 16 1", "-32", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-32)})})}, + // Check 32 bits + {"OpTypeInt 32 0", "42", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 0}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 42})})}, + {"OpTypeInt 32 1", "-32", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-32)})})}, + {"OpTypeFloat 32", "1.0", + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x3f800000})})}, + {"OpTypeFloat 32", "10.0", + Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x41200000})})}, + // Check 48 bits + {"OpTypeInt 48 0", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234, 0})})}, + {"OpTypeInt 48 0", "0x800000000001", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 1, 0x00008000})})}, + {"OpTypeInt 48 1", "0x800000000000", // Test sign extension. + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0, 0xffff8000})})}, + {"OpTypeInt 48 1", "-32", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-32), uint32_t(-1)})})}, + // Check 64 bits + {"OpTypeInt 64 0", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 0}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234, 0})})}, + {"OpTypeInt 64 1", "0x1234", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234, 0})})}, + {"OpTypeInt 64 1", "-42", + Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), + MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})}, + }),); +// clang-format on + +using OpSpecConstantInvalidTypeTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpSpecConstantInvalidTypeTest, InvalidTypes) { + const std::string input = "%1 = " + GetParam() + + "\n" + "%2 = OpSpecConstant %1 0\n"; + EXPECT_THAT(CompileFailure(input), + Eq("Type for SpecConstant must be a scalar floating point or " + "integer type")); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSpecConstantInvalidValidType, OpSpecConstantInvalidTypeTest, + ::testing::ValuesIn(std::vector{ + {"OpTypeVoid", + "OpTypeBool", + "OpTypeVector %a 32", + "OpTypeMatrix %a 32", + "OpTypeImage %a 1D 0 0 0 0 Unknown", + "OpTypeSampler", + "OpTypeSampledImage %a", + "OpTypeArray %a %b", + "OpTypeRuntimeArray %a", + "OpTypeStruct %a", + "OpTypeOpaque \"Foo\"", + "OpTypePointer UniformConstant %a", + "OpTypeFunction %a %b", + "OpTypeEvent", + "OpTypeDeviceEvent", + "OpTypeReserveId", + "OpTypeQueue", + "OpTypePipe ReadOnly", + "OpTypeForwardPointer %a UniformConstant", + // At least one thing that isn't a type at all + "OpNot %a %b" + }, + }),); +// clang-format on + +const int64_t kMaxUnsigned48Bit = (int64_t(1) << 48) - 1; +const int64_t kMaxSigned48Bit = (int64_t(1) << 47) - 1; +const int64_t kMinSigned48Bit = -kMaxSigned48Bit - 1; + +INSTANTIATE_TEST_CASE_P( + OpConstantRoundTrip, RoundTripTest, + ::testing::ValuesIn(std::vector{ + // 16 bit + "%1 = OpTypeInt 16 0\n%2 = OpConstant %1 0\n", + "%1 = OpTypeInt 16 0\n%2 = OpConstant %1 65535\n", + "%1 = OpTypeInt 16 1\n%2 = OpConstant %1 -32768\n", + "%1 = OpTypeInt 16 1\n%2 = OpConstant %1 32767\n", + "%1 = OpTypeInt 32 0\n%2 = OpConstant %1 0\n", + // 32 bit + std::string("%1 = OpTypeInt 32 0\n%2 = OpConstant %1 0\n"), + std::string("%1 = OpTypeInt 32 0\n%2 = OpConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 32 1\n%2 = OpConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 32 1\n%2 = OpConstant %1 ") + + std::to_string(std::numeric_limits::min()) + "\n", + // 48 bit + std::string("%1 = OpTypeInt 48 0\n%2 = OpConstant %1 0\n"), + std::string("%1 = OpTypeInt 48 0\n%2 = OpConstant %1 ") + + std::to_string(kMaxUnsigned48Bit) + "\n", + std::string("%1 = OpTypeInt 48 1\n%2 = OpConstant %1 ") + + std::to_string(kMaxSigned48Bit) + "\n", + std::string("%1 = OpTypeInt 48 1\n%2 = OpConstant %1 ") + + std::to_string(kMinSigned48Bit) + "\n", + // 64 bit + std::string("%1 = OpTypeInt 64 0\n%2 = OpConstant %1 0\n"), + std::string("%1 = OpTypeInt 64 0\n%2 = OpConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 64 1\n%2 = OpConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 64 1\n%2 = OpConstant %1 ") + + std::to_string(std::numeric_limits::min()) + "\n", + // 32-bit float + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0\n", + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 13.5\n", + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -12.5\n", + // 64-bit float + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0\n", + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 1.79767e+308\n", + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -1.79767e+308\n", + }), ); + +INSTANTIATE_TEST_CASE_P( + OpConstantHalfRoundTrip, RoundTripTest, + ::testing::ValuesIn(std::vector{ + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x0p+0\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x0p+0\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1p+0\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.1p+0\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.01p-1\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.8p+1\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.ffcp+1\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1p+0\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.1p+0\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.01p-1\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.8p+1\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffcp+1\n", + + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1p-16\n", // some denorms + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1p-24\n", + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1p-24\n", + + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1p+16\n", // +inf + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1p+16\n", // -inf + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.01p+16\n", // -inf + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.01p+16\n", // nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.11p+16\n", // nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.ffp+16\n", // nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.ffcp+16\n", // nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.004p+16\n", // nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.01p+16\n", // -nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.11p+16\n", // -nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffp+16\n", // -nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffcp+16\n", // -nan + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.004p+16\n", // -nan + }), ); + +// clang-format off +// (Clang-format really wants to break up these strings across lines. +INSTANTIATE_TEST_CASE_P( + OpConstantRoundTripNonFinite, RoundTripTest, + ::testing::ValuesIn(std::vector{ + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1p+128\n", // -inf + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1p+128\n", // inf + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.8p+128\n", // -nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.0002p+128\n", // -nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.0018p+128\n", // -nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.01ep+128\n", // -nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1.fffffep+128\n", // -nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.8p+128\n", // +nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.0002p+128\n", // +nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.0018p+128\n", // +nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.01ep+128\n", // +nan + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 0x1.fffffep+128\n", // +nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1p+1024\n", // -inf + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1p+1024\n", // +inf + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.8p+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.0fp+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.0000000000001p+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.00003p+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.fffffffffffffp+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.8p+1024\n", // +nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.0fp+1024\n", // +nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.0000000000001p+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.00003p+1024\n", // -nan + "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.fffffffffffffp+1024\n", // -nan + }),); +// clang-format on + +INSTANTIATE_TEST_CASE_P( + OpSpecConstantRoundTrip, RoundTripTest, + ::testing::ValuesIn(std::vector{ + // 16 bit + "%1 = OpTypeInt 16 0\n%2 = OpSpecConstant %1 0\n", + "%1 = OpTypeInt 16 0\n%2 = OpSpecConstant %1 65535\n", + "%1 = OpTypeInt 16 1\n%2 = OpSpecConstant %1 -32768\n", + "%1 = OpTypeInt 16 1\n%2 = OpSpecConstant %1 32767\n", + "%1 = OpTypeInt 32 0\n%2 = OpSpecConstant %1 0\n", + // 32 bit + std::string("%1 = OpTypeInt 32 0\n%2 = OpSpecConstant %1 0\n"), + std::string("%1 = OpTypeInt 32 0\n%2 = OpSpecConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 32 1\n%2 = OpSpecConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 32 1\n%2 = OpSpecConstant %1 ") + + std::to_string(std::numeric_limits::min()) + "\n", + // 48 bit + std::string("%1 = OpTypeInt 48 0\n%2 = OpSpecConstant %1 0\n"), + std::string("%1 = OpTypeInt 48 0\n%2 = OpSpecConstant %1 ") + + std::to_string(kMaxUnsigned48Bit) + "\n", + std::string("%1 = OpTypeInt 48 1\n%2 = OpSpecConstant %1 ") + + std::to_string(kMaxSigned48Bit) + "\n", + std::string("%1 = OpTypeInt 48 1\n%2 = OpSpecConstant %1 ") + + std::to_string(kMinSigned48Bit) + "\n", + // 64 bit + std::string("%1 = OpTypeInt 64 0\n%2 = OpSpecConstant %1 0\n"), + std::string("%1 = OpTypeInt 64 0\n%2 = OpSpecConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 64 1\n%2 = OpSpecConstant %1 ") + + std::to_string(std::numeric_limits::max()) + "\n", + std::string("%1 = OpTypeInt 64 1\n%2 = OpSpecConstant %1 ") + + std::to_string(std::numeric_limits::min()) + "\n", + // 32-bit float + "%1 = OpTypeFloat 32\n%2 = OpSpecConstant %1 0\n", + "%1 = OpTypeFloat 32\n%2 = OpSpecConstant %1 13.5\n", + "%1 = OpTypeFloat 32\n%2 = OpSpecConstant %1 -12.5\n", + // 64-bit float + "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 0\n", + "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 1.79767e+308\n", + "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 -1.79767e+308\n", + }), ); + +// Test OpSpecConstantOp + +using OpSpecConstantOpTestWithIds = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>>; + +// The operands to the OpSpecConstantOp opcode are all Ids. +TEST_P(OpSpecConstantOpTestWithIds, Assembly) { + std::stringstream input; + input << "%2 = OpSpecConstantOp %1 " << GetParam().name(); + for (auto id : GetParam().operands()) input << " %" << id; + input << "\n"; + + EXPECT_THAT(CompiledInstructions(input.str()), + Eq(MakeInstruction(SpvOpSpecConstantOp, + {1, 2, uint32_t(GetParam().value())}, + GetParam().operands()))); + + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input.str()), input.str()); +} + +// clang-format off +#define CASE1(NAME) { SpvOp##NAME, #NAME, {3} } +#define CASE2(NAME) { SpvOp##NAME, #NAME, {3, 4} } +#define CASE3(NAME) { SpvOp##NAME, #NAME, {3, 4, 5} } +#define CASE4(NAME) { SpvOp##NAME, #NAME, {3, 4, 5, 6} } +#define CASE5(NAME) { SpvOp##NAME, #NAME, {3, 4, 5, 6, 7} } +#define CASE6(NAME) { SpvOp##NAME, #NAME, {3, 4, 5, 6, 7, 8} } +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSpecConstantOp, OpSpecConstantOpTestWithIds, + ::testing::ValuesIn(std::vector>{ + // Conversion + CASE1(SConvert), + CASE1(FConvert), + CASE1(ConvertFToS), + CASE1(ConvertSToF), + CASE1(ConvertFToU), + CASE1(ConvertUToF), + CASE1(UConvert), + CASE1(ConvertPtrToU), + CASE1(ConvertUToPtr), + CASE1(GenericCastToPtr), + CASE1(PtrCastToGeneric), + CASE1(Bitcast), + CASE1(QuantizeToF16), + // Arithmetic + CASE1(SNegate), + CASE1(Not), + CASE2(IAdd), + CASE2(ISub), + CASE2(IMul), + CASE2(UDiv), + CASE2(SDiv), + CASE2(UMod), + CASE2(SRem), + CASE2(SMod), + CASE2(ShiftRightLogical), + CASE2(ShiftRightArithmetic), + CASE2(ShiftLeftLogical), + CASE2(BitwiseOr), + CASE2(BitwiseAnd), + CASE2(BitwiseXor), + CASE1(FNegate), + CASE2(FAdd), + CASE2(FSub), + CASE2(FMul), + CASE2(FDiv), + CASE2(FRem), + CASE2(FMod), + // Composite operations use literal numbers. So they're in another test. + // Logical + CASE2(LogicalOr), + CASE2(LogicalAnd), + CASE1(LogicalNot), + CASE2(LogicalEqual), + CASE2(LogicalNotEqual), + CASE3(Select), + // Comparison + CASE2(IEqual), + CASE2(INotEqual), // Allowed in 1.0 Rev 7 + CASE2(ULessThan), + CASE2(SLessThan), + CASE2(UGreaterThan), + CASE2(SGreaterThan), + CASE2(ULessThanEqual), + CASE2(SLessThanEqual), + CASE2(UGreaterThanEqual), + CASE2(SGreaterThanEqual), + // Memory + // For AccessChain, there is a base Id, then a sequence of index Ids. + // Having no index Ids is a corner case. + CASE1(AccessChain), + CASE2(AccessChain), + CASE6(AccessChain), + CASE1(InBoundsAccessChain), + CASE2(InBoundsAccessChain), + CASE6(InBoundsAccessChain), + // PtrAccessChain also has an element Id. + CASE2(PtrAccessChain), + CASE3(PtrAccessChain), + CASE6(PtrAccessChain), + CASE2(InBoundsPtrAccessChain), + CASE3(InBoundsPtrAccessChain), + CASE6(InBoundsPtrAccessChain), + }),); +#undef CASE1 +#undef CASE2 +#undef CASE3 +#undef CASE4 +#undef CASE5 +#undef CASE6 +// clang-format on + +using OpSpecConstantOpTestWithTwoIdsThenLiteralNumbers = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>>; + +// The operands to the OpSpecConstantOp opcode are two Ids followed by a +// sequence of literal numbers. +TEST_P(OpSpecConstantOpTestWithTwoIdsThenLiteralNumbers, Assembly) { + std::stringstream input; + input << "%2 = OpSpecConstantOp %1 " << GetParam().name() << " %3 %4"; + for (auto number : GetParam().operands()) input << " " << number; + input << "\n"; + + EXPECT_THAT(CompiledInstructions(input.str()), + Eq(MakeInstruction(SpvOpSpecConstantOp, + {1, 2, uint32_t(GetParam().value()), 3, 4}, + GetParam().operands()))); + + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input.str()), input.str()); +} + +#define CASE(NAME) SpvOp##NAME, #NAME +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSpecConstantOp, + OpSpecConstantOpTestWithTwoIdsThenLiteralNumbers, + ::testing::ValuesIn(std::vector>{ + // For VectorShuffle, there are two vector operands, and at least + // two selector Ids. OpenCL can have up to 16-element vectors. + {CASE(VectorShuffle), {0, 0}}, + {CASE(VectorShuffle), {4, 3, 2, 1}}, + {CASE(VectorShuffle), {0, 2, 4, 6, 1, 3, 5, 7}}, + {CASE(VectorShuffle), + {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}}, + // For CompositeInsert, there is an object to insert, the target + // composite, and then literal indices. + {CASE(CompositeInsert), {0}}, + {CASE(CompositeInsert), {4, 3, 99, 1}}, + }), ); + +using OpSpecConstantOpTestWithOneIdThenLiteralNumbers = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>>; + +// The operands to the OpSpecConstantOp opcode are one Id followed by a +// sequence of literal numbers. +TEST_P(OpSpecConstantOpTestWithOneIdThenLiteralNumbers, Assembly) { + std::stringstream input; + input << "%2 = OpSpecConstantOp %1 " << GetParam().name() << " %3"; + for (auto number : GetParam().operands()) input << " " << number; + input << "\n"; + + EXPECT_THAT(CompiledInstructions(input.str()), + Eq(MakeInstruction(SpvOpSpecConstantOp, + {1, 2, uint32_t(GetParam().value()), 3}, + GetParam().operands()))); + + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input.str()), input.str()); +} + +#define CASE(NAME) SpvOp##NAME, #NAME +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSpecConstantOp, + OpSpecConstantOpTestWithOneIdThenLiteralNumbers, + ::testing::ValuesIn(std::vector>{ + // For CompositeExtract, the universal limit permits up to 255 literal + // indices. Let's only test a few. + {CASE(CompositeExtract), {0}}, + {CASE(CompositeExtract), {0, 99, 42, 16, 17, 12, 19}}, + }), ); + +// TODO(dneto): OpConstantTrue +// TODO(dneto): OpConstantFalse +// TODO(dneto): OpConstantComposite +// TODO(dneto): OpConstantSampler: other variations Param is 0 or 1 +// TODO(dneto): OpConstantNull +// TODO(dneto): OpSpecConstantTrue +// TODO(dneto): OpSpecConstantFalse +// TODO(dneto): OpSpecConstantComposite +// TODO(dneto): Negative tests for OpSpecConstantOp + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp new file mode 100644 index 00000000000..07f1108840e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp @@ -0,0 +1,394 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Control Flow" section of the +// SPIR-V spec. + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using spvtest::TextToBinaryTest; +using ::testing::Combine; +using ::testing::Eq; +using ::testing::TestWithParam; +using ::testing::Values; +using ::testing::ValuesIn; + +// Test OpSelectionMerge + +using OpSelectionMergeTest = spvtest::TextToBinaryTestBase< + TestWithParam>>; + +TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) { + const std::string input = "OpSelectionMerge %1 " + GetParam().name(); + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSelectionMerge, {1, GetParam().value()}))); +} + +// clang-format off +#define CASE(VALUE,NAME) { SpvSelectionControl##VALUE, NAME} +INSTANTIATE_TEST_CASE_P(TextToBinarySelectionMerge, OpSelectionMergeTest, + ValuesIn(std::vector>{ + CASE(MaskNone, "None"), + CASE(FlattenMask, "Flatten"), + CASE(DontFlattenMask, "DontFlatten"), + }),); +#undef CASE +// clang-format on + +TEST_F(OpSelectionMergeTest, CombinedSelectionControlMask) { + const std::string input = "OpSelectionMerge %1 Flatten|DontFlatten"; + const uint32_t expected_mask = + SpvSelectionControlFlattenMask | SpvSelectionControlDontFlattenMask; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSelectionMerge, {1, expected_mask}))); +} + +TEST_F(OpSelectionMergeTest, WrongSelectionControl) { + // Case sensitive: "flatten" != "Flatten" and thus wrong. + EXPECT_THAT(CompileFailure("OpSelectionMerge %1 flatten|DontFlatten"), + Eq("Invalid selection control operand 'flatten|DontFlatten'.")); +} + +// Test OpLoopMerge + +using OpLoopMergeTest = spvtest::TextToBinaryTestBase< + TestWithParam>>>; + +TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) { + const auto ctrl = std::get<1>(GetParam()); + std::ostringstream input; + input << "OpLoopMerge %merge %continue " << ctrl.name(); + for (auto num : ctrl.operands()) input << " " << num; + EXPECT_THAT(CompiledInstructions(input.str(), std::get<0>(GetParam())), + Eq(MakeInstruction(SpvOpLoopMerge, {1, 2, ctrl.value()}, + ctrl.operands()))); +} + +#define CASE(VALUE, NAME) \ + { SpvLoopControl##VALUE, NAME } +#define CASE1(VALUE, NAME, PARM) \ + { \ + SpvLoopControl##VALUE, NAME, { PARM } \ + } +INSTANTIATE_TEST_CASE_P( + TextToBinaryLoopMerge, OpLoopMergeTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector>{ + // clang-format off + CASE(MaskNone, "None"), + CASE(UnrollMask, "Unroll"), + CASE(DontUnrollMask, "DontUnroll"), + // clang-format on + })), ); + +INSTANTIATE_TEST_CASE_P( + TextToBinaryLoopMergeV11, OpLoopMergeTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector>{ + // clang-format off + CASE(DependencyInfiniteMask, "DependencyInfinite"), + CASE1(DependencyLengthMask, "DependencyLength", 234), + {SpvLoopControlUnrollMask|SpvLoopControlDependencyLengthMask, + "DependencyLength|Unroll", {33}}, + // clang-format on + })), ); +#undef CASE +#undef CASE1 + +TEST_F(OpLoopMergeTest, CombinedLoopControlMask) { + const std::string input = "OpLoopMerge %merge %continue Unroll|DontUnroll"; + const uint32_t expected_mask = + SpvLoopControlUnrollMask | SpvLoopControlDontUnrollMask; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpLoopMerge, {1, 2, expected_mask}))); +} + +TEST_F(OpLoopMergeTest, WrongLoopControl) { + EXPECT_THAT(CompileFailure("OpLoopMerge %m %c none"), + Eq("Invalid loop control operand 'none'.")); +} + +// Test OpSwitch + +TEST_F(TextToBinaryTest, SwitchGoodZeroTargets) { + EXPECT_THAT(CompiledInstructions("OpSwitch %selector %default"), + Eq(MakeInstruction(SpvOpSwitch, {1, 2}))); +} + +TEST_F(TextToBinaryTest, SwitchGoodOneTarget) { + EXPECT_THAT(CompiledInstructions("%1 = OpTypeInt 32 0\n" + "%2 = OpConstant %1 52\n" + "OpSwitch %2 %default 12 %target0"), + Eq(Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 52}), + MakeInstruction(SpvOpSwitch, {2, 3, 12, 4})}))); +} + +TEST_F(TextToBinaryTest, SwitchGoodTwoTargets) { + EXPECT_THAT( + CompiledInstructions("%1 = OpTypeInt 32 0\n" + "%2 = OpConstant %1 52\n" + "OpSwitch %2 %default 12 %target0 42 %target1"), + Eq(Concatenate({ + MakeInstruction(SpvOpTypeInt, {1, 32, 0}), + MakeInstruction(SpvOpConstant, {1, 2, 52}), + MakeInstruction(SpvOpSwitch, {2, 3, 12, 4, 42, 5}), + }))); +} + +TEST_F(TextToBinaryTest, SwitchBadMissingSelector) { + EXPECT_THAT(CompileFailure("OpSwitch"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(TextToBinaryTest, SwitchBadInvalidSelector) { + EXPECT_THAT(CompileFailure("OpSwitch 12"), + Eq("Expected id to start with %.")); +} + +TEST_F(TextToBinaryTest, SwitchBadMissingDefault) { + EXPECT_THAT(CompileFailure("OpSwitch %selector"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(TextToBinaryTest, SwitchBadInvalidDefault) { + EXPECT_THAT(CompileFailure("OpSwitch %selector 12"), + Eq("Expected id to start with %.")); +} + +TEST_F(TextToBinaryTest, SwitchBadInvalidLiteral) { + // The assembler recognizes "OpSwitch %selector %default" as a complete + // instruction. Then it tries to parse "%abc" as the start of a new + // instruction, but can't since it hits the end of stream. + const auto input = R"(%i32 = OpTypeInt 32 0 + %selector = OpConstant %i32 42 + OpSwitch %selector %default %abc)"; + EXPECT_THAT(CompileFailure(input), Eq("Expected '=', found end of stream.")); +} + +TEST_F(TextToBinaryTest, SwitchBadMissingTarget) { + EXPECT_THAT(CompileFailure("%1 = OpTypeInt 32 0\n" + "%2 = OpConstant %1 52\n" + "OpSwitch %2 %default 12"), + Eq("Expected operand, found end of stream.")); +} + +// A test case for an OpSwitch. +// It is also parameterized to test encodings OpConstant +// integer literals. This can capture both single and multi-word +// integer literal tests. +struct SwitchTestCase { + std::string constant_type_args; + std::string constant_value_arg; + std::string case_value_arg; + std::vector expected_instructions; +}; + +using OpSwitchValidTest = + spvtest::TextToBinaryTestBase>; + +// Tests the encoding of OpConstant literal values, and also +// the literal integer cases in an OpSwitch. This can +// test both single and multi-word integer literal encodings. +TEST_P(OpSwitchValidTest, ValidTypes) { + const std::string input = "%1 = OpTypeInt " + GetParam().constant_type_args + + "\n" + "%2 = OpConstant %1 " + + GetParam().constant_value_arg + + "\n" + "OpSwitch %2 %default " + + GetParam().case_value_arg + " %4\n"; + std::vector instructions; + EXPECT_THAT(CompiledInstructions(input), + Eq(GetParam().expected_instructions)); +} + +// Constructs a SwitchTestCase from the given integer_width, signedness, +// constant value string, and expected encoded constant. +SwitchTestCase MakeSwitchTestCase(uint32_t integer_width, + uint32_t integer_signedness, + std::string constant_str, + std::vector encoded_constant, + std::string case_value_str, + std::vector encoded_case_value) { + std::stringstream ss; + ss << integer_width << " " << integer_signedness; + return SwitchTestCase{ + ss.str(), + constant_str, + case_value_str, + {Concatenate( + {MakeInstruction(SpvOpTypeInt, + {1, integer_width, integer_signedness}), + MakeInstruction(SpvOpConstant, + Concatenate({{1, 2}, encoded_constant})), + MakeInstruction(SpvOpSwitch, + Concatenate({{2, 3}, encoded_case_value, {4}}))})}}; +} + +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSwitchValid1Word, OpSwitchValidTest, + ValuesIn(std::vector({ + MakeSwitchTestCase(32, 0, "42", {42}, "100", {100}), + MakeSwitchTestCase(32, 1, "-1", {0xffffffff}, "100", {100}), + // SPIR-V 1.0 Rev 1 clarified that for an integer narrower than 32-bits, + // its bits will appear in the lower order bits of the 32-bit word, and + // a signed integer is sign-extended. + MakeSwitchTestCase(7, 0, "127", {127}, "100", {100}), + MakeSwitchTestCase(14, 0, "99", {99}, "100", {100}), + MakeSwitchTestCase(16, 0, "65535", {65535}, "100", {100}), + MakeSwitchTestCase(16, 1, "101", {101}, "100", {100}), + // Demonstrate sign extension + MakeSwitchTestCase(16, 1, "-2", {0xfffffffe}, "100", {100}), + // Hex cases + MakeSwitchTestCase(16, 1, "0x7ffe", {0x7ffe}, "0x1234", {0x1234}), + MakeSwitchTestCase(16, 1, "0x8000", {0xffff8000}, "0x8100", + {0xffff8100}), + MakeSwitchTestCase(16, 0, "0x8000", {0x00008000}, "0x8100", {0x8100}), + })), ); + +// NB: The words LOW ORDER bits show up first. +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSwitchValid2Words, OpSwitchValidTest, + ValuesIn(std::vector({ + MakeSwitchTestCase(33, 0, "101", {101, 0}, "500", {500, 0}), + MakeSwitchTestCase(48, 1, "-1", {0xffffffff, 0xffffffff}, "900", + {900, 0}), + MakeSwitchTestCase(64, 1, "-2", {0xfffffffe, 0xffffffff}, "-5", + {0xfffffffb, uint32_t(-1)}), + // Hex cases + MakeSwitchTestCase(48, 1, "0x7fffffffffff", {0xffffffff, 0x00007fff}, + "100", {100, 0}), + MakeSwitchTestCase(48, 1, "0x800000000000", {0x00000000, 0xffff8000}, + "0x800000000000", {0x00000000, 0xffff8000}), + MakeSwitchTestCase(48, 0, "0x800000000000", {0x00000000, 0x00008000}, + "0x800000000000", {0x00000000, 0x00008000}), + MakeSwitchTestCase(63, 0, "0x500000000", {0, 5}, "12", {12, 0}), + MakeSwitchTestCase(64, 0, "0x600000000", {0, 6}, "12", {12, 0}), + MakeSwitchTestCase(64, 1, "0x700000123", {0x123, 7}, "12", {12, 0}), + })), ); + +INSTANTIATE_TEST_CASE_P( + OpSwitchRoundTripUnsignedIntegers, RoundTripTest, + ValuesIn(std::vector({ + // Unsigned 16-bit. + "%1 = OpTypeInt 16 0\n%2 = OpConstant %1 65535\nOpSwitch %2 %3\n", + // Unsigned 32-bit, three non-default cases. + "%1 = OpTypeInt 32 0\n%2 = OpConstant %1 123456\n" + "OpSwitch %2 %3 100 %4 102 %5 1000000 %6\n", + // Unsigned 48-bit, three non-default cases. + "%1 = OpTypeInt 48 0\n%2 = OpConstant %1 5000000000\n" + "OpSwitch %2 %3 100 %4 102 %5 6000000000 %6\n", + // Unsigned 64-bit, three non-default cases. + "%1 = OpTypeInt 64 0\n%2 = OpConstant %1 9223372036854775807\n" + "OpSwitch %2 %3 100 %4 102 %5 9000000000000000000 %6\n", + })), ); + +INSTANTIATE_TEST_CASE_P( + OpSwitchRoundTripSignedIntegers, RoundTripTest, + ValuesIn(std::vector{ + // Signed 16-bit, with two non-default cases + "%1 = OpTypeInt 16 1\n%2 = OpConstant %1 32767\n" + "OpSwitch %2 %3 99 %4 -102 %5\n", + "%1 = OpTypeInt 16 1\n%2 = OpConstant %1 -32768\n" + "OpSwitch %2 %3 99 %4 -102 %5\n", + // Signed 32-bit, two non-default cases. + "%1 = OpTypeInt 32 1\n%2 = OpConstant %1 -123456\n" + "OpSwitch %2 %3 100 %4 -123456 %5\n", + "%1 = OpTypeInt 32 1\n%2 = OpConstant %1 123456\n" + "OpSwitch %2 %3 100 %4 123456 %5\n", + // Signed 48-bit, three non-default cases. + "%1 = OpTypeInt 48 1\n%2 = OpConstant %1 5000000000\n" + "OpSwitch %2 %3 100 %4 -7000000000 %5 6000000000 %6\n", + "%1 = OpTypeInt 48 1\n%2 = OpConstant %1 -5000000000\n" + "OpSwitch %2 %3 100 %4 -7000000000 %5 6000000000 %6\n", + // Signed 64-bit, three non-default cases. + "%1 = OpTypeInt 64 1\n%2 = OpConstant %1 9223372036854775807\n" + "OpSwitch %2 %3 100 %4 7000000000 %5 -1000000000000000000 %6\n", + "%1 = OpTypeInt 64 1\n%2 = OpConstant %1 -9223372036854775808\n" + "OpSwitch %2 %3 100 %4 7000000000 %5 -1000000000000000000 %6\n", + }), ); + +using OpSwitchInvalidTypeTestCase = + spvtest::TextToBinaryTestBase>; + +TEST_P(OpSwitchInvalidTypeTestCase, InvalidTypes) { + const std::string input = + "%1 = " + GetParam() + + "\n" + "%3 = OpCopyObject %1 %2\n" // We only care the type of the expression + "%4 = OpSwitch %3 %default 32 %c\n"; + EXPECT_THAT(CompileFailure(input), + Eq("The selector operand for OpSwitch must be the result of an " + "instruction that generates an integer scalar")); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + TextToBinaryOpSwitchInvalidTests, OpSwitchInvalidTypeTestCase, + ValuesIn(std::vector{ + {"OpTypeVoid", + "OpTypeBool", + "OpTypeFloat 32", + "OpTypeVector %a 32", + "OpTypeMatrix %a 32", + "OpTypeImage %a 1D 0 0 0 0 Unknown", + "OpTypeSampler", + "OpTypeSampledImage %a", + "OpTypeArray %a %b", + "OpTypeRuntimeArray %a", + "OpTypeStruct %a", + "OpTypeOpaque \"Foo\"", + "OpTypePointer UniformConstant %a", + "OpTypeFunction %a %b", + "OpTypeEvent", + "OpTypeDeviceEvent", + "OpTypeReserveId", + "OpTypeQueue", + "OpTypePipe ReadOnly", + "OpTypeForwardPointer %a UniformConstant", + // At least one thing that isn't a type at all + "OpNot %a %b" + }, + }),); +// clang-format on + +// TODO(dneto): OpPhi +// TODO(dneto): OpLoopMerge +// TODO(dneto): OpLabel +// TODO(dneto): OpBranch +// TODO(dneto): OpSwitch +// TODO(dneto): OpKill +// TODO(dneto): OpReturn +// TODO(dneto): OpReturnValue +// TODO(dneto): OpUnreachable +// TODO(dneto): OpLifetimeStart +// TODO(dneto): OpLifetimeStop + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp new file mode 100644 index 00000000000..b85650e5eca --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp @@ -0,0 +1,214 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Debug" section of the +// SPIR-V spec. + +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using spvtest::TextToBinaryTest; +using ::testing::Eq; + +// Test OpSource + +// A single test case for OpSource +struct LanguageCase { + uint32_t get_language_value() const { + return static_cast(language_value); + } + const char* language_name; + SpvSourceLanguage language_value; + uint32_t version; +}; + +// clang-format off +// The list of OpSource cases to use. +const LanguageCase kLanguageCases[] = { +#define CASE(NAME, VERSION) \ + { #NAME, SpvSourceLanguage##NAME, VERSION } + CASE(Unknown, 0), + CASE(Unknown, 999), + CASE(ESSL, 310), + CASE(GLSL, 450), + CASE(OpenCL_C, 120), + CASE(OpenCL_C, 200), + CASE(OpenCL_C, 210), + CASE(OpenCL_CPP, 210), + CASE(HLSL, 5), + CASE(HLSL, 6), +#undef CASE +}; +// clang-format on + +using OpSourceTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpSourceTest, AnyLanguage) { + const std::string input = std::string("OpSource ") + + GetParam().language_name + " " + + std::to_string(GetParam().version); + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSource, {GetParam().get_language_value(), + GetParam().version}))); +} + +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceTest, + ::testing::ValuesIn(kLanguageCases), ); + +TEST_F(OpSourceTest, WrongLanguage) { + EXPECT_THAT(CompileFailure("OpSource xxyyzz 12345"), + Eq("Invalid source language 'xxyyzz'.")); +} + +TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalFileId) { + // In the grammar, the file id is an OperandOptionalId. + const std::string input = "OpSource GLSL 450 %file_id"; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSource, {SpvSourceLanguageGLSL, 450, 1}))); +} + +TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) { + std::string fake_source = "To be or not to be"; + const std::string input = + "OpSource GLSL 450 %file_id \"" + fake_source + "\""; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSource, {SpvSourceLanguageGLSL, 450, 1}, + MakeVector(fake_source)))); +} + +// Test OpSourceContinued + +using OpSourceContinuedTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpSourceContinuedTest, AnyExtension) { + // TODO(dneto): utf-8, quoting, escaping + const std::string input = + std::string("OpSourceContinued \"") + GetParam() + "\""; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSourceContinued, MakeVector(GetParam())))); +} + +// TODO(dneto): utf-8, quoting, escaping +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceContinuedTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"}), ); + +// Test OpSourceExtension + +using OpSourceExtensionTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpSourceExtensionTest, AnyExtension) { + // TODO(dneto): utf-8, quoting, escaping + const std::string input = + std::string("OpSourceExtension \"") + GetParam() + "\""; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpSourceExtension, MakeVector(GetParam())))); +} + +// TODO(dneto): utf-8, quoting, escaping +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceExtensionTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"}), ); + +TEST_F(TextToBinaryTest, OpLine) { + EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"), + Eq(MakeInstruction(SpvOpLine, {1, 42, 99}))); +} + +TEST_F(TextToBinaryTest, OpNoLine) { + EXPECT_THAT(CompiledInstructions("OpNoLine"), + Eq(MakeInstruction(SpvOpNoLine, {}))); +} + +using OpStringTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpStringTest, AnyString) { + // TODO(dneto): utf-8, quoting, escaping + const std::string input = + std::string("%result = OpString \"") + GetParam() + "\""; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpString, {1}, MakeVector(GetParam())))); +} + +// TODO(dneto): utf-8, quoting, escaping +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpStringTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"}), ); + +using OpNameTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpNameTest, AnyString) { + const std::string input = + std::string("OpName %target \"") + GetParam() + "\""; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpName, {1}, MakeVector(GetParam())))); +} + +// UTF-8, quoting, escaping, etc. are covered in the StringLiterals tests in +// BinaryToText.Literal.cpp. +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpNameTest, + ::testing::Values("", "foo bar this and that"), ); + +using OpMemberNameTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpMemberNameTest, AnyString) { + // TODO(dneto): utf-8, quoting, escaping + const std::string input = + std::string("OpMemberName %type 42 \"") + GetParam() + "\""; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpMemberName, {1, 42}, MakeVector(GetParam())))); +} + +// TODO(dneto): utf-8, quoting, escaping +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpMemberNameTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"}), ); + +// TODO(dneto): Parse failures? + +using OpModuleProcessedTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpModuleProcessedTest, AnyString) { + const std::string input = + std::string("OpModuleProcessed \"") + GetParam() + "\""; + EXPECT_THAT( + CompiledInstructions(input, SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpModuleProcessed, MakeVector(GetParam())))); +} + +INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpModuleProcessedTest, + ::testing::Values("", "foo bar this and that"), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp new file mode 100644 index 00000000000..25c100b8efb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp @@ -0,0 +1,112 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Device-Side Enqueue Instructions" +// section of the SPIR-V spec. + +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::MakeInstruction; +using ::testing::Eq; + +// Test OpEnqueueKernel + +struct KernelEnqueueCase { + std::string local_size_source; + std::vector local_size_operands; +}; + +using OpEnqueueKernelGood = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(OpEnqueueKernelGood, Sample) { + const std::string input = + "%result = OpEnqueueKernel %type %queue %flags %NDRange %num_events" + " %wait_events %ret_event %invoke %param %param_size %param_align " + + GetParam().local_size_source; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpEnqueueKernel, + {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, + GetParam().local_size_operands))); +} + +INSTANTIATE_TEST_CASE_P( + TextToBinaryTest, OpEnqueueKernelGood, + ::testing::ValuesIn(std::vector{ + // Provide IDs for pointer-to-local arguments for the + // invoked function. + // Test up to 10 such arguments. + // I (dneto) can't find a limit on the number of kernel + // arguments in OpenCL C 2.0 Rev 29, e.g. in section 6.9 + // Restrictions. + {"", {}}, + {"%l0", {13}}, + {"%l0 %l1", {13, 14}}, + {"%l0 %l1 %l2", {13, 14, 15}}, + {"%l0 %l1 %l2 %l3", {13, 14, 15, 16}}, + {"%l0 %l1 %l2 %l3 %l4", {13, 14, 15, 16, 17}}, + {"%l0 %l1 %l2 %l3 %l4 %l5", {13, 14, 15, 16, 17, 18}}, + {"%l0 %l1 %l2 %l3 %l4 %l5 %l6", {13, 14, 15, 16, 17, 18, 19}}, + {"%l0 %l1 %l2 %l3 %l4 %l5 %l6 %l7", {13, 14, 15, 16, 17, 18, 19, 20}}, + {"%l0 %l1 %l2 %l3 %l4 %l5 %l6 %l7 %l8", + {13, 14, 15, 16, 17, 18, 19, 20, 21}}, + {"%l0 %l1 %l2 %l3 %l4 %l5 %l6 %l7 %l8 %l9", + {13, 14, 15, 16, 17, 18, 19, 20, 21, 22}}, + }), ); + +// Test some bad parses of OpEnqueueKernel. For other cases, we're relying +// on the uniformity of the parsing algorithm. The following two tests, ensure +// that every required ID operand is specified, and is actually an ID operand. +using OpKernelEnqueueBad = spvtest::TextToBinaryTest; + +TEST_F(OpKernelEnqueueBad, MissingLastOperand) { + EXPECT_THAT( + CompileFailure( + "%result = OpEnqueueKernel %type %queue %flags %NDRange %num_events" + " %wait_events %ret_event %invoke %param %param_size"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpKernelEnqueueBad, InvalidLastOperand) { + EXPECT_THAT( + CompileFailure( + "%result = OpEnqueueKernel %type %queue %flags %NDRange %num_events" + " %wait_events %ret_event %invoke %param %param_size 42"), + Eq("Expected id to start with %.")); +} + +// TODO(dneto): OpEnqueueMarker +// TODO(dneto): OpGetKernelNDRangeSubGroupCount +// TODO(dneto): OpGetKernelNDRangeMaxSubGroupSize +// TODO(dneto): OpGetKernelWorkGroupSize +// TODO(dneto): OpGetKernelPreferredWorkGroupSizeMultiple +// TODO(dneto): OpRetainEvent +// TODO(dneto): OpReleaseEvent +// TODO(dneto): OpCreateUserEvent +// TODO(dneto): OpSetUserEventStatus +// TODO(dneto): OpCaptureEventProfilingInfo +// TODO(dneto): OpGetDefaultQueue +// TODO(dneto): OpBuildNDRange +// TODO(dneto): OpBuildNDRange + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp new file mode 100644 index 00000000000..0d8d324b890 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp @@ -0,0 +1,713 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Extension Instruction" section +// of the SPIR-V spec. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/latest_version_glsl_std_450_header.h" +#include "source/latest_version_opencl_std_header.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using spvtest::TextToBinaryTest; +using ::testing::Combine; +using ::testing::Eq; +using ::testing::Values; +using ::testing::ValuesIn; + +// Returns a generator of common Vulkan environment values to be tested. +std::vector CommonVulkanEnvs() { + return {SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2, + SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1}; +} + +TEST_F(TextToBinaryTest, InvalidExtInstImportName) { + EXPECT_THAT(CompileFailure("%1 = OpExtInstImport \"Haskell.std\""), + Eq("Invalid extended instruction import 'Haskell.std'")); +} + +TEST_F(TextToBinaryTest, InvalidImportId) { + EXPECT_THAT(CompileFailure("%1 = OpTypeVoid\n" + "%2 = OpExtInst %1 %1"), + Eq("Invalid extended instruction import Id 2")); +} + +TEST_F(TextToBinaryTest, InvalidImportInstruction) { + const std::string input = R"(%1 = OpTypeVoid + %2 = OpExtInstImport "OpenCL.std" + %3 = OpExtInst %1 %2 not_in_the_opencl)"; + EXPECT_THAT(CompileFailure(input), + Eq("Invalid extended instruction name 'not_in_the_opencl'.")); +} + +TEST_F(TextToBinaryTest, MultiImport) { + const std::string input = R"(%2 = OpExtInstImport "OpenCL.std" + %2 = OpExtInstImport "OpenCL.std")"; + EXPECT_THAT(CompileFailure(input), + Eq("Import Id is being defined a second time")); +} + +TEST_F(TextToBinaryTest, TooManyArguments) { + const std::string input = R"(%opencl = OpExtInstImport "OpenCL.std" + %2 = OpExtInst %float %opencl cos %x %oops")"; + EXPECT_THAT(CompileFailure(input), Eq("Expected '=', found end of stream.")); +} + +TEST_F(TextToBinaryTest, ExtInstFromTwoDifferentImports) { + const std::string input = R"(%1 = OpExtInstImport "OpenCL.std" +%2 = OpExtInstImport "GLSL.std.450" +%4 = OpExtInst %3 %1 native_sqrt %5 +%7 = OpExtInst %6 %2 MatrixInverse %8 +)"; + + // Make sure it assembles correctly. + EXPECT_THAT( + CompiledInstructions(input), + Eq(Concatenate({ + MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("OpenCL.std")), + MakeInstruction(SpvOpExtInstImport, {2}, MakeVector("GLSL.std.450")), + MakeInstruction( + SpvOpExtInst, + {3, 4, 1, uint32_t(OpenCLLIB::Entrypoints::Native_sqrt), 5}), + MakeInstruction(SpvOpExtInst, + {6, 7, 2, uint32_t(GLSLstd450MatrixInverse), 8}), + }))); + + // Make sure it disassembles correctly. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input)); +} + +// A test case for assembling into words in an instruction. +struct AssemblyCase { + std::string input; + std::vector expected; +}; + +using ExtensionAssemblyTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(ExtensionAssemblyTest, Samples) { + const spv_target_env& env = std::get<0>(GetParam()); + const AssemblyCase& ac = std::get<1>(GetParam()); + + // Check that it assembles correctly. + EXPECT_THAT(CompiledInstructions(ac.input, env), Eq(ac.expected)); +} + +using ExtensionRoundTripTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(ExtensionRoundTripTest, Samples) { + const spv_target_env& env = std::get<0>(GetParam()); + const AssemblyCase& ac = std::get<1>(GetParam()); + + // Check that it assembles correctly. + EXPECT_THAT(CompiledInstructions(ac.input, env), Eq(ac.expected)); + + // Check round trip through the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(ac.input, + SPV_BINARY_TO_TEXT_OPTION_NONE, env), + Eq(ac.input)) + << "target env: " << spvTargetEnvDescription(env) << "\n"; +} + +// SPV_KHR_shader_ballot + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_shader_ballot, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {"OpCapability SubgroupBallotKHR\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilitySubgroupBallotKHR})}, + {"%2 = OpSubgroupBallotKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupBallotKHR, {1, 2, 3})}, + {"%2 = OpSubgroupFirstInvocationKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupFirstInvocationKHR, {1, 2, 3})}, + {"OpDecorate %1 BuiltIn SubgroupEqMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupEqMaskKHR})}, + {"OpDecorate %1 BuiltIn SubgroupGeMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupGeMaskKHR})}, + {"OpDecorate %1 BuiltIn SubgroupGtMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupGtMaskKHR})}, + {"OpDecorate %1 BuiltIn SubgroupLeMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupLeMaskKHR})}, + {"OpDecorate %1 BuiltIn SubgroupLtMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupLtMaskKHR})}, + })), ); + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_shader_ballot_vulkan_1_1, ExtensionRoundTripTest, + // In SPIR-V 1.3 and Vulkan 1.1 we can drop the KHR suffix on the + // builtin enums. + Combine(Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1), + ValuesIn(std::vector{ + {"OpCapability SubgroupBallotKHR\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilitySubgroupBallotKHR})}, + {"%2 = OpSubgroupBallotKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupBallotKHR, {1, 2, 3})}, + {"%2 = OpSubgroupFirstInvocationKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupFirstInvocationKHR, {1, 2, 3})}, + {"OpDecorate %1 BuiltIn SubgroupEqMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupEqMask})}, + {"OpDecorate %1 BuiltIn SubgroupGeMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupGeMask})}, + {"OpDecorate %1 BuiltIn SubgroupGtMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupGtMask})}, + {"OpDecorate %1 BuiltIn SubgroupLeMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupLeMask})}, + {"OpDecorate %1 BuiltIn SubgroupLtMask\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupLtMask})}, + })), ); + +// The old builtin names (with KHR suffix) still work in the assmebler, and +// map to the enums without the KHR. +INSTANTIATE_TEST_CASE_P( + SPV_KHR_shader_ballot_vulkan_1_1_alias_check, ExtensionAssemblyTest, + // In SPIR-V 1.3 and Vulkan 1.1 we can drop the KHR suffix on the + // builtin enums. + Combine(Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1), + ValuesIn(std::vector{ + {"OpDecorate %1 BuiltIn SubgroupEqMaskKHR\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupEqMask})}, + {"OpDecorate %1 BuiltIn SubgroupGeMaskKHR\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupGeMask})}, + {"OpDecorate %1 BuiltIn SubgroupGtMaskKHR\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupGtMask})}, + {"OpDecorate %1 BuiltIn SubgroupLeMaskKHR\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupLeMask})}, + {"OpDecorate %1 BuiltIn SubgroupLtMaskKHR\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInSubgroupLtMask})}, + })), ); + +// SPV_KHR_shader_draw_parameters + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_shader_draw_parameters, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine( + ValuesIn(CommonVulkanEnvs()), + ValuesIn(std::vector{ + {"OpCapability DrawParameters\n", + MakeInstruction(SpvOpCapability, {SpvCapabilityDrawParameters})}, + {"OpDecorate %1 BuiltIn BaseVertex\n", + MakeInstruction(SpvOpDecorate, + {1, SpvDecorationBuiltIn, SpvBuiltInBaseVertex})}, + {"OpDecorate %1 BuiltIn BaseInstance\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInBaseInstance})}, + {"OpDecorate %1 BuiltIn DrawIndex\n", + MakeInstruction(SpvOpDecorate, + {1, SpvDecorationBuiltIn, SpvBuiltInDrawIndex})}, + })), ); + +// SPV_KHR_subgroup_vote + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_subgroup_vote, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(ValuesIn(CommonVulkanEnvs()), + ValuesIn(std::vector{ + {"OpCapability SubgroupVoteKHR\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilitySubgroupVoteKHR})}, + {"%2 = OpSubgroupAnyKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupAnyKHR, {1, 2, 3})}, + {"%2 = OpSubgroupAllKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupAllKHR, {1, 2, 3})}, + {"%2 = OpSubgroupAllEqualKHR %1 %3\n", + MakeInstruction(SpvOpSubgroupAllEqualKHR, {1, 2, 3})}, + })), ); + +// SPV_KHR_16bit_storage + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_16bit_storage, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(ValuesIn(CommonVulkanEnvs()), + ValuesIn(std::vector{ + {"OpCapability StorageBuffer16BitAccess\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageUniformBufferBlock16})}, + {"OpCapability StorageBuffer16BitAccess\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageBuffer16BitAccess})}, + {"OpCapability StorageUniform16\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityUniformAndStorageBuffer16BitAccess})}, + {"OpCapability StorageUniform16\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageUniform16})}, + {"OpCapability StoragePushConstant16\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStoragePushConstant16})}, + {"OpCapability StorageInputOutput16\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageInputOutput16})}, + })), ); + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_16bit_storage_alias_check, ExtensionAssemblyTest, + Combine(ValuesIn(CommonVulkanEnvs()), + ValuesIn(std::vector{ + // The old name maps to the new enum. + {"OpCapability StorageUniformBufferBlock16\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageBuffer16BitAccess})}, + // The new name maps to the old enum. + {"OpCapability UniformAndStorageBuffer16BitAccess\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageUniform16})}, + })), ); + +// SPV_KHR_device_group + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_device_group, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(ValuesIn(CommonVulkanEnvs()), + ValuesIn(std::vector{ + {"OpCapability DeviceGroup\n", + MakeInstruction(SpvOpCapability, {SpvCapabilityDeviceGroup})}, + {"OpDecorate %1 BuiltIn DeviceIndex\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInDeviceIndex})}, + })), ); + +// SPV_KHR_8bit_storage + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_8bit_storage, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine( + ValuesIn(CommonVulkanEnvs()), + ValuesIn(std::vector{ + {"OpCapability StorageBuffer8BitAccess\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStorageBuffer8BitAccess})}, + {"OpCapability UniformAndStorageBuffer8BitAccess\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityUniformAndStorageBuffer8BitAccess})}, + {"OpCapability StoragePushConstant8\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityStoragePushConstant8})}, + })), ); + +// SPV_KHR_multiview + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_multiview, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {"OpCapability MultiView\n", + MakeInstruction(SpvOpCapability, {SpvCapabilityMultiView})}, + {"OpDecorate %1 BuiltIn ViewIndex\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInViewIndex})}, + })), ); + +// SPV_AMD_shader_explicit_vertex_parameter + +#define PREAMBLE \ + "%1 = OpExtInstImport \"SPV_AMD_shader_explicit_vertex_parameter\"\n" +INSTANTIATE_TEST_CASE_P( + SPV_AMD_shader_explicit_vertex_parameter, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {PREAMBLE "%3 = OpExtInst %2 %1 InterpolateAtVertexAMD %4 %5\n", + Concatenate( + {MakeInstruction( + SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_explicit_vertex_parameter")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5})})}, + })), ); +#undef PREAMBLE + +// SPV_AMD_shader_trinary_minmax + +#define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_shader_trinary_minmax\"\n" +INSTANTIATE_TEST_CASE_P( + SPV_AMD_shader_trinary_minmax, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {PREAMBLE "%3 = OpExtInst %2 %1 FMin3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 UMin3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 2, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 SMin3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 3, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 FMax3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 4, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 UMax3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 5, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 SMax3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 6, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 FMid3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 7, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 UMid3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 8, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 SMid3AMD %4 %5 %6\n", + Concatenate( + {MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_trinary_minmax")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 9, 4, 5, 6})})}, + })), ); +#undef PREAMBLE + +// SPV_AMD_gcn_shader + +#define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_gcn_shader\"\n" +INSTANTIATE_TEST_CASE_P( + SPV_AMD_gcn_shader, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {PREAMBLE "%3 = OpExtInst %2 %1 CubeFaceIndexAMD %4\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_gcn_shader")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 CubeFaceCoordAMD %4\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_gcn_shader")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 2, 4})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 TimeAMD\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_gcn_shader")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 3})})}, + })), ); +#undef PREAMBLE + +// SPV_AMD_shader_ballot + +#define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_shader_ballot\"\n" +INSTANTIATE_TEST_CASE_P( + SPV_AMD_shader_ballot, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {PREAMBLE "%3 = OpExtInst %2 %1 SwizzleInvocationsAMD %4 %5\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_ballot")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5})})}, + {PREAMBLE + "%3 = OpExtInst %2 %1 SwizzleInvocationsMaskedAMD %4 %5\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_ballot")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 2, 4, 5})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 WriteInvocationAMD %4 %5 %6\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_ballot")), + MakeInstruction(SpvOpExtInst, + {2, 3, 1, 3, 4, 5, 6})})}, + {PREAMBLE "%3 = OpExtInst %2 %1 MbcntAMD %4\n", + Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, + MakeVector("SPV_AMD_shader_ballot")), + MakeInstruction(SpvOpExtInst, {2, 3, 1, 4, 4})})}, + })), ); +#undef PREAMBLE + +// SPV_KHR_variable_pointers + +INSTANTIATE_TEST_CASE_P( + SPV_KHR_variable_pointers, ExtensionRoundTripTest, + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {"OpCapability VariablePointers\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityVariablePointers})}, + {"OpCapability VariablePointersStorageBuffer\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityVariablePointersStorageBuffer})}, + })), ); + +// SPV_GOOGLE_decorate_string + +INSTANTIATE_TEST_CASE_P( + SPV_GOOGLE_decorate_string, ExtensionRoundTripTest, + Combine( + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0), + ValuesIn(std::vector{ + {"OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE \"ABC\"\n", + MakeInstruction(SpvOpDecorateStringGOOGLE, + {1, SpvDecorationHlslSemanticGOOGLE}, + MakeVector("ABC"))}, + {"OpMemberDecorateStringGOOGLE %1 3 HlslSemanticGOOGLE \"DEF\"\n", + MakeInstruction(SpvOpMemberDecorateStringGOOGLE, + {1, 3, SpvDecorationHlslSemanticGOOGLE}, + MakeVector("DEF"))}, + })), ); + +// SPV_GOOGLE_hlsl_functionality1 + +INSTANTIATE_TEST_CASE_P( + SPV_GOOGLE_hlsl_functionality1, ExtensionRoundTripTest, + Combine( + // We'll get coverage over operand tables by trying the universal + // environments, and at least one specific environment. + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0), + // HlslSemanticGOOGLE is tested in SPV_GOOGLE_decorate_string, since + // they are coupled together. + ValuesIn(std::vector{ + {"OpDecorateId %1 HlslCounterBufferGOOGLE %2\n", + MakeInstruction(SpvOpDecorateId, + {1, SpvDecorationHlslCounterBufferGOOGLE, 2})}, + })), ); + +// SPV_NV_viewport_array2 + +INSTANTIATE_TEST_CASE_P( + SPV_NV_viewport_array2, ExtensionRoundTripTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3, + SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1), + ValuesIn(std::vector{ + {"OpExtension \"SPV_NV_viewport_array2\"\n", + MakeInstruction(SpvOpExtension, + MakeVector("SPV_NV_viewport_array2"))}, + // The EXT and NV extensions have the same token number for this + // capability. + {"OpCapability ShaderViewportIndexLayerEXT\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityShaderViewportIndexLayerNV})}, + // Check the new capability's token number + {"OpCapability ShaderViewportIndexLayerEXT\n", + MakeInstruction(SpvOpCapability, {5254})}, + // Decorations + {"OpDecorate %1 ViewportRelativeNV\n", + MakeInstruction(SpvOpDecorate, + {1, SpvDecorationViewportRelativeNV})}, + {"OpDecorate %1 BuiltIn ViewportMaskNV\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, + SpvBuiltInViewportMaskNV})}, + })), ); + +// SPV_NV_shader_subgroup_partitioned + +INSTANTIATE_TEST_CASE_P( + SPV_NV_shader_subgroup_partitioned, ExtensionRoundTripTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1), + ValuesIn(std::vector{ + {"OpExtension \"SPV_NV_shader_subgroup_partitioned\"\n", + MakeInstruction(SpvOpExtension, + MakeVector("SPV_NV_shader_subgroup_partitioned"))}, + {"OpCapability GroupNonUniformPartitionedNV\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityGroupNonUniformPartitionedNV})}, + // Check the new capability's token number + {"OpCapability GroupNonUniformPartitionedNV\n", + MakeInstruction(SpvOpCapability, {5297})}, + {"%2 = OpGroupNonUniformPartitionNV %1 %3\n", + MakeInstruction(SpvOpGroupNonUniformPartitionNV, {1, 2, 3})}, + // Check the new instruction's token number + {"%2 = OpGroupNonUniformPartitionNV %1 %3\n", + MakeInstruction(static_cast(5296), {1, 2, 3})}, + // Check the new group operations + {"%2 = OpGroupIAdd %1 %3 PartitionedReduceNV %4\n", + MakeInstruction(SpvOpGroupIAdd, + {1, 2, 3, SpvGroupOperationPartitionedReduceNV, + 4})}, + {"%2 = OpGroupIAdd %1 %3 PartitionedReduceNV %4\n", + MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 6, 4})}, + {"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanNV %4\n", + MakeInstruction(SpvOpGroupIAdd, + {1, 2, 3, + SpvGroupOperationPartitionedInclusiveScanNV, 4})}, + {"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanNV %4\n", + MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 7, 4})}, + {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n", + MakeInstruction(SpvOpGroupIAdd, + {1, 2, 3, + SpvGroupOperationPartitionedExclusiveScanNV, 4})}, + {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n", + MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 8, 4})}, + })), ); + +// SPV_EXT_descriptor_indexing + +INSTANTIATE_TEST_CASE_P( + SPV_EXT_descriptor_indexing, ExtensionRoundTripTest, + Combine( + Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0, + SPV_ENV_VULKAN_1_1), + ValuesIn(std::vector{ + {"OpExtension \"SPV_EXT_descriptor_indexing\"\n", + MakeInstruction(SpvOpExtension, + MakeVector("SPV_EXT_descriptor_indexing"))}, + // Check capabilities, by name + {"OpCapability ShaderNonUniformEXT\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityShaderNonUniformEXT})}, + {"OpCapability RuntimeDescriptorArrayEXT\n", + MakeInstruction(SpvOpCapability, + {SpvCapabilityRuntimeDescriptorArrayEXT})}, + {"OpCapability InputAttachmentArrayDynamicIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityInputAttachmentArrayDynamicIndexingEXT})}, + {"OpCapability UniformTexelBufferArrayDynamicIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityUniformTexelBufferArrayDynamicIndexingEXT})}, + {"OpCapability StorageTexelBufferArrayDynamicIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityStorageTexelBufferArrayDynamicIndexingEXT})}, + {"OpCapability UniformBufferArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityUniformBufferArrayNonUniformIndexingEXT})}, + {"OpCapability SampledImageArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilitySampledImageArrayNonUniformIndexingEXT})}, + {"OpCapability StorageBufferArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityStorageBufferArrayNonUniformIndexingEXT})}, + {"OpCapability StorageImageArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityStorageImageArrayNonUniformIndexingEXT})}, + {"OpCapability InputAttachmentArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityInputAttachmentArrayNonUniformIndexingEXT})}, + {"OpCapability UniformTexelBufferArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityUniformTexelBufferArrayNonUniformIndexingEXT})}, + {"OpCapability StorageTexelBufferArrayNonUniformIndexingEXT\n", + MakeInstruction( + SpvOpCapability, + {SpvCapabilityStorageTexelBufferArrayNonUniformIndexingEXT})}, + // Check capabilities, by number + {"OpCapability ShaderNonUniformEXT\n", + MakeInstruction(SpvOpCapability, {5301})}, + {"OpCapability RuntimeDescriptorArrayEXT\n", + MakeInstruction(SpvOpCapability, {5302})}, + {"OpCapability InputAttachmentArrayDynamicIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5303})}, + {"OpCapability UniformTexelBufferArrayDynamicIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5304})}, + {"OpCapability StorageTexelBufferArrayDynamicIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5305})}, + {"OpCapability UniformBufferArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5306})}, + {"OpCapability SampledImageArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5307})}, + {"OpCapability StorageBufferArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5308})}, + {"OpCapability StorageImageArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5309})}, + {"OpCapability InputAttachmentArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5310})}, + {"OpCapability UniformTexelBufferArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5311})}, + {"OpCapability StorageTexelBufferArrayNonUniformIndexingEXT\n", + MakeInstruction(SpvOpCapability, {5312})}, + + // Check the decoration token + {"OpDecorate %1 NonUniformEXT\n", + MakeInstruction(SpvOpDecorate, {1, SpvDecorationNonUniformEXT})}, + {"OpDecorate %1 NonUniformEXT\n", + MakeInstruction(SpvOpDecorate, {1, 5300})}, + })), ); + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp new file mode 100644 index 00000000000..748461fb198 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp @@ -0,0 +1,81 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Function" section of the +// SPIR-V spec. + +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using spvtest::TextToBinaryTest; +using ::testing::Eq; + +// Test OpFunction + +using OpFunctionControlTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) { + const std::string input = "%result_id = OpFunction %result_type " + + GetParam().name() + " %function_type "; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpFunction, {1, 2, GetParam().value(), 3}))); +} + +// clang-format off +#define CASE(VALUE,NAME) { SpvFunctionControl##VALUE, NAME } +INSTANTIATE_TEST_CASE_P(TextToBinaryFunctionTest, OpFunctionControlTest, + ::testing::ValuesIn(std::vector>{ + CASE(MaskNone, "None"), + CASE(InlineMask, "Inline"), + CASE(DontInlineMask, "DontInline"), + CASE(PureMask, "Pure"), + CASE(ConstMask, "Const"), + }),); +#undef CASE +// clang-format on + +TEST_F(OpFunctionControlTest, CombinedFunctionControlMask) { + // Sample a single combination. This ensures we've integrated + // the instruction parsing logic with spvTextParseMask. + const std::string input = + "%result_id = OpFunction %result_type Inline|Pure|Const %function_type"; + const uint32_t expected_mask = SpvFunctionControlInlineMask | + SpvFunctionControlPureMask | + SpvFunctionControlConstMask; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpFunction, {1, 2, expected_mask, 3}))); +} + +TEST_F(OpFunctionControlTest, WrongFunctionControl) { + EXPECT_THAT(CompileFailure("%r = OpFunction %t Inline|Unroll %ft"), + Eq("Invalid function control operand 'Inline|Unroll'.")); +} + +// TODO(dneto): OpFunctionParameter +// TODO(dneto): OpFunctionEnd +// TODO(dneto): OpFunctionCall + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp new file mode 100644 index 00000000000..2f4b76d2f25 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp @@ -0,0 +1,76 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Group Instrucions" section of the +// SPIR-V spec. + +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using ::testing::Eq; + +// Test GroupOperation enum + +using GroupOperationTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(GroupOperationTest, AnyGroupOperation) { + const std::string input = + "%result = OpGroupIAdd %type %scope " + GetParam().name() + " %x"; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, GetParam().value(), 4}))); +} + +// clang-format off +#define CASE(NAME) { SpvGroupOperation##NAME, #NAME} +INSTANTIATE_TEST_CASE_P(TextToBinaryGroupOperation, GroupOperationTest, + ::testing::ValuesIn(std::vector>{ + CASE(Reduce), + CASE(InclusiveScan), + CASE(ExclusiveScan), + }),); +#undef CASE +// clang-format on + +TEST_F(GroupOperationTest, WrongGroupOperation) { + EXPECT_THAT(CompileFailure("%r = OpGroupUMin %t %e xxyyzz %x"), + Eq("Invalid group operation 'xxyyzz'.")); +} + +// TODO(dneto): OpGroupAsyncCopy +// TODO(dneto): OpGroupWaitEvents +// TODO(dneto): OpGroupAll +// TODO(dneto): OpGroupAny +// TODO(dneto): OpGroupBroadcast +// TODO(dneto): OpGroupIAdd +// TODO(dneto): OpGroupFAdd +// TODO(dneto): OpGroupFMin +// TODO(dneto): OpGroupUMin +// TODO(dneto): OpGroupSMin +// TODO(dneto): OpGroupFMax +// TODO(dneto): OpGroupUMax +// TODO(dneto): OpGroupSMax + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp new file mode 100644 index 00000000000..c1adedf4484 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp @@ -0,0 +1,276 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Image Instructions" section of +// the SPIR-V spec. + +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::MakeInstruction; +using spvtest::TextToBinaryTest; +using ::testing::Eq; + +// An example case for a mask value with operands. +struct ImageOperandsCase { + std::string image_operands; + // The expected mask, followed by its operands. + std::vector expected_mask_and_operands; +}; + +// Test all kinds of image operands. + +using ImageOperandsTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(ImageOperandsTest, Sample) { + const std::string input = + "%2 = OpImageFetch %1 %3 %4" + GetParam().image_operands + "\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpImageFetch, {1, 2, 3, 4}, + GetParam().expected_mask_and_operands))); +} + +#define MASK(NAME) SpvImageOperands##NAME##Mask +INSTANTIATE_TEST_CASE_P( + TextToBinaryImageOperandsAny, ImageOperandsTest, + ::testing::ValuesIn(std::vector{ + // TODO(dneto): Rev32 adds many more values, and rearranges their + // values. + // Image operands are optional. + {"", {}}, + // Test each kind, alone. + {" Bias %5", {MASK(Bias), 5}}, + {" Lod %5", {MASK(Lod), 5}}, + {" Grad %5 %6", {MASK(Grad), 5, 6}}, + {" ConstOffset %5", {MASK(ConstOffset), 5}}, + {" Offset %5", {MASK(Offset), 5}}, + {" ConstOffsets %5", {MASK(ConstOffsets), 5}}, + {" Sample %5", {MASK(Sample), 5}}, + {" MinLod %5", {MASK(MinLod), 5}}, + }), ); +#undef MASK +#define MASK(NAME) static_cast(SpvImageOperands##NAME##Mask) +INSTANTIATE_TEST_CASE_P( + TextToBinaryImageOperandsCombination, ImageOperandsTest, + ::testing::ValuesIn(std::vector{ + // TODO(dneto): Rev32 adds many more values, and rearranges their + // values. + // Test adjacent pairs, so we can easily debug the values when it fails. + {" Bias|Lod %5 %6", {MASK(Bias) | MASK(Lod), 5, 6}}, + {" Lod|Grad %5 %6 %7", {MASK(Lod) | MASK(Grad), 5, 6, 7}}, + {" Grad|ConstOffset %5 %6 %7", + {MASK(Grad) | MASK(ConstOffset), 5, 6, 7}}, + {" ConstOffset|Offset %5 %6", {MASK(ConstOffset) | MASK(Offset), 5, 6}}, + {" Offset|ConstOffsets %5 %6", + {MASK(Offset) | MASK(ConstOffsets), 5, 6}}, + {" ConstOffsets|Sample %5 %6", + {MASK(ConstOffsets) | MASK(Sample), 5, 6}}, + // Test all masks together. + {" Bias|Lod|Grad|ConstOffset|Offset|ConstOffsets|Sample" + " %5 %6 %7 %8 %9 %10 %11 %12", + {MASK(Bias) | MASK(Lod) | MASK(Grad) | MASK(ConstOffset) | + MASK(Offset) | MASK(ConstOffsets) | MASK(Sample), + 5, 6, 7, 8, 9, 10, 11, 12}}, + // The same, but with mask value names reversed. + {" Sample|ConstOffsets|Offset|ConstOffset|Grad|Lod|Bias" + " %5 %6 %7 %8 %9 %10 %11 %12", + {MASK(Bias) | MASK(Lod) | MASK(Grad) | MASK(ConstOffset) | + MASK(Offset) | MASK(ConstOffsets) | MASK(Sample), + 5, 6, 7, 8, 9, 10, 11, 12}}}), ); +#undef MASK + +TEST_F(ImageOperandsTest, WrongOperand) { + EXPECT_THAT(CompileFailure("%r = OpImageFetch %t %i %c xxyyzz"), + Eq("Invalid image operand 'xxyyzz'.")); +} + +// Test OpImage + +using OpImageTest = TextToBinaryTest; + +TEST_F(OpImageTest, Valid) { + const std::string input = "%2 = OpImage %1 %3\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpImage, {1, 2, 3}))); + + // Test the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), input); +} + +TEST_F(OpImageTest, InvalidTypeOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImage 42"), + Eq("Expected id to start with %.")); +} + +TEST_F(OpImageTest, MissingSampledImageOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImage %1"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpImageTest, InvalidSampledImageOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImage %1 1000"), + Eq("Expected id to start with %.")); +} + +TEST_F(OpImageTest, TooManyOperands) { + // We should improve this message, to say what instruction we're trying to + // parse. + EXPECT_THAT(CompileFailure("%2 = OpImage %1 %3 %4"), // an Id + Eq("Expected '=', found end of stream.")); + + EXPECT_THAT(CompileFailure("%2 = OpImage %1 %3 99"), // a number + Eq("Expected or at the beginning of an " + "instruction, found '99'.")); + EXPECT_THAT(CompileFailure("%2 = OpImage %1 %3 \"abc\""), // a string + Eq("Expected or at the beginning of an " + "instruction, found '\"abc\"'.")); +} + +// Test OpImageSparseRead + +using OpImageSparseReadTest = TextToBinaryTest; + +TEST_F(OpImageSparseReadTest, OnlyRequiredOperands) { + const std::string input = "%2 = OpImageSparseRead %1 %3 %4\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpImageSparseRead, {1, 2, 3, 4}))); + // Test the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), input); +} + +// Test all kinds of image operands on OpImageSparseRead + +using ImageSparseReadImageOperandsTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>; + +TEST_P(ImageSparseReadImageOperandsTest, Sample) { + const std::string input = + "%2 = OpImageSparseRead %1 %3 %4" + GetParam().image_operands + "\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpImageSparseRead, {1, 2, 3, 4}, + GetParam().expected_mask_and_operands))); + // Test the disassembler. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), input); +} + +#define MASK(NAME) SpvImageOperands##NAME##Mask +INSTANTIATE_TEST_CASE_P(ImageSparseReadImageOperandsAny, + ImageSparseReadImageOperandsTest, + ::testing::ValuesIn(std::vector{ + // Image operands are optional. + {"", {}}, + // Test each kind, alone. + {" Bias %5", {MASK(Bias), 5}}, + {" Lod %5", {MASK(Lod), 5}}, + {" Grad %5 %6", {MASK(Grad), 5, 6}}, + {" ConstOffset %5", {MASK(ConstOffset), 5}}, + {" Offset %5", {MASK(Offset), 5}}, + {" ConstOffsets %5", {MASK(ConstOffsets), 5}}, + {" Sample %5", {MASK(Sample), 5}}, + {" MinLod %5", {MASK(MinLod), 5}}, + }), ); +#undef MASK +#define MASK(NAME) static_cast(SpvImageOperands##NAME##Mask) +INSTANTIATE_TEST_CASE_P( + ImageSparseReadImageOperandsCombination, ImageSparseReadImageOperandsTest, + ::testing::ValuesIn(std::vector{ + // values. + // Test adjacent pairs, so we can easily debug the values when it fails. + {" Bias|Lod %5 %6", {MASK(Bias) | MASK(Lod), 5, 6}}, + {" Lod|Grad %5 %6 %7", {MASK(Lod) | MASK(Grad), 5, 6, 7}}, + {" Grad|ConstOffset %5 %6 %7", + {MASK(Grad) | MASK(ConstOffset), 5, 6, 7}}, + {" ConstOffset|Offset %5 %6", {MASK(ConstOffset) | MASK(Offset), 5, 6}}, + {" Offset|ConstOffsets %5 %6", + {MASK(Offset) | MASK(ConstOffsets), 5, 6}}, + {" ConstOffsets|Sample %5 %6", + {MASK(ConstOffsets) | MASK(Sample), 5, 6}}, + // Test all masks together. + {" Bias|Lod|Grad|ConstOffset|Offset|ConstOffsets|Sample" + " %5 %6 %7 %8 %9 %10 %11 %12", + {MASK(Bias) | MASK(Lod) | MASK(Grad) | MASK(ConstOffset) | + MASK(Offset) | MASK(ConstOffsets) | MASK(Sample), + 5, 6, 7, 8, 9, 10, 11, 12}}, + // Don't try the masks reversed, since this is a round trip test, + // and the disassembler will sort them. + }), ); +#undef MASK + +TEST_F(OpImageSparseReadTest, InvalidTypeOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImageSparseRead 42"), + Eq("Expected id to start with %.")); +} + +TEST_F(OpImageSparseReadTest, MissingImageOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImageSparseRead %1"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpImageSparseReadTest, InvalidImageOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImageSparseRead %1 1000"), + Eq("Expected id to start with %.")); +} + +TEST_F(OpImageSparseReadTest, MissingCoordinateOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImageSparseRead %1 %2"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpImageSparseReadTest, InvalidCoordinateOperand) { + EXPECT_THAT(CompileFailure("%2 = OpImageSparseRead %1 %2 1000"), + Eq("Expected id to start with %.")); +} + +// TODO(dneto): OpSampledImage +// TODO(dneto): OpImageSampleImplicitLod +// TODO(dneto): OpImageSampleExplicitLod +// TODO(dneto): OpImageSampleDrefImplicitLod +// TODO(dneto): OpImageSampleDrefExplicitLod +// TODO(dneto): OpImageSampleProjImplicitLod +// TODO(dneto): OpImageSampleProjExplicitLod +// TODO(dneto): OpImageSampleProjDrefImplicitLod +// TODO(dneto): OpImageSampleProjDrefExplicitLod +// TODO(dneto): OpImageGather +// TODO(dneto): OpImageDrefGather +// TODO(dneto): OpImageRead +// TODO(dneto): OpImageWrite +// TODO(dneto): OpImageQueryFormat +// TODO(dneto): OpImageQueryOrder +// TODO(dneto): OpImageQuerySizeLod +// TODO(dneto): OpImageQuerySize +// TODO(dneto): OpImageQueryLod +// TODO(dneto): OpImageQueryLevels +// TODO(dneto): OpImageQuerySamples +// TODO(dneto): OpImageSparseSampleImplicitLod +// TODO(dneto): OpImageSparseSampleExplicitLod +// TODO(dneto): OpImageSparseSampleDrefImplicitLod +// TODO(dneto): OpImageSparseSampleDrefExplicitLod +// TODO(dneto): OpImageSparseSampleProjImplicitLod +// TODO(dneto): OpImageSparseSampleProjExplicitLod +// TODO(dneto): OpImageSparseSampleProjDrefImplicitLod +// TODO(dneto): OpImageSparseSampleProjDrefExplicitLod +// TODO(dneto): OpImageSparseFetch +// TODO(dneto): OpImageSparseDrefGather +// TODO(dneto): OpImageSparseTexelsResident + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.literal_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.literal_test.cpp new file mode 100644 index 00000000000..bcbb63e0dbd --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.literal_test.cpp @@ -0,0 +1,125 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for literal numbers and literal strings. + +#include + +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using spvtest::TextToBinaryTest; + +TEST_F(TextToBinaryTest, LiteralStringInPlaceOfLiteralNumber) { + EXPECT_EQ( + R"(Invalid unsigned integer literal: "I shouldn't be a string")", + CompileFailure(R"(OpSource GLSL "I shouldn't be a string")")); +} + +TEST_F(TextToBinaryTest, GarbageInPlaceOfLiteralString) { + EXPECT_EQ("Invalid literal string 'nice-source-code'.", + CompileFailure("OpSourceExtension nice-source-code")); +} + +TEST_F(TextToBinaryTest, LiteralNumberInPlaceOfLiteralString) { + EXPECT_EQ("Expected literal string, found literal number '1000'.", + CompileFailure("OpSourceExtension 1000")); +} + +TEST_F(TextToBinaryTest, LiteralFloatInPlaceOfLiteralInteger) { + EXPECT_EQ("Invalid unsigned integer literal: 10.5", + CompileFailure("OpSource GLSL 10.5")); + + EXPECT_EQ("Invalid unsigned integer literal: 0.2", + CompileFailure(R"(OpMemberName %type 0.2 "member0.2")")); + + EXPECT_EQ("Invalid unsigned integer literal: 32.42", + CompileFailure("%int = OpTypeInt 32.42 0")); + + EXPECT_EQ("Invalid unsigned integer literal: 4.5", + CompileFailure("%mat = OpTypeMatrix %vec 4.5")); + + EXPECT_EQ("Invalid unsigned integer literal: 1.5", + CompileFailure("OpExecutionMode %main LocalSize 1.5 1.6 1.7")); + + EXPECT_EQ("Invalid unsigned integer literal: 0.123", + CompileFailure("%i32 = OpTypeInt 32 1\n" + "%c = OpConstant %i32 0.123")); +} + +TEST_F(TextToBinaryTest, LiteralInt64) { + const std::string code = + "%1 = OpTypeInt 64 0\n%2 = OpConstant %1 123456789021\n"; + EXPECT_EQ(code, EncodeAndDecodeSuccessfully(code)); +} + +TEST_F(TextToBinaryTest, LiteralDouble) { + const std::string code = + "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 3.14159265358979\n"; + EXPECT_EQ(code, EncodeAndDecodeSuccessfully(code)); +} + +TEST_F(TextToBinaryTest, LiteralStringASCIILong) { + // SPIR-V allows strings up to 65535 characters. + // Test the simple case of UTF-8 code points corresponding + // to ASCII characters. + EXPECT_EQ(65535, SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX); + const std::string code = + "OpSourceExtension \"" + + std::string(SPV_LIMIT_LITERAL_STRING_UTF8_CHARS_MAX, 'o') + "\"\n"; + EXPECT_EQ(code, EncodeAndDecodeSuccessfully(code)); +} + +TEST_F(TextToBinaryTest, LiteralStringUTF8LongEncodings) { + // SPIR-V allows strings up to 65535 characters. + // Test the case of many Unicode characters, each of which has + // a 4-byte UTF-8 encoding. + + // An instruction is at most 65535 words long. The first one + // contains the wordcount and opcode. So the worst case number of + // 4-byte UTF-8 characters is 65533, since we also need to + // store a terminating null character. + + // This string fits exactly into 65534 words. + const std::string good_string = + spvtest::MakeLongUTF8String(65533) + // The following single character has a 3 byte encoding, + // which fits snugly against the terminating null. + + "\xe8\x80\x80"; + + // These strings will overflow any instruction with 0 or 1 other + // arguments, respectively. + const std::string bad_0_arg_string = spvtest::MakeLongUTF8String(65534); + const std::string bad_1_arg_string = spvtest::MakeLongUTF8String(65533); + + const std::string good_code = "OpSourceExtension \"" + good_string + "\"\n"; + EXPECT_EQ(good_code, EncodeAndDecodeSuccessfully(good_code)); + + // Prove that it works on more than one instruction. + const std::string good_code_2 = "OpSourceContinued \"" + good_string + "\"\n"; + EXPECT_EQ(good_code, EncodeAndDecodeSuccessfully(good_code)); + + // Failure cases. + EXPECT_EQ("Instruction too long: more than 65535 words.", + CompileFailure("OpSourceExtension \"" + bad_0_arg_string + "\"\n")); + EXPECT_EQ("Instruction too long: more than 65535 words.", + CompileFailure("OpSourceContinued \"" + bad_0_arg_string + "\"\n")); + EXPECT_EQ("Instruction too long: more than 65535 words.", + CompileFailure("OpName %target \"" + bad_1_arg_string + "\"\n")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp new file mode 100644 index 00000000000..ead08e6fdaf --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp @@ -0,0 +1,111 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Memory Instructions" section of +// the SPIR-V spec. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using spvtest::TextToBinaryTest; +using ::testing::Eq; + +// Test assembly of Memory Access masks + +using MemoryAccessTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(MemoryAccessTest, AnySingleMemoryAccessMask) { + std::stringstream input; + input << "OpStore %ptr %value " << GetParam().name(); + for (auto operand : GetParam().operands()) input << " " << operand; + EXPECT_THAT(CompiledInstructions(input.str()), + Eq(MakeInstruction(SpvOpStore, {1, 2, GetParam().value()}, + GetParam().operands()))); +} + +INSTANTIATE_TEST_CASE_P( + TextToBinaryMemoryAccessTest, MemoryAccessTest, + ::testing::ValuesIn(std::vector>{ + {SpvMemoryAccessMaskNone, "None", {}}, + {SpvMemoryAccessVolatileMask, "Volatile", {}}, + {SpvMemoryAccessAlignedMask, "Aligned", {16}}, + {SpvMemoryAccessNontemporalMask, "Nontemporal", {}}, + }), ); + +TEST_F(TextToBinaryTest, CombinedMemoryAccessMask) { + const std::string input = "OpStore %ptr %value Volatile|Aligned 16"; + const uint32_t expected_mask = + SpvMemoryAccessVolatileMask | SpvMemoryAccessAlignedMask; + EXPECT_THAT(expected_mask, Eq(3u)); + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpStore, {1, 2, expected_mask, 16}))); +} + +// Test Storage Class enum values + +using StorageClassTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(StorageClassTest, AnyStorageClass) { + const std::string input = "%1 = OpVariable %2 " + GetParam().name(); + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpVariable, {1, 2, GetParam().value()}))); +} + +// clang-format off +#define CASE(NAME) { SpvStorageClass##NAME, #NAME, {} } +INSTANTIATE_TEST_CASE_P( + TextToBinaryStorageClassTest, StorageClassTest, + ::testing::ValuesIn(std::vector>{ + CASE(UniformConstant), + CASE(Input), + CASE(Uniform), + CASE(Output), + CASE(Workgroup), + CASE(CrossWorkgroup), + CASE(Private), + CASE(Function), + CASE(Generic), + CASE(PushConstant), + CASE(AtomicCounter), + CASE(Image), + }),); +#undef CASE +// clang-format on + +// TODO(dneto): OpVariable with initializers +// TODO(dneto): OpImageTexelPointer +// TODO(dneto): OpLoad +// TODO(dneto): OpStore +// TODO(dneto): OpCopyMemory +// TODO(dneto): OpCopyMemorySized +// TODO(dneto): OpAccessChain +// TODO(dneto): OpInBoundsAccessChain +// TODO(dneto): OpPtrAccessChain +// TODO(dneto): OpArrayLength +// TODO(dneto): OpGenercPtrMemSemantics + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.misc_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.misc_test.cpp new file mode 100644 index 00000000000..03b1e0914d0 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.misc_test.cpp @@ -0,0 +1,58 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Miscellaneous" section of the +// SPIR-V spec. + +#include "test/unit_spirv.h" + +#include "gmock/gmock.h" +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using SpirvVector = spvtest::TextToBinaryTest::SpirvVector; +using spvtest::MakeInstruction; +using ::testing::Eq; +using TextToBinaryMisc = spvtest::TextToBinaryTest; + +TEST_F(TextToBinaryMisc, OpNop) { + EXPECT_THAT(CompiledInstructions("OpNop"), Eq(MakeInstruction(SpvOpNop, {}))); +} + +TEST_F(TextToBinaryMisc, OpUndef) { + const SpirvVector code = CompiledInstructions(R"(%f32 = OpTypeFloat 32 + %u = OpUndef %f32)"); + const uint32_t typeID = 1; + EXPECT_THAT(code[1], Eq(typeID)); + EXPECT_THAT(Subvector(code, 3), Eq(MakeInstruction(SpvOpUndef, {typeID, 2}))); +} + +TEST_F(TextToBinaryMisc, OpWrong) { + EXPECT_THAT(CompileFailure(" OpWrong %1 %2"), + Eq("Invalid Opcode name 'OpWrong'")); +} + +TEST_F(TextToBinaryMisc, OpWrongAfterRight) { + const auto assembly = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpXYZ +)"; + EXPECT_THAT(CompileFailure(assembly), Eq("Invalid Opcode name 'OpXYZ'")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp new file mode 100644 index 00000000000..ed4fa2fb412 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp @@ -0,0 +1,302 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Mode-Setting" section of the +// SPIR-V spec. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using spvtest::MakeVector; +using ::testing::Combine; +using ::testing::Eq; +using ::testing::TestWithParam; +using ::testing::Values; +using ::testing::ValuesIn; + +// Test OpMemoryModel + +// An example case for OpMemoryModel +struct MemoryModelCase { + uint32_t get_addressing_value() const { + return static_cast(addressing_value); + } + uint32_t get_memory_value() const { + return static_cast(memory_value); + } + SpvAddressingModel addressing_value; + std::string addressing_name; + SpvMemoryModel memory_value; + std::string memory_name; +}; + +using OpMemoryModelTest = + spvtest::TextToBinaryTestBase>; + +TEST_P(OpMemoryModelTest, AnyMemoryModelCase) { + const std::string input = "OpMemoryModel " + GetParam().addressing_name + + " " + GetParam().memory_name; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpMemoryModel, {GetParam().get_addressing_value(), + GetParam().get_memory_value()}))); +} + +#define CASE(ADDRESSING, MEMORY) \ + { \ + SpvAddressingModel##ADDRESSING, #ADDRESSING, SpvMemoryModel##MEMORY, \ + #MEMORY \ + } +// clang-format off +INSTANTIATE_TEST_CASE_P(TextToBinaryMemoryModel, OpMemoryModelTest, + ValuesIn(std::vector{ + // These cases exercise each addressing model, and + // each memory model, but not necessarily in + // combination. + CASE(Logical,Simple), + CASE(Logical,GLSL450), + CASE(Physical32,OpenCL), + CASE(Physical64,OpenCL), + }),); +#undef CASE +// clang-format on + +TEST_F(OpMemoryModelTest, WrongModel) { + EXPECT_THAT(CompileFailure("OpMemoryModel xxyyzz Simple"), + Eq("Invalid addressing model 'xxyyzz'.")); + EXPECT_THAT(CompileFailure("OpMemoryModel Logical xxyyzz"), + Eq("Invalid memory model 'xxyyzz'.")); +} + +// Test OpEntryPoint + +// An example case for OpEntryPoint +struct EntryPointCase { + uint32_t get_execution_value() const { + return static_cast(execution_value); + } + SpvExecutionModel execution_value; + std::string execution_name; + std::string entry_point_name; +}; + +using OpEntryPointTest = + spvtest::TextToBinaryTestBase>; + +TEST_P(OpEntryPointTest, AnyEntryPointCase) { + // TODO(dneto): utf-8, escaping, quoting cases for entry point name. + const std::string input = "OpEntryPoint " + GetParam().execution_name + + " %1 \"" + GetParam().entry_point_name + "\""; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpEntryPoint, {GetParam().get_execution_value(), 1}, + MakeVector(GetParam().entry_point_name)))); +} + +// clang-format off +#define CASE(NAME) SpvExecutionModel##NAME, #NAME +INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest, + ValuesIn(std::vector{ + { CASE(Vertex), "" }, + { CASE(TessellationControl), "my tess" }, + { CASE(TessellationEvaluation), "really fancy" }, + { CASE(Geometry), "Euclid" }, + { CASE(Fragment), "FAT32" }, + { CASE(GLCompute), "cubic" }, + { CASE(Kernel), "Sanders" }, + }),); +#undef CASE +// clang-format on + +TEST_F(OpEntryPointTest, WrongModel) { + EXPECT_THAT(CompileFailure("OpEntryPoint xxyyzz %1 \"fun\""), + Eq("Invalid execution model 'xxyyzz'.")); +} + +// Test OpExecutionMode +using OpExecutionModeTest = spvtest::TextToBinaryTestBase< + TestWithParam>>>; + +TEST_P(OpExecutionModeTest, AnyExecutionMode) { + // This string should assemble, but should not validate. + std::stringstream input; + input << "OpExecutionMode %1 " << std::get<1>(GetParam()).name(); + for (auto operand : std::get<1>(GetParam()).operands()) + input << " " << operand; + EXPECT_THAT(CompiledInstructions(input.str(), std::get<0>(GetParam())), + Eq(MakeInstruction(SpvOpExecutionMode, + {1, std::get<1>(GetParam()).value()}, + std::get<1>(GetParam()).operands()))); +} + +#define CASE(NAME) SpvExecutionMode##NAME, #NAME +INSTANTIATE_TEST_CASE_P( + TextToBinaryExecutionMode, OpExecutionModeTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector>{ + // The operand literal values are arbitrarily chosen, + // but there are the right number of them. + {CASE(Invocations), {101}}, + {CASE(SpacingEqual), {}}, + {CASE(SpacingFractionalEven), {}}, + {CASE(SpacingFractionalOdd), {}}, + {CASE(VertexOrderCw), {}}, + {CASE(VertexOrderCcw), {}}, + {CASE(PixelCenterInteger), {}}, + {CASE(OriginUpperLeft), {}}, + {CASE(OriginLowerLeft), {}}, + {CASE(EarlyFragmentTests), {}}, + {CASE(PointMode), {}}, + {CASE(Xfb), {}}, + {CASE(DepthReplacing), {}}, + {CASE(DepthGreater), {}}, + {CASE(DepthLess), {}}, + {CASE(DepthUnchanged), {}}, + {CASE(LocalSize), {64, 1, 2}}, + {CASE(LocalSizeHint), {8, 2, 4}}, + {CASE(InputPoints), {}}, + {CASE(InputLines), {}}, + {CASE(InputLinesAdjacency), {}}, + {CASE(Triangles), {}}, + {CASE(InputTrianglesAdjacency), {}}, + {CASE(Quads), {}}, + {CASE(Isolines), {}}, + {CASE(OutputVertices), {21}}, + {CASE(OutputPoints), {}}, + {CASE(OutputLineStrip), {}}, + {CASE(OutputTriangleStrip), {}}, + {CASE(VecTypeHint), {96}}, + {CASE(ContractionOff), {}}, + })), ); + +INSTANTIATE_TEST_CASE_P( + TextToBinaryExecutionModeV11, OpExecutionModeTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + ValuesIn(std::vector>{ + {CASE(Initializer)}, + {CASE(Finalizer)}, + {CASE(SubgroupSize), {12}}, + {CASE(SubgroupsPerWorkgroup), {64}}})), ); +#undef CASE + +TEST_F(OpExecutionModeTest, WrongMode) { + EXPECT_THAT(CompileFailure("OpExecutionMode %1 xxyyzz"), + Eq("Invalid execution mode 'xxyyzz'.")); +} + +TEST_F(OpExecutionModeTest, TooManyModes) { + EXPECT_THAT(CompileFailure("OpExecutionMode %1 Xfb PointMode"), + Eq("Expected or at the beginning of an " + "instruction, found 'PointMode'.")); +} + +// Test OpCapability + +using OpCapabilityTest = + spvtest::TextToBinaryTestBase>>; + +TEST_P(OpCapabilityTest, AnyCapability) { + const std::string input = "OpCapability " + GetParam().name(); + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpCapability, {GetParam().value()}))); +} + +// clang-format off +#define CASE(NAME) { SpvCapability##NAME, #NAME } +INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest, + ValuesIn(std::vector>{ + CASE(Matrix), + CASE(Shader), + CASE(Geometry), + CASE(Tessellation), + CASE(Addresses), + CASE(Linkage), + CASE(Kernel), + CASE(Vector16), + CASE(Float16Buffer), + CASE(Float16), + CASE(Float64), + CASE(Int64), + CASE(Int64Atomics), + CASE(ImageBasic), + CASE(ImageReadWrite), + CASE(ImageMipmap), + // Value 16 intentionally missing + CASE(Pipes), + CASE(Groups), + CASE(DeviceEnqueue), + CASE(LiteralSampler), + CASE(AtomicStorage), + CASE(Int16), + CASE(TessellationPointSize), + CASE(GeometryPointSize), + CASE(ImageGatherExtended), + // Value 26 intentionally missing + CASE(StorageImageMultisample), + CASE(UniformBufferArrayDynamicIndexing), + CASE(SampledImageArrayDynamicIndexing), + CASE(StorageBufferArrayDynamicIndexing), + CASE(StorageImageArrayDynamicIndexing), + CASE(ClipDistance), + CASE(CullDistance), + CASE(ImageCubeArray), + CASE(SampleRateShading), + CASE(ImageRect), + CASE(SampledRect), + CASE(GenericPointer), + CASE(Int8), + CASE(InputAttachment), + CASE(SparseResidency), + CASE(MinLod), + CASE(Sampled1D), + CASE(Image1D), + CASE(SampledCubeArray), + CASE(SampledBuffer), + CASE(ImageBuffer), + CASE(ImageMSArray), + CASE(StorageImageExtendedFormats), + CASE(ImageQuery), + CASE(DerivativeControl), + CASE(InterpolationFunction), + CASE(TransformFeedback), + }),); +#undef CASE +// clang-format on + +using TextToBinaryCapability = spvtest::TextToBinaryTest; + +TEST_F(TextToBinaryCapability, BadMissingCapability) { + EXPECT_THAT(CompileFailure("OpCapability"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(TextToBinaryCapability, BadInvalidCapability) { + EXPECT_THAT(CompileFailure("OpCapability 123"), + Eq("Invalid capability '123'.")); +} + +// TODO(dneto): OpExecutionMode + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.pipe_storage_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.pipe_storage_test.cpp new file mode 100644 index 00000000000..f74dbcfdfe8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.pipe_storage_test.cpp @@ -0,0 +1,126 @@ +// Copyright (c) 2016 Google 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. + +#include "gmock/gmock.h" +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using ::spvtest::MakeInstruction; +using ::testing::Eq; + +using OpTypePipeStorageTest = spvtest::TextToBinaryTest; + +// It can assemble, but should not validate. Validation checks for version +// and capability are in another test file. +TEST_F(OpTypePipeStorageTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("%res = OpTypePipeStorage", SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpTypePipeStorage, {1}))); +} + +TEST_F(OpTypePipeStorageTest, ArgumentCount) { + EXPECT_THAT( + CompileFailure("OpTypePipeStorage", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, found " + "'OpTypePipeStorage'.")); + EXPECT_THAT( + CompiledInstructions("%res = OpTypePipeStorage", SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpTypePipeStorage, {1}))); + EXPECT_THAT(CompileFailure("%res = OpTypePipeStorage %1 %2 %3 %4 %5", + SPV_ENV_UNIVERSAL_1_1), + Eq("'=' expected after result id.")); +} + +using OpConstantPipeStorageTest = spvtest::TextToBinaryTest; + +TEST_F(OpConstantPipeStorageTest, OpcodeAssemblesInV10) { + EXPECT_THAT(CompiledInstructions("%1 = OpConstantPipeStorage %2 3 4 5", + SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpConstantPipeStorage, {1, 2, 3, 4, 5}))); +} + +TEST_F(OpConstantPipeStorageTest, ArgumentCount) { + EXPECT_THAT( + CompileFailure("OpConstantPipeStorage", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, found " + "'OpConstantPipeStorage'.")); + EXPECT_THAT( + CompileFailure("%1 = OpConstantPipeStorage", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 3 4", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT(CompiledInstructions("%1 = OpConstantPipeStorage %2 3 4 5", + SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpConstantPipeStorage, {1, 2, 3, 4, 5}))); + EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 3 4 5 %6 %7", + SPV_ENV_UNIVERSAL_1_1), + Eq("'=' expected after result id.")); +} + +TEST_F(OpConstantPipeStorageTest, ArgumentTypes) { + EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 %3 4 5", + SPV_ENV_UNIVERSAL_1_1), + Eq("Invalid unsigned integer literal: %3")); + EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 3 %4 5", + SPV_ENV_UNIVERSAL_1_1), + Eq("Invalid unsigned integer literal: %4")); + EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage 2 3 4 5", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); + EXPECT_THAT(CompileFailure("%1 = OpConstantPipeStorage %2 3 4 \"ab\"", + SPV_ENV_UNIVERSAL_1_1), + Eq("Invalid unsigned integer literal: \"ab\"")); +} + +using OpCreatePipeFromPipeStorageTest = spvtest::TextToBinaryTest; + +TEST_F(OpCreatePipeFromPipeStorageTest, OpcodeAssemblesInV10) { + EXPECT_THAT(CompiledInstructions("%1 = OpCreatePipeFromPipeStorage %2 %3", + SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpCreatePipeFromPipeStorage, {1, 2, 3}))); +} + +TEST_F(OpCreatePipeFromPipeStorageTest, ArgumentCount) { + EXPECT_THAT( + CompileFailure("OpCreatePipeFromPipeStorage", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, found " + "'OpCreatePipeFromPipeStorage'.")); + EXPECT_THAT( + CompileFailure("%1 = OpCreatePipeFromPipeStorage", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT(CompileFailure("%1 = OpCreatePipeFromPipeStorage %2 OpNop", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found next instruction instead.")); + EXPECT_THAT(CompiledInstructions("%1 = OpCreatePipeFromPipeStorage %2 %3", + SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpCreatePipeFromPipeStorage, {1, 2, 3}))); + EXPECT_THAT(CompileFailure("%1 = OpCreatePipeFromPipeStorage %2 %3 %4 %5", + SPV_ENV_UNIVERSAL_1_1), + Eq("'=' expected after result id.")); +} + +TEST_F(OpCreatePipeFromPipeStorageTest, ArgumentTypes) { + EXPECT_THAT(CompileFailure("%1 = OpCreatePipeFromPipeStorage \"\" %3", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); + EXPECT_THAT(CompileFailure("%1 = OpCreatePipeFromPipeStorage %2 3", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp new file mode 100644 index 00000000000..42e4e2aeb18 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.reserved_sampling_test.cpp @@ -0,0 +1,63 @@ +// Copyright (c) 2017 Google 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. + +// Validation tests for illegal instructions + +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using ::spvtest::MakeInstruction; +using ::testing::Eq; + +using ReservedSamplingInstTest = RoundTripTest; + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjImplicitLod) { + std::string input = "%2 = OpImageSparseSampleProjImplicitLod %1 %3 %4\n"; + EXPECT_THAT( + CompiledInstructions(input, SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpImageSparseSampleProjImplicitLod, {1, 2, 3, 4}))); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjExplicitLod) { + std::string input = + "%2 = OpImageSparseSampleProjExplicitLod %1 %3 %4 Lod %5\n"; + EXPECT_THAT(CompiledInstructions(input, SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpImageSparseSampleProjExplicitLod, + {1, 2, 3, 4, SpvImageOperandsLodMask, 5}))); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjDrefImplicitLod) { + std::string input = + "%2 = OpImageSparseSampleProjDrefImplicitLod %1 %3 %4 %5\n"; + EXPECT_THAT(CompiledInstructions(input, SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpImageSparseSampleProjDrefImplicitLod, + {1, 2, 3, 4, 5}))); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjDrefExplicitLod) { + std::string input = + "%2 = OpImageSparseSampleProjDrefExplicitLod %1 %3 %4 %5 Lod %6\n"; + EXPECT_THAT(CompiledInstructions(input, SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpImageSparseSampleProjDrefExplicitLod, + {1, 2, 3, 4, 5, SpvImageOperandsLodMask, 6}))); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp new file mode 100644 index 00000000000..967e3c38b18 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.subgroup_dispatch_test.cpp @@ -0,0 +1,122 @@ +// Copyright (c) 2016 Google 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. + +// Assembler tests for instructions in the "Barrier Instructions" section +// of the SPIR-V spec. + +#include "test/unit_spirv.h" + +#include "gmock/gmock.h" +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using ::spvtest::MakeInstruction; +using ::testing::Eq; + +using OpGetKernelLocalSizeForSubgroupCountTest = spvtest::TextToBinaryTest; + +// We should be able to assemble it. Validation checks are in another test +// file. +TEST_F(OpGetKernelLocalSizeForSubgroupCountTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("%res = OpGetKernelLocalSizeForSubgroupCount %type " + "%sgcount %invoke %param %param_size %param_align", + SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpGetKernelLocalSizeForSubgroupCount, + {1, 2, 3, 4, 5, 6, 7}))); +} + +TEST_F(OpGetKernelLocalSizeForSubgroupCountTest, ArgumentCount) { + EXPECT_THAT(CompileFailure("OpGetKernelLocalSizeForSubgroupCount", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, " + "found 'OpGetKernelLocalSizeForSubgroupCount'.")); + EXPECT_THAT(CompileFailure("%res = OpGetKernelLocalSizeForSubgroupCount", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompileFailure("%1 = OpGetKernelLocalSizeForSubgroupCount %2 %3 %4 %5 %6", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompiledInstructions("%res = OpGetKernelLocalSizeForSubgroupCount %type " + "%sgcount %invoke %param %param_size %param_align", + SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpGetKernelLocalSizeForSubgroupCount, + {1, 2, 3, 4, 5, 6, 7}))); + EXPECT_THAT( + CompileFailure("%res = OpGetKernelLocalSizeForSubgroupCount %type " + "%sgcount %invoke %param %param_size %param_align %extra", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected '=', found end of stream.")); +} + +TEST_F(OpGetKernelLocalSizeForSubgroupCountTest, ArgumentTypes) { + EXPECT_THAT(CompileFailure( + "%1 = OpGetKernelLocalSizeForSubgroupCount 2 %3 %4 %5 %6 %7", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); + EXPECT_THAT( + CompileFailure( + "%1 = OpGetKernelLocalSizeForSubgroupCount %2 %3 %4 %5 %6 \"abc\"", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); +} + +using OpGetKernelMaxNumSubgroupsTest = spvtest::TextToBinaryTest; + +TEST_F(OpGetKernelMaxNumSubgroupsTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("%res = OpGetKernelMaxNumSubgroups %type " + "%invoke %param %param_size %param_align", + SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpGetKernelMaxNumSubgroups, {1, 2, 3, 4, 5, 6}))); +} + +TEST_F(OpGetKernelMaxNumSubgroupsTest, ArgumentCount) { + EXPECT_THAT( + CompileFailure("OpGetKernelMaxNumSubgroups", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, found " + "'OpGetKernelMaxNumSubgroups'.")); + EXPECT_THAT(CompileFailure("%res = OpGetKernelMaxNumSubgroups", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT(CompileFailure("%1 = OpGetKernelMaxNumSubgroups %2 %3 %4 %5", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found end of stream.")); + EXPECT_THAT( + CompiledInstructions("%res = OpGetKernelMaxNumSubgroups %type " + "%invoke %param %param_size %param_align", + SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpGetKernelMaxNumSubgroups, {1, 2, 3, 4, 5, 6}))); + EXPECT_THAT(CompileFailure("%res = OpGetKernelMaxNumSubgroups %type %invoke " + "%param %param_size %param_align %extra", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected '=', found end of stream.")); +} + +TEST_F(OpGetKernelMaxNumSubgroupsTest, ArgumentTypes) { + EXPECT_THAT(CompileFailure("%1 = OpGetKernelMaxNumSubgroups 2 %3 %4 %5 %6", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); + EXPECT_THAT( + CompileFailure("%1 = OpGetKernelMaxNumSubgroups %2 %3 %4 %5 \"abc\"", + SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp new file mode 100644 index 00000000000..c6f158f2996 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp @@ -0,0 +1,293 @@ +// Copyright (c) 2015-2016 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. + +// Assembler tests for instructions in the "Type-Declaration" section of the +// SPIR-V spec. + +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::EnumCase; +using spvtest::MakeInstruction; +using ::testing::Eq; + +// Test Dim enums via OpTypeImage + +using DimTest = + spvtest::TextToBinaryTestBase<::testing::TestWithParam>>; + +TEST_P(DimTest, AnyDim) { + const std::string input = + "%1 = OpTypeImage %2 " + GetParam().name() + " 2 3 0 4 Rgba8\n"; + EXPECT_THAT( + CompiledInstructions(input), + Eq(MakeInstruction(SpvOpTypeImage, {1, 2, GetParam().value(), 2, 3, 0, 4, + SpvImageFormatRgba8}))); + + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input)); +} + +// clang-format off +#define CASE(NAME) {SpvDim##NAME, #NAME} +INSTANTIATE_TEST_CASE_P( + TextToBinaryDim, DimTest, + ::testing::ValuesIn(std::vector>{ + CASE(1D), + CASE(2D), + CASE(3D), + CASE(Cube), + CASE(Rect), + CASE(Buffer), + CASE(SubpassData), + }),); +#undef CASE +// clang-format on + +TEST_F(DimTest, WrongDim) { + EXPECT_THAT(CompileFailure("%i = OpTypeImage %t xxyyzz 1 2 3 4 R8"), + Eq("Invalid dimensionality 'xxyyzz'.")); +} + +// Test ImageFormat enums via OpTypeImage + +using ImageFormatTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(ImageFormatTest, AnyImageFormatAndNoAccessQualifier) { + const std::string input = + "%1 = OpTypeImage %2 1D 2 3 0 4 " + GetParam().name() + "\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpTypeImage, {1, 2, SpvDim1D, 2, 3, 0, 4, + GetParam().value()}))); + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input)); +} + +// clang-format off +#define CASE(NAME) {SpvImageFormat##NAME, #NAME} +INSTANTIATE_TEST_CASE_P( + TextToBinaryImageFormat, ImageFormatTest, + ::testing::ValuesIn(std::vector>{ + CASE(Unknown), + CASE(Rgba32f), + CASE(Rgba16f), + CASE(R32f), + CASE(Rgba8), + CASE(Rgba8Snorm), + CASE(Rg32f), + CASE(Rg16f), + CASE(R11fG11fB10f), + CASE(R16f), + CASE(Rgba16), + CASE(Rgb10A2), + CASE(Rg16), + CASE(Rg8), + CASE(R16), + CASE(R8), + CASE(Rgba16Snorm), + CASE(Rg16Snorm), + CASE(Rg8Snorm), + CASE(R16Snorm), + CASE(R8Snorm), + CASE(Rgba32i), + CASE(Rgba16i), + CASE(Rgba8i), + CASE(R32i), + CASE(Rg32i), + CASE(Rg16i), + CASE(Rg8i), + CASE(R16i), + CASE(R8i), + CASE(Rgba32ui), + CASE(Rgba16ui), + CASE(Rgba8ui), + CASE(R32ui), + CASE(Rgb10a2ui), + CASE(Rg32ui), + CASE(Rg16ui), + CASE(Rg8ui), + CASE(R16ui), + CASE(R8ui), + }),); +#undef CASE +// clang-format on + +TEST_F(ImageFormatTest, WrongFormat) { + EXPECT_THAT(CompileFailure("%r = OpTypeImage %t 1D 2 3 0 4 xxyyzz"), + Eq("Invalid image format 'xxyyzz'.")); +} + +// Test AccessQualifier enums via OpTypeImage. +using ImageAccessQualifierTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(ImageAccessQualifierTest, AnyAccessQualifier) { + const std::string input = + "%1 = OpTypeImage %2 1D 2 3 0 4 Rgba8 " + GetParam().name() + "\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpTypeImage, + {1, 2, SpvDim1D, 2, 3, 0, 4, + SpvImageFormatRgba8, GetParam().value()}))); + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input)); +} + +// clang-format off +#define CASE(NAME) {SpvAccessQualifier##NAME, #NAME} +INSTANTIATE_TEST_CASE_P( + AccessQualifier, ImageAccessQualifierTest, + ::testing::ValuesIn(std::vector>{ + CASE(ReadOnly), + CASE(WriteOnly), + CASE(ReadWrite), + }),); +// clang-format on +#undef CASE + +// Test AccessQualifier enums via OpTypePipe. + +using OpTypePipeTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(OpTypePipeTest, AnyAccessQualifier) { + const std::string input = "%1 = OpTypePipe " + GetParam().name() + "\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(MakeInstruction(SpvOpTypePipe, {1, GetParam().value()}))); + // Check the disassembler as well. + EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input)); +} + +// clang-format off +#define CASE(NAME) {SpvAccessQualifier##NAME, #NAME} +INSTANTIATE_TEST_CASE_P( + TextToBinaryTypePipe, OpTypePipeTest, + ::testing::ValuesIn(std::vector>{ + CASE(ReadOnly), + CASE(WriteOnly), + CASE(ReadWrite), + }),); +#undef CASE +// clang-format on + +TEST_F(OpTypePipeTest, WrongAccessQualifier) { + EXPECT_THAT(CompileFailure("%1 = OpTypePipe xxyyzz"), + Eq("Invalid access qualifier 'xxyyzz'.")); +} + +using OpTypeForwardPointerTest = spvtest::TextToBinaryTest; + +#define CASE(storage_class) \ + do { \ + EXPECT_THAT( \ + CompiledInstructions("OpTypeForwardPointer %pt " #storage_class), \ + Eq(MakeInstruction(SpvOpTypeForwardPointer, \ + {1, SpvStorageClass##storage_class}))); \ + } while (0) + +TEST_F(OpTypeForwardPointerTest, ValidStorageClass) { + CASE(UniformConstant); + CASE(Input); + CASE(Uniform); + CASE(Output); + CASE(Workgroup); + CASE(CrossWorkgroup); + CASE(Private); + CASE(Function); + CASE(Generic); + CASE(PushConstant); + CASE(AtomicCounter); + CASE(Image); + CASE(StorageBuffer); +} + +#undef CASE + +TEST_F(OpTypeForwardPointerTest, MissingType) { + EXPECT_THAT(CompileFailure("OpTypeForwardPointer"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpTypeForwardPointerTest, MissingClass) { + EXPECT_THAT(CompileFailure("OpTypeForwardPointer %pt"), + Eq("Expected operand, found end of stream.")); +} + +TEST_F(OpTypeForwardPointerTest, WrongClass) { + EXPECT_THAT(CompileFailure("OpTypeForwardPointer %pt xxyyzz"), + Eq("Invalid storage class 'xxyyzz'.")); +} + +using OpSizeOfTest = spvtest::TextToBinaryTest; + +// We should be able to assemble it. Validation checks are in another test +// file. +TEST_F(OpSizeOfTest, OpcodeAssemblesInV10) { + EXPECT_THAT( + CompiledInstructions("%1 = OpSizeOf %2 %3", SPV_ENV_UNIVERSAL_1_0), + Eq(MakeInstruction(SpvOpSizeOf, {1, 2, 3}))); +} + +TEST_F(OpSizeOfTest, ArgumentCount) { + EXPECT_THAT( + CompileFailure("OpSizeOf", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected at the beginning of an instruction, found " + "'OpSizeOf'.")); + EXPECT_THAT(CompileFailure("%res = OpSizeOf OpNop", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected operand, found next instruction instead.")); + EXPECT_THAT( + CompiledInstructions("%1 = OpSizeOf %2 %3", SPV_ENV_UNIVERSAL_1_1), + Eq(MakeInstruction(SpvOpSizeOf, {1, 2, 3}))); + EXPECT_THAT( + CompileFailure("%1 = OpSizeOf %2 %3 44 55 ", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected or at the beginning of an instruction, " + "found '44'.")); +} + +TEST_F(OpSizeOfTest, ArgumentTypes) { + EXPECT_THAT(CompileFailure("%1 = OpSizeOf 2 %3", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); + EXPECT_THAT(CompileFailure("%1 = OpSizeOf %2 \"abc\"", SPV_ENV_UNIVERSAL_1_1), + Eq("Expected id to start with %.")); +} + +// TODO(dneto): OpTypeVoid +// TODO(dneto): OpTypeBool +// TODO(dneto): OpTypeInt +// TODO(dneto): OpTypeFloat +// TODO(dneto): OpTypeVector +// TODO(dneto): OpTypeMatrix +// TODO(dneto): OpTypeImage +// TODO(dneto): OpTypeSampler +// TODO(dneto): OpTypeSampledImage +// TODO(dneto): OpTypeArray +// TODO(dneto): OpTypeRuntimeArray +// TODO(dneto): OpTypeStruct +// TODO(dneto): OpTypeOpaque +// TODO(dneto): OpTypePointer +// TODO(dneto): OpTypeFunction +// TODO(dneto): OpTypeEvent +// TODO(dneto): OpTypeDeviceEvent +// TODO(dneto): OpTypeReserveId +// TODO(dneto): OpTypeQueue + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary_test.cpp new file mode 100644 index 00000000000..4ba37ad4deb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_to_binary_test.cpp @@ -0,0 +1,269 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/spirv_constant.h" +#include "source/util/bitutils.h" +#include "source/util/hex_float.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::AutoText; +using spvtest::Concatenate; +using spvtest::MakeInstruction; +using spvtest::ScopedContext; +using spvtest::TextToBinaryTest; +using testing::Eq; +using testing::IsNull; +using testing::NotNull; + +// An mask parsing test case. +struct MaskCase { + spv_operand_type_t which_enum; + uint32_t expected_value; + const char* expression; +}; + +using GoodMaskParseTest = ::testing::TestWithParam; + +TEST_P(GoodMaskParseTest, GoodMaskExpressions) { + spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_0); + + uint32_t value; + EXPECT_EQ(SPV_SUCCESS, + AssemblyGrammar(context).parseMaskOperand( + GetParam().which_enum, GetParam().expression, &value)); + EXPECT_EQ(GetParam().expected_value, value); + + spvContextDestroy(context); +} + +INSTANTIATE_TEST_CASE_P( + ParseMask, GoodMaskParseTest, + ::testing::ValuesIn(std::vector{ + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 0, "None"}, + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 1, "NotNaN"}, + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 2, "NotInf"}, + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 3, "NotNaN|NotInf"}, + // Mask experssions are symmetric. + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 3, "NotInf|NotNaN"}, + // Repeating a value has no effect. + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 3, "NotInf|NotNaN|NotInf"}, + // Using 3 operands still works. + {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 0x13, "NotInf|NotNaN|Fast"}, + {SPV_OPERAND_TYPE_SELECTION_CONTROL, 0, "None"}, + {SPV_OPERAND_TYPE_SELECTION_CONTROL, 1, "Flatten"}, + {SPV_OPERAND_TYPE_SELECTION_CONTROL, 2, "DontFlatten"}, + // Weirdly, you can specify to flatten and don't flatten a selection. + {SPV_OPERAND_TYPE_SELECTION_CONTROL, 3, "Flatten|DontFlatten"}, + {SPV_OPERAND_TYPE_LOOP_CONTROL, 0, "None"}, + {SPV_OPERAND_TYPE_LOOP_CONTROL, 1, "Unroll"}, + {SPV_OPERAND_TYPE_LOOP_CONTROL, 2, "DontUnroll"}, + // Weirdly, you can specify to unroll and don't unroll a loop. + {SPV_OPERAND_TYPE_LOOP_CONTROL, 3, "Unroll|DontUnroll"}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 0, "None"}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 1, "Inline"}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 2, "DontInline"}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 4, "Pure"}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 8, "Const"}, + {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 0xd, "Inline|Const|Pure"}, + }), ); + +using BadFPFastMathMaskParseTest = ::testing::TestWithParam; + +TEST_P(BadFPFastMathMaskParseTest, BadMaskExpressions) { + spv_context context = spvContextCreate(SPV_ENV_UNIVERSAL_1_0); + + uint32_t value; + EXPECT_NE(SPV_SUCCESS, + AssemblyGrammar(context).parseMaskOperand( + SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, GetParam(), &value)); + + spvContextDestroy(context); +} + +INSTANTIATE_TEST_CASE_P(ParseMask, BadFPFastMathMaskParseTest, + ::testing::ValuesIn(std::vector{ + nullptr, "", "NotValidEnum", "|", "NotInf|", + "|NotInf", "NotInf||NotNaN", + "Unroll" // A good word, but for the wrong enum + }), ); + +TEST_F(TextToBinaryTest, InvalidText) { + ASSERT_EQ(SPV_ERROR_INVALID_TEXT, + spvTextToBinary(ScopedContext().context, nullptr, 0, &binary, + &diagnostic)); + EXPECT_NE(nullptr, diagnostic); + EXPECT_THAT(diagnostic->error, Eq(std::string("Missing assembly text."))); +} + +TEST_F(TextToBinaryTest, InvalidPointer) { + SetText( + "OpEntryPoint Kernel 0 \"\"\nOpExecutionMode 0 LocalSizeHint 1 1 1\n"); + ASSERT_EQ(SPV_ERROR_INVALID_POINTER, + spvTextToBinary(ScopedContext().context, text.str, text.length, + nullptr, &diagnostic)); +} + +TEST_F(TextToBinaryTest, InvalidPrefix) { + EXPECT_EQ( + "Expected or at the beginning of an instruction, " + "found 'Invalid'.", + CompileFailure("Invalid")); +} + +TEST_F(TextToBinaryTest, EmptyAssemblyString) { + // An empty assembly module is valid! + // It should produce a valid module with zero instructions. + EXPECT_THAT(CompiledInstructions(""), Eq(std::vector{})); +} + +TEST_F(TextToBinaryTest, StringSpace) { + const std::string code = ("OpSourceExtension \"string with spaces\"\n"); + EXPECT_EQ(code, EncodeAndDecodeSuccessfully(code)); +} + +TEST_F(TextToBinaryTest, UnknownBeginningOfInstruction) { + EXPECT_EQ( + "Expected or at the beginning of an instruction, " + "found 'Google'.", + CompileFailure( + "\nOpSource OpenCL_C 12\nOpMemoryModel Physical64 OpenCL\nGoogle\n")); + EXPECT_EQ(4u, diagnostic->position.line + 1); + EXPECT_EQ(1u, diagnostic->position.column + 1); +} + +TEST_F(TextToBinaryTest, NoEqualSign) { + EXPECT_EQ("Expected '=', found end of stream.", + CompileFailure("\nOpSource OpenCL_C 12\n" + "OpMemoryModel Physical64 OpenCL\n%2\n")); + EXPECT_EQ(5u, diagnostic->position.line + 1); + EXPECT_EQ(1u, diagnostic->position.column + 1); +} + +TEST_F(TextToBinaryTest, NoOpCode) { + EXPECT_EQ("Expected opcode, found end of stream.", + CompileFailure("\nOpSource OpenCL_C 12\n" + "OpMemoryModel Physical64 OpenCL\n%2 =\n")); + EXPECT_EQ(5u, diagnostic->position.line + 1); + EXPECT_EQ(1u, diagnostic->position.column + 1); +} + +TEST_F(TextToBinaryTest, WrongOpCode) { + EXPECT_EQ("Invalid Opcode prefix 'Wahahaha'.", + CompileFailure("\nOpSource OpenCL_C 12\n" + "OpMemoryModel Physical64 OpenCL\n%2 = Wahahaha\n")); + EXPECT_EQ(4u, diagnostic->position.line + 1); + EXPECT_EQ(6u, diagnostic->position.column + 1); +} + +TEST_F(TextToBinaryTest, CRLF) { + const std::string input = + "%i32 = OpTypeInt 32 1\r\n%c = OpConstant %i32 123\r\n"; + EXPECT_THAT(CompiledInstructions(input), + Eq(Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}), + MakeInstruction(SpvOpConstant, {1, 2, 123})}))); +} + +using TextToBinaryFloatValueTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(TextToBinaryFloatValueTest, Samples) { + const std::string input = + "%1 = OpTypeFloat 32\n%2 = OpConstant %1 " + GetParam().first; + EXPECT_THAT(CompiledInstructions(input), + Eq(Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}), + MakeInstruction(SpvOpConstant, + {1, 2, GetParam().second})}))); +} + +INSTANTIATE_TEST_CASE_P( + FloatValues, TextToBinaryFloatValueTest, + ::testing::ValuesIn(std::vector>{ + {"0.0", 0x00000000}, // +0 + {"!0x00000001", 0x00000001}, // +denorm + {"!0x00800000", 0x00800000}, // +norm + {"1.5", 0x3fc00000}, + {"!0x7f800000", 0x7f800000}, // +inf + {"!0x7f800001", 0x7f800001}, // NaN + + {"-0.0", 0x80000000}, // -0 + {"!0x80000001", 0x80000001}, // -denorm + {"!0x80800000", 0x80800000}, // -norm + {"-2.5", 0xc0200000}, + {"!0xff800000", 0xff800000}, // -inf + {"!0xff800001", 0xff800001}, // NaN + }), ); + +using TextToBinaryHalfValueTest = spvtest::TextToBinaryTestBase< + ::testing::TestWithParam>>; + +TEST_P(TextToBinaryHalfValueTest, Samples) { + const std::string input = + "%1 = OpTypeFloat 16\n%2 = OpConstant %1 " + GetParam().first; + EXPECT_THAT(CompiledInstructions(input), + Eq(Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 16}), + MakeInstruction(SpvOpConstant, + {1, 2, GetParam().second})}))); +} + +INSTANTIATE_TEST_CASE_P( + HalfValues, TextToBinaryHalfValueTest, + ::testing::ValuesIn(std::vector>{ + {"0.0", 0x00000000}, + {"1.0", 0x00003c00}, + {"1.000844", 0x00003c00}, // Truncate to 1.0 + {"1.000977", 0x00003c01}, // Don't have to truncate + {"1.001465", 0x00003c01}, // Truncate to 1.0000977 + {"1.5", 0x00003e00}, + {"-1.0", 0x0000bc00}, + {"2.0", 0x00004000}, + {"-2.0", 0x0000c000}, + {"0x1p1", 0x00004000}, + {"-0x1p1", 0x0000c000}, + {"0x1.8p1", 0x00004200}, + {"0x1.8p4", 0x00004e00}, + {"0x1.801p4", 0x00004e00}, + {"0x1.804p4", 0x00004e01}, + }), ); + +TEST(CreateContext, InvalidEnvironment) { + spv_target_env env; + std::memset(&env, 99, sizeof(env)); + EXPECT_THAT(spvContextCreate(env), IsNull()); +} + +TEST(CreateContext, UniversalEnvironment) { + auto c = spvContextCreate(SPV_ENV_UNIVERSAL_1_0); + EXPECT_THAT(c, NotNull()); + spvContextDestroy(c); +} + +TEST(CreateContext, VulkanEnvironment) { + auto c = spvContextCreate(SPV_ENV_VULKAN_1_0); + EXPECT_THAT(c, NotNull()); + spvContextDestroy(c); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/text_word_get_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_word_get_test.cpp new file mode 100644 index 00000000000..b74a680fa75 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/text_word_get_test.cpp @@ -0,0 +1,254 @@ +// Copyright (c) 2015-2016 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. + +#include + +#include "test/unit_spirv.h" + +namespace spvtools { +namespace { + +using spvtest::AutoText; + +#define TAB "\t" +#define NEWLINE "\n" +#define BACKSLASH R"(\)" +#define QUOTE R"(")" + +TEST(TextWordGet, NullTerminator) { + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ( + SPV_SUCCESS, + AssemblyContext(AutoText("Word"), nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(4u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(4u, endPosition.index); + ASSERT_STREQ("Word", word.c_str()); +} + +TEST(TextWordGet, TabTerminator) { + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, AssemblyContext(AutoText("Word\t"), nullptr) + .getWord(&word, &endPosition)); + ASSERT_EQ(4u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(4u, endPosition.index); + ASSERT_STREQ("Word", word.c_str()); +} + +TEST(TextWordGet, SpaceTerminator) { + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ( + SPV_SUCCESS, + AssemblyContext(AutoText("Word "), nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(4u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(4u, endPosition.index); + ASSERT_STREQ("Word", word.c_str()); +} + +TEST(TextWordGet, SemicolonTerminator) { + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ( + SPV_SUCCESS, + AssemblyContext(AutoText("Wo;rd"), nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(2u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(2u, endPosition.index); + ASSERT_STREQ("Wo", word.c_str()); +} + +TEST(TextWordGet, NoTerminator) { + const std::string full_text = "abcdefghijklmn"; + for (size_t len = 1; len <= full_text.size(); ++len) { + std::string word; + spv_text_t text = {full_text.data(), len}; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(&text, nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(len, endPosition.column); + ASSERT_EQ(len, endPosition.index); + ASSERT_EQ(full_text.substr(0, len), word); + } +} + +TEST(TextWordGet, MultipleWords) { + AutoText input("Words in a sentence"); + AssemblyContext data(input, nullptr); + + spv_position_t endPosition = {}; + const char* words[] = {"Words", "in", "a", "sentence"}; + + std::string word; + for (uint32_t wordIndex = 0; wordIndex < 4; ++wordIndex) { + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &endPosition)); + ASSERT_EQ(strlen(words[wordIndex]), + endPosition.column - data.position().column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(strlen(words[wordIndex]), + endPosition.index - data.position().index); + ASSERT_STREQ(words[wordIndex], word.c_str()); + + data.setPosition(endPosition); + if (3 != wordIndex) { + ASSERT_EQ(SPV_SUCCESS, data.advance()); + } else { + ASSERT_EQ(SPV_END_OF_STREAM, data.advance()); + } + } +} + +TEST(TextWordGet, QuotesAreKept) { + AutoText input(R"("quotes" "around words")"); + const char* expected[] = {R"("quotes")", R"("around words")"}; + AssemblyContext data(input, nullptr); + + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &endPosition)); + EXPECT_EQ(8u, endPosition.column); + EXPECT_EQ(0u, endPosition.line); + EXPECT_EQ(8u, endPosition.index); + EXPECT_STREQ(expected[0], word.c_str()); + + // Move to the next word. + data.setPosition(endPosition); + data.seekForward(1); + + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &endPosition)); + EXPECT_EQ(23u, endPosition.column); + EXPECT_EQ(0u, endPosition.line); + EXPECT_EQ(23u, endPosition.index); + EXPECT_STREQ(expected[1], word.c_str()); +} + +TEST(TextWordGet, QuotesBetweenWordsActLikeGlue) { + AutoText input(R"(quotes" "between words)"); + const char* expected[] = {R"(quotes" "between)", "words"}; + AssemblyContext data(input, nullptr); + + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &endPosition)); + EXPECT_EQ(16u, endPosition.column); + EXPECT_EQ(0u, endPosition.line); + EXPECT_EQ(16u, endPosition.index); + EXPECT_STREQ(expected[0], word.c_str()); + + // Move to the next word. + data.setPosition(endPosition); + data.seekForward(1); + + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &endPosition)); + EXPECT_EQ(22u, endPosition.column); + EXPECT_EQ(0u, endPosition.line); + EXPECT_EQ(22u, endPosition.index); + EXPECT_STREQ(expected[1], word.c_str()); +} + +TEST(TextWordGet, QuotingWhitespace) { + AutoText input(QUOTE "white " NEWLINE TAB " space" QUOTE); + // Whitespace surrounded by quotes acts like glue. + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(input, nullptr).getWord(&word, &endPosition)); + EXPECT_EQ(input.str.length(), endPosition.column); + EXPECT_EQ(0u, endPosition.line); + EXPECT_EQ(input.str.length(), endPosition.index); + EXPECT_EQ(input.str, word); +} + +TEST(TextWordGet, QuoteAlone) { + AutoText input(QUOTE); + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(input, nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(1u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(1u, endPosition.index); + ASSERT_STREQ(QUOTE, word.c_str()); +} + +TEST(TextWordGet, EscapeAlone) { + AutoText input(BACKSLASH); + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(input, nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(1u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(1u, endPosition.index); + ASSERT_STREQ(BACKSLASH, word.c_str()); +} + +TEST(TextWordGet, EscapeAtEndOfInput) { + AutoText input("word" BACKSLASH); + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(input, nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(5u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(5u, endPosition.index); + ASSERT_STREQ("word" BACKSLASH, word.c_str()); +} + +TEST(TextWordGet, Escaping) { + AutoText input("w" BACKSLASH QUOTE "o" BACKSLASH NEWLINE "r" BACKSLASH ";d"); + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(input, nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(10u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(10u, endPosition.index); + ASSERT_EQ(input.str, word); +} + +TEST(TextWordGet, EscapingEscape) { + AutoText input("word" BACKSLASH BACKSLASH " abc"); + std::string word; + spv_position_t endPosition = {}; + ASSERT_EQ(SPV_SUCCESS, + AssemblyContext(input, nullptr).getWord(&word, &endPosition)); + ASSERT_EQ(6u, endPosition.column); + ASSERT_EQ(0u, endPosition.line); + ASSERT_EQ(6u, endPosition.index); + ASSERT_STREQ("word" BACKSLASH BACKSLASH, word.c_str()); +} + +TEST(TextWordGet, CRLF) { + AutoText input("abc\r\nd"); + AssemblyContext data(input, nullptr); + std::string word; + spv_position_t pos = {}; + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &pos)); + EXPECT_EQ(3u, pos.column); + EXPECT_STREQ("abc", word.c_str()); + data.setPosition(pos); + data.advance(); + ASSERT_EQ(SPV_SUCCESS, data.getWord(&word, &pos)); + EXPECT_EQ(1u, pos.column); + EXPECT_STREQ("d", word.c_str()); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/timer_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/timer_test.cpp new file mode 100644 index 00000000000..e53af66538b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/timer_test.cpp @@ -0,0 +1,142 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/util/timer.h" + +namespace spvtools { +namespace utils { +namespace { + +// A mock class to mimic Timer class for a testing purpose. It has fixed +// CPU/WALL/USR/SYS time, RSS delta, and the delta of the number of page faults. +class MockTimer : public Timer { + public: + MockTimer(std::ostream* out, bool measure_mem_usage = false) + : Timer(out, measure_mem_usage) {} + double CPUTime() override { return 0.019123; } + double WallTime() override { return 0.019723; } + double UserTime() override { return 0.012723; } + double SystemTime() override { return 0.002723; } + long RSS() const override { return 360L; } + long PageFault() const override { return 3600L; } +}; + +// This unit test checks whether the actual output of MockTimer::Report() is the +// same as fixed CPU/WALL/USR/SYS time, RSS delta, and the delta of the number +// of page faults that are returned by MockTimer. +TEST(MockTimer, DoNothing) { + std::ostringstream buf; + + PrintTimerDescription(&buf); + MockTimer timer(&buf); + timer.Start(); + + // Do nothing. + + timer.Stop(); + timer.Report("TimerTest"); + + EXPECT_EQ(0.019123, timer.CPUTime()); + EXPECT_EQ(0.019723, timer.WallTime()); + EXPECT_EQ(0.012723, timer.UserTime()); + EXPECT_EQ(0.002723, timer.SystemTime()); + EXPECT_EQ( + " PASS name CPU time WALL time USR time" + " SYS time\n TimerTest 0.02 0.02" + " 0.01 0.00\n", + buf.str()); +} + +// This unit test checks whether the ScopedTimer correctly reports +// the fixed CPU/WALL/USR/SYS time, RSS delta, and the delta of the number of +// page faults that are returned by MockTimer. +TEST(MockTimer, TestScopedTimer) { + std::ostringstream buf; + + { + ScopedTimer scopedtimer(&buf, "ScopedTimerTest"); + // Do nothing. + } + + EXPECT_EQ( + " ScopedTimerTest 0.02 0.02 0.01" + " 0.00\n", + buf.str()); +} + +// A mock class to mimic CumulativeTimer class for a testing purpose. It has +// fixed CPU/WALL/USR/SYS time, RSS delta, and the delta of the number of page +// faults for each measurement (i.e., a pair of Start() and Stop()). If the +// number of measurements increases, it increases |count_stop_| by the number of +// calling Stop() and the amount of each resource usage is proportional to +// |count_stop_|. +class MockCumulativeTimer : public CumulativeTimer { + public: + MockCumulativeTimer(std::ostream* out, bool measure_mem_usage = false) + : CumulativeTimer(out, measure_mem_usage), count_stop_(0) {} + double CPUTime() override { return count_stop_ * 0.019123; } + double WallTime() override { return count_stop_ * 0.019723; } + double UserTime() override { return count_stop_ * 0.012723; } + double SystemTime() override { return count_stop_ * 0.002723; } + long RSS() const override { return count_stop_ * 360L; } + long PageFault() const override { return count_stop_ * 3600L; } + + // Calling Stop() does nothing but just increases |count_stop_| by 1. + void Stop() override { ++count_stop_; }; + + private: + unsigned int count_stop_; +}; + +// This unit test checks whether the MockCumulativeTimer correctly reports the +// cumulative CPU/WALL/USR/SYS time, RSS delta, and the delta of the number of +// page faults whose values are fixed for each measurement (i.e., a pair of +// Start() and Stop()). +TEST(MockCumulativeTimer, DoNothing) { + CumulativeTimer* ctimer; + std::ostringstream buf; + + { + ctimer = new MockCumulativeTimer(&buf); + ctimer->Start(); + + // Do nothing. + + ctimer->Stop(); + } + + { + ctimer->Start(); + + // Do nothing. + + ctimer->Stop(); + ctimer->Report("CumulativeTimerTest"); + } + + EXPECT_EQ( + " CumulativeTimerTest 0.04 0.04 0.03" + " 0.01\n", + buf.str()); + + if (ctimer) delete ctimer; +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/CMakeLists.txt new file mode 100644 index 00000000000..cee95cadbdc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/CMakeLists.txt @@ -0,0 +1,18 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +spirv_add_nosetests(expect) +spirv_add_nosetests(spirv_test_framework) + +add_subdirectory(opt) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/expect.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/expect.py new file mode 100644 index 00000000000..c9596506add --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/expect.py @@ -0,0 +1,677 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 number of common spirv result checks coded in mixin classes. + +A test case can use these checks by declaring their enclosing mixin classes +as superclass and providing the expected_* variables required by the check_*() +methods in the mixin classes. +""" +import difflib +import os +import re +import subprocess +from spirv_test_framework import SpirvTest + + +def convert_to_unix_line_endings(source): + """Converts all line endings in source to be unix line endings.""" + return source.replace('\r\n', '\n').replace('\r', '\n') + + +def substitute_file_extension(filename, extension): + """Substitutes file extension, respecting known shader extensions. + + foo.vert -> foo.vert.[extension] [similarly for .frag, .comp, etc.] + foo.glsl -> foo.[extension] + foo.unknown -> foo.[extension] + foo -> foo.[extension] + """ + if filename[-5:] not in [ + '.vert', '.frag', '.tesc', '.tese', '.geom', '.comp', '.spvasm' + ]: + return filename.rsplit('.', 1)[0] + '.' + extension + else: + return filename + '.' + extension + + +def get_object_filename(source_filename): + """Gets the object filename for the given source file.""" + return substitute_file_extension(source_filename, 'spv') + + +def get_assembly_filename(source_filename): + """Gets the assembly filename for the given source file.""" + return substitute_file_extension(source_filename, 'spvasm') + + +def verify_file_non_empty(filename): + """Checks that a given file exists and is not empty.""" + if not os.path.isfile(filename): + return False, 'Cannot find file: ' + filename + if not os.path.getsize(filename): + return False, 'Empty file: ' + filename + return True, '' + + +class ReturnCodeIsZero(SpirvTest): + """Mixin class for checking that the return code is zero.""" + + def check_return_code_is_zero(self, status): + if status.returncode: + return False, 'Non-zero return code: {ret}\n'.format( + ret=status.returncode) + return True, '' + + +class NoOutputOnStdout(SpirvTest): + """Mixin class for checking that there is no output on stdout.""" + + def check_no_output_on_stdout(self, status): + if status.stdout: + return False, 'Non empty stdout: {out}\n'.format(out=status.stdout) + return True, '' + + +class NoOutputOnStderr(SpirvTest): + """Mixin class for checking that there is no output on stderr.""" + + def check_no_output_on_stderr(self, status): + if status.stderr: + return False, 'Non empty stderr: {err}\n'.format(err=status.stderr) + return True, '' + + +class SuccessfulReturn(ReturnCodeIsZero, NoOutputOnStdout, NoOutputOnStderr): + """Mixin class for checking that return code is zero and no output on + stdout and stderr.""" + pass + + +class NoGeneratedFiles(SpirvTest): + """Mixin class for checking that there is no file generated.""" + + def check_no_generated_files(self, status): + all_files = os.listdir(status.directory) + input_files = status.input_filenames + if all([f.startswith(status.directory) for f in input_files]): + all_files = [os.path.join(status.directory, f) for f in all_files] + generated_files = set(all_files) - set(input_files) + if len(generated_files) == 0: + return True, '' + else: + return False, 'Extra files generated: {}'.format(generated_files) + + +class CorrectBinaryLengthAndPreamble(SpirvTest): + """Provides methods for verifying preamble for a SPIR-V binary.""" + + def verify_binary_length_and_header(self, binary, spv_version=0x10000): + """Checks that the given SPIR-V binary has valid length and header. + + Returns: + False, error string if anything is invalid + True, '' otherwise + Args: + binary: a bytes object containing the SPIR-V binary + spv_version: target SPIR-V version number, with same encoding + as the version word in a SPIR-V header. + """ + + def read_word(binary, index, little_endian): + """Reads the index-th word from the given binary file.""" + word = binary[index * 4:(index + 1) * 4] + if little_endian: + word = reversed(word) + return reduce(lambda w, b: (w << 8) | ord(b), word, 0) + + def check_endianness(binary): + """Checks the endianness of the given SPIR-V binary. + + Returns: + True if it's little endian, False if it's big endian. + None if magic number is wrong. + """ + first_word = read_word(binary, 0, True) + if first_word == 0x07230203: + return True + first_word = read_word(binary, 0, False) + if first_word == 0x07230203: + return False + return None + + num_bytes = len(binary) + if num_bytes % 4 != 0: + return False, ('Incorrect SPV binary: size should be a multiple' + ' of words') + if num_bytes < 20: + return False, 'Incorrect SPV binary: size less than 5 words' + + preamble = binary[0:19] + little_endian = check_endianness(preamble) + # SPIR-V module magic number + if little_endian is None: + return False, 'Incorrect SPV binary: wrong magic number' + + # SPIR-V version number + version = read_word(preamble, 1, little_endian) + # TODO(dneto): Recent Glslang uses version word 0 for opengl_compat + # profile + + if version != spv_version and version != 0: + return False, 'Incorrect SPV binary: wrong version number' + # Shaderc-over-Glslang (0x000d....) or + # SPIRV-Tools (0x0007....) generator number + if read_word(preamble, 2, little_endian) != 0x000d0007 and \ + read_word(preamble, 2, little_endian) != 0x00070000: + return False, ('Incorrect SPV binary: wrong generator magic ' 'number') + # reserved for instruction schema + if read_word(preamble, 4, little_endian) != 0: + return False, 'Incorrect SPV binary: the 5th byte should be 0' + + return True, '' + + +class CorrectObjectFilePreamble(CorrectBinaryLengthAndPreamble): + """Provides methods for verifying preamble for a SPV object file.""" + + def verify_object_file_preamble(self, filename, spv_version=0x10000): + """Checks that the given SPIR-V binary file has correct preamble.""" + + success, message = verify_file_non_empty(filename) + if not success: + return False, message + + with open(filename, 'rb') as object_file: + object_file.seek(0, os.SEEK_END) + num_bytes = object_file.tell() + + object_file.seek(0) + + binary = bytes(object_file.read()) + return self.verify_binary_length_and_header(binary, spv_version) + + return True, '' + + +class CorrectAssemblyFilePreamble(SpirvTest): + """Provides methods for verifying preamble for a SPV assembly file.""" + + def verify_assembly_file_preamble(self, filename): + success, message = verify_file_non_empty(filename) + if not success: + return False, message + + with open(filename) as assembly_file: + line1 = assembly_file.readline() + line2 = assembly_file.readline() + line3 = assembly_file.readline() + + if (line1 != '; SPIR-V\n' or line2 != '; Version: 1.0\n' or + (not line3.startswith('; Generator: Google Shaderc over Glslang;'))): + return False, 'Incorrect SPV assembly' + + return True, '' + + +class ValidObjectFile(SuccessfulReturn, CorrectObjectFilePreamble): + """Mixin class for checking that every input file generates a valid SPIR-V 1.0 + object file following the object file naming rule, and there is no output on + stdout/stderr.""" + + def check_object_file_preamble(self, status): + for input_filename in status.input_filenames: + object_filename = get_object_filename(input_filename) + success, message = self.verify_object_file_preamble( + os.path.join(status.directory, object_filename)) + if not success: + return False, message + return True, '' + + +class ValidObjectFile1_3(ReturnCodeIsZero, CorrectObjectFilePreamble): + """Mixin class for checking that every input file generates a valid SPIR-V 1.3 + object file following the object file naming rule, and there is no output on + stdout/stderr.""" + + def check_object_file_preamble(self, status): + for input_filename in status.input_filenames: + object_filename = get_object_filename(input_filename) + success, message = self.verify_object_file_preamble( + os.path.join(status.directory, object_filename), 0x10300) + if not success: + return False, message + return True, '' + + +class ValidObjectFileWithAssemblySubstr(SuccessfulReturn, + CorrectObjectFilePreamble): + """Mixin class for checking that every input file generates a valid object + + file following the object file naming rule, there is no output on + stdout/stderr, and the disassmbly contains a specified substring per + input. + """ + + def check_object_file_disassembly(self, status): + for an_input in status.inputs: + object_filename = get_object_filename(an_input.filename) + obj_file = str(os.path.join(status.directory, object_filename)) + success, message = self.verify_object_file_preamble(obj_file) + if not success: + return False, message + cmd = [status.test_manager.disassembler_path, '--no-color', obj_file] + process = subprocess.Popen( + args=cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=status.directory) + output = process.communicate(None) + disassembly = output[0] + if not isinstance(an_input.assembly_substr, str): + return False, 'Missing assembly_substr member' + if an_input.assembly_substr not in disassembly: + return False, ('Incorrect disassembly output:\n{asm}\n' + 'Expected substring not found:\n{exp}'.format( + asm=disassembly, exp=an_input.assembly_substr)) + return True, '' + + +class ValidNamedObjectFile(SuccessfulReturn, CorrectObjectFilePreamble): + """Mixin class for checking that a list of object files with the given + names are correctly generated, and there is no output on stdout/stderr. + + To mix in this class, subclasses need to provide expected_object_filenames + as the expected object filenames. + """ + + def check_object_file_preamble(self, status): + for object_filename in self.expected_object_filenames: + success, message = self.verify_object_file_preamble( + os.path.join(status.directory, object_filename)) + if not success: + return False, message + return True, '' + + +class ValidFileContents(SpirvTest): + """Mixin class to test that a specific file contains specific text + To mix in this class, subclasses need to provide expected_file_contents as + the contents of the file and target_filename to determine the location.""" + + def check_file(self, status): + target_filename = os.path.join(status.directory, self.target_filename) + if not os.path.isfile(target_filename): + return False, 'Cannot find file: ' + target_filename + with open(target_filename, 'r') as target_file: + file_contents = target_file.read() + if isinstance(self.expected_file_contents, str): + if file_contents == self.expected_file_contents: + return True, '' + return False, ('Incorrect file output: \n{act}\n' + 'Expected:\n{exp}' + 'With diff:\n{diff}'.format( + act=file_contents, + exp=self.expected_file_contents, + diff='\n'.join( + list( + difflib.unified_diff( + self.expected_file_contents.split('\n'), + file_contents.split('\n'), + fromfile='expected_output', + tofile='actual_output'))))) + elif isinstance(self.expected_file_contents, type(re.compile(''))): + if self.expected_file_contents.search(file_contents): + return True, '' + return False, ('Incorrect file output: \n{act}\n' + 'Expected matching regex pattern:\n{exp}'.format( + act=file_contents, + exp=self.expected_file_contents.pattern)) + return False, ( + 'Could not open target file ' + target_filename + ' for reading') + + +class ValidAssemblyFile(SuccessfulReturn, CorrectAssemblyFilePreamble): + """Mixin class for checking that every input file generates a valid assembly + file following the assembly file naming rule, and there is no output on + stdout/stderr.""" + + def check_assembly_file_preamble(self, status): + for input_filename in status.input_filenames: + assembly_filename = get_assembly_filename(input_filename) + success, message = self.verify_assembly_file_preamble( + os.path.join(status.directory, assembly_filename)) + if not success: + return False, message + return True, '' + + +class ValidAssemblyFileWithSubstr(ValidAssemblyFile): + """Mixin class for checking that every input file generates a valid assembly + file following the assembly file naming rule, there is no output on + stdout/stderr, and all assembly files have the given substring specified + by expected_assembly_substr. + + To mix in this class, subclasses need to provde expected_assembly_substr + as the expected substring. + """ + + def check_assembly_with_substr(self, status): + for input_filename in status.input_filenames: + assembly_filename = get_assembly_filename(input_filename) + success, message = self.verify_assembly_file_preamble( + os.path.join(status.directory, assembly_filename)) + if not success: + return False, message + with open(assembly_filename, 'r') as f: + content = f.read() + if self.expected_assembly_substr not in convert_to_unix_line_endings( + content): + return False, ('Incorrect assembly output:\n{asm}\n' + 'Expected substring not found:\n{exp}'.format( + asm=content, exp=self.expected_assembly_substr)) + return True, '' + + +class ValidAssemblyFileWithoutSubstr(ValidAssemblyFile): + """Mixin class for checking that every input file generates a valid assembly + file following the assembly file naming rule, there is no output on + stdout/stderr, and no assembly files have the given substring specified + by unexpected_assembly_substr. + + To mix in this class, subclasses need to provde unexpected_assembly_substr + as the substring we expect not to see. + """ + + def check_assembly_for_substr(self, status): + for input_filename in status.input_filenames: + assembly_filename = get_assembly_filename(input_filename) + success, message = self.verify_assembly_file_preamble( + os.path.join(status.directory, assembly_filename)) + if not success: + return False, message + with open(assembly_filename, 'r') as f: + content = f.read() + if self.unexpected_assembly_substr in convert_to_unix_line_endings( + content): + return False, ('Incorrect assembly output:\n{asm}\n' + 'Unexpected substring found:\n{unexp}'.format( + asm=content, exp=self.unexpected_assembly_substr)) + return True, '' + + +class ValidNamedAssemblyFile(SuccessfulReturn, CorrectAssemblyFilePreamble): + """Mixin class for checking that a list of assembly files with the given + names are correctly generated, and there is no output on stdout/stderr. + + To mix in this class, subclasses need to provide expected_assembly_filenames + as the expected assembly filenames. + """ + + def check_object_file_preamble(self, status): + for assembly_filename in self.expected_assembly_filenames: + success, message = self.verify_assembly_file_preamble( + os.path.join(status.directory, assembly_filename)) + if not success: + return False, message + return True, '' + + +class ErrorMessage(SpirvTest): + """Mixin class for tests that fail with a specific error message. + + To mix in this class, subclasses need to provide expected_error as the + expected error message. + + The test should fail if the subprocess was terminated by a signal. + """ + + def check_has_error_message(self, status): + if not status.returncode: + return False, ('Expected error message, but returned success from ' + 'command execution') + if status.returncode < 0: + # On Unix, a negative value -N for Popen.returncode indicates + # termination by signal N. + # https://docs.python.org/2/library/subprocess.html + return False, ('Expected error message, but command was terminated by ' + 'signal ' + str(status.returncode)) + if not status.stderr: + return False, 'Expected error message, but no output on stderr' + if self.expected_error != convert_to_unix_line_endings(status.stderr): + return False, ('Incorrect stderr output:\n{act}\n' + 'Expected:\n{exp}'.format( + act=status.stderr, exp=self.expected_error)) + return True, '' + + +class ErrorMessageSubstr(SpirvTest): + """Mixin class for tests that fail with a specific substring in the error + message. + + To mix in this class, subclasses need to provide expected_error_substr as + the expected error message substring. + + The test should fail if the subprocess was terminated by a signal. + """ + + def check_has_error_message_as_substring(self, status): + if not status.returncode: + return False, ('Expected error message, but returned success from ' + 'command execution') + if status.returncode < 0: + # On Unix, a negative value -N for Popen.returncode indicates + # termination by signal N. + # https://docs.python.org/2/library/subprocess.html + return False, ('Expected error message, but command was terminated by ' + 'signal ' + str(status.returncode)) + if not status.stderr: + return False, 'Expected error message, but no output on stderr' + if self.expected_error_substr not in convert_to_unix_line_endings( + status.stderr): + return False, ('Incorrect stderr output:\n{act}\n' + 'Expected substring not found in stderr:\n{exp}'.format( + act=status.stderr, exp=self.expected_error_substr)) + return True, '' + + +class WarningMessage(SpirvTest): + """Mixin class for tests that succeed but have a specific warning message. + + To mix in this class, subclasses need to provide expected_warning as the + expected warning message. + """ + + def check_has_warning_message(self, status): + if status.returncode: + return False, ('Expected warning message, but returned failure from' + ' command execution') + if not status.stderr: + return False, 'Expected warning message, but no output on stderr' + if self.expected_warning != convert_to_unix_line_endings(status.stderr): + return False, ('Incorrect stderr output:\n{act}\n' + 'Expected:\n{exp}'.format( + act=status.stderr, exp=self.expected_warning)) + return True, '' + + +class ValidObjectFileWithWarning(NoOutputOnStdout, CorrectObjectFilePreamble, + WarningMessage): + """Mixin class for checking that every input file generates a valid object + file following the object file naming rule, with a specific warning message. + """ + + def check_object_file_preamble(self, status): + for input_filename in status.input_filenames: + object_filename = get_object_filename(input_filename) + success, message = self.verify_object_file_preamble( + os.path.join(status.directory, object_filename)) + if not success: + return False, message + return True, '' + + +class ValidAssemblyFileWithWarning(NoOutputOnStdout, + CorrectAssemblyFilePreamble, WarningMessage): + """Mixin class for checking that every input file generates a valid assembly + file following the assembly file naming rule, with a specific warning + message.""" + + def check_assembly_file_preamble(self, status): + for input_filename in status.input_filenames: + assembly_filename = get_assembly_filename(input_filename) + success, message = self.verify_assembly_file_preamble( + os.path.join(status.directory, assembly_filename)) + if not success: + return False, message + return True, '' + + +class StdoutMatch(SpirvTest): + """Mixin class for tests that can expect output on stdout. + + To mix in this class, subclasses need to provide expected_stdout as the + expected stdout output. + + For expected_stdout, if it's True, then they expect something on stdout but + will not check what it is. If it's a string, expect an exact match. If it's + anything else, it is assumed to be a compiled regular expression which will + be matched against re.search(). It will expect + expected_stdout.search(status.stdout) to be true. + """ + + def check_stdout_match(self, status): + # "True" in this case means we expect something on stdout, but we do not + # care what it is, we want to distinguish this from "blah" which means we + # expect exactly the string "blah". + if self.expected_stdout is True: + if not status.stdout: + return False, 'Expected something on stdout' + elif type(self.expected_stdout) == str: + if self.expected_stdout != convert_to_unix_line_endings(status.stdout): + return False, ('Incorrect stdout output:\n{ac}\n' + 'Expected:\n{ex}'.format( + ac=status.stdout, ex=self.expected_stdout)) + else: + if not self.expected_stdout.search( + convert_to_unix_line_endings(status.stdout)): + return False, ('Incorrect stdout output:\n{ac}\n' + 'Expected to match regex:\n{ex}'.format( + ac=status.stdout, ex=self.expected_stdout.pattern)) + return True, '' + + +class StderrMatch(SpirvTest): + """Mixin class for tests that can expect output on stderr. + + To mix in this class, subclasses need to provide expected_stderr as the + expected stderr output. + + For expected_stderr, if it's True, then they expect something on stderr, + but will not check what it is. If it's a string, expect an exact match. + If it's anything else, it is assumed to be a compiled regular expression + which will be matched against re.search(). It will expect + expected_stderr.search(status.stderr) to be true. + """ + + def check_stderr_match(self, status): + # "True" in this case means we expect something on stderr, but we do not + # care what it is, we want to distinguish this from "blah" which means we + # expect exactly the string "blah". + if self.expected_stderr is True: + if not status.stderr: + return False, 'Expected something on stderr' + elif type(self.expected_stderr) == str: + if self.expected_stderr != convert_to_unix_line_endings(status.stderr): + return False, ('Incorrect stderr output:\n{ac}\n' + 'Expected:\n{ex}'.format( + ac=status.stderr, ex=self.expected_stderr)) + else: + if not self.expected_stderr.search( + convert_to_unix_line_endings(status.stderr)): + return False, ('Incorrect stderr output:\n{ac}\n' + 'Expected to match regex:\n{ex}'.format( + ac=status.stderr, ex=self.expected_stderr.pattern)) + return True, '' + + +class StdoutNoWiderThan80Columns(SpirvTest): + """Mixin class for tests that require stdout to 80 characters or narrower. + + To mix in this class, subclasses need to provide expected_stdout as the + expected stdout output. + """ + + def check_stdout_not_too_wide(self, status): + if not status.stdout: + return True, '' + else: + for line in status.stdout.splitlines(): + if len(line) > 80: + return False, ('Stdout line longer than 80 columns: %s' % line) + return True, '' + + +class NoObjectFile(SpirvTest): + """Mixin class for checking that no input file has a corresponding object + file.""" + + def check_no_object_file(self, status): + for input_filename in status.input_filenames: + object_filename = get_object_filename(input_filename) + full_object_file = os.path.join(status.directory, object_filename) + print('checking %s' % full_object_file) + if os.path.isfile(full_object_file): + return False, ( + 'Expected no object file, but found: %s' % full_object_file) + return True, '' + + +class NoNamedOutputFiles(SpirvTest): + """Mixin class for checking that no specified output files exist. + + The expected_output_filenames member should be full pathnames.""" + + def check_no_named_output_files(self, status): + for object_filename in self.expected_output_filenames: + if os.path.isfile(object_filename): + return False, ( + 'Expected no output file, but found: %s' % object_filename) + return True, '' + + +class ExecutedListOfPasses(SpirvTest): + """Mixin class for checking that a list of passes where executed. + + It works by analyzing the output of the --print-all flag to spirv-opt. + + For this mixin to work, the class member expected_passes should be a sequence + of pass names as returned by Pass::name(). + """ + + def check_list_of_executed_passes(self, status): + # Collect all the output lines containing a pass name. + pass_names = [] + pass_name_re = re.compile(r'.*IR before pass (?P[\S]+)') + for line in status.stderr.splitlines(): + match = pass_name_re.match(line) + if match: + pass_names.append(match.group('pass_name')) + + for (expected, actual) in zip(self.expected_passes, pass_names): + if expected != actual: + return False, ( + 'Expected pass "%s" but found pass "%s"\n' % (expected, actual)) + + return True, '' diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/expect_nosetest.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/expect_nosetest.py new file mode 100644 index 00000000000..b591a2d0766 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/expect_nosetest.py @@ -0,0 +1,80 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Tests for the expect module.""" + +import expect +from spirv_test_framework import TestStatus +from nose.tools import assert_equal, assert_true, assert_false +import re + + +def nosetest_get_object_name(): + """Tests get_object_filename().""" + source_and_object_names = [('a.vert', 'a.vert.spv'), ('b.frag', 'b.frag.spv'), + ('c.tesc', 'c.tesc.spv'), ('d.tese', 'd.tese.spv'), + ('e.geom', 'e.geom.spv'), ('f.comp', 'f.comp.spv'), + ('file', 'file.spv'), ('file.', 'file.spv'), + ('file.uk', + 'file.spv'), ('file.vert.', + 'file.vert.spv'), ('file.vert.bla', + 'file.vert.spv')] + actual_object_names = [ + expect.get_object_filename(f[0]) for f in source_and_object_names + ] + expected_object_names = [f[1] for f in source_and_object_names] + + assert_equal(actual_object_names, expected_object_names) + + +class TestStdoutMatchADotC(expect.StdoutMatch): + expected_stdout = re.compile('a.c') + + +def nosetest_stdout_match_regex_has_match(): + test = TestStdoutMatchADotC() + status = TestStatus( + test_manager=None, + returncode=0, + stdout='0abc1', + stderr=None, + directory=None, + inputs=None, + input_filenames=None) + assert_true(test.check_stdout_match(status)[0]) + + +def nosetest_stdout_match_regex_no_match(): + test = TestStdoutMatchADotC() + status = TestStatus( + test_manager=None, + returncode=0, + stdout='ab', + stderr=None, + directory=None, + inputs=None, + input_filenames=None) + assert_false(test.check_stdout_match(status)[0]) + + +def nosetest_stdout_match_regex_empty_stdout(): + test = TestStdoutMatchADotC() + status = TestStatus( + test_manager=None, + returncode=0, + stdout='', + stderr=None, + directory=None, + inputs=None, + input_filenames=None) + assert_false(test.check_stdout_match(status)[0]) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/CMakeLists.txt new file mode 100644 index 00000000000..a6dc5262d0a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (c) 2018 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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(NOT ${SPIRV_SKIP_TESTS}) + if(${PYTHONINTERP_FOUND}) + add_test(NAME spirv_opt_tests + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/../spirv_test_framework.py + $ $ $ + --test-dir ${CMAKE_CURRENT_SOURCE_DIR}) + else() + message("Skipping CLI tools tests - Python executable not found") + endif() +endif() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/flags.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/flags.py new file mode 100644 index 00000000000..628d87108c2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/flags.py @@ -0,0 +1,330 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 placeholder +import expect +import re + +from spirv_test_framework import inside_spirv_testsuite + + +def empty_main_assembly(): + return """ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" + OpName %4 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd""" + + +@inside_spirv_testsuite('SpirvOptBase') +class TestAssemblyFileAsOnlyParameter(expect.ValidObjectFile1_3): + """Tests that spirv-opt accepts a SPIR-V object file.""" + + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + output = placeholder.TempFileName('output.spv') + spirv_args = [shader, '-o', output] + expected_object_filenames = (output) + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestHelpFlag(expect.ReturnCodeIsZero, expect.StdoutMatch): + """Test the --help flag.""" + + spirv_args = ['--help'] + expected_stdout = re.compile(r'.*The SPIR-V binary is read from ') + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestValidPassFlags(expect.ValidObjectFile1_3, + expect.ExecutedListOfPasses): + """Tests that spirv-opt accepts all valid optimization flags.""" + + flags = [ + '--ccp', '--cfg-cleanup', '--combine-access-chains', '--compact-ids', + '--convert-local-access-chains', '--copy-propagate-arrays', + '--eliminate-common-uniform', '--eliminate-dead-branches', + '--eliminate-dead-code-aggressive', '--eliminate-dead-const', + '--eliminate-dead-functions', '--eliminate-dead-inserts', + '--eliminate-dead-variables', '--eliminate-insert-extract', + '--eliminate-local-multi-store', '--eliminate-local-single-block', + '--eliminate-local-single-store', '--flatten-decorations', + '--fold-spec-const-op-composite', '--freeze-spec-const', + '--if-conversion', '--inline-entry-points-exhaustive', '--loop-fission', + '20', '--loop-fusion', '5', '--loop-unroll', '--loop-unroll-partial', '3', + '--loop-peeling', '--merge-blocks', '--merge-return', '--loop-unswitch', + '--private-to-local', '--reduce-load-size', '--redundancy-elimination', + '--remove-duplicates', '--replace-invalid-opcode', '--ssa-rewrite', + '--scalar-replacement', '--scalar-replacement=42', '--strength-reduction', + '--strip-debug', '--strip-reflect', '--vector-dce', '--workaround-1209', + '--unify-const' + ] + expected_passes = [ + 'ccp', + 'cfg-cleanup', + 'combine-access-chains', + 'compact-ids', + 'convert-local-access-chains', + 'copy-propagate-arrays', + 'eliminate-common-uniform', + 'eliminate-dead-branches', + 'eliminate-dead-code-aggressive', + 'eliminate-dead-const', + 'eliminate-dead-functions', + 'eliminate-dead-inserts', + 'eliminate-dead-variables', + # --eliminate-insert-extract runs the simplify-instructions pass. + 'simplify-instructions', + 'eliminate-local-multi-store', + 'eliminate-local-single-block', + 'eliminate-local-single-store', + 'flatten-decorations', + 'fold-spec-const-op-composite', + 'freeze-spec-const', + 'if-conversion', + 'inline-entry-points-exhaustive', + 'loop-fission', + 'loop-fusion', + 'loop-unroll', + 'loop-unroll', + 'loop-peeling', + 'merge-blocks', + 'merge-return', + 'loop-unswitch', + 'private-to-local', + 'reduce-load-size', + 'redundancy-elimination', + 'remove-duplicates', + 'replace-invalid-opcode', + 'ssa-rewrite', + 'scalar-replacement=100', + 'scalar-replacement=42', + 'strength-reduction', + 'strip-debug', + 'strip-reflect', + 'vector-dce', + 'workaround-1209', + 'unify-const' + ] + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + output = placeholder.TempFileName('output.spv') + spirv_args = [shader, '-o', output, '--print-all'] + flags + expected_object_filenames = (output) + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestPerformanceOptimizationPasses(expect.ValidObjectFile1_3, + expect.ExecutedListOfPasses): + """Tests that spirv-opt schedules all the passes triggered by -O.""" + + flags = ['-O'] + expected_passes = [ + 'merge-return', + 'inline-entry-points-exhaustive', + 'eliminate-dead-code-aggressive', + 'private-to-local', + 'eliminate-local-single-block', + 'eliminate-local-single-store', + 'eliminate-dead-code-aggressive', + 'scalar-replacement=100', + 'convert-local-access-chains', + 'eliminate-local-single-block', + 'eliminate-local-single-store', + 'eliminate-dead-code-aggressive', + 'eliminate-local-multi-store', + 'eliminate-dead-code-aggressive', + 'ccp', + 'eliminate-dead-code-aggressive', + 'redundancy-elimination', + 'combine-access-chains', + 'simplify-instructions', + 'vector-dce', + 'eliminate-dead-inserts', + 'eliminate-dead-branches', + 'simplify-instructions', + 'if-conversion', + 'copy-propagate-arrays', + 'reduce-load-size', + 'eliminate-dead-code-aggressive', + 'merge-blocks', + 'redundancy-elimination', + 'eliminate-dead-branches', + 'merge-blocks', + 'simplify-instructions', + ] + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + output = placeholder.TempFileName('output.spv') + spirv_args = [shader, '-o', output, '--print-all'] + flags + expected_object_filenames = (output) + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestSizeOptimizationPasses(expect.ValidObjectFile1_3, + expect.ExecutedListOfPasses): + """Tests that spirv-opt schedules all the passes triggered by -Os.""" + + flags = ['-Os'] + expected_passes = [ + 'merge-return', + 'inline-entry-points-exhaustive', + 'eliminate-dead-code-aggressive', + 'private-to-local', + 'scalar-replacement=100', + 'convert-local-access-chains', + 'eliminate-local-single-block', + 'eliminate-local-single-store', + 'eliminate-dead-code-aggressive', + 'simplify-instructions', + 'eliminate-dead-inserts', + 'eliminate-local-multi-store', + 'eliminate-dead-code-aggressive', + 'ccp', + 'eliminate-dead-code-aggressive', + 'eliminate-dead-branches', + 'if-conversion', + 'eliminate-dead-code-aggressive', + 'merge-blocks', + 'simplify-instructions', + 'eliminate-dead-inserts', + 'redundancy-elimination', + 'cfg-cleanup', + 'eliminate-dead-code-aggressive', + ] + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + output = placeholder.TempFileName('output.spv') + spirv_args = [shader, '-o', output, '--print-all'] + flags + expected_object_filenames = (output) + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLegalizationPasses(expect.ValidObjectFile1_3, + expect.ExecutedListOfPasses): + """Tests that spirv-opt schedules all the passes triggered by --legalize-hlsl. + """ + + flags = ['--legalize-hlsl'] + expected_passes = [ + 'eliminate-dead-branches', + 'merge-return', + 'inline-entry-points-exhaustive', + 'eliminate-dead-functions', + 'private-to-local', + 'eliminate-local-single-block', + 'eliminate-local-single-store', + 'eliminate-dead-code-aggressive', + 'scalar-replacement=0', + 'eliminate-local-single-block', + 'eliminate-local-single-store', + 'eliminate-dead-code-aggressive', + 'eliminate-local-multi-store', + 'eliminate-dead-code-aggressive', + 'ccp', + 'eliminate-dead-branches', + 'simplify-instructions', + 'eliminate-dead-code-aggressive', + 'copy-propagate-arrays', + 'vector-dce', + 'eliminate-dead-inserts', + 'reduce-load-size', + 'eliminate-dead-code-aggressive', + ] + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + output = placeholder.TempFileName('output.spv') + spirv_args = [shader, '-o', output, '--print-all'] + flags + expected_object_filenames = (output) + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestScalarReplacementArgsNegative(expect.ErrorMessageSubstr): + """Tests invalid arguments to --scalar-replacement.""" + + spirv_args = ['--scalar-replacement=-10'] + expected_error_substr = 'must have no arguments or a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestScalarReplacementArgsInvalidNumber(expect.ErrorMessageSubstr): + """Tests invalid arguments to --scalar-replacement.""" + + spirv_args = ['--scalar-replacement=a10f'] + expected_error_substr = 'must have no arguments or a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopFissionArgsNegative(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-fission.""" + + spirv_args = ['--loop-fission=-10'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopFissionArgsInvalidNumber(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-fission.""" + + spirv_args = ['--loop-fission=a10f'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopFusionArgsNegative(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-fusion.""" + + spirv_args = ['--loop-fusion=-10'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopFusionArgsInvalidNumber(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-fusion.""" + + spirv_args = ['--loop-fusion=a10f'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopUnrollPartialArgsNegative(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-unroll-partial.""" + + spirv_args = ['--loop-unroll-partial=-10'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopUnrollPartialArgsInvalidNumber(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-unroll-partial.""" + + spirv_args = ['--loop-unroll-partial=a10f'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopPeelingThresholdArgsNegative(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-peeling-threshold.""" + + spirv_args = ['--loop-peeling-threshold=-10'] + expected_error_substr = 'must have a positive integer argument' + + +@inside_spirv_testsuite('SpirvOptFlags') +class TestLoopPeelingThresholdArgsInvalidNumber(expect.ErrorMessageSubstr): + """Tests invalid arguments to --loop-peeling-threshold.""" + + spirv_args = ['--loop-peeling-threshold=a10f'] + expected_error_substr = 'must have a positive integer argument' diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/oconfig.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/oconfig.py new file mode 100644 index 00000000000..33723799496 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/opt/oconfig.py @@ -0,0 +1,58 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 placeholder +import expect +import re + +from spirv_test_framework import inside_spirv_testsuite + + +def empty_main_assembly(): + return """ + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main" + OpName %4 "main" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %4 = OpFunction %2 None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd""" + + +@inside_spirv_testsuite('SpirvOptConfigFile') +class TestOconfigEmpty(expect.SuccessfulReturn): + """Tests empty config files are accepted.""" + + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + config = placeholder.ConfigFlagsFile('', '.cfg') + spirv_args = [shader, '-o', placeholder.TempFileName('output.spv'), config] + + +@inside_spirv_testsuite('SpirvOptConfigFile') +class TestOconfigComments(expect.SuccessfulReturn): + """Tests empty config files are accepted. + + https://github.com/KhronosGroup/SPIRV-Tools/issues/1778 + """ + + shader = placeholder.FileSPIRVShader(empty_main_assembly(), '.spvasm') + config = placeholder.ConfigFlagsFile(""" +# This is a comment. +-O +--loop-unroll +""", '.cfg') + spirv_args = [shader, '-o', placeholder.TempFileName('output.spv'), config] diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/placeholder.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/placeholder.py new file mode 100644 index 00000000000..7de3c467a8b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/placeholder.py @@ -0,0 +1,213 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT 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 number of placeholders and their rules for expansion when used in tests. + +These placeholders, when used in spirv_args or expected_* variables of +SpirvTest, have special meanings. In spirv_args, they will be substituted by +the result of instantiate_for_spirv_args(), while in expected_*, by +instantiate_for_expectation(). A TestCase instance will be passed in as +argument to the instantiate_*() methods. +""" + +import os +import subprocess +import tempfile +from string import Template + + +class PlaceHolderException(Exception): + """Exception class for PlaceHolder.""" + pass + + +class PlaceHolder(object): + """Base class for placeholders.""" + + def instantiate_for_spirv_args(self, testcase): + """Instantiation rules for spirv_args. + + This method will be called when the current placeholder appears in + spirv_args. + + Returns: + A string to replace the current placeholder in spirv_args. + """ + raise PlaceHolderException('Subclass should implement this function.') + + def instantiate_for_expectation(self, testcase): + """Instantiation rules for expected_*. + + This method will be called when the current placeholder appears in + expected_*. + + Returns: + A string to replace the current placeholder in expected_*. + """ + raise PlaceHolderException('Subclass should implement this function.') + + +class FileShader(PlaceHolder): + """Stands for a shader whose source code is in a file.""" + + def __init__(self, source, suffix, assembly_substr=None): + assert isinstance(source, str) + assert isinstance(suffix, str) + self.source = source + self.suffix = suffix + self.filename = None + # If provided, this is a substring which is expected to be in + # the disassembly of the module generated from this input file. + self.assembly_substr = assembly_substr + + def instantiate_for_spirv_args(self, testcase): + """Creates a temporary file and writes the source into it. + + Returns: + The name of the temporary file. + """ + shader, self.filename = tempfile.mkstemp( + dir=testcase.directory, suffix=self.suffix) + shader_object = os.fdopen(shader, 'w') + shader_object.write(self.source) + shader_object.close() + return self.filename + + def instantiate_for_expectation(self, testcase): + assert self.filename is not None + return self.filename + + +class ConfigFlagsFile(PlaceHolder): + """Stands for a configuration file for spirv-opt generated out of a string.""" + + def __init__(self, content, suffix): + assert isinstance(content, str) + assert isinstance(suffix, str) + self.content = content + self.suffix = suffix + self.filename = None + + def instantiate_for_spirv_args(self, testcase): + """Creates a temporary file and writes content into it. + + Returns: + The name of the temporary file. + """ + temp_fd, self.filename = tempfile.mkstemp( + dir=testcase.directory, suffix=self.suffix) + fd = os.fdopen(temp_fd, 'w') + fd.write(self.content) + fd.close() + return '-Oconfig=%s' % self.filename + + def instantiate_for_expectation(self, testcase): + assert self.filename is not None + return self.filename + + +class FileSPIRVShader(PlaceHolder): + """Stands for a source shader file which must be converted to SPIR-V.""" + + def __init__(self, source, suffix, assembly_substr=None): + assert isinstance(source, str) + assert isinstance(suffix, str) + self.source = source + self.suffix = suffix + self.filename = None + # If provided, this is a substring which is expected to be in + # the disassembly of the module generated from this input file. + self.assembly_substr = assembly_substr + + def instantiate_for_spirv_args(self, testcase): + """Creates a temporary file, writes the source into it and assembles it. + + Returns: + The name of the assembled temporary file. + """ + shader, asm_filename = tempfile.mkstemp( + dir=testcase.directory, suffix=self.suffix) + shader_object = os.fdopen(shader, 'w') + shader_object.write(self.source) + shader_object.close() + self.filename = '%s.spv' % asm_filename + cmd = [ + testcase.test_manager.assembler_path, asm_filename, '-o', self.filename + ] + process = subprocess.Popen( + args=cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=testcase.directory) + output = process.communicate() + assert process.returncode == 0 and not output[0] and not output[1] + return self.filename + + def instantiate_for_expectation(self, testcase): + assert self.filename is not None + return self.filename + + +class StdinShader(PlaceHolder): + """Stands for a shader whose source code is from stdin.""" + + def __init__(self, source): + assert isinstance(source, str) + self.source = source + self.filename = None + + def instantiate_for_spirv_args(self, testcase): + """Writes the source code back to the TestCase instance.""" + testcase.stdin_shader = self.source + self.filename = '-' + return self.filename + + def instantiate_for_expectation(self, testcase): + assert self.filename is not None + return self.filename + + +class TempFileName(PlaceHolder): + """Stands for a temporary file's name.""" + + def __init__(self, filename): + assert isinstance(filename, str) + assert filename != '' + self.filename = filename + + def instantiate_for_spirv_args(self, testcase): + return os.path.join(testcase.directory, self.filename) + + def instantiate_for_expectation(self, testcase): + return os.path.join(testcase.directory, self.filename) + + +class SpecializedString(PlaceHolder): + """Returns a string that has been specialized based on TestCase. + + The string is specialized by expanding it as a string.Template + with all of the specialization being done with each $param replaced + by the associated member on TestCase. + """ + + def __init__(self, filename): + assert isinstance(filename, str) + assert filename != '' + self.filename = filename + + def instantiate_for_spirv_args(self, testcase): + return Template(self.filename).substitute(vars(testcase)) + + def instantiate_for_expectation(self, testcase): + return Template(self.filename).substitute(vars(testcase)) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/spirv_test_framework.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/spirv_test_framework.py new file mode 100644 index 00000000000..03ad08fa8c5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/spirv_test_framework.py @@ -0,0 +1,375 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Manages and runs tests from the current working directory. + +This will traverse the current working directory and look for python files that +contain subclasses of SpirvTest. + +If a class has an @inside_spirv_testsuite decorator, an instance of that +class will be created and serve as a test case in that testsuite. The test +case is then run by the following steps: + + 1. A temporary directory will be created. + 2. The spirv_args member variable will be inspected and all placeholders in it + will be expanded by calling instantiate_for_spirv_args() on placeholders. + The transformed list elements are then supplied as arguments to the spirv-* + tool under test. + 3. If the environment member variable exists, its write() method will be + invoked. + 4. All expected_* member variables will be inspected and all placeholders in + them will be expanded by calling instantiate_for_expectation() on those + placeholders. After placeholder expansion, if the expected_* variable is + a list, its element will be joined together with '' to form a single + string. These expected_* variables are to be used by the check_*() methods. + 5. The spirv-* tool will be run with the arguments supplied in spirv_args. + 6. All check_*() member methods will be called by supplying a TestStatus as + argument. Each check_*() method is expected to return a (Success, Message) + pair where Success is a boolean indicating success and Message is an error + message. + 7. If any check_*() method fails, the error message is output and the + current test case fails. + +If --leave-output was not specified, all temporary files and directories will +be deleted. +""" + +from __future__ import print_function + +import argparse +import fnmatch +import inspect +import os +import shutil +import subprocess +import sys +import tempfile +from collections import defaultdict +from placeholder import PlaceHolder + +EXPECTED_BEHAVIOR_PREFIX = 'expected_' +VALIDATE_METHOD_PREFIX = 'check_' + + +def get_all_variables(instance): + """Returns the names of all the variables in instance.""" + return [v for v in dir(instance) if not callable(getattr(instance, v))] + + +def get_all_methods(instance): + """Returns the names of all methods in instance.""" + return [m for m in dir(instance) if callable(getattr(instance, m))] + + +def get_all_superclasses(cls): + """Returns all superclasses of a given class. + + Returns: + A list of superclasses of the given class. The order guarantees that + * A Base class precedes its derived classes, e.g., for "class B(A)", it + will be [..., A, B, ...]. + * When there are multiple base classes, base classes declared first + precede those declared later, e.g., for "class C(A, B), it will be + [..., A, B, C, ...] + """ + classes = [] + for superclass in cls.__bases__: + for c in get_all_superclasses(superclass): + if c not in classes: + classes.append(c) + for superclass in cls.__bases__: + if superclass not in classes: + classes.append(superclass) + return classes + + +def get_all_test_methods(test_class): + """Gets all validation methods. + + Returns: + A list of validation methods. The order guarantees that + * A method defined in superclass precedes one defined in subclass, + e.g., for "class A(B)", methods defined in B precedes those defined + in A. + * If a subclass has more than one superclass, e.g., "class C(A, B)", + then methods defined in A precedes those defined in B. + """ + classes = get_all_superclasses(test_class) + classes.append(test_class) + all_tests = [ + m for c in classes for m in get_all_methods(c) + if m.startswith(VALIDATE_METHOD_PREFIX) + ] + unique_tests = [] + for t in all_tests: + if t not in unique_tests: + unique_tests.append(t) + return unique_tests + + +class SpirvTest: + """Base class for spirv test cases. + + Subclasses define test cases' facts (shader source code, spirv command, + result validation), which will be used by the TestCase class for running + tests. Subclasses should define spirv_args (specifying spirv_tool command + arguments), and at least one check_*() method (for result validation) for + a full-fledged test case. All check_*() methods should take a TestStatus + parameter and return a (Success, Message) pair, in which Success is a + boolean indicating success and Message is an error message. The test passes + iff all check_*() methods returns true. + + Often, a test case class will delegate the check_* behaviors by inheriting + from other classes. + """ + + def name(self): + return self.__class__.__name__ + + +class TestStatus: + """A struct for holding run status of a test case.""" + + def __init__(self, test_manager, returncode, stdout, stderr, directory, + inputs, input_filenames): + self.test_manager = test_manager + self.returncode = returncode + self.stdout = stdout + self.stderr = stderr + # temporary directory where the test runs + self.directory = directory + # List of inputs, as PlaceHolder objects. + self.inputs = inputs + # the names of input shader files (potentially including paths) + self.input_filenames = input_filenames + + +class SpirvTestException(Exception): + """SpirvTest exception class.""" + pass + + +def inside_spirv_testsuite(testsuite_name): + """Decorator for subclasses of SpirvTest. + + This decorator checks that a class meets the requirements (see below) + for a test case class, and then puts the class in a certain testsuite. + * The class needs to be a subclass of SpirvTest. + * The class needs to have spirv_args defined as a list. + * The class needs to define at least one check_*() methods. + * All expected_* variables required by check_*() methods can only be + of bool, str, or list type. + * Python runtime will throw an exception if the expected_* member + attributes required by check_*() methods are missing. + """ + + def actual_decorator(cls): + if not inspect.isclass(cls): + raise SpirvTestException('Test case should be a class') + if not issubclass(cls, SpirvTest): + raise SpirvTestException( + 'All test cases should be subclasses of SpirvTest') + if 'spirv_args' not in get_all_variables(cls): + raise SpirvTestException('No spirv_args found in the test case') + if not isinstance(cls.spirv_args, list): + raise SpirvTestException('spirv_args needs to be a list') + if not any( + [m.startswith(VALIDATE_METHOD_PREFIX) for m in get_all_methods(cls)]): + raise SpirvTestException('No check_*() methods found in the test case') + if not all( + [isinstance(v, (bool, str, list)) for v in get_all_variables(cls)]): + raise SpirvTestException( + 'expected_* variables are only allowed to be bool, str, or ' + 'list type.') + cls.parent_testsuite = testsuite_name + return cls + + return actual_decorator + + +class TestManager: + """Manages and runs a set of tests.""" + + def __init__(self, executable_path, assembler_path, disassembler_path): + self.executable_path = executable_path + self.assembler_path = assembler_path + self.disassembler_path = disassembler_path + self.num_successes = 0 + self.num_failures = 0 + self.num_tests = 0 + self.leave_output = False + self.tests = defaultdict(list) + + def notify_result(self, test_case, success, message): + """Call this to notify the manager of the results of a test run.""" + self.num_successes += 1 if success else 0 + self.num_failures += 0 if success else 1 + counter_string = str(self.num_successes + self.num_failures) + '/' + str( + self.num_tests) + print('%-10s %-40s ' % (counter_string, test_case.test.name()) + + ('Passed' if success else '-Failed-')) + if not success: + print(' '.join(test_case.command)) + print(message) + + def add_test(self, testsuite, test): + """Add this to the current list of test cases.""" + self.tests[testsuite].append(TestCase(test, self)) + self.num_tests += 1 + + def run_tests(self): + for suite in self.tests: + print('SPIRV tool test suite: "{suite}"'.format(suite=suite)) + for x in self.tests[suite]: + x.runTest() + + +class TestCase: + """A single test case that runs in its own directory.""" + + def __init__(self, test, test_manager): + self.test = test + self.test_manager = test_manager + self.inputs = [] # inputs, as PlaceHolder objects. + self.file_shaders = [] # filenames of shader files. + self.stdin_shader = None # text to be passed to spirv_tool as stdin + + def setUp(self): + """Creates environment and instantiates placeholders for the test case.""" + + self.directory = tempfile.mkdtemp(dir=os.getcwd()) + spirv_args = self.test.spirv_args + # Instantiate placeholders in spirv_args + self.test.spirv_args = [ + arg.instantiate_for_spirv_args(self) + if isinstance(arg, PlaceHolder) else arg for arg in self.test.spirv_args + ] + # Get all shader files' names + self.inputs = [arg for arg in spirv_args if isinstance(arg, PlaceHolder)] + self.file_shaders = [arg.filename for arg in self.inputs] + + if 'environment' in get_all_variables(self.test): + self.test.environment.write(self.directory) + + expectations = [ + v for v in get_all_variables(self.test) + if v.startswith(EXPECTED_BEHAVIOR_PREFIX) + ] + # Instantiate placeholders in expectations + for expectation_name in expectations: + expectation = getattr(self.test, expectation_name) + if isinstance(expectation, list): + expanded_expections = [ + element.instantiate_for_expectation(self) + if isinstance(element, PlaceHolder) else element + for element in expectation + ] + setattr(self.test, expectation_name, expanded_expections) + elif isinstance(expectation, PlaceHolder): + setattr(self.test, expectation_name, + expectation.instantiate_for_expectation(self)) + + def tearDown(self): + """Removes the directory if we were not instructed to do otherwise.""" + if not self.test_manager.leave_output: + shutil.rmtree(self.directory) + + def runTest(self): + """Sets up and runs a test, reports any failures and then cleans up.""" + self.setUp() + success = False + message = '' + try: + self.command = [self.test_manager.executable_path] + self.command.extend(self.test.spirv_args) + + process = subprocess.Popen( + args=self.command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + cwd=self.directory) + output = process.communicate(self.stdin_shader) + test_status = TestStatus(self.test_manager, process.returncode, output[0], + output[1], self.directory, self.inputs, + self.file_shaders) + run_results = [ + getattr(self.test, test_method)(test_status) + for test_method in get_all_test_methods(self.test.__class__) + ] + success, message = zip(*run_results) + success = all(success) + message = '\n'.join(message) + except Exception as e: + success = False + message = str(e) + self.test_manager.notify_result( + self, success, + message + '\nSTDOUT:\n%s\nSTDERR:\n%s' % (output[0], output[1])) + self.tearDown() + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument( + 'spirv_tool', + metavar='path/to/spirv_tool', + type=str, + nargs=1, + help='Path to the spirv-* tool under test') + parser.add_argument( + 'spirv_as', + metavar='path/to/spirv-as', + type=str, + nargs=1, + help='Path to spirv-as') + parser.add_argument( + 'spirv_dis', + metavar='path/to/spirv-dis', + type=str, + nargs=1, + help='Path to spirv-dis') + parser.add_argument( + '--leave-output', + action='store_const', + const=1, + help='Do not clean up temporary directories') + parser.add_argument( + '--test-dir', nargs=1, help='Directory to gather the tests from') + args = parser.parse_args() + default_path = sys.path + root_dir = os.getcwd() + if args.test_dir: + root_dir = args.test_dir[0] + manager = TestManager(args.spirv_tool[0], args.spirv_as[0], args.spirv_dis[0]) + if args.leave_output: + manager.leave_output = True + for root, _, filenames in os.walk(root_dir): + for filename in fnmatch.filter(filenames, '*.py'): + if filename.endswith('nosetest.py'): + # Skip nose tests, which are for testing functions of + # the test framework. + continue + sys.path = default_path + sys.path.append(root) + mod = __import__(os.path.splitext(filename)[0]) + for _, obj, in inspect.getmembers(mod): + if inspect.isclass(obj) and hasattr(obj, 'parent_testsuite'): + manager.add_test(obj.parent_testsuite, obj()) + manager.run_tests() + if manager.num_failures > 0: + sys.exit(-1) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/spirv_test_framework_nosetest.py b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/spirv_test_framework_nosetest.py new file mode 100644 index 00000000000..c0fbed5811b --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/tools/spirv_test_framework_nosetest.py @@ -0,0 +1,155 @@ +# Copyright (c) 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from spirv_test_framework import get_all_test_methods, get_all_superclasses +from nose.tools import assert_equal, with_setup + + +# Classes to be used in testing get_all_{superclasses|test_methods}() +class Root: + + def check_root(self): + pass + + +class A(Root): + + def check_a(self): + pass + + +class B(Root): + + def check_b(self): + pass + + +class C(Root): + + def check_c(self): + pass + + +class D(Root): + + def check_d(self): + pass + + +class E(Root): + + def check_e(self): + pass + + +class H(B, C, D): + + def check_h(self): + pass + + +class I(E): + + def check_i(self): + pass + + +class O(H, I): + + def check_o(self): + pass + + +class U(A, O): + + def check_u(self): + pass + + +class X(U, A): + + def check_x(self): + pass + + +class R1: + + def check_r1(self): + pass + + +class R2: + + def check_r2(self): + pass + + +class Multi(R1, R2): + + def check_multi(self): + pass + + +def nosetest_get_all_superclasses(): + """Tests get_all_superclasses().""" + + assert_equal(get_all_superclasses(A), [Root]) + assert_equal(get_all_superclasses(B), [Root]) + assert_equal(get_all_superclasses(C), [Root]) + assert_equal(get_all_superclasses(D), [Root]) + assert_equal(get_all_superclasses(E), [Root]) + + assert_equal(get_all_superclasses(H), [Root, B, C, D]) + assert_equal(get_all_superclasses(I), [Root, E]) + + assert_equal(get_all_superclasses(O), [Root, B, C, D, E, H, I]) + + assert_equal(get_all_superclasses(U), [Root, B, C, D, E, H, I, A, O]) + assert_equal(get_all_superclasses(X), [Root, B, C, D, E, H, I, A, O, U]) + + assert_equal(get_all_superclasses(Multi), [R1, R2]) + + +def nosetest_get_all_methods(): + """Tests get_all_test_methods().""" + assert_equal(get_all_test_methods(A), ['check_root', 'check_a']) + assert_equal(get_all_test_methods(B), ['check_root', 'check_b']) + assert_equal(get_all_test_methods(C), ['check_root', 'check_c']) + assert_equal(get_all_test_methods(D), ['check_root', 'check_d']) + assert_equal(get_all_test_methods(E), ['check_root', 'check_e']) + + assert_equal( + get_all_test_methods(H), + ['check_root', 'check_b', 'check_c', 'check_d', 'check_h']) + assert_equal(get_all_test_methods(I), ['check_root', 'check_e', 'check_i']) + + assert_equal( + get_all_test_methods(O), [ + 'check_root', 'check_b', 'check_c', 'check_d', 'check_e', 'check_h', + 'check_i', 'check_o' + ]) + + assert_equal( + get_all_test_methods(U), [ + 'check_root', 'check_b', 'check_c', 'check_d', 'check_e', 'check_h', + 'check_i', 'check_a', 'check_o', 'check_u' + ]) + assert_equal( + get_all_test_methods(X), [ + 'check_root', 'check_b', 'check_c', 'check_d', 'check_e', 'check_h', + 'check_i', 'check_a', 'check_o', 'check_u', 'check_x' + ]) + + assert_equal( + get_all_test_methods(Multi), ['check_r1', 'check_r2', 'check_multi']) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/unit_spirv.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/unit_spirv.cpp new file mode 100644 index 00000000000..84ed87a510c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/unit_spirv.cpp @@ -0,0 +1,55 @@ +// Copyright (c) 2015-2016 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. + +#include "test/unit_spirv.h" + +#include "gmock/gmock.h" +#include "test/test_fixture.h" + +namespace spvtools { +namespace { + +using spvtest::MakeVector; +using ::testing::Eq; +using Words = std::vector; + +TEST(MakeVector, Samples) { + EXPECT_THAT(MakeVector(""), Eq(Words{0})); + EXPECT_THAT(MakeVector("a"), Eq(Words{0x0061})); + EXPECT_THAT(MakeVector("ab"), Eq(Words{0x006261})); + EXPECT_THAT(MakeVector("abc"), Eq(Words{0x00636261})); + EXPECT_THAT(MakeVector("abcd"), Eq(Words{0x64636261, 0x00})); + EXPECT_THAT(MakeVector("abcde"), Eq(Words{0x64636261, 0x0065})); +} + +TEST(WordVectorPrintTo, PreservesFlagsAndFill) { + std::stringstream s; + s << std::setw(4) << std::oct << std::setfill('x') << 8 << " "; + spvtest::PrintTo(spvtest::WordVector({10, 16}), &s); + // The octal setting and fill character should be preserved + // from before the PrintTo. + // Width is reset after each emission of a regular scalar type. + // So set it explicitly again. + s << std::setw(4) << 9; + + EXPECT_THAT(s.str(), Eq("xx10 0x0000000a 0x00000010 xx11")); +} + +TEST_P(RoundTripTest, Sample) { + EXPECT_THAT(EncodeAndDecodeSuccessfully(GetParam()), Eq(GetParam())) + << GetParam(); +} + +} // namespace +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/unit_spirv.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/unit_spirv.h new file mode 100644 index 00000000000..22442888444 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/unit_spirv.h @@ -0,0 +1,234 @@ +// Copyright (c) 2015-2016 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. + +#ifndef TEST_UNIT_SPIRV_H_ +#define TEST_UNIT_SPIRV_H_ + +#include + +#include +#include +#include + +#include "gtest/gtest.h" +#include "source/assembly_grammar.h" +#include "source/binary.h" +#include "source/diagnostic.h" +#include "source/enum_set.h" +#include "source/opcode.h" +#include "source/spirv_endian.h" +#include "source/text.h" +#include "source/text_handler.h" +#include "source/val/validate.h" +#include "spirv-tools/libspirv.h" + +#ifdef __ANDROID__ +#include +namespace std { +template +std::string to_string(const T& val) { + std::ostringstream os; + os << val; + return os.str(); +} +} // namespace std +#endif + +// Determine endianness & predicate tests on it +enum { + I32_ENDIAN_LITTLE = 0x03020100ul, + I32_ENDIAN_BIG = 0x00010203ul, +}; + +static const union { + unsigned char bytes[4]; + uint32_t value; +} o32_host_order = {{0, 1, 2, 3}}; +#define I32_ENDIAN_HOST (o32_host_order.value) + +// A namespace for utilities used in SPIR-V Tools unit tests. +namespace spvtest { + +class WordVector; + +// Emits the given word vector to the given stream. +// This function can be used by the gtest value printer. +void PrintTo(const WordVector& words, ::std::ostream* os); + +// A proxy class to allow us to easily write out vectors of SPIR-V words. +class WordVector { + public: + explicit WordVector(const std::vector& val) : value_(val) {} + explicit WordVector(const spv_binary_t& binary) + : value_(binary.code, binary.code + binary.wordCount) {} + + // Returns the underlying vector. + const std::vector& value() const { return value_; } + + // Returns the string representation of this word vector. + std::string str() const { + std::ostringstream os; + PrintTo(*this, &os); + return os.str(); + } + + private: + const std::vector value_; +}; + +inline void PrintTo(const WordVector& words, ::std::ostream* os) { + size_t count = 0; + const auto saved_flags = os->flags(); + const auto saved_fill = os->fill(); + for (uint32_t value : words.value()) { + *os << "0x" << std::setw(8) << std::setfill('0') << std::hex << value + << " "; + if (count++ % 8 == 7) { + *os << std::endl; + } + } + os->flags(saved_flags); + os->fill(saved_fill); +} + +// Returns a vector of words representing a single instruction with the +// given opcode and operand words as a vector. +inline std::vector MakeInstruction( + SpvOp opcode, const std::vector& args) { + std::vector result{ + spvOpcodeMake(uint16_t(args.size() + 1), opcode)}; + result.insert(result.end(), args.begin(), args.end()); + return result; +} + +// Returns a vector of words representing a single instruction with the +// given opcode and whose operands are the concatenation of the two given +// argument lists. +inline std::vector MakeInstruction( + SpvOp opcode, std::vector args, + const std::vector& extra_args) { + args.insert(args.end(), extra_args.begin(), extra_args.end()); + return MakeInstruction(opcode, args); +} + +// Returns the vector of words representing the concatenation +// of all input vectors. +inline std::vector Concatenate( + const std::vector>& instructions) { + std::vector result; + for (const auto& instruction : instructions) { + result.insert(result.end(), instruction.begin(), instruction.end()); + } + return result; +} + +// Encodes a string as a sequence of words, using the SPIR-V encoding. +inline std::vector MakeVector(std::string input) { + std::vector result; + uint32_t word = 0; + size_t num_bytes = input.size(); + // SPIR-V strings are null-terminated. The byte_index == num_bytes + // case is used to push the terminating null byte. + for (size_t byte_index = 0; byte_index <= num_bytes; byte_index++) { + const auto new_byte = + (byte_index < num_bytes ? uint8_t(input[byte_index]) : uint8_t(0)); + word |= (new_byte << (8 * (byte_index % sizeof(uint32_t)))); + if (3 == (byte_index % sizeof(uint32_t))) { + result.push_back(word); + word = 0; + } + } + // Emit a trailing partial word. + if ((num_bytes + 1) % sizeof(uint32_t)) { + result.push_back(word); + } + return result; +} + +// A type for easily creating spv_text_t values, with an implicit conversion to +// spv_text. +struct AutoText { + explicit AutoText(const std::string& value) + : str(value), text({str.data(), str.size()}) {} + operator spv_text() { return &text; } + std::string str; + spv_text_t text; +}; + +// An example case for an enumerated value, optionally with operands. +template +class EnumCase { + public: + EnumCase() = default; // Required by ::testing::Combine(). + EnumCase(E val, std::string enum_name, std::vector ops = {}) + : enum_value_(val), name_(enum_name), operands_(ops) {} + // Returns the enum value as a uint32_t. + uint32_t value() const { return static_cast(enum_value_); } + // Returns the name of the enumerant. + const std::string& name() const { return name_; } + // Returns a reference to the operands. + const std::vector& operands() const { return operands_; } + + private: + E enum_value_; + std::string name_; + std::vector operands_; +}; + +// Returns a string with num_4_byte_chars Unicode characters, +// each of which has a 4-byte UTF-8 encoding. +inline std::string MakeLongUTF8String(size_t num_4_byte_chars) { + // An example of a longest valid UTF-8 character. + // Be explicit about the character type because Microsoft compilers can + // otherwise interpret the character string as being over wide (16-bit) + // characters. Ideally, we would just use a C++11 UTF-8 string literal, + // but we want to support older Microsoft compilers. + const std::basic_string earth_africa("\xF0\x9F\x8C\x8D"); + EXPECT_EQ(4u, earth_africa.size()); + + std::string result; + result.reserve(num_4_byte_chars * 4); + for (size_t i = 0; i < num_4_byte_chars; i++) { + result += earth_africa; + } + EXPECT_EQ(4 * num_4_byte_chars, result.size()); + return result; +} + +// Returns a vector of all valid target environment enums. +inline std::vector AllTargetEnvironments() { + return { + SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_EMBEDDED_1_2, + SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_EMBEDDED_2_0, + SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_EMBEDDED_2_1, + SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_EMBEDDED_2_2, + SPV_ENV_VULKAN_1_0, SPV_ENV_OPENGL_4_0, + SPV_ENV_OPENGL_4_1, SPV_ENV_OPENGL_4_2, + SPV_ENV_OPENGL_4_3, SPV_ENV_OPENGL_4_5, + SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3, + SPV_ENV_VULKAN_1_1, SPV_ENV_WEBGPU_0, + }; +} + +// Returns the capabilities in a CapabilitySet as an ordered vector. +inline std::vector ElementsIn( + const spvtools::CapabilitySet& capabilities) { + std::vector result; + capabilities.ForEach([&result](SpvCapability c) { result.push_back(c); }); + return result; +} + +} // namespace spvtest +#endif // TEST_UNIT_SPIRV_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/util/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/CMakeLists.txt new file mode 100644 index 00000000000..66d4e8a4219 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright (c) 2017 Google 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. + +add_spvtools_unittest(TARGET util_intrusive_list + SRCS ilist_test.cpp +) + +add_spvtools_unittest(TARGET bit_vector + SRCS bit_vector_test.cpp + LIBS SPIRV-Tools-opt +) + +add_spvtools_unittest(TARGET small_vector + SRCS small_vector_test.cpp +) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/util/bit_vector_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/bit_vector_test.cpp new file mode 100644 index 00000000000..8d967f8f93d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/bit_vector_test.cpp @@ -0,0 +1,164 @@ +// Copyright (c) 2017 Google 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. + +#include + +#include "gmock/gmock.h" + +#include "source/util/bit_vector.h" + +namespace spvtools { +namespace utils { +namespace { + +using BitVectorTest = ::testing::Test; + +TEST(BitVectorTest, Initialize) { + BitVector bvec; + + // Checks that all values are 0. Also tests checking a bit past the end of + // the vector containing the bits. + for (int i = 1; i < 10000; i *= 2) { + EXPECT_FALSE(bvec.Get(i)); + } +} + +TEST(BitVectorTest, Set) { + BitVector bvec; + + // Since 10,000 is larger than the initial size, this tests the resizing + // code. + for (int i = 3; i < 10000; i *= 2) { + bvec.Set(i); + } + + // Check that bits that were not set are 0. + for (int i = 1; i < 10000; i *= 2) { + EXPECT_FALSE(bvec.Get(i)); + } + + // Check that bits that were set are 1. + for (int i = 3; i < 10000; i *= 2) { + EXPECT_TRUE(bvec.Get(i)); + } +} + +TEST(BitVectorTest, SetReturnValue) { + BitVector bvec; + + // Make sure |Set| returns false when the bit was not set. + for (int i = 3; i < 10000; i *= 2) { + EXPECT_FALSE(bvec.Set(i)); + } + + // Make sure |Set| returns true when the bit was already set. + for (int i = 3; i < 10000; i *= 2) { + EXPECT_TRUE(bvec.Set(i)); + } +} + +TEST(BitVectorTest, Clear) { + BitVector bvec; + for (int i = 3; i < 10000; i *= 2) { + bvec.Set(i); + } + + // Check that the bits were properly set. + for (int i = 3; i < 10000; i *= 2) { + EXPECT_TRUE(bvec.Get(i)); + } + + // Clear all of the bits except for bit 3. + for (int i = 6; i < 10000; i *= 2) { + bvec.Clear(i); + } + + // Make sure bit 3 was not cleared. + EXPECT_TRUE(bvec.Get(3)); + + // Make sure all of the other bits that were set have been cleared. + for (int i = 6; i < 10000; i *= 2) { + EXPECT_FALSE(bvec.Get(i)); + } +} + +TEST(BitVectorTest, ClearReturnValue) { + BitVector bvec; + for (int i = 3; i < 10000; i *= 2) { + bvec.Set(i); + } + + // Make sure |Clear| returns true if the bit was set. + for (int i = 3; i < 10000; i *= 2) { + EXPECT_TRUE(bvec.Clear(i)); + } + + // Make sure |Clear| returns false if the bit was not set. + for (int i = 3; i < 10000; i *= 2) { + EXPECT_FALSE(bvec.Clear(i)); + } +} + +TEST(BitVectorTest, SimpleOrTest) { + BitVector bvec1; + bvec1.Set(3); + bvec1.Set(4); + + BitVector bvec2; + bvec2.Set(2); + bvec2.Set(4); + + // Check that |bvec1| changed when doing the |Or| operation. + EXPECT_TRUE(bvec1.Or(bvec2)); + + // Check that the values are all correct. + EXPECT_FALSE(bvec1.Get(0)); + EXPECT_FALSE(bvec1.Get(1)); + EXPECT_TRUE(bvec1.Get(2)); + EXPECT_TRUE(bvec1.Get(3)); + EXPECT_TRUE(bvec1.Get(4)); +} + +TEST(BitVectorTest, ResizingOrTest) { + BitVector bvec1; + bvec1.Set(3); + bvec1.Set(4); + + BitVector bvec2; + bvec2.Set(10000); + + // Similar to above except with a large value to test resizing. + EXPECT_TRUE(bvec1.Or(bvec2)); + EXPECT_FALSE(bvec1.Get(0)); + EXPECT_FALSE(bvec1.Get(1)); + EXPECT_FALSE(bvec1.Get(2)); + EXPECT_TRUE(bvec1.Get(3)); + EXPECT_TRUE(bvec1.Get(10000)); +} + +TEST(BitVectorTest, SubsetOrTest) { + BitVector bvec1; + bvec1.Set(3); + bvec1.Set(4); + + BitVector bvec2; + bvec2.Set(3); + + // |Or| returns false if |bvec1| does not change. + EXPECT_FALSE(bvec1.Or(bvec2)); +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/util/ilist_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/ilist_test.cpp new file mode 100644 index 00000000000..4a546f993cc --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/ilist_test.cpp @@ -0,0 +1,325 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "source/util/ilist.h" + +namespace spvtools { +namespace utils { +namespace { + +using ::testing::ElementsAre; +using IListTest = ::testing::Test; + +class TestNode : public IntrusiveNodeBase { + public: + TestNode() : IntrusiveNodeBase() {} + int data_; +}; + +class TestList : public IntrusiveList { + public: + TestList() = default; + TestList(TestList&& that) : IntrusiveList(std::move(that)) {} + TestList& operator=(TestList&& that) { + static_cast&>(*this) = + static_cast&&>(that); + return *this; + } +}; + +// This test checks the push_back method, as well as using an iterator to +// traverse the list from begin() to end(). This implicitly test the +// PreviousNode and NextNode functions. +TEST(IListTest, PushBack) { + TestNode nodes[10]; + TestList list; + for (int i = 0; i < 10; i++) { + nodes[i].data_ = i; + list.push_back(&nodes[i]); + } + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); +} + +// Returns a list containing the values 0 to n-1 using the first n elements of +// nodes to build the list. +TestList BuildList(TestNode nodes[], int n) { + TestList list; + for (int i = 0; i < n; i++) { + nodes[i].data_ = i; + list.push_back(&nodes[i]); + } + return list; +} + +// Test decrementing begin() +TEST(IListTest, DecrementingBegin) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 10); + EXPECT_EQ(--list.begin(), list.end()); +} + +// Test incrementing end() +TEST(IListTest, IncrementingEnd1) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 10); + EXPECT_EQ((++list.end())->data_, 0); +} + +// Test incrementing end() should equal begin() +TEST(IListTest, IncrementingEnd2) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 10); + EXPECT_EQ(++list.end(), list.begin()); +} + +// Test decrementing end() +TEST(IListTest, DecrementingEnd) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 10); + EXPECT_EQ((--list.end())->data_, 9); +} + +// Test the move constructor for the list class. +TEST(IListTest, MoveConstructor) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 10); + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); +} + +// Using a const list so we can test the const_iterator. +TEST(IListTest, ConstIterator) { + TestNode nodes[10]; + const TestList list = BuildList(nodes, 10); + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); +} + +// Uses the move assignement instead of the move constructor. +TEST(IListTest, MoveAssignment) { + TestNode nodes[10]; + TestList list; + list = BuildList(nodes, 10); + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); +} + +// Test inserting a new element at the end of a list using the IntrusiveNodeBase +// "InsertAfter" function. +TEST(IListTest, InsertAfter1) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 5); + + nodes[5].data_ = 5; + nodes[5].InsertAfter(&nodes[4]); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5)); +} + +// Test inserting a new element in the middle of a list using the +// IntrusiveNodeBase "InsertAfter" function. +TEST(IListTest, InsertAfter2) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 5); + + nodes[5].data_ = 5; + nodes[5].InsertAfter(&nodes[2]); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 5, 3, 4)); +} + +// Test moving an element already in the list in the middle of a list using the +// IntrusiveNodeBase "InsertAfter" function. +TEST(IListTest, MoveUsingInsertAfter1) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + nodes[5].InsertAfter(&nodes[2]); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 5, 3, 4)); +} + +// Move the element at the start of the list into the middle. +TEST(IListTest, MoveUsingInsertAfter2) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + nodes[0].InsertAfter(&nodes[2]); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(1, 2, 0, 3, 4, 5)); +} + +// Move an element in the middle of the list to the end. +TEST(IListTest, MoveUsingInsertAfter3) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + nodes[2].InsertAfter(&nodes[5]); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 3, 4, 5, 2)); +} + +// Removing an element from the middle of a list. +TEST(IListTest, Remove1) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + nodes[2].RemoveFromList(); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 3, 4, 5)); +} + +// Removing an element from the beginning of the list. +TEST(IListTest, Remove2) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + nodes[0].RemoveFromList(); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(1, 2, 3, 4, 5)); +} + +// Removing the last element of a list. +TEST(IListTest, Remove3) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + nodes[5].RemoveFromList(); + + std::vector output; + for (auto& i : list) output.push_back(i.data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4)); +} + +// Test that operator== and operator!= work properly for the iterator class. +TEST(IListTest, IteratorEqual) { + TestNode nodes[10]; + TestList list = BuildList(nodes, 6); + + std::vector output; + for (auto i = list.begin(); i != list.end(); ++i) + for (auto j = list.begin(); j != list.end(); ++j) + if (i == j) output.push_back(i->data_); + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5)); +} + +// Test MoveBefore. Moving into middle of a list. +TEST(IListTest, MoveBefore1) { + TestNode nodes[10]; + TestList list1 = BuildList(nodes, 6); + TestList list2 = BuildList(nodes + 6, 3); + + TestList::iterator insertion_point = list1.begin(); + ++insertion_point; + insertion_point.MoveBefore(&list2); + + std::vector output; + for (auto i = list1.begin(); i != list1.end(); ++i) { + output.push_back(i->data_); + } + + EXPECT_THAT(output, ElementsAre(0, 0, 1, 2, 1, 2, 3, 4, 5)); +} + +// Test MoveBefore. Moving to the start of a list. +TEST(IListTest, MoveBefore2) { + TestNode nodes[10]; + TestList list1 = BuildList(nodes, 6); + TestList list2 = BuildList(nodes + 6, 3); + + TestList::iterator insertion_point = list1.begin(); + insertion_point.MoveBefore(&list2); + + std::vector output; + for (auto i = list1.begin(); i != list1.end(); ++i) { + output.push_back(i->data_); + } + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 0, 1, 2, 3, 4, 5)); +} + +// Test MoveBefore. Moving to the end of a list. +TEST(IListTest, MoveBefore3) { + TestNode nodes[10]; + TestList list1 = BuildList(nodes, 6); + TestList list2 = BuildList(nodes + 6, 3); + + TestList::iterator insertion_point = list1.end(); + insertion_point.MoveBefore(&list2); + + std::vector output; + for (auto i = list1.begin(); i != list1.end(); ++i) { + output.push_back(i->data_); + } + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5, 0, 1, 2)); +} + +// Test MoveBefore. Moving an empty list. +TEST(IListTest, MoveBefore4) { + TestNode nodes[10]; + TestList list1 = BuildList(nodes, 6); + TestList list2; + + TestList::iterator insertion_point = list1.end(); + insertion_point.MoveBefore(&list2); + + std::vector output; + for (auto i = list1.begin(); i != list1.end(); ++i) { + output.push_back(i->data_); + } + + EXPECT_THAT(output, ElementsAre(0, 1, 2, 3, 4, 5)); +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/util/small_vector_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/small_vector_test.cpp new file mode 100644 index 00000000000..01d7df18578 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/util/small_vector_test.cpp @@ -0,0 +1,598 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "source/util/small_vector.h" + +namespace spvtools { +namespace utils { +namespace { + +using SmallVectorTest = ::testing::Test; + +TEST(SmallVectorTest, Initialize_default) { + SmallVector vec; + + EXPECT_TRUE(vec.empty()); + EXPECT_EQ(vec.size(), 0); + EXPECT_EQ(vec.begin(), vec.end()); +} + +TEST(SmallVectorTest, Initialize_list1) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_FALSE(vec.empty()); + EXPECT_EQ(vec.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec.size(); ++i) { + EXPECT_EQ(vec[i], result[i]); + } +} + +TEST(SmallVectorTest, Initialize_list2) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_FALSE(vec.empty()); + EXPECT_EQ(vec.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec.size(); ++i) { + EXPECT_EQ(vec[i], result[i]); + } +} + +TEST(SmallVectorTest, Initialize_copy1) { + SmallVector vec1 = {0, 1, 2, 3}; + SmallVector vec2(vec1); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + + EXPECT_EQ(vec1, vec2); +} + +TEST(SmallVectorTest, Initialize_copy2) { + SmallVector vec1 = {0, 1, 2, 3}; + SmallVector vec2(vec1); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + + EXPECT_EQ(vec1, vec2); +} + +TEST(SmallVectorTest, Initialize_copy_vec1) { + std::vector vec1 = {0, 1, 2, 3}; + SmallVector vec2(vec1); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + + EXPECT_EQ(vec1, vec2); +} + +TEST(SmallVectorTest, Initialize_copy_vec2) { + std::vector vec1 = {0, 1, 2, 3}; + SmallVector vec2(vec1); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + + EXPECT_EQ(vec1, vec2); +} + +TEST(SmallVectorTest, Initialize_move1) { + SmallVector vec1 = {0, 1, 2, 3}; + SmallVector vec2(std::move(vec1)); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + EXPECT_TRUE(vec1.empty()); +} + +TEST(SmallVectorTest, Initialize_move2) { + SmallVector vec1 = {0, 1, 2, 3}; + SmallVector vec2(std::move(vec1)); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + EXPECT_TRUE(vec1.empty()); +} + +TEST(SmallVectorTest, Initialize_move_vec1) { + std::vector vec1 = {0, 1, 2, 3}; + SmallVector vec2(std::move(vec1)); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + EXPECT_TRUE(vec1.empty()); +} + +TEST(SmallVectorTest, Initialize_move_vec2) { + std::vector vec1 = {0, 1, 2, 3}; + SmallVector vec2(std::move(vec1)); + + EXPECT_EQ(vec2.size(), 4); + + uint32_t result[] = {0, 1, 2, 3}; + for (uint32_t i = 0; i < vec2.size(); ++i) { + EXPECT_EQ(vec2[i], result[i]); + } + EXPECT_TRUE(vec1.empty()); +} + +TEST(SmallVectorTest, Initialize_iterators1) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 4); + uint32_t result[] = {0, 1, 2, 3}; + + uint32_t i = 0; + for (uint32_t p : vec) { + EXPECT_EQ(p, result[i]); + i++; + } +} + +TEST(SmallVectorTest, Initialize_iterators2) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 4); + uint32_t result[] = {0, 1, 2, 3}; + + uint32_t i = 0; + for (uint32_t p : vec) { + EXPECT_EQ(p, result[i]); + i++; + } +} + +TEST(SmallVectorTest, Initialize_iterators3) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 4); + uint32_t result[] = {0, 1, 2, 3}; + + uint32_t i = 0; + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + EXPECT_EQ(*it, result[i]); + i++; + } +} + +TEST(SmallVectorTest, Initialize_iterators4) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 4); + uint32_t result[] = {0, 1, 2, 3}; + + uint32_t i = 0; + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + EXPECT_EQ(*it, result[i]); + i++; + } +} + +TEST(SmallVectorTest, Initialize_iterators_write1) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 4); + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + *it *= 2; + } + + uint32_t result[] = {0, 2, 4, 6}; + + uint32_t i = 0; + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + EXPECT_EQ(*it, result[i]); + i++; + } +} + +TEST(SmallVectorTest, Initialize_iterators_write2) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 4); + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + *it *= 2; + } + + uint32_t result[] = {0, 2, 4, 6}; + + uint32_t i = 0; + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + EXPECT_EQ(*it, result[i]); + i++; + } +} + +TEST(SmallVectorTest, Initialize_front) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.front(), 0); + for (SmallVector::iterator it = vec.begin(); it != vec.end(); + ++it) { + *it += 2; + } + EXPECT_EQ(vec.front(), 2); +} + +TEST(SmallVectorTest, Erase_element_front1) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.front(), 0); + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin()); + EXPECT_EQ(vec.front(), 1); + EXPECT_EQ(vec.size(), 3); +} + +TEST(SmallVectorTest, Erase_element_front2) { + SmallVector vec = {0, 1, 2, 3}; + + EXPECT_EQ(vec.front(), 0); + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin()); + EXPECT_EQ(vec.front(), 1); + EXPECT_EQ(vec.size(), 3); +} + +TEST(SmallVectorTest, Erase_element_back1) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {0, 1, 2}; + + EXPECT_EQ(vec[3], 3); + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin() + 3); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_element_back2) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {0, 1, 2}; + + EXPECT_EQ(vec[3], 3); + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin() + 3); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_element_middle1) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {0, 1, 3}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin() + 2); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_element_middle2) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {0, 1, 3}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin() + 2); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_range_1) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin(), vec.end()); + EXPECT_EQ(vec.size(), 0); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_range_2) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin(), vec.end()); + EXPECT_EQ(vec.size(), 0); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_range_3) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {2, 3}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin(), vec.begin() + 2); + EXPECT_EQ(vec.size(), 2); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_range_4) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {2, 3}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin(), vec.begin() + 2); + EXPECT_EQ(vec.size(), 2); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_range_5) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {0, 3}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin() + 1, vec.begin() + 3); + EXPECT_EQ(vec.size(), 2); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Erase_range_6) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {0, 3}; + + EXPECT_EQ(vec.size(), 4); + vec.erase(vec.begin() + 1, vec.begin() + 3); + EXPECT_EQ(vec.size(), 2); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Push_back) { + SmallVector vec; + SmallVector result = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 0); + vec.push_back(0); + EXPECT_EQ(vec.size(), 1); + vec.push_back(1); + EXPECT_EQ(vec.size(), 2); + vec.push_back(2); + EXPECT_EQ(vec.size(), 3); + vec.push_back(3); + EXPECT_EQ(vec.size(), 4); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Emplace_back) { + SmallVector vec; + SmallVector result = {0, 1, 2, 3}; + + EXPECT_EQ(vec.size(), 0); + vec.emplace_back(0); + EXPECT_EQ(vec.size(), 1); + vec.emplace_back(1); + EXPECT_EQ(vec.size(), 2); + vec.emplace_back(2); + EXPECT_EQ(vec.size(), 3); + vec.emplace_back(3); + EXPECT_EQ(vec.size(), 4); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Clear) { + SmallVector vec = {0, 1, 2, 3}; + SmallVector result = {}; + + EXPECT_EQ(vec.size(), 4); + vec.clear(); + EXPECT_EQ(vec.size(), 0); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Insert1) { + SmallVector vec = {}; + SmallVector insert_values = {10, 11}; + SmallVector result = {10, 11}; + + EXPECT_EQ(vec.size(), 0); + auto ret = + vec.insert(vec.begin(), insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 2); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert2) { + SmallVector vec = {}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {10, 11, 12}; + + EXPECT_EQ(vec.size(), 0); + auto ret = + vec.insert(vec.begin(), insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert3) { + SmallVector vec = {0}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {10, 11, 12, 0}; + + EXPECT_EQ(vec.size(), 1); + auto ret = + vec.insert(vec.begin(), insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 4); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert4) { + SmallVector vec = {0}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {10, 11, 12, 0}; + + EXPECT_EQ(vec.size(), 1); + auto ret = + vec.insert(vec.begin(), insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 4); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert5) { + SmallVector vec = {0, 1, 2}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {0, 1, 2, 10, 11, 12}; + + EXPECT_EQ(vec.size(), 3); + auto ret = vec.insert(vec.end(), insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert6) { + SmallVector vec = {0, 1, 2}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {0, 1, 2, 10, 11, 12}; + + EXPECT_EQ(vec.size(), 3); + auto ret = vec.insert(vec.end(), insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert7) { + SmallVector vec = {0, 1, 2}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {0, 10, 11, 12, 1, 2}; + + EXPECT_EQ(vec.size(), 3); + auto ret = + vec.insert(vec.begin() + 1, insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Insert8) { + SmallVector vec = {0, 1, 2}; + SmallVector insert_values = {10, 11, 12}; + SmallVector result = {0, 10, 11, 12, 1, 2}; + + EXPECT_EQ(vec.size(), 3); + auto ret = + vec.insert(vec.begin() + 1, insert_values.begin(), insert_values.end()); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); + EXPECT_EQ(*ret, 10); +} + +TEST(SmallVectorTest, Resize1) { + SmallVector vec = {0, 1, 2}; + SmallVector result = {0, 1, 2, 10, 10, 10}; + + EXPECT_EQ(vec.size(), 3); + vec.resize(6, 10); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Resize2) { + SmallVector vec = {0, 1, 2}; + SmallVector result = {0, 1, 2, 10, 10, 10}; + + EXPECT_EQ(vec.size(), 3); + vec.resize(6, 10); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Resize3) { + SmallVector vec = {0, 1, 2}; + SmallVector result = {0, 1, 2, 10, 10, 10}; + + EXPECT_EQ(vec.size(), 3); + vec.resize(6, 10); + EXPECT_EQ(vec.size(), 6); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Resize4) { + SmallVector vec = {0, 1, 2, 10, 10, 10}; + SmallVector result = {0, 1, 2}; + + EXPECT_EQ(vec.size(), 6); + vec.resize(3, 10); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Resize5) { + SmallVector vec = {0, 1, 2, 10, 10, 10}; + SmallVector result = {0, 1, 2}; + + EXPECT_EQ(vec.size(), 6); + vec.resize(3, 10); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +TEST(SmallVectorTest, Resize6) { + SmallVector vec = {0, 1, 2, 10, 10, 10}; + SmallVector result = {0, 1, 2}; + + EXPECT_EQ(vec.size(), 6); + vec.resize(3, 10); + EXPECT_EQ(vec.size(), 3); + EXPECT_EQ(vec, result); +} + +} // namespace +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/CMakeLists.txt new file mode 100644 index 00000000000..b1e87da6643 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/CMakeLists.txt @@ -0,0 +1,74 @@ +# Copyright (c) 2016 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. + +set(VAL_TEST_COMMON_SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/../test_fixture.h + ${CMAKE_CURRENT_SOURCE_DIR}/../unit_spirv.h + ${CMAKE_CURRENT_SOURCE_DIR}/val_fixtures.h +) + +add_spvtools_unittest(TARGET val_abcde + SRCS + val_adjacency_test.cpp + val_arithmetics_test.cpp + val_atomics_test.cpp + val_barriers_test.cpp + val_bitwise_test.cpp + val_builtins_test.cpp + val_capability_test.cpp + val_cfg_test.cpp + val_composites_test.cpp + val_conversion_test.cpp + val_data_test.cpp + val_decoration_test.cpp + val_derivatives_test.cpp + val_explicit_reserved_test.cpp + val_extensions_test.cpp + val_ext_inst_test.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS ${SPIRV_TOOLS} +) + +add_spvtools_unittest(TARGET val_limits + SRCS val_limits_test.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS ${SPIRV_TOOLS} +) + +add_spvtools_unittest(TARGET val_ijklmnop + SRCS + val_id_test.cpp + val_image_test.cpp + val_interfaces_test.cpp + val_layout_test.cpp + val_literals_test.cpp + val_logicals_test.cpp + val_non_uniform_test.cpp + val_primitives_test.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS ${SPIRV_TOOLS} +) + +add_spvtools_unittest(TARGET val_stuvw + SRCS + val_ssa_test.cpp + val_state_test.cpp + val_storage_test.cpp + val_type_unique_test.cpp + val_validation_state_test.cpp + val_version_test.cpp + val_webgpu_test.cpp + ${VAL_TEST_COMMON_SRCS} + LIBS ${SPIRV_TOOLS} +) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_adjacency_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_adjacency_test.cpp new file mode 100644 index 00000000000..d62830514ad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_adjacency_test.cpp @@ -0,0 +1,289 @@ +// Copyright (c) 2018 LunarG 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateAdjacency = spvtest::ValidateBase; + +TEST_F(ValidateAdjacency, OpPhiBeginsModuleFail) { + const std::string module = R"( +%result = OpPhi %bool %true %true_label %false %false_label +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%func = OpTypeFunction %void +%main = OpFunction %void None %func +%main_entry = OpLabel +OpBranch %true_label +%true_label = OpLabel +OpBranch %false_label +%false_label = OpLabel +OpBranch %end_label +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(module); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 1 has not been defined")); +} + +TEST_F(ValidateAdjacency, OpLoopMergeEndsModuleFail) { + const std::string module = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%main = OpFunction %void None %func +%main_entry = OpLabel +OpBranch %loop +%loop = OpLabel +OpLoopMerge %end %loop None +)"; + + CompileSuccessfully(module); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Missing OpFunctionEnd at end of module")); +} + +TEST_F(ValidateAdjacency, OpSelectionMergeEndsModuleFail) { + const std::string module = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%main = OpFunction %void None %func +%main_entry = OpLabel +OpBranch %merge +%merge = OpLabel +OpSelectionMerge %merge None +)"; + + CompileSuccessfully(module); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Missing OpFunctionEnd at end of module")); +} + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "OpCapability Shader", + const std::string& execution_model = "Fragment") { + std::ostringstream ss; + ss << capabilities_and_extensions << "\n"; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"\n"; + + ss << R"( +%string = OpString "" +%void = OpTypeVoid +%bool = OpTypeBool +%int = OpTypeInt 32 0 +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%zero = OpConstant %int 0 +%func = OpTypeFunction %void +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +TEST_F(ValidateAdjacency, OpPhiPreceededByOpLabelSuccess) { + const std::string body = R"( +OpSelectionMerge %end_label None +OpBranchConditional %true %true_label %false_label +%true_label = OpLabel +OpBranch %end_label +%false_label = OpLabel +OpBranch %end_label +%end_label = OpLabel +%line = OpLine %string 0 0 +%result = OpPhi %bool %true %true_label %false %false_label +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpPhiPreceededByOpPhiSuccess) { + const std::string body = R"( +OpSelectionMerge %end_label None +OpBranchConditional %true %true_label %false_label +%true_label = OpLabel +OpBranch %end_label +%false_label = OpLabel +OpBranch %end_label +%end_label = OpLabel +%1 = OpPhi %bool %true %true_label %false %false_label +%2 = OpPhi %bool %true %true_label %false %false_label +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpPhiPreceededByOpLineSuccess) { + const std::string body = R"( +OpSelectionMerge %end_label None +OpBranchConditional %true %true_label %false_label +%true_label = OpLabel +OpBranch %end_label +%false_label = OpLabel +OpBranch %end_label +%end_label = OpLabel +%line = OpLine %string 0 0 +%result = OpPhi %bool %true %true_label %false %false_label +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpPhiPreceededByBadOpFail) { + const std::string body = R"( +OpSelectionMerge %end_label None +OpBranchConditional %true %true_label %false_label +%true_label = OpLabel +OpBranch %end_label +%false_label = OpLabel +OpBranch %end_label +%end_label = OpLabel +OpNop +%result = OpPhi %bool %true %true_label %false %false_label +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpPhi must appear before all non-OpPhi instructions")); +} + +TEST_F(ValidateAdjacency, OpLoopMergePreceedsOpBranchSuccess) { + const std::string body = R"( +OpBranch %loop +%loop = OpLabel +OpLoopMerge %end %loop None +OpBranch %loop +%end = OpLabel +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpLoopMergePreceedsOpBranchConditionalSuccess) { + const std::string body = R"( +OpBranch %loop +%loop = OpLabel +OpLoopMerge %end %loop None +OpBranchConditional %true %loop %end +%end = OpLabel +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpLoopMergePreceedsBadOpFail) { + const std::string body = R"( +OpBranch %loop +%loop = OpLabel +OpLoopMerge %end %loop None +OpNop +OpBranchConditional %true %loop %end +%end = OpLabel +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpLoopMerge must immediately precede either an " + "OpBranch or OpBranchConditional instruction.")); +} + +TEST_F(ValidateAdjacency, OpSelectionMergePreceedsOpBranchConditionalSuccess) { + const std::string body = R"( +OpSelectionMerge %end_label None +OpBranchConditional %true %true_label %false_label +%true_label = OpLabel +OpBranch %end_label +%false_label = OpLabel +OpBranch %end_label +%end_label = OpLabel +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpSelectionMergePreceedsOpSwitchSuccess) { + const std::string body = R"( +OpSelectionMerge %merge None +OpSwitch %zero %merge 0 %label +%label = OpLabel +OpBranch %merge +%merge = OpLabel +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAdjacency, OpSelectionMergePreceedsBadOpFail) { + const std::string body = R"( +OpSelectionMerge %merge None +OpNop +OpSwitch %zero %merge 0 %label +%label = OpLabel +OpBranch %merge +%merge = OpLabel +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSelectionMerge must immediately precede either an " + "OpBranchConditional or OpSwitch instruction")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_arithmetics_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_arithmetics_test.cpp new file mode 100644 index 00000000000..1c8d88be5ad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_arithmetics_test.cpp @@ -0,0 +1,1278 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateArithmetics = spvtest::ValidateBase; + +std::string GenerateCode(const std::string& main_body) { + const std::string prefix = + R"( +OpCapability Shader +OpCapability Int64 +OpCapability Float64 +OpCapability Matrix +%ext_inst = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%boolvec2 = OpTypeVector %bool 2 +%s32vec2 = OpTypeVector %s32 2 +%u32vec2 = OpTypeVector %u32 2 +%u64vec2 = OpTypeVector %u64 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%s32vec3 = OpTypeVector %s32 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%u64vec4 = OpTypeVector %u64 4 +%s32vec4 = OpTypeVector %s32 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32mat22 = OpTypeMatrix %f32vec2 2 +%f32mat23 = OpTypeMatrix %f32vec2 3 +%f32mat32 = OpTypeMatrix %f32vec3 2 +%f32mat33 = OpTypeMatrix %f32vec3 3 +%f64mat22 = OpTypeMatrix %f64vec2 2 + +%struct_f32_f32 = OpTypeStruct %f32 %f32 +%struct_u32_u32 = OpTypeStruct %u32 %u32 +%struct_u32_u32_u32 = OpTypeStruct %u32 %u32 %u32 +%struct_s32_s32 = OpTypeStruct %s32 %s32 +%struct_s32_u32 = OpTypeStruct %s32 %u32 +%struct_u32vec2_u32vec2 = OpTypeStruct %u32vec2 %u32vec2 +%struct_s32vec2_s32vec2 = OpTypeStruct %s32vec2 %s32vec2 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_pi = OpConstant %f32 3.14159 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 +%s32_4 = OpConstant %s32 4 +%s32_m1 = OpConstant %s32 -1 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64_4 = OpConstant %f64 4 + +%s64_0 = OpConstant %s64 0 +%s64_1 = OpConstant %s64 1 +%s64_2 = OpConstant %s64 2 +%s64_3 = OpConstant %s64 3 +%s64_4 = OpConstant %s64 4 +%s64_m1 = OpConstant %s64 -1 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_4 = OpConstant %u64 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 +%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec2_12 = OpConstantComposite %f64vec2 %f64_1 %f64_2 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec3_123 = OpConstantComposite %f64vec3 %f64_1 %f64_2 %f64_3 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 +%f64vec4_1234 = OpConstantComposite %f64vec4 %f64_1 %f64_2 %f64_3 %f64_4 + +%f32mat22_1212 = OpConstantComposite %f32mat22 %f32vec2_12 %f32vec2_12 +%f32mat23_121212 = OpConstantComposite %f32mat23 %f32vec2_12 %f32vec2_12 %f32vec2_12 +%f32mat32_123123 = OpConstantComposite %f32mat32 %f32vec3_123 %f32vec3_123 +%f32mat33_123123123 = OpConstantComposite %f32mat33 %f32vec3_123 %f32vec3_123 %f32vec3_123 + +%f64mat22_1212 = OpConstantComposite %f64mat22 %f64vec2_12 %f64vec2_12 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string suffix = + R"( +OpReturn +OpFunctionEnd)"; + + return prefix + main_body + suffix; +} + +TEST_F(ValidateArithmetics, F32Success) { + const std::string body = R"( +%val1 = OpFMul %f32 %f32_0 %f32_1 +%val2 = OpFSub %f32 %f32_2 %f32_0 +%val3 = OpFAdd %f32 %val1 %val2 +%val4 = OpFNegate %f32 %val3 +%val5 = OpFDiv %f32 %val4 %val1 +%val6 = OpFRem %f32 %val4 %f32_2 +%val7 = OpFMod %f32 %val4 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, F64Success) { + const std::string body = R"( +%val1 = OpFMul %f64 %f64_0 %f64_1 +%val2 = OpFSub %f64 %f64_2 %f64_0 +%val3 = OpFAdd %f64 %val1 %val2 +%val4 = OpFNegate %f64 %val3 +%val5 = OpFDiv %f64 %val4 %val1 +%val6 = OpFRem %f64 %val4 %f64_2 +%val7 = OpFMod %f64 %val4 %f64_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, Int32Success) { + const std::string body = R"( +%val1 = OpIMul %u32 %s32_0 %u32_1 +%val2 = OpIMul %s32 %s32_2 %u32_1 +%val3 = OpIAdd %u32 %val1 %val2 +%val4 = OpIAdd %s32 %val1 %val2 +%val5 = OpISub %u32 %val3 %val4 +%val6 = OpISub %s32 %val4 %val3 +%val7 = OpSDiv %s32 %val4 %val3 +%val8 = OpSNegate %s32 %val7 +%val9 = OpSRem %s32 %val4 %val3 +%val10 = OpSMod %s32 %val4 %val3 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, Int64Success) { + const std::string body = R"( +%val1 = OpIMul %u64 %s64_0 %u64_1 +%val2 = OpIMul %s64 %s64_2 %u64_1 +%val3 = OpIAdd %u64 %val1 %val2 +%val4 = OpIAdd %s64 %val1 %val2 +%val5 = OpISub %u64 %val3 %val4 +%val6 = OpISub %s64 %val4 %val3 +%val7 = OpSDiv %s64 %val4 %val3 +%val8 = OpSNegate %s64 %val7 +%val9 = OpSRem %s64 %val4 %val3 +%val10 = OpSMod %s64 %val4 %val3 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, F32Vec2Success) { + const std::string body = R"( +%val1 = OpFMul %f32vec2 %f32vec2_01 %f32vec2_12 +%val2 = OpFSub %f32vec2 %f32vec2_12 %f32vec2_01 +%val3 = OpFAdd %f32vec2 %val1 %val2 +%val4 = OpFNegate %f32vec2 %val3 +%val5 = OpFDiv %f32vec2 %val4 %val1 +%val6 = OpFRem %f32vec2 %val4 %f32vec2_12 +%val7 = OpFMod %f32vec2 %val4 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, F64Vec2Success) { + const std::string body = R"( +%val1 = OpFMul %f64vec2 %f64vec2_01 %f64vec2_12 +%val2 = OpFSub %f64vec2 %f64vec2_12 %f64vec2_01 +%val3 = OpFAdd %f64vec2 %val1 %val2 +%val4 = OpFNegate %f64vec2 %val3 +%val5 = OpFDiv %f64vec2 %val4 %val1 +%val6 = OpFRem %f64vec2 %val4 %f64vec2_12 +%val7 = OpFMod %f64vec2 %val4 %f64vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, U32Vec2Success) { + const std::string body = R"( +%val1 = OpIMul %u32vec2 %u32vec2_01 %u32vec2_12 +%val2 = OpISub %u32vec2 %u32vec2_12 %u32vec2_01 +%val3 = OpIAdd %u32vec2 %val1 %val2 +%val4 = OpSNegate %u32vec2 %val3 +%val5 = OpSDiv %u32vec2 %val4 %val1 +%val6 = OpSRem %u32vec2 %val4 %u32vec2_12 +%val7 = OpSMod %u32vec2 %val4 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, FNegateTypeIdU32) { + const std::string body = R"( +%val = OpFNegate %u32 %u32_0 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected floating scalar or vector type as Result Type: FNegate")); +} + +TEST_F(ValidateArithmetics, FNegateTypeIdVec2U32) { + const std::string body = R"( +%val = OpFNegate %u32vec2 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected floating scalar or vector type as Result Type: FNegate")); +} + +TEST_F(ValidateArithmetics, FNegateWrongOperand) { + const std::string body = R"( +%val = OpFNegate %f32 %u32_0 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FNegate operand index 2")); +} + +TEST_F(ValidateArithmetics, FMulTypeIdU32) { + const std::string body = R"( +%val = OpFMul %u32 %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected floating scalar or vector type as Result Type: FMul")); +} + +TEST_F(ValidateArithmetics, FMulTypeIdVec2U32) { + const std::string body = R"( +%val = OpFMul %u32vec2 %u32vec2_01 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected floating scalar or vector type as Result Type: FMul")); +} + +TEST_F(ValidateArithmetics, FMulWrongOperand1) { + const std::string body = R"( +%val = OpFMul %f32 %u32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FMul operand index 2")); +} + +TEST_F(ValidateArithmetics, FMulWrongOperand2) { + const std::string body = R"( +%val = OpFMul %f32 %f32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FMul operand index 3")); +} + +TEST_F(ValidateArithmetics, FMulWrongVectorOperand1) { + const std::string body = R"( +%val = OpFMul %f64vec3 %f32vec3_123 %f64vec3_012 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FMul operand index 2")); +} + +TEST_F(ValidateArithmetics, FMulWrongVectorOperand2) { + const std::string body = R"( +%val = OpFMul %f32vec3 %f32vec3_123 %f64vec3_012 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "FMul operand index 3")); +} + +TEST_F(ValidateArithmetics, IMulFloatTypeId) { + const std::string body = R"( +%val = OpIMul %f32 %u32_0 %s32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as Result Type: IMul")); +} + +TEST_F(ValidateArithmetics, IMulFloatOperand1) { + const std::string body = R"( +%val = OpIMul %u32 %f32_0 %s32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as operand: " + "IMul operand index 2")); +} + +TEST_F(ValidateArithmetics, IMulFloatOperand2) { + const std::string body = R"( +%val = OpIMul %u32 %s32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as operand: " + "IMul operand index 3")); +} + +TEST_F(ValidateArithmetics, IMulWrongBitWidthOperand1) { + const std::string body = R"( +%val = OpIMul %u64 %u32_0 %s64_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same bit width " + "as Result Type: IMul operand index 2")); +} + +TEST_F(ValidateArithmetics, IMulWrongBitWidthOperand2) { + const std::string body = R"( +%val = OpIMul %u32 %u32_0 %s64_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same bit width " + "as Result Type: IMul operand index 3")); +} + +TEST_F(ValidateArithmetics, IMulWrongBitWidthVector) { + const std::string body = R"( +%val = OpIMul %u64vec3 %u32vec3_012 %u32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same bit width " + "as Result Type: IMul operand index 2")); +} + +TEST_F(ValidateArithmetics, IMulVectorScalarOperand1) { + const std::string body = R"( +%val = OpIMul %u32vec2 %u32_0 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same dimension " + "as Result Type: IMul operand index 2")); +} + +TEST_F(ValidateArithmetics, IMulVectorScalarOperand2) { + const std::string body = R"( +%val = OpIMul %u32vec2 %u32vec2_01 %u32_0 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same dimension " + "as Result Type: IMul operand index 3")); +} + +TEST_F(ValidateArithmetics, IMulScalarVectorOperand1) { + const std::string body = R"( +%val = OpIMul %s32 %u32vec2_01 %u32_0 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same dimension " + "as Result Type: IMul operand index 2")); +} + +TEST_F(ValidateArithmetics, IMulScalarVectorOperand2) { + const std::string body = R"( +%val = OpIMul %u32 %u32_0 %s32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected arithmetic operands to have the same dimension " + "as Result Type: IMul operand index 3")); +} + +TEST_F(ValidateArithmetics, SNegateFloat) { + const std::string body = R"( +%val = OpSNegate %s32 %f32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as operand: " + "SNegate operand index 2")); +} + +TEST_F(ValidateArithmetics, UDivFloatType) { + const std::string body = R"( +%val = OpUDiv %f32 %u32_2 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected unsigned int scalar or vector type as Result Type: UDiv")); +} + +TEST_F(ValidateArithmetics, UDivSignedIntType) { + const std::string body = R"( +%val = OpUDiv %s32 %u32_2 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected unsigned int scalar or vector type as Result Type: UDiv")); +} + +TEST_F(ValidateArithmetics, UDivWrongOperand1) { + const std::string body = R"( +%val = OpUDiv %u64 %f64_2 %u64_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "UDiv operand index 2")); +} + +TEST_F(ValidateArithmetics, UDivWrongOperand2) { + const std::string body = R"( +%val = OpUDiv %u64 %u64_2 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected arithmetic operands to be of Result Type: " + "UDiv operand index 3")); +} + +TEST_F(ValidateArithmetics, DotSuccess) { + const std::string body = R"( +%val = OpDot %f32 %f32vec2_01 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, DotWrongTypeId) { + const std::string body = R"( +%val = OpDot %u32 %u32vec2_01 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float scalar type as Result Type: Dot")); +} + +TEST_F(ValidateArithmetics, DotNotVectorTypeOperand1) { + const std::string body = R"( +%val = OpDot %f32 %f32 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected float vector as operand: Dot operand index 2")); +} + +TEST_F(ValidateArithmetics, DotNotVectorTypeOperand2) { + const std::string body = R"( +%val = OpDot %f32 %f32vec3_012 %f32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected float vector as operand: Dot operand index 3")); +} + +TEST_F(ValidateArithmetics, DotWrongComponentOperand1) { + const std::string body = R"( +%val = OpDot %f64 %f32vec2_01 %f64vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected component type to be equal to Result Type: " + "Dot operand index 2")); +} + +TEST_F(ValidateArithmetics, DotWrongComponentOperand2) { + const std::string body = R"( +%val = OpDot %f32 %f32vec2_01 %f64vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected component type to be equal to Result Type: " + "Dot operand index 3")); +} + +TEST_F(ValidateArithmetics, DotDifferentVectorSize) { + const std::string body = R"( +%val = OpDot %f32 %f32vec2_01 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected operands to have the same number of componenets: Dot")); +} + +TEST_F(ValidateArithmetics, VectorTimesScalarSuccess) { + const std::string body = R"( +%val = OpVectorTimesScalar %f32vec2 %f32vec2_01 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, VectorTimesScalarWrongTypeId) { + const std::string body = R"( +%val = OpVectorTimesScalar %u32vec2 %f32vec2_01 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float vector type as Result Type: " + "VectorTimesScalar")); +} + +TEST_F(ValidateArithmetics, VectorTimesScalarWrongVector) { + const std::string body = R"( +%val = OpVectorTimesScalar %f32vec2 %f32vec3_012 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected vector operand type to be equal to Result Type: " + "VectorTimesScalar")); +} + +TEST_F(ValidateArithmetics, VectorTimesScalarWrongScalar) { + const std::string body = R"( +%val = OpVectorTimesScalar %f32vec2 %f32vec2_01 %f64_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected scalar operand type to be equal to the component " + "type of the vector operand: VectorTimesScalar")); +} + +TEST_F(ValidateArithmetics, MatrixTimesScalarSuccess) { + const std::string body = R"( +%val = OpMatrixTimesScalar %f32mat22 %f32mat22_1212 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, MatrixTimesScalarWrongTypeId) { + const std::string body = R"( +%val = OpMatrixTimesScalar %f32vec2 %f32mat22_1212 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float matrix type as Result Type: " + "MatrixTimesScalar")); +} + +TEST_F(ValidateArithmetics, MatrixTimesScalarWrongMatrix) { + const std::string body = R"( +%val = OpMatrixTimesScalar %f32mat22 %f32vec2_01 %f32_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected matrix operand type to be equal to Result Type: " + "MatrixTimesScalar")); +} + +TEST_F(ValidateArithmetics, MatrixTimesScalarWrongScalar) { + const std::string body = R"( +%val = OpMatrixTimesScalar %f32mat22 %f32mat22_1212 %f64_2 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected scalar operand type to be equal to the component " + "type of the matrix operand: MatrixTimesScalar")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrix2x22Success) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f32vec2_12 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrix3x32Success) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f32vec3_123 %f32mat32_123123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrixWrongTypeId) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32mat22 %f32vec2_12 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float vector type as Result Type: " + "VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrixNotFloatVector) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %u32vec2_12 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float vector type as left operand: " + "VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrixWrongVectorComponent) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f64vec2_12 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected component types of Result Type and vector to be equal: " + "VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrixWrongMatrix) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f32vec2_12 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float matrix type as right operand: " + "VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrixWrongMatrixComponent) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f32vec2_12 %f64mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected component types of Result Type and matrix to be equal: " + "VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrix2eq2x23Fail) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f32vec2_12 %f32mat23_121212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected number of columns of the matrix to be equal to Result Type " + "vector size: VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, VectorTimesMatrix2x32Fail) { + const std::string body = R"( +%val = OpVectorTimesMatrix %f32vec2 %f32vec2_12 %f32mat32_123123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected number of rows of the matrix to be equal to the vector " + "operand size: VectorTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesVector22x2Success) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec2 %f32mat22_1212 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, MatrixTimesVector23x3Success) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec2 %f32mat23_121212 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, MatrixTimesVectorWrongTypeId) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32mat22 %f32mat22_1212 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float vector type as Result Type: " + "MatrixTimesVector")); +} + +TEST_F(ValidateArithmetics, MatrixTimesVectorWrongMatrix) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec3 %f32vec3_123 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float matrix type as left operand: " + "MatrixTimesVector")); +} + +TEST_F(ValidateArithmetics, MatrixTimesVectorWrongMatrixCol) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec3 %f32mat23_121212 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected column type of the matrix to be equal to Result Type: " + "MatrixTimesVector")); +} + +TEST_F(ValidateArithmetics, MatrixTimesVectorWrongVector) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec2 %f32mat22_1212 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float vector type as right operand: " + "MatrixTimesVector")); +} + +TEST_F(ValidateArithmetics, MatrixTimesVectorDifferentComponents) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec2 %f32mat22_1212 %f64vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected component types of the operands to be equal: " + "MatrixTimesVector")); +} + +TEST_F(ValidateArithmetics, MatrixTimesVector22x3Fail) { + const std::string body = R"( +%val = OpMatrixTimesVector %f32vec2 %f32mat22_1212 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected number of columns of the matrix to be equal to the vector " + "size: MatrixTimesVector")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrix22x22Success) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat22_1212 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrix23x32Success) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat23_121212 %f32mat32_123123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrix33x33Success) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat33 %f32mat33_123123123 %f32mat33_123123123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrixWrongTypeId) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32vec2 %f32mat22_1212 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected float matrix type as Result Type: MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrixWrongLeftOperand) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32vec2_12 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected float matrix type as left operand: MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrixWrongRightOperand) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat22_1212 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected float matrix type as right operand: MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrix32x23Fail) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat32_123123 %f32mat23_121212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected column types of Result Type and left matrix to be equal: " + "MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrixDifferentComponents) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat22_1212 %f64mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected component types of Result Type and right " + "matrix to be equal: " + "MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrix23x23Fail) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat23_121212 %f32mat23_121212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected number of columns of Result Type and right " + "matrix to be equal: " + "MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, MatrixTimesMatrix23x22Fail) { + const std::string body = R"( +%val = OpMatrixTimesMatrix %f32mat22 %f32mat23_121212 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected number of columns of left matrix and number " + "of rows of right " + "matrix to be equal: MatrixTimesMatrix")); +} + +TEST_F(ValidateArithmetics, OuterProduct2x2Success) { + const std::string body = R"( +%val = OpOuterProduct %f32mat22 %f32vec2_12 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, OuterProduct3x2Success) { + const std::string body = R"( +%val = OpOuterProduct %f32mat32 %f32vec3_123 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, OuterProduct2x3Success) { + const std::string body = R"( +%val = OpOuterProduct %f32mat23 %f32vec2_01 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, OuterProductWrongTypeId) { + const std::string body = R"( +%val = OpOuterProduct %f32vec2 %f32vec2_01 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected float matrix type as Result Type: " + "OuterProduct")); +} + +TEST_F(ValidateArithmetics, OuterProductWrongLeftOperand) { + const std::string body = R"( +%val = OpOuterProduct %f32mat22 %f32vec3_123 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected column type of Result Type to be equal to the type " + "of the left operand: OuterProduct")); +} + +TEST_F(ValidateArithmetics, OuterProductRightOperandNotFloatVector) { + const std::string body = R"( +%val = OpOuterProduct %f32mat22 %f32vec2_12 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected float vector type as right operand: OuterProduct")); +} + +TEST_F(ValidateArithmetics, OuterProductRightOperandWrongComponent) { + const std::string body = R"( +%val = OpOuterProduct %f32mat22 %f32vec2_12 %f64vec2_01 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected component types of the operands to be equal: " + "OuterProduct")); +} + +TEST_F(ValidateArithmetics, OuterProductRightOperandWrongDimension) { + const std::string body = R"( +%val = OpOuterProduct %f32mat22 %f32vec2_12 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected number of columns of the matrix to be equal to the " + "vector size of the right operand: OuterProduct")); +} + +TEST_F(ValidateArithmetics, IAddCarrySuccess) { + const std::string body = R"( +%val1 = OpIAddCarry %struct_u32_u32 %u32_0 %u32_1 +%val2 = OpIAddCarry %struct_u32vec2_u32vec2 %u32vec2_01 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, IAddCarryResultTypeNotStruct) { + const std::string body = R"( +%val = OpIAddCarry %u32 %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected a struct as Result Type: IAddCarry")); +} + +TEST_F(ValidateArithmetics, IAddCarryResultTypeNotTwoMembers) { + const std::string body = R"( +%val = OpIAddCarry %struct_u32_u32_u32 %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type struct to have two members: IAddCarry")); +} + +TEST_F(ValidateArithmetics, IAddCarryResultTypeMemberNotUnsignedInt) { + const std::string body = R"( +%val = OpIAddCarry %struct_s32_s32 %s32_0 %s32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type struct member types to be " + "unsigned integer scalar " + "or vector: IAddCarry")); +} + +TEST_F(ValidateArithmetics, IAddCarryWrongLeftOperand) { + const std::string body = R"( +%val = OpIAddCarry %struct_u32_u32 %s32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both operands to be of Result Type member " + "type: IAddCarry")); +} + +TEST_F(ValidateArithmetics, IAddCarryWrongRightOperand) { + const std::string body = R"( +%val = OpIAddCarry %struct_u32_u32 %u32_0 %s32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both operands to be of Result Type member " + "type: IAddCarry")); +} + +TEST_F(ValidateArithmetics, OpSMulExtendedSuccess) { + const std::string body = R"( +%val1 = OpSMulExtended %struct_u32_u32 %u32_0 %u32_1 +%val2 = OpSMulExtended %struct_s32_s32 %s32_0 %s32_1 +%val3 = OpSMulExtended %struct_u32vec2_u32vec2 %u32vec2_01 %u32vec2_12 +%val4 = OpSMulExtended %struct_s32vec2_s32vec2 %s32vec2_01 %s32vec2_12 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateArithmetics, SMulExtendedResultTypeMemberNotInt) { + const std::string body = R"( +%val = OpSMulExtended %struct_f32_f32 %f32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type struct member types to be integer scalar " + "or vector: SMulExtended")); +} + +TEST_F(ValidateArithmetics, SMulExtendedResultTypeMembersNotIdentical) { + const std::string body = R"( +%val = OpSMulExtended %struct_s32_u32 %s32_0 %s32_1 +)"; + + CompileSuccessfully(GenerateCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type struct member types to be identical: " + "SMulExtended")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_atomics_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_atomics_test.cpp new file mode 100644 index 00000000000..9aece39aa19 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_atomics_test.cpp @@ -0,0 +1,1016 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateAtomics = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability Int64 +)"; + + ss << capabilities_and_extensions; + ss << R"( +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%f32vec4 = OpTypeVector %f32 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u64_1 = OpConstant %u64 1 +%f32vec4_0000 = OpConstantComposite %f32vec4 %f32_0 %f32_0 %f32_0 %f32_0 + +%cross_device = OpConstant %u32 0 +%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 +%subgroup = OpConstant %u32 3 +%invocation = OpConstant %u32 4 + +%relaxed = OpConstant %u32 0 +%acquire = OpConstant %u32 2 +%release = OpConstant %u32 4 +%acquire_release = OpConstant %u32 8 +%acquire_and_release = OpConstant %u32 6 +%sequentially_consistent = OpConstant %u32 16 +%acquire_release_uniform_workgroup = OpConstant %u32 328 + +%f32_ptr = OpTypePointer Workgroup %f32 +%f32_var = OpVariable %f32_ptr Workgroup + +%u32_ptr = OpTypePointer Workgroup %u32 +%u32_var = OpVariable %u32_ptr Workgroup + +%u64_ptr = OpTypePointer Workgroup %u64 +%u64_var = OpVariable %u64_ptr Workgroup + +%f32vec4_ptr = OpTypePointer Workgroup %f32vec4 +%f32vec4_var = OpVariable %f32vec4_ptr Workgroup + +%f32_ptr_function = OpTypePointer Function %f32 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +std::string GenerateKernelCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + std::ostringstream ss; + ss << R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability Int64 +)"; + + ss << capabilities_and_extensions; + ss << R"( +OpMemoryModel Physical32 OpenCL +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%f32vec4 = OpTypeVector %f32 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u64_1 = OpConstant %u64 1 +%f32vec4_0000 = OpConstantComposite %f32vec4 %f32_0 %f32_0 %f32_0 %f32_0 + +%cross_device = OpConstant %u32 0 +%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 +%subgroup = OpConstant %u32 3 +%invocation = OpConstant %u32 4 + +%relaxed = OpConstant %u32 0 +%acquire = OpConstant %u32 2 +%release = OpConstant %u32 4 +%acquire_release = OpConstant %u32 8 +%acquire_and_release = OpConstant %u32 6 +%sequentially_consistent = OpConstant %u32 16 +%acquire_release_uniform_workgroup = OpConstant %u32 328 +%acquire_release_atomic_counter_workgroup = OpConstant %u32 1288 + +%f32_ptr = OpTypePointer Workgroup %f32 +%f32_var = OpVariable %f32_ptr Workgroup + +%u32_ptr = OpTypePointer Workgroup %u32 +%u32_var = OpVariable %u32_ptr Workgroup + +%u64_ptr = OpTypePointer Workgroup %u64 +%u64_var = OpVariable %u64_ptr Workgroup + +%f32vec4_ptr = OpTypePointer Workgroup %f32vec4 +%f32vec4_var = OpVariable %f32vec4_ptr Workgroup + +%f32_ptr_function = OpTypePointer Function %f32 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +TEST_F(ValidateAtomics, AtomicLoadShaderSuccess) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %u32_var %device %relaxed +%val2 = OpAtomicLoad %u32 %u32_var %workgroup %acquire +%val3 = OpAtomicLoad %u64 %u64_var %subgroup %sequentially_consistent +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicLoadKernelSuccess) { + const std::string body = R"( +%val1 = OpAtomicLoad %f32 %f32_var %device %relaxed +%val2 = OpAtomicLoad %u32 %u32_var %workgroup %sequentially_consistent +%val3 = OpAtomicLoad %u64 %u64_var %subgroup %acquire +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicLoadVulkanSuccess) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %u32_var %device %relaxed +%val2 = OpAtomicLoad %u32 %u32_var %workgroup %acquire +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +// TODO(atgoo@github.com): the corresponding check fails Vulkan CTS, +// reenable once fixed. +TEST_F(ValidateAtomics, DISABLED_AtomicLoadVulkanSubgroup) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %u32_var %subgroup %acquire +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicLoad: in Vulkan environment memory scope is " + "limited to Device, Workgroup and Invocation")); +} + +TEST_F(ValidateAtomics, AtomicLoadVulkanRelease) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %u32_var %workgroup %release +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics " + "Release, AcquireRelease and SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicLoadVulkanAcquireRelease) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %u32_var %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics " + "Release, AcquireRelease and SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicLoadVulkanSequentiallyConsistent) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %u32_var %workgroup %sequentially_consistent +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Vulkan spec disallows OpAtomicLoad with Memory Semantics " + "Release, AcquireRelease and SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicLoadShaderFloat) { + const std::string body = R"( +%val1 = OpAtomicLoad %f32 %f32_var %device %relaxed +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicLoad: " + "expected Result Type to be int scalar type")); +} + +TEST_F(ValidateAtomics, AtomicLoadVulkanInt64) { + const std::string body = R"( +%val1 = OpAtomicLoad %u64 %u64_var %device %relaxed +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicLoad: according to the Vulkan spec atomic " + "Result Type needs to be a 32-bit int scalar type")); +} + +TEST_F(ValidateAtomics, AtomicLoadWrongResultType) { + const std::string body = R"( +%val1 = OpAtomicLoad %f32vec4 %f32vec4_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicLoad: " + "expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateAtomics, AtomicLoadWrongPointerType) { + const std::string body = R"( +%val1 = OpAtomicLoad %f32 %f32_ptr %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicLoad: expected Pointer to be of type OpTypePointer")); +} + +TEST_F(ValidateAtomics, AtomicLoadWrongPointerDataType) { + const std::string body = R"( +%val1 = OpAtomicLoad %u32 %f32_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicLoad: " + "expected Pointer to point to a value of type Result Type")); +} + +TEST_F(ValidateAtomics, AtomicLoadWrongScopeType) { + const std::string body = R"( +%val1 = OpAtomicLoad %f32 %f32_var %f32_1 %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicLoad: expected Scope to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicLoadWrongMemorySemanticsType) { + const std::string body = R"( +%val1 = OpAtomicLoad %f32 %f32_var %device %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicLoad: expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicStoreKernelSuccess) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +OpAtomicStore %u32_var %subgroup %release %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicStoreShaderSuccess) { + const std::string body = R"( +OpAtomicStore %u32_var %device %release %u32_1 +OpAtomicStore %u32_var %subgroup %sequentially_consistent %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicStoreVulkanSuccess) { + const std::string body = R"( +OpAtomicStore %u32_var %device %release %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateAtomics, AtomicStoreVulkanAcquire) { + const std::string body = R"( +OpAtomicStore %u32_var %device %acquire %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics " + "Acquire, AcquireRelease and SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicStoreVulkanAcquireRelease) { + const std::string body = R"( +OpAtomicStore %u32_var %device %acquire_release %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics " + "Acquire, AcquireRelease and SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicStoreVulkanSequentiallyConsistent) { + const std::string body = R"( +OpAtomicStore %u32_var %device %sequentially_consistent %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Vulkan spec disallows OpAtomicStore with Memory Semantics " + "Acquire, AcquireRelease and SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicStoreWrongPointerType) { + const std::string body = R"( +OpAtomicStore %f32_1 %device %relaxed %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicStore: expected Pointer to be of type OpTypePointer")); +} + +TEST_F(ValidateAtomics, AtomicStoreWrongPointerDataType) { + const std::string body = R"( +OpAtomicStore %f32vec4_var %device %relaxed %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicStore: " + "expected Pointer to be a pointer to int or float scalar " + "type")); +} + +TEST_F(ValidateAtomics, AtomicStoreWrongPointerStorageType) { + const std::string body = R"( +%f32_var_function = OpVariable %f32_ptr_function Function +OpAtomicStore %f32_var_function %device %relaxed %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicStore: expected Pointer Storage Class to be Uniform, " + "Workgroup, CrossWorkgroup, Generic, AtomicCounter, Image or " + "StorageBuffer")); +} + +TEST_F(ValidateAtomics, AtomicStoreWrongScopeType) { + const std::string body = R"( +OpAtomicStore %f32_var %f32_1 %relaxed %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicStore: expected Scope to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicStoreWrongMemorySemanticsType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %f32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicStore: expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicStoreWrongValueType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicStore: " + "expected Value type and the type pointed to by Pointer to " + "be the same")); +} + +TEST_F(ValidateAtomics, AtomicExchangeShaderSuccess) { + const std::string body = R"( +%val1 = OpAtomicStore %u32_var %device %relaxed %u32_1 +%val2 = OpAtomicExchange %u32 %u32_var %device %relaxed %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicExchangeKernelSuccess) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicExchange %f32 %f32_var %device %relaxed %f32_0 +%val3 = OpAtomicStore %u32_var %device %relaxed %u32_1 +%val4 = OpAtomicExchange %u32 %u32_var %device %relaxed %u32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicExchangeShaderFloat) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicExchange %f32 %f32_var %device %relaxed %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicExchange: " + "expected Result Type to be int scalar type")); +} + +TEST_F(ValidateAtomics, AtomicExchangeWrongResultType) { + const std::string body = R"( +%val1 = OpStore %f32vec4_var %f32vec4_0000 +%val2 = OpAtomicExchange %f32vec4 %f32vec4_var %device %relaxed %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicExchange: " + "expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateAtomics, AtomicExchangeWrongPointerType) { + const std::string body = R"( +%val2 = OpAtomicExchange %f32 %f32vec4_ptr %device %relaxed %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "AtomicExchange: expected Pointer to be of type OpTypePointer")); +} + +TEST_F(ValidateAtomics, AtomicExchangeWrongPointerDataType) { + const std::string body = R"( +%val1 = OpStore %f32vec4_var %f32vec4_0000 +%val2 = OpAtomicExchange %f32 %f32vec4_var %device %relaxed %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicExchange: " + "expected Pointer to point to a value of type Result Type")); +} + +TEST_F(ValidateAtomics, AtomicExchangeWrongScopeType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicExchange %f32 %f32_var %f32_1 %relaxed %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicExchange: expected Scope to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicExchangeWrongMemorySemanticsType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicExchange %f32 %f32_var %device %f32_1 %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicExchange: expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicExchangeWrongValueType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicExchange %f32 %f32_var %device %relaxed %u32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicExchange: " + "expected Value to be of type Result Type")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeShaderSuccess) { + const std::string body = R"( +%val1 = OpAtomicStore %u32_var %device %relaxed %u32_1 +%val2 = OpAtomicCompareExchange %u32 %u32_var %device %relaxed %relaxed %u32_0 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeKernelSuccess) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %relaxed %f32_0 %f32_1 +%val3 = OpAtomicStore %u32_var %device %relaxed %u32_1 +%val4 = OpAtomicCompareExchange %u32 %u32_var %device %relaxed %relaxed %u32_0 %u32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeShaderFloat) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val1 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %relaxed %f32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchange: " + "expected Result Type to be int scalar type")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongResultType) { + const std::string body = R"( +%val1 = OpStore %f32vec4_var %f32vec4_0000 +%val2 = OpAtomicCompareExchange %f32vec4 %f32vec4_var %device %relaxed %relaxed %f32vec4_0000 %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchange: " + "expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongPointerType) { + const std::string body = R"( +%val2 = OpAtomicCompareExchange %f32 %f32vec4_ptr %device %relaxed %relaxed %f32vec4_0000 %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchange: expected Pointer to be of type " + "OpTypePointer")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongPointerDataType) { + const std::string body = R"( +%val1 = OpStore %f32vec4_var %f32vec4_0000 +%val2 = OpAtomicCompareExchange %f32 %f32vec4_var %device %relaxed %relaxed %f32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicCompareExchange: " + "expected Pointer to point to a value of type Result Type")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongScopeType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %f32_1 %relaxed %relaxed %f32_0 %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicCompareExchange: expected Scope to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongMemorySemanticsType1) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %device %f32_1 %relaxed %f32_0 %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "AtomicCompareExchange: expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongMemorySemanticsType2) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %f32_1 %f32_0 %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "AtomicCompareExchange: expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeUnequalRelease) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %release %f32_0 %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchange: Memory Semantics Release and " + "AcquireRelease cannot be used for operand Unequal")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongValueType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %relaxed %u32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchange: " + "expected Value to be of type Result Type")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWrongComparatorType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchange %f32 %f32_var %device %relaxed %relaxed %f32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchange: " + "expected Comparator to be of type Result Type")); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWeakSuccess) { + const std::string body = R"( +%val3 = OpAtomicStore %u32_var %device %relaxed %u32_1 +%val4 = OpAtomicCompareExchangeWeak %u32 %u32_var %device %relaxed %relaxed %u32_0 %u32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicCompareExchangeWeakWrongResultType) { + const std::string body = R"( +OpAtomicStore %f32_var %device %relaxed %f32_1 +%val2 = OpAtomicCompareExchangeWeak %f32 %f32_var %device %relaxed %relaxed %f32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicCompareExchangeWeak: " + "expected Result Type to be int scalar type")); +} + +TEST_F(ValidateAtomics, AtomicArithmeticsSuccess) { + const std::string body = R"( +OpAtomicStore %u32_var %device %relaxed %u32_1 +%val1 = OpAtomicIIncrement %u32 %u32_var %device %acquire_release +%val2 = OpAtomicIDecrement %u32 %u32_var %device %acquire_release +%val3 = OpAtomicIAdd %u32 %u32_var %device %acquire_release %u32_1 +%val4 = OpAtomicISub %u32 %u32_var %device %acquire_release %u32_1 +%val5 = OpAtomicUMin %u32 %u32_var %device %acquire_release %u32_1 +%val6 = OpAtomicUMax %u32 %u32_var %device %acquire_release %u32_1 +%val7 = OpAtomicSMin %u32 %u32_var %device %sequentially_consistent %u32_1 +%val8 = OpAtomicSMax %u32 %u32_var %device %sequentially_consistent %u32_1 +%val9 = OpAtomicAnd %u32 %u32_var %device %sequentially_consistent %u32_1 +%val10 = OpAtomicOr %u32 %u32_var %device %sequentially_consistent %u32_1 +%val11 = OpAtomicXor %u32 %u32_var %device %sequentially_consistent %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicFlagsSuccess) { + const std::string body = R"( +OpAtomicFlagClear %u32_var %device %release +%val1 = OpAtomicFlagTestAndSet %bool %u32_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicFlagTestAndSetWrongResultType) { + const std::string body = R"( +%val1 = OpAtomicFlagTestAndSet %u32 %u32_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicFlagTestAndSet: " + "expected Result Type to be bool scalar type")); +} + +TEST_F(ValidateAtomics, AtomicFlagTestAndSetNotPointer) { + const std::string body = R"( +%val1 = OpAtomicFlagTestAndSet %bool %u32_1 %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicFlagTestAndSet: " + "expected Pointer to be of type OpTypePointer")); +} + +TEST_F(ValidateAtomics, AtomicFlagTestAndSetNotIntPointer) { + const std::string body = R"( +%val1 = OpAtomicFlagTestAndSet %bool %f32_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicFlagTestAndSet: " + "expected Pointer to point to a value of 32-bit int type")); +} + +TEST_F(ValidateAtomics, AtomicFlagTestAndSetNotInt32Pointer) { + const std::string body = R"( +%val1 = OpAtomicFlagTestAndSet %bool %u64_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicFlagTestAndSet: " + "expected Pointer to point to a value of 32-bit int type")); +} + +TEST_F(ValidateAtomics, AtomicFlagTestAndSetWrongScopeType) { + const std::string body = R"( +%val1 = OpAtomicFlagTestAndSet %bool %u32_var %u64_1 %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicFlagTestAndSet: " + "expected Scope to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicFlagTestAndSetWrongMemorySemanticsType) { + const std::string body = R"( +%val1 = OpAtomicFlagTestAndSet %bool %u32_var %device %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicFlagTestAndSet: " + "expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicFlagClearAcquire) { + const std::string body = R"( +OpAtomicFlagClear %u32_var %device %acquire +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Memory Semantics Acquire and AcquireRelease cannot be " + "used with AtomicFlagClear")); +} + +TEST_F(ValidateAtomics, AtomicFlagClearNotPointer) { + const std::string body = R"( +OpAtomicFlagClear %u32_1 %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicFlagClear: " + "expected Pointer to be of type OpTypePointer")); +} + +TEST_F(ValidateAtomics, AtomicFlagClearNotIntPointer) { + const std::string body = R"( +OpAtomicFlagClear %f32_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicFlagClear: " + "expected Pointer to point to a value of 32-bit int type")); +} + +TEST_F(ValidateAtomics, AtomicFlagClearNotInt32Pointer) { + const std::string body = R"( +OpAtomicFlagClear %u64_var %device %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicFlagClear: " + "expected Pointer to point to a value of 32-bit int type")); +} + +TEST_F(ValidateAtomics, AtomicFlagClearWrongScopeType) { + const std::string body = R"( +OpAtomicFlagClear %u32_var %u64_1 %relaxed +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicFlagClear: expected Scope to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicFlagClearWrongMemorySemanticsType) { + const std::string body = R"( +OpAtomicFlagClear %u32_var %device %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicFlagClear: expected Memory Semantics to be 32-bit int")); +} + +TEST_F(ValidateAtomics, AtomicIIncrementAcquireAndRelease) { + const std::string body = R"( +OpAtomicStore %u32_var %device %relaxed %u32_1 +%val1 = OpAtomicIIncrement %u32 %u32_var %device %acquire_and_release +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("AtomicIIncrement: no more than one of the following Memory " + "Semantics bits can be set at the same time: Acquire, Release, " + "AcquireRelease or SequentiallyConsistent")); +} + +TEST_F(ValidateAtomics, AtomicUniformMemorySemanticsShader) { + const std::string body = R"( +OpAtomicStore %u32_var %device %relaxed %u32_1 +%val1 = OpAtomicIIncrement %u32 %u32_var %device %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateAtomics, AtomicUniformMemorySemanticsKernel) { + const std::string body = R"( +OpAtomicStore %u32_var %device %relaxed %u32_1 +%val1 = OpAtomicIIncrement %u32 %u32_var %device %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicIIncrement: Memory Semantics UniformMemory " + "requires capability Shader")); +} + +TEST_F(ValidateAtomics, AtomicCounterMemorySemanticsNoCapability) { + const std::string body = R"( +OpAtomicStore %u32_var %device %relaxed %u32_1 +%val1 = OpAtomicIIncrement %u32 %u32_var %device %acquire_release_atomic_counter_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("AtomicIIncrement: Memory Semantics UniformMemory " + "requires capability AtomicStorage")); +} + +TEST_F(ValidateAtomics, AtomicCounterMemorySemanticsWithCapability) { + const std::string body = R"( +OpAtomicStore %u32_var %device %relaxed %u32_1 +%val1 = OpAtomicIIncrement %u32 %u32_var %device %acquire_release_atomic_counter_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body, "OpCapability AtomicStorage\n")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_barriers_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_barriers_test.cpp new file mode 100644 index 00000000000..38c168eda9c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_barriers_test.cpp @@ -0,0 +1,821 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateBarriers = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& execution_model = "GLCompute") { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability Int64 +)"; + + ss << capabilities_and_extensions; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_4 = OpConstant %u32 4 +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 + +%cross_device = OpConstant %u32 0 +%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 +%subgroup = OpConstant %u32 3 +%invocation = OpConstant %u32 4 + +%none = OpConstant %u32 0 +%acquire = OpConstant %u32 2 +%release = OpConstant %u32 4 +%acquire_release = OpConstant %u32 8 +%acquire_and_release = OpConstant %u32 6 +%sequentially_consistent = OpConstant %u32 16 +%acquire_release_uniform_workgroup = OpConstant %u32 328 +%acquire_and_release_uniform = OpConstant %u32 70 +%acquire_release_subgroup = OpConstant %u32 136 +%uniform = OpConstant %u32 64 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +std::string GenerateKernelCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + std::ostringstream ss; + ss << R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability Int64 +OpCapability NamedBarrier +)"; + + ss << capabilities_and_extensions; + ss << R"( +OpMemoryModel Physical32 OpenCL +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_4 = OpConstant %f32 4 +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_4 = OpConstant %u32 4 +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_4 = OpConstant %u64 4 + +%cross_device = OpConstant %u32 0 +%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 +%subgroup = OpConstant %u32 3 +%invocation = OpConstant %u32 4 + +%none = OpConstant %u32 0 +%acquire = OpConstant %u32 2 +%release = OpConstant %u32 4 +%acquire_release = OpConstant %u32 8 +%acquire_and_release = OpConstant %u32 6 +%sequentially_consistent = OpConstant %u32 16 +%acquire_release_uniform_workgroup = OpConstant %u32 328 +%acquire_and_release_uniform = OpConstant %u32 70 +%uniform = OpConstant %u32 64 + +%named_barrier = OpTypeNamedBarrier + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +TEST_F(ValidateBarriers, OpControlBarrierGLComputeSuccess) { + const std::string body = R"( +OpControlBarrier %device %device %none +OpControlBarrier %workgroup %workgroup %acquire +OpControlBarrier %workgroup %device %release +OpControlBarrier %cross_device %cross_device %acquire_release +OpControlBarrier %cross_device %cross_device %sequentially_consistent +OpControlBarrier %cross_device %cross_device %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBarriers, OpControlBarrierKernelSuccess) { + const std::string body = R"( +OpControlBarrier %device %device %none +OpControlBarrier %workgroup %workgroup %acquire +OpControlBarrier %workgroup %device %release +OpControlBarrier %cross_device %cross_device %acquire_release +OpControlBarrier %cross_device %cross_device %sequentially_consistent +OpControlBarrier %cross_device %cross_device %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); +} + +TEST_F(ValidateBarriers, OpControlBarrierTesselationControlSuccess) { + const std::string body = R"( +OpControlBarrier %device %device %none +OpControlBarrier %workgroup %workgroup %acquire +OpControlBarrier %workgroup %device %release +OpControlBarrier %cross_device %cross_device %acquire_release +OpControlBarrier %cross_device %cross_device %sequentially_consistent +OpControlBarrier %cross_device %cross_device %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body, "OpCapability Tessellation\n", + "TessellationControl")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBarriers, OpControlBarrierVulkanSuccess) { + const std::string body = R"( +OpControlBarrier %workgroup %device %none +OpControlBarrier %workgroup %workgroup %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateBarriers, OpControlBarrierExecutionModelFragmentSpirv12) { + const std::string body = R"( +OpControlBarrier %device %device %none +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment"), + SPV_ENV_UNIVERSAL_1_2); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpControlBarrier requires one of the following Execution " + "Models: TessellationControl, GLCompute or Kernel")); +} + +TEST_F(ValidateBarriers, OpControlBarrierExecutionModelFragmentSpirv13) { + const std::string body = R"( +OpControlBarrier %device %device %none +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment"), + SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); +} + +TEST_F(ValidateBarriers, OpControlBarrierFloatExecutionScope) { + const std::string body = R"( +OpControlBarrier %f32_1 %device %none +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ControlBarrier: expected Execution Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpControlBarrierU64ExecutionScope) { + const std::string body = R"( +OpControlBarrier %u64_1 %device %none +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ControlBarrier: expected Execution Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpControlBarrierFloatMemoryScope) { + const std::string body = R"( +OpControlBarrier %device %f32_1 %none +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ControlBarrier: expected Memory Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpControlBarrierU64MemoryScope) { + const std::string body = R"( +OpControlBarrier %device %u64_1 %none +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ControlBarrier: expected Memory Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpControlBarrierFloatMemorySemantics) { + const std::string body = R"( +OpControlBarrier %device %device %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "ControlBarrier: expected Memory Semantics to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpControlBarrierU64MemorySemantics) { + const std::string body = R"( +OpControlBarrier %device %device %u64_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "ControlBarrier: expected Memory Semantics to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpControlBarrierVulkanExecutionScopeDevice) { + const std::string body = R"( +OpControlBarrier %device %workgroup %none +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("ControlBarrier: in Vulkan environment Execution Scope " + "is limited to Workgroup and Subgroup")); +} + +TEST_F(ValidateBarriers, OpControlBarrierVulkanMemoryScopeSubgroup) { + const std::string body = R"( +OpControlBarrier %subgroup %subgroup %none +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ControlBarrier: in Vulkan 1.0 environment Memory Scope is " + "limited to Device, Workgroup and Invocation")); +} + +TEST_F(ValidateBarriers, OpControlBarrierVulkan1p1MemoryScopeSubgroup) { + const std::string body = R"( +OpControlBarrier %subgroup %subgroup %none +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateBarriers, OpControlBarrierVulkan1p1MemoryScopeCrossDevice) { + const std::string body = R"( +OpControlBarrier %subgroup %cross_device %none +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("ControlBarrier: in Vulkan environment, Memory Scope " + "cannot be CrossDevice")); +} + +TEST_F(ValidateBarriers, OpControlBarrierAcquireAndRelease) { + const std::string body = R"( +OpControlBarrier %device %device %acquire_and_release_uniform +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("ControlBarrier: Memory Semantics can have at most one " + "of the following bits set: Acquire, Release, " + "AcquireRelease or SequentiallyConsistent")); +} + +// TODO(atgoo@github.com): the corresponding check fails Vulkan CTS, +// reenable once fixed. +TEST_F(ValidateBarriers, DISABLED_OpControlBarrierVulkanSubgroupStorageClass) { + const std::string body = R"( +OpControlBarrier %workgroup %device %acquire_release_subgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "ControlBarrier: expected Memory Semantics to include a " + "Vulkan-supported storage class if Memory Semantics is not None")); +} + +TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionFragment1p1) { + const std::string body = R"( +OpControlBarrier %subgroup %subgroup %acquire_release_subgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateBarriers, OpControlBarrierWorkgroupExecutionFragment1p1) { + const std::string body = R"( +OpControlBarrier %workgroup %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpControlBarrier execution scope must be Subgroup for " + "Fragment, Vertex, Geometry and TessellationEvaluation " + "execution models")); +} + +TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionFragment1p0) { + const std::string body = R"( +OpControlBarrier %subgroup %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment"), + SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpControlBarrier requires one of the following Execution " + "Models: TessellationControl, GLCompute or Kernel")); +} + +TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionVertex1p1) { + const std::string body = R"( +OpControlBarrier %subgroup %subgroup %acquire_release_subgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateBarriers, OpControlBarrierWorkgroupExecutionVertex1p1) { + const std::string body = R"( +OpControlBarrier %workgroup %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpControlBarrier execution scope must be Subgroup for " + "Fragment, Vertex, Geometry and TessellationEvaluation " + "execution models")); +} + +TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionVertex1p0) { + const std::string body = R"( +OpControlBarrier %subgroup %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex"), + SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpControlBarrier requires one of the following Execution " + "Models: TessellationControl, GLCompute or Kernel")); +} + +TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionGeometry1p1) { + const std::string body = R"( +OpControlBarrier %subgroup %subgroup %acquire_release_subgroup +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability Geometry\n", "Geometry"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateBarriers, OpControlBarrierWorkgroupExecutionGeometry1p1) { + const std::string body = R"( +OpControlBarrier %workgroup %workgroup %acquire_release +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability Geometry\n", "Geometry"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpControlBarrier execution scope must be Subgroup for " + "Fragment, Vertex, Geometry and TessellationEvaluation " + "execution models")); +} + +TEST_F(ValidateBarriers, OpControlBarrierSubgroupExecutionGeometry1p0) { + const std::string body = R"( +OpControlBarrier %subgroup %workgroup %acquire_release +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability Geometry\n", "Geometry"), + SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpControlBarrier requires one of the following Execution " + "Models: TessellationControl, GLCompute or Kernel")); +} + +TEST_F(ValidateBarriers, + OpControlBarrierSubgroupExecutionTessellationEvaluation1p1) { + const std::string body = R"( +OpControlBarrier %subgroup %subgroup %acquire_release_subgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body, "OpCapability Tessellation\n", + "TessellationEvaluation"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateBarriers, + OpControlBarrierWorkgroupExecutionTessellationEvaluation1p1) { + const std::string body = R"( +OpControlBarrier %workgroup %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body, "OpCapability Tessellation\n", + "TessellationEvaluation"), + SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpControlBarrier execution scope must be Subgroup for " + "Fragment, Vertex, Geometry and TessellationEvaluation " + "execution models")); +} + +TEST_F(ValidateBarriers, + OpControlBarrierSubgroupExecutionTessellationEvaluation1p0) { + const std::string body = R"( +OpControlBarrier %subgroup %workgroup %acquire_release +)"; + + CompileSuccessfully(GenerateShaderCode(body, "OpCapability Tessellation\n", + "TessellationEvaluation"), + SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpControlBarrier requires one of the following Execution " + "Models: TessellationControl, GLCompute or Kernel")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierSuccess) { + const std::string body = R"( +OpMemoryBarrier %cross_device %acquire_release_uniform_workgroup +OpMemoryBarrier %device %uniform +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierKernelSuccess) { + const std::string body = R"( +OpMemoryBarrier %cross_device %acquire_release_uniform_workgroup +OpMemoryBarrier %device %uniform +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierVulkanSuccess) { + const std::string body = R"( +OpMemoryBarrier %workgroup %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierFloatMemoryScope) { + const std::string body = R"( +OpMemoryBarrier %f32_1 %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierU64MemoryScope) { + const std::string body = R"( +OpMemoryBarrier %u64_1 %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierFloatMemorySemantics) { + const std::string body = R"( +OpMemoryBarrier %device %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Semantics to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierU64MemorySemantics) { + const std::string body = R"( +OpMemoryBarrier %device %u64_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Semantics to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierVulkanMemoryScopeSubgroup) { + const std::string body = R"( +OpMemoryBarrier %subgroup %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: in Vulkan 1.0 environment Memory Scope is " + "limited to Device, Workgroup and Invocation")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierVulkan1p1MemoryScopeSubgroup) { + const std::string body = R"( +OpMemoryBarrier %subgroup %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_1)); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierAcquireAndRelease) { + const std::string body = R"( +OpMemoryBarrier %device %acquire_and_release_uniform +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryBarrier: Memory Semantics can have at most one " + "of the following bits set: Acquire, Release, " + "AcquireRelease or SequentiallyConsistent")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierVulkanMemorySemanticsNone) { + const std::string body = R"( +OpMemoryBarrier %device %none +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: Vulkan specification requires Memory Semantics " + "to have one of the following bits set: Acquire, Release, " + "AcquireRelease or SequentiallyConsistent")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierVulkanMemorySemanticsAcquire) { + const std::string body = R"( +OpMemoryBarrier %device %acquire +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Semantics to include a " + "Vulkan-supported storage class")); +} + +TEST_F(ValidateBarriers, OpMemoryBarrierVulkanSubgroupStorageClass) { + const std::string body = R"( +OpMemoryBarrier %device %acquire_release_subgroup +)"; + + CompileSuccessfully(GenerateShaderCode(body), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Semantics to include a " + "Vulkan-supported storage class")); +} + +TEST_F(ValidateBarriers, OpNamedBarrierInitializeSuccess) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %u32_4 +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); +} + +TEST_F(ValidateBarriers, OpNamedBarrierInitializeWrongResultType) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %u32 %u32_4 +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("NamedBarrierInitialize: expected Result Type to be " + "OpTypeNamedBarrier")); +} + +TEST_F(ValidateBarriers, OpNamedBarrierInitializeFloatSubgroupCount) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %f32_4 +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("NamedBarrierInitialize: expected Subgroup Count to be " + "a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpNamedBarrierInitializeU64SubgroupCount) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %u64_4 +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("NamedBarrierInitialize: expected Subgroup Count to be " + "a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryNamedBarrierSuccess) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %u32_4 +OpMemoryNamedBarrier %barrier %workgroup %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); +} + +TEST_F(ValidateBarriers, OpMemoryNamedBarrierNotNamedBarrier) { + const std::string body = R"( +OpMemoryNamedBarrier %u32_1 %workgroup %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryNamedBarrier: expected Named Barrier to be of " + "type OpTypeNamedBarrier")); +} + +TEST_F(ValidateBarriers, OpMemoryNamedBarrierFloatMemoryScope) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %u32_4 +OpMemoryNamedBarrier %barrier %f32_1 %acquire_release_uniform_workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "MemoryNamedBarrier: expected Memory Scope to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryNamedBarrierFloatMemorySemantics) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %u32_4 +OpMemoryNamedBarrier %barrier %workgroup %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "MemoryNamedBarrier: expected Memory Semantics to be a 32-bit int")); +} + +TEST_F(ValidateBarriers, OpMemoryNamedBarrierAcquireAndRelease) { + const std::string body = R"( +%barrier = OpNamedBarrierInitialize %named_barrier %u32_4 +OpMemoryNamedBarrier %barrier %workgroup %acquire_and_release_uniform +)"; + + CompileSuccessfully(GenerateKernelCode(body), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("MemoryNamedBarrier: Memory Semantics can have at most " + "one of the following bits set: Acquire, Release, " + "AcquireRelease or SequentiallyConsistent")); +} + +TEST_F(ValidateBarriers, TypeAsMemoryScope) { + const std::string body = R"( +OpMemoryBarrier %u32 %u32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("MemoryBarrier: expected Memory Scope to be a 32-bit int")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_bitwise_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_bitwise_test.cpp new file mode 100644 index 00000000000..18ccd4f8e1a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_bitwise_test.cpp @@ -0,0 +1,548 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateBitwise = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + const std::string capabilities = + R"( +OpCapability Shader +OpCapability Int64 +OpCapability Float64)"; + + const std::string after_extension_before_body = + R"( +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%boolvec2 = OpTypeVector %bool 2 +%s32vec2 = OpTypeVector %s32 2 +%u32vec2 = OpTypeVector %u32 2 +%u64vec2 = OpTypeVector %u64 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%s32vec3 = OpTypeVector %s32 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%u64vec4 = OpTypeVector %u64 4 +%s32vec4 = OpTypeVector %s32 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 +%s32_4 = OpConstant %s32 4 +%s32_m1 = OpConstant %s32 -1 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64_4 = OpConstant %f64 4 + +%s64_0 = OpConstant %s64 0 +%s64_1 = OpConstant %s64 1 +%s64_2 = OpConstant %s64 2 +%s64_3 = OpConstant %s64 3 +%s64_4 = OpConstant %s64 4 +%s64_m1 = OpConstant %s64 -1 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_4 = OpConstant %u64 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 +%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string after_body = + R"( +OpReturn +OpFunctionEnd)"; + + return capabilities + capabilities_and_extensions + + after_extension_before_body + body + after_body; +} + +TEST_F(ValidateBitwise, ShiftAllSuccess) { + const std::string body = R"( +%val1 = OpShiftRightLogical %u64 %u64_1 %s32_2 +%val2 = OpShiftRightArithmetic %s32vec2 %s32vec2_12 %s32vec2_12 +%val3 = OpShiftLeftLogical %u32vec2 %s32vec2_12 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBitwise, OpShiftRightLogicalWrongResultType) { + const std::string body = R"( +%val1 = OpShiftRightLogical %bool %u64_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as Result Type: " + "ShiftRightLogical")); +} + +TEST_F(ValidateBitwise, OpShiftRightLogicalBaseNotInt) { + const std::string body = R"( +%val1 = OpShiftRightLogical %u32 %f32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Base to be int scalar or vector: ShiftRightLogical")); +} + +TEST_F(ValidateBitwise, OpShiftRightLogicalBaseWrongDimension) { + const std::string body = R"( +%val1 = OpShiftRightLogical %u32 %u32vec2_12 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Base to have the same dimension as Result Type: " + "ShiftRightLogical")); +} + +TEST_F(ValidateBitwise, OpShiftRightLogicalBaseWrongBitWidth) { + const std::string body = R"( +%val1 = OpShiftRightLogical %u64 %u32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Base to have the same bit width as Result Type: " + "ShiftRightLogical")); +} + +TEST_F(ValidateBitwise, OpShiftRightLogicalShiftNotInt) { + const std::string body = R"( +%val1 = OpShiftRightLogical %u32 %u32_1 %f32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Shift to be int scalar or vector: ShiftRightLogical")); +} + +TEST_F(ValidateBitwise, OpShiftRightLogicalShiftWrongDimension) { + const std::string body = R"( +%val1 = OpShiftRightLogical %u32 %u32_1 %s32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Shift to have the same dimension as Result Type: " + "ShiftRightLogical")); +} + +TEST_F(ValidateBitwise, LogicAllSuccess) { + const std::string body = R"( +%val1 = OpBitwiseOr %u64 %u64_1 %s64_0 +%val2 = OpBitwiseAnd %s64 %s64_1 %u64_0 +%val3 = OpBitwiseXor %s32vec2 %s32vec2_12 %u32vec2_01 +%val4 = OpNot %s32vec2 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBitwise, OpBitwiseAndWrongResultType) { + const std::string body = R"( +%val1 = OpBitwiseAnd %bool %u64_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected int scalar or vector type as Result Type: BitwiseAnd")); +} + +TEST_F(ValidateBitwise, OpBitwiseAndLeftNotInt) { + const std::string body = R"( +%val1 = OpBitwiseAnd %u32 %f32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector as operand: BitwiseAnd " + "operand index 2")); +} + +TEST_F(ValidateBitwise, OpBitwiseAndRightNotInt) { + const std::string body = R"( +%val1 = OpBitwiseAnd %u32 %u32_1 %f32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector as operand: BitwiseAnd " + "operand index 3")); +} + +TEST_F(ValidateBitwise, OpBitwiseAndLeftWrongDimension) { + const std::string body = R"( +%val1 = OpBitwiseAnd %u32 %u32vec2_12 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to have the same dimension as Result Type: " + "BitwiseAnd operand index 2")); +} + +TEST_F(ValidateBitwise, OpBitwiseAndRightWrongDimension) { + const std::string body = R"( +%val1 = OpBitwiseAnd %u32 %s32_2 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to have the same dimension as Result Type: " + "BitwiseAnd operand index 3")); +} + +TEST_F(ValidateBitwise, OpBitwiseAndLeftWrongBitWidth) { + const std::string body = R"( +%val1 = OpBitwiseAnd %u64 %u32_1 %s64_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to have the same bit width as Result Type: " + "BitwiseAnd operand index 2")); +} + +TEST_F(ValidateBitwise, OpBitwiseAndRightWrongBitWidth) { + const std::string body = R"( +%val1 = OpBitwiseAnd %u64 %u64_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to have the same bit width as Result Type: " + "BitwiseAnd operand index 3")); +} + +TEST_F(ValidateBitwise, OpBitFieldInsertSuccess) { + const std::string body = R"( +%val1 = OpBitFieldInsert %u64 %u64_1 %u64_2 %s32_1 %s32_2 +%val2 = OpBitFieldInsert %s32vec2 %s32vec2_12 %s32vec2_12 %s32_1 %u32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBitwise, OpBitFieldInsertWrongResultType) { + const std::string body = R"( +%val1 = OpBitFieldInsert %bool %u64_1 %u64_2 %s32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected int scalar or vector type as Result Type: BitFieldInsert")); +} + +TEST_F(ValidateBitwise, OpBitFieldInsertWrongBaseType) { + const std::string body = R"( +%val1 = OpBitFieldInsert %u64 %s64_1 %u64_2 %s32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Base Type to be equal to Result Type: BitFieldInsert")); +} + +TEST_F(ValidateBitwise, OpBitFieldInsertWrongInsertType) { + const std::string body = R"( +%val1 = OpBitFieldInsert %u64 %u64_1 %s64_2 %s32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Insert Type to be equal to Result Type: BitFieldInsert")); +} + +TEST_F(ValidateBitwise, OpBitFieldInsertOffsetNotInt) { + const std::string body = R"( +%val1 = OpBitFieldInsert %u64 %u64_1 %u64_2 %f32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Offset Type to be int scalar: BitFieldInsert")); +} + +TEST_F(ValidateBitwise, OpBitFieldInsertCountNotInt) { + const std::string body = R"( +%val1 = OpBitFieldInsert %u64 %u64_1 %u64_2 %u32_1 %f32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Count Type to be int scalar: BitFieldInsert")); +} + +TEST_F(ValidateBitwise, OpBitFieldSExtractSuccess) { + const std::string body = R"( +%val1 = OpBitFieldSExtract %u64 %u64_1 %s32_1 %s32_2 +%val2 = OpBitFieldSExtract %s32vec2 %s32vec2_12 %s32_1 %u32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBitwise, OpBitFieldSExtractWrongResultType) { + const std::string body = R"( +%val1 = OpBitFieldSExtract %bool %u64_1 %s32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as Result Type: " + "BitFieldSExtract")); +} + +TEST_F(ValidateBitwise, OpBitFieldSExtractWrongBaseType) { + const std::string body = R"( +%val1 = OpBitFieldSExtract %u64 %s64_1 %s32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Base Type to be equal to Result Type: BitFieldSExtract")); +} + +TEST_F(ValidateBitwise, OpBitFieldSExtractOffsetNotInt) { + const std::string body = R"( +%val1 = OpBitFieldSExtract %u64 %u64_1 %f32_1 %s32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Offset Type to be int scalar: BitFieldSExtract")); +} + +TEST_F(ValidateBitwise, OpBitFieldSExtractCountNotInt) { + const std::string body = R"( +%val1 = OpBitFieldSExtract %u64 %u64_1 %u32_1 %f32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Count Type to be int scalar: BitFieldSExtract")); +} + +TEST_F(ValidateBitwise, OpBitReverseSuccess) { + const std::string body = R"( +%val1 = OpBitReverse %u64 %u64_1 +%val2 = OpBitReverse %s32vec2 %s32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBitwise, OpBitReverseWrongResultType) { + const std::string body = R"( +%val1 = OpBitReverse %bool %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected int scalar or vector type as Result Type: BitReverse")); +} + +TEST_F(ValidateBitwise, OpBitReverseWrongBaseType) { + const std::string body = R"( +%val1 = OpBitReverse %u64 %s64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Base Type to be equal to Result Type: BitReverse")); +} + +TEST_F(ValidateBitwise, OpBitCountSuccess) { + const std::string body = R"( +%val1 = OpBitCount %s32 %u64_1 +%val2 = OpBitCount %u32vec2 %s32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateBitwise, OpBitCountWrongResultType) { + const std::string body = R"( +%val1 = OpBitCount %bool %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as Result Type: BitCount")); +} + +TEST_F(ValidateBitwise, OpBitCountBaseNotInt) { + const std::string body = R"( +%val1 = OpBitCount %u32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Base Type to be int scalar or vector: BitCount")); +} + +TEST_F(ValidateBitwise, OpBitCountBaseWrongDimension) { + const std::string body = R"( +%val1 = OpBitCount %u32 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Base dimension to be equal to Result Type dimension: " + "BitCount")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_builtins_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_builtins_test.cpp new file mode 100644 index 00000000000..0c8909cec18 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_builtins_test.cpp @@ -0,0 +1,2118 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Tests validation rules of GLSL.450.std and OpenCL.std extended instructions. +// Doesn't test OpenCL.std vector size 2, 3, 4, 8 or 16 rules (not supported +// by standard SPIR-V). + +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +struct TestResult { + TestResult(spv_result_t in_validation_result = SPV_SUCCESS, + const char* in_error_str = nullptr, + const char* in_error_str2 = nullptr) + : validation_result(in_validation_result), + error_str(in_error_str), + error_str2(in_error_str2) {} + spv_result_t validation_result; + const char* error_str; + const char* error_str2; +}; + +using ::testing::Combine; +using ::testing::HasSubstr; +using ::testing::Not; +using ::testing::Values; +using ::testing::ValuesIn; + +using ValidateBuiltIns = spvtest::ValidateBase; +using ValidateVulkanCombineBuiltInExecutionModelDataTypeResult = + spvtest::ValidateBase>; +using ValidateVulkanCombineBuiltInArrayedVariable = spvtest::ValidateBase< + std::tuple>; + +struct EntryPoint { + std::string name; + std::string execution_model; + std::string execution_modes; + std::string body; + std::string interfaces; +}; + +class CodeGenerator { + public: + std::string Build() const; + + std::vector entry_points_; + std::string capabilities_; + std::string extensions_; + std::string memory_model_; + std::string before_types_; + std::string types_; + std::string after_types_; + std::string add_at_the_end_; +}; + +std::string CodeGenerator::Build() const { + std::ostringstream ss; + + ss << capabilities_; + ss << extensions_; + ss << memory_model_; + + for (const EntryPoint& entry_point : entry_points_) { + ss << "OpEntryPoint " << entry_point.execution_model << " %" + << entry_point.name << " \"" << entry_point.name << "\" " + << entry_point.interfaces << "\n"; + } + + for (const EntryPoint& entry_point : entry_points_) { + ss << entry_point.execution_modes << "\n"; + } + + ss << before_types_; + ss << types_; + ss << after_types_; + + for (const EntryPoint& entry_point : entry_points_) { + ss << "\n"; + ss << "%" << entry_point.name << " = OpFunction %void None %func\n"; + ss << "%" << entry_point.name << "_entry = OpLabel\n"; + ss << entry_point.body; + ss << "\nOpReturn\nOpFunctionEnd\n"; + } + + ss << add_at_the_end_; + + return ss.str(); +} + +std::string GetDefaultShaderCapabilities() { + return R"( +OpCapability Shader +OpCapability Geometry +OpCapability Tessellation +OpCapability Float64 +OpCapability Int64 +OpCapability MultiViewport +OpCapability SampleRateShading +)"; +} + +std::string GetDefaultShaderTypes() { + return R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%f32vec2 = OpTypeVector %f32 2 +%f32vec3 = OpTypeVector %f32 3 +%f32vec4 = OpTypeVector %f32 4 +%f64vec2 = OpTypeVector %f64 2 +%f64vec3 = OpTypeVector %f64 3 +%f64vec4 = OpTypeVector %f64 4 +%u32vec2 = OpTypeVector %u32 2 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%u32vec4 = OpTypeVector %u32 4 +%u64vec2 = OpTypeVector %u64 2 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_h = OpConstant %f32 0.5 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u64vec2_01 = OpConstantComposite %u64vec2 %u64_0 %u64_1 + +%u32arr2 = OpTypeArray %u32 %u32_2 +%u32arr3 = OpTypeArray %u32 %u32_3 +%u32arr4 = OpTypeArray %u32 %u32_4 +%u64arr2 = OpTypeArray %u64 %u32_2 +%u64arr3 = OpTypeArray %u64 %u32_3 +%u64arr4 = OpTypeArray %u64 %u32_4 +%f32arr2 = OpTypeArray %f32 %u32_2 +%f32arr3 = OpTypeArray %f32 %u32_3 +%f32arr4 = OpTypeArray %f32 %u32_4 +%f64arr2 = OpTypeArray %f64 %u32_2 +%f64arr3 = OpTypeArray %f64 %u32_3 +%f64arr4 = OpTypeArray %f64 %u32_4 + +%f32vec3arr3 = OpTypeArray %f32vec3 %u32_3 +%f32vec4arr3 = OpTypeArray %f32vec4 %u32_3 +%f64vec4arr3 = OpTypeArray %f64vec4 %u32_3 +)"; +} + +CodeGenerator GetDefaultShaderCodeGenerator() { + CodeGenerator generator; + generator.capabilities_ = GetDefaultShaderCapabilities(); + generator.memory_model_ = "OpMemoryModel Logical GLSL450\n"; + generator.types_ = GetDefaultShaderTypes(); + return generator; +} + +TEST_P(ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, InMain) { + const char* const built_in = std::get<0>(GetParam()); + const char* const execution_model = std::get<1>(GetParam()); + const char* const storage_class = std::get<2>(GetParam()); + const char* const data_type = std::get<3>(GetParam()); + const TestResult& test_result = std::get<4>(GetParam()); + + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = "OpMemberDecorate %built_in_type 0 BuiltIn "; + generator.before_types_ += built_in; + generator.before_types_ += "\n"; + + std::ostringstream after_types; + after_types << "%built_in_type = OpTypeStruct " << data_type << "\n"; + after_types << "%built_in_ptr = OpTypePointer " << storage_class + << " %built_in_type\n"; + after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class + << "\n"; + after_types << "%data_ptr = OpTypePointer " << storage_class << " " + << data_type << "\n"; + generator.after_types_ = after_types.str(); + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = execution_model; + if (strncmp(storage_class, "Input", 5) == 0 || + strncmp(storage_class, "Output", 6) == 0) { + entry_point.interfaces = "%built_in_var"; + } + + std::ostringstream execution_modes; + if (0 == std::strcmp(execution_model, "Fragment")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " OriginUpperLeft\n"; + } + if (0 == std::strcmp(built_in, "FragDepth")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " DepthReplacing\n"; + } + entry_point.execution_modes = execution_modes.str(); + + entry_point.body = R"( +%ptr = OpAccessChain %data_ptr %built_in_var %u32_0 +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(test_result.validation_result, + ValidateInstructions(SPV_ENV_VULKAN_1_0)); + if (test_result.error_str) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str)); + } + if (test_result.error_str2) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2)); + } +} + +TEST_P(ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, InFunction) { + const char* const built_in = std::get<0>(GetParam()); + const char* const execution_model = std::get<1>(GetParam()); + const char* const storage_class = std::get<2>(GetParam()); + const char* const data_type = std::get<3>(GetParam()); + const TestResult& test_result = std::get<4>(GetParam()); + + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = "OpMemberDecorate %built_in_type 0 BuiltIn "; + generator.before_types_ += built_in; + generator.before_types_ += "\n"; + + std::ostringstream after_types; + after_types << "%built_in_type = OpTypeStruct " << data_type << "\n"; + after_types << "%built_in_ptr = OpTypePointer " << storage_class + << " %built_in_type\n"; + after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class + << "\n"; + after_types << "%data_ptr = OpTypePointer " << storage_class << " " + << data_type << "\n"; + generator.after_types_ = after_types.str(); + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = execution_model; + if (strncmp(storage_class, "Input", 5) == 0 || + strncmp(storage_class, "Output", 6) == 0) { + entry_point.interfaces = "%built_in_var"; + } + + std::ostringstream execution_modes; + if (0 == std::strcmp(execution_model, "Fragment")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " OriginUpperLeft\n"; + } + if (0 == std::strcmp(built_in, "FragDepth")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " DepthReplacing\n"; + } + entry_point.execution_modes = execution_modes.str(); + + entry_point.body = R"( +%val2 = OpFunctionCall %void %foo +)"; + + generator.add_at_the_end_ = R"( +%foo = OpFunction %void None %func +%foo_entry = OpLabel +%ptr = OpAccessChain %data_ptr %built_in_var %u32_0 +OpReturn +OpFunctionEnd +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(test_result.validation_result, + ValidateInstructions(SPV_ENV_VULKAN_1_0)); + if (test_result.error_str) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str)); + } + if (test_result.error_str2) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2)); + } +} + +TEST_P(ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Variable) { + const char* const built_in = std::get<0>(GetParam()); + const char* const execution_model = std::get<1>(GetParam()); + const char* const storage_class = std::get<2>(GetParam()); + const char* const data_type = std::get<3>(GetParam()); + const TestResult& test_result = std::get<4>(GetParam()); + + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = "OpDecorate %built_in_var BuiltIn "; + generator.before_types_ += built_in; + generator.before_types_ += "\n"; + + std::ostringstream after_types; + after_types << "%built_in_ptr = OpTypePointer " << storage_class << " " + << data_type << "\n"; + after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class + << "\n"; + generator.after_types_ = after_types.str(); + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = execution_model; + if (strncmp(storage_class, "Input", 5) == 0 || + strncmp(storage_class, "Output", 6) == 0) { + entry_point.interfaces = "%built_in_var"; + } + // Any kind of reference would do. + entry_point.body = R"( +%val = OpBitcast %u64 %built_in_var +)"; + + std::ostringstream execution_modes; + if (0 == std::strcmp(execution_model, "Fragment")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " OriginUpperLeft\n"; + } + if (0 == std::strcmp(built_in, "FragDepth")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " DepthReplacing\n"; + } + entry_point.execution_modes = execution_modes.str(); + + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(test_result.validation_result, + ValidateInstructions(SPV_ENV_VULKAN_1_0)); + if (test_result.error_str) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str)); + } + if (test_result.error_str2) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2)); + } +} + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), + Values("Vertex", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Output"), Values("%f32arr2", "%f32arr4"), + Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), + Values("Fragment", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%f32arr2", "%f32arr4"), + Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceFragmentOutput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), + Values("Output"), Values("%f32arr4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance " + "to be used for variables with Output storage class if " + "execution model is Fragment.", + "which is called with execution model Fragment."))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceVertexInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), Values("Vertex"), + Values("Input"), Values("%f32arr4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance " + "to be used for variables with Input storage class if " + "execution model is Vertex.", + "which is called with execution model Vertex."))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), Values("GLCompute"), + Values("Input", "Output"), Values("%f32arr4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with Fragment, Vertex, TessellationControl, " + "TessellationEvaluation or Geometry execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceNotArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), + Values("Input"), Values("%f32vec2", "%f32vec4", "%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float array", + "is not an array"))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceNotFloatArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), + Values("Input"), Values("%u32arr2", "%u64arr4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float array", + "components are not float scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceNotF32Array, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), + Values("Input"), Values("%f64arr2", "%f64arr4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float array", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + FragCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + FragCoordNotFragment, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("FragCoord"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%f32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + FragCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Output"), + Values("%f32vec4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + FragCoordNotFloatVector, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f32arr4", "%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "is not a float vector"))), ); + +INSTANTIATE_TEST_CASE_P( + FragCoordNotFloatVec4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + FragCoordNotF32Vec4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f64vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + FragDepthSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), + Values("%f32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + FragDepthNotFragment, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("FragDepth"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Output"), Values("%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + FragDepthNotOutput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Input"), + Values("%f32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Output storage class", + "uses storage class Input"))), ); + +INSTANTIATE_TEST_CASE_P( + FragDepthNotFloatScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), + Values("%f32vec4", "%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "is not a float scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + FragDepthNotF32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), + Values("%f64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + FrontFacingAndHelperInvocationSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"), + Values("Input"), Values("%bool"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + FrontFacingAndHelperInvocationNotFragment, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("FrontFacing", "HelperInvocation"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%bool"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + FrontFacingAndHelperInvocationNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"), + Values("Output"), Values("%bool"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + FrontFacingAndHelperInvocationNotBool, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"), + Values("Input"), Values("%f32", "%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a bool scalar", + "is not a bool scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + ComputeShaderInputInt32Vec3Success, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("GLCompute"), Values("Input"), Values("%u32vec3"), + Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + ComputeShaderInputInt32Vec3NotGLCompute, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("Vertex", "Fragment", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32vec3"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with GLCompute execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + ComputeShaderInputInt32Vec3NotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("GLCompute"), Values("Output"), Values("%u32vec3"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + ComputeShaderInputInt32Vec3NotIntVector, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("GLCompute"), Values("Input"), + Values("%u32arr3", "%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit int vector", + "is not an int vector"))), ); + +INSTANTIATE_TEST_CASE_P( + ComputeShaderInputInt32Vec3NotIntVec3, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("GLCompute"), Values("Input"), Values("%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit int vector", + "has 4 components"))), ); + +INSTANTIATE_TEST_CASE_P( + ComputeShaderInputInt32Vec3NotInt32Vec, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("GLCompute"), Values("Input"), Values("%u64vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit int vector", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + InvocationIdSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), + Values("Input"), Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + InvocationIdInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InvocationId"), + Values("Vertex", "Fragment", "GLCompute", "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with TessellationControl or " + "Geometry execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + InvocationIdNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), + Values("Output"), Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + InvocationIdNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), + Values("Input"), Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + InvocationIdNotInt32, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), + Values("Input"), Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + InstanceIndexSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), + Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + InstanceIndexInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("InstanceIndex"), + Values("Geometry", "Fragment", "GLCompute", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Vertex execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + InstanceIndexNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Output"), + Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + InstanceIndexNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + InstanceIndexNotInt32, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), + Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Layer", "ViewportIndex"), Values("Fragment"), + Values("Input"), Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Layer", "ViewportIndex"), Values("Geometry"), + Values("Output"), Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Layer", "ViewportIndex"), + Values("TessellationControl", "GLCompute"), Values("Input"), + Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with Vertex, TessellationEvaluation, " + "Geometry, or Fragment execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexExecutionModelEnabledByCapability, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Layer", "ViewportIndex"), + Values("Vertex", "TessellationEvaluation"), Values("Output"), + Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "requires the ShaderViewportIndexLayerEXT capability"))), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexFragmentNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("Layer", "ViewportIndex"), Values("Fragment"), Values("Output"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "Output storage class if execution model is Fragment", + "which is called with execution model Fragment"))), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexGeometryNotOutput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("Layer", "ViewportIndex"), + Values("Vertex", "TessellationEvaluation", "Geometry"), Values("Input"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "Input storage class if execution model is Vertex, " + "TessellationEvaluation, or Geometry", + "which is called with execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Layer", "ViewportIndex"), Values("Fragment"), + Values("Input"), Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + LayerAndViewportIndexNotInt32, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Layer", "ViewportIndex"), Values("Fragment"), + Values("Input"), Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + PatchVerticesSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PatchVertices"), + Values("TessellationEvaluation", "TessellationControl"), + Values("Input"), Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PatchVerticesInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PatchVertices"), + Values("Vertex", "Fragment", "GLCompute", "Geometry"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with TessellationControl or " + "TessellationEvaluation execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + PatchVerticesNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PatchVertices"), + Values("TessellationEvaluation", "TessellationControl"), + Values("Output"), Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + PatchVerticesNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PatchVertices"), + Values("TessellationEvaluation", "TessellationControl"), + Values("Input"), Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + PatchVerticesNotInt32, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PatchVertices"), + Values("TessellationEvaluation", "TessellationControl"), + Values("Input"), Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + PointCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec2"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PointCoordNotFragment, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("PointCoord"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%f32vec2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + PointCoordNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointCoord"), Values("Fragment"), Values("Output"), + Values("%f32vec2"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + PointCoordNotFloatVector, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), + Values("%f32arr2", "%u32vec2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float vector", + "is not a float vector"))), ); + +INSTANTIATE_TEST_CASE_P( + PointCoordNotFloatVec3, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float vector", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + PointCoordNotF32Vec4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), + Values("%f64vec2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float vector", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize"), + Values("Vertex", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Output"), Values("%f32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize"), + Values("Geometry", "TessellationControl", "TessellationEvaluation"), + Values("Input"), Values("%f32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeVertexInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize"), Values("Vertex"), Values("Input"), + Values("%f32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow BuiltIn PointSize " + "to be used for variables with Input storage class if " + "execution model is Vertex.", + "which is called with execution model Vertex."))), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize"), Values("GLCompute", "Fragment"), + Values("Input", "Output"), Values("%f32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with Vertex, TessellationControl, " + "TessellationEvaluation or Geometry execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeNotFloatScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize"), Values("Vertex"), Values("Output"), + Values("%f32vec4", "%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "is not a float scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeNotF32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize"), Values("Vertex"), Values("Output"), + Values("%f64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + PositionOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), + Values("Vertex", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Output"), Values("%f32vec4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PositionInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), + Values("Geometry", "TessellationControl", "TessellationEvaluation"), + Values("Input"), Values("%f32vec4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PositionVertexInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), Values("Vertex"), Values("Input"), + Values("%f32vec4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow BuiltIn Position " + "to be used for variables with Input storage class if " + "execution model is Vertex.", + "which is called with execution model Vertex."))), ); + +INSTANTIATE_TEST_CASE_P( + PositionInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), Values("GLCompute", "Fragment"), + Values("Input", "Output"), Values("%f32vec4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with Vertex, TessellationControl, " + "TessellationEvaluation or Geometry execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + PositionNotFloatVector, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), Values("Geometry"), Values("Input"), + Values("%f32arr4", "%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "is not a float vector"))), ); + +INSTANTIATE_TEST_CASE_P( + PositionNotFloatVec4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), Values("Geometry"), Values("Input"), + Values("%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + PositionNotF32Vec4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("Position"), Values("Geometry"), Values("Input"), + Values("%f64vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PrimitiveId"), + Values("Fragment", "TessellationControl", "TessellationEvaluation", + "Geometry"), + Values("Input"), Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PrimitiveId"), Values("Geometry"), Values("Output"), + Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PrimitiveId"), Values("Vertex", "GLCompute"), + Values("Input"), Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with Fragment, TessellationControl, " + "TessellationEvaluation or Geometry execution models"))), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdFragmentNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("PrimitiveId"), Values("Fragment"), Values("Output"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "Output storage class if execution model is Fragment", + "which is called with execution model Fragment"))), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdGeometryNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PrimitiveId"), + Values("TessellationControl", "TessellationEvaluation"), + Values("Output"), Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Output storage class if execution model is Tessellation", + "which is called with execution model Tessellation"))), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PrimitiveId"), Values("Fragment"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + PrimitiveIdNotInt32, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PrimitiveId"), Values("Fragment"), Values("Input"), + Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleIdSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleId"), Values("Fragment"), Values("Input"), + Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + SampleIdInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("SampleId"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleIdNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("SampleId"), Values("Fragment"), Values("Output"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "Vulkan spec allows BuiltIn SampleId to be only used " + "for variables with Input storage class"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleIdNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleId"), Values("Fragment"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleIdNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleId"), Values("Fragment"), Values("Input"), + Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleMaskSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleMask"), Values("Fragment"), Values("Input", "Output"), + Values("%u32arr2", "%u32arr4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + SampleMaskInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("SampleMask"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32arr2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleMaskWrongStorageClass, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleMask"), Values("Fragment"), Values("UniformConstant"), + Values("%u32arr2"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec allows BuiltIn SampleMask to be only used for " + "variables with Input or Output storage class"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleMaskNotArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleMask"), Values("Fragment"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int array", + "is not an array"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleMaskNotIntArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleMask"), Values("Fragment"), Values("Input"), + Values("%f32arr2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int array", + "components are not int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + SampleMaskNotInt32Array, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SampleMask"), Values("Fragment"), Values("Input"), + Values("%u64arr2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int array", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + SamplePositionSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), + Values("%f32vec2"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + SamplePositionNotFragment, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("SamplePosition"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%f32vec2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + SamplePositionNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SamplePosition"), Values("Fragment"), Values("Output"), + Values("%f32vec2"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + SamplePositionNotFloatVector, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), + Values("%f32arr2", "%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float vector", + "is not a float vector"))), ); + +INSTANTIATE_TEST_CASE_P( + SamplePositionNotFloatVec2, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), + Values("%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float vector", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + SamplePositionNotF32Vec2, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), + Values("%f64vec2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float vector", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + TessCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessCoord"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32vec3"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + TessCoordNotFragment, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("TessCoord"), + Values("Vertex", "GLCompute", "Geometry", "TessellationControl", + "Fragment"), + Values("Input"), Values("%f32vec3"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be used only with TessellationEvaluation execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + TessCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessCoord"), Values("Fragment"), Values("Output"), + Values("%f32vec3"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output"))), ); + +INSTANTIATE_TEST_CASE_P( + TessCoordNotFloatVector, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessCoord"), Values("Fragment"), Values("Input"), + Values("%f32arr3", "%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit float vector", + "is not a float vector"))), ); + +INSTANTIATE_TEST_CASE_P( + TessCoordNotFloatVec3, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit float vector", + "has 2 components"))), ); + +INSTANTIATE_TEST_CASE_P( + TessCoordNotF32Vec3, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessCoord"), Values("Fragment"), Values("Input"), + Values("%f64vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit float vector", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterTeseInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32arr4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterTescOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationControl"), + Values("Output"), Values("%f32arr4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), + Values("Vertex", "GLCompute", "Geometry", "Fragment"), + Values("Input"), Values("%f32arr4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with TessellationControl or " + "TessellationEvaluation execution models."))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterOutputTese, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), + Values("Output"), Values("%f32arr4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " + "used for variables with Output storage class if execution " + "model is TessellationEvaluation."))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterInputTesc, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationControl"), + Values("Input"), Values("%f32arr4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " + "used for variables with Input storage class if execution " + "model is TessellationControl."))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterNotArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32vec4", "%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float array", + "is not an array"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterNotFloatArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), + Values("Input"), Values("%u32arr4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float array", + "components are not float scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterNotFloatArr4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32arr3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float array", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelOuterNotF32Arr4, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), + Values("Input"), Values("%f64arr4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float array", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerTeseInputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32arr2"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerTescOutputSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationControl"), + Values("Output"), Values("%f32arr2"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), + Values("Vertex", "GLCompute", "Geometry", "Fragment"), + Values("Input"), Values("%f32arr2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with TessellationControl or " + "TessellationEvaluation execution models."))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerOutputTese, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), + Values("Output"), Values("%f32arr2"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " + "used for variables with Output storage class if execution " + "model is TessellationEvaluation."))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerInputTesc, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationControl"), + Values("Input"), Values("%f32arr2"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " + "used for variables with Input storage class if execution " + "model is TessellationControl."))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerNotArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32vec2", "%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float array", + "is not an array"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerNotFloatArray, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), + Values("Input"), Values("%u32arr2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float array", + "components are not float scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerNotFloatArr2, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), + Values("Input"), Values("%f32arr3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float array", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + TessLevelInnerNotF32Arr2, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), + Values("Input"), Values("%f64arr2"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 2-component 32-bit float array", + "has components with bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + VertexIndexSuccess, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), + Values("%u32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + VertexIndexInvalidExecutionModel, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("VertexIndex"), + Values("Fragment", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Vertex execution model"))), ); + +INSTANTIATE_TEST_CASE_P( + VertexIndexNotInput, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("VertexIndex"), Values("Vertex"), Values("Output"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "Vulkan spec allows BuiltIn VertexIndex to be only " + "used for variables with Input storage class"))), ); + +INSTANTIATE_TEST_CASE_P( + VertexIndexNotIntScalar, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + VertexIndexNotInt32, + ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), + Values("%u64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "has bit width 64"))), ); + +TEST_P(ValidateVulkanCombineBuiltInArrayedVariable, Variable) { + const char* const built_in = std::get<0>(GetParam()); + const char* const execution_model = std::get<1>(GetParam()); + const char* const storage_class = std::get<2>(GetParam()); + const char* const data_type = std::get<3>(GetParam()); + const TestResult& test_result = std::get<4>(GetParam()); + + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = "OpDecorate %built_in_var BuiltIn "; + generator.before_types_ += built_in; + generator.before_types_ += "\n"; + + std::ostringstream after_types; + after_types << "%built_in_array = OpTypeArray " << data_type << " %u32_3\n"; + after_types << "%built_in_ptr = OpTypePointer " << storage_class + << " %built_in_array\n"; + after_types << "%built_in_var = OpVariable %built_in_ptr " << storage_class + << "\n"; + generator.after_types_ = after_types.str(); + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = execution_model; + entry_point.interfaces = "%built_in_var"; + // Any kind of reference would do. + entry_point.body = R"( +%val = OpBitcast %u64 %built_in_var +)"; + + std::ostringstream execution_modes; + if (0 == std::strcmp(execution_model, "Fragment")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " OriginUpperLeft\n"; + } + if (0 == std::strcmp(built_in, "FragDepth")) { + execution_modes << "OpExecutionMode %" << entry_point.name + << " DepthReplacing\n"; + } + entry_point.execution_modes = execution_modes.str(); + + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(test_result.validation_result, + ValidateInstructions(SPV_ENV_VULKAN_1_0)); + if (test_result.error_str) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str)); + } + if (test_result.error_str2) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str2)); + } +} + +INSTANTIATE_TEST_CASE_P(PointSizeArrayedF32TessControl, + ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("PointSize"), + Values("TessellationControl"), Values("Input"), + Values("%f32"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeArrayedF64TessControl, ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("PointSize"), Values("TessellationControl"), Values("Input"), + Values("%f64"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "has bit width 64"))), ); + +INSTANTIATE_TEST_CASE_P( + PointSizeArrayedF32Vertex, ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("PointSize"), Values("Vertex"), Values("Output"), + Values("%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "is not a float scalar"))), ); + +INSTANTIATE_TEST_CASE_P(PositionArrayedF32Vec4TessControl, + ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("Position"), + Values("TessellationControl"), Values("Input"), + Values("%f32vec4"), Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + PositionArrayedF32Vec3TessControl, + ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("Position"), Values("TessellationControl"), Values("Input"), + Values("%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "has 3 components"))), ); + +INSTANTIATE_TEST_CASE_P( + PositionArrayedF32Vec4Vertex, ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("Position"), Values("Vertex"), Values("Output"), + Values("%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "is not a float vector"))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceOutputSuccess, + ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("ClipDistance", "CullDistance"), + Values("Geometry", "TessellationControl", "TessellationEvaluation"), + Values("Output"), Values("%f32arr2", "%f32arr4"), + Values(TestResult())), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceVertexInput, ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), + Values("Input"), Values("%f32arr4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float array", + "components are not float scalar"))), ); + +INSTANTIATE_TEST_CASE_P( + ClipAndCullDistanceNotArray, ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("ClipDistance", "CullDistance"), + Values("Geometry", "TessellationControl", "TessellationEvaluation"), + Values("Input"), Values("%f32vec2", "%f32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float array", + "components are not float scalar"))), ); + +TEST_F(ValidateBuiltIns, WorkgroupSizeSuccess) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +%copy = OpCopyObject %u32vec3 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizeFragment) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Fragment"; + entry_point.execution_modes = "OpExecutionMode %main OriginUpperLeft"; + entry_point.body = R"( +%copy = OpCopyObject %u32vec3 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec allows BuiltIn WorkgroupSize to be used " + "only with GLCompute execution model")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("is referencing ID <2> (OpConstantComposite) which is " + "decorated with BuiltIn WorkgroupSize in function <1> " + "called with execution model Fragment")); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizeNotConstant) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %copy BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +%copy = OpCopyObject %u32vec3 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec requires BuiltIn WorkgroupSize to be a " + "constant. ID <2> (OpCopyObject) is not a constant")); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizeNotVector) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstant %u32 16 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +%copy = OpCopyObject %u32 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize " + "variable needs to be a 3-component 32-bit int vector. " + "ID <2> (OpConstant) is not an int vector.")); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizeNotIntVector) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %f32vec3 %f32_1 %f32_1 %f32_1 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +%copy = OpCopyObject %f32vec3 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize " + "variable needs to be a 3-component 32-bit int vector. " + "ID <2> (OpConstantComposite) is not an int vector.")); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizeNotVec3) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %u32vec2 %u32_1 %u32_1 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +%copy = OpCopyObject %u32vec2 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize " + "variable needs to be a 3-component 32-bit int vector. " + "ID <2> (OpConstantComposite) has 2 components.")); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizeNotInt32Vec) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %u64vec3 %u64_1 %u64_1 %u64_1 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +%copy = OpCopyObject %u64vec3 %workgroup_size +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("According to the Vulkan spec BuiltIn WorkgroupSize variable " + "needs to be a 3-component 32-bit int vector. ID <2> " + "(OpConstantComposite) has components with bit width 64.")); +} + +TEST_F(ValidateBuiltIns, WorkgroupSizePrivateVar) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %workgroup_size BuiltIn WorkgroupSize +)"; + + generator.after_types_ = R"( +%workgroup_size = OpConstantComposite %u32vec3 %u32_1 %u32_1 %u32_1 +%private_ptr_u32vec3 = OpTypePointer Private %u32vec3 +%var = OpVariable %private_ptr_u32vec3 Private %workgroup_size +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "GLCompute"; + entry_point.body = R"( +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateBuiltIns, GeometryPositionInOutSuccess) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + + generator.before_types_ = R"( +OpMemberDecorate %input_type 0 BuiltIn Position +OpMemberDecorate %output_type 0 BuiltIn Position +)"; + + generator.after_types_ = R"( +%input_type = OpTypeStruct %f32vec4 +%arrayed_input_type = OpTypeArray %input_type %u32_3 +%input_ptr = OpTypePointer Input %arrayed_input_type +%input = OpVariable %input_ptr Input +%input_f32vec4_ptr = OpTypePointer Input %f32vec4 +%output_type = OpTypeStruct %f32vec4 +%arrayed_output_type = OpTypeArray %output_type %u32_3 +%output_ptr = OpTypePointer Output %arrayed_output_type +%output = OpVariable %output_ptr Output +%output_f32vec4_ptr = OpTypePointer Output %f32vec4 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Geometry"; + entry_point.interfaces = "%input %output"; + entry_point.body = R"( +%input_pos = OpAccessChain %input_f32vec4_ptr %input %u32_0 %u32_0 +%output_pos = OpAccessChain %output_f32vec4_ptr %output %u32_0 %u32_0 +%pos = OpLoad %f32vec4 %input_pos +OpStore %output_pos %pos +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateBuiltIns, TwoBuiltInsFirstFails) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + + generator.before_types_ = R"( +OpMemberDecorate %input_type 0 BuiltIn FragCoord +OpMemberDecorate %output_type 0 BuiltIn Position +)"; + + generator.after_types_ = R"( +%input_type = OpTypeStruct %f32vec4 +%input_ptr = OpTypePointer Input %input_type +%input = OpVariable %input_ptr Input +%input_f32vec4_ptr = OpTypePointer Input %f32vec4 +%output_type = OpTypeStruct %f32vec4 +%output_ptr = OpTypePointer Output %output_type +%output = OpVariable %output_ptr Output +%output_f32vec4_ptr = OpTypePointer Output %f32vec4 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Geometry"; + entry_point.interfaces = "%input %output"; + entry_point.body = R"( +%input_pos = OpAccessChain %input_f32vec4_ptr %input %u32_0 +%output_pos = OpAccessChain %output_f32vec4_ptr %output %u32_0 +%pos = OpLoad %f32vec4 %input_pos +OpStore %output_pos %pos +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec allows BuiltIn FragCoord to be used only " + "with Fragment execution model")); +} + +TEST_F(ValidateBuiltIns, TwoBuiltInsSecondFails) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + + generator.before_types_ = R"( +OpMemberDecorate %input_type 0 BuiltIn Position +OpMemberDecorate %output_type 0 BuiltIn FragCoord +)"; + + generator.after_types_ = R"( +%input_type = OpTypeStruct %f32vec4 +%input_ptr = OpTypePointer Input %input_type +%input = OpVariable %input_ptr Input +%input_f32vec4_ptr = OpTypePointer Input %f32vec4 +%output_type = OpTypeStruct %f32vec4 +%output_ptr = OpTypePointer Output %output_type +%output = OpVariable %output_ptr Output +%output_f32vec4_ptr = OpTypePointer Output %f32vec4 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Geometry"; + entry_point.interfaces = "%input %output"; + entry_point.body = R"( +%input_pos = OpAccessChain %input_f32vec4_ptr %input %u32_0 +%output_pos = OpAccessChain %output_f32vec4_ptr %output %u32_0 +%pos = OpLoad %f32vec4 %input_pos +OpStore %output_pos %pos +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec allows BuiltIn FragCoord to be only used " + "for variables with Input storage class")); +} + +TEST_F(ValidateBuiltIns, VertexPositionVariableSuccess) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpDecorate %position BuiltIn Position +)"; + + generator.after_types_ = R"( +%f32vec4_ptr_output = OpTypePointer Output %f32vec4 +%position = OpVariable %f32vec4_ptr_output Output +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Vertex"; + entry_point.interfaces = "%position"; + entry_point.body = R"( +OpStore %position %f32vec4_0123 +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateBuiltIns, FragmentPositionTwoEntryPoints) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpMemberDecorate %output_type 0 BuiltIn Position +)"; + + generator.after_types_ = R"( +%output_type = OpTypeStruct %f32vec4 +%output_ptr = OpTypePointer Output %output_type +%output = OpVariable %output_ptr Output +%output_f32vec4_ptr = OpTypePointer Output %f32vec4 +)"; + + EntryPoint entry_point; + entry_point.name = "vmain"; + entry_point.execution_model = "Vertex"; + entry_point.interfaces = "%output"; + entry_point.body = R"( +%val1 = OpFunctionCall %void %foo +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + entry_point.name = "fmain"; + entry_point.execution_model = "Fragment"; + entry_point.interfaces = "%output"; + entry_point.execution_modes = "OpExecutionMode %fmain OriginUpperLeft"; + entry_point.body = R"( +%val2 = OpFunctionCall %void %foo +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + generator.add_at_the_end_ = R"( +%foo = OpFunction %void None %func +%foo_entry = OpLabel +%position = OpAccessChain %output_f32vec4_ptr %output %u32_0 +OpStore %position %f32vec4_0123 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec allows BuiltIn Position to be used only " + "with Vertex, TessellationControl, " + "TessellationEvaluation or Geometry execution models")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("called with execution model Fragment")); +} + +TEST_F(ValidateBuiltIns, FragmentFragDepthNoDepthReplacing) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpMemberDecorate %output_type 0 BuiltIn FragDepth +)"; + + generator.after_types_ = R"( +%output_type = OpTypeStruct %f32 +%output_ptr = OpTypePointer Output %output_type +%output = OpVariable %output_ptr Output +%output_f32_ptr = OpTypePointer Output %f32 +)"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Fragment"; + entry_point.interfaces = "%output"; + entry_point.execution_modes = "OpExecutionMode %main OriginUpperLeft"; + entry_point.body = R"( +%val2 = OpFunctionCall %void %foo +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + generator.add_at_the_end_ = R"( +%foo = OpFunction %void None %func +%foo_entry = OpLabel +%frag_depth = OpAccessChain %output_f32_ptr %output %u32_0 +OpStore %frag_depth %f32_1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec requires DepthReplacing execution mode to " + "be declared when using BuiltIn FragDepth")); +} + +TEST_F(ValidateBuiltIns, FragmentFragDepthOneMainHasDepthReplacingOtherHasnt) { + CodeGenerator generator = GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( +OpMemberDecorate %output_type 0 BuiltIn FragDepth +)"; + + generator.after_types_ = R"( +%output_type = OpTypeStruct %f32 +%output_ptr = OpTypePointer Output %output_type +%output = OpVariable %output_ptr Output +%output_f32_ptr = OpTypePointer Output %f32 +)"; + + EntryPoint entry_point; + entry_point.name = "main_d_r"; + entry_point.execution_model = "Fragment"; + entry_point.interfaces = "%output"; + entry_point.execution_modes = + "OpExecutionMode %main_d_r OriginUpperLeft\n" + "OpExecutionMode %main_d_r DepthReplacing"; + entry_point.body = R"( +%val2 = OpFunctionCall %void %foo +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + entry_point.name = "main_no_d_r"; + entry_point.execution_model = "Fragment"; + entry_point.interfaces = "%output"; + entry_point.execution_modes = "OpExecutionMode %main_no_d_r OriginUpperLeft"; + entry_point.body = R"( +%val3 = OpFunctionCall %void %foo +)"; + generator.entry_points_.push_back(std::move(entry_point)); + + generator.add_at_the_end_ = R"( +%foo = OpFunction %void None %func +%foo_entry = OpLabel +%frag_depth = OpAccessChain %output_f32_ptr %output %u32_0 +OpStore %frag_depth %f32_1 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vulkan spec requires DepthReplacing execution mode to " + "be declared when using BuiltIn FragDepth")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_capability_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_capability_test.cpp new file mode 100644 index 00000000000..2ee7133cd69 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_capability_test.cpp @@ -0,0 +1,2301 @@ +// Copyright (c) 2015-2016 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. + +// Validation tests for Logical Layout + +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/assembly_grammar.h" +#include "source/spirv_target_env.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using spvtest::ScopedContext; +using testing::Combine; +using testing::HasSubstr; +using testing::Values; +using testing::ValuesIn; + +// Parameter for validation test fixtures. The first std::string is a +// capability name that will begin the assembly under test, the second the +// remainder assembly, and the std::vector at the end determines whether the +// test expects success or failure. See below for details and convenience +// methods to access each one. +// +// The assembly to test is composed from a variable top line and a fixed +// remainder. The top line will be an OpCapability instruction, while the +// remainder will be some assembly text that succeeds or fails to assemble +// depending on which capability was chosen. For instance, the following will +// succeed: +// +// OpCapability Pipes ; implies Kernel +// OpLifetimeStop %1 0 ; requires Kernel +// +// and the following will fail: +// +// OpCapability Kernel +// %1 = OpTypeNamedBarrier ; requires NamedBarrier +// +// So how does the test parameter capture which capabilities should cause +// success and which shouldn't? The answer is in the last element: it's a +// std::vector of capabilities that make the remainder assembly succeed. So if +// the first-line capability exists in that std::vector, success is expected; +// otherwise, failure is expected in the tests. +// +// We will use testing::Combine() to vary the first line: when we combine +// AllCapabilities() with a single remainder assembly, we generate enough test +// cases to try the assembly with every possible capability that could be +// declared. However, Combine() only produces tuples -- it cannot produce, say, +// a struct. Therefore, this type must be a tuple. +using CapTestParameter = + std::tuple>>; + +const std::string& Capability(const CapTestParameter& p) { + return std::get<0>(p); +} +const std::string& Remainder(const CapTestParameter& p) { + return std::get<1>(p).first; +} +const std::vector& MustSucceed(const CapTestParameter& p) { + return std::get<1>(p).second; +} + +// Creates assembly to test from p. +std::string MakeAssembly(const CapTestParameter& p) { + std::ostringstream ss; + const std::string& capability = Capability(p); + if (!capability.empty()) { + ss << "OpCapability " << capability << "\n"; + } + ss << Remainder(p); + return ss.str(); +} + +// Expected validation result for p. +spv_result_t ExpectedResult(const CapTestParameter& p) { + const auto& caps = MustSucceed(p); + auto found = find(begin(caps), end(caps), Capability(p)); + return (found == end(caps)) ? SPV_ERROR_INVALID_CAPABILITY : SPV_SUCCESS; +} + +// Assembles using v1.0, unless the parameter's capability requires v1.1. +using ValidateCapability = spvtest::ValidateBase; + +// Always assembles using v1.1. +using ValidateCapabilityV11 = spvtest::ValidateBase; + +// Always assembles using Vulkan 1.0. +// TODO(dneto): Refactor all these tests to scale better across environments. +using ValidateCapabilityVulkan10 = spvtest::ValidateBase; +// Always assembles using OpenGL 4.0. +using ValidateCapabilityOpenGL40 = spvtest::ValidateBase; +// Always assembles using Vulkan 1.1. +using ValidateCapabilityVulkan11 = spvtest::ValidateBase; + +TEST_F(ValidateCapability, Default) { + const char str[] = R"( + OpCapability Kernel + OpCapability Linkage + OpCapability Matrix + OpMemoryModel Logical OpenCL +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 3 +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// clang-format off +const std::vector& AllCapabilities() { + static const auto r = new std::vector{ + "", + "Matrix", + "Shader", + "Geometry", + "Tessellation", + "Addresses", + "Linkage", + "Kernel", + "Vector16", + "Float16Buffer", + "Float16", + "Float64", + "Int64", + "Int64Atomics", + "ImageBasic", + "ImageReadWrite", + "ImageMipmap", + "Pipes", + "Groups", + "DeviceEnqueue", + "LiteralSampler", + "AtomicStorage", + "Int16", + "TessellationPointSize", + "GeometryPointSize", + "ImageGatherExtended", + "StorageImageMultisample", + "UniformBufferArrayDynamicIndexing", + "SampledImageArrayDynamicIndexing", + "StorageBufferArrayDynamicIndexing", + "StorageImageArrayDynamicIndexing", + "ClipDistance", + "CullDistance", + "ImageCubeArray", + "SampleRateShading", + "ImageRect", + "SampledRect", + "GenericPointer", + "Int8", + "InputAttachment", + "SparseResidency", + "MinLod", + "Sampled1D", + "Image1D", + "SampledCubeArray", + "SampledBuffer", + "ImageBuffer", + "ImageMSArray", + "StorageImageExtendedFormats", + "ImageQuery", + "DerivativeControl", + "InterpolationFunction", + "TransformFeedback", + "GeometryStreams", + "StorageImageReadWithoutFormat", + "StorageImageWriteWithoutFormat", + "MultiViewport", + "SubgroupDispatch", + "NamedBarrier", + "PipeStorage", + "GroupNonUniform", + "GroupNonUniformVote", + "GroupNonUniformArithmetic", + "GroupNonUniformBallot", + "GroupNonUniformShuffle", + "GroupNonUniformShuffleRelative", + "GroupNonUniformClustered", + "GroupNonUniformQuad", + "DrawParameters", + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16", + "UniformAndStorageBuffer16BitAccess", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16", + "DeviceGroup", + "MultiView", + "VariablePointersStorageBuffer", + "VariablePointers"}; + return *r; +} + +const std::vector& AllSpirV10Capabilities() { + static const auto r = new std::vector{ + "", + "Matrix", + "Shader", + "Geometry", + "Tessellation", + "Addresses", + "Linkage", + "Kernel", + "Vector16", + "Float16Buffer", + "Float16", + "Float64", + "Int64", + "Int64Atomics", + "ImageBasic", + "ImageReadWrite", + "ImageMipmap", + "Pipes", + "Groups", + "DeviceEnqueue", + "LiteralSampler", + "AtomicStorage", + "Int16", + "TessellationPointSize", + "GeometryPointSize", + "ImageGatherExtended", + "StorageImageMultisample", + "UniformBufferArrayDynamicIndexing", + "SampledImageArrayDynamicIndexing", + "StorageBufferArrayDynamicIndexing", + "StorageImageArrayDynamicIndexing", + "ClipDistance", + "CullDistance", + "ImageCubeArray", + "SampleRateShading", + "ImageRect", + "SampledRect", + "GenericPointer", + "Int8", + "InputAttachment", + "SparseResidency", + "MinLod", + "Sampled1D", + "Image1D", + "SampledCubeArray", + "SampledBuffer", + "ImageBuffer", + "ImageMSArray", + "StorageImageExtendedFormats", + "ImageQuery", + "DerivativeControl", + "InterpolationFunction", + "TransformFeedback", + "GeometryStreams", + "StorageImageReadWithoutFormat", + "StorageImageWriteWithoutFormat", + "MultiViewport"}; + return *r; +} + +const std::vector& AllVulkan10Capabilities() { + static const auto r = new std::vector{ + "", + "Matrix", + "Shader", + "InputAttachment", + "Sampled1D", + "Image1D", + "SampledBuffer", + "ImageBuffer", + "ImageQuery", + "DerivativeControl", + "Geometry", + "Tessellation", + "Float64", + "Int64", + "Int16", + "TessellationPointSize", + "GeometryPointSize", + "ImageGatherExtended", + "StorageImageMultisample", + "UniformBufferArrayDynamicIndexing", + "SampledImageArrayDynamicIndexing", + "StorageBufferArrayDynamicIndexing", + "StorageImageArrayDynamicIndexing", + "ClipDistance", + "CullDistance", + "ImageCubeArray", + "SampleRateShading", + "SparseResidency", + "MinLod", + "SampledCubeArray", + "ImageMSArray", + "StorageImageExtendedFormats", + "InterpolationFunction", + "StorageImageReadWithoutFormat", + "StorageImageWriteWithoutFormat", + "MultiViewport"}; + return *r; +} + +const std::vector& AllVulkan11Capabilities() { + static const auto r = new std::vector{ + "", + "Matrix", + "Shader", + "InputAttachment", + "Sampled1D", + "Image1D", + "SampledBuffer", + "ImageBuffer", + "ImageQuery", + "DerivativeControl", + "Geometry", + "Tessellation", + "Float64", + "Int64", + "Int16", + "TessellationPointSize", + "GeometryPointSize", + "ImageGatherExtended", + "StorageImageMultisample", + "UniformBufferArrayDynamicIndexing", + "SampledImageArrayDynamicIndexing", + "StorageBufferArrayDynamicIndexing", + "StorageImageArrayDynamicIndexing", + "ClipDistance", + "CullDistance", + "ImageCubeArray", + "SampleRateShading", + "SparseResidency", + "MinLod", + "SampledCubeArray", + "ImageMSArray", + "StorageImageExtendedFormats", + "InterpolationFunction", + "StorageImageReadWithoutFormat", + "StorageImageWriteWithoutFormat", + "MultiViewport", + "GroupNonUniform", + "GroupNonUniformVote", + "GroupNonUniformArithmetic", + "GroupNonUniformBallot", + "GroupNonUniformShuffle", + "GroupNonUniformShuffleRelative", + "GroupNonUniformClustered", + "GroupNonUniformQuad", + "DrawParameters", + "StorageBuffer16BitAccess", + "StorageUniformBufferBlock16", + "UniformAndStorageBuffer16BitAccess", + "StorageUniform16", + "StoragePushConstant16", + "StorageInputOutput16", + "DeviceGroup", + "MultiView", + "VariablePointersStorageBuffer", + "VariablePointers"}; + return *r; +} + +const std::vector& MatrixDependencies() { + static const auto r = new std::vector{ + "Matrix", + "Shader", + "Geometry", + "Tessellation", + "AtomicStorage", + "TessellationPointSize", + "GeometryPointSize", + "ImageGatherExtended", + "StorageImageMultisample", + "UniformBufferArrayDynamicIndexing", + "SampledImageArrayDynamicIndexing", + "StorageBufferArrayDynamicIndexing", + "StorageImageArrayDynamicIndexing", + "ClipDistance", + "CullDistance", + "ImageCubeArray", + "SampleRateShading", + "ImageRect", + "SampledRect", + "InputAttachment", + "SparseResidency", + "MinLod", + "SampledCubeArray", + "ImageMSArray", + "StorageImageExtendedFormats", + "ImageQuery", + "DerivativeControl", + "InterpolationFunction", + "TransformFeedback", + "GeometryStreams", + "StorageImageReadWithoutFormat", + "StorageImageWriteWithoutFormat", + "MultiViewport", + "DrawParameters", + "MultiView", + "VariablePointersStorageBuffer", + "VariablePointers"}; + return *r; +} + +const std::vector& ShaderDependencies() { + static const auto r = new std::vector{ + "Shader", + "Geometry", + "Tessellation", + "AtomicStorage", + "TessellationPointSize", + "GeometryPointSize", + "ImageGatherExtended", + "StorageImageMultisample", + "UniformBufferArrayDynamicIndexing", + "SampledImageArrayDynamicIndexing", + "StorageBufferArrayDynamicIndexing", + "StorageImageArrayDynamicIndexing", + "ClipDistance", + "CullDistance", + "ImageCubeArray", + "SampleRateShading", + "ImageRect", + "SampledRect", + "InputAttachment", + "SparseResidency", + "MinLod", + "SampledCubeArray", + "ImageMSArray", + "StorageImageExtendedFormats", + "ImageQuery", + "DerivativeControl", + "InterpolationFunction", + "TransformFeedback", + "GeometryStreams", + "StorageImageReadWithoutFormat", + "StorageImageWriteWithoutFormat", + "MultiViewport", + "DrawParameters", + "MultiView", + "VariablePointersStorageBuffer", + "VariablePointers"}; + return *r; +} + +const std::vector& TessellationDependencies() { + static const auto r = new std::vector{ + "Tessellation", + "TessellationPointSize"}; + return *r; +} + +const std::vector& GeometryDependencies() { + static const auto r = new std::vector{ + "Geometry", + "GeometryPointSize", + "GeometryStreams", + "MultiViewport"}; + return *r; +} + +const std::vector& GeometryTessellationDependencies() { + static const auto r = new std::vector{ + "Tessellation", + "TessellationPointSize", + "Geometry", + "GeometryPointSize", + "GeometryStreams", + "MultiViewport"}; + return *r; +} + +// Returns the names of capabilities that directly depend on Kernel, +// plus itself. +const std::vector& KernelDependencies() { + static const auto r = new std::vector{ + "Kernel", + "Vector16", + "Float16Buffer", + "ImageBasic", + "ImageReadWrite", + "ImageMipmap", + "Pipes", + "DeviceEnqueue", + "LiteralSampler", + "SubgroupDispatch", + "NamedBarrier", + "PipeStorage"}; + return *r; +} + +const std::vector& KernelAndGroupNonUniformDependencies() { + static const auto r = new std::vector{ + "Kernel", + "Vector16", + "Float16Buffer", + "ImageBasic", + "ImageReadWrite", + "ImageMipmap", + "Pipes", + "DeviceEnqueue", + "LiteralSampler", + "SubgroupDispatch", + "NamedBarrier", + "PipeStorage", + "GroupNonUniform", + "GroupNonUniformVote", + "GroupNonUniformArithmetic", + "GroupNonUniformBallot", + "GroupNonUniformShuffle", + "GroupNonUniformShuffleRelative", + "GroupNonUniformClustered", + "GroupNonUniformQuad"}; + return *r; +} + +const std::vector& AddressesDependencies() { + static const auto r = new std::vector{ + "Addresses", + "GenericPointer"}; + return *r; +} + +const std::vector& Sampled1DDependencies() { + static const auto r = new std::vector{ + "Sampled1D", + "Image1D"}; + return *r; +} + +const std::vector& SampledRectDependencies() { + static const auto r = new std::vector{ + "SampledRect", + "ImageRect"}; + return *r; +} + +const std::vector& SampledBufferDependencies() { + static const auto r = new std::vector{ + "SampledBuffer", + "ImageBuffer"}; + return *r; +} + +const char kOpenCLMemoryModel[] = \ + " OpCapability Kernel" + " OpMemoryModel Logical OpenCL "; + +const char kGLSL450MemoryModel[] = \ + " OpCapability Shader" + " OpMemoryModel Logical GLSL450 "; + +const char kVoidFVoid[] = \ + " %void = OpTypeVoid" + " %void_f = OpTypeFunction %void" + " %func = OpFunction %void None %void_f" + " %label = OpLabel" + " OpReturn" + " OpFunctionEnd "; + +const char kVoidFVoid2[] = \ + " %void_f = OpTypeFunction %voidt" + " %func = OpFunction %voidt None %void_f" + " %label = OpLabel" + " OpReturn" + " OpFunctionEnd "; + +INSTANTIATE_TEST_CASE_P(ExecutionModel, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint TessellationControl %func \"shader\"" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint TessellationEvaluation %func \"shader\"" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Geometry %func \"shader\"" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Fragment %func \"shader\"" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint GLCompute %func \"shader\"" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Kernel %func \"shader\"" + + std::string(kVoidFVoid), KernelDependencies()) +)),); + +INSTANTIATE_TEST_CASE_P(AddressingAndMemoryModel, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(" OpCapability Shader" + " OpMemoryModel Logical Simple" + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), AllCapabilities()), +std::make_pair(" OpCapability Shader" + " OpMemoryModel Logical GLSL450" + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), AllCapabilities()), +std::make_pair(" OpCapability Kernel" + " OpMemoryModel Logical OpenCL" + " OpEntryPoint Kernel %func \"compute\"" + + std::string(kVoidFVoid), AllCapabilities()), +std::make_pair(" OpCapability Shader" + " OpMemoryModel Physical32 Simple" + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), AddressesDependencies()), +std::make_pair(" OpCapability Shader" + " OpMemoryModel Physical32 GLSL450" + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), AddressesDependencies()), +std::make_pair(" OpCapability Kernel" + " OpMemoryModel Physical32 OpenCL" + " OpEntryPoint Kernel %func \"compute\"" + + std::string(kVoidFVoid), AddressesDependencies()), +std::make_pair(" OpCapability Shader" + " OpMemoryModel Physical64 Simple" + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), AddressesDependencies()), +std::make_pair(" OpCapability Shader" + " OpMemoryModel Physical64 GLSL450" + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid), AddressesDependencies()), +std::make_pair(" OpCapability Kernel" + " OpMemoryModel Physical64 OpenCL" + " OpEntryPoint Kernel %func \"compute\"" + + std::string(kVoidFVoid), AddressesDependencies()) +)),); + +INSTANTIATE_TEST_CASE_P(ExecutionMode, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func Invocations 42" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func SpacingEqual" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func SpacingFractionalEven" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func SpacingFractionalOdd" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func VertexOrderCw" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func VertexOrderCcw" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func PixelCenterInteger" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func OriginUpperLeft" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func OriginLowerLeft" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func EarlyFragmentTests" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func PointMode" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func Xfb" + + std::string(kVoidFVoid), std::vector{"TransformFeedback"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func DepthReplacing" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func DepthGreater" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func DepthLess" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" " + "OpExecutionMode %func DepthUnchanged" + + std::string(kVoidFVoid), ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"shader\" " + "OpExecutionMode %func LocalSize 42 42 42" + + std::string(kVoidFVoid), AllCapabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Kernel %func \"shader\" " + "OpExecutionMode %func LocalSizeHint 42 42 42" + + std::string(kVoidFVoid), KernelDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func InputPoints" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func InputLines" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func InputLinesAdjacency" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func Triangles" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func Triangles" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func InputTrianglesAdjacency" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func Quads" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func Isolines" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func OutputVertices 42" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint TessellationControl %func \"shader\" " + "OpExecutionMode %func OutputVertices 42" + + std::string(kVoidFVoid), TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func OutputPoints" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func OutputLineStrip" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Geometry %func \"shader\" " + "OpExecutionMode %func OutputTriangleStrip" + + std::string(kVoidFVoid), GeometryDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Kernel %func \"shader\" " + "OpExecutionMode %func VecTypeHint 2" + + std::string(kVoidFVoid), KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Kernel %func \"shader\" " + "OpExecutionMode %func ContractionOff" + + std::string(kVoidFVoid), KernelDependencies()))),); + +// clang-format on + +INSTANTIATE_TEST_CASE_P( + ExecutionModeV11, ValidateCapabilityV11, + Combine(ValuesIn(AllCapabilities()), + Values(std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"shader\" " + "OpExecutionMode %func SubgroupSize 1" + + std::string(kVoidFVoid), + std::vector{"SubgroupDispatch"}), + std::make_pair( + std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"shader\" " + "OpExecutionMode %func SubgroupsPerWorkgroup 65535" + + std::string(kVoidFVoid), + std::vector{"SubgroupDispatch"}))), ); +// clang-format off + +INSTANTIATE_TEST_CASE_P(StorageClass, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer UniformConstant %intt\n" + " %var = OpVariable %ptrt UniformConstant\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Kernel %func \"compute\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer Input %intt" + " %var = OpVariable %ptrt Input\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer Uniform %intt\n" + " %var = OpVariable %ptrt Uniform\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer Output %intt\n" + " %var = OpVariable %ptrt Output\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer Workgroup %intt\n" + " %var = OpVariable %ptrt Workgroup\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer CrossWorkgroup %intt\n" + " %var = OpVariable %ptrt CrossWorkgroup\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Kernel %func \"compute\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer Private %intt\n" + " %var = OpVariable %ptrt Private\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + " OpEntryPoint Kernel %func \"compute\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer PushConstant %intt\n" + " %var = OpVariable %ptrt PushConstant\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer AtomicCounter %intt\n" + " %var = OpVariable %ptrt AtomicCounter\n" + std::string(kVoidFVoid), + std::vector{"AtomicStorage"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + + " %intt = OpTypeInt 32 0\n" + " %ptrt = OpTypePointer Image %intt\n" + " %var = OpVariable %ptrt Image\n" + std::string(kVoidFVoid), + AllCapabilities()) +)),); + +INSTANTIATE_TEST_CASE_P(Dim, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt 1D 0 0 0 0 Unknown" + std::string(kVoidFVoid2), + Sampled1DDependencies()), +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt 2D 0 0 0 0 Unknown" + std::string(kVoidFVoid2), + AllCapabilities()), +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt 3D 0 0 0 0 Unknown" + std::string(kVoidFVoid2), + AllCapabilities()), +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt Cube 0 0 0 0 Unknown" + std::string(kVoidFVoid2), + ShaderDependencies()), +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt Rect 0 0 0 0 Unknown" + std::string(kVoidFVoid2), + SampledRectDependencies()), +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt Buffer 0 0 0 0 Unknown" + std::string(kVoidFVoid2), + SampledBufferDependencies()), +std::make_pair(" OpCapability ImageBasic" + + std::string(kOpenCLMemoryModel) + + std::string(" OpEntryPoint Kernel %func \"compute\"") + + " %voidt = OpTypeVoid" + " %imgt = OpTypeImage %voidt SubpassData 0 0 0 2 Unknown" + std::string(kVoidFVoid2), + std::vector{"InputAttachment"}) +)),); + +// NOTE: All Sampler Address Modes require kernel capabilities but the +// OpConstantSampler requires LiteralSampler which depends on Kernel +INSTANTIATE_TEST_CASE_P(SamplerAddressingMode, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + " %samplert = OpTypeSampler" + " %sampler = OpConstantSampler %samplert None 1 Nearest" + + std::string(kVoidFVoid), + std::vector{"LiteralSampler"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + " %samplert = OpTypeSampler" + " %sampler = OpConstantSampler %samplert ClampToEdge 1 Nearest" + + std::string(kVoidFVoid), + std::vector{"LiteralSampler"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + " %samplert = OpTypeSampler" + " %sampler = OpConstantSampler %samplert Clamp 1 Nearest" + + std::string(kVoidFVoid), + std::vector{"LiteralSampler"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + " %samplert = OpTypeSampler" + " %sampler = OpConstantSampler %samplert Repeat 1 Nearest" + + std::string(kVoidFVoid), + std::vector{"LiteralSampler"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + " OpEntryPoint Vertex %func \"shader\"" + " %samplert = OpTypeSampler" + " %sampler = OpConstantSampler %samplert RepeatMirrored 1 Nearest" + + std::string(kVoidFVoid), + std::vector{"LiteralSampler"}) +)),); + +// TODO(umar): Sampler Filter Mode +// TODO(umar): Image Format +// TODO(umar): Image Channel Order +// TODO(umar): Image Channel Data Type +// TODO(umar): Image Operands +// TODO(umar): FP Fast Math Mode +// TODO(umar): FP Rounding Mode +// TODO(umar): Linkage Type +// TODO(umar): Access Qualifier +// TODO(umar): Function Parameter Attribute + +INSTANTIATE_TEST_CASE_P(Decoration, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt RelaxedPrecision\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Block\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt BufferBlock\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt RowMajor\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + MatrixDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt ColMajor\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + MatrixDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt ArrayStride 1\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt MatrixStride 1\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + MatrixDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt GLSLShared\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt GLSLPacked\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %intt CPacked\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt NoPerspective\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Flat\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Patch\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Centroid\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Sample\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"SampleRateShading"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Invariant\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Restrict\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Aliased\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Volatile\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %intt Constant\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Coherent\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt NonWritable\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt NonReadable\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Uniform\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %intt SaturatedConversion\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Stream 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"GeometryStreams"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Location 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Component 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Index 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Binding 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt DescriptorSet 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt Offset 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt XfbBuffer 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"TransformFeedback"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt XfbStride 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"TransformFeedback"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %intt FuncParamAttr Zext\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %intt FPFastMathMode Fast\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt LinkageAttributes \"other\" Import\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"Linkage"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt NoContraction\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %intt InputAttachmentIndex 0\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"InputAttachment"}), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %intt Alignment 4\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()) +)),); + +// clang-format on +INSTANTIATE_TEST_CASE_P( + DecorationSpecId, ValidateCapability, + Combine( + ValuesIn(AllSpirV10Capabilities()), + Values(std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %1 SpecId 1\n" + "%intt = OpTypeInt 32 0\n" + "%1 = OpSpecConstant %intt 0\n" + + std::string(kVoidFVoid), + ShaderDependencies()))), ); + +INSTANTIATE_TEST_CASE_P( + DecorationV11, ValidateCapabilityV11, + Combine(ValuesIn(AllCapabilities()), + Values(std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %p MaxByteOffset 0 " + "%i32 = OpTypeInt 32 0 " + "%pi32 = OpTypePointer Workgroup %i32 " + "%p = OpVariable %pi32 Workgroup " + + std::string(kVoidFVoid), + AddressesDependencies()), + // Trying to test OpDecorate here, but if this fails due to + // incorrect OpMemoryModel validation, that must also be + // fixed. + std::make_pair( + std::string("OpMemoryModel Logical OpenCL " + "OpEntryPoint Kernel %func \"compute\" \n" + "OpDecorate %1 SpecId 1 " + "%intt = OpTypeInt 32 0 " + "%1 = OpSpecConstant %intt 0") + + std::string(kVoidFVoid), + KernelDependencies()), + std::make_pair( + std::string("OpMemoryModel Logical Simple " + "OpEntryPoint Vertex %func \"shader\" \n" + "OpDecorate %1 SpecId 1 " + "%intt = OpTypeInt 32 0 " + "%1 = OpSpecConstant %intt 0") + + std::string(kVoidFVoid), + ShaderDependencies()))), ); +// clang-format off + +INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn Position\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +// Just mentioning PointSize, ClipDistance, or CullDistance as a BuiltIn does +// not trigger the requirement for the associated capability. +// See https://github.com/KhronosGroup/SPIRV-Tools/issues/365 +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn PointSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn ClipDistance\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn CullDistance\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn VertexId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn InstanceId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn PrimitiveId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + GeometryTessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn InvocationId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + GeometryTessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn Layer\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + GeometryDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn ViewportIndex\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"MultiViewport"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn TessLevelOuter\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn TessLevelInner\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn TessCoord\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn PatchVertices\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + TessellationDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn FragCoord\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn PointCoord\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn FrontFacing\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn SampleId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"SampleRateShading"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn SamplePosition\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + std::vector{"SampleRateShading"}), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn SampleMask\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn FragDepth\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn HelperInvocation\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn VertexIndex\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn InstanceIndex\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn NumWorkgroups\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn WorkgroupSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn WorkgroupId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn LocalInvocationId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn GlobalInvocationId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn LocalInvocationIndex\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllCapabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn WorkDim\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn GlobalSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn EnqueuedWorkgroupSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn GlobalOffset\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn GlobalLinearId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn SubgroupSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelAndGroupNonUniformDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn SubgroupMaxSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn NumSubgroups\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelAndGroupNonUniformDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn NumEnqueuedSubgroups\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn SubgroupId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelAndGroupNonUniformDependencies()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn SubgroupLocalInvocationId\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + KernelAndGroupNonUniformDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn VertexIndex\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()), +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "OpDecorate %intt BuiltIn InstanceIndex\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + ShaderDependencies()) +)),); + +// Ensure that mere mention of PointSize, ClipDistance, or CullDistance as +// BuiltIns does not trigger the requirement for the associated +// capability. +// See https://github.com/KhronosGroup/SPIRV-Tools/issues/365 +INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapabilityVulkan10, + Combine( + // All capabilities to try. + ValuesIn(AllSpirV10Capabilities()), + Values( +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpMemberDecorate %block 0 BuiltIn PointSize\n" + "%f32 = OpTypeFloat 32\n" + "%block = OpTypeStruct %f32\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + // Capabilities which should succeed. + AllVulkan10Capabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpMemberDecorate %block 0 BuiltIn ClipDistance\n" + "%f32 = OpTypeFloat 32\n" + "%intt = OpTypeInt 32 0\n" + "%intt_4 = OpConstant %intt 4\n" + "%f32arr4 = OpTypeArray %f32 %intt_4\n" + "%block = OpTypeStruct %f32arr4\n" + std::string(kVoidFVoid), + AllVulkan10Capabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + "OpMemberDecorate %block 0 BuiltIn CullDistance\n" + "%f32 = OpTypeFloat 32\n" + "%intt = OpTypeInt 32 0\n" + "%intt_4 = OpConstant %intt 4\n" + "%f32arr4 = OpTypeArray %f32 %intt_4\n" + "%block = OpTypeStruct %f32arr4\n" + std::string(kVoidFVoid), + AllVulkan10Capabilities()) +)),); + +INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapabilityOpenGL40, + Combine( + // OpenGL 4.0 is based on SPIR-V 1.0 + ValuesIn(AllSpirV10Capabilities()), + Values( +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn PointSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllSpirV10Capabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn ClipDistance\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllSpirV10Capabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn CullDistance\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllSpirV10Capabilities()) +)),); + +INSTANTIATE_TEST_CASE_P(Capabilities, ValidateCapabilityVulkan11, + Combine( + // All capabilities to try. + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn PointSize\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllVulkan11Capabilities()), +std::make_pair(std::string(kGLSL450MemoryModel) + + "OpEntryPoint Vertex %func \"shader\" \n" + + "OpDecorate %intt BuiltIn CullDistance\n" + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + AllVulkan11Capabilities()) +)),); + +// TODO(umar): Selection Control +// TODO(umar): Loop Control +// TODO(umar): Function Control +// TODO(umar): Memory Semantics +// TODO(umar): Memory Access +// TODO(umar): Scope +// TODO(umar): Group Operation +// TODO(umar): Kernel Enqueue Flags +// TODO(umar): Kernel Profiling Flags + +INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values( +std::make_pair(std::string(kOpenCLMemoryModel) + + "OpEntryPoint Kernel %func \"compute\" \n" + + "%f32 = OpTypeFloat 32\n" + "%vec3 = OpTypeVector %f32 3\n" + "%mat33 = OpTypeMatrix %vec3 3\n" + std::string(kVoidFVoid), + MatrixDependencies()))),); +// clang-format on + +#if 0 +// TODO(atgoo@github.com) The following test is not valid as it generates +// invalid combinations of images, instructions and image operands. +// +// Creates assembly containing an OpImageFetch instruction using operands for +// the image-operands part. The assembly defines constants %fzero and %izero +// that can be used for operands where IDs are required. The assembly is valid, +// apart from not declaring any capabilities required by the operands. +string ImageOperandsTemplate(const std::string& operands) { + ostringstream ss; + // clang-format off + ss << R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL + +%i32 = OpTypeInt 32 0 +%f32 = OpTypeFloat 32 +%v4i32 = OpTypeVector %i32 4 +%timg = OpTypeImage %i32 2D 0 0 0 0 Unknown +%pimg = OpTypePointer UniformConstant %timg +%tfun = OpTypeFunction %i32 + +%vimg = OpVariable %pimg UniformConstant +%izero = OpConstant %i32 0 +%fzero = OpConstant %f32 0. + +%main = OpFunction %i32 None %tfun +%lbl = OpLabel +%img = OpLoad %timg %vimg +%r1 = OpImageFetch %v4i32 %img %izero )" << operands << R"( +OpReturnValue %izero +OpFunctionEnd +)"; + // clang-format on + return ss.str(); +} + +INSTANTIATE_TEST_CASE_P( + TwoImageOperandsMask, ValidateCapability, + Combine( + ValuesIn(AllCapabilities()), + Values(std::make_pair(ImageOperandsTemplate("Bias|Lod %fzero %fzero"), + ShaderDependencies()), + std::make_pair(ImageOperandsTemplate("Lod|Offset %fzero %izero"), + std::vector{"ImageGatherExtended"}), + std::make_pair(ImageOperandsTemplate("Sample|MinLod %izero %fzero"), + std::vector{"MinLod"}), + std::make_pair(ImageOperandsTemplate("Lod|Sample %fzero %izero"), + AllCapabilities()))), ); +#endif + +// TODO(umar): Instruction capability checks + +spv_result_t spvCoreOperandTableNameLookup(spv_target_env env, + const spv_operand_table table, + const spv_operand_type_t type, + const char* name, + const size_t nameLength) { + if (!table) return SPV_ERROR_INVALID_TABLE; + if (!name) return SPV_ERROR_INVALID_POINTER; + + for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) { + const auto& group = table->types[typeIndex]; + if (type != group.type) continue; + for (uint64_t index = 0; index < group.count; ++index) { + const auto& entry = group.entries[index]; + // Check for min version only. + if (spvVersionForTargetEnv(env) >= entry.minVersion && + nameLength == strlen(entry.name) && + !strncmp(entry.name, name, nameLength)) { + return SPV_SUCCESS; + } + } + } + + return SPV_ERROR_INVALID_LOOKUP; +} + +// True if capability exists in core spec of env. +bool Exists(const std::string& capability, spv_target_env env) { + ScopedContext sc(env); + return SPV_SUCCESS == + spvCoreOperandTableNameLookup(env, sc.context->operand_table, + SPV_OPERAND_TYPE_CAPABILITY, + capability.c_str(), capability.size()); +} + +TEST_P(ValidateCapability, Capability) { + const std::string capability = Capability(GetParam()); + spv_target_env env = SPV_ENV_UNIVERSAL_1_0; + if (!capability.empty()) { + if (Exists(capability, SPV_ENV_UNIVERSAL_1_0)) + env = SPV_ENV_UNIVERSAL_1_0; + else if (Exists(capability, SPV_ENV_UNIVERSAL_1_1)) + env = SPV_ENV_UNIVERSAL_1_1; + else if (Exists(capability, SPV_ENV_UNIVERSAL_1_2)) + env = SPV_ENV_UNIVERSAL_1_2; + else + env = SPV_ENV_UNIVERSAL_1_3; + } + const std::string test_code = MakeAssembly(GetParam()); + CompileSuccessfully(test_code, env); + ASSERT_EQ(ExpectedResult(GetParam()), ValidateInstructions(env)) + << "target env: " << spvTargetEnvDescription(env) << "\ntest code:\n" + << test_code; +} + +TEST_P(ValidateCapabilityV11, Capability) { + const std::string capability = Capability(GetParam()); + if (Exists(capability, SPV_ENV_UNIVERSAL_1_1)) { + const std::string test_code = MakeAssembly(GetParam()); + CompileSuccessfully(test_code, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(ExpectedResult(GetParam()), + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)) + << test_code; + } +} + +TEST_P(ValidateCapabilityVulkan10, Capability) { + const std::string capability = Capability(GetParam()); + if (Exists(capability, SPV_ENV_VULKAN_1_0)) { + const std::string test_code = MakeAssembly(GetParam()); + CompileSuccessfully(test_code, SPV_ENV_VULKAN_1_0); + ASSERT_EQ(ExpectedResult(GetParam()), + ValidateInstructions(SPV_ENV_VULKAN_1_0)) + << test_code; + } +} + +TEST_P(ValidateCapabilityVulkan11, Capability) { + const std::string capability = Capability(GetParam()); + if (Exists(capability, SPV_ENV_VULKAN_1_1)) { + const std::string test_code = MakeAssembly(GetParam()); + CompileSuccessfully(test_code, SPV_ENV_VULKAN_1_1); + ASSERT_EQ(ExpectedResult(GetParam()), + ValidateInstructions(SPV_ENV_VULKAN_1_1)) + << test_code; + } +} + +TEST_P(ValidateCapabilityOpenGL40, Capability) { + const std::string capability = Capability(GetParam()); + if (Exists(capability, SPV_ENV_OPENGL_4_0)) { + const std::string test_code = MakeAssembly(GetParam()); + CompileSuccessfully(test_code, SPV_ENV_OPENGL_4_0); + ASSERT_EQ(ExpectedResult(GetParam()), + ValidateInstructions(SPV_ENV_OPENGL_4_0)) + << test_code; + } +} + +TEST_F(ValidateCapability, SemanticsIdIsAnIdNotALiteral) { + // From https://github.com/KhronosGroup/SPIRV-Tools/issues/248 + // The validator was interpreting the memory semantics ID number + // as the value to be checked rather than an ID that references + // another value to be checked. + // In this case a raw ID of 64 was mistaken to mean a literal + // semantic value of UniformMemory, which would require the Shader + // capability. + const char str[] = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL + +; %i32 has ID 1 +%i32 = OpTypeInt 32 0 +%tf = OpTypeFunction %i32 +%pi32 = OpTypePointer CrossWorkgroup %i32 +%var = OpVariable %pi32 CrossWorkgroup +%c = OpConstant %i32 100 +%scope = OpConstant %i32 1 ; Device scope + +; Fake an instruction with 64 as the result id. +; !64 = OpConstantNull %i32 +!0x3002e !1 !64 + +%f = OpFunction %i32 None %tf +%l = OpLabel +%result = OpAtomicIAdd %i32 %var %scope !64 %c +OpReturnValue %result +OpFunctionEnd +)"; + + CompileSuccessfully(str); + + // Since we are forcing usage of 64, the "id bound" in the binary header + // must be overwritten so that 64 is considered within bound. + // ID Bound is at index 3 of the binary. Set it to 65. + OverwriteAssembledBinary(3, 65); + + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCapability, IntSignednessKernelGood) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +%i32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCapability, IntSignednessKernelBad) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +%i32 = OpTypeInt 32 1 +)"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Signedness in OpTypeInt must always be 0 when " + "Kernel capability is used.")); +} + +TEST_F(ValidateCapability, IntSignednessShaderGood) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%u32 = OpTypeInt 32 0 +%i32 = OpTypeInt 32 1 +)"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCapability, NonVulkan10Capability) { + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%u32 = OpTypeInt 32 0 +%i32 = OpTypeInt 32 1 +)"; + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Linkage is not allowed by Vulkan 1.0")); +} + +TEST_F(ValidateCapability, Vulkan10EnabledByExtension) { + const std::string spirv = R"( +OpCapability Shader +OpCapability DrawParameters +OpExtension "SPV_KHR_shader_draw_parameters" +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %func "shader" +OpMemberDecorate %block 0 BuiltIn PointSize +%f32 = OpTypeFloat 32 +%block = OpTypeStruct %f32 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); +} + +TEST_F(ValidateCapability, Vulkan10NotEnabledByExtension) { + const std::string spirv = R"( +OpCapability Shader +OpCapability DrawParameters +OpMemoryModel Logical GLSL450 +OpEntryPoint Vertex %func "shader" +OpDecorate %intt BuiltIn PointSize +%intt = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_VULKAN_1_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Capability DrawParameters is not allowed by Vulkan 1.0")); +} + +TEST_F(ValidateCapability, NonOpenCL12FullCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Pipes +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_1_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_1_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Capability Pipes is not allowed by OpenCL 1.2 Full Profile")); +} + +TEST_F(ValidateCapability, OpenCL12FullEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability ImageBasic +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_1_2)); +} + +TEST_F(ValidateCapability, OpenCL12FullNotEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_1_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_1_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability Sampled1D is not allowed by OpenCL 1.2 Full Profile")); +} + +TEST_F(ValidateCapability, NonOpenCL12EmbeddedCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_1_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_1_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability Int64 is not allowed by OpenCL 1.2 Embedded Profile")); +} + +TEST_F(ValidateCapability, OpenCL12EmbeddedEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability ImageBasic +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_1_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_1_2)); +} + +TEST_F(ValidateCapability, OpenCL12EmbeddedNotEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_1_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_1_2)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Sampled1D is not allowed by OpenCL 1.2 " + "Embedded Profile")); +} + +TEST_F(ValidateCapability, OpenCL20FullCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Pipes +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_2_0)); +} + +TEST_F(ValidateCapability, NonOpenCL20FullCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Matrix +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_2_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability Matrix is not allowed by OpenCL 2.0/2.1 Full Profile")); +} + +TEST_F(ValidateCapability, OpenCL20FullEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability ImageBasic +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_2_0)); +} + +TEST_F(ValidateCapability, OpenCL20FullNotEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_2_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Sampled1D is not allowed by OpenCL 2.0/2.1 " + "Full Profile")); +} + +TEST_F(ValidateCapability, NonOpenCL20EmbeddedCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_2_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_2_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Int64 is not allowed by OpenCL 2.0/2.1 " + "Embedded Profile")); +} + +TEST_F(ValidateCapability, OpenCL20EmbeddedEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability ImageBasic +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_2_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_2_0)); +} + +TEST_F(ValidateCapability, OpenCL20EmbeddedNotEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_2_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_2_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Sampled1D is not allowed by OpenCL 2.0/2.1 " + "Embedded Profile")); +} + +TEST_F(ValidateCapability, OpenCL22FullCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability PipeStorage +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_2_2)); +} + +TEST_F(ValidateCapability, NonOpenCL22FullCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Matrix +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_2_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Capability Matrix is not allowed by OpenCL 2.2 Full Profile")); +} + +TEST_F(ValidateCapability, OpenCL22FullEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability ImageBasic +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_2_2)); +} + +TEST_F(ValidateCapability, OpenCL22FullNotEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_2_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_2_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability Sampled1D is not allowed by OpenCL 2.2 Full Profile")); +} + +TEST_F(ValidateCapability, NonOpenCL22EmbeddedCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Int64 +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)"; + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_2_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_2_2)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability Int64 is not allowed by OpenCL 2.2 Embedded Profile")); +} + +TEST_F(ValidateCapability, OpenCL22EmbeddedEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability ImageBasic +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_2_2); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_2_2)); +} + +TEST_F(ValidateCapability, OpenCL22EmbeddedNotEnabledByCapability) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability Linkage +OpCapability Sampled1D +OpMemoryModel Physical64 OpenCL +%u32 = OpTypeInt 32 0 +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_OPENCL_EMBEDDED_2_2); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_OPENCL_EMBEDDED_2_2)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Sampled1D is not allowed by OpenCL 2.2 " + "Embedded Profile")); +} + +// Three tests to check enablement of an enum (a decoration) which is not +// in core, and is directly enabled by a capability, but not directly enabled +// by an extension. See https://github.com/KhronosGroup/SPIRV-Tools/issues/1596 + +TEST_F(ValidateCapability, DecorationFromExtensionMissingEnabledByCapability) { + // Decoration ViewportRelativeNV is enabled by ShaderViewportMaskNV, which in + // turn is enabled by SPV_NV_viewport_array2. + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical Simple +OpDecorate %void ViewportRelativeNV +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Operand 2 of Decorate requires one of these " + "capabilities: ShaderViewportMaskNV")); +} + +TEST_F(ValidateCapability, CapabilityEnabledByMissingExtension) { + // Capability ShaderViewportMaskNV is enabled by SPV_NV_viewport_array2. + const std::string spirv = R"( +OpCapability Shader +OpCapability ShaderViewportMaskNV +OpMemoryModel Logical Simple +)" + std::string(kVoidFVoid); + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(SPV_ERROR_MISSING_EXTENSION, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("operand 5255 requires one of these extensions: " + "SPV_NV_viewport_array2")); +} + +TEST_F(ValidateCapability, + DecorationEnabledByCapabilityEnabledByPresentExtension) { + // Decoration ViewportRelativeNV is enabled by ShaderViewportMaskNV, which in + // turn is enabled by SPV_NV_viewport_array2. + const std::string spirv = R"( +OpCapability Shader +OpCapability Linkage +OpCapability ShaderViewportMaskNV +OpExtension "SPV_NV_viewport_array2" +OpMemoryModel Logical Simple +OpDecorate %void ViewportRelativeNV +%void = OpTypeVoid +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)) + << getDiagnosticString(); +} + +// Three tests to check enablement of an instruction which is not in core, and +// is directly enabled by a capability, but not directly enabled by an +// extension. See https://github.com/KhronosGroup/SPIRV-Tools/issues/1624 +// Instruction OpSubgroupShuffleINTEL is enabled by SubgroupShuffleINTEL, which +// in turn is enabled by SPV_INTEL_subgroups. + +TEST_F(ValidateCapability, InstructionFromExtensionMissingEnabledByCapability) { + // Decoration ViewportRelativeNV is enabled by ShaderViewportMaskNV, which in + // turn is enabled by SPV_NV_viewport_array2. + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +; OpCapability SubgroupShuffleINTEL +OpExtension "SPV_INTEL_subgroups" +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%voidfn = OpTypeFunction %void +%zero = OpConstant %uint 0 +%main = OpFunction %void None %voidfn +%entry = OpLabel +%foo = OpSubgroupShuffleINTEL %uint %zero %zero +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode SubgroupShuffleINTEL requires one of these " + "capabilities: SubgroupShuffleINTEL")); +} + +TEST_F(ValidateCapability, + InstructionEnablingCapabilityEnabledByMissingExtension) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability SubgroupShuffleINTEL +; OpExtension "SPV_INTEL_subgroups" +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%voidfn = OpTypeFunction %void +%zero = OpConstant %uint 0 +%main = OpFunction %void None %voidfn +%entry = OpLabel +%foo = OpSubgroupShuffleINTEL %uint %zero %zero +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(SPV_ERROR_MISSING_EXTENSION, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("operand 5568 requires one of these extensions: " + "SPV_INTEL_subgroups")); +} + +TEST_F(ValidateCapability, + InstructionEnabledByCapabilityEnabledByPresentExtension) { + const std::string spirv = R"( +OpCapability Kernel +OpCapability Addresses +OpCapability SubgroupShuffleINTEL +OpExtension "SPV_INTEL_subgroups" +OpMemoryModel Physical32 OpenCL +OpEntryPoint Kernel %main "main" +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%voidfn = OpTypeFunction %void +%zero = OpConstant %uint 0 +%main = OpFunction %void None %voidfn +%entry = OpLabel +%foo = OpSubgroupShuffleINTEL %uint %zero %zero +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, SPV_ENV_UNIVERSAL_1_0); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)) + << getDiagnosticString(); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_cfg_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_cfg_test.cpp new file mode 100644 index 00000000000..045166925c3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_cfg_test.cpp @@ -0,0 +1,1848 @@ +// Copyright (c) 2015-2016 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. + +// Validation tests for Control Flow Graph + +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" + +#include "source/diagnostic.h" +#include "source/val/validate.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; + +using ValidateCFG = spvtest::ValidateBase; +using spvtest::ScopedContext; + +std::string nameOps() { return ""; } + +template +std::string nameOps(std::pair head, Args... names) { + return "OpName %" + head.first + " \"" + head.second + "\"\n" + + nameOps(names...); +} + +template +std::string nameOps(std::string head, Args... names) { + return "OpName %" + head + " \"" + head + "\"\n" + nameOps(names...); +} + +/// This class allows the easy creation of complex control flow without writing +/// SPIR-V. This class is used in the test cases below. +class Block { + std::string label_; + std::string body_; + SpvOp type_; + std::vector successors_; + + public: + /// Creates a Block with a given label + /// + /// @param[in]: label the label id of the block + /// @param[in]: type the branch instruciton that ends the block + explicit Block(std::string label, SpvOp type = SpvOpBranch) + : label_(label), body_(), type_(type), successors_() {} + + /// Sets the instructions which will appear in the body of the block + Block& SetBody(std::string body) { + body_ = body; + return *this; + } + + Block& AppendBody(std::string body) { + body_ += body; + return *this; + } + + /// Converts the block into a SPIR-V string + operator std::string() { + std::stringstream out; + out << std::setw(8) << "%" + label_ + " = OpLabel \n"; + if (!body_.empty()) { + out << body_; + } + + switch (type_) { + case SpvOpBranchConditional: + out << "OpBranchConditional %cond "; + for (Block& b : successors_) { + out << "%" + b.label_ + " "; + } + break; + case SpvOpSwitch: { + out << "OpSwitch %one %" + successors_.front().label_; + std::stringstream ss; + for (size_t i = 1; i < successors_.size(); i++) { + ss << " " << i << " %" << successors_[i].label_; + } + out << ss.str(); + } break; + case SpvOpReturn: + assert(successors_.size() == 0); + out << "OpReturn\n"; + break; + case SpvOpUnreachable: + assert(successors_.size() == 0); + out << "OpUnreachable\n"; + break; + case SpvOpBranch: + assert(successors_.size() == 1); + out << "OpBranch %" + successors_.front().label_; + break; + default: + assert(1 == 0 && "Unhandled"); + } + out << "\n"; + + return out.str(); + } + friend Block& operator>>(Block& curr, std::vector successors); + friend Block& operator>>(Block& lhs, Block& successor); +}; + +/// Assigns the successors for the Block on the lhs +Block& operator>>(Block& lhs, std::vector successors) { + if (lhs.type_ == SpvOpBranchConditional) { + assert(successors.size() == 2); + } else if (lhs.type_ == SpvOpSwitch) { + assert(successors.size() > 1); + } + lhs.successors_ = successors; + return lhs; +} + +/// Assigns the successor for the Block on the lhs +Block& operator>>(Block& lhs, Block& successor) { + assert(lhs.type_ == SpvOpBranch); + lhs.successors_.push_back(successor); + return lhs; +} + +const char* header(SpvCapability cap) { + static const char* shader_header = + "OpCapability Shader\n" + "OpCapability Linkage\n" + "OpMemoryModel Logical GLSL450\n"; + + static const char* kernel_header = + "OpCapability Kernel\n" + "OpCapability Linkage\n" + "OpMemoryModel Logical OpenCL\n"; + + return (cap == SpvCapabilityShader) ? shader_header : kernel_header; +} + +const char* types_consts() { + static const char* types = + "%voidt = OpTypeVoid\n" + "%boolt = OpTypeBool\n" + "%intt = OpTypeInt 32 0\n" + "%one = OpConstant %intt 1\n" + "%two = OpConstant %intt 2\n" + "%ptrt = OpTypePointer Function %intt\n" + "%funct = OpTypeFunction %voidt\n"; + + return types; +} + +INSTANTIATE_TEST_CASE_P(StructuredControlFlow, ValidateCFG, + ::testing::Values(SpvCapabilityShader, + SpvCapabilityKernel)); + +TEST_P(ValidateCFG, LoopReachableFromEntryButNeverLeadingToReturn) { + // In this case, the loop is reachable from a node without a predecessor, + // but never reaches a node with a return. + // + // This motivates the need for the pseudo-exit node to have a node + // from a cycle in its predecessors list. Otherwise the validator's + // post-dominance calculation will go into an infinite loop. + // + // For more motivation, see + // https://github.com/KhronosGroup/SPIRV-Tools/issues/279 + std::string str = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + + OpName %entry "entry" + OpName %loop "loop" + OpName %exit "exit" + +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt + +%main = OpFunction %voidt None %funct +%entry = OpLabel + OpBranch %loop +%loop = OpLabel + OpLoopMerge %exit %loop None + OpBranch %loop +%exit = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()) << str; +} + +TEST_P(ValidateCFG, LoopUnreachableFromEntryButLeadingToReturn) { + // In this case, the loop is not reachable from a node without a + // predecessor, but eventually reaches a node with a return. + // + // This motivates the need for the pseudo-entry node to have a node + // from a cycle in its successors list. Otherwise the validator's + // dominance calculation will go into an infinite loop. + // + // For more motivation, see + // https://github.com/KhronosGroup/SPIRV-Tools/issues/279 + // Before that fix, we'd have an infinite loop when calculating + // post-dominators. + std::string str = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + + OpName %entry "entry" + OpName %loop "loop" + OpName %cont "cont" + OpName %exit "exit" + +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%boolt = OpTypeBool +%false = OpConstantFalse %boolt + +%main = OpFunction %voidt None %funct +%entry = OpLabel + OpReturn + +%loop = OpLabel + OpLoopMerge %exit %cont None + OpBranch %cont + +%cont = OpLabel + OpBranchConditional %false %loop %exit + +%exit = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()) + << str << getDiagnosticString(); +} + +TEST_P(ValidateCFG, Simple) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block cont("cont"); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + loop.SetBody("OpLoopMerge %merge %cont None\n"); + } + + std::string str = header(GetParam()) + + nameOps("loop", "entry", "cont", "merge", + std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({cont, merge}); + str += cont >> loop; + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, Variable) { + Block entry("entry"); + Block cont("cont"); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%var = OpVariable %ptrt Function\n"); + + std::string str = header(GetParam()) + + nameOps(std::make_pair("func", "Main")) + types_consts() + + " %func = OpFunction %voidt None %funct\n"; + str += entry >> cont; + str += cont >> exit; + str += exit; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, VariableNotInFirstBlockBad) { + Block entry("entry"); + Block cont("cont"); + Block exit("exit", SpvOpReturn); + + // This operation should only be performed in the entry block + cont.SetBody("%var = OpVariable %ptrt Function\n"); + + std::string str = header(GetParam()) + + nameOps(std::make_pair("func", "Main")) + types_consts() + + " %func = OpFunction %voidt None %funct\n"; + + str += entry >> cont; + str += cont >> exit; + str += exit; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Variables can only be defined in the first block of a function")); +} + +TEST_P(ValidateCFG, BlockSelfLoopIsOk) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.SetBody("OpLoopMerge %merge %loop None\n"); + + std::string str = header(GetParam()) + + nameOps("loop", "merge", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + // loop branches to itself, but does not trigger an error. + str += loop >> std::vector({merge, loop}); + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_P(ValidateCFG, BlockAppearsBeforeDominatorBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block cont("cont"); + Block branch("branch", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) branch.SetBody("OpSelectionMerge %merge None\n"); + + std::string str = header(GetParam()) + + nameOps("cont", "branch", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> branch; + str += cont >> merge; // cont appears before its dominator + str += branch >> std::vector({cont, merge}); + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("Block .\\[cont\\] appears in the binary " + "before its dominator .\\[branch\\]\n" + " %branch = OpLabel\n")); +} + +TEST_P(ValidateCFG, MergeBlockTargetedByMultipleHeaderBlocksBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop"); + Block selection("selection", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.SetBody(" OpLoopMerge %merge %loop None\n"); + + // cannot share the same merge + if (is_shader) selection.SetBody("OpSelectionMerge %merge None\n"); + + std::string str = + header(GetParam()) + nameOps("merge", std::make_pair("func", "Main")) + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> selection; + str += selection >> std::vector({loop, merge}); + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("Block .\\[merge\\] is already a merge block " + "for another header\n" + " %Main = OpFunction %void None %9\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, MergeBlockTargetedByMultipleHeaderBlocksSelectionBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block selection("selection", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) selection.SetBody(" OpSelectionMerge %merge None\n"); + + // cannot share the same merge + if (is_shader) loop.SetBody(" OpLoopMerge %merge %loop None\n"); + + std::string str = + header(GetParam()) + nameOps("merge", std::make_pair("func", "Main")) + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> selection; + str += selection >> std::vector({merge, loop}); + str += loop >> std::vector({loop, merge}); + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("Block .\\[merge\\] is already a merge block " + "for another header\n" + " %Main = OpFunction %void None %9\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, BranchTargetFirstBlockBadSinceEntryBlock) { + Block entry("entry"); + Block bad("bad"); + Block end("end", SpvOpReturn); + std::string str = header(GetParam()) + + nameOps("entry", "bad", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> bad; + str += bad >> entry; // Cannot target entry block + str += end; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("First block .\\[entry\\] of function .\\[Main\\] " + "is targeted by block .\\[bad\\]\n" + " %Main = OpFunction %void None %10\n")); +} + +TEST_P(ValidateCFG, BranchTargetFirstBlockBadSinceValue) { + Block entry("entry"); + entry.SetBody("%undef = OpUndef %voidt\n"); + Block bad("bad"); + Block end("end", SpvOpReturn); + Block badvalue("undef"); // This referenes the OpUndef. + std::string str = header(GetParam()) + + nameOps("entry", "bad", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> bad; + str += + bad >> badvalue; // Check branch to a function value (it's not a block!) + str += end; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("Block\\(s\\) \\{..\\} are referenced but not " + "defined in function .\\[Main\\]\n" + " %Main = OpFunction %void None %10\n")) + << str; +} + +TEST_P(ValidateCFG, BranchConditionalTrueTargetFirstBlockBad) { + Block entry("entry"); + Block bad("bad", SpvOpBranchConditional); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + bad.SetBody(" OpLoopMerge %entry %exit None\n"); + + std::string str = header(GetParam()) + + nameOps("entry", "bad", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> bad; + str += bad >> std::vector({entry, exit}); // cannot target entry block + str += exit; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("First block .\\[entry\\] of function .\\[Main\\] " + "is targeted by block .\\[bad\\]\n" + " %Main = OpFunction %void None %10\n")); +} + +TEST_P(ValidateCFG, BranchConditionalFalseTargetFirstBlockBad) { + Block entry("entry"); + Block bad("bad", SpvOpBranchConditional); + Block t("t"); + Block merge("merge"); + Block end("end", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + bad.SetBody("OpLoopMerge %merge %cont None\n"); + + std::string str = header(GetParam()) + + nameOps("entry", "bad", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> bad; + str += bad >> std::vector({t, entry}); + str += merge >> end; + str += end; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("First block .\\[entry\\] of function .\\[Main\\] " + "is targeted by block .\\[bad\\]\n" + " %Main = OpFunction %void None %10\n")); +} + +TEST_P(ValidateCFG, SwitchTargetFirstBlockBad) { + Block entry("entry"); + Block bad("bad", SpvOpSwitch); + Block block1("block1"); + Block block2("block2"); + Block block3("block3"); + Block def("def"); // default block + Block merge("merge"); + Block end("end", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + bad.SetBody("OpSelectionMerge %merge None\n"); + + std::string str = header(GetParam()) + + nameOps("entry", "bad", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> bad; + str += bad >> std::vector({def, block1, block2, block3, entry}); + str += def >> merge; + str += block1 >> merge; + str += block2 >> merge; + str += block3 >> merge; + str += merge >> end; + str += end; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("First block .\\[entry\\] of function .\\[Main\\] " + "is targeted by block .\\[bad\\]\n" + " %Main = OpFunction %void None %10\n")); +} + +TEST_P(ValidateCFG, BranchToBlockInOtherFunctionBad) { + Block entry("entry"); + Block middle("middle", SpvOpBranchConditional); + Block end("end", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + middle.SetBody("OpSelectionMerge %end None\n"); + + Block entry2("entry2"); + Block middle2("middle2"); + Block end2("end2", SpvOpReturn); + + std::string str = + header(GetParam()) + nameOps("middle2", std::make_pair("func", "Main")) + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> middle; + str += middle >> std::vector({end, middle2}); + str += end; + str += "OpFunctionEnd\n"; + + str += "%func2 = OpFunction %voidt None %funct\n"; + str += entry2 >> middle2; + str += middle2 >> end2; + str += end2; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("Block\\(s\\) \\{.\\[middle2\\]\\} are referenced but not " + "defined in function .\\[Main\\]\n" + " %Main = OpFunction %void None %9\n")); +} + +TEST_P(ValidateCFG, HeaderDoesntDominatesMergeBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block head("head", SpvOpBranchConditional); + Block f("f"); + Block merge("merge", SpvOpReturn); + + head.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + + if (is_shader) head.AppendBody("OpSelectionMerge %merge None\n"); + + std::string str = header(GetParam()) + + nameOps("head", "merge", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> merge; + str += head >> std::vector({merge, f}); + str += f >> merge; + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("The selection construct with the selection header " + ".\\[head\\] does not dominate the merge block " + ".\\[merge\\]\n %merge = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, HeaderDoesntStrictlyDominateMergeBad) { + // If a merge block is reachable, then it must be strictly dominated by + // its header block. + bool is_shader = GetParam() == SpvCapabilityShader; + Block head("head", SpvOpBranchConditional); + Block exit("exit", SpvOpReturn); + + head.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + + if (is_shader) head.AppendBody("OpSelectionMerge %head None\n"); + + std::string str = header(GetParam()) + + nameOps("head", "exit", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += head >> std::vector({exit, exit}); + str += exit; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("The selection construct with the selection header " + ".\\[head\\] does not strictly dominate the merge block " + ".\\[head\\]\n %head = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()) << str; + } +} + +TEST_P(ValidateCFG, UnreachableMerge) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block branch("branch", SpvOpBranchConditional); + Block t("t", SpvOpReturn); + Block f("f", SpvOpReturn); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) branch.AppendBody("OpSelectionMerge %merge None\n"); + + std::string str = header(GetParam()) + + nameOps("branch", "merge", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> branch; + str += branch >> std::vector({t, f}); + str += t; + str += f; + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, UnreachableMergeDefinedByOpUnreachable) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block branch("branch", SpvOpBranchConditional); + Block t("t", SpvOpReturn); + Block f("f", SpvOpReturn); + Block merge("merge", SpvOpUnreachable); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) branch.AppendBody("OpSelectionMerge %merge None\n"); + + std::string str = header(GetParam()) + + nameOps("branch", "merge", std::make_pair("func", "Main")) + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> branch; + str += branch >> std::vector({t, f}); + str += t; + str += f; + str += merge; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, UnreachableBlock) { + Block entry("entry"); + Block unreachable("unreachable"); + Block exit("exit", SpvOpReturn); + + std::string str = + header(GetParam()) + + nameOps("unreachable", "exit", std::make_pair("func", "Main")) + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> exit; + str += unreachable >> exit; + str += exit; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, UnreachableBranch) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block unreachable("unreachable", SpvOpBranchConditional); + Block unreachablechildt("unreachablechildt"); + Block unreachablechildf("unreachablechildf"); + Block merge("merge"); + Block exit("exit", SpvOpReturn); + + unreachable.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) unreachable.AppendBody("OpSelectionMerge %merge None\n"); + std::string str = + header(GetParam()) + + nameOps("unreachable", "exit", std::make_pair("func", "Main")) + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> exit; + str += + unreachable >> std::vector({unreachablechildt, unreachablechildf}); + str += unreachablechildt >> merge; + str += unreachablechildf >> merge; + str += merge >> exit; + str += exit; + str += "OpFunctionEnd\n"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, EmptyFunction) { + std::string str = header(GetParam()) + std::string(types_consts()) + + R"(%func = OpFunction %voidt None %funct + %l = OpLabel + OpReturn + OpFunctionEnd)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, SingleBlockLoop) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.AppendBody("OpLoopMerge %exit %loop None\n"); + + std::string str = header(GetParam()) + std::string(types_consts()) + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({loop, exit}); + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, NestedLoops) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop1("loop1"); + Block loop1_cont_break_block("loop1_cont_break_block", + SpvOpBranchConditional); + Block loop2("loop2", SpvOpBranchConditional); + Block loop2_merge("loop2_merge"); + Block loop1_merge("loop1_merge"); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + loop1.SetBody("OpLoopMerge %loop1_merge %loop2 None\n"); + loop2.SetBody("OpLoopMerge %loop2_merge %loop2 None\n"); + } + + std::string str = header(GetParam()) + nameOps("loop2", "loop2_merge") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop1; + str += loop1 >> loop1_cont_break_block; + str += loop1_cont_break_block >> std::vector({loop1_merge, loop2}); + str += loop2 >> std::vector({loop2, loop2_merge}); + str += loop2_merge >> loop1; + str += loop1_merge >> exit; + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, NestedSelection) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + const int N = 256; + std::vector if_blocks; + std::vector merge_blocks; + Block inner("inner"); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + + if_blocks.emplace_back("if0", SpvOpBranchConditional); + + if (is_shader) if_blocks[0].SetBody("OpSelectionMerge %if_merge0 None\n"); + merge_blocks.emplace_back("if_merge0", SpvOpReturn); + + for (int i = 1; i < N; i++) { + std::stringstream ss; + ss << i; + if_blocks.emplace_back("if" + ss.str(), SpvOpBranchConditional); + if (is_shader) + if_blocks[i].SetBody("OpSelectionMerge %if_merge" + ss.str() + " None\n"); + merge_blocks.emplace_back("if_merge" + ss.str(), SpvOpBranch); + } + std::string str = header(GetParam()) + std::string(types_consts()) + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> if_blocks[0]; + for (int i = 0; i < N - 1; i++) { + str += + if_blocks[i] >> std::vector({if_blocks[i + 1], merge_blocks[i]}); + } + str += if_blocks.back() >> std::vector({inner, merge_blocks.back()}); + str += inner >> merge_blocks.back(); + for (int i = N - 1; i > 0; i--) { + str += merge_blocks[i] >> merge_blocks[i - 1]; + } + str += merge_blocks[0]; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateCFG, BackEdgeBlockDoesntPostDominateContinueTargetBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop1("loop1", SpvOpBranchConditional); + Block loop2("loop2", SpvOpBranchConditional); + Block loop2_merge("loop2_merge", SpvOpBranchConditional); + Block be_block("be_block"); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + loop1.SetBody("OpLoopMerge %exit %loop2_merge None\n"); + loop2.SetBody("OpLoopMerge %loop2_merge %loop2 None\n"); + } + + std::string str = header(GetParam()) + + nameOps("loop1", "loop2", "be_block", "loop2_merge") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop1; + str += loop1 >> std::vector({loop2, exit}); + str += loop2 >> std::vector({loop2, loop2_merge}); + str += loop2_merge >> std::vector({be_block, exit}); + str += be_block >> loop1; + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (GetParam() == SpvCapabilityShader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("The continue construct with the continue target " + ".\\[loop2_merge\\] is not post dominated by the " + "back-edge block .\\[be_block\\]\n" + " %be_block = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, BranchingToNonLoopHeaderBlockBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block split("split", SpvOpBranchConditional); + Block t("t"); + Block f("f"); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) split.SetBody("OpSelectionMerge %exit None\n"); + + std::string str = header(GetParam()) + nameOps("split", "f") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> split; + str += split >> std::vector({t, f}); + str += t >> exit; + str += f >> split; + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("Back-edges \\(.\\[f\\] -> .\\[split\\]\\) can only " + "be formed between a block and a loop header.\n" + " %f = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, BranchingToSameNonLoopHeaderBlockBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block split("split", SpvOpBranchConditional); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) split.SetBody("OpSelectionMerge %exit None\n"); + + std::string str = header(GetParam()) + nameOps("split") + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> split; + str += split >> std::vector({split, exit}); + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex( + "Back-edges \\(.\\[split\\] -> .\\[split\\]\\) can only be " + "formed between a block and a loop header.\n" + " %split = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, MultipleBackEdgeBlocksToLoopHeaderBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block back0("back0"); + Block back1("back1"); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.SetBody("OpLoopMerge %merge %back0 None\n"); + + std::string str = header(GetParam()) + nameOps("loop", "back0", "back1") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({back0, back1}); + str += back0 >> loop; + str += back1 >> loop; + str += merge; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex( + "Loop header .\\[loop\\] is targeted by 2 back-edge blocks " + "but the standard requires exactly one\n" + " %loop = OpLabel\n")) + << str; + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, ContinueTargetMustBePostDominatedByBackEdge) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block cheader("cheader", SpvOpBranchConditional); + Block be_block("be_block"); + Block merge("merge", SpvOpReturn); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.SetBody("OpLoopMerge %merge %cheader None\n"); + + std::string str = header(GetParam()) + nameOps("cheader", "be_block") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({cheader, merge}); + str += cheader >> std::vector({exit, be_block}); + str += exit; // Branches out of a continue construct + str += be_block >> loop; + str += merge; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("The continue construct with the continue target " + ".\\[cheader\\] is not post dominated by the " + "back-edge block .\\[be_block\\]\n" + " %be_block = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, BranchOutOfConstructToMergeBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block cont("cont", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.SetBody("OpLoopMerge %merge %loop None\n"); + + std::string str = header(GetParam()) + nameOps("cont", "loop") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({cont, merge}); + str += cont >> std::vector({loop, merge}); + str += merge; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("The continue construct with the continue target " + ".\\[loop\\] is not post dominated by the " + "back-edge block .\\[cont\\]\n" + " %cont = OpLabel\n")) + << str; + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_P(ValidateCFG, BranchOutOfConstructBad) { + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block cont("cont", SpvOpBranchConditional); + Block merge("merge"); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) loop.SetBody("OpLoopMerge %merge %loop None\n"); + + std::string str = header(GetParam()) + nameOps("cont", "loop") + + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({cont, merge}); + str += cont >> std::vector({loop, exit}); + str += merge >> exit; + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + if (is_shader) { + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("The continue construct with the continue target " + ".\\[loop\\] is not post dominated by the " + "back-edge block .\\[cont\\]\n" + " %cont = OpLabel\n")); + } else { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } +} + +TEST_F(ValidateCFG, OpSwitchToUnreachableBlock) { + Block entry("entry", SpvOpSwitch); + Block case0("case0"); + Block case1("case1"); + Block case2("case2"); + Block def("default", SpvOpUnreachable); + Block phi("phi", SpvOpReturn); + + std::string str = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint GLCompute %main "main" %id +OpExecutionMode %main LocalSize 1 1 1 +OpSource GLSL 430 +OpName %main "main" +OpDecorate %id BuiltIn GlobalInvocationId +%void = OpTypeVoid +%voidf = OpTypeFunction %void +%u32 = OpTypeInt 32 0 +%f32 = OpTypeFloat 32 +%uvec3 = OpTypeVector %u32 3 +%fvec3 = OpTypeVector %f32 3 +%uvec3ptr = OpTypePointer Input %uvec3 +%id = OpVariable %uvec3ptr Input +%one = OpConstant %u32 1 +%three = OpConstant %u32 3 +%main = OpFunction %void None %voidf +)"; + + entry.SetBody( + "%idval = OpLoad %uvec3 %id\n" + "%x = OpCompositeExtract %u32 %idval 0\n" + "%selector = OpUMod %u32 %x %three\n" + "OpSelectionMerge %phi None\n"); + str += entry >> std::vector({def, case0, case1, case2}); + str += case1 >> phi; + str += def; + str += phi; + str += case0 >> phi; + str += case2 >> phi; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCFG, LoopWithZeroBackEdgesBad) { + std::string str = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpName %loop "loop" +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%main = OpFunction %voidt None %funct +%loop = OpLabel + OpLoopMerge %exit %exit None + OpBranch %exit +%exit = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("Loop header .\\[loop\\] is targeted by " + "0 back-edge blocks but the standard requires exactly " + "one\n %loop = OpLabel\n")); +} + +TEST_F(ValidateCFG, LoopWithBackEdgeFromUnreachableContinueConstructGood) { + std::string str = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpName %loop "loop" +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%floatt = OpTypeFloat 32 +%boolt = OpTypeBool +%one = OpConstant %floatt 1 +%two = OpConstant %floatt 2 +%main = OpFunction %voidt None %funct +%entry = OpLabel + OpBranch %loop +%loop = OpLabel + OpLoopMerge %exit %cont None + OpBranch %16 +%16 = OpLabel +%cond = OpFOrdLessThan %boolt %one %two + OpBranchConditional %cond %body %exit +%body = OpLabel + OpReturn +%cont = OpLabel ; Reachable only from OpLoopMerge ContinueTarget parameter + OpBranch %loop ; Should be considered a back-edge +%exit = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_P(ValidateCFG, + NestedConstructWithUnreachableMergeBlockBranchingToOuterMergeBlock) { + // Test for https://github.com/KhronosGroup/SPIRV-Tools/issues/297 + // The nested construct has an unreachable merge block. In the + // augmented CFG that merge block + // we still determine that the + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry", SpvOpBranchConditional); + Block inner_head("inner_head", SpvOpBranchConditional); + Block inner_true("inner_true", SpvOpReturn); + Block inner_false("inner_false", SpvOpReturn); + Block inner_merge("inner_merge"); + Block exit("exit", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + entry.AppendBody("OpSelectionMerge %exit None\n"); + inner_head.SetBody("OpSelectionMerge %inner_merge None\n"); + } + + std::string str = header(GetParam()) + + nameOps("entry", "inner_merge", "exit") + types_consts() + + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> std::vector({inner_head, exit}); + str += inner_head >> std::vector({inner_true, inner_false}); + str += inner_true; + str += inner_false; + str += inner_merge >> exit; + str += exit; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_P(ValidateCFG, ContinueTargetCanBeMergeBlockForNestedStructureGood) { + // This example is valid. It shows that the validator can't just add + // an edge from the loop head to the continue target. If that edge + // is added, then the "if_merge" block is both the continue target + // for the loop and also the merge block for the nested selection, but + // then it wouldn't be dominated by "if_head", the header block for the + // nested selection. + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop"); + Block if_head("if_head", SpvOpBranchConditional); + Block if_true("if_true"); + Block if_merge("if_merge", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + loop.SetBody("OpLoopMerge %merge %if_merge None\n"); + if_head.SetBody("OpSelectionMerge %if_merge None\n"); + } + + std::string str = + header(GetParam()) + + nameOps("entry", "loop", "if_head", "if_true", "if_merge", "merge") + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> if_head; + str += if_head >> std::vector({if_true, if_merge}); + str += if_true >> if_merge; + str += if_merge >> std::vector({loop, merge}); + str += merge; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_P(ValidateCFG, SingleLatchBlockMultipleBranchesToLoopHeader) { + // This test case ensures we allow both branches of a loop latch block + // to go back to the loop header. It still counts as a single back edge. + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop", SpvOpBranchConditional); + Block latch("latch", SpvOpBranchConditional); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + loop.SetBody("OpLoopMerge %merge %latch None\n"); + } + + std::string str = + header(GetParam()) + nameOps("entry", "loop", "latch", "merge") + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> std::vector({latch, merge}); + str += latch >> std::vector({loop, loop}); // This is the key + str += merge; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) + << str << getDiagnosticString(); +} + +TEST_P(ValidateCFG, SingleLatchBlockHeaderContinueTargetIsItselfGood) { + // This test case ensures we don't count a Continue Target from a loop + // header to itself as a self-loop when computing back edges. + // Also, it detects that there is an edge from %latch to the pseudo-exit + // node, rather than from %loop. In particular, it detects that we + // have used the *reverse* textual order of blocks when computing + // predecessor traversal roots. + bool is_shader = GetParam() == SpvCapabilityShader; + Block entry("entry"); + Block loop("loop"); + Block latch("latch"); + Block merge("merge", SpvOpReturn); + + entry.SetBody("%cond = OpSLessThan %boolt %one %two\n"); + if (is_shader) { + loop.SetBody("OpLoopMerge %merge %loop None\n"); + } + + std::string str = + header(GetParam()) + nameOps("entry", "loop", "latch", "merge") + + types_consts() + "%func = OpFunction %voidt None %funct\n"; + + str += entry >> loop; + str += loop >> latch; + str += latch >> loop; + str += merge; + str += "OpFunctionEnd"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) + << str << getDiagnosticString(); +} + +// Unit test to check the case where a basic block is the entry block of 2 +// different constructs. In this case, the basic block is the entry block of a +// continue construct as well as a selection construct. See issue# 517 for more +// details. +TEST_F(ValidateCFG, BasicBlockIsEntryBlockOfTwoConstructsGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %void = OpTypeVoid + %bool = OpTypeBool + %int = OpTypeInt 32 1 + %void_func = OpTypeFunction %void + %int_0 = OpConstant %int 0 + %testfun = OpFunction %void None %void_func + %label_1 = OpLabel + OpBranch %start + %start = OpLabel + %cond = OpSLessThan %bool %int_0 %int_0 + ; + ; Note: In this case, the "target" block is both the entry block of + ; the continue construct of the loop as well as the entry block of + ; the selection construct. + ; + OpLoopMerge %loop_merge %target None + OpBranchConditional %cond %target %loop_merge + %loop_merge = OpLabel + OpReturn + %target = OpLabel + OpSelectionMerge %selection_merge None + OpBranchConditional %cond %do_stuff %do_other_stuff + %do_other_stuff = OpLabel + OpBranch %selection_merge + %selection_merge = OpLabel + OpBranch %start + %do_stuff = OpLabel + OpBranch %selection_merge + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCFG, OpReturnInNonVoidFunc) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %int = OpTypeInt 32 1 + %int_func = OpTypeFunction %int + %testfun = OpFunction %int None %int_func + %label_1 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpReturn can only be called from a function with void return type.\n" + " OpReturn")); +} + +TEST_F(ValidateCFG, StructuredCFGBranchIntoSelectionBody) { + std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%entry = OpLabel +OpSelectionMerge %merge None +OpBranchConditional %true %then %merge +%merge = OpLabel +OpBranch %then +%then = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("branches to the selection construct, but not to the " + "selection header 6\n %7 = OpLabel")); +} + +TEST_F(ValidateCFG, SwitchDefaultOnly) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpFunction %1 None %4 +%6 = OpLabel +OpSelectionMerge %7 None +OpSwitch %3 %7 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCFG, SwitchSingleCase) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpFunction %1 None %4 +%6 = OpLabel +OpSelectionMerge %7 None +OpSwitch %3 %7 0 %8 +%8 = OpLabel +OpBranch %7 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCFG, MultipleFallThroughBlocks) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %11 1 %12 +%10 = OpLabel +OpBranchConditional %6 %11 %12 +%11 = OpLabel +OpBranch %9 +%12 = OpLabel +OpBranch %9 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Case construct that targets 10 has branches to multiple other case " + "construct targets 12 and 11\n %10 = OpLabel")); +} + +TEST_F(ValidateCFG, MultipleFallThroughToDefault) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %11 1 %12 +%10 = OpLabel +OpBranch %9 +%11 = OpLabel +OpBranch %10 +%12 = OpLabel +OpBranch %10 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Multiple case constructs have branches to the case construct " + "that targets 10\n %10 = OpLabel")); +} + +TEST_F(ValidateCFG, MultipleFallThroughToNonDefault) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %11 1 %12 +%10 = OpLabel +OpBranch %12 +%11 = OpLabel +OpBranch %12 +%12 = OpLabel +OpBranch %9 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Multiple case constructs have branches to the case construct " + "that targets 12\n %12 = OpLabel")); +} + +TEST_F(ValidateCFG, DuplicateTargetWithFallThrough) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %10 1 %11 +%10 = OpLabel +OpBranch %11 +%11 = OpLabel +OpBranch %9 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateCFG, WrongOperandList) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %11 1 %12 +%10 = OpLabel +OpBranch %9 +%12 = OpLabel +OpBranch %11 +%11 = OpLabel +OpBranch %9 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Case construct that targets 12 has branches to the case " + "construct that targets 11, but does not immediately " + "precede it in the OpSwitch's target list\n" + " OpSwitch %uint_0 %10 0 %11 1 %12")); +} + +TEST_F(ValidateCFG, WrongOperandListThroughDefault) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %11 1 %12 +%10 = OpLabel +OpBranch %11 +%12 = OpLabel +OpBranch %10 +%11 = OpLabel +OpBranch %9 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Case construct that targets 12 has branches to the case " + "construct that targets 11, but does not immediately " + "precede it in the OpSwitch's target list\n" + " OpSwitch %uint_0 %10 0 %11 1 %12")); +} + +TEST_F(ValidateCFG, WrongOperandListNotLast) { + std::string text = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpTypeBool +%6 = OpConstantTrue %5 +%7 = OpFunction %1 None %4 +%8 = OpLabel +OpSelectionMerge %9 None +OpSwitch %3 %10 0 %11 1 %12 2 %13 +%10 = OpLabel +OpBranch %9 +%12 = OpLabel +OpBranch %11 +%11 = OpLabel +OpBranch %9 +%13 = OpLabel +OpBranch %9 +%9 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Case construct that targets 12 has branches to the case " + "construct that targets 11, but does not immediately " + "precede it in the OpSwitch's target list\n" + " OpSwitch %uint_0 %10 0 %11 1 %12 2 %13")); +} + +TEST_F(ValidateCFG, InvalidCaseExit) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypeFunction %2 +%5 = OpConstant %3 0 +%1 = OpFunction %2 None %4 +%6 = OpLabel +OpSelectionMerge %7 None +OpSwitch %5 %7 0 %8 1 %9 +%8 = OpLabel +OpBranch %10 +%9 = OpLabel +OpBranch %10 +%10 = OpLabel +OpReturn +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Case construct that targets 8 has invalid branch to " + "block 10 (not another case construct, corresponding " + "merge, outer loop merge or outer loop continue")); +} + +TEST_F(ValidateCFG, GoodCaseExitsToOuterConstructs) { + const std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%bool = OpTypeBool +%true = OpConstantTrue %bool +%int = OpTypeInt 32 0 +%int0 = OpConstant %int 0 +%func_ty = OpTypeFunction %void +%func = OpFunction %void None %func_ty +%1 = OpLabel +OpBranch %2 +%2 = OpLabel +OpLoopMerge %7 %6 None +OpBranch %3 +%3 = OpLabel +OpSelectionMerge %5 None +OpSwitch %int0 %5 0 %4 +%4 = OpLabel +OpBranchConditional %true %6 %7 +%5 = OpLabel +OpBranchConditional %true %6 %7 +%6 = OpLabel +OpBranch %2 +%7 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +/// TODO(umar): Nested CFG constructs + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_composites_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_composites_test.cpp new file mode 100644 index 00000000000..063626d1da1 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_composites_test.cpp @@ -0,0 +1,1472 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateComposites = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& execution_model = "Fragment") { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability Float64 +)"; + + ss << capabilities_and_extensions; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f32vec2 = OpTypeVector %f32 2 +%f32vec3 = OpTypeVector %f32 3 +%f32vec4 = OpTypeVector %f32 4 +%f64vec2 = OpTypeVector %f64 2 +%u32vec2 = OpTypeVector %u32 2 +%u32vec4 = OpTypeVector %u32 4 +%f64mat22 = OpTypeMatrix %f64vec2 2 +%f32mat22 = OpTypeMatrix %f32vec2 2 +%f32mat23 = OpTypeMatrix %f32vec2 3 +%f32mat32 = OpTypeMatrix %f32vec3 2 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 + +%f32mat22_1212 = OpConstantComposite %f32mat22 %f32vec2_12 %f32vec2_12 +%f32mat23_121212 = OpConstantComposite %f32mat23 %f32vec2_12 %f32vec2_12 %f32vec2_12 + +%f32vec2arr3 = OpTypeArray %f32vec2 %u32_3 +%f32vec2rarr = OpTypeRuntimeArray %f32vec2 + +%f32u32struct = OpTypeStruct %f32 %u32 +%big_struct = OpTypeStruct %f32 %f32vec4 %f32mat23 %f32vec2arr3 %f32vec2rarr %f32u32struct + +%ptr_big_struct = OpTypePointer Uniform %big_struct +%var_big_struct = OpVariable %ptr_big_struct Uniform + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +// Returns header for legacy tests taken from val_id_test.cpp. +std::string GetHeaderForTestsFromValId() { + return R"( +OpCapability Shader +OpCapability Linkage +OpCapability Addresses +OpCapability Pipes +OpCapability LiteralSampler +OpCapability DeviceEnqueue +OpCapability Vector16 +OpCapability Int8 +OpCapability Int16 +OpCapability Int64 +OpCapability Float64 +OpMemoryModel Logical GLSL450 +%void = OpTypeVoid +%void_f = OpTypeFunction %void +%int = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v3float = OpTypeVector %float 3 +%mat4x3 = OpTypeMatrix %v3float 4 +%_ptr_Private_mat4x3 = OpTypePointer Private %mat4x3 +%_ptr_Private_float = OpTypePointer Private %float +%my_matrix = OpVariable %_ptr_Private_mat4x3 Private +%my_float_var = OpVariable %_ptr_Private_float Private +%_ptr_Function_float = OpTypePointer Function %float +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_5 = OpConstant %int 5 + +; Making the following nested structures. +; +; struct S { +; bool b; +; vec4 v[5]; +; int i; +; mat4x3 m[5]; +; } +; uniform blockName { +; S s; +; bool cond; +; RunTimeArray arr; +; } + +%f32arr = OpTypeRuntimeArray %float +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%array5_mat4x3 = OpTypeArray %mat4x3 %int_5 +%array5_vec4 = OpTypeArray %v4float %int_5 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_vec4 = OpTypePointer Function %v4float +%_ptr_Uniform_vec4 = OpTypePointer Uniform %v4float +%struct_s = OpTypeStruct %bool %array5_vec4 %int %array5_mat4x3 +%struct_blockName = OpTypeStruct %struct_s %bool %f32arr +%_ptr_Uniform_blockName = OpTypePointer Uniform %struct_blockName +%_ptr_Uniform_struct_s = OpTypePointer Uniform %struct_s +%_ptr_Uniform_array5_mat4x3 = OpTypePointer Uniform %array5_mat4x3 +%_ptr_Uniform_mat4x3 = OpTypePointer Uniform %mat4x3 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%blockName_var = OpVariable %_ptr_Uniform_blockName Uniform +%spec_int = OpSpecConstant %int 2 +%func = OpFunction %void None %void_f +%my_label = OpLabel +)"; +} + +TEST_F(ValidateComposites, VectorExtractDynamicSuccess) { + const std::string body = R"( +%val1 = OpVectorExtractDynamic %f32 %f32vec4_0123 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, VectorExtractDynamicWrongResultType) { + const std::string body = R"( +%val1 = OpVectorExtractDynamic %f32vec4 %f32vec4_0123 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a scalar type")); +} + +TEST_F(ValidateComposites, VectorExtractDynamicNotVector) { + const std::string body = R"( +%val1 = OpVectorExtractDynamic %f32 %f32mat22_1212 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Vector type to be OpTypeVector")); +} + +TEST_F(ValidateComposites, VectorExtractDynamicWrongVectorComponent) { + const std::string body = R"( +%val1 = OpVectorExtractDynamic %f32 %u32vec4_0123 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Vector component type to be equal to Result Type")); +} + +TEST_F(ValidateComposites, VectorExtractDynamicWrongIndexType) { + const std::string body = R"( +%val1 = OpVectorExtractDynamic %f32 %f32vec4_0123 %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Index to be int scalar")); +} + +TEST_F(ValidateComposites, VectorInsertDynamicSuccess) { + const std::string body = R"( +%val1 = OpVectorInsertDynamic %f32vec4 %f32vec4_0123 %f32_1 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, VectorInsertDynamicWrongResultType) { + const std::string body = R"( +%val1 = OpVectorInsertDynamic %f32 %f32vec4_0123 %f32_1 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeVector")); +} + +TEST_F(ValidateComposites, VectorInsertDynamicNotVector) { + const std::string body = R"( +%val1 = OpVectorInsertDynamic %f32vec4 %f32mat22_1212 %f32_1 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Vector type to be equal to Result Type")); +} + +TEST_F(ValidateComposites, VectorInsertDynamicWrongComponentType) { + const std::string body = R"( +%val1 = OpVectorInsertDynamic %f32vec4 %f32vec4_0123 %u32_1 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Component type to be equal to Result Type " + "component type")); +} + +TEST_F(ValidateComposites, VectorInsertDynamicWrongIndexType) { + const std::string body = R"( +%val1 = OpVectorInsertDynamic %f32vec4 %f32vec4_0123 %f32_1 %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Index to be int scalar")); +} + +TEST_F(ValidateComposites, CompositeConstructNotComposite) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a composite type")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorSuccess) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec2_12 %f32vec2_12 +%val2 = OpCompositeConstruct %f32vec4 %f32vec2_12 %f32_0 %f32_0 +%val3 = OpCompositeConstruct %f32vec4 %f32_0 %f32_0 %f32vec2_12 +%val4 = OpCompositeConstruct %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CompositeConstructVectorOnlyOneConstituent) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected number of constituents to be at least 2")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituent1) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Constituents to be scalars or vectors of the same " + "type as Result Type components")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituent2) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec2_12 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Constituents to be scalars or vectors of the same " + "type as Result Type components")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituent3) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec2_12 %u32_0 %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Constituents to be scalars or vectors of the same " + "type as Result Type components")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongComponentNumber1) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec2_12 %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of given components to be equal to the " + "size of Result Type vector")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongComponentNumber2) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec4 %f32vec2_12 %f32vec2_12 %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of given components to be equal to the " + "size of Result Type vector")); +} + +TEST_F(ValidateComposites, CompositeConstructMatrixSuccess) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32mat22 %f32vec2_12 %f32vec2_12 +%val2 = OpCompositeConstruct %f32mat23 %f32vec2_12 %f32vec2_12 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituentNumber1) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32mat22 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of Constituents to be equal to the " + "number of columns of Result Type matrix")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituentNumber2) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32mat22 %f32vec2_12 %f32vec2_12 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of Constituents to be equal to the " + "number of columns of Result Type matrix")); +} + +TEST_F(ValidateComposites, CompositeConstructVectorWrongConsituent) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32mat22 %f32vec2_12 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Constituent type to be equal to the column type " + "Result Type matrix")); +} + +TEST_F(ValidateComposites, CompositeConstructArraySuccess) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CompositeConstructArrayWrongConsituentNumber1) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of Constituents to be equal to the " + "number of elements of Result Type array")); +} + +TEST_F(ValidateComposites, CompositeConstructArrayWrongConsituentNumber2) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 %f32vec2_12 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of Constituents to be equal to the " + "number of elements of Result Type array")); +} + +TEST_F(ValidateComposites, CompositeConstructArrayWrongConsituent) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %u32vec2_01 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Constituent type to be equal to the column type " + "Result Type array")); +} + +TEST_F(ValidateComposites, CompositeConstructStructSuccess) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32u32struct %f32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CompositeConstructStructWrongConstituentNumber1) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32u32struct %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of Constituents to be equal to the " + "number of members of Result Type struct")); +} + +TEST_F(ValidateComposites, CompositeConstructStructWrongConstituentNumber2) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32u32struct %f32_0 %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected total number of Constituents to be equal to the " + "number of members of Result Type struct")); +} + +TEST_F(ValidateComposites, CompositeConstructStructWrongConstituent) { + const std::string body = R"( +%val1 = OpCompositeConstruct %f32u32struct %f32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Constituent type to be equal to the " + "corresponding member type of Result Type struct")); +} + +TEST_F(ValidateComposites, CopyObjectSuccess) { + const std::string body = R"( +%val1 = OpCopyObject %f32 %f32_0 +%val2 = OpCopyObject %f32vec4 %f32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CopyObjectResultTypeNotType) { + const std::string body = R"( +%val1 = OpCopyObject %f32_0 %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 19 is not a type id")); +} + +TEST_F(ValidateComposites, CopyObjectWrongOperandType) { + const std::string body = R"( +%val1 = OpCopyObject %f32 %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type and Operand type to be the same")); +} + +TEST_F(ValidateComposites, TransposeSuccess) { + const std::string body = R"( +%val1 = OpTranspose %f32mat32 %f32mat23_121212 +%val2 = OpTranspose %f32mat22 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, TransposeResultTypeNotMatrix) { + const std::string body = R"( +%val1 = OpTranspose %f32vec4 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a matrix type")); +} + +TEST_F(ValidateComposites, TransposeDifferentComponentTypes) { + const std::string body = R"( +%val1 = OpTranspose %f64mat22 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected component types of Matrix and Result Type to be " + "identical")); +} + +TEST_F(ValidateComposites, TransposeIncompatibleDimensions1) { + const std::string body = R"( +%val1 = OpTranspose %f32mat23 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected number of columns and the column size " + "of Matrix to be the reverse of those of Result Type")); +} + +TEST_F(ValidateComposites, TransposeIncompatibleDimensions2) { + const std::string body = R"( +%val1 = OpTranspose %f32mat32 %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected number of columns and the column size " + "of Matrix to be the reverse of those of Result Type")); +} + +TEST_F(ValidateComposites, TransposeIncompatibleDimensions3) { + const std::string body = R"( +%val1 = OpTranspose %f32mat23 %f32mat23_121212 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected number of columns and the column size " + "of Matrix to be the reverse of those of Result Type")); +} + +TEST_F(ValidateComposites, CompositeExtractSuccess) { + const std::string body = R"( +%val1 = OpCompositeExtract %f32 %f32vec4_0123 1 +%val2 = OpCompositeExtract %u32 %u32vec4_0123 0 +%val3 = OpCompositeExtract %f32 %f32mat22_1212 0 1 +%val4 = OpCompositeExtract %f32vec2 %f32mat22_1212 0 +%array = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 %f32vec2_12 +%val5 = OpCompositeExtract %f32vec2 %array 2 +%val6 = OpCompositeExtract %f32 %array 2 1 +%struct = OpLoad %big_struct %var_big_struct +%val7 = OpCompositeExtract %f32 %struct 0 +%val8 = OpCompositeExtract %f32vec4 %struct 1 +%val9 = OpCompositeExtract %f32 %struct 1 2 +%val10 = OpCompositeExtract %f32mat23 %struct 2 +%val11 = OpCompositeExtract %f32vec2 %struct 2 2 +%val12 = OpCompositeExtract %f32 %struct 2 2 1 +%val13 = OpCompositeExtract %f32vec2 %struct 3 2 +%val14 = OpCompositeExtract %f32 %struct 3 2 1 +%val15 = OpCompositeExtract %f32vec2 %struct 4 100 +%val16 = OpCompositeExtract %f32 %struct 4 1000 1 +%val17 = OpCompositeExtract %f32 %struct 5 0 +%val18 = OpCompositeExtract %u32 %struct 5 1 +%val19 = OpCompositeExtract %big_struct %struct +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CompositeExtractNotObject) { + const std::string body = R"( +%val1 = OpCompositeExtract %f32 %f32vec4 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Composite to be an object " + "of composite type")); +} + +TEST_F(ValidateComposites, CompositeExtractNotComposite) { + const std::string body = R"( +%val1 = OpCompositeExtract %f32 %f32_1 0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Reached non-composite type while indexes still remain " + "to be traversed.")); +} + +TEST_F(ValidateComposites, CompositeExtractVectorOutOfBounds) { + const std::string body = R"( +%val1 = OpCompositeExtract %f32 %f32vec4_0123 4 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vector access is out of bounds, " + "vector size is 4, but access index is 4")); +} + +TEST_F(ValidateComposites, CompositeExtractMatrixOutOfCols) { + const std::string body = R"( +%val1 = OpCompositeExtract %f32 %f32mat23_121212 3 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Matrix access is out of bounds, " + "matrix has 3 columns, but access index is 3")); +} + +TEST_F(ValidateComposites, CompositeExtractMatrixOutOfRows) { + const std::string body = R"( +%val1 = OpCompositeExtract %f32 %f32mat23_121212 2 5 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vector access is out of bounds, " + "vector size is 2, but access index is 5")); +} + +TEST_F(ValidateComposites, CompositeExtractArrayOutOfBounds) { + const std::string body = R"( +%array = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 %f32vec2_12 +%val1 = OpCompositeExtract %f32vec2 %array 3 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Array access is out of bounds, " + "array size is 3, but access index is 3")); +} + +TEST_F(ValidateComposites, CompositeExtractStructOutOfBounds) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 6 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index is out of bounds, can not find index 6 in the " + "structure '37'. This structure has 6 members. " + "Largest valid index is 5.")); +} + +TEST_F(ValidateComposites, CompositeExtractNestedVectorOutOfBounds) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 3 1 5 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vector access is out of bounds, " + "vector size is 2, but access index is 5")); +} + +TEST_F(ValidateComposites, CompositeExtractTooManyIndices) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 3 1 1 2 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Reached non-composite type while " + "indexes still remain to be traversed.")); +} + +TEST_F(ValidateComposites, CompositeExtractWrongType1) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32vec2 %struct 3 1 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Result type (OpTypeVector) does not match the type that results " + "from indexing into the composite (OpTypeFloat).")); +} + +TEST_F(ValidateComposites, CompositeExtractWrongType2) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 3 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result type (OpTypeFloat) does not match the type " + "that results from indexing into the composite " + "(OpTypeVector).")); +} + +TEST_F(ValidateComposites, CompositeExtractWrongType3) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 2 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result type (OpTypeFloat) does not match the type " + "that results from indexing into the composite " + "(OpTypeVector).")); +} + +TEST_F(ValidateComposites, CompositeExtractWrongType4) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 4 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result type (OpTypeFloat) does not match the type " + "that results from indexing into the composite " + "(OpTypeVector).")); +} + +TEST_F(ValidateComposites, CompositeExtractWrongType5) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeExtract %f32 %struct 5 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Result type (OpTypeFloat) does not match the " + "type that results from indexing into the composite (OpTypeInt).")); +} + +TEST_F(ValidateComposites, CompositeInsertSuccess) { + const std::string body = R"( +%val1 = OpCompositeInsert %f32vec4 %f32_1 %f32vec4_0123 0 +%val2 = OpCompositeInsert %u32vec4 %u32_1 %u32vec4_0123 0 +%val3 = OpCompositeInsert %f32mat22 %f32_2 %f32mat22_1212 0 1 +%val4 = OpCompositeInsert %f32mat22 %f32vec2_01 %f32mat22_1212 0 +%array = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 %f32vec2_12 +%val5 = OpCompositeInsert %f32vec2arr3 %f32vec2_01 %array 2 +%val6 = OpCompositeInsert %f32vec2arr3 %f32_3 %array 2 1 +%struct = OpLoad %big_struct %var_big_struct +%val7 = OpCompositeInsert %big_struct %f32_3 %struct 0 +%val8 = OpCompositeInsert %big_struct %f32vec4_0123 %struct 1 +%val9 = OpCompositeInsert %big_struct %f32_3 %struct 1 2 +%val10 = OpCompositeInsert %big_struct %f32mat23_121212 %struct 2 +%val11 = OpCompositeInsert %big_struct %f32vec2_01 %struct 2 2 +%val12 = OpCompositeInsert %big_struct %f32_3 %struct 2 2 1 +%val13 = OpCompositeInsert %big_struct %f32vec2_01 %struct 3 2 +%val14 = OpCompositeInsert %big_struct %f32_3 %struct 3 2 1 +%val15 = OpCompositeInsert %big_struct %f32vec2_01 %struct 4 100 +%val16 = OpCompositeInsert %big_struct %f32_3 %struct 4 1000 1 +%val17 = OpCompositeInsert %big_struct %f32_3 %struct 5 0 +%val18 = OpCompositeInsert %big_struct %u32_3 %struct 5 1 +%val19 = OpCompositeInsert %big_struct %struct %struct +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateComposites, CompositeInsertResultTypeDifferentFromComposite) { + const std::string body = R"( +%val1 = OpCompositeInsert %f32 %f32_1 %f32vec4_0123 0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Result Type must be the same as Composite type in " + "OpCompositeInsert yielding Result Id 5.")); +} + +TEST_F(ValidateComposites, CompositeInsertNotComposite) { + const std::string body = R"( +%val1 = OpCompositeInsert %f32 %f32_1 %f32_0 0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Reached non-composite type while indexes still remain " + "to be traversed.")); +} + +TEST_F(ValidateComposites, CompositeInsertVectorOutOfBounds) { + const std::string body = R"( +%val1 = OpCompositeInsert %f32vec4 %f32_1 %f32vec4_0123 4 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vector access is out of bounds, " + "vector size is 4, but access index is 4")); +} + +TEST_F(ValidateComposites, CompositeInsertMatrixOutOfCols) { + const std::string body = R"( +%val1 = OpCompositeInsert %f32mat23 %f32_1 %f32mat23_121212 3 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Matrix access is out of bounds, " + "matrix has 3 columns, but access index is 3")); +} + +TEST_F(ValidateComposites, CompositeInsertMatrixOutOfRows) { + const std::string body = R"( +%val1 = OpCompositeInsert %f32mat23 %f32_1 %f32mat23_121212 2 5 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vector access is out of bounds, " + "vector size is 2, but access index is 5")); +} + +TEST_F(ValidateComposites, CompositeInsertArrayOutOfBounds) { + const std::string body = R"( +%array = OpCompositeConstruct %f32vec2arr3 %f32vec2_12 %f32vec2_12 %f32vec2_12 +%val1 = OpCompositeInsert %f32vec2arr3 %f32vec2_01 %array 3 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Array access is out of bounds, array " + "size is 3, but access index is 3")); +} + +TEST_F(ValidateComposites, CompositeInsertStructOutOfBounds) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 6 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index is out of bounds, can not find index 6 in the " + "structure '37'. This structure has 6 members. " + "Largest valid index is 5.")); +} + +TEST_F(ValidateComposites, CompositeInsertNestedVectorOutOfBounds) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 3 1 5 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Vector access is out of bounds, " + "vector size is 2, but access index is 5")); +} + +TEST_F(ValidateComposites, CompositeInsertTooManyIndices) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 3 1 1 2 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Reached non-composite type while indexes still remain " + "to be traversed.")); +} + +TEST_F(ValidateComposites, CompositeInsertWrongType1) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32vec2_01 %struct 3 1 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeVector) does not match the " + "type that results from indexing into the Composite " + "(OpTypeFloat).")); +} + +TEST_F(ValidateComposites, CompositeInsertWrongType2) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 3 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeFloat) does not match the type " + "that results from indexing into the Composite " + "(OpTypeVector).")); +} + +TEST_F(ValidateComposites, CompositeInsertWrongType3) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 2 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeFloat) does not match the type " + "that results from indexing into the Composite " + "(OpTypeVector).")); +} + +TEST_F(ValidateComposites, CompositeInsertWrongType4) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 4 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeFloat) does not match the type " + "that results from indexing into the Composite " + "(OpTypeVector).")); +} + +TEST_F(ValidateComposites, CompositeInsertWrongType5) { + const std::string body = R"( +%struct = OpLoad %big_struct %var_big_struct +%val1 = OpCompositeInsert %big_struct %f32_1 %struct 5 1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeFloat) does not match the type " + "that results from indexing into the Composite " + "(OpTypeInt).")); +} + +// Tests ported from val_id_test.cpp. + +// Valid. Tests both CompositeExtract and CompositeInsert with 255 indexes. +TEST_F(ValidateComposites, CompositeExtractInsertLimitsGood) { + int depth = 255; + std::string header = GetHeaderForTestsFromValId(); + header.erase(header.find("%func")); + std::ostringstream spirv; + spirv << header << std::endl; + + // Build nested structures. Struct 'i' contains struct 'i-1' + spirv << "%s_depth_1 = OpTypeStruct %float\n"; + for (int i = 2; i <= depth; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %s_depth_" << i - 1 << "\n"; + } + + // Define Pointer and Variable to use for CompositeExtract/Insert. + spirv << "%_ptr_Uniform_deep_struct = OpTypePointer Uniform %s_depth_" + << depth << "\n"; + spirv << "%deep_var = OpVariable %_ptr_Uniform_deep_struct Uniform\n"; + + // Function Start + spirv << R"( + %func = OpFunction %void None %void_f + %my_label = OpLabel + )"; + + // OpCompositeExtract/Insert with 'n' indexes (n = depth) + spirv << "%deep = OpLoad %s_depth_" << depth << " %deep_var" << std::endl; + spirv << "%entry = OpCompositeExtract %float %deep"; + for (int i = 0; i < depth; ++i) { + spirv << " 0"; + } + spirv << std::endl; + spirv << "%new_composite = OpCompositeInsert %s_depth_" << depth + << " %entry %deep"; + for (int i = 0; i < depth; ++i) { + spirv << " 0"; + } + spirv << std::endl; + + // Function end + spirv << R"( + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: 256 indexes passed to OpCompositeExtract. Limit is 255. +TEST_F(ValidateComposites, CompositeExtractArgCountExceededLimitBad) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%entry = OpCompositeExtract %float %matrix"; + for (int i = 0; i < 256; ++i) { + spirv << " 0"; + } + spirv << R"( + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The number of indexes in OpCompositeExtract may not " + "exceed 255. Found 256 indexes.")); +} + +// Invalid: 256 indexes passed to OpCompositeInsert. Limit is 255. +TEST_F(ValidateComposites, CompositeInsertArgCountExceededLimitBad) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%new_composite = OpCompositeInsert %mat4x3 %int_0 %matrix"; + for (int i = 0; i < 256; ++i) { + spirv << " 0"; + } + spirv << R"( + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The number of indexes in OpCompositeInsert may not " + "exceed 255. Found 256 indexes.")); +} + +// Invalid: In OpCompositeInsert, result type must be the same as composite type +TEST_F(ValidateComposites, CompositeInsertWrongResultTypeBad) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%float_entry = OpCompositeExtract %float %matrix 0 1" << std::endl; + spirv << "%new_composite = OpCompositeInsert %float %float_entry %matrix 0 1" + << std::endl; + spirv << R"(OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Result Type must be the same as Composite type")); +} + +// Valid: No Indexes were passed to OpCompositeExtract, and the Result Type is +// the same as the Base Composite type. +TEST_F(ValidateComposites, CompositeExtractNoIndexesGood) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%float_entry = OpCompositeExtract %mat4x3 %matrix" << std::endl; + spirv << R"(OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: No Indexes were passed to OpCompositeExtract, but the Result Type is +// different from the Base Composite type. +TEST_F(ValidateComposites, CompositeExtractNoIndexesBad) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%float_entry = OpCompositeExtract %float %matrix" << std::endl; + spirv << R"(OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result type (OpTypeFloat) does not match the type " + "that results from indexing into the composite " + "(OpTypeMatrix).")); +} + +// Valid: No Indexes were passed to OpCompositeInsert, and the type of the +// Object argument matches the Composite type. +TEST_F(ValidateComposites, CompositeInsertMissingIndexesGood) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%matrix_2 = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%new_composite = OpCompositeInsert %mat4x3 %matrix_2 %matrix"; + spirv << R"( + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: No Indexes were passed to OpCompositeInsert, but the type of the +// Object argument does not match the Composite type. +TEST_F(ValidateComposites, CompositeInsertMissingIndexesBad) { + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%new_composite = OpCompositeInsert %mat4x3 %int_0 %matrix"; + spirv << R"( + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeInt) does not match the type " + "that results from indexing into the Composite " + "(OpTypeMatrix).")); +} + +// Valid: Tests that we can index into Struct, Array, Matrix, and Vector! +TEST_F(ValidateComposites, CompositeExtractInsertIndexIntoAllTypesGood) { + // indexes that we are passing are: 0, 3, 1, 2, 0 + // 0 will select the struct_s within the base struct (blockName) + // 3 will select the Array that contains 5 matrices + // 1 will select the Matrix that is at index 1 of the array + // 2 will select the column (which is a vector) within the matrix at index 2 + // 0 will select the element at the index 0 of the vector. (which is a float). + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %ss = OpCompositeExtract %struct_s %myblock 0 + %sa = OpCompositeExtract %array5_mat4x3 %myblock 0 3 + %sm = OpCompositeExtract %mat4x3 %myblock 0 3 1 + %sc = OpCompositeExtract %v3float %myblock 0 3 1 2 + %fl = OpCompositeExtract %float %myblock 0 3 1 2 0 + ; + ; Now let's insert back at different levels... + ; + %b1 = OpCompositeInsert %struct_blockName %ss %myblock 0 + %b2 = OpCompositeInsert %struct_blockName %sa %myblock 0 3 + %b3 = OpCompositeInsert %struct_blockName %sm %myblock 0 3 1 + %b4 = OpCompositeInsert %struct_blockName %sc %myblock 0 3 1 2 + %b5 = OpCompositeInsert %struct_blockName %fl %myblock 0 3 1 2 0 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid. More indexes are provided than needed for OpCompositeExtract. +TEST_F(ValidateComposites, CompositeExtractReachedScalarBad) { + // indexes that we are passing are: 0, 3, 1, 2, 0 + // 0 will select the struct_s within the base struct (blockName) + // 3 will select the Array that contains 5 matrices + // 1 will select the Matrix that is at index 1 of the array + // 2 will select the column (which is a vector) within the matrix at index 2 + // 0 will select the element at the index 0 of the vector. (which is a float). + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %fl = OpCompositeExtract %float %myblock 0 3 1 2 0 1 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Reached non-composite type while indexes still remain " + "to be traversed.")); +} + +// Invalid. More indexes are provided than needed for OpCompositeInsert. +TEST_F(ValidateComposites, CompositeInsertReachedScalarBad) { + // indexes that we are passing are: 0, 3, 1, 2, 0 + // 0 will select the struct_s within the base struct (blockName) + // 3 will select the Array that contains 5 matrices + // 1 will select the Matrix that is at index 1 of the array + // 2 will select the column (which is a vector) within the matrix at index 2 + // 0 will select the element at the index 0 of the vector. (which is a float). + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %fl = OpCompositeExtract %float %myblock 0 3 1 2 0 + %b5 = OpCompositeInsert %struct_blockName %fl %myblock 0 3 1 2 0 1 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Reached non-composite type while indexes still remain " + "to be traversed.")); +} + +// Invalid. Result type doesn't match the type we get from indexing into +// the composite. +TEST_F(ValidateComposites, + CompositeExtractResultTypeDoesntMatchIndexedTypeBad) { + // indexes that we are passing are: 0, 3, 1, 2, 0 + // 0 will select the struct_s within the base struct (blockName) + // 3 will select the Array that contains 5 matrices + // 1 will select the Matrix that is at index 1 of the array + // 2 will select the column (which is a vector) within the matrix at index 2 + // 0 will select the element at the index 0 of the vector. (which is a float). + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %fl = OpCompositeExtract %int %myblock 0 3 1 2 0 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result type (OpTypeInt) does not match the type that " + "results from indexing into the composite " + "(OpTypeFloat).")); +} + +// Invalid. Given object type doesn't match the type we get from indexing into +// the composite. +TEST_F(ValidateComposites, CompositeInsertObjectTypeDoesntMatchIndexedTypeBad) { + // indexes that we are passing are: 0, 3, 1, 2, 0 + // 0 will select the struct_s within the base struct (blockName) + // 3 will select the Array that contains 5 matrices + // 1 will select the Matrix that is at index 1 of the array + // 2 will select the column (which is a vector) within the matrix at index 2 + // 0 will select the element at the index 0 of the vector. (which is a float). + // We are trying to insert an integer where we should be inserting a float. + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %b5 = OpCompositeInsert %struct_blockName %int_0 %myblock 0 3 1 2 0 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Object type (OpTypeInt) does not match the type " + "that results from indexing into the Composite " + "(OpTypeFloat).")); +} + +// Invalid. Index into a struct is larger than the number of struct members. +TEST_F(ValidateComposites, CompositeExtractStructIndexOutOfBoundBad) { + // struct_blockName has 3 members (index 0,1,2). We'll try to access index 3. + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %ss = OpCompositeExtract %struct_s %myblock 3 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index is out of bounds, can not find index 3 in the " + "structure '26'. This structure has 3 members. " + "Largest valid index is 2.")); +} + +// Invalid. Index into a struct is larger than the number of struct members. +TEST_F(ValidateComposites, CompositeInsertStructIndexOutOfBoundBad) { + // struct_blockName has 3 members (index 0,1,2). We'll try to access index 3. + std::ostringstream spirv; + spirv << GetHeaderForTestsFromValId() << R"( + %myblock = OpLoad %struct_blockName %blockName_var + %ss = OpCompositeExtract %struct_s %myblock 0 + %new_composite = OpCompositeInsert %struct_blockName %ss %myblock 3 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Index is out of bounds, can not find index 3 in the structure " + " '26'. This structure has 3 members. Largest valid index " + "is 2.")); +} + +// #1403: Ensure that the default spec constant value is not used to check the +// extract index. +TEST_F(ValidateComposites, ExtractFromSpecConstantSizedArray) { + std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpDecorate %spec_const SpecId 1 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%spec_const = OpSpecConstant %uint 3 +%uint_array = OpTypeArray %uint %spec_const +%undef = OpUndef %uint_array +%voidf = OpTypeFunction %void +%func = OpFunction %void None %voidf +%1 = OpLabel +%2 = OpCompositeExtract %uint %undef 4 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// #1403: Ensure that spec constant ops do not produce false positives. +TEST_F(ValidateComposites, ExtractFromSpecConstantOpSizedArray) { + std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpDecorate %spec_const SpecId 1 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%const = OpConstant %uint 1 +%spec_const = OpSpecConstant %uint 3 +%spec_const_op = OpSpecConstantOp %uint IAdd %spec_const %const +%uint_array = OpTypeArray %uint %spec_const_op +%undef = OpUndef %uint_array +%voidf = OpTypeFunction %void +%func = OpFunction %void None %voidf +%1 = OpLabel +%2 = OpCompositeExtract %uint %undef 4 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// #1403: Ensure that the default spec constant value is not used to check the +// size of the array for a composite construct. This code has limited actual +// value as it is incorrect unless the specialization constant is assigned the +// value of 2, but it is still a valid module. +TEST_F(ValidateComposites, CompositeConstructSpecConstantSizedArray) { + std::string spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +OpDecorate %spec_const SpecId 1 +%void = OpTypeVoid +%uint = OpTypeInt 32 0 +%uint_0 = OpConstant %uint 0 +%spec_const = OpSpecConstant %uint 3 +%uint_array = OpTypeArray %uint %spec_const +%voidf = OpTypeFunction %void +%func = OpFunction %void None %voidf +%1 = OpLabel +%2 = OpCompositeConstruct %uint_array %uint_0 %uint_0 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_conversion_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_conversion_test.cpp new file mode 100644 index 00000000000..e0b8a00180c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_conversion_test.cpp @@ -0,0 +1,1110 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateConversion = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + const std::string capabilities = + R"( +OpCapability Shader +OpCapability Int64 +OpCapability Float64)"; + + const std::string after_extension_before_body = + R"( +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%boolvec2 = OpTypeVector %bool 2 +%s32vec2 = OpTypeVector %s32 2 +%u32vec2 = OpTypeVector %u32 2 +%u64vec2 = OpTypeVector %u64 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%s32vec3 = OpTypeVector %s32 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%u64vec4 = OpTypeVector %u64 4 +%s32vec4 = OpTypeVector %s32 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 +%s32_4 = OpConstant %s32 4 +%s32_m1 = OpConstant %s32 -1 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64_4 = OpConstant %f64 4 + +%s64_0 = OpConstant %s64 0 +%s64_1 = OpConstant %s64 1 +%s64_2 = OpConstant %s64 2 +%s64_3 = OpConstant %s64 3 +%s64_4 = OpConstant %s64 4 +%s64_m1 = OpConstant %s64 -1 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_4 = OpConstant %u64 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 +%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec2_12 = OpConstantComposite %f64vec2 %f64_1 %f64_2 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec3_123 = OpConstantComposite %f64vec3 %f64_1 %f64_2 %f64_3 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 +%f64vec4_1234 = OpConstantComposite %f64vec4 %f64_1 %f64_2 %f64_3 %f64_4 + +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool + +%f32ptr_func = OpTypePointer Function %f32 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string after_body = + R"( +OpReturn +OpFunctionEnd)"; + + return capabilities + capabilities_and_extensions + + after_extension_before_body + body + after_body; +} + +std::string GenerateKernelCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + const std::string capabilities = + R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability GenericPointer +OpCapability Int64 +OpCapability Float64)"; + + const std::string after_extension_before_body = + R"( +OpMemoryModel Physical32 OpenCL +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%boolvec2 = OpTypeVector %bool 2 +%u32vec2 = OpTypeVector %u32 2 +%u64vec2 = OpTypeVector %u64 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%u64vec4 = OpTypeVector %u64 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64_4 = OpConstant %f64 4 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_4 = OpConstant %u64 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec2_12 = OpConstantComposite %f64vec2 %f64_1 %f64_2 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec3_123 = OpConstantComposite %f64vec3 %f64_1 %f64_2 %f64_3 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 +%f64vec4_1234 = OpConstantComposite %f64vec4 %f64_1 %f64_2 %f64_3 %f64_4 + +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool + +%f32ptr_func = OpTypePointer Function %f32 +%u32ptr_func = OpTypePointer Function %u32 +%f32ptr_gen = OpTypePointer Generic %f32 +%f32ptr_inp = OpTypePointer Input %f32 +%f32ptr_wg = OpTypePointer Workgroup %f32 +%f32ptr_cwg = OpTypePointer CrossWorkgroup %f32 + +%f32inp = OpVariable %f32ptr_inp Input + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string after_body = + R"( +OpReturn +OpFunctionEnd)"; + + return capabilities + capabilities_and_extensions + + after_extension_before_body + body + after_body; +} + +TEST_F(ValidateConversion, ConvertFToUSuccess) { + const std::string body = R"( +%val1 = OpConvertFToU %u32 %f32_1 +%val2 = OpConvertFToU %u32 %f64_0 +%val3 = OpConvertFToU %u32vec2 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, ConvertFToUWrongResultType) { + const std::string body = R"( +%val = OpConvertFToU %s32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected unsigned int scalar or vector type as Result " + "Type: ConvertFToU")); +} + +TEST_F(ValidateConversion, ConvertFToUWrongInputType) { + const std::string body = R"( +%val = OpConvertFToU %u32 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to be float scalar or vector: ConvertFToU")); +} + +TEST_F(ValidateConversion, ConvertFToUDifferentDimension) { + const std::string body = R"( +%val = OpConvertFToU %u32 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result " + "Type: ConvertFToU")); +} + +TEST_F(ValidateConversion, ConvertFToSSuccess) { + const std::string body = R"( +%val1 = OpConvertFToS %s32 %f32_1 +%val2 = OpConvertFToS %u32 %f64_0 +%val3 = OpConvertFToS %s32vec2 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, ConvertFToSWrongResultType) { + const std::string body = R"( +%val = OpConvertFToS %bool %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected int scalar or vector type as Result Type: ConvertFToS")); +} + +TEST_F(ValidateConversion, ConvertFToSWrongInputType) { + const std::string body = R"( +%val = OpConvertFToS %s32 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to be float scalar or vector: ConvertFToS")); +} + +TEST_F(ValidateConversion, ConvertFToSDifferentDimension) { + const std::string body = R"( +%val = OpConvertFToS %u32 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result " + "Type: ConvertFToS")); +} + +TEST_F(ValidateConversion, ConvertSToFSuccess) { + const std::string body = R"( +%val1 = OpConvertSToF %f32 %u32_1 +%val2 = OpConvertSToF %f32 %s64_0 +%val3 = OpConvertSToF %f32vec2 %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, ConvertSToFWrongResultType) { + const std::string body = R"( +%val = OpConvertSToF %u32 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected float scalar or vector type as Result Type: ConvertSToF")); +} + +TEST_F(ValidateConversion, ConvertSToFWrongInputType) { + const std::string body = R"( +%val = OpConvertSToF %f32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to be int scalar or vector: ConvertSToF")); +} + +TEST_F(ValidateConversion, ConvertSToFDifferentDimension) { + const std::string body = R"( +%val = OpConvertSToF %f32 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result " + "Type: ConvertSToF")); +} + +TEST_F(ValidateConversion, UConvertSuccess) { + const std::string body = R"( +%val1 = OpUConvert %u32 %u64_1 +%val2 = OpUConvert %u64 %s32_0 +%val3 = OpUConvert %u64vec2 %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, UConvertWrongResultType) { + const std::string body = R"( +%val = OpUConvert %s32 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected unsigned int scalar or vector type as Result " + "Type: UConvert")); +} + +TEST_F(ValidateConversion, UConvertWrongInputType) { + const std::string body = R"( +%val = OpUConvert %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to be int scalar or vector: UConvert")); +} + +TEST_F(ValidateConversion, UConvertDifferentDimension) { + const std::string body = R"( +%val = OpUConvert %u32 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result " + "Type: UConvert")); +} + +TEST_F(ValidateConversion, UConvertSameBitWidth) { + const std::string body = R"( +%val = OpUConvert %u32 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have different bit width from " + "Result Type: UConvert")); +} + +TEST_F(ValidateConversion, SConvertSuccess) { + const std::string body = R"( +%val1 = OpSConvert %s32 %u64_1 +%val2 = OpSConvert %s64 %s32_0 +%val3 = OpSConvert %u64vec2 %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, SConvertWrongResultType) { + const std::string body = R"( +%val = OpSConvert %f32 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as Result Type: SConvert")); +} + +TEST_F(ValidateConversion, SConvertWrongInputType) { + const std::string body = R"( +%val = OpSConvert %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to be int scalar or vector: SConvert")); +} + +TEST_F(ValidateConversion, SConvertDifferentDimension) { + const std::string body = R"( +%val = OpSConvert %s32 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result " + "Type: SConvert")); +} + +TEST_F(ValidateConversion, SConvertSameBitWidth) { + const std::string body = R"( +%val = OpSConvert %u32 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have different bit width from " + "Result Type: SConvert")); +} + +TEST_F(ValidateConversion, FConvertSuccess) { + const std::string body = R"( +%val1 = OpFConvert %f32 %f64_1 +%val2 = OpFConvert %f64 %f32_0 +%val3 = OpFConvert %f64vec2 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, FConvertWrongResultType) { + const std::string body = R"( +%val = OpFConvert %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected float scalar or vector type as Result Type: FConvert")); +} + +TEST_F(ValidateConversion, FConvertWrongInputType) { + const std::string body = R"( +%val = OpFConvert %f32 %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to be float scalar or vector: FConvert")); +} + +TEST_F(ValidateConversion, FConvertDifferentDimension) { + const std::string body = R"( +%val = OpFConvert %f64 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result " + "Type: FConvert")); +} + +TEST_F(ValidateConversion, FConvertSameBitWidth) { + const std::string body = R"( +%val = OpFConvert %f32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have different bit width from " + "Result Type: FConvert")); +} + +TEST_F(ValidateConversion, QuantizeToF16Success) { + const std::string body = R"( +%val1 = OpQuantizeToF16 %f32 %f32_1 +%val2 = OpQuantizeToF16 %f32 %f32_0 +%val3 = OpQuantizeToF16 %f32vec2 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, QuantizeToF16WrongResultType) { + const std::string body = R"( +%val = OpQuantizeToF16 %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected 32-bit float scalar or vector type as Result Type: " + "QuantizeToF16")); +} + +TEST_F(ValidateConversion, QuantizeToF16WrongResultTypeBitWidth) { + const std::string body = R"( +%val = OpQuantizeToF16 %u64 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected 32-bit float scalar or vector type as Result Type: " + "QuantizeToF16")); +} + +TEST_F(ValidateConversion, QuantizeToF16WrongInputType) { + const std::string body = R"( +%val = OpQuantizeToF16 %f32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected input type to be equal to Result Type: QuantizeToF16")); +} + +TEST_F(ValidateConversion, ConvertPtrToUSuccess) { + const std::string body = R"( +%ptr = OpVariable %f32ptr_func Function +%val1 = OpConvertPtrToU %u32 %ptr +%val2 = OpConvertPtrToU %u64 %ptr +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, ConvertPtrToUWrongResultType) { + const std::string body = R"( +%ptr = OpVariable %f32ptr_func Function +%val = OpConvertPtrToU %f32 %ptr +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected unsigned int scalar type as Result Type: " + "ConvertPtrToU")); +} + +TEST_F(ValidateConversion, ConvertPtrToUNotPointer) { + const std::string body = R"( +%val = OpConvertPtrToU %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to be a pointer: ConvertPtrToU")); +} + +TEST_F(ValidateConversion, SatConvertSToUSuccess) { + const std::string body = R"( +%val1 = OpSatConvertSToU %u32 %u64_2 +%val2 = OpSatConvertSToU %u64 %u32_1 +%val3 = OpSatConvertSToU %u64vec2 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, SatConvertSToUWrongResultType) { + const std::string body = R"( +%val = OpSatConvertSToU %f32 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar or vector type as Result Type: " + "SatConvertSToU")); +} + +TEST_F(ValidateConversion, SatConvertSToUWrongInputType) { + const std::string body = R"( +%val = OpSatConvertSToU %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected int scalar or vector as input: SatConvertSToU")); +} + +TEST_F(ValidateConversion, SatConvertSToUDifferentDimension) { + const std::string body = R"( +%val = OpSatConvertSToU %u32 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to have the same dimension as Result Type: " + "SatConvertSToU")); +} + +TEST_F(ValidateConversion, ConvertUToPtrSuccess) { + const std::string body = R"( +%val1 = OpConvertUToPtr %f32ptr_func %u32_1 +%val2 = OpConvertUToPtr %f32ptr_func %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, ConvertUToPtrWrongResultType) { + const std::string body = R"( +%val = OpConvertUToPtr %f32 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a pointer: ConvertUToPtr")); +} + +TEST_F(ValidateConversion, ConvertUToPtrNotInt) { + const std::string body = R"( +%val = OpConvertUToPtr %f32ptr_func %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar as input: ConvertUToPtr")); +} + +TEST_F(ValidateConversion, ConvertUToPtrNotIntScalar) { + const std::string body = R"( +%val = OpConvertUToPtr %f32ptr_func %u32vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected int scalar as input: ConvertUToPtr")); +} + +TEST_F(ValidateConversion, PtrCastToGenericSuccess) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%val = OpPtrCastToGeneric %f32ptr_gen %ptr_func +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, PtrCastToGenericWrongResultType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%val = OpPtrCastToGeneric %f32 %ptr_func +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be a pointer: PtrCastToGeneric")); +} + +TEST_F(ValidateConversion, PtrCastToGenericWrongResultStorageClass) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%val = OpPtrCastToGeneric %f32ptr_func %ptr_func +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have storage class Generic: " + "PtrCastToGeneric")); +} + +TEST_F(ValidateConversion, PtrCastToGenericWrongInputType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%val = OpPtrCastToGeneric %f32ptr_gen %f32 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to be a pointer: PtrCastToGeneric")); +} + +TEST_F(ValidateConversion, PtrCastToGenericWrongInputStorageClass) { + const std::string body = R"( +%val = OpPtrCastToGeneric %f32ptr_gen %f32inp +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have storage class Workgroup, " + "CrossWorkgroup or Function: PtrCastToGeneric")); +} + +TEST_F(ValidateConversion, PtrCastToGenericPointToDifferentType) { + const std::string body = R"( +%ptr_func = OpVariable %u32ptr_func Function +%val = OpPtrCastToGeneric %f32ptr_gen %ptr_func +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input and Result Type to point to the same type: " + "PtrCastToGeneric")); +} + +TEST_F(ValidateConversion, GenericCastToPtrSuccess) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtr %f32ptr_func %ptr_gen +%ptr_wg = OpGenericCastToPtr %f32ptr_wg %ptr_gen +%ptr_cwg = OpGenericCastToPtr %f32ptr_cwg %ptr_gen +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, GenericCastToPtrWrongResultType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtr %f32 %ptr_gen +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be a pointer: GenericCastToPtr")); +} + +TEST_F(ValidateConversion, GenericCastToPtrWrongResultStorageClass) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtr %f32ptr_gen %ptr_gen +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have storage class Workgroup, " + "CrossWorkgroup or Function: GenericCastToPtr")); +} + +TEST_F(ValidateConversion, GenericCastToPtrWrongInputType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtr %f32ptr_func %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to be a pointer: GenericCastToPtr")); +} + +TEST_F(ValidateConversion, GenericCastToPtrWrongInputStorageClass) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_func2 = OpGenericCastToPtr %f32ptr_func %ptr_func +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have storage class Generic: " + "GenericCastToPtr")); +} + +TEST_F(ValidateConversion, GenericCastToPtrPointToDifferentType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtr %u32ptr_func %ptr_gen +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input and Result Type to point to the same type: " + "GenericCastToPtr")); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitSuccess) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtrExplicit %f32ptr_func %ptr_gen Function +%ptr_wg = OpGenericCastToPtrExplicit %f32ptr_wg %ptr_gen Workgroup +%ptr_cwg = OpGenericCastToPtrExplicit %f32ptr_cwg %ptr_gen CrossWorkgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitWrongResultType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtrExplicit %f32 %ptr_gen Function +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Result Type to be a pointer: GenericCastToPtrExplicit")); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitResultStorageClassDiffers) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtrExplicit %f32ptr_func %ptr_gen Workgroup +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be of target storage class: " + "GenericCastToPtrExplicit")); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitWrongResultStorageClass) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtrExplicit %f32ptr_gen %ptr_gen Generic +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected target storage class to be Workgroup, " + "CrossWorkgroup or Function: GenericCastToPtrExplicit")); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitWrongInputType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtrExplicit %f32ptr_func %f32_1 Function +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to be a pointer: GenericCastToPtrExplicit")); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitWrongInputStorageClass) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_func2 = OpGenericCastToPtrExplicit %f32ptr_func %ptr_func Function +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have storage class Generic: " + "GenericCastToPtrExplicit")); +} + +TEST_F(ValidateConversion, GenericCastToPtrExplicitPointToDifferentType) { + const std::string body = R"( +%ptr_func = OpVariable %f32ptr_func Function +%ptr_gen = OpPtrCastToGeneric %f32ptr_gen %ptr_func +%ptr_func2 = OpGenericCastToPtrExplicit %u32ptr_func %ptr_gen Function +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input and Result Type to point to the same type: " + "GenericCastToPtrExplicit")); +} + +TEST_F(ValidateConversion, BitcastSuccess) { + const std::string body = R"( +%ptr = OpVariable %f32ptr_func Function +%val1 = OpBitcast %u32 %ptr +%val2 = OpBitcast %u64 %ptr +%val3 = OpBitcast %f32ptr_func %u32_1 +%val4 = OpBitcast %f32ptr_wg %u64_1 +%val5 = OpBitcast %f32 %u32_1 +%val6 = OpBitcast %f32vec2 %u32vec2_12 +%val7 = OpBitcast %f32vec2 %u64_1 +%val8 = OpBitcast %f64 %u32vec2_12 +%val9 = OpBitcast %f32vec4 %f64vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateConversion, BitcastInputHasNoType) { + const std::string body = R"( +%val = OpBitcast %u32 %f32 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to have a type: Bitcast")); +} + +TEST_F(ValidateConversion, BitcastWrongResultType) { + const std::string body = R"( +%val = OpBitcast %bool %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be a pointer or int or float vector " + "or scalar type: Bitcast")); +} + +TEST_F(ValidateConversion, BitcastWrongInputType) { + const std::string body = R"( +%val = OpBitcast %u32 %true +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected input to be a pointer or int or float vector " + "or scalar: Bitcast")); +} + +TEST_F(ValidateConversion, BitcastPtrWrongInputType) { + const std::string body = R"( +%val = OpBitcast %u32ptr_func %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected input to be a pointer or int scalar if Result Type " + "is pointer: Bitcast")); +} + +TEST_F(ValidateConversion, BitcastPtrWrongResultType) { + const std::string body = R"( +%val = OpBitcast %f32 %f32inp +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Pointer can only be converted to another pointer or int scalar: " + "Bitcast")); +} + +TEST_F(ValidateConversion, BitcastDifferentTotalBitWidth) { + const std::string body = R"( +%val = OpBitcast %f32 %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected input to have the same total bit width as Result Type: " + "Bitcast")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_data_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_data_test.cpp new file mode 100644 index 00000000000..d022d8b8a3a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_data_test.cpp @@ -0,0 +1,642 @@ +// Copyright (c) 2016 Google 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. + +// Validation tests for Data Rules. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; + +using ValidateData = spvtest::ValidateBase>; + +std::string HeaderWith(std::string cap) { + return std::string("OpCapability Shader OpCapability Linkage OpCapability ") + + cap + " OpMemoryModel Logical GLSL450 "; +} + +std::string header = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_addresses = R"( + OpCapability Addresses + OpCapability Kernel + OpCapability GenericPointer + OpCapability Linkage + OpMemoryModel Physical32 OpenCL +)"; +std::string header_with_vec16_cap = R"( + OpCapability Shader + OpCapability Vector16 + OpCapability Linkage + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_int8 = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Int8 + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_int16 = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Int16 + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_int64 = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Int64 + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_float16 = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Float16 + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_float16_buffer = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Float16Buffer + OpMemoryModel Logical GLSL450 +)"; +std::string header_with_float64 = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Float64 + OpMemoryModel Logical GLSL450 +)"; + +std::string invalid_comp_error = "Illegal number of components"; +std::string missing_cap_error = "requires the Vector16 capability"; +std::string missing_int8_cap_error = "requires the Int8 capability"; +std::string missing_int16_cap_error = + "requires the Int16 capability," + " or an extension that explicitly enables 16-bit integers."; +std::string missing_int64_cap_error = "requires the Int64 capability"; +std::string missing_float16_cap_error = + "requires the Float16 or Float16Buffer capability," + " or an extension that explicitly enables 16-bit floating point."; +std::string missing_float64_cap_error = "requires the Float64 capability"; +std::string invalid_num_bits_error = "Invalid number of bits"; + +TEST_F(ValidateData, vec0) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 0 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_comp_error)); +} + +TEST_F(ValidateData, vec1) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 1 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_comp_error)); +} + +TEST_F(ValidateData, vec2) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 2 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, vec3) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, vec4) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, vec5) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 5 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_comp_error)); +} + +TEST_F(ValidateData, vec8) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 8 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_cap_error)); +} + +TEST_F(ValidateData, vec8_with_capability) { + std::string str = header_with_vec16_cap + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 8 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, vec16) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 8 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_cap_error)); +} + +TEST_F(ValidateData, vec16_with_capability) { + std::string str = header_with_vec16_cap + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 16 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, vec15) { + std::string str = header + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 15 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_comp_error)); +} + +TEST_F(ValidateData, int8_good) { + std::string str = header_with_int8 + "%2 = OpTypeInt 8 0"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, int8_bad) { + std::string str = header + "%2 = OpTypeInt 8 1"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_int8_cap_error)); +} + +TEST_F(ValidateData, int8_with_storage_buffer_8bit_access_good) { + std::string str = HeaderWith( + "StorageBuffer8BitAccess " + "OpExtension \"SPV_KHR_8bit_storage\"") + + " %2 = OpTypeInt 8 0"; + CompileSuccessfully(str.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateData, int8_with_uniform_and_storage_buffer_8bit_access_good) { + std::string str = HeaderWith( + "UniformAndStorageBuffer8BitAccess " + "OpExtension \"SPV_KHR_8bit_storage\"") + + " %2 = OpTypeInt 8 0"; + CompileSuccessfully(str.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateData, int8_with_storage_push_constant_8_good) { + std::string str = HeaderWith( + "StoragePushConstant8 " + "OpExtension \"SPV_KHR_8bit_storage\"") + + " %2 = OpTypeInt 8 0"; + CompileSuccessfully(str.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateData, int16_good) { + std::string str = header_with_int16 + "%2 = OpTypeInt 16 1"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, storage_uniform_buffer_block_16_good) { + std::string str = HeaderWith( + "StorageUniformBufferBlock16 " + "OpExtension \"SPV_KHR_16bit_storage\"") + + "%2 = OpTypeInt 16 1 %3 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, storage_uniform_16_good) { + std::string str = + HeaderWith("StorageUniform16 OpExtension \"SPV_KHR_16bit_storage\"") + + "%2 = OpTypeInt 16 1 %3 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, storage_push_constant_16_good) { + std::string str = HeaderWith( + "StoragePushConstant16 " + "OpExtension \"SPV_KHR_16bit_storage\"") + + "%2 = OpTypeInt 16 1 %3 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, storage_input_output_16_good) { + std::string str = HeaderWith( + "StorageInputOutput16 " + "OpExtension \"SPV_KHR_16bit_storage\"") + + "%2 = OpTypeInt 16 1 %3 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, int16_bad) { + std::string str = header + "%2 = OpTypeInt 16 1"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_int16_cap_error)); +} + +TEST_F(ValidateData, int64_good) { + std::string str = header_with_int64 + "%2 = OpTypeInt 64 1"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, int64_bad) { + std::string str = header + "%2 = OpTypeInt 64 1"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_int64_cap_error)); +} + +// Number of bits in an integer may be only one of: {8,16,32,64} +TEST_F(ValidateData, int_invalid_num_bits) { + std::string str = header + "%2 = OpTypeInt 48 1"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_num_bits_error)); +} + +TEST_F(ValidateData, float16_good) { + std::string str = header_with_float16 + "%2 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, float16_buffer_good) { + std::string str = header_with_float16_buffer + "%2 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, float16_bad) { + std::string str = header + "%2 = OpTypeFloat 16"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_float16_cap_error)); +} + +TEST_F(ValidateData, float64_good) { + std::string str = header_with_float64 + "%2 = OpTypeFloat 64"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, float64_bad) { + std::string str = header + "%2 = OpTypeFloat 64"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(missing_float64_cap_error)); +} + +// Number of bits in a float may be only one of: {16,32,64} +TEST_F(ValidateData, float_invalid_num_bits) { + std::string str = header + "%2 = OpTypeFloat 48"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(invalid_num_bits_error)); +} + +TEST_F(ValidateData, matrix_data_type_float) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, ids_should_be_validated_before_data) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%mat33 = OpTypeMatrix %vec3 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 3 has not been defined")); +} + +TEST_F(ValidateData, matrix_bad_column_type) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%mat33 = OpTypeMatrix %f32 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Columns in a matrix must be of type vector")); +} + +TEST_F(ValidateData, matrix_data_type_int) { + std::string str = header + R"( +%int32 = OpTypeInt 32 1 +%vec3 = OpTypeVector %int32 3 +%mat33 = OpTypeMatrix %vec3 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("can only be parameterized with floating-point types")); +} + +TEST_F(ValidateData, matrix_data_type_bool) { + std::string str = header + R"( +%boolt = OpTypeBool +%vec3 = OpTypeVector %boolt 3 +%mat33 = OpTypeMatrix %vec3 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("can only be parameterized with floating-point types")); +} + +TEST_F(ValidateData, matrix_with_0_columns) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 0 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("can only be parameterized as having only 2, 3, or 4 columns")); +} + +TEST_F(ValidateData, matrix_with_1_column) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 1 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("can only be parameterized as having only 2, 3, or 4 columns")); +} + +TEST_F(ValidateData, matrix_with_2_columns) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 2 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, matrix_with_3_columns) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 3 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, matrix_with_4_columns) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 4 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, matrix_with_5_column) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 5 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("can only be parameterized as having only 2, 3, or 4 columns")); +} + +TEST_F(ValidateData, specialize_int) { + std::string str = header + R"( +%i32 = OpTypeInt 32 1 +%len = OpSpecConstant %i32 2)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, specialize_float) { + std::string str = header + R"( +%f32 = OpTypeFloat 32 +%len = OpSpecConstant %f32 2)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, specialize_boolean) { + std::string str = header + R"( +%2 = OpTypeBool +%3 = OpSpecConstantTrue %2 +%4 = OpSpecConstantFalse %2)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, specialize_boolean_to_int) { + std::string str = header + R"( +%2 = OpTypeInt 32 1 +%3 = OpSpecConstantTrue %2 +%4 = OpSpecConstantFalse %2)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Specialization constant must be a boolean")); +} + +TEST_F(ValidateData, missing_forward_pointer_decl) { + std::string str = header_with_addresses + R"( +%uintt = OpTypeInt 32 0 +%3 = OpTypeStruct %fwd_ptrt %uintt +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must first be declared using OpTypeForwardPointer")); +} + +TEST_F(ValidateData, missing_forward_pointer_decl_self_reference) { + std::string str = header_with_addresses + R"( +%uintt = OpTypeInt 32 0 +%3 = OpTypeStruct %3 %uintt +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must first be declared using OpTypeForwardPointer")); +} + +TEST_F(ValidateData, forward_pointer_missing_definition) { + std::string str = header_with_addresses + R"( +OpTypeForwardPointer %_ptr_Generic_struct_A Generic +%uintt = OpTypeInt 32 0 +%struct_B = OpTypeStruct %uintt %_ptr_Generic_struct_A +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("forward referenced IDs have not been defined")); +} + +TEST_F(ValidateData, forward_ref_bad_type) { + std::string str = header_with_addresses + R"( +OpTypeForwardPointer %_ptr_Generic_struct_A Generic +%uintt = OpTypeInt 32 0 +%struct_B = OpTypeStruct %uintt %_ptr_Generic_struct_A +%_ptr_Generic_struct_A = OpTypeFloat 32 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Found a forward reference to a non-pointer type in " + "OpTypeStruct instruction.")); +} + +TEST_F(ValidateData, forward_ref_points_to_non_struct) { + std::string str = header_with_addresses + R"( +OpTypeForwardPointer %_ptr_Generic_struct_A Generic +%uintt = OpTypeInt 32 0 +%struct_B = OpTypeStruct %uintt %_ptr_Generic_struct_A +%_ptr_Generic_struct_A = OpTypePointer Generic %uintt +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("A forward reference operand in an OpTypeStruct must " + "be an OpTypePointer that points to an OpTypeStruct. " + "Found OpTypePointer that points to OpTypeInt.")); +} + +TEST_F(ValidateData, struct_forward_pointer_good) { + std::string str = header_with_addresses + R"( +OpTypeForwardPointer %_ptr_Generic_struct_A Generic +%uintt = OpTypeInt 32 0 +%struct_B = OpTypeStruct %uintt %_ptr_Generic_struct_A +%struct_C = OpTypeStruct %uintt %struct_B +%struct_A = OpTypeStruct %uintt %struct_C +%_ptr_Generic_struct_A = OpTypePointer Generic %struct_C +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateData, ext_16bit_storage_caps_allow_free_fp_rounding_mode) { + for (const char* cap : {"StorageUniform16", "StorageUniformBufferBlock16", + "StoragePushConstant16", "StorageInputOutput16"}) { + for (const char* mode : {"RTE", "RTZ", "RTP", "RTN"}) { + std::string str = std::string(R"( + OpCapability Shader + OpCapability Linkage + OpCapability )") + + cap + R"( + OpExtension "SPV_KHR_16bit_storage" + OpMemoryModel Logical GLSL450 + OpDecorate %2 FPRoundingMode )" + mode + R"( + %1 = OpTypeFloat 32 + %2 = OpConstant %1 1.25 + )"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + } + } +} + +TEST_F(ValidateData, vulkan_disallow_free_fp_rounding_mode) { + for (const char* mode : {"RTE", "RTZ"}) { + for (const auto env : {SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1}) { + std::string str = std::string(R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpDecorate %2 FPRoundingMode )") + + mode + R"( + %1 = OpTypeFloat 32 + %2 = OpConstant %1 1.25 + )"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions(env)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Operand 2 of Decorate requires one of these capabilities: " + "StorageBuffer16BitAccess StorageUniform16 " + "StoragePushConstant16 StorageInputOutput16")); + } + } +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_decoration_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_decoration_test.cpp new file mode 100644 index 00000000000..c968183ca2a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_decoration_test.cpp @@ -0,0 +1,3037 @@ +// Copyright (c) 2017 Google 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. + +// Validation tests for decorations + +#include +#include + +#include "gmock/gmock.h" +#include "source/val/decoration.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Eq; +using ::testing::HasSubstr; + +using ValidateDecorations = spvtest::ValidateBase; + +TEST_F(ValidateDecorations, ValidateOpDecorateRegistration) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %1 ArrayStride 4 + OpDecorate %1 Uniform + %2 = OpTypeFloat 32 + %1 = OpTypeRuntimeArray %2 + ; Since %1 is used first in Decoration, it gets id 1. +)"; + const uint32_t id = 1; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + // Must have 2 decorations. + EXPECT_THAT( + vstate_->id_decorations(id), + Eq(std::vector{Decoration(SpvDecorationArrayStride, {4}), + Decoration(SpvDecorationUniform)})); +} + +TEST_F(ValidateDecorations, ValidateOpMemberDecorateRegistration) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %_arr_double_uint_6 ArrayStride 4 + OpMemberDecorate %_struct_115 2 NonReadable + OpMemberDecorate %_struct_115 2 Offset 2 + OpDecorate %_struct_115 BufferBlock + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %uint_6 = OpConstant %uint 6 + %_arr_double_uint_6 = OpTypeArray %float %uint_6 + %_struct_115 = OpTypeStruct %float %float %_arr_double_uint_6 +)"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + + // The array must have 1 decoration. + const uint32_t arr_id = 1; + EXPECT_THAT( + vstate_->id_decorations(arr_id), + Eq(std::vector{Decoration(SpvDecorationArrayStride, {4})})); + + // The struct must have 3 decorations. + const uint32_t struct_id = 2; + EXPECT_THAT( + vstate_->id_decorations(struct_id), + Eq(std::vector{Decoration(SpvDecorationNonReadable, {}, 2), + Decoration(SpvDecorationOffset, {2}, 2), + Decoration(SpvDecorationBufferBlock)})); +} + +TEST_F(ValidateDecorations, ValidateGroupDecorateRegistration) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %1 DescriptorSet 0 + OpDecorate %1 NonWritable + OpDecorate %1 Restrict + %1 = OpDecorationGroup + OpGroupDecorate %1 %2 %3 + OpGroupDecorate %1 %4 + %float = OpTypeFloat 32 +%_runtimearr_float = OpTypeRuntimeArray %float + %_struct_9 = OpTypeStruct %_runtimearr_float +%_ptr_Uniform__struct_9 = OpTypePointer Uniform %_struct_9 + %2 = OpVariable %_ptr_Uniform__struct_9 Uniform + %_struct_10 = OpTypeStruct %_runtimearr_float +%_ptr_Uniform__struct_10 = OpTypePointer Uniform %_struct_10 + %3 = OpVariable %_ptr_Uniform__struct_10 Uniform + %_struct_11 = OpTypeStruct %_runtimearr_float +%_ptr_Uniform__struct_11 = OpTypePointer Uniform %_struct_11 + %4 = OpVariable %_ptr_Uniform__struct_11 Uniform + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + + // Decoration group has 3 decorations. + auto expected_decorations = std::vector{ + Decoration(SpvDecorationDescriptorSet, {0}), + Decoration(SpvDecorationNonWritable), Decoration(SpvDecorationRestrict)}; + + // Decoration group is applied to id 1, 2, 3, and 4. Note that id 1 (which is + // the decoration group id) also has all the decorations. + EXPECT_THAT(vstate_->id_decorations(1), Eq(expected_decorations)); + EXPECT_THAT(vstate_->id_decorations(2), Eq(expected_decorations)); + EXPECT_THAT(vstate_->id_decorations(3), Eq(expected_decorations)); + EXPECT_THAT(vstate_->id_decorations(4), Eq(expected_decorations)); +} + +TEST_F(ValidateDecorations, ValidateGroupMemberDecorateRegistration) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %1 Offset 3 + %1 = OpDecorationGroup + OpGroupMemberDecorate %1 %_struct_1 3 %_struct_2 3 %_struct_3 3 + %float = OpTypeFloat 32 +%_runtimearr = OpTypeRuntimeArray %float + %_struct_1 = OpTypeStruct %float %float %float %_runtimearr + %_struct_2 = OpTypeStruct %float %float %float %_runtimearr + %_struct_3 = OpTypeStruct %float %float %float %_runtimearr + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + // Decoration group has 1 decoration. + auto expected_decorations = + std::vector{Decoration(SpvDecorationOffset, {3}, 3)}; + + // Decoration group is applied to id 2, 3, and 4. + EXPECT_THAT(vstate_->id_decorations(2), Eq(expected_decorations)); + EXPECT_THAT(vstate_->id_decorations(3), Eq(expected_decorations)); + EXPECT_THAT(vstate_->id_decorations(4), Eq(expected_decorations)); +} + +TEST_F(ValidateDecorations, LinkageImportUsedForInitializedVariableBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %target LinkageAttributes "link_ptr" Import + %float = OpTypeFloat 32 + %_ptr_float = OpTypePointer Uniform %float + %zero = OpConstantNull %float + %target = OpVariable %_ptr_float Uniform %zero + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("A module-scope OpVariable with initialization value " + "cannot be marked with the Import Linkage Type.")); +} +TEST_F(ValidateDecorations, LinkageExportUsedForInitializedVariableGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %target LinkageAttributes "link_ptr" Export + %float = OpTypeFloat 32 + %_ptr_float = OpTypePointer Uniform %float + %zero = OpConstantNull %float + %target = OpVariable %_ptr_float Uniform %zero + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, StructAllMembersHaveBuiltInDecorationsGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpMemberDecorate %_struct_1 0 BuiltIn Position + OpMemberDecorate %_struct_1 1 BuiltIn Position + OpMemberDecorate %_struct_1 2 BuiltIn Position + OpMemberDecorate %_struct_1 3 BuiltIn Position + %float = OpTypeFloat 32 +%_runtimearr = OpTypeRuntimeArray %float + %_struct_1 = OpTypeStruct %float %float %float %_runtimearr + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, MixedBuiltInDecorationsBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpMemberDecorate %_struct_1 0 BuiltIn Position + OpMemberDecorate %_struct_1 1 BuiltIn Position + %float = OpTypeFloat 32 +%_runtimearr = OpTypeRuntimeArray %float + %_struct_1 = OpTypeStruct %float %float %float %_runtimearr + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("When BuiltIn decoration is applied to a structure-type " + "member, all members of that structure type must also be " + "decorated with BuiltIn (No allowed mixing of built-in " + "variables and non-built-in variables within a single " + "structure). Structure id 1 does not meet this requirement.")); +} + +TEST_F(ValidateDecorations, StructContainsBuiltInStructBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpMemberDecorate %_struct_1 0 BuiltIn Position + OpMemberDecorate %_struct_1 1 BuiltIn Position + OpMemberDecorate %_struct_1 2 BuiltIn Position + OpMemberDecorate %_struct_1 3 BuiltIn Position + %float = OpTypeFloat 32 +%_runtimearr = OpTypeRuntimeArray %float + %_struct_1 = OpTypeStruct %float %float %float %_runtimearr + %_struct_2 = OpTypeStruct %_struct_1 + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Structure 1 contains members with BuiltIn " + "decoration. Therefore this structure may not be " + "contained as a member of another structure type. " + "Structure 4 contains structure 1.")); +} + +TEST_F(ValidateDecorations, StructContainsNonBuiltInStructGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %float = OpTypeFloat 32 + %_struct_1 = OpTypeStruct %float + %_struct_2 = OpTypeStruct %_struct_1 + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, MultipleBuiltInObjectsConsumedByOpEntryPointBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %in_1 %in_2 + OpMemberDecorate %struct_1 0 BuiltIn InvocationId + OpMemberDecorate %struct_2 0 BuiltIn Position + %int = OpTypeInt 32 1 + %void = OpTypeVoid + %func = OpTypeFunction %void + %float = OpTypeFloat 32 + %struct_1 = OpTypeStruct %int + %struct_2 = OpTypeStruct %float +%ptr_builtin_1 = OpTypePointer Input %struct_1 +%ptr_builtin_2 = OpTypePointer Input %struct_2 +%in_1 = OpVariable %ptr_builtin_1 Input +%in_2 = OpVariable %ptr_builtin_2 Input + %main = OpFunction %void None %func + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("There must be at most one object per Storage Class " + "that can contain a structure type containing members " + "decorated with BuiltIn, consumed per entry-point.")); +} + +TEST_F(ValidateDecorations, + OneBuiltInObjectPerStorageClassConsumedByOpEntryPointGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %in_1 %out_1 + OpMemberDecorate %struct_1 0 BuiltIn InvocationId + OpMemberDecorate %struct_2 0 BuiltIn Position + %int = OpTypeInt 32 1 + %void = OpTypeVoid + %func = OpTypeFunction %void + %float = OpTypeFloat 32 + %struct_1 = OpTypeStruct %int + %struct_2 = OpTypeStruct %float +%ptr_builtin_1 = OpTypePointer Input %struct_1 +%ptr_builtin_2 = OpTypePointer Output %struct_2 +%in_1 = OpVariable %ptr_builtin_1 Input +%out_1 = OpVariable %ptr_builtin_2 Output + %main = OpFunction %void None %func + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, NoBuiltInObjectsConsumedByOpEntryPointGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %in_1 %out_1 + %int = OpTypeInt 32 1 + %void = OpTypeVoid + %func = OpTypeFunction %void + %float = OpTypeFloat 32 + %struct_1 = OpTypeStruct %int + %struct_2 = OpTypeStruct %float +%ptr_builtin_1 = OpTypePointer Input %struct_1 +%ptr_builtin_2 = OpTypePointer Output %struct_2 +%in_1 = OpVariable %ptr_builtin_1 Input +%out_1 = OpVariable %ptr_builtin_2 Output + %main = OpFunction %void None %func + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, EntryPointFunctionHasLinkageAttributeBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpDecorate %main LinkageAttributes "import_main" Import +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%main = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("The LinkageAttributes Decoration (Linkage name: import_main) " + "cannot be applied to function id 1 because it is targeted by " + "an OpEntryPoint instruction.")); +} + +TEST_F(ValidateDecorations, FunctionDeclarationWithoutImportLinkageBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Function declaration (id 3) must have a LinkageAttributes " + "decoration with the Import Linkage type.")); +} + +TEST_F(ValidateDecorations, FunctionDeclarationWithImportLinkageGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %main LinkageAttributes "link_fn" Import + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, FunctionDeclarationWithExportLinkageBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %main LinkageAttributes "link_fn" Export + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Function declaration (id 1) must have a LinkageAttributes " + "decoration with the Import Linkage type.")); +} + +TEST_F(ValidateDecorations, FunctionDefinitionWithImportLinkageBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %main LinkageAttributes "link_fn" Import + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Function definition (id 1) may not be decorated with " + "Import Linkage type.")); +} + +TEST_F(ValidateDecorations, FunctionDefinitionWithoutImportLinkageGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %void = OpTypeVoid + %func = OpTypeFunction %void + %main = OpFunction %void None %func + %label = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, BuiltinVariablesGoodVulkan) { + const spv_target_env env = SPV_ENV_VULKAN_1_0; + std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragCoord %_entryPointOutput +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 500 +OpDecorate %gl_FragCoord BuiltIn FragCoord +OpDecorate %_entryPointOutput Location 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%float_0 = OpConstant %float 0 +%14 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %3 +%5 = OpLabel +OpStore %_entryPointOutput %14 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, env); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState(env)); +} + +TEST_F(ValidateDecorations, BuiltinVariablesWithLocationDecorationVulkan) { + const spv_target_env env = SPV_ENV_VULKAN_1_0; + std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragCoord %_entryPointOutput +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 500 +OpDecorate %gl_FragCoord BuiltIn FragCoord +OpDecorate %gl_FragCoord Location 0 +OpDecorate %_entryPointOutput Location 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%float_0 = OpConstant %float 0 +%14 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %3 +%5 = OpLabel +OpStore %_entryPointOutput %14 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, env); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("A BuiltIn variable (id 2) cannot have any Location or " + "Component decorations")); +} +TEST_F(ValidateDecorations, BuiltinVariablesWithComponentDecorationVulkan) { + const spv_target_env env = SPV_ENV_VULKAN_1_0; + std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" %gl_FragCoord %_entryPointOutput +OpExecutionMode %main OriginUpperLeft +OpSource HLSL 500 +OpDecorate %gl_FragCoord BuiltIn FragCoord +OpDecorate %gl_FragCoord Component 0 +OpDecorate %_entryPointOutput Location 0 +%void = OpTypeVoid +%3 = OpTypeFunction %void +%float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%float_0 = OpConstant %float 0 +%14 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 +%_ptr_Input_v4float = OpTypePointer Input %v4float +%gl_FragCoord = OpVariable %_ptr_Input_v4float Input +%_ptr_Output_v4float = OpTypePointer Output %v4float +%_entryPointOutput = OpVariable %_ptr_Output_v4float Output +%main = OpFunction %void None %3 +%5 = OpLabel +OpStore %_entryPointOutput %14 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv, env); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("A BuiltIn variable (id 2) cannot have any Location or " + "Component decorations")); +} + +// #version 440 +// #extension GL_EXT_nonuniform_qualifier : enable +// layout(binding = 1) uniform sampler2D s2d[]; +// layout(location = 0) in nonuniformEXT int i; +// void main() +// { +// vec4 v = texture(s2d[i], vec2(0.3)); +// } +TEST_F(ValidateDecorations, RuntimeArrayOfDescriptorSetsIsAllowed) { + const spv_target_env env = SPV_ENV_VULKAN_1_0; + std::string spirv = R"( + OpCapability Shader + OpCapability ShaderNonUniformEXT + OpCapability RuntimeDescriptorArrayEXT + OpCapability SampledImageArrayNonUniformIndexingEXT + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %i + OpSource GLSL 440 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %v "v" + OpName %s2d "s2d" + OpName %i "i" + OpDecorate %s2d DescriptorSet 0 + OpDecorate %s2d Binding 1 + OpDecorate %i Location 0 + OpDecorate %i NonUniformEXT + OpDecorate %18 NonUniformEXT + OpDecorate %21 NonUniformEXT + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 +%_runtimearr_11 = OpTypeRuntimeArray %11 +%_ptr_UniformConstant__runtimearr_11 = OpTypePointer UniformConstant %_runtimearr_11 + %s2d = OpVariable %_ptr_UniformConstant__runtimearr_11 UniformConstant + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %i = OpVariable %_ptr_Input_int Input +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %v2float = OpTypeVector %float 2 +%float_0_300000012 = OpConstant %float 0.300000012 + %24 = OpConstantComposite %v2float %float_0_300000012 %float_0_300000012 + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %18 = OpLoad %int %i + %20 = OpAccessChain %_ptr_UniformConstant_11 %s2d %18 + %21 = OpLoad %11 %20 + %26 = OpImageSampleExplicitLod %v4float %21 %24 Lod %float_0 + OpStore %v %26 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv, env); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +// #version 440 +// #extension GL_EXT_nonuniform_qualifier : enable +// layout(binding = 1) uniform sampler2D s2d[][2]; +// layout(location = 0) in nonuniformEXT int i; +// void main() +// { +// vec4 v = texture(s2d[i][i], vec2(0.3)); +// } +TEST_F(ValidateDecorations, RuntimeArrayOfArraysOfDescriptorSetsIsDisallowed) { + const spv_target_env env = SPV_ENV_VULKAN_1_0; + std::string spirv = R"( + OpCapability Shader + OpCapability ShaderNonUniformEXT + OpCapability RuntimeDescriptorArrayEXT + OpCapability SampledImageArrayNonUniformIndexingEXT + OpExtension "SPV_EXT_descriptor_indexing" + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %i + OpSource GLSL 440 + OpSourceExtension "GL_EXT_nonuniform_qualifier" + OpName %main "main" + OpName %v "v" + OpName %s2d "s2d" + OpName %i "i" + OpDecorate %s2d DescriptorSet 0 + OpDecorate %s2d Binding 1 + OpDecorate %i Location 0 + OpDecorate %i NonUniformEXT + OpDecorate %21 NonUniformEXT + OpDecorate %22 NonUniformEXT + OpDecorate %25 NonUniformEXT + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %10 = OpTypeImage %float 2D 0 0 0 1 Unknown + %11 = OpTypeSampledImage %10 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_11_uint_2 = OpTypeArray %11 %uint_2 +%_runtimearr__arr_11_uint_2 = OpTypeRuntimeArray %_arr_11_uint_2 +%_ptr_UniformConstant__runtimearr__arr_11_uint_2 = OpTypePointer UniformConstant %_runtimearr__arr_11_uint_2 + %s2d = OpVariable %_ptr_UniformConstant__runtimearr__arr_11_uint_2 UniformConstant + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %i = OpVariable %_ptr_Input_int Input +%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11 + %v2float = OpTypeVector %float 2 +%float_0_300000012 = OpConstant %float 0.300000012 + %28 = OpConstantComposite %v2float %float_0_300000012 %float_0_300000012 + %float_0 = OpConstant %float 0 + %main = OpFunction %void None %3 + %5 = OpLabel + %v = OpVariable %_ptr_Function_v4float Function + %21 = OpLoad %int %i + %22 = OpLoad %int %i + %24 = OpAccessChain %_ptr_UniformConstant_11 %s2d %21 %22 + %25 = OpLoad %11 %24 + %30 = OpImageSampleExplicitLod %v4float %25 %28 Lod %float_0 + OpStore %v %30 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv, env); + + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Only a single level of array is allowed for " + "descriptor set variables")); +} + +// #version 440 +// layout (set=1, binding=1) uniform sampler2D variableName[2][2]; +// void main() { +// } +TEST_F(ValidateDecorations, ArrayOfArraysOfDescriptorSetsIsDisallowed) { + const spv_target_env env = SPV_ENV_VULKAN_1_0; + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 440 + OpName %main "main" + OpName %variableName "variableName" + OpDecorate %variableName DescriptorSet 1 + OpDecorate %variableName Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %7 = OpTypeImage %float 2D 0 0 0 1 Unknown + %8 = OpTypeSampledImage %7 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_8_uint_2 = OpTypeArray %8 %uint_2 +%_arr__arr_8_uint_2_uint_2 = OpTypeArray %_arr_8_uint_2 %uint_2 +%_ptr_UniformConstant__arr__arr_8_uint_2_uint_2 = OpTypePointer UniformConstant %_arr__arr_8_uint_2_uint_2 +%variableName = OpVariable %_ptr_UniformConstant__arr__arr_8_uint_2_uint_2 UniformConstant + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv, env); + + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Only a single level of array is allowed for " + "descriptor set variables")); +} + +TEST_F(ValidateDecorations, BlockMissingOffsetBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Output = OpTypeStruct %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with Offset decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockMissingOffsetBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Output = OpTypeStruct %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with Offset decorations")); +} + +TEST_F(ValidateDecorations, BlockNestedStructMissingOffsetBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %v3float %int + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with Offset decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockNestedStructMissingOffsetBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %v3float %int + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must be explicitly laid out with Offset decorations")); +} + +TEST_F(ValidateDecorations, BlockGLSLSharedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output Block + OpDecorate %Output GLSLShared + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Output = OpTypeStruct %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLShared decoration")); +} + +TEST_F(ValidateDecorations, BufferBlockGLSLSharedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output BufferBlock + OpDecorate %Output GLSLShared + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Output = OpTypeStruct %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLShared decoration")); +} + +TEST_F(ValidateDecorations, BlockNestedStructGLSLSharedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %S GLSLShared + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLShared decoration")); +} + +TEST_F(ValidateDecorations, BufferBlockNestedStructGLSLSharedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %S GLSLShared + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLShared decoration")); +} + +TEST_F(ValidateDecorations, BlockGLSLPackedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output Block + OpDecorate %Output GLSLPacked + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Output = OpTypeStruct %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLPacked decoration")); +} + +TEST_F(ValidateDecorations, BufferBlockGLSLPackedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output BufferBlock + OpDecorate %Output GLSLPacked + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %Output = OpTypeStruct %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLPacked decoration")); +} + +TEST_F(ValidateDecorations, BlockNestedStructGLSLPackedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %S GLSLPacked + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLPacked decoration")); +} + +TEST_F(ValidateDecorations, BufferBlockNestedStructGLSLPackedBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpDecorate %S GLSLPacked + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %S = OpTypeStruct %int + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("must not use GLSLPacked decoration")); +} + +TEST_F(ValidateDecorations, BlockMissingArrayStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output Block + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %array = OpTypeArray %float %int_3 + %Output = OpTypeStruct %array +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockMissingArrayStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output BufferBlock + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %array = OpTypeArray %float %int_3 + %Output = OpTypeStruct %array +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride decorations")); +} + +TEST_F(ValidateDecorations, BlockNestedStructMissingArrayStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %array = OpTypeArray %float %int_3 + %S = OpTypeStruct %array + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockNestedStructMissingArrayStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %array = OpTypeArray %float %int_3 + %S = OpTypeStruct %array + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with ArrayStride decorations")); +} + +TEST_F(ValidateDecorations, BlockMissingMatrixStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output Block + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %matrix = OpTypeMatrix %v3float 4 + %Output = OpTypeStruct %matrix +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with MatrixStride decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockMissingMatrixStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output BufferBlock + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %matrix = OpTypeMatrix %v3float 4 + %Output = OpTypeStruct %matrix +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with MatrixStride decorations")); +} + +TEST_F(ValidateDecorations, BlockMissingMatrixStrideArrayBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output Block + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %matrix = OpTypeMatrix %v3float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %array = OpTypeArray %matrix %int_3 + %Output = OpTypeStruct %matrix +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with MatrixStride decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockMissingMatrixStrideArrayBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %Output BufferBlock + OpMemberDecorate %Output 0 Offset 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %matrix = OpTypeMatrix %v3float 4 + %int = OpTypeInt 32 1 + %int_3 = OpConstant %int 3 + %array = OpTypeArray %matrix %int_3 + %Output = OpTypeStruct %matrix +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with MatrixStride decorations")); +} + +TEST_F(ValidateDecorations, BlockNestedStructMissingMatrixStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %matrix = OpTypeMatrix %v3float 4 + %S = OpTypeStruct %matrix + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with MatrixStride decorations")); +} + +TEST_F(ValidateDecorations, BufferBlockNestedStructMissingMatrixStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 16 + OpMemberDecorate %Output 2 Offset 32 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %v4float = OpTypeVector %float 4 + %matrix = OpTypeMatrix %v3float 4 + %S = OpTypeStruct %matrix + %Output = OpTypeStruct %float %v4float %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("must be explicitly laid out with MatrixStride decorations")); +} + +TEST_F(ValidateDecorations, BlockStandardUniformBufferLayout) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %F 0 Offset 0 + OpMemberDecorate %F 1 Offset 8 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %_arr_mat3v3float_uint_2 ArrayStride 48 + OpMemberDecorate %O 0 Offset 0 + OpMemberDecorate %O 1 Offset 16 + OpMemberDecorate %O 2 Offset 32 + OpMemberDecorate %O 3 Offset 64 + OpMemberDecorate %O 4 ColMajor + OpMemberDecorate %O 4 Offset 80 + OpMemberDecorate %O 4 MatrixStride 16 + OpDecorate %_arr_O_uint_2 ArrayStride 176 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 8 + OpMemberDecorate %Output 2 Offset 16 + OpMemberDecorate %Output 3 Offset 32 + OpMemberDecorate %Output 4 Offset 48 + OpMemberDecorate %Output 5 Offset 64 + OpMemberDecorate %Output 6 ColMajor + OpMemberDecorate %Output 6 Offset 96 + OpMemberDecorate %Output 6 MatrixStride 16 + OpMemberDecorate %Output 7 Offset 128 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %F = OpTypeStruct %int %v2uint + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%mat2v3float = OpTypeMatrix %v3float 2 + %v3uint = OpTypeVector %uint 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_arr_mat3v3float_uint_2 = OpTypeArray %mat3v3float %uint_2 + %O = OpTypeStruct %v3uint %v2float %_arr_float_uint_2 %v2float %_arr_mat3v3float_uint_2 +%_arr_O_uint_2 = OpTypeArray %O %uint_2 + %Output = OpTypeStruct %float %v2float %v3float %F %float %_arr_float_uint_2 %mat2v3float %_arr_O_uint_2 +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, BlockLayoutPermitsTightVec3ScalarPackingGood) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/1666 + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 12 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %v3float %float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %B = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, BlockLayoutForbidsTightScalarVec3PackingBad) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/1666 + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %B = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Structure id 2 decorated as Block for variable in Uniform " + "storage class must follow standard uniform buffer layout " + "rules: member 1 at offset 4 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, + BlockLayoutPermitsTightScalarVec3PackingWithRelaxedLayoutGood) { + // Same as previous test, but with explicit option to relax block layout. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %B = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + spvValidatorOptionsSetRelaxBlockLayout(getValidatorOptions(), true); + EXPECT_EQ(SPV_SUCCESS, + ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, + BlockLayoutPermitsTightScalarVec3PackingBadOffsetWithRelaxedLayoutBad) { + // Same as previous test, but with the vector not aligned to its scalar + // element. Use offset 5 instead of a multiple of 4. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 5 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %B = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + spvValidatorOptionsSetRelaxBlockLayout(getValidatorOptions(), true); + EXPECT_EQ(SPV_ERROR_INVALID_ID, + ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 2 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 1 at " + "offset 5 is not aligned to scalar element size 4")); +} + +TEST_F(ValidateDecorations, + BlockLayoutPermitsTightScalarVec3PackingWithVulkan1_1Good) { + // Same as previous test, but with Vulkan 1.1. Vulkan 1.1 included + // VK_KHR_relaxed_block_layout in core. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %B = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, + ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, BufferBlock16bitStandardStorageBufferLayout) { + std::string spirv = R"( + OpCapability Shader + OpCapability StorageUniform16 + OpExtension "SPV_KHR_16bit_storage" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpDecorate %f32arr ArrayStride 4 + OpDecorate %f16arr ArrayStride 2 + OpMemberDecorate %SSBO32 0 Offset 0 + OpMemberDecorate %SSBO16 0 Offset 0 + OpDecorate %SSBO32 BufferBlock + OpDecorate %SSBO16 BufferBlock + %void = OpTypeVoid + %voidf = OpTypeFunction %void + %u32 = OpTypeInt 32 0 + %i32 = OpTypeInt 32 1 + %f32 = OpTypeFloat 32 + %uvec3 = OpTypeVector %u32 3 + %c_i32_32 = OpConstant %i32 32 +%c_i32_128 = OpConstant %i32 128 + %f32arr = OpTypeArray %f32 %c_i32_128 + %f16 = OpTypeFloat 16 + %f16arr = OpTypeArray %f16 %c_i32_128 + %SSBO32 = OpTypeStruct %f32arr + %SSBO16 = OpTypeStruct %f16arr +%_ptr_Uniform_SSBO32 = OpTypePointer Uniform %SSBO32 + %varSSBO32 = OpVariable %_ptr_Uniform_SSBO32 Uniform +%_ptr_Uniform_SSBO16 = OpTypePointer Uniform %SSBO16 + %varSSBO16 = OpVariable %_ptr_Uniform_SSBO16 Uniform + %main = OpFunction %void None %voidf + %label = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, BlockArrayBaseAlignmentGood) { + // For uniform buffer, Array base alignment is 16, and ArrayStride + // must be a multiple of 16. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 16 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_PushConstant_S = OpTypePointer PushConstant %S + %u = OpVariable %_ptr_PushConstant_S PushConstant + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, BlockArrayBadAlignmentBad) { + // For uniform buffer, Array base alignment is 16. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_Uniform_S = OpTypePointer Uniform %S + %u = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in Uniform " + "storage class must follow standard uniform buffer layout rules: " + "member 1 at offset 8 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, BlockArrayBadAlignmentWithRelaxedLayoutStillBad) { + // For uniform buffer, Array base alignment is 16, and ArrayStride + // must be a multiple of 16. This case uses relaxed block layout. Relaxed + // layout only relaxes rules for vector alignment, not array alignment. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_Uniform_S = OpTypePointer Uniform %S + %u = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, + ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_0)); + spvValidatorOptionsSetRelaxBlockLayout(getValidatorOptions(), true); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in Uniform " + "storage class must follow standard uniform buffer layout rules: " + "member 1 at offset 8 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, BlockArrayBadAlignmentWithVulkan1_1StillBad) { + // Same as previous test, but with Vulkan 1.1, which includes + // VK_KHR_relaxed_block_layout in core. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_Uniform_S = OpTypePointer Uniform %S + %u = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, + ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in Uniform " + "storage class must follow standard uniform buffer layout rules: " + "member 1 at offset 8 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, PushConstantArrayBaseAlignmentGood) { + // Tests https://github.com/KhronosGroup/SPIRV-Tools/issues/1664 + // From GLSL vertex shader: + // #version 450 + // layout(push_constant) uniform S { vec2 v; float arr[2]; } u; + // void main() { } + + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_PushConstant_S = OpTypePointer PushConstant %S + %u = OpVariable %_ptr_PushConstant_S PushConstant + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, PushConstantArrayBadAlignmentBad) { + // Like the previous test, but with offset 7 instead of 8. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 7 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_PushConstant_S = OpTypePointer PushConstant %S + %u = OpVariable %_ptr_PushConstant_S PushConstant + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in PushConstant " + "storage class must follow standard storage buffer layout rules: " + "member 1 at offset 7 is not aligned to 4")); +} + +TEST_F(ValidateDecorations, + PushConstantLayoutPermitsTightVec3ScalarPackingGood) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/1666 + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 12 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %v3float %float +%_ptr_PushConstant_S = OpTypePointer PushConstant %S + %B = OpVariable %_ptr_PushConstant_S PushConstant + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, + PushConstantLayoutForbidsTightScalarVec3PackingBad) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/1666 + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %S Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_Uniform_S = OpTypePointer PushConstant %S + %B = OpVariable %_ptr_Uniform_S PushConstant + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 2 decorated as Block for variable in PushConstant " + "storage class must follow standard storage buffer layout " + "rules: member 1 at offset 4 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, StorageBufferStorageClassArrayBaseAlignmentGood) { + // Spot check buffer rules when using StorageBuffer storage class with Block + // decoration. + std::string spirv = R"( + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 8 + OpDecorate %S Block + OpDecorate %u DescriptorSet 0 + OpDecorate %u Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_Uniform_S = OpTypePointer StorageBuffer %S + %u = OpVariable %_ptr_Uniform_S StorageBuffer + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, StorageBufferStorageClassArrayBadAlignmentBad) { + // Like the previous test, but with offset 7. + std::string spirv = R"( + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 7 + OpDecorate %S Block + OpDecorate %u DescriptorSet 0 + OpDecorate %u Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %uint = OpTypeInt 32 0 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %S = OpTypeStruct %v2float %_arr_float_uint_2 +%_ptr_Uniform_S = OpTypePointer StorageBuffer %S + %u = OpVariable %_ptr_Uniform_S StorageBuffer + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in StorageBuffer " + "storage class must follow standard storage buffer layout rules: " + "member 1 at offset 7 is not aligned to 4")); +} + +TEST_F(ValidateDecorations, BufferBlockStandardStorageBufferLayout) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %F 0 Offset 0 + OpMemberDecorate %F 1 Offset 8 + OpDecorate %_arr_float_uint_2 ArrayStride 4 + OpDecorate %_arr_mat3v3float_uint_2 ArrayStride 48 + OpMemberDecorate %O 0 Offset 0 + OpMemberDecorate %O 1 Offset 16 + OpMemberDecorate %O 2 Offset 24 + OpMemberDecorate %O 3 Offset 32 + OpMemberDecorate %O 4 ColMajor + OpMemberDecorate %O 4 Offset 48 + OpMemberDecorate %O 4 MatrixStride 16 + OpDecorate %_arr_O_uint_2 ArrayStride 144 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 8 + OpMemberDecorate %Output 2 Offset 16 + OpMemberDecorate %Output 3 Offset 32 + OpMemberDecorate %Output 4 Offset 48 + OpMemberDecorate %Output 5 Offset 52 + OpMemberDecorate %Output 6 ColMajor + OpMemberDecorate %Output 6 Offset 64 + OpMemberDecorate %Output 6 MatrixStride 16 + OpMemberDecorate %Output 7 Offset 96 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %F = OpTypeStruct %int %v2uint + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%mat2v3float = OpTypeMatrix %v3float 2 + %v3uint = OpTypeVector %uint 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_arr_mat3v3float_uint_2 = OpTypeArray %mat3v3float %uint_2 + %O = OpTypeStruct %v3uint %v2float %_arr_float_uint_2 %v2float %_arr_mat3v3float_uint_2 +%_arr_O_uint_2 = OpTypeArray %O %uint_2 + %Output = OpTypeStruct %float %v2float %v3float %F %float %_arr_float_uint_2 %mat2v3float %_arr_O_uint_2 +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, + StorageBufferLayoutPermitsTightVec3ScalarPackingGood) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/1666 + std::string spirv = R"( + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 12 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %v3float %float +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %B = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, + StorageBufferLayoutForbidsTightScalarVec3PackingBad) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/1666 + std::string spirv = R"( + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 0 + OpMemberDecorate %S 1 Offset 4 + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S + %B = OpVariable %_ptr_StorageBuffer_S StorageBuffer + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 2 decorated as Block for variable in StorageBuffer " + "storage class must follow standard storage buffer layout " + "rules: member 1 at offset 4 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, + BlockStandardUniformBufferLayoutIncorrectOffset0Bad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %F 0 Offset 0 + OpMemberDecorate %F 1 Offset 8 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %_arr_mat3v3float_uint_2 ArrayStride 48 + OpMemberDecorate %O 0 Offset 0 + OpMemberDecorate %O 1 Offset 16 + OpMemberDecorate %O 2 Offset 24 + OpMemberDecorate %O 3 Offset 33 + OpMemberDecorate %O 4 ColMajor + OpMemberDecorate %O 4 Offset 80 + OpMemberDecorate %O 4 MatrixStride 16 + OpDecorate %_arr_O_uint_2 ArrayStride 176 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 8 + OpMemberDecorate %Output 2 Offset 16 + OpMemberDecorate %Output 3 Offset 32 + OpMemberDecorate %Output 4 Offset 48 + OpMemberDecorate %Output 5 Offset 64 + OpMemberDecorate %Output 6 ColMajor + OpMemberDecorate %Output 6 Offset 96 + OpMemberDecorate %Output 6 MatrixStride 16 + OpMemberDecorate %Output 7 Offset 128 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %F = OpTypeStruct %int %v2uint + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%mat2v3float = OpTypeMatrix %v3float 2 + %v3uint = OpTypeVector %uint 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_arr_mat3v3float_uint_2 = OpTypeArray %mat3v3float %uint_2 + %O = OpTypeStruct %v3uint %v2float %_arr_float_uint_2 %v2float %_arr_mat3v3float_uint_2 +%_arr_O_uint_2 = OpTypeArray %O %uint_2 + %Output = OpTypeStruct %float %v2float %v3float %F %float %_arr_float_uint_2 %mat2v3float %_arr_O_uint_2 +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Structure id 6 decorated as Block for variable in Uniform " + "storage class must follow standard uniform buffer layout " + "rules: member 2 at offset 24 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, + BlockStandardUniformBufferLayoutIncorrectOffset1Bad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %F 0 Offset 0 + OpMemberDecorate %F 1 Offset 8 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %_arr_mat3v3float_uint_2 ArrayStride 48 + OpMemberDecorate %O 0 Offset 0 + OpMemberDecorate %O 1 Offset 16 + OpMemberDecorate %O 2 Offset 32 + OpMemberDecorate %O 3 Offset 64 + OpMemberDecorate %O 4 ColMajor + OpMemberDecorate %O 4 Offset 80 + OpMemberDecorate %O 4 MatrixStride 16 + OpDecorate %_arr_O_uint_2 ArrayStride 176 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 8 + OpMemberDecorate %Output 2 Offset 16 + OpMemberDecorate %Output 3 Offset 32 + OpMemberDecorate %Output 4 Offset 48 + OpMemberDecorate %Output 5 Offset 71 + OpMemberDecorate %Output 6 ColMajor + OpMemberDecorate %Output 6 Offset 96 + OpMemberDecorate %Output 6 MatrixStride 16 + OpMemberDecorate %Output 7 Offset 128 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %F = OpTypeStruct %int %v2uint + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%mat2v3float = OpTypeMatrix %v3float 2 + %v3uint = OpTypeVector %uint 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_arr_mat3v3float_uint_2 = OpTypeArray %mat3v3float %uint_2 + %O = OpTypeStruct %v3uint %v2float %_arr_float_uint_2 %v2float %_arr_mat3v3float_uint_2 +%_arr_O_uint_2 = OpTypeArray %O %uint_2 + %Output = OpTypeStruct %float %v2float %v3float %F %float %_arr_float_uint_2 %mat2v3float %_arr_O_uint_2 +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Structure id 8 decorated as Block for variable in Uniform " + "storage class must follow standard uniform buffer layout " + "rules: member 5 at offset 71 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, BlockUniformBufferLayoutIncorrectArrayStrideBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %F 0 Offset 0 + OpMemberDecorate %F 1 Offset 8 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpDecorate %_arr_mat3v3float_uint_2 ArrayStride 49 + OpMemberDecorate %O 0 Offset 0 + OpMemberDecorate %O 1 Offset 16 + OpMemberDecorate %O 2 Offset 32 + OpMemberDecorate %O 3 Offset 64 + OpMemberDecorate %O 4 ColMajor + OpMemberDecorate %O 4 Offset 80 + OpMemberDecorate %O 4 MatrixStride 16 + OpDecorate %_arr_O_uint_2 ArrayStride 176 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 8 + OpMemberDecorate %Output 2 Offset 16 + OpMemberDecorate %Output 3 Offset 32 + OpMemberDecorate %Output 4 Offset 48 + OpMemberDecorate %Output 5 Offset 64 + OpMemberDecorate %Output 6 ColMajor + OpMemberDecorate %Output 6 Offset 96 + OpMemberDecorate %Output 6 MatrixStride 16 + OpMemberDecorate %Output 7 Offset 128 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v2float = OpTypeVector %float 2 + %v3float = OpTypeVector %float 3 + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %F = OpTypeStruct %int %v2uint + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 +%mat2v3float = OpTypeMatrix %v3float 2 + %v3uint = OpTypeVector %uint 3 +%mat3v3float = OpTypeMatrix %v3float 3 +%_arr_mat3v3float_uint_2 = OpTypeArray %mat3v3float %uint_2 + %O = OpTypeStruct %v3uint %v2float %_arr_float_uint_2 %v2float %_arr_mat3v3float_uint_2 +%_arr_O_uint_2 = OpTypeArray %O %uint_2 + %Output = OpTypeStruct %float %v2float %v3float %F %float %_arr_float_uint_2 %mat2v3float %_arr_O_uint_2 +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 6 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 4 is " + "an array with stride 49 not satisfying alignment to 16")); +} + +TEST_F(ValidateDecorations, + BufferBlockStandardStorageBufferLayoutImproperStraddleBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 8 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %Output = OpTypeStruct %float %v3float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Structure id 3 decorated as BufferBlock for variable in " + "Uniform storage class must follow standard storage buffer " + "layout rules: member 1 at offset 8 is not aligned to 16")); +} + +TEST_F(ValidateDecorations, + BlockUniformBufferLayoutOffsetInsideArrayPaddingBad) { + // In this case the 2nd member fits entirely within the padding. + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpDecorate %_arr_float_uint_2 ArrayStride 16 + OpMemberDecorate %Output 0 Offset 0 + OpMemberDecorate %Output 1 Offset 20 + OpDecorate %Output Block + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %v2uint = OpTypeVector %uint 2 + %uint_2 = OpConstant %uint 2 +%_arr_float_uint_2 = OpTypeArray %float %uint_2 + %Output = OpTypeStruct %_arr_float_uint_2 %float +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 4 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 1 at " + "offset 20 overlaps previous member ending at offset 31")); +} + +TEST_F(ValidateDecorations, + BlockUniformBufferLayoutOffsetInsideStructPaddingBad) { + // In this case the 2nd member fits entirely within the padding. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %1 "main" + OpMemberDecorate %_struct_6 0 Offset 0 + OpMemberDecorate %_struct_2 0 Offset 0 + OpMemberDecorate %_struct_2 1 Offset 4 + OpDecorate %_struct_2 Block + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 + %_struct_6 = OpTypeStruct %float + %_struct_2 = OpTypeStruct %_struct_6 %float +%_ptr_Uniform__struct_2 = OpTypePointer Uniform %_struct_2 + %8 = OpVariable %_ptr_Uniform__struct_2 Uniform + %1 = OpFunction %void None %4 + %9 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 1 at " + "offset 4 overlaps previous member ending at offset 15")); +} + +TEST_F(ValidateDecorations, BlockLayoutOffsetOutOfOrderGoodUniversal1_0) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorate %Outer 0 Offset 4 + OpMemberDecorate %Outer 1 Offset 0 + OpDecorate %Outer Block + OpDecorate %O DescriptorSet 0 + OpDecorate %O Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %Outer = OpTypeStruct %uint %uint +%_ptr_Uniform_Outer = OpTypePointer Uniform %Outer + %O = OpVariable %_ptr_Uniform_Outer Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, + ValidateAndRetrieveValidationState(SPV_ENV_UNIVERSAL_1_0)); +} + +TEST_F(ValidateDecorations, BlockLayoutOffsetOutOfOrderGoodOpenGL4_5) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorate %Outer 0 Offset 4 + OpMemberDecorate %Outer 1 Offset 0 + OpDecorate %Outer Block + OpDecorate %O DescriptorSet 0 + OpDecorate %O Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %Outer = OpTypeStruct %uint %uint +%_ptr_Uniform_Outer = OpTypePointer Uniform %Outer + %O = OpVariable %_ptr_Uniform_Outer Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, + ValidateAndRetrieveValidationState(SPV_ENV_OPENGL_4_5)); +} + +TEST_F(ValidateDecorations, BlockLayoutOffsetOutOfOrderGoodVulkan1_1) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorate %Outer 0 Offset 4 + OpMemberDecorate %Outer 1 Offset 0 + OpDecorate %Outer Block + OpDecorate %O DescriptorSet 0 + OpDecorate %O Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %Outer = OpTypeStruct %uint %uint +%_ptr_Uniform_Outer = OpTypePointer Uniform %Outer + %O = OpVariable %_ptr_Uniform_Outer Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_1)) + << getDiagnosticString(); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, BlockLayoutOffsetOverlapBad) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpMemberDecorate %Outer 0 Offset 0 + OpMemberDecorate %Outer 1 Offset 16 + OpMemberDecorate %Inner 0 Offset 0 + OpMemberDecorate %Inner 1 Offset 16 + OpDecorate %Outer Block + OpDecorate %O DescriptorSet 0 + OpDecorate %O Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %Inner = OpTypeStruct %uint %uint + %Outer = OpTypeStruct %Inner %uint +%_ptr_Uniform_Outer = OpTypePointer Uniform %Outer + %O = OpVariable %_ptr_Uniform_Outer Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 3 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 1 at " + "offset 16 overlaps previous member ending at offset 31")); +} + +TEST_F(ValidateDecorations, BufferBlockEmptyStruct) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 430 + OpMemberDecorate %Output 0 Offset 0 + OpDecorate %Output BufferBlock + %void = OpTypeVoid + %3 = OpTypeFunction %void + %S = OpTypeStruct + %Output = OpTypeStruct %S +%_ptr_Uniform_Output = OpTypePointer Uniform %Output + %dataOutput = OpVariable %_ptr_Uniform_Output Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, RowMajorMatrixTightPackingGood) { + // Row major matrix rule: + // A row-major matrix of C columns has a base alignment equal to + // the base alignment of a vector of C matrix components. + // Note: The "matrix component" is the scalar element type. + + // The matrix has 3 columns and 2 rows (C=3, R=2). + // So the base alignment of b is the same as a vector of 3 floats, which is 16 + // bytes. The matrix consists of two of these, and therefore occupies 2 x 16 + // bytes, or 32 bytes. + // + // So the offsets can be: + // a -> 0 + // b -> 16 + // c -> 48 + // d -> 60 ; d fits at bytes 12-15 after offset of c. Tight (vec3;float) + // packing + + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpSource GLSL 450 + OpMemberDecorate %_struct_2 0 Offset 0 + OpMemberDecorate %_struct_2 1 RowMajor + OpMemberDecorate %_struct_2 1 Offset 16 + OpMemberDecorate %_struct_2 1 MatrixStride 16 + OpMemberDecorate %_struct_2 2 Offset 48 + OpMemberDecorate %_struct_2 3 Offset 60 + OpDecorate %_struct_2 Block + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 + %v3float = OpTypeVector %float 3 + %_struct_2 = OpTypeStruct %v4float %mat3v2float %v3float %float +%_ptr_Uniform__struct_2 = OpTypePointer Uniform %_struct_2 + %3 = OpVariable %_ptr_Uniform__struct_2 Uniform + %1 = OpFunction %void None %5 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, ArrayArrayRowMajorMatrixTightPackingGood) { + // Like the previous case, but we have an array of arrays of matrices. + // The RowMajor decoration goes on the struct member (surprisingly). + + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpSource GLSL 450 + OpMemberDecorate %_struct_2 0 Offset 0 + OpMemberDecorate %_struct_2 1 RowMajor + OpMemberDecorate %_struct_2 1 Offset 16 + OpMemberDecorate %_struct_2 1 MatrixStride 16 + OpMemberDecorate %_struct_2 2 Offset 80 + OpMemberDecorate %_struct_2 3 Offset 92 + OpDecorate %arr_mat ArrayStride 32 + OpDecorate %arr_arr_mat ArrayStride 32 + OpDecorate %_struct_2 Block + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 + %arr_mat = OpTypeArray %mat3v2float %uint_1 +%arr_arr_mat = OpTypeArray %arr_mat %uint_2 + %v3float = OpTypeVector %float 3 + %_struct_2 = OpTypeStruct %v4float %arr_arr_mat %v3float %float +%_ptr_Uniform__struct_2 = OpTypePointer Uniform %_struct_2 + %3 = OpVariable %_ptr_Uniform__struct_2 Uniform + %1 = OpFunction %void None %5 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()) + << getDiagnosticString(); +} + +TEST_F(ValidateDecorations, ArrayArrayRowMajorMatrixNextMemberOverlapsBad) { + // Like the previous case, but the offset of member 2 overlaps the matrix. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpSource GLSL 450 + OpMemberDecorate %_struct_2 0 Offset 0 + OpMemberDecorate %_struct_2 1 RowMajor + OpMemberDecorate %_struct_2 1 Offset 16 + OpMemberDecorate %_struct_2 1 MatrixStride 16 + OpMemberDecorate %_struct_2 2 Offset 64 + OpMemberDecorate %_struct_2 3 Offset 92 + OpDecorate %arr_mat ArrayStride 32 + OpDecorate %arr_arr_mat ArrayStride 32 + OpDecorate %_struct_2 Block + OpDecorate %3 DescriptorSet 0 + OpDecorate %3 Binding 0 + %void = OpTypeVoid + %5 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %v2float = OpTypeVector %float 2 +%mat3v2float = OpTypeMatrix %v2float 3 +%uint = OpTypeInt 32 0 +%uint_1 = OpConstant %uint 1 +%uint_2 = OpConstant %uint 2 + %arr_mat = OpTypeArray %mat3v2float %uint_1 +%arr_arr_mat = OpTypeArray %arr_mat %uint_2 + %v3float = OpTypeVector %float 3 + %_struct_2 = OpTypeStruct %v4float %arr_arr_mat %v3float %float +%_ptr_Uniform__struct_2 = OpTypePointer Uniform %_struct_2 + %3 = OpVariable %_ptr_Uniform__struct_2 Uniform + %1 = OpFunction %void None %5 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 2 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 2 at " + "offset 64 overlaps previous member ending at offset 79")); +} + +TEST_F(ValidateDecorations, StorageBufferArraySizeCalculationPackGood) { + // Original GLSL + + // #version 450 + // layout (set=0,binding=0) buffer S { + // uvec3 arr[2][2]; // first 3 elements are 16 bytes, last is 12 + // uint i; // Can have offset 60 = 3x16 + 12 + // } B; + // void main() {} + + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpDecorate %_arr_v3uint_uint_2 ArrayStride 16 + OpDecorate %_arr__arr_v3uint_uint_2_uint_2 ArrayStride 32 + OpMemberDecorate %_struct_4 0 Offset 0 + OpMemberDecorate %_struct_4 1 Offset 60 + OpDecorate %_struct_4 BufferBlock + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_2 = OpConstant %uint 2 +%_arr_v3uint_uint_2 = OpTypeArray %v3uint %uint_2 +%_arr__arr_v3uint_uint_2_uint_2 = OpTypeArray %_arr_v3uint_uint_2 %uint_2 + %_struct_4 = OpTypeStruct %_arr__arr_v3uint_uint_2_uint_2 %uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %7 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, StorageBufferArraySizeCalculationPackBad) { + // Like previous but, the offset of the second member is too small. + + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpDecorate %_arr_v3uint_uint_2 ArrayStride 16 + OpDecorate %_arr__arr_v3uint_uint_2_uint_2 ArrayStride 32 + OpMemberDecorate %_struct_4 0 Offset 0 + OpMemberDecorate %_struct_4 1 Offset 56 + OpDecorate %_struct_4 BufferBlock + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_2 = OpConstant %uint 2 +%_arr_v3uint_uint_2 = OpTypeArray %v3uint %uint_2 +%_arr__arr_v3uint_uint_2_uint_2 = OpTypeArray %_arr_v3uint_uint_2 %uint_2 + %_struct_4 = OpTypeStruct %_arr__arr_v3uint_uint_2_uint_2 %uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %7 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Structure id 4 decorated as BufferBlock for variable " + "in Uniform storage class must follow standard storage " + "buffer layout rules: member 1 at offset 56 overlaps " + "previous member ending at offset 59")); +} + +TEST_F(ValidateDecorations, UniformBufferArraySizeCalculationPackGood) { + // Like the corresponding buffer block case, but the array padding must + // count for the last element as well, and so the offset of the second + // member must be at least 64. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpDecorate %_arr_v3uint_uint_2 ArrayStride 16 + OpDecorate %_arr__arr_v3uint_uint_2_uint_2 ArrayStride 32 + OpMemberDecorate %_struct_4 0 Offset 0 + OpMemberDecorate %_struct_4 1 Offset 64 + OpDecorate %_struct_4 Block + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_2 = OpConstant %uint 2 +%_arr_v3uint_uint_2 = OpTypeArray %v3uint %uint_2 +%_arr__arr_v3uint_uint_2_uint_2 = OpTypeArray %_arr_v3uint_uint_2 %uint_2 + %_struct_4 = OpTypeStruct %_arr__arr_v3uint_uint_2_uint_2 %uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %7 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateDecorations, UniformBufferArraySizeCalculationPackBad) { + // Like previous but, the offset of the second member is too small. + + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %1 "main" + OpDecorate %_arr_v3uint_uint_2 ArrayStride 16 + OpDecorate %_arr__arr_v3uint_uint_2_uint_2 ArrayStride 32 + OpMemberDecorate %_struct_4 0 Offset 0 + OpMemberDecorate %_struct_4 1 Offset 60 + OpDecorate %_struct_4 Block + OpDecorate %5 DescriptorSet 0 + OpDecorate %5 Binding 0 + %void = OpTypeVoid + %7 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 + %uint_2 = OpConstant %uint 2 +%_arr_v3uint_uint_2 = OpTypeArray %v3uint %uint_2 +%_arr__arr_v3uint_uint_2_uint_2 = OpTypeArray %_arr_v3uint_uint_2 %uint_2 + %_struct_4 = OpTypeStruct %_arr__arr_v3uint_uint_2_uint_2 %uint +%_ptr_Uniform__struct_4 = OpTypePointer Uniform %_struct_4 + %5 = OpVariable %_ptr_Uniform__struct_4 Uniform + %1 = OpFunction %void None %7 + %12 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateAndRetrieveValidationState()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure id 4 decorated as Block for variable in Uniform storage " + "class must follow standard uniform buffer layout rules: member 1 at " + "offset 60 overlaps previous member ending at offset 63")); +} + +TEST_F(ValidateDecorations, LayoutNotCheckedWhenSkipBlockLayout) { + // Checks that block layout is not verified in skipping block layout mode. + // Even for obviously wrong layout. + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpSource GLSL 450 + OpMemberDecorate %S 0 Offset 3 ; wrong alignment + OpMemberDecorate %S 1 Offset 3 ; same offset as before! + OpDecorate %S Block + OpDecorate %B DescriptorSet 0 + OpDecorate %B Binding 0 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v3float = OpTypeVector %float 3 + %S = OpTypeStruct %float %v3float +%_ptr_Uniform_S = OpTypePointer Uniform %S + %B = OpVariable %_ptr_Uniform_S Uniform + %main = OpFunction %void None %3 + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv); + spvValidatorOptionsSetSkipBlockLayout(getValidatorOptions(), true); + EXPECT_EQ(SPV_SUCCESS, + ValidateAndRetrieveValidationState(SPV_ENV_VULKAN_1_0)); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, EntryPointVariableWrongStorageClass) { + const std::string spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" %var +%void = OpTypeVoid +%int = OpTypeInt 32 0 +%ptr_int_Workgroup = OpTypePointer Workgroup %int +%var = OpVariable %ptr_int_Workgroup Workgroup +%func_ty = OpTypeFunction %void +%1 = OpFunction %void None %func_ty +%2 = OpLabel +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpEntryPoint interfaces must be OpVariables with " + "Storage Class of Input(1) or Output(3). Found Storage " + "Class 4 for Entry Point id 1.")); +} +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_derivatives_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_derivatives_test.cpp new file mode 100644 index 00000000000..93a70e87cf6 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_derivatives_test.cpp @@ -0,0 +1,155 @@ +// Copyright (c) 2017 Google 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateDerivatives = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& execution_model = "Fragment") { + std::stringstream ss; + ss << R"( +OpCapability Shader +OpCapability DerivativeControl +)"; + + ss << capabilities_and_extensions; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"" + << " %f32_var_input" + << " %f32vec4_var_input" + << "\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f32vec4 = OpTypeVector %f32 4 + +%f32_ptr_input = OpTypePointer Input %f32 +%f32_var_input = OpVariable %f32_ptr_input Input + +%f32vec4_ptr_input = OpTypePointer Input %f32vec4 +%f32vec4_var_input = OpVariable %f32vec4_ptr_input Input + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +TEST_F(ValidateDerivatives, ScalarSuccess) { + const std::string body = R"( +%f32_var = OpLoad %f32 %f32_var_input +%val1 = OpDPdx %f32 %f32_var +%val2 = OpDPdy %f32 %f32_var +%val3 = OpFwidth %f32 %f32_var +%val4 = OpDPdxFine %f32 %f32_var +%val5 = OpDPdyFine %f32 %f32_var +%val6 = OpFwidthFine %f32 %f32_var +%val7 = OpDPdxCoarse %f32 %f32_var +%val8 = OpDPdyCoarse %f32 %f32_var +%val9 = OpFwidthCoarse %f32 %f32_var +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateDerivatives, VectorSuccess) { + const std::string body = R"( +%f32vec4_var = OpLoad %f32vec4 %f32vec4_var_input +%val1 = OpDPdx %f32vec4 %f32vec4_var +%val2 = OpDPdy %f32vec4 %f32vec4_var +%val3 = OpFwidth %f32vec4 %f32vec4_var +%val4 = OpDPdxFine %f32vec4 %f32vec4_var +%val5 = OpDPdyFine %f32vec4 %f32vec4_var +%val6 = OpFwidthFine %f32vec4 %f32vec4_var +%val7 = OpDPdxCoarse %f32vec4 %f32vec4_var +%val8 = OpDPdyCoarse %f32vec4 %f32vec4_var +%val9 = OpFwidthCoarse %f32vec4 %f32vec4_var +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateDerivatives, OpDPdxWrongResultType) { + const std::string body = R"( +%f32_var = OpLoad %f32 %f32_var_input +%val1 = OpDPdx %u32 %f32vec4 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be float scalar or vector type: " + "DPdx")); +} + +TEST_F(ValidateDerivatives, OpDPdxWrongPType) { + const std::string body = R"( +%f32vec4_var = OpLoad %f32vec4 %f32vec4_var_input +%val1 = OpDPdx %f32 %f32vec4_var +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected P type and Result Type to be the same: " + "DPdx")); +} + +TEST_F(ValidateDerivatives, OpDPdxWrongExecutionModel) { + const std::string body = R"( +%f32vec4_var = OpLoad %f32vec4 %f32vec4_var_input +%val1 = OpDPdx %f32vec4 %f32vec4_var +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex").c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Derivative instructions require Fragment execution model: DPdx")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_explicit_reserved_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_explicit_reserved_test.cpp new file mode 100644 index 00000000000..f01e933faeb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_explicit_reserved_test.cpp @@ -0,0 +1,122 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Validation tests for illegal instructions + +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Eq; +using ::testing::HasSubstr; + +using ReservedSamplingInstTest = spvtest::ValidateBase; + +// Generate a shader for use with validation tests for sparse sampling +// instructions. +std::string ShaderAssembly(const std::string& instruction_under_test) { + std::ostringstream os; + os << R"( OpCapability Shader + OpCapability SparseResidency + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %1 "main" + OpExecutionMode %1 OriginUpperLeft + OpSource GLSL 450 + OpDecorate %2 DescriptorSet 0 + OpDecorate %2 Binding 0 + %void = OpTypeVoid + %4 = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %float_0 = OpConstant %float 0 + %8 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 + %9 = OpTypeImage %float 2D 0 0 0 1 Unknown + %10 = OpTypeSampledImage %9 +%_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10 + %2 = OpVariable %_ptr_UniformConstant_10 UniformConstant + %v2float = OpTypeVector %float 2 + %13 = OpConstantComposite %v2float %float_0 %float_0 + %int = OpTypeInt 32 1 + %_struct_15 = OpTypeStruct %int %v4float + %1 = OpFunction %void None %4 + %16 = OpLabel + %17 = OpLoad %10 %2 +)" << instruction_under_test + << R"( + OpReturn + OpFunctionEnd +)"; + + return os.str(); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjImplicitLod) { + const std::string input = ShaderAssembly( + "%result = OpImageSparseSampleProjImplicitLod %_struct_15 %17 %13"); + CompileSuccessfully(input); + + EXPECT_THAT(ValidateInstructions(), Eq(SPV_ERROR_INVALID_BINARY)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Invalid Opcode name 'OpImageSparseSampleProjImplicitLod'")); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjExplicitLod) { + const std::string input = ShaderAssembly( + "%result = OpImageSparseSampleProjExplicitLod %_struct_15 %17 %13 Lod " + "%float_0\n"); + CompileSuccessfully(input); + + EXPECT_THAT(ValidateInstructions(), Eq(SPV_ERROR_INVALID_BINARY)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Invalid Opcode name 'OpImageSparseSampleProjExplicitLod'")); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjDrefImplicitLod) { + const std::string input = ShaderAssembly( + "%result = OpImageSparseSampleProjDrefImplicitLod %_struct_15 %17 %13 " + "%float_0\n"); + CompileSuccessfully(input); + + EXPECT_THAT(ValidateInstructions(), Eq(SPV_ERROR_INVALID_BINARY)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Invalid Opcode name 'OpImageSparseSampleProjDrefImplicitLod'")); +} + +TEST_F(ReservedSamplingInstTest, OpImageSparseSampleProjDrefExplicitLod) { + const std::string input = ShaderAssembly( + "%result = OpImageSparseSampleProjDrefExplicitLod %_struct_15 %17 %13 " + "%float_0 Lod " + "%float_0\n"); + CompileSuccessfully(input); + + EXPECT_THAT(ValidateInstructions(), Eq(SPV_ERROR_INVALID_BINARY)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Invalid Opcode name 'OpImageSparseSampleProjDrefExplicitLod'")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp new file mode 100644 index 00000000000..40126fd9d60 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp @@ -0,0 +1,5819 @@ +// Copyright (c) 2017 Google 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. + +// Tests validation rules of GLSL.450.std and OpenCL.std extended instructions. +// Doesn't test OpenCL.std vector size 2, 3, 4, 8 or 16 rules (not supported +// by standard SPIR-V). + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Eq; +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateExtInst = spvtest::ValidateBase; +using ValidateGlslStd450SqrtLike = spvtest::ValidateBase; +using ValidateGlslStd450FMinLike = spvtest::ValidateBase; +using ValidateGlslStd450FClampLike = spvtest::ValidateBase; +using ValidateGlslStd450SAbsLike = spvtest::ValidateBase; +using ValidateGlslStd450UMinLike = spvtest::ValidateBase; +using ValidateGlslStd450UClampLike = spvtest::ValidateBase; +using ValidateGlslStd450SinLike = spvtest::ValidateBase; +using ValidateGlslStd450PowLike = spvtest::ValidateBase; +using ValidateGlslStd450Pack = spvtest::ValidateBase; +using ValidateGlslStd450Unpack = spvtest::ValidateBase; +using ValidateOpenCLStdSqrtLike = spvtest::ValidateBase; +using ValidateOpenCLStdFMinLike = spvtest::ValidateBase; +using ValidateOpenCLStdFClampLike = spvtest::ValidateBase; +using ValidateOpenCLStdSAbsLike = spvtest::ValidateBase; +using ValidateOpenCLStdUMinLike = spvtest::ValidateBase; +using ValidateOpenCLStdUClampLike = spvtest::ValidateBase; +using ValidateOpenCLStdUMul24Like = spvtest::ValidateBase; +using ValidateOpenCLStdUMad24Like = spvtest::ValidateBase; +using ValidateOpenCLStdLengthLike = spvtest::ValidateBase; +using ValidateOpenCLStdDistanceLike = spvtest::ValidateBase; +using ValidateOpenCLStdNormalizeLike = spvtest::ValidateBase; +using ValidateOpenCLStdVStoreHalfLike = spvtest::ValidateBase; +using ValidateOpenCLStdVLoadHalfLike = spvtest::ValidateBase; +using ValidateOpenCLStdFractLike = spvtest::ValidateBase; +using ValidateOpenCLStdFrexpLike = spvtest::ValidateBase; +using ValidateOpenCLStdLdexpLike = spvtest::ValidateBase; +using ValidateOpenCLStdUpsampleLike = spvtest::ValidateBase; + +// Returns number of components in Pack/Unpack extended instructions. +// |ext_inst_name| is expected to be of the format "PackHalf2x16". +// Number of components is assumed to be single-digit. +uint32_t GetPackedNumComponents(const std::string& ext_inst_name) { + const size_t x_index = ext_inst_name.find_last_of('x'); + const std::string num_components_str = + ext_inst_name.substr(x_index - 1, x_index); + return uint32_t(std::stoul(num_components_str)); +} + +// Returns packed bit width in Pack/Unpack extended instructions. +// |ext_inst_name| is expected to be of the format "PackHalf2x16". +uint32_t GetPackedBitWidth(const std::string& ext_inst_name) { + const size_t x_index = ext_inst_name.find_last_of('x'); + const std::string packed_bit_width_str = ext_inst_name.substr(x_index + 1); + return uint32_t(std::stoul(packed_bit_width_str)); +} + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& execution_model = "Fragment") { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability Float16 +OpCapability Float64 +OpCapability Int16 +OpCapability Int64 +)"; + + ss << capabilities_and_extensions; + ss << "%extinst = OpExtInstImport \"GLSL.std.450\"\n"; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"" + << " %f32_output" + << " %f32vec2_output" + << " %u32_output" + << " %u32vec2_output" + << " %u64_output" + << " %f32_input" + << " %f32vec2_input" + << " %u32_input" + << " %u32vec2_input" + << " %u64_input" + << "\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f16 = OpTypeFloat 16 +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%u16 = OpTypeInt 16 0 +%s16 = OpTypeInt 16 1 +%f32vec2 = OpTypeVector %f32 2 +%f32vec3 = OpTypeVector %f32 3 +%f32vec4 = OpTypeVector %f32 4 +%f64vec2 = OpTypeVector %f64 2 +%f64vec3 = OpTypeVector %f64 3 +%f64vec4 = OpTypeVector %f64 4 +%u32vec2 = OpTypeVector %u32 2 +%u32vec3 = OpTypeVector %u32 3 +%s32vec2 = OpTypeVector %s32 2 +%u32vec4 = OpTypeVector %u32 4 +%s32vec4 = OpTypeVector %s32 4 +%u64vec2 = OpTypeVector %u64 2 +%s64vec2 = OpTypeVector %s64 2 +%f64mat22 = OpTypeMatrix %f64vec2 2 +%f32mat22 = OpTypeMatrix %f32vec2 2 +%f32mat23 = OpTypeMatrix %f32vec2 3 +%f32mat32 = OpTypeMatrix %f32vec3 2 +%f32mat33 = OpTypeMatrix %f32vec3 3 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_h = OpConstant %f32 0.5 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 + +%f16_0 = OpConstant %f16 0 +%f16_1 = OpConstant %f16 1 +%f16_h = OpConstant %f16 0.5 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 + +%s64_0 = OpConstant %s64 0 +%s64_1 = OpConstant %s64 1 +%s64_2 = OpConstant %s64 2 +%s64_3 = OpConstant %s64 3 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 + +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 + +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 + +%s64vec2_01 = OpConstantComposite %s64vec2 %s64_0 %s64_1 +%u64vec2_01 = OpConstantComposite %u64vec2 %u64_0 %u64_1 + +%f32mat22_1212 = OpConstantComposite %f32mat22 %f32vec2_12 %f32vec2_12 +%f32mat23_121212 = OpConstantComposite %f32mat23 %f32vec2_12 %f32vec2_12 %f32vec2_12 + +%f32_ptr_output = OpTypePointer Output %f32 +%f32vec2_ptr_output = OpTypePointer Output %f32vec2 + +%u32_ptr_output = OpTypePointer Output %u32 +%u32vec2_ptr_output = OpTypePointer Output %u32vec2 + +%u64_ptr_output = OpTypePointer Output %u64 + +%f32_output = OpVariable %f32_ptr_output Output +%f32vec2_output = OpVariable %f32vec2_ptr_output Output + +%u32_output = OpVariable %u32_ptr_output Output +%u32vec2_output = OpVariable %u32vec2_ptr_output Output + +%u64_output = OpVariable %u64_ptr_output Output + +%f32_ptr_input = OpTypePointer Input %f32 +%f32vec2_ptr_input = OpTypePointer Input %f32vec2 + +%u32_ptr_input = OpTypePointer Input %u32 +%u32vec2_ptr_input = OpTypePointer Input %u32vec2 + +%u64_ptr_input = OpTypePointer Input %u64 + +%f32_input = OpVariable %f32_ptr_input Input +%f32vec2_input = OpVariable %f32vec2_ptr_input Input + +%u32_input = OpVariable %u32_ptr_input Input +%u32vec2_input = OpVariable %u32vec2_ptr_input Input + +%u64_input = OpVariable %u64_ptr_input Input + +%struct_f16_u16 = OpTypeStruct %f16 %u16 +%struct_f32_f32 = OpTypeStruct %f32 %f32 +%struct_f32_f32_f32 = OpTypeStruct %f32 %f32 %f32 +%struct_f32_u32 = OpTypeStruct %f32 %u32 +%struct_f32_u32_f32 = OpTypeStruct %f32 %u32 %f32 +%struct_u32_f32 = OpTypeStruct %u32 %f32 +%struct_u32_u32 = OpTypeStruct %u32 %u32 +%struct_f32_f64 = OpTypeStruct %f32 %f64 +%struct_f32vec2_f32vec2 = OpTypeStruct %f32vec2 %f32vec2 +%struct_f32vec2_u32vec2 = OpTypeStruct %f32vec2 %u32vec2 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +std::string GenerateKernelCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& memory_model = "Physical32") { + std::ostringstream ss; + ss << R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability GenericPointer +OpCapability Int8 +OpCapability Int16 +OpCapability Int64 +OpCapability Float16 +OpCapability Float64 +OpCapability Vector16 +OpCapability Matrix +)"; + + ss << capabilities_and_extensions; + ss << "%extinst = OpExtInstImport \"OpenCL.std\"\n"; + ss << "OpMemoryModel " << memory_model << " OpenCL\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f16 = OpTypeFloat 16 +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%u16 = OpTypeInt 16 0 +%u8 = OpTypeInt 8 0 +%f32vec2 = OpTypeVector %f32 2 +%f32vec3 = OpTypeVector %f32 3 +%f32vec4 = OpTypeVector %f32 4 +%f32vec8 = OpTypeVector %f32 8 +%f16vec8 = OpTypeVector %f16 8 +%f32vec16 = OpTypeVector %f32 16 +%f64vec2 = OpTypeVector %f64 2 +%f64vec3 = OpTypeVector %f64 3 +%f64vec4 = OpTypeVector %f64 4 +%u32vec2 = OpTypeVector %u32 2 +%u32vec3 = OpTypeVector %u32 3 +%u32vec4 = OpTypeVector %u32 4 +%u32vec8 = OpTypeVector %u32 8 +%u64vec2 = OpTypeVector %u64 2 +%f64mat22 = OpTypeMatrix %f64vec2 2 +%f32mat22 = OpTypeMatrix %f32vec2 2 +%f32mat23 = OpTypeMatrix %f32vec2 3 +%f32mat32 = OpTypeMatrix %f32vec3 2 +%f32mat33 = OpTypeMatrix %f32vec3 3 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_h = OpConstant %f32 0.5 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 +%f32vec8_01010101 = OpConstantComposite %f32vec8 %f32_0 %f32_1 %f32_0 %f32_1 %f32_0 %f32_1 %f32_0 %f32_1 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 + +%f16_0 = OpConstant %f16 0 +%f16_1 = OpConstant %f16 1 + +%u8_0 = OpConstant %u8 0 +%u8_1 = OpConstant %u8 1 +%u8_2 = OpConstant %u8 2 +%u8_3 = OpConstant %u8 3 + +%u16_0 = OpConstant %u16 0 +%u16_1 = OpConstant %u16 1 +%u16_2 = OpConstant %u16 2 +%u16_3 = OpConstant %u16 3 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_256 = OpConstant %u32 256 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_256 = OpConstant %u64 256 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 + +%u64vec2_01 = OpConstantComposite %u64vec2 %u64_0 %u64_1 + +%f32mat22_1212 = OpConstantComposite %f32mat22 %f32vec2_12 %f32vec2_12 +%f32mat23_121212 = OpConstantComposite %f32mat23 %f32vec2_12 %f32vec2_12 %f32vec2_12 + +%struct_f32_f32 = OpTypeStruct %f32 %f32 +%struct_f32_f32_f32 = OpTypeStruct %f32 %f32 %f32 +%struct_f32_u32 = OpTypeStruct %f32 %u32 +%struct_f32_u32_f32 = OpTypeStruct %f32 %u32 %f32 +%struct_u32_f32 = OpTypeStruct %u32 %f32 +%struct_u32_u32 = OpTypeStruct %u32 %u32 +%struct_f32_f64 = OpTypeStruct %f32 %f64 +%struct_f32vec2_f32vec2 = OpTypeStruct %f32vec2 %f32vec2 +%struct_f32vec2_u32vec2 = OpTypeStruct %f32vec2 %u32vec2 + +%f16vec8_ptr_workgroup = OpTypePointer Workgroup %f16vec8 +%f16vec8_workgroup = OpVariable %f16vec8_ptr_workgroup Workgroup +%f16_ptr_workgroup = OpTypePointer Workgroup %f16 + +%u32vec8_ptr_workgroup = OpTypePointer Workgroup %u32vec8 +%u32vec8_workgroup = OpVariable %u32vec8_ptr_workgroup Workgroup +%u32_ptr_workgroup = OpTypePointer Workgroup %u32 + +%f32vec8_ptr_workgroup = OpTypePointer Workgroup %f32vec8 +%f32vec8_workgroup = OpVariable %f32vec8_ptr_workgroup Workgroup +%f32_ptr_workgroup = OpTypePointer Workgroup %f32 + +%u32arr = OpTypeArray %u32 %u32_256 +%u32arr_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %u32arr +%u32arr_cross_workgroup = OpVariable %u32arr_ptr_cross_workgroup CrossWorkgroup +%u32_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %u32 + +%f32arr = OpTypeArray %f32 %u32_256 +%f32arr_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %f32arr +%f32arr_cross_workgroup = OpVariable %f32arr_ptr_cross_workgroup CrossWorkgroup +%f32_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %f32 + +%f32vec2arr = OpTypeArray %f32vec2 %u32_256 +%f32vec2arr_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %f32vec2arr +%f32vec2arr_cross_workgroup = OpVariable %f32vec2arr_ptr_cross_workgroup CrossWorkgroup +%f32vec2_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %f32vec2 + +%struct_arr = OpTypeArray %struct_f32_f32 %u32_256 +%struct_arr_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %struct_arr +%struct_arr_cross_workgroup = OpVariable %struct_arr_ptr_cross_workgroup CrossWorkgroup +%struct_ptr_cross_workgroup = OpTypePointer CrossWorkgroup %struct_f32_f32 + +%f16vec8_ptr_uniform_constant = OpTypePointer UniformConstant %f16vec8 +%f16vec8_uniform_constant = OpVariable %f16vec8_ptr_uniform_constant UniformConstant +%f16_ptr_uniform_constant = OpTypePointer UniformConstant %f16 + +%u32vec8_ptr_uniform_constant = OpTypePointer UniformConstant %u32vec8 +%u32vec8_uniform_constant = OpVariable %u32vec8_ptr_uniform_constant UniformConstant +%u32_ptr_uniform_constant = OpTypePointer UniformConstant %u32 + +%f32vec8_ptr_uniform_constant = OpTypePointer UniformConstant %f32vec8 +%f32vec8_uniform_constant = OpVariable %f32vec8_ptr_uniform_constant UniformConstant +%f32_ptr_uniform_constant = OpTypePointer UniformConstant %f32 + +%f16vec8_ptr_input = OpTypePointer Input %f16vec8 +%f16vec8_input = OpVariable %f16vec8_ptr_input Input +%f16_ptr_input = OpTypePointer Input %f16 + +%f32_ptr_generic = OpTypePointer Generic %f32 +%u32_ptr_generic = OpTypePointer Generic %u32 + +%f32_ptr_function = OpTypePointer Function %f32 +%f32vec2_ptr_function = OpTypePointer Function %f32vec2 +%u32_ptr_function = OpTypePointer Function %u32 +%u64_ptr_function = OpTypePointer Function %u64 +%u32vec2_ptr_function = OpTypePointer Function %u32vec2 + +%u8arr = OpTypeArray %u8 %u32_256 +%u8arr_ptr_uniform_constant = OpTypePointer UniformConstant %u8arr +%u8arr_uniform_constant = OpVariable %u8arr_ptr_uniform_constant UniformConstant +%u8_ptr_uniform_constant = OpTypePointer UniformConstant %u8 +%u8_ptr_generic = OpTypePointer Generic %u8 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +TEST_P(ValidateGlslStd450SqrtLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32_0\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01\n"; + ss << "%val3 = OpExtInst %f64 %extinst " << ext_inst_name << " %f64_0\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450SqrtLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a float scalar " + "or vector type")); +} + +TEST_P(ValidateGlslStd450SqrtLike, IntOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllSqrtLike, ValidateGlslStd450SqrtLike, + ::testing::ValuesIn(std::vector{ + "Round", + "RoundEven", + "FAbs", + "Trunc", + "FSign", + "Floor", + "Ceil", + "Fract", + "Sqrt", + "InverseSqrt", + "Normalize", + }), ); + +TEST_P(ValidateGlslStd450FMinLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %f32vec2_12\n"; + ss << "%val3 = OpExtInst %f64 %extinst " << ext_inst_name + << " %f64_0 %f64_0\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450FMinLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a float scalar " + "or vector type")); +} + +TEST_P(ValidateGlslStd450FMinLike, IntOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateGlslStd450FMinLike, IntOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllFMinLike, ValidateGlslStd450FMinLike, + ::testing::ValuesIn(std::vector{ + "FMin", + "FMax", + "Step", + "Reflect", + "NMin", + "NMax", + }), ); + +TEST_P(ValidateGlslStd450FClampLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1 %f32_2\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %f32vec2_01 %f32vec2_12\n"; + ss << "%val3 = OpExtInst %f64 %extinst " << ext_inst_name + << " %f64_0 %f64_0 %f64_1\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450FClampLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32_0 %f32_1 %f32_2\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a float scalar " + "or vector type")); +} + +TEST_P(ValidateGlslStd450FClampLike, IntOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateGlslStd450FClampLike, IntOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateGlslStd450FClampLike, IntOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f32_1 %f32_0 %u32_2\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllFClampLike, ValidateGlslStd450FClampLike, + ::testing::ValuesIn(std::vector{ + "FClamp", + "FMix", + "SmoothStep", + "Fma", + "FaceForward", + "NClamp", + }), ); + +TEST_P(ValidateGlslStd450SAbsLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %s32 %extinst " << ext_inst_name << " %u32_1\n"; + ss << "%val2 = OpExtInst %s32 %extinst " << ext_inst_name << " %s32_1\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name << " %u32_1\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name << " %s32_1\n"; + ss << "%val5 = OpExtInst %s32vec2 %extinst " << ext_inst_name + << " %s32vec2_01\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %s32vec2_01\n"; + ss << "%val8 = OpExtInst %s32vec2 %extinst " << ext_inst_name + << " %u32vec2_01\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450SAbsLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be an int scalar " + "or vector type")); +} + +TEST_P(ValidateGlslStd450SAbsLike, FloatOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + " %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to be int scalars or " + "vectors")); +} + +TEST_P(ValidateGlslStd450SAbsLike, WrongDimOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + " %s32vec2_01\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same dimension as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450SAbsLike, WrongBitWidthOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s64 %extinst " + ext_inst_name + " %s32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same bit width as " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllSAbsLike, ValidateGlslStd450SAbsLike, + ::testing::ValuesIn(std::vector{ + "SAbs", + "SSign", + "FindILsb", + "FindUMsb", + "FindSMsb", + }), ); + +TEST_F(ValidateExtInst, FindUMsbNot32Bit) { + const std::string body = R"( +%val1 = OpExtInst %s64 %extinst FindUMsb %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FindUMsb: this instruction is currently " + "limited to 32-bit width components")); +} + +TEST_F(ValidateExtInst, FindSMsbNot32Bit) { + const std::string body = R"( +%val1 = OpExtInst %s64 %extinst FindSMsb %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FindSMsb: this instruction is currently " + "limited to 32-bit width components")); +} + +TEST_P(ValidateGlslStd450UMinLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %s32 %extinst " << ext_inst_name + << " %u32_1 %s32_2\n"; + ss << "%val2 = OpExtInst %s32 %extinst " << ext_inst_name + << " %s32_1 %u32_2\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %s32_2\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name + << " %s32_1 %u32_2\n"; + ss << "%val5 = OpExtInst %s32vec2 %extinst " << ext_inst_name + << " %s32vec2_01 %u32vec2_01\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %s32vec2_01\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %s32vec2_01 %u32vec2_01\n"; + ss << "%val8 = OpExtInst %s32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %s32vec2_01\n"; + ss << "%val9 = OpExtInst %s64 %extinst " << ext_inst_name + << " %u64_1 %s64_0\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450UMinLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0 %u32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be an int scalar " + "or vector type")); +} + +TEST_P(ValidateGlslStd450UMinLike, FloatOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + " %f32_0 %u32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to be int scalars or " + "vectors")); +} + +TEST_P(ValidateGlslStd450UMinLike, FloatOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + " %u32_0 %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to be int scalars or " + "vectors")); +} + +TEST_P(ValidateGlslStd450UMinLike, WrongDimOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %s32vec2_01 %s32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same dimension as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UMinLike, WrongDimOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %s32_0 %s32vec2_01\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same dimension as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UMinLike, WrongBitWidthOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s64 %extinst " + ext_inst_name + " %s32_0 %s64_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same bit width as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UMinLike, WrongBitWidthOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %s64 %extinst " + ext_inst_name + " %s64_0 %s32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same bit width as " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUMinLike, ValidateGlslStd450UMinLike, + ::testing::ValuesIn(std::vector{ + "UMin", + "SMin", + "UMax", + "SMax", + }), ); + +TEST_P(ValidateGlslStd450UClampLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %s32 %extinst " << ext_inst_name + << " %s32_0 %u32_1 %s32_2\n"; + ss << "%val2 = OpExtInst %s32 %extinst " << ext_inst_name + << " %u32_0 %s32_1 %u32_2\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name + << " %s32_0 %u32_1 %s32_2\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %s32_1 %u32_2\n"; + ss << "%val5 = OpExtInst %s32vec2 %extinst " << ext_inst_name + << " %s32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %s32vec2_01 %s32vec2_12\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %s32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val8 = OpExtInst %s32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %s32vec2_01 %s32vec2_12\n"; + ss << "%val9 = OpExtInst %s64 %extinst " << ext_inst_name + << " %u64_1 %s64_0 %s64_1\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450UClampLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be an int scalar " + "or vector type")); +} + +TEST_P(ValidateGlslStd450UClampLike, FloatOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to be int scalars or " + "vectors")); +} + +TEST_P(ValidateGlslStd450UClampLike, FloatOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to be int scalars or " + "vectors")); +} + +TEST_P(ValidateGlslStd450UClampLike, FloatOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to be int scalars or " + "vectors")); +} + +TEST_P(ValidateGlslStd450UClampLike, WrongDimOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %s32vec2_01 %s32_0 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same dimension as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UClampLike, WrongDimOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %s32_0 %s32vec2_01 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same dimension as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UClampLike, WrongDimOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s32 %extinst " + ext_inst_name + + " %s32_0 %u32_1 %s32vec2_01\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same dimension as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UClampLike, WrongBitWidthOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s64 %extinst " + ext_inst_name + + " %s32_0 %s64_0 %s64_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same bit width as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UClampLike, WrongBitWidthOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s64 %extinst " + ext_inst_name + + " %s64_0 %s32_0 %s64_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same bit width as " + "Result Type")); +} + +TEST_P(ValidateGlslStd450UClampLike, WrongBitWidthOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %s64 %extinst " + ext_inst_name + + " %s64_0 %s64_0 %s32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected all operands to have the same bit width as " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUClampLike, ValidateGlslStd450UClampLike, + ::testing::ValuesIn(std::vector{ + "UClamp", + "SClamp", + }), ); + +TEST_P(ValidateGlslStd450SinLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32_0\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450SinLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a 16 or 32-bit scalar " + "or vector float type")); +} + +TEST_P(ValidateGlslStd450SinLike, F64ResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f64 %extinst " + ext_inst_name + " %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a 16 or 32-bit scalar " + "or vector float type")); +} + +TEST_P(ValidateGlslStd450SinLike, IntOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllSinLike, ValidateGlslStd450SinLike, + ::testing::ValuesIn(std::vector{ + "Radians", + "Degrees", + "Sin", + "Cos", + "Tan", + "Asin", + "Acos", + "Atan", + "Sinh", + "Cosh", + "Tanh", + "Asinh", + "Acosh", + "Atanh", + "Exp", + "Exp2", + "Log", + "Log2", + }), ); + +TEST_P(ValidateGlslStd450PowLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_1 %f32_1\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %f32vec2_12\n"; + CompileSuccessfully(GenerateShaderCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450PowLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_1 %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a 16 or 32-bit scalar " + "or vector float type")); +} + +TEST_P(ValidateGlslStd450PowLike, F64ResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f64 %extinst " + ext_inst_name + " %f32_1 %f32_0\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected Result Type to be a 16 or 32-bit scalar " + "or vector float type")); +} + +TEST_P(ValidateGlslStd450PowLike, IntOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateGlslStd450PowLike, IntOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllPowLike, ValidateGlslStd450PowLike, + ::testing::ValuesIn(std::vector{ + "Atan2", + "Pow", + }), ); + +TEST_F(ValidateExtInst, GlslStd450DeterminantSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Determinant %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450DeterminantIncompatibleResultType) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst Determinant %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Determinant: " + "expected operand X component type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450DeterminantNotMatrix) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Determinant %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Determinant: " + "expected operand X to be a square matrix")); +} + +TEST_F(ValidateExtInst, GlslStd450DeterminantMatrixNotSquare) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Determinant %f32mat23_121212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Determinant: " + "expected operand X to be a square matrix")); +} + +TEST_F(ValidateExtInst, GlslStd450MatrixInverseSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32mat22 %extinst MatrixInverse %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450MatrixInverseIncompatibleResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32mat33 %extinst MatrixInverse %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 MatrixInverse: " + "expected operand X type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450MatrixInverseNotMatrix) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst MatrixInverse %f32mat22_1212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 MatrixInverse: " + "expected Result Type to be a square matrix")); +} + +TEST_F(ValidateExtInst, GlslStd450MatrixInverseMatrixNotSquare) { + const std::string body = R"( +%val1 = OpExtInst %f32mat23 %extinst MatrixInverse %f32mat23_121212 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 MatrixInverse: " + "expected Result Type to be a square matrix")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Modf %f32_h %f32_output +%val2 = OpExtInst %f32vec2 %extinst Modf %f32vec2_01 %f32vec2_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450ModfIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst Modf %f32_h %f32_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Modf: " + "expected Result Type to be a scalar or vector " + "float type")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfXNotOfResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Modf %f64_0 %f32_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Modf: " + "expected operand X type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfINotPointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Modf %f32_h %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Modf: " + "expected operand I to be a pointer")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfIDataNotOfResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Modf %f32_h %f32vec2_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Modf: " + "expected operand I data type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfStructSuccess) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_f32 %extinst ModfStruct %f32_h +%val2 = OpExtInst %struct_f32vec2_f32vec2 %extinst ModfStruct %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450ModfStructResultTypeNotStruct) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst ModfStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 ModfStruct: " + "expected Result Type to be a struct with two " + "identical scalar or vector float type members")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfStructResultTypeStructWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_f32_f32 %extinst ModfStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 ModfStruct: " + "expected Result Type to be a struct with two " + "identical scalar or vector float type members")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfStructResultTypeStructWrongFirstMember) { + const std::string body = R"( +%val1 = OpExtInst %struct_u32_f32 %extinst ModfStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 ModfStruct: " + "expected Result Type to be a struct with two " + "identical scalar or vector float type members")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfStructResultTypeStructMembersNotEqual) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_f64 %extinst ModfStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 ModfStruct: " + "expected Result Type to be a struct with two " + "identical scalar or vector float type members")); +} + +TEST_F(ValidateExtInst, GlslStd450ModfStructXWrongType) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_f32 %extinst ModfStruct %f64_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 ModfStruct: " + "expected operand X type to be equal to members of " + "Result Type struct")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Frexp %f32_h %u32_output +%val2 = OpExtInst %f32vec2 %extinst Frexp %f32vec2_01 %u32vec2_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst Frexp %f32_h %u32_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Frexp: " + "expected Result Type to be a scalar or vector " + "float type")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpWrongXType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Frexp %u32_1 %u32_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Frexp: " + "expected operand X type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpExpNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Frexp %f32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Frexp: " + "expected operand Exp to be a pointer")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpExpNotInt32Pointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Frexp %f32_1 %f32_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Frexp: " + "expected operand Exp data type to be a 32-bit int " + "scalar or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpExpWrongComponentNumber) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Frexp %f32vec2_01 %u32_output +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Frexp: " + "expected operand Exp data type to have the same " + "component number as Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450LdexpSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Ldexp %f32_h %u32_2 +%val2 = OpExtInst %f32vec2 %extinst Ldexp %f32vec2_01 %u32vec2_12 +%val3 = OpExtInst %f32 %extinst Ldexp %f32_h %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450LdexpIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst Ldexp %f32_h %u32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Ldexp: " + "expected Result Type to be a scalar or vector " + "float type")); +} + +TEST_F(ValidateExtInst, GlslStd450LdexpWrongXType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Ldexp %u32_1 %u32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Ldexp: " + "expected operand X type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450LdexpFloatExp) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Ldexp %f32_1 %f32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Ldexp: " + "expected operand Exp to be a 32-bit int scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450LdexpExpWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Ldexp %f32vec2_12 %u32_2 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Ldexp: " + "expected operand Exp to have the same component " + "number as Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpStructSuccess) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_u32 %extinst FrexpStruct %f32_h +%val2 = OpExtInst %struct_f32vec2_u32vec2 %extinst FrexpStruct %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpStructResultTypeNotStruct) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst FrexpStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FrexpStruct: " + "expected Result Type to be a struct with two members, " + "first member a float scalar or vector, second member " + "a 32-bit int scalar or vector with the same number of " + "components as the first member")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpStructResultTypeStructWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_u32_f32 %extinst FrexpStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FrexpStruct: " + "expected Result Type to be a struct with two members, " + "first member a float scalar or vector, second member " + "a 32-bit int scalar or vector with the same number of " + "components as the first member")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpStructResultTypeStructWrongMember1) { + const std::string body = R"( +%val1 = OpExtInst %struct_u32_u32 %extinst FrexpStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FrexpStruct: " + "expected Result Type to be a struct with two members, " + "first member a float scalar or vector, second member " + "a 32-bit int scalar or vector with the same number of " + "components as the first member")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpStructResultTypeStructWrongMember2) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_f32 %extinst FrexpStruct %f32_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FrexpStruct: " + "expected Result Type to be a struct with two members, " + "first member a float scalar or vector, second member " + "a 32-bit int scalar or vector with the same number of " + "components as the first member")); +} + +TEST_F(ValidateExtInst, GlslStd450FrexpStructXWrongType) { + const std::string body = R"( +%val1 = OpExtInst %struct_f32_u32 %extinst FrexpStruct %f64_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FrexpStruct: " + "expected operand X type to be equal to the first " + "member of Result Type struct")); +} + +TEST_F(ValidateExtInst, + GlslStd450FrexpStructResultTypeStructRightInt16Member2) { + const std::string body = R"( +%val1 = OpExtInst %struct_f16_u16 %extinst FrexpStruct %f16_h +)"; + + const std::string extension = R"( +OpExtension "SPV_AMD_gpu_shader_int16" +)"; + + CompileSuccessfully(GenerateShaderCode(body, extension)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, + GlslStd450FrexpStructResultTypeStructWrongInt16Member2) { + const std::string body = R"( +%val1 = OpExtInst %struct_f16_u16 %extinst FrexpStruct %f16_h +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 FrexpStruct: " + "expected Result Type to be a struct with two members, " + "first member a float scalar or vector, second member " + "a 32-bit int scalar or vector with the same number of " + "components as the first member")); +} + +TEST_P(ValidateGlslStd450Pack, Success) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string vec_str = + num_components == 2 ? " %f32vec2_01\n" : " %f32vec4_0123\n"; + + std::ostringstream body; + body << "%val1 = OpExtInst %u" << total_bit_width << " %extinst " + << ext_inst_name << vec_str; + body << "%val2 = OpExtInst %s" << total_bit_width << " %extinst " + << ext_inst_name << vec_str; + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450Pack, Float32ResultType) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string vec_str = + num_components == 2 ? " %f32vec2_01\n" : " %f32vec4_0123\n"; + + std::ostringstream body; + body << "%val1 = OpExtInst %f" << total_bit_width << " %extinst " + << ext_inst_name << vec_str; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected Result Type to be " << total_bit_width + << "-bit int scalar type"; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Pack, Int16ResultType) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string vec_str = + num_components == 2 ? " %f32vec2_01\n" : " %f32vec4_0123\n"; + + std::ostringstream body; + body << "%val1 = OpExtInst %u16 %extinst " << ext_inst_name << vec_str; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected Result Type to be " << total_bit_width + << "-bit int scalar type"; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Pack, VNotVector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + + std::ostringstream body; + body << "%val1 = OpExtInst %u" << total_bit_width << " %extinst " + << ext_inst_name << " %f32_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected operand V to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Pack, VNotFloatVector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string vec_str = + num_components == 2 ? " %u32vec2_01\n" : " %u32vec4_0123\n"; + + std::ostringstream body; + body << "%val1 = OpExtInst %u" << total_bit_width << " %extinst " + << ext_inst_name << vec_str; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected operand V to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Pack, VNotFloat32Vector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string vec_str = + num_components == 2 ? " %f64vec2_01\n" : " %f64vec4_0123\n"; + + std::ostringstream body; + body << "%val1 = OpExtInst %u" << total_bit_width << " %extinst " + << ext_inst_name << vec_str; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected operand V to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Pack, VWrongSizeVector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string vec_str = + num_components == 4 ? " %f32vec2_01\n" : " %f32vec4_0123\n"; + + std::ostringstream body; + body << "%val1 = OpExtInst %u" << total_bit_width << " %extinst " + << ext_inst_name << vec_str; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected operand V to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +INSTANTIATE_TEST_CASE_P(AllPack, ValidateGlslStd450Pack, + ::testing::ValuesIn(std::vector{ + "PackSnorm4x8", + "PackUnorm4x8", + "PackSnorm2x16", + "PackUnorm2x16", + "PackHalf2x16", + }), ); + +TEST_F(ValidateExtInst, PackDouble2x32Success) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst PackDouble2x32 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, PackDouble2x32Float32ResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst PackDouble2x32 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 PackDouble2x32: expected Result Type to " + "be 64-bit float scalar type")); +} + +TEST_F(ValidateExtInst, PackDouble2x32Int64ResultType) { + const std::string body = R"( +%val1 = OpExtInst %u64 %extinst PackDouble2x32 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 PackDouble2x32: expected Result Type to " + "be 64-bit float scalar type")); +} + +TEST_F(ValidateExtInst, PackDouble2x32VNotVector) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst PackDouble2x32 %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 PackDouble2x32: expected operand V to be " + "a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, PackDouble2x32VNotIntVector) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst PackDouble2x32 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 PackDouble2x32: expected operand V to be " + "a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, PackDouble2x32VNotInt32Vector) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst PackDouble2x32 %u64vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 PackDouble2x32: expected operand V to be " + "a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, PackDouble2x32VWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst PackDouble2x32 %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 PackDouble2x32: expected operand V to be " + "a 32-bit int vector of size 2")); +} + +TEST_P(ValidateGlslStd450Unpack, Success) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string result_type_str = + num_components == 2 ? "%f32vec2" : " %f32vec4"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %u" << total_bit_width << "_1\n"; + body << "%val2 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %s" << total_bit_width << "_1\n"; + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateGlslStd450Unpack, ResultTypeNotVector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string result_type_str = "%f32"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %u" << total_bit_width << "_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected Result Type to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Unpack, ResultTypeNotFloatVector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string result_type_str = + num_components == 2 ? "%u32vec2" : " %u32vec4"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %u" << total_bit_width << "_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected Result Type to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Unpack, ResultTypeNotFloat32Vector) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string result_type_str = + num_components == 2 ? "%f64vec2" : " %f64vec4"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %u" << total_bit_width << "_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected Result Type to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Unpack, ResultTypeWrongSize) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string result_type_str = + num_components == 4 ? "%f32vec2" : " %f32vec4"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %u" << total_bit_width << "_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected Result Type to be a 32-bit float vector of size " + << num_components; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Unpack, ResultPNotInt) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const std::string result_type_str = + num_components == 2 ? "%f32vec2" : " %f32vec4"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %f" << total_bit_width << "_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected operand P to be a " << total_bit_width + << "-bit int scalar"; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +TEST_P(ValidateGlslStd450Unpack, ResultPWrongBitWidth) { + const std::string ext_inst_name = GetParam(); + const uint32_t num_components = GetPackedNumComponents(ext_inst_name); + const uint32_t packed_bit_width = GetPackedBitWidth(ext_inst_name); + const uint32_t total_bit_width = num_components * packed_bit_width; + const uint32_t wrong_bit_width = total_bit_width == 32 ? 64 : 32; + const std::string result_type_str = + num_components == 2 ? "%f32vec2" : " %f32vec4"; + + std::ostringstream body; + body << "%val1 = OpExtInst " << result_type_str << " %extinst " + << ext_inst_name << " %u" << wrong_bit_width << "_1\n"; + + std::ostringstream expected; + expected << "GLSL.std.450 " << ext_inst_name + << ": expected operand P to be a " << total_bit_width + << "-bit int scalar"; + + CompileSuccessfully(GenerateShaderCode(body.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); +} + +INSTANTIATE_TEST_CASE_P(AllUnpack, ValidateGlslStd450Unpack, + ::testing::ValuesIn(std::vector{ + "UnpackSnorm4x8", + "UnpackUnorm4x8", + "UnpackSnorm2x16", + "UnpackUnorm2x16", + "UnpackHalf2x16", + }), ); + +TEST_F(ValidateExtInst, UnpackDouble2x32Success) { + const std::string body = R"( +%val1 = OpExtInst %u32vec2 %extinst UnpackDouble2x32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, UnpackDouble2x32ResultTypeNotVector) { + const std::string body = R"( +%val1 = OpExtInst %u64 %extinst UnpackDouble2x32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 UnpackDouble2x32: expected Result Type " + "to be a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, UnpackDouble2x32ResultTypeNotIntVector) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst UnpackDouble2x32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 UnpackDouble2x32: expected Result Type " + "to be a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, UnpackDouble2x32ResultTypeNotInt32Vector) { + const std::string body = R"( +%val1 = OpExtInst %u64vec2 %extinst UnpackDouble2x32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 UnpackDouble2x32: expected Result Type " + "to be a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, UnpackDouble2x32ResultTypeWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %u32vec4 %extinst UnpackDouble2x32 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 UnpackDouble2x32: expected Result Type " + "to be a 32-bit int vector of size 2")); +} + +TEST_F(ValidateExtInst, UnpackDouble2x32VNotFloat) { + const std::string body = R"( +%val1 = OpExtInst %u32vec2 %extinst UnpackDouble2x32 %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 UnpackDouble2x32: expected operand V to " + "be a 64-bit float scalar")); +} + +TEST_F(ValidateExtInst, UnpackDouble2x32VNotFloat64) { + const std::string body = R"( +%val1 = OpExtInst %u32vec2 %extinst UnpackDouble2x32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 UnpackDouble2x32: expected operand V to " + "be a 64-bit float scalar")); +} + +TEST_F(ValidateExtInst, GlslStd450LengthSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Length %f32_1 +%val2 = OpExtInst %f32 %extinst Length %f32vec2_01 +%val3 = OpExtInst %f32 %extinst Length %f32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450LengthIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst Length %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Length: " + "expected Result Type to be a float scalar type")); +} + +TEST_F(ValidateExtInst, GlslStd450LengthIntX) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Length %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Length: " + "expected operand X to be of float scalar or " + "vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450LengthDifferentType) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst Length %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Length: " + "expected operand X component type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Distance %f32_0 %f32_1 +%val2 = OpExtInst %f32 %extinst Distance %f32vec2_01 %f32vec2_12 +%val3 = OpExtInst %f32 %extinst Distance %f32vec4_0123 %f32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst Distance %f32vec2_01 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Distance: " + "expected Result Type to be a float scalar type")); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceIntP0) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Distance %u32_0 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Distance: " + "expected operand P0 to be of float scalar or " + "vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceF64VectorP0) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Distance %f64vec2_01 %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Distance: " + "expected operand P0 component type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceIntP1) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Distance %f32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Distance: " + "expected operand P1 to be of float scalar or " + "vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceF64VectorP1) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Distance %f32vec2_12 %f64vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Distance: " + "expected operand P1 component type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450DistanceDifferentSize) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Distance %f32vec2_01 %f32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Distance: " + "expected operands P0 and P1 to have the same number " + "of components")); +} + +TEST_F(ValidateExtInst, GlslStd450CrossSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst Cross %f32vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450CrossIntVectorResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32vec3 %extinst Cross %f32vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Cross: " + "expected Result Type to be a float vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450CrossResultTypeWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Cross %f32vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Cross: " + "expected Result Type to have 3 components")); +} + +TEST_F(ValidateExtInst, GlslStd450CrossXWrongType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst Cross %f64vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Cross: " + "expected operand X type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450CrossYWrongType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst Cross %f32vec3_123 %f64vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Cross: " + "expected operand Y type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450RefractSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst Refract %f32_1 %f32_1 %f32_1 +%val2 = OpExtInst %f32vec2 %extinst Refract %f32vec2_01 %f32vec2_01 %f16_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450RefractIntVectorResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32vec2 %extinst Refract %f32vec2_01 %f32vec2_01 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Refract: " + "expected Result Type to be a float scalar or " + "vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450RefractIntVectorI) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Refract %u32vec2_01 %f32vec2_01 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Refract: " + "expected operand I to be of type equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450RefractIntVectorN) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Refract %f32vec2_01 %u32vec2_01 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Refract: " + "expected operand N to be of type equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450RefractIntEta) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Refract %f32vec2_01 %f32vec2_01 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Refract: " + "expected operand Eta to be a float scalar")); +} + +TEST_F(ValidateExtInst, GlslStd450RefractFloat64Eta) { + // SPIR-V issue 337: Eta can be 64-bit float scalar. + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Refract %f32vec2_01 %f32vec2_01 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateExtInst, GlslStd450RefractVectorEta) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst Refract %f32vec2_01 %f32vec2_01 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 Refract: " + "expected operand Eta to be a float scalar")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtCentroid %f32_input +%val2 = OpExtInst %f32vec2 %extinst InterpolateAtCentroid %f32vec2_input +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidNoCapability) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtCentroid %f32_input +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid requires " + "capability InterpolationFunction")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst InterpolateAtCentroid %f32_input +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid: " + "expected Result Type to be a 32-bit float scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidF64ResultType) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst InterpolateAtCentroid %f32_input +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid: " + "expected Result Type to be a 32-bit float scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtCentroid %f32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid: " + "expected Interpolant to be a pointer")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidWrongDataType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtCentroid %f32vec2_input +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid: " + "expected Interpolant data type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidWrongStorageClass) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtCentroid %f32_output +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid: " + "expected Interpolant storage class to be Input")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtCentroidWrongExecutionModel) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtCentroid %f32_input +)"; + + CompileSuccessfully(GenerateShaderCode( + body, "OpCapability InterpolationFunction\n", "Vertex")); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtCentroid requires " + "Fragment execution model")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_input %u32_1 +%val2 = OpExtInst %f32vec2 %extinst InterpolateAtSample %f32vec2_input %u32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleNoCapability) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_input %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample requires " + "capability InterpolationFunction")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst InterpolateAtSample %f32_input %u32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Result Type to be a 32-bit float scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleF64ResultType) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst InterpolateAtSample %f32_input %u32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Result Type to be a 32-bit float scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_1 %u32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Interpolant to be a pointer")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleWrongDataType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32vec2_input %u32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Interpolant data type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleWrongStorageClass) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_output %u32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Interpolant storage class to be Input")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleFloatSample) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_input %f32_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Sample to be 32-bit integer")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleU64Sample) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_input %u64_1 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample: " + "expected Sample to be 32-bit integer")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtSampleWrongExecutionModel) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtSample %f32_input %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode( + body, "OpCapability InterpolationFunction\n", "Vertex")); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtSample requires " + "Fragment execution model")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %f32vec2_01 +%val2 = OpExtInst %f32vec2 %extinst InterpolateAtOffset %f32vec2_input %f32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetNoCapability) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset requires " + "capability InterpolationFunction")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst InterpolateAtOffset %f32_input %f32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Result Type to be a 32-bit float scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetF64ResultType) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst InterpolateAtOffset %f32_input %f32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Result Type to be a 32-bit float scalar " + "or vector type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_1 %f32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Interpolant to be a pointer")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetWrongDataType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32vec2_input %f32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Interpolant data type to be equal to " + "Result Type")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetWrongStorageClass) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_output %f32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Interpolant storage class to be Input")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetOffsetNotVector) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %f32_0 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Offset to be a vector of 2 32-bit floats")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetOffsetNotVector2) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %f32vec3_012 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Offset to be a vector of 2 32-bit floats")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetOffsetNotFloatVector) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %u32vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Offset to be a vector of 2 32-bit floats")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetOffsetNotFloat32Vector) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %f64vec2_01 +)"; + + CompileSuccessfully( + GenerateShaderCode(body, "OpCapability InterpolationFunction\n")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset: " + "expected Offset to be a vector of 2 32-bit floats")); +} + +TEST_F(ValidateExtInst, GlslStd450InterpolateAtOffsetWrongExecutionModel) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst InterpolateAtOffset %f32_input %f32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode( + body, "OpCapability InterpolationFunction\n", "Vertex")); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("GLSL.std.450 InterpolateAtOffset requires " + "Fragment execution model")); +} + +TEST_P(ValidateOpenCLStdSqrtLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32_0\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01\n"; + ss << "%val3 = OpExtInst %f32vec4 %extinst " << ext_inst_name + << " %f32vec4_0123\n"; + ss << "%val4 = OpExtInst %f64 %extinst " << ext_inst_name << " %f64_0\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdSqrtLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float scalar " + "or vector type")); +} + +TEST_P(ValidateOpenCLStdSqrtLike, IntOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P( + AllSqrtLike, ValidateOpenCLStdSqrtLike, + ::testing::ValuesIn(std::vector{ + "acos", "acosh", "acospi", "asin", + "asinh", "asinpi", "atan", "atanh", + "atanpi", "cbrt", "ceil", "cos", + "cosh", "cospi", "erfc", "erf", + "exp", "exp2", "exp10", "expm1", + "fabs", "floor", "log", "log2", + "log10", "log1p", "logb", "rint", + "round", "rsqrt", "sin", "sinh", + "sinpi", "sqrt", "tan", "tanh", + "tanpi", "tgamma", "trunc", "half_cos", + "half_exp", "half_exp2", "half_exp10", "half_log", + "half_log2", "half_log10", "half_recip", "half_rsqrt", + "half_sin", "half_sqrt", "half_tan", "lgamma", + "native_cos", "native_exp", "native_exp2", "native_exp10", + "native_log", "native_log2", "native_log10", "native_recip", + "native_rsqrt", "native_sin", "native_sqrt", "native_tan", + "degrees", "radians", "sign", + }), ); + +TEST_P(ValidateOpenCLStdFMinLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %f32vec2_12\n"; + ss << "%val3 = OpExtInst %f64 %extinst " << ext_inst_name + << " %f64_0 %f64_0\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdFMinLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float scalar " + "or vector type")); +} + +TEST_P(ValidateOpenCLStdFMinLike, IntOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateOpenCLStdFMinLike, IntOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllFMinLike, ValidateOpenCLStdFMinLike, + ::testing::ValuesIn(std::vector{ + "atan2", "atan2pi", "copysign", + "fdim", "fmax", "fmin", + "fmod", "maxmag", "minmag", + "hypot", "nextafter", "pow", + "powr", "remainder", "half_divide", + "half_powr", "native_divide", "native_powr", + "step", "fmax_common", "fmin_common", + }), ); + +TEST_P(ValidateOpenCLStdFClampLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1 %f32_2\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %f32vec2_01 %f32vec2_12\n"; + ss << "%val3 = OpExtInst %f64 %extinst " << ext_inst_name + << " %f64_0 %f64_0 %f64_1\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdFClampLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32_0 %f32_1 %f32_2\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float scalar " + "or vector type")); +} + +TEST_P(ValidateOpenCLStdFClampLike, IntOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateOpenCLStdFClampLike, IntOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +TEST_P(ValidateOpenCLStdFClampLike, IntOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f32_1 %f32_0 %u32_2\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllFClampLike, ValidateOpenCLStdFClampLike, + ::testing::ValuesIn(std::vector{ + "fma", + "mad", + "fclamp", + "mix", + "smoothstep", + }), ); + +TEST_P(ValidateOpenCLStdSAbsLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name << " %u32_1\n"; + ss << "%val2 = OpExtInst %u32 %extinst " << ext_inst_name << " %u32_1\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name << " %u32_1\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name << " %u32_1\n"; + ss << "%val5 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01\n"; + ss << "%val8 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdSAbsLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be an int scalar " + "or vector type")); +} + +TEST_P(ValidateOpenCLStdSAbsLike, FloatOperand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdSAbsLike, U64Operand) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u64_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllSAbsLike, ValidateOpenCLStdSAbsLike, + ::testing::ValuesIn(std::vector{ + "s_abs", + "clz", + "ctz", + "popcount", + "u_abs", + }), ); + +TEST_P(ValidateOpenCLStdUMinLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val2 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val5 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val8 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val9 = OpExtInst %u64 %extinst " << ext_inst_name + << " %u64_1 %u64_0\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdUMinLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0 %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be an int scalar " + "or vector type")); +} + +TEST_P(ValidateOpenCLStdUMinLike, FloatOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0 %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMinLike, FloatOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u32_0 %f32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMinLike, U64Operand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u64_0 %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMinLike, U64Operand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u32_0 %u64_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUMinLike, ValidateOpenCLStdUMinLike, + ::testing::ValuesIn(std::vector{ + "s_max", + "u_max", + "s_min", + "u_min", + "s_abs_diff", + "s_add_sat", + "u_add_sat", + "s_mul_hi", + "rotate", + "s_sub_sat", + "u_sub_sat", + "s_hadd", + "u_hadd", + "s_rhadd", + "u_rhadd", + "u_abs_diff", + "u_mul_hi", + }), ); + +TEST_P(ValidateOpenCLStdUClampLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val2 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val5 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val8 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val9 = OpExtInst %u64 %extinst " << ext_inst_name + << " %u64_1 %u64_0 %u64_1\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdUClampLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be an int scalar " + "or vector type")); +} + +TEST_P(ValidateOpenCLStdUClampLike, FloatOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUClampLike, FloatOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUClampLike, FloatOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUClampLike, U64Operand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUClampLike, U64Operand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUClampLike, U64Operand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUClampLike, ValidateOpenCLStdUClampLike, + ::testing::ValuesIn(std::vector{ + "s_clamp", + "u_clamp", + "s_mad_hi", + "u_mad_sat", + "s_mad_sat", + "u_mad_hi", + }), ); + +// ------------------------------------------------------------- +TEST_P(ValidateOpenCLStdUMul24Like, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val2 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val5 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + ss << "%val8 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdUMul24Like, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32_0 %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": expected Result Type to be a 32-bit int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdUMul24Like, U64ResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u64 %extinst " + ext_inst_name + " %u64_0 %u64\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": expected Result Type to be a 32-bit int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdUMul24Like, FloatOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_0 %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMul24Like, FloatOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u32_0 %f32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMul24Like, U64Operand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u64_0 %u32_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMul24Like, U64Operand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %u32_0 %u64_0\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUMul24Like, ValidateOpenCLStdUMul24Like, + ::testing::ValuesIn(std::vector{ + "s_mul24", + "u_mul24", + }), ); + +TEST_P(ValidateOpenCLStdUMad24Like, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val2 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val3 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val4 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u32_0 %u32_1 %u32_2\n"; + ss << "%val5 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val6 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val7 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + ss << "%val8 = OpExtInst %u32vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01 %u32vec2_12\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdUMad24Like, FloatResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": expected Result Type to be a 32-bit int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, U64ResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u64 %extinst " + ext_inst_name + + " %u64_0 %u64_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": expected Result Type to be a 32-bit int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, FloatOperand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, FloatOperand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, FloatOperand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, U64Operand1) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32_0 %u32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, U64Operand2) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %f32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdUMad24Like, U64Operand3) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %u32_0 %u32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected types of all operands to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUMad24Like, ValidateOpenCLStdUMad24Like, + ::testing::ValuesIn(std::vector{ + "s_mad24", + "u_mad24", + }), ); + +TEST_F(ValidateExtInst, OpenCLStdCrossSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst cross %f32vec3_012 %f32vec3_123 +%val2 = OpExtInst %f32vec4 %extinst cross %f32vec4_0123 %f32vec4_0123 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdCrossIntVectorResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32vec3 %extinst cross %f32vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std cross: " + "expected Result Type to be a float vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdCrossResultTypeWrongSize) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst cross %f32vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std cross: " + "expected Result Type to have 3 or 4 components")); +} + +TEST_F(ValidateExtInst, OpenCLStdCrossXWrongType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst cross %f64vec3_012 %f32vec3_123 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std cross: " + "expected operand X type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdCrossYWrongType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst cross %f32vec3_123 %f64vec3_012 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std cross: " + "expected operand Y type to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdLengthLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32vec2_01\n"; + ss << "%val2 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32vec4_0123\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdLengthLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32vec2_01\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected Result Type to be a float scalar type")); +} + +TEST_P(ValidateOpenCLStdLengthLike, IntX) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + " %u32vec2_01\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand P to be a float scalar or vector")); +} + +TEST_P(ValidateOpenCLStdLengthLike, VectorTooBig) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f32vec8_01010101\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand P to have no more than 4 components")); +} + +TEST_P(ValidateOpenCLStdLengthLike, DifferentType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f64 %extinst " + ext_inst_name + " %f32vec2_01\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand P component type to be equal to " + "Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllLengthLike, ValidateOpenCLStdLengthLike, + ::testing::ValuesIn(std::vector{ + "length", + "fast_length", + }), ); + +TEST_P(ValidateOpenCLStdDistanceLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32vec2_01 %f32vec2_01\n"; + ss << "%val2 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32vec4_0123 %f32vec4_1234\n"; + ss << "%val3 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdDistanceLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + + " %f32vec2_01 %f32vec2_12\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected Result Type to be a float scalar type")); +} + +TEST_P(ValidateOpenCLStdDistanceLike, IntP0) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %u32vec2_01 %f32vec2_12\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand P0 to be of float scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdDistanceLike, VectorTooBig) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f32vec8_01010101 %f32vec8_01010101\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand P0 to have no more than 4 components")); +} + +TEST_P(ValidateOpenCLStdDistanceLike, F64P0) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32 %extinst " + ext_inst_name + + " %f64vec2_01 %f32vec2_12\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": " + "expected operand P0 component type to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdDistanceLike, DifferentOperands) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f64 %extinst " + ext_inst_name + + " %f64vec2_01 %f32vec2_12\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operands P0 and P1 to be of the same type")); +} + +INSTANTIATE_TEST_CASE_P(AllDistanceLike, ValidateOpenCLStdDistanceLike, + ::testing::ValuesIn(std::vector{ + "distance", + "fast_distance", + }), ); + +TEST_P(ValidateOpenCLStdNormalizeLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01\n"; + ss << "%val2 = OpExtInst %f32vec4 %extinst " << ext_inst_name + << " %f32vec4_0123\n"; + ss << "%val3 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32_2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdNormalizeLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %u32 %extinst " + ext_inst_name + " %f32_2\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected Result Type to be a float scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdNormalizeLike, VectorTooBig) { + const std::string ext_inst_name = GetParam(); + const std::string body = "%val1 = OpExtInst %f32vec8 %extinst " + + ext_inst_name + " %f32vec8_01010101\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected Result Type to have no more than 4 components")); +} + +TEST_P(ValidateOpenCLStdNormalizeLike, DifferentType) { + const std::string ext_inst_name = GetParam(); + const std::string body = + "%val1 = OpExtInst %f64vec2 %extinst " + ext_inst_name + " %f32vec2_01\n"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand P type to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllNormalizeLike, ValidateOpenCLStdNormalizeLike, + ::testing::ValuesIn(std::vector{ + "normalize", + "fast_normalize", + }), ); + +TEST_F(ValidateExtInst, OpenCLStdBitselectSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst bitselect %f32_2 %f32_1 %f32_1 +%val2 = OpExtInst %f32vec4 %extinst bitselect %f32vec4_0123 %f32vec4_1234 %f32vec4_0123 +%val3 = OpExtInst %u32 %extinst bitselect %u32_2 %u32_1 %u32_1 +%val4 = OpExtInst %u32vec4 %extinst bitselect %u32vec4_0123 %u32vec4_0123 %u32vec4_0123 +%val5 = OpExtInst %u64 %extinst bitselect %u64_2 %u64_1 %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdBitselectWrongResultType) { + const std::string body = R"( +%val3 = OpExtInst %struct_f32_f32 %extinst bitselect %u32_2 %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std bitselect: " + "expected Result Type to be an int or float scalar or vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdBitselectAWrongType) { + const std::string body = R"( +%val3 = OpExtInst %u32 %extinst bitselect %f32_2 %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std bitselect: " + "expected types of all operands to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdBitselectBWrongType) { + const std::string body = R"( +%val3 = OpExtInst %u32 %extinst bitselect %u32_2 %f32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std bitselect: " + "expected types of all operands to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdBitselectCWrongType) { + const std::string body = R"( +%val3 = OpExtInst %u32 %extinst bitselect %u32_2 %u32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std bitselect: " + "expected types of all operands to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst select %f32_2 %f32_1 %u32_1 +%val2 = OpExtInst %f32vec4 %extinst select %f32vec4_0123 %f32vec4_1234 %u32vec4_0123 +%val3 = OpExtInst %u32 %extinst select %u32_2 %u32_1 %u32_1 +%val4 = OpExtInst %u32vec4 %extinst select %u32vec4_0123 %u32vec4_0123 %u32vec4_0123 +%val5 = OpExtInst %u64 %extinst select %u64_2 %u64_1 %u64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectWrongResultType) { + const std::string body = R"( +%val3 = OpExtInst %struct_f32_f32 %extinst select %u32_2 %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std select: " + "expected Result Type to be an int or float scalar or vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectAWrongType) { + const std::string body = R"( +%val3 = OpExtInst %u32 %extinst select %f32_2 %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std select: " + "expected operand A type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectBWrongType) { + const std::string body = R"( +%val3 = OpExtInst %u32 %extinst select %u32_2 %f32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std select: " + "expected operand B type to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectCWrongType) { + const std::string body = R"( +%val3 = OpExtInst %f32 %extinst select %f32_2 %f32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std select: " + "expected operand C to be an int scalar or vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectCWrongComponentNumber) { + const std::string body = R"( +%val3 = OpExtInst %f32vec2 %extinst select %f32vec2_12 %f32vec2_01 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std select: " + "expected operand C to have the same number of " + "components as Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdSelectCWrongBitWidth) { + const std::string body = R"( +%val3 = OpExtInst %f32vec2 %extinst select %f32vec2_12 %f32vec2_01 %u64vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std select: " + "expected operand C to have the same bit width as Result Type")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, SuccessPhysical32) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_1 %u32_1 %ptr" << rounding_mode << "\n"; + ss << "%val2 = OpExtInst %void %extinst " << ext_inst_name + << " %f64_0 %u32_2 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + ss << "%val2 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec4_0123 %u32_0 %ptr" << rounding_mode << "\n"; + ss << "%val3 = OpExtInst %void %extinst " << ext_inst_name + << " %f64vec2_01 %u32_2 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, SuccessPhysical64) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_1 %u64_1 %ptr" << rounding_mode << "\n"; + ss << "%val2 = OpExtInst %void %extinst " << ext_inst_name + << " %f64_0 %u64_2 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u64_1 %ptr" << rounding_mode << "\n"; + ss << "%val2 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec4_0123 %u64_0 %ptr" << rounding_mode << "\n"; + ss << "%val3 = OpExtInst %void %extinst " << ext_inst_name + << " %f64vec2_01 %u64_2 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, NonVoidResultType) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_1 %u32_1 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be void")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, WrongDataType) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f64vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Data to be a 32 or 64-bit float scalar")); + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f64_0 %u32_1 %ptr" << rounding_mode << "\n"; + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Data to be a 32 or 64-bit float vector")); + } +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, AddressingModelLogical) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_0 %u32_1 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Logical")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + " can only be used with physical addressing models")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, OffsetNotSizeT) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_0 %u32_1 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": " + "expected operand Offset to be of type size_t (64-bit integer " + "for the addressing model used in the module)")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, PNotPointer) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_0 %u32_1 %f16_ptr_workgroup" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %f16_ptr_workgroup" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P to be a pointer")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, ConstPointer) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_uniform_constant " + "%f16vec8_uniform_constant %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_0 %u32_1 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P storage class to be Generic, " + "CrossWorkgroup, Workgroup or Function")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, PDataTypeInt) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %u32_ptr_workgroup %u32vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_0 %u32_1 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P data type to be 16-bit float scalar")); +} + +TEST_P(ValidateOpenCLStdVStoreHalfLike, PDataTypeFloat32) { + const std::string ext_inst_name = GetParam(); + const std::string rounding_mode = + ext_inst_name.substr(ext_inst_name.length() - 2) == "_r" ? " RTE" : ""; + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + if (std::string::npos == ext_inst_name.find("halfn")) { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32_0 %u32_1 %ptr" << rounding_mode << "\n"; + } else { + ss << "%val1 = OpExtInst %void %extinst " << ext_inst_name + << " %f32vec2_01 %u32_1 %ptr" << rounding_mode << "\n"; + } + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P data type to be 16-bit float scalar")); +} + +INSTANTIATE_TEST_CASE_P(AllVStoreHalfLike, ValidateOpenCLStdVStoreHalfLike, + ::testing::ValuesIn(std::vector{ + "vstore_half", + "vstore_half_r", + "vstore_halfn", + "vstore_halfn_r", + "vstorea_halfn", + "vstorea_halfn_r", + }), ); + +TEST_P(ValidateOpenCLStdVLoadHalfLike, SuccessPhysical32) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %ptr 2\n"; + ss << "%val2 = OpExtInst %f32vec3 %extinst " << ext_inst_name + << " %u32_1 %ptr 3\n"; + ss << "%val3 = OpExtInst %f32vec4 %extinst " << ext_inst_name + << " %u32_1 %ptr 4\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, SuccessPhysical64) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u64_1 %ptr 2\n"; + ss << "%val2 = OpExtInst %f32vec3 %extinst " << ext_inst_name + << " %u64_1 %ptr 3\n"; + ss << "%val3 = OpExtInst %f32vec4 %extinst " << ext_inst_name + << " %u64_1 %ptr 4\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, ResultTypeNotFloatVector) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %u32_1 %ptr 1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float vector type")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, AddressingModelLogical) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Logical")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + " can only be used with physical addressing models")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, OffsetNotSizeT) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u64_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand Offset to be of type size_t (32-bit " + "integer for the addressing model used in the module)")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, PNotPointer) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %f16_ptr_workgroup 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P to be a pointer")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, OffsetWrongStorageType) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_input %f16vec8_input %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P storage class to be UniformConstant, " + "Generic, CrossWorkgroup, Workgroup or Function")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, PDataTypeInt) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %u32_ptr_workgroup %u32vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P data type to be 16-bit float scalar")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, PDataTypeFloat32) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected operand P data type to be 16-bit float scalar")); +} + +TEST_P(ValidateOpenCLStdVLoadHalfLike, WrongN) { + const std::string ext_inst_name = GetParam(); + + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_workgroup %f16vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %u32_1 %ptr 3\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected literal N to be equal to the number of " + "components of Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllVLoadHalfLike, ValidateOpenCLStdVLoadHalfLike, + ::testing::ValuesIn(std::vector{ + "vload_halfn", + "vloada_halfn", + }), ); + +TEST_F(ValidateExtInst, VLoadNSuccessFloatPhysical32) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst vloadn %u32_1 %ptr 2\n"; + ss << "%val2 = OpExtInst %f32vec3 %extinst vloadn %u32_1 %ptr 3\n"; + ss << "%val3 = OpExtInst %f32vec4 %extinst vloadn %u32_1 %ptr 4\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VLoadNSuccessIntPhysical32) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %u32_ptr_uniform_constant " + "%u32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %u32vec2 %extinst vloadn %u32_1 %ptr 2\n"; + ss << "%val2 = OpExtInst %u32vec3 %extinst vloadn %u32_1 %ptr 3\n"; + ss << "%val3 = OpExtInst %u32vec4 %extinst vloadn %u32_1 %ptr 4\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VLoadNSuccessFloatPhysical64) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst vloadn %u64_1 %ptr 2\n"; + ss << "%val2 = OpExtInst %f32vec3 %extinst vloadn %u64_1 %ptr 3\n"; + ss << "%val3 = OpExtInst %f32vec4 %extinst vloadn %u64_1 %ptr 4\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VLoadNSuccessIntPhysical64) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %u32_ptr_uniform_constant " + "%u32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %u32vec2 %extinst vloadn %u64_1 %ptr 2\n"; + ss << "%val2 = OpExtInst %u32vec3 %extinst vloadn %u64_1 %ptr 3\n"; + ss << "%val3 = OpExtInst %u32vec4 %extinst vloadn %u64_1 %ptr 4\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VLoadNWrongResultType) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vloadn %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std vloadn: " + "expected Result Type to be an int or float vector type")); +} + +TEST_F(ValidateExtInst, VLoadNAddressingModelLogical) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst vloadn %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Logical")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vloadn can only be used with physical " + "addressing models")); +} + +TEST_F(ValidateExtInst, VLoadNOffsetNotSizeT) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst vloadn %u64_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std vloadn: expected operand Offset to be of type size_t " + "(32-bit integer for the addressing model used in the module)")); +} + +TEST_F(ValidateExtInst, VLoadNPNotPointer) { + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32vec2 %extinst vloadn %u32_1 " + "%f32_ptr_uniform_constant 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std vloadn: expected operand P to be a pointer")); +} + +TEST_F(ValidateExtInst, VLoadNWrongStorageClass) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %u32_ptr_workgroup %u32vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %u32vec2 %extinst vloadn %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vloadn: expected operand P storage class " + "to be UniformConstant or Generic")); +} + +TEST_F(ValidateExtInst, VLoadNWrongComponentType) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %u32vec2 %extinst vloadn %u32_1 %ptr 2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vloadn: expected operand P data type to be " + "equal to component type of Result Type")); +} + +TEST_F(ValidateExtInst, VLoadNWrongN) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst vloadn %u32_1 %ptr 3\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vloadn: expected literal N to be equal to " + "the number of components of Result Type")); +} + +TEST_F(ValidateExtInst, VLoadHalfSuccessPhysical32) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_uniform_constant " + "%f16vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u32_1 %ptr\n"; + ss << "%val2 = OpExtInst %f64 %extinst vload_half %u32_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VLoadHalfSuccessPhysical64) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_uniform_constant " + "%f16vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u64_1 %ptr\n"; + ss << "%val2 = OpExtInst %f64 %extinst vload_half %u64_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VLoadHalfWrongResultType) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_uniform_constant " + "%f16vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %u32 %extinst vload_half %u32_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vload_half: " + "expected Result Type to be a float scalar type")); +} + +TEST_F(ValidateExtInst, VLoadHalfAddressingModelLogical) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_uniform_constant " + "%f16vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u32_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Logical")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vload_half can only be used with physical " + "addressing models")); +} + +TEST_F(ValidateExtInst, VLoadHalfOffsetNotSizeT) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_uniform_constant " + "%f16vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u64_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std vload_half: expected operand Offset to be of type size_t " + "(32-bit integer for the addressing model used in the module)")); +} + +TEST_F(ValidateExtInst, VLoadHalfPNotPointer) { + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u32_1 " + "%f16_ptr_uniform_constant\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std vload_half: expected operand P to be a pointer")); +} + +TEST_F(ValidateExtInst, VLoadHalfWrongStorageClass) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f16_ptr_input %f16vec8_input %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u32_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std vload_half: expected operand P storage class to be " + "UniformConstant, Generic, CrossWorkgroup, Workgroup or Function")); +} + +TEST_F(ValidateExtInst, VLoadHalfPDataTypeInt) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %u32_ptr_uniform_constant " + "%u32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u32_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vload_half: expected operand P data type " + "to be 16-bit float scalar")); +} + +TEST_F(ValidateExtInst, VLoadHalfPDataTypeFloat32) { + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst vload_half %u32_1 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vload_half: expected operand P data type " + "to be 16-bit float scalar")); +} + +TEST_F(ValidateExtInst, VStoreNSuccessFloatPhysical32) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32vec2_01 %u32_1 %ptr_g\n"; + ss << "%val2 = OpExtInst %void %extinst vstoren %f32vec4_0123 %u32_1 " + "%ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VStoreNSuccessFloatPhysical64) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32vec2_01 %u64_1 %ptr_g\n"; + ss << "%val2 = OpExtInst %void %extinst vstoren %f32vec4_0123 %u64_1 " + "%ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VStoreNSuccessIntPhysical32) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %u32_ptr_workgroup %u32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %u32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %u32vec2_01 %u32_1 %ptr_g\n"; + ss << "%val2 = OpExtInst %void %extinst vstoren %u32vec4_0123 %u32_1 " + "%ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VStoreNSuccessIntPhysical64) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %u32_ptr_workgroup %u32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %u32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %u32vec2_01 %u64_1 %ptr_g\n"; + ss << "%val2 = OpExtInst %void %extinst vstoren %u32vec4_0123 %u64_1 " + "%ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, VStoreNResultTypeNotVoid) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %f32 %extinst vstoren %f32vec2_01 %u32_1 %ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vstoren: expected Result Type to be void")); +} + +TEST_F(ValidateExtInst, VStoreNDataWrongType) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32_1 %u32_1 %ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std vstoren: expected Data to be an int or float vector")); +} + +TEST_F(ValidateExtInst, VStoreNAddressingModelLogical) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32vec2_01 %u32_1 %ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Logical")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vstoren can only be used with physical " + "addressing models")); +} + +TEST_F(ValidateExtInst, VStoreNOffsetNotSizeT) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32vec2_01 %u32_1 %ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str(), "", "Physical64")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std vstoren: expected operand Offset to be of type size_t " + "(64-bit integer for the addressing model used in the module)")); +} + +TEST_F(ValidateExtInst, VStoreNPNotPointer) { + std::ostringstream ss; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32vec2_01 %u32_1 " + "%f32_ptr_generic\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std vstoren: expected operand P to be a pointer")); +} + +TEST_F(ValidateExtInst, VStoreNPNotGeneric) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %f32vec2_01 %u32_1 %ptr_w\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vstoren: expected operand P storage class " + "to be Generic")); +} + +TEST_F(ValidateExtInst, VStorePWrongDataType) { + std::ostringstream ss; + ss << "%ptr_w = OpAccessChain %f32_ptr_workgroup %f32vec8_workgroup %u32_1\n"; + ss << "%ptr_g = OpPtrCastToGeneric %f32_ptr_generic %ptr_w\n"; + ss << "%val1 = OpExtInst %void %extinst vstoren %u32vec2_01 %u32_1 %ptr_g\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std vstoren: expected operand P data type to " + "be equal to the type of operand Data components")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle %f32vec4_0123 %u32vec2_01 +%val2 = OpExtInst %f32vec4 %extinst shuffle %f32vec4_0123 %u32vec4_0123 +%val3 = OpExtInst %u32vec2 %extinst shuffle %u32vec4_0123 %u32vec2_01 +%val4 = OpExtInst %u32vec4 %extinst shuffle %u32vec4_0123 %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleWrongResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst shuffle %f32vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected Result Type to be an int or float vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleResultTypeInvalidNumComponents) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst shuffle %f32vec4_0123 %u32vec3_012 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected Result Type to have 2, 4, 8 or 16 components")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleXWrongType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle %f32_0 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected operand X to be an int or float vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleXInvalidNumComponents) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle %f32vec3_012 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected operand X to have 2, 4, 8 or 16 components")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleXInvalidComponentType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle %f64vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std shuffle: " + "expected operand X and Result Type to have equal component types")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleShuffleMaskNotIntVector) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle %f32vec4_0123 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected operand Shuffle Mask to be an int vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleShuffleMaskInvalidNumComponents) { + const std::string body = R"( +%val1 = OpExtInst %f32vec4 %extinst shuffle %f32vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected operand Shuffle Mask to have the same number " + "of components as Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffleShuffleMaskInvalidBitWidth) { + const std::string body = R"( +%val1 = OpExtInst %f64vec2 %extinst shuffle %f64vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle: " + "expected operand Shuffle Mask components to have the " + "same bit width as Result Type components")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2Success) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle2 %f32vec4_0123 %f32vec4_0123 %u32vec2_01 +%val2 = OpExtInst %f32vec4 %extinst shuffle2 %f32vec4_0123 %f32vec4_0123 %u32vec4_0123 +%val3 = OpExtInst %u32vec2 %extinst shuffle2 %u32vec4_0123 %u32vec4_0123 %u32vec2_01 +%val4 = OpExtInst %u32vec4 %extinst shuffle2 %u32vec4_0123 %u32vec4_0123 %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2WrongResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst shuffle2 %f32vec4_0123 %f32vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected Result Type to be an int or float vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2ResultTypeInvalidNumComponents) { + const std::string body = R"( +%val1 = OpExtInst %f32vec3 %extinst shuffle2 %f32vec4_0123 %f32vec4_0123 %u32vec3_012 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected Result Type to have 2, 4, 8 or 16 components")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2XWrongType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle2 %f32_0 %f32_0 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected operand X to be an int or float vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2YTypeDifferentFromX) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle2 %f32vec2_01 %f32vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected operands X and Y to be of the same type")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2XInvalidNumComponents) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle2 %f32vec3_012 %f32vec3_012 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected operand X to have 2, 4, 8 or 16 components")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2XInvalidComponentType) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle2 %f64vec4_0123 %f64vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std shuffle2: " + "expected operand X and Result Type to have equal component types")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2ShuffleMaskNotIntVector) { + const std::string body = R"( +%val1 = OpExtInst %f32vec2 %extinst shuffle2 %f32vec4_0123 %f32vec4_0123 %f32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected operand Shuffle Mask to be an int vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2ShuffleMaskInvalidNumComponents) { + const std::string body = R"( +%val1 = OpExtInst %f32vec4 %extinst shuffle2 %f32vec4_0123 %f32vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected operand Shuffle Mask to have the same number " + "of components as Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdShuffle2ShuffleMaskInvalidBitWidth) { + const std::string body = R"( +%val1 = OpExtInst %f64vec2 %extinst shuffle2 %f64vec4_0123 %f64vec4_0123 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std shuffle2: " + "expected operand Shuffle Mask components to have the " + "same bit width as Result Type components")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrintfSuccess) { + const std::string body = R"( +%format = OpAccessChain %u8_ptr_uniform_constant %u8arr_uniform_constant %u32_0 +%val1 = OpExtInst %u32 %extinst printf %format %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdPrintfBoolResultType) { + const std::string body = R"( +%format = OpAccessChain %u8_ptr_uniform_constant %u8arr_uniform_constant %u32_0 +%val1 = OpExtInst %bool %extinst printf %format %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std printf: expected Result Type to be a 32-bit int type")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrintfU64ResultType) { + const std::string body = R"( +%format = OpAccessChain %u8_ptr_uniform_constant %u8arr_uniform_constant %u32_0 +%val1 = OpExtInst %u64 %extinst printf %format %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std printf: expected Result Type to be a 32-bit int type")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrintfFormatNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst printf %u8_ptr_uniform_constant %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std printf: expected operand Format to be a pointer")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrintfFormatNotUniformConstStorageClass) { + const std::string body = R"( +%format_const = OpAccessChain %u8_ptr_uniform_constant %u8arr_uniform_constant %u32_0 +%format = OpBitcast %u8_ptr_generic %format_const +%val1 = OpExtInst %u32 %extinst printf %format %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std printf: expected Format storage class to " + "be UniformConstant")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrintfFormatNotU8Pointer) { + const std::string body = R"( +%format = OpAccessChain %u32_ptr_uniform_constant %u32vec8_uniform_constant %u32_0 +%val1 = OpExtInst %u32 %extinst printf %format %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std printf: expected Format data type to be 8-bit int")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchU32Success) { + const std::string body = R"( +%ptr = OpAccessChain %u32_ptr_cross_workgroup %u32arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchU32Physical64Success) { + const std::string body = R"( +%ptr = OpAccessChain %u32_ptr_cross_workgroup %u32arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u64_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body, "", "Physical64")); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchF32Success) { + const std::string body = R"( +%ptr = OpAccessChain %f32_ptr_cross_workgroup %f32arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchF32Vec2Success) { + const std::string body = R"( +%ptr = OpAccessChain %f32vec2_ptr_cross_workgroup %f32vec2arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchResultTypeNotVoid) { + const std::string body = R"( +%ptr = OpAccessChain %u32_ptr_cross_workgroup %u32arr_cross_workgroup %u32_0 +%val1 = OpExtInst %u32 %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std prefetch: expected Result Type to be void")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchPtrNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %void %extinst prefetch %u32_ptr_cross_workgroup %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std prefetch: expected operand Ptr to be a pointer")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchPtrNotCrossWorkgroup) { + const std::string body = R"( +%ptr = OpAccessChain %u8_ptr_uniform_constant %u8arr_uniform_constant %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std prefetch: expected operand Ptr storage " + "class to be CrossWorkgroup")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchInvalidDataType) { + const std::string body = R"( +%ptr = OpAccessChain %struct_ptr_cross_workgroup %struct_arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std prefetch: expected Ptr data type to be int " + "or float scalar or vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchAddressingModelLogical) { + const std::string body = R"( +%ptr = OpAccessChain %u32_ptr_cross_workgroup %u32arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body, "", "Logical")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std prefetch can only be used with physical " + "addressing models")); +} + +TEST_F(ValidateExtInst, OpenCLStdPrefetchNumElementsNotSizeT) { + const std::string body = R"( +%ptr = OpAccessChain %f32_ptr_cross_workgroup %f32arr_cross_workgroup %u32_0 +%val1 = OpExtInst %void %extinst prefetch %ptr %u32_256 +)"; + + CompileSuccessfully(GenerateKernelCode(body, "", "Physical64")); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std prefetch: expected operand Num Elements to " + "be of type size_t (64-bit integer for the addressing " + "model used in the module)")); +} + +TEST_P(ValidateOpenCLStdFractLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_f32 = OpVariable %f32_ptr_function Function\n"; + ss << "%var_f32vec2 = OpVariable %f32vec2_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %var_f32\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %var_f32vec2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdFractLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_f32 = OpVariable %f32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %f32_0 %var_f32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdFractLike, XWrongType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_f32 = OpVariable %f32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f64_0 %var_f32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected type of operand X to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdFractLike, NotPointer) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_f32 = OpVariable %f32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected the last operand to be a pointer")); +} + +TEST_P(ValidateOpenCLStdFractLike, PointerInvalidStorageClass) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32_0 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected storage class of the pointer to be " + "Generic, CrossWorkgroup, Workgroup or Function")); +} + +TEST_P(ValidateOpenCLStdFractLike, PointerWrongDataType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_u32 = OpVariable %u32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %var_u32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": expected data type of the pointer to be equal to Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllFractLike, ValidateOpenCLStdFractLike, + ::testing::ValuesIn(std::vector{ + "fract", + "modf", + "sincos", + }), ); + +TEST_F(ValidateExtInst, OpenCLStdRemquoSuccess) { + const std::string body = R"( +%var_f32 = OpVariable %f32_ptr_function Function +%var_f32vec2 = OpVariable %f32vec2_ptr_function Function +%val1 = OpExtInst %f32 %extinst remquo %f32_3 %f32_2 %var_f32 +%val2 = OpExtInst %f32vec2 %extinst remquo %f32vec2_01 %f32vec2_12 %var_f32vec2 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdRemquoIntResultType) { + const std::string body = R"( +%var_f32 = OpVariable %f32_ptr_function Function +%val1 = OpExtInst %u32 %extinst remquo %f32_3 %f32_2 %var_f32 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std remquo: " + "expected Result Type to be a float scalar or vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdRemquoXWrongType) { + const std::string body = R"( +%var_f32 = OpVariable %f32_ptr_function Function +%val1 = OpExtInst %f32 %extinst remquo %u32_3 %f32_2 %var_f32 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std remquo: " + "expected type of operand X to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdRemquoYWrongType) { + const std::string body = R"( +%var_f32 = OpVariable %f32_ptr_function Function +%val1 = OpExtInst %f32 %extinst remquo %f32_3 %u32_2 %var_f32 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std remquo: " + "expected type of operand Y to be equal to Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdRemquoNotPointer) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst remquo %f32_3 %f32_2 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std remquo: " + "expected the last operand to be a pointer")); +} + +TEST_F(ValidateExtInst, OpenCLStdRemquoPointerWrongStorageClass) { + const std::string body = R"( +%ptr = OpAccessChain %f32_ptr_uniform_constant %f32vec8_uniform_constant %u32_1 +%val1 = OpExtInst %f32 %extinst remquo %f32_3 %f32_2 %ptr +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std remquo: " + "expected storage class of the pointer to be Generic, " + "CrossWorkgroup, Workgroup or Function")); +} + +TEST_F(ValidateExtInst, OpenCLStdRemquoPointerWrongDataType) { + const std::string body = R"( +%var_u32 = OpVariable %u32_ptr_function Function +%val1 = OpExtInst %f32 %extinst remquo %f32_3 %f32_2 %var_u32 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std remquo: " + "expected data type of the pointer to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_u32 = OpVariable %u32_ptr_function Function\n"; + ss << "%var_u32vec2 = OpVariable %u32vec2_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %var_u32\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %var_u32vec2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdFrexpLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_u32 = OpVariable %u32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %f32_0 %var_u32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, XWrongType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_u32 = OpVariable %u32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f64_0 %var_u32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected type of operand X to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, NotPointer) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected the last operand to be a pointer")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, PointerInvalidStorageClass) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%ptr = OpAccessChain %f32_ptr_uniform_constant " + "%f32vec8_uniform_constant %u32_1\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name << " %f32_0 %ptr\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected storage class of the pointer to be " + "Generic, CrossWorkgroup, Workgroup or Function")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, PointerDataTypeFloat) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_f32 = OpVariable %f32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %var_f32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected data type of the pointer to be a 32-bit " + "int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, PointerDataTypeU64) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_u64 = OpVariable %u64_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %var_u64\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected data type of the pointer to be a 32-bit " + "int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdFrexpLike, PointerDataTypeDiffSize) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%var_u32 = OpVariable %u32_ptr_function Function\n"; + ss << "%val1 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_01 %var_u32\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected data type of the pointer to have the same " + "number of components as Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllFrexpLike, ValidateOpenCLStdFrexpLike, + ::testing::ValuesIn(std::vector{ + "frexp", + "lgamma_r", + }), ); + +TEST_F(ValidateExtInst, OpenCLStdIlogbSuccess) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst ilogb %f32_3 +%val2 = OpExtInst %u32vec2 %extinst ilogb %f32vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdIlogbFloatResultType) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst ilogb %f32_3 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std ilogb: " + "expected Result Type to be a 32-bit int scalar or vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdIlogbIntX) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst ilogb %u32_3 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std ilogb: " + "expected operand X to be a float scalar or vector")); +} + +TEST_F(ValidateExtInst, OpenCLStdIlogbDiffSize) { + const std::string body = R"( +%val2 = OpExtInst %u32vec2 %extinst ilogb %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std ilogb: " + "expected operand X to have the same number of " + "components as Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdNanSuccess) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst nan %u32_3 +%val2 = OpExtInst %f32vec2 %extinst nan %u32vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtInst, OpenCLStdNanIntResultType) { + const std::string body = R"( +%val1 = OpExtInst %u32 %extinst nan %u32_3 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std nan: " + "expected Result Type to be a float scalar or vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdNanFloatNancode) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst nan %f32_3 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std nan: " + "expected Nancode to be an int scalar or vector type")); +} + +TEST_F(ValidateExtInst, OpenCLStdNanFloatDiffSize) { + const std::string body = R"( +%val1 = OpExtInst %f32 %extinst nan %u32vec2_12 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std nan: " + "expected Nancode to have the same number of " + "components as Result Type")); +} + +TEST_F(ValidateExtInst, OpenCLStdNanFloatDiffBitWidth) { + const std::string body = R"( +%val1 = OpExtInst %f64 %extinst nan %u32_2 +)"; + + CompileSuccessfully(GenerateKernelCode(body)); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std nan: " + "expected Nancode to have the same bit width as Result Type")); +} + +TEST_P(ValidateOpenCLStdLdexpLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %u32_1\n"; + ss << "%val2 = OpExtInst %f32vec2 %extinst " << ext_inst_name + << " %f32vec2_12 %u32vec2_12\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdLdexpLike, IntResultType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u32 %extinst " << ext_inst_name + << " %f32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be a float scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdLdexpLike, XWrongType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %u32_0 %u32_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected type of operand X to be equal to Result Type")); +} + +TEST_P(ValidateOpenCLStdLdexpLike, ExponentNotInt) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %f32_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected the exponent to be a 32-bit int scalar or vector")); +} + +TEST_P(ValidateOpenCLStdLdexpLike, ExponentNotInt32) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %u64_1\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected the exponent to be a 32-bit int scalar or vector")); +} + +TEST_P(ValidateOpenCLStdLdexpLike, ExponentWrongSize) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f32 %extinst " << ext_inst_name + << " %f32_0 %u32vec2_01\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected the exponent to have the same number of " + "components as Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllLdexpLike, ValidateOpenCLStdLdexpLike, + ::testing::ValuesIn(std::vector{ + "ldexp", + "pown", + "rootn", + }), ); + +TEST_P(ValidateOpenCLStdUpsampleLike, Success) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u16 %extinst " << ext_inst_name << " %u8_1 %u8_2\n"; + ss << "%val2 = OpExtInst %u32 %extinst " << ext_inst_name + << " %u16_1 %u16_2\n"; + ss << "%val3 = OpExtInst %u64 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + ss << "%val4 = OpExtInst %u64vec2 %extinst " << ext_inst_name + << " %u32vec2_01 %u32vec2_01\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateOpenCLStdUpsampleLike, FloatResultType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %f64 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Result Type to be an int scalar or vector type")); +} + +TEST_P(ValidateOpenCLStdUpsampleLike, InvalidResultTypeBitWidth) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u8 %extinst " << ext_inst_name << " %u8_1 %u8_2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpenCL.std " + ext_inst_name + + ": expected bit width of Result Type components to be 16, 32 or 64")); +} + +TEST_P(ValidateOpenCLStdUpsampleLike, LoHiDiffType) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u64 %extinst " << ext_inst_name + << " %u32_1 %u16_2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Hi and Lo operands to have the same type")); +} + +TEST_P(ValidateOpenCLStdUpsampleLike, DiffNumberOfComponents) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u64vec2 %extinst " << ext_inst_name + << " %u32_1 %u32_2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected Hi and Lo operands to have the same number " + "of components as Result Type")); +} + +TEST_P(ValidateOpenCLStdUpsampleLike, HiLoWrongBitWidth) { + const std::string ext_inst_name = GetParam(); + std::ostringstream ss; + ss << "%val1 = OpExtInst %u64 %extinst " << ext_inst_name + << " %u16_1 %u16_2\n"; + + CompileSuccessfully(GenerateKernelCode(ss.str())); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpenCL.std " + ext_inst_name + + ": expected bit width of components of Hi and Lo operands to " + "be half of the bit width of components of Result Type")); +} + +INSTANTIATE_TEST_CASE_P(AllUpsampleLike, ValidateOpenCLStdUpsampleLike, + ::testing::ValuesIn(std::vector{ + "u_upsample", + "s_upsample", + }), ); + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_extensions_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_extensions_test.cpp new file mode 100644 index 00000000000..b185c3ca7ea --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_extensions_test.cpp @@ -0,0 +1,322 @@ +// Copyright (c) 2017 Google 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. + +// Tests for OpExtension validator rules. + +#include +#include + +#include "gmock/gmock.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/spirv_target_env.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; +using ::testing::Values; +using ::testing::ValuesIn; + +using ValidateKnownExtensions = spvtest::ValidateBase; +using ValidateUnknownExtensions = spvtest::ValidateBase; +using ValidateExtensionCapabilities = spvtest::ValidateBase; + +// Returns expected error string if |extension| is not recognized. +std::string GetErrorString(const std::string& extension) { + return "Found unrecognized extension " + extension; +} + +INSTANTIATE_TEST_CASE_P( + ExpectSuccess, ValidateKnownExtensions, + Values( + // Match the order as published on the SPIR-V Registry. + "SPV_AMD_shader_explicit_vertex_parameter", + "SPV_AMD_shader_trinary_minmax", "SPV_AMD_gcn_shader", + "SPV_KHR_shader_ballot", "SPV_AMD_shader_ballot", + "SPV_AMD_gpu_shader_half_float", "SPV_KHR_shader_draw_parameters", + "SPV_KHR_subgroup_vote", "SPV_KHR_16bit_storage", + "SPV_KHR_device_group", "SPV_KHR_multiview", + "SPV_NVX_multiview_per_view_attributes", "SPV_NV_viewport_array2", + "SPV_NV_stereo_view_rendering", "SPV_NV_sample_mask_override_coverage", + "SPV_NV_geometry_shader_passthrough", "SPV_AMD_texture_gather_bias_lod", + "SPV_KHR_storage_buffer_storage_class", "SPV_KHR_variable_pointers", + "SPV_AMD_gpu_shader_int16", "SPV_KHR_post_depth_coverage", + "SPV_KHR_shader_atomic_counter_ops", "SPV_EXT_shader_stencil_export", + "SPV_EXT_shader_viewport_index_layer", + "SPV_AMD_shader_image_load_store_lod", "SPV_AMD_shader_fragment_mask", + "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1", + "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_descriptor_indexing")); + +INSTANTIATE_TEST_CASE_P(FailSilently, ValidateUnknownExtensions, + Values("ERROR_unknown_extension", "SPV_KHR_", + "SPV_KHR_shader_ballot_ERROR")); + +TEST_P(ValidateKnownExtensions, ExpectSuccess) { + const std::string extension = GetParam(); + const std::string str = + "OpCapability Shader\nOpCapability Linkage\nOpExtension \"" + extension + + "\"\nOpMemoryModel Logical GLSL450"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Not(HasSubstr(GetErrorString(extension)))); +} + +TEST_P(ValidateUnknownExtensions, FailSilently) { + const std::string extension = GetParam(); + const std::string str = + "OpCapability Shader\nOpCapability Linkage\nOpExtension \"" + extension + + "\"\nOpMemoryModel Logical GLSL450"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(extension))); +} + +TEST_F(ValidateExtensionCapabilities, DeclCapabilitySuccess) { + const std::string str = + "OpCapability Shader\nOpCapability Linkage\nOpCapability DeviceGroup\n" + "OpExtension \"SPV_KHR_device_group\"" + "\nOpMemoryModel Logical GLSL450"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateExtensionCapabilities, DeclCapabilityFailure) { + const std::string str = + "OpCapability Shader\nOpCapability Linkage\nOpCapability DeviceGroup\n" + "\nOpMemoryModel Logical GLSL450"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_ERROR_MISSING_EXTENSION, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("1st operand of Capability")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("requires one of these extensions")); + EXPECT_THAT(getDiagnosticString(), HasSubstr("SPV_KHR_device_group")); +} + +using ValidateAMDShaderBallotCapabilities = spvtest::ValidateBase; + +// Returns a vector of strings for the prefix of a SPIR-V assembly shader +// that can use the group instructions introduced by SPV_AMD_shader_ballot. +std::vector ShaderPartsForAMDShaderBallot() { + return std::vector{R"( + OpCapability Shader + OpCapability Linkage + )", + R"( + OpMemoryModel Logical GLSL450 + %float = OpTypeFloat 32 + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %scope = OpConstant %uint 3 + %uint_const = OpConstant %uint 42 + %int_const = OpConstant %uint 45 + %float_const = OpConstant %float 3.5 + + %void = OpTypeVoid + %fn_ty = OpTypeFunction %void + %fn = OpFunction %void None %fn_ty + %entry = OpLabel + )"}; +} + +// Returns a list of SPIR-V assembly strings, where each uses only types +// and IDs that can fit with a shader made from parts from the result +// of ShaderPartsForAMDShaderBallot. +std::vector AMDShaderBallotGroupInstructions() { + return std::vector{ + "%iadd_reduce = OpGroupIAddNonUniformAMD %uint %scope Reduce %uint_const", + "%iadd_iscan = OpGroupIAddNonUniformAMD %uint %scope InclusiveScan " + "%uint_const", + "%iadd_escan = OpGroupIAddNonUniformAMD %uint %scope ExclusiveScan " + "%uint_const", + + "%fadd_reduce = OpGroupFAddNonUniformAMD %float %scope Reduce " + "%float_const", + "%fadd_iscan = OpGroupFAddNonUniformAMD %float %scope InclusiveScan " + "%float_const", + "%fadd_escan = OpGroupFAddNonUniformAMD %float %scope ExclusiveScan " + "%float_const", + + "%fmin_reduce = OpGroupFMinNonUniformAMD %float %scope Reduce " + "%float_const", + "%fmin_iscan = OpGroupFMinNonUniformAMD %float %scope InclusiveScan " + "%float_const", + "%fmin_escan = OpGroupFMinNonUniformAMD %float %scope ExclusiveScan " + "%float_const", + + "%umin_reduce = OpGroupUMinNonUniformAMD %uint %scope Reduce %uint_const", + "%umin_iscan = OpGroupUMinNonUniformAMD %uint %scope InclusiveScan " + "%uint_const", + "%umin_escan = OpGroupUMinNonUniformAMD %uint %scope ExclusiveScan " + "%uint_const", + + "%smin_reduce = OpGroupUMinNonUniformAMD %int %scope Reduce %int_const", + "%smin_iscan = OpGroupUMinNonUniformAMD %int %scope InclusiveScan " + "%int_const", + "%smin_escan = OpGroupUMinNonUniformAMD %int %scope ExclusiveScan " + "%int_const", + + "%fmax_reduce = OpGroupFMaxNonUniformAMD %float %scope Reduce " + "%float_const", + "%fmax_iscan = OpGroupFMaxNonUniformAMD %float %scope InclusiveScan " + "%float_const", + "%fmax_escan = OpGroupFMaxNonUniformAMD %float %scope ExclusiveScan " + "%float_const", + + "%umax_reduce = OpGroupUMaxNonUniformAMD %uint %scope Reduce %uint_const", + "%umax_iscan = OpGroupUMaxNonUniformAMD %uint %scope InclusiveScan " + "%uint_const", + "%umax_escan = OpGroupUMaxNonUniformAMD %uint %scope ExclusiveScan " + "%uint_const", + + "%smax_reduce = OpGroupUMaxNonUniformAMD %int %scope Reduce %int_const", + "%smax_iscan = OpGroupUMaxNonUniformAMD %int %scope InclusiveScan " + "%int_const", + "%smax_escan = OpGroupUMaxNonUniformAMD %int %scope ExclusiveScan " + "%int_const"}; +} + +TEST_P(ValidateAMDShaderBallotCapabilities, ExpectSuccess) { + // Succeed because the module specifies the SPV_AMD_shader_ballot extension. + auto parts = ShaderPartsForAMDShaderBallot(); + + const std::string assembly = + parts[0] + "OpExtension \"SPV_AMD_shader_ballot\"\n" + parts[1] + + GetParam() + "\nOpReturn OpFunctionEnd"; + + CompileSuccessfully(assembly.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +INSTANTIATE_TEST_CASE_P(ExpectSuccess, ValidateAMDShaderBallotCapabilities, + ValuesIn(AMDShaderBallotGroupInstructions())); + +TEST_P(ValidateAMDShaderBallotCapabilities, ExpectFailure) { + // Fail because the module does not specify the SPV_AMD_shader_ballot + // extension. + auto parts = ShaderPartsForAMDShaderBallot(); + + const std::string assembly = + parts[0] + parts[1] + GetParam() + "\nOpReturn OpFunctionEnd"; + + CompileSuccessfully(assembly.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + + // Make sure we get an appropriate error message. + // Find just the opcode name, skipping over the "Op" part. + auto prefix_with_opcode = GetParam().substr(GetParam().find("Group")); + auto opcode = prefix_with_opcode.substr(0, prefix_with_opcode.find(' ')); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr(std::string("Opcode " + opcode + + " requires one of these capabilities: Groups"))); +} + +INSTANTIATE_TEST_CASE_P(ExpectFailure, ValidateAMDShaderBallotCapabilities, + ValuesIn(AMDShaderBallotGroupInstructions())); + +struct ExtIntoCoreCase { + const char* ext; + const char* cap; + const char* builtin; + spv_target_env env; + bool success; +}; + +using ValidateExtIntoCore = spvtest::ValidateBase; + +// Make sure that we don't panic about missing extensions for using +// functionalities that introduced in extensions but became core SPIR-V later. + +TEST_P(ValidateExtIntoCore, DoNotAskForExtensionInLaterVersion) { + const std::string code = std::string(R"( + OpCapability Shader + OpCapability )") + + GetParam().cap + R"( + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" %builtin + OpDecorate %builtin BuiltIn )" + GetParam().builtin + R"( + %void = OpTypeVoid + %3 = OpTypeFunction %void + %int = OpTypeInt 32 1 +%_ptr_Input_int = OpTypePointer Input %int + %builtin = OpVariable %_ptr_Input_int Input + %main = OpFunction %void None %3 + %5 = OpLabel + %18 = OpLoad %int %builtin + OpReturn + OpFunctionEnd)"; + + CompileSuccessfully(code.c_str(), GetParam().env); + if (GetParam().success) { + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(GetParam().env)); + } else { + ASSERT_NE(SPV_SUCCESS, ValidateInstructions(GetParam().env)); + const std::string message = getDiagnosticString(); + if (spvIsVulkanEnv(GetParam().env)) { + EXPECT_THAT(message, HasSubstr(std::string(GetParam().cap) + + " is not allowed by Vulkan")); + EXPECT_THAT(message, HasSubstr(std::string("or requires extension"))); + } else { + EXPECT_THAT(message, + HasSubstr(std::string("requires one of these extensions: ") + + GetParam().ext)); + } + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + KHR_extensions, ValidateExtIntoCore, + ValuesIn(std::vector{ + // SPV_KHR_shader_draw_parameters became core SPIR-V 1.3 + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseVertex", SPV_ENV_UNIVERSAL_1_3, true}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseVertex", SPV_ENV_UNIVERSAL_1_2, false}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseVertex", SPV_ENV_UNIVERSAL_1_1, false}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseVertex", SPV_ENV_UNIVERSAL_1_0, false}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseVertex", SPV_ENV_VULKAN_1_1, true}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseVertex", SPV_ENV_VULKAN_1_0, false}, + + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseInstance", SPV_ENV_UNIVERSAL_1_3, true}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "BaseInstance", SPV_ENV_VULKAN_1_0, false}, + + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "DrawIndex", SPV_ENV_UNIVERSAL_1_3, true}, + {"SPV_KHR_shader_draw_parameters", "DrawParameters", "DrawIndex", SPV_ENV_UNIVERSAL_1_1, false}, + + // SPV_KHR_multiview became core SPIR-V 1.3 + {"SPV_KHR_multiview", "MultiView", "ViewIndex", SPV_ENV_UNIVERSAL_1_3, true}, + {"SPV_KHR_multiview", "MultiView", "ViewIndex", SPV_ENV_UNIVERSAL_1_2, false}, + {"SPV_KHR_multiview", "MultiView", "ViewIndex", SPV_ENV_UNIVERSAL_1_1, false}, + {"SPV_KHR_multiview", "MultiView", "ViewIndex", SPV_ENV_UNIVERSAL_1_0, false}, + {"SPV_KHR_multiview", "MultiView", "ViewIndex", SPV_ENV_VULKAN_1_1, true}, + {"SPV_KHR_multiview", "MultiView", "ViewIndex", SPV_ENV_VULKAN_1_0, false}, + + // SPV_KHR_device_group became core SPIR-V 1.3 + {"SPV_KHR_device_group", "DeviceGroup", "DeviceIndex", SPV_ENV_UNIVERSAL_1_3, true}, + {"SPV_KHR_device_group", "DeviceGroup", "DeviceIndex", SPV_ENV_UNIVERSAL_1_2, false}, + {"SPV_KHR_device_group", "DeviceGroup", "DeviceIndex", SPV_ENV_UNIVERSAL_1_1, false}, + {"SPV_KHR_device_group", "DeviceGroup", "DeviceIndex", SPV_ENV_UNIVERSAL_1_0, false}, + {"SPV_KHR_device_group", "DeviceGroup", "DeviceIndex", SPV_ENV_VULKAN_1_1, true}, + {"SPV_KHR_device_group", "DeviceGroup", "DeviceIndex", SPV_ENV_VULKAN_1_0, false}, + })); +// clang-format on + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_fixtures.h b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_fixtures.h new file mode 100644 index 00000000000..73a0cc62461 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_fixtures.h @@ -0,0 +1,143 @@ +// Copyright (c) 2015-2016 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. + +// Common validation fixtures for unit tests + +#ifndef TEST_VAL_VAL_FIXTURES_H_ +#define TEST_VAL_VAL_FIXTURES_H_ + +#include +#include + +#include "source/val/validation_state.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" + +namespace spvtest { + +template +class ValidateBase : public ::testing::Test, + public ::testing::WithParamInterface { + public: + ValidateBase(); + + virtual void TearDown(); + + // Returns the a spv_const_binary struct + spv_const_binary get_const_binary(); + + // Checks that 'code' is valid SPIR-V text representation and stores the + // binary version for further method calls. + void CompileSuccessfully(std::string code, + spv_target_env env = SPV_ENV_UNIVERSAL_1_0); + + // Overwrites the word at index 'index' with the given word. + // For testing purposes, it is often useful to be able to manipulate the + // assembled binary before running the validator on it. + // This function overwrites the word at the given index with a new word. + void OverwriteAssembledBinary(uint32_t index, uint32_t word); + + // Performs validation on the SPIR-V code. + spv_result_t ValidateInstructions(spv_target_env env = SPV_ENV_UNIVERSAL_1_0); + + // Performs validation. Returns the status and stores validation state into + // the vstate_ member. + spv_result_t ValidateAndRetrieveValidationState( + spv_target_env env = SPV_ENV_UNIVERSAL_1_0); + + std::string getDiagnosticString(); + spv_position_t getErrorPosition(); + spv_validator_options getValidatorOptions(); + + spv_binary binary_; + spv_diagnostic diagnostic_; + spv_validator_options options_; + std::unique_ptr vstate_; +}; + +template +ValidateBase::ValidateBase() : binary_(), diagnostic_() { + // Initialize to default command line options. Different tests can then + // specialize specific options as necessary. + options_ = spvValidatorOptionsCreate(); +} + +template +spv_const_binary ValidateBase::get_const_binary() { + return spv_const_binary(binary_); +} + +template +void ValidateBase::TearDown() { + if (diagnostic_) { + spvDiagnosticPrint(diagnostic_); + } + spvDiagnosticDestroy(diagnostic_); + spvBinaryDestroy(binary_); + spvValidatorOptionsDestroy(options_); +} + +template +void ValidateBase::CompileSuccessfully(std::string code, + spv_target_env env) { + spv_diagnostic diagnostic = nullptr; + ASSERT_EQ(SPV_SUCCESS, + spvTextToBinary(ScopedContext(env).context, code.c_str(), + code.size(), &binary_, &diagnostic)) + << "ERROR: " << diagnostic->error + << "\nSPIR-V could not be compiled into binary:\n" + << code; +} + +template +void ValidateBase::OverwriteAssembledBinary(uint32_t index, uint32_t word) { + ASSERT_TRUE(index < binary_->wordCount) + << "OverwriteAssembledBinary: The given index is larger than the binary " + "word count."; + binary_->code[index] = word; +} + +template +spv_result_t ValidateBase::ValidateInstructions(spv_target_env env) { + return spvValidateWithOptions(ScopedContext(env).context, options_, + get_const_binary(), &diagnostic_); +} + +template +spv_result_t ValidateBase::ValidateAndRetrieveValidationState( + spv_target_env env) { + return spvtools::val::ValidateBinaryAndKeepValidationState( + ScopedContext(env).context, options_, get_const_binary()->code, + get_const_binary()->wordCount, &diagnostic_, &vstate_); +} + +template +std::string ValidateBase::getDiagnosticString() { + return diagnostic_ == nullptr ? std::string() + : std::string(diagnostic_->error); +} + +template +spv_validator_options ValidateBase::getValidatorOptions() { + return options_; +} + +template +spv_position_t ValidateBase::getErrorPosition() { + return diagnostic_ == nullptr ? spv_position_t() : diagnostic_->position; +} + +} // namespace spvtest + +#endif // TEST_VAL_VAL_FIXTURES_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_id_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_id_test.cpp new file mode 100644 index 00000000000..6d907b188de --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_id_test.cpp @@ -0,0 +1,5091 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/test_fixture.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +// NOTE: The tests in this file are ONLY testing ID usage, there for the input +// SPIR-V does not follow the logical layout rules from the spec in all cases in +// order to makes the tests smaller. Validation of the whole module is handled +// in stages, ID validation is only one of these stages. All validation stages +// are stand alone. + +namespace spvtools { +namespace val { +namespace { + +using spvtest::ScopedContext; +using ::testing::HasSubstr; +using ::testing::ValuesIn; + +using ValidateIdWithMessage = spvtest::ValidateBase; + +std::string kOpCapabilitySetup = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Addresses + OpCapability Int8 + OpCapability Int16 + OpCapability Int64 + OpCapability Float64 + OpCapability LiteralSampler + OpCapability Pipes + OpCapability DeviceEnqueue + OpCapability Vector16 +)"; + +std::string kGLSL450MemoryModel = kOpCapabilitySetup + R"( + OpMemoryModel Logical GLSL450 +)"; + +std::string kNoKernelGLSL450MemoryModel = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Addresses + OpCapability Int8 + OpCapability Int16 + OpCapability Int64 + OpCapability Float64 + OpMemoryModel Logical GLSL450 +)"; + +std::string kOpenCLMemoryModel32 = R"( + OpCapability Addresses + OpCapability Linkage + OpCapability Kernel +%1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical32 OpenCL +)"; + +std::string kOpenCLMemoryModel64 = R"( + OpCapability Addresses + OpCapability Linkage + OpCapability Kernel + OpCapability Int64 +%1 = OpExtInstImport "OpenCL.std" + OpMemoryModel Physical64 OpenCL +)"; + +std::string sampledImageSetup = R"( + %void = OpTypeVoid + %typeFuncVoid = OpTypeFunction %void + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + %image_type = OpTypeImage %float 2D 0 0 0 1 Unknown +%_ptr_UniformConstant_img = OpTypePointer UniformConstant %image_type + %tex = OpVariable %_ptr_UniformConstant_img UniformConstant + %sampler_type = OpTypeSampler +%_ptr_UniformConstant_sam = OpTypePointer UniformConstant %sampler_type + %s = OpVariable %_ptr_UniformConstant_sam UniformConstant + %sampled_image_type = OpTypeSampledImage %image_type + %v2float = OpTypeVector %float 2 + %float_1 = OpConstant %float 1 + %float_2 = OpConstant %float 2 + %const_vec_1_1 = OpConstantComposite %v2float %float_1 %float_1 + %const_vec_2_2 = OpConstantComposite %v2float %float_2 %float_2 + %bool_type = OpTypeBool + %spec_true = OpSpecConstantTrue %bool_type + %main = OpFunction %void None %typeFuncVoid + %label_1 = OpLabel + %image_inst = OpLoad %image_type %tex + %sampler_inst = OpLoad %sampler_type %s +)"; + +std::string BranchConditionalSetup = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %main "main" + OpExecutionMode %main OriginUpperLeft + OpSource GLSL 140 + OpName %main "main" + + ; type definitions + %bool = OpTypeBool + %uint = OpTypeInt 32 0 + %int = OpTypeInt 32 1 + %float = OpTypeFloat 32 + %v4float = OpTypeVector %float 4 + + ; constants + %true = OpConstantTrue %bool + %i0 = OpConstant %int 0 + %i1 = OpConstant %int 1 + %f0 = OpConstant %float 0 + %f1 = OpConstant %float 1 + + + ; main function header + %void = OpTypeVoid + %voidfunc = OpTypeFunction %void + %main = OpFunction %void None %voidfunc + %lmain = OpLabel +)"; + +std::string BranchConditionalTail = R"( + %target_t = OpLabel + OpNop + OpBranch %end + %target_f = OpLabel + OpNop + OpBranch %end + + %end = OpLabel + + OpReturn + OpFunctionEnd +)"; + +// TODO: OpUndef + +TEST_F(ValidateIdWithMessage, OpName) { + std::string spirv = kGLSL450MemoryModel + R"( + OpName %2 "name" +%1 = OpTypeInt 32 0 +%2 = OpTypePointer UniformConstant %1 +%3 = OpVariable %2 UniformConstant)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpMemberNameGood) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberName %2 0 "foo" +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpMemberNameTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberName %1 0 "foo" +%1 = OpTypeInt 32 0)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpMemberName Type '1[foo]' is not a struct type.")); +} +TEST_F(ValidateIdWithMessage, OpMemberNameMemberBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberName %1 1 "foo" +%2 = OpTypeInt 32 0 +%1 = OpTypeStruct %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpMemberName Member '1[foo]' index is larger than " + "Type '1[foo]'s member count.")); +} + +TEST_F(ValidateIdWithMessage, OpLineGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpString "/path/to/source.file" + OpLine %1 0 0 +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Input %2 +%4 = OpVariable %3 Input)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpLineFileBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeInt 32 0 + OpLine %1 0 0 + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpLine Target '1' is not an OpString.")); +} + +TEST_F(ValidateIdWithMessage, OpDecorateGood) { + std::string spirv = kGLSL450MemoryModel + R"( + OpDecorate %2 GLSLShared +%1 = OpTypeInt 64 0 +%2 = OpTypeStruct %1 %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpDecorateBad) { + std::string spirv = kGLSL450MemoryModel + R"( +OpDecorate %1 GLSLShared)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("forward referenced IDs have not been defined")); +} + +TEST_F(ValidateIdWithMessage, OpMemberDecorateGood) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %2 0 Uniform +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct %1 %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpMemberDecorateBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Uniform +%1 = OpTypeInt 32 0)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpMemberDecorate Structure type '1' is not a struct type.")); +} +TEST_F(ValidateIdWithMessage, OpMemberDecorateMemberBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 3 Uniform +%int = OpTypeInt 32 0 +%1 = OpTypeStruct %int %int)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index 3 provided in OpMemberDecorate for struct " + "1 is out of bounds. The structure has 2 members. " + "Largest valid index is 1.")); +} + +TEST_F(ValidateIdWithMessage, OpGroupDecorateGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpDecorationGroup + OpDecorate %1 Uniform + OpDecorate %1 GLSLShared + OpGroupDecorate %1 %3 %4 +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 42 +%4 = OpConstant %2 23)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpDecorationGroupBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpDecorationGroup + OpDecorate %1 Uniform + OpDecorate %1 GLSLShared + OpMemberDecorate %1 0 Constant + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result id of OpDecorationGroup can only " + "be targeted by OpName, OpGroupDecorate, " + "OpDecorate, and OpGroupMemberDecorate")); +} +TEST_F(ValidateIdWithMessage, OpGroupDecorateDecorationGroupBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpGroupDecorate %1 %2 %3 +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 42)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpGroupDecorate Decoration group '1' is not a " + "decoration group.")); +} +TEST_F(ValidateIdWithMessage, OpGroupDecorateTargetBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpDecorationGroup + OpDecorate %1 Uniform + OpDecorate %1 GLSLShared + OpGroupDecorate %1 %3 +%2 = OpTypeInt 32 0)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("forward referenced IDs have not been defined")); +} +TEST_F(ValidateIdWithMessage, OpGroupMemberDecorateDecorationGroupBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpGroupMemberDecorate %1 %2 0 +%2 = OpTypeInt 32 0)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpGroupMemberDecorate Decoration group '1' is " + "not a decoration group.")); +} +TEST_F(ValidateIdWithMessage, OpGroupMemberDecorateIdNotStructBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpDecorationGroup + OpGroupMemberDecorate %1 %2 0 +%2 = OpTypeInt 32 0)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpGroupMemberDecorate Structure type '2' is not " + "a struct type.")); +} +TEST_F(ValidateIdWithMessage, OpGroupMemberDecorateIndexOutOfBoundBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpDecorate %1 Offset 0 + %1 = OpDecorationGroup + OpGroupMemberDecorate %1 %struct 3 +%float = OpTypeFloat 32 +%struct = OpTypeStruct %float %float %float +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Index 3 provided in OpGroupMemberDecorate for struct " + " 2 is out of bounds. The structure has 3 members. " + "Largest valid index is 2.")); +} + +// TODO: OpExtInst + +TEST_F(ValidateIdWithMessage, OpEntryPointGood) { + std::string spirv = kGLSL450MemoryModel + R"( + OpEntryPoint GLCompute %3 "" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpEntryPointFunctionBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpEntryPoint GLCompute %1 "" +%1 = OpTypeVoid)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpEntryPoint Entry Point '1' is not a function.")); +} +TEST_F(ValidateIdWithMessage, OpEntryPointParameterCountBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpEntryPoint GLCompute %3 "" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpEntryPoint Entry Point '1's function parameter " + "count is not zero")); +} +TEST_F(ValidateIdWithMessage, OpEntryPointReturnTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpEntryPoint GLCompute %3 "" +%1 = OpTypeInt 32 0 +%ret = OpConstant %1 0 +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturnValue %ret + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpEntryPoint Entry Point '1's function return " + "type is not void.")); +} + +TEST_F(ValidateIdWithMessage, OpEntryPointInterfaceIsNotVariableTypeBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %ptr_builtin_1 + OpMemberDecorate %struct_1 0 BuiltIn InvocationId + %int = OpTypeInt 32 1 + %void = OpTypeVoid + %func = OpTypeFunction %void + %struct_1 = OpTypeStruct %int +%ptr_builtin_1 = OpTypePointer Input %struct_1 + %main = OpFunction %void None %func + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Interfaces passed to OpEntryPoint must be of type " + "OpTypeVariable. Found OpTypePointer.")); +} + +TEST_F(ValidateIdWithMessage, OpEntryPointInterfaceStorageClassBad) { + std::string spirv = R"( + OpCapability Shader + OpCapability Geometry + OpMemoryModel Logical GLSL450 + OpEntryPoint Geometry %main "main" %in_1 + OpMemberDecorate %struct_1 0 BuiltIn InvocationId + %int = OpTypeInt 32 1 + %void = OpTypeVoid + %func = OpTypeFunction %void + %struct_1 = OpTypeStruct %int +%ptr_builtin_1 = OpTypePointer Uniform %struct_1 + %in_1 = OpVariable %ptr_builtin_1 Uniform + %main = OpFunction %void None %func + %5 = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpEntryPoint interfaces must be OpVariables with " + "Storage Class of Input(1) or Output(3). Found Storage " + "Class 2 for Entry Point id 1.")); +} + +TEST_F(ValidateIdWithMessage, OpExecutionModeGood) { + std::string spirv = kGLSL450MemoryModel + R"( + OpEntryPoint GLCompute %3 "" + OpExecutionMode %3 LocalSize 1 1 1 +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpExecutionModeEntryPointMissing) { + std::string spirv = kGLSL450MemoryModel + R"( + OpExecutionMode %3 LocalSize 1 1 1 +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpExecutionMode Entry Point '1' is not the Entry " + "Point operand of an OpEntryPoint.")); +} + +TEST_F(ValidateIdWithMessage, OpExecutionModeEntryPointBad) { + std::string spirv = kGLSL450MemoryModel + R"( + OpEntryPoint GLCompute %3 "" %a + OpExecutionMode %a LocalSize 1 1 1 +%void = OpTypeVoid +%ptr = OpTypePointer Input %void +%a = OpVariable %ptr Input +%2 = OpTypeFunction %void +%3 = OpFunction %void None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpExecutionMode Entry Point '2' is not the Entry " + "Point operand of an OpEntryPoint.")); +} + +TEST_F(ValidateIdWithMessage, OpTypeVectorFloat) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeVectorInt) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeVector %1 4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeVectorUInt) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 64 0 +%2 = OpTypeVector %1 4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeVectorBool) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeBool +%2 = OpTypeVector %1 4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeVectorComponentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypePointer UniformConstant %1 +%3 = OpTypeVector %2 4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpTypeVector Component Type '2' is not a scalar type.")); +} + +TEST_F(ValidateIdWithMessage, OpTypeMatrixGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 2 +%3 = OpTypeMatrix %2 3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpTypeMatrixColumnTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeMatrix %1 3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Columns in a matrix must be of type vector.")); +} + +TEST_F(ValidateIdWithMessage, OpTypeSamplerGood) { + // In Rev31, OpTypeSampler takes no arguments. + std::string spirv = kGLSL450MemoryModel + R"( +%s = OpTypeSampler)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeArrayGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 1 +%3 = OpTypeArray %1 %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeArrayElementTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 1 +%3 = OpTypeArray %2 %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypeArray Element Type '2' is not a type.")); +} + +// Signed or unsigned. +enum Signed { kSigned, kUnsigned }; + +// Creates an assembly snippet declaring OpTypeArray with the given length. +std::string MakeArrayLength(const std::string& len, Signed isSigned, + int width) { + std::ostringstream ss; + ss << R"( + OpCapability Shader + OpCapability Linkage + OpCapability Int16 + OpCapability Int64 + )"; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << " %t = OpTypeInt " << width << (isSigned == kSigned ? " 1" : " 0"); + ss << " %l = OpConstant %t " << len; + ss << " %a = OpTypeArray %t %l"; + return ss.str(); +} + +// Tests OpTypeArray. Parameter is the width (in bits) of the array-length's +// type. +class OpTypeArrayLengthTest + : public spvtest::TextToBinaryTestBase<::testing::TestWithParam> { + protected: + OpTypeArrayLengthTest() + : position_(spv_position_t{0, 0, 0}), + diagnostic_(spvDiagnosticCreate(&position_, "")) {} + + ~OpTypeArrayLengthTest() { spvDiagnosticDestroy(diagnostic_); } + + // Runs spvValidate() on v, printing any errors via spvDiagnosticPrint(). + spv_result_t Val(const SpirvVector& v, const std::string& expected_err = "") { + spv_const_binary_t cbinary{v.data(), v.size()}; + const auto status = + spvValidate(ScopedContext().context, &cbinary, &diagnostic_); + if (status != SPV_SUCCESS) { + spvDiagnosticPrint(diagnostic_); + EXPECT_THAT(std::string(diagnostic_->error), HasSubstr(expected_err)); + } + return status; + } + + private: + spv_position_t position_; // For creating diagnostic_. + spv_diagnostic diagnostic_; +}; + +TEST_P(OpTypeArrayLengthTest, LengthPositive) { + const int width = GetParam(); + EXPECT_EQ(SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("1", kSigned, width)))); + EXPECT_EQ(SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("1", kUnsigned, width)))); + EXPECT_EQ(SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("2", kSigned, width)))); + EXPECT_EQ(SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("2", kUnsigned, width)))); + EXPECT_EQ(SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("55", kSigned, width)))); + EXPECT_EQ(SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("55", kUnsigned, width)))); + const std::string fpad(width / 4 - 1, 'F'); + EXPECT_EQ( + SPV_SUCCESS, + Val(CompileSuccessfully(MakeArrayLength("0x7" + fpad, kSigned, width)))); + EXPECT_EQ(SPV_SUCCESS, Val(CompileSuccessfully( + MakeArrayLength("0xF" + fpad, kUnsigned, width)))); +} + +TEST_P(OpTypeArrayLengthTest, LengthZero) { + const int width = GetParam(); + EXPECT_EQ( + SPV_ERROR_INVALID_ID, + Val(CompileSuccessfully(MakeArrayLength("0", kSigned, width)), + "OpTypeArray Length '2' default value must be at least 1.")); + EXPECT_EQ( + SPV_ERROR_INVALID_ID, + Val(CompileSuccessfully(MakeArrayLength("0", kUnsigned, width)), + "OpTypeArray Length '2' default value must be at least 1.")); +} + +TEST_P(OpTypeArrayLengthTest, LengthNegative) { + const int width = GetParam(); + EXPECT_EQ( + SPV_ERROR_INVALID_ID, + Val(CompileSuccessfully(MakeArrayLength("-1", kSigned, width)), + "OpTypeArray Length '2' default value must be at least 1.")); + EXPECT_EQ( + SPV_ERROR_INVALID_ID, + Val(CompileSuccessfully(MakeArrayLength("-2", kSigned, width)), + "OpTypeArray Length '2' default value must be at least 1.")); + EXPECT_EQ( + SPV_ERROR_INVALID_ID, + Val(CompileSuccessfully(MakeArrayLength("-123", kSigned, width)), + "OpTypeArray Length '2' default value must be at least 1.")); + const std::string neg_max = "0x8" + std::string(width / 4 - 1, '0'); + EXPECT_EQ( + SPV_ERROR_INVALID_ID, + Val(CompileSuccessfully(MakeArrayLength(neg_max, kSigned, width)), + "OpTypeArray Length '2' default value must be at least 1.")); +} + +// The only valid widths for integers are 8, 16, 32, and 64. +// Since the Int8 capability requires the Kernel capability, and the Kernel +// capability prohibits usage of signed integers, we can skip 8-bit integers +// here since the purpose of these tests is to check the validity of +// OpTypeArray, not OpTypeInt. +INSTANTIATE_TEST_CASE_P(Widths, OpTypeArrayLengthTest, + ValuesIn(std::vector{16, 32, 64})); + +TEST_F(ValidateIdWithMessage, OpTypeArrayLengthNull) { + std::string spirv = kGLSL450MemoryModel + R"( +%i32 = OpTypeInt 32 0 +%len = OpConstantNull %i32 +%ary = OpTypeArray %i32 %len)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpTypeArray Length '2' default value must be at least 1.")); +} + +TEST_F(ValidateIdWithMessage, OpTypeArrayLengthSpecConst) { + std::string spirv = kGLSL450MemoryModel + R"( +%i32 = OpTypeInt 32 0 +%len = OpSpecConstant %i32 2 +%ary = OpTypeArray %i32 %len)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeArrayLengthSpecConstOp) { + std::string spirv = kGLSL450MemoryModel + R"( +%i32 = OpTypeInt 32 0 +%c1 = OpConstant %i32 1 +%c2 = OpConstant %i32 2 +%len = OpSpecConstantOp %i32 IAdd %c1 %c2 +%ary = OpTypeArray %i32 %len)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpTypeRuntimeArrayGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeRuntimeArray %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpTypeRuntimeArrayBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 0 +%3 = OpTypeRuntimeArray %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpTypeRuntimeArray Element Type '2' is not a type.")); +} +// TODO: Object of this type can only be created with OpVariable using the +// Unifrom Storage Class + +TEST_F(ValidateIdWithMessage, OpTypeStructGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFloat 64 +%3 = OpTypePointer Input %1 +%4 = OpTypeStruct %1 %2 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpTypeStructMemberTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFloat 64 +%3 = OpConstant %2 0.0 +%4 = OpTypeStruct %1 %2 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypeStruct Member Type '3' is not a type.")); +} + +TEST_F(ValidateIdWithMessage, OpTypePointerGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypePointer Input %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpTypePointerBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 0 +%3 = OpTypePointer Input %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypePointer Type '2' is not a type.")); +} + +TEST_F(ValidateIdWithMessage, OpTypeFunctionGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpTypeFunctionReturnTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 0 +%3 = OpTypeFunction %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypeFunction Return Type '2' is not a type.")); +} +TEST_F(ValidateIdWithMessage, OpTypeFunctionParameterBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 %2 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpTypeFunction Parameter Type '3' is not a type.")); +} + +TEST_F(ValidateIdWithMessage, OpTypePipeGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 16 +%3 = OpTypePipe ReadOnly)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpConstantTrueGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeBool +%2 = OpConstantTrue %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantTrueBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpConstantTrue %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpConstantTrue Result Type '1' is not a boolean type.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantFalseGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeBool +%2 = OpConstantTrue %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantFalseBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpConstantFalse %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpConstantFalse Result Type '1' is not a boolean type.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpConstant !1 !0)"; + // The expected failure code is implementation dependent (currently + // INVALID_BINARY because the binary parser catches these cases) and may + // change over time, but this must always fail. + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpConstantCompositeVectorGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpConstant %1 3.14 +%4 = OpConstantComposite %2 %3 %3 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeVectorWithUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpConstant %1 3.14 +%9 = OpUndef %1 +%4 = OpConstantComposite %2 %3 %3 %3 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeVectorResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpConstant %1 3.14 +%4 = OpConstantComposite %1 %3 %3 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpConstantComposite Result Type '1' is not a composite type.")); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeVectorConstituentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%4 = OpTypeInt 32 0 +%3 = OpConstant %1 3.14 +%5 = OpConstant %4 42 ; bad type for constant value +%6 = OpConstantComposite %2 %3 %5 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '5's type does not match " + "Result Type '2's vector element type.")); +} +TEST_F(ValidateIdWithMessage, + OpConstantCompositeVectorConstituentUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%4 = OpTypeInt 32 0 +%3 = OpConstant %1 3.14 +%5 = OpUndef %4 ; bad type for undef value +%6 = OpConstantComposite %2 %3 %5 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '5's type does not match " + "Result Type '2's vector element type.")); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeMatrixGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeMatrix %2 4 + %4 = OpConstant %1 1.0 + %5 = OpConstant %1 0.0 + %6 = OpConstantComposite %2 %4 %5 %5 %5 + %7 = OpConstantComposite %2 %5 %4 %5 %5 + %8 = OpConstantComposite %2 %5 %5 %4 %5 + %9 = OpConstantComposite %2 %5 %5 %5 %4 +%10 = OpConstantComposite %3 %6 %7 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeMatrixUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeMatrix %2 4 + %4 = OpConstant %1 1.0 + %5 = OpConstant %1 0.0 + %6 = OpConstantComposite %2 %4 %5 %5 %5 + %7 = OpConstantComposite %2 %5 %4 %5 %5 + %8 = OpConstantComposite %2 %5 %5 %4 %5 + %9 = OpUndef %2 +%10 = OpConstantComposite %3 %6 %7 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeMatrixConstituentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 +%11 = OpTypeVector %1 3 + %3 = OpTypeMatrix %2 4 + %4 = OpConstant %1 1.0 + %5 = OpConstant %1 0.0 + %6 = OpConstantComposite %2 %4 %5 %5 %5 + %7 = OpConstantComposite %2 %5 %4 %5 %5 + %8 = OpConstantComposite %2 %5 %5 %4 %5 + %9 = OpConstantComposite %11 %5 %5 %5 +%10 = OpConstantComposite %3 %6 %7 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '10' vector " + "component count does not match Result Type '4's " + "vector component count.")); +} +TEST_F(ValidateIdWithMessage, + OpConstantCompositeMatrixConstituentUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 +%11 = OpTypeVector %1 3 + %3 = OpTypeMatrix %2 4 + %4 = OpConstant %1 1.0 + %5 = OpConstant %1 0.0 + %6 = OpConstantComposite %2 %4 %5 %5 %5 + %7 = OpConstantComposite %2 %5 %4 %5 %5 + %8 = OpConstantComposite %2 %5 %5 %4 %5 + %9 = OpUndef %11 +%10 = OpConstantComposite %3 %6 %7 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '10' vector " + "component count does not match Result Type '4's " + "vector component count.")); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeArrayGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%4 = OpConstantComposite %3 %2 %2 %2 %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeArrayWithUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%9 = OpUndef %1 +%3 = OpTypeArray %1 %2 +%4 = OpConstantComposite %3 %2 %2 %2 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeArrayConstConstituentBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%4 = OpConstantComposite %3 %2 %2 %2 %1)"; // Uses a type as operand + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '1' is not a " + "constant or undef.")); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeArrayConstituentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%5 = OpTypeFloat 32 +%6 = OpConstant %5 3.14 ; bad type for const value +%4 = OpConstantComposite %3 %2 %2 %2 %6)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '5's type does " + "not match Result Type '3's array element type.")); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeArrayConstituentUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%5 = OpTypeFloat 32 +%6 = OpUndef %5 ; bad type for undef +%4 = OpConstantComposite %3 %2 %2 %2 %6)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '5's type does " + "not match Result Type '3's array element type.")); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeStructGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpConstant %1 42 +%5 = OpConstant %2 4300000000 +%6 = OpConstantComposite %3 %4 %4 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeStructUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpConstant %1 42 +%5 = OpUndef %2 +%6 = OpConstantComposite %3 %4 %4 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantCompositeStructMemberTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpConstant %1 42 +%5 = OpConstant %2 4300000000 +%6 = OpConstantComposite %3 %4 %5 %4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '5' type does " + "not match the Result Type '3's member type.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantCompositeStructMemberUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpConstant %1 42 +%5 = OpUndef %2 +%6 = OpConstantComposite %3 %4 %5 %4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpConstantComposite Constituent '5' type does " + "not match the Result Type '3's member type.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantSamplerGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%float = OpTypeFloat 32 +%samplerType = OpTypeSampler +%3 = OpConstantSampler %samplerType ClampToEdge 0 Nearest)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpConstantSamplerResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpConstantSampler %1 Clamp 0 Nearest)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpConstantSampler Result Type '1' is not a sampler type.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantNullGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeBool + %2 = OpConstantNull %1 + %3 = OpTypeInt 32 0 + %4 = OpConstantNull %3 + %5 = OpTypeFloat 32 + %6 = OpConstantNull %5 + %7 = OpTypePointer UniformConstant %3 + %8 = OpConstantNull %7 + %9 = OpTypeEvent +%10 = OpConstantNull %9 +%11 = OpTypeDeviceEvent +%12 = OpConstantNull %11 +%13 = OpTypeReserveId +%14 = OpConstantNull %13 +%15 = OpTypeQueue +%16 = OpConstantNull %15 +%17 = OpTypeVector %5 2 +%18 = OpConstantNull %17 +%19 = OpTypeMatrix %17 2 +%20 = OpConstantNull %19 +%25 = OpConstant %3 8 +%21 = OpTypeArray %3 %25 +%22 = OpConstantNull %21 +%23 = OpTypeStruct %3 %5 %1 +%24 = OpConstantNull %23 +%26 = OpTypeArray %17 %25 +%27 = OpConstantNull %26 +%28 = OpTypeStruct %7 %26 %26 %1 +%29 = OpConstantNull %28 +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpConstantNullBasicBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpConstantNull %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpConstantNull Result Type '1' cannot have a null value.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantNullArrayBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%2 = OpTypeInt 32 0 +%3 = OpTypeSampler +%4 = OpConstant %2 4 +%5 = OpTypeArray %3 %4 +%6 = OpConstantNull %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpConstantNull Result Type '4' cannot have a null value.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantNullStructBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%2 = OpTypeSampler +%3 = OpTypeStruct %2 %2 +%4 = OpConstantNull %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpConstantNull Result Type '2' cannot have a null value.")); +} + +TEST_F(ValidateIdWithMessage, OpConstantNullRuntimeArrayBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%bool = OpTypeBool +%array = OpTypeRuntimeArray %bool +%null = OpConstantNull %array)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "OpConstantNull Result Type '2' cannot have a null value.")); +} + +TEST_F(ValidateIdWithMessage, OpSpecConstantTrueGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeBool +%2 = OpSpecConstantTrue %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpSpecConstantTrueBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpSpecConstantTrue %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Specialization constant must be a boolean type.")); +} + +TEST_F(ValidateIdWithMessage, OpSpecConstantFalseGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeBool +%2 = OpSpecConstantFalse %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpSpecConstantFalseBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpSpecConstantFalse %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Specialization constant must be a boolean type.")); +} + +TEST_F(ValidateIdWithMessage, OpSpecConstantGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpSpecConstant %1 42)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpSpecConstantBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpSpecConstant !1 !4)"; + // The expected failure code is implementation dependent (currently + // INVALID_BINARY because the binary parser catches these cases) and may + // change over time, but this must always fail. + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Type Id 1 is not a scalar numeric type")); +} + +// Valid: SpecConstantComposite specializes to a vector. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeVectorGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpSpecConstant %1 3.14 +%4 = OpConstant %1 3.14 +%5 = OpSpecConstantComposite %2 %3 %3 %4 %4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Valid: Vector of floats and Undefs. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeVectorWithUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpSpecConstant %1 3.14 +%5 = OpConstant %1 3.14 +%9 = OpUndef %1 +%4 = OpSpecConstantComposite %2 %3 %5 %3 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: result type is float. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeVectorResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpSpecConstant %1 3.14 +%4 = OpSpecConstantComposite %1 %3 %3 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("is not a composite type")); +} + +// Invalid: Vector contains a mix of Int and Float. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeVectorConstituentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%4 = OpTypeInt 32 0 +%3 = OpSpecConstant %1 3.14 +%5 = OpConstant %4 42 ; bad type for constant value +%6 = OpSpecConstantComposite %2 %3 %5 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '5's type " + "does not match Result Type '2's vector element " + "type.")); +} + +// Invalid: Constituent is not a constant +TEST_F(ValidateIdWithMessage, + OpSpecConstantCompositeVectorConstituentNotConstantBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%3 = OpTypeInt 32 0 +%4 = OpSpecConstant %1 3.14 +%6 = OpSpecConstantComposite %2 %3 %4 %4 %4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '3' is not a " + "constant or undef.")); +} + +// Invalid: Vector contains a mix of Undef-int and Float. +TEST_F(ValidateIdWithMessage, + OpSpecConstantCompositeVectorConstituentUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 4 +%4 = OpTypeInt 32 0 +%3 = OpSpecConstant %1 3.14 +%5 = OpUndef %4 ; bad type for undef value +%6 = OpSpecConstantComposite %2 %3 %5 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '5's type " + "does not match Result Type '2's vector element " + "type.")); +} + +// Invalid: Vector expects 3 components, but 4 specified. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeVectorNumComponentsBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeVector %1 3 +%3 = OpConstant %1 3.14 +%5 = OpSpecConstant %1 4.0 +%6 = OpSpecConstantComposite %2 %3 %5 %3 %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent count does " + "not match Result Type '2's vector component " + "count.")); +} + +// Valid: 4x4 matrix of floats +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeMatrixGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeMatrix %2 4 + %4 = OpConstant %1 1.0 + %5 = OpSpecConstant %1 0.0 + %6 = OpSpecConstantComposite %2 %4 %5 %5 %5 + %7 = OpSpecConstantComposite %2 %5 %4 %5 %5 + %8 = OpSpecConstantComposite %2 %5 %5 %4 %5 + %9 = OpSpecConstantComposite %2 %5 %5 %5 %4 +%10 = OpSpecConstantComposite %3 %6 %7 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Valid: Matrix in which one column is Undef +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeMatrixUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeMatrix %2 4 + %4 = OpConstant %1 1.0 + %5 = OpSpecConstant %1 0.0 + %6 = OpSpecConstantComposite %2 %4 %5 %5 %5 + %7 = OpSpecConstantComposite %2 %5 %4 %5 %5 + %8 = OpSpecConstantComposite %2 %5 %5 %4 %5 + %9 = OpUndef %2 +%10 = OpSpecConstantComposite %3 %6 %7 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Matrix in which the sizes of column vectors are not equal. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeMatrixConstituentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeVector %1 3 + %4 = OpTypeMatrix %2 4 + %5 = OpSpecConstant %1 1.0 + %6 = OpConstant %1 0.0 + %7 = OpSpecConstantComposite %2 %5 %6 %6 %6 + %8 = OpSpecConstantComposite %2 %6 %5 %6 %6 + %9 = OpSpecConstantComposite %2 %6 %6 %5 %6 + %10 = OpSpecConstantComposite %3 %6 %6 %6 +%11 = OpSpecConstantComposite %4 %7 %8 %9 %10)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '10' vector " + "component count does not match Result Type '4's " + "vector component count.")); +} + +// Invalid: Matrix type expects 4 columns but only 3 specified. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeMatrixNumColsBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeMatrix %2 4 + %4 = OpSpecConstant %1 1.0 + %5 = OpConstant %1 0.0 + %6 = OpSpecConstantComposite %2 %4 %5 %5 %5 + %7 = OpSpecConstantComposite %2 %5 %4 %5 %5 + %8 = OpSpecConstantComposite %2 %5 %5 %4 %5 +%10 = OpSpecConstantComposite %3 %6 %7 %8)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent count does " + "not match Result Type '3's matrix column count.")); +} + +// Invalid: Composite contains a non-const/undef component +TEST_F(ValidateIdWithMessage, + OpSpecConstantCompositeMatrixConstituentNotConstBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpConstant %1 0.0 + %3 = OpTypeVector %1 4 + %4 = OpTypeMatrix %3 4 + %5 = OpSpecConstantComposite %3 %2 %2 %2 %2 + %6 = OpSpecConstantComposite %4 %5 %5 %5 %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '1' is not a " + "constant composite or undef.")); +} + +// Invalid: Composite contains a column that is *not* a vector (it's an array) +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeMatrixColTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeInt 32 0 + %3 = OpSpecConstant %2 4 + %4 = OpConstant %1 0.0 + %5 = OpTypeVector %1 4 + %6 = OpTypeArray %2 %3 + %7 = OpTypeMatrix %5 4 + %8 = OpSpecConstantComposite %6 %3 %3 %3 %3 + %9 = OpSpecConstantComposite %5 %4 %4 %4 %4 + %10 = OpSpecConstantComposite %7 %9 %9 %9 %8)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '8' type " + "does not match Result Type '7's matrix column " + "type.")); +} + +// Invalid: Matrix with an Undef column of the wrong size. +TEST_F(ValidateIdWithMessage, + OpSpecConstantCompositeMatrixConstituentUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeFloat 32 + %2 = OpTypeVector %1 4 + %3 = OpTypeVector %1 3 + %4 = OpTypeMatrix %2 4 + %5 = OpSpecConstant %1 1.0 + %6 = OpSpecConstant %1 0.0 + %7 = OpSpecConstantComposite %2 %5 %6 %6 %6 + %8 = OpSpecConstantComposite %2 %6 %5 %6 %6 + %9 = OpSpecConstantComposite %2 %6 %6 %5 %6 + %10 = OpUndef %3 + %11 = OpSpecConstantComposite %4 %7 %8 %9 %10)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '10' vector " + "component count does not match Result Type '4's " + "vector component count.")); +} + +// Invalid: Matrix in which some columns are Int and some are Float. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeMatrixColumnTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeInt 32 0 + %2 = OpTypeFloat 32 + %3 = OpTypeVector %1 2 + %4 = OpTypeVector %2 2 + %5 = OpTypeMatrix %4 2 + %6 = OpSpecConstant %1 42 + %7 = OpConstant %2 3.14 + %8 = OpSpecConstantComposite %3 %6 %6 + %9 = OpSpecConstantComposite %4 %7 %7 +%10 = OpSpecConstantComposite %5 %8 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '8' " + "component type does not match Result Type '5's " + "matrix column component type.")); +} + +// Valid: Array of integers +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeArrayGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpSpecConstant %1 4 +%5 = OpConstant %1 5 +%3 = OpTypeArray %1 %2 +%6 = OpTypeArray %1 %5 +%4 = OpSpecConstantComposite %3 %2 %2 %2 %2 +%7 = OpSpecConstantComposite %3 %5 %5 %5 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Expecting an array of 4 components, but 3 specified. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeArrayNumComponentsBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%4 = OpSpecConstantComposite %3 %2 %2 %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent count does not " + "match Result Type '3's array length.")); +} + +// Valid: Array of Integers and Undef-int +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeArrayWithUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpSpecConstant %1 4 +%9 = OpUndef %1 +%3 = OpTypeArray %1 %2 +%4 = OpSpecConstantComposite %3 %2 %2 %2 %9)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Array uses a type as operand. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeArrayConstConstituentBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%4 = OpSpecConstantComposite %3 %2 %2 %2 %1)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '1' is not a " + "constant or undef.")); +} + +// Invalid: Array has a mix of Int and Float components. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeArrayConstituentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpConstant %1 4 +%3 = OpTypeArray %1 %2 +%4 = OpTypeFloat 32 +%5 = OpSpecConstant %4 3.14 ; bad type for const value +%6 = OpSpecConstantComposite %3 %2 %2 %2 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '5's type " + "does not match Result Type '3's array element " + "type.")); +} + +// Invalid: Array has a mix of Int and Undef-float. +TEST_F(ValidateIdWithMessage, + OpSpecConstantCompositeArrayConstituentUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpSpecConstant %1 4 +%3 = OpTypeArray %1 %2 +%5 = OpTypeFloat 32 +%6 = OpUndef %5 ; bad type for undef +%4 = OpSpecConstantComposite %3 %2 %2 %2 %6)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '5's type " + "does not match Result Type '3's array element " + "type.")); +} + +// Valid: Struct of {Int32,Int32,Int64}. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpConstant %1 42 +%5 = OpSpecConstant %2 4300000000 +%6 = OpSpecConstantComposite %3 %4 %4 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: missing one int32 struct member. +TEST_F(ValidateIdWithMessage, + OpSpecConstantCompositeStructMissingComponentBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%3 = OpTypeStruct %1 %1 %1 +%4 = OpConstant %1 42 +%5 = OpSpecConstant %1 430 +%6 = OpSpecConstantComposite %3 %4 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '2' count " + "does not match Result Type '2's struct member " + "count.")); +} + +// Valid: Struct uses Undef-int64. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructUndefGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpSpecConstant %1 42 +%5 = OpUndef %2 +%6 = OpSpecConstantComposite %3 %4 %4 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Composite contains non-const/undef component. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructNonConstBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpSpecConstant %1 42 +%5 = OpUndef %2 +%6 = OpSpecConstantComposite %3 %4 %1 %5)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '1' is not a " + "constant or undef.")); +} + +// Invalid: Struct component type does not match expected specialization type. +// Second component was expected to be Int32, but got Int64. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructMemberTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpConstant %1 42 +%5 = OpSpecConstant %2 4300000000 +%6 = OpSpecConstantComposite %3 %4 %5 %4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '5' type " + "does not match the Result Type '3's member " + "type.")); +} + +// Invalid: Undef-int64 used when Int32 was expected. +TEST_F(ValidateIdWithMessage, OpSpecConstantCompositeStructMemberUndefTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeInt 64 0 +%3 = OpTypeStruct %1 %1 %2 +%4 = OpSpecConstant %1 42 +%5 = OpUndef %2 +%6 = OpSpecConstantComposite %3 %4 %5 %4)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpSpecConstantComposite Constituent '5' type " + "does not match the Result Type '3's member " + "type.")); +} + +// TODO: OpSpecConstantOp + +TEST_F(ValidateIdWithMessage, OpVariableGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypePointer Input %1 +%3 = OpVariable %2 Input)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpVariableInitializerConstantGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypePointer Input %1 +%3 = OpConstant %1 42 +%4 = OpVariable %2 Input %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpVariableInitializerGlobalVariableGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypePointer Uniform %1 +%3 = OpVariable %2 Uniform +%4 = OpTypePointer Uniform %2 ; pointer to pointer +%5 = OpVariable %4 Uniform %3)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +// TODO: Positive test OpVariable with OpConstantNull of OpTypePointer +TEST_F(ValidateIdWithMessage, OpVariableResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpVariable %1 Input)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpVariable Result Type '1' is not a pointer type.")); +} +TEST_F(ValidateIdWithMessage, OpVariableInitializerIsTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypePointer Input %1 +%3 = OpVariable %2 Input %2)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpVariable Initializer '2' is not a constant or " + "module-scope variable")); +} + +TEST_F(ValidateIdWithMessage, OpVariableInitializerIsFunctionVarBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ptrint = OpTypePointer Function %int +%ptrptrint = OpTypePointer Function %ptrint +%void = OpTypeVoid +%fnty = OpTypeFunction %void +%main = OpFunction %void None %fnty +%entry = OpLabel +%var = OpVariable %ptrint Function +%varinit = OpVariable %ptrptrint Function %var ; Can't initialize function variable. +OpReturn +OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpVariable Initializer '8' is not a constant or " + "module-scope variable")); +} + +TEST_F(ValidateIdWithMessage, OpVariableInitializerIsModuleVarGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ptrint = OpTypePointer Uniform %int +%mvar = OpVariable %ptrint Uniform +%ptrptrint = OpTypePointer Function %ptrint +%void = OpTypeVoid +%fnty = OpTypeFunction %void +%main = OpFunction %void None %fnty +%entry = OpLabel +%goodvar = OpVariable %ptrptrint Function %mvar ; This is ok +OpReturn +OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpLoadGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeInt 32 0 + %3 = OpTypePointer UniformConstant %2 + %4 = OpTypeFunction %1 + %5 = OpVariable %3 UniformConstant + %6 = OpFunction %1 None %4 + %7 = OpLabel + %8 = OpLoad %2 %5 + %9 = OpReturn +%10 = OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// TODO: Add tests that exercise VariablePointersStorageBuffer instead of +// VariablePointers. +void createVariablePointerSpirvProgram(std::ostringstream* spirv, + std::string result_strategy, + bool use_varptr_cap, + bool add_helper_function) { + *spirv << "OpCapability Shader "; + if (use_varptr_cap) { + *spirv << "OpCapability VariablePointers "; + *spirv << "OpExtension \"SPV_KHR_variable_pointers\" "; + } + *spirv << R"( + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" + %void = OpTypeVoid + %voidf = OpTypeFunction %void + %bool = OpTypeBool + %i32 = OpTypeInt 32 1 + %f32 = OpTypeFloat 32 + %f32ptr = OpTypePointer Uniform %f32 + %i = OpConstant %i32 1 + %zero = OpConstant %i32 0 + %float_1 = OpConstant %f32 1.0 + %ptr1 = OpVariable %f32ptr Uniform + %ptr2 = OpVariable %f32ptr Uniform + )"; + if (add_helper_function) { + *spirv << R"( + ; //////////////////////////////////////////////////////////// + ;;;; Function that returns a pointer + ; //////////////////////////////////////////////////////////// + %selector_func_type = OpTypeFunction %f32ptr %bool %f32ptr %f32ptr + %choose_input_func = OpFunction %f32ptr None %selector_func_type + %is_neg_param = OpFunctionParameter %bool + %first_ptr_param = OpFunctionParameter %f32ptr + %second_ptr_param = OpFunctionParameter %f32ptr + %selector_func_begin = OpLabel + %result_ptr = OpSelect %f32ptr %is_neg_param %first_ptr_param %second_ptr_param + OpReturnValue %result_ptr + OpFunctionEnd + )"; + } + *spirv << R"( + %main = OpFunction %void None %voidf + %label = OpLabel + )"; + *spirv << result_strategy; + *spirv << R"( + OpReturn + OpFunctionEnd + )"; +} + +// With the VariablePointer Capability, OpLoad should allow loading a +// VaiablePointer. In this test the variable pointer is obtained by an OpSelect +TEST_F(ValidateIdWithMessage, OpLoadVarPtrOpSelectGood) { + std::string result_strategy = R"( + %isneg = OpSLessThan %bool %i %zero + %varptr = OpSelect %f32ptr %isneg %ptr1 %ptr2 + %result = OpLoad %f32 %varptr + )"; + + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, result_strategy, + true /* Add VariablePointers Capability? */, + false /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Without the VariablePointers Capability, OpLoad will not allow loading +// through a variable pointer. +// Disabled since using OpSelect with pointers without VariablePointers will +// fail LogicalsPass. +TEST_F(ValidateIdWithMessage, DISABLED_OpLoadVarPtrOpSelectBad) { + std::string result_strategy = R"( + %isneg = OpSLessThan %bool %i %zero + %varptr = OpSelect %f32ptr %isneg %ptr1 %ptr2 + %result = OpLoad %f32 %varptr + )"; + + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, result_strategy, + false /* Add VariablePointers Capability?*/, + false /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("is not a logical pointer.")); +} + +// With the VariablePointer Capability, OpLoad should allow loading a +// VaiablePointer. In this test the variable pointer is obtained by an OpPhi +TEST_F(ValidateIdWithMessage, OpLoadVarPtrOpPhiGood) { + std::string result_strategy = R"( + %is_neg = OpSLessThan %bool %i %zero + OpSelectionMerge %end_label None + OpBranchConditional %is_neg %take_ptr_1 %take_ptr_2 + %take_ptr_1 = OpLabel + OpBranch %end_label + %take_ptr_2 = OpLabel + OpBranch %end_label + %end_label = OpLabel + %varptr = OpPhi %f32ptr %ptr1 %take_ptr_1 %ptr2 %take_ptr_2 + %result = OpLoad %f32 %varptr + )"; + + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, result_strategy, + true /* Add VariablePointers Capability?*/, + false /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Without the VariablePointers Capability, OpLoad will not allow loading +// through a variable pointer. +TEST_F(ValidateIdWithMessage, OpLoadVarPtrOpPhiBad) { + std::string result_strategy = R"( + %is_neg = OpSLessThan %bool %i %zero + OpSelectionMerge %end_label None + OpBranchConditional %is_neg %take_ptr_1 %take_ptr_2 + %take_ptr_1 = OpLabel + OpBranch %end_label + %take_ptr_2 = OpLabel + OpBranch %end_label + %end_label = OpLabel + %varptr = OpPhi %f32ptr %ptr1 %take_ptr_1 %ptr2 %take_ptr_2 + %result = OpLoad %f32 %varptr + )"; + + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, result_strategy, + false /* Add VariablePointers Capability?*/, + false /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("is not a logical pointer")); +} + +// With the VariablePointer Capability, OpLoad should allow loading through a +// VaiablePointer. In this test the variable pointer is obtained from an +// OpFunctionCall (return value from a function) +TEST_F(ValidateIdWithMessage, OpLoadVarPtrOpFunctionCallGood) { + std::ostringstream spirv; + std::string result_strategy = R"( + %isneg = OpSLessThan %bool %i %zero + %varptr = OpFunctionCall %f32ptr %choose_input_func %isneg %ptr1 %ptr2 + %result = OpLoad %f32 %varptr + )"; + + createVariablePointerSpirvProgram(&spirv, result_strategy, + true /* Add VariablePointers Capability?*/, + true /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpLoadResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer UniformConstant %2 +%4 = OpTypeFunction %1 +%5 = OpVariable %3 UniformConstant +%6 = OpFunction %1 None %4 +%7 = OpLabel +%8 = OpLoad %3 %5 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpLoad Result Type '3' does not match Pointer " + " '5's type.")); +} + +TEST_F(ValidateIdWithMessage, OpLoadPointerBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer UniformConstant %2 +%4 = OpTypeFunction %1 +%5 = OpFunction %1 None %4 +%6 = OpLabel +%7 = OpLoad %2 %8 + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + // Prove that SSA checks trigger for a bad Id value. + // The next test case show the not-a-logical-pointer case. + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 8 has not been defined")); +} + +// Disabled as bitcasting type to object is now not valid. +TEST_F(ValidateIdWithMessage, DISABLED_OpLoadLogicalPointerBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFloat 32 +%4 = OpTypePointer UniformConstant %2 +%5 = OpTypePointer UniformConstant %3 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +%9 = OpBitcast %5 %4 ; Not valid in logical addressing +%10 = OpLoad %3 %9 ; Should trigger message + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + // Once we start checking bitcasts, we might catch that + // as the error first, instead of catching it here. + // I don't know if it's possible to generate a bad case + // if/when the validator is complete. + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpLoad Pointer '9' is not a logical pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpStoreGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %1 None %4 +%8 = OpLabel + OpStore %6 %5 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpStorePointerBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer UniformConstant %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %1 None %4 +%8 = OpLabel + OpStore %3 %5 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Pointer '3' is not a logical pointer.")); +} + +// Disabled as bitcasting type to object is now not valid. +TEST_F(ValidateIdWithMessage, DISABLED_OpStoreLogicalPointerBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFloat 32 +%4 = OpTypePointer UniformConstant %2 +%5 = OpTypePointer UniformConstant %3 +%6 = OpTypeFunction %1 +%7 = OpConstantNull %5 +%8 = OpFunction %1 None %6 +%9 = OpLabel +%10 = OpBitcast %5 %4 ; Not valid in logical addressing +%11 = OpStore %10 %7 ; Should trigger message + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Pointer '10' is not a logical pointer.")); +} + +// Without the VariablePointer Capability, OpStore should may not store +// through a variable pointer. +// Disabled since using OpSelect with pointers without VariablePointers will +// fail LogicalsPass. +TEST_F(ValidateIdWithMessage, DISABLED_OpStoreVarPtrBad) { + std::string result_strategy = R"( + %isneg = OpSLessThan %bool %i %zero + %varptr = OpSelect %f32ptr %isneg %ptr1 %ptr2 + OpStore %varptr %float_1 + )"; + + std::ostringstream spirv; + createVariablePointerSpirvProgram( + &spirv, result_strategy, false /* Add VariablePointers Capability? */, + false /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("is not a logical pointer.")); +} + +// With the VariablePointer Capability, OpStore should allow storing through a +// variable pointer. +TEST_F(ValidateIdWithMessage, OpStoreVarPtrGood) { + std::string result_strategy = R"( + %isneg = OpSLessThan %bool %i %zero + %varptr = OpSelect %f32ptr %isneg %ptr1 %ptr2 + OpStore %varptr %float_1 + )"; + + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, result_strategy, + true /* Add VariablePointers Capability? */, + false /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpStoreObjectGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %1 None %4 +%8 = OpLabel +%9 = OpUndef %1 + OpStore %6 %9 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Object '9's type is void.")); +} +TEST_F(ValidateIdWithMessage, OpStoreTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%9 = OpTypeFloat 32 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %9 3.14 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %1 None %4 +%8 = OpLabel + OpStore %6 %5 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Pointer '7's type does not match Object " + " '6's type.")); +} + +// The next series of test check test a relaxation of the rules for stores to +// structs. The first test checks that we get a failure when the option is not +// set to relax the rule. +// TODO: Add tests for layout compatible arrays and matricies when the validator +// relaxes the rules for them as well. Also need test to check for layout +// decorations specific to those types. +TEST_F(ValidateIdWithMessage, OpStoreTypeBadStruct) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Offset 0 + OpMemberDecorate %1 1 Offset 4 + OpMemberDecorate %2 0 Offset 0 + OpMemberDecorate %2 1 Offset 4 +%3 = OpTypeVoid +%4 = OpTypeFloat 32 +%1 = OpTypeStruct %4 %4 +%5 = OpTypePointer Uniform %1 +%2 = OpTypeStruct %4 %4 +%6 = OpTypeFunction %3 +%7 = OpConstant %4 3.14 +%8 = OpVariable %5 Uniform +%9 = OpFunction %3 None %6 +%10 = OpLabel +%11 = OpCompositeConstruct %2 %7 %7 + OpStore %8 %11 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Pointer '8's type does not match Object " + " '11's type.")); +} + +// Same code as the last test. The difference is that we relax the rule. +// Because the structs %3 and %5 are defined the same way. +TEST_F(ValidateIdWithMessage, OpStoreTypeRelaxedStruct) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Offset 0 + OpMemberDecorate %1 1 Offset 4 + OpMemberDecorate %2 0 Offset 0 + OpMemberDecorate %2 1 Offset 4 +%3 = OpTypeVoid +%4 = OpTypeFloat 32 +%1 = OpTypeStruct %4 %4 +%5 = OpTypePointer Uniform %1 +%2 = OpTypeStruct %4 %4 +%6 = OpTypeFunction %3 +%7 = OpConstant %4 3.14 +%8 = OpVariable %5 Uniform +%9 = OpFunction %3 None %6 +%10 = OpLabel +%11 = OpCompositeConstruct %2 %7 %7 + OpStore %8 %11 + OpReturn + OpFunctionEnd)"; + spvValidatorOptionsSetRelaxStoreStruct(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Same code as the last test excect for an extra decoration on one of the +// members. With the relaxed rules, the code is still valid. +TEST_F(ValidateIdWithMessage, OpStoreTypeRelaxedStructWithExtraDecoration) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Offset 0 + OpMemberDecorate %1 1 Offset 4 + OpMemberDecorate %1 0 RelaxedPrecision + OpMemberDecorate %2 0 Offset 0 + OpMemberDecorate %2 1 Offset 4 +%3 = OpTypeVoid +%4 = OpTypeFloat 32 +%1 = OpTypeStruct %4 %4 +%5 = OpTypePointer Uniform %1 +%2 = OpTypeStruct %4 %4 +%6 = OpTypeFunction %3 +%7 = OpConstant %4 3.14 +%8 = OpVariable %5 Uniform +%9 = OpFunction %3 None %6 +%10 = OpLabel +%11 = OpCompositeConstruct %2 %7 %7 + OpStore %8 %11 + OpReturn + OpFunctionEnd)"; + spvValidatorOptionsSetRelaxStoreStruct(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// This test check that we recursively traverse the struct to check if they are +// interchangable. +TEST_F(ValidateIdWithMessage, OpStoreTypeRelaxedNestedStruct) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Offset 0 + OpMemberDecorate %1 1 Offset 4 + OpMemberDecorate %2 0 Offset 0 + OpMemberDecorate %2 1 Offset 8 + OpMemberDecorate %3 0 Offset 0 + OpMemberDecorate %3 1 Offset 4 + OpMemberDecorate %4 0 Offset 0 + OpMemberDecorate %4 1 Offset 8 +%5 = OpTypeVoid +%6 = OpTypeInt 32 0 +%7 = OpTypeFloat 32 +%1 = OpTypeStruct %7 %6 +%2 = OpTypeStruct %1 %1 +%8 = OpTypePointer Uniform %2 +%3 = OpTypeStruct %7 %6 +%4 = OpTypeStruct %3 %3 +%9 = OpTypeFunction %5 +%10 = OpConstant %6 7 +%11 = OpConstant %7 3.14 +%12 = OpConstantComposite %3 %11 %10 +%13 = OpVariable %8 Uniform +%14 = OpFunction %5 None %9 +%15 = OpLabel +%16 = OpCompositeConstruct %4 %12 %12 + OpStore %13 %16 + OpReturn + OpFunctionEnd)"; + spvValidatorOptionsSetRelaxStoreStruct(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// This test check that the even with the relaxed rules an error is identified +// if the members of the struct are in a different order. +TEST_F(ValidateIdWithMessage, OpStoreTypeBadRelaxedStruct1) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Offset 0 + OpMemberDecorate %1 1 Offset 4 + OpMemberDecorate %2 0 Offset 0 + OpMemberDecorate %2 1 Offset 8 + OpMemberDecorate %3 0 Offset 0 + OpMemberDecorate %3 1 Offset 4 + OpMemberDecorate %4 0 Offset 0 + OpMemberDecorate %4 1 Offset 8 +%5 = OpTypeVoid +%6 = OpTypeInt 32 0 +%7 = OpTypeFloat 32 +%1 = OpTypeStruct %6 %7 +%2 = OpTypeStruct %1 %1 +%8 = OpTypePointer Uniform %2 +%3 = OpTypeStruct %7 %6 +%4 = OpTypeStruct %3 %3 +%9 = OpTypeFunction %5 +%10 = OpConstant %6 7 +%11 = OpConstant %7 3.14 +%12 = OpConstantComposite %3 %11 %10 +%13 = OpVariable %8 Uniform +%14 = OpFunction %5 None %9 +%15 = OpLabel +%16 = OpCompositeConstruct %4 %12 %12 + OpStore %13 %16 + OpReturn + OpFunctionEnd)"; + spvValidatorOptionsSetRelaxStoreStruct(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpStore Pointer '13's layout does not match Object " + " '16's layout.")); +} + +// This test check that the even with the relaxed rules an error is identified +// if the members of the struct are at different offsets. +TEST_F(ValidateIdWithMessage, OpStoreTypeBadRelaxedStruct2) { + std::string spirv = kGLSL450MemoryModel + R"( + OpMemberDecorate %1 0 Offset 4 + OpMemberDecorate %1 1 Offset 0 + OpMemberDecorate %2 0 Offset 0 + OpMemberDecorate %2 1 Offset 8 + OpMemberDecorate %3 0 Offset 0 + OpMemberDecorate %3 1 Offset 4 + OpMemberDecorate %4 0 Offset 0 + OpMemberDecorate %4 1 Offset 8 +%5 = OpTypeVoid +%6 = OpTypeInt 32 0 +%7 = OpTypeFloat 32 +%1 = OpTypeStruct %7 %6 +%2 = OpTypeStruct %1 %1 +%8 = OpTypePointer Uniform %2 +%3 = OpTypeStruct %7 %6 +%4 = OpTypeStruct %3 %3 +%9 = OpTypeFunction %5 +%10 = OpConstant %6 7 +%11 = OpConstant %7 3.14 +%12 = OpConstantComposite %3 %11 %10 +%13 = OpVariable %8 Uniform +%14 = OpFunction %5 None %9 +%15 = OpLabel +%16 = OpCompositeConstruct %4 %12 %12 + OpStore %13 %16 + OpReturn + OpFunctionEnd)"; + spvValidatorOptionsSetRelaxStoreStruct(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpStore Pointer '13's layout does not match Object " + " '16's layout.")); +} + +TEST_F(ValidateIdWithMessage, OpStoreTypeRelaxedLogicalPointerReturnPointer) { + const std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%1 = OpTypeInt 32 1 +%2 = OpTypePointer Function %1 +%3 = OpTypeFunction %2 %2 +%4 = OpFunction %2 None %3 +%5 = OpFunctionParameter %2 +%6 = OpLabel + OpReturnValue %5 + OpFunctionEnd)"; + + spvValidatorOptionsSetRelaxLogicalPointer(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpStoreTypeRelaxedLogicalPointerAllocPointer) { + const std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %1 = OpTypeVoid + %2 = OpTypeInt 32 1 + %3 = OpTypeFunction %1 ; void(void) + %4 = OpTypePointer Uniform %2 ; int* + %5 = OpTypePointer Private %4 ; int** (Private) + %6 = OpTypePointer Function %4 ; int** (Function) + %7 = OpVariable %5 Private + %8 = OpFunction %1 None %3 + %9 = OpLabel +%10 = OpVariable %6 Function + OpReturn + OpFunctionEnd)"; + + spvValidatorOptionsSetRelaxLogicalPointer(options_, true); + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpStoreVoid) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %1 None %4 +%8 = OpLabel +%9 = OpFunctionCall %1 %7 + OpStore %6 %9 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Object '8's type is void.")); +} + +TEST_F(ValidateIdWithMessage, OpStoreLabel) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %1 None %4 +%8 = OpLabel + OpStore %6 %8 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpStore Object '7' is not an object.")); +} + +// TODO: enable when this bug is fixed: +// https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15404 +TEST_F(ValidateIdWithMessage, DISABLED_OpStoreFunction) { + std::string spirv = kGLSL450MemoryModel + R"( +%2 = OpTypeInt 32 0 +%3 = OpTypePointer UniformConstant %2 +%4 = OpTypeFunction %2 +%5 = OpConstant %2 123 +%6 = OpVariable %3 UniformConstant +%7 = OpFunction %2 None %4 +%8 = OpLabel + OpStore %6 %7 + OpReturnValue %5 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpStoreBuiltin) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID + OpExecutionMode %main LocalSize 1 1 1 + OpSource GLSL 450 + OpName %main "main" + + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId + + %int = OpTypeInt 32 1 + %uint = OpTypeInt 32 0 + %v3uint = OpTypeVector %uint 3 +%_ptr_Input_v3uint = OpTypePointer Input %v3uint +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input + + %zero = OpConstant %uint 0 + %v3uint_000 = OpConstantComposite %v3uint %zero %zero %zero + + %void = OpTypeVoid + %voidfunc = OpTypeFunction %void + %main = OpFunction %void None %voidfunc + %lmain = OpLabel + + OpStore %gl_GlobalInvocationID %v3uint_000 + + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("storage class is read-only")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeInt 32 0 + %3 = OpTypePointer UniformConstant %2 + %4 = OpConstant %2 42 + %5 = OpVariable %3 UniformConstant %4 + %6 = OpTypePointer Function %2 + %7 = OpTypeFunction %1 + %8 = OpFunction %1 None %7 + %9 = OpLabel +%10 = OpVariable %6 Function + OpCopyMemory %10 %5 None + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryNonPointerTarget) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 %2 %3 +%5 = OpFunction %1 None %4 +%6 = OpFunctionParameter %2 +%7 = OpFunctionParameter %3 +%8 = OpLabel +OpCopyMemory %6 %7 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target operand '6' is not a pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryNonPointerSource) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %2 +%4 = OpTypeFunction %1 %2 %3 +%5 = OpFunction %1 None %4 +%6 = OpFunctionParameter %2 +%7 = OpFunctionParameter %3 +%8 = OpLabel +OpCopyMemory %7 %6 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Source operand '6' is not a pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeInt 32 0 + %3 = OpTypePointer UniformConstant %2 + %4 = OpConstant %2 42 + %5 = OpVariable %3 UniformConstant %4 +%11 = OpTypeFloat 32 + %6 = OpTypePointer Function %11 + %7 = OpTypeFunction %1 + %8 = OpFunction %1 None %7 + %9 = OpLabel +%10 = OpVariable %6 Function + OpCopyMemory %10 %5 None + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target '5's type does not match " + "Source '2's type.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryVoidTarget) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFunction %1 %3 %4 +%6 = OpFunction %1 None %5 +%7 = OpFunctionParameter %3 +%8 = OpFunctionParameter %4 +%9 = OpLabel +OpCopyMemory %7 %8 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target operand '7' cannot be a void pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemoryVoidSource) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Uniform %1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFunction %1 %3 %4 +%6 = OpFunction %1 None %5 +%7 = OpFunctionParameter %3 +%8 = OpFunctionParameter %4 +%9 = OpLabel +OpCopyMemory %8 %7 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Source operand '7' cannot be a void pointer.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedGood) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeInt 32 0 + %3 = OpTypePointer UniformConstant %2 + %4 = OpTypePointer Function %2 + %5 = OpConstant %2 4 + %6 = OpVariable %3 UniformConstant %5 + %7 = OpTypeFunction %1 + %8 = OpFunction %1 None %7 + %9 = OpLabel +%10 = OpVariable %4 Function + OpCopyMemorySized %10 %6 %5 None + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedTargetBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer UniformConstant %2 +%4 = OpTypePointer Function %2 +%5 = OpConstant %2 4 +%6 = OpVariable %3 UniformConstant %5 +%7 = OpTypeFunction %1 +%8 = OpFunction %1 None %7 +%9 = OpLabel + OpCopyMemorySized %9 %6 %5 None + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target operand '9' is not a pointer.")); +} +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSourceBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer UniformConstant %2 +%4 = OpTypePointer Function %2 +%5 = OpConstant %2 4 +%6 = OpTypeFunction %1 +%7 = OpFunction %1 None %6 +%8 = OpLabel +%9 = OpVariable %4 Function + OpCopyMemorySized %9 %5 %5 None + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Source operand '5' is not a pointer.")); +} +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeInt 32 0 + %3 = OpTypePointer UniformConstant %2 + %4 = OpTypePointer Function %2 + %5 = OpConstant %2 4 + %6 = OpVariable %3 UniformConstant %5 + %7 = OpTypeFunction %1 + %8 = OpFunction %1 None %7 + %9 = OpLabel +%10 = OpVariable %4 Function + OpCopyMemorySized %10 %6 %6 None + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '6' must be a scalar integer type.")); +} +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeInt 32 0 + %3 = OpTypePointer UniformConstant %2 + %4 = OpTypePointer Function %2 + %5 = OpConstant %2 4 + %6 = OpVariable %3 UniformConstant %5 + %7 = OpTypeFunction %1 +%11 = OpTypeFloat 32 +%12 = OpConstant %11 1.0 + %8 = OpFunction %1 None %7 + %9 = OpLabel +%10 = OpVariable %4 Function + OpCopyMemorySized %10 %6 %12 None + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '9' must be a scalar integer type.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantNull) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstantNull %2 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Size operand '3' cannot be a constant zero.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantZero) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 0 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Size operand '3' cannot be a constant zero.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantZero64) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 64 0 +%3 = OpConstant %2 0 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Size operand '3' cannot be a constant zero.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantNegative) { + const std::string spirv = kNoKernelGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 1 +%3 = OpConstant %2 -1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '3' cannot have the sign bit set to 1.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeConstantNegative64) { + const std::string spirv = kNoKernelGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 64 1 +%3 = OpConstant %2 -1 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Size operand '3' cannot have the sign bit set to 1.")); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeUnsignedNegative) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 2147483648 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpCopyMemorySizedSizeUnsignedNegative64) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 64 0 +%3 = OpConstant %2 9223372036854775808 +%4 = OpTypePointer Uniform %2 +%5 = OpTypeFloat 32 +%6 = OpTypePointer UniformConstant %5 +%7 = OpTypeFunction %1 %4 %6 +%8 = OpFunction %1 None %7 +%9 = OpFunctionParameter %4 +%10 = OpFunctionParameter %6 +%11 = OpLabel +OpCopyMemorySized %9 %10 %3 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +const char kDeeplyNestedStructureSetup[] = R"( +%void = OpTypeVoid +%void_f = OpTypeFunction %void +%int = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%v3float = OpTypeVector %float 3 +%mat4x3 = OpTypeMatrix %v3float 4 +%_ptr_Private_mat4x3 = OpTypePointer Private %mat4x3 +%_ptr_Private_float = OpTypePointer Private %float +%my_matrix = OpVariable %_ptr_Private_mat4x3 Private +%my_float_var = OpVariable %_ptr_Private_float Private +%_ptr_Function_float = OpTypePointer Function %float +%int_0 = OpConstant %int 0 +%int_1 = OpConstant %int 1 +%int_2 = OpConstant %int 2 +%int_3 = OpConstant %int 3 +%int_5 = OpConstant %int 5 + +; Making the following nested structures. +; +; struct S { +; bool b; +; vec4 v[5]; +; int i; +; mat4x3 m[5]; +; } +; uniform blockName { +; S s; +; bool cond; +; RunTimeArray arr; +; } + +%f32arr = OpTypeRuntimeArray %float +%bool = OpTypeBool +%v4float = OpTypeVector %float 4 +%array5_mat4x3 = OpTypeArray %mat4x3 %int_5 +%array5_vec4 = OpTypeArray %v4float %int_5 +%_ptr_Uniform_float = OpTypePointer Uniform %float +%_ptr_Function_vec4 = OpTypePointer Function %v4float +%_ptr_Uniform_vec4 = OpTypePointer Uniform %v4float +%struct_s = OpTypeStruct %bool %array5_vec4 %int %array5_mat4x3 +%struct_blockName = OpTypeStruct %struct_s %bool %f32arr +%_ptr_Uniform_blockName = OpTypePointer Uniform %struct_blockName +%_ptr_Uniform_struct_s = OpTypePointer Uniform %struct_s +%_ptr_Uniform_array5_mat4x3 = OpTypePointer Uniform %array5_mat4x3 +%_ptr_Uniform_mat4x3 = OpTypePointer Uniform %mat4x3 +%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float +%blockName_var = OpVariable %_ptr_Uniform_blockName Uniform +%spec_int = OpSpecConstant %int 2 +%func = OpFunction %void None %void_f +%my_label = OpLabel +)"; + +// In what follows, Access Chain Instruction refers to one of the following: +// OpAccessChain, OpInBoundsAccessChain, OpPtrAccessChain, and +// OpInBoundsPtrAccessChain +using AccessChainInstructionTest = spvtest::ValidateBase; + +// Determines whether the access chain instruction requires the 'element id' +// argument. +bool AccessChainRequiresElemId(const std::string& instr) { + return (instr == "OpPtrAccessChain" || instr == "OpInBoundsPtrAccessChain"); +} + +// Valid: Access a float in a matrix using an access chain instruction. +TEST_P(AccessChainInstructionTest, AccessChainGood) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + + "%float_entry = " + instr + + R"( %_ptr_Private_float %my_matrix )" + elem + + R"(%int_0 %int_1 + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid. The result type of an access chain instruction must be a pointer. +TEST_P(AccessChainInstructionTest, AccessChainResultTypeBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%float_entry = )" + + instr + + R"( %float %my_matrix )" + elem + + R"(%int_0 %int_1 +OpReturn +OpFunctionEnd + )"; + + const std::string expected_err = "The Result Type of " + instr + + " '36' must be " + "OpTypePointer. Found OpTypeFloat."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid. The base type of an access chain instruction must be a pointer. +TEST_P(AccessChainInstructionTest, AccessChainBaseTypeVoidBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%float_entry = )" + + instr + " %_ptr_Private_float %void " + elem + + R"(%int_0 %int_1 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = "The Base '1' in " + instr + + " instruction must " + "be a pointer."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid. The base type of an access chain instruction must be a pointer. +TEST_P(AccessChainInstructionTest, AccessChainBaseTypeNonPtrVariableBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %_ptr_Private_float )" + + elem + + R"(%int_0 %int_1 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = "The Base '8' in " + instr + + " instruction must " + "be a pointer."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: The storage class of Base and Result do not match. +TEST_P(AccessChainInstructionTest, + AccessChainResultAndBaseStorageClassDoesntMatchBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Function_float %my_matrix )" + elem + + R"(%int_0 %int_1 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = + "The result pointer storage class and base pointer storage class in " + + instr + " do not match."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid. The base type of an access chain instruction must point to a +// composite object. +TEST_P(AccessChainInstructionTest, + AccessChainBasePtrNotPointingToCompositeBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %my_float_var )" + elem + + R"(%int_0 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = instr + + " reached non-composite type while " + "indexes still remain to be traversed."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Valid. No Indexes were passed to the access chain instruction. The Result +// Type is the same as the Base type. +TEST_P(AccessChainInstructionTest, AccessChainNoIndexesGood) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %my_float_var )" + elem + + R"( +OpReturn +OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid. No Indexes were passed to the access chain instruction, but the +// Result Type is different from the Base type. +TEST_P(AccessChainInstructionTest, AccessChainNoIndexesBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_mat4x3 %my_float_var )" + elem + + R"( +OpReturn +OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("result type (OpTypeMatrix) does not match the type that " + "results from indexing into the base (OpTypeFloat).")); +} + +// Valid: 255 indexes passed to the access chain instruction. Limit is 255. +TEST_P(AccessChainInstructionTest, AccessChainTooManyIndexesGood) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? " %int_0 " : ""; + int depth = 255; + std::string header = kGLSL450MemoryModel + kDeeplyNestedStructureSetup; + header.erase(header.find("%func")); + std::ostringstream spirv; + spirv << header << "\n"; + + // Build nested structures. Struct 'i' contains struct 'i-1' + spirv << "%s_depth_1 = OpTypeStruct %float\n"; + for (int i = 2; i <= depth; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %s_depth_" << i - 1 << "\n"; + } + + // Define Pointer and Variable to use for the AccessChain instruction. + spirv << "%_ptr_Uniform_deep_struct = OpTypePointer Uniform %s_depth_" + << depth << "\n"; + spirv << "%deep_var = OpVariable %_ptr_Uniform_deep_struct Uniform\n"; + + // Function Start + spirv << R"( + %func = OpFunction %void None %void_f + %my_label = OpLabel + )"; + + // AccessChain with 'n' indexes (n = depth) + spirv << "%entry = " << instr << " %_ptr_Uniform_float %deep_var" << elem; + for (int i = 0; i < depth; ++i) { + spirv << " %int_0"; + } + + // Function end + spirv << R"( + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: 256 indexes passed to the access chain instruction. Limit is 255. +TEST_P(AccessChainInstructionTest, AccessChainTooManyIndexesBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? " %int_0 " : ""; + std::ostringstream spirv; + spirv << kGLSL450MemoryModel << kDeeplyNestedStructureSetup; + spirv << "%entry = " << instr << " %_ptr_Private_float %my_matrix" << elem; + for (int i = 0; i < 256; ++i) { + spirv << " %int_0"; + } + spirv << R"( + OpReturn + OpFunctionEnd + )"; + const std::string expected_err = "The number of indexes in " + instr + + " may not exceed 255. Found 256 indexes."; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Valid: 10 indexes passed to the access chain instruction. (Custom limit: 10) +TEST_P(AccessChainInstructionTest, CustomizedAccessChainTooManyIndexesGood) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? " %int_0 " : ""; + int depth = 10; + std::string header = kGLSL450MemoryModel + kDeeplyNestedStructureSetup; + header.erase(header.find("%func")); + std::ostringstream spirv; + spirv << header << "\n"; + + // Build nested structures. Struct 'i' contains struct 'i-1' + spirv << "%s_depth_1 = OpTypeStruct %float\n"; + for (int i = 2; i <= depth; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %s_depth_" << i - 1 << "\n"; + } + + // Define Pointer and Variable to use for the AccessChain instruction. + spirv << "%_ptr_Uniform_deep_struct = OpTypePointer Uniform %s_depth_" + << depth << "\n"; + spirv << "%deep_var = OpVariable %_ptr_Uniform_deep_struct Uniform\n"; + + // Function Start + spirv << R"( + %func = OpFunction %void None %void_f + %my_label = OpLabel + )"; + + // AccessChain with 'n' indexes (n = depth) + spirv << "%entry = " << instr << " %_ptr_Uniform_float %deep_var" << elem; + for (int i = 0; i < depth; ++i) { + spirv << " %int_0"; + } + + // Function end + spirv << R"( + OpReturn + OpFunctionEnd + )"; + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_access_chain_indexes, 10u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: 11 indexes passed to the access chain instruction. Custom Limit:10 +TEST_P(AccessChainInstructionTest, CustomizedAccessChainTooManyIndexesBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? " %int_0 " : ""; + std::ostringstream spirv; + spirv << kGLSL450MemoryModel << kDeeplyNestedStructureSetup; + spirv << "%entry = " << instr << " %_ptr_Private_float %my_matrix" << elem; + for (int i = 0; i < 11; ++i) { + spirv << " %int_0"; + } + spirv << R"( + OpReturn + OpFunctionEnd + )"; + const std::string expected_err = "The number of indexes in " + instr + + " may not exceed 10. Found 11 indexes."; + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_access_chain_indexes, 10u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: Index passed to the access chain instruction is float (must be +// integer). +TEST_P(AccessChainInstructionTest, AccessChainUndefinedIndexBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %my_matrix )" + elem + + R"(%float %int_1 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = + "Indexes passed to " + instr + " must be of type integer."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: The index argument that indexes into a struct must be of type +// OpConstant. +TEST_P(AccessChainInstructionTest, AccessChainStructIndexNotConstantBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%f = )" + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + + R"(%int_0 %spec_int %int_2 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = + "The passed to " + instr + + " to index into a structure must be an OpConstant."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: Indexing up to a vec4 granularity, but result type expected float. +TEST_P(AccessChainInstructionTest, + AccessChainStructResultTypeDoesntMatchIndexedTypeBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + + R"(%int_0 %int_1 %int_2 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = instr + + " result type (OpTypeFloat) does not match " + "the type that results from indexing into " + "the base (OpTypeVector)."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: Reach non-composite type (bool) when unused indexes remain. +TEST_P(AccessChainInstructionTest, AccessChainStructTooManyIndexesBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + + R"(%int_0 %int_2 %int_2 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = instr + + " reached non-composite type while " + "indexes still remain to be traversed."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: Trying to find index 3 of the struct that has only 3 members. +TEST_P(AccessChainInstructionTest, AccessChainStructIndexOutOfBoundBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + + R"(%int_3 %int_2 %int_2 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = "Index is out of bounds: " + instr + + " can not find index 3 into the structure " + " '26'. This structure has 3 members. " + "Largest valid index is 2."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Valid: Tests that we can index into Struct, Array, Matrix, and Vector! +TEST_P(AccessChainInstructionTest, AccessChainIndexIntoAllTypesGood) { + // indexes that we are passing are: 0, 3, 1, 2, 0 + // 0 will select the struct_s within the base struct (blockName) + // 3 will select the Array that contains 5 matrices + // 1 will select the Matrix that is at index 1 of the array + // 2 will select the column (which is a vector) within the matrix at index 2 + // 0 will select the element at the index 0 of the vector. (which is a float). + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::ostringstream spirv; + spirv << kGLSL450MemoryModel << kDeeplyNestedStructureSetup << std::endl; + spirv << "%ss = " << instr << " %_ptr_Uniform_struct_s %blockName_var " + << elem << "%int_0" << std::endl; + spirv << "%sa = " << instr << " %_ptr_Uniform_array5_mat4x3 %blockName_var " + << elem << "%int_0 %int_3" << std::endl; + spirv << "%sm = " << instr << " %_ptr_Uniform_mat4x3 %blockName_var " << elem + << "%int_0 %int_3 %int_1" << std::endl; + spirv << "%sc = " << instr << " %_ptr_Uniform_v3float %blockName_var " << elem + << "%int_0 %int_3 %int_1 %int_2" << std::endl; + spirv << "%entry = " << instr << " %_ptr_Uniform_float %blockName_var " + << elem << "%int_0 %int_3 %int_1 %int_2 %int_0" << std::endl; + spirv << R"( +OpReturn +OpFunctionEnd + )"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Valid: Access an element of OpTypeRuntimeArray. +TEST_P(AccessChainInstructionTest, AccessChainIndexIntoRuntimeArrayGood) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%runtime_arr_entry = )" + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + + R"(%int_2 %int_0 +OpReturn +OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Unused index when accessing OpTypeRuntimeArray. +TEST_P(AccessChainInstructionTest, AccessChainIndexIntoRuntimeArrayBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%runtime_arr_entry = )" + + instr + R"( %_ptr_Uniform_float %blockName_var )" + elem + + R"(%int_2 %int_0 %int_1 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = + instr + + " reached non-composite type while indexes still remain to be traversed."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: Reached scalar type before arguments to the access chain instruction +// finished. +TEST_P(AccessChainInstructionTest, AccessChainMatrixMoreArgsThanNeededBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_float %my_matrix )" + elem + + R"(%int_0 %int_1 %int_0 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = instr + + " reached non-composite type while " + "indexes still remain to be traversed."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Invalid: The result type and the type indexed into do not match. +TEST_P(AccessChainInstructionTest, + AccessChainResultTypeDoesntMatchIndexedTypeBad) { + const std::string instr = GetParam(); + const std::string elem = AccessChainRequiresElemId(instr) ? "%int_0 " : ""; + std::string spirv = kGLSL450MemoryModel + kDeeplyNestedStructureSetup + R"( +%entry = )" + + instr + R"( %_ptr_Private_mat4x3 %my_matrix )" + elem + + R"(%int_0 %int_1 +OpReturn +OpFunctionEnd + )"; + const std::string expected_err = instr + + " result type (OpTypeMatrix) does not match " + "the type that results from indexing into " + "the base (OpTypeFloat)."; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(expected_err)); +} + +// Run tests for Access Chain Instructions. +INSTANTIATE_TEST_CASE_P( + CheckAccessChainInstructions, AccessChainInstructionTest, + ::testing::Values("OpAccessChain", "OpInBoundsAccessChain", + "OpPtrAccessChain", "OpInBoundsPtrAccessChain")); + +// TODO: OpArrayLength +// TODO: OpImagePointer +// TODO: OpGenericPtrMemSemantics + +TEST_F(ValidateIdWithMessage, OpFunctionGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %1 %2 %2 +%4 = OpFunction %1 None %3 +%5 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpFunctionResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpConstant %2 42 +%4 = OpTypeFunction %1 %2 %2 +%5 = OpFunction %2 None %4 +%6 = OpLabel + OpReturnValue %3 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpFunction Result Type '2' does not match the " + "Function Type's return type '1'.")); +} +TEST_F(ValidateIdWithMessage, OpReturnValueTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFloat 32 +%3 = OpConstant %2 0 +%4 = OpTypeFunction %1 +%5 = OpFunction %1 None %4 +%6 = OpLabel + OpReturnValue %3 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpReturnValue Value '3's type does not match " + "OpFunction's return type.")); +} +TEST_F(ValidateIdWithMessage, OpFunctionFunctionTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%4 = OpFunction %1 None %2 +%5 = OpLabel + OpReturn +OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpFunction Function Type '2' is not a function type.")); +} + +TEST_F(ValidateIdWithMessage, OpFunctionUseBad) { + const std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeFloat 32 +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel +OpReturnValue %3 +OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid use of function result id 3.")); +} + +TEST_F(ValidateIdWithMessage, OpFunctionParameterGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %1 %2 +%4 = OpFunction %1 None %3 +%5 = OpFunctionParameter %2 +%6 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpFunctionParameterMultipleGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %1 %2 %2 +%4 = OpFunction %1 None %3 +%5 = OpFunctionParameter %2 +%6 = OpFunctionParameter %2 +%7 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpFunctionParameterResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %1 %2 +%4 = OpFunction %1 None %3 +%5 = OpFunctionParameter %1 +%6 = OpLabel + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpFunctionParameter Result Type '1' does not match the " + "OpTypeFunction parameter type of the same index.")); +} + +TEST_F(ValidateIdWithMessage, OpFunctionCallGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 ;21 + +%6 = OpFunction %2 None %3 +%7 = OpFunctionParameter %2 +%8 = OpLabel + OpReturnValue %7 + OpFunctionEnd + +%10 = OpFunction %1 None %4 +%11 = OpLabel +%12 = OpFunctionCall %2 %6 %5 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpFunctionCallResultTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 ;21 + +%6 = OpFunction %2 None %3 +%7 = OpFunctionParameter %2 +%8 = OpLabel +%9 = OpIAdd %2 %7 %7 + OpReturnValue %9 + OpFunctionEnd + +%10 = OpFunction %1 None %4 +%11 = OpLabel +%12 = OpFunctionCall %1 %6 %5 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpFunctionCall Result Type '1's type does not " + "match Function '2's return type.")); +} +TEST_F(ValidateIdWithMessage, OpFunctionCallFunctionBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 ;21 + +%10 = OpFunction %1 None %4 +%11 = OpLabel +%12 = OpFunctionCall %2 %5 %5 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpFunctionCall Function '5' is not a function.")); +} +TEST_F(ValidateIdWithMessage, OpFunctionCallArgumentTypeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 + +%13 = OpTypeFloat 32 +%14 = OpConstant %13 3.14 + +%6 = OpFunction %2 None %3 +%7 = OpFunctionParameter %2 +%8 = OpLabel +%9 = OpIAdd %2 %7 %7 + OpReturnValue %9 + OpFunctionEnd + +%10 = OpFunction %1 None %4 +%11 = OpLabel +%12 = OpFunctionCall %2 %6 %14 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpFunctionCall Argument '7's type does not match " + "Function '2's parameter type.")); +} + +// Valid: OpSampledImage result is used in the same block by +// OpImageSampleImplictLod +TEST_F(ValidateIdWithMessage, OpSampledImageGood) { + std::string spirv = kGLSL450MemoryModel + sampledImageSetup + R"( +%smpld_img = OpSampledImage %sampled_image_type %image_inst %sampler_inst +%si_lod = OpImageSampleImplicitLod %v4float %smpld_img %const_vec_1_1 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: OpSampledImage result is defined in one block and used in a +// different block. +TEST_F(ValidateIdWithMessage, OpSampledImageUsedInDifferentBlockBad) { + std::string spirv = kGLSL450MemoryModel + sampledImageSetup + R"( +%smpld_img = OpSampledImage %sampled_image_type %image_inst %sampler_inst +OpBranch %label_2 +%label_2 = OpLabel +%si_lod = OpImageSampleImplicitLod %v4float %smpld_img %const_vec_1_1 +OpReturn +OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("All OpSampledImage instructions must be in the same block in " + "which their Result are consumed. OpSampledImage Result " + "Type '23' has a consumer in a different basic block. The " + "consumer instruction is '25'.")); +} + +// Invalid: OpSampledImage result is used by OpSelect +// Note: According to the Spec, OpSelect parameters must be either a scalar or a +// vector. Therefore, OpTypeSampledImage is an illegal parameter for OpSelect. +// However, the OpSelect validation does not catch this today. Therefore, it is +// caught by the OpSampledImage validation. If the OpSelect validation code is +// updated, the error message for this test may change. +// +// Disabled since OpSelect catches this now. +TEST_F(ValidateIdWithMessage, DISABLED_OpSampledImageUsedInOpSelectBad) { + std::string spirv = kGLSL450MemoryModel + sampledImageSetup + R"( +%smpld_img = OpSampledImage %sampled_image_type %image_inst %sampler_inst +%select_img = OpSelect %sampled_image_type %spec_true %smpld_img %smpld_img +OpReturn +OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result from OpSampledImage instruction must not " + "appear as operands of OpSelect. Found result " + "'23' as an operand of '24'.")); +} + +// Valid: Get a float in a matrix using CompositeExtract. +// Valid: Insert float into a matrix using CompositeInsert. +TEST_F(ValidateIdWithMessage, CompositeExtractInsertGood) { + std::ostringstream spirv; + spirv << kGLSL450MemoryModel << kDeeplyNestedStructureSetup << std::endl; + spirv << "%matrix = OpLoad %mat4x3 %my_matrix" << std::endl; + spirv << "%float_entry = OpCompositeExtract %float %matrix 0 1" << std::endl; + + // To test CompositeInsert, insert the object back in after extraction. + spirv << "%new_composite = OpCompositeInsert %mat4x3 %float_entry %matrix 0 1" + << std::endl; + spirv << R"(OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +#if 0 +TEST_F(ValidateIdWithMessage, OpFunctionCallArgumentCountBar) { + const char *spirv = R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 %2 +%4 = OpTypeFunction %1 +%5 = OpConstant %2 42 ;21 + +%6 = OpFunction %2 None %3 +%7 = OpFunctionParameter %2 +%8 = OpLabel +%9 = OpLoad %2 %7 + OpReturnValue %9 + OpFunctionEnd + +%10 = OpFunction %1 None %4 +%11 = OpLabel + OpReturn +%12 = OpFunctionCall %2 %6 %5 + OpFunctionEnd)"; + CHECK(spirv, SPV_ERROR_INVALID_ID); +} +#endif + +// TODO: The many things that changed with how images are used. +// TODO: OpTextureSample +// TODO: OpTextureSampleDref +// TODO: OpTextureSampleLod +// TODO: OpTextureSampleProj +// TODO: OpTextureSampleGrad +// TODO: OpTextureSampleOffset +// TODO: OpTextureSampleProjLod +// TODO: OpTextureSampleProjGrad +// TODO: OpTextureSampleLodOffset +// TODO: OpTextureSampleProjOffset +// TODO: OpTextureSampleGradOffset +// TODO: OpTextureSampleProjLodOffset +// TODO: OpTextureSampleProjGradOffset +// TODO: OpTextureFetchTexelLod +// TODO: OpTextureFetchTexelOffset +// TODO: OpTextureFetchSample +// TODO: OpTextureFetchTexel +// TODO: OpTextureGather +// TODO: OpTextureGatherOffset +// TODO: OpTextureGatherOffsets +// TODO: OpTextureQuerySizeLod +// TODO: OpTextureQuerySize +// TODO: OpTextureQueryLevels +// TODO: OpTextureQuerySamples +// TODO: OpConvertUToF +// TODO: OpConvertFToS +// TODO: OpConvertSToF +// TODO: OpConvertUToF +// TODO: OpUConvert +// TODO: OpSConvert +// TODO: OpFConvert +// TODO: OpConvertPtrToU +// TODO: OpConvertUToPtr +// TODO: OpPtrCastToGeneric +// TODO: OpGenericCastToPtr +// TODO: OpBitcast +// TODO: OpGenericCastToPtrExplicit +// TODO: OpSatConvertSToU +// TODO: OpSatConvertUToS +// TODO: OpVectorExtractDynamic +// TODO: OpVectorInsertDynamic + +TEST_F(ValidateIdWithMessage, OpVectorShuffleIntGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ivec3 = OpTypeVector %int 3 +%ivec4 = OpTypeVector %int 4 +%ptr_ivec3 = OpTypePointer Function %ivec3 +%undef = OpUndef %ivec4 +%int_42 = OpConstant %int 42 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%1 = OpConstantComposite %ivec3 %int_42 %int_0 %int_2 +%2 = OpTypeFunction %ivec3 +%3 = OpFunction %ivec3 None %2 +%4 = OpLabel +%var = OpVariable %ptr_ivec3 Function %1 +%5 = OpLoad %ivec3 %var +%6 = OpVectorShuffle %ivec3 %5 %undef 2 1 0 + OpReturnValue %6 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleFloatGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%float = OpTypeFloat 32 +%vec2 = OpTypeVector %float 2 +%vec3 = OpTypeVector %float 3 +%vec4 = OpTypeVector %float 4 +%ptr_vec2 = OpTypePointer Function %vec2 +%ptr_vec3 = OpTypePointer Function %vec3 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%1 = OpConstantComposite %vec2 %float_2 %float_1 +%2 = OpConstantComposite %vec3 %float_1 %float_2 %float_2 +%3 = OpTypeFunction %vec4 +%4 = OpFunction %vec4 None %3 +%5 = OpLabel +%var = OpVariable %ptr_vec2 Function %1 +%var2 = OpVariable %ptr_vec3 Function %2 +%6 = OpLoad %vec2 %var +%7 = OpLoad %vec3 %var2 +%8 = OpVectorShuffle %vec4 %6 %7 4 3 1 0xffffffff + OpReturnValue %8 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleScalarResultType) { + std::string spirv = kGLSL450MemoryModel + R"( +%float = OpTypeFloat 32 +%vec2 = OpTypeVector %float 2 +%ptr_vec2 = OpTypePointer Function %vec2 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%1 = OpConstantComposite %vec2 %float_2 %float_1 +%2 = OpTypeFunction %float +%3 = OpFunction %float None %2 +%4 = OpLabel +%var = OpVariable %ptr_vec2 Function %1 +%5 = OpLoad %vec2 %var +%6 = OpVectorShuffle %float %5 %5 0 + OpReturnValue %6 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Result Type of OpVectorShuffle must be OpTypeVector.")); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleComponentCount) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ivec3 = OpTypeVector %int 3 +%ptr_ivec3 = OpTypePointer Function %ivec3 +%int_42 = OpConstant %int 42 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%1 = OpConstantComposite %ivec3 %int_42 %int_0 %int_2 +%2 = OpTypeFunction %ivec3 +%3 = OpFunction %ivec3 None %2 +%4 = OpLabel +%var = OpVariable %ptr_ivec3 Function %1 +%5 = OpLoad %ivec3 %var +%6 = OpVectorShuffle %ivec3 %5 %5 0 1 + OpReturnValue %6 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpVectorShuffle component literals count does not match " + "Result Type '2's vector component count.")); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleVector1Type) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ivec2 = OpTypeVector %int 2 +%ptr_int = OpTypePointer Function %int +%undef = OpUndef %ivec2 +%int_42 = OpConstant %int 42 +%2 = OpTypeFunction %ivec2 +%3 = OpFunction %ivec2 None %2 +%4 = OpLabel +%var = OpVariable %ptr_int Function %int_42 +%5 = OpLoad %int %var +%6 = OpVectorShuffle %ivec2 %5 %undef 0 0 + OpReturnValue %6 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The type of Vector 1 must be OpTypeVector.")); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleVector2Type) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ivec2 = OpTypeVector %int 2 +%ptr_ivec2 = OpTypePointer Function %ivec2 +%undef = OpUndef %int +%int_42 = OpConstant %int 42 +%1 = OpConstantComposite %ivec2 %int_42 %int_42 +%2 = OpTypeFunction %ivec2 +%3 = OpFunction %ivec2 None %2 +%4 = OpLabel +%var = OpVariable %ptr_ivec2 Function %1 +%5 = OpLoad %ivec2 %var +%6 = OpVectorShuffle %ivec2 %5 %undef 0 1 + OpReturnValue %6 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The type of Vector 2 must be OpTypeVector.")); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleVector1ComponentType) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ivec3 = OpTypeVector %int 3 +%ptr_ivec3 = OpTypePointer Function %ivec3 +%int_42 = OpConstant %int 42 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%float = OpTypeFloat 32 +%vec3 = OpTypeVector %float 3 +%vec4 = OpTypeVector %float 4 +%ptr_vec3 = OpTypePointer Function %vec3 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%1 = OpConstantComposite %ivec3 %int_42 %int_0 %int_2 +%2 = OpConstantComposite %vec3 %float_1 %float_2 %float_2 +%3 = OpTypeFunction %vec4 +%4 = OpFunction %vec4 None %3 +%5 = OpLabel +%var = OpVariable %ptr_ivec3 Function %1 +%var2 = OpVariable %ptr_vec3 Function %2 +%6 = OpLoad %ivec3 %var +%7 = OpLoad %vec3 %var2 +%8 = OpVectorShuffle %vec4 %6 %7 4 3 1 0 + OpReturnValue %8 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Component Type of Vector 1 must be the same as " + "ResultType.")); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleVector2ComponentType) { + std::string spirv = kGLSL450MemoryModel + R"( +%int = OpTypeInt 32 0 +%ivec3 = OpTypeVector %int 3 +%ptr_ivec3 = OpTypePointer Function %ivec3 +%int_42 = OpConstant %int 42 +%int_0 = OpConstant %int 0 +%int_2 = OpConstant %int 2 +%float = OpTypeFloat 32 +%vec3 = OpTypeVector %float 3 +%vec4 = OpTypeVector %float 4 +%ptr_vec3 = OpTypePointer Function %vec3 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%1 = OpConstantComposite %ivec3 %int_42 %int_0 %int_2 +%2 = OpConstantComposite %vec3 %float_1 %float_2 %float_2 +%3 = OpTypeFunction %vec4 +%4 = OpFunction %vec4 None %3 +%5 = OpLabel +%var = OpVariable %ptr_ivec3 Function %1 +%var2 = OpVariable %ptr_vec3 Function %2 +%6 = OpLoad %vec3 %var2 +%7 = OpLoad %ivec3 %var +%8 = OpVectorShuffle %vec4 %6 %7 4 3 1 0 + OpReturnValue %8 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The Component Type of Vector 2 must be the same as " + "ResultType.")); +} + +TEST_F(ValidateIdWithMessage, OpVectorShuffleLiterals) { + std::string spirv = kGLSL450MemoryModel + R"( +%float = OpTypeFloat 32 +%vec2 = OpTypeVector %float 2 +%vec3 = OpTypeVector %float 3 +%vec4 = OpTypeVector %float 4 +%ptr_vec2 = OpTypePointer Function %vec2 +%ptr_vec3 = OpTypePointer Function %vec3 +%float_1 = OpConstant %float 1 +%float_2 = OpConstant %float 2 +%1 = OpConstantComposite %vec2 %float_2 %float_1 +%2 = OpConstantComposite %vec3 %float_1 %float_2 %float_2 +%3 = OpTypeFunction %vec4 +%4 = OpFunction %vec4 None %3 +%5 = OpLabel +%var = OpVariable %ptr_vec2 Function %1 +%var2 = OpVariable %ptr_vec3 Function %2 +%6 = OpLoad %vec2 %var +%7 = OpLoad %vec3 %var2 +%8 = OpVectorShuffle %vec4 %6 %7 0 8 2 6 + OpReturnValue %8 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Component index 8 is out of bounds for combined (Vector1 + Vector2) " + "size of 5.")); +} + +// TODO: OpCompositeConstruct +// TODO: OpCompositeExtract +// TODO: OpCompositeInsert +// TODO: OpCopyObject +// TODO: OpTranspose +// TODO: OpSNegate +// TODO: OpFNegate +// TODO: OpNot +// TODO: OpIAdd +// TODO: OpFAdd +// TODO: OpISub +// TODO: OpFSub +// TODO: OpIMul +// TODO: OpFMul +// TODO: OpUDiv +// TODO: OpSDiv +// TODO: OpFDiv +// TODO: OpUMod +// TODO: OpSRem +// TODO: OpSMod +// TODO: OpFRem +// TODO: OpFMod +// TODO: OpVectorTimesScalar +// TODO: OpMatrixTimesScalar +// TODO: OpVectorTimesMatrix +// TODO: OpMatrixTimesVector +// TODO: OpMatrixTimesMatrix +// TODO: OpOuterProduct +// TODO: OpDot +// TODO: OpShiftRightLogical +// TODO: OpShiftRightArithmetic +// TODO: OpShiftLeftLogical +// TODO: OpBitwiseOr +// TODO: OpBitwiseXor +// TODO: OpBitwiseAnd +// TODO: OpAny +// TODO: OpAll +// TODO: OpIsNan +// TODO: OpIsInf +// TODO: OpIsFinite +// TODO: OpIsNormal +// TODO: OpSignBitSet +// TODO: OpLessOrGreater +// TODO: OpOrdered +// TODO: OpUnordered +// TODO: OpLogicalOr +// TODO: OpLogicalXor +// TODO: OpLogicalAnd +// TODO: OpSelect +// TODO: OpIEqual +// TODO: OpFOrdEqual +// TODO: OpFUnordEqual +// TODO: OpINotEqual +// TODO: OpFOrdNotEqual +// TODO: OpFUnordNotEqual +// TODO: OpULessThan +// TODO: OpSLessThan +// TODO: OpFOrdLessThan +// TODO: OpFUnordLessThan +// TODO: OpUGreaterThan +// TODO: OpSGreaterThan +// TODO: OpFOrdGreaterThan +// TODO: OpFUnordGreaterThan +// TODO: OpULessThanEqual +// TODO: OpSLessThanEqual +// TODO: OpFOrdLessThanEqual +// TODO: OpFUnordLessThanEqual +// TODO: OpUGreaterThanEqual +// TODO: OpSGreaterThanEqual +// TODO: OpFOrdGreaterThanEqual +// TODO: OpFUnordGreaterThanEqual +// TODO: OpDPdx +// TODO: OpDPdy +// TODO: OpFWidth +// TODO: OpDPdxFine +// TODO: OpDPdyFine +// TODO: OpFwidthFine +// TODO: OpDPdxCoarse +// TODO: OpDPdyCoarse +// TODO: OpFwidthCoarse +// TODO: OpLoopMerge +// TODO: OpSelectionMerge +// TODO: OpBranch + +TEST_F(ValidateIdWithMessage, OpPhiNotAType) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %3 %3 %7 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 3 is not a type id")); +} + +TEST_F(ValidateIdWithMessage, OpPhiSamePredecessor) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranchConditional %3 %8 %8 +%8 = OpLabel +%9 = OpPhi %2 %3 %7 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpPhiOddArgumentNumber) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %2 %3 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpPhi does not have an equal number of incoming " + "values and basic blocks.")); +} + +TEST_F(ValidateIdWithMessage, OpPhiTooFewPredecessors) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranch %8 +%8 = OpLabel +%9 = OpPhi %2 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpPhi's number of incoming blocks (0) does not match " + "block's predecessor count (1).")); +} + +TEST_F(ValidateIdWithMessage, OpPhiTooManyPredecessors) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranch %8 +%9 = OpLabel +OpReturn +%8 = OpLabel +%10 = OpPhi %2 %3 %7 %3 %9 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpPhi's number of incoming blocks (2) does not match " + "block's predecessor count (1).")); +} + +TEST_F(ValidateIdWithMessage, OpPhiMismatchedTypes) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeInt 32 0 +%6 = OpConstant %5 0 +%7 = OpTypeFunction %4 +%8 = OpFunction %4 None %7 +%9 = OpLabel +OpBranchConditional %3 %10 %11 +%11 = OpLabel +OpBranch %10 +%10 = OpLabel +%12 = OpPhi %2 %3 %9 %6 %11 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpPhi's result type 2 does not match incoming " + "value 6 type 5.")); +} + +TEST_F(ValidateIdWithMessage, OpPhiPredecessorNotABlock) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranchConditional %3 %8 %9 +%9 = OpLabel +OpBranch %11 +%11 = OpLabel +OpBranch %8 +%8 = OpLabel +%10 = OpPhi %2 %3 %7 %3 %3 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpPhi's incoming basic block 3 is not an OpLabel.")); +} + +TEST_F(ValidateIdWithMessage, OpPhiNotAPredecessor) { + std::string spirv = kOpenCLMemoryModel32 + R"( +%2 = OpTypeBool +%3 = OpConstantTrue %2 +%4 = OpTypeVoid +%5 = OpTypeFunction %4 +%6 = OpFunction %4 None %5 +%7 = OpLabel +OpBranchConditional %3 %8 %9 +%9 = OpLabel +OpBranch %11 +%11 = OpLabel +OpBranch %8 +%8 = OpLabel +%10 = OpPhi %2 %3 %7 %3 %9 +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpPhi's incoming basic block 9 is not a " + "predecessor of 8.")); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditionalGood) { + std::string spirv = BranchConditionalSetup + R"( + %branch_cond = OpINotEqual %bool %i0 %i1 + OpSelectionMerge %end None + OpBranchConditional %branch_cond %target_t %target_f + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditionalWithWeightsGood) { + std::string spirv = BranchConditionalSetup + R"( + %branch_cond = OpINotEqual %bool %i0 %i1 + OpSelectionMerge %end None + OpBranchConditional %branch_cond %target_t %target_f 1 1 + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditional_CondIsScalarInt) { + std::string spirv = BranchConditionalSetup + R"( + OpSelectionMerge %end None + OpBranchConditional %i0 %target_t %target_f + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Condition operand for OpBranchConditional must be of boolean type")); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditional_TrueTargetIsNotLabel) { + std::string spirv = BranchConditionalSetup + R"( + OpSelectionMerge %end None + OpBranchConditional %true %i0 %target_f + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The 'True Label' operand for OpBranchConditional must " + "be the ID of an OpLabel instruction")); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditional_FalseTargetIsNotLabel) { + std::string spirv = BranchConditionalSetup + R"( + OpSelectionMerge %end None + OpBranchConditional %true %target_t %i0 + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("The 'False Label' operand for OpBranchConditional " + "must be the ID of an OpLabel instruction")); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditional_NotEnoughWeights) { + std::string spirv = BranchConditionalSetup + R"( + %branch_cond = OpINotEqual %bool %i0 %i1 + OpSelectionMerge %end None + OpBranchConditional %branch_cond %target_t %target_f 1 + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpBranchConditional requires either 3 or 5 parameters")); +} + +TEST_F(ValidateIdWithMessage, OpBranchConditional_TooManyWeights) { + std::string spirv = BranchConditionalSetup + R"( + %branch_cond = OpINotEqual %bool %i0 %i1 + OpSelectionMerge %end None + OpBranchConditional %branch_cond %target_t %target_f 1 2 3 + )" + BranchConditionalTail; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpBranchConditional requires either 3 or 5 parameters")); +} + +// TODO: OpSwitch + +TEST_F(ValidateIdWithMessage, OpReturnValueConstantGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 +%4 = OpConstant %2 42 +%5 = OpFunction %2 None %3 +%6 = OpLabel + OpReturnValue %4 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueVariableGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 ;10 +%3 = OpTypeFunction %2 +%8 = OpTypePointer Function %2 ;18 +%4 = OpConstant %2 42 ;22 +%5 = OpFunction %2 None %3 ;27 +%6 = OpLabel ;29 +%7 = OpVariable %8 Function %4 ;34 +%9 = OpLoad %2 %7 + OpReturnValue %9 ;36 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueExpressionGood) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 +%4 = OpConstant %2 42 +%5 = OpFunction %2 None %3 +%6 = OpLabel +%7 = OpIAdd %2 %4 %4 + OpReturnValue %7 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueIsType) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 +%5 = OpFunction %2 None %3 +%6 = OpLabel + OpReturnValue %1 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpReturnValue Value '1' does not represent a value.")); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueIsLabel) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 +%5 = OpFunction %2 None %3 +%6 = OpLabel + OpReturnValue %6 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpReturnValue Value '5' does not represent a value.")); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueIsVoid) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %1 +%5 = OpFunction %1 None %3 +%6 = OpLabel +%7 = OpFunctionCall %1 %5 + OpReturnValue %7 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpReturnValue value's type '1' is missing or void.")); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueIsVariableInPhysical) { + // It's valid to return a pointer in a physical addressing model. + std::string spirv = kOpCapabilitySetup + R"( + OpMemoryModel Physical32 OpenCL +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Private %2 +%4 = OpTypeFunction %3 +%5 = OpFunction %3 None %4 +%6 = OpLabel +%7 = OpVariable %3 Function + OpReturnValue %7 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpReturnValueIsVariableInLogical) { + // It's invalid to return a pointer in a physical addressing model. + std::string spirv = kOpCapabilitySetup + R"( + OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypePointer Private %2 +%4 = OpTypeFunction %3 +%5 = OpFunction %3 None %4 +%6 = OpLabel +%7 = OpVariable %3 Function + OpReturnValue %7 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpReturnValue value's type '3' is a pointer, " + "which is invalid in the Logical addressing model.")); +} + +// With the VariablePointer Capability, the return value of a function is +// allowed to be a pointer. +TEST_F(ValidateIdWithMessage, OpReturnValueVarPtrGood) { + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, + "" /* Instructions to add to "main" */, + true /* Add VariablePointers Capability?*/, + true /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Without the VariablePointer Capability, the return value of a function is +// *not* allowed to be a pointer. +// Disabled since using OpSelect with pointers without VariablePointers will +// fail LogicalsPass. +TEST_F(ValidateIdWithMessage, DISABLED_OpReturnValueVarPtrBad) { + std::ostringstream spirv; + createVariablePointerSpirvProgram(&spirv, + "" /* Instructions to add to "main" */, + false /* Add VariablePointers Capability?*/, + true /* Use Helper Function? */); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpReturnValue value's type '7' is a pointer, " + "which is invalid in the Logical addressing model.")); +} + +// TODO: enable when this bug is fixed: +// https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15404 +TEST_F(ValidateIdWithMessage, DISABLED_OpReturnValueIsFunction) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeInt 32 0 +%3 = OpTypeFunction %2 +%5 = OpFunction %2 None %3 +%6 = OpLabel + OpReturnValue %5 + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, UndefinedTypeId) { + std::string spirv = kGLSL450MemoryModel + R"( +%s = OpTypeStruct %i32 +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Forward reference operands in an OpTypeStruct must " + "first be declared using OpTypeForwardPointer.")); +} + +TEST_F(ValidateIdWithMessage, UndefinedIdScope) { + std::string spirv = kGLSL450MemoryModel + R"( +%u32 = OpTypeInt 32 0 +%memsem = OpConstant %u32 0 +%void = OpTypeVoid +%void_f = OpTypeFunction %void +%f = OpFunction %void None %void_f +%l = OpLabel + OpMemoryBarrier %undef %memsem + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 7 has not been defined")); +} + +TEST_F(ValidateIdWithMessage, UndefinedIdMemSem) { + std::string spirv = kGLSL450MemoryModel + R"( +%u32 = OpTypeInt 32 0 +%scope = OpConstant %u32 0 +%void = OpTypeVoid +%void_f = OpTypeFunction %void +%f = OpFunction %void None %void_f +%l = OpLabel + OpMemoryBarrier %scope %undef + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 7 has not been defined")); +} + +TEST_F(ValidateIdWithMessage, + KernelOpEntryPointAndOpInBoundsPtrAccessChainGood) { + std::string spirv = kOpenCLMemoryModel32 + R"( + OpEntryPoint Kernel %2 "simple_kernel" + OpSource OpenCL_C 200000 + OpDecorate %3 BuiltIn GlobalInvocationId + OpDecorate %3 Constant + OpDecorate %4 FuncParamAttr NoCapture + OpDecorate %3 LinkageAttributes "__spirv_GlobalInvocationId" Import + %5 = OpTypeInt 32 0 + %6 = OpTypeVector %5 3 + %7 = OpTypePointer UniformConstant %6 + %3 = OpVariable %7 UniformConstant + %8 = OpTypeVoid + %9 = OpTypeStruct %5 +%10 = OpTypePointer CrossWorkgroup %9 +%11 = OpTypeFunction %8 %10 +%12 = OpConstant %5 0 +%13 = OpTypePointer CrossWorkgroup %5 +%14 = OpConstant %5 42 + %2 = OpFunction %8 None %11 + %4 = OpFunctionParameter %10 +%15 = OpLabel +%16 = OpLoad %6 %3 Aligned 0 +%17 = OpCompositeExtract %5 %16 0 +%18 = OpInBoundsPtrAccessChain %13 %4 %17 %12 + OpStore %18 %14 Aligned 4 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpPtrAccessChainGood) { + std::string spirv = kOpenCLMemoryModel64 + R"( + OpEntryPoint Kernel %2 "another_kernel" + OpSource OpenCL_C 200000 + OpDecorate %3 BuiltIn GlobalInvocationId + OpDecorate %3 Constant + OpDecorate %4 FuncParamAttr NoCapture + OpDecorate %3 LinkageAttributes "__spirv_GlobalInvocationId" Import + %5 = OpTypeInt 64 0 + %6 = OpTypeVector %5 3 + %7 = OpTypePointer UniformConstant %6 + %3 = OpVariable %7 UniformConstant + %8 = OpTypeVoid + %9 = OpTypeInt 32 0 +%10 = OpTypeStruct %9 +%11 = OpTypePointer CrossWorkgroup %10 +%12 = OpTypeFunction %8 %11 +%13 = OpConstant %5 4294967295 +%14 = OpConstant %9 0 +%15 = OpTypePointer CrossWorkgroup %9 +%16 = OpConstant %9 42 + %2 = OpFunction %8 None %12 + %4 = OpFunctionParameter %11 +%17 = OpLabel +%18 = OpLoad %6 %3 Aligned 0 +%19 = OpCompositeExtract %5 %18 0 +%20 = OpBitwiseAnd %5 %19 %13 +%21 = OpPtrAccessChain %15 %4 %20 %14 + OpStore %21 %16 Aligned 4 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateIdWithMessage, OpLoadBitcastPointerGood) { + std::string spirv = kOpenCLMemoryModel64 + R"( +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypeFloat 32 +%5 = OpTypePointer UniformConstant %3 +%6 = OpTypePointer UniformConstant %4 +%7 = OpVariable %5 UniformConstant +%8 = OpTypeFunction %2 +%9 = OpFunction %2 None %8 +%10 = OpLabel +%11 = OpBitcast %6 %7 +%12 = OpLoad %4 %11 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpLoadBitcastNonPointerBad) { + std::string spirv = kOpenCLMemoryModel64 + R"( +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypeFloat 32 +%5 = OpTypePointer UniformConstant %3 +%6 = OpTypeFunction %2 +%7 = OpVariable %5 UniformConstant +%8 = OpFunction %2 None %6 +%9 = OpLabel +%10 = OpLoad %3 %7 +%11 = OpBitcast %4 %10 +%12 = OpLoad %3 %11 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpLoad type for pointer '11' is not a pointer type.")); +} +TEST_F(ValidateIdWithMessage, OpStoreBitcastPointerGood) { + std::string spirv = kOpenCLMemoryModel64 + R"( +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypeFloat 32 +%5 = OpTypePointer Function %3 +%6 = OpTypePointer Function %4 +%7 = OpTypeFunction %2 +%8 = OpConstant %3 42 +%9 = OpFunction %2 None %7 +%10 = OpLabel +%11 = OpVariable %6 Function +%12 = OpBitcast %5 %11 + OpStore %12 %8 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} +TEST_F(ValidateIdWithMessage, OpStoreBitcastNonPointerBad) { + std::string spirv = kOpenCLMemoryModel64 + R"( +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypeFloat 32 +%5 = OpTypePointer Function %4 +%6 = OpTypeFunction %2 +%7 = OpConstant %4 42 +%8 = OpFunction %2 None %6 +%9 = OpLabel +%10 = OpVariable %5 Function +%11 = OpBitcast %3 %7 + OpStore %11 %7 + OpReturn + OpFunctionEnd)"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("OpStore type for pointer '11' is not a pointer type.")); +} + +// Result resulting from an instruction within a function may not be used +// outside that function. +TEST_F(ValidateIdWithMessage, ResultIdUsedOutsideOfFunctionBad) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Function %3 +%5 = OpFunction %1 None %2 +%6 = OpLabel +%7 = OpVariable %4 Function +OpReturn +OpFunctionEnd +%8 = OpFunction %1 None %2 +%9 = OpLabel +%10 = OpLoad %3 %7 +OpReturn +OpFunctionEnd + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "ID 7 defined in block 6 does not dominate its use in block 9")); +} + +TEST_F(ValidateIdWithMessage, SpecIdTargetNotSpecializationConstant) { + std::string spirv = kGLSL450MemoryModel + R"( +OpDecorate %1 SpecId 200 +%void = OpTypeVoid +%2 = OpTypeFunction %void +%int = OpTypeInt 32 0 +%1 = OpConstant %int 3 +%main = OpFunction %void None %2 +%4 = OpLabel +OpReturnValue %1 +OpFunctionEnd + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpDecorate SpecId decoration target '1' is not a " + "scalar specialization constant.")); +} + +TEST_F(ValidateIdWithMessage, SpecIdTargetOpSpecConstantOpBad) { + std::string spirv = kGLSL450MemoryModel + R"( +OpDecorate %1 SpecId 200 +%void = OpTypeVoid +%2 = OpTypeFunction %void +%int = OpTypeInt 32 0 +%3 = OpConstant %int 1 +%4 = OpConstant %int 2 +%1 = OpSpecConstantOp %int IAdd %3 %4 +%main = OpFunction %void None %2 +%6 = OpLabel +OpReturnValue %3 +OpFunctionEnd + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpDecorate SpecId decoration target '1' is not a " + "scalar specialization constant.")); +} + +TEST_F(ValidateIdWithMessage, SpecIdTargetOpSpecConstantCompositeBad) { + std::string spirv = kGLSL450MemoryModel + R"( +OpDecorate %1 SpecId 200 +%void = OpTypeVoid +%2 = OpTypeFunction %void +%int = OpTypeInt 32 0 +%3 = OpConstant %int 1 +%1 = OpSpecConstantComposite %int +%main = OpFunction %void None %2 +%4 = OpLabel +OpReturnValue %3 +OpFunctionEnd + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpDecorate SpecId decoration target '1' is not a " + "scalar specialization constant.")); +} + +TEST_F(ValidateIdWithMessage, SpecIdTargetGood) { + std::string spirv = kGLSL450MemoryModel + R"( +OpDecorate %3 SpecId 200 +OpDecorate %4 SpecId 201 +OpDecorate %5 SpecId 202 +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%int = OpTypeInt 32 0 +%bool = OpTypeBool +%3 = OpSpecConstant %int 3 +%4 = OpSpecConstantTrue %bool +%5 = OpSpecConstantFalse %bool +%main = OpFunction %1 None %2 +%6 = OpLabel +OpReturn +OpFunctionEnd + )"; + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); +} + +TEST_F(ValidateIdWithMessage, CorrectErrorForShuffle) { + std::string spirv = kGLSL450MemoryModel + R"( + %uint = OpTypeInt 32 0 + %float = OpTypeFloat 32 +%v4float = OpTypeVector %float 4 +%v2float = OpTypeVector %float 2 + %void = OpTypeVoid + %548 = OpTypeFunction %void + %CS = OpFunction %void None %548 + %550 = OpLabel + %6275 = OpUndef %v2float + %6280 = OpUndef %v2float + %6282 = OpVectorShuffle %v4float %6275 %6280 0 1 4 5 + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.c_str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Component index 4 is out of bounds for combined (Vector1 + Vector2) " + "size of 4.")); + EXPECT_EQ(23, getErrorPosition().index); +} + +TEST_F(ValidateIdWithMessage, VoidStructMember) { + const std::string spirv = kGLSL450MemoryModel + R"( +%void = OpTypeVoid +%struct = OpTypeStruct %void +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Structures cannot contain a void type.")); +} + +TEST_F(ValidateIdWithMessage, TypeFunctionBadUse) { + std::string spirv = kGLSL450MemoryModel + R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypePointer Function %2 +%4 = OpFunction %1 None %2 +%5 = OpLabel + OpReturn + OpFunctionEnd)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid use of function type result id 2.")); +} + +TEST_F(ValidateIdWithMessage, BadTypeId) { + std::string spirv = kGLSL450MemoryModel + R"( + %1 = OpTypeVoid + %2 = OpTypeFunction %1 + %3 = OpTypeFloat 32 + %4 = OpConstant %3 0 + %5 = OpFunction %1 None %2 + %6 = OpLabel + %7 = OpUndef %4 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ID 4 is not a type id")); +} + +// TODO: OpLifetimeStart +// TODO: OpLifetimeStop +// TODO: OpAtomicInit +// TODO: OpAtomicLoad +// TODO: OpAtomicStore +// TODO: OpAtomicExchange +// TODO: OpAtomicCompareExchange +// TODO: OpAtomicCompareExchangeWeak +// TODO: OpAtomicIIncrement +// TODO: OpAtomicIDecrement +// TODO: OpAtomicIAdd +// TODO: OpAtomicISub +// TODO: OpAtomicUMin +// TODO: OpAtomicUMax +// TODO: OpAtomicAnd +// TODO: OpAtomicOr +// TODO: OpAtomicXor +// TODO: OpAtomicIMin +// TODO: OpAtomicIMax +// TODO: OpEmitStreamVertex +// TODO: OpEndStreamPrimitive +// TODO: OpAsyncGroupCopy +// TODO: OpWaitGroupEvents +// TODO: OpGroupAll +// TODO: OpGroupAny +// TODO: OpGroupBroadcast +// TODO: OpGroupIAdd +// TODO: OpGroupFAdd +// TODO: OpGroupFMin +// TODO: OpGroupUMin +// TODO: OpGroupSMin +// TODO: OpGroupFMax +// TODO: OpGroupUMax +// TODO: OpGroupSMax +// TODO: OpEnqueueMarker +// TODO: OpEnqueueKernel +// TODO: OpGetKernelNDrangeSubGroupCount +// TODO: OpGetKernelNDrangeMaxSubGroupSize +// TODO: OpGetKernelWorkGroupSize +// TODO: OpGetKernelPreferredWorkGroupSizeMultiple +// TODO: OpRetainEvent +// TODO: OpReleaseEvent +// TODO: OpCreateUserEvent +// TODO: OpIsValidEvent +// TODO: OpSetUserEventStatus +// TODO: OpCaptureEventProfilingInfo +// TODO: OpGetDefaultQueue +// TODO: OpBuildNDRange +// TODO: OpReadPipe +// TODO: OpWritePipe +// TODO: OpReservedReadPipe +// TODO: OpReservedWritePipe +// TODO: OpReserveReadPipePackets +// TODO: OpReserveWritePipePackets +// TODO: OpCommitReadPipe +// TODO: OpCommitWritePipe +// TODO: OpIsValidReserveId +// TODO: OpGetNumPipePackets +// TODO: OpGetMaxPipePackets +// TODO: OpGroupReserveReadPipePackets +// TODO: OpGroupReserveWritePipePackets +// TODO: OpGroupCommitReadPipe +// TODO: OpGroupCommitWritePipe + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_image_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_image_test.cpp new file mode 100644 index 00000000000..03f3eeb995d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_image_test.cpp @@ -0,0 +1,3892 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateImage = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& execution_model = "Fragment", + const spv_target_env env = SPV_ENV_UNIVERSAL_1_0) { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability InputAttachment +OpCapability ImageGatherExtended +OpCapability MinLod +OpCapability Sampled1D +OpCapability ImageQuery +OpCapability Int64 +OpCapability Float64 +OpCapability SparseResidency +)"; + + if (env == SPV_ENV_UNIVERSAL_1_0) { + ss << "OpCapability SampledRect\n"; + } + + ss << capabilities_and_extensions; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%u64 = OpTypeInt 64 0 +%s32vec2 = OpTypeVector %s32 2 +%u32vec2 = OpTypeVector %u32 2 +%f32vec2 = OpTypeVector %f32 2 +%u32vec3 = OpTypeVector %u32 3 +%s32vec3 = OpTypeVector %s32 3 +%f32vec3 = OpTypeVector %f32 3 +%u32vec4 = OpTypeVector %u32 4 +%s32vec4 = OpTypeVector %s32 4 +%f32vec4 = OpTypeVector %f32 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_0_5 = OpConstant %f32 0.5 +%f32_0_25 = OpConstant %f32 0.25 +%f32_0_75 = OpConstant %f32 0.75 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 +%s32_4 = OpConstant %s32 4 +%s32_m1 = OpConstant %s32 -1 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%u64_0 = OpConstant %u64 0 + +%u32vec2arr4 = OpTypeArray %u32vec2 %u32_4 +%u32vec2arr3 = OpTypeArray %u32vec2 %u32_3 +%u32arr4 = OpTypeArray %u32 %u32_4 +%u32vec3arr4 = OpTypeArray %u32vec3 %u32_4 + +%struct_u32_f32vec4 = OpTypeStruct %u32 %f32vec4 +%struct_u64_f32vec4 = OpTypeStruct %u64 %f32vec4 +%struct_u32_u32vec4 = OpTypeStruct %u32 %u32vec4 +%struct_u32_f32vec3 = OpTypeStruct %u32 %f32vec3 +%struct_f32_f32vec4 = OpTypeStruct %f32 %f32vec4 +%struct_u32_u32 = OpTypeStruct %u32 %u32 +%struct_f32_f32 = OpTypeStruct %f32 %f32 +%struct_u32 = OpTypeStruct %u32 +%struct_u32_f32_u32 = OpTypeStruct %u32 %f32 %u32 +%struct_u32_f32vec4_u32 = OpTypeStruct %u32 %f32vec4 %u32 +%struct_u32_u32arr4 = OpTypeStruct %u32 %u32arr4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 +%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 + +%f32vec2_00 = OpConstantComposite %f32vec2 %f32_0 %f32_0 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_10 = OpConstantComposite %f32vec2 %f32_1 %f32_0 +%f32vec2_11 = OpConstantComposite %f32vec2 %f32_1 %f32_1 +%f32vec2_hh = OpConstantComposite %f32vec2 %f32_0_5 %f32_0_5 + +%f32vec3_000 = OpConstantComposite %f32vec3 %f32_0 %f32_0 %f32_0 +%f32vec3_hhh = OpConstantComposite %f32vec3 %f32_0_5 %f32_0_5 %f32_0_5 + +%f32vec4_0000 = OpConstantComposite %f32vec4 %f32_0 %f32_0 %f32_0 %f32_0 + +%const_offsets = OpConstantComposite %u32vec2arr4 %u32vec2_01 %u32vec2_12 %u32vec2_01 %u32vec2_12 +%const_offsets3x2 = OpConstantComposite %u32vec2arr3 %u32vec2_01 %u32vec2_12 %u32vec2_01 +%const_offsets4xu = OpConstantComposite %u32arr4 %u32_0 %u32_0 %u32_0 %u32_0 +%const_offsets4x3 = OpConstantComposite %u32vec3arr4 %u32vec3_012 %u32vec3_012 %u32vec3_012 %u32vec3_012 + +%type_image_f32_1d_0001 = OpTypeImage %f32 1D 0 0 0 1 Unknown +%ptr_image_f32_1d_0001 = OpTypePointer UniformConstant %type_image_f32_1d_0001 +%uniform_image_f32_1d_0001 = OpVariable %ptr_image_f32_1d_0001 UniformConstant +%type_sampled_image_f32_1d_0001 = OpTypeSampledImage %type_image_f32_1d_0001 + +%type_image_f32_1d_0002_rgba32f = OpTypeImage %f32 1D 0 0 0 2 Rgba32f +%ptr_image_f32_1d_0002_rgba32f = OpTypePointer UniformConstant %type_image_f32_1d_0002_rgba32f +%uniform_image_f32_1d_0002_rgba32f = OpVariable %ptr_image_f32_1d_0002_rgba32f UniformConstant +%type_sampled_image_f32_1d_0002_rgba32f = OpTypeSampledImage %type_image_f32_1d_0002_rgba32f + +%type_image_f32_2d_0001 = OpTypeImage %f32 2D 0 0 0 1 Unknown +%ptr_image_f32_2d_0001 = OpTypePointer UniformConstant %type_image_f32_2d_0001 +%uniform_image_f32_2d_0001 = OpVariable %ptr_image_f32_2d_0001 UniformConstant +%type_sampled_image_f32_2d_0001 = OpTypeSampledImage %type_image_f32_2d_0001 + +%type_image_f32_2d_0010 = OpTypeImage %f32 2D 0 0 1 0 Unknown +%ptr_image_f32_2d_0010 = OpTypePointer UniformConstant %type_image_f32_2d_0010 +%uniform_image_f32_2d_0010 = OpVariable %ptr_image_f32_2d_0010 UniformConstant +%type_sampled_image_f32_2d_0010 = OpTypeSampledImage %type_image_f32_2d_0010 + +%type_image_u32_2d_0001 = OpTypeImage %u32 2D 0 0 0 1 Unknown +%ptr_image_u32_2d_0001 = OpTypePointer UniformConstant %type_image_u32_2d_0001 +%uniform_image_u32_2d_0001 = OpVariable %ptr_image_u32_2d_0001 UniformConstant +%type_sampled_image_u32_2d_0001 = OpTypeSampledImage %type_image_u32_2d_0001 + +%type_image_u32_2d_0000 = OpTypeImage %u32 2D 0 0 0 0 Unknown +%ptr_image_u32_2d_0000 = OpTypePointer UniformConstant %type_image_u32_2d_0000 +%uniform_image_u32_2d_0000 = OpVariable %ptr_image_u32_2d_0000 UniformConstant +%type_sampled_image_u32_2d_0000 = OpTypeSampledImage %type_image_u32_2d_0000 + +%type_image_s32_3d_0001 = OpTypeImage %s32 3D 0 0 0 1 Unknown +%ptr_image_s32_3d_0001 = OpTypePointer UniformConstant %type_image_s32_3d_0001 +%uniform_image_s32_3d_0001 = OpVariable %ptr_image_s32_3d_0001 UniformConstant +%type_sampled_image_s32_3d_0001 = OpTypeSampledImage %type_image_s32_3d_0001 + +%type_image_f32_2d_0002 = OpTypeImage %f32 2D 0 0 0 2 Unknown +%ptr_image_f32_2d_0002 = OpTypePointer UniformConstant %type_image_f32_2d_0002 +%uniform_image_f32_2d_0002 = OpVariable %ptr_image_f32_2d_0002 UniformConstant +%type_sampled_image_f32_2d_0002 = OpTypeSampledImage %type_image_f32_2d_0002 + +%type_image_f32_spd_0002 = OpTypeImage %f32 SubpassData 0 0 0 2 Unknown +%ptr_image_f32_spd_0002 = OpTypePointer UniformConstant %type_image_f32_spd_0002 +%uniform_image_f32_spd_0002 = OpVariable %ptr_image_f32_spd_0002 UniformConstant +%type_sampled_image_f32_spd_0002 = OpTypeSampledImage %type_image_f32_spd_0002 + +%type_image_f32_3d_0111 = OpTypeImage %f32 3D 0 1 1 1 Unknown +%ptr_image_f32_3d_0111 = OpTypePointer UniformConstant %type_image_f32_3d_0111 +%uniform_image_f32_3d_0111 = OpVariable %ptr_image_f32_3d_0111 UniformConstant +%type_sampled_image_f32_3d_0111 = OpTypeSampledImage %type_image_f32_3d_0111 + +%type_image_f32_cube_0101 = OpTypeImage %f32 Cube 0 1 0 1 Unknown +%ptr_image_f32_cube_0101 = OpTypePointer UniformConstant %type_image_f32_cube_0101 +%uniform_image_f32_cube_0101 = OpVariable %ptr_image_f32_cube_0101 UniformConstant +%type_sampled_image_f32_cube_0101 = OpTypeSampledImage %type_image_f32_cube_0101 + +%type_image_f32_cube_0102_rgba32f = OpTypeImage %f32 Cube 0 1 0 2 Rgba32f +%ptr_image_f32_cube_0102_rgba32f = OpTypePointer UniformConstant %type_image_f32_cube_0102_rgba32f +%uniform_image_f32_cube_0102_rgba32f = OpVariable %ptr_image_f32_cube_0102_rgba32f UniformConstant +%type_sampled_image_f32_cube_0102_rgba32f = OpTypeSampledImage %type_image_f32_cube_0102_rgba32f + +%type_sampler = OpTypeSampler +%ptr_sampler = OpTypePointer UniformConstant %type_sampler +%uniform_sampler = OpVariable %ptr_sampler UniformConstant +)"; + + if (env == SPV_ENV_UNIVERSAL_1_0) { + ss << R"( +%type_image_void_2d_0001 = OpTypeImage %void 2D 0 0 0 1 Unknown +%ptr_image_void_2d_0001 = OpTypePointer UniformConstant %type_image_void_2d_0001 +%uniform_image_void_2d_0001 = OpVariable %ptr_image_void_2d_0001 UniformConstant +%type_sampled_image_void_2d_0001 = OpTypeSampledImage %type_image_void_2d_0001 + +%type_image_void_2d_0002 = OpTypeImage %void 2D 0 0 0 2 Unknown +%ptr_image_void_2d_0002 = OpTypePointer UniformConstant %type_image_void_2d_0002 +%uniform_image_void_2d_0002 = OpVariable %ptr_image_void_2d_0002 UniformConstant +%type_sampled_image_void_2d_0002 = OpTypeSampledImage %type_image_void_2d_0002 + +%type_image_f32_rect_0001 = OpTypeImage %f32 Rect 0 0 0 1 Unknown +%ptr_image_f32_rect_0001 = OpTypePointer UniformConstant %type_image_f32_rect_0001 +%uniform_image_f32_rect_0001 = OpVariable %ptr_image_f32_rect_0001 UniformConstant +%type_sampled_image_f32_rect_0001 = OpTypeSampledImage %type_image_f32_rect_0001 +)"; + } + + ss << R"( +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +std::string GenerateKernelCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + std::ostringstream ss; + ss << R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability ImageQuery +OpCapability ImageGatherExtended +OpCapability InputAttachment +OpCapability SampledRect +)"; + + ss << capabilities_and_extensions; + ss << R"( +OpMemoryModel Physical32 OpenCL +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u32vec2 = OpTypeVector %u32 2 +%f32vec2 = OpTypeVector %f32 2 +%u32vec3 = OpTypeVector %u32 3 +%f32vec3 = OpTypeVector %f32 3 +%u32vec4 = OpTypeVector %u32 4 +%f32vec4 = OpTypeVector %f32 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_0_5 = OpConstant %f32 0.5 +%f32_0_25 = OpConstant %f32 0.25 +%f32_0_75 = OpConstant %f32 0.75 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%f32vec2_00 = OpConstantComposite %f32vec2 %f32_0 %f32_0 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_10 = OpConstantComposite %f32vec2 %f32_1 %f32_0 +%f32vec2_11 = OpConstantComposite %f32vec2 %f32_1 %f32_1 +%f32vec2_hh = OpConstantComposite %f32vec2 %f32_0_5 %f32_0_5 + +%f32vec3_000 = OpConstantComposite %f32vec3 %f32_0 %f32_0 %f32_0 +%f32vec3_hhh = OpConstantComposite %f32vec3 %f32_0_5 %f32_0_5 %f32_0_5 + +%f32vec4_0000 = OpConstantComposite %f32vec4 %f32_0 %f32_0 %f32_0 %f32_0 + +%type_image_f32_2d_0001 = OpTypeImage %f32 2D 0 0 0 1 Unknown +%ptr_image_f32_2d_0001 = OpTypePointer UniformConstant %type_image_f32_2d_0001 +%uniform_image_f32_2d_0001 = OpVariable %ptr_image_f32_2d_0001 UniformConstant +%type_sampled_image_f32_2d_0001 = OpTypeSampledImage %type_image_f32_2d_0001 + +%type_image_f32_2d_0010 = OpTypeImage %f32 2D 0 0 1 0 Unknown +%ptr_image_f32_2d_0010 = OpTypePointer UniformConstant %type_image_f32_2d_0010 +%uniform_image_f32_2d_0010 = OpVariable %ptr_image_f32_2d_0010 UniformConstant +%type_sampled_image_f32_2d_0010 = OpTypeSampledImage %type_image_f32_2d_0010 + +%type_image_f32_3d_0010 = OpTypeImage %f32 3D 0 0 1 0 Unknown +%ptr_image_f32_3d_0010 = OpTypePointer UniformConstant %type_image_f32_3d_0010 +%uniform_image_f32_3d_0010 = OpVariable %ptr_image_f32_3d_0010 UniformConstant +%type_sampled_image_f32_3d_0010 = OpTypeSampledImage %type_image_f32_3d_0010 + +%type_image_f32_rect_0001 = OpTypeImage %f32 Rect 0 0 0 1 Unknown +%ptr_image_f32_rect_0001 = OpTypePointer UniformConstant %type_image_f32_rect_0001 +%uniform_image_f32_rect_0001 = OpVariable %ptr_image_f32_rect_0001 UniformConstant +%type_sampled_image_f32_rect_0001 = OpTypeSampledImage %type_image_f32_rect_0001 + +%type_sampler = OpTypeSampler +%ptr_sampler = OpTypePointer UniformConstant %type_sampler +%uniform_sampler = OpVariable %ptr_sampler UniformConstant + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +std::string GetShaderHeader(const std::string& capabilities_and_extensions = "", + bool include_entry_point = true) { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability Int64 +)"; + + ss << capabilities_and_extensions; + if (!include_entry_point) { + ss << "OpCapability Linkage"; + } + + ss << R"( +OpMemoryModel Logical GLSL450 +)"; + + if (include_entry_point) { + ss << "OpEntryPoint Fragment %main \"main\""; + } + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%s32 = OpTypeInt 32 1 +)"; + + return ss.str(); +} + +TEST_F(ValidateImage, TypeImageWrongSampledType) { + const std::string code = GetShaderHeader("", false) + R"( +%img_type = OpTypeImage %bool 2D 0 0 0 1 Unknown +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Sampled Type to be either void or " + "numerical scalar " + "type")); +} + +TEST_F(ValidateImage, TypeImageVoidSampledTypeVulkan) { + const std::string code = GetShaderHeader() + R"( +%img_type = OpTypeImage %void 2D 0 0 0 1 Unknown +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +OpReturn +OpFunctionEnd +)"; + + const spv_target_env env = SPV_ENV_VULKAN_1_0; + CompileSuccessfully(code, env); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Sampled Type to be a 32-bit int " + "or float scalar type for Vulkan environment")); +} + +TEST_F(ValidateImage, TypeImageU64SampledTypeVulkan) { + const std::string code = GetShaderHeader() + R"( +%img_type = OpTypeImage %u64 2D 0 0 0 1 Unknown +%void_func = OpTypeFunction %void +%main = OpFunction %void None %void_func +%main_lab = OpLabel +OpReturn +OpFunctionEnd +)"; + + const spv_target_env env = SPV_ENV_VULKAN_1_0; + CompileSuccessfully(code, env); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Sampled Type to be a 32-bit int " + "or float scalar type for Vulkan environment")); +} + +TEST_F(ValidateImage, TypeImageWrongDepth) { + const std::string code = GetShaderHeader("", false) + R"( +%img_type = OpTypeImage %f32 2D 3 0 0 1 Unknown +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid Depth 3 (must be 0, 1 or 2)")); +} + +TEST_F(ValidateImage, TypeImageWrongArrayed) { + const std::string code = GetShaderHeader("", false) + R"( +%img_type = OpTypeImage %f32 2D 0 2 0 1 Unknown +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid Arrayed 2 (must be 0 or 1)")); +} + +TEST_F(ValidateImage, TypeImageWrongMS) { + const std::string code = GetShaderHeader("", false) + R"( +%img_type = OpTypeImage %f32 2D 0 0 2 1 Unknown +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid MS 2 (must be 0 or 1)")); +} + +TEST_F(ValidateImage, TypeImageWrongSampled) { + const std::string code = GetShaderHeader("", false) + R"( +%img_type = OpTypeImage %f32 2D 0 0 0 3 Unknown +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid Sampled 3 (must be 0, 1 or 2)")); +} + +TEST_F(ValidateImage, TypeImageWrongSampledForSubpassData) { + const std::string code = + GetShaderHeader("OpCapability InputAttachment\n", false) + + R"( +%img_type = OpTypeImage %f32 SubpassData 0 0 0 1 Unknown +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Dim SubpassData requires Sampled to be 2")); +} + +TEST_F(ValidateImage, TypeImageWrongFormatForSubpassData) { + const std::string code = + GetShaderHeader("OpCapability InputAttachment\n", false) + + R"( +%img_type = OpTypeImage %f32 SubpassData 0 0 0 2 Rgba32f +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Dim SubpassData requires format Unknown")); +} + +TEST_F(ValidateImage, TypeSampledImageNotImage) { + const std::string code = GetShaderHeader("", false) + R"( +%simg_type = OpTypeSampledImage %f32 +)"; + + CompileSuccessfully(code.c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, SampledImageSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampledImageVulkanSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +)"; + + const spv_target_env env = SPV_ENV_VULKAN_1_0; + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment", env), env); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(env)); +} + +TEST_F(ValidateImage, SampledImageWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_image_f32_2d_0001 %img %sampler +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampledImageNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg1 = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%simg2 = OpSampledImage %type_sampled_image_f32_2d_0001 %simg1 %sampler +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, SampledImageImageNotForSampling) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0002 %img %sampler +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled' parameter to be 0 or 1")); +} + +TEST_F(ValidateImage, SampledImageVulkanUnknownSampled) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0000 %img %sampler +)"; + + const spv_target_env env = SPV_ENV_VULKAN_1_0; + CompileSuccessfully(GenerateShaderCode(body, "", "Fragment", env), env); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(env)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled' parameter to " + "be 1 for Vulkan environment.")); +} + +TEST_F(ValidateImage, SampledImageNotSampler) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %img +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Sampler to be of type OpTypeSampler")); +} + +TEST_F(ValidateImage, SampleImplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Bias %f32_0_25 +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh ConstOffset %s32vec2_01 +%res5 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Offset %s32vec2_01 +%res6 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh MinLod %f32_0_5 +%res7 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Bias|Offset|MinLod %f32_0_25 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleImplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %f32 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +TEST_F(ValidateImage, SampleImplicitLodWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec3 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, SampleImplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageSampleImplicitLod %f32vec4 %img %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleImplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %u32vec4 %simg %f32vec2_00 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, SampleImplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %u32vec4 %simg %f32vec2_00 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleImplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %img +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleImplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, SampleExplicitLodSuccessShader) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Lod %f32_1 +%res2 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_hh Grad %f32vec2_10 %f32vec2_01 +%res3 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_hh ConstOffset %s32vec2_01 +%res4 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec3_hhh Offset %s32vec2_01 +%res5 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_hh Grad|Offset|MinLod %f32vec2_10 %f32vec2_01 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleExplicitLodSuccessKernel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %u32vec4_0123 Lod %f32_1 +%res2 = OpImageSampleExplicitLod %f32vec4 %simg %u32vec2_01 Grad %f32vec2_10 %f32vec2_01 +%res3 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_hh ConstOffset %u32vec2_01 +%res4 = OpImageSampleExplicitLod %f32vec4 %simg %u32vec2_01 Offset %u32vec2_01 +%res5 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_hh Grad|Offset %f32vec2_10 %f32vec2_01 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleExplicitLodSuccessCubeArrayed) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f32vec3_hhh %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleExplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32 %simg %f32vec2_hh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +TEST_F(ValidateImage, SampleExplicitLodWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec3 %simg %f32vec2_hh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, SampleExplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageSampleExplicitLod %f32vec4 %img %f32vec2_hh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleExplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %u32vec4 %simg %f32vec2_00 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, SampleExplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %u32vec4 %simg %f32vec2_00 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleExplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %img Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleExplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, SampleExplicitLodBias) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Bias|Lod %f32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand Bias can only be used with ImplicitLod opcodes")); +} + +TEST_F(ValidateImage, LodAndGrad) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod|Grad %f32_1 %f32vec2_hh %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand bits Lod and Grad cannot be set at the same time")); +} + +TEST_F(ValidateImage, ImplicitLodWithLod) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Lod %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Image Operand Lod can only be used with ExplicitLod opcodes " + "and OpImageFetch")); +} + +TEST_F(ValidateImage, LodWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod %f32vec2_hh)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand Lod to be float scalar when " + "used with ExplicitLod")); +} + +TEST_F(ValidateImage, LodWrongDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_rect_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod %f32_0)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Lod requires 'Dim' parameter to be 1D, " + "2D, 3D or Cube")); +} + +TEST_F(ValidateImage, LodMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0010 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod %f32_0)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Lod requires 'MS' parameter to be 0")); +} + +TEST_F(ValidateImage, MinLodIncompatible) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Lod|MinLod %f32_0 %f32_0)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand MinLod can only be used with ImplicitLod opcodes or " + "together with Image Operand Grad")); +} + +TEST_F(ValidateImage, ImplicitLodWithGrad) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Grad %f32vec2_hh %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand Grad can only be used with ExplicitLod opcodes")); +} + +TEST_F(ValidateImage, SampleImplicitLod3DArrayedMultisampledSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 ConstOffset %s32vec3_012 +%res3 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Offset %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleImplicitLodCubeArrayedSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Bias %f32_0_25 +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 MinLod %f32_0_5 +%res5 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Bias|MinLod %f32_0_25 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleImplicitLodBiasWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Bias %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand Bias to be float scalar")); +} + +TEST_F(ValidateImage, SampleImplicitLodBiasWrongDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_rect_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh Bias %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Bias requires 'Dim' parameter to be 1D, " + "2D, 3D or Cube")); +} + +TEST_F(ValidateImage, SampleImplicitLodBiasMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Bias %f32_0_25 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Bias requires 'MS' parameter to be 0")); +} + +TEST_F(ValidateImage, SampleExplicitLodGradDxWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %s32vec3_012 %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both Image Operand Grad ids to be float " + "scalars or vectors")); +} + +TEST_F(ValidateImage, SampleExplicitLodGradDyWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f32vec3_hhh %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both Image Operand Grad ids to be float " + "scalars or vectors")); +} + +TEST_F(ValidateImage, SampleExplicitLodGradDxWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f32vec2_00 %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand Grad dx to have 3 components, but given 2")); +} + +TEST_F(ValidateImage, SampleExplicitLodGradDyWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f32vec3_hhh %f32vec2_00 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand Grad dy to have 3 components, but given 2")); +} + +TEST_F(ValidateImage, SampleExplicitLodGradMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec4_0000 Grad %f32vec3_000 %f32vec3_000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Grad requires 'MS' parameter to be 0")); +} + +TEST_F(ValidateImage, SampleImplicitLodConstOffsetCubeDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 ConstOffset %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand ConstOffset cannot be used with Cube Image 'Dim'")); +} + +TEST_F(ValidateImage, SampleImplicitLodConstOffsetWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 ConstOffset %f32vec3_000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand ConstOffset to be int scalar or vector")); +} + +TEST_F(ValidateImage, SampleImplicitLodConstOffsetWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 ConstOffset %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffset to have 3 " + "components, but given 2")); +} + +TEST_F(ValidateImage, SampleImplicitLodConstOffsetNotConst) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%offset = OpSNegate %s32vec3 %s32vec3_012 +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 ConstOffset %offset +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffset to be a const object")); +} + +TEST_F(ValidateImage, SampleImplicitLodOffsetCubeDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Offset %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Image Operand Offset cannot be used with Cube Image 'Dim'")); +} + +TEST_F(ValidateImage, SampleImplicitLodOffsetWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Offset %f32vec3_000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand Offset to be int scalar or vector")); +} + +TEST_F(ValidateImage, SampleImplicitLodOffsetWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 Offset %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand Offset to have 3 components, but given 2")); +} + +TEST_F(ValidateImage, SampleImplicitLodMoreThanOneOffset) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res4 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 ConstOffset|Offset %s32vec3_012 %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operands Offset, ConstOffset, ConstOffsets " + "cannot be used together")); +} + +TEST_F(ValidateImage, SampleImplicitLodMinLodWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 MinLod %s32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand MinLod to be float scalar")); +} + +TEST_F(ValidateImage, SampleImplicitLodMinLodWrongDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_rect_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh MinLod %f32_0_25 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand MinLod requires 'Dim' parameter to be " + "1D, 2D, 3D or Cube")); +} + +TEST_F(ValidateImage, SampleImplicitLodMinLodMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0111 %uniform_image_f32_3d_0111 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_3d_0111 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec4_0000 MinLod %f32_0_25 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Image Operand MinLod requires 'MS' parameter to be 0")); +} + +TEST_F(ValidateImage, SampleProjExplicitLodSuccess2D) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh Lod %f32_1 +%res3 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh Grad %f32vec2_10 %f32vec2_01 +%res4 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh ConstOffset %s32vec2_01 +%res5 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh Offset %s32vec2_01 +%res7 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh Grad|Offset %f32vec2_10 %f32vec2_01 %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjExplicitLodSuccessRect) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_rect_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh Grad %f32vec2_10 %f32vec2_01 +%res2 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec3_hhh Grad|Offset %f32vec2_10 %f32vec2_01 %s32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjExplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %f32 %simg %f32vec3_hhh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +TEST_F(ValidateImage, SampleProjExplicitLodWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %f32vec3 %simg %f32vec3_hhh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, SampleProjExplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageSampleProjExplicitLod %f32vec4 %img %f32vec3_hhh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleProjExplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %u32vec4 %simg %f32vec3_hhh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, SampleProjExplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %u32vec4 %simg %f32vec3_hhh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjExplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %f32vec4 %simg %img Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleProjExplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjExplicitLod %f32vec4 %simg %f32vec2_hh Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 3 components, " + "but given only 2")); +} + +TEST_F(ValidateImage, SampleProjImplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec3_hhh +%res2 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec3_hhh Bias %f32_0_25 +%res4 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec3_hhh ConstOffset %s32vec2_01 +%res5 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec3_hhh Offset %s32vec2_01 +%res6 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec3_hhh MinLod %f32_0_5 +%res7 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec3_hhh Bias|Offset|MinLod %f32_0_25 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjImplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %f32 %simg %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +TEST_F(ValidateImage, SampleProjImplicitLodWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %f32vec3 %simg %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, SampleProjImplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageSampleProjImplicitLod %f32vec4 %img %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleProjImplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %u32vec4 %simg %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, SampleProjImplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %u32vec4 %simg %f32vec3_hhh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjImplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %f32vec4 %simg %img +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleProjImplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjImplicitLod %f32vec4 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 3 components, " + "but given only 2")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_hh %f32_1 +%res2 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_hh %f32_1 Bias %f32_0_25 +%res4 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_hh %f32_1 ConstOffset %s32vec2_01 +%res5 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_hh %f32_1 Offset %s32vec2_01 +%res6 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_hh %f32_1 MinLod %f32_0_5 +%res7 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_hh %f32_1 Bias|Offset|MinLod %f32_0_25 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %void %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%res1 = OpImageSampleDrefImplicitLod %u32 %img %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %f32 %simg %f32vec2_00 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_00 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %u32 %simg %img %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %f32 %simg %f32_0_5 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, SampleDrefImplicitLodWrongDrefType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0001 %img %sampler +%res1 = OpImageSampleDrefImplicitLod %u32 %simg %f32vec2_00 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Dref to be of 32-bit float type")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_s32_3d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec4_0000 %f32_1 Lod %f32_1 +%res3 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec3_hhh %f32_1 Grad %f32vec3_hhh %f32vec3_hhh +%res4 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec3_hhh %f32_1 ConstOffset %s32vec3_012 +%res5 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec4_0000 %f32_1 Offset %s32vec3_012 +%res7 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec3_hhh %f32_1 Grad|Offset %f32vec3_hhh %f32vec3_hhh %s32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_s32_3d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %bool %simg %f32vec3_hhh %s32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%res1 = OpImageSampleDrefExplicitLod %s32 %img %f32vec3_hhh %s32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_s32_3d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %f32 %simg %f32vec3_hhh %s32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %u32 %simg %f32vec2_00 %s32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_s32_3d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %s32 %simg %img %s32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_s32_3d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec2_hh %s32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 3 components, " + "but given only 2")); +} + +TEST_F(ValidateImage, SampleDrefExplicitLodWrongDrefType) { + const std::string body = R"( +%img = OpLoad %type_image_s32_3d_0001 %uniform_image_s32_3d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_s32_3d_0001 %img %sampler +%res1 = OpImageSampleDrefExplicitLod %s32 %simg %f32vec3_hhh %u32_1 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Dref to be of 32-bit float type")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 +%res2 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 Bias %f32_0_25 +%res4 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 ConstOffset %s32vec2_01 +%res5 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 Offset %s32vec2_01 +%res6 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 MinLod %f32_0_5 +%res7 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 Bias|Offset|MinLod %f32_0_25 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %void %simg %f32vec3_hhh %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageSampleProjDrefImplicitLod %f32 %img %f32vec3_hhh %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %u32 %simg %f32vec3_hhh %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %u32 %simg %f32vec3_hhh %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %f32 %simg %img %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %f32 %simg %f32vec2_hh %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 3 components, " + "but given only 2")); +} + +TEST_F(ValidateImage, SampleProjDrefImplicitLodWrongDrefType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefImplicitLod %u32 %simg %f32vec3_hhh %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Dref to be of 32-bit float type")); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0001 %uniform_image_f32_1d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_1d_0001 %img %sampler +%res1 = OpImageSampleProjDrefExplicitLod %f32 %simg %f32vec2_hh %f32_0_5 Lod %f32_1 +%res2 = OpImageSampleProjDrefExplicitLod %f32 %simg %f32vec3_hhh %f32_0_5 Grad %f32_0_5 %f32_0_5 +%res3 = OpImageSampleProjDrefExplicitLod %f32 %simg %f32vec2_hh %f32_0_5 ConstOffset %s32_1 +%res4 = OpImageSampleProjDrefExplicitLod %f32 %simg %f32vec2_hh %f32_0_5 Offset %s32_1 +%res5 = OpImageSampleProjDrefExplicitLod %f32 %simg %f32vec2_hh %f32_0_5 Grad|Offset %f32_0_5 %f32_0_5 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0001 %uniform_image_f32_1d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_1d_0001 %img %sampler +%res1 = OpImageSampleProjDrefExplicitLod %bool %simg %f32vec2_hh %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float scalar type")); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0001 %uniform_image_f32_1d_0001 +%res1 = OpImageSampleProjDrefExplicitLod %f32 %img %f32vec2_hh %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0001 %uniform_image_f32_1d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_1d_0001 %img %sampler +%res1 = OpImageSampleProjDrefExplicitLod %u32 %simg %f32vec2_hh %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageSampleProjDrefExplicitLod %u32 %simg %f32vec3_hhh %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as Result Type")); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0001 %uniform_image_f32_1d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_1d_0001 %img %sampler +%res1 = OpImageSampleProjDrefExplicitLod %f32 %simg %img %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, SampleProjDrefExplicitLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0001 %uniform_image_f32_1d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_1d_0001 %img %sampler +%res1 = OpImageSampleProjDrefExplicitLod %f32 %simg %f32_0_5 %f32_0_5 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, FetchSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageFetch %f32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, FetchWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageFetch %f32 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +TEST_F(ValidateImage, FetchWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageFetch %f32vec3 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, FetchNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageFetch %f32vec4 %simg %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, FetchNotSampled) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageFetch %u32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled' parameter to be 1")); +} + +TEST_F(ValidateImage, FetchCube) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%res1 = OpImageFetch %f32vec4 %img %u32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("Image 'Dim' cannot be Cube")); +} + +TEST_F(ValidateImage, FetchWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageFetch %u32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, FetchVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%res1 = OpImageFetch %f32vec4 %img %u32vec2_01 +%res2 = OpImageFetch %u32vec4 %img %u32vec2_01 +%res3 = OpImageFetch %s32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, FetchWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageFetch %f32vec4 %img %f32vec2_00 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be int scalar or vector")); +} + +TEST_F(ValidateImage, FetchCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageFetch %f32vec4 %img %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, FetchLodNotInt) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageFetch %f32vec4 %img %u32vec2_01 Lod %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand Lod to be int scalar when used " + "with OpImageFetch")); +} + +TEST_F(ValidateImage, GatherSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 +%res2 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %const_offsets +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, GatherWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32 %simg %f32vec4_0000 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +TEST_F(ValidateImage, GatherWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32vec3 %simg %f32vec4_0000 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, GatherNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%res1 = OpImageGather %f32vec4 %img %f32vec4_0000 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sampled Image to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, GatherWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %u32vec4 %simg %f32vec4_0000 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, GatherVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageGather %u32vec4 %simg %f32vec2_00 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, GatherWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %u32vec4_0123 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, GatherCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32_0_5 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 4 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, GatherWrongComponentType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Component to be 32-bit int scalar")); +} + +TEST_F(ValidateImage, GatherComponentNot32Bit) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u64_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Component to be 32-bit int scalar")); +} + +TEST_F(ValidateImage, GatherDimCube) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %const_offsets +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand ConstOffsets cannot be used with Cube Image 'Dim'")); +} + +TEST_F(ValidateImage, GatherConstOffsetsNotArray) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand ConstOffsets to be an array of size 4")); +} + +TEST_F(ValidateImage, GatherConstOffsetsArrayWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %const_offsets3x2 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image Operand ConstOffsets to be an array of size 4")); +} + +TEST_F(ValidateImage, GatherConstOffsetsArrayNotVector) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %const_offsets4xu +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffsets array componenets " + "to be int vectors of size 2")); +} + +TEST_F(ValidateImage, GatherConstOffsetsArrayVectorWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %const_offsets4x3 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffsets array componenets " + "to be int vectors of size 2")); +} + +TEST_F(ValidateImage, GatherConstOffsetsArrayNotConst) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%offsets = OpUndef %u32vec2arr4 +%res1 = OpImageGather %f32vec4 %simg %f32vec4_0000 %u32_1 ConstOffsets %offsets +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image Operand ConstOffsets to be a const object")); +} + +TEST_F(ValidateImage, NotGatherWithConstOffsets) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res2 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh ConstOffsets %const_offsets +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Image Operand ConstOffsets can only be used with OpImageGather " + "and OpImageDrefGather")); +} + +TEST_F(ValidateImage, DrefGatherSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageDrefGather %f32vec4 %simg %f32vec4_0000 %f32_0_5 +%res2 = OpImageDrefGather %f32vec4 %simg %f32vec4_0000 %f32_0_5 ConstOffsets %const_offsets +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, DrefGatherVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0001 %uniform_image_void_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_void_2d_0001 %img %sampler +%res1 = OpImageDrefGather %u32vec4 %simg %f32vec2_00 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, DrefGatherWrongDrefType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0101 %uniform_image_f32_cube_0101 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_cube_0101 %img %sampler +%res1 = OpImageDrefGather %f32vec4 %simg %f32vec4_0000 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Dref to be of 32-bit float type")); +} + +TEST_F(ValidateImage, ReadSuccess1) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %u32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, ReadSuccess2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0002_rgba32f %uniform_image_f32_1d_0002_rgba32f +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability Image1D\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, ReadSuccess3) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0102_rgba32f %uniform_image_f32_cube_0102_rgba32f +%res1 = OpImageRead %f32vec4 %img %u32vec3_012 +)"; + + const std::string extra = "\nOpCapability ImageCubeArray\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, ReadSuccess4) { + const std::string body = R"( +%img = OpLoad %type_image_f32_spd_0002 %uniform_image_f32_spd_0002 +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, ReadNeedCapabilityStorageImageReadWithoutFormat) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %u32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability StorageImageReadWithoutFormat is required " + "to read storage image")); +} + +TEST_F(ValidateImage, ReadNeedCapabilityImage1D) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0002_rgba32f %uniform_image_f32_1d_0002_rgba32f +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Capability Image1D is required to access storage image")); +} + +TEST_F(ValidateImage, ReadNeedCapabilityImageCubeArray) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0102_rgba32f %uniform_image_f32_cube_0102_rgba32f +%res1 = OpImageRead %f32vec4 %img %u32vec3_012 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability ImageCubeArray is required to access storage image")); +} + +// TODO(atgoo@github.com) Disabled until the spec is clarified. +TEST_F(ValidateImage, DISABLED_ReadWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %f32 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int or float vector type")); +} + +// TODO(atgoo@github.com) Disabled until the spec is clarified. +TEST_F(ValidateImage, DISABLED_ReadWrongNumComponentsResultType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %f32vec3 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 4 components")); +} + +TEST_F(ValidateImage, ReadNotImage) { + const std::string body = R"( +%sampler = OpLoad %type_sampler %uniform_sampler +%res1 = OpImageRead %f32vec4 %sampler %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, ReadImageSampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled' parameter to be 0 or 2")); +} + +TEST_F(ValidateImage, ReadWrongSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type components")); +} + +TEST_F(ValidateImage, ReadVoidSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_void_2d_0002 %uniform_image_void_2d_0002 +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +%res2 = OpImageRead %u32vec4 %img %u32vec2_01 +%res3 = OpImageRead %s32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, ReadWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %u32vec4 %img %f32vec2_00 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be int scalar or vector")); +} + +TEST_F(ValidateImage, ReadCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageRead %u32vec4 %img %u32_1 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, WriteSuccess1) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, WriteSuccess2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0002_rgba32f %uniform_image_f32_1d_0002_rgba32f +%res1 = OpImageWrite %img %u32_1 %f32vec4_0000 +)"; + + const std::string extra = "\nOpCapability Image1D\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, WriteSuccess3) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0102_rgba32f %uniform_image_f32_cube_0102_rgba32f +%res1 = OpImageWrite %img %u32vec3_012 %f32vec4_0000 +)"; + + const std::string extra = "\nOpCapability ImageCubeArray\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, WriteSuccess4) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010 +;TODO(atgoo@github.com) Is it legal to write to MS image without sample index? +%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 +%res2 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u32_1 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, WriteSubpassData) { + const std::string body = R"( +%img = OpLoad %type_image_f32_spd_0002 %uniform_image_f32_spd_0002 +%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image 'Dim' cannot be SubpassData")); +} + +TEST_F(ValidateImage, WriteNeedCapabilityStorageImageWriteWithoutFormat) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %u32vec2_01 %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability StorageImageWriteWithoutFormat is required to write to " + "storage image")); +} + +TEST_F(ValidateImage, WriteNeedCapabilityImage1D) { + const std::string body = R"( +%img = OpLoad %type_image_f32_1d_0002_rgba32f %uniform_image_f32_1d_0002_rgba32f +%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Capability Image1D is required to access storage " + "image")); +} + +TEST_F(ValidateImage, WriteNeedCapabilityImageCubeArray) { + const std::string body = R"( +%img = OpLoad %type_image_f32_cube_0102_rgba32f %uniform_image_f32_cube_0102_rgba32f +%res1 = OpImageWrite %img %u32vec3_012 %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Capability ImageCubeArray is required to access storage image")); +} + +TEST_F(ValidateImage, WriteNotImage) { + const std::string body = R"( +%sampler = OpLoad %type_sampler %uniform_sampler +%res1 = OpImageWrite %sampler %u32vec2_01 %f32vec4_0000 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, WriteImageSampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled' parameter to be 0 or 2")); +} + +TEST_F(ValidateImage, WriteWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %f32vec2_00 %u32vec4_0123 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be int scalar or vector")); +} + +TEST_F(ValidateImage, WriteCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %u32_1 %u32vec4_0123 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, WriteTexelWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %u32vec2_01 %img +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Texel to be int or float vector or scalar")); +} + +TEST_F(ValidateImage, DISABLED_WriteTexelNotVector4) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %u32vec2_01 %u32vec3_012 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Texel to have 4 components")); +} + +TEST_F(ValidateImage, WriteTexelWrongComponentType) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0000 %uniform_image_u32_2d_0000 +%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected Image 'Sampled Type' to be the same as Texel components")); +} + +TEST_F(ValidateImage, WriteSampleNotInteger) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010 +%res1 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %f32_1 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image Operand Sample to be int scalar")); +} + +TEST_F(ValidateImage, SampleNotMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res2 = OpImageWrite %img %u32vec2_01 %f32vec4_0000 Sample %u32_1 +)"; + + const std::string extra = "\nOpCapability StorageImageWriteWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Image Operand Sample requires non-zero 'MS' parameter")); +} + +TEST_F(ValidateImage, SampleWrongOpcode) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0010 %img %sampler +%res1 = OpImageSampleExplicitLod %f32vec4 %simg %f32vec2_00 Sample %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image Operand Sample can only be used with " + "OpImageFetch, OpImageRead, OpImageWrite, " + "OpImageSparseFetch and OpImageSparseRead")); +} + +TEST_F(ValidateImage, SampleImageToImageSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%img2 = OpImage %type_image_f32_2d_0001 %simg +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SampleImageToImageWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%img2 = OpImage %type_sampled_image_f32_2d_0001 %simg +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeImage")); +} + +TEST_F(ValidateImage, SampleImageToImageNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%img2 = OpImage %type_image_f32_2d_0001 %img +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Sample Image to be of type OpTypeSampleImage")); +} + +TEST_F(ValidateImage, SampleImageToImageNotTheSameImageType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%img2 = OpImage %type_image_f32_2d_0002 %simg +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Sample Image image type to be equal to " + "Result Type")); +} + +TEST_F(ValidateImage, QueryFormatSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryFormat %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QueryFormatWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryFormat %bool %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int scalar type")); +} + +TEST_F(ValidateImage, QueryFormatNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryFormat %u32 %simg +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected operand to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, QueryOrderSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryOrder %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QueryOrderWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryOrder %bool %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int scalar type")); +} + +TEST_F(ValidateImage, QueryOrderNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryOrder %u32 %simg +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected operand to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, QuerySizeLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySizeLod %u32vec2 %img %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QuerySizeLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySizeLod %f32vec2 %img %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be int scalar or vector type")); +} + +TEST_F(ValidateImage, QuerySizeLodResultTypeWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySizeLod %u32 %img %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Result Type has 1 components, but 2 expected")); +} + +TEST_F(ValidateImage, QuerySizeLodNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQuerySizeLod %u32vec2 %simg %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, QuerySizeLodWrongImageDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageQuerySizeLod %u32vec2 %img %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image 'Dim' must be 1D, 2D, 3D or Cube")); +} + +TEST_F(ValidateImage, QuerySizeLodMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010 +%res1 = OpImageQuerySizeLod %u32vec2 %img %u32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("Image 'MS' must be 0")); +} + +TEST_F(ValidateImage, QuerySizeLodWrongLodType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySizeLod %u32vec2 %img %f32_0 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Level of Detail to be int scalar")); +} + +TEST_F(ValidateImage, QuerySizeSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySize %u32vec2 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QuerySizeWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySize %f32vec2 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be int scalar or vector type")); +} + +TEST_F(ValidateImage, QuerySizeNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQuerySize %u32vec2 %simg +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +// TODO(atgoo@github.com) Add more tests for OpQuerySize. + +TEST_F(ValidateImage, QueryLodSuccessKernel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %f32vec2_hh +%res2 = OpImageQueryLod %f32vec2 %simg %u32vec2_01 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QueryLodSuccessShader) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QueryLodWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %u32vec2 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be float vector type")); +} + +TEST_F(ValidateImage, QueryLodResultTypeWrongSize) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec3 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to have 2 components")); +} + +TEST_F(ValidateImage, QueryLodNotSampledImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryLod %f32vec2 %img %f32vec2_hh +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Image operand to be of type OpTypeSampledImage")); +} + +TEST_F(ValidateImage, QueryLodWrongDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_rect_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image 'Dim' must be 1D, 2D, 3D or Cube")); +} + +TEST_F(ValidateImage, QueryLodWrongCoordinateType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to be float scalar or vector")); +} + +TEST_F(ValidateImage, QueryLodCoordinateSizeTooSmall) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Coordinate to have at least 2 components, " + "but given only 1")); +} + +TEST_F(ValidateImage, QueryLevelsSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryLevels %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QueryLevelsWrongResultType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQueryLevels %f32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be int scalar type")); +} + +TEST_F(ValidateImage, QueryLevelsNotImage) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLevels %u32 %simg +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image to be of type OpTypeImage")); +} + +TEST_F(ValidateImage, QueryLevelsWrongDim) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageQueryLevels %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Image 'Dim' must be 1D, 2D, 3D or Cube")); +} + +TEST_F(ValidateImage, QuerySamplesSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0010 %uniform_image_f32_2d_0010 +%res1 = OpImageQuerySamples %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, QuerySamplesNot2D) { + const std::string body = R"( +%img = OpLoad %type_image_f32_3d_0010 %uniform_image_f32_3d_0010 +%res1 = OpImageQuerySamples %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("Image 'Dim' must be 2D")); +} + +TEST_F(ValidateImage, QuerySamplesNotMultisampled) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%res1 = OpImageQuerySamples %u32 %img +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("Image 'MS' must be 1")); +} + +TEST_F(ValidateImage, QueryLodWrongExecutionModel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex").c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpImageQueryLod requires Fragment execution model")); +} + +TEST_F(ValidateImage, QueryLodWrongExecutionModelWithFunc) { + const std::string body = R"( +%call_ret = OpFunctionCall %void %my_func +OpReturn +OpFunctionEnd +%my_func = OpFunction %void None %func +%my_func_entry = OpLabel +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageQueryLod %f32vec2 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex").c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpImageQueryLod requires Fragment execution model")); +} + +TEST_F(ValidateImage, ImplicitLodWrongExecutionModel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSampleImplicitLod %f32vec4 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body, "", "Vertex").c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ImplicitLod instructions require Fragment execution model")); +} + +TEST_F(ValidateImage, ReadSubpassDataWrongExecutionModel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_spd_0002 %uniform_image_f32_spd_0002 +%res1 = OpImageRead %f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra, "Vertex").c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Dim SubpassData requires Fragment execution model")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_u32_f32vec4 %simg %f32vec2_hh +%res2 = OpImageSparseSampleImplicitLod %struct_u32_f32vec4 %simg %f32vec2_hh Bias %f32_0_25 +%res4 = OpImageSparseSampleImplicitLod %struct_u32_f32vec4 %simg %f32vec2_hh ConstOffset %s32vec2_01 +%res5 = OpImageSparseSampleImplicitLod %struct_u32_f32vec4 %simg %f32vec2_hh Offset %s32vec2_01 +%res6 = OpImageSparseSampleImplicitLod %struct_u32_f32vec4 %simg %f32vec2_hh MinLod %f32_0_5 +%res7 = OpImageSparseSampleImplicitLod %struct_u64_f32vec4 %simg %f32vec2_hh Bias|Offset|MinLod %f32_0_25 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodResultTypeNotStruct) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %f32 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeStruct")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodResultTypeNotTwoMembers1) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_u32 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an int " + "scalar and a texel")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodResultTypeNotTwoMembers2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_u32_f32vec4_u32 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodResultTypeFirstMemberNotInt) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_f32_f32vec4 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodResultTypeTexelNotVector) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_u32_u32 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to be int or " + "float vector type")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodWrongNumComponentsTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_u32_f32vec3 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to have 4 " + "components")); +} + +TEST_F(ValidateImage, SparseSampleImplicitLodWrongComponentTypeTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleImplicitLod %struct_u32_u32vec4 %simg %f32vec2_hh +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type's second member components")); +} + +TEST_F(ValidateImage, SparseSampleDrefImplicitLodSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_u32_2d_0001 %uniform_image_u32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_u32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 +%res2 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 Bias %f32_0_25 +%res4 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 ConstOffset %s32vec2_01 +%res5 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 Offset %s32vec2_01 +%res6 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 MinLod %f32_0_5 +%res7 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 Bias|Offset|MinLod %f32_0_25 %s32vec2_01 %f32_0_5 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SparseSampleDrefImplicitLodResultTypeNotStruct) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleDrefImplicitLod %f32 %simg %f32vec2_hh %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeStruct")); +} + +TEST_F(ValidateImage, SparseSampleDrefImplicitLodResultTypeNotTwoMembers1) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleDrefImplicitLod %struct_u32 %simg %f32vec2_hh %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an int scalar " + "and a texel")); +} + +TEST_F(ValidateImage, SparseSampleDrefImplicitLodResultTypeNotTwoMembers2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleDrefImplicitLod %struct_u32_f32_u32 %simg %f32vec2_hh %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an int scalar " + "and a texel")); +} + +TEST_F(ValidateImage, SparseSampleDrefImplicitLodResultTypeFirstMemberNotInt) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleDrefImplicitLod %struct_f32_f32 %simg %f32vec2_hh %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an int scalar " + "and a texel")); +} + +TEST_F(ValidateImage, SparseSampleDrefImplicitLodDifferentSampledType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseSampleDrefImplicitLod %struct_u32_u32 %simg %f32vec2_hh %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type's second member")); +} + +TEST_F(ValidateImage, SparseFetchSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_u32_f32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SparseFetchResultTypeNotStruct) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %f32 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeStruct")); +} + +TEST_F(ValidateImage, SparseFetchResultTypeNotTwoMembers1) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_u32 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseFetchResultTypeNotTwoMembers2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_u32_f32vec4_u32 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseFetchResultTypeFirstMemberNotInt) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_f32_f32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseFetchResultTypeTexelNotVector) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_u32_u32 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to be int or " + "float vector type")); +} + +TEST_F(ValidateImage, SparseFetchWrongNumComponentsTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_u32_f32vec3 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to have 4 " + "components")); +} + +TEST_F(ValidateImage, SparseFetchWrongComponentTypeTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_rect_0001 %uniform_image_f32_rect_0001 +%res1 = OpImageSparseFetch %struct_u32_u32vec4 %img %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type's second member components")); +} + +TEST_F(ValidateImage, SparseReadSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %struct_u32_f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SparseReadResultTypeNotStruct) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %f32 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeStruct")); +} + +TEST_F(ValidateImage, SparseReadResultTypeNotTwoMembers1) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %struct_u32 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseReadResultTypeNotTwoMembers2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %struct_u32_f32vec4_u32 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseReadResultTypeFirstMemberNotInt) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %struct_f32_f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseReadResultTypeTexelWrongType) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %struct_u32_u32arr4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to be int or " + "float scalar or vector type")); +} + +TEST_F(ValidateImage, SparseReadWrongComponentTypeTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0002 %uniform_image_f32_2d_0002 +%res1 = OpImageSparseRead %struct_u32_u32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type's second member components")); +} + +TEST_F(ValidateImage, SparseReadSubpassDataNotAllowed) { + const std::string body = R"( +%img = OpLoad %type_image_f32_spd_0002 %uniform_image_f32_spd_0002 +%res1 = OpImageSparseRead %struct_u32_f32vec4 %img %u32vec2_01 +)"; + + const std::string extra = "\nOpCapability StorageImageReadWithoutFormat\n"; + CompileSuccessfully(GenerateShaderCode(body, extra, "Fragment").c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Image Dim SubpassData cannot be used with ImageSparseRead")); +} + +TEST_F(ValidateImage, SparseGatherSuccess) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_u32_f32vec4 %simg %f32vec4_0000 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SparseGatherResultTypeNotStruct) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %f32 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be OpTypeStruct")); +} + +TEST_F(ValidateImage, SparseGatherResultTypeNotTwoMembers1) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_u32 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an int " + "scalar and a texel")); +} + +TEST_F(ValidateImage, SparseGatherResultTypeNotTwoMembers2) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_u32_f32vec4_u32 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an int " + "scalar and a texel")); +} + +TEST_F(ValidateImage, SparseGatherResultTypeFirstMemberNotInt) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_f32_f32vec4 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be a struct containing an " + "int scalar and a texel")); +} + +TEST_F(ValidateImage, SparseGatherResultTypeTexelNotVector) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_u32_u32 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to be int or " + "float vector type")); +} + +TEST_F(ValidateImage, SparseGatherWrongNumComponentsTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_u32_f32vec3 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type's second member to have 4 " + "components")); +} + +TEST_F(ValidateImage, SparseGatherWrongComponentTypeTexel) { + const std::string body = R"( +%img = OpLoad %type_image_f32_2d_0001 %uniform_image_f32_2d_0001 +%sampler = OpLoad %type_sampler %uniform_sampler +%simg = OpSampledImage %type_sampled_image_f32_2d_0001 %img %sampler +%res1 = OpImageSparseGather %struct_u32_u32vec4 %simg %f32vec2_hh %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Image 'Sampled Type' to be the same as " + "Result Type's second member components")); +} + +TEST_F(ValidateImage, SparseTexelsResidentSuccess) { + const std::string body = R"( +%res1 = OpImageSparseTexelsResident %bool %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateImage, SparseTexelsResidentResultTypeNotBool) { + const std::string body = R"( +%res1 = OpImageSparseTexelsResident %u32 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected Result Type to be bool scalar type")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_interfaces_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_interfaces_test.cpp new file mode 100644 index 00000000000..b673a040f45 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_interfaces_test.cpp @@ -0,0 +1,164 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidateInterfacesTest = spvtest::ValidateBase; + +TEST_F(ValidateInterfacesTest, EntryPointMissingInput) { + std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Input %3 +%5 = OpVariable %4 Input +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +%8 = OpLoad %3 %5 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Input variable id <5> is used by entry point 'func' id <1>, " + "but is not listed as an interface")); +} + +TEST_F(ValidateInterfacesTest, EntryPointMissingOutput) { + std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Output %3 +%5 = OpVariable %4 Output +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +%8 = OpLoad %3 %5 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Output variable id <5> is used by entry point 'func' id <1>, " + "but is not listed as an interface")); +} + +TEST_F(ValidateInterfacesTest, InterfaceMissingUseInSubfunction) { + std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Input %3 +%5 = OpVariable %4 Input +%6 = OpTypeFunction %2 +%1 = OpFunction %2 None %6 +%7 = OpLabel +%8 = OpFunctionCall %2 %9 +OpReturn +OpFunctionEnd +%9 = OpFunction %2 None %6 +%10 = OpLabel +%11 = OpLoad %3 %5 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Input variable id <5> is used by entry point 'func' id <1>, " + "but is not listed as an interface")); +} + +TEST_F(ValidateInterfacesTest, TwoEntryPointsOneFunction) { + std::string text = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" %2 +OpEntryPoint Fragment %1 "func2" +%3 = OpTypeVoid +%4 = OpTypeInt 32 0 +%5 = OpTypePointer Input %4 +%2 = OpVariable %5 Input +%6 = OpTypeFunction %3 +%1 = OpFunction %3 None %6 +%7 = OpLabel +%8 = OpLoad %4 %2 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Input variable id <2> is used by entry point 'func2' id <1>, " + "but is not listed as an interface")); +} + +TEST_F(ValidateInterfacesTest, MissingInterfaceThroughInitializer) { + const std::string text = R"( +OpCapability Shader +OpCapability VariablePointers +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %1 "func" +%2 = OpTypeVoid +%3 = OpTypeInt 32 0 +%4 = OpTypePointer Input %3 +%5 = OpTypePointer Function %4 +%6 = OpVariable %4 Input +%7 = OpTypeFunction %2 +%1 = OpFunction %2 None %7 +%8 = OpLabel +%9 = OpVariable %5 Function %6 +OpReturn +OpFunctionEnd +)"; + + CompileSuccessfully(text, SPV_ENV_UNIVERSAL_1_3); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Input variable id <6> is used by entry point 'func' id <1>, " + "but is not listed as an interface")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_layout_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_layout_test.cpp new file mode 100644 index 00000000000..145c5439b3e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_layout_test.cpp @@ -0,0 +1,654 @@ +// Copyright (c) 2015-2016 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. + +// Validation tests for Logical Layout + +#include +#include +#include +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "source/diagnostic.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Eq; +using ::testing::HasSubstr; +using ::testing::StrEq; + +using pred_type = std::function; +using ValidateLayout = spvtest::ValidateBase< + std::tuple>>; + +// returns true if order is equal to VAL +template +spv_result_t Equals(int order) { + return order == VAL ? SPV_SUCCESS : RET; +} + +// returns true if order is between MIN and MAX(inclusive) +template +struct Range { + explicit Range(bool inverse = false) : inverse_(inverse) {} + spv_result_t operator()(int order) { + return (inverse_ ^ (order >= MIN && order <= MAX)) ? SPV_SUCCESS : RET; + } + + private: + bool inverse_; +}; + +template +spv_result_t InvalidSet(int order) { + for (spv_result_t val : {T(true)(order)...}) + if (val != SPV_SUCCESS) return val; + return SPV_SUCCESS; +} + +// SPIRV source used to test the logical layout +const std::vector& getInstructions() { + // clang-format off + static const std::vector instructions = { + "OpCapability Shader", + "OpExtension \"TestExtension\"", + "%inst = OpExtInstImport \"GLSL.std.450\"", + "OpMemoryModel Logical GLSL450", + "OpEntryPoint GLCompute %func \"\"", + "OpExecutionMode %func LocalSize 1 1 1", + "OpExecutionModeId %func LocalSizeId %one %one %one", + "%str = OpString \"Test String\"", + "%str2 = OpString \"blabla\"", + "OpSource GLSL 450 %str \"uniform vec3 var = vec3(4.0);\"", + "OpSourceContinued \"void main(){return;}\"", + "OpSourceExtension \"Test extension\"", + "OpName %func \"MyFunction\"", + "OpMemberName %struct 1 \"my_member\"", + "OpDecorate %dgrp RowMajor", + "OpMemberDecorate %struct 1 RowMajor", + "%dgrp = OpDecorationGroup", + "OpGroupDecorate %dgrp %mat33 %mat44", + "%intt = OpTypeInt 32 1", + "%floatt = OpTypeFloat 32", + "%voidt = OpTypeVoid", + "%boolt = OpTypeBool", + "%vec4 = OpTypeVector %floatt 4", + "%vec3 = OpTypeVector %floatt 3", + "%mat33 = OpTypeMatrix %vec3 3", + "%mat44 = OpTypeMatrix %vec4 4", + "%struct = OpTypeStruct %intt %mat33", + "%vfunct = OpTypeFunction %voidt", + "%viifunct = OpTypeFunction %voidt %intt %intt", + "%one = OpConstant %intt 1", + // TODO(umar): OpConstant fails because the type is not defined + // TODO(umar): OpGroupMemberDecorate + "OpLine %str 3 4", + "OpNoLine", + "%func = OpFunction %voidt None %vfunct", + "%l = OpLabel", + "OpReturn ; %func return", + "OpFunctionEnd ; %func end", + "%func2 = OpFunction %voidt None %viifunct", + "%funcp1 = OpFunctionParameter %intt", + "%funcp2 = OpFunctionParameter %intt", + "%fLabel = OpLabel", + "OpNop", + "OpReturn ; %func2 return", + "OpFunctionEnd" + }; + return instructions; +} + +static const int kRangeEnd = 1000; +pred_type All = Range<0, kRangeEnd>(); + +INSTANTIATE_TEST_CASE_P(InstructionsOrder, + ValidateLayout, + ::testing::Combine(::testing::Range((int)0, (int)getInstructions().size()), + // Note: Because of ID dependencies between instructions, some instructions + // are not free to be placed anywhere without triggering an non-layout + // validation error. Therefore, "Lines to compile" for some instructions + // are not "All" in the below. + // + // | Instruction | Line(s) valid | Lines to compile + ::testing::Values(std::make_tuple(std::string("OpCapability") , Equals<0> , Range<0, 2>()) + , std::make_tuple(std::string("OpExtension") , Equals<1> , All) + , std::make_tuple(std::string("OpExtInstImport") , Equals<2> , All) + , std::make_tuple(std::string("OpMemoryModel") , Equals<3> , Range<1, kRangeEnd>()) + , std::make_tuple(std::string("OpEntryPoint") , Equals<4> , All) + , std::make_tuple(std::string("OpExecutionMode ") , Range<5, 6>() , All) + , std::make_tuple(std::string("OpExecutionModeId") , Range<5, 6>() , All) + , std::make_tuple(std::string("OpSource ") , Range<7, 11>() , Range<8, kRangeEnd>()) + , std::make_tuple(std::string("OpSourceContinued ") , Range<7, 11>() , All) + , std::make_tuple(std::string("OpSourceExtension ") , Range<7, 11>() , All) + , std::make_tuple(std::string("%str2 = OpString ") , Range<7, 11>() , All) + , std::make_tuple(std::string("OpName ") , Range<12, 13>() , All) + , std::make_tuple(std::string("OpMemberName ") , Range<12, 13>() , All) + , std::make_tuple(std::string("OpDecorate ") , Range<14, 17>() , All) + , std::make_tuple(std::string("OpMemberDecorate ") , Range<14, 17>() , All) + , std::make_tuple(std::string("OpGroupDecorate ") , Range<14, 17>() , Range<17, kRangeEnd>()) + , std::make_tuple(std::string("OpDecorationGroup") , Range<14, 17>() , Range<0, 16>()) + , std::make_tuple(std::string("OpTypeBool") , Range<18, 31>() , All) + , std::make_tuple(std::string("OpTypeVoid") , Range<18, 31>() , Range<0, 26>()) + , std::make_tuple(std::string("OpTypeFloat") , Range<18, 31>() , Range<0,21>()) + , std::make_tuple(std::string("OpTypeInt") , Range<18, 31>() , Range<0, 21>()) + , std::make_tuple(std::string("OpTypeVector %floatt 4") , Range<18, 31>() , Range<20, 24>()) + , std::make_tuple(std::string("OpTypeMatrix %vec4 4") , Range<18, 31>() , Range<23, kRangeEnd>()) + , std::make_tuple(std::string("OpTypeStruct") , Range<18, 31>() , Range<25, kRangeEnd>()) + , std::make_tuple(std::string("%vfunct = OpTypeFunction"), Range<18, 31>() , Range<21, 31>()) + , std::make_tuple(std::string("OpConstant") , Range<18, 31>() , Range<21, kRangeEnd>()) + , std::make_tuple(std::string("OpLine ") , Range<18, kRangeEnd>() , Range<8, kRangeEnd>()) + , std::make_tuple(std::string("OpNoLine") , Range<18, kRangeEnd>() , All) + , std::make_tuple(std::string("%fLabel = OpLabel") , Equals<39> , All) + , std::make_tuple(std::string("OpNop") , Equals<40> , Range<40,kRangeEnd>()) + , std::make_tuple(std::string("OpReturn ; %func2 return") , Equals<41> , All) + )),); +// clang-format on + +// Creates a new vector which removes the string if the substr is found in the +// instructions vector and reinserts it in the location specified by order. +// NOTE: This will not work correctly if there are two instances of substr in +// instructions +std::vector GenerateCode(std::string substr, int order) { + std::vector code(getInstructions().size()); + std::vector inst(1); + partition_copy(std::begin(getInstructions()), std::end(getInstructions()), + std::begin(code), std::begin(inst), + [=](const std::string& str) { + return std::string::npos == str.find(substr); + }); + + code.insert(std::begin(code) + order, inst.front()); + return code; +} + +// This test will check the logical layout of a binary by removing each +// instruction in the pair of the INSTANTIATE_TEST_CASE_P call and moving it in +// the SPIRV source formed by combining the vector "instructions". +TEST_P(ValidateLayout, Layout) { + int order; + std::string instruction; + pred_type pred; + pred_type test_pred; // Predicate to determine if the test should be build + std::tuple testCase; + + std::tie(order, testCase) = GetParam(); + std::tie(instruction, pred, test_pred) = testCase; + + // Skip test which break the code generation + if (test_pred(order)) return; + + std::vector code = GenerateCode(instruction, order); + + std::stringstream ss; + std::copy(std::begin(code), std::end(code), + std::ostream_iterator(ss, "\n")); + + const auto env = SPV_ENV_UNIVERSAL_1_3; + // printf("code: \n%s\n", ss.str().c_str()); + CompileSuccessfully(ss.str(), env); + spv_result_t result; + // clang-format off + ASSERT_EQ(pred(order), result = ValidateInstructions(env)) + << "Actual: " << spvResultToString(result) + << "\nExpected: " << spvResultToString(pred(order)) + << "\nOrder: " << order + << "\nInstruction: " << instruction + << "\nCode: \n" << ss.str(); + // clang-format on +} + +TEST_F(ValidateLayout, MemoryModelMissingBeforeEntryPoint) { + std::string str = R"( + OpCapability Matrix + OpExtension "TestExtension" + %inst = OpExtInstImport "GLSL.std.450" + OpEntryPoint GLCompute %func "" + OpExecutionMode %func LocalSize 1 1 1 + )"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "EntryPoint cannot appear before the memory model instruction")); +} + +TEST_F(ValidateLayout, MemoryModelMissing) { + char str[] = R"(OpCapability Linkage)"; + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Missing required OpMemoryModel instruction")); +} + +TEST_F(ValidateLayout, MemoryModelSpecifiedTwice) { + char str[] = R"( + OpCapability Linkage + OpCapability Shader + OpMemoryModel Logical Simple + OpMemoryModel Logical Simple + )"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpMemoryModel should only be provided once")); +} + +TEST_F(ValidateLayout, FunctionDefinitionBeforeDeclarationBad) { + char str[] = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpDecorate %var Restrict +%intt = OpTypeInt 32 1 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%vifunct = OpTypeFunction %voidt %intt +%ptrt = OpTypePointer Function %intt +%func = OpFunction %voidt None %vfunct +%funcl = OpLabel + OpNop + OpReturn + OpFunctionEnd +%func2 = OpFunction %voidt None %vifunct ; must appear before definition +%func2p = OpFunctionParameter %intt + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Function declarations must appear before function definitions.")); +} + +// TODO(umar): Passes but gives incorrect error message. Should be fixed after +// type checking +TEST_F(ValidateLayout, LabelBeforeFunctionParameterBad) { + char str[] = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpDecorate %var Restrict +%intt = OpTypeInt 32 1 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%vifunct = OpTypeFunction %voidt %intt +%ptrt = OpTypePointer Function %intt +%func = OpFunction %voidt None %vifunct +%funcl = OpLabel ; Label appears before function parameter +%func2p = OpFunctionParameter %intt + OpNop + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Function parameters must only appear immediately " + "after the function definition")); +} + +TEST_F(ValidateLayout, FuncParameterNotImmediatlyAfterFuncBad) { + char str[] = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpDecorate %var Restrict +%intt = OpTypeInt 32 1 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%vifunct = OpTypeFunction %voidt %intt +%ptrt = OpTypePointer Function %intt +%func = OpFunction %voidt None %vifunct +%funcl = OpLabel + OpNop + OpBranch %next +%func2p = OpFunctionParameter %intt ;FunctionParameter appears in a function but not immediately afterwards +%next = OpLabel + OpNop + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Function parameters must only appear immediately " + "after the function definition")); +} + +TEST_F(ValidateLayout, OpUndefCanAppearInTypeDeclarationSection) { + std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpMemoryModel Logical OpenCL +%voidt = OpTypeVoid +%uintt = OpTypeInt 32 0 +%funct = OpTypeFunction %voidt +%udef = OpUndef %uintt +%func = OpFunction %voidt None %funct +%entry = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLayout, OpUndefCanAppearInBlock) { + std::string str = R"( + OpCapability Kernel + OpCapability Linkage + OpMemoryModel Logical OpenCL +%voidt = OpTypeVoid +%uintt = OpTypeInt 32 0 +%funct = OpTypeFunction %voidt +%func = OpFunction %voidt None %funct +%entry = OpLabel +%udef = OpUndef %uintt + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLayout, MissingFunctionEndForFunctionWithBody) { + const auto s = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%void = OpTypeVoid +%tf = OpTypeFunction %void +%f = OpFunction %void None %tf +%l = OpLabel +OpReturn +)"; + + CompileSuccessfully(s); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + StrEq("Missing OpFunctionEnd at end of module.")); +} + +TEST_F(ValidateLayout, MissingFunctionEndForFunctionPrototype) { + const auto s = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%void = OpTypeVoid +%tf = OpTypeFunction %void +%f = OpFunction %void None %tf +)"; + + CompileSuccessfully(s); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + StrEq("Missing OpFunctionEnd at end of module.")); +} + +using ValidateOpFunctionParameter = spvtest::ValidateBase; + +TEST_F(ValidateOpFunctionParameter, OpLineBetweenParameters) { + const auto s = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%foo_frag = OpString "foo.frag" +%i32 = OpTypeInt 32 1 +%tf = OpTypeFunction %i32 %i32 %i32 +%c = OpConstant %i32 123 +%f = OpFunction %i32 None %tf +OpLine %foo_frag 1 1 +%p1 = OpFunctionParameter %i32 +OpNoLine +%p2 = OpFunctionParameter %i32 +%l = OpLabel +OpReturnValue %c +OpFunctionEnd +)"; + CompileSuccessfully(s); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateOpFunctionParameter, TooManyParameters) { + const auto s = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%i32 = OpTypeInt 32 1 +%tf = OpTypeFunction %i32 %i32 %i32 +%c = OpConstant %i32 123 +%f = OpFunction %i32 None %tf +%p1 = OpFunctionParameter %i32 +%p2 = OpFunctionParameter %i32 +%xp3 = OpFunctionParameter %i32 +%xp4 = OpFunctionParameter %i32 +%xp5 = OpFunctionParameter %i32 +%xp6 = OpFunctionParameter %i32 +%xp7 = OpFunctionParameter %i32 +%l = OpLabel +OpReturnValue %c +OpFunctionEnd +)"; + CompileSuccessfully(s); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); +} + +using ValidateEntryPoint = spvtest::ValidateBase; + +// Tests that not having OpEntryPoint causes an error. +TEST_F(ValidateEntryPoint, NoEntryPointBad) { + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450)"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("No OpEntryPoint instruction was found. This is only " + "allowed if the Linkage capability is being used.")); +} + +// Invalid. A function may not be a target of both OpEntryPoint and +// OpFunctionCall. +TEST_F(ValidateEntryPoint, FunctionIsTargetOfEntryPointAndFunctionCallBad) { + std::string spirv = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %foo "foo" +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%foo = OpFunction %voidt None %funct +%entry = OpLabel +%recurse = OpFunctionCall %voidt %foo + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("A function (1) may not be targeted by both an OpEntryPoint " + "instruction and an OpFunctionCall instruction.")); +} + +// Invalid. Must be within a function to make a function call. +TEST_F(ValidateEntryPoint, FunctionCallOutsideFunctionBody) { + std::string spirv = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpName %variableName "variableName" + %34 = OpFunctionCall %variableName %1 + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("FunctionCall must happen within a function body.")); +} + +// Valid. Module with a function but no entry point is valid when Linkage +// Capability is used. +TEST_F(ValidateEntryPoint, NoEntryPointWithLinkageCapGood) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%foo = OpFunction %voidt None %funct +%entry = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLayout, ModuleProcessedInvalidIn10) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %void "void" + OpModuleProcessed "this is ok in 1.1 and later" + OpDecorate %void Volatile ; bogus, but makes the example short +%void = OpTypeVoid +)"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_WRONG_VERSION, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_0)); + // In a 1.0 environment the version check fails. + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Invalid SPIR-V binary version 1.1 for target " + "environment SPIR-V 1.0.")); +} + +TEST_F(ValidateLayout, ModuleProcessedValidIn11) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %void "void" + OpModuleProcessed "this is ok in 1.1 and later" + OpDecorate %void Volatile ; bogus, but makes the example short +%void = OpTypeVoid +)"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateLayout, ModuleProcessedBeforeLastNameIsTooEarly) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpModuleProcessed "this is too early" + OpName %void "void" +%void = OpTypeVoid +)"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + // By the mechanics of the validator, we assume ModuleProcessed is in the + // right spot, but then that OpName is in the wrong spot. + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Name cannot appear in a function declaration")); +} + +TEST_F(ValidateLayout, ModuleProcessedInvalidAfterFirstAnnotation) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %void Volatile ; this is bogus, but keeps the example short + OpModuleProcessed "this is too late" +%void = OpTypeVoid +)"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ModuleProcessed cannot appear in a function declaration")); +} + +TEST_F(ValidateLayout, ModuleProcessedInvalidInFunctionBeforeLabel) { + char str[] = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%voidfn = OpTypeFunction %void +%main = OpFunction %void None %voidfn + OpModuleProcessed "this is too late, in function before label" +%entry = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ModuleProcessed cannot appear in a function declaration")); +} + +TEST_F(ValidateLayout, ModuleProcessedInvalidInBasicBlock) { + char str[] = R"( + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %main "main" +%void = OpTypeVoid +%voidfn = OpTypeFunction %void +%main = OpFunction %void None %voidfn +%entry = OpLabel + OpModuleProcessed "this is too late, in basic block" + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str, SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, + ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("ModuleProcessed cannot appear in a function declaration")); +} + +// TODO(umar): Test optional instructions + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_limits_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_limits_test.cpp new file mode 100644 index 00000000000..55bf1e5f161 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_limits_test.cpp @@ -0,0 +1,718 @@ +// Copyright (c) 2016 Google 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. + +// Validation tests for Universal Limits. (Section 2.17 of the SPIR-V Spec) + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; + +using ValidateLimits = spvtest::ValidateBase; + +std::string header = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +)"; + +TEST_F(ValidateLimits, IdLargerThanBoundBad) { + std::string str = header + R"( +; %i32 has ID 1 +%i32 = OpTypeInt 32 1 +%c = OpConstant %i32 100 + +; Fake an instruction with 64 as the result id. +; !64 = OpConstantNull %i32 +!0x3002e !1 !64 +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Result '64' must be less than the ID bound '3'.")); +} + +TEST_F(ValidateLimits, IdEqualToBoundBad) { + std::string str = header + R"( +; %i32 has ID 1 +%i32 = OpTypeInt 32 1 +%c = OpConstant %i32 100 + +; Fake an instruction with 64 as the result id. +; !64 = OpConstantNull %i32 +!0x3002e !1 !64 +)"; + + CompileSuccessfully(str); + + // The largest ID used in this program is 64. Let's overwrite the ID bound in + // the header to be 64. This should result in an error because all IDs must + // satisfy: 0 < id < bound. + OverwriteAssembledBinary(3, 64); + + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Result '64' must be less than the ID bound '64'.")); +} + +TEST_F(ValidateLimits, StructNumMembersGood) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct)"; + for (int i = 0; i < 16383; ++i) { + spirv << " %1"; + } + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLimits, StructNumMembersExceededBad) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct)"; + for (int i = 0; i < 16384; ++i) { + spirv << " %1"; + } + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of OpTypeStruct members (16384) has exceeded " + "the limit (16383).")); +} + +TEST_F(ValidateLimits, CustomizedStructNumMembersGood) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct)"; + for (int i = 0; i < 32000; ++i) { + spirv << " %1"; + } + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_struct_members, 32000u); + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLimits, CustomizedStructNumMembersBad) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeStruct)"; + for (int i = 0; i < 32001; ++i) { + spirv << " %1"; + } + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_struct_members, 32000u); + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of OpTypeStruct members (32001) has exceeded " + "the limit (32000).")); +} + +// Valid: Switch statement has 16,383 branches. +TEST_F(ValidateLimits, SwitchNumBranchesGood) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypeInt 32 0 +%4 = OpConstant %3 1234 +%5 = OpFunction %1 None %2 +%7 = OpLabel +%8 = OpIAdd %3 %4 %4 +%9 = OpSwitch %4 %10)"; + + // Now add the (literal, label) pairs + for (int i = 0; i < 16383; ++i) { + spirv << " 1 %10"; + } + + spirv << R"( +%10 = OpLabel +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Switch statement has 16,384 branches. +TEST_F(ValidateLimits, SwitchNumBranchesBad) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypeInt 32 0 +%4 = OpConstant %3 1234 +%5 = OpFunction %1 None %2 +%7 = OpLabel +%8 = OpIAdd %3 %4 %4 +%9 = OpSwitch %4 %10)"; + + // Now add the (literal, label) pairs + for (int i = 0; i < 16384; ++i) { + spirv << " 1 %10"; + } + + spirv << R"( +%10 = OpLabel +OpReturn +OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of (literal, label) pairs in OpSwitch (16384) " + "exceeds the limit (16383).")); +} + +// Valid: Switch statement has 10 branches (limit is 10) +TEST_F(ValidateLimits, CustomizedSwitchNumBranchesGood) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypeInt 32 0 +%4 = OpConstant %3 1234 +%5 = OpFunction %1 None %2 +%7 = OpLabel +%8 = OpIAdd %3 %4 %4 +%9 = OpSwitch %4 %10)"; + + // Now add the (literal, label) pairs + for (int i = 0; i < 10; ++i) { + spirv << " 1 %10"; + } + + spirv << R"( +%10 = OpLabel +OpReturn +OpFunctionEnd + )"; + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_switch_branches, 10u); + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Switch statement has 11 branches (limit is 10) +TEST_F(ValidateLimits, CustomizedSwitchNumBranchesBad) { + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpTypeInt 32 0 +%4 = OpConstant %3 1234 +%5 = OpFunction %1 None %2 +%7 = OpLabel +%8 = OpIAdd %3 %4 %4 +%9 = OpSwitch %4 %10)"; + + // Now add the (literal, label) pairs + for (int i = 0; i < 11; ++i) { + spirv << " 1 %10"; + } + + spirv << R"( +%10 = OpLabel +OpReturn +OpFunctionEnd + )"; + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_switch_branches, 10u); + CompileSuccessfully(spirv.str()); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of (literal, label) pairs in OpSwitch (11) " + "exceeds the limit (10).")); +} + +// Valid: OpTypeFunction with 255 arguments. +TEST_F(ValidateLimits, OpTypeFunctionGood) { + int num_args = 255; + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFunction %1)"; + // add parameters + for (int i = 0; i < num_args; ++i) { + spirv << " %1"; + } + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: OpTypeFunction with 256 arguments. (limit is 255 according to the +// spec Universal Limits (2.17). +TEST_F(ValidateLimits, OpTypeFunctionBad) { + int num_args = 256; + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFunction %1)"; + for (int i = 0; i < num_args; ++i) { + spirv << " %1"; + } + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypeFunction may not take more than 255 arguments. " + "OpTypeFunction '2' has 256 arguments.")); +} + +// Valid: OpTypeFunction with 100 arguments (Custom limit: 100) +TEST_F(ValidateLimits, CustomizedOpTypeFunctionGood) { + int num_args = 100; + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFunction %1)"; + // add parameters + for (int i = 0; i < num_args; ++i) { + spirv << " %1"; + } + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_function_args, 100u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: OpTypeFunction with 101 arguments. (Custom limit: 100) +TEST_F(ValidateLimits, CustomizedOpTypeFunctionBad) { + int num_args = 101; + std::ostringstream spirv; + spirv << header << R"( +%1 = OpTypeInt 32 0 +%2 = OpTypeFunction %1)"; + for (int i = 0; i < num_args; ++i) { + spirv << " %1"; + } + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_function_args, 100u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpTypeFunction may not take more than 100 arguments. " + "OpTypeFunction '2' has 101 arguments.")); +} + +// Valid: module has 65,535 global variables. +TEST_F(ValidateLimits, NumGlobalVarsGood) { + int num_globals = 65535; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 +%_ptr_int = OpTypePointer Input %int + )"; + + for (int i = 0; i < num_globals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Input\n"; + } + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: module has 65,536 global variables (limit is 65,535). +TEST_F(ValidateLimits, NumGlobalVarsBad) { + int num_globals = 65536; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 +%_ptr_int = OpTypePointer Input %int + )"; + + for (int i = 0; i < num_globals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Input\n"; + } + + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of Global Variables (Storage Class other than " + "'Function') exceeded the valid limit (65535).")); +} + +// Valid: module has 50 global variables (limit is 50) +TEST_F(ValidateLimits, CustomizedNumGlobalVarsGood) { + int num_globals = 50; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 +%_ptr_int = OpTypePointer Input %int + )"; + + for (int i = 0; i < num_globals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Input\n"; + } + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_global_variables, 50u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: module has 51 global variables (limit is 50). +TEST_F(ValidateLimits, CustomizedNumGlobalVarsBad) { + int num_globals = 51; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 +%_ptr_int = OpTypePointer Input %int + )"; + + for (int i = 0; i < num_globals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Input\n"; + } + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_global_variables, 50u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of Global Variables (Storage Class other than " + "'Function') exceeded the valid limit (50).")); +} + +// Valid: module has 524,287 local variables. +// Note: AppVeyor limits process time to 300s. For a VisualStudio Debug +// build, going up to 524287 local variables gets too close to that +// limit. So test with an artificially lowered limit. +TEST_F(ValidateLimits, NumLocalVarsGoodArtificiallyLowLimit5K) { + int num_locals = 5000; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %_ptr_int = OpTypePointer Function %int + %voidt = OpTypeVoid + %funct = OpTypeFunction %voidt + %main = OpFunction %voidt None %funct + %entry = OpLabel + )"; + + for (int i = 0; i < num_locals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Function\n"; + } + + spirv << R"( + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + // Artificially limit it. + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_local_variables, num_locals); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: module has 524,288 local variables (limit is 524,287). +// Artificially limit the check to 5001. +TEST_F(ValidateLimits, NumLocalVarsBadArtificiallyLowLimit5K) { + int num_locals = 5001; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %_ptr_int = OpTypePointer Function %int + %voidt = OpTypeVoid + %funct = OpTypeFunction %voidt + %main = OpFunction %voidt None %funct + %entry = OpLabel + )"; + + for (int i = 0; i < num_locals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Function\n"; + } + + spirv << R"( + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(spirv.str()); + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_local_variables, 5000u); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of local variables ('Function' Storage Class) " + "exceeded the valid limit (5000).")); +} + +// Valid: module has 100 local variables (limit is 100). +TEST_F(ValidateLimits, CustomizedNumLocalVarsGood) { + int num_locals = 100; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %_ptr_int = OpTypePointer Function %int + %voidt = OpTypeVoid + %funct = OpTypeFunction %voidt + %main = OpFunction %voidt None %funct + %entry = OpLabel + )"; + + for (int i = 0; i < num_locals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Function\n"; + } + + spirv << R"( + OpReturn + OpFunctionEnd + )"; + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_local_variables, 100u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: module has 101 local variables (limit is 100). +TEST_F(ValidateLimits, CustomizedNumLocalVarsBad) { + int num_locals = 101; + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %_ptr_int = OpTypePointer Function %int + %voidt = OpTypeVoid + %funct = OpTypeFunction %voidt + %main = OpFunction %voidt None %funct + %entry = OpLabel + )"; + + for (int i = 0; i < num_locals; ++i) { + spirv << "%var_" << i << " = OpVariable %_ptr_int Function\n"; + } + + spirv << R"( + OpReturn + OpFunctionEnd + )"; + + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_local_variables, 100u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Number of local variables ('Function' Storage Class) " + "exceeded the valid limit (100).")); +} + +// Valid: Structure nesting depth of 255. +TEST_F(ValidateLimits, StructNestingDepthGood) { + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %s_depth_1 = OpTypeStruct %int + )"; + for (auto i = 2; i <= 255; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %int %s_depth_" << i - 1; + spirv << "\n"; + } + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Structure nesting depth of 256. +TEST_F(ValidateLimits, StructNestingDepthBad) { + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %s_depth_1 = OpTypeStruct %int + )"; + for (auto i = 2; i <= 256; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %int %s_depth_" << i - 1; + spirv << "\n"; + } + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure Nesting Depth may not be larger than 255. Found 256.")); +} + +// Valid: Structure nesting depth of 100 (limit is 100). +TEST_F(ValidateLimits, CustomizedStructNestingDepthGood) { + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %s_depth_1 = OpTypeStruct %int + )"; + for (auto i = 2; i <= 100; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %int %s_depth_" << i - 1; + spirv << "\n"; + } + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_struct_depth, 100u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Structure nesting depth of 101 (limit is 100). +TEST_F(ValidateLimits, CustomizedStructNestingDepthBad) { + std::ostringstream spirv; + spirv << header << R"( + %int = OpTypeInt 32 0 + %s_depth_1 = OpTypeStruct %int + )"; + for (auto i = 2; i <= 101; ++i) { + spirv << "%s_depth_" << i << " = OpTypeStruct %int %s_depth_" << i - 1; + spirv << "\n"; + } + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_struct_depth, 100u); + CompileSuccessfully(spirv.str()); + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Structure Nesting Depth may not be larger than 100. Found 101.")); +} + +// clang-format off +// Generates an SPIRV program with the given control flow nesting depth +void GenerateSpirvProgramWithCfgNestingDepth(std::string& str, int depth) { + std::ostringstream spirv; + spirv << header << R"( + %void = OpTypeVoid + %3 = OpTypeFunction %void + %bool = OpTypeBool + %12 = OpConstantTrue %bool + %main = OpFunction %void None %3 + %5 = OpLabel + OpBranch %6 + %6 = OpLabel + OpLoopMerge %8 %9 None + OpBranch %10 + %10 = OpLabel + OpBranchConditional %12 %7 %8 + %7 = OpLabel + )"; + int first_id = 13; + int last_id = 14; + // We already have 1 level of nesting due to the Loop. + int num_if_conditions = depth-1; + int largest_index = first_id + 2*num_if_conditions - 2; + for (int i = first_id; i <= largest_index; i = i + 2) { + spirv << "OpSelectionMerge %" << i+1 << " None" << "\n"; + spirv << "OpBranchConditional %12 " << "%" << i << " %" << i+1 << "\n"; + spirv << "%" << i << " = OpLabel" << "\n"; + } + spirv << "OpBranch %9" << "\n"; + + for (int i = largest_index+1; i > last_id; i = i - 2) { + spirv << "%" << i << " = OpLabel" << "\n"; + spirv << "OpBranch %" << i-2 << "\n"; + } + spirv << "%" << last_id << " = OpLabel" << "\n"; + spirv << "OpBranch %9" << "\n"; + spirv << R"( + %9 = OpLabel + OpBranch %6 + %8 = OpLabel + OpReturn + OpFunctionEnd + )"; + str = spirv.str(); +} +// clang-format on + +// Valid: Control Flow Nesting depth is 1023. +TEST_F(ValidateLimits, ControlFlowDepthGood) { + std::string spirv; + GenerateSpirvProgramWithCfgNestingDepth(spirv, 1023); + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Control Flow Nesting depth is 1024. (limit is 1023). +TEST_F(ValidateLimits, ControlFlowDepthBad) { + std::string spirv; + GenerateSpirvProgramWithCfgNestingDepth(spirv, 1024); + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Maximum Control Flow nesting depth exceeded.")); +} + +// Valid: Control Flow Nesting depth is 10 (custom limit: 10). +TEST_F(ValidateLimits, CustomizedControlFlowDepthGood) { + std::string spirv; + GenerateSpirvProgramWithCfgNestingDepth(spirv, 10); + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_control_flow_nesting_depth, 10u); + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// Invalid: Control Flow Nesting depth is 11. (custom limit: 10). +TEST_F(ValidateLimits, CustomizedControlFlowDepthBad) { + std::string spirv; + GenerateSpirvProgramWithCfgNestingDepth(spirv, 11); + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_control_flow_nesting_depth, 10u); + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_CFG, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Maximum Control Flow nesting depth exceeded.")); +} + +// Valid. The purpose here is to test the CFG depth calculation code when a loop +// continue target is the loop iteself. It also exercises the case where a loop +// is unreachable. +TEST_F(ValidateLimits, ControlFlowNoEntryToLoopGood) { + std::string str = header + R"( + OpName %entry "entry" + OpName %loop "loop" + OpName %exit "exit" +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%main = OpFunction %voidt None %funct +%entry = OpLabel + OpBranch %exit +%loop = OpLabel + OpLoopMerge %loop %loop None + OpBranch %loop +%exit = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_literals_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_literals_test.cpp new file mode 100644 index 00000000000..cbdbdd10e72 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_literals_test.cpp @@ -0,0 +1,142 @@ +// Copyright (c) 2017 Google 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. + +// Validation tests for ilegal literals + +#include +#include + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidateLiterals = spvtest::ValidateBase; +using ValidateLiteralsShader = spvtest::ValidateBase; +using ValidateLiteralsKernel = spvtest::ValidateBase; + +std::string GenerateShaderCode() { + std::string str = R"( + OpCapability Shader + OpCapability Linkage + OpCapability Int16 + OpCapability Int64 + OpCapability Float16 + OpCapability Float64 + OpMemoryModel Logical GLSL450 +%int16 = OpTypeInt 16 1 +%uint16 = OpTypeInt 16 0 +%int32 = OpTypeInt 32 1 +%uint32 = OpTypeInt 32 0 +%int64 = OpTypeInt 64 1 +%uint64 = OpTypeInt 64 0 +%half = OpTypeFloat 16 +%float = OpTypeFloat 32 +%double = OpTypeFloat 64 +%10 = OpTypeVoid + )"; + return str; +} + +std::string GenerateKernelCode() { + std::string str = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpCapability Int8 + OpMemoryModel Physical64 OpenCL +%uint8 = OpTypeInt 8 0 + )"; + return str; +} + +TEST_F(ValidateLiterals, LiteralsShaderGood) { + std::string str = GenerateShaderCode() + R"( +%11 = OpConstant %int16 !0x00007FFF +%12 = OpConstant %int16 !0xFFFF8000 +%13 = OpConstant %int16 !0xFFFFABCD +%14 = OpConstant %uint16 !0x0000ABCD +%15 = OpConstant %int16 -32768 +%16 = OpConstant %uint16 65535 +%17 = OpConstant %int32 -2147483648 +%18 = OpConstant %uint32 4294967295 +%19 = OpConstant %int64 -9223372036854775808 +%20 = OpConstant %uint64 18446744073709551615 +%21 = OpConstant %half !0x0000FFFF +%22 = OpConstant %float !0xFFFFFFFF +%23 = OpConstant %double !0xFFFFFFFF !0xFFFFFFFF + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateLiteralsShader, LiteralsShaderBad) { + std::string str = GenerateShaderCode() + GetParam(); + std::string inst_id = "11"; + CompileSuccessfully(str); + EXPECT_EQ(SPV_ERROR_INVALID_VALUE, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("The high-order bits of a literal number in instruction " + + inst_id + + " must be 0 for a floating-point type, " + "or 0 for an integer type with Signedness of 0, " + "or sign extended when Signedness is 1")); +} + +INSTANTIATE_TEST_CASE_P( + LiteralsShaderCases, ValidateLiteralsShader, + ::testing::Values("%11 = OpConstant %int16 !0xFFFF0000", // Sign bit is 0 + "%11 = OpConstant %int16 !0x00008000", // Sign bit is 1 + "%11 = OpConstant %int16 !0xABCD8000", // Sign bit is 1 + "%11 = OpConstant %int16 !0xABCD0000", + "%11 = OpConstant %uint16 !0xABCD0000", + "%11 = OpConstant %half !0xABCD0000", + "%11 = OpConstant %half !0x00010000")); + +TEST_F(ValidateLiterals, LiteralsKernelGood) { + std::string str = GenerateKernelCode() + R"( +%4 = OpConstant %uint8 !0x000000AB +%6 = OpConstant %uint8 255 + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateLiteralsKernel, LiteralsKernelBad) { + std::string str = GenerateKernelCode() + GetParam(); + std::string inst_id = "2"; + CompileSuccessfully(str); + EXPECT_EQ(SPV_ERROR_INVALID_VALUE, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("The high-order bits of a literal number in instruction " + + inst_id + + " must be 0 for a floating-point type, " + "or 0 for an integer type with Signedness of 0, " + "or sign extended when Signedness is 1")); +} + +INSTANTIATE_TEST_CASE_P( + LiteralsKernelCases, ValidateLiteralsKernel, + ::testing::Values("%2 = OpConstant %uint8 !0xABCDEF00", + "%2 = OpConstant %uint8 !0xABCDEFFF")); + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_logicals_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_logicals_test.cpp new file mode 100644 index 00000000000..449cdd54fc9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_logicals_test.cpp @@ -0,0 +1,923 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateLogicals = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + const std::string capabilities = + R"( +OpCapability Shader +OpCapability Int64 +OpCapability Float64)"; + + const std::string after_extension_before_body = + R"( +%ext_inst = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%s32 = OpTypeInt 32 1 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%s64 = OpTypeInt 64 1 +%boolvec2 = OpTypeVector %bool 2 +%s32vec2 = OpTypeVector %s32 2 +%u32vec2 = OpTypeVector %u32 2 +%u64vec2 = OpTypeVector %u64 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%s32vec3 = OpTypeVector %s32 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%u64vec4 = OpTypeVector %u64 4 +%s32vec4 = OpTypeVector %s32 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 + +%s32_0 = OpConstant %s32 0 +%s32_1 = OpConstant %s32 1 +%s32_2 = OpConstant %s32 2 +%s32_3 = OpConstant %s32 3 +%s32_4 = OpConstant %s32 4 +%s32_m1 = OpConstant %s32 -1 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64_4 = OpConstant %f64 4 + +%s64_0 = OpConstant %s64 0 +%s64_1 = OpConstant %s64 1 +%s64_2 = OpConstant %s64 2 +%s64_3 = OpConstant %s64 3 +%s64_4 = OpConstant %s64 4 +%s64_m1 = OpConstant %s64 -1 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_4 = OpConstant %u64 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%s32vec2_01 = OpConstantComposite %s32vec2 %s32_0 %s32_1 +%s32vec2_12 = OpConstantComposite %s32vec2 %s32_1 %s32_2 +%s32vec3_012 = OpConstantComposite %s32vec3 %s32_0 %s32_1 %s32_2 +%s32vec3_123 = OpConstantComposite %s32vec3 %s32_1 %s32_2 %s32_3 +%s32vec4_0123 = OpConstantComposite %s32vec4 %s32_0 %s32_1 %s32_2 %s32_3 +%s32vec4_1234 = OpConstantComposite %s32vec4 %s32_1 %s32_2 %s32_3 %s32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec2_12 = OpConstantComposite %f64vec2 %f64_1 %f64_2 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec3_123 = OpConstantComposite %f64vec3 %f64_1 %f64_2 %f64_3 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 +%f64vec4_1234 = OpConstantComposite %f64vec4 %f64_1 %f64_2 %f64_3 %f64_4 + +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%boolvec2_tf = OpConstantComposite %boolvec2 %true %false +%boolvec3_tft = OpConstantComposite %boolvec3 %true %false %true +%boolvec4_tftf = OpConstantComposite %boolvec4 %true %false %true %false + +%f32vec4ptr = OpTypePointer Function %f32vec4 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string after_body = + R"( +OpReturn +OpFunctionEnd)"; + + return capabilities + capabilities_and_extensions + + after_extension_before_body + body + after_body; +} + +std::string GenerateKernelCode( + const std::string& body, + const std::string& capabilities_and_extensions = "") { + const std::string capabilities = + R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability Int64 +OpCapability Float64)"; + + const std::string after_extension_before_body = + R"( +OpMemoryModel Physical32 OpenCL +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%f64 = OpTypeFloat 64 +%u64 = OpTypeInt 64 0 +%boolvec2 = OpTypeVector %bool 2 +%u32vec2 = OpTypeVector %u32 2 +%u64vec2 = OpTypeVector %u64 2 +%f32vec2 = OpTypeVector %f32 2 +%f64vec2 = OpTypeVector %f64 2 +%boolvec3 = OpTypeVector %bool 3 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%f32vec3 = OpTypeVector %f32 3 +%f64vec3 = OpTypeVector %f64 3 +%boolvec4 = OpTypeVector %bool 4 +%u32vec4 = OpTypeVector %u32 4 +%u64vec4 = OpTypeVector %u64 4 +%f32vec4 = OpTypeVector %f32 4 +%f64vec4 = OpTypeVector %f64 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64_4 = OpConstant %f64 4 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 +%u64_4 = OpConstant %u64 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec3_012 = OpConstantComposite %u32vec3 %u32_0 %u32_1 %u32_2 +%u32vec3_123 = OpConstantComposite %u32vec3 %u32_1 %u32_2 %u32_3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u32vec4_1234 = OpConstantComposite %u32vec4 %u32_1 %u32_2 %u32_3 %u32_4 + +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec2_12 = OpConstantComposite %f64vec2 %f64_1 %f64_2 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec3_123 = OpConstantComposite %f64vec3 %f64_1 %f64_2 %f64_3 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 +%f64vec4_1234 = OpConstantComposite %f64vec4 %f64_1 %f64_2 %f64_3 %f64_4 + +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool +%boolvec2_tf = OpConstantComposite %boolvec2 %true %false +%boolvec3_tft = OpConstantComposite %boolvec3 %true %false %true +%boolvec4_tftf = OpConstantComposite %boolvec4 %true %false %true %false + +%f32vec4ptr = OpTypePointer Function %f32vec4 + +%main = OpFunction %void None %func +%main_entry = OpLabel)"; + + const std::string after_body = + R"( +OpReturn +OpFunctionEnd)"; + + return capabilities + capabilities_and_extensions + + after_extension_before_body + body + after_body; +} + +TEST_F(ValidateLogicals, OpAnySuccess) { + const std::string body = R"( +%val1 = OpAny %bool %boolvec2_tf +%val2 = OpAny %bool %boolvec3_tft +%val3 = OpAny %bool %boolvec4_tftf +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpAnyWrongTypeId) { + const std::string body = R"( +%val = OpAny %u32 %boolvec2_tf +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected bool scalar type as Result Type: Any")); +} + +TEST_F(ValidateLogicals, OpAnyWrongOperand) { + const std::string body = R"( +%val = OpAny %bool %u32vec3_123 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected operand to be vector bool: Any")); +} + +TEST_F(ValidateLogicals, OpIsNanSuccess) { + const std::string body = R"( +%val1 = OpIsNan %bool %f32_1 +%val2 = OpIsNan %bool %f64_0 +%val3 = OpIsNan %boolvec2 %f32vec2_12 +%val4 = OpIsNan %boolvec3 %f32vec3_123 +%val5 = OpIsNan %boolvec4 %f32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpIsNanWrongTypeId) { + const std::string body = R"( +%val1 = OpIsNan %u32 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected bool scalar or vector type as Result Type: IsNan")); +} + +TEST_F(ValidateLogicals, OpIsNanOperandNotFloat) { + const std::string body = R"( +%val1 = OpIsNan %bool %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operand to be scalar or vector float: IsNan")); +} + +TEST_F(ValidateLogicals, OpIsNanOperandWrongSize) { + const std::string body = R"( +%val1 = OpIsNan %bool %f32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the operand to be equal: " + "IsNan")); +} + +TEST_F(ValidateLogicals, OpLessOrGreaterSuccess) { + const std::string body = R"( +%val1 = OpLessOrGreater %bool %f32_0 %f32_1 +%val2 = OpLessOrGreater %bool %f64_0 %f64_0 +%val3 = OpLessOrGreater %boolvec2 %f32vec2_12 %f32vec2_12 +%val4 = OpLessOrGreater %boolvec3 %f32vec3_123 %f32vec3_123 +%val5 = OpLessOrGreater %boolvec4 %f32vec4_1234 %f32vec4_1234 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpLessOrGreaterWrongTypeId) { + const std::string body = R"( +%val1 = OpLessOrGreater %u32 %f32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected bool scalar or vector type as Result Type: LessOrGreater")); +} + +TEST_F(ValidateLogicals, OpLessOrGreaterLeftOperandNotFloat) { + const std::string body = R"( +%val1 = OpLessOrGreater %bool %u32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected operands to be scalar or vector float: LessOrGreater")); +} + +TEST_F(ValidateLogicals, OpLessOrGreaterLeftOperandWrongSize) { + const std::string body = R"( +%val1 = OpLessOrGreater %bool %f32vec2_12 %f32_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the operands to be equal: " + "LessOrGreater")); +} + +TEST_F(ValidateLogicals, OpLessOrGreaterOperandsDifferentType) { + const std::string body = R"( +%val1 = OpLessOrGreater %bool %f32_1 %f64_1 +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected left and right operands to have the same type: " + "LessOrGreater")); +} + +TEST_F(ValidateLogicals, OpFOrdEqualSuccess) { + const std::string body = R"( +%val1 = OpFOrdEqual %bool %f32_0 %f32_1 +%val2 = OpFOrdEqual %bool %f64_0 %f64_0 +%val3 = OpFOrdEqual %boolvec2 %f32vec2_12 %f32vec2_12 +%val4 = OpFOrdEqual %boolvec3 %f32vec3_123 %f32vec3_123 +%val5 = OpFOrdEqual %boolvec4 %f32vec4_1234 %f32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpFOrdEqualWrongTypeId) { + const std::string body = R"( +%val1 = OpFOrdEqual %u32 %f32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected bool scalar or vector type as Result Type: FOrdEqual")); +} + +TEST_F(ValidateLogicals, OpFOrdEqualLeftOperandNotFloat) { + const std::string body = R"( +%val1 = OpFOrdEqual %bool %u32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector float: FOrdEqual")); +} + +TEST_F(ValidateLogicals, OpFOrdEqualLeftOperandWrongSize) { + const std::string body = R"( +%val1 = OpFOrdEqual %bool %f32vec2_12 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the operands to be equal: " + "FOrdEqual")); +} + +TEST_F(ValidateLogicals, OpFOrdEqualOperandsDifferentType) { + const std::string body = R"( +%val1 = OpFOrdEqual %bool %f32_1 %f64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected left and right operands to have the same type: " + "FOrdEqual")); +} + +TEST_F(ValidateLogicals, OpLogicalEqualSuccess) { + const std::string body = R"( +%val1 = OpLogicalEqual %bool %true %false +%val2 = OpLogicalEqual %boolvec2 %boolvec2_tf %boolvec2_tf +%val3 = OpLogicalEqual %boolvec3 %boolvec3_tft %boolvec3_tft +%val4 = OpLogicalEqual %boolvec4 %boolvec4_tftf %boolvec4_tftf +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpLogicalEqualWrongTypeId) { + const std::string body = R"( +%val1 = OpLogicalEqual %u32 %true %false +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected bool scalar or vector type as Result Type: LogicalEqual")); +} + +TEST_F(ValidateLogicals, OpLogicalEqualWrongLeftOperand) { + const std::string body = R"( +%val1 = OpLogicalEqual %bool %boolvec2_tf %false +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected both operands to be of Result Type: LogicalEqual")); +} + +TEST_F(ValidateLogicals, OpLogicalEqualWrongRightOperand) { + const std::string body = R"( +%val1 = OpLogicalEqual %boolvec2 %boolvec2_tf %false +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected both operands to be of Result Type: LogicalEqual")); +} + +TEST_F(ValidateLogicals, OpLogicalNotSuccess) { + const std::string body = R"( +%val1 = OpLogicalNot %bool %true +%val2 = OpLogicalNot %boolvec2 %boolvec2_tf +%val3 = OpLogicalNot %boolvec3 %boolvec3_tft +%val4 = OpLogicalNot %boolvec4 %boolvec4_tftf +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpLogicalNotWrongTypeId) { + const std::string body = R"( +%val1 = OpLogicalNot %u32 %true +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected bool scalar or vector type as Result Type: LogicalNot")); +} + +TEST_F(ValidateLogicals, OpLogicalNotWrongOperand) { + const std::string body = R"( +%val1 = OpLogicalNot %bool %boolvec2_tf +)"; + + CompileSuccessfully(GenerateKernelCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected operand to be of Result Type: LogicalNot")); +} + +TEST_F(ValidateLogicals, OpSelectSuccess) { + const std::string body = R"( +%val1 = OpSelect %u32 %true %u32_0 %u32_1 +%val2 = OpSelect %f32 %true %f32_0 %f32_1 +%val3 = OpSelect %f64 %true %f64_0 %f64_1 +%val4 = OpSelect %f32vec2 %boolvec2_tf %f32vec2_01 %f32vec2_12 +%val5 = OpSelect %f32vec4 %boolvec4_tftf %f32vec4_0123 %f32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpSelectWrongTypeId) { + const std::string body = R"( +%val1 = OpSelect %void %true %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected scalar or vector type as Result Type: Select")); +} + +TEST_F(ValidateLogicals, OpSelectPointerNoCapability) { + const std::string body = R"( +%x = OpVariable %f32vec4ptr Function +%y = OpVariable %f32vec4ptr Function +OpStore %x %f32vec4_0123 +OpStore %y %f32vec4_1234 +%val1 = OpSelect %f32vec4ptr %true %x %y +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Using pointers with OpSelect requires capability VariablePointers " + "or VariablePointersStorageBuffer")); +} + +TEST_F(ValidateLogicals, OpSelectPointerWithCapability1) { + const std::string body = R"( +%x = OpVariable %f32vec4ptr Function +%y = OpVariable %f32vec4ptr Function +OpStore %x %f32vec4_0123 +OpStore %y %f32vec4_1234 +%val1 = OpSelect %f32vec4ptr %true %x %y +)"; + + const std::string extra_cap_ext = R"( +OpCapability VariablePointers +OpExtension "SPV_KHR_variable_pointers" +)"; + + CompileSuccessfully(GenerateShaderCode(body, extra_cap_ext).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpSelectPointerWithCapability2) { + const std::string body = R"( +%x = OpVariable %f32vec4ptr Function +%y = OpVariable %f32vec4ptr Function +OpStore %x %f32vec4_0123 +OpStore %y %f32vec4_1234 +%val1 = OpSelect %f32vec4ptr %true %x %y +)"; + + const std::string extra_cap_ext = R"( +OpCapability VariablePointersStorageBuffer +OpExtension "SPV_KHR_variable_pointers" +)"; + + CompileSuccessfully(GenerateShaderCode(body, extra_cap_ext).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpSelectWrongCondition) { + const std::string body = R"( +%val1 = OpSelect %u32 %u32_1 %u32_0 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected bool scalar or vector type as condition: Select")); +} + +TEST_F(ValidateLogicals, OpSelectWrongConditionDimension) { + const std::string body = R"( +%val1 = OpSelect %u32vec2 %true %u32vec2_01 %u32vec2_12 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the condition to be equal: " + "Select")); +} + +TEST_F(ValidateLogicals, OpSelectWrongLeftObject) { + const std::string body = R"( +%val1 = OpSelect %bool %true %u32vec2_01 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both objects to be of Result Type: Select")); +} + +TEST_F(ValidateLogicals, OpSelectWrongRightObject) { + const std::string body = R"( +%val1 = OpSelect %bool %true %u32_1 %u32vec2_01 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both objects to be of Result Type: Select")); +} + +TEST_F(ValidateLogicals, OpIEqualSuccess) { + const std::string body = R"( +%val1 = OpIEqual %bool %u32_0 %s32_1 +%val2 = OpIEqual %bool %s64_0 %u64_0 +%val3 = OpIEqual %boolvec2 %s32vec2_12 %u32vec2_12 +%val4 = OpIEqual %boolvec3 %s32vec3_123 %u32vec3_123 +%val5 = OpIEqual %boolvec4 %s32vec4_1234 %u32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpIEqualWrongTypeId) { + const std::string body = R"( +%val1 = OpIEqual %u32 %s32_1 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected bool scalar or vector type as Result Type: IEqual")); +} + +TEST_F(ValidateLogicals, OpIEqualLeftOperandNotInt) { + const std::string body = R"( +%val1 = OpIEqual %bool %f32_1 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector int: IEqual")); +} + +TEST_F(ValidateLogicals, OpIEqualLeftOperandWrongSize) { + const std::string body = R"( +%val1 = OpIEqual %bool %s32vec2_12 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the operands to be equal: " + "IEqual")); +} + +TEST_F(ValidateLogicals, OpIEqualRightOperandNotInt) { + const std::string body = R"( +%val1 = OpIEqual %bool %u32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector int: IEqual")); +} + +TEST_F(ValidateLogicals, OpIEqualDifferentBitWidth) { + const std::string body = R"( +%val1 = OpIEqual %bool %u32_1 %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both operands to have the same component bit " + "width: IEqual")); +} + +TEST_F(ValidateLogicals, OpUGreaterThanSuccess) { + const std::string body = R"( +%val1 = OpUGreaterThan %bool %u32_0 %u32_1 +%val2 = OpUGreaterThan %bool %s32_0 %u32_1 +%val3 = OpUGreaterThan %bool %u64_0 %u64_0 +%val4 = OpUGreaterThan %bool %u64_0 %s64_0 +%val5 = OpUGreaterThan %boolvec2 %u32vec2_12 %u32vec2_12 +%val6 = OpUGreaterThan %boolvec3 %s32vec3_123 %u32vec3_123 +%val7 = OpUGreaterThan %boolvec4 %u32vec4_1234 %u32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpUGreaterThanWrongTypeId) { + const std::string body = R"( +%val1 = OpUGreaterThan %u32 %u32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected bool scalar or vector type as Result Type: UGreaterThan")); +} + +TEST_F(ValidateLogicals, OpUGreaterThanLeftOperandNotInt) { + const std::string body = R"( +%val1 = OpUGreaterThan %bool %f32_1 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector int: UGreaterThan")); +} + +TEST_F(ValidateLogicals, OpUGreaterThanLeftOperandWrongSize) { + const std::string body = R"( +%val1 = OpUGreaterThan %bool %u32vec2_12 %u32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the operands to be equal: " + "UGreaterThan")); +} + +TEST_F(ValidateLogicals, OpUGreaterThanRightOperandNotInt) { + const std::string body = R"( +%val1 = OpUGreaterThan %bool %u32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector int: UGreaterThan")); +} + +TEST_F(ValidateLogicals, OpUGreaterThanDifferentBitWidth) { + const std::string body = R"( +%val1 = OpUGreaterThan %bool %u32_1 %u64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected both operands to have the same component bit width: " + "UGreaterThan")); +} + +TEST_F(ValidateLogicals, OpSGreaterThanSuccess) { + const std::string body = R"( +%val1 = OpSGreaterThan %bool %s32_0 %s32_1 +%val2 = OpSGreaterThan %bool %u32_0 %s32_1 +%val3 = OpSGreaterThan %bool %s64_0 %s64_0 +%val4 = OpSGreaterThan %bool %s64_0 %u64_0 +%val5 = OpSGreaterThan %boolvec2 %s32vec2_12 %s32vec2_12 +%val6 = OpSGreaterThan %boolvec3 %s32vec3_123 %u32vec3_123 +%val7 = OpSGreaterThan %boolvec4 %s32vec4_1234 %s32vec4_1234 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateLogicals, OpSGreaterThanWrongTypeId) { + const std::string body = R"( +%val1 = OpSGreaterThan %s32 %s32_1 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected bool scalar or vector type as Result Type: SGreaterThan")); +} + +TEST_F(ValidateLogicals, OpSGreaterThanLeftOperandNotInt) { + const std::string body = R"( +%val1 = OpSGreaterThan %bool %f32_1 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector int: SGreaterThan")); +} + +TEST_F(ValidateLogicals, OpSGreaterThanLeftOperandWrongSize) { + const std::string body = R"( +%val1 = OpSGreaterThan %bool %s32vec2_12 %s32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Expected vector sizes of Result Type and the operands to be equal: " + "SGreaterThan")); +} + +TEST_F(ValidateLogicals, OpSGreaterThanRightOperandNotInt) { + const std::string body = R"( +%val1 = OpSGreaterThan %bool %s32_1 %f32_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Expected operands to be scalar or vector int: SGreaterThan")); +} + +TEST_F(ValidateLogicals, OpSGreaterThanDifferentBitWidth) { + const std::string body = R"( +%val1 = OpSGreaterThan %bool %s32_1 %s64_1 +)"; + + CompileSuccessfully(GenerateShaderCode(body).c_str()); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Expected both operands to have the same component bit " + "width: SGreaterThan")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp new file mode 100644 index 00000000000..6ff5c127b32 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp @@ -0,0 +1,252 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::Combine; +using ::testing::HasSubstr; +using ::testing::Values; +using ::testing::ValuesIn; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = "", + const std::string& execution_model = "GLCompute") { + std::ostringstream ss; + ss << R"( +OpCapability Shader +OpCapability GroupNonUniform +OpCapability GroupNonUniformVote +OpCapability GroupNonUniformBallot +OpCapability GroupNonUniformShuffle +OpCapability GroupNonUniformShuffleRelative +OpCapability GroupNonUniformArithmetic +OpCapability GroupNonUniformClustered +OpCapability GroupNonUniformQuad +)"; + + ss << capabilities_and_extensions; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%u32 = OpTypeInt 32 0 +%float = OpTypeFloat 32 +%u32vec4 = OpTypeVector %u32 4 + +%true = OpConstantTrue %bool +%false = OpConstantFalse %bool + +%u32_0 = OpConstant %u32 0 + +%float_0 = OpConstant %float 0 + +%u32vec4_null = OpConstantComposite %u32vec4 %u32_0 %u32_0 %u32_0 %u32_0 + +%cross_device = OpConstant %u32 0 +%device = OpConstant %u32 1 +%workgroup = OpConstant %u32 2 +%subgroup = OpConstant %u32 3 +%invocation = OpConstant %u32 4 + +%reduce = OpConstant %u32 0 +%inclusive_scan = OpConstant %u32 1 +%exclusive_scan = OpConstant %u32 2 +%clustered_reduce = OpConstant %u32 3 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +SpvScope scopes[] = {SpvScopeCrossDevice, SpvScopeDevice, SpvScopeWorkgroup, + SpvScopeSubgroup, SpvScopeInvocation}; + +using GroupNonUniformScope = spvtest::ValidateBase< + std::tuple>; + +std::string ConvertScope(SpvScope scope) { + switch (scope) { + case SpvScopeCrossDevice: + return "%cross_device"; + case SpvScopeDevice: + return "%device"; + case SpvScopeWorkgroup: + return "%workgroup"; + case SpvScopeSubgroup: + return "%subgroup"; + case SpvScopeInvocation: + return "%invocation"; + default: + return ""; + } +} + +TEST_P(GroupNonUniformScope, Vulkan1p1) { + std::string opcode = std::get<0>(GetParam()); + std::string type = std::get<1>(GetParam()); + SpvScope execution_scope = std::get<2>(GetParam()); + std::string args = std::get<3>(GetParam()); + + std::ostringstream sstr; + sstr << "%result = " << opcode << " "; + sstr << type << " "; + sstr << ConvertScope(execution_scope) << " "; + sstr << args << "\n"; + + CompileSuccessfully(GenerateShaderCode(sstr.str()), SPV_ENV_VULKAN_1_1); + spv_result_t result = ValidateInstructions(SPV_ENV_VULKAN_1_1); + if (execution_scope == SpvScopeSubgroup) { + EXPECT_EQ(SPV_SUCCESS, result); + } else { + EXPECT_EQ(SPV_ERROR_INVALID_DATA, result); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "in Vulkan environment Execution scope is limited to Subgroup")); + } +} + +TEST_P(GroupNonUniformScope, Spirv1p3) { + std::string opcode = std::get<0>(GetParam()); + std::string type = std::get<1>(GetParam()); + SpvScope execution_scope = std::get<2>(GetParam()); + std::string args = std::get<3>(GetParam()); + + std::ostringstream sstr; + sstr << "%result = " << opcode << " "; + sstr << type << " "; + sstr << ConvertScope(execution_scope) << " "; + sstr << args << "\n"; + + CompileSuccessfully(GenerateShaderCode(sstr.str()), SPV_ENV_UNIVERSAL_1_3); + spv_result_t result = ValidateInstructions(SPV_ENV_UNIVERSAL_1_3); + if (execution_scope == SpvScopeSubgroup || + execution_scope == SpvScopeWorkgroup) { + EXPECT_EQ(SPV_SUCCESS, result); + } else { + EXPECT_EQ(SPV_ERROR_INVALID_DATA, result); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Execution scope is limited to Subgroup or Workgroup")); + } +} + +INSTANTIATE_TEST_CASE_P(GroupNonUniformElect, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformElect"), + Values("%bool"), ValuesIn(scopes), Values(""))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformVote, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformAll", + "OpGroupNonUniformAny", + "OpGroupNonUniformAllEqual"), + Values("%bool"), ValuesIn(scopes), + Values("%true"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformBroadcast, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformBroadcast"), + Values("%bool"), ValuesIn(scopes), + Values("%true %u32_0"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformBroadcastFirst, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformBroadcastFirst"), + Values("%bool"), ValuesIn(scopes), + Values("%true"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformBallot, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformBallot"), + Values("%u32vec4"), ValuesIn(scopes), + Values("%true"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformInverseBallot, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformInverseBallot"), + Values("%bool"), ValuesIn(scopes), + Values("%u32vec4_null"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotBitExtract, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformBallotBitExtract"), + Values("%bool"), ValuesIn(scopes), + Values("%u32vec4_null %u32_0"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotBitCount, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformBallotBitCount"), + Values("%u32"), ValuesIn(scopes), + Values("Reduce %u32vec4_null"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotFind, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformBallotFindLSB", + "OpGroupNonUniformBallotFindMSB"), + Values("%u32"), ValuesIn(scopes), + Values("%u32vec4_null"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformShuffle, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformShuffle", + "OpGroupNonUniformShuffleXor", + "OpGroupNonUniformShuffleUp", + "OpGroupNonUniformShuffleDown"), + Values("%u32"), ValuesIn(scopes), + Values("%u32_0 %u32_0"))); + +INSTANTIATE_TEST_CASE_P( + GroupNonUniformIntegerArithmetic, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformIAdd", "OpGroupNonUniformIMul", + "OpGroupNonUniformSMin", "OpGroupNonUniformUMin", + "OpGroupNonUniformSMax", "OpGroupNonUniformUMax", + "OpGroupNonUniformBitwiseAnd", "OpGroupNonUniformBitwiseOr", + "OpGroupNonUniformBitwiseXor"), + Values("%u32"), ValuesIn(scopes), Values("Reduce %u32_0"))); + +INSTANTIATE_TEST_CASE_P( + GroupNonUniformFloatArithmetic, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformFAdd", "OpGroupNonUniformFMul", + "OpGroupNonUniformFMin", "OpGroupNonUniformFMax"), + Values("%float"), ValuesIn(scopes), Values("Reduce %float_0"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformLogicalArithmetic, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformLogicalAnd", + "OpGroupNonUniformLogicalOr", + "OpGroupNonUniformLogicalXor"), + Values("%bool"), ValuesIn(scopes), + Values("Reduce %true"))); + +INSTANTIATE_TEST_CASE_P(GroupNonUniformQuad, GroupNonUniformScope, + Combine(Values("OpGroupNonUniformQuadBroadcast", + "OpGroupNonUniformQuadSwap"), + Values("%u32"), ValuesIn(scopes), + Values("%u32_0 %u32_0"))); + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_primitives_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_primitives_test.cpp new file mode 100644 index 00000000000..f02ba805705 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_primitives_test.cpp @@ -0,0 +1,317 @@ +// Copyright (c) 2017 LunarG 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. + +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidatePrimitives = spvtest::ValidateBase; + +std::string GenerateShaderCode( + const std::string& body, + const std::string& capabilities_and_extensions = + "OpCapability GeometryStreams", + const std::string& execution_model = "Geometry") { + std::ostringstream ss; + ss << capabilities_and_extensions << "\n"; + ss << "OpMemoryModel Logical GLSL450\n"; + ss << "OpEntryPoint " << execution_model << " %main \"main\"\n"; + + ss << R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%u32vec4 = OpTypeVector %u32 4 + +%f32_0 = OpConstant %f32 0 +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 + +%main = OpFunction %void None %func +%main_entry = OpLabel +)"; + + ss << body; + + ss << R"( +OpReturn +OpFunctionEnd)"; + + return ss.str(); +} + +// Returns SPIR-V assembly fragment representing a function call, +// the end of the callee body, and the preamble and body of the called +// function with the given body, but missing the final return and +// function-end. The result is of the form where it can be used in the +// |body| argument to GenerateShaderCode. +std::string CallAndCallee(const std::string& body) { + std::ostringstream ss; + ss << R"( +%dummy = OpFunctionCall %void %foo +OpReturn +OpFunctionEnd + +%foo = OpFunction %void None %func +%foo_entry = OpLabel +)"; + + ss << body; + + return ss.str(); +} + +// OpEmitVertex doesn't have any parameters, so other validation +// is handled by the binary parser, and generic dominance checks. +TEST_F(ValidatePrimitives, EmitVertexSuccess) { + CompileSuccessfully( + GenerateShaderCode("OpEmitVertex", "OpCapability Geometry")); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidatePrimitives, EmitVertexFailMissingCapability) { + CompileSuccessfully( + GenerateShaderCode("OpEmitVertex", "OpCapability Shader", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Opcode EmitVertex requires one of these capabilities: Geometry")); +} + +TEST_F(ValidatePrimitives, EmitVertexFailWrongExecutionMode) { + CompileSuccessfully( + GenerateShaderCode("OpEmitVertex", "OpCapability Geometry", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("EmitVertex instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, EmitVertexFailWrongExecutionModeNestedFunction) { + CompileSuccessfully(GenerateShaderCode(CallAndCallee("OpEmitVertex"), + "OpCapability Geometry", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("EmitVertex instructions require Geometry execution model")); +} + +// OpEndPrimitive doesn't have any parameters, so other validation +// is handled by the binary parser, and generic dominance checks. +TEST_F(ValidatePrimitives, EndPrimitiveSuccess) { + CompileSuccessfully( + GenerateShaderCode("OpEndPrimitive", "OpCapability Geometry")); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidatePrimitives, EndPrimitiveFailMissingCapability) { + CompileSuccessfully( + GenerateShaderCode("OpEndPrimitive", "OpCapability Shader", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Opcode EndPrimitive requires one of these capabilities: Geometry")); +} + +TEST_F(ValidatePrimitives, EndPrimitiveFailWrongExecutionMode) { + CompileSuccessfully( + GenerateShaderCode("OpEndPrimitive", "OpCapability Geometry", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("EndPrimitive instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, EndPrimitiveFailWrongExecutionModeNestedFunction) { + CompileSuccessfully(GenerateShaderCode(CallAndCallee("OpEndPrimitive"), + "OpCapability Geometry", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("EndPrimitive instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, EmitStreamVertexSuccess) { + const std::string body = R"( +OpEmitStreamVertex %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidatePrimitives, EmitStreamVertexFailMissingCapability) { + CompileSuccessfully(GenerateShaderCode("OpEmitStreamVertex %u32_0", + "OpCapability Shader", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode EmitStreamVertex requires one of these " + "capabilities: GeometryStreams")); +} + +TEST_F(ValidatePrimitives, EmitStreamVertexFailWrongExecutionMode) { + CompileSuccessfully(GenerateShaderCode( + "OpEmitStreamVertex %u32_0", "OpCapability GeometryStreams", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "EmitStreamVertex instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, + EmitStreamVertexFailWrongExecutionModeNestedFunction) { + CompileSuccessfully( + GenerateShaderCode(CallAndCallee("OpEmitStreamVertex %u32_0"), + "OpCapability GeometryStreams", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "EmitStreamVertex instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, EmitStreamVertexNonInt) { + const std::string body = R"( +OpEmitStreamVertex %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("EmitStreamVertex: " + "expected Stream to be int scalar")); +} + +TEST_F(ValidatePrimitives, EmitStreamVertexNonScalar) { + const std::string body = R"( +OpEmitStreamVertex %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("EmitStreamVertex: " + "expected Stream to be int scalar")); +} + +TEST_F(ValidatePrimitives, EmitStreamVertexNonConstant) { + const std::string body = R"( +%val1 = OpIAdd %u32 %u32_0 %u32_1 +OpEmitStreamVertex %val1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("EmitStreamVertex: " + "expected Stream to be constant instruction")); +} + +TEST_F(ValidatePrimitives, EndStreamPrimitiveSuccess) { + const std::string body = R"( +OpEndStreamPrimitive %u32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidatePrimitives, EndStreamPrimitiveFailMissingCapability) { + CompileSuccessfully(GenerateShaderCode("OpEndStreamPrimitive %u32_0", + "OpCapability Shader", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_CAPABILITY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Opcode EndStreamPrimitive requires one of these " + "capabilities: GeometryStreams")); +} + +TEST_F(ValidatePrimitives, EndStreamPrimitiveFailWrongExecutionMode) { + CompileSuccessfully(GenerateShaderCode( + "OpEndStreamPrimitive %u32_0", "OpCapability GeometryStreams", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "EndStreamPrimitive instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, + EndStreamPrimitiveFailWrongExecutionModeNestedFunction) { + CompileSuccessfully( + GenerateShaderCode(CallAndCallee("OpEndStreamPrimitive %u32_0"), + "OpCapability GeometryStreams", "Vertex")); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "EndStreamPrimitive instructions require Geometry execution model")); +} + +TEST_F(ValidatePrimitives, EndStreamPrimitiveNonInt) { + const std::string body = R"( +OpEndStreamPrimitive %f32_0 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("EndStreamPrimitive: " + "expected Stream to be int scalar")); +} + +TEST_F(ValidatePrimitives, EndStreamPrimitiveNonScalar) { + const std::string body = R"( +OpEndStreamPrimitive %u32vec4_0123 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("EndStreamPrimitive: " + "expected Stream to be int scalar")); +} + +TEST_F(ValidatePrimitives, EndStreamPrimitiveNonConstant) { + const std::string body = R"( +%val1 = OpIAdd %u32 %u32_0 %u32_1 +OpEndStreamPrimitive %val1 +)"; + + CompileSuccessfully(GenerateShaderCode(body)); + EXPECT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("EndStreamPrimitive: " + "expected Stream to be constant instruction")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_ssa_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_ssa_test.cpp new file mode 100644 index 00000000000..25944f5189e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_ssa_test.cpp @@ -0,0 +1,1446 @@ +// Copyright (c) 2015-2016 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. + +// Validation tests for SSA + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::MatchesRegex; + +using ValidateSSA = spvtest::ValidateBase>; + +TEST_F(ValidateSSA, Default) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %3 "" + OpExecutionMode %3 LocalSize 1 1 1 +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, IdUndefinedBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%func = OpFunction %vfunct None %missing +%flabel = OpLabel + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, IdRedefinedBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %2 "redefined" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%2 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); +} + +TEST_F(ValidateSSA, DominateUsageBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %1 "not_dominant" +%2 = OpTypeFunction %1 ; uses %1 before it's definition +%1 = OpTypeVoid +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("not_dominant")); +} + +TEST_F(ValidateSSA, DominateUsageWithinBlockBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %bad "bad" +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%uintt = OpTypeInt 32 0 +%one = OpConstant %uintt 1 +%func = OpFunction %voidt None %funct +%entry = OpLabel +%sum = OpIAdd %uintt %one %bad +%bad = OpCopyObject %uintt %sum + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("ID .\\[bad\\] has not been defined\n" + " %8 = OpIAdd %uint %uint_1 %bad\n")); +} + +TEST_F(ValidateSSA, DominateUsageSameInstructionBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %sum "sum" +%voidt = OpTypeVoid +%funct = OpTypeFunction %voidt +%uintt = OpTypeInt 32 0 +%one = OpConstant %uintt 1 +%func = OpFunction %voidt None %funct +%entry = OpLabel +%sum = OpIAdd %uintt %one %sum + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("ID .\\[sum\\] has not been defined\n" + " %sum = OpIAdd %uint %uint_1 %sum\n")); +} + +TEST_F(ValidateSSA, ForwardNameGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %3 "main" +%1 = OpTypeVoid +%2 = OpTypeFunction %1 +%3 = OpFunction %1 None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardNameMissingTargetBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %5 "main" ; Target never defined +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("main")); +} + +TEST_F(ValidateSSA, ForwardMemberNameGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpMemberName %struct 0 "value" + OpMemberName %struct 1 "size" +%intt = OpTypeInt 32 1 +%uintt = OpTypeInt 32 0 +%struct = OpTypeStruct %intt %uintt +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardMemberNameMissingTargetBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpMemberName %struct 0 "value" + OpMemberName %bad 1 "size" ; Target is not defined +%intt = OpTypeInt 32 1 +%uintt = OpTypeInt 32 0 +%struct = OpTypeStruct %intt %uintt +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("size")); +} + +TEST_F(ValidateSSA, ForwardDecorateGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %var Restrict +%intt = OpTypeInt 32 1 +%ptrt = OpTypePointer UniformConstant %intt +%var = OpVariable %ptrt UniformConstant +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardDecorateInvalidIDBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" + OpDecorate %missing Restrict ;Missing ID +%voidt = OpTypeVoid +%intt = OpTypeInt 32 1 +%ptrt = OpTypePointer UniformConstant %intt +%var = OpVariable %ptrt UniformConstant +%2 = OpTypeFunction %voidt +%3 = OpFunction %voidt None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, ForwardMemberDecorateGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpMemberDecorate %struct 1 RowMajor +%intt = OpTypeInt 32 1 +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 3 +%struct = OpTypeStruct %intt %mat33 +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardMemberDecorateInvalidIdBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" + OpMemberDecorate %missing 1 RowMajor ; Target not defined +%intt = OpTypeInt 32 1 +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%mat33 = OpTypeMatrix %vec3 3 +%struct = OpTypeStruct %intt %mat33 +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, ForwardGroupDecorateGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpDecorate %dgrp RowMajor +%dgrp = OpDecorationGroup + OpGroupDecorate %dgrp %mat33 %mat44 +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%vec4 = OpTypeVector %f32 4 +%mat33 = OpTypeMatrix %vec3 3 +%mat44 = OpTypeMatrix %vec4 4 +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardGroupDecorateMissingGroupBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" + OpDecorate %dgrp RowMajor +%dgrp = OpDecorationGroup + OpGroupDecorate %missing %mat33 %mat44 ; Target not defined +%intt = OpTypeInt 32 1 +%vec3 = OpTypeVector %intt 3 +%vec4 = OpTypeVector %intt 4 +%mat33 = OpTypeMatrix %vec3 3 +%mat44 = OpTypeMatrix %vec4 4 +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, ForwardGroupDecorateMissingTargetBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" + OpDecorate %dgrp RowMajor +%dgrp = OpDecorationGroup + OpGroupDecorate %dgrp %missing %mat44 ; Target not defined +%f32 = OpTypeFloat 32 +%vec3 = OpTypeVector %f32 3 +%vec4 = OpTypeVector %f32 4 +%mat33 = OpTypeMatrix %vec3 3 +%mat44 = OpTypeMatrix %vec4 4 +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, ForwardGroupDecorateDecorationGroupDominateBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %dgrp "group" + OpDecorate %dgrp RowMajor + OpGroupDecorate %dgrp %mat33 %mat44 ; Decoration group does not dominate usage +%dgrp = OpDecorationGroup +%intt = OpTypeInt 32 1 +%vec3 = OpTypeVector %intt 3 +%vec4 = OpTypeVector %intt 4 +%mat33 = OpTypeMatrix %vec3 3 +%mat44 = OpTypeMatrix %vec4 4 +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("group")); +} + +TEST_F(ValidateSSA, ForwardDecorateInvalidIdBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" + OpDecorate %missing Restrict ; Missing target +%voidt = OpTypeVoid +%intt = OpTypeInt 32 1 +%ptrt = OpTypePointer UniformConstant %intt +%var = OpVariable %ptrt UniformConstant +%2 = OpTypeFunction %voidt +%3 = OpFunction %voidt None %2 +%4 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, FunctionCallGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 1 +%3 = OpTypeInt 32 0 +%4 = OpTypeFunction %1 +%8 = OpTypeFunction %1 %2 %3 +%four = OpConstant %2 4 +%five = OpConstant %3 5 +%9 = OpFunction %1 None %8 +%10 = OpFunctionParameter %2 +%11 = OpFunctionParameter %3 +%12 = OpLabel + OpReturn + OpFunctionEnd +%5 = OpFunction %1 None %4 +%6 = OpLabel +%7 = OpFunctionCall %1 %9 %four %five + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardFunctionCallGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%1 = OpTypeVoid +%2 = OpTypeInt 32 1 +%3 = OpTypeInt 32 0 +%four = OpConstant %2 4 +%five = OpConstant %3 5 +%8 = OpTypeFunction %1 %2 %3 +%4 = OpTypeFunction %1 +%5 = OpFunction %1 None %4 +%6 = OpLabel +%7 = OpFunctionCall %1 %9 %four %five + OpReturn + OpFunctionEnd +%9 = OpFunction %1 None %8 +%10 = OpFunctionParameter %2 +%11 = OpFunctionParameter %3 +%12 = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardBranchConditionalGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%voidt = OpTypeVoid +%boolt = OpTypeBool +%vfunct = OpTypeFunction %voidt +%true = OpConstantTrue %boolt +%main = OpFunction %voidt None %vfunct +%mainl = OpLabel + OpSelectionMerge %endl None + OpBranchConditional %true %truel %falsel +%truel = OpLabel + OpNop + OpBranch %endl +%falsel = OpLabel + OpNop + OpBranch %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardBranchConditionalWithWeightsGood) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%voidt = OpTypeVoid +%boolt = OpTypeBool +%vfunct = OpTypeFunction %voidt +%true = OpConstantTrue %boolt +%main = OpFunction %voidt None %vfunct +%mainl = OpLabel + OpSelectionMerge %endl None + OpBranchConditional %true %truel %falsel 1 9 +%truel = OpLabel + OpNop + OpBranch %endl +%falsel = OpLabel + OpNop + OpBranch %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardBranchConditionalNonDominantConditionBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %tcpy "conditional" +%voidt = OpTypeVoid +%boolt = OpTypeBool +%vfunct = OpTypeFunction %voidt +%true = OpConstantTrue %boolt +%main = OpFunction %voidt None %vfunct +%mainl = OpLabel + OpSelectionMerge %endl None + OpBranchConditional %tcpy %truel %falsel ; +%truel = OpLabel + OpNop + OpBranch %endl +%falsel = OpLabel + OpNop + OpBranch %endl +%endl = OpLabel +%tcpy = OpCopyObject %boolt %true + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("conditional")); +} + +TEST_F(ValidateSSA, ForwardBranchConditionalMissingTargetBad) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + OpName %missing "missing" +%voidt = OpTypeVoid +%boolt = OpTypeBool +%vfunct = OpTypeFunction %voidt +%true = OpConstantTrue %boolt +%main = OpFunction %voidt None %vfunct +%mainl = OpLabel + OpSelectionMerge %endl None + OpBranchConditional %true %missing %falsel +%truel = OpLabel + OpNop + OpBranch %endl +%falsel = OpLabel + OpNop + OpBranch %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +// Since Int8 requires the Kernel capability, the signedness of int types may +// not be "1". +const std::string kHeader = R"( +OpCapability Int8 +OpCapability DeviceEnqueue +OpCapability Linkage +OpMemoryModel Logical OpenCL +)"; + +const std::string kBasicTypes = R"( +%voidt = OpTypeVoid +%boolt = OpTypeBool +%int8t = OpTypeInt 8 0 +%uintt = OpTypeInt 32 0 +%vfunct = OpTypeFunction %voidt +%intptrt = OpTypePointer UniformConstant %uintt +%zero = OpConstant %uintt 0 +%one = OpConstant %uintt 1 +%ten = OpConstant %uintt 10 +%false = OpConstantFalse %boolt +)"; + +const std::string kKernelTypesAndConstants = R"( +%queuet = OpTypeQueue + +%three = OpConstant %uintt 3 +%arr3t = OpTypeArray %uintt %three +%ndt = OpTypeStruct %uintt %arr3t %arr3t %arr3t + +%eventt = OpTypeEvent + +%offset = OpConstant %uintt 0 +%local = OpConstant %uintt 1 +%gl = OpConstant %uintt 1 + +%nevent = OpConstant %uintt 0 +%event = OpConstantNull %eventt + +%firstp = OpConstant %int8t 0 +%psize = OpConstant %uintt 0 +%palign = OpConstant %uintt 32 +%lsize = OpConstant %uintt 1 +%flags = OpConstant %uintt 0 ; NoWait + +%kfunct = OpTypeFunction %voidt %intptrt +)"; + +const std::string kKernelSetup = R"( +%dqueue = OpGetDefaultQueue %queuet +%ndval = OpBuildNDRange %ndt %gl %local %offset +%revent = OpUndef %eventt + +)"; + +const std::string kKernelDefinition = R"( +%kfunc = OpFunction %voidt None %kfunct +%iparam = OpFunctionParameter %intptrt +%kfuncl = OpLabel + OpNop + OpReturn + OpFunctionEnd +)"; + +TEST_F(ValidateSSA, EnqueueKernelGood) { + std::string str = kHeader + kBasicTypes + kKernelTypesAndConstants + + kKernelDefinition + R"( + %main = OpFunction %voidt None %vfunct + %mainl = OpLabel + )" + kKernelSetup + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp %psize + %palign %lsize + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelGood) { + std::string str = kHeader + kBasicTypes + kKernelTypesAndConstants + R"( + %main = OpFunction %voidt None %vfunct + %mainl = OpLabel + )" + + kKernelSetup + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp %psize + %palign %lsize + OpReturn + OpFunctionEnd + )" + kKernelDefinition; + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, EnqueueMissingFunctionBad) { + std::string str = kHeader + "OpName %kfunc \"kfunc\"" + kBasicTypes + + kKernelTypesAndConstants + R"( + %main = OpFunction %voidt None %vfunct + %mainl = OpLabel + )" + kKernelSetup + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp %psize + %palign %lsize + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("kfunc")); +} + +std::string forwardKernelNonDominantParameterBaseCode( + std::string name = std::string()) { + std::string op_name; + if (name.empty()) { + op_name = ""; + } else { + op_name = "\nOpName %" + name + " \"" + name + "\"\n"; + } + std::string out = kHeader + op_name + kBasicTypes + kKernelTypesAndConstants + + kKernelDefinition + + R"( + %main = OpFunction %voidt None %vfunct + %mainl = OpLabel + )" + kKernelSetup; + return out; +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelMissingParameter1Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("missing") + R"( + %err = OpEnqueueKernel %missing %dqueue %flags %ndval + %nevent %event %revent %kfunc %firstp + %psize %palign %lsize + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter2Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("dqueue2") + R"( + %err = OpEnqueueKernel %uintt %dqueue2 %flags %ndval + %nevent %event %revent %kfunc + %firstp %psize %palign %lsize + %dqueue2 = OpGetDefaultQueue %queuet + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("dqueue2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter3Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("ndval2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval2 + %nevent %event %revent %kfunc %firstp + %psize %palign %lsize + %ndval2 = OpBuildNDRange %ndt %gl %local %offset + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ndval2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter4Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("nevent2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent2 + %event %revent %kfunc %firstp %psize + %palign %lsize + %nevent2 = OpCopyObject %uintt %nevent + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("nevent2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter5Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("event2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event2 %revent %kfunc %firstp %psize + %palign %lsize + %event2 = OpCopyObject %eventt %event + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("event2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter6Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("revent2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent2 %kfunc %firstp %psize + %palign %lsize + %revent2 = OpCopyObject %eventt %revent + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("revent2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter8Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("firstp2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp2 %psize + %palign %lsize + %firstp2 = OpCopyObject %int8t %firstp + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("firstp2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter9Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("psize2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp %psize2 + %palign %lsize + %psize2 = OpCopyObject %uintt %psize + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("psize2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter10Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("palign2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp %psize + %palign2 %lsize + %palign2 = OpCopyObject %uintt %palign + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("palign2")); +} + +TEST_F(ValidateSSA, ForwardEnqueueKernelNonDominantParameter11Bad) { + std::string str = forwardKernelNonDominantParameterBaseCode("lsize2") + R"( + %err = OpEnqueueKernel %uintt %dqueue %flags %ndval %nevent + %event %revent %kfunc %firstp %psize + %palign %lsize2 + %lsize2 = OpCopyObject %uintt %lsize + OpReturn + OpFunctionEnd + )"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("lsize2")); +} + +static const bool kWithNDrange = true; +static const bool kNoNDrange = false; +std::pair cases[] = { + {"OpGetKernelNDrangeSubGroupCount", kWithNDrange}, + {"OpGetKernelNDrangeMaxSubGroupSize", kWithNDrange}, + {"OpGetKernelWorkGroupSize", kNoNDrange}, + {"OpGetKernelPreferredWorkGroupSizeMultiple", kNoNDrange}}; + +INSTANTIATE_TEST_CASE_P(KernelArgs, ValidateSSA, ::testing::ValuesIn(cases), ); + +static const std::string return_instructions = R"( + OpReturn + OpFunctionEnd +)"; + +TEST_P(ValidateSSA, GetKernelGood) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode() + " %numsg = " + << instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize %palign" + << return_instructions; + // clang-format on + + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateSSA, ForwardGetKernelGood) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + // clang-format off + std::string str = kHeader + kBasicTypes + kKernelTypesAndConstants + + R"( + %main = OpFunction %voidt None %vfunct + %mainl = OpLabel + )" + + kKernelSetup + " %numsg = " + + instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize %palign" + + return_instructions + kKernelDefinition; + // clang-format on + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_P(ValidateSSA, ForwardGetKernelMissingDefinitionBad) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode("missing") + " %numsg = " + << instruction + " %uintt" + ndrange_param + "%missing %firstp %psize %palign" + << return_instructions; + // clang-format on + + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_P(ValidateSSA, ForwardGetKernelNDrangeSubGroupCountMissingParameter1Bad) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode("missing") + " %numsg = " + << instruction + " %missing" + ndrange_param + "%kfunc %firstp %psize %palign" + << return_instructions; + // clang-format on + + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_P(ValidateSSA, + ForwardGetKernelNDrangeSubGroupCountNonDominantParameter2Bad) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval2 " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode("ndval2") + " %numsg = " + << instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize %palign" + << "\n %ndval2 = OpBuildNDRange %ndt %gl %local %offset" + << return_instructions; + // clang-format on + + if (GetParam().second) { + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("ndval2")); + } +} + +TEST_P(ValidateSSA, + ForwardGetKernelNDrangeSubGroupCountNonDominantParameter4Bad) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode("firstp2") + " %numsg = " + << instruction + " %uintt" + ndrange_param + "%kfunc %firstp2 %psize %palign" + << "\n %firstp2 = OpCopyObject %int8t %firstp" + << return_instructions; + // clang-format on + + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("firstp2")); +} + +TEST_P(ValidateSSA, + ForwardGetKernelNDrangeSubGroupCountNonDominantParameter5Bad) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode("psize2") + " %numsg = " + << instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize2 %palign" + << "\n %psize2 = OpCopyObject %uintt %psize" + << return_instructions; + // clang-format on + + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("psize2")); +} + +TEST_P(ValidateSSA, + ForwardGetKernelNDrangeSubGroupCountNonDominantParameter6Bad) { + std::string instruction = GetParam().first; + bool with_ndrange = GetParam().second; + std::string ndrange_param = with_ndrange ? " %ndval " : " "; + + std::stringstream ss; + // clang-format off + ss << forwardKernelNonDominantParameterBaseCode("palign2") + " %numsg = " + << instruction + " %uintt" + ndrange_param + "%kfunc %firstp %psize %palign2" + << "\n %palign2 = OpCopyObject %uintt %palign" + << return_instructions; + // clang-format on + + if (GetParam().second) { + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("palign2")); + } +} + +TEST_F(ValidateSSA, PhiGood) { + std::string str = kHeader + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%preheader = OpLabel +%init = OpCopyObject %uintt %zero + OpBranch %loop +%loop = OpLabel +%i = OpPhi %uintt %init %preheader %loopi %loop +%loopi = OpIAdd %uintt %i %one + OpNop +%cond = OpSLessThan %boolt %i %ten + OpLoopMerge %endl %loop None + OpBranchConditional %cond %loop %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, PhiMissingTypeBad) { + std::string str = kHeader + "OpName %missing \"missing\"" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%preheader = OpLabel +%init = OpCopyObject %uintt %zero + OpBranch %loop +%loop = OpLabel +%i = OpPhi %missing %init %preheader %loopi %loop +%loopi = OpIAdd %uintt %i %one + OpNop +%cond = OpSLessThan %boolt %i %ten + OpLoopMerge %endl %loop None + OpBranchConditional %cond %loop %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, PhiMissingIdBad) { + std::string str = kHeader + "OpName %missing \"missing\"" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%preheader = OpLabel +%init = OpCopyObject %uintt %zero + OpBranch %loop +%loop = OpLabel +%i = OpPhi %uintt %missing %preheader %loopi %loop +%loopi = OpIAdd %uintt %i %one + OpNop +%cond = OpSLessThan %boolt %i %ten + OpLoopMerge %endl %loop None + OpBranchConditional %cond %loop %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, PhiMissingLabelBad) { + std::string str = kHeader + "OpName %missing \"missing\"" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%preheader = OpLabel +%init = OpCopyObject %uintt %zero + OpBranch %loop +%loop = OpLabel +%i = OpPhi %uintt %init %missing %loopi %loop +%loopi = OpIAdd %uintt %i %one + OpNop +%cond = OpSLessThan %boolt %i %ten + OpLoopMerge %endl %loop None + OpBranchConditional %cond %loop %endl +%endl = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr("missing")); +} + +TEST_F(ValidateSSA, IdDominatesItsUseGood) { + std::string str = kHeader + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel +%cond = OpSLessThan %boolt %one %ten +%eleven = OpIAdd %uintt %one %ten + OpSelectionMerge %merge None + OpBranchConditional %cond %t %f +%t = OpLabel +%twelve = OpIAdd %uintt %eleven %one + OpBranch %merge +%f = OpLabel +%twentytwo = OpIAdd %uintt %eleven %ten + OpBranch %merge +%merge = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, IdDoesNotDominateItsUseBad) { + std::string str = kHeader + + "OpName %eleven \"eleven\"\n" + "OpName %true_block \"true_block\"\n" + "OpName %false_block \"false_block\"" + + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel +%cond = OpSLessThan %boolt %one %ten + OpSelectionMerge %merge None + OpBranchConditional %cond %true_block %false_block +%true_block = OpLabel +%eleven = OpIAdd %uintt %one %ten +%twelve = OpIAdd %uintt %eleven %one + OpBranch %merge +%false_block = OpLabel +%twentytwo = OpIAdd %uintt %eleven %ten + OpBranch %merge +%merge = OpLabel + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("ID .\\[eleven\\] defined in block .\\[true_block\\] does " + "not dominate its use in block .\\[false_block\\]\n" + " %false_block = OpLabel\n")); +} + +TEST_F(ValidateSSA, PhiUseDoesntDominateDefinitionGood) { + std::string str = kHeader + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel +%var_one = OpVariable %intptrt Function %one +%one_val = OpLoad %uintt %var_one + OpBranch %loop +%loop = OpLabel +%i = OpPhi %uintt %one_val %entry %inew %cont +%cond = OpSLessThan %boolt %one %ten + OpLoopMerge %merge %cont None + OpBranchConditional %cond %body %merge +%body = OpLabel + OpBranch %cont +%cont = OpLabel +%inew = OpIAdd %uintt %i %one + OpBranch %loop +%merge = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, + PhiUseDoesntDominateUseOfPhiOperandUsedBeforeDefinitionBad) { + std::string str = kHeader + "OpName %inew \"inew\"" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel +%var_one = OpVariable %intptrt Function %one +%one_val = OpLoad %uintt %var_one + OpBranch %loop +%loop = OpLabel +%i = OpPhi %uintt %one_val %entry %inew %cont +%bad = OpIAdd %uintt %inew %one +%cond = OpSLessThan %boolt %one %ten + OpLoopMerge %merge %cont None + OpBranchConditional %cond %body %merge +%body = OpLabel + OpBranch %cont +%cont = OpLabel +%inew = OpIAdd %uintt %i %one + OpBranch %loop +%merge = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + MatchesRegex("ID .\\[inew\\] has not been defined\n" + " %19 = OpIAdd %uint %inew %uint_1\n")); +} + +TEST_F(ValidateSSA, PhiUseMayComeFromNonDominatingBlockGood) { + std::string str = kHeader + "OpName %if_true \"if_true\"\n" + + "OpName %exit \"exit\"\n" + "OpName %copy \"copy\"\n" + + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel + OpBranchConditional %false %if_true %exit + +%if_true = OpLabel +%copy = OpCopyObject %boolt %false + OpBranch %exit + +; The use of %copy here is ok, even though it was defined +; in a block that does not dominate %exit. That's the point +; of an OpPhi. +%exit = OpLabel +%value = OpPhi %boolt %false %entry %copy %if_true + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateSSA, PhiUsesItsOwnDefinitionGood) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/415 + // + // Non-phi instructions can't use their own definitions, as + // already checked in test DominateUsageSameInstructionBad. + std::string str = kHeader + "OpName %loop \"loop\"\n" + + "OpName %value \"value\"\n" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel + OpBranch %loop + +%loop = OpLabel +%value = OpPhi %boolt %false %entry %value %loop + OpBranch %loop + + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateSSA, PhiVariableDefNotDominatedByParentBlockBad) { + std::string str = kHeader + "OpName %if_true \"if_true\"\n" + + "OpName %if_false \"if_false\"\n" + + "OpName %exit \"exit\"\n" + "OpName %value \"phi\"\n" + + "OpName %true_copy \"true_copy\"\n" + + "OpName %false_copy \"false_copy\"\n" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel + OpBranchConditional %false %if_true %if_false + +%if_true = OpLabel +%true_copy = OpCopyObject %boolt %false + OpBranch %exit + +%if_false = OpLabel +%false_copy = OpCopyObject %boolt %false + OpBranch %exit + +; The (variable,Id) pairs are swapped. +%exit = OpLabel +%value = OpPhi %boolt %true_copy %if_false %false_copy %if_true + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("In OpPhi instruction .\\[phi\\], ID .\\[true_copy\\] " + "definition does not dominate its parent .\\[if_false\\]\n" + " %phi = OpPhi %bool %true_copy %if_false %false_copy " + "%if_true\n")); +} + +TEST_F(ValidateSSA, PhiVariableDefDominatesButNotDefinedInParentBlock) { + std::string str = kHeader + "OpName %if_true \"if_true\"\n" + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel + OpBranchConditional %false %if_true %if_false + +%if_true = OpLabel +%true_copy = OpCopyObject %boolt %false + OpBranch %if_tnext +%if_tnext = OpLabel + OpBranch %exit + +%if_false = OpLabel +%false_copy = OpCopyObject %boolt %false + OpBranch %if_fnext +%if_fnext = OpLabel + OpBranch %exit + +%exit = OpLabel +%value = OpPhi %boolt %true_copy %if_tnext %false_copy %if_fnext + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, + DominanceCheckIgnoresUsesInUnreachableBlocksDefInBlockGood) { + std::string str = kHeader + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel +%def = OpCopyObject %boolt %false + OpReturn + +%unreach = OpLabel +%use = OpCopyObject %boolt %def + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateSSA, PhiVariableUnreachableDefNotInParentBlock) { + std::string str = kHeader + "OpName %unreachable \"unreachable\"\n" + + kBasicTypes + + R"( +%func = OpFunction %voidt None %vfunct +%entry = OpLabel + OpBranch %if_false + +%unreachable = OpLabel +%copy = OpCopyObject %boolt %false + OpBranch %if_tnext +%if_tnext = OpLabel + OpBranch %exit + +%if_false = OpLabel +%false_copy = OpCopyObject %boolt %false + OpBranch %if_fnext +%if_fnext = OpLabel + OpBranch %exit + +%exit = OpLabel +%value = OpPhi %boolt %copy %if_tnext %false_copy %if_fnext + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, + DominanceCheckIgnoresUsesInUnreachableBlocksDefIsParamGood) { + std::string str = kHeader + kBasicTypes + + R"( +%void_fn_int = OpTypeFunction %voidt %uintt +%func = OpFunction %voidt None %void_fn_int +%int_param = OpFunctionParameter %uintt +%entry = OpLabel + OpReturn + +%unreach = OpLabel +%use = OpCopyObject %uintt %int_param + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); +} + +TEST_F(ValidateSSA, UseFunctionParameterFromOtherFunctionBad) { + std::string str = kHeader + + "OpName %first \"first\"\n" + "OpName %func \"func\"\n" + + "OpName %func2 \"func2\"\n" + kBasicTypes + + R"( +%viifunct = OpTypeFunction %voidt %uintt %uintt +%func = OpFunction %voidt None %viifunct +%first = OpFunctionParameter %uintt +%second = OpFunctionParameter %uintt + OpFunctionEnd +%func2 = OpFunction %voidt None %viifunct +%first2 = OpFunctionParameter %uintt +%second2 = OpFunctionParameter %uintt +%entry2 = OpLabel +%baduse = OpIAdd %uintt %first %first2 + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + MatchesRegex("ID .\\[first\\] used in function .\\[func2\\] is used " + "outside of it's defining function .\\[func\\]\n" + " %func = OpFunction %void None %14\n")); +} + +TEST_F(ValidateSSA, TypeForwardPointerForwardReference) { + // See https://github.com/KhronosGroup/SPIRV-Tools/issues/429 + // + // ForwardPointers can references instructions that have not been defined + std::string str = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpMemoryModel Logical OpenCL + OpName %intptrt "intptrt" + OpTypeForwardPointer %intptrt UniformConstant + %uint = OpTypeInt 32 0 + %intptrt = OpTypePointer UniformConstant %uint +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateSSA, TypeStructForwardReference) { + std::string str = R"( + OpCapability Kernel + OpCapability Addresses + OpCapability Linkage + OpMemoryModel Logical OpenCL + OpName %structptr "structptr" + OpTypeForwardPointer %structptr UniformConstant + %uint = OpTypeInt 32 0 + %structt1 = OpTypeStruct %structptr %uint + %structt2 = OpTypeStruct %uint %structptr + %structt3 = OpTypeStruct %uint %uint %structptr + %structt4 = OpTypeStruct %uint %uint %uint %structptr + %structptr = OpTypePointer UniformConstant %structt1 +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// TODO(umar): OpGroupMemberDecorate + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_state_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_state_test.cpp new file mode 100644 index 00000000000..699b224ad0e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_state_test.cpp @@ -0,0 +1,139 @@ +// Copyright (c) 2015-2016 The Khronos Group Inc. +// Copyright (c) 2016 Google 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. + +// Unit tests for ValidationState_t. + +#include + +#include "gtest/gtest.h" +#include "source/latest_version_spirv_header.h" + +#include "source/enum_set.h" +#include "source/extensions.h" +#include "source/spirv_validator_options.h" +#include "source/val/construct.h" +#include "source/val/function.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" + +namespace spvtools { +namespace val { +namespace { + +// This is all we need for these tests. +static uint32_t kFakeBinary[] = {0}; + +// A test with a ValidationState_t member transparently. +class ValidationStateTest : public testing::Test { + public: + ValidationStateTest() + : context_(spvContextCreate(SPV_ENV_UNIVERSAL_1_0)), + options_(spvValidatorOptionsCreate()), + state_(context_, options_, kFakeBinary, 0) {} + + ~ValidationStateTest() { + spvContextDestroy(context_); + spvValidatorOptionsDestroy(options_); + } + + protected: + spv_context context_; + spv_validator_options options_; + ValidationState_t state_; +}; + +// A test of ValidationState_t::HasAnyOfCapabilities(). +using ValidationState_HasAnyOfCapabilities = ValidationStateTest; + +TEST_F(ValidationState_HasAnyOfCapabilities, EmptyMask) { + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); + state_.RegisterCapability(SpvCapabilityMatrix); + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); + state_.RegisterCapability(SpvCapabilityImageMipmap); + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); + state_.RegisterCapability(SpvCapabilityPipes); + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); + state_.RegisterCapability(SpvCapabilityStorageImageArrayDynamicIndexing); + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); + state_.RegisterCapability(SpvCapabilityClipDistance); + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); + state_.RegisterCapability(SpvCapabilityStorageImageWriteWithoutFormat); + EXPECT_TRUE(state_.HasAnyOfCapabilities({})); +} + +TEST_F(ValidationState_HasAnyOfCapabilities, SingleCapMask) { + EXPECT_FALSE(state_.HasAnyOfCapabilities({SpvCapabilityMatrix})); + EXPECT_FALSE(state_.HasAnyOfCapabilities({SpvCapabilityImageMipmap})); + state_.RegisterCapability(SpvCapabilityMatrix); + EXPECT_TRUE(state_.HasAnyOfCapabilities({SpvCapabilityMatrix})); + EXPECT_FALSE(state_.HasAnyOfCapabilities({SpvCapabilityImageMipmap})); + state_.RegisterCapability(SpvCapabilityImageMipmap); + EXPECT_TRUE(state_.HasAnyOfCapabilities({SpvCapabilityMatrix})); + EXPECT_TRUE(state_.HasAnyOfCapabilities({SpvCapabilityImageMipmap})); +} + +TEST_F(ValidationState_HasAnyOfCapabilities, MultiCapMask) { + const auto set1 = + CapabilitySet{SpvCapabilitySampledRect, SpvCapabilityImageBuffer}; + const auto set2 = CapabilitySet{SpvCapabilityStorageImageWriteWithoutFormat, + SpvCapabilityStorageImageReadWithoutFormat, + SpvCapabilityGeometryStreams}; + EXPECT_FALSE(state_.HasAnyOfCapabilities(set1)); + EXPECT_FALSE(state_.HasAnyOfCapabilities(set2)); + state_.RegisterCapability(SpvCapabilityImageBuffer); + EXPECT_TRUE(state_.HasAnyOfCapabilities(set1)); + EXPECT_FALSE(state_.HasAnyOfCapabilities(set2)); +} + +// A test of ValidationState_t::HasAnyOfExtensions(). +using ValidationState_HasAnyOfExtensions = ValidationStateTest; + +TEST_F(ValidationState_HasAnyOfExtensions, EmptyMask) { + EXPECT_TRUE(state_.HasAnyOfExtensions({})); + state_.RegisterExtension(Extension::kSPV_KHR_shader_ballot); + EXPECT_TRUE(state_.HasAnyOfExtensions({})); + state_.RegisterExtension(Extension::kSPV_KHR_16bit_storage); + EXPECT_TRUE(state_.HasAnyOfExtensions({})); + state_.RegisterExtension(Extension::kSPV_NV_viewport_array2); + EXPECT_TRUE(state_.HasAnyOfExtensions({})); +} + +TEST_F(ValidationState_HasAnyOfExtensions, SingleCapMask) { + EXPECT_FALSE(state_.HasAnyOfExtensions({Extension::kSPV_KHR_shader_ballot})); + EXPECT_FALSE(state_.HasAnyOfExtensions({Extension::kSPV_KHR_16bit_storage})); + state_.RegisterExtension(Extension::kSPV_KHR_shader_ballot); + EXPECT_TRUE(state_.HasAnyOfExtensions({Extension::kSPV_KHR_shader_ballot})); + EXPECT_FALSE(state_.HasAnyOfExtensions({Extension::kSPV_KHR_16bit_storage})); + state_.RegisterExtension(Extension::kSPV_KHR_16bit_storage); + EXPECT_TRUE(state_.HasAnyOfExtensions({Extension::kSPV_KHR_shader_ballot})); + EXPECT_TRUE(state_.HasAnyOfExtensions({Extension::kSPV_KHR_16bit_storage})); +} + +TEST_F(ValidationState_HasAnyOfExtensions, MultiCapMask) { + const auto set1 = ExtensionSet{Extension::kSPV_KHR_multiview, + Extension::kSPV_KHR_16bit_storage}; + const auto set2 = ExtensionSet{Extension::kSPV_KHR_shader_draw_parameters, + Extension::kSPV_NV_stereo_view_rendering, + Extension::kSPV_KHR_shader_ballot}; + EXPECT_FALSE(state_.HasAnyOfExtensions(set1)); + EXPECT_FALSE(state_.HasAnyOfExtensions(set2)); + state_.RegisterExtension(Extension::kSPV_KHR_multiview); + EXPECT_TRUE(state_.HasAnyOfExtensions(set1)); + EXPECT_FALSE(state_.HasAnyOfExtensions(set2)); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_storage_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_storage_test.cpp new file mode 100644 index 00000000000..46b3ddcbb5a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_storage_test.cpp @@ -0,0 +1,182 @@ +// Copyright (c) 2015-2016 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. + +// Validation tests for OpVariable storage class + +#include +#include +#include + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ValidateStorage = spvtest::ValidateBase; + +TEST_F(ValidateStorage, FunctionStorageInsideFunction) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%intt = OpTypeInt 32 1 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%ptrt = OpTypePointer Function %intt +%func = OpFunction %voidt None %vfunct +%funcl = OpLabel +%var = OpVariable %ptrt Function + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateStorage, FunctionStorageOutsideFunction) { + char str[] = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%intt = OpTypeInt 32 1 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%ptrt = OpTypePointer Function %intt +%var = OpVariable %ptrt Function +%func = OpFunction %voidt None %vfunct +%funcl = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Variables can not have a function[7] storage class " + "outside of a function")); +} + +TEST_F(ValidateStorage, OtherStorageOutsideFunction) { + char str[] = R"( + OpCapability Shader + OpCapability Kernel + OpCapability AtomicStorage + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%intt = OpTypeInt 32 0 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%ptrt = OpTypePointer Function %intt +%unicon = OpVariable %ptrt UniformConstant +%input = OpVariable %ptrt Input +%unif = OpVariable %ptrt Uniform +%output = OpVariable %ptrt Output +%wgroup = OpVariable %ptrt Workgroup +%xwgrp = OpVariable %ptrt CrossWorkgroup +%priv = OpVariable %ptrt Private +%pushco = OpVariable %ptrt PushConstant +%atomct = OpVariable %ptrt AtomicCounter +%image = OpVariable %ptrt Image +%func = OpFunction %voidt None %vfunct +%funcl = OpLabel + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(str); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +// clang-format off +TEST_P(ValidateStorage, OtherStorageInsideFunction) { + std::stringstream ss; + ss << R"( + OpCapability Shader + OpCapability Kernel + OpCapability AtomicStorage + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%intt = OpTypeInt 32 0 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%ptrt = OpTypePointer Function %intt +%func = OpFunction %voidt None %vfunct +%funcl = OpLabel +%var = OpVariable %ptrt )" << GetParam() << R"( + OpReturn + OpFunctionEnd +)"; + + CompileSuccessfully(ss.str()); + ASSERT_EQ(SPV_ERROR_INVALID_LAYOUT, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr( + "Variables must have a function[7] storage class inside of a function")); +} + +INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateStorage, + ::testing::Values( + "Input", + "Uniform", + "Output", + "Workgroup", + "CrossWorkgroup", + "Private", + "PushConstant", + "AtomicCounter", + "Image"),); +// clang-format on + +TEST_F(ValidateStorage, GenericVariableOutsideFunction) { + const auto str = R"( + OpCapability Kernel + OpCapability Linkage + OpMemoryModel Logical OpenCL +%intt = OpTypeInt 32 0 +%ptrt = OpTypePointer Function %intt +%var = OpVariable %ptrt Generic +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpVariable storage class cannot be Generic")); +} + +TEST_F(ValidateStorage, GenericVariableInsideFunction) { + const auto str = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 +%intt = OpTypeInt 32 1 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%ptrt = OpTypePointer Function %intt +%func = OpFunction %voidt None %vfunct +%funcl = OpLabel +%var = OpVariable %ptrt Generic + OpReturn + OpFunctionEnd +)"; + CompileSuccessfully(str); + ASSERT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("OpVariable storage class cannot be Generic")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_type_unique_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_type_unique_test.cpp new file mode 100644 index 00000000000..67ceaddb86f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_type_unique_test.cpp @@ -0,0 +1,269 @@ +// Copyright (c) 2017 Google 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. + +// Tests for unique type declaration rules validator. + +#include + +#include "gmock/gmock.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; +using ::testing::Not; + +using ValidateTypeUnique = spvtest::ValidateBase; + +const spv_result_t kDuplicateTypeError = SPV_ERROR_INVALID_DATA; + +const std::string& GetHeader() { + static const std::string header = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%floatt = OpTypeFloat 32 +%vec2t = OpTypeVector %floatt 2 +%vec3t = OpTypeVector %floatt 3 +%vec4t = OpTypeVector %floatt 4 +%mat22t = OpTypeMatrix %vec2t 2 +%mat33t = OpTypeMatrix %vec3t 3 +%mat44t = OpTypeMatrix %vec4t 4 +%intt = OpTypeInt 32 1 +%uintt = OpTypeInt 32 0 +%num3 = OpConstant %uintt 3 +%const3 = OpConstant %uintt 3 +%val3 = OpConstant %uintt 3 +%array = OpTypeArray %vec3t %num3 +%struct = OpTypeStruct %floatt %floatt %vec3t +%boolt = OpTypeBool +%array2 = OpTypeArray %vec3t %num3 +%voidt = OpTypeVoid +%vfunct = OpTypeFunction %voidt +%struct2 = OpTypeStruct %floatt %floatt %vec3t +%false = OpConstantFalse %boolt +%true = OpConstantTrue %boolt +%runtime_arrayt = OpTypeRuntimeArray %floatt +%runtime_arrayt2 = OpTypeRuntimeArray %floatt +)"; + + return header; +} + +const std::string& GetBody() { + static const std::string body = R"( +%main = OpFunction %voidt None %vfunct +%mainl = OpLabel +%a = OpIAdd %uintt %const3 %val3 +%b = OpIAdd %uintt %const3 %val3 +OpSelectionMerge %endl None +OpBranchConditional %true %truel %falsel +%truel = OpLabel +%add1 = OpIAdd %uintt %a %b +%add2 = OpIAdd %uintt %a %b +OpBranch %endl +%falsel = OpLabel +%sub1 = OpISub %uintt %a %b +%sub2 = OpISub %uintt %a %b +OpBranch %endl +%endl = OpLabel +OpReturn +OpFunctionEnd +)"; + + return body; +} + +// Returns expected error string if |opcode| produces a duplicate type +// declaration. +std::string GetErrorString(SpvOp opcode) { + return "Duplicate non-aggregate type declarations are not allowed. Opcode: " + + std::string(spvOpcodeString(opcode)); +} + +TEST_F(ValidateTypeUnique, success) { + std::string str = GetHeader() + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateTypeUnique, duplicate_void) { + std::string str = GetHeader() + R"( +%boolt2 = OpTypeVoid +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeVoid))); +} + +TEST_F(ValidateTypeUnique, duplicate_bool) { + std::string str = GetHeader() + R"( +%boolt2 = OpTypeBool +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeBool))); +} + +TEST_F(ValidateTypeUnique, duplicate_int) { + std::string str = GetHeader() + R"( +%uintt2 = OpTypeInt 32 0 +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeInt))); +} + +TEST_F(ValidateTypeUnique, duplicate_float) { + std::string str = GetHeader() + R"( +%floatt2 = OpTypeFloat 32 +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), HasSubstr(GetErrorString(SpvOpTypeFloat))); +} + +TEST_F(ValidateTypeUnique, duplicate_vec3) { + std::string str = GetHeader() + R"( +%vec3t2 = OpTypeVector %floatt 3 +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr(GetErrorString(SpvOpTypeVector))); +} + +TEST_F(ValidateTypeUnique, duplicate_mat33) { + std::string str = GetHeader() + R"( +%mat33t2 = OpTypeMatrix %vec3t 3 +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr(GetErrorString(SpvOpTypeMatrix))); +} + +TEST_F(ValidateTypeUnique, duplicate_vfunc) { + std::string str = GetHeader() + R"( +%vfunct2 = OpTypeFunction %voidt +)" + GetBody(); + CompileSuccessfully(str.c_str()); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr(GetErrorString(SpvOpTypeFunction))); +} + +TEST_F(ValidateTypeUnique, duplicate_pipe_storage) { + std::string str = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability Pipes +OpCapability PipeStorage +OpMemoryModel Physical32 OpenCL +%ps = OpTypePipeStorage +%ps2 = OpTypePipeStorage +)"; + CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr(GetErrorString(SpvOpTypePipeStorage))); +} + +TEST_F(ValidateTypeUnique, duplicate_named_barrier) { + std::string str = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability NamedBarrier +OpMemoryModel Physical32 OpenCL +%nb = OpTypeNamedBarrier +%nb2 = OpTypeNamedBarrier +)"; + CompileSuccessfully(str.c_str(), SPV_ENV_UNIVERSAL_1_1); + ASSERT_EQ(kDuplicateTypeError, ValidateInstructions(SPV_ENV_UNIVERSAL_1_1)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr(GetErrorString(SpvOpTypeNamedBarrier))); +} + +TEST_F(ValidateTypeUnique, duplicate_forward_pointer) { + std::string str = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability GenericPointer +OpCapability Linkage +OpMemoryModel Physical32 OpenCL +OpTypeForwardPointer %ptr Generic +OpTypeForwardPointer %ptr2 Generic +%intt = OpTypeInt 32 0 +%floatt = OpTypeFloat 32 +%ptr = OpTypePointer Generic %intt +%ptr2 = OpTypePointer Generic %floatt +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateTypeUnique, duplicate_void_with_extension) { + std::string str = R"( +OpCapability Addresses +OpCapability Kernel +OpCapability Linkage +OpCapability Pipes +OpExtension "SPV_VALIDATOR_ignore_type_decl_unique" +OpMemoryModel Physical32 OpenCL +%voidt = OpTypeVoid +%voidt2 = OpTypeVoid +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + Not(HasSubstr(GetErrorString(SpvOpTypeVoid)))); +} + +TEST_F(ValidateTypeUnique, DuplicatePointerTypesNoExtension) { + std::string str = R"( +OpCapability Shader +OpCapability Linkage +OpMemoryModel Logical GLSL450 +%u32 = OpTypeInt 32 0 +%ptr1 = OpTypePointer Input %u32 +%ptr2 = OpTypePointer Input %u32 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); +} + +TEST_F(ValidateTypeUnique, DuplicatePointerTypesWithExtension) { + std::string str = R"( +OpCapability Shader +OpCapability Linkage +OpExtension "SPV_KHR_variable_pointers" +OpMemoryModel Logical GLSL450 +%u32 = OpTypeInt 32 0 +%ptr1 = OpTypePointer Input %u32 +%ptr2 = OpTypePointer Input %u32 +)"; + CompileSuccessfully(str.c_str()); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + Not(HasSubstr(GetErrorString(SpvOpTypePointer)))); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_validation_state_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_validation_state_test.cpp new file mode 100644 index 00000000000..68504c52888 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_validation_state_test.cpp @@ -0,0 +1,159 @@ +// Copyright (c) 2016 Google 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. + +// Basic tests for the ValidationState_t datastructure. + +#include + +#include "gmock/gmock.h" +#include "source/spirv_validator_options.h" +#include "test/unit_spirv.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidationStateTest = spvtest::ValidateBase; + +const char header[] = + " OpCapability Shader" + " OpCapability Linkage" + " OpMemoryModel Logical GLSL450 "; + +const char kVoidFVoid[] = + " %void = OpTypeVoid" + " %void_f = OpTypeFunction %void" + " %func = OpFunction %void None %void_f" + " %label = OpLabel" + " OpReturn" + " OpFunctionEnd "; + +// Tests that the instruction count in ValidationState is correct. +TEST_F(ValidationStateTest, CheckNumInstructions) { + std::string spirv = std::string(header) + "%int = OpTypeInt 32 0"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + EXPECT_EQ(size_t(4), vstate_->ordered_instructions().size()); +} + +// Tests that the number of global variables in ValidationState is correct. +TEST_F(ValidationStateTest, CheckNumGlobalVars) { + std::string spirv = std::string(header) + R"( + %int = OpTypeInt 32 0 +%_ptr_int = OpTypePointer Input %int + %var_1 = OpVariable %_ptr_int Input + %var_2 = OpVariable %_ptr_int Input + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + EXPECT_EQ(unsigned(2), vstate_->num_global_vars()); +} + +// Tests that the number of local variables in ValidationState is correct. +TEST_F(ValidationStateTest, CheckNumLocalVars) { + std::string spirv = std::string(header) + R"( + %int = OpTypeInt 32 0 + %_ptr_int = OpTypePointer Function %int + %voidt = OpTypeVoid + %funct = OpTypeFunction %voidt + %main = OpFunction %voidt None %funct + %entry = OpLabel + %var_1 = OpVariable %_ptr_int Function + %var_2 = OpVariable %_ptr_int Function + %var_3 = OpVariable %_ptr_int Function + OpReturn + OpFunctionEnd + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + EXPECT_EQ(unsigned(3), vstate_->num_local_vars()); +} + +// Tests that the "id bound" in ValidationState is correct. +TEST_F(ValidationStateTest, CheckIdBound) { + std::string spirv = std::string(header) + R"( + %int = OpTypeInt 32 0 + %voidt = OpTypeVoid + )"; + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + EXPECT_EQ(unsigned(3), vstate_->getIdBound()); +} + +// Tests that the entry_points in ValidationState is correct. +TEST_F(ValidationStateTest, CheckEntryPoints) { + std::string spirv = std::string(header) + + " OpEntryPoint Vertex %func \"shader\"" + + std::string(kVoidFVoid); + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); + EXPECT_EQ(size_t(1), vstate_->entry_points().size()); + EXPECT_EQ(SpvOpFunction, + vstate_->FindDef(vstate_->entry_points()[0])->opcode()); +} + +TEST_F(ValidationStateTest, CheckStructMemberLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_struct_members, 32000u); + EXPECT_EQ(32000u, options_->universal_limits_.max_struct_members); +} + +TEST_F(ValidationStateTest, CheckNumGlobalVarsLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_global_variables, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_global_variables); +} + +TEST_F(ValidationStateTest, CheckNumLocalVarsLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_local_variables, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_local_variables); +} + +TEST_F(ValidationStateTest, CheckStructDepthLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_struct_depth, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_struct_depth); +} + +TEST_F(ValidationStateTest, CheckSwitchBranchesLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_switch_branches, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_switch_branches); +} + +TEST_F(ValidationStateTest, CheckFunctionArgsLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_function_args, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_function_args); +} + +TEST_F(ValidationStateTest, CheckCFGDepthLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_control_flow_nesting_depth, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_control_flow_nesting_depth); +} + +TEST_F(ValidationStateTest, CheckAccessChainIndexesLimitOption) { + spvValidatorOptionsSetUniversalLimit( + options_, spv_validator_limit_max_access_chain_indexes, 100u); + EXPECT_EQ(100u, options_->universal_limits_.max_access_chain_indexes); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_version_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_version_test.cpp new file mode 100644 index 00000000000..fa252ac869f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_version_test.cpp @@ -0,0 +1,278 @@ +// Copyright (c) 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using ::testing::HasSubstr; + +using ValidateVersion = spvtest::ValidateBase< + std::tuple>; + +const std::string vulkan_spirv = R"( +OpCapability Shader +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %func "func" +%void = OpTypeVoid +%functy = OpTypeFunction %void +%func = OpFunction %void None %functy +%1 = OpLabel +OpReturn +OpFunctionEnd +)"; + +const std::string opencl_spirv = R"( +OpCapability Kernel +OpCapability Linkage +OpMemoryModel Logical OpenCL +)"; + +std::string version(spv_target_env env) { + switch (env) { + case SPV_ENV_UNIVERSAL_1_0: + case SPV_ENV_VULKAN_1_0: + case SPV_ENV_OPENGL_4_0: + case SPV_ENV_OPENGL_4_1: + case SPV_ENV_OPENGL_4_2: + case SPV_ENV_OPENGL_4_3: + case SPV_ENV_OPENGL_4_5: + case SPV_ENV_OPENCL_1_2: + case SPV_ENV_OPENCL_2_0: + case SPV_ENV_OPENCL_EMBEDDED_2_0: + return "1.0"; + case SPV_ENV_UNIVERSAL_1_1: + case SPV_ENV_OPENCL_2_1: + case SPV_ENV_OPENCL_EMBEDDED_2_1: + return "1.1"; + case SPV_ENV_UNIVERSAL_1_2: + case SPV_ENV_OPENCL_2_2: + case SPV_ENV_OPENCL_EMBEDDED_2_2: + return "1.2"; + case SPV_ENV_UNIVERSAL_1_3: + case SPV_ENV_VULKAN_1_1: + case SPV_ENV_WEBGPU_0: + return "1.3"; + default: + return "0"; + } +} + +TEST_P(ValidateVersion, version) { + CompileSuccessfully(std::get<2>(GetParam()), std::get<0>(GetParam())); + spv_result_t res = ValidateInstructions(std::get<1>(GetParam())); + if (std::get<3>(GetParam())) { + ASSERT_EQ(SPV_SUCCESS, res); + } else { + ASSERT_EQ(SPV_ERROR_WRONG_VERSION, res); + + std::string msg = "Invalid SPIR-V binary version "; + msg += version(std::get<0>(GetParam())); + msg += " for target environment "; + msg += spvTargetEnvDescription(std::get<1>(GetParam())); + EXPECT_THAT(getDiagnosticString(), HasSubstr(msg)); + } +} + +// clang-format off +INSTANTIATE_TEST_CASE_P(Universal, ValidateVersion, + ::testing::Values( + // Binary version, Target environment + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_2, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_VULKAN_1_0, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_VULKAN_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_OPENGL_4_0, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_OPENGL_4_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_OPENGL_4_2, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_OPENGL_4_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_OPENGL_4_5, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_WEBGPU_0, vulkan_spirv, true), + + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_VULKAN_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_VULKAN_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_OPENGL_4_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_OPENGL_4_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_OPENGL_4_2, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_OPENGL_4_3, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_OPENGL_4_5, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_1, SPV_ENV_WEBGPU_0, vulkan_spirv, true), + + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_2, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_OPENGL_4_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_OPENGL_4_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_OPENGL_4_2, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_OPENGL_4_3, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_OPENGL_4_5, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_WEBGPU_0, vulkan_spirv, true), + + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_2, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_OPENGL_4_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_OPENGL_4_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_OPENGL_4_2, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_OPENGL_4_3, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_OPENGL_4_5, vulkan_spirv, false), + std::make_tuple(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_WEBGPU_0, vulkan_spirv, true) + ) +); + +INSTANTIATE_TEST_CASE_P(Vulkan, ValidateVersion, + ::testing::Values( + // Binary version, Target environment + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_UNIVERSAL_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_UNIVERSAL_1_2, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_UNIVERSAL_1_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_0, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_OPENGL_4_0, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_OPENGL_4_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_OPENGL_4_2, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_OPENGL_4_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_OPENGL_4_5, vulkan_spirv, true), + + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_UNIVERSAL_1_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_UNIVERSAL_1_2, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_UNIVERSAL_1_3, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_VULKAN_1_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_VULKAN_1_1, vulkan_spirv, true), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_OPENGL_4_0, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_OPENGL_4_1, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_OPENGL_4_2, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_OPENGL_4_3, vulkan_spirv, false), + std::make_tuple(SPV_ENV_VULKAN_1_1, SPV_ENV_OPENGL_4_5, vulkan_spirv, false) + ) +); + +INSTANTIATE_TEST_CASE_P(OpenCL, ValidateVersion, + ::testing::Values( + // Binary version, Target environment + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_OPENCL_1_2, opencl_spirv, true), + + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_1, SPV_ENV_OPENCL_1_2, opencl_spirv, true), + + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_2_0, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_2_1, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_2_2, SPV_ENV_OPENCL_1_2, opencl_spirv, false), + + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_1_2, SPV_ENV_OPENCL_1_2, opencl_spirv, true) + ) +); + +INSTANTIATE_TEST_CASE_P(OpenCLEmbedded, ValidateVersion, + ::testing::Values( + // Binary version, Target environment + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_OPENCL_1_2, opencl_spirv, true), + + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_1, SPV_ENV_OPENCL_1_2, opencl_spirv, true), + + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_UNIVERSAL_1_1, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_UNIVERSAL_1_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_UNIVERSAL_1_3, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_2_0, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_2_1, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_EMBEDDED_2_0, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_EMBEDDED_2_1, opencl_spirv, false), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_EMBEDDED_2_2, opencl_spirv, true), + std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_2, SPV_ENV_OPENCL_1_2, opencl_spirv, false) + ) +); +// clang-format on + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_webgpu_test.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_webgpu_test.cpp new file mode 100644 index 00000000000..b65d08fe69e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/test/val/val_webgpu_test.cpp @@ -0,0 +1,51 @@ +// Copyright (c) 2018 Google 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. + +// Validation tests for WebGPU env specific checks + +#include + +#include "gmock/gmock.h" +#include "test/val/val_fixtures.h" + +namespace spvtools { +namespace val { +namespace { + +using testing::HasSubstr; + +using ValidateWebGPU = spvtest::ValidateBase; + +TEST_F(ValidateWebGPU, OpUndefIsDisallowed) { + std::string spirv = R"( + OpCapability Shader + OpCapability Linkage + OpMemoryModel Logical GLSL450 + %float = OpTypeFloat 32 + %1 = OpUndef %float +)"; + + CompileSuccessfully(spirv); + + // Control case: OpUndef is allowed in SPIR-V 1.3 + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_UNIVERSAL_1_3)); + + // Control case: OpUndef is disallowed in the WebGPU env + EXPECT_EQ(SPV_ERROR_INVALID_BINARY, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), HasSubstr("OpUndef is disallowed")); +} + +} // namespace +} // namespace val +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/tools/CMakeLists.txt new file mode 100644 index 00000000000..67143d879e5 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/CMakeLists.txt @@ -0,0 +1,83 @@ +# Copyright (c) 2015-2016 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. + +add_subdirectory(lesspipe) +add_subdirectory(emacs) + +# Add a SPIR-V Tools command line tool. Signature: +# add_spvtools_tool( +# TARGET target_name +# SRCS src_file1.cpp src_file2.cpp +# LIBS lib_target1 lib_target2 +# ) +function(add_spvtools_tool) + set(one_value_args TARGET) + set(multi_value_args SRCS LIBS) + cmake_parse_arguments( + ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + add_executable(${ARG_TARGET} ${ARG_SRCS}) + spvtools_default_compile_options(${ARG_TARGET}) + target_link_libraries(${ARG_TARGET} PRIVATE ${ARG_LIBS}) + target_include_directories(${ARG_TARGET} PRIVATE + ${spirv-tools_SOURCE_DIR} + ${spirv-tools_BINARY_DIR} + ) + set_property(TARGET ${ARG_TARGET} PROPERTY FOLDER "SPIRV-Tools executables") +endfunction() + +if (NOT ${SPIRV_SKIP_EXECUTABLES}) + add_spvtools_tool(TARGET spirv-as SRCS as/as.cpp LIBS ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-stats + SRCS stats/stats.cpp + stats/stats_analyzer.cpp + stats/stats_analyzer.h + stats/spirv_stats.cpp + stats/spirv_stats.h + LIBS ${SPIRV_TOOLS}) + add_spvtools_tool(TARGET spirv-cfg + SRCS cfg/cfg.cpp + cfg/bin_to_dot.h + cfg/bin_to_dot.cpp + LIBS ${SPIRV_TOOLS}) + target_include_directories(spirv-cfg PRIVATE ${spirv-tools_SOURCE_DIR} + ${SPIRV_HEADER_INCLUDE_DIR}) + target_include_directories(spirv-stats PRIVATE ${spirv-tools_SOURCE_DIR} + ${SPIRV_HEADER_INCLUDE_DIR}) + + set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt spirv-stats + spirv-cfg spirv-link) + + if(SPIRV_BUILD_COMPRESSION) + add_spvtools_tool(TARGET spirv-markv + SRCS comp/markv.cpp + comp/markv_model_factory.cpp + comp/markv_model_shader.cpp + LIBS SPIRV-Tools-comp SPIRV-Tools-opt ${SPIRV_TOOLS}) + target_include_directories(spirv-markv PRIVATE ${spirv-tools_SOURCE_DIR} + ${SPIRV_HEADER_INCLUDE_DIR}) + set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-markv) + endif(SPIRV_BUILD_COMPRESSION) + + if(ENABLE_SPIRV_TOOLS_INSTALL) + install(TARGETS ${SPIRV_INSTALL_TARGETS} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif(ENABLE_SPIRV_TOOLS_INSTALL) +endif() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/as/as.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/as/as.cpp new file mode 100644 index 00000000000..287ba51f8ac --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/as/as.cpp @@ -0,0 +1,154 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include + +#include "source/spirv_target_env.h" +#include "spirv-tools/libspirv.h" +#include "tools/io.h" + +void print_usage(char* argv0) { + printf( + R"(%s - Create a SPIR-V binary module from SPIR-V assembly text + +Usage: %s [options] [] + +The SPIR-V assembly text is read from . If no file is specified, +or if the filename is "-", then the assembly text is read from standard input. +The SPIR-V binary module is written to file "out.spv", unless the -o option +is used. + +Options: + + -h, --help Print this help. + + -o Set the output filename. Use '-' to mean stdout. + --version Display assembler version information. + --preserve-numeric-ids + Numeric IDs in the binary will have the same values as in the + source. Non-numeric IDs are allocated by filling in the gaps, + starting with 1 and going up. + --target-env {vulkan1.0|vulkan1.1|spv1.0|spv1.1|spv1.2|spv1.3} + Use Vulkan 1.0, Vulkan 1.1, SPIR-V 1.0, SPIR-V 1.1, + SPIR-V 1.2, or SPIR-V 1.3 +)", + argv0, argv0); +} + +static const auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_3; + +int main(int argc, char** argv) { + const char* inFile = nullptr; + const char* outFile = nullptr; + uint32_t options = 0; + spv_target_env target_env = kDefaultEnvironment; + for (int argi = 1; argi < argc; ++argi) { + if ('-' == argv[argi][0]) { + switch (argv[argi][1]) { + case 'h': { + print_usage(argv[0]); + return 0; + } + case 'o': { + if (!outFile && argi + 1 < argc) { + outFile = argv[++argi]; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case 0: { + // Setting a filename of "-" to indicate stdin. + if (!inFile) { + inFile = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } break; + case '-': { + // Long options + if (0 == strcmp(argv[argi], "--version")) { + printf("%s\n", spvSoftwareVersionDetailsString()); + printf("Target: %s\n", + spvTargetEnvDescription(kDefaultEnvironment)); + return 0; + } else if (0 == strcmp(argv[argi], "--help")) { + print_usage(argv[0]); + return 0; + } else if (0 == strcmp(argv[argi], "--preserve-numeric-ids")) { + options |= SPV_TEXT_TO_BINARY_OPTION_PRESERVE_NUMERIC_IDS; + } else if (0 == strcmp(argv[argi], "--target-env")) { + if (argi + 1 < argc) { + const auto env_str = argv[++argi]; + if (!spvParseTargetEnv(env_str, &target_env)) { + fprintf(stderr, "error: Unrecognized target env: %s\n", + env_str); + return 1; + } + } else { + fprintf(stderr, "error: Missing argument to --target-env\n"); + return 1; + } + } else { + fprintf(stderr, "error: Unrecognized option: %s\n\n", argv[argi]); + print_usage(argv[0]); + return 1; + } + } break; + default: + fprintf(stderr, "error: Unrecognized option: %s\n\n", argv[argi]); + print_usage(argv[0]); + return 1; + } + } else { + if (!inFile) { + inFile = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } + } + + if (!outFile) { + outFile = "out.spv"; + } + + std::vector contents; + if (!ReadFile(inFile, "r", &contents)) return 1; + + spv_binary binary; + spv_diagnostic diagnostic = nullptr; + spv_context context = spvContextCreate(target_env); + spv_result_t error = spvTextToBinaryWithOptions( + context, contents.data(), contents.size(), options, &binary, &diagnostic); + spvContextDestroy(context); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + return error; + } + + if (!WriteFile(outFile, "wb", binary->code, binary->wordCount)) { + spvBinaryDestroy(binary); + return 1; + } + + spvBinaryDestroy(binary); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/bin_to_dot.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/bin_to_dot.cpp new file mode 100644 index 00000000000..2561eea401c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/bin_to_dot.cpp @@ -0,0 +1,187 @@ +// Copyright (c) 2016 Google 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. + +#include "tools/cfg/bin_to_dot.h" + +#include +#include +#include +#include + +#include "source/assembly_grammar.h" +#include "source/name_mapper.h" + +namespace { + +const char* kMergeStyle = "style=dashed"; +const char* kContinueStyle = "style=dotted"; + +// A DotConverter can be used to dump the GraphViz "dot" graph for +// a SPIR-V module. +class DotConverter { + public: + DotConverter(spvtools::NameMapper name_mapper, std::iostream* out) + : name_mapper_(std::move(name_mapper)), out_(*out) {} + + // Emits the graph preamble. + void Begin() const { + out_ << "digraph {\n"; + // Emit a simple legend + out_ << "legend_merge_src [shape=plaintext, label=\"\"];\n" + << "legend_merge_dest [shape=plaintext, label=\"\"];\n" + << "legend_merge_src -> legend_merge_dest [label=\" merge\"," + << kMergeStyle << "];\n" + << "legend_continue_src [shape=plaintext, label=\"\"];\n" + << "legend_continue_dest [shape=plaintext, label=\"\"];\n" + << "legend_continue_src -> legend_continue_dest [label=\" continue\"," + << kContinueStyle << "];\n"; + } + // Emits the graph postamble. + void End() const { out_ << "}\n"; } + + // Emits the Dot commands for the given instruction. + spv_result_t HandleInstruction(const spv_parsed_instruction_t& inst); + + private: + // Ends processing for the current block, emitting its dot code. + void FlushBlock(const std::vector& successors); + + // The ID of the current functio, or 0 if outside of a function. + uint32_t current_function_id_ = 0; + + // The ID of the current basic block, or 0 if outside of a block. + uint32_t current_block_id_ = 0; + + // Have we completed processing for the entry block to this fuction? + bool seen_function_entry_block_ = false; + + // The Id of the merge block for this block if it exists, or 0 otherwise. + uint32_t merge_ = 0; + // The Id of the continue target block for this block if it exists, or 0 + // otherwise. + uint32_t continue_target_ = 0; + + // An object for mapping Ids to names. + spvtools::NameMapper name_mapper_; + + // The output stream. + std::ostream& out_; +}; + +spv_result_t DotConverter::HandleInstruction( + const spv_parsed_instruction_t& inst) { + switch (inst.opcode) { + case SpvOpFunction: + current_function_id_ = inst.result_id; + seen_function_entry_block_ = false; + break; + case SpvOpFunctionEnd: + current_function_id_ = 0; + break; + + case SpvOpLabel: + current_block_id_ = inst.result_id; + break; + + case SpvOpBranch: + FlushBlock({inst.words[1]}); + break; + case SpvOpBranchConditional: + FlushBlock({inst.words[2], inst.words[3]}); + break; + case SpvOpSwitch: { + std::vector successors{inst.words[2]}; + for (size_t i = 3; i < inst.num_operands; i += 2) { + successors.push_back(inst.words[inst.operands[i].offset]); + } + FlushBlock(successors); + } break; + + case SpvOpKill: + case SpvOpReturn: + case SpvOpUnreachable: + case SpvOpReturnValue: + FlushBlock({}); + break; + + case SpvOpLoopMerge: + merge_ = inst.words[1]; + continue_target_ = inst.words[2]; + break; + case SpvOpSelectionMerge: + merge_ = inst.words[1]; + break; + default: + break; + } + return SPV_SUCCESS; +} + +void DotConverter::FlushBlock(const std::vector& successors) { + out_ << current_block_id_; + if (!seen_function_entry_block_) { + out_ << " [label=\"" << name_mapper_(current_block_id_) << "\nFn " + << name_mapper_(current_function_id_) << " entry\", shape=box];\n"; + } else { + out_ << " [label=\"" << name_mapper_(current_block_id_) << "\"];\n"; + } + + for (auto successor : successors) { + out_ << current_block_id_ << " -> " << successor << ";\n"; + } + + if (merge_) { + out_ << current_block_id_ << " -> " << merge_ << " [" << kMergeStyle + << "];\n"; + } + if (continue_target_) { + out_ << current_block_id_ << " -> " << continue_target_ << " [" + << kContinueStyle << "];\n"; + } + + // Reset the book-keeping for a block. + seen_function_entry_block_ = true; + merge_ = 0; + continue_target_ = 0; +} + +spv_result_t HandleInstruction( + void* user_data, const spv_parsed_instruction_t* parsed_instruction) { + assert(user_data); + auto converter = static_cast(user_data); + return converter->HandleInstruction(*parsed_instruction); +} + +} // anonymous namespace + +spv_result_t BinaryToDot(const spv_const_context context, const uint32_t* words, + size_t num_words, std::iostream* out, + spv_diagnostic* diagnostic) { + // Invalid arguments return error codes, but don't necessarily generate + // diagnostics. These are programmer errors, not user errors. + if (!diagnostic) return SPV_ERROR_INVALID_DIAGNOSTIC; + const spvtools::AssemblyGrammar grammar(context); + if (!grammar.isValid()) return SPV_ERROR_INVALID_TABLE; + + spvtools::FriendlyNameMapper friendly_mapper(context, words, num_words); + DotConverter converter(friendly_mapper.GetNameMapper(), out); + converter.Begin(); + if (auto error = spvBinaryParse(context, &converter, words, num_words, + nullptr, HandleInstruction, diagnostic)) { + return error; + } + converter.End(); + + return SPV_SUCCESS; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/bin_to_dot.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/bin_to_dot.h new file mode 100644 index 00000000000..4de2e07faf8 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/bin_to_dot.h @@ -0,0 +1,28 @@ +// Copyright (c) 2016 Google 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. + +#ifndef TOOLS_CFG_BIN_TO_DOT_H_ +#define TOOLS_CFG_BIN_TO_DOT_H_ + +#include + +#include "spirv-tools/libspirv.h" + +// Dumps the control flow graph for the given module to the output stream. +// Returns SPV_SUCCESS on succes. +spv_result_t BinaryToDot(const spv_const_context context, const uint32_t* words, + size_t num_words, std::iostream* out, + spv_diagnostic* diagnostic); + +#endif // TOOLS_CFG_BIN_TO_DOT_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/cfg.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/cfg.cpp new file mode 100644 index 00000000000..9e2c448ba27 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/cfg/cfg.cpp @@ -0,0 +1,127 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include +#include + +#include "spirv-tools/libspirv.h" +#include "tools/cfg/bin_to_dot.h" +#include "tools/io.h" + +// Prints a program usage message to stdout. +static void print_usage(const char* argv0) { + printf( + R"(%s - Show the control flow graph in GraphiViz "dot" form. EXPERIMENTAL + +Usage: %s [options] [] + +The SPIR-V binary is read from . If no file is specified, +or if the filename is "-", then the binary is read from standard input. + +Options: + + -h, --help Print this help. + --version Display version information. + + -o Set the output filename. + Output goes to standard output if this option is + not specified, or if the filename is "-". +)", + argv0, argv0); +} + +static const auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_2; + +int main(int argc, char** argv) { + const char* inFile = nullptr; + const char* outFile = nullptr; // Stays nullptr if printing to stdout. + + for (int argi = 1; argi < argc; ++argi) { + if ('-' == argv[argi][0]) { + switch (argv[argi][1]) { + case 'h': + print_usage(argv[0]); + return 0; + case 'o': { + if (!outFile && argi + 1 < argc) { + outFile = argv[++argi]; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case '-': { + // Long options + if (0 == strcmp(argv[argi], "--help")) { + print_usage(argv[0]); + return 0; + } else if (0 == strcmp(argv[argi], "--version")) { + printf("%s EXPERIMENTAL\n", spvSoftwareVersionDetailsString()); + printf("Target: %s\n", + spvTargetEnvDescription(kDefaultEnvironment)); + return 0; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case 0: { + // Setting a filename of "-" to indicate stdin. + if (!inFile) { + inFile = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } break; + default: + print_usage(argv[0]); + return 1; + } + } else { + if (!inFile) { + inFile = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } + } + + // Read the input binary. + std::vector contents; + if (!ReadFile(inFile, "rb", &contents)) return 1; + spv_context context = spvContextCreate(kDefaultEnvironment); + spv_diagnostic diagnostic = nullptr; + + std::stringstream ss; + auto error = + BinaryToDot(context, contents.data(), contents.size(), &ss, &diagnostic); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(context); + return error; + } + std::string str = ss.str(); + WriteFile(outFile, "w", str.data(), str.size()); + + spvDiagnosticDestroy(diagnostic); + spvContextDestroy(context); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv.cpp new file mode 100644 index 00000000000..9a0a51808de --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv.cpp @@ -0,0 +1,385 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/comp/markv.h" +#include "source/spirv_target_env.h" +#include "source/table.h" +#include "spirv-tools/optimizer.hpp" +#include "tools/comp/markv_model_factory.h" +#include "tools/io.h" + +namespace { + +const auto kSpvEnv = SPV_ENV_UNIVERSAL_1_2; + +enum Task { + kNoTask = 0, + kEncode, + kDecode, + kTest, +}; + +struct ScopedContext { + ScopedContext(spv_target_env env) : context(spvContextCreate(env)) {} + ~ScopedContext() { spvContextDestroy(context); } + spv_context context; +}; + +void print_usage(char* argv0) { + printf( + R"(%s - Encodes or decodes a SPIR-V binary to or from a MARK-V binary. + +USAGE: %s [e|d|t] [options] [] + +The input binary is read from . If no file is specified, +or if the filename is "-", then the binary is read from standard input. + +If no output is specified then the output is printed to stdout in a human +readable format. + +WIP: MARK-V codec is in early stages of development. At the moment it only +can encode and decode some SPIR-V files and only if exacly the same build of +software is used (is doesn't write or handle version numbers yet). + +Tasks: + e Encode SPIR-V to MARK-V. + d Decode MARK-V to SPIR-V. + t Test the codec by first encoding the given SPIR-V file to + MARK-V, then decoding it back to SPIR-V and comparing results. + +Options: + -h, --help Print this help. + --comments Write codec comments to stderr. + --version Display MARK-V codec version. + --validate Validate SPIR-V while encoding or decoding. + --model= + Compression model, possible values: + shader_lite - fast, poor compression ratio + shader_mid - balanced + shader_max - best compression ratio + Default: shader_lite + + -o Set the output filename. + Output goes to standard output if this option is + not specified, or if the filename is "-". + Not needed for 't' task (testing). +)", + argv0, argv0); +} + +void DiagnosticsMessageHandler(spv_message_level_t level, const char*, + const spv_position_t& position, + const char* message) { + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: " << position.index << ": " << message << std::endl; + break; + case SPV_MSG_WARNING: + std::cerr << "warning: " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_INFO: + std::cerr << "info: " << position.index << ": " << message << std::endl; + break; + default: + break; + } +} + +} // namespace + +int main(int argc, char** argv) { + const char* input_filename = nullptr; + const char* output_filename = nullptr; + + Task task = kNoTask; + + if (argc < 3) { + print_usage(argv[0]); + return 0; + } + + const char* task_char = argv[1]; + if (0 == strcmp("e", task_char)) { + task = kEncode; + } else if (0 == strcmp("d", task_char)) { + task = kDecode; + } else if (0 == strcmp("t", task_char)) { + task = kTest; + } + + if (task == kNoTask) { + print_usage(argv[0]); + return 1; + } + + bool want_comments = false; + bool validate_spirv_binary = false; + + spvtools::comp::MarkvModelType model_type = + spvtools::comp::kMarkvModelUnknown; + + for (int argi = 2; argi < argc; ++argi) { + if ('-' == argv[argi][0]) { + switch (argv[argi][1]) { + case 'h': + print_usage(argv[0]); + return 0; + case 'o': { + if (!output_filename && argi + 1 < argc && + (task == kEncode || task == kDecode)) { + output_filename = argv[++argi]; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case '-': { + if (0 == strcmp(argv[argi], "--help")) { + print_usage(argv[0]); + return 0; + } else if (0 == strcmp(argv[argi], "--comments")) { + want_comments = true; + } else if (0 == strcmp(argv[argi], "--version")) { + fprintf(stderr, "error: Not implemented\n"); + return 1; + } else if (0 == strcmp(argv[argi], "--validate")) { + validate_spirv_binary = true; + } else if (0 == strcmp(argv[argi], "--model=shader_lite")) { + if (model_type != spvtools::comp::kMarkvModelUnknown) + fprintf(stderr, "error: More than one model specified\n"); + model_type = spvtools::comp::kMarkvModelShaderLite; + } else if (0 == strcmp(argv[argi], "--model=shader_mid")) { + if (model_type != spvtools::comp::kMarkvModelUnknown) + fprintf(stderr, "error: More than one model specified\n"); + model_type = spvtools::comp::kMarkvModelShaderMid; + } else if (0 == strcmp(argv[argi], "--model=shader_max")) { + if (model_type != spvtools::comp::kMarkvModelUnknown) + fprintf(stderr, "error: More than one model specified\n"); + model_type = spvtools::comp::kMarkvModelShaderMax; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case '\0': { + // Setting a filename of "-" to indicate stdin. + if (!input_filename) { + input_filename = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } break; + default: + print_usage(argv[0]); + return 1; + } + } else { + if (!input_filename) { + input_filename = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } + } + + if (model_type == spvtools::comp::kMarkvModelUnknown) + model_type = spvtools::comp::kMarkvModelShaderLite; + + const auto no_comments = spvtools::comp::MarkvLogConsumer(); + const auto output_to_stderr = [](const std::string& str) { + std::cerr << str; + }; + + ScopedContext ctx(kSpvEnv); + + std::unique_ptr model = + spvtools::comp::CreateMarkvModel(model_type); + + std::vector spirv; + std::vector markv; + + spvtools::comp::MarkvCodecOptions options; + options.validate_spirv_binary = validate_spirv_binary; + + if (task == kEncode) { + if (!ReadFile(input_filename, "rb", &spirv)) return 1; + assert(!spirv.empty()); + + if (SPV_SUCCESS != spvtools::comp::SpirvToMarkv( + ctx.context, spirv, options, *model, + DiagnosticsMessageHandler, + want_comments ? output_to_stderr : no_comments, + spvtools::comp::MarkvDebugConsumer(), &markv)) { + std::cerr << "error: Failed to encode " << input_filename << " to MARK-V " + << std::endl; + return 1; + } + + if (!WriteFile(output_filename, "wb", markv.data(), markv.size())) + return 1; + } else if (task == kDecode) { + if (!ReadFile(input_filename, "rb", &markv)) return 1; + assert(!markv.empty()); + + if (SPV_SUCCESS != spvtools::comp::MarkvToSpirv( + ctx.context, markv, options, *model, + DiagnosticsMessageHandler, + want_comments ? output_to_stderr : no_comments, + spvtools::comp::MarkvDebugConsumer(), &spirv)) { + std::cerr << "error: Failed to decode " << input_filename << " to SPIR-V " + << std::endl; + return 1; + } + + if (!WriteFile(output_filename, "wb", spirv.data(), spirv.size())) + return 1; + } else if (task == kTest) { + if (!ReadFile(input_filename, "rb", &spirv)) return 1; + assert(!spirv.empty()); + + std::vector spirv_before; + spvtools::Optimizer optimizer(kSpvEnv); + optimizer.RegisterPass(spvtools::CreateCompactIdsPass()); + if (!optimizer.Run(spirv.data(), spirv.size(), &spirv_before)) { + std::cerr << "error: Optimizer failure on: " << input_filename + << std::endl; + } + + std::vector encoder_instruction_bits; + std::vector encoder_instruction_comments; + std::vector> encoder_instruction_words; + std::vector decoder_instruction_bits; + std::vector decoder_instruction_comments; + std::vector> decoder_instruction_words; + + const auto encoder_debug_consumer = [&](const std::vector& words, + const std::string& bits, + const std::string& comment) { + encoder_instruction_words.push_back(words); + encoder_instruction_bits.push_back(bits); + encoder_instruction_comments.push_back(comment); + return true; + }; + + if (SPV_SUCCESS != spvtools::comp::SpirvToMarkv( + ctx.context, spirv_before, options, *model, + DiagnosticsMessageHandler, + want_comments ? output_to_stderr : no_comments, + encoder_debug_consumer, &markv)) { + std::cerr << "error: Failed to encode " << input_filename << " to MARK-V " + << std::endl; + return 1; + } + + const auto write_bug_report = [&]() { + for (size_t inst_index = 0; inst_index < decoder_instruction_words.size(); + ++inst_index) { + std::cerr << "\nInstruction #" << inst_index << std::endl; + std::cerr << "\nEncoder words: "; + for (uint32_t word : encoder_instruction_words[inst_index]) + std::cerr << word << " "; + std::cerr << "\nDecoder words: "; + for (uint32_t word : decoder_instruction_words[inst_index]) + std::cerr << word << " "; + std::cerr << std::endl; + + std::cerr << "\nEncoder bits: " << encoder_instruction_bits[inst_index]; + std::cerr << "\nDecoder bits: " << decoder_instruction_bits[inst_index]; + std::cerr << std::endl; + + std::cerr << "\nEncoder comments:\n" + << encoder_instruction_comments[inst_index]; + std::cerr << "Decoder comments:\n" + << decoder_instruction_comments[inst_index]; + std::cerr << std::endl; + } + }; + + const auto decoder_debug_consumer = [&](const std::vector& words, + const std::string& bits, + const std::string& comment) { + const size_t inst_index = decoder_instruction_words.size(); + if (inst_index >= encoder_instruction_words.size()) { + write_bug_report(); + std::cerr << "error: Decoder has more instructions than encoder: " + << input_filename << std::endl; + return false; + } + + decoder_instruction_words.push_back(words); + decoder_instruction_bits.push_back(bits); + decoder_instruction_comments.push_back(comment); + + if (encoder_instruction_words[inst_index] != + decoder_instruction_words[inst_index]) { + write_bug_report(); + std::cerr << "error: Words of the last decoded instruction differ from " + "reference: " + << input_filename << std::endl; + return false; + } + + if (encoder_instruction_bits[inst_index] != + decoder_instruction_bits[inst_index]) { + write_bug_report(); + std::cerr << "error: Bits of the last decoded instruction differ from " + "reference: " + << input_filename << std::endl; + return false; + } + return true; + }; + + std::vector spirv_after; + const spv_result_t decoding_result = spvtools::comp::MarkvToSpirv( + ctx.context, markv, options, *model, DiagnosticsMessageHandler, + want_comments ? output_to_stderr : no_comments, decoder_debug_consumer, + &spirv_after); + + if (decoding_result == SPV_REQUESTED_TERMINATION) { + std::cerr << "error: Decoding interrupted by the debugger: " + << input_filename << std::endl; + return 1; + } + + if (decoding_result != SPV_SUCCESS) { + std::cerr << "error: Failed to decode encoded " << input_filename + << " back to SPIR-V " << std::endl; + return 1; + } + + assert(spirv_before.size() == spirv_after.size()); + assert(std::mismatch(std::next(spirv_before.begin(), 5), spirv_before.end(), + std::next(spirv_after.begin(), 5)) == + std::make_pair(spirv_before.end(), spirv_after.end())); + } + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_factory.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_factory.cpp new file mode 100644 index 00000000000..863fcf55875 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_factory.cpp @@ -0,0 +1,50 @@ +// Copyright (c) 2017 Google 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. + +#include "tools/comp/markv_model_factory.h" + +#include "source/util/make_unique.h" +#include "tools/comp/markv_model_shader.h" + +namespace spvtools { +namespace comp { + +std::unique_ptr CreateMarkvModel(MarkvModelType type) { + std::unique_ptr model; + switch (type) { + case kMarkvModelShaderLite: { + model = MakeUnique(); + break; + } + case kMarkvModelShaderMid: { + model = MakeUnique(); + break; + } + case kMarkvModelShaderMax: { + model = MakeUnique(); + break; + } + case kMarkvModelUnknown: { + assert(0 && "kMarkvModelUnknown supplied to CreateMarkvModel"); + return model; + } + } + + model->SetModelType(static_cast(type)); + + return model; +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_factory.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_factory.h new file mode 100644 index 00000000000..c13898b9864 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_factory.h @@ -0,0 +1,37 @@ +// Copyright (c) 2017 Google 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. + +#ifndef TOOLS_COMP_MARKV_MODEL_FACTORY_H_ +#define TOOLS_COMP_MARKV_MODEL_FACTORY_H_ + +#include + +#include "source/comp/markv_model.h" + +namespace spvtools { +namespace comp { + +enum MarkvModelType { + kMarkvModelUnknown = 0, + kMarkvModelShaderLite, + kMarkvModelShaderMid, + kMarkvModelShaderMax, +}; + +std::unique_ptr CreateMarkvModel(MarkvModelType type); + +} // namespace comp +} // namespace spvtools + +#endif // TOOLS_COMP_MARKV_MODEL_FACTORY_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader.cpp new file mode 100644 index 00000000000..8e296cd8ce2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader.cpp @@ -0,0 +1,84 @@ +// Copyright (c) 2017 Google 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. + +#include "tools/comp/markv_model_shader.h" + +#include +#include +#include +#include +#include +#include + +#include "source/util/make_unique.h" + +namespace spvtools { +namespace comp { +namespace { + +// Signals that the value is not in the coding scheme and a fallback method +// needs to be used. +const uint64_t kMarkvNoneOfTheAbove = MarkvModel::GetMarkvNoneOfTheAbove(); + +inline uint32_t CombineOpcodeAndNumOperands(uint32_t opcode, + uint32_t num_operands) { + return opcode | (num_operands << 16); +} + +#include "tools/comp/markv_model_shader_default_autogen.inc" + +} // namespace + +MarkvModelShaderLite::MarkvModelShaderLite() { + const uint16_t kVersionNumber = 1; + SetModelVersion(kVersionNumber); + + opcode_and_num_operands_huffman_codec_ = + MakeUnique>(GetOpcodeAndNumOperandsHist()); + + id_fallback_strategy_ = IdFallbackStrategy::kShortDescriptor; +} + +MarkvModelShaderMid::MarkvModelShaderMid() { + const uint16_t kVersionNumber = 1; + SetModelVersion(kVersionNumber); + + opcode_and_num_operands_huffman_codec_ = + MakeUnique>(GetOpcodeAndNumOperandsHist()); + non_id_word_huffman_codecs_ = GetNonIdWordHuffmanCodecs(); + id_descriptor_huffman_codecs_ = GetIdDescriptorHuffmanCodecs(); + descriptors_with_coding_scheme_ = GetDescriptorsWithCodingScheme(); + literal_string_huffman_codecs_ = GetLiteralStringHuffmanCodecs(); + + id_fallback_strategy_ = IdFallbackStrategy::kShortDescriptor; +} + +MarkvModelShaderMax::MarkvModelShaderMax() { + const uint16_t kVersionNumber = 1; + SetModelVersion(kVersionNumber); + + opcode_and_num_operands_huffman_codec_ = + MakeUnique>(GetOpcodeAndNumOperandsHist()); + opcode_and_num_operands_markov_huffman_codecs_ = + GetOpcodeAndNumOperandsMarkovHuffmanCodecs(); + non_id_word_huffman_codecs_ = GetNonIdWordHuffmanCodecs(); + id_descriptor_huffman_codecs_ = GetIdDescriptorHuffmanCodecs(); + descriptors_with_coding_scheme_ = GetDescriptorsWithCodingScheme(); + literal_string_huffman_codecs_ = GetLiteralStringHuffmanCodecs(); + + id_fallback_strategy_ = IdFallbackStrategy::kRuleBased; +} + +} // namespace comp +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader.h new file mode 100644 index 00000000000..3a704571fd7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader.h @@ -0,0 +1,47 @@ +// Copyright (c) 2017 Google 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. + +#ifndef TOOLS_COMP_MARKV_MODEL_SHADER_H_ +#define TOOLS_COMP_MARKV_MODEL_SHADER_H_ + +#include "source/comp/markv_model.h" + +namespace spvtools { +namespace comp { + +// MARK-V shader compression model, which only uses fast and lightweight +// algorithms, which do not require training and are not heavily dependent on +// SPIR-V grammar. Compression ratio is worse than by other models. +class MarkvModelShaderLite : public MarkvModel { + public: + MarkvModelShaderLite(); +}; + +// MARK-V shader compression model with balanced compression ratio and runtime +// performance. +class MarkvModelShaderMid : public MarkvModel { + public: + MarkvModelShaderMid(); +}; + +// MARK-V shader compression model designed for maximum compression. +class MarkvModelShaderMax : public MarkvModel { + public: + MarkvModelShaderMax(); +}; + +} // namespace comp +} // namespace spvtools + +#endif // TOOLS_COMP_MARKV_MODEL_SHADER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader_default_autogen.inc b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader_default_autogen.inc new file mode 100644 index 00000000000..0093cf1c0b3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/comp/markv_model_shader_default_autogen.inc @@ -0,0 +1,14519 @@ + +std::map GetOpcodeAndNumOperandsHist() { + return std::map({ + { CombineOpcodeAndNumOperands(SpvOpExtInst, 7), 158282 }, + { CombineOpcodeAndNumOperands(SpvOpDot, 4), 151035 }, + { CombineOpcodeAndNumOperands(SpvOpVectorShuffle, 6), 183292 }, + { CombineOpcodeAndNumOperands(SpvOpImageSampleImplicitLod, 4), 126492 }, + { CombineOpcodeAndNumOperands(SpvOpExecutionMode, 2), 13311 }, + { CombineOpcodeAndNumOperands(SpvOpFNegate, 3), 29952 }, + { CombineOpcodeAndNumOperands(SpvOpExtInst, 5), 106847 }, + { CombineOpcodeAndNumOperands(SpvOpImageSampleExplicitLod, 7), 26350 }, + { CombineOpcodeAndNumOperands(SpvOpImageSampleExplicitLod, 6), 28186 }, + { CombineOpcodeAndNumOperands(SpvOpFDiv, 4), 41635 }, + { CombineOpcodeAndNumOperands(SpvOpFMul, 4), 412786 }, + { CombineOpcodeAndNumOperands(SpvOpFunction, 4), 62905 }, + { CombineOpcodeAndNumOperands(SpvOpVectorShuffle, 8), 118614 }, + { CombineOpcodeAndNumOperands(SpvOpDecorate, 2), 100735 }, + { CombineOpcodeAndNumOperands(SpvOpReturnValue, 1), 40852 }, + { CombineOpcodeAndNumOperands(SpvOpVectorTimesScalar, 4), 157091 }, + { CombineOpcodeAndNumOperands(SpvOpExtInst, 6), 122100 }, + { CombineOpcodeAndNumOperands(SpvOpAccessChain, 5), 82930 }, + { CombineOpcodeAndNumOperands(SpvOpFSub, 4), 161019 }, + { CombineOpcodeAndNumOperands(SpvOpConstant, 3), 466014 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeExtract, 5), 107126 }, + { CombineOpcodeAndNumOperands(SpvOpTypeImage, 8), 34775 }, + { CombineOpcodeAndNumOperands(SpvOpImageSampleDrefExplicitLod, 7), 26146 }, + { CombineOpcodeAndNumOperands(SpvOpMemoryModel, 2), 18879 }, + { CombineOpcodeAndNumOperands(SpvOpDecorate, 3), 485251 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeConstruct, 4), 78011 }, + { CombineOpcodeAndNumOperands(SpvOpTypeFloat, 2), 18879 }, + { CombineOpcodeAndNumOperands(SpvOpVectorTimesMatrix, 4), 15848 }, + { CombineOpcodeAndNumOperands(SpvOpTypeVector, 3), 69404 }, + { CombineOpcodeAndNumOperands(SpvOpTypeFunction, 3), 19998 }, + { CombineOpcodeAndNumOperands(SpvOpConstantComposite, 6), 40228 }, + { CombineOpcodeAndNumOperands(SpvOpCapability, 1), 22510 }, + { CombineOpcodeAndNumOperands(SpvOpTypeArray, 3), 37585 }, + { CombineOpcodeAndNumOperands(SpvOpTypeInt, 3), 30454 }, + { CombineOpcodeAndNumOperands(SpvOpFunctionCall, 4), 29021 }, + { CombineOpcodeAndNumOperands(SpvOpFAdd, 4), 342237 }, + { CombineOpcodeAndNumOperands(SpvOpTypeMatrix, 3), 24449 }, + { CombineOpcodeAndNumOperands(SpvOpLabel, 1), 129408 }, + { CombineOpcodeAndNumOperands(SpvOpTypePointer, 3), 246535 }, + { CombineOpcodeAndNumOperands(SpvOpAccessChain, 4), 503456 }, + { CombineOpcodeAndNumOperands(SpvOpTypeFunction, 2), 19779 }, + { CombineOpcodeAndNumOperands(SpvOpBranchConditional, 3), 24139 }, + { CombineOpcodeAndNumOperands(SpvOpVariable, 3), 697946 }, + { CombineOpcodeAndNumOperands(SpvOpConstantComposite, 5), 55769 }, + { CombineOpcodeAndNumOperands(SpvOpTypeVoid, 1), 18879 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeConstruct, 6), 145508 }, + { CombineOpcodeAndNumOperands(SpvOpFunctionParameter, 2), 85583 }, + { CombineOpcodeAndNumOperands(SpvOpTypeSampledImage, 2), 34775 }, + { CombineOpcodeAndNumOperands(SpvOpConstantComposite, 4), 66362 }, + { CombineOpcodeAndNumOperands(SpvOpLoad, 3), 1272902 }, + { CombineOpcodeAndNumOperands(SpvOpReturn, 0), 22122 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeExtract, 4), 861008 }, + { CombineOpcodeAndNumOperands(SpvOpFunctionEnd, 0), 62905 }, + { CombineOpcodeAndNumOperands(SpvOpExtInstImport, 2), 18879 }, + { CombineOpcodeAndNumOperands(SpvOpSelectionMerge, 2), 22009 }, + { CombineOpcodeAndNumOperands(SpvOpBranch, 1), 38275 }, + { CombineOpcodeAndNumOperands(SpvOpTypeBool, 1), 12208 }, + { CombineOpcodeAndNumOperands(SpvOpSampledImage, 4), 95518 }, + { CombineOpcodeAndNumOperands(SpvOpMemberDecorate, 3), 94887 }, + { CombineOpcodeAndNumOperands(SpvOpMemberDecorate, 4), 1942215 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeConstruct, 5), 205266 }, + { CombineOpcodeAndNumOperands(SpvOpUndef, 2), 22157 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeInsert, 5), 142749 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeInsert, 6), 24420 }, + { CombineOpcodeAndNumOperands(SpvOpCompositeExtract, 6), 16896 }, + { CombineOpcodeAndNumOperands(SpvOpStore, 2), 604982 }, + { CombineOpcodeAndNumOperands(SpvOpIAdd, 4), 14471 }, + { CombineOpcodeAndNumOperands(SpvOpVectorShuffle, 7), 269658 }, + { kMarkvNoneOfTheAbove, 399895 }, + }); +} + +std::map>> +GetOpcodeAndNumOperandsMarkovHuffmanCodecs() { + std::map>> codecs; + { + std::unique_ptr> codec(new HuffmanCodec(35, { + {0, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {262209, 0, 0}, + {262221, 0, 0}, + {262225, 0, 0}, + {262230, 0, 0}, + {262273, 0, 0}, + {262277, 0, 0}, + {262286, 0, 0}, + {327745, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393295, 0, 0}, + {393304, 0, 0}, + {458831, 0, 0}, + {458840, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 11, 8}, + {0, 12, 19}, + {0, 18, 20}, + {0, 5, 21}, + {0, 15, 7}, + {0, 10, 1}, + {0, 23, 22}, + {0, 14, 24}, + {0, 6, 4}, + {0, 2, 17}, + {0, 13, 25}, + {0, 9, 26}, + {0, 28, 27}, + {0, 3, 29}, + {0, 30, 16}, + {0, 32, 31}, + {0, 34, 33}, + })); + + codecs.emplace(SpvOpImageSampleExplicitLod, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(55, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393303, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 14, 5}, + {0, 29, 17}, + {0, 1, 30}, + {0, 10, 20}, + {0, 32, 31}, + {0, 33, 2}, + {0, 34, 23}, + {0, 8, 35}, + {0, 6, 36}, + {0, 19, 22}, + {0, 28, 25}, + {0, 38, 37}, + {0, 13, 39}, + {0, 40, 24}, + {0, 27, 21}, + {0, 26, 41}, + {0, 42, 12}, + {0, 15, 43}, + {0, 44, 18}, + {0, 45, 3}, + {0, 11, 7}, + {0, 16, 46}, + {0, 47, 9}, + {0, 4, 48}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + })); + + codecs.emplace(SpvOpFDiv, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(19, { + {0, 0, 0}, + {196669, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262286, 0, 0}, + {393295, 0, 0}, + {393304, 0, 0}, + {458840, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 10}, + {0, 11, 3}, + {0, 2, 9}, + {0, 4, 1}, + {0, 5, 6}, + {0, 13, 12}, + {0, 15, 14}, + {0, 16, 7}, + {0, 18, 17}, + })); + + codecs.emplace(SpvOpSampledImage, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(67, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262285, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393297, 0, 0}, + {393298, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 10}, + {0, 30, 35}, + {0, 1, 36}, + {0, 11, 37}, + {0, 38, 6}, + {0, 16, 39}, + {0, 15, 40}, + {0, 25, 2}, + {0, 41, 20}, + {0, 26, 19}, + {0, 42, 29}, + {0, 28, 22}, + {0, 23, 34}, + {0, 44, 43}, + {0, 17, 45}, + {0, 24, 27}, + {0, 18, 33}, + {0, 47, 46}, + {0, 8, 48}, + {0, 50, 49}, + {0, 32, 51}, + {0, 31, 52}, + {0, 53, 21}, + {0, 54, 13}, + {0, 3, 55}, + {0, 7, 14}, + {0, 57, 56}, + {0, 58, 5}, + {0, 59, 9}, + {0, 61, 60}, + {0, 63, 62}, + {0, 64, 12}, + {0, 66, 65}, + })); + + codecs.emplace(SpvOpFMul, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(79, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262230, 0, 0}, + {262231, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {262328, 0, 0}, + {262334, 0, 0}, + {327692, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393297, 0, 0}, + {393303, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {458840, 0, 0}, + {524345, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 38, 33}, + {0, 18, 41}, + {0, 42, 23}, + {0, 43, 6}, + {0, 34, 44}, + {0, 1, 45}, + {0, 31, 14}, + {0, 47, 46}, + {0, 48, 2}, + {0, 12, 21}, + {0, 49, 30}, + {0, 37, 50}, + {0, 51, 20}, + {0, 5, 24}, + {0, 40, 16}, + {0, 29, 13}, + {0, 26, 52}, + {0, 53, 17}, + {0, 36, 54}, + {0, 55, 28}, + {0, 57, 56}, + {0, 19, 25}, + {0, 39, 8}, + {0, 32, 58}, + {0, 59, 27}, + {0, 22, 10}, + {0, 35, 60}, + {0, 62, 61}, + {0, 63, 7}, + {0, 65, 64}, + {0, 4, 66}, + {0, 68, 67}, + {0, 11, 3}, + {0, 15, 69}, + {0, 9, 70}, + {0, 72, 71}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + })); + + codecs.emplace(SpvOpFAdd, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(55, { + {0, 0, 0}, + {65556, 0, 0}, + {65562, 0, 0}, + {131073, 0, 0}, + {131094, 0, 0}, + {131105, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262177, 0, 0}, + {262188, 0, 0}, + {262198, 0, 0}, + {327713, 0, 0}, + {327724, 0, 0}, + {393249, 0, 0}, + {393260, 0, 0}, + {458785, 0, 0}, + {524313, 0, 0}, + {524321, 0, 0}, + {589857, 0, 0}, + {655393, 0, 0}, + {720929, 0, 0}, + {852001, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 26, 24}, + {0, 29, 27}, + {0, 4, 30}, + {0, 21, 9}, + {0, 31, 20}, + {0, 33, 32}, + {0, 34, 3}, + {0, 8, 35}, + {0, 36, 5}, + {0, 23, 16}, + {0, 38, 37}, + {0, 25, 2}, + {0, 39, 1}, + {0, 17, 40}, + {0, 41, 15}, + {0, 18, 42}, + {0, 43, 6}, + {0, 44, 14}, + {0, 28, 19}, + {0, 7, 45}, + {0, 46, 22}, + {0, 48, 47}, + {0, 49, 11}, + {0, 51, 50}, + {0, 12, 10}, + {0, 53, 52}, + {0, 13, 54}, + })); + + codecs.emplace(SpvOpTypePointer, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(57, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {262328, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 9, 23}, + {0, 1, 30}, + {0, 5, 31}, + {0, 32, 28}, + {0, 33, 25}, + {0, 34, 29}, + {0, 18, 24}, + {0, 27, 16}, + {0, 7, 13}, + {0, 14, 35}, + {0, 20, 10}, + {0, 36, 21}, + {0, 2, 37}, + {0, 38, 3}, + {0, 39, 22}, + {0, 40, 19}, + {0, 41, 11}, + {0, 6, 4}, + {0, 12, 42}, + {0, 43, 8}, + {0, 15, 26}, + {0, 45, 44}, + {0, 47, 46}, + {0, 48, 17}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 56, 55}, + })); + + codecs.emplace(SpvOpFSub, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {65785, 0, 0}, + {131134, 0, 0}, + {196719, 0, 0}, + {262209, 0, 0}, + {262276, 0, 0}, + {327745, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 4}, + {0, 2, 8}, + {0, 1, 9}, + {0, 5, 10}, + {0, 3, 6}, + {0, 12, 11}, + })); + + codecs.emplace(SpvOpIAdd, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(83, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196669, 0, 0}, + {196732, 0, 0}, + {196735, 0, 0}, + {262209, 0, 0}, + {262221, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262230, 0, 0}, + {262231, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {262328, 0, 0}, + {262334, 0, 0}, + {262340, 0, 0}, + {327692, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393297, 0, 0}, + {393298, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {458840, 0, 0}, + {458842, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 25, 2}, + {0, 31, 43}, + {0, 4, 44}, + {0, 26, 45}, + {0, 39, 46}, + {0, 34, 36}, + {0, 19, 47}, + {0, 6, 48}, + {0, 35, 9}, + {0, 12, 29}, + {0, 21, 49}, + {0, 22, 13}, + {0, 17, 50}, + {0, 23, 51}, + {0, 52, 7}, + {0, 37, 1}, + {0, 53, 3}, + {0, 54, 24}, + {0, 56, 55}, + {0, 32, 57}, + {0, 59, 58}, + {0, 42, 10}, + {0, 60, 8}, + {0, 5, 41}, + {0, 61, 20}, + {0, 62, 38}, + {0, 64, 63}, + {0, 40, 65}, + {0, 66, 18}, + {0, 15, 28}, + {0, 14, 67}, + {0, 68, 30}, + {0, 70, 69}, + {0, 72, 71}, + {0, 73, 27}, + {0, 16, 74}, + {0, 75, 33}, + {0, 77, 76}, + {0, 79, 78}, + {0, 81, 80}, + {0, 82, 11}, + })); + + codecs.emplace(SpvOpCompositeExtract, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(29, { + {0, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {262209, 0, 0}, + {262225, 0, 0}, + {262273, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393295, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 10, 6}, + {0, 16, 13}, + {0, 7, 17}, + {0, 15, 18}, + {0, 19, 12}, + {0, 20, 14}, + {0, 1, 4}, + {0, 22, 21}, + {0, 11, 8}, + {0, 2, 5}, + {0, 9, 23}, + {0, 3, 24}, + {0, 26, 25}, + {0, 28, 27}, + })); + + codecs.emplace(SpvOpVectorTimesMatrix, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {65784, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(SpvOpBranch, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {262198, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(SpvOpFunctionEnd, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {65784, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(SpvOpBranchConditional, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(53, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196665, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {393228, 0, 0}, + {393295, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 25, 16}, + {0, 21, 28}, + {0, 18, 23}, + {0, 4, 29}, + {0, 10, 5}, + {0, 1, 30}, + {0, 32, 31}, + {0, 22, 33}, + {0, 34, 8}, + {0, 35, 15}, + {0, 13, 36}, + {0, 26, 17}, + {0, 38, 37}, + {0, 39, 11}, + {0, 40, 14}, + {0, 12, 27}, + {0, 19, 41}, + {0, 24, 42}, + {0, 44, 43}, + {0, 45, 7}, + {0, 20, 46}, + {0, 9, 47}, + {0, 48, 2}, + {0, 50, 49}, + {0, 6, 3}, + {0, 52, 51}, + })); + + codecs.emplace(SpvOpFunctionCall, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(71, { + {0, 0, 0}, + {65556, 0, 0}, + {65562, 0, 0}, + {131073, 0, 0}, + {131094, 0, 0}, + {131099, 0, 0}, + {131134, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196651, 0, 0}, + {196665, 0, 0}, + {196667, 0, 0}, + {196669, 0, 0}, + {262188, 0, 0}, + {262198, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262225, 0, 0}, + {262275, 0, 0}, + {262280, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327724, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {393228, 0, 0}, + {393260, 0, 0}, + {393273, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {458831, 0, 0}, + {524313, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 22, 4}, + {0, 32, 23}, + {0, 37, 30}, + {0, 21, 38}, + {0, 39, 31}, + {0, 41, 40}, + {0, 13, 42}, + {0, 43, 26}, + {0, 10, 44}, + {0, 28, 45}, + {0, 35, 18}, + {0, 20, 46}, + {0, 33, 47}, + {0, 24, 48}, + {0, 6, 49}, + {0, 3, 50}, + {0, 16, 51}, + {0, 27, 52}, + {0, 53, 1}, + {0, 9, 17}, + {0, 29, 54}, + {0, 19, 2}, + {0, 8, 36}, + {0, 55, 34}, + {0, 25, 56}, + {0, 7, 57}, + {0, 5, 58}, + {0, 60, 59}, + {0, 61, 15}, + {0, 63, 62}, + {0, 65, 64}, + {0, 66, 11}, + {0, 12, 67}, + {0, 69, 68}, + {0, 14, 70}, + })); + + codecs.emplace(SpvOpVariable, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(SpvOpAccessChain, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(73, { + {0, 0, 0}, + {252, 0, 0}, + {253, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131073, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196665, 0, 0}, + {196667, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {196854, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262221, 0, 0}, + {262225, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262276, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {262321, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393298, 0, 0}, + {393461, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 28, 5}, + {0, 30, 8}, + {0, 13, 38}, + {0, 40, 39}, + {0, 41, 26}, + {0, 42, 19}, + {0, 43, 29}, + {0, 23, 44}, + {0, 36, 32}, + {0, 45, 22}, + {0, 2, 46}, + {0, 21, 20}, + {0, 48, 47}, + {0, 33, 49}, + {0, 4, 50}, + {0, 51, 24}, + {0, 18, 11}, + {0, 52, 12}, + {0, 25, 15}, + {0, 53, 17}, + {0, 37, 54}, + {0, 55, 35}, + {0, 7, 27}, + {0, 57, 56}, + {0, 58, 31}, + {0, 6, 59}, + {0, 1, 60}, + {0, 62, 61}, + {0, 63, 14}, + {0, 3, 16}, + {0, 34, 64}, + {0, 66, 65}, + {0, 68, 67}, + {0, 70, 69}, + {0, 10, 9}, + {0, 72, 71}, + })); + + codecs.emplace(SpvOpLabel, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {56, 0, 0}, + {65784, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 1, 4}, + })); + + codecs.emplace(SpvOpReturn, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {65784, 0, 0}, + {131127, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(SpvOpFunction, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(31, { + {0, 0, 0}, + {65556, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262177, 0, 0}, + {262188, 0, 0}, + {262198, 0, 0}, + {327713, 0, 0}, + {393260, 0, 0}, + {524313, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 12, 1}, + {0, 13, 5}, + {0, 18, 17}, + {0, 7, 19}, + {0, 9, 20}, + {0, 16, 21}, + {0, 15, 10}, + {0, 22, 4}, + {0, 24, 23}, + {0, 25, 14}, + {0, 8, 11}, + {0, 2, 26}, + {0, 28, 27}, + {0, 3, 6}, + {0, 30, 29}, + })); + + codecs.emplace(SpvOpTypeVector, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {65784, 0, 0}, + {131127, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 4, 1}, + })); + + codecs.emplace(SpvOpFunctionParameter, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {56, 0, 0}, + {65784, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 1, 4}, + })); + + codecs.emplace(SpvOpReturnValue, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {131105, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(SpvOpTypeVoid, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(89, { + {0, 0, 0}, + {253, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196665, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {458764, 0, 0}, + {458809, 0, 0}, + {458831, 0, 0}, + {524345, 0, 0}, + {524367, 0, 0}, + {589881, 0, 0}, + {655417, 0, 0}, + {720953, 0, 0}, + {786489, 0, 0}, + {852025, 0, 0}, + {917561, 0, 0}, + {983097, 0, 0}, + {1114169, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 40, 32}, + {0, 46, 29}, + {0, 38, 27}, + {0, 20, 47}, + {0, 49, 48}, + {0, 50, 44}, + {0, 51, 43}, + {0, 14, 5}, + {0, 42, 52}, + {0, 13, 19}, + {0, 3, 26}, + {0, 54, 53}, + {0, 56, 55}, + {0, 57, 6}, + {0, 39, 37}, + {0, 15, 58}, + {0, 18, 31}, + {0, 59, 21}, + {0, 60, 17}, + {0, 61, 41}, + {0, 62, 24}, + {0, 34, 63}, + {0, 35, 64}, + {0, 65, 8}, + {0, 66, 36}, + {0, 67, 30}, + {0, 16, 11}, + {0, 69, 68}, + {0, 70, 28}, + {0, 22, 71}, + {0, 33, 72}, + {0, 45, 73}, + {0, 75, 74}, + {0, 77, 76}, + {0, 78, 12}, + {0, 1, 2}, + {0, 9, 79}, + {0, 25, 80}, + {0, 23, 81}, + {0, 4, 82}, + {0, 84, 83}, + {0, 86, 85}, + {0, 7, 10}, + {0, 88, 87}, + })); + + codecs.emplace(SpvOpStore, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {131075, 0, 0}, + {131088, 0, 0}, + {131143, 0, 0}, + {196624, 0, 0}, + {196679, 0, 0}, + {262216, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 8}, + {0, 7, 9}, + {0, 6, 10}, + {0, 5, 11}, + {0, 2, 12}, + })); + + codecs.emplace(SpvOpEntryPoint, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(97, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196665, 0, 0}, + {196669, 0, 0}, + {196732, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262230, 0, 0}, + {262231, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262276, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {262326, 0, 0}, + {262328, 0, 0}, + {262330, 0, 0}, + {327692, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393297, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458809, 0, 0}, + {458817, 0, 0}, + {458831, 0, 0}, + {458840, 0, 0}, + {524345, 0, 0}, + {524367, 0, 0}, + {589881, 0, 0}, + {720953, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 42, 47}, + {0, 48, 50}, + {0, 45, 51}, + {0, 34, 52}, + {0, 53, 41}, + {0, 1, 54}, + {0, 55, 5}, + {0, 15, 4}, + {0, 56, 35}, + {0, 26, 24}, + {0, 18, 28}, + {0, 57, 38}, + {0, 59, 58}, + {0, 60, 25}, + {0, 20, 9}, + {0, 7, 61}, + {0, 62, 22}, + {0, 11, 31}, + {0, 63, 8}, + {0, 64, 40}, + {0, 66, 65}, + {0, 27, 44}, + {0, 29, 67}, + {0, 68, 39}, + {0, 69, 2}, + {0, 37, 49}, + {0, 71, 70}, + {0, 30, 72}, + {0, 73, 17}, + {0, 33, 74}, + {0, 23, 14}, + {0, 32, 75}, + {0, 21, 76}, + {0, 77, 16}, + {0, 46, 78}, + {0, 13, 79}, + {0, 80, 12}, + {0, 19, 81}, + {0, 43, 36}, + {0, 83, 82}, + {0, 10, 84}, + {0, 85, 3}, + {0, 6, 86}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + {0, 96, 95}, + })); + + codecs.emplace(SpvOpLoad, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(47, { + {0, 0, 0}, + {262159, 0, 0}, + {327695, 0, 0}, + {393231, 0, 0}, + {458767, 0, 0}, + {524303, 0, 0}, + {589839, 0, 0}, + {655375, 0, 0}, + {720911, 0, 0}, + {786447, 0, 0}, + {851983, 0, 0}, + {917519, 0, 0}, + {983055, 0, 0}, + {1048591, 0, 0}, + {1114127, 0, 0}, + {1179663, 0, 0}, + {1245199, 0, 0}, + {1310735, 0, 0}, + {1376271, 0, 0}, + {1441807, 0, 0}, + {1507343, 0, 0}, + {1572879, 0, 0}, + {1638415, 0, 0}, + {1703951, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 23}, + {0, 22, 25}, + {0, 21, 26}, + {0, 6, 20}, + {0, 19, 27}, + {0, 29, 28}, + {0, 24, 18}, + {0, 30, 13}, + {0, 31, 14}, + {0, 32, 7}, + {0, 17, 15}, + {0, 33, 2}, + {0, 34, 8}, + {0, 16, 12}, + {0, 35, 3}, + {0, 36, 5}, + {0, 9, 37}, + {0, 39, 38}, + {0, 11, 40}, + {0, 4, 10}, + {0, 42, 41}, + {0, 44, 43}, + {0, 46, 45}, + })); + + codecs.emplace(SpvOpMemoryModel, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {196631, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 4, 5}, + {0, 1, 6}, + })); + + codecs.emplace(SpvOpTypeFloat, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(69, { + {0, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262289, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {327849, 0, 0}, + {393228, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458809, 0, 0}, + {458831, 0, 0}, + {524345, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 33, 10}, + {0, 31, 36}, + {0, 26, 37}, + {0, 5, 38}, + {0, 20, 39}, + {0, 22, 40}, + {0, 24, 25}, + {0, 15, 41}, + {0, 9, 17}, + {0, 1, 42}, + {0, 4, 43}, + {0, 35, 44}, + {0, 34, 45}, + {0, 19, 46}, + {0, 7, 29}, + {0, 16, 47}, + {0, 48, 32}, + {0, 49, 27}, + {0, 11, 14}, + {0, 18, 28}, + {0, 23, 50}, + {0, 51, 12}, + {0, 52, 21}, + {0, 6, 53}, + {0, 55, 54}, + {0, 57, 56}, + {0, 3, 58}, + {0, 13, 59}, + {0, 60, 8}, + {0, 30, 61}, + {0, 62, 2}, + {0, 64, 63}, + {0, 66, 65}, + {0, 68, 67}, + })); + + codecs.emplace(SpvOpCompositeConstruct, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(39, { + {0, 0, 0}, + {65556, 0, 0}, + {131094, 0, 0}, + {131105, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {262177, 0, 0}, + {327713, 0, 0}, + {393249, 0, 0}, + {458785, 0, 0}, + {524313, 0, 0}, + {524321, 0, 0}, + {589857, 0, 0}, + {655393, 0, 0}, + {786465, 0, 0}, + {917537, 0, 0}, + {1048609, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 19, 18}, + {0, 21, 15}, + {0, 1, 22}, + {0, 16, 23}, + {0, 14, 24}, + {0, 20, 25}, + {0, 13, 17}, + {0, 3, 26}, + {0, 6, 11}, + {0, 27, 12}, + {0, 4, 28}, + {0, 29, 10}, + {0, 9, 30}, + {0, 7, 31}, + {0, 33, 32}, + {0, 34, 5}, + {0, 8, 35}, + {0, 2, 36}, + {0, 38, 37}, + })); + + codecs.emplace(SpvOpTypeFunction, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {131086, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(SpvOpExtInstImport, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {131099, 0, 0}, + {196640, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(SpvOpTypeImage, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {131143, 0, 0}, + {196679, 0, 0}, + {196680, 0, 0}, + {262216, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 2}, + {0, 3, 6}, + {0, 7, 1}, + {0, 4, 8}, + })); + + codecs.emplace(SpvOpMemberDecorate, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {65553, 0, 0}, + {131083, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(SpvOpCapability, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(17, { + {0, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196640, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {327713, 0, 0}, + {458785, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 8}, + {0, 1, 10}, + {0, 6, 11}, + {0, 9, 12}, + {0, 4, 13}, + {0, 3, 14}, + {0, 15, 2}, + {0, 5, 16}, + })); + + codecs.emplace(SpvOpTypeInt, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(29, { + {0, 0, 0}, + {65556, 0, 0}, + {131073, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262188, 0, 0}, + {262198, 0, 0}, + {327724, 0, 0}, + {393260, 0, 0}, + {524313, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 6}, + {0, 16, 3}, + {0, 11, 17}, + {0, 5, 18}, + {0, 15, 19}, + {0, 13, 20}, + {0, 1, 4}, + {0, 12, 21}, + {0, 7, 22}, + {0, 14, 23}, + {0, 24, 10}, + {0, 25, 9}, + {0, 27, 26}, + {0, 8, 28}, + })); + + codecs.emplace(SpvOpConstantComposite, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {65556, 0, 0}, + {196631, 0, 0}, + {196640, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {327724, 0, 0}, + {393260, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 7}, + {0, 1, 9}, + {0, 10, 8}, + {0, 2, 11}, + {0, 5, 12}, + {0, 13, 4}, + {0, 3, 14}, + })); + + codecs.emplace(SpvOpTypeSampledImage, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(21, { + {0, 0, 0}, + {131073, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262198, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 11, 12}, + {0, 8, 13}, + {0, 7, 14}, + {0, 4, 10}, + {0, 9, 2}, + {0, 16, 15}, + {0, 1, 17}, + {0, 19, 18}, + {0, 6, 20}, + })); + + codecs.emplace(SpvOpTypeStruct, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(49, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 20, 12}, + {0, 26, 24}, + {0, 21, 27}, + {0, 28, 16}, + {0, 10, 8}, + {0, 30, 29}, + {0, 31, 17}, + {0, 32, 13}, + {0, 25, 6}, + {0, 1, 33}, + {0, 14, 11}, + {0, 3, 34}, + {0, 18, 35}, + {0, 37, 36}, + {0, 23, 5}, + {0, 38, 2}, + {0, 39, 7}, + {0, 4, 9}, + {0, 40, 19}, + {0, 42, 41}, + {0, 43, 22}, + {0, 45, 44}, + {0, 46, 15}, + {0, 48, 47}, + })); + + codecs.emplace(SpvOpFNegate, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {65555, 0, 0}, + {131143, 0, 0}, + {196679, 0, 0}, + {196680, 0, 0}, + {262216, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 6}, + {0, 1, 2}, + {0, 8, 7}, + {0, 5, 9}, + {0, 3, 10}, + })); + + codecs.emplace(SpvOpDecorate, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(25, { + {0, 0, 0}, + {65562, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262177, 0, 0}, + {262198, 0, 0}, + {327713, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 12, 11}, + {0, 9, 14}, + {0, 10, 15}, + {0, 13, 16}, + {0, 4, 17}, + {0, 2, 1}, + {0, 18, 7}, + {0, 20, 19}, + {0, 21, 3}, + {0, 22, 6}, + {0, 5, 8}, + {0, 24, 23}, + })); + + codecs.emplace(SpvOpTypeMatrix, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(31, { + {0, 0, 0}, + {65556, 0, 0}, + {131073, 0, 0}, + {131094, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262188, 0, 0}, + {262198, 0, 0}, + {327724, 0, 0}, + {393260, 0, 0}, + {524313, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 12, 2}, + {0, 17, 3}, + {0, 5, 18}, + {0, 1, 19}, + {0, 16, 4}, + {0, 21, 20}, + {0, 6, 15}, + {0, 7, 22}, + {0, 24, 23}, + {0, 13, 14}, + {0, 25, 8}, + {0, 26, 11}, + {0, 27, 10}, + {0, 29, 28}, + {0, 30, 9}, + })); + + codecs.emplace(SpvOpConstant, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(33, { + {0, 0, 0}, + {131113, 0, 0}, + {196629, 0, 0}, + {196631, 0, 0}, + {196632, 0, 0}, + {196640, 0, 0}, + {196641, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {262188, 0, 0}, + {262198, 0, 0}, + {327713, 0, 0}, + {327724, 0, 0}, + {393249, 0, 0}, + {393260, 0, 0}, + {524313, 0, 0}, + {524321, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 4}, + {0, 13, 11}, + {0, 16, 15}, + {0, 18, 10}, + {0, 20, 19}, + {0, 21, 2}, + {0, 23, 22}, + {0, 8, 24}, + {0, 9, 25}, + {0, 17, 26}, + {0, 14, 27}, + {0, 12, 28}, + {0, 1, 3}, + {0, 5, 29}, + {0, 30, 7}, + {0, 32, 31}, + })); + + codecs.emplace(SpvOpTypeBool, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {196636, 0, 0}, + {196640, 0, 0}, + {196651, 0, 0}, + {196667, 0, 0}, + {524313, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 5}, + {0, 3, 7}, + {0, 2, 8}, + {0, 6, 9}, + {0, 1, 10}, + })); + + codecs.emplace(SpvOpTypeArray, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(67, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {262334, 0, 0}, + {327692, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 27}, + {0, 11, 28}, + {0, 35, 21}, + {0, 36, 1}, + {0, 4, 37}, + {0, 39, 38}, + {0, 40, 30}, + {0, 41, 12}, + {0, 19, 42}, + {0, 13, 43}, + {0, 16, 44}, + {0, 45, 22}, + {0, 34, 18}, + {0, 29, 24}, + {0, 46, 25}, + {0, 6, 2}, + {0, 9, 31}, + {0, 17, 47}, + {0, 49, 48}, + {0, 50, 33}, + {0, 51, 26}, + {0, 20, 52}, + {0, 32, 53}, + {0, 3, 54}, + {0, 15, 14}, + {0, 23, 55}, + {0, 8, 56}, + {0, 58, 57}, + {0, 10, 59}, + {0, 5, 60}, + {0, 62, 61}, + {0, 64, 63}, + {0, 66, 65}, + })); + + codecs.emplace(SpvOpExtInst, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(57, { + {0, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196665, 0, 0}, + {196669, 0, 0}, + {196718, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393303, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 18, 6}, + {0, 30, 22}, + {0, 31, 25}, + {0, 10, 32}, + {0, 21, 33}, + {0, 3, 34}, + {0, 35, 5}, + {0, 23, 36}, + {0, 14, 17}, + {0, 37, 26}, + {0, 1, 38}, + {0, 29, 39}, + {0, 13, 40}, + {0, 41, 19}, + {0, 28, 20}, + {0, 16, 42}, + {0, 27, 43}, + {0, 8, 24}, + {0, 7, 44}, + {0, 9, 45}, + {0, 15, 46}, + {0, 12, 47}, + {0, 48, 2}, + {0, 4, 49}, + {0, 51, 50}, + {0, 11, 52}, + {0, 54, 53}, + {0, 56, 55}, + })); + + codecs.emplace(SpvOpVectorTimesScalar, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(67, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262230, 0, 0}, + {262231, 0, 0}, + {262272, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327737, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393273, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393303, 0, 0}, + {393304, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 26, 29}, + {0, 20, 35}, + {0, 12, 36}, + {0, 6, 37}, + {0, 38, 28}, + {0, 30, 5}, + {0, 8, 39}, + {0, 2, 40}, + {0, 41, 21}, + {0, 1, 10}, + {0, 43, 42}, + {0, 23, 16}, + {0, 44, 33}, + {0, 34, 31}, + {0, 14, 45}, + {0, 19, 46}, + {0, 25, 47}, + {0, 49, 48}, + {0, 27, 22}, + {0, 7, 50}, + {0, 17, 32}, + {0, 18, 51}, + {0, 24, 52}, + {0, 54, 53}, + {0, 55, 9}, + {0, 56, 11}, + {0, 57, 4}, + {0, 15, 58}, + {0, 59, 13}, + {0, 60, 3}, + {0, 62, 61}, + {0, 64, 63}, + {0, 66, 65}, + })); + + codecs.emplace(SpvOpVectorShuffle, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(33, { + {0, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {262201, 0, 0}, + {262209, 0, 0}, + {262225, 0, 0}, + {262231, 0, 0}, + {262273, 0, 0}, + {262277, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {327745, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {458831, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 13, 12}, + {0, 1, 18}, + {0, 19, 11}, + {0, 9, 20}, + {0, 10, 21}, + {0, 22, 15}, + {0, 23, 8}, + {0, 4, 24}, + {0, 25, 7}, + {0, 17, 26}, + {0, 5, 27}, + {0, 14, 3}, + {0, 29, 28}, + {0, 30, 2}, + {0, 6, 31}, + {0, 32, 16}, + })); + + codecs.emplace(SpvOpImageSampleImplicitLod, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(55, { + {0, 0, 0}, + {65785, 0, 0}, + {65790, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {196817, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262292, 0, 0}, + {327692, 0, 0}, + {327745, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393281, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393298, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 2}, + {0, 22, 29}, + {0, 30, 1}, + {0, 6, 31}, + {0, 9, 32}, + {0, 28, 3}, + {0, 27, 33}, + {0, 20, 16}, + {0, 34, 8}, + {0, 10, 35}, + {0, 4, 36}, + {0, 24, 23}, + {0, 21, 13}, + {0, 7, 37}, + {0, 38, 14}, + {0, 25, 39}, + {0, 17, 11}, + {0, 12, 19}, + {0, 41, 40}, + {0, 42, 18}, + {0, 15, 43}, + {0, 45, 44}, + {0, 47, 46}, + {0, 26, 48}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + })); + + codecs.emplace(SpvOpDot, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {131075, 0, 0}, + {131088, 0, 0}, + {196624, 0, 0}, + {196679, 0, 0}, + {262216, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 3}, + {0, 2, 7}, + {0, 1, 8}, + {0, 6, 9}, + {0, 4, 10}, + })); + + codecs.emplace(SpvOpExecutionMode, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {196858, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(SpvOpSelectionMerge, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(23, { + {0, 0, 0}, + {131134, 0, 0}, + {196669, 0, 0}, + {262209, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262277, 0, 0}, + {327745, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 12}, + {0, 7, 13}, + {0, 5, 1}, + {0, 4, 10}, + {0, 14, 6}, + {0, 16, 15}, + {0, 17, 11}, + {0, 3, 8}, + {0, 19, 18}, + {0, 9, 20}, + {0, 22, 21}, + })); + + codecs.emplace(SpvOpImageSampleDrefExplicitLod, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {65790, 0, 0}, + {131073, 0, 0}, + {262198, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 1}, + {0, 3, 5}, + {0, 2, 6}, + })); + + codecs.emplace(SpvOpUndef, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(59, { + {0, 0, 0}, + {65785, 0, 0}, + {131134, 0, 0}, + {131319, 0, 0}, + {196669, 0, 0}, + {196735, 0, 0}, + {262209, 0, 0}, + {262221, 0, 0}, + {262224, 0, 0}, + {262225, 0, 0}, + {262230, 0, 0}, + {262273, 0, 0}, + {262275, 0, 0}, + {262277, 0, 0}, + {262280, 0, 0}, + {262286, 0, 0}, + {262288, 0, 0}, + {262292, 0, 0}, + {262334, 0, 0}, + {327692, 0, 0}, + {327760, 0, 0}, + {327761, 0, 0}, + {327762, 0, 0}, + {393228, 0, 0}, + {393295, 0, 0}, + {393296, 0, 0}, + {393298, 0, 0}, + {458764, 0, 0}, + {458831, 0, 0}, + {524367, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 17, 3}, + {0, 5, 31}, + {0, 11, 32}, + {0, 33, 12}, + {0, 34, 20}, + {0, 16, 27}, + {0, 35, 23}, + {0, 37, 36}, + {0, 14, 18}, + {0, 39, 38}, + {0, 7, 30}, + {0, 8, 25}, + {0, 40, 15}, + {0, 13, 2}, + {0, 1, 29}, + {0, 19, 41}, + {0, 43, 42}, + {0, 28, 44}, + {0, 46, 45}, + {0, 22, 21}, + {0, 47, 24}, + {0, 48, 26}, + {0, 10, 6}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 4, 9}, + {0, 56, 55}, + {0, 58, 57}, + })); + + codecs.emplace(SpvOpCompositeInsert, std::move(codec)); + } + + return codecs; +} + +std::map>> +GetLiteralStringHuffmanCodecs() { + std::map>> codecs; + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {"", 0, 0}, + {"MainPs", 0, 0}, + {"MainVs", 0, 0}, + {"kMarkvNoneOfTheAbove", 0, 0}, + {"main", 0, 0}, + {"", 2, 3}, + {"", 1, 5}, + {"", 4, 6}, + })); + + codecs.emplace(SpvOpEntryPoint, std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {"", 0, 0}, + {"GLSL.std.450", 0, 0}, + {"kMarkvNoneOfTheAbove", 0, 0}, + {"", 1, 2}, + })); + + codecs.emplace(SpvOpExtInstImport, std::move(codec)); + } + + return codecs; +} + +std::map, std::unique_ptr>> +GetNonIdWordHuffmanCodecs() { + std::map, std::unique_ptr>> codecs; + { + std::unique_ptr> codec(new HuffmanCodec(33, { + {0, 0, 0}, + {4, 0, 0}, + {8, 0, 0}, + {10, 0, 0}, + {26, 0, 0}, + {29, 0, 0}, + {31, 0, 0}, + {37, 0, 0}, + {40, 0, 0}, + {43, 0, 0}, + {46, 0, 0}, + {49, 0, 0}, + {66, 0, 0}, + {67, 0, 0}, + {68, 0, 0}, + {69, 0, 0}, + {71, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 12, 5}, + {0, 18, 13}, + {0, 3, 7}, + {0, 19, 11}, + {0, 20, 16}, + {0, 14, 17}, + {0, 21, 1}, + {0, 2, 6}, + {0, 23, 22}, + {0, 4, 24}, + {0, 26, 25}, + {0, 28, 27}, + {0, 10, 15}, + {0, 8, 9}, + {0, 30, 29}, + {0, 32, 31}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {0, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpMemoryModel, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpMemoryModel, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {0, 0, 0}, + {4, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(std::pair(SpvOpEntryPoint, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpExecutionMode, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {18, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 2}, + {0, 6, 5}, + {0, 7, 1}, + {0, 3, 8}, + {0, 10, 9}, + })); + + codecs.emplace(std::pair(SpvOpExecutionMode, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1, 0, 0}, + {32, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpCapability, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {32, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeInt, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeInt, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {32, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeFloat, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 4}, + {0, 1, 5}, + {0, 6, 3}, + })); + + codecs.emplace(std::pair(SpvOpTypeVector, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 2, 5}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeMatrix, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 2, 5}, + {0, 1, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeImage, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeImage, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {0, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeImage, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {0, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeImage, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeImage, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {0, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeImage, 7), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 7}, + {0, 6, 8}, + {0, 1, 4}, + {0, 2, 9}, + {0, 10, 3}, + {0, 12, 11}, + })); + + codecs.emplace(std::pair(SpvOpTypePointer, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(173, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {9, 0, 0}, + {10, 0, 0}, + {11, 0, 0}, + {12, 0, 0}, + {13, 0, 0}, + {14, 0, 0}, + {15, 0, 0}, + {16, 0, 0}, + {17, 0, 0}, + {18, 0, 0}, + {19, 0, 0}, + {20, 0, 0}, + {21, 0, 0}, + {22, 0, 0}, + {23, 0, 0}, + {24, 0, 0}, + {26, 0, 0}, + {27, 0, 0}, + {28, 0, 0}, + {29, 0, 0}, + {30, 0, 0}, + {31, 0, 0}, + {32, 0, 0}, + {256, 0, 0}, + {507307272, 0, 0}, + {864026611, 0, 0}, + {981668463, 0, 0}, + {997553156, 0, 0}, + {1014330372, 0, 0}, + {1020708227, 0, 0}, + {1028443341, 0, 0}, + {1032953056, 0, 0}, + {1033463938, 0, 0}, + {1033463943, 0, 0}, + {1039998884, 0, 0}, + {1039998950, 0, 0}, + {1040187392, 0, 0}, + {1042401985, 0, 0}, + {1044220635, 0, 0}, + {1045622707, 0, 0}, + {1045622740, 0, 0}, + {1048576000, 0, 0}, + {1053609165, 0, 0}, + {1053790359, 0, 0}, + {1054448026, 0, 0}, + {1055437881, 0, 0}, + {1056300230, 0, 0}, + {1056964608, 0, 0}, + {1058056805, 0, 0}, + {1059286575, 0, 0}, + {1061158912, 0, 0}, + {1061997773, 0, 0}, + {1064514355, 0, 0}, + {1064854933, 0, 0}, + {1065353216, 0, 0}, + {1069547520, 0, 0}, + {1073741824, 0, 0}, + {1077936128, 0, 0}, + {1082130432, 0, 0}, + {1091567616, 0, 0}, + {1115422720, 0, 0}, + {1124073472, 0, 0}, + {1132396544, 0, 0}, + {1140850688, 0, 0}, + {1199562752, 0, 0}, + {3179067684, 0, 0}, + {3180973575, 0, 0}, + {3182651297, 0, 0}, + {3196448879, 0, 0}, + {3204448256, 0, 0}, + {3204993516, 0, 0}, + {3205248529, 0, 0}, + {3207137644, 0, 0}, + {3208642560, 0, 0}, + {3211081967, 0, 0}, + {3212836864, 0, 0}, + {3332128768, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 38, 37}, + {0, 42, 39}, + {0, 49, 44}, + {0, 45, 43}, + {0, 26, 50}, + {0, 46, 73}, + {0, 35, 28}, + {0, 32, 65}, + {0, 83, 40}, + {0, 60, 62}, + {0, 27, 54}, + {0, 79, 67}, + {0, 31, 74}, + {0, 51, 12}, + {0, 70, 30}, + {0, 15, 16}, + {0, 88, 25}, + {0, 90, 89}, + {0, 34, 71}, + {0, 72, 29}, + {0, 92, 91}, + {0, 14, 33}, + {0, 94, 93}, + {0, 22, 23}, + {0, 21, 95}, + {0, 19, 24}, + {0, 96, 13}, + {0, 47, 41}, + {0, 53, 48}, + {0, 58, 56}, + {0, 63, 59}, + {0, 76, 75}, + {0, 78, 77}, + {0, 81, 80}, + {0, 84, 82}, + {0, 52, 20}, + {0, 97, 69}, + {0, 99, 98}, + {0, 18, 10}, + {0, 68, 61}, + {0, 17, 100}, + {0, 102, 101}, + {0, 11, 36}, + {0, 104, 103}, + {0, 86, 105}, + {0, 107, 106}, + {0, 109, 108}, + {0, 110, 9}, + {0, 8, 111}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 126, 7}, + {0, 127, 85}, + {0, 6, 128}, + {0, 129, 55}, + {0, 130, 5}, + {0, 132, 131}, + {0, 134, 133}, + {0, 136, 135}, + {0, 137, 66}, + {0, 139, 138}, + {0, 141, 140}, + {0, 143, 142}, + {0, 145, 144}, + {0, 146, 57}, + {0, 147, 64}, + {0, 148, 4}, + {0, 149, 2}, + {0, 151, 150}, + {0, 152, 3}, + {0, 154, 153}, + {0, 156, 155}, + {0, 158, 157}, + {0, 159, 1}, + {0, 160, 87}, + {0, 162, 161}, + {0, 164, 163}, + {0, 166, 165}, + {0, 168, 167}, + {0, 170, 169}, + {0, 172, 171}, + })); + + codecs.emplace(std::pair(SpvOpConstant, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {0, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpFunction, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 7}, + {0, 4, 8}, + {0, 9, 2}, + {0, 1, 5}, + {0, 10, 6}, + {0, 12, 11}, + })); + + codecs.emplace(std::pair(SpvOpVariable, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {0, 0, 0}, + {2, 0, 0}, + {6, 0, 0}, + {11, 0, 0}, + {30, 0, 0}, + {33, 0, 0}, + {34, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 8}, + {0, 9, 1}, + {0, 3, 10}, + {0, 6, 11}, + {0, 12, 2}, + {0, 7, 5}, + {0, 14, 13}, + })); + + codecs.emplace(std::pair(SpvOpDecorate, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(37, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {9, 0, 0}, + {10, 0, 0}, + {12, 0, 0}, + {13, 0, 0}, + {14, 0, 0}, + {15, 0, 0}, + {16, 0, 0}, + {18, 0, 0}, + {64, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 17, 11}, + {0, 10, 13}, + {0, 12, 14}, + {0, 21, 20}, + {0, 9, 22}, + {0, 19, 15}, + {0, 8, 23}, + {0, 18, 24}, + {0, 25, 7}, + {0, 5, 6}, + {0, 26, 16}, + {0, 27, 4}, + {0, 28, 3}, + {0, 30, 29}, + {0, 31, 2}, + {0, 33, 32}, + {0, 35, 34}, + {0, 1, 36}, + })); + + codecs.emplace(std::pair(SpvOpDecorate, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(79, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {9, 0, 0}, + {10, 0, 0}, + {11, 0, 0}, + {12, 0, 0}, + {13, 0, 0}, + {14, 0, 0}, + {15, 0, 0}, + {16, 0, 0}, + {17, 0, 0}, + {18, 0, 0}, + {19, 0, 0}, + {20, 0, 0}, + {21, 0, 0}, + {22, 0, 0}, + {23, 0, 0}, + {24, 0, 0}, + {25, 0, 0}, + {26, 0, 0}, + {27, 0, 0}, + {28, 0, 0}, + {29, 0, 0}, + {30, 0, 0}, + {31, 0, 0}, + {32, 0, 0}, + {33, 0, 0}, + {34, 0, 0}, + {35, 0, 0}, + {36, 0, 0}, + {37, 0, 0}, + {38, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 39, 37}, + {0, 40, 36}, + {0, 34, 35}, + {0, 32, 33}, + {0, 30, 31}, + {0, 27, 29}, + {0, 26, 28}, + {0, 42, 41}, + {0, 23, 25}, + {0, 38, 22}, + {0, 44, 43}, + {0, 46, 45}, + {0, 21, 47}, + {0, 19, 20}, + {0, 17, 18}, + {0, 14, 15}, + {0, 12, 10}, + {0, 16, 13}, + {0, 9, 11}, + {0, 7, 8}, + {0, 6, 5}, + {0, 24, 48}, + {0, 50, 49}, + {0, 3, 4}, + {0, 51, 2}, + {0, 1, 52}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 60, 59}, + {0, 62, 61}, + {0, 64, 63}, + {0, 66, 65}, + {0, 68, 67}, + {0, 70, 69}, + {0, 72, 71}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + })); + + codecs.emplace(std::pair(SpvOpMemberDecorate, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {4, 0, 0}, + {7, 0, 0}, + {35, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 5, 2}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpMemberDecorate, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(149, { + {0, 0, 0}, + {0, 0, 0}, + {16, 0, 0}, + {28, 0, 0}, + {32, 0, 0}, + {36, 0, 0}, + {40, 0, 0}, + {44, 0, 0}, + {48, 0, 0}, + {60, 0, 0}, + {64, 0, 0}, + {76, 0, 0}, + {80, 0, 0}, + {84, 0, 0}, + {88, 0, 0}, + {92, 0, 0}, + {96, 0, 0}, + {100, 0, 0}, + {108, 0, 0}, + {112, 0, 0}, + {120, 0, 0}, + {124, 0, 0}, + {128, 0, 0}, + {132, 0, 0}, + {136, 0, 0}, + {140, 0, 0}, + {144, 0, 0}, + {148, 0, 0}, + {152, 0, 0}, + {156, 0, 0}, + {160, 0, 0}, + {172, 0, 0}, + {176, 0, 0}, + {192, 0, 0}, + {204, 0, 0}, + {208, 0, 0}, + {224, 0, 0}, + {236, 0, 0}, + {240, 0, 0}, + {248, 0, 0}, + {256, 0, 0}, + {272, 0, 0}, + {288, 0, 0}, + {292, 0, 0}, + {296, 0, 0}, + {300, 0, 0}, + {304, 0, 0}, + {316, 0, 0}, + {320, 0, 0}, + {332, 0, 0}, + {336, 0, 0}, + {348, 0, 0}, + {352, 0, 0}, + {364, 0, 0}, + {368, 0, 0}, + {372, 0, 0}, + {376, 0, 0}, + {384, 0, 0}, + {392, 0, 0}, + {400, 0, 0}, + {416, 0, 0}, + {424, 0, 0}, + {432, 0, 0}, + {448, 0, 0}, + {460, 0, 0}, + {464, 0, 0}, + {468, 0, 0}, + {472, 0, 0}, + {476, 0, 0}, + {480, 0, 0}, + {488, 0, 0}, + {492, 0, 0}, + {496, 0, 0}, + {512, 0, 0}, + {640, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 14, 17}, + {0, 37, 31}, + {0, 21, 39}, + {0, 24, 23}, + {0, 5, 13}, + {0, 38, 76}, + {0, 51, 77}, + {0, 55, 53}, + {0, 58, 56}, + {0, 64, 61}, + {0, 67, 66}, + {0, 70, 68}, + {0, 54, 71}, + {0, 62, 60}, + {0, 65, 63}, + {0, 73, 72}, + {0, 59, 57}, + {0, 52, 74}, + {0, 50, 69}, + {0, 49, 47}, + {0, 48, 46}, + {0, 45, 43}, + {0, 42, 44}, + {0, 78, 41}, + {0, 20, 18}, + {0, 80, 79}, + {0, 15, 27}, + {0, 7, 34}, + {0, 81, 6}, + {0, 28, 3}, + {0, 35, 82}, + {0, 9, 36}, + {0, 84, 83}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + {0, 96, 95}, + {0, 98, 97}, + {0, 11, 29}, + {0, 99, 25}, + {0, 100, 40}, + {0, 102, 101}, + {0, 26, 32}, + {0, 19, 30}, + {0, 16, 12}, + {0, 4, 8}, + {0, 104, 103}, + {0, 106, 105}, + {0, 33, 107}, + {0, 109, 108}, + {0, 111, 110}, + {0, 22, 112}, + {0, 113, 10}, + {0, 115, 114}, + {0, 75, 116}, + {0, 118, 117}, + {0, 119, 1}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 127, 126}, + {0, 129, 128}, + {0, 131, 130}, + {0, 132, 2}, + {0, 134, 133}, + {0, 136, 135}, + {0, 138, 137}, + {0, 140, 139}, + {0, 142, 141}, + {0, 144, 143}, + {0, 146, 145}, + {0, 148, 147}, + })); + + codecs.emplace(std::pair(SpvOpMemberDecorate, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 6}, + {0, 4, 7}, + {0, 8, 3}, + {0, 9, 5}, + {0, 1, 10}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 7}, + {0, 8, 5}, + {0, 9, 1}, + {0, 4, 10}, + {0, 11, 6}, + {0, 2, 12}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 8}, + {0, 5, 2}, + {0, 10, 9}, + {0, 1, 4}, + {0, 12, 11}, + {0, 7, 13}, + {0, 3, 14}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 5}, + {0, 9, 7}, + {0, 10, 3}, + {0, 11, 2}, + {0, 6, 1}, + {0, 13, 12}, + {0, 4, 14}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 7), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(61, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {9, 0, 0}, + {10, 0, 0}, + {11, 0, 0}, + {12, 0, 0}, + {13, 0, 0}, + {14, 0, 0}, + {15, 0, 0}, + {16, 0, 0}, + {17, 0, 0}, + {18, 0, 0}, + {19, 0, 0}, + {20, 0, 0}, + {21, 0, 0}, + {22, 0, 0}, + {23, 0, 0}, + {24, 0, 0}, + {27, 0, 0}, + {28, 0, 0}, + {29, 0, 0}, + {30, 0, 0}, + {31, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 30, 16}, + {0, 26, 27}, + {0, 29, 28}, + {0, 18, 22}, + {0, 12, 19}, + {0, 15, 20}, + {0, 14, 23}, + {0, 32, 7}, + {0, 8, 21}, + {0, 11, 33}, + {0, 17, 34}, + {0, 25, 13}, + {0, 36, 35}, + {0, 9, 10}, + {0, 38, 37}, + {0, 39, 31}, + {0, 5, 40}, + {0, 42, 41}, + {0, 44, 43}, + {0, 6, 45}, + {0, 46, 24}, + {0, 48, 47}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 55, 4}, + {0, 56, 3}, + {0, 57, 2}, + {0, 58, 1}, + {0, 60, 59}, + })); + + codecs.emplace(std::pair(SpvOpCompositeExtract, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(63, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {9, 0, 0}, + {10, 0, 0}, + {11, 0, 0}, + {12, 0, 0}, + {13, 0, 0}, + {29, 0, 0}, + {30, 0, 0}, + {31, 0, 0}, + {32, 0, 0}, + {33, 0, 0}, + {34, 0, 0}, + {35, 0, 0}, + {36, 0, 0}, + {37, 0, 0}, + {38, 0, 0}, + {39, 0, 0}, + {40, 0, 0}, + {41, 0, 0}, + {42, 0, 0}, + {43, 0, 0}, + {44, 0, 0}, + {45, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 13, 14}, + {0, 12, 9}, + {0, 11, 25}, + {0, 27, 26}, + {0, 29, 28}, + {0, 31, 30}, + {0, 23, 22}, + {0, 10, 24}, + {0, 8, 21}, + {0, 17, 7}, + {0, 19, 18}, + {0, 15, 20}, + {0, 6, 16}, + {0, 5, 33}, + {0, 35, 34}, + {0, 37, 36}, + {0, 39, 38}, + {0, 41, 40}, + {0, 43, 42}, + {0, 45, 44}, + {0, 47, 46}, + {0, 49, 48}, + {0, 51, 50}, + {0, 32, 52}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 3, 2}, + {0, 59, 4}, + {0, 60, 1}, + {0, 62, 61}, + })); + + codecs.emplace(std::pair(SpvOpCompositeExtract, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 5}, + {0, 3, 2}, + {0, 6, 4}, + {0, 8, 7}, + })); + + codecs.emplace(std::pair(SpvOpCompositeExtract, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(23, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {4, 0, 0}, + {5, 0, 0}, + {6, 0, 0}, + {7, 0, 0}, + {8, 0, 0}, + {9, 0, 0}, + {10, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 12, 11}, + {0, 10, 13}, + {0, 9, 14}, + {0, 7, 5}, + {0, 8, 6}, + {0, 4, 15}, + {0, 17, 16}, + {0, 18, 3}, + {0, 19, 2}, + {0, 20, 1}, + {0, 22, 21}, + })); + + codecs.emplace(std::pair(SpvOpCompositeInsert, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {0, 0, 0}, + {1, 0, 0}, + {2, 0, 0}, + {3, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 2, 6}, + {0, 7, 1}, + {0, 4, 8}, + })); + + codecs.emplace(std::pair(SpvOpCompositeInsert, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {2, 0, 0}, + {10, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {2, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleDrefExplicitLod, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {0, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpSelectionMerge, 1), std::move(codec)); + } + + return codecs; +} + +std::map, std::unique_ptr>> +GetIdDescriptorHuffmanCodecs() { + std::map, std::unique_ptr>> codecs; + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 4, 6}, + {0, 1, 7}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(63, { + {0, 0, 0}, + {34183582, 0, 0}, + {223800276, 0, 0}, + {295018543, 0, 0}, + {439764402, 0, 0}, + {443558693, 0, 0}, + {583624926, 0, 0}, + {599185303, 0, 0}, + {779021139, 0, 0}, + {1015552308, 0, 0}, + {1027242654, 0, 0}, + {1077859090, 0, 0}, + {1104362365, 0, 0}, + {1132589448, 0, 0}, + {1236389532, 0, 0}, + {1739837626, 0, 0}, + {1955104493, 0, 0}, + {2161102232, 0, 0}, + {2197874825, 0, 0}, + {2217833278, 0, 0}, + {2244470522, 0, 0}, + {2532518896, 0, 0}, + {2789375411, 0, 0}, + {3061690214, 0, 0}, + {3287039847, 0, 0}, + {3357301402, 0, 0}, + {3365041621, 0, 0}, + {3510257966, 0, 0}, + {3534235309, 0, 0}, + {4018237905, 0, 0}, + {4145966869, 0, 0}, + {4272200782, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 10, 19}, + {0, 6, 1}, + {0, 26, 13}, + {0, 2, 11}, + {0, 15, 22}, + {0, 23, 18}, + {0, 4, 27}, + {0, 28, 12}, + {0, 3, 30}, + {0, 9, 7}, + {0, 20, 14}, + {0, 29, 16}, + {0, 21, 8}, + {0, 34, 33}, + {0, 36, 35}, + {0, 31, 25}, + {0, 37, 24}, + {0, 39, 38}, + {0, 41, 40}, + {0, 43, 42}, + {0, 45, 44}, + {0, 17, 5}, + {0, 47, 46}, + {0, 49, 48}, + {0, 51, 50}, + {0, 53, 52}, + {0, 55, 54}, + {0, 57, 56}, + {0, 59, 58}, + {0, 61, 60}, + {0, 32, 62}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {4228502127, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(113, { + {0, 0, 0}, + {50998433, 0, 0}, + {139011596, 0, 0}, + {181902171, 0, 0}, + {296981500, 0, 0}, + {321630747, 0, 0}, + {416853049, 0, 0}, + {464259778, 0, 0}, + {615982737, 0, 0}, + {669982125, 0, 0}, + {759277550, 0, 0}, + {810488476, 0, 0}, + {870594305, 0, 0}, + {922996215, 0, 0}, + {969500141, 0, 0}, + {1015552308, 0, 0}, + {1139547465, 0, 0}, + {1203545131, 0, 0}, + {1220643281, 0, 0}, + {1220749418, 0, 0}, + {1367301635, 0, 0}, + {1395923345, 0, 0}, + {1554194368, 0, 0}, + {1742737136, 0, 0}, + {1755648697, 0, 0}, + {1962162282, 0, 0}, + {1964254745, 0, 0}, + {2055836767, 0, 0}, + {2096388952, 0, 0}, + {2124837447, 0, 0}, + {2161102232, 0, 0}, + {2321729979, 0, 0}, + {2346547796, 0, 0}, + {2399809085, 0, 0}, + {2432827426, 0, 0}, + {2455417440, 0, 0}, + {2572638469, 0, 0}, + {2614879967, 0, 0}, + {2855506940, 0, 0}, + {2919796598, 0, 0}, + {2970183398, 0, 0}, + {2976066508, 0, 0}, + {3044188332, 0, 0}, + {3061690214, 0, 0}, + {3091876332, 0, 0}, + {3104643263, 0, 0}, + {3107165180, 0, 0}, + {3187066832, 0, 0}, + {3413713311, 0, 0}, + {3487022798, 0, 0}, + {3602693817, 0, 0}, + {3678875745, 0, 0}, + {3701632935, 0, 0}, + {3829325073, 0, 0}, + {4040340620, 0, 0}, + {4174489262, 0, 0}, + {4272200782, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 33, 7}, + {0, 13, 34}, + {0, 21, 18}, + {0, 53, 22}, + {0, 39, 1}, + {0, 14, 9}, + {0, 43, 26}, + {0, 51, 35}, + {0, 19, 6}, + {0, 15, 25}, + {0, 55, 29}, + {0, 32, 3}, + {0, 27, 44}, + {0, 10, 46}, + {0, 45, 24}, + {0, 36, 40}, + {0, 47, 8}, + {0, 48, 54}, + {0, 58, 5}, + {0, 60, 59}, + {0, 30, 61}, + {0, 62, 56}, + {0, 64, 63}, + {0, 41, 50}, + {0, 66, 65}, + {0, 68, 67}, + {0, 70, 69}, + {0, 37, 31}, + {0, 4, 17}, + {0, 16, 20}, + {0, 72, 71}, + {0, 73, 52}, + {0, 49, 12}, + {0, 75, 74}, + {0, 76, 11}, + {0, 23, 42}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + {0, 84, 83}, + {0, 85, 28}, + {0, 87, 86}, + {0, 89, 88}, + {0, 91, 90}, + {0, 93, 92}, + {0, 94, 2}, + {0, 96, 95}, + {0, 98, 97}, + {0, 100, 99}, + {0, 102, 101}, + {0, 38, 103}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 57, 112}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(127, { + {0, 0, 0}, + {72782198, 0, 0}, + {139011596, 0, 0}, + {296981500, 0, 0}, + {300939750, 0, 0}, + {401211099, 0, 0}, + {429277936, 0, 0}, + {505940164, 0, 0}, + {538168945, 0, 0}, + {603915804, 0, 0}, + {688216667, 0, 0}, + {706016261, 0, 0}, + {790502615, 0, 0}, + {810488476, 0, 0}, + {993150979, 0, 0}, + {1203545131, 0, 0}, + {1206726575, 0, 0}, + {1265796414, 0, 0}, + {1314843976, 0, 0}, + {1367301635, 0, 0}, + {1378082995, 0, 0}, + {1410311776, 0, 0}, + {1443829854, 0, 0}, + {1448448666, 0, 0}, + {1468919488, 0, 0}, + {1496351055, 0, 0}, + {1619778288, 0, 0}, + {1684282922, 0, 0}, + {1848784182, 0, 0}, + {1901166356, 0, 0}, + {2095546797, 0, 0}, + {2096388952, 0, 0}, + {2162986400, 0, 0}, + {2197874825, 0, 0}, + {2246405597, 0, 0}, + {2250225826, 0, 0}, + {2282454607, 0, 0}, + {2328748202, 0, 0}, + {2348201466, 0, 0}, + {2597020383, 0, 0}, + {2633682514, 0, 0}, + {2817335337, 0, 0}, + {2855506940, 0, 0}, + {2936040203, 0, 0}, + {2955375511, 0, 0}, + {3122368657, 0, 0}, + {3154597438, 0, 0}, + {3184381405, 0, 0}, + {3187066832, 0, 0}, + {3233393284, 0, 0}, + {3251128023, 0, 0}, + {3260309823, 0, 0}, + {3441531391, 0, 0}, + {3496407048, 0, 0}, + {3582002820, 0, 0}, + {3647586740, 0, 0}, + {3653838348, 0, 0}, + {3730093054, 0, 0}, + {3759072440, 0, 0}, + {3928764629, 0, 0}, + {3969279737, 0, 0}, + {3994511488, 0, 0}, + {4026740269, 0, 0}, + {4274214049, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 43, 23}, + {0, 5, 24}, + {0, 9, 8}, + {0, 36, 21}, + {0, 13, 46}, + {0, 7, 12}, + {0, 35, 20}, + {0, 61, 59}, + {0, 22, 29}, + {0, 38, 62}, + {0, 56, 45}, + {0, 6, 48}, + {0, 33, 30}, + {0, 14, 58}, + {0, 34, 28}, + {0, 51, 40}, + {0, 63, 55}, + {0, 25, 16}, + {0, 17, 11}, + {0, 53, 52}, + {0, 65, 27}, + {0, 39, 41}, + {0, 67, 66}, + {0, 69, 68}, + {0, 10, 4}, + {0, 37, 18}, + {0, 60, 47}, + {0, 1, 32}, + {0, 71, 70}, + {0, 73, 72}, + {0, 57, 26}, + {0, 74, 31}, + {0, 76, 75}, + {0, 77, 44}, + {0, 78, 15}, + {0, 79, 54}, + {0, 81, 80}, + {0, 82, 49}, + {0, 84, 83}, + {0, 86, 85}, + {0, 88, 87}, + {0, 89, 19}, + {0, 91, 90}, + {0, 93, 92}, + {0, 95, 94}, + {0, 2, 96}, + {0, 98, 97}, + {0, 100, 99}, + {0, 102, 101}, + {0, 104, 103}, + {0, 106, 105}, + {0, 3, 107}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 114, 50}, + {0, 116, 115}, + {0, 118, 117}, + {0, 120, 119}, + {0, 122, 121}, + {0, 124, 123}, + {0, 64, 42}, + {0, 126, 125}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(93, { + {0, 0, 0}, + {99347751, 0, 0}, + {102542696, 0, 0}, + {107497541, 0, 0}, + {112452386, 0, 0}, + {139011596, 0, 0}, + {296981500, 0, 0}, + {429277936, 0, 0}, + {451957774, 0, 0}, + {508217552, 0, 0}, + {573901046, 0, 0}, + {774727851, 0, 0}, + {801484894, 0, 0}, + {920604853, 0, 0}, + {925559698, 0, 0}, + {1022915255, 0, 0}, + {1209418480, 0, 0}, + {1287937401, 0, 0}, + {1319785741, 0, 0}, + {1392080469, 0, 0}, + {1538342947, 0, 0}, + {1541020250, 0, 0}, + {1587209598, 0, 0}, + {1594733696, 0, 0}, + {1631434666, 0, 0}, + {1636389511, 0, 0}, + {1684282922, 0, 0}, + {1859128680, 0, 0}, + {1901166356, 0, 0}, + {2004567202, 0, 0}, + {2119793999, 0, 0}, + {2280400314, 0, 0}, + {2538917932, 0, 0}, + {2677264274, 0, 0}, + {2683080096, 0, 0}, + {2854085372, 0, 0}, + {2879917501, 0, 0}, + {3059119137, 0, 0}, + {3174324790, 0, 0}, + {3194725903, 0, 0}, + {3358097187, 0, 0}, + {3547456240, 0, 0}, + {3614752756, 0, 0}, + {3753486980, 0, 0}, + {3811268385, 0, 0}, + {3953733490, 0, 0}, + {3990925720, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 23, 22}, + {0, 36, 31}, + {0, 17, 40}, + {0, 27, 19}, + {0, 35, 33}, + {0, 30, 38}, + {0, 42, 39}, + {0, 46, 32}, + {0, 13, 12}, + {0, 44, 14}, + {0, 29, 11}, + {0, 10, 18}, + {0, 15, 37}, + {0, 1, 4}, + {0, 45, 2}, + {0, 21, 28}, + {0, 8, 5}, + {0, 49, 48}, + {0, 51, 50}, + {0, 53, 52}, + {0, 54, 16}, + {0, 55, 25}, + {0, 56, 3}, + {0, 58, 57}, + {0, 59, 26}, + {0, 20, 7}, + {0, 61, 60}, + {0, 62, 24}, + {0, 41, 63}, + {0, 65, 64}, + {0, 9, 34}, + {0, 67, 66}, + {0, 69, 68}, + {0, 71, 70}, + {0, 73, 72}, + {0, 75, 74}, + {0, 76, 43}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + {0, 84, 83}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 47, 91}, + {0, 92, 6}, + })); + + codecs.emplace(std::pair(SpvOpExtInst, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {166253838, 0, 0}, + {679771963, 0, 0}, + {1247793383, 0, 0}, + {2261697609, 0, 0}, + {2263349224, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 8}, + {0, 9, 1}, + {0, 3, 5}, + {0, 11, 10}, + {0, 2, 12}, + {0, 7, 6}, + {0, 14, 13}, + })); + + codecs.emplace(std::pair(SpvOpTypeVector, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {789872778, 0, 0}, + {1415510495, 0, 0}, + {1951208733, 0, 0}, + {2430404313, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 5}, + {0, 4, 6}, + {0, 7, 1}, + {0, 3, 8}, + })); + + codecs.emplace(std::pair(SpvOpTypeVector, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {1389644742, 0, 0}, + {3232633974, 0, 0}, + {3278176820, 0, 0}, + {3648138580, 0, 0}, + {3687777340, 0, 0}, + {3694383800, 0, 0}, + {3697687030, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 4}, + {0, 9, 6}, + {0, 10, 8}, + {0, 2, 11}, + {0, 12, 3}, + {0, 1, 13}, + {0, 14, 7}, + })); + + codecs.emplace(std::pair(SpvOpTypeArray, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {1951208733, 0, 0}, + {2160380860, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 2, 5}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeArray, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {144116905, 0, 0}, + {827246872, 0, 0}, + {1545298048, 0, 0}, + {2715370488, 0, 0}, + {2798552666, 0, 0}, + {3812456892, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 8, 6}, + {0, 9, 7}, + {0, 1, 10}, + {0, 11, 4}, + {0, 5, 12}, + })); + + codecs.emplace(std::pair(SpvOpTypeArray, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(67, { + {0, 0, 0}, + {40653745, 0, 0}, + {119981689, 0, 0}, + {153085016, 0, 0}, + {451382997, 0, 0}, + {545678922, 0, 0}, + {899570100, 0, 0}, + {929101967, 0, 0}, + {1070791291, 0, 0}, + {1100599986, 0, 0}, + {1103903216, 0, 0}, + {1154919607, 0, 0}, + {1199157863, 0, 0}, + {1258105452, 0, 0}, + {1369578001, 0, 0}, + {1372881231, 0, 0}, + {1674803691, 0, 0}, + {1677700667, 0, 0}, + {1989520052, 0, 0}, + {2593884753, 0, 0}, + {2664825925, 0, 0}, + {2924146124, 0, 0}, + {2926633629, 0, 0}, + {3249265647, 0, 0}, + {3345288309, 0, 0}, + {3410158390, 0, 0}, + {3489360962, 0, 0}, + {3495967422, 0, 0}, + {3504981554, 0, 0}, + {3705139860, 0, 0}, + {3822983876, 0, 0}, + {4141567741, 0, 0}, + {4234287173, 0, 0}, + {4240893633, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 15, 23}, + {0, 20, 17}, + {0, 32, 22}, + {0, 19, 12}, + {0, 13, 3}, + {0, 30, 27}, + {0, 4, 35}, + {0, 24, 36}, + {0, 31, 37}, + {0, 33, 38}, + {0, 39, 7}, + {0, 6, 40}, + {0, 41, 29}, + {0, 14, 42}, + {0, 43, 28}, + {0, 10, 44}, + {0, 45, 18}, + {0, 26, 46}, + {0, 5, 47}, + {0, 48, 2}, + {0, 49, 9}, + {0, 50, 16}, + {0, 34, 25}, + {0, 52, 51}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 60, 59}, + {0, 8, 21}, + {0, 1, 11}, + {0, 62, 61}, + {0, 64, 63}, + {0, 66, 65}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2160380860, 0, 0}, + {3278176820, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 6}, + {0, 2, 7}, + {0, 3, 8}, + {0, 9, 1}, + {0, 5, 10}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2160380860, 0, 0}, + {2320303498, 0, 0}, + {3232633974, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 7}, + {0, 2, 8}, + {0, 4, 9}, + {0, 10, 3}, + {0, 1, 6}, + {0, 12, 11}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2160380860, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 6}, + {0, 1, 7}, + {0, 3, 4}, + {0, 8, 2}, + {0, 10, 9}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2160380860, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 6}, + {0, 3, 7}, + {0, 5, 4}, + {0, 8, 1}, + {0, 10, 9}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2263349224, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 1, 6}, + {0, 2, 7}, + {0, 8, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 1, 6}, + {0, 2, 7}, + {0, 8, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 4, 6}, + {0, 7, 1}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 7), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 1, 6}, + {0, 7, 4}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 8), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 4}, + {0, 3, 5}, + {0, 1, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 9), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 3}, + {0, 1, 6}, + {0, 4, 7}, + {0, 8, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 10), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 1, 6}, + {0, 7, 4}, + {0, 8, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 11), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 4, 1}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 12), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 13), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 5}, + {0, 3, 6}, + {0, 7, 1}, + {0, 8, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 14), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 5, 3}, + {0, 6, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 15), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 2, 5}, + {0, 1, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 16), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 4, 6}, + {0, 7, 1}, + {0, 8, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 17), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 18), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 3, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 19), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 20), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 2, 5}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 21), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 1}, + {0, 2, 6}, + {0, 3, 7}, + {0, 8, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 22), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 5}, + {0, 2, 6}, + {0, 4, 7}, + {0, 8, 3}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 23), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2160380860, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 4}, + {0, 1, 7}, + {0, 2, 8}, + {0, 3, 9}, + {0, 10, 5}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 24), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 5}, + {0, 2, 6}, + {0, 4, 7}, + {0, 8, 3}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 25), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 2, 5}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 26), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 2, 5}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 27), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 28), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 29), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 30), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 3}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 31), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 32), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 33), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 3}, + {0, 2, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 34), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 35), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 36), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 37), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1389644742, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 38), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {3697687030, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 39), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 40), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 41), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 42), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 43), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 44), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 45), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 46), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 47), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 48), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 49), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 50), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {679771963, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpTypeStruct, 51), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(101, { + {0, 0, 0}, + {85880059, 0, 0}, + {135486769, 0, 0}, + {304448521, 0, 0}, + {436416061, 0, 0}, + {440421571, 0, 0}, + {450406196, 0, 0}, + {503094540, 0, 0}, + {543621065, 0, 0}, + {626892406, 0, 0}, + {628544021, 0, 0}, + {827698488, 0, 0}, + {869050696, 0, 0}, + {907126242, 0, 0}, + {908777857, 0, 0}, + {910429472, 0, 0}, + {1113409935, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {1322549027, 0, 0}, + {1784441183, 0, 0}, + {2080953106, 0, 0}, + {2194691858, 0, 0}, + {2448331885, 0, 0}, + {2466255445, 0, 0}, + {2468230023, 0, 0}, + {2547657777, 0, 0}, + {2549309392, 0, 0}, + {2550961007, 0, 0}, + {2894051250, 0, 0}, + {2929019254, 0, 0}, + {2934934694, 0, 0}, + {2936586309, 0, 0}, + {2938237924, 0, 0}, + {3077271274, 0, 0}, + {3092528578, 0, 0}, + {3094180193, 0, 0}, + {3094857332, 0, 0}, + {3095831808, 0, 0}, + {3183924418, 0, 0}, + {3207966516, 0, 0}, + {3282979782, 0, 0}, + {3433956341, 0, 0}, + {3561562003, 0, 0}, + {3563213618, 0, 0}, + {3564865233, 0, 0}, + {3585511591, 0, 0}, + {4028622909, 0, 0}, + {4039938779, 0, 0}, + {4050155669, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 16, 25}, + {0, 50, 1}, + {0, 42, 35}, + {0, 31, 41}, + {0, 4, 43}, + {0, 9, 10}, + {0, 3, 30}, + {0, 52, 47}, + {0, 12, 53}, + {0, 55, 54}, + {0, 36, 56}, + {0, 49, 57}, + {0, 6, 58}, + {0, 34, 33}, + {0, 59, 26}, + {0, 21, 32}, + {0, 60, 15}, + {0, 24, 61}, + {0, 62, 38}, + {0, 22, 2}, + {0, 37, 7}, + {0, 63, 46}, + {0, 14, 13}, + {0, 64, 5}, + {0, 65, 45}, + {0, 66, 19}, + {0, 18, 67}, + {0, 17, 20}, + {0, 68, 11}, + {0, 8, 69}, + {0, 70, 39}, + {0, 72, 71}, + {0, 74, 73}, + {0, 40, 75}, + {0, 76, 23}, + {0, 78, 77}, + {0, 29, 79}, + {0, 28, 80}, + {0, 27, 48}, + {0, 82, 81}, + {0, 51, 83}, + {0, 84, 44}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + {0, 96, 95}, + {0, 98, 97}, + {0, 100, 99}, + })); + + codecs.emplace(std::pair(SpvOpTypePointer, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(65, { + {0, 0, 0}, + {119981689, 0, 0}, + {162255877, 0, 0}, + {451382997, 0, 0}, + {545678922, 0, 0}, + {679771963, 0, 0}, + {789872778, 0, 0}, + {1100599986, 0, 0}, + {1103903216, 0, 0}, + {1154919607, 0, 0}, + {1343794461, 0, 0}, + {1415510495, 0, 0}, + {1674803691, 0, 0}, + {1951208733, 0, 0}, + {1989520052, 0, 0}, + {2160380860, 0, 0}, + {2263349224, 0, 0}, + {2320303498, 0, 0}, + {2924146124, 0, 0}, + {2984325996, 0, 0}, + {3334207724, 0, 0}, + {3345288309, 0, 0}, + {3410158390, 0, 0}, + {3489360962, 0, 0}, + {3495967422, 0, 0}, + {3504981554, 0, 0}, + {3800912395, 0, 0}, + {3802564010, 0, 0}, + {3866587616, 0, 0}, + {3868239231, 0, 0}, + {3869890846, 0, 0}, + {3998230222, 0, 0}, + {4240893633, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 3}, + {0, 6, 24}, + {0, 11, 7}, + {0, 32, 21}, + {0, 27, 34}, + {0, 35, 25}, + {0, 36, 8}, + {0, 26, 31}, + {0, 14, 15}, + {0, 28, 37}, + {0, 1, 23}, + {0, 39, 38}, + {0, 12, 40}, + {0, 22, 41}, + {0, 10, 16}, + {0, 43, 42}, + {0, 29, 44}, + {0, 2, 45}, + {0, 46, 19}, + {0, 48, 47}, + {0, 18, 49}, + {0, 50, 30}, + {0, 9, 33}, + {0, 52, 51}, + {0, 54, 53}, + {0, 13, 55}, + {0, 17, 56}, + {0, 5, 57}, + {0, 59, 58}, + {0, 60, 20}, + {0, 62, 61}, + {0, 64, 63}, + })); + + codecs.emplace(std::pair(SpvOpTypePointer, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(99, { + {0, 0, 0}, + {75986790, 0, 0}, + {95470391, 0, 0}, + {170378107, 0, 0}, + {172029722, 0, 0}, + {204234270, 0, 0}, + {205885885, 0, 0}, + {244668133, 0, 0}, + {265778447, 0, 0}, + {616435646, 0, 0}, + {618087261, 0, 0}, + {753954113, 0, 0}, + {1000070091, 0, 0}, + {1308462133, 0, 0}, + {1671139745, 0, 0}, + {1774874546, 0, 0}, + {1776526161, 0, 0}, + {1887808856, 0, 0}, + {1889460471, 0, 0}, + {1917966999, 0, 0}, + {2044728014, 0, 0}, + {2192810893, 0, 0}, + {2293247016, 0, 0}, + {2503194620, 0, 0}, + {2605012269, 0, 0}, + {2608484640, 0, 0}, + {2615111110, 0, 0}, + {2668769415, 0, 0}, + {2759951687, 0, 0}, + {2761603302, 0, 0}, + {2856623532, 0, 0}, + {2945369269, 0, 0}, + {2956189845, 0, 0}, + {3085119011, 0, 0}, + {3367313400, 0, 0}, + {3447882276, 0, 0}, + {3633746133, 0, 0}, + {3635397748, 0, 0}, + {3710645347, 0, 0}, + {3712296962, 0, 0}, + {3715846592, 0, 0}, + {3727494858, 0, 0}, + {3747079365, 0, 0}, + {3748965853, 0, 0}, + {3750617468, 0, 0}, + {4018820793, 0, 0}, + {4022124023, 0, 0}, + {4024173916, 0, 0}, + {4215670524, 0, 0}, + {4217322139, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 10, 9}, + {0, 31, 24}, + {0, 40, 13}, + {0, 45, 33}, + {0, 34, 46}, + {0, 43, 38}, + {0, 44, 15}, + {0, 11, 30}, + {0, 21, 6}, + {0, 47, 3}, + {0, 51, 16}, + {0, 14, 52}, + {0, 8, 53}, + {0, 35, 5}, + {0, 55, 54}, + {0, 56, 26}, + {0, 20, 57}, + {0, 39, 19}, + {0, 59, 58}, + {0, 61, 60}, + {0, 4, 62}, + {0, 2, 63}, + {0, 25, 7}, + {0, 64, 27}, + {0, 12, 22}, + {0, 65, 48}, + {0, 41, 42}, + {0, 17, 23}, + {0, 49, 66}, + {0, 68, 67}, + {0, 70, 69}, + {0, 72, 71}, + {0, 74, 73}, + {0, 18, 75}, + {0, 37, 32}, + {0, 76, 36}, + {0, 78, 77}, + {0, 79, 28}, + {0, 81, 80}, + {0, 82, 29}, + {0, 84, 83}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 91, 50}, + {0, 93, 92}, + {0, 95, 94}, + {0, 1, 96}, + {0, 98, 97}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(27, { + {0, 0, 0}, + {545678922, 0, 0}, + {679771963, 0, 0}, + {899570100, 0, 0}, + {929101967, 0, 0}, + {1100599986, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3056042030, 0, 0}, + {3334207724, 0, 0}, + {3357250579, 0, 0}, + {3705139860, 0, 0}, + {3800912395, 0, 0}, + {3802564010, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 3}, + {0, 10, 13}, + {0, 4, 15}, + {0, 16, 11}, + {0, 17, 1}, + {0, 14, 12}, + {0, 19, 18}, + {0, 21, 20}, + {0, 7, 6}, + {0, 9, 22}, + {0, 24, 23}, + {0, 25, 2}, + {0, 26, 8}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(57, { + {0, 0, 0}, + {283209196, 0, 0}, + {436416061, 0, 0}, + {679771963, 0, 0}, + {789872778, 0, 0}, + {815757910, 0, 0}, + {827698488, 0, 0}, + {1164221089, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {1525861001, 0, 0}, + {1579585816, 0, 0}, + {1675764636, 0, 0}, + {1824016656, 0, 0}, + {1951208733, 0, 0}, + {1991787192, 0, 0}, + {2180701723, 0, 0}, + {2194691858, 0, 0}, + {2320303498, 0, 0}, + {2881886868, 0, 0}, + {2926633629, 0, 0}, + {3249265647, 0, 0}, + {3334207724, 0, 0}, + {3472123498, 0, 0}, + {3674863070, 0, 0}, + {4050155669, 0, 0}, + {4141567741, 0, 0}, + {4155122613, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 24, 7}, + {0, 17, 1}, + {0, 4, 15}, + {0, 11, 16}, + {0, 28, 30}, + {0, 25, 20}, + {0, 14, 31}, + {0, 32, 26}, + {0, 12, 5}, + {0, 2, 22}, + {0, 33, 13}, + {0, 35, 34}, + {0, 37, 36}, + {0, 39, 38}, + {0, 40, 21}, + {0, 29, 18}, + {0, 27, 41}, + {0, 43, 42}, + {0, 19, 44}, + {0, 45, 23}, + {0, 6, 3}, + {0, 47, 46}, + {0, 49, 48}, + {0, 51, 50}, + {0, 10, 8}, + {0, 53, 52}, + {0, 9, 54}, + {0, 56, 55}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(17, { + {0, 0, 0}, + {679771963, 0, 0}, + {827698488, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 9}, + {0, 10, 6}, + {0, 1, 5}, + {0, 11, 3}, + {0, 12, 7}, + {0, 13, 2}, + {0, 15, 14}, + {0, 16, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(17, { + {0, 0, 0}, + {679771963, 0, 0}, + {827698488, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1951208733, 0, 0}, + {2194691858, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 5}, + {0, 10, 9}, + {0, 11, 6}, + {0, 7, 12}, + {0, 1, 3}, + {0, 2, 13}, + {0, 15, 14}, + {0, 4, 16}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {827698488, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 6}, + {0, 5, 7}, + {0, 2, 8}, + {0, 1, 9}, + {0, 10, 3}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {827698488, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1951208733, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 6}, + {0, 4, 7}, + {0, 8, 5}, + {0, 3, 9}, + {0, 1, 10}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {789872778, 0, 0}, + {827698488, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 1}, + {0, 4, 6}, + {0, 3, 7}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 7), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {543621065, 0, 0}, + {827698488, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 8), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {827698488, 0, 0}, + {1951208733, 0, 0}, + {3095831808, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 4}, + {0, 3, 5}, + {0, 1, 6}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 9), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1296054774, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 10), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {1296054774, 0, 0}, + {2320303498, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 1, 4}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 11), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {789872778, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 4, 1}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 12), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {789872778, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 1}, + {0, 4, 3}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 13), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 1}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 14), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 1}, + })); + + codecs.emplace(std::pair(SpvOpTypeFunction, 15), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {789872778, 0, 0}, + {1951208733, 0, 0}, + {2430404313, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 1, 5}, + {0, 2, 6}, + })); + + codecs.emplace(std::pair(SpvOpConstant, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(183, { + {0, 0, 0}, + {51041423, 0, 0}, + {52882140, 0, 0}, + {72782198, 0, 0}, + {142465290, 0, 0}, + {144116905, 0, 0}, + {158160339, 0, 0}, + {169135842, 0, 0}, + {210116709, 0, 0}, + {290391815, 0, 0}, + {296981500, 0, 0}, + {385229009, 0, 0}, + {438318340, 0, 0}, + {529742207, 0, 0}, + {628331516, 0, 0}, + {677668732, 0, 0}, + {778500192, 0, 0}, + {825595257, 0, 0}, + {910398460, 0, 0}, + {917019124, 0, 0}, + {959681532, 0, 0}, + {1031290113, 0, 0}, + {1039111164, 0, 0}, + {1064945649, 0, 0}, + {1087394637, 0, 0}, + {1092948665, 0, 0}, + {1156369516, 0, 0}, + {1158021131, 0, 0}, + {1172110445, 0, 0}, + {1304296041, 0, 0}, + {1400019344, 0, 0}, + {1450415100, 0, 0}, + {1452222566, 0, 0}, + {1543646433, 0, 0}, + {1543672828, 0, 0}, + {1612361408, 0, 0}, + {1622381564, 0, 0}, + {1691572958, 0, 0}, + {1755648697, 0, 0}, + {1782996825, 0, 0}, + {1784648440, 0, 0}, + {1930923350, 0, 0}, + {1939359710, 0, 0}, + {1971252067, 0, 0}, + {1979847999, 0, 0}, + {2078849875, 0, 0}, + {2113115132, 0, 0}, + {2135340676, 0, 0}, + {2170273742, 0, 0}, + {2268204687, 0, 0}, + {2285081596, 0, 0}, + {2318200267, 0, 0}, + {2321729979, 0, 0}, + {2326636627, 0, 0}, + {2444465148, 0, 0}, + {2466126792, 0, 0}, + {2490492987, 0, 0}, + {2524697596, 0, 0}, + {2557550659, 0, 0}, + {2678954464, 0, 0}, + {2705477184, 0, 0}, + {2715370488, 0, 0}, + {2732195517, 0, 0}, + {2775815164, 0, 0}, + {2796901051, 0, 0}, + {2798552666, 0, 0}, + {2855506940, 0, 0}, + {2860348412, 0, 0}, + {2922615804, 0, 0}, + {2937761472, 0, 0}, + {2944827576, 0, 0}, + {3092754101, 0, 0}, + {3107165180, 0, 0}, + {3168953855, 0, 0}, + {3184177968, 0, 0}, + {3202349435, 0, 0}, + {3266548732, 0, 0}, + {3332104493, 0, 0}, + {3362723943, 0, 0}, + {3571454885, 0, 0}, + {3712763835, 0, 0}, + {3743748793, 0, 0}, + {3810805277, 0, 0}, + {3912967080, 0, 0}, + {3929248764, 0, 0}, + {3958731802, 0, 0}, + {3997952447, 0, 0}, + {4016096296, 0, 0}, + {4106658327, 0, 0}, + {4172568578, 0, 0}, + {4198082194, 0, 0}, + {4248015868, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 35, 16}, + {0, 49, 42}, + {0, 86, 69}, + {0, 53, 30}, + {0, 45, 89}, + {0, 50, 68}, + {0, 73, 71}, + {0, 17, 46}, + {0, 14, 81}, + {0, 63, 44}, + {0, 12, 3}, + {0, 72, 31}, + {0, 55, 67}, + {0, 36, 19}, + {0, 22, 88}, + {0, 9, 70}, + {0, 93, 23}, + {0, 95, 94}, + {0, 47, 91}, + {0, 34, 32}, + {0, 97, 96}, + {0, 41, 61}, + {0, 99, 98}, + {0, 37, 1}, + {0, 77, 100}, + {0, 51, 60}, + {0, 101, 79}, + {0, 6, 2}, + {0, 11, 7}, + {0, 24, 21}, + {0, 43, 28}, + {0, 59, 56}, + {0, 75, 62}, + {0, 80, 78}, + {0, 87, 83}, + {0, 18, 15}, + {0, 102, 38}, + {0, 104, 103}, + {0, 85, 90}, + {0, 76, 25}, + {0, 29, 105}, + {0, 107, 106}, + {0, 58, 52}, + {0, 109, 108}, + {0, 57, 110}, + {0, 112, 111}, + {0, 114, 113}, + {0, 115, 33}, + {0, 74, 116}, + {0, 118, 117}, + {0, 120, 119}, + {0, 122, 121}, + {0, 124, 123}, + {0, 126, 125}, + {0, 128, 127}, + {0, 130, 129}, + {0, 131, 13}, + {0, 54, 27}, + {0, 133, 132}, + {0, 48, 40}, + {0, 5, 8}, + {0, 82, 134}, + {0, 26, 135}, + {0, 39, 4}, + {0, 136, 64}, + {0, 138, 137}, + {0, 140, 139}, + {0, 84, 141}, + {0, 143, 142}, + {0, 145, 144}, + {0, 147, 146}, + {0, 149, 148}, + {0, 20, 150}, + {0, 65, 151}, + {0, 66, 152}, + {0, 153, 10}, + {0, 155, 154}, + {0, 157, 156}, + {0, 159, 158}, + {0, 161, 160}, + {0, 163, 162}, + {0, 165, 164}, + {0, 167, 166}, + {0, 169, 168}, + {0, 170, 92}, + {0, 172, 171}, + {0, 174, 173}, + {0, 176, 175}, + {0, 178, 177}, + {0, 180, 179}, + {0, 182, 181}, + })); + + codecs.emplace(std::pair(SpvOpConstant, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1247793383, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 5}, + {0, 4, 6}, + {0, 1, 3}, + {0, 8, 7}, + })); + + codecs.emplace(std::pair(SpvOpConstantComposite, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(83, { + {0, 0, 0}, + {15502752, 0, 0}, + {46736908, 0, 0}, + {139011596, 0, 0}, + {149720480, 0, 0}, + {249378857, 0, 0}, + {251209228, 0, 0}, + {503145996, 0, 0}, + {836581417, 0, 0}, + {882718761, 0, 0}, + {1289566249, 0, 0}, + {1325348861, 0, 0}, + {1558001705, 0, 0}, + {1646147798, 0, 0}, + {1679946323, 0, 0}, + {1766401548, 0, 0}, + {1992893964, 0, 0}, + {2123388694, 0, 0}, + {2162986400, 0, 0}, + {2580096524, 0, 0}, + {2598189097, 0, 0}, + {2683080096, 0, 0}, + {2698156268, 0, 0}, + {2763960513, 0, 0}, + {3015046341, 0, 0}, + {3133016299, 0, 0}, + {3251128023, 0, 0}, + {3504158761, 0, 0}, + {3535289452, 0, 0}, + {3536941067, 0, 0}, + {3538592682, 0, 0}, + {3540244297, 0, 0}, + {3541895912, 0, 0}, + {3570219049, 0, 0}, + {3653838348, 0, 0}, + {3764205609, 0, 0}, + {3882634684, 0, 0}, + {3913885196, 0, 0}, + {3982047273, 0, 0}, + {4024252457, 0, 0}, + {4243119782, 0, 0}, + {4255182614, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 4}, + {0, 39, 2}, + {0, 38, 10}, + {0, 29, 41}, + {0, 23, 28}, + {0, 9, 24}, + {0, 44, 43}, + {0, 45, 6}, + {0, 20, 12}, + {0, 18, 33}, + {0, 19, 16}, + {0, 7, 46}, + {0, 48, 47}, + {0, 5, 49}, + {0, 13, 11}, + {0, 17, 14}, + {0, 25, 22}, + {0, 40, 36}, + {0, 1, 50}, + {0, 31, 30}, + {0, 51, 32}, + {0, 42, 52}, + {0, 54, 53}, + {0, 55, 15}, + {0, 37, 56}, + {0, 57, 34}, + {0, 59, 58}, + {0, 61, 60}, + {0, 35, 21}, + {0, 62, 26}, + {0, 64, 63}, + {0, 65, 27}, + {0, 3, 66}, + {0, 68, 67}, + {0, 70, 69}, + {0, 72, 71}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + })); + + codecs.emplace(std::pair(SpvOpConstantComposite, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(65, { + {0, 0, 0}, + {142465290, 0, 0}, + {158160339, 0, 0}, + {169135842, 0, 0}, + {210116709, 0, 0}, + {296981500, 0, 0}, + {615748604, 0, 0}, + {910398460, 0, 0}, + {959681532, 0, 0}, + {1039111164, 0, 0}, + {1087394637, 0, 0}, + {1156369516, 0, 0}, + {1450415100, 0, 0}, + {1543672828, 0, 0}, + {2100532220, 0, 0}, + {2170273742, 0, 0}, + {2285081596, 0, 0}, + {2326636627, 0, 0}, + {2444465148, 0, 0}, + {2732195517, 0, 0}, + {2763232252, 0, 0}, + {2796901051, 0, 0}, + {2855506940, 0, 0}, + {2922615804, 0, 0}, + {2937761472, 0, 0}, + {3202349435, 0, 0}, + {3362723943, 0, 0}, + {3712763835, 0, 0}, + {3810805277, 0, 0}, + {3929248764, 0, 0}, + {4016096296, 0, 0}, + {4172568578, 0, 0}, + {4248015868, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 12, 23}, + {0, 13, 6}, + {0, 20, 14}, + {0, 15, 24}, + {0, 17, 28}, + {0, 16, 31}, + {0, 7, 34}, + {0, 9, 32}, + {0, 36, 35}, + {0, 38, 37}, + {0, 40, 39}, + {0, 2, 8}, + {0, 10, 3}, + {0, 25, 19}, + {0, 27, 26}, + {0, 33, 30}, + {0, 11, 41}, + {0, 1, 21}, + {0, 18, 42}, + {0, 44, 43}, + {0, 46, 45}, + {0, 48, 47}, + {0, 29, 49}, + {0, 4, 50}, + {0, 52, 51}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 59, 5}, + {0, 61, 60}, + {0, 62, 22}, + {0, 64, 63}, + })); + + codecs.emplace(std::pair(SpvOpConstantComposite, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(57, { + {0, 0, 0}, + {52882140, 0, 0}, + {210116709, 0, 0}, + {296981500, 0, 0}, + {385229009, 0, 0}, + {615748604, 0, 0}, + {910398460, 0, 0}, + {959681532, 0, 0}, + {1031290113, 0, 0}, + {1039111164, 0, 0}, + {1172110445, 0, 0}, + {1450415100, 0, 0}, + {1543672828, 0, 0}, + {1622381564, 0, 0}, + {1782996825, 0, 0}, + {1971252067, 0, 0}, + {2100532220, 0, 0}, + {2268204687, 0, 0}, + {2326636627, 0, 0}, + {2444465148, 0, 0}, + {2490492987, 0, 0}, + {2678954464, 0, 0}, + {2763232252, 0, 0}, + {2855506940, 0, 0}, + {2922615804, 0, 0}, + {3912967080, 0, 0}, + {3929248764, 0, 0}, + {4172568578, 0, 0}, + {4248015868, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 11, 24}, + {0, 12, 5}, + {0, 22, 16}, + {0, 18, 17}, + {0, 30, 27}, + {0, 6, 13}, + {0, 9, 28}, + {0, 32, 31}, + {0, 34, 33}, + {0, 7, 35}, + {0, 4, 1}, + {0, 10, 8}, + {0, 20, 15}, + {0, 25, 21}, + {0, 36, 29}, + {0, 19, 37}, + {0, 39, 38}, + {0, 41, 40}, + {0, 43, 42}, + {0, 26, 44}, + {0, 45, 2}, + {0, 47, 46}, + {0, 49, 48}, + {0, 50, 14}, + {0, 51, 3}, + {0, 53, 52}, + {0, 54, 23}, + {0, 56, 55}, + })); + + codecs.emplace(std::pair(SpvOpConstantComposite, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(39, { + {0, 0, 0}, + {210116709, 0, 0}, + {296981500, 0, 0}, + {615748604, 0, 0}, + {910398460, 0, 0}, + {959681532, 0, 0}, + {1039111164, 0, 0}, + {1092948665, 0, 0}, + {1450415100, 0, 0}, + {1543672828, 0, 0}, + {1612361408, 0, 0}, + {2100532220, 0, 0}, + {2326636627, 0, 0}, + {2444465148, 0, 0}, + {2524697596, 0, 0}, + {2763232252, 0, 0}, + {2855506940, 0, 0}, + {3929248764, 0, 0}, + {4172568578, 0, 0}, + {4248015868, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 7}, + {0, 9, 3}, + {0, 15, 11}, + {0, 10, 21}, + {0, 18, 12}, + {0, 4, 20}, + {0, 22, 19}, + {0, 23, 6}, + {0, 14, 24}, + {0, 5, 25}, + {0, 27, 26}, + {0, 28, 17}, + {0, 30, 29}, + {0, 31, 13}, + {0, 1, 32}, + {0, 34, 33}, + {0, 16, 35}, + {0, 2, 36}, + {0, 38, 37}, + })); + + codecs.emplace(std::pair(SpvOpConstantComposite, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(35, { + {0, 0, 0}, + {296981500, 0, 0}, + {615748604, 0, 0}, + {673708384, 0, 0}, + {959681532, 0, 0}, + {1039111164, 0, 0}, + {1450415100, 0, 0}, + {1543672828, 0, 0}, + {1939359710, 0, 0}, + {2100532220, 0, 0}, + {2113115132, 0, 0}, + {2326636627, 0, 0}, + {2444465148, 0, 0}, + {2763232252, 0, 0}, + {2855506940, 0, 0}, + {3929248764, 0, 0}, + {4172568578, 0, 0}, + {4248015868, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 18, 3}, + {0, 6, 19}, + {0, 12, 4}, + {0, 17, 2}, + {0, 9, 7}, + {0, 20, 13}, + {0, 11, 8}, + {0, 10, 16}, + {0, 21, 15}, + {0, 5, 22}, + {0, 24, 23}, + {0, 26, 25}, + {0, 28, 27}, + {0, 29, 1}, + {0, 31, 30}, + {0, 33, 32}, + {0, 34, 14}, + })); + + codecs.emplace(std::pair(SpvOpConstantComposite, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(23, { + {0, 0, 0}, + {545678922, 0, 0}, + {679771963, 0, 0}, + {929101967, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3056042030, 0, 0}, + {3334207724, 0, 0}, + {3357250579, 0, 0}, + {3705139860, 0, 0}, + {3800912395, 0, 0}, + {3802564010, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 11}, + {0, 9, 3}, + {0, 1, 13}, + {0, 14, 10}, + {0, 12, 15}, + {0, 17, 16}, + {0, 18, 4}, + {0, 7, 5}, + {0, 20, 19}, + {0, 2, 21}, + {0, 22, 6}, + })); + + codecs.emplace(std::pair(SpvOpFunction, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(89, { + {0, 0, 0}, + {35240468, 0, 0}, + {123060826, 0, 0}, + {184634770, 0, 0}, + {359054425, 0, 0}, + {459968607, 0, 0}, + {619875033, 0, 0}, + {904486530, 0, 0}, + {945128292, 0, 0}, + {950731750, 0, 0}, + {1058429216, 0, 0}, + {1182296898, 0, 0}, + {1238120570, 0, 0}, + {1429389803, 0, 0}, + {1652168174, 0, 0}, + {1717510093, 0, 0}, + {1766422419, 0, 0}, + {1775308984, 0, 0}, + {1776629361, 0, 0}, + {1824526196, 0, 0}, + {1957265068, 0, 0}, + {1998433745, 0, 0}, + {2055664760, 0, 0}, + {2303184249, 0, 0}, + {2451531615, 0, 0}, + {2507457870, 0, 0}, + {2550501832, 0, 0}, + {2590402790, 0, 0}, + {2649103430, 0, 0}, + {2780190687, 0, 0}, + {2831059514, 0, 0}, + {3167253437, 0, 0}, + {3269075805, 0, 0}, + {3323202731, 0, 0}, + {3361419439, 0, 0}, + {3464197236, 0, 0}, + {3472029049, 0, 0}, + {3518630848, 0, 0}, + {3604842236, 0, 0}, + {3653985133, 0, 0}, + {4091916710, 0, 0}, + {4121643374, 0, 0}, + {4185590212, 0, 0}, + {4233562270, 0, 0}, + {4235213885, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 40}, + {0, 14, 31}, + {0, 7, 9}, + {0, 29, 27}, + {0, 18, 44}, + {0, 8, 5}, + {0, 10, 3}, + {0, 41, 37}, + {0, 42, 35}, + {0, 2, 1}, + {0, 47, 46}, + {0, 48, 4}, + {0, 11, 49}, + {0, 50, 36}, + {0, 19, 51}, + {0, 53, 52}, + {0, 55, 54}, + {0, 15, 12}, + {0, 26, 16}, + {0, 56, 21}, + {0, 25, 33}, + {0, 43, 24}, + {0, 57, 39}, + {0, 59, 58}, + {0, 61, 60}, + {0, 62, 34}, + {0, 64, 63}, + {0, 17, 30}, + {0, 66, 65}, + {0, 20, 67}, + {0, 13, 68}, + {0, 28, 69}, + {0, 70, 32}, + {0, 72, 71}, + {0, 73, 22}, + {0, 75, 74}, + {0, 77, 76}, + {0, 79, 78}, + {0, 80, 23}, + {0, 45, 81}, + {0, 83, 82}, + {0, 85, 84}, + {0, 38, 86}, + {0, 88, 87}, + })); + + codecs.emplace(std::pair(SpvOpFunction, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(87, { + {0, 0, 0}, + {75986790, 0, 0}, + {95470391, 0, 0}, + {170378107, 0, 0}, + {172029722, 0, 0}, + {204234270, 0, 0}, + {205885885, 0, 0}, + {244668133, 0, 0}, + {265778447, 0, 0}, + {753954113, 0, 0}, + {1000070091, 0, 0}, + {1671139745, 0, 0}, + {1774874546, 0, 0}, + {1776526161, 0, 0}, + {1887808856, 0, 0}, + {1889460471, 0, 0}, + {1917966999, 0, 0}, + {2044728014, 0, 0}, + {2192810893, 0, 0}, + {2293247016, 0, 0}, + {2503194620, 0, 0}, + {2608484640, 0, 0}, + {2615111110, 0, 0}, + {2668769415, 0, 0}, + {2759951687, 0, 0}, + {2761603302, 0, 0}, + {2856623532, 0, 0}, + {2956189845, 0, 0}, + {3085119011, 0, 0}, + {3367313400, 0, 0}, + {3447882276, 0, 0}, + {3633746133, 0, 0}, + {3635397748, 0, 0}, + {3710645347, 0, 0}, + {3712296962, 0, 0}, + {3727494858, 0, 0}, + {3747079365, 0, 0}, + {3748965853, 0, 0}, + {3750617468, 0, 0}, + {4018820793, 0, 0}, + {4022124023, 0, 0}, + {4024173916, 0, 0}, + {4215670524, 0, 0}, + {4217322139, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 39, 28}, + {0, 29, 40}, + {0, 37, 33}, + {0, 38, 12}, + {0, 9, 26}, + {0, 18, 6}, + {0, 41, 3}, + {0, 11, 13}, + {0, 5, 8}, + {0, 45, 30}, + {0, 22, 46}, + {0, 48, 47}, + {0, 16, 17}, + {0, 34, 49}, + {0, 51, 50}, + {0, 53, 52}, + {0, 7, 2}, + {0, 23, 21}, + {0, 54, 10}, + {0, 20, 36}, + {0, 55, 35}, + {0, 56, 4}, + {0, 43, 57}, + {0, 59, 58}, + {0, 60, 42}, + {0, 62, 61}, + {0, 63, 15}, + {0, 64, 31}, + {0, 14, 65}, + {0, 66, 24}, + {0, 67, 32}, + {0, 68, 19}, + {0, 70, 69}, + {0, 71, 27}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 78, 25}, + {0, 44, 79}, + {0, 81, 80}, + {0, 83, 82}, + {0, 1, 84}, + {0, 86, 85}, + })); + + codecs.emplace(std::pair(SpvOpFunction, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(41, { + {0, 0, 0}, + {436416061, 0, 0}, + {543621065, 0, 0}, + {679771963, 0, 0}, + {815757910, 0, 0}, + {827698488, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {1579585816, 0, 0}, + {1675764636, 0, 0}, + {1824016656, 0, 0}, + {1951208733, 0, 0}, + {2194691858, 0, 0}, + {2320303498, 0, 0}, + {2926633629, 0, 0}, + {3095831808, 0, 0}, + {3249265647, 0, 0}, + {3334207724, 0, 0}, + {4050155669, 0, 0}, + {4141567741, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 11}, + {0, 19, 16}, + {0, 9, 4}, + {0, 1, 17}, + {0, 22, 10}, + {0, 24, 23}, + {0, 15, 25}, + {0, 13, 26}, + {0, 27, 20}, + {0, 12, 28}, + {0, 30, 29}, + {0, 31, 18}, + {0, 3, 21}, + {0, 32, 14}, + {0, 34, 33}, + {0, 35, 8}, + {0, 5, 6}, + {0, 37, 36}, + {0, 39, 38}, + {0, 40, 7}, + })); + + codecs.emplace(std::pair(SpvOpFunctionParameter, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(41, { + {0, 0, 0}, + {522971108, 0, 0}, + {615341051, 0, 0}, + {718301639, 0, 0}, + {985750227, 0, 0}, + {1395113939, 0, 0}, + {1510333659, 0, 0}, + {1642805350, 0, 0}, + {1846856260, 0, 0}, + {1957218950, 0, 0}, + {1977038330, 0, 0}, + {1978689945, 0, 0}, + {1980341560, 0, 0}, + {2262220987, 0, 0}, + {2674422363, 0, 0}, + {3197739982, 0, 0}, + {3465954368, 0, 0}, + {3941049054, 0, 0}, + {3945795573, 0, 0}, + {4080527786, 0, 0}, + {4154758669, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 17}, + {0, 4, 15}, + {0, 8, 7}, + {0, 2, 20}, + {0, 22, 19}, + {0, 24, 23}, + {0, 14, 25}, + {0, 16, 26}, + {0, 27, 13}, + {0, 6, 28}, + {0, 30, 29}, + {0, 31, 10}, + {0, 11, 21}, + {0, 32, 12}, + {0, 34, 33}, + {0, 35, 5}, + {0, 9, 18}, + {0, 37, 36}, + {0, 39, 38}, + {0, 40, 1}, + })); + + codecs.emplace(std::pair(SpvOpFunctionParameter, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(27, { + {0, 0, 0}, + {545678922, 0, 0}, + {679771963, 0, 0}, + {899570100, 0, 0}, + {929101967, 0, 0}, + {1100599986, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3056042030, 0, 0}, + {3334207724, 0, 0}, + {3357250579, 0, 0}, + {3705139860, 0, 0}, + {3800912395, 0, 0}, + {3802564010, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 3}, + {0, 10, 13}, + {0, 4, 15}, + {0, 16, 11}, + {0, 17, 1}, + {0, 14, 12}, + {0, 19, 18}, + {0, 21, 20}, + {0, 22, 8}, + {0, 7, 6}, + {0, 23, 9}, + {0, 25, 24}, + {0, 26, 2}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(115, { + {0, 0, 0}, + {57149555, 0, 0}, + {86116519, 0, 0}, + {168339452, 0, 0}, + {181902171, 0, 0}, + {284226441, 0, 0}, + {314809953, 0, 0}, + {330249537, 0, 0}, + {527665290, 0, 0}, + {545363837, 0, 0}, + {707478563, 0, 0}, + {740921498, 0, 0}, + {807276090, 0, 0}, + {824323032, 0, 0}, + {835458563, 0, 0}, + {1162127370, 0, 0}, + {1245448751, 0, 0}, + {1277245109, 0, 0}, + {1375043498, 0, 0}, + {1380991098, 0, 0}, + {1603937321, 0, 0}, + {1708264968, 0, 0}, + {1717555224, 0, 0}, + {1765126703, 0, 0}, + {1838993983, 0, 0}, + {1949856502, 0, 0}, + {2108571893, 0, 0}, + {2110223508, 0, 0}, + {2293637521, 0, 0}, + {2377112119, 0, 0}, + {2378763734, 0, 0}, + {2512398201, 0, 0}, + {2516325050, 0, 0}, + {2645135839, 0, 0}, + {2708915136, 0, 0}, + {2894979602, 0, 0}, + {2903897222, 0, 0}, + {2976581453, 0, 0}, + {3054834317, 0, 0}, + {3075866530, 0, 0}, + {3085157904, 0, 0}, + {3242843022, 0, 0}, + {3266028549, 0, 0}, + {3296691317, 0, 0}, + {3299488628, 0, 0}, + {3322500634, 0, 0}, + {3345707173, 0, 0}, + {3536390697, 0, 0}, + {3584683259, 0, 0}, + {3647606635, 0, 0}, + {3760372982, 0, 0}, + {3823959661, 0, 0}, + {3839389658, 0, 0}, + {4124281183, 0, 0}, + {4130950286, 0, 0}, + {4169878842, 0, 0}, + {4174489262, 0, 0}, + {4237497041, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 17, 23}, + {0, 37, 8}, + {0, 45, 39}, + {0, 41, 14}, + {0, 48, 43}, + {0, 40, 31}, + {0, 19, 29}, + {0, 53, 26}, + {0, 10, 5}, + {0, 50, 24}, + {0, 27, 3}, + {0, 59, 32}, + {0, 51, 18}, + {0, 52, 55}, + {0, 60, 57}, + {0, 62, 61}, + {0, 36, 33}, + {0, 64, 63}, + {0, 65, 22}, + {0, 66, 46}, + {0, 6, 67}, + {0, 68, 13}, + {0, 21, 44}, + {0, 1, 69}, + {0, 30, 11}, + {0, 71, 70}, + {0, 12, 72}, + {0, 74, 73}, + {0, 76, 75}, + {0, 16, 2}, + {0, 49, 35}, + {0, 77, 9}, + {0, 42, 28}, + {0, 15, 78}, + {0, 80, 79}, + {0, 82, 81}, + {0, 47, 83}, + {0, 85, 84}, + {0, 87, 86}, + {0, 89, 88}, + {0, 20, 38}, + {0, 54, 90}, + {0, 34, 91}, + {0, 93, 92}, + {0, 25, 94}, + {0, 95, 7}, + {0, 97, 96}, + {0, 56, 98}, + {0, 100, 99}, + {0, 102, 101}, + {0, 104, 103}, + {0, 4, 105}, + {0, 107, 106}, + {0, 58, 108}, + {0, 110, 109}, + {0, 112, 111}, + {0, 114, 113}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(81, { + {0, 0, 0}, + {35240468, 0, 0}, + {36096192, 0, 0}, + {123060826, 0, 0}, + {184634770, 0, 0}, + {459968607, 0, 0}, + {619875033, 0, 0}, + {950731750, 0, 0}, + {1058429216, 0, 0}, + {1182296898, 0, 0}, + {1238120570, 0, 0}, + {1271484400, 0, 0}, + {1429389803, 0, 0}, + {1717510093, 0, 0}, + {1766422419, 0, 0}, + {1775308984, 0, 0}, + {1817271123, 0, 0}, + {1917336504, 0, 0}, + {1957265068, 0, 0}, + {1998433745, 0, 0}, + {2055664760, 0, 0}, + {2303184249, 0, 0}, + {2308565678, 0, 0}, + {2451531615, 0, 0}, + {2496297824, 0, 0}, + {2507457870, 0, 0}, + {2550501832, 0, 0}, + {2590402790, 0, 0}, + {2649103430, 0, 0}, + {2831059514, 0, 0}, + {2836440943, 0, 0}, + {3269075805, 0, 0}, + {3361419439, 0, 0}, + {3457269042, 0, 0}, + {3464197236, 0, 0}, + {3472029049, 0, 0}, + {3518630848, 0, 0}, + {3587381650, 0, 0}, + {3653985133, 0, 0}, + {4185590212, 0, 0}, + {4233562270, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 40, 37}, + {0, 22, 30}, + {0, 2, 7}, + {0, 24, 11}, + {0, 16, 33}, + {0, 6, 34}, + {0, 42, 27}, + {0, 5, 43}, + {0, 4, 44}, + {0, 36, 8}, + {0, 39, 45}, + {0, 46, 1}, + {0, 3, 47}, + {0, 48, 23}, + {0, 49, 9}, + {0, 50, 35}, + {0, 52, 51}, + {0, 32, 53}, + {0, 13, 10}, + {0, 26, 14}, + {0, 19, 54}, + {0, 55, 25}, + {0, 56, 38}, + {0, 17, 57}, + {0, 59, 58}, + {0, 61, 60}, + {0, 62, 29}, + {0, 12, 15}, + {0, 18, 63}, + {0, 28, 64}, + {0, 65, 31}, + {0, 67, 66}, + {0, 20, 41}, + {0, 69, 68}, + {0, 71, 70}, + {0, 21, 72}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + {0, 80, 79}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(61, { + {0, 0, 0}, + {37459569, 0, 0}, + {162167595, 0, 0}, + {535067202, 0, 0}, + {701281393, 0, 0}, + {837715723, 0, 0}, + {1320550031, 0, 0}, + {1630583316, 0, 0}, + {1913735398, 0, 0}, + {1918481917, 0, 0}, + {1955871800, 0, 0}, + {1977038330, 0, 0}, + {2053214130, 0, 0}, + {2443959748, 0, 0}, + {2564745684, 0, 0}, + {2622612602, 0, 0}, + {2677252364, 0, 0}, + {2736026107, 0, 0}, + {2790624748, 0, 0}, + {2882994691, 0, 0}, + {2888125966, 0, 0}, + {2970183398, 0, 0}, + {3253403867, 0, 0}, + {3427283542, 0, 0}, + {3570411982, 0, 0}, + {3619787319, 0, 0}, + {3662767579, 0, 0}, + {3884846406, 0, 0}, + {3910458990, 0, 0}, + {3927915220, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 20}, + {0, 6, 25}, + {0, 23, 3}, + {0, 2, 4}, + {0, 14, 17}, + {0, 11, 8}, + {0, 27, 10}, + {0, 19, 28}, + {0, 12, 16}, + {0, 33, 32}, + {0, 35, 34}, + {0, 37, 36}, + {0, 39, 38}, + {0, 40, 15}, + {0, 41, 7}, + {0, 1, 21}, + {0, 24, 13}, + {0, 29, 42}, + {0, 44, 43}, + {0, 22, 45}, + {0, 47, 46}, + {0, 49, 48}, + {0, 50, 30}, + {0, 31, 51}, + {0, 53, 52}, + {0, 55, 54}, + {0, 56, 9}, + {0, 57, 26}, + {0, 59, 58}, + {0, 60, 18}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(39, { + {0, 0, 0}, + {744062262, 0, 0}, + {810488476, 0, 0}, + {1040775722, 0, 0}, + {1280126114, 0, 0}, + {1367301635, 0, 0}, + {1684282922, 0, 0}, + {1918481917, 0, 0}, + {1978689945, 0, 0}, + {1980341560, 0, 0}, + {2443959748, 0, 0}, + {2629265310, 0, 0}, + {2790624748, 0, 0}, + {2970183398, 0, 0}, + {3044188332, 0, 0}, + {3496407048, 0, 0}, + {3662767579, 0, 0}, + {3887377256, 0, 0}, + {3971481069, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 2}, + {0, 18, 15}, + {0, 21, 6}, + {0, 13, 11}, + {0, 4, 22}, + {0, 14, 1}, + {0, 24, 23}, + {0, 25, 8}, + {0, 27, 26}, + {0, 20, 17}, + {0, 5, 28}, + {0, 29, 9}, + {0, 16, 10}, + {0, 31, 30}, + {0, 32, 7}, + {0, 19, 33}, + {0, 35, 34}, + {0, 37, 36}, + {0, 38, 12}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(27, { + {0, 0, 0}, + {37459569, 0, 0}, + {837715723, 0, 0}, + {1352628475, 0, 0}, + {1918481917, 0, 0}, + {1978689945, 0, 0}, + {1980341560, 0, 0}, + {2096388952, 0, 0}, + {2622612602, 0, 0}, + {2790624748, 0, 0}, + {2970183398, 0, 0}, + {3510682541, 0, 0}, + {3783543823, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 11}, + {0, 2, 8}, + {0, 15, 12}, + {0, 1, 3}, + {0, 16, 6}, + {0, 18, 17}, + {0, 19, 14}, + {0, 20, 5}, + {0, 10, 21}, + {0, 22, 4}, + {0, 23, 13}, + {0, 25, 24}, + {0, 9, 26}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {1510333659, 0, 0}, + {1684282922, 0, 0}, + {1918481917, 0, 0}, + {2790624748, 0, 0}, + {3662767579, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 1}, + {0, 8, 2}, + {0, 9, 7}, + {0, 3, 10}, + {0, 6, 11}, + {0, 4, 12}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(27, { + {0, 0, 0}, + {161668409, 0, 0}, + {188347929, 0, 0}, + {653708953, 0, 0}, + {976111724, 0, 0}, + {1510333659, 0, 0}, + {1918481917, 0, 0}, + {2790624748, 0, 0}, + {3033873113, 0, 0}, + {3499234137, 0, 0}, + {3525913657, 0, 0}, + {3552593177, 0, 0}, + {3570411982, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 3}, + {0, 2, 9}, + {0, 10, 11}, + {0, 15, 1}, + {0, 17, 16}, + {0, 19, 18}, + {0, 5, 4}, + {0, 20, 6}, + {0, 12, 21}, + {0, 14, 22}, + {0, 24, 23}, + {0, 7, 25}, + {0, 13, 26}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 7), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(31, { + {0, 0, 0}, + {226836633, 0, 0}, + {296981500, 0, 0}, + {718877177, 0, 0}, + {745556697, 0, 0}, + {798915737, 0, 0}, + {1510333659, 0, 0}, + {1684282922, 0, 0}, + {2444465148, 0, 0}, + {2713718873, 0, 0}, + {3495546641, 0, 0}, + {3564402361, 0, 0}, + {4056442905, 0, 0}, + {4083122425, 0, 0}, + {4123141705, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 14, 4}, + {0, 5, 3}, + {0, 9, 8}, + {0, 13, 12}, + {0, 1, 11}, + {0, 18, 17}, + {0, 2, 19}, + {0, 21, 20}, + {0, 23, 22}, + {0, 25, 24}, + {0, 26, 7}, + {0, 27, 16}, + {0, 10, 6}, + {0, 29, 28}, + {0, 15, 30}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 8), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(35, { + {0, 0, 0}, + {161668409, 0, 0}, + {188347929, 0, 0}, + {215027449, 0, 0}, + {296981500, 0, 0}, + {653708953, 0, 0}, + {680388473, 0, 0}, + {1119069977, 0, 0}, + {1510333659, 0, 0}, + {1584774136, 0, 0}, + {2049792025, 0, 0}, + {2444465148, 0, 0}, + {2568512089, 0, 0}, + {3033873113, 0, 0}, + {3499234137, 0, 0}, + {3525913657, 0, 0}, + {3552593177, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 6}, + {0, 10, 12}, + {0, 4, 3}, + {0, 16, 11}, + {0, 19, 14}, + {0, 5, 2}, + {0, 20, 13}, + {0, 21, 15}, + {0, 1, 22}, + {0, 24, 23}, + {0, 26, 25}, + {0, 28, 27}, + {0, 18, 29}, + {0, 8, 30}, + {0, 32, 31}, + {0, 9, 33}, + {0, 17, 34}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 9), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(25, { + {0, 0, 0}, + {825595257, 0, 0}, + {1064945649, 0, 0}, + {1290956281, 0, 0}, + {1510333659, 0, 0}, + {2096388952, 0, 0}, + {2248357849, 0, 0}, + {2713718873, 0, 0}, + {3187066832, 0, 0}, + {3205759417, 0, 0}, + {4064212479, 0, 0}, + {4163160985, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 3}, + {0, 2, 9}, + {0, 7, 6}, + {0, 5, 14}, + {0, 16, 15}, + {0, 17, 11}, + {0, 19, 18}, + {0, 20, 1}, + {0, 4, 13}, + {0, 22, 21}, + {0, 10, 23}, + {0, 12, 24}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 10), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(27, { + {0, 0, 0}, + {123108003, 0, 0}, + {296981500, 0, 0}, + {595410904, 0, 0}, + {1466938734, 0, 0}, + {1503477720, 0, 0}, + {1816558243, 0, 0}, + {1990431740, 0, 0}, + {2724625059, 0, 0}, + {2790624748, 0, 0}, + {2812498065, 0, 0}, + {3160388974, 0, 0}, + {3745223676, 0, 0}, + {3982311384, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 13}, + {0, 8, 1}, + {0, 12, 11}, + {0, 15, 3}, + {0, 6, 4}, + {0, 16, 7}, + {0, 17, 14}, + {0, 18, 2}, + {0, 19, 10}, + {0, 21, 20}, + {0, 23, 22}, + {0, 25, 24}, + {0, 9, 26}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 11), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(25, { + {0, 0, 0}, + {94145952, 0, 0}, + {1054641568, 0, 0}, + {1269075360, 0, 0}, + {1675922848, 0, 0}, + {2038205856, 0, 0}, + {2433519008, 0, 0}, + {2636942752, 0, 0}, + {2790624748, 0, 0}, + {2840366496, 0, 0}, + {2851900832, 0, 0}, + {2964622752, 0, 0}, + {3654061472, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 1}, + {0, 12, 6}, + {0, 14, 10}, + {0, 13, 4}, + {0, 11, 15}, + {0, 3, 16}, + {0, 2, 17}, + {0, 18, 5}, + {0, 9, 19}, + {0, 21, 20}, + {0, 23, 22}, + {0, 8, 24}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 12), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(45, { + {0, 0, 0}, + {107544081, 0, 0}, + {125015036, 0, 0}, + {586244865, 0, 0}, + {1033081852, 0, 0}, + {1064945649, 0, 0}, + {1155765244, 0, 0}, + {1304296041, 0, 0}, + {1543646433, 0, 0}, + {1782996825, 0, 0}, + {1941148668, 0, 0}, + {2002490364, 0, 0}, + {2022347217, 0, 0}, + {2063832060, 0, 0}, + {2487708241, 0, 0}, + {2726532092, 0, 0}, + {2849215484, 0, 0}, + {2966409025, 0, 0}, + {3445109809, 0, 0}, + {3458449569, 0, 0}, + {3634598908, 0, 0}, + {3695940604, 0, 0}, + {3923810593, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 2}, + {0, 14, 13}, + {0, 1, 23}, + {0, 6, 5}, + {0, 16, 15}, + {0, 24, 17}, + {0, 12, 25}, + {0, 22, 18}, + {0, 10, 26}, + {0, 28, 27}, + {0, 21, 29}, + {0, 31, 30}, + {0, 9, 8}, + {0, 11, 32}, + {0, 33, 19}, + {0, 3, 34}, + {0, 36, 35}, + {0, 38, 37}, + {0, 20, 39}, + {0, 41, 40}, + {0, 42, 4}, + {0, 44, 43}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 13), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(23, { + {0, 0, 0}, + {247698428, 0, 0}, + {309040124, 0, 0}, + {333554713, 0, 0}, + {572905105, 0, 0}, + {1033081852, 0, 0}, + {2002490364, 0, 0}, + {2009007457, 0, 0}, + {2487708241, 0, 0}, + {3634598908, 0, 0}, + {3695940604, 0, 0}, + {3923810593, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 1}, + {0, 9, 7}, + {0, 5, 12}, + {0, 14, 13}, + {0, 15, 8}, + {0, 3, 16}, + {0, 17, 11}, + {0, 10, 4}, + {0, 2, 18}, + {0, 20, 19}, + {0, 22, 21}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 14), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {247698428, 0, 0}, + {1033081852, 0, 0}, + {2002490364, 0, 0}, + {2910557180, 0, 0}, + {3757282300, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 4}, + {0, 7, 3}, + {0, 2, 8}, + {0, 1, 5}, + {0, 10, 9}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 15), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {1033081852, 0, 0}, + {1094423548, 0, 0}, + {2002490364, 0, 0}, + {3757282300, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 6, 2}, + {0, 4, 7}, + {0, 8, 1}, + })); + + codecs.emplace(std::pair(SpvOpFunctionCall, 16), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(57, { + {0, 0, 0}, + {135486769, 0, 0}, + {450406196, 0, 0}, + {503094540, 0, 0}, + {543621065, 0, 0}, + {827698488, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {1322549027, 0, 0}, + {1784441183, 0, 0}, + {2194691858, 0, 0}, + {2448331885, 0, 0}, + {2468230023, 0, 0}, + {2547657777, 0, 0}, + {2549309392, 0, 0}, + {2550961007, 0, 0}, + {2934934694, 0, 0}, + {2936586309, 0, 0}, + {2938237924, 0, 0}, + {3094180193, 0, 0}, + {3095831808, 0, 0}, + {3183924418, 0, 0}, + {3561562003, 0, 0}, + {3563213618, 0, 0}, + {3564865233, 0, 0}, + {4028622909, 0, 0}, + {4039938779, 0, 0}, + {4050155669, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 27, 28}, + {0, 10, 2}, + {0, 25, 24}, + {0, 1, 12}, + {0, 30, 3}, + {0, 20, 31}, + {0, 9, 32}, + {0, 34, 33}, + {0, 35, 22}, + {0, 26, 15}, + {0, 19, 36}, + {0, 18, 37}, + {0, 38, 16}, + {0, 39, 8}, + {0, 5, 40}, + {0, 6, 41}, + {0, 21, 42}, + {0, 11, 29}, + {0, 4, 43}, + {0, 13, 23}, + {0, 14, 17}, + {0, 7, 44}, + {0, 46, 45}, + {0, 48, 47}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 56, 55}, + })); + + codecs.emplace(std::pair(SpvOpVariable, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(57, { + {0, 0, 0}, + {37459569, 0, 0}, + {112745085, 0, 0}, + {137840602, 0, 0}, + {565334834, 0, 0}, + {625975427, 0, 0}, + {630964591, 0, 0}, + {680016782, 0, 0}, + {769422756, 0, 0}, + {1009983433, 0, 0}, + {1093210099, 0, 0}, + {1572088444, 0, 0}, + {1584774136, 0, 0}, + {1641565587, 0, 0}, + {1918481917, 0, 0}, + {2190437442, 0, 0}, + {2790624748, 0, 0}, + {3085467405, 0, 0}, + {3181646225, 0, 0}, + {3192069648, 0, 0}, + {3253403867, 0, 0}, + {3390051757, 0, 0}, + {3560665067, 0, 0}, + {3662767579, 0, 0}, + {4053789056, 0, 0}, + {4064212479, 0, 0}, + {4192247221, 0, 0}, + {4224872590, 0, 0}, + {4290024976, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 20}, + {0, 28, 10}, + {0, 13, 8}, + {0, 15, 17}, + {0, 30, 21}, + {0, 19, 31}, + {0, 4, 32}, + {0, 34, 33}, + {0, 35, 5}, + {0, 7, 24}, + {0, 9, 36}, + {0, 3, 37}, + {0, 38, 6}, + {0, 39, 23}, + {0, 27, 40}, + {0, 14, 41}, + {0, 25, 42}, + {0, 1, 29}, + {0, 12, 43}, + {0, 11, 26}, + {0, 18, 22}, + {0, 16, 44}, + {0, 46, 45}, + {0, 48, 47}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 56, 55}, + })); + + codecs.emplace(std::pair(SpvOpVariable, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(27, { + {0, 0, 0}, + {162255877, 0, 0}, + {679771963, 0, 0}, + {789872778, 0, 0}, + {1154919607, 0, 0}, + {1343794461, 0, 0}, + {1951208733, 0, 0}, + {2263349224, 0, 0}, + {2320303498, 0, 0}, + {2924146124, 0, 0}, + {2984325996, 0, 0}, + {3334207724, 0, 0}, + {3868239231, 0, 0}, + {3869890846, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 5, 3}, + {0, 9, 7}, + {0, 12, 4}, + {0, 16, 15}, + {0, 18, 17}, + {0, 14, 19}, + {0, 13, 10}, + {0, 20, 1}, + {0, 21, 8}, + {0, 2, 22}, + {0, 11, 23}, + {0, 6, 24}, + {0, 26, 25}, + })); + + codecs.emplace(std::pair(SpvOpLoad, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(83, { + {0, 0, 0}, + {169674806, 0, 0}, + {269823086, 0, 0}, + {408465899, 0, 0}, + {451264926, 0, 0}, + {543558236, 0, 0}, + {810488476, 0, 0}, + {850497536, 0, 0}, + {870594305, 0, 0}, + {883854656, 0, 0}, + {1033363654, 0, 0}, + {1069781886, 0, 0}, + {1141965917, 0, 0}, + {1323407757, 0, 0}, + {1570165302, 0, 0}, + {1684282922, 0, 0}, + {1742737136, 0, 0}, + {1901166356, 0, 0}, + {1949759310, 0, 0}, + {2043873558, 0, 0}, + {2087004702, 0, 0}, + {2096388952, 0, 0}, + {2157103435, 0, 0}, + {2219733501, 0, 0}, + {2356768706, 0, 0}, + {2443959748, 0, 0}, + {2517964682, 0, 0}, + {2614879967, 0, 0}, + {2622612602, 0, 0}, + {2660843182, 0, 0}, + {2959147533, 0, 0}, + {2970183398, 0, 0}, + {3044188332, 0, 0}, + {3091876332, 0, 0}, + {3187066832, 0, 0}, + {3244209297, 0, 0}, + {3487022798, 0, 0}, + {3496407048, 0, 0}, + {3570411982, 0, 0}, + {3692647551, 0, 0}, + {3713290482, 0, 0}, + {3831290364, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 1}, + {0, 35, 13}, + {0, 25, 11}, + {0, 7, 10}, + {0, 19, 36}, + {0, 43, 27}, + {0, 16, 29}, + {0, 22, 3}, + {0, 41, 30}, + {0, 44, 12}, + {0, 2, 24}, + {0, 40, 32}, + {0, 23, 45}, + {0, 46, 39}, + {0, 17, 33}, + {0, 48, 47}, + {0, 8, 49}, + {0, 51, 50}, + {0, 52, 20}, + {0, 53, 14}, + {0, 31, 54}, + {0, 15, 55}, + {0, 57, 56}, + {0, 59, 58}, + {0, 6, 26}, + {0, 61, 60}, + {0, 34, 62}, + {0, 64, 63}, + {0, 5, 37}, + {0, 9, 65}, + {0, 18, 28}, + {0, 66, 38}, + {0, 68, 67}, + {0, 69, 21}, + {0, 71, 70}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 79, 78}, + {0, 80, 42}, + {0, 82, 81}, + })); + + codecs.emplace(std::pair(SpvOpLoad, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(83, { + {0, 0, 0}, + {28782128, 0, 0}, + {30433743, 0, 0}, + {37459569, 0, 0}, + {137840602, 0, 0}, + {522971108, 0, 0}, + {565334834, 0, 0}, + {625975427, 0, 0}, + {630964591, 0, 0}, + {680016782, 0, 0}, + {1009983433, 0, 0}, + {1079999262, 0, 0}, + {1395113939, 0, 0}, + {1572088444, 0, 0}, + {1584774136, 0, 0}, + {1649426421, 0, 0}, + {1918481917, 0, 0}, + {1957218950, 0, 0}, + {2311941439, 0, 0}, + {2313593054, 0, 0}, + {2790624748, 0, 0}, + {2838165089, 0, 0}, + {2839816704, 0, 0}, + {2841468319, 0, 0}, + {3085467405, 0, 0}, + {3181646225, 0, 0}, + {3192069648, 0, 0}, + {3253403867, 0, 0}, + {3364388739, 0, 0}, + {3366040354, 0, 0}, + {3367691969, 0, 0}, + {3369343584, 0, 0}, + {3560665067, 0, 0}, + {3662767579, 0, 0}, + {3945795573, 0, 0}, + {4053789056, 0, 0}, + {4064212479, 0, 0}, + {4224872590, 0, 0}, + {4239834800, 0, 0}, + {4241486415, 0, 0}, + {4243138030, 0, 0}, + {4244789645, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 27}, + {0, 15, 2}, + {0, 10, 26}, + {0, 7, 24}, + {0, 9, 31}, + {0, 43, 30}, + {0, 29, 12}, + {0, 11, 41}, + {0, 40, 39}, + {0, 44, 23}, + {0, 22, 6}, + {0, 34, 35}, + {0, 18, 45}, + {0, 46, 21}, + {0, 17, 19}, + {0, 48, 47}, + {0, 28, 49}, + {0, 51, 50}, + {0, 52, 38}, + {0, 53, 33}, + {0, 4, 54}, + {0, 13, 55}, + {0, 57, 56}, + {0, 59, 58}, + {0, 37, 8}, + {0, 61, 60}, + {0, 5, 62}, + {0, 64, 63}, + {0, 36, 32}, + {0, 3, 65}, + {0, 14, 16}, + {0, 66, 25}, + {0, 68, 67}, + {0, 69, 20}, + {0, 71, 70}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 79, 78}, + {0, 80, 42}, + {0, 82, 81}, + })); + + codecs.emplace(std::pair(SpvOpLoad, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(49, { + {0, 0, 0}, + {137840602, 0, 0}, + {522971108, 0, 0}, + {769422756, 0, 0}, + {1009983433, 0, 0}, + {1079999262, 0, 0}, + {1558345254, 0, 0}, + {1572088444, 0, 0}, + {1641565587, 0, 0}, + {1918481917, 0, 0}, + {2311941439, 0, 0}, + {2313593054, 0, 0}, + {2790624748, 0, 0}, + {2838165089, 0, 0}, + {2994529201, 0, 0}, + {2996180816, 0, 0}, + {2997832431, 0, 0}, + {3027538652, 0, 0}, + {3253403867, 0, 0}, + {3364388739, 0, 0}, + {3560665067, 0, 0}, + {3662767579, 0, 0}, + {3945795573, 0, 0}, + {4192247221, 0, 0}, + {4224872590, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 14, 17}, + {0, 16, 15}, + {0, 13, 11}, + {0, 10, 3}, + {0, 22, 18}, + {0, 6, 8}, + {0, 19, 2}, + {0, 27, 26}, + {0, 28, 5}, + {0, 30, 29}, + {0, 32, 31}, + {0, 34, 33}, + {0, 4, 35}, + {0, 37, 36}, + {0, 21, 1}, + {0, 39, 38}, + {0, 40, 24}, + {0, 7, 23}, + {0, 20, 9}, + {0, 42, 41}, + {0, 43, 25}, + {0, 44, 12}, + {0, 46, 45}, + {0, 48, 47}, + })); + + codecs.emplace(std::pair(SpvOpStore, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(59, { + {0, 0, 0}, + {139011596, 0, 0}, + {177111659, 0, 0}, + {296981500, 0, 0}, + {408465899, 0, 0}, + {495107308, 0, 0}, + {810488476, 0, 0}, + {870594305, 0, 0}, + {1367301635, 0, 0}, + {1901166356, 0, 0}, + {2055836767, 0, 0}, + {2087004702, 0, 0}, + {2096388952, 0, 0}, + {2204920111, 0, 0}, + {2517964682, 0, 0}, + {2622612602, 0, 0}, + {2660843182, 0, 0}, + {2842919847, 0, 0}, + {2855506940, 0, 0}, + {2959147533, 0, 0}, + {3044188332, 0, 0}, + {3187066832, 0, 0}, + {3504158761, 0, 0}, + {3570411982, 0, 0}, + {3619787319, 0, 0}, + {3653838348, 0, 0}, + {3692647551, 0, 0}, + {3764205609, 0, 0}, + {3831290364, 0, 0}, + {3913885196, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 20, 29}, + {0, 25, 8}, + {0, 5, 1}, + {0, 24, 26}, + {0, 14, 9}, + {0, 27, 16}, + {0, 31, 7}, + {0, 33, 32}, + {0, 17, 34}, + {0, 35, 13}, + {0, 22, 6}, + {0, 3, 2}, + {0, 23, 36}, + {0, 28, 37}, + {0, 19, 4}, + {0, 38, 10}, + {0, 39, 15}, + {0, 40, 18}, + {0, 42, 41}, + {0, 43, 12}, + {0, 44, 21}, + {0, 45, 11}, + {0, 47, 46}, + {0, 49, 48}, + {0, 51, 50}, + {0, 53, 52}, + {0, 55, 54}, + {0, 57, 56}, + {0, 30, 58}, + })); + + codecs.emplace(std::pair(SpvOpStore, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(35, { + {0, 0, 0}, + {440421571, 0, 0}, + {827698488, 0, 0}, + {907126242, 0, 0}, + {908777857, 0, 0}, + {910429472, 0, 0}, + {1294403159, 0, 0}, + {1296054774, 0, 0}, + {1297706389, 0, 0}, + {2080953106, 0, 0}, + {2468230023, 0, 0}, + {2547657777, 0, 0}, + {2549309392, 0, 0}, + {2550961007, 0, 0}, + {3094857332, 0, 0}, + {3561562003, 0, 0}, + {3563213618, 0, 0}, + {3564865233, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 16, 12}, + {0, 17, 13}, + {0, 14, 19}, + {0, 18, 20}, + {0, 5, 21}, + {0, 11, 7}, + {0, 15, 22}, + {0, 9, 8}, + {0, 24, 23}, + {0, 25, 4}, + {0, 27, 26}, + {0, 28, 3}, + {0, 29, 10}, + {0, 6, 1}, + {0, 31, 30}, + {0, 32, 2}, + {0, 34, 33}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(99, { + {0, 0, 0}, + {27130513, 0, 0}, + {28782128, 0, 0}, + {30433743, 0, 0}, + {32085358, 0, 0}, + {155458798, 0, 0}, + {157110413, 0, 0}, + {163402553, 0, 0}, + {165054168, 0, 0}, + {213642219, 0, 0}, + {215293834, 0, 0}, + {216945449, 0, 0}, + {221900294, 0, 0}, + {545986953, 0, 0}, + {979993429, 0, 0}, + {1079999262, 0, 0}, + {1302400505, 0, 0}, + {1313182965, 0, 0}, + {1314834580, 0, 0}, + {1315613425, 0, 0}, + {1317265040, 0, 0}, + {1558345254, 0, 0}, + {1649426421, 0, 0}, + {2311941439, 0, 0}, + {2313593054, 0, 0}, + {2602027658, 0, 0}, + {2838165089, 0, 0}, + {2839816704, 0, 0}, + {2841468319, 0, 0}, + {2863084840, 0, 0}, + {2994529201, 0, 0}, + {2996180816, 0, 0}, + {2997832431, 0, 0}, + {3027538652, 0, 0}, + {3187387500, 0, 0}, + {3189039115, 0, 0}, + {3364388739, 0, 0}, + {3366040354, 0, 0}, + {3367691969, 0, 0}, + {3369343584, 0, 0}, + {3716914380, 0, 0}, + {3928842969, 0, 0}, + {3930494584, 0, 0}, + {3932146199, 0, 0}, + {3945482286, 0, 0}, + {4105051793, 0, 0}, + {4239834800, 0, 0}, + {4241486415, 0, 0}, + {4243138030, 0, 0}, + {4244789645, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 29, 10}, + {0, 17, 18}, + {0, 13, 14}, + {0, 44, 25}, + {0, 8, 7}, + {0, 20, 11}, + {0, 33, 19}, + {0, 6, 45}, + {0, 42, 43}, + {0, 40, 5}, + {0, 9, 16}, + {0, 1, 4}, + {0, 35, 34}, + {0, 12, 21}, + {0, 52, 51}, + {0, 31, 30}, + {0, 41, 32}, + {0, 54, 53}, + {0, 55, 2}, + {0, 3, 56}, + {0, 58, 57}, + {0, 60, 59}, + {0, 61, 22}, + {0, 63, 62}, + {0, 65, 64}, + {0, 67, 66}, + {0, 39, 68}, + {0, 38, 69}, + {0, 47, 70}, + {0, 49, 71}, + {0, 28, 48}, + {0, 37, 15}, + {0, 73, 72}, + {0, 74, 27}, + {0, 23, 75}, + {0, 76, 26}, + {0, 24, 77}, + {0, 79, 78}, + {0, 81, 80}, + {0, 82, 46}, + {0, 36, 83}, + {0, 85, 84}, + {0, 87, 86}, + {0, 89, 88}, + {0, 91, 90}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 50, 98}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(101, { + {0, 0, 0}, + {112745085, 0, 0}, + {116376005, 0, 0}, + {137840602, 0, 0}, + {400248103, 0, 0}, + {406044930, 0, 0}, + {468372467, 0, 0}, + {522971108, 0, 0}, + {615341051, 0, 0}, + {625975427, 0, 0}, + {630964591, 0, 0}, + {680016782, 0, 0}, + {763027711, 0, 0}, + {977312655, 0, 0}, + {1009983433, 0, 0}, + {1062250709, 0, 0}, + {1395113939, 0, 0}, + {1410849099, 0, 0}, + {1642805350, 0, 0}, + {1692932387, 0, 0}, + {1698730948, 0, 0}, + {1827244161, 0, 0}, + {1918481917, 0, 0}, + {2096472894, 0, 0}, + {2190437442, 0, 0}, + {2299842241, 0, 0}, + {2433358586, 0, 0}, + {2593325766, 0, 0}, + {2785441472, 0, 0}, + {2790624748, 0, 0}, + {2879917723, 0, 0}, + {2882994691, 0, 0}, + {2902069960, 0, 0}, + {3090408469, 0, 0}, + {3181646225, 0, 0}, + {3255947500, 0, 0}, + {3263901372, 0, 0}, + {3268751013, 0, 0}, + {3347863687, 0, 0}, + {3390051757, 0, 0}, + {3560665067, 0, 0}, + {3617689692, 0, 0}, + {3662767579, 0, 0}, + {3717523241, 0, 0}, + {3854557817, 0, 0}, + {3910458990, 0, 0}, + {3941049054, 0, 0}, + {3945795573, 0, 0}, + {4080527786, 0, 0}, + {4101009465, 0, 0}, + {4290024976, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 32, 44}, + {0, 41, 26}, + {0, 16, 10}, + {0, 27, 45}, + {0, 25, 38}, + {0, 12, 18}, + {0, 6, 35}, + {0, 46, 23}, + {0, 20, 37}, + {0, 52, 19}, + {0, 53, 21}, + {0, 54, 48}, + {0, 33, 55}, + {0, 3, 8}, + {0, 28, 56}, + {0, 13, 57}, + {0, 59, 58}, + {0, 1, 49}, + {0, 47, 60}, + {0, 61, 14}, + {0, 63, 62}, + {0, 64, 43}, + {0, 7, 4}, + {0, 65, 15}, + {0, 67, 66}, + {0, 68, 17}, + {0, 36, 2}, + {0, 30, 69}, + {0, 71, 70}, + {0, 34, 5}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 24, 78}, + {0, 39, 31}, + {0, 80, 79}, + {0, 9, 11}, + {0, 42, 81}, + {0, 83, 82}, + {0, 29, 50}, + {0, 84, 51}, + {0, 86, 85}, + {0, 22, 40}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + {0, 96, 95}, + {0, 98, 97}, + {0, 100, 99}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(69, { + {0, 0, 0}, + {51041423, 0, 0}, + {142465290, 0, 0}, + {144116905, 0, 0}, + {290391815, 0, 0}, + {438318340, 0, 0}, + {529742207, 0, 0}, + {677668732, 0, 0}, + {917019124, 0, 0}, + {1064945649, 0, 0}, + {1156369516, 0, 0}, + {1158021131, 0, 0}, + {1304296041, 0, 0}, + {1452222566, 0, 0}, + {1543646433, 0, 0}, + {1691572958, 0, 0}, + {1782996825, 0, 0}, + {1784648440, 0, 0}, + {1930923350, 0, 0}, + {2170273742, 0, 0}, + {2318200267, 0, 0}, + {2466126792, 0, 0}, + {2557550659, 0, 0}, + {2705477184, 0, 0}, + {2796901051, 0, 0}, + {2798552666, 0, 0}, + {2944827576, 0, 0}, + {3092754101, 0, 0}, + {3184177968, 0, 0}, + {3332104493, 0, 0}, + {3571454885, 0, 0}, + {3810805277, 0, 0}, + {3958731802, 0, 0}, + {4106658327, 0, 0}, + {4198082194, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 27, 33}, + {0, 21, 5}, + {0, 26, 13}, + {0, 20, 8}, + {0, 15, 7}, + {0, 37, 36}, + {0, 32, 29}, + {0, 38, 4}, + {0, 30, 1}, + {0, 9, 12}, + {0, 39, 18}, + {0, 22, 40}, + {0, 42, 41}, + {0, 44, 43}, + {0, 45, 35}, + {0, 46, 34}, + {0, 6, 14}, + {0, 28, 23}, + {0, 48, 47}, + {0, 49, 31}, + {0, 51, 50}, + {0, 19, 24}, + {0, 52, 10}, + {0, 2, 53}, + {0, 55, 54}, + {0, 25, 56}, + {0, 11, 57}, + {0, 59, 58}, + {0, 3, 17}, + {0, 61, 60}, + {0, 16, 62}, + {0, 64, 63}, + {0, 66, 65}, + {0, 68, 67}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(85, { + {0, 0, 0}, + {142465290, 0, 0}, + {144116905, 0, 0}, + {198967948, 0, 0}, + {290391815, 0, 0}, + {529742207, 0, 0}, + {586244865, 0, 0}, + {677668732, 0, 0}, + {825595257, 0, 0}, + {917019124, 0, 0}, + {973521782, 0, 0}, + {1064945649, 0, 0}, + {1156369516, 0, 0}, + {1158021131, 0, 0}, + {1212872174, 0, 0}, + {1304296041, 0, 0}, + {1452222566, 0, 0}, + {1543646433, 0, 0}, + {1600149091, 0, 0}, + {1782996825, 0, 0}, + {1784648440, 0, 0}, + {1839499483, 0, 0}, + {1930923350, 0, 0}, + {2170273742, 0, 0}, + {2226776400, 0, 0}, + {2318200267, 0, 0}, + {2466126792, 0, 0}, + {2557550659, 0, 0}, + {2614053317, 0, 0}, + {2796901051, 0, 0}, + {2798552666, 0, 0}, + {2853403709, 0, 0}, + {2944827576, 0, 0}, + {3184177968, 0, 0}, + {3240680626, 0, 0}, + {3480031018, 0, 0}, + {3571454885, 0, 0}, + {3810805277, 0, 0}, + {3867307935, 0, 0}, + {3958731802, 0, 0}, + {4106658327, 0, 0}, + {4198082194, 0, 0}, + {4254584852, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 7, 11}, + {0, 15, 4}, + {0, 32, 25}, + {0, 44, 39}, + {0, 36, 22}, + {0, 45, 17}, + {0, 24, 46}, + {0, 10, 9}, + {0, 6, 27}, + {0, 28, 18}, + {0, 42, 34}, + {0, 31, 14}, + {0, 41, 38}, + {0, 26, 3}, + {0, 47, 33}, + {0, 21, 8}, + {0, 5, 35}, + {0, 40, 16}, + {0, 37, 23}, + {0, 49, 48}, + {0, 51, 50}, + {0, 53, 52}, + {0, 55, 54}, + {0, 57, 56}, + {0, 59, 58}, + {0, 61, 60}, + {0, 63, 62}, + {0, 65, 64}, + {0, 67, 66}, + {0, 68, 12}, + {0, 29, 69}, + {0, 70, 1}, + {0, 30, 2}, + {0, 43, 71}, + {0, 73, 72}, + {0, 74, 20}, + {0, 75, 19}, + {0, 77, 76}, + {0, 13, 78}, + {0, 80, 79}, + {0, 82, 81}, + {0, 84, 83}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {144116905, 0, 0}, + {1158021131, 0, 0}, + {1784648440, 0, 0}, + {2798552666, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 5}, + {0, 4, 2}, + {0, 6, 3}, + {0, 8, 7}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(5, { + {0, 0, 0}, + {142465290, 0, 0}, + {1782996825, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 1}, + {0, 4, 3}, + })); + + codecs.emplace(std::pair(SpvOpAccessChain, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 2, 5}, + {0, 6, 1}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(59, { + {0, 0, 0}, + {177111659, 0, 0}, + {413918748, 0, 0}, + {529383565, 0, 0}, + {646282397, 0, 0}, + {837715723, 0, 0}, + {1019457583, 0, 0}, + {1022544883, 0, 0}, + {1054461787, 0, 0}, + {1097775533, 0, 0}, + {1136775085, 0, 0}, + {1191015885, 0, 0}, + {1196280518, 0, 0}, + {1203545131, 0, 0}, + {1352628475, 0, 0}, + {1367301635, 0, 0}, + {1918742169, 0, 0}, + {1922045399, 0, 0}, + {2055836767, 0, 0}, + {2183547611, 0, 0}, + {2204920111, 0, 0}, + {2358141757, 0, 0}, + {2572638469, 0, 0}, + {2597020383, 0, 0}, + {2842919847, 0, 0}, + {3619787319, 0, 0}, + {3701632935, 0, 0}, + {3783543823, 0, 0}, + {4245257809, 0, 0}, + {4265894873, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 11, 23}, + {0, 12, 2}, + {0, 9, 7}, + {0, 21, 19}, + {0, 4, 29}, + {0, 10, 28}, + {0, 17, 16}, + {0, 27, 3}, + {0, 32, 31}, + {0, 33, 22}, + {0, 6, 34}, + {0, 35, 8}, + {0, 36, 24}, + {0, 38, 37}, + {0, 1, 14}, + {0, 39, 20}, + {0, 5, 40}, + {0, 42, 41}, + {0, 43, 26}, + {0, 45, 44}, + {0, 47, 46}, + {0, 48, 18}, + {0, 15, 49}, + {0, 50, 25}, + {0, 51, 13}, + {0, 53, 52}, + {0, 55, 54}, + {0, 57, 56}, + {0, 30, 58}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(59, { + {0, 0, 0}, + {236660303, 0, 0}, + {342159236, 0, 0}, + {371428004, 0, 0}, + {373079619, 0, 0}, + {488500848, 0, 0}, + {495107308, 0, 0}, + {864295921, 0, 0}, + {1071164424, 0, 0}, + {1136911283, 0, 0}, + {1178317551, 0, 0}, + {1510422521, 0, 0}, + {1570165302, 0, 0}, + {1822823090, 0, 0}, + {1858116930, 0, 0}, + {1977038330, 0, 0}, + {2096388952, 0, 0}, + {2157103435, 0, 0}, + {2231688008, 0, 0}, + {2604576561, 0, 0}, + {2622612602, 0, 0}, + {2771938750, 0, 0}, + {2777172031, 0, 0}, + {2996594997, 0, 0}, + {3187066832, 0, 0}, + {3496407048, 0, 0}, + {3570411982, 0, 0}, + {3609540589, 0, 0}, + {3713290482, 0, 0}, + {3797761273, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 18, 8}, + {0, 27, 9}, + {0, 21, 10}, + {0, 14, 24}, + {0, 12, 19}, + {0, 11, 15}, + {0, 23, 2}, + {0, 7, 13}, + {0, 31, 22}, + {0, 32, 4}, + {0, 33, 29}, + {0, 34, 1}, + {0, 35, 3}, + {0, 37, 36}, + {0, 38, 28}, + {0, 39, 5}, + {0, 41, 40}, + {0, 42, 17}, + {0, 16, 43}, + {0, 45, 44}, + {0, 46, 6}, + {0, 48, 47}, + {0, 50, 49}, + {0, 52, 51}, + {0, 25, 53}, + {0, 54, 20}, + {0, 55, 26}, + {0, 57, 56}, + {0, 30, 58}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(47, { + {0, 0, 0}, + {236660303, 0, 0}, + {342159236, 0, 0}, + {488500848, 0, 0}, + {495107308, 0, 0}, + {864295921, 0, 0}, + {1178317551, 0, 0}, + {1510422521, 0, 0}, + {1570165302, 0, 0}, + {1858116930, 0, 0}, + {1977038330, 0, 0}, + {2096388952, 0, 0}, + {2157103435, 0, 0}, + {2231688008, 0, 0}, + {2604576561, 0, 0}, + {2622612602, 0, 0}, + {2771938750, 0, 0}, + {2777172031, 0, 0}, + {2996594997, 0, 0}, + {3496407048, 0, 0}, + {3570411982, 0, 0}, + {3609540589, 0, 0}, + {3713290482, 0, 0}, + {3797761273, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 21, 13}, + {0, 16, 6}, + {0, 14, 9}, + {0, 7, 10}, + {0, 18, 2}, + {0, 17, 5}, + {0, 25, 8}, + {0, 22, 12}, + {0, 26, 23}, + {0, 27, 1}, + {0, 28, 3}, + {0, 30, 29}, + {0, 32, 31}, + {0, 34, 33}, + {0, 35, 11}, + {0, 36, 4}, + {0, 38, 37}, + {0, 40, 39}, + {0, 41, 15}, + {0, 42, 19}, + {0, 20, 43}, + {0, 45, 44}, + {0, 24, 46}, + })); + + codecs.emplace(std::pair(SpvOpVectorShuffle, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {679771963, 0, 0}, + {1146476634, 0, 0}, + {2160380860, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {3800912395, 0, 0}, + {3802564010, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 3}, + {0, 9, 6}, + {0, 8, 7}, + {0, 11, 10}, + {0, 4, 12}, + {0, 5, 13}, + {0, 14, 1}, + })); + + codecs.emplace(std::pair(SpvOpCompositeConstruct, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(79, { + {0, 0, 0}, + {107497541, 0, 0}, + {289648234, 0, 0}, + {348584153, 0, 0}, + {369686787, 0, 0}, + {429277936, 0, 0}, + {449954059, 0, 0}, + {508217552, 0, 0}, + {742917749, 0, 0}, + {1032593647, 0, 0}, + {1158929937, 0, 0}, + {1209418480, 0, 0}, + {1319785741, 0, 0}, + {1321616112, 0, 0}, + {1417363940, 0, 0}, + {1541020250, 0, 0}, + {1564342316, 0, 0}, + {1578775276, 0, 0}, + {1631434666, 0, 0}, + {1636389511, 0, 0}, + {2012838864, 0, 0}, + {2262137600, 0, 0}, + {2281956980, 0, 0}, + {2359973133, 0, 0}, + {2464905186, 0, 0}, + {2613179511, 0, 0}, + {2621255555, 0, 0}, + {2817335337, 0, 0}, + {2881302403, 0, 0}, + {3063300848, 0, 0}, + {3151638847, 0, 0}, + {3233393284, 0, 0}, + {3323682385, 0, 0}, + {3337532056, 0, 0}, + {3456899824, 0, 0}, + {3547456240, 0, 0}, + {3675926744, 0, 0}, + {3753486980, 0, 0}, + {3931641900, 0, 0}, + {3970432934, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 25, 1}, + {0, 6, 4}, + {0, 8, 19}, + {0, 39, 24}, + {0, 3, 2}, + {0, 34, 14}, + {0, 10, 9}, + {0, 18, 38}, + {0, 32, 15}, + {0, 27, 16}, + {0, 28, 35}, + {0, 13, 26}, + {0, 20, 23}, + {0, 21, 11}, + {0, 36, 33}, + {0, 5, 22}, + {0, 42, 41}, + {0, 43, 29}, + {0, 45, 44}, + {0, 7, 46}, + {0, 48, 47}, + {0, 30, 31}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 55, 17}, + {0, 57, 56}, + {0, 59, 58}, + {0, 61, 60}, + {0, 62, 12}, + {0, 64, 63}, + {0, 66, 65}, + {0, 67, 37}, + {0, 69, 68}, + {0, 71, 70}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 40, 78}, + })); + + codecs.emplace(std::pair(SpvOpCompositeConstruct, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(87, { + {0, 0, 0}, + {153013225, 0, 0}, + {296836635, 0, 0}, + {296981500, 0, 0}, + {778500192, 0, 0}, + {810488476, 0, 0}, + {848380423, 0, 0}, + {900522183, 0, 0}, + {910398460, 0, 0}, + {959681532, 0, 0}, + {1141965917, 0, 0}, + {1287304304, 0, 0}, + {1323407757, 0, 0}, + {1417363940, 0, 0}, + {1471851763, 0, 0}, + {1526654696, 0, 0}, + {1654776395, 0, 0}, + {1684282922, 0, 0}, + {1739837626, 0, 0}, + {1791352211, 0, 0}, + {2195550588, 0, 0}, + {2319227476, 0, 0}, + {2491124112, 0, 0}, + {2789375411, 0, 0}, + {2807448986, 0, 0}, + {2817579280, 0, 0}, + {2835131395, 0, 0}, + {2847102741, 0, 0}, + {2855506940, 0, 0}, + {2860348412, 0, 0}, + {3079287749, 0, 0}, + {3091876332, 0, 0}, + {3168953855, 0, 0}, + {3374978006, 0, 0}, + {3399062057, 0, 0}, + {3510257966, 0, 0}, + {3554463148, 0, 0}, + {3579593979, 0, 0}, + {3757851979, 0, 0}, + {3759503594, 0, 0}, + {3761155209, 0, 0}, + {3762806824, 0, 0}, + {3902853271, 0, 0}, + {4140081844, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 38, 42}, + {0, 14, 23}, + {0, 26, 18}, + {0, 39, 35}, + {0, 6, 40}, + {0, 16, 13}, + {0, 33, 34}, + {0, 12, 4}, + {0, 27, 41}, + {0, 25, 21}, + {0, 24, 1}, + {0, 37, 19}, + {0, 32, 22}, + {0, 2, 8}, + {0, 20, 17}, + {0, 43, 36}, + {0, 29, 15}, + {0, 46, 45}, + {0, 48, 47}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 7, 55}, + {0, 56, 30}, + {0, 57, 5}, + {0, 59, 58}, + {0, 60, 11}, + {0, 9, 61}, + {0, 63, 62}, + {0, 65, 64}, + {0, 66, 31}, + {0, 68, 67}, + {0, 10, 69}, + {0, 71, 70}, + {0, 28, 72}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + {0, 79, 3}, + {0, 81, 80}, + {0, 83, 82}, + {0, 85, 84}, + {0, 44, 86}, + })); + + codecs.emplace(std::pair(SpvOpCompositeConstruct, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(81, { + {0, 0, 0}, + {14244860, 0, 0}, + {150820676, 0, 0}, + {153013225, 0, 0}, + {269823086, 0, 0}, + {289648234, 0, 0}, + {296981500, 0, 0}, + {678695941, 0, 0}, + {810488476, 0, 0}, + {850592577, 0, 0}, + {870594305, 0, 0}, + {910398460, 0, 0}, + {959681532, 0, 0}, + {1206571206, 0, 0}, + {1287304304, 0, 0}, + {1323407757, 0, 0}, + {1471851763, 0, 0}, + {1526654696, 0, 0}, + {1684282922, 0, 0}, + {1734446471, 0, 0}, + {1758530522, 0, 0}, + {2117320444, 0, 0}, + {2118972059, 0, 0}, + {2120623674, 0, 0}, + {2122275289, 0, 0}, + {2219733501, 0, 0}, + {2262321736, 0, 0}, + {2807448986, 0, 0}, + {2817579280, 0, 0}, + {2835131395, 0, 0}, + {2855506940, 0, 0}, + {2860348412, 0, 0}, + {2951272396, 0, 0}, + {3079287749, 0, 0}, + {3168953855, 0, 0}, + {3502816184, 0, 0}, + {3510257966, 0, 0}, + {3554463148, 0, 0}, + {3997952447, 0, 0}, + {4140081844, 0, 0}, + {4182141402, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 21, 26}, + {0, 29, 16}, + {0, 22, 36}, + {0, 1, 23}, + {0, 20, 5}, + {0, 19, 35}, + {0, 10, 38}, + {0, 13, 24}, + {0, 28, 7}, + {0, 27, 3}, + {0, 40, 2}, + {0, 34, 9}, + {0, 32, 11}, + {0, 33, 18}, + {0, 39, 37}, + {0, 31, 17}, + {0, 43, 42}, + {0, 45, 44}, + {0, 47, 46}, + {0, 49, 48}, + {0, 51, 50}, + {0, 8, 52}, + {0, 15, 53}, + {0, 55, 54}, + {0, 56, 14}, + {0, 58, 57}, + {0, 60, 59}, + {0, 61, 25}, + {0, 63, 62}, + {0, 4, 64}, + {0, 66, 65}, + {0, 68, 67}, + {0, 70, 69}, + {0, 71, 12}, + {0, 6, 72}, + {0, 30, 73}, + {0, 75, 74}, + {0, 77, 76}, + {0, 79, 78}, + {0, 41, 80}, + })); + + codecs.emplace(std::pair(SpvOpCompositeConstruct, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(111, { + {0, 0, 0}, + {34183582, 0, 0}, + {93914936, 0, 0}, + {94303122, 0, 0}, + {117998987, 0, 0}, + {153013225, 0, 0}, + {296981500, 0, 0}, + {451264926, 0, 0}, + {473485679, 0, 0}, + {476788909, 0, 0}, + {478440524, 0, 0}, + {480092139, 0, 0}, + {481743754, 0, 0}, + {810488476, 0, 0}, + {871966503, 0, 0}, + {910398460, 0, 0}, + {918189168, 0, 0}, + {933769938, 0, 0}, + {959681532, 0, 0}, + {1149665466, 0, 0}, + {1166917451, 0, 0}, + {1227221002, 0, 0}, + {1310740861, 0, 0}, + {1323407757, 0, 0}, + {1341516288, 0, 0}, + {1373166395, 0, 0}, + {1445161581, 0, 0}, + {1461645203, 0, 0}, + {1471851763, 0, 0}, + {1526654696, 0, 0}, + {1561718045, 0, 0}, + {1593584949, 0, 0}, + {1684282922, 0, 0}, + {1800404122, 0, 0}, + {1862284649, 0, 0}, + {2213411495, 0, 0}, + {2668680621, 0, 0}, + {2805256437, 0, 0}, + {2807448986, 0, 0}, + {2835131395, 0, 0}, + {2855506940, 0, 0}, + {2860348412, 0, 0}, + {3000904950, 0, 0}, + {3107413701, 0, 0}, + {3168953855, 0, 0}, + {3333131702, 0, 0}, + {3365041621, 0, 0}, + {3456899824, 0, 0}, + {3505028338, 0, 0}, + {3510257966, 0, 0}, + {3554463148, 0, 0}, + {3606320646, 0, 0}, + {3692647551, 0, 0}, + {3861006967, 0, 0}, + {4126287524, 0, 0}, + {4140081844, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 14, 33}, + {0, 35, 25}, + {0, 27, 17}, + {0, 8, 20}, + {0, 3, 54}, + {0, 1, 19}, + {0, 10, 46}, + {0, 11, 9}, + {0, 39, 28}, + {0, 53, 49}, + {0, 12, 2}, + {0, 34, 4}, + {0, 47, 36}, + {0, 23, 45}, + {0, 5, 37}, + {0, 24, 38}, + {0, 43, 26}, + {0, 48, 51}, + {0, 44, 32}, + {0, 15, 16}, + {0, 57, 22}, + {0, 55, 50}, + {0, 29, 58}, + {0, 60, 59}, + {0, 41, 61}, + {0, 63, 62}, + {0, 65, 64}, + {0, 67, 66}, + {0, 69, 68}, + {0, 13, 70}, + {0, 71, 7}, + {0, 42, 31}, + {0, 73, 72}, + {0, 75, 74}, + {0, 21, 30}, + {0, 77, 76}, + {0, 79, 78}, + {0, 81, 80}, + {0, 82, 18}, + {0, 84, 83}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 52, 91}, + {0, 6, 92}, + {0, 94, 93}, + {0, 96, 95}, + {0, 98, 97}, + {0, 99, 40}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 56, 110}, + })); + + codecs.emplace(std::pair(SpvOpCompositeConstruct, 4), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(155, { + {0, 0, 0}, + {18776483, 0, 0}, + {37009196, 0, 0}, + {277023757, 0, 0}, + {296981500, 0, 0}, + {348988933, 0, 0}, + {451264926, 0, 0}, + {564884461, 0, 0}, + {804899022, 0, 0}, + {810488476, 0, 0}, + {870594305, 0, 0}, + {876864198, 0, 0}, + {900522183, 0, 0}, + {928261291, 0, 0}, + {959681532, 0, 0}, + {1164724902, 0, 0}, + {1323407757, 0, 0}, + {1332774287, 0, 0}, + {1404739463, 0, 0}, + {1447712361, 0, 0}, + {1450415100, 0, 0}, + {1513770932, 0, 0}, + {1620634991, 0, 0}, + {1692600167, 0, 0}, + {1860649552, 0, 0}, + {1932614728, 0, 0}, + {2087004702, 0, 0}, + {2148510256, 0, 0}, + {2220475432, 0, 0}, + {2388524817, 0, 0}, + {2460489993, 0, 0}, + {2676385521, 0, 0}, + {2748350697, 0, 0}, + {2855506940, 0, 0}, + {2860348412, 0, 0}, + {2916400082, 0, 0}, + {2988365258, 0, 0}, + {3061856840, 0, 0}, + {3063508455, 0, 0}, + {3065160070, 0, 0}, + {3066811685, 0, 0}, + {3068463300, 0, 0}, + {3070114915, 0, 0}, + {3071766530, 0, 0}, + {3073418145, 0, 0}, + {3075069760, 0, 0}, + {3076721375, 0, 0}, + {3078372990, 0, 0}, + {3080024605, 0, 0}, + {3081676220, 0, 0}, + {3083327835, 0, 0}, + {3084979450, 0, 0}, + {3086631065, 0, 0}, + {3088282680, 0, 0}, + {3114708520, 0, 0}, + {3116360135, 0, 0}, + {3118011750, 0, 0}, + {3119663365, 0, 0}, + {3121314980, 0, 0}, + {3124618210, 0, 0}, + {3126269825, 0, 0}, + {3127921440, 0, 0}, + {3129573055, 0, 0}, + {3131224670, 0, 0}, + {3132876285, 0, 0}, + {3134527900, 0, 0}, + {3136179515, 0, 0}, + {3204260786, 0, 0}, + {3264086791, 0, 0}, + {3276225962, 0, 0}, + {3444275347, 0, 0}, + {3516240523, 0, 0}, + {3588205699, 0, 0}, + {3732136051, 0, 0}, + {3804101227, 0, 0}, + {3874089391, 0, 0}, + {4044115788, 0, 0}, + {4116080964, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 45, 43}, + {0, 3, 46}, + {0, 71, 36}, + {0, 44, 34}, + {0, 76, 54}, + {0, 73, 55}, + {0, 57, 67}, + {0, 51, 56}, + {0, 31, 27}, + {0, 38, 37}, + {0, 40, 39}, + {0, 42, 41}, + {0, 49, 47}, + {0, 35, 50}, + {0, 21, 70}, + {0, 19, 5}, + {0, 8, 58}, + {0, 17, 11}, + {0, 24, 18}, + {0, 30, 29}, + {0, 52, 9}, + {0, 77, 22}, + {0, 62, 48}, + {0, 25, 53}, + {0, 20, 59}, + {0, 26, 60}, + {0, 72, 6}, + {0, 79, 69}, + {0, 80, 7}, + {0, 81, 2}, + {0, 12, 13}, + {0, 82, 68}, + {0, 65, 61}, + {0, 74, 63}, + {0, 23, 83}, + {0, 64, 10}, + {0, 84, 32}, + {0, 66, 28}, + {0, 15, 85}, + {0, 86, 16}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 1, 93}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 100, 75}, + {0, 102, 101}, + {0, 104, 103}, + {0, 106, 105}, + {0, 107, 14}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 127, 126}, + {0, 129, 128}, + {0, 131, 130}, + {0, 133, 132}, + {0, 135, 134}, + {0, 137, 136}, + {0, 139, 138}, + {0, 141, 140}, + {0, 143, 142}, + {0, 145, 144}, + {0, 147, 146}, + {0, 33, 148}, + {0, 4, 149}, + {0, 78, 150}, + {0, 152, 151}, + {0, 154, 153}, + })); + + codecs.emplace(std::pair(SpvOpCompositeConstruct, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {679771963, 0, 0}, + {789872778, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 2}, + {0, 4, 7}, + {0, 1, 8}, + {0, 9, 5}, + {0, 3, 10}, + })); + + codecs.emplace(std::pair(SpvOpCompositeExtract, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(49, { + {0, 0, 0}, + {126463145, 0, 0}, + {171307615, 0, 0}, + {342159236, 0, 0}, + {354479447, 0, 0}, + {593829839, 0, 0}, + {743407979, 0, 0}, + {898191441, 0, 0}, + {900522183, 0, 0}, + {1265796414, 0, 0}, + {1287304304, 0, 0}, + {1356063462, 0, 0}, + {1368383673, 0, 0}, + {1526654696, 0, 0}, + {1766994680, 0, 0}, + {1793544760, 0, 0}, + {1811839150, 0, 0}, + {2234361374, 0, 0}, + {2279700640, 0, 0}, + {2383939514, 0, 0}, + {2780898906, 0, 0}, + {2996594997, 0, 0}, + {3413713311, 0, 0}, + {3554463148, 0, 0}, + {3635542517, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 11, 15}, + {0, 20, 14}, + {0, 7, 18}, + {0, 6, 1}, + {0, 12, 10}, + {0, 23, 19}, + {0, 13, 5}, + {0, 24, 17}, + {0, 21, 3}, + {0, 22, 16}, + {0, 26, 2}, + {0, 27, 8}, + {0, 4, 28}, + {0, 29, 9}, + {0, 31, 30}, + {0, 33, 32}, + {0, 35, 34}, + {0, 37, 36}, + {0, 39, 38}, + {0, 41, 40}, + {0, 43, 42}, + {0, 45, 44}, + {0, 47, 46}, + {0, 25, 48}, + })); + + codecs.emplace(std::pair(SpvOpCompositeExtract, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(153, { + {0, 0, 0}, + {13107491, 0, 0}, + {257136089, 0, 0}, + {293528591, 0, 0}, + {321459212, 0, 0}, + {425022309, 0, 0}, + {490769168, 0, 0}, + {495107308, 0, 0}, + {517919178, 0, 0}, + {617312262, 0, 0}, + {708736129, 0, 0}, + {753756604, 0, 0}, + {765238787, 0, 0}, + {796985462, 0, 0}, + {819503463, 0, 0}, + {850497536, 0, 0}, + {948086521, 0, 0}, + {1004589179, 0, 0}, + {1120149824, 0, 0}, + {1165671422, 0, 0}, + {1203545131, 0, 0}, + {1297165140, 0, 0}, + {1335363438, 0, 0}, + {1351676723, 0, 0}, + {1391866096, 0, 0}, + {1584369690, 0, 0}, + {1631216488, 0, 0}, + {1691646294, 0, 0}, + {1779143013, 0, 0}, + {1858116930, 0, 0}, + {1890300748, 0, 0}, + {1915438939, 0, 0}, + {1918742169, 0, 0}, + {1922045399, 0, 0}, + {1961990747, 0, 0}, + {2037710159, 0, 0}, + {2037814253, 0, 0}, + {2043873558, 0, 0}, + {2096388952, 0, 0}, + {2169307971, 0, 0}, + {2257843797, 0, 0}, + {2262220987, 0, 0}, + {2338272340, 0, 0}, + {2405770322, 0, 0}, + {2498042266, 0, 0}, + {2563789125, 0, 0}, + {2588618056, 0, 0}, + {2645120714, 0, 0}, + {2864863800, 0, 0}, + {2909957084, 0, 0}, + {2975894973, 0, 0}, + {3041450802, 0, 0}, + {3151638847, 0, 0}, + {3187066832, 0, 0}, + {3244716568, 0, 0}, + {3271748023, 0, 0}, + {3304438238, 0, 0}, + {3312467582, 0, 0}, + {3325419312, 0, 0}, + {3370185097, 0, 0}, + {3419674548, 0, 0}, + {3435931956, 0, 0}, + {3504158761, 0, 0}, + {3602522282, 0, 0}, + {3653059026, 0, 0}, + {3716353056, 0, 0}, + {3782099915, 0, 0}, + {3838648480, 0, 0}, + {3847846774, 0, 0}, + {3913593633, 0, 0}, + {3989799199, 0, 0}, + {3997038726, 0, 0}, + {4046301857, 0, 0}, + {4092654294, 0, 0}, + {4176581069, 0, 0}, + {4242327928, 0, 0}, + {4285652249, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 74, 38}, + {0, 12, 56}, + {0, 28, 24}, + {0, 60, 43}, + {0, 65, 72}, + {0, 18, 2}, + {0, 52, 3}, + {0, 19, 10}, + {0, 49, 36}, + {0, 67, 66}, + {0, 41, 17}, + {0, 53, 11}, + {0, 29, 68}, + {0, 26, 55}, + {0, 70, 76}, + {0, 73, 47}, + {0, 51, 22}, + {0, 39, 21}, + {0, 5, 9}, + {0, 40, 48}, + {0, 59, 44}, + {0, 6, 69}, + {0, 32, 31}, + {0, 4, 33}, + {0, 13, 54}, + {0, 14, 50}, + {0, 35, 75}, + {0, 58, 23}, + {0, 16, 34}, + {0, 27, 63}, + {0, 45, 61}, + {0, 20, 46}, + {0, 71, 1}, + {0, 79, 78}, + {0, 81, 80}, + {0, 83, 82}, + {0, 84, 8}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + {0, 96, 95}, + {0, 98, 97}, + {0, 64, 99}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 106, 62}, + {0, 108, 107}, + {0, 110, 109}, + {0, 7, 111}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 30, 124}, + {0, 126, 125}, + {0, 128, 127}, + {0, 130, 129}, + {0, 132, 131}, + {0, 134, 133}, + {0, 135, 25}, + {0, 57, 136}, + {0, 138, 137}, + {0, 42, 139}, + {0, 37, 140}, + {0, 142, 141}, + {0, 143, 15}, + {0, 145, 144}, + {0, 147, 146}, + {0, 149, 148}, + {0, 151, 150}, + {0, 152, 77}, + })); + + codecs.emplace(std::pair(SpvOpCompositeExtract, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(47, { + {0, 0, 0}, + {545678922, 0, 0}, + {630592085, 0, 0}, + {679771963, 0, 0}, + {899570100, 0, 0}, + {906176560, 0, 0}, + {929101967, 0, 0}, + {1100599986, 0, 0}, + {1103903216, 0, 0}, + {1107206446, 0, 0}, + {1369578001, 0, 0}, + {1372881231, 0, 0}, + {2320303498, 0, 0}, + {2926633629, 0, 0}, + {3249265647, 0, 0}, + {3334207724, 0, 0}, + {3486057732, 0, 0}, + {3674863070, 0, 0}, + {3705139860, 0, 0}, + {3800912395, 0, 0}, + {3802564010, 0, 0}, + {3822983876, 0, 0}, + {4141567741, 0, 0}, + {4292991777, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 9, 17}, + {0, 20, 11}, + {0, 25, 5}, + {0, 2, 14}, + {0, 23, 13}, + {0, 16, 26}, + {0, 27, 24}, + {0, 28, 8}, + {0, 29, 18}, + {0, 22, 30}, + {0, 6, 31}, + {0, 21, 32}, + {0, 3, 33}, + {0, 35, 34}, + {0, 1, 12}, + {0, 10, 36}, + {0, 37, 19}, + {0, 4, 15}, + {0, 39, 38}, + {0, 7, 40}, + {0, 42, 41}, + {0, 44, 43}, + {0, 46, 45}, + })); + + codecs.emplace(std::pair(SpvOpCompositeInsert, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(103, { + {0, 0, 0}, + {125792961, 0, 0}, + {132755933, 0, 0}, + {156014509, 0, 0}, + {436066778, 0, 0}, + {463084678, 0, 0}, + {531559080, 0, 0}, + {565233904, 0, 0}, + {578132535, 0, 0}, + {600906020, 0, 0}, + {602222721, 0, 0}, + {694743357, 0, 0}, + {760554870, 0, 0}, + {996663016, 0, 0}, + {1022309772, 0, 0}, + {1351676723, 0, 0}, + {1496901698, 0, 0}, + {1502470404, 0, 0}, + {1522901980, 0, 0}, + {1548254487, 0, 0}, + {1637661947, 0, 0}, + {1788504755, 0, 0}, + {2092468906, 0, 0}, + {2094647776, 0, 0}, + {2127660080, 0, 0}, + {2213946343, 0, 0}, + {2225172640, 0, 0}, + {2259467579, 0, 0}, + {2263866576, 0, 0}, + {2600961503, 0, 0}, + {2727022058, 0, 0}, + {2752967311, 0, 0}, + {2864705739, 0, 0}, + {3021406120, 0, 0}, + {3044723416, 0, 0}, + {3052439312, 0, 0}, + {3136865519, 0, 0}, + {3297860332, 0, 0}, + {3352361837, 0, 0}, + {3670298840, 0, 0}, + {3712946115, 0, 0}, + {3732709413, 0, 0}, + {3764662384, 0, 0}, + {3788324110, 0, 0}, + {3928555688, 0, 0}, + {4083347580, 0, 0}, + {4098876453, 0, 0}, + {4147239510, 0, 0}, + {4199470013, 0, 0}, + {4211577142, 0, 0}, + {4218799564, 0, 0}, + {4290374884, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 2}, + {0, 9, 8}, + {0, 17, 10}, + {0, 20, 18}, + {0, 22, 21}, + {0, 26, 23}, + {0, 31, 29}, + {0, 35, 34}, + {0, 45, 36}, + {0, 5, 3}, + {0, 12, 6}, + {0, 15, 14}, + {0, 25, 19}, + {0, 28, 27}, + {0, 38, 33}, + {0, 43, 39}, + {0, 47, 46}, + {0, 50, 49}, + {0, 7, 51}, + {0, 1, 48}, + {0, 37, 24}, + {0, 44, 42}, + {0, 13, 11}, + {0, 41, 40}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 60, 59}, + {0, 62, 61}, + {0, 64, 63}, + {0, 66, 65}, + {0, 68, 67}, + {0, 70, 69}, + {0, 72, 71}, + {0, 30, 16}, + {0, 73, 32}, + {0, 75, 74}, + {0, 77, 76}, + {0, 79, 78}, + {0, 81, 80}, + {0, 83, 82}, + {0, 85, 84}, + {0, 87, 86}, + {0, 89, 88}, + {0, 91, 90}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 52, 102}, + })); + + codecs.emplace(std::pair(SpvOpCompositeInsert, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(93, { + {0, 0, 0}, + {17185761, 0, 0}, + {117250846, 0, 0}, + {296981500, 0, 0}, + {330388453, 0, 0}, + {346929928, 0, 0}, + {533021259, 0, 0}, + {564302770, 0, 0}, + {680157484, 0, 0}, + {721450866, 0, 0}, + {798549062, 0, 0}, + {853200279, 0, 0}, + {864295921, 0, 0}, + {900522183, 0, 0}, + {973908139, 0, 0}, + {983243705, 0, 0}, + {1033363654, 0, 0}, + {1037370721, 0, 0}, + {1464587427, 0, 0}, + {1670691893, 0, 0}, + {1686512349, 0, 0}, + {1849065716, 0, 0}, + {1917602962, 0, 0}, + {1965902997, 0, 0}, + {2121980967, 0, 0}, + {2311072371, 0, 0}, + {2339901602, 0, 0}, + {2517964682, 0, 0}, + {2542834724, 0, 0}, + {2558655180, 0, 0}, + {2736881867, 0, 0}, + {2855506940, 0, 0}, + {2888753905, 0, 0}, + {2950446516, 0, 0}, + {3044188332, 0, 0}, + {3079287749, 0, 0}, + {3153451899, 0, 0}, + {3214537066, 0, 0}, + {3234673086, 0, 0}, + {3349230696, 0, 0}, + {3504158761, 0, 0}, + {3570411982, 0, 0}, + {3652695478, 0, 0}, + {3764205609, 0, 0}, + {3940720663, 0, 0}, + {4180570743, 0, 0}, + {4221373527, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 24, 18}, + {0, 4, 2}, + {0, 15, 14}, + {0, 21, 20}, + {0, 29, 26}, + {0, 42, 36}, + {0, 7, 45}, + {0, 37, 9}, + {0, 8, 5}, + {0, 32, 11}, + {0, 39, 38}, + {0, 12, 10}, + {0, 28, 19}, + {0, 1, 46}, + {0, 17, 6}, + {0, 30, 23}, + {0, 44, 33}, + {0, 35, 13}, + {0, 16, 48}, + {0, 50, 49}, + {0, 52, 51}, + {0, 54, 53}, + {0, 55, 40}, + {0, 57, 56}, + {0, 59, 58}, + {0, 61, 60}, + {0, 25, 22}, + {0, 63, 62}, + {0, 3, 64}, + {0, 66, 65}, + {0, 68, 67}, + {0, 70, 69}, + {0, 34, 71}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 27, 43}, + {0, 79, 78}, + {0, 81, 80}, + {0, 83, 82}, + {0, 84, 31}, + {0, 86, 85}, + {0, 41, 87}, + {0, 89, 88}, + {0, 91, 90}, + {0, 47, 92}, + })); + + codecs.emplace(std::pair(SpvOpCompositeInsert, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(115, { + {0, 0, 0}, + {132755933, 0, 0}, + {156014509, 0, 0}, + {255227811, 0, 0}, + {371186900, 0, 0}, + {371428004, 0, 0}, + {374731234, 0, 0}, + {531559080, 0, 0}, + {565233904, 0, 0}, + {578132535, 0, 0}, + {591140762, 0, 0}, + {600906020, 0, 0}, + {602222721, 0, 0}, + {656610661, 0, 0}, + {760554870, 0, 0}, + {996663016, 0, 0}, + {1022309772, 0, 0}, + {1496901698, 0, 0}, + {1502470404, 0, 0}, + {1522901980, 0, 0}, + {1536350567, 0, 0}, + {1543280290, 0, 0}, + {1548254487, 0, 0}, + {1788504755, 0, 0}, + {2064733527, 0, 0}, + {2092468906, 0, 0}, + {2094647776, 0, 0}, + {2162986400, 0, 0}, + {2225172640, 0, 0}, + {2259467579, 0, 0}, + {2263866576, 0, 0}, + {2360004627, 0, 0}, + {2507709226, 0, 0}, + {2600961503, 0, 0}, + {2727022058, 0, 0}, + {2752967311, 0, 0}, + {2864705739, 0, 0}, + {3021406120, 0, 0}, + {3052439312, 0, 0}, + {3136865519, 0, 0}, + {3297860332, 0, 0}, + {3352361837, 0, 0}, + {3598957382, 0, 0}, + {3619787319, 0, 0}, + {3655201337, 0, 0}, + {3670298840, 0, 0}, + {3774892253, 0, 0}, + {3788324110, 0, 0}, + {3808408202, 0, 0}, + {3951925872, 0, 0}, + {3952316364, 0, 0}, + {4098876453, 0, 0}, + {4147239510, 0, 0}, + {4199470013, 0, 0}, + {4211577142, 0, 0}, + {4217306348, 0, 0}, + {4218799564, 0, 0}, + {4290374884, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 43}, + {0, 4, 1}, + {0, 11, 9}, + {0, 13, 12}, + {0, 19, 18}, + {0, 25, 23}, + {0, 28, 26}, + {0, 35, 33}, + {0, 39, 38}, + {0, 2, 49}, + {0, 7, 3}, + {0, 16, 14}, + {0, 29, 22}, + {0, 37, 30}, + {0, 45, 41}, + {0, 51, 47}, + {0, 54, 52}, + {0, 57, 56}, + {0, 53, 8}, + {0, 32, 10}, + {0, 42, 40}, + {0, 24, 46}, + {0, 15, 50}, + {0, 55, 20}, + {0, 59, 44}, + {0, 61, 60}, + {0, 63, 62}, + {0, 65, 64}, + {0, 67, 66}, + {0, 69, 68}, + {0, 71, 70}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 31, 17}, + {0, 36, 34}, + {0, 79, 78}, + {0, 81, 80}, + {0, 27, 82}, + {0, 5, 21}, + {0, 48, 83}, + {0, 85, 84}, + {0, 87, 86}, + {0, 89, 88}, + {0, 91, 90}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 58, 114}, + })); + + codecs.emplace(std::pair(SpvOpCompositeInsert, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {3866587616, 0, 0}, + {3868239231, 0, 0}, + {3869890846, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 4}, + {0, 2, 5}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpSampledImage, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {1164218401, 0, 0}, + {2036361232, 0, 0}, + {2637132451, 0, 0}, + {3237903670, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 5}, + {0, 3, 6}, + {0, 1, 7}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpSampledImage, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {543558236, 0, 0}, + {1069781886, 0, 0}, + {1596005536, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 2, 5}, + {0, 1, 6}, + })); + + codecs.emplace(std::pair(SpvOpSampledImage, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1949759310, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpSampledImage, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(87, { + {0, 0, 0}, + {236660303, 0, 0}, + {347505241, 0, 0}, + {426360862, 0, 0}, + {439998433, 0, 0}, + {488500848, 0, 0}, + {495107308, 0, 0}, + {868652905, 0, 0}, + {1191735827, 0, 0}, + {1265998516, 0, 0}, + {1309728002, 0, 0}, + {1365842164, 0, 0}, + {1396344138, 0, 0}, + {1508074873, 0, 0}, + {1553476262, 0, 0}, + {1642818143, 0, 0}, + {1851510470, 0, 0}, + {1858116930, 0, 0}, + {1863199739, 0, 0}, + {1979978194, 0, 0}, + {1986584654, 0, 0}, + {2092100514, 0, 0}, + {2098706974, 0, 0}, + {2231688008, 0, 0}, + {2232491275, 0, 0}, + {2329992200, 0, 0}, + {2637935122, 0, 0}, + {2693892518, 0, 0}, + {2759250216, 0, 0}, + {2839765116, 0, 0}, + {2855895374, 0, 0}, + {2913136690, 0, 0}, + {3012980338, 0, 0}, + {3327770644, 0, 0}, + {3362344229, 0, 0}, + {3398925952, 0, 0}, + {3448018532, 0, 0}, + {3457985288, 0, 0}, + {3566035349, 0, 0}, + {3657635382, 0, 0}, + {3702405475, 0, 0}, + {3757479030, 0, 0}, + {3797204453, 0, 0}, + {4291477370, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 32, 28}, + {0, 9, 35}, + {0, 31, 11}, + {0, 10, 30}, + {0, 25, 21}, + {0, 40, 2}, + {0, 15, 19}, + {0, 24, 36}, + {0, 42, 4}, + {0, 18, 16}, + {0, 29, 26}, + {0, 43, 7}, + {0, 45, 8}, + {0, 37, 13}, + {0, 47, 46}, + {0, 48, 33}, + {0, 49, 14}, + {0, 3, 22}, + {0, 50, 12}, + {0, 41, 39}, + {0, 51, 34}, + {0, 52, 20}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 60, 59}, + {0, 61, 23}, + {0, 63, 62}, + {0, 65, 64}, + {0, 27, 66}, + {0, 67, 38}, + {0, 68, 17}, + {0, 70, 69}, + {0, 72, 71}, + {0, 74, 73}, + {0, 76, 75}, + {0, 5, 77}, + {0, 78, 1}, + {0, 80, 79}, + {0, 82, 81}, + {0, 83, 6}, + {0, 85, 84}, + {0, 44, 86}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(15, { + {0, 0, 0}, + {883854656, 0, 0}, + {1962971231, 0, 0}, + {2036361232, 0, 0}, + {2356768706, 0, 0}, + {2637132451, 0, 0}, + {3237903670, 0, 0}, + {3829682756, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 8, 2}, + {0, 6, 9}, + {0, 10, 7}, + {0, 4, 5}, + {0, 12, 11}, + {0, 3, 13}, + {0, 14, 1}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(87, { + {0, 0, 0}, + {150685616, 0, 0}, + {255302575, 0, 0}, + {414620710, 0, 0}, + {557400685, 0, 0}, + {575205902, 0, 0}, + {618761615, 0, 0}, + {646282397, 0, 0}, + {686024761, 0, 0}, + {740921498, 0, 0}, + {921246433, 0, 0}, + {1057578789, 0, 0}, + {1162127370, 0, 0}, + {1329499601, 0, 0}, + {1352628475, 0, 0}, + {1502028603, 0, 0}, + {1519723107, 0, 0}, + {1543798545, 0, 0}, + {1545450160, 0, 0}, + {1570165302, 0, 0}, + {1600392975, 0, 0}, + {1641415225, 0, 0}, + {2204920111, 0, 0}, + {2257971049, 0, 0}, + {2276405827, 0, 0}, + {2339018837, 0, 0}, + {2340670452, 0, 0}, + {2517964682, 0, 0}, + {2532518896, 0, 0}, + {2674090849, 0, 0}, + {2754074729, 0, 0}, + {2804281092, 0, 0}, + {2816338013, 0, 0}, + {2841008029, 0, 0}, + {3234673086, 0, 0}, + {3249261197, 0, 0}, + {3619787319, 0, 0}, + {3627739127, 0, 0}, + {3669223677, 0, 0}, + {3787567939, 0, 0}, + {3898287302, 0, 0}, + {4142016703, 0, 0}, + {4237092412, 0, 0}, + {4285779501, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 16, 15}, + {0, 2, 33}, + {0, 41, 35}, + {0, 32, 30}, + {0, 39, 38}, + {0, 5, 1}, + {0, 9, 43}, + {0, 40, 22}, + {0, 29, 12}, + {0, 4, 3}, + {0, 25, 37}, + {0, 34, 26}, + {0, 45, 19}, + {0, 31, 24}, + {0, 47, 46}, + {0, 48, 20}, + {0, 49, 6}, + {0, 8, 21}, + {0, 50, 11}, + {0, 13, 10}, + {0, 51, 42}, + {0, 52, 23}, + {0, 54, 53}, + {0, 56, 55}, + {0, 58, 57}, + {0, 60, 59}, + {0, 61, 28}, + {0, 63, 62}, + {0, 65, 64}, + {0, 17, 66}, + {0, 67, 18}, + {0, 68, 7}, + {0, 70, 69}, + {0, 72, 71}, + {0, 74, 73}, + {0, 76, 75}, + {0, 14, 77}, + {0, 78, 27}, + {0, 80, 79}, + {0, 82, 81}, + {0, 83, 36}, + {0, 85, 84}, + {0, 44, 86}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {2855506940, 0, 0}, + {3266548732, 0, 0}, + {3732640764, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 1}, + {0, 5, 4}, + {0, 3, 6}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleImplicitLod, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(139, { + {0, 0, 0}, + {27177503, 0, 0}, + {30663912, 0, 0}, + {151672195, 0, 0}, + {162608772, 0, 0}, + {180913835, 0, 0}, + {371621315, 0, 0}, + {414444763, 0, 0}, + {421602934, 0, 0}, + {443347828, 0, 0}, + {458937500, 0, 0}, + {587888644, 0, 0}, + {601656217, 0, 0}, + {665789406, 0, 0}, + {712168842, 0, 0}, + {730943059, 0, 0}, + {750870327, 0, 0}, + {875212982, 0, 0}, + {899320334, 0, 0}, + {973908139, 0, 0}, + {989813600, 0, 0}, + {1057606514, 0, 0}, + {1171541710, 0, 0}, + {1243764146, 0, 0}, + {1310404265, 0, 0}, + {1366337101, 0, 0}, + {1443547269, 0, 0}, + {1472185378, 0, 0}, + {1473799048, 0, 0}, + {1543935193, 0, 0}, + {1572834111, 0, 0}, + {1623013158, 0, 0}, + {1686512349, 0, 0}, + {1705716306, 0, 0}, + {1747355813, 0, 0}, + {1755165354, 0, 0}, + {1781864804, 0, 0}, + {1916983087, 0, 0}, + {1941403425, 0, 0}, + {2023008475, 0, 0}, + {2043684541, 0, 0}, + {2274226560, 0, 0}, + {2285438321, 0, 0}, + {2315690100, 0, 0}, + {2344328209, 0, 0}, + {2414725163, 0, 0}, + {2493146691, 0, 0}, + {2495155989, 0, 0}, + {2558655180, 0, 0}, + {2577859137, 0, 0}, + {2857814560, 0, 0}, + {2895151306, 0, 0}, + {2986830770, 0, 0}, + {3006548167, 0, 0}, + {3127329373, 0, 0}, + {3157581152, 0, 0}, + {3216471040, 0, 0}, + {3296722158, 0, 0}, + {3367298820, 0, 0}, + {3376009661, 0, 0}, + {3450001968, 0, 0}, + {3526837441, 0, 0}, + {3609540589, 0, 0}, + {3743398113, 0, 0}, + {3858973601, 0, 0}, + {3953984401, 0, 0}, + {3999472204, 0, 0}, + {4088613871, 0, 0}, + {4184019303, 0, 0}, + {4258229445, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 31, 16}, + {0, 58, 47}, + {0, 21, 61}, + {0, 6, 14}, + {0, 65, 23}, + {0, 35, 5}, + {0, 2, 7}, + {0, 10, 25}, + {0, 40, 22}, + {0, 9, 50}, + {0, 20, 11}, + {0, 38, 36}, + {0, 13, 12}, + {0, 67, 28}, + {0, 71, 68}, + {0, 73, 72}, + {0, 3, 29}, + {0, 27, 8}, + {0, 44, 37}, + {0, 74, 63}, + {0, 76, 75}, + {0, 18, 1}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + {0, 26, 15}, + {0, 83, 43}, + {0, 85, 84}, + {0, 19, 86}, + {0, 48, 32}, + {0, 33, 46}, + {0, 87, 49}, + {0, 89, 88}, + {0, 91, 90}, + {0, 41, 30}, + {0, 52, 42}, + {0, 64, 55}, + {0, 92, 53}, + {0, 94, 93}, + {0, 51, 39}, + {0, 45, 95}, + {0, 66, 54}, + {0, 97, 96}, + {0, 57, 98}, + {0, 99, 69}, + {0, 101, 100}, + {0, 56, 102}, + {0, 4, 59}, + {0, 34, 17}, + {0, 103, 24}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 60, 110}, + {0, 111, 62}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 127, 126}, + {0, 129, 128}, + {0, 70, 130}, + {0, 132, 131}, + {0, 134, 133}, + {0, 136, 135}, + {0, 138, 137}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(11, { + {0, 0, 0}, + {883854656, 0, 0}, + {1962971231, 0, 0}, + {2036361232, 0, 0}, + {2366506734, 0, 0}, + {3829682756, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 2}, + {0, 6, 7}, + {0, 8, 5}, + {0, 3, 9}, + {0, 1, 10}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(73, { + {0, 0, 0}, + {178571546, 0, 0}, + {223310468, 0, 0}, + {388034151, 0, 0}, + {449954059, 0, 0}, + {694743357, 0, 0}, + {797415788, 0, 0}, + {835638766, 0, 0}, + {1002144380, 0, 0}, + {1221183390, 0, 0}, + {1570165302, 0, 0}, + {1663234329, 0, 0}, + {1750829822, 0, 0}, + {1894133125, 0, 0}, + {1967643923, 0, 0}, + {1980341560, 0, 0}, + {2278706468, 0, 0}, + {2326990117, 0, 0}, + {2464905186, 0, 0}, + {2511346984, 0, 0}, + {2517964682, 0, 0}, + {2616085763, 0, 0}, + {2710583246, 0, 0}, + {2745872368, 0, 0}, + {2924263085, 0, 0}, + {3027500544, 0, 0}, + {3044723416, 0, 0}, + {3202324433, 0, 0}, + {3289213933, 0, 0}, + {3323682385, 0, 0}, + {3366848728, 0, 0}, + {3417583519, 0, 0}, + {3732916270, 0, 0}, + {3787909072, 0, 0}, + {3877813395, 0, 0}, + {4028028350, 0, 0}, + {4178218543, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 36, 31}, + {0, 15, 3}, + {0, 17, 1}, + {0, 24, 12}, + {0, 35, 34}, + {0, 28, 27}, + {0, 21, 38}, + {0, 6, 13}, + {0, 14, 7}, + {0, 39, 25}, + {0, 40, 30}, + {0, 42, 41}, + {0, 32, 43}, + {0, 23, 9}, + {0, 11, 44}, + {0, 45, 22}, + {0, 47, 46}, + {0, 2, 16}, + {0, 49, 48}, + {0, 4, 50}, + {0, 51, 18}, + {0, 53, 52}, + {0, 33, 54}, + {0, 26, 55}, + {0, 57, 56}, + {0, 5, 58}, + {0, 59, 8}, + {0, 19, 60}, + {0, 10, 61}, + {0, 29, 62}, + {0, 37, 63}, + {0, 65, 64}, + {0, 67, 66}, + {0, 20, 68}, + {0, 70, 69}, + {0, 72, 71}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {2855506940, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 5), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(13, { + {0, 0, 0}, + {3533637837, 0, 0}, + {3535289452, 0, 0}, + {3536941067, 0, 0}, + {3538592682, 0, 0}, + {3540244297, 0, 0}, + {3541895912, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 7}, + {0, 2, 8}, + {0, 9, 3}, + {0, 4, 10}, + {0, 5, 11}, + {0, 12, 6}, + })); + + codecs.emplace(std::pair(SpvOpImageSampleExplicitLod, 6), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 5}, + {0, 2, 6}, + {0, 1, 3}, + {0, 8, 7}, + })); + + codecs.emplace(std::pair(SpvOpFAdd, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(45, { + {0, 0, 0}, + {328661377, 0, 0}, + {464259778, 0, 0}, + {920941800, 0, 0}, + {969500141, 0, 0}, + {1449907751, 0, 0}, + {1451831482, 0, 0}, + {1543798545, 0, 0}, + {1545450160, 0, 0}, + {1626224034, 0, 0}, + {1669930486, 0, 0}, + {1770165905, 0, 0}, + {2278571792, 0, 0}, + {2432827426, 0, 0}, + {2656211099, 0, 0}, + {2736844435, 0, 0}, + {2870852215, 0, 0}, + {2919626325, 0, 0}, + {2923708820, 0, 0}, + {3325419312, 0, 0}, + {3678875745, 0, 0}, + {4182141402, 0, 0}, + {4241374559, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 2, 6}, + {0, 9, 13}, + {0, 5, 15}, + {0, 4, 11}, + {0, 20, 22}, + {0, 10, 1}, + {0, 18, 14}, + {0, 16, 3}, + {0, 12, 21}, + {0, 8, 7}, + {0, 24, 17}, + {0, 19, 25}, + {0, 27, 26}, + {0, 29, 28}, + {0, 31, 30}, + {0, 33, 32}, + {0, 35, 34}, + {0, 37, 36}, + {0, 39, 38}, + {0, 41, 40}, + {0, 43, 42}, + {0, 23, 44}, + })); + + codecs.emplace(std::pair(SpvOpFAdd, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(89, { + {0, 0, 0}, + {135920445, 0, 0}, + {176166202, 0, 0}, + {294390719, 0, 0}, + {296981500, 0, 0}, + {743407979, 0, 0}, + {810488476, 0, 0}, + {837715723, 0, 0}, + {885020215, 0, 0}, + {922996215, 0, 0}, + {959681532, 0, 0}, + {963902061, 0, 0}, + {1136775085, 0, 0}, + {1189681639, 0, 0}, + {1203545131, 0, 0}, + {1297294717, 0, 0}, + {1317058015, 0, 0}, + {1352397672, 0, 0}, + {1367301635, 0, 0}, + {1412908157, 0, 0}, + {1570165302, 0, 0}, + {1763758554, 0, 0}, + {1791427568, 0, 0}, + {1992893964, 0, 0}, + {2013867381, 0, 0}, + {2096388952, 0, 0}, + {2219733501, 0, 0}, + {2383939514, 0, 0}, + {2517964682, 0, 0}, + {2555315060, 0, 0}, + {2572638469, 0, 0}, + {2762094724, 0, 0}, + {2770161927, 0, 0}, + {2855506940, 0, 0}, + {3044188332, 0, 0}, + {3187066832, 0, 0}, + {3319278167, 0, 0}, + {3653838348, 0, 0}, + {3675926744, 0, 0}, + {3701632935, 0, 0}, + {3712946115, 0, 0}, + {3732709413, 0, 0}, + {3743748793, 0, 0}, + {3783543823, 0, 0}, + {3930727258, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 15, 12}, + {0, 38, 16}, + {0, 41, 40}, + {0, 1, 33}, + {0, 21, 34}, + {0, 9, 2}, + {0, 24, 7}, + {0, 39, 44}, + {0, 29, 22}, + {0, 17, 19}, + {0, 36, 32}, + {0, 26, 18}, + {0, 30, 3}, + {0, 11, 8}, + {0, 42, 35}, + {0, 46, 31}, + {0, 27, 5}, + {0, 48, 47}, + {0, 28, 49}, + {0, 51, 50}, + {0, 52, 23}, + {0, 54, 53}, + {0, 13, 14}, + {0, 6, 55}, + {0, 57, 56}, + {0, 59, 58}, + {0, 60, 43}, + {0, 62, 61}, + {0, 37, 63}, + {0, 65, 64}, + {0, 67, 66}, + {0, 69, 68}, + {0, 70, 4}, + {0, 10, 71}, + {0, 72, 20}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + {0, 80, 79}, + {0, 81, 25}, + {0, 83, 82}, + {0, 85, 84}, + {0, 87, 86}, + {0, 45, 88}, + })); + + codecs.emplace(std::pair(SpvOpFAdd, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(103, { + {0, 0, 0}, + {126463145, 0, 0}, + {220008971, 0, 0}, + {246375791, 0, 0}, + {503145996, 0, 0}, + {628331516, 0, 0}, + {643418617, 0, 0}, + {743407979, 0, 0}, + {837715723, 0, 0}, + {858902117, 0, 0}, + {870594305, 0, 0}, + {939671928, 0, 0}, + {959681532, 0, 0}, + {1051471757, 0, 0}, + {1092948665, 0, 0}, + {1097775533, 0, 0}, + {1136775085, 0, 0}, + {1140367371, 0, 0}, + {1332643570, 0, 0}, + {1367301635, 0, 0}, + {1558001705, 0, 0}, + {1684282922, 0, 0}, + {2096388952, 0, 0}, + {2183547611, 0, 0}, + {2219733501, 0, 0}, + {2358141757, 0, 0}, + {2359973133, 0, 0}, + {2383939514, 0, 0}, + {2444465148, 0, 0}, + {2517964682, 0, 0}, + {2567901801, 0, 0}, + {2598189097, 0, 0}, + {2655147757, 0, 0}, + {2683080096, 0, 0}, + {2705434194, 0, 0}, + {2738307068, 0, 0}, + {2780898906, 0, 0}, + {3030911670, 0, 0}, + {3032677281, 0, 0}, + {3063300848, 0, 0}, + {3277199633, 0, 0}, + {3289969989, 0, 0}, + {3401762422, 0, 0}, + {3436143898, 0, 0}, + {3560552546, 0, 0}, + {3656163446, 0, 0}, + {3675926744, 0, 0}, + {3701632935, 0, 0}, + {3743748793, 0, 0}, + {3752211294, 0, 0}, + {3794803132, 0, 0}, + {4241374559, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 21}, + {0, 17, 11}, + {0, 36, 35}, + {0, 46, 45}, + {0, 50, 49}, + {0, 9, 3}, + {0, 20, 47}, + {0, 37, 31}, + {0, 2, 34}, + {0, 40, 13}, + {0, 51, 32}, + {0, 41, 10}, + {0, 38, 19}, + {0, 18, 44}, + {0, 43, 16}, + {0, 48, 24}, + {0, 26, 5}, + {0, 53, 8}, + {0, 15, 7}, + {0, 25, 23}, + {0, 54, 27}, + {0, 56, 55}, + {0, 58, 57}, + {0, 60, 59}, + {0, 39, 42}, + {0, 62, 61}, + {0, 30, 63}, + {0, 4, 64}, + {0, 65, 28}, + {0, 66, 22}, + {0, 68, 67}, + {0, 69, 14}, + {0, 70, 33}, + {0, 71, 6}, + {0, 73, 72}, + {0, 75, 74}, + {0, 29, 76}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + {0, 84, 83}, + {0, 86, 85}, + {0, 88, 87}, + {0, 90, 89}, + {0, 91, 12}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 52, 102}, + })); + + codecs.emplace(std::pair(SpvOpFAdd, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 5}, + {0, 4, 6}, + {0, 1, 7}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpFSub, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(159, { + {0, 0, 0}, + {50385656, 0, 0}, + {117250846, 0, 0}, + {171494987, 0, 0}, + {195244192, 0, 0}, + {210754155, 0, 0}, + {265392489, 0, 0}, + {333855951, 0, 0}, + {416853049, 0, 0}, + {529068443, 0, 0}, + {533021259, 0, 0}, + {615982737, 0, 0}, + {660038281, 0, 0}, + {663341511, 0, 0}, + {669812542, 0, 0}, + {716890919, 0, 0}, + {1081536219, 0, 0}, + {1119744229, 0, 0}, + {1123617794, 0, 0}, + {1139547465, 0, 0}, + {1162789888, 0, 0}, + {1178317551, 0, 0}, + {1190147516, 0, 0}, + {1193734351, 0, 0}, + {1215030156, 0, 0}, + {1220749418, 0, 0}, + {1318479490, 0, 0}, + {1461398554, 0, 0}, + {1486207619, 0, 0}, + {1551372768, 0, 0}, + {1763758554, 0, 0}, + {1797960910, 0, 0}, + {1850331254, 0, 0}, + {1894417995, 0, 0}, + {1964254745, 0, 0}, + {1965902997, 0, 0}, + {1989327599, 0, 0}, + {2095027856, 0, 0}, + {2123683379, 0, 0}, + {2124837447, 0, 0}, + {2137526937, 0, 0}, + {2269114589, 0, 0}, + {2269130237, 0, 0}, + {2330636993, 0, 0}, + {2481746922, 0, 0}, + {2503770904, 0, 0}, + {2589449658, 0, 0}, + {2603020391, 0, 0}, + {2604576561, 0, 0}, + {2795773560, 0, 0}, + {2835131395, 0, 0}, + {2852854788, 0, 0}, + {2890638791, 0, 0}, + {2895413148, 0, 0}, + {2950446516, 0, 0}, + {2963744582, 0, 0}, + {3079287749, 0, 0}, + {3088785099, 0, 0}, + {3280064277, 0, 0}, + {3335250889, 0, 0}, + {3510242586, 0, 0}, + {3517169445, 0, 0}, + {3518703473, 0, 0}, + {3536471583, 0, 0}, + {3579593979, 0, 0}, + {3591222197, 0, 0}, + {3673811979, 0, 0}, + {3727034815, 0, 0}, + {3730093054, 0, 0}, + {3898287302, 0, 0}, + {3944781937, 0, 0}, + {3950980241, 0, 0}, + {4033586023, 0, 0}, + {4041974454, 0, 0}, + {4052965752, 0, 0}, + {4083161638, 0, 0}, + {4167600590, 0, 0}, + {4185661467, 0, 0}, + {4237092412, 0, 0}, + {4244540017, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 44, 18}, + {0, 69, 57}, + {0, 24, 16}, + {0, 79, 5}, + {0, 59, 4}, + {0, 76, 40}, + {0, 53, 45}, + {0, 14, 2}, + {0, 62, 61}, + {0, 33, 75}, + {0, 38, 37}, + {0, 42, 58}, + {0, 66, 47}, + {0, 63, 67}, + {0, 1, 7}, + {0, 10, 3}, + {0, 13, 12}, + {0, 23, 22}, + {0, 32, 28}, + {0, 36, 35}, + {0, 72, 49}, + {0, 74, 73}, + {0, 77, 55}, + {0, 27, 41}, + {0, 31, 15}, + {0, 6, 54}, + {0, 78, 17}, + {0, 81, 56}, + {0, 83, 82}, + {0, 85, 84}, + {0, 48, 30}, + {0, 71, 60}, + {0, 65, 51}, + {0, 87, 86}, + {0, 50, 34}, + {0, 89, 88}, + {0, 90, 9}, + {0, 25, 8}, + {0, 92, 91}, + {0, 93, 26}, + {0, 95, 94}, + {0, 52, 39}, + {0, 29, 20}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 64, 102}, + {0, 104, 103}, + {0, 106, 105}, + {0, 21, 107}, + {0, 108, 68}, + {0, 109, 46}, + {0, 110, 11}, + {0, 112, 111}, + {0, 114, 113}, + {0, 116, 115}, + {0, 117, 70}, + {0, 43, 118}, + {0, 120, 119}, + {0, 122, 121}, + {0, 124, 123}, + {0, 126, 125}, + {0, 128, 127}, + {0, 129, 19}, + {0, 131, 130}, + {0, 133, 132}, + {0, 135, 134}, + {0, 137, 136}, + {0, 139, 138}, + {0, 141, 140}, + {0, 143, 142}, + {0, 145, 144}, + {0, 147, 146}, + {0, 149, 148}, + {0, 151, 150}, + {0, 153, 152}, + {0, 155, 154}, + {0, 157, 156}, + {0, 158, 80}, + })); + + codecs.emplace(std::pair(SpvOpFSub, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(103, { + {0, 0, 0}, + {50998433, 0, 0}, + {171494987, 0, 0}, + {249378857, 0, 0}, + {296981500, 0, 0}, + {508007510, 0, 0}, + {610429940, 0, 0}, + {660038281, 0, 0}, + {663341511, 0, 0}, + {836581417, 0, 0}, + {1027242654, 0, 0}, + {1167160774, 0, 0}, + {1191015885, 0, 0}, + {1200870684, 0, 0}, + {1203545131, 0, 0}, + {1265796414, 0, 0}, + {1319785741, 0, 0}, + {1669959736, 0, 0}, + {1684282922, 0, 0}, + {1752686878, 0, 0}, + {1850331254, 0, 0}, + {1901166356, 0, 0}, + {1906988301, 0, 0}, + {2055836767, 0, 0}, + {2095027856, 0, 0}, + {2096388952, 0, 0}, + {2144962711, 0, 0}, + {2217833278, 0, 0}, + {2500819054, 0, 0}, + {2525173102, 0, 0}, + {2575525651, 0, 0}, + {2660843182, 0, 0}, + {2855506940, 0, 0}, + {2918750759, 0, 0}, + {2919787747, 0, 0}, + {3091876332, 0, 0}, + {3187066832, 0, 0}, + {3244209297, 0, 0}, + {3423702268, 0, 0}, + {3508792859, 0, 0}, + {3548535223, 0, 0}, + {3619787319, 0, 0}, + {3653838348, 0, 0}, + {3692647551, 0, 0}, + {3713290482, 0, 0}, + {3753486980, 0, 0}, + {3783756895, 0, 0}, + {3797961332, 0, 0}, + {3836822275, 0, 0}, + {4043078107, 0, 0}, + {4052965752, 0, 0}, + {4091394002, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 31, 49}, + {0, 24, 19}, + {0, 46, 45}, + {0, 6, 48}, + {0, 12, 33}, + {0, 17, 21}, + {0, 43, 11}, + {0, 7, 2}, + {0, 9, 8}, + {0, 28, 13}, + {0, 44, 38}, + {0, 30, 50}, + {0, 26, 22}, + {0, 29, 51}, + {0, 34, 37}, + {0, 53, 40}, + {0, 23, 54}, + {0, 55, 25}, + {0, 27, 18}, + {0, 1, 10}, + {0, 57, 56}, + {0, 59, 58}, + {0, 5, 47}, + {0, 60, 20}, + {0, 62, 61}, + {0, 64, 63}, + {0, 66, 65}, + {0, 67, 39}, + {0, 69, 68}, + {0, 16, 70}, + {0, 3, 71}, + {0, 73, 72}, + {0, 41, 15}, + {0, 35, 74}, + {0, 76, 75}, + {0, 78, 77}, + {0, 36, 79}, + {0, 81, 80}, + {0, 83, 82}, + {0, 14, 84}, + {0, 86, 85}, + {0, 88, 87}, + {0, 32, 89}, + {0, 42, 90}, + {0, 92, 91}, + {0, 94, 93}, + {0, 96, 95}, + {0, 98, 97}, + {0, 52, 99}, + {0, 100, 4}, + {0, 102, 101}, + })); + + codecs.emplace(std::pair(SpvOpFSub, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(157, { + {0, 0, 0}, + {49456560, 0, 0}, + {170690025, 0, 0}, + {243178923, 0, 0}, + {295017943, 0, 0}, + {296981500, 0, 0}, + {330249537, 0, 0}, + {435256475, 0, 0}, + {443558693, 0, 0}, + {456043370, 0, 0}, + {470277359, 0, 0}, + {592180731, 0, 0}, + {663258455, 0, 0}, + {706238670, 0, 0}, + {810488476, 0, 0}, + {870594305, 0, 0}, + {877895868, 0, 0}, + {900522183, 0, 0}, + {1077859090, 0, 0}, + {1082941229, 0, 0}, + {1104362365, 0, 0}, + {1132589448, 0, 0}, + {1173092699, 0, 0}, + {1203545131, 0, 0}, + {1265796414, 0, 0}, + {1278818058, 0, 0}, + {1285705317, 0, 0}, + {1319785741, 0, 0}, + {1382106590, 0, 0}, + {1461897718, 0, 0}, + {1474506522, 0, 0}, + {1530183840, 0, 0}, + {1558001705, 0, 0}, + {1558990974, 0, 0}, + {1616846013, 0, 0}, + {1633850097, 0, 0}, + {1684282922, 0, 0}, + {1725011064, 0, 0}, + {1767704813, 0, 0}, + {1923453688, 0, 0}, + {1941148668, 0, 0}, + {1955104493, 0, 0}, + {2022961611, 0, 0}, + {2162274327, 0, 0}, + {2212501241, 0, 0}, + {2219733501, 0, 0}, + {2234361374, 0, 0}, + {2272221101, 0, 0}, + {2305269460, 0, 0}, + {2488410748, 0, 0}, + {2566666743, 0, 0}, + {2598189097, 0, 0}, + {2775815164, 0, 0}, + {2793529873, 0, 0}, + {2844616706, 0, 0}, + {2970183398, 0, 0}, + {3103302036, 0, 0}, + {3110479131, 0, 0}, + {3115038057, 0, 0}, + {3116932970, 0, 0}, + {3152745753, 0, 0}, + {3187066832, 0, 0}, + {3244209297, 0, 0}, + {3383007207, 0, 0}, + {3392887901, 0, 0}, + {3508792859, 0, 0}, + {3737376990, 0, 0}, + {3753486980, 0, 0}, + {3765247327, 0, 0}, + {3817149113, 0, 0}, + {3839047923, 0, 0}, + {3886529747, 0, 0}, + {4044928561, 0, 0}, + {4061558677, 0, 0}, + {4069720347, 0, 0}, + {4069810315, 0, 0}, + {4128942283, 0, 0}, + {4164704452, 0, 0}, + {4273793488, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 74, 47}, + {0, 34, 33}, + {0, 36, 14}, + {0, 61, 48}, + {0, 13, 31}, + {0, 39, 25}, + {0, 37, 29}, + {0, 65, 54}, + {0, 4, 73}, + {0, 38, 10}, + {0, 15, 43}, + {0, 6, 35}, + {0, 9, 16}, + {0, 30, 19}, + {0, 49, 44}, + {0, 57, 53}, + {0, 60, 58}, + {0, 72, 66}, + {0, 59, 76}, + {0, 1, 68}, + {0, 70, 42}, + {0, 63, 3}, + {0, 28, 69}, + {0, 17, 55}, + {0, 45, 64}, + {0, 81, 80}, + {0, 7, 82}, + {0, 12, 11}, + {0, 21, 50}, + {0, 83, 18}, + {0, 22, 84}, + {0, 85, 26}, + {0, 20, 86}, + {0, 87, 40}, + {0, 56, 88}, + {0, 90, 89}, + {0, 92, 91}, + {0, 93, 2}, + {0, 95, 94}, + {0, 97, 96}, + {0, 98, 41}, + {0, 100, 99}, + {0, 101, 52}, + {0, 103, 102}, + {0, 77, 71}, + {0, 104, 78}, + {0, 105, 46}, + {0, 32, 8}, + {0, 106, 51}, + {0, 108, 107}, + {0, 23, 109}, + {0, 110, 27}, + {0, 112, 111}, + {0, 113, 75}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 124, 62}, + {0, 126, 125}, + {0, 128, 127}, + {0, 67, 129}, + {0, 131, 130}, + {0, 5, 132}, + {0, 134, 133}, + {0, 136, 135}, + {0, 138, 137}, + {0, 139, 24}, + {0, 141, 140}, + {0, 143, 142}, + {0, 145, 144}, + {0, 147, 146}, + {0, 149, 148}, + {0, 151, 150}, + {0, 153, 152}, + {0, 79, 154}, + {0, 156, 155}, + })); + + codecs.emplace(std::pair(SpvOpFSub, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 5}, + {0, 3, 6}, + {0, 1, 7}, + {0, 8, 2}, + })); + + codecs.emplace(std::pair(SpvOpFMul, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(41, { + {0, 0, 0}, + {342197850, 0, 0}, + {885020215, 0, 0}, + {963902061, 0, 0}, + {1041368449, 0, 0}, + {1352397672, 0, 0}, + {1791427568, 0, 0}, + {2013867381, 0, 0}, + {2513230733, 0, 0}, + {2555315060, 0, 0}, + {2562485583, 0, 0}, + {2567901801, 0, 0}, + {2655147757, 0, 0}, + {2680283743, 0, 0}, + {2752766693, 0, 0}, + {2806716850, 0, 0}, + {3030911670, 0, 0}, + {3401762422, 0, 0}, + {3697738938, 0, 0}, + {4164704452, 0, 0}, + {4273793488, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 14, 10}, + {0, 7, 16}, + {0, 1, 15}, + {0, 9, 6}, + {0, 4, 12}, + {0, 18, 5}, + {0, 13, 2}, + {0, 19, 3}, + {0, 17, 20}, + {0, 23, 22}, + {0, 24, 8}, + {0, 26, 25}, + {0, 27, 11}, + {0, 29, 28}, + {0, 31, 30}, + {0, 33, 32}, + {0, 35, 34}, + {0, 37, 36}, + {0, 39, 38}, + {0, 21, 40}, + })); + + codecs.emplace(std::pair(SpvOpFMul, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(129, { + {0, 0, 0}, + {126463145, 0, 0}, + {129135650, 0, 0}, + {200922300, 0, 0}, + {328661377, 0, 0}, + {354479447, 0, 0}, + {360730278, 0, 0}, + {451264926, 0, 0}, + {529068443, 0, 0}, + {593829839, 0, 0}, + {742917749, 0, 0}, + {761731755, 0, 0}, + {810488476, 0, 0}, + {870594305, 0, 0}, + {894529125, 0, 0}, + {959681532, 0, 0}, + {1054461787, 0, 0}, + {1077859090, 0, 0}, + {1086964761, 0, 0}, + {1158929937, 0, 0}, + {1168927492, 0, 0}, + {1196280518, 0, 0}, + {1203545131, 0, 0}, + {1367301635, 0, 0}, + {1508550646, 0, 0}, + {1618544981, 0, 0}, + {1661163736, 0, 0}, + {1684282922, 0, 0}, + {1766994680, 0, 0}, + {1830851200, 0, 0}, + {1901166356, 0, 0}, + {1955104493, 0, 0}, + {2055836767, 0, 0}, + {2096388952, 0, 0}, + {2100052708, 0, 0}, + {2161102232, 0, 0}, + {2197904616, 0, 0}, + {2262137600, 0, 0}, + {2278571792, 0, 0}, + {2281956980, 0, 0}, + {2438466459, 0, 0}, + {2443959748, 0, 0}, + {2517964682, 0, 0}, + {2557754096, 0, 0}, + {2622612602, 0, 0}, + {2660843182, 0, 0}, + {2736844435, 0, 0}, + {2780898906, 0, 0}, + {3044188332, 0, 0}, + {3059119137, 0, 0}, + {3194725903, 0, 0}, + {3270430997, 0, 0}, + {3337532056, 0, 0}, + {3407526215, 0, 0}, + {3496407048, 0, 0}, + {3504158761, 0, 0}, + {3534518722, 0, 0}, + {3570411982, 0, 0}, + {3701632935, 0, 0}, + {3929248764, 0, 0}, + {3944781937, 0, 0}, + {3970432934, 0, 0}, + {4008405264, 0, 0}, + {4245257809, 0, 0}, + {4253051659, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 6, 26}, + {0, 46, 24}, + {0, 64, 50}, + {0, 7, 17}, + {0, 40, 57}, + {0, 56, 49}, + {0, 34, 10}, + {0, 32, 61}, + {0, 36, 44}, + {0, 8, 43}, + {0, 4, 18}, + {0, 25, 23}, + {0, 9, 54}, + {0, 45, 41}, + {0, 13, 21}, + {0, 47, 31}, + {0, 39, 53}, + {0, 11, 3}, + {0, 29, 20}, + {0, 38, 58}, + {0, 37, 14}, + {0, 66, 52}, + {0, 67, 35}, + {0, 48, 68}, + {0, 1, 69}, + {0, 70, 28}, + {0, 27, 63}, + {0, 72, 71}, + {0, 74, 73}, + {0, 75, 60}, + {0, 77, 76}, + {0, 5, 51}, + {0, 15, 78}, + {0, 30, 79}, + {0, 55, 80}, + {0, 42, 81}, + {0, 83, 82}, + {0, 85, 84}, + {0, 86, 2}, + {0, 19, 16}, + {0, 87, 59}, + {0, 62, 88}, + {0, 90, 89}, + {0, 22, 91}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 12, 102}, + {0, 104, 103}, + {0, 33, 105}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 127, 126}, + {0, 65, 128}, + })); + + codecs.emplace(std::pair(SpvOpFMul, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(127, { + {0, 0, 0}, + {13319433, 0, 0}, + {15502752, 0, 0}, + {162608772, 0, 0}, + {171307615, 0, 0}, + {296981500, 0, 0}, + {354479447, 0, 0}, + {413918748, 0, 0}, + {443490822, 0, 0}, + {487719832, 0, 0}, + {593829839, 0, 0}, + {615982737, 0, 0}, + {703543228, 0, 0}, + {810488476, 0, 0}, + {870594305, 0, 0}, + {875212982, 0, 0}, + {959681532, 0, 0}, + {1019457583, 0, 0}, + {1203545131, 0, 0}, + {1278448636, 0, 0}, + {1325348861, 0, 0}, + {1368383673, 0, 0}, + {1400019344, 0, 0}, + {1646147798, 0, 0}, + {1679946323, 0, 0}, + {1684282922, 0, 0}, + {1747355813, 0, 0}, + {1755648697, 0, 0}, + {1793544760, 0, 0}, + {1811839150, 0, 0}, + {1901166356, 0, 0}, + {1947620272, 0, 0}, + {1992893964, 0, 0}, + {2042001863, 0, 0}, + {2096388952, 0, 0}, + {2123388694, 0, 0}, + {2128251367, 0, 0}, + {2130747644, 0, 0}, + {2135340676, 0, 0}, + {2161102232, 0, 0}, + {2443959748, 0, 0}, + {2513230733, 0, 0}, + {2557754096, 0, 0}, + {2580096524, 0, 0}, + {2589449658, 0, 0}, + {2614879967, 0, 0}, + {2698156268, 0, 0}, + {2970183398, 0, 0}, + {3002890475, 0, 0}, + {3133016299, 0, 0}, + {3142155593, 0, 0}, + {3187066832, 0, 0}, + {3266548732, 0, 0}, + {3287039847, 0, 0}, + {3357301402, 0, 0}, + {3413713311, 0, 0}, + {3434076295, 0, 0}, + {3496407048, 0, 0}, + {3504158761, 0, 0}, + {3882634684, 0, 0}, + {3929248764, 0, 0}, + {3987079331, 0, 0}, + {4076840151, 0, 0}, + {4243119782, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 31, 8}, + {0, 14, 56}, + {0, 7, 12}, + {0, 9, 30}, + {0, 42, 36}, + {0, 19, 11}, + {0, 22, 40}, + {0, 15, 3}, + {0, 57, 26}, + {0, 58, 61}, + {0, 55, 51}, + {0, 48, 34}, + {0, 20, 1}, + {0, 24, 23}, + {0, 46, 35}, + {0, 59, 49}, + {0, 21, 63}, + {0, 62, 44}, + {0, 6, 50}, + {0, 28, 18}, + {0, 66, 65}, + {0, 41, 32}, + {0, 39, 54}, + {0, 53, 67}, + {0, 68, 37}, + {0, 33, 69}, + {0, 43, 70}, + {0, 71, 38}, + {0, 72, 27}, + {0, 13, 47}, + {0, 45, 73}, + {0, 75, 74}, + {0, 76, 5}, + {0, 77, 17}, + {0, 79, 78}, + {0, 52, 80}, + {0, 2, 81}, + {0, 83, 82}, + {0, 85, 84}, + {0, 87, 86}, + {0, 4, 88}, + {0, 16, 29}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + {0, 60, 95}, + {0, 97, 96}, + {0, 98, 10}, + {0, 25, 99}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 64, 126}, + })); + + codecs.emplace(std::pair(SpvOpFMul, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(9, { + {0, 0, 0}, + {679771963, 0, 0}, + {1951208733, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 4, 5}, + {0, 3, 6}, + {0, 7, 1}, + {0, 2, 8}, + })); + + codecs.emplace(std::pair(SpvOpFDiv, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(153, { + {0, 0, 0}, + {10142671, 0, 0}, + {27865391, 0, 0}, + {29517006, 0, 0}, + {41739659, 0, 0}, + {97231530, 0, 0}, + {171334650, 0, 0}, + {200553094, 0, 0}, + {257136089, 0, 0}, + {294390719, 0, 0}, + {375530199, 0, 0}, + {380957745, 0, 0}, + {388034151, 0, 0}, + {455591063, 0, 0}, + {462664429, 0, 0}, + {491456522, 0, 0}, + {502863753, 0, 0}, + {626480004, 0, 0}, + {643418617, 0, 0}, + {651464351, 0, 0}, + {701281393, 0, 0}, + {744817486, 0, 0}, + {783918780, 0, 0}, + {862784766, 0, 0}, + {930804377, 0, 0}, + {952536201, 0, 0}, + {955476870, 0, 0}, + {1043738701, 0, 0}, + {1047011733, 0, 0}, + {1080545747, 0, 0}, + {1137442027, 0, 0}, + {1235468610, 0, 0}, + {1412908157, 0, 0}, + {1431749301, 0, 0}, + {1434223270, 0, 0}, + {1440646342, 0, 0}, + {1508570930, 0, 0}, + {1510422521, 0, 0}, + {1548121999, 0, 0}, + {1582841441, 0, 0}, + {1612225949, 0, 0}, + {1665981878, 0, 0}, + {1680746207, 0, 0}, + {1696076631, 0, 0}, + {1702168830, 0, 0}, + {1761469971, 0, 0}, + {1799299383, 0, 0}, + {1910240213, 0, 0}, + {1917451875, 0, 0}, + {1945006185, 0, 0}, + {1998444837, 0, 0}, + {2045285083, 0, 0}, + {2217966239, 0, 0}, + {2279273489, 0, 0}, + {2289803479, 0, 0}, + {2348676810, 0, 0}, + {2353194283, 0, 0}, + {2403632109, 0, 0}, + {2409539315, 0, 0}, + {2414984922, 0, 0}, + {2477389837, 0, 0}, + {2524531022, 0, 0}, + {2573160348, 0, 0}, + {2639720559, 0, 0}, + {2773229577, 0, 0}, + {2796513469, 0, 0}, + {2881225774, 0, 0}, + {2890570341, 0, 0}, + {2952850186, 0, 0}, + {3023287679, 0, 0}, + {3118548424, 0, 0}, + {3877813395, 0, 0}, + {3931288033, 0, 0}, + {3972309363, 0, 0}, + {4117704995, 0, 0}, + {4140081844, 0, 0}, + {4258414038, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 74, 53}, + {0, 58, 52}, + {0, 65, 60}, + {0, 41, 5}, + {0, 1, 67}, + {0, 24, 28}, + {0, 27, 26}, + {0, 55, 31}, + {0, 36, 61}, + {0, 13, 49}, + {0, 56, 48}, + {0, 16, 64}, + {0, 76, 42}, + {0, 45, 29}, + {0, 23, 6}, + {0, 72, 12}, + {0, 35, 19}, + {0, 20, 7}, + {0, 21, 46}, + {0, 71, 78}, + {0, 80, 79}, + {0, 47, 17}, + {0, 81, 70}, + {0, 34, 25}, + {0, 83, 82}, + {0, 85, 84}, + {0, 37, 86}, + {0, 87, 73}, + {0, 10, 4}, + {0, 40, 30}, + {0, 88, 57}, + {0, 54, 89}, + {0, 50, 90}, + {0, 11, 91}, + {0, 39, 15}, + {0, 59, 44}, + {0, 92, 66}, + {0, 69, 93}, + {0, 95, 94}, + {0, 14, 96}, + {0, 98, 97}, + {0, 62, 51}, + {0, 100, 99}, + {0, 102, 101}, + {0, 104, 103}, + {0, 32, 43}, + {0, 105, 38}, + {0, 107, 106}, + {0, 109, 108}, + {0, 22, 9}, + {0, 33, 110}, + {0, 2, 111}, + {0, 112, 3}, + {0, 114, 113}, + {0, 116, 115}, + {0, 68, 63}, + {0, 118, 117}, + {0, 120, 119}, + {0, 121, 8}, + {0, 123, 122}, + {0, 125, 124}, + {0, 127, 126}, + {0, 129, 128}, + {0, 131, 130}, + {0, 133, 132}, + {0, 75, 18}, + {0, 135, 134}, + {0, 137, 136}, + {0, 139, 138}, + {0, 141, 140}, + {0, 143, 142}, + {0, 145, 144}, + {0, 147, 146}, + {0, 149, 148}, + {0, 150, 77}, + {0, 152, 151}, + })); + + codecs.emplace(std::pair(SpvOpFDiv, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(131, { + {0, 0, 0}, + {5908395, 0, 0}, + {139011596, 0, 0}, + {296981500, 0, 0}, + {342615870, 0, 0}, + {370232173, 0, 0}, + {492958971, 0, 0}, + {528662843, 0, 0}, + {551924251, 0, 0}, + {604894932, 0, 0}, + {610429940, 0, 0}, + {780957373, 0, 0}, + {810488476, 0, 0}, + {872544165, 0, 0}, + {878733439, 0, 0}, + {918849409, 0, 0}, + {959681532, 0, 0}, + {1013756921, 0, 0}, + {1038982109, 0, 0}, + {1081611718, 0, 0}, + {1125913837, 0, 0}, + {1209418480, 0, 0}, + {1318081294, 0, 0}, + {1367301635, 0, 0}, + {1417425499, 0, 0}, + {1625742020, 0, 0}, + {1684282922, 0, 0}, + {1746004874, 0, 0}, + {1758287856, 0, 0}, + {1777640493, 0, 0}, + {2066323109, 0, 0}, + {2094550054, 0, 0}, + {2096388952, 0, 0}, + {2144962711, 0, 0}, + {2434845539, 0, 0}, + {2480811229, 0, 0}, + {2552825357, 0, 0}, + {2636946065, 0, 0}, + {2651956495, 0, 0}, + {2669086217, 0, 0}, + {2680819379, 0, 0}, + {2709694527, 0, 0}, + {2715304020, 0, 0}, + {2790648021, 0, 0}, + {2802261839, 0, 0}, + {2806296851, 0, 0}, + {2864543087, 0, 0}, + {2952260510, 0, 0}, + {2963184673, 0, 0}, + {3091876332, 0, 0}, + {3098991995, 0, 0}, + {3131890669, 0, 0}, + {3138977758, 0, 0}, + {3198541202, 0, 0}, + {3260579369, 0, 0}, + {3263841912, 0, 0}, + {3335250889, 0, 0}, + {3345856521, 0, 0}, + {3381478137, 0, 0}, + {3489269251, 0, 0}, + {3510242586, 0, 0}, + {3820814597, 0, 0}, + {3900859293, 0, 0}, + {4041974454, 0, 0}, + {4244540017, 0, 0}, + {4265894873, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 15, 52}, + {0, 20, 18}, + {0, 39, 29}, + {0, 9, 43}, + {0, 22, 13}, + {0, 46, 27}, + {0, 51, 48}, + {0, 19, 57}, + {0, 34, 24}, + {0, 64, 59}, + {0, 5, 7}, + {0, 38, 37}, + {0, 45, 47}, + {0, 2, 56}, + {0, 67, 8}, + {0, 17, 68}, + {0, 69, 61}, + {0, 70, 6}, + {0, 55, 54}, + {0, 72, 71}, + {0, 4, 73}, + {0, 74, 40}, + {0, 30, 11}, + {0, 42, 36}, + {0, 75, 58}, + {0, 31, 76}, + {0, 1, 77}, + {0, 44, 14}, + {0, 78, 50}, + {0, 79, 23}, + {0, 26, 80}, + {0, 81, 12}, + {0, 83, 82}, + {0, 84, 21}, + {0, 32, 85}, + {0, 87, 86}, + {0, 35, 10}, + {0, 88, 62}, + {0, 90, 89}, + {0, 41, 91}, + {0, 92, 53}, + {0, 93, 63}, + {0, 95, 94}, + {0, 33, 96}, + {0, 98, 97}, + {0, 99, 3}, + {0, 100, 28}, + {0, 101, 49}, + {0, 102, 60}, + {0, 104, 103}, + {0, 106, 105}, + {0, 108, 107}, + {0, 110, 109}, + {0, 65, 111}, + {0, 25, 112}, + {0, 114, 113}, + {0, 116, 115}, + {0, 117, 16}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 127, 126}, + {0, 128, 66}, + {0, 130, 129}, + })); + + codecs.emplace(std::pair(SpvOpFDiv, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(95, { + {0, 0, 0}, + {116093251, 0, 0}, + {149720480, 0, 0}, + {183103444, 0, 0}, + {251209228, 0, 0}, + {296981500, 0, 0}, + {357505993, 0, 0}, + {394654115, 0, 0}, + {410274915, 0, 0}, + {452208841, 0, 0}, + {788046331, 0, 0}, + {797934924, 0, 0}, + {810488476, 0, 0}, + {1144188012, 0, 0}, + {1220127364, 0, 0}, + {1321616112, 0, 0}, + {1324351672, 0, 0}, + {1348149915, 0, 0}, + {1459457331, 0, 0}, + {1465623797, 0, 0}, + {1531216990, 0, 0}, + {1543672828, 0, 0}, + {1578775276, 0, 0}, + {1738815671, 0, 0}, + {1904128160, 0, 0}, + {2071351379, 0, 0}, + {2119793999, 0, 0}, + {2274779301, 0, 0}, + {2291766425, 0, 0}, + {2357410109, 0, 0}, + {2438466459, 0, 0}, + {2496463830, 0, 0}, + {2630220147, 0, 0}, + {2682510803, 0, 0}, + {3047649911, 0, 0}, + {3085703811, 0, 0}, + {3235459678, 0, 0}, + {3261703164, 0, 0}, + {3331487616, 0, 0}, + {3462674048, 0, 0}, + {3570219049, 0, 0}, + {3585315836, 0, 0}, + {3602108619, 0, 0}, + {3724004880, 0, 0}, + {3931641900, 0, 0}, + {3955205564, 0, 0}, + {4073492988, 0, 0}, + {4127308103, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 24, 37}, + {0, 13, 38}, + {0, 17, 39}, + {0, 35, 23}, + {0, 18, 36}, + {0, 46, 19}, + {0, 20, 33}, + {0, 47, 6}, + {0, 1, 45}, + {0, 3, 27}, + {0, 8, 49}, + {0, 50, 29}, + {0, 10, 51}, + {0, 43, 31}, + {0, 53, 52}, + {0, 54, 26}, + {0, 7, 55}, + {0, 56, 32}, + {0, 57, 41}, + {0, 59, 58}, + {0, 61, 60}, + {0, 63, 62}, + {0, 64, 25}, + {0, 2, 34}, + {0, 65, 14}, + {0, 67, 66}, + {0, 12, 21}, + {0, 9, 68}, + {0, 69, 16}, + {0, 71, 70}, + {0, 72, 44}, + {0, 11, 73}, + {0, 74, 30}, + {0, 4, 75}, + {0, 28, 15}, + {0, 76, 42}, + {0, 5, 77}, + {0, 78, 40}, + {0, 80, 79}, + {0, 82, 81}, + {0, 22, 83}, + {0, 85, 84}, + {0, 86, 48}, + {0, 88, 87}, + {0, 90, 89}, + {0, 92, 91}, + {0, 94, 93}, + })); + + codecs.emplace(std::pair(SpvOpFDiv, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(7, { + {0, 0, 0}, + {679771963, 0, 0}, + {2320303498, 0, 0}, + {3334207724, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 3, 4}, + {0, 2, 5}, + {0, 1, 6}, + })); + + codecs.emplace(std::pair(SpvOpVectorTimesScalar, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(121, { + {0, 0, 0}, + {14113753, 0, 0}, + {102358168, 0, 0}, + {179458548, 0, 0}, + {330388453, 0, 0}, + {386525753, 0, 0}, + {470277359, 0, 0}, + {497658126, 0, 0}, + {508007510, 0, 0}, + {815034111, 0, 0}, + {826214242, 0, 0}, + {849867303, 0, 0}, + {885645401, 0, 0}, + {939415664, 0, 0}, + {968885186, 0, 0}, + {1105835505, 0, 0}, + {1159301677, 0, 0}, + {1461897718, 0, 0}, + {1482251215, 0, 0}, + {1486206763, 0, 0}, + {1527762373, 0, 0}, + {1558990974, 0, 0}, + {1618754372, 0, 0}, + {1669959736, 0, 0}, + {1752686878, 0, 0}, + {2004567202, 0, 0}, + {2055637638, 0, 0}, + {2113506324, 0, 0}, + {2154320787, 0, 0}, + {2162274327, 0, 0}, + {2306141594, 0, 0}, + {2345566651, 0, 0}, + {2457690657, 0, 0}, + {2473053808, 0, 0}, + {2500422644, 0, 0}, + {2504802016, 0, 0}, + {2506771164, 0, 0}, + {2793529873, 0, 0}, + {2801333547, 0, 0}, + {2879050471, 0, 0}, + {3032677281, 0, 0}, + {3045470312, 0, 0}, + {3181546731, 0, 0}, + {3240977890, 0, 0}, + {3262572726, 0, 0}, + {3307100165, 0, 0}, + {3425841570, 0, 0}, + {3560552546, 0, 0}, + {3641833815, 0, 0}, + {3652695478, 0, 0}, + {3782362128, 0, 0}, + {3797961332, 0, 0}, + {3837583704, 0, 0}, + {3886529747, 0, 0}, + {3907920335, 0, 0}, + {4043078107, 0, 0}, + {4044928561, 0, 0}, + {4069720347, 0, 0}, + {4180570743, 0, 0}, + {4245743275, 0, 0}, + {4285201458, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 44, 28}, + {0, 13, 45}, + {0, 19, 15}, + {0, 32, 31}, + {0, 43, 42}, + {0, 16, 52}, + {0, 33, 22}, + {0, 57, 55}, + {0, 24, 21}, + {0, 2, 59}, + {0, 10, 3}, + {0, 18, 12}, + {0, 41, 39}, + {0, 60, 46}, + {0, 4, 25}, + {0, 58, 49}, + {0, 14, 1}, + {0, 27, 17}, + {0, 50, 36}, + {0, 23, 54}, + {0, 5, 30}, + {0, 11, 7}, + {0, 38, 29}, + {0, 37, 8}, + {0, 48, 56}, + {0, 20, 6}, + {0, 34, 26}, + {0, 63, 62}, + {0, 65, 64}, + {0, 67, 66}, + {0, 69, 68}, + {0, 71, 70}, + {0, 73, 72}, + {0, 75, 74}, + {0, 9, 76}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + {0, 84, 83}, + {0, 40, 35}, + {0, 85, 47}, + {0, 86, 51}, + {0, 88, 87}, + {0, 90, 89}, + {0, 53, 91}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 115, 114}, + {0, 117, 116}, + {0, 119, 118}, + {0, 61, 120}, + })); + + codecs.emplace(std::pair(SpvOpVectorTimesScalar, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(127, { + {0, 0, 0}, + {100979271, 0, 0}, + {269576093, 0, 0}, + {314809953, 0, 0}, + {354479447, 0, 0}, + {497658126, 0, 0}, + {882718761, 0, 0}, + {968885186, 0, 0}, + {973908139, 0, 0}, + {1019457583, 0, 0}, + {1191015885, 0, 0}, + {1266262705, 0, 0}, + {1310404265, 0, 0}, + {1325348861, 0, 0}, + {1367301635, 0, 0}, + {1368383673, 0, 0}, + {1570165302, 0, 0}, + {1618544981, 0, 0}, + {1646147798, 0, 0}, + {1674464100, 0, 0}, + {1679946323, 0, 0}, + {1686512349, 0, 0}, + {1766401548, 0, 0}, + {1774052499, 0, 0}, + {1788301425, 0, 0}, + {2023008475, 0, 0}, + {2055836767, 0, 0}, + {2096388952, 0, 0}, + {2123388694, 0, 0}, + {2129301998, 0, 0}, + {2212501241, 0, 0}, + {2274226560, 0, 0}, + {2362972044, 0, 0}, + {2378763734, 0, 0}, + {2506771164, 0, 0}, + {2558655180, 0, 0}, + {2622612602, 0, 0}, + {2660843182, 0, 0}, + {2698156268, 0, 0}, + {2801333547, 0, 0}, + {2850246066, 0, 0}, + {2895151306, 0, 0}, + {2970183398, 0, 0}, + {2986830770, 0, 0}, + {3001444829, 0, 0}, + {3133016299, 0, 0}, + {3152745753, 0, 0}, + {3187066832, 0, 0}, + {3261122899, 0, 0}, + {3496407048, 0, 0}, + {3513669836, 0, 0}, + {3536390697, 0, 0}, + {3570411982, 0, 0}, + {3653838348, 0, 0}, + {3713290482, 0, 0}, + {3858973601, 0, 0}, + {3873587660, 0, 0}, + {3877583949, 0, 0}, + {3882634684, 0, 0}, + {3907920335, 0, 0}, + {3997432565, 0, 0}, + {4169226615, 0, 0}, + {4219766939, 0, 0}, + {4243119782, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 25, 12}, + {0, 41, 29}, + {0, 56, 44}, + {0, 1, 3}, + {0, 48, 24}, + {0, 33, 60}, + {0, 8, 50}, + {0, 35, 21}, + {0, 11, 7}, + {0, 34, 23}, + {0, 59, 57}, + {0, 10, 62}, + {0, 40, 2}, + {0, 5, 49}, + {0, 39, 17}, + {0, 9, 61}, + {0, 30, 6}, + {0, 19, 46}, + {0, 53, 54}, + {0, 31, 52}, + {0, 55, 43}, + {0, 66, 65}, + {0, 16, 67}, + {0, 51, 68}, + {0, 70, 69}, + {0, 26, 36}, + {0, 72, 71}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + {0, 80, 79}, + {0, 82, 81}, + {0, 37, 83}, + {0, 85, 84}, + {0, 13, 86}, + {0, 20, 18}, + {0, 38, 28}, + {0, 58, 45}, + {0, 87, 63}, + {0, 15, 88}, + {0, 32, 22}, + {0, 89, 4}, + {0, 90, 14}, + {0, 91, 42}, + {0, 93, 92}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 115, 114}, + {0, 27, 47}, + {0, 117, 116}, + {0, 119, 118}, + {0, 121, 120}, + {0, 123, 122}, + {0, 125, 124}, + {0, 126, 64}, + })); + + codecs.emplace(std::pair(SpvOpVectorTimesScalar, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(137, { + {0, 0, 0}, + {11698369, 0, 0}, + {146392076, 0, 0}, + {151810803, 0, 0}, + {223800276, 0, 0}, + {227103506, 0, 0}, + {253329281, 0, 0}, + {346929928, 0, 0}, + {461040879, 0, 0}, + {629859130, 0, 0}, + {680157484, 0, 0}, + {783918780, 0, 0}, + {810488476, 0, 0}, + {824323032, 0, 0}, + {870594305, 0, 0}, + {959681532, 0, 0}, + {975807626, 0, 0}, + {1081642571, 0, 0}, + {1084574846, 0, 0}, + {1094817798, 0, 0}, + {1141965917, 0, 0}, + {1164137269, 0, 0}, + {1166917451, 0, 0}, + {1204787336, 0, 0}, + {1232501371, 0, 0}, + {1318479490, 0, 0}, + {1369818198, 0, 0}, + {1372785527, 0, 0}, + {1526654696, 0, 0}, + {1543672828, 0, 0}, + {1548121999, 0, 0}, + {1635292159, 0, 0}, + {1641070431, 0, 0}, + {1684282922, 0, 0}, + {1767704813, 0, 0}, + {1781765116, 0, 0}, + {1838763297, 0, 0}, + {1901166356, 0, 0}, + {1904846533, 0, 0}, + {2011183308, 0, 0}, + {2032069771, 0, 0}, + {2071351379, 0, 0}, + {2087004702, 0, 0}, + {2244928358, 0, 0}, + {2314864456, 0, 0}, + {2374216296, 0, 0}, + {2394332122, 0, 0}, + {2443610186, 0, 0}, + {2524697596, 0, 0}, + {2526961521, 0, 0}, + {2568098594, 0, 0}, + {2807907995, 0, 0}, + {3103302036, 0, 0}, + {3117071189, 0, 0}, + {3188115516, 0, 0}, + {3417584874, 0, 0}, + {3554463148, 0, 0}, + {3561482820, 0, 0}, + {3691770462, 0, 0}, + {3729929345, 0, 0}, + {3733675151, 0, 0}, + {3831290364, 0, 0}, + {3866493821, 0, 0}, + {3929248764, 0, 0}, + {4060703604, 0, 0}, + {4092487128, 0, 0}, + {4167600590, 0, 0}, + {4214779116, 0, 0}, + {4248015868, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 36, 13}, + {0, 49, 60}, + {0, 51, 9}, + {0, 3, 62}, + {0, 67, 41}, + {0, 4, 31}, + {0, 66, 5}, + {0, 55, 32}, + {0, 2, 1}, + {0, 30, 16}, + {0, 7, 38}, + {0, 19, 10}, + {0, 34, 20}, + {0, 45, 46}, + {0, 22, 11}, + {0, 25, 23}, + {0, 40, 39}, + {0, 21, 57}, + {0, 6, 35}, + {0, 61, 8}, + {0, 52, 26}, + {0, 70, 59}, + {0, 71, 14}, + {0, 68, 47}, + {0, 73, 72}, + {0, 29, 74}, + {0, 76, 75}, + {0, 77, 17}, + {0, 79, 78}, + {0, 81, 80}, + {0, 82, 18}, + {0, 83, 42}, + {0, 85, 84}, + {0, 87, 86}, + {0, 27, 37}, + {0, 53, 43}, + {0, 89, 88}, + {0, 64, 54}, + {0, 90, 65}, + {0, 92, 91}, + {0, 58, 93}, + {0, 56, 48}, + {0, 94, 28}, + {0, 96, 95}, + {0, 98, 97}, + {0, 44, 99}, + {0, 101, 100}, + {0, 15, 12}, + {0, 103, 102}, + {0, 104, 33}, + {0, 106, 105}, + {0, 108, 107}, + {0, 24, 109}, + {0, 111, 110}, + {0, 113, 112}, + {0, 114, 50}, + {0, 116, 115}, + {0, 118, 117}, + {0, 120, 119}, + {0, 122, 121}, + {0, 124, 123}, + {0, 126, 125}, + {0, 128, 127}, + {0, 129, 63}, + {0, 131, 130}, + {0, 133, 132}, + {0, 135, 134}, + {0, 136, 69}, + })); + + codecs.emplace(std::pair(SpvOpVectorTimesScalar, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1951208733, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpDot, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(97, { + {0, 0, 0}, + {78001013, 0, 0}, + {170690025, 0, 0}, + {206688607, 0, 0}, + {443490822, 0, 0}, + {461476226, 0, 0}, + {537830163, 0, 0}, + {669982125, 0, 0}, + {790502615, 0, 0}, + {805072272, 0, 0}, + {1173092699, 0, 0}, + {1220643281, 0, 0}, + {1448448666, 0, 0}, + {1466804584, 0, 0}, + {1473411044, 0, 0}, + {1515695460, 0, 0}, + {1587730355, 0, 0}, + {1625742020, 0, 0}, + {2071351379, 0, 0}, + {2250055803, 0, 0}, + {2291766425, 0, 0}, + {2416108131, 0, 0}, + {2427834344, 0, 0}, + {2436009347, 0, 0}, + {2455417440, 0, 0}, + {2480811229, 0, 0}, + {2654325647, 0, 0}, + {2919796598, 0, 0}, + {3047649911, 0, 0}, + {3088511797, 0, 0}, + {3104643263, 0, 0}, + {3198541202, 0, 0}, + {3204986803, 0, 0}, + {3272233597, 0, 0}, + {3383007207, 0, 0}, + {3602108619, 0, 0}, + {3622349409, 0, 0}, + {3714664910, 0, 0}, + {3717942504, 0, 0}, + {3732000233, 0, 0}, + {3759072440, 0, 0}, + {3765247327, 0, 0}, + {3805423332, 0, 0}, + {3829325073, 0, 0}, + {3866493821, 0, 0}, + {4058280485, 0, 0}, + {4061558677, 0, 0}, + {4148979936, 0, 0}, + {4155586396, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 13, 38}, + {0, 39, 14}, + {0, 44, 9}, + {0, 48, 47}, + {0, 23, 15}, + {0, 33, 25}, + {0, 1, 42}, + {0, 5, 46}, + {0, 31, 3}, + {0, 36, 28}, + {0, 16, 12}, + {0, 32, 22}, + {0, 41, 21}, + {0, 6, 50}, + {0, 51, 29}, + {0, 45, 34}, + {0, 37, 8}, + {0, 19, 52}, + {0, 11, 4}, + {0, 43, 40}, + {0, 27, 53}, + {0, 54, 10}, + {0, 24, 55}, + {0, 57, 56}, + {0, 58, 26}, + {0, 2, 59}, + {0, 61, 60}, + {0, 63, 62}, + {0, 65, 64}, + {0, 20, 66}, + {0, 30, 35}, + {0, 67, 17}, + {0, 68, 7}, + {0, 70, 69}, + {0, 71, 18}, + {0, 73, 72}, + {0, 75, 74}, + {0, 77, 76}, + {0, 79, 78}, + {0, 81, 80}, + {0, 83, 82}, + {0, 85, 84}, + {0, 87, 86}, + {0, 89, 88}, + {0, 91, 90}, + {0, 93, 92}, + {0, 95, 94}, + {0, 49, 96}, + })); + + codecs.emplace(std::pair(SpvOpDot, 1), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(117, { + {0, 0, 0}, + {50385656, 0, 0}, + {181902171, 0, 0}, + {560078433, 0, 0}, + {615982737, 0, 0}, + {674428451, 0, 0}, + {837715723, 0, 0}, + {886972033, 0, 0}, + {900101778, 0, 0}, + {983299427, 0, 0}, + {1237148906, 0, 0}, + {1364157225, 0, 0}, + {1367301635, 0, 0}, + {1380160211, 0, 0}, + {1451831482, 0, 0}, + {1499923635, 0, 0}, + {1570165302, 0, 0}, + {1735295265, 0, 0}, + {1766401548, 0, 0}, + {1796311149, 0, 0}, + {1826456251, 0, 0}, + {1839669171, 0, 0}, + {2012838864, 0, 0}, + {2024071551, 0, 0}, + {2096388952, 0, 0}, + {2161102232, 0, 0}, + {2197874825, 0, 0}, + {2279700640, 0, 0}, + {2289183712, 0, 0}, + {2351620600, 0, 0}, + {2362972044, 0, 0}, + {2472176885, 0, 0}, + {2477434291, 0, 0}, + {2530899578, 0, 0}, + {2531826164, 0, 0}, + {2558133383, 0, 0}, + {2589449658, 0, 0}, + {2621255555, 0, 0}, + {2622612602, 0, 0}, + {2872580757, 0, 0}, + {2881302403, 0, 0}, + {2891091137, 0, 0}, + {2923708820, 0, 0}, + {2936040203, 0, 0}, + {2970183398, 0, 0}, + {3187066832, 0, 0}, + {3224952074, 0, 0}, + {3244383472, 0, 0}, + {3261122899, 0, 0}, + {3362830643, 0, 0}, + {3538158875, 0, 0}, + {3635542517, 0, 0}, + {3682213068, 0, 0}, + {3721902098, 0, 0}, + {3826846522, 0, 0}, + {3877583949, 0, 0}, + {3997432565, 0, 0}, + {4093615095, 0, 0}, + {4106828015, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 52, 28}, + {0, 33, 20}, + {0, 46, 57}, + {0, 47, 54}, + {0, 21, 17}, + {0, 31, 58}, + {0, 12, 53}, + {0, 29, 3}, + {0, 35, 34}, + {0, 48, 41}, + {0, 8, 5}, + {0, 7, 55}, + {0, 37, 32}, + {0, 60, 38}, + {0, 61, 16}, + {0, 14, 62}, + {0, 23, 63}, + {0, 13, 19}, + {0, 64, 9}, + {0, 65, 39}, + {0, 2, 66}, + {0, 67, 42}, + {0, 69, 68}, + {0, 25, 70}, + {0, 1, 49}, + {0, 6, 71}, + {0, 72, 15}, + {0, 73, 11}, + {0, 75, 74}, + {0, 77, 76}, + {0, 4, 78}, + {0, 56, 50}, + {0, 80, 79}, + {0, 10, 81}, + {0, 83, 82}, + {0, 85, 84}, + {0, 86, 27}, + {0, 43, 40}, + {0, 88, 87}, + {0, 44, 24}, + {0, 30, 89}, + {0, 51, 36}, + {0, 45, 90}, + {0, 18, 91}, + {0, 93, 92}, + {0, 22, 94}, + {0, 26, 95}, + {0, 97, 96}, + {0, 99, 98}, + {0, 101, 100}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 111, 110}, + {0, 113, 112}, + {0, 59, 114}, + {0, 116, 115}, + })); + + codecs.emplace(std::pair(SpvOpDot, 2), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(179, { + {0, 0, 0}, + {27177503, 0, 0}, + {50385656, 0, 0}, + {129748122, 0, 0}, + {139011596, 0, 0}, + {162608772, 0, 0}, + {181902171, 0, 0}, + {225200779, 0, 0}, + {342159236, 0, 0}, + {386293029, 0, 0}, + {429023543, 0, 0}, + {443558693, 0, 0}, + {504514034, 0, 0}, + {615982737, 0, 0}, + {669812542, 0, 0}, + {674428451, 0, 0}, + {837715723, 0, 0}, + {861753115, 0, 0}, + {875212982, 0, 0}, + {876867882, 0, 0}, + {899320334, 0, 0}, + {900101778, 0, 0}, + {938517572, 0, 0}, + {1347339159, 0, 0}, + {1356063462, 0, 0}, + {1373856501, 0, 0}, + {1376656865, 0, 0}, + {1451831482, 0, 0}, + {1522979646, 0, 0}, + {1548491889, 0, 0}, + {1570165302, 0, 0}, + {1735295265, 0, 0}, + {1747355813, 0, 0}, + {1766401548, 0, 0}, + {1871105284, 0, 0}, + {1918742169, 0, 0}, + {1922045399, 0, 0}, + {1978689945, 0, 0}, + {2024071551, 0, 0}, + {2059975069, 0, 0}, + {2076833303, 0, 0}, + {2096388952, 0, 0}, + {2181030375, 0, 0}, + {2197874825, 0, 0}, + {2362972044, 0, 0}, + {2414725163, 0, 0}, + {2517964682, 0, 0}, + {2564745684, 0, 0}, + {2577387676, 0, 0}, + {2589449658, 0, 0}, + {2604242419, 0, 0}, + {2683080096, 0, 0}, + {2696349144, 0, 0}, + {2763960513, 0, 0}, + {2817823941, 0, 0}, + {2852854788, 0, 0}, + {2891091137, 0, 0}, + {2919626325, 0, 0}, + {2923708820, 0, 0}, + {2936040203, 0, 0}, + {2963744582, 0, 0}, + {2970183398, 0, 0}, + {2984459037, 0, 0}, + {2996594997, 0, 0}, + {3015046341, 0, 0}, + {3055195668, 0, 0}, + {3127329373, 0, 0}, + {3187066832, 0, 0}, + {3193597927, 0, 0}, + {3200890815, 0, 0}, + {3224258475, 0, 0}, + {3224480461, 0, 0}, + {3261122899, 0, 0}, + {3609540589, 0, 0}, + {3619404941, 0, 0}, + {3619626927, 0, 0}, + {3727034815, 0, 0}, + {3742724777, 0, 0}, + {3742946763, 0, 0}, + {3836179806, 0, 0}, + {3913885196, 0, 0}, + {3927338499, 0, 0}, + {3927466635, 0, 0}, + {3997432565, 0, 0}, + {3999472204, 0, 0}, + {4010499223, 0, 0}, + {4032662899, 0, 0}, + {4110915453, 0, 0}, + {4145966869, 0, 0}, + {4228303141, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 23, 87}, + {0, 9, 28}, + {0, 42, 17}, + {0, 74, 70}, + {0, 86, 77}, + {0, 18, 5}, + {0, 31, 32}, + {0, 34, 3}, + {0, 38, 68}, + {0, 50, 29}, + {0, 72, 62}, + {0, 21, 15}, + {0, 14, 54}, + {0, 56, 22}, + {0, 48, 88}, + {0, 2, 76}, + {0, 6, 47}, + {0, 26, 79}, + {0, 65, 12}, + {0, 37, 81}, + {0, 91, 60}, + {0, 30, 92}, + {0, 25, 7}, + {0, 45, 40}, + {0, 66, 52}, + {0, 71, 69}, + {0, 78, 75}, + {0, 84, 82}, + {0, 94, 93}, + {0, 27, 95}, + {0, 97, 96}, + {0, 99, 98}, + {0, 100, 39}, + {0, 55, 101}, + {0, 58, 102}, + {0, 89, 103}, + {0, 35, 11}, + {0, 104, 36}, + {0, 53, 10}, + {0, 1, 64}, + {0, 73, 20}, + {0, 105, 13}, + {0, 107, 106}, + {0, 8, 16}, + {0, 24, 19}, + {0, 85, 63}, + {0, 109, 108}, + {0, 111, 110}, + {0, 4, 112}, + {0, 114, 113}, + {0, 116, 115}, + {0, 118, 117}, + {0, 83, 119}, + {0, 121, 120}, + {0, 123, 122}, + {0, 49, 44}, + {0, 124, 57}, + {0, 125, 59}, + {0, 126, 67}, + {0, 128, 127}, + {0, 130, 129}, + {0, 132, 131}, + {0, 134, 133}, + {0, 135, 51}, + {0, 137, 136}, + {0, 138, 61}, + {0, 43, 41}, + {0, 140, 139}, + {0, 142, 141}, + {0, 144, 143}, + {0, 146, 145}, + {0, 148, 147}, + {0, 149, 33}, + {0, 80, 150}, + {0, 152, 151}, + {0, 154, 153}, + {0, 156, 155}, + {0, 158, 157}, + {0, 160, 159}, + {0, 162, 161}, + {0, 164, 163}, + {0, 166, 165}, + {0, 168, 167}, + {0, 46, 169}, + {0, 171, 170}, + {0, 90, 172}, + {0, 174, 173}, + {0, 176, 175}, + {0, 178, 177}, + })); + + codecs.emplace(std::pair(SpvOpDot, 3), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1036475267, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpLabel, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(3, { + {0, 0, 0}, + {1036475267, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 1, 2}, + })); + + codecs.emplace(std::pair(SpvOpBranch, 0), std::move(codec)); + } + + { + std::unique_ptr> codec(new HuffmanCodec(119, { + {0, 0, 0}, + {57149555, 0, 0}, + {139011596, 0, 0}, + {255835594, 0, 0}, + {330249537, 0, 0}, + {388686774, 0, 0}, + {508217552, 0, 0}, + {550831114, 0, 0}, + {559246409, 0, 0}, + {599185303, 0, 0}, + {649208064, 0, 0}, + {679061455, 0, 0}, + {810488476, 0, 0}, + {951841533, 0, 0}, + {1008886329, 0, 0}, + {1022544883, 0, 0}, + {1215030156, 0, 0}, + {1305703280, 0, 0}, + {1367301635, 0, 0}, + {1453447304, 0, 0}, + {1487177499, 0, 0}, + {1603937321, 0, 0}, + {1617826947, 0, 0}, + {1643868273, 0, 0}, + {1672607981, 0, 0}, + {1681941034, 0, 0}, + {1755165354, 0, 0}, + {1781864804, 0, 0}, + {1795715718, 0, 0}, + {1977038330, 0, 0}, + {2096388952, 0, 0}, + {2204920111, 0, 0}, + {2244470522, 0, 0}, + {2330636993, 0, 0}, + {2400601988, 0, 0}, + {2424848261, 0, 0}, + {2603020391, 0, 0}, + {2622612602, 0, 0}, + {2645135839, 0, 0}, + {2660843182, 0, 0}, + {2708915136, 0, 0}, + {2724166585, 0, 0}, + {2728667725, 0, 0}, + {2890638791, 0, 0}, + {2901034693, 0, 0}, + {2941648648, 0, 0}, + {2970183398, 0, 0}, + {2998120306, 0, 0}, + {3123244280, 0, 0}, + {3187066832, 0, 0}, + {3209399506, 0, 0}, + {3230260738, 0, 0}, + {3344189994, 0, 0}, + {3345707173, 0, 0}, + {3367298820, 0, 0}, + {3397078357, 0, 0}, + {3569736966, 0, 0}, + {3816961131, 0, 0}, + {4091670162, 0, 0}, + {4237497041, 0, 0}, + {1111111111111111111, 0, 0}, + {0, 17, 44}, + {0, 25, 20}, + {0, 29, 34}, + {0, 18, 2}, + {0, 54, 49}, + {0, 28, 7}, + {0, 47, 52}, + {0, 23, 56}, + {0, 55, 26}, + {0, 24, 61}, + {0, 13, 62}, + {0, 63, 45}, + {0, 27, 15}, + {0, 64, 8}, + {0, 65, 59}, + {0, 35, 22}, + {0, 53, 38}, + {0, 58, 51}, + {0, 11, 66}, + {0, 10, 3}, + {0, 46, 67}, + {0, 69, 68}, + {0, 1, 50}, + {0, 42, 19}, + {0, 70, 6}, + {0, 31, 71}, + {0, 16, 72}, + {0, 74, 73}, + {0, 76, 75}, + {0, 78, 77}, + {0, 79, 4}, + {0, 5, 37}, + {0, 14, 36}, + {0, 80, 57}, + {0, 81, 48}, + {0, 83, 82}, + {0, 39, 84}, + {0, 86, 85}, + {0, 40, 87}, + {0, 89, 88}, + {0, 91, 90}, + {0, 93, 92}, + {0, 21, 9}, + {0, 41, 32}, + {0, 12, 43}, + {0, 95, 94}, + {0, 97, 96}, + {0, 99, 98}, + {0, 100, 33}, + {0, 60, 101}, + {0, 103, 102}, + {0, 105, 104}, + {0, 107, 106}, + {0, 109, 108}, + {0, 110, 30}, + {0, 112, 111}, + {0, 114, 113}, + {0, 116, 115}, + {0, 118, 117}, + })); + + codecs.emplace(std::pair(SpvOpReturnValue, 0), std::move(codec)); + } + + return codecs; +} + +std::unordered_set GetDescriptorsWithCodingScheme() { + std::unordered_set descriptors_with_coding_scheme = { + 3816961131, + 3569736966, + 3397078357, + 3344189994, + 3230260738, + 2941648648, + 2901034693, + 2728667725, + 2400601988, + 1795715718, + 1681941034, + 1487177499, + 1453447304, + 679061455, + 649208064, + 559246409, + 388686774, + 4228303141, + 4110915453, + 4010499223, + 3927466635, + 3927338499, + 3836179806, + 3742724777, + 3619404941, + 3224480461, + 3224258475, + 3200890815, + 3742946763, + 3193597927, + 2604242419, + 2577387676, + 2181030375, + 1376656865, + 1347339159, + 938517572, + 876867882, + 429023543, + 129748122, + 4106828015, + 4093615095, + 3826846522, + 3721902098, + 3244383472, + 2891091137, + 2872580757, + 2558133383, + 2477434291, + 1839669171, + 2059975069, + 1735295265, + 1364157225, + 1237148906, + 886972033, + 674428451, + 4148979936, + 3805423332, + 3732000233, + 3717942504, + 3714664910, + 3622349409, + 3272233597, + 3204986803, + 3088511797, + 1672607981, + 2416108131, + 2250055803, + 1796311149, + 1515695460, + 537830163, + 461476226, + 206688607, + 78001013, + 3866493821, + 3417584874, + 3188115516, + 2526961521, + 2443610186, + 2394332122, + 2374216296, + 2032069771, + 2011183308, + 1904846533, + 1641070431, + 1635292159, + 1372785527, + 1369818198, + 1204787336, + 1826456251, + 1164137269, + 1081642571, + 629859130, + 253329281, + 227103506, + 11698369, + 4219766939, + 4169226615, + 3997432565, + 3873587660, + 3513669836, + 3261122899, + 2129301998, + 1774052499, + 1266262705, + 4285201458, + 4245743275, + 3907920335, + 3837583704, + 3641833815, + 3307100165, + 1232501371, + 3262572726, + 3045470312, + 2879050471, + 2801333547, + 2506771164, + 2504802016, + 2500422644, + 2473053808, + 2457690657, + 2345566651, + 2306141594, + 2154320787, + 2055637638, + 1527762373, + 1486206763, + 1159301677, + 1105835505, + 968885186, + 885645401, + 849867303, + 815034111, + 497658126, + 386525753, + 179458548, + 102358168, + 4127308103, + 4073492988, + 1473411044, + 805072272, + 3724004880, + 3602108619, + 3585315836, + 3331487616, + 3261703164, + 3235459678, + 3085703811, + 3047649911, + 2357410109, + 2291766425, + 2071351379, + 1904128160, + 1738815671, + 1531216990, + 1465623797, + 1324351672, + 1220127364, + 1144188012, + 183103444, + 116093251, + 3900859293, + 3345856521, + 3691770462, + 3263841912, + 3198541202, + 3098991995, + 3682213068, + 2963184673, + 2864543087, + 2802261839, + 2790648021, + 900101778, + 2715304020, + 100979271, + 2709694527, + 2669086217, + 2531826164, + 2651956495, + 2552825357, + 2480811229, + 3138977758, + 2434845539, + 2066323109, + 1777640493, + 1758287856, + 1746004874, + 3945482286, + 3932146199, + 3129573055, + 3126269825, + 3716914380, + 985750227, + 1543672828, + 3189039115, + 1839499483, + 2696349144, + 1536350567, + 3971481069, + 3001444829, + 4028622909, + 215293834, + 213642219, + 153085016, + 1189681639, + 165054168, + 29517006, + 2614879967, + 27865391, + 1649426421, + 4239834800, + 1947620272, + 28782128, + 3207966516, + 3713290482, + 2042001863, + 2724166585, + 2356768706, + 1793544760, + 4092654294, + 2157103435, + 2087004702, + 2043873558, + 27177503, + 1033363654, + 4214779116, + 408465899, + 451264926, + 2377112119, + 1182296898, + 760554870, + 3566035349, + 2630220147, + 4192247221, + 1572088444, + 3538592682, + 769422756, + 1674803691, + 630964591, + 3458449569, + 565334834, + 137840602, + 3955205564, + 2009007457, + 1258105452, + 333554713, + 3923810593, + 126463145, + 3445109809, + 2966409025, + 2849215484, + 1910240213, + 3131890669, + 586244865, + 2320303498, + 3116932970, + 1317265040, + 2812498065, + 1466938734, + 4064212479, + 2613179511, + 2095546797, + 1671139745, + 2568512089, + 3695940604, + 1119069977, + 215027449, + 4123141705, + 3495546641, + 1978689945, + 3202324433, + 3783543823, + 2674422363, + 1352628475, + 1290956281, + 1894417995, + 740921498, + 4211577142, + 1033081852, + 3884846406, + 3253403867, + 2790624748, + 2538917932, + 2144962711, + 3323202731, + 4290024976, + 2564745684, + 2963744582, + 2443959748, + 354479447, + 750870327, + 1918481917, + 4032662899, + 3587381650, + 2414725163, + 1081611718, + 1625742020, + 2308565678, + 1871105284, + 2807907995, + 2121980967, + 1054641568, + 413918748, + 1917336504, + 1816558243, + 4130950286, + 1522979646, + 1669959736, + 1320550031, + 3104643263, + 3823959661, + 3525913657, + 3584683259, + 2918750759, + 3536390697, + 94303122, + 3296691317, + 801484894, + 2496463830, + 3266028549, + 3085157904, + 973908139, + 3787909072, + 3107413701, + 2378763734, + 920604853, + 2516325050, + 1838993983, + 1603937321, + 3183924418, + 1945006185, + 3982311384, + 2682510803, + 680388473, + 979993429, + 2405770322, + 461040879, + 2817579280, + 14113753, + 2894979602, + 168339452, + 951841533, + 4154758669, + 2637132451, + 3877583949, + 1949856502, + 922996215, + 3941049054, + 4182141402, + 2262220987, + 1957218950, + 2094550054, + 1846856260, + 3499234137, + 3086631065, + 3054834317, + 593829839, + 522971108, + 1162127370, + 4233562270, + 2780190687, + 1558345254, + 3716353056, + 3518630848, + 1158929937, + 2038205856, + 86116519, + 4185661467, + 975807626, + 3910458990, + 4124281183, + 3361419439, + 171334650, + 2590402790, + 2890570341, + 2303184249, + 385229009, + 1998433745, + 1717510093, + 4022124023, + 1429389803, + 945128292, + 904486530, + 3869890846, + 619875033, + 459968607, + 3743748793, + 359054425, + 1417363940, + 3653985133, + 255835594, + 1047011733, + 2763232252, + 1329499601, + 328661377, + 2162274327, + 2100532220, + 4255182614, + 4243119782, + 3982047273, + 4053789056, + 401211099, + 950731750, + 1319785741, + 32085358, + 3882634684, + 3117071189, + 3554463148, + 3570219049, + 3535289452, + 2314864456, + 3913885196, + 2763960513, + 1079999262, + 27130513, + 3033873113, + 2976581453, + 2598189097, + 595410904, + 1572834111, + 13319433, + 1084574846, + 2123388694, + 560078433, + 1679946323, + 3518703473, + 184634770, + 296981500, + 1646147798, + 455591063, + 1325348861, + 3224952074, + 1027242654, + 2281956980, + 4221373527, + 1289566249, + 4044928561, + 882718761, + 1510333659, + 836581417, + 1901166356, + 2276405827, + 4052965752, + 1155765244, + 503145996, + 251209228, + 495107308, + 3944781937, + 37459569, + 4248015868, + 4198082194, + 1302400505, + 4106658327, + 680016782, + 2319227476, + 2738307068, + 3929248764, + 2850246066, + 1824526196, + 3912967080, + 3044723416, + 3133016299, + 2517964682, + 3647586740, + 3653838348, + 929101967, + 3571454885, + 2806296851, + 977312655, + 646282397, + 3448018532, + 824323032, + 204234270, + 1579585816, + 3712763835, + 1212872174, + 3953984401, + 3168953855, + 2944827576, + 1582841441, + 2796901051, + 3323682385, + 1317058015, + 2557550659, + 1620634991, + 2986830770, + 2490492987, + 1817271123, + 40653745, + 1696076631, + 2466126792, + 4169878842, + 3251128023, + 2444465148, + 678695941, + 2481746922, + 2836440943, + 774727851, + 2246405597, + 4028028350, + 2524697596, + 1977038330, + 2817823941, + 2219733501, + 688216667, + 3634598908, + 3232633974, + 2724625059, + 3269075805, + 3732640764, + 2263349224, + 1680746207, + 2414984922, + 2507457870, + 50998433, + 3092528578, + 3712946115, + 1543935193, + 807276090, + 1221183390, + 172029722, + 2122275289, + 3990925720, + 2261697609, + 2736881867, + 295017943, + 3278176820, + 3748965853, + 3174324790, + 1103903216, + 3184177968, + 1113409935, + 2299842241, + 2162986400, + 1538342947, + 4056442905, + 1631434666, + 205885885, + 1594733696, + 1955104493, + 1022309772, + 3820814597, + 993150979, + 1209418480, + 1784441183, + 3958731802, + 2250225826, + 3065160070, + 2024071551, + 107497541, + 628544021, + 2732195517, + 4241486415, + 3969279737, + 870594305, + 2916400082, + 1193734351, + 3202349435, + 3831290364, + 3282979782, + 3928764629, + 1308462133, + 3216471040, + 2433519008, + 2022961611, + 3604842236, + 3374978006, + 2855895374, + 3496407048, + 1482251215, + 3994511488, + 2997832431, + 1132589448, + 1348149915, + 2092468906, + 2451531615, + 779021139, + 3730093054, + 3413713311, + 1022915255, + 2204920111, + 2660843182, + 1080545747, + 1642805350, + 1766422419, + 4141567741, + 1558990974, + 4185590212, + 2841468319, + 701281393, + 3325419312, + 451957774, + 357505993, + 1156369516, + 3187387500, + 2259467579, + 2678954464, + 3154597438, + 543558236, + 2359973133, + 1990431740, + 2705477184, + 1041368449, + 3122368657, + 3181646225, + 1094423548, + 2955375511, + 2888125966, + 153013225, + 2936040203, + 1758530522, + 573901046, + 3030911670, + 1675922848, + 4235213885, + 4091916710, + 2633682514, + 4254584852, + 2328748202, + 3357301402, + 3877813395, + 2004567202, + 2496297824, + 3334207724, + 1600149091, + 293528591, + 1782996825, + 3757282300, + 1107206446, + 1092948665, + 1797960910, + 1206726575, + 1496351055, + 3021406120, + 99347751, + 3797204453, + 1468919488, + 797415788, + 1314843976, + 2934934694, + 490769168, + 1474506522, + 3811268385, + 864295921, + 3081676220, + 151810803, + 2588618056, + 2998120306, + 416853049, + 3495967422, + 3233393284, + 508007510, + 759277550, + 1971252067, + 869050696, + 810488476, + 745556697, + 789872778, + 3362723943, + 1617826947, + 3260309823, + 2197904616, + 1199157863, + 1643868273, + 2430404313, + 321630747, + 2503194620, + 3194725903, + 2881225774, + 3997952447, + 1389644742, + 2713718873, + 3585511591, + 1684282922, + 3366848728, + 284226441, + 1541020250, + 4018237905, + 1369578001, + 2424848261, + 2654325647, + 1626224034, + 1081536219, + 309040124, + 123060826, + 3997038726, + 1670691893, + 1543280290, + 443347828, + 1776629361, + 3118548424, + 478440524, + 679771963, + 3729929345, + 4244789645, + 2366506734, + 2838165089, + 1619778288, + 1313182965, + 3240680626, + 1323407757, + 883854656, + 2194691858, + 15502752, + 3760372982, + 1366337101, + 3656163446, + 295018543, + 825595257, + 57149555, + 2563789125, + 2353194283, + 2636942752, + 4026740269, + 3570411982, + 123108003, + 3782362128, + 1280126114, + 1410849099, + 4228502127, + 3609540589, + 3365041621, + 269823086, + 348988933, + 1636389511, + 2936586309, + 2761603302, + 2318200267, + 449954059, + 2895413148, + 1755165354, + 4274214049, + 778500192, + 3345707173, + 3732136051, + 721450866, + 1600392975, + 2466255445, + 4050155669, + 3541895912, + 1139547465, + 394654115, + 1380991098, + 3516240523, + 2234361374, + 1094817798, + 744817486, + 3564402361, + 1452222566, + 1851510470, + 3619787319, + 4265894873, + 216945449, + 3061690214, + 2910557180, + 255227811, + 4167600590, + 1587209598, + 3157581152, + 3184381405, + 2572638469, + 615748604, + 2532518896, + 1774874546, + 599185303, + 1561718045, + 1742737136, + 1674464100, + 3136865519, + 706016261, + 2793529873, + 3504981554, + 4155122613, + 2080953106, + 1104362365, + 2879917501, + 850497536, + 1392080469, + 1287937401, + 718877177, + 1917966999, + 1822823090, + 3701632935, + 3591222197, + 2817335337, + 1941148668, + 3110479131, + 3289213933, + 583624926, + 468372467, + 1633850097, + 2110223508, + 898191441, + 112745085, + 4018820793, + 3085119011, + 2919626325, + 3094857332, + 2348201466, + 2192810893, + 4163160985, + 1269075360, + 3952316364, + 2881886868, + 439764402, + 1584774136, + 169674806, + 3759072440, + 102542696, + 2996180816, + 804899022, + 1015552308, + 963902061, + 3504158761, + 2002490364, + 2806716850, + 265778447, + 4083122425, + 181902171, + 1238120570, + 75986790, + 1265796414, + 899570100, + 2988365258, + 3655201337, + 3654061472, + 3061856840, + 1077859090, + 615341051, + 3678875745, + 3349230696, + 3647606635, + 2549309392, + 1508570930, + 1766401548, + 1448448666, + 1499923635, + 2882994691, + 3674863070, + 3056042030, + 4240893633, + 1395113939, + 2964622752, + 1951208733, + 3536941067, + 4176581069, + 1203545131, + 3092754101, + 246375791, + 2736026107, + 1069781886, + 3687777340, + 1564342316, + 535067202, + 1395923345, + 3240977890, + 1447712361, + 2602027658, + 718301639, + 3123244280, + 1032593647, + 2840366496, + 2680819379, + 3839389658, + 277023757, + 1172110445, + 1755648697, + 2472176885, + 223800276, + 625975427, + 976111724, + 4145966869, + 2789375411, + 618087261, + 249378857, + 4058280485, + 827698488, + 1558001705, + 3561482820, + 2562485583, + 4243138030, + 615982737, + 1220643281, + 150685616, + 3091876332, + 1040775722, + 669982125, + 4116080964, + 3582002820, + 910398460, + 1036475267, + 3800912395, + 146392076, + 1686512349, + 2326636627, + 2839816704, + 3502816184, + 226836633, + 3953733490, + 257136089, + 819503463, + 2863084840, + 1949759310, + 210754155, + 1367301635, + 3822983876, + 4273793488, + 3635397748, + 3930494584, + 3127921440, + 3167253437, + 3868239231, + 1859128680, + 3480031018, + 3810805277, + 2677252364, + 156014509, + 3627739127, + 2321729979, + 1146476634, + 4039938779, + 1964254745, + 2055836767, + 119981689, + 2629265310, + 2448331885, + 3737376990, + 144116905, + 2272221101, + 2197874825, + 1277245109, + 2503770904, + 360730278, + 3489360962, + 1166917451, + 707478563, + 4155586396, + 162255877, + 347505241, + 4215670524, + 3187066832, + 2399809085, + 2754074729, + 4060703604, + 628331516, + 1304296041, + 616435646, + 4080527786, + 1443829854, + 2512398201, + 708736129, + 13107491, + 3794803132, + 2049792025, + 2455417440, + 3367313400, + 3357250579, + 3694383800, + 2339901602, + 3242843022, + 2282454607, + 1243764146, + 835458563, + 1297706389, + 464259778, + 1766994680, + 1294403159, + 2568098594, + 3107165180, + 4040340620, + 3352361837, + 1031290113, + 2903897222, + 1677700667, + 3160388974, + 107544081, + 3044188332, + 2285081596, + 2835131395, + 2984459037, + 4174489262, + 1236389532, + 2938237924, + 321459212, + 3407526215, + 300939750, + 3441531391, + 2909957084, + 3192069648, + 1849065716, + 2524531022, + 505940164, + 4121643374, + 3774892253, + 3197739982, + 2161102232, + 2715370488, + 1992893964, + 1781864804, + 587888644, + 1039111164, + 4237497041, + 451382997, + 969500141, + 1415510495, + 3743398113, + 3027538652, + 2525173102, + 1708264968, + 3366040354, + 1100599986, + 188347929, + 2597020383, + 2705434194, + 2593884753, + 3472123498, + 2975894973, + 3152745753, + 1154919607, + 1930923350, + 3287039847, + 1372881231, + 2280400314, + 3369343584, + 2351620600, + 2645135839, + 2752766693, + 1471851763, + 1989520052, + 1141965917, + 1503477720, + 653708953, + 1765126703, + 2432827426, + 95470391, + 2567901801, + 2589449658, + 4218799564, + 3249265647, + 3673811979, + 210116709, + 1593584949, + 1791352211, + 3457985288, + 3345288309, + 531559080, + 2491124112, + 3410158390, + 4224872590, + 3705139860, + 162608772, + 4258229445, + 925559698, + 3928842969, + 4253051659, + 3633746133, + 3867307935, + 3560665067, + 798915737, + 2945369269, + 2677264274, + 2278571792, + 177111659, + 85880059, + 1297165140, + 1630583316, + 2232491275, + 1848784182, + 2487708241, + 626480004, + 3427283542, + 2108571893, + 304448521, + 3332104493, + 2244470522, + 436416061, + 221900294, + 1502470404, + 3552593177, + 440421571, + 450406196, + 503094540, + 3836822275, + 2708915136, + 3750617468, + 1119744229, + 3614752756, + 921246433, + 2285438321, + 626892406, + 2362972044, + 72782198, + 2929019254, + 2795773560, + 907126242, + 155458798, + 2798552666, + 1404739463, + 4285652249, + 1998444837, + 908777857, + 872544165, + 910429472, + 135486769, + 3457269042, + 426360862, + 1725011064, + 296836635, + 1322549027, + 2044728014, + 1530183840, + 529742207, + 4272200782, + 1341516288, + 2608484640, + 41739659, + 3260579369, + 2745872368, + 2894051250, + 862784766, + 3077271274, + 3094180193, + 3619626927, + 3745223676, + 2976066508, + 2854085372, + 2959147533, + 3266548732, + 1776526161, + 3712296962, + 1955871800, + 2580096524, + 2507709226, + 3564865233, + 948086521, + 1548254487, + 142465290, + 1472185378, + 1459457331, + 2274226560, + 3153451899, + 492958971, + 3563213618, + 1285705317, + 410274915, + 3710645347, + 1309728002, + 2119793999, + 1343794461, + 4024173916, + 2383939514, + 955476870, + 2698156268, + 35240468, + 2655147757, + 3764205609, + 3802564010, + 170690025, + 2311941439, + 3181546731, + 3866587616, + 3648138580, + 93914936, + 170378107, + 2120623674, + 1064945649, + 1618754372, + 244668133, + 247698428, + 3669223677, + 470277359, + 1781765116, + 1691572958, + 1373856501, + 2668769415, + 1087394637, + 1009983433, + 2180701723, + 4008405264, + 2831059514, + 2645120714, + 2649103430, + 2664825925, + 790502615, + 1739837626, + 2293247016, + 1784648440, + 1887808856, + 1788504755, + 112452386, + 1979978194, + 3462674048, + 2170273742, + 538168945, + 753954113, + 374731234, + 3715846592, + 1962971231, + 1860649552, + 1378082995, + 665789406, + 1717555224, + 139011596, + 1375043498, + 1618544981, + 1889460471, + 2262321736, + 1788301425, + 1652168174, + 2668680621, + 2636946065, + 2856623532, + 2759951687, + 959681532, + 3209399506, + 3055195668, + 1227221002, + 508217552, + 3289969989, + 243178923, + 2956189845, + 3075866530, + 2274779301, + 3940720663, + 3998230222, + 1178317551, + 4016096296, + 1545450160, + 2842919847, + 314809953, + 2952850186, + 3747079365, + 4147239510, + 169135842, + 1332643570, + 2994529201, + 973521782, + 1584369690, + 1043738701, + 2851900832, + 290391815, + 283209196, + 2468230023, + 1164221089, + 1991787192, + 3358097187, + 51041423, + 52882140, + 2339018837, + 2053214130, + 3757479030, + 158160339, + 853200279, + 1986584654, + 438318340, + 827246872, + 3299488628, + 2924263085, + 3472029049, + 2736844435, + 677668732, + 604894932, + 1158021131, + 1400019344, + 2268204687, + 1450415100, + 3854557817, + 1543646433, + 1278448636, + 342615870, + 1554194368, + 3080024605, + 3423702268, + 1675764636, + 1622381564, + 2078849875, + 2113115132, + 1380160211, + 3132876285, + 125015036, + 269576093, + 94145952, + 2777172031, + 2683080096, + 3812456892, + 488500848, + 3270430997, + 2895151306, + 116376005, + 400248103, + 406044930, + 1616846013, + 10142671, + 763027711, + 225200779, + 1062250709, + 2013867381, + 2113506324, + 1692932387, + 1827244161, + 3124618210, + 2096472894, + 2924146124, + 2128251367, + 2433358586, + 1939359710, + 2593325766, + 2879917723, + 694743357, + 2902069960, + 220008971, + 3090408469, + 917019124, + 1705716306, + 3263901372, + 3347863687, + 3447882276, + 1661163736, + 3617689692, + 3928555688, + 1057578789, + 435256475, + 4101009465, + 1941403425, + 198967948, + 3733675151, + 2043684541, + 3517169445, + 2226776400, + 2853403709, + 529383565, + 2807448986, + 4234287173, + 1019457583, + 1022544883, + 2493146691, + 1054461787, + 1008886329, + 1136775085, + 1191015885, + 1196280518, + 1979847999, + 50385656, + 1918742169, + 3999472204, + 3697687030, + 2220475432, + 2358141757, + 2360004627, + 4245257809, + 236660303, + 429277936, + 342159236, + 2622612602, + 371428004, + 373079619, + 643418617, + 2095027856, + 1071164424, + 1136911283, + 1548491889, + 2169307971, + 375530199, + 1510422521, + 3151638847, + 1698730948, + 2231688008, + 2604576561, + 2771938750, + 2996594997, + 289648234, + 348584153, + 2748350697, + 2926633629, + 2123683379, + 369686787, + 742917749, + 3538158875, + 2937761472, + 1545298048, + 1321616112, + 2855506940, + 900522183, + 1578775276, + 2217833278, + 2012838864, + 3753486980, + 2839765116, + 2464905186, + 2621255555, + 1305703280, + 861753115, + 3319278167, + 3063300848, + 149720480, + 1082941229, + 3337532056, + 2248357849, + 3675926744, + 1508550646, + 2289803479, + 3456899824, + 3931641900, + 3970432934, + 3419674548, + 1093210099, + 456043370, + 848380423, + 1287304304, + 1526654696, + 2055664760, + 1373166395, + 4291477370, + 2195550588, + 2847102741, + 3399062057, + 1641565587, + 2888753905, + 3579593979, + 3653059026, + 3757851979, + 2922615804, + 2919796598, + 1553476262, + 2566666743, + 3759503594, + 550831114, + 3761155209, + 3762806824, + 3902853271, + 4140081844, + 14244860, + 3847846774, + 150820676, + 1278818058, + 850592577, + 1206571206, + 1734446471, + 2117320444, + 1382106590, + 2436009347, + 2118972059, + 2951272396, + 36096192, + 117998987, + 473485679, + 2244928358, + 476788909, + 3489269251, + 610429940, + 480092139, + 481743754, + 871966503, + 918189168, + 601656217, + 933769938, + 939671928, + 1799299383, + 3312467582, + 1149665466, + 3006548167, + 1310740861, + 3602693817, + 1461645203, + 3367691969, + 1800404122, + 3486057732, + 1862284649, + 2076833303, + 2213411495, + 2805256437, + 3927915220, + 3000904950, + 2094647776, + 3333131702, + 1315613425, + 3752211294, + 603915804, + 3505028338, + 663258455, + 3322500634, + 1612225949, + 3606320646, + 157110413, + 1352397672, + 3861006967, + 452208841, + 18776483, + 1058429216, + 37009196, + 564884461, + 876864198, + 2952260510, + 2860348412, + 928261291, + 1164724902, + 2775815164, + 1332774287, + 780957373, + 939415664, + 1513770932, + 788046331, + 1692600167, + 4069810315, + 673708384, + 4024252457, + 1932614728, + 2148510256, + 3131224670, + 2388524817, + 2460489993, + 2676385521, + 826214242, + 3692647551, + 3063508455, + 3071766530, + 2063832060, + 1525861001, + 3073418145, + 837715723, + 3075069760, + 3076721375, + 3078372990, + 983243705, + 3083327835, + 171307615, + 1824016656, + 3084979450, + 1310404265, + 1775308984, + 3114708520, + 3116360135, + 3121314980, + 3134527900, + 1691646294, + 2804281092, + 97231530, + 3136179515, + 3204260786, + 3276225962, + 1220749418, + 3588205699, + 3874089391, + 4044115788, + 3268751013, + 743407979, + 166253838, + 1356063462, + 1368383673, + 2279700640, + 2130747644, + 3945795573, + 2780898906, + 3635542517, + 425022309, + 517919178, + 4061558677, + 2190437442, + 543621065, + 753756604, + 2500819054, + 1004589179, + 1165671422, + 30433743, + 3444275347, + 1335363438, + 1913735398, + 1265998516, + 3829325073, + 3662767579, + 463084678, + 1351676723, + 1391866096, + 3398925952, + 1631216488, + 815757910, + 1915438939, + 2427834344, + 1445161581, + 1890300748, + 2864863800, + 1961990747, + 575205902, + 2037710159, + 2037814253, + 617312262, + 3732916270, + 783918780, + 2257843797, + 2096388952, + 2338272340, + 1434223270, + 578132535, + 1980341560, + 1002144380, + 3244716568, + 4258414038, + 3271748023, + 3304438238, + 3717523241, + 3370185097, + 3435931956, + 1957265068, + 3602522282, + 2547657777, + 439998433, + 3838648480, + 3913593633, + 3989799199, + 906176560, + 1894133125, + 4046301857, + 4242327928, + 630592085, + 2693892518, + 4292991777, + 545678922, + 125792961, + 3015046341, + 132755933, + 2615111110, + 1570165302, + 1440646342, + 436066778, + 565233904, + 600906020, + 602222721, + 3951925872, + 1496901698, + 1522901980, + 2785441472, + 3041450802, + 1637661947, + 2127660080, + 3487022798, + 2269114589, + 1314834580, + 2315690100, + 3817149113, + 4091670162, + 1431749301, + 1858116930, + 2213946343, + 2225172640, + 2263866576, + 2727022058, + 2752967311, + 2864705739, + 3052439312, + 3510257966, + 2614053317, + 3297860332, + 3670298840, + 3732709413, + 3788324110, + 4098876453, + 4290374884, + 1623013158, + 3381478137, + 17185761, + 3931288033, + 2890638791, + 330388453, + 346929928, + 2022347217, + 4083347580, + 533021259, + 564302770, + 1917602962, + 680157484, + 3264086791, + 3727034815, + 798549062, + 3068463300, + 669812542, + 1965902997, + 2311072371, + 3079287749, + 2542834724, + 1587730355, + 2558655180, + 1838763297, + 4172568578, + 2160380860, + 2950446516, + 1830851200, + 3214537066, + 3234673086, + 3652695478, + 3103302036, + 3465954368, + 4180570743, + 3534518722, + 371186900, + 4091394002, + 1013756921, + 443558693, + 591140762, + 656610661, + 2064733527, + 3808408202, + 983299427, + 4217306348, + 1164218401, + 2036361232, + 3237903670, + 2970183398, + 2293637521, + 135920445, + 1596005536, + 868652905, + 1191735827, + 3987079331, + 1365842164, + 1508074873, + 1642818143, + 3436143898, + 4105051793, + 1863199739, + 3425841570, + 1070791291, + 2135340676, + 2639720559, + 3364388739, + 3797761273, + 2092100514, + 2098706974, + 2329992200, + 414444763, + 2759250216, + 2913136690, + 3012980338, + 3327770644, + 4128942283, + 3362344229, + 161668409, + 3401762422, + 2852854788, + 4237092412, + 1245448751, + 3702405475, + 918849409, + 3829682756, + 1612361408, + 255302575, + 414620710, + 386293029, + 618761615, + 686024761, + 744062262, + 1502028603, + 1543798545, + 1641415225, + 1548121999, + 2257971049, + 2124837447, + 878733439, + 2340670452, + 2674090849, + 3118011750, + 2816338013, + 178571546, + 2841008029, + 3249261197, + 370232173, + 4092487128, + 3787567939, + 3898287302, + 4142016703, + 4285779501, + 30663912, + 151672195, + 180913835, + 3534235309, + 34183582, + 4083161638, + 651464351, + 1410311776, + 371621315, + 421602934, + 458937500, + 2710583246, + 712168842, + 730943059, + 1519723107, + 875212982, + 1247793383, + 4217322139, + 989813600, + 1057606514, + 3764662384, + 1443547269, + 3066811685, + 3598957382, + 1791427568, + 1171541710, + 3930727258, + 1473799048, + 1296054774, + 1747355813, + 765238787, + 2023008475, + 1190147516, + 2344328209, + 2495155989, + 2577859137, + 2857814560, + 3127329373, + 3296722158, + 2773229577, + 3376009661, + 3450001968, + 920941800, + 3526837441, + 3858973601, + 1702168830, + 4088613871, + 1464587427, + 223310468, + 388034151, + 2346547796, + 1663234329, + 1750829822, + 1967643923, + 2881302403, + 2278706468, + 2326990117, + 2511346984, + 3088785099, + 2616085763, + 3027500544, + 3417583519, + 4178218543, + 1412908157, + 797934924, + 3533637837, + 1449907751, + 3362830643, + 1451831482, + 2637935122, + 3070114915, + 3023287679, + 551924251, + 1669930486, + 46736908, + 2870852215, + 1120149824, + 2923708820, + 3887377256, + 3464197236, + 4241374559, + 527665290, + 996663016, + 885020215, + 1763758554, + 3059119137, + 2555315060, + 2762094724, + 2530899578, + 2770161927, + 2262137600, + 3547456240, + 858902117, + 1140367371, + 1215030156, + 443490822, + 294390719, + 3032677281, + 1917451875, + 4184019303, + 3277199633, + 1271484400, + 1297294717, + 3560552546, + 171494987, + 195244192, + 3002890475, + 1811839150, + 265392489, + 1461398554, + 3205759417, + 333855951, + 529068443, + 660038281, + 557400685, + 663341511, + 930804377, + 1922045399, + 716890919, + 162167595, + 1654776395, + 1779143013, + 1123617794, + 2984325996, + 1162789888, + 1318479490, + 1235468610, + 3561562003, + 1486207619, + 1551372768, + 1850331254, + 3255947500, + 1037370721, + 1989327599, + 2137526937, + 835638766, + 2269130237, + 1962162282, + 3244209297, + 2330636993, + 3095831808, + 1396344138, + 2603020391, + 3434076295, + 3280064277, + 2656211099, + 3335250889, + 2550961007, + 3510242586, + 3536471583, + 3950980241, + 4033586023, + 117250846, + 3088282680, + 4041974454, + 4244540017, + 1167160774, + 899320334, + 1200870684, + 1752686878, + 1906988301, + 3804101227, + 2575525651, + 2919787747, + 3508792859, + 3548535223, + 3783756895, + 3797961332, + 4043078107, + 3115038057, + 2313593054, + 49456560, + 592180731, + 1051471757, + 1097775533, + 706238670, + 877895868, + 1173092699, + 1461897718, + 1767704813, + 1770165905, + 1923453688, + 2212501241, + 2305269460, + 2488410748, + 3782099915, + 2844616706, + 3383007207, + 3392887901, + 504514034, + 3765247327, + 1000070091, + 3727494858, + 3657635382, + 3839047923, + 3886529747, + 4069720347, + 4164704452, + 342197850, + 3540244297, + 2513230733, + 4117704995, + 3367298820, + 2680283743, + 3119663365, + 3697738938, + 545363837, + 163402553, + 5908395, + 129135650, + 2289183712, + 200922300, + 761731755, + 894529125, + 1086964761, + 1168927492, + 2100052708, + 2438466459, + 3390051757, + 2498042266, + 2557754096, + 2600961503, + 487719832, + 703543228, + 2726532092, + 4199470013, + 3142155593, + 2550501832, + 4076840151, + 200553094, + 380957745, + 572905105, + 462664429, + 1466804584, + 330249537, + 2605012269, + 491456522, + 4126287524, + 502863753, + 952536201, + 3510682541, + 1137442027, + 1665981878, + 1761469971, + 3085467405, + 2045285083, + 796985462, + 3433956341, + 2217966239, + 2183547611, + 2279273489, + 1916983087, + 2348676810, + 2403632109, + 2409539315, + 545986953, + 176166202, + 2477389837, + 2573160348, + 2796513469, + 3972309363, + 528662843, + 1038982109, + 1125913837, + 1318081294, + 1417425499, + }; + return descriptors_with_coding_scheme; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/dis/dis.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/dis/dis.cpp new file mode 100644 index 00000000000..6a2e269327e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/dis/dis.cpp @@ -0,0 +1,209 @@ +// Copyright (c) 2015-2016 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. + +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) +#include // Need fileno +#include +#endif + +#include +#include +#include +#include + +#include "spirv-tools/libspirv.h" +#include "tools/io.h" + +static void print_usage(char* argv0) { + printf( + R"(%s - Disassemble a SPIR-V binary module + +Usage: %s [options] [] + +The SPIR-V binary is read from . If no file is specified, +or if the filename is "-", then the binary is read from standard input. + +Options: + + -h, --help Print this help. + --version Display disassembler version information. + + -o Set the output filename. + Output goes to standard output if this option is + not specified, or if the filename is "-". + + --color Force color output. The default when printing to a terminal. + Overrides a previous --no-color option. + --no-color Don't print in color. Overrides a previous --color option. + The default when output goes to something other than a + terminal (e.g. a file, a pipe, or a shell redirection). + + --no-indent Don't indent instructions. + + --no-header Don't output the header as leading comments. + + --raw-id Show raw Id values instead of friendly names. + + --offsets Show byte offsets for each instruction. +)", + argv0, argv0); +} + +static const auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_3; + +int main(int argc, char** argv) { + const char* inFile = nullptr; + const char* outFile = nullptr; + + bool color_is_possible = +#if SPIRV_COLOR_TERMINAL + true; +#else + false; +#endif + bool force_color = false; + bool force_no_color = false; + + bool allow_indent = true; + bool show_byte_offsets = false; + bool no_header = false; + bool friendly_names = true; + + for (int argi = 1; argi < argc; ++argi) { + if ('-' == argv[argi][0]) { + switch (argv[argi][1]) { + case 'h': + print_usage(argv[0]); + return 0; + case 'o': { + if (!outFile && argi + 1 < argc) { + outFile = argv[++argi]; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case '-': { + // Long options + if (0 == strcmp(argv[argi], "--no-color")) { + force_no_color = true; + force_color = false; + } else if (0 == strcmp(argv[argi], "--color")) { + force_no_color = false; + force_color = true; + } else if (0 == strcmp(argv[argi], "--no-indent")) { + allow_indent = false; + } else if (0 == strcmp(argv[argi], "--offsets")) { + show_byte_offsets = true; + } else if (0 == strcmp(argv[argi], "--no-header")) { + no_header = true; + } else if (0 == strcmp(argv[argi], "--raw-id")) { + friendly_names = false; + } else if (0 == strcmp(argv[argi], "--help")) { + print_usage(argv[0]); + return 0; + } else if (0 == strcmp(argv[argi], "--version")) { + printf("%s\n", spvSoftwareVersionDetailsString()); + printf("Target: %s\n", + spvTargetEnvDescription(kDefaultEnvironment)); + return 0; + } else { + print_usage(argv[0]); + return 1; + } + } break; + case 0: { + // Setting a filename of "-" to indicate stdin. + if (!inFile) { + inFile = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } break; + default: + print_usage(argv[0]); + return 1; + } + } else { + if (!inFile) { + inFile = argv[argi]; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + return 1; + } + } + } + + uint32_t options = SPV_BINARY_TO_TEXT_OPTION_NONE; + + if (allow_indent) options |= SPV_BINARY_TO_TEXT_OPTION_INDENT; + + if (show_byte_offsets) options |= SPV_BINARY_TO_TEXT_OPTION_SHOW_BYTE_OFFSET; + + if (no_header) options |= SPV_BINARY_TO_TEXT_OPTION_NO_HEADER; + + if (friendly_names) options |= SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES; + + if (!outFile || (0 == strcmp("-", outFile))) { + // Print to standard output. + options |= SPV_BINARY_TO_TEXT_OPTION_PRINT; + + if (color_is_possible && !force_no_color) { + bool output_is_tty = true; +#if defined(_POSIX_VERSION) + output_is_tty = isatty(fileno(stdout)); +#endif + if (output_is_tty || force_color) { + options |= SPV_BINARY_TO_TEXT_OPTION_COLOR; + } + } + } + + // Read the input binary. + std::vector contents; + if (!ReadFile(inFile, "rb", &contents)) return 1; + + // If printing to standard output, then spvBinaryToText should + // do the printing. In particular, colour printing on Windows is + // controlled by modifying console objects synchronously while + // outputting to the stream rather than by injecting escape codes + // into the output stream. + // If the printing option is off, then save the text in memory, so + // it can be emitted later in this function. + const bool print_to_stdout = SPV_BINARY_TO_TEXT_OPTION_PRINT & options; + spv_text text = nullptr; + spv_text* textOrNull = print_to_stdout ? nullptr : &text; + spv_diagnostic diagnostic = nullptr; + spv_context context = spvContextCreate(kDefaultEnvironment); + spv_result_t error = + spvBinaryToText(context, contents.data(), contents.size(), options, + textOrNull, &diagnostic); + spvContextDestroy(context); + if (error) { + spvDiagnosticPrint(diagnostic); + spvDiagnosticDestroy(diagnostic); + return error; + } + + if (!print_to_stdout) { + if (!WriteFile(outFile, "w", text->str, text->length)) { + spvTextDestroy(text); + return 1; + } + } + spvTextDestroy(text); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/emacs/50spirv-tools.el b/3rdparty/bgfx/3rdparty/spirv-tools/tools/emacs/50spirv-tools.el new file mode 100644 index 00000000000..1d4fbeef85d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/emacs/50spirv-tools.el @@ -0,0 +1,40 @@ +;; Copyright (c) 2016 LunarG 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. + +;; Upon loading a file with the .spv extension into emacs, the file +;; will be disassembled using spirv-dis, and the result colorized with +;; asm-mode in emacs. The file may be edited within the constraints +;; of validity, and when re-saved will be re-assembled using spirv-as. + +;; Note that symbol IDs are not preserved through a load/edit/save operation. +;; This may change if the ability is added to spirv-as. + +;; It is required that those tools be in your PATH. If that is not the case +;; when starting emacs, the path can be modified as in this example: +;; (setenv "PATH" (concat (getenv "PATH") ":/path/to/spirv/tools")) +;; +;; See https://github.com/KhronosGroup/SPIRV-Tools/issues/359 + +(require 'jka-compr) +(require 'asm-mode) + +(add-to-list 'jka-compr-compression-info-list + '["\\.spv\\'" + "Assembling SPIRV" "spirv-as" ("-o" "-") + "Disassembling SPIRV" "spirv-dis" ("--no-color" "--raw-id") + t nil "\003\002\043\007"]) + +(add-to-list 'auto-mode-alist '("\\.spv\\'" . asm-mode)) + +(jka-compr-update) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/emacs/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/tools/emacs/CMakeLists.txt new file mode 100644 index 00000000000..ecd7c277a87 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/emacs/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright (c) 2016 LunarG 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. + +# Install a script for use with the auto-compression feature of emacs(1). +# Upon loading a file with the .spv extension, the file will be disassembled +# using spirv-dis, and the result colorized with asm-mode in emacs. The file +# may be edited within the constraints of validity, and when re-saved will be +# re-assembled using spirv-as. + +# It is required that those tools be in your PATH. If that is not the case +# when starting emacs, the path can be modified as in this example: +# (setenv "PATH" (concat (getenv "PATH") ":/path/to/spirv/tools")) +# +# See https://github.com/KhronosGroup/SPIRV-Tools/issues/359 + +# This is an absolute directory, and ignores CMAKE_INSTALL_PREFIX, or +# it will not be found by emacs upon startup. It is only installed if +# both of the following are true: +# 1. SPIRV_TOOLS_INSTALL_EMACS_HELPERS is defined +# 2. The directory /etc/emacs/site-start.d already exists at the time of +# cmake invocation (not at the time of make install). This is +# typically true if emacs is installed on the system. + +# Note that symbol IDs are not preserved through a load/edit/save operation. +# This may change if the ability is added to spirv-as. + +option(SPIRV_TOOLS_INSTALL_EMACS_HELPERS + "Install Emacs helper to disassemble/assemble SPIR-V binaries on file load/save." + ${SPIRV_TOOLS_INSTALL_EMACS_HELPERS}) +if (${SPIRV_TOOLS_INSTALL_EMACS_HELPERS}) + if(EXISTS /etc/emacs/site-start.d) + if(ENABLE_SPIRV_TOOLS_INSTALL) + install(FILES 50spirv-tools.el DESTINATION /etc/emacs/site-start.d) + endif(ENABLE_SPIRV_TOOLS_INSTALL) + endif() +endif() + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/io.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/io.h new file mode 100644 index 00000000000..aaf8fcdd29f --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/io.h @@ -0,0 +1,82 @@ +// Copyright (c) 2016 Google 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. + +#ifndef TOOLS_IO_H_ +#define TOOLS_IO_H_ + +#include +#include +#include + +// Appends the content from the file named as |filename| to |data|, assuming +// each element in the file is of type |T|. The file is opened with the given +// |mode|. If |filename| is nullptr or "-", reads from the standard input, but +// reopened with the given mode. If any error occurs, writes error messages to +// standard error and returns false. +template +bool ReadFile(const char* filename, const char* mode, std::vector* data) { + const int buf_size = 1024; + const bool use_file = filename && strcmp("-", filename); + if (FILE* fp = + (use_file ? fopen(filename, mode) : freopen(nullptr, mode, stdin))) { + T buf[buf_size]; + while (size_t len = fread(buf, sizeof(T), buf_size, fp)) { + data->insert(data->end(), buf, buf + len); + } + if (ftell(fp) == -1L) { + if (ferror(fp)) { + fprintf(stderr, "error: error reading file '%s'\n", filename); + return false; + } + } else { + if (sizeof(T) != 1 && (ftell(fp) % sizeof(T))) { + fprintf( + stderr, + "error: file size should be a multiple of %zd; file '%s' corrupt\n", + sizeof(T), filename); + return false; + } + } + if (use_file) fclose(fp); + } else { + fprintf(stderr, "error: file does not exist '%s'\n", filename); + return false; + } + return true; +} + +// Writes the given |data| into the file named as |filename| using the given +// |mode|, assuming |data| is an array of |count| elements of type |T|. If +// |filename| is nullptr or "-", writes to standard output. If any error occurs, +// returns false and outputs error message to standard error. +template +bool WriteFile(const char* filename, const char* mode, const T* data, + size_t count) { + const bool use_stdout = + !filename || (filename[0] == '-' && filename[1] == '\0'); + if (FILE* fp = (use_stdout ? stdout : fopen(filename, mode))) { + size_t written = fwrite(data, sizeof(T), count, fp); + if (count != written) { + fprintf(stderr, "error: could not write to file '%s'\n", filename); + return false; + } + if (!use_stdout) fclose(fp); + } else { + fprintf(stderr, "error: could not open file '%s'\n", filename); + return false; + } + return true; +} + +#endif // TOOLS_IO_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/lesspipe/CMakeLists.txt b/3rdparty/bgfx/3rdparty/spirv-tools/tools/lesspipe/CMakeLists.txt new file mode 100644 index 00000000000..484e51e588d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/lesspipe/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (c) 2016 Google 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. + +# Install a script for use with the LESSOPEN of less(1). +# For example, after installation into /usr/local do: +# export LESSOPEN='|/usr/local/bin "%s"' +# less -R foo.spv +# +# See https://github.com/KhronosGroup/SPIRV-Tools/issues/359 + +# The script will be installed with everyone having read and execute +# permissions. +# We have a .sh extension because Windows users often configure +# executable settings via filename extension. +if(ENABLE_SPIRV_TOOLS_INSTALL) + install(PROGRAMS spirv-lesspipe.sh DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif(ENABLE_SPIRV_TOOLS_INSTALL) diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/lesspipe/spirv-lesspipe.sh b/3rdparty/bgfx/3rdparty/spirv-tools/tools/lesspipe/spirv-lesspipe.sh new file mode 100644 index 00000000000..81e335501bb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/lesspipe/spirv-lesspipe.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright (c) 2016 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. + +# A script for automatically disassembling a .spv file +# for less(1). This assumes spirv-dis is on our PATH. +# +# See https://github.com/KhronosGroup/SPIRV-Tools/issues/359 + +case "$1" in + *.spv) spirv-dis "$@" 2>/dev/null;; + *) exit 1;; +esac + +exit $? + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/link/linker.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/link/linker.cpp new file mode 100644 index 00000000000..fb44a37ad6c --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/link/linker.cpp @@ -0,0 +1,159 @@ +// Copyright (c) 2017 Pierre Moreau +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "source/spirv_target_env.h" +#include "source/table.h" +#include "spirv-tools/libspirv.hpp" +#include "spirv-tools/linker.hpp" +#include "tools/io.h" + +void print_usage(char* argv0) { + printf( + R"(%s - Link SPIR-V binary files together. + +USAGE: %s [options] [ ...] + +The SPIR-V binaries are read from the different . + +NOTE: The linker is a work in progress. + +Options: + -h, --help Print this help. + -o Name of the resulting linked SPIR-V binary. + --create-library Link the binaries into a library, keeping all exported symbols. + --allow-partial-linkage Allow partial linkage by accepting imported symbols to be unresolved. + --verify-ids Verify that IDs in the resulting modules are truly unique. + --version Display linker version information + --target-env {vulkan1.0|spv1.0|spv1.1|spv1.2|opencl2.1|opencl2.2} + Use Vulkan1.0/SPIR-V1.0/SPIR-V1.1/SPIR-V1.2/OpenCL-2.1/OpenCL2.2 validation rules. +)", + argv0, argv0); +} + +int main(int argc, char** argv) { + std::vector inFiles; + const char* outFile = nullptr; + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_0; + spvtools::LinkerOptions options; + bool continue_processing = true; + int return_code = 0; + + for (int argi = 1; continue_processing && argi < argc; ++argi) { + const char* cur_arg = argv[argi]; + if ('-' == cur_arg[0]) { + if (0 == strcmp(cur_arg, "-o")) { + if (argi + 1 < argc) { + if (!outFile) { + outFile = argv[++argi]; + } else { + fprintf(stderr, "error: More than one output file specified\n"); + continue_processing = false; + return_code = 1; + } + } else { + fprintf(stderr, "error: Missing argument to %s\n", cur_arg); + continue_processing = false; + return_code = 1; + } + } else if (0 == strcmp(cur_arg, "--create-library")) { + options.SetCreateLibrary(true); + } else if (0 == strcmp(cur_arg, "--verify-ids")) { + options.SetVerifyIds(true); + } else if (0 == strcmp(cur_arg, "--allow-partial-linkage")) { + options.SetAllowPartialLinkage(true); + } else if (0 == strcmp(cur_arg, "--version")) { + printf("%s\n", spvSoftwareVersionDetailsString()); + // TODO(dneto): Add OpenCL 2.2 at least. + printf("Targets:\n %s\n %s\n %s\n", + spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_1), + spvTargetEnvDescription(SPV_ENV_VULKAN_1_0), + spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_2)); + continue_processing = false; + return_code = 0; + } else if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { + print_usage(argv[0]); + continue_processing = false; + return_code = 0; + } else if (0 == strcmp(cur_arg, "--target-env")) { + if (argi + 1 < argc) { + const auto env_str = argv[++argi]; + if (!spvParseTargetEnv(env_str, &target_env)) { + fprintf(stderr, "error: Unrecognized target env: %s\n", env_str); + continue_processing = false; + return_code = 1; + } + } else { + fprintf(stderr, "error: Missing argument to --target-env\n"); + continue_processing = false; + return_code = 1; + } + } + } else { + inFiles.push_back(cur_arg); + } + } + + // Exit if command line parsing was not successful. + if (!continue_processing) { + return return_code; + } + + if (inFiles.empty()) { + fprintf(stderr, "error: No input file specified\n"); + return 1; + } + + std::vector> contents(inFiles.size()); + for (size_t i = 0u; i < inFiles.size(); ++i) { + if (!ReadFile(inFiles[i], "rb", &contents[i])) return 1; + } + + const spvtools::MessageConsumer consumer = [](spv_message_level_t level, + const char*, + const spv_position_t& position, + const char* message) { + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_WARNING: + std::cout << "warning: " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_INFO: + std::cout << "info: " << position.index << ": " << message << std::endl; + break; + default: + break; + } + }; + spvtools::Context context(target_env); + context.SetMessageConsumer(consumer); + + std::vector linkingResult; + spv_result_t status = Link(context, contents, &linkingResult, options); + + if (!WriteFile(outFile, "wb", linkingResult.data(), + linkingResult.size())) + return 1; + + return status == SPV_SUCCESS ? 0 : 1; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/opt/opt.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/opt/opt.cpp new file mode 100644 index 00000000000..fcd260e45b3 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/opt/opt.cpp @@ -0,0 +1,610 @@ +// Copyright (c) 2016 Google 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. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/opt/log.h" +#include "source/opt/loop_peeling.h" +#include "source/opt/set_spec_constant_default_value_pass.h" +#include "source/spirv_validator_options.h" +#include "spirv-tools/optimizer.hpp" +#include "tools/io.h" +#include "tools/util/cli_consumer.h" + +namespace { + +// Status and actions to perform after parsing command-line arguments. +enum OptActions { OPT_CONTINUE, OPT_STOP }; + +struct OptStatus { + OptActions action; + int code; +}; + +// Message consumer for this tool. Used to emit diagnostics during +// initialization and setup. Note that |source| and |position| are irrelevant +// here because we are still not processing a SPIR-V input file. +void opt_diagnostic(spv_message_level_t level, const char* /*source*/, + const spv_position_t& /*positon*/, const char* message) { + if (level == SPV_MSG_ERROR) { + fprintf(stderr, "error: "); + } + fprintf(stderr, "%s\n", message); +} + +std::string GetListOfPassesAsString(const spvtools::Optimizer& optimizer) { + std::stringstream ss; + for (const auto& name : optimizer.GetPassNames()) { + ss << "\n\t\t" << name; + } + return ss.str(); +} + +const auto kDefaultEnvironment = SPV_ENV_UNIVERSAL_1_3; + +std::string GetLegalizationPasses() { + spvtools::Optimizer optimizer(kDefaultEnvironment); + optimizer.RegisterLegalizationPasses(); + return GetListOfPassesAsString(optimizer); +} + +std::string GetOptimizationPasses() { + spvtools::Optimizer optimizer(kDefaultEnvironment); + optimizer.RegisterPerformancePasses(); + return GetListOfPassesAsString(optimizer); +} + +std::string GetSizePasses() { + spvtools::Optimizer optimizer(kDefaultEnvironment); + optimizer.RegisterSizePasses(); + return GetListOfPassesAsString(optimizer); +} + +void PrintUsage(const char* program) { + // NOTE: Please maintain flags in lexicographical order. + printf( + R"(%s - Optimize a SPIR-V binary file. + +USAGE: %s [options] [] -o + +The SPIR-V binary is read from . If no file is specified, +or if is "-", then the binary is read from standard input. +if is "-", then the optimized output is written to +standard output. + +NOTE: The optimizer is a work in progress. + +Options (in lexicographical order): + --ccp + Apply the conditional constant propagation transform. This will + propagate constant values throughout the program, and simplify + expressions and conditional jumps with known predicate + values. Performed on entry point call tree functions and + exported functions. + --cfg-cleanup + Cleanup the control flow graph. This will remove any unnecessary + code from the CFG like unreachable code. Performed on entry + point call tree functions and exported functions. + --combine-access-chains + Combines chained access chains to produce a single instruction + where possible. + --compact-ids + Remap result ids to a compact range starting from %%1 and without + any gaps. + --convert-local-access-chains + Convert constant index access chain loads/stores into + equivalent load/stores with inserts and extracts. Performed + on function scope variables referenced only with load, store, + and constant index access chains in entry point call tree + functions. + --copy-propagate-arrays + Does propagation of memory references when an array is a copy of + another. It will only propagate an array if the source is never + written to, and the only store to the target is the copy. + --eliminate-common-uniform + Perform load/load elimination for duplicate uniform values. + Converts any constant index access chain uniform loads into + its equivalent load and extract. Some loads will be moved + to facilitate sharing. Performed only on entry point + call tree functions. + --eliminate-dead-branches + Convert conditional branches with constant condition to the + indicated unconditional brranch. Delete all resulting dead + code. Performed only on entry point call tree functions. + --eliminate-dead-code-aggressive + Delete instructions which do not contribute to a function's + output. Performed only on entry point call tree functions. + --eliminate-dead-const + Eliminate dead constants. + --eliminate-dead-functions + Deletes functions that cannot be reached from entry points or + exported functions. + --eliminate-dead-inserts + Deletes unreferenced inserts into composites, most notably + unused stores to vector components, that are not removed by + aggressive dead code elimination. + --eliminate-dead-variables + Deletes module scope variables that are not referenced. + --eliminate-insert-extract + DEPRECATED. This pass has been replaced by the simplification + pass, and that pass will be run instead. + See --simplify-instructions. + --eliminate-local-multi-store + Replace stores and loads of function scope variables that are + stored multiple times. Performed on variables referenceed only + with loads and stores. Performed only on entry point call tree + functions. + --eliminate-local-single-block + Perform single-block store/load and load/load elimination. + Performed only on function scope variables in entry point + call tree functions. + --eliminate-local-single-store + Replace stores and loads of function scope variables that are + only stored once. Performed on variables referenceed only with + loads and stores. Performed only on entry point call tree + functions. + --flatten-decorations + Replace decoration groups with repeated OpDecorate and + OpMemberDecorate instructions. + --fold-spec-const-op-composite + Fold the spec constants defined by OpSpecConstantOp or + OpSpecConstantComposite instructions to front-end constants + when possible. + --freeze-spec-const + Freeze the values of specialization constants to their default + values. + --if-conversion + Convert if-then-else like assignments into OpSelect. + --inline-entry-points-exhaustive + Exhaustively inline all function calls in entry point call tree + functions. Currently does not inline calls to functions with + early return in a loop. + --legalize-hlsl + Runs a series of optimizations that attempts to take SPIR-V + generated by an HLSL front-end and generates legal Vulkan SPIR-V. + The optimizations are: + %s + + Note this does not guarantee legal code. This option passes the + option --relax-logical-pointer to the validator. + --local-redundancy-elimination + Looks for instructions in the same basic block that compute the + same value, and deletes the redundant ones. + --loop-fission + Splits any top level loops in which the register pressure has exceeded + a given threshold. The threshold must follow the use of this flag and + must be a positive integer value. + --loop-fusion + Identifies adjacent loops with the same lower and upper bound. + If this is legal, then merge the loops into a single loop. + Includes heuristics to ensure it does not increase number of + registers too much, while reducing the number of loads from + memory. Takes an additional positive integer argument to set + the maximum number of registers. + --loop-unroll + Fully unrolls loops marked with the Unroll flag + --loop-unroll-partial + Partially unrolls loops marked with the Unroll flag. Takes an + additional non-0 integer argument to set the unroll factor, or + how many times a loop body should be duplicated + --loop-peeling + Execute few first (respectively last) iterations before + (respectively after) the loop if it can elide some branches. + --loop-peeling-threshold + Takes a non-0 integer argument to set the loop peeling code size + growth threshold. The threshold prevents the loop peeling + from happening if the code size increase created by + the optimization is above the threshold. + --merge-blocks + Join two blocks into a single block if the second has the + first as its only predecessor. Performed only on entry point + call tree functions. + --merge-return + Changes functions that have multiple return statements so they + have a single return statement. + + For structured control flow it is assumed that the only + unreachable blocks in the function are trivial merge and continue + blocks. + + A trivial merge block contains the label and an OpUnreachable + instructions, nothing else. A trivial continue block contain a + label and an OpBranch to the header, nothing else. + + These conditions are guaranteed to be met after running + dead-branch elimination. + --loop-unswitch + Hoists loop-invariant conditionals out of loops by duplicating + the loop on each branch of the conditional and adjusting each + copy of the loop. + -O + Optimize for performance. Apply a sequence of transformations + in an attempt to improve the performance of the generated + code. For this version of the optimizer, this flag is equivalent + to specifying the following optimization code names: + %s + -Os + Optimize for size. Apply a sequence of transformations in an + attempt to minimize the size of the generated code. For this + version of the optimizer, this flag is equivalent to specifying + the following optimization code names: + %s + + NOTE: The specific transformations done by -O and -Os change + from release to release. + -Oconfig= + Apply the sequence of transformations indicated in . + This file contains a sequence of strings separated by whitespace + (tabs, newlines or blanks). Each string is one of the flags + accepted by spirv-opt. Optimizations will be applied in the + sequence they appear in the file. This is equivalent to + specifying all the flags on the command line. For example, + given the file opts.cfg with the content: + + --inline-entry-points-exhaustive + --eliminate-dead-code-aggressive + + The following two invocations to spirv-opt are equivalent: + + $ spirv-opt -Oconfig=opts.cfg program.spv + + $ spirv-opt --inline-entry-points-exhaustive \ + --eliminate-dead-code-aggressive program.spv + + Lines starting with the character '#' in the configuration + file indicate a comment and will be ignored. + + The -O, -Os, and -Oconfig flags act as macros. Using one of them + is equivalent to explicitly inserting the underlying flags at + that position in the command line. For example, the invocation + 'spirv-opt --merge-blocks -O ...' applies the transformation + --merge-blocks followed by all the transformations implied by + -O. + --print-all + Print SPIR-V assembly to standard error output before each pass + and after the last pass. + --private-to-local + Change the scope of private variables that are used in a single + function to that function. + --reduce-load-size + Replaces loads of composite objects where not every component is + used by loads of just the elements that are used. + --redundancy-elimination + Looks for instructions in the same function that compute the + same value, and deletes the redundant ones. + --relax-struct-store + Allow store from one struct type to a different type with + compatible layout and members. This option is forwarded to the + validator. + --remove-duplicates + Removes duplicate types, decorations, capabilities and extension + instructions. + --replace-invalid-opcode + Replaces instructions whose opcode is valid for shader modules, + but not for the current shader stage. To have an effect, all + entry points must have the same execution model. + --ssa-rewrite + Replace loads and stores to function local variables with + operations on SSA IDs. + --scalar-replacement[=] + Replace aggregate function scope variables that are only accessed + via their elements with new function variables representing each + element. is a limit on the size of the aggragates that will + be replaced. 0 means there is no limit. The default value is + 100. + --set-spec-const-default-value ": ..." + Set the default values of the specialization constants with + : pairs specified in a double-quoted + string. : pairs must be separated by + blank spaces, and in each pair, spec id and default value must + be separated with colon ':' without any blank spaces in between. + e.g.: --set-spec-const-default-value "1:100 2:400" + --simplify-instructions + Will simplify all instructions in the function as much as + possible. + --skip-validation + Will not validate the SPIR-V before optimizing. If the SPIR-V + is invalid, the optimizer may fail or generate incorrect code. + This options should be used rarely, and with caution. + --strength-reduction + Replaces instructions with equivalent and less expensive ones. + --strip-debug + Remove all debug instructions. + --strip-reflect + Remove all reflection information. For now, this covers + reflection information defined by SPV_GOOGLE_hlsl_functionality1. + --time-report + Print the resource utilization of each pass (e.g., CPU time, + RSS) to standard error output. Currently it supports only Unix + systems. This option is the same as -ftime-report in GCC. It + prints CPU/WALL/USR/SYS time (and RSS if possible), but note that + USR/SYS time are returned by getrusage() and can have a small + error. + --vector-dce + This pass looks for components of vectors that are unused, and + removes them from the vector. Note this would still leave around + lots of dead code that a pass of ADCE will be able to remove. + --workaround-1209 + Rewrites instructions for which there are known driver bugs to + avoid triggering those bugs. + Current workarounds: Avoid OpUnreachable in loops. + --unify-const + Remove the duplicated constants. + -h, --help + Print this help. + --version + Display optimizer version information. +)", + program, program, GetLegalizationPasses().c_str(), + GetOptimizationPasses().c_str(), GetSizePasses().c_str()); +} + +// Reads command-line flags the file specified in |oconfig_flag|. This string +// is assumed to have the form "-Oconfig=FILENAME". This function parses the +// string and extracts the file name after the '=' sign. +// +// Flags found in |FILENAME| are pushed at the end of the vector |file_flags|. +// +// This function returns true on success, false on failure. +bool ReadFlagsFromFile(const char* oconfig_flag, + std::vector* file_flags) { + const char* fname = strchr(oconfig_flag, '='); + if (fname == nullptr || fname[0] != '=') { + spvtools::Errorf(opt_diagnostic, nullptr, {}, "Invalid -Oconfig flag %s", + oconfig_flag); + return false; + } + fname++; + + std::ifstream input_file; + input_file.open(fname); + if (input_file.fail()) { + spvtools::Errorf(opt_diagnostic, nullptr, {}, "Could not open file '%s'", + fname); + return false; + } + + std::string line; + while (std::getline(input_file, line)) { + // Ignore empty lines and lines starting with the comment marker '#'. + if (line.length() == 0 || line[0] == '#') { + continue; + } + + // Tokenize the line. Add all found tokens to the list of found flags. This + // mimics the way the shell will parse whitespace on the command line. NOTE: + // This does not support quoting and it is not intended to. + std::istringstream iss(line); + while (!iss.eof()) { + std::string flag; + iss >> flag; + file_flags->push_back(flag); + } + } + + return true; +} + +OptStatus ParseFlags(int argc, const char** argv, + spvtools::Optimizer* optimizer, const char** in_file, + const char** out_file, spvtools::ValidatorOptions* options, + bool* skip_validator); + +// Parses and handles the -Oconfig flag. |prog_name| contains the name of +// the spirv-opt binary (used to build a new argv vector for the recursive +// invocation to ParseFlags). |opt_flag| contains the -Oconfig=FILENAME flag. +// |optimizer|, |in_file| and |out_file| are as in ParseFlags. +// +// This returns the same OptStatus instance returned by ParseFlags. +OptStatus ParseOconfigFlag(const char* prog_name, const char* opt_flag, + spvtools::Optimizer* optimizer, const char** in_file, + const char** out_file) { + std::vector flags; + flags.push_back(prog_name); + + std::vector file_flags; + if (!ReadFlagsFromFile(opt_flag, &file_flags)) { + spvtools::Error(opt_diagnostic, nullptr, {}, + "Could not read optimizer flags from configuration file"); + return {OPT_STOP, 1}; + } + flags.insert(flags.end(), file_flags.begin(), file_flags.end()); + + const char** new_argv = new const char*[flags.size()]; + for (size_t i = 0; i < flags.size(); i++) { + if (flags[i].find("-Oconfig=") != std::string::npos) { + spvtools::Error( + opt_diagnostic, nullptr, {}, + "Flag -Oconfig= may not be used inside the configuration file"); + return {OPT_STOP, 1}; + } + new_argv[i] = flags[i].c_str(); + } + + bool skip_validator = false; + return ParseFlags(static_cast(flags.size()), new_argv, optimizer, + in_file, out_file, nullptr, &skip_validator); +} + +// Canonicalize the flag in |argv[argi]| of the form '--pass arg' into +// '--pass=arg'. The optimizer only accepts arguments to pass names that use the +// form '--pass_name=arg'. Since spirv-opt also accepts the other form, this +// function makes the necessary conversion. +// +// Pass flags that require additional arguments should be handled here. Note +// that additional arguments should be given as a single string. If the flag +// requires more than one argument, the pass creator in +// Optimizer::GetPassFromFlag() should parse it accordingly (e.g., see the +// handler for --set-spec-const-default-value). +// +// If the argument requests one of the passes that need an additional argument, +// |argi| is modified to point past the current argument, and the string +// "argv[argi]=argv[argi + 1]" is returned. Otherwise, |argi| is unmodified and +// the string "|argv[argi]|" is returned. +std::string CanonicalizeFlag(const char** argv, int argc, int* argi) { + const char* cur_arg = argv[*argi]; + const char* next_arg = (*argi + 1 < argc) ? argv[*argi + 1] : nullptr; + std::ostringstream canonical_arg; + canonical_arg << cur_arg; + + // NOTE: DO NOT ADD NEW FLAGS HERE. + // + // These flags are supported for backwards compatibility. When adding new + // passes that need extra arguments in its command-line flag, please make them + // use the syntax "--pass_name[=pass_arg]. + if (0 == strcmp(cur_arg, "--set-spec-const-default-value") || + 0 == strcmp(cur_arg, "--loop-fission") || + 0 == strcmp(cur_arg, "--loop-fusion") || + 0 == strcmp(cur_arg, "--loop-unroll-partial") || + 0 == strcmp(cur_arg, "--loop-peeling-threshold")) { + if (next_arg) { + canonical_arg << "=" << next_arg; + ++(*argi); + } + } + + return canonical_arg.str(); +} + +// the number of command-line flags. |argv| points to an array of strings +// holding the flags. |optimizer| is the Optimizer instance used to optimize the +// program. +// +// On return, this function stores the name of the input program in |in_file|. +// The name of the output file in |out_file|. The return value indicates whether +// optimization should continue and a status code indicating an error or +// success. +OptStatus ParseFlags(int argc, const char** argv, + spvtools::Optimizer* optimizer, const char** in_file, + const char** out_file, spvtools::ValidatorOptions* options, + bool* skip_validator) { + std::vector pass_flags; + for (int argi = 1; argi < argc; ++argi) { + const char* cur_arg = argv[argi]; + if ('-' == cur_arg[0]) { + if (0 == strcmp(cur_arg, "--version")) { + spvtools::Logf(opt_diagnostic, SPV_MSG_INFO, nullptr, {}, "%s\n", + spvSoftwareVersionDetailsString()); + return {OPT_STOP, 0}; + } else if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { + PrintUsage(argv[0]); + return {OPT_STOP, 0}; + } else if (0 == strcmp(cur_arg, "-o")) { + if (!*out_file && argi + 1 < argc) { + *out_file = argv[++argi]; + } else { + PrintUsage(argv[0]); + return {OPT_STOP, 1}; + } + } else if ('\0' == cur_arg[1]) { + // Setting a filename of "-" to indicate stdin. + if (!*in_file) { + *in_file = cur_arg; + } else { + spvtools::Error(opt_diagnostic, nullptr, {}, + "More than one input file specified"); + return {OPT_STOP, 1}; + } + } else if (0 == strncmp(cur_arg, "-Oconfig=", sizeof("-Oconfig=") - 1)) { + OptStatus status = + ParseOconfigFlag(argv[0], cur_arg, optimizer, in_file, out_file); + if (status.action != OPT_CONTINUE) { + return status; + } + } else if (0 == strcmp(cur_arg, "--skip-validation")) { + *skip_validator = true; + } else if (0 == strcmp(cur_arg, "--print-all")) { + optimizer->SetPrintAll(&std::cerr); + } else if (0 == strcmp(cur_arg, "--time-report")) { + optimizer->SetTimeReport(&std::cerr); + } else if (0 == strcmp(cur_arg, "--relax-struct-store")) { + options->SetRelaxStructStore(true); + } else { + // Some passes used to accept the form '--pass arg', canonicalize them + // to '--pass=arg'. + pass_flags.push_back(CanonicalizeFlag(argv, argc, &argi)); + + // If we were requested to legalize SPIR-V generated from the HLSL + // front-end, skip validation. + if (0 == strcmp(cur_arg, "--legalize-hlsl")) { + options->SetRelaxLogicalPointer(true); + } + } + } else { + if (!*in_file) { + *in_file = cur_arg; + } else { + spvtools::Error(opt_diagnostic, nullptr, {}, + "More than one input file specified"); + return {OPT_STOP, 1}; + } + } + } + + if (!optimizer->RegisterPassesFromFlags(pass_flags)) { + return {OPT_STOP, 1}; + } + + return {OPT_CONTINUE, 0}; +} + +} // namespace + +int main(int argc, const char** argv) { + const char* in_file = nullptr; + const char* out_file = nullptr; + bool skip_validator = false; + + spv_target_env target_env = kDefaultEnvironment; + spvtools::ValidatorOptions options; + + spvtools::Optimizer optimizer(target_env); + optimizer.SetMessageConsumer(spvtools::utils::CLIMessageConsumer); + + OptStatus status = ParseFlags(argc, argv, &optimizer, &in_file, &out_file, + &options, &skip_validator); + + if (status.action == OPT_STOP) { + return status.code; + } + + if (out_file == nullptr) { + spvtools::Error(opt_diagnostic, nullptr, {}, "-o required"); + return 1; + } + + std::vector binary; + if (!ReadFile(in_file, "rb", &binary)) { + return 1; + } + + // By using the same vector as input and output, we save time in the case + // that there was no change. + bool ok = optimizer.Run(binary.data(), binary.size(), &binary, options, + skip_validator); + + if (!WriteFile(out_file, "wb", binary.data(), binary.size())) { + return 1; + } + + return ok ? 0 : 1; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/spirv_stats.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/spirv_stats.cpp new file mode 100644 index 00000000000..7751c64024a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/spirv_stats.cpp @@ -0,0 +1,165 @@ +// Copyright (c) 2017 Google 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. + +#include "tools/stats/spirv_stats.h" + +#include + +#include +#include +#include + +#include "source/diagnostic.h" +#include "source/enum_string_mapping.h" +#include "source/extensions.h" +#include "source/id_descriptor.h" +#include "source/instruction.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/val/instruction.h" +#include "source/val/validate.h" +#include "source/val/validation_state.h" +#include "spirv-tools/libspirv.h" + +namespace spvtools { +namespace stats { +namespace { + +// Helper class for stats aggregation. Receives as in/out parameter. +// Constructs ValidationState and updates it by running validator for each +// instruction. +class StatsAggregator { + public: + StatsAggregator(SpirvStats* in_out_stats, const val::ValidationState_t* state) + : stats_(in_out_stats), vstate_(state) {} + + // Processes the instructions to collect stats. + void aggregate() { + const auto& instructions = vstate_->ordered_instructions(); + + ++stats_->version_hist[vstate_->version()]; + ++stats_->generator_hist[vstate_->generator()]; + + for (size_t i = 0; i < instructions.size(); ++i) { + const auto& inst = instructions[i]; + + ProcessOpcode(&inst, i); + ProcessCapability(&inst); + ProcessExtension(&inst); + ProcessConstant(&inst); + } + } + + // Collects OpCapability statistics. + void ProcessCapability(const val::Instruction* inst) { + if (inst->opcode() != SpvOpCapability) return; + const uint32_t capability = inst->word(inst->operands()[0].offset); + ++stats_->capability_hist[capability]; + } + + // Collects OpExtension statistics. + void ProcessExtension(const val::Instruction* inst) { + if (inst->opcode() != SpvOpExtension) return; + const std::string extension = GetExtensionString(&inst->c_inst()); + ++stats_->extension_hist[extension]; + } + + // Collects OpCode statistics. + void ProcessOpcode(const val::Instruction* inst, size_t idx) { + const SpvOp opcode = inst->opcode(); + ++stats_->opcode_hist[opcode]; + + if (idx == 0) return; + + --idx; + + const auto& instructions = vstate_->ordered_instructions(); + + auto step_it = stats_->opcode_markov_hist.begin(); + for (; step_it != stats_->opcode_markov_hist.end(); --idx, ++step_it) { + auto& hist = (*step_it)[instructions[idx].opcode()]; + ++hist[opcode]; + + if (idx == 0) break; + } + } + + // Collects OpConstant statistics. + void ProcessConstant(const val::Instruction* inst) { + if (inst->opcode() != SpvOpConstant) return; + + const uint32_t type_id = inst->GetOperandAs(0); + const auto type_decl_it = vstate_->all_definitions().find(type_id); + assert(type_decl_it != vstate_->all_definitions().end()); + + const val::Instruction& type_decl_inst = *type_decl_it->second; + const SpvOp type_op = type_decl_inst.opcode(); + if (type_op == SpvOpTypeInt) { + const uint32_t bit_width = type_decl_inst.GetOperandAs(1); + const uint32_t is_signed = type_decl_inst.GetOperandAs(2); + assert(is_signed == 0 || is_signed == 1); + if (bit_width == 16) { + if (is_signed) + ++stats_->s16_constant_hist[inst->GetOperandAs(2)]; + else + ++stats_->u16_constant_hist[inst->GetOperandAs(2)]; + } else if (bit_width == 32) { + if (is_signed) + ++stats_->s32_constant_hist[inst->GetOperandAs(2)]; + else + ++stats_->u32_constant_hist[inst->GetOperandAs(2)]; + } else if (bit_width == 64) { + if (is_signed) + ++stats_->s64_constant_hist[inst->GetOperandAs(2)]; + else + ++stats_->u64_constant_hist[inst->GetOperandAs(2)]; + } else { + assert(false && "TypeInt bit width is not 16, 32 or 64"); + } + } else if (type_op == SpvOpTypeFloat) { + const uint32_t bit_width = type_decl_inst.GetOperandAs(1); + if (bit_width == 32) { + ++stats_->f32_constant_hist[inst->GetOperandAs(2)]; + } else if (bit_width == 64) { + ++stats_->f64_constant_hist[inst->GetOperandAs(2)]; + } else { + assert(bit_width == 16); + } + } + } + + private: + SpirvStats* stats_; + const val::ValidationState_t* vstate_; + IdDescriptorCollection id_descriptors_; +}; + +} // namespace + +spv_result_t AggregateStats(const spv_context_t& context, const uint32_t* words, + const size_t num_words, spv_diagnostic* pDiagnostic, + SpirvStats* stats) { + std::unique_ptr vstate; + spv_validator_options_t options; + spv_result_t result = ValidateBinaryAndKeepValidationState( + &context, &options, words, num_words, pDiagnostic, &vstate); + if (result != SPV_SUCCESS) return result; + + StatsAggregator stats_aggregator(stats, vstate.get()); + stats_aggregator.aggregate(); + return SPV_SUCCESS; +} + +} // namespace stats +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/spirv_stats.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/spirv_stats.h new file mode 100644 index 00000000000..16e720fe311 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/spirv_stats.h @@ -0,0 +1,93 @@ +// Copyright (c) 2017 Google 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. + +#ifndef TOOLS_STATS_SPIRV_STATS_H_ +#define TOOLS_STATS_SPIRV_STATS_H_ + +#include +#include +#include +#include +#include + +#include "spirv-tools/libspirv.hpp" + +namespace spvtools { +namespace stats { + +struct SpirvStats { + // Version histogram, version_word -> count. + std::unordered_map version_hist; + + // Generator histogram, generator_word -> count. + std::unordered_map generator_hist; + + // Capability histogram, SpvCapabilityXXX -> count. + std::unordered_map capability_hist; + + // Extension histogram, extension_string -> count. + std::unordered_map extension_hist; + + // Opcode histogram, SpvOpXXX -> count. + std::unordered_map opcode_hist; + + // OpConstant u16 histogram, value -> count. + std::unordered_map u16_constant_hist; + + // OpConstant u32 histogram, value -> count. + std::unordered_map u32_constant_hist; + + // OpConstant u64 histogram, value -> count. + std::unordered_map u64_constant_hist; + + // OpConstant s16 histogram, value -> count. + std::unordered_map s16_constant_hist; + + // OpConstant s32 histogram, value -> count. + std::unordered_map s32_constant_hist; + + // OpConstant s64 histogram, value -> count. + std::unordered_map s64_constant_hist; + + // OpConstant f32 histogram, value -> count. + std::unordered_map f32_constant_hist; + + // OpConstant f64 histogram, value -> count. + std::unordered_map f64_constant_hist; + + // Used to collect statistics on opcodes triggering other opcodes. + // Container scheme: gap between instructions -> cue opcode -> later opcode + // -> count. + // For example opcode_markov_hist[2][OpFMul][OpFAdd] corresponds to + // the number of times an OpMul appears, followed by 2 other instructions, + // followed by OpFAdd. + // opcode_markov_hist[0][OpFMul][OpFAdd] corresponds to how many times + // OpFMul appears, directly followed by OpFAdd. + // The size of the outer std::vector also serves as an input parameter, + // determining how many steps will be collected. + // I.e. do opcode_markov_hist.resize(1) to collect data for one step only. + std::vector< + std::unordered_map>> + opcode_markov_hist; +}; + +// Aggregates existing |stats| with new stats extracted from |binary|. +spv_result_t AggregateStats(const spv_context_t& context, const uint32_t* words, + const size_t num_words, spv_diagnostic* pDiagnostic, + SpirvStats* stats); + +} // namespace stats +} // namespace spvtools + +#endif // TOOLS_STATS_SPIRV_STATS_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats.cpp new file mode 100644 index 00000000000..256ec1e1b9e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats.cpp @@ -0,0 +1,180 @@ +// Copyright (c) 2017 Google 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. + +#include +#include +#include +#include +#include +#include + +#include "source/table.h" +#include "spirv-tools/libspirv.h" +#include "tools/io.h" +#include "tools/stats/spirv_stats.h" +#include "tools/stats/stats_analyzer.h" + +namespace { + +struct ScopedContext { + ScopedContext(spv_target_env env) : context(spvContextCreate(env)) {} + ~ScopedContext() { spvContextDestroy(context); } + spv_context context; +}; + +void PrintUsage(char* argv0) { + printf( + R"(%s - Collect statistics from one or more SPIR-V binary file(s). + +USAGE: %s [options] [] + +TIP: In order to collect statistics from all .spv files under current dir use +find . -name "*.spv" -print0 | xargs -0 -s 2000000 %s + +Options: + -h, --help + Print this help. + + -v, --verbose + Print additional info to stderr. +)", + argv0, argv0, argv0); +} + +void DiagnosticsMessageHandler(spv_message_level_t level, const char*, + const spv_position_t& position, + const char* message) { + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: " << position.index << ": " << message << std::endl; + break; + case SPV_MSG_WARNING: + std::cout << "warning: " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_INFO: + std::cout << "info: " << position.index << ": " << message << std::endl; + break; + default: + break; + } +} + +} // namespace + +int main(int argc, char** argv) { + bool continue_processing = true; + int return_code = 0; + + bool expect_output_path = false; + bool verbose = false; + + std::vector paths; + const char* output_path = nullptr; + + for (int argi = 1; continue_processing && argi < argc; ++argi) { + const char* cur_arg = argv[argi]; + if ('-' == cur_arg[0]) { + if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { + PrintUsage(argv[0]); + continue_processing = false; + return_code = 0; + } else if (0 == strcmp(cur_arg, "--verbose") || + 0 == strcmp(cur_arg, "-v")) { + verbose = true; + } else if (0 == strcmp(cur_arg, "--output") || + 0 == strcmp(cur_arg, "-o")) { + expect_output_path = true; + } else { + PrintUsage(argv[0]); + continue_processing = false; + return_code = 1; + } + } else { + if (expect_output_path) { + output_path = cur_arg; + expect_output_path = false; + } else { + paths.push_back(cur_arg); + } + } + } + + // Exit if command line parsing was not successful. + if (!continue_processing) { + return return_code; + } + + std::cerr << "Processing " << paths.size() << " files..." << std::endl; + + ScopedContext ctx(SPV_ENV_UNIVERSAL_1_1); + spvtools::SetContextMessageConsumer(ctx.context, DiagnosticsMessageHandler); + + spvtools::stats::SpirvStats stats; + stats.opcode_markov_hist.resize(1); + + for (size_t index = 0; index < paths.size(); ++index) { + const size_t kMilestonePeriod = 1000; + if (verbose) { + if (index % kMilestonePeriod == kMilestonePeriod - 1) + std::cerr << "Processed " << index + 1 << " files..." << std::endl; + } + + const char* path = paths[index]; + std::vector contents; + if (!ReadFile(path, "rb", &contents)) return 1; + + if (SPV_SUCCESS != + spvtools::stats::AggregateStats(*ctx.context, contents.data(), + contents.size(), nullptr, &stats)) { + std::cerr << "error: Failed to aggregate stats for " << path << std::endl; + return 1; + } + } + + spvtools::stats::StatsAnalyzer analyzer(stats); + + std::ofstream fout; + if (output_path) { + fout.open(output_path); + if (!fout.is_open()) { + std::cerr << "error: Failed to open " << output_path << std::endl; + return 1; + } + } + + std::ostream& out = fout.is_open() ? fout : std::cout; + out << std::endl; + analyzer.WriteVersion(out); + analyzer.WriteGenerator(out); + + out << std::endl; + analyzer.WriteCapability(out); + + out << std::endl; + analyzer.WriteExtension(out); + + out << std::endl; + analyzer.WriteOpcode(out); + + out << std::endl; + analyzer.WriteOpcodeMarkov(out); + + out << std::endl; + analyzer.WriteConstantLiterals(out); + + return 0; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats_analyzer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats_analyzer.cpp new file mode 100644 index 00000000000..6d4cabbf6d9 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats_analyzer.cpp @@ -0,0 +1,235 @@ +// Copyright (c) 2017 Google 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. + +#include "tools/stats/stats_analyzer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source/comp/markv_model.h" +#include "source/enum_string_mapping.h" +#include "source/latest_version_spirv_header.h" +#include "source/opcode.h" +#include "source/operand.h" +#include "source/spirv_constant.h" + +namespace spvtools { +namespace stats { +namespace { + +// Signals that the value is not in the coding scheme and a fallback method +// needs to be used. +const uint64_t kMarkvNoneOfTheAbove = + comp::MarkvModel::GetMarkvNoneOfTheAbove(); + +std::string GetVersionString(uint32_t word) { + std::stringstream ss; + ss << "Version " << SPV_SPIRV_VERSION_MAJOR_PART(word) << "." + << SPV_SPIRV_VERSION_MINOR_PART(word); + return ss.str(); +} + +std::string GetGeneratorString(uint32_t word) { + return spvGeneratorStr(SPV_GENERATOR_TOOL_PART(word)); +} + +std::string GetOpcodeString(uint32_t word) { + return spvOpcodeString(static_cast(word)); +} + +std::string GetCapabilityString(uint32_t word) { + return CapabilityToString(static_cast(word)); +} + +template +std::string KeyIsLabel(T key) { + std::stringstream ss; + ss << key; + return ss.str(); +} + +template +std::unordered_map GetRecall( + const std::unordered_map& hist, uint64_t total) { + std::unordered_map freq; + for (const auto& pair : hist) { + const double frequency = + static_cast(pair.second) / static_cast(total); + freq.emplace(pair.first, frequency); + } + return freq; +} + +template +std::unordered_map GetPrevalence( + const std::unordered_map& hist) { + uint64_t total = 0; + for (const auto& pair : hist) { + total += pair.second; + } + + return GetRecall(hist, total); +} + +// Writes |freq| to |out| sorted by frequency in the following format: +// LABEL3 70% +// LABEL1 20% +// LABEL2 10% +// |label_from_key| is used to convert |Key| to label. +template +void WriteFreq(std::ostream& out, const std::unordered_map& freq, + std::string (*label_from_key)(Key)) { + std::vector> sorted_freq(freq.begin(), freq.end()); + std::sort(sorted_freq.begin(), sorted_freq.end(), + [](const std::pair& left, + const std::pair& right) { + return left.second > right.second; + }); + + for (const auto& pair : sorted_freq) { + if (pair.second < 0.001) break; + out << label_from_key(pair.first) << " " << pair.second * 100.0 << "%" + << std::endl; + } +} + +} // namespace + +StatsAnalyzer::StatsAnalyzer(const SpirvStats& stats) : stats_(stats) { + num_modules_ = 0; + for (const auto& pair : stats_.version_hist) { + num_modules_ += pair.second; + } + + version_freq_ = GetRecall(stats_.version_hist, num_modules_); + generator_freq_ = GetRecall(stats_.generator_hist, num_modules_); + capability_freq_ = GetRecall(stats_.capability_hist, num_modules_); + extension_freq_ = GetRecall(stats_.extension_hist, num_modules_); + opcode_freq_ = GetPrevalence(stats_.opcode_hist); +} + +void StatsAnalyzer::WriteVersion(std::ostream& out) { + WriteFreq(out, version_freq_, GetVersionString); +} + +void StatsAnalyzer::WriteGenerator(std::ostream& out) { + WriteFreq(out, generator_freq_, GetGeneratorString); +} + +void StatsAnalyzer::WriteCapability(std::ostream& out) { + WriteFreq(out, capability_freq_, GetCapabilityString); +} + +void StatsAnalyzer::WriteExtension(std::ostream& out) { + WriteFreq(out, extension_freq_, KeyIsLabel); +} + +void StatsAnalyzer::WriteOpcode(std::ostream& out) { + out << "Total unique opcodes used: " << opcode_freq_.size() << std::endl; + WriteFreq(out, opcode_freq_, GetOpcodeString); +} + +void StatsAnalyzer::WriteConstantLiterals(std::ostream& out) { + out << "Constant literals" << std::endl; + + out << "Float 32" << std::endl; + WriteFreq(out, GetPrevalence(stats_.f32_constant_hist), KeyIsLabel); + + out << std::endl << "Float 64" << std::endl; + WriteFreq(out, GetPrevalence(stats_.f64_constant_hist), KeyIsLabel); + + out << std::endl << "Unsigned int 16" << std::endl; + WriteFreq(out, GetPrevalence(stats_.u16_constant_hist), KeyIsLabel); + + out << std::endl << "Signed int 16" << std::endl; + WriteFreq(out, GetPrevalence(stats_.s16_constant_hist), KeyIsLabel); + + out << std::endl << "Unsigned int 32" << std::endl; + WriteFreq(out, GetPrevalence(stats_.u32_constant_hist), KeyIsLabel); + + out << std::endl << "Signed int 32" << std::endl; + WriteFreq(out, GetPrevalence(stats_.s32_constant_hist), KeyIsLabel); + + out << std::endl << "Unsigned int 64" << std::endl; + WriteFreq(out, GetPrevalence(stats_.u64_constant_hist), KeyIsLabel); + + out << std::endl << "Signed int 64" << std::endl; + WriteFreq(out, GetPrevalence(stats_.s64_constant_hist), KeyIsLabel); +} + +void StatsAnalyzer::WriteOpcodeMarkov(std::ostream& out) { + if (stats_.opcode_markov_hist.empty()) return; + + const std::unordered_map>& + cue_to_hist = stats_.opcode_markov_hist[0]; + + // Sort by prevalence of the opcodes in opcode_freq_ (descending). + std::vector>> + sorted_cue_to_hist(cue_to_hist.begin(), cue_to_hist.end()); + std::sort( + sorted_cue_to_hist.begin(), sorted_cue_to_hist.end(), + [this](const std::pair>& + left, + const std::pair>& + right) { + const double lf = opcode_freq_[left.first]; + const double rf = opcode_freq_[right.first]; + if (lf == rf) return right.first > left.first; + return lf > rf; + }); + + for (const auto& kv : sorted_cue_to_hist) { + const uint32_t cue = kv.first; + const double kFrequentEnoughToAnalyze = 0.0001; + if (opcode_freq_[cue] < kFrequentEnoughToAnalyze) continue; + + const std::unordered_map& hist = kv.second; + + uint32_t total = 0; + for (const auto& pair : hist) { + total += pair.second; + } + + std::vector> sorted_hist(hist.begin(), + hist.end()); + std::sort(sorted_hist.begin(), sorted_hist.end(), + [](const std::pair& left, + const std::pair& right) { + if (left.second == right.second) + return right.first > left.first; + return left.second > right.second; + }); + + for (const auto& pair : sorted_hist) { + const double prior = opcode_freq_[pair.first]; + const double posterior = + static_cast(pair.second) / static_cast(total); + out << GetOpcodeString(cue) << " -> " << GetOpcodeString(pair.first) + << " " << posterior * 100 << "% (base rate " << prior * 100 + << "%, pair occurrences " << pair.second << ")" << std::endl; + } + } +} + +} // namespace stats +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats_analyzer.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats_analyzer.h new file mode 100644 index 00000000000..f1c37bfaa00 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/stats/stats_analyzer.h @@ -0,0 +1,58 @@ +// Copyright (c) 2017 Google 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. + +#ifndef TOOLS_STATS_STATS_ANALYZER_H_ +#define TOOLS_STATS_STATS_ANALYZER_H_ + +#include +#include + +#include "tools/stats/spirv_stats.h" + +namespace spvtools { +namespace stats { + +class StatsAnalyzer { + public: + explicit StatsAnalyzer(const SpirvStats& stats); + + // Writes respective histograms to |out|. + void WriteVersion(std::ostream& out); + void WriteGenerator(std::ostream& out); + void WriteCapability(std::ostream& out); + void WriteExtension(std::ostream& out); + void WriteOpcode(std::ostream& out); + void WriteConstantLiterals(std::ostream& out); + + // Writes first order Markov analysis to |out|. + // stats_.opcode_markov_hist needs to contain raw data for at least one + // level. + void WriteOpcodeMarkov(std::ostream& out); + + private: + const SpirvStats& stats_; + + uint32_t num_modules_; + + std::unordered_map version_freq_; + std::unordered_map generator_freq_; + std::unordered_map capability_freq_; + std::unordered_map extension_freq_; + std::unordered_map opcode_freq_; +}; + +} // namespace stats +} // namespace spvtools + +#endif // TOOLS_STATS_STATS_ANALYZER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/util/cli_consumer.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/util/cli_consumer.cpp new file mode 100644 index 00000000000..77db734e81e --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/util/cli_consumer.cpp @@ -0,0 +1,45 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 "tools/util/cli_consumer.h" + +#include + +namespace spvtools { +namespace utils { + +void CLIMessageConsumer(spv_message_level_t level, const char*, + const spv_position_t& position, const char* message) { + switch (level) { + case SPV_MSG_FATAL: + case SPV_MSG_INTERNAL_ERROR: + case SPV_MSG_ERROR: + std::cerr << "error: line " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_WARNING: + std::cout << "warning: line " << position.index << ": " << message + << std::endl; + break; + case SPV_MSG_INFO: + std::cout << "info: line " << position.index << ": " << message + << std::endl; + break; + default: + break; + } +} + +} // namespace utils +} // namespace spvtools diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/util/cli_consumer.h b/3rdparty/bgfx/3rdparty/spirv-tools/tools/util/cli_consumer.h new file mode 100644 index 00000000000..ca3d91b95ad --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/util/cli_consumer.h @@ -0,0 +1,31 @@ +// Copyright (c) 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT 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 SOURCE_UTIL_CLI_CONSUMMER_H_ +#define SOURCE_UTIL_CLI_CONSUMMER_H_ + +#include + +namespace spvtools { +namespace utils { + +// A message consumer that can be used by command line tools like spirv-opt and +// spirv-val to display messages. +void CLIMessageConsumer(spv_message_level_t level, const char*, + const spv_position_t& position, const char* message); + +} // namespace utils +} // namespace spvtools + +#endif // SOURCE_UTIL_CLI_CONSUMMER_H_ diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/tools/val/val.cpp b/3rdparty/bgfx/3rdparty/spirv-tools/tools/val/val.cpp new file mode 100644 index 00000000000..172dd121deb --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/tools/val/val.cpp @@ -0,0 +1,173 @@ +// Copyright (c) 2015-2016 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. + +#include +#include +#include +#include +#include + +#include "source/spirv_target_env.h" +#include "source/spirv_validator_options.h" +#include "spirv-tools/libspirv.hpp" +#include "tools/io.h" +#include "tools/util/cli_consumer.h" + +void print_usage(char* argv0) { + printf( + R"(%s - Validate a SPIR-V binary file. + +USAGE: %s [options] [] + +The SPIR-V binary is read from . If no file is specified, +or if the filename is "-", then the binary is read from standard input. + +NOTE: The validator is a work in progress. + +Options: + -h, --help Print this help. + --max-struct-members + --max-struct-depth + --max-local-variables + --max-global-variables + --max-switch-branches + --max-function-args + --max-control-flow-nesting-depth + --max-access-chain-indexes + --relax-logical-pointer Allow allocating an object of a pointer type and returning + a pointer value from a function in logical addressing mode + --relax-block-layout Enable VK_HR_relaxed_block_layout when checking standard + uniform/storage buffer layout + --skip-block-layout Skip checking standard uniform/storage buffer layout + --relax-struct-store Allow store from one struct type to a + different type with compatible layout and + members. + --version Display validator version information. + --target-env {vulkan1.0|vulkan1.1|opencl2.2|spv1.0|spv1.1|spv1.2|spv1.3|webgpu0} + Use Vulkan 1.0, Vulkan 1.1, OpenCL 2.2, SPIR-V 1.0, + SPIR-V 1.1, SPIR-V 1.2, SPIR-V 1.3 or WIP WebGPU validation rules. +)", + argv0, argv0); +} + +int main(int argc, char** argv) { + const char* inFile = nullptr; + spv_target_env target_env = SPV_ENV_UNIVERSAL_1_3; + spvtools::ValidatorOptions options; + bool continue_processing = true; + int return_code = 0; + + for (int argi = 1; continue_processing && argi < argc; ++argi) { + const char* cur_arg = argv[argi]; + if ('-' == cur_arg[0]) { + if (0 == strncmp(cur_arg, "--max-", 6)) { + if (argi + 1 < argc) { + spv_validator_limit limit_type; + if (spvParseUniversalLimitsOptions(cur_arg, &limit_type)) { + uint32_t limit = 0; + if (sscanf(argv[++argi], "%u", &limit)) { + options.SetUniversalLimit(limit_type, limit); + } else { + fprintf(stderr, "error: missing argument to %s\n", cur_arg); + continue_processing = false; + return_code = 1; + } + } else { + fprintf(stderr, "error: unrecognized option: %s\n", cur_arg); + continue_processing = false; + return_code = 1; + } + } else { + fprintf(stderr, "error: Missing argument to %s\n", cur_arg); + continue_processing = false; + return_code = 1; + } + } else if (0 == strcmp(cur_arg, "--version")) { + printf("%s\n", spvSoftwareVersionDetailsString()); + printf("Targets:\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n", + spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_0), + spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_1), + spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_2), + spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_3), + spvTargetEnvDescription(SPV_ENV_OPENCL_2_2), + spvTargetEnvDescription(SPV_ENV_VULKAN_1_0), + spvTargetEnvDescription(SPV_ENV_VULKAN_1_1), + spvTargetEnvDescription(SPV_ENV_WEBGPU_0)); + continue_processing = false; + return_code = 0; + } else if (0 == strcmp(cur_arg, "--help") || 0 == strcmp(cur_arg, "-h")) { + print_usage(argv[0]); + continue_processing = false; + return_code = 0; + } else if (0 == strcmp(cur_arg, "--target-env")) { + if (argi + 1 < argc) { + const auto env_str = argv[++argi]; + if (!spvParseTargetEnv(env_str, &target_env)) { + fprintf(stderr, "error: Unrecognized target env: %s\n", env_str); + continue_processing = false; + return_code = 1; + } + } else { + fprintf(stderr, "error: Missing argument to --target-env\n"); + continue_processing = false; + return_code = 1; + } + } else if (0 == strcmp(cur_arg, "--relax-logical-pointer")) { + options.SetRelaxLogicalPointer(true); + } else if (0 == strcmp(cur_arg, "--relax-block-layout")) { + options.SetRelaxBlockLayout(true); + } else if (0 == strcmp(cur_arg, "--skip-block-layout")) { + options.SetSkipBlockLayout(true); + } else if (0 == strcmp(cur_arg, "--relax-struct-store")) { + options.SetRelaxStructStore(true); + } else if (0 == cur_arg[1]) { + // Setting a filename of "-" to indicate stdin. + if (!inFile) { + inFile = cur_arg; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + continue_processing = false; + return_code = 1; + } + } else { + print_usage(argv[0]); + continue_processing = false; + return_code = 1; + } + } else { + if (!inFile) { + inFile = cur_arg; + } else { + fprintf(stderr, "error: More than one input file specified\n"); + continue_processing = false; + return_code = 1; + } + } + } + + // Exit if command line parsing was not successful. + if (!continue_processing) { + return return_code; + } + + std::vector contents; + if (!ReadFile(inFile, "rb", &contents)) return 1; + + spvtools::SpirvTools tools(target_env); + tools.SetMessageConsumer(spvtools::utils::CLIMessageConsumer); + + bool succeed = tools.Validate(contents.data(), contents.size(), options); + + return !succeed; +} diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_code_format.sh b/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_code_format.sh new file mode 100644 index 00000000000..a6a58796a7d --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_code_format.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright (c) 2017 Google 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. +# +# Script to determine if source code in Pull Request is properly formatted. +# Exits with non 0 exit code if formatting is needed. +# +# This script assumes to be invoked at the project root directory. + +FILES_TO_CHECK=$(git diff --name-only master | grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp)$") + +if [ -z "${FILES_TO_CHECK}" ]; then + echo "No source code to check for formatting." + exit 0 +fi + +FORMAT_DIFF=$(git diff -U0 master -- ${FILES_TO_CHECK} | python ./utils/clang-format-diff.py -p1 -style=file) + +if [ -z "${FORMAT_DIFF}" ]; then + echo "All source code in PR properly formatted." + exit 0 +else + echo "Found formatting errors!" + echo "${FORMAT_DIFF}" + exit 1 +fi diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_copyright.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_copyright.py new file mode 100644 index 00000000000..85ea12891fa --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_copyright.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python +# Copyright (c) 2016 Google 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. +"""Checks for copyright notices in all the files that need them under the +current directory. Optionally insert them. When inserting, replaces +an MIT or Khronos free use license with Apache 2. +""" +from __future__ import print_function + +import argparse +import fileinput +import fnmatch +import inspect +import os +import re +import sys + +# List of designated copyright owners. +AUTHORS = ['The Khronos Group Inc.', + 'LunarG Inc.', + 'Google Inc.', + 'Google LLC', + 'Pierre Moreau'] +CURRENT_YEAR='2018' + +YEARS = '(2014-2016|2015-2016|2016|2016-2017|2017|2018)' +COPYRIGHT_RE = re.compile( + 'Copyright \(c\) {} ({})'.format(YEARS, '|'.join(AUTHORS))) + +MIT_BEGIN_RE = re.compile('Permission is hereby granted, ' + 'free of charge, to any person obtaining a') +MIT_END_RE = re.compile('MATERIALS OR THE USE OR OTHER DEALINGS IN ' + 'THE MATERIALS.') +APACHE2_BEGIN_RE = re.compile('Licensed under the Apache License, ' + 'Version 2.0 \(the "License"\);') +APACHE2_END_RE = re.compile('limitations under the License.') + +LICENSED = """Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.""" +LICENSED_LEN = 10 # Number of lines in LICENSED + + +def find(top, filename_glob, skip_glob_dir_list, skip_glob_files_list): + """Returns files in the tree rooted at top matching filename_glob but not + in directories matching skip_glob_dir_list nor files matching + skip_glob_dir_list.""" + + file_list = [] + for path, dirs, files in os.walk(top): + for glob in skip_glob_dir_list: + for match in fnmatch.filter(dirs, glob): + dirs.remove(match) + for filename in fnmatch.filter(files, filename_glob): + full_file = os.path.join(path, filename) + if full_file not in skip_glob_files_list: + file_list.append(full_file) + return file_list + + +def filtered_descendants(glob): + """Returns glob-matching filenames under the current directory, but skips + some irrelevant paths.""" + return find('.', glob, ['third_party', 'external', 'CompilerIdCXX', + 'build*', 'out*'], ['./utils/clang-format-diff.py']) + + +def skip(line): + """Returns true if line is all whitespace or shebang.""" + stripped = line.lstrip() + return stripped == '' or stripped.startswith('#!') + + +def comment(text, prefix): + """Returns commented-out text. + + Each line of text will be prefixed by prefix and a space character. Any + trailing whitespace will be trimmed. + """ + accum = ['{} {}'.format(prefix, line).rstrip() for line in text.split('\n')] + return '\n'.join(accum) + + +def insert_copyright(author, glob, comment_prefix): + """Finds all glob-matching files under the current directory and inserts the + copyright message, and license notice. An MIT license or Khronos free + use license (modified MIT) is replaced with an Apache 2 license. + + The copyright message goes into the first non-whitespace, non-shebang line + in a file. The license notice follows it. Both are prefixed on each line + by comment_prefix and a space. + """ + + copyright = comment('Copyright (c) {} {}'.format(CURRENT_YEAR, author), + comment_prefix) + '\n\n' + licensed = comment(LICENSED, comment_prefix) + '\n\n' + for file in filtered_descendants(glob): + # Parsing states are: + # 0 Initial: Have not seen a copyright declaration. + # 1 Seen a copyright line and no other interesting lines + # 2 In the middle of an MIT or Khronos free use license + # 9 Exited any of the above + state = 0 + update_file = False + for line in fileinput.input(file, inplace=1): + emit = True + if state is 0: + if COPYRIGHT_RE.search(line): + state = 1 + elif skip(line): + pass + else: + # Didn't see a copyright. Inject copyright and license. + sys.stdout.write(copyright) + sys.stdout.write(licensed) + # Assume there isn't a previous license notice. + state = 1 + elif state is 1: + if MIT_BEGIN_RE.search(line): + state = 2 + emit = False + elif APACHE2_BEGIN_RE.search(line): + # Assume an Apache license is preceded by a copyright + # notice. So just emit it like the rest of the file. + state = 9 + elif state is 2: + # Replace the MIT license with Apache 2 + emit = False + if MIT_END_RE.search(line): + state = 9 + sys.stdout.write(licensed) + if emit: + sys.stdout.write(line) + + +def alert_if_no_copyright(glob, comment_prefix): + """Prints names of all files missing either a copyright or Apache 2 license. + + Finds all glob-matching files under the current directory and checks if they + contain the copyright message and license notice. Prints the names of all the + files that don't meet both criteria. + + Returns the total number of file names printed. + """ + printed_count = 0 + for file in filtered_descendants(glob): + has_copyright = False + has_apache2 = False + line_num = 0 + apache_expected_end = 0 + with open(file) as contents: + for line in contents: + line_num += 1 + if COPYRIGHT_RE.search(line): + has_copyright = True + if APACHE2_BEGIN_RE.search(line): + apache_expected_end = line_num + LICENSED_LEN + if (line_num is apache_expected_end) and APACHE2_END_RE.search(line): + has_apache2 = True + if not (has_copyright and has_apache2): + message = file + if not has_copyright: + message += ' has no copyright' + if not has_apache2: + message += ' has no Apache 2 license notice' + print(message) + printed_count += 1 + return printed_count + + +class ArgParser(argparse.ArgumentParser): + def __init__(self): + super(ArgParser, self).__init__( + description=inspect.getdoc(sys.modules[__name__])) + self.add_argument('--update', dest='author', action='store', + help='For files missing a copyright notice, insert ' + 'one for the given author, and add a license ' + 'notice. The author must be in the AUTHORS ' + 'list in the script.') + + +def main(): + glob_comment_pairs = [('*.h', '//'), ('*.hpp', '//'), ('*.sh', '#'), + ('*.py', '#'), ('*.cpp', '//'), + ('CMakeLists.txt', '#')] + argparser = ArgParser() + args = argparser.parse_args() + + if args.author: + if args.author not in AUTHORS: + print('error: --update argument must be in the AUTHORS list in ' + 'check_copyright.py: {}'.format(AUTHORS)) + sys.exit(1) + for pair in glob_comment_pairs: + insert_copyright(args.author, *pair) + sys.exit(0) + else: + count = sum([alert_if_no_copyright(*p) for p in glob_comment_pairs]) + sys.exit(count > 0) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_symbol_exports.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_symbol_exports.py new file mode 100644 index 00000000000..c9c0364df09 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/check_symbol_exports.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python +# Copyright (c) 2017 Google 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. +"""Checks names of global exports from a library.""" + +from __future__ import print_function + +import os.path +import re +import subprocess +import sys + + +PROG = 'check_symbol_exports' + + +def command_output(cmd, directory): + """Runs a command in a directory and returns its standard output stream. + + Captures the standard error stream. + + Raises a RuntimeError if the command fails to launch or otherwise fails. + """ + p = subprocess.Popen(cmd, + cwd=directory, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True) + (stdout, _) = p.communicate() + if p.returncode != 0: + raise RuntimeError('Failed to run %s in %s' % (cmd, directory)) + return stdout + + +def check_library(library): + """Scans the given library file for global exports. If all such + exports are namespaced or begin with spv (in either C or C++ styles) + then return 0. Otherwise emit a message and return 1.""" + + # The pattern for a global symbol record + symbol_pattern = re.compile(r'^[0-aA-Fa-f]+ g *F \.text.*[0-9A-Fa-f]+ +(.*)') + + # Ok patterns are as follows, assuming Itanium name mangling: + # spv[A-Z] : extern "C" symbol starting with spv + # _ZN : something in a namespace + # _Z[0-9]+spv[A-Z_] : C++ symbol starting with spv[A-Z_] + symbol_ok_pattern = re.compile(r'^(spv[A-Z]|_ZN|_Z[0-9]+spv[A-Z_])') + seen = set() + result = 0 + for line in command_output(['objdump', '-t', library], '.').split('\n'): + match = symbol_pattern.search(line) + if match: + symbol = match.group(1) + if symbol not in seen: + seen.add(symbol) + #print("look at '{}'".format(symbol)) + if not symbol_ok_pattern.match(symbol): + print('{}: error: Unescaped exported symbol: {}'.format(PROG, symbol)) + result = 1 + return result + + +def main(): + import argparse + parser = argparse.ArgumentParser(description='Check global names exported from a library') + parser.add_argument('library', help='The static library to examine') + args = parser.parse_args() + + if not os.path.isfile(args.library): + print('{}: error: {} does not exist'.format(PROG, args.library)) + sys.exit(1) + + if os.name is 'posix': + status = check_library(args.library) + sys.exit(status) + else: + print('Passing test since not on Posix') + sys.exit(0) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/fixup_fuzz_result.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/fixup_fuzz_result.py new file mode 100644 index 00000000000..9fe54a3cc43 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/fixup_fuzz_result.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# Copyright (c) 2018 Google 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. + +import sys + +if len(sys.argv) < 1: + print("Need file to chop"); + +with open(sys.argv[1], mode='rb') as file: + file_content = file.read() + content = file_content[:len(file_content) - (len(file_content) % 4)] + sys.stdout.write(content) + diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_grammar_tables.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_grammar_tables.py new file mode 100644 index 00000000000..aabdad505e4 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_grammar_tables.py @@ -0,0 +1,749 @@ +#!/usr/bin/env python +# Copyright (c) 2016 Google 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. +"""Generates various info tables from SPIR-V JSON grammar.""" + +from __future__ import print_function + +import errno +import json +import os.path +import re + +# Prefix for all C variables generated by this script. +PYGEN_VARIABLE_PREFIX = 'pygen_variable' + +# Extensions to recognize, but which don't necessarily come from the SPIR-V +# core or KHR grammar files. Get this list from the SPIR-V registery web page. +# NOTE: Only put things on this list if it is not in those grammar files. +EXTENSIONS_FROM_SPIRV_REGISTRY_AND_NOT_FROM_GRAMMARS = """ +SPV_AMD_gcn_shader +SPV_AMD_gpu_shader_half_float +SPV_AMD_gpu_shader_int16 +SPV_AMD_shader_trinary_minmax +""" + + +def make_path_to_file(f): + """Makes all ancestor directories to the given file, if they + don't yet exist. + + Arguments: + f: The file whose ancestor directories are to be created. + """ + dir = os.path.dirname(os.path.abspath(f)) + try: + os.makedirs(dir) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(dir): + pass + else: + raise + + +def convert_min_required_version(version): + """Converts the minimal required SPIR-V version encoded in the + grammar to the symbol in SPIRV-Tools""" + if version is None: + return 'SPV_SPIRV_VERSION_WORD(1, 0)' + if version == 'None': + return '0xffffffffu' + return 'SPV_SPIRV_VERSION_WORD({})'.format(version.replace('.', ',')) + + +def compose_capability_list(caps): + """Returns a string containing a braced list of capabilities as enums. + + Arguments: + - caps: a sequence of capability names + + Returns: + a string containing the braced list of SpvCapability* enums named by caps. + """ + return "{" + ", ".join(['SpvCapability{}'.format(c) for c in caps]) + "}" + + +def get_capability_array_name(caps): + """Returns the name of the array containing all the given capabilities. + + Args: + - caps: a sequence of capability names + """ + if not caps: + return 'nullptr' + return '{}_caps_{}'.format(PYGEN_VARIABLE_PREFIX, ''.join(caps)) + + +def generate_capability_arrays(caps): + """Returns the arrays of capabilities. + + Arguments: + - caps: a sequence of sequence of capability names + """ + caps = sorted(set([tuple(c) for c in caps if c])) + arrays = [ + 'static const SpvCapability {}[] = {};'.format( + get_capability_array_name(c), compose_capability_list(c)) + for c in caps] + return '\n'.join(arrays) + + +def compose_extension_list(exts): + """Returns a string containing a braced list of extensions as enums. + + Arguments: + - exts: a sequence of extension names + + Returns: + a string containing the braced list of extensions named by exts. + """ + return "{" + ", ".join( + ['spvtools::Extension::k{}'.format(e) for e in exts]) + "}" + + +def get_extension_array_name(extensions): + """Returns the name of the array containing all the given extensions. + + Args: + - extensions: a sequence of extension names + """ + if not extensions: + return 'nullptr' + else: + return '{}_exts_{}'.format( + PYGEN_VARIABLE_PREFIX, ''.join(extensions)) + + +def generate_extension_arrays(extensions): + """Returns the arrays of extensions. + + Arguments: + - caps: a sequence of sequence of extension names + """ + extensions = sorted(set([tuple(e) for e in extensions if e])) + arrays = [ + 'static const spvtools::Extension {}[] = {};'.format( + get_extension_array_name(e), compose_extension_list(e)) + for e in extensions] + return '\n'.join(arrays) + + +def convert_operand_kind(operand_tuple): + """Returns the corresponding operand type used in spirv-tools for + the given operand kind and quantifier used in the JSON grammar. + + Arguments: + - operand_tuple: a tuple of two elements: + - operand kind: used in the JSON grammar + - quantifier: '', '?', or '*' + + Returns: + a string of the enumerant name in spv_operand_type_t + """ + kind, quantifier = operand_tuple + # The following cases are where we differ between the JSON grammar and + # spirv-tools. + if kind == 'IdResultType': + kind = 'TypeId' + elif kind == 'IdResult': + kind = 'ResultId' + elif kind == 'IdMemorySemantics' or kind == 'MemorySemantics': + kind = 'MemorySemanticsId' + elif kind == 'IdScope' or kind == 'Scope': + kind = 'ScopeId' + elif kind == 'IdRef': + kind = 'Id' + + elif kind == 'ImageOperands': + kind = 'Image' + elif kind == 'Dim': + kind = 'Dimensionality' + elif kind == 'ImageFormat': + kind = 'SamplerImageFormat' + elif kind == 'KernelEnqueueFlags': + kind = 'KernelEnqFlags' + + elif kind == 'LiteralExtInstInteger': + kind = 'ExtensionInstructionNumber' + elif kind == 'LiteralSpecConstantOpInteger': + kind = 'SpecConstantOpNumber' + elif kind == 'LiteralContextDependentNumber': + kind = 'TypedLiteralNumber' + + elif kind == 'PairLiteralIntegerIdRef': + kind = 'LiteralIntegerId' + elif kind == 'PairIdRefLiteralInteger': + kind = 'IdLiteralInteger' + elif kind == 'PairIdRefIdRef': # Used by OpPhi in the grammar + kind = 'Id' + + if kind == 'FPRoundingMode': + kind = 'FpRoundingMode' + elif kind == 'FPFastMathMode': + kind = 'FpFastMathMode' + + if quantifier == '?': + kind = 'Optional{}'.format(kind) + elif quantifier == '*': + kind = 'Variable{}'.format(kind) + + return 'SPV_OPERAND_TYPE_{}'.format( + re.sub(r'([a-z])([A-Z])', r'\1_\2', kind).upper()) + + +class InstInitializer(object): + """Instances holds a SPIR-V instruction suitable for printing as + the initializer for spv_opcode_desc_t.""" + + def __init__(self, opname, caps, exts, operands, version): + """Initialization. + + Arguments: + - opname: opcode name (with the 'Op' prefix) + - caps: a sequence of capability names required by this opcode + - exts: a sequence of names of extensions enabling this enumerant + - operands: a sequence of (operand-kind, operand-quantifier) tuples + - version: minimal SPIR-V version required for this opcode + """ + + assert opname.startswith('Op') + self.opname = opname[2:] # Remove the "Op" prefix. + self.num_caps = len(caps) + self.caps_mask = get_capability_array_name(caps) + self.num_exts = len(exts) + self.exts = get_extension_array_name(exts) + self.operands = [convert_operand_kind(o) for o in operands] + + self.fix_syntax() + + operands = [o[0] for o in operands] + self.ref_type_id = 'IdResultType' in operands + self.def_result_id = 'IdResult' in operands + + self.version = convert_min_required_version(version) + + def fix_syntax(self): + """Fix an instruction's syntax, adjusting for differences between + the officially released grammar and how SPIRV-Tools uses the grammar. + + Fixes: + - ExtInst should not end with SPV_OPERAND_VARIABLE_ID. + https://github.com/KhronosGroup/SPIRV-Tools/issues/233 + """ + if (self.opname == 'ExtInst' + and self.operands[-1] == 'SPV_OPERAND_TYPE_VARIABLE_ID'): + self.operands.pop() + + def __str__(self): + template = ['{{"{opname}"', 'SpvOp{opname}', + '{num_caps}', '{caps_mask}', + '{num_operands}', '{{{operands}}}', + '{def_result_id}', '{ref_type_id}', + '{num_exts}', '{exts}', + '{min_version}}}'] + return ', '.join(template).format( + opname=self.opname, + num_caps=self.num_caps, + caps_mask=self.caps_mask, + num_operands=len(self.operands), + operands=', '.join(self.operands), + def_result_id=(1 if self.def_result_id else 0), + ref_type_id=(1 if self.ref_type_id else 0), + num_exts=self.num_exts, + exts=self.exts, + min_version=self.version) + + +class ExtInstInitializer(object): + """Instances holds a SPIR-V extended instruction suitable for printing as + the initializer for spv_ext_inst_desc_t.""" + + def __init__(self, opname, opcode, caps, operands): + """Initialization. + + Arguments: + - opname: opcode name + - opcode: enumerant value for this opcode + - caps: a sequence of capability names required by this opcode + - operands: a sequence of (operand-kind, operand-quantifier) tuples + """ + self.opname = opname + self.opcode = opcode + self.num_caps = len(caps) + self.caps_mask = get_capability_array_name(caps) + self.operands = [convert_operand_kind(o) for o in operands] + self.operands.append('SPV_OPERAND_TYPE_NONE') + + def __str__(self): + template = ['{{"{opname}"', '{opcode}', '{num_caps}', '{caps_mask}', + '{{{operands}}}}}'] + return ', '.join(template).format( + opname=self.opname, + opcode=self.opcode, + num_caps=self.num_caps, + caps_mask=self.caps_mask, + operands=', '.join(self.operands)) + + +def generate_instruction(inst, is_ext_inst): + """Returns the C initializer for the given SPIR-V instruction. + + Arguments: + - inst: a dict containing information about a SPIR-V instruction + - is_ext_inst: a bool indicating whether |inst| is an extended + instruction. + + Returns: + a string containing the C initializer for spv_opcode_desc_t or + spv_ext_inst_desc_t + """ + opname = inst.get('opname') + opcode = inst.get('opcode') + caps = inst.get('capabilities', []) + exts = inst.get('extensions', []) + operands = inst.get('operands', {}) + operands = [(o['kind'], o.get('quantifier', '')) for o in operands] + min_version = inst.get('version', None) + + assert opname is not None + + if is_ext_inst: + return str(ExtInstInitializer(opname, opcode, caps, operands)) + else: + return str(InstInitializer(opname, caps, exts, operands, min_version)) + + +def generate_instruction_table(inst_table): + """Returns the info table containing all SPIR-V instructions, + sorted by opcode, and prefixed by capability arrays. + + Note: + - the built-in sorted() function is guaranteed to be stable. + https://docs.python.org/3/library/functions.html#sorted + + Arguments: + - inst_table: a list containing all SPIR-V instructions. + """ + inst_table = sorted(inst_table, key=lambda k: (k['opcode'], k['opname'])) + + caps_arrays = generate_capability_arrays( + [inst.get('capabilities', []) for inst in inst_table]) + exts_arrays = generate_extension_arrays( + [inst.get('extensions', []) for inst in inst_table]) + + insts = [generate_instruction(inst, False) for inst in inst_table] + insts = ['static const spv_opcode_desc_t kOpcodeTableEntries[] = {{\n' + ' {}\n}};'.format(',\n '.join(insts))] + + return '{}\n\n{}\n\n{}'.format(caps_arrays, exts_arrays, '\n'.join(insts)) + + +def generate_extended_instruction_table(inst_table, set_name): + """Returns the info table containing all SPIR-V extended instructions, + sorted by opcode, and prefixed by capability arrays. + + Arguments: + - inst_table: a list containing all SPIR-V instructions. + - set_name: the name of the extended instruction set. + """ + inst_table = sorted(inst_table, key=lambda k: k['opcode']) + caps = [inst.get('capabilities', []) for inst in inst_table] + caps_arrays = generate_capability_arrays(caps) + insts = [generate_instruction(inst, True) for inst in inst_table] + insts = ['static const spv_ext_inst_desc_t {}_entries[] = {{\n' + ' {}\n}};'.format(set_name, ',\n '.join(insts))] + + return '{}\n\n{}'.format(caps_arrays, '\n'.join(insts)) + + +class EnumerantInitializer(object): + """Prints an enumerant as the initializer for spv_operand_desc_t.""" + + def __init__(self, enumerant, value, caps, exts, parameters, version): + """Initialization. + + Arguments: + - enumerant: enumerant name + - value: enumerant value + - caps: a sequence of capability names required by this enumerant + - exts: a sequence of names of extensions enabling this enumerant + - parameters: a sequence of (operand-kind, operand-quantifier) tuples + - version: minimal SPIR-V version required for this opcode + """ + self.enumerant = enumerant + self.value = value + self.num_caps = len(caps) + self.caps = get_capability_array_name(caps) + self.num_exts = len(exts) + self.exts = get_extension_array_name(exts) + self.parameters = [convert_operand_kind(p) for p in parameters] + self.version = convert_min_required_version(version) + + def __str__(self): + template = ['{{"{enumerant}"', '{value}', '{num_caps}', + '{caps}', '{num_exts}', '{exts}', + '{{{parameters}}}', '{min_version}}}'] + return ', '.join(template).format( + enumerant=self.enumerant, + value=self.value, + num_caps=self.num_caps, + caps=self.caps, + num_exts=self.num_exts, + exts=self.exts, + parameters=', '.join(self.parameters), + min_version=self.version) + + +def generate_enum_operand_kind_entry(entry): + """Returns the C initializer for the given operand enum entry. + + Arguments: + - entry: a dict containing information about an enum entry + + Returns: + a string containing the C initializer for spv_operand_desc_t + """ + enumerant = entry.get('enumerant') + value = entry.get('value') + caps = entry.get('capabilities', []) + exts = entry.get('extensions', []) + params = entry.get('parameters', []) + params = [p.get('kind') for p in params] + params = zip(params, [''] * len(params)) + version = entry.get('version', None) + + assert enumerant is not None + assert value is not None + + return str(EnumerantInitializer( + enumerant, value, caps, exts, params, version)) + + +def generate_enum_operand_kind(enum): + """Returns the C definition for the given operand kind.""" + kind = enum.get('kind') + assert kind is not None + + # Sort all enumerants first according to their values and then + # their names so that the symbols with the same values are + # grouped together. + if enum.get('category') == 'ValueEnum': + functor = lambda k: (k['value'], k['enumerant']) + else: + functor = lambda k: (int(k['value'], 16), k['enumerant']) + entries = sorted(enum.get('enumerants', []), key=functor) + + name = '{}_{}Entries'.format(PYGEN_VARIABLE_PREFIX, kind) + entries = [' {}'.format(generate_enum_operand_kind_entry(e)) + for e in entries] + + template = ['static const spv_operand_desc_t {name}[] = {{', + '{entries}', '}};'] + entries = '\n'.join(template).format( + name=name, + entries=',\n'.join(entries)) + + return kind, name, entries + + +def generate_operand_kind_table(enums): + """Returns the info table containing all SPIR-V operand kinds.""" + # We only need to output info tables for those operand kinds that are enums. + enums = [e for e in enums if e.get('category') in ['ValueEnum', 'BitEnum']] + + caps = [entry.get('capabilities', []) + for enum in enums + for entry in enum.get('enumerants', [])] + caps_arrays = generate_capability_arrays(caps) + + exts = [entry.get('extensions', []) + for enum in enums + for entry in enum.get('enumerants', [])] + exts_arrays = generate_extension_arrays(exts) + + enums = [generate_enum_operand_kind(e) for e in enums] + # We have three operand kinds that requires their optional counterpart to + # exist in the operand info table. + three_optional_enums = ['ImageOperands', 'AccessQualifier', 'MemoryAccess'] + three_optional_enums = [e for e in enums if e[0] in three_optional_enums] + enums.extend(three_optional_enums) + + enum_kinds, enum_names, enum_entries = zip(*enums) + # Mark the last three as optional ones. + enum_quantifiers = [''] * (len(enums) - 3) + ['?'] * 3 + # And we don't want redefinition of them. + enum_entries = enum_entries[:-3] + enum_kinds = [convert_operand_kind(e) + for e in zip(enum_kinds, enum_quantifiers)] + table_entries = zip(enum_kinds, enum_names, enum_names) + table_entries = [' {{{}, ARRAY_SIZE({}), {}}}'.format(*e) + for e in table_entries] + + template = [ + 'static const spv_operand_desc_group_t {p}_OperandInfoTable[] = {{', + '{enums}', '}};'] + table = '\n'.join(template).format( + p=PYGEN_VARIABLE_PREFIX, enums=',\n'.join(table_entries)) + + return '\n\n'.join((caps_arrays,) + (exts_arrays,) + enum_entries + (table,)) + + +def get_extension_list(instructions, operand_kinds): + """Returns extensions as an alphabetically sorted list of strings.""" + + things_with_an_extensions_field = [item for item in instructions] + + enumerants = sum([item.get('enumerants', []) for item in operand_kinds], []) + + things_with_an_extensions_field.extend(enumerants) + + extensions = sum([item.get('extensions', []) + for item in things_with_an_extensions_field + if item.get('extensions')], []) + + for item in EXTENSIONS_FROM_SPIRV_REGISTRY_AND_NOT_FROM_GRAMMARS.split(): + # If it's already listed in a grammar, then don't put it in the + # special exceptions list. + assert item not in extensions, "Extension %s is already in a grammar file" % item + + extensions.extend(EXTENSIONS_FROM_SPIRV_REGISTRY_AND_NOT_FROM_GRAMMARS.split()) + + # Validator would ignore type declaration unique check. Should only be used + # for legacy autogenerated test files containing multiple instances of the + # same type declaration, if fixing the test by other methods is too + # difficult. Shouldn't be used for any other reasons. + extensions.append('SPV_VALIDATOR_ignore_type_decl_unique') + + return sorted(set(extensions)) + + +def get_capabilities(operand_kinds): + """Returns capabilities as a list of JSON objects, in order of + appearance. + """ + enumerants = sum([item.get('enumerants', []) for item in operand_kinds + if item.get('kind') in ['Capability']], []) + return enumerants + + +def generate_extension_enum(extensions): + """Returns enumeration containing extensions declared in the grammar.""" + return ',\n'.join(['k' + extension for extension in extensions]) + + +def generate_extension_to_string_mapping(extensions): + """Returns mapping function from extensions to corresponding strings.""" + function = 'const char* ExtensionToString(Extension extension) {\n' + function += ' switch (extension) {\n' + template = ' case Extension::k{extension}:\n' \ + ' return "{extension}";\n' + function += ''.join([template.format(extension=extension) + for extension in extensions]) + function += ' };\n\n return "";\n}' + return function + + +def generate_string_to_extension_mapping(extensions): + """Returns mapping function from strings to corresponding extensions.""" + + function = ''' + bool GetExtensionFromString(const char* str, Extension* extension) {{ + static const char* known_ext_strs[] = {{ {strs} }}; + static const Extension known_ext_ids[] = {{ {ids} }}; + const auto b = std::begin(known_ext_strs); + const auto e = std::end(known_ext_strs); + const auto found = std::equal_range( + b, e, str, [](const char* str1, const char* str2) {{ + return std::strcmp(str1, str2) < 0; + }}); + if (found.first == e || found.first == found.second) return false; + + *extension = known_ext_ids[found.first - b]; + return true; + }} + '''.format(strs=', '.join(['"{}"'.format(e) for e in extensions]), + ids=', '.join(['Extension::k{}'.format(e) for e in extensions])) + + return function + + +def generate_capability_to_string_mapping(operand_kinds): + """Returns mapping function from capabilities to corresponding strings. + We take care to avoid emitting duplicate values. + """ + function = 'const char* CapabilityToString(SpvCapability capability) {\n' + function += ' switch (capability) {\n' + template = ' case SpvCapability{capability}:\n' \ + ' return "{capability}";\n' + emitted = set() # The values of capabilities we already have emitted + for capability in get_capabilities(operand_kinds): + value = capability.get('value') + if value not in emitted: + emitted.add(value) + function += template.format(capability=capability.get('enumerant')) + function += ' case SpvCapabilityMax:\n' \ + ' assert(0 && "Attempting to convert SpvCapabilityMax to string");\n' \ + ' return "";\n' + function += ' };\n\n return "";\n}' + return function + + +def generate_all_string_enum_mappings(extensions, operand_kinds): + """Returns all string-to-enum / enum-to-string mapping tables.""" + tables = [] + tables.append(generate_extension_to_string_mapping(extensions)) + tables.append(generate_string_to_extension_mapping(extensions)) + tables.append(generate_capability_to_string_mapping(operand_kinds)) + return '\n\n'.join(tables) + + +def main(): + import argparse + parser = argparse.ArgumentParser(description='Generate SPIR-V info tables') + + parser.add_argument('--spirv-core-grammar', metavar='', + type=str, required=False, + help='input JSON grammar file for core SPIR-V ' + 'instructions') + parser.add_argument('--extinst-debuginfo-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for DebugInfo extended ' + 'instruction set') + parser.add_argument('--extinst-glsl-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for GLSL extended ' + 'instruction set') + parser.add_argument('--extinst-opencl-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for OpenCL extended ' + 'instruction set') + + parser.add_argument('--core-insts-output', metavar='', + type=str, required=False, default=None, + help='output file for core SPIR-V instructions') + parser.add_argument('--glsl-insts-output', metavar='', + type=str, required=False, default=None, + help='output file for GLSL extended instruction set') + parser.add_argument('--opencl-insts-output', metavar='', + type=str, required=False, default=None, + help='output file for OpenCL extended instruction set') + parser.add_argument('--operand-kinds-output', metavar='', + type=str, required=False, default=None, + help='output file for operand kinds') + parser.add_argument('--extension-enum-output', metavar='', + type=str, required=False, default=None, + help='output file for extension enumeration') + parser.add_argument('--enum-string-mapping-output', metavar='', + type=str, required=False, default=None, + help='output file for enum-string mappings') + parser.add_argument('--extinst-vendor-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for vendor extended ' + 'instruction set'), + parser.add_argument('--vendor-insts-output', metavar='', + type=str, required=False, default=None, + help='output file for vendor extended instruction set') + args = parser.parse_args() + + if (args.core_insts_output is None) != \ + (args.operand_kinds_output is None): + print('error: --core-insts-output and --operand-kinds-output ' + 'should be specified together.') + exit(1) + if args.operand_kinds_output and not (args.spirv_core_grammar and args.extinst_debuginfo_grammar): + print('error: --operand-kinds-output requires --spirv-core-grammar ' + 'and --exinst-debuginfo-grammar') + exit(1) + if (args.glsl_insts_output is None) != \ + (args.extinst_glsl_grammar is None): + print('error: --glsl-insts-output and --extinst-glsl-grammar ' + 'should be specified together.') + exit(1) + if (args.opencl_insts_output is None) != \ + (args.extinst_opencl_grammar is None): + print('error: --opencl-insts-output and --extinst-opencl-grammar ' + 'should be specified together.') + exit(1) + if (args.vendor_insts_output is None) != \ + (args.extinst_vendor_grammar is None): + print('error: --vendor-insts-output and ' + '--extinst-vendor-grammar should be specified together.') + exit(1) + if all([args.core_insts_output is None, + args.glsl_insts_output is None, + args.opencl_insts_output is None, + args.vendor_insts_output is None, + args.extension_enum_output is None, + args.enum_string_mapping_output is None]): + print('error: at least one output should be specified.') + exit(1) + + if args.spirv_core_grammar is not None: + with open(args.spirv_core_grammar) as json_file: + core_grammar = json.loads(json_file.read()) + with open(args.extinst_debuginfo_grammar) as debuginfo_json_file: + debuginfo_grammar = json.loads(debuginfo_json_file.read()) + instructions = [] + instructions.extend(core_grammar['instructions']) + instructions.extend(debuginfo_grammar['instructions']) + operand_kinds = [] + operand_kinds.extend(core_grammar['operand_kinds']) + operand_kinds.extend(debuginfo_grammar['operand_kinds']) + extensions = get_extension_list(instructions, operand_kinds) + if args.core_insts_output is not None: + make_path_to_file(args.core_insts_output) + make_path_to_file(args.operand_kinds_output) + print(generate_instruction_table(core_grammar['instructions']), + file=open(args.core_insts_output, 'w')) + print(generate_operand_kind_table(operand_kinds), + file=open(args.operand_kinds_output, 'w')) + if args.extension_enum_output is not None: + make_path_to_file(args.extension_enum_output) + print(generate_extension_enum(extensions), + file=open(args.extension_enum_output, 'w')) + if args.enum_string_mapping_output is not None: + make_path_to_file(args.enum_string_mapping_output) + print(generate_all_string_enum_mappings(extensions, operand_kinds), + file=open(args.enum_string_mapping_output, 'w')) + + if args.extinst_glsl_grammar is not None: + with open(args.extinst_glsl_grammar) as json_file: + grammar = json.loads(json_file.read()) + make_path_to_file(args.glsl_insts_output) + print(generate_extended_instruction_table( + grammar['instructions'], "glsl"), + file=open(args.glsl_insts_output, 'w')) + + if args.extinst_opencl_grammar is not None: + with open(args.extinst_opencl_grammar) as json_file: + grammar = json.loads(json_file.read()) + make_path_to_file(args.opencl_insts_output) + print(generate_extended_instruction_table( + grammar['instructions'], "opencl"), + file=open(args.opencl_insts_output, 'w')) + + if args.extinst_vendor_grammar is not None: + with open(args.extinst_vendor_grammar) as json_file: + grammar = json.loads(json_file.read()) + make_path_to_file(args.vendor_insts_output) + name = args.extinst_vendor_grammar + start = name.find("extinst.") + len("extinst.") + name = name[start:-len(".grammar.json")].replace("-", "_") + print(generate_extended_instruction_table( + grammar['instructions'], name), + file=open(args.vendor_insts_output, 'w')) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_language_headers.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_language_headers.py new file mode 100644 index 00000000000..1886bf4f38a --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_language_headers.py @@ -0,0 +1,188 @@ +#!/usr/bin/env python +# Copyright (c) 2017 Google 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. +"""Generates language headers from a JSON grammar file""" + +from __future__ import print_function + +import errno +import json +import os.path +import re + + +def make_path_to_file(f): + """Makes all ancestor directories to the given file, if they + don't yet exist. + + Arguments: + f: The file whose ancestor directories are to be created. + """ + dir = os.path.dirname(os.path.abspath(f)) + try: + os.makedirs(dir) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(dir): + pass + else: + raise + +class ExtInstGrammar: + """The grammar for an extended instruction set""" + + def __init__(self, name, copyright, instructions, operand_kinds, version = None, revision = None): + self.name = name + self.copyright = copyright + self.instructions = instructions + self.operand_kinds = operand_kinds + self.version = version + self.revision = revision + + +class LangGenerator: + """A language-specific generator""" + + def __init__(self): + self.upper_case_initial = re.compile('^[A-Z]') + pass + + def comment_prefix(self): + return "" + + def namespace_prefix(self): + return "" + + def uses_guards(self): + return False + + def cpp_guard_preamble(self): + return "" + + def cpp_guard_postamble(self): + return "" + + def enum_value(self, prefix, name, value): + if self.upper_case_initial.match(name): + use_name = name + else: + use_name = '_' + name + + return " {}{} = {},".format(prefix, use_name, value) + + def generate(self, grammar): + """Returns a string that is the language-specific header for the given grammar""" + + parts = [] + if grammar.copyright: + parts.extend(["{}{}".format(self.comment_prefix(), f) for f in grammar.copyright]) + parts.append('') + + guard = 'SPIRV_EXTINST_{}_H_'.format(grammar.name) + if self.uses_guards: + parts.append('#ifndef {}'.format(guard)) + parts.append('#define {}'.format(guard)) + parts.append('') + + parts.append(self.cpp_guard_preamble()) + + if grammar.version: + parts.append(self.const_definition(grammar.name, 'Version', grammar.version)) + + if grammar.revision is not None: + parts.append(self.const_definition(grammar.name, 'Revision', grammar.revision)) + + parts.append('') + + if grammar.instructions: + parts.append(self.enum_prefix(grammar.name, 'Instructions')) + for inst in grammar.instructions: + parts.append(self.enum_value(grammar.name, inst['opname'], inst['opcode'])) + parts.append(self.enum_end(grammar.name, 'Instructions')) + parts.append('') + + if grammar.operand_kinds: + for kind in grammar.operand_kinds: + parts.append(self.enum_prefix(grammar.name, kind['kind'])) + for e in kind['enumerants']: + parts.append(self.enum_value(grammar.name, e['enumerant'], e['value'])) + parts.append(self.enum_end(grammar.name, kind['kind'])) + parts.append('') + + parts.append(self.cpp_guard_postamble()) + + if self.uses_guards: + parts.append('#endif // {}'.format(guard)) + + return '\n'.join(parts) + + +class CLikeGenerator(LangGenerator): + def uses_guards(self): + return True + + def comment_prefix(self): + return "// " + + def const_definition(self, prefix, var, value): + # Use an anonymous enum. Don't use a static const int variable because + # that can bloat binary size. + return 'enum {0} {1}{2} = {3}, {1}{2}_BitWidthPadding = 0x7fffffff {4};'.format( + '{', prefix, var, value, '}') + + def enum_prefix(self, prefix, name): + return 'enum {}{} {}'.format(prefix, name, '{') + + def enum_end(self, prefix, enum): + return ' {}{}Max = 0x7ffffff\n{};\n'.format(prefix, enum, '}') + + def cpp_guard_preamble(self): + return '#ifdef __cplusplus\nextern "C" {\n#endif\n' + + def cpp_guard_postamble(self): + return '#ifdef __cplusplus\n}\n#endif\n' + + +class CGenerator(CLikeGenerator): + pass + + +def main(): + import argparse + parser = argparse.ArgumentParser(description='Generate language headers from a JSON grammar') + + parser.add_argument('--extinst-name', + type=str, required=True, + help='The name to use in tokens') + parser.add_argument('--extinst-grammar', metavar='', + type=str, required=True, + help='input JSON grammar file for extended instruction set') + parser.add_argument('--extinst-output-base', metavar='', + type=str, required=True, + help='Basename of the language-specific output file.') + args = parser.parse_args() + + with open(args.extinst_grammar) as json_file: + grammar_json = json.loads(json_file.read()) + grammar = ExtInstGrammar(name = args.extinst_name, + copyright = grammar_json['copyright'], + instructions = grammar_json['instructions'], + operand_kinds = grammar_json['operand_kinds'], + version = grammar_json['version'], + revision = grammar_json['revision']) + make_path_to_file(args.extinst_output_base) + print(CGenerator().generate(grammar), file=open(args.extinst_output_base + '.h', 'w')) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_registry_tables.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_registry_tables.py new file mode 100644 index 00000000000..8b1c3572137 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_registry_tables.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python +# Copyright (c) 2016 Google 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. +"""Generates the vendor tool table from the SPIR-V XML registry.""" + +from __future__ import print_function + +import distutils.dir_util +import os.path +import xml.etree.ElementTree + + +def generate_vendor_table(registry): + """Returns a list of C style initializers for the registered vendors + and their tools. + + Args: + registry: The SPIR-V XMLregistry as an xml.ElementTree + """ + + lines = [] + for ids in registry.iter('ids'): + if 'vendor' == ids.attrib['type']: + for an_id in ids.iter('id'): + value = an_id.attrib['value'] + vendor = an_id.attrib['vendor'] + if 'tool' in an_id.attrib: + tool = an_id.attrib['tool'] + vendor_tool = vendor + ' ' + tool + else: + tool = '' + vendor_tool = vendor + line = '{' + '{}, "{}", "{}", "{}"'.format(value, + vendor, + tool, + vendor_tool) + '},' + lines.append(line) + return '\n'.join(lines) + + +def main(): + import argparse + parser = argparse.ArgumentParser(description= + 'Generate tables from SPIR-V XML registry') + parser.add_argument('--xml', metavar='', + type=str, required=True, + help='SPIR-V XML Registry file') + parser.add_argument('--generator-output', metavar='', + type=str, required=True, + help='output file for SPIR-V generators table') + args = parser.parse_args() + + with open(args.xml) as xml_in: + registry = xml.etree.ElementTree.fromstring(xml_in.read()) + + distutils.dir_util.mkpath(os.path.dirname(args.generator_output)) + print(generate_vendor_table(registry), file=open(args.generator_output, 'w')) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_vim_syntax.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_vim_syntax.py new file mode 100644 index 00000000000..03c0b478bc7 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/generate_vim_syntax.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python +# Copyright (c) 2016 Google 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. +"""Generates Vim syntax rules for SPIR-V assembly (.spvasm) files""" + +from __future__ import print_function + +import json + +PREAMBLE="""" Vim syntax file +" Language: spvasm +" Generated by SPIRV-Tools + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn case match +""" + +POSTAMBLE=""" + +syntax keyword spvasmTodo TODO FIXME contained + +syn match spvasmIdNumber /%\d\+\>/ + +" The assembler treats the leading minus sign as part of the number token. +" This applies to integers, and to floats below. +syn match spvasmNumber /-\?\<\d\+\>/ + +" Floating point literals. +" In general, C++ requires at least digit in the mantissa, and the +" floating point is optional. This applies to both the regular decimal float +" case and the hex float case. + +" First case: digits before the optional decimal, no trailing digits. +syn match spvasmFloat /-\?\d\+\.\?\(e[+-]\d\+\)\?/ +" Second case: optional digits before decimal, trailing digits +syn match spvasmFloat /-\?\d*\.\d\+\(e[+-]\d\+\)\?/ + +" First case: hex digits before the optional decimal, no trailing hex digits. +syn match spvasmFloat /-\?0[xX]\\x\+\.\?p[-+]\d\+/ +" Second case: optional hex digits before decimal, trailing hex digits +syn match spvasmFloat /-\?0[xX]\\x*\.\\x\+p[-+]\d\+/ + +syn match spvasmComment /;.*$/ contains=spvasmTodo +syn region spvasmString start=/"/ skip=/\\\\"/ end=/"/ +syn match spvasmId /%[a-zA-Z_][a-zA-Z_0-9]*/ + +" Highlight unknown constants and statements as errors +syn match spvasmError /[a-zA-Z][a-zA-Z_0-9]*/ + + +if version >= 508 || !exists("did_c_syn_inits") + if version < 508 + let did_c_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + HiLink spvasmStatement Statement + HiLink spvasmNumber Number + HiLink spvasmComment Comment + HiLink spvasmString String + HiLink spvasmFloat Float + HiLink spvasmConstant Constant + HiLink spvasmIdNumber Identifier + HiLink spvasmId Identifier + HiLink spvasmTodo Todo + + delcommand HiLink +endif + +let b:current_syntax = "spvasm" +""" + +# This list is taken from the description of OpSpecConstantOp in SPIR-V 1.1. +# TODO(dneto): Propose that this information be embedded in the grammar file. +SPEC_CONSTANT_OP_OPCODES = """ + OpSConvert, OpFConvert + OpSNegate, OpNot + OpIAdd, OpISub + OpIMul, OpUDiv, OpSDiv, OpUMod, OpSRem, OpSMod + OpShiftRightLogical, OpShiftRightArithmetic, OpShiftLeftLogical + OpBitwiseOr, OpBitwiseXor, OpBitwiseAnd + OpVectorShuffle, OpCompositeExtract, OpCompositeInsert + OpLogicalOr, OpLogicalAnd, OpLogicalNot, + OpLogicalEqual, OpLogicalNotEqual + OpSelect + OpIEqual, OpINotEqual + OpULessThan, OpSLessThan + OpUGreaterThan, OpSGreaterThan + OpULessThanEqual, OpSLessThanEqual + OpUGreaterThanEqual, OpSGreaterThanEqual + + OpQuantizeToF16 + + OpConvertFToS, OpConvertSToF + OpConvertFToU, OpConvertUToF + OpUConvert + OpConvertPtrToU, OpConvertUToPtr + OpGenericCastToPtr, OpPtrCastToGeneric + OpBitcast + OpFNegate + OpFAdd, OpFSub + OpFMul, OpFDiv + OpFRem, OpFMod + OpAccessChain, OpInBoundsAccessChain + OpPtrAccessChain, OpInBoundsPtrAccessChain""" + + +def EmitAsStatement(name): + """Emits the given name as a statement token""" + print('syn keyword spvasmStatement', name) + + +def EmitAsEnumerant(name): + """Emits the given name as an named operand token""" + print('syn keyword spvasmConstant', name) + + +def main(): + """Parses arguments, then generates the Vim syntax rules for SPIR-V assembly + on stdout.""" + import argparse + parser = argparse.ArgumentParser(description='Generate SPIR-V info tables') + parser.add_argument('--spirv-core-grammar', metavar='', + type=str, required=True, + help='input JSON grammar file for core SPIR-V ' + 'instructions') + parser.add_argument('--extinst-glsl-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for GLSL extended ' + 'instruction set') + parser.add_argument('--extinst-opencl-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for OpenGL extended ' + 'instruction set') + parser.add_argument('--extinst-debuginfo-grammar', metavar='', + type=str, required=False, default=None, + help='input JSON grammar file for DebugInfo extended ' + 'instruction set') + args = parser.parse_args() + + # Generate the syntax rules. + print(PREAMBLE) + + core = json.loads(open(args.spirv_core_grammar).read()) + print('\n" Core instructions') + for inst in core["instructions"]: + EmitAsStatement(inst['opname']) + print('\n" Core operand enums') + for operand_kind in core["operand_kinds"]: + if 'enumerants' in operand_kind: + for e in operand_kind['enumerants']: + EmitAsEnumerant(e['enumerant']) + + if args.extinst_glsl_grammar is not None: + print('\n" GLSL.std.450 extended instructions') + glsl = json.loads(open(args.extinst_glsl_grammar).read()) + # These opcodes are really enumerant operands for the OpExtInst + # instruction. + for inst in glsl["instructions"]: + EmitAsEnumerant(inst['opname']) + + if args.extinst_opencl_grammar is not None: + print('\n" OpenCL.std extended instructions') + opencl = json.loads(open(args.extinst_opencl_grammar).read()) + for inst in opencl["instructions"]: + EmitAsEnumerant(inst['opname']) + + if args.extinst_debuginfo_grammar is not None: + print('\n" DebugInfo extended instructions') + debuginfo = json.loads(open(args.extinst_debuginfo_grammar).read()) + for inst in debuginfo["instructions"]: + EmitAsEnumerant(inst['opname']) + print('\n" DebugInfo operand enums') + for operand_kind in debuginfo["operand_kinds"]: + if 'enumerants' in operand_kind: + for e in operand_kind['enumerants']: + EmitAsEnumerant(e['enumerant']) + + print('\n" OpSpecConstantOp opcodes') + for word in SPEC_CONSTANT_OP_OPCODES.split(' '): + stripped = word.strip('\n,') + if stripped != "": + # Treat as an enumerant, but without the leading "Op" + EmitAsEnumerant(stripped[2:]) + print(POSTAMBLE) + + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/spirv-tools/utils/update_build_version.py b/3rdparty/bgfx/3rdparty/spirv-tools/utils/update_build_version.py new file mode 100644 index 00000000000..d71aeccd9d2 --- /dev/null +++ b/3rdparty/bgfx/3rdparty/spirv-tools/utils/update_build_version.py @@ -0,0 +1,150 @@ +#!/usr/bin/env python + +# Copyright (c) 2016 Google 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. + +# Updates an output file with version info unless the new content is the same +# as the existing content. +# +# Args: +# +# The output file will contain a line of text consisting of two C source syntax +# string literals separated by a comma: +# - The software version deduced from the CHANGES file in the given directory. +# - A longer string with the project name, the software version number, and +# git commit information for the directory. The commit information +# is the output of "git describe" if that succeeds, or "git rev-parse HEAD" +# if that succeeds, or otherwise a message containing the phrase +# "unknown hash". +# The string contents are escaped as necessary. + +from __future__ import print_function + +import datetime +import errno +import os +import os.path +import re +import subprocess +import sys +import time + + +def mkdir_p(directory): + """Make the directory, and all its ancestors as required. Any of the + directories are allowed to already exist.""" + + if directory == "": + # We're being asked to make the current directory. + return + + try: + os.makedirs(directory) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(directory): + pass + else: + raise + + +def command_output(cmd, directory): + """Runs a command in a directory and returns its standard output stream. + + Captures the standard error stream. + + Raises a RuntimeError if the command fails to launch or otherwise fails. + """ + p = subprocess.Popen(cmd, + cwd=directory, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + (stdout, _) = p.communicate() + if p.returncode != 0: + raise RuntimeError('Failed to run %s in %s' % (cmd, directory)) + return stdout + + +def deduce_software_version(directory): + """Returns a software version number parsed from the CHANGES file + in the given directory. + + The CHANGES file describes most recent versions first. + """ + + # Match the first well-formed version-and-date line. + # Allow trailing whitespace in the checked-out source code has + # unexpected carriage returns on a linefeed-only system such as + # Linux. + pattern = re.compile(r'^(v\d+\.\d+(-dev)?) \d\d\d\d-\d\d-\d\d\s*$') + changes_file = os.path.join(directory, 'CHANGES') + with open(changes_file, mode='rU') as f: + for line in f.readlines(): + match = pattern.match(line) + if match: + return match.group(1) + raise Exception('No version number found in {}'.format(changes_file)) + + +def describe(directory): + """Returns a string describing the current Git HEAD version as descriptively + as possible. + + Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If + successful, returns the output; otherwise returns 'unknown hash, '.""" + try: + # decode() is needed here for Python3 compatibility. In Python2, + # str and bytes are the same type, but not in Python3. + # Popen.communicate() returns a bytes instance, which needs to be + # decoded into text data first in Python3. And this decode() won't + # hurt Python2. + return command_output(['git', 'describe'], directory).rstrip().decode() + except: + try: + return command_output( + ['git', 'rev-parse', 'HEAD'], directory).rstrip().decode() + except: + # This is the fallback case where git gives us no information, + # e.g. because the source tree might not be in a git tree. + # In this case, usually use a timestamp. However, to ensure + # reproducible builds, allow the builder to override the wall + # clock time with enviornment variable SOURCE_DATE_EPOCH + # containing a (presumably) fixed timestamp. + timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) + formatted = datetime.date.fromtimestamp(timestamp).isoformat() + return 'unknown hash, {}'.format(formatted) + + +def main(): + if len(sys.argv) != 3: + print('usage: {} '.format(sys.argv[0])) + sys.exit(1) + + output_file = sys.argv[2] + mkdir_p(os.path.dirname(output_file)) + + software_version = deduce_software_version(sys.argv[1]) + new_content = '"{}", "SPIRV-Tools {} {}"\n'.format( + software_version, software_version, + describe(sys.argv[1]).replace('"', '\\"')) + + if os.path.isfile(output_file): + with open(output_file, 'r') as f: + if new_content == f.read(): + return + + with open(output_file, 'w') as f: + f.write(new_content) + +if __name__ == '__main__': + main() diff --git a/3rdparty/bgfx/3rdparty/stb/stb_rect_pack.h b/3rdparty/bgfx/3rdparty/stb/stb_rect_pack.h index 836e563cd08..2b07dcc82c8 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_rect_pack.h +++ b/3rdparty/bgfx/3rdparty/stb/stb_rect_pack.h @@ -1,16 +1,4 @@ -#if defined(__GNUC__) || defined(__clang__) -# if defined(__clang__) -# pragma clang diagnostic ignored "-Wunknown-pragmas" -# endif // defined(__clang__) -# pragma GCC diagnostic ignored "-Wtype-limits" -# pragma GCC diagnostic ignored "-Wunused-function" -# pragma GCC diagnostic ignored "-Wunused-parameter" -# pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#else -# pragma warning(disable:4100) // C4100: 'c': unreferenced formal parameter -#endif - -// stb_rect_pack.h - v0.08 - public domain - rectangle packing +// stb_rect_pack.h - v0.11 - public domain - rectangle packing // Sean Barrett 2014 // // Useful for e.g. packing rectangular textures into an atlas. @@ -39,11 +27,16 @@ // Sean Barrett // Minor features // Martins Mozeiko +// github:IntellectualKitty +// // Bugfixes / warning fixes // Jeremy Jaussaud // // Version history: // +// 0.11 (2017-03-03) return packing success/fail result +// 0.10 (2016-10-25) remove cast-away-const to avoid warnings +// 0.09 (2016-08-27) fix compiler warnings // 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0) // 0.07 (2015-09-13) fix bug with empty rects (w=0 or h=0) // 0.06 (2015-04-15) added STBRP_SORT to allow replacing qsort @@ -53,9 +46,7 @@ // // LICENSE // -// This software is dual-licensed to the public domain and under the following -// license: you are granted a perpetual, irrevocable license to copy, modify, -// publish, and distribute this file as you see fit. +// See end of file for license information. ////////////////////////////////////////////////////////////////////////////// // @@ -87,7 +78,7 @@ typedef int stbrp_coord; typedef unsigned short stbrp_coord; #endif -STBRP_DEF void stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); +STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); // Assign packed locations to rectangles. The rectangles are of type // 'stbrp_rect' defined below, stored in the array 'rects', and there // are 'num_rects' many of them. @@ -108,6 +99,9 @@ STBRP_DEF void stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int // arrays will probably produce worse packing results than calling it // a single time with the full rectangle array, but the option is // available. +// +// The function returns 1 if all of the rectangles were successfully +// packed and 0 otherwise. struct stbrp_rect { @@ -160,7 +154,7 @@ enum { STBRP_HEURISTIC_Skyline_default=0, STBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default, - STBRP_HEURISTIC_Skyline_BF_sortHeight, + STBRP_HEURISTIC_Skyline_BF_sortHeight }; @@ -210,9 +204,17 @@ struct stbrp_context #define STBRP_ASSERT assert #endif +#ifdef _MSC_VER +#define STBRP__NOTUSED(v) (void)(v) +#define STBRP__CDECL __cdecl +#else +#define STBRP__NOTUSED(v) (void)sizeof(v) +#define STBRP__CDECL +#endif + enum { - STBRP__INIT_skyline = 1, + STBRP__INIT_skyline = 1 }; STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic) @@ -285,6 +287,9 @@ static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0 stbrp_node *node = first; int x1 = x0 + width; int min_y, visited_width, waste_area; + + STBRP__NOTUSED(c); + STBRP_ASSERT(first->x <= x0); #if 0 @@ -489,17 +494,14 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i STBRP_ASSERT(cur->next == NULL); { - stbrp_node *L1 = NULL, *L2 = NULL; int count=0; cur = context->active_head; while (cur) { - L1 = cur; cur = cur->next; ++count; } cur = context->free_head; while (cur) { - L2 = cur; cur = cur->next; ++count; } @@ -510,10 +512,10 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i return res; } -static int rect_height_compare(const void *a, const void *b) +static int STBRP__CDECL rect_height_compare(const void *a, const void *b) { - stbrp_rect *p = (stbrp_rect *) a; - stbrp_rect *q = (stbrp_rect *) b; + const stbrp_rect *p = (const stbrp_rect *) a; + const stbrp_rect *q = (const stbrp_rect *) b; if (p->h > q->h) return -1; if (p->h < q->h) @@ -521,21 +523,10 @@ static int rect_height_compare(const void *a, const void *b) return (p->w > q->w) ? -1 : (p->w < q->w); } -static int rect_width_compare(const void *a, const void *b) +static int STBRP__CDECL rect_original_order(const void *a, const void *b) { - stbrp_rect *p = (stbrp_rect *) a; - stbrp_rect *q = (stbrp_rect *) b; - if (p->w > q->w) - return -1; - if (p->w < q->w) - return 1; - return (p->h > q->h) ? -1 : (p->h < q->h); -} - -static int rect_original_order(const void *a, const void *b) -{ - stbrp_rect *p = (stbrp_rect *) a; - stbrp_rect *q = (stbrp_rect *) b; + const stbrp_rect *p = (const stbrp_rect *) a; + const stbrp_rect *q = (const stbrp_rect *) b; return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); } @@ -545,9 +536,9 @@ static int rect_original_order(const void *a, const void *b) #define STBRP__MAXVAL 0xffff #endif -STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) +STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) { - int i; + int i, all_rects_packed = 1; // we use the 'was_packed' field internally to allow sorting/unsorting for (i=0; i < num_rects; ++i) { @@ -577,8 +568,56 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n // unsort STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order); - // set was_packed flags - for (i=0; i < num_rects; ++i) + // set was_packed flags and all_rects_packed status + for (i=0; i < num_rects; ++i) { rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL); + if (!rects[i].was_packed) + all_rects_packed = 0; + } + + // return the all_rects_packed status + return all_rects_packed; } #endif + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/3rdparty/bgfx/3rdparty/stb/stb_textedit.h b/3rdparty/bgfx/3rdparty/stb/stb_textedit.h index 4b731a0c229..9e12469be70 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_textedit.h +++ b/3rdparty/bgfx/3rdparty/stb/stb_textedit.h @@ -1,10 +1,9 @@ -// [ImGui] this is a slightly modified version of stb_truetype.h 1.9. Those changes would need to be pushed into nothings/sb -// [ImGui] - fixed linestart handler when over last character of multi-line buffer + simplified existing code (#588, #815) -// [ImGui] - fixed a state corruption/crash bug in stb_text_redo and stb_textedit_discard_redo (#715) -// [ImGui] - fixed a crash bug in stb_textedit_discard_redo (#681) +// [ImGui] this is a slightly modified version of stb_textedit.h 1.12. Those changes would need to be pushed into nothings/stb +// [ImGui] - 2018-06: fixed undo/redo after pasting large amount of text (over 32 kb). Redo will still fail when undo buffers are exhausted, but text won't be corrupted (see nothings/stb issue #620) +// [ImGui] - 2018-06: fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321) // [ImGui] - fixed some minor warnings -// stb_textedit.h - v1.9 - public domain - Sean Barrett +// stb_textedit.h - v1.12 - public domain - Sean Barrett // Development of this library was sponsored by RAD Game Tools // // This C header file implements the guts of a multi-line text-editing @@ -23,9 +22,7 @@ // // LICENSE // -// This software is dual-licensed to the public domain and under the following -// license: you are granted a perpetual, irrevocable license to copy, modify, -// publish, and distribute this file as you see fit. +// See end of file for license information. // // // DEPENDENCIES @@ -37,6 +34,9 @@ // // VERSION HISTORY // +// 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash +// 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield +// 1.10 (2016-10-25) supress warnings about casting away const with -Wcast-qual // 1.9 (2016-08-27) customizable move-by-word // 1.8 (2016-04-02) better keyboard handling when mouse button is down // 1.7 (2015-09-13) change y range handling in case baseline is non-0 @@ -55,12 +55,13 @@ // // Ulf Winklemann: move-by-word in 1.1 // Fabian Giesen: secondary key inputs in 1.5 -// Martins Mozeiko: STB_TEXTEDIT_memmove +// Martins Mozeiko: STB_TEXTEDIT_memmove in 1.6 // // Bugfixes: // Scott Graham // Daniel Keller // Omar Cornut +// Dan Thompson // // USAGE // @@ -90,8 +91,8 @@ // moderate sizes. The undo system does no memory allocations, so // it grows STB_TexteditState by the worst-case storage which is (in bytes): // -// [4 + sizeof(STB_TEXTEDIT_POSITIONTYPE)] * STB_TEXTEDIT_UNDOSTATE_COUNT -// + sizeof(STB_TEXTEDIT_CHARTYPE) * STB_TEXTEDIT_UNDOCHAR_COUNT +// [4 + 3 * sizeof(STB_TEXTEDIT_POSITIONTYPE)] * STB_TEXTEDIT_UNDOSTATE_COUNT +// + sizeof(STB_TEXTEDIT_CHARTYPE) * STB_TEXTEDIT_UNDOCHAR_COUNT // // // Implementation mode: @@ -114,7 +115,7 @@ // Symbols that must be the same in header-file and implementation mode: // // STB_TEXTEDIT_CHARTYPE the character type -// STB_TEXTEDIT_POSITIONTYPE small type that a valid cursor position +// STB_TEXTEDIT_POSITIONTYPE small type that is a valid cursor position // STB_TEXTEDIT_UNDOSTATECOUNT the number of undo states to allow // STB_TEXTEDIT_UNDOCHARCOUNT the number of characters to store in the undo buffer // @@ -203,7 +204,7 @@ // void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y) // int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state) // int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len) -// void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int key) +// void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXEDIT_KEYTYPE key) // // Each of these functions potentially updates the string and updates the // state. @@ -237,7 +238,9 @@ // inputs, set a high bit to distinguish the two; then you can define the // various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit // set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is -// clear. +// clear. STB_TEXTEDIT_KEYTYPE defaults to int, but you can #define it to +// anything other type you wante before including. +// // // When rendering, you can read the cursor position and selection state from // the STB_TexteditState. @@ -297,9 +300,9 @@ typedef struct { // private data STB_TEXTEDIT_POSITIONTYPE where; - short insert_length; - short delete_length; - short char_storage; + STB_TEXTEDIT_POSITIONTYPE insert_length; + STB_TEXTEDIT_POSITIONTYPE delete_length; + int char_storage; } StbUndoRecord; typedef struct @@ -308,7 +311,7 @@ typedef struct StbUndoRecord undo_rec [STB_TEXTEDIT_UNDOSTATECOUNT]; STB_TEXTEDIT_CHARTYPE undo_char[STB_TEXTEDIT_UNDOCHARCOUNT]; short undo_point, redo_point; - short undo_char_point, redo_char_point; + int undo_char_point, redo_char_point; } StbUndoState; typedef struct @@ -450,6 +453,15 @@ static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y) // API click: on mouse down, move the cursor to the clicked location, and reset the selection static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y) { + // In single-line mode, just always make y = 0. This lets the drag keep working if the mouse + // goes off the top or bottom of the text + if( state->single_line ) + { + StbTexteditRow r; + STB_TEXTEDIT_LAYOUTROW(&r, str, 0); + y = r.ymin; + } + state->cursor = stb_text_locate_coord(str, x, y); state->select_start = state->cursor; state->select_end = state->cursor; @@ -459,9 +471,21 @@ static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *stat // API drag: on mouse drag, move the cursor and selection endpoint to the clicked location static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y) { - int p = stb_text_locate_coord(str, x, y); + int p = 0; + + // In single-line mode, just always make y = 0. This lets the drag keep working if the mouse + // goes off the top or bottom of the text + if( state->single_line ) + { + StbTexteditRow r; + STB_TEXTEDIT_LAYOUTROW(&r, str, 0); + y = r.ymin; + } + if (state->select_start == state->select_end) state->select_start = state->cursor; + + p = stb_text_locate_coord(str, x, y); state->cursor = state->select_end = p; } @@ -677,9 +701,8 @@ static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state) } // API paste: replace existing selection with passed-in text -static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len) +static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len) { - STB_TEXTEDIT_CHARTYPE *text = (STB_TEXTEDIT_CHARTYPE *) ctext; // if there's a selection, the paste should delete it stb_textedit_clamp(str, state); stb_textedit_delete_selection(str,state); @@ -696,8 +719,12 @@ static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state return 0; } +#ifndef STB_TEXTEDIT_KEYTYPE +#define STB_TEXTEDIT_KEYTYPE int +#endif + // API key: process a keyboard input -static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int key) +static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_KEYTYPE key) { retry: switch (key) { @@ -1074,14 +1101,14 @@ static void stb_textedit_discard_undo(StbUndoState *state) if (state->undo_rec[0].char_storage >= 0) { int n = state->undo_rec[0].insert_length, i; // delete n characters from all other records - state->undo_char_point = state->undo_char_point - (short) n; // vsnet05 - STB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t) ((size_t)state->undo_char_point*sizeof(STB_TEXTEDIT_CHARTYPE))); + state->undo_char_point -= n; + STB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t) (state->undo_char_point*sizeof(STB_TEXTEDIT_CHARTYPE))); for (i=0; i < state->undo_point; ++i) if (state->undo_rec[i].char_storage >= 0) - state->undo_rec[i].char_storage = state->undo_rec[i].char_storage - (short) n; // vsnet05 // @OPTIMIZE: get rid of char_storage and infer it + state->undo_rec[i].char_storage -= n; // @OPTIMIZE: get rid of char_storage and infer it } --state->undo_point; - STB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec+1, (size_t) ((size_t)state->undo_point*sizeof(state->undo_rec[0]))); + STB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec+1, (size_t) (state->undo_point*sizeof(state->undo_rec[0]))); } } @@ -1097,14 +1124,17 @@ static void stb_textedit_discard_redo(StbUndoState *state) // if the k'th undo state has characters, clean those up if (state->undo_rec[k].char_storage >= 0) { int n = state->undo_rec[k].insert_length, i; - // delete n characters from all other records - state->redo_char_point = state->redo_char_point + (short) n; // vsnet05 - STB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((size_t)(STB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point)*sizeof(STB_TEXTEDIT_CHARTYPE))); + // move the remaining redo character data to the end of the buffer + state->redo_char_point += n; + STB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point-n, (size_t) ((STB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point)*sizeof(STB_TEXTEDIT_CHARTYPE))); + // adjust the position of all the other records to account for above memmove for (i=state->redo_point; i < k; ++i) if (state->undo_rec[i].char_storage >= 0) - state->undo_rec[i].char_storage = state->undo_rec[i].char_storage + (short) n; // vsnet05 + state->undo_rec[i].char_storage += n; } - STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point, state->undo_rec + state->redo_point-1, (size_t) ((size_t)(STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point)*sizeof(state->undo_rec[0]))); + // now move all the redo records towards the end of the buffer; the first one is at 'redo_point' + STB_TEXTEDIT_memmove(state->undo_rec + state->redo_point+1, state->undo_rec + state->redo_point, (size_t) ((STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point)*sizeof(state->undo_rec[0]))); + // now move redo_point to point to the new one ++state->redo_point; } } @@ -1140,15 +1170,15 @@ static STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos, return NULL; r->where = pos; - r->insert_length = (short) insert_len; - r->delete_length = (short) delete_len; + r->insert_length = (STB_TEXTEDIT_POSITIONTYPE) insert_len; + r->delete_length = (STB_TEXTEDIT_POSITIONTYPE) delete_len; if (insert_len == 0) { r->char_storage = -1; return NULL; } else { r->char_storage = state->undo_char_point; - state->undo_char_point = state->undo_char_point + (short) insert_len; + state->undo_char_point += insert_len; return &state->undo_char[r->char_storage]; } } @@ -1188,16 +1218,16 @@ static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state) // there's definitely room to store the characters eventually while (s->undo_char_point + u.delete_length > s->redo_char_point) { - // there's currently not enough room, so discard a redo record - stb_textedit_discard_redo(s); // should never happen: if (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT) return; + // there's currently not enough room, so discard a redo record + stb_textedit_discard_redo(s); } r = &s->undo_rec[s->redo_point-1]; r->char_storage = s->redo_char_point - u.delete_length; - s->redo_char_point = s->redo_char_point - (short) u.delete_length; + s->redo_char_point = s->redo_char_point - u.delete_length; // now save the characters for (i=0; i < u.delete_length; ++i) @@ -1319,4 +1349,61 @@ static void stb_textedit_initialize_state(STB_TexteditState *state, int is_singl { stb_textedit_clear_state(state, is_single_line); } + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif + +static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len) +{ + return stb_textedit_paste_internal(str, state, (STB_TEXTEDIT_CHARTYPE *) ctext, len); +} + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + #endif//STB_TEXTEDIT_IMPLEMENTATION + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/3rdparty/bgfx/3rdparty/stb/stb_truetype.h b/3rdparty/bgfx/3rdparty/stb/stb_truetype.h index fc5b9782181..f65deb50346 100644 --- a/3rdparty/bgfx/3rdparty/stb/stb_truetype.h +++ b/3rdparty/bgfx/3rdparty/stb/stb_truetype.h @@ -1,4 +1,4 @@ -// stb_truetype.h - v1.15 - public domain +// stb_truetype.h - v1.19 - public domain // authored from 2009-2016 by Sean Barrett / RAD Game Tools // // This library processes TrueType files: @@ -6,6 +6,7 @@ // extract glyph metrics // extract glyph shapes // render glyphs to one-channel bitmaps with antialiasing (box filter) +// render glyphs to one-channel SDF bitmaps (signed-distance field/function) // // Todo: // non-MS cmaps @@ -21,39 +22,37 @@ // Mikko Mononen: compound shape support, more cmap formats // Tor Andersson: kerning, subpixel rendering // Dougall Johnson: OpenType / Type 2 font handling +// Daniel Ribeiro Maciel: basic GPOS-based kerning // // Misc other: // Ryan Gordon // Simon Glass // github:IntellectualKitty +// Imanol Celaya +// Daniel Ribeiro Maciel // // Bug/warning reports/fixes: -// "Zer" on mollyrocket (with fix) -// Cass Everitt -// stoiko (Haemimont Games) -// Brian Hook -// Walter van Niftrik -// David Gow -// David Given -// Ivan-Assen Ivanov -// Anthony Pesch -// Johan Duparc -// Hou Qiming -// Fabian "ryg" Giesen -// Martins Mozeiko -// Cap Petschulat -// Omar Cornut -// github:aloucks -// Peter LaValle -// Sergey Popov -// Giumo X. Clanjor -// Higor Euripedes -// Thomas Fields -// Derek Vinyard -// Cort Stratton -// +// "Zer" on mollyrocket Fabian "ryg" Giesen +// Cass Everitt Martins Mozeiko +// stoiko (Haemimont Games) Cap Petschulat +// Brian Hook Omar Cornut +// Walter van Niftrik github:aloucks +// David Gow Peter LaValle +// David Given Sergey Popov +// Ivan-Assen Ivanov Giumo X. Clanjor +// Anthony Pesch Higor Euripedes +// Johan Duparc Thomas Fields +// Hou Qiming Derek Vinyard +// Rob Loach Cort Stratton +// Kenney Phillis Jr. github:oyvindjam +// Brian Costabile github:vassvik +// // VERSION HISTORY // +// 1.19 (2018-02-11) GPOS kerning, STBTT_fmod +// 1.18 (2018-01-29) add missing function +// 1.17 (2017-07-23) make more arguments const; doc fix +// 1.16 (2017-07-12) SDF support // 1.15 (2017-03-03) make more arguments const // 1.14 (2017-01-16) num-fonts-in-TTC function // 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts @@ -92,7 +91,7 @@ // Improved 3D API (more shippable): // #include "stb_rect_pack.h" -- optional, but you really want it // stbtt_PackBegin() -// stbtt_PackSetOversample() -- for improved quality on small fonts +// stbtt_PackSetOversampling() -- for improved quality on small fonts // stbtt_PackFontRanges() -- pack and renders // stbtt_PackEnd() // stbtt_GetPackedQuad() @@ -110,6 +109,7 @@ // Character advance/positioning // stbtt_GetCodepointHMetrics() // stbtt_GetFontVMetrics() +// stbtt_GetFontVMetricsOS2() // stbtt_GetCodepointKernAdvance() // // Starting with version 1.06, the rasterizer was replaced with a new, @@ -165,7 +165,7 @@ // measurement for describing font size, defined as 72 points per inch. // stb_truetype provides a point API for compatibility. However, true // "per inch" conventions don't make much sense on computer displays -// since they different monitors have different number of pixels per +// since different monitors have different number of pixels per // inch. For example, Windows traditionally uses a convention that // there are 96 pixels per inch, thus making 'inch' measurements have // nothing to do with inches, and thus effectively defining a point to @@ -175,6 +175,39 @@ // for non-commercial fonts, thus making fonts scaled in points // according to the TrueType spec incoherently sized in practice. // +// DETAILED USAGE: +// +// Scale: +// Select how high you want the font to be, in points or pixels. +// Call ScaleForPixelHeight or ScaleForMappingEmToPixels to compute +// a scale factor SF that will be used by all other functions. +// +// Baseline: +// You need to select a y-coordinate that is the baseline of where +// your text will appear. Call GetFontBoundingBox to get the baseline-relative +// bounding box for all characters. SF*-y0 will be the distance in pixels +// that the worst-case character could extend above the baseline, so if +// you want the top edge of characters to appear at the top of the +// screen where y=0, then you would set the baseline to SF*-y0. +// +// Current point: +// Set the current point where the first character will appear. The +// first character could extend left of the current point; this is font +// dependent. You can either choose a current point that is the leftmost +// point and hope, or add some padding, or check the bounding box or +// left-side-bearing of the first character to be displayed and set +// the current point based on that. +// +// Displaying a character: +// Compute the bounding box of the character. It will contain signed values +// relative to . I.e. if it returns x0,y0,x1,y1, +// then the character should be displayed in the rectangle from +// to #define STBTT_ifloor(x) ((int) floor(x)) @@ -407,6 +441,18 @@ int main(int arg, char **argv) #ifndef STBTT_sqrt #include #define STBTT_sqrt(x) sqrt(x) + #define STBTT_pow(x,y) pow(x,y) + #endif + + #ifndef STBTT_fmod + #include + #define STBTT_fmod(x,y) fmod(x,y) + #endif + + #ifndef STBTT_cos + #include + #define STBTT_cos(x) cos(x) + #define STBTT_acos(x) acos(x) #endif #ifndef STBTT_fabs @@ -432,7 +478,7 @@ int main(int arg, char **argv) #endif #ifndef STBTT_memcpy - #include + #include #define STBTT_memcpy memcpy #define STBTT_memset memset #endif @@ -548,7 +594,7 @@ STBTT_DEF void stbtt_PackEnd (stbtt_pack_context *spc); #define STBTT_POINT_SIZE(x) (-(x)) -STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, float font_size, +STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size, int first_unicode_char_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range); // Creates character bitmaps from the font_index'th font found in fontdata (use // font_index=0 if you don't know what that is). It creates num_chars_in_range @@ -573,7 +619,7 @@ typedef struct unsigned char h_oversample, v_oversample; // don't set these, they're used internally } stbtt_pack_range; -STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges); +STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges); // Creates character bitmaps from multiple ranges of characters stored in // ranges. This will usually create a better-packed bitmap than multiple // calls to stbtt_PackFontRange. Note that you can call this multiple @@ -658,7 +704,7 @@ struct stbtt_fontinfo int numGlyphs; // number of glyphs, needed for range checking - int loca,head,glyf,hhea,hmtx,kern; // table locations as offset from start of .ttf + int loca,head,glyf,hhea,hmtx,kern,gpos; // table locations as offset from start of .ttf int index_map; // a cmap mapping for our chosen character encoding int indexToLocFormat; // format needed to map from glyph index to glyph @@ -715,6 +761,12 @@ STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, in // these are expressed in unscaled coordinates, so you must multiply by // the scale factor for a given size +STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap); +// analogous to GetFontVMetrics, but returns the "typographic" values from the OS/2 +// table (specific to MS/Windows TTF files). +// +// Returns 1 on success (table present), 0 on failure. + STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1); // the bounding box around all possible characters @@ -809,6 +861,10 @@ STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, uns // same as stbtt_MakeCodepointBitmap, but you can specify a subpixel // shift for the character +STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint); +// same as stbtt_MakeCodepointBitmapSubpixel, but prefiltering +// is performed (see stbtt_PackSetOversampling) + STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); // get the bbox of the bitmap centered around the glyph origin; so the // bitmap width is ix1-ix0, height is iy1-iy0, and location to place @@ -826,6 +882,7 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff); STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph); STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph); +STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int glyph); STBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1); STBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y,float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1); @@ -848,6 +905,64 @@ STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, // 1-channel bitmap int invert, // if non-zero, vertically flip shape void *userdata); // context for to STBTT_MALLOC +////////////////////////////////////////////////////////////////////////////// +// +// Signed Distance Function (or Field) rendering + +STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata); +// frees the SDF bitmap allocated below + +STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); +STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff); +// These functions compute a discretized SDF field for a single character, suitable for storing +// in a single-channel texture, sampling with bilinear filtering, and testing against +// larger than some threshhold to produce scalable fonts. +// info -- the font +// scale -- controls the size of the resulting SDF bitmap, same as it would be creating a regular bitmap +// glyph/codepoint -- the character to generate the SDF for +// padding -- extra "pixels" around the character which are filled with the distance to the character (not 0), +// which allows effects like bit outlines +// onedge_value -- value 0-255 to test the SDF against to reconstruct the character (i.e. the isocontour of the character) +// pixel_dist_scale -- what value the SDF should increase by when moving one SDF "pixel" away from the edge (on the 0..255 scale) +// if positive, > onedge_value is inside; if negative, < onedge_value is inside +// width,height -- output height & width of the SDF bitmap (including padding) +// xoff,yoff -- output origin of the character +// return value -- a 2D array of bytes 0..255, width*height in size +// +// pixel_dist_scale & onedge_value are a scale & bias that allows you to make +// optimal use of the limited 0..255 for your application, trading off precision +// and special effects. SDF values outside the range 0..255 are clamped to 0..255. +// +// Example: +// scale = stbtt_ScaleForPixelHeight(22) +// padding = 5 +// onedge_value = 180 +// pixel_dist_scale = 180/5.0 = 36.0 +// +// This will create an SDF bitmap in which the character is about 22 pixels +// high but the whole bitmap is about 22+5+5=32 pixels high. To produce a filled +// shape, sample the SDF at each pixel and fill the pixel if the SDF value +// is greater than or equal to 180/255. (You'll actually want to antialias, +// which is beyond the scope of this example.) Additionally, you can compute +// offset outlines (e.g. to stroke the character border inside & outside, +// or only outside). For example, to fill outside the character up to 3 SDF +// pixels, you would compare against (180-36.0*3)/255 = 72/255. The above +// choice of variables maps a range from 5 pixels outside the shape to +// 2 pixels inside the shape to 0..255; this is intended primarily for apply +// outside effects only (the interior range is needed to allow proper +// antialiasing of the font at *smaller* sizes) +// +// The function computes the SDF analytically at each SDF pixel, not by e.g. +// building a higher-res bitmap and approximating it. In theory the quality +// should be as high as possible for an SDF of this size & representation, but +// unclear if this is true in practice (perhaps building a higher-res bitmap +// and computing from that can allow drop-out prevention). +// +// The algorithm has not been optimized at all, so expect it to be slow +// if computing lots of characters or very large sizes. + + + ////////////////////////////////////////////////////////////////////////////// // // Finding the right font... @@ -1232,6 +1347,7 @@ static int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, in info->hhea = stbtt__find_table(data, fontstart, "hhea"); // required info->hmtx = stbtt__find_table(data, fontstart, "hmtx"); // required info->kern = stbtt__find_table(data, fontstart, "kern"); // not required + info->gpos = stbtt__find_table(data, fontstart, "GPOS"); // not required if (!cmap || !info->head || !info->hhea || !info->hmtx) return 0; @@ -2085,7 +2201,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st // push immediate if (b0 == 255) { - f = (float)stbtt__buf_get32(&b) / 0x10000; + f = (float)(stbtt_int32)stbtt__buf_get32(&b) / 0x10000; } else { stbtt__buf_skip(&b, -1); f = (float)(stbtt_int16)stbtt__cff_int(&b); @@ -2123,12 +2239,10 @@ static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, in { stbtt__csctx c = STBTT__CSCTX_INIT(1); int r = stbtt__run_charstring(info, glyph_index, &c); - if (x0) { - *x0 = r ? c.min_x : 0; - *y0 = r ? c.min_y : 0; - *x1 = r ? c.max_x : 0; - *y1 = r ? c.max_y : 0; - } + if (x0) *x0 = r ? c.min_x : 0; + if (y0) *y0 = r ? c.min_y : 0; + if (x1) *x1 = r ? c.max_x : 0; + if (y1) *y1 = r ? c.max_y : 0; return r ? c.num_vertices : 0; } @@ -2152,7 +2266,7 @@ STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_inde } } -STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) +static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) { stbtt_uint8 *data = info->data + info->kern; stbtt_uint32 needle, straw; @@ -2182,9 +2296,261 @@ STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, return 0; } +static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph) +{ + stbtt_uint16 coverageFormat = ttUSHORT(coverageTable); + switch(coverageFormat) { + case 1: { + stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2); + + // Binary search. + stbtt_int32 l=0, r=glyphCount-1, m; + int straw, needle=glyph; + while (l <= r) { + stbtt_uint8 *glyphArray = coverageTable + 4; + stbtt_uint16 glyphID; + m = (l + r) >> 1; + glyphID = ttUSHORT(glyphArray + 2 * m); + straw = glyphID; + if (needle < straw) + r = m - 1; + else if (needle > straw) + l = m + 1; + else { + return m; + } + } + } break; + + case 2: { + stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2); + stbtt_uint8 *rangeArray = coverageTable + 4; + + // Binary search. + stbtt_int32 l=0, r=rangeCount-1, m; + int strawStart, strawEnd, needle=glyph; + while (l <= r) { + stbtt_uint8 *rangeRecord; + m = (l + r) >> 1; + rangeRecord = rangeArray + 6 * m; + strawStart = ttUSHORT(rangeRecord); + strawEnd = ttUSHORT(rangeRecord + 2); + if (needle < strawStart) + r = m - 1; + else if (needle > strawEnd) + l = m + 1; + else { + stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4); + return startCoverageIndex + glyph - strawStart; + } + } + } break; + + default: { + // There are no other cases. + STBTT_assert(0); + } break; + } + + return -1; +} + +static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph) +{ + stbtt_uint16 classDefFormat = ttUSHORT(classDefTable); + switch(classDefFormat) + { + case 1: { + stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2); + stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4); + stbtt_uint8 *classDef1ValueArray = classDefTable + 6; + + if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount) + return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID)); + + classDefTable = classDef1ValueArray + 2 * glyphCount; + } break; + + case 2: { + stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2); + stbtt_uint8 *classRangeRecords = classDefTable + 4; + + // Binary search. + stbtt_int32 l=0, r=classRangeCount-1, m; + int strawStart, strawEnd, needle=glyph; + while (l <= r) { + stbtt_uint8 *classRangeRecord; + m = (l + r) >> 1; + classRangeRecord = classRangeRecords + 6 * m; + strawStart = ttUSHORT(classRangeRecord); + strawEnd = ttUSHORT(classRangeRecord + 2); + if (needle < strawStart) + r = m - 1; + else if (needle > strawEnd) + l = m + 1; + else + return (stbtt_int32)ttUSHORT(classRangeRecord + 4); + } + + classDefTable = classRangeRecords + 6 * classRangeCount; + } break; + + default: { + // There are no other cases. + STBTT_assert(0); + } break; + } + + return -1; +} + +// Define to STBTT_assert(x) if you want to break on unimplemented formats. +#define STBTT_GPOS_TODO_assert(x) + +static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) +{ + stbtt_uint16 lookupListOffset; + stbtt_uint8 *lookupList; + stbtt_uint16 lookupCount; + stbtt_uint8 *data; + stbtt_int32 i; + + if (!info->gpos) return 0; + + data = info->data + info->gpos; + + if (ttUSHORT(data+0) != 1) return 0; // Major version 1 + if (ttUSHORT(data+2) != 0) return 0; // Minor version 0 + + lookupListOffset = ttUSHORT(data+8); + lookupList = data + lookupListOffset; + lookupCount = ttUSHORT(lookupList); + + for (i=0; i> 1; + pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m; + secondGlyph = ttUSHORT(pairValue); + straw = secondGlyph; + if (needle < straw) + r = m - 1; + else if (needle > straw) + l = m + 1; + else { + stbtt_int16 xAdvance = ttSHORT(pairValue + 2); + return xAdvance; + } + } + } break; + + case 2: { + stbtt_uint16 valueFormat1 = ttUSHORT(table + 4); + stbtt_uint16 valueFormat2 = ttUSHORT(table + 6); + + stbtt_uint16 classDef1Offset = ttUSHORT(table + 8); + stbtt_uint16 classDef2Offset = ttUSHORT(table + 10); + int glyph1class = stbtt__GetGlyphClass(table + classDef1Offset, glyph1); + int glyph2class = stbtt__GetGlyphClass(table + classDef2Offset, glyph2); + + stbtt_uint16 class1Count = ttUSHORT(table + 12); + stbtt_uint16 class2Count = ttUSHORT(table + 14); + STBTT_assert(glyph1class < class1Count); + STBTT_assert(glyph2class < class2Count); + + // TODO: Support more formats. + STBTT_GPOS_TODO_assert(valueFormat1 == 4); + if (valueFormat1 != 4) return 0; + STBTT_GPOS_TODO_assert(valueFormat2 == 0); + if (valueFormat2 != 0) return 0; + + if (glyph1class >= 0 && glyph1class < class1Count && glyph2class >= 0 && glyph2class < class2Count) { + stbtt_uint8 *class1Records = table + 16; + stbtt_uint8 *class2Records = class1Records + 2 * (glyph1class * class2Count); + stbtt_int16 xAdvance = ttSHORT(class2Records + 2 * glyph2class); + return xAdvance; + } + } break; + + default: { + // There are no other cases. + STBTT_assert(0); + break; + }; + } + } + break; + }; + + default: + // TODO: Implement other stuff. + break; + } + } + + return 0; +} + +STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int g2) +{ + int xAdvance = 0; + + if (info->gpos) + xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2); + + if (info->kern) + xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2); + + return xAdvance; +} + STBTT_DEF int stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2) { - if (!info->kern) // if no kerning table, don't waste time looking up both codepoint->glyphs + if (!info->kern && !info->gpos) // if no kerning table, don't waste time looking up both codepoint->glyphs return 0; return stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info,ch1), stbtt_FindGlyphIndex(info,ch2)); } @@ -2201,6 +2567,17 @@ STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, in if (lineGap) *lineGap = ttSHORT(info->data+info->hhea + 8); } +STBTT_DEF int stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int *typoAscent, int *typoDescent, int *typoLineGap) +{ + int tab = stbtt__find_table(info->data, info->fontstart, "OS/2"); + if (!tab) + return 0; + if (typoAscent ) *typoAscent = ttSHORT(info->data+tab + 68); + if (typoDescent) *typoDescent = ttSHORT(info->data+tab + 70); + if (typoLineGap) *typoLineGap = ttSHORT(info->data+tab + 72); + return 1; +} + STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1) { *x0 = ttSHORT(info->data + info->head + 36); @@ -2297,7 +2674,7 @@ static void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata) hh->num_remaining_in_head_chunk = count; } --hh->num_remaining_in_head_chunk; - return (char *) (hh->head) + size * hh->num_remaining_in_head_chunk; + return (char *) (hh->head) + sizeof(stbtt__hheap_chunk) + size * hh->num_remaining_in_head_chunk; } } @@ -2693,19 +3070,18 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, // from the other y segment, and it might ignored as an empty segment. to avoid // that, we need to explicitly produce segments based on x positions. - // rename variables to clear pairs + // rename variables to clearly-defined pairs float y0 = y_top; float x1 = (float) (x); float x2 = (float) (x+1); float x3 = xb; float y3 = y_bottom; - float y1,y2; // x = e->x + e->dx * (y-y_top) // (y-y_top) = (x - e->x) / e->dx // y = (x - e->x) / e->dx + y_top - y1 = (x - x0) / dx + y_top; - y2 = (x+1 - x0) / dx + y_top; + float y1 = (x - x0) / dx + y_top; + float y2 = (x+1 - x0) / dx + y_top; if (x0 < x1 && x3 > x2) { // three segments descending down-right stbtt__handle_clipped_edge(scanline,x,e, x0,y0, x1,y1); @@ -3132,8 +3508,9 @@ error: STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata) { - float scale = scale_x > scale_y ? scale_y : scale_x; - int winding_count, *winding_lengths; + float scale = scale_x > scale_y ? scale_y : scale_x; + int winding_count = 0; + int *winding_lengths = NULL; stbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata); if (windings) { stbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, invert, userdata); @@ -3221,6 +3598,11 @@ STBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo * return stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y,shift_x,shift_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff); } +STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int oversample_x, int oversample_y, float *sub_x, float *sub_y, int codepoint) +{ + stbtt_MakeGlyphBitmapSubpixelPrefilter(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, oversample_x, oversample_y, sub_x, sub_y, stbtt_FindGlyphIndex(info,codepoint)); +} + STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint) { stbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info,codepoint)); @@ -3600,6 +3982,29 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stb return k; } +STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int prefilter_x, int prefilter_y, float *sub_x, float *sub_y, int glyph) +{ + stbtt_MakeGlyphBitmapSubpixel(info, + output, + out_w - (prefilter_x - 1), + out_h - (prefilter_y - 1), + out_stride, + scale_x, + scale_y, + shift_x, + shift_y, + glyph); + + if (prefilter_x > 1) + stbtt__h_prefilter(output, out_w, out_h, out_stride, prefilter_x); + + if (prefilter_y > 1) + stbtt__v_prefilter(output, out_w, out_h, out_stride, prefilter_y); + + *sub_x = stbtt__oversample_shift(prefilter_x); + *sub_y = stbtt__oversample_shift(prefilter_y); +} + // rects array must be big enough to accommodate all characters in the given ranges STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects) { @@ -3688,7 +4093,7 @@ STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect stbrp_pack_rects((stbrp_context *) spc->pack_info, rects, num_rects); } -STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges) +STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges) { stbtt_fontinfo info; int i,j,n, return_value = 1; @@ -3724,7 +4129,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd return return_value; } -STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, float font_size, +STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, float font_size, int first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range) { stbtt_pack_range range; @@ -3763,6 +4168,387 @@ STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int pw, int *xpos += b->xadvance; } +////////////////////////////////////////////////////////////////////////////// +// +// sdf computation +// + +#define STBTT_min(a,b) ((a) < (b) ? (a) : (b)) +#define STBTT_max(a,b) ((a) < (b) ? (b) : (a)) + +static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], float q0[2], float q1[2], float q2[2], float hits[2][2]) +{ + float q0perp = q0[1]*ray[0] - q0[0]*ray[1]; + float q1perp = q1[1]*ray[0] - q1[0]*ray[1]; + float q2perp = q2[1]*ray[0] - q2[0]*ray[1]; + float roperp = orig[1]*ray[0] - orig[0]*ray[1]; + + float a = q0perp - 2*q1perp + q2perp; + float b = q1perp - q0perp; + float c = q0perp - roperp; + + float s0 = 0., s1 = 0.; + int num_s = 0; + + if (a != 0.0) { + float discr = b*b - a*c; + if (discr > 0.0) { + float rcpna = -1 / a; + float d = (float) STBTT_sqrt(discr); + s0 = (b+d) * rcpna; + s1 = (b-d) * rcpna; + if (s0 >= 0.0 && s0 <= 1.0) + num_s = 1; + if (d > 0.0 && s1 >= 0.0 && s1 <= 1.0) { + if (num_s == 0) s0 = s1; + ++num_s; + } + } + } else { + // 2*b*s + c = 0 + // s = -c / (2*b) + s0 = c / (-2 * b); + if (s0 >= 0.0 && s0 <= 1.0) + num_s = 1; + } + + if (num_s == 0) + return 0; + else { + float rcp_len2 = 1 / (ray[0]*ray[0] + ray[1]*ray[1]); + float rayn_x = ray[0] * rcp_len2, rayn_y = ray[1] * rcp_len2; + + float q0d = q0[0]*rayn_x + q0[1]*rayn_y; + float q1d = q1[0]*rayn_x + q1[1]*rayn_y; + float q2d = q2[0]*rayn_x + q2[1]*rayn_y; + float rod = orig[0]*rayn_x + orig[1]*rayn_y; + + float q10d = q1d - q0d; + float q20d = q2d - q0d; + float q0rd = q0d - rod; + + hits[0][0] = q0rd + s0*(2.0f - 2.0f*s0)*q10d + s0*s0*q20d; + hits[0][1] = a*s0+b; + + if (num_s > 1) { + hits[1][0] = q0rd + s1*(2.0f - 2.0f*s1)*q10d + s1*s1*q20d; + hits[1][1] = a*s1+b; + return 2; + } else { + return 1; + } + } +} + +static int equal(float *a, float *b) +{ + return (a[0] == b[0] && a[1] == b[1]); +} + +static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex *verts) +{ + int i; + float orig[2], ray[2] = { 1, 0 }; + float y_frac; + int winding = 0; + + orig[0] = x; + orig[1] = y; + + // make sure y never passes through a vertex of the shape + y_frac = (float) STBTT_fmod(y, 1.0f); + if (y_frac < 0.01f) + y += 0.01f; + else if (y_frac > 0.99f) + y -= 0.01f; + orig[1] = y; + + // test a ray from (-infinity,y) to (x,y) + for (i=0; i < nverts; ++i) { + if (verts[i].type == STBTT_vline) { + int x0 = (int) verts[i-1].x, y0 = (int) verts[i-1].y; + int x1 = (int) verts[i ].x, y1 = (int) verts[i ].y; + if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) { + float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0; + if (x_inter < x) + winding += (y0 < y1) ? 1 : -1; + } + } + if (verts[i].type == STBTT_vcurve) { + int x0 = (int) verts[i-1].x , y0 = (int) verts[i-1].y ; + int x1 = (int) verts[i ].cx, y1 = (int) verts[i ].cy; + int x2 = (int) verts[i ].x , y2 = (int) verts[i ].y ; + int ax = STBTT_min(x0,STBTT_min(x1,x2)), ay = STBTT_min(y0,STBTT_min(y1,y2)); + int by = STBTT_max(y0,STBTT_max(y1,y2)); + if (y > ay && y < by && x > ax) { + float q0[2],q1[2],q2[2]; + float hits[2][2]; + q0[0] = (float)x0; + q0[1] = (float)y0; + q1[0] = (float)x1; + q1[1] = (float)y1; + q2[0] = (float)x2; + q2[1] = (float)y2; + if (equal(q0,q1) || equal(q1,q2)) { + x0 = (int)verts[i-1].x; + y0 = (int)verts[i-1].y; + x1 = (int)verts[i ].x; + y1 = (int)verts[i ].y; + if (y > STBTT_min(y0,y1) && y < STBTT_max(y0,y1) && x > STBTT_min(x0,x1)) { + float x_inter = (y - y0) / (y1 - y0) * (x1-x0) + x0; + if (x_inter < x) + winding += (y0 < y1) ? 1 : -1; + } + } else { + int num_hits = stbtt__ray_intersect_bezier(orig, ray, q0, q1, q2, hits); + if (num_hits >= 1) + if (hits[0][0] < 0) + winding += (hits[0][1] < 0 ? -1 : 1); + if (num_hits >= 2) + if (hits[1][0] < 0) + winding += (hits[1][1] < 0 ? -1 : 1); + } + } + } + } + return winding; +} + +static float stbtt__cuberoot( float x ) +{ + if (x<0) + return -(float) STBTT_pow(-x,1.0f/3.0f); + else + return (float) STBTT_pow( x,1.0f/3.0f); +} + +// x^3 + c*x^2 + b*x + a = 0 +static int stbtt__solve_cubic(float a, float b, float c, float* r) +{ + float s = -a / 3; + float p = b - a*a / 3; + float q = a * (2*a*a - 9*b) / 27 + c; + float p3 = p*p*p; + float d = q*q + 4*p3 / 27; + if (d >= 0) { + float z = (float) STBTT_sqrt(d); + float u = (-q + z) / 2; + float v = (-q - z) / 2; + u = stbtt__cuberoot(u); + v = stbtt__cuberoot(v); + r[0] = s + u + v; + return 1; + } else { + float u = (float) STBTT_sqrt(-p/3); + float v = (float) STBTT_acos(-STBTT_sqrt(-27/p3) * q / 2) / 3; // p3 must be negative, since d is negative + float m = (float) STBTT_cos(v); + float n = (float) STBTT_cos(v-3.141592/2)*1.732050808f; + r[0] = s + u * 2 * m; + r[1] = s - u * (m + n); + r[2] = s - u * (m - n); + + //STBTT_assert( STBTT_fabs(((r[0]+a)*r[0]+b)*r[0]+c) < 0.05f); // these asserts may not be safe at all scales, though they're in bezier t parameter units so maybe? + //STBTT_assert( STBTT_fabs(((r[1]+a)*r[1]+b)*r[1]+c) < 0.05f); + //STBTT_assert( STBTT_fabs(((r[2]+a)*r[2]+b)*r[2]+c) < 0.05f); + return 3; + } +} + +STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float scale, int glyph, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff) +{ + float scale_x = scale, scale_y = scale; + int ix0,iy0,ix1,iy1; + int w,h; + unsigned char *data; + + // if one scale is 0, use same scale for both + if (scale_x == 0) scale_x = scale_y; + if (scale_y == 0) { + if (scale_x == 0) return NULL; // if both scales are 0, return NULL + scale_y = scale_x; + } + + stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale, scale, 0.0f,0.0f, &ix0,&iy0,&ix1,&iy1); + + // if empty, return NULL + if (ix0 == ix1 || iy0 == iy1) + return NULL; + + ix0 -= padding; + iy0 -= padding; + ix1 += padding; + iy1 += padding; + + w = (ix1 - ix0); + h = (iy1 - iy0); + + if (width ) *width = w; + if (height) *height = h; + if (xoff ) *xoff = ix0; + if (yoff ) *yoff = iy0; + + // invert for y-downwards bitmaps + scale_y = -scale_y; + + { + int x,y,i,j; + float *precompute; + stbtt_vertex *verts; + int num_verts = stbtt_GetGlyphShape(info, glyph, &verts); + data = (unsigned char *) STBTT_malloc(w * h, info->userdata); + precompute = (float *) STBTT_malloc(num_verts * sizeof(float), info->userdata); + + for (i=0,j=num_verts-1; i < num_verts; j=i++) { + if (verts[i].type == STBTT_vline) { + float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y; + float x1 = verts[j].x*scale_x, y1 = verts[j].y*scale_y; + float dist = (float) STBTT_sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0)); + precompute[i] = (dist == 0) ? 0.0f : 1.0f / dist; + } else if (verts[i].type == STBTT_vcurve) { + float x2 = verts[j].x *scale_x, y2 = verts[j].y *scale_y; + float x1 = verts[i].cx*scale_x, y1 = verts[i].cy*scale_y; + float x0 = verts[i].x *scale_x, y0 = verts[i].y *scale_y; + float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2; + float len2 = bx*bx + by*by; + if (len2 != 0.0f) + precompute[i] = 1.0f / (bx*bx + by*by); + else + precompute[i] = 0.0f; + } else + precompute[i] = 0.0f; + } + + for (y=iy0; y < iy1; ++y) { + for (x=ix0; x < ix1; ++x) { + float val; + float min_dist = 999999.0f; + float sx = (float) x + 0.5f; + float sy = (float) y + 0.5f; + float x_gspace = (sx / scale_x); + float y_gspace = (sy / scale_y); + + int winding = stbtt__compute_crossings_x(x_gspace, y_gspace, num_verts, verts); // @OPTIMIZE: this could just be a rasterization, but needs to be line vs. non-tesselated curves so a new path + + for (i=0; i < num_verts; ++i) { + float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y; + + // check against every point here rather than inside line/curve primitives -- @TODO: wrong if multiple 'moves' in a row produce a garbage point, and given culling, probably more efficient to do within line/curve + float dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy); + if (dist2 < min_dist*min_dist) + min_dist = (float) STBTT_sqrt(dist2); + + if (verts[i].type == STBTT_vline) { + float x1 = verts[i-1].x*scale_x, y1 = verts[i-1].y*scale_y; + + // coarse culling against bbox + //if (sx > STBTT_min(x0,x1)-min_dist && sx < STBTT_max(x0,x1)+min_dist && + // sy > STBTT_min(y0,y1)-min_dist && sy < STBTT_max(y0,y1)+min_dist) + float dist = (float) STBTT_fabs((x1-x0)*(y0-sy) - (y1-y0)*(x0-sx)) * precompute[i]; + STBTT_assert(i != 0); + if (dist < min_dist) { + // check position along line + // x' = x0 + t*(x1-x0), y' = y0 + t*(y1-y0) + // minimize (x'-sx)*(x'-sx)+(y'-sy)*(y'-sy) + float dx = x1-x0, dy = y1-y0; + float px = x0-sx, py = y0-sy; + // minimize (px+t*dx)^2 + (py+t*dy)^2 = px*px + 2*px*dx*t + t^2*dx*dx + py*py + 2*py*dy*t + t^2*dy*dy + // derivative: 2*px*dx + 2*py*dy + (2*dx*dx+2*dy*dy)*t, set to 0 and solve + float t = -(px*dx + py*dy) / (dx*dx + dy*dy); + if (t >= 0.0f && t <= 1.0f) + min_dist = dist; + } + } else if (verts[i].type == STBTT_vcurve) { + float x2 = verts[i-1].x *scale_x, y2 = verts[i-1].y *scale_y; + float x1 = verts[i ].cx*scale_x, y1 = verts[i ].cy*scale_y; + float box_x0 = STBTT_min(STBTT_min(x0,x1),x2); + float box_y0 = STBTT_min(STBTT_min(y0,y1),y2); + float box_x1 = STBTT_max(STBTT_max(x0,x1),x2); + float box_y1 = STBTT_max(STBTT_max(y0,y1),y2); + // coarse culling against bbox to avoid computing cubic unnecessarily + if (sx > box_x0-min_dist && sx < box_x1+min_dist && sy > box_y0-min_dist && sy < box_y1+min_dist) { + int num=0; + float ax = x1-x0, ay = y1-y0; + float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2; + float mx = x0 - sx, my = y0 - sy; + float res[3],px,py,t,it; + float a_inv = precompute[i]; + if (a_inv == 0.0) { // if a_inv is 0, it's 2nd degree so use quadratic formula + float a = 3*(ax*bx + ay*by); + float b = 2*(ax*ax + ay*ay) + (mx*bx+my*by); + float c = mx*ax+my*ay; + if (a == 0.0) { // if a is 0, it's linear + if (b != 0.0) { + res[num++] = -c/b; + } + } else { + float discriminant = b*b - 4*a*c; + if (discriminant < 0) + num = 0; + else { + float root = (float) STBTT_sqrt(discriminant); + res[0] = (-b - root)/(2*a); + res[1] = (-b + root)/(2*a); + num = 2; // don't bother distinguishing 1-solution case, as code below will still work + } + } + } else { + float b = 3*(ax*bx + ay*by) * a_inv; // could precompute this as it doesn't depend on sample point + float c = (2*(ax*ax + ay*ay) + (mx*bx+my*by)) * a_inv; + float d = (mx*ax+my*ay) * a_inv; + num = stbtt__solve_cubic(b, c, d, res); + } + if (num >= 1 && res[0] >= 0.0f && res[0] <= 1.0f) { + t = res[0], it = 1.0f - t; + px = it*it*x0 + 2*t*it*x1 + t*t*x2; + py = it*it*y0 + 2*t*it*y1 + t*t*y2; + dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy); + if (dist2 < min_dist * min_dist) + min_dist = (float) STBTT_sqrt(dist2); + } + if (num >= 2 && res[1] >= 0.0f && res[1] <= 1.0f) { + t = res[1], it = 1.0f - t; + px = it*it*x0 + 2*t*it*x1 + t*t*x2; + py = it*it*y0 + 2*t*it*y1 + t*t*y2; + dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy); + if (dist2 < min_dist * min_dist) + min_dist = (float) STBTT_sqrt(dist2); + } + if (num >= 3 && res[2] >= 0.0f && res[2] <= 1.0f) { + t = res[2], it = 1.0f - t; + px = it*it*x0 + 2*t*it*x1 + t*t*x2; + py = it*it*y0 + 2*t*it*y1 + t*t*y2; + dist2 = (px-sx)*(px-sx) + (py-sy)*(py-sy); + if (dist2 < min_dist * min_dist) + min_dist = (float) STBTT_sqrt(dist2); + } + } + } + } + if (winding == 0) + min_dist = -min_dist; // if outside the shape, value is negative + val = onedge_value + pixel_dist_scale * min_dist; + if (val < 0) + val = 0; + else if (val > 255) + val = 255; + data[(y-iy0)*w+(x-ix0)] = (unsigned char) val; + } + } + STBTT_free(precompute, info->userdata); + STBTT_free(verts, info->userdata); + } + return data; +} + +STBTT_DEF unsigned char * stbtt_GetCodepointSDF(const stbtt_fontinfo *info, float scale, int codepoint, int padding, unsigned char onedge_value, float pixel_dist_scale, int *width, int *height, int *xoff, int *yoff) +{ + return stbtt_GetGlyphSDF(info, scale, stbtt_FindGlyphIndex(info, codepoint), padding, onedge_value, pixel_dist_scale, width, height, xoff, yoff); +} + +STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata) +{ + STBTT_free(bitmap, userdata); +} ////////////////////////////////////////////////////////////////////////////// // @@ -3970,6 +4756,13 @@ STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const // FULL VERSION HISTORY // +// 1.19 (2018-02-11) OpenType GPOS kerning (horizontal only), STBTT_fmod +// 1.18 (2018-01-29) add missing function +// 1.17 (2017-07-23) make more arguments const; doc fix +// 1.16 (2017-07-12) SDF support +// 1.15 (2017-03-03) make more arguments const +// 1.14 (2017-01-16) num-fonts-in-TTC function +// 1.13 (2017-01-02) support OpenType fonts, certain Apple fonts // 1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual // 1.11 (2016-04-02) fix unused-variable warning // 1.10 (2016-04-02) allow user-defined fabs() replacement diff --git a/3rdparty/bgfx/LICENSE b/3rdparty/bgfx/LICENSE index dd17ed45ef3..3df43e30a2a 100644 --- a/3rdparty/bgfx/LICENSE +++ b/3rdparty/bgfx/LICENSE @@ -1,4 +1,4 @@ -Copyright 2010-2017 Branimir Karadzic. All rights reserved. +Copyright 2010-2018 Branimir Karadzic. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/3rdparty/bgfx/README.md b/3rdparty/bgfx/README.md index d1d79870a7f..32d2295113b 100644 --- a/3rdparty/bgfx/README.md +++ b/3rdparty/bgfx/README.md @@ -16,8 +16,8 @@ Supported rendering backends: * Direct3D 9 * Direct3D 11 - * Direct3D 12 (WIP) - * Metal (WIP) + * Direct3D 12 + * Metal * OpenGL 2.1 * OpenGL 3.1+ * OpenGL ES 2 @@ -25,10 +25,6 @@ Supported rendering backends: * WebGL 1.0 * WebGL 2.0 -Supported HMD: - - * OculusVR (1.3.0) - Supported platforms: * Android (14+, ARM, x86, MIPS) @@ -37,17 +33,17 @@ Supported platforms: * iOS (iPhone, iPad, AppleTV) * Linux * MIPS Creator CI20 - * OSX (10.9+) + * OSX (10.12+) * RaspberryPi * SteamLink * Windows (XP, Vista, 7, 8, 10) - * WinRT (WinPhone 8.0+) + * UWP (Universal Windows, Xbox One) Supported compilers: * Clang 3.3 and above - * GCC 4.6 and above - * VS2015 and above + * GCC 5 and above + * VS2017 and above Languages: @@ -79,8 +75,8 @@ Languages: [Tools](https://bkaradzic.github.io/bgfx/tools.html) ---------------------------------------------------- -Who is using it? ----------------- +Who is using it? #madewithbgfx +------------------------------ ## Airmech @@ -115,12 +111,6 @@ derivative of the original Torque Engine. target="_blank">Torque 6 Material Editor -## twinkle - -https://github.com/cgbystrom/twinkle GPU-accelerated UI framework powered by -JavaScript for desktop/mobile apps. Idea is to combine the fast workflow and -deployment model of web with the performance of native code and GPU acceleration. - ## Lumix Engine https://github.com/nem0/LumixEngine LumixEngine is a MIT licensed 3D engine. @@ -210,7 +200,7 @@ width="640" height="480" border="0" /> https://github.com/volcoma/EtherealEngine EtherealEngine C++ Game Engine and WYSIWYG Editor -![EtherealEngine screenshot](https://cloud.githubusercontent.com/assets/1499411/19988985/2a302204-a22c-11e6-98af-5f446d0c79ac.png) +![EtherealEngine screenshot](https://user-images.githubusercontent.com/1499411/29488403-ff3c3df6-8512-11e7-869f-32a783530cc3.png) ## Go Rally @@ -228,26 +218,21 @@ https://github.com/s1ddok/Fiber2D#fiber2d - Fiber2D - Cross-platform 2D Game Engine in pure Swift ![Fiber2D Demo Gif](http://imgur.com/CP6d9kT.gif) -## On the Hunt +## On the Hunt / Lumix Engine http://www.indiedb.com/games/on-the-hunt - On the Hunt is an open world hunting -game in development. It's a combination of FPS and stealth. -![On the Hunt](http://media.indiedb.com/images/downloads/1/120/119448/img.png) +game in development. It's a combination of FPS and stealth. -## FbxPipeline - -https://github.com/VladSerhiienko/FbxPipeline - Yet another FBX exporter with -flatbuffers serialization. - -## FRAG - Framework for Rather Awesome Games - -http://fragworks.io/ - FRAG is a cross-platform 2D game creation framework for -the Nim programming language. + ## vg-renderer https://github.com/jdryg/vg-renderer#vg-renderer - A vector graphics renderer -for bgfx, based on ideas from both NanoVG and ImDrawList (Dear ImGUI) +for bgfx, based on ideas from both NanoVG and ImDrawList (Dear ImGUI) +![vg-renderer](https://raw.githubusercontent.com/jdryg/vg-renderer/master/img/vgrenderer_tiger.png) ## Zombie Safari @@ -284,6 +269,66 @@ target="_blank">Match Engine | Football Manager 2018 +## WonderWorlds + +http://wonderworlds.me/ - WonderWorlds is a place to play thousands +of user-created levels and stories, make your own using the extensive in-game +tools and share them with whomever you want. + + + +## mud + +https://hugoam.github.io/mud-io/ - an all-purpose c++ app prototyping library, +focused towards live graphical apps and games. + +![mud](https://raw.githubusercontent.com/hugoam/mud-io/master/media/14_live_gfx.png) + +## Talking Tom Pool + +https://outfit7.com/apps/talking-tom-pool/ - "Sling and match†puzzle game for +mobile devices. + + + +## GPlayEngine + +https://github.com/fredakilla/GPlayEngine#gplayengine - GPlayEngine is C++ +cross-platform game engine for creating 2D/3D games based on the GamePlay 3D +engine v3.0. + +![](https://camo.githubusercontent.com/d89a364fb306f208ca14a58267c8303f60f0f0cf/68747470733a2f2f692e696d6775722e636f6d2f306569395932382e706e67) + +## Off The Road + +http://www.dogbytegames.com/off_the_road.html - Sandbox off-road driving +simulator. + + + +## Coal Burnout + +https://beardsvibe.com/ - Multiplayer PVP rhythm game. + +![coal-burnout](https://beardsvibe.com/scr/0l.png) + +## Project Aero + +https://www.adobe.com/products/projectaero.html - Project Aero, a powerful new +augmented reality (AR) authoring tool that makes it easier for designers to +create immersive content. + +![project-aero](https://www.adobe.com/content/dam/acom/en/products/aero/pod2.jpg/_jcr_content/renditions/cq5dam.mobile_640.640.462.jpg) + [License (BSD 2-clause)](https://bkaradzic.github.io/bgfx/license.html) ----------------------------------------------------------------------- @@ -291,7 +336,7 @@ width="640" height="480" border="0" /> - Copyright 2010-2017 Branimir Karadzic. All rights reserved. + Copyright 2010-2018 Branimir Karadzic. All rights reserved. https://github.com/bkaradzic/bgfx diff --git a/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp b/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp index a66acd13fba..57d594155f6 100644 --- a/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp +++ b/3rdparty/bgfx/examples/00-helloworld/helloworld.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -29,8 +29,13 @@ public: m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -84,8 +89,8 @@ public: // Use debug font to print information about this example. bgfx::dbgTextClear(); bgfx::dbgTextImage( - bx::uint16_max(uint16_t(m_width /2/8 ), 20)-20 - , bx::uint16_max(uint16_t(m_height/2/16), 6)-6 + bx::max(uint16_t(m_width /2/8 ), 20)-20 + , bx::max(uint16_t(m_height/2/16), 6)-6 , 40 , 12 , s_logo @@ -93,6 +98,9 @@ public: ); bgfx::dbgTextPrintf(0, 1, 0x0f, "Color can be changed with ANSI \x1b[9;me\x1b[10;ms\x1b[11;mc\x1b[12;ma\x1b[13;mp\x1b[14;me\x1b[0m code too."); + bgfx::dbgTextPrintf(80, 1, 0x0f, "\x1b[;0m \x1b[;1m \x1b[; 2m \x1b[; 3m \x1b[; 4m \x1b[; 5m \x1b[; 6m \x1b[; 7m \x1b[0m"); + bgfx::dbgTextPrintf(80, 2, 0x0f, "\x1b[;8m \x1b[;9m \x1b[;10m \x1b[;11m \x1b[;12m \x1b[;13m \x1b[;14m \x1b[;15m \x1b[0m"); + const bgfx::Stats* stats = bgfx::getStats(); bgfx::dbgTextPrintf(0, 2, 0x0f, "Backbuffer %dW x %dH in pixels, debug text %dW x %dH in characters." , stats->width diff --git a/3rdparty/bgfx/examples/01-cubes/cubes.cpp b/3rdparty/bgfx/examples/01-cubes/cubes.cpp index a162b05d60b..faa098ecb1a 100644 --- a/3rdparty/bgfx/examples/01-cubes/cubes.cpp +++ b/3rdparty/bgfx/examples/01-cubes/cubes.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -75,18 +75,68 @@ static const uint16_t s_cubeTriStrip[] = 5, }; +static const uint16_t s_cubeLineList[] = +{ + 0, 1, + 0, 2, + 0, 4, + 1, 3, + 1, 5, + 2, 3, + 2, 6, + 3, 7, + 4, 5, + 4, 6, + 5, 7, + 6, 7, +}; + +static const uint16_t s_cubeLineStrip[] = +{ + 0, 2, 3, 1, 5, 7, 6, 4, + 0, 2, 6, 4, 5, 7, 3, 1, + 0, +}; + +static const uint16_t s_cubePoints[] = +{ + 0, 1, 2, 3, 4, 5, 6, 7 +}; + +static const char* s_ptNames[] +{ + "Triangle List", + "Triangle Strip", + "Lines", + "Line Strip", + "Points", +}; + +static const uint64_t s_ptState[] +{ + UINT64_C(0), + BGFX_STATE_PT_TRISTRIP, + BGFX_STATE_PT_LINES, + BGFX_STATE_PT_LINESTRIP, + BGFX_STATE_PT_POINTS, +}; +BX_STATIC_ASSERT(BX_COUNTOF(s_ptState) == BX_COUNTOF(s_ptNames) ); + class ExampleCubes : public entry::AppI { public: ExampleCubes(const char* _name, const char* _description) : entry::AppI(_name, _description) + , m_pt(0) + , m_r(true) + , m_g(true) + , m_b(true) + , m_a(true) { } void init(int32_t _argc, const char* const* _argv, uint32_t _width, uint32_t _height) override { - BX_UNUSED(s_cubeTriList, s_cubeTriStrip); - Args args(_argc, _argv); m_width = _width; @@ -94,35 +144,64 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); // Set view 0 clear state. bgfx::setViewClear(0 - , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH - , 0x303030ff - , 1.0f - , 0 - ); + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); // Create vertex stream declaration. PosColorVertex::init(); // Create static vertex buffer. m_vbh = bgfx::createVertexBuffer( - // Static data can be passed with bgfx::makeRef - bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ) - , PosColorVertex::ms_decl - ); + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ) + , PosColorVertex::ms_decl + ); - // Create static index buffer. - m_ibh = bgfx::createIndexBuffer( - // Static data can be passed with bgfx::makeRef - bgfx::makeRef(s_cubeTriStrip, sizeof(s_cubeTriStrip) ) - ); + // Create static index buffer for triangle list rendering. + m_ibh[0] = bgfx::createIndexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_cubeTriList, sizeof(s_cubeTriList) ) + ); + + // Create static index buffer for triangle strip rendering. + m_ibh[1] = bgfx::createIndexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_cubeTriStrip, sizeof(s_cubeTriStrip) ) + ); + + // Create static index buffer for line list rendering. + m_ibh[2] = bgfx::createIndexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_cubeLineList, sizeof(s_cubeLineList) ) + ); + + // Create static index buffer for line strip rendering. + m_ibh[3] = bgfx::createIndexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_cubeLineStrip, sizeof(s_cubeLineStrip) ) + ); + + // Create static index buffer for point list rendering. + m_ibh[4] = bgfx::createIndexBuffer( + // Static data can be passed with bgfx::makeRef + bgfx::makeRef(s_cubePoints, sizeof(s_cubePoints) ) + ); // Create program from shaders. m_program = loadProgram("vs_cubes", "fs_cubes"); @@ -137,7 +216,11 @@ public: imguiDestroy(); // Cleanup. - bgfx::destroy(m_ibh); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_ibh); ++ii) + { + bgfx::destroy(m_ibh[ii]); + } + bgfx::destroy(m_vbh); bgfx::destroy(m_program); @@ -163,28 +246,37 @@ public: showExampleDialog(this); + ImGui::SetNextWindowPos( + ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 3.5f) + , ImGuiCond_FirstUseEver + ); + ImGui::Begin("Settings" + , NULL + , 0 + ); + + ImGui::Checkbox("Write R", &m_r); + ImGui::Checkbox("Write G", &m_g); + ImGui::Checkbox("Write B", &m_b); + ImGui::Checkbox("Write A", &m_a); + + ImGui::Text("Primitive topology:"); + ImGui::Combo("", (int*)&m_pt, s_ptNames, BX_COUNTOF(s_ptNames) ); + + ImGui::End(); + imguiEndFrame(); float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) ); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -201,6 +293,19 @@ public: // if no other draw calls are submitted to view 0. bgfx::touch(0); + bgfx::IndexBufferHandle ibh = m_ibh[m_pt]; + uint64_t state = 0 + | (m_r ? BGFX_STATE_WRITE_R : 0) + | (m_g ? BGFX_STATE_WRITE_G : 0) + | (m_b ? BGFX_STATE_WRITE_B : 0) + | (m_a ? BGFX_STATE_WRITE_A : 0) + | BGFX_STATE_WRITE_Z + | BGFX_STATE_DEPTH_TEST_LESS + | BGFX_STATE_CULL_CW + | BGFX_STATE_MSAA + | s_ptState[m_pt] + ; + // Submit 11x11 cubes. for (uint32_t yy = 0; yy < 11; ++yy) { @@ -217,13 +322,10 @@ public: // Set vertex and index buffer. bgfx::setVertexBuffer(0, m_vbh); - bgfx::setIndexBuffer(m_ibh); + bgfx::setIndexBuffer(ibh); // Set render states. - bgfx::setState(0 - | BGFX_STATE_DEFAULT - | BGFX_STATE_PT_TRISTRIP - ); + bgfx::setState(state); // Submit primitive for rendering to view 0. bgfx::submit(0, m_program); @@ -247,9 +349,15 @@ public: uint32_t m_debug; uint32_t m_reset; bgfx::VertexBufferHandle m_vbh; - bgfx::IndexBufferHandle m_ibh; + bgfx::IndexBufferHandle m_ibh[BX_COUNTOF(s_ptState)]; bgfx::ProgramHandle m_program; int64_t m_timeOffset; + int32_t m_pt; + + bool m_r; + bool m_g; + bool m_b; + bool m_a; }; } // namespace diff --git a/3rdparty/bgfx/examples/01-cubes/fs_cubes.sc b/3rdparty/bgfx/examples/01-cubes/fs_cubes.sc index ce5831255a6..99ec64685ad 100644 --- a/3rdparty/bgfx/examples/01-cubes/fs_cubes.sc +++ b/3rdparty/bgfx/examples/01-cubes/fs_cubes.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/01-cubes/makefile b/3rdparty/bgfx/examples/01-cubes/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/01-cubes/makefile +++ b/3rdparty/bgfx/examples/01-cubes/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/01-cubes/vs_cubes.sc b/3rdparty/bgfx/examples/01-cubes/vs_cubes.sc index 9d7d6853085..906372cb0f8 100644 --- a/3rdparty/bgfx/examples/01-cubes/vs_cubes.sc +++ b/3rdparty/bgfx/examples/01-cubes/vs_cubes.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h index a9288af756e..3415bc27b9c 100644 --- a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h +++ b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.bin.h @@ -26,202 +26,70 @@ static const uint8_t fs_metaballs_glsl[398] = 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor = 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tmpvar_2;.}... }; -static const uint8_t fs_metaballs_spv[3095] = +static const uint8_t fs_metaballs_spv[986] = { - 0x46, 0x53, 0x48, 0x05, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0x08, 0x0c, 0x00, 0x00, 0x03, 0x02, // FSH..,.?........ - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x97, 0x61, 0x00, 0x00, 0x00, 0x00, // #..........a.... + 0x46, 0x53, 0x48, 0x05, 0x03, 0x2c, 0xf5, 0x3f, 0x00, 0x00, 0xc8, 0x03, 0x00, 0x00, 0x03, 0x02, // FSH..,.?........ + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x34, 0x0e, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...4......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x01, 0x14, 0x00, 0x00, 0x76, 0x65, // in............ve - 0x63, 0x33, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c3_splat(f1;.... - 0x03, 0x00, 0x39, 0x1b, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, // ..9..._x......5. - 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, // ..vec4_splat(f1; - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, // .........._x.... - 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, // ......@main(vf4; - 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa8, 0x48, // vf3;vf4;.......H - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x82, 0x5a, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, // ...Z..v_normal.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4e, 0x48, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ......NH..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, // gData_0_........ - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, // ..bgfx_VoidFrag. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x5f, 0x5b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ......_[..param. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x29, 0x05, 0x00, 0x00, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x44, // ......)...lightD - 0x69, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x67, 0x15, 0x00, 0x00, 0x6e, 0x64, // ir........g...nd - 0x6f, 0x74, 0x6c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x3f, 0x0d, 0x00, 0x00, 0x73, 0x70, // otl.......?...sp - 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xcf, 0x54, 0x00, 0x00, 0x70, 0x61, // ec.........T..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x53, 0x35, 0x00, 0x00, 0x70, 0x61, // ram.......S5..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x76, 0x5f, // ram........A..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, // color0........w. - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, // ..,?..v_normal.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // ......4...v_norm - 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, // al............gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...G..param..... - 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...U..param..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x24, 0x47, // a_0_..........$G - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, // lobal........... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, // ..u_viewRect.... - 0x06, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x00, // Texel........... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfe, 0x07, // ..u_view........ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, // ......u_invView. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x05, 0x00, // proj............ - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invProj..... - 0x06, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x07, 0x00, // Proj............ - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ..u_invViewProj. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x09, 0x00, // model........... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, // ..u_modelView... - 0x07, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfe, 0x07, // lViewProj....... - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // ......u_alphaRef - 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // 4.G...w......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...4......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...........@. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x01, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, // ..#.......H..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x03, 0x00, // ..`...H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x07, 0x00, // ..`...H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, // ..........H..... - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x02, 0x00, // .. ...G......... - 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, // ..........!..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, // ..!...}......... - 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x41, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x2c, 0x00, 0x06, 0x00, 0x18, 0x00, // ..A.......,..... - 0x00, 0x00, 0x29, 0x05, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x41, 0x03, // ..)...........A. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x01, 0x00, 0x00, 0x00, 0x00, // ..+.......O..... - 0xf0, 0x41, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x76, 0x09, 0x00, 0x00, 0xcd, 0xcc, // .A+.......v..... - 0x0c, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x59, 0x05, 0x00, 0x00, 0x2f, 0xba, // .@+.......Y.../. - 0xe8, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, // .>+............. - 0x80, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, // .? ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, // ..;.......w..... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x01, 0x00, // ..;.......4..... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, // ..;............. - 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . - 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x94, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ..........e...j. - 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x94, 0x01, 0x00, 0x00, 0x65, 0x00, // ..e...e.......e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ..e.......6..... - 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, // ................ - 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, // ..Sa..;........G - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xab, 0x55, // ......;........U - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, // ......;......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcb, 0x41, // ......=........A - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, // ..w...=.......,? - 0x00, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc9, 0x47, 0x00, 0x00, 0xcb, 0x41, // ..4...>....G...A - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, // ..>....U..,?..9. - 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0xc9, 0x47, // .......&.......G - 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ...U......=..... - 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, // ..........>..... - 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // ..........8...6. - 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x00, // ................ - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x39, 0x1b, 0x00, 0x00, 0xf8, 0x00, // ..7.......9..... - 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, // ......=.......dW - 0x00, 0x00, 0x39, 0x1b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x12, 0x50, // ..9...=........P - 0x00, 0x00, 0x39, 0x1b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, // ..9...=........9 - 0x00, 0x00, 0x39, 0x1b, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0xb0, 0x2a, // ..9...P........* - 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0x12, 0x50, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, // ..dW...P...9.... - 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...*..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc4, 0x25, // ...............% - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x94, 0x1f, 0x00, 0x00, 0xdd, 0x0e, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x00, 0x00, 0xdd, 0x0e, // ..=........H.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbf, 0x32, 0x00, 0x00, 0xdd, 0x0e, // ..=........2.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd2, 0x32, 0x00, 0x00, 0xdd, 0x0e, // ..=........2.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xec, 0x21, 0x00, 0x00, 0x94, 0x1f, // ..P........!.... - 0x00, 0x00, 0x1f, 0x48, 0x00, 0x00, 0xbf, 0x32, 0x00, 0x00, 0xd2, 0x32, 0x00, 0x00, 0xfe, 0x00, // ...H...2...2.... - 0x02, 0x00, 0xec, 0x21, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ...!..8...6..... - 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x37, 0x00, // ..........}...7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa8, 0x48, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, // .......H..7..... - 0x00, 0x00, 0x82, 0x5a, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4e, 0x48, // ...Z..7.......NH - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x82, 0x51, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......Q..;..... - 0x00, 0x00, 0x5f, 0x5b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // .._[......;..... - 0x00, 0x00, 0xcf, 0x54, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // ...T......;..... - 0x00, 0x00, 0x53, 0x35, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x5b, // ..S5......>..._[ - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x5f, 0x5b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // ..5..._[..=..... - 0x00, 0x00, 0xc4, 0x60, 0x00, 0x00, 0x82, 0x5a, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x18, 0x00, // ...`...Z........ - 0x00, 0x00, 0xef, 0x3d, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0xc4, 0x60, // ...=......E....` - 0x00, 0x00, 0x94, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x15, 0x00, 0x00, 0xef, 0x3d, // ..........g....= - 0x00, 0x00, 0x29, 0x05, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3f, 0x0d, // ..)...........?. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x67, 0x15, 0x00, 0x00, 0x4f, 0x01, // ..........g...O. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x96, 0x61, 0x00, 0x00, 0xa8, 0x48, // ..=........a...H - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x5f, 0x3c, 0x00, 0x00, 0x96, 0x61, // ..O......._<...a - 0x00, 0x00, 0x96, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ...a............ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xcf, 0x54, 0x00, 0x00, 0x76, 0x09, 0x00, 0x00, 0x39, 0x00, // ..>....T..v...9. - 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x5a, 0x46, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0xcf, 0x54, // ......ZF.......T - 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x58, 0x00, 0x00, 0x01, 0x00, // ...........X.... - 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x5f, 0x3c, 0x00, 0x00, 0x5a, 0x46, 0x00, 0x00, 0x8e, 0x00, // ......_<..ZF.... - 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa3, 0x2c, 0x00, 0x00, 0x08, 0x58, 0x00, 0x00, 0x67, 0x15, // .......,...X..g. - 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa3, 0x2e, 0x00, 0x00, 0x3f, 0x0d, // ..P...........?. - 0x00, 0x00, 0x3f, 0x0d, 0x00, 0x00, 0x3f, 0x0d, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x18, 0x00, // ..?...?......... - 0x00, 0x00, 0x7a, 0x61, 0x00, 0x00, 0xa3, 0x2c, 0x00, 0x00, 0xa3, 0x2e, 0x00, 0x00, 0x3e, 0x00, // ..za...,......>. - 0x03, 0x00, 0x53, 0x35, 0x00, 0x00, 0x59, 0x05, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x18, 0x00, // ..S5..Y...9..... - 0x00, 0x00, 0x3b, 0x61, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x53, 0x35, 0x00, 0x00, 0x0c, 0x00, // ..;a......S5.... - 0x07, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd5, 0x36, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, // .......6........ - 0x00, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x3b, 0x61, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..za..;a..Q..... - 0x00, 0x00, 0xbd, 0x37, 0x00, 0x00, 0xd5, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ...7...6......Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x60, 0x58, 0x00, 0x00, 0xd5, 0x36, 0x00, 0x00, 0x01, 0x00, // ......`X...6.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x41, 0x1c, 0x00, 0x00, 0xd5, 0x36, // ..Q.......A....6 - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x56, // ......P........V - 0x00, 0x00, 0xbd, 0x37, 0x00, 0x00, 0x60, 0x58, 0x00, 0x00, 0x41, 0x1c, 0x00, 0x00, 0x8a, 0x00, // ...7..`X..A..... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x48, 0x00, 0x00, 0x99, 0x56, 0x00, 0x00, 0xfd, 0x00, // ..>...NH...V.... - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..8.... + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x10, 0x00, // ..M...Q......... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x76, 0x5f, // in........M...v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x51, 0x00, // color0........Q. + 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_normal...... + 0x06, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ......bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x1e, 0x00, // ata0..G...M..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...Q..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, // .. ............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x28, 0x00, // ......+.......(. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2c, 0x00, // ......+.......,. + 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x2c, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2d, 0x00, // ......,.......-. + 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..(...(...,...+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x41, 0x2b, 0x00, // ......5......A+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2b, 0x00, // ......9......@+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x2b, 0x00, // ......B.../..>+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x20, 0x00, // ......F......? . + 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..L...........;. + 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..L...M....... . + 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..P...........;. + 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..P...Q....... . + 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..[...........;. + 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..[...........,. + 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x39, 0x00, // ..........9...9. + 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..9...,......... + 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x36, 0x00, // ..B...B...B...6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... + 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..N...M...=..... + 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x08, 0x00, // ..R...Q......... + 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x52, 0x00, // ..z.......E...R. + 0x00, 0x00, 0x94, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7a, 0x00, // ..........|...z. + 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7e, 0x00, // ..-...........~. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x35, 0x00, // ..........|...5. + 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x4e, 0x00, // ..O...........N. + 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ..N............. + 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x8e, 0x00, // ................ + 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..............|. + 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x7e, 0x00, // ..P...........~. + 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x08, 0x00, // ..~...~......... + 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x0c, 0x00, // ................ + 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, // ................ + 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ..........Q..... + 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x89, 0x00, // ..Q............. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8d, 0x00, // ......P......... + 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x46, 0x00, // ..............F. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>............. + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ..8....... }; static const uint8_t fs_metaballs_dx9[423] = { diff --git a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.sc b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.sc index f0863de6d0f..b5ce0cd0c6e 100644 --- a/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.sc +++ b/3rdparty/bgfx/examples/02-metaballs/fs_metaballs.sc @@ -1,7 +1,7 @@ $input v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/02-metaballs/makefile b/3rdparty/bgfx/examples/02-metaballs/makefile index a9e31815229..76ce78d8e4d 100644 --- a/3rdparty/bgfx/examples/02-metaballs/makefile +++ b/3rdparty/bgfx/examples/02-metaballs/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp b/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp index c14c3df0fda..f5256d8286d 100644 --- a/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp +++ b/3rdparty/bgfx/examples/02-metaballs/metaballs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -375,7 +375,7 @@ float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0, const float* __restrict edge0 = s_cube[_idx0]; const float* __restrict edge1 = s_cube[_idx1]; - if (bx::fabs(_iso-_v1) < 0.00001f) + if (bx::abs(_iso-_v1) < 0.00001f) { _result[0] = edge1[0]; _result[1] = edge1[1]; @@ -383,8 +383,8 @@ float vertLerp(float* __restrict _result, float _iso, uint32_t _idx0, float _v0, return 1.0f; } - if (bx::fabs(_iso-_v0) < 0.00001f - || bx::fabs(_v0-_v1) < 0.00001f) + if (bx::abs(_iso-_v0) < 0.00001f + || bx::abs(_v0-_v1) < 0.00001f) { _result[0] = edge0[0]; _result[1] = edge0[1]; @@ -493,8 +493,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -559,8 +564,6 @@ public: showExampleDialog(this); - imguiEndFrame(); - // Set view 0 default viewport. bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); @@ -576,24 +579,10 @@ public: const double toMs = 1000.0/freq; float time = (float)( (now - m_timeOffset)/double(bx::getHPFrequency() ) ); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -50.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -50.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -621,10 +610,10 @@ public: float sphere[numSpheres][4]; for (uint32_t ii = 0; ii < numSpheres; ++ii) { - sphere[ii][0] = bx::fsin(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f); - sphere[ii][1] = bx::fsin(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f); - sphere[ii][2] = bx::fcos(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f); - sphere[ii][3] = 1.0f/(2.0f + (bx::fsin(time*(ii*0.13f) )*0.5f+0.5f)*2.0f); + sphere[ii][0] = bx::sin(time*(ii*0.21f)+ii*0.37f) * (DIMS * 0.5f - 8.0f); + sphere[ii][1] = bx::sin(time*(ii*0.37f)+ii*0.67f) * (DIMS * 0.5f - 8.0f); + sphere[ii][2] = bx::cos(time*(ii*0.11f)+ii*0.13f) * (DIMS * 0.5f - 8.0f); + sphere[ii][3] = 1.0f/(2.0f + (bx::sin(time*(ii*0.13f) )*0.5f+0.5f)*2.0f); } profUpdate = bx::getHPCounter(); @@ -758,11 +747,28 @@ public: bgfx::submit(0, m_program); // Display stats. - bgfx::dbgTextPrintf(1, 4, 0x0f, "Num vertices: %5d (%6.4f%%)", numVertices, float(numVertices)/maxVertices * 100); - bgfx::dbgTextPrintf(1, 5, 0x0f, " Update: % 7.3f[ms]", double(profUpdate)*toMs); - bgfx::dbgTextPrintf(1, 6, 0x0f, "Calc normals: % 7.3f[ms]", double(profNormal)*toMs); - bgfx::dbgTextPrintf(1, 7, 0x0f, " Triangulate: % 7.3f[ms]", double(profTriangulate)*toMs); - bgfx::dbgTextPrintf(1, 8, 0x0f, " Frame: % 7.3f[ms]", double(frameTime)*toMs); + ImGui::SetNextWindowPos( + ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 4.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::Begin("Stats" + , NULL + , 0 + ); + + ImGui::Text("Num vertices:"); ImGui::SameLine(100); ImGui::Text("%5d (%6.4f%%)", numVertices, float(numVertices)/maxVertices * 100); + ImGui::Text("Update:"); ImGui::SameLine(100); ImGui::Text("% 7.3f[ms]", double(profUpdate)*toMs); + ImGui::Text("Calc normals:"); ImGui::SameLine(100); ImGui::Text("% 7.3f[ms]", double(profNormal)*toMs); + ImGui::Text("Triangulate:"); ImGui::SameLine(100); ImGui::Text("% 7.3f[ms]", double(profTriangulate)*toMs); + ImGui::Text("Frame:"); ImGui::SameLine(100); ImGui::Text("% 7.3f[ms]", double(frameTime)*toMs); + + ImGui::End(); + + imguiEndFrame(); // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. diff --git a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h index 07b08f1bfe2..eb8e38a1745 100644 --- a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h +++ b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.bin.h @@ -35,219 +35,110 @@ static const uint8_t vs_metaballs_glsl[537] = 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // v_color0 = a_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t vs_metaballs_spv[3371] = +static const uint8_t vs_metaballs_spv[1632] = { 0x56, 0x53, 0x48, 0x05, 0x03, 0x2c, 0xf5, 0x3f, 0x02, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..,.?...u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0xf8, 0x0c, // .u_model........ - 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x37, 0x62, // ....#.........7b + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x08, 0x04, 0x00, // elViewProj...... + 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x24, 0x06, // .u_model......$. + 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xa8, 0x00, // ....#........... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, // ................ 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, // ......GLSL.std.4 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // 50.............. - 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x46, 0x14, 0x00, 0x00, 0xa6, 0x14, // in........F..... - 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x33, 0x13, 0x00, 0x00, 0x03, 0x00, // ......v...3..... - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x78, 0x04, // ..main........x. - 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x04, // ..Output......x. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // ......gl_Positio - 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, // n.....x.......v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x04, // color0........x. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, // ......v_normal.. - 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, // ..........@main( - 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, // vf4;vf3;vf3;.... - 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..O...a_color0.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // ......:...a_norm - 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0x61, 0x5f, // al.........M..a_ - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, // position........ - 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, // .._varying_..... - 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..^...$Global... - 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..^.......u_view - 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x01, 0x00, // Rect......^..... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, // ..u_viewTexel... - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..^.......u_view - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......^.......u_ - 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x5e, 0x05, // invView.......^. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ......u_proj.... - 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, // ..^.......u_invP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, // roj.......^..... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ..u_viewProj.... - 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..^.......u_invV - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x5e, 0x05, // iewProj.......^. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, // ......u_model... - 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..^.......u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, // lView.....^..... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ..u_modelViewPro - 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, // j.....^.......u_ - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, // alphaRef4.....B. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x61, 0x5f, // ...........A..a_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x89, 0x14, // color0.......... - 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..a_color0...... - 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, // ...?..a_normal.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x46, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // ......F...a_norm - 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x61, 0x5f, // al........@,..a_ - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, // position........ - 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, // ..a_position.... - 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, // ......flattenTem - 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // p......U..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......8..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, // ..........@entry + 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4d, 0x00, // in....F...J...M. + 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x03, 0x00, // ..X...[..._..... + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x27, 0x00, // ..main........'. + 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x27, 0x00, // ..$Global.....'. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, // ......u_model... + 0x07, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..'.......u_mode + 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x29, 0x00, // lViewProj.....). + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x46, 0x00, 0x00, 0x00, 0x61, 0x5f, // ..........F...a_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4a, 0x00, // color0........J. + 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..a_normal...... + 0x05, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ..M...a_position + 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x58, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, // ......X...@entry 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, // PointOutput.gl_P - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x76, 0x13, // osition.......v. + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x5b, 0x00, // osition.......[. 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, // ..@entryPointOut 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, // put.v_color0.... - 0x09, 0x00, 0x33, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, // ..3...@entryPoin + 0x09, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, // .._...@entryPoin 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, // tOutput.v_normal - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...........@. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x01, 0x00, // ......H...^..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, // ..#.......H...^. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..^............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...^......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, // ..`...H...^..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..^............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...^......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, // ......H...^..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..^............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...^......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, // ..`...H...^..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..^............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...^......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, // ......H...^..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..........H...^. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..^............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, // .. ...G...^..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...B..."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x46, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...F......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, // ..G............. - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...v......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x33, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...3......... - 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, // ..........!..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. - 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x78, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......x......... - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x44, 0x09, 0x00, 0x00, 0x78, 0x04, // ......!...D...x. - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0xf5, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x04, 0x00, 0x00, 0x15, 0x00, // ..........x..... - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, // .............?+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..............,. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, // ................ - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..........+..... - 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x18, 0x00, // ..........,..... - 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, // ..r............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . - 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ..........e...j. - 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......^......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, // ..e...e.......e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xdb, 0x07, // ..e....... ..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xdb, 0x07, // ......^...;..... - 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..B.......+..... - 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, // ..)....... ..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ......e...+..... - 0x00, 0x00, 0x23, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..#....... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, // .......... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, // ..........;..... - 0x00, 0x00, 0x46, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, // ..F.......;..... - 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // .......... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x97, 0x02, // ..v....... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, 0x02, // ..........;..... - 0x00, 0x00, 0x33, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ..3.......6..... - 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, // ................ - 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xf5, 0x06, 0x00, 0x00, 0x08, 0x10, // ..Sa..;......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, // ......;........U - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, // ......;........8 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, // ......;......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, // ......=........A - 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, // ......=........? - 0x00, 0x00, 0x46, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x40, 0x2c, // ..F...=.......@, - 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, // ......>....U...A - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, // ..>....8...?..>. - 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x78, 0x04, // ......@,..9...x. - 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, // ..I&.......U...8 - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, // ......>.......I& - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, // ..A.......T4.... - 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, // ......=......... - 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, // ..T4..>......... - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, // ..A........@.... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, // ......=....... . - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, // ...@..>...v... . - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, // ..A........@.... - 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x13, 0x2d, // ......=........- - 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x33, 0x13, 0x00, 0x00, 0x13, 0x2d, // ...@..>...3....- - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x78, 0x04, // ......8...6...x. - 0x00, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x09, 0x00, 0x00, 0x37, 0x00, // ..........D...7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, // ......O...7..... - 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xb9, 0x4d, // ..:...7........M - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x5f, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xf5, 0x06, // ......_W..;..... - 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, // ..........A..... - 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ..d-..........>. - 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, // ..d-......A..... - 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ...8..........>. - 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // ...8..r...=..... - 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..5b...M..Q..... - 0x00, 0x00, 0x3b, 0x3a, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..;:..5b......Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0b, 0x47, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, // .......G..5b.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x53, 0x00, 0x00, 0x35, 0x62, // ..Q.......+S..5b - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, // ......P........2 - 0x00, 0x00, 0x3b, 0x3a, 0x00, 0x00, 0x0b, 0x47, 0x00, 0x00, 0x2b, 0x53, 0x00, 0x00, 0x8a, 0x00, // ..;:...G..+S.... - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, // ..A.......),..B. - 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, // ..)...=...e....< - 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, // ..),...........; - 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, // ...2...<..A..... - 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, // .._8..........>. - 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // .._8...;..=..... - 0x00, 0x00, 0x36, 0x62, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..6b..:...Q..... - 0x00, 0x00, 0x3c, 0x3a, 0x00, 0x00, 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..<:..6b......Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x47, 0x00, 0x00, 0x36, 0x62, 0x00, 0x00, 0x01, 0x00, // .......G..6b.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x53, 0x00, 0x00, 0x36, 0x62, // ..Q.......,S..6b - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x85, 0x32, // ......P........2 - 0x00, 0x00, 0x3c, 0x3a, 0x00, 0x00, 0x0c, 0x47, 0x00, 0x00, 0x2c, 0x53, 0x00, 0x00, 0x0c, 0x0a, // ..<:...G..,S.... - 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x2a, 0x2c, 0x00, 0x00, 0x42, 0x13, // ..A.......*,..B. - 0x00, 0x00, 0x23, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, // ..#.......=...e. - 0x00, 0x00, 0xfd, 0x3d, 0x00, 0x00, 0x2a, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...=..*,........ - 0x00, 0x00, 0x62, 0x32, 0x00, 0x00, 0x85, 0x32, 0x00, 0x00, 0xfd, 0x3d, 0x00, 0x00, 0x4f, 0x00, // ..b2...2...=..O. - 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x57, 0x35, 0x00, 0x00, 0x62, 0x32, 0x00, 0x00, 0x62, 0x32, // ......W5..b2..b2 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. - 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0xd3, 0x48, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, // .......H........ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd3, 0x48, 0x00, 0x00, 0x57, 0x35, 0x00, 0x00, 0x3d, 0x00, // ..>....H..W5..=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x41, 0x00, // .......!..O...A. - 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, // ......-<........ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0x3d, 0x00, // ..>...-<...!..=. - 0x04, 0x00, 0x78, 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, // ..x...G:........ - 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..G:..8.... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...&.......@. + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...'......... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...'.......#. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, // ......H...'..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, // ..........H...'. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, // ..........H...'. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x48, 0x00, // ......#.......H. + 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..'............. + 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, // ..G...'.......G. + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..)...".......G. + 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..F...........G. + 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, // ..J...........G. + 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, // ..M...........G. + 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..X...........G. + 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..[...........G. + 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, // .._............. + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ......!......... + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, // .......... ..... + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, // ................ + 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. + 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, // .............?+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. + 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, // ................ + 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, // ..#............. + 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..$... .......+. + 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..$...%... ..... + 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x1e, 0x00, // ..&...#...%..... + 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..'...&...#... . + 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..(.......'...;. + 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, // ..(...)....... . + 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..*.......#... . + 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..E...........;. + 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..E...F....... . + 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..I...........;. + 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..I...J.......;. + 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..I...M....... . + 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..W...........;. + 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..W...X.......;. + 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, // ..W...[....... . + 0x04, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..^...........;. + 0x04, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..^..._.......6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, // ..........=..... + 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, // ..G...F...=..... + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, // ..K...J...=..... + 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ..N...M...Q..... + 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..s...N.......Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x01, 0x00, // ......t...N..... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x4e, 0x00, // ..Q.......u...N. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x76, 0x00, // ......P.......v. + 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x16, 0x00, // ..s...t...u..... + 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x29, 0x00, // ..A...*...w...). + 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x78, 0x00, // ......=...#...x. + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x79, 0x00, // ..w...........y. + 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ..v...x...Q..... + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..|...K.......Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, // ......}...K..... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x4b, 0x00, // ..Q.......~...K. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x7f, 0x00, // ......P......... + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x17, 0x00, // ..|...}...~..... + 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x29, 0x00, // ..A...*.......). + 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, // ..........=...#. + 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x4f, 0x00, // ..............O. + 0x08, 0x00, 0x09, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x82, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........y..... + 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x88, 0x00, // ................ + 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x89, 0x00, // ..R............. + 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x58, 0x00, // ..y.......>...X. + 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x47, 0x00, // ......>...[...G. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>..._......... + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x02, 0x00, 0x01, 0x00, 0x80, 0x00, // ..8............. }; static const uint8_t vs_metaballs_dx9[451] = { diff --git a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.sc b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.sc index 5158879c2b4..a018b69d915 100644 --- a/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.sc +++ b/3rdparty/bgfx/examples/02-metaballs/vs_metaballs.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_color0 $output v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/03-raymarch/fs_raymarching.sc b/3rdparty/bgfx/examples/03-raymarch/fs_raymarching.sc index 377619b944e..4266eac2aac 100644 --- a/3rdparty/bgfx/examples/03-raymarch/fs_raymarching.sc +++ b/3rdparty/bgfx/examples/03-raymarch/fs_raymarching.sc @@ -1,7 +1,7 @@ $input v_color0, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/03-raymarch/makefile b/3rdparty/bgfx/examples/03-raymarch/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/03-raymarch/makefile +++ b/3rdparty/bgfx/examples/03-raymarch/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp b/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp index 8826937423c..a07e018485e 100644 --- a/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp +++ b/3rdparty/bgfx/examples/03-raymarch/raymarch.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -116,8 +116,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -187,8 +192,8 @@ public: // if no other draw calls are submitted to viewZ 0. bgfx::touch(0); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -15.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -15.0f }; float view[16]; float proj[16]; diff --git a/3rdparty/bgfx/examples/03-raymarch/vs_raymarching.sc b/3rdparty/bgfx/examples/03-raymarch/vs_raymarching.sc index fa014694f0d..264d8b9cae2 100644 --- a/3rdparty/bgfx/examples/03-raymarch/vs_raymarching.sc +++ b/3rdparty/bgfx/examples/03-raymarch/vs_raymarching.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_texcoord0 $output v_color0, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/04-mesh/fs_mesh.sc b/3rdparty/bgfx/examples/04-mesh/fs_mesh.sc index 61d01414709..a2d95b99847 100644 --- a/3rdparty/bgfx/examples/04-mesh/fs_mesh.sc +++ b/3rdparty/bgfx/examples/04-mesh/fs_mesh.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/04-mesh/makefile b/3rdparty/bgfx/examples/04-mesh/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/04-mesh/makefile +++ b/3rdparty/bgfx/examples/04-mesh/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/04-mesh/mesh.cpp b/3rdparty/bgfx/examples/04-mesh/mesh.cpp index 2b2e2f2cea7..06896ef0208 100644 --- a/3rdparty/bgfx/examples/04-mesh/mesh.cpp +++ b/3rdparty/bgfx/examples/04-mesh/mesh.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -27,8 +27,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -98,24 +103,10 @@ public: float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) ); bgfx::setUniform(u_time, &time); - float at[3] = { 0.0f, 1.0f, 0.0f }; - float eye[3] = { 0.0f, 1.0f, -2.5f }; + const bx::Vec3 at = { 0.0f, 1.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 1.0f, -2.5f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); diff --git a/3rdparty/bgfx/examples/04-mesh/vs_mesh.sc b/3rdparty/bgfx/examples/04-mesh/vs_mesh.sc index 25c33179c84..95095d94fd1 100644 --- a/3rdparty/bgfx/examples/04-mesh/vs_mesh.sc +++ b/3rdparty/bgfx/examples/04-mesh/vs_mesh.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/05-instancing/fs_instancing.sc b/3rdparty/bgfx/examples/05-instancing/fs_instancing.sc index ce5831255a6..99ec64685ad 100644 --- a/3rdparty/bgfx/examples/05-instancing/fs_instancing.sc +++ b/3rdparty/bgfx/examples/05-instancing/fs_instancing.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/05-instancing/instancing.cpp b/3rdparty/bgfx/examples/05-instancing/instancing.cpp index c295a9813c5..d471efb87fd 100644 --- a/3rdparty/bgfx/examples/05-instancing/instancing.cpp +++ b/3rdparty/bgfx/examples/05-instancing/instancing.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -73,11 +73,16 @@ public: m_width = _width; m_height = _height; - m_debug = BGFX_DEBUG_NONE; + m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -163,28 +168,14 @@ public: // When instancing is not supported by GPU, implement alternative // code path that doesn't use instancing. bool blink = uint32_t(time*3.0f)&1; - bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " Instancing is not supported by GPU. "); + bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " Instancing is not supported by GPU. "); } else { - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -221,9 +212,9 @@ public: mtx[14] = 0.0f; float* color = (float*)&data[64]; - color[0] = bx::fsin(time+float(xx)/11.0f)*0.5f+0.5f; - color[1] = bx::fcos(time+float(yy)/11.0f)*0.5f+0.5f; - color[2] = bx::fsin(time*3.0f)*0.5f+0.5f; + color[0] = bx::sin(time+float(xx)/11.0f)*0.5f+0.5f; + color[1] = bx::cos(time+float(yy)/11.0f)*0.5f+0.5f; + color[2] = bx::sin(time*3.0f)*0.5f+0.5f; color[3] = 1.0f; data += instanceStride; diff --git a/3rdparty/bgfx/examples/05-instancing/makefile b/3rdparty/bgfx/examples/05-instancing/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/05-instancing/makefile +++ b/3rdparty/bgfx/examples/05-instancing/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/05-instancing/vs_instancing.sc b/3rdparty/bgfx/examples/05-instancing/vs_instancing.sc index 813a49982e5..b48a802b1b4 100644 --- a/3rdparty/bgfx/examples/05-instancing/vs_instancing.sc +++ b/3rdparty/bgfx/examples/05-instancing/vs_instancing.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, i_data0, i_data1, i_data2, i_data3, i_data4 $output v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/06-bump/bump.cpp b/3rdparty/bgfx/examples/06-bump/bump.cpp index e60fb042fba..2f299161926 100644 --- a/3rdparty/bgfx/examples/06-bump/bump.cpp +++ b/3rdparty/bgfx/examples/06-bump/bump.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -99,8 +99,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -206,24 +211,10 @@ public: float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() )); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -7.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -7.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -239,8 +230,8 @@ public: float lightPosRadius[4][4]; for (uint32_t ii = 0; ii < m_numLights; ++ii) { - lightPosRadius[ii][0] = bx::fsin( (time*(0.1f + ii*0.17f) + ii*bx::kPiHalf*1.37f ) )*3.0f; - lightPosRadius[ii][1] = bx::fcos( (time*(0.2f + ii*0.29f) + ii*bx::kPiHalf*1.49f ) )*3.0f; + lightPosRadius[ii][0] = bx::sin( (time*(0.1f + ii*0.17f) + ii*bx::kPiHalf*1.37f ) )*3.0f; + lightPosRadius[ii][1] = bx::cos( (time*(0.2f + ii*0.29f) + ii*bx::kPiHalf*1.49f ) )*3.0f; lightPosRadius[ii][2] = -2.5f; lightPosRadius[ii][3] = 3.0f; } @@ -284,7 +275,7 @@ public: } // Set instance data buffer. - bgfx::setInstanceDataBuffer(&idb, numInstances); + bgfx::setInstanceDataBuffer(&idb, 0, numInstances); // Set vertex and index buffer. bgfx::setVertexBuffer(0, m_vbh); @@ -296,9 +287,9 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ); @@ -333,9 +324,9 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ); diff --git a/3rdparty/bgfx/examples/06-bump/fs_bump.sc b/3rdparty/bgfx/examples/06-bump/fs_bump.sc index 4923dd5b93f..65154548ba2 100644 --- a/3rdparty/bgfx/examples/06-bump/fs_bump.sc +++ b/3rdparty/bgfx/examples/06-bump/fs_bump.sc @@ -1,7 +1,7 @@ $input v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 // in... /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/06-bump/makefile b/3rdparty/bgfx/examples/06-bump/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/06-bump/makefile +++ b/3rdparty/bgfx/examples/06-bump/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/06-bump/vs_bump.sc b/3rdparty/bgfx/examples/06-bump/vs_bump.sc index e0a17d9d818..d41f87fc2fa 100644 --- a/3rdparty/bgfx/examples/06-bump/vs_bump.sc +++ b/3rdparty/bgfx/examples/06-bump/vs_bump.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_tangent, a_texcoord0 $output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/06-bump/vs_bump_instanced.sc b/3rdparty/bgfx/examples/06-bump/vs_bump_instanced.sc index a843f0bc53e..24c509732b7 100644 --- a/3rdparty/bgfx/examples/06-bump/vs_bump_instanced.sc +++ b/3rdparty/bgfx/examples/06-bump/vs_bump_instanced.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_tangent, a_texcoord0, i_data0, i_data1, i_data2, $output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/07-callback/callback.cpp b/3rdparty/bgfx/examples/07-callback/callback.cpp index 6c92e297782..987c51761ac 100644 --- a/3rdparty/bgfx/examples/07-callback/callback.cpp +++ b/3rdparty/bgfx/examples/07-callback/callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -69,13 +69,13 @@ static const uint16_t s_cubeIndices[36] = 6, 3, 7, }; -void savePng(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip) +void savePng(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bimg::TextureFormat::Enum _format, bool _yflip) { bx::FileWriter writer; bx::Error err; if (bx::open(&writer, _filePath, false, &err) ) { - bimg::imageWritePng(&writer, _width, _height, _srcPitch, _src, _grayscale, _yflip, &err); + bimg::imageWritePng(&writer, _width, _height, _srcPitch, _src, _format, _yflip, &err); bx::close(&writer); } } @@ -97,8 +97,10 @@ struct BgfxCallback : public bgfx::CallbackI { } - virtual void fatal(bgfx::Fatal::Enum _code, const char* _str) override + virtual void fatal(const char* _filePath, uint16_t _line, bgfx::Fatal::Enum _code, const char* _str) override { + BX_UNUSED(_filePath, _line); + // Something unexpected happened, inform user and bail out. bx::debugPrintf("Fatal error: 0x%08x: %s", _code, _str); @@ -188,7 +190,7 @@ struct BgfxCallback : public bgfx::CallbackI // Save screen shot as PNG. bx::snprintf(temp, BX_COUNTOF(temp), "%s.png", _filePath); - savePng(temp, _width, _height, _pitch, _data, false, _yflip); + savePng(temp, _width, _height, _pitch, _data, bimg::TextureFormat::BGRA8, _yflip); // Save screen shot as TGA. bx::snprintf(temp, BX_COUNTOF(temp), "%s.tga", _filePath); @@ -323,14 +325,15 @@ public: | BGFX_RESET_MSAA_X16 ; - bgfx::init( - args.m_type - , args.m_pciId - , 0 - , &m_callback // custom callback handler - , &m_allocator // custom allocator - ); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + init.callback = &m_callback; // custom callback handler + init.allocator = &m_allocator; // custom allocator + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -420,8 +423,8 @@ public: // if no other draw calls are submitted to view 0. bgfx::touch(0); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; float view[16]; float proj[16]; diff --git a/3rdparty/bgfx/examples/07-callback/fs_callback.sc b/3rdparty/bgfx/examples/07-callback/fs_callback.sc index f8f35c5a850..f9808c77f3b 100644 --- a/3rdparty/bgfx/examples/07-callback/fs_callback.sc +++ b/3rdparty/bgfx/examples/07-callback/fs_callback.sc @@ -1,7 +1,7 @@ $input v_world, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/07-callback/makefile b/3rdparty/bgfx/examples/07-callback/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/07-callback/makefile +++ b/3rdparty/bgfx/examples/07-callback/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/07-callback/vs_callback.sc b/3rdparty/bgfx/examples/07-callback/vs_callback.sc index 96e80ea0a5a..28ef12e9083 100644 --- a/3rdparty/bgfx/examples/07-callback/vs_callback.sc +++ b/3rdparty/bgfx/examples/07-callback/vs_callback.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_world, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/08-update/fs_update.sc b/3rdparty/bgfx/examples/08-update/fs_update.sc index 30a5cf97f61..7c64dfb8def 100644 --- a/3rdparty/bgfx/examples/08-update/fs_update.sc +++ b/3rdparty/bgfx/examples/08-update/fs_update.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/08-update/fs_update_3d.sc b/3rdparty/bgfx/examples/08-update/fs_update_3d.sc index 8f9c9765cc2..d07e2abeeef 100644 --- a/3rdparty/bgfx/examples/08-update/fs_update_3d.sc +++ b/3rdparty/bgfx/examples/08-update/fs_update_3d.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/08-update/fs_update_cmp.sc b/3rdparty/bgfx/examples/08-update/fs_update_cmp.sc index 09dd73fd0bf..d5e13254172 100644 --- a/3rdparty/bgfx/examples/08-update/fs_update_cmp.sc +++ b/3rdparty/bgfx/examples/08-update/fs_update_cmp.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/08-update/makefile b/3rdparty/bgfx/examples/08-update/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/08-update/makefile +++ b/3rdparty/bgfx/examples/08-update/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/08-update/update.cpp b/3rdparty/bgfx/examples/08-update/update.cpp index 789b2a038ea..0eb0c53cabe 100644 --- a/3rdparty/bgfx/examples/08-update/update.cpp +++ b/3rdparty/bgfx/examples/08-update/update.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -8,7 +8,8 @@ #include "packrect.h" #include "imgui/imgui.h" -#include +#include + #include namespace @@ -37,7 +38,7 @@ struct PosTexcoordVertex bgfx::VertexDecl PosTexcoordVertex::ms_decl; -static PosTexcoordVertex s_m_cubeVertices[28] = +static PosTexcoordVertex s_cubeVertices[] = { {-1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f }, { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }, @@ -74,8 +75,9 @@ static PosTexcoordVertex s_m_cubeVertices[28] = {-1.0f, -1.0f, 1.0f, -2.0f, -2.0f, 2.0f }, { 1.0f, -1.0f, 1.0f, 2.0f, -2.0f, 2.0f }, }; +BX_STATIC_ASSERT(BX_COUNTOF(s_cubeVertices) == 28); -static const uint16_t s_m_cubeIndices[36] = +static const uint16_t s_cubeIndices[] = { 0, 1, 2, // 0 1, 3, 2, @@ -95,8 +97,20 @@ static const uint16_t s_m_cubeIndices[36] = 20, 22, 21, // 10 21, 22, 23, }; +BX_STATIC_ASSERT(BX_COUNTOF(s_cubeIndices) == 36); -static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _side, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 0xff) +static void updateTextureCubeRectBgra8( + bgfx::TextureHandle _handle + , uint8_t _side + , uint16_t _x + , uint16_t _y + , uint16_t _width + , uint16_t _height + , uint8_t _r + , uint8_t _g + , uint8_t _b + , uint8_t _a = 0xff + ) { bgfx::TextureInfo ti; bgfx::calcTextureSize(ti, _width, _height, 1, false, false, 1, bgfx::TextureFormat::BGRA8); @@ -115,15 +129,15 @@ static void updateTextureCubeRectBgra8(bgfx::TextureHandle _handle, uint8_t _sid bgfx::updateTextureCube(_handle, 0, _side, 0, _x, _y, _width, _height, mem); } -static const uint16_t textureside = 512; -static const uint32_t texture2dSize = 256; +static const uint16_t kTextureSide = 512; +static const uint32_t kTexture2dSize = 256; class ExampleUpdate : public entry::AppI { public: ExampleUpdate(const char* _name, const char* _description) : entry::AppI(_name, _description) - , m_cube(textureside) + , m_cube(kTextureSide) { } @@ -136,8 +150,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -153,15 +172,19 @@ public: // Create vertex stream declaration. PosTexcoordVertex::init(); - m_textures[0] = loadTexture("textures/texture_compression_bc1.ktx", BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP); - m_textures[1] = loadTexture("textures/texture_compression_bc2.ktx", BGFX_TEXTURE_U_CLAMP); - m_textures[2] = loadTexture("textures/texture_compression_bc3.ktx", BGFX_TEXTURE_V_CLAMP); - m_textures[3] = loadTexture("textures/texture_compression_etc1.ktx", BGFX_TEXTURE_U_BORDER|BGFX_TEXTURE_V_BORDER|BGFX_TEXTURE_BORDER_COLOR(1) ); - m_textures[4] = loadTexture("textures/texture_compression_etc2.ktx"); - m_textures[5] = loadTexture("textures/texture_compression_ptc12.pvr"); - m_textures[6] = loadTexture("textures/texture_compression_ptc14.pvr"); - m_textures[7] = loadTexture("textures/texture_compression_ptc22.pvr"); - m_textures[8] = loadTexture("textures/texture_compression_ptc24.pvr"); + m_textures[ 0] = loadTexture("textures/texture_compression_bc1.ktx", BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP); + m_textures[ 1] = loadTexture("textures/texture_compression_bc2.ktx", BGFX_SAMPLER_U_CLAMP); + m_textures[ 2] = loadTexture("textures/texture_compression_bc3.ktx", BGFX_SAMPLER_V_CLAMP); + m_textures[ 3] = loadTexture("textures/texture_compression_etc1.ktx", BGFX_SAMPLER_U_BORDER | BGFX_SAMPLER_V_BORDER | BGFX_SAMPLER_BORDER_COLOR(1)); + m_textures[ 4] = loadTexture("textures/texture_compression_etc2.ktx"); + m_textures[ 5] = loadTexture("textures/texture_compression_ptc12.pvr"); + m_textures[ 6] = loadTexture("textures/texture_compression_ptc14.pvr"); + m_textures[ 7] = loadTexture("textures/texture_compression_ptc22.pvr"); + m_textures[ 8] = loadTexture("textures/texture_compression_ptc24.pvr"); + m_textures[ 9] = loadTexture("textures/texture_compression_atc.dds"); + m_textures[10] = loadTexture("textures/texture_compression_atci.dds"); + m_textures[11] = loadTexture("textures/texture_compression_atce.dds"); + BX_STATIC_ASSERT(12 == BX_COUNTOF(m_textures)); const bgfx::Caps* caps = bgfx::getCaps(); m_texture3DSupported = !!(caps->supported & BGFX_CAPS_TEXTURE_3D); @@ -189,27 +212,27 @@ public: } } - if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R8]) ) + if (0 != (BGFX_CAPS_FORMAT_TEXTURE_3D & caps->formats[bgfx::TextureFormat::R8]) ) { - m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem8); + m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R8, BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_SAMPLER_W_CLAMP, mem8); } - if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R16F]) ) + if (0 != (BGFX_CAPS_FORMAT_TEXTURE_3D & caps->formats[bgfx::TextureFormat::R16F]) ) { - m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R16F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem16f); + m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R16F, BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_SAMPLER_W_CLAMP, mem16f); } - if (0 != (BGFX_CAPS_FORMAT_TEXTURE_2D & caps->formats[bgfx::TextureFormat::R32F]) ) + if (0 != (BGFX_CAPS_FORMAT_TEXTURE_3D & caps->formats[bgfx::TextureFormat::R32F]) ) { - m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R32F, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP, mem32f); + m_textures3d[m_numTextures3d++] = bgfx::createTexture3D(32, 32, 32, false, bgfx::TextureFormat::R32F, BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_SAMPLER_W_CLAMP, mem32f); } } // Create static vertex buffer. - m_vbh = bgfx::createVertexBuffer(bgfx::makeRef(s_m_cubeVertices, sizeof(s_m_cubeVertices) ), PosTexcoordVertex::ms_decl); + m_vbh = bgfx::createVertexBuffer(bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ), PosTexcoordVertex::ms_decl); // Create static index buffer. - m_ibh = bgfx::createIndexBuffer(bgfx::makeRef(s_m_cubeIndices, sizeof(s_m_cubeIndices) ) ); + m_ibh = bgfx::createIndexBuffer(bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ) ); // Create programs. m_program = loadProgram("vs_update", "fs_update"); @@ -239,28 +262,28 @@ public: } m_textureCube[0] = bgfx::createTextureCube( - textureside - , false - , 1 - , bgfx::TextureFormat::BGRA8 - , BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT - ); + kTextureSide + , false + , 1 + , bgfx::TextureFormat::BGRA8 + , BGFX_SAMPLER_MIN_POINT|BGFX_SAMPLER_MAG_POINT|BGFX_SAMPLER_MIP_POINT + ); if (m_blitSupported) { m_textureCube[1] = bgfx::createTextureCube( - textureside - , false - , 1 - , bgfx::TextureFormat::BGRA8 - , BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT|BGFX_TEXTURE_BLIT_DST - ); + kTextureSide + , false + , 1 + , bgfx::TextureFormat::BGRA8 + , BGFX_SAMPLER_MIN_POINT|BGFX_SAMPLER_MAG_POINT|BGFX_SAMPLER_MIP_POINT|BGFX_TEXTURE_BLIT_DST + ); } if (m_computeSupported) { m_textureCube[2] = bgfx::createTextureCube( - textureside + kTextureSide , false , 1 , bgfx::TextureFormat::RGBA8 @@ -269,19 +292,19 @@ public: } m_texture2d = bgfx::createTexture2D( - texture2dSize - , texture2dSize - , false - , 1 - , bgfx::TextureFormat::BGRA8 - , BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT - ); + kTexture2dSize + , kTexture2dSize + , false + , 1 + , bgfx::TextureFormat::BGRA8 + , BGFX_SAMPLER_MIN_POINT|BGFX_SAMPLER_MAG_POINT|BGFX_SAMPLER_MIP_POINT + ); - m_texture2dData = (uint8_t*)malloc(texture2dSize*texture2dSize*4); + m_texture2dData = (uint8_t*)malloc(kTexture2dSize*kTexture2dSize*4); - m_rr = rand()%255; - m_gg = rand()%255; - m_bb = rand()%255; + m_rr = m_rng.gen()%255; + m_gg = m_rng.gen()%255; + m_bb = m_rng.gen()%255; m_hit = 0; m_miss = 0; @@ -364,7 +387,13 @@ public: imguiEndFrame(); - float borderColor[4] = { float(rand()%255)/255.0f, float(rand()%255)/255.0f, float(rand()%255)/255.0f, float(rand()%255)/255.0f }; + float borderColor[4] = + { + float(m_rng.gen()%255)/255.0f, + float(m_rng.gen()%255)/255.0f, + float(m_rng.gen()%255)/255.0f, + float(m_rng.gen()%255)/255.0f, + }; bgfx::setPaletteColor(1, borderColor); // Set view 0 and 1 viewport. @@ -383,8 +412,8 @@ public: { PackCube face; - uint16_t bw = bx::uint16_max(1, rand()%(textureside/4) ); - uint16_t bh = bx::uint16_max(1, rand()%(textureside/4) ); + uint16_t bw = bx::max(1, m_rng.gen()%(kTextureSide/4) ); + uint16_t bh = bx::max(1, m_rng.gen()%(kTextureSide/4) ); if (m_cube.find(bw, bh, face) ) { @@ -399,9 +428,9 @@ public: bgfx::blit(0, m_textureCube[1], 0, rect.m_x, rect.m_y, face.m_side, m_textureCube[0], 0, rect.m_x, rect.m_y, face.m_side, rect.m_width, rect.m_height); } - m_rr = rand()%255; - m_gg = rand()%255; - m_bb = rand()%255; + m_rr = m_rng.gen()%255; + m_gg = m_rng.gen()%255; + m_bb = m_rng.gen()%255; } else { @@ -425,14 +454,14 @@ public: { // Fill rect. - const uint32_t pitch = texture2dSize*4; + const uint32_t pitch = kTexture2dSize*4; - const uint16_t tw = rand()% texture2dSize; - const uint16_t th = rand()% texture2dSize; - const uint16_t tx = rand()%(texture2dSize-tw); - const uint16_t ty = rand()%(texture2dSize-th); + const uint16_t tw = m_rng.gen()% kTexture2dSize; + const uint16_t th = m_rng.gen()% kTexture2dSize; + const uint16_t tx = m_rng.gen()%(kTexture2dSize-tw); + const uint16_t ty = m_rng.gen()%(kTexture2dSize-th); - uint8_t* dst = &m_texture2dData[(ty*texture2dSize+tx)*4]; + uint8_t* dst = &m_texture2dData[(ty*kTexture2dSize+tx)*4]; uint8_t* next = dst + pitch; // Using makeRef to pass texture memory without copying. @@ -455,12 +484,13 @@ public: } } - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -5.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -5.0f }; float view[16]; - float proj[16]; bx::mtxLookAt(view, eye, at); + + float proj[16]; bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); // Set view and projection matrix for view 0. @@ -469,8 +499,8 @@ public: // Update texturecube using compute shader if (bgfx::isValid(m_programCompute) ) { - bgfx::setImage(0, s_texCube, m_textureCube[2], 0, bgfx::Access::Write); - bgfx::dispatch(0, m_programCompute, textureside/16, textureside/16); + bgfx::setImage(0, m_textureCube[2], 0, bgfx::Access::Write); + bgfx::dispatch(0, m_programCompute, kTextureSide/16, kTextureSide/16); } for (uint32_t ii = 0; ii < BX_COUNTOF(m_textureCube); ++ii) @@ -478,35 +508,38 @@ public: if (bgfx::isValid(m_textureCube[ii])) { float mtx[16]; - bx::mtxSRT( mtx, 0.7f, 0.7f, 0.7f, time, time*0.37f, 0.0f, -2.0f +ii*2.0f, 0.0f, 0.0f ); + bx::mtxSRT(mtx, 0.7f, 0.7f, 0.7f, time, time*0.37f, 0.0f, -2.0f +ii*2.0f, 0.0f, 0.0f); // Set model matrix for rendering. - bgfx::setTransform( mtx ); + bgfx::setTransform(mtx); // Set vertex and index buffer. - bgfx::setVertexBuffer(0, m_vbh ); - bgfx::setIndexBuffer( m_ibh ); + bgfx::setVertexBuffer(0, m_vbh); + bgfx::setIndexBuffer(m_ibh); // Bind texture. - bgfx::setTexture( 0, s_texCube, m_textureCube[ii] ); + bgfx::setTexture(0, s_texCube, m_textureCube[ii]); // Set render states. - bgfx::setState( BGFX_STATE_DEFAULT ); + bgfx::setState(BGFX_STATE_DEFAULT); // Submit primitive for rendering to view 0. - bgfx::submit( 0, m_program ); + bgfx::submit(0, m_program); } } // Set view and projection matrix for view 1. const float aspectRatio = float(m_height)/float(m_width); - const float size = 11.0f; + const float margin = 0.7f; + const float sizeX = 0.5f * BX_COUNTOF(m_textures) * 2.1f + margin; + const float sizeY = sizeX * aspectRatio; + const bgfx::Caps* caps = bgfx::getCaps(); - bx::mtxOrtho(proj, -size, size, size*aspectRatio, -size*aspectRatio, 0.0f, 1000.0f, 0.0f, caps->homogeneousDepth); + bx::mtxOrtho(proj, -sizeX, sizeX, sizeY, -sizeY, 0.0f, 1000.0f, 0.0f, caps->homogeneousDepth); bgfx::setViewTransform(1, NULL, proj); float mtx[16]; - bx::mtxTranslate(mtx, -size+2.0f - BX_COUNTOF(m_textures)*0.1f*0.5f, 1.9f, 0.0f); + bx::mtxTranslate(mtx, -sizeX + margin + 1.0f, 1.9f, 0.0f); // Set model matrix for rendering. bgfx::setTransform(mtx); @@ -524,11 +557,11 @@ public: // Submit primitive for rendering to view 1. bgfx::submit(1, m_programCmp); - const float xpos = -size+2.0f - BX_COUNTOF(m_textures)*0.1f*0.5f; + const float xpos = -sizeX + margin + 1.0f; for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii) { - bx::mtxTranslate(mtx, xpos + ii*2.1f, size-6.5f, 0.0f); + bx::mtxTranslate(mtx, xpos + ii*2.1f, sizeY - margin - 1.0f, 0.0f); // Set model matrix for rendering. bgfx::setTransform(mtx); @@ -549,7 +582,7 @@ public: for (uint32_t ii = 0; ii < m_numTextures3d; ++ii) { - bx::mtxTranslate(mtx, xpos + ii*2.1f, -size+6.5f, 0.0f); + bx::mtxTranslate(mtx, xpos + (ii+(BX_COUNTOF(m_textures) - m_numTextures3d)*0.5f)*2.1f, -sizeY + margin + 1.0f, 0.0f); // Set model matrix for rendering. bgfx::setTransform(mtx); @@ -570,7 +603,7 @@ public: for (uint32_t ii = 0; ii < 4; ++ii) { - bx::mtxTranslate(mtx, xpos + (size-2.0f)*2.1f, -size+6.5f + ii*2.1f, 0.0f); + bx::mtxTranslate(mtx, sizeX - margin - 1.0f, -sizeY + margin + 1.0f + ii*2.1f, 0.0f); // Set model matrix for rendering. bgfx::setTransform(mtx); @@ -616,6 +649,7 @@ public: RectPackCubeT<256> m_cube; int64_t m_updateTime; int64_t m_timeOffset; + bx::RngMwc m_rng; uint32_t m_hit; uint32_t m_miss; @@ -624,7 +658,7 @@ public: uint8_t m_gg; uint8_t m_bb; - bgfx::TextureHandle m_textures[9]; + bgfx::TextureHandle m_textures[12]; bgfx::TextureHandle m_textures3d[3]; bgfx::TextureHandle m_texture2d; bgfx::TextureHandle m_textureCube[3]; diff --git a/3rdparty/bgfx/examples/08-update/vs_update.sc b/3rdparty/bgfx/examples/08-update/vs_update.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/08-update/vs_update.sc +++ b/3rdparty/bgfx/examples/08-update/vs_update.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/common.sh b/3rdparty/bgfx/examples/09-hdr/common.sh index 28e1b9981b5..c2fb179dbf3 100644 --- a/3rdparty/bgfx/examples/09-hdr/common.sh +++ b/3rdparty/bgfx/examples/09-hdr/common.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_blur.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_blur.sc index 5a70fa5e8d6..e4ceb061faa 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_blur.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_blur.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_bright.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_bright.sc index 16824eb1ffa..3c969b30c1c 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_bright.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_bright.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_lum.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_lum.sc index 1a09d5f1cc1..488a04b0104 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_lum.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_lum.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_lumavg.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_lumavg.sc index 2e4dc943bea..eb35f1f3caa 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_lumavg.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_lumavg.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_mesh.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_mesh.sc index 4d7824d207d..1e64fd1ff9d 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_mesh.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_mesh.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_skybox.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_skybox.sc index 7ca789a75bd..63e6d58e5d1 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_skybox.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_skybox.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/fs_hdr_tonemap.sc b/3rdparty/bgfx/examples/09-hdr/fs_hdr_tonemap.sc index 9c02a901da6..e17ebfedfa6 100644 --- a/3rdparty/bgfx/examples/09-hdr/fs_hdr_tonemap.sc +++ b/3rdparty/bgfx/examples/09-hdr/fs_hdr_tonemap.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/hdr.cpp b/3rdparty/bgfx/examples/09-hdr/hdr.cpp index 500acf0560a..fb3a266dacb 100644 --- a/3rdparty/bgfx/examples/09-hdr/hdr.cpp +++ b/3rdparty/bgfx/examples/09-hdr/hdr.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -154,8 +154,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -163,11 +168,11 @@ public: // Create vertex stream declaration. PosColorTexCoord0Vertex::init(); - m_uffizi = loadTexture("textures/uffizi.dds" + m_uffizi = loadTexture("textures/uffizi.ktx" , 0 - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP - | BGFX_TEXTURE_W_CLAMP + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP + | BGFX_SAMPLER_W_CLAMP ); m_skyProgram = loadProgram("vs_hdr_skybox", "fs_hdr_skybox"); @@ -302,10 +307,10 @@ public: , false , 1 , bgfx::TextureFormat::BGRA8 - , ((msaa + 1) << BGFX_TEXTURE_RT_MSAA_SHIFT) | BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP + , (uint64_t(msaa + 1) << BGFX_TEXTURE_RT_MSAA_SHIFT) | BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP ); - const uint32_t textureFlags = BGFX_TEXTURE_RT_WRITE_ONLY|( (msaa+1)<homogeneousDepth); // Set view and projection matrix for view hdrMesh. bgfx::setViewTransform(hdrMesh, view, proj); - float tonemap[4] = { m_middleGray, bx::fsq(m_white), m_threshold, m_time }; + float tonemap[4] = { m_middleGray, bx::square(m_white), m_threshold, m_time }; // Render skybox into view hdrSkybox. bgfx::setTexture(0, s_texCube, m_uffizi); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); bgfx::setUniform(u_mtx, mtx); screenSpaceQuad( (float)m_width, (float)m_height, true); bgfx::submit(hdrSkybox, m_skyProgram); @@ -497,35 +504,35 @@ public: // Calculate luminance. setOffsets2x2Lum(u_offset, 128, 128); bgfx::setTexture(0, s_texColor, m_fbtextures[0]); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(128.0f, 128.0f, m_caps->originBottomLeft); bgfx::submit(hdrLuminance, m_lumProgram); // Downscale luminance 0. setOffsets4x4Lum(u_offset, 128, 128); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[0]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(64.0f, 64.0f, m_caps->originBottomLeft); bgfx::submit(hdrLumScale0, m_lumAvgProgram); // Downscale luminance 1. setOffsets4x4Lum(u_offset, 64, 64); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[1]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(16.0f, 16.0f, m_caps->originBottomLeft); bgfx::submit(hdrLumScale1, m_lumAvgProgram); // Downscale luminance 2. setOffsets4x4Lum(u_offset, 16, 16); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[2]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(4.0f, 4.0f, m_caps->originBottomLeft); bgfx::submit(hdrLumScale2, m_lumAvgProgram); // Downscale luminance 3. setOffsets4x4Lum(u_offset, 4, 4); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_lum[3]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(1.0f, 1.0f, m_caps->originBottomLeft); bgfx::submit(hdrLumScale3, m_lumAvgProgram); @@ -533,14 +540,14 @@ public: setOffsets4x4Lum(u_offset, m_width/2, m_height/2); bgfx::setTexture(0, s_texColor, m_fbtextures[0]); bgfx::setTexture(1, s_texLum, bgfx::getTexture(m_lum[4]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); bgfx::setUniform(u_tonemap, tonemap); screenSpaceQuad( (float)m_width/2.0f, (float)m_height/2.0f, m_caps->originBottomLeft); bgfx::submit(hdrBrightness, m_brightProgram); // m_blur m_bright pass vertically. bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_bright) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); bgfx::setUniform(u_tonemap, tonemap); screenSpaceQuad( (float)m_width/8.0f, (float)m_height/8.0f, m_caps->originBottomLeft); bgfx::submit(hdrVBlur, m_blurProgram); @@ -549,7 +556,7 @@ public: bgfx::setTexture(0, s_texColor, m_fbtextures[0]); bgfx::setTexture(1, s_texLum, bgfx::getTexture(m_lum[4]) ); bgfx::setTexture(2, s_texBlur, bgfx::getTexture(m_blur) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad( (float)m_width, (float)m_height, m_caps->originBottomLeft); bgfx::submit(hdrHBlurTonemap, m_tonemapProgram); diff --git a/3rdparty/bgfx/examples/09-hdr/makefile b/3rdparty/bgfx/examples/09-hdr/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/09-hdr/makefile +++ b/3rdparty/bgfx/examples/09-hdr/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_blur.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_blur.sc index 3dd4f6eeb5e..51b17c14b5b 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_blur.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_blur.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_bright.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_bright.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_bright.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_bright.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_lum.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_lum.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_lum.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_lum.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_lumavg.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_lumavg.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_lumavg.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_lumavg.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_mesh.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_mesh.sc index e2ab69dc8a3..01648dc32b5 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_mesh.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_mesh.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_pos, v_view, v_normal /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_skybox.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_skybox.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_skybox.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_skybox.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/09-hdr/vs_hdr_tonemap.sc b/3rdparty/bgfx/examples/09-hdr/vs_hdr_tonemap.sc index 2fa2c708f8b..13604778439 100644 --- a/3rdparty/bgfx/examples/09-hdr/vs_hdr_tonemap.sc +++ b/3rdparty/bgfx/examples/09-hdr/vs_hdr_tonemap.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/10-font/font.cpp b/3rdparty/bgfx/examples/10-font/font.cpp index a3f1bacca30..26dbfc76e6e 100644 --- a/3rdparty/bgfx/examples/10-font/font.cpp +++ b/3rdparty/bgfx/examples/10-font/font.cpp @@ -68,8 +68,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -244,17 +249,17 @@ public: const double toMs = 1000.0 / freq; // Use transient text to display debug information. - wchar_t fpsText[64]; - bx::swnprintf(fpsText, BX_COUNTOF(fpsText), L"Frame: % 7.3f[ms]", double(frameTime) * toMs); + char fpsText[64]; + bx::snprintf(fpsText, BX_COUNTOF(fpsText), "Frame: % 7.3f[ms]", double(frameTime) * toMs); m_textBufferManager->clearTextBuffer(m_transientText); m_textBufferManager->setPenPosition(m_transientText, m_width - 150.0f, 10.0f); - m_textBufferManager->appendText(m_transientText, m_visitor10, L"Transient\n"); - m_textBufferManager->appendText(m_transientText, m_visitor10, L"text buffer\n"); + m_textBufferManager->appendText(m_transientText, m_visitor10, "Transient\n"); + m_textBufferManager->appendText(m_transientText, m_visitor10, "text buffer\n"); m_textBufferManager->appendText(m_transientText, m_visitor10, fpsText); - float at[3] = { 0, 0, 0.0f }; - float eye[3] = { 0, 0, -1.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -1.0f }; float view[16]; bx::mtxLookAt(view, eye, at); @@ -262,49 +267,7 @@ public: const float centering = 0.5f; // Setup a top-left ortho matrix for screen space drawing. - const bgfx::HMD* hmd = bgfx::getHMD(); const bgfx::Caps* caps = bgfx::getCaps(); - if (NULL != hmd - && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float proj[16]; - bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, caps->homogeneousDepth); - - static float time = 0.0f; - time += 0.05f; - - const float dist = 10.0f; - const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]); - const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]); - - float ortho[2][16]; - const float offsetx = m_width/2.0f; - bx::mtxOrtho( - ortho[0] - , centering - , offsetx + centering - , m_height + centering - , centering - , -1.0f - , 1.0f - , offset0 - , caps->homogeneousDepth - ); - bx::mtxOrtho( - ortho[1] - , centering - , offsetx + centering - , m_height + centering - , centering - , -1.0f - , 1.0f - , offset1 - , caps->homogeneousDepth - ); - bgfx::setViewTransform(0, view, ortho[0], BGFX_VIEW_STEREO, ortho[1]); - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float ortho[16]; bx::mtxOrtho( diff --git a/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp b/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp index aa653c80285..43634abba9b 100644 --- a/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp +++ b/3rdparty/bgfx/examples/11-fontsdf/fontsdf.cpp @@ -51,8 +51,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -142,12 +147,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 2.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 2.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); bool recomputeVisibleText = false; @@ -183,8 +191,8 @@ public: // if no other draw calls are submitted to view 0. bgfx::touch(0); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -1.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -1.0f }; float view[16]; bx::mtxLookAt(view, eye, at); @@ -192,30 +200,7 @@ public: const float centering = 0.5f; // Setup a top-left ortho matrix for screen space drawing. - const bgfx::HMD* hmd = bgfx::getHMD(); const bgfx::Caps* caps = bgfx::getCaps(); - if (NULL != hmd - && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float proj[16]; - bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, caps->homogeneousDepth); - - static float time = 0.0f; - time += 0.05f; - - const float dist = 10.0f; - const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]); - const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]); - - float ortho[2][16]; - const float viewOffset = m_width/4.0f; - const float viewWidth = m_width/2.0f; - bx::mtxOrtho(ortho[0], centering + viewOffset, centering + viewOffset + viewWidth, m_height + centering, centering, -1.0f, 1.0f, offset0, caps->homogeneousDepth); - bx::mtxOrtho(ortho[1], centering + viewOffset, centering + viewOffset + viewWidth, m_height + centering, centering, -1.0f, 1.0f, offset1, caps->homogeneousDepth); - bgfx::setViewTransform(0, view, ortho[0], BGFX_VIEW_STEREO, ortho[1]); - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float ortho[16]; bx::mtxOrtho(ortho, centering, m_width + centering, m_height + centering, centering, -1.0f, 1.0f, 0.0f, caps->homogeneousDepth); diff --git a/3rdparty/bgfx/examples/12-lod/lod.cpp b/3rdparty/bgfx/examples/12-lod/lod.cpp index 19ac984817e..130826c747f 100644 --- a/3rdparty/bgfx/examples/12-lod/lod.cpp +++ b/3rdparty/bgfx/examples/12-lod/lod.cpp @@ -43,8 +43,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -76,7 +81,7 @@ public: m_textureStipple = bgfx::createTexture2D(8, 4, false, 1 , bgfx::TextureFormat::R8 - , BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIN_POINT + , BGFX_SAMPLER_MAG_POINT|BGFX_SAMPLER_MIN_POINT , stippleTex ); @@ -144,12 +149,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 2.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 6.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::Checkbox("Transition", &m_transitions); @@ -168,24 +176,10 @@ public: // if no other draw calls are submitted to view 0. bgfx::touch(0); - float at[3] = { 0.0f, 1.0f, 0.0f }; - float eye[3] = { 0.0f, 2.0f, -distance }; + const bx::Vec3 at = { 0.0f, 1.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 2.0f, -distance }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's m_width/m_height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -216,8 +210,8 @@ public: stippleInv[2] = (float(m_transitionFrame)*4.0f/255.0f) - (1.0f/255.0f); const uint64_t stateTransparent = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -251,12 +245,12 @@ public: } int lod = 0; - if (eye[2] < -2.5f) + if (eye.z < -2.5f) { lod = 1; } - if (eye[2] < -5.0f) + if (eye.z < -5.0f) { lod = 2; } diff --git a/3rdparty/bgfx/examples/12-lod/makefile b/3rdparty/bgfx/examples/12-lod/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/12-lod/makefile +++ b/3rdparty/bgfx/examples/12-lod/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/13-stencil/makefile b/3rdparty/bgfx/examples/13-stencil/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/13-stencil/makefile +++ b/3rdparty/bgfx/examples/13-stencil/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/13-stencil/stencil.cpp b/3rdparty/bgfx/examples/13-stencil/stencil.cpp index a1af5aceb02..5308757e87f 100644 --- a/3rdparty/bgfx/examples/13-stencil/stencil.cpp +++ b/3rdparty/bgfx/examples/13-stencil/stencil.cpp @@ -401,8 +401,8 @@ struct RenderState static RenderState s_renderStates[RenderState::Count] = { { // StencilReflection_CraftStencil - BGFX_STATE_RGB_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA , UINT32_MAX @@ -415,10 +415,10 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // StencilReflection_DrawReflected - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CW //reflection matrix has inverted normals. using CCW instead of CW. | BGFX_STATE_MSAA @@ -432,8 +432,8 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // StencilReflection_BlendPlane - BGFX_STATE_RGB_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_Z | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_SRC_COLOR) | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW @@ -443,8 +443,8 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // StencilReflection_DrawScene - BGFX_STATE_RGB_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -453,8 +453,8 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ProjectionShadows_DrawAmbient - BGFX_STATE_RGB_WRITE - | BGFX_STATE_DEPTH_WRITE // write depth ! + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_Z // write depth ! | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -475,7 +475,7 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ProjectionShadows_DrawDiffuse - BGFX_STATE_RGB_WRITE + BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) | BGFX_STATE_DEPTH_TEST_EQUAL | BGFX_STATE_CULL_CCW @@ -490,9 +490,9 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_BlendLightTexture - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_COLOR, BGFX_STATE_BLEND_INV_SRC_COLOR) | BGFX_STATE_CULL_CCW @@ -502,7 +502,7 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_DrawPlaneBottom - BGFX_STATE_RGB_WRITE + BGFX_STATE_WRITE_RGB | BGFX_STATE_CULL_CW | BGFX_STATE_MSAA , UINT32_MAX @@ -805,8 +805,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_viewState.m_width, m_viewState.m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_viewState.m_width; + init.resolution.height = m_viewState.m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -926,12 +931,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_viewState.m_width - m_viewState.m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_viewState.m_width / 5.0f, m_viewState.m_height / 2.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_viewState.m_width / 5.0f, m_viewState.m_height / 2.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); { @@ -1005,9 +1013,9 @@ public: const float radius = (m_scene == StencilReflectionScene) ? 15.0f : 25.0f; for (uint8_t ii = 0; ii < numLights; ++ii) { - lightPosRadius[ii][0] = bx::fsin( (lightTimeAccumulator*1.1f + ii*0.03f + ii*bx::kPiHalf*1.07f ) )*20.0f; - lightPosRadius[ii][1] = 8.0f + (1.0f - bx::fcos( (lightTimeAccumulator*1.5f + ii*0.29f + bx::kPiHalf*1.49f ) ) )*4.0f; - lightPosRadius[ii][2] = bx::fcos( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::kPiHalf*1.79f ) )*20.0f; + lightPosRadius[ii][0] = bx::sin( (lightTimeAccumulator*1.1f + ii*0.03f + ii*bx::kPiHalf*1.07f ) )*20.0f; + lightPosRadius[ii][1] = 8.0f + (1.0f - bx::cos( (lightTimeAccumulator*1.5f + ii*0.29f + bx::kPiHalf*1.49f ) ) )*4.0f; + lightPosRadius[ii][2] = bx::cos( (lightTimeAccumulator*1.3f + ii*0.13f + ii*bx::kPiHalf*1.79f ) )*20.0f; lightPosRadius[ii][3] = radius; } bx::memCopy(s_uniforms.m_lightPosRadius, lightPosRadius, numLights * 4*sizeof(float) ); @@ -1077,9 +1085,9 @@ public: , 0.0f , 0.0f , 0.0f - , bx::fsin(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f + , bx::sin(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f , 4.0f - , bx::fcos(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f + , bx::cos(ii * 2.0f + 13.0f - sceneTimeAccumulator) * 13.0f ); } diff --git a/3rdparty/bgfx/examples/14-shadowvolumes/makefile b/3rdparty/bgfx/examples/14-shadowvolumes/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/14-shadowvolumes/makefile +++ b/3rdparty/bgfx/examples/14-shadowvolumes/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp index d6195526d12..e3273c8d135 100644 --- a/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp +++ b/3rdparty/bgfx/examples/14-shadowvolumes/shadowvolumes.cpp @@ -365,9 +365,9 @@ static void setRenderState(const RenderState& _renderState) static RenderState s_renderStates[RenderState::Count] = { { // ShadowVolume_UsingStencilTexture_DrawAmbient - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -376,7 +376,7 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ShadowVolume_UsingStencilTexture_BuildDepth - BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -385,8 +385,8 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ShadowVolume_UsingStencilTexture_CraftStencil_DepthPass - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) | BGFX_STATE_DEPTH_TEST_LEQUAL | BGFX_STATE_MSAA @@ -395,8 +395,8 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ShadowVolume_UsingStencilTexture_CraftStencil_DepthFail - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) | BGFX_STATE_DEPTH_TEST_GEQUAL | BGFX_STATE_MSAA @@ -405,10 +405,10 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ShadowVolume_UsingStencilTexture_DrawDiffuse - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_EQUAL | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -417,9 +417,9 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // ShadowVolume_UsingStencilBuffer_DrawAmbient - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -462,8 +462,8 @@ static RenderState s_renderStates[RenderState::Count] = | BGFX_STENCIL_OP_PASS_Z_KEEP }, { // ShadowVolume_UsingStencilBuffer_DrawDiffuse - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) | BGFX_STATE_DEPTH_TEST_EQUAL | BGFX_STATE_CULL_CCW @@ -478,9 +478,9 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_Default - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -489,9 +489,9 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_BlendLightTexture - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_COLOR, BGFX_STATE_BLEND_INV_SRC_COLOR) | BGFX_STATE_CULL_CCW @@ -501,9 +501,9 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_DrawPlaneBottom - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_CULL_CW | BGFX_STATE_MSAA , UINT32_MAX @@ -511,7 +511,7 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_DrawShadowVolume_Lines - BGFX_STATE_RGB_WRITE + BGFX_STATE_WRITE_RGB | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_SRC_ALPHA) | BGFX_STATE_PT_LINES @@ -1713,7 +1713,7 @@ void createNearClipVolume(float* __restrict _outPlanes24f // -1.0f - behind near plane float lightSide = float( (d > delta) - (d < -delta) ); - float t = bx::ftan(bx::toRad(_fovy)*0.5f) * _near; + float t = bx::tan(bx::toRad(_fovy)*0.5f) * _near; float b = -t; float r = t * _aspect; float l = -r; @@ -1736,10 +1736,10 @@ void createNearClipVolume(float* __restrict _outPlanes24f for (uint8_t ii = 0; ii < 4; ++ii) { float* normal = planeNormals[ii]; - float* plane = volumePlanes[ii]; + float* plane = volumePlanes[ii]; float planeVec[3]; - bx::vec3Sub(planeVec, corners[ii], corners[(ii-1)%4]); + bx::vec3Sub(planeVec, corners[ii], corners[(ii-1)&3]); float light[3]; float tmp[3]; @@ -1752,7 +1752,7 @@ void createNearClipVolume(float* __restrict _outPlanes24f normal[1] *= lightSide; normal[2] *= lightSide; - float lenInv = 1.0f / bx::fsqrt(bx::vec3Dot(normal, normal) ); + float lenInv = 1.0f / bx::sqrt(bx::vec3Dot(normal, normal) ); plane[0] = normal[0] * lenInv; plane[1] = normal[1] * lenInv; @@ -1775,7 +1775,7 @@ void createNearClipVolume(float* __restrict _outPlanes24f bx::vec3MulMtx(tmp, lightPlaneNormal, mtxViewInv); bx::vec3Sub(lightPlaneNormal, tmp, _lightPos); - float lenInv = 1.0f / bx::fsqrt(bx::vec3Dot(lightPlaneNormal, lightPlaneNormal) ); + float lenInv = 1.0f / bx::sqrt(bx::vec3Dot(lightPlaneNormal, lightPlaneNormal) ); lightPlane[0] = lightPlaneNormal[0] * lenInv; lightPlane[1] = lightPlaneNormal[1] * lenInv; @@ -1786,7 +1786,7 @@ void createNearClipVolume(float* __restrict _outPlanes24f bool clipTest(const float* _planes, uint8_t _planeNum, const Mesh& _mesh, const float* _scale, const float* _translate) { float (*volumePlanes)[4] = (float(*)[4])_planes; - float scale = bx::fmax(bx::fmax(_scale[0], _scale[1]), _scale[2]); + float scale = bx::max(_scale[0], _scale[1], _scale[2]); const GroupArray& groups = _mesh.m_groups; for (GroupArray::const_iterator it = groups.begin(), itEnd = groups.end(); it != itEnd; ++it) @@ -1882,11 +1882,16 @@ public: m_viewState = ViewState(_width, _height); m_clearValues = { 0x00000000, 1.0f, 0 }; - m_debug = BGFX_DEBUG_NONE; + m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_viewState.m_width, m_viewState.m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_viewState.m_width; + init.resolution.height = m_viewState.m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -1908,7 +1913,7 @@ public: bgfx::TextureHandle fbtextures[] = { - bgfx::createTexture2D(uint16_t(m_viewState.m_width), uint16_t(m_viewState.m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_RT), + bgfx::createTexture2D(uint16_t(m_viewState.m_width), uint16_t(m_viewState.m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_TEXTURE_RT), bgfx::createTexture2D(uint16_t(m_viewState.m_width), uint16_t(m_viewState.m_height), false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY), }; @@ -2112,7 +2117,7 @@ public: bgfx::TextureHandle fbtextures[] = { - bgfx::createTexture2D(uint16_t(m_viewState.m_width), uint16_t(m_viewState.m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_RT), + bgfx::createTexture2D(uint16_t(m_viewState.m_width), uint16_t(m_viewState.m_height), false, 1, bgfx::TextureFormat::BGRA8, BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_TEXTURE_RT), bgfx::createTexture2D(uint16_t(m_viewState.m_width), uint16_t(m_viewState.m_height), false, 1, bgfx::TextureFormat::D16, BGFX_TEXTURE_RT_WRITE_ONLY) }; s_stencilFb = bgfx::createFrameBuffer(BX_COUNTOF(fbtextures), fbtextures, true); @@ -2133,19 +2138,6 @@ public: cameraUpdate(deltaTime, m_mouseState); // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float eye[3]; - cameraGetPosition(eye); - - bx::mtxQuatTranslationHMD(m_viewState.m_view, hmd->eye[0].rotation, eye); - bx::mtxProj(m_viewState.m_proj, hmd->eye[0].fov, nearPlane, farPlane, s_oglNdc); - - m_viewState.m_width = hmd->width; - m_viewState.m_height = hmd->height; - } - else { cameraGetViewMtx(m_viewState.m_view); bx::mtxProj(m_viewState.m_proj, fov, aspect, nearPlane, farPlane, s_oglNdc); @@ -2164,11 +2156,17 @@ public: showExampleDialog(this); - ImGui::SetNextWindowPos(ImVec2(m_viewState.m_width - 256.0f, 10.0f) ); + ImGui::SetNextWindowPos( + ImVec2(m_viewState.m_width - 256.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(256.0f, 700.0f) + , ImGuiCond_FirstUseEver + ); ImGui::Begin("Settings" , NULL - , ImVec2(256.0f, 700.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); const char* titles[2] = @@ -2266,11 +2264,17 @@ public: ImGui::End(); - ImGui::SetNextWindowPos(ImVec2(10, float(m_viewState.m_height) - 77.0f - 10.0f) ); + ImGui::SetNextWindowPos( + ImVec2(10, float(m_viewState.m_height) - 77.0f - 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(120.0f, 77.0f) + , ImGuiCond_FirstUseEver + ); ImGui::Begin("Show help:" , NULL - , ImVec2(120.0f, 77.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); if (ImGui::Button(m_showHelp ? "ON" : "OFF") ) @@ -2310,9 +2314,9 @@ public: { for (uint8_t ii = 0; ii < m_numLights; ++ii) { - lightPosRadius[ii][0] = bx::fcos(2.0f*bx::kPi/float(m_numLights) * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f; + lightPosRadius[ii][0] = bx::cos(2.0f*bx::kPi/float(m_numLights) * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f; lightPosRadius[ii][1] = 20.0f; - lightPosRadius[ii][2] = bx::fsin(2.0f*bx::kPi/float(m_numLights) * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f; + lightPosRadius[ii][2] = bx::sin(2.0f*bx::kPi/float(m_numLights) * float(ii) + lightTimeAccumulator * 1.1f + 3.0f) * 20.0f; lightPosRadius[ii][3] = 20.0f; } } @@ -2320,16 +2324,16 @@ public: { for (uint8_t ii = 0; ii < m_numLights; ++ii) { - lightPosRadius[ii][0] = bx::fcos(float(ii) * 2.0f/float(m_numLights) + lightTimeAccumulator * 1.3f + bx::kPi) * 40.0f; + lightPosRadius[ii][0] = bx::cos(float(ii) * 2.0f/float(m_numLights) + lightTimeAccumulator * 1.3f + bx::kPi) * 40.0f; lightPosRadius[ii][1] = 20.0f; - lightPosRadius[ii][2] = bx::fsin(float(ii) * 2.0f/float(m_numLights) + lightTimeAccumulator * 1.3f + bx::kPi) * 40.0f; + lightPosRadius[ii][2] = bx::sin(float(ii) * 2.0f/float(m_numLights) + lightTimeAccumulator * 1.3f + bx::kPi) * 40.0f; lightPosRadius[ii][3] = 20.0f; } } if (m_showHelp) { - uint8_t row = 5; + uint8_t row = 18; bgfx::dbgTextPrintf(3, row++, 0x0f, "Stencil buffer implementation:"); bgfx::dbgTextPrintf(8, row++, 0x0f, "Depth fail - Robust, but slower than 'Depth pass'. Requires computing and drawing of shadow volume caps."); bgfx::dbgTextPrintf(8, row++, 0x0f, "Depth pass - Faster, but not stable. Shadows are wrong when camera is in the shadow."); @@ -2345,6 +2349,10 @@ public: bgfx::dbgTextPrintf(8, row++, 0x0f, "Stencil buffer - Faster, but capable only of +1 incr."); bgfx::dbgTextPrintf(8, row++, 0x0f, "Texture as stencil - Slower, but capable of +2 incr."); } + else + { + bgfx::dbgTextClear(); + } // Setup instances Instance shadowCasters[SceneCount][60]; @@ -2390,9 +2398,9 @@ public: inst.m_rotation[0] = 0.0f; inst.m_rotation[1] = 0.0f; inst.m_rotation[2] = 0.0f; - inst.m_pos[0] = bx::fsin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; + inst.m_pos[0] = bx::sin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; inst.m_pos[1] = 6.0f; - inst.m_pos[2] = bx::fcos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; + inst.m_pos[2] = bx::cos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; inst.m_model = &m_cubeModel; } @@ -2407,9 +2415,9 @@ public: inst.m_rotation[0] = 0.0f; inst.m_rotation[1] = 0.0f; inst.m_rotation[2] = 0.0f; - inst.m_pos[0] = bx::fsin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; + inst.m_pos[0] = bx::sin(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; inst.m_pos[1] = 22.0f; - inst.m_pos[2] = bx::fcos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; + inst.m_pos[2] = bx::cos(ii * 2.0f + 13.0f + sceneTimeAccumulator * 1.1f) * 13.0f; inst.m_model = &m_cubeModel; } diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile b/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile +++ b/3rdparty/bgfx/examples/15-shadowmaps-simple/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp index 0119c730d8f..b42b4a6f819 100644 --- a/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp +++ b/3rdparty/bgfx/examples/15-shadowmaps-simple/shadowmaps_simple.cpp @@ -75,8 +75,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -141,7 +146,7 @@ public: , false , 1 , bgfx::TextureFormat::D16 - , BGFX_TEXTURE_RT | BGFX_TEXTURE_COMPARE_LEQUAL + , BGFX_TEXTURE_RT | BGFX_SAMPLER_COMPARE_LEQUAL ), }; shadowMapTexture = fbtextures[0]; @@ -179,9 +184,8 @@ public: m_state[0] = meshStateCreate(); m_state[0]->m_state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | (m_shadowSamplerSupported ? 0 : BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A) + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -192,9 +196,9 @@ public: m_state[1] = meshStateCreate(); m_state[1]->m_state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -209,8 +213,8 @@ public: // Set view and projection matrices. - float eye[3] = { 0.0f, 30.0f, -60.0f }; - float at[3] = { 0.0f, 5.0f, 0.0f }; + const bx::Vec3 at = { 0.0f, 5.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 30.0f, -60.0f }; bx::mtxLookAt(m_view, eye, at); const float aspect = float(int32_t(m_width) ) / float(int32_t(m_height) ); @@ -275,9 +279,9 @@ public: // Setup lights. float lightPos[4]; - lightPos[0] = -bx::fcos(time); + lightPos[0] = -bx::cos(time); lightPos[1] = -1.0f; - lightPos[2] = -bx::fsin(time); + lightPos[2] = -bx::sin(time); lightPos[3] = 0.0f; bgfx::setUniform(u_lightPos, lightPos); @@ -315,9 +319,8 @@ public: float lightView[16]; float lightProj[16]; - float eye[3] = { -lightPos[0], -lightPos[1], -lightPos[2] }; - float at[3] = { 0.0f, 0.0f, 0.0f }; - + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { -lightPos[0], -lightPos[1], -lightPos[2] }; bx::mtxLookAt(lightView, eye, at); const bgfx::Caps* caps = bgfx::getCaps(); diff --git a/3rdparty/bgfx/examples/16-shadowmaps/makefile b/3rdparty/bgfx/examples/16-shadowmaps/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/makefile +++ b/3rdparty/bgfx/examples/16-shadowmaps/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp index 9ee44d7fbbb..4c9a020604a 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp +++ b/3rdparty/bgfx/examples/16-shadowmaps/shadowmaps.cpp @@ -213,12 +213,12 @@ void mtxYawPitchRoll(float* __restrict _result , float _roll ) { - float sroll = bx::fsin(_roll); - float croll = bx::fcos(_roll); - float spitch = bx::fsin(_pitch); - float cpitch = bx::fcos(_pitch); - float syaw = bx::fsin(_yaw); - float cyaw = bx::fcos(_yaw); + float sroll = bx::sin(_roll); + float croll = bx::cos(_roll); + float spitch = bx::sin(_pitch); + float cpitch = bx::cos(_pitch); + float syaw = bx::sin(_yaw); + float cyaw = bx::cos(_yaw); _result[ 0] = sroll * spitch * syaw + croll * cyaw; _result[ 1] = sroll * cpitch; @@ -647,10 +647,10 @@ static RenderState s_renderStates[RenderState::Count] = { { // Default 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_LESS - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA , UINT32_MAX @@ -659,9 +659,9 @@ static RenderState s_renderStates[RenderState::Count] = }, { // ShadowMap_PackDepth 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -671,9 +671,9 @@ static RenderState s_renderStates[RenderState::Count] = }, { // ShadowMap_PackDepthHoriz 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -688,9 +688,9 @@ static RenderState s_renderStates[RenderState::Count] = }, { // ShadowMap_PackDepthVert 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -704,9 +704,9 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_BlendLightTexture - BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_COLOR, BGFX_STATE_BLEND_INV_SRC_COLOR) | BGFX_STATE_CULL_CCW @@ -716,7 +716,7 @@ static RenderState s_renderStates[RenderState::Count] = , BGFX_STENCIL_NONE }, { // Custom_DrawPlaneBottom - BGFX_STATE_RGB_WRITE + BGFX_STATE_WRITE_RGB | BGFX_STATE_CULL_CW | BGFX_STATE_MSAA , UINT32_MAX @@ -1114,7 +1114,7 @@ void splitFrustum(float* _splits, uint8_t _numSplits, float _near, float _far, f { float si = float(int8_t(ff) ) / numSlicesf; - const float nearp = l*(_near*bx::fpow(ratio, si) ) + (1 - l)*(_near + (_far - _near)*si); + const float nearp = l*(_near*bx::pow(ratio, si) ) + (1 - l)*(_near + (_far - _near)*si); _splits[nn] = nearp; //near _splits[ff] = nearp * 1.005f; //far from previous split } @@ -1301,8 +1301,13 @@ public: m_viewState = ViewState(uint16_t(m_width), uint16_t(m_height)); m_clearValues = ClearValues(0x00000000, 1.0f, 0); - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_viewState.m_width, m_viewState.m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_viewState.m_width; + init.resolution.height = m_viewState.m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -1957,7 +1962,7 @@ public: const float camAspect = float(int32_t(m_viewState.m_width) ) / float(int32_t(m_viewState.m_height) ); const float camNear = 0.1f; const float camFar = 2000.0f; - const float projHeight = 1.0f/bx::ftan(bx::toRad(camFovy)*0.5f); + const float projHeight = bx::tan(bx::toRad(camFovy)*0.5f); const float projWidth = projHeight * camAspect; bx::mtxProj(m_viewState.m_proj, camFovy, camAspect, camNear, camFar, caps->homogeneousDepth); cameraGetViewMtx(m_viewState.m_view); @@ -1984,12 +1989,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_viewState.m_width - m_viewState.m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_viewState.m_width / 5.0f, m_viewState.m_height - 20.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_viewState.m_width / 5.0f, m_viewState.m_height - 20.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); #define IMGUI_FLOAT_SLIDER(_name, _val) \ @@ -2086,12 +2094,15 @@ public: ImGui::SetNextWindowPos( ImVec2(10.0f, 260.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_viewState.m_width / 5.0f, 350.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Light" , NULL - , ImVec2(m_viewState.m_width / 5.0f, 350.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::PushItemWidth(185.0f); @@ -2198,16 +2209,16 @@ public: if (m_settings.m_updateScene) { m_timeAccumulatorScene += deltaTime; } // Setup lights. - m_pointLight.m_position.m_x = bx::fcos(m_timeAccumulatorLight) * 20.0f; + m_pointLight.m_position.m_x = bx::cos(m_timeAccumulatorLight) * 20.0f; m_pointLight.m_position.m_y = 26.0f; - m_pointLight.m_position.m_z = bx::fsin(m_timeAccumulatorLight) * 20.0f; + m_pointLight.m_position.m_z = bx::sin(m_timeAccumulatorLight) * 20.0f; m_pointLight.m_spotDirectionInner.m_x = -m_pointLight.m_position.m_x; m_pointLight.m_spotDirectionInner.m_y = -m_pointLight.m_position.m_y; m_pointLight.m_spotDirectionInner.m_z = -m_pointLight.m_position.m_z; - m_directionalLight.m_position.m_x = -bx::fcos(m_timeAccumulatorLight); + m_directionalLight.m_position.m_x = -bx::cos(m_timeAccumulatorLight); m_directionalLight.m_position.m_y = -1.0f; - m_directionalLight.m_position.m_z = -bx::fsin(m_timeAccumulatorLight); + m_directionalLight.m_position.m_z = -bx::sin(m_timeAccumulatorLight); // Setup instance matrices. float mtxFloor[16]; @@ -2274,9 +2285,9 @@ public: , 0.0f , float(ii) , 0.0f - , bx::fsin(float(ii)*2.0f*bx::kPi/float(numTrees) ) * 60.0f + , bx::sin(float(ii)*2.0f*bx::kPi/float(numTrees) ) * 60.0f , 0.0f - , bx::fcos(float(ii)*2.0f*bx::kPi/float(numTrees) ) * 60.0f + , bx::cos(float(ii)*2.0f*bx::kPi/float(numTrees) ) * 60.0f ); } @@ -2324,7 +2335,7 @@ public: float at[3]; bx::vec3Add(at, m_pointLight.m_position.m_v, m_pointLight.m_spotDirectionInner.m_v); - bx::mtxLookAt(lightView[TetrahedronFaces::Green], m_pointLight.m_position.m_v, at); + bx::mtxLookAt(lightView[TetrahedronFaces::Green], bx::load(m_pointLight.m_position.m_v), bx::load(at) ); } else if (LightType::PointLight == m_settings.m_lightType) { @@ -2341,7 +2352,7 @@ public: { const float fovx = 143.98570868f + 3.51f + m_settings.m_fovXAdjust; const float fovy = 125.26438968f + 9.85f + m_settings.m_fovYAdjust; - const float aspect = bx::ftan(bx::toRad(fovx*0.5f) )/bx::ftan(bx::toRad(fovy*0.5f) ); + const float aspect = bx::tan(bx::toRad(fovx*0.5f) )/bx::tan(bx::toRad(fovy*0.5f) ); bx::mtxProj( lightProj[ProjType::Vertical] @@ -2367,7 +2378,7 @@ public: const float fovx = 143.98570868f + 7.8f + m_settings.m_fovXAdjust; const float fovy = 125.26438968f + 3.0f + m_settings.m_fovYAdjust; - const float aspect = bx::ftan(bx::toRad(fovx*0.5f) )/bx::ftan(bx::toRad(fovy*0.5f) ); + const float aspect = bx::tan(bx::toRad(fovx*0.5f) )/bx::tan(bx::toRad(fovy*0.5f) ); bx::mtxProj( lightProj[ProjType::Horizontal] @@ -2410,13 +2421,13 @@ public: else // LightType::DirectionalLight == settings.m_lightType { // Setup light view mtx. - float eye[3] = + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { - -m_directionalLight.m_position.m_x - , -m_directionalLight.m_position.m_y - , -m_directionalLight.m_position.m_z + -m_directionalLight.m_position.m_x, + -m_directionalLight.m_position.m_y, + -m_directionalLight.m_position.m_z, }; - float at[3] = { 0.0f, 0.0f, 0.0f }; bx::mtxLookAt(lightView[0], eye, at); // Compute camera inverse view mtx. @@ -2472,12 +2483,12 @@ public: bx::vec3MulMtx(lightSpaceFrustumCorner, frustumCorners[ii][jj], lightView[0]); // Update bounding box. - min[0] = bx::fmin(min[0], lightSpaceFrustumCorner[0]); - max[0] = bx::fmax(max[0], lightSpaceFrustumCorner[0]); - min[1] = bx::fmin(min[1], lightSpaceFrustumCorner[1]); - max[1] = bx::fmax(max[1], lightSpaceFrustumCorner[1]); - min[2] = bx::fmin(min[2], lightSpaceFrustumCorner[2]); - max[2] = bx::fmax(max[2], lightSpaceFrustumCorner[2]); + min[0] = bx::min(min[0], lightSpaceFrustumCorner[0]); + max[0] = bx::max(max[0], lightSpaceFrustumCorner[0]); + min[1] = bx::min(min[1], lightSpaceFrustumCorner[1]); + max[1] = bx::max(max[1], lightSpaceFrustumCorner[1]); + min[2] = bx::min(min[2], lightSpaceFrustumCorner[2]); + max[2] = bx::max(max[2], lightSpaceFrustumCorner[2]); } float minproj[3]; @@ -2494,8 +2505,8 @@ public: if (m_settings.m_stabilize) { const float quantizer = 64.0f; - scalex = quantizer / bx::fceil(quantizer / scalex); - scaley = quantizer / bx::fceil(quantizer / scaley); + scalex = quantizer / bx::ceil(quantizer / scalex); + scaley = quantizer / bx::ceil(quantizer / scaley); } offsetx = 0.5f * (maxproj[0] + minproj[0]) * scalex; @@ -2504,8 +2515,8 @@ public: if (m_settings.m_stabilize) { const float halfSize = currentShadowMapSizef * 0.5f; - offsetx = bx::fceil(offsetx * halfSize) / halfSize; - offsety = bx::fceil(offsety * halfSize) / halfSize; + offsetx = bx::ceil(offsetx * halfSize) / halfSize; + offsety = bx::ceil(offsety * halfSize) / halfSize; } float mtxCrop[16]; @@ -2888,12 +2899,12 @@ public: && currentSmSettings->m_doBlur) { bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[0]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); bgfx::submit(RENDERVIEW_VBLUR_0_ID, s_programs.m_vBlur[depthType]); bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtBlur) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); bgfx::submit(RENDERVIEW_HBLUR_0_ID, s_programs.m_hBlur[depthType]); @@ -2904,12 +2915,12 @@ public: const uint8_t viewId = RENDERVIEW_VBLUR_0_ID + jj; bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[ii]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); bgfx::submit(viewId, s_programs.m_vBlur[depthType]); bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtBlur) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); bgfx::submit(viewId+1, s_programs.m_hBlur[depthType]); } @@ -3144,7 +3155,7 @@ public: if (m_settings.m_drawDepthBuffer) { bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[0]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); bgfx::submit(RENDERVIEW_DRAWDEPTH_0_ID, s_programs.m_drawDepth[depthType]); @@ -3153,7 +3164,7 @@ public: for (uint8_t ii = 1; ii < m_settings.m_numSplits; ++ii) { bgfx::setTexture(4, s_shadowMap[0], bgfx::getTexture(s_rtShadowMap[ii]) ); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad(currentShadowMapSizef, currentShadowMapSizef, s_flipV); bgfx::submit(RENDERVIEW_DRAWDEPTH_0_ID+ii, s_programs.m_drawDepth[depthType]); } diff --git a/3rdparty/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc b/3rdparty/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc index e7f7b1cf5ad..68852137ff1 100644 --- a/3rdparty/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc +++ b/3rdparty/bgfx/examples/16-shadowmaps/vs_shadowmaps_hblur.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0, v_texcoord1, v_texcoord2, v_texcoord3, v_texcoord4 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp index d84b1502290..9e88829df48 100644 --- a/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp +++ b/3rdparty/bgfx/examples/17-drawstress/drawstress.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -126,11 +126,16 @@ public: m_deltaTimeAvgNs = 0; m_numFrames = 0; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); const bgfx::Caps* caps = bgfx::getCaps(); - m_maxDim = (int32_t)bx::fpow(float(caps->limits.maxDrawCalls), 1.0f/3.0f); + m_maxDim = (int32_t)bx::pow(float(caps->limits.maxDrawCalls), 1.0f/3.0f); // Enable debug text. bgfx::setDebug(m_debug); @@ -299,7 +304,7 @@ public: if (m_deltaTimeNs > 1000000) { - m_deltaTimeAvgNs = m_deltaTimeNs / bx::int64_max(1, m_numFrames); + m_deltaTimeAvgNs = m_deltaTimeNs / bx::max(1, m_numFrames); if (m_autoAdjust) { @@ -333,12 +338,17 @@ public: showExampleDialog(this); - ImGui::SetNextWindowPos(ImVec2((float)m_width - (float)m_width / 4.0f - 10.0f, 10.0f) ); - ImGui::SetNextWindowSize(ImVec2((float)m_width / 4.0f, (float)m_height / 2.0f) ); + ImGui::SetNextWindowPos( + ImVec2((float)m_width - (float)m_width / 4.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2((float)m_width / 4.0f, (float)m_height / 2.0f) + , ImGuiCond_FirstUseEver + ); ImGui::Begin("Settings" , NULL - , ImVec2((float)m_width / 4.0f, (float)m_height / 2.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::RadioButton("Rotate",&m_transform,0); @@ -365,8 +375,8 @@ public: imguiEndFrame(); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; float view[16]; bx::mtxLookAt(view, eye, at); diff --git a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h index 1c74a4393b9..186744f7081 100644 --- a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h +++ b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.bin.h @@ -7,138 +7,34 @@ static const uint8_t fs_drawstress_glsl[89] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t fs_drawstress_spv[2079] = +static const uint8_t fs_drawstress_spv[402] = { - 0x46, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x03, 0x02, // FSH....I........ - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, // #.........za.... + 0x46, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x03, 0x02, // FSH....I........ + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, // #.........+..... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, // ..w............. + 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, // ..!...*......... 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, // ................ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, // ......5...vec4_s - 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, // plat(f1;........ - 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x40, 0x6d, // .._x..........@m - 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, // ain(vf4;vf4;.... - 0x05, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..O0..v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa2, 0x25, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // .......%..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, // gData_0_........ - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, // ..bgfx_VoidFrag. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ......,N..param. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .......@..v_colo - 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, // r0........w...v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // color0.......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xef, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......G..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc7, 0x02, // gData_0_........ - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..$Global....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, // viewTexel....... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, // iew............. - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..u_proj........ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc7, 0x02, // viewProj........ - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..u_model....... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..........u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, // aRef4.G...w..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf0, 0x06, 0x00, 0x00, 0x06, 0x00, // ......G......... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xc7, 0x02, // ..#... ...G..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // .. ... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x3d, 0x0b, 0x00, 0x00, 0x08, 0x00, // ......!...=..... - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // .......... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..w....... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .. .......+..... - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf0, 0x06, // ..j... ......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xc7, 0x02, // ..e...j......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..........e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......e...e..... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xef, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......G......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3e, 0x00, // .......@..w...>. - 0x03, 0x00, 0xef, 0x47, 0x00, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, // ...G...@..9..... - 0x00, 0x00, 0x79, 0x61, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xef, 0x47, 0x00, 0x00, 0x9a, 0x16, // ..ya.......G.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, // ..8...6.......5. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......dW......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......N......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......I9......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......9......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, // .......*..dW...N - 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, // ..I9...9.......* - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0x0f, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......=...7..... - 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x25, // ..O0..7........% - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xee, 0x5f, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // ......._..;..... - 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x4e, // ..,N......>...,N - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..5...,N..=..... - 0x00, 0x00, 0x58, 0x5b, 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x25, // ..X[..O0..>....% - 0x00, 0x00, 0x58, 0x5b, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..X[......8.... + 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......!...v_colo + 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x62, 0x67, // r0........*...bg + 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, // fx_FragData0..G. + 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..!...........G. + 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, // ..*............. + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ......!......... + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, // .......... ..... + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // .. ...........;. + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // .. ...!....... . + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..)...........;. + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..)...*.......6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..........=..... + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2a, 0x00, // .."...!...>...*. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, // ..".......8..... + 0x00, 0x00, // .. }; static const uint8_t fs_drawstress_dx9[131] = { diff --git a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.sc b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.sc index ce5831255a6..99ec64685ad 100644 --- a/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.sc +++ b/3rdparty/bgfx/examples/17-drawstress/fs_drawstress.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/17-drawstress/makefile b/3rdparty/bgfx/examples/17-drawstress/makefile index a9e31815229..76ce78d8e4d 100644 --- a/3rdparty/bgfx/examples/17-drawstress/makefile +++ b/3rdparty/bgfx/examples/17-drawstress/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h index 3b320f7509c..f4da07dd2a6 100644 --- a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h +++ b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.bin.h @@ -22,177 +22,76 @@ static const uint8_t vs_drawstress_glsl[325] = 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // lor0 = a_color0; 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; -static const uint8_t vs_drawstress_spv[2697] = +static const uint8_t vs_drawstress_spv[1088] = { 0x56, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x64, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // d.....#......... - 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x14, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // ....v........... - 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x38, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, // ........8...Outp - 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ut......8....... - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, // gl_Position..... - 0x38, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // 8.......v_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // ............@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // n(vf4;vf3;...... - 0xf5, 0x48, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // .H..a_color0.... - 0x05, 0x00, 0x05, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....,G..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, // on.........._var - 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ying_........... - 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // $Global......... - 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, // ....u_viewRect.. - 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ewTexel......... - 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....u_view...... - 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, // ........u_invVie - 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // w............... - 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // u_proj.......... - 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, // ....u_invProj... - 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x99, 0x02, 0x00, 0x00, // ewProj.......... - 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ....u_invViewPro - 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // j............... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // u_model......... - 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, // ....u_modelView. - 0x06, 0x00, 0x07, 0x00, 0x99, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, // delViewProj..... - 0x99, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, // ........u_alphaR - 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ef4.....B....... - 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // .....A..a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ............a_co - 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, // lor0........,?.. - 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... - 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ....a_position.. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, // main....6...:... + 0x43, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // C...F........... + 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, // ........ ...$Glo + 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // bal..... ....... + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. + 0x05, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // ...."........... + 0x36, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // 6...a_color0.... + 0x05, 0x00, 0x05, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....:...a_positi + 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x43, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // on......C...@ent 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO + 0x46, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // F...@entryPointO 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x47, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // G...7.......@... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // #.......H....... - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x99, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x99, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x99, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...G........... - 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...B..."....... - 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...v........... - 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, // ........!....... - 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x1e, 0x00, 0x04, 0x00, 0x38, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....8........... - 0x21, 0x00, 0x05, 0x00, 0xc6, 0x07, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, // !.......8....... - 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x38, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // 8........... ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....e........... - 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... - 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // +.......j... ... - 0x1c, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, // ....7...e...j... - 0x1e, 0x00, 0x0e, 0x00, 0x99, 0x02, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...7...e... - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x05, 0x00, 0x00, // e....... ....... - 0x02, 0x00, 0x00, 0x00, 0x99, 0x02, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x05, 0x00, 0x00, // ........;....... - 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // B.......+....... - 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, // )....... ....... - 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, // ....e... ....... - 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, // ........;....... - 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, // ........ ....... - 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, // ........;....... - 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, // ........ ....... - 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, // ........;....... - 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, // ........;....... - 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, // v.......6....... - 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // ................ - 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // Sa..;........... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, // ....;........U.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // ....;........... - 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, // ....=........A.. - 0x89, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, // ....=.......,?.. - 0xa6, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, // ....>....U...A.. - 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, // >.......,?..9... - 0x38, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, // 8...I&.......U.. - 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // ....>.......I&.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // A.......T4...... - 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, // ....=........... - 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, // T4..>........... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // A........@...... - 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, // ....=........-.. - 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, // .@..>...v....-.. - 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x38, 0x04, 0x00, 0x00, // ....8...6...8... - 0x0e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // ............7... - 0x9a, 0x02, 0x00, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, // .....H..7....... - 0x2c, 0x47, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x51, 0x1d, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ,G......Q...;... - 0xb5, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... - 0x9a, 0x02, 0x00, 0x00, 0x50, 0x24, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....P$.......... - 0x3e, 0x00, 0x03, 0x00, 0x50, 0x24, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...P$......=... - 0x18, 0x00, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....'(..,G..Q... - 0x0d, 0x00, 0x00, 0x00, 0xac, 0x4a, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....J..'(...... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7c, 0x57, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, // Q.......|W..'(.. - 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1d, 0x19, 0x00, 0x00, // ....Q........... - 0x27, 0x28, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // '(......P....... - 0xf5, 0x42, 0x00, 0x00, 0xac, 0x4a, 0x00, 0x00, 0x7c, 0x57, 0x00, 0x00, 0x1d, 0x19, 0x00, 0x00, // .B...J..|W...... - 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x61, 0x23, 0x00, 0x00, // ....A.......a#.. - 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // B...)...=...e... - 0x2b, 0x34, 0x00, 0x00, 0x61, 0x23, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // +4..a#.......... - 0xd7, 0x32, 0x00, 0x00, 0xf5, 0x42, 0x00, 0x00, 0x2b, 0x34, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .2...B..+4..A... - 0x9a, 0x02, 0x00, 0x00, 0x97, 0x2f, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ...../.......... - 0x3e, 0x00, 0x03, 0x00, 0x97, 0x2f, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >..../...2..=... - 0x1d, 0x00, 0x00, 0x00, 0x8e, 0x31, 0x00, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .....1...H..A... - 0x9a, 0x02, 0x00, 0x00, 0x9e, 0x4c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....L.......... - 0x3e, 0x00, 0x03, 0x00, 0x9e, 0x4c, 0x00, 0x00, 0x8e, 0x31, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....L...1..=... - 0x38, 0x04, 0x00, 0x00, 0x30, 0x19, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, // 8...0........... - 0x30, 0x19, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // 0...8.... + 0x48, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H... ........... + 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H... .......#... + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H... ....... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, // ........G... ... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G..."..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...6....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...:....... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....G...C....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...F....... + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ............... + 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, // ....+........... + 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, // ...?+........... + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ........ ....... + 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ...!....... ... + 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...!..."....... + 0x20, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ...#........... + 0x20, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...5........... + 0x3b, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...5...6....... + 0x20, 0x00, 0x04, 0x00, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...9........... + 0x3b, 0x00, 0x04, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...9...:....... + 0x20, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...B........... + 0x3b, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...B...C....... + 0x3b, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...B...F....... + 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... + 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x07, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....7...6...=... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....;...:...Q... + 0x06, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....]...;....... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // Q.......^...;... + 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // ....Q......._... + 0x3b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // ;.......P....... + 0x60, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // `...]...^..._... + 0x15, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, // ....A...#...a... + 0x22, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, // ".......=....... + 0x62, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // b...a........... + 0x63, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // c...`...b...Q... + 0x06, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....h...c....... + 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // ........i...h... + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, // R...........i... + 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, // c.......>...C... + 0x80, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x46, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, // ....>...F...7... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x00, 0x40, 0x00, // ....8.........@. }; static const uint8_t vs_drawstress_dx9[313] = { diff --git a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.sc b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.sc index 9d7d6853085..906372cb0f8 100644 --- a/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.sc +++ b/3rdparty/bgfx/examples/17-drawstress/vs_drawstress.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/18-ibl/ibl.cpp b/3rdparty/bgfx/examples/18-ibl/ibl.cpp index d369fa918b3..7f43232d351 100644 --- a/3rdparty/bgfx/examples/18-ibl/ibl.cpp +++ b/3rdparty/bgfx/examples/18-ibl/ibl.cpp @@ -160,10 +160,10 @@ struct LightProbe char filePath[512]; bx::snprintf(filePath, BX_COUNTOF(filePath), "textures/%s_lod.dds", _name); - m_tex = loadTexture(filePath, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP); + m_tex = loadTexture(filePath, BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_SAMPLER_W_CLAMP); bx::snprintf(filePath, BX_COUNTOF(filePath), "textures/%s_irr.dds", _name); - m_texIrr = loadTexture(filePath, BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_W_CLAMP); + m_texIrr = loadTexture(filePath, BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_SAMPLER_W_CLAMP); } void destroy() @@ -205,7 +205,7 @@ struct Camera void mtxLookAt(float* _outViewMtx) { - bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr); + bx::mtxLookAt(_outViewMtx, bx::load(m_pos.curr), bx::load(m_target.curr) ); } void orbit(float _dx, float _dy) @@ -272,7 +272,7 @@ struct Camera latLongFromVec(ll[0], ll[1], toPosNorm); ll[0] += consume[0]; ll[1] -= consume[1]; - ll[1] = bx::fclamp(ll[1], 0.02f, 0.98f); + ll[1] = bx::clamp(ll[1], 0.02f, 0.98f); float tmp[3]; vecFromLatLong(tmp, ll[0], ll[1]); @@ -292,16 +292,16 @@ struct Camera void update(float _dt) { - const float amount = bx::fmin(_dt/0.12f, 1.0f); + const float amount = bx::min(_dt/0.12f, 1.0f); consumeOrbit(amount); - m_target.curr[0] = bx::flerp(m_target.curr[0], m_target.dest[0], amount); - m_target.curr[1] = bx::flerp(m_target.curr[1], m_target.dest[1], amount); - m_target.curr[2] = bx::flerp(m_target.curr[2], m_target.dest[2], amount); - m_pos.curr[0] = bx::flerp(m_pos.curr[0], m_pos.dest[0], amount); - m_pos.curr[1] = bx::flerp(m_pos.curr[1], m_pos.dest[1], amount); - m_pos.curr[2] = bx::flerp(m_pos.curr[2], m_pos.dest[2], amount); + m_target.curr[0] = bx::lerp(m_target.curr[0], m_target.dest[0], amount); + m_target.curr[1] = bx::lerp(m_target.curr[1], m_target.dest[1], amount); + m_target.curr[2] = bx::lerp(m_target.curr[2], m_target.dest[2], amount); + m_pos.curr[0] = bx::lerp(m_pos.curr[0], m_pos.dest[0], amount); + m_pos.curr[1] = bx::lerp(m_pos.curr[1], m_pos.dest[1], amount); + m_pos.curr[2] = bx::lerp(m_pos.curr[2], m_pos.dest[2], amount); } void envViewMtx(float* _mtx) @@ -356,10 +356,10 @@ struct Camera const float phi = _u * 2.0f*bx::kPi; const float theta = _v * bx::kPi; - const float st = bx::fsin(theta); - const float sp = bx::fsin(phi); - const float ct = bx::fcos(theta); - const float cp = bx::fcos(phi); + const float st = bx::sin(theta); + const float sp = bx::sin(phi); + const float ct = bx::cos(theta); + const float cp = bx::cos(phi); _vec[0] = -st*sp; _vec[1] = ct; @@ -368,8 +368,8 @@ struct Camera static inline void latLongFromVec(float& _u, float& _v, const float _vec[3]) { - const float phi = bx::fatan2(_vec[0], _vec[2]); - const float theta = bx::facos(_vec[1]); + const float phi = bx::atan2(_vec[0], _vec[2]); + const float theta = bx::acos(_vec[1]); _u = (bx::kPi + phi)*bx::kInvPi*0.5f; _v = theta*bx::kInvPi; @@ -501,8 +501,13 @@ public: | BGFX_RESET_MSAA_X16 ; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -592,12 +597,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height - 20.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height - 20.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::PushItemWidth(180.0f); @@ -707,12 +715,15 @@ public: ImGui::SetNextWindowPos( ImVec2(10.0f, 260.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, 450.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Mesh" , NULL - , ImVec2(m_width / 5.0f, 450.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::Text("Mesh:"); @@ -823,8 +834,8 @@ public: bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) ); // Env rotation. - const float amount = bx::fmin(deltaTimeSec/0.12f, 1.0f); - m_settings.m_envRotCurr = bx::flerp(m_settings.m_envRotCurr, m_settings.m_envRotDest, amount); + const float amount = bx::min(deltaTimeSec/0.12f, 1.0f); + m_settings.m_envRotCurr = bx::lerp(m_settings.m_envRotCurr, m_settings.m_envRotDest, amount); // Env mtx. float mtxEnvView[16]; @@ -836,7 +847,7 @@ public: // Submit view 0. bgfx::setTexture(0, s_texCube, m_lightProbes[m_currentLightProbe].m_tex); bgfx::setTexture(1, s_texCubeIrr, m_lightProbes[m_currentLightProbe].m_texIrr); - bgfx::setState(BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A); screenSpaceQuad( (float)m_width, (float)m_height, true); m_uniforms.submit(); bgfx::submit(0, m_programSky); diff --git a/3rdparty/bgfx/examples/18-ibl/makefile b/3rdparty/bgfx/examples/18-ibl/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/18-ibl/makefile +++ b/3rdparty/bgfx/examples/18-ibl/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/19-oit/fs_oit.sc b/3rdparty/bgfx/examples/19-oit/fs_oit.sc index 8d1be8552bf..cd71b902adb 100644 --- a/3rdparty/bgfx/examples/19-oit/fs_oit.sc +++ b/3rdparty/bgfx/examples/19-oit/fs_oit.sc @@ -1,7 +1,7 @@ $input v_pos /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/19-oit/fs_oit_wb.sc b/3rdparty/bgfx/examples/19-oit/fs_oit_wb.sc index caf3d0548a3..aa9531f96bd 100644 --- a/3rdparty/bgfx/examples/19-oit/fs_oit_wb.sc +++ b/3rdparty/bgfx/examples/19-oit/fs_oit_wb.sc @@ -1,7 +1,7 @@ $input v_pos /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/19-oit/fs_oit_wb_blit.sc b/3rdparty/bgfx/examples/19-oit/fs_oit_wb_blit.sc index 8feacd58f91..4f4c8fae668 100644 --- a/3rdparty/bgfx/examples/19-oit/fs_oit_wb_blit.sc +++ b/3rdparty/bgfx/examples/19-oit/fs_oit_wb_blit.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate.sc b/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate.sc index 656144e36fc..4a049922363 100644 --- a/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate.sc +++ b/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate.sc @@ -1,7 +1,7 @@ $input v_pos /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc b/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc index 5511754da5b..8c6c52c3937 100644 --- a/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc +++ b/3rdparty/bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/19-oit/makefile b/3rdparty/bgfx/examples/19-oit/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/19-oit/makefile +++ b/3rdparty/bgfx/examples/19-oit/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/19-oit/oit.cpp b/3rdparty/bgfx/examples/19-oit/oit.cpp index 63905a2b89d..b8660c06362 100644 --- a/3rdparty/bgfx/examples/19-oit/oit.cpp +++ b/3rdparty/bgfx/examples/19-oit/oit.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -166,8 +166,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -306,13 +311,16 @@ public: } ImGui::SetNextWindowPos( - ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 3.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 3.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::Separator(); @@ -338,13 +346,13 @@ public: const double freq = double(bx::getHPFrequency() ); float time = (float)( (now-m_timeOffset)/freq); - // Reference: - // Weighted, Blended Order-Independent Transparency - // http://jcgt.org/published/0002/02/09/ - // http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html - - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -7.0f }; + // Reference(s): + // - Weighted, Blended Order-Independent Transparency + // https://web.archive.org/save/http://jcgt.org/published/0002/02/09/ + // https://web.archive.org/web/20181126040455/http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html + // + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -7.0f }; float view[16]; float proj[16]; @@ -399,7 +407,7 @@ public: if (m_fadeInOut && zz == 1) { - color[3] = bx::fsin(time*3.0f)*0.49f+0.5f; + color[3] = bx::sin(time*3.0f)*0.49f+0.5f; } bgfx::setUniform(u_color, color); @@ -421,16 +429,16 @@ public: const uint64_t state = 0 | BGFX_STATE_CULL_CW - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ; const uint64_t stateNoDepth = 0 | BGFX_STATE_CULL_CW - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS | BGFX_STATE_MSAA ; @@ -483,7 +491,7 @@ public: bgfx::setTexture(0, s_texColor0, m_fbtextures[0]); bgfx::setTexture(1, s_texColor1, m_fbtextures[1]); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_SRC_ALPHA, BGFX_STATE_BLEND_SRC_ALPHA) ); screenSpaceQuad( (float)m_width, (float)m_height, s_flipV); diff --git a/3rdparty/bgfx/examples/19-oit/vs_oit.sc b/3rdparty/bgfx/examples/19-oit/vs_oit.sc index 1cb27fffceb..cd66075de26 100644 --- a/3rdparty/bgfx/examples/19-oit/vs_oit.sc +++ b/3rdparty/bgfx/examples/19-oit/vs_oit.sc @@ -2,7 +2,7 @@ $input a_position $output v_pos /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/19-oit/vs_oit_blit.sc b/3rdparty/bgfx/examples/19-oit/vs_oit_blit.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/19-oit/vs_oit_blit.sc +++ b/3rdparty/bgfx/examples/19-oit/vs_oit_blit.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp index 77e8d41f114..8d0e91ee60b 100644 --- a/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp +++ b/3rdparty/bgfx/examples/20-nanovg/nanovg.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -1108,11 +1108,11 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h nvgBeginPath(vg); nvgFillColor(vg, nvgRGBA(255,192,0,255) ); nvgRoundedRect(vg - , bx::fround(bounds[0])-4.0f - , bx::fround(bounds[1])-2.0f - , bx::fround(bounds[2]-bounds[0])+8.0f - , bx::fround(bounds[3]-bounds[1])+4.0f - , (bx::fround(bounds[3]-bounds[1])+4.0f)/2.0f-1.0f + , bx::round(bounds[0])-4.0f + , bx::round(bounds[1])-2.0f + , bx::round(bounds[2]-bounds[0])+8.0f + , bx::round(bounds[3]-bounds[1])+4.0f + , (bx::round(bounds[3]-bounds[1])+4.0f)/2.0f-1.0f ); nvgFill(vg); @@ -1130,10 +1130,10 @@ void drawParagraph(struct NVGcontext* vg, float x, float y, float width, float h nvgBeginPath(vg); nvgFillColor(vg, nvgRGBA(220,220,220,255) ); nvgRoundedRect(vg - , bx::fround(bounds[0]-2.0f) - , bx::fround(bounds[1]-2.0f) - , bx::fround(bounds[2]-bounds[0])+4.0f - , bx::fround(bounds[3]-bounds[1])+4.0f + , bx::round(bounds[0]-2.0f) + , bx::round(bounds[1]-2.0f) + , bx::round(bounds[2]-bounds[0])+4.0f + , bx::round(bounds[3]-bounds[1])+4.0f , 3.0f ); px = float( (int)( (bounds[2]+bounds[0])/2) ); @@ -1250,8 +1250,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); diff --git a/3rdparty/bgfx/examples/21-deferred/deferred.cpp b/3rdparty/bgfx/examples/21-deferred/deferred.cpp index 45c8aaf7faf..00379705b05 100644 --- a/3rdparty/bgfx/examples/21-deferred/deferred.cpp +++ b/3rdparty/bgfx/examples/21-deferred/deferred.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -204,11 +204,16 @@ public: m_width = _width; m_height = _height; - m_debug = BGFX_DEBUG_NONE; + m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -387,7 +392,7 @@ public: // When multiple render targets (MRT) is not supported by GPU, // implement alternative code path that doesn't use MRT. bool blink = uint32_t(time*3.0f)&1; - bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " MRT not supported by GPU. "); + bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " MRT not supported by GPU. "); // Set view 0 default viewport. bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); @@ -413,17 +418,17 @@ public: bgfx::destroy(m_gbuffer); } - const uint32_t samplerFlags = 0 + const uint64_t tsFlags = 0 | BGFX_TEXTURE_RT - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ; - m_gbufferTex[0] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); - m_gbufferTex[1] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); - m_gbufferTex[2] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::D24, samplerFlags); + m_gbufferTex[0] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, tsFlags); + m_gbufferTex[1] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::BGRA8, tsFlags); + m_gbufferTex[2] = bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::D24S8, tsFlags); m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true); if (bgfx::isValid(m_lightBuffer) ) @@ -431,17 +436,20 @@ public: bgfx::destroy(m_lightBuffer); } - m_lightBuffer = bgfx::createFrameBuffer(uint16_t(m_width), uint16_t(m_height), bgfx::TextureFormat::BGRA8, samplerFlags); + m_lightBuffer = bgfx::createFrameBuffer(uint16_t(m_width), uint16_t(m_height), bgfx::TextureFormat::BGRA8, tsFlags); } ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 3.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 3.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::SliderInt("Num lights", &m_numLights, 1, 2048); @@ -528,9 +536,9 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ); @@ -545,25 +553,25 @@ public: { Sphere lightPosRadius; - float lightTime = time * m_lightAnimationSpeed * (bx::fsin(light/float(m_numLights) * bx::kPiHalf ) * 0.5f + 0.5f); - lightPosRadius.m_center[0] = bx::fsin( ( (lightTime + light*0.47f) + bx::kPiHalf*1.37f ) )*offset; - lightPosRadius.m_center[1] = bx::fcos( ( (lightTime + light*0.69f) + bx::kPiHalf*1.49f ) )*offset; - lightPosRadius.m_center[2] = bx::fsin( ( (lightTime + light*0.37f) + bx::kPiHalf*1.57f ) )*2.0f; - lightPosRadius.m_radius = 2.0f; + float lightTime = time * m_lightAnimationSpeed * (bx::sin(light/float(m_numLights) * bx::kPiHalf ) * 0.5f + 0.5f); + lightPosRadius.m_center.x = bx::sin( ( (lightTime + light*0.47f) + bx::kPiHalf*1.37f ) )*offset; + lightPosRadius.m_center.y = bx::cos( ( (lightTime + light*0.69f) + bx::kPiHalf*1.49f ) )*offset; + lightPosRadius.m_center.z = bx::sin( ( (lightTime + light*0.37f) + bx::kPiHalf*1.57f ) )*2.0f; + lightPosRadius.m_radius = 2.0f; Aabb aabb; toAabb(aabb, lightPosRadius); float box[8][3] = { - { aabb.m_min[0], aabb.m_min[1], aabb.m_min[2] }, - { aabb.m_min[0], aabb.m_min[1], aabb.m_max[2] }, - { aabb.m_min[0], aabb.m_max[1], aabb.m_min[2] }, - { aabb.m_min[0], aabb.m_max[1], aabb.m_max[2] }, - { aabb.m_max[0], aabb.m_min[1], aabb.m_min[2] }, - { aabb.m_max[0], aabb.m_min[1], aabb.m_max[2] }, - { aabb.m_max[0], aabb.m_max[1], aabb.m_min[2] }, - { aabb.m_max[0], aabb.m_max[1], aabb.m_max[2] }, + { aabb.m_min.x, aabb.m_min.y, aabb.m_min.z }, + { aabb.m_min.x, aabb.m_min.y, aabb.m_max.z }, + { aabb.m_min.x, aabb.m_max.y, aabb.m_min.z }, + { aabb.m_min.x, aabb.m_max.y, aabb.m_max.z }, + { aabb.m_max.x, aabb.m_min.y, aabb.m_min.z }, + { aabb.m_max.x, aabb.m_min.y, aabb.m_max.z }, + { aabb.m_max.x, aabb.m_max.y, aabb.m_min.z }, + { aabb.m_max.x, aabb.m_max.y, aabb.m_max.z }, }; float xyz[3]; @@ -577,20 +585,20 @@ public: for (uint32_t ii = 1; ii < 8; ++ii) { bx::vec3MulMtxH(xyz, box[ii], vp); - minx = bx::fmin(minx, xyz[0]); - miny = bx::fmin(miny, xyz[1]); - maxx = bx::fmax(maxx, xyz[0]); - maxy = bx::fmax(maxy, xyz[1]); - maxz = bx::fmax(maxz, xyz[2]); + minx = bx::min(minx, xyz[0]); + miny = bx::min(miny, xyz[1]); + maxx = bx::max(maxx, xyz[0]); + maxy = bx::max(maxy, xyz[1]); + maxz = bx::max(maxz, xyz[2]); } // Cull light if it's fully behind camera. if (maxz >= 0.0f) { - float x0 = bx::fclamp( (minx * 0.5f + 0.5f) * m_width, 0.0f, (float)m_width); - float y0 = bx::fclamp( (miny * 0.5f + 0.5f) * m_height, 0.0f, (float)m_height); - float x1 = bx::fclamp( (maxx * 0.5f + 0.5f) * m_width, 0.0f, (float)m_width); - float y1 = bx::fclamp( (maxy * 0.5f + 0.5f) * m_height, 0.0f, (float)m_height); + float x0 = bx::clamp( (minx * 0.5f + 0.5f) * m_width, 0.0f, (float)m_width); + float y0 = bx::clamp( (miny * 0.5f + 0.5f) * m_height, 0.0f, (float)m_height); + float x1 = bx::clamp( (maxx * 0.5f + 0.5f) * m_width, 0.0f, (float)m_width); + float y1 = bx::clamp( (maxy * 0.5f + 0.5f) * m_height, 0.0f, (float)m_height); if (m_showScissorRects) { @@ -637,7 +645,7 @@ public: bgfx::setVertexBuffer(0, &tvb); bgfx::setIndexBuffer(&tib); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_PT_LINES | BGFX_STATE_BLEND_ALPHA ); @@ -663,8 +671,8 @@ public: bgfx::setTexture(0, s_normal, bgfx::getTexture(m_gbuffer, 1) ); bgfx::setTexture(1, s_depth, bgfx::getTexture(m_gbuffer, 2) ); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_ADD ); screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); @@ -676,8 +684,8 @@ public: bgfx::setTexture(0, s_albedo, bgfx::getTexture(m_gbuffer, 0) ); bgfx::setTexture(1, s_light, bgfx::getTexture(m_lightBuffer, 0) ); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A ); screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); bgfx::submit(RENDER_PASS_COMBINE_ID, m_combineProgram); @@ -700,7 +708,7 @@ public: bgfx::setVertexBuffer(0, m_vbh); bgfx::setIndexBuffer(m_ibh, 0, 6); bgfx::setTexture(0, s_texColor, m_gbufferTex[ii]); - bgfx::setState(BGFX_STATE_RGB_WRITE); + bgfx::setState(BGFX_STATE_WRITE_RGB); bgfx::submit(RENDER_PASS_DEBUG_GBUFFER_ID, m_debugProgram); } } diff --git a/3rdparty/bgfx/examples/21-deferred/fs_deferred_combine.sc b/3rdparty/bgfx/examples/21-deferred/fs_deferred_combine.sc index 05413283227..524732cc612 100644 --- a/3rdparty/bgfx/examples/21-deferred/fs_deferred_combine.sc +++ b/3rdparty/bgfx/examples/21-deferred/fs_deferred_combine.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug.sc b/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug.sc index 74cf4558a13..9dc1de09e31 100644 --- a/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug.sc +++ b/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug_line.sc b/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug_line.sc index ce5831255a6..99ec64685ad 100644 --- a/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug_line.sc +++ b/3rdparty/bgfx/examples/21-deferred/fs_deferred_debug_line.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/fs_deferred_geom.sc b/3rdparty/bgfx/examples/21-deferred/fs_deferred_geom.sc index c30b93e949c..2026e7e8af3 100644 --- a/3rdparty/bgfx/examples/21-deferred/fs_deferred_geom.sc +++ b/3rdparty/bgfx/examples/21-deferred/fs_deferred_geom.sc @@ -1,7 +1,7 @@ $input v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/fs_deferred_light.sc b/3rdparty/bgfx/examples/21-deferred/fs_deferred_light.sc index 8d11c47933f..dac140d8e3d 100644 --- a/3rdparty/bgfx/examples/21-deferred/fs_deferred_light.sc +++ b/3rdparty/bgfx/examples/21-deferred/fs_deferred_light.sc @@ -1,7 +1,7 @@ $input v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/makefile b/3rdparty/bgfx/examples/21-deferred/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/21-deferred/makefile +++ b/3rdparty/bgfx/examples/21-deferred/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/21-deferred/vs_deferred_combine.sc b/3rdparty/bgfx/examples/21-deferred/vs_deferred_combine.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/21-deferred/vs_deferred_combine.sc +++ b/3rdparty/bgfx/examples/21-deferred/vs_deferred_combine.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug.sc b/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug.sc +++ b/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug_line.sc b/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug_line.sc index 9d7d6853085..906372cb0f8 100644 --- a/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug_line.sc +++ b/3rdparty/bgfx/examples/21-deferred/vs_deferred_debug_line.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/vs_deferred_geom.sc b/3rdparty/bgfx/examples/21-deferred/vs_deferred_geom.sc index dd207ef854a..0b466d598ef 100644 --- a/3rdparty/bgfx/examples/21-deferred/vs_deferred_geom.sc +++ b/3rdparty/bgfx/examples/21-deferred/vs_deferred_geom.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_tangent, a_texcoord0 $output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/21-deferred/vs_deferred_light.sc b/3rdparty/bgfx/examples/21-deferred/vs_deferred_light.sc index 6840665dfea..8c3b7a822b6 100644 --- a/3rdparty/bgfx/examples/21-deferred/vs_deferred_light.sc +++ b/3rdparty/bgfx/examples/21-deferred/vs_deferred_light.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0 $output v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/22-windows/windows.cpp b/3rdparty/bgfx/examples/22-windows/windows.cpp index 98ff0fb9c39..cd2be08852e 100644 --- a/3rdparty/bgfx/examples/22-windows/windows.cpp +++ b/3rdparty/bgfx/examples/22-windows/windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -80,11 +80,16 @@ public: m_width = _width; m_height = _height; - m_debug = BGFX_DEBUG_NONE; + m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); const bgfx::Caps* caps = bgfx::getCaps(); bool swapChainSupported = 0 != (caps->supported & BGFX_CAPS_SWAP_CHAIN); @@ -167,17 +172,16 @@ public: bool update() override { - entry::WindowState state; - if (!entry::processWindowEvents(state, m_debug, m_reset) ) + if (!entry::processWindowEvents(m_state, m_debug, m_reset) ) { - m_mouseState = state.m_mouse; + entry::MouseState mouseState = m_state.m_mouse; - imguiBeginFrame(m_mouseState.m_mx - , m_mouseState.m_my - , (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) - | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) - | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) - , m_mouseState.m_mz + imguiBeginFrame(mouseState.m_mx + , mouseState.m_my + , (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) + | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) + | (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) + , mouseState.m_mz , uint16_t(m_width) , uint16_t(m_height) ); @@ -186,21 +190,21 @@ public: imguiEndFrame(); - if (isValid(state.m_handle) ) + if (isValid(m_state.m_handle) ) { - if (0 == state.m_handle.idx) + if (0 == m_state.m_handle.idx) { - m_width = state.m_width; - m_height = state.m_height; + m_width = m_state.m_width; + m_height = m_state.m_height; } else { - uint8_t viewId = (uint8_t)state.m_handle.idx; + uint8_t viewId = (uint8_t)m_state.m_handle.idx; entry::WindowState& win = m_windows[viewId]; - if (win.m_nwh != state.m_nwh - || (win.m_width != state.m_width - || win.m_height != state.m_height) ) + if (win.m_nwh != m_state.m_nwh + || (win.m_width != m_state.m_width + || win.m_height != m_state.m_height) ) { // When window changes size or native window handle changed // frame buffer must be recreated. @@ -210,9 +214,9 @@ public: m_fbh[viewId].idx = bgfx::kInvalidHandle; } - win.m_nwh = state.m_nwh; - win.m_width = state.m_width; - win.m_height = state.m_height; + win.m_nwh = m_state.m_nwh; + win.m_width = m_state.m_width; + win.m_height = m_state.m_height; if (NULL != win.m_nwh) { @@ -226,8 +230,8 @@ public: } } - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; float view[16]; bx::mtxLookAt(view, eye, at); @@ -270,12 +274,12 @@ public: if (NULL != m_bindings) { - bgfx::dbgTextPrintf(0, 5, 0x2f, "Press 'c' to create or 'd' to destroy window."); + bgfx::dbgTextPrintf(0, 1, 0x2f, "Press 'c' to create or 'd' to destroy window."); } else { bool blink = uint32_t(time*3.0f)&1; - bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " Multiple windows is not supported by `%s` renderer. ", bgfx::getRendererName(bgfx::getCaps()->rendererType) ); + bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " Multiple windows is not supported by `%s` renderer. ", bgfx::getRendererName(bgfx::getCaps()->rendererType) ); } uint32_t count = 0; @@ -352,7 +356,7 @@ public: } } - entry::MouseState m_mouseState; + entry::WindowState m_state; uint32_t m_width; uint32_t m_height; diff --git a/3rdparty/bgfx/examples/23-vectordisplay/main.cpp b/3rdparty/bgfx/examples/23-vectordisplay/main.cpp index e71943e08b3..badeeccff9a 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/main.cpp +++ b/3rdparty/bgfx/examples/23-vectordisplay/main.cpp @@ -23,10 +23,10 @@ struct PosColorVertex static void init() { ms_decl - .begin() - .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) - .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) - .end(); + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true) + .end(); } static bgfx::VertexDecl ms_decl; @@ -50,8 +50,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); float texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; @@ -114,8 +119,8 @@ public: m_vd.resize(uint16_t(m_width), uint16_t(m_height) ); } - const float at[3] = { 0.0f, 0.0f, 0.0f }; - const float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; float view[16]; float proj[16]; @@ -182,8 +187,9 @@ public: // draw moving shape static float counter = 0.0f; counter += 0.01f; - float posX = m_width / 2.0f + bx::fsin(counter * 3.18378f) * (m_width / 2.0f); - float posY = m_height / 2.0f + bx::fcos(counter) * (m_height / 2.0f); + + const float posX = m_width / 2.0f + bx::sin(counter * 3.18378f) * (m_width / 2.0f); + const float posY = m_height / 2.0f + bx::cos(counter) * (m_height / 2.0f); m_vd.drawCircle(posX, posY, 5.0f, 10.0f); m_vd.endFrame(); diff --git a/3rdparty/bgfx/examples/23-vectordisplay/makefile b/3rdparty/bgfx/examples/23-vectordisplay/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/makefile +++ b/3rdparty/bgfx/examples/23-vectordisplay/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp index c9b677619c5..e63d156b966 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp +++ b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp @@ -47,7 +47,7 @@ bgfx::VertexDecl PosColorUvVertex::ms_decl; inline float normalizef(float _a) { - return bx::fwrap(_a, 2.0f * bx::kPi); + return bx::wrap(_a, 2.0f * bx::kPi); } VectorDisplay::VectorDisplay() @@ -163,10 +163,11 @@ void VectorDisplay::endFrame() BX_CHECK(m_points.size() < MAX_NUMBER_VERTICES, ""); - bgfx::updateDynamicVertexBuffer(m_vertexBuffers[m_currentDrawStep] + bgfx::update( + m_vertexBuffers[m_currentDrawStep] , 0 , bgfx::copy(m_points.data(), (uint32_t)m_points.size() * sizeof(PosColorUvVertex) ) - ); + ); m_vertexBuffersSize[m_currentDrawStep] = (uint32_t)m_points.size(); for (int loopvar = 0; loopvar < m_numberDecaySteps; loopvar++) @@ -187,7 +188,7 @@ void VectorDisplay::endFrame() } else { - alpha = bx::fpow(m_decayValue, stepi - 1.0f) * m_initialDecay; + alpha = bx::pow(m_decayValue, stepi - 1.0f) * m_initialDecay; } float params[4] = { 0.0f, 0.0f, 0.0f, alpha }; @@ -198,8 +199,8 @@ void VectorDisplay::endFrame() bgfx::setVertexBuffer(0, m_vertexBuffers[i], 0, m_vertexBuffersSize[i]); // explicitly feed vertex number! bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_DST_ALPHA) | BGFX_STATE_BLEND_EQUATION_SEPARATE(BGFX_STATE_BLEND_EQUATION_ADD, BGFX_STATE_BLEND_EQUATION_MAX) ); @@ -229,8 +230,8 @@ void VectorDisplay::endFrame() bgfx::setViewFrameBuffer(viewCounter, m_glow0FrameBuffer); bgfx::setViewRect(viewCounter, 0, 0, m_glowWidth, m_glowHeight); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A ); params[0] = 1.0f / m_glowWidth; params[1] = 0.0f; @@ -257,8 +258,8 @@ void VectorDisplay::endFrame() bgfx::setUniform(u_params, params); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A ); bgfx::setViewName(viewCounter, "BlendPassB"); @@ -278,8 +279,8 @@ void VectorDisplay::endFrame() bgfx::setViewRect(viewCounter, 0, 0, m_screenWidth, m_screenHeight); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_sceneFrameBuffer) ); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) ); @@ -298,8 +299,8 @@ void VectorDisplay::endFrame() bgfx::setViewRect(viewCounter, 0, 0, m_screenWidth, m_screenHeight); bgfx::setTexture(0, s_texColor, bgfx::getTexture(m_glow1FrameBuffer) ); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE, BGFX_STATE_BLEND_ONE) ); @@ -343,8 +344,10 @@ void VectorDisplay::endDraw() Line* lines = (Line*)alloca(nlines * sizeof(Line) ); float t = effectiveThickness(); - int first_last_same = bx::fabs(m_pendingPoints[0].x - m_pendingPoints[m_pendingPoints.size() - 1].x) < 0.1 - && bx::fabs(m_pendingPoints[0].y - m_pendingPoints[m_pendingPoints.size() - 1].y) < 0.1; + int first_last_same = true + && bx::abs(m_pendingPoints[0].x - m_pendingPoints[m_pendingPoints.size() - 1].x) < 0.1 + && bx::abs(m_pendingPoints[0].y - m_pendingPoints[m_pendingPoints.size() - 1].y) < 0.1 + ; // compute basics for (size_t i = 1; i < m_pendingPoints.size(); i++) @@ -358,10 +361,10 @@ void VectorDisplay::endDraw() line->y0 = m_pendingPoints[i - 1].y; line->x1 = m_pendingPoints[i].x; line->y1 = m_pendingPoints[i].y; - line->a = bx::fatan2(line->y1 - line->y0, line->x1 - line->x0); // angle from positive x axis, increasing ccw, [-pi, pi] - line->sin_a = bx::fsin(line->a); - line->cos_a = bx::fcos(line->a); - line->len = bx::fsqrt( (line->x1 - line->x0) * (line->x1 - line->x0) + (line->y1 - line->y0) * (line->y1 - line->y0) ); + line->a = bx::atan2(line->y1 - line->y0, line->x1 - line->x0); // angle from positive x axis, increasing ccw, [-pi, pi] + line->sin_a = bx::sin(line->a); + line->cos_a = bx::cos(line->a); + line->len = bx::sqrt( (line->x1 - line->x0) * (line->x1 - line->x0) + (line->y1 - line->y0) * (line->y1 - line->y0) ); // figure out what connections we have line->has_prev = (!line->is_first @@ -385,18 +388,18 @@ void VectorDisplay::endDraw() { float pa2a = normalizef(pline->a - line->a); float a2pa = normalizef(line->a - pline->a); - float maxshorten = bx::fmin(line->len, pline->len) / 2.0f; + float maxshorten = bx::min(line->len, pline->len) / 2.0f; - if (bx::fmin(a2pa, pa2a) <= (bx::kPi / 2.0f + FLT_EPSILON) ) + if (bx::min(a2pa, pa2a) <= (bx::kPi / 2.0f + FLT_EPSILON) ) { if (a2pa < pa2a) { - float shorten = t * bx::fsin(a2pa / 2.0f) / bx::fcos(a2pa / 2.0f); + float shorten = t * bx::sin(a2pa / 2.0f) / bx::cos(a2pa / 2.0f); float a = (bx::kPi - a2pa) / 2.0f; if (shorten > maxshorten) { line->s0 = pline->s1 = maxshorten; - line->tr0 = pline->tr1 = maxshorten * bx::fsin(a) / bx::fcos(a); + line->tr0 = pline->tr1 = maxshorten * bx::sin(a) / bx::cos(a); } else { @@ -407,12 +410,13 @@ void VectorDisplay::endDraw() } else { - float shorten = t * bx::fsin(pa2a / 2.0f) / bx::fcos(pa2a / 2.0f); + float shorten = t * bx::sin(pa2a / 2.0f) / bx::cos(pa2a / 2.0f); float a = (bx::kPi - pa2a) / 2.0f; if (shorten > maxshorten) { - line->s0 = pline->s1 = maxshorten; - line->tl0 = pline->tl1 = maxshorten * bx::fsin(a) / bx::fcos(a); + line->s0 = pline->s1 = maxshorten; + line->tl0 = + pline->tl1 = maxshorten * bx::sin(a) / bx::cos(a); } else { @@ -495,12 +499,12 @@ void VectorDisplay::drawCircle(float _x, float _y, float _radius, float _steps) float step = bx::kPi * 2.0f / _steps; - beginDraw(_x + _radius * bx::fsin(edgeangle + angadjust), - _y - _radius * bx::fcos(edgeangle + angadjust) ); + beginDraw(_x + _radius * bx::sin(edgeangle + angadjust), + _y - _radius * bx::cos(edgeangle + angadjust) ); for (edgeangle = 0; edgeangle < 2.0f * bx::kPi - 0.001; edgeangle += step) { - drawTo(_x + _radius * bx::fsin(edgeangle + step - angadjust), - _y - _radius * bx::fcos(edgeangle + step - angadjust) ); + drawTo(_x + _radius * bx::sin(edgeangle + step - angadjust), + _y - _radius * bx::cos(edgeangle + step - angadjust) ); } endDraw(); @@ -510,32 +514,39 @@ void VectorDisplay::drawWheel(float _angle, float _x, float _y, float _radius) { float spokeradius = _radius - 2.0f; // draw spokes - drawLine(_x + spokeradius * bx::fsin(_angle), - _y - spokeradius * bx::fcos(_angle), - _x - spokeradius * bx::fsin(_angle), - _y + spokeradius * bx::fcos(_angle) ); - drawLine(_x + spokeradius * bx::fsin(_angle + bx::kPi / 4.0f), - _y - spokeradius * bx::fcos(_angle + bx::kPi / 4.0f), - _x - spokeradius * bx::fsin(_angle + bx::kPi / 4.0f), - _y + spokeradius * bx::fcos(_angle + bx::kPi / 4.0f) ); - drawLine(_x + spokeradius * bx::fsin(_angle + bx::kPi / 2.0f), - _y - spokeradius * bx::fcos(_angle + bx::kPi / 2.0f), - _x - spokeradius * bx::fsin(_angle + bx::kPi / 2.0f), - _y + spokeradius * bx::fcos(_angle + bx::kPi / 2.0f) ); - drawLine(_x + spokeradius * bx::fsin(_angle + 3.0f * bx::kPi / 4.0f), - _y - spokeradius * bx::fcos(_angle + 3.0f * bx::kPi / 4.0f), - _x - spokeradius * bx::fsin(_angle + 3.0f * bx::kPi / 4.0f), - _y + spokeradius * bx::fcos(_angle + 3.0f * bx::kPi / 4.0f) ); + drawLine(_x + spokeradius * bx::sin(_angle), + _y - spokeradius * bx::cos(_angle), + _x - spokeradius * bx::sin(_angle), + _y + spokeradius * bx::cos(_angle) + ); + drawLine(_x + spokeradius * bx::sin(_angle + bx::kPi / 4.0f), + _y - spokeradius * bx::cos(_angle + bx::kPi / 4.0f), + _x - spokeradius * bx::sin(_angle + bx::kPi / 4.0f), + _y + spokeradius * bx::cos(_angle + bx::kPi / 4.0f) + ); + drawLine(_x + spokeradius * bx::sin(_angle + bx::kPi / 2.0f), + _y - spokeradius * bx::cos(_angle + bx::kPi / 2.0f), + _x - spokeradius * bx::sin(_angle + bx::kPi / 2.0f), + _y + spokeradius * bx::cos(_angle + bx::kPi / 2.0f) + ); + drawLine(_x + spokeradius * bx::sin(_angle + 3.0f * bx::kPi / 4.0f), + _y - spokeradius * bx::cos(_angle + 3.0f * bx::kPi / 4.0f), + _x - spokeradius * bx::sin(_angle + 3.0f * bx::kPi / 4.0f), + _y + spokeradius * bx::cos(_angle + 3.0f * bx::kPi / 4.0f) + ); float edgeangle = 0.0f; float angadjust = 0.0f; - beginDraw(_x + _radius * bx::fsin(_angle + edgeangle + angadjust), - _y - _radius * bx::fcos(_angle + edgeangle + angadjust) ); + beginDraw( + _x + _radius * bx::sin(_angle + edgeangle + angadjust) + , _y - _radius * bx::cos(_angle + edgeangle + angadjust) + ); + for (edgeangle = 0; edgeangle < 2.0f * bx::kPi - 0.001f; edgeangle += bx::kPi / 4.0f) { - drawTo(_x + _radius * bx::fsin(_angle + edgeangle + bx::kPi / 4.0f - angadjust), - _y - _radius * bx::fcos(_angle + edgeangle + bx::kPi / 4.0f - angadjust) ); + drawTo(_x + _radius * bx::sin(_angle + edgeangle + bx::kPi / 4.0f - angadjust), + _y - _radius * bx::cos(_angle + edgeangle + bx::kPi / 4.0f - angadjust) ); } endDraw(); @@ -547,12 +558,10 @@ float VectorDisplay::effectiveThickness() { return m_thickness * m_drawScale / 2.0f; } - else - { - // this makes thickness=16 at 2048x1536 - float v = (0.01f * (m_screenWidth + m_screenHeight) / 2.0f) * m_drawScale / 2.0f; - return bx::fmax(v, 6.0f); - } + + // this makes thickness=16 at 2048x1536 + float vv = (0.01f * (m_screenWidth + m_screenHeight) / 2.0f) * m_drawScale / 2.0f; + return bx::max(vv, 6.0f); } void VectorDisplay::setTransform(float _offsetX, float _offsetY, float _scale) @@ -622,7 +631,7 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t, if (a2pa < pa2a) { _t = -_t; - nsteps = (int)bx::fmax(1, bx::fround(a2pa / (bx::kPi / 8.0f) ) ); + nsteps = (int32_t)bx::max(1.0f, bx::round(a2pa / (bx::kPi / 8.0f) ) ); angles = (float*)alloca(sizeof(float) * (nsteps + 1) ); for (i = 0; i <= nsteps; i++) { @@ -631,7 +640,7 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t, } else { - nsteps = (int)bx::fmax(1, bx::fround(pa2a / (bx::kPi / 8.0f) ) ); + nsteps = (int32_t)bx::max(1.0f, bx::round(pa2a / (bx::kPi / 8.0f) ) ); angles = (float*)alloca(sizeof(float) * (nsteps + 1) ); for (i = 0; i <= nsteps; i++) { @@ -641,9 +650,9 @@ void VectorDisplay::drawFan(float _cx, float _cy, float _pa, float _a, float _t, for (i = 1; i <= nsteps; i++) { - appendTexpoint(_cx + _t * bx::fsin(angles[i - 1]), _cy - _t * bx::fcos(angles[i - 1]), _e, (float)HALF_TEXTURE_SIZE); + appendTexpoint(_cx + _t * bx::sin(angles[i - 1]), _cy - _t * bx::cos(angles[i - 1]), _e, (float)HALF_TEXTURE_SIZE); appendTexpoint(_cx, _cy, _s, (float)HALF_TEXTURE_SIZE); - appendTexpoint(_cx + _t * bx::fsin(angles[i]), _cy - _t * bx::fcos(angles[i]), _e, (float)HALF_TEXTURE_SIZE); + appendTexpoint(_cx + _t * bx::sin(angles[i]), _cy - _t * bx::cos(angles[i]), _e, (float)HALF_TEXTURE_SIZE); } } @@ -818,21 +827,21 @@ void VectorDisplay::screenSpaceQuad(float _textureWidth, float _textureHeight, f void VectorDisplay::setupResDependent() { - const uint32_t samplerFlags = 0 + const uint64_t tsFlags = 0 | BGFX_TEXTURE_RT - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ; - m_sceneFrameBuffer = bgfx::createFrameBuffer(m_screenWidth, m_screenHeight, bgfx::TextureFormat::BGRA8, samplerFlags); + m_sceneFrameBuffer = bgfx::createFrameBuffer(m_screenWidth, m_screenHeight, bgfx::TextureFormat::BGRA8, tsFlags); m_glowWidth = m_screenWidth / 3; m_glowHeight = m_screenHeight / 3; - m_glow0FrameBuffer = bgfx::createFrameBuffer(m_glowWidth, m_glowHeight, bgfx::TextureFormat::BGRA8, samplerFlags); - m_glow1FrameBuffer = bgfx::createFrameBuffer(m_glowWidth, m_glowHeight, bgfx::TextureFormat::BGRA8, samplerFlags); + m_glow0FrameBuffer = bgfx::createFrameBuffer(m_glowWidth, m_glowHeight, bgfx::TextureFormat::BGRA8, tsFlags); + m_glow1FrameBuffer = bgfx::createFrameBuffer(m_glowWidth, m_glowHeight, bgfx::TextureFormat::BGRA8, tsFlags); } void VectorDisplay::teardownResDependent() @@ -853,14 +862,14 @@ void VectorDisplay::genLinetex() // generate { for (y = 0; y < TEXTURE_SIZE; y++) { - float distance = bx::fmin(1.0f - , bx::fsqrt( (float)( (x - HALF_TEXTURE_SIZE) * (x - HALF_TEXTURE_SIZE) + (y - HALF_TEXTURE_SIZE) * (y - HALF_TEXTURE_SIZE) ) ) / (float)HALF_TEXTURE_SIZE + float distance = bx::min(1.0f + , bx::sqrt( (float)( (x - HALF_TEXTURE_SIZE) * (x - HALF_TEXTURE_SIZE) + (y - HALF_TEXTURE_SIZE) * (y - HALF_TEXTURE_SIZE) ) ) / (float)HALF_TEXTURE_SIZE ); - float line = bx::fpow(16.0f, -2.0f * distance); - float glow = bx::fpow( 2.0f, -4.0f * distance) / 10.0f; + float line = bx::pow(16.0f, -2.0f * distance); + float glow = bx::pow( 2.0f, -4.0f * distance) / 10.0f; glow = 0; - float val = bx::fsaturate(line + glow); + float val = bx::clamp(line + glow, 0.0f, 1.0f); texbuf[(x + y * TEXTURE_SIZE) * 4 + 0] = 0xff; texbuf[(x + y * TEXTURE_SIZE) * 4 + 1] = 0xff; @@ -870,10 +879,10 @@ void VectorDisplay::genLinetex() // generate } const uint32_t flags = 0 - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT ; m_lineTexId = bgfx::createTexture2D(TEXTURE_SIZE, TEXTURE_SIZE, false, 1, bgfx::TextureFormat::BGRA8, flags, mem); diff --git a/3rdparty/bgfx/examples/24-nbody/makefile b/3rdparty/bgfx/examples/24-nbody/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/24-nbody/makefile +++ b/3rdparty/bgfx/examples/24-nbody/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/24-nbody/nbody.cpp b/3rdparty/bgfx/examples/24-nbody/nbody.cpp index 4d285d81739..ae675c35512 100644 --- a/3rdparty/bgfx/examples/24-nbody/nbody.cpp +++ b/3rdparty/bgfx/examples/24-nbody/nbody.cpp @@ -127,8 +127,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -280,12 +285,15 @@ public: { ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 1.5f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 1.5f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); bool reset = false; @@ -357,8 +365,8 @@ public: bgfx::dispatch(0, m_updateInstancesProgram, uint16_t(m_paramsData.dispatchSize), 1, 1); } - bx::xchg(m_currPositionBuffer0, m_currPositionBuffer1); - bx::xchg(m_prevPositionBuffer0, m_prevPositionBuffer1); + bx::swap(m_currPositionBuffer0, m_currPositionBuffer1); + bx::swap(m_prevPositionBuffer0, m_prevPositionBuffer1); // Update camera. cameraUpdate(deltaTime, m_mouseState); @@ -367,30 +375,6 @@ public: cameraGetViewMtx(view); // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float viewHead[16]; - float eye[3] = {}; - bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye); - - float tmp[16]; - bx::mtxMul(tmp, view, viewHead); - bgfx::setViewTransform( - 0 - , tmp - , hmd->eye[0].projection - , BGFX_VIEW_STEREO - , hmd->eye[1].projection - ); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float proj[16]; bx::mtxProj( @@ -417,7 +401,7 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_ADD | BGFX_STATE_DEPTH_TEST_ALWAYS ); diff --git a/3rdparty/bgfx/examples/25-c99/helloworld.c b/3rdparty/bgfx/examples/25-c99/helloworld.c index d81ffdb3596..5175730059d 100644 --- a/3rdparty/bgfx/examples/25-c99/helloworld.c +++ b/3rdparty/bgfx/examples/25-c99/helloworld.c @@ -22,13 +22,11 @@ int32_t _main_(int32_t _argc, char** _argv) (void)_argc; (void)_argv; - bgfx_init(BGFX_RENDERER_TYPE_COUNT - , BGFX_PCI_ID_NONE - , 0 - , NULL - , NULL - ); - bgfx_reset(width, height, reset); + bgfx_init_t init; + bgfx_init_ctor(&init); + + bgfx_init(&init); + bgfx_reset(width, height, reset, init.resolution.format); // Enable debug text. bgfx_set_debug(debug); diff --git a/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp b/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp index d2c43c903b9..55970a4019b 100644 --- a/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp +++ b/3rdparty/bgfx/examples/26-occlusion/occlusion.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -76,11 +76,16 @@ public: m_width = _width; m_height = _height; - m_debug = BGFX_DEBUG_NONE; + m_debug = BGFX_DEBUG_TEXT; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -204,23 +209,6 @@ public: cameraGetViewMtx(view); // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float viewHead[16]; - float eye[3] = {}; - bx::mtxQuatTranslationHMD(viewHead, hmd->eye[0].rotation, eye); - - float tmp[16]; - bx::mtxMul(tmp, view, viewHead); - - bgfx::setViewTransform(0, tmp, hmd->eye[0].projection); - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - - bgfx::setViewTransform(1, tmp, hmd->eye[1].projection); - bgfx::setViewRect(1, 0, 0, hmd->width, hmd->height); - } - else { float proj[16]; bx::mtxProj(proj, 90.0f, float(m_width)/float(m_height), 0.1f, 10000.0f, bgfx::getCaps()->homogeneousDepth); @@ -231,8 +219,8 @@ public: bgfx::setViewTransform(1, view, proj); bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) ); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 17.5f, 10.0f, -17.5f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 17.5f, 10.0f, -17.5f }; bx::mtxLookAt(view, eye, at); bgfx::setViewTransform(2, view, proj); @@ -286,12 +274,12 @@ public: for (uint16_t xx = 0; xx < CUBES_DIM; ++xx) { - bgfx::dbgTextImage(5 + xx*2, 5, 1, CUBES_DIM, img + xx*2, CUBES_DIM*2); + bgfx::dbgTextImage(5 + xx*2, 20, 1, CUBES_DIM, img + xx*2, CUBES_DIM*2); } int32_t numPixels = 0; bgfx::getResult(m_occlusionQueries[0], &numPixels); - bgfx::dbgTextPrintf(5, 5 + CUBES_DIM + 1, 0xf, "%d", numPixels); + bgfx::dbgTextPrintf(5, 20 + CUBES_DIM + 1, 0xf, "Passing pixels count: %d", numPixels); } // Advance to next frame. Rendering thread will be kicked to diff --git a/3rdparty/bgfx/examples/27-terrain/makefile b/3rdparty/bgfx/examples/27-terrain/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/27-terrain/makefile +++ b/3rdparty/bgfx/examples/27-terrain/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/27-terrain/terrain.cpp b/3rdparty/bgfx/examples/27-terrain/terrain.cpp index 82a6012ae8a..8ae06d56833 100644 --- a/3rdparty/bgfx/examples/27-terrain/terrain.cpp +++ b/3rdparty/bgfx/examples/27-terrain/terrain.cpp @@ -76,8 +76,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -256,7 +261,7 @@ public: } mem = bgfx::makeRef(&m_terrain.m_vertices[0], sizeof(PosTexCoord0Vertex) * m_terrain.m_vertexCount); - bgfx::updateDynamicVertexBuffer(m_dvbh, 0, mem); + bgfx::update(m_dvbh, 0, mem); if (!bgfx::isValid(m_dibh) ) { @@ -264,7 +269,7 @@ public: } mem = bgfx::makeRef(&m_terrain.m_indices[0], sizeof(uint16_t) * m_terrain.m_indexCount); - bgfx::updateDynamicIndexBuffer(m_dibh, 0, mem); + bgfx::update(m_dibh, 0, mem); break; case 2: // Height Texture: Update a height texture that is sampled in the terrain vertex shader. @@ -316,15 +321,15 @@ public: // Brush attenuation float a2 = (float)(area_x * area_x); float b2 = (float)(area_y * area_y); - float brushAttn = m_brush.m_size - bx::fsqrt(a2 + b2); + float brushAttn = m_brush.m_size - bx::sqrt(a2 + b2); // Raise/Lower and scale by brush power. - height += 0.0f < bx::fclamp(brushAttn*m_brush.m_power, 0.0f, m_brush.m_power) && m_brush.m_raise + height += 0.0f < bx::clamp(brushAttn*m_brush.m_power, 0.0f, m_brush.m_power) && m_brush.m_raise ? 1.0f : -1.0f ; - m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::fclamp(height, 0.0f, 255.0f); + m_terrain.m_heightMap[heightMapPos] = (uint8_t)bx::clamp(height, 0.0f, 255.0f); m_terrain.m_dirty = true; } } @@ -406,12 +411,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 3.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 3.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::Separator(); diff --git a/3rdparty/bgfx/examples/28-wireframe/makefile b/3rdparty/bgfx/examples/28-wireframe/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/28-wireframe/makefile +++ b/3rdparty/bgfx/examples/28-wireframe/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp b/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp index e7454c57cad..d19ee8b8c74 100644 --- a/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp +++ b/3rdparty/bgfx/examples/28-wireframe/wireframe.cpp @@ -49,7 +49,7 @@ struct Camera void mtxLookAt(float* _outViewMtx) { - bx::mtxLookAt(_outViewMtx, m_pos.curr, m_target.curr); + bx::mtxLookAt(_outViewMtx, bx::load(m_pos.curr), bx::load(m_target.curr) ); } void orbit(float _dx, float _dy) @@ -116,7 +116,7 @@ struct Camera bx::vec3ToLatLong(&ll[0], &ll[1], toPosNorm); ll[0] += consume[0]; ll[1] -= consume[1]; - ll[1] = bx::fclamp(ll[1], 0.02f, 0.98f); + ll[1] = bx::clamp(ll[1], 0.02f, 0.98f); float tmp[3]; bx::vec3FromLatLong(tmp, ll[0], ll[1]); @@ -136,16 +136,16 @@ struct Camera void update(float _dt) { - const float amount = bx::fmin(_dt/0.12f, 1.0f); + const float amount = bx::min(_dt/0.12f, 1.0f); consumeOrbit(amount); - m_target.curr[0] = bx::flerp(m_target.curr[0], m_target.dest[0], amount); - m_target.curr[1] = bx::flerp(m_target.curr[1], m_target.dest[1], amount); - m_target.curr[2] = bx::flerp(m_target.curr[2], m_target.dest[2], amount); - m_pos.curr[0] = bx::flerp(m_pos.curr[0], m_pos.dest[0], amount); - m_pos.curr[1] = bx::flerp(m_pos.curr[1], m_pos.dest[1], amount); - m_pos.curr[2] = bx::flerp(m_pos.curr[2], m_pos.dest[2], amount); + m_target.curr[0] = bx::lerp(m_target.curr[0], m_target.dest[0], amount); + m_target.curr[1] = bx::lerp(m_target.curr[1], m_target.dest[1], amount); + m_target.curr[2] = bx::lerp(m_target.curr[2], m_target.dest[2], amount); + m_pos.curr[0] = bx::lerp(m_pos.curr[0], m_pos.dest[0], amount); + m_pos.curr[1] = bx::lerp(m_pos.curr[1], m_pos.dest[1], amount); + m_pos.curr[2] = bx::lerp(m_pos.curr[2], m_pos.dest[2], amount); } struct Interp3f @@ -303,8 +303,13 @@ public: | BGFX_RESET_MSAA_X16 ; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -385,12 +390,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height * 0.75f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height * 0.75f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::Separator(); @@ -472,9 +480,9 @@ public: if (DrawMode::Wireframe == m_drawMode) { uint64_t state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) @@ -484,10 +492,10 @@ public: else { uint64_t state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_LESS - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA ; diff --git a/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp b/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp index e089957411d..f2e2cfddd82 100644 --- a/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp +++ b/3rdparty/bgfx/examples/29-debugdraw/debugdraw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -16,6 +16,454 @@ namespace { +static DdVertex s_bunnyVertices[] = +{ + { 25.0883f, -44.2788f, 31.0055f }, + { 0.945623f, 53.5504f, -24.6146f }, + { -0.94455f, -14.3443f, -16.8223f }, + { -20.1103f, -48.6664f, 12.6763f }, + { -1.60652f, -26.3165f, -24.5424f }, + { -30.6284f, -53.6299f, 14.7666f }, + { 1.69145f, -43.8075f, -15.2065f }, + { -20.5139f, 21.0521f, -5.40868f }, + { -13.9518f, 53.6299f, -39.1193f }, + { -21.7912f, 48.7801f, -42.0995f }, + { -26.8408f, 23.6537f, -17.7324f }, + { -23.1196f, 33.9692f, 4.91483f }, + { -12.3236f, -41.6303f, 31.8324f }, + { 27.6427f, -5.05034f, -11.3201f }, + { 32.2565f, 1.30521f, 30.2671f }, + { 47.2723f, -27.0974f, 11.1774f }, + { 33.598f, 10.5888f, 7.95916f }, + { -13.2898f, 12.6234f, 5.55953f }, + { -32.7364f, 19.0648f, -10.5736f }, + { -32.7536f, 31.4158f, -1.40712f }, + { -25.3672f, 30.2874f, -12.4682f }, + { 32.921f, -36.8408f, -12.0254f }, + { -37.7251f, -33.8989f, 0.378443f }, + { -35.6341f, -0.246891f, -9.25165f }, + { -16.7041f, -50.0254f, -15.6177f }, + { 24.6604f, -53.5319f, -11.1059f }, + { -7.77574f, -53.5719f, -16.6655f }, + { 20.6241f, 13.3489f, 0.376349f }, + { -44.2889f, 29.5222f, 18.7918f }, + { 18.5805f, 16.3651f, 12.6351f }, + { -23.7853f, 31.7598f, -6.54093f }, + { 24.7518f, -53.5075f, 2.14984f }, + { -45.7912f, -17.6301f, 21.1198f }, + { 51.8403f, -33.1847f, 24.3337f }, + { -47.5343f, -4.32792f, 4.06232f }, + { -50.6832f, -12.442f, 11.0994f }, + { -49.5132f, 19.2782f, 3.17559f }, + { -39.4881f, 29.0208f, -6.70431f }, + { -52.7286f, 1.23232f, 9.74872f }, + { 26.505f, -16.1297f, -17.0487f }, + { -25.367f, 20.0473f, -8.44282f }, + { -24.5797f, -10.3143f, -18.3154f }, + { -28.6707f, 6.12074f, 27.8025f }, + { -16.9868f, 22.6819f, 1.37408f }, + { -37.2678f, 23.9443f, -9.4945f }, + { -24.8562f, 21.3763f, 18.8847f }, + { -47.1879f, 3.8542f, -4.74621f }, + { 38.0706f, -7.33673f, -7.6099f }, + { -34.8833f, -3.57074f, 26.4838f }, + { 12.3797f, 5.46782f, 32.9762f }, + { -31.5974f, -22.956f, 30.5827f }, + { -6.80953f, 48.055f, -18.5116f }, + { 6.3474f, -15.1622f, -24.4726f }, + { -25.5733f, 25.2452f, -34.4736f }, + { -23.8955f, 31.8323f, -40.8696f }, + { -11.8622f, 38.2304f, -43.3125f }, + { -20.4918f, 41.2409f, -3.11271f }, + { 24.9806f, -8.53455f, 37.2862f }, + { -52.8935f, 5.3376f, 28.246f }, + { 34.106f, -41.7941f, 30.962f }, + { -1.26914f, 35.6664f, -18.7177f }, + { -0.13048f, 44.7288f, -28.7163f }, + { 2.47929f, 0.678165f, -14.6892f }, + { -31.8649f, -14.2299f, 32.2998f }, + { -19.774f, 30.8258f, 5.77293f }, + { 49.8059f, -37.125f, 4.97284f }, + { -28.0581f, -26.439f, -14.8316f }, + { -9.12066f, -27.3987f, -12.8592f }, + { -13.8752f, -29.9821f, 32.5962f }, + { -6.6222f, -10.9884f, 33.5007f }, + { -21.2664f, -53.6089f, -3.49195f }, + { -0.628672f, 52.8093f, -9.88088f }, + { 8.02417f, 51.8956f, -21.5834f }, + { -44.6547f, 11.9973f, 34.7897f }, + { -7.55466f, 37.9035f, -0.574101f }, + { 52.8252f, -27.1986f, 11.6429f }, + { -0.934591f, 9.81861f, 0.512566f }, + { -3.01043f, 5.70605f, 22.0954f }, + { -34.6337f, 44.5964f, -31.1713f }, + { -26.9017f, 35.1991f, -32.4307f }, + { 15.9884f, -8.92223f, -14.7411f }, + { -22.8337f, -43.458f, 26.7274f }, + { -31.9864f, -47.0243f, 9.36972f }, + { -36.9436f, 24.1866f, 29.2521f }, + { -26.5411f, 29.6549f, 21.2867f }, + { 33.7644f, -24.1886f, -13.8513f }, + { -2.44749f, -17.0148f, 41.6617f }, + { -38.364f, -13.9823f, -12.5705f }, + { -10.2972f, -51.6584f, 38.935f }, + { 1.28109f, -43.4943f, 36.6288f }, + { -19.7784f, -44.0413f, -4.23994f }, + { 37.0944f, -53.5479f, 27.6467f }, + { 24.9642f, -37.1722f, 35.7038f }, + { 37.5851f, 5.64874f, 21.6702f }, + { -17.4738f, -53.5734f, 30.0664f }, + { -8.93088f, 45.3429f, -34.4441f }, + { -17.7111f, -6.5723f, 29.5162f }, + { 44.0059f, -17.4408f, -5.08686f }, + { -46.2534f, -22.6115f, 0.702059f }, + { 43.9321f, -33.8575f, 4.31819f }, + { 41.6762f, -7.37115f, 27.6798f }, + { 8.20276f, -42.0948f, -18.0893f }, + { 26.2678f, -44.6777f, -10.6835f }, + { 17.709f, 13.1542f, 25.1769f }, + { -35.9897f, 3.92007f, 35.8198f }, + { -23.9323f, -37.3142f, -2.39396f }, + { 5.19169f, 46.8851f, -28.7587f }, + { -37.3072f, -35.0484f, 16.9719f }, + { 45.0639f, -28.5255f, 22.3465f }, + { -34.4175f, 35.5861f, -21.7562f }, + { 9.32684f, -12.6655f, 42.189f }, + { 1.00938f, -31.7694f, 43.1914f }, + { -45.4666f, -3.71104f, 19.2248f }, + { -28.7999f, -50.8481f, 31.5232f }, + { 35.2212f, -45.9047f, 0.199736f }, + { 40.3f, -53.5889f, 7.47622f }, + { 29.0515f, 5.1074f, -10.002f }, + { 13.4336f, 4.84341f, -9.72327f }, + { 11.0617f, -26.245f, -24.9471f }, + { -35.6056f, -51.2531f, 0.436527f }, + { -10.6863f, 34.7374f, -36.7452f }, + { -51.7652f, 27.4957f, 7.79363f }, + { -50.1898f, 18.379f, 26.3763f }, + { -49.6836f, -1.32722f, 26.2828f }, + { 19.0363f, -16.9114f, 41.8511f }, + { 32.7141f, -21.501f, 36.0025f }, + { 12.5418f, -28.4244f, 43.3125f }, + { -19.5634f, 42.6328f, -27.0687f }, + { -16.1942f, 6.55011f, 19.4066f }, + { 46.9886f, -18.8482f, 22.1332f }, + { 45.9697f, -3.76781f, 4.10111f }, + { -28.2912f, 51.3277f, -35.1815f }, + { -40.2796f, -27.7518f, 22.8684f }, + { -22.7984f, -38.9977f, 22.158f }, + { 54.0614f, -35.6096f, 12.694f }, + { 44.2064f, -53.6029f, 18.8679f }, + { 19.789f, -29.517f, -19.6094f }, + { -34.3769f, 34.8566f, 9.92517f }, + { -23.7518f, -45.0319f, 8.71282f }, + { -12.7978f, 3.55087f, -13.7108f }, + { -54.0614f, 8.83831f, 8.91353f }, + { 16.2986f, -53.5717f, 34.065f }, + { -36.6243f, -53.5079f, 24.6495f }, + { 16.5794f, -48.5747f, 35.5681f }, + { -32.3263f, 41.4526f, -18.7388f }, + { -18.8488f, 9.62627f, -8.81052f }, + { 5.35849f, 36.3616f, -12.9346f }, + { 6.19167f, 34.497f, -17.965f }, +}; + +static const uint16_t s_bunnyTriList[] = +{ + 80, 2, 52, + 0, 143, 92, + 51, 1, 71, + 96, 128, 77, + 67, 2, 41, + 85, 39, 52, + 58, 123, 38, + 99, 21, 114, + 55, 9, 54, + 136, 102, 21, + 3, 133, 81, + 101, 136, 4, + 5, 82, 3, + 6, 90, 24, + 7, 40, 145, + 33, 75, 134, + 55, 8, 9, + 10, 40, 20, + 46, 140, 38, + 74, 64, 11, + 89, 88, 12, + 147, 60, 7, + 47, 116, 13, + 59, 129, 108, + 147, 72, 106, + 33, 108, 75, + 100, 57, 14, + 129, 130, 15, + 32, 35, 112, + 16, 29, 27, + 107, 98, 132, + 130, 116, 47, + 17, 43, 7, + 54, 44, 53, + 46, 34, 23, + 87, 41, 23, + 40, 10, 18, + 8, 131, 9, + 11, 19, 56, + 11, 137, 19, + 19, 20, 30, + 28, 121, 137, + 122, 140, 36, + 15, 130, 97, + 28, 84, 83, + 114, 21, 102, + 87, 98, 22, + 41, 145, 23, + 133, 68, 12, + 90, 70, 24, + 31, 25, 26, + 98, 34, 35, + 16, 27, 116, + 28, 83, 122, + 29, 103, 77, + 40, 30, 20, + 14, 49, 103, + 31, 26, 142, + 78, 9, 131, + 80, 62, 2, + 6, 67, 105, + 32, 48, 63, + 60, 30, 7, + 33, 135, 91, + 116, 130, 16, + 47, 13, 39, + 70, 119, 5, + 24, 26, 6, + 102, 25, 31, + 103, 49, 77, + 16, 130, 93, + 125, 126, 124, + 111, 86, 110, + 4, 52, 2, + 87, 34, 98, + 4, 6, 101, + 29, 76, 27, + 112, 35, 34, + 6, 4, 67, + 72, 1, 106, + 26, 24, 70, + 36, 37, 121, + 81, 113, 142, + 44, 109, 37, + 122, 58, 38, + 96, 48, 128, + 71, 11, 56, + 73, 122, 83, + 52, 39, 80, + 40, 18, 145, + 82, 5, 119, + 10, 20, 120, + 139, 145, 41, + 3, 142, 5, + 76, 117, 27, + 95, 120, 20, + 104, 45, 42, + 128, 43, 17, + 44, 37, 36, + 128, 45, 64, + 143, 111, 126, + 34, 46, 38, + 97, 130, 47, + 142, 91, 115, + 114, 31, 115, + 125, 100, 129, + 48, 96, 63, + 62, 41, 2, + 69, 77, 49, + 133, 50, 68, + 60, 51, 30, + 4, 118, 52, + 53, 55, 54, + 95, 8, 55, + 121, 37, 19, + 65, 75, 99, + 51, 56, 30, + 14, 57, 110, + 58, 122, 73, + 59, 92, 125, + 42, 45, 128, + 49, 14, 110, + 60, 147, 61, + 76, 62, 117, + 69, 49, 86, + 26, 5, 142, + 46, 44, 36, + 63, 50, 132, + 128, 64, 43, + 75, 108, 15, + 134, 75, 65, + 68, 69, 86, + 62, 76, 145, + 142, 141, 91, + 67, 66, 105, + 69, 68, 96, + 119, 70, 90, + 33, 91, 108, + 136, 118, 4, + 56, 51, 71, + 1, 72, 71, + 23, 18, 44, + 104, 123, 73, + 106, 1, 61, + 86, 111, 68, + 83, 45, 104, + 30, 56, 19, + 15, 97, 99, + 71, 74, 11, + 15, 99, 75, + 25, 102, 6, + 12, 94, 81, + 135, 33, 134, + 138, 133, 3, + 76, 29, 77, + 94, 88, 141, + 115, 31, 142, + 36, 121, 122, + 4, 2, 67, + 9, 78, 79, + 137, 121, 19, + 69, 96, 77, + 13, 62, 80, + 8, 127, 131, + 143, 141, 89, + 133, 12, 81, + 82, 119, 138, + 45, 83, 84, + 21, 85, 136, + 126, 110, 124, + 86, 49, 110, + 13, 116, 117, + 22, 66, 87, + 141, 88, 89, + 64, 45, 84, + 79, 78, 109, + 26, 70, 5, + 14, 93, 100, + 68, 50, 63, + 90, 105, 138, + 141, 0, 91, + 105, 90, 6, + 0, 92, 59, + 17, 145, 76, + 29, 93, 103, + 113, 81, 94, + 39, 85, 47, + 132, 35, 32, + 128, 48, 42, + 93, 29, 16, + 145, 18, 23, + 108, 129, 15, + 32, 112, 48, + 66, 41, 87, + 120, 95, 55, + 96, 68, 63, + 85, 99, 97, + 18, 53, 44, + 22, 98, 107, + 98, 35, 132, + 95, 127, 8, + 137, 64, 84, + 18, 10, 53, + 21, 99, 85, + 54, 79, 44, + 100, 93, 130, + 142, 3, 81, + 102, 101, 6, + 93, 14, 103, + 42, 48, 104, + 87, 23, 34, + 66, 22, 105, + 106, 61, 147, + 72, 74, 71, + 109, 144, 37, + 115, 65, 99, + 107, 132, 133, + 94, 12, 88, + 108, 91, 59, + 43, 64, 74, + 109, 78, 144, + 43, 147, 7, + 91, 135, 115, + 111, 110, 126, + 38, 112, 34, + 142, 113, 94, + 54, 9, 79, + 120, 53, 10, + 138, 3, 82, + 114, 102, 31, + 134, 65, 115, + 105, 22, 107, + 125, 129, 59, + 37, 144, 19, + 17, 76, 77, + 89, 12, 111, + 41, 66, 67, + 13, 117, 62, + 116, 27, 117, + 136, 52, 118, + 51, 60, 61, + 138, 119, 90, + 53, 120, 55, + 68, 111, 12, + 122, 121, 28, + 123, 58, 73, + 110, 57, 124, + 47, 85, 97, + 44, 79, 109, + 126, 125, 92, + 43, 74, 146, + 20, 19, 127, + 128, 17, 77, + 72, 146, 74, + 115, 99, 114, + 140, 122, 38, + 133, 105, 107, + 129, 100, 130, + 131, 144, 78, + 95, 20, 127, + 123, 48, 112, + 102, 136, 101, + 89, 111, 143, + 28, 137, 84, + 133, 132, 50, + 125, 57, 100, + 38, 123, 112, + 124, 57, 125, + 135, 134, 115, + 23, 44, 46, + 136, 85, 52, + 41, 62, 139, + 137, 11, 64, + 104, 48, 123, + 133, 138, 105, + 145, 139, 62, + 25, 6, 26, + 7, 30, 40, + 46, 36, 140, + 141, 143, 0, + 132, 32, 63, + 83, 104, 73, + 19, 144, 127, + 142, 94, 141, + 39, 13, 80, + 92, 143, 126, + 127, 144, 131, + 51, 61, 1, + 91, 0, 59, + 17, 7, 145, + 43, 146, 147, + 146, 72, 147, +}; + void imageCheckerboard(void* _dst, uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1) { uint32_t* dst = (uint32_t*)_dst; @@ -46,8 +494,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC | BGFX_RESET_MSAA_X16; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -74,6 +527,12 @@ public: imageCheckerboard(data, 32, 32, 4, 0xff808080, 0xffc0c0c0); m_sprite = ddCreateSprite(32, 32, data); + m_bunny = ddCreateGeometry( + BX_COUNTOF(s_bunnyVertices) + , s_bunnyVertices + , BX_COUNTOF(s_bunnyTriList) + , s_bunnyTriList + ); imguiCreate(); } @@ -82,6 +541,7 @@ public: { imguiDestroy(); + ddDestroy(m_bunny); ddDestroy(m_sprite); ddShutdown(); @@ -95,26 +555,23 @@ public: } template - bool intersect(const Ray& _ray, const Ty& _shape) + bool intersect(DebugDrawEncoder* _dde, const Ray& _ray, const Ty& _shape) { Hit hit; if (::intersect(_ray, _shape, &hit) ) { - ddPush(); + _dde->push(); - ddSetWireframe(false); + _dde->setWireframe(false); - ddSetColor(0xff0000ff); + _dde->setColor(0xff0000ff); - float tmp[3]; - bx::vec3Mul(tmp, hit.m_normal, 0.7f); + const bx::Vec3 tmp = bx::mul(hit.m_normal, 0.7f); + const bx::Vec3 end = bx::add(hit.m_pos, tmp); - float end[3]; - bx::vec3Add(end, hit.m_pos, tmp); + _dde->drawCone(&hit.m_pos.x, &end.x, 0.1f); - ddDrawCone(hit.m_pos, end, 0.1f); - - ddPop(); + _dde->pop(); return true; } @@ -157,16 +614,6 @@ public: float proj[16]; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float eye[3]; - cameraGetPosition(eye); - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); @@ -180,9 +627,9 @@ public: float mtxInvVp[16]; bx::mtxInverse(mtxInvVp, mtxVp); - float zero[3] = {}; - float eye[] = { 5.0f, 10.0f, 5.0f }; - bx::mtxLookAt(view, eye, zero); + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 5.0f, 10.0f, 5.0f }; + bx::mtxLookAt(view, eye, at); bx::mtxProj(proj, 45.0f, float(m_width)/float(m_height), 1.0f, 15.0f, bgfx::getCaps()->homogeneousDepth); bx::mtxMul(mtxVp, view, proj); @@ -194,99 +641,128 @@ public: const uint32_t selected = 0xff80ffff; - ddBegin(0); - ddDrawAxis(0.0f, 0.0f, 0.0f); + DebugDrawEncoder dde; - ddPush(); + dde.begin(0); + dde.drawAxis(0.0f, 0.0f, 0.0f); + + dde.push(); Aabb aabb = { { 5.0f, 1.0f, 1.0f }, { 10.0f, 5.0f, 5.0f }, }; - ddSetWireframe(true); - ddSetColor(intersect(ray, aabb) ? selected : 0xff00ff00); - ddDraw(aabb); - ddPop(); + dde.setWireframe(true); + dde.setColor(intersect(&dde, ray, aabb) ? selected : 0xff00ff00); + dde.draw(aabb); + dde.pop(); float time = float(now/freq); Obb obb; bx::mtxRotateX(obb.m_mtx, time); - ddSetWireframe(true); - ddSetColor(intersect(ray, obb) ? selected : 0xffffffff); - ddDraw(obb); + dde.setWireframe(true); + dde.setColor(intersect(&dde, ray, obb) ? selected : 0xffffffff); + dde.draw(obb); bx::mtxSRT(obb.m_mtx, 1.0f, 1.0f, 1.0f, time*0.23f, time, 0.0f, 3.0f, 0.0f, 0.0f); - ddPush(); + dde.push(); toAabb(aabb, obb); - ddSetWireframe(true); - ddSetColor(0xff0000ff); - ddDraw(aabb); - ddPop(); + dde.setWireframe(true); + dde.setColor(0xff0000ff); + dde.draw(aabb); + dde.pop(); - ddSetWireframe(false); - ddSetColor(intersect(ray, obb) ? selected : 0xffffffff); - ddDraw(obb); + dde.setWireframe(false); + dde.setColor(intersect(&dde, ray, obb) ? selected : 0xffffffff); + dde.draw(obb); - ddSetColor(0xffffffff); - ddSetTranslate(0.0f, -2.0f, 0.0f); - ddDrawGrid(Axis::Y, zero, 20, 1.0f); - ddSetTransform(NULL); + dde.setColor(0xffffffff); - ddDrawFrustum(mtxVp); + dde.push(); + { + float bunny[16]; + bx::mtxSRT(bunny, 0.03f, 0.03f, 0.03f, 0.0f, 0.0f, 0.0f, -3.0f, 0.0f, 0.0f); - ddPush(); + dde.setTransform(bunny); + const bool wireframe = bx::mod(time, 2.0f) > 1.0f; + dde.setWireframe(wireframe); + dde.setColor(wireframe ? 0xffff00ff : 0xff00ff00); + dde.draw(m_bunny); + dde.setTransform(NULL); + } + dde.pop(); + + { + const float normal[] = { 0.0f, 1.0f, 0.0f }; + const float pos[] = { 0.0f, -2.0f, 0.0f }; + + Plane plane; + bx::calcPlane(&plane.m_normal.x, normal, pos); + + dde.setColor(false + || intersect(&dde, ray, plane) + ? selected + : 0xffffffff + ); + + dde.drawGrid(Axis::Y, pos, 20, 1.0f); + } + + dde.drawFrustum(mtxVp); + + dde.push(); Sphere sphere = { { 0.0f, 5.0f, 0.0f }, 1.0f }; - ddSetColor(intersect(ray, sphere) ? selected : 0xfff0c0ff); - ddSetWireframe(true); - ddSetLod(3); - ddDraw(sphere); - ddSetWireframe(false); + dde.setColor(intersect(&dde, ray, sphere) ? selected : 0xfff0c0ff); + dde.setWireframe(true); + dde.setLod(3); + dde.draw(sphere); + dde.setWireframe(false); - sphere.m_center[0] = -2.0f; - ddSetColor(intersect(ray, sphere) ? selected : 0xc0ffc0ff); - ddSetLod(2); - ddDraw(sphere); + sphere.m_center.x = -2.0f; + dde.setColor(intersect(&dde, ray, sphere) ? selected : 0xc0ffc0ff); + dde.setLod(2); + dde.draw(sphere); - sphere.m_center[0] = -4.0f; - ddSetColor(intersect(ray, sphere) ? selected : 0xa0f0ffff); - ddSetLod(1); - ddDraw(sphere); + sphere.m_center.x = -4.0f; + dde.setColor(intersect(&dde, ray, sphere) ? selected : 0xa0f0ffff); + dde.setLod(1); + dde.draw(sphere); - sphere.m_center[0] = -6.0f; - ddSetColor(intersect(ray, sphere) ? selected : 0xffc0ff00); - ddSetLod(0); - ddDraw(sphere); - ddPop(); + sphere.m_center.x = -6.0f; + dde.setColor(intersect(&dde, ray, sphere) ? selected : 0xffc0ff00); + dde.setLod(0); + dde.draw(sphere); + dde.pop(); - ddSetColor(0xffffffff); + dde.setColor(0xffffffff); - ddPush(); + dde.push(); { float normal[3] = { 0.0f, 0.0f, 1.0f }; float center[3] = { -8.0f, 0.0f, 0.0f }; - ddPush(); - ddSetStipple(true, 1.0f, time*0.1f); - ddSetColor(0xff0000ff); - ddDrawCircle(normal, center, 1.0f, 0.5f + bx::fsin(time*10.0f) ); - ddPop(); + dde.push(); + dde.setStipple(true, 1.0f, time*0.1f); + dde.setColor(0xff0000ff); + dde.drawCircle(normal, center, 1.0f, 0.5f + bx::sin(time*10.0f) ); + dde.pop(); - ddSetSpin(time); - ddDrawQuad(m_sprite, normal, center, 2.0f); + dde.setSpin(time); + dde.drawQuad(m_sprite, normal, center, 2.0f); } - ddPop(); + dde.pop(); - ddPush(); - ddSetStipple(true, 1.0f, -time*0.1f); - ddDrawCircle(Axis::Z, -8.0f, 0.0f, 0.0f, 1.25f, 2.0f); - ddPop(); + dde.push(); + dde.setStipple(true, 1.0f, -time*0.1f); + dde.drawCircle(Axis::Z, -8.0f, 0.0f, 0.0f, 1.25f, 2.0f); + dde.pop(); - ddPush(); - ddSetLod(UINT8_MAX); + dde.push(); + dde.setLod(UINT8_MAX); - ddPush(); - ddSetSpin(time*0.3f); + dde.push(); + dde.setSpin(time*0.3f); { Cone cone = { @@ -302,32 +778,32 @@ public: 0.5f }; - ddSetColor(false - || intersect(ray, cone) - || intersect(ray, cylinder) + dde.setColor(false + || intersect(&dde, ray, cone) + || intersect(&dde, ray, cylinder) ? selected : 0xffffffff ); - ddDraw(cone); - ddDraw(cylinder); + dde.draw(cone); + dde.draw(cylinder); } - ddPop(); + dde.pop(); { - ddSetLod(0); + dde.setLod(0); Capsule capsule = { { 0.0f, 7.0f, 0.0f }, { -6.0f, 7.0f, 0.0f }, 0.5f }; - ddSetColor(intersect(ray, capsule) ? selected : 0xffffffff); - ddDraw(capsule); + dde.setColor(intersect(&dde, ray, capsule) ? selected : 0xffffffff); + dde.draw(capsule); } - ddPop(); + dde.pop(); - ddPush(); + dde.push(); float mtx[16]; bx::mtxSRT(mtx @@ -344,22 +820,22 @@ public: }; float up[3] = { 0.0f, 4.0f, 0.0f }; - bx::vec3MulMtx(cylinder.m_end, up, mtx); - ddSetColor(intersect(ray, cylinder) ? selected : 0xffffffff); - ddDraw(cylinder); + bx::vec3MulMtx(&cylinder.m_end.x, up, mtx); + dde.setColor(intersect(&dde, ray, cylinder) ? selected : 0xffffffff); + dde.draw(cylinder); - ddPush(); + dde.push(); toAabb(aabb, cylinder); - ddSetWireframe(true); - ddSetColor(0xff0000ff); - ddDraw(aabb); - ddPop(); + dde.setWireframe(true); + dde.setColor(0xff0000ff); + dde.draw(aabb); + dde.pop(); - ddPop(); + dde.pop(); - ddDrawOrb(-11.0f, 0.0f, 0.0f, 1.0f); + dde.drawOrb(-11.0f, 0.0f, 0.0f, 1.0f); - ddEnd(); + dde.end(); // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. @@ -372,7 +848,9 @@ public: } entry::MouseState m_mouseState; - SpriteHandle m_sprite; + + SpriteHandle m_sprite; + GeometryHandle m_bunny; int64_t m_timeOffset; diff --git a/3rdparty/bgfx/examples/30-picking/fs_picking_id.sc b/3rdparty/bgfx/examples/30-picking/fs_picking_id.sc index d44277909d4..603eab3019d 100644 --- a/3rdparty/bgfx/examples/30-picking/fs_picking_id.sc +++ b/3rdparty/bgfx/examples/30-picking/fs_picking_id.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/30-picking/fs_picking_shaded.sc b/3rdparty/bgfx/examples/30-picking/fs_picking_shaded.sc index 8109c85a19b..7939b6ab9a1 100644 --- a/3rdparty/bgfx/examples/30-picking/fs_picking_shaded.sc +++ b/3rdparty/bgfx/examples/30-picking/fs_picking_shaded.sc @@ -1,7 +1,7 @@ $input v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/30-picking/makefile b/3rdparty/bgfx/examples/30-picking/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/30-picking/makefile +++ b/3rdparty/bgfx/examples/30-picking/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/30-picking/picking.cpp b/3rdparty/bgfx/examples/30-picking/picking.cpp index 22e4af9bb00..7847e1ba406 100644 --- a/3rdparty/bgfx/examples/30-picking/picking.cpp +++ b/3rdparty/bgfx/examples/30-picking/picking.cpp @@ -35,9 +35,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -114,19 +118,19 @@ public: // Set up ID buffer, which has a color target and depth buffer m_pickingRT = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::RGBA8, 0 | BGFX_TEXTURE_RT - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ); m_pickingRTDepth = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::D24S8, 0 | BGFX_TEXTURE_RT - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ); // CPU texture for blitting to and reading ID buffer so we can see what was clicked on. @@ -136,11 +140,11 @@ public: m_blitTex = bgfx::createTexture2D(ID_DIM, ID_DIM, false, 1, bgfx::TextureFormat::RGBA8, 0 | BGFX_TEXTURE_BLIT_DST | BGFX_TEXTURE_READ_BACK - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ); bgfx::TextureHandle rt[2] = @@ -208,13 +212,16 @@ public: if (blitSupport) { ImGui::SetNextWindowPos( - ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 2.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 2.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::Image(m_pickingRT, ImVec2(m_width / 5.0f - 16.0f, m_width / 5.0f - 16.0f) ); @@ -231,13 +238,14 @@ public: const float camSpeed = 0.25; float cameraSpin = (float)m_cameraSpin; float eyeDist = 2.5f; - float eye[3] = + + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { - -eyeDist * bx::fsin(time*cameraSpin*camSpeed), + -eyeDist * bx::sin(time*cameraSpin*camSpeed), 0.0f, - -eyeDist * bx::fcos(time*cameraSpin*camSpeed), + -eyeDist * bx::cos(time*cameraSpin*camSpeed), }; - float at[3] = { 0.0f, 0.0f, 0.0f }; float view[16]; bx::mtxLookAt(view, eye, at); @@ -270,7 +278,7 @@ public: // Look at our unprojected point float pickView[16]; - bx::mtxLookAt(pickView, pickEye, pickAt); + bx::mtxLookAt(pickView, bx::load(pickEye), bx::load(pickAt) ); // Tight FOV is best for picking float pickProj[16]; diff --git a/3rdparty/bgfx/examples/30-picking/vs_picking_shaded.sc b/3rdparty/bgfx/examples/30-picking/vs_picking_shaded.sc index 0e295689c49..fb54484949d 100644 --- a/3rdparty/bgfx/examples/30-picking/vs_picking_shaded.sc +++ b/3rdparty/bgfx/examples/30-picking/vs_picking_shaded.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_pos, v_view, v_normal, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/31-rsm/makefile b/3rdparty/bgfx/examples/31-rsm/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/31-rsm/makefile +++ b/3rdparty/bgfx/examples/31-rsm/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp b/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp index 3d292ec4454..8a0ca30a2d7 100644 --- a/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp +++ b/3rdparty/bgfx/examples/31-rsm/reflectiveshadowmap.cpp @@ -208,9 +208,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -298,36 +302,36 @@ public: // Light sphere m_lightSphere = meshLoad("meshes/unit_sphere.bin"); - const uint32_t samplerFlags = 0 + const uint64_t tsFlags = 0 | BGFX_TEXTURE_RT - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ; // Make gbuffer and related textures - m_gbufferTex[GBUFFER_RT_NORMAL] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); - m_gbufferTex[GBUFFER_RT_COLOR] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); - m_gbufferTex[GBUFFER_RT_DEPTH] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::D24, samplerFlags); + m_gbufferTex[GBUFFER_RT_NORMAL] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, tsFlags); + m_gbufferTex[GBUFFER_RT_COLOR] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, tsFlags); + m_gbufferTex[GBUFFER_RT_DEPTH] = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::D24, tsFlags); m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_gbufferTex), m_gbufferTex, true); // Make light buffer - m_lightBufferTex = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, samplerFlags); + m_lightBufferTex = bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::BGRA8, tsFlags); bgfx::TextureHandle lightBufferRTs[] = { m_lightBufferTex }; m_lightBuffer = bgfx::createFrameBuffer(BX_COUNTOF(lightBufferRTs), lightBufferRTs, true); // Make shadow buffer - const uint32_t rsmFlags = 0 + const uint64_t rsmFlags = 0 | BGFX_TEXTURE_RT - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP ; // Reflective shadow map @@ -336,8 +340,8 @@ public: , SHADOW_MAP_DIM , false , 1 - , bgfx::TextureFormat::BGRA8, - rsmFlags + , bgfx::TextureFormat::BGRA8 + , rsmFlags ); // Typical shadow map @@ -346,12 +350,12 @@ public: , SHADOW_MAP_DIM , false , 1 - , bgfx::TextureFormat::D16, - BGFX_TEXTURE_RT/* | BGFX_TEXTURE_COMPARE_LEQUAL*/ + , bgfx::TextureFormat::D16 + , BGFX_TEXTURE_RT /* | BGFX_TEXTURE_COMPARE_LEQUAL*/ ); // Note I'm not setting BGFX_TEXTURE_COMPARE_LEQUAL. Why? - // Normally a PCF shadow map such as this requires a compare. However, this sample also - // reads from this texture in the lighting pass, and only uses the PCF capabilites in the - // combine pass, so the flag is disabled by default. + // Normally a PCF shadow map such as this requires a compare. However, this sample also + // reads from this texture in the lighting pass, and only uses the PCF capabilites in the + // combine pass, so the flag is disabled by default. m_shadowBuffer = bgfx::createFrameBuffer(BX_COUNTOF(m_shadowBufferTex), m_shadowBufferTex, true); @@ -472,7 +476,7 @@ public: lightAt[1] = 0.0f; lightAt[2] = 0.0f; - bx::mtxLookAt(smView, lightEye, lightAt); + bx::mtxLookAt(smView, bx::load(lightEye), bx::load(lightAt) ); const float area = 10.0f; const bgfx::Caps* caps = bgfx::getCaps(); bx::mtxOrtho(smProj, -area, area, -area, area, -100.0f, 100.0f, 0.0f, caps->homogeneousDepth); @@ -525,9 +529,9 @@ public: bgfx::setUniform(u_sphereInfo, sphereInfo); const uint64_t lightDrawState = 0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_ADD // <=== Overlapping lights contribute more - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_A | BGFX_STATE_CULL_CW // <=== If we go into the lights, there will be problems, so we draw the far back face. ; @@ -549,7 +553,7 @@ public: bgfx::setTexture(2, s_light, bgfx::getTexture(m_lightBuffer, 0) ); bgfx::setTexture(3, s_depth, bgfx::getTexture(m_gbuffer, GBUFFER_RT_DEPTH) ); bgfx::setTexture(4, s_shadowMap, bgfx::getTexture(m_shadowBuffer, SHADOW_RT_DEPTH) - , BGFX_TEXTURE_COMPARE_LEQUAL + , BGFX_SAMPLER_COMPARE_LEQUAL ); // Uniforms for combine pass @@ -565,8 +569,8 @@ public: // Set up state for combine pass // point of this is to avoid doing depth test, which is in the default state bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A ); // Set up transform matrix for fullscreen quad @@ -593,12 +597,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 3.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 3.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::SliderFloat("RSM Amount", &m_rsmAmount, 0.0f, 0.7f); @@ -673,9 +680,9 @@ public: { float el = m_lightElevation * (bx::kPi/180.0f); float az = m_lightAzimuth * (bx::kPi/180.0f); - m_lightDir[0] = bx::fcos(el)*bx::fcos(az); - m_lightDir[2] = bx::fcos(el)*bx::fsin(az); - m_lightDir[1] = bx::fsin(el); + m_lightDir[0] = bx::cos(el)*bx::cos(az); + m_lightDir[2] = bx::cos(el)*bx::sin(az); + m_lightDir[1] = bx::sin(el); m_lightDir[3] = 0.0f; } diff --git a/3rdparty/bgfx/examples/32-particles/particles.cpp b/3rdparty/bgfx/examples/32-particles/particles.cpp index c89e23f3259..4736a5da095 100644 --- a/3rdparty/bgfx/examples/32-particles/particles.cpp +++ b/3rdparty/bgfx/examples/32-particles/particles.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -207,11 +207,9 @@ struct Emitter void gizmo(const float* _view, const float* _proj) { float mtx[16]; - bx::mtxSRT(mtx - , 1.0f, 1.0f, 1.0f - , m_uniforms.m_angle[0], m_uniforms.m_angle[1], m_uniforms.m_angle[2] - , m_uniforms.m_position[0], m_uniforms.m_position[1], m_uniforms.m_position[2] - ); + float scale[3] = { 1.0f, 1.0f, 1.0f }; + + ImGuizmo::RecomposeMatrixFromComponents(m_uniforms.m_position, m_uniforms.m_angle, scale, mtx); ImGuiIO& io = ImGui::GetIO(); ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y); @@ -224,7 +222,6 @@ struct Emitter , mtx ); - float scale[3]; ImGuizmo::DecomposeMatrixToComponents(mtx, m_uniforms.m_position, m_uniforms.m_angle, scale); } }; @@ -246,8 +243,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -340,16 +342,6 @@ public: float proj[16]; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float eye[3]; - cameraGetPosition(eye); - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { bx::mtxProj(proj, 60.0f, float(m_width)/float(m_height), 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); @@ -372,12 +364,14 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 4.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 4.0f, m_height - 20.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 4.0f, m_height - 20.0f) - , ImGuiWindowFlags_AlwaysAutoResize ); static float timeScale = 1.0f; @@ -410,10 +404,11 @@ public: imguiEndFrame(); - ddBegin(0); + DebugDrawEncoder dde; + dde.begin(0); float center[3] = { 0.0f, 0.0f, 0.0f }; - ddDrawGrid(Axis::Y, center); + dde.drawGrid(Axis::Y, center); float eye[3]; cameraGetPosition(eye); @@ -421,17 +416,20 @@ public: m_emitter[currentEmitter].update(); psUpdate(deltaTime * timeScale); - psRender(0, view, eye); + psRender(0, view, bx::load(eye) ); if (showBounds) { Aabb aabb; psGetAabb(m_emitter[currentEmitter].m_handle, aabb); - ddSetColor(0xff0000ff); - ddDraw(aabb); + dde.push(); + dde.setWireframe(true); + dde.setColor(0xff0000ff); + dde.draw(aabb); + dde.pop(); } - ddEnd(); + dde.end(); // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. diff --git a/3rdparty/bgfx/examples/33-pom/makefile b/3rdparty/bgfx/examples/33-pom/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/33-pom/makefile +++ b/3rdparty/bgfx/examples/33-pom/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/33-pom/pom.cpp b/3rdparty/bgfx/examples/33-pom/pom.cpp index 363a5974534..4148c32129d 100644 --- a/3rdparty/bgfx/examples/33-pom/pom.cpp +++ b/3rdparty/bgfx/examples/33-pom/pom.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -125,8 +125,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -220,24 +225,10 @@ public: float time = (float)( (now-m_timeOffset)/freq); - float at[3] = { 0.0f, 0.0f, 1.0f }; - float eye[3] = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 1.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, 0.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -265,12 +256,15 @@ public: ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 2.0f) + , ImGuiCond_FirstUseEver ); ImGui::Begin("Settings" , NULL - , ImVec2(m_width / 5.0f, m_height / 2.0f) - , ImGuiWindowFlags_AlwaysAutoResize + , 0 ); ImGui::RadioButton("No bump mapping", &m_shading_type, 0); @@ -342,9 +336,9 @@ public: // Set render states. bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_MSAA ); diff --git a/3rdparty/bgfx/examples/34-mvs/mvs.cpp b/3rdparty/bgfx/examples/34-mvs/mvs.cpp index 561923396ef..87144356f8f 100644 --- a/3rdparty/bgfx/examples/34-mvs/mvs.cpp +++ b/3rdparty/bgfx/examples/34-mvs/mvs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -121,8 +121,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -202,24 +207,10 @@ public: float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) ); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); diff --git a/3rdparty/bgfx/examples/35-dynamic/dynamic.cpp b/3rdparty/bgfx/examples/35-dynamic/dynamic.cpp index 1823721aafc..0bcbf110257 100644 --- a/3rdparty/bgfx/examples/35-dynamic/dynamic.cpp +++ b/3rdparty/bgfx/examples/35-dynamic/dynamic.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -99,8 +99,13 @@ public: m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable debug text. bgfx::setDebug(m_debug); @@ -185,24 +190,10 @@ public: float time = (float)( (bx::getHPCounter()-m_timeOffset)/double(bx::getHPFrequency() ) ); - float at[3] = { 0.0f, 0.0f, 0.0f }; - float eye[3] = { 0.0f, 0.0f, -35.0f }; + const bx::Vec3 at = { 0.0f, 0.0f, 0.0f }; + const bx::Vec3 eye = { 0.0f, 0.0f, -35.0f }; // Set view and projection matrix for view 0. - const bgfx::HMD* hmd = bgfx::getHMD(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float view[16]; - bx::mtxQuatTranslationHMD(view, hmd->eye[0].rotation, eye); - bgfx::setViewTransform(0, view, hmd->eye[0].projection, BGFX_VIEW_STEREO, hmd->eye[1].projection); - - // Set view 0 default viewport. - // - // Use HMD's width/height since HMD's internal frame buffer size - // might be much larger than window size. - bgfx::setViewRect(0, 0, 0, hmd->width, hmd->height); - } - else { float view[16]; bx::mtxLookAt(view, eye, at); @@ -234,7 +225,7 @@ public: } uint32_t idx = m_mwc.gen() % (kDimWidth*kDimHeight); - bgfx::updateDynamicVertexBuffer(m_vbh[idx], 0, mem); + bgfx::update(m_vbh[idx], 0, mem); } // Submit 11x11 cubes. diff --git a/3rdparty/bgfx/examples/36-sky/makefile b/3rdparty/bgfx/examples/36-sky/makefile index 94d3aae708a..171709170a4 100644 --- a/3rdparty/bgfx/examples/36-sky/makefile +++ b/3rdparty/bgfx/examples/36-sky/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/36-sky/sky.cpp b/3rdparty/bgfx/examples/36-sky/sky.cpp index f6b7983eed4..f529e0eb8a1 100644 --- a/3rdparty/bgfx/examples/36-sky/sky.cpp +++ b/3rdparty/bgfx/examples/36-sky/sky.cpp @@ -60,39 +60,23 @@ namespace { // Represents color. Color-space depends on context. // In the code below, used to represent color in XYZ, and RGB color-space - union Color - { - struct { - float X; - float Y; - float Z; - }; - struct { - float r; - float g; - float b; - }; - - float data[3]; - }; - + typedef bx::Vec3 Color; // HDTV rec. 709 matrix. static float M_XYZ2RGB[] = { - 3.240479f, -0.969256f, 0.055648f, - -1.53715f, 1.875991f, -0.204043f, - -0.49853f, 0.041556f, 1.057311f + 3.240479f, -0.969256f, 0.055648f, + -1.53715f, 1.875991f, -0.204043f, + -0.49853f, 0.041556f, 1.057311f, }; - // Converts color repesentation from CIE XYZ to RGB color-space. - Color XYZToRGB(const Color& xyz) + Color xyzToRgb(const Color& xyz) { Color rgb; - rgb.r = M_XYZ2RGB[0] * xyz.X + M_XYZ2RGB[3] * xyz.Y + M_XYZ2RGB[6] * xyz.Z; - rgb.g = M_XYZ2RGB[1] * xyz.X + M_XYZ2RGB[4] * xyz.Y + M_XYZ2RGB[7] * xyz.Z; - rgb.b = M_XYZ2RGB[2] * xyz.X + M_XYZ2RGB[5] * xyz.Y + M_XYZ2RGB[8] * xyz.Z; + rgb.x = M_XYZ2RGB[0] * xyz.x + M_XYZ2RGB[3] * xyz.y + M_XYZ2RGB[6] * xyz.z; + rgb.y = M_XYZ2RGB[1] * xyz.x + M_XYZ2RGB[4] * xyz.y + M_XYZ2RGB[7] * xyz.z; + rgb.z = M_XYZ2RGB[2] * xyz.x + M_XYZ2RGB[5] * xyz.y + M_XYZ2RGB[8] * xyz.z; return rgb; }; @@ -101,20 +85,20 @@ namespace // Computed using code from Game Engine Gems, Volume One, chapter 15. Implementation based on Dr. Richard Bird model. // This table is used for piecewise linear interpolation. Transitions from and to 0.0 at sunset and sunrise are highly inaccurate static std::map sunLuminanceXYZTable = { - { 5.0f, {{ 0.000000f, 0.000000f, 0.000000f }} }, - { 7.0f, {{ 12.703322f, 12.989393f, 9.100411f }} }, - { 8.0f, {{ 13.202644f, 13.597814f, 11.524929f }} }, - { 9.0f, {{ 13.192974f, 13.597458f, 12.264488f }} }, - { 10.0f, {{ 13.132943f, 13.535914f, 12.560032f }} }, - { 11.0f, {{ 13.088722f, 13.489535f, 12.692996f }} }, - { 12.0f, {{ 13.067827f, 13.467483f, 12.745179f }} }, - { 13.0f, {{ 13.069653f, 13.469413f, 12.740822f }} }, - { 14.0f, {{ 13.094319f, 13.495428f, 12.678066f }} }, - { 15.0f, {{ 13.142133f, 13.545483f, 12.526785f }} }, - { 16.0f, {{ 13.201734f, 13.606017f, 12.188001f }} }, - { 17.0f, {{ 13.182774f, 13.572725f, 11.311157f }} }, - { 18.0f, {{ 12.448635f, 12.672520f, 8.267771f }} }, - { 20.0f, {{ 0.000000f, 0.000000f, 0.000000f }} } + { 5.0f, { 0.000000f, 0.000000f, 0.000000f } }, + { 7.0f, { 12.703322f, 12.989393f, 9.100411f } }, + { 8.0f, { 13.202644f, 13.597814f, 11.524929f } }, + { 9.0f, { 13.192974f, 13.597458f, 12.264488f } }, + { 10.0f, { 13.132943f, 13.535914f, 12.560032f } }, + { 11.0f, { 13.088722f, 13.489535f, 12.692996f } }, + { 12.0f, { 13.067827f, 13.467483f, 12.745179f } }, + { 13.0f, { 13.069653f, 13.469413f, 12.740822f } }, + { 14.0f, { 13.094319f, 13.495428f, 12.678066f } }, + { 15.0f, { 13.142133f, 13.545483f, 12.526785f } }, + { 16.0f, { 13.201734f, 13.606017f, 12.188001f } }, + { 17.0f, { 13.182774f, 13.572725f, 11.311157f } }, + { 18.0f, { 12.448635f, 12.672520f, 8.267771f } }, + { 20.0f, { 0.000000f, 0.000000f, 0.000000f } }, }; @@ -124,28 +108,28 @@ namespace // The scale of luminance change in Day/night transitions is not preserved. // Luminance at night was increased to eliminate need the of HDR render. static std::map skyLuminanceXYZTable = { - { 0.0f, {{ 0.308f, 0.308f, 0.411f }} }, - { 1.0f, {{ 0.308f, 0.308f, 0.410f }} }, - { 2.0f, {{ 0.301f, 0.301f, 0.402f }} }, - { 3.0f, {{ 0.287f, 0.287f, 0.382f }} }, - { 4.0f, {{ 0.258f, 0.258f, 0.344f }} }, - { 5.0f, {{ 0.258f, 0.258f, 0.344f }} }, - { 7.0f, {{ 0.962851f, 1.000000f, 1.747835f }} }, - { 8.0f, {{ 0.967787f, 1.000000f, 1.776762f }} }, - { 9.0f, {{ 0.970173f, 1.000000f, 1.788413f }} }, - { 10.0f, {{ 0.971431f, 1.000000f, 1.794102f }} }, - { 11.0f, {{ 0.972099f, 1.000000f, 1.797096f }} }, - { 12.0f, {{ 0.972385f, 1.000000f, 1.798389f }} }, - { 13.0f, {{ 0.972361f, 1.000000f, 1.798278f }} }, - { 14.0f, {{ 0.972020f, 1.000000f, 1.796740f }} }, - { 15.0f, {{ 0.971275f, 1.000000f, 1.793407f }} }, - { 16.0f, {{ 0.969885f, 1.000000f, 1.787078f }} }, - { 17.0f, {{ 0.967216f, 1.000000f, 1.773758f }} }, - { 18.0f, {{ 0.961668f, 1.000000f, 1.739891f }} }, - { 20.0f, {{ 0.264f, 0.264f, 0.352f }} }, - { 21.0f, {{ 0.264f, 0.264f, 0.352f }} }, - { 22.0f, {{ 0.290f, 0.290f, 0.386f }} }, - { 23.0f, {{ 0.303f, 0.303f, 0.404f }} } + { 0.0f, { 0.308f, 0.308f, 0.411f } }, + { 1.0f, { 0.308f, 0.308f, 0.410f } }, + { 2.0f, { 0.301f, 0.301f, 0.402f } }, + { 3.0f, { 0.287f, 0.287f, 0.382f } }, + { 4.0f, { 0.258f, 0.258f, 0.344f } }, + { 5.0f, { 0.258f, 0.258f, 0.344f } }, + { 7.0f, { 0.962851f, 1.000000f, 1.747835f } }, + { 8.0f, { 0.967787f, 1.000000f, 1.776762f } }, + { 9.0f, { 0.970173f, 1.000000f, 1.788413f } }, + { 10.0f, { 0.971431f, 1.000000f, 1.794102f } }, + { 11.0f, { 0.972099f, 1.000000f, 1.797096f } }, + { 12.0f, { 0.972385f, 1.000000f, 1.798389f } }, + { 13.0f, { 0.972361f, 1.000000f, 1.798278f } }, + { 14.0f, { 0.972020f, 1.000000f, 1.796740f } }, + { 15.0f, { 0.971275f, 1.000000f, 1.793407f } }, + { 16.0f, { 0.969885f, 1.000000f, 1.787078f } }, + { 17.0f, { 0.967216f, 1.000000f, 1.773758f } }, + { 18.0f, { 0.961668f, 1.000000f, 1.739891f } }, + { 20.0f, { 0.264f, 0.264f, 0.352f } }, + { 21.0f, { 0.264f, 0.264f, 0.352f } }, + { 22.0f, { 0.290f, 0.290f, 0.386f } }, + { 23.0f, { 0.303f, 0.303f, 0.404f } }, }; @@ -154,19 +138,19 @@ namespace // Coefficients correspond to xyY colorspace. static Color ABCDE[] = { - {{ -0.2592f, -0.2608f, -1.4630f }}, - {{ 0.0008f, 0.0092f, 0.4275f }}, - {{ 0.2125f, 0.2102f, 5.3251f }}, - {{ -0.8989f, -1.6537f, -2.5771f }}, - {{ 0.0452f, 0.0529f, 0.3703f }} + { -0.2592f, -0.2608f, -1.4630f }, + { 0.0008f, 0.0092f, 0.4275f }, + { 0.2125f, 0.2102f, 5.3251f }, + { -0.8989f, -1.6537f, -2.5771f }, + { 0.0452f, 0.0529f, 0.3703f }, }; static Color ABCDE_t[] = { - {{ -0.0193f, -0.0167f, 0.1787f }}, - {{ -0.0665f, -0.0950f, -0.3554f }}, - {{ -0.0004f, -0.0079f, -0.0227f }}, - {{ -0.0641f, -0.0441f, 0.1206f }}, - {{ -0.0033f, -0.0109f, -0.0670f }} + { -0.0193f, -0.0167f, 0.1787f }, + { -0.0665f, -0.0950f, -0.3554f }, + { -0.0004f, -0.0079f, -0.0227f }, + { -0.0641f, -0.0441f, 0.1206f }, + { -0.0033f, -0.0109f, -0.0670f }, }; @@ -175,9 +159,15 @@ namespace { typedef Color ValueType; typedef std::map KeyMap; + public: - DynamicValueController() {}; - ~DynamicValueController() {}; + DynamicValueController() + { + } + + ~DynamicValueController() + { + } void SetMap(const KeyMap& keymap) { @@ -189,22 +179,27 @@ namespace typename KeyMap::const_iterator itUpper = m_keyMap.upper_bound(time + 1e-6f); typename KeyMap::const_iterator itLower = itUpper; --itLower; + if (itLower == m_keyMap.end()) { return itUpper->second; } + if (itUpper == m_keyMap.end()) { return itLower->second; } + float lowerTime = itLower->first; const ValueType& lowerVal = itLower->second; float upperTime = itUpper->first; const ValueType& upperVal = itUpper->second; + if (lowerTime == upperTime) { return lowerVal; } + return interpolate(lowerTime, lowerVal, upperTime, upperVal, time); }; @@ -214,18 +209,16 @@ namespace }; private: - const ValueType interpolate(float lowerTime, const ValueType& lowerVal, float upperTime, const ValueType& upperVal, float time) const + ValueType interpolate(float lowerTime, const ValueType& lowerVal, float upperTime, const ValueType& upperVal, float time) const { - float x = (time - lowerTime) / (upperTime - lowerTime); - ValueType result; - bx::vec3Lerp(result.data, lowerVal.data, upperVal.data, x); + const float tt = (time - lowerTime) / (upperTime - lowerTime); + const ValueType result = bx::lerp(lowerVal, upperVal, tt); return result; }; KeyMap m_keyMap; }; - // Controls sun position according to time, month, and observer's latitude. // Sun position computation based on Earth's orbital elements: https://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html class SunController @@ -247,11 +240,11 @@ namespace December }; - SunController(): - m_latitude(50.0f), - m_month(June), - m_eclipticObliquity(bx::toRad(23.4f)), - m_delta(0.0f) + SunController() + : m_latitude(50.0f) + , m_month(June) + , m_eclipticObliquity(bx::toRad(23.4f) ) + , m_delta(0.0f) { m_northDirection[0] = 1.0; m_northDirection[1] = 0.0; @@ -261,10 +254,10 @@ namespace m_upvector[2] = 0.0f; } - void Update(float time) + void Update(float _time) { CalculateSunOrbit(); - UpdateSunPosition(time - 12.0f); + UpdateSunPosition(_time - 12.0f); } float m_northDirection[3]; @@ -278,26 +271,29 @@ namespace { float day = 30.0f * m_month + 15.0f; float lambda = 280.46f + 0.9856474f * day; - lambda = bx::toRad(lambda); - m_delta = bx::fasin(bx::fsin(m_eclipticObliquity) * bx::fsin(lambda)); + lambda = bx::toRad(lambda); + m_delta = bx::asin(bx::sin(m_eclipticObliquity) * bx::sin(lambda) ); } - void UpdateSunPosition(float hour) + void UpdateSunPosition(float _hour) { float latitude = bx::toRad(m_latitude); - float h = hour * bx::kPi / 12.0f; - float azimuth = bx::fatan2( - bx::fsin(h), - bx::fcos(h) * bx::fsin(latitude) - bx::ftan(m_delta) * bx::fcos(latitude) - ); + float hh = _hour * bx::kPi / 12.0f; + float azimuth = bx::atan2( + bx::sin(hh) + , bx::cos(hh) * bx::sin(latitude) - bx::tan(m_delta) * bx::cos(latitude) + ); + + float altitude = bx::asin( + bx::sin(latitude) * bx::sin(m_delta) + bx::cos(latitude) * bx::cos(m_delta) * bx::cos(hh) + ); - float altitude = bx::fasin( - bx::fsin(latitude) * bx::fsin(m_delta) + bx::fcos(latitude) * bx::fcos(m_delta) * bx::fcos(h) - ); float rotation[4]; bx::quatRotateAxis(rotation, m_upvector, -azimuth); + float direction[3]; bx::vec3MulQuat(direction, m_northDirection, rotation); + float v[3]; bx::vec3Cross(v, m_upvector, direction); bx::quatRotateAxis(rotation, v, altitude); @@ -393,7 +389,7 @@ namespace void draw() { - bgfx::setState(BGFX_STATE_RGB_WRITE | BGFX_STATE_DEPTH_TEST_EQUAL); + bgfx::setState(BGFX_STATE_WRITE_RGB | BGFX_STATE_DEPTH_TEST_EQUAL); bgfx::setIndexBuffer(m_ibh); bgfx::setVertexBuffer(0, m_vbh); bgfx::submit(0, m_preventBanding ? m_skyProgram_colorBandingFix : m_skyProgram); @@ -423,8 +419,13 @@ namespace m_debug = BGFX_DEBUG_NONE; m_reset = BGFX_RESET_VSYNC; - bgfx::init(args.m_type, args.m_pciId); - bgfx::reset(m_width, m_height, m_reset); + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); // Enable m_debug text. bgfx::setDebug(m_debug); @@ -544,25 +545,25 @@ namespace const double freq = double(bx::getHPFrequency()); const float deltaTime = float(frameTime / freq); m_time += m_timeScale * deltaTime; - m_time = bx::fmod(m_time, 24.0f); + m_time = bx::mod(m_time, 24.0f); m_sun.Update(m_time); imguiBeginFrame(m_mouseState.m_mx , m_mouseState.m_my - , (m_mouseState.m_buttons[entry::MouseButton::Left] ? IMGUI_MBUT_LEFT : 0) - | (m_mouseState.m_buttons[entry::MouseButton::Right] ? IMGUI_MBUT_RIGHT : 0) + , (m_mouseState.m_buttons[entry::MouseButton::Left] ? IMGUI_MBUT_LEFT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Right] ? IMGUI_MBUT_RIGHT : 0) | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , m_mouseState.m_mz , uint16_t(m_width) , uint16_t(m_height) - ); + ); showExampleDialog(this); ImGui::SetNextWindowPos( ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) - , ImGuiSetCond_FirstUseEver - ); + , ImGuiCond_FirstUseEver + ); imgui(m_width / 5.0f - 10.0f); @@ -586,14 +587,14 @@ namespace bgfx::setViewTransform(0, view, proj); Color sunLuminanceXYZ = m_sunLuminanceXYZ.GetValue(m_time); - Color sunLuminanceRGB = XYZToRGB(sunLuminanceXYZ); + Color sunLuminanceRGB = xyzToRgb(sunLuminanceXYZ); Color skyLuminanceXYZ = m_skyLuminanceXYZ.GetValue(m_time); - Color skyLuminanceRGB = XYZToRGB(skyLuminanceXYZ); + Color skyLuminanceRGB = xyzToRgb(skyLuminanceXYZ); - bgfx::setUniform(u_sunLuminance, sunLuminanceRGB.data); - bgfx::setUniform(u_skyLuminanceXYZ, skyLuminanceXYZ.data); - bgfx::setUniform(u_skyLuminance, skyLuminanceRGB.data); + bgfx::setUniform(u_sunLuminance, &sunLuminanceRGB.x); + bgfx::setUniform(u_skyLuminanceXYZ, &skyLuminanceXYZ.x); + bgfx::setUniform(u_skyLuminance, &skyLuminanceRGB.x); bgfx::setUniform(u_sunDirection, m_sun.m_sunDirection); @@ -617,14 +618,15 @@ namespace return false; } - void computePerezCoeff(float turbidity, float* perezCoeff) + void computePerezCoeff(float _turbidity, float* _outPerezCoeff) { - for (int i = 0; i < 5; ++i) + const bx::Vec3 turbidity = { _turbidity, _turbidity, _turbidity }; + for (uint32_t ii = 0; ii < 5; ++ii) { - Color tmp; - bx::vec3Mul(tmp.data, ABCDE_t[i].data, turbidity); - bx::vec3Add(perezCoeff + 4 * i, tmp.data, ABCDE[i].data); - perezCoeff[4 * i + 3] = 0.0f; + const bx::Vec3 tmp = bx::mad(ABCDE_t[ii], turbidity, ABCDE[ii]); + float* out = _outPerezCoeff + 4 * ii; + bx::store(out, tmp); + out[3] = 0.0f; } } diff --git a/3rdparty/bgfx/examples/36-sky/vs_sky_landscape.sc b/3rdparty/bgfx/examples/36-sky/vs_sky_landscape.sc index 57f6c35faa2..8fe13cc33bb 100644 --- a/3rdparty/bgfx/examples/36-sky/vs_sky_landscape.sc +++ b/3rdparty/bgfx/examples/36-sky/vs_sky_landscape.sc @@ -2,7 +2,7 @@ $input a_position, a_normal, a_texcoord0 $output v_normal, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_downscale_hi_z.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_downscale_hi_z.sc new file mode 100644 index 00000000000..aecd7e416ee --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_downscale_hi_z.sc @@ -0,0 +1,47 @@ +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_compute.sh" + +IMAGE2D_RO(s_texOcclusionDepthIn, r32f, 0); +IMAGE2D_WR(s_texOcclusionDepthOut, r32f, 1); + +uniform vec4 u_inputRTSize; + +NUM_THREADS(16, 16, 1) +void main() +{ + // this shader can be used to both copy a mip over to the output and downscale it. + + ivec2 coord = ivec2(gl_GlobalInvocationID.xy); + + if (all(lessThan(coord.xy, u_inputRTSize.xy) ) ) + { + float maxDepth = 1.0; + + if (u_inputRTSize.z > 1) + { + vec4 depths = vec4( + imageLoad(s_texOcclusionDepthIn, ivec2(u_inputRTSize.zw * coord.xy ) ).x + , imageLoad(s_texOcclusionDepthIn, ivec2(u_inputRTSize.zw * coord.xy + ivec2(1.0, 0.0) ) ).x + , imageLoad(s_texOcclusionDepthIn, ivec2(u_inputRTSize.zw * coord.xy + ivec2(0.0, 1.0) ) ).x + , imageLoad(s_texOcclusionDepthIn, ivec2(u_inputRTSize.zw * coord.xy + ivec2(1.0, 1.0) ) ).x + ); + + // find and return max depth + maxDepth = max( + max(depths.x, depths.y) + , max(depths.z, depths.w) + ); + } + else + { + // do not downscale, just copy the value over to the output rendertarget + maxDepth = imageLoad(s_texOcclusionDepthIn, coord.xy).x; + } + + imageStore(s_texOcclusionDepthOut, coord, vec4(maxDepth,0,0,1) ); + } +} diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_occlude_props.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_occlude_props.sc new file mode 100644 index 00000000000..aced7da3c44 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_occlude_props.sc @@ -0,0 +1,108 @@ +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_compute.sh" + +SAMPLER2D(s_texOcclusionDepth, 0); + +BUFFER_RO(instanceDataIn, vec4, 1); +BUFFER_RW(drawcallInstanceCount, uint, 2); +BUFFER_WR(instancePredicates, bool, 3); + +uniform vec4 u_inputRTSize; +uniform vec4 u_cullingConfig; + +NUM_THREADS(64, 1, 1) +void main() +{ + bool predicate = false; + + //make sure that we not processing more instances than available + if (gl_GlobalInvocationID.x < uint(u_cullingConfig.x) ) + { + //get the bounding box for this instance + vec4 bboxMin = instanceDataIn[2 * gl_GlobalInvocationID.x] ; + vec3 bboxMax = instanceDataIn[2 * gl_GlobalInvocationID.x + 1].xyz; + + int drawcallID = int(bboxMin.w); + + //Adapted from http://blog.selfshadow.com/publications/practical-visibility/ + vec3 bboxSize = bboxMax.xyz - bboxMin.xyz; + + vec3 boxCorners[] = { + bboxMin.xyz, + bboxMin.xyz + vec3(bboxSize.x,0,0), + bboxMin.xyz + vec3(0, bboxSize.y,0), + bboxMin.xyz + vec3(0, 0, bboxSize.z), + bboxMin.xyz + vec3(bboxSize.xy,0), + bboxMin.xyz + vec3(0, bboxSize.yz), + bboxMin.xyz + vec3(bboxSize.x, 0, bboxSize.z), + bboxMin.xyz + bboxSize.xyz + }; + float minZ = 1.0; + vec2 minXY = vec2(1.0, 1.0); + vec2 maxXY = vec2(0.0, 0.0); + + UNROLL + for (int i = 0; i < 8; i++) + { + //transform World space aaBox to NDC + vec4 clipPos = mul( u_viewProj, vec4(boxCorners[i], 1) ); + + clipPos.z = max(clipPos.z, 0); + + clipPos.xyz = clipPos.xyz / clipPos.w; + + clipPos.xy = clamp(clipPos.xy, -1, 1); + clipPos.xy = clipPos.xy * vec2(0.5, -0.5) + vec2(0.5, 0.5); + + minXY = min(clipPos.xy, minXY); + maxXY = max(clipPos.xy, maxXY); + + minZ = saturate(min(minZ, clipPos.z)); + } + + vec4 boxUVs = vec4(minXY, maxXY); + + // Calculate hi-Z buffer mip + ivec2 size = ivec2( (maxXY - minXY) * u_inputRTSize.xy); + float mip = ceil(log2(max(size.x, size.y))); + + mip = clamp(mip, 0, u_cullingConfig.z); + + // Texel footprint for the lower (finer-grained) level + float level_lower = max(mip - 1, 0); + vec2 scale = vec2_splat(exp2(-level_lower) ); + vec2 a = floor(boxUVs.xy*scale); + vec2 b = ceil(boxUVs.zw*scale); + vec2 dims = b - a; + + // Use the lower level if we only touch <= 2 texels in both dimensions + if (dims.x <= 2 && dims.y <= 2) + mip = level_lower; + + //load depths from high z buffer + vec4 depth = + { + texture2DLod(s_texOcclusionDepth, boxUVs.xy, mip).x, + texture2DLod(s_texOcclusionDepth, boxUVs.zy, mip).x, + texture2DLod(s_texOcclusionDepth, boxUVs.xw, mip).x, + texture2DLod(s_texOcclusionDepth, boxUVs.zw, mip).x, + }; + + //find the max depth + float maxDepth = max( max(depth.x, depth.y), max(depth.z, depth.w) ); + + if ( minZ <= maxDepth ) + { + predicate = true; + + //increase instance count for this particular prop type + atomicAdd(drawcallInstanceCount[ drawcallID ], 1); + } + } + + instancePredicates[gl_GlobalInvocationID.x] = predicate; +} diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_stream_compaction.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_stream_compaction.sc new file mode 100644 index 00000000000..3c35acdc7e8 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/cs_gdr_stream_compaction.sc @@ -0,0 +1,124 @@ +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_compute.sh" + +//the per drawcall data that is constant (noof indices and offsets to vertex/index buffers) +BUFFER_RO(drawcallConstData, uint, 0); +//instance data for all instances (pre culling) +BUFFER_RO(instanceDataIn, vec4, 1); +//per instance visibility (output of culling pass) +BUFFER_RO(instancePredicates, bool, 2); + +//how many instances per drawcall +BUFFER_RW(drawcallInstanceCount, uint, 3); +//drawcall data that will drive drawIndirect +BUFFER_RW(drawcallData, uvec4, 4); +//culled instance data +BUFFER_WR(instanceDataOut, vec4, 5); + +uniform vec4 u_cullingConfig; + +// Based on Parallel Prefix Sum (Scan) with CUDA by Mark Harris +SHARED uint temp[2048]; + +NUM_THREADS(1024, 1, 1) +void main() +{ + uint tID = gl_GlobalInvocationID.x; + int NoofInstancesPowOf2 = int(u_cullingConfig.y); + int NoofDrawcalls = int(u_cullingConfig.w); + + int offset = 1; + temp[2 * tID ] = uint(instancePredicates[2 * tID ]); // load input into shared memory + temp[2 * tID + 1] = uint(instancePredicates[2 * tID + 1]); + + int d; + + //perform reduction + for (d = NoofInstancesPowOf2 >> 1; d > 0; d >>= 1) + { + barrier(); + + if (tID < d) + { + int ai = int(offset * (2 * tID + 1) - 1); + int bi = int(offset * (2 * tID + 2) - 1); + temp[bi] += temp[ai]; + } + + offset *= 2; + } + + // clear the last element + if (tID == 0) + { + temp[NoofInstancesPowOf2 - 1] = 0; + } + + // perform downsweep and build scan + for ( d = 1; d < NoofInstancesPowOf2; d *= 2) + { + offset >>= 1; + + barrier(); + + if (tID < d) + { + int ai = int(offset * (2 * tID + 1) - 1); + int bi = int(offset * (2 * tID + 2) - 1); + int t = int(temp[ai]); + temp[ai] = temp[bi]; + temp[bi] += t; + } + } + + barrier(); + + int index = int(2 * tID); + + // scatter results + if (instancePredicates[index]) + { + instanceDataOut[4 * temp[index] ] = instanceDataIn[4 * index ]; + instanceDataOut[4 * temp[index] + 1] = instanceDataIn[4 * index + 1]; + instanceDataOut[4 * temp[index] + 2] = instanceDataIn[4 * index + 2]; + instanceDataOut[4 * temp[index] + 3] = instanceDataIn[4 * index + 3]; + } + + index = int(2 * tID + 1); + + if (instancePredicates[index]) + { + instanceDataOut[4 * temp[index] ] = instanceDataIn[4 * index ]; + instanceDataOut[4 * temp[index] + 1] = instanceDataIn[4 * index + 1]; + instanceDataOut[4 * temp[index] + 2] = instanceDataIn[4 * index + 2]; + instanceDataOut[4 * temp[index] + 3] = instanceDataIn[4 * index + 3]; + } + + if (tID == 0) + { + uint startInstance = 0; + + //copy data to indirect buffer, could possible be done in a different compute shader + for (int k = 0; k < NoofDrawcalls; k++) + { + drawIndexedIndirect( + drawcallData, + k, + drawcallConstData[ k * 3 ], //number of indices + drawcallInstanceCount[k], //number of instances + drawcallConstData[ k * 3 + 1 ], //offset into the index buffer + drawcallConstData[ k * 3 + 2 ], //offset into the vertex buffer + startInstance //offset into the instance buffer + ); + + startInstance += drawcallInstanceCount[k]; + + drawcallInstanceCount[k] = 0; + } + } + +} diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/fs_gdr_instanced_indirect_rendering.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/fs_gdr_instanced_indirect_rendering.sc new file mode 100644 index 00000000000..14f48499180 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/fs_gdr_instanced_indirect_rendering.sc @@ -0,0 +1,26 @@ +$input v_materialID + +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +uniform vec4 u_color[32]; + +void main() +{ + vec4 color = u_color[uint(v_materialID)]; + + if (color.w < 1.0f) + { + //render dithered alpha + if ( (int(gl_FragCoord.x) % 2) == (int(gl_FragCoord.y) % 2) ) + { + discard; + } + } + + gl_FragColor = vec4(color.xyz, 1.0); +} diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp b/3rdparty/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp new file mode 100644 index 00000000000..9a3bb3a6b6a --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/gpudrivenrendering.cpp @@ -0,0 +1,1224 @@ +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +/* + * Reference(s): + * - Experiments in GPU-based occlusion culling + * https://web.archive.org/web/20180920045301/https://interplayoflight.wordpress.com/2017/11/15/experiments-in-gpu-based-occlusion-culling/ + * - Experiments in GPU-based occlusion culling part 2: MultiDrawIndirect and mesh lodding + * https://web.archive.org/web/20180920045332/https://interplayoflight.wordpress.com/2018/01/15/experiments-in-gpu-based-occlusion-culling-part-2-multidrawindirect-and-mesh-lodding/ + */ + +#include "common.h" +#include "bgfx_utils.h" +#include "imgui/imgui.h" + +namespace +{ + +#define RENDER_PASS_HIZ_ID 0 +#define RENDER_PASS_HIZ_DOWNSCALE_ID 1 +#define RENDER_PASS_OCCLUDE_PROPS_ID 2 +#define RENDER_PASS_COMPACT_STREAM_ID 3 +#define RENDER_PASS_MAIN_ID 4 + +struct Camera +{ + Camera() + { + reset(); + } + + void reset() + { + m_target.curr[0] = 0.0f; + m_target.curr[1] = 0.0f; + m_target.curr[2] = 0.0f; + m_target.dest[0] = 0.0f; + m_target.dest[1] = 0.0f; + m_target.dest[2] = 0.0f; + + m_pos.curr[0] = 55.0f; + m_pos.curr[1] = 20.0f; + m_pos.curr[2] = 65.0f; + m_pos.dest[0] = 55.0f; + m_pos.dest[1] = 20.0f; + m_pos.dest[2] = 65.0f; + + m_orbit[0] = 0.0f; + m_orbit[1] = 0.0f; + } + + void mtxLookAt(float* _outViewMtx) + { + bx::mtxLookAt(_outViewMtx, bx::load(m_pos.curr), bx::load(m_target.curr) ); + } + + void orbit(float _dx, float _dy) + { + m_orbit[0] += _dx; + m_orbit[1] += _dy; + } + + void dolly(float _dz) + { + const float cnear = 1.0f; + const float cfar = 100.0f; + + const float toTarget[3] = + { + m_target.dest[0] - m_pos.dest[0], + m_target.dest[1] - m_pos.dest[1], + m_target.dest[2] - m_pos.dest[2], + }; + const float toTargetLen = bx::vec3Length(toTarget); + const float invToTargetLen = 1.0f / (toTargetLen + FLT_MIN); + const float toTargetNorm[3] = + { + toTarget[0] * invToTargetLen, + toTarget[1] * invToTargetLen, + toTarget[2] * invToTargetLen, + }; + + float delta = toTargetLen*_dz; + float newLen = toTargetLen + delta; + if ((cnear < newLen || _dz < 0.0f) + && (newLen < cfar || _dz > 0.0f)) + { + m_pos.dest[0] += toTargetNorm[0] * delta; + m_pos.dest[1] += toTargetNorm[1] * delta; + m_pos.dest[2] += toTargetNorm[2] * delta; + } + } + + void consumeOrbit(float _amount) + { + float consume[2]; + consume[0] = m_orbit[0] * _amount; + consume[1] = m_orbit[1] * _amount; + m_orbit[0] -= consume[0]; + m_orbit[1] -= consume[1]; + + const float toPos[3] = + { + m_pos.curr[0] - m_target.curr[0], + m_pos.curr[1] - m_target.curr[1], + m_pos.curr[2] - m_target.curr[2], + }; + const float toPosLen = bx::vec3Length(toPos); + const float invToPosLen = 1.0f / (toPosLen + FLT_MIN); + const float toPosNorm[3] = + { + toPos[0] * invToPosLen, + toPos[1] * invToPosLen, + toPos[2] * invToPosLen, + }; + + float ll[2]; + latLongFromVec(ll[0], ll[1], toPosNorm); + ll[0] += consume[0]; + ll[1] -= consume[1]; + ll[1] = bx::clamp(ll[1], 0.02f, 0.98f); + + float tmp[3]; + vecFromLatLong(tmp, ll[0], ll[1]); + + float diff[3]; + diff[0] = (tmp[0] - toPosNorm[0])*toPosLen; + diff[1] = (tmp[1] - toPosNorm[1])*toPosLen; + diff[2] = (tmp[2] - toPosNorm[2])*toPosLen; + + m_pos.curr[0] += diff[0]; + m_pos.curr[1] += diff[1]; + m_pos.curr[2] += diff[2]; + m_pos.dest[0] += diff[0]; + m_pos.dest[1] += diff[1]; + m_pos.dest[2] += diff[2]; + } + + void update(float _dt) + { + const float amount = bx::min(_dt / 0.12f, 1.0f); + + consumeOrbit(amount); + + m_target.curr[0] = bx::lerp(m_target.curr[0], m_target.dest[0], amount); + m_target.curr[1] = bx::lerp(m_target.curr[1], m_target.dest[1], amount); + m_target.curr[2] = bx::lerp(m_target.curr[2], m_target.dest[2], amount); + m_pos.curr[0] = bx::lerp(m_pos.curr[0], m_pos.dest[0], amount); + m_pos.curr[1] = bx::lerp(m_pos.curr[1], m_pos.dest[1], amount); + m_pos.curr[2] = bx::lerp(m_pos.curr[2], m_pos.dest[2], amount); + } + + void envViewMtx(float* _mtx) + { + const float toTarget[3] = + { + m_target.curr[0] - m_pos.curr[0], + m_target.curr[1] - m_pos.curr[1], + m_target.curr[2] - m_pos.curr[2], + }; + + const float toTargetLen = bx::vec3Length(toTarget); + const float invToTargetLen = 1.0f / (toTargetLen + FLT_MIN); + const float toTargetNorm[3] = + { + toTarget[0] * invToTargetLen, + toTarget[1] * invToTargetLen, + toTarget[2] * invToTargetLen, + }; + + float tmp[3]; + const float fakeUp[3] = { 0.0f, 1.0f, 0.0f }; + + float right[3]; + bx::vec3Cross(tmp, fakeUp, toTargetNorm); + bx::vec3Norm(right, tmp); + + float up[3]; + bx::vec3Cross(tmp, toTargetNorm, right); + bx::vec3Norm(up, tmp); + + _mtx[0] = right[0]; + _mtx[1] = right[1]; + _mtx[2] = right[2]; + _mtx[3] = 0.0f; + _mtx[4] = up[0]; + _mtx[5] = up[1]; + _mtx[6] = up[2]; + _mtx[7] = 0.0f; + _mtx[8] = toTargetNorm[0]; + _mtx[9] = toTargetNorm[1]; + _mtx[10] = toTargetNorm[2]; + _mtx[11] = 0.0f; + _mtx[12] = 0.0f; + _mtx[13] = 0.0f; + _mtx[14] = 0.0f; + _mtx[15] = 1.0f; + } + + static inline void vecFromLatLong(float _vec[3], float _u, float _v) + { + const float phi = _u * 2.0f*bx::kPi; + const float theta = _v * bx::kPi; + + const float st = bx::sin(theta); + const float sp = bx::sin(phi); + const float ct = bx::cos(theta); + const float cp = bx::cos(phi); + + _vec[0] = -st*sp; + _vec[1] = ct; + _vec[2] = -st*cp; + } + + static inline void latLongFromVec(float& _u, float& _v, const float _vec[3]) + { + const float phi = bx::atan2(_vec[0], _vec[2]); + const float theta = bx::acos(_vec[1]); + + _u = (bx::kPi + phi)*bx::kInvPi*0.5f; + _v = theta*bx::kInvPi; + } + + struct Interp3f + { + float curr[3]; + float dest[3]; + }; + + Interp3f m_target; + Interp3f m_pos; + float m_orbit[2]; +}; + +struct Mouse +{ + Mouse() + : m_dx(0.0f) + , m_dy(0.0f) + , m_prevMx(0.0f) + , m_prevMy(0.0f) + , m_scroll(0) + , m_scrollPrev(0) + { + } + + void update(float _mx, float _my, int32_t _mz, uint32_t _width, uint32_t _height) + { + const float widthf = float(int32_t(_width)); + const float heightf = float(int32_t(_height)); + + // Delta movement. + m_dx = float(_mx - m_prevMx) / widthf; + m_dy = float(_my - m_prevMy) / heightf; + + m_prevMx = _mx; + m_prevMy = _my; + + // Scroll. + m_scroll = _mz - m_scrollPrev; + m_scrollPrev = _mz; + } + + float m_dx; // Screen space. + float m_dy; + float m_prevMx; + float m_prevMy; + int32_t m_scroll; + int32_t m_scrollPrev; +}; + +struct PosVertex +{ + float m_x; + float m_y; + float m_z; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .end(); + }; + + static bgfx::VertexDecl ms_decl; +}; + +bgfx::VertexDecl PosVertex::ms_decl; + +static PosVertex s_cubeVertices[8] = +{ + {-0.5f, 0.5f, 0.5f}, + { 0.5f, 0.5f, 0.5f}, + {-0.5f, -0.5f, 0.5f}, + { 0.5f, -0.5f, 0.5f}, + {-0.5f, 0.5f, -0.5f}, + { 0.5f, 0.5f, -0.5f}, + {-0.5f, -0.5f, -0.5f}, + { 0.5f, -0.5f, -0.5f}, +}; + +static const uint16_t s_cubeIndices[36] = +{ + 0, 1, 2, // 0 + 1, 3, 2, + 4, 6, 5, // 2 + 5, 6, 7, + 0, 2, 4, // 4 + 4, 2, 6, + 1, 5, 3, // 6 + 5, 7, 3, + 0, 4, 1, // 8 + 4, 5, 1, + 2, 3, 6, // 10 + 6, 3, 7, +}; + +struct RenderPass +{ + enum Enum + { + Occlusion = 1 << 0, + MainPass = 1 << 1, + All = Occlusion | MainPass + }; +}; + +// All the per-instance data we store +struct InstanceData +{ + float m_world[16]; + float m_bboxMin[4]; + float m_bboxMax[4]; +}; + +//A description of each prop +struct Prop +{ + PosVertex* m_vertices; + uint16_t* m_indices; + InstanceData* m_instances; + bgfx::VertexBufferHandle m_vertexbufferHandle; + bgfx::IndexBufferHandle m_indexbufferHandle; + uint16_t m_noofVertices; + uint16_t m_noofIndices; + uint16_t m_noofInstances; + uint16_t m_materialID; + RenderPass::Enum m_renderPass; +}; + +//A simplistic material, comprised of a color only +struct Material +{ + float m_color[4]; +}; + +inline void setVector4(float* dest, float x, float y, float z, float w) +{ + dest[0] = x; + dest[1] = y; + dest[2] = z; + dest[3] = w; +} + +//Sets up a prop +void createCubeMesh(Prop& prop) +{ + prop.m_noofVertices = 8; + prop.m_noofIndices = 36; + prop.m_vertices = new PosVertex[prop.m_noofVertices]; + prop.m_indices = new uint16_t[prop.m_noofIndices]; + + bx::memCopy(prop.m_vertices, s_cubeVertices, prop.m_noofVertices * PosVertex::ms_decl.getStride()); + bx::memCopy(prop.m_indices, s_cubeIndices, prop.m_noofIndices * sizeof(uint16_t)); + + prop.m_vertexbufferHandle = bgfx::createVertexBuffer( + bgfx::makeRef(prop.m_vertices, prop.m_noofVertices * PosVertex::ms_decl.getStride()), + PosVertex::ms_decl); + + prop.m_indexbufferHandle = bgfx::createIndexBuffer(bgfx::makeRef(prop.m_indices, prop.m_noofIndices * sizeof(uint16_t))); +} + +//returns a random number between 0 and 1 +float rand01() +{ + return rand() / (float)RAND_MAX; +} + +class GPUDrivenRendering : public entry::AppI +{ +public: + GPUDrivenRendering(const char* _name, const char* _description) + : entry::AppI(_name, _description) + { + } + + void init(int32_t _argc, const char* const* _argv, uint32_t _width, uint32_t _height) override + { + Args args(_argc, _argv); + + m_width = _width; + m_height = _height; + + //find largest pow of two dims less than backbuffer size + m_hiZwidth = (uint32_t)bx::pow(2.0f, bx::floor(bx::log2(float(m_width ) ) ) ); + m_hiZheight = (uint32_t)bx::pow(2.0f, bx::floor(bx::log2(float(m_height) ) ) ); + + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; + + bgfx::Init init; + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); + + // Enable debug text. + bgfx::setDebug(m_debug); + + // Create uniforms and samplers. + u_inputRTSize = bgfx::createUniform("u_inputRTSize", bgfx::UniformType::Vec4); + u_cullingConfig = bgfx::createUniform("u_cullingConfig", bgfx::UniformType::Vec4); + u_color = bgfx::createUniform("u_color", bgfx::UniformType::Vec4, 32); + s_texOcclusionDepth = bgfx::createUniform("s_texOcclusionDepth", bgfx::UniformType::Int1); + + //create props + { + m_totalInstancesCount = 0; + + // Create vertex stream declaration. + PosVertex::init(); + + m_noofProps = 0; + + m_props = new Prop[s_maxNoofProps]; + + //first create space for some materials + m_materials = new Material[s_maxNoofProps]; + m_noofMaterials = 0; + + //add a ground plane + { + Prop& prop = m_props[m_noofProps++]; + + prop.m_renderPass = RenderPass::MainPass; + + createCubeMesh(prop); + + prop.m_noofInstances = 1; + prop.m_instances = new InstanceData[prop.m_noofInstances]; + + bx::mtxSRT(prop.m_instances->m_world + , 100.0f, 0.1f, 100.0f + , 0.0f, 0.0f, 0.0f + , 0.0f, 0.0f, 0.0f + ); + + float temp[4]; + setVector4(temp, -0.5f, -0.5f, -0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances->m_bboxMin, temp, prop.m_instances->m_world); + + setVector4(temp, 0.5f, 0.5f, 0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances->m_bboxMax, temp, prop.m_instances->m_world); + + prop.m_materialID = m_noofMaterials; + setVector4(m_materials[prop.m_materialID].m_color, 0.0f, 0.6f, 0.0f, 1.0f); + m_noofMaterials++; + + m_totalInstancesCount += prop.m_noofInstances; + } + + //add a few instances of the occluding mesh + { + Prop& prop = m_props[m_noofProps++]; + + prop.m_renderPass = RenderPass::All; + + //create prop + createCubeMesh(prop); + + //add a few instances of the wall mesh + prop.m_noofInstances = 25; + prop.m_instances = new InstanceData[prop.m_noofInstances]; + for (int i = 0; i < prop.m_noofInstances; i++) + { + //calculate world position + bx::mtxSRT(prop.m_instances[i].m_world + , 40.0f, 10.0f, 0.1f + , 0.0f, ( rand01() * 120.0f - 60.0f) * 3.1459f / 180.0f, 0.0f + , rand01() * 100.0f - 50.0f, 5.0f, rand01() * 100.0f - 50.0f + ); + + //calculate bounding box and transform to world space + float temp[4]; + setVector4(temp, -0.5f, -0.5f, -0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances[i].m_bboxMin, temp, prop.m_instances[i].m_world ); + + setVector4(temp, 0.5f, 0.5f, 0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances[i].m_bboxMax, temp, prop.m_instances[i].m_world ); + } + + //set the material ID. Will be used in the shader to select the material + prop.m_materialID = m_noofMaterials; + + //add a "material" for this prop + setVector4(m_materials[prop.m_materialID].m_color, 0.0f, 0.0f, 1.0f, 0.0f); + m_noofMaterials++; + + m_totalInstancesCount += prop.m_noofInstances; + } + + //add a few "regular" props + { + //add cubes + { + Prop& prop = m_props[m_noofProps++]; + + prop.m_renderPass = RenderPass::MainPass; + + createCubeMesh(prop); + + prop.m_noofInstances = 200; + prop.m_instances = new InstanceData[prop.m_noofInstances]; + for (int i = 0; i < prop.m_noofInstances; i++) + { + bx::mtxSRT(prop.m_instances[i].m_world + , 2.0f, 2.0f, 2.0f + , 0.0f, 0.0f, 0.0f + , rand01() * 100.0f - 50.0f, 1.0f, rand01() * 100.0f - 50.0f + ); + + float temp[4]; + setVector4(temp, -0.5f, -0.5f, -0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances[i].m_bboxMin, temp, prop.m_instances[i].m_world); + + setVector4(temp, 0.5f, 0.5f, 0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances[i].m_bboxMax, temp, prop.m_instances[i].m_world); + } + + prop.m_materialID = m_noofMaterials; + setVector4(m_materials[prop.m_materialID].m_color, 1.0f, 1.0f, 0.0f, 1.0f); + m_noofMaterials++; + + m_totalInstancesCount += prop.m_noofInstances; + } + + //add some more cubes + { + Prop& prop = m_props[m_noofProps++]; + + prop.m_renderPass = RenderPass::MainPass; + + createCubeMesh(prop); + + prop.m_noofInstances = 300; + prop.m_instances = new InstanceData[prop.m_noofInstances]; + for (int i = 0; i < prop.m_noofInstances; i++) + { + bx::mtxSRT(prop.m_instances[i].m_world + , 2.0f, 4.0f, 2.0f + , 0.0f, 0.0f, 0.0f + , rand01() * 100.0f - 50.0f, 2.0f, rand01() * 100.0f - 50.0f + ); + + float temp[4]; + setVector4(temp, -0.5f, -0.5f, -0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances[i].m_bboxMin, temp, prop.m_instances[i].m_world ); + + setVector4(temp, 0.5f, 0.5f, 0.5f, 1.0f); + bx::vec4MulMtx(prop.m_instances[i].m_bboxMax, temp, prop.m_instances[i].m_world); + } + + prop.m_materialID = m_noofMaterials; + setVector4(m_materials[prop.m_materialID].m_color, 1.0f, 0.0f, 0.0f, 1.0f); + m_noofMaterials++; + + m_totalInstancesCount += prop.m_noofInstances; + } + } + } + + //Setup Occlusion pass + { + const uint64_t tsFlags = 0 + | BGFX_TEXTURE_RT + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP + ; + + // Create buffers for the HiZ pass + m_hiZDepthBuffer = bgfx::createFrameBuffer(uint16_t(m_hiZwidth), uint16_t(m_hiZheight), bgfx::TextureFormat::D32, tsFlags); + + bgfx::TextureHandle buffer = bgfx::createTexture2D(uint16_t(m_hiZwidth), uint16_t(m_hiZheight), true, 1, bgfx::TextureFormat::R32F, BGFX_TEXTURE_COMPUTE_WRITE | tsFlags); + m_hiZBuffer = bgfx::createFrameBuffer(1, &buffer, true); + + //how many mip will the Hi Z buffer have? + m_noofHiZMips = (uint8_t)(1 + bx::floor(bx::log2(float(bx::max(m_hiZwidth, m_hiZheight) ) ) ) ); + + // Setup compute shader buffers + + //The compute shader will write how many unoccluded instances per drawcall there are here + m_drawcallInstanceCounts = bgfx::createDynamicIndexBuffer(s_maxNoofProps, BGFX_BUFFER_INDEX32 | BGFX_BUFFER_COMPUTE_READ_WRITE); + + //the compute shader will write the result of the occlusion test for each instance here + m_instancePredicates = bgfx::createDynamicIndexBuffer(s_maxNoofInstances, BGFX_BUFFER_COMPUTE_READ_WRITE); + + //bounding box for each instance, will be fed to the compute shader to calculate occlusion + { + bgfx::VertexDecl computeVertexDecl; + computeVertexDecl.begin() + .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) + .end(); + + //initialise the buffer with the bounding boxes of all instances + const int sizeOfBuffer = 2 * 4 * m_totalInstancesCount; + float* boundingBoxes = new float[sizeOfBuffer]; + + float* data = boundingBoxes; + for (uint16_t i = 0; i < m_noofProps; i++) + { + Prop& prop = m_props[i]; + + const uint32_t numInstances = prop.m_noofInstances; + + for (uint32_t j = 0; j < numInstances; j++) + { + bx::memCopy(data, prop.m_instances[j].m_bboxMin, 3 * sizeof(float)); + data[3] = (float)i; // store the drawcall ID here to avoid creating a separate buffer + data += 4; + + bx::memCopy(data, prop.m_instances[j].m_bboxMax, 3 * sizeof(float)); + data += 4; + } + } + + const bgfx::Memory* mem = bgfx::makeRef(boundingBoxes, sizeof(float) * sizeOfBuffer); + + m_instanceBoundingBoxes = bgfx::createDynamicVertexBuffer(mem, computeVertexDecl, BGFX_BUFFER_COMPUTE_READ); + } + + //pre and post occlusion culling instance data buffers + { + bgfx::VertexDecl instanceBufferVertexDecl; + instanceBufferVertexDecl.begin() + .add(bgfx::Attrib::TexCoord0, 4, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord1, 4, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord2, 4, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord3, 4, bgfx::AttribType::Float) + .end(); + + //initialise the buffer with data for all instances + //Currently we only store a world matrix (16 floats) + const int sizeOfBuffer = 16 * m_totalInstancesCount; + float* instanceData = new float[sizeOfBuffer]; + + float* data = instanceData; + for (uint16_t ii = 0; ii < m_noofProps; ++ii) + { + Prop& prop = m_props[ii]; + + const uint32_t numInstances = prop.m_noofInstances; + + for (uint32_t jj = 0; jj < numInstances; ++jj) + { + bx::memCopy(data, prop.m_instances[jj].m_world, 16 * sizeof(float) ); + data[3] = float(ii); // store the drawcall ID here to avoid creating a separate buffer + data += 16; + } + } + + const bgfx::Memory* mem = bgfx::makeRef(instanceData, sizeof(float) * sizeOfBuffer); + + //pre occlusion buffer + m_instanceBuffer = bgfx::createVertexBuffer(mem, instanceBufferVertexDecl, BGFX_BUFFER_COMPUTE_READ); + + //post occlusion buffer + m_culledInstanceBuffer = bgfx::createDynamicVertexBuffer(4 * m_totalInstancesCount, instanceBufferVertexDecl, BGFX_BUFFER_COMPUTE_WRITE); + } + + //we use one "drawcall" per prop to render all its instances + m_indirectBuffer = bgfx::createIndirectBuffer(m_noofProps); + + // Create programs from shaders for occlusion pass. + m_programOcclusionPass = loadProgram("vs_gdr_render_occlusion", NULL); + m_programDownscaleHiZ = loadProgram("cs_gdr_downscale_hi_z", NULL); + m_programOccludeProps = loadProgram("cs_gdr_occlude_props", NULL); + m_programStreamCompaction = loadProgram("cs_gdr_stream_compaction", NULL); + + // Set view RENDER_PASS_HIZ_ID clear state. + bgfx::setViewClear(RENDER_PASS_HIZ_ID + , BGFX_CLEAR_DEPTH + , 0x0 + , 1.0f + , 0 + ); + } + + // Setup Main pass + { + // Set view 0 clear state. + bgfx::setViewClear(RENDER_PASS_MAIN_ID + , BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH + , 0x303030ff + , 1.0f + , 0 + ); + + // Create program from shaders. + m_programMainPass = loadProgram("vs_gdr_instanced_indirect_rendering", "fs_gdr_instanced_indirect_rendering"); + } + + // Create static vertex buffer for all props. + + // Calculate how many vertices/indices the master buffers will need. + uint16_t totalNoofVertices = 0; + uint16_t totalNoofIndices = 0; + for (uint16_t i = 0; i < m_noofProps; i++) + { + Prop& prop = m_props[i]; + + totalNoofVertices += prop.m_noofVertices; + totalNoofIndices += prop.m_noofIndices; + } + + // CPU data to fill the master buffers + m_allPropVerticesDataCPU = new PosVertex[totalNoofVertices]; + m_allPropIndicesDataCPU = new uint16_t[totalNoofIndices]; + m_indirectBufferDataCPU = new uint32_t[m_noofProps * 3]; + + // Copy data over to the master buffers + PosVertex* propVerticesData = m_allPropVerticesDataCPU; + uint16_t* propIndicesData = m_allPropIndicesDataCPU; + + uint16_t vertexBufferOffset = 0; + uint16_t indexBufferOffset = 0; + + for (uint16_t i = 0; i < m_noofProps; i++) + { + Prop& prop = m_props[i]; + + bx::memCopy(propVerticesData, prop.m_vertices, prop.m_noofVertices * sizeof(PosVertex)); + bx::memCopy(propIndicesData, prop.m_indices, prop.m_noofIndices * sizeof(uint16_t)); + + propVerticesData += prop.m_noofVertices; + propIndicesData += prop.m_noofIndices; + + m_indirectBufferDataCPU[ i * 3 ] = prop.m_noofIndices; + m_indirectBufferDataCPU[ i * 3 + 1] = indexBufferOffset; + m_indirectBufferDataCPU[ i * 3 + 2] = vertexBufferOffset; + + indexBufferOffset += prop.m_noofIndices; + vertexBufferOffset += prop.m_noofVertices; + } + + // Create master vertex buffer + m_allPropsVertexbufferHandle = bgfx::createVertexBuffer( + bgfx::makeRef(m_allPropVerticesDataCPU, totalNoofVertices * PosVertex::ms_decl.getStride()) + , PosVertex::ms_decl + ); + + // Create master index buffer. + m_allPropsIndexbufferHandle = bgfx::createIndexBuffer( + bgfx::makeRef(m_allPropIndicesDataCPU, totalNoofIndices * sizeof(uint16_t) ) + ); + + // Create buffer with const drawcall data which will be copied to the indirect buffer later. + m_indirectBufferData = bgfx::createIndexBuffer( + bgfx::makeRef(m_indirectBufferDataCPU, m_noofProps * 3 * sizeof(uint32_t)), + BGFX_BUFFER_COMPUTE_READ | BGFX_BUFFER_INDEX32 + ); + + m_timeOffset = bx::getHPCounter(); + + m_useIndirect = true; + + imguiCreate(); + } + + int shutdown() override + { + imguiDestroy(); + + // Cleanup. + + bgfx::destroy(m_programMainPass); + bgfx::destroy(m_programOcclusionPass); + bgfx::destroy(m_programDownscaleHiZ); + bgfx::destroy(m_programOccludeProps); + bgfx::destroy(m_programStreamCompaction); + + for (uint16_t i = 0; i < m_noofProps; i++) + { + Prop& prop = m_props[i]; + + bgfx::destroy(prop.m_indexbufferHandle); + bgfx::destroy(prop.m_vertexbufferHandle); + + delete[] prop.m_indices; + delete[] prop.m_vertices; + delete[] prop.m_instances; + } + + delete[] m_props; + + bgfx::destroy(m_hiZDepthBuffer); + bgfx::destroy(m_hiZBuffer); + bgfx::destroy(m_indirectBuffer); + bgfx::destroy(m_indirectBufferData); + bgfx::destroy(m_instanceBoundingBoxes); + bgfx::destroy(m_drawcallInstanceCounts); + bgfx::destroy(m_instancePredicates); + bgfx::destroy(m_instanceBuffer); + bgfx::destroy(m_culledInstanceBuffer); + + bgfx::destroy(m_allPropsVertexbufferHandle); + bgfx::destroy(m_allPropsIndexbufferHandle); + + bgfx::destroy(s_texOcclusionDepth); + bgfx::destroy(u_inputRTSize); + bgfx::destroy(u_cullingConfig); + bgfx::destroy(u_color); + + delete[] m_allPropVerticesDataCPU; + delete[] m_allPropIndicesDataCPU; + delete[] m_indirectBufferDataCPU; + + // Shutdown bgfx. + bgfx::shutdown(); + + return 0; + } + + //renders the occluders to a depth buffer + void renderOcclusionBufferPass() + { + // Setup the occlusion pass projection + bx::mtxProj(m_occlusionProj, 60.0f, float(m_hiZwidth) / float(m_hiZheight), 0.1f, 500.0f, bgfx::getCaps()->homogeneousDepth); + + bgfx::setViewTransform(RENDER_PASS_HIZ_ID, m_mainView, m_occlusionProj); + + bgfx::setViewFrameBuffer(RENDER_PASS_HIZ_ID, m_hiZDepthBuffer); + bgfx::setViewRect(RENDER_PASS_HIZ_ID, 0, 0, uint16_t(m_hiZwidth), uint16_t(m_hiZheight)); + + const uint16_t instanceStride = sizeof(InstanceData); + + // render all instances of the occluder meshes + for (uint16_t i = 0; i < m_noofProps; i++) + { + Prop& prop = m_props[i]; + + if (prop.m_renderPass & RenderPass::Occlusion) + { + const uint32_t numInstances = prop.m_noofInstances; + + // render instances to the occlusion buffer + if (numInstances == bgfx::getAvailInstanceDataBuffer(numInstances, instanceStride)) + { + bgfx::InstanceDataBuffer instanceBuffer; + + bgfx::allocInstanceDataBuffer(&instanceBuffer, numInstances, instanceStride); + + InstanceData *data = (InstanceData *) instanceBuffer.data; + + for (uint32_t j = 0; j < numInstances; j++) + { + //we only need the world matrix for the occlusion pass + bx::memCopy(data->m_world, prop.m_instances[j].m_world, sizeof(data->m_world)); + data++; + } + + // Set vertex and index buffer. + bgfx::setVertexBuffer(0, prop.m_vertexbufferHandle); + bgfx::setIndexBuffer(prop.m_indexbufferHandle); + + // Set instance data buffer. + bgfx::setInstanceDataBuffer(&instanceBuffer); + + // Set render states. + bgfx::setState(BGFX_STATE_DEFAULT); + + // Submit primitive for rendering to view. + bgfx::submit(RENDER_PASS_HIZ_ID, m_programOcclusionPass); + } + } + } + } + + // downscale the occluder depth buffer to create a mipmap chain + void renderDownscalePass() + { + uint32_t width = m_hiZwidth; + uint32_t height = m_hiZheight; + + for (uint8_t lod = 0; lod < m_noofHiZMips; ++lod) + { + float coordinateScale = lod > 0 ? 2.0f : 1.0f; + + float inputRendertargetSize[4] = { (float)width, (float)height, coordinateScale, coordinateScale }; + bgfx::setUniform(u_inputRTSize, inputRendertargetSize); + + if (lod > 0) + { + // down scale mip 1 onwards + width /= 2; + height /= 2; + + bgfx::setImage(0, getTexture(m_hiZBuffer, 0), lod - 1, bgfx::Access::Read); + bgfx::setImage(1, getTexture(m_hiZBuffer, 0), lod, bgfx::Access::Write); + } + else + { + // copy mip zero over to the hi Z buffer. + // We can't currently use blit as it requires same format and CopyResource is not exposed. + bgfx::setImage(0, getTexture(m_hiZDepthBuffer, 0), 0, bgfx::Access::Read); + bgfx::setImage(1, getTexture(m_hiZBuffer, 0), 0, bgfx::Access::Write); + } + + bgfx::dispatch(RENDER_PASS_HIZ_DOWNSCALE_ID, m_programDownscaleHiZ, width/16, height/16); + } + } + + // perform the occlusion using the mip chain + void renderOccludePropsPass() + { + // run the computer shader to determine visibility of each instance + bgfx::setTexture(0, s_texOcclusionDepth, bgfx::getTexture(m_hiZBuffer, 0) ); + + bgfx::setBuffer(1, m_instanceBoundingBoxes, bgfx::Access::Read); + bgfx::setBuffer(2, m_drawcallInstanceCounts, bgfx::Access::ReadWrite); + bgfx::setBuffer(3, m_instancePredicates, bgfx::Access::Write); + + float inputRendertargetSize[4] = { (float)m_hiZwidth, (float)m_hiZheight, 1.0f/ m_hiZwidth, 1.0f/ m_hiZheight }; + bgfx::setUniform(u_inputRTSize, inputRendertargetSize); + + // store a rounded-up, power of two instance count for the stream compaction step + float noofInstancesPowOf2 = bx::pow(2.0f, bx::floor(bx::log(m_totalInstancesCount) / bx::log(2.0f) ) + 1.0f); + + float cullingConfig[4] = + { + (float)m_totalInstancesCount, + noofInstancesPowOf2, + (float)m_noofHiZMips, + (float)m_noofProps + }; + bgfx::setUniform(u_cullingConfig, cullingConfig); + + //set the view/projection transforms so that the compute shader can receive the viewProjection matrix automagically + bgfx::setViewTransform(RENDER_PASS_OCCLUDE_PROPS_ID, m_mainView, m_occlusionProj); + + uint16_t groupX = bx::max(m_totalInstancesCount / 64 + 1, 1); + + bgfx::dispatch(RENDER_PASS_OCCLUDE_PROPS_ID, m_programOccludeProps, groupX, 1, 1); + + // perform stream compaction to remove occluded instances + + // the per drawcall data that is constant (noof indices/vertices and offsets to vertex/index buffers) + bgfx::setBuffer(0, m_indirectBufferData, bgfx::Access::Read); + // instance data for all instances (pre culling) + bgfx::setBuffer(1, m_instanceBuffer, bgfx::Access::Read); + // per instance visibility (output of culling pass) + bgfx::setBuffer(2, m_instancePredicates, bgfx::Access::Read); + + // how many instances per drawcall + bgfx::setBuffer(3, m_drawcallInstanceCounts, bgfx::Access::ReadWrite); + // drawcall data that will drive drawIndirect + bgfx::setBuffer(4, m_indirectBuffer, bgfx::Access::ReadWrite); + // culled instance data + bgfx::setBuffer(5, m_culledInstanceBuffer, bgfx::Access::Write); + + bgfx::setUniform(u_cullingConfig, cullingConfig); + + bgfx::dispatch(RENDER_PASS_COMPACT_STREAM_ID, m_programStreamCompaction, 1, 1, 1); + + } + + // render the unoccluded props to the screen + void renderMainPass() + { + // Set view and projection matrix for view 0. + { + bgfx::setViewTransform(RENDER_PASS_MAIN_ID, m_mainView, m_mainProj); + + // Set view 0 default viewport. + bgfx::setViewRect(RENDER_PASS_MAIN_ID, 0, 0, uint16_t(m_width), uint16_t(m_height)); + } + + // Set render states. + bgfx::setState(BGFX_STATE_DEFAULT); + + const uint16_t instanceStride = sizeof(InstanceData); + + // Set "material" data (currently a color only) + bgfx::setUniform(u_color, &m_materials[0].m_color, m_noofMaterials); + + if (m_useIndirect) + { + // Set vertex and index buffer. + bgfx::setVertexBuffer(0, m_allPropsVertexbufferHandle); + bgfx::setIndexBuffer( m_allPropsIndexbufferHandle); + + // Set instance data buffer. + bgfx::setInstanceDataBuffer(m_culledInstanceBuffer, 0, m_totalInstancesCount ); + + bgfx::submit(RENDER_PASS_MAIN_ID, m_programMainPass, m_indirectBuffer, 0, m_noofProps); + } + else + { + // render all props using regular instancing + for (uint16_t ii = 0; ii < m_noofProps; ++ii) + { + Prop& prop = m_props[ii]; + + if (prop.m_renderPass & RenderPass::MainPass) + { + const uint32_t numInstances = prop.m_noofInstances; + + if (numInstances == bgfx::getAvailInstanceDataBuffer(numInstances, instanceStride)) + { + bgfx::InstanceDataBuffer instanceBuffer; + + bgfx::allocInstanceDataBuffer(&instanceBuffer, numInstances, instanceStride); + + InstanceData *data = (InstanceData *)instanceBuffer.data; + + for (uint32_t jj = 0; jj < numInstances; ++jj) + { + //copy world matrix + bx::memCopy(data->m_world, prop.m_instances[jj].m_world, sizeof(data->m_world) ); + //pack the material ID into the world transform + data->m_world[3] = float(prop.m_materialID); + data++; + } + + // Set vertex and index buffer. + bgfx::setVertexBuffer(0, prop.m_vertexbufferHandle); + bgfx::setIndexBuffer(prop.m_indexbufferHandle); + + // Set instance data buffer. + bgfx::setInstanceDataBuffer(&instanceBuffer); + + bgfx::submit(RENDER_PASS_MAIN_ID, m_programMainPass); + } + } + } + } + } + + bool update() override + { + if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) + { + imguiBeginFrame(m_mouseState.m_mx + , m_mouseState.m_my + , (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) + , m_mouseState.m_mz + , uint16_t(m_width) + , uint16_t(m_height) + ); + + showExampleDialog(this); + + ImGui::SetNextWindowPos( + ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 6.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::Begin("Settings" + , NULL + , 0 + ); + ImGui::Checkbox("Use Draw Indirect", &m_useIndirect); + + ImGui::End(); + + imguiEndFrame(); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(0); + + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency()); + const float deltaTimeSec = float(double(frameTime) / freq); + + // Camera. + const bool mouseOverGui = ImGui::MouseOverArea(); + m_mouse.update(float(m_mouseState.m_mx), float(m_mouseState.m_my), m_mouseState.m_mz, m_width, m_height); + if (!mouseOverGui) + { + if (m_mouseState.m_buttons[entry::MouseButton::Left]) + { + m_camera.orbit(m_mouse.m_dx, m_mouse.m_dy); + } + else if (m_mouseState.m_buttons[entry::MouseButton::Right]) + { + m_camera.dolly(m_mouse.m_dx + m_mouse.m_dy); + } + else if (0 != m_mouse.m_scroll) + { + m_camera.dolly(float(m_mouse.m_scroll)*0.05f); + } + } + + m_camera.update(deltaTimeSec); + + // Get renderer capabilities info. + const bgfx::Caps* caps = bgfx::getCaps(); + + // Check if instancing is supported. + if (0 == (BGFX_CAPS_INSTANCING & caps->supported) ) + { + // When instancing is not supported by GPU, implement alternative + // code path that doesn't use instancing. + float time = (float)((bx::getHPCounter() - m_timeOffset) / double(bx::getHPFrequency())); + bool blink = uint32_t(time*3.0f)&1; + bgfx::dbgTextPrintf(0, 0, blink ? 0x1f : 0x01, " Instancing is not supported by GPU. "); + } + else + { + // calculate main view and project matrices as they are typically reused between passes. + m_camera.mtxLookAt(m_mainView); + bx::mtxProj(m_mainProj, 60.0f, float(m_width) / float(m_height), 0.1f, 500.0f, bgfx::getCaps()->homogeneousDepth); + + //submit drawcalls for all passes + renderOcclusionBufferPass(); + + renderDownscalePass(); + + renderOccludePropsPass(); + + renderMainPass(); + } + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; + } + + return false; + } + + entry::MouseState m_mouseState; + + uint32_t m_width; + uint32_t m_height; + uint32_t m_hiZwidth; + uint32_t m_hiZheight; + uint32_t m_debug; + uint32_t m_reset; + + float m_mainView[16]; + float m_mainProj[16]; + float m_occlusionProj[16]; + + bgfx::ProgramHandle m_programMainPass; + bgfx::ProgramHandle m_programOcclusionPass; + bgfx::ProgramHandle m_programDownscaleHiZ; + bgfx::ProgramHandle m_programOccludeProps; + bgfx::ProgramHandle m_programStreamCompaction; + + bgfx::FrameBufferHandle m_hiZDepthBuffer; + bgfx::FrameBufferHandle m_hiZBuffer; + bgfx::IndirectBufferHandle m_indirectBuffer; + + bgfx::VertexBufferHandle m_allPropsVertexbufferHandle; + bgfx::IndexBufferHandle m_allPropsIndexbufferHandle; + bgfx::IndexBufferHandle m_indirectBufferData; + + PosVertex* m_allPropVerticesDataCPU; + uint16_t* m_allPropIndicesDataCPU; + uint32_t* m_indirectBufferDataCPU; + + bgfx::DynamicVertexBufferHandle m_instanceBoundingBoxes; + bgfx::DynamicIndexBufferHandle m_drawcallInstanceCounts; + bgfx::DynamicIndexBufferHandle m_instancePredicates; + bgfx::VertexBufferHandle m_instanceBuffer; + bgfx::DynamicVertexBufferHandle m_culledInstanceBuffer; + + bgfx::UniformHandle s_texOcclusionDepth; + bgfx::UniformHandle u_inputRTSize; + bgfx::UniformHandle u_cullingConfig; + bgfx::UniformHandle u_color; + + Prop* m_props; + Material* m_materials; + uint16_t m_noofProps; + uint16_t m_noofMaterials; + uint16_t m_totalInstancesCount; + + static const uint16_t s_maxNoofProps = 10; + + static const uint16_t s_maxNoofInstances = 2048; + + int64_t m_timeOffset; + + uint8_t m_noofHiZMips; + + bool m_useIndirect; + + Camera m_camera; + Mouse m_mouse; +}; + +} // namespace + +ENTRY_IMPLEMENT_MAIN(GPUDrivenRendering, "37-gpudrivenrendering", "GPU-Driven Rendering."); diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/makefile b/3rdparty/bgfx/examples/37-gpudrivenrendering/makefile new file mode 100644 index 00000000000..171709170a4 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/makefile @@ -0,0 +1,10 @@ +# +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. +# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause +# + +BGFX_DIR=../.. +RUNTIME_DIR=$(BGFX_DIR)/examples/runtime +BUILD_DIR=../../.build + +include $(BGFX_DIR)/scripts/shader.mk diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/screenshot.png b/3rdparty/bgfx/examples/37-gpudrivenrendering/screenshot.png new file mode 100644 index 00000000000..6174311fc71 Binary files /dev/null and b/3rdparty/bgfx/examples/37-gpudrivenrendering/screenshot.png differ diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/varying.def.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/varying.def.sc new file mode 100644 index 00000000000..bab2e384d93 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/varying.def.sc @@ -0,0 +1,9 @@ +vec3 a_position : POSITION; +vec2 a_texcoord0 : TEXCOORD0; +vec4 i_data0 : TEXCOORD7; +vec4 i_data1 : TEXCOORD6; +vec4 i_data2 : TEXCOORD5; +vec4 i_data3 : TEXCOORD4; + +vec2 v_texcoord0 : TEXCOORD0; +flat float v_materialID : TEXCOORD0; diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/vs_gdr_instanced_indirect_rendering.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/vs_gdr_instanced_indirect_rendering.sc new file mode 100644 index 00000000000..da5174d9f69 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/vs_gdr_instanced_indirect_rendering.sc @@ -0,0 +1,23 @@ +$input a_position, i_data0, i_data1, i_data2, i_data3 +$output v_materialID + +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +void main() +{ + mat4 model; + model[0] = vec4(i_data0.xyz, 0.0); + model[1] = i_data1; + model[2] = i_data2; + model[3] = i_data3; + + v_materialID = i_data0.w; + + vec4 worldPos = instMul(model, vec4(a_position, 1.0) ); + gl_Position = mul(u_viewProj, worldPos); +} diff --git a/3rdparty/bgfx/examples/37-gpudrivenrendering/vs_gdr_render_occlusion.sc b/3rdparty/bgfx/examples/37-gpudrivenrendering/vs_gdr_render_occlusion.sc new file mode 100644 index 00000000000..dcfe4b60635 --- /dev/null +++ b/3rdparty/bgfx/examples/37-gpudrivenrendering/vs_gdr_render_occlusion.sc @@ -0,0 +1,20 @@ +$input a_position, i_data0, i_data1, i_data2, i_data3, i_data4 + +/* + * Copyright 2018 Kostas Anagnostou. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +void main() +{ + mat4 model; + model[0] = i_data0; + model[1] = i_data1; + model[2] = i_data2; + model[3] = i_data3; + + vec4 worldPos = instMul(model, vec4(a_position, 1.0) ); + gl_Position = mul(u_viewProj, worldPos); +} diff --git a/3rdparty/bgfx/examples/38-bloom/bloom.cpp b/3rdparty/bgfx/examples/38-bloom/bloom.cpp new file mode 100644 index 00000000000..1de0111ca9b --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/bloom.cpp @@ -0,0 +1,660 @@ +/* + * Copyright 2018 Eric Arnebäck. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +/* + * Reference(s): + * - Next Generation Post Processing in Call of Duty: Advanced Warfare + * https://web.archive.org/web/20180920045230/http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare + */ + +#include "common.h" +#include "bgfx_utils.h" +#include "imgui/imgui.h" +#include "camera.h" +#include "bounds.h" + +namespace +{ + +// pass that render the geometry of the boxes. +#define RENDER_PASS_GEOMETRY_ID 0 + +// the first downsample pass. +#define RENDER_PASS_DOWNSAMPLE0_ID 1 + +// the first upsample pass. +#define RENDER_PASS_UPSAMPLE0_ID ( (TEX_CHAIN_LEN-1) + 1) + +// the final pass the combines the bloom with the g-buffer. +#define RENDER_PASS_COMBINE_ID ( (TEX_CHAIN_LEN-1) + 1 + (TEX_CHAIN_LEN-1) ) + +// number of downsampled and then upsampled textures(used for bloom.) +#define TEX_CHAIN_LEN 5 + +static float s_texelHalf = 0.0f; + +struct PosVertex +{ + float m_x; + float m_y; + float m_z; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; + +bgfx::VertexDecl PosVertex::ms_decl; + +struct PosTexCoord0Vertex +{ + float m_x; + float m_y; + float m_z; + float m_u; + float m_v; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; + +bgfx::VertexDecl PosTexCoord0Vertex::ms_decl; + +constexpr float cs = 0.29f; + +static PosVertex s_cubeVertices[24] = +{ + {-cs, cs, cs }, + { cs, cs, cs }, + {-cs, -cs, cs }, + { cs, -cs, cs }, + {-cs, cs, -cs }, + { cs, cs, -cs }, + {-cs, -cs, -cs }, + { cs, -cs, -cs }, + {-cs, cs, cs }, + { cs, cs, cs }, + {-cs, cs, -cs }, + { cs, cs, -cs }, + {-cs, -cs, cs }, + { cs, -cs, cs }, + {-cs, -cs, -cs }, + { cs, -cs, -cs }, + { cs, -cs, cs }, + { cs, cs, cs }, + { cs, -cs, -cs }, + { cs, cs, -cs }, + {-cs, -cs, cs }, + {-cs, cs, cs }, + {-cs, -cs, -cs }, + {-cs, cs, -cs }, +}; + +static const uint16_t s_cubeIndices[36] = +{ + 0, 2, 1, + 1, 2, 3, + 4, 5, 6, + 5, 7, 6, + + 8, 10, 9, + 9, 10, 11, + 12, 13, 14, + 13, 15, 14, + + 16, 18, 17, + 17, 18, 19, + 20, 21, 22, + 21, 23, 22, +}; + +void screenSpaceQuad(float _textureWidth, float _textureHeight, float _texelHalf, bool _originBottomLeft, float _width = 1.0f, float _height = 1.0f) +{ + if (3 == bgfx::getAvailTransientVertexBuffer(3, PosTexCoord0Vertex::ms_decl) ) + { + bgfx::TransientVertexBuffer vb; + bgfx::allocTransientVertexBuffer(&vb, 3, PosTexCoord0Vertex::ms_decl); + PosTexCoord0Vertex* vertex = (PosTexCoord0Vertex*)vb.data; + + const float minx = -_width; + const float maxx = _width; + const float miny = 0.0f; + const float maxy = _height*2.0f; + + const float texelHalfW = _texelHalf/_textureWidth; + const float texelHalfH = _texelHalf/_textureHeight; + const float minu = -1.0f + texelHalfW; + const float maxu = 1.0f + texelHalfH; + + const float zz = 0.0f; + + float minv = texelHalfH; + float maxv = 2.0f + texelHalfH; + + if (_originBottomLeft) + { + float temp = minv; + minv = maxv; + maxv = temp; + + minv -= 1.0f; + maxv -= 1.0f; + } + + vertex[0].m_x = minx; + vertex[0].m_y = miny; + vertex[0].m_z = zz; + vertex[0].m_u = minu; + vertex[0].m_v = minv; + + vertex[1].m_x = maxx; + vertex[1].m_y = miny; + vertex[1].m_z = zz; + vertex[1].m_u = maxu; + vertex[1].m_v = minv; + + vertex[2].m_x = maxx; + vertex[2].m_y = maxy; + vertex[2].m_z = zz; + vertex[2].m_u = maxu; + vertex[2].m_v = maxv; + + bgfx::setVertexBuffer(0, &vb); + } +} + +class ExampleDeferred : public entry::AppI +{ +public: + ExampleDeferred(const char* _name, const char* _description) + : entry::AppI(_name, _description) + { + } + + void init(int32_t _argc, const char* const* _argv, uint32_t _width, uint32_t _height) override + { + Args args(_argc, _argv); + + m_width = _width; + m_height = _height; + m_debug = BGFX_DEBUG_TEXT; + m_reset = BGFX_RESET_VSYNC; + + bgfx::Init init; + + init.type = args.m_type; + init.vendorId = args.m_pciId; + init.resolution.width = m_width; + init.resolution.height = m_height; + init.resolution.reset = m_reset; + bgfx::init(init); + + // Enable m_debug text. + bgfx::setDebug(m_debug); + + // Set palette color for index 0 + bgfx::setPaletteColor(0, UINT32_C(0x00000000) ); + + // Set geometry pass view clear state. + bgfx::setViewClear(RENDER_PASS_GEOMETRY_ID + , BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH + , 1.0f + , 0 + , 0 + , 0 + ); + + // we need to clear the textures in the chain, before downsampling into them. + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN-1; ++ii) + { + bgfx::setViewClear(RENDER_PASS_DOWNSAMPLE0_ID + ii + , BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH + , 1.0f + , 0 + , 0 + ); + } + + // Create vertex stream declaration. + PosVertex::init(); + PosTexCoord0Vertex::init(); + + // Create static vertex buffer. + m_vbh = bgfx::createVertexBuffer( + bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) ) + , PosVertex::ms_decl + ); + + m_ibh = bgfx::createIndexBuffer(bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) ) ); + + s_albedo = bgfx::createUniform("s_albedo", bgfx::UniformType::Int1); + s_tex = bgfx::createUniform("s_tex", bgfx::UniformType::Int1); + s_depth = bgfx::createUniform("s_depth", bgfx::UniformType::Int1); + s_light = bgfx::createUniform("s_light", bgfx::UniformType::Int1); + u_pixelSize = bgfx::createUniform("u_pixelSize", bgfx::UniformType::Vec4); + u_intensity = bgfx::createUniform("u_intensity", bgfx::UniformType::Vec4); + u_color = bgfx::createUniform("u_color", bgfx::UniformType::Vec4); + u_mtx = bgfx::createUniform("u_mtx", bgfx::UniformType::Mat4); + + // Create program from shaders. + m_geomProgram = loadProgram("vs_albedo_output", "fs_albedo_output"); + m_downsampleProgram = loadProgram("vs_fullscreen", "fs_downsample"); + m_upsampleProgram = loadProgram("vs_fullscreen", "fs_upsample"); + m_combineProgram = loadProgram("vs_fullscreen", "fs_bloom_combine"); + + m_gbuffer = BGFX_INVALID_HANDLE; + + for (int ii = 0; ii < TEX_CHAIN_LEN; ++ii) + { + m_texChainFb[ii] = BGFX_INVALID_HANDLE; + } + + // Imgui. + imguiCreate(); + + m_timeOffset = bx::getHPCounter(); + const bgfx::RendererType::Enum renderer = bgfx::getRendererType(); + s_texelHalf = bgfx::RendererType::Direct3D9 == renderer ? 0.5f : 0.0f; + + // Get renderer capabilities info. + m_caps = bgfx::getCaps(); + + m_oldWidth = 0; + m_oldHeight = 0; + m_oldReset = m_reset; + + m_scrollArea = 0; + + cameraCreate(); + + const float initialPos[3] = { 0.0f, 0.0f, -15.0f }; + cameraSetPosition(initialPos); + cameraSetVerticalAngle(0.0f); + } + + virtual int shutdown() override + { + // Cleanup. + cameraDestroy(); + imguiDestroy(); + + if (bgfx::isValid(m_gbuffer) ) + { + bgfx::destroy(m_gbuffer); + } + + for (int ii = 0; ii < TEX_CHAIN_LEN; ++ii) + { + bgfx::destroy(m_texChainFb[ii]); + } + + bgfx::destroy(m_ibh); + bgfx::destroy(m_vbh); + + bgfx::destroy(m_geomProgram); + bgfx::destroy(m_downsampleProgram); + bgfx::destroy(m_upsampleProgram); + bgfx::destroy(m_combineProgram); + + bgfx::destroy(s_albedo); + bgfx::destroy(s_tex); + bgfx::destroy(s_depth); + bgfx::destroy(s_light); + + bgfx::destroy(u_mtx); + bgfx::destroy(u_pixelSize); + bgfx::destroy(u_intensity); + bgfx::destroy(u_color); + + // Shutdown bgfx. + bgfx::shutdown(); + + return 0; + } + + bool update() override + { + if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) ) + { + imguiBeginFrame( + m_mouseState.m_mx + , m_mouseState.m_my + , (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) + | (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) + , m_mouseState.m_mz + , uint16_t(m_width) + , uint16_t(m_height) + ); + + showExampleDialog(this); + + int64_t now = bx::getHPCounter(); + static int64_t last = now; + const int64_t frameTime = now - last; + last = now; + const double freq = double(bx::getHPFrequency() ); + const float deltaTime = float(frameTime/freq); + + float time = (float)( (now-m_timeOffset)/freq); + + if (2 > m_caps->limits.maxFBAttachments) + { + // When multiple render targets (MRT) is not supported by GPU, + // implement alternative code path that doesn't use MRT. + bool blink = uint32_t(time*3.0f)&1; + bgfx::dbgTextPrintf(0, 0, blink ? 0x4f : 0x04, " MRT not supported by GPU. "); + + // Set view 0 default viewport. + bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(0); + } + else + { + if (m_oldWidth != m_width + || m_oldHeight != m_height + || m_oldReset != m_reset + || !bgfx::isValid(m_gbuffer) ) + { + // Recreate variable size render targets when resolution changes. + m_oldWidth = m_width; + m_oldHeight = m_height; + m_oldReset = m_reset; + + if (bgfx::isValid(m_gbuffer) ) + { + bgfx::destroy(m_gbuffer); + } + + const uint64_t tsFlags = 0 + | BGFX_TEXTURE_RT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP + ; + + for (int ii = 0; ii < TEX_CHAIN_LEN; ++ii) + { + if (bgfx::isValid(m_texChainFb[ii]) ) + { + bgfx::destroy(m_texChainFb[ii]); + } + + const float dim = float(1 << ii); + + m_texChainFb[ii] = bgfx::createFrameBuffer( + (uint16_t)(m_width / dim) + , (uint16_t)(m_height / dim) + , bgfx::TextureFormat::RGBA32F + , tsFlags + ); + } + + bgfx::TextureHandle gbufferTex[] = + { + bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::RGBA32F, tsFlags), + bgfx::getTexture(m_texChainFb[0]), + bgfx::createTexture2D(uint16_t(m_width), uint16_t(m_height), false, 1, bgfx::TextureFormat::D24S8, tsFlags), + }; + + m_gbuffer = bgfx::createFrameBuffer(BX_COUNTOF(gbufferTex), gbufferTex, true); + } + + ImGui::SetNextWindowPos( + ImVec2(m_width - m_width / 5.0f - 10.0f, 10.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::SetNextWindowSize( + ImVec2(m_width / 5.0f, m_height / 6.0f) + , ImGuiCond_FirstUseEver + ); + ImGui::Begin("Settings" + , NULL + , 0 + ); + + ImGui::SliderFloat("intensity", &m_intensity, 0.0f, 3.0f); + + ImGui::End(); + + // Update camera. + cameraUpdate(deltaTime, m_mouseState); + + float view[16]; + cameraGetViewMtx(view); + + float proj[16]; + // Setup views + { + bgfx::setViewRect(RENDER_PASS_GEOMETRY_ID, 0, 0, uint16_t(m_width), uint16_t(m_height) ); + + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN-1; ++ii) + { + const float dim = float(1 << (ii + 1) ); + + bgfx::setViewRect(RENDER_PASS_DOWNSAMPLE0_ID + ii, 0, 0 + , uint16_t(m_width / dim) + , uint16_t(m_height / dim) + ); + } + + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN-1; ++ii) + { + const float dim = float(1 << (TEX_CHAIN_LEN - ii - 2) ); + + bgfx::setViewRect(RENDER_PASS_UPSAMPLE0_ID + ii, 0, 0 + , uint16_t(m_width / dim) + , uint16_t(m_height / dim) + ); + } + + bx::mtxProj(proj, 60.0f, float(m_width) / float(m_height), 0.1f, 100.0f, m_caps->homogeneousDepth); + bgfx::setViewFrameBuffer(RENDER_PASS_GEOMETRY_ID, m_gbuffer); + bgfx::setViewTransform(RENDER_PASS_GEOMETRY_ID, view, proj); + + bgfx::setViewRect(RENDER_PASS_COMBINE_ID, 0, 0, uint16_t(m_width), uint16_t(m_height)); + + bx::mtxOrtho(proj, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 100.0f, 0.0f, m_caps->homogeneousDepth); + + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN-1; ++ii) + { + bgfx::setViewTransform(RENDER_PASS_DOWNSAMPLE0_ID + ii, NULL, proj); + bgfx::setViewFrameBuffer(RENDER_PASS_DOWNSAMPLE0_ID + ii, m_texChainFb[ii+1]); + } + + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN-1; ++ii) + { + bgfx::setViewTransform(RENDER_PASS_UPSAMPLE0_ID + ii, NULL, proj); + bgfx::setViewFrameBuffer(RENDER_PASS_UPSAMPLE0_ID + ii, m_texChainFb[TEX_CHAIN_LEN - ii - 2]); + } + + bgfx::setViewTransform(RENDER_PASS_COMBINE_ID, NULL, proj); + } + + const uint32_t kNum = 9; + const int kNumColors = 5; + const float color[4*kNumColors] = + { // Palette: http://www.colourlovers.com/palette/3647908/RGB_Ice_Cream + 0.847f*0.2f, 0.365f*0.2f, 0.408f*0.2f, 1.0f, + 0.976f*0.2f, 0.827f*0.2f, 0.533f*0.2f, 1.0f, + 0.533f*0.2f, 0.867f*0.2f, 0.741f*0.2f, 1.0f, + 0.894f*0.2f, 0.620f*0.2f, 0.416f*0.2f, 1.0f, + 0.584f*0.2f, 0.788f*0.2f, 0.882f*0.2f, 1.0f, + }; + + // Render a whole bunch of colored cubes to the g-buffer. + for (uint32_t xx = 0; xx < kNum; ++xx) + { + bgfx::setUniform(u_color, &color[4 * (xx % kNumColors)]); + + float mtx[16]; + + bx::mtxIdentity(mtx); + + const float tt = (float)xx / (float)kNum + 0.07f * time; + const float rr = bx::sin(0.47f * time * bx::kPi2) + 1.4f; + + mtx[12] = bx::sin(tt * bx::kPi2)*rr; + mtx[13] = bx::cos(tt * bx::kPi2)*rr; + mtx[14] = 0.2f * (float)xx / (float)kNum; + + // Set transform for draw call. + bgfx::setTransform(mtx); + + // Set vertex and index buffer. + bgfx::setVertexBuffer(0, m_vbh); + bgfx::setIndexBuffer(m_ibh); + + // Set render states. + bgfx::setState(0 + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z + | BGFX_STATE_DEPTH_TEST_LESS + | BGFX_STATE_MSAA + ); + + // Submit primitive for rendering to view 0. + bgfx::submit(RENDER_PASS_GEOMETRY_ID, m_geomProgram); + } + + // Now downsample. + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN-1; ++ii) + { + const float dim = float(1 << (ii + 1) ); + const float pixelSize[4] = + { + 1.0f / (m_width / dim), + 1.0f / (m_height / dim), + 0.0f, + 0.0f, + }; + + bgfx::setUniform(u_pixelSize, pixelSize); + bgfx::setTexture(0, s_tex, bgfx::getTexture(m_texChainFb[ii]) ); + + bgfx::setState(0 + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + ); + + screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + bgfx::submit(RENDER_PASS_DOWNSAMPLE0_ID + ii, m_downsampleProgram); + } + + // Now upsample. + for (uint16_t ii = 0; ii < TEX_CHAIN_LEN - 1; ++ii) + { + const float dim = float(1 << (TEX_CHAIN_LEN - 2 - ii) ); + + const float pixelSize[4] = + { + 1.0f / (float)(m_width / dim), + 1.0f / (float)(m_height / dim), + 0.0f, + 0.0f, + }; + const float intensity[4] = { m_intensity, 0.0f, 0.0f, 0.0f }; + + bgfx::setUniform(u_pixelSize, pixelSize); + bgfx::setUniform(u_intensity, intensity); + + // Combine color and light buffers. + bgfx::setTexture(0, s_tex, bgfx::getTexture(m_texChainFb[TEX_CHAIN_LEN - 1 - ii]) ); + + // As we upscale, we also sum with the previous mip level. We do this by alpha blending. + bgfx::setState(0 + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_ADD + ); + + screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + bgfx::submit(RENDER_PASS_UPSAMPLE0_ID + ii, m_upsampleProgram); + } + + // Do final pass, that combines the bloom with the g-buffer. + bgfx::setTexture(0, s_albedo, bgfx::getTexture(m_gbuffer, 0) ); + bgfx::setTexture(1, s_light, bgfx::getTexture(m_texChainFb[0]) ); + bgfx::setState(0 + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + ); + screenSpaceQuad( (float)m_width, (float)m_height, s_texelHalf, m_caps->originBottomLeft); + bgfx::submit(RENDER_PASS_COMBINE_ID, m_combineProgram); + } + + imguiEndFrame(); + + // Advance to next frame. Rendering thread will be kicked to + // process submitted rendering primitives. + bgfx::frame(); + + return true; + } + + return false; + } + + bgfx::VertexBufferHandle m_vbh; + bgfx::IndexBufferHandle m_ibh; + + bgfx::UniformHandle s_albedo; + bgfx::UniformHandle s_tex; + bgfx::UniformHandle s_depth; + bgfx::UniformHandle s_light; + bgfx::UniformHandle u_pixelSize; + bgfx::UniformHandle u_intensity; + bgfx::UniformHandle u_color; + + + bgfx::UniformHandle u_mtx; + + bgfx::ProgramHandle m_geomProgram; + bgfx::ProgramHandle m_downsampleProgram; + bgfx::ProgramHandle m_upsampleProgram; + bgfx::ProgramHandle m_combineProgram; + + bgfx::FrameBufferHandle m_gbuffer; + bgfx::FrameBufferHandle m_texChainFb[TEX_CHAIN_LEN]; + + uint32_t m_width; + uint32_t m_height; + uint32_t m_debug; + uint32_t m_reset; + + float m_intensity = 1.0f; + + uint32_t m_oldWidth; + uint32_t m_oldHeight; + uint32_t m_oldReset; + + int32_t m_scrollArea; + + entry::MouseState m_mouseState; + + const bgfx::Caps* m_caps; + int64_t m_timeOffset; +}; + +} // namespace + +ENTRY_IMPLEMENT_MAIN(ExampleDeferred, "38-bloom", "Bloom."); diff --git a/3rdparty/bgfx/examples/38-bloom/fs_albedo_output.sc b/3rdparty/bgfx/examples/38-bloom/fs_albedo_output.sc new file mode 100644 index 00000000000..b445c1ef06a --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/fs_albedo_output.sc @@ -0,0 +1,20 @@ +$input v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 + +/* + * Copyright 2018 Eric Arnebäck. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +uniform vec4 u_color; + +void main() +{ + // the albedo-buffer of the g-buffer. + gl_FragData[0] = u_color; + + // for convenience, we also output the same color, to the first texture of the texture chain used for bloom. + // this color will now be bloomed, in the following passes. + gl_FragData[1] = u_color; +} diff --git a/3rdparty/bgfx/examples/38-bloom/fs_bloom_combine.sc b/3rdparty/bgfx/examples/38-bloom/fs_bloom_combine.sc new file mode 100644 index 00000000000..8e70488fe72 --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/fs_bloom_combine.sc @@ -0,0 +1,24 @@ +$input v_texcoord0 + +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +SAMPLER2D(s_albedo, 0); +SAMPLER2D(s_light, 1); + +void main() +{ + vec3 hdrColor = texture2D(s_albedo, v_texcoord0).rgb; + + hdrColor += texture2D(s_light, v_texcoord0).rgb; + + // instead of some fancy tonemapping operator, we just clamp it, to keep it simple. + vec3 finalColor = clamp(hdrColor, 0.0, 1.0); + + float g = 2.2; + gl_FragColor = vec4(pow(finalColor, vec3(1.0 / g, 1.0 / g, 1.0 / g) ), 1.0); +} diff --git a/3rdparty/bgfx/examples/38-bloom/fs_downsample.sc b/3rdparty/bgfx/examples/38-bloom/fs_downsample.sc new file mode 100644 index 00000000000..f9ec13a2913 --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/fs_downsample.sc @@ -0,0 +1,42 @@ +$input v_texcoord0 + +/* + * Copyright 2018 Eric Arnebäck. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +SAMPLER2D(s_tex, 0); + +// pixel size of the target texture. +uniform vec4 u_pixelSize; + +void main() +{ + vec2 halfpixel = 0.5 * vec2(u_pixelSize.x, u_pixelSize.y); + vec2 oneepixel = 1.0 * vec2(u_pixelSize.x, u_pixelSize.y); + + vec2 uv = v_texcoord0.xy; + + vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); + + sum += (4.0/32.0) * texture2D(s_tex, uv).rgba; + + sum += (4.0/32.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, -halfpixel.y) ); + sum += (4.0/32.0) * texture2D(s_tex, uv + vec2(+halfpixel.x, +halfpixel.y) ); + sum += (4.0/32.0) * texture2D(s_tex, uv + vec2(+halfpixel.x, -halfpixel.y) ); + sum += (4.0/32.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, +halfpixel.y) ); + + sum += (2.0/32.0) * texture2D(s_tex, uv + vec2(+oneepixel.x, 0.0) ); + sum += (2.0/32.0) * texture2D(s_tex, uv + vec2(-oneepixel.x, 0.0) ); + sum += (2.0/32.0) * texture2D(s_tex, uv + vec2(0.0, +oneepixel.y) ); + sum += (2.0/32.0) * texture2D(s_tex, uv + vec2(0.0, -oneepixel.y) ); + + sum += (1.0/32.0) * texture2D(s_tex, uv + vec2(+oneepixel.x, +oneepixel.y) ); + sum += (1.0/32.0) * texture2D(s_tex, uv + vec2(-oneepixel.x, +oneepixel.y) ); + sum += (1.0/32.0) * texture2D(s_tex, uv + vec2(+oneepixel.x, -oneepixel.y) ); + sum += (1.0/32.0) * texture2D(s_tex, uv + vec2(-oneepixel.x, -oneepixel.y) ); + + gl_FragColor.xyzw = sum; +} diff --git a/3rdparty/bgfx/examples/38-bloom/fs_upsample.sc b/3rdparty/bgfx/examples/38-bloom/fs_upsample.sc new file mode 100644 index 00000000000..54ac70a6191 --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/fs_upsample.sc @@ -0,0 +1,35 @@ +$input v_texcoord0 + +/* + * Copyright 2018 Eric Arnebäck. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +SAMPLER2D(s_tex, 0); + +uniform vec4 u_pixelSize; +uniform vec4 u_intensity; + +void main() +{ + vec2 halfpixel = u_pixelSize.xy; + vec2 uv = v_texcoord0.xy; + + vec4 sum = vec4_splat(0.0); + + sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, 0.0) ); + sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2( 0.0, halfpixel.y) ); + sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2( halfpixel.x, 0.0) ); + sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2( 0.0, -halfpixel.y) ); + + sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, -halfpixel.y) ); + sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, halfpixel.y) ); + sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2( halfpixel.x, -halfpixel.y) ); + sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2( halfpixel.x, halfpixel.y) ); + + sum += (4.0 / 16.0) * texture2D(s_tex, uv); + + gl_FragColor = u_intensity.x * sum; +} diff --git a/3rdparty/bgfx/examples/38-bloom/makefile b/3rdparty/bgfx/examples/38-bloom/makefile new file mode 100644 index 00000000000..171709170a4 --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/makefile @@ -0,0 +1,10 @@ +# +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. +# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause +# + +BGFX_DIR=../.. +RUNTIME_DIR=$(BGFX_DIR)/examples/runtime +BUILD_DIR=../../.build + +include $(BGFX_DIR)/scripts/shader.mk diff --git a/3rdparty/bgfx/examples/38-bloom/screenshot.png b/3rdparty/bgfx/examples/38-bloom/screenshot.png new file mode 100644 index 00000000000..7af87412079 Binary files /dev/null and b/3rdparty/bgfx/examples/38-bloom/screenshot.png differ diff --git a/3rdparty/bgfx/examples/38-bloom/varying.def.sc b/3rdparty/bgfx/examples/38-bloom/varying.def.sc new file mode 100644 index 00000000000..4fb6fcf95fa --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/varying.def.sc @@ -0,0 +1,13 @@ +vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0); +vec3 v_wpos : TEXCOORD1 = vec3(0.0, 0.0, 0.0); +vec3 v_view : TEXCOORD2 = vec3(0.0, 0.0, 0.0); +vec3 v_normal : NORMAL = vec3(0.0, 0.0, 1.0); +vec3 v_tangent : TANGENT = vec3(1.0, 0.0, 0.0); +vec3 v_bitangent : BINORMAL = vec3(0.0, 1.0, 0.0); +vec4 v_color0 : COLOR = vec4(1.0, 0.0, 0.0, 1.0); + +vec3 a_position : POSITION; +vec4 a_normal : NORMAL; +vec4 a_tangent : TANGENT; +vec2 a_texcoord0 : TEXCOORD0; +vec4 a_color0 : COLOR0; diff --git a/3rdparty/bgfx/examples/38-bloom/vs_albedo_output.sc b/3rdparty/bgfx/examples/38-bloom/vs_albedo_output.sc new file mode 100644 index 00000000000..d526a026187 --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/vs_albedo_output.sc @@ -0,0 +1,17 @@ +$input a_position, a_normal, a_tangent, a_texcoord0 +$output v_wpos, v_view, v_normal, v_tangent, v_bitangent, v_texcoord0 + +/* + * Copyright 2018 Eric Arnebäck. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +void main() +{ + vec3 wpos = mul(u_model[0], vec4(a_position, 1.0) ).xyz; + gl_Position = mul(u_viewProj, vec4(wpos, 1.0) ); + + v_texcoord0 = a_texcoord0; +} diff --git a/3rdparty/bgfx/examples/38-bloom/vs_deferred_combine.sc b/3rdparty/bgfx/examples/38-bloom/vs_deferred_combine.sc new file mode 100644 index 00000000000..8c3b7a822b6 --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/vs_deferred_combine.sc @@ -0,0 +1,15 @@ +$input a_position, a_texcoord0 +$output v_texcoord0 + +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_texcoord0 = a_texcoord0; +} diff --git a/3rdparty/bgfx/examples/38-bloom/vs_fullscreen.sc b/3rdparty/bgfx/examples/38-bloom/vs_fullscreen.sc new file mode 100644 index 00000000000..0e6a23be15d --- /dev/null +++ b/3rdparty/bgfx/examples/38-bloom/vs_fullscreen.sc @@ -0,0 +1,15 @@ +$input a_position, a_texcoord0 +$output v_texcoord0 + +/* + * Copyright 2018 Eric Arnebäck. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "../common/common.sh" + +void main() +{ + gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) ); + v_texcoord0 = a_texcoord0; +} diff --git a/3rdparty/bgfx/examples/assets/textures/textures.ninja b/3rdparty/bgfx/examples/assets/textures/textures.ninja index bc7f67c510f..ee31be41d2b 100644 --- a/3rdparty/bgfx/examples/assets/textures/textures.ninja +++ b/3rdparty/bgfx/examples/assets/textures/textures.ninja @@ -3,10 +3,12 @@ textures = $pwd/../../runtime/textures build $textures/texture_compression_bc1.ktx: texturec_bc1 $pwd/texture_compression.png build $textures/texture_compression_bc2.ktx: texturec_bc2 $pwd/texture_compression.png build $textures/texture_compression_bc3.ktx: texturec_bc3 $pwd/texture_compression.png +build $textures/texture_compression_bc7.ktx: texturec_bc7 $pwd/texture_compression.png build $textures/texture_compression_etc1.ktx: texturec_etc1 $pwd/texture_compression.png build $textures/texture_compression_etc2.ktx: texturec_etc2 $pwd/texture_compression.png -build $textures/parallax-d.ktx: texturec_diffuse $pwd/parallax-d.png -build $textures/parallax-n.ktx: texturec_normal $pwd/parallax-n.png -build $textures/parallax-h.ktx: texturec_height $pwd/parallax-h.png -build $textures/lightmap.ktx: texturec_height $pwd/../sky/lightmap.png +build $textures/parallax-d.ktx: texturec_diffuse $pwd/parallax-d.png +build $textures/parallax-n.ktx: texturec_normal $pwd/parallax-n.png +build $textures/parallax-h.ktx: texturec_height $pwd/parallax-h.png +build $textures/lightmap.ktx: texturec_height $pwd/../sky/lightmap.png +build $textures/uffizi.ktx: texturec_equirect $pwd/uffizi-large.exr diff --git a/3rdparty/bgfx/examples/assets/textures/uffizi-large.exr b/3rdparty/bgfx/examples/assets/textures/uffizi-large.exr new file mode 100644 index 00000000000..f93148c4fa7 Binary files /dev/null and b/3rdparty/bgfx/examples/assets/textures/uffizi-large.exr differ diff --git a/3rdparty/bgfx/examples/common/aviwriter.h b/3rdparty/bgfx/examples/common/aviwriter.h index 41bd1ab97eb..554e7166e24 100644 --- a/3rdparty/bgfx/examples/common/aviwriter.h +++ b/3rdparty/bgfx/examples/common/aviwriter.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp index befcd32505b..fd3b87251c5 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp +++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -207,7 +207,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath, , mem ); } - else + else if (bgfx::isTextureValid(0, false, imageContainer->m_numLayers, bgfx::TextureFormat::Enum(imageContainer->m_format), _flags) ) { handle = bgfx::createTexture2D( uint16_t(imageContainer->m_width) @@ -220,7 +220,10 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _filePath, ); } - bgfx::setName(handle, _filePath); + if (bgfx::isValid(handle) ) + { + bgfx::setName(handle, _filePath); + } if (NULL != _info) { @@ -552,9 +555,9 @@ struct Mesh if (BGFX_STATE_MASK == _state) { _state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CCW | BGFX_STATE_MSAA @@ -676,7 +679,7 @@ Args::Args(int _argc, const char* const* _argv) { m_type = bgfx::RendererType::Noop; } - else if (BX_ENABLED(BX_PLATFORM_WINDOWS) ) + else if (BX_ENABLED(BX_PLATFORM_WINDOWS|BX_PLATFORM_WINRT|BX_PLATFORM_XBOXONE) ) { if (cmdLine.hasArg("d3d9") ) { diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.h b/3rdparty/bgfx/examples/common/bgfx_utils.h index 5fba167bc85..87799f2e2c4 100644 --- a/3rdparty/bgfx/examples/common/bgfx_utils.h +++ b/3rdparty/bgfx/examples/common/bgfx_utils.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -23,7 +23,7 @@ bgfx::ShaderHandle loadShader(const char* _name); bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); /// -bgfx::TextureHandle loadTexture(const char* _name, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, bgfx::TextureInfo* _info = NULL, bimg::Orientation::Enum* _orientation = NULL); +bgfx::TextureHandle loadTexture(const char* _name, uint32_t _flags = BGFX_SAMPLER_NONE, uint8_t _skip = 0, bgfx::TextureInfo* _info = NULL, bimg::Orientation::Enum* _orientation = NULL); /// bimg::ImageContainer* imageLoad(const char* _filePath, bgfx::TextureFormat::Enum _dstFormat); @@ -41,7 +41,7 @@ void calcTangents(void* _vertices, uint16_t _numVertices, bgfx::VertexDecl _decl inline bool checkAvailTransientBuffers(uint32_t _numVertices, const bgfx::VertexDecl& _decl, uint32_t _numIndices) { return _numVertices == bgfx::getAvailTransientVertexBuffer(_numVertices, _decl) - && _numIndices == bgfx::getAvailTransientIndexBuffer(_numIndices) + && (0 == _numIndices || _numIndices == bgfx::getAvailTransientIndexBuffer(_numIndices) ) ; } diff --git a/3rdparty/bgfx/examples/common/bounds.cpp b/3rdparty/bgfx/examples/common/bounds.cpp index b8cfc54168e..2d73dfcb973 100644 --- a/3rdparty/bgfx/examples/common/bounds.cpp +++ b/3rdparty/bgfx/examples/common/bounds.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -10,102 +10,90 @@ void aabbToObb(Obb& _obb, const Aabb& _aabb) { bx::memSet(_obb.m_mtx, 0, sizeof(_obb.m_mtx) ); - _obb.m_mtx[ 0] = (_aabb.m_max[0] - _aabb.m_min[0]) * 0.5f; - _obb.m_mtx[ 5] = (_aabb.m_max[1] - _aabb.m_min[1]) * 0.5f; - _obb.m_mtx[10] = (_aabb.m_max[2] - _aabb.m_min[2]) * 0.5f; - _obb.m_mtx[12] = (_aabb.m_min[0] + _aabb.m_max[0]) * 0.5f; - _obb.m_mtx[13] = (_aabb.m_min[1] + _aabb.m_max[1]) * 0.5f; - _obb.m_mtx[14] = (_aabb.m_min[2] + _aabb.m_max[2]) * 0.5f; + _obb.m_mtx[ 0] = (_aabb.m_max.x - _aabb.m_min.x) * 0.5f; + _obb.m_mtx[ 5] = (_aabb.m_max.y - _aabb.m_min.y) * 0.5f; + _obb.m_mtx[10] = (_aabb.m_max.z - _aabb.m_min.z) * 0.5f; + _obb.m_mtx[12] = (_aabb.m_min.x + _aabb.m_max.x) * 0.5f; + _obb.m_mtx[13] = (_aabb.m_min.y + _aabb.m_max.y) * 0.5f; + _obb.m_mtx[14] = (_aabb.m_min.z + _aabb.m_max.z) * 0.5f; _obb.m_mtx[15] = 1.0f; } void toAabb(Aabb& _aabb, const Obb& _obb) { - float xyz[3] = { 1.0f, 1.0f, 1.0f }; + bx::Vec3 xyz = { 1.0f, 1.0f, 1.0f }; + bx::Vec3 tmp = bx::mul(xyz, _obb.m_mtx); - float tmp[3]; - bx::vec3MulMtx(tmp, xyz, _obb.m_mtx); - - bx::vec3Move(_aabb.m_min, tmp); - bx::vec3Move(_aabb.m_max, tmp); + _aabb.m_min = tmp; + _aabb.m_max = tmp; for (uint32_t ii = 1; ii < 8; ++ii) { - xyz[0] = ii & 1 ? -1.0f : 1.0f; - xyz[1] = ii & 2 ? -1.0f : 1.0f; - xyz[2] = ii & 4 ? -1.0f : 1.0f; - bx::vec3MulMtx(tmp, xyz, _obb.m_mtx); + xyz.x = ii & 1 ? -1.0f : 1.0f; + xyz.y = ii & 2 ? -1.0f : 1.0f; + xyz.z = ii & 4 ? -1.0f : 1.0f; + tmp = bx::mul(xyz, _obb.m_mtx); - bx::vec3Min(_aabb.m_min, _aabb.m_min, tmp); - bx::vec3Max(_aabb.m_max, _aabb.m_max, tmp); + _aabb.m_min = bx::min(_aabb.m_min, tmp); + _aabb.m_max = bx::max(_aabb.m_max, tmp); } } void toAabb(Aabb& _aabb, const Sphere& _sphere) { - float radius = _sphere.m_radius; - bx::vec3Sub(_aabb.m_min, _sphere.m_center, radius); - bx::vec3Add(_aabb.m_max, _sphere.m_center, radius); + const float radius = _sphere.m_radius; + _aabb.m_min = bx::sub(_sphere.m_center, radius); + _aabb.m_max = bx::add(_sphere.m_center, radius); } void toAabb(Aabb& _aabb, const Disk& _disk) { - // Reference: http://iquilezles.org/www/articles/diskbbox/diskbbox.htm - float nsq[3]; - bx::vec3Mul(nsq, _disk.m_normal, _disk.m_normal); + // Reference(s): + // - https://web.archive.org/web/20181113055756/http://iquilezles.org/www/articles/diskbbox/diskbbox.htm + // + const bx::Vec3 nsq = bx::mul(_disk.m_normal, _disk.m_normal); + const bx::Vec3 one = { 1.0f, 1.0f, 1.0f }; + const bx::Vec3 tmp = bx::sub(one, nsq); + const float inv = 1.0f / (tmp.x*tmp.y*tmp.z); - float one[3] = { 1.0f, 1.0f, 1.0f }; - float tmp[3]; - bx::vec3Sub(tmp, one, nsq); + const bx::Vec3 extent = + { + _disk.m_radius * tmp.x * bx::sqrt((nsq.x + nsq.y * nsq.z) * inv), + _disk.m_radius * tmp.y * bx::sqrt((nsq.y + nsq.z * nsq.x) * inv), + _disk.m_radius * tmp.z * bx::sqrt((nsq.z + nsq.x * nsq.y) * inv), + }; - const float inv = 1.0f / (tmp[0]*tmp[1]*tmp[2]); - - float extent[3]; - extent[0] = _disk.m_radius * tmp[0] * bx::fsqrt( (nsq[0] + nsq[1] * nsq[2]) * inv); - extent[1] = _disk.m_radius * tmp[1] * bx::fsqrt( (nsq[1] + nsq[2] * nsq[0]) * inv); - extent[2] = _disk.m_radius * tmp[2] * bx::fsqrt( (nsq[2] + nsq[0] * nsq[1]) * inv); - - bx::vec3Sub(_aabb.m_min, _disk.m_center, extent); - bx::vec3Add(_aabb.m_max, _disk.m_center, extent); + _aabb.m_min = bx::sub(_disk.m_center, extent); + _aabb.m_max = bx::add(_disk.m_center, extent); } void toAabb(Aabb& _aabb, const Cylinder& _cylinder) { - // Reference: http://iquilezles.org/www/articles/diskbbox/diskbbox.htm - float axis[3]; - bx::vec3Sub(axis, _cylinder.m_end, _cylinder.m_pos); + // Reference(s): + // - https://web.archive.org/web/20181113055756/http://iquilezles.org/www/articles/diskbbox/diskbbox.htm + // + const bx::Vec3 axis = bx::sub(_cylinder.m_end, _cylinder.m_pos); + const bx::Vec3 asq = bx::mul(axis, axis); + const bx::Vec3 nsq = bx::mul(asq, 1.0f/bx::dot(axis, axis) ); + const bx::Vec3 one = { 1.0f, 1.0f, 1.0f }; + const bx::Vec3 tmp = bx::sub(one, nsq); - float asq[3]; - bx::vec3Mul(asq, axis, axis); + const float inv = 1.0f / (tmp.x*tmp.y*tmp.z); - float nsq[3]; - bx::vec3Mul(nsq, asq, 1.0f/bx::vec3Dot(axis, axis) ); + const bx::Vec3 extent = + { + _cylinder.m_radius * tmp.x * bx::sqrt( (nsq.x + nsq.y * nsq.z) * inv), + _cylinder.m_radius * tmp.y * bx::sqrt( (nsq.y + nsq.z * nsq.x) * inv), + _cylinder.m_radius * tmp.z * bx::sqrt( (nsq.z + nsq.x * nsq.y) * inv), + }; - float one[3] = { 1.0f, 1.0f, 1.0f }; - float tmp[3]; - bx::vec3Sub(tmp, one, nsq); + const bx::Vec3 minP = bx::sub(_cylinder.m_pos, extent); + const bx::Vec3 minE = bx::sub(_cylinder.m_end, extent); + const bx::Vec3 maxP = bx::add(_cylinder.m_pos, extent); + const bx::Vec3 maxE = bx::add(_cylinder.m_end, extent); - const float inv = 1.0f / (tmp[0]*tmp[1]*tmp[2]); - - float extent[3]; - extent[0] = _cylinder.m_radius * tmp[0] * bx::fsqrt( (nsq[0] + nsq[1] * nsq[2]) * inv); - extent[1] = _cylinder.m_radius * tmp[1] * bx::fsqrt( (nsq[1] + nsq[2] * nsq[0]) * inv); - extent[2] = _cylinder.m_radius * tmp[2] * bx::fsqrt( (nsq[2] + nsq[0] * nsq[1]) * inv); - - float minP[3]; - bx::vec3Sub(minP, _cylinder.m_pos, extent); - - float minE[3]; - bx::vec3Sub(minE, _cylinder.m_end, extent); - - float maxP[3]; - bx::vec3Add(maxP, _cylinder.m_pos, extent); - - float maxE[3]; - bx::vec3Add(maxE, _cylinder.m_end, extent); - - bx::vec3Min(_aabb.m_min, minP, minE); - bx::vec3Max(_aabb.m_max, maxP, maxE); + _aabb.m_min = bx::min(minP, minE); + _aabb.m_max = bx::max(maxP, maxE); } void aabbTransformToObb(Obb& _obb, const Aabb& _aabb, const float* _mtx) @@ -118,12 +106,12 @@ void aabbTransformToObb(Obb& _obb, const Aabb& _aabb, const float* _mtx) void toAabb(Aabb& _aabb, const void* _vertices, uint32_t _numVertices, uint32_t _stride) { - float min[3], max[3]; + bx::Vec3 min, max; uint8_t* vertex = (uint8_t*)_vertices; float* position = (float*)vertex; - min[0] = max[0] = position[0]; - min[1] = max[1] = position[1]; - min[2] = max[2] = position[2]; + min.x = max.x = position[0]; + min.y = max.y = position[1]; + min.z = max.z = position[2]; vertex += _stride; for (uint32_t ii = 1; ii < _numVertices; ++ii) @@ -131,35 +119,30 @@ void toAabb(Aabb& _aabb, const void* _vertices, uint32_t _numVertices, uint32_t position = (float*)vertex; vertex += _stride; - float xx = position[0]; - float yy = position[1]; - float zz = position[2]; - min[0] = bx::fmin(xx, min[0]); - min[1] = bx::fmin(yy, min[1]); - min[2] = bx::fmin(zz, min[2]); - max[0] = bx::fmax(xx, max[0]); - max[1] = bx::fmax(yy, max[1]); - max[2] = bx::fmax(zz, max[2]); + bx::Vec3 pos = + { + position[0], + position[1], + position[2], + }; + min = bx::min(pos, min); + max = bx::max(pos, max); } - _aabb.m_min[0] = min[0]; - _aabb.m_min[1] = min[1]; - _aabb.m_min[2] = min[2]; - _aabb.m_max[0] = max[0]; - _aabb.m_max[1] = max[1]; - _aabb.m_max[2] = max[2]; + _aabb.m_min = min; + _aabb.m_max = max; } void toAabb(Aabb& _aabb, const float* _mtx, const void* _vertices, uint32_t _numVertices, uint32_t _stride) { - float min[3], max[3]; + bx::Vec3 min, max; uint8_t* vertex = (uint8_t*)_vertices; float position[3]; bx::vec3MulMtx(position, (float*)vertex, _mtx); - min[0] = max[0] = position[0]; - min[1] = max[1] = position[1]; - min[2] = max[2] = position[2]; + min.x = max.x = position[0]; + min.y = max.y = position[1]; + min.z = max.z = position[2]; vertex += _stride; for (uint32_t ii = 1; ii < _numVertices; ++ii) @@ -167,57 +150,53 @@ void toAabb(Aabb& _aabb, const float* _mtx, const void* _vertices, uint32_t _num bx::vec3MulMtx(position, (float*)vertex, _mtx); vertex += _stride; - float xx = position[0]; - float yy = position[1]; - float zz = position[2]; - min[0] = bx::fmin(xx, min[0]); - min[1] = bx::fmin(yy, min[1]); - min[2] = bx::fmin(zz, min[2]); - max[0] = bx::fmax(xx, max[0]); - max[1] = bx::fmax(yy, max[1]); - max[2] = bx::fmax(zz, max[2]); + bx::Vec3 pos = + { + position[0], + position[1], + position[2], + }; + min = bx::min(pos, min); + max = bx::max(pos, max); } - _aabb.m_min[0] = min[0]; - _aabb.m_min[1] = min[1]; - _aabb.m_min[2] = min[2]; - _aabb.m_max[0] = max[0]; - _aabb.m_max[1] = max[1]; - _aabb.m_max[2] = max[2]; + _aabb.m_min = min; + _aabb.m_max = max; } float calcAreaAabb(const Aabb& _aabb) { - float ww = _aabb.m_max[0] - _aabb.m_min[0]; - float hh = _aabb.m_max[1] - _aabb.m_min[1]; - float dd = _aabb.m_max[2] - _aabb.m_min[2]; + const float ww = _aabb.m_max.x - _aabb.m_min.x; + const float hh = _aabb.m_max.y - _aabb.m_min.y; + const float dd = _aabb.m_max.z - _aabb.m_min.z; return 2.0f * (ww*hh + ww*dd + hh*dd); } void aabbExpand(Aabb& _aabb, float _factor) { - _aabb.m_min[0] -= _factor; - _aabb.m_min[1] -= _factor; - _aabb.m_min[2] -= _factor; - _aabb.m_max[0] += _factor; - _aabb.m_max[1] += _factor; - _aabb.m_max[2] += _factor; + _aabb.m_min.x -= _factor; + _aabb.m_min.y -= _factor; + _aabb.m_min.z -= _factor; + _aabb.m_max.x += _factor; + _aabb.m_max.y += _factor; + _aabb.m_max.z += _factor; } void aabbExpand(Aabb& _aabb, const float* _pos) { - bx::vec3Min(_aabb.m_min, _aabb.m_min, _pos); - bx::vec3Max(_aabb.m_max, _aabb.m_max, _pos); + const bx::Vec3 pos = { _pos[0], _pos[1], _pos[2] }; + _aabb.m_min = bx::min(_aabb.m_min, pos); + _aabb.m_max = bx::max(_aabb.m_max, pos); } uint32_t aabbOverlapTest(const Aabb& _aabb0, const Aabb& _aabb1) { - const uint32_t ltMinX = _aabb0.m_max[0] < _aabb1.m_min[0]; - const uint32_t gtMaxX = _aabb0.m_min[0] > _aabb1.m_max[0]; - const uint32_t ltMinY = _aabb0.m_max[1] < _aabb1.m_min[1]; - const uint32_t gtMaxY = _aabb0.m_min[1] > _aabb1.m_max[1]; - const uint32_t ltMinZ = _aabb0.m_max[2] < _aabb1.m_min[2]; - const uint32_t gtMaxZ = _aabb0.m_min[2] > _aabb1.m_max[2]; + const uint32_t ltMinX = _aabb0.m_max.x < _aabb1.m_min.x; + const uint32_t gtMaxX = _aabb0.m_min.x > _aabb1.m_max.x; + const uint32_t ltMinY = _aabb0.m_max.y < _aabb1.m_min.y; + const uint32_t gtMaxY = _aabb0.m_min.y > _aabb1.m_max.y; + const uint32_t ltMinZ = _aabb0.m_max.z < _aabb1.m_min.z; + const uint32_t gtMaxZ = _aabb0.m_min.z > _aabb1.m_max.z; return 0 | (ltMinX<<0) @@ -282,10 +261,12 @@ void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num Aabb aabb; toAabb(aabb, _vertices, _numVertices, _stride); - float center[3]; - center[0] = (aabb.m_min[0] + aabb.m_max[0]) * 0.5f; - center[1] = (aabb.m_min[1] + aabb.m_max[1]) * 0.5f; - center[2] = (aabb.m_min[2] + aabb.m_max[2]) * 0.5f; + bx::Vec3 center = + { + (aabb.m_min.x + aabb.m_max.x) * 0.5f, + (aabb.m_min.y + aabb.m_max.y) * 0.5f, + (aabb.m_min.z + aabb.m_max.z) * 0.5f, + }; float maxDistSq = 0.0f; uint8_t* vertex = (uint8_t*)_vertices; @@ -295,16 +276,15 @@ void calcMaxBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num float* position = (float*)vertex; vertex += _stride; - float xx = position[0] - center[0]; - float yy = position[1] - center[1]; - float zz = position[2] - center[2]; - - float distSq = xx*xx + yy*yy + zz*zz; - maxDistSq = bx::fmax(distSq, maxDistSq); + const float xx = position[0] - center.x; + const float yy = position[1] - center.y; + const float zz = position[2] - center.z; + const float distSq = xx*xx + yy*yy + zz*zz; + maxDistSq = bx::max(distSq, maxDistSq); } - bx::vec3Move(_sphere.m_center, center); - _sphere.m_radius = bx::fsqrt(maxDistSq); + _sphere.m_center = center; + _sphere.m_radius = bx::sqrt(maxDistSq); } void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _numVertices, uint32_t _stride, float _step) @@ -313,22 +293,24 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num uint8_t* vertex = (uint8_t*)_vertices; - float center[3]; + bx::Vec3 center; float* position = (float*)&vertex[0]; - bx::vec3Move(center, position); + center.x = position[0]; + center.y = position[1]; + center.z = position[2]; position = (float*)&vertex[1*_stride]; - center[0] += position[0]; - center[1] += position[1]; - center[2] += position[2]; + center.x += position[0]; + center.y += position[1]; + center.z += position[2]; - center[0] *= 0.5f; - center[1] *= 0.5f; - center[2] *= 0.5f; + center.x *= 0.5f; + center.y *= 0.5f; + center.z *= 0.5f; - float xx = position[0] - center[0]; - float yy = position[1] - center[1]; - float zz = position[2] - center[2]; + float xx = position[0] - center.x; + float yy = position[1] - center.y; + float zz = position[2] - center.z; float maxDistSq = xx*xx + yy*yy + zz*zz; float radiusStep = _step * 0.37f; @@ -341,19 +323,19 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num { position = (float*)&vertex[index*_stride]; - xx = position[0] - center[0]; - yy = position[1] - center[1]; - zz = position[2] - center[2]; + xx = position[0] - center.x; + yy = position[1] - center.y; + zz = position[2] - center.z; float distSq = xx*xx + yy*yy + zz*zz; if (distSq > maxDistSq) { done = false; - center[0] += xx * radiusStep; - center[1] += yy * radiusStep; - center[2] += zz * radiusStep; - maxDistSq = bx::flerp(maxDistSq, distSq, _step); + center.x += xx * radiusStep; + center.y += yy * radiusStep; + center.z += zz * radiusStep; + maxDistSq = bx::lerp(maxDistSq, distSq, _step); break; } @@ -361,13 +343,13 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num } while (!done); - bx::vec3Move(_sphere.m_center, center); - _sphere.m_radius = bx::fsqrt(maxDistSq); + _sphere.m_center = center; + _sphere.m_radius = bx::sqrt(maxDistSq); } -void calcPlaneUv(const Plane& _plane, float* _udir, float* _vdir) +void calcPlaneUv(const Plane& _plane, bx::Vec3& _udir, bx::Vec3& _vdir) { - bx::vec3TangentFrame(_plane.m_normal, _udir, _vdir); + bx::calcTangentFrame(_udir, _vdir, _plane.m_normal); } void buildFrustumPlanes(Plane* _result, const float* _viewProj) @@ -389,131 +371,108 @@ void buildFrustumPlanes(Plane* _result, const float* _viewProj) Plane& top = _result[4]; Plane& bottom = _result[5]; - near.m_normal[0] = xw - xz; - near.m_normal[1] = yw - yz; - near.m_normal[2] = zw - zz; - near.m_dist = ww - wz; + near.m_normal.x = xw - xz; + near.m_normal.y = yw - yz; + near.m_normal.z = zw - zz; + near.m_dist = ww - wz; - far.m_normal[0] = xw + xz; - far.m_normal[1] = yw + yz; - far.m_normal[2] = zw + zz; - far.m_dist = ww + wz; + far.m_normal.x = xw + xz; + far.m_normal.y = yw + yz; + far.m_normal.z = zw + zz; + far.m_dist = ww + wz; const float xx = _viewProj[ 0]; const float yx = _viewProj[ 4]; const float zx = _viewProj[ 8]; const float wx = _viewProj[12]; - left.m_normal[0] = xw - xx; - left.m_normal[1] = yw - yx; - left.m_normal[2] = zw - zx; - left.m_dist = ww - wx; + left.m_normal.x = xw - xx; + left.m_normal.y = yw - yx; + left.m_normal.z = zw - zx; + left.m_dist = ww - wx; - right.m_normal[0] = xw + xx; - right.m_normal[1] = yw + yx; - right.m_normal[2] = zw + zx; - right.m_dist = ww + wx; + right.m_normal.x = xw + xx; + right.m_normal.y = yw + yx; + right.m_normal.z = zw + zx; + right.m_dist = ww + wx; const float xy = _viewProj[ 1]; const float yy = _viewProj[ 5]; const float zy = _viewProj[ 9]; const float wy = _viewProj[13]; - top.m_normal[0] = xw + xy; - top.m_normal[1] = yw + yy; - top.m_normal[2] = zw + zy; - top.m_dist = ww + wy; + top.m_normal.x = xw + xy; + top.m_normal.y = yw + yy; + top.m_normal.z = zw + zy; + top.m_dist = ww + wy; - bottom.m_normal[0] = xw - xy; - bottom.m_normal[1] = yw - yy; - bottom.m_normal[2] = zw - zy; + bottom.m_normal.x = xw - xy; + bottom.m_normal.y = yw - yy; + bottom.m_normal.z = zw - zy; bottom.m_dist = ww - wy; Plane* plane = _result; for (uint32_t ii = 0; ii < 6; ++ii) { - float invLen = 1.0f / bx::vec3Norm(plane->m_normal, plane->m_normal); + const float len = bx::length(plane->m_normal); + plane->m_normal = bx::normalize(plane->m_normal); + float invLen = 1.0f / len; plane->m_dist *= invLen; ++plane; } } -void intersectPlanes(float _result[3], const Plane& _pa, const Plane& _pb, const Plane& _pc) +bx::Vec3 intersectPlanes(const Plane& _pa, const Plane& _pb, const Plane& _pc) { - float axb[3]; - bx::vec3Cross(axb, _pa.m_normal, _pb.m_normal); + const bx::Vec3 axb = bx::cross(_pa.m_normal, _pb.m_normal); + const bx::Vec3 bxc = bx::cross(_pb.m_normal, _pc.m_normal); + const bx::Vec3 cxa = bx::cross(_pc.m_normal, _pa.m_normal); + const bx::Vec3 tmp0 = bx::mul(bxc, _pa.m_dist); + const bx::Vec3 tmp1 = bx::mul(cxa, _pb.m_dist); + const bx::Vec3 tmp2 = bx::mul(axb, _pc.m_dist); + const bx::Vec3 tmp3 = bx::add(tmp0, tmp1); + const bx::Vec3 tmp4 = bx::add(tmp3, tmp2); - float bxc[3]; - bx::vec3Cross(bxc, _pb.m_normal, _pc.m_normal); + const float denom = bx::dot(_pa.m_normal, bxc); + const bx::Vec3 result = bx::mul(tmp4, -1.0f/denom); - float cxa[3]; - bx::vec3Cross(cxa, _pc.m_normal, _pa.m_normal); - - float tmp0[3]; - bx::vec3Mul(tmp0, bxc, _pa.m_dist); - - float tmp1[3]; - bx::vec3Mul(tmp1, cxa, _pb.m_dist); - - float tmp2[3]; - bx::vec3Mul(tmp2, axb, _pc.m_dist); - - float tmp[3]; - bx::vec3Add(tmp, tmp0, tmp1); - bx::vec3Add(tmp0, tmp, tmp2); - - float denom = bx::vec3Dot(_pa.m_normal, bxc); - bx::vec3Mul(_result, tmp0, -1.0f/denom); + return result; } Ray makeRay(float _x, float _y, const float* _invVp) { Ray ray; - const float near[3] = { _x, _y, 0.0f }; - bx::vec3MulMtxH(ray.m_pos, near, _invVp); + const bx::Vec3 near = { _x, _y, 0.0f }; + ray.m_pos = bx::mulH(near, _invVp); - float tmp[3]; - const float far[3] = { _x, _y, 1.0f }; - bx::vec3MulMtxH(tmp, far, _invVp); + const bx::Vec3 far = { _x, _y, 1.0f }; + bx::Vec3 tmp = bx::mulH(far, _invVp); - float dir[3]; - bx::vec3Sub(dir, tmp, ray.m_pos); - bx::vec3Norm(ray.m_dir, dir); + const bx::Vec3 dir = bx::sub(tmp, ray.m_pos); + ray.m_dir = bx::normalize(dir); return ray; } -inline void getPointAt(float* _result, const Ray& _ray, float _t) +inline bx::Vec3 getPointAt(const Ray& _ray, float _t) { - float tmp[3]; - bx::vec3Mul(tmp, _ray.m_dir, _t); - bx::vec3Add(_result, _ray.m_pos, tmp); + return bx::add(bx::mul(_ray.m_dir, _t), _ray.m_pos); } bool intersect(const Ray& _ray, const Aabb& _aabb, Hit* _hit) { - float invDir[3]; - bx::vec3Rcp(invDir, _ray.m_dir); + const bx::Vec3 invDir = bx::rcp(_ray.m_dir); + const bx::Vec3 tmp0 = bx::sub(_aabb.m_min, _ray.m_pos); + const bx::Vec3 t0 = bx::mul(tmp0, invDir); + const bx::Vec3 tmp1 = bx::sub(_aabb.m_max, _ray.m_pos); + const bx::Vec3 t1 = bx::mul(tmp1, invDir); - float tmp[3]; + const bx::Vec3 min = bx::min(t0, t1); + const bx::Vec3 max = bx::max(t0, t1); - float t0[3]; - bx::vec3Sub(tmp, _aabb.m_min, _ray.m_pos); - bx::vec3Mul(t0, tmp, invDir); - - float t1[3]; - bx::vec3Sub(tmp, _aabb.m_max, _ray.m_pos); - bx::vec3Mul(t1, tmp, invDir); - - float min[3]; - bx::vec3Min(min, t0, t1); - - float max[3]; - bx::vec3Max(max, t0, t1); - - const float tmin = bx::fmax3(min[0], min[1], min[2]); - const float tmax = bx::fmin3(max[0], max[1], max[2]); + const float tmin = bx::max(min.x, min.y, min.z); + const float tmax = bx::min(max.x, max.y, max.z); if (tmax < 0.0f || tmin > tmax) @@ -523,12 +482,12 @@ bool intersect(const Ray& _ray, const Aabb& _aabb, Hit* _hit) if (NULL != _hit) { - _hit->m_normal[0] = float( (t1[0] == tmin) - (t0[0] == tmin) ); - _hit->m_normal[1] = float( (t1[1] == tmin) - (t0[1] == tmin) ); - _hit->m_normal[2] = float( (t1[2] == tmin) - (t0[2] == tmin) ); + _hit->m_normal.x = float( (t1.x == tmin) - (t0.x == tmin) ); + _hit->m_normal.y = float( (t1.y == tmin) - (t0.y == tmin) ); + _hit->m_normal.z = float( (t1.z == tmin) - (t0.z == tmin) ); _hit->m_dist = tmin; - getPointAt(_hit->m_pos, _ray, tmin); + _hit->m_pos = getPointAt(_ray, tmin); } return true; @@ -554,19 +513,17 @@ bool intersect(const Ray& _ray, const Obb& _obb, Hit* _hit) bx::mtxInverse(mtxInv, _obb.m_mtx); Ray obbRay; - bx::vec3MulMtx(obbRay.m_pos, _ray.m_pos, mtxInv); - bx::vec3MulMtxXyz0(obbRay.m_dir, _ray.m_dir, mtxInv); + obbRay.m_pos = bx::mul(_ray.m_pos, mtxInv); + obbRay.m_dir = bx::mulXyz0(_ray.m_dir, mtxInv); if (intersect(obbRay, s_kUnitAabb, _hit) ) { if (NULL != _hit) { - float tmp[3]; - bx::vec3MulMtx(tmp, _hit->m_pos, _obb.m_mtx); - bx::vec3Move(_hit->m_pos, tmp); + _hit->m_pos = bx::mul(_hit->m_pos, _obb.m_mtx); - bx::vec3MulMtxXyz0(tmp, _hit->m_normal, _obb.m_mtx); - bx::vec3Norm(_hit->m_normal, tmp); + const bx::Vec3 tmp = bx::mulXyz0(_hit->m_normal, _obb.m_mtx); + _hit->m_normal = bx::normalize(tmp); } return true; @@ -578,17 +535,16 @@ bool intersect(const Ray& _ray, const Obb& _obb, Hit* _hit) bool intersect(const Ray& _ray, const Disk& _disk, Hit* _hit) { Plane plane; - bx::vec3Move(plane.m_normal, _disk.m_normal); - plane.m_dist = -bx::vec3Dot(_disk.m_center, _disk.m_normal); + plane.m_normal = _disk.m_normal; + plane.m_dist = -bx::dot(_disk.m_center, _disk.m_normal); Hit tmpHit; _hit = NULL != _hit ? _hit : &tmpHit; if (intersect(_ray, plane, _hit) ) { - float tmp[3]; - bx::vec3Sub(tmp, _disk.m_center, _hit->m_pos); - return bx::vec3Dot(tmp, tmp) <= bx::fsq(_disk.m_radius); + const bx::Vec3 tmp = bx::sub(_disk.m_center, _hit->m_pos); + return bx::dot(tmp, tmp) <= bx::square(_disk.m_radius); } return false; @@ -596,45 +552,39 @@ bool intersect(const Ray& _ray, const Disk& _disk, Hit* _hit) static bool intersect(const Ray& _ray, const Cylinder& _cylinder, bool _capsule, Hit* _hit) { - float axis[3]; - bx::vec3Sub(axis, _cylinder.m_end, _cylinder.m_pos); + bx::Vec3 axis = bx::sub(_cylinder.m_end, _cylinder.m_pos); + const bx::Vec3 rc = bx::sub(_ray.m_pos, _cylinder.m_pos); + const bx::Vec3 dxa = bx::cross(_ray.m_dir, axis); - float rc[3]; - bx::vec3Sub(rc, _ray.m_pos, _cylinder.m_pos); - - float normal[3]; - bx::vec3Cross(normal, _ray.m_dir, axis); - - const float len = bx::vec3Norm(normal, normal); - const float dist = bx::fabs(bx::vec3Dot(rc, normal) ); + const float len = bx::length(dxa); + const bx::Vec3 normal = bx::normalize(dxa); + const float dist = bx::abs(bx::dot(rc, normal) ); if (dist > _cylinder.m_radius) { return false; } - float vo[3]; - bx::vec3Cross(vo, rc, axis); - const float t0 = -bx::vec3Dot(vo, normal) / len; + bx::Vec3 vo = bx::cross(rc, axis); + const float t0 = -bx::dot(vo, normal) / len; - bx::vec3Cross(vo, normal, axis); - bx::vec3Norm(vo, vo); + vo = bx::normalize(bx::cross(normal, axis) ); - const float rsq = bx::fsq(_cylinder.m_radius); - const float ddoto = bx::vec3Dot(_ray.m_dir, vo); - const float ss = t0 - bx::fabs(bx::fsqrt(rsq - bx::fsq(dist) ) / ddoto); + const float rsq = bx::square(_cylinder.m_radius); + const float ddoto = bx::dot(_ray.m_dir, vo); + const float ss = t0 - bx::abs(bx::sqrt(rsq - bx::square(dist) ) / ddoto); if (0.0f > ss) { return false; } - float point[3]; - getPointAt(point, _ray, ss); + const bx::Vec3 point = getPointAt(_ray, ss); - const float axisLen = bx::vec3Norm(axis, axis); - const float pdota = bx::vec3Dot(_cylinder.m_pos, axis); - const float height = bx::vec3Dot(point, axis) - pdota; + const float axisLen = bx::length(axis); + axis = bx::normalize(axis); + const float pdota = bx::dot(_cylinder.m_pos, axis); + const float height = bx::dot(point, axis) - pdota; if (height > 0.0f && height < axisLen) @@ -642,14 +592,12 @@ static bool intersect(const Ray& _ray, const Cylinder& _cylinder, bool _capsule, if (NULL != _hit) { const float t1 = height / axisLen; - float pointOnAxis[3]; - bx::vec3Lerp(pointOnAxis, _cylinder.m_pos, _cylinder.m_end, t1); + const bx::Vec3 pointOnAxis = bx::lerp(_cylinder.m_pos, _cylinder.m_end, t1); - bx::vec3Move(_hit->m_pos, point); + _hit->m_pos = point; - float tmp[3]; - bx::vec3Sub(tmp, point, pointOnAxis); - bx::vec3Norm(_hit->m_normal, tmp); + const bx::Vec3 tmp = bx::sub(point, pointOnAxis); + _hit->m_normal = bx::normalize(tmp); _hit->m_dist = ss; } @@ -659,17 +607,14 @@ static bool intersect(const Ray& _ray, const Cylinder& _cylinder, bool _capsule, if (_capsule) { - const float rdota = bx::vec3Dot(_ray.m_pos, axis); + const float rdota = bx::dot(_ray.m_pos, axis); const float pp = rdota - pdota; const float t1 = pp / axisLen; - float pointOnAxis[3]; - bx::vec3Lerp(pointOnAxis, _cylinder.m_pos, _cylinder.m_end, t1); + const bx::Vec3 pointOnAxis = bx::lerp(_cylinder.m_pos, _cylinder.m_end, t1); + const bx::Vec3 axisToRay = bx::sub(_ray.m_pos, pointOnAxis); - float axisToRay[3]; - bx::vec3Sub(axisToRay, _ray.m_pos, pointOnAxis); - - if (_cylinder.m_radius < bx::vec3Length(axisToRay) + if (_cylinder.m_radius < bx::length(axisToRay) && 0.0f > ss) { return false; @@ -678,38 +623,37 @@ static bool intersect(const Ray& _ray, const Cylinder& _cylinder, bool _capsule, Sphere sphere; sphere.m_radius = _cylinder.m_radius; - bx::vec3Move(sphere.m_center, 0.0f >= height + sphere.m_center = 0.0f >= height ? _cylinder.m_pos : _cylinder.m_end - ); + ; return intersect(_ray, sphere, _hit); } Plane plane; - float pos[3]; + bx::Vec3 pos; if (0.0f >= height) { - bx::vec3Neg(plane.m_normal, axis); - bx::vec3Move(pos, _cylinder.m_pos); + plane.m_normal = bx::neg(axis); + pos = _cylinder.m_pos; } else { - bx::vec3Move(plane.m_normal, axis); - bx::vec3Move(pos, _cylinder.m_end); + plane.m_normal = axis; + pos = _cylinder.m_end; } - plane.m_dist = -bx::vec3Dot(pos, plane.m_normal); + plane.m_dist = -bx::dot(pos, plane.m_normal); Hit tmpHit; _hit = NULL != _hit ? _hit : &tmpHit; if (intersect(_ray, plane, _hit) ) { - float tmp[3]; - bx::vec3Sub(tmp, pos, _hit->m_pos); - return bx::vec3Dot(tmp, tmp) <= rsq; + const bx::Vec3 tmp = bx::sub(pos, _hit->m_pos); + return bx::dot(tmp, tmp) <= rsq; } return false; @@ -728,32 +672,30 @@ bool intersect(const Ray& _ray, const Capsule& _capsule, Hit* _hit) bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit) { - float axis[3]; - bx::vec3Sub(axis, _cone.m_pos, _cone.m_end); + const bx::Vec3 axis = bx::sub(_cone.m_pos, _cone.m_end); - float normal[3]; - const float len = bx::vec3Norm(normal, axis); + const float len = bx::length(axis); + const bx::Vec3 normal = bx::normalize(axis); Disk disk; - bx::vec3Move(disk.m_center, _cone.m_pos); - bx::vec3Move(disk.m_normal, normal); + disk.m_center = _cone.m_pos; + disk.m_normal = normal; disk.m_radius = _cone.m_radius; Hit tmpInt; Hit* out = NULL != _hit ? _hit : &tmpInt; bool hit = intersect(_ray, disk, out); - float ro[3]; - bx::vec3Sub(ro, _ray.m_pos, _cone.m_end); + const bx::Vec3 ro = bx::sub(_ray.m_pos, _cone.m_end); - const float hyp = bx::fsqrt(bx::fsq(_cone.m_radius) + bx::fsq(len) ); - const float cosaSq = bx::fsq(len/hyp); - const float ndoto = bx::vec3Dot(normal, ro); - const float ndotd = bx::vec3Dot(normal, _ray.m_dir); + const float hyp = bx::sqrt(bx::square(_cone.m_radius) + bx::square(len) ); + const float cosaSq = bx::square(len/hyp); + const float ndoto = bx::dot(normal, ro); + const float ndotd = bx::dot(normal, _ray.m_dir); - const float aa = bx::fsq(ndotd) - cosaSq; - const float bb = 2.0f * (ndotd*ndoto - bx::vec3Dot(_ray.m_dir, ro)*cosaSq); - const float cc = bx::fsq(ndoto) - bx::vec3Dot(ro, ro)*cosaSq; + const float aa = bx::square(ndotd) - cosaSq; + const float bb = 2.0f * (ndotd*ndoto - bx::dot(_ray.m_dir, ro)*cosaSq); + const float cc = bx::square(ndoto) - bx::dot(ro, ro)*cosaSq; float det = bb*bb - 4.0f*aa*cc; @@ -762,7 +704,7 @@ bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit) return hit; } - det = bx::fsqrt(det); + det = bx::sqrt(det); const float invA2 = 1.0f / (2.0f*aa); const float t1 = (-bb - det) * invA2; const float t2 = (-bb + det) * invA2; @@ -779,13 +721,10 @@ bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit) return hit; } - float hitPos[3]; - getPointAt(hitPos, _ray, tt); + const bx::Vec3 hitPos = getPointAt(_ray, tt); + const bx::Vec3 point = bx::sub(hitPos, _cone.m_end); - float point[3]; - bx::vec3Sub(point, hitPos, _cone.m_end); - - const float hh = bx::vec3Dot(normal, point); + const float hh = bx::dot(normal, point); if (0.0f > hh || len < hh) @@ -799,16 +738,13 @@ bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit) || tt < _hit->m_dist) { _hit->m_dist = tt; + _hit->m_pos = hitPos; - bx::vec3Move(_hit->m_pos, hitPos); + const float scale = hh / bx::dot(point, point); + const bx::Vec3 pointScaled = bx::mul(point, scale); - const float scale = hh / bx::vec3Dot(point, point); - float pointScaled[3]; - bx::vec3Mul(pointScaled, point, scale); - - float tmp[3]; - bx::vec3Sub(tmp, pointScaled, normal); - bx::vec3Norm(_hit->m_normal, tmp); + const bx::Vec3 tmp = bx::sub(pointScaled, normal); + _hit->m_normal = bx::normalize(tmp); } } @@ -817,13 +753,13 @@ bool intersect(const Ray& _ray, const Cone& _cone, Hit* _hit) bool intersect(const Ray& _ray, const Plane& _plane, Hit* _hit) { - float equation = bx::vec3Dot(_ray.m_pos, _plane.m_normal) + _plane.m_dist; + float equation = bx::dot(_ray.m_pos, _plane.m_normal) + _plane.m_dist; if (0.0f > equation) { return false; } - float ndotd = bx::vec3Dot(_ray.m_dir, _plane.m_normal); + float ndotd = bx::dot(_ray.m_dir, _plane.m_normal); if (0.0f < ndotd) { return false; @@ -831,12 +767,11 @@ bool intersect(const Ray& _ray, const Plane& _plane, Hit* _hit) if (NULL != _hit) { - bx::vec3Move(_hit->m_normal, _plane.m_normal); + _hit->m_normal = _plane.m_normal; float tt = -equation/ndotd; _hit->m_dist = tt; - - getPointAt(_hit->m_pos, _ray, tt); + _hit->m_pos = getPointAt(_ray, tt); } return true; @@ -844,17 +779,16 @@ bool intersect(const Ray& _ray, const Plane& _plane, Hit* _hit) bool intersect(const Ray& _ray, const Sphere& _sphere, Hit* _hit) { - float rs[3]; - bx::vec3Sub(rs, _ray.m_pos, _sphere.m_center); + const bx::Vec3 rs = bx::sub(_ray.m_pos, _sphere.m_center); - const float bb = bx::vec3Dot(rs, _ray.m_dir); + const float bb = bx::dot(rs, _ray.m_dir); if (0.0f < bb) { return false; } - const float aa = bx::vec3Dot(_ray.m_dir, _ray.m_dir); - const float cc = bx::vec3Dot(rs, rs) - bx::fsq(_sphere.m_radius); + const float aa = bx::dot(_ray.m_dir, _ray.m_dir); + const float cc = bx::dot(rs, rs) - bx::square(_sphere.m_radius); const float discriminant = bb*bb - aa*cc; @@ -863,7 +797,7 @@ bool intersect(const Ray& _ray, const Sphere& _sphere, Hit* _hit) return false; } - const float sqrtDiscriminant = bx::fsqrt(discriminant); + const float sqrtDiscriminant = bx::sqrt(discriminant); const float invA = 1.0f / aa; const float tt = -(bb + sqrtDiscriminant)*invA; @@ -876,13 +810,11 @@ bool intersect(const Ray& _ray, const Sphere& _sphere, Hit* _hit) { _hit->m_dist = tt; - float point[3]; - getPointAt(point, _ray, tt); - bx::vec3Move(_hit->m_pos, point); + const bx::Vec3 point = getPointAt(_ray, tt); + _hit->m_pos = point; - float tmp[3]; - bx::vec3Sub(tmp, point, _sphere.m_center); - bx::vec3Norm(_hit->m_normal, tmp); + const bx::Vec3 tmp = bx::sub(point, _sphere.m_center); + _hit->m_normal = bx::normalize(tmp); } return true; @@ -890,22 +822,12 @@ bool intersect(const Ray& _ray, const Sphere& _sphere, Hit* _hit) bool intersect(const Ray& _ray, const Tris& _triangle, Hit* _hit) { - float edge10[3]; - bx::vec3Sub(edge10, _triangle.m_v1, _triangle.m_v0); - - float edge02[3]; - bx::vec3Sub(edge02, _triangle.m_v0, _triangle.m_v2); - - float normal[3]; - bx::vec3Cross(normal, edge02, edge10); - - float vo[3]; - bx::vec3Sub(vo, _triangle.m_v0, _ray.m_pos); - - float dxo[3]; - bx::vec3Cross(dxo, _ray.m_dir, vo); - - const float det = bx::vec3Dot(normal, _ray.m_dir); + const bx::Vec3 edge10 = bx::sub(_triangle.m_v1, _triangle.m_v0); + const bx::Vec3 edge02 = bx::sub(_triangle.m_v0, _triangle.m_v2); + const bx::Vec3 normal = bx::cross(edge02, edge10); + const bx::Vec3 vo = bx::sub(_triangle.m_v0, _ray.m_pos); + const bx::Vec3 dxo = bx::cross(_ray.m_dir, vo); + const float det = bx::dot(normal, _ray.m_dir); if (det > 0.0f) { @@ -913,8 +835,8 @@ bool intersect(const Ray& _ray, const Tris& _triangle, Hit* _hit) } const float invDet = 1.0f/det; - const float bz = bx::vec3Dot(dxo, edge02) * invDet; - const float by = bx::vec3Dot(dxo, edge10) * invDet; + const float bz = bx::dot(dxo, edge02) * invDet; + const float by = bx::dot(dxo, edge10) * invDet; const float bx = 1.0f - by - bz; if (bx < 0.0f || by < 0.0f || bz < 0.0f) @@ -924,12 +846,11 @@ bool intersect(const Ray& _ray, const Tris& _triangle, Hit* _hit) if (NULL != _hit) { - bx::vec3Norm(_hit->m_normal, normal); + _hit->m_normal = bx::normalize(normal); - const float tt = bx::vec3Dot(normal, vo) * invDet; + const float tt = bx::dot(normal, vo) * invDet; _hit->m_dist = tt; - - getPointAt(_hit->m_pos, _ray, tt); + _hit->m_pos = getPointAt(_ray, tt); } return true; diff --git a/3rdparty/bgfx/examples/common/bounds.h b/3rdparty/bgfx/examples/common/bounds.h index ef6cd94b41f..aea395df780 100644 --- a/3rdparty/bgfx/examples/common/bounds.h +++ b/3rdparty/bgfx/examples/common/bounds.h @@ -1,42 +1,44 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #ifndef BOUNDS_H_HEADER_GUARD #define BOUNDS_H_HEADER_GUARD +#include + struct Aabb { - float m_min[3]; - float m_max[3]; + bx::Vec3 m_min; + bx::Vec3 m_max; }; struct Cylinder { - float m_pos[3]; - float m_end[3]; + bx::Vec3 m_pos; + bx::Vec3 m_end; float m_radius; }; struct Capsule { - float m_pos[3]; - float m_end[3]; + bx::Vec3 m_pos; + bx::Vec3 m_end; float m_radius; }; struct Cone { - float m_pos[3]; - float m_end[3]; + bx::Vec3 m_pos; + bx::Vec3 m_end; float m_radius; }; struct Disk { - float m_center[3]; - float m_normal[3]; + bx::Vec3 m_center; + bx::Vec3 m_normal; float m_radius; }; @@ -47,33 +49,33 @@ struct Obb struct Plane { - float m_normal[3]; + bx::Vec3 m_normal; float m_dist; }; struct Ray { - float m_pos[3]; - float m_dir[3]; + bx::Vec3 m_pos; + bx::Vec3 m_dir; }; struct Sphere { - float m_center[3]; + bx::Vec3 m_center; float m_radius; }; struct Tris { - float m_v0[3]; - float m_v1[3]; - float m_v2[3]; + bx::Vec3 m_v0; + bx::Vec3 m_v1; + bx::Vec3 m_v2; }; struct Hit { - float m_pos[3]; - float m_normal[3]; + bx::Vec3 m_pos; + bx::Vec3 m_normal; float m_dist; }; @@ -124,7 +126,7 @@ void calcMinBoundingSphere(Sphere& _sphere, const void* _vertices, uint32_t _num void buildFrustumPlanes(Plane* _planes, const float* _viewProj); /// Returns point from 3 intersecting planes. -void intersectPlanes(float _result[3], const Plane& _pa, const Plane& _pb, const Plane& _pc); +bx::Vec3 intersectPlanes(const Plane& _pa, const Plane& _pb, const Plane& _pc); /// Make screen space ray from x, y coordinate and inverse view-projection matrix. Ray makeRay(float _x, float _y, const float* _invVp); diff --git a/3rdparty/bgfx/examples/common/camera.cpp b/3rdparty/bgfx/examples/common/camera.cpp index 14f93d52cde..3e48e57d4f7 100644 --- a/3rdparty/bgfx/examples/common/camera.cpp +++ b/3rdparty/bgfx/examples/common/camera.cpp @@ -102,15 +102,15 @@ struct Camera m_mouseNow.m_my = 0; m_mouseLast.m_mx = 0; m_mouseLast.m_my = 0; - m_eye[0] = 0.0f; - m_eye[1] = 0.0f; - m_eye[2] = -35.0f; - m_at[0] = 0.0f; - m_at[1] = 0.0f; - m_at[2] = -1.0f; - m_up[0] = 0.0f; - m_up[1] = 1.0f; - m_up[2] = 0.0f; + m_eye.x = 0.0f; + m_eye.y = 0.0f; + m_eye.z = -35.0f; + m_at.x = 0.0f; + m_at.y = 0.0f; + m_at.z = -1.0f; + m_up.x = 0.0f; + m_up.y = 1.0f; + m_up.z = 0.0f; m_horizontalAngle = 0.01f; m_verticalAngle = 0.0f; m_mouseSpeed = 0.0020f; @@ -164,107 +164,88 @@ struct Camera m_keys |= gpy < -16834 ? CAMERA_KEY_FORWARD : 0; m_keys |= gpy > 16834 ? CAMERA_KEY_BACKWARD : 0; - float direction[3] = + const bx::Vec3 direction = { - bx::fcos(m_verticalAngle) * bx::fsin(m_horizontalAngle), - bx::fsin(m_verticalAngle), - bx::fcos(m_verticalAngle) * bx::fcos(m_horizontalAngle), + bx::cos(m_verticalAngle) * bx::sin(m_horizontalAngle), + bx::sin(m_verticalAngle), + bx::cos(m_verticalAngle) * bx::cos(m_horizontalAngle), }; - float right[3] = + const bx::Vec3 right = { - bx::fsin(m_horizontalAngle - bx::kPiHalf), + bx::sin(m_horizontalAngle - bx::kPiHalf), 0, - bx::fcos(m_horizontalAngle - bx::kPiHalf), + bx::cos(m_horizontalAngle - bx::kPiHalf), }; - float up[3]; - bx::vec3Cross(up, right, direction); + const bx::Vec3 up = bx::cross(right, direction); if (m_keys & CAMERA_KEY_FORWARD) { - float pos[3]; - bx::vec3Move(pos, m_eye); + const bx::Vec3 pos = m_eye; + const bx::Vec3 tmp = bx::mul(direction, _deltaTime * m_moveSpeed); - float tmp[3]; - bx::vec3Mul(tmp, direction, _deltaTime * m_moveSpeed); - - bx::vec3Add(m_eye, pos, tmp); + m_eye = bx::add(pos, tmp); setKeyState(CAMERA_KEY_FORWARD, false); } if (m_keys & CAMERA_KEY_BACKWARD) { - float pos[3]; - bx::vec3Move(pos, m_eye); + const bx::Vec3 pos = m_eye; + const bx::Vec3 tmp = bx::mul(direction, _deltaTime * m_moveSpeed); - float tmp[3]; - bx::vec3Mul(tmp, direction, _deltaTime * m_moveSpeed); - - bx::vec3Sub(m_eye, pos, tmp); + m_eye = bx::sub(pos, tmp); setKeyState(CAMERA_KEY_BACKWARD, false); } if (m_keys & CAMERA_KEY_LEFT) { - float pos[3]; - bx::vec3Move(pos, m_eye); + const bx::Vec3 pos = m_eye; + const bx::Vec3 tmp = bx::mul(right, _deltaTime * m_moveSpeed); - float tmp[3]; - bx::vec3Mul(tmp, right, _deltaTime * m_moveSpeed); - - bx::vec3Add(m_eye, pos, tmp); + m_eye = bx::add(pos, tmp); setKeyState(CAMERA_KEY_LEFT, false); } if (m_keys & CAMERA_KEY_RIGHT) { - float pos[3]; - bx::vec3Move(pos, m_eye); + const bx::Vec3 pos = m_eye; + const bx::Vec3 tmp = bx::mul(right, _deltaTime * m_moveSpeed); - float tmp[3]; - bx::vec3Mul(tmp, right, _deltaTime * m_moveSpeed); - - bx::vec3Sub(m_eye, pos, tmp); + m_eye = bx::sub(pos, tmp); setKeyState(CAMERA_KEY_RIGHT, false); } if (m_keys & CAMERA_KEY_UP) { - float pos[3]; - bx::vec3Move(pos, m_eye); + const bx::Vec3 pos = m_eye; + const bx::Vec3 tmp = bx::mul(up, _deltaTime * m_moveSpeed); - float tmp[3]; - bx::vec3Mul(tmp, up, _deltaTime * m_moveSpeed); - - bx::vec3Add(m_eye, pos, tmp); + m_eye = bx::add(pos, tmp); setKeyState(CAMERA_KEY_UP, false); } if (m_keys & CAMERA_KEY_DOWN) { - float pos[3]; - bx::vec3Move(pos, m_eye); + const bx::Vec3 pos = m_eye; + const bx::Vec3 tmp = bx::mul(up, _deltaTime * m_moveSpeed); - float tmp[3]; - bx::vec3Mul(tmp, up, _deltaTime * m_moveSpeed); - - bx::vec3Sub(m_eye, pos, tmp); + m_eye = bx::sub(pos, tmp); setKeyState(CAMERA_KEY_DOWN, false); } - bx::vec3Add(m_at, m_eye, direction); - bx::vec3Cross(m_up, right, direction); + m_at = bx::add(m_eye, direction); + m_up = bx::cross(right, direction); } void getViewMtx(float* _viewMtx) { - bx::mtxLookAt(_viewMtx, m_eye, m_at, m_up); + bx::mtxLookAt(_viewMtx, bx::load(&m_eye.x), bx::load(&m_at.x), bx::load(&m_up.x) ); } void setPosition(const float* _pos) { - bx::memCopy(m_eye, _pos, sizeof(float)*3); + bx::memCopy(&m_eye.x, _pos, sizeof(float)*3); } void setVerticalAngle(float _verticalAngle) @@ -280,9 +261,9 @@ struct Camera MouseCoords m_mouseNow; MouseCoords m_mouseLast; - float m_eye[3]; - float m_at[3]; - float m_up[3]; + bx::Vec3 m_eye; + bx::Vec3 m_at; + bx::Vec3 m_up; float m_horizontalAngle; float m_verticalAngle; @@ -334,12 +315,12 @@ void cameraGetViewMtx(float* _viewMtx) void cameraGetPosition(float* _pos) { - bx::memCopy(_pos, s_camera->m_eye, 3*sizeof(float) ); + bx::memCopy(_pos, &s_camera->m_eye.x, 3*sizeof(float) ); } void cameraGetAt(float* _at) { - bx::memCopy(_at, s_camera->m_at, 3*sizeof(float) ); + bx::memCopy(_at, &s_camera->m_at.x, 3*sizeof(float) ); } void cameraUpdate(float _deltaTime, const entry::MouseState& _mouseState) diff --git a/3rdparty/bgfx/examples/common/common.h b/3rdparty/bgfx/examples/common/common.h index 19c71c2a2a5..e86a41c2610 100644 --- a/3rdparty/bgfx/examples/common/common.h +++ b/3rdparty/bgfx/examples/common/common.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/common.sh b/3rdparty/bgfx/examples/common/common.sh index 2ebe4c76176..e997f87ebaa 100644 --- a/3rdparty/bgfx/examples/common/common.sh +++ b/3rdparty/bgfx/examples/common/common.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/cube_atlas.cpp b/3rdparty/bgfx/examples/common/cube_atlas.cpp index c112969843f..44c58b1e098 100644 --- a/3rdparty/bgfx/examples/common/cube_atlas.cpp +++ b/3rdparty/bgfx/examples/common/cube_atlas.cpp @@ -299,7 +299,7 @@ Atlas::Atlas(uint16_t _textureSize, const uint8_t* _textureBuffer, uint16_t _reg , false , 1 , bgfx::TextureFormat::BGRA8 - , BGFX_TEXTURE_NONE + , BGFX_SAMPLER_NONE , bgfx::makeRef(m_textureBuffer, getTextureBufferSize() ) ); } diff --git a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp index 3418dd96fec..669f1e0204c 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp +++ b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -9,11 +9,16 @@ #include "../bgfx_utils.h" #include "../packrect.h" +#include #include #include #include #include +#ifndef DEBUG_DRAW_CONFIG_MAX_GEOMETRY +# define DEBUG_DRAW_CONFIG_MAX_GEOMETRY 256 +#endif // DEBUG_DRAW_CONFIG_MAX_GEOMETRY + struct DebugVertex { float m_x; @@ -82,6 +87,40 @@ struct DebugShapeVertex bgfx::VertexDecl DebugShapeVertex::ms_decl; +struct DebugMeshVertex +{ + float m_x; + float m_y; + float m_z; + + static void init() + { + ms_decl + .begin() + .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) + .end(); + } + + static bgfx::VertexDecl ms_decl; +}; + +bgfx::VertexDecl DebugMeshVertex::ms_decl; + +static DebugShapeVertex s_quadVertices[4] = +{ + {-1.0f, 0.0f, 1.0f, { 0, 0, 0, 0 } }, + { 1.0f, 0.0f, 1.0f, { 0, 0, 0, 0 } }, + {-1.0f, 0.0f, -1.0f, { 0, 0, 0, 0 } }, + { 1.0f, 0.0f, -1.0f, { 0, 0, 0, 0 } }, + +}; + +static const uint16_t s_quadIndices[6] = +{ + 0, 1, 2, + 1, 3, 2, +}; + static DebugShapeVertex s_cubeVertices[8] = { {-1.0f, 1.0f, 1.0f, { 0, 0, 0, 0 } }, @@ -127,18 +166,18 @@ static uint8_t getCircleLod(uint8_t _lod) static void circle(float* _out, float _angle) { - float sa = bx::fsin(_angle); - float ca = bx::fcos(_angle); + float sa = bx::sin(_angle); + float ca = bx::cos(_angle); _out[0] = sa; _out[1] = ca; } static void squircle(float* _out, float _angle) { - float sa = bx::fsin(_angle); - float ca = bx::fcos(_angle); - _out[0] = bx::fsqrt(bx::fabs(sa) ) * bx::fsign(sa); - _out[1] = bx::fsqrt(bx::fabs(ca) ) * bx::fsign(ca); + float sa = bx::sin(_angle); + float ca = bx::cos(_angle); + _out[0] = bx::sqrt(bx::abs(sa) ) * bx::sign(sa); + _out[1] = bx::sqrt(bx::abs(ca) ) * bx::sign(ca); } uint32_t genSphere(uint8_t _subdiv0, void* _pos0 = NULL, uint16_t _posStride0 = 0, void* _normals0 = NULL, uint16_t _normalStride0 = 0) @@ -155,7 +194,7 @@ uint32_t genSphere(uint8_t _subdiv0, void* _pos0 = NULL, uint16_t _posStride0 = { static const float scale = 1.0f; static const float golden = 1.6180339887f; - static const float len = bx::fsqrt(golden*golden + 1.0f); + static const float len = bx::sqrt(golden*golden + 1.0f); static const float ss = 1.0f/len * scale; static const float ll = ss*golden; @@ -266,7 +305,7 @@ uint32_t genSphere(uint8_t _subdiv0, void* _pos0 = NULL, uint16_t _posStride0 = } gen(_pos0, _posStride0, _normals0, _normalStride0, _subdiv0); } - uint32_t numVertices = 20*3*bx::uint32_max(1, (uint32_t)bx::fpow(4.0f, _subdiv0) ); + uint32_t numVertices = 20*3*bx::uint32_max(1, (uint32_t)bx::pow(4.0f, _subdiv0) ); return numVertices; } @@ -299,8 +338,10 @@ void getPoint(float* _result, Axis::Enum _axis, float _x, float _y) #include "vs_debugdraw_lines_stipple.bin.h" #include "fs_debugdraw_lines_stipple.bin.h" #include "vs_debugdraw_fill.bin.h" +#include "vs_debugdraw_fill_mesh.bin.h" #include "fs_debugdraw_fill.bin.h" #include "vs_debugdraw_fill_lit.bin.h" +#include "vs_debugdraw_fill_lit_mesh.bin.h" #include "fs_debugdraw_fill_lit.bin.h" #include "vs_debugdraw_fill_texture.bin.h" #include "fs_debugdraw_fill_texture.bin.h" @@ -312,8 +353,10 @@ static const bgfx::EmbeddedShader s_embeddedShaders[] = BGFX_EMBEDDED_SHADER(vs_debugdraw_lines_stipple), BGFX_EMBEDDED_SHADER(fs_debugdraw_lines_stipple), BGFX_EMBEDDED_SHADER(vs_debugdraw_fill), + BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_mesh), BGFX_EMBEDDED_SHADER(fs_debugdraw_fill), BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_lit), + BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_lit_mesh), BGFX_EMBEDDED_SHADER(fs_debugdraw_fill_lit), BGFX_EMBEDDED_SHADER(vs_debugdraw_fill_texture), BGFX_EMBEDDED_SHADER(fs_debugdraw_fill_texture), @@ -333,6 +376,8 @@ struct SpriteT SpriteHandle create(uint16_t _width, uint16_t _height) { + bx::MutexScope lock(m_lock); + SpriteHandle handle = { bx::kInvalidHandle }; if (m_handleAlloc.getNumHandles() < m_handleAlloc.getMaxHandles() ) @@ -341,7 +386,15 @@ struct SpriteT if (m_ra.find(_width, _height, pack) ) { handle.idx = m_handleAlloc.alloc(); - m_pack[handle.idx] = pack; + + if (isValid(handle) ) + { + m_pack[handle.idx] = pack; + } + else + { + m_ra.clear(pack); + } } } @@ -360,33 +413,196 @@ struct SpriteT return m_pack[_sprite.idx]; } + bx::Mutex m_lock; bx::HandleAllocT m_handleAlloc; Pack2D m_pack[MaxHandlesT]; RectPack2DT<256> m_ra; }; -struct DebugDraw +template +struct GeometryT { - DebugDraw() - : m_depthTestLess(true) - , m_state(State::Count) + GeometryT() { } - void init(bool _depthTestLess, bx::AllocatorI* _allocator) + GeometryHandle create(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices, const void* _indices, bool _index32) { - m_allocator = _allocator; - m_depthTestLess = _depthTestLess; + BX_UNUSED(_numVertices, _vertices, _numIndices, _indices, _index32); + GeometryHandle handle; + { + bx::MutexScope lock(m_lock); + handle = { m_handleAlloc.alloc() }; + } + + if (isValid(handle) ) + { + Geometry& geometry = m_geometry[handle.idx]; + geometry.m_vbh = bgfx::createVertexBuffer( + bgfx::copy(_vertices, _numVertices*sizeof(DdVertex) ) + , DebugMeshVertex::ms_decl + ); + + geometry.m_topologyNumIndices[0] = _numIndices; + geometry.m_topologyNumIndices[1] = bgfx::topologyConvert( + bgfx::TopologyConvert::TriListToLineList + , NULL + , 0 + , _indices + , _numIndices + , _index32 + ); + + const uint32_t indexSize = _index32 ? sizeof(uint32_t) : sizeof(uint16_t); + + const uint32_t numIndices = 0 + + geometry.m_topologyNumIndices[0] + + geometry.m_topologyNumIndices[1] + ; + const bgfx::Memory* mem = bgfx::alloc(numIndices*indexSize ); + uint8_t* indexData = mem->data; + + bx::memCopy(indexData, _indices, _numIndices*indexSize ); + bgfx::topologyConvert( + bgfx::TopologyConvert::TriListToLineList + , &indexData[geometry.m_topologyNumIndices[0]*indexSize ] + , geometry.m_topologyNumIndices[1]*indexSize + , _indices + , _numIndices + , _index32 + ); + + geometry.m_ibh = bgfx::createIndexBuffer( + mem + , _index32 ? BGFX_BUFFER_INDEX32 : BGFX_BUFFER_NONE + ); + } + + return handle; + } + + void destroy(GeometryHandle _handle) + { + bx::MutexScope lock(m_lock); + Geometry& geometry = m_geometry[_handle.idx]; + bgfx::destroy(geometry.m_vbh); + bgfx::destroy(geometry.m_ibh); + + m_handleAlloc.free(_handle.idx); + } + + struct Geometry + { + Geometry() + { + m_vbh.idx = bx::kInvalidHandle; + m_ibh.idx = bx::kInvalidHandle; + m_topologyNumIndices[0] = 0; + m_topologyNumIndices[1] = 0; + } + + bgfx::VertexBufferHandle m_vbh; + bgfx::IndexBufferHandle m_ibh; + uint32_t m_topologyNumIndices[2]; + }; + + bx::Mutex m_lock; + bx::HandleAllocT m_handleAlloc; + Geometry m_geometry[MaxHandlesT]; +}; + +struct Attrib +{ + uint64_t m_state; + float m_offset; + float m_scale; + float m_spin; + uint32_t m_abgr; + bool m_stipple; + bool m_wireframe; + uint8_t m_lod; +}; + +struct Program +{ + enum Enum + { + Lines, + LinesStipple, + Fill, + FillMesh, + FillLit, + FillLitMesh, + FillTexture, + + Count + }; +}; + +struct Mesh +{ + enum Enum + { + Sphere0, + Sphere1, + Sphere2, + Sphere3, + + Cone0, + Cone1, + Cone2, + Cone3, + + Cylinder0, + Cylinder1, + Cylinder2, + Cylinder3, + + Capsule0, + Capsule1, + Capsule2, + Capsule3, + + Quad, + + Cube, + + Count, + + SphereMaxLod = Sphere3 - Sphere0, + ConeMaxLod = Cone3 - Cone0, + CylinderMaxLod = Cylinder3 - Cylinder0, + CapsuleMaxLod = Capsule3 - Capsule0, + }; + + uint32_t m_startVertex; + uint32_t m_numVertices; + uint32_t m_startIndex[2]; + uint32_t m_numIndices[2]; +}; + +typedef SpriteT<256, SPRITE_TEXTURE_SIZE> Sprite; +typedef GeometryT Geometry; + +struct DebugDrawShared +{ + void init(bx::AllocatorI* _allocator) + { if (NULL == _allocator) { static bx::DefaultAllocator allocator; m_allocator = &allocator; } + else + { + m_allocator = _allocator; + } DebugVertex::init(); DebugUvVertex::init(); DebugShapeVertex::init(); + DebugMeshVertex::init(); bgfx::RendererType::Enum type = bgfx::getRendererType(); @@ -408,12 +624,24 @@ struct DebugDraw , true ); + m_program[Program::FillMesh] = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_debugdraw_fill_mesh") + , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_debugdraw_fill") + , true + ); + m_program[Program::FillLit] = bgfx::createProgram( bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_debugdraw_fill_lit") , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_debugdraw_fill_lit") , true ); + m_program[Program::FillLitMesh] = bgfx::createProgram( + bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_debugdraw_fill_lit_mesh") + , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_debugdraw_fill_lit") + , true + ); + m_program[Program::FillTexture] = bgfx::createProgram( bgfx::createEmbeddedShader(s_embeddedShaders, type, "vs_debugdraw_fill_texture") , bgfx::createEmbeddedShader(s_embeddedShaders, type, "fs_debugdraw_fill_texture") @@ -684,6 +912,15 @@ struct DebugDraw startIndex += numIndices + numLineListIndices; } + m_mesh[Mesh::Quad].m_startVertex = startVertex; + m_mesh[Mesh::Quad].m_numVertices = BX_COUNTOF(s_quadVertices); + m_mesh[Mesh::Quad].m_startIndex[0] = startIndex; + m_mesh[Mesh::Quad].m_numIndices[0] = BX_COUNTOF(s_quadIndices); + m_mesh[Mesh::Quad].m_startIndex[1] = 0; + m_mesh[Mesh::Quad].m_numIndices[1] = 0; + startVertex += BX_COUNTOF(s_quadVertices); + startIndex += BX_COUNTOF(s_quadIndices); + m_mesh[Mesh::Cube].m_startVertex = startVertex; m_mesh[Mesh::Cube].m_numVertices = BX_COUNTOF(s_cubeVertices); m_mesh[Mesh::Cube].m_startIndex[0] = startIndex; @@ -696,7 +933,7 @@ struct DebugDraw const bgfx::Memory* vb = bgfx::alloc(startVertex*stride); const bgfx::Memory* ib = bgfx::alloc(startIndex*sizeof(uint16_t) ); - for (uint32_t mesh = Mesh::Sphere0; mesh < Mesh::Cube; ++mesh) + for (uint32_t mesh = Mesh::Sphere0; mesh < Mesh::Quad; ++mesh) { Mesh::Enum id = Mesh::Enum(mesh); bx::memCopy(&vb->data[m_mesh[id].m_startVertex * stride] @@ -713,6 +950,16 @@ struct DebugDraw BX_FREE(m_allocator, indices[id]); } + bx::memCopy(&vb->data[m_mesh[Mesh::Quad].m_startVertex * stride] + , s_quadVertices + , sizeof(s_quadVertices) + ); + + bx::memCopy(&ib->data[m_mesh[Mesh::Quad].m_startIndex[0] * sizeof(uint16_t)] + , s_quadIndices + , sizeof(s_quadIndices) + ); + bx::memCopy(&vb->data[m_mesh[Mesh::Cube].m_startVertex * stride] , s_cubeVertices , sizeof(s_cubeVertices) @@ -725,12 +972,6 @@ struct DebugDraw m_vbh = bgfx::createVertexBuffer(vb, DebugShapeVertex::ms_decl); m_ibh = bgfx::createIndexBuffer(ib); - - m_viewId = 0; - m_pos = 0; - m_indexPos = 0; - m_vertexPos = 0; - m_posQuad = 0; } void shutdown() @@ -773,20 +1014,73 @@ struct DebugDraw m_sprite.destroy(_handle); } - void begin(uint8_t _viewId) + GeometryHandle createGeometry(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices, const void* _indices, bool _index32) + { + return m_geometry.create(_numVertices, _vertices, _numIndices, _indices, _index32); + } + + void destroy(GeometryHandle _handle) + { + m_geometry.destroy(_handle); + } + + bx::AllocatorI* m_allocator; + + Sprite m_sprite; + Geometry m_geometry; + + Mesh m_mesh[Mesh::Count]; + + bgfx::UniformHandle s_texColor; + bgfx::TextureHandle m_texture; + bgfx::ProgramHandle m_program[Program::Count]; + bgfx::UniformHandle u_params; + + bgfx::VertexBufferHandle m_vbh; + bgfx::IndexBufferHandle m_ibh; +}; + +static DebugDrawShared s_dds; + +struct DebugDrawEncoderImpl +{ + DebugDrawEncoderImpl() + : m_depthTestLess(true) + , m_state(State::Count) + , m_defaultEncoder(NULL) + { + } + + void init(bgfx::Encoder* _encoder) + { + m_defaultEncoder = _encoder; + } + + void shutdown() + { + } + + void begin(bgfx::ViewId _viewId, bool _depthTestLess, bgfx::Encoder* _encoder) { BX_CHECK(State::Count == m_state); - m_viewId = _viewId; - m_state = State::None; - m_stack = 0; + m_viewId = _viewId; + m_encoder = _encoder == NULL ? m_defaultEncoder : _encoder; + m_state = State::None; + m_stack = 0; + m_depthTestLess = _depthTestLess; + + m_pos = 0; + m_indexPos = 0; + m_vertexPos = 0; + m_posQuad = 0; Attrib& attrib = m_attrib[0]; attrib.m_state = 0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | (m_depthTestLess ? BGFX_STATE_DEPTH_TEST_LESS : BGFX_STATE_DEPTH_TEST_GREATER) | BGFX_STATE_CULL_CW - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z ; attrib.m_scale = 1.0f; attrib.m_spin = 0.0f; @@ -807,7 +1101,8 @@ struct DebugDraw flushQuad(); flush(); - m_state = State::Count; + m_encoder = NULL; + m_state = State::Count; } void push() @@ -830,10 +1125,29 @@ struct DebugDraw --m_stack; } - void setTransform(const void* _mtx, uint16_t _num = 1) + void setDepthTestLess(bool _depthTestLess) { BX_CHECK(State::Count != m_state); - flush(); + if (m_depthTestLess != _depthTestLess) + { + m_depthTestLess = _depthTestLess; + Attrib& attrib = m_attrib[m_stack]; + if (attrib.m_state & BGFX_STATE_DEPTH_TEST_MASK) + { + flush(); + attrib.m_state &= ~BGFX_STATE_DEPTH_TEST_MASK; + attrib.m_state |= _depthTestLess ? BGFX_STATE_DEPTH_TEST_LESS : BGFX_STATE_DEPTH_TEST_GREATER; + } + } + } + + void setTransform(const void* _mtx, uint16_t _num = 1, bool _flush = true) + { + BX_CHECK(State::Count != m_state); + if (_flush) + { + flush(); + } MatrixStack& stack = m_mtxStack[m_mtxStackCurrent]; @@ -844,7 +1158,7 @@ struct DebugDraw } bgfx::Transform transform; - stack.mtx = bgfx::allocTransform(&transform, _num); + stack.mtx = m_encoder->allocTransform(&transform, _num); stack.num = _num; stack.data = transform.data; bx::memCopy(transform.data, _mtx, _num*64); @@ -862,11 +1176,14 @@ struct DebugDraw setTranslate(_pos[0], _pos[1], _pos[2]); } - void pushTransform(const void* _mtx, uint16_t _num) + void pushTransform(const void* _mtx, uint16_t _num, bool _flush = true) { BX_CHECK(m_mtxStackCurrent < BX_COUNTOF(m_mtxStack), "Out of matrix stack!"); BX_CHECK(State::Count != m_state); - flush(); + if (_flush) + { + flush(); + } float* mtx = NULL; @@ -887,13 +1204,16 @@ struct DebugDraw } m_mtxStackCurrent++; - setTransform(mtx, _num); + setTransform(mtx, _num, _flush); } - void popTransform() + void popTransform(bool _flush = true) { BX_CHECK(State::Count != m_state); - flush(); + if (_flush) + { + flush(); + } m_mtxStackCurrent--; } @@ -919,7 +1239,7 @@ struct DebugDraw uint64_t state = m_attrib[m_stack].m_state & ~(0 | BGFX_STATE_DEPTH_TEST_MASK - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_CULL_CW | BGFX_STATE_CULL_CCW ); @@ -930,7 +1250,7 @@ struct DebugDraw ; state |= _depthWrite - ? BGFX_STATE_DEPTH_WRITE + ? BGFX_STATE_WRITE_Z : 0 ; @@ -1106,29 +1426,29 @@ struct DebugDraw const Attrib& attrib = m_attrib[m_stack]; if (attrib.m_wireframe) { - moveTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_min[2]); - lineTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_min[2]); - lineTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_min[2]); - lineTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_min[2]); + moveTo(_aabb.m_min.x, _aabb.m_min.y, _aabb.m_min.z); + lineTo(_aabb.m_max.x, _aabb.m_min.y, _aabb.m_min.z); + lineTo(_aabb.m_max.x, _aabb.m_max.y, _aabb.m_min.z); + lineTo(_aabb.m_min.x, _aabb.m_max.y, _aabb.m_min.z); close(); - moveTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_max[2]); - lineTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_max[2]); - lineTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_max[2]); - lineTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_max[2]); + moveTo(_aabb.m_min.x, _aabb.m_min.y, _aabb.m_max.z); + lineTo(_aabb.m_max.x, _aabb.m_min.y, _aabb.m_max.z); + lineTo(_aabb.m_max.x, _aabb.m_max.y, _aabb.m_max.z); + lineTo(_aabb.m_min.x, _aabb.m_max.y, _aabb.m_max.z); close(); - moveTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_min[2]); - lineTo(_aabb.m_min[0], _aabb.m_min[1], _aabb.m_max[2]); + moveTo(_aabb.m_min.x, _aabb.m_min.y, _aabb.m_min.z); + lineTo(_aabb.m_min.x, _aabb.m_min.y, _aabb.m_max.z); - moveTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_min[2]); - lineTo(_aabb.m_max[0], _aabb.m_min[1], _aabb.m_max[2]); + moveTo(_aabb.m_max.x, _aabb.m_min.y, _aabb.m_min.z); + lineTo(_aabb.m_max.x, _aabb.m_min.y, _aabb.m_max.z); - moveTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_min[2]); - lineTo(_aabb.m_min[0], _aabb.m_max[1], _aabb.m_max[2]); + moveTo(_aabb.m_min.x, _aabb.m_max.y, _aabb.m_min.z); + lineTo(_aabb.m_min.x, _aabb.m_max.y, _aabb.m_max.z); - moveTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_min[2]); - lineTo(_aabb.m_max[0], _aabb.m_max[1], _aabb.m_max[2]); + moveTo(_aabb.m_max.x, _aabb.m_max.y, _aabb.m_min.z); + lineTo(_aabb.m_max.x, _aabb.m_max.y, _aabb.m_max.z); } else { @@ -1140,12 +1460,12 @@ struct DebugDraw void draw(const Cylinder& _cylinder, bool _capsule) { - drawCylinder(_cylinder.m_pos, _cylinder.m_end, _cylinder.m_radius, _capsule); + drawCylinder(&_cylinder.m_pos.x, &_cylinder.m_end.x, _cylinder.m_radius, _capsule); } void draw(const Disk& _disk) { - drawCircle(_disk.m_normal, _disk.m_center, _disk.m_radius, 0.0f); + drawCircle(&_disk.m_normal.x, &_disk.m_center.x, _disk.m_radius, 0.0f); } void draw(const Obb& _obb) @@ -1198,55 +1518,184 @@ struct DebugDraw , 0.0f , 0.0f , 0.0f - , _sphere.m_center[0] - , _sphere.m_center[1] - , _sphere.m_center[2] + , _sphere.m_center.x + , _sphere.m_center.y + , _sphere.m_center.z ); uint8_t lod = attrib.m_lod > Mesh::SphereMaxLod - ? uint8_t(Mesh::SphereMaxLod) - : attrib.m_lod - ; + ? uint8_t(Mesh::SphereMaxLod) + : attrib.m_lod + ; draw(Mesh::Enum(Mesh::Sphere0 + lod), mtx, 1, attrib.m_wireframe); } + void setUParams(const Attrib& _attrib, bool _wireframe) + { + const float flip = 0 == (_attrib.m_state & BGFX_STATE_CULL_CCW) ? 1.0f : -1.0f; + const uint8_t alpha = _attrib.m_abgr >> 24; + + float params[4][4] = + { + { // lightDir + 0.0f * flip, + -1.0f * flip, + 0.0f * flip, + 3.0f, // shininess + }, + { // skyColor + 1.0f, + 0.9f, + 0.8f, + 0.0f, // unused + }, + { // groundColor.xyz0 + 0.2f, + 0.22f, + 0.5f, + 0.0f, // unused + }, + { // matColor + ( (_attrib.m_abgr) & 0xff) / 255.0f, + ( (_attrib.m_abgr >> 8) & 0xff) / 255.0f, + ( (_attrib.m_abgr >> 16) & 0xff) / 255.0f, + (alpha) / 255.0f, + }, + }; + + bx::vec3Norm(params[0], params[0]); + m_encoder->setUniform(s_dds.u_params, params, 4); + + m_encoder->setState(0 + | _attrib.m_state + | (_wireframe ? BGFX_STATE_PT_LINES | BGFX_STATE_LINEAA | BGFX_STATE_BLEND_ALPHA + : (alpha < 0xff) ? BGFX_STATE_BLEND_ALPHA : 0) + ); + } + + void draw(GeometryHandle _handle) + { + const Geometry::Geometry& geometry = s_dds.m_geometry.m_geometry[_handle.idx]; + m_encoder->setVertexBuffer(0, geometry.m_vbh); + + const Attrib& attrib = m_attrib[m_stack]; + const bool wireframe = attrib.m_wireframe; + setUParams(attrib, wireframe); + + if (wireframe) + { + m_encoder->setIndexBuffer( + geometry.m_ibh + , geometry.m_topologyNumIndices[0] + , geometry.m_topologyNumIndices[1] + ); + } + else if (0 != geometry.m_topologyNumIndices[0]) + { + m_encoder->setIndexBuffer( + geometry.m_ibh + , 0 + , geometry.m_topologyNumIndices[0] + ); + } + + m_encoder->setTransform(m_mtxStack[m_mtxStackCurrent].mtx); + bgfx::ProgramHandle program = s_dds.m_program[wireframe ? Program::FillMesh : Program::FillLitMesh]; + m_encoder->submit(m_viewId, program); + } + + void draw(bool _lineList, uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices, const uint16_t* _indices) + { + flush(); + + if (_numVertices == bgfx::getAvailTransientVertexBuffer(_numVertices, DebugMeshVertex::ms_decl) ) + { + bgfx::TransientVertexBuffer tvb; + bgfx::allocTransientVertexBuffer(&tvb, _numVertices, DebugMeshVertex::ms_decl); + bx::memCopy(tvb.data, _vertices, _numVertices * DebugMeshVertex::ms_decl.m_stride); + m_encoder->setVertexBuffer(0, &tvb); + + const Attrib& attrib = m_attrib[m_stack]; + const bool wireframe = _lineList || attrib.m_wireframe; + setUParams(attrib, wireframe); + + if (0 < _numIndices) + { + uint32_t numIndices = _numIndices; + bgfx::TransientIndexBuffer tib; + if (!_lineList && wireframe) + { + numIndices = bgfx::topologyConvert( + bgfx::TopologyConvert::TriListToLineList + , NULL + , 0 + , _indices + , _numIndices + , false + ); + + + bgfx::allocTransientIndexBuffer(&tib, numIndices); + bgfx::topologyConvert( + bgfx::TopologyConvert::TriListToLineList + , tib.data + , numIndices * sizeof(uint16_t) + , _indices + , _numIndices + , false + ); + } + else + { + bgfx::allocTransientIndexBuffer(&tib, numIndices); + bx::memCopy(tib.data, _indices, numIndices * sizeof(uint16_t) ); + } + m_encoder->setIndexBuffer(&tib); + } + + m_encoder->setTransform(m_mtxStack[m_mtxStackCurrent].mtx); + bgfx::ProgramHandle program = s_dds.m_program[wireframe ? Program::FillMesh : Program::FillLitMesh]; + m_encoder->submit(m_viewId, program); + } + } + void drawFrustum(const float* _viewProj) { Plane planes[6]; buildFrustumPlanes(planes, _viewProj); - float points[24]; - intersectPlanes(&points[ 0], planes[0], planes[2], planes[4]); - intersectPlanes(&points[ 3], planes[0], planes[3], planes[4]); - intersectPlanes(&points[ 6], planes[0], planes[3], planes[5]); - intersectPlanes(&points[ 9], planes[0], planes[2], planes[5]); - intersectPlanes(&points[12], planes[1], planes[2], planes[4]); - intersectPlanes(&points[15], planes[1], planes[3], planes[4]); - intersectPlanes(&points[18], planes[1], planes[3], planes[5]); - intersectPlanes(&points[21], planes[1], planes[2], planes[5]); + bx::Vec3 points[8]; + points[0] = intersectPlanes(planes[0], planes[2], planes[4]); + points[1] = intersectPlanes(planes[0], planes[3], planes[4]); + points[2] = intersectPlanes(planes[0], planes[3], planes[5]); + points[3] = intersectPlanes(planes[0], planes[2], planes[5]); + points[4] = intersectPlanes(planes[1], planes[2], planes[4]); + points[5] = intersectPlanes(planes[1], planes[3], planes[4]); + points[6] = intersectPlanes(planes[1], planes[3], planes[5]); + points[7] = intersectPlanes(planes[1], planes[2], planes[5]); - moveTo(&points[ 0]); - lineTo(&points[ 3]); - lineTo(&points[ 6]); - lineTo(&points[ 9]); + moveTo(&points[0].x); + lineTo(&points[1].x); + lineTo(&points[2].x); + lineTo(&points[3].x); close(); - moveTo(&points[12]); - lineTo(&points[15]); - lineTo(&points[18]); - lineTo(&points[21]); + moveTo(&points[4].x); + lineTo(&points[5].x); + lineTo(&points[6].x); + lineTo(&points[7].x); close(); - moveTo(&points[ 0]); - lineTo(&points[12]); + moveTo(&points[0].x); + lineTo(&points[4].x); - moveTo(&points[ 3]); - lineTo(&points[15]); + moveTo(&points[1].x); + lineTo(&points[5].x); - moveTo(&points[ 6]); - lineTo(&points[18]); + moveTo(&points[2].x); + lineTo(&points[6].x); - moveTo(&points[ 9]); - lineTo(&points[21]); + moveTo(&points[3].x); + lineTo(&points[7].x); } void drawFrustum(const void* _viewProj) @@ -1260,12 +1709,12 @@ struct DebugDraw const uint32_t num = getCircleLod(attrib.m_lod); const float step = bx::kPi * 2.0f / num; - _degrees = bx::fwrap(_degrees, 360.0f); + _degrees = bx::wrap(_degrees, 360.0f); float pos[3]; getPoint(pos, _axis - , bx::fsin(step * 0)*_radius - , bx::fcos(step * 0)*_radius + , bx::sin(step * 0)*_radius + , bx::cos(step * 0)*_radius ); moveTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); @@ -1275,22 +1724,22 @@ struct DebugDraw for (uint32_t ii = 1; ii < n+1; ++ii) { getPoint(pos, _axis - , bx::fsin(step * ii)*_radius - , bx::fcos(step * ii)*_radius + , bx::sin(step * ii)*_radius + , bx::cos(step * ii)*_radius ); lineTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); } moveTo(_x, _y, _z); getPoint(pos, _axis - , bx::fsin(step * 0)*_radius - , bx::fcos(step * 0)*_radius + , bx::sin(step * 0)*_radius + , bx::cos(step * 0)*_radius ); lineTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); getPoint(pos, _axis - , bx::fsin(step * n)*_radius - , bx::fcos(step * n)*_radius + , bx::sin(step * n)*_radius + , bx::cos(step * n)*_radius ); moveTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); lineTo(_x, _y, _z); @@ -1301,7 +1750,7 @@ struct DebugDraw const Attrib& attrib = m_attrib[m_stack]; const uint32_t num = getCircleLod(attrib.m_lod); const float step = bx::kPi * 2.0f / num; - _weight = bx::fclamp(_weight, 0.0f, 2.0f); + _weight = bx::clamp(_weight, 0.0f, 2.0f); float udir[3]; float vdir[3]; @@ -1316,8 +1765,8 @@ struct DebugDraw circle(xy0, 0.0f); squircle(xy1, 0.0f); - bx::vec3Mul(pos, udir, bx::flerp(xy0[0], xy1[0], _weight)*_radius); - bx::vec3Mul(tmp0, vdir, bx::flerp(xy0[1], xy1[1], _weight)*_radius); + bx::vec3Mul(pos, udir, bx::lerp(xy0[0], xy1[0], _weight)*_radius); + bx::vec3Mul(tmp0, vdir, bx::lerp(xy0[1], xy1[1], _weight)*_radius); bx::vec3Add(tmp1, pos, tmp0); bx::vec3Add(pos, tmp1, _center); moveTo(pos); @@ -1328,8 +1777,8 @@ struct DebugDraw circle(xy0, angle); squircle(xy1, angle); - bx::vec3Mul(pos, udir, bx::flerp(xy0[0], xy1[0], _weight)*_radius); - bx::vec3Mul(tmp0, vdir, bx::flerp(xy0[1], xy1[1], _weight)*_radius); + bx::vec3Mul(pos, udir, bx::lerp(xy0[0], xy1[0], _weight)*_radius); + bx::vec3Mul(tmp0, vdir, bx::lerp(xy0[1], xy1[1], _weight)*_radius); bx::vec3Add(tmp1, pos, tmp0); bx::vec3Add(pos, tmp1, _center); lineTo(pos); @@ -1348,7 +1797,7 @@ struct DebugDraw const Attrib& attrib = m_attrib[m_stack]; const uint32_t num = getCircleLod(attrib.m_lod); const float step = bx::kPi * 2.0f / num; - _weight = bx::fclamp(_weight, 0.0f, 2.0f); + _weight = bx::clamp(_weight, 0.0f, 2.0f); float xy0[2]; float xy1[2]; @@ -1357,8 +1806,8 @@ struct DebugDraw float pos[3]; getPoint(pos, _axis - , bx::flerp(xy0[0], xy1[0], _weight)*_radius - , bx::flerp(xy0[1], xy1[1], _weight)*_radius + , bx::lerp(xy0[0], xy1[0], _weight)*_radius + , bx::lerp(xy0[1], xy1[1], _weight)*_radius ); moveTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); @@ -1369,8 +1818,8 @@ struct DebugDraw squircle(xy1, angle); getPoint(pos, _axis - , bx::flerp(xy0[0], xy1[0], _weight)*_radius - , bx::flerp(xy0[1], xy1[1], _weight)*_radius + , bx::lerp(xy0[0], xy1[0], _weight)*_radius + , bx::lerp(xy0[1], xy1[1], _weight)*_radius ); lineTo(pos[0] + _x, pos[1] + _y, pos[2] + _z); } @@ -1380,49 +1829,63 @@ struct DebugDraw void drawQuad(const float* _normal, const float* _center, float _size) { const Attrib& attrib = m_attrib[m_stack]; + if (attrib.m_wireframe) + { + float udir[3]; + float vdir[3]; - float udir[3]; - float vdir[3]; + bx::vec3TangentFrame(_normal, udir, vdir, attrib.m_spin); - bx::vec3TangentFrame(_normal, udir, vdir, attrib.m_spin); + const float halfExtent = _size*0.5f; - const float halfExtent = _size*0.5f; + float umin[3]; + bx::vec3Mul(umin, udir, -halfExtent); - float umin[3]; - bx::vec3Mul(umin, udir, -halfExtent); + float umax[3]; + bx::vec3Mul(umax, udir, halfExtent); - float umax[3]; - bx::vec3Mul(umax, udir, halfExtent); + float vmin[3]; + bx::vec3Mul(vmin, vdir, -halfExtent); - float vmin[3]; - bx::vec3Mul(vmin, vdir, -halfExtent); + float vmax[3]; + bx::vec3Mul(vmax, vdir, halfExtent); - float vmax[3]; - bx::vec3Mul(vmax, vdir, halfExtent); + float pt[3]; + float tmp[3]; + bx::vec3Add(tmp, umin, vmin); + bx::vec3Add(pt, _center, tmp); + moveTo(pt); - float pt[3]; - float tmp[3]; - bx::vec3Add(tmp, umin, vmin); - bx::vec3Add(pt, _center, tmp); - moveTo(pt); + bx::vec3Add(tmp, umax, vmin); + bx::vec3Add(pt, _center, tmp); + lineTo(pt); - bx::vec3Add(tmp, umax, vmin); - bx::vec3Add(pt, _center, tmp); - lineTo(pt); + bx::vec3Add(tmp, umax, vmax); + bx::vec3Add(pt, _center, tmp); + lineTo(pt); - bx::vec3Add(tmp, umax, vmax); - bx::vec3Add(pt, _center, tmp); - lineTo(pt); + bx::vec3Add(tmp, umin, vmax); + bx::vec3Add(pt, _center, tmp); + lineTo(pt); - bx::vec3Add(tmp, umin, vmax); - bx::vec3Add(pt, _center, tmp); - lineTo(pt); - - close(); + close(); + } + else + { + float mtx[16]; + bx::mtxFromNormal(mtx, _normal, _size*0.5f, _center, attrib.m_spin); + draw(Mesh::Quad, mtx, 1, false); + } } void drawQuad(SpriteHandle _handle, const float* _normal, const float* _center, float _size) { + if (!isValid(_handle) ) + { + drawQuad(_normal, _center, _size); + return; + } + if (m_posQuad == BX_COUNTOF(m_cacheQuad) ) { flushQuad(); @@ -1435,7 +1898,7 @@ struct DebugDraw bx::vec3TangentFrame(_normal, udir, vdir, attrib.m_spin); - const Pack2D& pack = m_sprite.get(_handle); + const Pack2D& pack = s_dds.m_sprite.get(_handle); const float invTextureSize = 1.0f/SPRITE_TEXTURE_SIZE; const float us = pack.m_x * invTextureSize; const float vs = pack.m_y * invTextureSize; @@ -1560,26 +2023,30 @@ struct DebugDraw if (_capsule) { uint8_t lod = attrib.m_lod > Mesh::CapsuleMaxLod - ? uint8_t(Mesh::CapsuleMaxLod) - : attrib.m_lod - ; + ? uint8_t(Mesh::CapsuleMaxLod) + : attrib.m_lod + ; draw(Mesh::Enum(Mesh::Capsule0 + lod), mtx[0], 2, attrib.m_wireframe); Sphere sphere; - bx::vec3Move(sphere.m_center, _from); - sphere.m_radius = _radius; + sphere.m_center.x = _from[0]; + sphere.m_center.y = _from[1]; + sphere.m_center.z = _from[2]; + sphere.m_radius = _radius; draw(sphere); - bx::vec3Move(sphere.m_center, _to); + sphere.m_center.x = _to[0]; + sphere.m_center.y = _to[1]; + sphere.m_center.z = _to[2]; draw(sphere); } else { uint8_t lod = attrib.m_lod > Mesh::CylinderMaxLod - ? uint8_t(Mesh::CylinderMaxLod) - : attrib.m_lod - ; - draw(Mesh::Enum(Mesh::Cylinder0 + lod), mtx[0], 2, attrib.m_wireframe); + ? uint8_t(Mesh::CylinderMaxLod) + : attrib.m_lod + ; + draw(Mesh::Enum(Mesh::Cylinder0 + lod), mtx[0], 2, attrib.m_wireframe); } } @@ -1745,6 +2212,7 @@ struct DebugDraw moveTo(_axis, 0.0f, -halfExtent); lineTo(_axis, 0.0f, halfExtent); + popTransform(); pop(); } @@ -1769,124 +2237,30 @@ struct DebugDraw pop(); } -private: - struct Mesh - { - enum Enum - { - Sphere0, - Sphere1, - Sphere2, - Sphere3, - - Cone0, - Cone1, - Cone2, - Cone3, - - Cylinder0, - Cylinder1, - Cylinder2, - Cylinder3, - - Capsule0, - Capsule1, - Capsule2, - Capsule3, - - Cube, - - Count, - - SphereMaxLod = Sphere3 - Sphere0, - ConeMaxLod = Cone3 - Cone0, - CylinderMaxLod = Cylinder3 - Cylinder0, - CapsuleMaxLod = Capsule3 - Capsule0, - }; - - uint32_t m_startVertex; - uint32_t m_numVertices; - uint32_t m_startIndex[2]; - uint32_t m_numIndices[2]; - }; - - struct Program - { - enum Enum - { - Lines, - LinesStipple, - Fill, - FillLit, - FillTexture, - - Count - }; - }; - void draw(Mesh::Enum _mesh, const float* _mtx, uint16_t _num, bool _wireframe) { - pushTransform(_mtx, _num); + pushTransform(_mtx, _num, false /* flush */); - const Mesh& mesh = m_mesh[_mesh]; - - const Attrib& attrib = m_attrib[m_stack]; + const Mesh& mesh = s_dds.m_mesh[_mesh]; if (0 != mesh.m_numIndices[_wireframe]) { - bgfx::setIndexBuffer(m_ibh + m_encoder->setIndexBuffer(s_dds.m_ibh , mesh.m_startIndex[_wireframe] , mesh.m_numIndices[_wireframe] ); } - const float flip = 0 == (attrib.m_state & BGFX_STATE_CULL_CCW) ? 1.0f : -1.0f; - const uint8_t alpha = attrib.m_abgr>>24; - - float params[4][4] = - { - { // lightDir - 0.0f * flip, - -1.0f * flip, - 0.0f * flip, - 3.0f, // shininess - }, - { // skyColor - 1.0f, - 0.9f, - 0.8f, - 0.0f, // unused - }, - { // groundColor.xyz0 - 0.2f, - 0.22f, - 0.5f, - 0.0f, // unused - }, - { // matColor - ( (attrib.m_abgr )&0xff)/255.0f, - ( (attrib.m_abgr>> 8)&0xff)/255.0f, - ( (attrib.m_abgr>>16)&0xff)/255.0f, - ( alpha )/255.0f, - }, - }; - - bx::vec3Norm(params[0], params[0]); - - bgfx::setUniform(u_params, params, 4); + const Attrib& attrib = m_attrib[m_stack]; + setUParams(attrib, _wireframe); MatrixStack& stack = m_mtxStack[m_mtxStackCurrent]; - bgfx::setTransform(stack.mtx, stack.num); + m_encoder->setTransform(stack.mtx, stack.num); - bgfx::setVertexBuffer(0, m_vbh, mesh.m_startVertex, mesh.m_numVertices); - bgfx::setState(0 - | attrib.m_state - | (_wireframe ? BGFX_STATE_PT_LINES|BGFX_STATE_LINEAA|BGFX_STATE_BLEND_ALPHA - : (alpha < 0xff) ? BGFX_STATE_BLEND_ALPHA : 0) - ); - bgfx::submit(m_viewId, m_program[_wireframe ? Program::Fill : Program::FillLit]); + m_encoder->setVertexBuffer(0, s_dds.m_vbh, mesh.m_startVertex, mesh.m_numVertices); + m_encoder->submit(m_viewId, s_dds.m_program[_wireframe ? Program::Fill : Program::FillLit]); - popTransform(); + popTransform(false /* flush */); } void softFlush() @@ -1913,18 +2287,18 @@ private: const Attrib& attrib = m_attrib[m_stack]; - bgfx::setVertexBuffer(0, &tvb); - bgfx::setIndexBuffer(&tib); - bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + m_encoder->setVertexBuffer(0, &tvb); + m_encoder->setIndexBuffer(&tib); + m_encoder->setState(0 + | BGFX_STATE_WRITE_RGB | BGFX_STATE_PT_LINES | attrib.m_state | BGFX_STATE_LINEAA | BGFX_STATE_BLEND_ALPHA ); - bgfx::setTransform(m_mtxStack[m_mtxStackCurrent].mtx); - bgfx::ProgramHandle program = m_program[attrib.m_stipple ? 1 : 0]; - bgfx::submit(m_viewId, program); + m_encoder->setTransform(m_mtxStack[m_mtxStackCurrent].mtx); + bgfx::ProgramHandle program = s_dds.m_program[attrib.m_stipple ? 1 : 0]; + m_encoder->submit(m_viewId, program); } m_state = State::None; @@ -1962,14 +2336,14 @@ private: const Attrib& attrib = m_attrib[m_stack]; - bgfx::setVertexBuffer(0, &tvb); - bgfx::setIndexBuffer(&tib); - bgfx::setState(0 + m_encoder->setVertexBuffer(0, &tvb); + m_encoder->setIndexBuffer(&tib); + m_encoder->setState(0 | (attrib.m_state & ~BGFX_STATE_CULL_MASK) ); - bgfx::setTransform(m_mtxStack[m_mtxStackCurrent].mtx); - bgfx::setTexture(0, s_texColor, m_texture); - bgfx::submit(m_viewId, m_program[Program::FillTexture]); + m_encoder->setTransform(m_mtxStack[m_mtxStackCurrent].mtx); + m_encoder->setTexture(0, s_dds.s_texColor, s_dds.m_texture); + m_encoder->submit(m_viewId, s_dds.m_program[Program::FillTexture]); } m_posQuad = 0; @@ -1988,19 +2362,18 @@ private: }; }; - static const uint32_t cacheSize = 1024; - static const uint32_t stackSize = 16; - BX_STATIC_ASSERT(cacheSize >= 3, "Cache must be at least 3 elements."); - DebugVertex m_cache[cacheSize+1]; - uint16_t m_indices[cacheSize*2]; + static const uint32_t kCacheSize = 1024; + static const uint32_t kStackSize = 16; + static const uint32_t kCacheQuadSize = 1024; + BX_STATIC_ASSERT(kCacheSize >= 3, "Cache must be at least 3 elements."); + + DebugVertex m_cache[kCacheSize+1]; + DebugUvVertex m_cacheQuad[kCacheQuadSize]; + uint16_t m_indices[kCacheSize*2]; uint16_t m_pos; + uint16_t m_posQuad; uint16_t m_indexPos; uint16_t m_vertexPos; - - static const uint32_t cacheQuadSize = 1024; - DebugUvVertex m_cacheQuad[cacheQuadSize]; - uint16_t m_posQuad; - uint32_t m_mtxStackCurrent; struct MatrixStack @@ -2019,250 +2392,281 @@ private: MatrixStack m_mtxStack[32]; - uint8_t m_viewId; - uint8_t m_stack; - bool m_depthTestLess; + bgfx::ViewId m_viewId; + uint8_t m_stack; + bool m_depthTestLess; - struct Attrib - { - uint64_t m_state; - float m_offset; - float m_scale; - float m_spin; - uint32_t m_abgr; - bool m_stipple; - bool m_wireframe; - uint8_t m_lod; - }; - - Attrib m_attrib[stackSize]; + Attrib m_attrib[kStackSize]; State::Enum m_state; - Mesh m_mesh[Mesh::Count]; - - typedef SpriteT<256, SPRITE_TEXTURE_SIZE> Sprite; - Sprite m_sprite; - - bgfx::UniformHandle s_texColor; - bgfx::TextureHandle m_texture; - bgfx::ProgramHandle m_program[Program::Count]; - bgfx::UniformHandle u_params; - - bgfx::VertexBufferHandle m_vbh; - bgfx::IndexBufferHandle m_ibh; - - bx::AllocatorI* m_allocator; + bgfx::Encoder* m_encoder; + bgfx::Encoder* m_defaultEncoder; }; -static DebugDraw s_dd; +static DebugDrawEncoderImpl s_dde; +BX_STATIC_ASSERT(sizeof(DebugDrawEncoderImpl) <= sizeof(DebugDrawEncoder), "Size must match"); -void ddInit(bool _depthTestLess, bx::AllocatorI* _allocator) +void ddInit(bx::AllocatorI* _allocator) { - s_dd.init(_depthTestLess, _allocator); + s_dds.init(_allocator); + s_dde.init(bgfx::begin() ); } void ddShutdown() { - s_dd.shutdown(); + s_dde.shutdown(); + s_dds.shutdown(); } SpriteHandle ddCreateSprite(uint16_t _width, uint16_t _height, const void* _data) { - return s_dd.createSprite(_width, _height, _data); + return s_dds.createSprite(_width, _height, _data); } void ddDestroy(SpriteHandle _handle) { - s_dd.destroy(_handle); + s_dds.destroy(_handle); } -void ddBegin(uint8_t _viewId) +GeometryHandle ddCreateGeometry(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices, const void* _indices, bool _index32) { - s_dd.begin(_viewId); + return s_dds.createGeometry(_numVertices, _vertices, _numIndices, _indices, _index32); } -void ddEnd() +void ddDestroy(GeometryHandle _handle) { - s_dd.end(); + s_dds.destroy(_handle); } -void ddPush() +#define DEBUG_DRAW_ENCODER(_func) reinterpret_cast(this)->_func + +DebugDrawEncoder::DebugDrawEncoder() { - s_dd.push(); + DEBUG_DRAW_ENCODER(init(s_dde.m_defaultEncoder) ); } -void ddPop() +DebugDrawEncoder::~DebugDrawEncoder() { - s_dd.pop(); + DEBUG_DRAW_ENCODER(shutdown() ); } -void ddSetState(bool _depthTest, bool _depthWrite, bool _clockwise) +void DebugDrawEncoder::begin(uint16_t _viewId, bool _depthTestLess, bgfx::Encoder* _encoder) { - s_dd.setState(_depthTest, _depthWrite, _clockwise); + DEBUG_DRAW_ENCODER(begin(_viewId, _depthTestLess, _encoder) ); } -void ddSetColor(uint32_t _abgr) +void DebugDrawEncoder::end() { - s_dd.setColor(_abgr); + DEBUG_DRAW_ENCODER(end() ); } -void ddSetLod(uint8_t _lod) +void DebugDrawEncoder::push() { - s_dd.setLod(_lod); + DEBUG_DRAW_ENCODER(push() ); } -void ddSetWireframe(bool _wireframe) +void DebugDrawEncoder::pop() { - s_dd.setWireframe(_wireframe); + DEBUG_DRAW_ENCODER(pop() ); } -void ddSetStipple(bool _stipple, float _scale, float _offset) +void DebugDrawEncoder::setDepthTestLess(bool _depthTestLess) { - s_dd.setStipple(_stipple, _scale, _offset); + DEBUG_DRAW_ENCODER(setDepthTestLess(_depthTestLess) ); } -void ddSetSpin(float _spin) +void DebugDrawEncoder::setState(bool _depthTest, bool _depthWrite, bool _clockwise) { - s_dd.setSpin(_spin); + DEBUG_DRAW_ENCODER(setState(_depthTest, _depthWrite, _clockwise) ); } -void ddSetTransform(const void* _mtx) +void DebugDrawEncoder::setColor(uint32_t _abgr) { - s_dd.setTransform(_mtx); + DEBUG_DRAW_ENCODER(setColor(_abgr) ); } -void ddSetTranslate(float _x, float _y, float _z) +void DebugDrawEncoder::setLod(uint8_t _lod) { - s_dd.setTranslate(_x, _y, _z); + DEBUG_DRAW_ENCODER(setLod(_lod) ); } -void ddMoveTo(float _x, float _y, float _z) +void DebugDrawEncoder::setWireframe(bool _wireframe) { - s_dd.moveTo(_x, _y, _z); + DEBUG_DRAW_ENCODER(setWireframe(_wireframe) ); } -void ddMoveTo(const void* _pos) +void DebugDrawEncoder::setStipple(bool _stipple, float _scale, float _offset) { - s_dd.moveTo(_pos); + DEBUG_DRAW_ENCODER(setStipple(_stipple, _scale, _offset) ); } -void ddLineTo(float _x, float _y, float _z) +void DebugDrawEncoder::setSpin(float _spin) { - s_dd.lineTo(_x, _y, _z); + DEBUG_DRAW_ENCODER(setSpin(_spin) ); } -void ddLineTo(const void* _pos) +void DebugDrawEncoder::setTransform(const void* _mtx) { - s_dd.lineTo(_pos); + DEBUG_DRAW_ENCODER(setTransform(_mtx) ); } -void ddClose() +void DebugDrawEncoder::setTranslate(float _x, float _y, float _z) { - s_dd.close(); + DEBUG_DRAW_ENCODER(setTranslate(_x, _y, _z) ); } -void ddDraw(const Aabb& _aabb) +void DebugDrawEncoder::pushTransform(const void* _mtx) { - s_dd.draw(_aabb); + DEBUG_DRAW_ENCODER(pushTransform(_mtx, 1) ); } -void ddDraw(const Cylinder& _cylinder) +void DebugDrawEncoder::popTransform() { - s_dd.draw(_cylinder, false); + DEBUG_DRAW_ENCODER(popTransform() ); } -void ddDraw(const Capsule& _capsule) +void DebugDrawEncoder::moveTo(float _x, float _y, float _z) { - s_dd.draw( *( (const Cylinder*)&_capsule), true); + DEBUG_DRAW_ENCODER(moveTo(_x, _y, _z) ); } -void ddDraw(const Disk& _disk) +void DebugDrawEncoder::moveTo(const void* _pos) { - s_dd.draw(_disk); + DEBUG_DRAW_ENCODER(moveTo(_pos) ); } -void ddDraw(const Obb& _obb) +void DebugDrawEncoder::lineTo(float _x, float _y, float _z) { - s_dd.draw(_obb); + DEBUG_DRAW_ENCODER(lineTo(_x, _y, _z) ); } -void ddDraw(const Sphere& _sphere) +void DebugDrawEncoder::lineTo(const void* _pos) { - s_dd.draw(_sphere); + DEBUG_DRAW_ENCODER(lineTo(_pos) ); } -void ddDraw(const Cone& _cone) +void DebugDrawEncoder::close() { - ddDrawCone(_cone.m_pos, _cone.m_end, _cone.m_radius); + DEBUG_DRAW_ENCODER(close() ); } -void ddDrawFrustum(const void* _viewProj) +void DebugDrawEncoder::draw(const Aabb& _aabb) { - s_dd.drawFrustum(_viewProj); + DEBUG_DRAW_ENCODER(draw(_aabb) ); } -void ddDrawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees) +void DebugDrawEncoder::draw(const Cylinder& _cylinder) { - s_dd.drawArc(_axis, _x, _y, _z, _radius, _degrees); + DEBUG_DRAW_ENCODER(draw(_cylinder, false) ); } -void ddDrawCircle(const void* _normal, const void* _center, float _radius, float _weight) +void DebugDrawEncoder::draw(const Capsule& _capsule) { - s_dd.drawCircle(_normal, _center, _radius, _weight); + DEBUG_DRAW_ENCODER(draw(*( (const Cylinder*)&_capsule), true) ); } -void ddDrawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight) +void DebugDrawEncoder::draw(const Disk& _disk) { - s_dd.drawCircle(_axis, _x, _y, _z, _radius, _weight); + DEBUG_DRAW_ENCODER(draw(_disk) ); } -void ddDrawQuad(const float* _normal, const float* _center, float _size) +void DebugDrawEncoder::draw(const Obb& _obb) { - s_dd.drawQuad(_normal, _center, _size); + DEBUG_DRAW_ENCODER(draw(_obb) ); } -void ddDrawQuad(SpriteHandle _handle, const float* _normal, const float* _center, float _size) +void DebugDrawEncoder::draw(const Sphere& _sphere) { - s_dd.drawQuad(_handle, _normal, _center, _size); + DEBUG_DRAW_ENCODER(draw(_sphere) ); } -void ddDrawQuad(bgfx::TextureHandle _handle, const float* _normal, const float* _center, float _size) +void DebugDrawEncoder::draw(const Cone& _cone) { - s_dd.drawQuad(_handle, _normal, _center, _size); + DEBUG_DRAW_ENCODER(drawCone(&_cone.m_pos.x, &_cone.m_end.x, _cone.m_radius) ); } -void ddDrawCone(const void* _from, const void* _to, float _radius) +void DebugDrawEncoder::draw(GeometryHandle _handle) { - s_dd.drawCone(_from, _to, _radius); + DEBUG_DRAW_ENCODER(draw(_handle) ); } -void ddDrawCylinder(const void* _from, const void* _to, float _radius) +void DebugDrawEncoder::drawLineList(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices, const uint16_t* _indices) { - s_dd.drawCylinder(_from, _to, _radius, false); + DEBUG_DRAW_ENCODER(draw(true, _numVertices, _vertices, _numIndices, _indices) ); } -void ddDrawCapsule(const void* _from, const void* _to, float _radius) +void DebugDrawEncoder::drawTriList(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices, const uint16_t* _indices) { - s_dd.drawCylinder(_from, _to, _radius, true); + DEBUG_DRAW_ENCODER(draw(false, _numVertices, _vertices, _numIndices, _indices) ); } -void ddDrawAxis(float _x, float _y, float _z, float _len, Axis::Enum _hightlight, float _thickness) +void DebugDrawEncoder::drawFrustum(const void* _viewProj) { - s_dd.drawAxis(_x, _y, _z, _len, _hightlight, _thickness); + DEBUG_DRAW_ENCODER(drawFrustum(_viewProj) ); } -void ddDrawGrid(const void* _normal, const void* _center, uint32_t _size, float _step) +void DebugDrawEncoder::drawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees) { - s_dd.drawGrid(_normal, _center, _size, _step); + DEBUG_DRAW_ENCODER(drawArc(_axis, _x, _y, _z, _radius, _degrees) ); } -void ddDrawGrid(Axis::Enum _axis, const void* _center, uint32_t _size, float _step) +void DebugDrawEncoder::drawCircle(const void* _normal, const void* _center, float _radius, float _weight) { - s_dd.drawGrid(_axis, _center, _size, _step); + DEBUG_DRAW_ENCODER(drawCircle(_normal, _center, _radius, _weight) ); } -void ddDrawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _hightlight) +void DebugDrawEncoder::drawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight) { - s_dd.drawOrb(_x, _y, _z, _radius, _hightlight); + DEBUG_DRAW_ENCODER(drawCircle(_axis, _x, _y, _z, _radius, _weight) ); +} + +void DebugDrawEncoder::drawQuad(const float* _normal, const float* _center, float _size) +{ + DEBUG_DRAW_ENCODER(drawQuad(_normal, _center, _size) ); +} + +void DebugDrawEncoder::drawQuad(SpriteHandle _handle, const float* _normal, const float* _center, float _size) +{ + DEBUG_DRAW_ENCODER(drawQuad(_handle, _normal, _center, _size) ); +} + +void DebugDrawEncoder::drawQuad(bgfx::TextureHandle _handle, const float* _normal, const float* _center, float _size) +{ + DEBUG_DRAW_ENCODER(drawQuad(_handle, _normal, _center, _size) ); +} + +void DebugDrawEncoder::drawCone(const void* _from, const void* _to, float _radius) +{ + DEBUG_DRAW_ENCODER(drawCone(_from, _to, _radius) ); +} + +void DebugDrawEncoder::drawCylinder(const void* _from, const void* _to, float _radius) +{ + DEBUG_DRAW_ENCODER(drawCylinder(_from, _to, _radius, false) ); +} + +void DebugDrawEncoder::drawCapsule(const void* _from, const void* _to, float _radius) +{ + DEBUG_DRAW_ENCODER(drawCylinder(_from, _to, _radius, true) ); +} + +void DebugDrawEncoder::drawAxis(float _x, float _y, float _z, float _len, Axis::Enum _highlight, float _thickness) +{ + DEBUG_DRAW_ENCODER(drawAxis(_x, _y, _z, _len, _highlight, _thickness) ); +} + +void DebugDrawEncoder::drawGrid(const void* _normal, const void* _center, uint32_t _size, float _step) +{ + DEBUG_DRAW_ENCODER(drawGrid(_normal, _center, _size, _step) ); +} + +void DebugDrawEncoder::drawGrid(Axis::Enum _axis, const void* _center, uint32_t _size, float _step) +{ + DEBUG_DRAW_ENCODER(drawGrid(_axis, _center, _size, _step) ); +} + +void DebugDrawEncoder::drawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _highlight) +{ + DEBUG_DRAW_ENCODER(drawOrb(_x, _y, _z, _radius, _highlight) ); } diff --git a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h index a52da4fbd85..9bc68ae19e3 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h +++ b/3rdparty/bgfx/examples/common/debugdraw/debugdraw.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -21,12 +21,19 @@ struct Axis }; }; -struct SpriteHandle { uint16_t idx; }; +struct DdVertex +{ + float x, y, z; +}; +struct SpriteHandle { uint16_t idx; }; inline bool isValid(SpriteHandle _handle) { return _handle.idx != UINT16_MAX; } +struct GeometryHandle { uint16_t idx; }; +inline bool isValid(GeometryHandle _handle) { return _handle.idx != UINT16_MAX; } + /// -void ddInit(bool _depthTestLess = true, bx::AllocatorI* _allocator = NULL); +void ddInit(bx::AllocatorI* _allocator = NULL); /// void ddShutdown(); @@ -38,117 +45,153 @@ SpriteHandle ddCreateSprite(uint16_t _width, uint16_t _height, const void* _data void ddDestroy(SpriteHandle _handle); /// -void ddBegin(uint8_t _viewId); +GeometryHandle ddCreateGeometry(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices = 0, const void* _indices = NULL, bool _index32 = false); /// -void ddEnd(); +void ddDestroy(GeometryHandle _handle); -/// -void ddPush(); -/// -void ddPop(); +struct DebugDrawEncoder +{ + /// + DebugDrawEncoder(); -/// -void ddSetState(bool _depthTest, bool _depthWrite, bool _clockwise); + /// + ~DebugDrawEncoder(); -/// -void ddSetColor(uint32_t _abgr); + /// + void begin(uint16_t _viewId, bool _depthTestLess = true, bgfx::Encoder* _encoder = NULL); -/// -void ddSetLod(uint8_t _lod); + /// + void end(); -/// -void ddSetWireframe(bool _wireframe); + /// + void push(); -/// -void ddSetStipple(bool _stipple, float _scale = 1.0f, float _offset = 0.0f); + /// + void pop(); -/// -void ddSetSpin(float _spin); + /// + void setDepthTestLess(bool _depthTestLess); -/// -void ddSetTransform(const void* _mtx); + /// + void setState(bool _depthTest, bool _depthWrite, bool _clockwise); -/// -void ddSetTranslate(float _x, float _y, float _z); + /// + void setColor(uint32_t _abgr); -/// -void ddMoveTo(float _x, float _y, float _z = 0.0f); + /// + void setLod(uint8_t _lod); -/// -void ddMoveTo(const void* _pos); + /// + void setWireframe(bool _wireframe); -/// -void ddLineTo(float _x, float _y, float _z = 0.0f); + /// + void setStipple(bool _stipple, float _scale = 1.0f, float _offset = 0.0f); -/// -void ddLineTo(const void* _pos); + /// + void setSpin(float _spin); -/// -void ddClose(); + /// + void setTransform(const void* _mtx); -/// -void ddDraw(const Aabb& _aabb); + /// + void setTranslate(float _x, float _y, float _z); -/// -void ddDraw(const Cylinder& _cylinder); + /// + void pushTransform(const void* _mtx); -/// -void ddDraw(const Capsule& _capsule); + /// + void popTransform(); -/// -void ddDraw(const Disk& _disk); + /// + void moveTo(float _x, float _y, float _z = 0.0f); -/// -void ddDraw(const Obb& _obb); + /// + void moveTo(const void* _pos); -/// -void ddDraw(const Sphere& _sphere); + /// + void lineTo(float _x, float _y, float _z = 0.0f); -/// -void ddDraw(const Cone& _cone); + /// + void lineTo(const void* _pos); -/// -void ddDrawFrustum(const void* _viewProj); + /// + void close(); -/// -void ddDrawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees); + /// + void draw(const Aabb& _aabb); -/// -void ddDrawCircle(const void* _normal, const void* _center, float _radius, float _weight = 0.0f); + /// + void draw(const Cylinder& _cylinder); -/// -void ddDrawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight = 0.0f); + /// + void draw(const Capsule& _capsule); -/// -void ddDrawQuad(const float* _normal, const float* _center, float _size); + /// + void draw(const Disk& _disk); -/// -void ddDrawQuad(SpriteHandle _handle, const float* _normal, const float* _center, float _size); + /// + void draw(const Obb& _obb); -/// -void ddDrawQuad(bgfx::TextureHandle _handle, const float* _normal, const float* _center, float _size); + /// + void draw(const Sphere& _sphere); -/// -void ddDrawCone(const void* _from, const void* _to, float _radius); + /// + void draw(const Cone& _cone); -/// -void ddDrawCylinder(const void* _from, const void* _to, float _radius); + /// + void draw(GeometryHandle _handle); -/// -void ddDrawCapsule(const void* _from, const void* _to, float _radius); + /// + void drawLineList(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices = 0, const uint16_t* _indices = NULL); -/// -void ddDrawAxis(float _x, float _y, float _z, float _len = 1.0f, Axis::Enum _highlight = Axis::Count, float _thickness = 0.0f); + /// + void drawTriList(uint32_t _numVertices, const DdVertex* _vertices, uint32_t _numIndices = 0, const uint16_t* _indices = NULL); -/// -void ddDrawGrid(const void* _normal, const void* _center, uint32_t _size = 20, float _step = 1.0f); + /// + void drawFrustum(const void* _viewProj); -/// -void ddDrawGrid(Axis::Enum _axis, const void* _center, uint32_t _size = 20, float _step = 1.0f); + /// + void drawArc(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _degrees); -/// -void ddDrawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _highlight = Axis::Count); + /// + void drawCircle(const void* _normal, const void* _center, float _radius, float _weight = 0.0f); + + /// + void drawCircle(Axis::Enum _axis, float _x, float _y, float _z, float _radius, float _weight = 0.0f); + + /// + void drawQuad(const float* _normal, const float* _center, float _size); + + /// + void drawQuad(SpriteHandle _handle, const float* _normal, const float* _center, float _size); + + /// + void drawQuad(bgfx::TextureHandle _handle, const float* _normal, const float* _center, float _size); + + /// + void drawCone(const void* _from, const void* _to, float _radius); + + /// + void drawCylinder(const void* _from, const void* _to, float _radius); + + /// + void drawCapsule(const void* _from, const void* _to, float _radius); + + /// + void drawAxis(float _x, float _y, float _z, float _len = 1.0f, Axis::Enum _highlight = Axis::Count, float _thickness = 0.0f); + + /// + void drawGrid(const void* _normal, const void* _center, uint32_t _size = 20, float _step = 1.0f); + + /// + void drawGrid(Axis::Enum _axis, const void* _center, uint32_t _size = 20, float _step = 1.0f); + + /// + void drawOrb(float _x, float _y, float _z, float _radius, Axis::Enum _highlight = Axis::Count); + + BX_ALIGN_DECL_CACHE_LINE(uint8_t) m_internal[50<<10]; +}; #endif // DEBUGDRAW_H_HEADER_GUARD diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h index db13e1a87c1..3e0fac8f155 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h @@ -8,142 +8,49 @@ static const uint8_t fs_debugdraw_fill_glsl[104] = 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x5b, // olor = u_params[ 0x33, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 3];.}... }; -static const uint8_t fs_debugdraw_fill_spv[2142] = +static const uint8_t fs_debugdraw_fill_spv[641] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0x40, 0x08, 0x00, 0x00, 0x03, 0x02, 0x23, // ams......@.....# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x2e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........a..... + 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0x60, 0x02, 0x00, 0x00, 0x03, 0x02, 0x23, // ams......`.....# + 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........G...... 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, // ................ - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....main....... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x4d, 0x0f, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .....M...@main(v - 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2c, 0x41, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......,A..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, // .....bgfx_VoidFr - 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x70, 0x61, 0x72, // ag........^..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, // am...........$Gl - 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // obal............ - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewRect..... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, // .........u_viewT - 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // exel............ - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, // .u_view......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, // .....u_invView.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .............u_p - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // roj............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_invProj...... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .........u_viewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // roj............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .u_invViewProj.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m - 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // odel............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, // .u_modelView.... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, // ViewProj........ - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, // .....u_alphaRef4 - 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .............u_p - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // arams........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3d, 0x51, 0x00, 0x00, 0x67, 0x6c, 0x5f, // .........=Q..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_0_..... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7d, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // _0_..G...}...... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#... ...H...... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xf5, 0x00, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x7d, 0x01, 0x00, // .j... .......}.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .e...j...+...... - 0x00, 0x16, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xb2, 0x04, 0x00, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xd2, 0x01, 0x00, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x7d, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .}...e...e...... - 0x00, 0xb2, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4f, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...O...... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x04, 0x00, 0x00, 0x42, 0x13, 0x00, // .....;...O...B.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, // .....+.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // .....6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2d, 0x61, 0x00, // .............-a. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. - 0x00, 0x39, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xe7, 0x49, 0x00, 0x00, 0x4d, 0x0f, 0x00, // .9........I..M.. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x51, 0x00, // .....=.......=Q. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x3d, 0x51, 0x00, // .....>.......=Q. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .....8...6...... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .5...........7.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, // ................ - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......dW..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........N..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......I9..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........9..... - 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, // .P........*..dW. - 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..N..I9...9..... - 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // ..*..8...6...... - 0x00, 0x4d, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .M...........7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2c, 0x41, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x31, 0x27, 0x00, // .....,A......1'. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........^..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....^......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5e, 0x00, // .........5....^. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x0a, 0x5a, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........Z..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x6b, 0x2e, 0x00, 0x00, 0x0a, 0x5a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x41, 0x00, // .k....Z..>...,A. - 0x00, 0x6b, 0x2e, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .k.......8.... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....main....... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // . ...$Global.... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // . .......u_param + 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // s........"...... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .........bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // agData0..G...... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, // .........H... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#.......G.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, // . .......G...".. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // . .......+...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // ................ + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...!...... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // . ...;...!...".. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, // .....+...#...$.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, // .....+...#...%.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...&...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...-...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, // .....;...-...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x41, 0x00, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .A...&...E...".. + 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .$...%...=...... + 0x00, 0x46, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2e, 0x00, 0x00, // .F...E...>...... + 0x00, 0x46, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, // .F.......8.....@ + 0x00, // . }; static const uint8_t fs_debugdraw_fill_dx9[182] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc index 532cf6e42c0..f04d07e1c27 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h index 3586d73caeb..4df9a09bcb9 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h @@ -33,261 +33,102 @@ static const uint8_t fs_debugdraw_fill_lit_glsl[510] = 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // gl_FragColor = 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tmpvar_3;.}... }; -static const uint8_t fs_debugdraw_fill_lit_spv[4038] = +static const uint8_t fs_debugdraw_fill_lit_spv[1489] = { 0x46, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH...V_...u_par - 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0xa8, 0x0f, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // .........ob..... + 0x61, 0x6d, 0x73, 0x12, 0x04, 0x00, 0x00, 0x04, 0x00, 0xb0, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# + 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0xd4, 0x0f, 0x00, 0x00, 0x6f, 0x12, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .....o.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x6d, 0x69, 0x78, // n........0...mix - 0x28, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x00, // (vf3;vf3;vf3;... - 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x5f, 0x61, 0x00, 0x00, 0x05, 0x00, 0x03, // ........._a..... - 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xd9, 0x0e, 0x00, // ....._b......... - 0x00, 0x5f, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x01, 0x14, 0x00, 0x00, 0x76, 0x65, 0x63, // ._t..........vec - 0x33, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, // 3_splat(f1;..... - 0x00, 0xe5, 0x41, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, // ..A.._x......5.. - 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, // .vec4_splat(f1;. - 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x07, // ........._x..... - 0x00, 0xd1, 0x10, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x33, 0x3b, 0x76, // .....@main(vf3;v - 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6e, 0x62, 0x00, // f3;vf4;......nb. - 0x00, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8f, 0x41, 0x00, // .v_view.......A. - 0x00, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8c, 0x4a, 0x00, // .v_world......J. - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, // .........bgfx_Vo - 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, // idFrag........]. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x83, 0x0f, 0x00, // .param.......... - 0x00, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x58, 0x0d, 0x00, // .normal......X.. - 0x00, 0x76, 0x69, 0x65, 0x77, 0x44, 0x69, 0x72, 0x00, 0x05, 0x00, 0x04, 0x00, 0x67, 0x15, 0x00, // .viewDir.....g.. - 0x00, 0x6e, 0x64, 0x6f, 0x74, 0x6c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, // .ndotl.......... - 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xe2, 0x04, 0x00, // .$Global........ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, // .....u_viewRect. - 0x00, 0x06, 0x00, 0x06, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v - 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // iewTexel........ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_view..... - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi - 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ew.............. - 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xe2, 0x04, 0x00, // .u_proj......... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .....u_invProj.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xe2, 0x04, 0x00, // iewProj......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // .....u_invViewPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, // oj.............. - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xe2, 0x04, 0x00, // .u_model........ - 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // .....u_modelView - 0x00, 0x06, 0x00, 0x07, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, // odelViewProj.... - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, // .........u_alpha - 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x06, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0c, 0x00, 0x00, // Ref4............ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x79, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, // .y...|.......... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, // n........H...$Gl + 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // obal.....H...... 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, // .u_params....... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x96, 0x0e, 0x00, // .B.............. - 0x00, 0x64, 0x69, 0x66, 0x66, 0x75, 0x73, 0x65, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x56, 0x00, // .diffuse......V. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbe, 0x39, 0x00, // .param........9. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, 0x00, // .param........9. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0c, 0x0a, 0x00, // .param.......... - 0x00, 0x73, 0x70, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x91, 0x37, 0x00, // .spec.........7. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xcb, 0x41, 0x00, // .param........A. - 0x00, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x0f, 0x00, // .v_view......... - 0x00, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2c, 0x3f, 0x00, // .v_view......,?. - 0x00, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6f, 0x12, 0x00, // .v_world.....o.. - 0x00, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, // .v_world........ - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......G..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......U..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // .........param.. - 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // .........gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x04, 0x00, // Data_0_..G...B.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xfa, 0x07, 0x00, // .....@...G...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, // . ...H.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...`...H.. - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................ - 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................ - 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // . ...H.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...`...H.. - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................ - 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................ - 0x00, 0x48, 0x00, 0x04, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xe2, 0x04, 0x00, // .........H...... - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#... ...H.. - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, // .........#...0.. - 0x00, 0x47, 0x00, 0x03, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...........G.. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .B...".......G.. - 0x00, 0xd4, 0x0f, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .............G.. - 0x00, 0x6f, 0x12, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .o...........G.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // ................ - 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, // .....!.......... - 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ......... ...... - 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, // .............!.. - 0x00, 0x75, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, // .u.............. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, // .....!.......... - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....!.......... - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .....!...n...... - 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, // ................ - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0x42, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, // .B...e...j...+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // ................ - 0x00, 0xfa, 0x07, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // ................ - 0x00, 0xe2, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x42, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...B...e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xfa, 0x07, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5f, 0x07, 0x00, // ......... ..._.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0xe2, 0x04, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5f, 0x07, 0x00, // .........;..._.. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.............. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ./.......+...... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ........?+...... - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .........+...... - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // ......... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0xd4, 0x0f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0x6f, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .o....... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, // .Sa..;........G. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, // .....=........A. - 0x00, 0xd4, 0x0f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, // .....=.......,?. - 0x00, 0x6f, 0x12, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc9, 0x47, 0x00, 0x00, 0xcb, 0x41, 0x00, // .o...>....G...A. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....U..,?..9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xd1, 0x10, 0x00, 0x00, 0xc9, 0x47, 0x00, // ......&.......G. - 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ..U......=...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, // .........>...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .........8...6.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, // .....0.......u.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...........7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, // .........7...... - 0x00, 0xd9, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x9a, 0x54, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..........T..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x75, 0x1e, 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....u.......=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x8b, 0x43, 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C......=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x92, 0x42, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x0c, 0x00, 0x08, // ......B......... - 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x1a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, // ................ - 0x00, 0x75, 0x1e, 0x00, 0x00, 0x8b, 0x43, 0x00, 0x00, 0x92, 0x42, 0x00, 0x00, 0xfe, 0x00, 0x02, // .u....C...B..... - 0x00, 0x05, 0x1a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, // .....8...6...... - 0x00, 0x01, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .............7.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xe5, 0x41, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x73, 0x1d, 0x00, // ......A......s.. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6a, 0x62, 0x00, 0x00, 0xe5, 0x41, 0x00, // .=.......jb...A. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x18, 0x5b, 0x00, 0x00, 0xe5, 0x41, 0x00, // .=........[...A. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x2b, 0x00, 0x00, 0xe5, 0x41, 0x00, // .=.......)+...A. - 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x9b, 0x19, 0x00, 0x00, 0x6a, 0x62, 0x00, // .P...........jb. - 0x00, 0x18, 0x5b, 0x00, 0x00, 0x29, 0x2b, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x9b, 0x19, 0x00, // ..[..)+......... - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2e, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........._..=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......[......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....%S......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......=......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // ......=......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0x25, 0x53, 0x00, // .....V[...[..%S. - 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x56, 0x5b, 0x00, // ..=...=......V[. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xd1, 0x10, 0x00, // .8...6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, // .....n...7...... - 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x8f, 0x41, 0x00, // .nb..7........A. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7........J..... - 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, 0x00, // ..S..;........]. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xd4, 0x56, 0x00, // .....;........V. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xbe, 0x39, 0x00, // .....;........9. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xf7, 0x39, 0x00, // .....;........9. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x91, 0x37, 0x00, // .....;........7. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....>....]..... - 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, // .9...........5.. - 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa5, 0x29, 0x00, // ..]..=........). - 0x00, 0x8f, 0x41, 0x00, 0x00, 0xcf, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xeb, 0x21, 0x00, // ..A...........!. - 0x00, 0xa5, 0x29, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xc9, 0x1f, 0x00, // ..)..=.......... - 0x00, 0x8f, 0x41, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf9, 0x2f, 0x00, // ..A.........../. - 0x00, 0xc9, 0x1f, 0x00, 0x00, 0xd0, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd5, 0x44, 0x00, // ..............D. - 0x00, 0xf9, 0x2f, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x18, 0x00, 0x00, 0x00, 0x62, 0x5a, 0x00, // ../..........bZ. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xeb, 0x21, 0x00, 0x00, 0xd5, 0x44, 0x00, // .....D....!...D. - 0x00, 0x0c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x45, 0x00, 0x00, 0x00, 0x62, 0x5a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, // .E...bZ..=...... - 0x00, 0xf4, 0x1e, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, // .....nb......... - 0x00, 0xe7, 0x2b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0xf4, 0x1e, 0x00, // ..+......E...... - 0x00, 0x7f, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x58, 0x0d, 0x00, 0x00, 0xe7, 0x2b, 0x00, // .........X....+. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........`..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xb5, 0x2a, 0x00, 0x00, 0x83, 0x60, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, // ..*...`..O...... - 0x00, 0x7c, 0x4a, 0x00, 0x00, 0xb5, 0x2a, 0x00, 0x00, 0xb5, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, // .|J...*...*..... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x94, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x67, 0x15, 0x00, 0x00, 0x83, 0x0f, 0x00, 0x00, 0x7c, 0x4a, 0x00, 0x00, 0x85, 0x00, 0x05, // .g.......|J..... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5e, 0x5e, 0x00, 0x00, 0x67, 0x15, 0x00, 0x00, 0xfc, 0x00, 0x00, // .....^^..g...... - 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x97, 0x19, 0x00, 0x00, 0x5e, 0x5e, 0x00, // .............^^. - 0x00, 0xfc, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1e, 0x54, 0x00, // .....P........T. - 0x00, 0x97, 0x19, 0x00, 0x00, 0x97, 0x19, 0x00, 0x00, 0x97, 0x19, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x44, 0x3d, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....D=..B.../.. - 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xfb, 0x1a, 0x00, // .....=.......... - 0x00, 0x44, 0x3d, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0f, 0x35, 0x00, // .D=..O........5. - 0x00, 0xfb, 0x1a, 0x00, 0x00, 0xfb, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x0f, 0x35, 0x00, // .....>....V...5. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xc3, 0x49, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........I..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x37, 0x5f, 0x00, 0x00, 0xc3, 0x49, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, // .7_...I..O...... - 0x00, 0xd6, 0x34, 0x00, 0x00, 0x37, 0x5f, 0x00, 0x00, 0x37, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, // ..4..7_..7_..... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x39, 0x00, // .........>....9. - 0x00, 0xd6, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x1e, 0x54, 0x00, // ..4..>....9...T. - 0x00, 0x39, 0x00, 0x07, 0x00, 0x18, 0x00, 0x00, 0x00, 0x8b, 0x56, 0x00, 0x00, 0x30, 0x0c, 0x00, // .9........V..0.. - 0x00, 0xd4, 0x56, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x41, 0x00, 0x06, // ..V...9...9..A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x20, 0x58, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ..... X..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x58, 0x61, 0x00, // .....=.......Xa. - 0x00, 0x20, 0x58, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x5a, 0x4f, 0x00, // . X..O.......ZO. - 0x00, 0x58, 0x61, 0x00, 0x00, 0x58, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .Xa..Xa......... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x96, 0x0e, 0x00, // ................ - 0x00, 0x8b, 0x56, 0x00, 0x00, 0x5a, 0x4f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x91, 0x37, 0x00, // ..V..ZO..>....7. - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x19, 0x4e, 0x00, // .....9........N. - 0x00, 0x01, 0x14, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, // ......7......... - 0x00, 0x3b, 0x2f, 0x00, 0x00, 0x96, 0x0e, 0x00, 0x00, 0x19, 0x4e, 0x00, 0x00, 0x41, 0x00, 0x07, // .;/.......N..A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x84, 0x3a, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......:..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0xaf, 0x2a, 0x00, 0x00, 0x84, 0x3a, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ..*...:..Q...... - 0x00, 0xe5, 0x33, 0x00, 0x00, 0x3b, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // ..3..;/......Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xde, 0x43, 0x00, 0x00, 0x3b, 0x2f, 0x00, 0x00, 0x01, 0x00, 0x00, // ......C..;/..... - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0x3b, 0x2f, 0x00, // .Q........O..;/. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9e, 0x3f, 0x00, // .....P........?. - 0x00, 0xe5, 0x33, 0x00, 0x00, 0xde, 0x43, 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0xaf, 0x2a, 0x00, // ..3...C...O...*. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>....J...?..... - 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .8.... + 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // .J...........y.. + 0x00, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, // .v_view......|.. + 0x00, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x05, 0x00, 0x06, 0x00, 0x87, 0x00, 0x00, // .v_world........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .G...G.......... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...H.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...H...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...J..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...y.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...|.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x87, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x17, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x15, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....E... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .+...E...F...... + 0x00, 0x1c, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, // .....G.......F.. + 0x00, 0x1e, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....H...G... .. + 0x00, 0x49, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .I.......H...;.. + 0x00, 0x49, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .I...J.......... + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .K... .......+.. + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .K...L....... .. + 0x00, 0x4d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .M...........+.. + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .K...S.......+.. + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .K...T.......+.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x2b, 0x00, 0x04, // .....V......?+.. + 0x00, 0x4b, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .K...d.......+.. + 0x00, 0x45, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .E...o....... .. + 0x00, 0x70, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .p........... .. + 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .x...........;.. + 0x00, 0x78, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .x...y.......;.. + 0x00, 0x78, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .x...|....... .. + 0x00, 0x86, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x86, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .........=...... + 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xcf, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .}...|.......... + 0x00, 0xa8, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .....}.......... + 0x00, 0xaa, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .....}.......... + 0x00, 0xab, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0xac, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, // .........D...... + 0x00, 0xab, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .....E.......A.. + 0x00, 0x4d, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, // .M.......J...L.. + 0x00, 0x4c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, // .L...=.......... + 0x00, 0xb2, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, // .....O.......... + 0x00, 0xb3, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x94, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, // ................ + 0x00, 0xad, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0xb7, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, // .........V...... + 0x00, 0x06, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, // .............V.. + 0x00, 0x50, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, // .P.............. + 0x00, 0xb8, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, // .........A...M.. + 0x00, 0xba, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // .....J...L...S.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, // .=.............. + 0x00, 0x4f, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, // .O.............. + 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, // .A...M.......J.. + 0x00, 0x4c, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, // .L...T...=...... + 0x00, 0xbe, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, // .........O...... + 0x00, 0xbf, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0xd9, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, // ................ + 0x00, 0xbf, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, // .........A...M.. + 0x00, 0xc1, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, // .....J...L...d.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, // .=.............. + 0x00, 0x4f, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, // .O.............. + 0x00, 0xc2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, // ................ + 0x00, 0xc3, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07, 0x00, 0x70, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, // .....A...p...... + 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, // .J...L...d...o.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, // .=.............. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, // .Q.............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, // .....Q.......... + 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .........Q...... + 0x00, 0xcd, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, // .............P.. + 0x00, 0x14, 0x00, 0x00, 0x00, 0xce, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, // ................ + 0x00, 0xcd, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x87, 0x00, 0x00, // .........>...... + 0x00, 0xce, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, // .........8.....@ + 0x00, // . }; static const uint8_t fs_debugdraw_fill_lit_dx9[402] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc index 7fb087d1428..a16bbe458e1 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc @@ -1,7 +1,7 @@ $input v_view, v_world /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.bin.h index c92ca603216..7d47b793184 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.bin.h @@ -17,233 +17,73 @@ static const uint8_t fs_debugdraw_fill_texture_glsl[253] = 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x2a, 0x20, 0x76, 0x5f, // = (tmpvar_1 * v_ 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // color0);.}... }; -static const uint8_t fs_debugdraw_fill_texture_spv[3599] = +static const uint8_t fs_debugdraw_fill_texture_spv[1034] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x03, 0x02, // FSH............. - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........ob.... + 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x03, 0x02, // FSH............. + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...t......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x62, 0x67, // in............bg - 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x73, 0x74, 0x72, 0x75, // fxTexture2D(stru - 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // ct-BgfxSampler2D - 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x05, 0x00, // -p1-t211;vf2;... - 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ..~..._sampler.m - 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, // _sampler........ - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, // .._sampler.m_tex - 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, // ture.........._c - 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, // oord......5...ve - 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c4_splat(f1;.... - 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x16, 0x0e, // ......_x........ - 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, // ..@main(vf4;vf2; - 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x76, 0x5f, // vf4;......nb..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x8f, 0x41, // color0.........A - 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x06, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ...J..gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, // a_0_......a...Bg + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x10, 0x00, // ..K...O...Z..... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, // in............Bg 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, // fxSampler2D..... - 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..a.......m_samp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, // ler.......a..... + 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, // ler............. 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... - 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, // ......flattenTem - 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // p.........s_texC + 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // .. ...s_texColor + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......"...s_texC 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, // olorSampler..... - 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, // Texture......... - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, // ..s_texColor.m_s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, // ampler........P. - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, // ..s_texColor.m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, // exture.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, // ..bgfx_VoidFrag. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......]..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......V..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......9..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x91, 0x37, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......7..param. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .......+..v_colo - 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, // r0........w...v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, // color0.........< - 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..t...v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0.........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, // gData_0_.......U - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, // ..param........8 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, // ..param......... - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, // ..param......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, // ......D...$Globa - 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....D.......u_ - 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, // viewRect......D. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, // ......u_viewTexe - 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....D.......u_ - 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, 0x00, 0x00, 0x03, 0x00, // view......D..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invView..... - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, // ..D.......u_proj - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......D.......u_ - 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, // invProj.......D. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // ......u_viewProj - 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x44, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......D.......u_ - 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // invViewProj..... - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..D.......u_mode - 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....D.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x44, 0x06, // modelView.....D. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x44, 0x06, 0x00, 0x00, 0x0b, 0x00, // wProj.....D..... - 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, // ..u_alphaRef4.G. - 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......".......G. - 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......!.......G. - 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......".......G. - 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......!.......G. - 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..w...........G. - 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, // ..t...........G. - 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..............G. - 0x04, 0x00, 0xc2, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, // ..........@...H. - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, // ..D.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...D.......#. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x02, 0x00, // ......H...D..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x02, 0x00, // ......H...D..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, // ..#... ...H...D. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..D...........H. - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, // ..D.......#...`. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...D......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x04, 0x00, // ......H...D..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x04, 0x00, // ......H...D..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, // ..#.......H...D. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..D...........H. - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..D.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...D......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x06, 0x00, // ......H...D..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x06, 0x00, // ......H...D..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, // ..#... ...H...D. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..D...........H. - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, // ..D.......#...`. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...D......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x08, 0x00, // ......H...D..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x08, 0x00, // ......H...D..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, // ..#.......H...D. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..D...........H. - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, // ..D.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...D......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x44, 0x06, 0x00, 0x00, 0x0a, 0x00, // ......H...D..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x0a, 0x00, // ......H...D..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x06, // ..#.......H...D. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x44, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, // ..D.......#... . - 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x44, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, // ..G...D......... - 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, // .......... ...y. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x0a, 0x08, // ..........!..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, // ......y......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x69, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, // ..!...i......... - 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, // ..............a. - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, // ......a... ...z. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, // ..........;...z. - 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, // .......... ..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, // ..........;..... - 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, // .......... ...{. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, // ..........;...{. - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // .. .......+..... - 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, // .......... ..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, // ..........;..... - 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..P.......+..... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, // ................ - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, // ......;.......w. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, // ......;.......t. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, // ......;......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..........e..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......+.......j. - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xc2, 0x03, 0x00, 0x00, 0x65, 0x00, // .. ...........e. - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x44, 0x06, 0x00, 0x00, 0x1d, 0x00, // ..j.......D..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ......e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xc2, 0x03, // ..e...e...e..... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, // ..e...e.......6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, // ................ - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, // ......Sa..;..... - 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ..........;..... - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, // ...U......;..... - 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...8......;..... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..!C......=..... - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, // ...3......P...a. - 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, // ..^ ..!C...3..>. - 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. - 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, // ..........A..... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. - 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..P.......=..... - 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, // ...+..w...=..... - 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, // ...<..t...>....U - 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, // ...+..>....8...< - 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0x16, 0x0e, // ..9........&.... - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // ...U...8......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, // ......7...y...~. - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, // ................ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xf7, 0x0d, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x7e, 0x17, // ..=........H..~. - 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, // ..V........>.... - 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x24, // ...H..=........$ - 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, // ......W........Y - 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, // ...>...$.......Y - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, // ..8...6.......5. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2e, 0x5f, 0x00, 0x00, 0x3d, 0x00, // ..........._..=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......[......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......%S......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......=......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......=......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0x25, 0x53, // ......V[...[..%S - 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x56, 0x5b, // ...=...=......V[ - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x0e, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......i...7..... - 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8f, 0x41, // ..nb..7........A - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf8, 0x00, // ..7........J.... - 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, // ...S..;........] - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xd4, 0x56, // ......;...y....V - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x39, // ......;........9 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x91, 0x37, // ......;........7 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, // ......>....].... - 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, // ..9...........5. - 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, // ...]..=.......#A - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x23, 0x41, // ......>....V..#A - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x50, 0x13, // ..=........,..P. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, // ..>....9...,..=. - 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x3e, 0x00, // ......7,...A..>. - 0x03, 0x00, 0x91, 0x37, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, // ...7..7,..9..... - 0x00, 0x00, 0x8e, 0x1d, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0xf7, 0x39, // ...........V...9 - 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xba, 0x5b, // ...7..=........[ - 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x34, // ..nb..........;4 - 0x00, 0x00, 0x8e, 0x1d, 0x00, 0x00, 0xba, 0x5b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x4a, // .......[..>....J - 0x00, 0x00, 0x3b, 0x34, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..;4......8.... + 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..%...s_texColor + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4b, 0x00, // Texture.......K. + 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... + 0x05, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..O...v_texcoord + 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, // 0.....Z...bgfx_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ragData0..G...%. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ..".......G...%. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x00, // ..!.......G...K. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4f, 0x00, // ..........G...O. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5a, 0x00, // ..........G...Z. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ......... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, // ......;....... . + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ...!..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, // ......;...!...". + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ...$..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......;...$...%. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, // ..........1..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ...J......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...J...K..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, // .. ...N......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...N...O..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x59, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ...Y......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x59, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;...Y...Z..... + 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......#..."...=. + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, // ......&...%...P. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, // ......'...#...&. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..>... ...'...=. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......L...K...=. + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......P...O...=. + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, // ......t... ...Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........t..... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x74, 0x00, // ..Q...........t. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0x84, 0x00, // ......V...1..... + 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..........W..... + 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x85, 0x00, // ..........P..... + 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x4c, 0x00, // ......x.......L. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>...Z...x..... + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ..8....... }; static const uint8_t fs_debugdraw_fill_texture_dx9[240] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc index 7b27eaa1b32..7a1f5b5ecb8 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h index f8c37fc71f7..d7390a788fb 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h @@ -7,138 +7,34 @@ static const uint8_t fs_debugdraw_lines_glsl[89] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t fs_debugdraw_lines_spv[2079] = +static const uint8_t fs_debugdraw_lines_spv[402] = { - 0x46, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x03, 0x02, // FSH....I........ - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, // #.........za.... + 0x46, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x03, 0x02, // FSH....I........ + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, // #.........+..... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, // ..w............. + 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, // ..!...*......... 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, // ................ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, // ......5...vec4_s - 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, // plat(f1;........ - 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x40, 0x6d, // .._x..........@m - 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, // ain(vf4;vf4;.... - 0x05, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..O0..v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa2, 0x25, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // .......%..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, // gData_0_........ - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, // ..bgfx_VoidFrag. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ......,N..param. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .......@..v_colo - 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, // r0........w...v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // color0.......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xef, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......G..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc7, 0x02, // gData_0_........ - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..$Global....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, // viewTexel....... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, // iew............. - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..u_proj........ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc7, 0x02, // viewProj........ - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..u_model....... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..........u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, // aRef4.G...w..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf0, 0x06, 0x00, 0x00, 0x06, 0x00, // ......G......... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xc7, 0x02, // ..#... ...G..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // .. ... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x3d, 0x0b, 0x00, 0x00, 0x08, 0x00, // ......!...=..... - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // .......... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..w....... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .. .......+..... - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf0, 0x06, // ..j... ......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xc7, 0x02, // ..e...j......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..........e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......e...e..... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xef, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......G......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3e, 0x00, // .......@..w...>. - 0x03, 0x00, 0xef, 0x47, 0x00, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, // ...G...@..9..... - 0x00, 0x00, 0x79, 0x61, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xef, 0x47, 0x00, 0x00, 0x9a, 0x16, // ..ya.......G.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, // ..8...6.......5. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......dW......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......N......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......I9......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......9......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, // .......*..dW...N - 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, // ..I9...9.......* - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0x0f, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......=...7..... - 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x25, // ..O0..7........% - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xee, 0x5f, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // ......._..;..... - 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x4e, // ..,N......>...,N - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..5...,N..=..... - 0x00, 0x00, 0x58, 0x5b, 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x25, // ..X[..O0..>....% - 0x00, 0x00, 0x58, 0x5b, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..X[......8.... + 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......!...v_colo + 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x62, 0x67, // r0........*...bg + 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, // fx_FragData0..G. + 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..!...........G. + 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, // ..*............. + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ......!......... + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, // .......... ..... + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // .. ...........;. + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // .. ...!....... . + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..)...........;. + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..)...*.......6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..........=..... + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2a, 0x00, // .."...!...>...*. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, // ..".......8..... + 0x00, 0x00, // .. }; static const uint8_t fs_debugdraw_lines_dx9[131] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc index 19f8692163c..0b13177a98c 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h index 3f2c6870752..ab91393a414 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h @@ -16,183 +16,52 @@ static const uint8_t fs_debugdraw_lines_stipple_glsl[235] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, // _FragColor = v_c 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor0;.}... }; -static const uint8_t fs_debugdraw_lines_stipple_spv[2787] = +static const uint8_t fs_debugdraw_lines_stipple_spv[698] = { - 0x46, 0x53, 0x48, 0x05, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0xd4, 0x0a, 0x00, 0x00, 0x03, 0x02, // FSH...Z......... - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0xf4, 0x61, 0x00, 0x00, 0x00, 0x00, // #..........a.... + 0x46, 0x53, 0x48, 0x05, 0xe7, 0x1a, 0x5a, 0xef, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0x03, 0x02, // FSH...Z......... + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, // #.........}..... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0xf9, 0x15, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w............. - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x13, 0x00, 0x00, 0x6d, 0x6f, // in........,...mo - 0x64, 0x28, 0x66, 0x31, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, // d(f1;f1;........ - 0x00, 0x00, 0x5f, 0x61, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, // .._a.........._b - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, // ......5...vec4_s - 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, // plat(f1;........ - 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x40, 0x6d, // .._x..........@m - 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x66, 0x31, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, // ain(vf4;f1;vf4;. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xfb, 0x54, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .......T..v_colo - 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa4, 0x52, 0x00, 0x00, 0x76, 0x5f, // r0.........R..v_ - 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xbf, 0x58, // stipple........X - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, // ..........bgfx_V - 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x97, 0x52, // oidFrag........R - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x07, 0x4c, // ..param........L - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8b, 0x2c, // ..param........, - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, // ..param........A - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..w...v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, // ......,?..v_stip - 0x70, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf9, 0x15, 0x00, 0x00, 0x76, 0x5f, // ple...........v_ - 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // stipple......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......G..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......U..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0b, 0x05, // gData_0_........ - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0b, 0x05, // ..$Global....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x0b, 0x05, // viewTexel....... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x04, 0x00, // iew............. - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0b, 0x05, // ..u_proj........ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x0b, 0x05, // viewProj........ - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x08, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0b, 0x05, // ..u_model....... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..........u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, // aRef4.G...w..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf9, 0x15, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x06, 0x00, // ......G...*..... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0b, 0x05, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x0b, 0x05, // ..#... ...G..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // .. ... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0xd7, 0x0a, 0x00, 0x00, 0x0d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, // ..........!..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x51, 0x00, // ..........!...Q. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6e, 0x01, 0x00, 0x00, 0x00, 0x00, // .>+.......n..... - 0x80, 0x3e, 0x14, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // .>........ ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, // ..w....... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8b, 0x02, // ..........;..... - 0x00, 0x00, 0xf9, 0x15, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // .......... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .. .......+..... - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x2a, 0x07, // ..j... .......*. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x0b, 0x05, // ..e...j......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..........e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..*...e...e..... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......G......;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......U......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......A..w...=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0xf9, 0x15, 0x00, 0x00, 0x3e, 0x00, // ......,?......>. - 0x03, 0x00, 0xc9, 0x47, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, // ...G...A..>....U - 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, // ..,?..9........& - 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, // .......G...U.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x13, // ..8...6.......,. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, 0x0a, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xc7, 0x0e, // ......7......... - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x43, 0x5c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ......C...=..... - 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..dW......=..... - 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ...N......=..... - 0x00, 0x00, 0x71, 0x3d, 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..q=......=..... - 0x00, 0x00, 0x15, 0x4c, 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x00, // ...L............ - 0x00, 0x00, 0xf6, 0x18, 0x00, 0x00, 0x71, 0x3d, 0x00, 0x00, 0x15, 0x4c, 0x00, 0x00, 0x0c, 0x00, // ......q=...L.... - 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa1, 0x2b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // .......+........ - 0x00, 0x00, 0xf6, 0x18, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x86, 0x40, // ...............@ - 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xa1, 0x2b, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, // ...N...+........ - 0x00, 0x00, 0xbf, 0x2c, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0x86, 0x40, 0x00, 0x00, 0xfe, 0x00, // ...,..dW...@.... - 0x02, 0x00, 0xbf, 0x2c, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...,..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc4, 0x25, // ...............% - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x94, 0x1f, 0x00, 0x00, 0xdd, 0x0e, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x00, 0x00, 0xdd, 0x0e, // ..=........H.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbf, 0x32, 0x00, 0x00, 0xdd, 0x0e, // ..=........2.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd2, 0x32, 0x00, 0x00, 0xdd, 0x0e, // ..=........2.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xec, 0x21, 0x00, 0x00, 0x94, 0x1f, // ..P........!.... - 0x00, 0x00, 0x1f, 0x48, 0x00, 0x00, 0xbf, 0x32, 0x00, 0x00, 0xd2, 0x32, 0x00, 0x00, 0xfe, 0x00, // ...H...2...2.... - 0x02, 0x00, 0xec, 0x21, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ...!..8...6..... - 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x37, 0x00, // ..........Q...7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xfb, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // .......T..7..... - 0x00, 0x00, 0xa4, 0x52, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbf, 0x58, // ...R..7........X - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf3, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......a..;..... - 0x00, 0x00, 0x97, 0x52, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // ...R......;..... - 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // ...L......;..... - 0x00, 0x00, 0x8b, 0x2c, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x97, 0x52, // ...,......>....R - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x97, 0x52, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..5....R..=..... - 0x00, 0x00, 0x69, 0x4f, 0x00, 0x00, 0xa4, 0x52, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x07, 0x4c, // ..iO...R..>....L - 0x00, 0x00, 0x69, 0x4f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x2c, 0x00, 0x00, 0x6e, 0x01, // ..iO..>....,..n. - 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x22, 0x00, 0x00, 0x2c, 0x13, // ..9.......!"..,. - 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x8b, 0x2c, 0x00, 0x00, 0xb8, 0x00, 0x05, 0x00, 0x09, 0x00, // ...L...,........ - 0x00, 0x00, 0x6e, 0x1d, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x21, 0x22, 0x00, 0x00, 0xf7, 0x00, // ..n.......!".... - 0x03, 0x00, 0x09, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x6e, 0x1d, // ..............n. - 0x00, 0x00, 0x2a, 0x4a, 0x00, 0x00, 0x09, 0x1d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2a, 0x4a, // ..*J..........*J - 0x00, 0x00, 0xfc, 0x00, 0x01, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x09, 0x1d, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x05, 0x3c, 0x00, 0x00, 0xfb, 0x54, 0x00, 0x00, 0x3e, 0x00, // .......<...T..>. - 0x03, 0x00, 0xbf, 0x58, 0x00, 0x00, 0x05, 0x3c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ...X...<......8. - 0x01, 0x00, 0x00, // ... + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x10, 0x00, // ..<...@...K..... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x76, 0x5f, // in........<...v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x00, // color0........@. + 0x00, 0x00, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_stipple..... + 0x06, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ..K...bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ata0..G...<..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...@..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...K..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, // .. ............. + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2e, 0x00, // ......+......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2f, 0x00, // .....>+......./. + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x14, 0x00, 0x02, 0x00, 0x34, 0x00, 0x00, 0x00, 0x20, 0x00, // .....>....4... . + 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..;...........;. + 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..;...<....... . + 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..?...........;. + 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ..?...@....... . + 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..J...........;. + 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..J...K.......+. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x36, 0x00, // ......|......@6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... + 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, // ..=...<...=..... + 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, // ..A...@......... + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x0c, 0x00, // ..w...A...|..... + 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ......x......... + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x79, 0x00, // ..w...........y. + 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, // ../...x......... + 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0xb8, 0x00, // ..z...A...y..... + 0x05, 0x00, 0x34, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x7a, 0x00, // ..4...g.......z. + 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, // ......h......... + 0x04, 0x00, 0x67, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0xf8, 0x00, // ..g...i...h..... + 0x02, 0x00, 0x69, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x01, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x68, 0x00, // ..i...........h. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>...K...=..... + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ..8....... }; static const uint8_t fs_debugdraw_lines_stipple_dx9[299] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc index 29a2e7aea5f..96e4b22c856 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc @@ -1,7 +1,7 @@ $input v_color0, v_stipple /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/makefile b/3rdparty/bgfx/examples/common/debugdraw/makefile index 27e6c6bf04d..72fbea92955 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/makefile +++ b/3rdparty/bgfx/examples/common/debugdraw/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h index d2dc7d7363b..fe3404cec49 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h @@ -22,168 +22,88 @@ static const uint8_t vs_debugdraw_fill_glsl[329] = 0x65, 0x73, 0x2e, 0x78, 0x29, 0x5d, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // es.x)] * tmpvar_ 0x31, 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1));.}... }; -static const uint8_t vs_debugdraw_fill_spv[2546] = +static const uint8_t vs_debugdraw_fill_spv[1265] = { 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el. .. ..u_viewP - 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0xc4, 0x09, 0x00, 0x00, 0x03, 0x02, 0x23, // roj............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x9a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........a..... + 0x65, 0x6c, 0x04, 0x20, 0x40, 0x00, 0x80, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el. @....u_viewP + 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0xbc, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, // roj............# + 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........|...... 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x48, 0x0c, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x03, // .H.............. - 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf9, 0x03, 0x00, // .main........... - 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xf9, 0x03, 0x00, // .Output......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // .....gl_Position - 0x00, 0x05, 0x00, 0x06, 0x00, 0xbd, 0x10, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v - 0x69, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4f, 0x30, 0x00, // i4;vf3;......O0. - 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // .a_indices...... - 0x00, 0xa2, 0x25, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, // ..%..a_position. - 0x00, 0x05, 0x00, 0x04, 0x00, 0xff, 0x10, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x00, // .........model.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // .........$Global - 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v - 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, // iewRect......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, // .....u_viewTexel - 0x00, 0x06, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v - 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // iew............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, // .u_invView...... - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, // .........u_proj. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, // nvProj.......... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // .....u_viewProj. - 0x00, 0x06, 0x00, 0x07, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, // nvViewProj...... - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x97, 0x0b, 0x00, // odelView........ - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // .....u_modelView - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, // Proj............ - 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, // .u_alphaRef4.... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, // .B.............. - 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // ._varying_...... - 0x00, 0xcb, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, 0x00, // ..A..a_indices.. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, // .....H...a_indic - 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, // es.......,?..a_p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, // osition......... - 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, // .a_position..... - 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, // .....@entryPoint - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, // Output.gl_Positi - 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xef, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // on........G..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // am...G.......... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // .@...H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x97, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x97, 0x0b, 0x00, // .#... ...G...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G...B...".. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...H...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....G.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. - 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, // . .............. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // . .............. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x05, 0x00, 0x3f, 0x07, 0x00, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x97, 0x02, 0x00, // .!...?.......... - 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // ....?....e...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....+.......j.. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // . ...........e.. - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, // .j.............. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .....e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, // .e...e...e...... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .e...e....... .. - 0x00, 0x51, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x97, 0x0b, 0x00, 0x00, 0x3b, 0x00, 0x04, // .Q...........;.. - 0x00, 0x51, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .Q...B.......+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .....#.......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x89, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .........e... .. - 0x00, 0x76, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x2b, 0x00, 0x04, // .v...........+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x98, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x98, 0x02, 0x00, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....H....... .. - 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, // .....Sa..;...... - 0x00, 0xef, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, // ..G......;...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, // .........=...... - 0x00, 0xcb, 0x41, 0x00, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, // ..A..H...=...... - 0x00, 0x2c, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xef, 0x47, 0x00, // .,?......>....G. - 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, // ..A..>.......,?. - 0x00, 0x39, 0x00, 0x06, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x39, 0x19, 0x00, 0x00, 0xbd, 0x10, 0x00, // .9.......9...... - 0x00, 0xef, 0x47, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..G......Q...... - 0x00, 0xf8, 0x21, 0x00, 0x00, 0x39, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..!..9.......>.. - 0x00, 0x95, 0x15, 0x00, 0x00, 0xf8, 0x21, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ......!......8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0xf9, 0x03, 0x00, 0x00, 0xbd, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x3f, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x97, 0x02, 0x00, 0x00, 0x4f, 0x30, 0x00, // .?...7.......O0. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xa2, 0x25, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7........%..... - 0x00, 0xdb, 0x5f, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x76, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, // .._..;...v...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd1, 0x46, 0x00, // .....=........F. - 0x00, 0xa2, 0x25, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x46, 0x00, // ..%..Q.......,F. - 0x00, 0xd1, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ..F......Q...... - 0x00, 0xd3, 0x4f, 0x00, 0x00, 0xd1, 0x46, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // ..O...F......Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x5b, 0x00, 0x00, 0xd1, 0x46, 0x00, 0x00, 0x02, 0x00, 0x00, // ......[...F..... - 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x4c, 0x3b, 0x00, 0x00, 0x2c, 0x46, 0x00, // .P.......L;..,F. - 0x00, 0xd3, 0x4f, 0x00, 0x00, 0xf3, 0x5b, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // ..O...[......A.. - 0x00, 0x89, 0x02, 0x00, 0x00, 0x5a, 0x60, 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x0a, 0x0a, 0x00, // .....Z`..O0..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x99, 0x61, 0x00, 0x00, 0x5a, 0x60, 0x00, // .=........a..Z`. - 0x00, 0x41, 0x00, 0x06, 0x00, 0xe2, 0x02, 0x00, 0x00, 0xa2, 0x48, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........H..B.. - 0x00, 0x23, 0x0a, 0x00, 0x00, 0x99, 0x61, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .#....a..=...e.. - 0x00, 0xb5, 0x2f, 0x00, 0x00, 0xa2, 0x48, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ../...H......... - 0x00, 0xff, 0x10, 0x00, 0x00, 0x4c, 0x3b, 0x00, 0x00, 0xb5, 0x2f, 0x00, 0x00, 0x41, 0x00, 0x05, // .....L;.../..A.. - 0x00, 0xe2, 0x02, 0x00, 0x00, 0xc4, 0x2e, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x1d, 0x0a, 0x00, // .........B...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xcc, 0x5e, 0x00, 0x00, 0xc4, 0x2e, 0x00, // .=...e....^..... - 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x67, 0x44, 0x00, 0x00, 0xff, 0x10, 0x00, // .........gD..... - 0x00, 0xcc, 0x5e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xee, 0x27, 0x00, // ..^..A........'. - 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xee, 0x27, 0x00, // .........>....'. - 0x00, 0x67, 0x44, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x5e, 0x5b, 0x00, // .gD..=.......^[. - 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x5e, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, // .........^[..8.. - 0x00, 0x00, // .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // .>...B...E...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // .main........... + 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1f, 0x00, 0x00, // .$Global........ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // .....u_viewProj. + 0x00, 0x06, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m + 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x05, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // odel.....!...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, // .....>...a_indic + 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x42, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, // es.......B...a_p + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x45, 0x00, 0x00, // osition......E.. + 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, // .@entryPointOutp + 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ut.gl_Position.. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .G...........@.. + 0x00, 0x48, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // .........H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, // .........H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...@...H.. + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................ + 0x00, 0x47, 0x00, 0x03, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...........G.. + 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .!...".......G.. + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .>...........G.. + 0x00, 0x42, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .B...........G.. + 0x00, 0x45, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // .E.............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....!.......... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... + 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x16, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ......... ...... + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, // ............?... + 0x00, 0x1b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // ................ + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // ......... ...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // . ...........;.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // . ...!.......+.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ....."....... .. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .'...........+.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....-....... .. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .=...........;.. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .=...>....... .. + 0x00, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .A...........;.. + 0x00, 0x41, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .A...B....... .. + 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .D...........;.. + 0x00, 0x44, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .D...E.......6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .........=...... + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, // .?...>...=...... + 0x00, 0x43, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, // .C...B...Q...... + 0x00, 0x5c, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .....C.......Q.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....]...C...... + 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, // .Q.......^...C.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, // .....P......._.. + 0x00, 0x5c, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, // .....]...^...... + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // .Q.......a...?.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, // .....A...'...b.. + 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .!..."...a...=.. + 0x00, 0x1b, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, // .....c...b...... + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, // .....d..._...c.. + 0x00, 0x41, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, // .A...'...f...!.. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, // .-...=.......g.. + 0x00, 0x66, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, // .f...........h.. + 0x00, 0x64, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, // .d...g...Q...... + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, // .k...h.......... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, // .....l...k...R.. + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, // .....{...l...h.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x45, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, // .....>...E...{.. + 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0e, 0x00, 0x01, 0x00, 0x40, // .....8.........@ + 0x08, // . }; static const uint8_t vs_debugdraw_fill_dx9[482] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc index 7cd02be4df0..afb034cc028 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc @@ -1,7 +1,7 @@ $input a_position, a_indices /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h index f0aa257f3ce..241cc7450fd 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h @@ -35,211 +35,113 @@ static const uint8_t vs_debugdraw_fill_lit_glsl[532] = 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, // = tmpvar_2.xyz;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_debugdraw_fill_lit_spv[3247] = +static const uint8_t vs_debugdraw_fill_lit_spv[1678] = { 0x56, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...V_...u_mod - 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el. .. ..u_viewP - 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // roj.......u_view - 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x74, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, // ......t.....#... - 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x9a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, // .......a........ + 0x65, 0x6c, 0x04, 0x20, 0x80, 0x00, 0x80, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el. .....u_viewP + 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x40, 0x00, 0x04, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // roj..@....u_view + 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x4c, 0x06, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, // ......L.....#... + 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, // ................ 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, // ..............GL 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, // SL.std.450...... 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0c, // ......main....H. - 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0xc9, 0x0f, 0x00, 0x00, 0xc1, 0x11, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, // ......main....L. + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x60, 0x00, // ..P...Y...]...`. 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, // ................ - 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ......main...... - 0x04, 0x00, 0x69, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, // ..i...Output.... - 0x06, 0x00, 0x69, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // ..i.......gl_Pos - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x05, 0x00, 0x69, 0x04, 0x00, 0x00, 0x01, 0x00, // ition.....i..... - 0x00, 0x00, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x69, 0x04, // ..v_view......i. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x05, 0x00, // ......v_world... - 0x06, 0x00, 0xbd, 0x10, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x69, 0x34, 0x3b, // ......@main(vi4; - 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x61, 0x5f, // vf3;......O0..a_ - 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa2, 0x25, // indices........% - 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, // ..a_position.... - 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, // ......_varying_. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x3c, 0x0c, 0x00, 0x00, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, // ......<...world. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, // ......^...$Globa - 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....^.......u_ - 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, // viewRect......^. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, // ......u_viewTexe - 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....^.......u_ - 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, // view......^..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invView..... - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, // ..^.......u_proj - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......^.......u_ - 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, // invProj.......^. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // ......u_viewProj - 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......^.......u_ - 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // invViewProj..... - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..^.......u_mode - 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....^.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, // modelView.....^. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0b, 0x00, // wProj.....^..... - 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, // ..u_alphaRef4... - 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, // ..B............A + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ......main...... + 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..'...$Global... + 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..'.......u_view + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......'.......u_ + 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x27, 0x00, // viewProj......'. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x05, 0x00, // ......u_model... + 0x03, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4c, 0x00, // ..)...........L. 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, // ..a_indices..... - 0x05, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, // ..H...a_indices. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ......,?..a_posi - 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, // tion..........a_ - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, // position........ - 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, // ..flattenTemp... - 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...U..param..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, // ......@entryPoin - 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // tOutput.gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0xc9, 0x0f, 0x00, 0x00, 0x40, 0x65, // ion...........@e - 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, // ntryPointOutput. - 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0xc1, 0x11, // v_view.......... + 0x05, 0x00, 0x50, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ..P...a_position + 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x59, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, // ......Y...@entry + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, // PointOutput.gl_P + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x5d, 0x00, // osition.......]. 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, // ..@entryPointOut - 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x00, 0x00, 0x47, 0x00, // put.v_world...G. - 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, // ..........@...H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, // ..^.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...^.......#. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, // ......H...^..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, // ......H...^..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..#... ...H...^. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..^...........H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, // ..^.......#...`. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...^......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, // ......H...^..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, // ......H...^..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..#.......H...^. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..^...........H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..^.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...^......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, // ......H...^..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, // ......H...^..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..#... ...H...^. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..^...........H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, // ..^.......#...`. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...^......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, // ......H...^..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, // ......H...^..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..#.......H...^. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..^...........H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, // ..^.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...^......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, // ......H...^..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, // ......H...^..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, // ..#.......H...^. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, // ..^.......#... . - 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, // ..G...^.......G. - 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..B...".......G. - 0x04, 0x00, 0x48, 0x0c, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..H...........G. - 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, // ..............G. - 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..............G. - 0x04, 0x00, 0xc9, 0x0f, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..............G. - 0x04, 0x00, 0xc1, 0x11, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, // ................ - 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1a, 0x00, // .. ............. - 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, // .......... ..... - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, // ................ - 0x05, 0x00, 0x69, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, // ..i............. - 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x1f, 0x08, 0x00, 0x00, 0x69, 0x04, 0x00, 0x00, 0x97, 0x02, // ..!.......i..... - 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe6, 0x06, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x69, 0x04, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, // ..i...+......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x0a, // ......,.......,. - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, // .............?.. - 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, // ..e............. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, // ......j... ..... - 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, // ......e...j..... - 0x0e, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, // ..^...........e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e.......e...e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xdb, 0x07, 0x00, 0x00, 0x02, 0x00, // ...... ......... - 0x00, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xdb, 0x07, 0x00, 0x00, 0x42, 0x13, // ..^...;.......B. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x0a, // ......+.......#. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x89, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, // ...... ......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, // ..e...+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, // ......+......... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x98, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x98, 0x02, 0x00, 0x00, 0x48, 0x0c, // ......;.......H. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, // ......;......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x15, // ......;......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, // ...... ......... - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0xc9, 0x0f, // ......;......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0xc1, 0x11, // ......;......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, // ......6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, // ..............Sa - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe6, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, // ..;............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, // ..;........U.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, // ..;............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x48, 0x0c, // ..=........A..H. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0xa6, 0x14, // ..=.......,?.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, // ..>....U...A..>. - 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x69, 0x04, // ......,?..9...i. - 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0xbd, 0x10, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, // ..I&.......U.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, // ..>.......I&..A. - 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, // ......T4........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, // ..=...........T4 - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, // ..>...........A. - 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, // .......@........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, // ..=....... ....@ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc9, 0x0f, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, // ..>....... ...A. - 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, // .......@........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, // ..=........-...@ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc1, 0x11, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, // ..>........-.... - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x69, 0x04, 0x00, 0x00, 0xbd, 0x10, // ..8...6...i..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x97, 0x02, // ..........7..... - 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xa2, 0x25, // ..O0..7........% - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x27, 0x60, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe6, 0x06, // ......'`..;..... - 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, // ..........A..... - 0x00, 0x00, 0xf3, 0x1c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xf3, 0x1c, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, // ......,...A..... - 0x00, 0x00, 0xd3, 0x40, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ...@..........>. - 0x03, 0x00, 0xd3, 0x40, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // ...@..,...=..... - 0x00, 0x00, 0x7e, 0x20, 0x00, 0x00, 0xa2, 0x25, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..~ ...%..Q..... - 0x00, 0x00, 0x03, 0x43, 0x00, 0x00, 0x7e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ...C..~ ......Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd3, 0x4f, 0x00, 0x00, 0x7e, 0x20, 0x00, 0x00, 0x01, 0x00, // .......O..~ .... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x5b, 0x00, 0x00, 0x7e, 0x20, // ..Q........[..~ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x4c, 0x3b, // ......P.......L; - 0x00, 0x00, 0x03, 0x43, 0x00, 0x00, 0xd3, 0x4f, 0x00, 0x00, 0xf3, 0x5b, 0x00, 0x00, 0x8a, 0x00, // ...C...O...[.... - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x89, 0x02, 0x00, 0x00, 0x5a, 0x60, 0x00, 0x00, 0x4f, 0x30, // ..A.......Z`..O0 - 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x99, 0x61, // ......=........a - 0x00, 0x00, 0x5a, 0x60, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xe2, 0x02, 0x00, 0x00, 0xa2, 0x48, // ..Z`..A........H - 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x23, 0x0a, 0x00, 0x00, 0x99, 0x61, 0x00, 0x00, 0x3d, 0x00, // ..B...#....a..=. - 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xb5, 0x2f, 0x00, 0x00, 0xa2, 0x48, 0x00, 0x00, 0x90, 0x00, // ..e..../...H.... - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3c, 0x0c, 0x00, 0x00, 0x4c, 0x3b, 0x00, 0x00, 0xb5, 0x2f, // ......<...L;.../ - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0xc4, 0x2e, 0x00, 0x00, 0x42, 0x13, // ..A...........B. - 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xcc, 0x5e, // ......=...e....^ - 0x00, 0x00, 0xc4, 0x2e, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x67, 0x44, // ..............gD - 0x00, 0x00, 0x3c, 0x0c, 0x00, 0x00, 0xcc, 0x5e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, // ..<....^..A..... - 0x00, 0x00, 0x3a, 0x28, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ..:(..........>. - 0x03, 0x00, 0x3a, 0x28, 0x00, 0x00, 0x67, 0x44, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, // ..:(..gD..A..... - 0x00, 0x00, 0xa9, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...G..B.......=. - 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x49, 0x27, 0x00, 0x00, 0xa9, 0x47, 0x00, 0x00, 0x90, 0x00, // ..e...I'...G.... - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2a, 0x3b, 0x00, 0x00, 0x3c, 0x0c, 0x00, 0x00, 0x49, 0x27, // ......*;..<...I' - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0xe6, 0x24, 0x00, 0x00, 0x2a, 0x3b, // ..O........$..*; - 0x00, 0x00, 0x2a, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ..*;............ - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0xf1, 0x52, 0x00, 0x00, 0x0f, 0x12, // ..A........R.... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf1, 0x52, 0x00, 0x00, 0xe6, 0x24, // ......>....R...$ - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0xcb, 0x3d, 0x00, 0x00, 0x3c, 0x0c, // ..O........=..<. - 0x00, 0x00, 0x3c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ..<............. - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0e, 0x19, 0x00, 0x00, 0x0f, 0x12, // ..A............. - 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0e, 0x19, 0x00, 0x00, 0xcb, 0x3d, // ......>........= - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x69, 0x04, 0x00, 0x00, 0x5e, 0x5b, 0x00, 0x00, 0x0f, 0x12, // ..=...i...^[.... - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x5e, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ......^[..8.... + 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // put.v_view...... + 0x09, 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, // ..`...@entryPoin + 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, // tOutput.v_world. + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...&.......@. + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...'......... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...'.......#. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, // ......H...'..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, // ..........H...'. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, // ..........H...'. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#...@...H. + 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..'............. + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...'......... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...'.......#. + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, // ......H...'..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x27, 0x00, // ..........G...'. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x22, 0x00, // ......G...)...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...L..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...P..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x59, 0x00, 0x00, 0x00, 0x0b, 0x00, // ......G...Y..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...]..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x60, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...`..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, // .. ............. + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x09, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x09, 0x00, // .. ............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, // ......+......... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x19, 0x00, // ......+......... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......+......... + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0c, 0x00, // .....?....#..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........$... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......+...$...%. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x23, 0x00, // .. .......&...#. + 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, // ..%.......'...#. + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, // ..#...&... ...(. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x28, 0x00, // ......'...;...(. + 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2e, 0x00, // ..)....... ..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, // ......#...+..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4b, 0x00, // ..2....... ...K. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4b, 0x00, // ..........;...K. + 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4f, 0x00, // ..L....... ...O. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, // ..........;...O. + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x58, 0x00, // ..P....... ...X. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, // ..........;...X. + 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5c, 0x00, // ..Y....... ..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5c, 0x00, // ..........;..... + 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5c, 0x00, // ..].......;..... + 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, // ..`.......6..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, // ................ + 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4d, 0x00, // ......=.......M. + 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x51, 0x00, // ..L...=.......Q. + 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x74, 0x00, // ..P...Q.......t. + 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, // ..Q.......Q..... + 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ..u...Q.......Q. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x02, 0x00, // ......v...Q..... + 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x74, 0x00, // ..P.......w...t. + 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x51, 0x00, // ..u...v.......Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, // ......y...M..... + 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x29, 0x00, // ..A.......z...). + 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, // ......y...=...#. + 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, // ..{...z......... + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x41, 0x00, // ..|...w...{...A. + 0x05, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x15, 0x00, // ......~...)..... + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7e, 0x00, // ..=...#.......~. + 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..............|. + 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x83, 0x00, // ......A......... + 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, // ..)...2...=...#. + 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x4f, 0x00, // ......|.......O. + 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4f, 0x00, // ..............O. + 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..........|...|. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8c, 0x00, // ................ + 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x8d, 0x00, // ..R............. + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x59, 0x00, // ..........>...Y. + 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x86, 0x00, // ......>...]..... + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>...`......... + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0e, 0x00, 0x01, 0x00, 0x80, 0x08, // ..8........... }; static const uint8_t vs_debugdraw_fill_lit_dx9[635] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc index ab5a83f0507..5cad2f127e4 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc @@ -2,7 +2,7 @@ $input a_position, a_indices $output v_view, v_world /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.bin.h new file mode 100644 index 00000000000..b5d0395fbd2 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.bin.h @@ -0,0 +1,293 @@ +static const uint8_t vs_debugdraw_fill_lit_mesh_glsl[485] = +{ + 0x56, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH...V_...u_vie + 0x77, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // w.......u_viewPr + 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // oj.......u_model + 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0xaa, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, // . .. .....attrib + 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, // ute highp vec3 a + 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // _position;.varyi + 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, // ng highp vec3 v_ + 0x76, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, // view;.varying hi + 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, // ghp vec3 v_world + 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, // ;.uniform highp + 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // mat4 u_view;.uni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, // form highp mat4 + 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // u_viewProj;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // orm mat4 u_model + 0x5b, 0x33, 0x32, 0x5d, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, // [32];.void main + 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // ().{. highp vec + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // 4 tmpvar_1;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, // pvar_1.w = 1.0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_1.xyz = + 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x68, // a_position;. h + 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ighp vec4 tmpvar + 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, // _2;. tmpvar_2 = + 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x30, 0x5d, 0x20, 0x2a, 0x20, 0x74, // (u_model[0] * t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, // mpvar_1);. gl_P + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x76, 0x69, 0x65, // osition = (u_vie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // wProj * tmpvar_2 + 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x20, 0x3d, 0x20, 0x28, 0x75, // );. v_view = (u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // _view * tmpvar_2 + 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, // ).xyz;. v_world + 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x3b, // = tmpvar_2.xyz; + 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... +}; +static const uint8_t vs_debugdraw_fill_lit_mesh_spv[1642] = +{ + 0x56, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...V_...u_mod + 0x65, 0x6c, 0x04, 0x01, 0x80, 0x00, 0x04, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el.......u_viewP + 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x40, 0x00, 0x04, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // roj..@....u_view + 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x28, 0x06, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, // ......(.....#... + 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, // ................ + 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, // ..............GL + 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, // SL.std.450...... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, // ......main....H. + 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x5c, 0x00, // ..L...U...Y..... + 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, // ................ + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ......main...... + 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..'...$Global... + 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..'.......u_view + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......'.......u_ + 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x27, 0x00, // viewProj......'. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x05, 0x00, // ......u_model... + 0x03, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x48, 0x00, // ..)...........H. + 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, // ..a_indices..... + 0x05, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ..L...a_position + 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x55, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, // ......U...@entry + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, // PointOutput.gl_P + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x59, 0x00, // osition.......Y. + 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, // ..@entryPointOut + 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // put.v_view...... + 0x09, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, // ......@entryPoin + 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, // tOutput.v_world. + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...&.......@. + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...'......... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...'.......#. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, // ......H...'..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, // ..........H...'. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, // ..........H...'. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#...@...H. + 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..'............. + 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...'......... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...'.......#. + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, // ......H...'..... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x27, 0x00, // ..........G...'. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x22, 0x00, // ......G...)...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...H..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...L..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x0b, 0x00, // ......G...U..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x59, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...Y..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G......... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, // .. ............. + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x09, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x09, 0x00, // .. ............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, // ......+......... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x19, 0x00, // ......+......... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......+......... + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0c, 0x00, // .....?....#..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........$... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......+...$...%. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x23, 0x00, // .. .......&...#. + 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, // ..%.......'...#. + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, // ..#...&... ...(. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x28, 0x00, // ......'...;...(. + 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, // ..).......+..... + 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2b, 0x00, // ..*....... ...+. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x47, 0x00, // ......#... ...G. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x47, 0x00, // ..........;...G. + 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4b, 0x00, // ..H....... ...K. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4b, 0x00, // ..........;...K. + 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x54, 0x00, // ..L....... ...T. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x54, 0x00, // ..........;...T. + 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x58, 0x00, // ..U....... ...X. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, // ..........;...X. + 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, // ..Y.......;...X. + 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, // ..........6..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, // ................ + 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x4d, 0x00, // ......=.......M. + 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x70, 0x00, // ..L...Q.......p. + 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, // ..M.......Q..... + 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ..q...M.......Q. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x02, 0x00, // ......r...M..... + 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x70, 0x00, // ..P.......s...p. + 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x41, 0x00, // ..q...r.......A. + 0x06, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x19, 0x00, // ..+...t...)..... + 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x75, 0x00, // ..*...=...#...u. + 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x76, 0x00, // ..t...........v. + 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x2b, 0x00, // ..s...u...A...+. + 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..x...).......=. + 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x90, 0x00, // ..#...y...x..... + 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x79, 0x00, // ......z...v...y. + 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x29, 0x00, // ..A...+...}...). + 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x7e, 0x00, // ..*...=...#...~. + 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x7f, 0x00, // ..}............. + 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0a, 0x00, // ..v...~...O..... + 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0a, 0x00, // ..........O..... + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, // ......v...v..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, // ..........Q..... + 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, // ......z......... + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x52, 0x00, // ..............R. + 0x06, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x7a, 0x00, // ..............z. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x55, 0x00, 0x00, 0x00, 0xa5, 0x00, // ......>...U..... + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x59, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..>...Y.......>. + 0x03, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. + 0x01, 0x00, 0x00, 0x02, 0x0e, 0x00, 0x01, 0x00, 0xc0, 0x00, // .......... +}; +static const uint8_t vs_debugdraw_fill_lit_mesh_dx9[555] = +{ + 0x56, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...V_...u_mod + 0x65, 0x6c, 0x04, 0x20, 0x08, 0x00, 0x04, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x04, // el. .....u_view. + 0x01, 0x00, 0x00, 0x04, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // ......u_viewProj + 0x04, 0x01, 0x04, 0x00, 0x04, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, // ................ + 0x32, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x03, // 2.CTAB.......... + 0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x93, 0x00, // ................ + 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x60, 0x00, // ..X...........`. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ......p......... + 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x02, 0x00, // ..x............. + 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......x.......u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x00, // model......... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0xab, 0x03, 0x00, // ......u_view.... + 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, // viewProj.vs_3_0. + 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, // Microsoft (R) HL + 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, // SL Shader Compil + 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // er 10.1......... + 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // ................ + 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x07, 0xe0, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x01, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0f, 0x80, 0x09, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... + 0x0f, 0x80, 0x08, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x0a, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0b, 0x00, // ................ + 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x05, 0x00, // ............U... + 0xe4, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x00, 0x00, // ................ + 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x06, 0x00, // ................ + 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x0f, 0xe0, 0x07, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, // ................ + 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x04, 0x00, // ........U....... + 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ + 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x00, 0x00, // ................ + 0xaa, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x07, 0xe0, 0x03, 0x00, // ................ + 0xe4, 0xa0, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, // ................ + 0x07, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... +}; +static const uint8_t vs_debugdraw_fill_lit_mesh_dx11[874] = +{ + 0x56, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH...V_...u_vie + 0x77, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // w.......u_viewPr + 0x6f, 0x6a, 0x04, 0x00, 0x40, 0x00, 0x04, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // oj..@....u_model + 0x04, 0x20, 0x80, 0x00, 0x80, 0x00, 0x28, 0x03, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xc4, 0x14, // . ....(...DXBC.. + 0x8c, 0x7a, 0xb5, 0xb5, 0x88, 0x8c, 0xc7, 0xf4, 0x92, 0xe3, 0x3e, 0xf8, 0xb7, 0x7a, 0x01, 0x00, // .z........>..z.. + 0x00, 0x00, 0x28, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x84, 0x00, // ..(.......,..... + 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00, 0x02, 0x00, // ......ISGNP..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......8......... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x45, 0x00, // ..............E. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x42, 0x4c, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x44, 0x49, 0x43, // ......BLENDINDIC + 0x45, 0x53, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, 0xab, 0x4f, 0x53, // ES.POSITION...OS + 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNh...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x5c, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0xab, 0xab, 0x53, 0x48, // N.TEXCOORD....SH + 0x44, 0x52, 0x2c, 0x02, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x59, 0x00, // DR,...@.......Y. + 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x5f, 0x00, // ..F. ........._. + 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, // ..r.......g.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, // ..........e...r + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, // ......e...r .... + 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, // ..h.......8..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......V.......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, // .........2..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, // ......F. ....... + 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ..2...........F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x01, 0x00, // ............... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x00, // ..F............. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......F.......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, // .........8..... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, // ......V.......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, // .........2..... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ......F. ....... + 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..........F..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, // ..2...........F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, // ............... + 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x20, // ..F.......2.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, // ......F. ....... + 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, // ..........F..... + 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, // ..8...r.......V. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ......F. ....... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x82, // ..2...r.......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, // ............... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, // ..F.......2...r. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, // ......F. ....... + 0x00, 0x00, 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..........F..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x82, // ..2...r ......F. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, // ............... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, // ..F.......6...r + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......F.......>. + 0x00, 0x01, 0x00, 0x02, 0x0e, 0x00, 0x01, 0x00, 0x80, 0x08, // .......... +}; +static const uint8_t vs_debugdraw_fill_lit_mesh_mtl[822] = +{ + 0x56, 0x53, 0x48, 0x05, 0x0f, 0xc8, 0x56, 0x5f, 0x03, 0x00, 0x06, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH...V_...u_vie + 0x77, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // w.......u_viewPr + 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // oj.......u_model + 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0xfb, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, // . .. .....using + 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, // namespace metal; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, // haderInput {. f + 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // loat3 a_position + 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, // [[attribute(0)] + 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, // ];.};.struct xla + 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x50, // {. float4 gl_P + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // osition [[positi + 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, // on]];. float3 v + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, // _view;. float3 + 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // v_world;.};.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // Uniform {. floa + 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x66, // t4x4 u_view;. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // loat4x4 u_viewPr + 0x6f, 0x6a, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, // oj;. float4x4 u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x33, 0x32, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, // _model[32];.};.v + 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // ertex xlatMtlSha + 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // derOutput xlatMt + 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // lMain (xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // aderInput _mtl_i + 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, // [[stage_in]], c + 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // onstant xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, // haderUniform& _m + 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, // tl_u [[buffer(0) + 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // ]]).{. xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // haderOutput _mtl + 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, // _o;. float4 tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // var_1 = 0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, // var_1.w = 1.0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_1.xyz = + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // _mtl_i.a_positio + 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // n;. float4 tmpv + 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_2 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // ar_2 = (_mtl_u.u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x30, 0x5d, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, // _model[0] * tmpv + 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // ar_1);. _mtl_o. + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, // gl_Position = (_ + 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // mtl_u.u_viewProj + 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, // * tmpvar_2);. + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x20, 0x3d, 0x20, // _mtl_o.v_view = + 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x20, 0x2a, // (_mtl_u.u_view * + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, // tmpvar_2).xyz;. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x77, 0x6f, 0x72, 0x6c, 0x64, // _mtl_o.v_world + 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x3b, // = tmpvar_2.xyz; + 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // . return _mtl_o + 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... +}; +extern const uint8_t* vs_debugdraw_fill_lit_mesh_pssl; +extern const uint32_t vs_debugdraw_fill_lit_mesh_pssl_size; diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc new file mode 100644 index 00000000000..7616da2055f --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc @@ -0,0 +1,17 @@ +$input a_position, a_indices +$output v_view, v_world + +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include + +void main() +{ + vec4 world = mul(u_model[0], vec4(a_position, 1.0) ); + gl_Position = mul(u_viewProj, world); + v_view = mul(u_view, world).xyz; + v_world = world.xyz; +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.bin.h new file mode 100644 index 00000000000..607a997e639 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.bin.h @@ -0,0 +1,216 @@ +static const uint8_t vs_debugdraw_fill_mesh_glsl[282] = +{ + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, // wProj.......u_mo + 0x64, 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0xec, 0x00, 0x00, 0x00, 0x61, 0x74, 0x74, // del. .. .....att + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, // ribute highp vec + 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x75, 0x6e, // 3 a_position;.un + 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, // iform highp mat4 + 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // u_viewProj;.uni + 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // form mat4 u_mode + 0x6c, 0x5b, 0x33, 0x32, 0x5d, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, // l[32];.void main + 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // ().{. highp ve + 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c4 tmpvar_1;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, // mpvar_1.w = 1.0; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, // . tmpvar_1.xyz + 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // = a_position;. + 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, // gl_Position = (u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x28, 0x75, 0x5f, 0x6d, // _viewProj * (u_m + 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x30, 0x5d, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // odel[0] * tmpvar + 0x5f, 0x31, 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _1));.}... +}; +static const uint8_t vs_debugdraw_fill_mesh_spv[1229] = +{ + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod + 0x65, 0x6c, 0x04, 0x01, 0x40, 0x00, 0x04, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el..@....u_viewP + 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x98, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, // roj............# + 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........u...... + 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... + 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // .:...>...A...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // .main........... + 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1f, 0x00, 0x00, // .$Global........ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // .....u_viewProj. + 0x00, 0x06, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m + 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x05, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // odel.....!...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, // .....:...a_indic + 0x65, 0x73, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, // es.......>...a_p + 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x41, 0x00, 0x00, // osition......A.. + 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, // .@entryPointOutp + 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ut.gl_Position.. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .G...........@.. + 0x00, 0x48, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H.............. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // .........H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1f, 0x00, 0x00, // .........H...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...@...H.. + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // ................ + 0x00, 0x47, 0x00, 0x03, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...........G.. + 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .!...".......G.. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .:...........G.. + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .>...........G.. + 0x00, 0x41, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // .A.............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....!.......... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... + 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x16, 0x00, 0x03, 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ......... ...... + 0x00, 0x0a, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, // ............?... + 0x00, 0x1b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // ................ + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // ......... ...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // . ...........;.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // . ...!.......+.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .....".......+.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....#....... .. + 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .$........... .. + 0x00, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .9...........;.. + 0x00, 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .9...:....... .. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .=...........;.. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .=...>....... .. + 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .@...........;.. + 0x00, 0x40, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .@...A.......6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, // .........=...... + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, // .?...>...Q...... + 0x00, 0x58, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .X...?.......Q.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....Y...?...... + 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // .Q.......Z...?.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, // .....P.......[.. + 0x00, 0x58, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, // .X...Y...Z...... + 0x00, 0x41, 0x00, 0x06, 0x00, 0x24, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, // .A...$.......!.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, // ."...#...=...... + 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, // .].............. + 0x00, 0x5e, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // .^...[...]...A.. + 0x00, 0x24, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .$...`...!...#.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .=.......a...`.. + 0x00, 0x90, 0x00, 0x05, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, // .........b...^.. + 0x00, 0x61, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .a...Q.......e.. + 0x00, 0x62, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, // .b.............. + 0x00, 0x66, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x00, // .f...e...R...... + 0x00, 0x74, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .t...f...b...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x41, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>...A...t...... + 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0e, 0x00, 0x01, 0x00, 0x80, 0x00, // .8........... +}; +static const uint8_t vs_debugdraw_fill_mesh_dx9[402] = +{ + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod + 0x65, 0x6c, 0x04, 0x20, 0x04, 0x00, 0x04, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // el. .....u_viewP + 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, // roj......d...... + 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, // ...+.CTAB....... + 0x00, 0x00, 0x03, 0xfe, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ + 0x00, 0x78, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // .x...D.......... + 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .L.............. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .....h.......u_m + 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, // odel......... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // .....u_viewProj. + 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, // .vs_3_0.Microsof + 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, // t (R) HLSL Shade + 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, // r Compiler 10.1. + 0xab, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, // ................ + 0x80, 0x05, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // .......U........ + 0x80, 0x04, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x0f, 0x80, 0x06, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, // ................ + 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x07, 0x00, 0xe4, // ................ + 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0xe4, // ...........U.... + 0xa0, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, // ................ + 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, // ................ + 0xa0, 0x00, 0x00, 0xaa, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, // ................ + 0xe0, 0x03, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0xff, 0x80, 0x01, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, // ................ + 0x00, 0x00, // .. +}; +static const uint8_t vs_debugdraw_fill_mesh_dx11[605] = +{ + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, // wProj.......u_mo + 0x64, 0x65, 0x6c, 0x04, 0x20, 0x40, 0x00, 0x80, 0x00, 0x28, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, // del. @...(...DXB + 0x43, 0x27, 0x23, 0xd8, 0x33, 0xce, 0xb9, 0x21, 0xaa, 0x08, 0x79, 0xa6, 0x15, 0x6b, 0x1a, 0x45, // C'#.3..!..y..k.E + 0x8d, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, // .....(.......,.. + 0x00, 0x84, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, // .........ISGNP.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........8...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // ................ + 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .E.............. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x42, 0x4c, 0x45, 0x4e, 0x44, 0x49, 0x4e, // .........BLENDIN + 0x44, 0x49, 0x43, 0x45, 0x53, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, // DICES.POSITION.. + 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .OSGN,.......... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // . .............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, // .........SV_POSI + 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x53, 0x48, 0x44, 0x52, 0x68, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, // TION.SHDRh...@.. + 0x00, 0x5a, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, // .Z...Y...F. .... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, // ....._...r...... + 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .g.... ......... + 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, // .h.......8...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .....V.......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, // .........2...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....F. ........ + 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, // .........F...... + 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .2...........F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, // .F.............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .....F.......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, // .........8...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .....V.......F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, // .........2...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....F. ........ + 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, // .........F...... + 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, // .2...........F. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x20, 0x10, // .F.......2.... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .....F. ........ + 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, // .........F...... + 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x02, 0x0e, 0x00, 0x01, 0x00, 0x40, 0x08, // .>.........@. +}; +static const uint8_t vs_debugdraw_fill_mesh_mtl[626] = +{ + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x07, 0x75, 0x5f, 0x6d, 0x6f, // wProj.......u_mo + 0x64, 0x65, 0x6c, 0x04, 0x20, 0x00, 0x00, 0x20, 0x00, 0x44, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, // del. .. .D...usi + 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met + 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. + 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // float3 a_posit + 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, // ion [[attribute( + 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // 0)]];.};.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut + 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // put {. float4 g + 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, // l_Position [[pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // ition]];.};.stru + 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader + 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // Uniform {. floa + 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, // t4x4 u_viewProj; + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, // . float4x4 u_mo + 0x64, 0x65, 0x6c, 0x5b, 0x33, 0x32, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, // del[32];.};.vert + 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ex xlatMtlShader + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, // Output xlatMtlMa + 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // in (xlatMtlShade + 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, // rInput _mtl_i [[ + 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, // stage_in]], cons + 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // tant xlatMtlShad + 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // erUniform& _mtl_ + 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, // u [[buffer(0)]]) + 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // .{. xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // erOutput _mtl_o; + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // . float4 tmpvar + 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _1 = 0;. tmpvar + 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // _1.w = 1.0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // pvar_1.xyz = _mt + 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, // l_i.a_position;. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // _mtl_o.gl_Posi + 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // tion = (_mtl_u.u + 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x28, 0x5f, 0x6d, 0x74, // _viewProj * (_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5b, 0x30, 0x5d, 0x20, 0x2a, // l_u.u_model[0] * + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, // tmpvar_1));. r + 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, // eturn _mtl_o;.}. + 0x0a, 0x00, // .. +}; +extern const uint8_t* vs_debugdraw_fill_mesh_pssl; +extern const uint32_t vs_debugdraw_fill_mesh_pssl_size; diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc new file mode 100644 index 00000000000..3d3e5156350 --- /dev/null +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc @@ -0,0 +1,14 @@ +$input a_position, a_indices + +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include + +void main() +{ + vec4 model = mul(u_model[0], vec4(a_position, 1.0) ); + gl_Position = mul(u_viewProj, model); +} diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.bin.h index c9f8aa6ece2..a0b567e6447 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.bin.h @@ -28,209 +28,90 @@ static const uint8_t vs_debugdraw_fill_texture_glsl[420] = 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // or0 = a_color0;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_debugdraw_fill_texture_spv[3209] = +static const uint8_t vs_debugdraw_fill_texture_spv[1298] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x64, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // d.....#......... - 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xe4, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // main....>...B... + 0x46, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, // F...Q...T...X... 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x64, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // d...Output...... - 0x64, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // d.......gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion.....d....... - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x64, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // d.......v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0xad, 0x11, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, // n(vf4;vf3;vf2;.. - 0x05, 0x00, 0x05, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ........a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ......../B..a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x10, 0x46, 0x00, 0x00, // sition.......F.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xdf, 0x00, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo - 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x65, 0x04, 0x00, 0x00, // oord0...G...e... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // ....@...H....... - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xdf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // ........H....... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, // ............d... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x03, 0x09, 0x00, 0x00, 0x64, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, // ....d........... - 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x64, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // d........... ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,............... - 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........e....... - 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, // ....+.......j... - 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x65, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // .......e...e... - 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // j............... - 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ....e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x04, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // e...e....... ... - 0x5c, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x5c, 0x03, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ....B.......+... - 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ....)....... ... - 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ........e... ... - 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... - 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... - 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... - 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ....v....... ... - 0x92, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x92, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, // ............6... - 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, // ................ - 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, // ....Sa..;....... - 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........;....... - 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // .U......;....... - 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // .8......;....... - 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........=....... - 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // .A......=....... - 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // .?......=....... - 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, // @,......>....U.. - 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, // .A..>....8...?.. - 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, // >.......@,..9... - 0x64, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0xad, 0x11, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, // d...I&.......U.. - 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, // .8......>....... - 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // I&..A.......T4.. - 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........=....... - 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, // ....T4..>....... - 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // ....A........@.. - 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........=....... - 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, // ....@..>...v... - 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // ...A........@.. - 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ........=....... - 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, // .-...@..>....... - 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, // .-......8...6... - 0x64, 0x04, 0x00, 0x00, 0xad, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, // d............... - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // 7...........7... - 0x95, 0x02, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, // ..../B..7....... - 0x10, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x70, 0x1e, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .F......p...;... - 0xe1, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... - 0x9a, 0x02, 0x00, 0x00, 0xbb, 0x25, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....%.......... - 0x3e, 0x00, 0x03, 0x00, 0xbb, 0x25, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >....%......A... - 0x90, 0x02, 0x00, 0x00, 0x9b, 0x49, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....I.......... - 0x3e, 0x00, 0x03, 0x00, 0x9b, 0x49, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....I......=... - 0x18, 0x00, 0x00, 0x00, 0x46, 0x29, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....F)../B..Q... - 0x0d, 0x00, 0x00, 0x00, 0xcb, 0x4b, 0x00, 0x00, 0x46, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....K..F)...... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x9b, 0x58, 0x00, 0x00, 0x46, 0x29, 0x00, 0x00, // Q........X..F).. - 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3c, 0x1a, 0x00, 0x00, // ....Q.......<... - 0x46, 0x29, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // F)......P....... - 0x14, 0x44, 0x00, 0x00, 0xcb, 0x4b, 0x00, 0x00, 0x9b, 0x58, 0x00, 0x00, 0x3c, 0x1a, 0x00, 0x00, // .D...K...X..<... - 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x80, 0x24, 0x00, 0x00, // ....A........$.. - 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // B...)...=...e... - 0x4a, 0x35, 0x00, 0x00, 0x80, 0x24, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // J5...$.......... - 0xf6, 0x33, 0x00, 0x00, 0x14, 0x44, 0x00, 0x00, 0x4a, 0x35, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .3...D..J5..A... - 0x9a, 0x02, 0x00, 0x00, 0xb6, 0x30, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // .....0.......... - 0x3e, 0x00, 0x03, 0x00, 0xb6, 0x30, 0x00, 0x00, 0xf6, 0x33, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....0...3..=... - 0x13, 0x00, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .....2...F..A... - 0x90, 0x02, 0x00, 0x00, 0xbd, 0x4d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....M.......... - 0x3e, 0x00, 0x03, 0x00, 0xbd, 0x4d, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....M...2..=... - 0x1d, 0x00, 0x00, 0x00, 0xae, 0x32, 0x00, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .....2......A... - 0x9a, 0x02, 0x00, 0x00, 0xbe, 0x4d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....M.......... - 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x4d, 0x00, 0x00, 0xae, 0x32, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....M...2..=... - 0x64, 0x04, 0x00, 0x00, 0xf6, 0x31, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, // d....1.......... - 0xf6, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .1..8.... + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0x26, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, // &...$Global..... + 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // &.......u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, // iewProj.....(... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ........>...a_co + 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x42, 0x00, 0x00, 0x00, // lor0........B... + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0x46, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // F...a_texcoord0. + 0x05, 0x00, 0x0a, 0x00, 0x51, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....Q...@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // intOutput.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, // ition.......T... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // t.v_color0...... + 0x58, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // X...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...&....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...&....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, // #.......H...&... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, // &.......G...(... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, // ".......G...>... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, // ........G...B... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, // ........G...F... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, // ........G...Q... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, // ........G...T... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, // ........G...X... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......+....... + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, // .......?+....... + 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // ............%... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, // ............&... + 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // %... ...'....... + 0x26, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, // &...;...'...(... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...)....... + 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // %... ...=....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, // ....;...=...>... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...A....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // ....;...A...B... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...E....... + 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, // ....;...E...F... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...P....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, // ....;...P...Q... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, // ....;...P...T... + 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...W....... + 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, // ....;...W...X... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, // =.......?...>... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // =.......C...B... + 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, // =.......G...F... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, // Q.......p...C... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, // ....Q.......q... + 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // C.......Q....... + 0x72, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // r...C.......P... + 0x07, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, // ....s...p...q... + 0x72, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, // r.......A...)... + 0x74, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // t...(.......=... + 0x25, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // %...u...t....... + 0x07, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, // ....v...s...u... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, // Q.......}...v... + 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, // ............~... + 0x7d, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // }...R........... + 0x7e, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ~...v.......>... + 0x51, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x54, 0x00, 0x00, 0x00, // Q.......>...T... + 0x3f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x58, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, // ?...>...X...G... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, // ....8........... + 0x40, 0x00, // @. }; static const uint8_t vs_debugdraw_fill_texture_dx9[349] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc index fa081555d37..e5d82b89de7 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0, a_color0 $output v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h index 32ae50d8cc9..bde77ae03e2 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h @@ -22,177 +22,76 @@ static const uint8_t vs_debugdraw_lines_glsl[325] = 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // lor0 = a_color0; 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; -static const uint8_t vs_debugdraw_lines_spv[2697] = +static const uint8_t vs_debugdraw_lines_spv[1088] = { 0x56, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....I...u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x64, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // d.....#......... - 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x14, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // ....v........... - 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x38, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, // ........8...Outp - 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ut......8....... - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, // gl_Position..... - 0x38, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // 8.......v_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // ............@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // n(vf4;vf3;...... - 0xf5, 0x48, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // .H..a_color0.... - 0x05, 0x00, 0x05, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....,G..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, // on.........._var - 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ying_........... - 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // $Global......... - 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, // ....u_viewRect.. - 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ewTexel......... - 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....u_view...... - 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, // ........u_invVie - 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // w............... - 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // u_proj.......... - 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, // ....u_invProj... - 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x99, 0x02, 0x00, 0x00, // ewProj.......... - 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ....u_invViewPro - 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // j............... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // u_model......... - 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, // ....u_modelView. - 0x06, 0x00, 0x07, 0x00, 0x99, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, // delViewProj..... - 0x99, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, // ........u_alphaR - 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ef4.....B....... - 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // .....A..a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ............a_co - 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, // lor0........,?.. - 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... - 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ....a_position.. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, // main....6...:... + 0x43, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // C...F........... + 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, // ........ ...$Glo + 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // bal..... ....... + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. + 0x05, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // ...."........... + 0x36, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // 6...a_color0.... + 0x05, 0x00, 0x05, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....:...a_positi + 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x43, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // on......C...@ent 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO + 0x46, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // F...@entryPointO 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x47, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // G...7.......@... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // #.......H....... - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x99, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x99, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x99, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...G........... - 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...B..."....... - 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...v........... - 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, // ........!....... - 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x1e, 0x00, 0x04, 0x00, 0x38, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....8........... - 0x21, 0x00, 0x05, 0x00, 0xc6, 0x07, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, // !.......8....... - 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x38, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // 8........... ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....e........... - 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... - 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // +.......j... ... - 0x1c, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, // ....7...e...j... - 0x1e, 0x00, 0x0e, 0x00, 0x99, 0x02, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...7...e... - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x05, 0x00, 0x00, // e....... ....... - 0x02, 0x00, 0x00, 0x00, 0x99, 0x02, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x05, 0x00, 0x00, // ........;....... - 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // B.......+....... - 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, // )....... ....... - 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, // ....e... ....... - 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, // ........;....... - 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, // ........ ....... - 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, // ........;....... - 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, // ........ ....... - 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, // ........;....... - 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, // ........;....... - 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, // v.......6....... - 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // ................ - 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // Sa..;........... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, // ....;........U.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // ....;........... - 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, // ....=........A.. - 0x89, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, // ....=.......,?.. - 0xa6, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, // ....>....U...A.. - 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, // >.......,?..9... - 0x38, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, // 8...I&.......U.. - 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // ....>.......I&.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // A.......T4...... - 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, // ....=........... - 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, // T4..>........... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // A........@...... - 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, // ....=........-.. - 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, // .@..>...v....-.. - 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x38, 0x04, 0x00, 0x00, // ....8...6...8... - 0x0e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // ............7... - 0x9a, 0x02, 0x00, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, // .....H..7....... - 0x2c, 0x47, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x51, 0x1d, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ,G......Q...;... - 0xb5, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ............A... - 0x9a, 0x02, 0x00, 0x00, 0x50, 0x24, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....P$.......... - 0x3e, 0x00, 0x03, 0x00, 0x50, 0x24, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...P$......=... - 0x18, 0x00, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....'(..,G..Q... - 0x0d, 0x00, 0x00, 0x00, 0xac, 0x4a, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....J..'(...... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7c, 0x57, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, // Q.......|W..'(.. - 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1d, 0x19, 0x00, 0x00, // ....Q........... - 0x27, 0x28, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // '(......P....... - 0xf5, 0x42, 0x00, 0x00, 0xac, 0x4a, 0x00, 0x00, 0x7c, 0x57, 0x00, 0x00, 0x1d, 0x19, 0x00, 0x00, // .B...J..|W...... - 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x61, 0x23, 0x00, 0x00, // ....A.......a#.. - 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // B...)...=...e... - 0x2b, 0x34, 0x00, 0x00, 0x61, 0x23, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // +4..a#.......... - 0xd7, 0x32, 0x00, 0x00, 0xf5, 0x42, 0x00, 0x00, 0x2b, 0x34, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .2...B..+4..A... - 0x9a, 0x02, 0x00, 0x00, 0x97, 0x2f, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ...../.......... - 0x3e, 0x00, 0x03, 0x00, 0x97, 0x2f, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >..../...2..=... - 0x1d, 0x00, 0x00, 0x00, 0x8e, 0x31, 0x00, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .....1...H..A... - 0x9a, 0x02, 0x00, 0x00, 0x9e, 0x4c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....L.......... - 0x3e, 0x00, 0x03, 0x00, 0x9e, 0x4c, 0x00, 0x00, 0x8e, 0x31, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....L...1..=... - 0x38, 0x04, 0x00, 0x00, 0x30, 0x19, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, // 8...0........... - 0x30, 0x19, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // 0...8.... + 0x48, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H... ........... + 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H... .......#... + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H... ....... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, // ........G... ... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G..."..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...6....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...:....... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....G...C....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...F....... + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ............... + 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, // ....+........... + 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, // ...?+........... + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ........ ....... + 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ...!....... ... + 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...!..."....... + 0x20, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ...#........... + 0x20, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...5........... + 0x3b, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...5...6....... + 0x20, 0x00, 0x04, 0x00, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...9........... + 0x3b, 0x00, 0x04, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...9...:....... + 0x20, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...B........... + 0x3b, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...B...C....... + 0x3b, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...B...F....... + 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... + 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x07, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....7...6...=... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....;...:...Q... + 0x06, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....]...;....... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // Q.......^...;... + 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // ....Q......._... + 0x3b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // ;.......P....... + 0x60, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // `...]...^..._... + 0x15, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, // ....A...#...a... + 0x22, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, // ".......=....... + 0x62, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // b...a........... + 0x63, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // c...`...b...Q... + 0x06, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....h...c....... + 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // ........i...h... + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, // R...........i... + 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x43, 0x00, 0x00, 0x00, // c.......>...C... + 0x80, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x46, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, // ....>...F...7... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, 0x00, 0x40, 0x00, // ....8.........@. }; static const uint8_t vs_debugdraw_lines_dx9[313] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc index a7097378fa2..bfb5c73e59d 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h index f98d559feb2..97179df413f 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h @@ -28,211 +28,91 @@ static const uint8_t vs_debugdraw_lines_stipple_glsl[419] = 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x3b, 0x0a, 0x7d, // a_texcoord0.x;.} 0x0a, 0x0a, 0x00, // ... }; -static const uint8_t vs_debugdraw_lines_stipple_spv[3237] = +static const uint8_t vs_debugdraw_lines_stipple_spv[1314] = { 0x56, 0x53, 0x48, 0x05, 0xe7, 0x1a, 0x5a, 0xef, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH...Z....u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x80, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ......#......... - 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xf4, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0xfb, 0x0b, 0x00, 0x00, // ........v....... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, // main....?...C... + 0x47, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, // G...R...U...Y... 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x4c, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // L...Output...... - 0x4c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // L.......gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x4c, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion.....L....... - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x4c, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, // L.......v_stippl - 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xad, 0x11, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // e...........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, // n(vf4;vf3;vf2;.. - 0x05, 0x00, 0x05, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ........a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ......../B..a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x10, 0x46, 0x00, 0x00, // sition.......F.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xdf, 0x00, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x09, 0x00, 0xfb, 0x0b, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo - 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, // intOutput.v_stip - 0x70, 0x6c, 0x65, 0x00, 0x47, 0x00, 0x04, 0x00, 0x65, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ple.G...e....... - 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // @...H........... - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // #.......H....... - 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ....#.......H... - 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ........#... ... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H............... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....H........... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // #...`...H....... - 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H............... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H........... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // #.......H....... - 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, // ........#... ... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H............... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....H........... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // #...`...H....... - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H............... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H........... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, // #.......H....... - 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ............H... - 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H............... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xdf, 0x00, 0x00, 0x00, // #... ...G....... - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...B..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....G........... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...v....... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xfb, 0x0b, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... - 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ............... - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x4c, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........L....... - 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0xd3, 0x08, 0x00, 0x00, // ........!....... - 0x4c, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, // L............... - 0x20, 0x00, 0x04, 0x00, 0xc9, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4c, 0x04, 0x00, 0x00, // ...........L... - 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........ ....... - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // +............... - 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, // +..............? - 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ,............... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... - 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x65, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // e...e...j....... - 0xdf, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5c, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0xdf, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5c, 0x03, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ....;.......B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, // e...+........... - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, // ....;.......v... - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xfb, 0x0b, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0xc9, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, // .8...?..>....... - 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x4c, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // @,..9...L...I&.. - 0xad, 0x11, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .....U...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =....... ....@.. - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v... ...A... - 0x8a, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0xfb, 0x0b, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x4c, 0x04, 0x00, 0x00, 0xad, 0x11, 0x00, 0x00, // 8...6...L....... - 0x00, 0x00, 0x00, 0x00, 0xd3, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........7....... - 0xe2, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, // ....7......./B.. - 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........F...... - 0x70, 0x1e, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xc9, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // p...;........... - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbb, 0x25, 0x00, 0x00, // ....A........%.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbb, 0x25, 0x00, 0x00, // ........>....%.. - 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9b, 0x49, 0x00, 0x00, // ....A........I.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9b, 0x49, 0x00, 0x00, // ........>....I.. - 0x0c, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x46, 0x29, 0x00, 0x00, // ....=.......F).. - 0x2f, 0x42, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xcb, 0x4b, 0x00, 0x00, // /B..Q........K.. - 0x46, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // F)......Q....... - 0x9b, 0x58, 0x00, 0x00, 0x46, 0x29, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // .X..F)......Q... - 0x0d, 0x00, 0x00, 0x00, 0x3c, 0x1a, 0x00, 0x00, 0x46, 0x29, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....<...F)...... - 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x14, 0x44, 0x00, 0x00, 0xcb, 0x4b, 0x00, 0x00, // P........D...K.. - 0x9b, 0x58, 0x00, 0x00, 0x3c, 0x1a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .X..<.......A... - 0xe2, 0x02, 0x00, 0x00, 0x80, 0x24, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // .....$..B...)... - 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x4a, 0x35, 0x00, 0x00, 0x80, 0x24, 0x00, 0x00, // =...e...J5...$.. - 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf6, 0x33, 0x00, 0x00, 0x14, 0x44, 0x00, 0x00, // .........3...D.. - 0x4a, 0x35, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb6, 0x30, 0x00, 0x00, // J5..A........0.. - 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb6, 0x30, 0x00, 0x00, // ........>....0.. - 0xf6, 0x33, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, // .3..=........2.. - 0xe2, 0x2e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x09, 0x4e, 0x00, 0x00, // ....A........N.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x09, 0x4e, 0x00, 0x00, // ........>....N.. - 0xad, 0x32, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x94, 0x4a, 0x00, 0x00, // .2..A........J.. - 0x10, 0x46, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // .F......=....... - 0xb2, 0x19, 0x00, 0x00, 0x94, 0x4a, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, // .....J..A....... - 0x95, 0x4a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .J..........>... - 0x95, 0x4a, 0x00, 0x00, 0xb2, 0x19, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x4c, 0x04, 0x00, 0x00, // .J......=...L... - 0xf6, 0x31, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xf6, 0x31, 0x00, 0x00, // .1...........1.. - 0x38, 0x00, 0x01, 0x00, 0x00, // 8.... + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0x26, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, // &...$Global..... + 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // &.......u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, // iewProj.....(... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ........?...a_co + 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x43, 0x00, 0x00, 0x00, // lor0........C... + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0x47, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // G...a_texcoord0. + 0x05, 0x00, 0x0a, 0x00, 0x52, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....R...@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // intOutput.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x55, 0x00, 0x00, 0x00, // ition.......U... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // t.v_color0...... + 0x59, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // Y...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x73, 0x74, 0x69, 0x70, 0x70, 0x6c, 0x65, 0x00, // utput.v_stipple. + 0x48, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...&........... + 0x48, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...&.......#... + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...&....... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, // ........G...&... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...(..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...?....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...C....... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...G....... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....G...R....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...U....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x59, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...Y....... + 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ............... + 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ....+........... + 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ...?+........... + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ........%....... + 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // ........&...%... + 0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, // ...'.......&... + 0x3b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...'...(....... + 0x20, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // ...).......%... + 0x20, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...>........... + 0x3b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...>...?....... + 0x20, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...B........... + 0x3b, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...B...C....... + 0x20, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ...F........... + 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...F...G....... + 0x20, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...Q........... + 0x3b, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...Q...R....... + 0x3b, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...Q...U....... + 0x20, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...X........... + 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...X...Y....... + 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... + 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x07, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....@...?...=... + 0x09, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....D...C...=... + 0x0b, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....H...G...Q... + 0x06, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....q...D....... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // Q.......r...D... + 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, // ....Q.......s... + 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // D.......P....... + 0x74, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, // t...q...r...s... + 0x18, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, // ....A...)...u... + 0x28, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // (.......=...%... + 0x76, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // v...u........... + 0x77, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // w...t...v...Q... + 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....|...H....... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // Q...........w... + 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // ................ + 0x7f, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // ....R........... + 0x80, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ....w.......>... + 0x52, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x55, 0x00, 0x00, 0x00, // R.......>...U... + 0x40, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x59, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, // @...>...Y...|... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, // ....8........... + 0x40, 0x00, // @. }; static const uint8_t vs_debugdraw_lines_stipple_dx9[349] = { diff --git a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc index 9e027b8bdee..91b2d8b2b96 100644 --- a/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc +++ b/3rdparty/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_texcoord0 $output v_color0, v_stipple /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/entry/cmd.cpp b/3rdparty/bgfx/examples/common/entry/cmd.cpp index 08fe6b27501..4c68be9b51c 100644 --- a/3rdparty/bgfx/examples/common/entry/cmd.cpp +++ b/3rdparty/bgfx/examples/common/entry/cmd.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -37,7 +37,7 @@ struct CmdContext void exec(const char* _cmd) { - for (const char* next = _cmd; '\0' != *next; _cmd = next) + for (bx::StringView next(_cmd); !next.isEmpty(); _cmd = next.getPtr() ) { char commandLine[1024]; uint32_t size = sizeof(commandLine); @@ -62,14 +62,14 @@ struct CmdContext case -1: { - stl::string tmp(_cmd, next-_cmd - (*next == '\0' ? 0 : 1) ); + stl::string tmp(_cmd, next.getPtr()-_cmd - (next.isEmpty() ? 0 : 1) ); DBG("Command '%s' doesn't exist.", tmp.c_str() ); } break; default: { - stl::string tmp(_cmd, next-_cmd - (*next == '\0' ? 0 : 1) ); + stl::string tmp(_cmd, next.getPtr()-_cmd - (next.isEmpty() ? 0 : 1) ); DBG("Failed '%s' err: %d.", tmp.c_str(), err); } break; diff --git a/3rdparty/bgfx/examples/common/entry/cmd.h b/3rdparty/bgfx/examples/common/entry/cmd.h index b11f1af7a9f..27523d153c0 100644 --- a/3rdparty/bgfx/examples/common/entry/cmd.h +++ b/3rdparty/bgfx/examples/common/entry/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/entry/dbg.h b/3rdparty/bgfx/examples/common/entry/dbg.h index 06a228ed753..2a50e7a5813 100644 --- a/3rdparty/bgfx/examples/common/entry/dbg.h +++ b/3rdparty/bgfx/examples/common/entry/dbg.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp index f476bb5e459..44c9dfd604b 100644 --- a/3rdparty/bgfx/examples/common/entry/entry.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -284,9 +284,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { if (setOrToggle(s_reset, "vsync", BGFX_RESET_VSYNC, 1, _argc, _argv) || setOrToggle(s_reset, "maxaniso", BGFX_RESET_MAXANISOTROPY, 1, _argc, _argv) - || setOrToggle(s_reset, "hmd", BGFX_RESET_HMD, 1, _argc, _argv) - || setOrToggle(s_reset, "hmddbg", BGFX_RESET_HMD_DEBUG, 1, _argc, _argv) - || setOrToggle(s_reset, "hmdrecenter", BGFX_RESET_HMD_RECENTER, 1, _argc, _argv) || setOrToggle(s_reset, "msaa", BGFX_RESET_MSAA_X16, 1, _argc, _argv) || setOrToggle(s_reset, "flush", BGFX_RESET_FLUSH_AFTER_RENDER, 1, _argc, _argv) || setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv) @@ -606,7 +603,7 @@ restart: for (AppI* app = getFirstApp(); NULL != app; app = app->getNext() ) { if (NULL == selected - && bx::strFindI(app->getName(), find) ) + && !bx::strFindI(app->getName(), find).isEmpty() ) { selected = app; } @@ -652,6 +649,8 @@ restart: return result; } + WindowState s_window[ENTRY_CONFIG_MAX_WINDOWS]; + bool processEvents(uint32_t& _width, uint32_t& _height, uint32_t& _debug, uint32_t& _reset, MouseState* _mouse) { s_debug = _debug; @@ -732,6 +731,11 @@ restart: case Event::Size: { const SizeEvent* size = static_cast(ev); + WindowState& win = s_window[0]; + win.m_handle = size->m_handle; + win.m_width = size->m_width; + win.m_height = size->m_height; + handle = size->m_handle; _width = size->m_width; _height = size->m_height; @@ -745,6 +749,13 @@ restart: case Event::Suspend: break; + case Event::DropFile: + { + const DropFileEvent* drop = static_cast(ev); + DBG("%s", drop->m_filePath.get() ); + } + break; + default: break; } @@ -770,8 +781,6 @@ restart: return s_exit; } - WindowState s_window[ENTRY_CONFIG_MAX_WINDOWS]; - bool processWindowEvents(WindowState& _state, uint32_t& _debug, uint32_t& _reset) { s_debug = _debug; @@ -780,6 +789,7 @@ restart: WindowHandle handle = { UINT16_MAX }; bool mouseLock = inputIsMouseLocked(); + bool clearDropFile = true; const Event* ev; do @@ -900,6 +910,14 @@ restart: case Event::Suspend: break; + case Event::DropFile: + { + const DropFileEvent* drop = static_cast(ev); + win.m_dropFile = drop->m_filePath; + clearDropFile = false; + } + break; + default: break; } @@ -911,7 +929,12 @@ restart: if (isValid(handle) ) { - const WindowState& win = s_window[handle.idx]; + WindowState& win = s_window[handle.idx]; + if (clearDropFile) + { + win.m_dropFile.clear(); + } + _state = win; if (handle.idx == 0) diff --git a/3rdparty/bgfx/examples/common/entry/entry.h b/3rdparty/bgfx/examples/common/entry/entry.h index 9efe7c672aa..75cbeb26ca3 100644 --- a/3rdparty/bgfx/examples/common/entry/entry.h +++ b/3rdparty/bgfx/examples/common/entry/entry.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -8,6 +8,7 @@ #include "dbg.h" #include +#include #include namespace bx { struct FileReaderI; struct FileWriterI; struct AllocatorI; } @@ -252,7 +253,7 @@ namespace entry void setWindowPos(WindowHandle _handle, int32_t _x, int32_t _y); void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height); void setWindowTitle(WindowHandle _handle, const char* _title); - void toggleWindowFrame(WindowHandle _handle); + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled); void toggleFullscreen(WindowHandle _handle); void setMouseLock(WindowHandle _handle, bool _lock); void setCurrentDir(const char* _dir); @@ -272,6 +273,7 @@ namespace entry uint32_t m_height; MouseState m_mouse; void* m_nwh; + bx::FilePath m_dropFile; }; bool processWindowEvents(WindowState& _state, uint32_t& _debug, uint32_t& _reset); diff --git a/3rdparty/bgfx/examples/common/entry/entry_android.cpp b/3rdparty/bgfx/examples/common/entry/entry_android.cpp index 3c39f6085f0..644ed4aca4c 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_android.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_android.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -535,9 +535,9 @@ namespace entry BX_UNUSED(_handle, _title); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - BX_UNUSED(_handle); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_asmjs.cpp b/3rdparty/bgfx/examples/common/entry/entry_asmjs.cpp index 87857612ee5..4434e41c9e6 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_asmjs.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_asmjs.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -381,9 +381,9 @@ namespace entry BX_UNUSED(_handle, _title); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - BX_UNUSED(_handle); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp index 9c3ad35894e..5e81dd9aece 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_glfw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -276,7 +276,7 @@ namespace entry static void joystickCb(int _jid, int _action); // Based on cutef8 by Jeff Bezanson (Public Domain) - static uint8_t encodeUTF8(uint8_t _chars[4], unsigned int _scancode) + static uint8_t encodeUTF8(uint8_t _chars[4], uint32_t _scancode) { uint8_t length = 0; @@ -432,6 +432,7 @@ namespace entry glfwSetCursorPosCallback(m_windows[0], cursorPosCb); glfwSetMouseButtonCallback(m_windows[0], mouseButtonCb); glfwSetWindowSizeCallback(m_windows[0], windowSizeCb); + glfwSetDropCallback(m_windows[0], dropFileCb); glfwSetWindow(m_windows[0]); m_eventQueue.postSizeEvent(handle, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT); @@ -491,6 +492,7 @@ namespace entry glfwSetCursorPosCallback(window, cursorPosCb); glfwSetMouseButtonCallback(window, mouseButtonCb); glfwSetWindowSizeCallback(window, windowSizeCb); + glfwSetDropCallback(window, dropFileCb); m_windows[msg->m_handle.idx] = window; m_eventQueue.postSizeEvent(msg->m_handle, msg->m_width, msg->m_height); @@ -619,12 +621,13 @@ namespace entry return invalid; } - static void keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods); - static void charCb(GLFWwindow* _window, unsigned int _scancode); + static void keyCb(GLFWwindow* _window, int32_t _key, int32_t _scancode, int32_t _action, int32_t _mods); + static void charCb(GLFWwindow* _window, uint32_t _scancode); static void scrollCb(GLFWwindow* _window, double _dx, double _dy); static void cursorPosCb(GLFWwindow* _window, double _mx, double _my); - static void mouseButtonCb(GLFWwindow* _window, int _button, int _action, int _mods); - static void windowSizeCb(GLFWwindow* _window, int _width, int _height); + static void mouseButtonCb(GLFWwindow* _window, int32_t _button, int32_t _action, int32_t _mods); + static void windowSizeCb(GLFWwindow* _window, int32_t _width, int32_t _height); + static void dropFileCb(GLFWwindow* _window, int32_t _count, const char** _filePaths); MainThreadEntry m_mte; bx::Thread m_thread; @@ -649,7 +652,7 @@ namespace entry Context s_ctx; - void Context::keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods) + void Context::keyCb(GLFWwindow* _window, int32_t _key, int32_t _scancode, int32_t _action, int32_t _mods) { BX_UNUSED(_scancode); if (_key == GLFW_KEY_UNKNOWN) @@ -663,7 +666,7 @@ namespace entry s_ctx.m_eventQueue.postKeyEvent(handle, key, mods, down); } - void Context::charCb(GLFWwindow* _window, unsigned int _scancode) + void Context::charCb(GLFWwindow* _window, uint32_t _scancode) { WindowHandle handle = s_ctx.findHandle(_window); uint8_t chars[4]; @@ -700,7 +703,7 @@ namespace entry ); } - void Context::mouseButtonCb(GLFWwindow* _window, int _button, int _action, int _mods) + void Context::mouseButtonCb(GLFWwindow* _window, int32_t _button, int32_t _action, int32_t _mods) { BX_UNUSED(_mods); WindowHandle handle = s_ctx.findHandle(_window); @@ -716,12 +719,21 @@ namespace entry ); } - void Context::windowSizeCb(GLFWwindow* _window, int _width, int _height) + void Context::windowSizeCb(GLFWwindow* _window, int32_t _width, int32_t _height) { WindowHandle handle = s_ctx.findHandle(_window); s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height); } + void Context::dropFileCb(GLFWwindow* _window, int32_t _count, const char** _filePaths) + { + WindowHandle handle = s_ctx.findHandle(_window); + for (int32_t ii = 0; ii < _count; ++ii) + { + s_ctx.m_eventQueue.postDropFileEvent(handle, _filePaths[ii]); + } + } + static void joystickCb(int _jid, int _action) { if (_jid >= ENTRY_CONFIG_MAX_GAMEPADS) @@ -813,12 +825,9 @@ namespace entry glfwPostEmptyEvent(); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - Msg* msg = new Msg(GLFW_WINDOW_TOGGLE_FRAME); - msg->m_handle = _handle; - s_ctx.m_msgs.push(msg); - glfwPostEmptyEvent(); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_ios.mm b/3rdparty/bgfx/examples/common/entry/entry_ios.mm index d781089fb63..569e99f51bd 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_ios.mm +++ b/3rdparty/bgfx/examples/common/entry/entry_ios.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -130,9 +130,9 @@ namespace entry BX_UNUSED(_handle, _title); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - BX_UNUSED(_handle); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_noop.cpp b/3rdparty/bgfx/examples/common/entry/entry_noop.cpp index a0007bc5c98..a7157d77ef2 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_noop.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_noop.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -52,9 +52,9 @@ namespace entry BX_UNUSED(_handle, _title); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - BX_UNUSED(_handle); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) @@ -71,7 +71,7 @@ namespace entry int main(int _argc, const char* const* _argv) { - entry::main(_argc, _argv); + return entry::main(_argc, _argv); } #endif // ENTRY_CONFIG_USE_NOOP diff --git a/3rdparty/bgfx/examples/common/entry/entry_osx.mm b/3rdparty/bgfx/examples/common/entry/entry_osx.mm index e99d59bab27..9bd53fb1362 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_osx.mm +++ b/3rdparty/bgfx/examples/common/entry/entry_osx.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -58,7 +58,6 @@ namespace entry bgfx::setPlatformData(pd); } - static WindowHandle s_defaultWindow = { 0 }; static uint8_t s_translateKey[256]; struct MainThreadEntry @@ -94,7 +93,8 @@ namespace entry struct Context { Context() - : m_scrollf(0.0f) + : m_windowsCreated(0) + , m_scrollf(0.0f) , m_mx(0) , m_my(0) , m_scroll(0) @@ -156,7 +156,7 @@ namespace entry NSEvent* waitEvent() { return [NSApp - nextEventMatchingMask:NSAnyEventMask + nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantFuture] // wait for event inMode:NSDefaultRunLoopMode dequeue:YES @@ -166,52 +166,38 @@ namespace entry NSEvent* peekEvent() { return [NSApp - nextEventMatchingMask:NSAnyEventMask + nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] // do not wait for event inMode:NSDefaultRunLoopMode dequeue:YES ]; } - void getMousePos(int* outX, int* outY) + void getMousePos(NSWindow *window, int* outX, int* outY) { - WindowHandle handle = { 0 }; - NSWindow* window = m_window[handle.idx]; - NSRect originalFrame = [window frame]; - NSPoint location = [window mouseLocationOutsideOfEventStream]; - NSRect adjustFrame = [window contentRectForFrameRect: originalFrame]; + //WindowHandle handle = { 0 }; + //NSWindow* window = m_window[handle.idx]; - int x = location.x; - int y = (int)adjustFrame.size.height - (int)location.y; + NSRect originalFrame = [window frame]; + NSPoint location = [window mouseLocationOutsideOfEventStream]; + NSRect adjustFrame = [window contentRectForFrameRect: originalFrame]; + + int32_t x = location.x; + int32_t y = int32_t(adjustFrame.size.height) - int32_t(location.y); // clamp within the range of the window - - if (x < 0) x = 0; - if (y < 0) y = 0; - if (x > (int)adjustFrame.size.width) x = (int)adjustFrame.size.width; - if (y > (int)adjustFrame.size.height) y = (int)adjustFrame.size.height; - - *outX = x; - *outY = y; + *outX = bx::clamp(x, 0, int32_t(adjustFrame.size.width) ); + *outY = bx::clamp(y, 0, int32_t(adjustFrame.size.height) ); } uint8_t translateModifiers(int flags) { - uint8_t mask = 0; - - if (flags & NSShiftKeyMask) - mask |= Modifier::LeftShift | Modifier::RightShift; - - if (flags & NSAlternateKeyMask) - mask |= Modifier::LeftAlt | Modifier::RightAlt; - - if (flags & NSControlKeyMask) - mask |= Modifier::LeftCtrl | Modifier::RightCtrl; - - if (flags & NSCommandKeyMask) - mask |= Modifier::LeftMeta | Modifier::RightMeta; - - return mask; + return 0 + | (0 != (flags & NSEventModifierFlagShift ) ) ? Modifier::LeftShift | Modifier::RightShift : 0 + | (0 != (flags & NSEventModifierFlagOption ) ) ? Modifier::LeftAlt | Modifier::RightAlt : 0 + | (0 != (flags & NSEventModifierFlagControl) ) ? Modifier::LeftCtrl | Modifier::RightCtrl : 0 + | (0 != (flags & NSEventModifierFlagCommand) ) ? Modifier::LeftMeta | Modifier::RightMeta : 0 + ; } Key::Enum handleKeyEvent(NSEvent* event, uint8_t* specialKeys, uint8_t* _pressedChar) @@ -227,7 +213,7 @@ namespace entry *_pressedChar = (uint8_t)keyChar; int keyCode = keyChar; - *specialKeys = translateModifiers([event modifierFlags]); + *specialKeys = translateModifiers(int([event modifierFlags])); // if this is a unhandled key just return None if (keyCode < 256) @@ -272,54 +258,60 @@ namespace entry { NSEventType eventType = [event type]; + NSWindow *window = [NSApp keyWindow]; + WindowHandle handle = handleFromWindow(window); + switch (eventType) { - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: - getMousePos(&m_mx, &m_my); - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll); + case NSEventTypeMouseMoved: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: + getMousePos(window, &m_mx, &m_my); + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll); break; - case NSLeftMouseDown: + case NSEventTypeLeftMouseDown: { // Command + Left Mouse Button acts as middle! This just a temporary solution! // This is because the average OSX user doesn't have middle mouse click. - MouseButton::Enum mb = ([event modifierFlags] & NSCommandKeyMask) ? MouseButton::Middle : MouseButton::Left; - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, mb, true); + MouseButton::Enum mb = ([event modifierFlags] & NSEventModifierFlagCommand) + ? MouseButton::Middle + : MouseButton::Left + ; + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, mb, true); } break; - case NSLeftMouseUp: - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Left, false); - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Middle, false); + case NSEventTypeLeftMouseUp: + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Left, false); + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Middle, false); break; - case NSRightMouseDown: - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Right, true); + case NSEventTypeRightMouseDown: + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Right, true); break; - case NSRightMouseUp: - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Right, false); + case NSEventTypeRightMouseUp: + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Right, false); break; - case NSOtherMouseDown: - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Middle, true); + case NSEventTypeOtherMouseDown: + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Middle, true); break; - case NSOtherMouseUp: - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Middle, false); + case NSEventTypeOtherMouseUp: + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Middle, false); break; - case NSScrollWheel: + case NSEventTypeScrollWheel: m_scrollf += [event deltaY]; m_scroll = (int32_t)m_scrollf; - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll); + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll); break; - case NSKeyDown: + case NSEventTypeKeyDown: { uint8_t modifiers = 0; uint8_t pressedChar[4]; @@ -335,15 +327,15 @@ namespace entry else { enum { ShiftMask = Modifier::LeftShift|Modifier::RightShift }; - m_eventQueue.postCharEvent(s_defaultWindow, 1, pressedChar); - m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, true); + m_eventQueue.postCharEvent(handle, 1, pressedChar); + m_eventQueue.postKeyEvent(handle, key, modifiers, true); return false; } } } break; - case NSKeyUp: + case NSEventTypeKeyUp: { uint8_t modifiers = 0; uint8_t pressedChar[4]; @@ -353,7 +345,7 @@ namespace entry if (key != Key::None) { - m_eventQueue.postKeyEvent(s_defaultWindow, key, modifiers, false); + m_eventQueue.postKeyEvent(handle, key, modifiers, false); return false; } @@ -373,10 +365,9 @@ namespace entry return false; } - void windowDidResize() + void windowDidResize(NSWindow *window) { - WindowHandle handle = { 0 }; - NSWindow* window = m_window[handle.idx]; + WindowHandle handle = handleFromWindow(window); NSRect originalFrame = [window frame]; NSRect rect = [window contentRectForFrameRect: originalFrame]; uint32_t width = uint32_t(rect.size.width); @@ -384,20 +375,22 @@ namespace entry m_eventQueue.postSizeEvent(handle, width, height); // Make sure mouse button state is 'up' after resize. - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Left, false); - m_eventQueue.postMouseEvent(s_defaultWindow, m_mx, m_my, m_scroll, MouseButton::Right, false); + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Left, false); + m_eventQueue.postMouseEvent(handle, m_mx, m_my, m_scroll, MouseButton::Right, false); } - void windowDidBecomeKey() + void windowDidBecomeKey(NSWindow *window) { - m_eventQueue.postSuspendEvent(s_defaultWindow, Suspend::WillResume); - m_eventQueue.postSuspendEvent(s_defaultWindow, Suspend::DidResume); + WindowHandle handle = handleFromWindow(window); + m_eventQueue.postSuspendEvent(handle, Suspend::WillResume); + m_eventQueue.postSuspendEvent(handle, Suspend::DidResume); } - void windowDidResignKey() + void windowDidResignKey(NSWindow *window) { - m_eventQueue.postSuspendEvent(s_defaultWindow, Suspend::WillSuspend); - m_eventQueue.postSuspendEvent(s_defaultWindow, Suspend::DidSuspend); + WindowHandle handle = handleFromWindow(window); + m_eventQueue.postSuspendEvent(handle, Suspend::WillSuspend); + m_eventQueue.postSuspendEvent(handle, Suspend::DidSuspend); } int32_t run(int _argc, const char* const* _argv) @@ -435,34 +428,21 @@ namespace entry [NSApp setMainMenu:menubar]; m_style = 0 - | NSTitledWindowMask - | NSClosableWindowMask - | NSMiniaturizableWindowMask - | NSResizableWindowMask - ; + | NSWindowStyleMaskTitled + | NSWindowStyleMaskResizable + | NSWindowStyleMaskClosable + | NSWindowStyleMaskMiniaturizable + ; NSRect screenRect = [[NSScreen mainScreen] frame]; const float centerX = (screenRect.size.width - (float)ENTRY_DEFAULT_WIDTH )*0.5f; const float centerY = (screenRect.size.height - (float)ENTRY_DEFAULT_HEIGHT)*0.5f; - - m_windowAlloc.alloc(); - NSRect rect = NSMakeRect(centerX, centerY, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT); - NSWindow* window = [[NSWindow alloc] - initWithContentRect:rect - styleMask:m_style - backing:NSBackingStoreBuffered defer:NO - ]; NSString* appName = [[NSProcessInfo processInfo] processName]; - [window setTitle:appName]; - [window makeKeyAndOrderFront:window]; - [window setAcceptsMouseMovedEvents:YES]; - [window setBackgroundColor:[NSColor blackColor]]; - [[Window sharedDelegate] windowCreated:window]; + createWindow(centerX, centerY, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT, ENTRY_WINDOW_FLAG_NONE, [appName UTF8String]); - m_window[0] = window; - m_windowFrame = [window frame]; + m_windowFrame = [m_window[0] frame]; - osxSetNSWindow(window); + osxSetNSWindow(m_window[0]); MainThreadEntry mte; mte.m_argc = _argc; @@ -472,7 +452,10 @@ namespace entry thread.init(mte.threadFunc, &mte); WindowHandle handle = { 0 }; - m_eventQueue.postSizeEvent(handle, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT); + NSRect contentRect = [m_window[0] contentRectForFrameRect: m_windowFrame]; + uint32_t width = uint32_t(contentRect.size.width); + uint32_t height = uint32_t(contentRect.size.height); + m_eventQueue.postSizeEvent(handle, width, height); while (!(m_exit = [dg applicationHasTerminated]) ) { @@ -499,10 +482,26 @@ namespace entry return m_windowAlloc.isValid(_handle.idx); } + WindowHandle handleFromWindow(NSWindow *window) + { + uint16_t windowIdx = 0; + for (uint16_t i = 0; i < m_windowsCreated; i++) + { + if (window == m_window[i]) + { + windowIdx = i; + break; + } + } + WindowHandle handle = { windowIdx }; + return handle; + } + EventQueue m_eventQueue; bx::HandleAllocT m_windowAlloc; NSWindow* m_window[ENTRY_CONFIG_MAX_WINDOWS]; + SInt32 m_windowsCreated; NSRect m_windowFrame; float m_scrollf; @@ -533,8 +532,50 @@ namespace entry WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title) { - BX_UNUSED(_x, _y, _width, _height, _flags, _title); - WindowHandle handle = { UINT16_MAX }; + BX_UNUSED(_flags); + + uint16_t handleIdx = IncrementAtomic(&s_ctx.m_windowsCreated); + + if (handleIdx >= ENTRY_CONFIG_MAX_WINDOWS) + { + return { UINT16_MAX }; + } + + WindowHandle handle = { handleIdx }; + + void (^createWindowBlock)(void) = ^(void) { + s_ctx.m_windowAlloc.alloc(); + NSRect rect = NSMakeRect(_x, _y, _width, _height); + NSWindow* window = [[NSWindow alloc] + initWithContentRect:rect + styleMask:s_ctx.m_style + backing:NSBackingStoreBuffered defer:NO + ]; + NSString* appName = [NSString stringWithUTF8String:_title]; + [window setTitle:appName]; + [window makeKeyAndOrderFront:window]; + [window setAcceptsMouseMovedEvents:YES]; + [window setBackgroundColor:[NSColor blackColor]]; + [[Window sharedDelegate] windowCreated:window]; + + s_ctx.m_window[handleIdx] = window; + + if(s_ctx.m_windowsCreated > 1) + { + s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height); + s_ctx.m_eventQueue.postWindowEvent(handle, window); + } + }; + + if ([NSThread isMainThread]) + { + createWindowBlock(); + } + else + { + dispatch_async(dispatch_get_main_queue(), createWindowBlock); + } + return handle; } @@ -593,16 +634,9 @@ namespace entry } } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - if (s_ctx.isValid(_handle) ) - { - s_ctx.m_style ^= NSTitledWindowMask; - dispatch_async(dispatch_get_main_queue() - , ^{ - [s_ctx.m_window[_handle.idx] setStyleMask: s_ctx.m_style]; - }); - } + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) @@ -615,7 +649,7 @@ namespace entry if (!s_ctx.m_fullscreen) { - s_ctx.m_style &= ~NSTitledWindowMask; + s_ctx.m_style &= ~NSWindowStyleMaskTitled; dispatch_async(dispatch_get_main_queue() , ^{ [NSMenu setMenuBarVisible: false]; @@ -627,7 +661,7 @@ namespace entry } else { - s_ctx.m_style |= NSTitledWindowMask; + s_ctx.m_style |= NSWindowStyleMaskTitled; dispatch_async(dispatch_get_main_queue() , ^{ [NSMenu setMenuBarVisible: true]; @@ -737,23 +771,23 @@ namespace entry - (void)windowDidResize:(NSNotification*)notification { - BX_UNUSED(notification); + NSWindow *window = [notification object]; using namespace entry; - s_ctx.windowDidResize(); + s_ctx.windowDidResize(window); } - (void)windowDidBecomeKey:(NSNotification*)notification { - BX_UNUSED(notification); - using namespace entry; - s_ctx.windowDidBecomeKey(); + NSWindow *window = [notification object]; + using namespace entry; + s_ctx.windowDidBecomeKey(window); } - (void)windowDidResignKey:(NSNotification*)notification { - BX_UNUSED(notification); - using namespace entry; - s_ctx.windowDidResignKey(); + NSWindow *window = [notification object]; + using namespace entry; + s_ctx.windowDidResignKey(window); } @end diff --git a/3rdparty/bgfx/examples/common/entry/entry_p.h b/3rdparty/bgfx/examples/common/entry/entry_p.h index fa4792a5cb5..6776610b636 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_p.h +++ b/3rdparty/bgfx/examples/common/entry/entry_p.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -9,11 +9,12 @@ #define TINYSTL_ALLOCATOR entry::TinyStlAllocator #include +#include #include "entry.h" #ifndef ENTRY_CONFIG_USE_NOOP -# define ENTRY_CONFIG_USE_NOOP (BX_PLATFORM_QNX) +# define ENTRY_CONFIG_USE_NOOP 0 #endif // ENTRY_CONFIG_USE_NOOP #ifndef ENTRY_CONFIG_USE_SDL @@ -84,6 +85,7 @@ namespace entry Size, Window, Suspend, + DropFile, }; Event(Enum _type) @@ -170,6 +172,13 @@ namespace entry Suspend::Enum m_state; }; + struct DropFileEvent : public Event + { + ENTRY_IMPLEMENT_EVENT(DropFileEvent, Event::DropFile); + + bx::FilePath m_filePath; + }; + const Event* poll(); const Event* poll(WindowHandle _handle); void release(const Event* _event); @@ -276,6 +285,13 @@ namespace entry m_queue.push(ev); } + void postDropFileEvent(WindowHandle _handle, const bx::FilePath& _filePath) + { + DropFileEvent* ev = BX_NEW(getAllocator(), DropFileEvent)(_handle); + ev->m_filePath = _filePath; + m_queue.push(ev); + } + const Event* poll() { return m_queue.pop(); diff --git a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp index 62a59b5bc04..d582b034e5e 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_sdl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -281,6 +281,7 @@ namespace entry , m_width(0) , m_height(0) , m_flags(0) + , m_flagsEnabled(false) { } @@ -290,6 +291,7 @@ namespace entry uint32_t m_height; uint32_t m_flags; tinystl::string m_title; + bool m_flagsEnabled; }; static uint32_t s_userEventStart; @@ -299,6 +301,7 @@ namespace entry SDL_USER_WINDOW_CREATE, SDL_USER_WINDOW_DESTROY, SDL_USER_WINDOW_SET_TITLE, + SDL_USER_WINDOW_SET_FLAGS, SDL_USER_WINDOW_SET_POS, SDL_USER_WINDOW_SET_SIZE, SDL_USER_WINDOW_TOGGLE_FRAME, @@ -485,6 +488,8 @@ namespace entry WindowHandle defaultWindow = { 0 }; setWindowSize(defaultWindow, m_width, m_height, true); + SDL_EventState(SDL_DROPFILE, SDL_ENABLE); + bx::FileReaderI* reader = NULL; while (NULL == reader) { @@ -556,7 +561,7 @@ namespace entry m_eventQueue.postMouseEvent(handle , mev.x , mev.y - , 0 + , m_mz , button , mev.type == SDL_MOUSEBUTTONDOWN ); @@ -803,6 +808,18 @@ namespace entry } break; + case SDL_DROPFILE: + { + const SDL_DropEvent& dev = event.drop; + WindowHandle handle = defaultWindow; //findHandle(dev.windowID); + if (isValid(handle) ) + { + m_eventQueue.postDropFileEvent(handle, dev.file); + SDL_free(dev.file); + } + } + break; + default: { const SDL_UserEvent& uev = event.user; @@ -814,13 +831,13 @@ namespace entry Msg* msg = (Msg*)uev.data2; m_window[handle.idx] = SDL_CreateWindow(msg->m_title.c_str() - , msg->m_x - , msg->m_y - , msg->m_width - , msg->m_height - , SDL_WINDOW_SHOWN - | SDL_WINDOW_RESIZABLE - ); + , msg->m_x + , msg->m_y + , msg->m_width + , msg->m_height + , SDL_WINDOW_SHOWN + | SDL_WINDOW_RESIZABLE + ); m_flags[handle.idx] = msg->m_flags; @@ -859,6 +876,24 @@ namespace entry } break; + case SDL_USER_WINDOW_SET_FLAGS: + { + WindowHandle handle = getWindowHandle(uev); + Msg* msg = (Msg*)uev.data2; + + if (msg->m_flagsEnabled) + { + m_flags[handle.idx] |= msg->m_flags; + } + else + { + m_flags[handle.idx] &= ~msg->m_flags; + } + + delete msg; + } + break; + case SDL_USER_WINDOW_SET_POS: { WindowHandle handle = getWindowHandle(uev); @@ -1075,9 +1110,12 @@ namespace entry sdlPostEvent(SDL_USER_WINDOW_SET_TITLE, _handle, msg); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - sdlPostEvent(SDL_USER_WINDOW_TOGGLE_FRAME, _handle); + Msg* msg = new Msg; + msg->m_flags = _flags; + msg->m_flagsEnabled = _enabled; + sdlPostEvent(SDL_USER_WINDOW_SET_FLAGS, _handle, msg); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp index 68045859eb0..845c039b451 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_windows.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -266,6 +266,7 @@ namespace entry WM_USER_WINDOW_CREATE = WM_USER, WM_USER_WINDOW_DESTROY, WM_USER_WINDOW_SET_TITLE, + WM_USER_WINDOW_SET_FLAGS, WM_USER_WINDOW_SET_POS, WM_USER_WINDOW_SET_SIZE, WM_USER_WINDOW_TOGGLE_FRAME, @@ -324,6 +325,7 @@ namespace entry , m_width(0) , m_height(0) , m_flags(0) + , m_flagsEnabled(false) { } @@ -333,6 +335,7 @@ namespace entry uint32_t m_height; uint32_t m_flags; tinystl::string m_title; + bool m_flagsEnabled; }; static void mouseCapture(HWND _hwnd, bool _capture) @@ -466,7 +469,9 @@ namespace entry RegisterClassExA(&wnd); m_windowAlloc.alloc(); - m_hwnd[0] = CreateWindowA("bgfx" + m_hwnd[0] = CreateWindowExA( + WS_EX_ACCEPTFILES + , "bgfx" , "BGFX" , WS_OVERLAPPEDWINDOW|WS_VISIBLE , 0 @@ -590,6 +595,23 @@ namespace entry } break; + case WM_USER_WINDOW_SET_FLAGS: + { + Msg* msg = (Msg*)_lparam; + + if (msg->m_flagsEnabled) + { + m_flags[_wparam] |= msg->m_flags; + } + else + { + m_flags[_wparam] &= ~msg->m_flags; + } + + delete msg; + } + break; + case WM_USER_WINDOW_SET_POS: { Msg* msg = (Msg*)_lparam; @@ -838,6 +860,17 @@ namespace entry } break; + case WM_DROPFILES: + { + HDROP drop = (HDROP)_wparam; + char tmp[bx::kMaxFilePath]; + uint32_t result = DragQueryFileA(drop, 0, tmp, sizeof(tmp) ); + BX_UNUSED(result); + WindowHandle handle = findHandle(_hwnd); + m_eventQueue.postDropFileEvent(handle, tmp); + } + break; + default: break; } @@ -871,6 +904,7 @@ namespace entry HDC hdc = GetDC(_hwnd); SelectObject(hdc, brush); FillRect(hdc, &rect, brush); + ReleaseDC(_hwnd, hdc); } void adjust(HWND _hwnd, uint32_t _width, uint32_t _height, bool _windowFrame) @@ -1081,9 +1115,12 @@ namespace entry PostMessage(s_ctx.m_hwnd[0], WM_USER_WINDOW_SET_TITLE, _handle.idx, (LPARAM)msg); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - PostMessage(s_ctx.m_hwnd[0], WM_USER_WINDOW_TOGGLE_FRAME, _handle.idx, 0); + Msg* msg = new Msg; + msg->m_flags = _flags; + msg->m_flagsEnabled = _enabled; + PostMessage(s_ctx.m_hwnd[0], WM_USER_WINDOW_SET_FLAGS, _handle.idx, (LPARAM)msg); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_winrt.cx b/3rdparty/bgfx/examples/common/entry/entry_winrt.cx index c59aab100ed..76270e99770 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_winrt.cx +++ b/3rdparty/bgfx/examples/common/entry/entry_winrt.cx @@ -9,7 +9,7 @@ #include #include -#include +#include #include using namespace Windows::ApplicationModel; @@ -24,7 +24,7 @@ using namespace Windows::Graphics::Display; #endif // BX_PLATFORM_WINRT using namespace Platform; -static const char* const g_emptyArgs[] = { "" }; +static const char* const g_emptyArgs[] = { "app.exe", "", "" }; static entry::WindowHandle g_defaultWindow = { 0 }; static entry::EventQueue g_eventQueue; @@ -79,6 +79,8 @@ public: virtual void Run() { + bgfx::renderFrame(); + bx::Thread thread; thread.init(MainThreadFunc, nullptr); @@ -89,8 +91,8 @@ public: auto dpi = DisplayInformation::GetForCurrentView()->LogicalDpi; static const float dipsPerInch = 96.0f; g_eventQueue.postSizeEvent(g_defaultWindow - , lround(bx::ffloor(bounds.Width * dpi / dipsPerInch + 0.5f) ) - , lround(bx::ffloor(bounds.Height * dpi / dipsPerInch + 0.5f) ) + , lround(bx::floor(bounds.Width * dpi / dipsPerInch + 0.5f) ) + , lround(bx::floor(bounds.Height * dpi / dipsPerInch + 0.5f) ) ); #endif // BX_PLATFORM_WINRT @@ -104,10 +106,14 @@ public: { window->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); } + + bgfx::renderFrame(); } g_eventQueue.postExitEvent(); + while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() ) {}; + thread.shutdown(); } @@ -144,9 +150,9 @@ private: m_windowClosed = true; } - static int32_t MainThreadFunc(void*) + static int32_t MainThreadFunc(bx::Thread*, void*) { - return entry::main(0, g_emptyArgs); + return entry::main(BX_COUNTOF(g_emptyArgs), g_emptyArgs); } }; @@ -203,9 +209,9 @@ namespace entry BX_UNUSED(_handle, _title); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - BX_UNUSED(_handle); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp index d65520f4f08..6bfd3192caa 100644 --- a/3rdparty/bgfx/examples/common/entry/entry_x11.cpp +++ b/3rdparty/bgfx/examples/common/entry/entry_x11.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -346,7 +346,7 @@ namespace entry int32_t run(int _argc, const char* const* _argv) { XInitThreads(); - m_display = XOpenDisplay(0); + m_display = XOpenDisplay(NULL); int32_t screen = DefaultScreen(m_display); m_depth = DefaultDepth(m_display, screen); @@ -758,9 +758,9 @@ namespace entry XStoreName(display, window, _title); } - void toggleWindowFrame(WindowHandle _handle) + void setWindowFlags(WindowHandle _handle, uint32_t _flags, bool _enabled) { - BX_UNUSED(_handle); + BX_UNUSED(_handle, _flags, _enabled); } void toggleFullscreen(WindowHandle _handle) diff --git a/3rdparty/bgfx/examples/common/entry/input.cpp b/3rdparty/bgfx/examples/common/entry/input.cpp index e90d05ebb47..5fdad9c0bb6 100644 --- a/3rdparty/bgfx/examples/common/entry/input.cpp +++ b/3rdparty/bgfx/examples/common/entry/input.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/entry/input.h b/3rdparty/bgfx/examples/common/entry/input.h index 281267d338b..6954f3daa19 100644 --- a/3rdparty/bgfx/examples/common/entry/input.h +++ b/3rdparty/bgfx/examples/common/entry/input.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/example-glue.cpp b/3rdparty/bgfx/examples/common/example-glue.cpp index 61eba601b80..b6b3d456255 100644 --- a/3rdparty/bgfx/examples/common/example-glue.cpp +++ b/3rdparty/bgfx/examples/common/example-glue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -42,6 +42,34 @@ static bool bar(float _width, float _maxWidth, float _height, const ImVec4& _col return itemHovered; } +static const ImVec4 s_resourceColor(0.5f, 0.5f, 0.5f, 1.0f); + +static void resourceBar(const char* _name, const char* _tooltip, uint32_t _num, uint32_t _max, float _maxWidth, float _height) +{ + bool itemHovered = false; + + ImGui::Text("%s: %4d / %4d", _name, _num, _max); + itemHovered |= ImGui::IsItemHovered(); + ImGui::SameLine(); + + const float percentage = float(_num)/float(_max); + + itemHovered |= bar(bx::max(1.0f, percentage*_maxWidth), _maxWidth, _height, s_resourceColor); + ImGui::SameLine(); + + ImGui::Text("%5.2f%%", percentage*100.0f); + + if (itemHovered) + { + ImGui::SetTooltip("%s %5.2f%%" + , _tooltip + , percentage*100.0f + ); + } +} + +static bool s_showStats = false; + void showExampleDialog(entry::AppI* _app, const char* _errorText) { char temp[1024]; @@ -49,13 +77,15 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) ImGui::SetNextWindowPos( ImVec2(10.0f, 50.0f) - , ImGuiSetCond_FirstUseEver + , ImGuiCond_FirstUseEver ); - ImGui::Begin(temp - , NULL - , ImVec2(256.0f, 200.0f) + ImGui::SetNextWindowSize( + ImVec2(300.0f, 200.0f) + , ImGuiCond_FirstUseEver ); + ImGui::Begin(temp); + ImGui::TextWrapped("%s", _app->getDescription() ); ImGui::Separator(); @@ -136,6 +166,9 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) cmdExec("exit"); } + ImGui::SameLine(); + s_showStats ^= ImGui::Button(ICON_FA_BAR_CHART); + ImGui::PopStyleVar(); } @@ -195,8 +228,10 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) const bgfx::Stats* stats = bgfx::getStats(); const double toMsCpu = 1000.0/stats->cpuTimerFreq; const double toMsGpu = 1000.0/stats->gpuTimerFreq; - ImGui::Text("Frame %0.3f" - , double(stats->cpuTimeFrame)*toMsCpu + const double frameMs = double(stats->cpuTimeFrame)*toMsCpu; + ImGui::Text("Frame %0.3f [ms], %0.3f FPS" + , frameMs + , 1000.0/frameMs ); ImGui::Text("Submit CPU %0.3f, GPU %0.3f (L: %d)" @@ -216,102 +251,141 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText) ImGui::Text("GPU mem: %s / %s", tmp0, tmp1); } - if (0 != stats->numViews) + if (s_showStats) { - if (ImGui::CollapsingHeader(ICON_FA_CLOCK_O " Profiler") ) - { - if (ImGui::BeginChild("##view_profiler", ImVec2(0.0f, 0.0f) ) ) - { - ImGui::PushFont(ImGui::Font::Mono); + ImGui::SetNextWindowSize( + ImVec2(300.0f, 500.0f) + , ImGuiCond_FirstUseEver + ); - ImVec4 cpuColor(0.5f, 1.0f, 0.5f, 1.0f); - ImVec4 gpuColor(0.5f, 0.5f, 1.0f, 1.0f); + if (ImGui::Begin(ICON_FA_BAR_CHART " Stats", &s_showStats) ) + { + if (ImGui::CollapsingHeader(ICON_FA_PUZZLE_PIECE " Resources") ) + { + const bgfx::Caps* caps = bgfx::getCaps(); const float itemHeight = ImGui::GetTextLineHeightWithSpacing(); - const float itemHeightWithSpacing = ImGui::GetItemsLineHeightWithSpacing(); - const double toCpuMs = 1000.0/double(stats->cpuTimerFreq); - const double toGpuMs = 1000.0/double(stats->gpuTimerFreq); - const float scale = 3.0f; - - if (ImGui::ListBoxHeader("Encoders", ImVec2(ImGui::GetWindowWidth(), stats->numEncoders*itemHeightWithSpacing) ) ) - { - ImGuiListClipper clipper(stats->numEncoders, itemHeight); - - while (clipper.Step() ) - { - for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos) - { - const bgfx::EncoderStats& encoderStats = stats->encoderStats[pos]; - - ImGui::Text("%3d", pos); - ImGui::SameLine(64.0f); - - const float maxWidth = 30.0f*scale; - const float cpuMs = float( (encoderStats.cpuTimeEnd-encoderStats.cpuTimeBegin)*toCpuMs); - const float cpuWidth = bx::fclamp(cpuMs*scale, 1.0f, maxWidth); - - if (bar(cpuWidth, maxWidth, itemHeight, cpuColor) ) - { - ImGui::SetTooltip("Encoder %d, CPU: %f [ms]" - , pos - , cpuMs - ); - } - } - } - - ImGui::ListBoxFooter(); - } - - ImGui::Separator(); - - if (ImGui::ListBoxHeader("Views", ImVec2(ImGui::GetWindowWidth(), stats->numViews*itemHeightWithSpacing) ) ) - { - ImGuiListClipper clipper(stats->numViews, itemHeight); - - while (clipper.Step() ) - { - for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos) - { - const bgfx::ViewStats& viewStats = stats->viewStats[pos]; - - ImGui::Text("%3d %3d %s", pos, viewStats.view, viewStats.name); - - const float maxWidth = 30.0f*scale; - const float cpuWidth = bx::fclamp(float(viewStats.cpuTimeElapsed*toCpuMs)*scale, 1.0f, maxWidth); - const float gpuWidth = bx::fclamp(float(viewStats.gpuTimeElapsed*toGpuMs)*scale, 1.0f, maxWidth); - - ImGui::SameLine(64.0f); - - if (bar(cpuWidth, maxWidth, itemHeight, cpuColor) ) - { - ImGui::SetTooltip("View %d \"%s\", CPU: %f [ms]" - , pos - , viewStats.name - , viewStats.cpuTimeElapsed*toCpuMs - ); - } - - ImGui::SameLine(); - if (bar(gpuWidth, maxWidth, itemHeight, gpuColor) ) - { - ImGui::SetTooltip("View: %d \"%s\", GPU: %f [ms]" - , pos - , viewStats.name - , viewStats.gpuTimeElapsed*toGpuMs - ); - } - } - } - - ImGui::ListBoxFooter(); - } + const float maxWidth = 90.0f; + ImGui::PushFont(ImGui::Font::Mono); + ImGui::Text("Res: Num / Max"); + resourceBar("DIB", "Dynamic index buffers", stats->numDynamicIndexBuffers, caps->limits.maxDynamicIndexBuffers, maxWidth, itemHeight); + resourceBar("DVB", "Dynamic vertex buffers", stats->numDynamicVertexBuffers, caps->limits.maxDynamicVertexBuffers, maxWidth, itemHeight); + resourceBar(" FB", "Frame buffers", stats->numFrameBuffers, caps->limits.maxFrameBuffers, maxWidth, itemHeight); + resourceBar(" IB", "Index buffers", stats->numIndexBuffers, caps->limits.maxIndexBuffers, maxWidth, itemHeight); + resourceBar(" OQ", "Occlusion queries", stats->numOcclusionQueries, caps->limits.maxOcclusionQueries, maxWidth, itemHeight); + resourceBar(" P", "Programs", stats->numPrograms, caps->limits.maxPrograms, maxWidth, itemHeight); + resourceBar(" S", "Shaders", stats->numShaders, caps->limits.maxShaders, maxWidth, itemHeight); + resourceBar(" T", "Textures", stats->numTextures, caps->limits.maxTextures, maxWidth, itemHeight); + resourceBar(" U", "Uniforms", stats->numUniforms, caps->limits.maxUniforms, maxWidth, itemHeight); + resourceBar(" VB", "Vertex buffers", stats->numVertexBuffers, caps->limits.maxVertexBuffers, maxWidth, itemHeight); + resourceBar(" VD", "Vertex declarations", stats->numVertexDecls, caps->limits.maxVertexDecls, maxWidth, itemHeight); ImGui::PopFont(); } - ImGui::EndChild(); + if (ImGui::CollapsingHeader(ICON_FA_CLOCK_O " Profiler") ) + { + if (0 == stats->numViews) + { + ImGui::Text("Profiler is not enabled."); + } + else + { + if (ImGui::BeginChild("##view_profiler", ImVec2(0.0f, 0.0f) ) ) + { + ImGui::PushFont(ImGui::Font::Mono); + + ImVec4 cpuColor(0.5f, 1.0f, 0.5f, 1.0f); + ImVec4 gpuColor(0.5f, 0.5f, 1.0f, 1.0f); + + const float itemHeight = ImGui::GetTextLineHeightWithSpacing(); + const float itemHeightWithSpacing = ImGui::GetFrameHeightWithSpacing(); + const double toCpuMs = 1000.0/double(stats->cpuTimerFreq); + const double toGpuMs = 1000.0/double(stats->gpuTimerFreq); + const float scale = 3.0f; + + if (ImGui::ListBoxHeader("Encoders", ImVec2(ImGui::GetWindowWidth(), stats->numEncoders*itemHeightWithSpacing) ) ) + { + ImGuiListClipper clipper(stats->numEncoders, itemHeight); + + while (clipper.Step() ) + { + for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos) + { + const bgfx::EncoderStats& encoderStats = stats->encoderStats[pos]; + + ImGui::Text("%3d", pos); + ImGui::SameLine(64.0f); + + const float maxWidth = 30.0f*scale; + const float cpuMs = float( (encoderStats.cpuTimeEnd-encoderStats.cpuTimeBegin)*toCpuMs); + const float cpuWidth = bx::clamp(cpuMs*scale, 1.0f, maxWidth); + + if (bar(cpuWidth, maxWidth, itemHeight, cpuColor) ) + { + ImGui::SetTooltip("Encoder %d, CPU: %f [ms]" + , pos + , cpuMs + ); + } + } + } + + ImGui::ListBoxFooter(); + } + + ImGui::Separator(); + + if (ImGui::ListBoxHeader("Views", ImVec2(ImGui::GetWindowWidth(), stats->numViews*itemHeightWithSpacing) ) ) + { + ImGuiListClipper clipper(stats->numViews, itemHeight); + + while (clipper.Step() ) + { + for (int32_t pos = clipper.DisplayStart; pos < clipper.DisplayEnd; ++pos) + { + const bgfx::ViewStats& viewStats = stats->viewStats[pos]; + + ImGui::Text("%3d %3d %s", pos, viewStats.view, viewStats.name); + + const float maxWidth = 30.0f*scale; + const float cpuWidth = bx::clamp(float(viewStats.cpuTimeElapsed*toCpuMs)*scale, 1.0f, maxWidth); + const float gpuWidth = bx::clamp(float(viewStats.gpuTimeElapsed*toGpuMs)*scale, 1.0f, maxWidth); + + ImGui::SameLine(64.0f); + + if (bar(cpuWidth, maxWidth, itemHeight, cpuColor) ) + { + ImGui::SetTooltip("View %d \"%s\", CPU: %f [ms]" + , pos + , viewStats.name + , viewStats.cpuTimeElapsed*toCpuMs + ); + } + + ImGui::SameLine(); + if (bar(gpuWidth, maxWidth, itemHeight, gpuColor) ) + { + ImGui::SetTooltip("View: %d \"%s\", GPU: %f [ms]" + , pos + , viewStats.name + , viewStats.gpuTimeElapsed*toGpuMs + ); + } + } + } + + ImGui::ListBoxFooter(); + } + + ImGui::PopFont(); + } + + ImGui::EndChild(); + } + } } + ImGui::End(); } ImGui::End(); diff --git a/3rdparty/bgfx/examples/common/font/font_manager.cpp b/3rdparty/bgfx/examples/common/font/font_manager.cpp index 4b3062ab884..0da5c17a0ba 100644 --- a/3rdparty/bgfx/examples/common/font/font_manager.cpp +++ b/3rdparty/bgfx/examples/common/font/font_manager.cpp @@ -3,8 +3,6 @@ * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ -#define USE_EDTAA3 0 - #include #if BX_COMPILER_MSVC @@ -28,12 +26,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #include -#if USE_EDTAA3 -# include -#else -# define SDF_IMPLEMENTATION -# include -#endif // USE_EDTAA3 +#define SDF_IMPLEMENTATION +#include #include // wcslen @@ -272,102 +266,6 @@ bool TrueTypeFont::bakeGlyphSubpixel(CodePoint _codePoint, GlyphInfo& _glyphInfo return true; } -static void makeDistanceMap(const uint8_t* _img, uint8_t* _outImg, uint32_t _width, uint32_t _height) -{ -#if USE_EDTAA3 - int16_t* xdist = (int16_t*)malloc(_width * _height * sizeof(int16_t) ); - int16_t* ydist = (int16_t*)malloc(_width * _height * sizeof(int16_t) ); - double* gx = (double*)calloc(_width * _height, sizeof(double) ); - double* gy = (double*)calloc(_width * _height, sizeof(double) ); - double* data = (double*)calloc(_width * _height, sizeof(double) ); - double* outside = (double*)calloc(_width * _height, sizeof(double) ); - double* inside = (double*)calloc(_width * _height, sizeof(double) ); - uint32_t ii; - - // Convert img into double (data) - double img_min = 255, img_max = -255; - for (ii = 0; ii < _width * _height; ++ii) - { - double v = _img[ii]; - data[ii] = v; - if (v > img_max) - { - img_max = v; - } - - if (v < img_min) - { - img_min = v; - } - } - - // Rescale image levels between 0 and 1 - for (ii = 0; ii < _width * _height; ++ii) - { - data[ii] = (_img[ii] - img_min) / (img_max - img_min); - } - - // Compute outside = edtaa3(bitmap); % Transform background (0's) - computegradient(data, _width, _height, gx, gy); - edtaa3(data, gx, gy, _width, _height, xdist, ydist, outside); - for (ii = 0; ii < _width * _height; ++ii) - { - if (outside[ii] < 0) - { - outside[ii] = 0.0; - } - } - - // Compute inside = edtaa3(1-bitmap); % Transform foreground (1's) - bx::memSet(gx, 0, sizeof(double) * _width * _height); - bx::memSet(gy, 0, sizeof(double) * _width * _height); - for (ii = 0; ii < _width * _height; ++ii) - { - data[ii] = 1.0 - data[ii]; - } - - computegradient(data, _width, _height, gx, gy); - edtaa3(data, gx, gy, _width, _height, xdist, ydist, inside); - for (ii = 0; ii < _width * _height; ++ii) - { - if (inside[ii] < 0) - { - inside[ii] = 0.0; - } - } - - // distmap = outside - inside; % Bipolar distance field - uint8_t* out = _outImg; - for (ii = 0; ii < _width * _height; ++ii) - { - outside[ii] -= inside[ii]; - outside[ii] = 128 + outside[ii] * 16; - - if (outside[ii] < 0) - { - outside[ii] = 0; - } - - if (outside[ii] > 255) - { - outside[ii] = 255; - } - - out[ii] = 255 - (uint8_t) outside[ii]; - } - - free(xdist); - free(ydist); - free(gx); - free(gy); - free(data); - free(outside); - free(inside); -#else - sdfBuild(_outImg, _width, 8.0f, _img, _width, _height, _width); -#endif // USE_EDTAA3 -} - bool TrueTypeFont::bakeGlyphDistance(CodePoint _codePoint, GlyphInfo& _glyphInfo, uint8_t* _outBuffer) { BX_CHECK(m_font != NULL, "TrueTypeFont not initialized"); @@ -426,7 +324,7 @@ bool TrueTypeFont::bakeGlyphDistance(CodePoint _codePoint, GlyphInfo& _glyphInfo bx::memCopy(alphaImg + ii * nw + dw, _outBuffer + (ii - dh) * ww, ww); } - makeDistanceMap(alphaImg, _outBuffer, nw, nh); + sdfBuild(_outBuffer, nw, 8.0f, alphaImg, nw, nh, nw); free(alphaImg); _glyphInfo.offset_x -= (float)dw; @@ -719,6 +617,11 @@ const GlyphInfo* FontManager::getGlyphInfo(FontHandle _handle, CodePoint _codePo bool FontManager::addBitmap(GlyphInfo& _glyphInfo, const uint8_t* _data) { - _glyphInfo.regionIndex = m_atlas->addRegion( (uint16_t) ceil(_glyphInfo.width), (uint16_t) ceil(_glyphInfo.height), _data, AtlasRegion::TYPE_GRAY); + _glyphInfo.regionIndex = m_atlas->addRegion( + (uint16_t)bx::ceil(_glyphInfo.width) + , (uint16_t)bx::ceil(_glyphInfo.height) + , _data + , AtlasRegion::TYPE_GRAY + ); return true; } diff --git a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h index c2897caab43..dabdd175e37 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_basic.bin.h @@ -36,287 +36,114 @@ static const uint8_t fs_font_basic_glsl[553] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_4;.}... }; -static const uint8_t fs_font_basic_spv[4459] = +static const uint8_t fs_font_basic_spv[1686] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x5c, 0x11, 0x00, 0x00, 0x03, 0x02, // FSH............. - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........ob.... + 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x84, 0x06, 0x00, 0x00, 0x03, 0x02, // FSH............. + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...t......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x00, 0xd5, 0x11, 0x00, 0x00, 0x62, 0x67, // in............bg - 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x28, 0x73, 0x74, // fxTextureCube(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x43, 0x75, 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x43, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, // Cube-p1-tC11;vf3 - 0x3b, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, // ;.....~..._sampl - 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, // er.m_sampler.... - 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ......_sampler.m - 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, // _texture........ - 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, // .._coord......5. - 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, // ..vec4_splat(f1; - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, // .........._x.... - 0x07, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, // ......@main(vf4; - 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6e, 0x62, // vf4;vf4;......nb + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x10, 0x00, // ..y...|......... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, // in............Bg + 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, // fxSamplerCube... + 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, // ler............. + 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... + 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // .. ...s_texColor + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......"...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, // olorSampler..... + 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..%...s_texColor + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x79, 0x00, // Texture.......y. 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...A..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0......J..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x67, 0x09, // gData_0_......g. - 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, // ..BgfxSamplerCub - 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // e.....g.......m_ - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, // sampler.......g. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, // ..........flatte - 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, // nTemp.........s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. - 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ..........s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... - 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_sampler...... - 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..P...s_texColor - 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_texture...... - 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, // ......bgfx_VoidF - 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x70, 0x61, // rag........]..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, // ram...........co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x70, 0x61, // lor........9..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbf, 0x39, 0x00, 0x00, 0x70, 0x61, // ram........9..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, // ram........9..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x69, 0x6e, // ram.......M...in - 0x64, 0x65, 0x78, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x60, 0x10, 0x00, 0x00, 0x72, 0x67, // dex.......`...rg - 0x62, 0x61, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x61, 0x6c, // ba............al - 0x70, 0x68, 0x61, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, // pha........+..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, // color0........w. - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...<..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 0.....t...v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, // oord0.........gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...U..param..... - 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...8..param..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x72, 0x01, 0x00, 0x00, 0x24, 0x47, // a_0_......r...$G - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x01, 0x00, 0x00, 0x00, 0x00, // lobal.....r..... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, // ..u_viewRect.... - 0x06, 0x00, 0x72, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..r.......u_view - 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x02, 0x00, // Texel.....r..... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x01, // ..u_view......r. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, // ......u_invView. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......r.......u_ - 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x01, 0x00, 0x00, 0x05, 0x00, // proj......r..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invProj..... - 0x06, 0x00, 0x72, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..r.......u_view - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x72, 0x01, 0x00, 0x00, 0x07, 0x00, // Proj......r..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ..u_invViewProj. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......r.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x01, 0x00, 0x00, 0x09, 0x00, // model.....r..... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, // ..u_modelView... - 0x07, 0x00, 0x72, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..r.......u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x01, // lViewProj.....r. - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // ......u_alphaRef - 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // 4.G......."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G.......!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G......."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G.......!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...w......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...t......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xfb, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...........@. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x01, 0x00, // ......H...r..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, // ..#.......H...r. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..r............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...r......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x03, 0x00, // ..`...H...r..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..r............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...r......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x05, 0x00, // ......H...r..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..r............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...r......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x07, 0x00, // ..`...H...r..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..r............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...r......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x09, 0x00, // ......H...r..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, // ..........H...r. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..r............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x72, 0x01, 0x00, 0x00, 0x02, 0x00, // .. ...G...r..... - 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, // ..........!..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, // ..y............. - 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x98, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x06, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x15, 0x03, // ..+.......y..... - 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x91, 0x00, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, // ................ - 0x04, 0x00, 0x67, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x20, 0x00, // ..g........... . - 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x67, 0x09, 0x00, 0x00, 0x20, 0x00, // ..!.......g... . - 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, // ..z...........;. - 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // ..z........... . - 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, // ..{...........;. - 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, // ..{............. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, // ......P.......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, // ................ - 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .. .......+..... - 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x69, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..i......@+..... - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .........?+..... - 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xc9, 0x03, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x46, 0x06, // .......... ...F. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc9, 0x03, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..........+..... - 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..........+..... - 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..........+..... - 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..........+..... - 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..........+..... - 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // .......... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..w.......;..... - 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..t....... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..........+..... - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xfb, 0x07, // ..j... ......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x72, 0x01, // ..e...j.......r. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..........e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0xfb, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......e...e..... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..!...........;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......U......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......8......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, // ......!C......=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......3......P. - 0x05, 0x00, 0x67, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, // ..g...^ ..!C...3 - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, // ..>.......^ ..A. - 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, // ..y....V........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, // ..=............V - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, // ..>...........A. - 0x05, 0x00, 0x15, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, // .......@........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, // ..=............@ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, // ..>...P.......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......+..w...=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, // .......<..t...>. - 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, // ...U...+..>....8 - 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, // ...<..9........& - 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, // .......U...8.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd5, 0x11, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, // ......+...7...y. - 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x15, 0x03, 0x00, 0x00, 0xf7, 0x0d, // ..~...7......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, // ..7............. - 0x02, 0x00, 0xca, 0x1c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xc6, 0x19, // ......=......... - 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, // ......=........H - 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, // ..~...V........> - 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // .......H..=..... - 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...$......W..... - 0x00, 0x00, 0x82, 0x59, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, // ...Y...>...$.... - 0x02, 0x00, 0x82, 0x59, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...Y..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2e, 0x5f, // ..............._ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0xdd, 0x0e, // ..=........[.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xdd, 0x0e, // ..=.......%S.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xdd, 0x0e, // ..=........=.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xdd, 0x0e, // ..=........=.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, 0x00, 0x00, 0xe0, 0x5b, // ..P.......V[...[ - 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xfe, 0x00, // ..%S...=...=.... - 0x02, 0x00, 0x56, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ..V[..8...6..... - 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x37, 0x00, // ..............7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......nb..7..... - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x4a, // ...A..7........J - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......S..;..... - 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...]......;..... - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, // ..........;...y. - 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, // ...9......;..... - 0x00, 0x00, 0xbf, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, // ...9......;..... - 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x46, 0x06, // ...9......;...F. - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, // ..`.......>....] - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..5....]..=..... - 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x39, // ..#A......>....9 - 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x83, 0x2c, // ..#A..=........, - 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbf, 0x39, 0x00, 0x00, 0x83, 0x2c, // ..P...>....9..., - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x8f, 0x41, // ..=........!...A - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa0, 0x37, 0x00, 0x00, 0x19, 0x21, // ..O........7...! - 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ...!............ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0xa0, 0x37, 0x00, 0x00, 0x39, 0x00, // ..>....9...7..9. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x00, 0x00, 0xd5, 0x11, 0x00, 0x00, 0xbe, 0x39, // ...............9 - 0x00, 0x00, 0xbf, 0x39, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, // ...9...9..>..... - 0x00, 0x00, 0x18, 0x1e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xe8, 0x3a, // ......A........: - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ...A......=..... - 0x00, 0x00, 0xb2, 0x3f, 0x00, 0x00, 0xe8, 0x3a, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, // ...?...:........ - 0x00, 0x00, 0xd1, 0x46, 0x00, 0x00, 0xb2, 0x3f, 0x00, 0x00, 0x69, 0x0b, 0x00, 0x00, 0x81, 0x00, // ...F...?..i..... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x58, 0x2d, 0x00, 0x00, 0xd1, 0x46, 0x00, 0x00, 0xfc, 0x00, // ......X-...F.... - 0x00, 0x00, 0x6e, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x58, 0x2d, // ..n.......M...X- - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xfa, 0x4d, 0x00, 0x00, 0x18, 0x0e, // ..A........M.... - 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x37, // ......=.......I7 - 0x00, 0x00, 0xfa, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x5c, 0x4f, // ...M..A........O - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5c, 0x4f, // ..`.......>....O - 0x00, 0x00, 0x49, 0x37, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xd7, 0x35, // ..I7..A........5 - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... - 0x00, 0x00, 0x2e, 0x1e, 0x00, 0x00, 0xd7, 0x35, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // .......5..A..... - 0x00, 0x00, 0x5d, 0x4f, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ..]O..`.......>. - 0x03, 0x00, 0x5d, 0x4f, 0x00, 0x00, 0x2e, 0x1e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ..]O......A..... - 0x00, 0x00, 0xd8, 0x35, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...5..........=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x1e, 0x00, 0x00, 0xd8, 0x35, 0x00, 0x00, 0x41, 0x00, // ....../....5..A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x5e, 0x4f, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x11, 0x0a, // ......^O..`..... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5e, 0x4f, 0x00, 0x00, 0x2f, 0x1e, 0x00, 0x00, 0x41, 0x00, // ..>...^O../...A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xd9, 0x35, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x13, 0x0a, // .......5........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x30, 0x1e, 0x00, 0x00, 0xd9, 0x35, // ..=.......0....5 - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x5f, 0x4f, 0x00, 0x00, 0x60, 0x10, // ..A......._O..`. - 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x4f, 0x00, 0x00, 0x30, 0x1e, // ......>..._O..0. - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x8b, 0x35, 0x00, 0x00, 0x60, 0x10, // ..A........5..`. - 0x00, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x10, // ..M...=......... - 0x00, 0x00, 0x8b, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe5, 0x2e, // ...5..=......... - 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x5b, 0x3f, // ..nb..O.......[? - 0x00, 0x00, 0xe5, 0x2e, 0x00, 0x00, 0xe5, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x94, 0x1c, // ......A......... - 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..nb......=..... - 0x00, 0x00, 0xa2, 0x32, 0x00, 0x00, 0x94, 0x1c, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, // ...2............ - 0x00, 0x00, 0x9b, 0x1a, 0x00, 0x00, 0xa2, 0x32, 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x51, 0x00, // .......2......Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe6, 0x25, 0x00, 0x00, 0x5b, 0x3f, 0x00, 0x00, 0x00, 0x00, // .......%..[?.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa4, 0x2b, 0x00, 0x00, 0x5b, 0x3f, // ..Q........+..[? - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x4f, // ......Q........O - 0x00, 0x00, 0x5b, 0x3f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // ..[?......P..... - 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xe6, 0x25, 0x00, 0x00, 0xa4, 0x2b, 0x00, 0x00, 0xc5, 0x4f, // ...?...%...+...O - 0x00, 0x00, 0x9b, 0x1a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x9e, 0x3f, // ......>....J...? - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ......8.... + 0x05, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..|...v_texcoord + 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x87, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, // 0.........bgfx_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ragData0..G...%. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ..".......G...%. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x79, 0x00, // ..!.......G...y. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7c, 0x00, // ..........G...|. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x87, 0x00, // ..........G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x00, // ...... ......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ......... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, // ......;....... . + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ...!..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, // ......;...!...". + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ...$..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......;...$...%. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........(... . + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, // ......+...(...). + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2d, 0x00, // ......+...(...-. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, // ..........1..... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // ......K... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+.......O..... + 0x80, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, // .@+.......Q..... + 0x00, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, // .?+...K...T..... + 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x54, 0x00, // ......U.......T. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x55, 0x00, // .. ...V.......U. + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..+...(...`..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x03, 0x00, // ..+...(...e..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ...x......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...x...y..... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...x...|..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x86, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x86, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;............. + 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. + 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..V...........=. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......#..."...=. + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, // ......&...%...P. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, // ......'...#...&. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..>... ...'...=. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......z...y...=. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......}...|...=. + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, // .......... ...Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xa4, 0x00, // ..Q............. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xa6, 0x00, // ......O......... + 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..}...}......... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0xd1, 0x00, // ......V...1..... + 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..........W..... + 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x03, 0x00, // ..........}..... + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0xa9, 0x00, // ................ + 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xab, 0x00, // ..O............. + 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x04, 0x00, 0x28, 0x00, // ......Q...n...(. + 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. + 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x2d, 0x00, // ..............-. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xaf, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x51, 0x00, // ..>...........Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xa1, 0x00, // ..A............. + 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xb1, 0x00, // ..)...>......... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0xd3, 0x00, // ..Q............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xb5, 0x00, // ......A......... + 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb5, 0x00, // ......`...>..... + 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb7, 0x00, // ......Q......... + 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, // ..........A..... + 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..........e...>. + 0x03, 0x00, 0xb8, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, // ..........A..... + 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x03, 0x00, // ..........z..... + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0xbf, 0x00, // ................ + 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc2, 0x00, // ......Q......... + 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..z.......Q..... + 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ......z.......Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x02, 0x00, // ..........z..... + 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xc2, 0x00, // ..P............. + 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0x87, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_font_basic_dx9[456] = { diff --git a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h index 5374f93ca71..87ac0af3a95 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field.bin.h @@ -65,310 +65,132 @@ static const uint8_t fs_font_distance_field_glsl[1019] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp 0x76, 0x61, 0x72, 0x5f, 0x39, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_9;.}... }; -static const uint8_t fs_font_distance_field_spv[4831] = +static const uint8_t fs_font_distance_field_spv[1974] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xd0, 0x12, 0x00, 0x00, 0x03, 0x02, // FSH............. - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........ob.... + 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xa4, 0x07, 0x00, 0x00, 0x03, 0x02, // FSH............. + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...t......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x00, 0xd5, 0x11, 0x00, 0x00, 0x62, 0x67, // in............bg - 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x28, 0x73, 0x74, // fxTextureCube(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x43, 0x75, 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x43, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, // Cube-p1-tC11;vf3 - 0x3b, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, // ;.....~..._sampl - 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, // er.m_sampler.... - 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ......_sampler.m - 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, // _texture........ - 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, // .._coord......5. - 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, // ..vec4_splat(f1; - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, // .........._x.... - 0x07, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, // ......@main(vf4; - 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6e, 0x62, // vf4;vf4;......nb + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, // in............Bg + 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, // fxSamplerCube... + 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, // ler............. + 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... + 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // .. ...s_texColor + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......"...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, // olorSampler..... + 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..%...s_texColor + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x91, 0x00, // Texture......... 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...A..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0......J..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x67, 0x09, // gData_0_......g. - 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, // ..BgfxSamplerCub - 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // e.....g.......m_ - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, // sampler.......g. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, // ..........flatte - 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, // nTemp.........s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. - 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ..........s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... - 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_sampler...... - 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..P...s_texColor - 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_texture...... - 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, // ......bgfx_VoidF - 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x70, 0x61, // rag........]..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, // ram...........co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x70, 0x61, // lor........9..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbf, 0x39, 0x00, 0x00, 0x70, 0x61, // ram........9..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, // ram........9..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x69, 0x6e, // ram.......M...in - 0x64, 0x65, 0x78, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x60, 0x10, 0x00, 0x00, 0x72, 0x67, // dex.......`...rg - 0x62, 0x61, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x81, 0x11, 0x00, 0x00, 0x64, 0x69, // ba............di - 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xcf, 0x16, 0x00, 0x00, 0x64, 0x78, // st............dx - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xd0, 0x16, 0x00, 0x00, 0x64, 0x79, 0x00, 0x00, 0x05, 0x00, // ..........dy.... - 0x03, 0x00, 0xc9, 0x10, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf3, 0x10, // ......w......... - 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, // ..alpha........+ - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..w...v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // .......<..v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, // oord0.....t...v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // texcoord0....... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......U..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......8..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x4d, 0x06, // gData_0_......M. - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x4d, 0x06, // ..$Global.....M. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......M.......u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x4d, 0x06, // viewTexel.....M. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..M.......u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x04, 0x00, // iew.......M..... - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x4d, 0x06, // ..u_proj......M. - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......M.......u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x4d, 0x06, // viewProj......M. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x08, 0x00, // roj.......M..... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x4d, 0x06, // ..u_model.....M. - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.....M.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..M.......u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, // aRef4.G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, // ......G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, // ......G...w..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, // ......G...t..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf0, 0x04, 0x00, 0x00, 0x06, 0x00, // ......G......... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x00, 0x00, // ..@...H...M..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, // ..#.......H...M. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..M...........H. - 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..M.......#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...M......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x03, 0x00, // ......H...M..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x03, 0x00, // ......H...M..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, // ..#...`...H...M. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..M...........H. - 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..M.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...M......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x05, 0x00, // ......H...M..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x05, 0x00, // ......H...M..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, // ..#.......H...M. - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..M...........H. - 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..M.......#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...M......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x07, 0x00, // ......H...M..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x07, 0x00, // ......H...M..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, // ..#...`...H...M. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..M...........H. - 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..M.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...M......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x09, 0x00, // ......H...M..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x09, 0x00, // ......H...M..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, // ..#.......H...M. - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..M...........H. - 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..M.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...M......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x0b, 0x00, // ......H...M..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x4d, 0x06, // ..#... ...G...M. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, // .. ...y......... - 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, // .......... ..... - 0x09, 0x00, 0x98, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, // .. ............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, // ..!...+.......y. - 0x00, 0x00, 0x15, 0x03, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, // ..........!..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x91, 0x00, // ..........!..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ - 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x67, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x98, 0x00, // ......g......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x67, 0x09, // .. ...!.......g. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, // .. ...z......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, // ..;...z......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, // ..;............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, // .. ...{......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, // ..;...{......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x98, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, // ..;.......P..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, // ..+............. - 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, // ................ - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x69, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x2b, 0x00, // ......i......@+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x2b, 0x00, // .............?+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ - 0x04, 0x00, 0xc9, 0x03, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0x0a, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x46, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc9, 0x03, 0x00, 0x00, 0x2b, 0x00, // ..F...........+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x20, 0x00, // .............A . - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, // ......w.......;. - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ......t....... . - 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, // ................ - 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..e...........+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, // ......j... ..... - 0x04, 0x00, 0xf0, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, // ......e...j..... - 0x0e, 0x00, 0x4d, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, // ..M...........e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xf0, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e.......e...e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, // ......6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, // ..............Sa - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, // ..;...!......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, // ..;........U.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, // ..;........8.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, // ..;............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, // ..=.......!C.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, // ..=........3.... - 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x67, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, // ..P...g...^ ..!C - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, // ...3..>.......^ - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, // ..A...y....V.... - 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, // ......=......... - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, // ...V..>......... - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x15, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, // ..A........@.... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xd3, 0x1e, // ......=......... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, // ...@..>...P..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, // ..=........+..w. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, // ..=........<..t. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, // ..>....U...+..>. - 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, // ...8...<..9..... - 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, // ...&.......U...8 - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, // ......=......... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, // ......>......... - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ......8...6..... - 0x00, 0x00, 0xd5, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x37, 0x00, // ..........+...7. - 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x15, 0x03, // ..y...~...7..... - 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xe7, 0x15, // ......7......... - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, // ..........=..... - 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, // ...H..~...V..... - 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, // ...>.......H..=. - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, // .......$......W. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, // .......Y...>...$ - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // .......Y..8...6. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, // ......5......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, // ..7............. - 0x02, 0x00, 0x2e, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, // ..._..=........[ - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, // ......=.......%S - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, // ......=........= - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, // ......=........= - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, // ......P.......V[ - 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, // ...[..%S...=...= - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x56, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // ......V[..8...6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, // ................ - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, // ..7.......nb..7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // .......A..7..... - 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, // ...J.......S..;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......]......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..y....9......;. - 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0xbf, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......9......;. - 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......9......;. - 0x04, 0x00, 0x46, 0x06, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..F...`.......>. - 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...]......9..... - 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, // ......5....]..=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, // ......#A......>. - 0x03, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, // ...9..#A..=..... - 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbf, 0x39, // ...,..P...>....9 - 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x19, 0x21, // ...,..=........! - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa0, 0x37, // ...A..O........7 - 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ...!...!........ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0xa0, 0x37, // ......>....9...7 - 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x00, 0x00, 0xd5, 0x11, // ..9............. - 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0xbf, 0x39, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x3e, 0x00, // ...9...9...9..>. - 0x03, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x18, 0x1e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ..........A..... - 0x00, 0x00, 0xe8, 0x3a, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...:...A......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb2, 0x3f, 0x00, 0x00, 0xe8, 0x3a, 0x00, 0x00, 0x85, 0x00, // .......?...:.... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd1, 0x46, 0x00, 0x00, 0xb2, 0x3f, 0x00, 0x00, 0x69, 0x0b, // .......F...?..i. - 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x58, 0x2d, 0x00, 0x00, 0xd1, 0x46, // ..........X-...F - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4d, 0x15, // ......n.......M. - 0x00, 0x00, 0x58, 0x2d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xfa, 0x4d, // ..X-..A........M - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... - 0x00, 0x00, 0x49, 0x37, 0x00, 0x00, 0xfa, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ..I7...M..A..... - 0x00, 0x00, 0x5c, 0x4f, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ...O..`.......>. - 0x03, 0x00, 0x5c, 0x4f, 0x00, 0x00, 0x49, 0x37, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ...O..I7..A..... - 0x00, 0x00, 0xd7, 0x35, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...5..........=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2e, 0x1e, 0x00, 0x00, 0xd7, 0x35, 0x00, 0x00, 0x41, 0x00, // ...........5..A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x5d, 0x4f, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x0e, 0x0a, // ......]O..`..... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5d, 0x4f, 0x00, 0x00, 0x2e, 0x1e, 0x00, 0x00, 0x41, 0x00, // ..>...]O......A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xd8, 0x35, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x0a, 0x0a, // .......5........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x1e, 0x00, 0x00, 0xd8, 0x35, // ..=......./....5 - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x5e, 0x4f, 0x00, 0x00, 0x60, 0x10, // ..A.......^O..`. - 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5e, 0x4f, 0x00, 0x00, 0x2f, 0x1e, // ......>...^O../. - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xd9, 0x35, 0x00, 0x00, 0x18, 0x0e, // ..A........5.... - 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x30, 0x1e, // ......=.......0. - 0x00, 0x00, 0xd9, 0x35, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x5f, 0x4f, // ...5..A......._O - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x4f, // ..`.......>..._O - 0x00, 0x00, 0x30, 0x1e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x8b, 0x35, // ..0...A........5 - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..`...M...=..... - 0x00, 0x00, 0x81, 0x11, 0x00, 0x00, 0x8b, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // .......5..=..... - 0x00, 0x00, 0x6f, 0x39, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, // ..o9...A..O..... - 0x00, 0x00, 0x83, 0x26, 0x00, 0x00, 0x6f, 0x39, 0x00, 0x00, 0x6f, 0x39, 0x00, 0x00, 0x00, 0x00, // ...&..o9..o9.... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xcf, 0x00, 0x04, 0x00, 0x18, 0x00, // ................ - 0x00, 0x00, 0x2b, 0x2c, 0x00, 0x00, 0x83, 0x26, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, // ..+,...&........ - 0x00, 0x00, 0xcf, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x2b, 0x2c, // ..........B...+, - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x59, 0x41, 0x00, 0x00, 0x8f, 0x41, // ..=.......YA...A - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0f, 0x27, 0x00, 0x00, 0x59, 0x41, // ..O........'..YA - 0x00, 0x00, 0x59, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ..YA............ - 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x70, 0x47, 0x00, 0x00, 0x0f, 0x27, // ..........pG...' - 0x00, 0x00, 0xd0, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd1, 0x47, 0x00, 0x00, 0x70, 0x47, // ...........G..pG - 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd0, 0x16, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0xd1, 0x47, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..B....G........ - 0x00, 0x00, 0x4f, 0x4e, 0x00, 0x00, 0xcf, 0x16, 0x00, 0x00, 0xd0, 0x16, 0x00, 0x00, 0x85, 0x00, // ..ON............ - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc9, 0x10, 0x00, 0x00, 0xf7, 0x0a, 0x00, 0x00, 0x4f, 0x4e, // ..............ON - 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xeb, 0x4c, 0x00, 0x00, 0xfc, 0x00, // ...........L.... - 0x00, 0x00, 0xc9, 0x10, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x33, 0x28, // ..............3( - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xc9, 0x10, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xeb, 0x4c, // ..........1....L - 0x00, 0x00, 0x33, 0x28, 0x00, 0x00, 0x81, 0x11, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..3(......=..... - 0x00, 0x00, 0x34, 0x3a, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, // ..4:..nb..O..... - 0x00, 0x00, 0x5f, 0x52, 0x00, 0x00, 0x34, 0x3a, 0x00, 0x00, 0x34, 0x3a, 0x00, 0x00, 0x00, 0x00, // .._R..4:..4:.... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ..........A..... - 0x00, 0x00, 0x94, 0x1c, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ......nb......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa2, 0x32, 0x00, 0x00, 0x94, 0x1c, 0x00, 0x00, 0x85, 0x00, // .......2........ - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x9b, 0x1a, 0x00, 0x00, 0xa2, 0x32, 0x00, 0x00, 0xf3, 0x10, // ...........2.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe6, 0x25, 0x00, 0x00, 0x5f, 0x52, // ..Q........%.._R - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa4, 0x2b, // ......Q........+ - 0x00, 0x00, 0x5f, 0x52, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // .._R......Q..... - 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0x5f, 0x52, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, // ...O.._R......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xe6, 0x25, 0x00, 0x00, 0xa4, 0x2b, // .......?...%...+ - 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0x9b, 0x1a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x4a, // ...O......>....J - 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ...?......8.... + 0x05, 0x00, 0x94, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ......v_texcoord + 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, // 0.........bgfx_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ragData0..G...%. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ..".......G...%. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x91, 0x00, // ..!.......G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, 0x00, // ..........G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9f, 0x00, // ..........G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x00, // ...... ......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ......... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, // ......;....... . + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ...!..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, // ......;...!...". + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ...$..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......;...$...%. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........(... . + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, // ......+...(...). + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2d, 0x00, // ......+...(...-. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, // ..........1..... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // ......K... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+.......O..... + 0x80, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, // .@+.......Q..... + 0x00, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, // .?+...K...T..... + 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x54, 0x00, // ......U.......T. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x55, 0x00, // .. ...V.......U. + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..+...(...`..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x03, 0x00, // ..+...(...e..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+.......y..... + 0x00, 0x41, 0x20, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // .A ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;............. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;............. + 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. + 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..V...........=. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......#..."...=. + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, // ......&...%...P. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, // ......'...#...&. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..>... ...'...=. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, // .......... ...Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0xc0, 0x00, // ..Q............. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xc2, 0x00, // ......O......... + 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x01, // ......V...1..... + 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..........W..... + 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xc5, 0x00, // ................ + 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc7, 0x00, // ..O............. + 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x04, 0x00, 0x28, 0x00, // ......Q...n...(. + 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. + 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x2d, 0x00, // ..............-. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0x51, 0x00, // ..>...........Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xcd, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xce, 0x00, 0x00, 0x00, 0xb9, 0x00, // ..A............. + 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xce, 0x00, 0x00, 0x00, 0xcd, 0x00, // ..)...>......... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x02, 0x01, // ..Q............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd1, 0x00, // ......A......... + 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x00, // ......`...>..... + 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd3, 0x00, // ......Q......... + 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, // ..........A..... + 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..........e...>. + 0x03, 0x00, 0xd4, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x00, // ..........A..... + 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x4f, 0x00, // ..............O. + 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x95, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xcf, 0x00, // ................ + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x0c, 0x00, // ................ + 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, // ..............B. + 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdd, 0x00, // ......O......... + 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xde, 0x00, // ................ + 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdf, 0x00, // ................ + 0x00, 0x00, 0xde, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x81, 0x00, // ......B......... + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xe0, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x79, 0x00, // ..............y. + 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe6, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, // ..Q............. + 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0x0c, 0x00, // ......Q......... + 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, // ..............1. + 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xee, 0x00, // ................ + 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0x00, // ......Q......... + 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xf1, 0x00, // ..P............. + 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_font_distance_field_dx9[748] = { diff --git a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h index 71498dd52ee..97029e0735b 100644 --- a/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h +++ b/3rdparty/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h @@ -81,320 +81,135 @@ static const uint8_t fs_font_distance_field_subpixel_glsl[1268] = 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2e, 0x77, 0x29, 0x3b, 0x0a, // * v_color0.w);. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t fs_font_distance_field_subpixel_spv[4987] = +static const uint8_t fs_font_distance_field_subpixel_spv[2022] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x6c, 0x13, 0x00, 0x00, 0x03, 0x02, // FSH.......l..... - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........ob.... + 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xd4, 0x07, 0x00, 0x00, 0x03, 0x02, // FSH............. + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, // #.........?..... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...t......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0f, 0x00, 0xd5, 0x11, 0x00, 0x00, 0x62, 0x67, // in............bg - 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x28, 0x73, 0x74, // fxTextureCube(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x43, 0x75, 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x43, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, // Cube-p1-tC11;vf3 - 0x3b, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, // ;.....~..._sampl - 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, // er.m_sampler.... - 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ......_sampler.m - 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, // _texture........ - 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, // .._coord......5. - 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, // ..vec4_splat(f1; - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, // .........._x.... - 0x07, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, // ......@main(vf4; - 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6e, 0x62, // vf4;vf4;......nb + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, // in............Bg + 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, // fxSamplerCube... + 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, // ler............. + 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... + 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // .. ...s_texColor + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......"...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, // olorSampler..... + 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..%...s_texColor + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa0, 0x00, // Texture......... 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...A..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0......J..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x67, 0x09, // gData_0_......g. - 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, // ..BgfxSamplerCub - 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // e.....g.......m_ - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, // sampler.......g. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, // ..........flatte - 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, // nTemp.........s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. - 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ..........s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... - 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_sampler...... - 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..P...s_texColor - 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_texture...... - 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, // ......bgfx_VoidF - 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x70, 0x61, // rag........]..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x69, 0x6e, // ram.......M...in - 0x64, 0x65, 0x78, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x57, 0x17, 0x00, 0x00, 0x64, 0x78, // dex.......W...dx - 0x33, 0x00, 0x05, 0x00, 0x03, 0x00, 0x85, 0x0f, 0x00, 0x00, 0x64, 0x79, 0x33, 0x00, 0x05, 0x00, // 3.........dy3... - 0x04, 0x00, 0xc2, 0x0c, 0x00, 0x00, 0x64, 0x65, 0x63, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x05, 0x00, // ......decal..... - 0x05, 0x00, 0xd7, 0x12, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x4c, 0x65, 0x66, 0x74, // ......sampleLeft - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x07, 0x0f, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ..........sample - 0x52, 0x69, 0x67, 0x68, 0x74, 0x00, 0x05, 0x00, 0x05, 0x00, 0x1f, 0x14, 0x00, 0x00, 0x6c, 0x65, // Right.........le - 0x66, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x56, // ft_dist........V - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbe, 0x39, // ..param........9 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbf, 0x39, // ..param........9 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2a, 0x0f, // ..param.......*. - 0x00, 0x00, 0x72, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x64, 0x69, 0x73, 0x74, 0x00, 0x00, 0x05, 0x00, // ..right_dist.... - 0x04, 0x00, 0xc0, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...9..param..... - 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...9..param..... - 0x04, 0x00, 0x91, 0x37, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...7..param..... - 0x04, 0x00, 0x81, 0x11, 0x00, 0x00, 0x64, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ......dist...... - 0x03, 0x00, 0xcf, 0x16, 0x00, 0x00, 0x64, 0x78, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xd0, 0x16, // ......dx........ - 0x00, 0x00, 0x64, 0x79, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc9, 0x10, 0x00, 0x00, 0x77, 0x00, // ..dy..........w. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4a, 0x0d, 0x00, 0x00, 0x73, 0x75, 0x62, 0x5f, 0x63, 0x6f, // ......J...sub_co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, // lor........+..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, // color0........w. - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...<..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 0.....t...v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, // oord0.........gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...U..param..... - 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...8..param..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x40, 0x09, 0x00, 0x00, 0x24, 0x47, // a_0_......@...$G - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x40, 0x09, 0x00, 0x00, 0x00, 0x00, // lobal.....@..... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, // ..u_viewRect.... - 0x06, 0x00, 0x40, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..@.......u_view - 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x02, 0x00, // Texel.....@..... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x40, 0x09, // ..u_view......@. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, // ......u_invView. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ - 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x40, 0x09, 0x00, 0x00, 0x05, 0x00, // proj......@..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invProj..... - 0x06, 0x00, 0x40, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..@.......u_view - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x40, 0x09, 0x00, 0x00, 0x07, 0x00, // Proj......@..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ..u_invViewProj. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x40, 0x09, 0x00, 0x00, 0x09, 0x00, // model.....@..... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, // ..u_modelView... - 0x07, 0x00, 0x40, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..@.......u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x40, 0x09, // lViewProj.....@. - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // ......u_alphaRef - 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // 4.G......."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G.......!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G......."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G.......!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...w......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, // ..G...t......... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G............. - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1d, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...........@. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...@.......#. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x01, 0x00, // ......H...@..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, // ..#.......H...@. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..@............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...@......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...@.......#. - 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x03, 0x00, // ..`...H...@..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..@............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...@......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...@.......#. - 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x05, 0x00, // ......H...@..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..@............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...@......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...@.......#. - 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x07, 0x00, // ..`...H...@..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..@............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...@......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...@.......#. - 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x09, 0x00, // ......H...@..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, // ..........H...@. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..@............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x40, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...@.......#. - 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x40, 0x09, 0x00, 0x00, 0x02, 0x00, // .. ...G...@..... - 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, // ..........!..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, // ..y............. - 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x98, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x06, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x15, 0x03, // ..+.......y..... - 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x91, 0x00, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, // ................ - 0x04, 0x00, 0x67, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x20, 0x00, // ..g........... . - 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x67, 0x09, 0x00, 0x00, 0x20, 0x00, // ..!.......g... . - 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, // ..z...........;. - 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // ..z........... . - 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, // ..{...........;. - 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, // ..{............. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, // ......P.......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, // ................ - 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .. .......+..... - 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x69, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..i......@+..... - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // .........?+..... - 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0xc1, 0xaa, 0x2a, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ........*>+..... - 0x00, 0x00, 0xf7, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // .........A ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..w.......;..... - 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..t....... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // ..........+..... - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x1d, 0x0b, // ..j... ......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x40, 0x09, // ..e...j.......@. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..........e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x1d, 0x0b, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......e...e..... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..!...........;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......U......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......8......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, // ......!C......=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......3......P. - 0x05, 0x00, 0x67, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, // ..g...^ ..!C...3 - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, // ..>.......^ ..A. - 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, // ..y....V........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, // ..=............V - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, // ..>...........A. - 0x05, 0x00, 0x15, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, // .......@........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, // ..=............@ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, // ..>...P.......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......+..w...=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, // .......<..t...>. - 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, // ...U...+..>....8 - 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, // ...<..9........& - 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, // .......U...8.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd5, 0x11, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, // ......+...7...y. - 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x15, 0x03, 0x00, 0x00, 0xf7, 0x0d, // ..~...7......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, // ..7............. - 0x02, 0x00, 0xca, 0x1c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xc6, 0x19, // ......=......... - 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, // ......=........H - 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, // ..~...V........> - 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // .......H..=..... - 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...$......W..... - 0x00, 0x00, 0x82, 0x59, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, // ...Y...>...$.... - 0x02, 0x00, 0x82, 0x59, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...Y..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2e, 0x5f, // ..............._ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0xdd, 0x0e, // ..=........[.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xdd, 0x0e, // ..=.......%S.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xdd, 0x0e, // ..=........=.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xdd, 0x0e, // ..=........=.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, 0x00, 0x00, 0xe0, 0x5b, // ..P.......V[...[ - 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xfe, 0x00, // ..%S...=...=.... - 0x02, 0x00, 0x56, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ..V[..8...6..... - 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x37, 0x00, // ..............7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......nb..7..... - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x4a, // ...A..7........J - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......S..;..... - 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, // ...]......;...y. - 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, // ...V......;..... - 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, // ...9......;..... - 0x00, 0x00, 0xbf, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, // ...9......;...y. - 0x00, 0x00, 0xc0, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, // ...9......;..... - 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, // ...9......;..... - 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, // ...7......>....] - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ..5....]..A..... - 0x00, 0x00, 0x22, 0x5c, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, // .."....A......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8e, 0x3c, 0x00, 0x00, 0x22, 0x5c, 0x00, 0x00, 0x85, 0x00, // .......<.."..... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd1, 0x46, 0x00, 0x00, 0x8e, 0x3c, 0x00, 0x00, 0x69, 0x0b, // .......F...<..i. - 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x2d, 0x00, 0x00, 0xd1, 0x46, // ...........-...F - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4d, 0x15, // ......n.......M. - 0x00, 0x00, 0x0c, 0x2d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x60, 0x37, // ...-..=.......`7 - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x89, 0x39, // ...A..O........9 - 0x00, 0x00, 0x60, 0x37, 0x00, 0x00, 0x60, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..`7..`7........ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xcf, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x57, 0x17, // ..............W. - 0x00, 0x00, 0x89, 0x39, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x40, // ...9..=.......y@ - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x7d, 0x27, // ...A..O.......}' - 0x00, 0x00, 0x79, 0x40, 0x00, 0x00, 0x79, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..y@..y@........ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd4, 0x50, // ...............P - 0x00, 0x00, 0x7d, 0x27, 0x00, 0x00, 0xd0, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x85, 0x0f, // ..}'............ - 0x00, 0x00, 0xd4, 0x50, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0xc2, 0x0c, // ...P............ - 0x00, 0x00, 0x57, 0x17, 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..W.......=..... - 0x00, 0x00, 0xc1, 0x32, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, // ...2...A..O..... - 0x00, 0x00, 0x8b, 0x3b, 0x00, 0x00, 0xc1, 0x32, 0x00, 0x00, 0xc1, 0x32, 0x00, 0x00, 0x00, 0x00, // ...;...2...2.... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x18, 0x00, // ................ - 0x00, 0x00, 0xd7, 0x12, 0x00, 0x00, 0x8b, 0x3b, 0x00, 0x00, 0xc2, 0x0c, 0x00, 0x00, 0x3d, 0x00, // .......;......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2d, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, // .......-...A..O. - 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x13, 0x40, 0x00, 0x00, 0xdb, 0x2d, 0x00, 0x00, 0xdb, 0x2d, // .......@...-...- + 0x05, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ......v_texcoord + 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xae, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, // 0.........bgfx_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ragData0..G...%. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ..".......G...%. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa0, 0x00, // ..!.......G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa3, 0x00, // ..........G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xae, 0x00, // ..........G..... + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ......... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, // ......;....... . + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ...!..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, // ......;...!...". + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ...$..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......;...$...%. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........(... . + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, // ..........1..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+.......H..... + 0x80, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, // .@+.......J..... + 0x00, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0xc1, 0xaa, // .?+.......W..... + 0x2a, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, // *>+............. + 0x00, 0x41, 0x20, 0x00, 0x04, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // .A ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;............. + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xad, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xad, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;............. + 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x36, 0x00, // ..........>...6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, // ..........=..... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..#..."...=..... + 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, // ..&...%...P..... + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..'...#...&...>. + 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // .. ...'...=..... + 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... + 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. + 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xd8, 0x00, // ................ + 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0xda, 0x00, // ..J...n...(..... + 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdc, 0x00, // ......O......... + 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xcf, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdd, 0x00, // ................ + 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdf, 0x00, // ......O......... + 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe0, 0x00, // ................ + 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe1, 0x00, // ................ + 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe3, 0x00, // ................ + 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, // ......W...O..... + 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, // ................ + 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x4f, 0x00, // ..............O. + 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa4, 0x00, // ................ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x81, 0x00, // ................ - 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x07, 0x0f, 0x00, 0x00, 0x13, 0x40, 0x00, 0x00, 0xc2, 0x0c, // ...........@.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3e, 0x36, 0x00, 0x00, 0x14, 0x11, // ..=.......>6.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x3e, 0x36, 0x00, 0x00, 0x3d, 0x00, // ..>....V..>6..=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x96, 0x2c, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, // .......,..P...>. - 0x03, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x96, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbf, 0x39, // ...9...,..>....9 - 0x00, 0x00, 0xd7, 0x12, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x45, 0x4e, // ......9.......EN - 0x00, 0x00, 0xd5, 0x11, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0xbf, 0x39, // .......V...9...9 - 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe6, 0x4a, 0x00, 0x00, 0x45, 0x4e, // ..O........J..EN - 0x00, 0x00, 0x45, 0x4e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ..EN............ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1f, 0x14, // ......M......... - 0x00, 0x00, 0xe6, 0x4a, 0x00, 0x00, 0x4d, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ...J..M...=..... - 0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc0, 0x39, // ...#......>....9 - 0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x97, 0x2c, // ...#..=........, - 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x97, 0x2c, // ..P...>....9..., - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x91, 0x37, 0x00, 0x00, 0x07, 0x0f, 0x00, 0x00, 0x39, 0x00, // ..>....7......9. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x46, 0x4e, 0x00, 0x00, 0xd5, 0x11, 0x00, 0x00, 0xc0, 0x39, // ......FN.......9 - 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, // ...9...7..O..... - 0x00, 0x00, 0xf2, 0x4f, 0x00, 0x00, 0x46, 0x4e, 0x00, 0x00, 0x46, 0x4e, 0x00, 0x00, 0x02, 0x00, // ...O..FN..FN.... + 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe3, 0x00, // ................ + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x20, 0x00, // ..=........... . + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x32, 0x01, 0x00, 0x00, 0xec, 0x00, // ..Q.......2..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x33, 0x01, // ......Q.......3. + 0x00, 0x00, 0xec, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, // ..........V...1. + 0x00, 0x00, 0x25, 0x01, 0x00, 0x00, 0x33, 0x01, 0x00, 0x00, 0x32, 0x01, 0x00, 0x00, 0x57, 0x00, // ..%...3...2...W. + 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x25, 0x01, 0x00, 0x00, 0xe7, 0x00, // ......'...%..... + 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x27, 0x01, // ..O...........'. + 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ..'............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0x00, // ......M......... + 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xda, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, // ..........=..... + 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ...... ...Q..... + 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..6...........Q. + 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x37, 0x01, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x01, 0x00, // ......7......... + 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x37, 0x01, // ..V...1...-...7. + 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x01, // ..6...W......./. + 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, // ..-.......O..... + 0x00, 0x00, 0xf6, 0x00, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00, 0x02, 0x00, // ....../.../..... 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4d, 0x00, // ..............M. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2a, 0x0f, 0x00, 0x00, 0xf2, 0x4f, 0x00, 0x00, 0x4d, 0x15, // ......*....O..M. - 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8b, 0x5b, 0x00, 0x00, 0x1f, 0x14, // ...........[.... - 0x00, 0x00, 0x2a, 0x0f, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x81, 0x11, // ..*............. - 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x8b, 0x5b, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, // .......[........ - 0x00, 0x00, 0xcf, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x57, 0x17, // ..........B...W. - 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd0, 0x16, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x85, 0x0f, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..B............. - 0x00, 0x00, 0x57, 0x57, 0x00, 0x00, 0xcf, 0x16, 0x00, 0x00, 0xd0, 0x16, 0x00, 0x00, 0x85, 0x00, // ..WW............ - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc9, 0x10, 0x00, 0x00, 0xf7, 0x0a, 0x00, 0x00, 0x57, 0x57, // ..............WW - 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x2c, 0x00, 0x00, 0xfc, 0x00, // ...........,.... - 0x00, 0x00, 0xc9, 0x10, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x9b, 0x59, // ......P........Y - 0x00, 0x00, 0x07, 0x2c, 0x00, 0x00, 0x07, 0x2c, 0x00, 0x00, 0x07, 0x2c, 0x00, 0x00, 0x81, 0x00, // ...,...,...,.... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x38, 0x43, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xc9, 0x10, // ......8C........ - 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x90, 0x5b, 0x00, 0x00, 0x38, 0x43, // ..P........[..8C - 0x00, 0x00, 0x38, 0x43, 0x00, 0x00, 0x38, 0x43, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, // ..8C..8C..P..... - 0x00, 0x00, 0xf6, 0x55, 0x00, 0x00, 0x1f, 0x14, 0x00, 0x00, 0x81, 0x11, 0x00, 0x00, 0x2a, 0x0f, // ...U..........*. - 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x4a, 0x0d, 0x00, 0x00, 0x01, 0x00, // ..........J..... - 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x9b, 0x59, 0x00, 0x00, 0x90, 0x5b, 0x00, 0x00, 0xf6, 0x55, // ..1....Y...[...U - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6a, 0x51, 0x00, 0x00, 0x6e, 0x62, // ..A.......jQ..nb - 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd2, 0x37, // ......=........7 - 0x00, 0x00, 0x6a, 0x51, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0xec, 0x31, // ..jQ...........1 - 0x00, 0x00, 0x4a, 0x0d, 0x00, 0x00, 0xd2, 0x37, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..J....7..=..... - 0x00, 0x00, 0x3f, 0x61, 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, // ..?a...J..O..... - 0x00, 0x00, 0xf9, 0x1f, 0x00, 0x00, 0x3f, 0x61, 0x00, 0x00, 0xec, 0x31, 0x00, 0x00, 0x04, 0x00, // ......?a...1.... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf9, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ...J......A..... - 0x00, 0x00, 0xc5, 0x4d, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...M..nb......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf2, 0x3a, 0x00, 0x00, 0xc5, 0x4d, 0x00, 0x00, 0x85, 0x00, // .......:...M.... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x24, 0x00, 0x00, 0x81, 0x11, 0x00, 0x00, 0xf2, 0x3a, // .......$.......: - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x8c, 0x4a, // ..A........6...J - 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x36, 0x00, 0x00, 0x02, 0x24, // ......>....6...$ - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ......8.... + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x00, 0x00, 0xda, 0x00, // ................ + 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0xf1, 0x00, // ................ + 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfb, 0x00, // ................ + 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, // ..J............. + 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0xdd, 0x00, // ..........B..... + 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, // ..B............. + 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, 0x01, // ................ + 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x4a, 0x00, // ..............J. + 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x01, // ......P......... + 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x81, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x03, 0x01, // ..........J..... + 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x08, 0x01, // ..P............. + 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, // ..........P..... + 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xf7, 0x00, // ................ + 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x0d, 0x01, // ..1............. + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0xa1, 0x00, // ..Q............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x12, 0x01, // ................ + 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, // ..........O..... + 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x12, 0x01, 0x00, 0x00, 0x04, 0x00, // ......>......... + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0xfb, 0x00, // ................ + 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3c, 0x01, // ......R.......<. + 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0xae, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ......<.......8. + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_font_distance_field_subpixel_dx9[896] = { diff --git a/3rdparty/bgfx/examples/common/font/makefile b/3rdparty/bgfx/examples/common/font/makefile index 928467df33c..9dd5826c317 100644 --- a/3rdparty/bgfx/examples/common/font/makefile +++ b/3rdparty/bgfx/examples/common/font/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp index b442a811b67..c231a87c507 100644 --- a/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp +++ b/3rdparty/bgfx/examples/common/font/text_buffer_manager.cpp @@ -700,7 +700,7 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId case FONT_TYPE_ALPHA: program = m_basicProgram; bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) ); break; @@ -708,7 +708,7 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId case FONT_TYPE_DISTANCE: program = m_distanceProgram; bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) ); break; @@ -716,7 +716,7 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId case FONT_TYPE_DISTANCE_SUBPIXEL: program = m_distanceSubpixelProgram; bgfx::setState(0 - | BGFX_STATE_RGB_WRITE + | BGFX_STATE_WRITE_RGB | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_INV_SRC_COLOR) , bc.textBuffer->getTextColor() ); @@ -779,15 +779,17 @@ void TextBufferManager::submitTextBuffer(TextBufferHandle _handle, bgfx::ViewId ibh.idx = bc.indexBufferHandleIdx; vbh.idx = bc.vertexBufferHandleIdx; - bgfx::updateDynamicIndexBuffer(ibh - , 0 - , bgfx::copy(bc.textBuffer->getIndexBuffer(), indexSize) - ); + bgfx::update( + ibh + , 0 + , bgfx::copy(bc.textBuffer->getIndexBuffer(), indexSize) + ); - bgfx::updateDynamicVertexBuffer(vbh - , 0 - , bgfx::copy(bc.textBuffer->getVertexBuffer(), vertexSize) - ); + bgfx::update( + vbh + , 0 + , bgfx::copy(bc.textBuffer->getVertexBuffer(), vertexSize) + ); } bgfx::setVertexBuffer(0, vbh, 0, bc.textBuffer->getVertexCount() ); diff --git a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h index 8ed838e51d1..083c2f1a82a 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_basic.bin.h @@ -28,204 +28,86 @@ static const uint8_t vs_font_basic_glsl[431] = 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 = 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_font_basic_spv[3133] = +static const uint8_t vs_font_basic_spv[1246] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x18, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ......#......... - 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 6b.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xb0, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // main....;...?... + 0x42, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // B...M...P...S... 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x8c, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....Output...... - 0x8c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // ........gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion............. - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x8c, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ........v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0x16, 0x0e, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, // n(vf4;vf2;vf4;.. - 0x05, 0x00, 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ....O...a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........:...a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, // sition.......M.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xbc, 0x01, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo - 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4e, 0x03, 0x00, 0x00, // oord0...G...N... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ....@...H....... - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xbc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xbc, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, // ................ - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x71, 0x09, 0x00, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, // q............... - 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x8c, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,.......z....... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // N...e...j....... - 0xbc, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...N...e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x39, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...9....... - 0xbc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x39, 0x04, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ....;...9...B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // e... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, // ....;.......v... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, // .8...?..>....... - 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // @,..9.......I&.. - 0x16, 0x0e, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .....U...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =....... ....@.. - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v... ...A... - 0x9a, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x16, 0x0e, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0x71, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ....q...7....... - 0x4f, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, // O...7.......:... - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........M...... - 0x5f, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // _W..;........... - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, // ....A.......d-.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, // ........>...d-.. - 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, // ....A........8.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, // ........>....8.. - 0x7a, 0x0b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, // z...=.......5b.. - 0x3a, 0x19, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x28, 0x3a, 0x00, 0x00, // :...Q.......(:.. - 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // 5b......Q....... - 0x9b, 0x46, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // .F..5b......P... - 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0x28, 0x3a, 0x00, 0x00, 0x9b, 0x46, 0x00, 0x00, // .....2..(:...F.. - 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, // ........A....... - 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ),..B...)...=... - 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // e....<..),...... - 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, // .....;...2...<.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A......._8...... - 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, // ....>..._8...;.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, // =........!...M.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A.......-<...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, // ....>...-<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, // =........!..O... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........<...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, // ....>....<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // =.......G:...... - 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ....G:..8.... + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0x23, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, // #...$Global..... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // #.......u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, 0x00, // iewProj.....%... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ........;...a_co + 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3f, 0x00, 0x00, 0x00, // lor0........?... + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0x42, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // B...a_texcoord0. + 0x05, 0x00, 0x0a, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....M...@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // intOutput.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x50, 0x00, 0x00, 0x00, // ition.......P... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // t.v_color0...... + 0x53, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // S...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...#....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...#....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, // #.......H...#... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // #.......G...%... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // ".......G...;... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........G...?... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, // ........G...B... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // ........G...M... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, // ........G...P... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x53, 0x00, 0x00, 0x00, // ........G...S... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......+....... + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......?+....... + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ........+....... + 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, // ............"... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, // ............#... + 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // "... ...$....... + 0x23, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // #...;...$...%... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...&....... + 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // "... ...:....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // ....;...:...;... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...>....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ....;...>...?... + 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // ....;...:...B... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...L....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, // ....;...L...M... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ....;...L...P... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // ....;...L...S... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // =.......<...;... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // =.......@...?... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // =.......C...B... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // Q.......k...@... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, // ....Q.......l... + 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // @.......P....... + 0x6d, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, // m...k...l....... + 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, // ....A...&...n... + 0x25, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, // %.......=..."... + 0x6f, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // o...n........... + 0x70, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // p...m...o...Q... + 0x06, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....w...p....... + 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ........x...w... + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, // R...........x... + 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x00, 0x00, 0x00, // p.......>...M... + 0x96, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....>...P...<... + 0x3e, 0x00, 0x03, 0x00, 0x53, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >...S...C....... + 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // 8...........@. }; static const uint8_t vs_font_basic_dx9[329] = { diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h index 3bb4f2222f3..7cb91536ad6 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field.bin.h @@ -28,204 +28,86 @@ static const uint8_t vs_font_distance_field_glsl[431] = 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 = 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_font_distance_field_spv[3133] = +static const uint8_t vs_font_distance_field_spv[1246] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x18, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ......#......... - 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 6b.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xb0, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // main....;...?... + 0x42, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // B...M...P...S... 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x8c, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....Output...... - 0x8c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // ........gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion............. - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x8c, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ........v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0x16, 0x0e, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, // n(vf4;vf2;vf4;.. - 0x05, 0x00, 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ....O...a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........:...a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, // sition.......M.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xbc, 0x01, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo - 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4e, 0x03, 0x00, 0x00, // oord0...G...N... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ....@...H....... - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xbc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xbc, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, // ................ - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x71, 0x09, 0x00, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, // q............... - 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x8c, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,.......z....... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // N...e...j....... - 0xbc, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...N...e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x39, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...9....... - 0xbc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x39, 0x04, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ....;...9...B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // e... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, // ....;.......v... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, // .8...?..>....... - 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // @,..9.......I&.. - 0x16, 0x0e, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .....U...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =....... ....@.. - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v... ...A... - 0x9a, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x16, 0x0e, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0x71, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ....q...7....... - 0x4f, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, // O...7.......:... - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........M...... - 0x5f, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // _W..;........... - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, // ....A.......d-.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, // ........>...d-.. - 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, // ....A........8.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, // ........>....8.. - 0x7a, 0x0b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, // z...=.......5b.. - 0x3a, 0x19, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x28, 0x3a, 0x00, 0x00, // :...Q.......(:.. - 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // 5b......Q....... - 0x9b, 0x46, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // .F..5b......P... - 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0x28, 0x3a, 0x00, 0x00, 0x9b, 0x46, 0x00, 0x00, // .....2..(:...F.. - 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, // ........A....... - 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ),..B...)...=... - 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // e....<..),...... - 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, // .....;...2...<.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A......._8...... - 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, // ....>..._8...;.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, // =........!...M.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A.......-<...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, // ....>...-<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, // =........!..O... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........<...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, // ....>....<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // =.......G:...... - 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ....G:..8.... + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0x23, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, // #...$Global..... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // #.......u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, 0x00, // iewProj.....%... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ........;...a_co + 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3f, 0x00, 0x00, 0x00, // lor0........?... + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0x42, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // B...a_texcoord0. + 0x05, 0x00, 0x0a, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....M...@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // intOutput.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x50, 0x00, 0x00, 0x00, // ition.......P... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // t.v_color0...... + 0x53, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // S...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...#....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...#....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, // #.......H...#... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // #.......G...%... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // ".......G...;... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........G...?... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, // ........G...B... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // ........G...M... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, // ........G...P... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x53, 0x00, 0x00, 0x00, // ........G...S... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......+....... + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......?+....... + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ........+....... + 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, // ............"... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, // ............#... + 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // "... ...$....... + 0x23, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // #...;...$...%... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...&....... + 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // "... ...:....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // ....;...:...;... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...>....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ....;...>...?... + 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // ....;...:...B... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...L....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, // ....;...L...M... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ....;...L...P... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // ....;...L...S... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // =.......<...;... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // =.......@...?... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // =.......C...B... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // Q.......k...@... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, // ....Q.......l... + 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // @.......P....... + 0x6d, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, // m...k...l....... + 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, // ....A...&...n... + 0x25, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, // %.......=..."... + 0x6f, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // o...n........... + 0x70, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // p...m...o...Q... + 0x06, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....w...p....... + 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ........x...w... + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, // R...........x... + 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x00, 0x00, 0x00, // p.......>...M... + 0x96, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....>...P...<... + 0x3e, 0x00, 0x03, 0x00, 0x53, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >...S...C....... + 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // 8...........@. }; static const uint8_t vs_font_distance_field_dx9[329] = { diff --git a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h index c70632b4501..0d0ce67d86d 100644 --- a/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h +++ b/3rdparty/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h @@ -28,204 +28,86 @@ static const uint8_t vs_font_distance_field_subpixel_glsl[431] = 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // d0;. v_color0 = 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_font_distance_field_subpixel_spv[3133] = +static const uint8_t vs_font_distance_field_subpixel_spv[1246] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x18, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ......#......... - 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 6b.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xb0, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // main....;...?... + 0x42, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // B...M...P...S... 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x8c, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....Output...... - 0x8c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // ........gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion............. - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x8c, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ........v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0x16, 0x0e, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, // n(vf4;vf2;vf4;.. - 0x05, 0x00, 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ....O...a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........:...a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, // sition.......M.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xbc, 0x01, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo - 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4e, 0x03, 0x00, 0x00, // oord0...G...N... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ....@...H....... - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xbc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xbc, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xbc, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xbc, 0x01, 0x00, 0x00, // ........H....... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0xbc, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, // ................ - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x71, 0x09, 0x00, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, // q............... - 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x8c, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,.......z....... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // N...e...j....... - 0xbc, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...N...e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x39, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...9....... - 0xbc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x39, 0x04, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ....;...9...B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // e... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, // ....;.......v... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, // .8...?..>....... - 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // @,..9.......I&.. - 0x16, 0x0e, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .....U...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =....... ....@.. - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v... ...A... - 0x9a, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x16, 0x0e, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0x71, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ....q...7....... - 0x4f, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, // O...7.......:... - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........M...... - 0x5f, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // _W..;........... - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, // ....A.......d-.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, // ........>...d-.. - 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, // ....A........8.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, // ........>....8.. - 0x7a, 0x0b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, // z...=.......5b.. - 0x3a, 0x19, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x28, 0x3a, 0x00, 0x00, // :...Q.......(:.. - 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // 5b......Q....... - 0x9b, 0x46, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // .F..5b......P... - 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0x28, 0x3a, 0x00, 0x00, 0x9b, 0x46, 0x00, 0x00, // .....2..(:...F.. - 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, // ........A....... - 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ),..B...)...=... - 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // e....<..),...... - 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, // .....;...2...<.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A......._8...... - 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, // ....>..._8...;.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, // =........!...M.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A.......-<...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, // ....>...-<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, // =........!..O... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........<...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, // ....>....<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // =.......G:...... - 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ....G:..8.... + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0x23, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, // #...$Global..... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // #.......u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, 0x00, // iewProj.....%... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ........;...a_co + 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3f, 0x00, 0x00, 0x00, // lor0........?... + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0x42, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // B...a_texcoord0. + 0x05, 0x00, 0x0a, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....M...@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // intOutput.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x50, 0x00, 0x00, 0x00, // ition.......P... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // t.v_color0...... + 0x53, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // S...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...#....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...#....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, // #.......H...#... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // #.......G...%... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // ".......G...;... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........G...?... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, // ........G...B... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // ........G...M... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, // ........G...P... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x53, 0x00, 0x00, 0x00, // ........G...S... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......+....... + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......?+....... + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ........+....... + 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, // ............"... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, // ............#... + 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // "... ...$....... + 0x23, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // #...;...$...%... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...&....... + 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // "... ...:....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // ....;...:...;... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...>....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // ....;...>...?... + 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // ....;...:...B... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...L....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, // ....;...L...M... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ....;...L...P... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // ....;...L...S... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // =.......<...;... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, // =.......@...?... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // =.......C...B... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // Q.......k...@... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, // ....Q.......l... + 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // @.......P....... + 0x6d, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, // m...k...l....... + 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, // ....A...&...n... + 0x25, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, // %.......=..."... + 0x6f, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // o...n........... + 0x70, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // p...m...o...Q... + 0x06, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....w...p....... + 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ........x...w... + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, // R...........x... + 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x00, 0x00, 0x00, // p.......>...M... + 0x96, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....>...P...<... + 0x3e, 0x00, 0x03, 0x00, 0x53, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >...S...C....... + 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // 8...........@. }; static const uint8_t vs_font_distance_field_subpixel_dx9[329] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h index a8d71299d5d..fc2e222dd71 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.bin.h @@ -7,138 +7,34 @@ static const uint8_t fs_imgui_color_glsl[89] = 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ragColor = v_col 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // or0;.}... }; -static const uint8_t fs_imgui_color_spv[2079] = +static const uint8_t fs_imgui_color_spv[402] = { - 0x46, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x03, 0x02, // FSH....I........ - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, // #.........za.... + 0x46, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x03, 0x02, // FSH....I........ + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, // #.........+..... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, // ..w............. + 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, // ..!...*......... 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, // ................ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, // ......5...vec4_s - 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, // plat(f1;........ - 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x40, 0x6d, // .._x..........@m - 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, // ain(vf4;vf4;.... - 0x05, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..O0..v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa2, 0x25, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // .......%..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, // gData_0_........ - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, // ..bgfx_VoidFrag. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ......,N..param. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .......@..v_colo - 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, // r0........w...v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // color0.......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xef, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......G..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc7, 0x02, // gData_0_........ - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..$Global....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, // viewTexel....... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, // iew............. - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..u_proj........ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc7, 0x02, // viewProj........ - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc7, 0x02, // ..u_model....... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..........u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, // aRef4.G...w..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf0, 0x06, 0x00, 0x00, 0x06, 0x00, // ......G......... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc7, 0x02, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xc7, 0x02, // ..#... ...G..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // .. ... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x3d, 0x0b, 0x00, 0x00, 0x08, 0x00, // ......!...=..... - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........+..... - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, // .......... ..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, // ..........;..... - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..w....... ..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, // ..........;..... - 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, // .. .......+..... - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf0, 0x06, // ..j... ......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xc7, 0x02, // ..e...j......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..........e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......e...e..... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xef, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......G......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3e, 0x00, // .......@..w...>. - 0x03, 0x00, 0xef, 0x47, 0x00, 0x00, 0xbf, 0x40, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, // ...G...@..9..... - 0x00, 0x00, 0x79, 0x61, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xef, 0x47, 0x00, 0x00, 0x9a, 0x16, // ..ya.......G.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, // ..8...6.......5. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......dW......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......N......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......I9......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......9......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, // .......*..dW...N - 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, // ..I9...9.......* - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0x0f, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......=...7..... - 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x25, // ..O0..7........% - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xee, 0x5f, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, // ......._..;..... - 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x4e, // ..,N......>...,N - 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, // ......9......... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..5...,N..=..... - 0x00, 0x00, 0x58, 0x5b, 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x25, // ..X[..O0..>....% - 0x00, 0x00, 0x58, 0x5b, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..X[......8.... + 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......!...v_colo + 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x62, 0x67, // r0........*...bg + 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, // fx_FragData0..G. + 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..!...........G. + 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, // ..*............. + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ......!......... + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, // .......... ..... + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // .. ...........;. + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // .. ...!....... . + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..)...........;. + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..)...*.......6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..........=..... + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2a, 0x00, // .."...!...>...*. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, // ..".......8..... + 0x00, 0x00, // .. }; static const uint8_t fs_imgui_color_dx9[131] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.sc b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.sc index 19f8692163c..0b13177a98c 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.sc +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_color.sc @@ -1,7 +1,7 @@ $input v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h index 0b69b9f5be4..bad9ff03c72 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h @@ -24,258 +24,99 @@ static const uint8_t fs_imgui_cubemap_glsl[363] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_1;.}... }; -static const uint8_t fs_imgui_cubemap_spv[3991] = +static const uint8_t fs_imgui_cubemap_spv[1446] = { 0x46, 0x53, 0x48, 0x05, 0xe3, 0xc2, 0x5c, 0x65, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH....e...u_ima 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, 0x00, // geLodEnabled.... - 0x01, 0x00, 0x70, 0x0f, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // ..p.....#....... - 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ..za............ + 0x01, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, // ..|.....#....... + 0x08, 0x00, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, // ..........GLSL.s 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, // td.450.......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x34, 0x0e, 0x00, 0x00, 0xd1, 0x0d, // ..main....4..... - 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x11, 0x00, 0xf4, 0x10, // ..main.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, // ..bgfxTextureCub - 0x65, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, // eLod(struct-Bgfx - 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, // SamplerCube-p1-t - 0x43, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, // C11;vf3;f1;..... - 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ..~..._sampler.m - 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, // _sampler........ - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, // .._sampler.m_tex - 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, // ture.........._c - 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, // oord.........._l - 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, // evel......5...ve - 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c4_splat(f1;.... - 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x9e, 0x16, // ......_x........ - 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, // ..@main(vf3;vf4; - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x42, 0x26, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // ......B&..v_norm - 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x19, 0x46, 0x00, 0x00, 0x67, 0x6c, // al.........F..gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ..g...BgfxSample - 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x00, 0x00, // rCube.....g..... - 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, // ..m_sampler..... - 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, // ..g.......m_text - 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, // ure...........fl - 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, // attenTemp....... - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, // ..s_texColorSamp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, // ler...........s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // texColorTexture. - 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ..........s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // olor.m_sampler.. - 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......P...s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // olor.m_texture.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, // ..........bgfx_V - 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, // oidFrag........] - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, // ..param......... - 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0e, 0x07, // ..color......... - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0e, 0x07, // ..$Global....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x0e, 0x07, // viewTexel....... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x04, 0x00, // iew............. - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0e, 0x07, // ..u_proj........ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x0e, 0x07, // viewProj........ - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x08, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x0e, 0x07, // ..u_model....... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..........u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0c, 0x00, // aRef4........... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // ..u_imageLodEnab - 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, // led.......B..... - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......V..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......9..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......9..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x91, 0x37, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......7..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x00, // ..........alpha. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, // .......*..v_norm - 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x76, 0x5f, // al........4...v_ - 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // normal.......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......U..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, // gData_0_..G..... - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, // ..".......G..... - 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, // ..!.......G..... - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, // ..".......G..... - 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x13, 0x06, // ..!.......G..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, // ......@...H..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x02, 0x00, // .. ...H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#...`...H. - 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x04, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x06, 0x00, // .. ...H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#...`...H. - 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x08, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0a, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x0e, 0x07, // ..........H..... - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, // ..........#...0. - 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, // ..G...........G. - 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..B...".......G. - 0x04, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..4...........G. - 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, // ................ - 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, // .......... ...y. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x98, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x74, 0x0b, // ..........!...t. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x15, 0x03, 0x00, 0x00, 0x95, 0x02, // ......y......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x2e, 0x0b, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x67, 0x09, // ..............g. - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, // .......... ...!. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x67, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, // ......g... ...z. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, // ..........;...z. - 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x03, // .......... ..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x03, // ..........;..... - 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, // .......... ...{. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, // ..........;...{. - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // .. .......+..... - 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x03, // .......... ..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x03, // ..........;..... - 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..P.......+..... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, // ................ - 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..........e..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......+.......j. - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x13, 0x06, 0x00, 0x00, 0x65, 0x00, // .. ...........e. - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x0e, 0x07, 0x00, 0x00, 0x1d, 0x00, // ..j............. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ......e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x13, 0x06, // ..e...e...e..... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..e...e......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0e, 0x07, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8b, 0x09, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, // ..;.......B..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, // ..+......./..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xcd, 0xcc, // ..+............. - 0x4c, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0xcd, 0xcc, // L>+.......!..... - 0x4c, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, // L?+............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x01, 0x00, // ..;.......4..... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, // ..;............. - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..!...........;. - 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......U......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, // ......!C......=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......3......P. - 0x05, 0x00, 0x67, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, // ..g...^ ..!C...3 - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, // ..>.......^ ..A. - 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, // ..y....V........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, // ..=............V - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, // ..>...........A. - 0x05, 0x00, 0x15, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, // .......@........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, // ..=............@ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, // ..>...P.......=. - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x34, 0x0e, 0x00, 0x00, 0x3e, 0x00, // .......*..4...>. - 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, // ...U...*..9..... - 0x00, 0x00, 0x79, 0x61, 0x00, 0x00, 0x9e, 0x16, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, // ..ya.......U.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x10, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, // ......t...7...y. - 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x15, 0x03, 0x00, 0x00, 0xf7, 0x0d, // ..~...7......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, // ..............._ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, // ..=.......!A..~. - 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, // ..V.......`5.... - 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x22, // ..!A..=........" - 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, // ......=........G - 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, // ......X.......(= - 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, // ..`5...".......G - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // ......(=..8...6. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, // ......5......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, // ..7............. - 0x02, 0x00, 0xc6, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, // ...5..=.......). - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, // ......=........B - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, // ......=.......T- - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, // ......=.......g- - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, // ......P........1 - 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, // ..)....B..T-..g- - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xee, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // .......1..8...6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x0b, // ................ - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x42, 0x26, 0x00, 0x00, 0x37, 0x00, // ..7.......B&..7. - 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x19, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc0, 0x53, // .......F.......S - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x07, 0x00, // ..;........].... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x07, 0x00, // ..;...y....V.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x07, 0x00, // ..;........9.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x07, 0x00, // ..;........9.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x07, 0x00, // ..;........7.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, // ..>....]......9. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5d, // ..........5....] - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x14, 0x11, // ..=.......#A.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x3d, 0x00, // ..>....V..#A..=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, // .......,..P...>. - 0x03, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, // ...9...,..=..... - 0x00, 0x00, 0xcf, 0x2c, 0x00, 0x00, 0x42, 0x26, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, // ...,..B&..>....9 - 0x00, 0x00, 0xcf, 0x2c, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x3d, 0x42, // ...,..A.......=B - 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ..B.../.......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd6, 0x1f, 0x00, 0x00, 0x3d, 0x42, 0x00, 0x00, 0x3e, 0x00, // ..........=B..>. - 0x03, 0x00, 0x91, 0x37, 0x00, 0x00, 0xd6, 0x1f, 0x00, 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, // ...7......9..... - 0x00, 0x00, 0xd7, 0x56, 0x00, 0x00, 0xf4, 0x10, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0xbe, 0x39, // ...V.......V...9 - 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, // ...9...7..O..... - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0xd7, 0x56, 0x00, 0x00, 0xd7, 0x56, 0x00, 0x00, 0x00, 0x00, // .......V...V.... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, // ..........A..... - 0x00, 0x00, 0x79, 0x5a, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0d, 0x0a, // ..yZ..B.../..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x32, 0x36, 0x00, 0x00, 0x79, 0x5a, // ..=.......26..yZ - 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xaa, 0x44, 0x00, 0x00, 0x21, 0x0a, // ...........D..!. - 0x00, 0x00, 0x32, 0x36, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x10, // ..26............ - 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xaa, 0x44, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // .......D..Q..... - 0x00, 0x00, 0xc9, 0x2a, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ...*..........Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0a, 0x1f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0x18, 0x0e, // ..Q........O.... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9e, 0x3f, // ......P........? - 0x00, 0x00, 0xc9, 0x2a, 0x00, 0x00, 0x0a, 0x1f, 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0xf3, 0x10, // ...*.......O.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x19, 0x46, 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xfd, 0x00, // ..>....F...?.... - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..8.... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x6c, 0x00, // ..main....c...l. + 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, // ..main.......... + 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, // ..BgfxSamplerCub + 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // e.............m_ + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, // sampler......... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ...... ...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, // olor......"...s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......%...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... + 0x04, 0x00, 0x44, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..D...$Global... + 0x08, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ..D.......u_imag + 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, // eLodEnabled..... + 0x03, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x63, 0x00, // ..F...........c. + 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_normal...... + 0x06, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ..l...bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x22, 0x00, // ata0..G...%...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x21, 0x00, // ......G...%...!. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, // ......H...D..... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x44, 0x00, // ..#.......G...D. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x22, 0x00, // ......G...F...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x63, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...c..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...l..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, // .......... ..... + 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, // ..;....... ..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, // .. ...!......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, // ..;...!..."..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, // .. ...$......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, // ..;...$...%..... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // ......(... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+...(...-..... + 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......1......... + 0x03, 0x00, 0x44, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x45, 0x00, // ..D....... ...E. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x45, 0x00, // ......D...;...E. + 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x4c, 0x00, // ..F...........L. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x4c, 0x00, // .. .......+...L. + 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4e, 0x00, // ..M....... ...N. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..........+..... + 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..T.....L>+..... + 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x4c, 0x00, // ..U.....L?+...L. + 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x62, 0x00, // ..V....... ...b. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x62, 0x00, // ..........;...b. + 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x6b, 0x00, // ..c....... ...k. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x6b, 0x00, // ..........;...k. + 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, // ..l.......6..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, // ................ + 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, // ......=.......#. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, // .."...=.......&. + 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, // ..%...P.......'. + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, // ..#...&...>... . + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x64, 0x00, // ..'...=.......d. + 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x88, 0x00, // ..c...=......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x00, // .. ...Q......... + 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, // ..........Q..... + 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. + 0x06, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x2d, 0x00, // ..N.......F...-. + 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8b, 0x00, // ..M...=......... + 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0xa3, 0x00, // ......V...1..... + 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, // ..........X..... + 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x02, 0x00, // ..........d..... + 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x8e, 0x00, // ......A...N..... + 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..F...-...V...=. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x8f, 0x00, // ..........U..... + 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x54, 0x00, // ..............T. + 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x94, 0x00, // ......Q......... + 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x94, 0x00, // ..P............. + 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..l...........8. + 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // ...... }; static const uint8_t fs_imgui_cubemap_dx9[384] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.sc b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.sc index cf210f6b128..20bb3a52a97 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.sc +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_cubemap.sc @@ -1,7 +1,7 @@ $input v_normal /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h index 3943125e11a..b31a2f0abcc 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image.bin.h @@ -24,259 +24,99 @@ static const uint8_t fs_imgui_image_glsl[360] = 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _1;.}... }; -static const uint8_t fs_imgui_image_spv[4003] = +static const uint8_t fs_imgui_image_spv[1446] = { 0x46, 0x53, 0x48, 0x05, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, 0x00, // geLodEnabled.... - 0x01, 0x00, 0x7c, 0x0f, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // ..|.....#....... - 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ..za............ + 0x01, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, // ..|.....#....... + 0x08, 0x00, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, // ..........GLSL.s 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, // td.450.......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, // ..main....t..... - 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0xce, 0x14, // ..main.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, // ..bgfxTexture2DL - 0x6f, 0x64, 0x28, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, // od(struct-BgfxSa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, // mpler2D-p1-t211; - 0x76, 0x66, 0x32, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, // vf2;f1;.......~. - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, // .._sampler.m_sam - 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, // pler.........._s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ampler.m_texture - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, // .........._coord - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, // .........._level - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, // ......5...vec4_s - 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, // plat(f1;........ - 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe8, 0x16, 0x00, 0x00, 0x40, 0x6d, // .._x..........@m - 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, // ain(vf2;vf4;.... - 0x05, 0x00, 0x42, 0x26, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..B&..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x19, 0x46, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0......F..gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, // gData_0_......a. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6e, 0x00, // ..main....e...n. + 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, // ..main.......... 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, // ..BgfxSampler2D. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // ......a.......m_ - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, // sampler.......a. + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // ..............m_ + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, // sampler......... 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, // ..........flatte - 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, // nTemp.........s_ + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ...... ...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, // olor......"...s_ 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. - 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ..........s_texC + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......%...s_texC 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... - 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_sampler...... - 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..P...s_texColor - 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // .m_texture...... - 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, // ......bgfx_VoidF - 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x70, 0x61, // rag........]..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, // ram...........co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x24, 0x47, // lor...........$G - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x00, 0x00, // lobal........... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, // ..u_viewRect.... - 0x06, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x02, 0x00, // Texel........... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8f, 0x02, // ..u_view........ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, // ......u_invView. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x05, 0x00, // proj............ - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invProj..... - 0x06, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x07, 0x00, // Proj............ - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ..u_invViewProj. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x09, 0x00, // model........... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, // ..u_modelView... - 0x07, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8f, 0x02, // lViewProj....... - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // ......u_alphaRef - 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, // 4.............u_ - 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, // imageLodEnabled. - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ......B......... - 0x04, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...V..param..... - 0x04, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...9..param..... - 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...9..param..... - 0x04, 0x00, 0x91, 0x37, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...7..param..... - 0x04, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x00, 0x00, 0x00, 0x05, 0x00, // ......alpha..... - 0x05, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...*..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 0.....t...v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, // oord0.........gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...U..param..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, // a_0_..G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, // ......G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xcd, 0x06, 0x00, 0x00, 0x06, 0x00, // ......G......... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x8f, 0x02, // ..#... ...H..... - 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, // ......#...0...G. - 0x03, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, // ..........G...B. - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, // ..".......G...t. - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, // ..........G..... - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. - 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, // ...... ...y..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x53, 0x0b, 0x00, 0x00, 0x1d, 0x00, // ......!...S..... - 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8a, 0x02, // ..y............. - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x1f, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x90, 0x02, // ..!............. - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, // ..........a..... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, // ..a... ...z..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, // ......;...z..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x00, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0xee, 0x0e, // ......;......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, // ...... ...{..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, // ......;...{..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x06, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x50, 0x13, // ......;.......P. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, // ......+......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, // ................ - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . - 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xcd, 0x06, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ..........e...j. - 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xcd, 0x06, 0x00, 0x00, 0x65, 0x00, // ..e...e.......e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, // ..e........... . - 0x04, 0x00, 0x0c, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x0c, 0x05, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, // ......B.......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, // ....../.......+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x2b, 0x00, // ............L>+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x2b, 0x00, // ......!.....L?+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ......t....... . - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..............6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, // ................ - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, // ......Sa..;..... - 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, // ..........;..... - 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...U......;..... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..!C......=..... - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, // ...3......P...a. - 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, // ..^ ..!C...3..>. - 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. - 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, // ..........A..... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. - 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, // ..P.......=..... - 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, // ...*..t...>....U - 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x79, 0x61, // ...*..9.......ya - 0x00, 0x00, 0xe8, 0x16, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // .......U......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x14, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x53, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, // ..S...7...y...~. - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, // ..........._..=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, // ......!A..~...V. - 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, // ......`5......!A - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, // ..=........".... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, // ..=........G.... - 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, // ..X.......(=..`5 - 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, // ...".......G.... - 0x02, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ..(=..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, // ...............5 - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, // ..=.......)..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, // ..=........B.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, // ..=.......T-.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, // ..=.......g-.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, // ..P........1..). - 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, // ...B..T-..g-.... - 0x02, 0x00, 0xee, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ...1..8...6..... - 0x00, 0x00, 0xe8, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0b, 0x00, 0x00, 0x37, 0x00, // ..............7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x42, 0x26, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......B&..7..... - 0x00, 0x00, 0x19, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, // ...F.......S..;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......]......;. - 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..y....V......;. - 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......9......;. - 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......9......;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, // .......7......>. - 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...]......9..... - 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, // ......5....]..=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, // ......#A......>. - 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ...V..#A..=..... - 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x39, // ...,..P...>....9 - 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xcf, 0x2c, // ...,..=........, - 0x00, 0x00, 0x42, 0x26, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0xcf, 0x2c, // ..B&..>....9..., - 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x3d, 0x42, 0x00, 0x00, 0x42, 0x13, // ..A.......=B..B. - 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ../.......=..... - 0x00, 0x00, 0xd6, 0x1f, 0x00, 0x00, 0x3d, 0x42, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x91, 0x37, // ......=B..>....7 - 0x00, 0x00, 0xd6, 0x1f, 0x00, 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd7, 0x56, // ......9........V - 0x00, 0x00, 0xce, 0x14, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0xf7, 0x39, // .......V...9...9 - 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x0e, // ...7..O......... - 0x00, 0x00, 0xd7, 0x56, 0x00, 0x00, 0xd7, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ...V...V........ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x79, 0x5a, // ......A.......yZ - 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ..B.../.......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x32, 0x36, 0x00, 0x00, 0x79, 0x5a, 0x00, 0x00, 0x85, 0x00, // ......26..yZ.... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xaa, 0x44, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x32, 0x36, // .......D..!...26 - 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x05, 0x0b, // ................ - 0x00, 0x00, 0xaa, 0x44, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc9, 0x2a, // ...D..Q........* - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..........Q..... - 0x00, 0x00, 0x0a, 0x1f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x02, 0x00, // .......O........ - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xc9, 0x2a, // ..P........?...* - 0x00, 0x00, 0x0a, 0x1f, 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x3e, 0x00, // .......O......>. - 0x03, 0x00, 0x19, 0x46, 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ...F...?......8. - 0x01, 0x00, 0x00, // ... + 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..F...$Global... + 0x08, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ..F.......u_imag + 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, // eLodEnabled..... + 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x65, 0x00, // ..H...........e. + 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... + 0x06, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ..n...bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x22, 0x00, // ata0..G...%...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x21, 0x00, // ......G...%...!. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, // ......H...F..... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x46, 0x00, // ..#.......G...F. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x22, 0x00, // ......G...H...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...e..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...n..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, // .......... ..... + 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, // ..;....... ..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, // .. ...!......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, // ..;...!..."..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, // .. ...$......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, // ..;...$...%..... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // ......(... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+...(...-..... + 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......1......... + 0x03, 0x00, 0x46, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x47, 0x00, // ..F....... ...G. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x47, 0x00, // ......F...;...G. + 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x4e, 0x00, // ..H...........N. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x4e, 0x00, // .. .......+...N. + 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x50, 0x00, // ..O....... ...P. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..........+..... + 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..V.....L>+..... + 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x4e, 0x00, // ..W.....L?+...N. + 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x64, 0x00, // ..X....... ...d. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x64, 0x00, // ..........;...d. + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x6d, 0x00, // ..e....... ...m. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x6d, 0x00, // ..........;...m. + 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, // ..n.......6..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, // ................ + 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, // ......=.......#. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, // .."...=.......&. + 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, // ..%...P.......'. + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, // ..#...&...>... . + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x66, 0x00, // ..'...=.......f. + 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x8a, 0x00, // ..e...=......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xab, 0x00, // .. ...Q......... + 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, // ..........Q..... + 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. + 0x06, 0x00, 0x50, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x2d, 0x00, // ..P.......H...-. + 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8d, 0x00, // ..O...=......... + 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0xa5, 0x00, // ......V...1..... + 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, // ..........X..... + 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x02, 0x00, // ..........f..... + 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x50, 0x00, 0x00, 0x00, 0x90, 0x00, // ......A...P..... + 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..H...-...X...=. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x91, 0x00, // ..........W..... + 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x56, 0x00, // ..............V. + 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, // ......Q......... + 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x96, 0x00, // ..P............. + 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..n...........8. + 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // ...... }; static const uint8_t fs_imgui_image_dx9[388] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h index f8ca1c815c0..c0623a37362 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h @@ -37,281 +37,105 @@ static const uint8_t fs_imgui_image_swizz_glsl[565] = 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, // olor = tmpvar_3; 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... }; -static const uint8_t fs_imgui_image_swizz_spv[4363] = +static const uint8_t fs_imgui_image_swizz_spv[1538] = { 0x46, 0x53, 0x48, 0x05, 0x6f, 0x1e, 0x3e, 0x3c, 0x02, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, 0x00, // geLodEnabled.... - 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x01, 0x00, 0x00, // ...u_swizzle.... - 0x01, 0x00, 0xd4, 0x10, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // ........#....... - 0x08, 0x00, 0x75, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ..ub............ + 0x01, 0x00, 0x09, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x12, 0x01, 0x10, 0x00, // ...u_swizzle.... + 0x01, 0x00, 0xc8, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, // ........#....... + 0x08, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, // ..........GLSL.s 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, // td.450.......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, // ..main....t..... - 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0xce, 0x14, // ..main.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, // ..bgfxTexture2DL - 0x6f, 0x64, 0x28, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, // od(struct-BgfxSa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, // mpler2D-p1-t211; - 0x76, 0x66, 0x32, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, // vf2;f1;.......~. - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, // .._sampler.m_sam - 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, // pler.........._s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // ampler.m_texture - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, // .........._coord - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, // .........._level - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x01, 0x14, 0x00, 0x00, 0x76, 0x65, 0x63, 0x33, 0x5f, 0x73, // ..........vec3_s - 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x58, 0x4f, // plat(f1;......XO - 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, // .._x......5...ve - 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c4_splat(f1;.... - 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe8, 0x16, // ......_x........ - 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, // ..@main(vf2;vf4; - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x5b, 0x4c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ......[L..v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x55, 0x3d, 0x00, 0x00, 0x67, 0x6c, // oord0.....U=..gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ..a...BgfxSample - 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x00, 0x00, // r2D.......a..... - 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, // ..m_sampler..... - 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, // ..a.......m_text - 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, // ure...........fl - 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, // attenTemp....... - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, // ..s_texColorSamp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, // ler...........s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // texColorTexture. - 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ..........s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // olor.m_sampler.. - 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......P...s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // olor.m_texture.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, // ..........bgfx_V - 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x13, 0x57, // oidFrag........W - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, // ..param......... - 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x33, 0x01, // ..color.......3. - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x01, // ..$Global.....3. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......3.......u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x33, 0x01, // viewTexel.....3. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0x33, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..3.......u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x04, 0x00, // iew.......3..... - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x01, // ..u_proj......3. - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......3.......u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x33, 0x01, // viewProj......3. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x08, 0x00, // roj.......3..... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x01, // ..u_model.....3. - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.....3.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..3.......u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0c, 0x00, // aRef4.....3..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, // ..u_imageLodEnab - 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0d, 0x00, // led.......3..... - 0x00, 0x00, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, 0x7a, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..u_swizzle..... - 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x4a, 0x50, // ..B...........JP - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x34, 0x33, // ..param.......43 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x35, 0x33, // ..param.......53 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6d, 0x33, // ..param.......m3 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf3, 0x10, // ..param......... - 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x07, 0x31, // ..alpha........1 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe8, 0x2a, // ..param........* - 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..t...v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0.........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, // gData_0_.......U - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, // ..param......... - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, // ..param......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G......."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G.......!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G......."..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G.......!..... - 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x12, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, // ..G...........@. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...3.......#. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x01, 0x00, // ......H...3..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, // ..#.......H...3. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..3............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...3......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...3.......#. - 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x03, 0x00, // ..`...H...3..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..3............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...3......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...3.......#. - 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x05, 0x00, // ......H...3..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#... ...H. - 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..3............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...3......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...3.......#. - 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x07, 0x00, // ..`...H...3..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..3............. - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H...3......... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...3.......#. - 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x09, 0x00, // ......H...3..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, // ..........H...3. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ..3............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...3.......#. - 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, 0x00, 0x00, 0x0c, 0x00, // .. ...H...3..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x33, 0x01, // ..#...0...H...3. - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x00, 0x47, 0x00, // ......#...@...G. - 0x03, 0x00, 0x33, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, // ..3.......G...B. - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, // ..".......G...t. - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, // ..........G..... - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. - 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, // ...... ...y..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x53, 0x0b, 0x00, 0x00, 0x1d, 0x00, // ......!...S..... - 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8a, 0x02, // ..y............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x1f, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x90, 0x02, // ..!............. - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, // ..........a..... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, // ..a... ...z..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, // ......;...z..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x00, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0xee, 0x0e, // ......;......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, // ...... ...{..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, // ......;...{..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x06, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x50, 0x13, // ......;.......P. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, // ......+......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, // ................ - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . - 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x12, 0x0a, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ..........e...j. - 0x00, 0x00, 0x1e, 0x00, 0x10, 0x00, 0x33, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......3......... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x12, 0x0a, 0x00, 0x00, 0x65, 0x00, // ..e...e.......e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..e............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb0, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x33, 0x01, // .. ...........3. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb0, 0x03, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, // ..;.......B..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, // ..+......./..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x32, 0x0a, 0x00, 0x00, 0x0d, 0x00, // ..+.......2..... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xcd, 0xcc, // ..+............. - 0x4c, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0xcd, 0xcc, // L>+.......!..... - 0x4c, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, // L?+............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, // ..;.......t..... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, // ..;............. - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........Sa..;. - 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......U......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, // ......!C......=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......3......P. - 0x05, 0x00, 0x61, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, // ..a...^ ..!C...3 - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, // ..>.......^ ..A. - 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, // ..y....V........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, // ..=............V - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, // ..>...........A. - 0x05, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, // .......@........ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, // ..=............@ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, // ..>...P.......=. - 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, // .......*..t...>. - 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, // ...U...*..9..... - 0x00, 0x00, 0x79, 0x61, 0x00, 0x00, 0xe8, 0x16, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, // ..ya.......U.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, // ..=............. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, // ..>............. - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x14, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, // ......S...7...y. - 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, // ..~...7......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, // ..............._ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, // ..=.......!A..~. - 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, // ..V.......`5.... - 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x95, 0x22, // ..!A..=........" - 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, // ......=........G - 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, // ......X.......(= - 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, // ..`5...".......G - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // ......(=..8...6. - 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe5, 0x00, // ................ - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x58, 0x4f, 0x00, 0x00, 0xf8, 0x00, // ..7.......XO.... - 0x02, 0x00, 0xdd, 0x56, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x37, 0x54, // ...V..=.......7T - 0x00, 0x00, 0x58, 0x4f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe5, 0x4c, // ..XO..=........L - 0x00, 0x00, 0x58, 0x4f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x36, // ..XO..=......./6 - 0x00, 0x00, 0x58, 0x4f, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x53, // ..XO..P........S - 0x00, 0x00, 0x37, 0x54, 0x00, 0x00, 0xe5, 0x4c, 0x00, 0x00, 0x2f, 0x36, 0x00, 0x00, 0xfe, 0x00, // ..7T...L../6.... - 0x02, 0x00, 0x05, 0x53, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...S..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x02, 0x2d, // ...............- - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1e, 0x5e, 0x00, 0x00, 0xdd, 0x0e, // ..=........^.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x63, 0x55, 0x00, 0x00, 0xdd, 0x0e, // ..=.......cU.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xca, 0x26, 0x00, 0x00, 0xdd, 0x0e, // ..=........&.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdd, 0x26, 0x00, 0x00, 0xdd, 0x0e, // ..=........&.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2a, 0x29, 0x00, 0x00, 0x1e, 0x5e, // ..P.......*)...^ - 0x00, 0x00, 0x63, 0x55, 0x00, 0x00, 0xca, 0x26, 0x00, 0x00, 0xdd, 0x26, 0x00, 0x00, 0xfe, 0x00, // ..cU...&...&.... - 0x02, 0x00, 0x2a, 0x29, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, // ..*)..8...6..... - 0x00, 0x00, 0xe8, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x0b, 0x00, 0x00, 0x37, 0x00, // ..............7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x5b, 0x4c, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......[L..7..... - 0x00, 0x00, 0x55, 0x3d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf0, 0x1b, 0x00, 0x00, 0x3b, 0x00, // ..U=..........;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......W......;. - 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..y...JP......;. - 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x34, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ......43......;. - 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x35, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ......53......;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ......m3......;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, // .......1......>. - 0x03, 0x00, 0x13, 0x57, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...W......9..... - 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x3d, 0x00, // ......5....W..=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xd2, 0x53, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, // .......S......>. - 0x03, 0x00, 0x4a, 0x50, 0x00, 0x00, 0xd2, 0x53, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..JP...S..=..... - 0x00, 0x00, 0xf9, 0x25, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x34, 0x33, // ...%..P...>...43 - 0x00, 0x00, 0xf9, 0x25, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x45, 0x26, // ...%..=.......E& - 0x00, 0x00, 0x5b, 0x4c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x33, 0x00, 0x00, 0x45, 0x26, // ..[L..>...53..E& - 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xb3, 0x3b, 0x00, 0x00, 0x42, 0x13, // ..A........;..B. - 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ../.......=..... - 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0xb3, 0x3b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6d, 0x33, // ..L....;..>...m3 - 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x77, 0x59, // ..L...9.......wY - 0x00, 0x00, 0xce, 0x14, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x34, 0x33, 0x00, 0x00, 0x35, 0x33, // ......JP..43..53 - 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x6f, 0x25, // ..m3..A.......o% - 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x32, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..B...2...=..... - 0x00, 0x00, 0x21, 0x27, 0x00, 0x00, 0x6f, 0x25, 0x00, 0x00, 0x94, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..!'..o%........ - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x77, 0x59, 0x00, 0x00, 0x21, 0x27, 0x00, 0x00, 0x41, 0x00, // ......wY..!'..A. - 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x0f, 0x62, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, // .......b..B.../. - 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x97, 0x1a, // ......=......... - 0x00, 0x00, 0x0f, 0x62, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb7, 0x3c, // ...b...........< - 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x97, 0x1a, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..!............. - 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xb7, 0x3c, 0x00, 0x00, 0x3e, 0x00, // ...........<..>. - 0x03, 0x00, 0x07, 0x31, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x18, 0x00, // ...1......9..... - 0x00, 0x00, 0x4f, 0x2b, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x51, 0x00, // ..O+.......1..Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa1, 0x4d, 0x00, 0x00, 0x4f, 0x2b, 0x00, 0x00, 0x00, 0x00, // .......M..O+.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x49, 0x00, 0x00, 0x4f, 0x2b, // ..Q........I..O+ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x74, 0x62, // ......Q.......tb - 0x00, 0x00, 0x4f, 0x2b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // ..O+......P..... - 0x00, 0x00, 0x4d, 0x52, 0x00, 0x00, 0xa1, 0x4d, 0x00, 0x00, 0xf3, 0x49, 0x00, 0x00, 0x74, 0x62, // ..MR...M...I..tb - 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x55, 0x3d, 0x00, 0x00, 0x4d, 0x52, // ......>...U=..MR - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ......8.... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..main....s...|. + 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, // ..main.......... + 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, // ..BgfxSampler2D. + 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // ..............m_ + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, // sampler......... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......%...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x27, 0x00, 0x00, 0x00, 0x73, 0x5f, // olor......'...s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......*...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... + 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..O...$Global... + 0x08, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ..O.......u_imag + 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, // eLodEnabled..... + 0x06, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x77, 0x69, 0x7a, // ..O.......u_swiz + 0x7a, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, // zle.......Q..... + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x73, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ......s...v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x62, 0x67, // oord0.....|...bg + 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, // fx_FragData0..G. + 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..*...".......G. + 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, // ..*...!.......H. + 0x05, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, // ..O.......#..... + 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...O.......#. + 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x02, 0x00, // ......G...O..... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...Q..."..... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x73, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...s......... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...|......... + 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, // ..........!..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, // ................ + 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, // ...... ......... + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, // ................ + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, // ................ + 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..$...........;. + 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, // ..$...%....... . + 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..&...........;. + 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, // ..&...'....... . + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..)...........;. + 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, // ..)...*......... + 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..-... .......+. + 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..-...........+. + 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, // ..-...2......... + 0x03, 0x00, 0x36, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x4f, 0x00, // ..6...........O. + 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x50, 0x00, // .......... ...P. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x50, 0x00, // ......O...;...P. + 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x57, 0x00, // ..Q...........W. + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x57, 0x00, // .. .......+...W. + 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x59, 0x00, // ..X....... ...Y. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5d, 0x00, // .......... ...]. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..........+..... + 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..b.....L>+..... + 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x57, 0x00, // ..c.....L?+...W. + 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x72, 0x00, // ..d....... ...r. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x72, 0x00, // ..........;...r. + 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x00, // ..s....... ...{. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x00, // ..........;...{. + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, // ..|.......6..... + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, // ................ + 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x28, 0x00, // ......=.......(. + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..'...=.......+. + 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..*...P.......,. + 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x25, 0x00, // ..(...+...>...%. + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x74, 0x00, // ..,...=.......t. + 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x99, 0x00, // ..s...=......... + 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xc3, 0x00, // ..%...Q......... + 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, // ..........Q..... + 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. + 0x06, 0x00, 0x59, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x32, 0x00, // ..Y.......Q...2. + 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..X...=......... + 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, 0x00, 0xb7, 0x00, // ......V...6..... + 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, // ..........X..... + 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, // ..........t..... + 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x9e, 0x00, // ......A...]..... + 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0e, 0x00, // ..Q.......=..... + 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x94, 0x00, 0x05, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. + 0x06, 0x00, 0x59, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x32, 0x00, // ..Y.......Q...2. + 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa2, 0x00, // ..d...=......... + 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa3, 0x00, // ................ + 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, // ..c............. + 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x50, 0x00, // ......b.......P. + 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, // ................ + 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x7c, 0x00, // ..........>...|. + 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, // ..........8..... + 0x20, 0x00, // . }; static const uint8_t fs_imgui_image_swizz_dx9[452] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h index 0f768c9247b..b28e0a8c36c 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h @@ -42,307 +42,124 @@ static const uint8_t fs_imgui_latlong_glsl[651] = 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_4;.}... }; -static const uint8_t fs_imgui_latlong_spv[4779] = +static const uint8_t fs_imgui_latlong_spv[1850] = { 0x46, 0x53, 0x48, 0x05, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x69, 0x6d, 0x61, // FSH.o.><...u_ima 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x01, 0x00, 0x00, // geLodEnabled.... - 0x01, 0x00, 0x84, 0x12, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, // ........#....... - 0x08, 0x00, 0x9d, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ...b............ + 0x01, 0x00, 0x10, 0x07, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, // ........#....... + 0x08, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, // ..........GLSL.s 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, // td.450.......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, // ..main....t..... - 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x11, 0x00, 0xf4, 0x10, // ..main.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, // ..bgfxTextureCub - 0x65, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, // eLod(struct-Bgfx - 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, // SamplerCube-p1-t - 0x43, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, // C11;vf3;f1;..... - 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ..~..._sampler.m - 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, // _sampler........ - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, // .._sampler.m_tex - 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, // ture.........._c - 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, // oord.........._l - 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, // evel......5...ve - 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c4_splat(f1;.... - 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcd, 0x0c, // ......_x........ - 0x00, 0x00, 0x76, 0x65, 0x63, 0x46, 0x72, 0x6f, 0x6d, 0x4c, 0x61, 0x74, 0x4c, 0x6f, 0x6e, 0x67, // ..vecFromLatLong - 0x28, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x05, 0x00, 0x03, 0x00, 0x73, 0x10, 0x00, 0x00, 0x5f, 0x75, // (vf2;.....s..._u - 0x76, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe8, 0x16, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, // v.........@main( - 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x40, // vf2;vf4;.......@ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..main.......... + 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, // ..main.......... + 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, // ..BgfxSamplerCub + 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, // e.............m_ + 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, // sampler......... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // ......m_texture. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......&...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x28, 0x00, 0x00, 0x00, 0x73, 0x5f, // olor......(...s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // texColorSampler. + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......+...s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // olorTexture..... + 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ..w...$Global... + 0x08, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6d, 0x61, 0x67, // ..w.......u_imag + 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, // eLodEnabled..... + 0x03, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x93, 0x00, // ..y............. 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x06, 0x00, 0x6c, 0x5e, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ..l^..gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x42, 0x67, // a_0_......g...Bg - 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, // fxSamplerCube... - 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..g.......m_samp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x01, 0x00, // ler.......g..... - 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... - 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, // ......flattenTem - 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // p.........s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, // olorSampler..... - 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, // Texture......... - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, // ..s_texColor.m_s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, // ampler........P. - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, // ..s_texColor.m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x43, 0x08, // exture........C. - 0x00, 0x00, 0x70, 0x69, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbf, 0x15, 0x00, 0x00, 0x74, 0x77, // ..pi..........tw - 0x6f, 0x50, 0x69, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xca, 0x0c, 0x00, 0x00, 0x70, 0x68, // oPi...........ph - 0x69, 0x00, 0x05, 0x00, 0x04, 0x00, 0xb3, 0x13, 0x00, 0x00, 0x74, 0x68, 0x65, 0x74, 0x61, 0x00, // i.........theta. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa2, 0x10, 0x00, 0x00, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, // ..........result - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, // ..........bgfx_V - 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa2, 0x46, // oidFrag........F - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x46, 0x17, // ..param.......F. - 0x00, 0x00, 0x64, 0x69, 0x72, 0x00, 0x05, 0x00, 0x04, 0x00, 0x12, 0x59, 0x00, 0x00, 0x70, 0x61, // ..dir......Y..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, // ram...........co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x24, 0x47, // lor...........$G - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, // lobal........... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, // ..u_viewRect.... - 0x06, 0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, 0x00, // Texel........... - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x82, 0x00, // ..u_view........ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, // ......u_invView. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x82, 0x00, 0x00, 0x00, 0x05, 0x00, // proj............ - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invProj..... - 0x06, 0x00, 0x82, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x82, 0x00, 0x00, 0x00, 0x07, 0x00, // Proj............ - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ..u_invViewProj. - 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x82, 0x00, 0x00, 0x00, 0x09, 0x00, // model........... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, // ..u_modelView... - 0x07, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x82, 0x00, // lViewProj....... - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // ......u_alphaRef - 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, // 4.............u_ - 0x69, 0x6d, 0x61, 0x67, 0x65, 0x4c, 0x6f, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, // imageLodEnabled. - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ......B......... - 0x04, 0x00, 0xfc, 0x3b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...;..param..... - 0x04, 0x00, 0xfd, 0x3b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...;..param..... - 0x04, 0x00, 0x35, 0x3c, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ..5<..param..... - 0x04, 0x00, 0xcf, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...9..param..... - 0x04, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x00, 0x00, 0x00, 0x05, 0x00, // ......alpha..... - 0x05, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ...*..v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 0.....t...v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, // oord0.........gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ...U..param..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, // a_0_..G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, // ......G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x06, 0x00, // ......G......... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x82, 0x00, // ..#... ...H..... - 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, // ......#...0...G. - 0x03, 0x00, 0x82, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, // ..........G...B. - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, // ..".......G...t. - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, // ..........G..... - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. - 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, // ...... ...y..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x98, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x74, 0x0b, 0x00, 0x00, 0x1d, 0x00, // ......!...t..... - 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x15, 0x03, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x8a, 0x02, // ..y............. - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x90, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x1f, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x90, 0x02, // ..!............. - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x67, 0x09, 0x00, 0x00, 0xfc, 0x01, // ..........g..... - 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, // ...... ...!..... - 0x00, 0x00, 0x67, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, // ..g... ...z..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, // ......;...z..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x00, 0x00, // ...... ......... - 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0xee, 0x0e, // ......;......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, // ...... ...{..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, // ......;...{..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x06, 0x00, // ...... ......... - 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x50, 0x13, // ......;.......P. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, // ......+......... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x98, 0x00, // ................ - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x43, 0x08, 0x00, 0x00, 0xdb, 0x0f, // ..+.......C..... - 0x49, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, // I@+............. - 0x00, 0x40, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .@........ ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, // ..+............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x02, 0x00, // ..+............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . - 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ..........e...j. - 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x82, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e.......e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, // ..e........... . - 0x04, 0x00, 0xff, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0xff, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, // ......B.......+. - 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, // ....../....... . - 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x2b, 0x00, // ............L>+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x20, 0x00, // ......!.....L? . - 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ......t....... . - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, // ..............6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, // ................ - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, // ......Sa..;...!. - 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, // ..........;..... - 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...U......;..... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, // ..!C......=..... - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x67, 0x09, // ...3......P...g. - 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, // ..^ ..!C...3..>. - 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. - 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x15, 0x03, // ..........A..... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. - 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, // ..P.......=..... - 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, // ...*..t...>....U - 0x00, 0x00, 0xe8, 0x2a, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x79, 0x61, // ...*..9.......ya - 0x00, 0x00, 0xe8, 0x16, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // .......U......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x10, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x74, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, // ..t...7...y...~. - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x15, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, // ..........._..=. - 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, // ......!A..~...V. - 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, // ......`5......!A - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, // ..=........".... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, // ..=........G.... - 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, // ..X.......(=..`5 - 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, // ...".......G.... - 0x02, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ..(=..8...6..... - 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, // ..5...........7. - 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, // ...............5 - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, // ..=.......)..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, // ..=........B.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, // ..=.......T-.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, // ..=.......g-.... - 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, // ..P........1..). - 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, // ...B..T-..g-.... - 0x02, 0x00, 0xee, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x18, 0x00, // ...1..8...6..... - 0x00, 0x00, 0xcd, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x37, 0x00, // ..............7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x73, 0x10, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xcb, 0x54, // ......s........T - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xa2, 0x10, 0x00, 0x00, 0x07, 0x00, // ..;............. - 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbf, 0x15, 0x00, 0x00, 0x19, 0x00, // ................ - 0x00, 0x00, 0x43, 0x08, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x90, 0x27, // ..C...A........' - 0x00, 0x00, 0x73, 0x10, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..s.......=..... - 0x00, 0x00, 0x74, 0x5d, 0x00, 0x00, 0x90, 0x27, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..t]...'........ - 0x00, 0x00, 0xca, 0x0c, 0x00, 0x00, 0x74, 0x5d, 0x00, 0x00, 0xbf, 0x15, 0x00, 0x00, 0x41, 0x00, // ......t]......A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x2d, 0x00, 0x00, 0x73, 0x10, 0x00, 0x00, 0x0d, 0x0a, // .......-..s..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x92, 0x59, 0x00, 0x00, 0xdd, 0x2d, // ..=........Y...- - 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb3, 0x13, 0x00, 0x00, 0x92, 0x59, // ...............Y - 0x00, 0x00, 0x43, 0x08, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xff, 0x3d, // ..C............= - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb3, 0x13, 0x00, 0x00, 0x7f, 0x00, // ................ - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe5, 0x1a, 0x00, 0x00, 0xff, 0x3d, 0x00, 0x00, 0x0c, 0x00, // ...........=.... - 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x30, 0x3b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // ......0;........ - 0x00, 0x00, 0xca, 0x0c, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1f, 0x22, // ..............." - 0x00, 0x00, 0xe5, 0x1a, 0x00, 0x00, 0x30, 0x3b, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ......0;..A..... - 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xa2, 0x10, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3e, 0x00, // ...3..........>. - 0x03, 0x00, 0xd7, 0x33, 0x00, 0x00, 0x1f, 0x22, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, // ...3..."........ - 0x00, 0x00, 0xc2, 0x60, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xb3, 0x13, // ...`............ - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x97, 0x41, 0x00, 0x00, 0xa2, 0x10, // ..A........A.... - 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x97, 0x41, 0x00, 0x00, 0xc2, 0x60, // ......>....A...` - 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x4b, 0x00, 0x00, 0x01, 0x00, // ...........K.... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb3, 0x13, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x7b, 0x23, 0x00, 0x00, 0x06, 0x4b, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, // ..{#...K........ - 0x00, 0x00, 0xa4, 0x54, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xca, 0x0c, // ...T............ - 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x42, 0x00, 0x00, 0x7b, 0x23, // ...........B..{# - 0x00, 0x00, 0xa4, 0x54, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x77, 0x45, // ...T..A.......wE - 0x00, 0x00, 0xa2, 0x10, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x77, 0x45, // ..........>...wE - 0x00, 0x00, 0xf3, 0x42, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x9c, 0x62, // ...B..=........b - 0x00, 0x00, 0xa2, 0x10, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x9c, 0x62, 0x00, 0x00, 0x38, 0x00, // ...........b..8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xe8, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x1f, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x08, 0x40, // ......7........@ - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6c, 0x5e, 0x00, 0x00, 0xf8, 0x00, // ..7.......l^.... - 0x02, 0x00, 0xfe, 0x55, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xa2, 0x46, // ...U..;........F - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x12, 0x59, // ......;........Y - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xfc, 0x3b, // ......;...y....; - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0xfd, 0x3b, // ......;........; - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x35, 0x3c, // ......;.......5< - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xcf, 0x39, // ......;........9 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x46, 0x00, 0x00, 0x0c, 0x0a, // ......>....F.... - 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, // ..9...........5. - 0x00, 0x00, 0xa2, 0x46, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x15, 0x43, // ...F..=........C - 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x12, 0x59, 0x00, 0x00, 0x15, 0x43, // ...@..>....Y...C - 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x46, 0x17, 0x00, 0x00, 0xcd, 0x0c, // ..9.......F..... - 0x00, 0x00, 0x12, 0x59, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x61, 0x43, // ...Y..=.......aC - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xfc, 0x3b, 0x00, 0x00, 0x61, 0x43, // ......>....;..aC - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xd4, 0x2e, 0x00, 0x00, 0x50, 0x13, // ..=...........P. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xfd, 0x3b, 0x00, 0x00, 0xd4, 0x2e, 0x00, 0x00, 0x3e, 0x00, // ..>....;......>. - 0x03, 0x00, 0x35, 0x3c, 0x00, 0x00, 0x46, 0x17, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, // ..5<..F...A..... - 0x00, 0x00, 0x05, 0x3b, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, // ...;..B.../..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5a, 0x53, 0x00, 0x00, 0x05, 0x3b, // ..=.......ZS...; - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xcf, 0x39, 0x00, 0x00, 0x5a, 0x53, 0x00, 0x00, 0x39, 0x00, // ..>....9..ZS..9. - 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x15, 0x59, 0x00, 0x00, 0xf4, 0x10, 0x00, 0x00, 0xfc, 0x3b, // .......Y.......; - 0x00, 0x00, 0xfd, 0x3b, 0x00, 0x00, 0x35, 0x3c, 0x00, 0x00, 0xcf, 0x39, 0x00, 0x00, 0x4f, 0x00, // ...;..5<...9..O. - 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x15, 0x59, 0x00, 0x00, 0x15, 0x59, // ...........Y...Y - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, // ..............A. - 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xb7, 0x5c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, // ..........B.../. - 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x70, 0x38, // ......=.......p8 - 0x00, 0x00, 0xb7, 0x5c, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe8, 0x46, // ...............F - 0x00, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..!...p8........ - 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0xe8, 0x46, 0x00, 0x00, 0x51, 0x00, // ...........F..Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4d, 0x5e, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, // ......M^........ - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x48, 0x21, 0x00, 0x00, 0x18, 0x0e, // ..Q.......H!.... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x52, // ......Q........R - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // ..........P..... - 0x00, 0x00, 0xdc, 0x41, 0x00, 0x00, 0x4d, 0x5e, 0x00, 0x00, 0x48, 0x21, 0x00, 0x00, 0x03, 0x52, // ...A..M^..H!...R - 0x00, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6c, 0x5e, 0x00, 0x00, 0xdc, 0x41, // ......>...l^...A - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ......8.... + 0x06, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ......bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x22, 0x00, // ata0..G...+...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x21, 0x00, // ......G...+...!. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, // ......H...w..... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x77, 0x00, // ..#.......G...w. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x22, 0x00, // ......G...y...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x93, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, // .......... ..... + 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, // .. ...%......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x06, 0x00, // ..;...%...&..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, // .. ...'......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, // ..;...'...(..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, // .. ...*......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, // ..;...*...+..... + 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+.......3..... + 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x37, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, // ......7.......+. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0xdb, 0x0f, 0x49, 0x40, 0x15, 0x00, // ......F.....I@.. + 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..L... .......+. + 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..L...M.......+. + 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1e, 0x00, // ..L...S......... + 0x03, 0x00, 0x77, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x78, 0x00, // ..w....... ...x. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x78, 0x00, // ......w...;...x. + 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7f, 0x00, // ..y....... ..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..........+..... + 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3e, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ........L>+..... + 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x92, 0x00, // ........L? ..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x92, 0x00, // ..........;..... + 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x00, // .......... ..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x00, // ..........;..... + 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, // ..........+..... + 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0xdb, 0x0f, 0xc9, 0x40, 0x01, 0x00, 0x03, 0x00, 0x0b, 0x00, // .........@...... + 0x00, 0x00, 0x0b, 0x01, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ......6......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x28, 0x00, // ..=.......)...(. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..=.......,...+. + 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x29, 0x00, // ..P.......-...). + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x2d, 0x00, // ..,...>...&...-. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x19, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x93, 0x00, // ..=............. + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x94, 0x00, // ..Q............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xdd, 0x00, // ................ + 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x46, 0x00, // ..............F. + 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdd, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe4, 0x00, // ................ + 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x01, // ......R......... + 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, // ................ + 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, // ................ + 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x01, // ......R......... + 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, // ................ + 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xee, 0x00, // ................ + 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf0, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x85, 0x00, // ................ + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0xf0, 0x00, // ................ + 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0xf1, 0x00, // ..R............. + 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, // ..........=..... + 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ......&...Q..... + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x79, 0x00, // ..A...........y. + 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, // ..3...M...=..... + 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x37, 0x00, // ..........V...7. + 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x58, 0x00, // ..............X. + 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x08, 0x01, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7f, 0x00, // ..........A..... + 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x53, 0x00, // ......y...3...S. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0xc2, 0x00, // ..=............. + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x86, 0x00, // ................ + 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc5, 0x00, // ................ + 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xfc, 0x00, // ..Q............. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xcb, 0x00, // ......P......... + 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0xc5, 0x00, // ................ + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>............. + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // ..8....... }; static const uint8_t fs_imgui_latlong_dx9[548] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h index 5d6cfebbf10..4eedbc04b0a 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.bin.h @@ -20,247 +20,81 @@ static const uint8_t fs_imgui_texture_glsl[290] = 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_imgui_texture_spv[3823] = +static const uint8_t fs_imgui_texture_spv[1162] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xe0, 0x0e, 0x00, 0x00, 0x03, 0x02, // FSH............. - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........ob.... + 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x78, 0x04, 0x00, 0x00, 0x03, 0x02, // FSH.......x..... + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...t......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x62, 0x67, // in............bg - 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x73, 0x74, 0x72, 0x75, // fxTexture2D(stru - 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // ct-BgfxSampler2D - 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x05, 0x00, // -p1-t211;vf2;... - 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ..~..._sampler.m - 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, // _sampler........ - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, // .._sampler.m_tex - 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, // ture.........._c - 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, // oord......5...ve - 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c4_splat(f1;.... - 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x16, 0x0e, // ......_x........ - 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, // ..@main(vf4;vf2; - 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x76, 0x5f, // vf4;......nb..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x8f, 0x41, // color0.........A - 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x06, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ...J..gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, // a_0_......a...Bg + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x10, 0x00, // ..Y...]...h..... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, // in............Bg 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, // fxSampler2D..... - 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..a.......m_samp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, // ler.......a..... + 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, // ler............. 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... - 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, // ......flattenTem - 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // p.........s_texC + 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // .. ...s_texColor + 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ......"...s_texC 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, // olorSampler..... - 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, // Texture......... - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, // ..s_texColor.m_s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, // ampler........P. - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, // ..s_texColor.m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, // exture.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, // ..bgfx_VoidFrag. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......]..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf3, 0x10, 0x00, 0x00, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x00, // ..........alpha. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......V..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......9..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x91, 0x37, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......7..param. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .......+..v_colo - 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, // r0........w...v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, // color0.........< - 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..t...v_texcoord - 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // 0.........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, // gData_0_.......U - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, // ..param........8 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, // ..param......... - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, // ..param......... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, // ......r...$Globa - 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....r.......u_ - 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, // viewRect......r. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, // ......u_viewTexe - 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....r.......u_ - 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, 0x00, 0x00, 0x03, 0x00, // view......r..... - 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, // ..u_invView..... - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, // ..r.......u_proj - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......r.......u_ - 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, // invProj.......r. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // ......u_viewProj - 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x72, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......r.......u_ - 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, // invViewProj..... - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..r.......u_mode - 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, // l.....r.......u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x72, 0x06, // modelView.....r. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x72, 0x06, 0x00, 0x00, 0x0b, 0x00, // wProj.....r..... - 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, // ..u_alphaRef4.G. - 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......".......G. - 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......!.......G. - 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......".......G. - 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ......!.......G. - 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..w...........G. - 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, // ..t...........G. - 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..............G. - 0x04, 0x00, 0x7b, 0x08, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, // ..{.......@...H. - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, // ..r.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...r.......#. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x02, 0x00, // ......H...r..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x02, 0x00, // ......H...r..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, // ..#... ...H...r. - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..r...........H. - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, // ..r.......#...`. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...r......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x04, 0x00, // ......H...r..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x04, 0x00, // ......H...r..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, // ..#.......H...r. - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..r...........H. - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, // ..r.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...r......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x06, 0x00, // ......H...r..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x06, 0x00, // ......H...r..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, // ..#... ...H...r. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..r...........H. - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, // ..r.......#...`. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...r......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x08, 0x00, // ......H...r..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x08, 0x00, // ......H...r..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, // ..#.......H...r. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..r...........H. - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, // ..r.......#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H...r......... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x72, 0x06, 0x00, 0x00, 0x0a, 0x00, // ......H...r..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x0a, 0x00, // ......H...r..... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x72, 0x06, // ..#.......H...r. - 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0x72, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, // ..r.......#... . - 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x72, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, // ..G...r......... - 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, // .......... ...y. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x0a, 0x08, // ..........!..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, // ......y......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x69, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, // ..!...i......... - 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, // ..............a. - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, // ......a... ...z. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, // ..........;...z. - 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, // .......... ..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, // ..........;..... - 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, // .......... ...{. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, // ..........;...{. - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // .. .......+..... - 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, // .......... ..... - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, // ..........;..... - 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, // ..P.......+..... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, // ................ - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, // ......+......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, // ......+......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, // ......;.......w. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, // ......;.......t. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, // ......;......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..........e..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......+.......j. - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x7b, 0x08, 0x00, 0x00, 0x65, 0x00, // .. .......{...e. - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x72, 0x06, 0x00, 0x00, 0x1d, 0x00, // ..j.......r..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ......e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x7b, 0x08, // ..e...e...e...{. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, // ..e...e.......6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, // ................ - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, // ......Sa..;..... - 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ..........;..... - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, // ...U......;..... - 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...8......;..... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..!C......=..... - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, // ...3......P...a. - 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, // ..^ ..!C...3..>. - 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. - 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, // ..........A..... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. - 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..P.......=..... - 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, // ...+..w...=..... - 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, // ...<..t...>....U - 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, // ...+..>....8...< - 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0x16, 0x0e, // ..9........&.... - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // ...U...8......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, // ......7...y...~. - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, // ................ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xf7, 0x0d, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x7e, 0x17, // ..=........H..~. - 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, // ..V........>.... - 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x24, // ...H..=........$ - 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, // ......W........Y - 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, // ...>...$.......Y - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, // ..8...6.......5. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2e, 0x5f, 0x00, 0x00, 0x3d, 0x00, // ..........._..=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......[......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......%S......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......=......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......=......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0x25, 0x53, // ......V[...[..%S - 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x56, 0x5b, // ...=...=......V[ - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x0e, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ......i...7..... - 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8f, 0x41, // ..nb..7........A - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf8, 0x00, // ..7........J.... - 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, // ...S..;........] - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xd4, 0x56, // ......;...y....V - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x39, // ......;........9 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x91, 0x37, // ......;........7 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, // ......>....].... - 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, // ..9...........5. - 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, // ...]..=.......#A - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x23, 0x41, // ......>....V..#A - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x50, 0x13, // ..=........,..P. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, // ..>....9...,..=. - 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x3e, 0x00, // ......7,...A..>. - 0x03, 0x00, 0x91, 0x37, 0x00, 0x00, 0x37, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, // ...7..7,..9..... - 0x00, 0x00, 0x31, 0x55, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0xf7, 0x39, // ..1U.......V...9 - 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf3, 0x10, // ...7..Q......... - 0x00, 0x00, 0x31, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..1U......=..... - 0x00, 0x00, 0x57, 0x32, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, // ..W2..nb..O..... - 0x00, 0x00, 0xeb, 0x4b, 0x00, 0x00, 0x57, 0x32, 0x00, 0x00, 0x57, 0x32, 0x00, 0x00, 0x00, 0x00, // ...K..W2..W2.... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // ..........A..... - 0x00, 0x00, 0x94, 0x1c, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ......nb......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa2, 0x32, 0x00, 0x00, 0x94, 0x1c, 0x00, 0x00, 0x85, 0x00, // .......2........ - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x9b, 0x1a, 0x00, 0x00, 0xa2, 0x32, 0x00, 0x00, 0xf3, 0x10, // ...........2.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe6, 0x25, 0x00, 0x00, 0xeb, 0x4b, // ..Q........%...K - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa4, 0x2b, // ......Q........+ - 0x00, 0x00, 0xeb, 0x4b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, // ...K......Q..... - 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0xeb, 0x4b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, // ...O...K......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xe6, 0x25, 0x00, 0x00, 0xa4, 0x2b, // .......?...%...+ - 0x00, 0x00, 0xc5, 0x4f, 0x00, 0x00, 0x9b, 0x1a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x4a, // ...O......>....J - 0x00, 0x00, 0x9e, 0x3f, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ...?......8.... + 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..%...s_texColor + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x59, 0x00, // Texture.......Y. + 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... + 0x05, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..]...v_texcoord + 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x68, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, // 0.....h...bgfx_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ragData0..G...%. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ..".......G...%. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x59, 0x00, // ..!.......G...Y. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5d, 0x00, // ..........G...]. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x68, 0x00, // ..........G...h. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ......... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, // ......;....... . + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ...!..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, // ......;...!...". + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ...$..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......;...$...%. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, // ..........1..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ...X......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...X...Y..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, // .. ............. + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;.......]..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x67, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ...g......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x67, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;...g...h..... + 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......#..."...=. + 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, // ......&...%...P. + 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, // ......'...#...&. + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..>... ...'...=. + 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......Z...Y...=. + 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x3d, 0x00, // ......^...]...=. + 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, // .......... ...Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x82, 0x00, // ..Q............. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0x9b, 0x00, // ......V...1..... + 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, // ..........W..... + 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x51, 0x00, // ..........^...Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x5a, 0x00, // ..Q...........Z. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8b, 0x00, // ................ + 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ......Z.......Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x01, 0x00, // ..........Z..... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x5a, 0x00, // ..Q...........Z. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8f, 0x00, // ......P......... + 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8b, 0x00, // ................ + 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x68, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0xfd, 0x00, // ..>...h......... + 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ..8....... }; static const uint8_t fs_imgui_texture_dx9[252] = { diff --git a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.sc b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.sc index 99814a3f1d5..6f890a6fa63 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.sc +++ b/3rdparty/bgfx/examples/common/imgui/fs_imgui_texture.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h index 952be213e8f..c59608cbb86 100644 --- a/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h @@ -16,233 +16,72 @@ static const uint8_t fs_ocornut_imgui_glsl[238] = 0x20, 0x3d, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x2a, 0x20, 0x76, // = (tmpvar_1 * v 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _color0);.}... }; -static const uint8_t fs_ocornut_imgui_spv[3591] = +static const uint8_t fs_ocornut_imgui_spv[1022] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf8, 0x0d, 0x00, 0x00, 0x03, 0x02, // FSH............. - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........ob.... + 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xec, 0x03, 0x00, 0x00, 0x03, 0x02, // FSH............. + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, // ..w...t......... - 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ - 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, // ..............ma - 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x62, 0x67, // in............bg - 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x73, 0x74, 0x72, 0x75, // fxTexture2D(stru - 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // ct-BgfxSampler2D - 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x05, 0x00, // -p1-t211;vf2;... - 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, // ..~..._sampler.m - 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, // _sampler........ - 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, // .._sampler.m_tex - 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, // ture.........._c - 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, // oord......5...ve - 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, // c4_splat(f1;.... - 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x16, 0x0e, // ......_x........ - 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, // ..@main(vf4;vf2; - 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x76, 0x5f, // vf4;......nb..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x8f, 0x41, // color0.........A - 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x06, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ...J..gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, // a_0_......a...Bg + 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x10, 0x00, // ..M...Q......... + 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, // in............Bg 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, // fxSampler2D..... - 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..a.......m_samp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, // ler.......a..... + 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ..........m_samp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, // ler............. 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... - 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, // ......flattenTem - 0x70, 0x00, 0x05, 0x00, 0x06, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, // p.........s_texS - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4b, 0x0f, // ampler........K. - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // ..s_texTexture.. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4f, 0x12, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, // ......O...s_tex. - 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x05, 0x00, 0x06, 0x00, 0x36, 0x0e, // m_sampler.....6. - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // ..s_tex.m_textur - 0x65, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, // e.........bgfx_V - 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9d, 0x5d, // oidFrag........] - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x41, 0x12, // ..param.......A. - 0x00, 0x00, 0x74, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd4, 0x56, // ..texel........V - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf7, 0x39, // ..param........9 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x91, 0x37, // ..param........7 - 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, // ..param........+ - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..w...v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // .......<..v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, // oord0.....t...v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, // texcoord0....... - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......U..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // .......8..param. - 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, // ..........param. - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // ..........gl_Fra - 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc5, 0x01, // gData_0_........ - 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x01, // ..$Global....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, // ......u_viewRect - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x01, // viewTexel....... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, // ......u_view.... - 0x06, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x04, 0x00, // iew............. - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x01, // ..u_proj........ - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, // ......u_invProj. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc5, 0x01, // viewProj........ - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, // ......u_invViewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x08, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x01, // ..u_model....... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // ......u_modelVie - 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, // w.............u_ - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, // modelViewProj... - 0x06, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, // ..........u_alph - 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x22, 0x00, // aRef4.G.......". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x21, 0x00, // ......G.......!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x22, 0x00, // ......G...K...". - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x21, 0x00, // ......G...K...!. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, // ......G...w..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, // ......G...t..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7c, 0x04, 0x00, 0x00, 0x06, 0x00, // ......G...|..... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xc5, 0x01, // ..#... ...G..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, // .. ...y......... - 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, // .......... ..... - 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, // .. ............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, // .. ............. - 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, // ..!...........y. - 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, // ..........!..... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, // .......... ..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x69, 0x00, // ..........!...i. - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ - 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, // ......a......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x09, // .. ...........a. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, // .. ...z......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x00, 0x00, // ..;...z......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x00, 0x00, // ..;.......K..... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, // .. ...{......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x4f, 0x12, 0x00, 0x00, 0x06, 0x00, // ..;...{...O..... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x96, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x36, 0x0e, 0x00, 0x00, 0x06, 0x00, // ..;.......6..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, // ..+............. - 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ......w....... . - 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, // ......t....... . - 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, // ................ - 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, // ..e............. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, // ......j... ..... - 0x04, 0x00, 0x7c, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, // ..|...e...j..... - 0x0e, 0x00, 0xc5, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, // ..............e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...|...e...e. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, // ......6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, // ..............Sa - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, // ..;............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, // ..;........U.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, // ..;........8.... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, // ..;............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x0f, 0x0d, // ..=.......!C.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x4b, 0x0f, // ..=........3..K. - 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, // ..P...a...^ ..!C - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, // ...3..>.......^ - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, // ..A...y....V.... - 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, // ......=......... - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4f, 0x12, 0x00, 0x00, 0x1f, 0x1f, // ...V..>...O..... - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, // ..A........@.... - 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, // ......=......... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x0e, 0x00, 0x00, 0xd3, 0x1e, // ...@..>...6..... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, // ..=........+..w. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, // ..=........<..t. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, // ..>....U...+..>. - 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, // ...8...<..9..... - 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0x16, 0x0e, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, // ...&.......U...8 - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, // ......=......... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, // ......>......... - 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, // ......8...6..... - 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, // ..............7. - 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, // ..y...~...7..... - 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, // ......7......... - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..........=..... - 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, // ...H..~...V..... - 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, // ...>.......H..=. - 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, // .......$......W. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, // .......Y...>...$ - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // .......Y..8...6. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, // ......5......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, // ..7............. - 0x02, 0x00, 0x2e, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, // ..._..=........[ - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, // ......=.......%S - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, // ......=........= - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, // ......=........= - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, // ......P.......V[ - 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, // ...[..%S...=...= - 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x56, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, // ......V[..8...6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x00, // ..............i. - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, // ..7.......nb..7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // .......A..7..... - 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, // ...J.......S..;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......]......;. - 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..y....V......;. - 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......9......;. - 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, // .......7......>. - 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, // ...]......9..... - 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, // ......5....]..=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x4f, 0x12, 0x00, 0x00, 0x3e, 0x00, // ......#A..O...>. - 0x03, 0x00, 0xd4, 0x56, 0x00, 0x00, 0x23, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ...V..#A..=..... - 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x36, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, // ...,..6...>....9 - 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x37, 0x2c, // ...,..=.......7, - 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x91, 0x37, 0x00, 0x00, 0x37, 0x2c, // ...A..>....7..7, - 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x41, 0x12, 0x00, 0x00, 0x99, 0x0f, // ..9.......A..... - 0x00, 0x00, 0xd4, 0x56, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x91, 0x37, 0x00, 0x00, 0x3d, 0x00, // ...V...9...7..=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xba, 0x5b, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x85, 0x00, // .......[..nb.... - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x34, 0x00, 0x00, 0x41, 0x12, 0x00, 0x00, 0xba, 0x5b, // ......;4..A....[ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x3b, 0x34, 0x00, 0x00, 0xfd, 0x00, // ..>....J..;4.... - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ..8.... + 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x00, 0x00, 0x05, 0x00, // .. ...s_tex..... + 0x06, 0x00, 0x22, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, // .."...s_texSampl + 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, // er........%...s_ + 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // texTexture...... + 0x05, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..M...v_color0.. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x51, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ......Q...v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x62, 0x67, // oord0.........bg + 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, // fx_FragData0..G. + 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..%...".......G. + 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..%...!.......G. + 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, // ..M...........G. + 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, // ..Q...........G. + 0x04, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, // ................ + 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ......!......... + 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // .. ............. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, // ................ + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, // ................ + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, // ................ + 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, // .......... ..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, // ..........;..... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, // .. ....... ...!. + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, // ..........;...!. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, // .."....... ...$. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, // ..........;...$. + 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, // ..%...........1. + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, // ...... ...L..... + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4d, 0x00, // ......;...L...M. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, // ...... ...P..... + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x51, 0x00, // ......;...P...Q. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x03, 0x00, // ...... ...[..... + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5c, 0x00, // ......;...[..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ......6......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, // ..=.......#...". + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, // ..=.......&...%. + 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, // ..P.......'...#. + 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, // ..&...>... ...'. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x4d, 0x00, // ..=.......N...M. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x51, 0x00, // ..=.......R...Q. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x20, 0x00, // ..=.......w... . + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x77, 0x00, // ..Q...........w. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x8e, 0x00, // ......Q......... + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x31, 0x00, // ..w.......V...1. + 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x57, 0x00, // ..............W. + 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x52, 0x00, // ..............R. + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x8a, 0x00, // ..........|..... + 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x7c, 0x00, // ..N...>.......|. + 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ......8....... }; static const uint8_t fs_ocornut_imgui_dx9[231] = { diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.cpp b/3rdparty/bgfx/examples/common/imgui/imgui.cpp index 3a29d57efc9..6cd4b13c191 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.cpp +++ b/3rdparty/bgfx/examples/common/imgui/imgui.cpp @@ -8,11 +8,13 @@ #include #include #include -#include +#include #include "imgui.h" #include "../bgfx_utils.h" +//#define USE_ENTRY 1 + #ifndef USE_ENTRY # if defined(SCI_NAMESPACE) # define USE_ENTRY 1 @@ -23,10 +25,10 @@ #if USE_ENTRY # include "../entry/entry.h" +# include "../entry/input.h" #endif // USE_ENTRY #if defined(SCI_NAMESPACE) -# include "../entry/input.h" # include "scintilla.h" #endif // defined(SCI_NAMESPACE) @@ -63,13 +65,11 @@ static FontRangeMerge s_fontRangeMerge[] = { s_iconsFontAwesomeTtf, sizeof(s_iconsFontAwesomeTtf), { ICON_MIN_FA, ICON_MAX_FA, 0 } }, }; -static void* memAlloc(size_t _size); -static void memFree(void* _ptr); +static void* memAlloc(size_t _size, void* _userData); +static void memFree(void* _ptr, void* _userData); struct OcornutImguiContext { - static void renderDrawLists(ImDrawData* _drawData); - void render(ImDrawData* _drawData) { const ImGuiIO& io = ImGui::GetIO(); @@ -79,29 +79,7 @@ struct OcornutImguiContext bgfx::setViewName(m_viewId, "ImGui"); bgfx::setViewMode(m_viewId, bgfx::ViewMode::Sequential); - const bgfx::HMD* hmd = bgfx::getHMD(); const bgfx::Caps* caps = bgfx::getCaps(); - if (NULL != hmd && 0 != (hmd->flags & BGFX_HMD_RENDERING) ) - { - float proj[16]; - bx::mtxProj(proj, hmd->eye[0].fov, 0.1f, 100.0f, bgfx::getCaps()->homogeneousDepth); - - static float time = 0.0f; - time += 0.05f; - - const float dist = 10.0f; - const float offset0 = -proj[8] + (hmd->eye[0].viewOffset[0] / dist * proj[0]); - const float offset1 = -proj[8] + (hmd->eye[1].viewOffset[0] / dist * proj[0]); - - float ortho[2][16]; - const float viewOffset = width/4.0f; - const float viewWidth = width/2.0f; - bx::mtxOrtho(ortho[0], viewOffset, viewOffset + viewWidth, height, 0.0f, 0.0f, 1000.0f, offset0, caps->homogeneousDepth); - bx::mtxOrtho(ortho[1], viewOffset, viewOffset + viewWidth, height, 0.0f, 0.0f, 1000.0f, offset1, caps->homogeneousDepth); - bgfx::setViewTransform(m_viewId, NULL, ortho[0], BGFX_VIEW_STEREO, ortho[1]); - bgfx::setViewRect(m_viewId, 0, 0, hmd->width, hmd->height); - } - else { float ortho[16]; bx::mtxOrtho(ortho, 0.0f, width, height, 0.0f, 0.0f, 1000.0f, 0.0f, caps->homogeneousDepth); @@ -144,8 +122,8 @@ struct OcornutImguiContext else if (0 != cmd->ElemCount) { uint64_t state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_MSAA ; @@ -172,18 +150,18 @@ struct OcornutImguiContext state |= BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); } - const uint16_t xx = uint16_t(bx::fmax(cmd->ClipRect.x, 0.0f) ); - const uint16_t yy = uint16_t(bx::fmax(cmd->ClipRect.y, 0.0f) ); + const uint16_t xx = uint16_t(bx::max(cmd->ClipRect.x, 0.0f) ); + const uint16_t yy = uint16_t(bx::max(cmd->ClipRect.y, 0.0f) ); bgfx::setScissor(xx, yy - , uint16_t(bx::fmin(cmd->ClipRect.z, 65535.0f)-xx) - , uint16_t(bx::fmin(cmd->ClipRect.w, 65535.0f)-yy) + , uint16_t(bx::min(cmd->ClipRect.z, 65535.0f)-xx) + , uint16_t(bx::min(cmd->ClipRect.w, 65535.0f)-yy) ); bgfx::setState(state); bgfx::setTexture(0, s_tex, th); bgfx::setVertexBuffer(0, &tvb, 0, numVertices); bgfx::setIndexBuffer(&tib, offset, cmd->ElemCount); - bgfx::submit(cmd->ViewId, program); + bgfx::submit(m_viewId, program); } offset += cmd->ElemCount; @@ -205,10 +183,11 @@ struct OcornutImguiContext m_lastScroll = 0; m_last = bx::getHPCounter(); + ImGui::SetAllocatorFunctions(memAlloc, memFree, NULL); + + m_imgui = ImGui::CreateContext(); + ImGuiIO& io = ImGui::GetIO(); - io.RenderDrawListsFn = renderDrawLists; - io.MemAllocFn = memAlloc; - io.MemFreeFn = memFree; io.DisplaySize = ImVec2(1280.0f, 720.0f); io.DeltaTime = 1.0f / 60.0f; @@ -216,16 +195,20 @@ struct OcornutImguiContext setupStyle(true); -#if defined(SCI_NAMESPACE) +#if USE_ENTRY io.KeyMap[ImGuiKey_Tab] = (int)entry::Key::Tab; io.KeyMap[ImGuiKey_LeftArrow] = (int)entry::Key::Left; io.KeyMap[ImGuiKey_RightArrow] = (int)entry::Key::Right; io.KeyMap[ImGuiKey_UpArrow] = (int)entry::Key::Up; io.KeyMap[ImGuiKey_DownArrow] = (int)entry::Key::Down; + io.KeyMap[ImGuiKey_PageUp] = (int)entry::Key::PageUp; + io.KeyMap[ImGuiKey_PageDown] = (int)entry::Key::PageDown; io.KeyMap[ImGuiKey_Home] = (int)entry::Key::Home; io.KeyMap[ImGuiKey_End] = (int)entry::Key::End; + io.KeyMap[ImGuiKey_Insert] = (int)entry::Key::Insert; io.KeyMap[ImGuiKey_Delete] = (int)entry::Key::Delete; io.KeyMap[ImGuiKey_Backspace] = (int)entry::Key::Backspace; + io.KeyMap[ImGuiKey_Space] = (int)entry::Key::Space; io.KeyMap[ImGuiKey_Enter] = (int)entry::Key::Return; io.KeyMap[ImGuiKey_Escape] = (int)entry::Key::Esc; io.KeyMap[ImGuiKey_A] = (int)entry::Key::KeyA; @@ -234,7 +217,29 @@ struct OcornutImguiContext io.KeyMap[ImGuiKey_X] = (int)entry::Key::KeyX; io.KeyMap[ImGuiKey_Y] = (int)entry::Key::KeyY; io.KeyMap[ImGuiKey_Z] = (int)entry::Key::KeyZ; -#endif // defined(SCI_NAMESPACE) + + io.ConfigFlags |= 0 + | ImGuiConfigFlags_NavEnableGamepad + | ImGuiConfigFlags_NavEnableKeyboard + ; + + io.NavInputs[ImGuiNavInput_Activate] = (int)entry::Key::GamepadA; + io.NavInputs[ImGuiNavInput_Cancel] = (int)entry::Key::GamepadB; +// io.NavInputs[ImGuiNavInput_Input] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_Menu] = (int)entry::Key::; + io.NavInputs[ImGuiNavInput_DpadLeft] = (int)entry::Key::GamepadLeft; + io.NavInputs[ImGuiNavInput_DpadRight] = (int)entry::Key::GamepadRight; + io.NavInputs[ImGuiNavInput_DpadUp] = (int)entry::Key::GamepadUp; + io.NavInputs[ImGuiNavInput_DpadDown] = (int)entry::Key::GamepadDown; +// io.NavInputs[ImGuiNavInput_LStickLeft] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_LStickRight] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_LStickUp] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_LStickDown] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_FocusPrev] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_FocusNext] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_TweakSlow] = (int)entry::Key::; +// io.NavInputs[ImGuiNavInput_TweakFast] = (int)entry::Key::; +#endif // USE_ENTRY bgfx::RendererType::Enum type = bgfx::getRendererType(); m_program = bgfx::createProgram( @@ -306,7 +311,7 @@ struct OcornutImguiContext void destroy() { ImGui::ShutdownDockContext(); - ImGui::Shutdown(); + ImGui::DestroyContext(m_imgui); bgfx::destroy(s_tex); bgfx::destroy(m_texture); @@ -332,7 +337,8 @@ struct OcornutImguiContext ImGui::StyleColorsLight(&style); } - style.FrameRounding = 4.0f; + style.FrameRounding = 4.0f; + style.WindowBorderSize = 0.0f; } void beginFrame( @@ -369,7 +375,7 @@ struct OcornutImguiContext io.MouseWheel = (float)(_scroll - m_lastScroll); m_lastScroll = _scroll; -#if defined(SCI_NAMESPACE) +#if USE_ENTRY uint8_t modifiers = inputGetModifiersState(); io.KeyShift = 0 != (modifiers & (entry::Modifier::LeftShift | entry::Modifier::RightShift) ); io.KeyCtrl = 0 != (modifiers & (entry::Modifier::LeftCtrl | entry::Modifier::RightCtrl ) ); @@ -378,20 +384,20 @@ struct OcornutImguiContext { io.KeysDown[ii] = inputGetKeyState(entry::Key::Enum(ii) ); } -#endif // defined(SCI_NAMESPACE) +#endif // USE_ENTRY ImGui::NewFrame(); - ImGui::PushStyleVar(ImGuiStyleVar_ViewId, (float)_viewId); ImGuizmo::BeginFrame(); } void endFrame() { - ImGui::PopStyleVar(1); ImGui::Render(); + render(ImGui::GetDrawData() ); } + ImGuiContext* m_imgui; bx::AllocatorI* m_allocator; bgfx::VertexDecl m_decl; bgfx::ProgramHandle m_program; @@ -407,21 +413,18 @@ struct OcornutImguiContext static OcornutImguiContext s_ctx; -static void* memAlloc(size_t _size) +static void* memAlloc(size_t _size, void* _userData) { + BX_UNUSED(_userData); return BX_ALLOC(s_ctx.m_allocator, _size); } -static void memFree(void* _ptr) +static void memFree(void* _ptr, void* _userData) { + BX_UNUSED(_userData); BX_FREE(s_ctx.m_allocator, _ptr); } -void OcornutImguiContext::renderDrawLists(ImDrawData* _drawData) -{ - s_ctx.render(_drawData); -} - void imguiCreate(float _fontSize, bx::AllocatorI* _allocator) { s_ctx.create(_fontSize, _allocator); @@ -456,8 +459,8 @@ BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunknown-pragmas") //BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-but-set-variable"); // warning: variable ‘L1’ set but not used BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wtype-limits"); // warning: comparison is always true due to limited range of data type -#define STBTT_malloc(_size, _userData) memAlloc(_size) -#define STBTT_free(_ptr, _userData) memFree(_ptr) +#define STBTT_malloc(_size, _userData) memAlloc(_size, _userData) +#define STBTT_free(_ptr, _userData) memFree(_ptr, _userData) #define STB_RECT_PACK_IMPLEMENTATION #include #define STB_TRUETYPE_IMPLEMENTATION diff --git a/3rdparty/bgfx/examples/common/imgui/imgui.h b/3rdparty/bgfx/examples/common/imgui/imgui.h index b3deb59ebe7..4f549670323 100644 --- a/3rdparty/bgfx/examples/common/imgui/imgui.h +++ b/3rdparty/bgfx/examples/common/imgui/imgui.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -7,7 +7,7 @@ #define IMGUI_H_HEADER_GUARD #include -#include +#include #include #include @@ -133,7 +133,7 @@ namespace ImGui { return false || ImGui::IsAnyItemHovered() - || ImGui::IsAnyWindowHovered() + || ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow) ; } diff --git a/3rdparty/bgfx/examples/common/imgui/makefile b/3rdparty/bgfx/examples/common/imgui/makefile index b9648f147fd..13855bc440d 100644 --- a/3rdparty/bgfx/examples/common/imgui/makefile +++ b/3rdparty/bgfx/examples/common/imgui/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/common/imgui/scintilla.cpp b/3rdparty/bgfx/examples/common/imgui/scintilla.cpp index 0b881c091cb..0ab454ab054 100644 --- a/3rdparty/bgfx/examples/common/imgui/scintilla.cpp +++ b/3rdparty/bgfx/examples/common/imgui/scintilla.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/3rdparty/bgfx/examples/common/imgui/scintilla.h b/3rdparty/bgfx/examples/common/imgui/scintilla.h index d555d5f2542..c575a5f403b 100644 --- a/3rdparty/bgfx/examples/common/imgui/scintilla.h +++ b/3rdparty/bgfx/examples/common/imgui/scintilla.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h index 9383f6b3dae..0b27d2d20df 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.bin.h @@ -22,178 +22,76 @@ static const uint8_t vs_imgui_color_glsl[324] = 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // or0 = a_color0;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_imgui_color_spv[2716] = +static const uint8_t vs_imgui_color_spv[1075] = { 0x56, 0x53, 0x48, 0x05, 0xa4, 0x8b, 0xef, 0x49, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH....I...u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x7c, 0x0a, 0x00, 0x00, 0x03, // wProj......|.... - 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, // .#.........Ta... + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x04, 0x00, 0x00, 0x03, // wProj........... + 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, // .#.............. 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, // ................ 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, // ...GLSL.std.450. 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, // ...........main. - 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, // ...............v - 0x13, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, // ................ - 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, // .......main..... - 0x00, 0x04, 0x00, 0x38, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, // ...8...Output... - 0x00, 0x06, 0x00, 0x38, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, // ...8.......gl_Po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x38, 0x04, 0x00, 0x00, 0x01, // sition.....8.... - 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, // ...v_color0..... - 0x00, 0x06, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, // .......@main(vf4 - 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x61, // ;vf3;.......H..a - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, // _color0........, - 0x47, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, // G..a_position... - 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, // ......._varying_ - 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, // .......;...$Glob - 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, // al.....;.......u - 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, // _viewRect......; - 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, // .......u_viewTex - 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, // el.....;.......u - 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, // _view......;.... - 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, // ...u_invView.... - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, // ...;.......u_pro - 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, // j......;.......u - 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, // _invProj.......; - 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // .......u_viewPro - 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, // j......;.......u - 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, // _invViewProj.... - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // ...;.......u_mod - 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, // el.....;.......u - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3b, // _modelView.....; - 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // .......u_modelVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0b, // ewProj.....;.... - 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, // ...u_alphaRef4.. - 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, // ...B............ - 0x41, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, // A..a_color0..... - 0x00, 0x05, 0x00, 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, // .......a_color0. - 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, // .......,?..a_pos - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, // ition..........a - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, // _position....... - 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, // ...flattenTemp.. - 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // ....U..param.... - 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // .......param.... - 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, // .......@entryPoi - 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // ntOutput.gl_Posi - 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x76, 0x13, 0x00, 0x00, 0x40, // tion.......v...@ - 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // entryPointOutput - 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, // .v_color0..G.... - 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // .......@...H...; - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, // .......#.......H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, // ...;.......#.... - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, // ...H...;........ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, // ...H...;.......# - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, // ... ...H...;.... - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, // .......#...`...H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ...;............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, // ...H...;........ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, // ...H...;.......# - 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, // .......H...;.... - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, // .......#.......H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ...;............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, // ...H...;........ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, // ...H...;.......# - 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, // ... ...H...;.... - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, // .......#...`...H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ...;............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, // ...H...;........ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, // ...H...;.......# - 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, // .......H...;.... - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, // .......#.......H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ...;............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, // ...H...;........ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, // ...H...;.......# - 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, // .......H...;.... - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...........H...; - 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, // .......#... ...G - 0x00, 0x03, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, // ...;.......G...B - 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, // ...".......G.... - 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, // ...........G.... - 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, // ...........G.... - 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, // ...........G...v - 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, // ................ - 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, // ...!............ - 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, // ....... ........ - 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, // ........... .... - 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, // ................ - 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, // ........... .... - 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x38, // ...............8 - 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0xc6, // ...........!.... - 0x07, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x20, // ...8........... - 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0x15, // ...........8.... - 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, // ....... .......+ - 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, // ...............+ - 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, // ..............?+ - 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, // ..............., - 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, // ................ - 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, // ...........+.... - 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, // ................ - 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, // ...............e - 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, // ................ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, // ... .......+.... - 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x94, // ...j... ........ - 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x3b, // ...e...j.......; - 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, // ...........e...e - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, // ...e...e...e...e - 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, // .......e...e.... - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3b, // ... ...........; - 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, // ...;.......B.... - 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, // ...+............ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, // ... ...........e - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, // ... ............ - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, // ...;............ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, // ... ............ - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, // ...;............ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, // ... ............ - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, // ...;............ - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, // ...;.......v.... - 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, // ...6............ - 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, // ...........Sa..; - 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, // ...............; - 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, // ........U......; - 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, // ...............= - 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x3d, // ........A......= - 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3e, // .......,?......> - 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, // ....U...A..>.... - 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x38, 0x04, 0x00, 0x00, 0x49, // ...,?..9...8...I - 0x26, 0x00, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, // &.......U......> - 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, // .......I&..A.... - 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, // ...T4..........= - 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, // ...........T4..> - 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, // ...........A.... - 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, // ....@..........= - 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, // ........-...@..> - 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, // ...v....-......8 - 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x38, 0x04, 0x00, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0x00, // ...6...8........ - 0x00, 0x00, 0x00, 0xc6, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf5, // .......7........ - 0x48, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x2c, 0x47, 0x00, 0x00, 0xf8, // H..7.......,G... - 0x00, 0x02, 0x00, 0x51, 0x1d, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb5, 0x06, 0x00, 0x00, 0x0f, // ...Q...;........ - 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x50, // .......A.......P - 0x24, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, // $..........>...P - 0x24, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x81, // $......=........ - 0x29, 0x00, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x2f, // )..,G..O......./ - 0x40, 0x00, 0x00, 0x81, 0x29, 0x00, 0x00, 0x81, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // @...)...)....... - 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6e, 0x59, 0x00, 0x00, 0x2f, // ...Q.......nY../ - 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, // @......Q.......O - 0x5d, 0x00, 0x00, 0x2f, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, // ]../@......P.... - 0x00, 0x00, 0x00, 0xf5, 0x42, 0x00, 0x00, 0x6e, 0x59, 0x00, 0x00, 0x4f, 0x5d, 0x00, 0x00, 0x0c, // ....B..nY..O]... - 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x61, // .......A.......a - 0x23, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, // #..B.......=...e - 0x00, 0x00, 0x00, 0x2b, 0x34, 0x00, 0x00, 0x61, 0x23, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, // ...+4..a#....... - 0x00, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, 0xf5, 0x42, 0x00, 0x00, 0x2b, 0x34, 0x00, 0x00, 0x41, // ....2...B..+4..A - 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x97, 0x2f, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, // ......../....... - 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x97, 0x2f, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, 0x3d, // ...>..../...2..= - 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8e, 0x31, 0x00, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x41, // ........1...H..A - 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9e, 0x4c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, // ........L....... - 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9e, 0x4c, 0x00, 0x00, 0x8e, 0x31, 0x00, 0x00, 0x3d, // ...>....L...1..= - 0x00, 0x04, 0x00, 0x38, 0x04, 0x00, 0x00, 0x30, 0x19, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, // ...8...0........ - 0x00, 0x02, 0x00, 0x30, 0x19, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ...0...8.... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, // ...........main. + 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x47, // ...7...;...D...G + 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, // ................ + 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, // .......main..... + 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, // ...!...$Global.. + 0x00, 0x06, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, // ...!.......u_vie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, // wProj......#.... + 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x37, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // .......7...a_col + 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x61, // or0........;...a + 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x44, // _position......D + 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, // ...@entryPointOu + 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // tput.gl_Position + 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x47, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, // .......G...@entr + 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, // yPointOutput.v_c + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, // olor0..H...!.... + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, // .......H...!.... + 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, // ...#.......H...! + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, // ...............G + 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, // ...!.......G...# + 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x37, // ...".......G...7 + 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, // ...........G...; + 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x44, // ...........G...D + 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, // ...........G...G + 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, // ................ + 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, // ...!............ + 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, // ....... ........ + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, // ................ + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x13, // ................ + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, // ... .......+.... + 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x06, // ..........?+.... + 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x13, // ...........+.... + 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x20, // ............... + 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x21, // ...............! + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, // ... ... ...".... + 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, // ...!...;..."...# + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, // ....... ...$.... + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, // ... ... ...6.... + 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x37, // .......;...6...7 + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, // ....... ...:.... + 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, // .......;...:...; + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x03, // ....... ...C.... + 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x44, // .......;...C...D + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x47, // .......;...C...G + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, // .......6........ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, // ................ + 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x37, // ...=.......8...7 + 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, // ...=.......<...; + 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x3c, // ...Q......._...< + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, // .......Q.......` + 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, // ...<.......P.... + 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x16, // ...a..._...`.... + 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, 0x62, // .......A...$...b + 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x20, // ...#.......=... + 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, // ...c...b........ + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x51, // ...d...a...c...Q + 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, // .......i...d.... + 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x69, // ...........j...i + 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x6a, // ...R...........j + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x44, // ...d.......>...D + 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x47, 0x00, 0x00, 0x00, 0x38, // .......>...G...8 + 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x01, // .......8........ + 0x00, 0x40, 0x00, // .@. }; static const uint8_t vs_imgui_color_dx9[284] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.sc b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.sc index f5c42aa9bae..9c2eb59115e 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.sc +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_color.sc @@ -2,7 +2,7 @@ $input a_position, a_color0 $output v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h index fda39d3e965..4ac06ee43dd 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h @@ -22,180 +22,79 @@ static const uint8_t vs_imgui_cubemap_glsl[329] = 0x72, 0x6d, 0x61, 0x6c, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x2e, // rmal = a_normal. 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // xyz;.}... }; -static const uint8_t vs_imgui_cubemap_spv[2741] = +static const uint8_t vs_imgui_cubemap_spv[1136] = { 0x56, 0x53, 0x48, 0x05, 0xe3, 0xc2, 0x5c, 0x65, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH....e...u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x90, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ......#......... - 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x44, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // D.....#......... + 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x46, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main....F....... - 0x95, 0x15, 0x00, 0x00, 0x33, 0x13, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // ....3........... - 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x29, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, // ........)...Outp - 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x29, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ut......)....... - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, // gl_Position..... - 0x29, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, // ).......v_normal - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // ............@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // n(vf4;vf3;...... - 0xf5, 0x48, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, // .H..a_normal.... - 0x05, 0x00, 0x05, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....,G..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, // on.........._var - 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ying_........... - 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // $Global......... - 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, // ....u_viewRect.. - 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ewTexel......... - 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....u_view...... - 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, // ........u_invVie - 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // w............... - 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // u_proj.......... - 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, // ....u_invProj... - 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x99, 0x02, 0x00, 0x00, // ewProj.......... - 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ....u_invViewPro - 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // j............... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x99, 0x02, 0x00, 0x00, // u_model......... - 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, // ....u_modelView. - 0x06, 0x00, 0x07, 0x00, 0x99, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, // delViewProj..... - 0x99, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, // ........u_alphaR - 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ef4.....B....... - 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, // .....A..a_normal - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x46, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, // ........F...a_no - 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, // rmal........,?.. - 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... - 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ....a_position.. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, // main....7...;... + 0x44, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // D...H........... + 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, // ........ ...$Glo + 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // bal..... ....... + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. + 0x05, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // ...."........... + 0x37, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, 0x00, 0x00, // 7...a_normal.... + 0x05, 0x00, 0x05, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....;...a_positi + 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x44, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // on......D...@ent 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x33, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // 3...@entryPointO + 0x48, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // H...@entryPointO 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x00, 0x00, // utput.v_normal.. - 0x47, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // G...7.......@... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // #.......H....... - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x99, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x99, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x99, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x05, 0x00, 0x99, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x99, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...G........... - 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...B..."....... - 0x47, 0x00, 0x04, 0x00, 0x46, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...F........... - 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x33, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...3........... - 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, // ........!....... - 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x1e, 0x00, 0x04, 0x00, 0x29, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ....)........... - 0x21, 0x00, 0x05, 0x00, 0xa8, 0x07, 0x00, 0x00, 0x29, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, // !.......)....... - 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xa6, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x29, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // )........... ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, // ...?,.......r... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // 7...e...j....... - 0x99, 0x02, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...7...e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x99, 0x02, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x05, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ....;.......B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // e... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x46, 0x14, 0x00, 0x00, // ....;.......F... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x33, 0x13, 0x00, 0x00, // ....;.......3... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0xa6, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x46, 0x14, 0x00, 0x00, // =........A..F... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =.......,?...... - 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x29, 0x04, 0x00, 0x00, // ....,?..9...)... - 0x49, 0x26, 0x00, 0x00, 0x0e, 0x0c, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // I&.......U...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x95, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x33, 0x13, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >...3....-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x29, 0x04, 0x00, 0x00, 0x0e, 0x0c, 0x00, 0x00, // 8...6...)....... - 0x00, 0x00, 0x00, 0x00, 0xa8, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........7....... - 0xf5, 0x48, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x2c, 0x47, 0x00, 0x00, // .H..7.......,G.. - 0xf8, 0x00, 0x02, 0x00, 0x51, 0x1d, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xa6, 0x06, 0x00, 0x00, // ....Q...;....... - 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, // ........A....... - 0x50, 0x24, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // P$..........>... - 0x50, 0x24, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // P$..r...=....... - 0x27, 0x28, 0x00, 0x00, 0x2c, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // '(..,G..Q....... - 0xac, 0x4a, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // .J..'(......Q... - 0x0d, 0x00, 0x00, 0x00, 0x7c, 0x57, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....|W..'(...... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1d, 0x19, 0x00, 0x00, 0x27, 0x28, 0x00, 0x00, // Q...........'(.. - 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf5, 0x42, 0x00, 0x00, // ....P........B.. - 0xac, 0x4a, 0x00, 0x00, 0x7c, 0x57, 0x00, 0x00, 0x1d, 0x19, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // .J..|W.......... - 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x61, 0x23, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A.......a#..B... - 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2b, 0x34, 0x00, 0x00, // )...=...e...+4.. - 0x61, 0x23, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, // a#...........2.. - 0xf5, 0x42, 0x00, 0x00, 0x2b, 0x34, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // .B..+4..A....... - 0x97, 0x2f, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ./..........>... - 0x97, 0x2f, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // ./...2..=....... - 0x51, 0x28, 0x00, 0x00, 0xf5, 0x48, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, // Q(...H..O....... - 0x96, 0x49, 0x00, 0x00, 0x51, 0x28, 0x00, 0x00, 0x51, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .I..Q(..Q(...... - 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, // ........A....... - 0x73, 0x5b, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // s[..........>... - 0x73, 0x5b, 0x00, 0x00, 0x96, 0x49, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x29, 0x04, 0x00, 0x00, // s[...I..=...)... - 0x30, 0x19, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x30, 0x19, 0x00, 0x00, // 0...........0... - 0x38, 0x00, 0x01, 0x00, 0x00, // 8.... + 0x48, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H... ........... + 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H... .......#... + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H... ....... + 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, // ........G... ... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G..."..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...7....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...;....... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....G...D....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...H....... + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ............... + 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, // ....+........... + 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, // ...?+........... + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ........ ....... + 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ...!....... ... + 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...!..."....... + 0x20, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, // ...#........... + 0x20, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...6........... + 0x3b, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...6...7....... + 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...:........... + 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;...:...;....... + 0x20, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ...C........... + 0x3b, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...C...D....... + 0x20, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...G........... + 0x3b, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;...G...H....... + 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... + 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x07, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....8...7...=... + 0x09, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....<...;...Q... + 0x06, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...._...<....... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // Q.......`...<... + 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, // ....Q.......a... + 0x3c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, // <.......P....... + 0x62, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, // b..._...`...a... + 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x23, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, // ....A...#...c... + 0x22, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, // ".......=....... + 0x64, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // d...c........... + 0x65, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, // e...b...d...O... + 0x09, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, // ....h...8...8... + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x06, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....k...e....... + 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, // ........l...k... + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, // R...........l... + 0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x44, 0x00, 0x00, 0x00, // e.......>...D... + 0x83, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // ....>...H...h... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x00, 0x40, 0x00, // ....8.........@. }; static const uint8_t vs_imgui_cubemap_dx9[313] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.sc b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.sc index 7f68b53e860..d2cd9242e54 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.sc +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_cubemap.sc @@ -2,7 +2,7 @@ $input a_position, a_normal $output v_normal /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h index 05a195cac28..05bc8959c59 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_image.bin.h @@ -22,180 +22,78 @@ static const uint8_t vs_imgui_image_glsl[336] = 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, // v_texcoord0 = a 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _texcoord0;.}... }; -static const uint8_t vs_imgui_image_spv[2744] = +static const uint8_t vs_imgui_image_spv[1111] = { 0x56, 0x53, 0x48, 0x05, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH.o.><...u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x98, 0x0a, 0x00, 0x00, 0x03, // wProj........... - 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x37, 0x62, 0x00, 0x00, 0x00, // .#.........7b... + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0x30, 0x04, 0x00, 0x00, 0x03, // wProj......0.... + 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, // .#.............. 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, // ................ 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, // ...GLSL.std.450. 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, // ...........main. - 0x00, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x8b, // ................ - 0x17, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, // ................ - 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, // .......main..... - 0x00, 0x04, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, // .......Output... - 0x00, 0x06, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, // ...........gl_Po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x01, // sition.......... - 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, // ...v_texcoord0.. - 0x00, 0x06, 0x00, 0xbc, 0x0e, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x33, // .......@main(vf3 - 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa2, 0x3c, 0x00, 0x00, 0x61, // ;vf2;.......<..a - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xc4, // _position....... - 0x1d, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, // ...a_texcoord0.. - 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, // ......._varying_ - 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, // .......;...$Glob - 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, // al.....;.......u - 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, // _viewRect......; - 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, // .......u_viewTex - 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, // el.....;.......u - 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, // _view......;.... - 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, // ...u_invView.... - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, // ...;.......u_pro - 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, // j......;.......u - 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, // _invProj.......; - 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // .......u_viewPro - 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, // j......;.......u - 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, // _invViewProj.... - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // ...;.......u_mod - 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, // el.....;.......u - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3b, // _modelView.....; - 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // .......u_modelVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0b, // ewProj.....;.... - 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, // ...u_alphaRef4.. - 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, // ...B............ - 0x41, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, // A..a_position... - 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // .......a_positio - 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, // n......,?..a_tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x61, // coord0.........a - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, // _texcoord0...... - 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, // ...flattenTemp.. - 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // ....U..param.... - 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // .......param.... - 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, // .......@entryPoi - 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // ntOutput.gl_Posi - 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, // tion...........@ - 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // entryPointOutput - 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, // .v_texcoord0...G - 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, // ...........@...H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, // ...;.......#.... - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, // ...H...;.......# - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, // .......H...;.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, // .......H...;.... - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...#... ...H...; - 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, // ...............H - 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, // ...;...........H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, // ...;.......#...` - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, // ...H...;........ - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, // .......H...;.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, // .......H...;.... - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...#.......H...; - 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, // ...............H - 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, // ...;...........H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, // ...;.......#.... - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, // ...H...;........ - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, // .......H...;.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, // .......H...;.... - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...#... ...H...; - 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, // ...............H - 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, // ...;...........H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, // ...;.......#...` - 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, // ...H...;........ - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, // .......H...;.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, // .......H...;.... - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...#.......H...; - 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, // ...............H - 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, // ...;...........H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, // ...;.......#.... - 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, // ...H...;........ - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, // .......H...;.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, // .......H...;.... - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, // ...#.......H...; - 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, // ...............H - 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, // ...;.......#... - 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, // ...G...;.......G - 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...B...".......G - 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...............G - 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, // ...............G - 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...............G - 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, // ................ - 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, // .......!........ - 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, // ........... .... - 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, // ................ - 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, // ................ - 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, // ................ - 0x00, 0x04, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x21, // ...............! - 0x00, 0x05, 0x00, 0x67, 0x07, 0x00, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x90, // ...g............ - 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x97, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1a, // ... ............ - 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, // ........... .... - 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, // ...+............ - 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, // ...+............ - 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x0c, // ...,............ - 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, // .......+........ - 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, // .......+........ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, // ......?....e.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, // .......+.......j - 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x65, // ... ...........e - 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x1d, // ...j.......;.... - 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, // .......e...e...e - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x94, // ...e...e...e.... - 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, // ...e...e....... - 0x00, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x3b, // ...........;...; - 0x00, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, // .......B.......+ - 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, // ...........e... - 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, // ...............; - 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, // ...............; - 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, // ...............; - 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, // ...............; - 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, // ...............6 - 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // ................ - 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, // .......Sa..;.... - 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, // ...........;.... - 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, // ....U......;.... - 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, // ...........=.... - 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, // ....A......=.... - 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, // ...,?......>.... - 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x2c, // U...A..>......., - 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0xbc, // ?..9.......I&... - 0x0e, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, // ....U......>.... - 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, // ...I&..A.......T - 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, // 4..........=.... - 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, // .......T4..>.... - 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xee, // .......A........ - 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, // @..........=.... - 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8b, // ....-...@..>.... - 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, // ....-......8...6 - 0x00, 0x05, 0x00, 0x1a, 0x04, 0x00, 0x00, 0xbc, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, // ...............g - 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xa2, 0x3c, 0x00, 0x00, 0x37, // ...7........<..7 - 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xc4, 0x1d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x5f, // ..............._ - 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, // W..;............ - 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0x18, 0x2d, 0x00, 0x00, 0x0f, // ...A........-... - 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x2d, 0x00, 0x00, 0x1f, // .......>....-... - 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x19, 0x00, 0x00, 0xa2, // ...=............ - 0x3c, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0xbe, 0x2f, 0x00, 0x00, 0x10, // <..O......../... - 0x19, 0x00, 0x00, 0x10, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, // ...............Q - 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x36, 0x62, 0x00, 0x00, 0xbe, 0x2f, 0x00, 0x00, 0x00, // .......6b.../... - 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x98, 0x1b, 0x00, 0x00, 0xbe, // ...Q............ - 0x2f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x84, // /......P........ - 0x32, 0x00, 0x00, 0x36, 0x62, 0x00, 0x00, 0x98, 0x1b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, // 2..6b........... - 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x42, // ...A.......),..B - 0x13, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xf3, // .......=...e.... - 0x3c, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9f, // <..),........... - 0x3b, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, // ;...2...<..A.... - 0x02, 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, // ..._8..........> - 0x00, 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, // ..._8...;..=.... - 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0xc4, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, // ....!......A.... - 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, // ...-<..........> - 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1a, // ...-<...!..=.... - 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x47, // ...G:..........G - 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // :..8.... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, // ...........main. + 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x49, // ...8...<...E...I + 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, // ................ + 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, // .......main..... + 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, // ...!...$Global.. + 0x00, 0x06, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, // ...!.......u_vie + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, // wProj......#.... + 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x38, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, // .......8...a_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x61, // ition......<...a + 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x45, // _texcoord0.....E + 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, // ...@entryPointOu + 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // tput.gl_Position + 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x49, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, // .......I...@entr + 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, // yPointOutput.v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x21, // excoord0...H...! + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, // ...........H...! + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, // .......#.......H + 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ...!............ + 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, // ...G...!.......G + 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...#...".......G + 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...8...........G + 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, // ...<...........G + 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...E...........G + 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, // ...I............ + 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, // .......!........ + 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, // ........... .... + 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, // ................ + 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, // ................ + 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, // ................ + 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, // ....... .......+ + 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, // ...............+ + 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, // ...............+ + 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, // ..............?. + 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, // ... ............ + 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x22, // ...!... ... ..." + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x22, // .......!...;..." + 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, // ...#....... ...$ + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x37, // ....... ... ...7 + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x37, // ...........;...7 + 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3b, // ...8....... ...; + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3b, // ...........;...; + 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x44, // ...<....... ...D + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x44, // ...........;...D + 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x48, // ...E....... ...H + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, // ...........;...H + 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, // ...I.......6.... + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, // ................ + 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, // .......=.......9 + 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3d, // ...8...=.......= + 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x61, // ...<...Q.......a + 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, // ...9.......Q.... + 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, // ...b...9.......P + 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x62, // .......c...a...b + 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x24, // ...........A...$ + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3d, // ...d...#.......= + 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x90, // ... ...e...d.... + 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x65, // .......f...c...e + 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x66, // ...Q.......k...f + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, // ...............l + 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x83, // ...k...R........ + 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, // ...l...f.......> + 0x00, 0x03, 0x00, 0x45, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x49, // ...E.......>...I + 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ...=.......8.... + 0x02, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // .....@. }; static const uint8_t vs_imgui_image_dx9[284] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h index 6e70cf9e57f..b02c76d866d 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h @@ -23,180 +23,79 @@ static const uint8_t vs_imgui_latlong_glsl[337] = 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, // a_texcoord0;.}.. 0x00, // . }; -static const uint8_t vs_imgui_latlong_spv[2741] = +static const uint8_t vs_imgui_latlong_spv[1124] = { 0x56, 0x53, 0x48, 0x05, 0x6f, 0x1e, 0x3e, 0x3c, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH.o.><...u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x90, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ......#......... - 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 6b.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x38, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // 8.....#......... + 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // main............ - 0x95, 0x15, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ - 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, // ............Outp - 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ut.............. - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, // gl_Position..... - 0x1a, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ........v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xbc, 0x0e, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // n(vf3;vf2;...... - 0xa2, 0x3c, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // .<..a_position.. - 0x05, 0x00, 0x05, 0x00, 0xc4, 0x1d, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ........a_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, // rd0........._var - 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, // ying_.......;... - 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, // $Global.....;... - 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, // ....u_viewRect.. - 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ....;.......u_vi - 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, // ewTexel.....;... - 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....u_view...... - 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, // ;.......u_invVie - 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // w.......;....... - 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, // u_proj......;... - 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, // ....u_invProj... - 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ....;.......u_vi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x3b, 0x06, 0x00, 0x00, // ewProj......;... - 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ....u_invViewPro - 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // j.......;....... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x3b, 0x06, 0x00, 0x00, // u_model.....;... - 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, // ....u_modelView. - 0x06, 0x00, 0x07, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ....;.......u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, // delViewProj..... - 0x3b, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, // ;.......u_alphaR - 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ef4.....B....... - 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....A..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, // sition......,?.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // main....8...<... + 0x45, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // E...I........... + 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, // ........!...$Glo + 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // bal.....!....... + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. + 0x05, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // ....#........... + 0x38, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // 8...a_position.. + 0x05, 0x00, 0x05, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....<...a_texcoo + 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x45, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // rd0.....E...@ent 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // _Position....... - 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO + 0x49, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // I...@entryPointO 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord - 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // 0...G........... - 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // @...H...;....... - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, // #.......H...;... - 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ....#.......H... - 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ;...........H... - 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ;.......#... ... - 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...;........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....H...;....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....H...;....... - 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, // #...`...H...;... - 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ;...........H... - 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, // ;.......#....... - 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...;........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H...;....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H...;....... - 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, // #.......H...;... - 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x3b, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ;...........H... - 0x3b, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, // ;.......#... ... - 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...;........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....H...;....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....H...;....... - 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, // #...`...H...;... - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ;...........H... - 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, // ;.......#....... - 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...;........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H...;....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H...;....... - 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, // #.......H...;... - 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x3b, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ;...........H... - 0x3b, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, // ;.......#....... - 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...;........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x3b, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....H...;....... - 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x3b, 0x06, 0x00, 0x00, // #... ...G...;... - 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...B..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....G........... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G........... - 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... - 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ............... - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ................ - 0x13, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x67, 0x07, 0x00, 0x00, 0x1a, 0x04, 0x00, 0x00, // ....!...g....... - 0x95, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x97, 0x06, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1a, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // .......+....... - 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........+....... - 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // ........,....... - 0x1f, 0x07, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, 0x00, // ...........?.... - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x94, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // ....e...j....... - 0x3b, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ;...........e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e.......e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x3b, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb8, 0x08, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ;...;.......B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // e... ........... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0x97, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......,?...... - 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x1a, 0x04, 0x00, 0x00, // ....,?..9....... - 0x49, 0x26, 0x00, 0x00, 0xbc, 0x0e, 0x00, 0x00, 0xab, 0x55, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // I&.......U...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x90, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1a, 0x04, 0x00, 0x00, 0xbc, 0x0e, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0x67, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, // ....g...7....... - 0xa2, 0x3c, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xc4, 0x1d, 0x00, 0x00, // .<..7........... - 0xf8, 0x00, 0x02, 0x00, 0x5f, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x97, 0x06, 0x00, 0x00, // ...._W..;....... - 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, // ........A....... - 0x18, 0x2d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .-..........>... - 0x18, 0x2d, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // .-......=....... - 0x35, 0x62, 0x00, 0x00, 0xa2, 0x3c, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // 5b...<..Q....... - 0x3b, 0x3a, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ;:..5b......Q... - 0x0d, 0x00, 0x00, 0x00, 0x0b, 0x47, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .....G..5b...... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x53, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, // Q.......+S..5b.. - 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, // ....P........2.. - 0x3b, 0x3a, 0x00, 0x00, 0x0b, 0x47, 0x00, 0x00, 0x2b, 0x53, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ;:...G..+S...... - 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A.......),..B... - 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, // )...=...e....<.. - 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, // ),...........;.. - 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // .2...<..A....... - 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // _8..........>... - 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // _8...;..=....... - 0x1d, 0x21, 0x00, 0x00, 0xc4, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, // .!......A....... - 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // -<..........>... - 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1a, 0x04, 0x00, 0x00, // -<...!..=....... - 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, // G:..........G:.. - 0x38, 0x00, 0x01, 0x00, 0x00, // 8.... + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...!....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...!....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, // #.......H...!... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, // !.......G...#... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, // ".......G...8... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, // ........G...<... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, // ........G...E... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, // ........G...I... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // .......+....... + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // ........+....... + 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x18, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, // .......?.... ... + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, // ............!... + 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ... ..."....... + 0x21, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // !...;..."...#... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...$....... + 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ... ...7....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, // ....;...7...8... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...;....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....;...;...<... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...D....... + 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, // ....;...D...E... + 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...H....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, // ....;...H...I... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, // =.......9...8... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // =.......=...<... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, // Q.......`...9... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, // ....Q.......a... + 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // 9.......Q....... + 0x62, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // b...9.......P... + 0x0b, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, // ....c...`...a... + 0x62, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, // b.......A...$... + 0x64, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // d...#.......=... + 0x20, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // ...e...d....... + 0x0b, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ....f...c...e... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, // Q.......k...f... + 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, // ............l... + 0x6b, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, // k...R........... + 0x6c, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // l...f.......>... + 0x45, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x49, 0x00, 0x00, 0x00, // E.......>...I... + 0x3d, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // =.......8....... + 0x10, 0x00, 0x40, 0x00, // ..@. }; static const uint8_t vs_imgui_latlong_dx9[313] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h index d2a8f3748a5..4270e2752d7 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.bin.h @@ -28,209 +28,89 @@ static const uint8_t vs_imgui_texture_glsl[419] = 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, // r0 = a_color0;.} 0x0a, 0x0a, 0x00, // ... }; -static const uint8_t vs_imgui_texture_spv[3212] = +static const uint8_t vs_imgui_texture_spv[1285] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie - 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x6c, 0x0c, 0x00, 0x00, 0x03, // wProj......l.... - 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, // .#.........Ta... + 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x03, // wProj........... + 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, // .#.............. 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, // ................ 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, // ...GLSL.std.450. 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, // ................ - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, // ...........main. - 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x95, // ................ - 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, // ...v............ - 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, // ...............m - 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x64, 0x04, 0x00, 0x00, 0x4f, // ain........d...O - 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x00, // utput......d.... - 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, // ...gl_Position.. - 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // ...d.......v_col - 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x02, // or0........d.... - 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, // ...v_texcoord0.. - 0x00, 0x07, 0x00, 0xad, 0x11, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, // .......@main(vf4 - 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe2, // ;vf3;vf2;....... - 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, // ...a_color0..... - 0x00, 0x05, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // .../B..a_positio - 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x10, 0x46, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, // n.......F..a_tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, // coord0........._ - 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xdf, // varying_........ - 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, // ...$Global...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, // .......u_viewRec - 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, // t..............u - 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xdf, // _viewTexel...... - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, // .......u_view... - 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, // ...........u_inv - 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x04, // View............ - 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, // ...u_proj....... - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, // .......u_invProj - 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, // ...............u - 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xdf, // _viewProj....... - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, // .......u_invView - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x08, // Proj............ - 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xdf, // ...u_model...... - 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // .......u_modelVi - 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, // ew.............u - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, // _modelViewProj.. - 0x00, 0x06, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, // ...........u_alp - 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, // haRef4.....B.... - 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // ........A..a_col - 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x89, 0x14, 0x00, 0x00, 0x61, // or0............a - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xd9, // _color0......... - 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, // ?..a_position... - 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // .......a_positio - 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, // n......@,..a_tex - 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x61, // coord0.........a - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, // _texcoord0...... - 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, // ...flattenTemp.. - 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // ....U..param.... - 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // ....8..param.... - 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, // .......param.... - 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, // .......@entryPoi - 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, // ntOutput.gl_Posi - 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x76, 0x13, 0x00, 0x00, 0x40, // tion.......v...@ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, // ...........main. + 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x51, // ...>...B...F...Q + 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, // ...T...X........ + 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, // ...............m + 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x24, // ain........&...$ + 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, // Global.....&.... + 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x05, // ...u_viewProj... + 0x00, 0x03, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3e, // ...(...........> + 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, // ...a_color0..... + 0x00, 0x05, 0x00, 0x42, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // ...B...a_positio + 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x46, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, // n......F...a_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x51, 0x00, 0x00, 0x00, 0x40, // coord0.....Q...@ 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // entryPointOutput - 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x8b, // .v_color0....... - 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, // ...@entryPointOu - 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tput.v_texcoord0 - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x65, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, // ...G...e.......@ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, // ...H...........# - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x01, // .......H........ - 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, // ...#.......H.... - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, // .......#... ...H - 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ................ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, // ...H............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, // ...H...........# - 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x03, // ...`...H........ - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, // .......#.......H - 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ................ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, // ...H............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, // ...H...........# - 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x05, // .......H........ - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, // .......#... ...H - 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ................ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, // ...H............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, // ...H...........# - 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x07, // ...`...H........ - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, // .......#.......H - 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ................ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, // ...H............ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, // ...H...........# - 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, // .......H........ - 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, // ...........H.... - 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, // .......#.......H - 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ................ - 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, // ...H...........# - 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x02, // ... ...G........ - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, // ...G...B...".... - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, // ...G............ - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, // ...G............ - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, // ...G............ - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, // ...G............ - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, // ...G...v........ - 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, // ...G............ - 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, // ...........!.... - 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, // ............... - 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, // ................ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, // ... ............ - 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, // ... ............ - 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, // ................ - 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, // ... ............ - 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, // .......d........ - 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x03, 0x09, 0x00, 0x00, 0x64, // .......!.......d - 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, // ............... - 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x04, 0x00, 0x00, 0x15, // ...........d.... - 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, // ....... .......+ - 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, // ...............+ - 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, // ..............?+ - 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, // ..............., - 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, // ................ - 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, // ...........+.... - 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, // ...........,.... - 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, // ...............+ - 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, // ................ - 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, // ...e............ - 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, // ....... .......+ - 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, // .......j... .... - 0x00, 0x04, 0x00, 0x65, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, // ...e...e...j.... - 0x00, 0x0e, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, // ...............e - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, // ...e...e...e...e - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, // ...e...e...e...e - 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5c, 0x03, 0x00, 0x00, 0x02, // ....... ........ - 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5c, 0x03, 0x00, 0x00, 0x42, // .......;.......B - 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, // .......+........ - 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, // ....... ........ - 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, // ...e... ........ - 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, // .......;........ - 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, // ....... ........ - 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, // .......;........ - 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, // ....... ........ - 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, // .......;........ - 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, // ....... ........ - 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, // .......;........ - 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, // .......;.......v - 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x03, // ....... ........ - 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x8b, // .......;........ - 0x17, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, // .......6........ - 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, // ...............S - 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, // a..;............ - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, // ...;........U... - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, // ...;........8... - 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, // ...;............ - 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, // ...=........A... - 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, // ...=........?... - 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, // ...=.......@,... - 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, // ...>....U...A..> - 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, // ....8...?..>.... - 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x64, 0x04, 0x00, 0x00, 0x49, // ...@,..9...d...I - 0x26, 0x00, 0x00, 0xad, 0x11, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, // &.......U...8... - 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, // ...>.......I&..A - 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, // .......T4....... - 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, // ...=...........T - 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, // 4..>...........A - 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, // ........@....... - 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, // ...=....... .... - 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, // @..>...v... ...A - 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, // ........@....... - 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, // ...=........-... - 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, // @..>........-... - 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, 0xad, // ...8...6...d.... - 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, // ...........7.... - 0x02, 0x00, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x2f, // .......7......./ - 0x42, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0xf8, // B..7........F... - 0x00, 0x02, 0x00, 0x70, 0x1e, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x0f, // ...p...;........ - 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbb, // .......A........ - 0x25, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbb, // %..........>.... - 0x25, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9b, // %......A........ - 0x49, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9b, // I..........>.... - 0x49, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa0, // I......=........ - 0x2a, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x4e, // *../B..O.......N - 0x41, 0x00, 0x00, 0xa0, 0x2a, 0x00, 0x00, 0xa0, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // A...*...*....... - 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8d, 0x5a, 0x00, 0x00, 0x4e, // ...Q........Z..N - 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6e, // A......Q.......n - 0x5e, 0x00, 0x00, 0x4e, 0x41, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, // ^..NA......P.... - 0x00, 0x00, 0x00, 0x14, 0x44, 0x00, 0x00, 0x8d, 0x5a, 0x00, 0x00, 0x6e, 0x5e, 0x00, 0x00, 0x0c, // ....D...Z..n^... - 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x80, // .......A........ - 0x24, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, // $..B.......=...e - 0x00, 0x00, 0x00, 0x4a, 0x35, 0x00, 0x00, 0x80, 0x24, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, // ...J5...$....... - 0x00, 0x00, 0x00, 0xf6, 0x33, 0x00, 0x00, 0x14, 0x44, 0x00, 0x00, 0x4a, 0x35, 0x00, 0x00, 0x41, // ....3...D..J5..A - 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb6, 0x30, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, // ........0....... - 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb6, 0x30, 0x00, 0x00, 0xf6, 0x33, 0x00, 0x00, 0x3d, // ...>....0...3..= - 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0x41, // ........2...F..A - 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xbd, 0x4d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, // ........M....... - 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbd, 0x4d, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, 0x3d, // ...>....M...2..= - 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xae, 0x32, 0x00, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x41, // ........2......A - 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbe, 0x4d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, // ........M....... - 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x4d, 0x00, 0x00, 0xae, 0x32, 0x00, 0x00, 0x3d, // ...>....M...2..= - 0x00, 0x04, 0x00, 0x64, 0x04, 0x00, 0x00, 0xf6, 0x31, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, // ...d....1....... - 0x00, 0x02, 0x00, 0xf6, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ....1..8.... + 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, // .gl_Position.... + 0x00, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, // ...T...@entryPoi + 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ntOutput.v_color + 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x58, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, // 0......X...@entr + 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, // yPointOutput.v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x26, // excoord0...H...& + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x26, // ...........H...& + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, // .......#.......H + 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, // ...&............ + 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, // ...G...&.......G + 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...(...".......G + 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...>...........G + 0x00, 0x04, 0x00, 0x42, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, // ...B...........G + 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, // ...F...........G + 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...Q...........G + 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, // ...T...........G + 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, // ...X............ + 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, // .......!........ + 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, // ........... .... + 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, // ................ + 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, // ................ + 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, // ................ + 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, // ....... .......+ + 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, // ..............?+ + 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, // ...............+ + 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, // ................ + 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, // ...%............ + 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x27, // ...&...%... ...' + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x27, // .......&...;...' + 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x29, // ...(....... ...) + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3d, // .......%... ...= + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3d, // ...........;...= + 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x41, // ...>....... ...A + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x41, // ...........;...A + 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x45, // ...B....... ...E + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x45, // ...........;...E + 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x50, // ...F....... ...P + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x50, // ...........;...P + 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x50, // ...Q.......;...P + 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x57, // ...T....... ...W + 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x57, // ...........;...W + 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, // ...X.......6.... + 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, // ................ + 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3f, // .......=.......? + 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x43, // ...>...=.......C + 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x47, // ...B...=.......G + 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x71, // ...F...Q.......q + 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, // ...C.......Q.... + 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, // ...r...C.......P + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x72, // .......s...q...r + 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x29, // ...........A...) + 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3d, // ...t...(.......= + 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x90, // ...%...u...t.... + 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x75, // .......v...s...u + 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x76, // ...Q.......}...v + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7e, // ...............~ + 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x9c, // ...}...R........ + 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, // ...~...v.......> + 0x00, 0x03, 0x00, 0x51, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x54, // ...Q.......>...T + 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x58, 0x00, 0x00, 0x00, 0x47, // ...?...>...X...G + 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, // .......8........ + 0x00, 0x10, 0x00, 0x40, 0x00, // ...@. }; static const uint8_t vs_imgui_texture_dx9[320] = { diff --git a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.sc b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.sc index b40aa9b82fc..c2e9aa11a12 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.sc +++ b/3rdparty/bgfx/examples/common/imgui/vs_imgui_texture.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0, a_color0 $output v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h index aca91da5667..3a6c6a1b934 100644 --- a/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h +++ b/3rdparty/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h @@ -34,222 +34,92 @@ static const uint8_t vs_ocornut_imgui_glsl[523] = 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, // v_color0 = a_c 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // olor0;.}... }; -static const uint8_t vs_ocornut_imgui_spv[3421] = +static const uint8_t vs_ocornut_imgui_spv[1342] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0b, 0x75, 0x5f, 0x76, 0x69, 0x65, // VSH........u_vie - 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x3c, 0x0d, 0x00, 0x00, // wTexel......<... - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x65, 0x61, 0x00, 0x00, // ..#.........ea.. + 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x14, 0x05, 0x00, 0x00, // wTexel.......... + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xb0, 0x00, 0x00, 0x00, // ..#............. 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, // ................ 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, // ....GLSL.std.450 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main - 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ................ - 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, // ....v........... - 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x64, 0x04, 0x00, 0x00, // main........d... - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, // Output......d... - 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, // ....gl_Position. - 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, // ....d.......v_co - 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, // lor0........d... - 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....v_texcoord0. - 0x05, 0x00, 0x07, 0x00, 0xad, 0x11, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, // ........@main(vf - 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // 4;vf3;vf2;...... - 0xe2, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ..../B..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x10, 0x46, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, // on.......F..a_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, 0x00, 0x00, // xcoord0......... - 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, // _varying_....... - 0xe5, 0x10, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ....pos......... - 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // $Global......... - 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, // ....u_viewRect.. - 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ewTexel......... - 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....u_view...... - 0x00, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, // ........u_invVie - 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // w............... - 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // u_proj.......... - 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, // ....u_invProj... - 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, // ewProj.......... - 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ....u_invViewPro - 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // j............... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // u_model......... - 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, // ....u_modelView. - 0x06, 0x00, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, // delViewProj..... - 0x00, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, // ........u_alphaR - 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ef4.....B....... - 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // .....A..a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ............a_co - 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, // lor0.........?.. - 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... - 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ....a_position.. - 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....@,..a_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, // rd0.........a_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, // xcoord0......... - 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, // flattenTemp..... - 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .U..param....... - 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .8..param....... - 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // ....param....... - 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // utput.gl_Positio - 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // n.......v...@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, // ryPointOutput.v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, // color0.......... + 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, // ....F...J...N... + 0x59, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, // Y.......`....... + 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, // main........$... + 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x00, 0x00, 0x00, // $Global.....$... + 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. + 0x05, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // ....&........... + 0x46, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // F...a_color0.... + 0x05, 0x00, 0x05, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // ....J...a_positi + 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, // on......N...a_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x59, 0x00, 0x00, 0x00, // xcoord0.....Y... 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu - 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, // t.v_texcoord0... - 0x47, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // G...........@... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....H........... - 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // #.......H....... - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x00, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#... ...H... - 0x00, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // `...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x00, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x00, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...G........... - 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...B..."....... - 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G............... - 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // G...v........... - 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // G............... - 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, // ........!....... - 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, // ............... - 0x1e, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....d........... - 0x13, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x03, 0x09, 0x00, 0x00, 0x64, 0x04, 0x00, 0x00, // ....!.......d... - 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... - 0xe1, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ........d....... - 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, // ...........?+... - 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, // ............,... - 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ................ - 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... - 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // ........,....... - 0x1f, 0x07, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x04, 0x00, // ...........@.... - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0x08, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // ....e...j....... - 0x00, 0x09, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e.......e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7d, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...}....... - 0x00, 0x09, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7d, 0x0b, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ....;...}...B... - 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9d, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9d, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9d, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, // ....;.......v... - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, // .8...?..>....... - 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x64, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // @,..9...d...I&.. - 0xad, 0x11, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .....U...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =....... ....@.. - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v... ...A... - 0x90, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, 0xad, 0x11, 0x00, 0x00, // 8...6...d....... - 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........7....... - 0xe2, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, // ....7......./B.. - 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........F...... - 0xfe, 0x1d, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // ....;........... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe5, 0x10, 0x00, 0x00, // ....;........... - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x24, 0x53, 0x00, 0x00, // ....A.......$S.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x24, 0x53, 0x00, 0x00, // ........>...$S.. - 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9b, 0x49, 0x00, 0x00, // ....A........I.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9b, 0x49, 0x00, 0x00, // ........>....I.. - 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x27, 0x2f, 0x00, 0x00, // ....=.......'/.. - 0x2f, 0x42, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x64, 0x61, 0x00, 0x00, // /B..O.......da.. - 0x27, 0x2f, 0x00, 0x00, 0x27, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // '/..'/.......... - 0x8e, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x9d, 0x54, 0x00, 0x00, 0x64, 0x61, 0x00, 0x00, // .........T..da.. - 0x19, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x27, 0x54, 0x00, 0x00, // ....A.......'T.. - 0x42, 0x13, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // B.......=....... - 0xc1, 0x47, 0x00, 0x00, 0x27, 0x54, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, // .G..'T..O....... - 0x98, 0x19, 0x00, 0x00, 0xc1, 0x47, 0x00, 0x00, 0xc1, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....G...G...... - 0x01, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfd, 0x4c, 0x00, 0x00, // .............L.. - 0x9d, 0x54, 0x00, 0x00, 0x98, 0x19, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe5, 0x10, 0x00, 0x00, // .T......>....... - 0xfd, 0x4c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xa6, 0x2a, 0x00, 0x00, // .L..A........*.. - 0xe5, 0x10, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... - 0xd0, 0x37, 0x00, 0x00, 0xa6, 0x2a, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // .7...*.......... - 0x75, 0x5f, 0x00, 0x00, 0xd0, 0x37, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // u_...7......A... - 0x8a, 0x02, 0x00, 0x00, 0x66, 0x44, 0x00, 0x00, 0xe5, 0x10, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, // ....fD.......... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x22, 0x55, 0x00, 0x00, 0x66, 0x44, 0x00, 0x00, // =......."U..fD.. - 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x9e, 0x55, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // .........U...... - 0x22, 0x55, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7e, 0x1b, 0x00, 0x00, // "U..P.......~... - 0x75, 0x5f, 0x00, 0x00, 0x9e, 0x55, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // u_...U.......... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x12, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........=...... - 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x12, 0x3d, 0x00, 0x00, 0x7e, 0x1b, 0x00, 0x00, // ....>....=..~... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, // =........2...F.. - 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xbd, 0x4d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........M...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbd, 0x4d, 0x00, 0x00, 0xad, 0x32, 0x00, 0x00, // ....>....M...2.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xae, 0x32, 0x00, 0x00, 0xe2, 0x2e, 0x00, 0x00, // =........2...... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbe, 0x4d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........M...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x4d, 0x00, 0x00, 0xae, 0x32, 0x00, 0x00, // ....>....M...2.. - 0x3d, 0x00, 0x04, 0x00, 0x64, 0x04, 0x00, 0x00, 0xf6, 0x31, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // =...d....1...... - 0xfe, 0x00, 0x02, 0x00, 0xf6, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....1..8.... + 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, // t.gl_Position... + 0x05, 0x00, 0x09, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // intOutput.v_colo + 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // r0......`...@ent + 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, // ryPointOutput.v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // texcoord0...H... + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // $.......#....... + 0x47, 0x00, 0x03, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // G...$.......G... + 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // &...".......G... + 0x46, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // F...........G... + 0x4a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // J...........G... + 0x4e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // N...........G... + 0x59, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // Y...........G... + 0x5c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // ............G... + 0x60, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, // `............... + 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....!........... + 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ........ ....... + 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ................ + 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ................ + 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ................ + 0x16, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... + 0x06, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, // ...........?+... + 0x06, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x1e, 0x00, 0x03, 0x00, // .... ......@.... + 0x24, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // $....... ...%... + 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // ....$...;...%... + 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x16, 0x00, 0x00, 0x00, // &.......+....... + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, // '....... ...(... + 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, // ........ ...E... + 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x45, 0x00, 0x00, 0x00, // ........;...E... + 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, // F....... ...I... + 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, 0x00, // ........;...I... + 0x4a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // J....... ...M... + 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // ........;...M... + 0x4e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, // N....... ...X... + 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, // ........;...X... + 0x59, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, // Y.......;...X... + 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, // ........ ..._... + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, // ........;..._... + 0x60, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, // `............... + 0xaf, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, // =.......G...F... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, // =.......K...J... + 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, // =.......O...N... + 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, // O.......z...K... + 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // K............... + 0x0b, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ....{...z... ... + 0x41, 0x00, 0x05, 0x00, 0x28, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, // A...(...|...&... + 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, // '...=.......}... + 0x7c, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, // |...O.......~... + 0x7d, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // }...}........... + 0x85, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, // ............{... + 0x7e, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, // ~...Q........... + 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x82, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x06, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, // P............... + 0xaf, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ + 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, // R............... + 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x59, 0x00, 0x00, 0x00, // ........>...Y... + 0xae, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, // ....>.......G... + 0x3e, 0x00, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >...`...O....... + 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x10, 0x00, // 8............. }; static const uint8_t vs_ocornut_imgui_dx9[361] = { diff --git a/3rdparty/bgfx/examples/common/nanovg/fontstash.h b/3rdparty/bgfx/examples/common/nanovg/fontstash.h index 53cb4bdcd4f..798b404172d 100644 --- a/3rdparty/bgfx/examples/common/nanovg/fontstash.h +++ b/3rdparty/bgfx/examples/common/nanovg/fontstash.h @@ -38,6 +38,11 @@ enum FONSalign { FONS_ALIGN_BASELINE = 1<<6, // Default }; +enum FONSglyphBitmap { + FONS_GLYPH_BITMAP_OPTIONAL = 1, + FONS_GLYPH_BITMAP_REQUIRED = 2, +}; + enum FONSerrorCode { // Font atlas is full. FONS_ATLAS_FULL = 1, @@ -78,12 +83,13 @@ struct FONStextIter { const char* next; const char* end; unsigned int utf8state; + int bitmapOption; }; typedef struct FONStextIter FONStextIter; typedef struct FONScontext FONScontext; -// Constructor and destructor. +// Contructor and destructor. FONScontext* fonsCreateInternal(FONSparams* params); void fonsDeleteInternal(FONScontext* s); @@ -92,7 +98,7 @@ void fonsSetErrorCallback(FONScontext* s, void (*callback)(void* uptr, int error void fonsGetAtlasSize(FONScontext* s, int* width, int* height); // Expands the atlas size. int fonsExpandAtlas(FONScontext* s, int width, int height); -// Resets the whole stash. +// Reseta the whole stash. int fonsResetAtlas(FONScontext* stash, int width, int height); // Add fonts @@ -122,7 +128,7 @@ void fonsLineBounds(FONScontext* s, float y, float* miny, float* maxy); void fonsVertMetrics(FONScontext* s, float* ascender, float* descender, float* lineh); // Text iterator -int fonsTextIterInit(FONScontext* stash, FONStextIter* iter, float x, float y, const char* str, const char* end); +int fonsTextIterInit(FONScontext* stash, FONStextIter* iter, float x, float y, const char* str, const char* end, int bitmapOption); int fonsTextIterNext(FONScontext* stash, FONStextIter* iter, struct FONSquad* quad); // Pull texture changes @@ -880,22 +886,24 @@ error: int fonsAddFont(FONScontext* stash, const char* name, const char* path) { FILE* fp = 0; - int dataSize = 0; + size_t dataSize = 0; + size_t readed; unsigned char* data = NULL; // Read in the font data. fp = fopen(path, "rb"); if (fp == NULL) goto error; fseek(fp,0,SEEK_END); - dataSize = (int)ftell(fp); + dataSize = ftell(fp); fseek(fp,0,SEEK_SET); data = (unsigned char*)malloc(dataSize); if (data == NULL) goto error; - fread(data, 1, dataSize, fp); + readed = fread(data, 1, dataSize, fp); fclose(fp); fp = 0; + if (readed != dataSize) goto error; - return fonsAddFontMem(stash, name, data, dataSize, 1); + return fonsAddFontMem(stash, name, data, int(dataSize), 1); error: if (data) free(data); @@ -1035,7 +1043,7 @@ static void fons__blur(FONScontext* stash, unsigned char* dst, int w, int h, int } static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned int codepoint, - short isize, short iblur) + short isize, short iblur, int bitmapOption) { int i, g, advance, lsb, x0, y0, x1, y1, gw, gh, gx, gy, x, y; float scale; @@ -1058,12 +1066,18 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in h = fons__hashint(codepoint) & (FONS_HASH_LUT_SIZE-1); i = font->lut[h]; while (i != -1) { - if (font->glyphs[i].codepoint == codepoint && font->glyphs[i].size == isize && font->glyphs[i].blur == iblur) - return &font->glyphs[i]; + if (font->glyphs[i].codepoint == codepoint && font->glyphs[i].size == isize && font->glyphs[i].blur == iblur) { + glyph = &font->glyphs[i]; + if (bitmapOption == FONS_GLYPH_BITMAP_OPTIONAL || (glyph->x0 >= 0 && glyph->y0 >= 0)) { + return glyph; + } + // At this point, glyph exists but the bitmap data is not yet created. + break; + } i = font->glyphs[i].next; } - // Could not find glyph, create it. + // Create a new glyph or rasterize bitmap data for a cached glyph. g = fons__tt_getGlyphIndex(&font->font, codepoint); // Try to find the glyph in fallback fonts. if (g == 0) { @@ -1084,20 +1098,34 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in gw = x1-x0 + pad*2; gh = y1-y0 + pad*2; - // Find free spot for the rect in the atlas - added = fons__atlasAddRect(stash->atlas, gw, gh, &gx, &gy); - if (added == 0 && stash->handleError != NULL) { - // Atlas is full, let the user to resize the atlas (or not), and try again. - stash->handleError(stash->errorUptr, FONS_ATLAS_FULL, 0); + // Determines the spot to draw glyph in the atlas. + if (bitmapOption == FONS_GLYPH_BITMAP_REQUIRED) { + // Find free spot for the rect in the atlas added = fons__atlasAddRect(stash->atlas, gw, gh, &gx, &gy); + if (added == 0 && stash->handleError != NULL) { + // Atlas is full, let the user to resize the atlas (or not), and try again. + stash->handleError(stash->errorUptr, FONS_ATLAS_FULL, 0); + added = fons__atlasAddRect(stash->atlas, gw, gh, &gx, &gy); + } + if (added == 0) return NULL; + } else { + // Negative coordinate indicates there is no bitmap data created. + gx = -1; + gy = -1; } - if (added == 0) return NULL; // Init glyph. - glyph = fons__allocGlyph(font); - glyph->codepoint = codepoint; - glyph->size = isize; - glyph->blur = iblur; + if (glyph == NULL) { + glyph = fons__allocGlyph(font); + glyph->codepoint = codepoint; + glyph->size = isize; + glyph->blur = iblur; + glyph->next = 0; + + // Insert char to hash lookup. + glyph->next = font->lut[h]; + font->lut[h] = font->nglyphs-1; + } glyph->index = g; glyph->x0 = (short)gx; glyph->y0 = (short)gy; @@ -1106,15 +1134,14 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in glyph->xadv = (short)(scale * advance * 10.0f); glyph->xoff = (short)(x0 - pad); glyph->yoff = (short)(y0 - pad); - glyph->next = 0; - // Insert char to hash lookup. - glyph->next = font->lut[h]; - font->lut[h] = font->nglyphs-1; + if (bitmapOption == FONS_GLYPH_BITMAP_OPTIONAL) { + return glyph; + } // Rasterize dst = &stash->texData[(glyph->x0+pad) + (glyph->y0+pad) * stash->params.width]; - fons__tt_renderGlyphBitmap(&renderFont->font, dst, gw-pad*2,gh-pad*2, stash->params.width, scale,scale, g); + fons__tt_renderGlyphBitmap(&renderFont->font, dst, gw-pad*2,gh-pad*2, stash->params.width, scale, scale, g); // Make sure there is one pixel empty border. dst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; @@ -1141,7 +1168,7 @@ static FONSglyph* fons__getGlyph(FONScontext* stash, FONSfont* font, unsigned in if (iblur > 0) { stash->nscratch = 0; bdst = &stash->texData[glyph->x0 + glyph->y0 * stash->params.width]; - fons__blur(stash, bdst, gw,gh, stash->params.width, iblur); + fons__blur(stash, bdst, gw, gh, stash->params.width, iblur); } stash->dirtyRect[0] = fons__mini(stash->dirtyRect[0], glyph->x0); @@ -1303,7 +1330,7 @@ float fonsDrawText(FONScontext* stash, for (; str != end; ++str) { if (fons__decutf8(&utf8state, &codepoint, *(const unsigned char*)str)) continue; - glyph = fons__getGlyph(stash, font, codepoint, isize, iblur); + glyph = fons__getGlyph(stash, font, codepoint, isize, iblur, FONS_GLYPH_BITMAP_REQUIRED); if (glyph != NULL) { fons__getQuad(stash, font, prevGlyphIndex, glyph, scale, state->spacing, &x, &y, &q); @@ -1326,7 +1353,7 @@ float fonsDrawText(FONScontext* stash, } int fonsTextIterInit(FONScontext* stash, FONStextIter* iter, - float x, float y, const char* str, const char* end) + float x, float y, const char* str, const char* end, int bitmapOption) { FONSstate* state = fons__getState(stash); float width; @@ -1366,6 +1393,7 @@ int fonsTextIterInit(FONScontext* stash, FONStextIter* iter, iter->end = end; iter->codepoint = 0; iter->prevGlyphIndex = -1; + iter->bitmapOption = bitmapOption; return 1; } @@ -1386,7 +1414,8 @@ int fonsTextIterNext(FONScontext* stash, FONStextIter* iter, FONSquad* quad) // Get glyph and quad iter->x = iter->nextx; iter->y = iter->nexty; - glyph = fons__getGlyph(stash, iter->font, iter->codepoint, iter->isize, iter->iblur); + glyph = fons__getGlyph(stash, iter->font, iter->codepoint, iter->isize, iter->iblur, iter->bitmapOption); + // If the iterator was initialized with FONS_GLYPH_BITMAP_OPTIONAL, then the UV coordinates of the quad will be invalid. if (glyph != NULL) fons__getQuad(stash, iter->font, iter->prevGlyphIndex, glyph, iter->scale, iter->spacing, &iter->nextx, &iter->nexty, quad); iter->prevGlyphIndex = glyph != NULL ? glyph->index : -1; @@ -1483,7 +1512,7 @@ float fonsTextBounds(FONScontext* stash, for (; str != end; ++str) { if (fons__decutf8(&utf8state, &codepoint, *(const unsigned char*)str)) continue; - glyph = fons__getGlyph(stash, font, codepoint, isize, iblur); + glyph = fons__getGlyph(stash, font, codepoint, isize, iblur, FONS_GLYPH_BITMAP_OPTIONAL); if (glyph != NULL) { fons__getQuad(stash, font, prevGlyphIndex, glyph, scale, state->spacing, &x, &y, &q); if (q.x0 < minx) minx = q.x0; diff --git a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h index cba255fac8f..5900a70540d 100644 --- a/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h +++ b/3rdparty/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h @@ -184,653 +184,371 @@ static const uint8_t fs_nanovg_fill_glsl[2928] = 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor 0x3d, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = result_1;.}... }; -static const uint8_t fs_nanovg_fill_spv[10317] = +static const uint8_t fs_nanovg_fill_spv[5804] = { 0x46, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x07, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, // ams.......u_pain - 0x74, 0x4d, 0x61, 0x74, 0x13, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, // tMat.......u_ext - 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, // entRadius....... - 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, // u_innerCol...... - 0x0a, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x00, 0x00, 0x01, // .u_outerCol..... + 0x61, 0x6d, 0x73, 0x12, 0x01, 0xa0, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, // ams.......u_pain + 0x74, 0x4d, 0x61, 0x74, 0x13, 0x01, 0x30, 0x00, 0x03, 0x00, 0x0e, 0x75, 0x5f, 0x65, 0x78, 0x74, // tMat..0....u_ext + 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x12, 0x01, 0x90, 0x00, 0x01, 0x00, 0x0a, // entRadius....... + 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x60, 0x00, 0x01, 0x00, // u_innerCol..`... + 0x0a, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x12, 0x01, 0x70, 0x00, 0x01, // .u_outerCol..p.. 0x00, 0x0c, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x13, 0x01, // ..u_scissorMat.. - 0x00, 0x00, 0x01, 0x00, 0x11, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, // .....u_scissorEx - 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xbc, 0x27, 0x00, 0x00, // tScale.......'.. - 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x5c, 0x62, 0x00, 0x00, // ..#..........b.. + 0x00, 0x00, 0x03, 0x00, 0x11, 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, // .....u_scissorEx + 0x74, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, 0x01, 0x80, 0x00, 0x01, 0x00, 0x18, 0x16, 0x00, 0x00, // tScale.......... + 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xa8, 0x02, 0x00, 0x00, // ..#............. 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, // ................ 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, // ....GLSL.std.450 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main - 0x00, 0x00, 0x00, 0x00, 0xc1, 0x12, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, // ........t....... - 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, // ................ - 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x99, 0x0f, 0x00, 0x00, // main............ - 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x73, 0x74, // bgfxTexture2D(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, // 2D-p1-t211;vf2;. - 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ....~..._sampler - 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, // .m_sampler...... - 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, // ...._sampler.m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, // exture.......... - 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xd2, 0x0c, 0x00, 0x00, // _coord.......... - 0x6d, 0x69, 0x78, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, // mix(vf4;vf4;vf4; - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x5f, 0x61, 0x00, 0x00, // ............_a.. - 0x05, 0x00, 0x03, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, // ........_b...... - 0xd9, 0x0e, 0x00, 0x00, 0x5f, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, // ...._t......5... - 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, // vec4_splat(f1;.. - 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, // ........_x...... - 0x91, 0x0e, 0x00, 0x00, 0x73, 0x64, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x72, 0x65, 0x63, 0x74, 0x28, // ....sdroundrect( - 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x05, 0x00, 0x03, 0x00, // vf2;vf2;f1;..... - 0xb5, 0x31, 0x00, 0x00, 0x70, 0x74, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x40, 0x0d, 0x00, 0x00, // .1..pt......@... - 0x65, 0x78, 0x74, 0x00, 0x05, 0x00, 0x03, 0x00, 0x4d, 0x17, 0x00, 0x00, 0x72, 0x61, 0x64, 0x00, // ext.....M...rad. - 0x05, 0x00, 0x07, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, // ........scissorM - 0x61, 0x73, 0x6b, 0x28, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, // ask(vf2;........ - 0xc2, 0x10, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe2, 0x0b, 0x00, 0x00, // ....p........... - 0x73, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x28, 0x76, 0x66, 0x32, 0x3b, 0x00, // strokeMask(vf2;. - 0x05, 0x00, 0x05, 0x00, 0x1c, 0x12, 0x00, 0x00, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // ........_texcoor - 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x20, 0x14, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // d....... ...@mai - 0x6e, 0x28, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, // n(vf2;vf2;vf4;.. - 0x05, 0x00, 0x05, 0x00, 0xa8, 0x27, 0x00, 0x00, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....'..v_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x20, 0x61, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, // on...... a..v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd5, 0x40, 0x00, 0x00, // xcoord0......@.. - 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, // gl_FragData_0_.. - 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, // ....a...BgfxSamp - 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, // ler2D.......a... - 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, // ....m_sampler... - 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, // ....a.......m_te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, // xture........... - 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x06, 0x00, // flattenTemp..... - 0x0f, 0x0d, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ....s_texSampler - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, // ........K...s_te - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // xTexture........ - 0x4f, 0x12, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // O...s_tex.m_samp - 0x6c, 0x65, 0x72, 0x00, 0x05, 0x00, 0x06, 0x00, 0x36, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, // ler.....6...s_te - 0x78, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x05, 0x00, 0x04, 0x00, // x.m_texture..... - 0xbc, 0x0e, 0x00, 0x00, 0x65, 0x78, 0x74, 0x32, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, // ....ext2........ - 0x6e, 0x45, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x0a, 0x17, 0x00, 0x00, // nE..d........... - 0x73, 0x63, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, // sc......h...$Glo - 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // bal.....h....... - 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // u_viewRect...... - 0x68, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, // h.......u_viewTe - 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // xel.....h....... - 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, // u_view......h... - 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, // ....u_invView... - 0x06, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, // ....h.......u_pr - 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // oj......h....... - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // u_invProj....... - 0x68, 0x08, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, // h.......u_viewPr - 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x68, 0x08, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // oj......h....... - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, // u_invViewProj... - 0x06, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ....h.......u_mo - 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // del.....h....... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, // u_modelView..... - 0x68, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // h.......u_modelV - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, // iewProj.....h... - 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, // ....u_alphaRef4. - 0x06, 0x00, 0x07, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x63, // ....h.......u_sc + 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, 0x66, 0x01, 0x00, 0x00, 0x71, 0x01, 0x00, 0x00, // ....c...f...q... + 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, // ................ + 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, // main............ + 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, // BgfxSampler2D... + 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, // ............m_sa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, // mpler........... + 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, // ....m_texture... + 0x05, 0x00, 0x04, 0x00, 0x33, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x00, 0x00, 0x00, // ....3...s_tex... + 0x05, 0x00, 0x06, 0x00, 0x35, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x61, 0x6d, // ....5...s_texSam + 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x38, 0x00, 0x00, 0x00, // pler........8... + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, // s_texTexture.... + 0x05, 0x00, 0x04, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ....}...$Global. + 0x06, 0x00, 0x07, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x73, 0x63, // ....}.......u_sc 0x69, 0x73, 0x73, 0x6f, 0x72, 0x4d, 0x61, 0x74, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // issorMat........ - 0x68, 0x08, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // h.......u_paintM - 0x61, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, // at......h....... + 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x69, 0x6e, 0x74, 0x4d, // }.......u_paintM + 0x61, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // at......}....... 0x75, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // u_innerCol...... - 0x68, 0x08, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, // h.......u_outerC - 0x6f, 0x6c, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x68, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ol......h....... + 0x7d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x43, // }.......u_outerC + 0x6f, 0x6c, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ol......}....... 0x75, 0x5f, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x53, 0x63, 0x61, 0x6c, // u_scissorExtScal - 0x65, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x68, 0x08, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, // e.......h....... + 0x65, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // e.......}....... 0x75, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x64, 0x69, 0x75, 0x73, 0x00, 0x00, // u_extentRadius.. - 0x06, 0x00, 0x06, 0x00, 0x68, 0x08, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, // ....h.......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, // rams........B... - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, // ............bgfx - 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // _VoidFrag....... - 0xe6, 0x53, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .S..param....... - 0x60, 0x0d, 0x00, 0x00, 0x73, 0x63, 0x69, 0x73, 0x73, 0x6f, 0x72, 0x00, 0x05, 0x00, 0x04, 0x00, // `...scissor..... - 0x07, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // .0..param....... - 0x38, 0x17, 0x00, 0x00, 0x73, 0x74, 0x72, 0x6f, 0x6b, 0x65, 0x41, 0x6c, 0x70, 0x68, 0x61, 0x00, // 8...strokeAlpha. - 0x05, 0x00, 0x04, 0x00, 0x08, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, // .....0..param... - 0x05, 0x00, 0x03, 0x00, 0xb3, 0x2a, 0x00, 0x00, 0x70, 0x74, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, // .....*..pt...... - 0xb6, 0x10, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x09, 0x30, 0x00, 0x00, // ....d........0.. - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0a, 0x30, 0x00, 0x00, // param........0.. - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0b, 0x30, 0x00, 0x00, // param........0.. - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0c, 0x30, 0x00, 0x00, // param........0.. - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0d, 0x30, 0x00, 0x00, // color........0.. - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0e, 0x30, 0x00, 0x00, // param........0.. - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0f, 0x30, 0x00, 0x00, // param........0.. - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa2, 0x10, 0x00, 0x00, // param........... - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x0b, 0x17, 0x00, 0x00, // result.......... - 0x70, 0x74, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x10, 0x30, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, // pt.......0..colo - 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x11, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // r........0..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x12, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........0..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x13, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........0..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, // m...........colo - 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x14, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // r........0..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x40, 0x30, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m.......@0..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xda, 0x2d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........-..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x70, 0x6f, // m........+..v_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xc1, 0x12, 0x00, 0x00, // sition.......... - 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // v_position...... - 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // .<..v_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....t...v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, // rd0.........gl_F - 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ragData_0_...... - 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .U..param....... - 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .8..param....... - 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, // ....param....... - 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, // ....gl_FragData_ - 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // 0_..G......."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G.......!... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G...K..."... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...K...!... - 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x88, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ....G........... - 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // @...H...h....... - 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // #.......H...h... - 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ....#.......H... - 0x68, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // h...........H... - 0x68, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // h.......#... ... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...h........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....H...h....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....H...h....... - 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // #...`...H...h... - 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x68, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // h...........H... - 0x68, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, // h.......#....... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...h........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H...h....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....H...h....... - 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // #.......H...h... - 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x68, 0x08, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // h...........H... - 0x68, 0x08, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, // h.......#... ... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...h........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....H...h....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ....H...h....... - 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // #...`...H...h... - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x68, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // h...........H... - 0x68, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, // h.......#....... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...h........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H...h....... - 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ....H...h....... - 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // #.......H...h... - 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... - 0x68, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // h...........H... - 0x68, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, // h.......#....... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...h........... - 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // ....H...h....... - 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, // #... ...H...h... - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // ........H...h... - 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...0...H... - 0x68, 0x08, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // h............... - 0x48, 0x00, 0x04, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...h........... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...h.......#... - 0x60, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // `...H...h....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // ........H...h... - 0x0e, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x90, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x68, 0x08, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, // h.......#....... - 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...h.......#... - 0xb0, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, // ....H...h....... - 0x23, 0x00, 0x00, 0x00, 0xc0, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x68, 0x08, 0x00, 0x00, // #.......H...h... - 0x12, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xd0, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#.......G... - 0x68, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // h.......G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc1, 0x12, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, // ........G...t... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, // !............... - 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ...y....... - 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ - 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....!........... - 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // y........... ... - 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0xbb, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, // ................ - 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....!........... - 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0xc8, 0x0b, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ....!........... - 0x90, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, // ............!... - 0xe1, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x4b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, // K............... - 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, // ........a....... - 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // a... ...z....... - 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x0f, 0x0d, 0x00, 0x00, // ....;...z....... - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .... ........... - 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x4b, 0x0f, 0x00, 0x00, // ....;.......K... - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // .... ...{....... - 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x4f, 0x12, 0x00, 0x00, // ....;...{...O... - 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // .... ........... - 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x36, 0x0e, 0x00, 0x00, // ....;.......6... - 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, // ................ - 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... - 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // +............... - 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,............... - 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ...?............ - 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........e....... - 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, // ....+.......j... - 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x88, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ...........e... - 0x6a, 0x0a, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // j.......F....... - 0x03, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x15, 0x00, 0x68, 0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........h....... - 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ....e...e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, // e...e...e....... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, // e...e.......F... - 0x46, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // F............... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe5, 0x0a, 0x00, 0x00, // ........ ....... - 0x02, 0x00, 0x00, 0x00, 0x68, 0x08, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe5, 0x0a, 0x00, 0x00, // ....h...;....... - 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // B.......+....... - 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xc3, 0x02, 0x00, 0x00, // /....... ....... - 0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ....F...+....... - 0x3b, 0x0a, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, // ;....... ....... - 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........+....... - 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // .......?,....... - 0x1e, 0x06, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, // ...........@+... - 0x0c, 0x00, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ....A....... ... - 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, 0x00, // ................ - 0x09, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x32, 0x0a, 0x00, 0x00, // ....+.......2... - 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3e, 0x0a, 0x00, 0x00, // ....+.......>... - 0x11, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, // ....+........... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x35, 0x0a, 0x00, 0x00, // ....+.......5... - 0x0e, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x38, 0x0a, 0x00, 0x00, // ....+.......8... - 0x0f, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa2, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, // +.............@@ - 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0xc1, 0x12, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;.......t....... - 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... - 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ........Sa..;... - 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x90, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .....U......;... - 0x90, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .....8......;... - 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... - 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x0f, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....!C......=... - 0x96, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x4b, 0x0f, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, // .....3..K...P... - 0x61, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, // a...^ ..!C...3.. - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......^ ..A... - 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // y....V.......... - 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, // =............V.. - 0x3e, 0x00, 0x03, 0x00, 0x4f, 0x12, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...O.......A... - 0x13, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =............@.. - 0x3e, 0x00, 0x03, 0x00, 0x36, 0x0e, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...6.......=... - 0x13, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0xc1, 0x12, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....+......=... - 0x13, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .....<..t...>... - 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, // .U...+..>....8.. - 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, // .<..9........&.. - 0x20, 0x14, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // ....U...8...... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // =............... - 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >............... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, // ........7...y... - 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, // ~...7........... - 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7............... - 0xca, 0x1c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, // ....=........... - 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, // ....=........H.. - 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, // ~...V........>.. - 0xc6, 0x19, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // .....H..=....... - 0xfe, 0x24, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // .$......W....... - 0x82, 0x59, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, // .Y...>...$...... - 0x82, 0x59, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // .Y..8...6....... - 0xd2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // ............7... - 0x9a, 0x02, 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........7....... - 0xc7, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, // ....7........... - 0xf8, 0x00, 0x02, 0x00, 0x16, 0x59, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .....Y..=....... - 0x37, 0x54, 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // 7T......=....... - 0x07, 0x48, 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .H......=....... - 0x0e, 0x47, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, // .G.............. - 0x65, 0x19, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x37, 0x54, 0x00, 0x00, // e...........7T.. - 0x07, 0x48, 0x00, 0x00, 0x0e, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x65, 0x19, 0x00, 0x00, // .H...G......e... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, // 8...6.......5... - 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, // ........7....... - 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x19, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .........N..=... - 0x0d, 0x00, 0x00, 0x00, 0x67, 0x1c, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....g.......=... - 0x0d, 0x00, 0x00, 0x00, 0xf2, 0x44, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....D......=... - 0x0d, 0x00, 0x00, 0x00, 0x92, 0x2f, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ...../......=... - 0x0d, 0x00, 0x00, 0x00, 0xa5, 0x2f, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // ...../......P... - 0x1d, 0x00, 0x00, 0x00, 0x41, 0x4a, 0x00, 0x00, 0x67, 0x1c, 0x00, 0x00, 0xf2, 0x44, 0x00, 0x00, // ....AJ..g....D.. - 0x92, 0x2f, 0x00, 0x00, 0xa5, 0x2f, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x41, 0x4a, 0x00, 0x00, // ./.../......AJ.. - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x91, 0x0e, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0xc8, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, // ........7....... - 0xb5, 0x31, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x40, 0x0d, 0x00, 0x00, // .1..7.......@... - 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x4d, 0x17, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7.......M....... - 0x24, 0x56, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x6e, 0x45, 0x00, 0x00, // $V..;.......nE.. - 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x5b, 0x62, 0x00, 0x00, // ....=.......[b.. - 0x40, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x83, 0x2b, 0x00, 0x00, // @...=........+.. - 0x4d, 0x17, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc2, 0x28, 0x00, 0x00, // M...=........(.. - 0x4d, 0x17, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x7d, 0x3f, 0x00, 0x00, // M...P.......}?.. - 0x83, 0x2b, 0x00, 0x00, 0xc2, 0x28, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // .+...(.......... - 0xbc, 0x0e, 0x00, 0x00, 0x5b, 0x62, 0x00, 0x00, 0x7d, 0x3f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....[b..}?..=... - 0x13, 0x00, 0x00, 0x00, 0xf3, 0x20, 0x00, 0x00, 0xb5, 0x31, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, // ..... ...1...... - 0x13, 0x00, 0x00, 0x00, 0x67, 0x4d, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....gM.......... - 0xf3, 0x20, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0xe8, 0x32, 0x00, 0x00, // . ...........2.. - 0x67, 0x4d, 0x00, 0x00, 0xbc, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6e, 0x45, 0x00, 0x00, // gM......>...nE.. - 0xe8, 0x32, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x73, 0x57, 0x00, 0x00, // .2..A.......sW.. - 0x6e, 0x45, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // nE......=....... - 0x9f, 0x51, 0x00, 0x00, 0x73, 0x57, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, // .Q..sW..A....... - 0x47, 0x35, 0x00, 0x00, 0x6e, 0x45, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // G5..nE......=... - 0x0d, 0x00, 0x00, 0x00, 0x40, 0x3b, 0x00, 0x00, 0x47, 0x35, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // ....@;..G5...... - 0x0d, 0x00, 0x00, 0x00, 0x91, 0x41, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, // .....A......(... - 0x9f, 0x51, 0x00, 0x00, 0x40, 0x3b, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // .Q..@;.......... - 0x1f, 0x4a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x91, 0x41, 0x00, 0x00, // .J......%....A.. - 0x0c, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x31, 0x00, 0x00, // ....=....... 1.. - 0x6e, 0x45, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x22, 0x2b, 0x00, 0x00, // nE.........."+.. - 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x31, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, // ....(... 1...... - 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7a, 0x53, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........zS...... - 0x42, 0x00, 0x00, 0x00, 0x22, 0x2b, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // B..."+.......... - 0x59, 0x19, 0x00, 0x00, 0x1f, 0x4a, 0x00, 0x00, 0x7a, 0x53, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // Y....J..zS..=... - 0x0d, 0x00, 0x00, 0x00, 0x9c, 0x18, 0x00, 0x00, 0x4d, 0x17, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // ........M....... - 0x0d, 0x00, 0x00, 0x00, 0x82, 0x61, 0x00, 0x00, 0x59, 0x19, 0x00, 0x00, 0x9c, 0x18, 0x00, 0x00, // .....a..Y....... - 0xfe, 0x00, 0x02, 0x00, 0x82, 0x61, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, // .....a..8...6... - 0x0d, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // ................ - 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xc2, 0x10, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7............... - 0xeb, 0x3d, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x0a, 0x17, 0x00, 0x00, // .=..;........... - 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x47, 0x00, 0x00, // ....=........G.. - 0xc2, 0x10, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x2d, 0x00, 0x00, // ....Q........-.. - 0x01, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // .G......Q....... - 0x93, 0x4f, 0x00, 0x00, 0x01, 0x47, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, // .O...G......P... - 0x18, 0x00, 0x00, 0x00, 0x7c, 0x3b, 0x00, 0x00, 0x10, 0x2d, 0x00, 0x00, 0x93, 0x4f, 0x00, 0x00, // ....|;...-...O.. - 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xc3, 0x02, 0x00, 0x00, 0xe8, 0x1b, 0x00, 0x00, // ....A........... - 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, // B.../...=...F... - 0xbc, 0x2d, 0x00, 0x00, 0xe8, 0x1b, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, // .-.............. - 0x36, 0x1e, 0x00, 0x00, 0x7c, 0x3b, 0x00, 0x00, 0xbc, 0x2d, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, // 6...|;...-..O... - 0x13, 0x00, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00, 0x36, 0x1e, 0x00, 0x00, 0x36, 0x1e, 0x00, 0x00, // .....`..6...6... - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x5b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x82, 0x60, 0x00, 0x00, // .[...........`.. - 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x27, 0x5f, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A.......'_..B... - 0x3b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xcd, 0x56, 0x00, 0x00, // ;...=........V.. - 0x27, 0x5f, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0xd9, 0x5c, 0x00, 0x00, // '_..O........... - 0xcd, 0x56, 0x00, 0x00, 0xcd, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .V...V.......... - 0x83, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x9c, 0x39, 0x00, 0x00, 0x0d, 0x5b, 0x00, 0x00, // .........9...[.. - 0xd9, 0x5c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0a, 0x17, 0x00, 0x00, 0x9c, 0x39, 0x00, 0x00, // ....>........9.. - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x60, 0x49, 0x00, 0x00, 0x0a, 0x17, 0x00, 0x00, // =.......`I...... - 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x28, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A.......(G..B... - 0x3b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xde, 0x60, 0x00, 0x00, // ;...=........`.. - 0x28, 0x47, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x9e, 0x60, 0x00, 0x00, // (G..O........`.. - 0xde, 0x60, 0x00, 0x00, 0xde, 0x60, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .`...`.......... - 0x85, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0a, 0x60, 0x00, 0x00, 0x60, 0x49, 0x00, 0x00, // .........`..`I.. - 0x9e, 0x60, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x74, 0x51, 0x00, 0x00, // .`..........tQ.. - 0x1e, 0x06, 0x00, 0x00, 0x0a, 0x60, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0a, 0x17, 0x00, 0x00, // .....`..>....... - 0x74, 0x51, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x96, 0x5d, 0x00, 0x00, // tQ..A........].. - 0x0a, 0x17, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... - 0xc5, 0x2b, 0x00, 0x00, 0x96, 0x5d, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, // .+...].......... - 0xe9, 0x3d, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0xc5, 0x2b, 0x00, 0x00, // .=......+....+.. - 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, // ........A....... - 0xbf, 0x59, 0x00, 0x00, 0x0a, 0x17, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .Y..........=... - 0x0d, 0x00, 0x00, 0x00, 0x7b, 0x2b, 0x00, 0x00, 0xbf, 0x59, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, // ....{+...Y...... - 0x0d, 0x00, 0x00, 0x00, 0x48, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, // ....H.......+... - 0x7b, 0x2b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // {+.............. - 0x0d, 0x00, 0x00, 0x00, 0x55, 0x1f, 0x00, 0x00, 0xe9, 0x3d, 0x00, 0x00, 0x48, 0x1e, 0x00, 0x00, // ....U....=..H... - 0xfe, 0x00, 0x02, 0x00, 0x55, 0x1f, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, // ....U...8...6... - 0x0d, 0x00, 0x00, 0x00, 0xe2, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // ................ - 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x1c, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7............... - 0xa3, 0x52, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xc4, 0x2a, 0x00, 0x00, // .R..A........*.. - 0x1c, 0x12, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... - 0x22, 0x54, 0x00, 0x00, 0xc4, 0x2a, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // "T...*.......... - 0x40, 0x32, 0x00, 0x00, 0x22, 0x54, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // @2.."T.......... - 0x0d, 0x00, 0x00, 0x00, 0xe3, 0x3f, 0x00, 0x00, 0x40, 0x32, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // .....?..@2...... - 0x0c, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x47, 0x46, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........GF...... - 0x04, 0x00, 0x00, 0x00, 0xe3, 0x3f, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // .....?.......... - 0x5a, 0x4e, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x47, 0x46, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, // ZN......GF..A... - 0x8b, 0x02, 0x00, 0x00, 0x28, 0x33, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, // ....(3..B...A... - 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x68, 0x47, 0x00, 0x00, // ....=.......hG.. - 0x28, 0x33, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x24, 0x5a, 0x00, 0x00, // (3..........$Z.. - 0x5a, 0x4e, 0x00, 0x00, 0x68, 0x47, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // ZN..hG.......... - 0x30, 0x44, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // 0D......%....... - 0x24, 0x5a, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x4f, 0x5e, 0x00, 0x00, // $Z..A.......O^.. - 0x1c, 0x12, 0x00, 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... - 0x36, 0x32, 0x00, 0x00, 0x4f, 0x5e, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // 62..O^.......... - 0xc7, 0x4b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // .K......%....... - 0x36, 0x32, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xca, 0x60, 0x00, 0x00, // 62...........`.. - 0x30, 0x44, 0x00, 0x00, 0xc7, 0x4b, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xca, 0x60, 0x00, 0x00, // 0D...K.......`.. - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x14, 0x00, 0x00, // 8...6....... ... - 0x00, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, // ....K...7....... - 0xa8, 0x27, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x61, 0x00, 0x00, // .'..7....... a.. - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd5, 0x40, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........@...... - 0xc3, 0x18, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xe6, 0x53, 0x00, 0x00, // ....;........S.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x60, 0x0d, 0x00, 0x00, // ....;.......`... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x38, 0x17, 0x00, 0x00, // ....;.......8... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x08, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x09, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x0a, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x0b, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0d, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0e, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0f, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x10, 0x00, 0x00, // ....;........... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x11, 0x30, 0x00, 0x00, // ....;...y....0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x12, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x13, 0x30, 0x00, 0x00, // ....;........0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, // ....;........... - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x14, 0x30, 0x00, 0x00, // ....;...y....0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x40, 0x30, 0x00, 0x00, // ....;.......@0.. - 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0xda, 0x2d, 0x00, 0x00, // ....;........-.. - 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe6, 0x53, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ....>....S...... - 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, // 9...........5... - 0xe6, 0x53, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x59, 0x50, 0x00, 0x00, // .S..=.......YP.. - 0xa8, 0x27, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x07, 0x30, 0x00, 0x00, 0x59, 0x50, 0x00, 0x00, // .'..>....0..YP.. - 0x39, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x51, 0x58, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, // 9.......QX...... - 0x07, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x60, 0x0d, 0x00, 0x00, 0x51, 0x58, 0x00, 0x00, // .0..>...`...QX.. - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x65, 0x60, 0x00, 0x00, 0x20, 0x61, 0x00, 0x00, // =.......e`.. a.. - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x30, 0x00, 0x00, 0x65, 0x60, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, // >....0..e`..9... - 0x0d, 0x00, 0x00, 0x00, 0x9d, 0x58, 0x00, 0x00, 0xe2, 0x0b, 0x00, 0x00, 0x08, 0x30, 0x00, 0x00, // .....X.......0.. - 0x3e, 0x00, 0x03, 0x00, 0x38, 0x17, 0x00, 0x00, 0x9d, 0x58, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, // >...8....X..A... - 0x8b, 0x02, 0x00, 0x00, 0xae, 0x34, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, // .....4..B...A... - 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfa, 0x1e, 0x00, 0x00, // ....=........... - 0xae, 0x34, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, // .4...........3.. - 0xfa, 0x1e, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x7c, 0x3a, 0x00, 0x00, // ............|:.. - 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xfc, 0x33, 0x00, 0x00, 0x29, 0x2b, 0x00, 0x00, // .........3..)+.. - 0xf5, 0x61, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x29, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .a......)+..=... - 0x13, 0x00, 0x00, 0x00, 0x6c, 0x1d, 0x00, 0x00, 0xa8, 0x27, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ....l....'..Q... - 0x0d, 0x00, 0x00, 0x00, 0x83, 0x4d, 0x00, 0x00, 0x6c, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....M..l....... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf0, 0x52, 0x00, 0x00, 0x6c, 0x1d, 0x00, 0x00, // Q........R..l... - 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3e, 0x00, 0x00, // ....P........>.. - 0x83, 0x4d, 0x00, 0x00, 0xf0, 0x52, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .M...R......A... - 0xc3, 0x02, 0x00, 0x00, 0x45, 0x1f, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x32, 0x0a, 0x00, 0x00, // ....E...B...2... - 0x3d, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x19, 0x31, 0x00, 0x00, 0x45, 0x1f, 0x00, 0x00, // =...F....1..E... - 0x90, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x45, 0x25, 0x00, 0x00, 0xd9, 0x3e, 0x00, 0x00, // ........E%...>.. - 0x19, 0x31, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0xb3, 0x2a, 0x00, 0x00, // .1..O........*.. - 0x45, 0x25, 0x00, 0x00, 0x45, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // E%..E%.......... - 0x3e, 0x00, 0x03, 0x00, 0x09, 0x30, 0x00, 0x00, 0xb3, 0x2a, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >....0...*..A... - 0x9b, 0x02, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x3e, 0x0a, 0x00, 0x00, // .....@..B...>... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x80, 0x55, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, // =........U...@.. - 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x91, 0x44, 0x00, 0x00, 0x80, 0x55, 0x00, 0x00, // O........D...U.. - 0x80, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .U..........>... - 0x0a, 0x30, 0x00, 0x00, 0x91, 0x44, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, // .0...D..A....... - 0xc9, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x3e, 0x0a, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, // .>..B...>....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x9f, 0x60, 0x00, 0x00, 0xc9, 0x3e, 0x00, 0x00, // =........`...>.. - 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x30, 0x00, 0x00, 0x9f, 0x60, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, // >....0...`..9... - 0x0d, 0x00, 0x00, 0x00, 0x4a, 0x56, 0x00, 0x00, 0x91, 0x0e, 0x00, 0x00, 0x09, 0x30, 0x00, 0x00, // ....JV.......0.. - 0x0a, 0x30, 0x00, 0x00, 0x0b, 0x30, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, // .0...0..A....... - 0x6b, 0x52, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, // kR..B...A....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, 0x6b, 0x52, 0x00, 0x00, // =........2..kR.. - 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc3, 0x39, 0x00, 0x00, 0xd7, 0x32, 0x00, 0x00, // .........9...2.. - 0xfc, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbe, 0x41, 0x00, 0x00, // .............A.. - 0x4a, 0x56, 0x00, 0x00, 0xc3, 0x39, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, // JV...9..A....... - 0x42, 0x29, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, // B)..B...A....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x58, 0x41, 0x00, 0x00, 0x42, 0x29, 0x00, 0x00, // =.......XA..B).. - 0x88, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8f, 0x20, 0x00, 0x00, 0xbe, 0x41, 0x00, 0x00, // ......... ...A.. - 0x58, 0x41, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb6, 0x10, 0x00, 0x00, // XA.............. - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x8f, 0x20, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ....+.... ...... - 0x8a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x68, 0x21, 0x00, 0x00, // ....P.......h!.. - 0xb6, 0x10, 0x00, 0x00, 0xb6, 0x10, 0x00, 0x00, 0xb6, 0x10, 0x00, 0x00, 0xb6, 0x10, 0x00, 0x00, // ................ - 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x52, 0x48, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A.......RH..B... - 0x35, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xfa, 0x1c, 0x00, 0x00, // 5...=........... - 0x52, 0x48, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0d, 0x30, 0x00, 0x00, 0xfa, 0x1c, 0x00, 0x00, // RH..>....0...... - 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x86, 0x38, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A........8..B... - 0x38, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xfd, 0x60, 0x00, 0x00, // 8...=........`.. - 0x86, 0x38, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0e, 0x30, 0x00, 0x00, 0xfd, 0x60, 0x00, 0x00, // .8..>....0...`.. - 0x3e, 0x00, 0x03, 0x00, 0x0f, 0x30, 0x00, 0x00, 0x68, 0x21, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, // >....0..h!..9... - 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x4e, 0x00, 0x00, 0xd2, 0x0c, 0x00, 0x00, 0x0d, 0x30, 0x00, 0x00, // .....N.......0.. - 0x0e, 0x30, 0x00, 0x00, 0x0f, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0c, 0x30, 0x00, 0x00, // .0...0..>....0.. - 0xdb, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x37, 0x1c, 0x00, 0x00, // .N..=.......7... - 0x38, 0x17, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x4e, 0x00, 0x00, // 8...=........N.. - 0x60, 0x0d, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8e, 0x2f, 0x00, 0x00, // `............/.. - 0x37, 0x1c, 0x00, 0x00, 0x0c, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // 7....N..=....... - 0xa9, 0x1d, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // .....0.......... - 0xdd, 0x4b, 0x00, 0x00, 0xa9, 0x1d, 0x00, 0x00, 0x8e, 0x2f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .K......./..>... - 0x0c, 0x30, 0x00, 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .0...K..=....... - 0x8a, 0x59, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x10, 0x00, 0x00, // .Y...0..>....... - 0x8a, 0x59, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x7c, 0x3a, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // .Y......|:...... - 0xf5, 0x61, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xb9, 0x50, 0x00, 0x00, // .a..A........P.. - 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // B...A.......=... - 0x0d, 0x00, 0x00, 0x00, 0x39, 0x3f, 0x00, 0x00, 0xb9, 0x50, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, // ....9?...P...... - 0x09, 0x00, 0x00, 0x00, 0xfd, 0x33, 0x00, 0x00, 0x39, 0x3f, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // .....3..9?...... - 0xf7, 0x00, 0x03, 0x00, 0x3d, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, // ....=^.......... - 0xfd, 0x33, 0x00, 0x00, 0x2a, 0x2b, 0x00, 0x00, 0xf8, 0x61, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // .3..*+...a...... - 0x2a, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x6d, 0x1d, 0x00, 0x00, // *+..=.......m... - 0xa8, 0x27, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x84, 0x4d, 0x00, 0x00, // .'..Q........M.. - 0x6d, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // m.......Q....... - 0xf1, 0x52, 0x00, 0x00, 0x6d, 0x1d, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, // .R..m.......P... - 0x18, 0x00, 0x00, 0x00, 0xda, 0x3e, 0x00, 0x00, 0x84, 0x4d, 0x00, 0x00, 0xf1, 0x52, 0x00, 0x00, // .....>...M...R.. - 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xc3, 0x02, 0x00, 0x00, 0x46, 0x1f, 0x00, 0x00, // ....A.......F... - 0x42, 0x13, 0x00, 0x00, 0x32, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, // B...2...=...F... - 0x1a, 0x31, 0x00, 0x00, 0x46, 0x1f, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, // .1..F........... - 0x7e, 0x25, 0x00, 0x00, 0xda, 0x3e, 0x00, 0x00, 0x1a, 0x31, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, // ~%...>...1..O... - 0x13, 0x00, 0x00, 0x00, 0x60, 0x28, 0x00, 0x00, 0x7e, 0x25, 0x00, 0x00, 0x7e, 0x25, 0x00, 0x00, // ....`(..~%..~%.. - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, // ........A....... - 0xf2, 0x3d, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x3e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .=..B...>...=... - 0x1d, 0x00, 0x00, 0x00, 0x38, 0x20, 0x00, 0x00, 0xf2, 0x3d, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, // ....8 ...=..O... - 0x13, 0x00, 0x00, 0x00, 0xc2, 0x5c, 0x00, 0x00, 0x38, 0x20, 0x00, 0x00, 0x38, 0x20, 0x00, 0x00, // ........8 ..8 .. - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0b, 0x17, 0x00, 0x00, 0x60, 0x28, 0x00, 0x00, 0xc2, 0x5c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....`(......=... - 0xfc, 0x01, 0x00, 0x00, 0xfe, 0x56, 0x00, 0x00, 0x4f, 0x12, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .....V..O...>... - 0x11, 0x30, 0x00, 0x00, 0xfe, 0x56, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, // .0...V..=....... - 0xdf, 0x22, 0x00, 0x00, 0x36, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x12, 0x30, 0x00, 0x00, // ."..6...>....0.. - 0xdf, 0x22, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x13, 0x30, 0x00, 0x00, 0x0b, 0x17, 0x00, 0x00, // ."..>....0...... - 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x27, 0x4f, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, // 9.......'O...... - 0x11, 0x30, 0x00, 0x00, 0x12, 0x30, 0x00, 0x00, 0x13, 0x30, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .0...0...0..>... - 0x10, 0x30, 0x00, 0x00, 0x27, 0x4f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, // .0..'O..A....... - 0xaf, 0x34, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, // .4..B...A....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfb, 0x1e, 0x00, 0x00, 0xaf, 0x34, 0x00, 0x00, // =............4.. - 0xb4, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0xfe, 0x33, 0x00, 0x00, 0xfb, 0x1e, 0x00, 0x00, // .........3...... - 0x8a, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xf6, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........a...... - 0xfa, 0x00, 0x04, 0x00, 0xfe, 0x33, 0x00, 0x00, 0x03, 0x2b, 0x00, 0x00, 0xf6, 0x61, 0x00, 0x00, // .....3...+...a.. - 0xf8, 0x00, 0x02, 0x00, 0x03, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .....+..=....... - 0x96, 0x1d, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, // .....0..O....... - 0x6d, 0x4c, 0x00, 0x00, 0x96, 0x1d, 0x00, 0x00, 0x96, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // mL.............. - 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, // ........A....... - 0x07, 0x5e, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .^...0......=... - 0x0d, 0x00, 0x00, 0x00, 0xdf, 0x3a, 0x00, 0x00, 0x07, 0x5e, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // .....:...^...... - 0x18, 0x00, 0x00, 0x00, 0x2b, 0x24, 0x00, 0x00, 0x6d, 0x4c, 0x00, 0x00, 0xdf, 0x3a, 0x00, 0x00, // ....+$..mL...:.. - 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x96, 0x2f, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, // A......../...0.. - 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x50, 0x3d, 0x00, 0x00, // ....=.......P=.. - 0x96, 0x2f, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x43, 0x00, 0x00, // ./..Q.......gC.. - 0x2b, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // +$......Q....... - 0x60, 0x53, 0x00, 0x00, 0x2b, 0x24, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // `S..+$......Q... - 0x0d, 0x00, 0x00, 0x00, 0x47, 0x5f, 0x00, 0x00, 0x2b, 0x24, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....G_..+$...... - 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd4, 0x4e, 0x00, 0x00, 0x67, 0x43, 0x00, 0x00, // P........N..gC.. - 0x60, 0x53, 0x00, 0x00, 0x47, 0x5f, 0x00, 0x00, 0x50, 0x3d, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // `S..G_..P=..>... - 0x10, 0x30, 0x00, 0x00, 0xd4, 0x4e, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xf6, 0x61, 0x00, 0x00, // .0...N.......a.. - 0xf8, 0x00, 0x02, 0x00, 0xf6, 0x61, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, // .....a..A....... - 0xba, 0x50, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, // .P..B...A....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3a, 0x3f, 0x00, 0x00, 0xba, 0x50, 0x00, 0x00, // =.......:?...P.. - 0xb4, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0xff, 0x33, 0x00, 0x00, 0x3a, 0x3f, 0x00, 0x00, // .........3..:?.. - 0x19, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xf7, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........a...... - 0xfa, 0x00, 0x04, 0x00, 0xff, 0x33, 0x00, 0x00, 0x04, 0x2b, 0x00, 0x00, 0xf7, 0x61, 0x00, 0x00, // .....3...+...a.. - 0xf8, 0x00, 0x02, 0x00, 0x04, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .....+..=....... - 0x5d, 0x1d, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, // ]....0..O....... - 0x68, 0x5c, 0x00, 0x00, 0x5d, 0x1d, 0x00, 0x00, 0x5d, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // h...]...]....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ............>... - 0x10, 0x30, 0x00, 0x00, 0x68, 0x5c, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xf7, 0x61, 0x00, 0x00, // .0..h........a.. - 0xf8, 0x00, 0x02, 0x00, 0xf7, 0x61, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, // .....a..A....... - 0xe4, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x35, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .G..B...5...=... - 0x1d, 0x00, 0x00, 0x00, 0xaf, 0x3c, 0x00, 0x00, 0xe4, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....<...G..=... - 0x1d, 0x00, 0x00, 0x00, 0xf6, 0x4a, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // .....J...0...... - 0x1d, 0x00, 0x00, 0x00, 0xde, 0x28, 0x00, 0x00, 0xf6, 0x4a, 0x00, 0x00, 0xaf, 0x3c, 0x00, 0x00, // .....(...J...<.. - 0x3e, 0x00, 0x03, 0x00, 0x10, 0x30, 0x00, 0x00, 0xde, 0x28, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >....0...(..=... - 0x0d, 0x00, 0x00, 0x00, 0x16, 0x5b, 0x00, 0x00, 0x38, 0x17, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....[..8...=... - 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x4e, 0x00, 0x00, 0x60, 0x0d, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // .....N..`....... - 0x0d, 0x00, 0x00, 0x00, 0x8f, 0x2f, 0x00, 0x00, 0x16, 0x5b, 0x00, 0x00, 0x0d, 0x4e, 0x00, 0x00, // ...../...[...N.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x1d, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, // =............0.. - 0x8e, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xde, 0x4b, 0x00, 0x00, 0xaa, 0x1d, 0x00, 0x00, // .........K...... - 0x8f, 0x2f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x10, 0x30, 0x00, 0x00, 0xde, 0x4b, 0x00, 0x00, // ./..>....0...K.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8b, 0x59, 0x00, 0x00, 0x10, 0x30, 0x00, 0x00, // =........Y...0.. - 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x10, 0x00, 0x00, 0x8b, 0x59, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // >........Y...... - 0x3d, 0x5e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf8, 0x61, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, // =^.......a..A... - 0x8b, 0x02, 0x00, 0x00, 0xbb, 0x50, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, // .....P..B...A... - 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x3f, 0x00, 0x00, // ....=.......;?.. - 0xbb, 0x50, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, // .P...........4.. - 0x3b, 0x3f, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x3c, 0x5e, 0x00, 0x00, // ;?..........<^.. - 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x34, 0x00, 0x00, 0xf4, 0x36, 0x00, 0x00, // .........4...6.. - 0xf9, 0x61, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf4, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .a.......6..>... - 0xa2, 0x10, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x3c, 0x5e, 0x00, 0x00, // ............<^.. - 0xf8, 0x00, 0x02, 0x00, 0xf9, 0x61, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, // .....a..A....... - 0xbc, 0x50, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, // .P..B...A....... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3c, 0x3f, 0x00, 0x00, 0xbc, 0x50, 0x00, 0x00, // =...........0.. - 0xc7, 0x28, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xcc, 0x22, 0x00, 0x00, // .(..=........".. - 0x36, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x40, 0x30, 0x00, 0x00, 0xcc, 0x22, 0x00, 0x00, // 6...>...@0...".. - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x80, 0x22, 0x00, 0x00, 0x20, 0x61, 0x00, 0x00, // =........".. a.. - 0x3e, 0x00, 0x03, 0x00, 0xda, 0x2d, 0x00, 0x00, 0x80, 0x22, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, // >....-..."..9... - 0x1d, 0x00, 0x00, 0x00, 0x9e, 0x58, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x14, 0x30, 0x00, 0x00, // .....X.......0.. - 0x40, 0x30, 0x00, 0x00, 0xda, 0x2d, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, 0x00, 0x00, // @0...-..>....... - 0x9e, 0x58, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xb0, 0x34, 0x00, 0x00, // .X..A........4.. - 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // B...A.......=... - 0x0d, 0x00, 0x00, 0x00, 0xfc, 0x1e, 0x00, 0x00, 0xb0, 0x34, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, // .........4...... - 0x09, 0x00, 0x00, 0x00, 0x02, 0x34, 0x00, 0x00, 0xfc, 0x1e, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // .....4.......... - 0xf7, 0x00, 0x03, 0x00, 0xfa, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, // .....a.......... - 0x02, 0x34, 0x00, 0x00, 0x05, 0x2b, 0x00, 0x00, 0xfa, 0x61, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // .4...+...a...... - 0x05, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x97, 0x1d, 0x00, 0x00, // .+..=........... - 0x18, 0x0e, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6e, 0x4c, 0x00, 0x00, // ....O.......nL.. - 0x97, 0x1d, 0x00, 0x00, 0x97, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x08, 0x5e, 0x00, 0x00, // ....A........^.. - 0x18, 0x0e, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... - 0xe0, 0x3a, 0x00, 0x00, 0x08, 0x5e, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, // .:...^.......... - 0x2c, 0x24, 0x00, 0x00, 0x6e, 0x4c, 0x00, 0x00, 0xe0, 0x3a, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ,$..nL...:..A... - 0x8a, 0x02, 0x00, 0x00, 0x97, 0x2f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, // ...../.......... - 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x51, 0x3d, 0x00, 0x00, 0x97, 0x2f, 0x00, 0x00, // =.......Q=.../.. - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x68, 0x43, 0x00, 0x00, 0x2c, 0x24, 0x00, 0x00, // Q.......hC..,$.. - 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x61, 0x53, 0x00, 0x00, // ....Q.......aS.. - 0x2c, 0x24, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // ,$......Q....... - 0x48, 0x5f, 0x00, 0x00, 0x2c, 0x24, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // H_..,$......P... - 0x1d, 0x00, 0x00, 0x00, 0xd5, 0x4e, 0x00, 0x00, 0x68, 0x43, 0x00, 0x00, 0x61, 0x53, 0x00, 0x00, // .....N..hC..aS.. - 0x48, 0x5f, 0x00, 0x00, 0x51, 0x3d, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, 0x00, 0x00, // H_..Q=..>....... - 0xd5, 0x4e, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xfa, 0x61, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // .N.......a...... - 0xfa, 0x61, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xbd, 0x50, 0x00, 0x00, // .a..A........P.. - 0x42, 0x13, 0x00, 0x00, 0x41, 0x0a, 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // B...A.......=... - 0x0d, 0x00, 0x00, 0x00, 0x3d, 0x3f, 0x00, 0x00, 0xbd, 0x50, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, // ....=?...P...... - 0x09, 0x00, 0x00, 0x00, 0x03, 0x34, 0x00, 0x00, 0x3d, 0x3f, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, // .....4..=?...... - 0xf7, 0x00, 0x03, 0x00, 0x2a, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, // ....*........... - 0x03, 0x34, 0x00, 0x00, 0x06, 0x2b, 0x00, 0x00, 0x2a, 0x1a, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // .4...+..*....... - 0x06, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5e, 0x1d, 0x00, 0x00, // .+..=.......^... - 0x18, 0x0e, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x69, 0x5c, 0x00, 0x00, // ....O.......i... - 0x5e, 0x1d, 0x00, 0x00, 0x5e, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ^...^........... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, 0x00, 0x00, // ........>....... - 0x69, 0x5c, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x2a, 0x1a, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // i.......*....... - 0x2a, 0x1a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xed, 0x38, 0x00, 0x00, // *...=........8.. - 0x60, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xca, 0x1d, 0x00, 0x00, // `...=........... - 0x18, 0x0e, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd1, 0x32, 0x00, 0x00, // .............2.. - 0xca, 0x1d, 0x00, 0x00, 0xed, 0x38, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, 0x00, 0x00, // .....8..>....... - 0xd1, 0x32, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8f, 0x49, 0x00, 0x00, // .2..=........I.. - 0x18, 0x0e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x87, 0x4e, 0x00, 0x00, // ....A........N.. - 0x42, 0x13, 0x00, 0x00, 0x35, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // B...5...=....... - 0x3f, 0x21, 0x00, 0x00, 0x87, 0x4e, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // ?!...N.......... - 0x33, 0x2a, 0x00, 0x00, 0x8f, 0x49, 0x00, 0x00, 0x3f, 0x21, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // 3*...I..?!..>... - 0xa2, 0x10, 0x00, 0x00, 0x33, 0x2a, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xfd, 0x3d, 0x00, 0x00, // ....3*.......=.. - 0xf8, 0x00, 0x02, 0x00, 0xfd, 0x3d, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x3c, 0x5e, 0x00, 0x00, // .....=......<^.. - 0xf8, 0x00, 0x02, 0x00, 0x3c, 0x5e, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x3d, 0x5e, 0x00, 0x00, // ....<^......=^.. - 0xf8, 0x00, 0x02, 0x00, 0x3d, 0x5e, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x7c, 0x3a, 0x00, 0x00, // ....=^......|:.. - 0xf8, 0x00, 0x02, 0x00, 0x7c, 0x3a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....|:..=....... - 0x7d, 0x40, 0x00, 0x00, 0xa2, 0x10, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd5, 0x40, 0x00, 0x00, // }@......>....@.. - 0x7d, 0x40, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // }@......8.... + 0x06, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, // ....}.......u_pa + 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7f, 0x00, 0x00, 0x00, // rams............ + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x63, 0x01, 0x00, 0x00, 0x76, 0x5f, 0x70, 0x6f, // ........c...v_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x66, 0x01, 0x00, 0x00, // sition......f... + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, // v_texcoord0..... + 0x71, 0x01, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // q...bgfx_FragDat + 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // a0..G...8..."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x38, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, // ....G...8...!... + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...}....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...}....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, // #.......H...}... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, // ............H... + 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // }...........H... + 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // }.......#...0... + 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // H...}........... + 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....H...}....... + 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, // #...`...H...}... + 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...p...H... + 0x7d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // }.......#....... + 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...}.......#... + 0x90, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ....H...}....... + 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x7d, 0x00, 0x00, 0x00, // #.......G...}... + 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, // ....G......."... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x63, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...c....... + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x66, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...f....... + 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x01, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // ....G...q....... + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, // ............!... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, // ................ + 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, // ........ ....... + 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ + 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, // ...2........... + 0x3b, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ;...2...3....... + 0x20, 0x00, 0x04, 0x00, 0x34, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...4........... + 0x3b, 0x00, 0x04, 0x00, 0x34, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ;...4...5....... + 0x20, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ...7........... + 0x3b, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ;...7...8....... + 0x15, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....;... ....... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // +...;...<....... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +...;...@....... + 0x1b, 0x00, 0x03, 0x00, 0x44, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ....D........... + 0x62, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // b... .......+... + 0x62, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // b...c.......+... + 0x62, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // b...f.......+... + 0x07, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, // ....j.......,... + 0x0b, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, // ....m...j...j... + 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, // +.......w......? + 0x17, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....x........... + 0x18, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....|...x....... + 0x1e, 0x00, 0x09, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, // ....}...|...|... + 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...~....... + 0x7d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // }...;...~....... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... + 0x7c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, // |...+...;....... + 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x87, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... + 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, // ....+........... + 0x00, 0x00, 0x00, 0x3f, 0x2c, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, // ...?,........... + 0x8c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........+....... + 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // .......@+...;... + 0xa4, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........ ....... + 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00, // ........+...b... + 0xbb, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x02, 0x00, 0xbe, 0x00, 0x00, 0x00, // ................ + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // +...;........... + 0x2b, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +...b........... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +...;........... + 0x2b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // +...;........... + 0x2c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ,.......4...w... + 0x77, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // w...w...w...+... + 0x07, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x00, 0x04, 0x00, // ....8.....@@ ... + 0x62, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // b...........;... + 0x62, 0x01, 0x00, 0x00, 0x63, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // b...c.......;... + 0x62, 0x01, 0x00, 0x00, 0x66, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // b...f....... ... + 0x70, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // p...........;... + 0x70, 0x01, 0x00, 0x00, 0x71, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, // p...q........... + 0x0d, 0x00, 0x00, 0x00, 0xa7, 0x02, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, // ........6....... + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // ................ + 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, // ....=.......6... + 0x35, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, // 5...=.......9... + 0x38, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, // 8...P.......:... + 0x36, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x33, 0x00, 0x00, 0x00, // 6...9...>...3... + 0x3a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, // :...=.......d... + 0x63, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, // c...=.......g... + 0x66, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, // f...Q.......7... + 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // d.......Q....... + 0x38, 0x02, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, // 8...d.......P... + 0x78, 0x00, 0x00, 0x00, 0x39, 0x02, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, // x...9...7...8... + 0x77, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x3a, 0x02, 0x00, 0x00, // w...A.......:... + 0x7f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, // ....@...=...|... + 0x3b, 0x02, 0x00, 0x00, 0x3a, 0x02, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, // ;...:.......x... + 0x3c, 0x02, 0x00, 0x00, 0x39, 0x02, 0x00, 0x00, 0x3b, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, // <...9...;...O... + 0x0b, 0x00, 0x00, 0x00, 0x3d, 0x02, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, 0x3c, 0x02, 0x00, 0x00, // ....=...<...<... + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x3e, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3d, 0x02, 0x00, 0x00, // >...........=... + 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0x3f, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A.......?....... + 0x86, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, // ....=.......@... + 0x3f, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x41, 0x02, 0x00, 0x00, // ?...O.......A... + 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // @...@........... + 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x42, 0x02, 0x00, 0x00, 0x3e, 0x02, 0x00, 0x00, // ........B...>... + 0x41, 0x02, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, // A...A.......D... + 0x7f, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... + 0x45, 0x02, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, // E...D...O....... + 0x46, 0x02, 0x00, 0x00, 0x45, 0x02, 0x00, 0x00, 0x45, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // F...E...E....... + 0x03, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x47, 0x02, 0x00, 0x00, // ............G... + 0x42, 0x02, 0x00, 0x00, 0x46, 0x02, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // B...F........... + 0x48, 0x02, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x47, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // H.......G...Q... + 0x07, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....J...H....... + 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........K....... + 0x2b, 0x00, 0x00, 0x00, 0x4a, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // +...J...j...w... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4d, 0x02, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, // Q.......M...H... + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4e, 0x02, 0x00, 0x00, // ............N... + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x4d, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, // ....+...M...j... + 0x77, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x4f, 0x02, 0x00, 0x00, // w...........O... + 0x4b, 0x02, 0x00, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // K...N...Q....... + 0x52, 0x02, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // R...g........... + 0x07, 0x00, 0x00, 0x00, 0x53, 0x02, 0x00, 0x00, 0x52, 0x02, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, // ....S...R....... + 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x53, 0x02, 0x00, 0x00, // ........T...S... + 0x77, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x55, 0x02, 0x00, 0x00, // w...........U... + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // ........T....... + 0x07, 0x00, 0x00, 0x00, 0x56, 0x02, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x55, 0x02, 0x00, 0x00, // ....V...w...U... + 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x57, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A.......W....... + 0xa4, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ....f...=....... + 0x58, 0x02, 0x00, 0x00, 0x57, 0x02, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // X...W........... + 0x59, 0x02, 0x00, 0x00, 0x56, 0x02, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // Y...V...X....... + 0x07, 0x00, 0x00, 0x00, 0x5a, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // ....Z.......%... + 0x77, 0x00, 0x00, 0x00, 0x59, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // w...Y...Q....... + 0x5c, 0x02, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // ....g........... + 0x07, 0x00, 0x00, 0x00, 0x5d, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, // ....].......%... + 0x77, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // w............... + 0x5e, 0x02, 0x00, 0x00, 0x5a, 0x02, 0x00, 0x00, 0x5d, 0x02, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, // ^...Z...]...A... + 0xa5, 0x00, 0x00, 0x00, 0xa1, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, // ................ + 0xbb, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa2, 0x01, 0x00, 0x00, // ....=........... + 0xa1, 0x01, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xa3, 0x01, 0x00, 0x00, // ................ + 0xa2, 0x01, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xa4, 0x01, 0x00, 0x00, // ....j........... + 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xa3, 0x01, 0x00, 0x00, 0xa5, 0x01, 0x00, 0x00, // ................ + 0xa6, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa5, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x07, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........d....... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa9, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, // Q...........d... + 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00, 0x00, 0xaa, 0x01, 0x00, 0x00, // ....P...x....... + 0xa8, 0x01, 0x00, 0x00, 0xa9, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ........w...A... + 0x80, 0x00, 0x00, 0x00, 0xab, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ............<... + 0x3d, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xac, 0x01, 0x00, 0x00, 0xab, 0x01, 0x00, 0x00, // =...|........... + 0x90, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0xad, 0x01, 0x00, 0x00, 0xaa, 0x01, 0x00, 0x00, // ....x........... + 0xac, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xae, 0x01, 0x00, 0x00, // ....O........... + 0xad, 0x01, 0x00, 0x00, 0xad, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xcc, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb1, 0x01, 0x00, 0x00, // ....=........... + 0xb0, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb2, 0x01, 0x00, 0x00, // ....O........... + 0xb1, 0x01, 0x00, 0x00, 0xb1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, 0xb3, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xcc, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........=....... + 0xb4, 0x01, 0x00, 0x00, 0xb3, 0x01, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // ........P....... + 0x65, 0x02, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, // e............... + 0x0b, 0x00, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x65, 0x02, 0x00, 0x00, // ....f.......e... + 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x68, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........h....... + 0x04, 0x00, 0x00, 0x00, 0xae, 0x01, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x6a, 0x02, 0x00, 0x00, 0x68, 0x02, 0x00, 0x00, 0x66, 0x02, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // j...h...f...Q... + 0x07, 0x00, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x6a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....l...j....... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6e, 0x02, 0x00, 0x00, 0x6a, 0x02, 0x00, 0x00, // Q.......n...j... + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6f, 0x02, 0x00, 0x00, // ............o... + 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x6e, 0x02, 0x00, 0x00, // ....(...l...n... + 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ........p....... + 0x25, 0x00, 0x00, 0x00, 0x6f, 0x02, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, // %...o...j....... + 0x0b, 0x00, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, // ....r.......(... + 0x6a, 0x02, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, // j...m........... + 0x73, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x72, 0x02, 0x00, 0x00, // s.......B...r... + 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, // ........t...p... + 0x73, 0x02, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x76, 0x02, 0x00, 0x00, // s...........v... + 0x74, 0x02, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // t.......A....... + 0xb6, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, // ............c... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb7, 0x01, 0x00, 0x00, 0xb6, 0x01, 0x00, 0x00, // =............... + 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0xb7, 0x01, 0x00, 0x00, // ................ + 0x8c, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, // ................ + 0x76, 0x02, 0x00, 0x00, 0xb8, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // v.......A....... + 0xba, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, // ............c... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbb, 0x01, 0x00, 0x00, 0xba, 0x01, 0x00, 0x00, // =............... + 0x88, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, // ................ + 0xbb, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, // ....+.......j... + 0x77, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbf, 0x01, 0x00, 0x00, // w...P........... + 0xbd, 0x01, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, 0xbd, 0x01, 0x00, 0x00, // ................ + 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xe1, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc1, 0x01, 0x00, 0x00, // ....=........... + 0xc0, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xc2, 0x01, 0x00, 0x00, // ....A........... + 0x7f, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... + 0xc3, 0x01, 0x00, 0x00, 0xc2, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0x7b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0xc1, 0x01, 0x00, 0x00, // {............... + 0xc3, 0x01, 0x00, 0x00, 0xbf, 0x01, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ................ + 0xc7, 0x01, 0x00, 0x00, 0x5e, 0x02, 0x00, 0x00, 0x4f, 0x02, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ....^...O....... + 0x0d, 0x00, 0x00, 0x00, 0xc9, 0x01, 0x00, 0x00, 0x7b, 0x02, 0x00, 0x00, 0xc7, 0x01, 0x00, 0x00, // ........{....... + 0xf9, 0x00, 0x02, 0x00, 0xa4, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa6, 0x01, 0x00, 0x00, // ................ + 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, 0xcb, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // ........=....... + 0xcc, 0x01, 0x00, 0x00, 0xcb, 0x01, 0x00, 0x00, 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, // ................ + 0xcd, 0x01, 0x00, 0x00, 0xcc, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, // ........w....... + 0xce, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0xcd, 0x01, 0x00, 0x00, // ................ + 0xcf, 0x01, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xcf, 0x01, 0x00, 0x00, // ................ + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, // Q...........d... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd3, 0x01, 0x00, 0x00, // ....Q........... + 0x64, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00, 0x00, // d.......P...x... + 0xd4, 0x01, 0x00, 0x00, 0xd2, 0x01, 0x00, 0x00, 0xd3, 0x01, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // ............w... + 0x41, 0x00, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0xd5, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, // A............... + 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xd6, 0x01, 0x00, 0x00, // <...=...|....... + 0xd5, 0x01, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, // ........x....... + 0xd4, 0x01, 0x00, 0x00, 0xd6, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, // ........O....... + 0xd8, 0x01, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, 0xd7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, 0xd9, 0x01, 0x00, 0x00, // ....A........... + 0x7f, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........=....... + 0xda, 0x01, 0x00, 0x00, 0xd9, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, // ........O....... + 0xdb, 0x01, 0x00, 0x00, 0xda, 0x01, 0x00, 0x00, 0xda, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, // ................ + 0xd8, 0x01, 0x00, 0x00, 0xdb, 0x01, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ........=....... + 0xdd, 0x01, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // ....3...Q....... + 0x8e, 0x02, 0x00, 0x00, 0xdd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x08, 0x00, 0x00, 0x00, 0x8f, 0x02, 0x00, 0x00, 0xdd, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x56, 0x00, 0x05, 0x00, 0x44, 0x00, 0x00, 0x00, 0x81, 0x02, 0x00, 0x00, 0x8f, 0x02, 0x00, 0x00, // V...D........... + 0x8e, 0x02, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, // ....W........... + 0x81, 0x02, 0x00, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0xe0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe1, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xe2, 0x01, 0x00, 0x00, 0xe1, 0x01, 0x00, 0x00, // ................ + 0x77, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // w............... + 0xfa, 0x00, 0x04, 0x00, 0xe2, 0x01, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00, 0xe3, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xe4, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x78, 0x00, 0x00, 0x00, // ........O...x... + 0xe6, 0x01, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0xe8, 0x01, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ................ + 0x78, 0x00, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00, // x............... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, // Q............... + 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, // ....Q........... + 0xe9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0xed, 0x01, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x07, 0x00, 0x00, 0x00, 0xee, 0x01, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, // P............... + 0xed, 0x01, 0x00, 0x00, 0xee, 0x01, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0xe3, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xe3, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0x83, 0x02, 0x00, 0x00, 0xcf, 0x01, 0x00, 0x00, // ................ + 0xef, 0x01, 0x00, 0x00, 0xe4, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0xf0, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0xf1, 0x01, 0x00, 0x00, // ................ + 0x9f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xfa, 0x00, 0x04, 0x00, 0xf2, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, // ........O....... + 0xf6, 0x01, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0xf3, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf3, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xa2, 0x02, 0x00, 0x00, 0xa1, 0x02, 0x00, 0x00, 0xe3, 0x01, 0x00, 0x00, // ................ + 0xf6, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x87, 0x00, 0x00, 0x00, // ........A....... + 0xf7, 0x01, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... + 0x0d, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0xf7, 0x01, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xfa, 0x01, 0x00, 0x00, 0xa2, 0x02, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, // ................ + 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0x5e, 0x02, 0x00, 0x00, // ............^... + 0x4f, 0x02, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, // O............... + 0xfa, 0x01, 0x00, 0x00, 0xfd, 0x01, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xce, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xd0, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0x01, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, // ................ + 0x9f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0xfa, 0x00, 0x04, 0x00, 0x03, 0x02, 0x00, 0x00, 0x05, 0x02, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x05, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x04, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x06, 0x02, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0x07, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x09, 0x02, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, // ................ + 0x38, 0x01, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 8............... + 0xfa, 0x00, 0x04, 0x00, 0x09, 0x02, 0x00, 0x00, 0x0b, 0x02, 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x0b, 0x02, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ........=....... + 0x0c, 0x02, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // ....3...Q....... + 0x92, 0x02, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x08, 0x00, 0x00, 0x00, 0x93, 0x02, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x56, 0x00, 0x05, 0x00, 0x44, 0x00, 0x00, 0x00, 0x89, 0x02, 0x00, 0x00, 0x93, 0x02, 0x00, 0x00, // V...D........... + 0x92, 0x02, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, // ....W........... + 0x89, 0x02, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ....g...A....... + 0x0f, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x0f, 0x02, 0x00, 0x00, // =............... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, // ................ + 0x77, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // w............... + 0xfa, 0x00, 0x04, 0x00, 0x11, 0x02, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0x13, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x78, 0x00, 0x00, 0x00, // ........O...x... + 0x15, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0x17, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, // ................ + 0x78, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x15, 0x02, 0x00, 0x00, 0x17, 0x02, 0x00, 0x00, // x............... + 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, // Q............... + 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00, // ....Q........... + 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, // ........Q....... + 0x1c, 0x02, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... + 0x07, 0x00, 0x00, 0x00, 0x1d, 0x02, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x50, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x1e, 0x02, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x00, // P............... + 0x1c, 0x02, 0x00, 0x00, 0x1d, 0x02, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0x12, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x12, 0x02, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x0b, 0x02, 0x00, 0x00, // ................ + 0x1e, 0x02, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0xa5, 0x00, 0x00, 0x00, // ........A....... + 0x1f, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x1f, 0x02, 0x00, 0x00, // =....... ....... + 0xb4, 0x00, 0x05, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x21, 0x02, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, // ........!... ... + 0x9f, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x22, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........"....... + 0xfa, 0x00, 0x04, 0x00, 0x21, 0x02, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, // ....!...#..."... + 0xf8, 0x00, 0x02, 0x00, 0x23, 0x02, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, // ....#...O....... + 0x25, 0x02, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // %............... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0x22, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x22, 0x02, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // "......."....... + 0x0d, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x9f, 0x02, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, // ................ + 0x25, 0x02, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // %...#........... + 0x28, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x4f, 0x02, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // (.......O...A... + 0x87, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, // ....*........... + 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x02, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, // =.......+...*... + 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, // ........,...(... + 0x2b, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0x0a, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // +............... + 0x0a, 0x02, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa6, 0x02, 0x00, 0x00, // ................ + 0xa7, 0x02, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x22, 0x02, 0x00, 0x00, // ........,..."... + 0xf9, 0x00, 0x02, 0x00, 0x04, 0x02, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x04, 0x02, 0x00, 0x00, // ................ + 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa5, 0x02, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, // ............4... + 0x05, 0x02, 0x00, 0x00, 0xa6, 0x02, 0x00, 0x00, 0x0a, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, // ................ + 0xce, 0x01, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xce, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, // ................ + 0x0d, 0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00, // ................ + 0xa5, 0x02, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0xf9, 0x00, 0x02, 0x00, 0xa4, 0x01, 0x00, 0x00, // ................ + 0xf8, 0x00, 0x02, 0x00, 0xa4, 0x01, 0x00, 0x00, 0xf5, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, // ................ + 0xa3, 0x02, 0x00, 0x00, 0xc9, 0x01, 0x00, 0x00, 0xa5, 0x01, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x00, // ................ + 0xce, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x71, 0x01, 0x00, 0x00, 0xa3, 0x02, 0x00, 0x00, // ....>...q....... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb0, 0x00, // ....8....... }; static const uint8_t fs_nanovg_fill_dx9[1585] = { diff --git a/3rdparty/bgfx/examples/common/nanovg/makefile b/3rdparty/bgfx/examples/common/nanovg/makefile index 928467df33c..9dd5826c317 100644 --- a/3rdparty/bgfx/examples/common/nanovg/makefile +++ b/3rdparty/bgfx/examples/common/nanovg/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp index dcd652c8c26..db392092c8b 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp @@ -77,6 +77,7 @@ enum NVGpointFlags struct NVGstate { NVGcompositeOperationState compositeOperation; + int shapeAntiAlias; NVGpaint fill; NVGpaint stroke; float strokeWidth; @@ -655,6 +656,7 @@ void nvgReset(NVGcontext* ctx) nvg__setPaintColor(&state->fill, nvgRGBA(255,255,255,255)); nvg__setPaintColor(&state->stroke, nvgRGBA(0,0,0,255)); state->compositeOperation = nvg__compositeOperationState(NVG_SOURCE_OVER); + state->shapeAntiAlias = 1; state->strokeWidth = 1.0f; state->miterLimit = 10.0f; state->lineCap = NVG_BUTT; @@ -674,6 +676,12 @@ void nvgReset(NVGcontext* ctx) } // State setting +void nvgShapeAntiAlias(NVGcontext* ctx, int enabled) +{ + NVGstate* state = nvg__getState(ctx); + state->shapeAntiAlias = enabled; +} + void nvgStrokeWidth(NVGcontext* ctx, float width) { NVGstate* state = nvg__getState(ctx); @@ -2183,7 +2191,7 @@ void nvgFill(NVGcontext* ctx) int i; nvg__flattenPaths(ctx); - if (ctx->params.edgeAntiAlias) + if (ctx->params.edgeAntiAlias && state->shapeAntiAlias) nvg__expandFill(ctx, ctx->fringeWidth, NVG_MITER, 2.4f); else nvg__expandFill(ctx, 0.0f, NVG_MITER, 2.4f); @@ -2228,7 +2236,7 @@ void nvgStroke(NVGcontext* ctx) nvg__flattenPaths(ctx); - if (ctx->params.edgeAntiAlias) + if (ctx->params.edgeAntiAlias && state->shapeAntiAlias) nvg__expandStroke(ctx, strokeWidth*0.5f + ctx->fringeWidth*0.5f, state->lineCap, state->lineJoin, state->miterLimit); else nvg__expandStroke(ctx, strokeWidth*0.5f, state->lineCap, state->lineJoin, state->miterLimit); @@ -2413,7 +2421,7 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* verts = nvg__allocTempVerts(ctx, cverts); if (verts == NULL) return x; - fonsTextIterInit(ctx->fs, &iter, x*scale, y*scale, string, end); + fonsTextIterInit(ctx->fs, &iter, x*scale, y*scale, string, end, FONS_GLYPH_BITMAP_REQUIRED); prevIter = iter; while (fonsTextIterNext(ctx->fs, &iter, &q)) { float c[4*2]; @@ -2451,7 +2459,7 @@ float nvgText(NVGcontext* ctx, float x, float y, const char* string, const char* nvg__renderText(ctx, verts, nverts); - return iter.x; + return iter.nextx / scale; } void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end) @@ -2510,7 +2518,7 @@ int nvgTextGlyphPositions(NVGcontext* ctx, float x, float y, const char* string, fonsSetAlign(ctx->fs, state->textAlign); fonsSetFont(ctx->fs, state->fontId); - fonsTextIterInit(ctx->fs, &iter, x*scale, y*scale, string, end); + fonsTextIterInit(ctx->fs, &iter, x*scale, y*scale, string, end, FONS_GLYPH_BITMAP_OPTIONAL); prevIter = iter; while (fonsTextIterNext(ctx->fs, &iter, &q)) { if (iter.prevGlyphIndex < 0 && nvg__allocTextAtlas(ctx)) { // can not retrieve glyph? @@ -2576,7 +2584,7 @@ int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, floa breakRowWidth *= scale; - fonsTextIterInit(ctx->fs, &iter, 0, 0, string, end); + fonsTextIterInit(ctx->fs, &iter, 0, 0, string, end, FONS_GLYPH_BITMAP_OPTIONAL); prevIter = iter; while (fonsTextIterNext(ctx->fs, &iter, &q)) { if (iter.prevGlyphIndex < 0 && nvg__allocTextAtlas(ctx)) { // can not retrieve glyph? diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg.h b/3rdparty/bgfx/examples/common/nanovg/nanovg.h index a6a952c3cae..074ae96a7fe 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg.h +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg.h @@ -240,6 +240,9 @@ void nvgReset(NVGcontext* ctx); // // Current render style can be saved and restored using nvgSave() and nvgRestore(). +// Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default. +void nvgShapeAntiAlias(NVGcontext* ctx, int enabled); + // Sets current stroke style to a solid color. void nvgStrokeColor(NVGcontext* ctx, NVGcolor color); @@ -268,7 +271,7 @@ void nvgLineCap(NVGcontext* ctx, int cap); void nvgLineJoin(NVGcontext* ctx, int join); // Sets the transparency applied to all rendered shapes. -// Already transparent paths will get proportionally more transparent as well. +// Alreade transparent paths will get proportionally more transparent as well. void nvgGlobalAlpha(NVGcontext* ctx, float alpha); // @@ -392,7 +395,7 @@ NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float NVGcolor icol, NVGcolor ocol); // Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering -// drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle, +// drop shadows or hilights for boxes. Parameters (x,y) define the top-left corner of the rectangle, // (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry // the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient. // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp index abf571a5965..77699841c01 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -331,7 +331,7 @@ namespace , false , 1 , NVG_TEXTURE_RGBA == _type ? bgfx::TextureFormat::RGBA8 : bgfx::TextureFormat::R8 - , BGFX_TEXTURE_NONE + , BGFX_SAMPLER_NONE ); if (NULL != mem) @@ -777,8 +777,8 @@ namespace struct GLNVGcall* call = &gl->calls[ii]; const GLNVGblend* blend = &call->blendFunc; gl->state = BGFX_STATE_BLEND_FUNC_SEPARATE(blend->srcRGB, blend->dstRGB, blend->srcAlpha, blend->dstAlpha) - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A ; switch (call->type) { @@ -1144,12 +1144,12 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId) { return nvgCreate(_edgeaa, _viewId, NULL); } -void nvgDelete(struct NVGcontext* _ctx) +void nvgDelete(NVGcontext* _ctx) { nvgDeleteInternal(_ctx); } -void nvgSetViewId(struct NVGcontext* _ctx, bgfx::ViewId _viewId) +void nvgSetViewId(NVGcontext* _ctx, bgfx::ViewId _viewId) { struct NVGparams* params = nvgInternalParams(_ctx); struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr; diff --git a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h index 9bb3a8462e0..90bf95a7ea4 100644 --- a/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h +++ b/3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -27,10 +27,10 @@ NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _al NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId); /// -void nvgDelete(struct NVGcontext* _ctx); +void nvgDelete(NVGcontext* _ctx); /// -void nvgSetViewId(struct NVGcontext* _ctx, bgfx::ViewId _viewId); +void nvgSetViewId(NVGcontext* _ctx, bgfx::ViewId _viewId); /// uint16_t nvgGetViewId(struct NVGcontext* _ctx); diff --git a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h index aecc5785cf7..5b2853828be 100644 --- a/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h +++ b/3rdparty/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h @@ -35,220 +35,101 @@ static const uint8_t vs_nanovg_fill_glsl[541] = 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, // gl_Position = t 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mpvar_1;.}... }; -static const uint8_t vs_nanovg_fill_spv[3378] = +static const uint8_t vs_nanovg_fill_spv[1481] = { 0x56, 0x53, 0x48, 0x05, 0xcf, 0xda, 0x1b, 0x94, 0x02, 0x00, 0x0b, 0x75, 0x5f, 0x68, 0x61, 0x6c, // VSH........u_hal - 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, // fTexel.......u_v - 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0d, 0x00, // iewSize......... - 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0xfe, 0x61, 0x00, // ...#..........a. + 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x02, 0x01, 0x10, 0x00, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x76, // fTexel.......u_v + 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x90, 0x05, 0x00, // iewSize......... + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xb1, 0x00, 0x00, // ...#............ 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... - 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, // n............... - 0x00, 0x87, 0x0c, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x46, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, // n........F...Out - 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x46, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // put......F...... - 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, // .gl_Position.... - 0x00, 0x46, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // .F.......v_posit - 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x46, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, // ion......F...... - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0x06, 0x0f, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x32, 0x3b, 0x76, // .....@main(vf2;v - 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x48, 0x55, 0x00, 0x00, 0x61, 0x5f, 0x70, // f2;......HU..a_p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x15, 0x26, 0x00, // osition.......&. - 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, // .a_texcoord0.... - 0x00, 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, // ....._varying_.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // .........$Global - 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v - 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, // iewRect......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, // .....u_viewTexel - 0x00, 0x06, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .............u_v - 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // iew............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, // .u_invView...... - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, // .........u_proj. - 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, // nvProj.......... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // .....u_viewProj. - 0x00, 0x06, 0x00, 0x07, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, // nvViewProj...... - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xd7, 0x05, 0x00, // odelView........ - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // .....u_modelView - 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, // Proj............ - 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x06, // .u_alphaRef4.... - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, // .........u_viewS - 0x69, 0x7a, 0x65, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0d, 0x00, 0x00, // ize............. - 0x00, 0x75, 0x5f, 0x68, 0x61, 0x6c, 0x66, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x05, 0x00, 0x03, // .u_halfTexel.... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x41, 0x00, // .B............A. - 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, // .a_position..... - 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, // .....a_position. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // .....,?..a_texco - 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, // ord0.........a_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, // excoord0........ - 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, // .flattenTemp.... - 0x00, 0xab, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..U..param...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, // .....param...... - 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, // .....@entryPoint - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, // Output.gl_Positi - 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x87, 0x0c, 0x00, 0x00, 0x40, 0x65, 0x6e, // on...........@en - 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, // tryPointOutput.v - 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, // _position....... - 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, // .....@entryPoint - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // Output.v_texcoor - 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x20, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // d0...G... ...... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, // .@...H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd7, 0x05, 0x00, // .#... ...H...... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...0...H.. - 0x00, 0xd7, 0x05, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x0a, 0x00, // .........#...@.. - 0x00, 0x47, 0x00, 0x03, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...........G.. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .B...".......G.. - 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .............G.. - 0x00, 0x95, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .............G.. - 0x00, 0x95, 0x15, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .............G.. - 0x00, 0x87, 0x0c, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .............G.. - 0x00, 0x8b, 0x17, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // ................ - 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, // .....!.......... - 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ......... ...... - 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, // ................ - 0x00, 0x46, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, // .F.............. - 0x00, 0x21, 0x00, 0x05, 0x00, 0xb0, 0x07, 0x00, 0x00, 0x46, 0x04, 0x00, 0x00, 0x90, 0x02, 0x00, // .!.......F...... - 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xc3, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x46, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .F........... .. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, // .....+.......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, // .....,.......... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x20, 0x01, 0x00, // .j... ....... .. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x10, 0x00, 0xd7, 0x05, 0x00, // .e...j.......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x20, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . ...e...e...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x54, 0x08, 0x00, // ......... ...T.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0xd7, 0x05, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x54, 0x08, 0x00, // .........;...T.. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.......+...... - 0x00, 0x32, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .2....... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ........@+...... - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, // ./....... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ........?+...... - 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, // ......... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, // .........;...... - 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, // .........;...... - 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // ......... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, // ......... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, // .........;...... - 0x00, 0x87, 0x0c, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, // .........;...... - 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xc3, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, // .Sa..;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0xab, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xcb, 0x41, 0x00, // .....=........A. - 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x2c, 0x3f, 0x00, // .....=.......,?. - 0x00, 0x95, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xab, 0x55, 0x00, 0x00, 0xcb, 0x41, 0x00, // .....>....U...A. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x2c, 0x3f, 0x00, 0x00, 0x39, 0x00, 0x06, // .>.......,?..9.. - 0x00, 0x46, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x06, 0x0f, 0x00, 0x00, 0xab, 0x55, 0x00, // .F...I&.......U. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, // .....>.......I&. - 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, // .A.......T4..... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, // .....=.......... - 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, // .T4..>.......... - 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, // .A........@..... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, // .....=....... .. - 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x87, 0x0c, 0x00, 0x00, 0x20, 0x1f, 0x00, // ..@..>....... .. - 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, // .A........@..... - 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, // .....=........-. - 0x00, 0xef, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, // ..@..>........-. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x46, 0x04, 0x00, // .....8...6...F.. - 0x00, 0x06, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, // .............7.. - 0x00, 0x90, 0x02, 0x00, 0x00, 0x48, 0x55, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, // .....HU..7...... - 0x00, 0x15, 0x26, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x08, 0x5f, 0x00, 0x00, 0x3b, 0x00, 0x04, // ..&......._..;.. - 0x00, 0xc3, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // .............A.. - 0x00, 0x90, 0x02, 0x00, 0x00, 0xd4, 0x1b, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, // ................ - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x1b, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x41, 0x00, 0x05, // .>...........A.. - 0x00, 0x90, 0x02, 0x00, 0x00, 0xb4, 0x3f, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, // ......?......... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb4, 0x3f, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, // .>....?......=.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0xc6, 0x28, 0x00, 0x00, 0x48, 0x55, 0x00, 0x00, 0x41, 0x00, 0x05, // ......(..HU..A.. - 0x00, 0x90, 0x02, 0x00, 0x00, 0xd6, 0x43, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, // ......C......... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd6, 0x43, 0x00, 0x00, 0xc6, 0x28, 0x00, 0x00, 0x3d, 0x00, 0x04, // .>....C...(..=.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0xb3, 0x28, 0x00, 0x00, 0x15, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, // ......(...&..A.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd9, 0x45, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x32, 0x0a, 0x00, // ......E..B...2.. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x43, 0x5f, 0x00, 0x00, 0xd9, 0x45, 0x00, // .=.......C_...E. - 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1d, 0x5d, 0x00, 0x00, 0x43, 0x5f, 0x00, // .O........]..C_. - 0x00, 0x43, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, // .C_............. - 0x00, 0x13, 0x00, 0x00, 0x00, 0xdc, 0x2b, 0x00, 0x00, 0xb3, 0x28, 0x00, 0x00, 0x1d, 0x5d, 0x00, // ......+...(...]. - 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0x5a, 0x56, 0x00, 0x00, 0x0f, 0x12, 0x00, // .A.......ZV..... - 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5a, 0x56, 0x00, 0x00, 0xdc, 0x2b, 0x00, // .....>...ZV...+. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xb9, 0x45, 0x00, 0x00, 0x0f, 0x12, 0x00, // .A........E..... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x8f, 0x2c, 0x00, 0x00, 0xb9, 0x45, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ..,...E......... - 0x00, 0xc5, 0x2e, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x8f, 0x2c, 0x00, 0x00, 0x41, 0x00, 0x06, // ..........,..A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0xec, 0x38, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......8..B.../.. - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf0, 0x51, 0x00, // .....=........Q. - 0x00, 0xec, 0x38, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x72, 0x37, 0x00, // ..8..........r7. - 0x00, 0xc5, 0x2e, 0x00, 0x00, 0xf0, 0x51, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ......Q......... - 0x00, 0xa4, 0x44, 0x00, 0x00, 0x72, 0x37, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // ..D..r7......A.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x42, 0x1f, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, // .....B.......... - 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfd, 0x61, 0x00, // .....=........a. - 0x00, 0x42, 0x1f, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc6, 0x2e, 0x00, // .B.............. - 0x00, 0x18, 0x00, 0x00, 0x00, 0xfd, 0x61, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, // ......a..A...... - 0x00, 0xed, 0x38, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0d, 0x0a, 0x00, // ..8..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x00, 0x00, 0xed, 0x38, 0x00, // .=........Q...8. - 0x00, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8f, 0x38, 0x00, 0x00, 0xc6, 0x2e, 0x00, // ..........8..... - 0x00, 0xf1, 0x51, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xcd, 0x3a, 0x00, // ..Q...........:. - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8f, 0x38, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ......8..P...... - 0x00, 0xb3, 0x40, 0x00, 0x00, 0xa4, 0x44, 0x00, 0x00, 0xcd, 0x3a, 0x00, 0x00, 0x0c, 0x0a, 0x00, // ..@...D...:..... - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x2b, 0x33, 0x00, // .....A.......+3. - 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2b, 0x33, 0x00, // .........>...+3. - 0x00, 0xb3, 0x40, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x46, 0x04, 0x00, 0x00, 0xd1, 0x5b, 0x00, // ..@..=...F....[. - 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xd1, 0x5b, 0x00, 0x00, 0x38, 0x00, 0x01, // ..........[..8.. - 0x00, 0x00, // .. + 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // n....G...J...S.. + 0x00, 0x57, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // .W...Z.......... + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, // n............$Gl + 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // obal............ + 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewSize..... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x68, 0x61, 0x6c, 0x66, 0x54, // .........u_halfT + 0x65, 0x78, 0x65, 0x6c, 0x00, 0x05, 0x00, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exel............ + 0x00, 0x05, 0x00, 0x05, 0x00, 0x47, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // .....G...a_posit + 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, // ion......J...a_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x53, 0x00, 0x00, // excoord0.....S.. + 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, // .@entryPointOutp + 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ut.gl_Position.. + 0x00, 0x05, 0x00, 0x0a, 0x00, 0x57, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, // .....W...@entryP + 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x70, 0x6f, 0x73, // ointOutput.v_pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x5a, 0x00, 0x00, // ition........Z.. + 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, // .@entryPointOutp + 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, // ut.v_texcoord0.. + 0x00, 0x48, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....H.......... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x00, // .#.......G...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G.......".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...G...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...J...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x53, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....G...S...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...W...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...Z...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // . .............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, // .....+.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....;.......... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, // .....+.......%.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .....+.......&.. + 0x00, 0x00, 0x00, 0x00, 0x40, 0x15, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ....@....'... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .....+...'...(.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...-...... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, // .....+.......1.. + 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, // ....?+...'...3.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... ...F...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, // .....;...F...G.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x46, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, // .....;...F...J.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...R...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, // .....;...R...S.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...V...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, // .....;...V...W.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, // .....;...V...Z.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....H...G...=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, // .....K...J...A.. + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, // .....v.......... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, // .=.......w...v.. + 0x00, 0x4f, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, // .O.......x...w.. + 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, // .w.............. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // .....y...K...x.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, // .Q.......|...H.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. + 0x00, 0x26, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2d, 0x00, 0x00, // .&...|...A...-.. + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .~.......%...(.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, // .=...........~.. + 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. + 0x00, 0x7f, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....1...Q...... + 0x00, 0x83, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, // .....H.......... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, // .........&...... + 0x00, 0x41, 0x00, 0x06, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .A...-.......... + 0x00, 0x25, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, // .%...3...=...... + 0x00, 0x86, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x87, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, // .............P.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, // ................ + 0x00, 0x14, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....1.......... + 0x00, 0x8d, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, // .........1...R.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x53, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, // .....>...S...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x57, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...W...H...>.. + 0x00, 0x5a, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .Z...y.......8.. + 0x00, 0x00, 0x02, 0x01, 0x00, 0x10, 0x00, 0x20, 0x00, // ....... . }; static const uint8_t vs_nanovg_fill_dx9[426] = { diff --git a/3rdparty/bgfx/examples/common/packrect.h b/3rdparty/bgfx/examples/common/packrect.h index fa6ebebe213..994b31c95b3 100644 --- a/3rdparty/bgfx/examples/common/packrect.h +++ b/3rdparty/bgfx/examples/common/packrect.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -43,8 +43,8 @@ public: bool find(uint16_t _width, uint16_t _height, Pack2D& _pack) { - uint16_t width = bx::uint16_min(64, (_width + m_bw - 1) / m_bw); - uint16_t height = bx::uint16_min(numBlocks, (_height + m_bh - 1) / m_bh); + uint16_t width = bx::min(64, (_width + m_bw - 1) / m_bw); + uint16_t height = bx::min(numBlocks, (_height + m_bh - 1) / m_bh); uint16_t numx = 64-width; uint16_t numy = numBlocks-height; @@ -90,10 +90,10 @@ public: void clear(const Pack2D& _pack) { - uint16_t startx = bx::uint16_min(63, _pack.m_x / m_bw); - uint16_t starty = bx::uint16_min(numBlocks-1, _pack.m_y / m_bh); - uint16_t endx = bx::uint16_min(64, (_pack.m_width + m_bw - 1) / m_bw + startx); - uint16_t endy = bx::uint16_min(numBlocks, (_pack.m_height + m_bh - 1) / m_bh + starty); + uint16_t startx = bx::min(63, _pack.m_x / m_bw); + uint16_t starty = bx::min(numBlocks-1, _pack.m_y / m_bh); + uint16_t endx = bx::min(64, (_pack.m_width + m_bw - 1) / m_bw + startx); + uint16_t endy = bx::min(numBlocks, (_pack.m_height + m_bh - 1) / m_bh + starty); uint16_t width = endx - startx; const uint64_t mask = (width == 64 ? UINT64_MAX : (UINT64_C(1)<. - 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. - 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, // ..........A..... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. - 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..P.......=..... - 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ...+..w...=..... - 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, // ...<..t...>....U - 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, // ...+..>....8...< - 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0x82, 0x0d, // ..9........&.... - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // ...U...8......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, // ......7...y...~. - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, // ..7...........7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, // ................ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0xf7, 0x0d, // ..=............. - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x7e, 0x17, // ..=........H..~. - 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, // ..V........>.... - 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x24, // ...H..=........$ - 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, // ......W........Y - 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, // ...>...$.......Y - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, // ..8...6.......5. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, // ..........7..... - 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2e, 0x5f, 0x00, 0x00, 0x3d, 0x00, // ..........._..=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......[......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x53, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // ......%S......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, // .......=......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, // .......=......P. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x56, 0x5b, 0x00, 0x00, 0xe0, 0x5b, 0x00, 0x00, 0x25, 0x53, // ......V[...[..%S - 0x00, 0x00, 0xc5, 0x3d, 0x00, 0x00, 0xd8, 0x3d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x56, 0x5b, // ...=...=......V[ - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x82, 0x0d, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ..........7..... - 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8f, 0x41, // ..nb..7........A - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0xf8, 0x00, // ..7........J.... - 0x02, 0x00, 0xc0, 0x53, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5d, // ...S..;........] - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x60, 0x10, // ......;.......`. - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xbe, 0x39, // ......;...y....9 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x39, // ......;........9 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x91, 0x37, // ......;........7 - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x0c, 0x0a, // ......>....].... - 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, // ..9...........5. - 0x00, 0x00, 0x9d, 0x5d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x23, 0x41, // ...]..=.......#A - 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbe, 0x39, 0x00, 0x00, 0x23, 0x41, // ......>....9..#A - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x50, 0x13, // ..=........,..P. - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, 0x3d, 0x00, // ..>....9...,..=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x8f, 0x41, 0x00, 0x00, 0x4f, 0x00, // .......!...A..O. - 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0xa0, 0x37, 0x00, 0x00, 0x19, 0x21, 0x00, 0x00, 0x19, 0x21, // .......7...!...! - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x91, 0x37, // ..........>....7 - 0x00, 0x00, 0xa0, 0x37, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe1, 0x5c, // ...7..9......... - 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0xbe, 0x39, 0x00, 0x00, 0xf7, 0x39, 0x00, 0x00, 0x91, 0x37, // .......9...9...7 - 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x09, 0x55, 0x00, 0x00, 0xe1, 0x5c, // ..O........U.... - 0x00, 0x00, 0xe1, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x09, 0x55, // ......>...`....U - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x49, 0x27, 0x00, 0x00, 0x60, 0x10, // ..=.......I'..`. - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0xef, 0x39, 0x00, 0x00, 0x49, 0x27, // ..O........9..I' - 0x00, 0x00, 0x49, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ..I'............ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xef, 0x45, 0x00, 0x00, 0x6e, 0x62, // ..=........E..nb - 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x75, 0x62, 0x00, 0x00, 0xef, 0x45, // ..O.......ub...E - 0x00, 0x00, 0xef, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, // ...E............ - 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0xed, 0x35, 0x00, 0x00, 0xef, 0x39, // ...........5...9 - 0x00, 0x00, 0x75, 0x62, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xcb, 0x34, // ..ub..A........4 - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..`.......=..... - 0x00, 0x00, 0x5f, 0x57, 0x00, 0x00, 0xcb, 0x34, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, // .._W...4........ - 0x00, 0x00, 0xe2, 0x2d, 0x00, 0x00, 0xed, 0x35, 0x00, 0x00, 0x5f, 0x57, 0x00, 0x00, 0x41, 0x00, // ...-...5.._W..A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xd4, 0x3d, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x13, 0x0a, // .......=..nb.... - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x98, 0x4d, 0x00, 0x00, 0xd4, 0x3d, // ..=........M...= - 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0xec, 0x31, 0x00, 0x00, 0xe2, 0x2d, // ...........1...- - 0x00, 0x00, 0x98, 0x4d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3f, 0x61, // ...M..=.......?a - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf9, 0x1f, // ..`...O......... - 0x00, 0x00, 0x3f, 0x61, 0x00, 0x00, 0xec, 0x31, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, // ..?a...1........ - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x60, 0x10, // ..........>...`. - 0x00, 0x00, 0xf9, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xb9, 0x48, // ......A........H - 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..`.......=..... - 0x00, 0x00, 0x1b, 0x1e, 0x00, 0x00, 0xb9, 0x48, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, // .......H..A..... - 0x00, 0x00, 0x15, 0x55, 0x00, 0x00, 0x6e, 0x62, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...U..nb......=. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2f, 0x2b, 0x00, 0x00, 0x15, 0x55, 0x00, 0x00, 0x85, 0x00, // ....../+...U.... - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xef, 0x23, 0x00, 0x00, 0x1b, 0x1e, 0x00, 0x00, 0x2f, 0x2b, // .......#....../+ - 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xb7, 0x2d, 0x00, 0x00, 0x8f, 0x41, // ..A........-...A - 0x00, 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5b, 0x19, // ......=.......[. - 0x00, 0x00, 0xb7, 0x2d, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x36, // ...-..........I6 - 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x5b, 0x19, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0d, 0x00, // ......[......... - 0x00, 0x00, 0x74, 0x62, 0x00, 0x00, 0xef, 0x23, 0x00, 0x00, 0x49, 0x36, 0x00, 0x00, 0x41, 0x00, // ..tb...#..I6..A. - 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xd0, 0x53, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x13, 0x0a, // .......S..`..... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd0, 0x53, 0x00, 0x00, 0x74, 0x62, 0x00, 0x00, 0x3d, 0x00, // ..>....S..tb..=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x24, 0x2e, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x3e, 0x00, // ......$...`...>. - 0x03, 0x00, 0x8c, 0x4a, 0x00, 0x00, 0x24, 0x2e, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ...J..$.......8. - 0x01, 0x00, 0x00, // ... + 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ..%...s_texColor + 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x69, 0x00, // Texture.......i. + 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... + 0x05, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // ..l...v_texcoord + 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x77, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, // 0.....w...bgfx_F + 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ragData0..G...%. + 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, // ..".......G...%. + 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x69, 0x00, // ..!.......G...i. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x6c, 0x00, // ..........G...l. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x00, // ..........G...w. + 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. + 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, // ................ + 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ......... + 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, // ......;....... . + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, // ...... ...!..... + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, // ......;...!...". + 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... ...$..... + 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, // ......;...$...%. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x31, 0x00, 0x00, 0x00, 0x08, 0x00, // ..........1..... + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ......J......... + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+......._..... + 0x80, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, // .? ...h......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...h...i..... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...h...l..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ...v......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;...v...w..... + 0x00, 0x00, 0x2e, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x36, 0x00, // ..............6. + 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, // ..........=..... + 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, // ..#..."...=..... + 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, // ..&...%...P..... + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..'...#...&...>. + 0x03, 0x00, 0x20, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // .. ...'...=..... + 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..j...i...=..... + 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, // ..m...l...=..... + 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, // ...... ...Q..... + 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x6d, 0x00, // ..O...........m. + 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x00, // ..m...........V. + 0x05, 0x00, 0x31, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0xbe, 0x00, // ..1............. + 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xb9, 0x00, // ..W............. + 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x97, 0x00, // ......O...J..... + 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x99, 0x00, // ......O...J..... + 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..j...j......... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x9a, 0x00, // ..........J..... + 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00, // ................ + 0x05, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x9c, 0x00, // ..J............. + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x6a, 0x00, // ..Q...........j. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x4a, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........J..... + 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, // ..........O..... + 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, // ..............Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x6a, 0x00, // ..Q...........j. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa7, 0x00, // ................ + 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, // ..........Q..... + 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x83, 0x00, // ......m......... + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0xa9, 0x00, // .........._..... + 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0xa7, 0x00, // ................ + 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xc6, 0x00, // ......R......... + 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..............>. + 0x03, 0x00, 0x77, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..w...........8. + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ...... }; static const uint8_t fs_particle_dx9[328] = { diff --git a/3rdparty/bgfx/examples/common/ps/fs_particle.sc b/3rdparty/bgfx/examples/common/ps/fs_particle.sc index f0b4f569fc6..486a7cdff18 100644 --- a/3rdparty/bgfx/examples/common/ps/fs_particle.sc +++ b/3rdparty/bgfx/examples/common/ps/fs_particle.sc @@ -1,7 +1,7 @@ $input v_color0, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/ps/makefile b/3rdparty/bgfx/examples/common/ps/makefile index 27e6c6bf04d..72fbea92955 100644 --- a/3rdparty/bgfx/examples/common/ps/makefile +++ b/3rdparty/bgfx/examples/common/ps/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/examples/common/ps/particle_system.cpp b/3rdparty/bgfx/examples/common/ps/particle_system.cpp index 7ad93331a37..c7a57d5b0fd 100644 --- a/3rdparty/bgfx/examples/common/ps/particle_system.cpp +++ b/3rdparty/bgfx/examples/common/ps/particle_system.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -98,8 +98,8 @@ namespace ps { struct Particle { - float start[3]; - float end[2][3]; + bx::Vec3 start; + bx::Vec3 end[2]; float blendStart; float blendEnd; float scaleStart; @@ -237,6 +237,8 @@ namespace ps const uint32_t numParticles = uint32_t(m_dt / timePerParticle); m_dt -= numParticles * timePerParticle; + constexpr bx::Vec3 up = { 0.0f, 1.0f, 0.0f }; + float time = 0.0f; for (uint32_t ii = 0 ; ii < numParticles && m_num < m_max @@ -246,84 +248,81 @@ namespace ps Particle& particle = m_particles[m_num]; m_num++; - const float up[3] = { 0.0f, 1.0f, 0.0f }; - - float pos[3]; + bx::Vec3 pos; switch (m_shape) { default: case EmitterShape::Sphere: - bx::randUnitSphere(pos, &m_rng); + pos = bx::randUnitSphere(&m_rng); break; case EmitterShape::Hemisphere: - bx::randUnitHemisphere(pos, &m_rng, up); + pos = bx::randUnitHemisphere(&m_rng, up); break; case EmitterShape::Circle: - bx::randUnitCircle(pos, &m_rng); + pos = bx::randUnitCircle(&m_rng); break; case EmitterShape::Disc: { - float tmp[3]; - bx::randUnitCircle(tmp, &m_rng); - bx::vec3Mul(pos, tmp, bx::frnd(&m_rng) ); + const bx::Vec3 tmp = bx::randUnitCircle(&m_rng); + pos = bx::mul(tmp, bx::frnd(&m_rng) ); } break; case EmitterShape::Rect: - pos[0] = bx::frndh(&m_rng); - pos[1] = 0.0f; - pos[2] = bx::frndh(&m_rng); + pos = + { + bx::frndh(&m_rng), + 0.0f, + bx::frndh(&m_rng), + }; break; } - float dir[3]; + bx::Vec3 dir; switch (m_direction) { default: case EmitterDirection::Up: - bx::vec3Move(dir, up); + dir = up; break; case EmitterDirection::Outward: - bx::vec3Norm(dir, pos); + dir = bx::normalize(pos); break; } - float start[3]; - float end[3]; - const float startOffset = bx::flerp(m_uniforms.m_offsetStart[0], m_uniforms.m_offsetStart[1], bx::frnd(&m_rng) ); - bx::vec3Mul(start, pos, startOffset); + const float startOffset = bx::lerp(m_uniforms.m_offsetStart[0], m_uniforms.m_offsetStart[1], bx::frnd(&m_rng) ); + const bx::Vec3 start = bx::mul(pos, startOffset); - const float endOffset = bx::flerp(m_uniforms.m_offsetEnd[0], m_uniforms.m_offsetEnd[1], bx::frnd(&m_rng) ); - float tmp1[3]; - bx::vec3Mul(tmp1, dir, endOffset); - bx::vec3Add(end, tmp1, start); + const float endOffset = bx::lerp(m_uniforms.m_offsetEnd[0], m_uniforms.m_offsetEnd[1], bx::frnd(&m_rng) ); + const bx::Vec3 tmp1 = bx::mul(dir, endOffset); + const bx::Vec3 end = bx::add(tmp1, start); particle.life = time; - particle.lifeSpan = bx::flerp(m_uniforms.m_lifeSpan[0], m_uniforms.m_lifeSpan[1], bx::frnd(&m_rng) ); + particle.lifeSpan = bx::lerp(m_uniforms.m_lifeSpan[0], m_uniforms.m_lifeSpan[1], bx::frnd(&m_rng) ); - float gravity[3] = { 0.0f, -9.81f * m_uniforms.m_gravityScale * bx::fsq(particle.lifeSpan), 0.0f }; + const bx::Vec3 gravity = { 0.0f, -9.81f * m_uniforms.m_gravityScale * bx::square(particle.lifeSpan), 0.0f }; - bx::vec3MulMtx(particle.start, start, mtx); - bx::vec3MulMtx(particle.end[0], end, mtx); - bx::vec3Add(particle.end[1], particle.end[0], gravity); + particle.start = bx::mul(start, mtx); + particle.end[0] = bx::mul(end, mtx); + particle.end[1] = bx::add(particle.end[0], gravity); bx::memCopy(particle.rgba, m_uniforms.m_rgba, BX_COUNTOF(m_uniforms.m_rgba)*sizeof(uint32_t) ); - particle.blendStart = bx::flerp(m_uniforms.m_blendStart[0], m_uniforms.m_blendStart[1], bx::frnd(&m_rng) ); - particle.blendEnd = bx::flerp(m_uniforms.m_blendEnd[0], m_uniforms.m_blendEnd[1], bx::frnd(&m_rng) ); + particle.blendStart = bx::lerp(m_uniforms.m_blendStart[0], m_uniforms.m_blendStart[1], bx::frnd(&m_rng) ); + particle.blendEnd = bx::lerp(m_uniforms.m_blendEnd[0], m_uniforms.m_blendEnd[1], bx::frnd(&m_rng) ); - particle.scaleStart = bx::flerp(m_uniforms.m_scaleStart[0], m_uniforms.m_scaleStart[1], bx::frnd(&m_rng) ); - particle.scaleEnd = bx::flerp(m_uniforms.m_scaleEnd[0], m_uniforms.m_scaleEnd[1], bx::frnd(&m_rng) ); + particle.scaleStart = bx::lerp(m_uniforms.m_scaleStart[0], m_uniforms.m_scaleStart[1], bx::frnd(&m_rng) ); + particle.scaleEnd = bx::lerp(m_uniforms.m_scaleEnd[0], m_uniforms.m_scaleEnd[1], bx::frnd(&m_rng) ); time += timePerParticle; } } - uint32_t render(const float _uv[4], const float* _mtxView, const float* _eye, uint32_t _first, uint32_t _max, ParticleSort* _outSort, PosColorTexCoord0Vertex* _outVertices) + uint32_t render(const float _uv[4], const float* _mtxView, const bx::Vec3& _eye, uint32_t _first, uint32_t _max, ParticleSort* _outSort, PosColorTexCoord0Vertex* _outVertices) { bx::EaseFn easeRgba = bx::getEaseFunc(m_uniforms.m_easeRgba); bx::EaseFn easePos = bx::getEaseFunc(m_uniforms.m_easePos); @@ -332,8 +331,8 @@ namespace ps Aabb aabb = { - { bx::kHuge, bx::kHuge, bx::kHuge }, - { -bx::kHuge, -bx::kHuge, -bx::kHuge }, + { bx::kInfinity, bx::kInfinity, bx::kInfinity }, + { -bx::kInfinity, -bx::kInfinity, -bx::kInfinity }, }; for (uint32_t jj = 0, num = m_num, current = _first @@ -345,45 +344,38 @@ namespace ps const float ttPos = easePos(particle.life); const float ttScale = easeScale(particle.life); - const float ttBlend = bx::fsaturate(easeBlend(particle.life) ); - const float ttRgba = bx::fsaturate(easeRgba(particle.life) ); + const float ttBlend = bx::clamp(easeBlend(particle.life), 0.0f, 1.0f); + const float ttRgba = bx::clamp(easeRgba(particle.life), 0.0f, 1.0f); - float p0[3]; - bx::vec3Lerp(p0, particle.start, particle.end[0], ttPos); - - float p1[3]; - bx::vec3Lerp(p1, particle.end[0], particle.end[1], ttPos); - - float pos[3]; - bx::vec3Lerp(pos, p0, p1, ttPos); + const bx::Vec3 p0 = bx::lerp(particle.start, particle.end[0], ttPos); + const bx::Vec3 p1 = bx::lerp(particle.end[0], particle.end[1], ttPos); + const bx::Vec3 pos = bx::lerp(p0, p1, ttPos); ParticleSort& sort = _outSort[current]; - float tmp[3]; - bx::vec3Sub(tmp, _eye, pos); - sort.dist = bx::fsqrt(bx::vec3Dot(tmp, tmp) ); + const bx::Vec3 tmp0 = bx::sub(_eye, pos); + sort.dist = bx::length(tmp0); sort.idx = current; uint32_t idx = uint32_t(ttRgba*4); - float ttmod = bx::fmod(ttRgba, 0.25f)/0.25f; + float ttmod = bx::mod(ttRgba, 0.25f)/0.25f; uint32_t rgbaStart = particle.rgba[idx]; uint32_t rgbaEnd = particle.rgba[idx+1]; - float rr = bx::flerp( ( (uint8_t*)&rgbaStart)[0], ( (uint8_t*)&rgbaEnd)[0], ttmod)/255.0f; - float gg = bx::flerp( ( (uint8_t*)&rgbaStart)[1], ( (uint8_t*)&rgbaEnd)[1], ttmod)/255.0f; - float bb = bx::flerp( ( (uint8_t*)&rgbaStart)[2], ( (uint8_t*)&rgbaEnd)[2], ttmod)/255.0f; - float aa = bx::flerp( ( (uint8_t*)&rgbaStart)[3], ( (uint8_t*)&rgbaEnd)[3], ttmod)/255.0f; + float rr = bx::lerp( ( (uint8_t*)&rgbaStart)[0], ( (uint8_t*)&rgbaEnd)[0], ttmod)/255.0f; + float gg = bx::lerp( ( (uint8_t*)&rgbaStart)[1], ( (uint8_t*)&rgbaEnd)[1], ttmod)/255.0f; + float bb = bx::lerp( ( (uint8_t*)&rgbaStart)[2], ( (uint8_t*)&rgbaEnd)[2], ttmod)/255.0f; + float aa = bx::lerp( ( (uint8_t*)&rgbaStart)[3], ( (uint8_t*)&rgbaEnd)[3], ttmod)/255.0f; - float blend = bx::flerp(particle.blendStart, particle.blendEnd, ttBlend); - float scale = bx::flerp(particle.scaleStart, particle.scaleEnd, ttScale); + float blend = bx::lerp(particle.blendStart, particle.blendEnd, ttBlend); + float scale = bx::lerp(particle.scaleStart, particle.scaleEnd, ttScale); uint32_t abgr = toAbgr(rr, gg, bb, aa); - float udir[3] = { _mtxView[0]*scale, _mtxView[4]*scale, _mtxView[8]*scale }; - float vdir[3] = { _mtxView[1]*scale, _mtxView[5]*scale, _mtxView[9]*scale }; + const bx::Vec3 udir = { _mtxView[0]*scale, _mtxView[4]*scale, _mtxView[8]*scale }; + const bx::Vec3 vdir = { _mtxView[1]*scale, _mtxView[5]*scale, _mtxView[9]*scale }; PosColorTexCoord0Vertex* vertex = &_outVertices[current*4]; - bx::vec3Sub(tmp, pos, udir); - bx::vec3Sub(&vertex->m_x, tmp, vdir); + bx::store(&vertex->m_x, bx::sub(bx::sub(pos, udir), vdir) ); aabbExpand(aabb, &vertex->m_x); vertex->m_abgr = abgr; vertex->m_u = _uv[0]; @@ -391,8 +383,7 @@ namespace ps vertex->m_blend = blend; ++vertex; - bx::vec3Add(tmp, pos, udir); - bx::vec3Sub(&vertex->m_x, tmp, vdir); + bx::store(&vertex->m_x, bx::sub(bx::add(pos, udir), vdir) ); aabbExpand(aabb, &vertex->m_x); vertex->m_abgr = abgr; vertex->m_u = _uv[2]; @@ -400,8 +391,7 @@ namespace ps vertex->m_blend = blend; ++vertex; - bx::vec3Add(tmp, pos, udir); - bx::vec3Add(&vertex->m_x, tmp, vdir); + bx::store(&vertex->m_x, bx::add(bx::add(pos, udir), vdir) ); aabbExpand(aabb, &vertex->m_x); vertex->m_abgr = abgr; vertex->m_u = _uv[2]; @@ -409,8 +399,7 @@ namespace ps vertex->m_blend = blend; ++vertex; - bx::vec3Sub(tmp, pos, udir); - bx::vec3Add(&vertex->m_x, tmp, vdir); + bx::store(&vertex->m_x, bx::add(bx::sub(pos, udir), vdir) ); aabbExpand(aabb, &vertex->m_x); vertex->m_abgr = abgr; vertex->m_u = _uv[0]; @@ -534,7 +523,7 @@ namespace ps m_num = numParticles; } - void render(uint8_t _view, const float* _mtxView, const float* _eye) + void render(uint8_t _view, const float* _mtxView, const bx::Vec3& _eye) { if (0 != m_num) { @@ -604,8 +593,8 @@ namespace ps BX_FREE(m_allocator, particleSort); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_CULL_CW | BGFX_STATE_BLEND_NORMAL @@ -751,7 +740,7 @@ void psUpdate(float _dt) s_ctx.update(_dt); } -void psRender(uint8_t _view, const float* _mtxView, const float* _eye) +void psRender(uint8_t _view, const float* _mtxView, const bx::Vec3& _eye) { s_ctx.render(_view, _mtxView, _eye); } diff --git a/3rdparty/bgfx/examples/common/ps/particle_system.h b/3rdparty/bgfx/examples/common/ps/particle_system.h index 52b7b60e7fc..36659ef5dad 100644 --- a/3rdparty/bgfx/examples/common/ps/particle_system.h +++ b/3rdparty/bgfx/examples/common/ps/particle_system.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -101,6 +101,6 @@ void psDestroyEmitter(EmitterHandle _handle); void psUpdate(float _dt); /// -void psRender(uint8_t _view, const float* _mtxView, const float* _eye); +void psRender(uint8_t _view, const float* _mtxView, const bx::Vec3& _eye); #endif // PARTICLE_SYSTEM_H_HEADER_GUARD diff --git a/3rdparty/bgfx/examples/common/ps/vs_particle.bin.h b/3rdparty/bgfx/examples/common/ps/vs_particle.bin.h index 81bb66515b6..02d9a5b3589 100644 --- a/3rdparty/bgfx/examples/common/ps/vs_particle.bin.h +++ b/3rdparty/bgfx/examples/common/ps/vs_particle.bin.h @@ -28,206 +28,87 @@ static const uint8_t vs_particle_glsl[420] = 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, // = a_texcoord0;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_particle_spv[3153] = +static const uint8_t vs_particle_spv[1250] = { 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x2c, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // ,.....#......... - 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 6b.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0xb4, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, // ......#......... + 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // main....<...@... + 0x43, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, // C...N...Q...T... 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x8c, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....Output...... - 0x8c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // ........gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion............. - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x8c, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ........v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, // n(vf4;vf3;vf4;.. - 0x05, 0x00, 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ....O...a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........:...a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, // sition.......M.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ....^...$Global. - 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ....^.......u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, // ewRect......^... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ....^.......u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew......^....... - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ^.......u_proj.. - 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ....^.......u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, // vProj.......^... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ....^.......u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ^.......u_model. - 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ....^.......u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, // delView.....^... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj.....^....... - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent - 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo - 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, // oord0...G....... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ....@...H...^... - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x5e, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^.......#....... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ^.......G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, // ................ - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x85, 0x09, 0x00, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, // ................ - 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x8c, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ............ ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ...?+........... - 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, // ....,........... - 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,.......z....... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ - 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // e............... - 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, // ....j... ....... - 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, // ....e...j....... - 0x5e, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ^...........e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x65, 0x00, 0x00, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e.......e...e... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xdb, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x5e, 0x05, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xdb, 0x07, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // ^...;.......B... - 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....+.......)... - 0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ........... - 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // e... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ........... - 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // ....;........... - 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, // ....;.......v... - 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ....;........... - 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x95, 0x38, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, // .8...?..>....... - 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, // @,..9.......I&.. - 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .....U...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, // =....... ....@.. - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v... ...A... - 0x9a, 0x02, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // .....@.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, // =........-...@.. - 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >........-...... - 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x8c, 0x04, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, // 8...6........... - 0x00, 0x00, 0x00, 0x00, 0x85, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........7....... - 0x4f, 0x2e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, // O...7.......:... - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // 7........M...... - 0x5f, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x09, 0x07, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // _W..;........... - 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, // ....A.......d-.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, // ........>...d-.. - 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, // ....A........8.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, // ........>....8.. - 0x7a, 0x0b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, // z...=.......5b.. - 0x3a, 0x19, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x3a, 0x00, 0x00, // :...Q.......;:.. - 0x35, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // 5b......Q....... - 0x0b, 0x47, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // .G..5b......Q... - 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x53, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....+S..5b...... - 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0x3b, 0x3a, 0x00, 0x00, // P........2..;:.. - 0x0b, 0x47, 0x00, 0x00, 0x2b, 0x53, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .G..+S......A... - 0xe2, 0x02, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, // ....),..B...)... - 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, // =...e....<..),.. - 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, // .........;...2.. - 0xf3, 0x3c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, // .<..A......._8.. - 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, // ........>..._8.. - 0x9f, 0x3b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, // .;..=........!.. - 0x4f, 0x2e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, // O...A.......-<.. - 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, // ........>...-<.. - 0x1d, 0x21, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, // .!..=........!.. - 0xb9, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2e, 0x3c, 0x00, 0x00, // .M..A........<.. - 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2e, 0x3c, 0x00, 0x00, // ........>....<.. - 0x1e, 0x21, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, // .!..=.......G:.. - 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, // ........G:..8... - 0x00, // . + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ + 0x24, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, // $...$Global..... + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, // $.......u_modelV + 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, // iewProj.....&... + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ........<...a_co + 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00, // lor0........@... + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... + 0x43, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // C...a_texcoord0. + 0x05, 0x00, 0x0a, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....N...@entryPo + 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // intOutput.gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x51, 0x00, 0x00, 0x00, // ition.......Q... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // t.v_color0...... + 0x54, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // T...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...$....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...$....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, // #.......H...$... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, // $.......G...&... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, // ".......G...<... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, // ........G...@... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, // ........G...C... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, // ........G...N... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, 0x00, // ........G...Q... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, // ........G...T... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......+....... + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00, // .......?+....... + 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, // ............#... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x24, 0x00, 0x00, 0x00, // ............$... + 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // #... ...%....... + 0x24, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, // $...;...%...&... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...'....... + 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // #... ...;....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....;...;...<... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...?....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // ....;...?...@... + 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, // ....;...;...C... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...M....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, // ....;...M...N... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, // ....;...M...Q... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, // ....;...M...T... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // =.......=...<... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // =.......A...@... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, // =.......D...C... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, // Q.......l...A... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, // ....Q.......m... + 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // A.......Q....... + 0x6e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // n...A.......P... + 0x07, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, // ....o...l...m... + 0x6e, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, // n.......A...'... + 0x70, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // p...&.......=... + 0x23, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // #...q...p....... + 0x07, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, // ....r...o...q... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, // Q.......y...r... + 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, // ............z... + 0x79, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, // y...R........... + 0x7a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // z...r.......>... + 0x4e, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x51, 0x00, 0x00, 0x00, // N.......>...Q... + 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x54, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // =...>...T...D... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, // ....8........... + 0x40, 0x00, // @. }; static const uint8_t vs_particle_dx9[349] = { diff --git a/3rdparty/bgfx/examples/common/ps/vs_particle.sc b/3rdparty/bgfx/examples/common/ps/vs_particle.sc index 33a2a4639f8..eed38abe4f2 100644 --- a/3rdparty/bgfx/examples/common/ps/vs_particle.sc +++ b/3rdparty/bgfx/examples/common/ps/vs_particle.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_texcoord0 $output v_color0, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/common/shaderlib.sh b/3rdparty/bgfx/examples/common/shaderlib.sh index a890edba368..2bcd43d7df2 100644 --- a/3rdparty/bgfx/examples/common/shaderlib.sh +++ b/3rdparty/bgfx/examples/common/shaderlib.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/examples/makefile b/3rdparty/bgfx/examples/makefile index 3a5fff89c65..9f1dd73b437 100644 --- a/3rdparty/bgfx/examples/makefile +++ b/3rdparty/bgfx/examples/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # @@ -37,6 +37,8 @@ rebuild: # @make -s --no-print-directory rebuild -C 34-mvs # @make -s --no-print-directory rebuild -C 35-dynamic @make -s --no-print-directory rebuild -C 36-sky +# @make -s --no-print-directory rebuild -C 37-gpudrivenrendering + @make -s --no-print-directory rebuild -C 38-bloom @make -s --no-print-directory rebuild -C common/debugdraw @make -s --no-print-directory rebuild -C common/font @make -s --no-print-directory rebuild -C common/imgui diff --git a/3rdparty/bgfx/examples/runtime/meshes/bunny.bin b/3rdparty/bgfx/examples/runtime/meshes/bunny.bin index e3aaed17b0e..f0fed0880d0 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/bunny.bin and b/3rdparty/bgfx/examples/runtime/meshes/bunny.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/bunny_decimated.bin b/3rdparty/bgfx/examples/runtime/meshes/bunny_decimated.bin index d2f2f07e3f6..176344675cf 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/bunny_decimated.bin and b/3rdparty/bgfx/examples/runtime/meshes/bunny_decimated.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/bunny_patched.bin b/3rdparty/bgfx/examples/runtime/meshes/bunny_patched.bin index 217bffeb5ab..e8645370ea9 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/bunny_patched.bin and b/3rdparty/bgfx/examples/runtime/meshes/bunny_patched.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/column.bin b/3rdparty/bgfx/examples/runtime/meshes/column.bin index 2d1d1dc5dd3..a58c780d121 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/column.bin and b/3rdparty/bgfx/examples/runtime/meshes/column.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/cube.bin b/3rdparty/bgfx/examples/runtime/meshes/cube.bin index 874c9408e58..9395fc6a3f6 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/cube.bin and b/3rdparty/bgfx/examples/runtime/meshes/cube.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin b/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin index 7e3e4b8423e..1ed9d7cc9b2 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin and b/3rdparty/bgfx/examples/runtime/meshes/hollowcube.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/orb.bin b/3rdparty/bgfx/examples/runtime/meshes/orb.bin index bd454afba03..ff8d16628a8 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/orb.bin and b/3rdparty/bgfx/examples/runtime/meshes/orb.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/platform.bin b/3rdparty/bgfx/examples/runtime/meshes/platform.bin index 27b604341e2..de63c2457b8 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/platform.bin and b/3rdparty/bgfx/examples/runtime/meshes/platform.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/test_scene.bin b/3rdparty/bgfx/examples/runtime/meshes/test_scene.bin index 6f75d1a8c15..bf234cb0b37 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/test_scene.bin and b/3rdparty/bgfx/examples/runtime/meshes/test_scene.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree.bin b/3rdparty/bgfx/examples/runtime/meshes/tree.bin index 6daa0cef736..aec00bfb2b5 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_1.bin b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_1.bin index dcce8a7aaa4..26ed0727b6c 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_1.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_2.bin b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_2.bin index c7cdb1dd67b..97f939dbd3f 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_2.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod0_2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_1.bin b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_1.bin index d27ea1f0e45..563e82c917d 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_1.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_2.bin b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_2.bin index 08d57375fc2..1983f836087 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_2.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod1_2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_1.bin b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_1.bin index 4b8d4b7d275..d2aa057f6ca 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_1.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_2.bin b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_2.bin index 821151e0d9d..886d7b3bebe 100644 Binary files a/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_2.bin and b/3rdparty/bgfx/examples/runtime/meshes/tree1b_lod2_2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_downscale_hi_z.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_downscale_hi_z.bin new file mode 100644 index 00000000000..2752459098c Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_downscale_hi_z.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_occlude_props.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_occlude_props.bin new file mode 100644 index 00000000000..e65b53dfac0 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_occlude_props.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_stream_compaction.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_stream_compaction.bin new file mode 100644 index 00000000000..944ef164534 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/cs_gdr_stream_compaction.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_albedo_output.bin new file mode 100644 index 00000000000..d48f03cd088 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_bloom_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_bloom_combine.bin new file mode 100644 index 00000000000..86c11d50efe Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_bloom_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_downsample.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_downsample.bin new file mode 100644 index 00000000000..0d87efe69ee Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_downsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_gdr_instanced_indirect_rendering.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_gdr_instanced_indirect_rendering.bin new file mode 100644 index 00000000000..7d3b633a94c Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_gdr_instanced_indirect_rendering.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex1.bin index 28749bc7bd2..4eb1929d549 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex1.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex2.bin index e7421cf6c7d..26c3e9ae821 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex2.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svbacktex2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex1.bin index 28749bc7bd2..4eb1929d549 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex1.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex2.bin index e7421cf6c7d..26c3e9ae821 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex2.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svfronttex2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svside.bin index cc8056bc938..ae0ab14bb50 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svside.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svside.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidetex.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidetex.bin index 62c3990780a..0e02bf1e66b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidetex.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_shadowvolume_svsidetex.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_upsample.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_upsample.bin new file mode 100644 index 00000000000..f5743187cd4 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_upsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin index c093b9b3ec2..abc5e081a97 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx11/fs_wf_wireframe.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_albedo_output.bin new file mode 100644 index 00000000000..d878978bcff Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_fullscreen.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_fullscreen.bin new file mode 100644 index 00000000000..8df2a6c91d2 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_fullscreen.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_gdr_instanced_indirect_rendering.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_gdr_instanced_indirect_rendering.bin new file mode 100644 index 00000000000..0af85a6b5ac Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_gdr_instanced_indirect_rendering.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_gdr_render_occlusion.bin b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_gdr_render_occlusion.bin new file mode 100644 index 00000000000..47146150d9c Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx11/vs_gdr_render_occlusion.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_albedo_output.bin new file mode 100644 index 00000000000..093ae8b637b Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bloom_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bloom_combine.bin new file mode 100644 index 00000000000..c7c151e9fd2 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_bloom_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_downsample.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_downsample.bin new file mode 100644 index 00000000000..1191de96edb Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_downsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin index a1c89a10295..aab8a7abf89 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin index 251d0d9f135..348ac02882a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svbacktex2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin index a1c89a10295..aab8a7abf89 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex1.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin index 251d0d9f135..348ac02882a 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svfronttex2.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin index 90bd0c3c360..b5186b8cdcf 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svside.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin index ef53032fde7..e6059b1061c 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_shadowvolume_svsidetex.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_upsample.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_upsample.bin new file mode 100644 index 00000000000..933559d4513 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_upsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin index e6867ec155c..526a1aff393 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin and b/3rdparty/bgfx/examples/runtime/shaders/dx9/fs_wf_wireframe.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_albedo_output.bin new file mode 100644 index 00000000000..9b75228cfe3 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_fullscreen.bin b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_fullscreen.bin new file mode 100644 index 00000000000..83bdf080955 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/dx9/vs_fullscreen.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_indirect.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_indirect.bin index f95029086b5..886ee1fe7d4 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_indirect.bin and b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_indirect.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_init_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_init_instances.bin index a2473b11edd..3b3ad504881 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_init_instances.bin and b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_init_instances.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin index 99c38441b3b..c2d0ea5f182 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin and b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update_instances.bin index b2a964470ca..4b06073718b 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update_instances.bin and b/3rdparty/bgfx/examples/runtime/shaders/essl/cs_update_instances.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/fs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_albedo_output.bin new file mode 100644 index 00000000000..ec28c0d4048 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/fs_bloom_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_bloom_combine.bin new file mode 100644 index 00000000000..dd66b5cee21 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_bloom_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/fs_downsample.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_downsample.bin new file mode 100644 index 00000000000..c360dccaac9 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_downsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/fs_upsample.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_upsample.bin new file mode 100644 index 00000000000..01c22c33a0c Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/essl/fs_upsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/vs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_albedo_output.bin new file mode 100644 index 00000000000..5212bac65ae Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/essl/vs_fullscreen.bin b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_fullscreen.bin new file mode 100644 index 00000000000..433ae1c6ea9 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/essl/vs_fullscreen.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_downscale_hi_z.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_downscale_hi_z.bin new file mode 100644 index 00000000000..f9e14ffa9c2 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_downscale_hi_z.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_occlude_props.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_occlude_props.bin new file mode 100644 index 00000000000..e775dd91ea5 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_occlude_props.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_stream_compaction.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_stream_compaction.bin new file mode 100644 index 00000000000..cac91d1a355 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_gdr_stream_compaction.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin index e03ff08f132..b35fb695ab6 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_indirect.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin index 4ee2968c976..b7bd2ba9524 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_init_instances.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update.bin index 2c4b5735604..89f089a2778 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin index 9af5bfddcce..6096432c8af 100644 Binary files a/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin and b/3rdparty/bgfx/examples/runtime/shaders/glsl/cs_update_instances.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_albedo_output.bin new file mode 100644 index 00000000000..ebe232706f7 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_bloom_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_bloom_combine.bin new file mode 100644 index 00000000000..23d53074dc1 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_bloom_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_downsample.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_downsample.bin new file mode 100644 index 00000000000..055b774bdb7 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_downsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_gdr_instanced_indirect_rendering.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_gdr_instanced_indirect_rendering.bin new file mode 100644 index 00000000000..a60877da56b Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_gdr_instanced_indirect_rendering.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_upsample.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_upsample.bin new file mode 100644 index 00000000000..dfb1acc2fad Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/fs_upsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_albedo_output.bin new file mode 100644 index 00000000000..490de47ca1d Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_fullscreen.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_fullscreen.bin new file mode 100644 index 00000000000..16256a7f9e6 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_fullscreen.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_gdr_instanced_indirect_rendering.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_gdr_instanced_indirect_rendering.bin new file mode 100644 index 00000000000..49d175484b4 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_gdr_instanced_indirect_rendering.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_gdr_render_occlusion.bin b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_gdr_render_occlusion.bin new file mode 100644 index 00000000000..f3fe0e8c55e Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/glsl/vs_gdr_render_occlusion.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_albedo_output.bin new file mode 100644 index 00000000000..22af56128ba Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bloom_combine.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bloom_combine.bin new file mode 100644 index 00000000000..0684c1069ee Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_bloom_combine.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_downsample.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_downsample.bin new file mode 100644 index 00000000000..8a60126078b Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_downsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/fs_upsample.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_upsample.bin new file mode 100644 index 00000000000..69cf6e3467b Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/metal/fs_upsample.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_albedo_output.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_albedo_output.bin new file mode 100644 index 00000000000..021b33ca896 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_albedo_output.bin differ diff --git a/3rdparty/bgfx/examples/runtime/shaders/metal/vs_fullscreen.bin b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_fullscreen.bin new file mode 100644 index 00000000000..6706c0b40c7 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/shaders/metal/vs_fullscreen.bin differ diff --git a/3rdparty/bgfx/examples/runtime/textures/parallax-d.ktx b/3rdparty/bgfx/examples/runtime/textures/parallax-d.ktx index 4b73fc3792e..54c74a0603e 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/parallax-d.ktx and b/3rdparty/bgfx/examples/runtime/textures/parallax-d.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/parallax-n.ktx b/3rdparty/bgfx/examples/runtime/textures/parallax-n.ktx index a5a2d7b21b6..1280e92cea9 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/parallax-n.ktx and b/3rdparty/bgfx/examples/runtime/textures/parallax-n.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_10x5.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_10x5.dds new file mode 100644 index 00000000000..5d839395484 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_10x5.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_4x4.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_4x4.dds new file mode 100644 index 00000000000..ada6b45d92f Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_4x4.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_5x5.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_5x5.dds new file mode 100644 index 00000000000..bfce304225c Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_5x5.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_6x6.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_6x6.dds new file mode 100644 index 00000000000..a1215b7f95d Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_6x6.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_8x5.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_8x5.dds new file mode 100644 index 00000000000..55d1754fb93 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_8x5.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_8x6.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_8x6.dds new file mode 100644 index 00000000000..e205b999ce5 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_astc_8x6.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_atc.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_atc.dds new file mode 100644 index 00000000000..be2aeb7d411 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_atc.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_atce.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_atce.dds new file mode 100644 index 00000000000..5d1cabd07db Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_atce.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_atci.dds b/3rdparty/bgfx/examples/runtime/textures/texture_compression_atci.dds new file mode 100644 index 00000000000..57eadf20c92 Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_atci.dds differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc1.ktx b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc1.ktx index 21bc6840365..0be5ced96f3 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc1.ktx and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc1.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc2.ktx b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc2.ktx index 1bfa7ba3479..473406fa71c 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc2.ktx and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc2.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc3.ktx b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc3.ktx index fa27b104acf..8d3d85567d5 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc3.ktx and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc3.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc7.ktx b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc7.ktx new file mode 100644 index 00000000000..265dde5bbeb Binary files /dev/null and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_bc7.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc1.ktx b/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc1.ktx index fea5ac28f84..0206deaddd9 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc1.ktx and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc1.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc2.ktx b/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc2.ktx index 61bbf0a63e2..f6dd5b4548c 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc2.ktx and b/3rdparty/bgfx/examples/runtime/textures/texture_compression_etc2.ktx differ diff --git a/3rdparty/bgfx/examples/runtime/textures/uffizi.dds b/3rdparty/bgfx/examples/runtime/textures/uffizi.ktx similarity index 59% rename from 3rdparty/bgfx/examples/runtime/textures/uffizi.dds rename to 3rdparty/bgfx/examples/runtime/textures/uffizi.ktx index e6c4fc32850..dee260dec26 100644 Binary files a/3rdparty/bgfx/examples/runtime/textures/uffizi.dds and b/3rdparty/bgfx/examples/runtime/textures/uffizi.ktx differ diff --git a/3rdparty/bgfx/include/bgfx/bgfx.h b/3rdparty/bgfx/include/bgfx/bgfx.h index 7f3a4936f0f..3430764e84a 100644 --- a/3rdparty/bgfx/include/bgfx/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/bgfx.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -88,7 +88,7 @@ namespace bgfx /// struct Attrib { - /// Corresponds to vertex shader attribute. Attributes: + /// Corresponds to vertex shader attribute. enum Enum { Position, //!< a_position @@ -173,6 +173,15 @@ namespace bgfx PTC14A, //!< PVRTC1 RGBA 4BPP PTC22, //!< PVRTC2 RGBA 2BPP PTC24, //!< PVRTC2 RGBA 4BPP + ATC, //!< ATC RGB 4BPP + ATCE, //!< ATCE RGBA 8 BPP explicit alpha + ATCI, //!< ATCI RGBA 8 BPP interpolated alpha + ASTC4x4, //!< ASTC 4x4 8.0 BPP + ASTC5x5, //!< ASTC 5x5 5.12 BPP + ASTC6x6, //!< ASTC 6x6 3.56 BPP + ASTC8x5, //!< ASTC 8x5 3.20 BPP + ASTC8x6, //!< ASTC 8x6 2.67 BPP + ASTC10x5, //!< ASTC 10x5 2.56 BPP Unknown, // Compressed formats above. @@ -298,6 +307,25 @@ namespace bgfx }; }; + /// Primitive topology. + /// + /// @attention C99 equivalent is `bgfx_topology_t`. + /// + struct Topology + { + /// Primitive topology: + enum Enum + { + TriList, //!< Triangle list. + TriStrip, //!< Triangle strip. + LineList, //!< Line list. + LineStrip, //!< Line strip. + PointList, //!< Point list. + + Count + }; + }; + /// Topology conversion function. /// /// @attention C99 equivalent is `bgfx_topology_convert_t`. @@ -308,6 +336,7 @@ namespace bgfx enum Enum { TriListFlipWinding, //!< Flip winding order of triangle list. + TriStripFlipWinding, //!< Flip winding order of trinagle strip. TriListToLineList, //!< Convert triangle list to line list. TriStripToTriList, //!< Convert triangle strip to triangle list. LineStripToLineList, //!< Convert line strip to line list. @@ -362,18 +391,18 @@ namespace bgfx static const uint16_t kInvalidHandle = UINT16_MAX; - BGFX_HANDLE(DynamicIndexBufferHandle); - BGFX_HANDLE(DynamicVertexBufferHandle); - BGFX_HANDLE(FrameBufferHandle); - BGFX_HANDLE(IndexBufferHandle); - BGFX_HANDLE(IndirectBufferHandle); - BGFX_HANDLE(OcclusionQueryHandle); - BGFX_HANDLE(ProgramHandle); - BGFX_HANDLE(ShaderHandle); - BGFX_HANDLE(TextureHandle); - BGFX_HANDLE(UniformHandle); - BGFX_HANDLE(VertexBufferHandle); - BGFX_HANDLE(VertexDeclHandle); + BGFX_HANDLE(DynamicIndexBufferHandle) + BGFX_HANDLE(DynamicVertexBufferHandle) + BGFX_HANDLE(FrameBufferHandle) + BGFX_HANDLE(IndexBufferHandle) + BGFX_HANDLE(IndirectBufferHandle) + BGFX_HANDLE(OcclusionQueryHandle) + BGFX_HANDLE(ProgramHandle) + BGFX_HANDLE(ShaderHandle) + BGFX_HANDLE(TextureHandle) + BGFX_HANDLE(UniformHandle) + BGFX_HANDLE(VertexBufferHandle) + BGFX_HANDLE(VertexDeclHandle) /// Callback interface to implement application specific behavior. /// Cached items are currently used for OpenGL and Direct3D 12 binary @@ -389,10 +418,12 @@ namespace bgfx { virtual ~CallbackI() = 0; - /// If fatal code code is not Fatal::DebugCheck this callback is - /// called on unrecoverable error. It's not safe to continue, inform - /// user and terminate application from this call. + /// This callback is called on unrecoverable errors. + /// It's not safe to continue (Exluding _code `Fatal::DebugCheck`), + /// inform the user and terminate the application. /// + /// @param[in] _filePath File path where fatal message was generated. + /// @param[in] _line Line where fatal message was generated. /// @param[in] _code Fatal error code. /// @param[in] _str More information about error. /// @@ -401,7 +432,12 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_callback_vtbl.fatal`. /// - virtual void fatal(Fatal::Enum _code, const char* _str) = 0; + virtual void fatal( + const char* _filePath + , uint16_t _line + , Fatal::Enum _code + , const char* _str + ) = 0; /// Print debug message. /// @@ -427,8 +463,8 @@ namespace bgfx /// /// @param[in] _name Region name, contains dynamic string. /// @param[in] _abgr Color of profiler region. - /// @param[in] _filePath File path where profilerBegin was called. - /// @param[in] _line Line where profilerBegin was called. + /// @param[in] _filePath File path where `profilerBegin` was called. + /// @param[in] _line Line where `profilerBegin` was called. /// /// @remarks /// Not thread safe and it can be called from any thread. @@ -446,8 +482,8 @@ namespace bgfx /// /// @param[in] _name Region name, contains string literal. /// @param[in] _abgr Color of profiler region. - /// @param[in] _filePath File path where profilerBeginLiteral was called. - /// @param[in] _line Line where profilerBeginLiteral was called. + /// @param[in] _filePath File path where `profilerBeginLiteral` was called. + /// @param[in] _line Line where `profilerBeginLiteral` was called. /// /// @remarks /// Not thread safe and it can be called from any thread. @@ -470,7 +506,7 @@ namespace bgfx /// virtual void profilerEnd() = 0; - /// Return size of for cached item. Return 0 if no cached item was + /// Returns the size of a cached item. Returns 0 if no cached item was /// found. /// /// @param[in] _id Cache id. @@ -507,10 +543,11 @@ namespace bgfx /// @param[in] _filePath File path. /// @param[in] _width Image width. /// @param[in] _height Image height. - /// @param[in] _pitch Number of bytes to skip to next line. + /// @param[in] _pitch Number of bytes to skip between the start of + /// each horizontal line of the image. /// @param[in] _data Image data. /// @param[in] _size Image size. - /// @param[in] _yflip If true image origin is bottom left. + /// @param[in] _yflip If true, image origin is bottom left. /// /// @attention C99 equivalent is `bgfx_callback_vtbl.screen_shot`. /// @@ -524,7 +561,14 @@ namespace bgfx , bool _yflip ) = 0; - /// Called when capture begins. + /// Called when a video capture begins. + /// + /// @param[in] _width Image width. + /// @param[in] _height Image height. + /// @param[in] _pitch Number of bytes to skip between the start of + /// each horizontal line of the image. + /// @param[in] _format Texture format. See: `TextureFormat::Enum`. + /// @param[in] _yflip If true, image origin is bottom left. /// /// @attention C99 equivalent is `bgfx_callback_vtbl.capture_begin`. /// @@ -536,7 +580,7 @@ namespace bgfx , bool _yflip ) = 0; - /// Called when capture ends. + /// Called when a video capture ends. /// /// @attention C99 equivalent is `bgfx_callback_vtbl.capture_end`. /// @@ -556,6 +600,91 @@ namespace bgfx { } + /// Platform data. + /// + /// @attention C99 equivalent is `bgfx_platform_data_t`. + /// + struct PlatformData + { + PlatformData(); + + void* ndt; //!< Native display type. + void* nwh; //!< Native window handle. + void* context; //!< GL context, or D3D device. + void* backBuffer; //!< GL backbuffer, or D3D render target view. + void* backBufferDS; //!< Backbuffer depth/stencil. + }; + + /// Backbuffer resolution and reset parameters. + /// + /// @attention C99 equivalent is `bgfx_resolution_t`. + /// + struct Resolution + { + Resolution(); + + TextureFormat::Enum format; //!< Backbuffer format. + uint32_t width; //!< Backbuffer width. + uint32_t height; //!< Backbuffer height. + uint32_t reset; //!< Reset parameters. + uint8_t numBackBuffers; //!< Number of back buffers. + uint8_t maxFrameLatency; //!< Maximum frame latency. + }; + + /// Initialization parameters used by `bgfx::init`. + /// + /// @attention C99 equivalent is `bgfx_init_t`. + /// + struct Init + { + Init(); + + /// Select rendering backend. When set to RendererType::Count + /// a default rendering backend will be selected appropriate to the platform. + /// See: `bgfx::RendererType` + RendererType::Enum type; + + /// Vendor PCI id. If set to `BGFX_PCI_ID_NONE` it will select the first + /// device. + /// - `BGFX_PCI_ID_NONE` - Autoselect adapter. + /// - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer. + /// - `BGFX_PCI_ID_AMD` - AMD adapter. + /// - `BGFX_PCI_ID_INTEL` - Intel adapter. + /// - `BGFX_PCI_ID_NVIDIA` - nVidia adapter. + uint16_t vendorId; + + /// Device id. If set to 0 it will select first device, or device with + /// matching id. + uint16_t deviceId; + + bool debug; //!< Enable device for debuging. + bool profile; //!< Enable device for profiling. + + /// Platform data. + PlatformData platformData; + + /// Backbuffer resolution and reset parameters. See: `bgfx::Resolution`. + Resolution resolution; + + struct Limits + { + uint16_t maxEncoders; //!< Maximum number of encoder threads. + uint32_t transientVbSize; //!< Maximum transient vertex buffer size. + uint32_t transientIbSize; //!< Maximum transient index buffer size. + }; + + Limits limits; + + /// Provide application specific callback interface. + /// See: `bgfx::CallbackI` + CallbackI* callback; + + /// Custom allocator. When a custom allocator is not + /// specified, bgfx uses the CRT allocator. Bgfx assumes + /// custom allocator is thread safe. + bx::AllocatorI* allocator; + }; + /// Memory release callback. /// /// param[in] _ptr Pointer to allocated data. @@ -565,7 +694,9 @@ namespace bgfx /// typedef void (*ReleaseFn)(void* _ptr, void* _userData); - /// Memory obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`. + /// Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`. + /// + /// @attention It is illegal to create this structure on stack and pass it to any bgfx API. /// /// @attention C99 equivalent is `bgfx_memory_t`. /// @@ -592,7 +723,7 @@ namespace bgfx uint16_t vendorId; //!< Selected GPU vendor PCI id. uint16_t deviceId; //!< Selected GPU device id. - bool homogeneousDepth; //!< True when NDC depth is in [-1, 1] range. + bool homogeneousDepth; //!< True when NDC depth is in [-1, 1] range, otherwise its [0, 1]. bool originBottomLeft; //!< True when NDC origin is at bottom left. uint8_t numGPUs; //!< Number of enumerated GPUs. @@ -613,6 +744,7 @@ namespace bgfx uint32_t maxDrawCalls; //!< Maximum number of draw calls. uint32_t maxBlits; //!< Maximum number of blit calls. uint32_t maxTextureSize; //!< Maximum texture size. + uint32_t maxTextureLayers; //!< Maximum texture layers. uint32_t maxViews; //!< Maximum number of views. uint32_t maxFrameBuffers; //!< Maximum number of frame buffer handles. uint32_t maxFBAttachments; //!< Maximum number of frame buffer attachments. @@ -620,6 +752,7 @@ namespace bgfx uint32_t maxShaders; //!< Maximum number of shader handles. uint32_t maxTextures; //!< Maximum number of texture handles. uint32_t maxTextureSamplers; //!< Maximum number of texture samplers. + uint32_t maxComputeBindings; //!< Maximum number of compute bindings. uint32_t maxVertexDecls; //!< Maximum number of vertex format declarations. uint32_t maxVertexStreams; //!< Maximum number of vertex streams. uint32_t maxIndexBuffers; //!< Maximum number of index buffer handles. @@ -629,6 +762,8 @@ namespace bgfx uint32_t maxUniforms; //!< Maximum number of uniform handles. uint32_t maxOcclusionQueries; //!< Maximum number of occlusion query handles. uint32_t maxEncoders; //!< Maximum number of encoder threads. + uint32_t transientVbSize; //!< Maximum transient vertex buffer size. + uint32_t transientIbSize; //!< Maximum transient index buffer size. }; Limits limits; @@ -725,15 +860,19 @@ namespace bgfx uint16_t num; //!< Number of elements in array. }; - /// Frame buffer texture attachemnt info. + /// Frame buffer texture attachment info. /// /// @attention C99 equivalent is `bgfx_attachment_t`. /// struct Attachment { + void init(TextureHandle _handle, Access::Enum _access = Access::Write, uint16_t _layer = 0, uint16_t _mip = 0, uint8_t _resolve = BGFX_RESOLVE_AUTO_GEN_MIPS); + + Access::Enum access; //!< TextureHandle handle; //!< Texture handle. uint16_t mip; //!< Mip level. uint16_t layer; //!< Cubemap side or depth layer/slice. + uint8_t resolve; //!< Resolve flags. See: `BGFX_RESOLVE_*` }; /// Transform data. @@ -746,34 +885,6 @@ namespace bgfx uint16_t num; //!< Number of matrices. }; - /// HMD info. - /// - /// @attention C99 equivalent is `bgfx_hmd_t`. - /// - struct HMD - { - /// Eye - /// - /// @attention C99 equivalent is `bgfx_hmd_eye_t`. - /// - struct Eye - { - float rotation[4]; //!< Eye rotation represented as quaternion. - float translation[3]; //!< Eye translation. - float fov[4]; //!< Field of view (up, down, left, right). - float viewOffset[3]; //!< Eye view matrix translation adjustment. - float projection[16]; //!< Eye projection matrix. - float pixelsPerTanAngle[2]; //!< Number of pixels that fit in tan(angle) = 1. - }; - - Eye eye[2]; - uint16_t width; //!< Frame buffer width. - uint16_t height; //!< Frame buffer height. - uint32_t deviceWidth; //!< Device resolution width. - uint32_t deviceHeight; //!< Device resolution height. - uint8_t flags; //!< Status flags. - }; - /// typedef uint16_t ViewId; @@ -803,48 +914,72 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_stats_t`. /// + /// @remarks All time values are high-resolution timestamps, while + /// time frequencies define timestamps-per-second for that hardware. struct Stats { - int64_t cpuTimeFrame; //!< CPU time between two `bgfx::frame` calls. - int64_t cpuTimeBegin; //!< Render thread CPU submit begin time. - int64_t cpuTimeEnd; //!< Render thread CPU submit end time. - int64_t cpuTimerFreq; //!< CPU timer frequency. + int64_t cpuTimeFrame; //!< CPU time between two `bgfx::frame` calls. + int64_t cpuTimeBegin; //!< Render thread CPU submit begin time. + int64_t cpuTimeEnd; //!< Render thread CPU submit end time. + int64_t cpuTimerFreq; //!< CPU timer frequency. Timestamps-per-second - int64_t gpuTimeBegin; //!< GPU frame begin time. - int64_t gpuTimeEnd; //!< GPU frame end time. - int64_t gpuTimerFreq; //!< GPU timer frequency. + int64_t gpuTimeBegin; //!< GPU frame begin time. + int64_t gpuTimeEnd; //!< GPU frame end time. + int64_t gpuTimerFreq; //!< GPU timer frequency. - int64_t waitRender; //!< Time spent waiting for render backend thread to finish issuing - //! draw commands to underlying graphics API. - int64_t waitSubmit; //!< Time spent waiting for submit thread to advance to next frame. + int64_t waitRender; //!< Time spent waiting for render backend thread to finish issuing + //! draw commands to underlying graphics API. + int64_t waitSubmit; //!< Time spent waiting for submit thread to advance to next frame. - uint32_t numDraw; //!< Number of draw calls submitted. - uint32_t numCompute; //!< Number of compute calls submitted. - uint32_t maxGpuLatency; //!< GPU driver latency. + uint32_t numDraw; //!< Number of draw calls submitted. + uint32_t numCompute; //!< Number of compute calls submitted. + uint32_t numBlit; //!< Number of blit calls submitted. + uint32_t maxGpuLatency; //!< GPU driver latency. - int64_t gpuMemoryMax; //!< Maximum available GPU memory for application. - int64_t gpuMemoryUsed; //!< Amount of GPU memory used. + uint16_t numDynamicIndexBuffers; //!< Number of used dynamic index buffers. + uint16_t numDynamicVertexBuffers; //!< Number of used dynamic vertex buffers. + uint16_t numFrameBuffers; //!< Number of used frame buffers. + uint16_t numIndexBuffers; //!< Number of used index buffers. + uint16_t numOcclusionQueries; //!< Number of used occlusion queries. + uint16_t numPrograms; //!< Number of used programs. + uint16_t numShaders; //!< Number of used shaders. + uint16_t numTextures; //!< Number of used textures. + uint16_t numUniforms; //!< Number of used uniforms. + uint16_t numVertexBuffers; //!< Number of used vertex buffers. + uint16_t numVertexDecls; //!< Number of used vertex declarations. - uint16_t width; //!< Backbuffer width in pixels. - uint16_t height; //!< Backbuffer height in pixels. - uint16_t textWidth; //!< Debug text width in characters. - uint16_t textHeight; //!< Debug text height in characters. + int64_t textureMemoryUsed; //!< Estimate of texture memory used. + int64_t rtMemoryUsed; //!< Estimate of render target memory used. + int32_t transientVbUsed; //!< Amount of transient vertex buffer used. + int32_t transientIbUsed; //!< Amount of transient index buffer used. - uint16_t numViews; //!< Number of view stats. - ViewStats* viewStats; //!< View stats. + uint32_t numPrims[Topology::Count]; //!< Number of primitives rendered. - uint8_t numEncoders; //!< Number of encoders used during frame. - EncoderStats* encoderStats; //!< Encoder stats. + int64_t gpuMemoryMax; //!< Maximum available GPU memory for application. + int64_t gpuMemoryUsed; //!< Amount of GPU memory used by the application. + + uint16_t width; //!< Backbuffer width in pixels. + uint16_t height; //!< Backbuffer height in pixels. + uint16_t textWidth; //!< Debug text width in characters. + uint16_t textHeight; //!< Debug text height in characters. + + uint16_t numViews; //!< Number of view stats. + ViewStats* viewStats; //!< Array of View stats. + + uint8_t numEncoders; //!< Number of encoders used during frame. + EncoderStats* encoderStats; //!< Array of encoder stats. }; - /// Encoder for submitting draw calls from multiple threads. Use `bgfx::begin()` - /// to obtain encoder for thread. + /// Encoders are used for submitting draw calls from multiple threads. Only one encoder + /// per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread. /// /// @attention C99 equivalent is `bgfx_encoder`. /// struct Encoder { - /// Sets debug marker. + /// Sets a debug marker. This allows you to group + /// graphics calls together for easy browsing in + /// graphics debugging tools. /// /// @attention C99 equivalent is `bgfx_set_marker`. /// @@ -854,14 +989,12 @@ namespace bgfx /// /// @param[in] _state State flags. Default state for primitive type is /// triangles. See: `BGFX_STATE_DEFAULT`. - /// - `BGFX_STATE_ALPHA_WRITE` - Enable alpha write. - /// - `BGFX_STATE_DEPTH_WRITE` - Enable depth write. /// - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. /// - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. /// - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. /// - `BGFX_STATE_CULL_*` - Backface culling mode. - /// - `BGFX_STATE_RGB_WRITE` - Enable RGB write. - /// - `BGFX_STATE_MSAA` - Enable MSAA. + /// - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. + /// - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. /// - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. /// /// @param[in] _rgba Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and @@ -872,8 +1005,8 @@ namespace bgfx /// `BGFX_STATE_ALPHA_REF(_ref)`, /// `BGFX_STATE_POINT_SIZE(_size)`, /// `BGFX_STATE_BLEND_FUNC(_src, _dst)`, - /// `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)` - /// `BGFX_STATE_BLEND_EQUATION(_equation)` + /// `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, + /// `BGFX_STATE_BLEND_EQUATION(_equation)`, /// `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` /// 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend /// equation is specified. @@ -910,11 +1043,11 @@ namespace bgfx , uint32_t _bstencil = BGFX_STENCIL_NONE ); - /// Set scissor for draw primitive. For scissor for all primitives in + /// Set scissor for draw primitive. To scissor for all primitives in /// view see `bgfx::setViewScissor`. /// - /// @param[in] _x Position x from the left corner of the window. - /// @param[in] _y Position y from the top corner of the window. + /// @param[in] _x Position x from the left side of the window. + /// @param[in] _y Position y from the top of the window. /// @param[in] _width Width of scissor region. /// @param[in] _height Height of scissor region. /// @returns Scissor cache index. @@ -930,19 +1063,19 @@ namespace bgfx /// Set scissor from cache for draw primitive. /// - /// @param[in] _cache Index in scissor cache. Passing UINT16_MAX unset primitive - /// scissor and primitive will use view scissor instead. + /// @param[in] _cache Index in scissor cache. + /// Pass UINT16_MAX to have primitive use view scissor instead. /// /// @attention C99 equivalent is `bgfx_set_scissor_cached`. /// void setScissor(uint16_t _cache = UINT16_MAX); - /// Set model matrix for draw primitive. If it is not called model will + /// Set model matrix for draw primitive. If it is not called, model will /// be rendered with identity model matrix. /// /// @param[in] _mtx Pointer to first matrix in array. /// @param[in] _num Number of matrices in array. - /// @returns index into matrix cache in case the same model matrix has + /// @returns Index into matrix cache in case the same model matrix has /// to be used for other draw primitive call. /// /// @attention C99 equivalent is `bgfx_set_transform`. @@ -956,7 +1089,7 @@ namespace bgfx /// /// @param[in] _transform Pointer to `Transform` structure. /// @param[in] _num Number of matrices. - /// @returns index into matrix cache. + /// @returns Index into matrix cache. /// /// @attention Pointer returned can be modifed until `bgfx::frame` is called. /// @attention C99 equivalent is `bgfx_alloc_transform`. @@ -1041,9 +1174,6 @@ namespace bgfx /// /// @param[in] _tib Transient index buffer. /// - /// @remarks - /// _tib pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_index_buffer`. /// void setIndexBuffer(const TransientIndexBuffer* _tib); @@ -1054,9 +1184,6 @@ namespace bgfx /// @param[in] _firstIndex First index to render. /// @param[in] _numIndices Number of indices to render. /// - /// @remarks - /// _tib pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_index_buffer`. /// void setIndexBuffer( @@ -1126,9 +1253,6 @@ namespace bgfx /// @param[in] _stream Vertex stream. /// @param[in] _tvb Transient vertex buffer. /// - /// @remarks - /// _tvb pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_vertex_buffer`. /// void setVertexBuffer( @@ -1143,9 +1267,6 @@ namespace bgfx /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. /// - /// @remarks - /// _tvb pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_vertex_buffer`. /// void setVertexBuffer( @@ -1155,19 +1276,36 @@ namespace bgfx , uint32_t _numVertices ); + /// Set number of vertices for auto generated vertices use in conjuction + /// with gl_VertexID. + /// + /// @param[in] _numVertices Number of vertices. + /// + /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. + /// @attention C99 equivalent is `bgfx_set_vertex_count`. + /// + void setVertexCount(uint32_t _numVertices); + /// Set instance data buffer for draw primitive. /// /// @param[in] _idb Transient instance data buffer. - /// @param[in] _num Number of data instances. /// - /// @remarks - /// _idb pointer after this call is invalid. + /// @attention C99 equivalent is `bgfx_set_instance_data_buffer`. + /// + void setInstanceDataBuffer(const InstanceDataBuffer* _idb); + + /// Set instance data buffer for draw primitive. + /// + /// @param[in] _idb Transient instance data buffer. + /// @param[in] _start First instance data. + /// @param[in] _num Number of data instances. /// /// @attention C99 equivalent is `bgfx_set_instance_data_buffer`. /// void setInstanceDataBuffer( const InstanceDataBuffer* _idb - , uint32_t _num = UINT32_MAX + , uint32_t _start + , uint32_t _num ); /// Set instance data buffer for draw primitive. @@ -1198,6 +1336,16 @@ namespace bgfx , uint32_t _num ); + /// Set number of instances for auto generated instances use in conjuction + /// with gl_InstanceID. + /// + /// @param[in] _numInstances Number of instances. + /// + /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. + /// @attention C99 equivalent is `bgfx_set_instance_count`. + /// + void setInstanceCount(uint32_t _numInstances); + /// Set texture stage for draw primitive. /// /// @param[in] _stage Texture unit. @@ -1205,9 +1353,9 @@ namespace bgfx /// @param[in] _handle Texture handle. /// @param[in] _flags Texture sampling mode. Default value UINT32_MAX uses /// texture sampling settings from the texture. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @attention C99 equivalent is `bgfx_set_texture`. @@ -1241,7 +1389,7 @@ namespace bgfx void submit( ViewId _id , ProgramHandle _program - , int32_t _depth = 0 + , uint32_t _depth = 0 , bool _preserveState = false ); @@ -1260,7 +1408,7 @@ namespace bgfx ViewId _id , ProgramHandle _program , OcclusionQueryHandle _occlusionQuery - , int32_t _depth = 0 + , uint32_t _depth = 0 , bool _preserveState = false ); @@ -1284,7 +1432,7 @@ namespace bgfx , IndirectBufferHandle _indirectHandle , uint16_t _start = 0 , uint16_t _num = 1 - , int32_t _depth = 0 + , uint32_t _depth = 0 , bool _preserveState = false ); @@ -1361,7 +1509,6 @@ namespace bgfx /// Set compute image from texture. /// /// @param[in] _stage Texture unit. - /// @param[in] _sampler Program sampler. /// @param[in] _handle Texture handle. /// @param[in] _mip Mip level. /// @param[in] _access Texture access. See `Access::Enum`. @@ -1371,7 +1518,6 @@ namespace bgfx /// void setImage( uint8_t _stage - , UniformHandle _sampler , TextureHandle _handle , uint8_t _mip , Access::Enum _access @@ -1442,7 +1588,7 @@ namespace bgfx /// @param[in] _width Width of region. /// @param[in] _height Height of region. /// - /// @attention Destination texture must be create with `BGFX_TEXTURE_BLIT_DST` flag. + /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// @attention C99 equivalent is `bgfx_blit`. /// @@ -1466,21 +1612,21 @@ namespace bgfx /// @param[in] _dstX Destination texture X position. /// @param[in] _dstY Destination texture Y position. /// @param[in] _dstZ If texture is 2D this argument should be 0. If destination texture is cube - /// this argument represent destination texture cube face. For 3D texture this argument - /// represent destination texture Z position. + /// this argument represents destination texture cube face. For 3D texture this argument + /// represents destination texture Z position. /// @param[in] _src Source texture handle. /// @param[in] _srcMip Source texture mip level. /// @param[in] _srcX Source texture X position. /// @param[in] _srcY Source texture Y position. /// @param[in] _srcZ If texture is 2D this argument should be 0. If source texture is cube - /// this argument represent source texture cube face. For 3D texture this argument - /// represent source texture Z position. + /// this argument represents source texture cube face. For 3D texture this argument + /// represents source texture Z position. /// @param[in] _width Width of region. /// @param[in] _height Height of region. - /// @param[in] _depth If texture is 3D this argument represent depth of region, otherwise is + /// @param[in] _depth If texture is 3D this argument represents depth of region, otherwise it's /// unused. /// - /// @attention Destination texture must be create with `BGFX_TEXTURE_BLIT_DST` flag. + /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// @attention C99 equivalent is `bgfx_blit`. /// @@ -1556,7 +1702,7 @@ namespace bgfx /// Decode attribute. /// - /// @attention C99 equivalent is ``. + /// @attention C99 equivalent is `bgfx_vertex_decl_decode`. /// void decode( Attrib::Enum _attrib @@ -1567,6 +1713,9 @@ namespace bgfx ) const; /// Returns true if VertexDecl contains attribute. + /// + /// @attention C99 equivalent is `bgfx_vertex_decl_has`. + /// bool has(Attrib::Enum _attrib) const { return UINT16_MAX != m_attributes[_attrib]; } /// Returns relative attribute offset from the vertex. @@ -1739,39 +1888,13 @@ namespace bgfx /// Initialize bgfx library. /// - /// @param[in] _type Select rendering backend. When set to RendererType::Count - /// default rendering backend will be selected. - /// See: `bgfx::RendererType` - /// - /// @param[in] _vendorId Vendor PCI id. If set to `BGFX_PCI_ID_NONE` it will select the first - /// device. - /// - `BGFX_PCI_ID_NONE` - Autoselect adapter. - /// - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer. - /// - `BGFX_PCI_ID_AMD` - AMD adapter. - /// - `BGFX_PCI_ID_INTEL` - Intel adapter. - /// - `BGFX_PCI_ID_NVIDIA` - nVidia adapter. - /// - /// @param[in] _deviceId Device id. If set to 0 it will select first device, or device with - /// matching id. - /// - /// @param[in] _callback Provide application specific callback interface. - /// See: `bgfx::CallbackI` - /// - /// @param[in] _allocator Custom allocator. When custom allocator is not - /// specified, library uses default CRT allocator. The library assumes - /// custom allocator is thread safe. + /// @param[in] _init Initialization parameters. See: `bgfx::Init` for more info. /// /// @returns `true` if initialization was successful. /// /// @attention C99 equivalent is `bgfx_init`. /// - bool init( - RendererType::Enum _type = RendererType::Count - , uint16_t _vendorId = BGFX_PCI_ID_NONE - , uint16_t _deviceId = 0 - , CallbackI* _callback = NULL - , bx::AllocatorI* _allocator = NULL - ); + bool init(const Init& _init = {}); /// Shutdown bgfx library. /// @@ -1790,14 +1913,12 @@ namespace bgfx /// - `BGFX_RESET_VSYNC` - Enable V-Sync. /// - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. /// - `BGFX_RESET_CAPTURE` - Begin screen capture. - /// - `BGFX_RESET_HMD` - HMD stereo rendering. - /// - `BGFX_RESET_HMD_DEBUG` - HMD stereo rendering debug mode. - /// - `BGFX_RESET_HMD_RECENTER` - HMD calibration. /// - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. /// - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip /// occurs. Default behavior is that flip occurs before rendering new /// frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. /// - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer. + /// @param[in] _format Texture format. See: `TextureFormat::Enum`. /// /// @attention This call doesn't actually change window size, it just /// resizes back-buffer. Windowing code has to change window size. @@ -1808,11 +1929,14 @@ namespace bgfx uint32_t _width , uint32_t _height , uint32_t _flags = BGFX_RESET_NONE + , TextureFormat::Enum _format = TextureFormat::Count ); /// Begin submitting draw calls from thread. /// - Encoder* begin(); + /// @param[in] _forThread Explicitly request an encoder for a worker thread. + /// + Encoder* begin(bool _forThread = false); /// End submitting draw calls from thread. /// @@ -1852,12 +1976,6 @@ namespace bgfx /// const Caps* getCaps(); - /// Returns HMD info. - /// - /// @attention C99 equivalent is `bgfx_get_hmd`. - /// - const HMD* getHMD(); - /// Returns performance counters. /// /// @attention Pointer returned is valid until `bgfx::frame` is called. @@ -1867,6 +1985,8 @@ namespace bgfx /// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. /// + /// @param[in] _size Size to allocate. + /// /// @attention C99 equivalent is `bgfx_alloc`. /// const Memory* alloc(uint32_t _size); @@ -1883,13 +2003,18 @@ namespace bgfx , uint32_t _size ); - /// Make reference to data to pass to bgfx. Unlike `bgfx::alloc` this call - /// doesn't allocate memory for data. It just copies pointer to data. You + /// Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call + /// doesn't allocate memory for data. It just copies the _data pointer. You /// can pass `ReleaseFn` function pointer to release this memory after it's - /// consumed, or you must make sure data is available for at least 2 + /// consumed, otherwise you must make sure _data is available for at least 2 /// `bgfx::frame` calls. `ReleaseFn` function must be able to be called /// from any thread. /// + /// @param[in] _data Pointer to data. + /// @param[in] _size Size of data. + /// @param[in] _releaseFn Callback function to release memory after use. + /// @param[in] _userData User data to be passed to callback function. + /// /// @attention Data passed must be available for at least 2 `bgfx::frame` calls. /// @attention C99 equivalent are `bgfx_make_ref`, `bgfx_make_ref_release`. /// @@ -1904,9 +2029,9 @@ namespace bgfx /// /// @param[in] _debug Available flags: /// - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set - /// all rendering calls will be skipped. It's useful when profiling - /// to quickly assess bottleneck between CPU and GPU. - /// - `BGFX_DEBUG_PROFILER` - Enabled profiler. + /// all rendering calls will be skipped. This is useful when profiling + /// to quickly assess potential bottlenecks between CPU and GPU. + /// - `BGFX_DEBUG_PROFILER` - Enable profiler. /// - `BGFX_DEBUG_STATS` - Display internal statistics. /// - `BGFX_DEBUG_TEXT` - Display debug text. /// - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering @@ -1918,6 +2043,9 @@ namespace bgfx /// Clear internal debug text buffer. /// + /// @param[in] _attr Background color. + /// @param[in] _small Default or 8x8 font. + /// /// @attention C99 equivalent is `bgfx_dbg_text_clear`. /// void dbgTextClear( @@ -1929,7 +2057,7 @@ namespace bgfx /// /// @param[in] _x, _y 2D position from top-left. /// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom - /// 4-bits represent foreground color from standard VGA text palette. + /// 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). /// @param[in] _format `printf` style format. /// /// @attention C99 equivalent is `bgfx_dbg_text_printf`. @@ -1946,7 +2074,7 @@ namespace bgfx /// /// @param[in] _x, _y 2D position from top-left. /// @param[in] _attr Color palette. Where top 4-bits represent index of background, and bottom - /// 4-bits represent foreground color from standard VGA text palette. + /// 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). /// @param[in] _format `printf` style format. /// @param[in] _argList additional arguments for format string /// @@ -1987,9 +2115,9 @@ namespace bgfx /// - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer /// is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. /// - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if different amount of - /// data is passed. If this flag is not specified if more data is passed on update buffer - /// will be trimmed to fit existing buffer size. This flag has effect only on dynamic + /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + /// data is passed. If this flag is not specified, and more data is passed on update, the buffer + /// will be trimmed to fit the existing buffer size. This flag has effect only on dynamic /// buffers. /// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on /// index buffers. @@ -2019,9 +2147,9 @@ namespace bgfx /// - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer /// is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. /// - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if different amount of - /// data is passed. If this flag is not specified if more data is passed on update buffer - /// will be trimmed to fit existing buffer size. This flag has effect only on dynamic + /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + /// data is passed. If this flag is not specified, and more data is passed on update, the buffer + /// will be trimmed to fit the existing buffer size. This flag has effect only on dynamic /// buffers. /// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on /// index buffers. @@ -2052,9 +2180,9 @@ namespace bgfx /// - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer /// is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. /// - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if different amount of - /// data is passed. If this flag is not specified if more data is passed on update buffer - /// will be trimmed to fit existing buffer size. This flag has effect only on dynamic + /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + /// data is passed. If this flag is not specified, and more data is passed on update, the buffer + /// will be trimmed to fit the existing buffer size. This flag has effect only on dynamic /// buffers. /// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on /// index buffers. @@ -2076,9 +2204,9 @@ namespace bgfx /// - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer /// is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. /// - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if different amount of - /// data is passed. If this flag is not specified if more data is passed on update buffer - /// will be trimmed to fit existing buffer size. This flag has effect only on dynamic + /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + /// data is passed. If this flag is not specified, and more data is passed on update, the buffer + /// will be trimmed to fit the existing buffer size. This flag has effect only on dynamic /// buffers. /// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on /// index buffers. @@ -2099,7 +2227,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_update_dynamic_index_buffer`. /// - void updateDynamicIndexBuffer( + void update( DynamicIndexBufferHandle _handle , uint32_t _startIndex , const Memory* _mem @@ -2123,9 +2251,9 @@ namespace bgfx /// - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer /// is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. /// - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if different amount of - /// data is passed. If this flag is not specified if more data is passed on update buffer - /// will be trimmed to fit existing buffer size. This flag has effect only on dynamic + /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + /// data is passed. If this flag is not specified, and more data is passed on update, the buffer + /// will be trimmed to fit the existing buffer size. This flag has effect only on dynamic /// buffers. /// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on /// index buffers. @@ -2149,9 +2277,9 @@ namespace bgfx /// - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer /// is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. /// - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. - /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if different amount of - /// data is passed. If this flag is not specified if more data is passed on update buffer - /// will be trimmed to fit existing buffer size. This flag has effect only on dynamic + /// - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of + /// data is passed. If this flag is not specified, and more data is passed on update, the buffer + /// will be trimmed to fit the existing buffer size. This flag has effect only on dynamic /// buffers. /// - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on /// index buffers. @@ -2173,7 +2301,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_update_dynamic_vertex_buffer`. /// - void updateDynamicVertexBuffer( + void update( DynamicVertexBufferHandle _handle , uint32_t _startVertex , const Memory* _mem @@ -2187,7 +2315,7 @@ namespace bgfx /// void destroy(DynamicVertexBufferHandle _handle); - /// Returns number of available indices. + /// Returns number of requested or maximum available indices. /// /// @param[in] _num Number of required indices. /// @@ -2195,7 +2323,7 @@ namespace bgfx /// uint32_t getAvailTransientIndexBuffer(uint32_t _num); - /// Returns number of available vertices. + /// Returns number of requested or maximum available vertices. /// /// @param[in] _num Number of required vertices. /// @param[in] _decl Vertex declaration. @@ -2207,7 +2335,7 @@ namespace bgfx , const VertexDecl& _decl ); - /// Returns number of available instance buffer slots. + /// Returns number of requested or maximum available instance buffer slots. /// /// @param[in] _num Number of required instances. /// @param[in] _stride Stride per instance. @@ -2308,7 +2436,7 @@ namespace bgfx /// ShaderHandle createShader(const Memory* _mem); - /// Returns num of uniforms, and uniform handles used inside shader. + /// Returns the number of uniforms and uniform handles used inside a shader. /// /// @param[in] _handle Shader handle. /// @param[in] _uniforms UniformHandle array where data will be stored. @@ -2330,16 +2458,19 @@ namespace bgfx /// /// @param[in] _handle Shader handle. /// @param[in] _name Shader name. + /// @param[in] _len Shader name length (if length is INT32_MAX, it's expected + /// that _name is zero terminated string. /// /// @attention C99 equivalent is `bgfx_set_shader_name`. /// void setName( ShaderHandle _handle , const char* _name + , int32_t _len = INT32_MAX ); - /// Destroy shader. Once program is created with shader it is safe to - /// destroy shader. + /// Destroy shader. Once a shader program is created with _handle, + /// it is safe to destroy that shader. /// /// @param[in] _handle Shader handle. /// @@ -2402,12 +2533,12 @@ namespace bgfx , bool _cubeMap , uint16_t _numLayers , TextureFormat::Enum _format - , uint32_t _flags + , uint64_t _flags ); /// Calculate amount of memory required for texture. /// - /// @param[out] _info Resulting texture info structure. + /// @param[out] _info Resulting texture info structure. See: `TextureInfo`. /// @param[in] _width Width. /// @param[in] _height Height. /// @param[in] _depth Depth dimension of volume texture. @@ -2432,11 +2563,11 @@ namespace bgfx /// Create texture from memory buffer. /// /// @param[in] _mem DDS, KTX or PVR texture data. - /// @param[in] _flags Default texture sampling mode is linear, and wrap mode - /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// @param[in] _flags Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + /// flags. Default texture sampling mode is linear, and wrap mode is repeat. + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @param[in] _skip Skip top level mips when parsing texture. @@ -2447,7 +2578,7 @@ namespace bgfx /// TextureHandle createTexture( const Memory* _mem - , uint32_t _flags = BGFX_TEXTURE_NONE + , uint64_t _flags = BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE , uint8_t _skip = 0 , TextureInfo* _info = NULL ); @@ -2460,11 +2591,11 @@ namespace bgfx /// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps /// `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. /// @param[in] _format Texture format. See: `TextureFormat::Enum`. - /// @param[in] _flags Default texture sampling mode is linear, and wrap mode - /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// @param[in] _flags Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + /// flags. Default texture sampling mode is linear, and wrap mode is repeat. + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable. If @@ -2479,7 +2610,7 @@ namespace bgfx , bool _hasMips , uint16_t _numLayers , TextureFormat::Enum _format - , uint32_t _flags = BGFX_TEXTURE_NONE + , uint64_t _flags = BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE , const Memory* _mem = NULL ); @@ -2492,11 +2623,11 @@ namespace bgfx /// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps /// `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. /// @param[in] _format Texture format. See: `TextureFormat::Enum`. - /// @param[in] _flags Default texture sampling mode is linear, and wrap mode - /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// @param[in] _flags Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + /// flags. Default texture sampling mode is linear, and wrap mode is repeat. + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @attention C99 equivalent is `bgfx_create_texture_2d_scaled`. @@ -2506,7 +2637,7 @@ namespace bgfx , bool _hasMips , uint16_t _numLayers , TextureFormat::Enum _format - , uint32_t _flags = BGFX_TEXTURE_NONE + , uint64_t _flags = BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE ); /// Create 3D texture. @@ -2516,11 +2647,11 @@ namespace bgfx /// @param[in] _depth Depth. /// @param[in] _hasMips Indicates that texture contains full mip-map chain. /// @param[in] _format Texture format. See: `TextureFormat::Enum`. - /// @param[in] _flags Default texture sampling mode is linear, and wrap mode - /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// @param[in] _flags Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + /// flags. Default texture sampling mode is linear, and wrap mode is repeat. + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable. If @@ -2534,7 +2665,7 @@ namespace bgfx , uint16_t _depth , bool _hasMips , TextureFormat::Enum _format - , uint32_t _flags = BGFX_TEXTURE_NONE + , uint64_t _flags = BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE , const Memory* _mem = NULL ); @@ -2545,11 +2676,11 @@ namespace bgfx /// @param[in] _numLayers Number of layers in texture array. Must be 1 if caps /// `BGFX_CAPS_TEXTURE_CUBE_ARRAY` flag is not set. /// @param[in] _format Texture format. See: `TextureFormat::Enum`. - /// @param[in] _flags Default texture sampling mode is linear, and wrap mode - /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// @param[in] _flags Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) + /// flags. Default texture sampling mode is linear, and wrap mode is repeat. + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @param[in] _mem Texture data. If `_mem` is non-NULL, created texture will be immutable. If @@ -2563,7 +2694,7 @@ namespace bgfx , bool _hasMips , uint16_t _numLayers , TextureFormat::Enum _format - , uint32_t _flags = BGFX_TEXTURE_NONE + , uint64_t _flags = BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE , const Memory* _mem = NULL ); @@ -2630,7 +2761,7 @@ namespace bgfx /// +----------+ /// |-z 2| /// | ^ +y | - /// | | | + /// | | | Unfolded cube: /// | +---->+x | /// +----------+----------+----------+----------+ /// |+y 1|+y 4|+y 0|+y 5| @@ -2690,14 +2821,33 @@ namespace bgfx /// /// @param[in] _handle Texture handle. /// @param[in] _name Texture name. + /// @param[in] _len Texture name length (if length is INT32_MAX, it's expected + /// that _name is zero terminated string. /// /// @attention C99 equivalent is `bgfx_set_texture_name`. /// void setName( TextureHandle _handle , const char* _name + , int32_t _len = INT32_MAX ); + /// Returns texture direct access pointer. + /// + /// @param[in] _handle Texture handle. + /// + /// @returns Pointer to texture memory. If returned pointer is `NULL` direct access + /// is not available for this texture. If pointer is `UINTPTR_MAX` sentinel value + /// it means texture is pending creation. Pointer returned can be cached and it + /// will be valid until texture is destroyed. + /// + /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature + /// is available on GPUs that have unified memory architecture (UMA) support. + /// + /// @attention C99 equivalent is `bgfx_get_direct_access_ptr`. + /// + void* getDirectAccessPtr(TextureHandle _handle); + /// Destroy texture. /// /// @param[in] _handle Texture handle. @@ -2713,9 +2863,9 @@ namespace bgfx /// @param[in] _format Texture format. See: `TextureFormat::Enum`. /// @param[in] _textureFlags Default texture sampling mode is linear, and wrap mode /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @returns Handle to frame buffer object. @@ -2726,7 +2876,7 @@ namespace bgfx uint16_t _width , uint16_t _height , TextureFormat::Enum _format - , uint32_t _textureFlags = BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP + , uint64_t _textureFlags = BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP ); /// Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio @@ -2737,9 +2887,9 @@ namespace bgfx /// @param[in] _format Texture format. See: `TextureFormat::Enum`. /// @param[in] _textureFlags Default texture sampling mode is linear, and wrap mode /// is repeat. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @returns Handle to frame buffer object. @@ -2749,7 +2899,7 @@ namespace bgfx FrameBufferHandle createFrameBuffer( BackbufferRatio::Enum _ratio , TextureFormat::Enum _format - , uint32_t _textureFlags = BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP + , uint64_t _textureFlags = BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP ); /// Create MRT frame buffer from texture handles (simple). @@ -2773,7 +2923,7 @@ namespace bgfx /// mip level. /// /// @param[in] _num Number of texture attachments. - /// @param[in] _attachment Attachment texture info. See: `Attachment`. + /// @param[in] _attachment Attachment texture info. See: `bgfx::Attachment`. /// @param[in] _destroyTextures If true, textures will be destroyed when /// frame buffer is destroyed. /// @@ -2792,6 +2942,7 @@ namespace bgfx /// @param[in] _nwh OS' target native window handle. /// @param[in] _width Window back buffer width. /// @param[in] _height Window back buffer height. + /// @param[in] _format Window back buffer color format. /// @param[in] _depthFormat Window back buffer depth format. /// /// @returns Handle to frame buffer object. @@ -2805,7 +2956,8 @@ namespace bgfx void* _nwh , uint16_t _width , uint16_t _height - , TextureFormat::Enum _depthFormat = TextureFormat::UnknownDepth + , TextureFormat::Enum _format = TextureFormat::Count + , TextureFormat::Enum _depthFormat = TextureFormat::Count ); /// Obtain texture handle of frame buffer attachment. @@ -2816,6 +2968,8 @@ namespace bgfx /// @returns Returns invalid texture handle if attachment index is not /// correct, or frame buffer is created with native window handle. /// + /// @attention C99 equivalent is `bgfx_get_texture`. + /// TextureHandle getTexture( FrameBufferHandle _handle , uint8_t _attachment = 0 @@ -2846,7 +3000,7 @@ namespace bgfx /// /// 2. Predefined uniforms (declared in `bgfx_shader.sh`): /// - `u_viewRect vec4(x, y, width, height)` - view rectangle for current - /// view. + /// view, in pixels. /// - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse /// width and height /// - `u_view mat4` - view matrix @@ -3177,13 +3331,11 @@ namespace bgfx /// /// @param[in] _state State flags. Default state for primitive type is /// triangles. See: `BGFX_STATE_DEFAULT`. - /// - `BGFX_STATE_ALPHA_WRITE` - Enable alpha write. - /// - `BGFX_STATE_DEPTH_WRITE` - Enable depth write. /// - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. /// - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. /// - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. /// - `BGFX_STATE_CULL_*` - Backface culling mode. - /// - `BGFX_STATE_RGB_WRITE` - Enable RGB write. + /// - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. /// - `BGFX_STATE_MSAA` - Enable MSAA. /// - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. /// @@ -3260,8 +3412,8 @@ namespace bgfx /// void setScissor(uint16_t _cache = UINT16_MAX); - /// Set model matrix for draw primitive. If it is not called model will - /// be rendered with identity model matrix. + /// Set model matrix for draw primitive. If it is not called, + /// the model will be rendered with an identity model matrix. /// /// @param[in] _mtx Pointer to first matrix in array. /// @param[in] _num Number of matrices in array. @@ -3364,9 +3516,6 @@ namespace bgfx /// /// @param[in] _tib Transient index buffer. /// - /// @remarks - /// _tib pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_index_buffer`. /// void setIndexBuffer(const TransientIndexBuffer* _tib); @@ -3377,9 +3526,6 @@ namespace bgfx /// @param[in] _firstIndex First index to render. /// @param[in] _numIndices Number of indices to render. /// - /// @remarks - /// _tib pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_index_buffer`. /// void setIndexBuffer( @@ -3449,9 +3595,6 @@ namespace bgfx /// @param[in] _stream Vertex stream. /// @param[in] _tvb Transient vertex buffer. /// - /// @remarks - /// _tvb pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_vertex_buffer`. /// void setVertexBuffer( @@ -3466,9 +3609,6 @@ namespace bgfx /// @param[in] _startVertex First vertex to render. /// @param[in] _numVertices Number of vertices to render. /// - /// @remarks - /// _tvb pointer after this call is invalid. - /// /// @attention C99 equivalent is `bgfx_set_transient_vertex_buffer`. /// void setVertexBuffer( @@ -3478,19 +3618,36 @@ namespace bgfx , uint32_t _numVertices ); + /// Set number of vertices for auto generated vertices use in conjuction + /// with gl_VertexID. + /// + /// @param[in] _numVertices Number of vertices. + /// + /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. + /// @attention C99 equivalent is `bgfx_set_vertex_count`. + /// + void setVertexCount(uint32_t _numVertices); + /// Set instance data buffer for draw primitive. /// /// @param[in] _idb Transient instance data buffer. - /// @param[in] _num Number of data instances. /// - /// @remarks - /// _idb pointer after this call is invalid. + /// @attention C99 equivalent is `bgfx_set_instance_data_buffer`. + /// + void setInstanceDataBuffer(const InstanceDataBuffer* _idb); + + /// Set instance data buffer for draw primitive. + /// + /// @param[in] _idb Transient instance data buffer. + /// @param[in] _start First instance data. + /// @param[in] _num Number of data instances. /// /// @attention C99 equivalent is `bgfx_set_instance_data_buffer`. /// void setInstanceDataBuffer( const InstanceDataBuffer* _idb - , uint32_t _num = UINT32_MAX + , uint32_t _start + , uint32_t _num ); /// Set instance data buffer for draw primitive. @@ -3521,6 +3678,16 @@ namespace bgfx , uint32_t _num ); + /// Set number of instances for auto generated instances use in conjuction + /// with gl_InstanceID. + /// + /// @param[in] _numInstances Number of instances. + /// + /// @attention Availability depends on: `BGFX_CAPS_VERTEX_ID`. + /// @attention C99 equivalent is `bgfx_set_instance_count`. + /// + void setInstanceCount(uint32_t _numInstances); + /// Set texture stage for draw primitive. /// /// @param[in] _stage Texture unit. @@ -3528,9 +3695,9 @@ namespace bgfx /// @param[in] _handle Texture handle. /// @param[in] _flags Texture sampling mode. Default value UINT32_MAX uses /// texture sampling settings from the texture. - /// - `BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap + /// - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap /// mode. - /// - `BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic + /// - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic /// sampling. /// /// @attention C99 equivalent is `bgfx_set_texture`. @@ -3564,7 +3731,7 @@ namespace bgfx void submit( ViewId _id , ProgramHandle _program - , int32_t _depth = 0 + , uint32_t _depth = 0 , bool _preserveState = false ); @@ -3583,7 +3750,7 @@ namespace bgfx ViewId _id , ProgramHandle _program , OcclusionQueryHandle _occlusionQuery - , int32_t _depth = 0 + , uint32_t _depth = 0 , bool _preserveState = false ); @@ -3607,7 +3774,7 @@ namespace bgfx , IndirectBufferHandle _indirectHandle , uint16_t _start = 0 , uint16_t _num = 1 - , int32_t _depth = 0 + , uint32_t _depth = 0 , bool _preserveState = false ); @@ -3684,7 +3851,6 @@ namespace bgfx /// Set compute image from texture. /// /// @param[in] _stage Texture unit. - /// @param[in] _sampler Program sampler. /// @param[in] _handle Texture handle. /// @param[in] _mip Mip level. /// @param[in] _access Texture access. See `Access::Enum`. @@ -3694,7 +3860,6 @@ namespace bgfx /// void setImage( uint8_t _stage - , UniformHandle _sampler , TextureHandle _handle , uint8_t _mip , Access::Enum _access @@ -3753,7 +3918,7 @@ namespace bgfx /// void discard(); - /// Blit texture 2D region between two 2D textures. + /// Blit 2D texture region between two 2D textures. /// /// @param[in] _id View id. /// @param[in] _dst Destination texture handle. @@ -3765,7 +3930,7 @@ namespace bgfx /// @param[in] _width Width of region. /// @param[in] _height Height of region. /// - /// @attention Destination texture must be create with `BGFX_TEXTURE_BLIT_DST` flag. + /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// @attention C99 equivalent is `bgfx_blit`. /// @@ -3789,21 +3954,21 @@ namespace bgfx /// @param[in] _dstX Destination texture X position. /// @param[in] _dstY Destination texture Y position. /// @param[in] _dstZ If texture is 2D this argument should be 0. If destination texture is cube - /// this argument represent destination texture cube face. For 3D texture this argument - /// represent destination texture Z position. + /// this argument represents destination texture cube face. For 3D texture this argument + /// represents destination texture Z position. /// @param[in] _src Source texture handle. /// @param[in] _srcMip Source texture mip level. /// @param[in] _srcX Source texture X position. /// @param[in] _srcY Source texture Y position. /// @param[in] _srcZ If texture is 2D this argument should be 0. If source texture is cube - /// this argument represent source texture cube face. For 3D texture this argument - /// represent source texture Z position. + /// this argument represents source texture cube face. For 3D texture this argument + /// represents source texture Z position. /// @param[in] _width Width of region. /// @param[in] _height Height of region. - /// @param[in] _depth If texture is 3D this argument represent depth of region, otherwise is + /// @param[in] _depth If texture is 3D this argument represents depth of region, otherwise it's /// unused. /// - /// @attention Destination texture must be create with `BGFX_TEXTURE_BLIT_DST` flag. + /// @attention Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. /// @attention Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. /// @attention C99 equivalent is `bgfx_blit`. /// diff --git a/3rdparty/bgfx/include/bgfx/c99/bgfx.h b/3rdparty/bgfx/include/bgfx/c99/bgfx.h index 33bce5be59a..58a583ff121 100644 --- a/3rdparty/bgfx/include/bgfx/c99/bgfx.h +++ b/3rdparty/bgfx/include/bgfx/c99/bgfx.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE * * vim: set tabstop=4 expandtab: @@ -15,6 +15,10 @@ #include +#if !defined(BGFX_INVALID_HANDLE) +# define BGFX_INVALID_HANDLE { UINT16_MAX } +#endif // !defined(BGFX_INVALID_HANDLE) + #ifndef BGFX_SHARED_LIB_BUILD # define BGFX_SHARED_LIB_BUILD 0 #endif // BGFX_SHARED_LIB_BUILD @@ -129,6 +133,15 @@ typedef enum bgfx_texture_format BGFX_TEXTURE_FORMAT_PTC14A, BGFX_TEXTURE_FORMAT_PTC22, BGFX_TEXTURE_FORMAT_PTC24, + BGFX_TEXTURE_FORMAT_ATC, + BGFX_TEXTURE_FORMAT_ATCE, + BGFX_TEXTURE_FORMAT_ATCI, + BGFX_TEXTURE_FORMAT_ASTC4x4, + BGFX_TEXTURE_FORMAT_ASTC5x5, + BGFX_TEXTURE_FORMAT_ASTC6x6, + BGFX_TEXTURE_FORMAT_ASTC8x5, + BGFX_TEXTURE_FORMAT_ASTC8x6, + BGFX_TEXTURE_FORMAT_ASTC10x5, BGFX_TEXTURE_FORMAT_UNKNOWN, @@ -233,9 +246,22 @@ typedef enum bgfx_occlusion_query_result } bgfx_occlusion_query_result_t; +typedef enum bgfx_topology +{ + BGFX_TOPOLOGY_TRI_LIST, + BGFX_TOPOLOGY_TRI_STRIP, + BGFX_TOPOLOGY_LINE_LIST, + BGFX_TOPOLOGY_LINE_STRIP, + BGFX_TOPOLOGY_POINT_LIST, + + BGFX_TOPOLOGY_COUNT + +} bgfx_topology_t; + typedef enum bgfx_topology_convert { BGFX_TOPOLOGY_CONVERT_TRI_LIST_FLIP_WINDING, + BGFX_TOPOLOGY_CONVERT_TRI_STRIP_FLIP_WINDING, BGFX_TOPOLOGY_CONVERT_TRI_LIST_TO_LINE_LIST, BGFX_TOPOLOGY_CONVERT_TRI_STRIP_TO_TRI_LIST, BGFX_TOPOLOGY_CONVERT_LINE_STRIP_TO_LINE_LIST, @@ -275,7 +301,7 @@ typedef enum bgfx_view_mode } bgfx_view_mode_t; #define BGFX_HANDLE_T(_name) \ - typedef struct _name { uint16_t idx; } _name##_t + typedef struct _name##_s { uint16_t idx; } _name##_t BGFX_HANDLE_T(bgfx_dynamic_index_buffer_handle); BGFX_HANDLE_T(bgfx_dynamic_vertex_buffer_handle); @@ -296,7 +322,7 @@ BGFX_HANDLE_T(bgfx_vertex_decl_handle); typedef void (*bgfx_release_fn_t)(void* _ptr, void* _userData); /**/ -typedef struct bgfx_memory +typedef struct bgfx_memory_s { uint8_t* data; uint32_t size; @@ -304,42 +330,18 @@ typedef struct bgfx_memory } bgfx_memory_t; /**/ -typedef struct bgfx_transform +typedef struct bgfx_transform_s { float* data; uint16_t num; } bgfx_transform_t; -/**/ -typedef struct bgfx_hmd_eye -{ - float rotation[4]; - float translation[3]; - float fov[4]; - float viewOffset[3]; - float projection[16]; - float pixelsPerTanAngle[2]; - -} bgfx_hmd_eye_t; - -/**/ -typedef struct bgfx_hmd -{ - bgfx_hmd_eye_t eye[2]; - uint16_t width; - uint16_t height; - uint32_t deviceWidth; - uint32_t deviceHeight; - uint8_t flags; - -} bgfx_hmd_t; - /**/ typedef uint16_t bgfx_view_id_t; /**/ -typedef struct bgfx_view_stats +typedef struct bgfx_view_stats_s { char name[256]; bgfx_view_id_t view; @@ -348,7 +350,7 @@ typedef struct bgfx_view_stats } bgfx_view_stats_t; -typedef struct bgfx_encoder_stats +typedef struct bgfx_encoder_stats_s { int64_t cpuTimeBegin; int64_t cpuTimeEnd; @@ -356,7 +358,7 @@ typedef struct bgfx_encoder_stats } bgfx_encoder_stats_t; /**/ -typedef struct bgfx_stats +typedef struct bgfx_stats_s { int64_t cpuTimeFrame; int64_t cpuTimeBegin; @@ -372,8 +374,28 @@ typedef struct bgfx_stats uint32_t numDraw; uint32_t numCompute; + uint32_t numBlit; uint32_t maxGpuLatency; + uint16_t numDynamicIndexBuffers; + uint16_t numDynamicVertexBuffers; + uint16_t numFrameBuffers; + uint16_t numIndexBuffers; + uint16_t numOcclusionQueries; + uint16_t numPrograms; + uint16_t numShaders; + uint16_t numTextures; + uint16_t numUniforms; + uint16_t numVertexBuffers; + uint16_t numVertexDecls; + + int64_t textureMemoryUsed; + int64_t rtMemoryUsed; + int32_t transientVbUsed; + int32_t transientIbUsed; + + uint32_t numPrims[BGFX_TOPOLOGY_COUNT]; + int64_t gpuMemoryMax; int64_t gpuMemoryUsed; @@ -391,10 +413,7 @@ typedef struct bgfx_stats } bgfx_stats_t; /**/ -struct bgfx_encoder; - -/**/ -typedef struct bgfx_vertex_decl +typedef struct bgfx_vertex_decl_s { uint32_t hash; uint16_t stride; @@ -404,7 +423,7 @@ typedef struct bgfx_vertex_decl } bgfx_vertex_decl_t; /**/ -typedef struct bgfx_transient_index_buffer +typedef struct bgfx_transient_index_buffer_s { uint8_t* data; uint32_t size; @@ -414,7 +433,7 @@ typedef struct bgfx_transient_index_buffer } bgfx_transient_index_buffer_t; /**/ -typedef struct bgfx_transient_vertex_buffer +typedef struct bgfx_transient_vertex_buffer_s { uint8_t* data; uint32_t size; @@ -426,7 +445,7 @@ typedef struct bgfx_transient_vertex_buffer } bgfx_transient_vertex_buffer_t; /**/ -typedef struct bgfx_instance_data_buffer +typedef struct bgfx_instance_data_buffer_s { uint8_t* data; uint32_t size; @@ -438,7 +457,7 @@ typedef struct bgfx_instance_data_buffer } bgfx_instance_data_buffer_t; /**/ -typedef struct bgfx_texture_info +typedef struct bgfx_texture_info_s { bgfx_texture_format_t format; uint32_t storageSize; @@ -453,7 +472,7 @@ typedef struct bgfx_texture_info } bgfx_texture_info_t; /**/ -typedef struct bgfx_uniform_info +typedef struct bgfx_uniform_info_s { char name[256]; bgfx_uniform_type_t type; @@ -462,27 +481,30 @@ typedef struct bgfx_uniform_info } bgfx_uniform_info_t; /**/ -typedef struct bgfx_attachment +typedef struct bgfx_attachment_s { + bgfx_access_t access; bgfx_texture_handle_t handle; uint16_t mip; uint16_t layer; + uint8_t resolve; } bgfx_attachment_t; /**/ -typedef struct bgfx_caps_gpu +typedef struct bgfx_caps_gpu_s { uint16_t vendorId; uint16_t deviceId; } bgfx_caps_gpu_t; -typedef struct bgfx_caps_limits +typedef struct bgfx_caps_limits_s { uint32_t maxDrawCalls; uint32_t maxBlits; uint32_t maxTextureSize; + uint32_t maxTextureLayers; uint32_t maxViews; uint32_t maxFrameBuffers; uint32_t maxFBAttachments; @@ -490,6 +512,7 @@ typedef struct bgfx_caps_limits uint32_t maxShaders; uint32_t maxTextures; uint32_t maxTextureSamplers; + uint32_t maxComputeBindings; uint32_t maxVertexDecls; uint32_t maxVertexStreams; uint32_t maxIndexBuffers; @@ -499,11 +522,13 @@ typedef struct bgfx_caps_limits uint32_t maxUniforms; uint32_t maxOcclusionQueries; uint32_t maxEncoders; + uint32_t transientVbSize; + uint32_t transientIbSize; } bgfx_caps_limits_t; /**/ -typedef struct bgfx_caps +typedef struct bgfx_caps_s { bgfx_renderer_type_t rendererType; @@ -523,7 +548,7 @@ typedef struct bgfx_caps } bgfx_caps_t; /**/ -typedef enum bgfx_fatal +typedef enum bgfx_fatal_s { BGFX_FATAL_DEBUG_CHECK, BGFX_FATAL_INVALID_SHADER, @@ -536,16 +561,16 @@ typedef enum bgfx_fatal } bgfx_fatal_t; /**/ -typedef struct bgfx_callback_interface +typedef struct bgfx_callback_interface_s { - const struct bgfx_callback_vtbl* vtbl; + const struct bgfx_callback_vtbl_s* vtbl; } bgfx_callback_interface_t; /**/ -typedef struct bgfx_callback_vtbl +typedef struct bgfx_callback_vtbl_s { - void (*fatal)(bgfx_callback_interface_t* _this, bgfx_fatal_t _code, const char* _str); + void (*fatal)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, bgfx_fatal_t _code, const char* _str); void (*trace_vargs)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, const char* _format, va_list _argList); void (*profiler_begin)(bgfx_callback_interface_t* _this, const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line); void (*profiler_begin_literal)(bgfx_callback_interface_t* _this, const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line); @@ -561,25 +586,81 @@ typedef struct bgfx_callback_vtbl } bgfx_callback_vtbl_t; /**/ -typedef struct bgfx_allocator_interface +typedef struct bgfx_allocator_interface_s { - const struct bgfx_allocator_vtbl* vtbl; + const struct bgfx_allocator_vtbl_s* vtbl; } bgfx_allocator_interface_t; /**/ -typedef struct bgfx_allocator_vtbl +typedef struct bgfx_allocator_vtbl_s { void* (*realloc)(bgfx_allocator_interface_t* _this, void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line); } bgfx_allocator_vtbl_t; +/**/ +typedef struct bgfx_platform_data +{ + void* ndt; + void* nwh; + void* context; + void* backBuffer; + void* backBufferDS; + +} bgfx_platform_data_t; + +/**/ +typedef struct bgfx_resolution_s +{ + bgfx_texture_format_t format; + uint32_t width; + uint32_t height; + uint32_t reset; + uint8_t numBackBuffers; + uint8_t maxFrameLatency; + +} bgfx_resolution_t; + +/**/ +typedef struct bgfx_init_limits_s +{ + uint16_t maxEncoders; + uint32_t transientVbSize; + uint32_t transientIbSize; + +} bgfx_init_limits_t; + +/**/ +typedef struct bgfx_init_s +{ + bgfx_renderer_type_t type; + uint16_t vendorId; + uint16_t deviceId; + bool debug; + bool profile; + + bgfx_platform_data_t platformData; + bgfx_resolution_t resolution; + bgfx_init_limits_t limits; + + bgfx_callback_interface_t* callback; + bgfx_allocator_interface_t* allocator; + +} bgfx_init_t; + /**/ BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer); /**/ BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); +/**/ +BGFX_C_API void bgfx_vertex_decl_decode(const bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt); + +/**/ +BGFX_C_API bool bgfx_vertex_decl_has(const bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib); + /**/ BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _decl, uint8_t _num); @@ -611,34 +692,34 @@ BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type); /**/ -BGFX_C_API bool bgfx_init(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator); +BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init); /**/ -BGFX_C_API void bgfx_shutdown(); +BGFX_C_API bool bgfx_init(const bgfx_init_t* _init); /**/ -BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags); +BGFX_C_API void bgfx_shutdown(void); /**/ -BGFX_C_API struct bgfx_encoder* bgfx_begin(); +BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format); /**/ -BGFX_C_API void bgfx_end(struct bgfx_encoder* _encoder); +BGFX_C_API struct bgfx_encoder_s* bgfx_begin(void); + +/**/ +BGFX_C_API void bgfx_end(struct bgfx_encoder_s* _encoder); /**/ BGFX_C_API uint32_t bgfx_frame(bool _capture); /**/ -BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(); +BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void); /**/ -BGFX_C_API const bgfx_caps_t* bgfx_get_caps(); +BGFX_C_API const bgfx_caps_t* bgfx_get_caps(void); /**/ -BGFX_C_API const bgfx_hmd_t* bgfx_get_hmd(); - -/**/ -BGFX_C_API const bgfx_stats_t* bgfx_get_stats(); +BGFX_C_API const bgfx_stats_t* bgfx_get_stats(void); /**/ BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size); @@ -740,7 +821,7 @@ BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_ BGFX_C_API void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info); /**/ -BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name); +BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name, int32_t _len); /**/ BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle); @@ -755,25 +836,25 @@ BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_ BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle); /**/ -BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags); +BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags); /**/ BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format); /**/ -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info); +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t* _info); /**/ -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem); /**/ -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags); +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags); /**/ -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem); /**/ -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem); /**/ BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); @@ -788,16 +869,16 @@ BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip); /**/ -BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name); +BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name, int32_t _len); /**/ BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle); /**/ -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags); /**/ -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags); /**/ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures); @@ -806,7 +887,7 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures); /**/ -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat); +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat); /**/ BGFX_C_API bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment); @@ -821,7 +902,7 @@ BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uni BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle); /**/ -BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(); +BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(void); /**/ BGFX_C_API bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int32_t* _result); @@ -917,7 +998,10 @@ BGFX_C_API void bgfx_set_dynamic_vertex_buffer(uint8_t _stream, bgfx_dynamic_ver BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); /**/ -BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _num); +BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices); + +/**/ +BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num); /**/ BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); @@ -925,6 +1009,9 @@ BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_han /**/ BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); +/**/ +BGFX_C_API void bgfx_set_instance_count(uint32_t _numInstances); + /**/ BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); @@ -932,16 +1019,16 @@ BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, BGFX_C_API void bgfx_touch(bgfx_view_id_t _id); /**/ -BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); +BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); /**/ BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); @@ -965,112 +1052,115 @@ BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _handle, BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); /**/ -BGFX_C_API void bgfx_discard(); +BGFX_C_API void bgfx_discard(void); /**/ BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); /**/ -BGFX_C_API void bgfx_encoder_set_marker(struct bgfx_encoder* _encoder, const char* _marker); +BGFX_C_API void bgfx_encoder_set_marker(struct bgfx_encoder_s* _encoder, const char* _marker); /**/ -BGFX_C_API void bgfx_encoder_set_state(struct bgfx_encoder* _encoder, uint64_t _state, uint32_t _rgba); +BGFX_C_API void bgfx_encoder_set_state(struct bgfx_encoder_s* _encoder, uint64_t _state, uint32_t _rgba); /**/ -BGFX_C_API void bgfx_encoder_set_condition(struct bgfx_encoder* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible); +BGFX_C_API void bgfx_encoder_set_condition(struct bgfx_encoder_s* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible); /**/ -BGFX_C_API void bgfx_encoder_set_stencil(struct bgfx_encoder* _encoder, uint32_t _fstencil, uint32_t _bstencil); +BGFX_C_API void bgfx_encoder_set_stencil(struct bgfx_encoder_s* _encoder, uint32_t _fstencil, uint32_t _bstencil); /**/ -BGFX_C_API uint16_t bgfx_encoder_set_scissor(struct bgfx_encoder* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); +BGFX_C_API uint16_t bgfx_encoder_set_scissor(struct bgfx_encoder_s* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); /**/ -BGFX_C_API void bgfx_encoder_set_scissor_cached(struct bgfx_encoder* _encoder, uint16_t _cache); +BGFX_C_API void bgfx_encoder_set_scissor_cached(struct bgfx_encoder_s* _encoder, uint16_t _cache); /**/ -BGFX_C_API uint32_t bgfx_encoder_set_transform(struct bgfx_encoder* _encoder, const void* _mtx, uint16_t _num); +BGFX_C_API uint32_t bgfx_encoder_set_transform(struct bgfx_encoder_s* _encoder, const void* _mtx, uint16_t _num); /**/ -BGFX_C_API uint32_t bgfx_encoder_alloc_transform(struct bgfx_encoder* _encoder, bgfx_transform_t* _transform, uint16_t _num); +BGFX_C_API uint32_t bgfx_encoder_alloc_transform(struct bgfx_encoder_s* _encoder, bgfx_transform_t* _transform, uint16_t _num); /**/ -BGFX_C_API void bgfx_encoder_set_transform_cached(struct bgfx_encoder* _encoder, uint32_t _cache, uint16_t _num); +BGFX_C_API void bgfx_encoder_set_transform_cached(struct bgfx_encoder_s* _encoder, uint32_t _cache, uint16_t _num); /**/ -BGFX_C_API void bgfx_encoder_set_uniform(struct bgfx_encoder* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num); +BGFX_C_API void bgfx_encoder_set_uniform(struct bgfx_encoder_s* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num); /**/ -BGFX_C_API void bgfx_encoder_set_index_buffer(struct bgfx_encoder* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); +BGFX_C_API void bgfx_encoder_set_index_buffer(struct bgfx_encoder_s* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); /**/ -BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(struct bgfx_encoder* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); +BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(struct bgfx_encoder_s* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); /**/ -BGFX_C_API void bgfx_encoder_set_transient_index_buffer(struct bgfx_encoder* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); +BGFX_C_API void bgfx_encoder_set_transient_index_buffer(struct bgfx_encoder_s* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); /**/ -BGFX_C_API void bgfx_encoder_set_vertex_buffer(struct bgfx_encoder* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); +BGFX_C_API void bgfx_encoder_set_vertex_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); /**/ -BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(struct bgfx_encoder* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); +BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); /**/ -BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(struct bgfx_encoder* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); +BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); /**/ -BGFX_C_API void bgfx_encoder_set_instance_data_buffer(struct bgfx_encoder* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _num); +BGFX_C_API void bgfx_encoder_set_vertex_count(struct bgfx_encoder_s* _encoder, uint32_t _numVertices); /**/ -BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(struct bgfx_encoder* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); +BGFX_C_API void bgfx_encoder_set_instance_data_buffer(struct bgfx_encoder_s* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num); /**/ -BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(struct bgfx_encoder* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); +BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(struct bgfx_encoder_s* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); /**/ -BGFX_C_API void bgfx_encoder_set_texture(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); +BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(struct bgfx_encoder_s* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); /**/ -BGFX_C_API void bgfx_encoder_touch(struct bgfx_encoder* _encoder, bgfx_view_id_t _id); +BGFX_C_API void bgfx_encoder_set_texture(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); /**/ -BGFX_C_API void bgfx_encoder_submit(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_encoder_touch(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id); /**/ -BGFX_C_API void bgfx_encoder_submit_occlusion_query(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_encoder_submit(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_encoder_submit_indirect(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); +BGFX_C_API void bgfx_encoder_submit_occlusion_query(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_encoder_set_image(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); +BGFX_C_API void bgfx_encoder_submit_indirect(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState); /**/ -BGFX_C_API void bgfx_encoder_set_compute_index_buffer(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); +BGFX_C_API void bgfx_encoder_set_image(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); /**/ -BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); +BGFX_C_API void bgfx_encoder_set_compute_index_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); +BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); +BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); +BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_encoder_dispatch(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); +BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); /**/ -BGFX_C_API void bgfx_encoder_dispatch_indirect(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); +BGFX_C_API void bgfx_encoder_dispatch(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); /**/ -BGFX_C_API void bgfx_encoder_discard(struct bgfx_encoder* _encoder); +BGFX_C_API void bgfx_encoder_dispatch_indirect(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); /**/ -BGFX_C_API void bgfx_encoder_blit(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); +BGFX_C_API void bgfx_encoder_discard(struct bgfx_encoder_s* _encoder); + +/**/ +BGFX_C_API void bgfx_encoder_blit(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); /**/ BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath); diff --git a/3rdparty/bgfx/include/bgfx/c99/platform.h b/3rdparty/bgfx/include/bgfx/c99/platform.h index e58f6b28224..caaeb01c4b0 100644 --- a/3rdparty/bgfx/include/bgfx/c99/platform.h +++ b/3rdparty/bgfx/include/bgfx/c99/platform.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE * * vim: set tabstop=4 expandtab: @@ -33,17 +33,6 @@ typedef enum bgfx_render_frame */ BGFX_C_API bgfx_render_frame_t bgfx_render_frame(int32_t _msecs); -typedef struct bgfx_platform_data -{ - void* ndt; - void* nwh; - void* context; - void* backBuffer; - void* backBufferDS; - void* session; - -} bgfx_platform_data_t; - /**/ BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data); @@ -73,6 +62,8 @@ typedef struct bgfx_interface_vtbl uintptr_t (*override_internal_texture)(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags); void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer); void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); + void (*vertex_decl_decode)(const bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt); + bool (*vertex_decl_has)(const bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib); void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num); void (*vertex_decl_end)(bgfx_vertex_decl_t* _decl); void (*vertex_pack)(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index); @@ -83,13 +74,13 @@ typedef struct bgfx_interface_vtbl void (*topology_sort_tri_list)(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, const void* _indices, uint32_t _numIndices, bool _index32); uint8_t (*get_supported_renderers)(uint8_t _max, bgfx_renderer_type_t* _enum); const char* (*get_renderer_name)(bgfx_renderer_type_t _type); - bool (*init)(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator); + void (*init_ctor)(bgfx_init_t* _init); + bool (*init)(const bgfx_init_t* _init); void (*shutdown)(); - void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags); + void (*reset)(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format); uint32_t (*frame)(bool _capture); bgfx_renderer_type_t (*get_renderer_type)(); const bgfx_caps_t* (*get_caps)(); - const bgfx_hmd_t* (*get_hmd)(); const bgfx_stats_t* (*get_stats)(); const bgfx_memory_t* (*alloc)(uint32_t _size); const bgfx_memory_t* (*copy)(const void* _data, uint32_t _size); @@ -123,28 +114,29 @@ typedef struct bgfx_interface_vtbl void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle); bgfx_shader_handle_t (*create_shader)(const bgfx_memory_t* _mem); uint16_t (*get_shader_uniforms)(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max); - void (*set_shader_name)(bgfx_shader_handle_t _handle, const char* _name); + void (*set_shader_name)(bgfx_shader_handle_t _handle, const char* _name, int32_t _len); void (*destroy_shader)(bgfx_shader_handle_t _handle); bgfx_program_handle_t (*create_program)(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); bgfx_program_handle_t (*create_compute_program)(bgfx_shader_handle_t _csh, bool _destroyShaders); void (*destroy_program)(bgfx_program_handle_t _handle); - bool (*is_texture_valid)(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags); + bool (*is_texture_valid)(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags); void (*calc_texture_size)(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format); - bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info); - bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); - bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags); - bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); - bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem); + bgfx_texture_handle_t (*create_texture)(const bgfx_memory_t* _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t* _info); + bgfx_texture_handle_t (*create_texture_2d)(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem); + bgfx_texture_handle_t (*create_texture_2d_scaled)(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags); + bgfx_texture_handle_t (*create_texture_3d)(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem); + bgfx_texture_handle_t (*create_texture_cube)(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem); void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem); void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); uint32_t (*read_texture)(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip); - void (*set_texture_name)(bgfx_texture_handle_t _handle, const char* _name); + void (*set_texture_name)(bgfx_texture_handle_t _handle, const char* _name, int32_t _len); + void* (*get_direct_access_ptr)(bgfx_texture_handle_t _handle); void (*destroy_texture)(bgfx_texture_handle_t _handle); - bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); - bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); + bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags); + bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags); bgfx_frame_buffer_handle_t (*create_frame_buffer_from_attachment)(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures); - bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat); + bgfx_frame_buffer_handle_t (*create_frame_buffer_from_nwh)(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat); bgfx_texture_handle_t (*get_texture)(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment); void (*destroy_frame_buffer)(bgfx_frame_buffer_handle_t _handle); bgfx_uniform_handle_t (*create_uniform)(const char* _name, bgfx_uniform_type_t _type, uint16_t _num); @@ -164,40 +156,42 @@ typedef struct bgfx_interface_vtbl void (*set_view_transform)(bgfx_view_id_t _id, const void* _view, const void* _proj); void (*set_view_transform_stereo)(bgfx_view_id_t _id, const void* _view, const void* _projL, uint8_t _flags, const void* _projR); void (*set_view_order)(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t* _order); - void (*encoder_set_marker)(struct bgfx_encoder* _encoder, const char* _marker); - void (*encoder_set_state)(struct bgfx_encoder* _encoder, uint64_t _state, uint32_t _rgba); - void (*encoder_set_condition)(struct bgfx_encoder* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible); - void (*encoder_set_stencil)(struct bgfx_encoder* _encoder, uint32_t _fstencil, uint32_t _bstencil); - uint16_t (*encoder_set_scissor)(struct bgfx_encoder* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); - void (*encoder_set_scissor_cached)(struct bgfx_encoder* _encoder, uint16_t _cache); - uint32_t (*encoder_set_transform)(struct bgfx_encoder* _encoder, const void* _mtx, uint16_t _num); - uint32_t (*encoder_alloc_transform)(struct bgfx_encoder* _encoder, bgfx_transform_t* _transform, uint16_t _num); - void (*encoder_set_transform_cached)(struct bgfx_encoder* _encoder, uint32_t _cache, uint16_t _num); - void (*encoder_set_uniform)(struct bgfx_encoder* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num); - void (*encoder_set_index_buffer)(struct bgfx_encoder* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); - void (*encoder_set_dynamic_index_buffer)(struct bgfx_encoder* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); - void (*encoder_set_transient_index_buffer)(struct bgfx_encoder* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); - void (*encoder_set_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); - void (*encoder_set_dynamic_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); - void (*encoder_set_transient_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); - void (*encoder_set_instance_data_buffer)(struct bgfx_encoder* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _num); - void (*encoder_set_instance_data_from_vertex_buffer)(struct bgfx_encoder* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); - void (*encoder_set_instance_data_from_dynamic_vertex_buffer)(struct bgfx_encoder* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); - void (*encoder_set_texture)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); - void (*encoder_touch)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id); - void (*encoder_submit)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState); - void (*encoder_submit_occlusion_query)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState); - void (*encoder_submit_indirect)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState); - void (*encoder_set_image)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); - void (*encoder_set_compute_index_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); - void (*encoder_set_compute_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); - void (*encoder_set_compute_dynamic_index_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); - void (*encoder_set_compute_dynamic_vertex_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); - void (*encoder_set_compute_indirect_buffer)(struct bgfx_encoder* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); - void (*encoder_dispatch)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); - void (*encoder_dispatch_indirect)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); - void (*encoder_discard)(struct bgfx_encoder* _encoder); - void (*encoder_blit)(struct bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); + void (*encoder_set_marker)(struct bgfx_encoder_s* _encoder, const char* _marker); + void (*encoder_set_state)(struct bgfx_encoder_s* _encoder, uint64_t _state, uint32_t _rgba); + void (*encoder_set_condition)(struct bgfx_encoder_s* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible); + void (*encoder_set_stencil)(struct bgfx_encoder_s* _encoder, uint32_t _fstencil, uint32_t _bstencil); + uint16_t (*encoder_set_scissor)(struct bgfx_encoder_s* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height); + void (*encoder_set_scissor_cached)(struct bgfx_encoder_s* _encoder, uint16_t _cache); + uint32_t (*encoder_set_transform)(struct bgfx_encoder_s* _encoder, const void* _mtx, uint16_t _num); + uint32_t (*encoder_alloc_transform)(struct bgfx_encoder_s* _encoder, bgfx_transform_t* _transform, uint16_t _num); + void (*encoder_set_transform_cached)(struct bgfx_encoder_s* _encoder, uint32_t _cache, uint16_t _num); + void (*encoder_set_uniform)(struct bgfx_encoder_s* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num); + void (*encoder_set_index_buffer)(struct bgfx_encoder_s* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); + void (*encoder_set_dynamic_index_buffer)(struct bgfx_encoder_s* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices); + void (*encoder_set_transient_index_buffer)(struct bgfx_encoder_s* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices); + void (*encoder_set_vertex_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); + void (*encoder_set_dynamic_vertex_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices); + void (*encoder_set_transient_vertex_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices); + void (*encoder_set_vertex_count)(struct bgfx_encoder_s* _encoder, uint32_t _numVertices); + void (*encoder_set_instance_data_buffer)(struct bgfx_encoder_s* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num); + void (*encoder_set_instance_data_from_vertex_buffer)(struct bgfx_encoder_s* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); + void (*encoder_set_instance_data_from_dynamic_vertex_buffer)(struct bgfx_encoder_s* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num); + void (*encoder_set_instance_count)(struct bgfx_encoder_s* _encoder, uint32_t _numInstance); + void (*encoder_set_texture)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags); + void (*encoder_touch)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id); + void (*encoder_submit)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _depth, bool _preserveState); + void (*encoder_submit_occlusion_query)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState); + void (*encoder_submit_indirect)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState); + void (*encoder_set_image)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format); + void (*encoder_set_compute_index_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); + void (*encoder_set_compute_vertex_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); + void (*encoder_set_compute_dynamic_index_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); + void (*encoder_set_compute_dynamic_vertex_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); + void (*encoder_set_compute_indirect_buffer)(struct bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); + void (*encoder_dispatch)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags); + void (*encoder_dispatch_indirect)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags); + void (*encoder_discard)(struct bgfx_encoder_s* _encoder); + void (*encoder_blit)(struct bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth); void (*request_screen_shot)(bgfx_frame_buffer_handle_t _handle, const char* _filePath); } bgfx_interface_vtbl_t; diff --git a/3rdparty/bgfx/include/bgfx/defines.h b/3rdparty/bgfx/include/bgfx/defines.h index 8a9ddcaf256..d6419e47a68 100644 --- a/3rdparty/bgfx/include/bgfx/defines.h +++ b/3rdparty/bgfx/include/bgfx/defines.h @@ -1,17 +1,33 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(57) +#define BGFX_API_VERSION UINT32_C(90) /// Color RGB/alpha/depth write. When it's not specified write will be disabled. -#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. -#define BGFX_STATE_ALPHA_WRITE UINT64_C(0x0000000000000002) //!< Enable alpha write. -#define BGFX_STATE_DEPTH_WRITE UINT64_C(0x0000000000000004) //!< Enable depth write. +#define BGFX_STATE_WRITE_R UINT64_C(0x0000000000000001) //!< Enable R write. +#define BGFX_STATE_WRITE_G UINT64_C(0x0000000000000002) //!< Enable G write. +#define BGFX_STATE_WRITE_B UINT64_C(0x0000000000000004) //!< Enable B write. +#define BGFX_STATE_WRITE_A UINT64_C(0x0000000000000008) //!< Enable alpha write. +#define BGFX_STATE_WRITE_Z UINT64_C(0x0000004000000000) //!< Enable depth write. + +/// Enable RGB write. +#define BGFX_STATE_WRITE_RGB (0 \ + | BGFX_STATE_WRITE_R \ + | BGFX_STATE_WRITE_G \ + | BGFX_STATE_WRITE_B \ + ) + +/// Write all channels mask. +#define BGFX_STATE_WRITE_MASK (0 \ + | BGFX_STATE_WRITE_RGB \ + | BGFX_STATE_WRITE_A \ + | BGFX_STATE_WRITE_Z \ + ) /// Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled. #define BGFX_STATE_DEPTH_TEST_LESS UINT64_C(0x0000000000000010) //!< Enable depth test, less. @@ -87,19 +103,20 @@ #define BGFX_STATE_RESERVED_SHIFT 61 //!< Internal bits shift. #define BGFX_STATE_RESERVED_MASK UINT64_C(0xe000000000000000) //!< Internal bits mask. +/// #define BGFX_STATE_NONE UINT64_C(0x0000000000000000) //!< No state. #define BGFX_STATE_MASK UINT64_C(0xffffffffffffffff) //!< State mask. /// Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise /// culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored). -#define BGFX_STATE_DEFAULT (0 \ - | BGFX_STATE_RGB_WRITE \ - | BGFX_STATE_ALPHA_WRITE \ - | BGFX_STATE_DEPTH_TEST_LESS \ - | BGFX_STATE_DEPTH_WRITE \ - | BGFX_STATE_CULL_CW \ - | BGFX_STATE_MSAA \ - ) +#define BGFX_STATE_DEFAULT (0 \ + | BGFX_STATE_WRITE_RGB \ + | BGFX_STATE_WRITE_A \ + | BGFX_STATE_WRITE_Z \ + | BGFX_STATE_DEPTH_TEST_LESS \ + | BGFX_STATE_CULL_CW \ + | BGFX_STATE_MSAA \ + ) /// Alpha reference value. #define BGFX_STATE_ALPHA_REF(_ref) ( ( (uint64_t)(_ref )<>BGFX_STATE_BLEND_SHIFT) \ - | ( (uint32_t)( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \ - ) +#define BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) (0 \ + | ( (uint32_t)( (_src)>>BGFX_STATE_BLEND_SHIFT) \ + | ( (uint32_t)( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \ + ) -#define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \ - | BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \ - | ( (uint32_t)( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \ - ) +/// +#define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \ + | BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \ + | ( (uint32_t)( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \ + ) #define BGFX_STATE_BLEND_FUNC_RT_1(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<< 0) #define BGFX_STATE_BLEND_FUNC_RT_2(_src, _dst) (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<11) @@ -192,6 +210,7 @@ #define BGFX_STENCIL_FUNC_RMASK_SHIFT 8 //!< #define BGFX_STENCIL_FUNC_RMASK_MASK UINT32_C(0x0000ff00) //!< +/// #define BGFX_STENCIL_TEST_LESS UINT32_C(0x00010000) //!< Enable stencil test, less. #define BGFX_STENCIL_TEST_LEQUAL UINT32_C(0x00020000) //!< Enable stencil test, less or equal. #define BGFX_STENCIL_TEST_EQUAL UINT32_C(0x00030000) //!< Enable stencil test, equal. @@ -203,6 +222,7 @@ #define BGFX_STENCIL_TEST_SHIFT 16 //!< Stencil test bit shift. #define BGFX_STENCIL_TEST_MASK UINT32_C(0x000f0000) //!< Stencil test bit mask. +/// #define BGFX_STENCIL_OP_FAIL_S_ZERO UINT32_C(0x00000000) //!< Zero. #define BGFX_STENCIL_OP_FAIL_S_KEEP UINT32_C(0x00100000) //!< Keep. #define BGFX_STENCIL_OP_FAIL_S_REPLACE UINT32_C(0x00200000) //!< Replace. @@ -214,6 +234,7 @@ #define BGFX_STENCIL_OP_FAIL_S_SHIFT 20 //!< Stencil operation fail bit shift. #define BGFX_STENCIL_OP_FAIL_S_MASK UINT32_C(0x00f00000) //!< Stencil operation fail bit mask. +/// #define BGFX_STENCIL_OP_FAIL_Z_ZERO UINT32_C(0x00000000) //!< Zero. #define BGFX_STENCIL_OP_FAIL_Z_KEEP UINT32_C(0x01000000) //!< Keep. #define BGFX_STENCIL_OP_FAIL_Z_REPLACE UINT32_C(0x02000000) //!< Replace. @@ -225,6 +246,7 @@ #define BGFX_STENCIL_OP_FAIL_Z_SHIFT 24 //!< Stencil operation depth fail bit shift #define BGFX_STENCIL_OP_FAIL_Z_MASK UINT32_C(0x0f000000) //!< Stencil operation depth fail bit mask. +/// #define BGFX_STENCIL_OP_PASS_Z_ZERO UINT32_C(0x00000000) //!< Zero. #define BGFX_STENCIL_OP_PASS_Z_KEEP UINT32_C(0x10000000) //!< Keep. #define BGFX_STENCIL_OP_PASS_Z_REPLACE UINT32_C(0x20000000) //!< Replace. @@ -236,6 +258,7 @@ #define BGFX_STENCIL_OP_PASS_Z_SHIFT 28 //!< Stencil operation depth pass bit shift #define BGFX_STENCIL_OP_PASS_Z_MASK UINT32_C(0xf0000000) //!< Stencil operation depth pass bit mask. +/// #define BGFX_STENCIL_NONE UINT32_C(0x00000000) //!< #define BGFX_STENCIL_MASK UINT32_C(0xffffffff) //!< #define BGFX_STENCIL_DEFAULT UINT32_C(0x00000000) //!< @@ -262,21 +285,24 @@ #define BGFX_CLEAR_DISCARD_DEPTH UINT16_C(0x0800) //!< Discard frame buffer depth attachment. #define BGFX_CLEAR_DISCARD_STENCIL UINT16_C(0x1000) //!< Discard frame buffer stencil attachment. -#define BGFX_CLEAR_DISCARD_COLOR_MASK (0 \ - | BGFX_CLEAR_DISCARD_COLOR_0 \ - | BGFX_CLEAR_DISCARD_COLOR_1 \ - | BGFX_CLEAR_DISCARD_COLOR_2 \ - | BGFX_CLEAR_DISCARD_COLOR_3 \ - | BGFX_CLEAR_DISCARD_COLOR_4 \ - | BGFX_CLEAR_DISCARD_COLOR_5 \ - | BGFX_CLEAR_DISCARD_COLOR_6 \ - | BGFX_CLEAR_DISCARD_COLOR_7 \ - ) -#define BGFX_CLEAR_DISCARD_MASK (0 \ - | BGFX_CLEAR_DISCARD_COLOR_MASK \ - | BGFX_CLEAR_DISCARD_DEPTH \ - | BGFX_CLEAR_DISCARD_STENCIL \ - ) +/// +#define BGFX_CLEAR_DISCARD_COLOR_MASK (0 \ + | BGFX_CLEAR_DISCARD_COLOR_0 \ + | BGFX_CLEAR_DISCARD_COLOR_1 \ + | BGFX_CLEAR_DISCARD_COLOR_2 \ + | BGFX_CLEAR_DISCARD_COLOR_3 \ + | BGFX_CLEAR_DISCARD_COLOR_4 \ + | BGFX_CLEAR_DISCARD_COLOR_5 \ + | BGFX_CLEAR_DISCARD_COLOR_6 \ + | BGFX_CLEAR_DISCARD_COLOR_7 \ + ) + +/// +#define BGFX_CLEAR_DISCARD_MASK (0 \ + | BGFX_CLEAR_DISCARD_COLOR_MASK \ + | BGFX_CLEAR_DISCARD_DEPTH \ + | BGFX_CLEAR_DISCARD_STENCIL \ + ) /// #define BGFX_DEBUG_NONE UINT32_C(0x00000000) //!< No debug. @@ -289,6 +315,7 @@ /// #define BGFX_BUFFER_NONE UINT16_C(0x0000) //!< +/// #define BGFX_BUFFER_COMPUTE_FORMAT_8x1 UINT16_C(0x0001) //!< 1 8-bit value #define BGFX_BUFFER_COMPUTE_FORMAT_8x2 UINT16_C(0x0002) //!< 2 8-bit values #define BGFX_BUFFER_COMPUTE_FORMAT_8x4 UINT16_C(0x0003) //!< 4 8-bit values @@ -301,91 +328,100 @@ #define BGFX_BUFFER_COMPUTE_FORMAT_SHIFT 0 //!< #define BGFX_BUFFER_COMPUTE_FORMAT_MASK UINT16_C(0x000f) //!< +/// #define BGFX_BUFFER_COMPUTE_TYPE_INT UINT16_C(0x0010) //!< Type `int`. #define BGFX_BUFFER_COMPUTE_TYPE_UINT UINT16_C(0x0020) //!< Type `uint`. #define BGFX_BUFFER_COMPUTE_TYPE_FLOAT UINT16_C(0x0030) //!< Type `float`. #define BGFX_BUFFER_COMPUTE_TYPE_SHIFT 4 //!< #define BGFX_BUFFER_COMPUTE_TYPE_MASK UINT16_C(0x0030) //!< +/// #define BGFX_BUFFER_COMPUTE_READ UINT16_C(0x0100) //!< Buffer will be read by shader. #define BGFX_BUFFER_COMPUTE_WRITE UINT16_C(0x0200) //!< Buffer will be used for writing. #define BGFX_BUFFER_DRAW_INDIRECT UINT16_C(0x0400) //!< Buffer will be used for storing draw indirect commands. #define BGFX_BUFFER_ALLOW_RESIZE UINT16_C(0x0800) //!< Allow dynamic index/vertex buffer resize during update. #define BGFX_BUFFER_INDEX32 UINT16_C(0x1000) //!< Index buffer contains 32-bit indices. +/// #define BGFX_BUFFER_COMPUTE_READ_WRITE (0 \ - | BGFX_BUFFER_COMPUTE_READ \ - | BGFX_BUFFER_COMPUTE_WRITE \ - ) + | BGFX_BUFFER_COMPUTE_READ \ + | BGFX_BUFFER_COMPUTE_WRITE \ + ) + +/// Texture creation flags. +#define BGFX_TEXTURE_NONE UINT64_C(0x0000000000000000) //!< +#define BGFX_TEXTURE_MSAA_SAMPLE UINT64_C(0x0000000800000000) //!< Texture will be used for MSAA sampling. +#define BGFX_TEXTURE_RT UINT64_C(0x0000001000000000) //!< Render target no MSAA. +#define BGFX_TEXTURE_RT_MSAA_X2 UINT64_C(0x0000002000000000) //!< Render target MSAAx2 mode. +#define BGFX_TEXTURE_RT_MSAA_X4 UINT64_C(0x0000003000000000) //!< Render target MSAAx4 mode. +#define BGFX_TEXTURE_RT_MSAA_X8 UINT64_C(0x0000004000000000) //!< Render target MSAAx8 mode. +#define BGFX_TEXTURE_RT_MSAA_X16 UINT64_C(0x0000005000000000) //!< Render target MSAAx16 mode. +#define BGFX_TEXTURE_RT_MSAA_SHIFT 36 //!< +#define BGFX_TEXTURE_RT_MSAA_MASK UINT64_C(0x0000007000000000) //!< +#define BGFX_TEXTURE_RT_WRITE_ONLY UINT64_C(0x0000008000000000) //!< Render target will be used for writing only. +#define BGFX_TEXTURE_RT_MASK UINT64_C(0x000000f000000000) //!< +#define BGFX_TEXTURE_COMPUTE_WRITE UINT64_C(0x0000100000000000) //!< Texture will be used for compute write. +#define BGFX_TEXTURE_SRGB UINT64_C(0x0000200000000000) //!< Sample texture as sRGB. +#define BGFX_TEXTURE_BLIT_DST UINT64_C(0x0000400000000000) //!< Texture will be used as blit destination. +#define BGFX_TEXTURE_READ_BACK UINT64_C(0x0000800000000000) //!< Texture will be used for read back from GPU. + +/// Sampler flags. +#define BGFX_SAMPLER_NONE UINT32_C(0x00000000) //!< +#define BGFX_SAMPLER_U_MIRROR UINT32_C(0x00000001) //!< Wrap U mode: Mirror +#define BGFX_SAMPLER_U_CLAMP UINT32_C(0x00000002) //!< Wrap U mode: Clamp +#define BGFX_SAMPLER_U_BORDER UINT32_C(0x00000003) //!< Wrap U mode: Border +#define BGFX_SAMPLER_U_SHIFT 0 //!< +#define BGFX_SAMPLER_U_MASK UINT32_C(0x00000003) //!< +#define BGFX_SAMPLER_V_MIRROR UINT32_C(0x00000004) //!< Wrap V mode: Mirror +#define BGFX_SAMPLER_V_CLAMP UINT32_C(0x00000008) //!< Wrap V mode: Clamp +#define BGFX_SAMPLER_V_BORDER UINT32_C(0x0000000c) //!< Wrap V mode: Border +#define BGFX_SAMPLER_V_SHIFT 2 //!< +#define BGFX_SAMPLER_V_MASK UINT32_C(0x0000000c) //!< +#define BGFX_SAMPLER_W_MIRROR UINT32_C(0x00000010) //!< Wrap W mode: Mirror +#define BGFX_SAMPLER_W_CLAMP UINT32_C(0x00000020) //!< Wrap W mode: Clamp +#define BGFX_SAMPLER_W_BORDER UINT32_C(0x00000030) //!< Wrap W mode: Border +#define BGFX_SAMPLER_W_SHIFT 4 //!< +#define BGFX_SAMPLER_W_MASK UINT32_C(0x00000030) //!< +#define BGFX_SAMPLER_MIN_POINT UINT32_C(0x00000040) //!< Min sampling mode: Point +#define BGFX_SAMPLER_MIN_ANISOTROPIC UINT32_C(0x00000080) //!< Min sampling mode: Anisotropic +#define BGFX_SAMPLER_MIN_SHIFT 6 //!< +#define BGFX_SAMPLER_MIN_MASK UINT32_C(0x000000c0) //!< +#define BGFX_SAMPLER_MAG_POINT UINT32_C(0x00000100) //!< Mag sampling mode: Point +#define BGFX_SAMPLER_MAG_ANISOTROPIC UINT32_C(0x00000200) //!< Mag sampling mode: Anisotropic +#define BGFX_SAMPLER_MAG_SHIFT 8 //!< +#define BGFX_SAMPLER_MAG_MASK UINT32_C(0x00000300) //!< +#define BGFX_SAMPLER_MIP_POINT UINT32_C(0x00000400) //!< Mip sampling mode: Point +#define BGFX_SAMPLER_MIP_SHIFT 10 //!< +#define BGFX_SAMPLER_MIP_MASK UINT32_C(0x00000400) //!< +#define BGFX_SAMPLER_COMPARE_LESS UINT32_C(0x00010000) //!< Compare when sampling depth texture: less. +#define BGFX_SAMPLER_COMPARE_LEQUAL UINT32_C(0x00020000) //!< Compare when sampling depth texture: less or equal. +#define BGFX_SAMPLER_COMPARE_EQUAL UINT32_C(0x00030000) //!< Compare when sampling depth texture: equal. +#define BGFX_SAMPLER_COMPARE_GEQUAL UINT32_C(0x00040000) //!< Compare when sampling depth texture: greater or equal. +#define BGFX_SAMPLER_COMPARE_GREATER UINT32_C(0x00050000) //!< Compare when sampling depth texture: greater. +#define BGFX_SAMPLER_COMPARE_NOTEQUAL UINT32_C(0x00060000) //!< Compare when sampling depth texture: not equal. +#define BGFX_SAMPLER_COMPARE_NEVER UINT32_C(0x00070000) //!< Compare when sampling depth texture: never. +#define BGFX_SAMPLER_COMPARE_ALWAYS UINT32_C(0x00080000) //!< Compare when sampling depth texture: always. +#define BGFX_SAMPLER_COMPARE_SHIFT 16 //!< +#define BGFX_SAMPLER_COMPARE_MASK UINT32_C(0x000f0000) //!< +#define BGFX_SAMPLER_SAMPLE_STENCIL UINT32_C(0x00100000) //!< Sample stencil instead of depth. +#define BGFX_SAMPLER_BORDER_COLOR_SHIFT 24 //!< +#define BGFX_SAMPLER_BORDER_COLOR_MASK UINT32_C(0x0f000000) //!< +#define BGFX_SAMPLER_RESERVED_SHIFT 28 //!< +#define BGFX_SAMPLER_RESERVED_MASK UINT32_C(0xf0000000) //!< /// -#define BGFX_TEXTURE_NONE UINT32_C(0x00000000) //!< -#define BGFX_TEXTURE_U_MIRROR UINT32_C(0x00000001) //!< Wrap U mode: Mirror -#define BGFX_TEXTURE_U_CLAMP UINT32_C(0x00000002) //!< Wrap U mode: Clamp -#define BGFX_TEXTURE_U_BORDER UINT32_C(0x00000003) //!< Wrap U mode: Border -#define BGFX_TEXTURE_U_SHIFT 0 //!< -#define BGFX_TEXTURE_U_MASK UINT32_C(0x00000003) //!< -#define BGFX_TEXTURE_V_MIRROR UINT32_C(0x00000004) //!< Wrap V mode: Mirror -#define BGFX_TEXTURE_V_CLAMP UINT32_C(0x00000008) //!< Wrap V mode: Clamp -#define BGFX_TEXTURE_V_BORDER UINT32_C(0x0000000c) //!< Wrap V mode: Border -#define BGFX_TEXTURE_V_SHIFT 2 //!< -#define BGFX_TEXTURE_V_MASK UINT32_C(0x0000000c) //!< -#define BGFX_TEXTURE_W_MIRROR UINT32_C(0x00000010) //!< Wrap W mode: Mirror -#define BGFX_TEXTURE_W_CLAMP UINT32_C(0x00000020) //!< Wrap W mode: Clamp -#define BGFX_TEXTURE_W_BORDER UINT32_C(0x00000030) //!< Wrap W mode: Border -#define BGFX_TEXTURE_W_SHIFT 4 //!< -#define BGFX_TEXTURE_W_MASK UINT32_C(0x00000030) //!< -#define BGFX_TEXTURE_MIN_POINT UINT32_C(0x00000040) //!< Min sampling mode: Point -#define BGFX_TEXTURE_MIN_ANISOTROPIC UINT32_C(0x00000080) //!< Min sampling mode: Anisotropic -#define BGFX_TEXTURE_MIN_SHIFT 6 //!< -#define BGFX_TEXTURE_MIN_MASK UINT32_C(0x000000c0) //!< -#define BGFX_TEXTURE_MAG_POINT UINT32_C(0x00000100) //!< Mag sampling mode: Point -#define BGFX_TEXTURE_MAG_ANISOTROPIC UINT32_C(0x00000200) //!< Mag sampling mode: Anisotropic -#define BGFX_TEXTURE_MAG_SHIFT 8 //!< -#define BGFX_TEXTURE_MAG_MASK UINT32_C(0x00000300) //!< -#define BGFX_TEXTURE_MIP_POINT UINT32_C(0x00000400) //!< Mip sampling mode: Point -#define BGFX_TEXTURE_MIP_SHIFT 10 //!< -#define BGFX_TEXTURE_MIP_MASK UINT32_C(0x00000400) //!< -#define BGFX_TEXTURE_MSAA_SAMPLE UINT32_C(0x00000800) //!< Texture will be used for MSAA sampling. -#define BGFX_TEXTURE_RT UINT32_C(0x00001000) //!< -#define BGFX_TEXTURE_RT_MSAA_X2 UINT32_C(0x00002000) //!< Render target MSAAx2 mode. -#define BGFX_TEXTURE_RT_MSAA_X4 UINT32_C(0x00003000) //!< Render target MSAAx4 mode. -#define BGFX_TEXTURE_RT_MSAA_X8 UINT32_C(0x00004000) //!< Render target MSAAx8 mode. -#define BGFX_TEXTURE_RT_MSAA_X16 UINT32_C(0x00005000) //!< Render target MSAAx16 mode. -#define BGFX_TEXTURE_RT_MSAA_SHIFT 12 //!< -#define BGFX_TEXTURE_RT_MSAA_MASK UINT32_C(0x00007000) //!< -#define BGFX_TEXTURE_RT_WRITE_ONLY UINT32_C(0x00008000) //!< Render target will be used for writing only. -#define BGFX_TEXTURE_RT_MASK UINT32_C(0x0000f000) //!< -#define BGFX_TEXTURE_COMPARE_LESS UINT32_C(0x00010000) //!< Compare when sampling depth texture: less. -#define BGFX_TEXTURE_COMPARE_LEQUAL UINT32_C(0x00020000) //!< Compare when sampling depth texture: less or equal. -#define BGFX_TEXTURE_COMPARE_EQUAL UINT32_C(0x00030000) //!< Compare when sampling depth texture: equal. -#define BGFX_TEXTURE_COMPARE_GEQUAL UINT32_C(0x00040000) //!< Compare when sampling depth texture: greater or equal. -#define BGFX_TEXTURE_COMPARE_GREATER UINT32_C(0x00050000) //!< Compare when sampling depth texture: greater. -#define BGFX_TEXTURE_COMPARE_NOTEQUAL UINT32_C(0x00060000) //!< Compare when sampling depth texture: not equal. -#define BGFX_TEXTURE_COMPARE_NEVER UINT32_C(0x00070000) //!< Compare when sampling depth texture: never. -#define BGFX_TEXTURE_COMPARE_ALWAYS UINT32_C(0x00080000) //!< Compare when sampling depth texture: always. -#define BGFX_TEXTURE_COMPARE_SHIFT 16 //!< -#define BGFX_TEXTURE_COMPARE_MASK UINT32_C(0x000f0000) //!< -#define BGFX_TEXTURE_COMPUTE_WRITE UINT32_C(0x00100000) //!< Texture will be used for compute write. -#define BGFX_TEXTURE_SRGB UINT32_C(0x00200000) //!< Sample texture as sRGB. -#define BGFX_TEXTURE_BLIT_DST UINT32_C(0x00400000) //!< Texture will be used as blit destination. -#define BGFX_TEXTURE_READ_BACK UINT32_C(0x00800000) //!< Texture will be used for read back from GPU. -#define BGFX_TEXTURE_BORDER_COLOR_SHIFT 24 //!< -#define BGFX_TEXTURE_BORDER_COLOR_MASK UINT32_C(0x0f000000) //!< -#define BGFX_TEXTURE_RESERVED_SHIFT 28 //!< -#define BGFX_TEXTURE_RESERVED_MASK UINT32_C(0xf0000000) //!< +#define BGFX_SAMPLER_BORDER_COLOR(_index) ( (_index << BGFX_SAMPLER_BORDER_COLOR_SHIFT) & BGFX_SAMPLER_BORDER_COLOR_MASK) -#define BGFX_TEXTURE_BORDER_COLOR(_index) ( (_index << BGFX_TEXTURE_BORDER_COLOR_SHIFT) & BGFX_TEXTURE_BORDER_COLOR_MASK) - -#define BGFX_TEXTURE_SAMPLER_BITS_MASK (0 \ - | BGFX_TEXTURE_U_MASK \ - | BGFX_TEXTURE_V_MASK \ - | BGFX_TEXTURE_W_MASK \ - | BGFX_TEXTURE_MIN_MASK \ - | BGFX_TEXTURE_MAG_MASK \ - | BGFX_TEXTURE_MIP_MASK \ - | BGFX_TEXTURE_COMPARE_MASK \ - ) +/// +#define BGFX_SAMPLER_BITS_MASK (0 \ + | BGFX_SAMPLER_U_MASK \ + | BGFX_SAMPLER_V_MASK \ + | BGFX_SAMPLER_W_MASK \ + | BGFX_SAMPLER_MIN_MASK \ + | BGFX_SAMPLER_MAG_MASK \ + | BGFX_SAMPLER_MIP_MASK \ + | BGFX_SAMPLER_COMPARE_MASK \ + ) /// #define BGFX_RESET_NONE UINT32_C(0x00000000) //!< No reset flags. @@ -401,16 +437,13 @@ #define BGFX_RESET_VSYNC UINT32_C(0x00000080) //!< Enable V-Sync. #define BGFX_RESET_MAXANISOTROPY UINT32_C(0x00000100) //!< Turn on/off max anisotropy. #define BGFX_RESET_CAPTURE UINT32_C(0x00000200) //!< Begin screen capture. -#define BGFX_RESET_HMD UINT32_C(0x00000400) //!< HMD stereo rendering. -#define BGFX_RESET_HMD_DEBUG UINT32_C(0x00000800) //!< HMD stereo rendering debug mode. -#define BGFX_RESET_HMD_RECENTER UINT32_C(0x00001000) //!< HMD calibration. #define BGFX_RESET_FLUSH_AFTER_RENDER UINT32_C(0x00002000) //!< Flush rendering after submitting to GPU. #define BGFX_RESET_FLIP_AFTER_RENDER UINT32_C(0x00004000) //!< This flag specifies where flip occurs. Default behavior is that flip occurs before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. #define BGFX_RESET_SRGB_BACKBUFFER UINT32_C(0x00008000) //!< Enable sRGB backbuffer. -#define BGFX_RESET_HIDPI UINT32_C(0x00010000) //!< Enable HiDPI rendering. -#define BGFX_RESET_DEPTH_CLAMP UINT32_C(0x00020000) //!< Enable depth clamp. -#define BGFX_RESET_SUSPEND UINT32_C(0x00040000) //!< Suspend rendering. - +#define BGFX_RESET_HDR10 UINT32_C(0x00010000) //!< Enable HDR10 rendering. +#define BGFX_RESET_HIDPI UINT32_C(0x00020000) //!< Enable HiDPI rendering. +#define BGFX_RESET_DEPTH_CLAMP UINT32_C(0x00040000) //!< Enable depth clamp. +#define BGFX_RESET_SUSPEND UINT32_C(0x00080000) //!< Suspend rendering. #define BGFX_RESET_RESERVED_SHIFT 31 //!< Internal bits shift. #define BGFX_RESET_RESERVED_MASK UINT32_C(0x80000000) //!< Internal bits mask. @@ -423,22 +456,24 @@ #define BGFX_CAPS_FRAGMENT_DEPTH UINT64_C(0x0000000000000020) //!< Fragment depth is accessible in fragment shader. #define BGFX_CAPS_FRAGMENT_ORDERING UINT64_C(0x0000000000000040) //!< Fragment ordering is available in fragment shader. #define BGFX_CAPS_GRAPHICS_DEBUGGER UINT64_C(0x0000000000000080) //!< Graphics debugger is present. -#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000000100) //!< HiDPI rendering is supported. -#define BGFX_CAPS_HMD UINT64_C(0x0000000000000200) //!< Head Mounted Display is available. -#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000000400) //!< 32-bit indices are supported. -#define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000000800) //!< Instancing is supported. -#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000001000) //!< Occlusion query is supported. -#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000002000) //!< Renderer is on separate thread. -#define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000004000) //!< Multiple windows are supported. -#define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000008000) //!< 2D texture array is supported. -#define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000010000) //!< 3D textures are supported. -#define BGFX_CAPS_TEXTURE_BLIT UINT64_C(0x0000000000020000) //!< Texture blit is supported. -#define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x00000000000c0000) //!< All texture compare modes are supported. -#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000080000) //!< Texture compare less equal mode is supported. -#define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000100000) //!< Cubemap texture array is supported. -#define BGFX_CAPS_TEXTURE_READ_BACK UINT64_C(0x0000000000200000) //!< Read-back texture is supported. -#define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000000400000) //!< Vertex attribute half-float is supported. -#define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000000800000) //!< Vertex attribute 10_10_10_2 is supported. +#define BGFX_CAPS_HDR10 UINT64_C(0x0000000000000100) //!< HDR10 rendering is supported. +#define BGFX_CAPS_HIDPI UINT64_C(0x0000000000000400) //!< HiDPI rendering is supported. +#define BGFX_CAPS_INDEX32 UINT64_C(0x0000000000000800) //!< 32-bit indices are supported. +#define BGFX_CAPS_INSTANCING UINT64_C(0x0000000000001000) //!< Instancing is supported. +#define BGFX_CAPS_OCCLUSION_QUERY UINT64_C(0x0000000000002000) //!< Occlusion query is supported. +#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000004000) //!< Renderer is on separate thread. +#define BGFX_CAPS_SWAP_CHAIN UINT64_C(0x0000000000008000) //!< Multiple windows are supported. +#define BGFX_CAPS_TEXTURE_2D_ARRAY UINT64_C(0x0000000000010000) //!< 2D texture array is supported. +#define BGFX_CAPS_TEXTURE_3D UINT64_C(0x0000000000020000) //!< 3D textures are supported. +#define BGFX_CAPS_TEXTURE_BLIT UINT64_C(0x0000000000040000) //!< Texture blit is supported. +#define BGFX_CAPS_TEXTURE_COMPARE_ALL UINT64_C(0x0000000000180000) //!< All texture compare modes are supported. +#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000100000) //!< Texture compare less equal mode is supported. +#define BGFX_CAPS_TEXTURE_CUBE_ARRAY UINT64_C(0x0000000000200000) //!< Cubemap texture array is supported. +#define BGFX_CAPS_TEXTURE_DIRECT_ACCESS UINT64_C(0x0000000000400000) //!< CPU direct access to GPU texture memory. +#define BGFX_CAPS_TEXTURE_READ_BACK UINT64_C(0x0000000000800000) //!< Read-back texture is supported. +#define BGFX_CAPS_VERTEX_ATTRIB_HALF UINT64_C(0x0000000001000000) //!< Vertex attribute half-float is supported. +#define BGFX_CAPS_VERTEX_ATTRIB_UINT10 UINT64_C(0x0000000002000000) //!< Vertex attribute 10_10_10_2 is supported. +#define BGFX_CAPS_VERTEX_ID UINT64_C(0x0000000004000000) //!< Rendering with VertexID only is supported. /// #define BGFX_CAPS_FORMAT_TEXTURE_NONE UINT16_C(0x0000) //!< Texture format is not supported. @@ -471,6 +506,10 @@ #define BGFX_SUBMIT_RESERVED_SHIFT 7 //!< Internal bits shift. #define BGFX_SUBMIT_RESERVED_MASK UINT8_C(0x80) //!< Internal bits mask. +/// +#define BGFX_RESOLVE_NONE UINT8_C(0x00) //!< No resolve flags. +#define BGFX_RESOLVE_AUTO_GEN_MIPS UINT8_C(0x01) //!< Auto-generate mip maps on resolve. + /// #define BGFX_PCI_ID_NONE UINT16_C(0x0000) //!< Autoselect adapter. #define BGFX_PCI_ID_SOFTWARE_RASTERIZER UINT16_C(0x0001) //!< Software rasterizer. @@ -478,11 +517,6 @@ #define BGFX_PCI_ID_INTEL UINT16_C(0x8086) //!< Intel adapter. #define BGFX_PCI_ID_NVIDIA UINT16_C(0x10de) //!< nVidia adapter. -/// -#define BGFX_HMD_NONE UINT8_C(0x00) //!< None. -#define BGFX_HMD_DEVICE_RESOLUTION UINT8_C(0x01) //!< Has HMD native resolution. -#define BGFX_HMD_RENDERING UINT8_C(0x02) //!< Rendering to HMD. - /// #define BGFX_CUBE_MAP_POSITIVE_X UINT8_C(0x00) //!< Cubemap +x. #define BGFX_CUBE_MAP_NEGATIVE_X UINT8_C(0x01) //!< Cubemap -x. diff --git a/3rdparty/bgfx/include/bgfx/embedded_shader.h b/3rdparty/bgfx/include/bgfx/embedded_shader.h index 6bffbf58c64..a3cb99f6d8b 100644 --- a/3rdparty/bgfx/include/bgfx/embedded_shader.h +++ b/3rdparty/bgfx/include/bgfx/embedded_shader.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -34,7 +34,6 @@ || BX_PLATFORM_IOS \ || BX_PLATFORM_LINUX \ || BX_PLATFORM_OSX \ - || BX_PLATFORM_QNX \ || BX_PLATFORM_RPI \ || BX_PLATFORM_STEAMLINK \ || BX_PLATFORM_WINDOWS \ @@ -57,37 +56,44 @@ #if BGFX_PLATFORM_SUPPORTS_DX9BC # undef BGFX_EMBEDDED_SHADER_DX9BC -# define BGFX_EMBEDDED_SHADER_DX9BC(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _dx9 ), sizeof(BX_CONCATENATE(_name, _dx9 ) ) }, +# define BGFX_EMBEDDED_SHADER_DX9BC(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _dx9 ), BX_COUNTOF(BX_CONCATENATE(_name, _dx9 ) ) }, #endif // BGFX_PLATFORM_SUPPORTS_DX9BC #if BGFX_PLATFORM_SUPPORTS_DXBC # undef BGFX_EMBEDDED_SHADER_DXBC -# define BGFX_EMBEDDED_SHADER_DXBC(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _dx11), sizeof(BX_CONCATENATE(_name, _dx11) ) }, +# define BGFX_EMBEDDED_SHADER_DXBC(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _dx11), BX_COUNTOF(BX_CONCATENATE(_name, _dx11) ) }, #endif // BGFX_PLATFORM_SUPPORTS_DXBC #if BGFX_PLATFORM_SUPPORTS_PSSL # undef BGFX_EMBEDDED_SHADER_PSSL -# define BGFX_EMBEDDED_SHADER_PSSL(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _pssl), BX_CONCATENATE(_name, _pssl_size) }, +# define BGFX_EMBEDDED_SHADER_PSSL(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _pssl), BX_CONCATENATE(_name, _pssl_size) }, #endif // BGFX_PLATFORM_SUPPORTS_PSSL #if BGFX_PLATFORM_SUPPORTS_ESSL # undef BGFX_EMBEDDED_SHADER_ESSL -# define BGFX_EMBEDDED_SHADER_ESSL(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _glsl), sizeof(BX_CONCATENATE(_name, _glsl) ) }, +# define BGFX_EMBEDDED_SHADER_ESSL(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _glsl), BX_COUNTOF(BX_CONCATENATE(_name, _glsl) ) }, #endif // BGFX_PLATFORM_SUPPORTS_ESSL #if BGFX_PLATFORM_SUPPORTS_GLSL # undef BGFX_EMBEDDED_SHADER_GLSL -# define BGFX_EMBEDDED_SHADER_GLSL(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _glsl), sizeof(BX_CONCATENATE(_name, _glsl) ) }, +# define BGFX_EMBEDDED_SHADER_GLSL(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _glsl), BX_COUNTOF(BX_CONCATENATE(_name, _glsl) ) }, #endif // BGFX_PLATFORM_SUPPORTS_GLSL #if BGFX_PLATFORM_SUPPORTS_SPIRV # undef BGFX_EMBEDDED_SHADER_SPIRV -# define BGFX_EMBEDDED_SHADER_SPIRV(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _spv), sizeof(BX_CONCATENATE(_name, _spv) ) }, +# define BGFX_EMBEDDED_SHADER_SPIRV(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _spv), BX_COUNTOF(BX_CONCATENATE(_name, _spv) ) }, #endif // BGFX_PLATFORM_SUPPORTS_SPIRV #if BGFX_PLATFORM_SUPPORTS_METAL # undef BGFX_EMBEDDED_SHADER_METAL -# define BGFX_EMBEDDED_SHADER_METAL(_renderer, _name) { _renderer, BX_CONCATENATE(_name, _mtl), sizeof(BX_CONCATENATE(_name, _mtl) ) }, +# define BGFX_EMBEDDED_SHADER_METAL(_renderer, _name) \ + { _renderer, BX_CONCATENATE(_name, _mtl), BX_COUNTOF(BX_CONCATENATE(_name, _mtl) ) }, #endif // BGFX_PLATFORM_SUPPORTS_METAL #define BGFX_EMBEDDED_SHADER(_name) \ diff --git a/3rdparty/bgfx/include/bgfx/platform.h b/3rdparty/bgfx/include/bgfx/platform.h index 7e89f2fa78c..33d2c83d9c1 100644 --- a/3rdparty/bgfx/include/bgfx/platform.h +++ b/3rdparty/bgfx/include/bgfx/platform.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE */ @@ -48,20 +48,6 @@ namespace bgfx /// to bgfx::init, render thread won't be created by bgfx::init call. RenderFrame::Enum renderFrame(int32_t _msecs = -1); - /// Platform data. - /// - /// @attention C99 equivalent is `bgfx_platform_data_t`. - /// - struct PlatformData - { - void* ndt; //!< Native display type. - void* nwh; //!< Native window handle. - void* context; //!< GL context, or D3D device. - void* backBuffer; //!< GL backbuffer, or D3D render target view. - void* backBufferDS; //!< Backbuffer depth/stencil. - void* session; //!< ovrSession, for Oculus SDK - }; - /// Set platform data. /// /// @warning Must be called before `bgfx::init`. @@ -134,7 +120,7 @@ namespace bgfx /// /// @attention C99 equivalent is `bgfx_override_internal_texture`. /// - uintptr_t overrideInternal(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE); + uintptr_t overrideInternal(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_SAMPLER_NONE); } // namespace bgfx diff --git a/3rdparty/bgfx/makefile b/3rdparty/bgfx/makefile index 64fa680e1b0..2bb0cef3ea6 100644 --- a/3rdparty/bgfx/makefile +++ b/3rdparty/bgfx/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # @@ -39,24 +39,22 @@ clean: ## Clean all intermediate files. @mkdir .build projgen: ## Generate project files for all configurations. - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2012 - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2013 - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2015 - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2017 - $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=mingw-gcc gmake - $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=linux-gcc gmake - $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=osx gmake - $(GENIE) --with-tools --with-combined-examples --with-shared-lib --xcode=osx xcode4 - $(GENIE) --with-tools --with-combined-examples --with-shared-lib --xcode=ios xcode4 - $(GENIE) --with-combined-examples --with-shared-lib --gcc=freebsd gmake - $(GENIE) --with-combined-examples --gcc=android-arm gmake - $(GENIE) --with-combined-examples --gcc=android-mips gmake - $(GENIE) --with-combined-examples --gcc=android-x86 gmake - $(GENIE) --with-combined-examples --gcc=asmjs gmake - $(GENIE) --with-combined-examples --gcc=ios-arm gmake - $(GENIE) --with-combined-examples --gcc=ios-arm64 gmake - $(GENIE) --with-combined-examples --gcc=ios-simulator gmake - $(GENIE) --with-combined-examples --gcc=rpi gmake + $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2017 + $(GENIE) --with-tools --with-combined-examples --vs=winstore100 vs2017 + $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=mingw-gcc gmake + $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=linux-gcc gmake + $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=osx gmake + $(GENIE) --with-tools --with-combined-examples --with-shared-lib --xcode=osx xcode8 + $(GENIE) --with-tools --with-combined-examples --with-shared-lib --xcode=ios xcode8 + $(GENIE) --with-combined-examples --with-shared-lib --gcc=freebsd gmake + $(GENIE) --with-combined-examples --gcc=android-arm gmake + $(GENIE) --with-combined-examples --gcc=android-x86 gmake + $(GENIE) --with-combined-examples --gcc=asmjs gmake + $(GENIE) --with-combined-examples --gcc=ios-arm gmake + $(GENIE) --with-combined-examples --gcc=ios-arm64 gmake + $(GENIE) --with-combined-examples --gcc=ios-simulator gmake + $(GENIE) --with-combined-examples --gcc=ios-simulator64 gmake + $(GENIE) --with-combined-examples --gcc=rpi gmake .build/projects/gmake-android-arm: $(GENIE) --gcc=android-arm gmake @@ -66,14 +64,6 @@ android-arm-release: .build/projects/gmake-android-arm ## Build - Android ARM Re $(MAKE) -R -C .build/projects/gmake-android-arm config=release android-arm: android-arm-debug android-arm-release ## Build - Android ARM Debug and Release -.build/projects/gmake-android-mips: - $(GENIE) --gcc=android-mips gmake -android-mips-debug: .build/projects/gmake-android-mips ## Build - Android MIPS Debug - $(MAKE) -R -C .build/projects/gmake-android-mips config=debug -android-mips-release: .build/projects/gmake-android-mips ## Build - Android MIPS Release - $(MAKE) -R -C .build/projects/gmake-android-mips config=release -android-mips: android-mips-debug android-mips-release ## Build - Android MIPS Debug and Release - .build/projects/gmake-android-x86: $(GENIE) --gcc=android-x86 gmake android-x86-debug: .build/projects/gmake-android-x86 ## Build - Android x86 Debug and Release @@ -92,15 +82,11 @@ asmjs: asmjs-debug asmjs-release ## Build - Emscripten Debug and Release .build/projects/gmake-linux: $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=linux-gcc gmake -linux-debug32: .build/projects/gmake-linux ## Build - Linux x86 Debug - $(MAKE) -R -C .build/projects/gmake-linux config=debug32 -linux-release32: .build/projects/gmake-linux ## Build - Linux x86 Release - $(MAKE) -R -C .build/projects/gmake-linux config=release32 linux-debug64: .build/projects/gmake-linux ## Build - Linux x64 Debug $(MAKE) -R -C .build/projects/gmake-linux config=debug64 linux-release64: .build/projects/gmake-linux ## Build - Linux x64 Release $(MAKE) -R -C .build/projects/gmake-linux config=release64 -linux: linux-debug32 linux-release32 linux-debug64 linux-release64 ## Build - Linux x86/x64 Debug and Release +linux: linux-debug64 linux-release64 ## Build - Linux x86/x64 Debug and Release .build/projects/gmake-freebsd: $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=freebsd gmake @@ -115,7 +101,7 @@ freebsd-release64: .build/projects/gmake-freebsd ## Build - FreeBSD x86 Release freebsd: freebsd-debug32 freebsd-release32 freebsd-debug64 freebsd-release64 ## Build - FreeBSD x86/x64 Debug and Release .build/projects/gmake-mingw-gcc: - $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=mingw-gcc gmake + $(GENIE) --with-tools --with-combined-examples --with-shared-lib --os=windows --gcc=mingw-gcc gmake mingw-gcc-debug32: .build/projects/gmake-mingw-gcc ## Build - MinGW GCC x86 Debug $(MAKE) -R -C .build/projects/gmake-mingw-gcc config=debug32 mingw-gcc-release32: .build/projects/gmake-mingw-gcc ## Build - MinGW GCC x86 Release @@ -138,42 +124,6 @@ mingw-clang-release64: .build/projects/gmake-mingw-clang ## Build - MinGW Clang $(MAKE) -R -C .build/projects/gmake-mingw-clang config=release64 mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64 ## Build - MinGW Clang x86/x64 Debug and Release -.build/projects/vs2012: - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2012 -vs2012-debug32: .build/projects/vs2012 ## Build - VS2012 x86 Debug - devenv .build/projects/vs2012/bgfx.sln /Build "Debug|Win32" -vs2012-release32: .build/projects/vs2012 ## Build - VS2012 x86 Release - devenv .build/projects/vs2012/bgfx.sln /Build "Release|Win32" -vs2012-debug64: .build/projects/vs2012 ## Build - VS2012 x64 Debug - devenv .build/projects/vs2012/bgfx.sln /Build "Debug|x64" -vs2012-release64: .build/projects/vs2012 ## Build - VS2012 x64 Release - devenv .build/projects/vs2012/bgfx.sln /Build "Release|x64" -vs2012: vs2012-debug32 vs2012-release32 vs2012-debug64 vs2012-release64 ## Build - VS2012 x86/x64 Debug and Release - -.build/projects/vs2013: - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2013 -vs2013-debug32: .build/projects/vs2013 ## Build - VS2013 x86 Debug - devenv .build/projects/vs2013/bgfx.sln /Build "Debug|Win32" -vs2013-release32: .build/projects/vs2013 ## Build - VS2013 x86 Release - devenv .build/projects/vs2013/bgfx.sln /Build "Release|Win32" -vs2013-debug64: .build/projects/vs2013 ## Build - VS2013 x64 Debug - devenv .build/projects/vs2013/bgfx.sln /Build "Debug|x64" -vs2013-release64: .build/projects/vs2013 ## Build - VS2013 x64 Release - devenv .build/projects/vs2013/bgfx.sln /Build "Release|x64" -vs2013: vs2013-debug32 vs2013-release32 vs2013-debug64 vs2013-release64 ## Build - VS2013 x86/x64 Debug and Release - -.build/projects/vs2015: - $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2015 -vs2015-debug32: .build/projects/vs2015 ## Build - VS2015 x86 Debug - devenv .build/projects/vs2015/bgfx.sln /Build "Debug|Win32" -vs2015-release32: .build/projects/vs2015 ## Build - VS2015 x86 Release - devenv .build/projects/vs2015/bgfx.sln /Build "Release|Win32" -vs2015-debug64: .build/projects/vs2015 ## Build - VS2015 x64 Debug - devenv .build/projects/vs2015/bgfx.sln /Build "Debug|x64" -vs2015-release64: .build/projects/vs2015 ## Build - VS2015 x64 Release - devenv .build/projects/vs2015/bgfx.sln /Build "Release|x64" -vs2015: vs2015-debug32 vs2015-release32 vs2015-debug64 vs2015-release64 ## Build - VS2015 x86/x64 Debug and Release - .build/projects/vs2017: $(GENIE) --with-tools --with-combined-examples --with-shared-lib vs2017 vs2017-debug32: .build/projects/vs2017 ## Build - vs2017 x86 Debug @@ -186,17 +136,25 @@ vs2017-release64: .build/projects/vs2017 ## Build - vs2017 x64 Release devenv .build/projects/vs2017/bgfx.sln /Build "Release|x64" vs2017: vs2017-debug32 vs2017-release32 vs2017-debug64 vs2017-release64 ## Build - vs2017 x86/x64 Debug and Release +.build/projects/vs2017-winstore100: + $(GENIE) --with-combined-examples --vs=winstore100 vs2017 +vs2017-winstore100-debug32: .build/projects/vs2017-winstore100 ## Build - vs2017-winstore100 x86 Debug + devenv .build/projects/vs2017-winstore100/bgfx.sln /Build "Debug|Win32" +vs2017-winstore100-release32: .build/projects/vs2017-winstore100 ## Build - vs2017-winstore100 x86 Release + devenv .build/projects/vs2017-winstore100/bgfx.sln /Build "Release|Win32" +vs2017-winstore100-debug64: .build/projects/vs2017-winstore100 ## Build - vs2017-winstore100 x64 Debug + devenv .build/projects/vs2017-winstore100/bgfx.sln /Build "Debug|x64" +vs2017-winstore100-release64: .build/projects/vs2017-winstore100 ## Build - vs2017-winstore100 x64 Release + devenv .build/projects/vs2017-winstore100/bgfx.sln /Build "Release|x64" +vs2017-winstore100: vs2017-winstore100-debug32 vs2017-winstore100-release32 vs2017-winstore100-debug64 vs2017-winstore100-release64 ## Build - vs2017-winstore100 x86/x64 Debug and Release + .build/projects/gmake-osx: $(GENIE) --with-tools --with-combined-examples --with-shared-lib --gcc=osx gmake -osx-debug32: .build/projects/gmake-osx ## Build - OSX x86 Debug - $(MAKE) -C .build/projects/gmake-osx config=debug32 -osx-release32: .build/projects/gmake-osx ## Build - OSX x86 Release - $(MAKE) -C .build/projects/gmake-osx config=release32 osx-debug64: .build/projects/gmake-osx ## Build - OSX x64 Debug $(MAKE) -C .build/projects/gmake-osx config=debug64 osx-release64: .build/projects/gmake-osx ## Build - OSX x64 Release $(MAKE) -C .build/projects/gmake-osx config=release64 -osx: osx-debug32 osx-release32 osx-debug64 osx-release64 ## Build - OSX x86/x64 Debug and Release +osx: osx-debug64 osx-release64 ## Build - OSX x86/x64 Debug and Release .build/projects/gmake-ios-arm: $(GENIE) --gcc=ios-arm gmake @@ -222,6 +180,14 @@ ios-simulator-release: .build/projects/gmake-ios-simulator ## Build - iOS Simula $(MAKE) -R -C .build/projects/gmake-ios-simulator config=release ios-simulator: ios-simulator-debug ios-simulator-release ## Build - iOS Simulator Debug and Release +.build/projects/gmake-ios-simulator64: + $(GENIE) --gcc=ios-simulator64 gmake +ios-simulator64-debug: .build/projects/gmake-ios-simulator64 ## Build - iOS Simulator Debug + $(MAKE) -R -C .build/projects/gmake-ios-simulator64 config=debug +ios-simulator64-release: .build/projects/gmake-ios-simulator64 ## Build - iOS Simulator Release + $(MAKE) -R -C .build/projects/gmake-ios-simulator64 config=release +ios-simulator64: ios-simulator64-debug ios-simulator64-release ## Build - iOS Simulator Debug and Release + .build/projects/gmake-rpi: $(GENIE) --gcc=rpi gmake rpi-debug: .build/projects/gmake-rpi ## Build - RasberryPi Debug diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua index adccbf026d2..ed06cf7e564 100644 --- a/3rdparty/bgfx/scripts/bgfx.lua +++ b/3rdparty/bgfx/scripts/bgfx.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- @@ -76,7 +76,6 @@ function bgfxProjectBase(_kind, _defines) includedirs { path.join(BGFX_DIR, "3rdparty"), - path.join(BGFX_DIR, "3rdparty/dxsdk/include"), path.join(BX_DIR, "include"), path.join(BIMG_DIR, "include"), } @@ -95,39 +94,23 @@ function bgfxProjectBase(_kind, _defines) } end - if _OPTIONS["with-ovr"] then - defines { --- "BGFX_CONFIG_MULTITHREADED=0", - "BGFX_CONFIG_USE_OVR=1", - } - includedirs { - "$(OVR_DIR)/LibOVR/Include", - } - - configuration { "x32" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release", _ACTION) } - - configuration { "x64" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Release", _ACTION) } - - configuration { "x32 or x64" } - links { "libovr" } - - configuration {} - end - configuration { "Debug" } defines { "BGFX_CONFIG_DEBUG=1", } + configuration { "vs* or mingw*", "not durango" } + includedirs { + path.join(BGFX_DIR, "3rdparty/dxsdk/include"), + } + configuration { "android*" } links { "EGL", "GLESv2", } - configuration { "winphone8* or winstore8*" } + configuration { "winstore*" } linkoptions { "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata } @@ -147,11 +130,10 @@ function bgfxProjectBase(_kind, _defines) "-weak_framework MetalKit", } - configuration { "not nacl", "not linux-steamlink", "not NX32", "not NX64" } + configuration { "not linux-steamlink", "not NX32", "not NX64" } includedirs { - --nacl has GLES2 headers modified... - --steamlink has EGL headers modified... - --NX has EGL headers modified... + -- steamlink has EGL headers modified... + -- NX has EGL headers modified... path.join(BGFX_DIR, "3rdparty/khronos"), } @@ -170,6 +152,7 @@ function bgfxProjectBase(_kind, _defines) path.join(BGFX_DIR, "include/**.h"), path.join(BGFX_DIR, "src/**.cpp"), path.join(BGFX_DIR, "src/**.h"), + path.join(BGFX_DIR, "scripts/**.natvis"), } removefiles { @@ -185,9 +168,11 @@ function bgfxProjectBase(_kind, _defines) excludes { path.join(BGFX_DIR, "src/bgfx.cpp"), path.join(BGFX_DIR, "src/debug_**.cpp"), + path.join(BGFX_DIR, "src/dxgi.cpp"), path.join(BGFX_DIR, "src/glcontext_**.cpp"), - path.join(BGFX_DIR, "src/image.cpp"), path.join(BGFX_DIR, "src/hmd**.cpp"), + path.join(BGFX_DIR, "src/image.cpp"), + path.join(BGFX_DIR, "src/nvapi.cpp"), path.join(BGFX_DIR, "src/renderer_**.cpp"), path.join(BGFX_DIR, "src/shader**.cpp"), path.join(BGFX_DIR, "src/topology.cpp"), diff --git a/3rdparty/bgfx/scripts/bgfx.natvis b/3rdparty/bgfx/scripts/bgfx.natvis new file mode 100644 index 00000000000..b82280af29d --- /dev/null +++ b/3rdparty/bgfx/scripts/bgfx.natvis @@ -0,0 +1,129 @@ + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx} }} + + idx + bgfx::s_ctx->m_indexBuffers[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx} }} + + idx + bgfx::s_ctx->m_vertexBuffers[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx} }} + + idx + bgfx::s_ctx->m_dynamicIndexBuffers[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx} }} + + idx + bgfx::s_ctx->m_dynamicVertexBuffers[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx}, name={bgfx::s_ctx->m_uniformRef[idx].m_name} }} + + idx + bgfx::s_ctx->m_uniformRef[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx}, name={bgfx::s_ctx->m_shaderRef[idx].m_name} }} + + idx + bgfx::s_ctx->m_shaderRef[idx] + + + + + + m_uniforms,[m_num] + m_name + m_hash + m_refCount + m_num + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx}, vsh={bgfx::s_ctx->m_programRef[idx].m_vsh}, fsh={bgfx::s_ctx->m_programRef[idx].m_fsh} }} + + idx + bgfx::s_ctx->m_programRef[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx}, name={bgfx::s_ctx->m_textureRef[idx].m_name} }} + + idx + bgfx::s_ctx->m_textureRef[idx] + + + + + + m_name + m_ptr + m_storageSize + m_refCount + m_bbRatio + (bgfx::TextureFormat::Enum)m_format + m_numMips + m_owned + m_immutable + m_rt + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx} }} + + idx + bgfx::s_ctx->m_frameBufferRef[idx] + + + + + {{ idx={idx} (INVALID) }} + {{ idx={idx} }} + + this,! + bgfx::s_ctx->m_declRef[idx] + + + + + + (bgfx::EncoderImpl *)this + + + + + + (DebugDrawEncoderImpl *)this + + + diff --git a/3rdparty/bgfx/scripts/bgfx.pc b/3rdparty/bgfx/scripts/bgfx.pc deleted file mode 100644 index f9cc3a0525f..00000000000 --- a/3rdparty/bgfx/scripts/bgfx.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/usr/local -exec_prefix=${prefix} -includedir=${prefix}/include -libdir=${exec_prefix}/lib - -Cflags: -I${includedir} -Libs: -L${libdir} -lX11 -lGL -pthread -lrt -ldl - -Name: bgfx -Description: Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library. -Version: 1.0.0 diff --git a/3rdparty/bgfx/scripts/build.ninja b/3rdparty/bgfx/scripts/build.ninja index f36701ea387..1cfcac5c497 100644 --- a/3rdparty/bgfx/scripts/build.ninja +++ b/3rdparty/bgfx/scripts/build.ninja @@ -23,6 +23,9 @@ rule texturec_bc4 rule texturec_bc5 command = texturec -f $in -o $out -t bc5 -m +rule texturec_bc7 + command = texturec -f $in -o $out -t bc7 -m + rule texturec_etc1 command = texturec -f $in -o $out -t etc1 -m @@ -38,6 +41,9 @@ rule texturec_normal rule texturec_height command = texturec -f $in -o $out -t r8 +rule texturec_equirect + command = texturec -f $in -o $out --max 512 -t rgba16f --equirect + pwd = ../examples/assets/meshes subninja ../examples/assets/meshes/meshes.ninja diff --git a/3rdparty/bgfx/scripts/example-common.lua b/3rdparty/bgfx/scripts/example-common.lua index 78fe16ed1c3..976675ee746 100644 --- a/3rdparty/bgfx/scripts/example-common.lua +++ b/3rdparty/bgfx/scripts/example-common.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- @@ -30,8 +30,8 @@ project ("example-common") files { path.join(BGFX_DIR, "3rdparty/ib-compress/**.cpp"), path.join(BGFX_DIR, "3rdparty/ib-compress/**.h"), - path.join(BGFX_DIR, "3rdparty/ocornut-imgui/**.cpp"), - path.join(BGFX_DIR, "3rdparty/ocornut-imgui/**.h"), + path.join(BGFX_DIR, "3rdparty/dear-imgui/**.cpp"), + path.join(BGFX_DIR, "3rdparty/dear-imgui/**.h"), path.join(BGFX_DIR, "examples/common/**.cpp"), path.join(BGFX_DIR, "examples/common/**.cpp"), path.join(BGFX_DIR, "examples/common/**.h"), @@ -90,7 +90,7 @@ project ("example-common") path.join(BGFX_DIR, "examples/common/**.mm"), } - configuration { "winphone8* or winstore8* or durango"} + configuration { "winstore* or durango"} files { path.join(BGFX_DIR, "examples/common/**.cx"), } diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua index cacec034e8a..05bc713595a 100644 --- a/3rdparty/bgfx/scripts/genie.lua +++ b/3rdparty/bgfx/scripts/genie.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- @@ -8,11 +8,6 @@ newoption { description = "Enable amalgamated build.", } -newoption { - trigger = "with-ovr", - description = "Enable OculusVR integration.", -} - newoption { trigger = "with-sdl", description = "Enable SDL entry.", @@ -184,19 +179,6 @@ function exampleProjectDefaults() configuration {} end - if _OPTIONS["with-ovr"] then - configuration { "x32" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release", _ACTION) } - - configuration { "x64" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Release", _ACTION) } - - configuration { "x32 or x64" } - links { "libovr" } - - configuration {} - end - configuration { "vs*", "x32 or x64" } linkoptions { "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll @@ -232,7 +214,7 @@ function exampleProjectDefaults() "kernelx", } - configuration { "winphone8* or winstore8*" } + configuration { "winstore*" } removelinks { "DelayImp", "gdi32", @@ -240,6 +222,7 @@ function exampleProjectDefaults() } links { "d3d11", + "d3d12", "dxgi" } linkoptions { @@ -247,15 +230,15 @@ function exampleProjectDefaults() } -- WinRT targets need their own output directories or build files stomp over each other - configuration { "x32", "winphone8* or winstore8*" } + configuration { "x32", "winstore*" } targetdir (path.join(BGFX_BUILD_DIR, "win32_" .. _ACTION, "bin", _name)) objdir (path.join(BGFX_BUILD_DIR, "win32_" .. _ACTION, "obj", _name)) - configuration { "x64", "winphone8* or winstore8*" } + configuration { "x64", "winstore*" } targetdir (path.join(BGFX_BUILD_DIR, "win64_" .. _ACTION, "bin", _name)) objdir (path.join(BGFX_BUILD_DIR, "win64_" .. _ACTION, "obj", _name)) - configuration { "ARM", "winphone8* or winstore8*" } + configuration { "ARM", "winstore*" } targetdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "bin", _name)) objdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "obj", _name)) @@ -273,24 +256,6 @@ function exampleProjectDefaults() "GLESv2", } - configuration { "nacl*" } - kind "ConsoleApp" - targetextension ".nexe" - links { - "ppapi", - "ppapi_gles2", - "pthread", - } - - configuration { "pnacl" } - kind "ConsoleApp" - targetextension ".pexe" - links { - "ppapi", - "ppapi_gles2", - "pthread", - } - configuration { "asmjs" } kind "ConsoleApp" targetextension ".bc" @@ -481,6 +446,8 @@ or _OPTIONS["with-combined-examples"] then , "34-mvs" , "35-dynamic" , "36-sky" + , "37-gpudrivenrendering" + , "38-bloom" ) -- C99 source doesn't compile under WinRT settings diff --git a/3rdparty/bgfx/scripts/geometryc.lua b/3rdparty/bgfx/scripts/geometryc.lua index e4fbd909ee2..566afb155c0 100644 --- a/3rdparty/bgfx/scripts/geometryc.lua +++ b/3rdparty/bgfx/scripts/geometryc.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- diff --git a/3rdparty/bgfx/scripts/shader-embeded.mk b/3rdparty/bgfx/scripts/shader-embeded.mk index ac9d4d69b4d..1d126f88ccc 100644 --- a/3rdparty/bgfx/scripts/shader-embeded.mk +++ b/3rdparty/bgfx/scripts/shader-embeded.mk @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/scripts/shader.mk b/3rdparty/bgfx/scripts/shader.mk index 86cbf79aaa6..e8ca61d33cf 100644 --- a/3rdparty/bgfx/scripts/shader.mk +++ b/3rdparty/bgfx/scripts/shader.mk @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/scripts/shaderc.lua b/3rdparty/bgfx/scripts/shaderc.lua index d61ace02c4a..fd5209d66c8 100644 --- a/3rdparty/bgfx/scripts/shaderc.lua +++ b/3rdparty/bgfx/scripts/shaderc.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- @@ -7,65 +7,144 @@ group "tools/shaderc" local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer") local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp") +local GLSLANG = path.join(BGFX_DIR, "3rdparty/glslang") +local SPIRV_TOOLS = path.join(BGFX_DIR, "3rdparty/spirv-tools") + +project "spirv-opt" + kind "StaticLib" + + includedirs { + path.join(SPIRV_TOOLS, "include"), + path.join(SPIRV_TOOLS, "include/generated"), + path.join(SPIRV_TOOLS, "source"), + path.join(SPIRV_TOOLS), + path.join(SPIRV_TOOLS, "external/SPIRV-Headers/include"), + } + + files { + path.join(SPIRV_TOOLS, "source/opt/**.cpp"), + path.join(SPIRV_TOOLS, "source/opt/**.h"), + + -- libspirv + path.join(SPIRV_TOOLS, "source/assembly_grammar.cpp"), + path.join(SPIRV_TOOLS, "source/assembly_grammar.h"), + path.join(SPIRV_TOOLS, "source/binary.cpp"), + path.join(SPIRV_TOOLS, "source/binary.h"), + path.join(SPIRV_TOOLS, "source/cfa.h"), + path.join(SPIRV_TOOLS, "source/diagnostic.cpp"), + path.join(SPIRV_TOOLS, "source/diagnostic.h"), + path.join(SPIRV_TOOLS, "source/disassemble.cpp"), + path.join(SPIRV_TOOLS, "source/disassemble.h"), + path.join(SPIRV_TOOLS, "source/enum_set.h"), + path.join(SPIRV_TOOLS, "source/enum_string_mapping.cpp"), + path.join(SPIRV_TOOLS, "source/enum_string_mapping.h"), + path.join(SPIRV_TOOLS, "source/ext_inst.cpp"), + path.join(SPIRV_TOOLS, "source/ext_inst.h"), + path.join(SPIRV_TOOLS, "source/extensions.cpp"), + path.join(SPIRV_TOOLS, "source/extensions.h"), + path.join(SPIRV_TOOLS, "source/id_descriptor.cpp"), + path.join(SPIRV_TOOLS, "source/id_descriptor.h"), + path.join(SPIRV_TOOLS, "source/instruction.h"), + path.join(SPIRV_TOOLS, "source/latest_version_glsl_std_450_header.h"), + path.join(SPIRV_TOOLS, "source/latest_version_opencl_std_header.h"), + path.join(SPIRV_TOOLS, "source/latest_version_spirv_header.h"), + path.join(SPIRV_TOOLS, "source/libspirv.cpp"), + path.join(SPIRV_TOOLS, "source/macro.h"), + path.join(SPIRV_TOOLS, "source/name_mapper.cpp"), + path.join(SPIRV_TOOLS, "source/name_mapper.h"), + path.join(SPIRV_TOOLS, "source/opcode.cpp"), + path.join(SPIRV_TOOLS, "source/opcode.h"), + path.join(SPIRV_TOOLS, "source/operand.cpp"), + path.join(SPIRV_TOOLS, "source/operand.h"), + path.join(SPIRV_TOOLS, "source/parsed_operand.cpp"), + path.join(SPIRV_TOOLS, "source/parsed_operand.h"), + path.join(SPIRV_TOOLS, "source/print.cpp"), + path.join(SPIRV_TOOLS, "source/print.h"), + path.join(SPIRV_TOOLS, "source/software_version.cpp"), + path.join(SPIRV_TOOLS, "source/spirv_constant.h"), + path.join(SPIRV_TOOLS, "source/spirv_definition.h"), + path.join(SPIRV_TOOLS, "source/spirv_endian.cpp"), + path.join(SPIRV_TOOLS, "source/spirv_endian.h"), + path.join(SPIRV_TOOLS, "source/spirv_target_env.cpp"), + path.join(SPIRV_TOOLS, "source/spirv_target_env.h"), + path.join(SPIRV_TOOLS, "source/spirv_validator_options.cpp"), + path.join(SPIRV_TOOLS, "source/spirv_validator_options.h"), + path.join(SPIRV_TOOLS, "source/table.cpp"), + path.join(SPIRV_TOOLS, "source/table.h"), + path.join(SPIRV_TOOLS, "source/text.cpp"), + path.join(SPIRV_TOOLS, "source/text.h"), + path.join(SPIRV_TOOLS, "source/text_handler.cpp"), + path.join(SPIRV_TOOLS, "source/text_handler.h"), + path.join(SPIRV_TOOLS, "source/util/bit_vector.cpp"), + path.join(SPIRV_TOOLS, "source/util/bit_vector.h"), + path.join(SPIRV_TOOLS, "source/util/bitutils.h"), + path.join(SPIRV_TOOLS, "source/util/hex_float.h"), + path.join(SPIRV_TOOLS, "source/util/parse_number.cpp"), + path.join(SPIRV_TOOLS, "source/util/parse_number.h"), + path.join(SPIRV_TOOLS, "source/util/string_utils.cpp"), + path.join(SPIRV_TOOLS, "source/util/string_utils.h"), + path.join(SPIRV_TOOLS, "source/util/timer.h"), + path.join(SPIRV_TOOLS, "source/val/basic_block.cpp"), + path.join(SPIRV_TOOLS, "source/val/construct.cpp"), + path.join(SPIRV_TOOLS, "source/val/decoration.h"), + path.join(SPIRV_TOOLS, "source/val/function.cpp"), + path.join(SPIRV_TOOLS, "source/val/instruction.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_adjacency.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_annotation.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_arithmetics.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_atomics.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_barriers.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_bitwise.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_builtins.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_capability.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_cfg.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_composites.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_constants.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_conversion.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_datarules.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_debug.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_decorations.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_derivatives.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_execution_limitations.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_ext_inst.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_function.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_id.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_image.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_interfaces.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_instruction.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_layout.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_literals.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_logicals.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_memory.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_mode_setting.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_non_uniform.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_primitives.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate_type.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate.cpp"), + path.join(SPIRV_TOOLS, "source/val/validate.h"), + path.join(SPIRV_TOOLS, "source/val/validation_state.cpp"), + } + + configuration { "vs*" } + buildoptions { + "/wd4127", -- warning C4127: conditional expression is constant + "/wd4389", -- warning C4389: '==': signed/unsigned mismatch + "/wd4702", -- warning C4702: unreachable code + "/wd4706", -- warning C4706: assignment within conditional expression + } project "glslang" kind "StaticLib" - local GLSLANG = path.join(BGFX_DIR, "3rdparty/glslang") - - configuration { "vs2012" } - defines { - "atoll=_atoi64", - "strtoll=_strtoi64", - "strtoull=_strtoui64", - } - - configuration { "vs*" } - buildoptions { - "/wd4005", -- warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition - "/wd4100", -- error C4100: 'inclusionDepth' : unreferenced formal parameter - "/wd4127", -- warning C4127: conditional expression is constant - "/wd4244", -- warning C4244: '=': conversion from 'int' to 'char', possible loss of data - "/wd4456", -- warning C4456: declaration of 'feature' hides previous local declaration - "/wd4457", -- warning C4457: declaration of 'token' hides function parameter - "/wd4458", -- warning C4458: declaration of 'language' hides class member - "/wd4702", -- warning C4702: unreachable code - } - - configuration { "not vs*" } - buildoptions { - "-Wno-deprecated-register", - "-Wno-ignored-qualifiers", - "-Wno-inconsistent-missing-override", - "-Wno-missing-field-initializers", - "-Wno-reorder", - "-Wno-return-type", - "-Wno-shadow", - "-Wno-sign-compare", - "-Wno-undef", - "-Wno-unknown-pragmas", - "-Wno-unused-parameter", - "-Wno-unused-variable", - } - - configuration { "osx" } - buildoptions { - "-Wno-c++11-extensions", - "-Wno-unused-const-variable", - } - - configuration { "linux-*" } - buildoptions { - "-Wno-unused-but-set-variable", - } - - configuration {} - defines { - "ENABLE_HLSL=1", - } + defines { + "ENABLE_OPT=1", -- spirv-tools + "ENABLE_HLSL=1", + } includedirs { GLSLANG, + path.join(SPIRV_TOOLS, "include"), + path.join(SPIRV_TOOLS, "source"), } files { @@ -99,6 +178,58 @@ project "glslang" path.join(GLSLANG, "glslang/OSDependent/Windows/**.h"), } + configuration { "vs*" } + buildoptions { + "/wd4005", -- warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition + "/wd4065", -- warning C4065: switch statement contains 'default' but no 'case' labels + "/wd4100", -- warning C4100: 'inclusionDepth' : unreferenced formal parameter + "/wd4127", -- warning C4127: conditional expression is constant + "/wd4189", -- warning C4189: 'isFloat': local variable is initialized but not referenced + "/wd4244", -- warning C4244: '=': conversion from 'int' to 'char', possible loss of data + "/wd4310", -- warning C4310: cast truncates constant value + "/wd4389", -- warning C4389: '==': signed/unsigned mismatch + "/wd4456", -- warning C4456: declaration of 'feature' hides previous local declaration + "/wd4457", -- warning C4457: declaration of 'token' hides function parameter + "/wd4458", -- warning C4458: declaration of 'language' hides class member + "/wd4702", -- warning C4702: unreachable code + "/wd4715", -- warning C4715: 'spv::Builder::makeFpConstant': not all control paths return a value + "/wd4838", -- warning C4838: conversion from 'spv::GroupOperation' to 'unsigned int' requires a narrowing conversion + } + + configuration { "mingw* or linux or osx" } + buildoptions { + "-Wno-ignored-qualifiers", + "-Wno-implicit-fallthrough", + "-Wno-missing-field-initializers", + "-Wno-reorder", + "-Wno-return-type", + "-Wno-shadow", + "-Wno-sign-compare", + "-Wno-switch", + "-Wno-undef", + "-Wno-unknown-pragmas", + "-Wno-unused-function", + "-Wno-unused-parameter", + "-Wno-unused-variable", + } + + configuration { "osx" } + buildoptions { + "-Wno-c++11-extensions", + "-Wno-unused-const-variable", + "-Wno-deprecated-register", + } + + configuration { "linux-gcc-*" } + buildoptions { + "-Wno-unused-but-set-variable", + } + + configuration { "mingw* or linux or osx" } + buildoptions { + "-fno-strict-aliasing", -- glslang has bugs if strict aliasing is used. + } + configuration {} project "glsl-optimizer" @@ -168,12 +299,16 @@ project "glsl-optimizer" "/wd4701", -- warning C4701: potentially uninitialized local variable 'lower' used "/wd4702", -- warning C4702: unreachable code "/wd4706", -- warning C4706: assignment within conditional expression - "/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. + "/wd4996", -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. } configuration { "mingw* or linux or osx" } buildoptions { "-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used. + + "-Wno-implicit-fallthrough", + "-Wno-sign-compare", + "-Wno-unused-function", "-Wno-unused-parameter", } @@ -181,6 +316,16 @@ project "glsl-optimizer" "-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it. } + configuration { "osx" } + buildoptions { + "-Wno-deprecated-register", + } + + configuration { "mingw* or linux-gcc-*" } + buildoptions { + "-Wno-misleading-indentation", + } + configuration {} project "fcpp" @@ -191,6 +336,7 @@ project "fcpp" "NWORK=65536", "NBUFF=65536", "OLD_PREPROCESSOR=0", +-- "MSG_PREFIX=\"Preprocessor: \"", } files { @@ -216,6 +362,7 @@ project "fcpp" configuration { "not vs*" } buildoptions { "-Wno-implicit-fallthrough", + "-Wno-parentheses-equality", } configuration {} @@ -244,6 +391,7 @@ project "shaderc" "fcpp", "glslang", "glsl-optimizer", + "spirv-opt", } files { diff --git a/3rdparty/bgfx/scripts/texturec.lua b/3rdparty/bgfx/scripts/texturec.lua index e229293e3e2..c1c0e7da12f 100644 --- a/3rdparty/bgfx/scripts/texturec.lua +++ b/3rdparty/bgfx/scripts/texturec.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- diff --git a/3rdparty/bgfx/scripts/texturev.lua b/3rdparty/bgfx/scripts/texturev.lua index 4443391a27d..8d17034c664 100644 --- a/3rdparty/bgfx/scripts/texturev.lua +++ b/3rdparty/bgfx/scripts/texturev.lua @@ -41,9 +41,7 @@ project ("texturev") if _OPTIONS["with-glfw"] then defines { "ENTRY_CONFIG_USE_GLFW=1" } - links { - "glfw3" - } + links { "glfw3" } configuration { "linux or freebsd" } links { @@ -63,52 +61,6 @@ project ("texturev") configuration {} end - if _OPTIONS["with-ovr"] then - links { - "winmm", - "ws2_32", - } - - -- Check for LibOVR 5.0+ - if os.isdir(path.join(os.getenv("OVR_DIR"), "LibOVR/Lib/Windows/Win32/Debug/VS2012")) then - - configuration { "x32", "Debug" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Debug", _ACTION) } - - configuration { "x32", "Release" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release", _ACTION) } - - configuration { "x64", "Debug" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Debug", _ACTION) } - - configuration { "x64", "Release" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Release", _ACTION) } - - configuration { "x32 or x64" } - links { "libovr" } - else - configuration { "x32" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Win32", _ACTION) } - - configuration { "x64" } - libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/x64", _ACTION) } - - configuration { "x32", "Debug" } - links { "libovrd" } - - configuration { "x32", "Release" } - links { "libovr" } - - configuration { "x64", "Debug" } - links { "libovr64d" } - - configuration { "x64", "Release" } - links { "libovr64" } - end - - configuration {} - end - configuration { "vs*" } linkoptions { "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll @@ -132,7 +84,7 @@ project ("texturev") "psapi", } - configuration { "winphone8*"} + configuration { "winstore*" } removelinks { "DelayImp", "gdi32", @@ -140,6 +92,7 @@ project ("texturev") } links { "d3d11", + "d3d12", "dxgi" } linkoptions { diff --git a/3rdparty/bgfx/scripts/tools.mk b/3rdparty/bgfx/scripts/tools.mk index 0cda8ba7c46..2b034bcca30 100644 --- a/3rdparty/bgfx/scripts/tools.mk +++ b/3rdparty/bgfx/scripts/tools.mk @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/src/amalgamated.cpp b/3rdparty/bgfx/src/amalgamated.cpp index 3a940d0b176..6e6ebec7c85 100644 --- a/3rdparty/bgfx/src/amalgamated.cpp +++ b/3rdparty/bgfx/src/amalgamated.cpp @@ -1,16 +1,14 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #include "bgfx.cpp" #include "debug_renderdoc.cpp" +#include "dxgi.cpp" #include "glcontext_egl.cpp" #include "glcontext_glx.cpp" #include "glcontext_wgl.cpp" -#include "hmd.cpp" -#include "hmd_ovr.cpp" -#include "hmd_openvr.cpp" #include "nvapi.cpp" #include "renderer_d3d9.cpp" #include "renderer_d3d11.cpp" diff --git a/3rdparty/bgfx/src/amalgamated.mm b/3rdparty/bgfx/src/amalgamated.mm index 7d3cb5b8dae..8d1ce6416ac 100644 --- a/3rdparty/bgfx/src/amalgamated.mm +++ b/3rdparty/bgfx/src/amalgamated.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index 64970cb7e32..5b58c5f55f0 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -19,19 +19,19 @@ namespace bgfx #define BGFX_API_THREAD_MAGIC UINT32_C(0x78666762) #if BGFX_CONFIG_MULTITHREADED -# define BGFX_CHECK_API_THREAD() \ - BX_CHECK(NULL != s_ctx, "Library is not initialized yet."); \ - BX_CHECK(BGFX_API_THREAD_MAGIC == s_threadIndex, "Must be called from main thread.") -# define BGFX_CHECK_RENDER_THREAD() BX_CHECK(BGFX_API_THREAD_MAGIC != s_threadIndex, "Must be called from render thread.") +# define BGFX_CHECK_API_THREAD() \ + BX_CHECK(NULL != s_ctx, "Library is not initialized yet."); \ + BX_CHECK(BGFX_API_THREAD_MAGIC == s_threadIndex, "Must be called from main thread.") +# define BGFX_CHECK_RENDER_THREAD() BX_CHECK(~BGFX_API_THREAD_MAGIC == s_threadIndex, "Must be called from render thread.") #else # define BGFX_CHECK_API_THREAD() # define BGFX_CHECK_RENDER_THREAD() #endif // BGFX_CONFIG_MULTITHREADED -#define BGFX_CHECK_CAPS(_caps, _msg) \ - BX_CHECK(0 != (g_caps.supported & (_caps) ) \ - , _msg " Use bgfx::getCaps to check " #_caps " backend renderer capabilities." \ - ); +#define BGFX_CHECK_CAPS(_caps, _msg) \ + BX_CHECK(0 != (g_caps.supported & (_caps) ) \ + , _msg " Use bgfx::getCaps to check " #_caps " backend renderer capabilities." \ + ); #if BGFX_CONFIG_USE_TINYSTL void* TinyStlAllocator::static_allocate(size_t _bytes) @@ -54,7 +54,7 @@ namespace bgfx { } - virtual void fatal(Fatal::Enum _code, const char* _str) override + virtual void fatal(const char* _filePath, uint16_t _line, Fatal::Enum _code, const char* _str) override { if (Fatal::DebugCheck == _code) { @@ -62,7 +62,7 @@ namespace bgfx } else { - BX_TRACE("0x%08x: %s", _code, _str); + bgfx::trace(_filePath, _line, "BGFX 0x%08x: %s\n", _code, _str); BX_UNUSED(_code, _str); abort(); } @@ -195,7 +195,7 @@ namespace bgfx { bx::MutexScope scope(m_mutex); ++m_numBlocks; - m_maxBlocks = bx::uint32_max(m_maxBlocks, m_numBlocks); + m_maxBlocks = bx::max(m_maxBlocks, m_numBlocks); } #endif // BGFX_CONFIG_MEMORY_TRACKING @@ -212,7 +212,7 @@ namespace bgfx { bx::MutexScope scope(m_mutex); ++m_numBlocks; - m_maxBlocks = bx::uint32_max(m_maxBlocks, m_numBlocks); + m_maxBlocks = bx::max(m_maxBlocks, m_numBlocks); } #endif // BGFX_CONFIG_MEMORY_TRACKING @@ -362,7 +362,7 @@ namespace bgfx tc.m_height = _height; tc.m_depth = 0; tc.m_numLayers = 1; - tc.m_numMips = uint8_t(bx::uint16_max(1, _numMips) ); + tc.m_numMips = bx::max(1, _numMips); tc.m_format = _format; tc.m_cubeMap = false; tc.m_mem = NULL; @@ -387,29 +387,29 @@ namespace bgfx return s_graphicsDebuggerPresent; } - void fatal(Fatal::Enum _code, const char* _format, ...) + void fatal(const char* _filePath, uint16_t _line, Fatal::Enum _code, const char* _format, ...) { va_list argList; va_start(argList, _format); + char temp[8192]; + char* out = temp; + int32_t len = bx::vsnprintf(out, sizeof(temp), _format, argList); + if ( (int32_t)sizeof(temp) < len) + { + out = (char*)alloca(len+1); + len = bx::vsnprintf(out, len, _format, argList); + } + out[len] = '\0'; + if (BX_UNLIKELY(NULL == g_callback) ) { - bx::debugPrintfVargs(_format, argList); + bx::debugPrintf("%s(%d): BGFX 0x%08x: %s", _filePath, _line, _code, out); abort(); } else { - char temp[8192]; - char* out = temp; - int32_t len = bx::vsnprintf(out, sizeof(temp), _format, argList); - if ( (int32_t)sizeof(temp) < len) - { - out = (char*)alloca(len+1); - len = bx::vsnprintf(out, len, _format, argList); - } - out[len] = '\0'; - - g_callback->fatal(_code, out); + g_callback->fatal(_filePath, _line, _code, out); } va_end(argList); @@ -488,6 +488,40 @@ namespace bgfx return handle; } + void dump(const VertexDecl& _decl) + { + if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) + { + BX_TRACE("vertexdecl %08x (%08x), stride %d" + , _decl.m_hash + , bx::hash(_decl.m_attributes) + , _decl.m_stride + ); + + for (uint32_t attr = 0; attr < Attrib::Count; ++attr) + { + if (UINT16_MAX != _decl.m_attributes[attr]) + { + uint8_t num; + AttribType::Enum type; + bool normalized; + bool asInt; + _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt); + + BX_TRACE("\tattr %d - %s, num %d, type %d, norm %d, asint %d, offset %d" + , attr + , getAttribName(Attrib::Enum(attr) ) + , num + , type + , normalized + , asInt + , _decl.m_offset[attr] + ); + } + } + } + } + #include "charset.h" void charsetFillTexture(const uint8_t* _charset, uint8_t* _rgba, uint32_t _height, uint32_t _pitch, uint32_t _bpp) @@ -510,18 +544,20 @@ namespace bgfx static uint8_t parseAttrTo(char*& _ptr, char _to, uint8_t _default) { - const char* str = bx::strFind(_ptr, _to); - if (NULL != str - && 3 > str-_ptr) + const bx::StringView str = bx::strFind(_ptr, _to); + if (!str.isEmpty() + && 3 > str.getPtr()-_ptr) { char tmp[4]; - int32_t len = int32_t(str-_ptr); + int32_t len = int32_t(str.getPtr()-_ptr); bx::strCopy(tmp, sizeof(tmp), _ptr, len); - uint8_t attr = uint8_t(atoi(tmp) ); + uint32_t attr; + bx::fromString(&attr, tmp); + _ptr += len+1; - return attr; + return uint8_t(attr); } return _default; @@ -561,7 +597,7 @@ namespace bgfx num = bx::vsnprintf(temp, num, _format, argListCopy); uint8_t attr = _attr; - uint8_t* mem = &m_mem[(_y*m_width+_x)*2]; + MemSlot* mem = &m_mem[_y*m_width+_x]; for (uint32_t ii = 0, xx = _x; ii < num && xx < m_width; ++ii) { char ch = temp[ii]; @@ -573,9 +609,9 @@ namespace bgfx } else { - mem[0] = ch; - mem[1] = attr; - mem += 2; + mem->character = ch; + mem->attribute = attr; + ++mem; ++xx; } } @@ -609,11 +645,11 @@ namespace bgfx charsetFillTexture(vga8x8, rgba, 8, pitch, bpp); charsetFillTexture(vga8x16, &rgba[8*pitch], 16, pitch, bpp); m_texture = createTexture2D(width, height, false, 1, TextureFormat::R8 - , BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP + , BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP , mem ); @@ -653,25 +689,26 @@ namespace bgfx float m_v; }; - static uint32_t palette[16] = + static uint32_t palette[] = { - 0x0, - 0xff0000cc, - 0xff069a4e, - 0xff00a0c4, - 0xffa46534, - 0xff7b5075, - 0xff9a9806, - 0xffcfd7d3, - 0xff535755, - 0xff2929ef, - 0xff34e28a, - 0xff4fe9fc, - 0xffcf9f72, - 0xffa87fad, - 0xffe2e234, - 0xffeceeee, + 0x0, // Black + 0xffa46534, // Blue + 0xff069a4e, // Green + 0xff9a9806, // Cyan + 0xff0000cc, // Red + 0xff7b5075, // Magenta + 0xff00a0c4, // Brown + 0xffcfd7d3, // Light Gray + 0xff535755, // Dark Gray + 0xffcf9f72, // Light Blue + 0xff34e28a, // Light Green + 0xffe2e234, // Light Cyan + 0xff2929ef, // Light Red + 0xffa87fad, // Light Magenta + 0xff4fe9fc, // Yellow + 0xffeceeee, // White }; + BX_STATIC_ASSERT(BX_COUNTOF(palette) == 16); uint32_t yy = 0; uint32_t xx = 0; @@ -696,12 +733,14 @@ namespace bgfx for (; yy < _mem.m_height && numIndices < numBatchIndices; ++yy) { xx = xx < _mem.m_width ? xx : 0; - const uint8_t* line = &_mem.m_mem[(yy*_mem.m_width+xx)*2]; + const TextVideoMem::MemSlot* line = &_mem.m_mem[yy*_mem.m_width+xx]; for (; xx < _mem.m_width && numIndices < numBatchIndices; ++xx) { - uint8_t ch = line[0]; - uint8_t attr = line[1]; + uint32_t ch = line->character; + uint8_t attr = line->attribute; + if (ch > 0xff) + ch = 0; // todo: render unicode code point , ch > 255) if (0 != (ch|attr) && (' ' != ch || 0 != (attr&0xf0) ) ) @@ -733,7 +772,7 @@ namespace bgfx numIndices += 6; } - line += 2; + line ++; } if (numIndices >= numBatchIndices) @@ -859,7 +898,226 @@ namespace bgfx return PredefinedUniform::Count; } - void EncoderImpl::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void srtToMatrix4_x1(void* _dst, const void* _src) + { + Matrix4* mtx = reinterpret_cast< Matrix4*>(_dst); + const Srt* srt = reinterpret_cast(_src); + + const float rx = srt->rotate[0]; + const float ry = srt->rotate[1]; + const float rz = srt->rotate[2]; + const float rw = srt->rotate[3]; + + const float xx2 = 2.0f * rx * rx; + const float yy2 = 2.0f * ry * ry; + const float zz2 = 2.0f * rz * rz; + const float yx2 = 2.0f * ry * rx; + const float yz2 = 2.0f * ry * rz; + const float yw2 = 2.0f * ry * rw; + const float wz2 = 2.0f * rw * rz; + const float wx2 = 2.0f * rw * rx; + const float xz2 = 2.0f * rx * rz; + + const float sx = srt->scale[0]; + const float sy = srt->scale[1]; + const float sz = srt->scale[2]; + + mtx->un.val[ 0] = (1.0f - yy2 - zz2)*sx; + mtx->un.val[ 1] = ( yx2 + wz2)*sx; + mtx->un.val[ 2] = ( xz2 - yw2)*sx; + mtx->un.val[ 3] = 0.0f; + + mtx->un.val[ 4] = ( yx2 - wz2)*sy; + mtx->un.val[ 5] = (1.0f - xx2 - zz2)*sy; + mtx->un.val[ 6] = ( yz2 + wx2)*sy; + mtx->un.val[ 7] = 0.0f; + + mtx->un.val[ 8] = ( xz2 + yw2)*sz; + mtx->un.val[ 9] = ( yz2 - wx2)*sz; + mtx->un.val[10] = (1.0f - xx2 - yy2)*sz; + mtx->un.val[11] = 0.0f; + + const float tx = srt->translate[0]; + const float ty = srt->translate[1]; + const float tz = srt->translate[2]; + + mtx->un.val[12] = tx; + mtx->un.val[13] = ty; + mtx->un.val[14] = tz; + mtx->un.val[15] = 1.0f; + } + + void transpose(void* _dst, uint32_t _dstStride, const void* _src, uint32_t _srcStride = sizeof(bx::simd128_t) ) + { + uint8_t* dst = reinterpret_cast< uint8_t *>(_dst); + const uint8_t* src = reinterpret_cast(_src); + + using namespace bx; + + const simd128_t r0 = simd_ld(src); + src += _srcStride; + + const simd128_t r1 = simd_ld(src); + src += _srcStride; + + const simd128_t r2 = simd_ld(src); + src += _srcStride; + + const simd128_t r3 = simd_ld(src); + + const simd128_t aibj = simd_shuf_xAyB(r0, r2); // aibj + const simd128_t emfn = simd_shuf_xAyB(r1, r3); // emfn + const simd128_t ckdl = simd_shuf_zCwD(r0, r2); // ckdl + const simd128_t gohp = simd_shuf_zCwD(r1, r3); // gohp + const simd128_t aeim = simd_shuf_xAyB(aibj, emfn); // aeim + const simd128_t bfjn = simd_shuf_zCwD(aibj, emfn); // bfjn + const simd128_t cgko = simd_shuf_xAyB(ckdl, gohp); // cgko + const simd128_t dhlp = simd_shuf_zCwD(ckdl, gohp); // dhlp + + simd_st(dst, aeim); + dst += _dstStride; + + simd_st(dst, bfjn); + dst += _dstStride; + + simd_st(dst, cgko); + dst += _dstStride; + + simd_st(dst, dhlp); + } + + void srtToMatrix4_x4_Ref(void* _dst, const void* _src) + { + uint8_t* dst = reinterpret_cast< uint8_t*>(_dst); + const uint8_t* src = reinterpret_cast(_src); + + srtToMatrix4_x1(dst + 0*sizeof(Matrix4), src + 0*sizeof(Srt) ); + srtToMatrix4_x1(dst + 1*sizeof(Matrix4), src + 1*sizeof(Srt) ); + srtToMatrix4_x1(dst + 2*sizeof(Matrix4), src + 2*sizeof(Srt) ); + srtToMatrix4_x1(dst + 3*sizeof(Matrix4), src + 3*sizeof(Srt) ); + } + + void srtToMatrix4_x4_Simd(void* _dst, const void* _src) + { + using namespace bx; + + simd128_t* dst = reinterpret_cast< simd128_t*>(_dst); + const simd128_t* src = reinterpret_cast(_src); + + simd128_t rotate[4]; + simd128_t translate[4]; + simd128_t scale[4]; + + transpose(rotate, sizeof(simd128_t), src + 0, sizeof(Srt) ); + transpose(translate, sizeof(simd128_t), src + 1, sizeof(Srt) ); + transpose(scale, sizeof(simd128_t), src + 2, sizeof(Srt) ); + + const simd128_t rx = simd_ld(rotate + 0); + const simd128_t ry = simd_ld(rotate + 1); + const simd128_t rz = simd_ld(rotate + 2); + const simd128_t rw = simd_ld(rotate + 3); + + const simd128_t tx = simd_ld(translate + 0); + const simd128_t ty = simd_ld(translate + 1); + const simd128_t tz = simd_ld(translate + 2); + + const simd128_t sx = simd_ld(scale + 0); + const simd128_t sy = simd_ld(scale + 1); + const simd128_t sz = simd_ld(scale + 2); + + const simd128_t zero = simd_splat(0.0f); + const simd128_t one = simd_splat(1.0f); + const simd128_t two = simd_splat(2.0f); + + const simd128_t xx = simd_mul(rx, rx); + const simd128_t xx2 = simd_mul(two, xx); + const simd128_t yy = simd_mul(ry, ry); + const simd128_t yy2 = simd_mul(two, yy); + const simd128_t zz = simd_mul(rz, rz); + const simd128_t zz2 = simd_mul(two, zz); + const simd128_t yx = simd_mul(ry, rx); + const simd128_t yx2 = simd_mul(two, yx); + const simd128_t yz = simd_mul(ry, rz); + const simd128_t yz2 = simd_mul(two, yz); + const simd128_t yw = simd_mul(ry, rw); + const simd128_t yw2 = simd_mul(two, yw); + const simd128_t wz = simd_mul(rw, rz); + const simd128_t wz2 = simd_mul(two, wz); + const simd128_t wx = simd_mul(rw, rx); + const simd128_t wx2 = simd_mul(two, wx); + const simd128_t xz = simd_mul(rx, rz); + const simd128_t xz2 = simd_mul(two, xz); + const simd128_t t0x = simd_sub(one, yy2); + const simd128_t r0x = simd_sub(t0x, zz2); + const simd128_t r0y = simd_add(yx2, wz2); + const simd128_t r0z = simd_sub(xz2, yw2); + const simd128_t r1x = simd_sub(yx2, wz2); + const simd128_t omxx2 = simd_sub(one, xx2); + const simd128_t r1y = simd_sub(omxx2, zz2); + const simd128_t r1z = simd_add(yz2, wx2); + const simd128_t r2x = simd_add(xz2, yw2); + const simd128_t r2y = simd_sub(yz2, wx2); + const simd128_t r2z = simd_sub(omxx2, yy2); + + simd128_t tmp[4]; + tmp[0] = simd_mul(r0x, sx); + tmp[1] = simd_mul(r0y, sx); + tmp[2] = simd_mul(r0z, sx); + tmp[3] = zero; + transpose(dst + 0, sizeof(Matrix4), tmp); + + tmp[0] = simd_mul(r1x, sy); + tmp[1] = simd_mul(r1y, sy); + tmp[2] = simd_mul(r1z, sy); + tmp[3] = zero; + transpose(dst + 1, sizeof(Matrix4), tmp); + + tmp[0] = simd_mul(r2x, sz); + tmp[1] = simd_mul(r2y, sz); + tmp[2] = simd_mul(r2z, sz); + tmp[3] = zero; + transpose(dst + 2, sizeof(Matrix4), tmp); + + tmp[0] = tx; + tmp[1] = ty; + tmp[2] = tz; + tmp[3] = one; + transpose(dst + 3, sizeof(Matrix4), tmp); + } + + void srtToMatrix4(void* _dst, const void* _src, uint32_t _num) + { + uint8_t* dst = reinterpret_cast< uint8_t*>(_dst); + const uint8_t* src = reinterpret_cast(_src); + + if (!bx::isAligned(src, 16) ) + { + for (uint32_t ii = 0, num = _num / 4; ii < num; ++ii) + { + srtToMatrix4_x4_Ref(dst, src); + src += 4*sizeof(Srt); + dst += 4*sizeof(Matrix4); + } + } + else + { + for (uint32_t ii = 0, num = _num / 4; ii < num; ++ii) + { + srtToMatrix4_x4_Simd(dst, src); + src += 4*sizeof(Srt); + dst += 4*sizeof(Matrix4); + } + } + + for (uint32_t ii = 0, num = _num & 3; ii < num; ++ii) + { + srtToMatrix4_x1(dst, src); + src += sizeof(Srt); + dst += sizeof(Matrix4); + } + } + + void EncoderImpl::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState) { if (BX_ENABLED(BGFX_CONFIG_DEBUG_UNIFORM) && !_preserveState) @@ -915,8 +1173,8 @@ namespace bgfx switch (s_ctx->m_view[_id].m_mode) { case ViewMode::Sequential: m_key.m_seq = s_ctx->getSeqIncr(_id); type = SortKey::SortSequence; break; - case ViewMode::DepthAscending: m_key.m_depth = (uint32_t)_depth; type = SortKey::SortDepth; break; - case ViewMode::DepthDescending: m_key.m_depth = (uint32_t)-_depth; type = SortKey::SortDepth; break; + case ViewMode::DepthAscending: m_key.m_depth = _depth; type = SortKey::SortDepth; break; + case ViewMode::DepthDescending: m_key.m_depth = UINT32_MAX-_depth; type = SortKey::SortDepth; break; default: break; } @@ -929,17 +1187,25 @@ namespace bgfx m_draw.m_uniformBegin = m_uniformBegin; m_draw.m_uniformEnd = m_uniformEnd; - uint32_t numVertices = UINT32_MAX; - for (uint32_t idx = 0, streamMask = m_draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) - ) + if (UINT8_MAX != m_draw.m_streamMask) { - streamMask >>= ntz; - idx += ntz; - numVertices = bx::uint32_min(numVertices, m_numVertices[idx]); + uint32_t numVertices = UINT32_MAX; + for (uint32_t idx = 0, streamMask = m_draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) + ) + { + streamMask >>= ntz; + idx += ntz; + numVertices = bx::min(numVertices, m_numVertices[idx]); + } + + m_draw.m_numVertices = numVertices; + } + else + { + m_draw.m_numVertices = m_numVertices[0]; } - m_draw.m_numVertices = numVertices; if (isValid(_occlusionQuery) ) { @@ -986,9 +1252,9 @@ namespace bgfx m_compute.m_startMatrix = m_draw.m_startMatrix; m_compute.m_numMatrices = m_draw.m_numMatrices; - m_compute.m_numX = bx::uint32_max(_numX, 1); - m_compute.m_numY = bx::uint32_max(_numY, 1); - m_compute.m_numZ = bx::uint32_max(_numZ, 1); + m_compute.m_numX = bx::max(_numX, 1u); + m_compute.m_numY = bx::max(_numY, 1u); + m_compute.m_numZ = bx::max(_numZ, 1u); m_compute.m_submitFlags = _flags; m_key.m_program = _handle.idx; @@ -1070,6 +1336,11 @@ namespace bgfx { if (BX_ENABLED(BGFX_CONFIG_MULTITHREADED) ) { + if (s_renderFrameCalled) + { + BGFX_CHECK_RENDER_THREAD(); + } + if (NULL == s_ctx) { s_renderFrameCalled = true; @@ -1077,7 +1348,6 @@ namespace bgfx return RenderFrame::NoContext; } - BGFX_CHECK_RENDER_THREAD(); int32_t msecs = -1 == _msecs ? BGFX_CONFIG_API_SEMAPHORE_TIMEOUT : _msecs @@ -1147,8 +1417,8 @@ namespace bgfx CAPS_FLAGS(BGFX_CAPS_FRAGMENT_DEPTH), CAPS_FLAGS(BGFX_CAPS_FRAGMENT_ORDERING), CAPS_FLAGS(BGFX_CAPS_GRAPHICS_DEBUGGER), + CAPS_FLAGS(BGFX_CAPS_HDR10), CAPS_FLAGS(BGFX_CAPS_HIDPI), - CAPS_FLAGS(BGFX_CAPS_HMD), CAPS_FLAGS(BGFX_CAPS_INDEX32), CAPS_FLAGS(BGFX_CAPS_INSTANCING), CAPS_FLAGS(BGFX_CAPS_OCCLUSION_QUERY), @@ -1160,9 +1430,11 @@ namespace bgfx CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_ALL), CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_LEQUAL), CAPS_FLAGS(BGFX_CAPS_TEXTURE_CUBE_ARRAY), + CAPS_FLAGS(BGFX_CAPS_TEXTURE_DIRECT_ACCESS), CAPS_FLAGS(BGFX_CAPS_TEXTURE_READ_BACK), CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_HALF), CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_UINT10), + CAPS_FLAGS(BGFX_CAPS_VERTEX_ID), #undef CAPS_FLAGS }; @@ -1247,6 +1519,7 @@ namespace bgfx LIMITS(maxDrawCalls); LIMITS(maxBlits); LIMITS(maxTextureSize); + LIMITS(maxTextureLayers); LIMITS(maxViews); LIMITS(maxFrameBuffers); LIMITS(maxFBAttachments); @@ -1254,6 +1527,7 @@ namespace bgfx LIMITS(maxShaders); LIMITS(maxTextures); LIMITS(maxTextureSamplers); + LIMITS(maxComputeBindings); LIMITS(maxVertexDecls); LIMITS(maxVertexStreams); LIMITS(maxIndexBuffers); @@ -1263,6 +1537,8 @@ namespace bgfx LIMITS(maxUniforms); LIMITS(maxOcclusionQueries); LIMITS(maxEncoders); + LIMITS(transientVbSize); + LIMITS(transientIbSize); #undef LIMITS BX_TRACE(""); @@ -1356,6 +1632,41 @@ namespace bgfx return s_ctx->m_uniformRef[_handle.idx].m_name.getPtr(); } + static const char* s_topologyName[] = + { + "Triangles", + "TriStrip", + "Lines", + "LineStrip", + "Points", + }; + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_topologyName) ); + + const char* getName(Topology::Enum _topology) + { + return s_topologyName[bx::min(_topology, Topology::PointList)]; + } + + const char* getShaderTypeName(uint32_t _magic) + { + if (isShaderType(_magic, 'C') ) + { + return "Compute"; + } + else if (isShaderType(_magic, 'F') ) + { + return "Fragment"; + } + else if (isShaderType(_magic, 'V') ) + { + return "Vertex"; + } + + BX_CHECK(false, "Invalid shader type!"); + + return NULL; + } + static TextureFormat::Enum s_emulatedFormats[] = { TextureFormat::BC1, @@ -1373,14 +1684,39 @@ namespace bgfx TextureFormat::PTC14A, TextureFormat::PTC22, TextureFormat::PTC24, + TextureFormat::ATC, + TextureFormat::ATCE, + TextureFormat::ATCI, + TextureFormat::ASTC4x4, + TextureFormat::ASTC5x5, + TextureFormat::ASTC6x6, + TextureFormat::ASTC8x5, + TextureFormat::ASTC8x6, + TextureFormat::ASTC10x5, TextureFormat::BGRA8, // GL doesn't support BGRA8 without extensions. TextureFormat::RGBA8, // D3D9 doesn't support RGBA8 }; - bool Context::init(RendererType::Enum _type) + bool Context::init(const Init& _init) { BX_CHECK(!m_rendererInitialized, "Already initialized?"); + m_init = _init; + m_init.resolution.reset &= ~BGFX_RESET_INTERNAL_FORCE; + + if (g_platformData.ndt == NULL + && g_platformData.nwh == NULL + && g_platformData.context == NULL + && g_platformData.backBuffer == NULL + && g_platformData.backBufferDS == NULL) + { + bx::memCopy(&g_platformData, &m_init.platformData, sizeof(PlatformData) ); + } + else + { + bx::memCopy(&m_init.platformData, &g_platformData, sizeof(PlatformData) ); + } + m_exit = false; m_flipped = true; m_frames = 0; @@ -1437,11 +1773,19 @@ namespace bgfx m_declRef.init(); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::RendererInit); - cmdbuf.write(_type); + cmdbuf.write(_init); frameNoRenderWait(); - uint16_t idx = m_encoderHandle.alloc(); + m_encoderHandle = bx::createHandleAlloc(g_allocator, _init.limits.maxEncoders); + m_encoder = (EncoderImpl*)BX_ALLOC(g_allocator, sizeof(EncoderImpl)*_init.limits.maxEncoders); + m_encoderStats = (EncoderStats*)BX_ALLOC(g_allocator, sizeof(EncoderStats)*_init.limits.maxEncoders); + for (uint32_t ii = 0, num = _init.limits.maxEncoders; ii < num; ++ii) + { + BX_PLACEMENT_NEW(&m_encoder[ii], EncoderImpl); + } + + uint16_t idx = m_encoderHandle->alloc(); BX_CHECK(0 == idx, "Internal encoder handle is not 0 (idx %d).", idx); BX_UNUSED(idx); m_encoder[0].begin(m_submit, 0); m_encoder0 = reinterpret_cast(&m_encoder[0]); @@ -1492,14 +1836,14 @@ namespace bgfx m_textVideoMemBlitter.init(); m_clearQuad.init(); - m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE); - m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE); + m_submit->m_transientVb = createTransientVertexBuffer(_init.limits.transientVbSize); + m_submit->m_transientIb = createTransientIndexBuffer(_init.limits.transientIbSize); frame(); if (BX_ENABLED(BGFX_CONFIG_MULTITHREADED) ) { - m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE); - m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE); + m_submit->m_transientVb = createTransientVertexBuffer(_init.limits.transientVbSize); + m_submit->m_transientIb = createTransientIndexBuffer(_init.limits.transientIbSize); frame(); } @@ -1532,6 +1876,16 @@ namespace bgfx frame(); m_encoder[0].end(true); + m_encoderHandle->free(0); + bx::destroyHandleAlloc(g_allocator, m_encoderHandle); + m_encoderHandle = NULL; + + for (uint32_t ii = 0, num = g_caps.limits.maxEncoders; ii < num; ++ii) + { + m_encoder[ii].~EncoderImpl(); + } + BX_FREE(g_allocator, m_encoder); + BX_FREE(g_allocator, m_encoderStats); m_dynVertexBufferAllocator.compact(); m_dynIndexBufferAllocator.compact(); @@ -1566,42 +1920,42 @@ namespace bgfx if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) { -#define CHECK_HANDLE_LEAK(_handleAlloc) \ - BX_MACRO_BLOCK_BEGIN \ - if (0 != _handleAlloc.getNumHandles() ) \ - { \ - BX_TRACE("LEAK: " #_handleAlloc " %d (max: %d)" \ - , _handleAlloc.getNumHandles() \ - , _handleAlloc.getMaxHandles() \ - ); \ - for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) \ - { \ - BX_TRACE("\t%3d: %4d", ii, _handleAlloc.getHandleAt(ii) ); \ - } \ - } \ - BX_MACRO_BLOCK_END +#define CHECK_HANDLE_LEAK(_handleAlloc) \ + BX_MACRO_BLOCK_BEGIN \ + if (0 != _handleAlloc.getNumHandles() ) \ + { \ + BX_TRACE("LEAK: " #_handleAlloc " %d (max: %d)" \ + , _handleAlloc.getNumHandles() \ + , _handleAlloc.getMaxHandles() \ + ); \ + for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) \ + { \ + BX_TRACE("\t%3d: %4d", ii, _handleAlloc.getHandleAt(ii) ); \ + } \ + } \ + BX_MACRO_BLOCK_END -#define CHECK_HANDLE_LEAK_NAME(_handleAlloc, _type, _ref) \ - BX_MACRO_BLOCK_BEGIN \ - if (0 != _handleAlloc.getNumHandles() ) \ - { \ - BX_TRACE("LEAK: " #_handleAlloc " %d (max: %d)" \ - , _handleAlloc.getNumHandles() \ - , _handleAlloc.getMaxHandles() \ - ); \ - for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) \ - { \ - uint16_t idx = _handleAlloc.getHandleAt(ii); \ - const _type& ref = _ref[idx]; BX_UNUSED(ref); \ - BX_TRACE("\t%3d: %4d %s (count %d)" \ - , ii \ - , idx \ - , ref.m_name.getPtr() \ - , ref.m_refCount \ - ); \ - } \ - } \ - BX_MACRO_BLOCK_END +#define CHECK_HANDLE_LEAK_NAME(_handleAlloc, _type, _ref) \ + BX_MACRO_BLOCK_BEGIN \ + if (0 != _handleAlloc.getNumHandles() ) \ + { \ + BX_TRACE("LEAK: " #_handleAlloc " %d (max: %d)" \ + , _handleAlloc.getNumHandles() \ + , _handleAlloc.getMaxHandles() \ + ); \ + for (uint16_t ii = 0, num = _handleAlloc.getNumHandles(); ii < num; ++ii) \ + { \ + uint16_t idx = _handleAlloc.getHandleAt(ii); \ + const _type& ref = _ref[idx]; BX_UNUSED(ref); \ + BX_TRACE("\t%3d: %4d %s (count %d)" \ + , ii \ + , idx \ + , ref.m_name.getPtr() \ + , ref.m_refCount \ + ); \ + } \ + } \ + BX_MACRO_BLOCK_END CHECK_HANDLE_LEAK (m_dynamicIndexBufferHandle ); CHECK_HANDLE_LEAK (m_dynamicVertexBufferHandle ); @@ -1683,16 +2037,16 @@ namespace bgfx } } - Encoder* Context::begin() + Encoder* Context::begin(bool _forThread) { EncoderImpl* encoder = &m_encoder[0]; #if BGFX_CONFIG_MULTITHREADED - if (BGFX_API_THREAD_MAGIC != s_threadIndex) + if (_forThread || BGFX_API_THREAD_MAGIC != s_threadIndex) { bx::MutexScope scopeLock(m_encoderApiLock); - uint16_t idx = m_encoderHandle.alloc(); + uint16_t idx = m_encoderHandle->alloc(); if (kInvalidHandle == idx) { return NULL; @@ -1701,6 +2055,8 @@ namespace bgfx encoder = &m_encoder[idx]; encoder->begin(m_submit, uint8_t(idx) ); } +#else + BX_UNUSED(_forThread); #endif // BGFX_CONFIG_MULTITHREADED return reinterpret_cast(encoder); @@ -1709,11 +2065,10 @@ namespace bgfx void Context::end(Encoder* _encoder) { #if BGFX_CONFIG_MULTITHREADED - if (BGFX_API_THREAD_MAGIC != s_threadIndex) + EncoderImpl* encoder = reinterpret_cast(_encoder); + if (encoder != &m_encoder[0]) { - EncoderImpl* encoder = reinterpret_cast(_encoder); encoder->end(true); - m_encoderEndSem.post(); } #else @@ -1757,8 +2112,8 @@ namespace bgfx void Context::swap() { freeDynamicBuffers(); - m_submit->m_resolution = m_resolution; - m_resolution.m_flags &= ~BGFX_RESET_INTERNAL_FORCE; + m_submit->m_resolution = m_init.resolution; + m_init.resolution.reset &= ~BGFX_RESET_INTERNAL_FORCE; m_submit->m_debug = m_debug; m_submit->m_perfStats.numViews = 0; @@ -1770,9 +2125,13 @@ namespace bgfx --m_colorPaletteDirty; bx::memCopy(m_submit->m_colorPalette, m_clearColor, sizeof(m_clearColor) ); } + + freeAllHandles(m_submit); + m_submit->resetFreeHandles(); + m_submit->finish(); - bx::xchg(m_render, m_submit); + bx::swap(m_render, m_submit); bx::memCopy(m_render->m_occlusion, m_submit->m_occlusion, sizeof(m_submit->m_occlusion) ); @@ -1786,12 +2145,11 @@ namespace bgfx m_submit->start(); bx::memSet(m_seq, 0, sizeof(m_seq) ); - freeAllHandles(m_submit); - m_submit->resetFreeHandles(); - m_submit->m_textVideoMem->resize(m_render->m_textVideoMem->m_small - , m_resolution.m_width - , m_resolution.m_height + m_submit->m_textVideoMem->resize( + m_render->m_textVideoMem->m_small + , m_init.resolution.width + , m_init.resolution.height ); int64_t now = bx::getHPCounter(); @@ -1799,7 +2157,10 @@ namespace bgfx m_frameTimeLast = now; } - RendererContextI* rendererCreate(RendererType::Enum _type); + /// + RendererContextI* rendererCreate(const Init& _init); + + /// void rendererDestroy(RendererContextI* _renderCtx); void Context::flip() @@ -1807,7 +2168,7 @@ namespace bgfx if (m_rendererInitialized && !m_flipped) { - m_renderCtx->flip(m_render->m_hmd); + m_renderCtx->flip(); m_flipped = true; if (m_renderCtx->isDeviceRemoved() ) @@ -1815,7 +2176,9 @@ namespace bgfx // Something horribly went wrong, fallback to noop renderer. rendererDestroy(m_renderCtx); - m_renderCtx = rendererCreate(RendererType::Noop); + Init init; + init.type = RendererType::Noop; + m_renderCtx = rendererCreate(init); g_caps.rendererType = RendererType::Noop; } } @@ -1940,7 +2303,7 @@ namespace bgfx uint16_t pitch; _cmdbuf.read(pitch); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); uint32_t key = m_textureUpdateBatch.m_keys[ii]; @@ -1970,15 +2333,15 @@ namespace bgfx } } - typedef RendererContextI* (*RendererCreateFn)(); + typedef RendererContextI* (*RendererCreateFn)(const Init& _init); typedef void (*RendererDestroyFn)(); -#define BGFX_RENDERER_CONTEXT(_namespace) \ - namespace _namespace \ - { \ - extern RendererContextI* rendererCreate(); \ - extern void rendererDestroy(); \ - } +#define BGFX_RENDERER_CONTEXT(_namespace) \ + namespace _namespace \ + { \ + extern RendererContextI* rendererCreate(const Init& _init); \ + extern void rendererDestroy(); \ + } BGFX_RENDERER_CONTEXT(noop); BGFX_RENDERER_CONTEXT(d3d9); @@ -2017,15 +2380,6 @@ namespace bgfx }; BX_STATIC_ASSERT(BX_COUNTOF(s_rendererCreator) == RendererType::Count); - struct Condition - { - enum Enum - { - LessEqual, - GreaterEqual, - }; - }; - bool windowsVersionIs(Condition::Enum _op, uint32_t _version) { #if BX_PLATFORM_WINDOWS @@ -2059,7 +2413,7 @@ namespace bgfx return *(const int32_t*)_rhs - *(const int32_t*)_lhs; } - RendererContextI* rendererCreate(RendererType::Enum _type) + RendererContextI* rendererCreate(const Init& _init) { int32_t scores[RendererType::Count]; uint32_t numScores = 0; @@ -2070,7 +2424,7 @@ namespace bgfx if (s_rendererCreator[ii].supported) { int32_t score = 0; - if (_type == renderer) + if (_init.type == renderer) { score += 1000; } @@ -2102,12 +2456,17 @@ namespace bgfx } else if (BX_ENABLED(BX_PLATFORM_OSX) ) { - score += RendererType::OpenGL == renderer ? 20 : 0; + score += RendererType::Metal == renderer ? 20 : 0; + score += RendererType::OpenGL == renderer ? 10 : 0; + } + else if (BX_ENABLED(BX_PLATFORM_IOS) ) + { + score += RendererType::Metal == renderer ? 20 : 0; + score += RendererType::OpenGLES == renderer ? 10 : 0; } else if (BX_ENABLED(0 || BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN - || BX_PLATFORM_IOS || BX_PLATFORM_RPI ) ) { @@ -2122,7 +2481,8 @@ namespace bgfx || BX_PLATFORM_WINRT ) ) { - score += RendererType::Direct3D11 == renderer ? 20 : 0; + score += RendererType::Direct3D12 == renderer ? 20 : 0; + score += RendererType::Direct3D11 == renderer ? 10 : 0; } scores[numScores++] = (score<<8) | uint8_t(renderer); @@ -2135,7 +2495,7 @@ namespace bgfx for (uint32_t ii = 0; ii < numScores; ++ii) { RendererType::Enum renderer = RendererType::Enum(scores[ii] & 0xff); - renderCtx = s_rendererCreator[renderer].createFn(); + renderCtx = s_rendererCreator[renderer].createFn(_init); if (NULL != renderCtx) { break; @@ -2183,10 +2543,10 @@ namespace bgfx ); BX_CHECK(!m_rendererInitialized, "This shouldn't happen! Bad synchronization?"); - RendererType::Enum type; - _cmdbuf.read(type); + Init init; + _cmdbuf.read(init); - m_renderCtx = rendererCreate(type); + m_renderCtx = rendererCreate(init); m_rendererInitialized = NULL != m_renderCtx; @@ -2226,7 +2586,7 @@ namespace bgfx m_exit = true; } - // fall through + BX_FALLTHROUGH; case CommandBuffer::End: end = true; @@ -2237,7 +2597,7 @@ namespace bgfx IndexBufferHandle handle; _cmdbuf.read(handle); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); uint16_t flags; @@ -2284,7 +2644,7 @@ namespace bgfx VertexBufferHandle handle; _cmdbuf.read(handle); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); VertexDeclHandle declHandle; @@ -2334,7 +2694,7 @@ namespace bgfx uint32_t size; _cmdbuf.read(size); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); m_renderCtx->updateDynamicIndexBuffer(handle, offset, size, mem); @@ -2378,7 +2738,7 @@ namespace bgfx uint32_t size; _cmdbuf.read(size); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); m_renderCtx->updateDynamicVertexBuffer(handle, offset, size, mem); @@ -2401,7 +2761,7 @@ namespace bgfx ShaderHandle handle; _cmdbuf.read(handle); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); m_renderCtx->createShader(handle, mem); @@ -2448,16 +2808,20 @@ namespace bgfx TextureHandle handle; _cmdbuf.read(handle); - Memory* mem; + const Memory* mem; _cmdbuf.read(mem); - uint32_t flags; + uint64_t flags; _cmdbuf.read(flags); uint8_t skip; _cmdbuf.read(skip); - m_renderCtx->createTexture(handle, mem, flags, skip); + void* ptr = m_renderCtx->createTexture(handle, mem, flags, skip); + if (NULL != ptr) + { + setDirectAccessPtr(handle, ptr); + } bx::MemoryReader reader(mem->data, mem->size); @@ -2541,7 +2905,10 @@ namespace bgfx uint8_t numMips; _cmdbuf.read(numMips); - m_renderCtx->resizeTexture(handle, width, height, numMips); + uint16_t numLayers; + _cmdbuf.read(numLayers); + + m_renderCtx->resizeTexture(handle, width, height, numMips, numLayers); } break; @@ -2573,10 +2940,13 @@ namespace bgfx uint16_t height; _cmdbuf.read(height); + TextureFormat::Enum format; + _cmdbuf.read(format); + TextureFormat::Enum depthFormat; _cmdbuf.read(depthFormat); - m_renderCtx->createFrameBuffer(handle, nwh, width, height, depthFormat); + m_renderCtx->createFrameBuffer(handle, nwh, width, height, format, depthFormat); } else { @@ -2735,7 +3105,49 @@ namespace bgfx return s_rendererCreator[_type].name; } - bool init(RendererType::Enum _type, uint16_t _vendorId, uint16_t _deviceId, CallbackI* _callback, bx::AllocatorI* _allocator) + PlatformData::PlatformData() + : ndt(NULL) + , nwh(NULL) + , context(NULL) + , backBuffer(NULL) + , backBufferDS(NULL) + { + } + + Resolution::Resolution() + : format(TextureFormat::RGBA8) + , width(1280) + , height(720) + , reset(BGFX_RESET_NONE) + , numBackBuffers(2) + , maxFrameLatency(0) + { + } + + Init::Init() + : type(RendererType::Count) + , vendorId(BGFX_PCI_ID_NONE) + , deviceId(0) + , debug(BX_ENABLED(BGFX_CONFIG_DEBUG) ) + , profile(BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + , callback(NULL) + , allocator(NULL) + { + limits.maxEncoders = BGFX_CONFIG_DEFAULT_MAX_ENCODERS; + limits.transientVbSize = BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE; + limits.transientIbSize = BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE; + } + + void Attachment::init(TextureHandle _handle, Access::Enum _access, uint16_t _layer, uint16_t _mip, uint8_t _resolve) + { + access = _access; + handle = _handle; + mip = _mip; + layer = _layer; + resolve = _resolve; + } + + bool init(const Init& _init) { if (NULL != s_ctx) { @@ -2743,6 +3155,13 @@ namespace bgfx return false; } + if (1 > _init.limits.maxEncoders + || 128 < _init.limits.maxEncoders) + { + BX_TRACE("init.limits.maxEncoders must be between 1 and 128."); + return false; + } + struct ErrorState { enum Enum @@ -2754,9 +3173,9 @@ namespace bgfx ErrorState::Enum errorState = ErrorState::Default; - if (NULL != _allocator) + if (NULL != _init.allocator) { - g_allocator = _allocator; + g_allocator = _init.allocator; } else { @@ -2765,9 +3184,9 @@ namespace bgfx s_allocatorStub = BX_NEW(&allocator, AllocatorStub); } - if (NULL != _callback) + if (NULL != _init.callback) { - g_callback = _callback; + g_callback = _init.callback; } else { @@ -2777,27 +3196,29 @@ namespace bgfx if (true && !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_PS4) - && RendererType::Noop != _type - && NULL == g_platformData.ndt - && NULL == g_platformData.nwh - && NULL == g_platformData.context - && NULL == g_platformData.backBuffer - && NULL == g_platformData.backBufferDS + && RendererType::Noop != _init.type + && NULL == _init.platformData.ndt + && NULL == _init.platformData.nwh + && NULL == _init.platformData.context + && NULL == _init.platformData.backBuffer + && NULL == _init.platformData.backBufferDS ) { - BX_TRACE("bgfx platform data like window handle or backbuffer must be set."); - goto error; + BX_TRACE("bgfx platform data like window handle or backbuffer is not set, creating headless device."); } bx::memSet(&g_caps, 0, sizeof(g_caps) ); g_caps.limits.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS; g_caps.limits.maxBlits = BGFX_CONFIG_MAX_BLIT_ITEMS; + g_caps.limits.maxTextureSize = 0; + g_caps.limits.maxTextureLayers = 1; g_caps.limits.maxViews = BGFX_CONFIG_MAX_VIEWS; g_caps.limits.maxFrameBuffers = BGFX_CONFIG_MAX_FRAME_BUFFERS; g_caps.limits.maxPrograms = BGFX_CONFIG_MAX_PROGRAMS; g_caps.limits.maxShaders = BGFX_CONFIG_MAX_SHADERS; g_caps.limits.maxTextures = BGFX_CONFIG_MAX_TEXTURES; g_caps.limits.maxTextureSamplers = BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; + g_caps.limits.maxComputeBindings = 0; g_caps.limits.maxVertexDecls = BGFX_CONFIG_MAX_VERTEX_DECLS; g_caps.limits.maxVertexStreams = 1; g_caps.limits.maxIndexBuffers = BGFX_CONFIG_MAX_INDEX_BUFFERS; @@ -2807,23 +3228,25 @@ namespace bgfx g_caps.limits.maxUniforms = BGFX_CONFIG_MAX_UNIFORMS; g_caps.limits.maxOcclusionQueries = BGFX_CONFIG_MAX_OCCLUSION_QUERIES; g_caps.limits.maxFBAttachments = 1; - g_caps.limits.maxEncoders = BGFX_CONFIG_MAX_ENCODERS; + g_caps.limits.maxEncoders = (0 != BGFX_CONFIG_MULTITHREADED) ? _init.limits.maxEncoders : 1; + g_caps.limits.transientVbSize = _init.limits.transientVbSize; + g_caps.limits.transientIbSize = _init.limits.transientIbSize; - g_caps.vendorId = _vendorId; - g_caps.deviceId = _deviceId; + g_caps.vendorId = _init.vendorId; + g_caps.deviceId = _init.deviceId; BX_TRACE("Init..."); errorState = ErrorState::ContextAllocated; s_ctx = BX_ALIGNED_NEW(g_allocator, Context, 64); - if (s_ctx->init(_type) ) + if (s_ctx->init(_init) ) { BX_TRACE("Init complete."); return true; } -error: +//error: BX_TRACE("Init failed."); switch (errorState) @@ -2831,6 +3254,7 @@ error: case ErrorState::ContextAllocated: BX_ALIGNED_DELETE(g_allocator, s_ctx, 64); s_ctx = NULL; + BX_FALLTHROUGH; case ErrorState::Default: if (NULL != s_callbackStub) @@ -2846,6 +3270,7 @@ error: s_allocatorStub = NULL; } + s_renderFrameCalled = false; s_threadIndex = 0; g_callback = NULL; g_allocator = NULL; @@ -2886,21 +3311,22 @@ error: s_allocatorStub = NULL; } + s_renderFrameCalled = false; s_threadIndex = 0; g_callback = NULL; g_allocator = NULL; } - void reset(uint32_t _width, uint32_t _height, uint32_t _flags) + void reset(uint32_t _width, uint32_t _height, uint32_t _flags, TextureFormat::Enum _format) { BGFX_CHECK_API_THREAD(); BX_CHECK(0 == (_flags&BGFX_RESET_RESERVED_MASK), "Do not set reset reserved flags!"); - s_ctx->reset(_width, _height, _flags); + s_ctx->reset(_width, _height, _flags, _format); } - Encoder* begin() + Encoder* begin(bool _forThread) { - return s_ctx->begin(); + return s_ctx->begin(_forThread); } #define BGFX_ENCODER(_func) reinterpret_cast(this)->_func @@ -2958,7 +3384,7 @@ error: const Context::UniformRef& uniform = s_ctx->m_uniformRef[_handle.idx]; BX_CHECK(isValid(_handle) && 0 < uniform.m_refCount, "Setting invalid uniform (handle %3d)!", _handle.idx); BX_CHECK(_num == UINT16_MAX || uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num); - BGFX_ENCODER(setUniform(uniform.m_type, _handle, _value, _num) ); + BGFX_ENCODER(setUniform(uniform.m_type, _handle, _value, UINT16_MAX != _num ? _num : uniform.m_num) ); } void Encoder::setIndexBuffer(IndexBufferHandle _handle) @@ -3031,10 +3457,21 @@ error: setVertexBuffer(_stream, _tvb, 0, UINT32_MAX); } - void Encoder::setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) + void Encoder::setVertexCount(uint32_t _numVertices) + { + BGFX_CHECK_CAPS(BGFX_CAPS_VERTEX_ID, "Auto generated vertices are not supported!"); + BGFX_ENCODER(setVertexCount(_numVertices) ); + } + + void Encoder::setInstanceDataBuffer(const InstanceDataBuffer* _idb) + { + setInstanceDataBuffer(_idb, 0, UINT32_MAX); + } + + void Encoder::setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _start, uint32_t _num) { BX_CHECK(NULL != _idb, "_idb can't be NULL"); - BGFX_ENCODER(setInstanceDataBuffer(_idb, _num) ); + BGFX_ENCODER(setInstanceDataBuffer(_idb, _start, _num) ); } void Encoder::setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) @@ -3055,10 +3492,17 @@ error: ) ); } + void Encoder::setInstanceCount(uint32_t _numInstances) + { + BGFX_CHECK_CAPS(BGFX_CAPS_VERTEX_ID, "Auto generated instances are not supported!"); + BGFX_ENCODER(setInstanceCount(_numInstances) ); + } + void Encoder::setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) { + BGFX_CHECK_HANDLE("setTexture/UniformHandle", s_ctx->m_uniformHandle, _sampler); BGFX_CHECK_HANDLE_INVALID_OK("setTexture/TextureHandle", s_ctx->m_textureHandle, _handle); - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxTextureSamplers, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxTextureSamplers); BGFX_ENCODER(setTexture(_stage, _sampler, _handle, _flags) ); } @@ -3068,13 +3512,13 @@ error: submit(_id, handle); } - void Encoder::submit(ViewId _id, ProgramHandle _program, int32_t _depth, bool _preserveState) + void Encoder::submit(ViewId _id, ProgramHandle _program, uint32_t _depth, bool _preserveState) { OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; submit(_id, _program, handle, _depth, _preserveState); } - void Encoder::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void Encoder::submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState) { BX_CHECK(false || !isValid(_occlusionQuery) @@ -3086,7 +3530,7 @@ error: BGFX_ENCODER(submit(_id, _program, _occlusionQuery, _depth, _preserveState) ); } - void Encoder::submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void Encoder::submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState) { BGFX_CHECK_HANDLE_INVALID_OK("submit", s_ctx->m_programHandle, _program); BGFX_CHECK_HANDLE("submit", s_ctx->m_vertexBufferHandle, _indirectHandle); @@ -3096,21 +3540,21 @@ error: void Encoder::setBuffer(uint8_t _stage, IndexBufferHandle _handle, Access::Enum _access) { - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxComputeBindings, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxComputeBindings); BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_indexBufferHandle, _handle); BGFX_ENCODER(setBuffer(_stage, _handle, _access) ); } void Encoder::setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) { - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxComputeBindings, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxComputeBindings); BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_vertexBufferHandle, _handle); BGFX_ENCODER(setBuffer(_stage, _handle, _access) ); } void Encoder::setBuffer(uint8_t _stage, DynamicIndexBufferHandle _handle, Access::Enum _access) { - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxComputeBindings, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxComputeBindings); BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_dynamicIndexBufferHandle, _handle); const DynamicIndexBuffer& dib = s_ctx->m_dynamicIndexBuffers[_handle.idx]; BGFX_ENCODER(setBuffer(_stage, dib.m_handle, _access) ); @@ -3118,7 +3562,7 @@ error: void Encoder::setBuffer(uint8_t _stage, DynamicVertexBufferHandle _handle, Access::Enum _access) { - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxComputeBindings, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxComputeBindings); BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_dynamicVertexBufferHandle, _handle); const DynamicVertexBuffer& dvb = s_ctx->m_dynamicVertexBuffers[_handle.idx]; BGFX_ENCODER(setBuffer(_stage, dvb.m_handle, _access) ); @@ -3126,15 +3570,16 @@ error: void Encoder::setBuffer(uint8_t _stage, IndirectBufferHandle _handle, Access::Enum _access) { - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxComputeBindings, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxComputeBindings); BGFX_CHECK_HANDLE("setBuffer", s_ctx->m_vertexBufferHandle, _handle); VertexBufferHandle handle = { _handle.idx }; BGFX_ENCODER(setBuffer(_stage, handle, _access) ); } - void Encoder::setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) + void Encoder::setImage(uint8_t _stage, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) { - BX_CHECK(_stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, "Invalid stage %d (max %d).", _stage, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS); + BX_CHECK(_stage < g_caps.limits.maxComputeBindings, "Invalid stage %d (max %d).", _stage, g_caps.limits.maxComputeBindings); + BGFX_CHECK_HANDLE_INVALID_OK("setImage/TextureHandle", s_ctx->m_textureHandle, _handle); _format = TextureFormat::Count == _format ? TextureFormat::Enum(s_ctx->m_textureRef[_handle.idx].m_format) : _format @@ -3142,7 +3587,7 @@ error: BX_CHECK(_format != TextureFormat::BGRA8 , "Can't use TextureFormat::BGRA8 with compute, use TextureFormat::RGBA8 instead." ); - BGFX_ENCODER(setImage(_stage, _sampler, _handle, _mip, _access, _format) ); + BGFX_ENCODER(setImage(_stage, _handle, _mip, _access, _format) ); } void Encoder::dispatch(ViewId _id, ProgramHandle _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) @@ -3174,6 +3619,8 @@ error: void Encoder::blit(ViewId _id, TextureHandle _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, TextureHandle _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { BGFX_CHECK_CAPS(BGFX_CAPS_TEXTURE_BLIT, "Texture blit is not supported!"); + BGFX_CHECK_HANDLE("blit/src TextureHandle", s_ctx->m_textureHandle, _src); + BGFX_CHECK_HANDLE("blit/dst TextureHandle", s_ctx->m_textureHandle, _dst); const Context::TextureRef& src = s_ctx->m_textureRef[_src.idx]; const Context::TextureRef& dst = s_ctx->m_textureRef[_dst.idx]; BX_CHECK(src.m_format == dst.m_format @@ -3203,11 +3650,6 @@ error: return &g_caps; } - const HMD* getHMD() - { - return s_ctx->getHMD(); - } - const Stats* getStats() { return s_ctx->getPerfStats(); @@ -3338,10 +3780,10 @@ error: return s_ctx->createDynamicIndexBuffer(_mem, _flags); } - void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _startIndex, const Memory* _mem) + void update(DynamicIndexBufferHandle _handle, uint32_t _startIndex, const Memory* _mem) { BX_CHECK(NULL != _mem, "_mem can't be NULL"); - s_ctx->updateDynamicIndexBuffer(_handle, _startIndex, _mem); + s_ctx->update(_handle, _startIndex, _mem); } void destroy(DynamicIndexBufferHandle _handle) @@ -3362,10 +3804,10 @@ error: return s_ctx->createDynamicVertexBuffer(_mem, _decl, _flags); } - void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, const Memory* _mem) + void update(DynamicVertexBufferHandle _handle, uint32_t _startVertex, const Memory* _mem) { BX_CHECK(NULL != _mem, "_mem can't be NULL"); - s_ctx->updateDynamicVertexBuffer(_handle, _startVertex, _mem); + s_ctx->update(_handle, _startVertex, _mem); } void destroy(DynamicVertexBufferHandle _handle) @@ -3397,7 +3839,9 @@ error: BX_CHECK(NULL != _tib, "_tib can't be NULL"); BX_CHECK(0 < _num, "Requesting 0 indices."); s_ctx->allocTransientIndexBuffer(_tib, _num); - BX_CHECK(_num == _tib->size/2, "Failed to allocate transient index buffer (requested %d, available %d). Use bgfx::checkAvailTransient* functions to ensure availability." + BX_CHECK(_num == _tib->size/2 + , "Failed to allocate transient index buffer (requested %d, available %d). " + "Use bgfx::getAvailTransient* functions to ensure availability." , _num , _tib->size/2 ); @@ -3407,10 +3851,11 @@ error: { BX_CHECK(NULL != _tvb, "_tvb can't be NULL"); BX_CHECK(0 < _num, "Requesting 0 vertices."); - BX_CHECK(UINT16_MAX >= _num, "Requesting %d vertices (max: %d).", _num, UINT16_MAX); BX_CHECK(isValid(_decl), "Invalid VertexDecl."); s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl); - BX_CHECK(_num == _tvb->size / _decl.m_stride, "Failed to allocate transient vertex buffer (requested %d, available %d). Use bgfx::checkAvailTransient* functions to ensure availability." + BX_CHECK(_num == _tvb->size / _decl.m_stride + , "Failed to allocate transient vertex buffer (requested %d, available %d). " + "Use bgfx::getAvailTransient* functions to ensure availability." , _num , _tvb->size / _decl.m_stride ); @@ -3437,7 +3882,9 @@ error: BX_CHECK(_stride == BX_ALIGN_16(_stride), "Stride must be multiple of 16."); BX_CHECK(0 < _num, "Requesting 0 instanced data vertices."); s_ctx->allocInstanceDataBuffer(_idb, _num, _stride); - BX_CHECK(_num == _idb->size / _stride, "Failed to allocate instance data buffer (requested %d, available %d). Use bgfx::checkAvailTransient* functions to ensure availability." + BX_CHECK(_num == _idb->size / _stride + , "Failed to allocate instance data buffer (requested %d, available %d). " + "Use bgfx::getAvailTransient* functions to ensure availability." , _num , _idb->size / _stride ); @@ -3464,9 +3911,9 @@ error: return s_ctx->getShaderUniforms(_handle, _uniforms, _max); } - void setName(ShaderHandle _handle, const char* _name) + void setName(ShaderHandle _handle, const char* _name, int32_t _len) { - s_ctx->setName(_handle, _name); + s_ctx->setName(_handle, bx::StringView(_name, _len) ); } void destroy(ShaderHandle _handle) @@ -3494,7 +3941,7 @@ error: s_ctx->destroyProgram(_handle); } - static void isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, bx::Error* _err) + static void isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, bx::Error* _err) { BX_ERROR_SCOPE(_err); @@ -3537,11 +3984,19 @@ error: return; } - bool formatSupported = 0 != (g_caps.formats[_format] & (0 + bool formatSupported; + if (0 != (_flags & (BGFX_TEXTURE_RT | BGFX_TEXTURE_RT_WRITE_ONLY)) ) + { + formatSupported = 0 != (g_caps.formats[_format] & BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER); + } + else + { + formatSupported = 0 != (g_caps.formats[_format] & (0 | BGFX_CAPS_FORMAT_TEXTURE_2D | BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED | BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB ) ); + } uint16_t srgbCaps = BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB; if (_cubeMap) @@ -3603,7 +4058,7 @@ error: } } - bool isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags) + bool isTextureValid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags) { bx::Error err; isTextureValid(_depth, _cubeMap, _numLayers, _format, _flags, &err); @@ -3615,10 +4070,10 @@ error: bimg::imageGetSize( (bimg::TextureInfo*)&_info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bimg::TextureFormat::Enum(_format) ); } - TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info) + TextureHandle createTexture(const Memory* _mem, uint64_t _flags, uint8_t _skip, TextureInfo* _info) { BX_CHECK(NULL != _mem, "_mem can't be NULL"); - return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::Count); + return s_ctx->createTexture(_mem, _flags, _skip, _info, BackbufferRatio::Count, false); } void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height) @@ -3635,11 +4090,11 @@ error: break; } - _width = bx::uint16_max(1, _width); - _height = bx::uint16_max(1, _height); + _width = bx::max(1, _width); + _height = bx::max(1, _height); } - static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) + static TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem) { bx::Error err; isTextureValid(0, false, _numLayers, _format, _flags, &err); @@ -3651,13 +4106,13 @@ error: if (BackbufferRatio::Count != _ratio) { - _width = uint16_t(s_ctx->m_resolution.m_width); - _height = uint16_t(s_ctx->m_resolution.m_height); + _width = uint16_t(s_ctx->m_init.resolution.width); + _height = uint16_t(s_ctx->m_init.resolution.height); getTextureSizeFromRatio(_ratio, _width, _height); } const uint8_t numMips = calcNumMips(_hasMips, _width, _height); - _numLayers = bx::uint16_max(_numLayers, 1); + _numLayers = bx::max(_numLayers, 1); if (BX_ENABLED(BGFX_CONFIG_DEBUG) && NULL != _mem) @@ -3689,22 +4144,22 @@ error: tc.m_mem = _mem; bx::write(&writer, tc); - return s_ctx->createTexture(mem, _flags, 0, NULL, _ratio); + return s_ctx->createTexture(mem, _flags, 0, NULL, _ratio, NULL != _mem); } - TextureHandle createTexture2D(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) + TextureHandle createTexture2D(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem) { BX_CHECK(_width > 0 && _height > 0, "Invalid texture size (width %d, height %d).", _width, _height); return createTexture2D(BackbufferRatio::Count, _width, _height, _hasMips, _numLayers, _format, _flags, _mem); } - TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags) + TextureHandle createTexture2D(BackbufferRatio::Enum _ratio, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags) { BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio."); return createTexture2D(_ratio, 0, 0, _hasMips, _numLayers, _format, _flags, NULL); } - TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) + TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem) { bx::Error err; isTextureValid(_depth, false, 1, _format, _flags, &err); @@ -3742,17 +4197,17 @@ error: tc.m_mem = _mem; bx::write(&writer, tc); - return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count); + return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count, NULL != _mem); } - TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem) + TextureHandle createTextureCube(uint16_t _size, bool _hasMips, uint16_t _numLayers, TextureFormat::Enum _format, uint64_t _flags, const Memory* _mem) { bx::Error err; isTextureValid(0, true, _numLayers, _format, _flags, &err); BX_CHECK(err.isOk(), "%s", err.getMessage().getPtr() ); const uint8_t numMips = calcNumMips(_hasMips, _size, _size); - _numLayers = bx::uint16_max(_numLayers, 1); + _numLayers = bx::max(_numLayers, 1); if (BX_ENABLED(BGFX_CONFIG_DEBUG) && NULL != _mem) @@ -3784,12 +4239,17 @@ error: tc.m_mem = _mem; bx::write(&writer, tc); - return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count); + return s_ctx->createTexture(mem, _flags, 0, NULL, BackbufferRatio::Count, NULL != _mem); } - void setName(TextureHandle _handle, const char* _name) + void setName(TextureHandle _handle, const char* _name, int32_t _len) { - s_ctx->setName(_handle, _name); + s_ctx->setName(_handle, bx::StringView(_name, _len) ); + } + + void* getDirectAccessPtr(TextureHandle _handle) + { + return s_ctx->getDirectAccessPtr(_handle); } void destroy(TextureHandle _handle) @@ -3850,14 +4310,14 @@ error: return s_ctx->readTexture(_handle, _data, _mip); } - FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags) + FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint64_t _textureFlags) { _textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT; TextureHandle th = createTexture2D(_width, _height, false, 1, _format, _textureFlags); return createFrameBuffer(1, &th, true); } - FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint32_t _textureFlags) + FrameBufferHandle createFrameBuffer(BackbufferRatio::Enum _ratio, TextureFormat::Enum _format, uint64_t _textureFlags) { BX_CHECK(_ratio < BackbufferRatio::Count, "Invalid back buffer ratio."); _textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT; @@ -3871,9 +4331,7 @@ error: for (uint8_t ii = 0; ii < _num; ++ii) { Attachment& at = attachment[ii]; - at.handle = _handles[ii]; - at.mip = 0; - at.layer = 0; + at.init(_handles[ii], Access::Write, 0, 0, BGFX_RESOLVE_AUTO_GEN_MIPS); } return createFrameBuffer(_num, attachment, _destroyTextures); } @@ -3890,7 +4348,7 @@ error: return s_ctx->createFrameBuffer(_num, _attachment, _destroyTextures); } - FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat) + FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) { BGFX_CHECK_CAPS(BGFX_CAPS_SWAP_CHAIN, "Swap chain is not supported!"); BX_WARN(_width > 0 && _height > 0 @@ -3898,10 +4356,19 @@ error: , _width , _height ); + BX_CHECK(_format == TextureFormat::Count || bimg::isColor(bimg::TextureFormat::Enum(_format) ) + , "Invalid texture format for color (%s)." + , bimg::getName(bimg::TextureFormat::Enum(_format) ) + ); + BX_CHECK(_depthFormat == TextureFormat::Count || bimg::isDepth(bimg::TextureFormat::Enum(_depthFormat) ) + , "Invalid texture format for depth (%s)." + , bimg::getName(bimg::TextureFormat::Enum(_depthFormat) ) + ); return s_ctx->createFrameBuffer( _nwh - , bx::uint16_max(_width, 1) - , bx::uint16_max(_height, 1) + , bx::max(_width, 1) + , bx::max(_height, 1) + , _format , _depthFormat ); } @@ -4001,8 +4468,8 @@ error: { BX_CHECK(checkView(_id), "Invalid view id: %d", _id); - uint16_t width = uint16_t(s_ctx->m_resolution.m_width); - uint16_t height = uint16_t(s_ctx->m_resolution.m_height); + uint16_t width = uint16_t(s_ctx->m_init.resolution.width); + uint16_t height = uint16_t(s_ctx->m_init.resolution.height); getTextureSizeFromRatio(_ratio, width, height); setViewRect(_id, _x, _y, width, height); } @@ -4181,10 +4648,22 @@ error: setVertexBuffer(_stream, _tvb, 0, UINT32_MAX); } - void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) + void setVertexCount(uint32_t _numVertices) { BGFX_CHECK_API_THREAD(); - s_ctx->m_encoder0->setInstanceDataBuffer(_idb, _num); + s_ctx->m_encoder0->setVertexCount(_numVertices); + } + + void setInstanceDataBuffer(const InstanceDataBuffer* _idb) + { + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setInstanceDataBuffer(_idb); + } + + void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _start, uint32_t _num) + { + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setInstanceDataBuffer(_idb, _start, _num); } void setInstanceDataBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _num) @@ -4199,6 +4678,12 @@ error: s_ctx->m_encoder0->setInstanceDataBuffer(_handle, _startVertex, _num); } + void setInstanceCount(uint32_t _numInstances) + { + BGFX_CHECK_API_THREAD(); + s_ctx->m_encoder0->setInstanceCount(_numInstances); + } + void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) { BGFX_CHECK_API_THREAD(); @@ -4211,19 +4696,19 @@ error: submit(_id, handle); } - void submit(ViewId _id, ProgramHandle _program, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, uint32_t _depth, bool _preserveState) { OcclusionQueryHandle handle = BGFX_INVALID_HANDLE; submit(_id, _program, handle, _depth, _preserveState); } - void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->submit(_id, _program, _occlusionQuery, _depth, _preserveState); } - void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState) { BGFX_CHECK_API_THREAD(); s_ctx->m_encoder0->submit(_id, _program, _indirectHandle, _start, _num, _depth, _preserveState); @@ -4259,10 +4744,10 @@ error: s_ctx->m_encoder0->setBuffer(_stage, _handle, _access); } - void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) + void setImage(uint8_t _stage, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) { BGFX_CHECK_API_THREAD(); - s_ctx->m_encoder0->setImage(_stage, _sampler, _handle, _mip, _access, _format); + s_ctx->m_encoder0->setImage(_stage, _handle, _mip, _access, _format); } void dispatch(ViewId _id, ProgramHandle _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) @@ -4307,16 +4792,20 @@ extern "C" // When laptop setup has integrated and discrete GPU, following driver workarounds will // select discrete GPU: - // Reference: https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm + // Reference(s): + // - https://web.archive.org/web/20180722051003/https://docs.nvidia.com/gameworks/content/technologies/desktop/optimus.htm + // __declspec(dllexport) uint32_t NvOptimusEnablement = UINT32_C(1); - // Reference: http://gpuopen.com/amdpowerxpressrequesthighperformance/ + // Reference(s): + // - https://web.archive.org/web/20180722051032/https://gpuopen.com/amdpowerxpressrequesthighperformance/ + // __declspec(dllexport) uint32_t AmdPowerXpressRequestHighPerformance = UINT32_C(1); } #endif // BX_PLATFORM_WINDOWS #define BGFX_TEXTURE_FORMAT_BIMG(_fmt) \ - BX_STATIC_ASSERT(uint32_t(bgfx::TextureFormat::_fmt) == uint32_t(bimg::TextureFormat::_fmt) ) + BX_STATIC_ASSERT(uint32_t(bgfx::TextureFormat::_fmt) == uint32_t(bimg::TextureFormat::_fmt) ) BGFX_TEXTURE_FORMAT_BIMG(BC1); BGFX_TEXTURE_FORMAT_BIMG(BC2); @@ -4335,6 +4824,15 @@ BGFX_TEXTURE_FORMAT_BIMG(PTC12A); BGFX_TEXTURE_FORMAT_BIMG(PTC14A); BGFX_TEXTURE_FORMAT_BIMG(PTC22); BGFX_TEXTURE_FORMAT_BIMG(PTC24); +BGFX_TEXTURE_FORMAT_BIMG(ATC); +BGFX_TEXTURE_FORMAT_BIMG(ATCE); +BGFX_TEXTURE_FORMAT_BIMG(ATCI); +BGFX_TEXTURE_FORMAT_BIMG(ASTC4x4); +BGFX_TEXTURE_FORMAT_BIMG(ASTC5x5); +BGFX_TEXTURE_FORMAT_BIMG(ASTC6x6); +BGFX_TEXTURE_FORMAT_BIMG(ASTC8x5); +BGFX_TEXTURE_FORMAT_BIMG(ASTC8x6); +BGFX_TEXTURE_FORMAT_BIMG(ASTC10x5); BGFX_TEXTURE_FORMAT_BIMG(Unknown); BGFX_TEXTURE_FORMAT_BIMG(R1); BGFX_TEXTURE_FORMAT_BIMG(A8); @@ -4404,9 +4902,9 @@ BGFX_TEXTURE_FORMAT_BIMG(Count); #define FLAGS_MASK_TEST(_flags, _mask) ( (_flags) == ( (_flags) & (_mask) ) ) BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 - | BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER - | BGFX_TEXTURE_INTERNAL_SHARED - , BGFX_TEXTURE_RESERVED_MASK + | BGFX_SAMPLER_INTERNAL_DEFAULT + | BGFX_SAMPLER_INTERNAL_SHARED + , BGFX_SAMPLER_RESERVED_MASK ) ); BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 @@ -4425,6 +4923,92 @@ BX_STATIC_ASSERT(FLAGS_MASK_TEST(0 , BGFX_SUBMIT_RESERVED_MASK ) ); +BX_STATIC_ASSERT( (0 + | BGFX_STATE_WRITE_MASK + | BGFX_STATE_DEPTH_TEST_MASK + | BGFX_STATE_BLEND_MASK + | BGFX_STATE_BLEND_EQUATION_MASK + | BGFX_STATE_BLEND_INDEPENDENT + | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE + | BGFX_STATE_CULL_MASK + | BGFX_STATE_ALPHA_REF_MASK + | BGFX_STATE_PT_MASK + | BGFX_STATE_POINT_SIZE_MASK + | BGFX_STATE_MSAA + | BGFX_STATE_LINEAA + | BGFX_STATE_CONSERVATIVE_RASTER + | BGFX_STATE_RESERVED_MASK + ) == (0 + ^ BGFX_STATE_WRITE_MASK + ^ BGFX_STATE_DEPTH_TEST_MASK + ^ BGFX_STATE_BLEND_MASK + ^ BGFX_STATE_BLEND_EQUATION_MASK + ^ BGFX_STATE_BLEND_INDEPENDENT + ^ BGFX_STATE_BLEND_ALPHA_TO_COVERAGE + ^ BGFX_STATE_CULL_MASK + ^ BGFX_STATE_ALPHA_REF_MASK + ^ BGFX_STATE_PT_MASK + ^ BGFX_STATE_POINT_SIZE_MASK + ^ BGFX_STATE_MSAA + ^ BGFX_STATE_LINEAA + ^ BGFX_STATE_CONSERVATIVE_RASTER + ^ BGFX_STATE_RESERVED_MASK + ) ); + +BX_STATIC_ASSERT(FLAGS_MASK_TEST(BGFX_CAPS_TEXTURE_COMPARE_LEQUAL, BGFX_CAPS_TEXTURE_COMPARE_ALL) ); + +BX_STATIC_ASSERT( (0 + | BGFX_CAPS_ALPHA_TO_COVERAGE + | BGFX_CAPS_BLEND_INDEPENDENT + | BGFX_CAPS_COMPUTE + | BGFX_CAPS_CONSERVATIVE_RASTER + | BGFX_CAPS_DRAW_INDIRECT + | BGFX_CAPS_FRAGMENT_DEPTH + | BGFX_CAPS_FRAGMENT_ORDERING + | BGFX_CAPS_GRAPHICS_DEBUGGER + | BGFX_CAPS_HDR10 + | BGFX_CAPS_HIDPI + | BGFX_CAPS_INDEX32 + | BGFX_CAPS_INSTANCING + | BGFX_CAPS_OCCLUSION_QUERY + | BGFX_CAPS_RENDERER_MULTITHREADED + | BGFX_CAPS_SWAP_CHAIN + | BGFX_CAPS_TEXTURE_2D_ARRAY + | BGFX_CAPS_TEXTURE_3D + | BGFX_CAPS_TEXTURE_BLIT + | BGFX_CAPS_TEXTURE_CUBE_ARRAY + | BGFX_CAPS_TEXTURE_DIRECT_ACCESS + | BGFX_CAPS_TEXTURE_READ_BACK + | BGFX_CAPS_VERTEX_ATTRIB_HALF + | BGFX_CAPS_VERTEX_ATTRIB_UINT10 + | BGFX_CAPS_VERTEX_ID + ) == (0 + ^ BGFX_CAPS_ALPHA_TO_COVERAGE + ^ BGFX_CAPS_BLEND_INDEPENDENT + ^ BGFX_CAPS_COMPUTE + ^ BGFX_CAPS_CONSERVATIVE_RASTER + ^ BGFX_CAPS_DRAW_INDIRECT + ^ BGFX_CAPS_FRAGMENT_DEPTH + ^ BGFX_CAPS_FRAGMENT_ORDERING + ^ BGFX_CAPS_GRAPHICS_DEBUGGER + ^ BGFX_CAPS_HDR10 + ^ BGFX_CAPS_HIDPI + ^ BGFX_CAPS_INDEX32 + ^ BGFX_CAPS_INSTANCING + ^ BGFX_CAPS_OCCLUSION_QUERY + ^ BGFX_CAPS_RENDERER_MULTITHREADED + ^ BGFX_CAPS_SWAP_CHAIN + ^ BGFX_CAPS_TEXTURE_2D_ARRAY + ^ BGFX_CAPS_TEXTURE_3D + ^ BGFX_CAPS_TEXTURE_BLIT + ^ BGFX_CAPS_TEXTURE_CUBE_ARRAY + ^ BGFX_CAPS_TEXTURE_DIRECT_ACCESS + ^ BGFX_CAPS_TEXTURE_READ_BACK + ^ BGFX_CAPS_VERTEX_ATTRIB_HALF + ^ BGFX_CAPS_VERTEX_ATTRIB_UINT10 + ^ BGFX_CAPS_VERTEX_ID + ) ); + #undef FLAGS_MASK_TEST #define BGFX_C99_ENUM_CHECK(_enum, _c99enumcount) \ @@ -4438,6 +5022,7 @@ BGFX_C99_ENUM_CHECK(bgfx::TextureFormat, BGFX_TEXTURE_FORMAT_COUNT); BGFX_C99_ENUM_CHECK(bgfx::UniformType, BGFX_UNIFORM_TYPE_COUNT); BGFX_C99_ENUM_CHECK(bgfx::BackbufferRatio, BGFX_BACKBUFFER_RATIO_COUNT); BGFX_C99_ENUM_CHECK(bgfx::OcclusionQueryResult, BGFX_OCCLUSION_QUERY_RESULT_COUNT); +BGFX_C99_ENUM_CHECK(bgfx::Topology, BGFX_TOPOLOGY_COUNT); BGFX_C99_ENUM_CHECK(bgfx::TopologyConvert, BGFX_TOPOLOGY_CONVERT_COUNT); BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT); #undef BGFX_C99_ENUM_CHECK @@ -4447,8 +5032,6 @@ BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t); -BGFX_C99_STRUCT_SIZE_CHECK(bgfx::HMD::Eye, bgfx_hmd_eye_t); -BGFX_C99_STRUCT_SIZE_CHECK(bgfx::HMD, bgfx_hmd_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexDecl, bgfx_vertex_decl_t); BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t); @@ -4472,9 +5055,9 @@ namespace bgfx { } - virtual void fatal(Fatal::Enum _code, const char* _str) override + virtual void fatal(const char* _filePath, uint16_t _line, Fatal::Enum _code, const char* _str) override { - m_interface->vtbl->fatal(m_interface, (bgfx_fatal_t)_code, _str); + m_interface->vtbl->fatal(m_interface, _filePath, _line, (bgfx_fatal_t)_code, _str); } virtual void traceVargs(const char* _filePath, uint16_t _line, const char* _format, va_list _argList) override @@ -4569,6 +5152,26 @@ BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _a ); } +BGFX_C_API void bgfx_vertex_decl_decode(const bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt) +{ + bgfx::AttribType::Enum type; + const bgfx::VertexDecl* decl = (const bgfx::VertexDecl*)_decl; + decl->decode( + bgfx::Attrib::Enum(_attrib) + , *_num + , type + , *_normalized + , *_asInt + ); + *_type = (bgfx_attrib_type_t)type; +} + +BGFX_C_API bool bgfx_vertex_decl_has(const bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib) +{ + const bgfx::VertexDecl* decl = (const bgfx::VertexDecl*)_decl; + return decl->has(bgfx::Attrib::Enum(_attrib)); +} + BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _decl, uint8_t _num) { bgfx::VertexDecl* decl = (bgfx::VertexDecl*)_decl; @@ -4626,30 +5229,43 @@ BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type) return bgfx::getRendererName(bgfx::RendererType::Enum(_type) ); } -BGFX_C_API bool bgfx_init(bgfx_renderer_type_t _type, uint16_t _vendorId, uint16_t _deviceId, bgfx_callback_interface_t* _callback, bgfx_allocator_interface_t* _allocator) +BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init) { - static bgfx::CallbackC99 s_callback; - s_callback.m_interface = _callback; - - static bgfx::AllocatorC99 s_allocator; - s_allocator.m_interface = _allocator; - - return bgfx::init(bgfx::RendererType::Enum(_type) - , _vendorId - , _deviceId - , NULL == _callback ? NULL : &s_callback - , NULL == _allocator ? NULL : &s_allocator - ); + BX_PLACEMENT_NEW(_init, bgfx::Init); } -BGFX_C_API void bgfx_shutdown() +BGFX_C_API bool bgfx_init(const bgfx_init_t* _init) +{ + bgfx_init_t init = *_init; + + if (init.callback != NULL) + { + static bgfx::CallbackC99 s_callback; + s_callback.m_interface = init.callback; + init.callback = reinterpret_cast(&s_callback); + } + + if (init.allocator != NULL) + { + static bgfx::AllocatorC99 s_allocator; + s_allocator.m_interface = init.allocator; + init.allocator = reinterpret_cast(&s_allocator); + } + + union { const bgfx_init_t* c; const bgfx::Init* cpp; } in; + in.c = &init; + + return bgfx::init(*in.cpp); +} + +BGFX_C_API void bgfx_shutdown(void) { return bgfx::shutdown(); } -BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags) +BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format) { - bgfx::reset(_width, _height, _flags); + bgfx::reset(_width, _height, _flags, bgfx::TextureFormat::Enum(_format) ); } BGFX_C_API uint32_t bgfx_frame(bool _capture) @@ -4657,22 +5273,17 @@ BGFX_C_API uint32_t bgfx_frame(bool _capture) return bgfx::frame(_capture); } -BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type() +BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void) { return bgfx_renderer_type_t(bgfx::getRendererType() ); } -BGFX_C_API const bgfx_caps_t* bgfx_get_caps() +BGFX_C_API const bgfx_caps_t* bgfx_get_caps(void) { return (const bgfx_caps_t*)bgfx::getCaps(); } -BGFX_C_API const bgfx_hmd_t* bgfx_get_hmd() -{ - return (const bgfx_hmd_t*)bgfx::getHMD(); -} - -BGFX_C_API const bgfx_stats_t* bgfx_get_stats() +BGFX_C_API const bgfx_stats_t* bgfx_get_stats(void) { return (const bgfx_stats_t*)bgfx::getStats(); } @@ -4769,7 +5380,7 @@ BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_m BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem) { union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle }; - bgfx::updateDynamicIndexBuffer(handle.cpp, _startIndex, (const bgfx::Memory*)_mem); + bgfx::update(handle.cpp, _startIndex, (const bgfx::Memory*)_mem); } BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle) @@ -4797,7 +5408,7 @@ BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; - bgfx::updateDynamicVertexBuffer(handle.cpp, _startVertex, (const bgfx::Memory*)_mem); + bgfx::update(handle.cpp, _startVertex, (const bgfx::Memory*)_mem); } BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle) @@ -4870,10 +5481,10 @@ BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_ return bgfx::getShaderUniforms(handle.cpp, (bgfx::UniformHandle*)_uniforms, _max); } -BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name) +BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name, int32_t _len) { union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle }; - bgfx::setName(handle.cpp, _name); + bgfx::setName(handle.cpp, _name, _len); } BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle) @@ -4905,7 +5516,7 @@ BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle) bgfx::destroy(handle.cpp); } -BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags) +BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags) { return bgfx::isTextureValid(_depth, _cubeMap, _numLayers, bgfx::TextureFormat::Enum(_format), _flags); } @@ -4916,7 +5527,7 @@ BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _wid bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format) ); } -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info) +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t* _info) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle; bgfx::TextureInfo* info = (bgfx::TextureInfo*)_info; @@ -4924,28 +5535,28 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, return handle.c; } -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem) +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle; handle.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem); return handle.c; } -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags) +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle; handle.cpp = bgfx::createTexture2D(bgfx::BackbufferRatio::Enum(_ratio), _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags); return handle.c; } -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem) +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle; handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem); return handle.c; } -BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem) +BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle; handle.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem); @@ -4976,10 +5587,16 @@ BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data return bgfx::readTexture(handle.cpp, _data, _mip); } -BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name) +BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name, int32_t _len) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; - bgfx::setName(handle.cpp, _name); + bgfx::setName(handle.cpp, _name, _len); +} + +BGFX_C_API void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle) +{ + union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; + return bgfx::getDirectAccessPtr(handle.cpp); } BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle) @@ -4988,14 +5605,14 @@ BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle) bgfx::destroy(handle.cpp); } -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags) +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle; handle.cpp = bgfx::createFrameBuffer(_width, _height, bgfx::TextureFormat::Enum(_format), _textureFlags); return handle.c; } -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags) +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle; handle.cpp = bgfx::createFrameBuffer(bgfx::BackbufferRatio::Enum(_ratio), bgfx::TextureFormat::Enum(_format), _textureFlags); @@ -5016,10 +5633,10 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(u return handle.c; } -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _depthFormat) +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle; - handle.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, bgfx::TextureFormat::Enum(_depthFormat) ); + handle.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, bgfx::TextureFormat::Enum(_format), bgfx::TextureFormat::Enum(_depthFormat) ); return handle.c; } @@ -5057,7 +5674,7 @@ BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle) bgfx::destroy(handle.cpp); } -BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query() +BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(void) { union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle; handle.cpp = bgfx::createOcclusionQuery(); @@ -5228,9 +5845,14 @@ BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_tra bgfx::setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices); } -BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _num) +BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices) { - bgfx::setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _num); + bgfx::setVertexCount(_numVertices); +} + +BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num) +{ + bgfx::setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _start, _num); } BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) @@ -5245,6 +5867,11 @@ BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_v bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num); } +BGFX_C_API void bgfx_set_instance_count(uint32_t _numInstances) +{ + bgfx::setInstanceCount(_numInstances); +} + BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags) { union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; @@ -5257,31 +5884,30 @@ BGFX_C_API void bgfx_touch(bgfx_view_id_t _id) return bgfx::touch(_id); } -BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; bgfx::submit(_id, handle.cpp, _depth, _preserveState); } -BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; - union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; + union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; bgfx::submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState); } -BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; bgfx::submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState); } -BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) +BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) { - union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; - bgfx::setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ); + bgfx::setImage(_stage, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ); } BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access) @@ -5327,7 +5953,7 @@ BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t bgfx::dispatch(_id, handle.cpp, indirectHandle.cpp, _start, _num, _flags); } -BGFX_C_API void bgfx_discard() +BGFX_C_API void bgfx_discard(void) { bgfx::discard(); } @@ -5341,197 +5967,206 @@ BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_ #define BGFX_ENCODER(_func) reinterpret_cast(_encoder)->_func -BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder* _encoder, const char* _marker) +BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder_s* _encoder, const char* _marker) { BGFX_ENCODER(setMarker(_marker) ); } -BGFX_C_API void bgfx_encoder_set_state(bgfx_encoder* _encoder, uint64_t _state, uint32_t _rgba) +BGFX_C_API void bgfx_encoder_set_state(bgfx_encoder_s* _encoder, uint64_t _state, uint32_t _rgba) { BGFX_ENCODER(setState(_state, _rgba) ); } -BGFX_C_API void bgfx_encoder_set_condition(bgfx_encoder* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible) +BGFX_C_API void bgfx_encoder_set_condition(bgfx_encoder_s* _encoder, bgfx_occlusion_query_handle_t _handle, bool _visible) { union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle }; BGFX_ENCODER(setCondition(handle.cpp, _visible) ); } -BGFX_C_API void bgfx_encoder_set_stencil(bgfx_encoder* _encoder, uint32_t _fstencil, uint32_t _bstencil) +BGFX_C_API void bgfx_encoder_set_stencil(bgfx_encoder_s* _encoder, uint32_t _fstencil, uint32_t _bstencil) { BGFX_ENCODER(setStencil(_fstencil, _bstencil) ); } -BGFX_C_API uint16_t bgfx_encoder_set_scissor(bgfx_encoder* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) +BGFX_C_API uint16_t bgfx_encoder_set_scissor(bgfx_encoder_s* _encoder, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { return BGFX_ENCODER(setScissor(_x, _y, _width, _height) ); } -BGFX_C_API void bgfx_encoder_set_scissor_cached(bgfx_encoder* _encoder, uint16_t _cache) +BGFX_C_API void bgfx_encoder_set_scissor_cached(bgfx_encoder_s* _encoder, uint16_t _cache) { BGFX_ENCODER(setScissor(_cache) ); } -BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder* _encoder, const void* _mtx, uint16_t _num) +BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder_s* _encoder, const void* _mtx, uint16_t _num) { return BGFX_ENCODER(setTransform(_mtx, _num) ); } -BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder* _encoder, bgfx_transform_t* _transform, uint16_t _num) +BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder_s* _encoder, bgfx_transform_t* _transform, uint16_t _num) { return BGFX_ENCODER(allocTransform( (bgfx::Transform*)_transform, _num) ); } -BGFX_C_API void bgfx_encoder_set_transform_cached(bgfx_encoder* _encoder, uint32_t _cache, uint16_t _num) +BGFX_C_API void bgfx_encoder_set_transform_cached(bgfx_encoder_s* _encoder, uint32_t _cache, uint16_t _num) { BGFX_ENCODER(setTransform(_cache, _num) ); } -BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num) +BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder_s* _encoder, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num) { union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle }; BGFX_ENCODER(setUniform(handle.cpp, _value, _num) ); } -BGFX_C_API void bgfx_encoder_set_index_buffer(bgfx_encoder* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices) +BGFX_C_API void bgfx_encoder_set_index_buffer(bgfx_encoder_s* _encoder, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices) { union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setIndexBuffer(handle.cpp, _firstIndex, _numIndices) ); } -BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices) +BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_s* _encoder, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices) { union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setIndexBuffer(handle.cpp, _firstIndex, _numIndices) ); } -BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices) +BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_s* _encoder, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices) { BGFX_ENCODER(setIndexBuffer( (const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices) ); } -BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) +BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_s* _encoder, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) { union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices) ); } -BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) +BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_s* _encoder, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices) ); } -BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices) +BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_s* _encoder, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices) { BGFX_ENCODER(setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices) ); } -BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _num) +BGFX_C_API void bgfx_encoder_set_vertex_count(bgfx_encoder_s* _encoder, uint32_t _numVertices) { - BGFX_ENCODER(setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _num) ); + BGFX_ENCODER(setVertexCount(_numVertices) ); } -BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) +BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_s* _encoder, const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num) +{ + BGFX_ENCODER(setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _start, _num) ); +} + +BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_s* _encoder, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) { union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setInstanceDataBuffer(handle.cpp, _startVertex, _num) ); } -BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) +BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_s* _encoder, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setInstanceDataBuffer(handle.cpp, _startVertex, _num) ); } -BGFX_C_API void bgfx_encoder_set_texture(bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags) +BGFX_C_API void bgfx_encoder_set_instance_count(bgfx_encoder_s* _encoder, uint32_t _numInstances) +{ + BGFX_ENCODER(setInstanceCount(_numInstances) ); +} + +BGFX_C_API void bgfx_encoder_set_texture(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags) { union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; BGFX_ENCODER(setTexture(_stage, sampler.cpp, handle.cpp, _flags) ); } -BGFX_C_API void bgfx_encoder_touch(bgfx_encoder* _encoder, bgfx_view_id_t _id) +BGFX_C_API void bgfx_encoder_touch(bgfx_encoder_s* _encoder, bgfx_view_id_t _id) { return BGFX_ENCODER(touch(_id) ); } -BGFX_C_API void bgfx_encoder_submit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_encoder_submit(bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; BGFX_ENCODER(submit(_id, handle.cpp, _depth, _preserveState) ); } -BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program }; - union { bgfx_occlusion_query_handle c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; + union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery }; BGFX_ENCODER(submit(_id, program.cpp, occlusionQuery.cpp, _depth, _preserveState) ); } -BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) +BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; BGFX_ENCODER(submit(_id, handle.cpp, indirectHandle.cpp, _start, _num, _depth, _preserveState) ); } -BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder* _encoder, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) +BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format) { - union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; - BGFX_ENCODER(setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ) ); + BGFX_ENCODER(setImage(_stage, handle.cpp, _mip, bgfx::Access::Enum(_access), bgfx::TextureFormat::Enum(_format) ) ); } -BGFX_C_API void bgfx_encoder_set_compute_index_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access) +BGFX_C_API void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access) { union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); } -BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access) +BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access) { union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); } -BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access) +BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access) { union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); } -BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access) +BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access) { union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); } -BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access) +BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_s* _encoder, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access) { union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle }; BGFX_ENCODER(setBuffer(_stage, handle.cpp, bgfx::Access::Enum(_access) ) ); } -BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) +BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; BGFX_ENCODER(dispatch(_id, handle.cpp, _numX, _numY, _numZ, _flags) ); } -BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) +BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_program_handle_t _handle, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags) { union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle }; union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle }; BGFX_ENCODER(dispatch(_id, handle.cpp, indirectHandle.cpp, _start, _num, _flags) ); } -BGFX_C_API void bgfx_encoder_discard(bgfx_encoder* _encoder) +BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_s* _encoder) { BGFX_ENCODER(discard() ); } -BGFX_C_API void bgfx_encoder_blit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) +BGFX_C_API void bgfx_encoder_blit(bgfx_encoder_s* _encoder, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst }; union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src }; @@ -5540,7 +6175,7 @@ BGFX_C_API void bgfx_encoder_blit(bgfx_encoder* _encoder, bgfx_view_id_t _id, bg #undef BGFX_ENCODER -BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle _handle, const char* _filePath) +BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle }; bgfx::requestScreenShot(handle.cpp, _filePath); @@ -5585,6 +6220,8 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(override_internal_texture) \ BGFX_IMPORT_FUNC(vertex_decl_begin) \ BGFX_IMPORT_FUNC(vertex_decl_add) \ + BGFX_IMPORT_FUNC(vertex_decl_decode) \ + BGFX_IMPORT_FUNC(vertex_decl_has) \ BGFX_IMPORT_FUNC(vertex_decl_skip) \ BGFX_IMPORT_FUNC(vertex_decl_end) \ BGFX_IMPORT_FUNC(vertex_pack) \ @@ -5595,13 +6232,13 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(topology_sort_tri_list) \ BGFX_IMPORT_FUNC(get_supported_renderers) \ BGFX_IMPORT_FUNC(get_renderer_name) \ + BGFX_IMPORT_FUNC(init_ctor) \ BGFX_IMPORT_FUNC(init) \ BGFX_IMPORT_FUNC(shutdown) \ BGFX_IMPORT_FUNC(reset) \ BGFX_IMPORT_FUNC(frame) \ BGFX_IMPORT_FUNC(get_renderer_type) \ BGFX_IMPORT_FUNC(get_caps) \ - BGFX_IMPORT_FUNC(get_hmd) \ BGFX_IMPORT_FUNC(get_stats) \ BGFX_IMPORT_FUNC(alloc) \ BGFX_IMPORT_FUNC(copy) \ @@ -5652,6 +6289,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(update_texture_cube) \ BGFX_IMPORT_FUNC(read_texture) \ BGFX_IMPORT_FUNC(set_texture_name) \ + BGFX_IMPORT_FUNC(get_direct_access_ptr) \ BGFX_IMPORT_FUNC(destroy_texture) \ BGFX_IMPORT_FUNC(create_frame_buffer) \ BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \ @@ -5692,9 +6330,11 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(encoder_set_vertex_buffer) \ BGFX_IMPORT_FUNC(encoder_set_dynamic_vertex_buffer) \ BGFX_IMPORT_FUNC(encoder_set_transient_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_vertex_count) \ BGFX_IMPORT_FUNC(encoder_set_instance_data_buffer) \ BGFX_IMPORT_FUNC(encoder_set_instance_data_from_vertex_buffer) \ BGFX_IMPORT_FUNC(encoder_set_instance_data_from_dynamic_vertex_buffer) \ + BGFX_IMPORT_FUNC(encoder_set_instance_count) \ BGFX_IMPORT_FUNC(encoder_set_texture) \ BGFX_IMPORT_FUNC(encoder_touch) \ BGFX_IMPORT_FUNC(encoder_submit) \ diff --git a/3rdparty/bgfx/src/bgfx_compute.sh b/3rdparty/bgfx/src/bgfx_compute.sh index 902651e9c8c..05eefd88713 100644 --- a/3rdparty/bgfx/src/bgfx_compute.sh +++ b/3rdparty/bgfx/src/bgfx_compute.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -51,6 +51,15 @@ #define NUM_THREADS(_x, _y, _z) layout (local_size_x = _x, local_size_y = _y, local_size_z = _z) in; +#define atomicFetchAndAdd(_mem, _data, _original) _original = atomicAdd(_mem, _data) +#define atomicFetchAndAnd(_mem, _data, _original) _original = atomicAnd(_mem, _data) +#define atomicFetchAndMax(_mem, _data, _original) _original = atomicMax(_mem, _data) +#define atomicFetchAndMin(_mem, _data, _original) _original = atomicMin(_mem, _data) +#define atomicFetchAndOr(_mem, _data, _original) _original = atomicOr(_mem, _data) +#define atomicFetchAndXor(_mem, _data, _original) _original = atomicXor(_mem, _data) +#define atomicFetchAndExchange(_mem, _data, _original) _original = atomicExchange(_mem, _data) +#define atomicFetchCompareExchange(_mem, _compare, _data, _original) _original = atomicCompSwap(_mem,_compare, _data) + #else #define SHARED groupshared @@ -251,79 +260,63 @@ __IMAGE_IMPL_A(r32ui, x, uvec4, xxxx) __IMAGE_IMPL_A(rg32ui, xy, uvec4, xyyy) __IMAGE_IMPL_A(rgba32ui, xyzw, uvec4, xyzw) -#define __ATOMIC_IMPL_TYPE(_genType, _glFunc, _dxFunc) \ - _genType _glFunc(inout _genType _mem, _genType _data) \ - { \ - _genType result; \ - _dxFunc(_mem, _data, result); \ - return result; \ - } - -#define __ATOMIC_IMPL(_glFunc, _dxFunc) \ - __ATOMIC_IMPL_TYPE(int, _glFunc, _dxFunc) \ - __ATOMIC_IMPL_TYPE(uint, _glFunc, _dxFunc) - -__ATOMIC_IMPL(atomicAdd, InterlockedAdd); -__ATOMIC_IMPL(atomicAnd, InterlockedAnd); -__ATOMIC_IMPL(atomicExchange, InterlockedExchange); -__ATOMIC_IMPL(atomicMax, InterlockedMax); -__ATOMIC_IMPL(atomicMin, InterlockedMin); -__ATOMIC_IMPL(atomicOr, InterlockedOr); -__ATOMIC_IMPL(atomicXor, InterlockedXor); - -int atomicCompSwap(inout int _mem, int _compare, int _data) -{ - int result; - InterlockedCompareExchange(_mem, _compare, _data, result); - return result; -} - -uint atomicCompSwap(inout uint _mem, uint _compare, uint _data) -{ - uint result; - InterlockedCompareExchange(_mem, _compare, _data, result); - return result; -} +#define atomicAdd(_mem, _data) InterlockedAdd(_mem, _data) +#define atomicAnd(_mem, _data) InterlockedAnd(_mem, _data) +#define atomicMax(_mem, _data) InterlockedMax(_mem, _data) +#define atomicMin(_mem, _data) InterlockedMin(_mem, _data) +#define atomicOr(_mem, _data) InterlockedOr(_mem, _data) +#define atomicXor(_mem, _data) InterlockedXor(_mem, _data) +#define atomicFetchAndAdd(_mem, _data, _original) InterlockedAdd(_mem, _data, _original) +#define atomicFetchAndAnd(_mem, _data, _original) InterlockedAnd(_mem, _data, _original) +#define atomicFetchAndMax(_mem, _data, _original) InterlockedMax(_mem, _data, _original) +#define atomicFetchAndMin(_mem, _data, _original) InterlockedMin(_mem, _data, _original) +#define atomicFetchAndOr(_mem, _data, _original) InterlockedOr(_mem, _data, _original) +#define atomicFetchAndXor(_mem, _data, _original) InterlockedXor(_mem, _data, _original) +#define atomicFetchAndExchange(_mem, _data, _original) InterlockedExchange(_mem, _data, _original) +#define atomicFetchCompareExchange(_mem, _compare, _data, _original) InterlockedCompareExchange(_mem,_compare, _data, _original) // InterlockedCompareStore #define barrier() GroupMemoryBarrierWithGroupSync() #define memoryBarrier() GroupMemoryBarrierWithGroupSync() #define memoryBarrierAtomicCounter() GroupMemoryBarrierWithGroupSync() -#define memoryBarrierBuffer() GroupMemoryBarrierWithGroupSync() +#define memoryBarrierBuffer() AllMemoryBarrierWithGroupSync() #define memoryBarrierImage() GroupMemoryBarrierWithGroupSync() #define memoryBarrierShared() GroupMemoryBarrierWithGroupSync() #define groupMemoryBarrier() GroupMemoryBarrierWithGroupSync() #endif // BGFX_SHADER_LANGUAGE_GLSL -#define dispatchIndirect(_buffer \ - , _offset \ - , _numX \ - , _numY \ - , _numZ \ - ) \ - _buffer[_offset*2+0] = uvec4(_numX, _numY, _numZ, 0u) +#define dispatchIndirect( \ + _buffer \ + , _offset \ + , _numX \ + , _numY \ + , _numZ \ + ) \ + _buffer[_offset*2+0] = uvec4(_numX, _numY, _numZ, 0u) -#define drawIndirect(_buffer \ - , _offset \ - , _numVertices \ - , _numInstances \ - , _startVertex \ - , _startInstance \ - ) \ - _buffer[_offset*2+0] = uvec4(_numVertices, _numInstances, _startVertex, _startInstance) +#define drawIndirect( \ + _buffer \ + , _offset \ + , _numVertices \ + , _numInstances \ + , _startVertex \ + , _startInstance \ + ) \ + _buffer[_offset*2+0] = uvec4(_numVertices, _numInstances, _startVertex, _startInstance) -#define drawIndexedIndirect(_buffer \ - , _offset \ - , _numIndices \ - , _numInstances \ - , _startIndex \ - , _startVertex \ - , _startInstance \ - ) \ - _buffer[_offset*2+0] = uvec4(_numIndices, _numInstances, _startIndex, _startVertex); \ - _buffer[_offset*2+1] = uvec4(_startInstance, 0u, 0u, 0u) +#define drawIndexedIndirect( \ + _buffer \ + , _offset \ + , _numIndices \ + , _numInstances \ + , _startIndex \ + , _startVertex \ + , _startInstance \ + ) \ + _buffer[_offset*2+0] = uvec4(_numIndices, _numInstances, _startIndex, _startVertex); \ + _buffer[_offset*2+1] = uvec4(_startInstance, 0u, 0u, 0u) #endif // __cplusplus diff --git a/3rdparty/bgfx/src/bgfx_p.h b/3rdparty/bgfx/src/bgfx_p.h index 14fce4ff2a5..f6dfc434b19 100644 --- a/3rdparty/bgfx/src/bgfx_p.h +++ b/3rdparty/bgfx/src/bgfx_p.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -25,23 +25,23 @@ #include // Check handle, cannot be bgfx::kInvalidHandle and must be valid. -#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \ - BX_CHECK(isValid(_handle) \ - && _handleAlloc.isValid(_handle.idx) \ +#define BGFX_CHECK_HANDLE(_desc, _handleAlloc, _handle) \ + BX_CHECK(isValid(_handle) \ + && _handleAlloc.isValid(_handle.idx) \ , "Invalid handle. %s handle: %d (max %d)" \ - , _desc \ - , _handle.idx \ - , _handleAlloc.getMaxHandles() \ + , _desc \ + , _handle.idx \ + , _handleAlloc.getMaxHandles() \ ) // Check handle, it's ok to be bgfx::kInvalidHandle or must be valid. #define BGFX_CHECK_HANDLE_INVALID_OK(_desc, _handleAlloc, _handle) \ - BX_CHECK(!isValid(_handle) \ - || _handleAlloc.isValid(_handle.idx) \ - , "Invalid handle. %s handle: %d (max %d)" \ - , _desc \ - , _handle.idx \ - , _handleAlloc.getMaxHandles() \ + BX_CHECK(!isValid(_handle) \ + || _handleAlloc.isValid(_handle.idx) \ + , "Invalid handle. %s handle: %d (max %d)" \ + , _desc \ + , _handle.idx \ + , _handleAlloc.getMaxHandles() \ ) #if BGFX_CONFIG_MULTITHREADED @@ -67,7 +67,7 @@ namespace bgfx #if BX_COMPILER_CLANG_ANALYZER void __attribute__( (analyzer_noreturn) ) fatal(Fatal::Enum _code, const char* _format, ...); #else - void fatal(Fatal::Enum _code, const char* _format, ...); + void fatal(const char* _filePath, uint16_t _line, Fatal::Enum _code, const char* _format, ...); #endif // BX_COMPILER_CLANG_ANALYZER void trace(const char* _filePath, uint16_t _line, const char* _format, ...); @@ -76,34 +76,34 @@ namespace bgfx inline bool operator==(const UniformHandle& _lhs, const UniformHandle& _rhs) { return _lhs.idx == _rhs.idx; } } -#define _BX_TRACE(_format, ...) \ - BX_MACRO_BLOCK_BEGIN \ +#define _BX_TRACE(_format, ...) \ + BX_MACRO_BLOCK_BEGIN \ bgfx::trace(__FILE__, uint16_t(__LINE__), "BGFX " _format "\n", ##__VA_ARGS__); \ BX_MACRO_BLOCK_END -#define _BX_WARN(_condition, _format, ...) \ - BX_MACRO_BLOCK_BEGIN \ - if (!BX_IGNORE_C4127(_condition) ) \ - { \ +#define _BX_WARN(_condition, _format, ...) \ + BX_MACRO_BLOCK_BEGIN \ + if (!BX_IGNORE_C4127(_condition) ) \ + { \ BX_TRACE("WARN " _format, ##__VA_ARGS__); \ - } \ + } \ BX_MACRO_BLOCK_END -#define _BX_CHECK(_condition, _format, ...) \ - BX_MACRO_BLOCK_BEGIN \ - if (!BX_IGNORE_C4127(_condition) ) \ - { \ - BX_TRACE("CHECK " _format, ##__VA_ARGS__); \ - bgfx::fatal(bgfx::Fatal::DebugCheck, _format, ##__VA_ARGS__); \ - } \ +#define _BX_CHECK(_condition, _format, ...) \ + BX_MACRO_BLOCK_BEGIN \ + if (!BX_IGNORE_C4127(_condition) ) \ + { \ + BX_TRACE("CHECK " _format, ##__VA_ARGS__); \ + bgfx::fatal(__FILE__, uint16_t(__LINE__), bgfx::Fatal::DebugCheck, _format, ##__VA_ARGS__); \ + } \ BX_MACRO_BLOCK_END -#define BGFX_FATAL(_condition, _err, _format, ...) \ - BX_MACRO_BLOCK_BEGIN \ - if (!BX_IGNORE_C4127(_condition) ) \ - { \ - fatal(_err, _format, ##__VA_ARGS__); \ - } \ +#define BGFX_FATAL(_condition, _err, _format, ...) \ + BX_MACRO_BLOCK_BEGIN \ + if (!BX_IGNORE_C4127(_condition) ) \ + { \ + fatal(__FILE__, uint16_t(__LINE__), _err, _format, ##__VA_ARGS__); \ + } \ BX_MACRO_BLOCK_END #include @@ -114,7 +114,6 @@ namespace bgfx #include #include #include -#include #include #include #include @@ -133,20 +132,14 @@ namespace bgfx #define BGFX_CHUNK_MAGIC_TEX BX_MAKEFOURCC('T', 'E', 'X', 0x0) -#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x3) -#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x5) -#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x5) - #define BGFX_CLEAR_COLOR_USE_PALETTE UINT16_C(0x8000) -#define BGFX_CLEAR_MASK (0 \ - | BGFX_CLEAR_COLOR \ - | BGFX_CLEAR_DEPTH \ - | BGFX_CLEAR_STENCIL \ +#define BGFX_CLEAR_MASK (0 \ + | BGFX_CLEAR_COLOR \ + | BGFX_CLEAR_DEPTH \ + | BGFX_CLEAR_STENCIL \ | BGFX_CLEAR_COLOR_USE_PALETTE \ ) -#include // mingw wants it to be before tr1/unordered_*... - #if BGFX_CONFIG_USE_TINYSTL namespace bgfx { @@ -161,8 +154,42 @@ namespace bgfx # include # include # include + +namespace tinystl +{ + template + class list : public vector + { + public: + void push_front(const T& _value) + { + this->insert(this->begin(), _value); + } + + void pop_front() + { + this->erase(this->begin() ); + } + + void sort() + { + bx::quickSort( + this->begin() + , uint32_t(this->end() - this->begin() ) + , sizeof(T) + , [](const void* _a, const void* _b) -> int32_t { + const T& lhs = *(const T*)(_a); + const T& rhs = *(const T*)(_b); + return lhs < rhs ? -1 : 1; + }); + } + }; + +} // namespace tinystl + namespace stl = tinystl; #else +# include # include # include # include @@ -176,18 +203,15 @@ namespace stl = std; # include #endif // BX_PLATFORM_* -#define BGFX_DEFAULT_WIDTH 1280 -#define BGFX_DEFAULT_HEIGHT 720 +#define BGFX_MAX_COMPUTE_BINDINGS BGFX_CONFIG_MAX_TEXTURE_SAMPLERS -#define BGFX_MAX_COMPUTE_BINDINGS 8 +#define BGFX_SAMPLER_INTERNAL_DEFAULT UINT32_C(0x10000000) +#define BGFX_SAMPLER_INTERNAL_SHARED UINT32_C(0x20000000) -#define BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER UINT32_C(0x10000000) -#define BGFX_TEXTURE_INTERNAL_SHARED UINT32_C(0x20000000) +#define BGFX_RESET_INTERNAL_FORCE UINT32_C(0x80000000) -#define BGFX_RESET_INTERNAL_FORCE UINT32_C(0x80000000) - -#define BGFX_STATE_INTERNAL_SCISSOR UINT64_C(0x2000000000000000) -#define BGFX_STATE_INTERNAL_OCCLUSION_QUERY UINT64_C(0x4000000000000000) +#define BGFX_STATE_INTERNAL_SCISSOR UINT64_C(0x2000000000000000) +#define BGFX_STATE_INTERNAL_OCCLUSION_QUERY UINT64_C(0x4000000000000000) #define BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE UINT8_C(0x80) @@ -280,6 +304,36 @@ namespace bgfx return 0 != _decl.m_stride; } + struct Condition + { + enum Enum + { + LessEqual, + GreaterEqual, + }; + }; + + bool windowsVersionIs(Condition::Enum _op, uint32_t _version); + + constexpr bool isShaderType(uint32_t _magic, char _type) + { + return uint32_t(_type) == (_magic & BX_MAKEFOURCC(0xff, 0, 0, 0) ); + } + + inline bool isShaderBin(uint32_t _magic) + { + return BX_MAKEFOURCC(0, 'S', 'H', 0) == (_magic & BX_MAKEFOURCC(0, 0xff, 0xff, 0) ) + && (isShaderType(_magic, 'C') || isShaderType(_magic, 'F') || isShaderType(_magic, 'V') ) + ; + } + + inline bool isShaderVerLess(uint32_t _magic, uint8_t _version) + { + return (_magic & BX_MAKEFOURCC(0, 0, 0, 0xff) ) < BX_MAKEFOURCC(0, 0, 0, _version); + } + + const char* getShaderTypeName(uint32_t _magic); + struct Clear { void set(uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) @@ -361,15 +415,14 @@ namespace bgfx void setIntersect(const Rect& _a, const Rect& _b) { - using namespace bx; - const uint16_t sx = uint16_max(_a.m_x, _b.m_x); - const uint16_t sy = uint16_max(_a.m_y, _b.m_y); - const uint16_t ex = uint16_min(_a.m_x + _a.m_width, _b.m_x + _b.m_width ); - const uint16_t ey = uint16_min(_a.m_y + _a.m_height, _b.m_y + _b.m_height); + const uint16_t sx = bx::max(_a.m_x, _b.m_x); + const uint16_t sy = bx::max(_a.m_y, _b.m_y); + const uint16_t ex = bx::min(_a.m_x + _a.m_width, _b.m_x + _b.m_width ); + const uint16_t ey = bx::min(_a.m_y + _a.m_height, _b.m_y + _b.m_height); m_x = sx; m_y = sy; - m_width = (uint16_t)uint32_satsub(ex, sx); - m_height = (uint16_t)uint32_satsub(ey, sy); + m_width = (uint16_t)bx::uint32_satsub(ex, sx); + m_height = (uint16_t)bx::uint32_satsub(ey, sy); } void intersect(const Rect& _a) @@ -419,10 +472,23 @@ namespace bgfx bool isGraphicsDebuggerPresent(); void release(const Memory* _mem); const char* getAttribName(Attrib::Enum _attr); + const char* getAttribNameShort(Attrib::Enum _attr); void getTextureSizeFromRatio(BackbufferRatio::Enum _ratio, uint16_t& _width, uint16_t& _height); TextureFormat::Enum getViableTextureFormat(const bimg::ImageContainer& _imageContainer); const char* getName(TextureFormat::Enum _fmt); const char* getName(UniformHandle _handle); + const char* getName(Topology::Enum _topology); + + template + inline void release(Ty) + { + } + + template<> + inline void release(Memory* _mem) + { + release( (const Memory*)_mem); + } inline uint32_t castfu(float _value) { @@ -443,9 +509,9 @@ namespace bgfx inline bool needBorderColor(uint32_t _flags) { - return BGFX_TEXTURE_U_BORDER == (_flags & BGFX_TEXTURE_U_BORDER) - || BGFX_TEXTURE_V_BORDER == (_flags & BGFX_TEXTURE_V_BORDER) - || BGFX_TEXTURE_W_BORDER == (_flags & BGFX_TEXTURE_W_BORDER) + return BGFX_SAMPLER_U_BORDER == (_flags & BGFX_SAMPLER_U_BORDER) + || BGFX_SAMPLER_V_BORDER == (_flags & BGFX_SAMPLER_V_BORDER) + || BGFX_SAMPLER_W_BORDER == (_flags & BGFX_SAMPLER_W_BORDER) ; } @@ -453,8 +519,8 @@ namespace bgfx { if (_hasMips) { - const uint32_t max = bx::uint32_max(bx::uint32_max(_width, _height), _depth); - const uint32_t num = 1 + uint32_t(bx::flog2(float(max) ) ); + const uint32_t max = bx::max(_width, _height, _depth); + const uint32_t num = 1 + uint32_t(bx::log2(float(max) ) ); return uint8_t(num); } @@ -462,6 +528,7 @@ namespace bgfx return 1; } + /// Dump vertex declaration into debug output. void dump(const VertexDecl& _decl); struct TextVideoMem @@ -473,7 +540,7 @@ namespace bgfx , m_height(0) , m_small(false) { - resize(); + resize(false, 1, 1); clear(); } @@ -482,7 +549,7 @@ namespace bgfx BX_FREE(g_allocator, m_mem); } - void resize(bool _small = false, uint32_t _width = BGFX_DEFAULT_WIDTH, uint32_t _height = BGFX_DEFAULT_HEIGHT) + void resize(bool _small, uint32_t _width, uint32_t _height) { uint32_t width = bx::uint32_imax(1, _width/8); uint32_t height = bx::uint32_imax(1, _height/(_small ? 8 : 16) ); @@ -497,25 +564,27 @@ namespace bgfx m_height = (uint16_t)height; uint32_t size = m_size; - m_size = m_width * m_height * 2; + m_size = m_width * m_height; - m_mem = (uint8_t*)BX_REALLOC(g_allocator, m_mem, m_size); + m_mem = (MemSlot*)BX_REALLOC(g_allocator, m_mem, m_size * sizeof(MemSlot)); if (size < m_size) { - bx::memSet(&m_mem[size], 0, m_size-size); + bx::memSet(&m_mem[size], 0, (m_size-size) * sizeof(MemSlot)); } } } void clear(uint8_t _attr = 0) { - uint8_t* mem = m_mem; - for (uint32_t ii = 0, num = m_size/2; ii < num; ++ii) + MemSlot* mem = m_mem; + bx::memSet(mem, 0, m_size * sizeof(MemSlot)); + if (_attr != 0) { - mem[0] = 0; - mem[1] = _attr; - mem += 2; + for (uint32_t ii = 0, num = m_size; ii < num; ++ii) + { + mem[ii].attribute = _attr; + } } } @@ -533,16 +602,33 @@ namespace bgfx { if (_x < m_width && _y < m_height) { - uint8_t* dst = &m_mem[(_y*m_width+_x)*2]; + MemSlot* dst = &m_mem[_y*m_width+_x]; const uint8_t* src = (const uint8_t*)_data; - const uint32_t width = (bx::uint32_min(m_width, _width +_x)-_x)*2; - const uint32_t height = bx::uint32_min(m_height, _height+_y)-_y; - const uint32_t dstPitch = m_width*2; - bx::memCopy(dst, src, width, height, _pitch, dstPitch); + const uint32_t width = bx::min(m_width, _width +_x)-_x; + const uint32_t height = bx::min(m_height, _height+_y)-_y; + const uint32_t dstPitch = m_width; + + for (uint32_t ii = 0; ii < height; ++ii) + { + for (uint32_t jj = 0; jj < width; ++jj) + { + dst[jj].character = src[jj*2]; + dst[jj].attribute = src[jj*2+1]; + } + + src += _pitch; + dst += dstPitch; + } } } - uint8_t* m_mem; + struct MemSlot + { + uint8_t attribute; + uint8_t character; + }; + + MemSlot* m_mem; uint32_t m_size; uint16_t m_width; uint16_t m_height; @@ -788,9 +874,9 @@ namespace bgfx }; // -#define SORK_KEY_NUM_BITS_VIEW 10 +#define SORT_KEY_NUM_BITS_VIEW 10 -#define SORT_KEY_VIEW_SHIFT (64-SORK_KEY_NUM_BITS_VIEW) +#define SORT_KEY_VIEW_SHIFT (64-SORT_KEY_NUM_BITS_VIEW) #define SORT_KEY_VIEW_MASK ( (uint64_t(BGFX_CONFIG_MAX_VIEWS-1) )<(&m_num, num, BGFX_CONFIG_MAX_MATRIX_CACHE - 1); BX_WARN(first+num < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache overflow. %d (max: %d)", first+num, BGFX_CONFIG_MAX_MATRIX_CACHE); - num = bx::uint32_min(num, BGFX_CONFIG_MAX_MATRIX_CACHE-1-first); + num = bx::min(num, BGFX_CONFIG_MAX_MATRIX_CACHE-1-first); *_num = (uint16_t)num; return first; } @@ -1199,9 +1294,11 @@ namespace bgfx public: static UniformBuffer* create(uint32_t _size = 1<<20) { - uint32_t size = BX_ALIGN_16(bx::uint32_max(_size, sizeof(UniformBuffer) ) ); - void* data = BX_ALLOC(g_allocator, size); - return BX_PLACEMENT_NEW(data, UniformBuffer)(_size); + const uint32_t structSize = sizeof(UniformBuffer)-sizeof(UniformBuffer::m_buffer); + + uint32_t size = BX_ALIGN_16(_size); + void* data = BX_ALLOC(g_allocator, size+structSize); + return BX_PLACEMENT_NEW(data, UniformBuffer)(size); } static void destroy(UniformBuffer* _uniformBuffer) @@ -1215,8 +1312,9 @@ namespace bgfx UniformBuffer* uniformBuffer = *_uniformBuffer; if (_treshold >= uniformBuffer->m_size - uniformBuffer->m_pos) { - uint32_t size = BX_ALIGN_16(bx::uint32_max(uniformBuffer->m_size + _grow, sizeof(UniformBuffer) ) ); - void* data = BX_REALLOC(g_allocator, uniformBuffer, size); + const uint32_t structSize = sizeof(UniformBuffer)-sizeof(UniformBuffer::m_buffer); + uint32_t size = BX_ALIGN_16(uniformBuffer->m_size + _grow); + void* data = BX_REALLOC(g_allocator, uniformBuffer, size+structSize); uniformBuffer = reinterpret_cast(data); uniformBuffer->m_size = size; @@ -1304,7 +1402,7 @@ namespace bgfx private: UniformBuffer(uint32_t _size) - : m_size(_size-sizeof(m_buffer) ) + : m_size(_size) , m_pos(0) { finish(); @@ -1316,12 +1414,11 @@ namespace bgfx uint32_t m_size; uint32_t m_pos; - char m_buffer[8]; + char m_buffer[256<<20]; }; struct UniformRegInfo { - const void* m_data; UniformHandle m_handle; }; @@ -1347,7 +1444,7 @@ namespace bgfx return NULL; } - const UniformRegInfo& add(UniformHandle _handle, const char* _name, const void* _data) + const UniformRegInfo& add(UniformHandle _handle, const char* _name) { BX_CHECK(isValid(_handle), "Uniform handle is invalid (name: %s)!", _name); const uint32_t key = bx::hash(_name); @@ -1355,7 +1452,6 @@ namespace bgfx m_uniforms.insert(key, _handle.idx); UniformRegInfo& info = m_info[_handle.idx]; - info.m_data = _data; info.m_handle = _handle; return info; @@ -1384,24 +1480,12 @@ namespace bgfx Count }; + uint32_t m_samplerFlags; uint16_t m_idx; uint8_t m_type; - - union - { - struct - { - uint32_t m_textureFlags; - } m_draw; - - struct - { - uint8_t m_format; - uint8_t m_access; - uint8_t m_mip; - } m_compute; - - } m_un; + uint8_t m_format; + uint8_t m_access; + uint8_t m_mip; }; struct Stream @@ -1427,7 +1511,7 @@ namespace bgfx Binding& bind = m_bind[ii]; bind.m_idx = kInvalidHandle; bind.m_type = 0; - bind.m_un.m_draw.m_textureFlags = 0; + bind.m_samplerFlags = 0; } }; @@ -1557,22 +1641,14 @@ namespace bgfx TextureHandle m_dst; }; - struct Resolution + struct IndexBuffer { - Resolution() - : m_width(BGFX_DEFAULT_WIDTH) - , m_height(BGFX_DEFAULT_HEIGHT) - , m_flags(BGFX_RESET_NONE) - { - } - - uint32_t m_width; - uint32_t m_height; - uint32_t m_flags; + uint32_t m_size; }; struct VertexBuffer { + uint32_t m_size; uint16_t m_stride; }; @@ -1611,10 +1687,10 @@ namespace bgfx void setRect(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) { - m_rect.m_x = (uint16_t)bx::uint32_imax(int16_t(_x), 0); - m_rect.m_y = (uint16_t)bx::uint32_imax(int16_t(_y), 0); - m_rect.m_width = bx::uint16_max(_width, 1); - m_rect.m_height = bx::uint16_max(_height, 1); + m_rect.m_x = uint16_t(bx::max(int16_t(_x), 0) ); + m_rect.m_y = uint16_t(bx::max(int16_t(_y), 0) ); + m_rect.m_width = bx::max(_width, 1); + m_rect.m_height = bx::max(_height, 1); } void setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) @@ -1695,6 +1771,18 @@ namespace bgfx m_rectCache.reset(); } + bool isZeroArea(const Rect& _rect, uint16_t _scissor) const + { + if (UINT16_MAX != _scissor) + { + Rect scissorRect; + scissorRect.setIntersect(_rect, m_rectCache.m_cache[_scissor]); + return scissorRect.isZeroArea(); + } + + return false; + } + MatrixCache m_matrixCache; RectCache m_rectCache; }; @@ -1704,7 +1792,6 @@ namespace bgfx Frame() : m_waitSubmit(0) , m_waitRender(0) - , m_hmdInitialized(false) , m_capture(false) { SortKey term; @@ -1723,9 +1810,15 @@ namespace bgfx void create() { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_uniformBuffer); ++ii) { - m_uniformBuffer[ii] = UniformBuffer::create(); + const uint32_t num = g_caps.limits.maxEncoders; + + m_uniformBuffer = (UniformBuffer**)BX_ALLOC(g_allocator, sizeof(UniformBuffer*)*num); + + for (uint32_t ii = 0; ii < num; ++ii) + { + m_uniformBuffer[ii] = UniformBuffer::create(); + } } reset(); @@ -1735,10 +1828,12 @@ namespace bgfx void destroy() { - for (uint32_t ii = 0; ii < BX_COUNTOF(m_uniformBuffer); ++ii) + for (uint32_t ii = 0, num = g_caps.limits.maxEncoders; ii < num; ++ii) { UniformBuffer::destroy(m_uniformBuffer[ii]); } + + BX_FREE(g_allocator, m_uniformBuffer); BX_DELETE(g_allocator, m_textVideoMem); } @@ -1751,6 +1846,9 @@ namespace bgfx void start() { + m_perfStats.transientVbUsed = m_vboffset; + m_perfStats.transientIbUsed = m_iboffset; + m_frameCache.reset(); m_numRenderItems = 0; m_numBlitItems = 0; @@ -1782,7 +1880,7 @@ namespace bgfx { uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) ); uint32_t iboffset = offset + _num*sizeof(uint16_t); - iboffset = bx::uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE); + iboffset = bx::min(iboffset, g_caps.limits.transientIbSize); uint32_t num = (iboffset-offset)/sizeof(uint16_t); return num; } @@ -1801,7 +1899,7 @@ namespace bgfx { uint32_t offset = bx::strideAlign(m_vboffset, _stride); uint32_t vboffset = offset + _num * _stride; - vboffset = bx::uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE); + vboffset = bx::min(vboffset, g_caps.limits.transientVbSize); uint32_t num = (vboffset-offset)/_stride; return num; } @@ -1884,7 +1982,7 @@ namespace bgfx BlitItem m_blitItem[BGFX_CONFIG_MAX_BLIT_ITEMS+1]; FrameCache m_frameCache; - UniformBuffer* m_uniformBuffer[BGFX_CONFIG_MAX_ENCODERS]; + UniformBuffer** m_uniformBuffer; uint32_t m_numRenderItems; uint16_t m_numBlitItems; @@ -1966,7 +2064,6 @@ namespace bgfx FreeHandle m_freeUniform; TextVideoMem* m_textVideoMem; - HMD m_hmd; Stats m_perfStats; ViewStats m_viewStats[BGFX_CONFIG_MAX_VIEWS]; @@ -1974,7 +2071,6 @@ namespace bgfx int64_t m_waitSubmit; int64_t m_waitRender; - bool m_hmdInitialized; bool m_capture; }; @@ -2103,11 +2199,12 @@ namespace bgfx , BGFX_CONFIG_MAX_MATRIX_CACHE ); m_draw.m_startMatrix = _cache; - m_draw.m_numMatrices = uint16_t(bx::uint32_min(_cache+_num, BGFX_CONFIG_MAX_MATRIX_CACHE-1) - _cache); + m_draw.m_numMatrices = uint16_t(bx::min(_cache+_num, BGFX_CONFIG_MAX_MATRIX_CACHE-1) - _cache); } void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) { + BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); m_draw.m_startIndex = _firstIndex; m_draw.m_numIndices = _numIndices; m_draw.m_indexBuffer = _handle; @@ -2115,15 +2212,17 @@ namespace bgfx void setIndexBuffer(const DynamicIndexBuffer& _dib, uint32_t _firstIndex, uint32_t _numIndices) { + BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); const uint32_t indexSize = 0 == (_dib.m_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; m_draw.m_startIndex = _dib.m_startIndex + _firstIndex; - m_draw.m_numIndices = bx::uint32_min(_numIndices, _dib.m_size/indexSize); + m_draw.m_numIndices = bx::min(_numIndices, _dib.m_size/indexSize); m_draw.m_indexBuffer = _dib.m_handle; } void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) { - const uint32_t numIndices = bx::uint32_min(_numIndices, _tib->size/2); + BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); + const uint32_t numIndices = bx::min(_numIndices, _tib->size/2); m_draw.m_indexBuffer = _tib->handle; m_draw.m_startIndex = _tib->startIndex + _firstIndex; m_draw.m_numIndices = numIndices; @@ -2132,6 +2231,7 @@ namespace bgfx void setVertexBuffer(uint8_t _stream, VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices) { + BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); if (m_draw.setStreamBit(_stream, _handle) ) { @@ -2145,6 +2245,7 @@ namespace bgfx void setVertexBuffer(uint8_t _stream, const DynamicVertexBuffer& _dvb, uint32_t _startVertex, uint32_t _numVertices) { + BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); if (m_draw.setStreamBit(_stream, _dvb.m_handle) ) { @@ -2153,13 +2254,14 @@ namespace bgfx stream.m_handle = _dvb.m_handle; stream.m_decl = _dvb.m_decl; m_numVertices[_stream] = - bx::uint32_min(bx::uint32_imax(0, _dvb.m_numVertices - _startVertex), _numVertices) + bx::min(bx::uint32_imax(0, _dvb.m_numVertices - _startVertex), _numVertices) ; } } void setVertexBuffer(uint8_t _stream, const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) { + BX_CHECK(UINT8_MAX != m_draw.m_streamMask, ""); BX_CHECK(_stream < BGFX_CONFIG_MAX_VERTEX_STREAMS, "Invalid stream %d (max %d).", _stream, BGFX_CONFIG_MAX_VERTEX_STREAMS); if (m_draw.setStreamBit(_stream, _tvb->handle) ) { @@ -2168,16 +2270,29 @@ namespace bgfx stream.m_handle = _tvb->handle; stream.m_decl = _tvb->decl; m_numVertices[_stream] = - bx::uint32_min(bx::uint32_imax(0, _tvb->size/_tvb->stride - _startVertex), _numVertices) + bx::min(bx::uint32_imax(0, _tvb->size/_tvb->stride - _startVertex), _numVertices) ; } } - void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _num) + void setVertexCount(uint32_t _numVertices) { - m_draw.m_instanceDataOffset = _idb->offset; + BX_CHECK(0 == m_draw.m_streamMask, "Vertex buffer already set."); + m_draw.m_streamMask = UINT8_MAX; + Stream& stream = m_draw.m_stream[0]; + stream.m_startVertex = 0; + stream.m_handle.idx = kInvalidHandle; + stream.m_decl.idx = kInvalidHandle; + m_numVertices[0] = _numVertices; + } + + void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint32_t _start, uint32_t _num) + { + const uint32_t start = bx::min(_start, _idb->num); + const uint32_t num = bx::min(_idb->num - start, _num); + m_draw.m_instanceDataOffset = _idb->offset + start*_idb->stride; m_draw.m_instanceDataStride = _idb->stride; - m_draw.m_numInstances = bx::uint32_min(_idb->num, _num); + m_draw.m_numInstances = num; m_draw.m_instanceDataBuffer = _idb->handle; } @@ -2189,13 +2304,19 @@ namespace bgfx m_draw.m_instanceDataBuffer = _handle; } + void setInstanceCount(uint32_t _numInstances) + { + BX_CHECK(!isValid(m_draw.m_instanceDataBuffer), "Instance buffer already set."); + m_draw.m_numInstances = _numInstances; + } + void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) { Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::Texture); - bind.m_un.m_draw.m_textureFlags = (_flags&BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER) - ? BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER + bind.m_samplerFlags = (_flags&BGFX_SAMPLER_INTERNAL_DEFAULT) + ? BGFX_SAMPLER_INTERNAL_DEFAULT : _flags ; @@ -2211,9 +2332,9 @@ namespace bgfx Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::IndexBuffer); - bind.m_un.m_compute.m_format = 0; - bind.m_un.m_compute.m_access = uint8_t(_access); - bind.m_un.m_compute.m_mip = 0; + bind.m_format = 0; + bind.m_access = uint8_t(_access); + bind.m_mip = 0; } void setBuffer(uint8_t _stage, VertexBufferHandle _handle, Access::Enum _access) @@ -2221,25 +2342,19 @@ namespace bgfx Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::VertexBuffer); - bind.m_un.m_compute.m_format = 0; - bind.m_un.m_compute.m_access = uint8_t(_access); - bind.m_un.m_compute.m_mip = 0; + bind.m_format = 0; + bind.m_access = uint8_t(_access); + bind.m_mip = 0; } - void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) + void setImage(uint8_t _stage, TextureHandle _handle, uint8_t _mip, Access::Enum _access, TextureFormat::Enum _format) { Binding& bind = m_bind.m_bind[_stage]; bind.m_idx = _handle.idx; bind.m_type = uint8_t(Binding::Image); - bind.m_un.m_compute.m_format = uint8_t(_format); - bind.m_un.m_compute.m_access = uint8_t(_access); - bind.m_un.m_compute.m_mip = _mip; - - if (isValid(_sampler) ) - { - uint32_t stage = _stage; - setUniform(UniformType::Int1, _sampler, &stage, 1); - } + bind.m_format = uint8_t(_format); + bind.m_access = uint8_t(_access); + bind.m_mip = _mip; } void discard() @@ -2255,9 +2370,9 @@ namespace bgfx m_bind.clear(); } - void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, int32_t _depth, bool _preserveState); + void submit(ViewId _id, ProgramHandle _program, OcclusionQueryHandle _occlusionQuery, uint32_t _depth, bool _preserveState); - void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, int32_t _depth, bool _preserveState) + void submit(ViewId _id, ProgramHandle _program, IndirectBufferHandle _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, bool _preserveState) { m_draw.m_startIndirect = _start; m_draw.m_numIndirect = _num; @@ -2371,8 +2486,7 @@ namespace bgfx } } - VertexDeclHandle invalid = BGFX_INVALID_HANDLE; - return invalid; + return BGFX_INVALID_HANDLE; } VertexDeclHandle release(VertexBufferHandle _handle) @@ -2442,6 +2556,8 @@ namespace bgfx uint64_t alloc(uint32_t _size) { + _size = bx::max(_size, 16u); + for (FreeList::iterator it = m_free.begin(), itEnd = m_free.end(); it != itEnd; ++it) { if (it->m_size >= _size) @@ -2517,7 +2633,7 @@ namespace bgfx uint32_t m_size; }; - typedef std::list FreeList; + typedef stl::list FreeList; FreeList m_free; typedef stl::unordered_map UsedList; @@ -2530,34 +2646,34 @@ namespace bgfx virtual RendererType::Enum getRendererType() const = 0; virtual const char* getRendererName() const = 0; virtual bool isDeviceRemoved() = 0; - virtual void flip(HMD& _hmd) = 0; - virtual void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) = 0; + virtual void flip() = 0; + virtual void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) = 0; virtual void destroyIndexBuffer(IndexBufferHandle _handle) = 0; virtual void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) = 0; virtual void destroyVertexDecl(VertexDeclHandle _handle) = 0; - virtual void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) = 0; + virtual void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) = 0; virtual void destroyVertexBuffer(VertexBufferHandle _handle) = 0; virtual void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size, uint16_t _flags) = 0; - virtual void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) = 0; + virtual void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) = 0; virtual void destroyDynamicIndexBuffer(IndexBufferHandle _handle) = 0; virtual void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size, uint16_t _flags) = 0; - virtual void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) = 0; + virtual void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) = 0; virtual void destroyDynamicVertexBuffer(VertexBufferHandle _handle) = 0; - virtual void createShader(ShaderHandle _handle, Memory* _mem) = 0; + virtual void createShader(ShaderHandle _handle, const Memory* _mem) = 0; virtual void destroyShader(ShaderHandle _handle) = 0; virtual void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) = 0; virtual void destroyProgram(ProgramHandle _handle) = 0; - virtual void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) = 0; + virtual void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) = 0; virtual void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) = 0; virtual void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) = 0; virtual void updateTextureEnd() = 0; virtual void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) = 0; - virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) = 0; + virtual void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) = 0; virtual void overrideInternal(TextureHandle _handle, uintptr_t _ptr) = 0; virtual uintptr_t getInternal(TextureHandle _handle) = 0; virtual void destroyTexture(TextureHandle _handle) = 0; virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const Attachment* _attachment) = 0; - virtual void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) = 0; + virtual void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) = 0; virtual void destroyFrameBuffer(FrameBufferHandle _handle) = 0; virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0; virtual void destroyUniform(UniformHandle _handle) = 0; @@ -2595,6 +2711,8 @@ namespace bgfx , m_colorPaletteDirty(0) , m_frames(0) , m_debug(BGFX_DEBUG_NONE) + , m_rtMemoryUsed(0) + , m_textureMemoryUsed(0) , m_renderCtx(NULL) , m_renderMain(NULL) , m_renderNoop(NULL) @@ -2619,7 +2737,7 @@ namespace bgfx } // game thread - bool init(RendererType::Enum _type); + bool init(const Init& _init); void shutdown(); CommandBuffer& getCommandBuffer(CommandBuffer::Enum _cmd) @@ -2630,7 +2748,7 @@ namespace bgfx return cmdbuf; } - BGFX_API_FUNC(void reset(uint32_t _width, uint32_t _height, uint32_t _flags) ) + BGFX_API_FUNC(void reset(uint32_t _width, uint32_t _height, uint32_t _flags, TextureFormat::Enum _format) ) { BX_WARN(g_caps.limits.maxTextureSize >= _width && g_caps.limits.maxTextureSize >= _height @@ -2639,9 +2757,10 @@ namespace bgfx , _width , _height ); - m_resolution.m_width = bx::uint32_clamp(_width, 1, g_caps.limits.maxTextureSize); - m_resolution.m_height = bx::uint32_clamp(_height, 1, g_caps.limits.maxTextureSize); - m_resolution.m_flags = 0 + m_init.resolution.format = TextureFormat::Count != _format ? _format : m_init.resolution.format; + m_init.resolution.width = bx::clamp(_width, 1u, g_caps.limits.maxTextureSize); + m_init.resolution.height = bx::clamp(_height, 1u, g_caps.limits.maxTextureSize); + m_init.resolution.reset = 0 | _flags | (g_platformDataChangedSinceReset ? BGFX_RESET_INTERNAL_FORCE : 0) ; @@ -2662,11 +2781,12 @@ namespace bgfx { TextureHandle handle = { textureIdx }; resizeTexture(handle - , uint16_t(m_resolution.m_width) - , uint16_t(m_resolution.m_height) + , uint16_t(m_init.resolution.width) + , uint16_t(m_init.resolution.height) , textureRef.m_numMips + , textureRef.m_numLayers ); - m_resolution.m_flags |= BGFX_RESET_INTERNAL_FORCE; + m_init.resolution.reset |= BGFX_RESET_INTERNAL_FORCE; } } } @@ -2680,7 +2800,7 @@ namespace bgfx { BGFX_MUTEX_SCOPE(m_resourceApiLock); - m_submit->m_textVideoMem->resize(_small, (uint16_t)m_resolution.m_width, (uint16_t)m_resolution.m_height); + m_submit->m_textVideoMem->resize(_small, (uint16_t)m_init.resolution.width, (uint16_t)m_init.resolution.height); m_submit->m_textVideoMem->clear(_attr); } @@ -2698,30 +2818,34 @@ namespace bgfx m_submit->m_textVideoMem->image(_x, _y, _width, _height, _data, _pitch); } - BGFX_API_FUNC(const HMD* getHMD() ) - { - BGFX_MUTEX_SCOPE(m_resourceApiLock); - - if (m_submit->m_hmdInitialized) - { - return &m_submit->m_hmd; - } - - return NULL; - } - BGFX_API_FUNC(const Stats* getPerfStats() ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); Stats& stats = m_submit->m_perfStats; const Resolution& resolution = m_submit->m_resolution; - stats.width = uint16_t(resolution.m_width); - stats.height = uint16_t(resolution.m_height); + stats.width = uint16_t(resolution.width); + stats.height = uint16_t(resolution.height); const TextVideoMem* tvm = m_submit->m_textVideoMem; stats.textWidth = tvm->m_width; stats.textHeight = tvm->m_height; stats.encoderStats = m_encoderStats; + + stats.numDynamicIndexBuffers = m_dynamicIndexBufferHandle.getNumHandles(); + stats.numDynamicVertexBuffers = m_dynamicVertexBufferHandle.getNumHandles(); + stats.numFrameBuffers = m_frameBufferHandle.getNumHandles(); + stats.numIndexBuffers = m_indexBufferHandle.getNumHandles(); + stats.numOcclusionQueries = m_occlusionQueryHandle.getNumHandles(); + stats.numPrograms = m_programHandle.getNumHandles(); + stats.numShaders = m_shaderHandle.getNumHandles(); + stats.numTextures = m_textureHandle.getNumHandles(); + stats.numUniforms = m_uniformHandle.getNumHandles(); + stats.numVertexBuffers = m_vertexBufferHandle.getNumHandles(); + stats.numVertexDecls = m_vertexDeclHandle.getNumHandles(); + + stats.textureMemoryUsed = m_textureMemoryUsed; + stats.rtMemoryUsed = m_rtMemoryUsed; + return &stats; } @@ -2734,6 +2858,9 @@ namespace bgfx BX_WARN(isValid(handle), "Failed to allocate index buffer handle."); if (isValid(handle) ) { + IndexBuffer& ib = m_indexBuffers[handle.idx]; + ib.m_size = _mem->size; + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateIndexBuffer); cmdbuf.write(handle); cmdbuf.write(_mem); @@ -2797,7 +2924,9 @@ namespace bgfx m_declRef.add(handle, declHandle, _decl.m_hash); - m_vertexBuffers[handle.idx].m_stride = _decl.m_stride; + VertexBuffer& vb = m_vertexBuffers[handle.idx]; + vb.m_size = _mem->size; + vb.m_stride = _decl.m_stride; CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexBuffer); cmdbuf.write(handle); @@ -2848,10 +2977,13 @@ namespace bgfx BX_WARN(isValid(indexBufferHandle), "Failed to allocate index buffer handle."); if (!isValid(indexBufferHandle) ) { - return ptr; + return NonLocalAllocator::kInvalidBlock; } - uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE, _size); + const uint32_t allocSize = bx::max(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE, _size); + + IndexBuffer& ib = m_indexBuffers[indexBufferHandle.idx]; + ib.m_size = allocSize; CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer); cmdbuf.write(indexBufferHandle); @@ -2869,19 +3001,29 @@ namespace bgfx { BGFX_MUTEX_SCOPE(m_resourceApiLock); - DynamicIndexBufferHandle handle = BGFX_INVALID_HANDLE; + DynamicIndexBufferHandle handle = { m_dynamicIndexBufferHandle.alloc() }; + BX_WARN(isValid(handle), "Failed to allocate dynamic index buffer handle."); + if (!isValid(handle) ) + { + return handle; + } + const uint32_t indexSize = 0 == (_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; uint32_t size = BX_ALIGN_16(_num*indexSize); uint64_t ptr = 0; - if (0 != (_flags & BGFX_BUFFER_COMPUTE_WRITE) ) + if (0 != (_flags & BGFX_BUFFER_COMPUTE_READ_WRITE) ) { IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() }; if (!isValid(indexBufferHandle) ) { - return handle; + m_dynamicIndexBufferHandle.free(handle.idx); + return BGFX_INVALID_HANDLE; } + IndexBuffer& ib = m_indexBuffers[indexBufferHandle.idx]; + ib.m_size = size; + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer); cmdbuf.write(indexBufferHandle); cmdbuf.write(size); @@ -2894,17 +3036,11 @@ namespace bgfx ptr = allocDynamicIndexBuffer(size, _flags); if (ptr == NonLocalAllocator::kInvalidBlock) { - return handle; + m_dynamicIndexBufferHandle.free(handle.idx); + return BGFX_INVALID_HANDLE; } } - handle.idx = m_dynamicIndexBufferHandle.alloc(); - BX_WARN(isValid(handle), "Failed to allocate dynamic index buffer handle."); - if (!isValid(handle) ) - { - return handle; - } - DynamicIndexBuffer& dib = m_dynamicIndexBuffers[handle.idx]; dib.m_handle.idx = uint16_t(ptr>>32); dib.m_offset = uint32_t(ptr); @@ -2923,26 +3059,25 @@ namespace bgfx const uint32_t indexSize = 0 == (_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; DynamicIndexBufferHandle handle = createDynamicIndexBuffer(_mem->size/indexSize, _flags); - if (isValid(handle) ) - { - updateDynamicIndexBuffer(handle, 0, _mem); - } - else + if (!isValid(handle) ) { release(_mem); + return BGFX_INVALID_HANDLE; } + update(handle, 0, _mem); + return handle; } - BGFX_API_FUNC(void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _startIndex, const Memory* _mem) ) + BGFX_API_FUNC(void update(DynamicIndexBufferHandle _handle, uint32_t _startIndex, const Memory* _mem) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); BGFX_CHECK_HANDLE("updateDynamicIndexBuffer", m_dynamicIndexBufferHandle, _handle); DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx]; - BX_CHECK(0 == (dib.m_flags & BGFX_BUFFER_COMPUTE_READ_WRITE), "Can't update GPU buffer from CPU."); + BX_CHECK(0 == (dib.m_flags & BGFX_BUFFER_COMPUTE_WRITE), "Can't update GPU buffer from CPU."); const uint32_t indexSize = 0 == (dib.m_flags & BGFX_BUFFER_INDEX32) ? 2 : 4; if (dib.m_size < _mem->size @@ -2958,10 +3093,10 @@ namespace bgfx dib.m_startIndex = bx::strideAlign(dib.m_offset, indexSize)/indexSize; } - uint32_t offset = (dib.m_startIndex + _startIndex)*indexSize; - uint32_t size = bx::uint32_min(offset - + bx::uint32_min(bx::uint32_satsub(dib.m_size, _startIndex*indexSize), _mem->size) - , BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE) - offset + const uint32_t offset = (dib.m_startIndex + _startIndex)*indexSize; + const uint32_t size = bx::min(offset + + bx::min(bx::uint32_satsub(dib.m_size, _startIndex*indexSize), _mem->size) + , m_indexBuffers[dib.m_handle.idx].m_size) - offset ; BX_CHECK(_mem->size <= size, "Truncating dynamic index buffer update (size %d, mem size %d)." , size @@ -2987,7 +3122,7 @@ namespace bgfx { DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx]; - if (0 != (dib.m_flags & BGFX_BUFFER_COMPUTE_WRITE) ) + if (0 != (dib.m_flags & BGFX_BUFFER_COMPUTE_READ_WRITE) ) { destroyIndexBuffer(dib.m_handle); } @@ -3013,14 +3148,17 @@ namespace bgfx if (ptr == NonLocalAllocator::kInvalidBlock) { VertexBufferHandle vertexBufferHandle = { m_vertexBufferHandle.alloc() }; - BX_WARN(isValid(vertexBufferHandle), "Failed to allocate dynamic vertex buffer handle."); if (!isValid(vertexBufferHandle) ) { return NonLocalAllocator::kInvalidBlock; } - uint32_t allocSize = bx::uint32_max(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size); + const uint32_t allocSize = bx::max(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE, _size); + + VertexBuffer& vb = m_vertexBuffers[vertexBufferHandle.idx]; + vb.m_size = allocSize; + vb.m_stride = 0; CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer); cmdbuf.write(vertexBufferHandle); @@ -3038,7 +3176,20 @@ namespace bgfx { BGFX_MUTEX_SCOPE(m_resourceApiLock); - DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE; + VertexDeclHandle declHandle = findVertexDecl(_decl); + if (!isValid(declHandle) ) + { + BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); + return BGFX_INVALID_HANDLE; + } + + DynamicVertexBufferHandle handle = { m_dynamicVertexBufferHandle.alloc() }; + if (!isValid(handle) ) + { + BX_TRACE("WARNING: Failed to allocate dynamic vertex buffer handle (BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS, max: %d).", BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS); + return BGFX_INVALID_HANDLE; + } + uint32_t size = bx::strideAlign16(_num*_decl.m_stride, _decl.m_stride); uint64_t ptr = 0; @@ -3047,10 +3198,15 @@ namespace bgfx VertexBufferHandle vertexBufferHandle = { m_vertexBufferHandle.alloc() }; if (!isValid(vertexBufferHandle) ) { + m_dynamicVertexBufferHandle.free(handle.idx); BX_TRACE("WARNING: Failed to allocate vertex buffer handle (BGFX_CONFIG_MAX_VERTEX_BUFFERS, max: %d).", BGFX_CONFIG_MAX_VERTEX_BUFFERS); - return handle; + return BGFX_INVALID_HANDLE; } + VertexBuffer& vb = m_vertexBuffers[vertexBufferHandle.idx]; + vb.m_size = size; + vb.m_stride = 0; + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer); cmdbuf.write(vertexBufferHandle); cmdbuf.write(size); @@ -3063,24 +3219,11 @@ namespace bgfx ptr = allocDynamicVertexBuffer(size, _flags); if (ptr == NonLocalAllocator::kInvalidBlock) { - return handle; + m_dynamicVertexBufferHandle.free(handle.idx); + return BGFX_INVALID_HANDLE; } } - VertexDeclHandle declHandle = findVertexDecl(_decl); - if (!isValid(declHandle) ) - { - BX_TRACE("WARNING: Failed to allocate vertex decl handle (BGFX_CONFIG_MAX_VERTEX_DECLS, max: %d).", BGFX_CONFIG_MAX_VERTEX_DECLS); - return handle; - } - - handle.idx = m_dynamicVertexBufferHandle.alloc(); - if (!isValid(handle) ) - { - BX_TRACE("WARNING: Failed to allocate dynamic vertex buffer handle (BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS, max: %d).", BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS); - return handle; - } - DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[handle.idx]; dvb.m_handle.idx = uint16_t(ptr>>32); dvb.m_offset = uint32_t(ptr); @@ -3102,19 +3245,18 @@ namespace bgfx uint32_t numVertices = _mem->size/_decl.m_stride; DynamicVertexBufferHandle handle = createDynamicVertexBuffer(numVertices, _decl, _flags); - if (isValid(handle) ) - { - updateDynamicVertexBuffer(handle, 0, _mem); - } - else + if (!isValid(handle) ) { release(_mem); + return BGFX_INVALID_HANDLE; } + update(handle, 0, _mem); + return handle; } - BGFX_API_FUNC(void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _startVertex, const Memory* _mem) ) + BGFX_API_FUNC(void update(DynamicVertexBufferHandle _handle, uint32_t _startVertex, const Memory* _mem) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -3137,10 +3279,10 @@ namespace bgfx dvb.m_startVertex = bx::strideAlign(dvb.m_offset, dvb.m_stride)/dvb.m_stride; } - uint32_t offset = (dvb.m_startVertex + _startVertex)*dvb.m_stride; - uint32_t size = bx::uint32_min(offset - + bx::uint32_min(bx::uint32_satsub(dvb.m_size, _startVertex*dvb.m_stride), _mem->size) - , BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE) - offset + const uint32_t offset = (dvb.m_startVertex + _startVertex)*dvb.m_stride; + const uint32_t size = bx::min(offset + + bx::min(bx::uint32_satsub(dvb.m_size, _startVertex*dvb.m_stride), _mem->size) + , m_vertexBuffers[dvb.m_handle.idx].m_size) - offset ; BX_CHECK(_mem->size <= size, "Truncating dynamic vertex buffer update (size %d, mem size %d)." , size @@ -3336,6 +3478,8 @@ namespace bgfx BGFX_API_FUNC(void allocInstanceDataBuffer(InstanceDataBuffer* _idb, uint32_t _num, uint16_t _stride) ) { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + uint16_t stride = BX_ALIGN_16(_stride); uint32_t offset = m_submit->allocTransientVertexBuffer(_num, stride); @@ -3391,24 +3535,38 @@ namespace bgfx if (!err.isOk() ) { - ShaderHandle invalid = BGFX_INVALID_HANDLE; + BX_TRACE("Couldn't read shader signature!"); release(_mem); - return invalid; + return BGFX_INVALID_HANDLE; } - if (BGFX_CHUNK_MAGIC_CSH != magic - && BGFX_CHUNK_MAGIC_FSH != magic - && BGFX_CHUNK_MAGIC_VSH != magic) + if (!isShaderBin(magic) ) { - BX_WARN(false, "Invalid shader signature! %c%c%c%d." + BX_TRACE("Invalid shader signature! %c%c%c%d." , ( (uint8_t*)&magic)[0] , ( (uint8_t*)&magic)[1] , ( (uint8_t*)&magic)[2] , ( (uint8_t*)&magic)[3] ); - ShaderHandle invalid = BGFX_INVALID_HANDLE; release(_mem); - return invalid; + return BGFX_INVALID_HANDLE; + } + + if (isShaderType(magic, 'C') + && 0 == (g_caps.supported & BGFX_CAPS_COMPUTE) ) + { + BX_TRACE("Creating compute shader but compute is not supported!"); + release(_mem); + return BGFX_INVALID_HANDLE; + } + + if ( (isShaderType(magic, 'C') && isShaderVerLess(magic, 3) ) + || (isShaderType(magic, 'F') && isShaderVerLess(magic, 5) ) + || (isShaderType(magic, 'V') && isShaderVerLess(magic, 5) ) ) + { + BX_TRACE("Unsupported shader binary version."); + release(_mem); + return BGFX_INVALID_HANDLE; } const uint32_t shaderHash = bx::hash(_mem->data, _mem->size); @@ -3421,74 +3579,92 @@ namespace bgfx return handle; } - ShaderHandle handle = { m_shaderHandle.alloc() }; + uint32_t hashIn; + bx::read(&reader, hashIn, &err); - BX_WARN(isValid(handle), "Failed to allocate shader handle."); - if (isValid(handle) ) + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) { - bool ok = m_shaderHashMap.insert(shaderHash, handle.idx); - BX_CHECK(ok, "Shader already exists!"); BX_UNUSED(ok); - - uint32_t iohash; - bx::read(&reader, iohash); - - uint16_t count; - bx::read(&reader, count); - - ShaderRef& sr = m_shaderRef[handle.idx]; - sr.m_refCount = 1; - sr.m_hash = iohash; - sr.m_num = 0; - sr.m_uniforms = NULL; - - UniformHandle* uniforms = (UniformHandle*)alloca(count*sizeof(UniformHandle) ); - - for (uint32_t ii = 0; ii < count; ++ii) - { - uint8_t nameSize = 0; - bx::read(&reader, nameSize); - - char name[256]; - bx::read(&reader, &name, nameSize); - name[nameSize] = '\0'; - - uint8_t type = 0; - bx::read(&reader, type); - type &= ~BGFX_UNIFORM_MASK; - - uint8_t num; - bx::read(&reader, num); - - uint16_t regIndex; - bx::read(&reader, regIndex); - - uint16_t regCount; - bx::read(&reader, regCount); - - PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name); - if (PredefinedUniform::Count == predefined) - { - uniforms[sr.m_num] = createUniform(name, UniformType::Enum(type), regCount); - sr.m_num++; - } - } - - if (0 != sr.m_num) - { - uint32_t size = sr.m_num*sizeof(UniformHandle); - sr.m_uniforms = (UniformHandle*)BX_ALLOC(g_allocator, size); - bx::memCopy(sr.m_uniforms, uniforms, size); - } - - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateShader); - cmdbuf.write(handle); - cmdbuf.write(_mem); + hashOut = hashIn; } else { - release(_mem); + bx::read(&reader, hashOut, &err); } + uint16_t count; + bx::read(&reader, count, &err); + + if (!err.isOk() ) + { + BX_TRACE("Corrupted shader binary!"); + release(_mem); + return BGFX_INVALID_HANDLE; + } + + ShaderHandle handle = { m_shaderHandle.alloc() }; + + if (!isValid(handle) ) + { + BX_TRACE("Failed to allocate shader handle."); + release(_mem); + return BGFX_INVALID_HANDLE; + } + + bool ok = m_shaderHashMap.insert(shaderHash, handle.idx); + BX_CHECK(ok, "Shader already exists!"); BX_UNUSED(ok); + + ShaderRef& sr = m_shaderRef[handle.idx]; + sr.m_refCount = 1; + sr.m_hashIn = hashIn; + sr.m_hashOut = hashOut; + sr.m_num = 0; + sr.m_uniforms = NULL; + + UniformHandle* uniforms = (UniformHandle*)alloca(count*sizeof(UniformHandle) ); + + for (uint32_t ii = 0; ii < count; ++ii) + { + uint8_t nameSize = 0; + bx::read(&reader, nameSize, &err); + + char name[256]; + bx::read(&reader, &name, nameSize, &err); + name[nameSize] = '\0'; + + uint8_t type = 0; + bx::read(&reader, type, &err); + type &= ~BGFX_UNIFORM_MASK; + + uint8_t num; + bx::read(&reader, num, &err); + + uint16_t regIndex; + bx::read(&reader, regIndex, &err); + + uint16_t regCount; + bx::read(&reader, regCount, &err); + + PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name); + if (PredefinedUniform::Count == predefined) + { + uniforms[sr.m_num] = createUniform(name, UniformType::Enum(type), regCount); + sr.m_num++; + } + } + + if (0 != sr.m_num) + { + uint32_t size = sr.m_num*sizeof(UniformHandle); + sr.m_uniforms = (UniformHandle*)BX_ALLOC(g_allocator, size); + bx::memCopy(sr.m_uniforms, uniforms, size); + } + + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateShader); + cmdbuf.write(handle); + cmdbuf.write(_mem); + return handle; } @@ -3505,22 +3681,23 @@ namespace bgfx ShaderRef& sr = m_shaderRef[_handle.idx]; if (NULL != _uniforms) { - bx::memCopy(_uniforms, sr.m_uniforms, bx::uint16_min(_max, sr.m_num)*sizeof(UniformHandle) ); + bx::memCopy(_uniforms, sr.m_uniforms, bx::min(_max, sr.m_num)*sizeof(UniformHandle) ); } return sr.m_num; } - void setName(Handle _handle, const char* _name) + void setName(Handle _handle, const bx::StringView& _name) { CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::SetName); cmdbuf.write(_handle); - uint16_t len = (uint8_t)bx::strLen(_name)+1; + uint16_t len = uint16_t(_name.getLength()+1); cmdbuf.write(len); - cmdbuf.write(_name, len); + cmdbuf.write(_name.getPtr(), len-1); + cmdbuf.write('\0'); } - BGFX_API_FUNC(void setName(ShaderHandle _handle, const char* _name) ) + BGFX_API_FUNC(void setName(ShaderHandle _handle, const bx::StringView& _name) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -3594,8 +3771,7 @@ namespace bgfx || !isValid(_fsh) ) { BX_TRACE("Vertex/fragment shader is invalid (vsh %d, fsh %d).", _vsh.idx, _fsh.idx); - ProgramHandle invalid = BGFX_INVALID_HANDLE; - return invalid; + return BGFX_INVALID_HANDLE; } ProgramHandle handle = { m_programHashMap.find(uint32_t(_fsh.idx<<16)|_vsh.idx) }; @@ -3610,11 +3786,10 @@ namespace bgfx { const ShaderRef& vsr = m_shaderRef[_vsh.idx]; const ShaderRef& fsr = m_shaderRef[_fsh.idx]; - if (vsr.m_hash != fsr.m_hash) + if (vsr.m_hashOut != fsr.m_hashIn) { BX_TRACE("Vertex shader output doesn't match fragment shader input."); - ProgramHandle invalid = BGFX_INVALID_HANDLE; - return invalid; + return BGFX_INVALID_HANDLE; } handle.idx = m_programHandle.alloc(); @@ -3656,8 +3831,7 @@ namespace bgfx if (!isValid(_vsh) ) { BX_WARN(false, "Compute shader is invalid (vsh %d).", _vsh.idx); - ProgramHandle invalid = BGFX_INVALID_HANDLE; - return invalid; + return BGFX_INVALID_HANDLE; } ProgramHandle handle = { m_programHashMap.find(_vsh.idx) }; @@ -3728,7 +3902,7 @@ namespace bgfx } } - BGFX_API_FUNC(TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info, BackbufferRatio::Enum _ratio) ) + BGFX_API_FUNC(TextureHandle createTexture(const Memory* _mem, uint64_t _flags, uint8_t _skip, TextureInfo* _info, BackbufferRatio::Enum _ratio, bool _immutable) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -3761,37 +3935,52 @@ namespace bgfx _info->numMips = 0; _info->bitsPerPixel = 0; _info->cubeMap = false; + + return BGFX_INVALID_HANDLE; } TextureHandle handle = { m_textureHandle.alloc() }; BX_WARN(isValid(handle), "Failed to allocate texture handle."); - if (isValid(handle) ) - { - TextureRef& ref = m_textureRef[handle.idx]; - ref.m_refCount = 1; - ref.m_bbRatio = uint8_t(_ratio); - ref.m_format = uint8_t(_info->format); - ref.m_numMips = imageContainer.m_numMips; - ref.m_owned = false; - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateTexture); - cmdbuf.write(handle); - cmdbuf.write(_mem); - cmdbuf.write(_flags); - cmdbuf.write(_skip); + if (!isValid(handle) ) + { + release(_mem); + return BGFX_INVALID_HANDLE; + } + + TextureRef& ref = m_textureRef[handle.idx]; + ref.init( + _ratio + , _info->format + , _info->storageSize + , imageContainer.m_numMips + , imageContainer.m_numLayers + , 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_DIRECT_ACCESS) + , _immutable + , 0 != (_flags & BGFX_TEXTURE_RT_MASK) + ); + + if (ref.m_rt) + { + m_rtMemoryUsed += int64_t(ref.m_storageSize); } else { - release(_mem); + m_textureMemoryUsed += int64_t(ref.m_storageSize); } + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateTexture); + cmdbuf.write(handle); + cmdbuf.write(_mem); + cmdbuf.write(_flags); + cmdbuf.write(_skip); + return handle; } - BGFX_API_FUNC(void setName(TextureHandle _handle, const char* _name) ) + BGFX_API_FUNC(void setName(TextureHandle _handle, const bx::StringView& _name) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); - BGFX_CHECK_HANDLE("setName", m_textureHandle, _handle); TextureRef& ref = m_textureRef[_handle.idx]; @@ -3800,6 +3989,21 @@ namespace bgfx setName(convert(_handle), _name); } + void setDirectAccessPtr(TextureHandle _handle, void* _ptr) + { + TextureRef& ref = m_textureRef[_handle.idx]; + ref.m_ptr = _ptr; + } + + BGFX_API_FUNC(void* getDirectAccessPtr(TextureHandle _handle) ) + { + BGFX_MUTEX_SCOPE(m_resourceApiLock); + BGFX_CHECK_HANDLE("getDirectAccessPtr", m_textureHandle, _handle); + + TextureRef& ref = m_textureRef[_handle.idx]; + return ref.m_ptr; + } + BGFX_API_FUNC(void destroyTexture(TextureHandle _handle) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -3831,7 +4035,7 @@ namespace bgfx return m_frames + 2; } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) { const TextureRef& textureRef = m_textureRef[_handle.idx]; BX_CHECK(BackbufferRatio::Count != textureRef.m_bbRatio, ""); @@ -3851,6 +4055,7 @@ namespace bgfx cmdbuf.write(_width); cmdbuf.write(_height); cmdbuf.write(_numMips); + cmdbuf.write(_numLayers); } void textureTakeOwnership(TextureHandle _handle) @@ -3877,6 +4082,15 @@ namespace bgfx { ref.m_name.clear(); + if (ref.m_rt) + { + m_rtMemoryUsed -= int64_t(ref.m_storageSize); + } + else + { + m_textureMemoryUsed -= int64_t(ref.m_storageSize); + } + bool ok = m_submit->free(_handle); BX_UNUSED(ok); BX_CHECK(ok, "Texture handle %d is already destroyed!", _handle.idx); @@ -3901,6 +4115,14 @@ namespace bgfx { BGFX_MUTEX_SCOPE(m_resourceApiLock); + const TextureRef& textureRef = m_textureRef[_handle.idx]; + if (textureRef.m_immutable) + { + BX_WARN(false, "Can't update immutable texture."); + release(_mem); + return; + } + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateTexture); cmdbuf.write(_handle); cmdbuf.write(_side); @@ -3989,7 +4211,7 @@ namespace bgfx return handle; } - BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat) ) + BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); @@ -4004,6 +4226,7 @@ namespace bgfx cmdbuf.write(_nwh); cmdbuf.write(_width); cmdbuf.write(_height); + cmdbuf.write(_format); cmdbuf.write(_depthFormat); FrameBufferRef& ref = m_frameBufferRef[handle.idx]; @@ -4023,12 +4246,11 @@ namespace bgfx const FrameBufferRef& ref = m_frameBufferRef[_handle.idx]; if (!ref.m_window) { - uint32_t attachment = bx::uint32_min(_attachment, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS); + const uint32_t attachment = bx::min(_attachment, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS); return ref.un.m_th[attachment]; } - TextureHandle invalid = BGFX_INVALID_HANDLE; - return invalid; + return BGFX_INVALID_HANDLE; } BGFX_API_FUNC(void destroyFrameBuffer(FrameBufferHandle _handle) ) @@ -4060,14 +4282,13 @@ namespace bgfx { BGFX_MUTEX_SCOPE(m_resourceApiLock); - BX_WARN(PredefinedUniform::Count == nameToPredefinedUniformEnum(_name), "%s is predefined uniform name.", _name); if (PredefinedUniform::Count != nameToPredefinedUniformEnum(_name) ) { - UniformHandle handle = BGFX_INVALID_HANDLE; - return handle; + BX_TRACE("%s is predefined uniform name.", _name); + return BGFX_INVALID_HANDLE; } - _num = bx::uint16_max(1, _num); + _num = bx::max(1, _num); uint16_t idx = m_uniformHashMap.find(bx::hash(_name) ); if (kInvalidHandle != idx) @@ -4087,7 +4308,7 @@ namespace bgfx || uniform.m_num < _num) { uniform.m_type = oldsize < newsize ? _type : uniform.m_type; - uniform.m_num = bx::uint16_max(uniform.m_num, _num); + uniform.m_num = bx::max(uniform.m_num, _num); CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform); cmdbuf.write(handle); @@ -4104,32 +4325,31 @@ namespace bgfx UniformHandle handle = { m_uniformHandle.alloc() }; - if (isValid(handle) ) - { - BX_TRACE("Creating uniform (handle %3d) %s", handle.idx, _name); - - UniformRef& uniform = m_uniformRef[handle.idx]; - uniform.m_name.set(_name); - uniform.m_refCount = 1; - uniform.m_type = _type; - uniform.m_num = _num; - - bool ok = m_uniformHashMap.insert(bx::hash(_name), handle.idx); - BX_CHECK(ok, "Uniform already exists (name: %s)!", _name); BX_UNUSED(ok); - - CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform); - cmdbuf.write(handle); - cmdbuf.write(_type); - cmdbuf.write(_num); - uint8_t len = (uint8_t)bx::strLen(_name)+1; - cmdbuf.write(len); - cmdbuf.write(_name, len); - } - else + if (!isValid(handle) ) { BX_TRACE("Failed to allocate uniform handle."); + return BGFX_INVALID_HANDLE; } + BX_TRACE("Creating uniform (handle %3d) %s", handle.idx, _name); + + UniformRef& uniform = m_uniformRef[handle.idx]; + uniform.m_name.set(_name); + uniform.m_refCount = 1; + uniform.m_type = _type; + uniform.m_num = _num; + + bool ok = m_uniformHashMap.insert(bx::hash(_name), handle.idx); + BX_CHECK(ok, "Uniform already exists (name: %s)!", _name); BX_UNUSED(ok); + + CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform); + cmdbuf.write(handle); + cmdbuf.write(_type); + cmdbuf.write(_num); + uint8_t len = (uint8_t)bx::strLen(_name)+1; + cmdbuf.write(len); + cmdbuf.write(_name, len); + return handle; } @@ -4272,7 +4492,7 @@ namespace bgfx BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) ) { - BX_CHECK(bx::fequal(_depth, bx::fclamp(_depth, 0.0f, 1.0f), 0.0001f) + BX_CHECK(bx::equal(_depth, bx::clamp(_depth, 0.0f, 1.0f), 0.0001f) , "Clear depth value must be between 0.0 and 1.0 (_depth %f)." , _depth ); @@ -4282,7 +4502,7 @@ namespace bgfx BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) ) { - BX_CHECK(bx::fequal(_depth, bx::fclamp(_depth, 0.0f, 1.0f), 0.0001f) + BX_CHECK(bx::equal(_depth, bx::clamp(_depth, 0.0f, 1.0f), 0.0001f) , "Clear depth value must be between 0.0 and 1.0 (_depth %f)." , _depth ); @@ -4313,7 +4533,7 @@ namespace bgfx BGFX_API_FUNC(void setViewOrder(ViewId _id, uint16_t _num, const ViewId* _order) ) { - const uint32_t num = bx::uint32_min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id; + const uint32_t num = bx::min(_id + _num, BGFX_CONFIG_MAX_VIEWS) - _id; if (NULL == _order) { for (uint32_t ii = 0; ii < num; ++ii) @@ -4328,7 +4548,7 @@ namespace bgfx } } - BGFX_API_FUNC(Encoder* begin() ); + BGFX_API_FUNC(Encoder* begin(bool _forThread) ); BGFX_API_FUNC(void end(Encoder* _encoder) ); @@ -4403,7 +4623,7 @@ namespace bgfx void encoderApiWait() { - uint16_t numEncoders = m_encoderHandle.getNumHandles(); + uint16_t numEncoders = m_encoderHandle->getNumHandles(); for (uint16_t ii = 1; ii < numEncoders; ++ii) { @@ -4412,15 +4632,15 @@ namespace bgfx for (uint16_t ii = 0; ii < numEncoders; ++ii) { - uint16_t idx = m_encoderHandle.getHandleAt(ii); + uint16_t idx = m_encoderHandle->getHandleAt(ii); m_encoderStats[ii].cpuTimeBegin = m_encoder[idx].m_cpuTimeBegin; m_encoderStats[ii].cpuTimeEnd = m_encoder[idx].m_cpuTimeEnd; } m_submit->m_perfStats.numEncoders = uint8_t(numEncoders); - m_encoderHandle.reset(); - uint16_t idx = m_encoderHandle.alloc(); + m_encoderHandle->reset(); + uint16_t idx = m_encoderHandle->alloc(); BX_CHECK(0 == idx, "Internal encoder handle is not 0 (idx %d).", idx); BX_UNUSED(idx); } @@ -4457,11 +4677,11 @@ namespace bgfx } #endif // BGFX_CONFIG_MULTITHREADED - EncoderStats m_encoderStats[BGFX_CONFIG_MAX_ENCODERS]; + EncoderStats* m_encoderStats; Encoder* m_encoder0; - EncoderImpl m_encoder[BGFX_CONFIG_MAX_ENCODERS]; + EncoderImpl* m_encoder; uint32_t m_numEncoders; - bx::HandleAllocT m_encoderHandle; + bx::HandleAlloc* m_encoderHandle; Frame m_frame[1+(BGFX_CONFIG_MULTITHREADED ? 1 : 0)]; Frame* m_render; @@ -4470,6 +4690,7 @@ namespace bgfx uint64_t m_tempKeys[BGFX_CONFIG_MAX_DRAW_CALLS]; RenderItemCount m_tempValues[BGFX_CONFIG_MAX_DRAW_CALLS]; + IndexBuffer m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS]; VertexBuffer m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS]; DynamicIndexBuffer m_dynamicIndexBuffers[BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS]; @@ -4502,7 +4723,8 @@ namespace bgfx { UniformHandle* m_uniforms; String m_name; - uint32_t m_hash; + uint32_t m_hashIn; + uint32_t m_hashOut; int16_t m_refCount; uint16_t m_num; }; @@ -4524,12 +4746,40 @@ namespace bgfx struct TextureRef { - String m_name; - int16_t m_refCount; - uint8_t m_bbRatio; - uint8_t m_format; - uint8_t m_numMips; - bool m_owned; + void init( + BackbufferRatio::Enum _ratio + , TextureFormat::Enum _format + , uint32_t _storageSize + , uint8_t _numMips + , uint16_t _numLayers + , bool _ptrPending + , bool _immutable + , bool _rt + ) + { + m_ptr = _ptrPending ? (void*)UINTPTR_MAX : NULL; + m_storageSize = _storageSize; + m_refCount = 1; + m_bbRatio = uint8_t(_ratio); + m_format = uint8_t(_format); + m_numMips = _numMips; + m_numLayers = _numLayers; + m_owned = false; + m_immutable = _immutable; + m_rt = _rt; + } + + String m_name; + void* m_ptr; + uint32_t m_storageSize; + int16_t m_refCount; + uint8_t m_bbRatio; + uint8_t m_format; + uint8_t m_numMips; + uint16_t m_numLayers; + bool m_owned; + bool m_immutable; + bool m_rt; }; struct FrameBufferRef @@ -4566,11 +4816,14 @@ namespace bgfx uint8_t m_colorPaletteDirty; - Resolution m_resolution; + Init m_init; int64_t m_frameTimeLast; uint32_t m_frames; uint32_t m_debug; + int64_t m_rtMemoryUsed; + int64_t m_textureMemoryUsed; + TextVideoMemBlitter m_textVideoMemBlitter; ClearQuad m_clearQuad; diff --git a/3rdparty/bgfx/src/bgfx_shader.sh b/3rdparty/bgfx/src/bgfx_shader.sh index b8155c1d650..ce8761ed10a 100644 --- a/3rdparty/bgfx/src/bgfx_shader.sh +++ b/3rdparty/bgfx/src/bgfx_shader.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -242,6 +242,13 @@ vec4 bgfxTexelFetch(BgfxSampler2D _sampler, ivec2 _coord, int _lod) return _sampler.m_texture.Load(ivec3(_coord, _lod) ); } +vec2 bgfxTextureSize(BgfxSampler2D _sampler, int _lod) +{ + vec2 result; + _sampler.m_texture.GetDimensions(result.x, result.y); + return result; +} + ivec4 bgfxTexelFetch(BgfxISampler2D _sampler, ivec2 _coord, int _lod) { return _sampler.m_texture.Load(ivec3(_coord, _lod) ); @@ -262,6 +269,13 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod) return _sampler.m_texture.Load(ivec4(_coord, _lod) ); } +vec3 bgfxTextureSize(BgfxSampler3D _sampler, int _lod) +{ + vec3 result; + _sampler.m_texture.GetDimensions(result.x, result.y, result.z); + return result; +} + # define SAMPLER2D(_name, _reg) \ uniform SamplerState _name ## Sampler : REGISTER(s, _reg); \ uniform Texture2D _name ## Texture : REGISTER(t, _reg); \ @@ -322,6 +336,7 @@ vec4 bgfxTexelFetch(BgfxSampler3D _sampler, ivec3 _coord, int _lod) # define textureCubeLod(_sampler, _coord, _level) bgfxTextureCubeLod(_sampler, _coord, _level) # define texelFetch(_sampler, _coord, _lod) bgfxTexelFetch(_sampler, _coord, _lod) +# define textureSize(_sampler, _lod) bgfxTextureSize(_sampler, _lod) # else # define sampler2DShadow sampler2D @@ -445,12 +460,12 @@ vec4 mod(vec4 _a, vec4 _b) { return _a - _b * floor(_a / _b); } # define SAMPLERCUBEARRAY(_name, _reg) uniform samplerCubeArray _name # define SAMPLER2DARRAYSHADOW(_name, _reg) uniform sampler2DArrayShadow _name -# if BGFX_SHADER_LANGUAGE_GLSL >= 130 -# define ISAMPLER2D(_name, _reg) uniform isampler2D _name -# define USAMPLER2D(_name, _reg) uniform usampler2D _name -# define ISAMPLER3D(_name, _reg) uniform isampler3D _name -# define USAMPLER3D(_name, _reg) uniform usampler3D _name +# define ISAMPLER2D(_name, _reg) uniform isampler2D _name +# define USAMPLER2D(_name, _reg) uniform usampler2D _name +# define ISAMPLER3D(_name, _reg) uniform isampler3D _name +# define USAMPLER3D(_name, _reg) uniform usampler3D _name +# if BGFX_SHADER_LANGUAGE_GLSL >= 130 # define texture2D(_sampler, _coord) texture(_sampler, _coord) # define texture2DArray(_sampler, _coord) texture(_sampler, _coord) # define texture3D(_sampler, _coord) texture(_sampler, _coord) @@ -477,6 +492,24 @@ uvec3 uvec3_splat(uint _x) { return uvec3(_x, _x, _x); } uvec4 uvec4_splat(uint _x) { return uvec4(_x, _x, _x, _x); } #endif // BGFX_SHADER_LANGUAGE_GLSL >= 130 || BGFX_SHADER_LANGUAGE_HLSL || BGFX_SHADER_LANGUAGE_PSSL || BGFX_SHADER_LANGUAGE_SPIRV +mat4 mtxFromRows(vec4 _0, vec4 _1, vec4 _2, vec4 _3) +{ +#if BGFX_SHADER_LANGUAGE_GLSL + return transpose(mat4(_0, _1, _2, _3) ); +#else + return mat4(_0, _1, _2, _3); +#endif // BGFX_SHADER_LANGUAGE_GLSL +} + +mat4 mtxFromCols(vec4 _0, vec4 _1, vec4 _2, vec4 _3) +{ +#if BGFX_SHADER_LANGUAGE_GLSL + return mat4(_0, _1, _2, _3); +#else + return transpose(mat4(_0, _1, _2, _3) ); +#endif // BGFX_SHADER_LANGUAGE_GLSL +} + uniform vec4 u_viewRect; uniform vec4 u_viewTexel; uniform mat4 u_view; diff --git a/3rdparty/bgfx/src/charset.h b/3rdparty/bgfx/src/charset.h index e186730bfb3..e9233a32e70 100644 --- a/3rdparty/bgfx/src/charset.h +++ b/3rdparty/bgfx/src/charset.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/config.h b/3rdparty/bgfx/src/config.h index 7c038715845..d8a1ab97164 100644 --- a/3rdparty/bgfx/src/config.h +++ b/3rdparty/bgfx/src/config.h @@ -1,87 +1,87 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #ifndef BGFX_CONFIG_H_HEADER_GUARD #define BGFX_CONFIG_H_HEADER_GUARD -#include +#include #ifndef BGFX_CONFIG_DEBUG # define BGFX_CONFIG_DEBUG 0 #endif // BGFX_CONFIG_DEBUG -#if !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \ - && !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \ - && !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \ - && !defined(BGFX_CONFIG_RENDERER_METAL) \ - && !defined(BGFX_CONFIG_RENDERER_OPENGL) \ - && !defined(BGFX_CONFIG_RENDERER_OPENGLES) \ - && !defined(BGFX_CONFIG_RENDERER_VULKAN) \ - && !defined(BGFX_CONFIG_RENDERER_GNM) +#if !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \ + && !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \ + && !defined(BGFX_CONFIG_RENDERER_DIRECT3D12) \ + && !defined(BGFX_CONFIG_RENDERER_METAL) \ + && !defined(BGFX_CONFIG_RENDERER_OPENGL) \ + && !defined(BGFX_CONFIG_RENDERER_OPENGLES) \ + && !defined(BGFX_CONFIG_RENDERER_VULKAN) \ + && !defined(BGFX_CONFIG_RENDERER_GNM) # ifndef BGFX_CONFIG_RENDERER_DIRECT3D9 # define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \ - || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_WINDOWS \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_DIRECT3D9 # ifndef BGFX_CONFIG_RENDERER_DIRECT3D11 # define BGFX_CONFIG_RENDERER_DIRECT3D11 (0 \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ - || BX_PLATFORM_XBOXONE \ + || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_WINRT \ + || BX_PLATFORM_XBOXONE \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_DIRECT3D11 # ifndef BGFX_CONFIG_RENDERER_DIRECT3D12 # define BGFX_CONFIG_RENDERER_DIRECT3D12 (0 \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_XBOXONE \ + || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_WINRT \ + || BX_PLATFORM_XBOXONE \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_DIRECT3D12 # ifndef BGFX_CONFIG_RENDERER_METAL -# define BGFX_CONFIG_RENDERER_METAL (0 \ +# define BGFX_CONFIG_RENDERER_METAL (0 \ || (BX_PLATFORM_IOS && BX_CPU_ARM) \ - || (BX_PLATFORM_OSX >= 101100) \ + || (BX_PLATFORM_OSX >= 101100) \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_METAL # ifndef BGFX_CONFIG_RENDERER_OPENGL # define BGFX_CONFIG_RENDERER_OPENGL (0 \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_OSX \ + || BX_PLATFORM_WINDOWS \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_OPENGL # ifndef BGFX_CONFIG_RENDERER_OPENGLES # define BGFX_CONFIG_RENDERER_OPENGLES (0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_EMSCRIPTEN \ - || BX_PLATFORM_IOS \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_STEAMLINK \ - || BX_PLATFORM_NX \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_EMSCRIPTEN \ + || BX_PLATFORM_IOS \ + || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ + || BX_PLATFORM_NX \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_OPENGLES # ifndef BGFX_CONFIG_RENDERER_VULKAN # define BGFX_CONFIG_RENDERER_VULKAN (0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_NX \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_NX \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_VULKAN # ifndef BGFX_CONFIG_RENDERER_GNM # define BGFX_CONFIG_RENDERER_GNM (0 \ - || BX_PLATFORM_PS4 \ + || BX_PLATFORM_PS4 \ ? 1 : 0) # endif // BGFX_CONFIG_RENDERER_GNM @@ -143,11 +143,6 @@ # define BGFX_CONFIG_USE_TINYSTL 1 #endif // BGFX_CONFIG_USE_TINYSTL -/// Enable OculusVR integration. -#ifndef BGFX_CONFIG_USE_OVR -# define BGFX_CONFIG_USE_OVR 0 -#endif // BGFX_CONFIG_USE_OVR - /// Enable nVidia PerfHUD integration. #ifndef BGFX_CONFIG_DEBUG_PERFHUD # define BGFX_CONFIG_DEBUG_PERFHUD 0 @@ -210,13 +205,14 @@ # define BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM 9 #endif // BGFX_CONFIG_SORT_KEY_NUM_BITS_PROGRAM -// Cannot be configured directly. Must must be power of 2. +// Cannot be configured via compiler options. #define BGFX_CONFIG_MAX_PROGRAMS (1< # endif // BX_PLATFORM_WINDOWS @@ -56,7 +56,7 @@ namespace bgfx } pRENDERDOC_GetAPI RENDERDOC_GetAPI; - static RENDERDOC_API_1_1_0* s_renderDoc = NULL; + static RENDERDOC_API_1_1_2* s_renderDoc = NULL; static void* s_renderDocDll = NULL; void* loadRenderDoc() @@ -72,15 +72,22 @@ namespace bgfx return NULL; } - void* renderDocDll = bx::dlopen("renderdoc.dll"); + void* renderDocDll = bx::dlopen( +#if BX_PLATFORM_WINDOWS + "renderdoc.dll" +#else + "./librenderdoc.so" +#endif // BX_PLATFORM_WINDOWS + ); if (NULL != renderDocDll) { RENDERDOC_GetAPI = (pRENDERDOC_GetAPI)bx::dlsym(renderDocDll, "RENDERDOC_GetAPI"); + if (NULL != RENDERDOC_GetAPI - && 1 == RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_0, (void**)&s_renderDoc) ) + && 1 == RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_2, (void**)&s_renderDoc) ) { - s_renderDoc->SetLogFilePathTemplate(BGFX_CONFIG_RENDERDOC_LOG_FILEPATH); + s_renderDoc->SetCaptureFilePathTemplate(BGFX_CONFIG_RENDERDOC_LOG_FILEPATH); s_renderDoc->SetFocusToggleKeys(NULL, 0); @@ -147,4 +154,4 @@ namespace bgfx } // namespace bgfx -#endif // BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX) +#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX diff --git a/3rdparty/bgfx/src/debug_renderdoc.h b/3rdparty/bgfx/src/debug_renderdoc.h index b696a7e7294..0c62e777532 100644 --- a/3rdparty/bgfx/src/debug_renderdoc.h +++ b/3rdparty/bgfx/src/debug_renderdoc.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/dxgi.cpp b/3rdparty/bgfx/src/dxgi.cpp new file mode 100644 index 00000000000..4f2bc7c0984 --- /dev/null +++ b/3rdparty/bgfx/src/dxgi.cpp @@ -0,0 +1,660 @@ +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#include "bgfx_p.h" + +#if BGFX_CONFIG_RENDERER_DIRECT3D11 || BGFX_CONFIG_RENDERER_DIRECT3D12 + +#include "dxgi.h" +#include "renderer_d3d.h" + +#if !BX_PLATFORM_WINDOWS +# include +# if BX_PLATFORM_WINRT +# include +# endif // BX_PLATFORM_WINRT +#endif // !BX_PLATFORM_WINDOWS + +namespace bgfx +{ + BX_PRAGMA_DIAGNOSTIC_PUSH(); + BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wunused-variable"); + BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunused-const-variable"); + BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration"); + +#if BX_PLATFORM_WINDOWS + static PFN_CREATE_DXGI_FACTORY CreateDXGIFactory; + static PFN_GET_DEBUG_INTERFACE DXGIGetDebugInterface; + static PFN_GET_DEBUG_INTERFACE1 DXGIGetDebugInterface1; +#endif // BX_PLATFORM_WINDOWS + + static const GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } }; + static const GUID IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0 } }; + static const GUID IID_IDXGIFactory3 = { 0x25483823, 0xcd46, 0x4c7d, { 0x86, 0xca, 0x47, 0xaa, 0x95, 0xb8, 0x37, 0xbd } }; + static const GUID IID_IDXGIFactory4 = { 0x1bc6ea02, 0xef36, 0x464f, { 0xbf, 0x0c, 0x21, 0xca, 0x39, 0xe5, 0x16, 0x8a } }; + static const GUID IID_IDXGIFactory5 = { 0x7632e1f5, 0xee65, 0x4dca, { 0x87, 0xfd, 0x84, 0xcd, 0x75, 0xf8, 0x83, 0x8d } }; + static const GUID IID_IDXGIDevice0 = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } }; + static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; + static const GUID IID_IDXGIDevice2 = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } }; + static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; + static const GUID IID_IDXGIAdapter = { 0x2411e7e1, 0x12ac, 0x4ccf, { 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0 } }; + static const GUID IID_IDXGIAdapter2 = { 0x0aa1ae0a, 0xfa0e, 0x4b84, { 0x86, 0x44, 0xe0, 0x5f, 0xf8, 0xe5, 0xac, 0xb5 } }; + static const GUID IID_IDXGIAdapter3 = { 0x645967a4, 0x1392, 0x4310, { 0xa7, 0x98, 0x80, 0x53, 0xce, 0x3e, 0x93, 0xfd } }; + static const GUID IID_IDXGIAdapter4 = { 0x3c8d99d1, 0x4fbf, 0x4181, { 0xa8, 0x2c, 0xaf, 0x66, 0xbf, 0x7b, 0xd2, 0x4e } }; + static const GUID IID_IDXGISwapChain3 = { 0x94d99bdb, 0xf1f8, 0x4ab0, { 0xb2, 0x36, 0x7d, 0xa0, 0x17, 0x0e, 0xda, 0xb1 } }; + static const GUID IID_IDXGISwapChain4 = { 0x3d585d5a, 0xbd4a, 0x489e, { 0xb1, 0xf4, 0x3d, 0xbc, 0xb6, 0x45, 0x2f, 0xfb } }; + static const GUID IID_IDXGIOutput6 = { 0x068346e8, 0xaaec, 0x4b84, { 0xad, 0xd7, 0x13, 0x7f, 0x51, 0x3f, 0x77, 0xa1 } }; + + BX_PRAGMA_DIAGNOSTIC_POP(); + + static const DXGI_COLOR_SPACE_TYPE s_colorSpace[] = + { + DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709, // gamma 2.2, BT.709 + DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709, // gamma 1.0, BT.709 + DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020, // gamma 2084, BT.2020 + }; + + static const char* s_colorSpaceStr[] = + { + // https://msdn.microsoft.com/en-us/library/windows/desktop/dn903661(v=vs.85).aspx + "RGB, 0-255, 2.2, Image, BT.709, n/a", // DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 + "RGB, 0-255, 1.0, Image, BT.709, n/a", // DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 + "RGB, 16-235, 2.2, Image, BT.709, n/a", // DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 + "RGB, 16-235, 2.2, Image, BT.2020, n/a", // DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 + "Reserved", // DXGI_COLOR_SPACE_RESERVED + "YCbCr, 0-255, 2.2, Image, BT.709, BT.601", // DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 + "YCbCr, 16-235, 2.2, Video, BT.601, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 + "YCbCr, 0-255, 2.2, Video, BT.601, n/a", // DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 + "YCbCr, 16-235, 2.2, Video, BT.709, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 + "YCbCr, 0-255, 2.2, Video, BT.709, n/a", // DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 + "YCbCr, 16-235, 2.2, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 + "YCbCr, 0-255, 2.2, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 + "RGB, 0-255, 2084, Image, BT.2020, n/a", // DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 + "YCbCr, 16-235, 2084, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 + "RGB, 0-255, 2084, Image, BT.2020, n/a", // DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 + "YCbCr, 16-235, 2.2, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 + "YCbCr, 16-235, 2084, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 +#if BX_PLATFORM_WINDOWS + "RGB, 0-255, 2.2, Image, BT.2020, n/a", // DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 + "YCbCr, 16-235, HLG, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 + "YCbCr, 0-255, HLG, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 +// "RGB, 16-235, 2.4, Image, BT.709, n/a", // DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 +// "RGB, 16-235, 2.4, Image, BT.2020, n/a", // DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 +// "YCbCr, 16-235, 2.4, Video, BT.709, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 +// "YCbCr, 16-235, 2.4, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 +// "YCbCr, 16-235, 2.4, Video, BT.2020, n/a", // DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 +#endif // BX_PLATFORM_WINDOWS + "Custom", + }; + static const DXGI_COLOR_SPACE_TYPE kDxgiLastColorSpace = +#if BX_PLATFORM_WINDOWS + DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 +#else + DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 +#endif // BX_PLATFORM_WINDOWS + ; + BX_STATIC_ASSERT(BX_COUNTOF(s_colorSpaceStr) == kDxgiLastColorSpace+2, "Colorspace string table mismatch with DXGI_COLOR_SPACE_*."); + + static const GUID s_dxgiDeviceIIDs[] = + { + IID_IDXGIDevice3, + IID_IDXGIDevice2, + IID_IDXGIDevice1, + IID_IDXGIDevice0, + }; + + static const GUID s_dxgiSwapChainIIDs[] = + { + IID_IDXGISwapChain4, + IID_IDXGISwapChain3, + }; + + DxgiSwapChain::DxgiSwapChain() + { + } + + Dxgi::Dxgi() + : m_dxgiDll(NULL) + , m_dxgiDebugDll(NULL) + , m_driverType(D3D_DRIVER_TYPE_NULL) + , m_factory(NULL) + , m_adapter(NULL) + , m_output(NULL) + { + } + + bool Dxgi::init(Caps& _caps) + { +#if BX_PLATFORM_WINDOWS + m_dxgiDll = bx::dlopen("dxgi.dll"); + if (NULL == m_dxgiDll) + { + BX_TRACE("Init error: Failed to load dxgi.dll."); + return false; + } + + m_dxgiDebugDll = bx::dlopen("dxgidebug.dll"); + if (NULL != m_dxgiDebugDll) + { + DXGIGetDebugInterface = (PFN_GET_DEBUG_INTERFACE )bx::dlsym(m_dxgiDebugDll, "DXGIGetDebugInterface"); + DXGIGetDebugInterface1 = (PFN_GET_DEBUG_INTERFACE1)bx::dlsym(m_dxgiDebugDll, "DXGIGetDebugInterface1"); + if (NULL == DXGIGetDebugInterface + && NULL == DXGIGetDebugInterface1) + { + bx::dlclose(m_dxgiDebugDll); + m_dxgiDebugDll = NULL; + } + } + + CreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgiDll, "CreateDXGIFactory1"); + + if (NULL == CreateDXGIFactory) + { + CreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgiDll, "CreateDXGIFactory"); + } + + if (NULL == CreateDXGIFactory) + { + BX_TRACE("Init error: Function CreateDXGIFactory not found."); + return false; + } +#endif // BX_PLATFORM_WINDOWS + + HRESULT hr = S_OK; +#if BX_PLATFORM_WINRT + // WinRT requires the IDXGIFactory2 interface, which isn't supported on older platforms + hr = CreateDXGIFactory1(IID_IDXGIFactory2, (void**)&m_factory); +#elif BX_PLATFORM_WINDOWS + hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)&m_factory); +#endif // BX_PLATFORM_* + + if (FAILED(hr) ) + { + BX_TRACE("Init error: Unable to create DXGI factory."); + return false; + } + + m_driverType = BGFX_PCI_ID_SOFTWARE_RASTERIZER == _caps.vendorId + ? D3D_DRIVER_TYPE_WARP + : D3D_DRIVER_TYPE_HARDWARE + ; + + if (NULL != m_factory) + { + AdapterI* adapter; + for (uint32_t ii = 0 + ; DXGI_ERROR_NOT_FOUND != m_factory->EnumAdapters(ii, reinterpret_cast(&adapter) ) && ii < BX_COUNTOF(_caps.gpu) + ; ++ii + ) + { + { + DXGI_ADAPTER_DESC desc; + hr = adapter->GetDesc(&desc); + if (SUCCEEDED(hr) ) + { + BX_TRACE("Adapter #%d", ii); + + char description[BX_COUNTOF(desc.Description)]; + wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); + BX_TRACE("\tDescription: %s", description); + BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x" + , desc.VendorId + , desc.DeviceId + , desc.SubSysId + , desc.Revision + ); + BX_TRACE("\tMemory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)" + , desc.DedicatedVideoMemory + , desc.DedicatedSystemMemory + , desc.SharedSystemMemory + ); + + _caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; + _caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; + ++_caps.numGPUs; + + if (NULL == m_adapter) + { + if ( (BGFX_PCI_ID_NONE != _caps.vendorId || 0 != _caps.deviceId) + && (BGFX_PCI_ID_NONE == _caps.vendorId || desc.VendorId == _caps.vendorId) + && ( 0 == _caps.deviceId || desc.DeviceId == _caps.deviceId) ) + { + m_adapter = adapter; + m_adapter->AddRef(); + m_driverType = D3D_DRIVER_TYPE_UNKNOWN; + } + + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) + && !bx::strFind(description, "PerfHUD").isEmpty() ) + { + m_adapter = adapter; + m_driverType = D3D_DRIVER_TYPE_REFERENCE; + } + } + } + } + + bool hdr10 = false; + + IDXGIOutput* output; + for (uint32_t jj = 0 + ; SUCCEEDED(adapter->EnumOutputs(jj, &output) ) + ; ++jj + ) + { + DXGI_OUTPUT_DESC outputDesc; + hr = output->GetDesc(&outputDesc); + if (SUCCEEDED(hr)) + { + BX_TRACE("\tOutput #%d", jj); + + char deviceName[BX_COUNTOF(outputDesc.DeviceName)]; + wcstombs(deviceName, outputDesc.DeviceName, BX_COUNTOF(outputDesc.DeviceName)); + BX_TRACE("\t\t DeviceName: %s", deviceName); + BX_TRACE("\t\t DesktopCoordinates: %d, %d, %d, %d" + , outputDesc.DesktopCoordinates.left + , outputDesc.DesktopCoordinates.top + , outputDesc.DesktopCoordinates.right + , outputDesc.DesktopCoordinates.bottom + ); + BX_TRACE("\t\t AttachedToDesktop: %d", outputDesc.AttachedToDesktop); + BX_TRACE("\t\t Rotation: %d", outputDesc.Rotation); + +#if BX_PLATFORM_WINDOWS + IDXGIOutput6* output6; + hr = output->QueryInterface(IID_IDXGIOutput6, (void**)&output6); + if (SUCCEEDED(hr) ) + { + DXGI_OUTPUT_DESC1 desc; + hr = output6->GetDesc1(&desc); + if (SUCCEEDED(hr) ) + { + BX_TRACE("\t\t BitsPerColor: %d", desc.BitsPerColor); + BX_TRACE("\t\t Color space: %s (colorspace, range, gamma, sitting, primaries, transform)" + , s_colorSpaceStr[bx::min(desc.ColorSpace, kDxgiLastColorSpace+1)] + ); + BX_TRACE("\t\t RedPrimary: %f, %f", desc.RedPrimary[0], desc.RedPrimary[1]); + BX_TRACE("\t\t GreenPrimary: %f, %f", desc.GreenPrimary[0], desc.GreenPrimary[1]); + BX_TRACE("\t\t BluePrimary: %f, %f", desc.BluePrimary[0], desc.BluePrimary[1]); + BX_TRACE("\t\t WhitePoint: %f, %f", desc.WhitePoint[0], desc.WhitePoint[1]); + BX_TRACE("\t\t MinLuminance: %f", desc.MinLuminance); + BX_TRACE("\t\t MaxLuminance: %f", desc.MaxLuminance); + BX_TRACE("\t\tMaxFullFrameLuminance: %f", desc.MaxFullFrameLuminance); + BX_TRACE("\t\t HDR support: %s", DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 == desc.ColorSpace ? "true" : "false"); + + hdr10 |= DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 == desc.ColorSpace; + } + + // BK - warn only because RenderDoc might be present. + DX_RELEASE_W(output6, 1); + } +#endif // BX_PLATFORM_WINDOWS + + DX_RELEASE(output, 0); + } + } + + _caps.supported |= hdr10 ? BGFX_CAPS_HDR10 : 0; + + DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0); + } + + if (NULL == m_adapter) + { + hr = m_factory->EnumAdapters(0, reinterpret_cast(&m_adapter) ); + BX_WARN(SUCCEEDED(hr), "EnumAdapters failed 0x%08x.", hr); + m_driverType = D3D_DRIVER_TYPE_UNKNOWN; + } + + bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); + hr = m_adapter->GetDesc(&m_adapterDesc); + BX_WARN(SUCCEEDED(hr), "Adapter GetDesc failed 0x%08x.", hr); + + m_adapter->EnumOutputs(0, &m_output); + + _caps.vendorId = 0 == m_adapterDesc.VendorId + ? BGFX_PCI_ID_SOFTWARE_RASTERIZER + : (uint16_t)m_adapterDesc.VendorId + ; + _caps.deviceId = (uint16_t)m_adapterDesc.DeviceId; + } + + return true; + } + + void Dxgi::shutdown() + { + DX_RELEASE(m_output, 0); + DX_RELEASE(m_adapter, 0); + DX_RELEASE(m_factory, 0); + + bx::dlclose(m_dxgiDebugDll); + m_dxgiDebugDll = NULL; + + bx::dlclose(m_dxgiDll); + m_dxgiDll = NULL; + } + + void Dxgi::update(IUnknown* _device) + { + IDXGIDevice* dxgiDevice = NULL; + HRESULT hr = E_FAIL; + for (uint32_t ii = 0; ii < BX_COUNTOF(s_dxgiDeviceIIDs) && FAILED(hr); ++ii) + { + hr = _device->QueryInterface(s_dxgiDeviceIIDs[ii], (void**)&dxgiDevice); + BX_TRACE("DXGI device 11.%d, hr %x", BX_COUNTOF(s_dxgiDeviceIIDs) - 1 - ii, hr); + } + + if (NULL == m_factory) + { + DX_CHECK(dxgiDevice->GetAdapter(reinterpret_cast(&m_adapter) ) ); + + bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); + hr = m_adapter->GetDesc(&m_adapterDesc); + BX_WARN(SUCCEEDED(hr), "Adapter GetDesc failed 0x%08x.", hr); + + DX_CHECK(m_adapter->GetParent(IID_IDXGIFactory2, (void**)&m_factory) ); + } + + DX_RELEASE_I(dxgiDevice); + } + + static const GUID IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } }; + + HRESULT Dxgi::createSwapChain(IUnknown* _device, const SwapChainDesc& _scd, SwapChainI** _swapChain) + { + HRESULT hr = S_OK; + + bool allowTearing = false; + +#if BX_PLATFORM_WINDOWS + if (windowsVersionIs(Condition::GreaterEqual, 0x0604) ) + { + // BK - CheckFeatureSupport with DXGI_FEATURE_PRESENT_ALLOW_TEARING + // will crash on pre Windows 8. Issue #1356. + hr = m_factory->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &allowTearing, sizeof(allowTearing) ); + BX_TRACE("Allow tearing is %ssupported.", allowTearing ? "" : "not "); + } + + DXGI_SWAP_CHAIN_DESC scd; + scd.BufferDesc.Width = _scd.width; + scd.BufferDesc.Height = _scd.height; + scd.BufferDesc.RefreshRate.Numerator = 1; + scd.BufferDesc.RefreshRate.Denominator = 60; + scd.BufferDesc.Format = _scd.format; + scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; + scd.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; + scd.SampleDesc.Count = 1; + scd.SampleDesc.Quality = 0; + scd.BufferUsage = _scd.bufferUsage; + scd.BufferCount = _scd.bufferCount; + scd.OutputWindow = (HWND)_scd.nwh; + scd.Windowed = _scd.windowed; + scd.SwapEffect = _scd.swapEffect; + scd.Flags = 0 + | _scd.flags + | (allowTearing ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0) + ; + + hr = m_factory->CreateSwapChain( + _device + , &scd + , reinterpret_cast(_swapChain) + ); + + if (SUCCEEDED(hr) ) + { + IDXGIDevice1* dxgiDevice1; + _device->QueryInterface(IID_IDXGIDevice1, (void**)&dxgiDevice1); + if (NULL != dxgiDevice1) + { + dxgiDevice1->SetMaximumFrameLatency(_scd.maxFrameLatency); + DX_RELEASE_I(dxgiDevice1); + } + } +#else + DXGI_SWAP_CHAIN_DESC1 scd; + scd.Width = _scd.width; + scd.Height = _scd.height; + scd.Format = _scd.format; + scd.Stereo = _scd.stereo; + scd.SampleDesc.Count = 1; + scd.SampleDesc.Quality = 0; + scd.BufferUsage = _scd.bufferUsage; + scd.BufferCount = _scd.bufferCount; + scd.Scaling = _scd.scaling; + scd.SwapEffect = _scd.swapEffect; + scd.AlphaMode = _scd.alphaMode; + scd.Flags = _scd.flags; + + if (NULL == _scd.ndt) + { + hr = m_factory->CreateSwapChainForCoreWindow( + _device + , (::IUnknown*)_scd.nwh + , &scd + , NULL + , reinterpret_cast(_swapChain) + ); + } + else if (reinterpret_cast(1) == _scd.ndt) + { + return E_FAIL; + } + else + { + hr = m_factory->CreateSwapChainForComposition( + _device + , &scd + , NULL + , reinterpret_cast(_swapChain) + ); + if (FAILED(hr) ) + { + return hr; + } + +# if BX_PLATFORM_WINRT + IInspectable *nativeWindow = reinterpret_cast(_scd.nwh); + ISwapChainBackgroundPanelNative* panel = NULL; + hr = nativeWindow->QueryInterface( + __uuidof(ISwapChainBackgroundPanelNative) + , (void **)&panel + ); + if (FAILED(hr) ) + { + return hr; + } + + if (NULL != panel) + { + hr = panel->SetSwapChain(*_swapChain); + if (FAILED(hr) ) + { + return hr; + } + + panel->Release(); + } +# endif // BX_PLATFORM_WINRT + } +#endif // BX_PLATFORM_WINDOWS + + if (FAILED(hr) ) + { + BX_TRACE("Failed to create swap chain."); + return hr; + } + +#if BX_PLATFORM_WINDOWS + if (SUCCEEDED(hr) ) + { + for (uint32_t ii = 0; ii < BX_COUNTOF(s_dxgiSwapChainIIDs); ++ii) + { + IDXGISwapChain1* swapChain; + hr = (*_swapChain)->QueryInterface(s_dxgiSwapChainIIDs[ii], (void**)&swapChain); + BX_TRACE("DXGI swap chain %d, hr %x", 4-ii, hr); + + if (SUCCEEDED(hr) ) + { + DX_RELEASE(*_swapChain, 1); + *_swapChain = reinterpret_cast(swapChain); + + BX_TRACE("Color space support:"); + for (uint32_t jj = 0; jj < BX_COUNTOF(s_colorSpace); ++jj) + { + uint32_t colorSpaceSupport; + reinterpret_cast(*_swapChain)->CheckColorSpaceSupport(s_colorSpace[jj], &colorSpaceSupport); + BX_TRACE("\t%2d: \"%-20s\", 0x%08x, %s" + , s_colorSpace[jj] + , s_colorSpaceStr[s_colorSpace[jj]] + , colorSpaceSupport + , 0 != (colorSpaceSupport & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) + ? "supported" + : "-" + ); + } + + break; + } + } + } +#endif // BX_PLATFORM_WINDOWS + + updateHdr10(*_swapChain, _scd); + + return S_OK; + } + + void Dxgi::updateHdr10(SwapChainI* _swapChain, const SwapChainDesc& _scd) + { +#if BX_PLATFORM_WINDOWS + ::IDXGISwapChain4* swapChain4; + HRESULT hr = _swapChain->QueryInterface(IID_IDXGISwapChain4, (void**)&swapChain4); + + if (SUCCEEDED(hr) ) + { + const DXGI_COLOR_SPACE_TYPE colorSpace = + _scd.format == DXGI_FORMAT_R10G10B10A2_UNORM ? DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 + : _scd.format == DXGI_FORMAT_R16G16B16A16_FLOAT ? DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 + : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 + ; + + hr = swapChain4->SetColorSpace1(colorSpace); + + if (SUCCEEDED(hr) ) + { + DXGI_OUTPUT_DESC1 desc; + + IDXGIOutput* output; + hr = _swapChain->GetContainingOutput(&output); + if (SUCCEEDED(hr) ) + { + IDXGIOutput6* output6; + hr = output->QueryInterface(IID_IDXGIOutput6, (void**)&output6); + if (SUCCEEDED(hr) ) + { + hr = output6->GetDesc1(&desc); + if (SUCCEEDED(hr) ) + { + BX_TRACE("Display specs:") + BX_TRACE("\t BitsPerColor: %d", desc.BitsPerColor); + BX_TRACE("\t Color space: %s (colorspace, range, gamma, sitting, primaries, transform)" + , s_colorSpaceStr[bx::min(desc.ColorSpace, kDxgiLastColorSpace+1)] + ); + BX_TRACE("\t RedPrimary: %f, %f", desc.RedPrimary[0], desc.RedPrimary[1]); + BX_TRACE("\t GreenPrimary: %f, %f", desc.GreenPrimary[0], desc.GreenPrimary[1]); + BX_TRACE("\t BluePrimary: %f, %f", desc.BluePrimary[0], desc.BluePrimary[1]); + BX_TRACE("\t WhitePoint: %f, %f", desc.WhitePoint[0], desc.WhitePoint[1]); + BX_TRACE("\t MinLuminance: %f", desc.MinLuminance); + BX_TRACE("\t MaxLuminance: %f", desc.MaxLuminance); + BX_TRACE("\tMaxFullFrameLuminance: %f", desc.MaxFullFrameLuminance); + } + + DX_RELEASE(output6, 1); + } + + DX_RELEASE(output, 0); + } + + DXGI_HDR_METADATA_HDR10 hdr10; + hdr10.RedPrimary[0] = uint16_t(desc.RedPrimary[0] * 50000.0f); + hdr10.RedPrimary[1] = uint16_t(desc.RedPrimary[1] * 50000.0f); + hdr10.GreenPrimary[0] = uint16_t(desc.GreenPrimary[0] * 50000.0f); + hdr10.GreenPrimary[1] = uint16_t(desc.GreenPrimary[1] * 50000.0f); + hdr10.BluePrimary[0] = uint16_t(desc.BluePrimary[0] * 50000.0f); + hdr10.BluePrimary[1] = uint16_t(desc.BluePrimary[1] * 50000.0f); + hdr10.WhitePoint[0] = uint16_t(desc.WhitePoint[0] * 50000.0f); + hdr10.WhitePoint[1] = uint16_t(desc.WhitePoint[1] * 50000.0f); + hdr10.MaxMasteringLuminance = uint32_t(desc.MaxLuminance * 10000.0f); + hdr10.MinMasteringLuminance = uint32_t(desc.MinLuminance * 10000.0f); + hdr10.MaxContentLightLevel = uint16_t(desc.MaxFullFrameLuminance); + hdr10.MaxFrameAverageLightLevel = uint16_t(desc.MaxFullFrameLuminance); + hr = swapChain4->SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10, sizeof(DXGI_HDR_METADATA_HDR10), &hdr10); + } + + DX_RELEASE(swapChain4, 1); + } +#else + BX_UNUSED(_swapChain, _scd); +#endif // BX_PLATFORM_WINDOWS + } + + HRESULT Dxgi::resizeBuffers(SwapChainI* _swapChain, const SwapChainDesc& _scd, const uint32_t* _nodeMask, IUnknown* const* _presentQueue) + { + HRESULT hr; + +#if BX_PLATFORM_WINDOWS + if (NULL != _nodeMask + && NULL != _presentQueue) + { + hr = _swapChain->ResizeBuffers1( + _scd.bufferCount + , _scd.width + , _scd.height + , _scd.format + , _scd.flags + , _nodeMask + , _presentQueue + ); + } + else +#endif // BX_PLATFORM_WINDOWS + { + BX_UNUSED(_nodeMask, _presentQueue); + + hr = _swapChain->ResizeBuffers( + _scd.bufferCount + , _scd.width + , _scd.height + , _scd.format + , _scd.flags + ); + } + + if (SUCCEEDED(hr) ) + { + updateHdr10(_swapChain, _scd); + } + + return hr; + } + + void Dxgi::trim() + { +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + IDXGIDevice3* device; + HRESULT hr = m_factory->QueryInterface(IID_IDXGIDevice3, (void**)&device); + if (SUCCEEDED(hr) ) + { + device->Trim(); + DX_RELEASE(device, 1); + } +#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + } + +} // namespace bgfx + +#endif // BGFX_CONFIG_RENDERER_DIRECT3D11 || BGFX_CONFIG_RENDERER_DIRECT3D12 diff --git a/3rdparty/bgfx/src/dxgi.h b/3rdparty/bgfx/src/dxgi.h new file mode 100644 index 00000000000..604a50eb984 --- /dev/null +++ b/3rdparty/bgfx/src/dxgi.h @@ -0,0 +1,110 @@ +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + */ + +#ifndef BGFX_DXGI_H_HEADER_GUARD +#define BGFX_DXGI_H_HEADER_GUARD + +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +# include +# include +#else +# include +#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + +namespace bgfx +{ +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + typedef ::IUnknown IUnknown; +#else + typedef ::IGraphicsUnknown IUnknown; +#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + + typedef HRESULT (WINAPI* PFN_CREATE_DXGI_FACTORY)(REFIID _riid, void** _factory); + typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE)(REFIID _riid, void** _debug); + typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE1)(UINT _flags, REFIID _riid, void** _debug); + + struct SwapChainDesc + { + uint32_t width; + uint32_t height; + DXGI_FORMAT format; + bool stereo; + DXGI_SAMPLE_DESC sampleDesc; + DXGI_USAGE bufferUsage; + uint32_t bufferCount; + DXGI_SCALING scaling; + DXGI_SWAP_EFFECT swapEffect; + DXGI_ALPHA_MODE alphaMode; + uint32_t flags; + uint8_t maxFrameLatency; + void* nwh; + void* ndt; + bool windowed; + }; + + struct DxgiSwapChain + { + /// + DxgiSwapChain(); + }; + + /// + struct Dxgi + { +#if BX_PLATFORM_WINDOWS + typedef ::IDXGIAdapter3 AdapterI; + typedef ::IDXGIFactory5 FactoryI; + typedef ::IDXGISwapChain3 SwapChainI; + typedef ::IDXGIOutput OutputI; +#elif BX_PLATFORM_WINRT + typedef ::IDXGIAdapter AdapterI; + typedef ::IDXGIFactory4 FactoryI; + typedef ::IDXGISwapChain1 SwapChainI; + typedef ::IDXGIOutput OutputI; +#else + typedef ::IDXGIAdapter AdapterI; + typedef ::IDXGIFactory2 FactoryI; + typedef ::IDXGISwapChain1 SwapChainI; + typedef ::IDXGIOutput OutputI; +#endif // BX_PLATFORM_WINDOWS + + /// + Dxgi(); + + /// + bool init(Caps& _caps); + + /// + void shutdown(); + + /// + void update(IUnknown* _device); + + /// + HRESULT createSwapChain(IUnknown* _device, const SwapChainDesc& _scd, SwapChainI** _swapChain); + + /// + void updateHdr10(SwapChainI* _swapChain, const SwapChainDesc& _scd); + + /// + HRESULT resizeBuffers(SwapChainI* _swapChain, const SwapChainDesc& _scd, const uint32_t* _nodeMask = NULL, IUnknown* const* _presentQueue = NULL); + + /// + void trim(); + + /// + void* m_dxgiDll; + void* m_dxgiDebugDll; + + D3D_DRIVER_TYPE m_driverType; + DXGI_ADAPTER_DESC m_adapterDesc; + FactoryI* m_factory; + AdapterI* m_adapter; + OutputI* m_output; + }; + +} // namespace bgfx + +#endif // BGFX_DXGI_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/fs_clear0.bin.h b/3rdparty/bgfx/src/fs_clear0.bin.h index f4a98048d35..346466213ff 100644 --- a/3rdparty/bgfx/src/fs_clear0.bin.h +++ b/3rdparty/bgfx/src/fs_clear0.bin.h @@ -9,143 +9,49 @@ static const uint8_t fs_clear0_glsl[128] = 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, // olor = bgfx_clea 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x30, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_color[0];.}... }; -static const uint8_t fs_clear0_spv[2158] = +static const uint8_t fs_clear0_spv[641] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x01, 0x00, 0x00, 0x01, // clear_color..... - 0x00, 0x48, 0x08, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .H.....#........ - 0x00, 0x2e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // ..a............. + 0x00, 0x58, 0x02, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .X.....#........ + 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .F.............. 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .main........... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, // n........5...vec - 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, // 4_splat(f1;..... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4d, 0x0f, 0x00, // ....._x......M.. - 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // .@main(vf4;..... - 0x00, 0x2c, 0x41, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .,A..gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _0_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..^..param...... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // nvView.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // ewProj.......... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0xd2, 0x01, 0x00, // lphaRef4........ - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3d, 0x51, 0x00, 0x00, 0x67, 0x6c, 0x5f, // .........=Q..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_0_..... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7d, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // _0_..G...}...... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xd2, 0x01, 0x00, // .#... ...H...... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xf5, 0x00, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x7d, 0x01, 0x00, // .j... .......}.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .e...j...+...... - 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xb2, 0x04, 0x00, // .".............. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xd2, 0x01, 0x00, // .....".......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x7d, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .}...e...e...... - 0x00, 0xb2, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4f, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...O...... - 0x00, 0xd2, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x04, 0x00, 0x00, 0x42, 0x13, 0x00, // .....;...O...B.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // .....6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2d, 0x61, 0x00, // .............-a. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. - 0x00, 0x39, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xe7, 0x49, 0x00, 0x00, 0x4d, 0x0f, 0x00, // .9........I..M.. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x51, 0x00, // .....=.......=Q. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x3d, 0x51, 0x00, // .....>.......=Q. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .....8...6...... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .5...........7.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, // ................ - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......dW..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........N..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......I9..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........9..... - 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, // .P........*..dW. - 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..N..I9...9..... - 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // ..*..8...6...... - 0x00, 0x4d, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .M...........7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2c, 0x41, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x31, 0x27, 0x00, // .....,A......1'. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........^..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9d, 0x5e, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....^......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x9d, 0x5e, 0x00, // .........5....^. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x0a, 0x5a, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........Z..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x6b, 0x2e, 0x00, 0x00, 0x0a, 0x5a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x41, 0x00, // .k....Z..>...,A. - 0x00, 0x6b, 0x2e, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .k.......8.... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, // .main....-...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, // n........ ...$Gl + 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x08, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // obal..... ...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r........"...... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....-...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // agData0..G...... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x20, 0x00, 0x00, // .........H... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#.......G.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, // . .......G...".. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, // .".......G...-.. + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // . .......+...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, // ................ + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...!...... + 0x00, 0x20, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // . ...;...!...".. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, // .....+...#...$.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...%...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...,...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, // .....;...,...-.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x41, 0x00, 0x06, 0x00, 0x25, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .A...%...D...".. + 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .$...$...=...... + 0x00, 0x45, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x00, 0x00, // .E...D...>...-.. + 0x00, 0x45, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, // .E.......8...... + 0x00, // . }; static const uint8_t fs_clear0_dx9[198] = { diff --git a/3rdparty/bgfx/src/fs_clear0.sc b/3rdparty/bgfx/src/fs_clear0.sc index 7f7025d98ec..c3e1572ec44 100644 --- a/3rdparty/bgfx/src/fs_clear0.sc +++ b/3rdparty/bgfx/src/fs_clear0.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear1.bin.h b/3rdparty/bgfx/src/fs_clear1.bin.h index 1b7159c700b..9d90ec80e99 100644 --- a/3rdparty/bgfx/src/fs_clear1.bin.h +++ b/3rdparty/bgfx/src/fs_clear1.bin.h @@ -12,160 +12,57 @@ static const uint8_t fs_clear1_glsl[170] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x31, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[1];.}... }; -static const uint8_t fs_clear1_spv[2418] = +static const uint8_t fs_clear1_spv[769] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x02, 0x00, 0x00, 0x02, // clear_color..... - 0x00, 0x4c, 0x09, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .L.....#........ - 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0xd8, 0x02, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .......#........ + 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Q.............. 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ - 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, // .main........5.. - 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, // .vec4_splat(f1;. - 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x06, // ........._x..... - 0x00, 0xff, 0x0f, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, // .....@main(vf4;v - 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......O0..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xa2, 0x25, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..%..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _1_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .,N..param...... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // nvView.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // ewProj.......... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x9a, 0x06, 0x00, // lphaRef4........ - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xbd, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xdf, 0x38, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..8..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa3, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _1_.......G..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xda, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // _1_..G.......... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc7, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x9a, 0x06, 0x00, // .#... ...H...... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x05, 0x00, 0x3d, 0x0b, 0x00, // .........!...=.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, // ................ - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0xda, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, // .....e...j...+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....".......... - 0x00, 0xc7, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // ........."...... - 0x00, 0x9a, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0xda, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.......e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc7, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x09, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x9a, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x09, 0x00, // .........;...... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.............. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ./.......+...... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // ......... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa3, 0x47, 0x00, // .Sa..;........G. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, // .....9........,. - 0x00, 0xff, 0x0f, 0x00, 0x00, 0xa3, 0x47, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......G......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xbd, 0x43, 0x00, 0x00, 0xa3, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdf, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......8......>.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xbd, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... - 0x00, 0xdf, 0x38, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ..8......8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, // .....5.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. - 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, // .....=.......dW. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, // .....=........N. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, // .....=.......I9. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, // .....=........9. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, // .....P........*. - 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, // .dW...N..I9...9. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......*..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x0b, 0x00, // .............=.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4f, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......O0..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x25, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xee, 0x5f, 0x00, // ......%......._. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......,N..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2c, 0x4e, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>...,N......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x2c, 0x4e, 0x00, // .........5...,N. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x53, 0x18, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......S...B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x85, 0x5a, 0x00, 0x00, 0x53, 0x18, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4f, 0x30, 0x00, // ..Z..S...>...O0. - 0x00, 0x85, 0x5a, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xf9, 0x34, 0x00, // ..Z..A........4. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0xf9, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......!...4..>.. - 0x00, 0xa2, 0x25, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ..%...!......8.. - 0x00, 0x00, // .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .main....4...6.. + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, // .main........!.. + 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x08, 0x00, 0x21, 0x00, 0x00, // .$Global.....!.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, // color........#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x34, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // .........4...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData0..... + 0x00, 0x36, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .6...bgfx_FragDa + 0x74, 0x61, 0x31, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ta1..G... ...... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...!...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, // .#.......G...!.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G...#...".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x34, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...4...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...6...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // . .............. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, // .....+.......... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // ......... ...... + 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x21, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........!... .. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, // . ...".......!.. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .;..."...#...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....$... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+...$...%...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // . ...&.......... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .+...$...)...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // . ...3.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x33, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...3...4...... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x33, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...3...6...... + 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x26, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, // .&...M...#...%.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, // .%...=.......N.. + 0x00, 0x4d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x26, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, // .M...A...&...O.. + 0x00, 0x23, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .#...%...)...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....P...O...>.. + 0x00, 0x34, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x00, 0x00, // .4...N...>...6.. + 0x00, 0x50, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, // .P.......8..... + 0x00, // . }; static const uint8_t fs_clear1_dx9[210] = { diff --git a/3rdparty/bgfx/src/fs_clear1.sc b/3rdparty/bgfx/src/fs_clear1.sc index 921c19fe31e..81701cdd247 100644 --- a/3rdparty/bgfx/src/fs_clear1.sc +++ b/3rdparty/bgfx/src/fs_clear1.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear2.bin.h b/3rdparty/bgfx/src/fs_clear2.bin.h index 5ad3d268131..19d9d0a6632 100644 --- a/3rdparty/bgfx/src/fs_clear2.bin.h +++ b/3rdparty/bgfx/src/fs_clear2.bin.h @@ -15,176 +15,65 @@ static const uint8_t fs_clear2_glsl[210] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x32, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[2];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear2_spv[2678] = +static const uint8_t fs_clear2_spv[897] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x03, 0x00, 0x00, 0x03, // clear_color..... - 0x00, 0x50, 0x0a, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .P.....#........ - 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x58, 0x03, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .X.....#........ + 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // ................ 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .main....;...=.. + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .?.............. 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, // ................ - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....main....... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x07, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // f4;vf4;vf4;..... - 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_....../B..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... - 0x00, 0x10, 0x46, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..F..gl_FragData - 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _2_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0xf4, 0x56, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..V..param...... - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .b...$Global.... - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .b.......u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......b...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .b.......u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....b.......u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // nvView.......b.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .b.......u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......b...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .b.......u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // ewProj.......b.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .b.......u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....b...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....b.......u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x62, 0x0b, 0x00, // lphaRef4.....b.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x8c, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..9..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_......@,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_2_..... - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... - 0x00, 0x5f, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ._U..param...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // _2_..G...7...... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...b...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#.......H...b.. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .b.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...b...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...b...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#...`...H...b.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .b.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...b...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...b...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#.......H...b.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .b.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...b...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...b...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#...`...H...b.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .b.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...b...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...b...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#.......H...b.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .b...........H.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .b.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...b.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H...b...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x62, 0x0b, 0x00, // .#... ...H...b.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0x62, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .b.......G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x91, 0x00, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....e.......... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, // .+.......j... .. - 0x00, 0x1c, 0x00, 0x04, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....7...e...j.. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, // .+......."...... - 0x00, 0x1c, 0x00, 0x04, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .............".. - 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....b.......... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x37, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...7...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdc, 0x04, 0x00, 0x00, 0x20, 0x00, 0x04, // .e........... .. - 0x00, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x62, 0x0b, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........b...;.. - 0x00, 0x1c, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .....B.......... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ...../.......+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .....Sa..;...... - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..G......;...... - 0x00, 0x5f, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ._U......;...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, // .........9...... - 0x00, 0xbe, 0x2c, 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x5f, 0x55, 0x00, // ..,.......G.._U. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....=........C. - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8c, 0x39, 0x00, // ..G..=........9. - 0x00, 0x5f, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, // ._U..=.......@,. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....>........C. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x8c, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........9..>.. - 0x00, 0xb3, 0x15, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .....@,......8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.......5...... - 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .dW......=...... - 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ..N......=...... - 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .I9......=...... - 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ..9......P...... - 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, // ..*..dW...N..I9. - 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, // ..9.......*..8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x82, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x91, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe2, 0x2e, 0x00, // .....7.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x37, 0x00, 0x03, // .7......./B..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x10, 0x46, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x37, 0x1e, 0x00, // ......F......7.. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........V..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....V......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0xf4, 0x56, 0x00, // .........5....V. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x1b, 0x21, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........!..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xce, 0x18, 0x00, 0x00, 0x1b, 0x21, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x2e, 0x00, // ......!..>...... - 0x00, 0xce, 0x18, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xc1, 0x3d, 0x00, // .....A........=. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf2, 0x1b, 0x00, 0x00, 0xc1, 0x3d, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..........=..>.. - 0x00, 0x2f, 0x42, 0x00, 0x00, 0xf2, 0x1b, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ./B......A...... - 0x00, 0xc2, 0x3d, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..=..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe6, 0x29, 0x00, 0x00, 0xc2, 0x3d, 0x00, // .=........)...=. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x10, 0x46, 0x00, 0x00, 0xe6, 0x29, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>....F...)..... - 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .8.... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....main....... + 0x00, 0x22, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x08, // ."...$Global.... + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // .".......bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, // ear_color....... + 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3b, 0x00, 0x00, // .$...........;.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x05, 0x00, 0x06, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....=...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x31, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3f, 0x00, 0x00, // agData1......?.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x32, 0x00, // .bgfx_FragData2. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .G...!.......... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...".......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...$..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...=.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .G...?.......... + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x15, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .+....... ...... + 0x00, 0x1c, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .....!....... .. + 0x00, 0x1e, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ....."...!... .. + 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .#......."...;.. + 0x00, 0x23, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .#...$.......... + 0x00, 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .%... .......+.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .%...&....... .. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .'...........+.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .%...*.......+.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .%...-....... .. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .:...........;.. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .:...;.......;.. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .:...=.......;.. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .:...?.......6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, // .........A...'.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .V...$...&...&.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, // .=.......W...V.. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, // .A...'...X...$.. + 0x00, 0x26, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .&...*...=...... + 0x00, 0x59, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x27, 0x00, 0x00, // .Y...X...A...'.. + 0x00, 0x5a, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, // .Z...$...&...-.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, // .=.......[...Z.. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...;...W...>.. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x3f, 0x00, 0x00, // .=...Y...>...?.. + 0x00, 0x5b, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, // .[.......8.....0 + 0x00, // . }; static const uint8_t fs_clear2_dx9[222] = { diff --git a/3rdparty/bgfx/src/fs_clear2.sc b/3rdparty/bgfx/src/fs_clear2.sc index 163430f5984..90a9e4beccb 100644 --- a/3rdparty/bgfx/src/fs_clear2.sc +++ b/3rdparty/bgfx/src/fs_clear2.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear3.bin.h b/3rdparty/bgfx/src/fs_clear3.bin.h index 67c7bce9fb8..1bf05f08031 100644 --- a/3rdparty/bgfx/src/fs_clear3.bin.h +++ b/3rdparty/bgfx/src/fs_clear3.bin.h @@ -17,192 +17,73 @@ static const uint8_t fs_clear3_glsl[250] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x33, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[3];.}... }; -static const uint8_t fs_clear3_spv[2938] = +static const uint8_t fs_clear3_spv[1025] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x04, 0x00, 0x00, 0x04, // clear_color..... - 0x00, 0x54, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .T.....#........ - 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0xd8, 0x03, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .......#........ + 0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .g.............. 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, // .main....B...D.. + 0x00, 0x46, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, // .F...H.......... 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, // ................ - 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, // .....5...vec4_sp - 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, // lat(f1;......... - 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0xf4, 0x0c, 0x00, 0x00, 0x40, 0x6d, 0x61, // ._x..........@ma - 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // in(vf4;vf4;vf4;v - 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8f, 0x22, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......."..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xf3, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..T..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_......NJ..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xd8, 0x4e, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..N..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _3_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x83, 0x46, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..F..param...... - 0x00, 0x67, 0x04, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .g...$Global.... - 0x00, 0x67, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .g.......u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......g...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .g.......u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....g.......u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // nvView.......g.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0x67, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .g.......u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......g...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0x67, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .g.......u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // ewProj.......g.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0x67, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .g.......u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....g...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....g.......u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x67, 0x04, 0x00, // lphaRef4.....g.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .@,..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _3_.......G..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // am........U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......I8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // _3_..G.......... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...g...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#.......H...g.. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .g.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...g...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...g...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#...`...H...g.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .g.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...g...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...g...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#.......H...g.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .g.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...g...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...g...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#...`...H...g.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .g.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x67, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...g...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...g...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#.......H...g.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .g...........H.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .g.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...g.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H...g...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x67, 0x04, 0x00, // .#... ...H...g.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0x67, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .g.......G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x3a, 0x04, 0x00, // .........!...:.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .........e...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....+.......j.. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x94, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, // . ...........e.. - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .j...+.......".. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf1, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x67, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, // .".......g...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .....e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, // .e...e...e...... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf1, 0x04, 0x00, // .e...e.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0xe4, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x04, 0x00, // . ...........g.. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe4, 0x06, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, // .;.......B...... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, // .+......./...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // .+.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........Sa..;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......G......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......U......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....I8......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x08, // .............9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, 0x00, 0xf4, 0x0c, 0x00, 0x00, 0xc9, 0x47, 0x00, // ......,.......G. - 0x00, 0x85, 0x55, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..U..I8......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....y9...U..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..I8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....@,......>.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb3, 0x15, 0x00, 0x00, 0xed, 0x2c, 0x00, // .y9..>........,. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.......@,..... - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....dW......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......N......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....I9......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // ......9......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, // ......*..dW...N. - 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, // .I9...9.......*. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xf4, 0x0c, 0x00, // .8...6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x04, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .....:...7...... - 0x00, 0x8f, 0x22, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf3, 0x54, 0x00, // .."..7........T. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......NJ..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd8, 0x4e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x45, 0x58, 0x00, // ......N......EX. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x83, 0x46, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........F..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x83, 0x46, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....F......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x83, 0x46, 0x00, // .........5....F. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x29, 0x5b, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......)[..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x96, 0x21, 0x00, 0x00, 0x29, 0x5b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8f, 0x22, 0x00, // ..!..)[..>....". - 0x00, 0x96, 0x21, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x46, 0x00, // ..!..A........F. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x89, 0x46, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......V...F..>.. - 0x00, 0xf3, 0x54, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..T...V..A...... - 0x00, 0x8a, 0x46, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..F..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x56, 0x00, 0x00, 0x8a, 0x46, 0x00, // .=........V...F. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x01, 0x56, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...NJ...V..A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x8b, 0x46, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......F..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x75, 0x19, 0x00, // .....=.......u.. - 0x00, 0x8b, 0x46, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd8, 0x4e, 0x00, 0x00, 0x75, 0x19, 0x00, // ..F..>....N..u.. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... + 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x05, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // .....#...$Global + 0x00, 0x06, 0x00, 0x08, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // .....#.......bgf + 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, // x_clear_color... + 0x00, 0x05, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....%.......... + 0x00, 0x42, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .B...bgfx_FragDa + 0x74, 0x61, 0x30, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x44, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta0......D...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x31, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData1..... + 0x00, 0x46, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .F...bgfx_FragDa + 0x74, 0x61, 0x32, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x48, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta2......H...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x33, 0x00, 0x00, 0x47, 0x00, 0x04, // x_FragData3..G.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ."...........H.. + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .#.......#...... + 0x00, 0x47, 0x00, 0x03, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...#.......G.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .%...".......G.. + 0x00, 0x42, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .B...........G.. + 0x00, 0x44, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .D...........G.. + 0x00, 0x46, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .F...........G.. + 0x00, 0x48, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // .H.............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....!.......... + 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ......... ...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // . ... .......+.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // . ...!.......... + 0x00, 0x22, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, // .".......!...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, // .#..."... ...$.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, // .....#...;...$.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, // .%...........&.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, // . .......+...&.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, // .'....... ...(.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, // .........+...&.. + 0x00, 0x2b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, // .+.......+...&.. + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, // .........+...&.. + 0x00, 0x31, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, // .1....... ...A.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, // .........;...A.. + 0x00, 0x42, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, // .B.......;...A.. + 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, // .D.......;...A.. + 0x00, 0x46, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x41, 0x00, 0x00, // .F.......;...A.. + 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, // .H.......6...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x28, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, // .....A...(..._.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .%...'...'...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .....`..._...A.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, // .(...a...%...'.. + 0x00, 0x2b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, // .+...=.......b.. + 0x00, 0x61, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x28, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, // .a...A...(...c.. + 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .%...'.......=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .....d...c...A.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, // .(...e...%...'.. + 0x00, 0x31, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, // .1...=.......f.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x42, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .e...>...B...`.. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x44, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...D...b...>.. + 0x00, 0x46, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x48, 0x00, 0x00, // .F...d...>...H.. + 0x00, 0x66, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, // .f.......8.....@ + 0x00, // . }; static const uint8_t fs_clear3_dx9[234] = { diff --git a/3rdparty/bgfx/src/fs_clear3.sc b/3rdparty/bgfx/src/fs_clear3.sc index 96b82934b6b..3dd4accb4c3 100644 --- a/3rdparty/bgfx/src/fs_clear3.sc +++ b/3rdparty/bgfx/src/fs_clear3.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear4.bin.h b/3rdparty/bgfx/src/fs_clear4.bin.h index 0fb82b48509..70e1266808a 100644 --- a/3rdparty/bgfx/src/fs_clear4.bin.h +++ b/3rdparty/bgfx/src/fs_clear4.bin.h @@ -20,208 +20,81 @@ static const uint8_t fs_clear4_glsl[290] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x34, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[4];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear4_spv[3198] = +static const uint8_t fs_clear4_spv[1153] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x05, 0x00, 0x00, 0x05, // clear_color..... - 0x00, 0x58, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .X.....#........ - 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x58, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .X.....#........ + 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .r.............. 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x10, 0x00, 0x03, // ................ - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, // n........5...vec - 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, // 4_splat(f1;..... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x66, 0x11, 0x00, // ....._x......f.. - 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // .@main(vf4;vf4;v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // f4;vf4;vf4;..... - 0x00, 0xbb, 0x60, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..`..gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_.......+..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... - 0x00, 0xc3, 0x44, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..D..gl_FragData - 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x16, 0x53, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_.......S..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... - 0x00, 0xa0, 0x57, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..W..gl_FragData - 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _4_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x4b, 0x4f, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .KO..param...... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // ./...$Global.... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // ./.......u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, // ect....../...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // ./.......u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // ...../.......u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // nvView......./.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // ./.......u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, // oj......./...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // ./.......u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // ewProj......./.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // ./.......u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, // View...../...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // ...../.......u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x2f, 0x09, 0x00, // lphaRef4...../.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_......@,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_4_..... - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... - 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..U..param...... - 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .o8..param...... - 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .I8..param...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... - 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // _4_..G.......... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x06, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.../...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#.......H.../.. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ./.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.../...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.../...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#...`...H.../.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // ./.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.../...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.../...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#.......H.../.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // ./.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.../...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.../...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#...`...H.../.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // ./.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.../...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.../...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#.......H.../.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // ./...........H.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // ./.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.../.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.../...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2f, 0x09, 0x00, // .#... ...H.../.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // ./.......G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x08, 0x00, 0x75, 0x0a, 0x00, // .........!...u.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xf1, 0x02, 0x00, // .j... .......... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .e...j...+...... - 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x06, 0x05, 0x00, // .".............. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x2f, 0x09, 0x00, // ....."......./.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0xf1, 0x02, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....e...e...... - 0x00, 0x06, 0x05, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xac, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x2f, 0x09, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xac, 0x0b, 0x00, 0x00, 0x42, 0x13, 0x00, // ./...;.......B.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, // .....+.......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, // .....+.......... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, // .....+.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x17, 0x0a, 0x00, // .....+.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd2, 0x11, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // .....6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, // .............Sa. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........G..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........U..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......o8..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......I8..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. - 0x00, 0x39, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, 0x00, 0x66, 0x11, 0x00, // .9........,..f.. - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, // ..G...U..o8..I8. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....=........C. - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, // ..G..=.......y9. - 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, // ..U..=........,. - 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, // .o8..=........,. - 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, // .I8..=.......@,. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....>........C. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>.......y9..>.. - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, // ......,..>...... - 0x00, 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x40, 0x2c, 0x00, // ..,..>.......@,. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .....8...6...... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .5...........7.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, // ................ - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......dW..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........N..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......I9..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........9..... - 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, // .P........*..dW. - 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..N..I9...9..... - 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // ..*..8...6...... - 0x00, 0x66, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x0a, 0x00, 0x00, 0x37, 0x00, 0x03, // .f.......u...7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbb, 0x60, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......`..7...... - 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc3, 0x44, 0x00, // ..+..7........D. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x16, 0x53, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........S..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa0, 0x57, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x0d, 0x61, 0x00, // ......W.......a. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x4b, 0x4f, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......KO..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4b, 0x4f, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>...KO......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x4b, 0x4f, 0x00, // .........5...KO. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x72, 0x19, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......r...B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xa4, 0x5b, 0x00, 0x00, 0x72, 0x19, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbb, 0x60, 0x00, // ..[..r...>....`. - 0x00, 0xa4, 0x5b, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x18, 0x36, 0x00, // ..[..A........6. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc8, 0x5e, 0x00, 0x00, 0x18, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......^...6..>.. - 0x00, 0x8b, 0x2b, 0x00, 0x00, 0xc8, 0x5e, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..+...^..A...... - 0x00, 0x19, 0x36, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..6..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc9, 0x5e, 0x00, 0x00, 0x19, 0x36, 0x00, // .=........^...6. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x44, 0x00, 0x00, 0xc9, 0x5e, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....D...^..A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x1a, 0x36, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......6..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xca, 0x5e, 0x00, // .....=........^. - 0x00, 0x1a, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x16, 0x53, 0x00, 0x00, 0xca, 0x5e, 0x00, // ..6..>....S...^. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x1b, 0x36, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........6..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x3d, 0x22, 0x00, 0x00, 0x1b, 0x36, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa0, 0x57, 0x00, // .="...6..>....W. - 0x00, 0x3d, 0x22, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .="......8.... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, // .main....I...K.. + 0x00, 0x4d, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, // .M...O...Q...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, // n........$...$Gl + 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x08, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // obal.....$...... + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // .bgfx_clear_colo + 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r........&...... + 0x00, 0x05, 0x00, 0x06, 0x00, 0x49, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....I...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4b, 0x00, 0x00, // agData0......K.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x31, 0x00, // .bgfx_FragData1. + 0x00, 0x05, 0x00, 0x06, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....M...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x32, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x4f, 0x00, 0x00, // agData2......O.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x33, 0x00, // .bgfx_FragData3. + 0x00, 0x05, 0x00, 0x06, 0x00, 0x51, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....Q...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x34, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, // agData4..G...#.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, // .........H...$.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#.......G.. + 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, // .$.......G...&.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x49, 0x00, 0x00, // .".......G...I.. + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, // .........G...K.. + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, // .........G...M.. + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, // .........G...O.. + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x51, 0x00, 0x00, // .........G...Q.. + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, // .............!.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, // . .......+...!.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, // ."...........#.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x24, 0x00, 0x00, // .....".......$.. + 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .#... ...%...... + 0x00, 0x24, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .$...;...%...&.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........'... .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .....+...'...(.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...)...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, // .....+...'...,.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, // .....+...'.../.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, // .....+...'...2.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, // .....+...'...5.. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... ...H...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, // .....;...H...I.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, // .....;...H...K.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, // .....;...H...M.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, // .....;...H...O.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x48, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, // .....;...H...Q.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x41, 0x00, 0x06, 0x00, 0x29, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .A...)...h...&.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .(...(...=...... + 0x00, 0x69, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x29, 0x00, 0x00, // .i...h...A...).. + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, // .j...&...(...,.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, // .=.......k...j.. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x29, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .A...)...l...&.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .(.../...=...... + 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x29, 0x00, 0x00, // .m...l...A...).. + 0x00, 0x6e, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, // .n...&...(...2.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, // .=.......o...n.. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x29, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, // .A...)...p...&.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .(...5...=...... + 0x00, 0x71, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x49, 0x00, 0x00, // .q...p...>...I.. + 0x00, 0x69, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, // .i...>...K...k.. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...M...m...>.. + 0x00, 0x4f, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x51, 0x00, 0x00, // .O...o...>...Q.. + 0x00, 0x71, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, // .q.......8.....P + 0x00, // . }; static const uint8_t fs_clear4_dx9[234] = { diff --git a/3rdparty/bgfx/src/fs_clear4.sc b/3rdparty/bgfx/src/fs_clear4.sc index 6e62276e04f..7390a02ca11 100644 --- a/3rdparty/bgfx/src/fs_clear4.sc +++ b/3rdparty/bgfx/src/fs_clear4.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear5.bin.h b/3rdparty/bgfx/src/fs_clear5.bin.h index 3765521e1ef..26d53fe54b4 100644 --- a/3rdparty/bgfx/src/fs_clear5.bin.h +++ b/3rdparty/bgfx/src/fs_clear5.bin.h @@ -22,225 +22,89 @@ static const uint8_t fs_clear5_glsl[330] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x35, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[5];.}... }; -static const uint8_t fs_clear5_spv[3458] = +static const uint8_t fs_clear5_spv[1281] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x06, 0x00, 0x00, 0x06, // clear_color..... - 0x00, 0x5c, 0x0d, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .......#........ - 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0xd8, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .......#........ + 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .}.............. 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xc3, 0x15, 0x00, // ................ - 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ - 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, // .main........5.. - 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, // .vec4_splat(f1;. - 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x0a, // ........._x..... - 0x00, 0x44, 0x12, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, // .D...@main(vf4;v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // f4;vf4;vf4;vf4;v - 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x68, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;......hT..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xa2, 0x4c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..L..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x52, 0x34, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_......R4..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0x53, 0x34, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .S4..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa5, 0x42, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......B..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0x2f, 0x47, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ./G..gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _5_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x13, 0x58, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..X..param...... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .4...$Global.... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .4.......u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......4...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .4.......u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....4.......u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // nvView.......4.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .4.......u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......4...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .4.......u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // ewProj.......4.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .4.......u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....4...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....4.......u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0x34, 0x02, 0x00, // lphaRef4.....4.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .@,..gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _5_.......G..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // am........U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......o8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x70, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......p8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......I8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0xc3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, // _5_..G...N...... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x1b, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...4...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#.......H...4.. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .4.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...4...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H...4...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#...`...H...4.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .4.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...4...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...4...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#.......H...4.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .4.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...4...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H...4...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#...`...H...4.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .4.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x34, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...4...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...4...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#.......H...4.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .4...........H.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .4.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...4.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H...4...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x34, 0x02, 0x00, // .#... ...H...4.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0x34, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .4.......G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x09, 0x00, 0x7f, 0x07, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, // ................ - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, // .N...e...j...+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....".......... - 0x00, 0x1b, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // ........."...... - 0x00, 0x34, 0x02, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .4...........e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x4e, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...N...e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1b, 0x05, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb1, 0x04, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb1, 0x04, 0x00, // .....4...;...... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.............. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ./.......+...... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x17, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .........+...... - 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // ......... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xc3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, // .Sa..;........G. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, // .....;.......o8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x70, 0x38, 0x00, // .....;.......p8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, // .....;.......I8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, // .....9........,. - 0x00, 0x44, 0x12, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, // .D....G...U..o8. - 0x00, 0x70, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // .p8..I8......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....y9...U..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..o8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..p8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..I8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....@,......>.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, // .y9..>........,. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........,..>.. - 0x00, 0xd2, 0x11, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x15, 0x00, // ......,..>...... - 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .@,......8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, // .....5.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. - 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, // .....=.......dW. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, // .....=........N. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, // .....=.......I9. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, // .....=........9. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, // .....P........*. - 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, // .dW...N..I9...9. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......*..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x44, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x07, 0x00, // .....D.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x68, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......hT..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa2, 0x4c, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......L..7...... - 0x00, 0x52, 0x34, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x53, 0x34, 0x00, // .R4..7.......S4. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa5, 0x42, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........B..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2f, 0x47, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x56, 0x1f, 0x00, // ...../G......V.. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x58, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........X..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x13, 0x58, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....X......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x58, 0x00, // .........5....X. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3a, 0x22, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......:"..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xed, 0x19, 0x00, 0x00, 0x3a, 0x22, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x68, 0x54, 0x00, // .....:"..>...hT. - 0x00, 0xed, 0x19, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe0, 0x3e, 0x00, // .....A........>. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x11, 0x1d, 0x00, 0x00, 0xe0, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..........>..>.. - 0x00, 0xa2, 0x4c, 0x00, 0x00, 0x11, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..L......A...... - 0x00, 0xe1, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..>..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x12, 0x1d, 0x00, 0x00, 0xe1, 0x3e, 0x00, // .=............>. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x52, 0x34, 0x00, 0x00, 0x12, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...R4......A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe2, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......>..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x1d, 0x00, // .....=.......... - 0x00, 0xe2, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x53, 0x34, 0x00, 0x00, 0x13, 0x1d, 0x00, // ..>..>...S4..... - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe3, 0x3e, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........>..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x14, 0x1d, 0x00, 0x00, 0xe3, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa5, 0x42, 0x00, // ......>..>....B. - 0x00, 0x14, 0x1d, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xe4, 0x3e, 0x00, // .....A........>. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x05, 0x2b, 0x00, 0x00, 0xe4, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......+...>..>.. - 0x00, 0x2f, 0x47, 0x00, 0x00, 0x05, 0x2b, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ./G...+......8.. - 0x00, 0x00, // .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, // .main....P...R.. + 0x00, 0x54, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, // .T...V...X...Z.. + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, // .main........%.. + 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x08, 0x00, 0x25, 0x00, 0x00, // .$Global.....%.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x27, 0x00, 0x00, // color........'.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x50, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // .........P...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData0..... + 0x00, 0x52, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .R...bgfx_FragDa + 0x74, 0x61, 0x31, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x54, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta1......T...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x32, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData2..... + 0x00, 0x56, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .V...bgfx_FragDa + 0x74, 0x61, 0x33, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x58, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta3......X...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x34, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData4..... + 0x00, 0x5a, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .Z...bgfx_FragDa + 0x74, 0x61, 0x35, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ta5..G...$...... + 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...%...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, // .#.......G...%.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G...'...".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x50, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...P...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...R...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...T...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x56, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...V...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...X...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...Z...... + 0x00, 0x05, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // . .............. + 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ........."... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .....+..."...#.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .........$...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, // .#.......%...$.. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, // . ...&.......%.. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .;...&...'...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....(... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+...(...)...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // . ...*.......... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .+...(...-...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .+...(...0...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .+...(...3...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .+...(...6...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // .+...(...9...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // . ...O.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...O...P...... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...O...R...... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...O...T...... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...O...V...... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...O...X...... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .;...O...Z...... + 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, // .*...q...'...).. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, // .)...=.......r.. + 0x00, 0x71, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, // .q...A...*...s.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .'...)...-...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .....t...s...A.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, // .*...u...'...).. + 0x00, 0x30, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, // .0...=.......v.. + 0x00, 0x75, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, // .u...A...*...w.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .'...)...3...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .....x...w...A.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, // .*...y...'...).. + 0x00, 0x36, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, // .6...=.......z.. + 0x00, 0x79, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, // .y...A...*...{.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .'...)...9...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....|...{...>.. + 0x00, 0x50, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x52, 0x00, 0x00, // .P...r...>...R.. + 0x00, 0x74, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x54, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, // .t...>...T...v.. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x56, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...V...x...>.. + 0x00, 0x58, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5a, 0x00, 0x00, // .X...z...>...Z.. + 0x00, 0x7c, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, // .|.......8.....` + 0x00, // . }; static const uint8_t fs_clear5_dx9[234] = { diff --git a/3rdparty/bgfx/src/fs_clear5.sc b/3rdparty/bgfx/src/fs_clear5.sc index b2157bf2ff0..0deb9ff95e0 100644 --- a/3rdparty/bgfx/src/fs_clear5.sc +++ b/3rdparty/bgfx/src/fs_clear5.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear6.bin.h b/3rdparty/bgfx/src/fs_clear6.bin.h index 50f560bad57..bc0561c8b52 100644 --- a/3rdparty/bgfx/src/fs_clear6.bin.h +++ b/3rdparty/bgfx/src/fs_clear6.bin.h @@ -25,241 +25,97 @@ static const uint8_t fs_clear6_glsl[370] = 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5b, 0x36, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, // ear_color[6];.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_clear6_spv[3718] = +static const uint8_t fs_clear6_spv[1409] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x07, 0x00, 0x00, 0x07, // clear_color..... - 0x00, 0x60, 0x0e, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .`.....#........ - 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .Ta............. + 0x00, 0x58, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .X.....#........ + 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // ................ 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xc3, 0x15, 0x00, // ................ - 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, // .main....W...Y.. + 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, // .[...]..._...a.. + 0x00, 0x63, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .c.............. 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, // ................ - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....main....... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x0b, 0x00, 0x97, 0x0f, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // f4;vf4;vf4;vf4;v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, // f4;vf4;vf4;..... - 0x00, 0x15, 0x48, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..H..gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x3a, 0x23, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_......:#..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... - 0x00, 0x1a, 0x3d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..=..gl_FragData - 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x1b, 0x3d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_.......=..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... - 0x00, 0x1c, 0x3d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..=..gl_FragData - 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x6d, 0x4b, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _4_......mK..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_5_..... - 0x00, 0xf7, 0x4f, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..O..gl_FragData - 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _6_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0xa2, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // nvView.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // ewProj.......... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0xfc, 0x06, 0x00, // lphaRef4........ - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_......@,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, // FragData_6_..... - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..G..param...... - 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..U..param...... - 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .o8..param...... - 0x00, 0x70, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .p8..param...... - 0x00, 0x71, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .q8..param...... - 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .I8..param...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....param...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _0_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_1_..... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _2_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_3_..... - 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _4_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_5_..... - 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, // _6_..G.......... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x30, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G...0...... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xfc, 0x06, 0x00, // .#... ...H...... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0xfc, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x0a, 0x00, 0x1b, 0x07, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....e.......... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, // .+.......j... .. - 0x00, 0x1c, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .........e...j.. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, // .+......."...... - 0x00, 0x1c, 0x00, 0x04, 0x00, 0x30, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .....0.......".. - 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e.......e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x30, 0x05, 0x00, 0x00, 0x20, 0x00, 0x04, // .e.......0... .. - 0x00, 0x79, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y...........;.. - 0x00, 0x79, 0x09, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .y...B.......... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ...../.......+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .....Sa..;...... - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..G......;...... - 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..U......;...... - 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .o8......;...... - 0x00, 0x70, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .p8......;...... - 0x00, 0x71, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .q8......;...... - 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .I8......;...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x0b, 0x00, 0x08, 0x00, 0x00, // .........9...... - 0x00, 0xbe, 0x2c, 0x00, 0x00, 0x97, 0x0f, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x85, 0x55, 0x00, // ..,.......G...U. - 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x71, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, // .o8..p8..q8..I8. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....=........C. - 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, // ..G..=.......y9. - 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, // ..U..=........,. - 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2c, 0x00, // .o8..=........,. - 0x00, 0x70, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdc, 0x2c, 0x00, // .p8..=........,. - 0x00, 0x71, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, // .q8..=........,. - 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, // .I8..=.......@,. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, // .....>........C. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>.......y9..>.. - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, // ......,..>...... - 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xdc, 0x2c, 0x00, // ..,..>........,. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x15, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........,..>.. - 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .....@,......8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.......5...... - 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .dW......=...... - 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ..N......=...... - 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .I9......=...... - 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ..9......P...... - 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0x49, 0x39, 0x00, // ..*..dW...N..I9. - 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x38, 0x00, 0x01, // ..9.......*..8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x97, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x1b, 0x07, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x15, 0x48, 0x00, // .....7........H. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x3a, 0x23, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......:#..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1a, 0x3d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......=..7...... - 0x00, 0x1b, 0x3d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1c, 0x3d, 0x00, // ..=..7........=. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6d, 0x4b, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......mK..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf7, 0x4f, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x64, 0x59, 0x00, // ......O......dY. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xa2, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........G..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa2, 0x47, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....G......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0xa2, 0x47, 0x00, // .........5....G. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x48, 0x5c, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......H...B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xfb, 0x53, 0x00, 0x00, 0x48, 0x5c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x15, 0x48, 0x00, // ..S..H...>....H. - 0x00, 0xfb, 0x53, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xa8, 0x47, 0x00, // ..S..A........G. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x57, 0x00, 0x00, 0xa8, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......W...G..>.. - 0x00, 0x3a, 0x23, 0x00, 0x00, 0x1f, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // .:#...W..A...... - 0x00, 0xa9, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // ..G..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x57, 0x00, 0x00, 0xa9, 0x47, 0x00, // .=....... W...G. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1a, 0x3d, 0x00, 0x00, 0x20, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....=.. W..A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0xaa, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......G..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x57, 0x00, // .....=.......!W. - 0x00, 0xaa, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1b, 0x3d, 0x00, 0x00, 0x21, 0x57, 0x00, // ..G..>....=..!W. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xab, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, // .A........G..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0x22, 0x57, 0x00, 0x00, 0xab, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1c, 0x3d, 0x00, // ."W...G..>....=. - 0x00, 0x22, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xac, 0x47, 0x00, // ."W..A........G. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x23, 0x57, 0x00, 0x00, 0xac, 0x47, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....#W...G..>.. - 0x00, 0x6d, 0x4b, 0x00, 0x00, 0x23, 0x57, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // .mK..#W..A...... - 0x00, 0xad, 0x47, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1d, 0x0a, 0x00, // ..G..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x94, 0x1a, 0x00, 0x00, 0xad, 0x47, 0x00, // .=............G. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf7, 0x4f, 0x00, 0x00, 0x94, 0x1a, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>....O......... - 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .8.... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....main....... + 0x00, 0x26, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x08, // .&...$Global.... + 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, // .&.......bgfx_cl + 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, // ear_color....... + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x57, 0x00, 0x00, // .(...........W.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x05, 0x00, 0x06, 0x00, 0x59, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....Y...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x31, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x5b, 0x00, 0x00, // agData1......[.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x32, 0x00, // .bgfx_FragData2. + 0x00, 0x05, 0x00, 0x06, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....]...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x33, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x5f, 0x00, 0x00, // agData3......_.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x34, 0x00, // .bgfx_FragData4. + 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, // .....a...bgfx_Fr + 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x35, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x63, 0x00, 0x00, // agData5......c.. + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x36, 0x00, // .bgfx_FragData6. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .G...%.......... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...&.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...&...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...(..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x57, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...W.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x59, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...Y.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .G...[.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // .G...].......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .G..._.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x61, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, // .G...a.......... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x63, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // .G...c.......... + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x17, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x15, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....#... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .+...#...$...... + 0x00, 0x1c, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, // .....%.......$.. + 0x00, 0x1e, 0x00, 0x03, 0x00, 0x26, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....&...%... .. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .'.......&...;.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .'...(.......... + 0x00, 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .)... .......+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .)...*....... .. + 0x00, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .+...........+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .)...........+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .)...1.......+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .)...4.......+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .)...7.......+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .)...:.......+.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .)...=....... .. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V...........;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V...W.......;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V...Y.......;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V...[.......;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V...].......;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V..._.......;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .V...a.......;.. + 0x00, 0x56, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .V...c.......6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, // .........A...+.. + 0x00, 0x7a, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, // .z...(...*...*.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, // .=.......{...z.. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .A...+...|...(.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .*.......=...... + 0x00, 0x7d, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, // .}...|...A...+.. + 0x00, 0x7e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, // .~...(...*...1.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, // .=...........~.. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .A...+.......(.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .*...4...=...... + 0x00, 0x81, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, // .........A...+.. + 0x00, 0x82, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, // .....(...*...7.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, // .=.............. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .A...+.......(.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .*...:...=...... + 0x00, 0x85, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2b, 0x00, 0x00, // .........A...+.. + 0x00, 0x86, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .....(...*...=.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, // .=.............. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x57, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...W...{...>.. + 0x00, 0x59, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5b, 0x00, 0x00, // .Y...}...>...[.. + 0x00, 0x7f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // .....>...]...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>..._.......>.. + 0x00, 0x61, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x63, 0x00, 0x00, // .a.......>...c.. + 0x00, 0x87, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x70, // .........8.....p + 0x00, // . }; static const uint8_t fs_clear6_dx9[234] = { diff --git a/3rdparty/bgfx/src/fs_clear6.sc b/3rdparty/bgfx/src/fs_clear6.sc index 32bcb0ca60e..971f5b4e3d1 100644 --- a/3rdparty/bgfx/src/fs_clear6.sc +++ b/3rdparty/bgfx/src/fs_clear6.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_clear7.bin.h b/3rdparty/bgfx/src/fs_clear7.bin.h index c43bccd472b..29a984ad7c1 100644 --- a/3rdparty/bgfx/src/fs_clear7.bin.h +++ b/3rdparty/bgfx/src/fs_clear7.bin.h @@ -27,257 +27,105 @@ static const uint8_t fs_clear7_glsl[410] = 0x20, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // bgfx_clear_colo 0x72, 0x5b, 0x37, 0x5d, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r[7];.}... }; -static const uint8_t fs_clear7_spv[3978] = +static const uint8_t fs_clear7_spv[1537] = { 0x46, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x62, 0x67, 0x66, 0x78, 0x5f, // FSH........bgfx_ 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x08, 0x00, 0x00, 0x08, // clear_color..... - 0x00, 0x64, 0x0f, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, // .d.....#........ - 0x00, 0x2d, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // .-b............. + 0x00, 0xd8, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, // .......#........ + 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, // ................ 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, // .........GLSL.st 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, // d.450........... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // ................ - 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xc2, 0x11, 0x00, // .main........... - 0x00, 0xb3, 0x15, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0xc3, 0x15, 0x00, // ................ - 0x00, 0xf1, 0x0d, 0x00, 0x00, 0xe2, 0x11, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .main....^...`.. + 0x00, 0x62, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, // .b...d...f...h.. + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, // .j...l.......... 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, // ................ - 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, // .....5...vec4_sp - 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, // lat(f1;......... - 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x0c, 0x00, 0xd9, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, // ._x..........@ma - 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // in(vf4;vf4;vf4;v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, // f4;vf4;vf4;vf4;v - 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xfb, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, // f4;.......T..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x51, 0x44, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .QD..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe2, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......E..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xe3, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..E..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe4, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......E..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0xe5, 0x45, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..E..gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x54, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_......5T..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_6_..... - 0x00, 0xbf, 0x58, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..X..gl_FragData - 0x5f, 0x37, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // _7_..........bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x6a, 0x50, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .jP..param...... - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....$Global.... - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .........u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, // ect............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .........u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .............u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // nvView.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .........u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.............. - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .........u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // ewProj.......... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, // View............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .............u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x08, 0x00, 0xc4, 0x0b, 0x00, // lphaRef4........ - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, // .....bgfx_clear_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // color........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ..........C..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .y9..gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0xdd, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..,..gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_.......,..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_6_..... - 0x00, 0x40, 0x2c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .@,..gl_FragData - 0x5f, 0x37, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, 0x72, // _7_.......G..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // am........U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......o8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x70, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......p8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x71, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......q8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x72, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......r8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x49, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am.......I8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0xc2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x31, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _1_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x32, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_2_..... - 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x33, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _3_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x34, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_4_..... - 0x00, 0xc3, 0x15, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x35, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // _5_..........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x36, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_6_..... - 0x00, 0xe2, 0x11, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x37, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // _7_..G.......... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x45, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, // .@...G...E...... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#.......H...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .....#.......H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#...`...H...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#.......H...... - 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#...`...H...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#.......H...... - 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc4, 0x0b, 0x00, // .#... ...H...... - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, // .....#...0...G.. - 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .".......G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc3, 0x15, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xf1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xe2, 0x11, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // .!.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..... ... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x0b, 0x00, 0x49, 0x09, 0x00, // .........!...I.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .........e...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....+.......j.. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, // . ...........e.. - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x22, 0x0a, 0x00, // .j...+.......".. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x45, 0x05, 0x00, 0x00, 0x1d, 0x00, 0x00, // .........E...... - 0x00, 0x22, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0xc4, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, // .".............. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .....e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x08, 0x04, 0x00, // .e...e...e...... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x45, 0x05, 0x00, // .e...e.......E.. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7e, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc4, 0x0b, 0x00, // . ...~.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7e, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, // .;...~...B...... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, // .+......./...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, // .+.............. - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, // .+....... ...... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xb3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xc3, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xe2, 0x11, 0x00, 0x00, 0x03, 0x00, 0x00, // .;.............. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........Sa..;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......G......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......U......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....o8......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....p8......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x71, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....q8......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x72, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....r8......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....I8......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x39, 0x00, 0x0c, // .............9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbe, 0x2c, 0x00, 0x00, 0xd9, 0x0d, 0x00, 0x00, 0xc9, 0x47, 0x00, // ......,.......G. - 0x00, 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x71, 0x38, 0x00, // ..U..o8..p8..q8. - 0x00, 0x72, 0x38, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // .r8..I8......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......C...G..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x39, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....y9...U..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xda, 0x2c, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..o8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..p8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x71, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..q8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdd, 0x2c, 0x00, 0x00, 0x72, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..r8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0x49, 0x38, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......,..I8..=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....@,......>.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xaa, 0x43, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x11, 0x00, // ......C..>...... - 0x00, 0x79, 0x39, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb3, 0x15, 0x00, 0x00, 0xda, 0x2c, 0x00, // .y9..>........,. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe1, 0x0d, 0x00, 0x00, 0xdb, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>........,..>.. - 0x00, 0xd2, 0x11, 0x00, 0x00, 0xdc, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc3, 0x15, 0x00, // ......,..>...... - 0x00, 0xdd, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xf1, 0x0d, 0x00, 0x00, 0xed, 0x2c, 0x00, // ..,..>........,. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x11, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.......@,..... - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x88, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....dW......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa9, 0x4e, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......N......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x49, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....I9......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // ......9......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x2a, 0x00, 0x00, 0x64, 0x57, 0x00, 0x00, 0xa9, 0x4e, 0x00, // ......*..dW...N. - 0x00, 0x49, 0x39, 0x00, 0x00, 0x5c, 0x39, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xb0, 0x2a, 0x00, // .I9...9.......*. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xd9, 0x0d, 0x00, // .8...6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .....I...7...... - 0x00, 0xfb, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x51, 0x44, 0x00, // ..T..7.......QD. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe2, 0x45, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........E..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe3, 0x45, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......E..7...... - 0x00, 0xe4, 0x45, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe5, 0x45, 0x00, // ..E..7........E. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x35, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......5T..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xbf, 0x58, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x2c, 0x62, 0x00, // ......X......,b. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6a, 0x50, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......jP..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6a, 0x50, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>...jP......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x6a, 0x50, 0x00, // .........5...jP. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x91, 0x1a, 0x00, 0x00, 0x42, 0x13, 0x00, // .A...........B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xc3, 0x5c, 0x00, 0x00, 0x91, 0x1a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xfb, 0x54, 0x00, // .........>....T. - 0x00, 0xc3, 0x5c, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x37, 0x37, 0x00, // .....A.......77. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe7, 0x5f, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......_..77..>.. - 0x00, 0x51, 0x44, 0x00, 0x00, 0xe7, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // .QD..._..A...... - 0x00, 0x38, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x11, 0x0a, 0x00, // .87..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe8, 0x5f, 0x00, 0x00, 0x38, 0x37, 0x00, // .=........_..87. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x45, 0x00, 0x00, 0xe8, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....E..._..A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x39, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....97..B.../.. - 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe9, 0x5f, 0x00, // .....=........_. - 0x00, 0x39, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe3, 0x45, 0x00, 0x00, 0xe9, 0x5f, 0x00, // .97..>....E..._. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3a, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......:7..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x17, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ./.......=...... - 0x00, 0xea, 0x5f, 0x00, 0x00, 0x3a, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe4, 0x45, 0x00, // .._..:7..>....E. - 0x00, 0xea, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3b, 0x37, 0x00, // .._..A.......;7. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xeb, 0x5f, 0x00, 0x00, 0x3b, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......_..;7..>.. - 0x00, 0xe5, 0x45, 0x00, 0x00, 0xeb, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x9b, 0x02, 0x00, // ..E..._..A...... - 0x00, 0x3c, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x1d, 0x0a, 0x00, // .<7..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xec, 0x5f, 0x00, 0x00, 0x3c, 0x37, 0x00, // .=........_..<7. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x54, 0x00, 0x00, 0xec, 0x5f, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...5T..._..A.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x3d, 0x37, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....=7..B.../.. - 0x00, 0x20, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5c, 0x23, 0x00, // . ...=........#. - 0x00, 0x3d, 0x37, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xbf, 0x58, 0x00, 0x00, 0x5c, 0x23, 0x00, // .=7..>....X...#. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... + 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0x05, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // .....'...$Global + 0x00, 0x06, 0x00, 0x08, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // .....'.......bgf + 0x78, 0x5f, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, // x_clear_color... + 0x00, 0x05, 0x00, 0x03, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, // .....).......... + 0x00, 0x5e, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .^...bgfx_FragDa + 0x74, 0x61, 0x30, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x60, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta0......`...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x31, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData1..... + 0x00, 0x62, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .b...bgfx_FragDa + 0x74, 0x61, 0x32, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x64, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta2......d...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x33, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData3..... + 0x00, 0x66, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .f...bgfx_FragDa + 0x74, 0x61, 0x34, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x68, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta4......h...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x35, 0x00, 0x00, 0x05, 0x00, 0x06, // x_FragData5..... + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .j...bgfx_FragDa + 0x74, 0x61, 0x36, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, // ta6......l...bgf + 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x37, 0x00, 0x00, 0x47, 0x00, 0x04, // x_FragData7..G.. + 0x00, 0x26, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .&...........H.. + 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .'.......#...... + 0x00, 0x47, 0x00, 0x03, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...'.......G.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .)...".......G.. + 0x00, 0x5e, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .^...........G.. + 0x00, 0x60, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .`...........G.. + 0x00, 0x62, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .b...........G.. + 0x00, 0x64, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .d...........G.. + 0x00, 0x66, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .f...........G.. + 0x00, 0x68, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .h...........G.. + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .j...........G.. + 0x00, 0x6c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // .l.............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....!.......... + 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ......... ...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // ................ + 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .$... .......+.. + 0x00, 0x24, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .$...%.......... + 0x00, 0x26, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, // .&.......%...... + 0x00, 0x27, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, // .'...&... ...(.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, // .....'...;...(.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .)...........*.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // . .......+...*.. + 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, // .+....... ...,.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .........+...*.. + 0x00, 0x2f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // ./.......+...*.. + 0x00, 0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .2.......+...*.. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .5.......+...*.. + 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .8.......+...*.. + 0x00, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .;.......+...*.. + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, // .>.......+...*.. + 0x00, 0x41, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .A....... ...].. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .........;...].. + 0x00, 0x5e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .^.......;...].. + 0x00, 0x60, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .`.......;...].. + 0x00, 0x62, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .b.......;...].. + 0x00, 0x64, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .d.......;...].. + 0x00, 0x66, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .f.......;...].. + 0x00, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .h.......;...].. + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5d, 0x00, 0x00, // .j.......;...].. + 0x00, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, // .l.......6...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, // .....A...,...... + 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .)...+...+...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, // .,.......)...+.. + 0x00, 0x2f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, // ./...=.......... + 0x00, 0x85, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, // .....A...,...... + 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .)...+...2...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, // .,.......)...+.. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, // .5...=.......... + 0x00, 0x89, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, // .....A...,...... + 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .)...+...8...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, // .,.......)...+.. + 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, // .;...=.......... + 0x00, 0x8d, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, // .....A...,...... + 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .)...+...>...=.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, // .,.......)...+.. + 0x00, 0x41, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, // .A...=.......... + 0x00, 0x91, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, // .....>...^...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...`.......>.. + 0x00, 0x62, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x00, 0x00, // .b.......>...d.. + 0x00, 0x8a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x66, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, // .....>...f...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0x68, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...h.......>.. + 0x00, 0x6a, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6c, 0x00, 0x00, // .j.......>...l.. + 0x00, 0x92, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, // .........8...... + 0x00, // . }; static const uint8_t fs_clear7_dx9[234] = { diff --git a/3rdparty/bgfx/src/fs_clear7.sc b/3rdparty/bgfx/src/fs_clear7.sc index 78ee8d01028..946eb2fe188 100644 --- a/3rdparty/bgfx/src/fs_clear7.sc +++ b/3rdparty/bgfx/src/fs_clear7.sc @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/fs_debugfont.bin.h b/3rdparty/bgfx/src/fs_debugfont.bin.h index 553bc8fef58..d491d4d3b66 100644 --- a/3rdparty/bgfx/src/fs_debugfont.bin.h +++ b/3rdparty/bgfx/src/fs_debugfont.bin.h @@ -24,271 +24,75 @@ static const uint8_t fs_debugfont_glsl[354] = 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, // r = tmpvar_1;.}. 0x0a, 0x00, // .. }; -static const uint8_t fs_debugfont_spv[4195] = +static const uint8_t fs_debugfont_spv[1070] = { - 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x54, 0x10, 0x00, 0x00, 0x03, 0x02, // FSH..."f..T..... - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x4a, 0x62, 0x00, 0x00, 0x00, 0x00, // #.........Jb.... + 0x46, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x00, 0x03, 0x02, // FSH..."f........ + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, // #............... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, // ..w...x...t..... - 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x99, 0x0f, // ..main.......... - 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, // ..bgfxTexture2D( - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, // struct-BgfxSampl - 0x65, 0x72, 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, // er2D-p1-t211;vf2 - 0x3b, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe2, 0x2e, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ;.........m_samp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x6d, 0x5f, // ler......./B..m_ - 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, // texture......... - 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xd2, 0x0c, // .._coord........ - 0x00, 0x00, 0x6d, 0x69, 0x78, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, // ..mix(vf4;vf4;vf - 0x34, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x5f, 0x61, // 4;............_a - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, 0x00, 0x00, 0x05, 0x00, // .........._b.... - 0x03, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x5f, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, // ......_t......5. - 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, // ..vec4_splat(f1; - 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, // .........._x.... - 0x08, 0x00, 0xdd, 0x13, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, // ......@main(vf4; - 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, // vf4;vf2;vf4;.... - 0x05, 0x00, 0x62, 0x25, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // ..b%..v_color0.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x27, 0x22, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......'"..v_colo - 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x51, 0x00, 0x00, 0x76, 0x5f, // r1.........Q..v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x92, 0x55, // texcoord0......U - 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, // ..gl_FragData_0_ - 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, // ......a...BgfxSa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, // mpler2D.......a. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // ......m_sampler. - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, // ......a.......m_ - 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, // texture......... - 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, // ..flattenTemp... - 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, // Sampler......... - 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, // ..s_texColorText - 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x67, 0x12, 0x00, 0x00, 0x6d, 0x5f, // ure.......g...m_ - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa3, 0x14, // sampler......... - 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, // ..m_texture..... - 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, // ......bgfx_VoidF - 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x70, 0x61, // rag.......jO..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, // ram...........co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x70, 0x61, // lor........+..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x70, 0x61, // ram........+..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x70, 0x61, // ram........+..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x70, 0x61, // ram.......^)..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xe1, 0x2b, 0x00, 0x00, 0x76, 0x5f, // ram........+..v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, // color0........w. - 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, // ..v_color0...... - 0x05, 0x00, 0xb0, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x00, 0x00, // ...<..v_color1.. - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......x...v_colo - 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x76, 0x5f, // r1........@,..v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, // texcoord0.....t. + 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x7d, 0x00, // ..i...l...p...}. + 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x29, 0x00, // ..main........). + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, // ..s_texColorSamp + 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x73, 0x5f, // ler.......,...s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // texColorTexture. + 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x69, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // ......i...v_colo + 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x76, 0x5f, // r0........l...v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x70, 0x00, // color1........p. 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, // ..v_texcoord0... - 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, // ......gl_FragDat - 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x70, 0x61, // a_0_.......G..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, // ram........U..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, // ram........8..pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, // ram...........pa - 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, // ram...........gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, // _FragData_0_.... - 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ......$Global... - 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x01, 0x00, // Rect............ - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, // ..u_viewTexel... - 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xa0, 0x06, // invView......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ......u_proj.... - 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, // ..........u_invP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ..u_viewProj.... - 0x07, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xa0, 0x06, // iewProj......... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, // ......u_model... - 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, // lView........... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ..u_modelViewPro - 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, // j.............u_ - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, // alphaRef4.G..... - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, // ..".......G..... - 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, // ..!.......G..... - 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, // ..".......G..... - 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, // ..!.......G...w. - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x78, 0x0e, // ..........G...x. - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, // ..........G...t. - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, // ..........G..... - 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x71, 0x01, // ..........G...q. - 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ......@...H..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, // .. ...H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#...`...H. - 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x06, 0x00, // .. ...H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, // ......#...`...H. - 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x08, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, // ................ - 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, // ..H............. - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, // ..H...........#. - 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x0a, 0x00, // ......H......... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa0, 0x06, // ..........H..... - 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, // ......#... ...G. - 0x03, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..!............. - 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x00, 0x00, // ...... ...y..... - 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . - 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0x00, 0x00, // ...... ......... - 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, // ..y........... . - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x06, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, // ......!......... - 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x08, 0x04, 0x00, 0x00, 0x08, 0x00, // ......!......... - 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x02, // ................ - 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, // ......a......... - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x09, // .. ...........a. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, // ..;............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, // ..;...y......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, // ..;............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x67, 0x12, 0x00, 0x00, 0x00, 0x00, // ..;...y...g..... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, 0x00, 0xa3, 0x14, 0x00, 0x00, 0x00, 0x00, // ..;............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, // ..+............. - 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, // ................ - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, // ...... .......+. - 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, // ..............+. - 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x7a, 0x01, 0x00, 0x00, 0x81, 0x80, 0x80, 0x3b, 0x14, 0x00, // ......z......;.. - 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, // ......;.......w. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x78, 0x0e, // ......;.......x. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, // ...... ......... - 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x74, 0x14, // ......;.......t. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, // ...... ......... - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, // ......;......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, // ..........e..... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......+.......j. - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x71, 0x01, 0x00, 0x00, 0x65, 0x00, // .. .......q...e. - 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x1d, 0x00, // ..j............. - 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ......e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x71, 0x01, // ..e...e...e...q. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x36, 0x00, // ..e...e.......6. - 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, // ................ - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ......Sa..;..... - 0x00, 0x00, 0xc9, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...G......;..... - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, // ...U......;..... - 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, // ...8......;..... - 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, // ..........=..... - 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, // ..!C......=..... - 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, // ...3......P...a. - 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, // ..^ ..!C...3..>. - 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, // ......^ ..A...y. - 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...V..........=. - 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, // ...........V..>. - 0x03, 0x00, 0x67, 0x12, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, // ..g.......A..... - 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, // ...@..........=. - 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, // ...........@..>. - 0x03, 0x00, 0xa3, 0x14, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ..........=..... - 0x00, 0x00, 0xe1, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, // ...+..w...=..... - 0x00, 0x00, 0xb0, 0x3c, 0x00, 0x00, 0x78, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, // ...<..x...=..... - 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc9, 0x47, // ..@,..t...>....G - 0x00, 0x00, 0xe1, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb0, 0x3c, // ...+..>....U...< - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x39, 0x00, // ..>....8..@,..9. - 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xdd, 0x13, 0x00, 0x00, 0xc9, 0x47, // .......&.......G - 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, // ...U...8......=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, // ..............>. - 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..............8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x0a, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0xe2, 0x2e, // ......7...y..... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, 0x00, 0x2f, 0x42, 0x00, 0x00, 0x37, 0x00, // ..7......./B..7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xca, 0x1c, // ................ - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xc6, 0x19, 0x00, 0x00, 0x2f, 0x42, // ..=.........../B - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0xe2, 0x2e, // ..=........H.... - 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xc6, 0x19, // ..V........>.... - 0x00, 0x00, 0xca, 0x48, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x24, // ...H..=........$ - 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x82, 0x59, // ......W........Y - 0x00, 0x00, 0xf7, 0x3e, 0x00, 0x00, 0xfe, 0x24, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x82, 0x59, // ...>...$.......Y - 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd2, 0x0c, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // ..........7..... - 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc7, 0x0e, // ......7......... - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0xf8, 0x00, // ..7............. - 0x02, 0x00, 0x16, 0x59, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x37, 0x54, // ...Y..=.......7T - 0x00, 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x07, 0x48, // ......=........H - 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0e, 0x47, // ......=........G - 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x19, // ..............e. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x37, 0x54, 0x00, 0x00, 0x07, 0x48, // ..........7T...H - 0x00, 0x00, 0x0e, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x65, 0x19, 0x00, 0x00, 0x38, 0x00, // ...G......e...8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, // ..6.......5..... - 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, // ......7......... - 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x19, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // .......N..=..... - 0x00, 0x00, 0x67, 0x1c, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..g.......=..... - 0x00, 0x00, 0xf2, 0x44, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ...D......=..... - 0x00, 0x00, 0x92, 0x2f, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // .../......=..... - 0x00, 0x00, 0xa5, 0x2f, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // .../......P..... - 0x00, 0x00, 0x41, 0x4a, 0x00, 0x00, 0x67, 0x1c, 0x00, 0x00, 0xf2, 0x44, 0x00, 0x00, 0x92, 0x2f, // ..AJ..g....D.../ - 0x00, 0x00, 0xa5, 0x2f, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x41, 0x4a, 0x00, 0x00, 0x38, 0x00, // .../......AJ..8. - 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xdd, 0x13, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x62, 0x25, // ......7.......b% - 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x27, 0x22, 0x00, 0x00, 0x37, 0x00, // ..7.......'"..7. - 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0x08, 0x51, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, // .......Q..7..... - 0x00, 0x00, 0x92, 0x55, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x5e, 0x00, 0x00, 0x3b, 0x00, // ...U.......^..;. - 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ......jO......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // ..............;. - 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......+......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......+......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, // .......+......;. - 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......^)......>. - 0x03, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, // ..jO......9..... - 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x3d, 0x00, // ......5...jO..=. - 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x08, 0x51, 0x00, 0x00, 0x3e, 0x00, // .......K...Q..>. - 0x03, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, // ...+...K..9..... - 0x00, 0x00, 0x95, 0x54, 0x00, 0x00, 0x99, 0x0f, 0x00, 0x00, 0x67, 0x12, 0x00, 0x00, 0xa3, 0x14, // ...T......g..... - 0x00, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x29, 0x4c, // ...+..=.......)L - 0x00, 0x00, 0x27, 0x22, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x29, 0x4c, // ..'"..>....+..)L - 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa6, 0x1f, 0x00, 0x00, 0x62, 0x25, // ..=...........b% - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0xa6, 0x1f, 0x00, 0x00, 0x4f, 0x00, // ..>....+......O. - 0x09, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xea, 0x31, 0x00, 0x00, 0x95, 0x54, 0x00, 0x00, 0x95, 0x54, // .......1...T...T - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5e, 0x29, 0x00, 0x00, 0xea, 0x31, 0x00, 0x00, 0x39, 0x00, // ..>...^)...1..9. - 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x29, 0x00, 0x00, 0xd2, 0x0c, 0x00, 0x00, 0x8c, 0x2b, // .......).......+ - 0x00, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x18, 0x0e, // ...+..^)..>..... - 0x00, 0x00, 0x1e, 0x29, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xb7, 0x49, // ...)..A........I - 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, // ..........=..... - 0x00, 0x00, 0x49, 0x62, 0x00, 0x00, 0xb7, 0x49, 0x00, 0x00, 0xb8, 0x00, 0x05, 0x00, 0x09, 0x00, // ..Ib...I........ - 0x00, 0x00, 0x7a, 0x44, 0x00, 0x00, 0x49, 0x62, 0x00, 0x00, 0x7a, 0x01, 0x00, 0x00, 0xf7, 0x00, // ..zD..Ib..z..... - 0x03, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x7a, 0x44, // ..............zD - 0x00, 0x00, 0xfd, 0x46, 0x00, 0x00, 0xdc, 0x19, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xfd, 0x46, // ...F...........F - 0x00, 0x00, 0xfc, 0x00, 0x01, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd8, 0x38, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x3e, 0x00, // .......8......>. - 0x03, 0x00, 0x92, 0x55, 0x00, 0x00, 0xd8, 0x38, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ...U...8......8. - 0x01, 0x00, 0x00, // ... + 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // ..}...bgfx_FragD + 0x61, 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x22, 0x00, // ata0..G...)...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x21, 0x00, // ......G...)...!. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x22, 0x00, // ......G...,...". + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x21, 0x00, // ......G...,...!. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x69, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...i..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...l..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x70, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...p..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x1e, 0x00, // ......G...}..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. + 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, // ................ + 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, // .......... ..... + 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // .. ...(......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, // ..;...(...)..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, // .. ...+......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..;...+...,..... + 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x38, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, // ......8.......+. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x81, 0x80, 0x80, 0x3b, 0x14, 0x00, // ......`......;.. + 0x02, 0x00, 0x61, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, // ..a... ...h..... + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x69, 0x00, // ......;...h...i. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x68, 0x00, 0x00, 0x00, 0x6c, 0x00, // ......;...h...l. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x01, 0x00, // ...... ...o..... + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x70, 0x00, // ......;...o...p. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x03, 0x00, // ...... ...|..... + 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x7d, 0x00, // ......;...|...}. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, // ......6......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, // ................ + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x29, 0x00, // ..=.......*...). + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..=.......-...,. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x69, 0x00, // ..=.......j...i. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6c, 0x00, // ..=.......m...l. + 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x70, 0x00, // ..=.......q...p. + 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x38, 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x2d, 0x00, // ..V...8.......-. + 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x57, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa8, 0x00, // ..*...W......... + 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x09, 0x00, 0x0d, 0x00, // ......q...O..... + 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, // ................ + 0x08, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, // ................ + 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x51, 0x00, // ..m...j.......Q. + 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0xb8, 0x00, 0x05, 0x00, 0x61, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0xb3, 0x00, // ......a......... + 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x03, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, // ..`............. + 0x00, 0x00, 0xfa, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x98, 0x00, // ................ + 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x99, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x01, 0x00, 0xf8, 0x00, // ................ + 0x02, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x7d, 0x00, 0x00, 0x00, 0xad, 0x00, // ......>...}..... + 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ......8....... }; static const uint8_t fs_debugfont_dx9[364] = { diff --git a/3rdparty/bgfx/src/fs_debugfont.sc b/3rdparty/bgfx/src/fs_debugfont.sc index bccdd01bd18..8d9c04b5a40 100644 --- a/3rdparty/bgfx/src/fs_debugfont.sc +++ b/3rdparty/bgfx/src/fs_debugfont.sc @@ -1,7 +1,7 @@ $input v_color0, v_color1, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glcontext_eagl.h b/3rdparty/bgfx/src/glcontext_eagl.h index 31a1576a8ad..5e816b4e675 100644 --- a/3rdparty/bgfx/src/glcontext_eagl.h +++ b/3rdparty/bgfx/src/glcontext_eagl.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glcontext_eagl.mm b/3rdparty/bgfx/src/glcontext_eagl.mm index 541cc40b08f..a9e49a3a8ba 100644 --- a/3rdparty/bgfx/src/glcontext_eagl.mm +++ b/3rdparty/bgfx/src/glcontext_eagl.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -189,6 +189,7 @@ namespace bgfx { namespace gl m_context = (void*)context; [EAGLContext setCurrentContext:context]; + [CATransaction flush]; GL_CHECK(glGenFramebuffers(1, &m_fbo) ); GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) ); diff --git a/3rdparty/bgfx/src/glcontext_egl.cpp b/3rdparty/bgfx/src/glcontext_egl.cpp index ef03ec594ab..67e643262b1 100644 --- a/3rdparty/bgfx/src/glcontext_egl.cpp +++ b/3rdparty/bgfx/src/glcontext_egl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -196,7 +196,7 @@ EGL_IMPORT dumpExtensions(extensions); // https://www.khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_recordable.txt - const bool hasEglAndroidRecordable = !!bx::findIdentifierMatch(extensions, "EGL_ANDROID_recordable"); + const bool hasEglAndroidRecordable = !bx::findIdentifierMatch(extensions, "EGL_ANDROID_recordable").isEmpty(); EGLint attrs[] = { @@ -256,8 +256,8 @@ EGL_IMPORT m_surface = eglCreateWindowSurface(m_display, m_config, nwh, NULL); BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface."); - const bool hasEglKhrCreateContext = !!bx::findIdentifierMatch(extensions, "EGL_KHR_create_context"); - const bool hasEglKhrNoError = !!bx::findIdentifierMatch(extensions, "EGL_KHR_create_context_no_error"); + const bool hasEglKhrCreateContext = !bx::findIdentifierMatch(extensions, "EGL_KHR_create_context").isEmpty(); + const bool hasEglKhrNoError = !bx::findIdentifierMatch(extensions, "EGL_KHR_create_context_no_error").isEmpty(); const uint32_t gles = BGFX_CONFIG_RENDERER_OPENGLES; @@ -380,6 +380,7 @@ EGL_IMPORT return BX_ENABLED(0 | BX_PLATFORM_LINUX | BX_PLATFORM_WINDOWS + | BX_PLATFORM_ANDROID ) ? BGFX_CAPS_SWAP_CHAIN : 0 diff --git a/3rdparty/bgfx/src/glcontext_egl.h b/3rdparty/bgfx/src/glcontext_egl.h index 79082ec3c38..ac7275666f4 100644 --- a/3rdparty/bgfx/src/glcontext_egl.h +++ b/3rdparty/bgfx/src/glcontext_egl.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glcontext_glx.cpp b/3rdparty/bgfx/src/glcontext_glx.cpp index 7afd3ec7c33..b968267e9c0 100644 --- a/3rdparty/bgfx/src/glcontext_glx.cpp +++ b/3rdparty/bgfx/src/glcontext_glx.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -12,6 +12,9 @@ # define GLX_GLXEXT_PROTOTYPES # include +// will include X11 which #defines None... +#undef None + namespace bgfx { namespace gl { typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval); @@ -26,28 +29,30 @@ namespace bgfx { namespace gl struct SwapChainGL { - SwapChainGL(::Window _window, XVisualInfo* _visualInfo, GLXContext _context) - : m_window(_window) + SwapChainGL(::Display* display, ::Window _window, XVisualInfo* _visualInfo, GLXContext _context) + : m_display(display) + , m_window(_window) { - m_context = glXCreateContext( (::Display*)g_platformData.ndt, _visualInfo, _context, GL_TRUE); + m_context = glXCreateContext(m_display, _visualInfo, _context, GL_TRUE); } ~SwapChainGL() { - glXMakeCurrent( (::Display*)g_platformData.ndt, 0, 0); - glXDestroyContext( (::Display*)g_platformData.ndt, m_context); + glXMakeCurrent(m_display, 0, 0); + glXDestroyContext(m_display, m_context); } void makeCurrent() { - glXMakeCurrent( (::Display*)g_platformData.ndt, m_window, m_context); + glXMakeCurrent(m_display, m_window, m_context); } void swapBuffers() { - glXSwapBuffers( (::Display*)g_platformData.ndt, m_window); + glXSwapBuffers(m_display, m_window); } + ::Display* m_display; Window m_window; GLXContext m_context; }; @@ -57,13 +62,23 @@ namespace bgfx { namespace gl BX_UNUSED(_width, _height); m_context = (GLXContext)g_platformData.context; + m_display = (::Display*)g_platformData.ndt; + + // It's possible the user has provided the window handle, but not + // the display handle. If this is the case, try opening the default + // display + if (NULL == m_display) + { + m_display = XOpenDisplay(NULL); + BGFX_FATAL(m_display, Fatal::UnableToInitialize, "XOpenDisplay(NULL) : Failed to open default display"); + } if (NULL == g_platformData.context) { - XLockDisplay( (::Display*)g_platformData.ndt); + XLockDisplay(m_display); int major, minor; - bool version = glXQueryVersion( (::Display*)g_platformData.ndt, &major, &minor); + bool version = glXQueryVersion(m_display, &major, &minor); BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version"); BGFX_FATAL( (major == 1 && minor >= 2) || major > 1 , Fatal::UnableToInitialize @@ -72,9 +87,9 @@ namespace bgfx { namespace gl , minor ); - int32_t screen = DefaultScreen( (::Display*)g_platformData.ndt); + int32_t screen = DefaultScreen(m_display); - const char* extensions = glXQueryExtensionsString( (::Display*)g_platformData.ndt, screen); + const char* extensions = glXQueryExtensionsString(m_display, screen); BX_TRACE("GLX extensions:"); dumpExtensions(extensions); @@ -96,21 +111,21 @@ namespace bgfx { namespace gl GLXFBConfig bestConfig = NULL; int numConfigs; - GLXFBConfig* configs = glXChooseFBConfig( (::Display*)g_platformData.ndt, screen, attrsGlx, &numConfigs); + GLXFBConfig* configs = glXChooseFBConfig(m_display, screen, attrsGlx, &numConfigs); BX_TRACE("glX num configs %d", numConfigs); for (int ii = 0; ii < numConfigs; ++ii) { - m_visualInfo = glXGetVisualFromFBConfig( (::Display*)g_platformData.ndt, configs[ii]); + m_visualInfo = glXGetVisualFromFBConfig(m_display, configs[ii]); if (NULL != m_visualInfo) { BX_TRACE("---"); bool valid = true; - for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2) + for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != 0; attr += 2) { int value; - glXGetFBConfigAttrib( (::Display*)g_platformData.ndt, configs[ii], attrsGlx[attr], &value); + glXGetFBConfigAttrib(m_display, configs[ii], attrsGlx[attr], &value); BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)" , ii , numConfigs @@ -146,7 +161,7 @@ namespace bgfx { namespace gl BGFX_FATAL(m_visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration."); BX_TRACE("Create GL 2.1 context."); - m_context = glXCreateContext( (::Display*)g_platformData.ndt, m_visualInfo, 0, GL_TRUE); + m_context = glXCreateContext(m_display, m_visualInfo, 0, GL_TRUE); BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context."); #if BGFX_CONFIG_RENDERER_OPENGL >= 31 @@ -165,11 +180,11 @@ namespace bgfx { namespace gl 0, }; - GLXContext context = glXCreateContextAttribsARB( (::Display*)g_platformData.ndt, bestConfig, 0, true, contextAttrs); + GLXContext context = glXCreateContextAttribsARB(m_display, bestConfig, 0, true, contextAttrs); if (NULL != context) { - glXDestroyContext( (::Display*)g_platformData.ndt, m_context); + glXDestroyContext(m_display, m_context); m_context = context; } } @@ -177,19 +192,19 @@ namespace bgfx { namespace gl BX_UNUSED(bestConfig); #endif // BGFX_CONFIG_RENDERER_OPENGL >= 31 - XUnlockDisplay( (::Display*)g_platformData.ndt); + XUnlockDisplay(m_display); } import(); - glXMakeCurrent( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, m_context); + glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context); m_current = NULL; glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalEXT"); if (NULL != glXSwapIntervalEXT) { BX_TRACE("Using glXSwapIntervalEXT."); - glXSwapIntervalEXT( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, 0); + glXSwapIntervalEXT(m_display, (::Window)g_platformData.nwh, 0); } else { @@ -212,21 +227,27 @@ namespace bgfx { namespace gl glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); - glXSwapBuffers( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh); + glXSwapBuffers(m_display, (::Window)g_platformData.nwh); g_internalData.context = m_context; } void GlContext::destroy() { - glXMakeCurrent( (::Display*)g_platformData.ndt, 0, 0); + glXMakeCurrent(m_display, 0, 0); if (NULL == g_platformData.context) { - glXDestroyContext( (::Display*)g_platformData.ndt, m_context); + glXDestroyContext(m_display, m_context); XFree(m_visualInfo); } + // If we opened the display, have to close it + if (NULL == g_platformData.ndt) + { + XCloseDisplay(m_display); + } m_context = NULL; m_visualInfo = NULL; + m_display = NULL; } void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t _flags) @@ -236,7 +257,7 @@ namespace bgfx { namespace gl if (NULL != glXSwapIntervalEXT) { - glXSwapIntervalEXT( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, interval); + glXSwapIntervalEXT(m_display, (::Window)g_platformData.nwh, interval); } else if (NULL != glXSwapIntervalMESA) { @@ -255,13 +276,13 @@ namespace bgfx { namespace gl SwapChainGL* GlContext::createSwapChain(void* _nwh) { - return BX_NEW(g_allocator, SwapChainGL)( (::Window)_nwh, m_visualInfo, m_context); + return BX_NEW(g_allocator, SwapChainGL)(m_display, (::Window)_nwh, m_visualInfo, m_context); } void GlContext::destroySwapChain(SwapChainGL* _swapChain) { BX_DELETE(g_allocator, _swapChain); - glXMakeCurrent( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, m_context); + glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context); } void GlContext::swap(SwapChainGL* _swapChain) @@ -270,7 +291,7 @@ namespace bgfx { namespace gl if (NULL == _swapChain) { - glXSwapBuffers( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh); + glXSwapBuffers(m_display, (::Window)g_platformData.nwh); } else { @@ -286,7 +307,7 @@ namespace bgfx { namespace gl if (NULL == _swapChain) { - glXMakeCurrent( (::Display*)g_platformData.ndt, (::Window)g_platformData.nwh, m_context); + glXMakeCurrent(m_display, (::Window)g_platformData.nwh, m_context); } else { diff --git a/3rdparty/bgfx/src/glcontext_glx.h b/3rdparty/bgfx/src/glcontext_glx.h index 6b93cb9be4b..622f6ab98de 100644 --- a/3rdparty/bgfx/src/glcontext_glx.h +++ b/3rdparty/bgfx/src/glcontext_glx.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -21,6 +21,7 @@ namespace bgfx { namespace gl : m_current(NULL) , m_context(0) , m_visualInfo(NULL) + , m_display(NULL) { } @@ -44,6 +45,7 @@ namespace bgfx { namespace gl SwapChainGL* m_current; GLXContext m_context; XVisualInfo* m_visualInfo; + ::Display* m_display; }; } /* namespace gl */ } // namespace bgfx diff --git a/3rdparty/bgfx/src/glcontext_nsgl.h b/3rdparty/bgfx/src/glcontext_nsgl.h index 00e07de9b17..e6a6db9a223 100644 --- a/3rdparty/bgfx/src/glcontext_nsgl.h +++ b/3rdparty/bgfx/src/glcontext_nsgl.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glcontext_nsgl.mm b/3rdparty/bgfx/src/glcontext_nsgl.mm index 1bef5ca3122..af35e9c5ebf 100644 --- a/3rdparty/bgfx/src/glcontext_nsgl.mm +++ b/3rdparty/bgfx/src/glcontext_nsgl.mm @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glcontext_wgl.cpp b/3rdparty/bgfx/src/glcontext_wgl.cpp index d20b8449dd1..859203dccdd 100644 --- a/3rdparty/bgfx/src/glcontext_wgl.cpp +++ b/3rdparty/bgfx/src/glcontext_wgl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glcontext_wgl.h b/3rdparty/bgfx/src/glcontext_wgl.h index 0b5f340a7a3..275a114364d 100644 --- a/3rdparty/bgfx/src/glcontext_wgl.h +++ b/3rdparty/bgfx/src/glcontext_wgl.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/glimports.h b/3rdparty/bgfx/src/glimports.h index 2ee03365d27..24e25c055f9 100644 --- a/3rdparty/bgfx/src/glimports.h +++ b/3rdparty/bgfx/src/glimports.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -112,6 +112,8 @@ typedef void (GL_APIENTRYP PFNGLFINISHPROC) (); typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (); typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (GL_APIENTRYP PFNGLFRONTFACE)(GLenum mode); typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); @@ -302,6 +304,8 @@ GL_IMPORT______(false, PFNGLFINISHPROC, glFinish); GL_IMPORT______(false, PFNGLFLUSHPROC, glFlush); GL_IMPORT______(true, PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer); GL_IMPORT______(true, PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D); +GL_IMPORT______(true, PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer); +GL_IMPORT______(false, PFNGLFRONTFACE, glFrontFace); GL_IMPORT______(false, PFNGLGENBUFFERSPROC, glGenBuffers); GL_IMPORT______(true, PFNGLGENERATEMIPMAPPROC, glGenerateMipmap); GL_IMPORT______(true, PFNGLGENFRAMEBUFFERSPROC, glGenFramebuffers); @@ -342,10 +346,17 @@ GL_IMPORT______(false, PFNGLGETSHADERIVPROC, glGetShaderiv GL_IMPORT______(false, PFNGLGETSHADERINFOLOGPROC, glGetShaderInfoLog); GL_IMPORT______(false, PFNGLGETSTRINGPROC, glGetString); GL_IMPORT______(false, PFNGLGETUNIFORMLOCATIONPROC, glGetUniformLocation); + #if BGFX_CONFIG_RENDERER_OPENGL || !(BGFX_CONFIG_RENDERER_OPENGLES < 30) GL_IMPORT______(true, PFNGLGETSTRINGIPROC, glGetStringi); GL_IMPORT______(true, PFNGLINVALIDATEFRAMEBUFFERPROC, glInvalidateFramebuffer); #endif // !(BGFX_CONFIG_RENDERER_OPENGLES < 30) + +#if !(BGFX_CONFIG_RENDERER_OPENGLES < 30) +GL_IMPORT______(true, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample); +GL_IMPORT______(true, PFNGLTEXIMAGE3DMULTISAMPLEPROC, glTexImage3DMultisample); +#endif // !(BGFX_CONFIG_RENDERER_OPENGLES < 30) + GL_IMPORT______(false, PFNGLLINKPROGRAMPROC, glLinkProgram); GL_IMPORT______(true, PFNGLMEMORYBARRIERPROC, glMemoryBarrier); GL_IMPORT______(true, PFNGLMULTIDRAWARRAYSINDIRECTPROC, glMultiDrawArraysIndirect); @@ -442,6 +453,7 @@ GL_IMPORT_EXT__(true, PFNGLDELETEFRAMEBUFFERSPROC, glDeleteFrame GL_IMPORT_EXT__(true, PFNGLCHECKFRAMEBUFFERSTATUSPROC, glCheckFramebufferStatus); GL_IMPORT_EXT__(true, PFNGLFRAMEBUFFERRENDERBUFFERPROC, glFramebufferRenderbuffer); GL_IMPORT_EXT__(true, PFNGLFRAMEBUFFERTEXTURE2DPROC, glFramebufferTexture2D); +GL_IMPORT_EXT__(true, PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer); GL_IMPORT_EXT__(true, PFNGLBINDRENDERBUFFERPROC, glBindRenderbuffer); GL_IMPORT_EXT__(true, PFNGLGENRENDERBUFFERSPROC, glGenRenderbuffers); GL_IMPORT_EXT__(true, PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers); @@ -497,6 +509,8 @@ GL_IMPORT_EXT__(true, PFNGLTEXSTORAGE3DPROC, glTexStorage3 GL_IMPORT______(true, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample); GL_IMPORT______(true, PFNGLTEXIMAGE3DMULTISAMPLEPROC, glTexImage3DMultisample); +GL_IMPORT_EXT__(true, PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer); + GL_IMPORT_EXT__(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker); GL_IMPORT_EXT__(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker); GL_IMPORT_EXT__(true, PFNGLPOPGROUPMARKEREXTPROC, glPopGroupMarker); @@ -577,6 +591,9 @@ GL_IMPORT______(true, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedT GL_IMPORT______(true, PFNGLTEXSTORAGE2DPROC, glTexStorage2D); GL_IMPORT______(true, PFNGLTEXSTORAGE3DPROC, glTexStorage3D); GL_IMPORT______(true, PFNGLTEXIMAGE2DMULTISAMPLEPROC, glTexImage2DMultisample); +GL_IMPORT______(true, PFNGLTEXIMAGE3DMULTISAMPLEPROC, glTexImage3DMultisample); + +GL_IMPORT______(true, PFNGLFRAMEBUFFERTEXTURELAYERPROC, glFramebufferTextureLayer); GL_IMPORT______(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker); GL_IMPORT______(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker); diff --git a/3rdparty/bgfx/src/hmd.cpp b/3rdparty/bgfx/src/hmd.cpp deleted file mode 100644 index b224a57171f..00000000000 --- a/3rdparty/bgfx/src/hmd.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#include "hmd.h" - -namespace bgfx -{ - VR::VR() - : m_impl(NULL) - , m_framesUntilReconnect(0) - , m_enabled(false) - { - } - - void VR::init(VRImplI* _impl) - { - if (NULL == _impl) - { - return; - } - - if (!_impl->init() ) - { - return; - } - - m_impl = _impl; - m_impl->connect(&m_desc); - - if (!m_impl->isConnected() ) - { - connectFailed(); - return; - } - - m_hmdSize.m_w = m_desc.m_eyeSize[0].m_w + m_desc.m_eyeSize[1].m_w; - m_hmdSize.m_h = bx::uint32_max(m_desc.m_eyeSize[0].m_h, m_desc.m_eyeSize[1].m_h); - } - - void VR::shutdown() - { - if (NULL == m_impl) - { - return; - } - - m_impl->destroySwapChain(); - - if (m_impl->isConnected() ) - { - m_impl->disconnect(); - } - - m_impl->shutdown(); - m_impl = NULL; - m_enabled = false; - } - - void VR::getViewport(uint8_t _eye, Rect* _viewport) const - { - _viewport->m_x = uint16_t(_eye * (m_desc.m_eyeSize[_eye].m_w + 1) ); - _viewport->m_y = 0; - _viewport->m_width = uint16_t(m_desc.m_eyeSize[_eye].m_w); - _viewport->m_height = uint16_t(m_desc.m_eyeSize[_eye].m_h); - } - - void VR::makeRenderTargetActive() - { - BX_CHECK(m_enabled, "VR::renderEyeStart called while not enabled - render usage error"); - - if (NULL != m_impl) - { - m_impl->makeRenderTargetActive(m_desc); - } - } - - void VR::recenter() - { - if (NULL != m_impl) - { - m_impl->recenter(); - } - } - - void VR::preReset() - { - if (NULL != m_impl) - { - m_impl->destroyMirror(); - } - - m_enabled = false; - } - - void VR::postReset(int _msaaSamples, int _mirrorWidth, int _mirrorHeight) - { - if (NULL != m_impl - && m_impl->createSwapChain(m_desc, _msaaSamples, _mirrorWidth, _mirrorHeight) ) - { - m_enabled = true; - } - } - - void VR::flip() - { - if (NULL == m_impl - || !m_enabled) - { - return; - } - else if (!m_impl->isConnected() - && !tryReconnect() ) - { - return; - } - - if (!m_impl->submitSwapChain(m_desc) ) - { - m_impl->destroySwapChain(); - m_impl->disconnect(); - return; - } - } - - void VR::swap(HMD& _hmd) - { - _hmd.flags = BGFX_HMD_NONE; - - if (NULL == m_impl) - { - return; - } - - _hmd.flags = BGFX_HMD_DEVICE_RESOLUTION; - _hmd.deviceWidth = m_desc.m_deviceSize.m_w; - _hmd.deviceHeight = m_desc.m_deviceSize.m_h; - _hmd.width = uint16_t(m_hmdSize.m_w); - _hmd.height = uint16_t(m_hmdSize.m_h); - - if (!m_impl->updateTracking(_hmd) ) - { - m_impl->destroySwapChain(); - m_impl->disconnect(); - } - - if (!m_impl->isConnected() ) - { - return; - } - - for (int eye = 0; eye < 2; ++eye) - { - _hmd.eye[eye].fov[0] = m_desc.m_eyeFov[eye].m_up; - _hmd.eye[eye].fov[1] = m_desc.m_eyeFov[eye].m_down; - _hmd.eye[eye].fov[2] = m_desc.m_eyeFov[eye].m_left; - _hmd.eye[eye].fov[3] = m_desc.m_eyeFov[eye].m_right; - } - - m_impl->updateInput(_hmd); - if (m_enabled) - { - _hmd.flags |= BGFX_HMD_RENDERING; - } - } - - bool VR::tryReconnect() - { - if (!m_impl) - { - return false; - } - - BX_CHECK(!m_impl->isConnected(), "VR::tryReconnect called when already connected. Usage error"); - - --m_framesUntilReconnect; - if (m_framesUntilReconnect > 0) - { - return false; - } - - m_framesUntilReconnect = 90; - m_impl->connect(&m_desc); - if (!m_impl->isConnected() ) - { - connectFailed(); - return false; - } - - m_hmdSize.m_w = m_desc.m_eyeSize[0].m_w + m_desc.m_eyeSize[1].m_w; - m_hmdSize.m_h = bx::uint32_max(m_desc.m_eyeSize[0].m_h, m_desc.m_eyeSize[1].m_h); - return true; - } - - void VR::connectFailed() - { - // sane defaults - m_desc.m_deviceSize.m_w = 2160; - m_desc.m_deviceSize.m_h = 1200; - m_desc.m_deviceType = 0; - m_desc.m_refreshRate = 90.0f; - m_desc.m_neckOffset[0] = 0.0805f; - m_desc.m_neckOffset[1] = 0.075f; - - for (int eye = 0; eye < 2; ++eye) - { - m_desc.m_eyeFov[eye].m_up = 1.32928634f; - m_desc.m_eyeFov[eye].m_down = 1.32928634f; - } - - m_desc.m_eyeFov[0].m_left = 1.05865765f; - m_desc.m_eyeFov[0].m_right = 1.09236801f; - m_desc.m_eyeFov[1].m_left = 1.09236801f; - m_desc.m_eyeFov[1].m_right = 1.05865765f; - } - -} // namesapce bgfx diff --git a/3rdparty/bgfx/src/hmd.h b/3rdparty/bgfx/src/hmd.h deleted file mode 100644 index d2360ed2903..00000000000 --- a/3rdparty/bgfx/src/hmd.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#ifndef BGFX_HMD_H_HEADER_GUARD -#define BGFX_HMD_H_HEADER_GUARD - -#include "bgfx_p.h" - -namespace bgfx -{ - struct VRSize - { - uint32_t m_w; - uint32_t m_h; - }; - - struct VRFovTan - { - float m_up; - float m_down; - float m_left; - float m_right; - }; - - struct VRDesc - { - uint32_t m_deviceType; - float m_refreshRate; - VRSize m_deviceSize; - VRSize m_eyeSize[2]; - VRFovTan m_eyeFov[2]; - float m_neckOffset[2]; - }; - - struct BX_NO_VTABLE VRImplI - { - virtual ~VRImplI() = 0; - - virtual bool init() = 0; - virtual void shutdown() = 0; - virtual void connect(VRDesc* _desc) = 0; - virtual void disconnect() = 0; - virtual bool isConnected() const = 0; - - virtual bool updateTracking(HMD& _hmd) = 0; - virtual void updateInput(HMD& _hmd) = 0; - virtual void recenter() = 0; - - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) = 0; - virtual void destroySwapChain() = 0; - virtual void destroyMirror() = 0; - virtual void makeRenderTargetActive(const VRDesc& _desc) = 0; - virtual bool submitSwapChain(const VRDesc& _desc) = 0; - }; - - inline VRImplI::~VRImplI() - { - } - - class VR - { - public: - VR(); - - void init(VRImplI* _impl); - void shutdown(); - - bool isInitialized() const - { - return NULL != m_impl; - } - - bool isEnabled() const - { - return m_enabled; - } - - void getViewport(uint8_t _eye, Rect* _viewport) const; - void makeRenderTargetActive(); - void recenter(); - - void preReset(); - void postReset(int _msaaSamples, int _mirrorWidth, int _mirrorHeight); - void flip(); - void swap(HMD& _hmd); - - private: - bool tryReconnect(); - void connectFailed(); - - VRImplI* m_impl; - VRDesc m_desc; - VRSize m_hmdSize; - uint32_t m_framesUntilReconnect; - bool m_enabled; - }; - -} // namespace bgfx - -#endif // BGFX_HMD_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/hmd_openvr.cpp b/3rdparty/bgfx/src/hmd_openvr.cpp deleted file mode 100644 index 54d86de99c2..00000000000 --- a/3rdparty/bgfx/src/hmd_openvr.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#include "hmd_openvr.h" - -BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-variable") -#include - -namespace bgfx -{ -#if BX_PLATFORM_WINDOWS -# define VR_CALLTYPE __cdecl -#else -# define VR_CALLTYPE -#endif - - typedef uint32_t (VR_CALLTYPE *PFN_VR_INITINTERNAL)(EVRInitError* peError, EVRApplicationType eType); - typedef void (VR_CALLTYPE *PFN_VR_SHUTDOWNINTERNAL)(); - typedef bool (VR_CALLTYPE *PFN_VR_ISHMDPRESENT)(); - typedef void* (VR_CALLTYPE *PFN_VR_GETGENERICINTERFACE)(const char* pchInterfaceVersion, EVRInitError* peError); - typedef bool (VR_CALLTYPE *PFN_VR_ISRUNTIMEINSTALLED)(); - typedef bool (VR_CALLTYPE *PFN_VR_ISINTERFACEVERSIONVALID)(const char *pchInterfaceVersion); - typedef uint32_t (VR_CALLTYPE *PFN_VR_GETINITTOKEN)(); - typedef const char* (VR_CALLTYPE *PFN_VR_GETVRINITERRORASSYMBOL)(EVRInitError error); - typedef const char* (VR_CALLTYPE *PFN_VR_GETVRINITERRORASENGLISHDESCRIPTION)(EVRInitError error); - - PFN_VR_INITINTERNAL VR_InitInternal; - PFN_VR_SHUTDOWNINTERNAL VR_ShutdownInternal; - PFN_VR_ISHMDPRESENT VR_IsHmdPresent; - PFN_VR_GETGENERICINTERFACE VR_GetGenericInterface; - PFN_VR_ISRUNTIMEINSTALLED VR_IsRuntimeInstalled; - PFN_VR_ISINTERFACEVERSIONVALID VR_IsInterfaceVersionValid; - PFN_VR_GETINITTOKEN VR_GetInitToken; - PFN_VR_GETVRINITERRORASSYMBOL VR_GetVRInitErrorAsSymbol; - PFN_VR_GETVRINITERRORASENGLISHDESCRIPTION VR_GetVRInitErrorAsEnglishDescription; - - void* loadOpenVR() - { - void* openvrdll = bx::dlopen( -#if BX_PLATFORM_LINUX - "libopenvr_api.so" -#elif BX_PLATFORM_OSX - "libopenvr_api.dylib" -#else - "openvr_api.dll" -#endif // BX_PLATFORM_* - ); - if (NULL != openvrdll) - { - VR_InitInternal = (PFN_VR_INITINTERNAL )bx::dlsym(openvrdll, "VR_InitInternal"); - VR_ShutdownInternal = (PFN_VR_SHUTDOWNINTERNAL )bx::dlsym(openvrdll, "VR_ShutdownInternal"); - VR_IsHmdPresent = (PFN_VR_ISHMDPRESENT )bx::dlsym(openvrdll, "VR_IsHmdPresent"); - VR_GetGenericInterface = (PFN_VR_GETGENERICINTERFACE )bx::dlsym(openvrdll, "VR_GetGenericInterface"); - VR_IsRuntimeInstalled = (PFN_VR_ISRUNTIMEINSTALLED )bx::dlsym(openvrdll, "VR_IsRuntimeInstalled"); - VR_IsInterfaceVersionValid = (PFN_VR_ISINTERFACEVERSIONVALID)bx::dlsym(openvrdll, "VR_IsInterfaceVersionValid"); - VR_GetInitToken = (PFN_VR_GETINITTOKEN )bx::dlsym(openvrdll, "VR_GetInitToken"); - VR_GetVRInitErrorAsSymbol = (PFN_VR_GETVRINITERRORASSYMBOL )bx::dlsym(openvrdll, "VR_GetVRInitErrorAsSymbol"); - VR_GetVRInitErrorAsEnglishDescription = (PFN_VR_GETVRINITERRORASENGLISHDESCRIPTION)bx::dlsym(openvrdll, "VR_GetVRInitErrorAsEnglishDescription"); - - if (NULL == VR_InitInternal - || NULL == VR_ShutdownInternal - || NULL == VR_IsHmdPresent - || NULL == VR_GetGenericInterface - || NULL == VR_IsRuntimeInstalled - || NULL == VR_IsInterfaceVersionValid - || NULL == VR_GetInitToken - || NULL == VR_GetVRInitErrorAsSymbol - || NULL == VR_GetVRInitErrorAsEnglishDescription) - { - bx::dlclose(openvrdll); - return NULL; - } - - EVRInitError err; - uint32_t token = VR_InitInternal(&err, EVRApplicationType_VRApplication_Scene); - BX_UNUSED(token); - - BX_TRACE("OpenVR: HMD is %spresent, Runtime is %sinstalled." - , VR_IsHmdPresent() ? "" : "not " - , VR_IsRuntimeInstalled() ? "" : "not " - ); - } - - return openvrdll; - } - - void unloadOpenVR(void* _openvrdll) - { - VR_ShutdownInternal(); - bx::dlclose(_openvrdll); - } - -} // namespace bgfx diff --git a/3rdparty/bgfx/src/hmd_openvr.h b/3rdparty/bgfx/src/hmd_openvr.h deleted file mode 100644 index 897a1220383..00000000000 --- a/3rdparty/bgfx/src/hmd_openvr.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#ifndef BGFX_OPENVR_H_HEADER_GUARD -#define BGFX_OPENVR_H_HEADER_GUARD - -#include "bgfx_p.h" - -namespace bgfx -{ - void* loadOpenVR(); - void unloadOpenVR(void*); - -} // namespace bgfx - -#endif // BGFX_OPENVR_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/hmd_ovr.cpp b/3rdparty/bgfx/src/hmd_ovr.cpp deleted file mode 100644 index 0898d9d65be..00000000000 --- a/3rdparty/bgfx/src/hmd_ovr.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#include "bgfx_p.h" - -#if BGFX_CONFIG_USE_OVR - -#include "hmd_ovr.h" - -namespace bgfx -{ -#define _OVR_CHECK(_call) \ - BX_MACRO_BLOCK_BEGIN \ - ovrResult __result__ = _call; \ - BX_CHECK(OVR_SUCCESS(__result__), #_call " FAILED %d", __result__); \ - BX_MACRO_BLOCK_END - -#if BGFX_CONFIG_DEBUG -# define OVR_CHECK(_call) _OVR_CHECK(_call) -#else -# define OVR_CHECK(_call) _call -#endif // BGFX_CONFIG_DEBUG - - VRImplOVR::VRImplOVR() - : m_session(NULL) - { - } - - VRImplOVR::~VRImplOVR() - { - if (NULL != g_platformData.session) - { - return; - } - - BX_CHECK(NULL == m_session, "OVR not shutdown properly."); - } - - bool VRImplOVR::init() - { - if (NULL != g_platformData.session) - { - return true; - } - - ovrResult initialized = ovr_Initialize(NULL); - if (!OVR_SUCCESS(initialized)) - { - BX_TRACE("Unable to initialize OVR runtime."); - return false; - } - - return true; - } - - void VRImplOVR::shutdown() - { - if (NULL != g_platformData.session) - { - return; - } - - ovr_Shutdown(); - } - - void VRImplOVR::connect(VRDesc* _desc) - { - if (NULL == g_platformData.session) - { - ovrGraphicsLuid luid; - ovrResult result = ovr_Create(&m_session, &luid); - if (!OVR_SUCCESS(result)) - { - BX_TRACE("Failed to create OVR device."); - return; - } - } - else - { - m_session = (ovrSession)g_platformData.session; - } - - ovrHmdDesc hmdDesc = ovr_GetHmdDesc(m_session); - _desc->m_deviceType = hmdDesc.Type; - _desc->m_refreshRate = hmdDesc.DisplayRefreshRate; - _desc->m_deviceSize.m_w = hmdDesc.Resolution.w; - _desc->m_deviceSize.m_h = hmdDesc.Resolution.h; - - BX_TRACE("OVR HMD: %s, %s, firmware: %d.%d" - , hmdDesc.ProductName - , hmdDesc.Manufacturer - , hmdDesc.FirmwareMajor - , hmdDesc.FirmwareMinor - ); - - ovrSizei eyeSize[2] = - { - ovr_GetFovTextureSize(m_session, ovrEye_Left, hmdDesc.DefaultEyeFov[0], 1.0f), - ovr_GetFovTextureSize(m_session, ovrEye_Right, hmdDesc.DefaultEyeFov[0], 1.0f), - }; - - for (int eye = 0; eye < 2; ++eye) - { - BX_STATIC_ASSERT(sizeof(_desc->m_eyeFov[eye]) == sizeof(hmdDesc.DefaultEyeFov[eye])); - bx::memCopy(&_desc->m_eyeFov[eye], &hmdDesc.DefaultEyeFov[eye], sizeof(_desc->m_eyeFov[eye])); - _desc->m_eyeSize[eye].m_w = eyeSize[eye].w; - _desc->m_eyeSize[eye].m_h = eyeSize[eye].h; - } - - float neckOffset[2] = {OVR_DEFAULT_NECK_TO_EYE_HORIZONTAL, OVR_DEFAULT_NECK_TO_EYE_VERTICAL}; - ovr_GetFloatArray(m_session, OVR_KEY_NECK_TO_EYE_DISTANCE, neckOffset, 2); - _desc->m_neckOffset[0] = neckOffset[0]; - _desc->m_neckOffset[1] = neckOffset[1]; - - // build constant layer settings - m_renderLayer.Header.Type = ovrLayerType_EyeFov; - m_renderLayer.Header.Flags = 0; - m_renderLayer.Fov[0] = hmdDesc.DefaultEyeFov[0]; - m_renderLayer.Fov[1] = hmdDesc.DefaultEyeFov[1]; - m_renderLayer.Viewport[0].Pos.x = 0; - m_renderLayer.Viewport[0].Pos.y = 0; - m_renderLayer.Viewport[0].Size.w = _desc->m_eyeSize[0].m_w; - m_renderLayer.Viewport[0].Size.h = _desc->m_eyeSize[0].m_h; - m_renderLayer.Viewport[1].Pos.x = _desc->m_eyeSize[0].m_w+1; - m_renderLayer.Viewport[1].Pos.y = 0; - m_renderLayer.Viewport[1].Size.w = _desc->m_eyeSize[1].m_w; - m_renderLayer.Viewport[1].Size.h = _desc->m_eyeSize[1].m_h; - - m_viewScale.HmdSpaceToWorldScaleInMeters = 1.0f; - for (int eye = 0; eye < 2; ++eye) - { - ovrEyeRenderDesc erd = ovr_GetRenderDesc(m_session, static_cast(eye), hmdDesc.DefaultEyeFov[eye]); - m_viewScale.HmdToEyeOffset[eye] = erd.HmdToEyeOffset; - m_eyeFov[eye] = erd.Fov; - m_pixelsPerTanAngleAtCenter[eye] = erd.PixelsPerTanAngleAtCenter; - } - } - - void VRImplOVR::disconnect() - { - if (NULL != g_platformData.session) - { - return; - } - - if (NULL != m_session) - { - ovr_Destroy(m_session); - m_session = NULL; - } - } - - bool VRImplOVR::updateTracking(HMD& _hmd) - { - if (NULL == m_session) - { - return false; - } - - ovr_GetEyePoses(m_session, 0, ovrTrue, m_viewScale.HmdToEyeOffset, m_renderLayer.RenderPose, &m_renderLayer.SensorSampleTime); - - for (int eye = 0; eye < 2; ++eye) - { - const ovrPosef& pose = m_renderLayer.RenderPose[eye]; - HMD::Eye& hmdEye = _hmd.eye[eye]; - - hmdEye.rotation[0] = pose.Orientation.x; - hmdEye.rotation[1] = pose.Orientation.y; - hmdEye.rotation[2] = pose.Orientation.z; - hmdEye.rotation[3] = pose.Orientation.w; - hmdEye.translation[0] = pose.Position.x; - hmdEye.translation[1] = pose.Position.y; - hmdEye.translation[2] = pose.Position.z; - hmdEye.viewOffset[0] = -m_viewScale.HmdToEyeOffset[eye].x; - hmdEye.viewOffset[1] = -m_viewScale.HmdToEyeOffset[eye].y; - hmdEye.viewOffset[2] = -m_viewScale.HmdToEyeOffset[eye].z; - - hmdEye.pixelsPerTanAngle[0] = m_pixelsPerTanAngleAtCenter[eye].x; - hmdEye.pixelsPerTanAngle[1] = m_pixelsPerTanAngleAtCenter[eye].y; - - ovrMatrix4f projection = ovrMatrix4f_Projection(m_eyeFov[eye], 0.1f, 1000.0f, ovrProjection_LeftHanded); - for (uint32_t ii = 0; ii < 4; ++ii) - { - for (uint32_t jj = 0; jj < 4; ++jj) - { - hmdEye.projection[4*ii + jj] = projection.M[jj][ii]; - } - } - } - - return true; - } - - void VRImplOVR::updateInput(HMD& /* _hmd */) - { - } - - void VRImplOVR::recenter() - { - if (NULL != m_session) - { - ovr_RecenterTrackingOrigin(m_session); - } - } - -} // namespace bgfx - -#endif // BGFX_CONFIG_USE_OVR diff --git a/3rdparty/bgfx/src/hmd_ovr.h b/3rdparty/bgfx/src/hmd_ovr.h deleted file mode 100644 index f41d429df10..00000000000 --- a/3rdparty/bgfx/src/hmd_ovr.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - */ - -#ifndef BGFX_OVR_H_HEADER_GUARD -#define BGFX_OVR_H_HEADER_GUARD - -#include "bgfx_p.h" - -#if BGFX_CONFIG_USE_OVR - -# include "hmd.h" -# include - -# define OVR_VERSION_(_a, _b, _c) (_a * 10000 + _b * 100 + _c) -# define OVR_VERSION OVR_VERSION_(OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION, OVR_MINOR_VERSION) - -# include - -# if BGFX_CONFIG_RENDERER_DIRECT3D11 -# include -# endif // BGFX_CONFIG_RENDERER_DIRECT3D11 - -# if BGFX_CONFIG_RENDERER_OPENGL -# include -# endif // BGFX_CONFIG_RENDERER_OPENGL - - -namespace bgfx -{ - class VRImplOVR : public VRImplI - { - public: - VRImplOVR(); - virtual ~VRImplOVR() = 0; - - virtual bool init() override; - virtual void shutdown() override; - virtual void connect(VRDesc* _desc) override; - virtual void disconnect() override; - - virtual bool isConnected() const override - { - return NULL != m_session; - } - - virtual bool updateTracking(HMD& _hmd) override; - virtual void updateInput(HMD& _hmd) override; - virtual void recenter() override; - - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override = 0; - virtual void destroySwapChain() override = 0; - virtual void destroyMirror() override = 0; - virtual void makeRenderTargetActive(const VRDesc& _desc) override = 0; - virtual bool submitSwapChain(const VRDesc& _desc) override = 0; - - protected: - ovrSession m_session; - ovrLayerEyeFov m_renderLayer; - ovrViewScaleDesc m_viewScale; - ovrFovPort m_eyeFov[2]; - ovrVector2f m_pixelsPerTanAngleAtCenter[2]; - }; - -} // namespace bgfx - -#endif // BGFX_CONFIG_USE_OVR - -#endif // BGFX_OVR_H_HEADER_GUARD diff --git a/3rdparty/bgfx/src/makefile b/3rdparty/bgfx/src/makefile index 8f017d2d9c0..8dccda6ab3f 100644 --- a/3rdparty/bgfx/src/makefile +++ b/3rdparty/bgfx/src/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/src/nvapi.cpp b/3rdparty/bgfx/src/nvapi.cpp index e4205c112df..3ece9c7fc03 100644 --- a/3rdparty/bgfx/src/nvapi.cpp +++ b/3rdparty/bgfx/src/nvapi.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -11,10 +11,11 @@ namespace bgfx /* * NVAPI * - * Reference: - * http://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/index.html - * https://github.com/jNizM/AHK_NVIDIA_NvAPI/blob/master/info/NvAPI_IDs.txt + * Reference(s): + * - https://web.archive.org/web/20181126035649/https://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/index.html + * - https://web.archive.org/web/20181126035710/https://github.com/jNizM/AHK_NVIDIA_NvAPI/blob/master/info/NvAPI_IDs.txt */ + struct NvPhysicalGpuHandle; #define NVAPI_MAX_PHYSICAL_GPUS 64 @@ -53,11 +54,13 @@ namespace bgfx typedef NvApiStatus (NVAPICALL* PFN_NVAPI_GPUGETMEMORYINFO)(NvPhysicalGpuHandle* _handle, NvMemoryInfoV2* _memoryInfo); typedef NvApiStatus (NVAPICALL* PFN_NVAPI_GPUGETFULLNAME)(NvPhysicalGpuHandle* _physicalGpu, char _name[64]); -#define NVAPI_INITIALIZE UINT32_C(0x0150e828) -#define NVAPI_UNLOAD UINT32_C(0xd22bdd7e) -#define NVAPI_ENUMPHYSICALGPUS UINT32_C(0xe5ac921f) -#define NVAPI_GPUGETMEMORYINFO UINT32_C(0x07f9b368) -#define NVAPI_GPUGETFULLNAME UINT32_C(0xceee8e9f) +#define NVAPI_INITIALIZE UINT32_C(0x0150e828) +#define NVAPI_UNLOAD UINT32_C(0xd22bdd7e) +#define NVAPI_ENUMPHYSICALGPUS UINT32_C(0xe5ac921f) +#define NVAPI_GPUGETMEMORYINFO UINT32_C(0x07f9b368) +#define NVAPI_GPUGETFULLNAME UINT32_C(0xceee8e9f) +#define NVAPI_MULTIDRAWINSTANCEDINDIRECT UINT32_C(0xd4e26bbf) +#define NVAPI_MULTIDRAWINDEXEDINSTANCEDINDIRECT UINT32_C(0x59e890f9) static PFN_NVAPI_QUERYINTERFACE nvApiQueryInterface; static PFN_NVAPI_INITIALIZE nvApiInitialize; @@ -66,9 +69,38 @@ namespace bgfx static PFN_NVAPI_GPUGETMEMORYINFO nvApiGpuGetMemoryInfo; static PFN_NVAPI_GPUGETFULLNAME nvApiGpuGetFullName; + /* + * NVIDIA Aftermath + * + * Reference(s): + * - https://web.archive.org/web/20181126035743/https://developer.nvidia.com/nvidia-aftermath + */ + + typedef int32_t (*PFN_NVAFTERMATH_DX11_INITIALIZE)(int32_t _version, int32_t _flags, const ID3D11Device* _device); + typedef int32_t (*PFN_NVAFTERMATH_DX11_CREATECONTEXTHANDLE)(const ID3D11DeviceContext* _deviceCtx, NvAftermathContextHandle** _outContextHandle); + typedef int32_t (*PFN_NVAFTERMATH_DX12_INITIALIZE)(int32_t _version, int32_t _flags, const ID3D12Device* _device); + typedef int32_t (*PFN_NVAFTERMATH_DX12_CREATECONTEXTHANDLE)(const ID3D12CommandList* _commandList, NvAftermathContextHandle** _outContextHandle); + typedef int32_t (*PFN_NVAFTERMATH_RELEASECONTEXTHANDLE)(const NvAftermathContextHandle* _contextHandle); + typedef int32_t (*PFN_NVAFTERMATH_SETEVENTMARKER)(const NvAftermathContextHandle* _contextHandle, const void* _markerData, uint32_t _markerSize); + typedef int32_t (*PFN_NVAFTERMATH_GETDATA)(uint32_t _numContexts, const NvAftermathContextHandle** _contextHandles, void* _outContextData); + typedef int32_t (*PFN_NVAFTERMATH_GETDEVICESTATUS)(void* _outStatus); + typedef int32_t (*PFN_NVAFTERMATH_GETPAGEFAULTINFORMATION)(void* _outPageFaultInformation); + + static PFN_NVAFTERMATH_DX11_INITIALIZE nvAftermathDx11Initialize; + static PFN_NVAFTERMATH_DX11_CREATECONTEXTHANDLE nvAftermathDx11CreateContextHandle; + static PFN_NVAFTERMATH_DX12_INITIALIZE nvAftermathDx12Initialize; + static PFN_NVAFTERMATH_DX12_CREATECONTEXTHANDLE nvAftermathDx12CreateContextHandle; + static PFN_NVAFTERMATH_RELEASECONTEXTHANDLE nvAftermathReleaseContextHandle; + static PFN_NVAFTERMATH_SETEVENTMARKER nvAftermathSetEventMarker; + static PFN_NVAFTERMATH_GETDATA nvAftermathGetData; + static PFN_NVAFTERMATH_GETDEVICESTATUS nvAftermathGetDeviceStatus; + static PFN_NVAFTERMATH_GETPAGEFAULTINFORMATION nvAftermathGetPageFaultInformation; + NvApi::NvApi() : m_nvApiDll(NULL) , m_nvGpu(NULL) + , m_nvAftermathDll(NULL) + , m_aftermathHandle(NULL) { } @@ -76,11 +108,11 @@ namespace bgfx { m_nvGpu = NULL; m_nvApiDll = bx::dlopen( -#if BX_ARCH_32BIT - "nvapi.dll" -#else - "nvapi64.dll" + "nvapi" +#if BX_ARCH_64BIT + "64" #endif // BX_ARCH_32BIT + ".dll" ); if (NULL != m_nvApiDll) @@ -91,11 +123,14 @@ namespace bgfx if (initialized) { - nvApiInitialize = (PFN_NVAPI_INITIALIZE )nvApiQueryInterface(NVAPI_INITIALIZE); - nvApiUnload = (PFN_NVAPI_UNLOAD )nvApiQueryInterface(NVAPI_UNLOAD); - nvApiEnumPhysicalGPUs = (PFN_NVAPI_ENUMPHYSICALGPUS )nvApiQueryInterface(NVAPI_ENUMPHYSICALGPUS); - nvApiGpuGetMemoryInfo = (PFN_NVAPI_GPUGETMEMORYINFO )nvApiQueryInterface(NVAPI_GPUGETMEMORYINFO); - nvApiGpuGetFullName = (PFN_NVAPI_GPUGETFULLNAME )nvApiQueryInterface(NVAPI_GPUGETFULLNAME); + nvApiInitialize = (PFN_NVAPI_INITIALIZE )nvApiQueryInterface(NVAPI_INITIALIZE); + nvApiUnload = (PFN_NVAPI_UNLOAD )nvApiQueryInterface(NVAPI_UNLOAD); + nvApiEnumPhysicalGPUs = (PFN_NVAPI_ENUMPHYSICALGPUS)nvApiQueryInterface(NVAPI_ENUMPHYSICALGPUS); + nvApiGpuGetMemoryInfo = (PFN_NVAPI_GPUGETMEMORYINFO)nvApiQueryInterface(NVAPI_GPUGETMEMORYINFO); + nvApiGpuGetFullName = (PFN_NVAPI_GPUGETFULLNAME )nvApiQueryInterface(NVAPI_GPUGETFULLNAME); + + nvApiD3D11MultiDrawInstancedIndirect = (PFN_NVAPI_MULTIDRAWINDIRECT)nvApiQueryInterface(NVAPI_MULTIDRAWINSTANCEDINDIRECT); + nvApiD3D11MultiDrawIndexedInstancedIndirect = (PFN_NVAPI_MULTIDRAWINDIRECT)nvApiQueryInterface(NVAPI_MULTIDRAWINDEXEDINSTANCEDINDIRECT); initialized = true && NULL != nvApiInitialize @@ -116,18 +151,19 @@ namespace bgfx if (initialized) { m_nvGpu = physicalGpus[0]; + + initialized = NULL != m_nvGpu; + if (initialized) + { + char name[64]; + nvApiGpuGetFullName(m_nvGpu, name); + BX_TRACE("%s", name); + } + else + { + nvApiUnload(); + } } - - char name[64]; - nvApiGpuGetFullName(m_nvGpu, name); - BX_TRACE("%s", name); - } - - initialized = NULL != m_nvGpu; - - if (!initialized) - { - nvApiUnload(); } } @@ -154,6 +190,8 @@ namespace bgfx bx::dlclose(m_nvApiDll); m_nvApiDll = NULL; } + + shutdownAftermath(); } void NvApi::getMemoryInfo(int64_t& _gpuMemoryUsed, int64_t& _gpuMemoryMax) @@ -164,8 +202,8 @@ namespace bgfx NvApiStatus status = nvApiGpuGetMemoryInfo(m_nvGpu, &memInfo); if (NVAPI_OK == status) { - _gpuMemoryMax = 1024 * memInfo.availableDedicatedVideoMemory; - _gpuMemoryUsed = 1024 * (memInfo.availableDedicatedVideoMemory - memInfo.curAvailableDedicatedVideoMemory); + _gpuMemoryMax = 1024 * int64_t(memInfo.availableDedicatedVideoMemory); + _gpuMemoryUsed = 1024 * int64_t(memInfo.availableDedicatedVideoMemory - memInfo.curAvailableDedicatedVideoMemory); // BX_TRACE(" dedicatedVideoMemory: %d KiB", memInfo.dedicatedVideoMemory); // BX_TRACE(" availableDedicatedVideoMemory: %d KiB", memInfo.availableDedicatedVideoMemory); // BX_TRACE(" systemVideoMemory: %d KiB", memInfo.systemVideoMemory); @@ -180,4 +218,156 @@ namespace bgfx } } + bool NvApi::loadAftermath() + { + m_nvAftermathDll = bx::dlopen( + "GFSDK_Aftermath_Lib." +#if BX_ARCH_32BIT + "x86" +#else + "x64" +#endif // BX_ARCH_32BIT + ".dll" + ); + + if (NULL != m_nvAftermathDll) + { + nvAftermathDx11Initialize = (PFN_NVAFTERMATH_DX11_INITIALIZE )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_DX11_Initialize"); + nvAftermathDx11CreateContextHandle = (PFN_NVAFTERMATH_DX11_CREATECONTEXTHANDLE)bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_DX11_CreateContextHandle"); + nvAftermathDx12Initialize = (PFN_NVAFTERMATH_DX12_INITIALIZE )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_DX12_Initialize"); + nvAftermathDx12CreateContextHandle = (PFN_NVAFTERMATH_DX12_CREATECONTEXTHANDLE)bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_DX12_CreateContextHandle"); + nvAftermathReleaseContextHandle = (PFN_NVAFTERMATH_RELEASECONTEXTHANDLE )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_ReleaseContextHandle"); + nvAftermathSetEventMarker = (PFN_NVAFTERMATH_SETEVENTMARKER )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_SetEventMarker"); + nvAftermathGetData = (PFN_NVAFTERMATH_GETDATA )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_GetData"); + nvAftermathGetDeviceStatus = (PFN_NVAFTERMATH_GETDEVICESTATUS )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_GetDeviceStatus"); + nvAftermathGetPageFaultInformation = (PFN_NVAFTERMATH_GETPAGEFAULTINFORMATION )bx::dlsym(m_nvAftermathDll, "GFSDK_Aftermath_GetPageFaultInformation"); + + bool initialized = true + && NULL != nvAftermathDx11Initialize + && NULL != nvAftermathDx11CreateContextHandle + && NULL != nvAftermathDx12Initialize + && NULL != nvAftermathDx12CreateContextHandle + && NULL != nvAftermathReleaseContextHandle + && NULL != nvAftermathSetEventMarker + && NULL != nvAftermathGetData + && NULL != nvAftermathGetDeviceStatus + && NULL != nvAftermathGetPageFaultInformation + ; + + if (initialized) + { + return true; + } + + shutdownAftermath(); + } + + return false; + } + + bool NvApi::initAftermath(const ID3D11Device* _device, const ID3D11DeviceContext* _deviceCtx) + { + if (loadAftermath() ) + { + int32_t result; + result = nvAftermathDx11Initialize(0x13, 1, _device); + if (1 == result) + { + result = nvAftermathDx11CreateContextHandle(_deviceCtx, &m_aftermathHandle); + BX_WARN(1 == result, "NV Aftermath: nvAftermathDx12CreateContextHandle failed %x", result); + + if (1 == result) + { + return true; + } + } + else + { + switch (result) + { + case int32_t(0xbad0000a): BX_TRACE("NV Aftermath: Debug layer not compatible with Aftermath."); break; + default: BX_TRACE("NV Aftermath: Failed to initialize."); break; + } + } + + shutdownAftermath(); + } + + return false; + } + + bool NvApi::initAftermath(const ID3D12Device* _device, const ID3D12CommandList* _commandList) + { + if (loadAftermath() ) + { + int32_t result; + result = nvAftermathDx12Initialize(0x13, 1, _device); + if (1 == result) + { + result = nvAftermathDx12CreateContextHandle(_commandList, &m_aftermathHandle); + BX_WARN(1 == result, "NV Aftermath: nvAftermathDx12CreateContextHandle failed %x", result); + + if (1 == result) + { + return true; + } + } + else + { + switch (result) + { + case int32_t(0xbad0000a): BX_TRACE("NV Aftermath: Debug layer not compatible with Aftermath."); break; + default: BX_TRACE("NV Aftermath: Failed to initialize."); break; + } + } + + shutdownAftermath(); + } + + return false; + } + + NvAftermathDeviceStatus::Enum NvApi::getDeviceStatus() const + { + if (NULL != m_aftermathHandle) + { + int32_t status; + nvAftermathGetDeviceStatus(&status); + + return NvAftermathDeviceStatus::Enum(status); + } + + return NvAftermathDeviceStatus::NotInitialized; + } + + void NvApi::shutdownAftermath() + { + if (NULL != m_nvAftermathDll) + { + if (NULL != m_aftermathHandle) + { + nvAftermathReleaseContextHandle(m_aftermathHandle); + m_aftermathHandle = NULL; + } + + bx::dlclose(m_nvAftermathDll); + m_nvAftermathDll = NULL; + } + } + +#define NVA_CHECK(_call) \ + BX_MACRO_BLOCK_BEGIN \ + int32_t __result__ = _call; \ + BX_CHECK(1 == __result__, #_call " FAILED 0x%08x\n", __result__); \ + BX_UNUSED(__result__); \ + BX_MACRO_BLOCK_END + + void NvApi::setMarker(const bx::StringView& _marker) + { + if (NULL != m_aftermathHandle) + { + NVA_CHECK(nvAftermathSetEventMarker(m_aftermathHandle, _marker.getPtr(), _marker.getLength() ) ); + } + } + } // namespace bgfx diff --git a/3rdparty/bgfx/src/nvapi.h b/3rdparty/bgfx/src/nvapi.h index ce08052b3aa..8fe5b967d8c 100644 --- a/3rdparty/bgfx/src/nvapi.h +++ b/3rdparty/bgfx/src/nvapi.h @@ -1,14 +1,36 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ #ifndef BGFX_NVAPI_H_HEADER_GUARD #define BGFX_NVAPI_H_HEADER_GUARD +struct ID3D11Device; +struct ID3D11DeviceContext; +struct ID3D11Buffer; +struct ID3D12Device; +struct ID3D12CommandList; + namespace bgfx { struct NvPhysicalGpuHandle; + struct NvAftermathContextHandle; + + struct NvAftermathDeviceStatus + { + enum Enum + { + Active, + Timeout, + OutOfMemory, + PageFault, + Unknown, + NotInitialized + }; + }; + + typedef void (*PFN_NVAPI_MULTIDRAWINDIRECT)(ID3D11DeviceContext* _deviceCtx, uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride); /// struct NvApi @@ -22,11 +44,39 @@ namespace bgfx /// void shutdown(); + /// + bool isInitialized() const { return NULL != m_nvGpu; } + /// void getMemoryInfo(int64_t& _gpuMemoryUsed, int64_t& _gpuMemoryMax); + /// + bool loadAftermath(); + + /// + bool initAftermath(const ID3D11Device* _device, const ID3D11DeviceContext* _deviceCtx); + + /// + bool initAftermath(const ID3D12Device* _device, const ID3D12CommandList* _commandList); + + /// + NvAftermathDeviceStatus::Enum getDeviceStatus() const; + + /// + void shutdownAftermath(); + + /// + void setMarker(const bx::StringView& _marker); + + /// void* m_nvApiDll; NvPhysicalGpuHandle* m_nvGpu; + + void* m_nvAftermathDll; + NvAftermathContextHandle* m_aftermathHandle; + + PFN_NVAPI_MULTIDRAWINDIRECT nvApiD3D11MultiDrawInstancedIndirect; + PFN_NVAPI_MULTIDRAWINDIRECT nvApiD3D11MultiDrawIndexedInstancedIndirect; }; } // namespace bgfx diff --git a/3rdparty/bgfx/src/renderer.h b/3rdparty/bgfx/src/renderer.h index e5c1cbd4c2f..ef45002a7a0 100644 --- a/3rdparty/bgfx/src/renderer.h +++ b/3rdparty/bgfx/src/renderer.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -47,12 +47,12 @@ namespace bgfx { } - ViewState(Frame* _frame, bool _hmdEnabled) + ViewState(Frame* _frame, bool _stereo) { - reset(_frame, _hmdEnabled); + reset(_frame, _stereo); } - void reset(Frame* _frame, bool _hmdEnabled) + void reset(Frame* _frame, bool _stereo) { m_alphaRef = 0.0f; m_invViewCached = UINT16_MAX; @@ -62,16 +62,15 @@ namespace bgfx m_view[0] = m_viewTmp[0]; m_view[1] = m_viewTmp[1]; - if (_hmdEnabled) + if (_stereo) { - HMD& hmd = _frame->m_hmd; - m_view[0] = m_viewTmp[0]; Matrix4 viewAdjust; bx::mtxIdentity(viewAdjust.un.val); for (uint32_t eye = 0; eye < 2; ++eye) { +/* const HMD::Eye& hmdEye = hmd.eye[eye]; viewAdjust.un.val[12] = hmdEye.viewOffset[0]; viewAdjust.un.val[13] = hmdEye.viewOffset[1]; @@ -91,6 +90,7 @@ namespace bgfx bx::memCopy(&m_view[0][ii].un.f4x4, &_frame->m_view[ii].m_view.un.f4x4, sizeof(Matrix4) ); } } +*/ } } else @@ -103,7 +103,7 @@ namespace bgfx for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { - for (uint32_t eye = 0; eye < uint32_t(_hmdEnabled)+1; ++eye) + for (uint32_t eye = 0; eye < uint32_t(_stereo)+1; ++eye) { bx::float4x4_mul(&m_viewProj[eye][ii].un.f4x4 , &m_view[eye][ii].un.f4x4 @@ -314,11 +314,6 @@ namespace bgfx uint16_t m_invViewProjCached; }; - template - inline void release(Ty) - { - } - template class StateCacheLru { diff --git a/3rdparty/bgfx/src/renderer_d3d.h b/3rdparty/bgfx/src/renderer_d3d.h index a654ab073b9..25983d6dcd6 100644 --- a/3rdparty/bgfx/src/renderer_d3d.h +++ b/3rdparty/bgfx/src/renderer_d3d.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -19,13 +19,66 @@ # define DX_CHECK_EXTRA_ARGS #endif // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9 +#define DXGI_FORMAT_ASTC_4X4_TYPELESS DXGI_FORMAT(133) +#define DXGI_FORMAT_ASTC_4X4_UNORM DXGI_FORMAT(134) +#define DXGI_FORMAT_ASTC_4X4_UNORM_SRGB DXGI_FORMAT(135) +#define DXGI_FORMAT_ASTC_5X4_TYPELESS DXGI_FORMAT(137) +#define DXGI_FORMAT_ASTC_5X4_UNORM DXGI_FORMAT(138) +#define DXGI_FORMAT_ASTC_5X4_UNORM_SRGB DXGI_FORMAT(139) +#define DXGI_FORMAT_ASTC_5X5_TYPELESS DXGI_FORMAT(141) +#define DXGI_FORMAT_ASTC_5X5_UNORM DXGI_FORMAT(142) +#define DXGI_FORMAT_ASTC_5X5_UNORM_SRGB DXGI_FORMAT(143) +#define DXGI_FORMAT_ASTC_6X5_TYPELESS DXGI_FORMAT(145) +#define DXGI_FORMAT_ASTC_6X5_UNORM DXGI_FORMAT(146) +#define DXGI_FORMAT_ASTC_6X5_UNORM_SRGB DXGI_FORMAT(147) +#define DXGI_FORMAT_ASTC_6X6_TYPELESS DXGI_FORMAT(149) +#define DXGI_FORMAT_ASTC_6X6_UNORM DXGI_FORMAT(150) +#define DXGI_FORMAT_ASTC_6X6_UNORM_SRGB DXGI_FORMAT(151) +#define DXGI_FORMAT_ASTC_8X5_TYPELESS DXGI_FORMAT(153) +#define DXGI_FORMAT_ASTC_8X5_UNORM DXGI_FORMAT(154) +#define DXGI_FORMAT_ASTC_8X5_UNORM_SRGB DXGI_FORMAT(155) +#define DXGI_FORMAT_ASTC_8X6_TYPELESS DXGI_FORMAT(157) +#define DXGI_FORMAT_ASTC_8X6_UNORM DXGI_FORMAT(158) +#define DXGI_FORMAT_ASTC_8X6_UNORM_SRGB DXGI_FORMAT(159) +#define DXGI_FORMAT_ASTC_8X8_TYPELESS DXGI_FORMAT(161) +#define DXGI_FORMAT_ASTC_8X8_UNORM DXGI_FORMAT(162) +#define DXGI_FORMAT_ASTC_8X8_UNORM_SRGB DXGI_FORMAT(163) +#define DXGI_FORMAT_ASTC_10X5_TYPELESS DXGI_FORMAT(165) +#define DXGI_FORMAT_ASTC_10X5_UNORM DXGI_FORMAT(166) +#define DXGI_FORMAT_ASTC_10X5_UNORM_SRGB DXGI_FORMAT(167) +#define DXGI_FORMAT_ASTC_10X6_TYPELESS DXGI_FORMAT(169) +#define DXGI_FORMAT_ASTC_10X6_UNORM DXGI_FORMAT(170) +#define DXGI_FORMAT_ASTC_10X6_UNORM_SRGB DXGI_FORMAT(171) +#define DXGI_FORMAT_ASTC_10X8_TYPELESS DXGI_FORMAT(173) +#define DXGI_FORMAT_ASTC_10X8_UNORM DXGI_FORMAT(174) +#define DXGI_FORMAT_ASTC_10X8_UNORM_SRGB DXGI_FORMAT(175) +#define DXGI_FORMAT_ASTC_10X10_TYPELESS DXGI_FORMAT(177) +#define DXGI_FORMAT_ASTC_10X10_UNORM DXGI_FORMAT(178) +#define DXGI_FORMAT_ASTC_10X10_UNORM_SRGB DXGI_FORMAT(179) +#define DXGI_FORMAT_ASTC_12X10_TYPELESS DXGI_FORMAT(181) +#define DXGI_FORMAT_ASTC_12X10_UNORM DXGI_FORMAT(182) +#define DXGI_FORMAT_ASTC_12X10_UNORM_SRGB DXGI_FORMAT(183) +#define DXGI_FORMAT_ASTC_12X12_TYPELESS DXGI_FORMAT(185) +#define DXGI_FORMAT_ASTC_12X12_UNORM DXGI_FORMAT(186) +#define DXGI_FORMAT_ASTC_12X12_UNORM_SRGB DXGI_FORMAT(187) + namespace bgfx { -#if BX_PLATFORM_XBOXONE - typedef ::IGraphicsUnknown IUnknown; -#else + constexpr uint32_t toRgba8(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) + { + return 0 + | (uint32_t(_r)<<24) + | (uint32_t(_g)<<16) + | (uint32_t(_b)<< 8) + | (uint32_t(_a) ) + ; + } + +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT typedef ::IUnknown IUnknown; -#endif // BX_PLATFORM_XBOXONE +#else + typedef ::IGraphicsUnknown IUnknown; +#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT #define _DX_CHECK(_call) \ BX_MACRO_BLOCK_BEGIN \ @@ -69,7 +122,8 @@ namespace bgfx #endif // BGFX_CONFIG_DEBUG_OBJECT_NAME #define DX_RELEASE(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_CHECK) -#define DX_RELEASE_WARNONLY(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_WARN) +#define DX_RELEASE_W(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_WARN) +#define DX_RELEASE_I(_ptr) _DX_RELEASE(_ptr, 0, BX_NOOP) typedef int (WINAPI* PFN_D3DPERF_BEGIN_EVENT)(DWORD _color, LPCWSTR _name); typedef int (WINAPI* PFN_D3DPERF_END_EVENT)(); @@ -78,31 +132,41 @@ namespace bgfx typedef BOOL (WINAPI* PFN_D3DPERF_QUERY_REPEAT_FRAME)(); typedef void (WINAPI* PFN_D3DPERF_SET_OPTIONS)(DWORD _options); typedef DWORD (WINAPI* PFN_D3DPERF_GET_STATUS)(); - typedef HRESULT (WINAPI* PFN_CREATE_DXGI_FACTORY)(REFIID _riid, void** _factory); - typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE)(REFIID _riid, void** _debug); - typedef HRESULT (WINAPI* PFN_GET_DEBUG_INTERFACE1)(UINT _flags, REFIID _riid, void** _debug); -#define _PIX_SETMARKER(_col, _name) D3DPERF_SetMarker(_col, _name) +#define _PIX_SETMARKER(_col, _name) D3DPERF_SetMarker(_col, _name) #define _PIX_BEGINEVENT(_col, _name) D3DPERF_BeginEvent(_col, _name) -#define _PIX_ENDEVENT() D3DPERF_EndEvent() +#define _PIX_ENDEVENT() D3DPERF_EndEvent() #if BGFX_CONFIG_DEBUG_PIX # define PIX_SETMARKER(_color, _name) _PIX_SETMARKER(_color, _name) # define PIX_BEGINEVENT(_color, _name) _PIX_BEGINEVENT(_color, _name) -# define PIX_ENDEVENT() _PIX_ENDEVENT() +# define PIX_ENDEVENT() _PIX_ENDEVENT() #else # define PIX_SETMARKER(_color, _name) BX_UNUSED(_name) # define PIX_BEGINEVENT(_color, _name) BX_UNUSED(_name) # define PIX_ENDEVENT() #endif // BGFX_CONFIG_DEBUG_PIX -#define D3DCOLOR_FRAME D3DCOLOR_RGBA(0xff, 0xd7, 0xc9, 0xff) -#define D3DCOLOR_VIEW D3DCOLOR_RGBA(0xe4, 0xb4, 0x8e, 0xff) -#define D3DCOLOR_VIEW_L D3DCOLOR_RGBA(0xf9, 0xee, 0xe5, 0xff) -#define D3DCOLOR_VIEW_R D3DCOLOR_RGBA(0xe8, 0xd3, 0xc0, 0xff) -#define D3DCOLOR_DRAW D3DCOLOR_RGBA(0xc6, 0xe5, 0xb9, 0xff) -#define D3DCOLOR_COMPUTE D3DCOLOR_RGBA(0xa7, 0xdb, 0xd8, 0xff) -#define D3DCOLOR_MARKER D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff) +#define D3DCOLOR_FRAME toRgba8(0xff, 0xd7, 0xc9, 0xff) +#define D3DCOLOR_VIEW toRgba8(0xe4, 0xb4, 0x8e, 0xff) +#define D3DCOLOR_VIEW_L toRgba8(0xf9, 0xee, 0xe5, 0xff) +#define D3DCOLOR_VIEW_R toRgba8(0xe8, 0xd3, 0xc0, 0xff) +#define D3DCOLOR_DRAW toRgba8(0xc6, 0xe5, 0xb9, 0xff) +#define D3DCOLOR_COMPUTE toRgba8(0xa7, 0xdb, 0xd8, 0xff) +#define D3DCOLOR_MARKER toRgba8(0xff, 0x00, 0x00, 0xff) + + inline bool isType(IUnknown* _interface, const GUID& _id) + { + IUnknown* out; + HRESULT hr = _interface->QueryInterface(_id, (void**)&out); + if (FAILED(hr) ) + { + return false; + } + + out->Release(); + return true; + } inline int getRefCount(IUnknown* _interface) { @@ -141,7 +205,7 @@ namespace bgfx typename HashMap::iterator it = m_hashMap.find(_key); if (it != m_hashMap.end() ) { - DX_RELEASE_WARNONLY(it->second, 0); + DX_RELEASE_W(it->second, 0); m_hashMap.erase(it); } } diff --git a/3rdparty/bgfx/src/renderer_d3d11.cpp b/3rdparty/bgfx/src/renderer_d3d11.cpp index 0a22fa4b443..7fc4e8777e4 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.cpp +++ b/3rdparty/bgfx/src/renderer_d3d11.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -8,17 +8,6 @@ #if BGFX_CONFIG_RENDERER_DIRECT3D11 # include "renderer_d3d11.h" -#if !BX_PLATFORM_WINDOWS -# include -# if BX_PLATFORM_WINRT -# include -# endif // BX_PLATFORM_WINRT -#endif // !BX_PLATFORM_WINDOWS - -#if BGFX_CONFIG_USE_OVR -# include "hmd_ovr.h" -#endif // BGFX_CONFIG_USE_OVR - namespace bgfx { namespace d3d11 { static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -41,16 +30,7 @@ namespace bgfx { namespace d3d11 { D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, 1, 1, 0 }, { D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED, 0, 0, 0 }, }; - - static const char* s_primName[] = - { - "TriList", - "TriStrip", - "Line", - "LineStrip", - "Point", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName)+1); + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo)-1); union Zero { @@ -60,7 +40,7 @@ namespace bgfx { namespace d3d11 } ID3D11Buffer* m_buffer[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; - ID3D11UnorderedAccessView* m_uav[D3D11_PS_CS_UAV_REGISTER_COUNT]; + ID3D11UnorderedAccessView* m_uav[D3D11_1_UAV_SLOT_COUNT]; ID3D11ShaderResourceView* m_srv[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]; ID3D11SamplerState* m_sampler[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]; ID3D11RenderTargetView* m_rtv[BGFX_CONFIG_MAX_FRAME_BUFFERS]; @@ -207,82 +187,91 @@ namespace bgfx { namespace d3d11 static const TextureFormatInfo s_textureFormat[] = { - { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC1_UNORM_SRGB }, // BC1 - { DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC2_UNORM_SRGB }, // BC2 - { DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC3_UNORM_SRGB }, // BC3 - { DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC4 - { DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC5 - { DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC6H - { DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC7_UNORM_SRGB }, // BC7 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC1 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A1 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12A - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14A - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC22 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC24 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // Unknown - { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R1 - { DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // A8 - { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8 - { DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8I - { DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8U - { DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8S - { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16 - { DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16I - { DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16U - { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16F - { DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16S - { DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32I - { DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32U - { DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32F - { DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8 - { DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8I - { DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8U - { DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8S - { DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16 - { DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16I - { DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16U - { DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16F - { DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16S - { DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32I - { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32U - { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32F - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8I - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8U - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8S - { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB9E5F - { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB }, // BGRA8 - { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8 - { DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8I - { DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8U - { DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA8S - { DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16 - { DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16I - { DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16U - { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16F - { DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16S - { DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32I - { DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32U - { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32F - { DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R5G6B5 - { DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA4 - { DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB5A1 - { DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB10A2 - { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG11B10F - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // UnknownDepth - { DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_UNKNOWN }, // D16 - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24 - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24S8 - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D32 - { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D16F - { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D24F - { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D32F - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D0S8 + { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC1_UNORM_SRGB }, // BC1 + { DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC2_UNORM_SRGB }, // BC2 + { DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC3_UNORM_SRGB }, // BC3 + { DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC4 + { DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC5 + { DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC6H + { DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC7_UNORM_SRGB }, // BC7 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC1 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A1 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12A + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14A + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC22 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC24 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ATC + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ATCE + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ATCI + { DXGI_FORMAT_ASTC_4X4_UNORM, DXGI_FORMAT_ASTC_4X4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_4X4_UNORM_SRGB }, // ASTC4x4 + { DXGI_FORMAT_ASTC_5X5_UNORM, DXGI_FORMAT_ASTC_5X5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_5X5_UNORM_SRGB }, // ASTC5x5 + { DXGI_FORMAT_ASTC_6X6_UNORM, DXGI_FORMAT_ASTC_6X6_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_6X6_UNORM_SRGB }, // ASTC6x6 + { DXGI_FORMAT_ASTC_8X5_UNORM, DXGI_FORMAT_ASTC_8X5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_8X5_UNORM_SRGB }, // ASTC8x5 + { DXGI_FORMAT_ASTC_8X6_UNORM, DXGI_FORMAT_ASTC_8X6_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_8X6_UNORM_SRGB }, // ASTC8x6 + { DXGI_FORMAT_ASTC_10X5_UNORM, DXGI_FORMAT_ASTC_10X5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_10X5_UNORM_SRGB }, // ASTC10x5 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // Unknown + { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R1 + { DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // A8 + { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8 + { DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8I + { DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8U + { DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8S + { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16 + { DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16I + { DXGI_FORMAT_R16_UINT, DXGI_FORMAT_R16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16U + { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16F + { DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16S + { DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32I + { DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32U + { DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32F + { DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8 + { DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8I + { DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8U + { DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8S + { DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16 + { DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16I + { DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16U + { DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16F + { DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16S + { DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32I + { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32U + { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32F + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8I + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8U + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8S + { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB9E5F + { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB }, // BGRA8 + { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8 + { DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8I + { DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8U + { DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA8S + { DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16 + { DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16I + { DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16U + { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16F + { DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16S + { DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32I + { DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32U + { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32F + { DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R5G6B5 + { DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA4 + { DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB5A1 + { DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB10A2 + { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG11B10F + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // UnknownDepth + { DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_UNKNOWN }, // D16 + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24 + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24S8 + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D32 + { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D16F + { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D24F + { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D32F + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) ); @@ -401,15 +390,9 @@ namespace bgfx { namespace d3d11 static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } }; static const GUID IID_ID3D11Texture2D = { 0x6f15aaf2, 0xd208, 0x4e89, { 0x9a, 0xb4, 0x48, 0x95, 0x35, 0xd3, 0x4f, 0x9c } }; - static const GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, { 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 } }; - static const GUID IID_IDXGIDevice0 = { 0x54ec77fa, 0x1377, 0x44e6, { 0x8c, 0x32, 0x88, 0xfd, 0x5f, 0x44, 0xc8, 0x4c } }; - static const GUID IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; - static const GUID IID_IDXGIDevice2 = { 0x05008617, 0xfbfd, 0x4051, { 0xa7, 0x90, 0x14, 0x48, 0x84, 0xb4, 0xf6, 0xa9 } }; - static const GUID IID_IDXGIDevice3 = { 0x6007896c, 0x3244, 0x4afd, { 0xbf, 0x18, 0xa6, 0xd3, 0xbe, 0xda, 0x50, 0x23 } }; static const GUID IID_ID3D11Device1 = { 0xa04bfb29, 0x08ef, 0x43d6, { 0xa4, 0x9c, 0xa9, 0xbd, 0xbd, 0xcb, 0xe6, 0x86 } }; static const GUID IID_ID3D11Device2 = { 0x9d06dffa, 0xd1e5, 0x4d07, { 0x83, 0xa8, 0x1b, 0xb1, 0x23, 0xf2, 0xf8, 0x41 } }; static const GUID IID_ID3D11Device3 = { 0xa05c8c37, 0xd2c6, 0x4732, { 0xb3, 0xa0, 0x9c, 0xe0, 0xb0, 0xdc, 0x9a, 0xe6 } }; - static const GUID IID_IDXGIAdapter = { 0x2411e7e1, 0x12ac, 0x4ccf, { 0xbd, 0x14, 0x97, 0x98, 0xe8, 0x53, 0x4d, 0xc0 } }; static const GUID IID_ID3D11InfoQueue = { 0x6543dbb6, 0x1b48, 0x42f5, { 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6 } }; static const GUID IID_IDXGIDeviceRenderDoc = { 0xa7aa6116, 0x9c8d, 0x4bba, { 0x90, 0x83, 0xb4, 0xd8, 0x16, 0xb7, 0x1b, 0x78 } }; static const GUID IID_ID3DUserDefinedAnnotation = { 0xb2daad8b, 0x03d4, 0x4dbf, { 0x95, 0xeb, 0x32, 0xab, 0x4b, 0x63, 0xd0, 0xab } }; @@ -427,14 +410,6 @@ namespace bgfx { namespace d3d11 IID_ID3D11Device1, }; - static const GUID s_dxgiDeviceIIDs[] = - { - IID_IDXGIDevice3, - IID_IDXGIDevice2, - IID_IDXGIDevice1, - IID_IDXGIDevice0, - }; - inline bool isLost(HRESULT _hr) { return false @@ -493,12 +468,10 @@ namespace bgfx { namespace d3d11 BX_PRAGMA_DIAGNOSTIC_POP(); - static BX_NO_INLINE bool getIntelExtensions(ID3D11Device* _device) + static HRESULT setIntelExtension(ID3D11Device* _device, const void* _data, uint32_t _size) { - uint8_t temp[28]; - D3D11_BUFFER_DESC desc; - desc.ByteWidth = sizeof(temp); + desc.ByteWidth = _size; desc.Usage = D3D11_USAGE_STAGING; desc.BindFlags = 0; desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; @@ -506,37 +479,73 @@ namespace bgfx { namespace d3d11 desc.StructureByteStride = 0; D3D11_SUBRESOURCE_DATA initData; - initData.pSysMem = &temp; - initData.SysMemPitch = sizeof(temp); + initData.pSysMem = _data; + initData.SysMemPitch = _size; initData.SysMemSlicePitch = 0; - bx::StaticMemoryBlockWriter writer(&temp, sizeof(temp) ); - bx::write(&writer, "INTCEXTNCAPSFUNC", 16); - bx::write(&writer, UINT32_C(0x00010000) ); - bx::write(&writer, UINT32_C(0) ); - bx::write(&writer, UINT32_C(0) ); - ID3D11Buffer* buffer; HRESULT hr = _device->CreateBuffer(&desc, &initData, &buffer); if (SUCCEEDED(hr) ) { buffer->Release(); + } - bx::MemoryReader reader(&temp, sizeof(temp) ); - bx::skip(&reader, 16); + return hr; + }; - uint32_t version; - bx::read(&reader, version); + static const uint32_t kIntelExtensionInterfaceVersion = UINT32_C(0x10000); - uint32_t driverVersion; - bx::read(&reader, driverVersion); + struct IntelExtension + { + char key[16]; + uint32_t version; + uint32_t type; + uint32_t data[16]; + }; - return version <= driverVersion; + static const IntelExtension s_intelDirectAccessResource = + { + { 'I', 'N', 'T', 'C', 'E', 'X', 'T', 'N', 'R', 'E', 'S', 'O', 'U', 'R', 'C', 'E' }, + kIntelExtensionInterfaceVersion, + 1, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + }; + + static HRESULT setIntelDirectAccessResource(ID3D11Device* _device) + { + return setIntelExtension(_device, &s_intelDirectAccessResource, sizeof(s_intelDirectAccessResource) ); + } + + static BX_NO_INLINE bool getIntelExtensions(ID3D11Device* _device) + { + if (windowsVersionIs(Condition::GreaterEqual, 0x0604) ) + { + uint8_t temp[28]; + + bx::StaticMemoryBlockWriter writer(&temp, sizeof(temp) ); + bx::write(&writer, "INTCEXTNCAPSFUNC", 16); + bx::write(&writer, kIntelExtensionInterfaceVersion); + bx::write(&writer, UINT32_C(0) ); + bx::write(&writer, UINT32_C(0) ); + + if (SUCCEEDED(setIntelExtension(_device, temp, sizeof(temp) ) ) ) + { + bx::MemoryReader reader(&temp, sizeof(temp) ); + bx::skip(&reader, 16); + + uint32_t version; + bx::read(&reader, version); + + uint32_t driverVersion; + bx::read(&reader, driverVersion); + + return version <= driverVersion; + } } return false; - }; + } void resume(ID3D11Device* _device) { @@ -548,26 +557,11 @@ namespace bgfx { namespace d3d11 BX_UNUSED(_device); } - void trim(ID3D11Device* _device) - { -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT - IDXGIDevice3* device; - HRESULT hr = _device->QueryInterface(IID_IDXGIDevice3, (void**)&device); - if (SUCCEEDED(hr) ) - { - device->Trim(); - DX_RELEASE(device, 1); - } -#else - BX_UNUSED(_device); -#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT - } - /* * AMD GPU Services (AGS) library * - * Reference: - * https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK + * Reference(s): + * - https://web.archive.org/web/20181126035805/https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK */ enum AGS_RETURN_CODE { @@ -627,60 +621,32 @@ namespace bgfx { namespace d3d11 void amdAgsMultiDrawInstancedIndirect(uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride); void amdAgsMultiDrawIndexedInstancedIndirect(uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride); + void nvapiMultiDrawInstancedIndirect(uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride); + void nvapiMultiDrawIndexedInstancedIndirect(uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride); + static MultiDrawIndirectFn multiDrawInstancedIndirect; static MultiDrawIndirectFn multiDrawIndexedInstancedIndirect; #if USE_D3D11_DYNAMIC_LIB static PFN_D3D11_CREATE_DEVICE D3D11CreateDevice; - static PFN_CREATE_DXGI_FACTORY CreateDXGIFactory; static PFN_D3DPERF_SET_MARKER D3DPERF_SetMarker; static PFN_D3DPERF_BEGIN_EVENT D3DPERF_BeginEvent; static PFN_D3DPERF_END_EVENT D3DPERF_EndEvent; - static PFN_GET_DEBUG_INTERFACE DXGIGetDebugInterface; - static PFN_GET_DEBUG_INTERFACE1 DXGIGetDebugInterface1; #endif // USE_D3D11_DYNAMIC_LIB int WINAPI d3d11Annotation_BeginEvent(DWORD _color, LPCWSTR _name); int WINAPI d3d11Annotation_EndEvent(); void WINAPI d3d11Annotation_SetMarker(DWORD _color, LPCWSTR _name); -#if BGFX_CONFIG_USE_OVR - class VRImplOVRD3D11 : public VRImplOVR - { - public: - VRImplOVRD3D11(); - - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override; - virtual void destroySwapChain() override; - virtual void destroyMirror() override; - virtual void makeRenderTargetActive(const VRDesc& _desc) override; - virtual bool submitSwapChain(const VRDesc& _desc) override; - - private: - ID3D11DepthStencilView* m_depthBuffer; - ID3D11RenderTargetView* m_eyeRtv[4]; - ID3D11RenderTargetView* m_msaaRtv; - ID3D11Texture2D* m_msaaTexture; - - ovrTextureSwapChain m_textureSwapChain; - ovrMirrorTexture m_mirrorTexture; - }; -#endif // BGFX_CONFIG_USE_OVR - struct RendererContextD3D11 : public RendererContextI { RendererContextD3D11() - : m_d3d9dll(NULL) - , m_d3d11dll(NULL) - , m_dxgidll(NULL) - , m_dxgidebugdll(NULL) - , m_renderdocdll(NULL) - , m_agsdll(NULL) + : m_d3d9Dll(NULL) + , m_d3d11Dll(NULL) + , m_renderDocDll(NULL) + , m_agsDll(NULL) , m_ags(NULL) - , m_driverType(D3D_DRIVER_TYPE_NULL) , m_featureLevel(D3D_FEATURE_LEVEL(0) ) - , m_adapter(NULL) - , m_factory(NULL) , m_swapChain(NULL) , m_lost(false) , m_numWindows(0) @@ -702,9 +668,9 @@ namespace bgfx { namespace d3d11 , m_fsChanges(0) , m_rtMsaa(false) , m_timerQuerySupport(false) + , m_directAccessSupport(false) { m_fbh.idx = kInvalidHandle; - bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); bx::memSet(&m_scd, 0, sizeof(m_scd) ); bx::memSet(&m_windows, 0xff, sizeof(m_windows) ); } @@ -713,7 +679,7 @@ namespace bgfx { namespace d3d11 { } - bool init() + bool init(const Init& _init) { struct ErrorState { @@ -722,22 +688,15 @@ namespace bgfx { namespace d3d11 Default, LoadedD3D11, LoadedDXGI, - CreatedDXGIFactory, }; }; ErrorState::Enum errorState = ErrorState::Default; - // Must be before device creation, and before RenderDoc. - VRImplI* vrImpl = NULL; -#if BGFX_CONFIG_USE_OVR - vrImpl = &m_ovrRender; -#endif // BGFX_CONFIG_USE_OVR - m_ovr.init(vrImpl); - - if (!m_ovr.isInitialized() ) + if (_init.debug + || _init.profile) { - m_renderdocdll = loadRenderDoc(); + m_renderDocDll = loadRenderDoc(); } m_fbh.idx = kInvalidHandle; @@ -745,25 +704,25 @@ namespace bgfx { namespace d3d11 bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); m_ags = NULL; - m_agsdll = bx::dlopen( + m_agsDll = bx::dlopen( #if BX_ARCH_32BIT "amd_ags_x86.dll" #else "amd_ags_x64.dll" #endif // BX_ARCH_32BIT ); - if (NULL != m_agsdll) + if (NULL != m_agsDll) { - agsInit = (PFN_AGS_INIT )bx::dlsym(m_agsdll, "agsInit"); - agsDeInit = (PFN_AGS_DEINIT)bx::dlsym(m_agsdll, "agsDeInit"); - agsGetCrossfireGPUCount = (PFN_AGS_GET_CROSSFIRE_GPU_COUNT )bx::dlsym(m_agsdll, "agsGetCrossfireGPUCount"); - agsGetTotalGPUCount = (PFN_AGS_GET_TOTAL_GPU_COUNT )bx::dlsym(m_agsdll, "agsGetTotalGPUCount"); - agsGetGPUMemorySize = (PFN_AGS_GET_GPU_MEMORY_SIZE )bx::dlsym(m_agsdll, "agsGetGPUMemorySize"); - agsGetDriverVersionInfo = (PFN_AGS_GET_DRIVER_VERSION_INFO )bx::dlsym(m_agsdll, "agsGetDriverVersionInfo"); - agsDriverExtensions_Init = (PFN_AGS_DRIVER_EXTENSIONS_INIT )bx::dlsym(m_agsdll, "agsDriverExtensions_Init"); - agsDriverExtensions_DeInit = (PFN_AGS_DRIVER_EXTENSIONS_DEINIT)bx::dlsym(m_agsdll, "agsDriverExtensions_DeInit"); - agsDriverExtensions_MultiDrawInstancedIndirect = (PFN_AGS_DRIVER_EXTENSIONS_MULTIDRAW_INSTANCED_INDIRECT )bx::dlsym(m_agsdll, "agsDriverExtensions_MultiDrawInstancedIndirect"); - agsDriverExtensions_MultiDrawIndexedInstancedIndirect = (PFN_AGS_DRIVER_EXTENSIONS_MULTIDRAW_INDEXED_INSTANCED_INDIRECT)bx::dlsym(m_agsdll, "agsDriverExtensions_MultiDrawIndexedInstancedIndirect"); + agsInit = (PFN_AGS_INIT )bx::dlsym(m_agsDll, "agsInit"); + agsDeInit = (PFN_AGS_DEINIT)bx::dlsym(m_agsDll, "agsDeInit"); + agsGetCrossfireGPUCount = (PFN_AGS_GET_CROSSFIRE_GPU_COUNT )bx::dlsym(m_agsDll, "agsGetCrossfireGPUCount"); + agsGetTotalGPUCount = (PFN_AGS_GET_TOTAL_GPU_COUNT )bx::dlsym(m_agsDll, "agsGetTotalGPUCount"); + agsGetGPUMemorySize = (PFN_AGS_GET_GPU_MEMORY_SIZE )bx::dlsym(m_agsDll, "agsGetGPUMemorySize"); + agsGetDriverVersionInfo = (PFN_AGS_GET_DRIVER_VERSION_INFO )bx::dlsym(m_agsDll, "agsGetDriverVersionInfo"); + agsDriverExtensions_Init = (PFN_AGS_DRIVER_EXTENSIONS_INIT )bx::dlsym(m_agsDll, "agsDriverExtensions_Init"); + agsDriverExtensions_DeInit = (PFN_AGS_DRIVER_EXTENSIONS_DEINIT)bx::dlsym(m_agsDll, "agsDriverExtensions_DeInit"); + agsDriverExtensions_MultiDrawInstancedIndirect = (PFN_AGS_DRIVER_EXTENSIONS_MULTIDRAW_INSTANCED_INDIRECT )bx::dlsym(m_agsDll, "agsDriverExtensions_MultiDrawInstancedIndirect"); + agsDriverExtensions_MultiDrawIndexedInstancedIndirect = (PFN_AGS_DRIVER_EXTENSIONS_MULTIDRAW_INDEXED_INSTANCED_INDIRECT)bx::dlsym(m_agsDll, "agsDriverExtensions_MultiDrawIndexedInstancedIndirect"); bool agsSupported = true && NULL != agsInit @@ -819,17 +778,17 @@ namespace bgfx { namespace d3d11 m_ags = NULL; } - bx::dlclose(m_agsdll); - m_agsdll = NULL; + bx::dlclose(m_agsDll); + m_agsDll = NULL; } } m_nvapi.init(); #if USE_D3D11_DYNAMIC_LIB - m_d3d11dll = bx::dlopen("d3d11.dll"); + m_d3d11Dll = bx::dlopen("d3d11.dll"); - if (NULL == m_d3d11dll) + if (NULL == m_d3d11Dll) { BX_TRACE("Init error: Failed to load d3d11.dll."); goto error; @@ -837,18 +796,18 @@ namespace bgfx { namespace d3d11 errorState = ErrorState::LoadedD3D11; - m_d3d9dll = NULL; + m_d3d9Dll = NULL; if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { // D3D11_1.h has ID3DUserDefinedAnnotation // http://msdn.microsoft.com/en-us/library/windows/desktop/hh446881%28v=vs.85%29.aspx - m_d3d9dll = bx::dlopen("d3d9.dll"); - if (NULL != m_d3d9dll) + m_d3d9Dll = bx::dlopen("d3d9.dll"); + if (NULL != m_d3d9Dll) { - D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker" ); - D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9dll, "D3DPERF_BeginEvent"); - D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9dll, "D3DPERF_EndEvent" ); + D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9Dll, "D3DPERF_SetMarker" ); + D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9Dll, "D3DPERF_BeginEvent"); + D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9Dll, "D3DPERF_EndEvent" ); BX_CHECK(NULL != D3DPERF_SetMarker && NULL != D3DPERF_BeginEvent && NULL != D3DPERF_EndEvent @@ -857,136 +816,28 @@ namespace bgfx { namespace d3d11 } } - D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)bx::dlsym(m_d3d11dll, "D3D11CreateDevice"); + D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)bx::dlsym(m_d3d11Dll, "D3D11CreateDevice"); if (NULL == D3D11CreateDevice) { BX_TRACE("Init error: Function D3D11CreateDevice not found."); goto error; } +#endif // USE_D3D11_DYNAMIC_LIB - m_dxgidll = bx::dlopen("dxgi.dll"); - if (NULL == m_dxgidll) + m_device = (ID3D11Device*)g_platformData.context; + + if (!m_dxgi.init(g_caps) ) { - BX_TRACE("Init error: Failed to load dxgi.dll."); goto error; } errorState = ErrorState::LoadedDXGI; - CreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgidll, "CreateDXGIFactory1"); - if (NULL == CreateDXGIFactory) - { - CreateDXGIFactory = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgidll, "CreateDXGIFactory"); - } - if (NULL == CreateDXGIFactory) - { - BX_TRACE("Init error: Function CreateDXGIFactory not found."); - goto error; - } - - m_dxgidebugdll = bx::dlopen("dxgidebug.dll"); - if (NULL != m_dxgidebugdll) - { - DXGIGetDebugInterface = (PFN_GET_DEBUG_INTERFACE )bx::dlsym(m_dxgidebugdll, "DXGIGetDebugInterface"); - DXGIGetDebugInterface1 = (PFN_GET_DEBUG_INTERFACE1)bx::dlsym(m_dxgidebugdll, "DXGIGetDebugInterface1"); - if (NULL == DXGIGetDebugInterface - && NULL == DXGIGetDebugInterface1) - { - bx::dlclose(m_dxgidebugdll); - m_dxgidebugdll = NULL; - } - else - { - // Figure out how to access IDXGIInfoQueue on pre Win8... - } - } -#endif // USE_D3D11_DYNAMIC_LIB - - HRESULT hr; - IDXGIFactory* factory; -#if BX_PLATFORM_WINRT - // WinRT requires the IDXGIFactory2 interface, which isn't supported on older platforms - hr = CreateDXGIFactory1(__uuidof(IDXGIFactory2), (void**)&factory); -#elif BX_PLATFORM_WINDOWS - hr = CreateDXGIFactory(IID_IDXGIFactory, (void**)&factory); -#else - hr = S_OK; - factory = NULL; -#endif // BX_PLATFORM_* - if (FAILED(hr) ) - { - BX_TRACE("Init error: Unable to create DXGI factory."); - goto error; - } - - errorState = ErrorState::CreatedDXGIFactory; - - m_device = (ID3D11Device*)g_platformData.context; - if (NULL == m_device) { - m_adapter = NULL; - m_driverType = BGFX_PCI_ID_SOFTWARE_RASTERIZER == g_caps.vendorId - ? D3D_DRIVER_TYPE_WARP - : D3D_DRIVER_TYPE_HARDWARE - ; - - if (NULL != factory) + if (NULL != m_renderDocDll) { - IDXGIAdapter* adapter; - for (uint32_t ii = 0 - ; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters(ii, &adapter) && ii < BX_COUNTOF(g_caps.gpu) - ; ++ii - ) - { - DXGI_ADAPTER_DESC desc; - hr = adapter->GetDesc(&desc); - if (SUCCEEDED(hr) ) - { - BX_TRACE("Adapter #%d", ii); - - char description[BX_COUNTOF(desc.Description)]; - wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); - BX_TRACE("\tDescription: %s", description); - BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x" - , desc.VendorId - , desc.DeviceId - , desc.SubSysId - , desc.Revision - ); - BX_TRACE("\tMemory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)" - , desc.DedicatedVideoMemory - , desc.DedicatedSystemMemory - , desc.SharedSystemMemory - ); - - g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; - g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; - ++g_caps.numGPUs; - - if (NULL == m_adapter) - { - if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) - && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) - && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) - { - m_adapter = adapter; - m_adapter->AddRef(); - m_driverType = D3D_DRIVER_TYPE_UNKNOWN; - } - - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != bx::strFind(description, "PerfHUD") ) - { - m_adapter = adapter; - m_driverType = D3D_DRIVER_TYPE_REFERENCE; - } - } - } - - DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0); - } - DX_RELEASE(factory, NULL != m_adapter ? 1 : 0); + setGraphicsDebuggerPresent(true); } D3D_FEATURE_LEVEL featureLevel[] = @@ -1003,20 +854,22 @@ namespace bgfx { namespace d3d11 #endif // BX_PLATFORM_WINRT }; + HRESULT hr = S_OK; + for (;;) { uint32_t flags = 0 | D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_BGRA_SUPPORT // | D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS - | (BX_ENABLED(BGFX_CONFIG_DEBUG) ? D3D11_CREATE_DEVICE_DEBUG : 0) + | (_init.debug ? D3D11_CREATE_DEVICE_DEBUG : 0) ; hr = E_FAIL; for (uint32_t ii = 0; ii < BX_COUNTOF(featureLevel) && FAILED(hr);) { - hr = D3D11CreateDevice(m_adapter - , m_driverType + hr = D3D11CreateDevice(m_dxgi.m_adapter + , m_dxgi.m_driverType , NULL , flags , &featureLevel[ii] @@ -1045,10 +898,10 @@ namespace bgfx { namespace d3d11 } if (FAILED(hr) - && D3D_DRIVER_TYPE_WARP != m_driverType) + && D3D_DRIVER_TYPE_WARP != m_dxgi.m_driverType) { // Try with WARP - m_driverType = D3D_DRIVER_TYPE_WARP; + m_dxgi.m_driverType = D3D_DRIVER_TYPE_WARP; continue; } @@ -1060,11 +913,6 @@ namespace bgfx { namespace d3d11 BX_TRACE("Init error: Unable to create Direct3D11 device."); goto error; } - - if (NULL != m_adapter) - { - DX_RELEASE(m_adapter, 2); - } } else { @@ -1079,12 +927,14 @@ namespace bgfx { namespace d3d11 m_featureLevel = m_device->GetFeatureLevel(); } + m_dxgi.update(m_device); + { m_deviceInterfaceVersion = 0; for (uint32_t ii = 0; ii < BX_COUNTOF(s_d3dDeviceIIDs); ++ii) { ID3D11Device* device; - hr = m_device->QueryInterface(s_d3dDeviceIIDs[ii], (void**)&device); + HRESULT hr = m_device->QueryInterface(s_d3dDeviceIIDs[ii], (void**)&device); if (SUCCEEDED(hr) ) { device->Release(); // BK - ignore ref count. @@ -1093,172 +943,123 @@ namespace bgfx { namespace d3d11 } } - if (NULL != m_renderdocdll) - { - // RenderDoc doesn't support ID3D11Device3 yet: - // https://github.com/baldurk/renderdoc/issues/235 - m_deviceInterfaceVersion = bx::uint32_min(m_deviceInterfaceVersion, 1); - } - - IDXGIDevice* device = NULL; - IDXGIAdapter* adapter = NULL; - hr = E_FAIL; - for (uint32_t ii = 0; ii < BX_COUNTOF(s_dxgiDeviceIIDs) && FAILED(hr); ++ii) - { - hr = m_device->QueryInterface(s_dxgiDeviceIIDs[ii], (void**)&device); - BX_TRACE("DXGI device 11.%d, hr %x", BX_COUNTOF(s_dxgiDeviceIIDs)-1-ii, hr); - + { /// + IDXGIDevice* renderdoc; + HRESULT hr = m_device->QueryInterface(IID_IDXGIDeviceRenderDoc, (void**)&renderdoc); if (SUCCEEDED(hr) ) { -#if BX_COMPILER_MSVC -BX_PRAGMA_DIAGNOSTIC_PUSH(); -BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4530) // warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc - try - { - // QueryInterface above can succeed, but getting adapter call might crash on Win7. - hr = device->GetAdapter(&adapter); - } - catch (...) - { - BX_TRACE("Failed to get adapter foro IID_IDXGIDevice%d.", BX_COUNTOF(s_dxgiDeviceIIDs)-1-ii); - DX_RELEASE(device, 0); - hr = E_FAIL; - } -BX_PRAGMA_DIAGNOSTIC_POP(); -#else - hr = device->GetAdapter(&adapter); -#endif // BX_COMPILER_MSVC - } - } - - if (FAILED(hr) ) - { - BX_TRACE("Init error: Unable to create Direct3D11 device."); - goto error; - } - - // GPA increases device ref count. - // RenderDoc makes device ref count 0 here. - // - // This causes assert in debug. When debugger is present refcount - // checks are off. - IDXGIDevice* renderdoc; - hr = m_device->QueryInterface(IID_IDXGIDeviceRenderDoc, (void**)&renderdoc); - if (SUCCEEDED(hr) ) - { - setGraphicsDebuggerPresent(true); - DX_RELEASE(renderdoc, 2); - } - else - { - setGraphicsDebuggerPresent(3 != getRefCount(device) ); - DX_RELEASE(device, 2); - } - - bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); - hr = adapter->GetDesc(&m_adapterDesc); - BX_WARN(SUCCEEDED(hr), "Adapter GetDesc failed 0x%08x.", hr); - - g_caps.vendorId = 0 == m_adapterDesc.VendorId - ? BGFX_PCI_ID_SOFTWARE_RASTERIZER - : (uint16_t)m_adapterDesc.VendorId - ; - g_caps.deviceId = (uint16_t)m_adapterDesc.DeviceId; - - if (NULL == g_platformData.backBuffer) - { -#if !BX_PLATFORM_WINDOWS - hr = adapter->GetParent(__uuidof(IDXGIFactory2), (void**)&m_factory); - DX_RELEASE(adapter, 2); - if (FAILED(hr) ) - { - BX_TRACE("Init error: Unable to create Direct3D11 device."); - goto error; - } - - bx::memSet(&m_scd, 0, sizeof(m_scd) ); - m_scd.Width = BGFX_DEFAULT_WIDTH; - m_scd.Height = BGFX_DEFAULT_HEIGHT; - m_scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - m_scd.Stereo = false; - m_scd.SampleDesc.Count = 1; - m_scd.SampleDesc.Quality = 0; - m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - m_scd.BufferCount = 2; - m_scd.Scaling = 0 == g_platformData.ndt - ? DXGI_SCALING_NONE - : DXGI_SCALING_STRETCH; - m_scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; - m_scd.AlphaMode = DXGI_ALPHA_MODE_IGNORE; - - if (NULL == g_platformData.ndt) - { - hr = m_factory->CreateSwapChainForCoreWindow(m_device - , (::IUnknown*)g_platformData.nwh - , &m_scd - , NULL - , &m_swapChain - ); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain."); + setGraphicsDebuggerPresent(true); + DX_RELEASE(renderdoc, 2); } else { - BGFX_FATAL(g_platformData.ndt == reinterpret_cast(1), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - hr = m_factory->CreateSwapChainForComposition(m_device - , &m_scd - , NULL - , &m_swapChain - ); - BX_WARN(SUCCEEDED(hr), "Unable to create Direct3D11 swap chain."); - -# if BX_PLATFORM_WINRT - IInspectable* nativeWindow = reinterpret_cast(g_platformData.nwh); - ISwapChainBackgroundPanelNative* panel = NULL; - hr = nativeWindow->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void**)&panel); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - if (NULL != panel) - { - hr = panel->SetSwapChain(m_swapChain); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - panel->Release(); - } -# endif // BX_PLATFORM_WINRT + IUnknown* device = m_device; + setGraphicsDebuggerPresent(2 != getRefCount(device) ); } + } + + if (BGFX_PCI_ID_NVIDIA != m_dxgi.m_adapterDesc.VendorId) + { + m_nvapi.shutdown(); + } + + if (NULL == g_platformData.backBuffer) + { + HRESULT hr = S_OK; + + m_swapEffect = +#if BX_PLATFORM_WINDOWS + DXGI_SWAP_EFFECT_FLIP_DISCARD #else - hr = adapter->GetParent(IID_IDXGIFactory, (void**)&m_factory); - DX_RELEASE(adapter, 2); - if (FAILED(hr) ) - { - BX_TRACE("Init error: Unable to create Direct3D11 device."); - goto error; - } + DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL +#endif // !BX_PLATFORM_WINDOWS + ; + + m_swapBufferCount = bx::clamp(_init.resolution.numBackBuffers, 2, BGFX_CONFIG_MAX_BACK_BUFFERS); bx::memSet(&m_scd, 0, sizeof(m_scd) ); - m_scd.BufferDesc.Width = BGFX_DEFAULT_WIDTH; - m_scd.BufferDesc.Height = BGFX_DEFAULT_HEIGHT; - m_scd.BufferDesc.RefreshRate.Numerator = 60; - m_scd.BufferDesc.RefreshRate.Denominator = 1; - m_scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - m_scd.SampleDesc.Count = 1; - m_scd.SampleDesc.Quality = 0; - m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - m_scd.BufferCount = 1; - m_scd.OutputWindow = (HWND)g_platformData.nwh; - m_scd.Windowed = true; + m_scd.width = _init.resolution.width; + m_scd.height = _init.resolution.height; + m_scd.format = s_textureFormat[_init.resolution.format].m_fmt; - hr = m_factory->CreateSwapChain(m_device - , &m_scd - , &m_swapChain - ); + updateMsaa(m_scd.format); + m_scd.sampleDesc = s_msaa[(_init.resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; - DX_CHECK(m_factory->MakeWindowAssociation( (HWND)g_platformData.nwh, 0 + m_scd.bufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + m_scd.bufferCount = m_swapBufferCount; + m_scd.scaling = 0 == g_platformData.ndt + ? DXGI_SCALING_NONE + : DXGI_SCALING_STRETCH + ; + m_scd.swapEffect = m_swapEffect; + m_scd.alphaMode = DXGI_ALPHA_MODE_IGNORE; + m_scd.flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + + m_scd.maxFrameLatency = bx::min(_init.resolution.maxFrameLatency, 3); + m_scd.nwh = g_platformData.nwh; + m_scd.ndt = g_platformData.ndt; + m_scd.windowed = true; + + m_msaaRt = NULL; + + if (NULL != m_scd.nwh) + { + hr = m_dxgi.createSwapChain(m_device + , m_scd + , &m_swapChain + ); + + if (FAILED(hr) ) + { + // DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL is not available on win7 + // Try again with DXGI_SWAP_EFFECT_DISCARD + m_swapEffect = DXGI_SWAP_EFFECT_DISCARD; + m_swapBufferCount = 1; + + m_scd.bufferCount = m_swapBufferCount; + m_scd.swapEffect = m_swapEffect; + hr = m_dxgi.createSwapChain(m_device + , m_scd + , &m_swapChain + ); + + if (FAILED(hr) ) + { + BX_TRACE("Init error: Failed to create swap chain."); + goto error; + } + } + + m_resolution = _init.resolution; + m_resolution.reset = _init.resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); + + m_textVideoMem.resize(false, _init.resolution.width, _init.resolution.height); + m_textVideoMem.clear(); + + if (1 < m_scd.sampleDesc.Count) + { + D3D11_TEXTURE2D_DESC desc; + desc.Width = m_scd.width; + desc.Height = m_scd.height; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.Format = m_scd.format; + desc.SampleDesc = m_scd.sampleDesc; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_RENDER_TARGET; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; + DX_CHECK(m_device->CreateTexture2D(&desc, NULL, &m_msaaRt) ); + } + } + +#if BX_PLATFORM_WINDOWS + DX_CHECK(m_dxgi.m_factory->MakeWindowAssociation( (HWND)g_platformData.nwh, 0 | DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER ) ); -#endif // BX_PLATFORM_* +#endif // BX_PLATFORM_WINDOWS + if (FAILED(hr) ) { BX_TRACE("Init error: Failed to create swap chain."); @@ -1268,9 +1069,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); else { bx::memSet(&m_scd, 0, sizeof(m_scd) ); - m_scd.SampleDesc.Count = 1; - m_scd.SampleDesc.Quality = 0; - setBufferSize(BGFX_DEFAULT_WIDTH, BGFX_DEFAULT_HEIGHT); + m_scd.sampleDesc.Count = 1; + m_scd.sampleDesc.Quality = 0; + m_scd.width = _init.resolution.width; + m_scd.height = _init.resolution.height; m_backBufferColor = (ID3D11RenderTargetView*)g_platformData.backBuffer; m_backBufferDepthStencil = (ID3D11DepthStencilView*)g_platformData.backBufferDS; } @@ -1281,7 +1083,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #if USE_D3D11_DYNAMIC_LIB if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { - hr = m_deviceCtx->QueryInterface(IID_ID3DUserDefinedAnnotation, (void**)&m_annotation); + HRESULT hr = m_deviceCtx->QueryInterface(IID_ID3DUserDefinedAnnotation, (void**)&m_annotation); if (SUCCEEDED(hr) ) { @@ -1292,15 +1094,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } #endif // USE_D3D11_DYNAMIC_LIB - if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) + if (_init.debug) { - hr = m_device->QueryInterface(IID_ID3D11InfoQueue, (void**)&m_infoQueue); + HRESULT hr = m_device->QueryInterface(IID_ID3D11InfoQueue, (void**)&m_infoQueue); if (SUCCEEDED(hr) ) { m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true); m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, false); m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, false); + m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_INFO, false); + m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_MESSAGE, false); D3D11_INFO_QUEUE_FILTER filter; bx::memSet(&filter, 0, sizeof(filter) ); @@ -1323,8 +1127,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); filter.DenyList.pIDList = idlist; m_infoQueue->PushStorageFilter(&filter); - - DX_RELEASE(m_infoQueue, 3); } } @@ -1333,21 +1135,29 @@ BX_PRAGMA_DIAGNOSTIC_POP(); | BGFX_CAPS_TEXTURE_3D | BGFX_CAPS_VERTEX_ATTRIB_HALF | BGFX_CAPS_VERTEX_ATTRIB_UINT10 + | BGFX_CAPS_VERTEX_ID | BGFX_CAPS_FRAGMENT_DEPTH - | (getIntelExtensions(m_device) ? BGFX_CAPS_FRAGMENT_ORDERING : 0) + | (getIntelExtensions(m_device) + ? BGFX_CAPS_FRAGMENT_ORDERING + | BGFX_CAPS_TEXTURE_DIRECT_ACCESS + : 0) | BGFX_CAPS_SWAP_CHAIN - | (m_ovr.isInitialized() ? BGFX_CAPS_HMD : 0) | BGFX_CAPS_DRAW_INDIRECT | BGFX_CAPS_TEXTURE_BLIT | BGFX_CAPS_TEXTURE_READ_BACK - | ( (m_featureLevel >= D3D_FEATURE_LEVEL_9_2) ? BGFX_CAPS_OCCLUSION_QUERY : 0) + | ( (m_featureLevel >= D3D_FEATURE_LEVEL_9_2) + ? BGFX_CAPS_OCCLUSION_QUERY + : 0) | BGFX_CAPS_ALPHA_TO_COVERAGE - | ( (m_deviceInterfaceVersion >= 3) ? BGFX_CAPS_CONSERVATIVE_RASTER : 0) + | ( (m_deviceInterfaceVersion >= 3) + ? BGFX_CAPS_CONSERVATIVE_RASTER + : 0) | BGFX_CAPS_TEXTURE_2D_ARRAY | BGFX_CAPS_TEXTURE_CUBE_ARRAY ); - m_timerQuerySupport = m_featureLevel >= D3D_FEATURE_LEVEL_10_0; + m_timerQuerySupport = m_featureLevel >= D3D_FEATURE_LEVEL_10_0; + m_directAccessSupport = 0 != (g_caps.supported & BGFX_CAPS_TEXTURE_DIRECT_ACCESS); if (m_featureLevel <= D3D_FEATURE_LEVEL_9_2) { @@ -1375,8 +1185,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { + g_caps.limits.maxComputeBindings = bx::min(BGFX_MAX_COMPUTE_BINDINGS + , D3D_FEATURE_LEVEL_11_1 <= m_featureLevel + ? D3D11_1_UAV_SLOT_COUNT + : D3D11_PS_CS_UAV_REGISTER_COUNT + ); + g_caps.supported |= BGFX_CAPS_TEXTURE_COMPARE_ALL; g_caps.limits.maxTextureSize = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; + g_caps.limits.maxTextureLayers = D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION; g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min( D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS @@ -1409,7 +1226,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); }; D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS data; - hr = m_device->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &data, sizeof(data) ); + HRESULT hr = m_device->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &data, sizeof(data) ); if (SUCCEEDED(hr) && data.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x) { @@ -1434,7 +1251,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); }; D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT data; - hr = m_device->CheckFeatureSupport(D3D11_FEATURE(11) /*D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT*/, &data, sizeof(data) ); + HRESULT hr = m_device->CheckFeatureSupport(D3D11_FEATURE(11) /*D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT*/, &data, sizeof(data) ); if (SUCCEEDED(hr) && data.SimpleInstancingSupported) { @@ -1451,7 +1268,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); }; D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT data; - hr = m_device->CheckFeatureSupport(D3D11_FEATURE(9) /*D3D11_FEATURE_D3D9_SHADOW_SUPPORT*/, &data, sizeof(data) ); + HRESULT hr = m_device->CheckFeatureSupport(D3D11_FEATURE(9) /*D3D11_FEATURE_D3D9_SHADOW_SUPPORT*/, &data, sizeof(data) ); if (SUCCEEDED(hr) && data.SupportsDepthAsTextureWithLessEqualComparisonFilter) { @@ -1481,7 +1298,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_FEATURE_DATA_FORMAT_SUPPORT data; // D3D11_FEATURE_DATA_FORMAT_SUPPORT2 data.InFormat = fmt; - hr = m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) ); + HRESULT hr = m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) ); if (SUCCEEDED(hr) ) { support |= 0 != (data.OutFormatSupport & (0 @@ -1604,7 +1421,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_FEATURE_DATA_FORMAT_SUPPORT data; // D3D11_FEATURE_DATA_FORMAT_SUPPORT2 data.InFormat = fmtSrgb; - hr = m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) ); + HRESULT hr = m_device->CheckFeatureSupport(D3D11_FEATURE_FORMAT_SUPPORT, &data, sizeof(data) ); if (SUCCEEDED(hr) ) { support |= 0 != (data.OutFormatSupport & (0 @@ -1653,7 +1470,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); mbstowcs(s_viewNameW[ii], s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED); } - if (BX_ENABLED(BGFX_CONFIG_DEBUG) + if (_init.debug && NULL != m_infoQueue) { m_infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true); @@ -1685,45 +1502,52 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_ags = NULL; } } + else if (m_nvapi.isInitialized() + && NULL != m_nvapi.nvApiD3D11MultiDrawInstancedIndirect + && NULL != m_nvapi.nvApiD3D11MultiDrawIndexedInstancedIndirect) + { + multiDrawInstancedIndirect = nvapiMultiDrawInstancedIndirect; + multiDrawIndexedInstancedIndirect = nvapiMultiDrawIndexedInstancedIndirect; + } } // - updateMsaa(); + updateMsaa(m_scd.format); postReset(); } + m_nvapi.initAftermath(m_device, m_deviceCtx); + g_internalData.context = m_device; return true; error: switch (errorState) { - case ErrorState::CreatedDXGIFactory: + case ErrorState::LoadedDXGI: + DX_RELEASE(m_annotation, 1); + DX_RELEASE_W(m_infoQueue, 0); + DX_RELEASE(m_msaaRt, 0); DX_RELEASE(m_swapChain, 0); DX_RELEASE(m_deviceCtx, 0); DX_RELEASE(m_device, 0); - DX_RELEASE(m_factory, 0); #if USE_D3D11_DYNAMIC_LIB - case ErrorState::LoadedDXGI: - if (NULL != m_dxgidebugdll) + if (NULL != m_d3d9Dll) { - bx::dlclose(m_dxgidebugdll); - m_dxgidebugdll = NULL; + bx::dlclose(m_d3d9Dll); + m_d3d9Dll = NULL; } +#endif // USE_D3D11_DYNAMIC_LIB - if (NULL != m_d3d9dll) - { - bx::dlclose(m_d3d9dll); - m_d3d9dll = NULL; - } - - bx::dlclose(m_dxgidll); - m_dxgidll = NULL; + m_dxgi.shutdown(); + BX_FALLTHROUGH; +#if USE_D3D11_DYNAMIC_LIB case ErrorState::LoadedD3D11: - bx::dlclose(m_d3d11dll); - m_d3d11dll = NULL; + bx::dlclose(m_d3d11Dll); + m_d3d11Dll = NULL; + BX_FALLTHROUGH; #endif // USE_D3D11_DYNAMIC_LIB case ErrorState::Default: @@ -1736,11 +1560,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_ags = NULL; } - bx::dlclose(m_agsdll); - m_agsdll = NULL; + bx::dlclose(m_agsDll); + m_agsDll = NULL; - unloadRenderDoc(m_renderdocdll); - m_ovr.shutdown(); + unloadRenderDoc(m_renderDocDll); break; } @@ -1750,9 +1573,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void shutdown() { preReset(); - m_ovr.shutdown(); - - m_nvapi.shutdown(); if (NULL != m_ags) { @@ -1760,8 +1580,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_ags = NULL; } - bx::dlclose(m_agsdll); - m_agsdll = NULL; + bx::dlclose(m_agsDll); + m_agsDll = NULL; m_deviceCtx->ClearState(); @@ -1793,31 +1613,26 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } DX_RELEASE(m_annotation, 1); + DX_RELEASE_W(m_infoQueue, 0); + DX_RELEASE(m_msaaRt, 0); DX_RELEASE(m_swapChain, 0); DX_RELEASE(m_deviceCtx, 0); DX_RELEASE(m_device, 0); - DX_RELEASE(m_factory, 0); - unloadRenderDoc(m_renderdocdll); + m_nvapi.shutdown(); + m_dxgi.shutdown(); + + unloadRenderDoc(m_renderDocDll); #if USE_D3D11_DYNAMIC_LIB - if (NULL != m_dxgidebugdll) + if (NULL != m_d3d9Dll) { - bx::dlclose(m_dxgidebugdll); - m_dxgidebugdll = NULL; + bx::dlclose(m_d3d9Dll); + m_d3d9Dll = NULL; } - if (NULL != m_d3d9dll) - { - bx::dlclose(m_d3d9dll); - m_d3d9dll = NULL; - } - - bx::dlclose(m_dxgidll); - m_dxgidll = NULL; - - bx::dlclose(m_d3d11dll); - m_d3d11dll = NULL; + bx::dlclose(m_d3d11Dll); + m_d3d11Dll = NULL; #endif // USE_D3D11_DYNAMIC_LIB } @@ -1831,7 +1646,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return BGFX_RENDERER_DIRECT3D11_NAME; } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override + void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } @@ -1852,7 +1667,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -1867,7 +1682,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -1883,7 +1698,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -1893,7 +1708,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) override + void createShader(ShaderHandle _handle, const Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } @@ -1913,9 +1728,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override + void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override { - m_textures[_handle.idx].create(_mem, _flags, _skip); + return m_textures[_handle.idx].create(_mem, _flags, _skip); } void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override @@ -1959,7 +1774,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_deviceCtx->Unmap(texture.m_ptr, _mip); } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override { TextureD3D11& texture = m_textures[_handle.idx]; @@ -1974,7 +1789,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); tc.m_width = _width; tc.m_height = _height; tc.m_depth = 0; - tc.m_numLayers = 1; + tc.m_numLayers = _numLayers; tc.m_numMips = _numMips; tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; @@ -2013,11 +1828,21 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override { + for (uint32_t ii = 0, num = m_numWindows; ii < num; ++ii) + { + FrameBufferHandle handle = m_windows[ii]; + if (isValid(handle) + && m_frameBuffers[handle.idx].m_nwh == _nwh) + { + destroyFrameBuffer(handle); + } + } + uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; - m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); + m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat); } void destroyFrameBuffer(FrameBufferHandle _handle) override @@ -2029,8 +1854,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (m_numWindows > 1) { FrameBufferHandle handle = m_windows[m_numWindows]; - m_windows[denseIdx] = handle; - m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + m_windows[m_numWindows] = {kInvalidHandle}; + if (m_numWindows != denseIdx) + { + m_windows[denseIdx] = handle; + m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + } } } } @@ -2046,7 +1875,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void* data = BX_ALLOC(g_allocator, size); bx::memSet(data, 0, size); m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name, data); + m_uniformReg.add(_handle, _name); } void destroyUniform(UniformHandle _handle) override @@ -2173,11 +2002,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); switch (_handle.type) { case Handle::Shader: - setDebugObjectName(m_shaders[_handle.idx].m_ptr, _name); + setDebugObjectName(m_shaders[_handle.idx].m_ptr, "%s", _name); break; case Handle::Texture: - setDebugObjectName(m_textures[_handle.idx].m_ptr, _name); + setDebugObjectName(m_textures[_handle.idx].m_ptr, "%s", _name); break; default: @@ -2194,11 +2023,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { ID3D11DeviceContext* deviceCtx = m_deviceCtx; - uint32_t width = getBufferWidth(); - uint32_t height = getBufferHeight(); + const uint32_t width = m_scd.width; + const uint32_t height = m_scd.height; - FrameBufferHandle fbh = BGFX_INVALID_HANDLE; - setFrameBuffer(fbh, false, false); + setFrameBuffer(BGFX_INVALID_HANDLE, false, false); D3D11_VIEWPORT vp; vp.TopLeftX = 0; @@ -2209,8 +2037,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); vp.MaxDepth = 1.0f; deviceCtx->RSSetViewports(1, &vp); - uint64_t state = BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + uint64_t state = BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS ; @@ -2243,7 +2071,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); setShaderUniform(flags, predefined.m_loc, proj, 4); commitShaderConstants(); - m_textures[_blitter.m_texture.idx].commit(0, BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER, NULL); + m_textures[_blitter.m_texture.idx].commit(0, BGFX_SAMPLER_INTERNAL_DEFAULT, NULL); commitTextureStage(); } @@ -2266,8 +2094,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { m_needPresent = false; - ovrPreReset(); - if (m_timerQuerySupport) { m_gpuTimer.preReset(); @@ -2298,22 +2124,25 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { if (NULL != m_swapChain) { - ID3D11Texture2D* color; - DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&color) ); + ID3D11Texture2D* backBufferColor = NULL; + if (NULL == m_msaaRt) + { + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBufferColor) ); + } D3D11_RENDER_TARGET_VIEW_DESC desc; - desc.ViewDimension = (m_resolution.m_flags & BGFX_RESET_MSAA_MASK) + desc.ViewDimension = (m_resolution.reset & BGFX_RESET_MSAA_MASK) ? D3D11_RTV_DIMENSION_TEXTURE2DMS : D3D11_RTV_DIMENSION_TEXTURE2D ; desc.Texture2D.MipSlice = 0; - desc.Format = (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) - ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB - : DXGI_FORMAT_R8G8B8A8_UNORM + desc.Format = (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) + ? m_scd.format == DXGI_FORMAT_R8G8B8A8_UNORM ? DXGI_FORMAT_R8G8B8A8_UNORM_SRGB : m_scd.format + : m_scd.format ; - DX_CHECK(m_device->CreateRenderTargetView(color, &desc, &m_backBufferColor) ); - DX_RELEASE(color, 0); + DX_CHECK(m_device->CreateRenderTargetView(NULL == m_msaaRt ? backBufferColor : m_msaaRt, &desc, &m_backBufferColor) ); + DX_RELEASE(backBufferColor, 0); } if (m_timerQuerySupport) @@ -2322,18 +2151,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } m_occlusionQuery.postReset(); - ovrPostReset(); - - // If OVR doesn't create separate depth stencil view, create default one. - if (!m_ovr.isEnabled() && NULL == m_backBufferDepthStencil) + if (NULL == m_backBufferDepthStencil) { D3D11_TEXTURE2D_DESC dsd; - dsd.Width = getBufferWidth(); - dsd.Height = getBufferHeight(); + dsd.Width = m_scd.width; + dsd.Height = m_scd.height; dsd.MipLevels = 1; dsd.ArraySize = 1; dsd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - dsd.SampleDesc = m_scd.SampleDesc; + dsd.SampleDesc = m_scd.sampleDesc; dsd.Usage = D3D11_USAGE_DEFAULT; dsd.BindFlags = D3D11_BIND_DEPTH_STENCIL; dsd.CPUAccessFlags = 0; @@ -2345,16 +2171,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(depthStencil, 0); } - if (m_ovr.isEnabled() ) - { - m_ovr.makeRenderTargetActive(); - } - else - { - m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil); - } + m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil); - m_currentColor = m_backBufferColor; + m_currentColor = m_backBufferColor; m_currentDepthStencil = m_backBufferDepthStencil; for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) @@ -2370,15 +2189,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return m_lost; } - void flip(HMD& _hmd) override + void flip() override { - if (NULL != m_swapChain - && !m_lost) + if (!m_lost) { HRESULT hr = S_OK; uint32_t syncInterval = BX_ENABLED(!BX_PLATFORM_WINDOWS) ? 1 // sync interval of 0 is not supported on WinRT - : !!(m_resolution.m_flags & BGFX_RESET_VSYNC) + : !!(m_resolution.reset & BGFX_RESET_VSYNC) ; for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii) @@ -2388,15 +2206,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (SUCCEEDED(hr) ) { - if (m_needPresent) + if (NULL != m_swapChain + && m_needPresent) { - m_ovr.flip(); - m_ovr.swap(_hmd); - - if (!m_ovr.isEnabled() ) - { - hr = m_swapChain->Present(syncInterval, 0); - } + hr = m_swapChain->Present(syncInterval, 0); m_needPresent = false; } @@ -2429,25 +2242,22 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void invalidateCompute() { + const uint32_t maxComputeBindings = g_caps.limits.maxComputeBindings; + const uint32_t maxTextureSamplers = g_caps.limits.maxTextureSamplers; + m_deviceCtx->CSSetShader(NULL, NULL, 0); - - ID3D11UnorderedAccessView* uav[BGFX_MAX_COMPUTE_BINDINGS] = {}; - m_deviceCtx->CSSetUnorderedAccessViews(0, BX_COUNTOF(uav), uav, NULL); - - ID3D11ShaderResourceView* srv[BGFX_MAX_COMPUTE_BINDINGS] = {}; - m_deviceCtx->CSSetShaderResources(0, BX_COUNTOF(srv), srv); - - ID3D11SamplerState* samplers[BGFX_MAX_COMPUTE_BINDINGS] = {}; - m_deviceCtx->CSSetSamplers(0, BX_COUNTOF(samplers), samplers); + m_deviceCtx->CSSetUnorderedAccessViews(0, maxComputeBindings, s_zero.m_uav, NULL); + m_deviceCtx->CSSetShaderResources(0, maxTextureSamplers, s_zero.m_srv); + m_deviceCtx->CSSetSamplers(0, maxTextureSamplers, s_zero.m_sampler); } - void updateMsaa() + void updateMsaa(DXGI_FORMAT _format) const { for (uint32_t ii = 1, last = 0; ii < BX_COUNTOF(s_msaa); ++ii) { uint32_t msaa = s_checkMsaa[ii]; uint32_t quality = 0; - HRESULT hr = m_device->CheckMultisampleQualityLevels(getBufferFormat(), msaa, &quality); + HRESULT hr = m_device->CheckMultisampleQualityLevels(_format, msaa, &quality); if (SUCCEEDED(hr) && 0 < quality) @@ -2465,8 +2275,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bool updateResolution(const Resolution& _resolution) { - const bool suspended = !!( _resolution.m_flags & BGFX_RESET_SUSPEND); - const bool wasSuspended = !!(m_resolution.m_flags & BGFX_RESET_SUSPEND); + const bool suspended = !!( _resolution.reset & BGFX_RESET_SUSPEND); + const bool wasSuspended = !!(m_resolution.reset & BGFX_RESET_SUSPEND); if (suspended && wasSuspended) { return true; @@ -2475,21 +2285,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { m_deviceCtx->Flush(); m_deviceCtx->ClearState(); - trim(m_device); + m_dxgi.trim(); suspend(m_device); - m_resolution.m_flags |= BGFX_RESET_SUSPEND; + m_resolution.reset |= BGFX_RESET_SUSPEND; return true; } else if (wasSuspended) { resume(m_device); - m_resolution.m_flags &= ~BGFX_RESET_SUSPEND; + m_resolution.reset &= ~BGFX_RESET_SUSPEND; } - bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER); - uint32_t maxAnisotropy = 1; - if (!!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) ) + if (!!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) ) { maxAnisotropy = (m_featureLevel == D3D_FEATURE_LEVEL_9_1) ? D3D_FL9_1_DEFAULT_MAX_ANISOTROPY @@ -2504,7 +2312,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } bool depthClamp = true - && !!(_resolution.m_flags & BGFX_RESET_DEPTH_CLAMP) + && !!(_resolution.reset & BGFX_RESET_DEPTH_CLAMP) && m_featureLevel > D3D_FEATURE_LEVEL_9_3 // disabling depth clamp is only supported on 10_0+ ; @@ -2515,30 +2323,32 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } const uint32_t maskFlags = ~(0 - | BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP | BGFX_RESET_SUSPEND ); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height + || m_resolution.format != _resolution.format + || (m_resolution.reset&maskFlags) != (_resolution.reset&maskFlags) ) { - uint32_t flags = _resolution.m_flags & (~BGFX_RESET_INTERNAL_FORCE); + uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); bool resize = true && !BX_ENABLED(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) // can't use ResizeBuffers on Windows Phone - && (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK) + && (m_resolution.reset&BGFX_RESET_MSAA_MASK) == (flags&BGFX_RESET_MSAA_MASK) ; m_resolution = _resolution; - m_resolution.m_flags = flags; + m_resolution.reset = flags; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.resize(false, _resolution.width, _resolution.height); m_textVideoMem.clear(); - setBufferSize(_resolution.m_width, _resolution.m_height); + m_scd.width = _resolution.width; + m_scd.height = _resolution.height; + m_scd.format = s_textureFormat[_resolution.format].m_fmt; preReset(); @@ -2553,90 +2363,48 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { + DX_RELEASE(m_msaaRt, 0); + if (resize) { m_deviceCtx->OMSetRenderTargets(1, s_zero.m_rtv, NULL); - DX_CHECK(m_swapChain->ResizeBuffers(2 - , getBufferWidth() - , getBufferHeight() - , getBufferFormat() - , DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH - ) ); + + DX_CHECK(m_dxgi.resizeBuffers(m_swapChain, m_scd) ); } else { - updateMsaa(); - m_scd.SampleDesc = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; + updateMsaa(m_scd.format); + m_scd.sampleDesc = s_msaa[(m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; DX_RELEASE(m_swapChain, 0); - SwapChainDesc* scd = &m_scd; - SwapChainDesc swapChainScd; - if (0 != (m_resolution.m_flags & BGFX_RESET_HMD) - && m_ovr.isInitialized() ) - { - swapChainScd = m_scd; - swapChainScd.SampleDesc = s_msaa[0]; - scd = &swapChainScd; - } - -#if !BX_PLATFORM_WINDOWS - HRESULT hr = S_OK; - if (g_platformData.ndt == 0) - { - hr = m_factory->CreateSwapChainForCoreWindow(m_device - , (::IUnknown*)g_platformData.nwh - , scd - , NULL - , &m_swapChain - ); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain."); - } - else - { - BGFX_FATAL(g_platformData.ndt == reinterpret_cast(1), Fatal::UnableToInitialize, "Invalid native display type."); - - hr = m_factory->CreateSwapChainForComposition(m_device - , &m_scd - , NULL - , &m_swapChain - ); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain."); - -# if BX_PLATFORM_WINRT - IInspectable *nativeWindow = reinterpret_cast(g_platformData.nwh); - ISwapChainBackgroundPanelNative* panel = NULL; - hr = nativeWindow->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&panel); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - if (NULL != panel) - { - hr = panel->SetSwapChain(m_swapChain); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - panel->Release(); - } -# endif // BX_PLATFORM_WINRT - } -#else - HRESULT hr; - hr = m_factory->CreateSwapChain(m_device - , scd - , &m_swapChain - ); -#endif // !BX_PLATFORM_WINDOWS + HRESULT hr = m_dxgi.createSwapChain(m_device + , m_scd + , &m_swapChain + ); BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::UnableToInitialize, "Failed to create swap chain."); } + + if (1 < m_scd.sampleDesc.Count) + { + D3D11_TEXTURE2D_DESC desc; + desc.Width = m_scd.width; + desc.Height = m_scd.height; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.Format = m_scd.format; + desc.SampleDesc = m_scd.sampleDesc; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_RENDER_TARGET; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; + DX_CHECK(m_device->CreateTexture2D(&desc, NULL, &m_msaaRt) ); + } } postReset(); } - if (recenter) - { - m_ovr.recenter(); - } - return false; } @@ -2699,15 +2467,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (!isValid(_fbh) ) { - if (m_ovr.isEnabled() ) - { - m_ovr.makeRenderTargetActive(); - } - else - { - m_currentColor = m_backBufferColor; - m_currentDepthStencil = m_backBufferDepthStencil; - } + m_currentColor = m_backBufferColor; + m_currentDepthStencil = m_backBufferDepthStencil; m_deviceCtx->OMSetRenderTargets(1, &m_currentColor, m_currentDepthStencil); m_needPresent |= _needPresent; @@ -2906,16 +2667,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); drt->DestBlendAlpha = s_blendFactor[dstA][1]; drt->BlendOpAlpha = s_blendEquation[equA]; - uint8_t writeMask = (_state&BGFX_STATE_ALPHA_WRITE) - ? D3D11_COLOR_WRITE_ENABLE_ALPHA - : 0 - ; - writeMask |= (_state&BGFX_STATE_RGB_WRITE) - ? D3D11_COLOR_WRITE_ENABLE_RED - | D3D11_COLOR_WRITE_ENABLE_GREEN - | D3D11_COLOR_WRITE_ENABLE_BLUE - : 0 - ; + uint8_t writeMask = 0; + writeMask |= (_state&BGFX_STATE_WRITE_R) ? D3D11_COLOR_WRITE_ENABLE_RED : 0; + writeMask |= (_state&BGFX_STATE_WRITE_G) ? D3D11_COLOR_WRITE_ENABLE_GREEN : 0; + writeMask |= (_state&BGFX_STATE_WRITE_B) ? D3D11_COLOR_WRITE_ENABLE_BLUE : 0; + writeMask |= (_state&BGFX_STATE_WRITE_A) ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0; drt->RenderTargetWriteMask = writeMask; @@ -2984,7 +2740,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t fstencil = unpackStencil(0, _stencil); uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT; - _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK); + _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, ~BGFX_STENCIL_FUNC_REF_MASK); bx::HashMurmur2A murmur; murmur.begin(); @@ -2998,7 +2754,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); D3D11_DEPTH_STENCIL_DESC desc; bx::memSet(&desc, 0, sizeof(desc) ); desc.DepthEnable = 0 != func; - desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO; + desc.DepthWriteMask = !!(BGFX_STATE_WRITE_Z & _state) ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO; desc.DepthFunc = s_cmpFunc[func]; uint32_t bstencil = unpackStencil(1, _stencil); @@ -3100,12 +2856,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ID3D11SamplerState* getSamplerState(uint32_t _flags, const float _rgba[4]) { - const uint32_t index = (_flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT; - _flags &= BGFX_TEXTURE_SAMPLER_BITS_MASK; + const uint32_t index = (_flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; + _flags &= BGFX_SAMPLER_BITS_MASK; // Force both min+max anisotropic, can't be set individually. - _flags |= 0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) - ? BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC + _flags |= 0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC) ) + ? BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC : 0 ; @@ -3147,17 +2903,17 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (NULL == sampler) { - const uint32_t cmpFunc = (_flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT; - const uint8_t minFilter = s_textureFilter[0][(_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT]; - const uint8_t magFilter = s_textureFilter[1][(_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT]; - const uint8_t mipFilter = s_textureFilter[2][(_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT]; + const uint32_t cmpFunc = (_flags&BGFX_SAMPLER_COMPARE_MASK)>>BGFX_SAMPLER_COMPARE_SHIFT; + const uint8_t minFilter = s_textureFilter[0][(_flags&BGFX_SAMPLER_MIN_MASK)>>BGFX_SAMPLER_MIN_SHIFT]; + const uint8_t magFilter = s_textureFilter[1][(_flags&BGFX_SAMPLER_MAG_MASK)>>BGFX_SAMPLER_MAG_SHIFT]; + const uint8_t mipFilter = s_textureFilter[2][(_flags&BGFX_SAMPLER_MIP_MASK)>>BGFX_SAMPLER_MIP_SHIFT]; const uint8_t filter = 0 == cmpFunc ? 0 : D3D11_COMPARISON_FILTERING_BIT; D3D11_SAMPLER_DESC sd; sd.Filter = (D3D11_FILTER)(filter|minFilter|magFilter|mipFilter); - sd.AddressU = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; - sd.AddressV = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; - sd.AddressW = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; + sd.AddressU = s_textureAddress[(_flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT]; + sd.AddressV = s_textureAddress[(_flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT]; + sd.AddressW = s_textureAddress[(_flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT]; sd.MipLODBias = float(BGFX_CONFIG_MIP_LOD_BIAS); sd.MaxAnisotropy = m_maxAnisotropy; sd.ComparisonFunc = 0 == cmpFunc ? D3D11_COMPARISON_NEVER : s_cmpFunc[cmpFunc]; @@ -3183,55 +2939,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return _visible == (0 != _render->m_occlusion[_handle.idx]); } - DXGI_FORMAT getBufferFormat() - { -#if BX_PLATFORM_WINDOWS - return m_scd.BufferDesc.Format; -#else - return m_scd.Format; -#endif - } - - uint32_t getBufferWidth() - { -#if BX_PLATFORM_WINDOWS - return m_scd.BufferDesc.Width; -#else - return m_scd.Width; -#endif - } - - uint32_t getBufferHeight() - { -#if BX_PLATFORM_WINDOWS - return m_scd.BufferDesc.Height; -#else - return m_scd.Height; -#endif - } - - void setBufferSize(uint32_t _width, uint32_t _height) - { -#if BX_PLATFORM_WINDOWS - m_scd.BufferDesc.Width = _width; - m_scd.BufferDesc.Height = _height; -#else - m_scd.Width = _width; - m_scd.Height = _height; -#endif - } - void commitTextureStage() { + const uint32_t maxTextureSamplers = g_caps.limits.maxTextureSamplers; + // vertex texture fetch not supported on 9_1 through 9_3 if (m_featureLevel > D3D_FEATURE_LEVEL_9_3) { - m_deviceCtx->VSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_srv); - m_deviceCtx->VSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_sampler); + m_deviceCtx->VSSetShaderResources(0, maxTextureSamplers, m_textureStage.m_srv); + m_deviceCtx->VSSetSamplers(0, maxTextureSamplers, m_textureStage.m_sampler); } - m_deviceCtx->PSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_srv); - m_deviceCtx->PSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_sampler); + m_deviceCtx->PSSetShaderResources(0, maxTextureSamplers, m_textureStage.m_srv); + m_deviceCtx->PSSetSamplers(0, maxTextureSamplers, m_textureStage.m_sampler); } void invalidateTextureStage() @@ -3291,7 +3011,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return uav; } - ID3D11ShaderResourceView* getCachedSrv(TextureHandle _handle, uint8_t _mip, bool _compute = false) + ID3D11ShaderResourceView* getCachedSrv(TextureHandle _handle, uint8_t _mip, bool _compute = false, bool _stencil = false) { bx::HashMurmur2A murmur; murmur.begin(); @@ -3299,6 +3019,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); murmur.add(_mip); murmur.add(0); murmur.add(_compute); + murmur.add(_stencil); uint32_t hash = murmur.end(); IUnknown** ptr = m_srvUavLru.find(hash); @@ -3311,16 +3032,30 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const bool msaaSample = 1 < msaa.Count && 0 != (texture.m_flags&BGFX_TEXTURE_MSAA_SAMPLE); D3D11_SHADER_RESOURCE_VIEW_DESC desc; - desc.Format = texture.getSrvFormat(); + desc.Format = _stencil ? DXGI_FORMAT_X24_TYPELESS_G8_UINT : texture.getSrvFormat(); switch (texture.m_type) { case TextureD3D11::Texture2D: - desc.ViewDimension = msaaSample - ? D3D11_SRV_DIMENSION_TEXTURE2DMS - : D3D11_SRV_DIMENSION_TEXTURE2D - ; - desc.Texture2D.MostDetailedMip = _mip; - desc.Texture2D.MipLevels = 1; + if (1 < texture.m_depth) + { + desc.ViewDimension = msaaSample + ? D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY + : D3D11_SRV_DIMENSION_TEXTURE2DARRAY + ; + desc.Texture2DArray.MostDetailedMip = _mip; + desc.Texture2DArray.MipLevels = 1; + desc.Texture2DArray.FirstArraySlice = 0; + desc.Texture2DArray.ArraySize = texture.m_depth; + } + else + { + desc.ViewDimension = msaaSample + ? D3D11_SRV_DIMENSION_TEXTURE2DMS + : D3D11_SRV_DIMENSION_TEXTURE2D + ; + desc.Texture2D.MostDetailedMip = _mip; + desc.Texture2D.MipLevels = 1; + } break; case TextureD3D11::TextureCube: @@ -3359,27 +3094,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); return srv; } - void ovrPostReset() - { -#if BGFX_CONFIG_USE_OVR - if (m_resolution.m_flags & (BGFX_RESET_HMD|BGFX_RESET_HMD_DEBUG) ) - { - const uint32_t msaaSamples = 1 << ((m_resolution.m_flags&BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT); - m_ovr.postReset(msaaSamples, m_resolution.m_width, m_resolution.m_height); - } -#endif // BGFX_CONFIG_USE_OVR - } - - void ovrPreReset() - { -#if BGFX_CONFIG_USE_OVR - m_ovr.preReset(); -#endif // BGFX_CONFIG_USE_OVR - } - void capturePostReset() { - if (m_resolution.m_flags&BGFX_RESET_CAPTURE) + if (m_resolution.reset&BGFX_RESET_CAPTURE) { ID3D11Texture2D* backBuffer; DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBuffer) ); @@ -3436,7 +3153,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { - m_deviceCtx->ResolveSubresource(m_captureResolve, 0, backBuffer, 0, getBufferFormat() ); + m_deviceCtx->ResolveSubresource(m_captureResolve, 0, backBuffer, 0, m_scd.format); m_deviceCtx->CopyResource(m_captureTexture, m_captureResolve); } @@ -3446,13 +3163,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); bimg::imageSwizzleBgra8( mapped.pData , mapped.RowPitch - , getBufferWidth() - , getBufferHeight() + , m_scd.width + , m_scd.height , mapped.pData , mapped.RowPitch ); - g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch); + g_callback->captureFrame(mapped.pData, m_scd.height*mapped.RowPitch); m_deviceCtx->Unmap(m_captureTexture, 0); @@ -3553,8 +3270,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } else { - width = getBufferWidth(); - height = getBufferHeight(); + width = m_scd.width; + height = m_scd.height; } if (0 == _rect.m_x @@ -3569,8 +3286,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ID3D11DeviceContext* deviceCtx = m_deviceCtx; uint64_t state = 0; - state |= _clear.m_flags & BGFX_CLEAR_COLOR ? BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE : 0; - state |= _clear.m_flags & BGFX_CLEAR_DEPTH ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_DEPTH_WRITE : 0; + state |= _clear.m_flags & BGFX_CLEAR_COLOR ? BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A : 0; + state |= _clear.m_flags & BGFX_CLEAR_DEPTH ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_WRITE_Z : 0; uint64_t stencil = 0; stencil |= _clear.m_flags & BGFX_CLEAR_STENCIL ? 0 @@ -3678,28 +3395,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - void* m_d3d9dll; - void* m_d3d11dll; - void* m_dxgidll; - void* m_dxgidebugdll; + void* m_d3d9Dll; + void* m_d3d11Dll; + void* m_renderDocDll; + void* m_agsDll; - void* m_renderdocdll; - void* m_agsdll; + Dxgi m_dxgi; AGSContext* m_ags; - NvApi m_nvapi; - D3D_DRIVER_TYPE m_driverType; D3D_FEATURE_LEVEL m_featureLevel; - IDXGIAdapter* m_adapter; - DXGI_ADAPTER_DESC m_adapterDesc; -#if BX_PLATFORM_WINDOWS - IDXGIFactory* m_factory; - IDXGISwapChain* m_swapChain; -#else - IDXGIFactory2* m_factory; - IDXGISwapChain1* m_swapChain; -#endif // BX_PLATFORM_WINDOWS + + Dxgi::SwapChainI* m_swapChain; + ID3D11Texture2D* m_msaaRt; bool m_needPresent; bool m_lost; @@ -3726,13 +3434,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); Resolution m_resolution; -#if BX_PLATFORM_WINDOWS - typedef DXGI_SWAP_CHAIN_DESC SwapChainDesc; -#else - typedef DXGI_SWAP_CHAIN_DESC1 SwapChainDesc; -#endif // BX_PLATFORM_WINDOWS - SwapChainDesc m_scd; + DXGI_SWAP_EFFECT m_swapEffect; + uint32_t m_swapBufferCount; uint32_t m_maxAnisotropy; bool m_depthClamp; bool m_wireframe; @@ -3769,19 +3473,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); FrameBufferHandle m_fbh; bool m_rtMsaa; bool m_timerQuerySupport; - - VR m_ovr; -#if BGFX_CONFIG_USE_OVR - VRImplOVRD3D11 m_ovrRender; -#endif // BGFX_CONFIG_USE_OVR + bool m_directAccessSupport; }; static RendererContextD3D11* s_renderD3D11; - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11); - if (!s_renderD3D11->init() ) + if (!s_renderD3D11->init(_init) ) { BX_DELETE(g_allocator, s_renderD3D11); s_renderD3D11 = NULL; @@ -3826,6 +3526,16 @@ BX_PRAGMA_DIAGNOSTIC_POP(); agsDriverExtensions_MultiDrawIndexedInstancedIndirect(s_renderD3D11->m_ags, _numDrawIndirect, _ptr, _offset, _stride); } + void nvapiMultiDrawInstancedIndirect(uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride) + { + s_renderD3D11->m_nvapi.nvApiD3D11MultiDrawInstancedIndirect(s_renderD3D11->m_deviceCtx, _numDrawIndirect, _ptr, _offset, _stride); + } + + void nvapiMultiDrawIndexedInstancedIndirect(uint32_t _numDrawIndirect, ID3D11Buffer* _ptr, uint32_t _offset, uint32_t _stride) + { + s_renderD3D11->m_nvapi.nvApiD3D11MultiDrawIndexedInstancedIndirect(s_renderD3D11->m_deviceCtx, _numDrawIndirect, _ptr, _offset, _stride); + } + int WINAPI d3d11Annotation_BeginEvent(DWORD _color, LPCWSTR _name) { BX_UNUSED(_color); @@ -3843,230 +3553,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); s_renderD3D11->m_annotation->SetMarker(_name); } -#if BGFX_CONFIG_USE_OVR - - VRImplOVRD3D11::VRImplOVRD3D11() - : m_depthBuffer(NULL) - , m_msaaRtv(NULL) - , m_msaaTexture(NULL) - , m_textureSwapChain(NULL) - , m_mirrorTexture(NULL) - { - bx::memSet(m_eyeRtv, 0, sizeof(m_eyeRtv)); - } - - bool VRImplOVRD3D11::createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) - { - if (!m_session) - { - return false; - } - - ID3D11Device* device = s_renderD3D11->m_device; - - if (NULL == m_textureSwapChain) - { - ovrTextureSwapChainDesc swapchainDesc = {}; - swapchainDesc.Type = ovrTexture_2D; - swapchainDesc.Width = _desc.m_eyeSize[0].m_w + _desc.m_eyeSize[1].m_w; - swapchainDesc.Height = bx::uint32_max(_desc.m_eyeSize[0].m_h, _desc.m_eyeSize[1].m_h); - swapchainDesc.MipLevels = 1; - swapchainDesc.ArraySize = 1; - swapchainDesc.SampleCount = 1; - swapchainDesc.MiscFlags = ovrTextureMisc_DX_Typeless; - swapchainDesc.BindFlags = ovrTextureBind_DX_RenderTarget; - swapchainDesc.StaticImage = ovrFalse; - swapchainDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - - ovrResult result = ovr_CreateTextureSwapChainDX(m_session, device, &swapchainDesc, &m_textureSwapChain); - if (!OVR_SUCCESS(result) ) - { - return false; - } - - for (int eye = 0; eye < 2; ++eye) - { - m_renderLayer.ColorTexture[eye] = m_textureSwapChain; - } - - // create MSAA target - if (_msaaSamples > 1) - { - D3D11_TEXTURE2D_DESC msDesc; - msDesc.Width = swapchainDesc.Width; - msDesc.Height = swapchainDesc.Height; - msDesc.MipLevels = 1; - msDesc.ArraySize = 1; - msDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - msDesc.SampleDesc.Count = _msaaSamples; - msDesc.SampleDesc.Quality = 0; - msDesc.Usage = D3D11_USAGE_DEFAULT; - msDesc.CPUAccessFlags = 0; - msDesc.MiscFlags = 0; - msDesc.BindFlags = D3D11_BIND_RENDER_TARGET; - DX_CHECK(device->CreateTexture2D(&msDesc, NULL, &m_msaaTexture) ); - DX_CHECK(device->CreateRenderTargetView(m_msaaTexture, NULL, &m_msaaRtv) ); - } - else - { - int swapchainSize; - result = ovr_GetTextureSwapChainLength(m_session, m_textureSwapChain, &swapchainSize); - if (!OVR_SUCCESS(result) ) - { - destroySwapChain(); - return false; - } - - BX_CHECK(swapchainSize <= BX_COUNTOF(m_eyeRtv), "Too many OVR swap chain entries %d", swapchainSize); - for (int ii = 0; ii < swapchainSize; ++ii) - { - ID3D11Texture2D* texture; - ovr_GetTextureSwapChainBufferDX(m_session, m_textureSwapChain, ii, IID_PPV_ARGS(&texture) ); - - D3D11_RENDER_TARGET_VIEW_DESC viewDesc; - viewDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - viewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - viewDesc.Texture2D.MipSlice = 0; - DX_CHECK(device->CreateRenderTargetView(texture, &viewDesc, &m_eyeRtv[ii]) ); - DX_RELEASE(texture, 1); - } - } - - // create depth buffer - D3D11_TEXTURE2D_DESC dbDesc = {}; - dbDesc.Width = swapchainDesc.Width; - dbDesc.Height = swapchainDesc.Height; - dbDesc.MipLevels = 1; - dbDesc.ArraySize = 1; - dbDesc.Format = DXGI_FORMAT_D32_FLOAT; - dbDesc.SampleDesc.Count = _msaaSamples; - dbDesc.SampleDesc.Quality = 0; - dbDesc.Usage = D3D11_USAGE_DEFAULT; - dbDesc.CPUAccessFlags = 0; - dbDesc.MiscFlags = 0; - dbDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL; - ID3D11Texture2D* depthTexture; - DX_CHECK(device->CreateTexture2D(&dbDesc, NULL, &depthTexture) ); - DX_CHECK(device->CreateDepthStencilView(depthTexture, NULL, &m_depthBuffer) ); - DX_RELEASE(depthTexture, 0); - } - - if (NULL == m_mirrorTexture) - { - ovrMirrorTextureDesc mirrorDesc = {}; - mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - mirrorDesc.Width = _mirrorWidth; - mirrorDesc.Height = _mirrorHeight; - ovrResult result = ovr_CreateMirrorTextureDX(m_session, device, &mirrorDesc, &m_mirrorTexture); - BX_WARN(OVR_SUCCESS(result), "Could not create D3D11 OVR mirror texture"); - BX_UNUSED(result); - } - - return true; - } - - void VRImplOVRD3D11::destroySwapChain() - { - if (NULL != m_textureSwapChain) - { - BX_CHECK(m_session, "VRSWapChain destroyed without valid OVR session"); - ovr_DestroyTextureSwapChain(m_session, m_textureSwapChain); - m_textureSwapChain = NULL; - } - - for (int ii = 0, nn = BX_COUNTOF(m_eyeRtv); ii < nn; ++ii) - { - DX_RELEASE(m_eyeRtv[ii], 0); - } - - DX_RELEASE(m_msaaRtv, 0); - DX_RELEASE(m_msaaTexture, 0); - DX_RELEASE(m_depthBuffer, 0); - - destroyMirror(); - } - - void VRImplOVRD3D11::destroyMirror() - { - if (NULL != m_mirrorTexture) - { - ovr_DestroyMirrorTexture(m_session, m_mirrorTexture); - m_mirrorTexture = NULL; - } - } - - void VRImplOVRD3D11::makeRenderTargetActive(const VRDesc& /*_desc*/) - { - if (NULL != m_msaaRtv) - { - s_renderD3D11->m_currentColor = m_msaaRtv; - } - else - { - int index; - ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain, &index); - s_renderD3D11->m_currentColor = m_eyeRtv[index]; - } - - s_renderD3D11->m_currentDepthStencil = m_depthBuffer; - } - - bool VRImplOVRD3D11::submitSwapChain(const VRDesc& /* _desc */) - { - BX_CHECK(NULL != m_session, "No session in VRImplOVRD3D11::submitSwapChain. Usage error"); - BX_CHECK(NULL != m_textureSwapChain, "VRImplOVRD3D11 submitted without a valid swap chain"); - - ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; - - int index; - ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain, &index); - - ID3D11Texture2D* eyeTexture; - ovr_GetTextureSwapChainBufferDX(m_session, m_textureSwapChain, index, IID_PPV_ARGS(&eyeTexture)); - - // resolve MSAA - if (NULL != m_msaaRtv) - { - deviceCtx->ResolveSubresource(eyeTexture, 0, m_msaaTexture, 0, DXGI_FORMAT_R8G8B8A8_UNORM); - } - - ovrResult result = ovr_CommitTextureSwapChain(m_session, m_textureSwapChain); - if (!OVR_SUCCESS(result) ) - { - return false; - DX_RELEASE(eyeTexture, 1); - } - - ovrLayerHeader* layerList = &m_renderLayer.Header; - result = ovr_SubmitFrame(m_session, 0, NULL, &layerList, 1); - if (!OVR_SUCCESS(result) ) - { - DX_RELEASE(eyeTexture, 1); - return false; - } - - if (result != ovrSuccess_NotVisible && NULL != m_mirrorTexture) - { - IDXGISwapChain* swapChain = s_renderD3D11->m_swapChain; - - ID3D11Texture2D* tex = NULL; - ovr_GetMirrorTextureBufferDX(m_session, m_mirrorTexture, IID_PPV_ARGS(&tex)); - ID3D11Texture2D* backBuffer; - DX_CHECK(swapChain->GetBuffer(0, IID_PPV_ARGS(&backBuffer))); - - deviceCtx->CopyResource(backBuffer, tex); - DX_CHECK(swapChain->Present(0, 0)); - - DX_RELEASE(tex, 1); - DX_RELEASE(backBuffer, 0); - } - - DX_RELEASE(eyeTexture, 1); - return true; - } - -#endif // BGFX_CONFIG_USE_OVR - struct UavFormat { DXGI_FORMAT format[3]; @@ -4369,22 +3855,21 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t magic; bx::read(&reader, magic); - switch (magic) + const bool fragment = isShaderType(magic, 'F'); + + uint32_t hashIn; + bx::read(&reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) { - case BGFX_CHUNK_MAGIC_CSH: - case BGFX_CHUNK_MAGIC_FSH: - case BGFX_CHUNK_MAGIC_VSH: - break; - - default: - BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic); - break; + hashOut = hashIn; + } + else + { + bx::read(&reader, hashOut); } - - bool fragment = BGFX_CHUNK_MAGIC_FSH == magic; - - uint32_t iohash; - bx::read(&reader, iohash); uint16_t count; bx::read(&reader, count); @@ -4393,11 +3878,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_numUniforms = count; BX_TRACE("%s Shader consts %d" - , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute" + , getShaderTypeName(magic) , count ); - uint8_t fragmentBit = fragment ? BGFX_UNIFORM_FRAGMENTBIT : 0; + const uint8_t fragmentBit = fragment ? BGFX_UNIFORM_FRAGMENTBIT : 0; if (0 < count) { @@ -4477,13 +3962,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const void* code = reader.getDataPtr(); bx::skip(&reader, shaderSize+1); - if (BGFX_CHUNK_MAGIC_FSH == magic) + if (isShaderType(magic, 'F') ) { m_hasDepthOp = hasDepthOp(code, shaderSize); DX_CHECK(s_renderD3D11->m_device->CreatePixelShader(code, shaderSize, NULL, &m_pixelShader) ); BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create fragment shader."); } - else if (BGFX_CHUNK_MAGIC_VSH == magic) + else if (isShaderType(magic, 'V') ) { m_hash = bx::hash(code, shaderSize); m_code = copy(code, shaderSize); @@ -4491,7 +3976,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_CHECK(s_renderD3D11->m_device->CreateVertexShader(code, shaderSize, NULL, &m_vertexShader) ); BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create vertex shader."); } - else + else if (isShaderType(magic, 'C') ) { DX_CHECK(s_renderD3D11->m_device->CreateComputeShader(code, shaderSize, NULL, &m_computeShader) ); BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create compute shader."); @@ -4528,11 +4013,75 @@ BX_PRAGMA_DIAGNOSTIC_POP(); desc.MiscFlags = 0; desc.StructureByteStride = 0; DX_CHECK(s_renderD3D11->m_device->CreateBuffer(&desc, NULL, &m_buffer) ); + + BX_TRACE("\tCB size: %d", desc.ByteWidth); } } - void TextureD3D11::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) + void* DirectAccessResourceD3D11::createTexture2D(const D3D11_TEXTURE2D_DESC* _gpuDesc, const D3D11_SUBRESOURCE_DATA* _srd, ID3D11Texture2D** _gpuTexture2d) { + ID3D11Device* device = s_renderD3D11->m_device; + DX_CHECK(setIntelDirectAccessResource(device) ); + DX_CHECK(device->CreateTexture2D(_gpuDesc, _srd, _gpuTexture2d) ); + + D3D11_TEXTURE2D_DESC cpuDesc; + bx::memCopy(&cpuDesc, _gpuDesc, sizeof(cpuDesc) ); + cpuDesc.BindFlags = 0; + cpuDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + cpuDesc.Usage = D3D11_USAGE_STAGING; + + DX_CHECK(setIntelDirectAccessResource(s_renderD3D11->m_device) ); + DX_CHECK(device->CreateTexture2D(&cpuDesc, NULL, &m_texture2d) ); + + ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; + deviceCtx->CopyResource(m_texture2d, *_gpuTexture2d); + + D3D11_MAPPED_SUBRESOURCE mappedResource; + deviceCtx->Map(m_texture2d, 0, D3D11_MAP_WRITE, 0, &mappedResource); + m_descriptor = reinterpret_cast(mappedResource.pData); + + return m_descriptor->ptr; + } + + void* DirectAccessResourceD3D11::createTexture3D(const D3D11_TEXTURE3D_DESC* _gpuDesc, const D3D11_SUBRESOURCE_DATA* _srd, ID3D11Texture3D** _gpuTexture3d) + { + ID3D11Device* device = s_renderD3D11->m_device; + DX_CHECK(setIntelDirectAccessResource(device) ); + DX_CHECK(device->CreateTexture3D(_gpuDesc, _srd, _gpuTexture3d) ); + + D3D11_TEXTURE3D_DESC cpuDesc; + bx::memCopy(&cpuDesc, _gpuDesc, sizeof(cpuDesc) ); + cpuDesc.BindFlags = 0; + cpuDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + cpuDesc.Usage = D3D11_USAGE_STAGING; + + DX_CHECK(setIntelDirectAccessResource(s_renderD3D11->m_device) ); + DX_CHECK(device->CreateTexture3D(&cpuDesc, NULL, &m_texture3d) ); + + ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; + deviceCtx->CopyResource(m_texture3d, *_gpuTexture3d); + + D3D11_MAPPED_SUBRESOURCE mappedResource; + deviceCtx->Map(m_texture3d, 0, D3D11_MAP_WRITE, 0, &mappedResource); + m_descriptor = reinterpret_cast(mappedResource.pData); + + return m_descriptor->ptr; + } + + void DirectAccessResourceD3D11::destroy() + { + if (NULL != m_descriptor) + { + s_renderD3D11->m_deviceCtx->Unmap(m_ptr, 0); + m_descriptor = NULL; + DX_RELEASE(m_ptr, 0); + } + } + + void* TextureD3D11::create(const Memory* _mem, uint64_t _flags, uint8_t _skip) + { + void* directAccessPtr = NULL; + bimg::ImageContainer imageContainer; if (bimg::imageParse(imageContainer, _mem->data, _mem->size) ) @@ -4548,7 +4097,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_flags = _flags; m_width = textureWidth; m_height = textureHeight; - m_depth = imageContainer.m_depth; + m_depth = 1 < imageContainer.m_depth + ? imageContainer.m_depth + : imageContainer.m_numLayers + ; m_requestedFormat = uint8_t(imageContainer.m_format); m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); const bool convert = m_textureFormat != m_requestedFormat; @@ -4592,16 +4144,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); for (uint16_t side = 0; side < numSides; ++side) { - uint32_t width = textureWidth; - uint32_t height = textureHeight; - uint32_t depth = imageContainer.m_depth; - for (uint8_t lod = 0, num = numMips; lod < num; ++lod) { - width = bx::uint32_max(1, width); - height = bx::uint32_max(1, height); - depth = bx::uint32_max(1, depth); - bimg::ImageMip mip; if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { @@ -4611,7 +4155,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { uint32_t srcpitch = mip.m_width*bpp/8; uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, mip.m_width*mip.m_height*bpp/8); - bimg::imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format); + bimg::imageDecodeToBgra8(g_allocator, temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format); srd[kk].pSysMem = temp; srd[kk].SysMemPitch = srcpitch; @@ -4629,10 +4173,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); srd[kk].SysMemSlicePitch = mip.m_height*srd[kk].SysMemPitch; ++kk; } - - width >>= 1; - height >>= 1; - depth >>= 1; } } @@ -4678,12 +4218,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); srvd.Format = getSrvFormat(); } + const bool directAccess = s_renderD3D11->m_directAccessSupport + && !renderTarget + && !readBack + && !blit + && !writeOnly + ; + switch (m_type) { case Texture2D: case TextureCube: { - D3D11_TEXTURE2D_DESC desc; + D3D11_TEXTURE2D_DESC desc = {}; desc.Width = textureWidth; desc.Height = textureHeight; desc.MipLevels = numMips; @@ -4774,13 +4321,20 @@ BX_PRAGMA_DIAGNOSTIC_POP(); desc.SampleDesc = s_msaa[0]; } - DX_CHECK(s_renderD3D11->m_device->CreateTexture2D(&desc, kk == 0 ? NULL : srd, &m_texture2d) ); + if (directAccess) + { + directAccessPtr = m_dar.createTexture2D(&desc, kk == 0 ? NULL : srd, &m_texture2d); + } + else + { + DX_CHECK(s_renderD3D11->m_device->CreateTexture2D(&desc, kk == 0 ? NULL : srd, &m_texture2d) ); + } } break; case Texture3D: { - D3D11_TEXTURE3D_DESC desc; + D3D11_TEXTURE3D_DESC desc = {}; desc.Width = textureWidth; desc.Height = textureHeight; desc.Depth = imageContainer.m_depth; @@ -4816,7 +4370,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D; srvd.Texture3D.MipLevels = numMips; - DX_CHECK(s_renderD3D11->m_device->CreateTexture3D(&desc, kk == 0 ? NULL : srd, &m_texture3d) ); + if (directAccess) + { + directAccessPtr = m_dar.createTexture3D(&desc, kk == 0 ? NULL : srd, &m_texture3d); + } + else + { + DX_CHECK(s_renderD3D11->m_device->CreateTexture3D(&desc, kk == 0 ? NULL : srd, &m_texture3d) ); + } } break; } @@ -4845,15 +4406,19 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } } + + return directAccessPtr; } void TextureD3D11::destroy() { + m_dar.destroy(); + s_renderD3D11->m_srvUavLru.invalidateWithParent(getHandle().idx); DX_RELEASE(m_rt, 0); DX_RELEASE(m_srv, 0); DX_RELEASE(m_uav, 0); - if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) ) + if (0 == (m_flags & BGFX_SAMPLER_INTERNAL_SHARED) ) { DX_RELEASE(m_ptr, 0); } @@ -4862,7 +4427,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void TextureD3D11::overrideInternal(uintptr_t _ptr) { destroy(); - m_flags |= BGFX_TEXTURE_INTERNAL_SHARED; + m_flags |= BGFX_SAMPLER_INTERNAL_SHARED; m_ptr = (ID3D11Resource*)_ptr; s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, NULL, &m_srv); @@ -4876,7 +4441,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); box.left = _rect.m_x; box.top = _rect.m_y; box.right = box.left + _rect.m_width; - box.bottom = box.top + _rect.m_height; + box.bottom = box.top + _rect.m_height; uint32_t layer = 0; @@ -4893,6 +4458,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } const uint32_t subres = _mip + ( (layer + _side) * m_numMips); + const bool depth = bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); const uint32_t rectpitch = _rect.m_width*bpp/8; const uint32_t srcpitch = UINT16_MAX == _pitch ? rectpitch : _pitch; @@ -4906,14 +4472,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch); - bimg::imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); + bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; } deviceCtx->UpdateSubresource( m_ptr , subres - , &box + , depth ? NULL : &box , data , srcpitch , TextureD3D11::Texture3D == m_type ? slicepitch : 0 @@ -4928,18 +4494,30 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void TextureD3D11::commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]) { TextureStage& ts = s_renderD3D11->m_textureStage; - ts.m_srv[_stage] = m_srv; - uint32_t flags = 0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) + + if (0 != (_flags & BGFX_SAMPLER_SAMPLE_STENCIL) ) + { + ts.m_srv[_stage] = s_renderD3D11->getCachedSrv( + TextureHandle{ uint16_t(this - s_renderD3D11->m_textures) } + , 0 + , false + , true + ); + } + else + { + ts.m_srv[_stage] = m_srv; + } + + const uint32_t flags = 0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? _flags - : m_flags + : uint32_t(m_flags) ; - uint32_t index = (flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT; - ts.m_sampler[_stage] = s_renderD3D11->getSamplerState(flags - , _palette[index]) - ; + uint32_t index = (flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; + ts.m_sampler[_stage] = s_renderD3D11->getSamplerState(flags, _palette[index]); } - void TextureD3D11::resolve() const + void TextureD3D11::resolve(uint8_t _resolve) const { ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx; @@ -4951,7 +4529,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); if (renderTarget - && 1 < m_numMips) + && 1 < m_numMips + && 0 != (_resolve & BGFX_RESOLVE_AUTO_GEN_MIPS) ) { deviceCtx->GenerateMips(m_srv); } @@ -4993,23 +4572,33 @@ BX_PRAGMA_DIAGNOSTIC_POP(); postReset(); } - void FrameBufferD3D11::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) + void FrameBufferD3D11::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) { - DXGI_SWAP_CHAIN_DESC scd; - bx::memCopy(&scd, &s_renderD3D11->m_scd, sizeof(DXGI_SWAP_CHAIN_DESC) ); - scd.BufferDesc.Width = _width; - scd.BufferDesc.Height = _height; - scd.OutputWindow = (HWND)_nwh; + SwapChainDesc scd; + bx::memCopy(&scd, &s_renderD3D11->m_scd, sizeof(SwapChainDesc) ); + scd.format = TextureFormat::Count == _format ? scd.format : s_textureFormat[_format].m_fmt; + scd.width = _width; + scd.height = _height; + scd.nwh = _nwh; + scd.ndt = NULL; ID3D11Device* device = s_renderD3D11->m_device; - HRESULT hr; - hr = s_renderD3D11->m_factory->CreateSwapChain(device - , &scd + HRESULT hr = s_renderD3D11->m_dxgi.createSwapChain(device + , scd , &m_swapChain ); BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain."); +#if BX_PLATFORM_WINDOWS + DX_CHECK(s_renderD3D11->m_dxgi.m_factory->MakeWindowAssociation( + (HWND)_nwh + , 0 + | DXGI_MWA_NO_WINDOW_CHANGES + | DXGI_MWA_NO_ALT_ENTER + ) ); +#endif // BX_PLATFORM_WINDOWS + ID3D11Resource* ptr; DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&ptr) ); DX_CHECK(device->CreateRenderTargetView(ptr, NULL, &m_rtv[0]) ); @@ -5020,12 +4609,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); : DXGI_FORMAT_D24_UNORM_S8_UINT ; D3D11_TEXTURE2D_DESC dsd; - dsd.Width = scd.BufferDesc.Width; - dsd.Height = scd.BufferDesc.Height; + dsd.Width = scd.width; + dsd.Height = scd.height; dsd.MipLevels = 1; dsd.ArraySize = 1; dsd.Format = fmtDsv; - dsd.SampleDesc = scd.SampleDesc; + dsd.SampleDesc = scd.sampleDesc; dsd.Usage = D3D11_USAGE_DEFAULT; dsd.BindFlags = D3D11_BIND_DEPTH_STENCIL; dsd.CPUAccessFlags = 0; @@ -5037,6 +4626,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(depthStencil, 0); m_srv[0] = NULL; + m_nwh = _nwh; m_denseIdx = _denseIdx; m_num = 1; } @@ -5048,6 +4638,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_RELEASE(m_swapChain, 0); m_num = 0; + m_nwh = NULL; m_numTh = 0; m_needPresent = false; @@ -5082,10 +4673,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_num = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - const TextureD3D11& texture = s_renderD3D11->m_textures[handle.idx]; + const TextureD3D11& texture = s_renderD3D11->m_textures[at.handle.idx]; if (0 == m_width) { @@ -5131,7 +4723,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); : D3D11_DSV_DIMENSION_TEXTURE2D ; dsvDesc.Flags = 0; - dsvDesc.Texture2D.MipSlice = m_attachment[ii].mip; + dsvDesc.Texture2D.MipSlice = at.mip; DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView( NULL == texture.m_rt ? texture.m_ptr : texture.m_rt , &dsvDesc @@ -5148,14 +4740,14 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY; dsvDesc.Texture2DMSArray.ArraySize = 1; - dsvDesc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer; + dsvDesc.Texture2DMSArray.FirstArraySlice = at.layer; } else { dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY; dsvDesc.Texture2DArray.ArraySize = 1; - dsvDesc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer; - dsvDesc.Texture2DArray.MipSlice = m_attachment[ii].mip; + dsvDesc.Texture2DArray.FirstArraySlice = at.layer; + dsvDesc.Texture2DArray.MipSlice = at.mip; } dsvDesc.Flags = 0; DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView(texture.m_ptr, &dsvDesc, &m_dsv) ); @@ -5163,7 +4755,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); break; } } - else + else if (Access::Write == at.access) { D3D11_RENDER_TARGET_VIEW_DESC desc; desc.Format = texture.getSrvFormat(); @@ -5173,16 +4765,35 @@ BX_PRAGMA_DIAGNOSTIC_POP(); case TextureD3D11::Texture2D: if (1 < msaa.Count) { - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; + if (1 < texture.m_depth) + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; + desc.Texture2DMSArray.FirstArraySlice = at.layer; + desc.Texture2DMSArray.ArraySize = 1; + } + else + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; + } } else { - desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - desc.Texture2D.MipSlice = m_attachment[ii].mip; + if (1 < texture.m_depth) + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + desc.Texture2DArray.FirstArraySlice = at.layer; + desc.Texture2DArray.ArraySize = 1; + desc.Texture2DArray.MipSlice = at.mip; + } + else + { + desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipSlice = at.mip; + } } DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView( - NULL == texture.m_rt ? texture.m_ptr : texture.m_rt + NULL == texture.m_rt ? texture.m_ptr : texture.m_rt , &desc , &m_rtv[m_num] ) ); @@ -5193,23 +4804,23 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; desc.Texture2DMSArray.ArraySize = 1; - desc.Texture2DMSArray.FirstArraySlice = m_attachment[ii].layer; + desc.Texture2DMSArray.FirstArraySlice = at.layer; } else { desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; desc.Texture2DArray.ArraySize = 1; - desc.Texture2DArray.FirstArraySlice = m_attachment[ii].layer; - desc.Texture2DArray.MipSlice = m_attachment[ii].mip; + desc.Texture2DArray.FirstArraySlice = at.layer; + desc.Texture2DArray.MipSlice = at.mip; } DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); break; case TextureD3D11::Texture3D: desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; - desc.Texture3D.MipSlice = m_attachment[ii].mip; + desc.Texture3D.MipSlice = at.mip; desc.Texture3D.WSize = 1; - desc.Texture3D.FirstWSlice = m_attachment[ii].layer; + desc.Texture3D.FirstWSlice = at.layer; DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, &desc, &m_rtv[m_num]) ); break; } @@ -5217,6 +4828,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(texture.m_ptr, NULL, &m_srv[m_num]) ); m_num++; } + else + { + BX_CHECK(false, ""); + } } } } @@ -5228,11 +4843,12 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - const TextureD3D11& texture = s_renderD3D11->m_textures[handle.idx]; - texture.resolve(); + const TextureD3D11& texture = s_renderD3D11->m_textures[at.handle.idx]; + texture.resolve(at.resolve); } } } @@ -5568,14 +5184,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); box.bottom = blit.m_srcY + height; box.back = 1; - const uint32_t srcZ = TextureD3D11::TextureCube == src.m_type - ? blit.m_srcZ - : 0 - ; - const uint32_t dstZ = TextureD3D11::TextureCube == dst.m_type - ? blit.m_dstZ - : 0 - ; + const uint32_t srcZ = blit.m_srcZ; + const uint32_t dstZ = blit.m_dstZ; deviceCtx->CopySubresourceRegion(dst.m_ptr , dstZ*dst.m_numMips+blit.m_dstMip @@ -5639,9 +5249,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); RenderBind currentBind; currentBind.clear(); - _render->m_hmdInitialized = m_ovr.isInitialized(); - - const bool hmdEnabled = m_ovr.isEnabled(); + const bool hmdEnabled = false; static ViewState viewState; viewState.reset(_render, hmdEnabled); @@ -5666,6 +5274,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); Rect viewScissorRect; viewScissorRect.clear(); + const uint32_t maxComputeBindings = g_caps.limits.maxComputeBindings; + const uint32_t maxTextureSamplers = g_caps.limits.maxTextureSamplers; + uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {}; @@ -5686,8 +5297,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { // reset the framebuffer to be the backbuffer; depending on the swap effect, // if we don't do this we'll only see one frame of output and then nothing - FrameBufferHandle invalid = BGFX_INVALID_HANDLE; - setFrameBuffer(invalid, true, false); + setFrameBuffer(BGFX_INVALID_HANDLE, true, false); bool viewRestart = false; uint8_t eye = 0; @@ -5754,7 +5364,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { profiler.end(); } - profiler.begin(view); viewState.m_rect = _render->m_view[view].m_rect; @@ -5772,15 +5381,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); } - if (m_ovr.isEnabled() ) - { - m_ovr.getViewport(eye, &viewState.m_rect); - } - else - { - viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2; - viewState.m_rect.m_width /= 2; - } + viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2; + viewState.m_rect.m_width /= 2; } else { @@ -5810,7 +5412,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (BGFX_CLEAR_NONE != (clr.m_flags & BGFX_CLEAR_MASK) ) { clearQuad(_clearQuad, viewState.m_rect, clr, _render->m_colorPalette); - prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update after clear quad. + prim = s_primInfo[Topology::Count]; // Force primitive type update after clear quad. } submitBlit(bs, view); @@ -5833,11 +5435,11 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->IASetVertexBuffers(0, 2, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero); deviceCtx->IASetIndexBuffer(NULL, DXGI_FORMAT_R16_UINT, 0); - deviceCtx->VSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, s_zero.m_srv); - deviceCtx->PSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, s_zero.m_srv); + deviceCtx->VSSetShaderResources(0, maxTextureSamplers, s_zero.m_srv); + deviceCtx->PSSetShaderResources(0, maxTextureSamplers, s_zero.m_srv); - deviceCtx->VSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, s_zero.m_sampler); - deviceCtx->PSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, s_zero.m_sampler); + deviceCtx->VSSetSamplers(0, maxTextureSamplers, s_zero.m_sampler); + deviceCtx->PSSetSamplers(0, maxTextureSamplers, s_zero.m_sampler); } const RenderCompute& compute = renderItem.compute; @@ -5889,35 +5491,39 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } BX_UNUSED(programChanged); ID3D11UnorderedAccessView* uav[BGFX_MAX_COMPUTE_BINDINGS] = {}; - ID3D11ShaderResourceView* srv[BGFX_MAX_COMPUTE_BINDINGS] = {}; - ID3D11SamplerState* sampler[BGFX_MAX_COMPUTE_BINDINGS] = {}; - for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) + for (uint8_t stage = 0; stage < maxComputeBindings; ++stage) { - const Binding& bind = renderBind.m_bind[ii]; + const Binding& bind = renderBind.m_bind[stage]; if (kInvalidHandle != bind.m_idx) { switch (bind.m_type) { case Binding::Image: - case Binding::Texture: { TextureD3D11& texture = m_textures[bind.m_idx]; - if (Access::Read != bind.m_un.m_compute.m_access) + if (Access::Read != bind.m_access) { - uav[ii] = 0 == bind.m_un.m_compute.m_mip + uav[stage] = 0 == bind.m_mip ? texture.m_uav - : s_renderD3D11->getCachedUav(texture.getHandle(), bind.m_un.m_compute.m_mip) + : s_renderD3D11->getCachedUav(texture.getHandle(), bind.m_mip) ; } else { - srv[ii] = s_renderD3D11->getCachedSrv(texture.getHandle(), bind.m_un.m_compute.m_mip, true); - sampler[ii] = s_renderD3D11->getSamplerState(texture.m_flags, NULL); + m_textureStage.m_srv[stage] = s_renderD3D11->getCachedSrv(texture.getHandle(), bind.m_mip, true); + m_textureStage.m_sampler[stage] = s_renderD3D11->getSamplerState(uint32_t(texture.m_flags), NULL); } } break; + case Binding::Texture: + { + TextureD3D11& texture = m_textures[bind.m_idx]; + texture.commit(stage, bind.m_samplerFlags, _render->m_colorPalette); + } + break; + case Binding::IndexBuffer: case Binding::VertexBuffer: { @@ -5925,13 +5531,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ? m_indexBuffers[bind.m_idx] : m_vertexBuffers[bind.m_idx] ; - if (Access::Read != bind.m_un.m_compute.m_access) + if (Access::Read != bind.m_access) { - uav[ii] = buffer.m_uav; + uav[stage] = buffer.m_uav; } else { - srv[ii] = buffer.m_srv; + m_textureStage.m_srv[stage] = buffer.m_srv; } } break; @@ -5939,9 +5545,15 @@ BX_PRAGMA_DIAGNOSTIC_POP(); } } - deviceCtx->CSSetUnorderedAccessViews(0, BX_COUNTOF(uav), uav, NULL); - deviceCtx->CSSetShaderResources(0, BX_COUNTOF(srv), srv); - deviceCtx->CSSetSamplers(0, BX_COUNTOF(sampler), sampler); + if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) + { + // Quiet validation: Resource being set to CS UnorderedAccessView slot 0 is still bound on input! + deviceCtx->CSSetShaderResources(0, maxComputeBindings, s_zero.m_srv); + } + + deviceCtx->CSSetUnorderedAccessViews(0, maxComputeBindings, uav, NULL); + deviceCtx->CSSetShaderResources(0, maxTextureSamplers, m_textureStage.m_srv); + deviceCtx->CSSetSamplers(0, maxTextureSamplers, m_textureStage.m_sampler); if (isValid(compute.m_indirectBuffer) ) { @@ -5989,11 +5601,25 @@ BX_PRAGMA_DIAGNOSTIC_POP(); const RenderDraw& draw = renderItem.draw; const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); - if (isValid(draw.m_occlusionQuery) - && !hasOcclusionQuery - && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) ) { - continue; + const bool occluded = true + && isValid(draw.m_occlusionQuery) + && !hasOcclusionQuery + && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) + ; + + if (occluded + || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) + { + if (resetState) + { + currentState.clear(); + currentState.m_scissor = !draw.m_scissor; + currentBind.clear(); + } + + continue; + } } const uint64_t newFlags = draw.m_stateFlags; @@ -6054,10 +5680,6 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { Rect scissorRect; scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); - if (scissorRect.isZeroArea() ) - { - continue; - } scissorEnabled = true; D3D11_RECT rc; @@ -6142,8 +5764,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); deviceCtx->VSSetConstantBuffers(0, 1, &vsh->m_buffer); const ShaderD3D11* fsh = program.m_fsh; - if (NULL != m_currentColor - || fsh->m_hasDepthOp) + if (NULL != fsh + && (NULL != m_currentColor || fsh->m_hasDepthOp) ) { deviceCtx->PSSetShader(fsh->m_pixelShader, NULL, 0); deviceCtx->PSSetConstantBuffers(0, 1, &fsh->m_buffer); @@ -6170,10 +5792,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); commit(*vcb); } - UniformBuffer* fcb = program.m_fsh->m_constantBuffer; - if (NULL != fcb) + if (NULL != program.m_fsh) { - commit(*fcb); + UniformBuffer* fcb = program.m_fsh->m_constantBuffer; + if (NULL != fcb) + { + commit(*fcb); + } } } @@ -6188,13 +5813,13 @@ BX_PRAGMA_DIAGNOSTIC_POP(); { uint32_t changes = 0; - for (uint8_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) + for (uint8_t stage = 0; stage < maxTextureSamplers; ++stage) { const Binding& bind = renderBind.m_bind[stage]; Binding& current = currentBind.m_bind[stage]; - if (current.m_idx != bind.m_idx - || current.m_type != bind.m_type - || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags + if (current.m_idx != bind.m_idx + || current.m_type != bind.m_type + || current.m_samplerFlags != bind.m_samplerFlags || programChanged) { if (kInvalidHandle != bind.m_idx) @@ -6204,7 +5829,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); case Binding::Texture: { TextureD3D11& texture = m_textures[bind.m_idx]; - texture.commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + texture.commit(stage, bind.m_samplerFlags, _render->m_colorPalette); } break; @@ -6244,7 +5869,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (programChanged || vertexStreamChanged) { - currentState.m_streamMask = draw.m_streamMask; + currentState.m_streamMask = draw.m_streamMask; currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; currentState.m_instanceDataOffset = draw.m_instanceDataOffset; currentState.m_instanceDataStride = draw.m_instanceDataStride; @@ -6256,34 +5881,38 @@ BX_PRAGMA_DIAGNOSTIC_POP(); uint32_t numVertices = draw.m_numVertices; uint8_t numStreams = 0; - for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams - ) + + if (UINT8_MAX != draw.m_streamMask) { - streamMask >>= ntz; - idx += ntz; + for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams + ) + { + streamMask >>= ntz; + idx += ntz; - currentState.m_stream[idx].m_decl = draw.m_stream[idx].m_decl; - currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; - currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; + currentState.m_stream[idx].m_decl = draw.m_stream[idx].m_decl; + currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; + currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; - uint16_t handle = draw.m_stream[idx].m_handle.idx; - const VertexBufferD3D11& vb = m_vertexBuffers[handle]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; - uint32_t stride = vertexDecl.m_stride; + const uint16_t handle = draw.m_stream[idx].m_handle.idx; + const VertexBufferD3D11& vb = m_vertexBuffers[handle]; + const uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const uint32_t stride = vertexDecl.m_stride; - buffers[numStreams] = vb.m_ptr; - strides[numStreams] = stride; - offsets[numStreams] = draw.m_stream[idx].m_startVertex * stride; - decls[numStreams] = &vertexDecl; + buffers[numStreams] = vb.m_ptr; + strides[numStreams] = stride; + offsets[numStreams] = draw.m_stream[idx].m_startVertex * stride; + decls[numStreams] = &vertexDecl; - numVertices = bx::uint32_min(UINT32_MAX == draw.m_numVertices - ? vb.m_size/stride - : draw.m_numVertices - , numVertices - ); + numVertices = bx::uint32_min(UINT32_MAX == draw.m_numVertices + ? vb.m_size/stride + : draw.m_numVertices + , numVertices + ); + } } currentState.m_numVertices = numVertices; @@ -6295,9 +5924,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (isValid(draw.m_instanceDataBuffer) ) { const VertexBufferD3D11& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; - uint32_t instStride = draw.m_instanceDataStride; + const uint32_t instStride = draw.m_instanceDataStride; deviceCtx->IASetVertexBuffers(numStreams, 1, &inst.m_ptr, &instStride, &draw.m_instanceDataOffset); - setInputLayout(numStreams, decls, m_program[programIdx], draw.m_instanceDataStride/16); + setInputLayout(numStreams, decls, m_program[programIdx], uint16_t(instStride/16) ); } else { @@ -6308,6 +5937,18 @@ BX_PRAGMA_DIAGNOSTIC_POP(); else { deviceCtx->IASetVertexBuffers(0, 1, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero); + + if (isValid(draw.m_instanceDataBuffer) ) + { + const VertexBufferD3D11& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; + const uint32_t instStride = draw.m_instanceDataStride; + deviceCtx->IASetVertexBuffers(0, 1, &inst.m_ptr, &instStride, &draw.m_instanceDataOffset); + setInputLayout(0, NULL, m_program[programIdx], uint16_t(instStride/16) ); + } + else + { + deviceCtx->IASetInputLayout(NULL); + } } } @@ -6356,7 +5997,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); : draw.m_numIndirect ; - multiDrawIndexedInstancedIndirect(numDrawIndirect + multiDrawIndexedInstancedIndirect( + numDrawIndirect , ptr , draw.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE , BGFX_CONFIG_DRAW_INDIRECT_STRIDE @@ -6369,7 +6011,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); : draw.m_numIndirect ; - multiDrawInstancedIndirect(numDrawIndirect + multiDrawInstancedIndirect( + numDrawIndirect , ptr , draw.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE , BGFX_CONFIG_DRAW_INDIRECT_STRIDE @@ -6484,7 +6127,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); if (0 < _render->m_numRenderItems) { - if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) + if (0 != (m_resolution.reset & BGFX_RESET_FLUSH_AFTER_RENDER) ) { deviceCtx->Flush(); } @@ -6535,7 +6178,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); perfStats.gpuTimerFreq = result.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; + perfStats.numBlit = _render->m_numBlitItems; perfStats.maxGpuLatency = maxGpuLatency; + bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); m_nvapi.getMemoryInfo(perfStats.gpuMemoryUsed, perfStats.gpuMemoryMax); if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) @@ -6556,7 +6201,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); tvm.clear(); uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f + tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f , " %s.%d (FL %d.%d) / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " , getRendererName() , m_deviceInterfaceVersion @@ -6564,7 +6209,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); , (m_featureLevel >> 8) & 0xf ); - const DXGI_ADAPTER_DESC& desc = m_adapterDesc; + const DXGI_ADAPTER_DESC& desc = m_dxgi.m_adapterDesc; char description[BX_COUNTOF(desc.Description)]; wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); tvm.printf(0, pos++, 0x8f, " Device: %s", description); @@ -6589,27 +6234,23 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); pos = 10; - tvm.printf(10, pos++, 0x8e, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " + tvm.printf(10, pos++, 0x8b, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " , double(frameTime)*toMs , double(min)*toMs , double(max)*toMs , freq/frameTime ); - char hmd[16]; - bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' '); - - const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy " - , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' + const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; + tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " + , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<m_numRenderItems , statsKeyType[0] , statsKeyType[1] @@ -6621,10 +6262,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); maxGpuLatency = 0; maxGpuElapsed = 0.0; - for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii) + for (uint32_t ii = 0; ii < Topology::Count; ++ii) { - tvm.printf(10, pos++, 0x8e, " %10s: %7d (#inst: %5d), submitted: %7d, indirect %7d" - , s_primName[ii] + tvm.printf(10, pos++, 0x8b, " %10s: %7d (#inst: %5d), submitted: %7d, indirect %7d" + , getName(Topology::Enum(ii) ) , statsNumPrimsRendered[ii] , statsNumInstances[ii] , statsNumPrimsSubmitted[ii] @@ -6632,23 +6273,23 @@ BX_PRAGMA_DIAGNOSTIC_POP(); ); } - if (NULL != m_renderdocdll) + if (NULL != m_renderDocDll) { - tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] "); + tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] "); } - tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); + tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); +// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); + tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); + tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); pos++; - tvm.printf(10, pos++, 0x8e, " Occlusion queries: %3d ", m_occlusionQuery.m_control.available() ); + tvm.printf(10, pos++, 0x8b, " Occlusion queries: %3d ", m_occlusionQuery.m_control.available() ); pos++; - tvm.printf(10, pos++, 0x8e, " State cache: "); - tvm.printf(10, pos++, 0x8e, " Blend | DepthS | Input | Raster | Sampler "); - tvm.printf(10, pos++, 0x8e, " %6d | %6d | %6d | %6d | %6d " + tvm.printf(10, pos++, 0x8b, " State cache: "); + tvm.printf(10, pos++, 0x8b, " Blend | DepthS | Input | Raster | Sampler "); + tvm.printf(10, pos++, 0x8b, " %6d | %6d | %6d | %6d | %6d " , m_blendStateCache.getCount() , m_depthStencilStateCache.getCount() , m_inputLayoutCache.getCount() @@ -6658,9 +6299,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); pos++; double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8e, " Capture: %7.4f [ms] ", captureMs); + tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms] ", captureMs); - uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attr[2] = { 0x8c, 0x8a }; uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %7.4f [ms] ", _render->m_waitSubmit*toMs); @@ -6682,6 +6323,16 @@ BX_PRAGMA_DIAGNOSTIC_POP(); PIX_ENDEVENT(); } + + m_deviceCtx->OMSetRenderTargets(1, s_zero.m_rtv, NULL); + + if (NULL != m_msaaRt) + { + ID3D11Texture2D* backBufferColor; + DX_CHECK(m_swapChain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&backBufferColor) ); + deviceCtx->ResolveSubresource(backBufferColor, 0, m_msaaRt, 0, m_scd.format); + DX_RELEASE(backBufferColor, 0); + } } } /* namespace d3d11 */ } // namespace bgfx @@ -6689,8 +6340,9 @@ BX_PRAGMA_DIAGNOSTIC_POP(); namespace bgfx { namespace d3d11 { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 699352d98e5..2e021c4aa2f 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -10,8 +10,8 @@ #define USE_D3D11_STAGING_BUFFER 0 #if !USE_D3D11_DYNAMIC_LIB -# undef BGFX_CONFIG_DEBUG_PIX -# define BGFX_CONFIG_DEBUG_PIX 0 +# undef BGFX_CONFIG_DEBUG_PIX +# define BGFX_CONFIG_DEBUG_PIX 0 #endif // !USE_D3D11_DYNAMIC_LIB BX_PRAGMA_DIAGNOSTIC_PUSH(); @@ -21,42 +21,36 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4005) // warning C4005: '' : macro redefinitio #include #define D3D11_NO_HELPERS #if BX_PLATFORM_WINDOWS -# include -# include +# include #elif BX_PLATFORM_WINRT -# include +# define __D3D10_1SHADER_H__ // BK - not used keep quiet! +# include #else -# include +# if !BGFX_CONFIG_DEBUG +# define D3DCOMPILE_NO_DEBUG_AND_ALL_FAST_SEMANTICS 1 +# endif // !BGFX_CONFIG_DEBUG +# include #endif // BX_PLATFORM_* BX_PRAGMA_DIAGNOSTIC_POP() #include "renderer.h" #include "renderer_d3d.h" #include "shader_dxbc.h" -#include "hmd.h" -#include "hmd_openvr.h" #include "debug_renderdoc.h" #include "nvapi.h" - -#ifndef D3DCOLOR_ARGB -# define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) ) -#endif // D3DCOLOR_ARGB - -#ifndef D3DCOLOR_RGBA -# define D3DCOLOR_RGBA(_r, _g, _b, _a) D3DCOLOR_ARGB(_a, _r, _g, _b) -#endif // D3DCOLOR_RGBA +#include "dxgi.h" #define BGFX_D3D11_BLEND_STATE_MASK (0 \ | BGFX_STATE_BLEND_MASK \ | BGFX_STATE_BLEND_EQUATION_MASK \ | BGFX_STATE_BLEND_INDEPENDENT \ | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE \ - | BGFX_STATE_ALPHA_WRITE \ - | BGFX_STATE_RGB_WRITE \ + | BGFX_STATE_WRITE_A \ + | BGFX_STATE_WRITE_RGB \ ) #define BGFX_D3D11_DEPTH_STENCIL_MASK (0 \ - | BGFX_STATE_DEPTH_WRITE \ + | BGFX_STATE_WRITE_Z \ | BGFX_STATE_DEPTH_TEST_MASK \ ) @@ -220,6 +214,38 @@ namespace bgfx { namespace d3d11 uint8_t m_numPredefined; }; + struct IntelDirectAccessResourceDescriptor + { + void* ptr; + uint32_t xoffset; + uint32_t yoffset; + uint32_t tileFormat; + uint32_t pitch; + uint32_t size; + }; + + struct DirectAccessResourceD3D11 + { + DirectAccessResourceD3D11() + : m_ptr(NULL) + , m_descriptor(NULL) + { + } + + void* createTexture2D(const D3D11_TEXTURE2D_DESC* _gpuDesc, const D3D11_SUBRESOURCE_DATA* _srd, ID3D11Texture2D** _gpuTexture2d); + void* createTexture3D(const D3D11_TEXTURE3D_DESC* _gpuDesc, const D3D11_SUBRESOURCE_DATA* _srd, ID3D11Texture3D** _gpuTexture3d); + void destroy(); + + union + { + ID3D11Resource* m_ptr; + ID3D11Texture2D* m_texture2d; + ID3D11Texture3D* m_texture3d; + }; + + IntelDirectAccessResourceDescriptor* m_descriptor; + }; + struct TextureD3D11 { enum Enum @@ -238,12 +264,12 @@ namespace bgfx { namespace d3d11 { } - void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); + void* create(const Memory* _mem, uint64_t _flags, uint8_t _skip); void destroy(); void overrideInternal(uintptr_t _ptr); void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]); - void resolve() const; + void resolve(uint8_t _resolve) const; TextureHandle getHandle() const; DXGI_FORMAT getSrvFormat() const; @@ -254,6 +280,8 @@ namespace bgfx { namespace d3d11 ID3D11Texture3D* m_texture3d; }; + DirectAccessResourceD3D11 m_dar; + union { ID3D11Resource* m_rt; @@ -262,7 +290,7 @@ namespace bgfx { namespace d3d11 ID3D11ShaderResourceView* m_srv; ID3D11UnorderedAccessView* m_uav; - uint32_t m_flags; + uint64_t m_flags; uint32_t m_width; uint32_t m_height; uint32_t m_depth; @@ -277,6 +305,7 @@ namespace bgfx { namespace d3d11 FrameBufferD3D11() : m_dsv(NULL) , m_swapChain(NULL) + , m_nwh(NULL) , m_width(0) , m_height(0) , m_denseIdx(UINT16_MAX) @@ -287,7 +316,7 @@ namespace bgfx { namespace d3d11 } void create(uint8_t _num, const Attachment* _attachment); - void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); + void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat); uint16_t destroy(); void preReset(bool _force = false); void postReset(); @@ -299,7 +328,8 @@ namespace bgfx { namespace d3d11 ID3D11RenderTargetView* m_rtv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; ID3D11DepthStencilView* m_dsv; - IDXGISwapChain* m_swapChain; + Dxgi::SwapChainI* m_swapChain; + void* m_nwh; uint32_t m_width; uint32_t m_height; diff --git a/3rdparty/bgfx/src/renderer_d3d12.cpp b/3rdparty/bgfx/src/renderer_d3d12.cpp index c38ad43a7d0..d577e63b609 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.cpp +++ b/3rdparty/bgfx/src/renderer_d3d12.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -8,9 +8,20 @@ #if BGFX_CONFIG_RENDERER_DIRECT3D12 # include "renderer_d3d12.h" +#if !BX_PLATFORM_WINDOWS +# include +# if BX_PLATFORM_WINRT +# include +# endif // BX_PLATFORM_WINRT +#endif // !BX_PLATFORM_WINDOWS + +#if BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT) +PFN_PIX_GET_THREAD_INFO bgfx_PIXGetThreadInfo; +PFN_PIX_EVENTS_REPLACE_BLOCK bgfx_PIXEventsReplaceBlock; +#endif // BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS + namespace bgfx { namespace d3d12 { - static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; struct PrimInfo @@ -27,18 +38,11 @@ namespace bgfx { namespace d3d12 { D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, 3, 3, 0 }, { D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, 3, 1, 2 }, { D3D_PRIMITIVE_TOPOLOGY_LINELIST, D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE, 2, 2, 0 }, + { D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE, 2, 1, 1 }, { D3D_PRIMITIVE_TOPOLOGY_POINTLIST, D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT, 1, 1, 0 }, { D3D_PRIMITIVE_TOPOLOGY_UNDEFINED, D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED, 0, 0, 0 }, }; - - static const char* s_primName[] = - { - "TriList", - "TriStrip", - "Line", - "Point", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName)+1); + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo)-1); static const uint32_t s_checkMsaa[] = { @@ -174,82 +178,91 @@ namespace bgfx { namespace d3d12 static const TextureFormatInfo s_textureFormat[] = { - { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC1_UNORM_SRGB }, // BC1 - { DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC2_UNORM_SRGB }, // BC2 - { DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC3_UNORM_SRGB }, // BC3 - { DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC4 - { DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC5 - { DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC6H - { DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC7_UNORM_SRGB }, // BC7 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC1 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A1 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12A - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14A - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC22 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC24 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // Unknown - { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R1 - { DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // A8 - { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8 - { DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8I - { DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8U - { DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8S - { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16 - { DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16I - { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16U - { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16F - { DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16S - { DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32I - { DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32U - { DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32F - { DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8 - { DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8I - { DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8U - { DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8S - { DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16 - { DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16I - { DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16U - { DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16F - { DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16S - { DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32I - { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32U - { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32F - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8 - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8I - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8U - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8S - { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB9E5F - { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB }, // BGRA8 - { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8 - { DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8I - { DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8U - { DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA8S - { DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16 - { DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16I - { DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16U - { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16F - { DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16S - { DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32I - { DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32U - { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32F - { DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R5G6B5 - { DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA4 - { DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB5A1 - { DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB10A2 - { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG11B10F - { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // UnknownDepth - { DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_UNKNOWN }, // D16 - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24 - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24S8 - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D32 - { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D16F - { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D24F - { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D32F - { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D0S8 + { DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC1_UNORM_SRGB }, // BC1 + { DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC2_UNORM_SRGB }, // BC2 + { DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC3_UNORM_SRGB }, // BC3 + { DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_BC4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC4 + { DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_BC5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC5 + { DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_BC6H_SF16, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // BC6H + { DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_BC7_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_BC7_UNORM_SRGB }, // BC7 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC1 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ETC2A1 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC12A + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC14A + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC22 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // PTC24 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ATC + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ATCE + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // ATCI + { DXGI_FORMAT_ASTC_4X4_UNORM, DXGI_FORMAT_ASTC_4X4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_4X4_UNORM_SRGB }, // ASTC4x4 + { DXGI_FORMAT_ASTC_5X5_UNORM, DXGI_FORMAT_ASTC_5X5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_5X5_UNORM_SRGB }, // ASTC5x5 + { DXGI_FORMAT_ASTC_6X6_UNORM, DXGI_FORMAT_ASTC_6X6_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_6X6_UNORM_SRGB }, // ASTC6x6 + { DXGI_FORMAT_ASTC_8X5_UNORM, DXGI_FORMAT_ASTC_8X5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_8X5_UNORM_SRGB }, // ASTC8x5 + { DXGI_FORMAT_ASTC_8X6_UNORM, DXGI_FORMAT_ASTC_8X6_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_8X6_UNORM_SRGB }, // ASTC8x6 + { DXGI_FORMAT_ASTC_10X5_UNORM, DXGI_FORMAT_ASTC_10X5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_ASTC_10X5_UNORM_SRGB }, // ASTC10x5 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // Unknown + { DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_R1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R1 + { DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // A8 + { DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8 + { DXGI_FORMAT_R8_SINT, DXGI_FORMAT_R8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8I + { DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8U + { DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_R8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R8S + { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16 + { DXGI_FORMAT_R16_SINT, DXGI_FORMAT_R16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16I + { DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16U + { DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16F + { DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_R16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R16S + { DXGI_FORMAT_R32_SINT, DXGI_FORMAT_R32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32I + { DXGI_FORMAT_R32_UINT, DXGI_FORMAT_R32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32U + { DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R32F + { DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8 + { DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_R8G8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8I + { DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_R8G8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8U + { DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_R8G8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG8S + { DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_R16G16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16 + { DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_R16G16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16I + { DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_R16G16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16U + { DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16F + { DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_R16G16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG16S + { DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_R32G32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32I + { DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_R32G32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32U + { DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG32F + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8 + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8I + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8U + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB8S + { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB9E5F + { DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_B8G8R8A8_UNORM_SRGB }, // BGRA8 + { DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8 + { DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_R8G8B8A8_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8I + { DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_R8G8B8A8_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB }, // RGBA8U + { DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_R8G8B8A8_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA8S + { DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16 + { DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_R16G16B16A16_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16I + { DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_R16G16B16A16_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16U + { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16F + { DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_R16G16B16A16_SNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA16S + { DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_R32G32B32A32_SINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32I + { DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_R32G32B32A32_UINT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32U + { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA32F + { DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_B5G6R5_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // R5G6B5 + { DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_B4G4R4A4_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGBA4 + { DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_B5G5R5A1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB5A1 + { DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RGB10A2 + { DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_R11G11B10_FLOAT, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // RG11B10F + { DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN }, // UnknownDepth + { DXGI_FORMAT_R16_TYPELESS, DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_D16_UNORM, DXGI_FORMAT_UNKNOWN }, // D16 + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24 + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D24S8 + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D32 + { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D16F + { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D24F + { DXGI_FORMAT_R32_TYPELESS, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_D32_FLOAT, DXGI_FORMAT_UNKNOWN }, // D32F + { DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_UNKNOWN }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) ); @@ -311,7 +324,7 @@ namespace bgfx { namespace d3d12 }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - static D3D12_INPUT_ELEMENT_DESC* fillVertexDecl(D3D12_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) + static D3D12_INPUT_ELEMENT_DESC* fillVertexDecl(uint8_t _stream, D3D12_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) { D3D12_INPUT_ELEMENT_DESC* elem = _out; @@ -321,6 +334,8 @@ namespace bgfx { namespace d3d12 { bx::memCopy(elem, &s_attrib[attr], sizeof(D3D12_INPUT_ELEMENT_DESC) ); + elem->InputSlot = _stream; + if (0 == _decl.m_attributes[attr]) { elem->AlignedByteOffset = 0; @@ -355,31 +370,51 @@ namespace bgfx { namespace d3d12 _commandList->ResourceBarrier(1, &barrier); } -#if USE_D3D12_DYNAMIC_LIB - static const GUID IID_ID3D12CommandAllocator = { 0x6102dee4, 0xaf59, 0x4b09, { 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24 } }; - static const GUID IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } }; - static const GUID IID_ID3D12CommandSignature = { 0xc36a797c, 0xec80, 0x4f0a, { 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1 } }; - static const GUID IID_ID3D12Debug = { 0x344488b7, 0x6846, 0x474b, { 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0 } }; - static const GUID IID_ID3D12DescriptorHeap = { 0x8efb471d, 0x616c, 0x4f49, { 0x90, 0xf7, 0x12, 0x7b, 0xb7, 0x63, 0xfa, 0x51 } }; - static const GUID IID_ID3D12Device = { 0x189819f1, 0x1db6, 0x4b57, { 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7 } }; - static const GUID IID_ID3D12Fence = { 0x0a753dcf, 0xc4d8, 0x4b91, { 0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76 } }; - static const GUID IID_ID3D12GraphicsCommandList = { 0x5b160d0f, 0xac1b, 0x4185, { 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55 } }; - static const GUID IID_ID3D12InfoQueue = { 0x0742a90b, 0xc387, 0x483f, { 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58 } }; - static const GUID IID_ID3D12PipelineState = { 0x765a30f3, 0xf624, 0x4c6f, { 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45 } }; - static const GUID IID_ID3D12Resource = { 0x696442be, 0xa72e, 0x4059, { 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad } }; - static const GUID IID_ID3D12RootSignature = { 0xc54a6b66, 0x72df, 0x4ee8, { 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14 } }; - static const GUID IID_ID3D12QueryHeap = { 0x0d9658ae, 0xed45, 0x469e, { 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4 } }; - static const GUID IID_IDXGIFactory4 = { 0x1bc6ea02, 0xef36, 0x464f, { 0xbf, 0x0c, 0x21, 0xca, 0x39, 0xe5, 0x16, 0x8a } }; -#else - static const GUID IID_ID3D12CommandSignature = { 0xc36a797c, 0xec80, 0x4f0a, { 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1 } }; - static const GUID IID_ID3D12QueryHeap = { 0x0d9658ae, 0xed45, 0x469e, { 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4 } }; -#endif // USE_D3D12_DYNAMIC_LIB + BX_PRAGMA_DIAGNOSTIC_PUSH(); + BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunused-const-variable"); + BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunneeded-internal-declaration"); + + static const GUID IID_ID3D12CommandAllocator = { 0x6102dee4, 0xaf59, 0x4b09, { 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24 } }; + static const GUID IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, { 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed } }; + static const GUID IID_ID3D12CommandSignature = { 0xc36a797c, 0xec80, 0x4f0a, { 0x89, 0x85, 0xa7, 0xb2, 0x47, 0x50, 0x82, 0xd1 } }; + static const GUID IID_ID3D12Debug = { 0x344488b7, 0x6846, 0x474b, { 0xb9, 0x89, 0xf0, 0x27, 0x44, 0x82, 0x45, 0xe0 } }; + static const GUID IID_ID3D12Debug1 = { 0xaffaa4ca, 0x63fe, 0x4d8e, { 0xb8, 0xad, 0x15, 0x90, 0x00, 0xaf, 0x43, 0x04 } }; + static const GUID IID_ID3D12DescriptorHeap = { 0x8efb471d, 0x616c, 0x4f49, { 0x90, 0xf7, 0x12, 0x7b, 0xb7, 0x63, 0xfa, 0x51 } }; + static const GUID IID_ID3D12Device = { 0x189819f1, 0x1db6, 0x4b57, { 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7 } }; + static const GUID IID_ID3D12Device1 = { 0x77acce80, 0x638e, 0x4e65, { 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e } }; + static const GUID IID_ID3D12Device2 = { 0x30baa41e, 0xb15b, 0x475c, { 0xa0, 0xbb, 0x1a, 0xf5, 0xc5, 0xb6, 0x43, 0x28 } }; + static const GUID IID_ID3D12Device3 = { 0x81dadc15, 0x2bad, 0x4392, { 0x93, 0xc5, 0x10, 0x13, 0x45, 0xc4, 0xaa, 0x98 } }; + static const GUID IID_ID3D12Device4 = { 0xe865df17, 0xa9ee, 0x46f9, { 0xa4, 0x63, 0x30, 0x98, 0x31, 0x5a, 0xa2, 0xe5 } }; + static const GUID IID_ID3D12Device5 = { 0x8b4f173b, 0x2fea, 0x4b80, { 0x8f, 0x58, 0x43, 0x07, 0x19, 0x1a, 0xb9, 0x5d } }; + static const GUID IID_ID3D12Fence = { 0x0a753dcf, 0xc4d8, 0x4b91, { 0xad, 0xf6, 0xbe, 0x5a, 0x60, 0xd9, 0x5a, 0x76 } }; + static const GUID IID_ID3D12GraphicsCommandList = { 0x5b160d0f, 0xac1b, 0x4185, { 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55 } }; + static const GUID IID_ID3D12GraphicsCommandList1 = { 0x553103fb, 0x1fe7, 0x4557, { 0xbb, 0x38, 0x94, 0x6d, 0x7d, 0x0e, 0x7c, 0xa7 } }; + static const GUID IID_ID3D12GraphicsCommandList2 = { 0x38C3E585, 0xFF17, 0x412C, { 0x91, 0x50, 0x4F, 0xC6, 0xF9, 0xD7, 0x2A, 0x28 } }; + static const GUID IID_ID3D12GraphicsCommandList3 = { 0x6FDA83A7, 0xB84C, 0x4E38, { 0x9A, 0xC8, 0xC7, 0xBD, 0x22, 0x01, 0x6B, 0x3D } }; + static const GUID IID_ID3D12GraphicsCommandList4 = { 0x8754318e, 0xd3a9, 0x4541, { 0x98, 0xcf, 0x64, 0x5b, 0x50, 0xdc, 0x48, 0x74 } }; + static const GUID IID_ID3D12InfoQueue = { 0x0742a90b, 0xc387, 0x483f, { 0xb9, 0x46, 0x30, 0xa7, 0xe4, 0xe6, 0x14, 0x58 } }; + static const GUID IID_ID3D12PipelineState = { 0x765a30f3, 0xf624, 0x4c6f, { 0xa8, 0x28, 0xac, 0xe9, 0x48, 0x62, 0x24, 0x45 } }; + static const GUID IID_ID3D12Resource = { 0x696442be, 0xa72e, 0x4059, { 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad } }; + static const GUID IID_ID3D12RootSignature = { 0xc54a6b66, 0x72df, 0x4ee8, { 0x8b, 0xe5, 0xa9, 0x46, 0xa1, 0x42, 0x92, 0x14 } }; + static const GUID IID_ID3D12QueryHeap = { 0x0d9658ae, 0xed45, 0x469e, { 0xa6, 0x1d, 0x97, 0x0e, 0xc5, 0x83, 0xca, 0xb4 } }; + + BX_PRAGMA_DIAGNOSTIC_POP(); + + static const GUID s_d3dDeviceIIDs[] = + { + IID_ID3D12Device5, + IID_ID3D12Device4, + IID_ID3D12Device3, + IID_ID3D12Device2, + IID_ID3D12Device1, + }; struct HeapProperty { enum Enum { Default, + Texture, Upload, ReadBack, @@ -390,30 +425,71 @@ namespace bgfx { namespace d3d12 D3D12_RESOURCE_STATES m_state; }; - static const HeapProperty s_heapProperties[] = + static HeapProperty s_heapProperties[] = { - { { D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }, D3D12_RESOURCE_STATE_COMMON }, - { { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }, D3D12_RESOURCE_STATE_GENERIC_READ }, - { { D3D12_HEAP_TYPE_READBACK, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 1, 1 }, D3D12_RESOURCE_STATE_COPY_DEST }, + { { D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 0, 0 }, D3D12_RESOURCE_STATE_COMMON }, + { { D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 0, 0 }, D3D12_RESOURCE_STATE_COMMON }, + { { D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 0, 0 }, D3D12_RESOURCE_STATE_GENERIC_READ }, + { { D3D12_HEAP_TYPE_READBACK, D3D12_CPU_PAGE_PROPERTY_UNKNOWN, D3D12_MEMORY_POOL_UNKNOWN, 0, 0 }, D3D12_RESOURCE_STATE_COPY_DEST }, }; BX_STATIC_ASSERT(BX_COUNTOF(s_heapProperties) == HeapProperty::Count); - ID3D12Resource* createCommittedResource(ID3D12Device* _device, HeapProperty::Enum _heapProperty, D3D12_RESOURCE_DESC* _resourceDesc, D3D12_CLEAR_VALUE* _clearValue) + static inline D3D12_HEAP_PROPERTIES ID3D12DeviceGetCustomHeapProperties(ID3D12Device *device, UINT nodeMask, D3D12_HEAP_TYPE heapType) + { + // NOTICE: gcc trick for return struct + union { + D3D12_HEAP_PROPERTIES (STDMETHODCALLTYPE ID3D12Device::*w)(UINT, D3D12_HEAP_TYPE); + void (STDMETHODCALLTYPE ID3D12Device::*f)(D3D12_HEAP_PROPERTIES *, UINT, D3D12_HEAP_TYPE); + } conversion = { &ID3D12Device::GetCustomHeapProperties }; + D3D12_HEAP_PROPERTIES ret; + (device->*conversion.f)(&ret, nodeMask, heapType); + return ret; + } + + static void initHeapProperties(ID3D12Device* _device, D3D12_HEAP_PROPERTIES& _properties) + { + if (D3D12_HEAP_TYPE_CUSTOM != _properties.Type) + { + _properties = ID3D12DeviceGetCustomHeapProperties(_device, 1, _properties.Type); + } + } + + static void initHeapProperties(ID3D12Device* _device) + { +#if BX_PLATFORM_WINDOWS + initHeapProperties(_device, s_heapProperties[HeapProperty::Default ].m_properties); + initHeapProperties(_device, s_heapProperties[HeapProperty::Texture ].m_properties); + initHeapProperties(_device, s_heapProperties[HeapProperty::Upload ].m_properties); + initHeapProperties(_device, s_heapProperties[HeapProperty::ReadBack].m_properties); +#endif // BX_PLATFORM_WINDOWS + } + + ID3D12Resource* createCommittedResource(ID3D12Device* _device, HeapProperty::Enum _heapProperty, const D3D12_RESOURCE_DESC* _resourceDesc, const D3D12_CLEAR_VALUE* _clearValue, bool _memSet = false) { const HeapProperty& heapProperty = s_heapProperties[_heapProperty]; ID3D12Resource* resource; DX_CHECK(_device->CreateCommittedResource(&heapProperty.m_properties - , D3D12_HEAP_FLAG_NONE - , _resourceDesc - , heapProperty.m_state - , _clearValue - , IID_ID3D12Resource - , (void**)&resource - ) ); + , D3D12_HEAP_FLAG_NONE + , _resourceDesc + , heapProperty.m_state + , _clearValue + , IID_ID3D12Resource + , (void**)&resource + ) ); BX_WARN(NULL != resource, "CreateCommittedResource failed (size: %d). Out of memory?" , _resourceDesc->Width ); + if (BX_ENABLED(BX_PLATFORM_XBOXONE) + && _memSet) + { + void* ptr; + DX_CHECK(resource->Map(0, NULL, &ptr) ); + D3D12_RESOURCE_ALLOCATION_INFO rai = _device->GetResourceAllocationInfo(1, 1, _resourceDesc); + bx::memSet(ptr, 0, size_t(rai.SizeInBytes) ); + resource->Unmap(0, NULL); + } + return resource; } @@ -493,10 +569,10 @@ namespace bgfx { namespace d3d12 } #if USE_D3D12_DYNAMIC_LIB - static PFN_D3D12_CREATE_DEVICE D3D12CreateDevice; - static PFN_D3D12_GET_DEBUG_INTERFACE D3D12GetDebugInterface; - static PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignature; - static PFN_CREATE_DXGI_FACTORY CreateDXGIFactory1; + static PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES D3D12EnableExperimentalFeatures; + static PFN_D3D12_CREATE_DEVICE D3D12CreateDevice; + static PFN_D3D12_GET_DEBUG_INTERFACE D3D12GetDebugInterface; + static PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignature; typedef HANDLE (WINAPI* PFN_CREATE_EVENT_EX_A)(LPSECURITY_ATTRIBUTES _attrs, LPCSTR _name, DWORD _flags, DWORD _access); static PFN_CREATE_EVENT_EX_A CreateEventExA; @@ -508,8 +584,11 @@ namespace bgfx { namespace d3d12 return _heap->GetCPUDescriptorHandleForHeapStart(); #else D3D12_CPU_DESCRIPTOR_HANDLE handle; - typedef void (WINAPI ID3D12DescriptorHeap::*PFN_GET_CPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(D3D12_CPU_DESCRIPTOR_HANDLE *); - (_heap->*(PFN_GET_CPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(&ID3D12DescriptorHeap::GetCPUDescriptorHandleForHeapStart) )(&handle); + union { + D3D12_CPU_DESCRIPTOR_HANDLE (WINAPI ID3D12DescriptorHeap::*w)(); + void (WINAPI ID3D12DescriptorHeap::*f)(D3D12_CPU_DESCRIPTOR_HANDLE *); + } conversion = { &ID3D12DescriptorHeap::GetCPUDescriptorHandleForHeapStart }; + (_heap->*conversion.f)(&handle); return handle; #endif // BX_COMPILER_MSVC } @@ -520,8 +599,11 @@ namespace bgfx { namespace d3d12 return _heap->GetGPUDescriptorHandleForHeapStart(); #else D3D12_GPU_DESCRIPTOR_HANDLE handle; - typedef void (WINAPI ID3D12DescriptorHeap::*PFN_GET_GPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(D3D12_GPU_DESCRIPTOR_HANDLE *); - (_heap->*(PFN_GET_GPU_DESCRIPTOR_HANDLE_FOR_HEAP_START)(&ID3D12DescriptorHeap::GetGPUDescriptorHandleForHeapStart) )(&handle); + union { + D3D12_GPU_DESCRIPTOR_HANDLE (WINAPI ID3D12DescriptorHeap::*w)(); + void (WINAPI ID3D12DescriptorHeap::*f)(D3D12_GPU_DESCRIPTOR_HANDLE *); + } conversion = { &ID3D12DescriptorHeap::GetGPUDescriptorHandleForHeapStart }; + (_heap->*conversion.f)(&handle); return handle; #endif // BX_COMPILER_MSVC } @@ -531,20 +613,39 @@ namespace bgfx { namespace d3d12 #if BX_COMPILER_MSVC return _resource->GetDesc(); #else - typedef void (STDMETHODCALLTYPE ID3D12Resource::*PFN_GET_GET_DESC)(D3D12_RESOURCE_DESC*); D3D12_RESOURCE_DESC desc; - (_resource->*(PFN_GET_GET_DESC)(&ID3D12Resource::GetDesc))(&desc); + union { + D3D12_RESOURCE_DESC (STDMETHODCALLTYPE ID3D12Resource::*w)(); + void (STDMETHODCALLTYPE ID3D12Resource::*f)(D3D12_RESOURCE_DESC *); + } conversion = { &ID3D12Resource::GetDesc }; + (_resource->*conversion.f)(&desc); return desc; #endif // BX_COMPILER_MSVC } +#if BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT) + static PIXEventsThreadInfo s_pixEventsThreadInfo; + + PIXEventsThreadInfo* WINAPI stubPIXGetThreadInfo() + { + return &s_pixEventsThreadInfo; + } + + uint64_t WINAPI stubPIXEventsReplaceBlock(bool _getEarliestTime) + { + BX_UNUSED(_getEarliestTime); + return 0; + } +#endif // BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS + struct RendererContextD3D12 : public RendererContextI { RendererContextD3D12() - : m_d3d12dll(NULL) - , m_dxgidll(NULL) - , m_renderdocdll(NULL) + : m_d3d12Dll(NULL) + , m_renderDocDll(NULL) + , m_winPixEvent(NULL) , m_featureLevel(D3D_FEATURE_LEVEL(0) ) + , m_swapChain(NULL) , m_wireframe(false) , m_lost(false) , m_maxAnisotropy(1) @@ -553,6 +654,7 @@ namespace bgfx { namespace d3d12 , m_vsChanges(0) , m_backBufferColorIdx(0) , m_rtMsaa(false) + , m_directAccessSupport(false) { } @@ -560,7 +662,7 @@ namespace bgfx { namespace d3d12 { } - bool init() + bool init(const Init& _init) { struct ErrorState { @@ -576,24 +678,46 @@ namespace bgfx { namespace d3d12 }; ErrorState::Enum errorState = ErrorState::Default; - LUID luid; +// LUID luid; - m_renderdocdll = loadRenderDoc(); - setGraphicsDebuggerPresent(NULL != m_renderdocdll); +#if BGFX_CONFIG_DEBUG_PIX && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT) + m_winPixEvent = bx::dlopen("WinPixEventRuntime.dll"); + + if (NULL != m_winPixEvent) + { + bgfx_PIXGetThreadInfo = (PFN_PIX_GET_THREAD_INFO )bx::dlsym(m_winPixEvent, "PIXGetThreadInfo"); + bgfx_PIXEventsReplaceBlock = (PFN_PIX_EVENTS_REPLACE_BLOCK)bx::dlsym(m_winPixEvent, "PIXEventsReplaceBlock"); + } + + if (NULL == bgfx_PIXGetThreadInfo + || NULL == bgfx_PIXEventsReplaceBlock) + { + bgfx_PIXGetThreadInfo = stubPIXGetThreadInfo; + bgfx_PIXEventsReplaceBlock = stubPIXEventsReplaceBlock; + } +#endif // BGFX_CONFIG_DEBUG_PIX && BX_PLATFORM_WINDOWS + + if (_init.debug + || _init.profile) + { + m_renderDocDll = loadRenderDoc(); + } + + setGraphicsDebuggerPresent(NULL != m_renderDocDll || NULL != m_winPixEvent); m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); #if USE_D3D12_DYNAMIC_LIB - m_kernel32dll = bx::dlopen("kernel32.dll"); - if (NULL == m_kernel32dll) + m_kernel32Dll = bx::dlopen("kernel32.dll"); + if (NULL == m_kernel32Dll) { BX_TRACE("Init error: Failed to load kernel32.dll."); goto error; } - CreateEventExA = (PFN_CREATE_EVENT_EX_A)bx::dlsym(m_kernel32dll, "CreateEventExA"); + CreateEventExA = (PFN_CREATE_EVENT_EX_A)bx::dlsym(m_kernel32Dll, "CreateEventExA"); if (NULL == CreateEventExA) { BX_TRACE("Init error: Function CreateEventExA not found."); @@ -602,8 +726,10 @@ namespace bgfx { namespace d3d12 errorState = ErrorState::LoadedKernel32; - m_d3d12dll = bx::dlopen("d3d12.dll"); - if (NULL == m_d3d12dll) + m_nvapi.init(); + + m_d3d12Dll = bx::dlopen("d3d12.dll"); + if (NULL == m_d3d12Dll) { BX_TRACE("Init error: Failed to load d3d12.dll."); goto error; @@ -611,13 +737,16 @@ namespace bgfx { namespace d3d12 errorState = ErrorState::LoadedD3D12; - D3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)bx::dlsym(m_d3d12dll, "D3D12CreateDevice"); + D3D12EnableExperimentalFeatures = (PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES)bx::dlsym(m_d3d12Dll, "D3D12EnableExperimentalFeatures"); + BX_WARN(NULL != D3D12EnableExperimentalFeatures, "Function D3D12EnableExperimentalFeatures not found."); + + D3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)bx::dlsym(m_d3d12Dll, "D3D12CreateDevice"); BX_WARN(NULL != D3D12CreateDevice, "Function D3D12CreateDevice not found."); - D3D12GetDebugInterface = (PFN_D3D12_GET_DEBUG_INTERFACE)bx::dlsym(m_d3d12dll, "D3D12GetDebugInterface"); + D3D12GetDebugInterface = (PFN_D3D12_GET_DEBUG_INTERFACE)bx::dlsym(m_d3d12Dll, "D3D12GetDebugInterface"); BX_WARN(NULL != D3D12GetDebugInterface, "Function D3D12GetDebugInterface not found."); - D3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)bx::dlsym(m_d3d12dll, "D3D12SerializeRootSignature"); + D3D12SerializeRootSignature = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)bx::dlsym(m_d3d12Dll, "D3D12SerializeRootSignature"); BX_WARN(NULL != D3D12SerializeRootSignature, "Function D3D12SerializeRootSignature not found."); if (NULL == D3D12CreateDevice @@ -627,109 +756,61 @@ namespace bgfx { namespace d3d12 BX_TRACE("Init error: Function not found."); goto error; } - - m_dxgidll = bx::dlopen("dxgi.dll"); - - if (NULL == m_dxgidll) - { - BX_TRACE("Init error: Failed to load dxgi.dll."); - goto error; - } - - CreateDXGIFactory1 = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgidll, "CreateDXGIFactory1"); - - if (NULL == CreateDXGIFactory1) - { - BX_TRACE("Init error: Function CreateDXGIFactory1 not found."); - goto error; - } #endif // USE_D3D12_DYNAMIC_LIB + if (!m_dxgi.init(g_caps) ) + { + goto error; + } + errorState = ErrorState::LoadedDXGI; HRESULT hr; -#if BX_PLATFORM_WINDOWS - hr = CreateDXGIFactory1(IID_IDXGIFactory4, (void**)&m_factory); -#else - hr = S_OK; - m_factory = NULL; -#endif // BX_PLATFORM_* - - if (FAILED(hr) ) + if (_init.debug + || _init.profile) { - BX_TRACE("Init error: Unable to create DXGI factory."); - goto error; - } - - errorState = ErrorState::CreatedDXGIFactory; - - m_adapter = NULL; - m_driverType = D3D_DRIVER_TYPE_HARDWARE; - - if (NULL != m_factory) - { -#if BX_PLATFORM_WINDOWS - IDXGIAdapter3* adapter; -#else - IDXGIAdapter* adapter; -#endif // BX_PLATFORM_* - for (uint32_t ii = 0; DXGI_ERROR_NOT_FOUND != m_factory->EnumAdapters(ii, reinterpret_cast(&adapter) ); ++ii) - { - DXGI_ADAPTER_DESC desc; - hr = adapter->GetDesc(&desc); - if (SUCCEEDED(hr) ) - { - BX_TRACE("Adapter #%d", ii); - - char description[BX_COUNTOF(desc.Description)]; - wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); - BX_TRACE("\tDescription: %s", description); - BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x" - , desc.VendorId - , desc.DeviceId - , desc.SubSysId - , desc.Revision - ); - BX_TRACE("\tMemory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)" - , desc.DedicatedVideoMemory - , desc.DedicatedSystemMemory - , desc.SharedSystemMemory - ); - - g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; - g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; - ++g_caps.numGPUs; - - if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) - && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) - && (0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) - { - m_adapter = adapter; - m_adapter->AddRef(); - m_driverType = D3D_DRIVER_TYPE_UNKNOWN; - } - - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != bx::strFind(description, "PerfHUD") ) - { - m_adapter = adapter; - m_driverType = D3D_DRIVER_TYPE_REFERENCE; - } - } - - DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0); - } - } - - if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) - { - ID3D12Debug* debug; - hr = D3D12GetDebugInterface(IID_ID3D12Debug, (void**)&debug); + ID3D12Debug* debug0; + hr = D3D12GetDebugInterface(IID_ID3D12Debug, (void**)&debug0); if (SUCCEEDED(hr) ) { - debug->EnableDebugLayer(); + uint32_t debugFlags = 0; + + if (_init.debug) + { +#if BX_PLATFORM_WINDOWS + debug0->EnableDebugLayer(); + + { + ID3D12Debug1* debug1; + hr = debug0->QueryInterface(IID_ID3D12Debug1, (void**)&debug1); + + if (SUCCEEDED(hr) ) + { +// debug1->SetEnableGPUBasedValidation(true); +// debug1->SetEnableSynchronizedCommandQueueValidation(true); + } + + DX_RELEASE(debug1, 1); + } +#elif BX_PLATFORM_XBOXONE + debugFlags |= D3D12_PROCESS_DEBUG_FLAG_DEBUG_LAYER_ENABLED; +#endif // BX_PLATFORM_WINDOWS + } + +#if BX_PLATFORM_XBOXONE + // https://github.com/Microsoft/Xbox-ATG-Samples/blob/76d236e3bd372aceec18b2ad0556a7879dbd9628/XDKSamples/IntroGraphics/SimpleTriangle12/DeviceResources.cpp#L67 + debugFlags |= _init.profile ? D3D12XBOX_PROCESS_DEBUG_FLAG_INSTRUMENTED : 0; + + if (0 != debugFlags) + { + debug0->SetProcessDebugFlags(D3D12XBOX_PROCESS_DEBUG_FLAGS(debugFlags) ); + } +#endif // BX_PLATFORM_XBOXONE + BX_UNUSED(debugFlags); + + DX_RELEASE(debug0, 0); } } @@ -745,7 +826,7 @@ namespace bgfx { namespace d3d12 hr = E_FAIL; for (uint32_t ii = 0; ii < BX_COUNTOF(featureLevel) && FAILED(hr); ++ii) { - hr = D3D12CreateDevice(m_adapter + hr = D3D12CreateDevice(m_dxgi.m_adapter , featureLevel[ii] , IID_ID3D12Device , (void**)&m_device @@ -761,45 +842,39 @@ namespace bgfx { namespace d3d12 if (FAILED(hr) ) { BX_TRACE("Init error: Unable to create Direct3D12 device."); + if (BX_ENABLED(BX_PLATFORM_WINRT) ) + { + BX_TRACE("Hint: Change UWP app to game?"); + } goto error; } - if (NULL != m_factory) + m_dxgi.update(m_device); + { - bx::memSet(&m_adapterDesc, 0, sizeof(m_adapterDesc) ); -// NOTICE: -// LUID STDMETHODCALLTYPE ID3D12Device::GetAdapterLuid() has a different behaviour in gcc , -// because gcc64 returns small struct in RAX, but the microsoft implemention of ID3D12Device::GetAdapterLuid() in d3d12.dll -// pass the struct LUID's address as the second parameter. - typedef void (STDMETHODCALLTYPE ID3D12Device::*ID3D12Device_GetAdapterLuid_f)(LUID *); - (m_device->*(ID3D12Device_GetAdapterLuid_f)(&ID3D12Device::GetAdapterLuid))(&luid); -#if BX_PLATFORM_WINDOWS - IDXGIAdapter3* adapter; -#else - IDXGIAdapter* adapter; -#endif // BX_PLATFORM_* - for (uint32_t ii = 0; DXGI_ERROR_NOT_FOUND != m_factory->EnumAdapters(ii, reinterpret_cast(&adapter) ); ++ii) + m_deviceInterfaceVersion = 0; + for (uint32_t ii = 0; ii < BX_COUNTOF(s_d3dDeviceIIDs); ++ii) { - adapter->GetDesc(&m_adapterDesc); - if (m_adapterDesc.AdapterLuid.LowPart == luid.LowPart - && m_adapterDesc.AdapterLuid.HighPart == luid.HighPart) + ID3D12Device* device; + hr = m_device->QueryInterface(s_d3dDeviceIIDs[ii], (void**)&device); + if (SUCCEEDED(hr) ) { - if (NULL == m_adapter) - { - m_adapter = adapter; - } - else - { - DX_RELEASE(adapter, 0); - } + device->Release(); // BK - ignore ref count. + m_deviceInterfaceVersion = BX_COUNTOF(s_d3dDeviceIIDs) - ii; break; } - DX_RELEASE(adapter, 0); } } - g_caps.vendorId = (uint16_t)m_adapterDesc.VendorId; - g_caps.deviceId = (uint16_t)m_adapterDesc.DeviceId; +#if BX_PLATFORM_XBOXONE + m_device->SetDebugErrorFilterX(0x73EC9EAF, D3D12XBOX_DEBUG_FILTER_FLAG_DISABLE_BREAKS); + m_device->SetDebugErrorFilterX(0x8EC9B15C, D3D12XBOX_DEBUG_FILTER_FLAG_DISABLE_OUTPUT); +#endif // BX_PLATFORM_XBOXONE + + if (BGFX_PCI_ID_NVIDIA != m_dxgi.m_adapterDesc.VendorId) + { + m_nvapi.shutdown(); + } { uint32_t numNodes = m_device->GetNodeCount(); @@ -810,11 +885,11 @@ namespace bgfx { namespace d3d12 architecture.NodeIndex = ii; DX_CHECK(m_device->CheckFeatureSupport(D3D12_FEATURE_ARCHITECTURE, &architecture, sizeof(architecture) ) ); BX_TRACE("\tNode % 2d: TileBasedRenderer %d, UMA %d, CacheCoherentUMA %d" - , ii - , architecture.TileBasedRenderer - , architecture.UMA - , architecture.CacheCoherentUMA - ); + , ii + , architecture.TileBasedRenderer + , architecture.UMA + , architecture.CacheCoherentUMA + ); if (0 == ii) { bx::memCopy(&m_architecture, &architecture, sizeof(architecture) ); @@ -822,36 +897,6 @@ namespace bgfx { namespace d3d12 } } -#if !BX_PLATFORM_WINDOWS - if (NULL == m_factory) - { - IDXGIDevice1* dxgiDevice; - hr = m_device->QueryInterface(IID_IDXGIDevice1, (void**)&dxgiDevice); - - if (FAILED(hr) ) - { - BX_TRACE("Init error: Unable to query IDXGIDevice1 interface 0x%08x.", hr); - goto error; - } - - hr = dxgiDevice->GetAdapter(&m_adapter); - - if (FAILED(hr) ) - { - BX_TRACE("Init error: DXGIDevice1::GetAdapter failed 0x%08x.", hr); - goto error; - } - - hr = m_adapter->GetParent(IID_IDXGIFactory2, (void**)&m_factory); - - if (FAILED(hr) ) - { - BX_TRACE("Init error: IDXGIAdapter::GetParent failed 0x%08x.", hr); - goto error; - } - } -#endif // !BX_PLATFORM_WINDOWS - DX_CHECK(m_device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS, &m_options, sizeof(m_options) ) ); BX_TRACE("D3D12 options:") BX_TRACE("\tTiledResourcesTier %d", m_options.TiledResourcesTier); @@ -861,117 +906,109 @@ namespace bgfx { namespace d3d12 BX_TRACE("\tCrossNodeSharingTier %d", m_options.CrossNodeSharingTier); BX_TRACE("\tResourceHeapTier %d", m_options.ResourceHeapTier); + initHeapProperties(m_device); + m_cmd.init(m_device); errorState = ErrorState::CreatedCommandQueue; if (NULL == g_platformData.backBuffer) { -#if !BX_PLATFORM_WINDOWS - hr = m_adapter->GetParent(__uuidof(IDXGIFactory2), (void**)&m_factory); - DX_RELEASE(m_adapter, 1); - if (FAILED(hr) ) - { - BX_TRACE("Init error: Unable to create Direct3D11 device."); - goto error; - } + bx::memSet(&m_scd, 0, sizeof(m_scd) ); + m_scd.width = _init.resolution.width; + m_scd.height = _init.resolution.height; + m_scd.format = s_textureFormat[_init.resolution.format].m_fmt; + m_scd.stereo = false; - m_scd.Width = BGFX_DEFAULT_WIDTH; - m_scd.Height = BGFX_DEFAULT_HEIGHT; - m_scd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - m_scd.Stereo = false; - m_scd.SampleDesc.Count = 1; - m_scd.SampleDesc.Quality = 0; - m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - m_scd.BufferCount = bx::uint32_min(BX_COUNTOF(m_backBufferColor), 4); - m_scd.Scaling = DXGI_SCALING_STRETCH; - m_scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; - m_scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + updateMsaa(m_scd.format); + m_scd.sampleDesc = s_msaa[(_init.resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; - if (NULL == g_platformData.ndt) + m_scd.bufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + m_scd.bufferCount = bx::clamp(_init.resolution.numBackBuffers, 2, BX_COUNTOF(m_backBufferColor) ); + m_scd.scaling = 0 == g_platformData.ndt + ? DXGI_SCALING_NONE + : DXGI_SCALING_STRETCH + ; + m_scd.swapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; + m_scd.alphaMode = DXGI_ALPHA_MODE_IGNORE; + m_scd.flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + + m_scd.maxFrameLatency = bx::min(_init.resolution.maxFrameLatency, 3); + m_scd.nwh = g_platformData.nwh; + m_scd.ndt = g_platformData.ndt; + m_scd.windowed = true; + + m_backBufferColorIdx = m_scd.bufferCount-1; + + m_msaaRt = NULL; + + if (NULL != m_scd.nwh) { - hr = m_factory->CreateSwapChainForCoreWindow(m_device - , (::IUnknown*)g_platformData.nwh - , &m_scd - , NULL + hr = m_dxgi.createSwapChain( + getDeviceForSwapChain() + , m_scd , &m_swapChain ); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 swap chain."); - } - else - { - BGFX_FATAL(g_platformData.ndt == reinterpret_cast(1), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - hr = m_factory->CreateSwapChainForComposition(m_device - , &m_scd - , NULL - , &m_swapChain - ); - BX_WARN(SUCCEEDED(hr), "Unable to create Direct3D11 swap chain."); -# if BX_PLATFORM_WINRT - IInspectable* nativeWindow = reinterpret_cast(g_platformData.nwh); - ISwapChainBackgroundPanelNative* panel = NULL; - hr = nativeWindow->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void**)&panel); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - if (NULL != panel) + if (FAILED(hr) ) { - hr = panel->SetSwapChain(m_swapChain); - BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to set swap chain on panel."); - - panel->Release(); + BX_TRACE("Init error: Unable to create Direct3D12 swap chain."); + goto error; } -# endif // BX_PLATFORM_WINRT - } -#else - m_scd.BufferDesc.Width = BGFX_DEFAULT_WIDTH; - m_scd.BufferDesc.Height = BGFX_DEFAULT_HEIGHT; - m_scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - m_scd.BufferDesc.Scaling = DXGI_MODE_SCALING_STRETCHED; - m_scd.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; - m_scd.BufferDesc.RefreshRate.Numerator = 60; - m_scd.BufferDesc.RefreshRate.Denominator = 1; - m_scd.SampleDesc.Count = 1; - m_scd.SampleDesc.Quality = 0; - m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - m_scd.BufferCount = bx::uint32_min(BX_COUNTOF(m_backBufferColor), 4); - m_scd.OutputWindow = (HWND)g_platformData.nwh; - m_scd.Windowed = true; - m_scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; - m_scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; + else + { + m_resolution = _init.resolution; + m_resolution.reset = _init.resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); - BX_CHECK(m_scd.BufferCount <= BX_COUNTOF(m_backBufferColor), "Swap chain buffer count %d (max %d)." - , m_scd.BufferCount - , BX_COUNTOF(m_backBufferColor) - ); - hr = m_factory->CreateSwapChain(m_cmd.m_commandQueue - , &m_scd - , reinterpret_cast(&m_swapChain) - ); -#endif // BX_PLATFORM_* - if (FAILED(hr) ) - { - BX_TRACE("Init error: Failed to create swap chain."); - goto error; + m_textVideoMem.resize(false, _init.resolution.width, _init.resolution.height); + m_textVideoMem.clear(); + } + + if (1 < m_scd.sampleDesc.Count) + { + D3D12_RESOURCE_DESC resourceDesc; + resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + resourceDesc.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT; + resourceDesc.Width = m_scd.width; + resourceDesc.Height = m_scd.height; + resourceDesc.MipLevels = 1; + resourceDesc.Format = m_scd.format; + resourceDesc.SampleDesc = m_scd.sampleDesc; + resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; + resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + resourceDesc.DepthOrArraySize = 1; + + D3D12_CLEAR_VALUE clearValue; + clearValue.Format = resourceDesc.Format; + clearValue.Color[0] = 0.0f; + clearValue.Color[1] = 0.0f; + clearValue.Color[2] = 0.0f; + clearValue.Color[3] = 0.0f; + + m_msaaRt = createCommittedResource(m_device, HeapProperty::Texture, &resourceDesc, &clearValue, true); + setDebugObjectName(m_msaaRt, "MSAA Backbuffer"); + } } } m_presentElapsed = 0; { - m_resolution.m_width = BGFX_DEFAULT_WIDTH; - m_resolution.m_height = BGFX_DEFAULT_HEIGHT; + m_resolution.width = _init.resolution.width; + m_resolution.height = _init.resolution.height; m_numWindows = 1; #if BX_PLATFORM_WINDOWS - DX_CHECK(m_factory->MakeWindowAssociation( (HWND)g_platformData.nwh - , 0 - | DXGI_MWA_NO_WINDOW_CHANGES - | DXGI_MWA_NO_ALT_ENTER - ) ); + m_infoQueue = NULL; - if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) + DX_CHECK(m_dxgi.m_factory->MakeWindowAssociation( (HWND)g_platformData.nwh + , 0 + | DXGI_MWA_NO_WINDOW_CHANGES + | DXGI_MWA_NO_ALT_ENTER + ) ); + + if (_init.debug) { hr = m_device->QueryInterface(IID_ID3D12InfoQueue, (void**)&m_infoQueue); @@ -992,48 +1029,46 @@ namespace bgfx { namespace d3d12 filter.DenyList.NumCategories = BX_COUNTOF(catlist); filter.DenyList.pCategoryList = catlist; m_infoQueue->PushStorageFilter(&filter); - - DX_RELEASE_WARNONLY(m_infoQueue, 0); } } #endif // BX_PLATFORM_WINDOWS D3D12_DESCRIPTOR_HEAP_DESC rtvDescHeap; rtvDescHeap.NumDescriptors = 0 - + BX_COUNTOF(m_backBufferColor) - + BGFX_CONFIG_MAX_FRAME_BUFFERS*BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS - ; + + BX_COUNTOF(m_backBufferColor) + + BGFX_CONFIG_MAX_FRAME_BUFFERS*BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS + ; rtvDescHeap.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; rtvDescHeap.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; rtvDescHeap.NodeMask = 1; DX_CHECK(m_device->CreateDescriptorHeap(&rtvDescHeap - , IID_ID3D12DescriptorHeap - , (void**)&m_rtvDescriptorHeap - ) ); + , IID_ID3D12DescriptorHeap + , (void**)&m_rtvDescriptorHeap + ) ); D3D12_DESCRIPTOR_HEAP_DESC dsvDescHeap; dsvDescHeap.NumDescriptors = 0 - + 1 // reserved for depth backbuffer. - + BGFX_CONFIG_MAX_FRAME_BUFFERS - ; + + 1 // reserved for depth backbuffer. + + BGFX_CONFIG_MAX_FRAME_BUFFERS + ; dsvDescHeap.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; dsvDescHeap.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; dsvDescHeap.NodeMask = 1; DX_CHECK(m_device->CreateDescriptorHeap(&dsvDescHeap - , IID_ID3D12DescriptorHeap - , (void**)&m_dsvDescriptorHeap - ) ); + , IID_ID3D12DescriptorHeap + , (void**)&m_dsvDescriptorHeap + ) ); for (uint32_t ii = 0; ii < BX_COUNTOF(m_scratchBuffer); ++ii) { m_scratchBuffer[ii].create(BGFX_CONFIG_MAX_DRAW_CALLS*1024 - , BGFX_CONFIG_MAX_TEXTURES + BGFX_CONFIG_MAX_SHADERS + BGFX_CONFIG_MAX_DRAW_CALLS - ); + , BGFX_CONFIG_MAX_TEXTURES + BGFX_CONFIG_MAX_SHADERS + BGFX_CONFIG_MAX_DRAW_CALLS + ); } m_samplerAllocator.create(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER - , 1024 - , BGFX_CONFIG_MAX_TEXTURE_SAMPLERS - ); + , 1024 + , BGFX_CONFIG_MAX_TEXTURE_SAMPLERS + ); D3D12_DESCRIPTOR_RANGE descRange[] = { @@ -1064,38 +1099,50 @@ namespace bgfx { namespace d3d12 ID3DBlob* outBlob; ID3DBlob* errorBlob; DX_CHECK(D3D12SerializeRootSignature(&descRootSignature - , D3D_ROOT_SIGNATURE_VERSION_1 - , &outBlob - , &errorBlob - ) ); + , D3D_ROOT_SIGNATURE_VERSION_1 + , &outBlob + , &errorBlob + ) ); DX_CHECK(m_device->CreateRootSignature(0 - , outBlob->GetBufferPointer() - , outBlob->GetBufferSize() - , IID_ID3D12RootSignature - , (void**)&m_rootSignature - ) ); + , outBlob->GetBufferPointer() + , outBlob->GetBufferSize() + , IID_ID3D12RootSignature + , (void**)&m_rootSignature + ) ); + + /// + m_directAccessSupport = true + && BX_ENABLED(BX_PLATFORM_XBOXONE) + && m_architecture.UMA + ; g_caps.supported |= ( 0 - | BGFX_CAPS_TEXTURE_3D - | BGFX_CAPS_TEXTURE_COMPARE_ALL - | BGFX_CAPS_INSTANCING - | BGFX_CAPS_VERTEX_ATTRIB_HALF - | BGFX_CAPS_VERTEX_ATTRIB_UINT10 - | BGFX_CAPS_FRAGMENT_DEPTH - | BGFX_CAPS_BLEND_INDEPENDENT - | BGFX_CAPS_COMPUTE - | (m_options.ROVsSupported ? BGFX_CAPS_FRAGMENT_ORDERING : 0) -// | BGFX_CAPS_SWAP_CHAIN - | BGFX_CAPS_TEXTURE_BLIT - | BGFX_CAPS_TEXTURE_READ_BACK - | BGFX_CAPS_OCCLUSION_QUERY - | BGFX_CAPS_ALPHA_TO_COVERAGE - | BGFX_CAPS_TEXTURE_2D_ARRAY - | BGFX_CAPS_TEXTURE_CUBE_ARRAY - ); - g_caps.limits.maxTextureSize = 16384; - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + | BGFX_CAPS_TEXTURE_3D + | BGFX_CAPS_TEXTURE_COMPARE_ALL + | BGFX_CAPS_INSTANCING + | BGFX_CAPS_DRAW_INDIRECT + | BGFX_CAPS_VERTEX_ATTRIB_HALF + | BGFX_CAPS_VERTEX_ATTRIB_UINT10 + | BGFX_CAPS_VERTEX_ID + | BGFX_CAPS_FRAGMENT_DEPTH + | BGFX_CAPS_BLEND_INDEPENDENT + | BGFX_CAPS_COMPUTE + | (m_options.ROVsSupported ? BGFX_CAPS_FRAGMENT_ORDERING : 0) + | (m_directAccessSupport ? BGFX_CAPS_TEXTURE_DIRECT_ACCESS : 0) + | (BX_ENABLED(BX_PLATFORM_WINDOWS) ? BGFX_CAPS_SWAP_CHAIN : 0) + | BGFX_CAPS_TEXTURE_BLIT + | BGFX_CAPS_TEXTURE_READ_BACK + | BGFX_CAPS_OCCLUSION_QUERY + | BGFX_CAPS_ALPHA_TO_COVERAGE + | BGFX_CAPS_TEXTURE_2D_ARRAY + | BGFX_CAPS_TEXTURE_CUBE_ARRAY + ); + g_caps.limits.maxTextureSize = D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION; + g_caps.limits.maxTextureLayers = D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION; + g_caps.limits.maxFBAttachments = bx::min(16, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS); + g_caps.limits.maxComputeBindings = bx::min(D3D12_UAV_SLOT_COUNT, BGFX_MAX_COMPUTE_BINDINGS); + g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS; for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii) { @@ -1245,14 +1292,47 @@ namespace bgfx { namespace d3d12 for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii) { bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED + 1, "%3d ", ii); - mbstowcs(s_viewNameW[ii], s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED); } postReset(); m_batch.create(4<<10); + m_batch.setIndirectMode(BGFX_PCI_ID_NVIDIA != m_dxgi.m_adapterDesc.VendorId); + m_gpuTimer.init(); m_occlusionQuery.init(); + + { + D3D12_INDIRECT_ARGUMENT_TYPE argType[] = + { + D3D12_INDIRECT_ARGUMENT_TYPE_DISPATCH, + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW, + D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED, + }; + + D3D12_INDIRECT_ARGUMENT_DESC argDesc; + bx::memSet(&argDesc, 0, sizeof(argDesc) ); + + for (uint32_t ii = 0; ii < BX_COUNTOF(m_commandSignature); ++ii) + { + argDesc.Type = argType[ii]; + D3D12_COMMAND_SIGNATURE_DESC commandSignatureDesc = { BGFX_CONFIG_DRAW_INDIRECT_STRIDE, 1, &argDesc, 1 }; + + m_commandSignature[ii] = NULL; + DX_CHECK(m_device->CreateCommandSignature(&commandSignatureDesc + , NULL + , IID_ID3D12CommandSignature + , (void**)&m_commandSignature[ii] + ) ); + } + } + } + + if (m_nvapi.isInitialized() ) + { + finish(); + m_commandList = m_cmd.alloc(); + m_nvapi.initAftermath(m_device, m_commandList); } g_internalData.context = m_device; @@ -1263,21 +1343,31 @@ namespace bgfx { namespace d3d12 { case ErrorState::CreatedCommandQueue: m_cmd.shutdown(); + BX_FALLTHROUGH; + case ErrorState::CreatedDXGIFactory: DX_RELEASE(m_device, 0); - DX_RELEASE(m_adapter, 0); - DX_RELEASE(m_factory, 0); + m_dxgi.shutdown(); + BX_FALLTHROUGH; + #if USE_D3D12_DYNAMIC_LIB case ErrorState::LoadedDXGI: - bx::dlclose(m_dxgidll); case ErrorState::LoadedD3D12: - bx::dlclose(m_d3d12dll); + bx::dlclose(m_d3d12Dll); + BX_FALLTHROUGH; + case ErrorState::LoadedKernel32: - bx::dlclose(m_kernel32dll); + bx::dlclose(m_kernel32Dll); + BX_FALLTHROUGH; + #endif // USE_D3D12_DYNAMIC_LIB case ErrorState::Default: default: - unloadRenderDoc(m_renderdocdll); + m_nvapi.shutdown(); + + unloadRenderDoc(m_renderDocDll); + bx::dlclose(m_winPixEvent); + m_winPixEvent = NULL; break; } @@ -1286,6 +1376,7 @@ namespace bgfx { namespace d3d12 void shutdown() { + m_cmd.finish(); m_batch.destroy(); preReset(); @@ -1322,25 +1413,37 @@ namespace bgfx { namespace d3d12 m_textures[ii].destroy(); } +#if BX_PLATFORM_WINDOWS + DX_RELEASE_W(m_infoQueue, 0); +#endif // BX_PLATFORM_WINDOWS + DX_RELEASE(m_rtvDescriptorHeap, 0); DX_RELEASE(m_dsvDescriptorHeap, 0); - DX_RELEASE(m_rootSignature, 0); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_commandSignature); ++ii) + { + DX_RELEASE(m_commandSignature[ii], 0); + } + DX_RELEASE(m_rootSignature, 0); + DX_RELEASE(m_msaaRt, 0); DX_RELEASE(m_swapChain, 0); m_cmd.shutdown(); DX_RELEASE(m_device, 0); - DX_RELEASE(m_adapter, 0); - DX_RELEASE(m_factory, 0); - unloadRenderDoc(m_renderdocdll); + m_nvapi.shutdown(); + m_dxgi.shutdown(); + + unloadRenderDoc(m_renderDocDll); + + bx::dlclose(m_winPixEvent); + m_winPixEvent = NULL; #if USE_D3D12_DYNAMIC_LIB - bx::dlclose(m_dxgidll); - bx::dlclose(m_d3d12dll); - bx::dlclose(m_kernel32dll); + bx::dlclose(m_d3d12Dll); + bx::dlclose(m_kernel32Dll); #endif // USE_D3D12_DYNAMIC_LIB } @@ -1359,24 +1462,26 @@ namespace bgfx { namespace d3d12 return m_lost; } - void flip(HMD& /*_hmd*/) override + void flip() override { - if (NULL != m_swapChain - && !m_lost) + if (!m_lost) { int64_t start = bx::getHPCounter(); - HRESULT hr = 0; - uint32_t syncInterval = !!(m_resolution.m_flags & BGFX_RESET_VSYNC); + m_cmd.finish(m_backBufferColorFence[(m_backBufferColorIdx-1) % m_scd.bufferCount]); + + HRESULT hr = S_OK; + uint32_t syncInterval = !!(m_resolution.reset & BGFX_RESET_VSYNC); uint32_t flags = 0 == syncInterval ? DXGI_PRESENT_RESTART : 0; for (uint32_t ii = 1, num = m_numWindows; ii < num && SUCCEEDED(hr); ++ii) { - hr = m_frameBuffers[m_windows[ii].idx].m_swapChain->Present(syncInterval, flags); + FrameBufferD3D12& frameBuffer = m_frameBuffers[m_windows[ii].idx]; + hr = frameBuffer.present(syncInterval, flags); } - if (SUCCEEDED(hr) ) + if (SUCCEEDED(hr) + && NULL != m_swapChain) { - m_cmd.finish(m_backBufferColorFence[(m_backBufferColorIdx-1) % m_scd.BufferCount]); hr = m_swapChain->Present(syncInterval, flags); } @@ -1394,7 +1499,7 @@ namespace bgfx { namespace d3d12 } } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override + void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags, false); } @@ -1415,7 +1520,7 @@ namespace bgfx { namespace d3d12 { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -1430,7 +1535,7 @@ namespace bgfx { namespace d3d12 m_indexBuffers[_handle.idx].create(_size, NULL, _flags, false); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_indexBuffers[_handle.idx].update(m_commandList, _offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -1446,7 +1551,7 @@ namespace bgfx { namespace d3d12 m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_vertexBuffers[_handle.idx].update(m_commandList, _offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -1456,7 +1561,7 @@ namespace bgfx { namespace d3d12 m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) override + void createShader(ShaderHandle _handle, const Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } @@ -1476,9 +1581,9 @@ namespace bgfx { namespace d3d12 m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override + void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override { - m_textures[_handle.idx].create(_mem, _flags, _skip); + return m_textures[_handle.idx].create(_mem, _flags, _skip); } void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override @@ -1534,7 +1639,6 @@ namespace bgfx { namespace d3d12 uint32_t srcWidth = bx::uint32_max(1, texture.m_width >>_mip); uint32_t srcHeight = bx::uint32_max(1, texture.m_height>>_mip); uint8_t* src; - readback->Map(0, NULL, (void**)&src); const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); uint8_t* dst = (uint8_t*)_data; @@ -1542,6 +1646,9 @@ namespace bgfx { namespace d3d12 uint32_t pitch = bx::uint32_min(uint32_t(srcPitch), dstPitch); + D3D12_RANGE readRange = { 0, dstPitch*srcHeight }; + readback->Map(0, &readRange, (void**)&src); + for (uint32_t yy = 0, height = srcHeight; yy < height; ++yy) { bx::memCopy(dst, src, pitch); @@ -1550,12 +1657,13 @@ namespace bgfx { namespace d3d12 dst += dstPitch; } - readback->Unmap(0, NULL); + D3D12_RANGE writeRange = { 0, 0 }; + readback->Unmap(0, &writeRange); DX_RELEASE(readback, 0); } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override { TextureD3D12& texture = m_textures[_handle.idx]; @@ -1570,7 +1678,7 @@ namespace bgfx { namespace d3d12 tc.m_width = _width; tc.m_height = _height; tc.m_depth = 0; - tc.m_numLayers = 1; + tc.m_numLayers = _numLayers; tc.m_numMips = _numMips; tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; @@ -1604,24 +1712,47 @@ namespace bgfx { namespace d3d12 m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override { + finishAll(true); + + for (uint32_t ii = 0, num = m_numWindows; ii < num; ++ii) + { + FrameBufferHandle handle = m_windows[ii]; + if (isValid(handle) + && m_frameBuffers[handle.idx].m_nwh == _nwh) + { + destroyFrameBuffer(handle); + } + } + uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; - m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); + m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat); } void destroyFrameBuffer(FrameBufferHandle _handle) override { - uint16_t denseIdx = m_frameBuffers[_handle.idx].destroy(); + FrameBufferD3D12& frameBuffer = m_frameBuffers[_handle.idx]; + + if (NULL != frameBuffer.m_swapChain) + { + finishAll(true); + } + + uint16_t denseIdx = frameBuffer.destroy(); if (UINT16_MAX != denseIdx) { --m_numWindows; if (m_numWindows > 1) { FrameBufferHandle handle = m_windows[m_numWindows]; - m_windows[denseIdx] = handle; - m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + m_windows[m_numWindows] = {kInvalidHandle}; + if (m_numWindows != denseIdx) + { + m_windows[denseIdx] = handle; + m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + } } } } @@ -1637,7 +1768,7 @@ namespace bgfx { namespace d3d12 void* data = BX_ALLOC(g_allocator, size); bx::memSet(data, 0, size); m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name, data); + m_uniformReg.add(_handle, _name); } void destroyUniform(UniformHandle _handle) override @@ -1651,7 +1782,7 @@ namespace bgfx { namespace d3d12 { BX_UNUSED(_handle); - uint32_t idx = (m_backBufferColorIdx-1) % m_scd.BufferCount; + uint32_t idx = (m_backBufferColorIdx-1) % m_scd.bufferCount; m_cmd.finish(m_backBufferColorFence[idx]); ID3D12Resource* backBuffer = m_backBufferColor[idx]; @@ -1717,14 +1848,6 @@ namespace bgfx { namespace d3d12 void updateViewName(ViewId _id, const char* _name) override { - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) - { - mbstowcs(&s_viewNameW[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] - , _name - , BX_COUNTOF(s_viewNameW[0])-BGFX_CONFIG_MAX_VIEW_NAME_RESERVED - ); - } - bx::strCopy(&s_viewName[_id][BGFX_CONFIG_MAX_VIEW_NAME_RESERVED] , BX_COUNTOF(s_viewName[0]) - BGFX_CONFIG_MAX_VIEW_NAME_RESERVED , _name @@ -1736,8 +1859,12 @@ namespace bgfx { namespace d3d12 bx::memCopy(m_uniforms[_loc], _data, _size); } - void setMarker(const char* /*_marker*/, uint32_t /*_size*/) override + void setMarker(const char* _marker, uint32_t /*_size*/) override { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + PIX3_SETMARKER(m_commandList, D3DCOLOR_MARKER, _marker); + } } void invalidateOcclusionQuery(OcclusionQueryHandle _handle) override @@ -1750,11 +1877,11 @@ namespace bgfx { namespace d3d12 switch (_handle.type) { case Handle::Shader: -// setDebugObjectName(m_shaders[_handle.idx].m_ptr, _name); +// setDebugObjectName(m_shaders[_handle.idx].m_ptr, "%s", _name); break; case Handle::Texture: - setDebugObjectName(m_textures[_handle.idx].m_ptr, _name); + setDebugObjectName(m_textures[_handle.idx].m_ptr, "%s", _name); break; default: @@ -1769,11 +1896,10 @@ namespace bgfx { namespace d3d12 void blitSetup(TextVideoMemBlitter& _blitter) override { - const uint32_t width = getBufferWidth(); - const uint32_t height = getBufferHeight(); + const uint32_t width = m_scd.width; + const uint32_t height = m_scd.height; - FrameBufferHandle fbh = BGFX_INVALID_HANDLE; - setFrameBuffer(fbh, false); + setFrameBuffer(BGFX_INVALID_HANDLE, false); D3D12_VIEWPORT vp; vp.TopLeftX = 0; @@ -1792,14 +1918,16 @@ namespace bgfx { namespace d3d12 m_commandList->RSSetScissorRects(1, &rc); const uint64_t state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS ; + const VertexDecl* decls[1] = { &m_vertexDecls[_blitter.m_vb->decl.idx] }; ID3D12PipelineState* pso = getPipelineState(state , packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) - , _blitter.m_vb->decl.idx + , 1 + , decls , _blitter.m_program.idx , 0 ); @@ -1826,8 +1954,8 @@ namespace bgfx { namespace d3d12 m_commandList->SetGraphicsRootConstantBufferView(Rdt::CBV, gpuAddress); TextureD3D12& texture = m_textures[_blitter.m_texture.idx]; - uint32_t samplerFlags[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = { texture.m_flags & BGFX_TEXTURE_SAMPLER_BITS_MASK }; - uint16_t samplerStateIdx = getSamplerState(samplerFlags, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, NULL); + uint32_t samplerFlags[] = { uint32_t(texture.m_flags & BGFX_SAMPLER_BITS_MASK) }; + uint16_t samplerStateIdx = getSamplerState(samplerFlags, BX_COUNTOF(samplerFlags), NULL); m_commandList->SetGraphicsRootDescriptorTable(Rdt::Sampler, m_samplerAllocator.get(samplerStateIdx) ); D3D12_GPU_DESCRIPTOR_HANDLE srvHandle; scratchBuffer.allocSrv(srvHandle, texture); @@ -1872,11 +2000,18 @@ namespace bgfx { namespace d3d12 { finishAll(); - for (uint32_t ii = 0, num = m_scd.BufferCount; ii < num; ++ii) + if (NULL != m_swapChain) { - DX_RELEASE(m_backBufferColor[ii], num-1-ii); + for (uint32_t ii = 0, num = m_scd.bufferCount; ii < num; ++ii) + { +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + DX_RELEASE(m_backBufferColor[ii], num-1-ii); +#else + DX_RELEASE(m_backBufferColor[ii], 1); +#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + } + DX_RELEASE(m_backBufferDepthStencil, 0); } - DX_RELEASE(m_backBufferDepthStencil, 0); for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) { @@ -1894,27 +2029,48 @@ namespace bgfx { namespace d3d12 uint32_t rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); - for (uint32_t ii = 0, num = m_scd.BufferCount; ii < num; ++ii) + if (NULL != m_swapChain) { - D3D12_CPU_DESCRIPTOR_HANDLE handle = getCPUHandleHeapStart(m_rtvDescriptorHeap); - handle.ptr += ii * rtvDescriptorSize; - DX_CHECK(m_swapChain->GetBuffer(ii + for (uint32_t ii = 0, num = m_scd.bufferCount; ii < num; ++ii) + { + D3D12_CPU_DESCRIPTOR_HANDLE handle = getCPUHandleHeapStart(m_rtvDescriptorHeap); + handle.ptr += ii * rtvDescriptorSize; + DX_CHECK(m_swapChain->GetBuffer(ii , IID_ID3D12Resource , (void**)&m_backBufferColor[ii] ) ); - m_device->CreateRenderTargetView(m_backBufferColor[ii], NULL, handle); + m_device->CreateRenderTargetView( + NULL == m_msaaRt + ? m_backBufferColor[ii] + : m_msaaRt + , NULL + , handle + ); + + if (BX_ENABLED(BX_PLATFORM_XBOXONE) ) + { + ID3D12Resource* resource = m_backBufferColor[ii]; + + BX_CHECK(DXGI_FORMAT_R8G8B8A8_UNORM == m_scd.format, ""); + const uint32_t size = m_scd.width*m_scd.height*4; + + void* ptr; + DX_CHECK(resource->Map(0, NULL, &ptr) ); + bx::memSet(ptr, 0, size); + resource->Unmap(0, NULL); + } + } } D3D12_RESOURCE_DESC resourceDesc; resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; - resourceDesc.Alignment = 0; - resourceDesc.Width = bx::uint32_max(m_resolution.m_width, 1); - resourceDesc.Height = bx::uint32_max(m_resolution.m_height, 1); - resourceDesc.DepthOrArraySize = 1; - resourceDesc.MipLevels = 0; - resourceDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - resourceDesc.SampleDesc.Count = 1; - resourceDesc.SampleDesc.Quality = 0; + resourceDesc.Alignment = 1 < m_scd.sampleDesc.Count ? D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT : 0; + resourceDesc.Width = bx::uint32_max(m_resolution.width, 1); + resourceDesc.Height = bx::uint32_max(m_resolution.height, 1); + resourceDesc.DepthOrArraySize = 1; + resourceDesc.MipLevels = 1; + resourceDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + resourceDesc.SampleDesc = m_scd.sampleDesc; resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; @@ -1923,20 +2079,15 @@ namespace bgfx { namespace d3d12 clearValue.DepthStencil.Depth = 1.0f; clearValue.DepthStencil.Stencil = 0; + m_commandList = m_cmd.alloc(); + m_backBufferDepthStencil = createCommittedResource(m_device, HeapProperty::Default, &resourceDesc, &clearValue); + m_device->CreateDepthStencilView(m_backBufferDepthStencil, NULL, getCPUHandleHeapStart(m_dsvDescriptorHeap)); - D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc; - ZeroMemory(&dsvDesc, sizeof(dsvDesc) ); - dsvDesc.Format = resourceDesc.Format; - dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D; - dsvDesc.Flags = D3D12_DSV_FLAGS(0) -// | D3D12_DSV_FLAG_READ_ONLY_DEPTH -// | D3D12_DSV_FLAG_READ_ONLY_DEPTH - ; - - m_device->CreateDepthStencilView(m_backBufferDepthStencil - , &dsvDesc - , getCPUHandleHeapStart(m_dsvDescriptorHeap) + setResourceBarrier(m_commandList + , m_backBufferDepthStencil + , D3D12_RESOURCE_STATE_COMMON + , D3D12_RESOURCE_STATE_DEPTH_WRITE ); for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) @@ -1944,7 +2095,15 @@ namespace bgfx { namespace d3d12 m_frameBuffers[ii].postReset(); } - m_commandList = m_cmd.alloc(); + if (NULL != m_msaaRt) + { + setResourceBarrier(m_commandList + , m_msaaRt + , D3D12_RESOURCE_STATE_COMMON + , D3D12_RESOURCE_STATE_RESOLVE_SOURCE + ); + } + // capturePostReset(); } @@ -1956,7 +2115,7 @@ namespace bgfx { namespace d3d12 m_samplerAllocator.reset(); } - void updateMsaa() + void updateMsaa(DXGI_FORMAT _format) const { for (uint32_t ii = 1, last = 0; ii < BX_COUNTOF(s_msaa); ++ii) { @@ -1964,18 +2123,16 @@ namespace bgfx { namespace d3d12 D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS data; bx::memSet(&data, 0, sizeof(msaa) ); - data.Format = getBufferFormat(); + data.Format = _format; data.SampleCount = msaa; data.Flags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE; HRESULT hr = m_device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &data, sizeof(data) ); -data.NumQualityLevels = 0; - if (SUCCEEDED(hr) && 0 < data.NumQualityLevels) { s_msaa[ii].Count = data.SampleCount; - s_msaa[ii].Quality = data.NumQualityLevels - 1; + s_msaa[ii].Quality = data.NumQualityLevels-1; last = ii; } else @@ -1985,9 +2142,18 @@ data.NumQualityLevels = 0; } } + IUnknown* getDeviceForSwapChain() const + { +# if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + return m_cmd.m_commandQueue; +# else + return m_device; +# endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT + } + bool updateResolution(const Resolution& _resolution) { - if (!!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) ) + if (!!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) ) { m_maxAnisotropy = D3D12_REQ_MAXANISOTROPY; } @@ -1996,7 +2162,7 @@ data.NumQualityLevels = 0; m_maxAnisotropy = 1; } - bool depthClamp = !!(_resolution.m_flags & BGFX_RESET_DEPTH_CLAMP); + bool depthClamp = !!(_resolution.reset & BGFX_RESET_DEPTH_CLAMP); if (m_depthClamp != depthClamp) { @@ -2005,64 +2171,95 @@ data.NumQualityLevels = 0; } const uint32_t maskFlags = ~(0 - | BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP | BGFX_RESET_SUSPEND ); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height + || m_resolution.format != _resolution.format + || (m_resolution.reset&maskFlags) != (_resolution.reset&maskFlags) ) { - uint32_t flags = _resolution.m_flags & (~BGFX_RESET_INTERNAL_FORCE); + uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); - bool resize = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (_resolution.m_flags&BGFX_RESET_MSAA_MASK); + bool resize = true + && BX_ENABLED(BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT) + && (m_resolution.reset&BGFX_RESET_MSAA_MASK) == (_resolution.reset&BGFX_RESET_MSAA_MASK) + ; m_resolution = _resolution; - m_resolution.m_flags = flags; + m_resolution.reset = flags; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.resize(false, _resolution.width, _resolution.height); m_textVideoMem.clear(); - setBufferSize(_resolution.m_width, _resolution.m_height); + m_scd.width = _resolution.width; + m_scd.height = _resolution.height; + m_scd.format = s_textureFormat[_resolution.format].m_fmt; preReset(); - BX_UNUSED(resize); -#if BX_PLATFORM_WINDOWS - if (resize) - { - uint32_t nodeMask[] = { 1, 1, 1, 1 }; - BX_STATIC_ASSERT(BX_COUNTOF(m_backBufferColor) == BX_COUNTOF(nodeMask) ); - IUnknown* presentQueue[] ={ m_cmd.m_commandQueue, m_cmd.m_commandQueue, m_cmd.m_commandQueue, m_cmd.m_commandQueue }; - BX_STATIC_ASSERT(BX_COUNTOF(m_backBufferColor) == BX_COUNTOF(presentQueue) ); + DX_RELEASE(m_msaaRt, 0); - DX_CHECK(m_swapChain->ResizeBuffers1(m_scd.BufferCount - , m_scd.BufferDesc.Width - , m_scd.BufferDesc.Height - , m_scd.BufferDesc.Format - , m_scd.Flags - , nodeMask - , presentQueue - ) ); + if (NULL == m_swapChain) + { } else -#endif // BX_PLATFORM_WINDOWS { - updateMsaa(); - m_scd.SampleDesc = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; - - DX_RELEASE(m_swapChain, 0); - + if (resize) + { #if BX_PLATFORM_WINDOWS - HRESULT hr; - hr = m_factory->CreateSwapChain(m_cmd.m_commandQueue - , &m_scd - , reinterpret_cast(&m_swapChain) - ); - BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::UnableToInitialize, "Failed to create swap chain."); + uint32_t nodeMask[] = { 1, 1, 1, 1 }; + BX_STATIC_ASSERT(BX_COUNTOF(m_backBufferColor) == BX_COUNTOF(nodeMask) ); + IUnknown* presentQueue[] ={ m_cmd.m_commandQueue, m_cmd.m_commandQueue, m_cmd.m_commandQueue, m_cmd.m_commandQueue }; + BX_STATIC_ASSERT(BX_COUNTOF(m_backBufferColor) == BX_COUNTOF(presentQueue) ); + DX_CHECK(m_dxgi.resizeBuffers(m_swapChain, m_scd, nodeMask, presentQueue) ); +#elif BX_PLATFORM_WINRT + DX_CHECK(m_dxgi.resizeBuffers(m_swapChain, m_scd); + m_backBufferColorIdx = m_scd.bufferCount-1; #endif // BX_PLATFORM_WINDOWS + } + else + { + updateMsaa(m_scd.format); + m_scd.sampleDesc = s_msaa[(m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; + + DX_RELEASE(m_swapChain, 0); + + HRESULT hr; + hr = m_dxgi.createSwapChain( + getDeviceForSwapChain() + , m_scd + , &m_swapChain + ); + BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::UnableToInitialize, "Failed to create swap chain."); + } + + if (1 < m_scd.sampleDesc.Count) + { + D3D12_RESOURCE_DESC resourceDesc; + resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + resourceDesc.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT; + resourceDesc.Width = m_scd.width; + resourceDesc.Height = m_scd.height; + resourceDesc.MipLevels = 1; + resourceDesc.Format = m_scd.format; + resourceDesc.SampleDesc = m_scd.sampleDesc; + resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; + resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + resourceDesc.DepthOrArraySize = 1; + + D3D12_CLEAR_VALUE clearValue; + clearValue.Format = resourceDesc.Format; + clearValue.Color[0] = 0.0f; + clearValue.Color[1] = 0.0f; + clearValue.Color[2] = 0.0f; + clearValue.Color[3] = 0.0f; + + m_msaaRt = createCommittedResource(m_device, HeapProperty::Texture, &resourceDesc, &clearValue, true); + setDebugObjectName(m_msaaRt, "MSAA Backbuffer"); + } } postReset(); @@ -2121,6 +2318,41 @@ data.NumQualityLevels = 0; } } + D3D12_CPU_DESCRIPTOR_HANDLE getRtv(FrameBufferHandle _fbh) + { + FrameBufferD3D12& frameBuffer = m_frameBuffers[_fbh.idx]; + + if (NULL != frameBuffer.m_swapChain) + { +#if BX_PLATFORM_WINDOWS + uint8_t idx = uint8_t(frameBuffer.m_swapChain->GetCurrentBackBufferIndex() ); + frameBuffer.setState(m_commandList, idx, D3D12_RESOURCE_STATE_RENDER_TARGET); + return getRtv(_fbh, idx); +#endif // BX_PLATFORM_WINDOWS + } + + return getRtv(_fbh, 0); + } + + D3D12_CPU_DESCRIPTOR_HANDLE getRtv(FrameBufferHandle _fbh, uint8_t _attachment) + { + D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = getCPUHandleHeapStart(m_rtvDescriptorHeap); + uint32_t rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); + D3D12_CPU_DESCRIPTOR_HANDLE result = + { + rtvDescriptor.ptr + (BX_COUNTOF(m_backBufferColor) + _fbh.idx * BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS + _attachment) * rtvDescriptorSize + }; + return result; + } + + D3D12_CPU_DESCRIPTOR_HANDLE getDsv(FrameBufferHandle _fbh) const + { + D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(m_dsvDescriptorHeap); + uint32_t dsvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); + D3D12_CPU_DESCRIPTOR_HANDLE result = { dsvDescriptor.ptr + (1 + _fbh.idx) * dsvDescriptorSize }; + return result; + } + void setFrameBuffer(FrameBufferHandle _fbh, bool _msaa = true) { if (isValid(m_fbh) @@ -2128,19 +2360,22 @@ data.NumQualityLevels = 0; { const FrameBufferD3D12& frameBuffer = m_frameBuffers[m_fbh.idx]; - for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) + if (NULL == frameBuffer.m_swapChain) { - TextureD3D12& texture = m_textures[frameBuffer.m_texture[ii].idx]; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); - } - - if (isValid(frameBuffer.m_depth) ) - { - TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx]; - const bool writeOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); - if (!writeOnly) + for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) { - texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_READ); + TextureD3D12& texture = m_textures[frameBuffer.m_texture[ii].idx]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + } + + if (isValid(frameBuffer.m_depth) ) + { + TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx]; + const bool writeOnly = 0 != (texture.m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); + if (!writeOnly) + { + texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_READ); + } } } } @@ -2158,14 +2393,12 @@ data.NumQualityLevels = 0; } else { - const FrameBufferD3D12& frameBuffer = m_frameBuffers[_fbh.idx]; + FrameBufferD3D12& frameBuffer = m_frameBuffers[_fbh.idx]; if (0 < frameBuffer.m_num) { - D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = getCPUHandleHeapStart(m_rtvDescriptorHeap); - uint32_t rtvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); - m_rtvHandle.ptr = rtvDescriptor.ptr + (BX_COUNTOF(m_backBufferColor) + _fbh.idx * BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) * rtvDescriptorSize; - m_currentColor = &m_rtvHandle; + m_rtvHandle = getRtv(_fbh); + m_currentColor = &m_rtvHandle; } else { @@ -2174,9 +2407,7 @@ data.NumQualityLevels = 0; if (isValid(frameBuffer.m_depth) ) { - D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(m_dsvDescriptorHeap); - uint32_t dsvDescriptorSize = m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); - m_dsvHandle.ptr = dsvDescriptor.ptr + (1 + _fbh.idx) * dsvDescriptorSize; + m_dsvHandle = getDsv(_fbh); m_currentDepthStencil = &m_dsvHandle; } else @@ -2184,23 +2415,31 @@ data.NumQualityLevels = 0; m_currentDepthStencil = NULL; } - for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) + if (NULL != frameBuffer.m_swapChain) { - TextureD3D12& texture = m_textures[frameBuffer.m_texture[ii].idx]; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_RENDER_TARGET); + frameBuffer.m_needPresent = true; + } + else + { + for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) + { + TextureD3D12& texture = m_textures[frameBuffer.m_texture[ii].idx]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_RENDER_TARGET); + } + + if (isValid(frameBuffer.m_depth) ) + { + TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_WRITE); + } } - if (isValid(frameBuffer.m_depth) ) - { - TextureD3D12& texture = m_textures[frameBuffer.m_depth.idx]; - texture.setState(m_commandList, D3D12_RESOURCE_STATE_DEPTH_WRITE); - } - - m_commandList->OMSetRenderTargets(frameBuffer.m_num - , m_currentColor - , true - , m_currentDepthStencil - ); + m_commandList->OMSetRenderTargets( + frameBuffer.m_num + , m_currentColor + , true + , m_currentDepthStencil + ); } m_fbh = _fbh; @@ -2237,16 +2476,11 @@ data.NumQualityLevels = 0; drt->BlendOpAlpha = s_blendEquation[equA]; } - uint8_t writeMask = (_state & BGFX_STATE_ALPHA_WRITE) - ? D3D12_COLOR_WRITE_ENABLE_ALPHA - : 0 - ; - writeMask |= (_state & BGFX_STATE_RGB_WRITE) - ? D3D12_COLOR_WRITE_ENABLE_RED - | D3D12_COLOR_WRITE_ENABLE_GREEN - | D3D12_COLOR_WRITE_ENABLE_BLUE - : 0 - ; + uint8_t writeMask = 0; + writeMask |= (_state & BGFX_STATE_WRITE_R) ? D3D12_COLOR_WRITE_ENABLE_RED : 0; + writeMask |= (_state & BGFX_STATE_WRITE_G) ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0; + writeMask |= (_state & BGFX_STATE_WRITE_B) ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0; + writeMask |= (_state & BGFX_STATE_WRITE_A) ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0; drt->LogicOp = D3D12_LOGIC_OP_CLEAR; drt->RenderTargetWriteMask = writeMask; @@ -2314,7 +2548,7 @@ data.NumQualityLevels = 0; bx::memSet(&_desc, 0, sizeof(_desc) ); uint32_t func = (_state&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT; _desc.DepthEnable = 0 != func; - _desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) + _desc.DepthWriteMask = !!(BGFX_STATE_WRITE_Z & _state) ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO ; @@ -2339,20 +2573,38 @@ data.NumQualityLevels = 0; _desc.BackFace.StencilFunc = s_cmpFunc[(bstencil&BGFX_STENCIL_TEST_MASK) >> BGFX_STENCIL_TEST_SHIFT]; } - uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, const VertexDecl& _vertexDecl, const ProgramD3D12& _program, uint8_t _numInstanceData) + uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, uint8_t _numStreams, const VertexDecl** _vertexDecls, const ProgramD3D12& _program, uint16_t _numInstanceData) { - VertexDecl decl; - bx::memCopy(&decl, &_vertexDecl, sizeof(VertexDecl) ); - const uint16_t* attrMask = _program.m_vsh->m_attrMask; + uint16_t attrMask[Attrib::Count]; + bx::memCopy(attrMask, _program.m_vsh->m_attrMask, sizeof(attrMask)); - for (uint32_t ii = 0; ii < Attrib::Count; ++ii) + D3D12_INPUT_ELEMENT_DESC* elem = _vertexElements; + + for (uint8_t stream = 0; stream < _numStreams; ++stream) { - uint16_t mask = attrMask[ii]; - uint16_t attr = (decl.m_attributes[ii] & mask); - decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr; + VertexDecl decl; + bx::memCopy(&decl, _vertexDecls[stream], sizeof(VertexDecl)); + + const bool last = stream == _numStreams-1; + + for (uint32_t ii = 0; ii < Attrib::Count; ++ii) + { + uint16_t mask = attrMask[ii]; + uint16_t attr = (decl.m_attributes[ii] & mask); + if (0 == attr + || UINT16_MAX == attr) + { + decl.m_attributes[ii] = last ? ~attr : UINT16_MAX; + } + else + { + attrMask[ii] = 0; + } + } + + elem = fillVertexDecl(stream, elem, decl); } - D3D12_INPUT_ELEMENT_DESC* elem = fillVertexDecl(_vertexElements, decl); uint32_t num = uint32_t(elem-_vertexElements); const D3D12_INPUT_ELEMENT_DESC inst = { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1 }; @@ -2388,6 +2640,12 @@ data.NumQualityLevels = 0; return uint32_t(elem-_vertexElements); } + uint32_t setInputLayout(D3D12_INPUT_ELEMENT_DESC* _vertexElements, const VertexDecl& _vertexDecl, const ProgramD3D12& _program, uint16_t _numInstanceData) + { + const VertexDecl* decls[1] = { &_vertexDecl }; + return setInputLayout(_vertexElements, BX_COUNTOF(decls), decls, _program, _numInstanceData); + } + static void patchCb0(DxbcInstruction& _instruction, void* _userData) { union { void* ptr; uint32_t offset; } cast = { _userData }; @@ -2398,10 +2656,22 @@ data.NumQualityLevels = 0; if (DxbcOperandType::ConstantBuffer == operand.type) { if (DxbcOperandAddrMode::Imm32 == operand.addrMode[0] - && 0 == operand.regIndex[0] - && DxbcOperandAddrMode::Imm32 == operand.addrMode[1]) + && 0 == operand.regIndex[0]) { - operand.regIndex[1] += cast.offset; + for (uint32_t jj = 1; jj < operand.numAddrModes; ++jj) + { + if (DxbcOperandAddrMode::Imm32 == operand.addrMode[jj] + || DxbcOperandAddrMode::RegImm32 == operand.addrMode[jj]) + { + operand.regIndex[jj] += cast.offset; + } + else if (0 != cast.offset) + { + operand.subOperand[jj].regIndex = operand.regIndex[jj]; + operand.addrMode[jj] = DxbcOperandAddrMode::RegImm32; + operand.regIndex[jj] = cast.offset; + } + } } } } @@ -2437,14 +2707,21 @@ data.NumQualityLevels = 0; return pso; } - ID3D12PipelineState* getPipelineState(uint64_t _state, uint64_t _stencil, uint16_t _declIdx, uint16_t _programIdx, uint8_t _numInstanceData) + ID3D12PipelineState* getPipelineState( + uint64_t _state + , uint64_t _stencil + , uint8_t _numStreams + , const VertexDecl** _vertexDecls + , uint16_t _programIdx + , uint8_t _numInstanceData + ) { ProgramD3D12& program = m_program[_programIdx]; _state &= 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_MASK | BGFX_STATE_BLEND_MASK | BGFX_STATE_BLEND_EQUATION_MASK @@ -2457,17 +2734,20 @@ data.NumQualityLevels = 0; | BGFX_STATE_PT_MASK ; - _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK); + _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, ~BGFX_STENCIL_FUNC_REF_MASK); VertexDecl decl; - bx::memCopy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) ); - const uint16_t* attrMask = program.m_vsh->m_attrMask; - - for (uint32_t ii = 0; ii < Attrib::Count; ++ii) + if (0 < _numStreams) { - uint16_t mask = attrMask[ii]; - uint16_t attr = (decl.m_attributes[ii] & mask); - decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr; + bx::memCopy(&decl, _vertexDecls[0], sizeof(VertexDecl) ); + const uint16_t* attrMask = program.m_vsh->m_attrMask; + + for (uint32_t ii = 0; ii < Attrib::Count; ++ii) + { + uint16_t mask = attrMask[ii]; + uint16_t attr = (decl.m_attributes[ii] & mask); + decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr; + } } bx::HashMurmur2A murmur; @@ -2476,8 +2756,17 @@ data.NumQualityLevels = 0; murmur.add(_stencil); murmur.add(program.m_vsh->m_hash); murmur.add(program.m_vsh->m_attrMask, sizeof(program.m_vsh->m_attrMask) ); - murmur.add(program.m_fsh->m_hash); - murmur.add(m_vertexDecls[_declIdx].m_hash); + + if (NULL != program.m_fsh) + { + murmur.add(program.m_fsh->m_hash); + } + + for (uint32_t ii = 0; ii < _numStreams; ++ii) + { + murmur.add(_vertexDecls[ii]->m_hash); + } + murmur.add(decl.m_attributes, sizeof(decl.m_attributes) ); murmur.add(m_fbh.idx); murmur.add(_numInstanceData); @@ -2498,66 +2787,79 @@ data.NumQualityLevels = 0; desc.VS.pShaderBytecode = program.m_vsh->m_code->data; desc.VS.BytecodeLength = program.m_vsh->m_code->size; - const Memory* temp = alloc(program.m_fsh->m_code->size); - bx::memSet(temp->data, 0, temp->size); - bx::MemoryReader rd(program.m_fsh->m_code->data, program.m_fsh->m_code->size); - bx::StaticMemoryBlockWriter wr(temp->data, temp->size); + const Memory* temp = NULL; - DxbcContext dxbc; - bx::Error err; - read(&rd, dxbc, &err); - - bool patchShader = !dxbc.shader.aon9; - if (BX_ENABLED(BGFX_CONFIG_DEBUG) - && patchShader) + if (NULL != program.m_fsh) { - union { uint32_t offset; void* ptr; } cast = { 0 }; - filter(dxbc.shader, dxbc.shader, patchCb0, cast.ptr); + bx::MemoryReader rd(program.m_fsh->m_code->data, program.m_fsh->m_code->size); - write(&wr, dxbc, &err); + DxbcContext dxbc; + bx::Error err; + read(&rd, dxbc, &err); - dxbcHash(temp->data + 20, temp->size - 20, temp->data + 4); - - patchShader = 0 == bx::memCmp(program.m_fsh->m_code->data, temp->data, 16); - BX_CHECK(patchShader, "DXBC fragment shader patching error (ShaderHandle: %d).", program.m_fsh - m_shaders); - - if (!patchShader) + bool patchShader = !dxbc.shader.aon9; + if (BX_ENABLED(BGFX_CONFIG_DEBUG) + && patchShader) { - for (uint32_t ii = 20; ii < temp->size; ii += 16) + union { uint32_t offset; void* ptr; } cast = { 0 }; + filter(dxbc.shader, dxbc.shader, patchCb0, cast.ptr); + + temp = alloc(uint32_t(dxbc.shader.byteCode.size() )+1024); + bx::StaticMemoryBlockWriter wr(temp->data, temp->size); + + int32_t size = write(&wr, dxbc, &err); + dxbcHash(temp->data + 20, size - 20, temp->data + 4); + + patchShader = 0 == bx::memCmp(program.m_fsh->m_code->data, temp->data, 16); + BX_CHECK(patchShader, "DXBC fragment shader patching error (ShaderHandle: %d).", program.m_fsh - m_shaders); + + if (!patchShader) { - if (0 != bx::memCmp(&program.m_fsh->m_code->data[ii], &temp->data[ii], 16) ) + for (uint32_t ii = 20; ii < temp->size; ii += 16) { -// bx::debugPrintfData(&program.m_fsh->m_code->data[ii], temp->size-ii, ""); -// bx::debugPrintfData(&temp->data[ii], temp->size-ii, ""); - break; + if (0 != bx::memCmp(&program.m_fsh->m_code->data[ii], &temp->data[ii], 16) ) + { + // bx::debugPrintfData(&program.m_fsh->m_code->data[ii], temp->size-ii, ""); + // bx::debugPrintfData(&temp->data[ii], temp->size-ii, ""); + break; + } } + + desc.PS.pShaderBytecode = program.m_fsh->m_code->data; + desc.PS.BytecodeLength = program.m_fsh->m_code->size; } + release(temp); + temp = NULL; + } + + if (patchShader) + { + union { uint32_t offset; void* ptr; } cast = + { + uint32_t(program.m_vsh->m_size)/16 + }; + filter(dxbc.shader, dxbc.shader, patchCb0, cast.ptr); + + temp = alloc(uint32_t(dxbc.shader.byteCode.size() )+1024); + bx::StaticMemoryBlockWriter wr(temp->data, temp->size); + + int32_t size = write(&wr, dxbc, &err); + dxbcHash(temp->data + 20, size - 20, temp->data + 4); + + desc.PS.pShaderBytecode = temp->data; + desc.PS.BytecodeLength = size; + } + else + { desc.PS.pShaderBytecode = program.m_fsh->m_code->data; desc.PS.BytecodeLength = program.m_fsh->m_code->size; } } - - if (patchShader) - { - bx::memCopy(temp->data, program.m_fsh->m_code->data, program.m_fsh->m_code->size); - - bx::seek(&wr, 0, bx::Whence::Begin); - union { uint32_t offset; void* ptr; } cast = - { - uint32_t(program.m_vsh->m_size)/16 - }; - filter(dxbc.shader, dxbc.shader, patchCb0, cast.ptr); - write(&wr, dxbc, &err); - dxbcHash(temp->data + 20, temp->size - 20, temp->data + 4); - - desc.PS.pShaderBytecode = temp->data; - desc.PS.BytecodeLength = temp->size; - } else { - desc.PS.pShaderBytecode = program.m_fsh->m_code->data; - desc.PS.BytecodeLength = program.m_fsh->m_code->size; + desc.PS.pShaderBytecode = NULL; + desc.PS.BytecodeLength = 0; } desc.DS.pShaderBytecode = NULL; @@ -2576,13 +2878,16 @@ data.NumQualityLevels = 0; desc.StreamOutput.RasterizedStream = 0; setBlendState(desc.BlendState, _state); - desc.SampleMask = 1; + desc.SampleMask = UINT32_MAX; setRasterizerState(desc.RasterizerState, _state); setDepthStencilState(desc.DepthStencilState, _state, _stencil); D3D12_INPUT_ELEMENT_DESC vertexElements[Attrib::Count + 1 + BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; - desc.InputLayout.NumElements = setInputLayout(vertexElements, m_vertexDecls[_declIdx], program, _numInstanceData); - desc.InputLayout.pInputElementDescs = vertexElements; + desc.InputLayout.NumElements = setInputLayout(vertexElements, _numStreams, _vertexDecls, program, _numInstanceData); + desc.InputLayout.pInputElementDescs = 0 == desc.InputLayout.NumElements + ? NULL + : vertexElements + ; uint8_t primIndex = uint8_t( (_state&BGFX_STATE_PT_MASK) >> BGFX_STATE_PT_SHIFT); desc.PrimitiveTopologyType = s_primInfo[primIndex].m_topologyType; @@ -2590,20 +2895,29 @@ data.NumQualityLevels = 0; if (isValid(m_fbh) ) { const FrameBufferD3D12& frameBuffer = m_frameBuffers[m_fbh.idx]; - desc.NumRenderTargets = frameBuffer.m_num; - - for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) + if (NULL == frameBuffer.m_swapChain) { - desc.RTVFormats[ii] = m_textures[frameBuffer.m_texture[ii].idx].m_srvd.Format; - } + desc.NumRenderTargets = frameBuffer.m_num; - if (isValid(frameBuffer.m_depth) ) - { - desc.DSVFormat = s_textureFormat[m_textures[frameBuffer.m_depth.idx].m_textureFormat].m_fmtDsv; + for (uint8_t ii = 0, num = frameBuffer.m_num; ii < num; ++ii) + { + desc.RTVFormats[ii] = m_textures[frameBuffer.m_texture[ii].idx].m_srvd.Format; + } + + if (isValid(frameBuffer.m_depth) ) + { + desc.DSVFormat = s_textureFormat[m_textures[frameBuffer.m_depth.idx].m_textureFormat].m_fmtDsv; + } + else + { + desc.DSVFormat = DXGI_FORMAT_UNKNOWN; + } } else { - desc.DSVFormat = DXGI_FORMAT_UNKNOWN; + desc.NumRenderTargets = 1; + desc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.DSVFormat = DXGI_FORMAT_UNKNOWN; } } else @@ -2613,8 +2927,7 @@ data.NumQualityLevels = 0; desc.DSVFormat = DXGI_FORMAT_D24_UNORM_S8_UINT; } - desc.SampleDesc.Count = 1; - desc.SampleDesc.Quality = 0; + desc.SampleDesc = m_scd.sampleDesc; uint32_t length = g_callback->cacheReadSize(hash); bool cached = length > 0; @@ -2647,13 +2960,19 @@ data.NumQualityLevels = 0; if (NULL == pso) { DX_CHECK(m_device->CreateGraphicsPipelineState(&desc - , IID_ID3D12PipelineState - , (void**)&pso - ) ); + , IID_ID3D12PipelineState + , (void**)&pso + ) ); } + + BGFX_FATAL(NULL != pso, Fatal::InvalidShader, "Failed to create PSO!"); + m_pipelineStateCache.add(hash, pso); - release(temp); + if (NULL != temp) + { + release(temp); + } ID3DBlob* blob; HRESULT hr = pso->GetCachedBlob(&blob); @@ -2697,44 +3016,6 @@ data.NumQualityLevels = 0; return _visible == (0 != _render->m_occlusion[_handle.idx]); } - DXGI_FORMAT getBufferFormat() - { -#if BX_PLATFORM_WINDOWS - return m_scd.BufferDesc.Format; -#else - return m_scd.Format; -#endif - } - - uint32_t getBufferWidth() - { -#if BX_PLATFORM_WINDOWS - return m_scd.BufferDesc.Width; -#else - return m_scd.Width; -#endif - } - - uint32_t getBufferHeight() - { -#if BX_PLATFORM_WINDOWS - return m_scd.BufferDesc.Height; -#else - return m_scd.Height; -#endif - } - - void setBufferSize(uint32_t _width, uint32_t _height) - { -#if BX_PLATFORM_WINDOWS - m_scd.BufferDesc.Width = _width; - m_scd.BufferDesc.Height = _height; -#else - m_scd.Width = _width; - m_scd.Height = _height; -#endif - } - void commit(UniformBuffer& _uniformBuffer) { _uniformBuffer.reset(); @@ -2887,8 +3168,8 @@ data.NumQualityLevels = 0; } else { - width = getBufferWidth(); - height = getBufferHeight(); + width = m_scd.width; + height = m_scd.height; } if (0 == _rect.m_x @@ -2923,34 +3204,32 @@ data.NumQualityLevels = 0; m_commandList = NULL; } - void finishAll() + void finishAll(bool _alloc = false) { uint64_t fence = m_cmd.kick(); m_cmd.finish(fence, true); - m_commandList = NULL; + m_commandList = _alloc ? m_cmd.alloc() : NULL; } - void* m_kernel32dll; - void* m_d3d12dll; - void* m_dxgidll; - void* m_renderdocdll; + Dxgi m_dxgi; + NvApi m_nvapi; + + void* m_kernel32Dll; + void* m_d3d12Dll; + void* m_renderDocDll; + void* m_winPixEvent; D3D_FEATURE_LEVEL m_featureLevel; D3D_DRIVER_TYPE m_driverType; - DXGI_ADAPTER_DESC m_adapterDesc; D3D12_FEATURE_DATA_ARCHITECTURE m_architecture; D3D12_FEATURE_DATA_D3D12_OPTIONS m_options; + Dxgi::SwapChainI* m_swapChain; + ID3D12Resource* m_msaaRt; + #if BX_PLATFORM_WINDOWS - IDXGIAdapter3* m_adapter; - IDXGIFactory4* m_factory; - IDXGISwapChain3* m_swapChain; ID3D12InfoQueue* m_infoQueue; -#else - IDXGIAdapter* m_adapter; - IDXGIFactory2* m_factory; - IDXGISwapChain1* m_swapChain; #endif // BX_PLATFORM_WINDOWS int64_t m_presentElapsed; @@ -2961,20 +3240,23 @@ data.NumQualityLevels = 0; TimerQueryD3D12 m_gpuTimer; OcclusionQueryD3D12 m_occlusionQuery; + uint32_t m_deviceInterfaceVersion; + ID3D12DescriptorHeap* m_rtvDescriptorHeap; ID3D12DescriptorHeap* m_dsvDescriptorHeap; D3D12_CPU_DESCRIPTOR_HANDLE m_rtvHandle; D3D12_CPU_DESCRIPTOR_HANDLE m_dsvHandle; D3D12_CPU_DESCRIPTOR_HANDLE* m_currentColor; D3D12_CPU_DESCRIPTOR_HANDLE* m_currentDepthStencil; - ID3D12Resource* m_backBufferColor[4]; - uint64_t m_backBufferColorFence[4]; + ID3D12Resource* m_backBufferColor[BGFX_CONFIG_MAX_BACK_BUFFERS]; + uint64_t m_backBufferColorFence[BGFX_CONFIG_MAX_BACK_BUFFERS]; ID3D12Resource* m_backBufferDepthStencil; - ScratchBufferD3D12 m_scratchBuffer[4]; + ScratchBufferD3D12 m_scratchBuffer[BGFX_CONFIG_MAX_BACK_BUFFERS]; DescriptorAllocatorD3D12 m_samplerAllocator; - ID3D12RootSignature* m_rootSignature; + ID3D12RootSignature* m_rootSignature; + ID3D12CommandSignature* m_commandSignature[3]; CommandQueueD3D12 m_cmd; BatchD3D12 m_batch; @@ -2984,11 +3266,7 @@ data.NumQualityLevels = 0; bool m_wireframe; bool m_lost; -#if BX_PLATFORM_WINDOWS - DXGI_SWAP_CHAIN_DESC m_scd; -#else - DXGI_SWAP_CHAIN_DESC1 m_scd; -#endif // BX_PLATFORM_WINDOWS + SwapChainDesc m_scd; uint32_t m_maxAnisotropy; bool m_depthClamp; @@ -3016,14 +3294,15 @@ data.NumQualityLevels = 0; FrameBufferHandle m_fbh; uint32_t m_backBufferColorIdx; bool m_rtMsaa; + bool m_directAccessSupport; }; static RendererContextD3D12* s_renderD3D12; - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { s_renderD3D12 = BX_NEW(g_allocator, RendererContextD3D12); - if (!s_renderD3D12->init() ) + if (!s_renderD3D12->init(_init) ) { BX_DELETE(g_allocator, s_renderD3D12); s_renderD3D12 = NULL; @@ -3051,20 +3330,22 @@ data.NumQualityLevels = 0; desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; desc.NodeMask = 1; DX_CHECK(device->CreateDescriptorHeap(&desc - , IID_ID3D12DescriptorHeap - , (void**)&m_heap - ) ); + , IID_ID3D12DescriptorHeap + , (void**)&m_heap + ) ); m_upload = createCommittedResource(device, HeapProperty::Upload, desc.NumDescriptors * 1024); m_gpuVA = m_upload->GetGPUVirtualAddress(); - m_upload->Map(0, NULL, (void**)&m_data); + D3D12_RANGE readRange = { 0, 0 }; + m_upload->Map(0, &readRange, (void**)&m_data); reset(m_gpuHandle); } void ScratchBufferD3D12::destroy() { - m_upload->Unmap(0, NULL); + D3D12_RANGE writeRange = { 0, 0 }; + m_upload->Unmap(0, &writeRange); DX_RELEASE(m_upload, 0); DX_RELEASE(m_heap, 0); @@ -3078,6 +3359,14 @@ data.NumQualityLevels = 0; _gpuHandle = m_gpuHandle; } + void ScratchBufferD3D12::allocEmpty(D3D12_GPU_DESCRIPTOR_HANDLE& _gpuHandle) + { + m_cpuHandle.ptr += m_incrementSize; + + _gpuHandle = m_gpuHandle; + m_gpuHandle.ptr += m_incrementSize; + } + void* ScratchBufferD3D12::allocCbv(D3D12_GPU_VIRTUAL_ADDRESS& _gpuAddress, uint32_t _size) { _gpuAddress = m_gpuVA + m_pos; @@ -3085,15 +3374,15 @@ data.NumQualityLevels = 0; m_pos += BX_ALIGN_256(_size); -// D3D12_CONSTANT_BUFFER_VIEW_DESC desc; -// desc.BufferLocation = _gpuAddress; -// desc.SizeInBytes = _size; -// ID3D12Device* device = s_renderD3D12->m_device; -// device->CreateConstantBufferView(&desc -// , m_cpuHandle -// ); -// m_cpuHandle.ptr += m_incrementSize; -// m_gpuHandle.ptr += m_incrementSize; +// D3D12_CONSTANT_BUFFER_VIEW_DESC desc; +// desc.BufferLocation = _gpuAddress; +// desc.SizeInBytes = _size; +// ID3D12Device* device = s_renderD3D12->m_device; +// device->CreateConstantBufferView(&desc +// , m_cpuHandle +// ); +// m_cpuHandle.ptr += m_incrementSize; +// m_gpuHandle.ptr += m_incrementSize; return data; } @@ -3226,9 +3515,9 @@ data.NumQualityLevels = 0; desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; desc.NodeMask = 1; DX_CHECK(device->CreateDescriptorHeap(&desc - , IID_ID3D12DescriptorHeap - , (void**)&m_heap - ) ); + , IID_ID3D12DescriptorHeap + , (void**)&m_heap + ) ); m_cpuHandle = getCPUHandleHeapStart(m_heap); m_gpuHandle = getGPUHandleHeapStart(m_heap); @@ -3267,22 +3556,22 @@ data.NumQualityLevels = 0; { uint32_t flags = _flags[ii]; - const uint32_t cmpFunc = (flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT; - const uint8_t minFilter = s_textureFilter[0][(flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT]; - const uint8_t magFilter = s_textureFilter[1][(flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT]; - const uint8_t mipFilter = s_textureFilter[2][(flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT]; + const uint32_t cmpFunc = (flags&BGFX_SAMPLER_COMPARE_MASK)>>BGFX_SAMPLER_COMPARE_SHIFT; + const uint8_t minFilter = s_textureFilter[0][(flags&BGFX_SAMPLER_MIN_MASK)>>BGFX_SAMPLER_MIN_SHIFT]; + const uint8_t magFilter = s_textureFilter[1][(flags&BGFX_SAMPLER_MAG_MASK)>>BGFX_SAMPLER_MAG_SHIFT]; + const uint8_t mipFilter = s_textureFilter[2][(flags&BGFX_SAMPLER_MIP_MASK)>>BGFX_SAMPLER_MIP_SHIFT]; const uint8_t filter = 0 == cmpFunc ? 0 : D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT; D3D12_SAMPLER_DESC sd; sd.Filter = (D3D12_FILTER)(filter|minFilter|magFilter|mipFilter); - sd.AddressU = s_textureAddress[(flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; - sd.AddressV = s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; - sd.AddressW = s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; + sd.AddressU = s_textureAddress[(flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT]; + sd.AddressV = s_textureAddress[(flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT]; + sd.AddressW = s_textureAddress[(flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT]; sd.MipLODBias = float(BGFX_CONFIG_MIP_LOD_BIAS); sd.MaxAnisotropy = maxAnisotropy; sd.ComparisonFunc = 0 == cmpFunc ? D3D12_COMPARISON_FUNC_NEVER : s_cmpFunc[cmpFunc]; - uint32_t index = (flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT; + uint32_t index = (flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; if (NULL != _palette && needBorderColor(flags) ) @@ -3340,32 +3629,32 @@ data.NumQualityLevels = 0; queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE; queueDesc.NodeMask = 1; DX_CHECK(_device->CreateCommandQueue(&queueDesc - , IID_ID3D12CommandQueue - , (void**)&m_commandQueue - ) ); + , IID_ID3D12CommandQueue + , (void**)&m_commandQueue + ) ); m_completedFence = 0; m_currentFence = 0; DX_CHECK(_device->CreateFence(0 - , D3D12_FENCE_FLAG_NONE - , IID_ID3D12Fence - , (void**)&m_fence - ) ); + , D3D12_FENCE_FLAG_NONE + , IID_ID3D12Fence + , (void**)&m_fence + ) ); for (uint32_t ii = 0; ii < BX_COUNTOF(m_commandList); ++ii) { DX_CHECK(_device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT - , IID_ID3D12CommandAllocator - , (void**)&m_commandList[ii].m_commandAllocator - ) ); + , IID_ID3D12CommandAllocator + , (void**)&m_commandList[ii].m_commandAllocator + ) ); DX_CHECK(_device->CreateCommandList(0 - , D3D12_COMMAND_LIST_TYPE_DIRECT - , m_commandList[ii].m_commandAllocator - , NULL - , IID_ID3D12GraphicsCommandList - , (void**)&m_commandList[ii].m_commandList - ) ); + , D3D12_COMMAND_LIST_TYPE_DIRECT + , m_commandList[ii].m_commandAllocator + , NULL + , IID_ID3D12GraphicsCommandList + , (void**)&m_commandList[ii].m_commandList + ) ); DX_CHECK(m_commandList[ii].m_commandList->Close() ); } @@ -3460,6 +3749,8 @@ data.NumQualityLevels = 0; CloseHandle(commandList.m_event); commandList.m_event = NULL; m_completedFence = m_fence->GetCompletedValue(); + BX_WARN(UINT64_MAX != m_completedFence, "D3D12: Device lost."); + m_commandQueue->Wait(m_fence, m_completedFence); ResourceArray& ra = m_release[m_control.m_read]; @@ -3488,9 +3779,12 @@ data.NumQualityLevels = 0; D3D12_INDIRECT_ARGUMENT_DESC drawArgDesc[] = { - { D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW, { { Rdt::CBV } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 0 } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 1 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 2 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 3 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 4 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW, { { Rdt::CBV } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_DRAW, { { 0 } } }, }; @@ -3503,17 +3797,20 @@ data.NumQualityLevels = 0; }; DX_CHECK(device->CreateCommandSignature(&drawCommandSignature - , rootSignature - , IID_ID3D12CommandSignature - , (void**)&m_commandSignature[Draw] - ) ); + , rootSignature + , IID_ID3D12CommandSignature + , (void**)&m_commandSignature[Draw] + ) ); D3D12_INDIRECT_ARGUMENT_DESC drawIndexedArgDesc[] = { - { D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW, { { Rdt::CBV } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 0 } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 1 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 2 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 3 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_VERTEX_BUFFER_VIEW, { { 4 } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_INDEX_BUFFER_VIEW, { { 0 } } }, + { D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW, { { Rdt::CBV } } }, { D3D12_INDIRECT_ARGUMENT_TYPE_DRAW_INDEXED, { { 0 } } }, }; @@ -3526,21 +3823,22 @@ data.NumQualityLevels = 0; }; DX_CHECK(device->CreateCommandSignature(&drawIndexedCommandSignature - , rootSignature - , IID_ID3D12CommandSignature - , (void**)&m_commandSignature[DrawIndexed] - ) ); + , rootSignature + , IID_ID3D12CommandSignature + , (void**)&m_commandSignature[DrawIndexed] + ) ); m_cmds[Draw ] = BX_ALLOC(g_allocator, m_maxDrawPerBatch*sizeof(DrawIndirectCommand) ); m_cmds[DrawIndexed] = BX_ALLOC(g_allocator, m_maxDrawPerBatch*sizeof(DrawIndexedIndirectCommand) ); + uint32_t cmdSize = bx::max(sizeof(DrawIndirectCommand), sizeof(DrawIndexedIndirectCommand) ); for (uint32_t ii = 0; ii < BX_COUNTOF(m_indirect); ++ii) { - m_indirect[ii].create(m_maxDrawPerBatch*sizeof(DrawIndexedIndirectCommand) + m_indirect[ii].create(m_maxDrawPerBatch*cmdSize , NULL , BGFX_BUFFER_DRAW_INDIRECT , false - , sizeof(DrawIndexedIndirectCommand) + , cmdSize ); } } @@ -3569,45 +3867,159 @@ data.NumQualityLevels = 0; return *cmd; } + uint8_t fill(ID3D12GraphicsCommandList* _commandList, D3D12_VERTEX_BUFFER_VIEW* _vbv, const RenderDraw& _draw, uint32_t& _outNumVertices) + { + uint8_t numStreams = 0; + _outNumVertices = _draw.m_numVertices; + + if (UINT8_MAX != _draw.m_streamMask) + { + for (uint32_t idx = 0, streamMask = _draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams + ) + { + streamMask >>= ntz; + idx += ntz; + + const Stream& stream = _draw.m_stream[idx]; + + uint16_t handle = stream.m_handle.idx; + VertexBufferD3D12& vb = s_renderD3D12->m_vertexBuffers[handle]; + vb.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + + uint16_t decl = !isValid(vb.m_decl) ? stream.m_decl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = s_renderD3D12->m_vertexDecls[decl]; + uint32_t stride = vertexDecl.m_stride; + + D3D12_VERTEX_BUFFER_VIEW& vbv = _vbv[numStreams]; + vbv.BufferLocation = vb.m_gpuVA + stream.m_startVertex * stride; + vbv.StrideInBytes = vertexDecl.m_stride; + vbv.SizeInBytes = vb.m_size; + + _outNumVertices = bx::uint32_min(UINT32_MAX == _draw.m_numVertices + ? vb.m_size/stride + : _draw.m_numVertices + , _outNumVertices + ); + } + } + + return numStreams; + } + uint32_t BatchD3D12::draw(ID3D12GraphicsCommandList* _commandList, D3D12_GPU_VIRTUAL_ADDRESS _cbv, const RenderDraw& _draw) { - Enum type = Enum(!!isValid(_draw.m_indexBuffer) ); - - VertexBufferD3D12& vb = s_renderD3D12->m_vertexBuffers[_draw.m_stream[0].m_handle.idx]; - vb.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - - uint16_t declIdx = !isValid(vb.m_decl) ? _draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = s_renderD3D12->m_vertexDecls[declIdx]; - uint32_t numIndices = 0; - - if (Draw == type) + if (isValid(_draw.m_indirectBuffer) ) { - const uint32_t numVertices = UINT32_MAX == _draw.m_numVertices - ? vb.m_size / vertexDecl.m_stride - : _draw.m_numVertices - ; + _commandList->SetGraphicsRootConstantBufferView(Rdt::CBV, _cbv); + + D3D12_VERTEX_BUFFER_VIEW vbvs[BGFX_CONFIG_MAX_VERTEX_STREAMS+1]; + + uint32_t numVertices; + uint8_t numStreams = fill(_commandList, vbvs, _draw, numVertices); - DrawIndirectCommand& cmd = getCmd(Draw); - cmd.cbv = _cbv; - cmd.vbv[0].BufferLocation = vb.m_gpuVA; - cmd.vbv[0].StrideInBytes = vertexDecl.m_stride; - cmd.vbv[0].SizeInBytes = vb.m_size; if (isValid(_draw.m_instanceDataBuffer) ) { VertexBufferD3D12& inst = s_renderD3D12->m_vertexBuffers[_draw.m_instanceDataBuffer.idx]; inst.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - cmd.vbv[1].BufferLocation = inst.m_gpuVA + _draw.m_instanceDataOffset; - cmd.vbv[1].StrideInBytes = _draw.m_instanceDataStride; - cmd.vbv[1].SizeInBytes = _draw.m_numInstances * _draw.m_instanceDataStride; + D3D12_VERTEX_BUFFER_VIEW& vbv = vbvs[numStreams++]; + vbv.BufferLocation = inst.m_gpuVA + _draw.m_instanceDataOffset; + vbv.StrideInBytes = _draw.m_instanceDataStride; + vbv.SizeInBytes = _draw.m_numInstances * _draw.m_instanceDataStride; + } + + _commandList->IASetVertexBuffers(0 + , numStreams + , vbvs + ); + + const VertexBufferD3D12& indirect = s_renderD3D12->m_vertexBuffers[_draw.m_indirectBuffer.idx]; + const uint32_t numDrawIndirect = UINT16_MAX == _draw.m_numIndirect + ? indirect.m_size/BGFX_CONFIG_DRAW_INDIRECT_STRIDE + : _draw.m_numIndirect + ; + + uint32_t numIndices = 0; + + if (isValid(_draw.m_indexBuffer) ) + { + BufferD3D12& ib = s_renderD3D12->m_indexBuffers[_draw.m_indexBuffer.idx]; + ib.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + + const bool hasIndex16 = 0 == (ib.m_flags & BGFX_BUFFER_INDEX32); + const uint32_t indexSize = hasIndex16 ? 2 : 4; + + numIndices = UINT32_MAX == _draw.m_numIndices + ? ib.m_size / indexSize + : _draw.m_numIndices + ; + + D3D12_INDEX_BUFFER_VIEW ibv; + ibv.BufferLocation = ib.m_gpuVA; + ibv.SizeInBytes = ib.m_size; + ibv.Format = hasIndex16 + ? DXGI_FORMAT_R16_UINT + : DXGI_FORMAT_R32_UINT + ; + _commandList->IASetIndexBuffer(&ibv); + + _commandList->ExecuteIndirect( + s_renderD3D12->m_commandSignature[2] + , numDrawIndirect + , indirect.m_ptr + , _draw.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE + , NULL + , 0 + ); } else { - bx::memSet(&cmd.vbv[1], 0, sizeof(cmd.vbv[1]) ); + _commandList->ExecuteIndirect( + s_renderD3D12->m_commandSignature[1] + , numDrawIndirect + , indirect.m_ptr + , _draw.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE + , NULL + , 0 + ); } - cmd.draw.InstanceCount = _draw.m_numInstances; - cmd.draw.VertexCountPerInstance = numVertices; - cmd.draw.StartVertexLocation = _draw.m_stream[0].m_startVertex; - cmd.draw.StartInstanceLocation = 0; + + return numIndices; + } + + Enum type = Enum(!!isValid(_draw.m_indexBuffer) ); + + uint32_t numIndices = 0; + + if (Draw == type) + { + DrawIndirectCommand& cmd = getCmd(Draw); + cmd.cbv = _cbv; + + uint32_t numVertices; + uint8_t numStreams = fill(_commandList, cmd.vbv, _draw, numVertices); + + if (isValid(_draw.m_instanceDataBuffer) ) + { + VertexBufferD3D12& inst = s_renderD3D12->m_vertexBuffers[_draw.m_instanceDataBuffer.idx]; + inst.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + D3D12_VERTEX_BUFFER_VIEW& vbv = cmd.vbv[numStreams++]; + vbv.BufferLocation = inst.m_gpuVA + _draw.m_instanceDataOffset; + vbv.StrideInBytes = _draw.m_instanceDataStride; + vbv.SizeInBytes = _draw.m_numInstances * _draw.m_instanceDataStride; + } + + for (; numStreams < BX_COUNTOF(cmd.vbv); ++numStreams) + { + D3D12_VERTEX_BUFFER_VIEW* vbv = &cmd.vbv[numStreams]; + bx::memSet(vbv, 0, sizeof(D3D12_VERTEX_BUFFER_VIEW)); + } + + cmd.args.InstanceCount = _draw.m_numInstances; + cmd.args.VertexCountPerInstance = numVertices; + cmd.args.StartVertexLocation = 0; + cmd.args.StartInstanceLocation = 0; } else { @@ -3630,26 +4042,31 @@ data.NumQualityLevels = 0; ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT ; - cmd.vbv[0].BufferLocation = vb.m_gpuVA; - cmd.vbv[0].StrideInBytes = vertexDecl.m_stride; - cmd.vbv[0].SizeInBytes = vb.m_size; + + uint32_t numVertices; + uint8_t numStreams = fill(_commandList, cmd.vbv, _draw, numVertices); + if (isValid(_draw.m_instanceDataBuffer) ) { VertexBufferD3D12& inst = s_renderD3D12->m_vertexBuffers[_draw.m_instanceDataBuffer.idx]; inst.setState(_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - cmd.vbv[1].BufferLocation = inst.m_gpuVA + _draw.m_instanceDataOffset; - cmd.vbv[1].StrideInBytes = _draw.m_instanceDataStride; - cmd.vbv[1].SizeInBytes = _draw.m_numInstances * _draw.m_instanceDataStride; + D3D12_VERTEX_BUFFER_VIEW& vbv = cmd.vbv[numStreams++]; + vbv.BufferLocation = inst.m_gpuVA + _draw.m_instanceDataOffset; + vbv.StrideInBytes = _draw.m_instanceDataStride; + vbv.SizeInBytes = _draw.m_numInstances * _draw.m_instanceDataStride; } - else + + for (; numStreams < BX_COUNTOF(cmd.vbv); ++numStreams) { - bx::memSet(&cmd.vbv[1], 0, sizeof(cmd.vbv[1]) ); + D3D12_VERTEX_BUFFER_VIEW* vbv = &cmd.vbv[numStreams]; + bx::memSet(vbv, 0, sizeof(D3D12_VERTEX_BUFFER_VIEW)); } - cmd.drawIndexed.IndexCountPerInstance = numIndices; - cmd.drawIndexed.InstanceCount = _draw.m_numInstances; - cmd.drawIndexed.StartIndexLocation = _draw.m_startIndex; - cmd.drawIndexed.BaseVertexLocation = _draw.m_stream[0].m_startVertex; - cmd.drawIndexed.StartInstanceLocation = 0; + + cmd.args.IndexCountPerInstance = numIndices; + cmd.args.InstanceCount = _draw.m_numInstances; + cmd.args.StartIndexLocation = _draw.m_startIndex; + cmd.args.BaseVertexLocation = 0; + cmd.args.StartInstanceLocation = 0; } if (BX_UNLIKELY(m_flushPerBatch == m_num[type]) ) @@ -3712,16 +4129,16 @@ data.NumQualityLevels = 0; { bx::memCopy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ); _commandList->IASetVertexBuffers(0 - , 0 == cmd.vbv[1].BufferLocation ? 1 : 2 + , BGFX_CONFIG_MAX_VERTEX_STREAMS+1 , cmd.vbv ); } _commandList->DrawInstanced( - cmd.draw.VertexCountPerInstance - , cmd.draw.InstanceCount - , cmd.draw.StartVertexLocation - , cmd.draw.StartInstanceLocation + cmd.args.VertexCountPerInstance + , cmd.args.InstanceCount + , cmd.args.StartVertexLocation + , cmd.args.StartInstanceLocation ); } } @@ -3742,7 +4159,7 @@ data.NumQualityLevels = 0; { bx::memCopy(m_current.vbv, cmd.vbv, sizeof(cmd.vbv) ); _commandList->IASetVertexBuffers(0 - , 0 == cmd.vbv[1].BufferLocation ? 1 : 2 + , BGFX_CONFIG_MAX_VERTEX_STREAMS+1 , cmd.vbv ); } @@ -3754,11 +4171,11 @@ data.NumQualityLevels = 0; } _commandList->DrawIndexedInstanced( - cmd.drawIndexed.IndexCountPerInstance - , cmd.drawIndexed.InstanceCount - , cmd.drawIndexed.StartIndexLocation - , cmd.drawIndexed.BaseVertexLocation - , cmd.drawIndexed.StartInstanceLocation + cmd.args.IndexCountPerInstance + , cmd.args.InstanceCount + , cmd.args.StartIndexLocation + , cmd.args.BaseVertexLocation + , cmd.args.StartInstanceLocation ); } } @@ -3827,6 +4244,9 @@ data.NumQualityLevels = 0; if (drawIndirect) { +#if BX_PLATFORM_XBOXONE + flags |= D3D12XBOX_RESOURCE_FLAG_ALLOW_INDIRECT_BUFFER; +#endif // BX_PLATFORM_XBOXONE format = DXGI_FORMAT_R32G32B32A32_UINT; stride = 16; } @@ -3900,9 +4320,12 @@ data.NumQualityLevels = 0; { ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, _size); uint8_t* data; - DX_CHECK(staging->Map(0, NULL, (void**)&data) ); + + D3D12_RANGE readRange = { 0, 0 }; + DX_CHECK(staging->Map(0, &readRange, (void**)&data) ); bx::memCopy(data, _data, _size); - staging->Unmap(0, NULL); + D3D12_RANGE writeRange = { 0, _size }; + staging->Unmap(0, &writeRange); D3D12_RESOURCE_STATES state = setState(_commandList, D3D12_RESOURCE_STATE_COPY_DEST); _commandList->CopyBufferRegion(m_ptr, _offset, staging, 0, _size); @@ -3917,6 +4340,7 @@ data.NumQualityLevels = 0; { s_renderD3D12->m_cmd.release(m_ptr); m_dynamic = false; + m_state = D3D12_RESOURCE_STATE_COMMON; } } @@ -3930,7 +4354,7 @@ data.NumQualityLevels = 0; , _state ); - bx::xchg(m_state, _state); + bx::swap(m_state, _state); } return _state; @@ -3949,22 +4373,21 @@ data.NumQualityLevels = 0; uint32_t magic; bx::read(&reader, magic); - switch (magic) + const bool fragment = isShaderType(magic, 'F'); + + uint32_t hashIn; + bx::read(&reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) { - case BGFX_CHUNK_MAGIC_CSH: - case BGFX_CHUNK_MAGIC_FSH: - case BGFX_CHUNK_MAGIC_VSH: - break; - - default: - BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic); - break; + hashOut = hashIn; + } + else + { + bx::read(&reader, hashOut); } - - bool fragment = BGFX_CHUNK_MAGIC_FSH == magic; - - uint32_t iohash; - bx::read(&reader, iohash); uint16_t count; bx::read(&reader, count); @@ -3973,7 +4396,7 @@ data.NumQualityLevels = 0; m_numUniforms = count; BX_TRACE("%s Shader consts %d" - , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute" + , getShaderTypeName(magic) , count ); @@ -4079,7 +4502,8 @@ data.NumQualityLevels = 0; bx::HashMurmur2A murmur; murmur.begin(); - murmur.add(iohash); + murmur.add(hashIn); + murmur.add(hashOut); murmur.add(code, shaderSize); murmur.add(numAttrs); murmur.add(m_attrMask, numAttrs); @@ -4088,7 +4512,7 @@ data.NumQualityLevels = 0; bx::read(&reader, m_size); } - void TextureD3D12::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) + void* TextureD3D12::create(const Memory* _mem, uint64_t _flags, uint8_t _skip) { bimg::ImageContainer imageContainer; @@ -4133,18 +4557,11 @@ data.NumQualityLevels = 0; const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) ); const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); - uint32_t blockWidth = 1; - uint32_t blockHeight = 1; - - if (convert && compressed) - { - blockWidth = blockInfo.blockWidth; - blockHeight = blockInfo.blockHeight; - } const bool writeOnly = 0 != (m_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE); const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); + const bool blit = 0 != (m_flags&BGFX_TEXTURE_BLIT_DST); BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s RT[%c], BO[%c], CW[%c]%s." , this - s_renderD3D12->m_textures @@ -4159,50 +4576,45 @@ data.NumQualityLevels = 0; , swizzle ? " (swizzle BGRA8 -> RGBA8)" : "" ); - uint32_t totalSize = 0; - for (uint8_t side = 0; side < numSides; ++side) { - uint32_t width = textureWidth; - uint32_t height = textureHeight; - uint32_t depth = imageContainer.m_depth; - for (uint8_t lod = 0; lod < numMips; ++lod) { - width = bx::uint32_max(blockWidth, width); - height = bx::uint32_max(blockHeight, height); - depth = bx::uint32_max(1, depth); - bimg::ImageMip mip; if (bimg::imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) ) { if (convert) { - const uint32_t pitch = bx::strideAlign(width*bpp / 8, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); - const uint32_t slice = bx::strideAlign(pitch * height, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); + const uint32_t pitch = bx::strideAlign(bx::max(mip.m_width, 4)*bpp/8, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); + const uint32_t slice = bx::strideAlign(bx::max(mip.m_height, 4)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); + const uint32_t size = slice*mip.m_depth; - uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice); - bimg::imageDecodeToBgra8(temp - , mip.m_data - , mip.m_width - , mip.m_height - , pitch, mip.m_format - ); + uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size); + bimg::imageDecodeToBgra8( + g_allocator + , temp + , mip.m_data + , mip.m_width + , mip.m_height + , pitch + , mip.m_format + ); srd[kk].pData = temp; srd[kk].RowPitch = pitch; srd[kk].SlicePitch = slice; - totalSize += slice; } else if (compressed) { - uint32_t pitch = bx::strideAlign( (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); - uint32_t slice = bx::strideAlign( (mip.m_height/blockInfo.blockHeight)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); + const uint32_t pitch = bx::strideAlign( (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); + const uint32_t slice = bx::strideAlign( (mip.m_height/blockInfo.blockHeight)*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); + const uint32_t size = slice*mip.m_depth; - uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice); + uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size); bimg::imageCopy(temp - , mip.m_height/blockInfo.blockHeight + , mip.m_height/blockInfo.blockHeight , (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize + , mip.m_depth , mip.m_data , pitch ); @@ -4210,17 +4622,17 @@ data.NumQualityLevels = 0; srd[kk].pData = temp; srd[kk].RowPitch = pitch; srd[kk].SlicePitch = slice; - totalSize += slice; } else { const uint32_t pitch = bx::strideAlign(mip.m_width*mip.m_bpp / 8, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); - const uint32_t slice = bx::strideAlign(pitch * mip.m_height, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); + const uint32_t slice = bx::strideAlign(mip.m_height*pitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); - uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice); + uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, slice*mip.m_depth); bimg::imageCopy(temp , mip.m_height - , mip.m_width*mip.m_bpp / 8 + , mip.m_width*mip.m_bpp/8 + , mip.m_depth , mip.m_data , pitch ); @@ -4228,27 +4640,13 @@ data.NumQualityLevels = 0; srd[kk].pData = temp; srd[kk].RowPitch = pitch; srd[kk].SlicePitch = slice; - totalSize += slice; } - srd[kk].SlicePitch = mip.m_height*srd[kk].RowPitch; ++kk; } - else - { - const uint32_t pitch = bx::strideAlign(width*bpp / 8, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT); - const uint32_t slice = bx::strideAlign(pitch * height, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT); - totalSize += slice; - } - - width >>= 1; - height >>= 1; - depth >>= 1; } } - BX_TRACE("texture total size: %d", totalSize); - const uint32_t msaaQuality = bx::uint32_satsub( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1); const DXGI_SAMPLE_DESC& msaa = s_msaa[msaaQuality]; @@ -4268,7 +4666,7 @@ data.NumQualityLevels = 0; ID3D12GraphicsCommandList* commandList = s_renderD3D12->m_commandList; D3D12_RESOURCE_DESC resourceDesc; - resourceDesc.Alignment = 0; + resourceDesc.Alignment = 1 < msaa.Count ? D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT : 0; resourceDesc.Width = textureWidth; resourceDesc.Height = textureHeight; resourceDesc.MipLevels = numMips; @@ -4294,14 +4692,16 @@ data.NumQualityLevels = 0; } else if (renderTarget) { + resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + state |= D3D12_RESOURCE_STATE_RENDER_TARGET; + state &= ~D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE; + clearValue = (D3D12_CLEAR_VALUE*)alloca(sizeof(D3D12_CLEAR_VALUE) ); clearValue->Format = resourceDesc.Format; clearValue->Color[0] = 0.0f; clearValue->Color[1] = 0.0f; clearValue->Color[2] = 0.0f; clearValue->Color[3] = 0.0f; - - resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; } if (writeOnly) @@ -4315,6 +4715,18 @@ data.NumQualityLevels = 0; resourceDesc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; } + if (blit) + { + state = D3D12_RESOURCE_STATE_COPY_DEST; + } + + const bool directAccess = s_renderD3D12->m_directAccessSupport + && !renderTarget +// && !readBack + && !blit + && !writeOnly + ; + switch (m_type) { case Texture2D: @@ -4400,36 +4812,21 @@ data.NumQualityLevels = 0; break; } - m_ptr = createCommittedResource(device, HeapProperty::Default, &resourceDesc, clearValue); + m_ptr = createCommittedResource(device, HeapProperty::Texture, &resourceDesc, clearValue, renderTarget); + if (directAccess) { - uint64_t uploadBufferSize; - uint32_t* numRows = (uint32_t*)alloca(sizeof(uint32_t)*numSrd); - uint64_t* rowSizeInBytes = (uint64_t*)alloca(sizeof(uint64_t)*numSrd); - D3D12_PLACED_SUBRESOURCE_FOOTPRINT* layouts = (D3D12_PLACED_SUBRESOURCE_FOOTPRINT*)alloca(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT)*numSrd); - - device->GetCopyableFootprints(&resourceDesc - , 0 - , numSrd - , 0 - , layouts - , numRows - , rowSizeInBytes - , &uploadBufferSize - ); - BX_WARN(uploadBufferSize == totalSize, "uploadBufferSize %d (totalSize %d), numRows %d, rowSizeInBytes %d" - , uploadBufferSize - , totalSize - , numRows[0] - , rowSizeInBytes[0] - ); + DX_CHECK(m_ptr->Map(0, NULL, &m_directAccessPtr) ); } if (kk != 0) { - ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, totalSize); + uint64_t uploadBufferSize; + device->GetCopyableFootprints(&resourceDesc, 0, numSrd, 0, NULL, NULL, NULL, &uploadBufferSize); - setState(commandList,D3D12_RESOURCE_STATE_COPY_DEST); + ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, uint32_t(uploadBufferSize) ); + + setState(commandList, D3D12_RESOURCE_STATE_COPY_DEST); uint64_t result = UpdateSubresources(commandList , m_ptr @@ -4464,20 +4861,30 @@ data.NumQualityLevels = 0; } } } + + return m_directAccessPtr; } void TextureD3D12::destroy() { if (NULL != m_ptr) { + if (NULL != m_directAccessPtr) + { + D3D12_RANGE writeRange = { 0, 0 }; + m_ptr->Unmap(0, &writeRange); + m_directAccessPtr = NULL; + } + s_renderD3D12->m_cmd.release(m_ptr); - m_ptr = NULL; + m_ptr = NULL; + m_state = D3D12_RESOURCE_STATE_COMMON; } } void TextureD3D12::update(ID3D12GraphicsCommandList* _commandList, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) { - setState(_commandList, D3D12_RESOURCE_STATE_COPY_DEST); + D3D12_RESOURCE_STATES state = setState(_commandList, D3D12_RESOURCE_STATE_COPY_DEST); const uint32_t subres = _mip + (_side * m_numMips); const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); @@ -4506,12 +4913,14 @@ data.NumQualityLevels = 0; ID3D12Resource* staging = createCommittedResource(s_renderD3D12->m_device, HeapProperty::Upload, totalBytes); uint8_t* data; - DX_CHECK(staging->Map(0, NULL, (void**)&data) ); + D3D12_RANGE readRange = { 0, 0 }; + DX_CHECK(staging->Map(0, &readRange, (void**)&data) ); for (uint32_t ii = 0, height = _rect.m_height; ii < height; ++ii) { bx::memCopy(&data[ii*rowPitch], &_mem->data[ii*srcpitch], srcpitch); } - staging->Unmap(0, NULL); + D3D12_RANGE writeRange = { 0, _rect.m_height*srcpitch }; + staging->Unmap(0, &writeRange); D3D12_BOX box; box.left = 0; @@ -4526,13 +4935,14 @@ data.NumQualityLevels = 0; D3D12_TEXTURE_COPY_LOCATION src = { staging, D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT, { layout } }; _commandList->CopyTextureRegion(&dst, _rect.m_x, _rect.m_y, 0, &src, &box); - setState(_commandList, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + setState(_commandList, state); s_renderD3D12->m_cmd.release(staging); } - void TextureD3D12::resolve() + void TextureD3D12::resolve(uint8_t _resolve) const { + BX_UNUSED(_resolve); } D3D12_RESOURCE_STATES TextureD3D12::setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state) @@ -4545,7 +4955,7 @@ data.NumQualityLevels = 0; , _state ); - bx::xchg(m_state, _state); + bx::swap(m_state, _state); } return _state; @@ -4560,8 +4970,83 @@ data.NumQualityLevels = 0; postReset(); } - void FrameBufferD3D12::create(uint16_t /*_denseIdx*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) + void FrameBufferD3D12::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) { + BX_UNUSED(_nwh, _width, _height, _depthFormat); + +#if BX_PLATFORM_WINDOWS + SwapChainDesc scd; + bx::memCopy(&scd, &s_renderD3D12->m_scd, sizeof(DXGI_SWAP_CHAIN_DESC) ); + scd.format = TextureFormat::Count == _format ? scd.format : s_textureFormat[_format].m_fmt; + scd.width = _width; + scd.height = _height; + scd.nwh = _nwh; + + HRESULT hr; + hr = s_renderD3D12->m_dxgi.createSwapChain( + s_renderD3D12->getDeviceForSwapChain() + , scd + , &m_swapChain + ); + BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain."); + m_state = D3D12_RESOURCE_STATE_PRESENT; + + DX_CHECK(s_renderD3D12->m_dxgi.m_factory->MakeWindowAssociation( + (HWND)_nwh + , 0 + | DXGI_MWA_NO_WINDOW_CHANGES + | DXGI_MWA_NO_ALT_ENTER + ) ); + + ID3D12Device* device = s_renderD3D12->m_device; + FrameBufferHandle fbh = { uint16_t(this - s_renderD3D12->m_frameBuffers) }; + + for (uint32_t ii = 0, num = scd.bufferCount; ii < num; ++ii) + { + D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = s_renderD3D12->getRtv(fbh, uint8_t(ii) ); + + ID3D12Resource* colorBuffer; + DX_CHECK(m_swapChain->GetBuffer(ii + , IID_ID3D12Resource + , (void**)&colorBuffer + ) ); + device->CreateRenderTargetView(colorBuffer, NULL, rtvHandle); + DX_RELEASE(colorBuffer, 0); + } +#endif // BX_PLATFORM_WINDOWS + + m_nwh = _nwh; + m_denseIdx = _denseIdx; + m_num = 1; + } + + uint16_t FrameBufferD3D12::destroy() + { + DX_RELEASE(m_swapChain, 0); + + m_nwh = NULL; + m_numTh = 0; + m_needPresent = false; + + m_depth.idx = bgfx::kInvalidHandle; + + uint16_t denseIdx = m_denseIdx; + m_denseIdx = UINT16_MAX; + + return denseIdx; + } + + HRESULT FrameBufferD3D12::present(uint32_t _syncInterval, uint32_t _flags) + { + if (m_needPresent) + { + HRESULT hr = m_swapChain->Present(_syncInterval, _flags); + hr = !isLost(hr) ? S_OK : hr; + m_needPresent = false; + return hr; + } + + return S_OK; } void FrameBufferD3D12::preReset() @@ -4585,10 +5070,11 @@ data.NumQualityLevels = 0; m_num = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - const TextureD3D12& texture = s_renderD3D12->m_textures[handle.idx]; + const TextureD3D12& texture = s_renderD3D12->m_textures[at.handle.idx]; if (0 == m_width) { @@ -4600,7 +5086,7 @@ data.NumQualityLevels = 0; if (bimg::isDepth(bimg::TextureFormat::Enum(texture.m_textureFormat) ) ) { BX_CHECK(!isValid(m_depth), ""); - m_depth = handle; + m_depth = at.handle; D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_dsvDescriptorHeap); uint32_t dsvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); dsvDescriptor.ptr += (1 + fbhIdx) * dsvDescriptorSize; @@ -4609,7 +5095,7 @@ data.NumQualityLevels = 0; BX_UNUSED(blockInfo); D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc; - ZeroMemory(&dsvDesc, sizeof(dsvDesc) ); + bx::memSet(&dsvDesc, 0, sizeof(dsvDesc) ); dsvDesc.Format = s_textureFormat[texture.m_textureFormat].m_fmtDsv; dsvDesc.ViewDimension = D3D12_DSV_DIMENSION_TEXTURE2D; dsvDesc.Flags = D3D12_DSV_FLAG_NONE @@ -4621,50 +5107,116 @@ data.NumQualityLevels = 0; , &dsvDesc , dsvDescriptor ); + + s_renderD3D12->m_commandList->ClearDepthStencilView( + dsvDescriptor + , D3D12_CLEAR_FLAG_DEPTH|D3D12_CLEAR_FLAG_STENCIL + , 0.0f + , 0 + , 0 + , NULL + ); + } + else if (Access::Write == at.access) + { + m_texture[m_num] = at.handle; + D3D12_CPU_DESCRIPTOR_HANDLE rtv = { rtvDescriptor.ptr + m_num * rtvDescriptorSize }; + + D3D12_RENDER_TARGET_VIEW_DESC desc; + desc.Format = texture.m_srvd.Format; + + switch (texture.m_type) + { + default: + case TextureD3D12::Texture2D: +// if (1 < msaa.Count) +// { +// desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMS; +// } +// else + { + desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; + desc.Texture2D.MipSlice = at.mip; + desc.Texture2D.PlaneSlice = 0; + } + break; + + case TextureD3D12::TextureCube: +// if (1 < msaa.Count) +// { +// desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY; +// desc.Texture2DMSArray.ArraySize = 1; +// desc.Texture2DMSArray.FirstArraySlice = at.layer; +// } +// else + { + desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2DARRAY; + desc.Texture2DArray.ArraySize = 1; + desc.Texture2DArray.FirstArraySlice = at.layer; + desc.Texture2DArray.MipSlice = at.mip; + desc.Texture2DArray.PlaneSlice = 0; + } + break; + + case TextureD3D12::Texture3D: + desc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE3D; + desc.Texture3D.MipSlice = at.mip; + desc.Texture3D.WSize = 1; + desc.Texture3D.FirstWSlice = at.layer; + break; + } + + device->CreateRenderTargetView(texture.m_ptr + , &desc + , rtv + ); + + float rgba[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; + s_renderD3D12->m_commandList->ClearRenderTargetView( + rtv + , rgba + , 0 + , NULL + ); + + m_num++; } else { - m_texture[m_num] = handle; - D3D12_CPU_DESCRIPTOR_HANDLE rtv = { rtvDescriptor.ptr + m_num * rtvDescriptorSize }; - device->CreateRenderTargetView(texture.m_ptr - , NULL - , rtv - ); - m_num++; + BX_CHECK(false, ""); } } } } } - uint16_t FrameBufferD3D12::destroy() - { - m_numTh = 0; - - m_depth.idx = bgfx::kInvalidHandle; - - uint16_t denseIdx = m_denseIdx; - m_denseIdx = UINT16_MAX; - - return denseIdx; - } - void FrameBufferD3D12::resolve() { + if (0 < m_numTh) + { + for (uint32_t ii = 0; ii < m_numTh; ++ii) + { + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) + { + const TextureD3D12& texture = s_renderD3D12->m_textures[at.handle.idx]; + texture.resolve(at.resolve); + } + } + } } void FrameBufferD3D12::clear(ID3D12GraphicsCommandList* _commandList, const Clear& _clear, const float _palette[][4], const D3D12_RECT* _rect, uint32_t _num) { ID3D12Device* device = s_renderD3D12->m_device; - const uint32_t fbhIdx = (uint32_t)(this - s_renderD3D12->m_frameBuffers); + FrameBufferHandle fbh = { (uint16_t)(this - s_renderD3D12->m_frameBuffers) }; + D3D12_CPU_DESCRIPTOR_HANDLE rtv = s_renderD3D12->getRtv(fbh); + uint32_t rtvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); if (BGFX_CLEAR_COLOR & _clear.m_flags && 0 != m_num) { - D3D12_CPU_DESCRIPTOR_HANDLE rtvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_rtvDescriptorHeap); - uint32_t rtvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); - rtvDescriptor.ptr += (BX_COUNTOF(s_renderD3D12->m_backBufferColor) + fbhIdx * BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) * rtvDescriptorSize; - if (BGFX_CLEAR_COLOR_USE_PALETTE & _clear.m_flags) { for (uint32_t ii = 0, num = m_num; ii < num; ++ii) @@ -4672,12 +5224,12 @@ data.NumQualityLevels = 0; uint8_t index = _clear.m_index[ii]; if (UINT8_MAX != index) { - D3D12_CPU_DESCRIPTOR_HANDLE rtv = { rtvDescriptor.ptr + ii * rtvDescriptorSize }; _commandList->ClearRenderTargetView(rtv , _palette[index] , _num , _rect ); + rtv.ptr += rtvDescriptorSize; } } } @@ -4692,12 +5244,12 @@ data.NumQualityLevels = 0; }; for (uint32_t ii = 0, num = m_num; ii < num; ++ii) { - D3D12_CPU_DESCRIPTOR_HANDLE rtv = { rtvDescriptor.ptr + ii * rtvDescriptorSize }; _commandList->ClearRenderTargetView(rtv , frgba , _num , _rect ); + rtv.ptr += rtvDescriptorSize; } } } @@ -4707,7 +5259,7 @@ data.NumQualityLevels = 0; { D3D12_CPU_DESCRIPTOR_HANDLE dsvDescriptor = getCPUHandleHeapStart(s_renderD3D12->m_dsvDescriptorHeap); uint32_t dsvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); - dsvDescriptor.ptr += (1 + fbhIdx) * dsvDescriptorSize; + dsvDescriptor.ptr += (1 + fbh.idx) * dsvDescriptorSize; DWORD flags = 0; flags |= (_clear.m_flags & BGFX_CLEAR_DEPTH) ? D3D12_CLEAR_FLAG_DEPTH : 0; @@ -4723,6 +5275,30 @@ data.NumQualityLevels = 0; } } + D3D12_RESOURCE_STATES FrameBufferD3D12::setState(ID3D12GraphicsCommandList* _commandList, uint8_t _idx, D3D12_RESOURCE_STATES _state) + { + if (m_state != _state) + { + ID3D12Resource* colorBuffer; + DX_CHECK(m_swapChain->GetBuffer(_idx + , IID_ID3D12Resource + , (void**)&colorBuffer + ) ); + + setResourceBarrier(_commandList + , colorBuffer + , m_state + , _state + ); + + DX_RELEASE(colorBuffer, 0); + + bx::swap(m_state, _state); + } + + return _state; + } + void TimerQueryD3D12::init() { D3D12_QUERY_HEAP_DESC queryHeapDesc; @@ -4856,9 +5432,9 @@ data.NumQualityLevels = 0; queryHeapDesc.NodeMask = 1; queryHeapDesc.Type = D3D12_QUERY_HEAP_TYPE_OCCLUSION; DX_CHECK(s_renderD3D12->m_device->CreateQueryHeap(&queryHeapDesc - , IID_ID3D12QueryHeap - , (void**)&m_queryHeap - ) ); + , IID_ID3D12QueryHeap + , (void**)&m_queryHeap + ) ); const uint32_t size = BX_COUNTOF(m_handle)*sizeof(uint64_t); m_readback = createCommittedResource(s_renderD3D12->m_device @@ -4937,13 +5513,28 @@ data.NumQualityLevels = 0; void RendererContextD3D12::submitBlit(BlitState& _bs, uint16_t _view) { + TextureHandle currentSrc = { kInvalidHandle }; + D3D12_RESOURCE_STATES state = D3D12_RESOURCE_STATES(UINT32_MAX); + while (_bs.hasItem(_view) ) { const BlitItem& blit = _bs.advance(); - const TextureD3D12& src = m_textures[blit.m_src.idx]; + TextureD3D12& src = m_textures[blit.m_src.idx]; const TextureD3D12& dst = m_textures[blit.m_dst.idx]; + if (currentSrc.idx != blit.m_src.idx) + { + if (D3D12_RESOURCE_STATES(UINT32_MAX) != state) + { + m_textures[currentSrc.idx].setState(m_commandList, state); + } + + currentSrc = blit.m_src; + + state = src.setState(m_commandList, D3D12_RESOURCE_STATE_COPY_SOURCE); + } + uint32_t srcWidth = bx::uint32_min(src.m_width, blit.m_srcX + blit.m_width) - blit.m_srcX; uint32_t srcHeight = bx::uint32_min(src.m_height, blit.m_srcY + blit.m_height) - blit.m_srcY; uint32_t srcDepth = bx::uint32_min(src.m_depth, blit.m_srcZ + blit.m_depth) - blit.m_srcZ; @@ -4964,8 +5555,8 @@ data.NumQualityLevels = 0; box.bottom = blit.m_srcY + height;; box.back = blit.m_srcZ + bx::uint32_imax(1, depth); - D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{}} }; - D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, {{}} }; + D3D12_TEXTURE_COPY_LOCATION dstLocation = { dst.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, { { 0, { DXGI_FORMAT_UNKNOWN, 0, 0, 0, 0 } } } }; + D3D12_TEXTURE_COPY_LOCATION srcLocation = { src.m_ptr, D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX, { { 0, { DXGI_FORMAT_UNKNOWN, 0, 0, 0, 0 } } } }; m_commandList->CopyTextureRegion(&dstLocation , blit.m_dstX , blit.m_dstY @@ -5012,11 +5603,17 @@ data.NumQualityLevels = 0; ); } } + + if (isValid(currentSrc) + && D3D12_RESOURCE_STATES(UINT32_MAX) != state) + { + m_textures[currentSrc.idx].setState(m_commandList, state); + } } void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter) { -// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit"); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "rendererSubmit"); if (m_lost || updateResolution(_render->m_resolution) ) @@ -5024,6 +5621,11 @@ data.NumQualityLevels = 0; return; } + if (_render->m_capture) + { + renderDocTriggerCapture(); + } + int64_t timeBegin = bx::getHPCounter(); int64_t captureElapsed = 0; @@ -5051,8 +5653,6 @@ data.NumQualityLevels = 0; RenderBind currentBind; currentBind.clear(); - _render->m_hmdInitialized = false; - const bool hmdEnabled = false; static ViewState viewState; viewState.reset(_render, hmdEnabled); @@ -5084,6 +5684,8 @@ data.NumQualityLevels = 0; Rect viewScissorRect; viewScissorRect.clear(); + const uint32_t maxComputeBindings = g_caps.limits.maxComputeBindings; + uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {}; @@ -5097,7 +5699,16 @@ data.NumQualityLevels = 0; ); #if BX_PLATFORM_WINDOWS - m_backBufferColorIdx = m_swapChain->GetCurrentBackBufferIndex(); + if (NULL != m_swapChain) + { + m_backBufferColorIdx = m_swapChain->GetCurrentBackBufferIndex(); + } + else + { + m_backBufferColorIdx = (m_backBufferColorIdx+1) % BX_COUNTOF(m_scratchBuffer); + } +#else + m_backBufferColorIdx = (m_backBufferColorIdx+1) % m_scd.bufferCount; #endif // BX_PLATFORM_WINDOWS const uint64_t f0 = BGFX_STATE_BLEND_FACTOR; @@ -5113,14 +5724,33 @@ data.NumQualityLevels = 0; StateCacheLru bindLru; - setResourceBarrier(m_commandList - , m_backBufferColor[m_backBufferColorIdx] - , D3D12_RESOURCE_STATE_PRESENT - , D3D12_RESOURCE_STATE_RENDER_TARGET - ); + if (NULL != m_msaaRt) + { + setResourceBarrier(m_commandList + , m_msaaRt + , D3D12_RESOURCE_STATE_RESOLVE_SOURCE + , D3D12_RESOURCE_STATE_RENDER_TARGET + ); + + setResourceBarrier(m_commandList + , m_backBufferColor[m_backBufferColorIdx] + , D3D12_RESOURCE_STATE_PRESENT + , D3D12_RESOURCE_STATE_RESOLVE_DEST + ); + } + else if (NULL != m_swapChain) + { + setResourceBarrier(m_commandList + , m_backBufferColor[m_backBufferColorIdx] + , D3D12_RESOURCE_STATE_PRESENT + , D3D12_RESOURCE_STATE_RENDER_TARGET + ); + } if (0 == (_render->m_debug&BGFX_DEBUG_IFH) ) { + setFrameBuffer(BGFX_INVALID_HANDLE, true); + m_batch.begin(); // uint8_t eye = 0; @@ -5149,6 +5779,8 @@ data.NumQualityLevels = 0; m_batch.flush(m_commandList, true); kick(); + commandListChanged = true; + view = key.m_view; currentPso = NULL; currentSamplerStateIdx = kInvalidHandle; @@ -5196,7 +5828,7 @@ data.NumQualityLevels = 0; clearQuad(clearRect, clr, _render->m_colorPalette); } - prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update. + prim = s_primInfo[Topology::Count]; // Force primitive type update. submitBlit(bs, view); } @@ -5207,6 +5839,21 @@ data.NumQualityLevels = 0; { wasCompute = true; + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + char* viewName = s_viewName[view]; + viewName[3] = L'C'; + PIX3_ENDEVENT(m_commandList); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_COMPUTE, viewName); + } + + commandListChanged = true; + } + + if (commandListChanged) + { + commandListChanged = false; + m_commandList->SetComputeRootSignature(m_rootSignature); ID3D12DescriptorHeap* heaps[] = { m_samplerAllocator.getHeap(), @@ -5236,32 +5883,44 @@ data.NumQualityLevels = 0; D3D12_GPU_DESCRIPTOR_HANDLE srvHandle[BGFX_MAX_COMPUTE_BINDINGS] = {}; uint32_t samplerFlags[BGFX_MAX_COMPUTE_BINDINGS] = {}; - for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) + for (uint8_t stage = 0; stage < maxComputeBindings; ++stage) { - const Binding& bind = renderBind.m_bind[ii]; + const Binding& bind = renderBind.m_bind[stage]; if (kInvalidHandle != bind.m_idx) { switch (bind.m_type) { case Binding::Image: - case Binding::Texture: { TextureD3D12& texture = m_textures[bind.m_idx]; - if (Access::Read != bind.m_un.m_compute.m_access) + if (Access::Read != bind.m_access) { texture.setState(m_commandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); - scratchBuffer.allocUav(srvHandle[ii], texture, bind.m_un.m_compute.m_mip); + scratchBuffer.allocUav(srvHandle[stage], texture, bind.m_mip); } else { texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - scratchBuffer.allocSrv(srvHandle[ii], texture, bind.m_un.m_compute.m_mip); - samplerFlags[ii] = texture.m_flags; + scratchBuffer.allocSrv(srvHandle[stage], texture, bind.m_mip); + samplerFlags[stage] = uint32_t(texture.m_flags); } } break; + case Binding::Texture: + { + TextureD3D12& texture = m_textures[bind.m_idx]; + texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); + scratchBuffer.allocSrv(srvHandle[stage], texture); + samplerFlags[stage] = (0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & bind.m_samplerFlags) + ? bind.m_samplerFlags + : texture.m_flags + ) & (BGFX_SAMPLER_BITS_MASK | BGFX_SAMPLER_BORDER_COLOR_MASK | BGFX_SAMPLER_COMPARE_MASK) + ; + } + break; + case Binding::IndexBuffer: case Binding::VertexBuffer: { @@ -5270,23 +5929,28 @@ data.NumQualityLevels = 0; : m_vertexBuffers[bind.m_idx] ; - if (Access::Read != bind.m_un.m_compute.m_access) + if (Access::Read != bind.m_access) { buffer.setState(m_commandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); - scratchBuffer.allocUav(srvHandle[ii], buffer); + scratchBuffer.allocUav(srvHandle[stage], buffer); } else { buffer.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); - scratchBuffer.allocSrv(srvHandle[ii], buffer); + scratchBuffer.allocSrv(srvHandle[stage], buffer); } } break; } } + else + { + samplerFlags[stage] = 0; + scratchBuffer.allocEmpty(srvHandle[stage]); + } } - uint16_t samplerStateIdx = getSamplerState(samplerFlags, BGFX_MAX_COMPUTE_BINDINGS, _render->m_colorPalette); + uint16_t samplerStateIdx = getSamplerState(samplerFlags, maxComputeBindings, _render->m_colorPalette); if (samplerStateIdx != currentSamplerStateIdx) { currentSamplerStateIdx = samplerStateIdx; @@ -5344,19 +6008,21 @@ data.NumQualityLevels = 0; if (isValid(compute.m_indirectBuffer) ) { - const VertexBufferD3D12& vb = m_vertexBuffers[compute.m_indirectBuffer.idx]; + const VertexBufferD3D12& indirect = m_vertexBuffers[compute.m_indirectBuffer.idx]; uint32_t numDrawIndirect = UINT16_MAX == compute.m_numIndirect - ? vb.m_size/BGFX_CONFIG_DRAW_INDIRECT_STRIDE + ? indirect.m_size/BGFX_CONFIG_DRAW_INDIRECT_STRIDE : compute.m_numIndirect ; - uint32_t args = compute.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE; - for (uint32_t ii = 0; ii < numDrawIndirect; ++ii) - { -// m_commandList->ExecuteIndirect(ptr, args); - args += BGFX_CONFIG_DRAW_INDIRECT_STRIDE; - } + m_commandList->ExecuteIndirect( + s_renderD3D12->m_commandSignature[0] + , numDrawIndirect + , indirect.m_ptr + , compute.m_startIndirect * BGFX_CONFIG_DRAW_INDIRECT_STRIDE + , NULL + , 0 + ); } else { @@ -5366,14 +6032,47 @@ data.NumQualityLevels = 0; continue; } + bool resetState = viewChanged || wasCompute; + + if (wasCompute) + { + wasCompute = false; + + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + BX_UNUSED(s_viewName); + char* viewName = s_viewName[view]; + viewName[3] = ' '; + PIX3_ENDEVENT(m_commandList); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_DRAW, viewName); + } + + commandListChanged = true; + } + const RenderDraw& draw = renderItem.draw; const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); - if (isValid(draw.m_occlusionQuery) - && !hasOcclusionQuery - && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) ) { - continue; + const bool occluded = true + && isValid(draw.m_occlusionQuery) + && !hasOcclusionQuery + && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) + ; + + if (occluded + || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) + { + if (resetState) + { + currentState.clear(); + currentState.m_scissor = !draw.m_scissor; + currentBind.clear(); + commandListChanged = true; + } + + continue; + } } const uint64_t newFlags = draw.m_stateFlags; @@ -5384,22 +6083,18 @@ data.NumQualityLevels = 0; uint64_t changedStencil = (currentState.m_stencil ^ draw.m_stencil) & BGFX_STENCIL_FUNC_REF_MASK; currentState.m_stencil = newStencil; - if (viewChanged - || wasCompute) + if (resetState) { - if (wasCompute) - { - wasCompute = false; - } + wasCompute = false; - if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) - { - BX_UNUSED(s_viewNameW); -// wchar_t* viewNameW = s_viewNameW[view]; -// viewNameW[3] = L' '; -// PIX_ENDEVENT(); -// PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW); - } + currentState.clear(); + currentState.m_scissor = !draw.m_scissor; + changedFlags = BGFX_STATE_MASK; + changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); + currentState.m_stateFlags = newFlags; + currentState.m_stencil = newStencil; + + currentBind.clear(); commandListChanged = true; } @@ -5432,10 +6127,16 @@ data.NumQualityLevels = 0; primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT); } + bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); - if (isValid(draw.m_stream[0].m_handle) ) + if (0 != draw.m_streamMask) { + currentState.m_streamMask = draw.m_streamMask; + currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; + currentState.m_instanceDataOffset = draw.m_instanceDataOffset; + currentState.m_instanceDataStride = draw.m_instanceDataStride; + const uint64_t state = draw.m_stateFlags; bool hasFactor = 0 || f0 == (state & f0) @@ -5444,13 +6145,37 @@ data.NumQualityLevels = 0; || f3 == (state & f3) ; - const VertexBufferD3D12& vb = m_vertexBuffers[draw.m_stream[0].m_handle.idx]; - uint16_t declIdx = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; + const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + + uint8_t numStreams = 0; + if (UINT8_MAX != draw.m_streamMask) + { + for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams + ) + { + streamMask >>= ntz; + idx += ntz; + + currentState.m_stream[idx].m_decl = draw.m_stream[idx].m_decl; + currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; + currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; + + uint16_t handle = draw.m_stream[idx].m_handle.idx; + const VertexBufferD3D12& vb = m_vertexBuffers[handle]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = m_vertexDecls[decl]; + + decls[numStreams] = &vertexDecl; + } + } ID3D12PipelineState* pso = getPipelineState(state , draw.m_stencil - , declIdx + , numStreams + , decls , key.m_program , uint8_t(draw.m_instanceDataStride/16) ); @@ -5476,10 +6201,10 @@ data.NumQualityLevels = 0; Bind* bindCached = bindLru.find(bindHash); if (NULL == bindCached) { + uint32_t numSet = 0; D3D12_GPU_DESCRIPTOR_HANDLE srvHandle[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; uint32_t samplerFlags[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; { - srvHandle[0].ptr = 0; for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage) { const Binding& bind = renderBind.m_bind[stage]; @@ -5492,26 +6217,28 @@ data.NumQualityLevels = 0; TextureD3D12& texture = m_textures[bind.m_idx]; texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); scratchBuffer.allocSrv(srvHandle[stage], texture); - samplerFlags[stage] = (0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & bind.m_un.m_draw.m_textureFlags) - ? bind.m_un.m_draw.m_textureFlags + samplerFlags[stage] = (0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & bind.m_samplerFlags) + ? bind.m_samplerFlags : texture.m_flags - ) & (BGFX_TEXTURE_SAMPLER_BITS_MASK | BGFX_TEXTURE_BORDER_COLOR_MASK) + ) & (BGFX_SAMPLER_BITS_MASK | BGFX_SAMPLER_BORDER_COLOR_MASK | BGFX_SAMPLER_COMPARE_MASK) ; + + ++numSet; } break; case Binding::IndexBuffer: case Binding::VertexBuffer: { + samplerFlags[stage] = 0; + BufferD3D12& buffer = Binding::IndexBuffer == bind.m_type ? m_indexBuffers[bind.m_idx] : m_vertexBuffers[bind.m_idx] ; - if (Access::Read != bind.m_un.m_compute.m_access) + if (Access::Read != bind.m_access) { - // The api functions prevent binding with Access::Write, - // but might as well allow it in here for future-proofing buffer.setState(m_commandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); scratchBuffer.allocUav(srvHandle[stage], buffer); } @@ -5520,19 +6247,21 @@ data.NumQualityLevels = 0; buffer.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); scratchBuffer.allocSrv(srvHandle[stage], buffer); } + + ++numSet; } break; } } else { - bx::memCopy(&srvHandle[stage], &srvHandle[0], sizeof(D3D12_GPU_DESCRIPTOR_HANDLE) ); + scratchBuffer.allocEmpty(srvHandle[stage]); samplerFlags[stage] = 0; } } } - if (srvHandle[0].ptr != 0) + if (0 != numSet) { uint16_t samplerStateIdx = getSamplerState(samplerFlags, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, _render->m_colorPalette); if (samplerStateIdx != currentSamplerStateIdx) @@ -5542,6 +6271,7 @@ data.NumQualityLevels = 0; } m_commandList->SetGraphicsRootDescriptorTable(Rdt::SRV, srvHandle[0]); + m_commandList->SetGraphicsRootDescriptorTable(Rdt::UAV, srvHandle[0]); Bind bind; bind.m_srvHandle = srvHandle[0]; @@ -5557,7 +6287,9 @@ data.NumQualityLevels = 0; currentSamplerStateIdx = samplerStateIdx; m_commandList->SetGraphicsRootDescriptorTable(Rdt::Sampler, m_samplerAllocator.get(samplerStateIdx) ); } + m_commandList->SetGraphicsRootDescriptorTable(Rdt::SRV, bindCached->m_srvHandle); + m_commandList->SetGraphicsRootDescriptorTable(Rdt::UAV, bindCached->m_srvHandle); } } @@ -5633,8 +6365,7 @@ data.NumQualityLevels = 0; m_commandList->SetPipelineState(pso); } - bool constantsChanged = false; - if (draw.m_uniformBegin < draw.m_uniformEnd + if (constantsChanged || currentProgramIdx != key.m_program || BGFX_STATE_ALPHA_REF_MASK & changedFlags) { @@ -5647,10 +6378,13 @@ data.NumQualityLevels = 0; commit(*vcb); } - UniformBuffer* fcb = program.m_fsh->m_constantBuffer; - if (NULL != fcb) + if (NULL != program.m_fsh) { - commit(*fcb); + UniformBuffer* fcb = program.m_fsh->m_constantBuffer; + if (NULL != fcb) + { + commit(*fcb); + } } hasPredefined = 0 < program.m_numPredefined; @@ -5688,11 +6422,22 @@ data.NumQualityLevels = 0; m_batch.end(m_commandList); kick(); + if (wasCompute) + { + if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) + { + char* viewName = s_viewName[view]; + viewName[3] = L'C'; + PIX3_ENDEVENT(m_commandList); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_DRAW, viewName); + } + } + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); if (0 < _render->m_numRenderItems) { - if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) + if (0 != (m_resolution.reset & BGFX_RESET_FLUSH_AFTER_RENDER) ) { // deviceCtx->Flush(); } @@ -5705,13 +6450,15 @@ data.NumQualityLevels = 0; } } + PIX3_ENDEVENT(m_commandList); + int64_t timeEnd = bx::getHPCounter(); int64_t frameTime = timeEnd - timeBegin; static int64_t min = frameTime; static int64_t max = frameTime; - min = bx::int64_min(min, frameTime); - max = bx::int64_max(max, frameTime); + min = bx::min(min, frameTime); + max = bx::max(max, frameTime); static uint32_t maxGpuLatency = 0; static double maxGpuElapsed = 0.0f; @@ -5719,8 +6466,8 @@ data.NumQualityLevels = 0; static int64_t presentMin = m_presentElapsed; static int64_t presentMax = m_presentElapsed; - presentMin = bx::int64_min(presentMin, m_presentElapsed); - presentMax = bx::int64_max(presentMax, m_presentElapsed); + presentMin = bx::min(presentMin, m_presentElapsed); + presentMax = bx::max(presentMax, m_presentElapsed); if (UINT32_MAX != frameQueryIdx) { @@ -5748,14 +6495,16 @@ data.NumQualityLevels = 0; perfStats.gpuTimerFreq = m_gpuTimer.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; + perfStats.numBlit = _render->m_numBlitItems; perfStats.maxGpuLatency = maxGpuLatency; + bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); perfStats.gpuMemoryMax = -INT64_MAX; perfStats.gpuMemoryUsed = -INT64_MAX; #if BX_PLATFORM_WINDOWS DXGI_QUERY_VIDEO_MEMORY_INFO vmi[2]; - DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &vmi[0]) ); - DX_CHECK(m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &vmi[1]) ); + DX_CHECK(m_dxgi.m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &vmi[0]) ); + DX_CHECK(m_dxgi.m_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL, &vmi[1]) ); perfStats.gpuMemoryMax = int64_t(vmi[0].Budget); perfStats.gpuMemoryUsed = int64_t(vmi[0].CurrentUsage); @@ -5763,7 +6512,7 @@ data.NumQualityLevels = 0; if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { -// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats"); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "debugstats"); // m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; @@ -5779,14 +6528,15 @@ data.NumQualityLevels = 0; tvm.clear(); uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f - , " %s (FL %d.%d) / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " + tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f + , " %s.%d (FL %d.%d) / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " , getRendererName() + , m_deviceInterfaceVersion , (m_featureLevel >> 12) & 0xf , (m_featureLevel >> 8) & 0xf ); - const DXGI_ADAPTER_DESC& desc = m_adapterDesc; + const DXGI_ADAPTER_DESC& desc = m_dxgi.m_adapterDesc; char description[BX_COUNTOF(desc.Description)]; wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) ); tvm.printf(0, pos++, 0x8f, " Device: %s", description); @@ -5838,74 +6588,70 @@ data.NumQualityLevels = 0; #endif // BX_PLATFORM_WINDOWS pos = 10; - tvm.printf(10, pos++, 0x8e, " Frame: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " + tvm.printf(10, pos++, 0x8b, " Frame: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " , double(frameTime)*toMs , double(min)*toMs , double(max)*toMs , freq/frameTime ); - tvm.printf(10, pos++, 0x8e, " Present: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] " + tvm.printf(10, pos++, 0x8b, " Present: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] " , double(m_presentElapsed)*toMs , double(presentMin)*toMs , double(presentMax)*toMs ); - char hmd[16]; - bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' '); - - const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy " - , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' + const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; + tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " + , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs ); - for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii) + for (uint32_t ii = 0; ii < Topology::Count; ++ii) { - tvm.printf(10, pos++, 0x8e, " %9s: %7d (#inst: %5d), submitted: %7d " - , s_primName[ii] + tvm.printf(10, pos++, 0x8b, " %9s: %7d (#inst: %5d), submitted: %7d " + , getName(Topology::Enum(ii) ) , statsNumPrimsRendered[ii] , statsNumInstances[ii] , statsNumPrimsSubmitted[ii] ); } - tvm.printf(10, pos++, 0x8e, " Batch: %7dx%d indirect, %7d immediate " + tvm.printf(10, pos++, 0x8b, " Batch: %7dx%d indirect, %7d immediate " , m_batch.m_stats.m_numIndirect[BatchD3D12::Draw] , m_batch.m_maxDrawPerBatch , m_batch.m_stats.m_numImmediate[BatchD3D12::Draw] ); - tvm.printf(10, pos++, 0x8e, " %7dx%d indirect, %7d immediate " + tvm.printf(10, pos++, 0x8b, " %7dx%d indirect, %7d immediate " , m_batch.m_stats.m_numIndirect[BatchD3D12::DrawIndexed] , m_batch.m_maxDrawPerBatch , m_batch.m_stats.m_numImmediate[BatchD3D12::DrawIndexed] ); - if (NULL != m_renderdocdll) + if (NULL != m_renderDocDll) { - tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] "); + tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] "); } - tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); + tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); +// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); + tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); + tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); pos++; - tvm.printf(10, pos++, 0x8e, " State cache: "); - tvm.printf(10, pos++, 0x8e, " PSO | Sampler | Bind | Queued "); - tvm.printf(10, pos++, 0x8e, " %6d | %6d | %6d | %6d " + tvm.printf(10, pos++, 0x8b, " State cache: "); + tvm.printf(10, pos++, 0x8b, " PSO | Sampler | Bind | Queued "); + tvm.printf(10, pos++, 0x8b, " %6d | %6d | %6d | %6d " , m_pipelineStateCache.getCount() , m_samplerStateCache.getCount() , bindLru.getCount() @@ -5914,9 +6660,9 @@ data.NumQualityLevels = 0; pos++; double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8e, " Capture: %7.4f [ms] ", captureMs); + tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms] ", captureMs); - uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attr[2] = { 0x8c, 0x8a }; uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %7.4f [ms] ", _render->m_waitSubmit*toMs); @@ -5930,22 +6676,56 @@ data.NumQualityLevels = 0; blit(this, _textVideoMemBlitter, tvm); -// PIX_ENDEVENT(); + PIX3_ENDEVENT(m_commandList); } else if (_render->m_debug & BGFX_DEBUG_TEXT) { -// PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext"); + PIX3_BEGINEVENT(m_commandList, D3DCOLOR_FRAME, "debugtext"); blit(this, _textVideoMemBlitter, _render->m_textVideoMem); -// PIX_ENDEVENT(); + PIX3_ENDEVENT(m_commandList); } - setResourceBarrier(m_commandList - , m_backBufferColor[m_backBufferColorIdx] - , D3D12_RESOURCE_STATE_RENDER_TARGET - , D3D12_RESOURCE_STATE_PRESENT - ); + m_commandList->OMSetRenderTargets(0, NULL, false, NULL); + + if (NULL != m_msaaRt) + { + setResourceBarrier(m_commandList + , m_msaaRt + , D3D12_RESOURCE_STATE_RENDER_TARGET + , D3D12_RESOURCE_STATE_RESOLVE_SOURCE + ); + + m_commandList->ResolveSubresource(m_backBufferColor[m_backBufferColorIdx], 0, m_msaaRt, 0, m_scd.format); + + setResourceBarrier(m_commandList + , m_backBufferColor[m_backBufferColorIdx] + , D3D12_RESOURCE_STATE_RESOLVE_DEST + , D3D12_RESOURCE_STATE_PRESENT + ); + } + else if (NULL != m_swapChain) + { + setResourceBarrier(m_commandList + , m_backBufferColor[m_backBufferColorIdx] + , D3D12_RESOURCE_STATE_RENDER_TARGET + , D3D12_RESOURCE_STATE_PRESENT + ); + } + +#if BX_PLATFORM_WINDOWS + for (uint32_t ii = 1, num = m_numWindows; ii < num; ++ii) + { + FrameBufferD3D12& frameBuffer = m_frameBuffers[m_windows[ii].idx]; + if (NULL != frameBuffer.m_swapChain) + { + uint8_t idx = uint8_t(frameBuffer.m_swapChain->GetCurrentBackBufferIndex() ); + frameBuffer.setState(m_commandList, idx, D3D12_RESOURCE_STATE_PRESENT); + } + } +#endif // BX_PLATFORM_WINDOWS + m_backBufferColorFence[m_backBufferColorIdx] = kick(); } @@ -5955,8 +6735,9 @@ data.NumQualityLevels = 0; namespace bgfx { namespace d3d12 { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_d3d12.h b/3rdparty/bgfx/src/renderer_d3d12.h index c658459f446..216159f37d4 100644 --- a/3rdparty/bgfx/src/renderer_d3d12.h +++ b/3rdparty/bgfx/src/renderer_d3d12.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -9,10 +9,13 @@ #define USE_D3D12_DYNAMIC_LIB BX_PLATFORM_WINDOWS #include -#if BX_PLATFORM_XBOXONE -# include +#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +# include #else -# include +# if !BGFX_CONFIG_DEBUG +# define D3DCOMPILE_NO_DEBUG 1 +# endif // !BGFX_CONFIG_DEBUG +# include #endif // BX_PLATFORM_XBOXONE #if defined(__MINGW32__) // BK - temp workaround for MinGW until I nuke d3dx12 usage. @@ -38,10 +41,6 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wmissing-field-initializers"); #endif // BX_PLATFORM_XBOXONE BX_PRAGMA_DIAGNOSTIC_POP(); -#if BX_PLATFORM_WINDOWS -# include -#endif // BX_PLATFORM_WINDOWS - #ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT # define D3D12_TEXTURE_DATA_PITCH_ALIGNMENT 1024 #endif // D3D12_TEXTURE_DATA_PITCH_ALIGNMENT @@ -50,9 +49,43 @@ BX_PRAGMA_DIAGNOSTIC_POP(); #include "renderer_d3d.h" #include "shader_dxbc.h" #include "debug_renderdoc.h" +#include "nvapi.h" +#include "dxgi.h" + +#if BGFX_CONFIG_DEBUG_PIX +# if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT +typedef struct PIXEventsThreadInfo* (WINAPI* PFN_PIX_GET_THREAD_INFO)(); +typedef uint64_t (WINAPI* PFN_PIX_EVENTS_REPLACE_BLOCK)(bool _getEarliestTime); + +extern PFN_PIX_GET_THREAD_INFO bgfx_PIXGetThreadInfo; +extern PFN_PIX_EVENTS_REPLACE_BLOCK bgfx_PIXEventsReplaceBlock; + +# define PIXGetThreadInfo bgfx_PIXGetThreadInfo +# define PIXEventsReplaceBlock bgfx_PIXEventsReplaceBlock +# else +extern "C" struct PIXEventsThreadInfo* WINAPI bgfx_PIXGetThreadInfo(); +extern "C" uint64_t WINAPI bgfx_PIXEventsReplaceBlock(bool _getEarliestTime); +# endif // BX_PLATFORM_WINDOWS + +# include + +# define _PIX3_BEGINEVENT(_commandList, _color, _name) PIXBeginEvent(_commandList, _color, _name) +# define _PIX3_SETMARKER(_commandList, _color, _name) PIXSetMarker(_commandList, _color, _name) +# define _PIX3_ENDEVENT(_commandList) PIXEndEvent(_commandList) + +# define PIX3_BEGINEVENT(_commandList, _color, _name) _PIX3_BEGINEVENT(_commandList, _color, _name) +# define PIX3_SETMARKER(_commandList, _color, _name) _PIX3_SETMARKER(_commandList, _color, _name) +# define PIX3_ENDEVENT(_commandList) _PIX3_ENDEVENT(_commandList) +#else +# define PIX3_BEGINEVENT(_commandList, _color, _name) BX_UNUSED(_commandList, _color, _name) +# define PIX3_SETMARKER(_commandList, _color, _name) BX_UNUSED(_commandList, _color, _name) +# define PIX3_ENDEVENT(_commandList) BX_UNUSED(_commandList) +#endif // BGFX_CONFIG_DEBUG_PIX namespace bgfx { namespace d3d12 { + typedef HRESULT (WINAPI* PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES)(uint32_t _numFeatures, const IID* _iids, void* _configurationStructs, uint32_t* _configurationStructSizes); + struct Rdt { enum Enum @@ -81,6 +114,8 @@ namespace bgfx { namespace d3d12 void destroy(); void reset(D3D12_GPU_DESCRIPTOR_HANDLE& _gpuHandle); + void allocEmpty(D3D12_GPU_DESCRIPTOR_HANDLE& _gpuHandle); + void* allocCbv(D3D12_GPU_VIRTUAL_ADDRESS& _gpuAddress, uint32_t _size); void allocSrv(D3D12_GPU_DESCRIPTOR_HANDLE& _gpuHandle, struct TextureD3D12& _texture, uint8_t _mip = 0); @@ -268,6 +303,7 @@ namespace bgfx { namespace d3d12 TextureD3D12() : m_ptr(NULL) + , m_directAccessPtr(NULL) , m_state(D3D12_RESOURCE_STATE_COMMON) , m_numMips(0) { @@ -275,17 +311,18 @@ namespace bgfx { namespace d3d12 bx::memSet(&m_uavd, 0, sizeof(m_uavd) ); } - void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); + void* create(const Memory* _mem, uint64_t _flags, uint8_t _skip); void destroy(); void update(ID3D12GraphicsCommandList* _commandList, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); - void resolve(); + void resolve(uint8_t _resolve) const; D3D12_RESOURCE_STATES setState(ID3D12GraphicsCommandList* _commandList, D3D12_RESOURCE_STATES _state); D3D12_SHADER_RESOURCE_VIEW_DESC m_srvd; D3D12_UNORDERED_ACCESS_VIEW_DESC m_uavd; ID3D12Resource* m_ptr; + void* m_directAccessPtr; D3D12_RESOURCE_STATES m_state; - uint32_t m_flags; + uint64_t m_flags; uint32_t m_width; uint32_t m_height; uint32_t m_depth; @@ -300,32 +337,40 @@ namespace bgfx { namespace d3d12 { FrameBufferD3D12() : m_swapChain(NULL) + , m_nwh(NULL) , m_width(0) , m_height(0) , m_denseIdx(UINT16_MAX) , m_num(0) , m_numTh(0) + , m_state(D3D12_RESOURCE_STATE_PRESENT) + , m_needPresent(false) { m_depth.idx = bgfx::kInvalidHandle; } void create(uint8_t _num, const Attachment* _attachment); - void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); + void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat); uint16_t destroy(); + HRESULT present(uint32_t _syncInterval, uint32_t _flags); void preReset(); void postReset(); void resolve(); void clear(ID3D12GraphicsCommandList* _commandList, const Clear& _clear, const float _palette[][4], const D3D12_RECT* _rect = NULL, uint32_t _num = 0); + D3D12_RESOURCE_STATES setState(ID3D12GraphicsCommandList* _commandList, uint8_t _idx, D3D12_RESOURCE_STATES _state); TextureHandle m_texture[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; TextureHandle m_depth; - IDXGISwapChain* m_swapChain; + Dxgi::SwapChainI* m_swapChain; + void* m_nwh; uint32_t m_width; uint32_t m_height; uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; Attachment m_attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + D3D12_RESOURCE_STATES m_state; + bool m_needPresent; }; struct CommandQueueD3D12 @@ -417,17 +462,17 @@ namespace bgfx { namespace d3d12 struct DrawIndirectCommand { + D3D12_VERTEX_BUFFER_VIEW vbv[BGFX_CONFIG_MAX_VERTEX_STREAMS + 1 /* instanced buffer */]; D3D12_GPU_VIRTUAL_ADDRESS cbv; - D3D12_VERTEX_BUFFER_VIEW vbv[2]; - D3D12_DRAW_ARGUMENTS draw; + D3D12_DRAW_ARGUMENTS args; }; struct DrawIndexedIndirectCommand { - D3D12_GPU_VIRTUAL_ADDRESS cbv; - D3D12_VERTEX_BUFFER_VIEW vbv[2]; + D3D12_VERTEX_BUFFER_VIEW vbv[BGFX_CONFIG_MAX_VERTEX_STREAMS + 1 /* instanced buffer */]; D3D12_INDEX_BUFFER_VIEW ibv; - D3D12_DRAW_INDEXED_ARGUMENTS drawIndexed; + D3D12_GPU_VIRTUAL_ADDRESS cbv; + D3D12_DRAW_INDEXED_ARGUMENTS args; }; struct Stats diff --git a/3rdparty/bgfx/src/renderer_d3d9.cpp b/3rdparty/bgfx/src/renderer_d3d9.cpp index 7dd76c2cc46..21dbef68ff2 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.cpp +++ b/3rdparty/bgfx/src/renderer_d3d9.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -31,16 +31,7 @@ namespace bgfx { namespace d3d9 { D3DPT_POINTLIST, 1, 1, 0 }, { D3DPRIMITIVETYPE(0), 0, 0, 0 }, }; - - static const char* s_primName[] = - { - "TriList", - "TriStrip", - "Line", - "LineStrip", - "Point", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName)+1); + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo)-1); static const D3DMULTISAMPLE_TYPE s_checkMsaa[] = { @@ -189,6 +180,15 @@ namespace bgfx { namespace d3d9 { D3DFMT_UNKNOWN }, // PTC14A { D3DFMT_UNKNOWN }, // PTC22 { D3DFMT_UNKNOWN }, // PTC24 + { D3DFMT_UNKNOWN }, // ATC, + { D3DFMT_UNKNOWN }, // ATCE, + { D3DFMT_UNKNOWN }, // ATCI, + { D3DFMT_UNKNOWN }, // ASTC4x4, + { D3DFMT_UNKNOWN }, // ASTC5x5, + { D3DFMT_UNKNOWN }, // ASTC6x6, + { D3DFMT_UNKNOWN }, // ASTC8x5, + { D3DFMT_UNKNOWN }, // ASTC8x6, + { D3DFMT_UNKNOWN }, // ASTC10x5, { D3DFMT_UNKNOWN }, // Unknown { D3DFMT_A1 }, // R1 { D3DFMT_A8 }, // A8 @@ -399,7 +399,7 @@ namespace bgfx { namespace d3d9 { } - bool init() + bool init(const Init& _init) { struct ErrorState { @@ -422,11 +422,11 @@ namespace bgfx { namespace d3d9 // http://msdn.microsoft.com/en-us/library/windows/desktop/bb172588%28v=vs.85%29.aspx bx::memSet(&m_params, 0, sizeof(m_params) ); - m_params.BackBufferWidth = BGFX_DEFAULT_WIDTH; - m_params.BackBufferHeight = BGFX_DEFAULT_HEIGHT; + m_params.BackBufferWidth = _init.resolution.width; + m_params.BackBufferHeight = _init.resolution.height; m_params.BackBufferFormat = adapterFormat; - m_params.BackBufferCount = 1; - m_params.MultiSampleType = D3DMULTISAMPLE_NONE; + m_params.BackBufferCount = bx::clamp(_init.resolution.numBackBuffers, 2, BGFX_CONFIG_MAX_BACK_BUFFERS); + m_params.MultiSampleType = D3DMULTISAMPLE_NONE; m_params.MultiSampleQuality = 0; m_params.EnableAutoDepthStencil = TRUE; m_params.AutoDepthStencilFormat = D3DFMT_D24S8; @@ -443,9 +443,9 @@ namespace bgfx { namespace d3d9 m_params.BackBufferWidth = rect.right-rect.left; m_params.BackBufferHeight = rect.bottom-rect.top; - m_d3d9dll = bx::dlopen("d3d9.dll"); + m_d3d9Dll = bx::dlopen("d3d9.dll"); - if (NULL == m_d3d9dll) + if (NULL == m_d3d9Dll) { BX_TRACE("Init error: Failed to load d3d9.dll."); goto error; @@ -457,9 +457,9 @@ namespace bgfx { namespace d3d9 if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) ) { - D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker"); - D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9dll, "D3DPERF_BeginEvent"); - D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9dll, "D3DPERF_EndEvent"); + D3DPERF_SetMarker = (PFN_D3DPERF_SET_MARKER )bx::dlsym(m_d3d9Dll, "D3DPERF_SetMarker"); + D3DPERF_BeginEvent = (PFN_D3DPERF_BEGIN_EVENT)bx::dlsym(m_d3d9Dll, "D3DPERF_BeginEvent"); + D3DPERF_EndEvent = (PFN_D3DPERF_END_EVENT )bx::dlsym(m_d3d9Dll, "D3DPERF_EndEvent"); BX_CHECK(NULL != D3DPERF_SetMarker && NULL != D3DPERF_BeginEvent @@ -471,7 +471,7 @@ namespace bgfx { namespace d3d9 m_d3d9ex = NULL; m_deviceEx = NULL; - Direct3DCreate9Ex = (Direct3DCreate9ExFn)bx::dlsym(m_d3d9dll, "Direct3DCreate9Ex"); + Direct3DCreate9Ex = (Direct3DCreate9ExFn)bx::dlsym(m_d3d9Dll, "Direct3DCreate9Ex"); if (BX_ENABLED(BGFX_CONFIG_RENDERER_DIRECT3D9EX) && NULL != Direct3DCreate9Ex) { @@ -493,7 +493,7 @@ namespace bgfx { namespace d3d9 if (NULL == m_d3d9) { - Direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9dll, "Direct3DCreate9"); + Direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9Dll, "Direct3DCreate9"); if (NULL == Direct3DCreate9) { @@ -551,7 +551,7 @@ namespace bgfx { namespace d3d9 } if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) - && 0 != bx::strFind(desc.Description, "PerfHUD") ) + && !bx::strFind(desc.Description, "PerfHUD").isEmpty() ) { m_adapter = ii; m_deviceType = D3DDEVTYPE_REF; @@ -869,6 +869,7 @@ namespace bgfx { namespace d3d9 { DX_RELEASE(m_device, 0); } + BX_FALLTHROUGH; case ErrorState::CreatedD3D9: if (NULL != m_d3d9ex) @@ -880,10 +881,12 @@ namespace bgfx { namespace d3d9 { DX_RELEASE(m_d3d9, 0); } + BX_FALLTHROUGH; case ErrorState::LoadedD3D9: m_nvapi.shutdown(); - bx::dlclose(m_d3d9dll); + bx::dlclose(m_d3d9Dll); + BX_FALLTHROUGH; case ErrorState::Default: break; @@ -930,7 +933,7 @@ namespace bgfx { namespace d3d9 } m_nvapi.shutdown(); - bx::dlclose(m_d3d9dll); + bx::dlclose(m_d3d9Dll); m_initialized = false; } @@ -950,7 +953,7 @@ namespace bgfx { namespace d3d9 return BGFX_RENDERER_DIRECT3D9_NAME; } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override + void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } @@ -971,7 +974,7 @@ namespace bgfx { namespace d3d9 { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t /*_flags*/) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t /*_flags*/) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle); } @@ -986,7 +989,7 @@ namespace bgfx { namespace d3d9 m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -1002,7 +1005,7 @@ namespace bgfx { namespace d3d9 m_vertexBuffers[_handle.idx].create(_size, NULL, decl); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -1012,7 +1015,7 @@ namespace bgfx { namespace d3d9 m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) override + void createShader(ShaderHandle _handle, const Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } @@ -1024,7 +1027,7 @@ namespace bgfx { namespace d3d9 void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) override { - m_program[_handle.idx].create(m_shaders[_vsh.idx], m_shaders[_fsh.idx]); + m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL); } void destroyProgram(ProgramHandle _handle) override @@ -1032,9 +1035,10 @@ namespace bgfx { namespace d3d9 m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override + void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); + return NULL; } void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) override @@ -1087,7 +1091,7 @@ namespace bgfx { namespace d3d9 DX_CHECK(texture.m_texture2d->UnlockRect(_mip) ); } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override { TextureD3D9& texture = m_textures[_handle.idx]; @@ -1102,7 +1106,7 @@ namespace bgfx { namespace d3d9 tc.m_width = _width; tc.m_height = _height; tc.m_depth = 0; - tc.m_numLayers = 1; + tc.m_numLayers = _numLayers; tc.m_numMips = _numMips; tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; @@ -1141,11 +1145,11 @@ namespace bgfx { namespace d3d9 m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; - m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); + m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat); } void destroyFrameBuffer(FrameBufferHandle _handle) override @@ -1157,8 +1161,12 @@ namespace bgfx { namespace d3d9 if (m_numWindows > 1) { FrameBufferHandle handle = m_windows[m_numWindows]; - m_windows[denseIdx] = handle; - m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + m_windows[m_numWindows] = {kInvalidHandle}; + if (m_numWindows != denseIdx) + { + m_windows[denseIdx] = handle; + m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + } } } } @@ -1174,7 +1182,7 @@ namespace bgfx { namespace d3d9 void* data = BX_ALLOC(g_allocator, size); bx::memSet(data, 0, size); m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name, data); + m_uniformReg.add(_handle, _name); } void destroyUniform(UniformHandle _handle) override @@ -1343,7 +1351,7 @@ namespace bgfx { namespace d3d9 uint8_t flags = predefined.m_type; setShaderUniform(flags, predefined.m_loc, proj, 4); - m_textures[_blitter.m_texture.idx].commit(0, BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER, NULL); + m_textures[_blitter.m_texture.idx].commit(0, BGFX_SAMPLER_INTERNAL_DEFAULT, NULL); } void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override @@ -1394,27 +1402,26 @@ namespace bgfx { namespace d3d9 void updateResolution(const Resolution& _resolution) { - m_maxAnisotropy = !!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) + m_maxAnisotropy = !!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) ? m_caps.MaxAnisotropy : 1 ; const uint32_t maskFlags = ~(0 - | BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP | BGFX_RESET_SUSPEND ); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height + || (m_resolution.reset&maskFlags) != (_resolution.reset&maskFlags) ) { - uint32_t flags = _resolution.m_flags & (~BGFX_RESET_INTERNAL_FORCE); + uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); m_resolution = _resolution; - m_resolution.m_flags = flags; + m_resolution.reset = flags; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.resize(false, _resolution.width, _resolution.height); m_textVideoMem.clear(); D3DDEVICE_CREATION_PARAMETERS dcp; @@ -1425,14 +1432,14 @@ namespace bgfx { namespace d3d9 m_params.BackBufferFormat = dm.Format; - m_params.BackBufferWidth = _resolution.m_width; - m_params.BackBufferHeight = _resolution.m_height; - m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_resolution.m_flags&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0; - m_params.PresentationInterval = !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; + m_params.BackBufferWidth = _resolution.width; + m_params.BackBufferHeight = _resolution.height; + m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_resolution.reset&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0; + m_params.PresentationInterval = !!(m_resolution.reset&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE; updateMsaa(); - Msaa& msaa = s_msaa[(m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; + Msaa& msaa = s_msaa[(m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; m_params.MultiSampleType = msaa.m_type; m_params.MultiSampleQuality = msaa.m_quality; @@ -1461,7 +1468,7 @@ namespace bgfx { namespace d3d9 } DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) ); - DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) ) ); + DX_CHECK(m_device->SetRenderState(D3DRS_SRGBWRITEENABLE, 0 != (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) ) ); } else { @@ -1519,7 +1526,7 @@ namespace bgfx { namespace d3d9 return false; } - void flip(HMD& /*_hmd*/) override + void flip() override { if (NULL != m_swapChain) { @@ -1693,18 +1700,18 @@ namespace bgfx { namespace d3d9 void setSamplerState(uint8_t _stage, uint32_t _flags, const float _rgba[4]) { - const uint32_t flags = _flags&( (~BGFX_TEXTURE_RESERVED_MASK) | BGFX_TEXTURE_SAMPLER_BITS_MASK | BGFX_TEXTURE_SRGB); + const uint32_t flags = _flags&( (~BGFX_SAMPLER_RESERVED_MASK) | BGFX_SAMPLER_BITS_MASK | BGFX_TEXTURE_SRGB); BX_CHECK(_stage < BX_COUNTOF(m_samplerFlags), ""); if (m_samplerFlags[_stage] != flags) { m_samplerFlags[_stage] = flags; IDirect3DDevice9* device = m_device; - D3DTEXTUREADDRESS tau = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; - D3DTEXTUREADDRESS tav = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; - D3DTEXTUREADDRESS taw = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; - D3DTEXTUREFILTERTYPE minFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT]; - D3DTEXTUREFILTERTYPE magFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT]; - D3DTEXTUREFILTERTYPE mipFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT]; + D3DTEXTUREADDRESS tau = s_textureAddress[(_flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT]; + D3DTEXTUREADDRESS tav = s_textureAddress[(_flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT]; + D3DTEXTUREADDRESS taw = s_textureAddress[(_flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT]; + D3DTEXTUREFILTERTYPE minFilter = s_textureFilter[(_flags&BGFX_SAMPLER_MIN_MASK)>>BGFX_SAMPLER_MIN_SHIFT]; + D3DTEXTUREFILTERTYPE magFilter = s_textureFilter[(_flags&BGFX_SAMPLER_MAG_MASK)>>BGFX_SAMPLER_MAG_SHIFT]; + D3DTEXTUREFILTERTYPE mipFilter = s_textureFilter[(_flags&BGFX_SAMPLER_MIP_MASK)>>BGFX_SAMPLER_MIP_SHIFT]; setSamplerState(device, _stage, D3DSAMP_ADDRESSU, tau); setSamplerState(device, _stage, D3DSAMP_ADDRESSV, tav); @@ -1748,7 +1755,7 @@ namespace bgfx { namespace d3d9 void capturePostReset() { - if (m_resolution.m_flags&BGFX_RESET_CAPTURE) + if (m_resolution.reset&BGFX_RESET_CAPTURE) { uint32_t width = m_params.BackBufferWidth; uint32_t height = m_params.BackBufferHeight; @@ -2199,7 +2206,7 @@ namespace bgfx { namespace d3d9 IDirect3DVertexDeclaration9* m_instanceDataDecls[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; - void* m_d3d9dll; + void* m_d3d9Dll; NvApi m_nvapi; uint32_t m_adapter; D3DDEVTYPE m_deviceType; @@ -2246,10 +2253,10 @@ namespace bgfx { namespace d3d9 static RendererContextD3D9* s_renderD3D9; - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9); - if (!s_renderD3D9->init() ) + if (!s_renderD3D9->init(_init) ) { BX_DELETE(g_allocator, s_renderD3D9); s_renderD3D9 = NULL; @@ -2387,21 +2394,21 @@ namespace bgfx { namespace d3d9 uint32_t magic; bx::read(&reader, magic); - switch (magic) + const bool fragment = isShaderType(magic, 'F'); + + uint32_t hashIn; + bx::read(&reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) { - case BGFX_CHUNK_MAGIC_FSH: - case BGFX_CHUNK_MAGIC_VSH: - break; - - default: - BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic); - break; + hashOut = hashIn; + } + else + { + bx::read(&reader, hashOut); } - - bool fragment = BGFX_CHUNK_MAGIC_FSH == magic; - - uint32_t iohash; - bx::read(&reader, iohash); uint16_t count; bx::read(&reader, count); @@ -2891,7 +2898,7 @@ namespace bgfx { namespace d3d9 return surface; } - void TextureD3D9::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) + void TextureD3D9::create(const Memory* _mem, uint64_t _flags, uint8_t _skip) { bimg::ImageContainer imageContainer; @@ -2983,13 +2990,15 @@ namespace bgfx { namespace d3d9 uint32_t srcpitch = mipWidth*bpp/8; uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mipHeight); - bimg::imageDecodeToBgra8(temp - , mip.m_data - , mip.m_width - , mip.m_height - , srcpitch - , mip.m_format - ); + bimg::imageDecodeToBgra8( + g_allocator + , temp + , mip.m_data + , mip.m_width + , mip.m_height + , srcpitch + , mip.m_format + ); bx::memCopy(bits, temp, pitch, height, srcpitch, pitch); @@ -2997,7 +3006,7 @@ namespace bgfx { namespace d3d9 } else { - bimg::imageDecodeToBgra8(bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format); + bimg::imageDecodeToBgra8(g_allocator, bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format); } } else @@ -3056,7 +3065,7 @@ namespace bgfx { namespace d3d9 if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - bimg::imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); + bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; } @@ -3102,11 +3111,11 @@ namespace bgfx { namespace d3d9 void TextureD3D9::commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]) { - uint32_t flags = 0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) + const uint32_t flags = 0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? _flags - : m_flags + : uint32_t(m_flags) ; - uint32_t index = (flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT; + uint32_t index = (flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; s_renderD3D9->setSamplerState(_stage, flags, _palette[index]); IDirect3DDevice9* device = s_renderD3D9->m_device; @@ -3117,7 +3126,7 @@ namespace bgfx { namespace d3d9 } } - void TextureD3D9::resolve() const + void TextureD3D9::resolve(uint8_t _resolve) const { if (NULL != m_surface && NULL != m_ptr) @@ -3131,7 +3140,8 @@ namespace bgfx { namespace d3d9 ) ); DX_RELEASE(surface, 1); - if (1 < m_numMips) + if (1 < m_numMips + && 0 != (_resolve & BGFX_RESOLVE_AUTO_GEN_MIPS) ) { m_ptr->GenerateMipSubLevels(); } @@ -3187,10 +3197,11 @@ namespace bgfx { namespace d3d9 for (uint32_t ii = 0; ii < _num; ++ii) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - const TextureD3D9& texture = s_renderD3D9->m_textures[handle.idx]; + const TextureD3D9& texture = s_renderD3D9->m_textures[at.handle.idx]; if (NULL != texture.m_surface) { @@ -3199,7 +3210,7 @@ namespace bgfx { namespace d3d9 } else { - m_surface[ii] = texture.getSurface(uint8_t(m_attachment[ii].layer), uint8_t(m_attachment[ii].mip) ); + m_surface[ii] = texture.getSurface(uint8_t(at.layer), uint8_t(at.mip) ); } if (0 == m_num) @@ -3230,7 +3241,7 @@ namespace bgfx { namespace d3d9 } } - void FrameBufferD3D9::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) + void FrameBufferD3D9::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) { BX_UNUSED(_depthFormat); @@ -3241,6 +3252,7 @@ namespace bgfx { namespace d3d9 D3DPRESENT_PARAMETERS params; bx::memCopy(¶ms, &s_renderD3D9->m_params, sizeof(D3DPRESENT_PARAMETERS) ); + params.BackBufferFormat = TextureFormat::Count == _format ? params.BackBufferFormat : s_textureFormat[_format].m_fmt; params.BackBufferWidth = m_width; params.BackBufferHeight = m_height; @@ -3318,8 +3330,13 @@ namespace bgfx { namespace d3d9 { for (uint32_t ii = 0, num = m_numTh; ii < num; ++ii) { - const TextureD3D9& texture = s_renderD3D9->m_textures[m_attachment[ii].handle.idx]; - texture.resolve(); + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) + { + const TextureD3D9& texture = s_renderD3D9->m_textures[at.handle.idx]; + texture.resolve(at.resolve); + } } } } @@ -3370,19 +3387,24 @@ namespace bgfx { namespace d3d9 { for (uint32_t ii = 0, num = m_numTh; ii < num; ++ii) { - TextureHandle th = m_attachment[ii].handle; + const Attachment& at = m_attachment[ii]; - if (isValid(th) ) + if (isValid(at.handle) ) { - TextureD3D9& texture = s_renderD3D9->m_textures[th.idx]; + TextureD3D9& texture = s_renderD3D9->m_textures[at.handle.idx]; + if (NULL != texture.m_surface) { m_surface[ii] = texture.m_surface; m_surface[ii]->AddRef(); } + else if (Access::Write == at.access) + { + m_surface[ii] = texture.getSurface(uint8_t(at.layer), uint8_t(at.mip) ); + } else { - m_surface[ii] = texture.getSurface(uint8_t(m_attachment[ii].layer), uint8_t(m_attachment[ii].mip) ); + BX_CHECK(false, ""); } } } @@ -3784,11 +3806,18 @@ namespace bgfx { namespace d3d9 const RenderBind& renderBind = _render->m_renderItemBind[itemIdx]; const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); - if (isValid(draw.m_occlusionQuery) - && !hasOcclusionQuery - && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) ) { - continue; + const bool occluded = true + && isValid(draw.m_occlusionQuery) + && !hasOcclusionQuery + && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) + ; + + if (occluded + || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) + { + continue; + } } const uint64_t newFlags = draw.m_stateFlags; @@ -3879,10 +3908,6 @@ namespace bgfx { namespace d3d9 { Rect scissorRect; scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); - if (scissorRect.isZeroArea() ) - { - continue; - } DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, true) ); RECT rc; @@ -3951,10 +3976,10 @@ namespace bgfx { namespace d3d9 if ( (0 | BGFX_STATE_CULL_MASK - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_MASK - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_MASK | BGFX_STATE_BLEND_EQUATION_MASK | BGFX_STATE_ALPHA_REF_MASK @@ -3969,9 +3994,9 @@ namespace bgfx { namespace d3d9 DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, s_cullMode[cull]) ); } - if (BGFX_STATE_DEPTH_WRITE & changedFlags) + if (BGFX_STATE_WRITE_Z & changedFlags) { - DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, !!(BGFX_STATE_DEPTH_WRITE & newFlags) ) ); + DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, !!(BGFX_STATE_WRITE_Z & newFlags) ) ); } if (BGFX_STATE_DEPTH_TEST_MASK & changedFlags) @@ -4006,10 +4031,13 @@ namespace bgfx { namespace d3d9 DX_CHECK(m_device->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, !!(newFlags&BGFX_STATE_LINEAA) ) ); } - if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags) + if ( (BGFX_STATE_WRITE_A|BGFX_STATE_WRITE_RGB) & changedFlags) { - uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0; - writeEnable |= (newFlags&BGFX_STATE_RGB_WRITE) ? D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE : 0; + uint32_t writeEnable = 0; + writeEnable |= (newFlags&BGFX_STATE_WRITE_R) ? D3DCOLORWRITEENABLE_RED : 0; + writeEnable |= (newFlags&BGFX_STATE_WRITE_G) ? D3DCOLORWRITEENABLE_GREEN : 0; + writeEnable |= (newFlags&BGFX_STATE_WRITE_B) ? D3DCOLORWRITEENABLE_BLUE : 0; + writeEnable |= (newFlags&BGFX_STATE_WRITE_A) ? D3DCOLORWRITEENABLE_ALPHA : 0; DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, writeEnable) ); } @@ -4064,11 +4092,12 @@ namespace bgfx { namespace d3d9 && blendFactor != draw.m_rgba) { const uint32_t rgba = draw.m_rgba; - D3DCOLOR color = D3DCOLOR_RGBA(rgba>>24 - , (rgba>>16)&0xff - , (rgba>> 8)&0xff - , (rgba )&0xff - ); + D3DCOLOR color = D3DCOLOR_RGBA( + rgba>>24 + , (rgba>>16)&0xff + , (rgba>> 8)&0xff + , (rgba )&0xff + ); DX_CHECK(device->SetRenderState(D3DRS_BLENDFACTOR, color) ); } } @@ -4098,7 +4127,10 @@ namespace bgfx { namespace d3d9 { ProgramD3D9& program = m_program[programIdx]; device->SetVertexShader(program.m_vsh->m_vertexShader); - device->SetPixelShader(program.m_fsh->m_pixelShader); + device->SetPixelShader(NULL == program.m_fsh + ? NULL + : program.m_fsh->m_pixelShader + ); } programChanged = @@ -4117,10 +4149,13 @@ namespace bgfx { namespace d3d9 commit(*vcb); } - UniformBuffer* fcb = program.m_fsh->m_constantBuffer; - if (NULL != fcb) + if (NULL != program.m_fsh) { - commit(*fcb); + UniformBuffer* fcb = program.m_fsh->m_constantBuffer; + if (NULL != fcb) + { + commit(*fcb); + } } } @@ -4133,13 +4168,13 @@ namespace bgfx { namespace d3d9 const Binding& bind = renderBind.m_bind[stage]; Binding& current = currentBind.m_bind[stage]; - if (current.m_idx != bind.m_idx - || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags + if (current.m_idx != bind.m_idx + || current.m_samplerFlags != bind.m_samplerFlags || programChanged) { if (kInvalidHandle != bind.m_idx) { - m_textures[bind.m_idx].commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + m_textures[bind.m_idx].commit(stage, bind.m_samplerFlags, _render->m_colorPalette); } else { @@ -4321,7 +4356,7 @@ namespace bgfx { namespace d3d9 if (0 < _render->m_numRenderItems) { - if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) + if (0 != (m_resolution.reset & BGFX_RESET_FLUSH_AFTER_RENDER) ) { flush(); } @@ -4372,7 +4407,9 @@ namespace bgfx { namespace d3d9 perfStats.gpuTimerFreq = result.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; + perfStats.numBlit = _render->m_numBlitItems; perfStats.maxGpuLatency = maxGpuLatency; + bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); m_nvapi.getMemoryInfo(perfStats.gpuMemoryUsed, perfStats.gpuMemoryMax); if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) @@ -4393,7 +4430,8 @@ namespace bgfx { namespace d3d9 tvm.clear(); uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f, " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " + tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f + , " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " , getRendererName() ); @@ -4405,23 +4443,23 @@ namespace bgfx { namespace d3d9 tvm.printf(0, pos++, 0x8f, " Memory: %s (process) ", processMemoryUsed); pos = 10; - tvm.printf(10, pos++, 0x8e, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " + tvm.printf(10, pos++, 0x8b, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " , double(frameTime)*toMs , double(min)*toMs , double(max)*toMs , freq/frameTime ); - const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " - , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' + const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; + tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " + , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<m_numRenderItems , statsKeyType[0] , statsKeyType[1] @@ -4433,36 +4471,36 @@ namespace bgfx { namespace d3d9 maxGpuLatency = 0; maxGpuElapsed = 0.0; - for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii) + for (uint32_t ii = 0; ii < Topology::Count; ++ii) { - tvm.printf(10, pos++, 0x8e, " %10s: %7d (#inst: %5d), submitted: %7d" - , s_primName[ii] + tvm.printf(10, pos++, 0x8b, " %10s: %7d (#inst: %5d), submitted: %7d" + , getName(Topology::Enum(ii) ) , statsNumPrimsRendered[ii] , statsNumInstances[ii] , statsNumPrimsSubmitted[ii] ); } - tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); + tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); +// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); + tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); + tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); pos++; - tvm.printf(10, pos++, 0x8e, " Occlusion queries: %3d ", m_occlusionQuery.m_control.available() ); + tvm.printf(10, pos++, 0x8b, " Occlusion queries: %3d ", m_occlusionQuery.m_control.available() ); pos++; - tvm.printf(10, pos++, 0x8e, " State cache: "); - tvm.printf(10, pos++, 0x8e, " Input "); - tvm.printf(10, pos++, 0x8e, " %6d " + tvm.printf(10, pos++, 0x8b, " State cache: "); + tvm.printf(10, pos++, 0x8b, " Input "); + tvm.printf(10, pos++, 0x8b, " %6d " , m_inputLayoutCache.getCount() ); pos++; double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8e, " Capture: %7.4f [ms]", captureMs); + tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms]", captureMs); - uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attr[2] = { 0x8c, 0x8a }; uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %7.4f [ms]", _render->m_waitSubmit*toMs); @@ -4493,8 +4531,9 @@ namespace bgfx { namespace d3d9 namespace bgfx { namespace d3d9 { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_d3d9.h b/3rdparty/bgfx/src/renderer_d3d9.h index 46945e8014f..06cd320b96f 100644 --- a/3rdparty/bgfx/src/renderer_d3d9.h +++ b/3rdparty/bgfx/src/renderer_d3d9.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -240,7 +240,7 @@ namespace bgfx { namespace d3d9 switch (m_type) { - case 0: DX_RELEASE(m_vertexShader, 0); + case 0: DX_RELEASE(m_vertexShader, 0); BX_FALLTHROUGH; default: DX_RELEASE(m_pixelShader, 0); } } @@ -259,17 +259,19 @@ namespace bgfx { namespace d3d9 struct ProgramD3D9 { - void create(const ShaderD3D9& _vsh, const ShaderD3D9& _fsh) + void create(const ShaderD3D9* _vsh, const ShaderD3D9* _fsh) { - BX_CHECK(NULL != _vsh.m_vertexShader, "Vertex shader doesn't exist."); - m_vsh = &_vsh; + m_vsh = _vsh; + m_fsh = _fsh; - BX_CHECK(NULL != _fsh.m_pixelShader, "Fragment shader doesn't exist."); - m_fsh = &_fsh; + bx::memCopy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform) ); + m_numPredefined = _vsh->m_numPredefined; - bx::memCopy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) ); - bx::memCopy(&m_predefined[_vsh.m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) ); - m_numPredefined = _vsh.m_numPredefined + _fsh.m_numPredefined; + if (NULL != _fsh) + { + bx::memCopy(&m_predefined[_vsh->m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform) ); + m_numPredefined += _fsh->m_numPredefined; + } } void destroy() @@ -312,11 +314,11 @@ namespace bgfx { namespace d3d9 void dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth); IDirect3DSurface9* getSurface(uint8_t _side = 0, uint8_t _mip = 0) const; - void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); + void create(const Memory* _mem, uint64_t _flags, uint8_t _skip); void destroy(bool _resize = false) { - if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) ) + if (0 == (m_flags & BGFX_SAMPLER_INTERNAL_SHARED) ) { if (_resize) { @@ -338,7 +340,7 @@ namespace bgfx { namespace d3d9 void overrideInternal(uintptr_t _ptr) { destroy(); - m_flags |= BGFX_TEXTURE_INTERNAL_SHARED; + m_flags |= BGFX_SAMPLER_INTERNAL_SHARED; m_ptr = (IDirect3DBaseTexture9*)_ptr; } @@ -346,7 +348,7 @@ namespace bgfx { namespace d3d9 void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void updateEnd(); void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]); - void resolve() const; + void resolve(uint8_t _resolve) const; void preReset(); void postReset(); @@ -369,7 +371,7 @@ namespace bgfx { namespace d3d9 IDirect3DCubeTexture9* m_stagingCube; }; - uint32_t m_flags; + uint64_t m_flags; uint32_t m_width; uint32_t m_height; uint32_t m_depth; @@ -393,7 +395,7 @@ namespace bgfx { namespace d3d9 } void create(uint8_t _num, const Attachment* _attachment); - void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); + void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat); uint16_t destroy(); HRESULT present(); void resolve() const; diff --git a/3rdparty/bgfx/src/renderer_gl.cpp b/3rdparty/bgfx/src/renderer_gl.cpp index 9d7e0d3d701..7f0afda9a04 100644 --- a/3rdparty/bgfx/src/renderer_gl.cpp +++ b/3rdparty/bgfx/src/renderer_gl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -9,7 +9,6 @@ # include "renderer_gl.h" # include # include -# include "hmd_ovr.h" namespace bgfx { namespace gl { @@ -30,16 +29,9 @@ namespace bgfx { namespace gl { GL_LINES, 2, 2, 0 }, { GL_LINE_STRIP, 2, 1, 1 }, { GL_POINTS, 1, 1, 0 }, + { GL_ZERO, 0, 0, 0 }, }; - - static const char* s_primName[] = - { - "TriList", - "TriStrip", - "Line", - "LineStrip", - "Point", - }; + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo)-1); static const char* s_attribName[] = { @@ -208,6 +200,15 @@ namespace bgfx { namespace gl { GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_ZERO, false }, // PTC14A { GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG, GL_ZERO, GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG, GL_ZERO, false }, // PTC22 { GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG, GL_ZERO, GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG, GL_ZERO, false }, // PTC24 + { GL_ATC_RGB_AMD, GL_ZERO, GL_ATC_RGB_AMD, GL_ZERO, false }, // ATC + { GL_ATC_RGBA_EXPLICIT_ALPHA_AMD, GL_ZERO, GL_ATC_RGBA_EXPLICIT_ALPHA_AMD, GL_ZERO, false }, // ATCE + { GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD, GL_ZERO, GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD, GL_ZERO, false }, // ATCI + { GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_ZERO, false }, // ASTC4x4 + { GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_ZERO, false }, // ASTC5x5 + { GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_ZERO, false }, // ASTC6x6 + { GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ASTC_8x5_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_ZERO, false }, // ASTC8x5 + { GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_ZERO, false }, // ASTC8x6 + { GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_ZERO, false }, // ASTC10x5 { GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO, false }, // Unknown { GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO, false }, // R1 { GL_ALPHA, GL_ZERO, GL_ALPHA, GL_UNSIGNED_BYTE, false }, // A8 @@ -291,6 +292,15 @@ namespace bgfx { namespace gl GL_ZERO, // PTC14A GL_ZERO, // PTC22 GL_ZERO, // PTC24 + GL_ZERO, // ATC + GL_ZERO, // ATCE + GL_ZERO, // ATCI + GL_ZERO, // ASTC4x4 + GL_ZERO, // ASTC5x5 + GL_ZERO, // ASTC6x6 + GL_ZERO, // ASTC8x5 + GL_ZERO, // ASTC8x6 + GL_ZERO, // ASTC10x5 GL_ZERO, // Unknown GL_ZERO, // R1 GL_ALPHA, // A8 @@ -372,6 +382,15 @@ namespace bgfx { namespace gl GL_ZERO, // PTC14A GL_ZERO, // PTC22 GL_ZERO, // PTC24 + GL_ZERO, // ATC + GL_ZERO, // ATCE + GL_ZERO, // ATCI + GL_ZERO, // ASTC4x4 + GL_ZERO, // ASTC5x5 + GL_ZERO, // ASTC6x6 + GL_ZERO, // ASTC8x5 + GL_ZERO, // ASTC8x6 + GL_ZERO, // ASTC10x5 GL_ZERO, // Unknown GL_ZERO, // R1 GL_ALPHA, // A8 @@ -560,9 +579,6 @@ namespace bgfx { namespace gl GOOGLE_depth_texture, - GREMEDY_string_marker, - GREMEDY_frame_terminator, - IMG_multisampled_render_to_texture, IMG_read_format, IMG_shader_binary, @@ -773,9 +789,6 @@ namespace bgfx { namespace gl { "GOOGLE_depth_texture", false, true }, - { "GREMEDY_string_marker", false, true }, - { "GREMEDY_frame_terminator", false, true }, - { "IMG_multisampled_render_to_texture", false, true }, { "IMG_read_format", false, true }, { "IMG_shader_binary", false, true }, @@ -895,6 +908,15 @@ namespace bgfx { namespace gl NULL }; + static const char* s_uint[] = + { + "uint", + "uvec2", + "uvec3", + "uvec4", + NULL + }; + static const char* s_texelFetch[] = { "texture", @@ -935,6 +957,7 @@ namespace bgfx { namespace gl { "gl_VertexID", "gl_InstanceID", + "uint", NULL }; @@ -955,6 +978,15 @@ namespace bgfx { namespace gl NULL }; + static const char* s_intepolationQualifier[] = + { + "flat", + "smooth", + "noperspective", + "centroid", + NULL + }; + static void GL_APIENTRY stubVertexAttribDivisor(GLuint /*_index*/, GLuint /*_divisor*/) { } @@ -969,28 +1001,10 @@ namespace bgfx { namespace gl GL_CHECK(glDrawElements(_mode, _count, _type, _indices) ); } - static void GL_APIENTRY stubFrameTerminatorGREMEDY() - { - } - static void GL_APIENTRY stubInsertEventMarker(GLsizei /*_length*/, const char* /*_marker*/) { } - static void GL_APIENTRY stubInsertEventMarkerGREMEDY(GLsizei _length, const char* _marker) - { - // If is a null-terminated string then should not - // include the terminator. - // - // If is 0 then is assumed to be null-terminated. - - uint32_t size = (0 == _length ? (uint32_t)bx::strLen(_marker) : _length) + 1; - size *= sizeof(wchar_t); - wchar_t* name = (wchar_t*)alloca(size); - mbstowcs(name, _marker, size-2); - GL_CHECK(glStringMarkerGREMEDY(_length, _marker) ); - } - static void GL_APIENTRY stubObjectLabel(GLenum /*_identifier*/, GLuint /*_name*/, GLsizei /*_length*/, const char* /*_label*/) { } @@ -1059,10 +1073,10 @@ namespace bgfx { namespace gl while (pos < end) { uint32_t len; - const char* space = bx::strFind(pos, ' '); - if (NULL != space) + bx::StringView space = bx::strFind(pos, ' '); + if (!space.isEmpty() ) { - len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) ); + len = bx::uint32_min(sizeof(name), (uint32_t)(space.getPtr() - pos) ); } else { @@ -1444,7 +1458,13 @@ namespace bgfx { namespace gl return err; } - static bool isTextureFormatValid(TextureFormat::Enum _format, bool _srgb = false, bool _mipAutogen = false, bool _array = false, GLsizei _dim = 16) + static bool isTextureFormatValid( + TextureFormat::Enum _format + , bool _srgb = false + , bool _mipAutogen = false + , bool _array = false + , GLsizei _dim = 16 + ) { const TextureFormatInfo& tfi = s_textureFormat[_format]; GLenum internalFmt = _srgb @@ -1456,6 +1476,8 @@ namespace bgfx { namespace gl return false; } +BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) ); + const GLenum target = _array ? GL_TEXTURE_2D_ARRAY : GL_TEXTURE_2D @@ -1469,7 +1491,7 @@ namespace bgfx { namespace gl if (_array) { glTexStorage3D(target - , 1 + GLsizei(bx::flog2(float(_dim) ) ) + , 1 + GLsizei(bx::log2(float(_dim) ) ) , internalFmt , _dim , _dim @@ -1549,8 +1571,7 @@ namespace bgfx { namespace gl ? tfi.m_internalFmtSrgb : tfi.m_internalFmt ; - if (GL_ZERO == internalFmt - || !tfi.m_supported) + if (GL_ZERO == internalFmt) { return false; } @@ -1628,9 +1649,9 @@ namespace bgfx { namespace gl static void getFilters(uint32_t _flags, bool _hasMips, GLenum& _magFilter, GLenum& _minFilter) { - const uint32_t mag = (_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT; - const uint32_t min = (_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT; - const uint32_t mip = (_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT; + const uint32_t mag = (_flags&BGFX_SAMPLER_MAG_MASK)>>BGFX_SAMPLER_MAG_SHIFT; + const uint32_t min = (_flags&BGFX_SAMPLER_MIN_MASK)>>BGFX_SAMPLER_MIN_SHIFT; + const uint32_t mip = (_flags&BGFX_SAMPLER_MIP_MASK)>>BGFX_SAMPLER_MIP_SHIFT; _magFilter = s_textureFilterMag[mag]; _minFilter = s_textureFilterMin[min][_hasMips ? mip+1 : 0]; } @@ -1663,32 +1684,6 @@ namespace bgfx { namespace gl BX_UNUSED(supported); } -#if BGFX_CONFIG_USE_OVR - class VRImplOVRGL : public VRImplOVR - { - public: - VRImplOVRGL(); - - virtual bool createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) override; - virtual void destroySwapChain() override; - virtual void destroyMirror() override; - virtual void makeRenderTargetActive(const VRDesc& _desc) override; - virtual bool submitSwapChain(const VRDesc& _desc) override; - - private: - GLuint m_eyeTarget[4]; - GLuint m_depthRbo; - GLuint m_msaaTexture; - GLuint m_msaaTarget; - GLuint m_mirrorFbo; - GLint m_mirrorWidth; - GLint m_mirrorHeight; - - ovrTextureSwapChain m_textureSwapChain; - ovrMirrorTexture m_mirrorTexture; - }; -#endif // BGFX_CONFIG_USE_OVR - struct VendorId { const char* name; @@ -1700,6 +1695,7 @@ namespace bgfx { namespace gl { "NVIDIA Corporation", BGFX_PCI_ID_NVIDIA }, { "Advanced Micro Devices, Inc.", BGFX_PCI_ID_AMD }, { "Intel", BGFX_PCI_ID_INTEL }, + { "ATI Technologies Inc.", BGFX_PCI_ID_AMD }, }; struct Workaround @@ -1750,7 +1746,7 @@ namespace bgfx { namespace gl { } - bool init() + bool init(const Init& _init) { struct ErrorState { @@ -1762,20 +1758,17 @@ namespace bgfx { namespace gl ErrorState::Enum errorState = ErrorState::Default; - m_renderdocdll = loadRenderDoc(); + if (_init.debug + || _init.profile) + { + m_renderdocdll = loadRenderDoc(); + } m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); - setRenderContextSize(BGFX_DEFAULT_WIDTH, BGFX_DEFAULT_HEIGHT); - - // Must be after context is initialized?! - VRImplI* vrImpl = NULL; -#if BGFX_CONFIG_USE_OVR - vrImpl = &m_ovrRender; -#endif - m_ovr.init(vrImpl); + setRenderContextSize(_init.resolution.width, _init.resolution.height); m_vendor = getGLString(GL_VENDOR); m_renderer = getGLString(GL_RENDERER); @@ -1861,8 +1854,8 @@ namespace bgfx { namespace gl ; if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) - && 0 == bx::strCmp(m_vendor, "Imagination Technologies") - && NULL != bx::strFind(m_version, "(SDK 3.5@3510720)") ) + && 0 == bx::strCmp(m_vendor, "Imagination Technologies") + && !bx::strFind(m_version, "(SDK 3.5@3510720)").isEmpty() ) { // Skip initializing extensions that are broken in emulator. s_extension[Extension::ARB_program_interface_query ].m_initialize = @@ -1870,8 +1863,8 @@ namespace bgfx { namespace gl } if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) - && 0 == bx::strCmp(m_vendor, "Imagination Technologies") - && NULL != bx::strFind(m_version, "1.8@905891") ) + && 0 == bx::strCmp(m_vendor, "Imagination Technologies") + && !bx::strFind(m_version, "1.8@905891").isEmpty() ) { m_workaround.m_detachShader = false; } @@ -1889,10 +1882,10 @@ namespace bgfx { namespace gl while (pos < end) { uint32_t len; - const char* space = bx::strFind(pos, ' '); - if (NULL != space) + const bx::StringView space = bx::strFind(pos, ' '); + if (!space.isEmpty() ) { - len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) ); + len = bx::uint32_min(sizeof(name), (uint32_t)(space.getPtr() - pos) ); } else { @@ -2096,10 +2089,11 @@ namespace bgfx { namespace gl // EXT_texture_format_BGRA8888 wants both format and internal // format to be BGRA. // - // Reference: - // https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt - // https://www.opengl.org/registry/specs/EXT/bgra.txt - // https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_format_BGRA8888.txt + // Reference(s): + // - https://web.archive.org/web/20181126035829/https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_format_BGRA8888.txt + // - https://web.archive.org/web/20181126035841/https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_bgra.txt + // - https://web.archive.org/web/20181126035851/https://www.khronos.org/registry/OpenGL/extensions/APPLE/APPLE_texture_format_BGRA8888.txt + // if (!s_extension[Extension::EXT_bgra ].m_supported && !s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported) { @@ -2113,12 +2107,17 @@ namespace bgfx { namespace gl } } - if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) - || !isTextureFormatValid(TextureFormat::R8) ) + if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) ) { - // GL core has to use GL_R8 Issue#208, GLES2 has to use GL_LUMINANCE issue#226 - s_textureFormat[TextureFormat::R8].m_internalFmt = GL_LUMINANCE; - s_textureFormat[TextureFormat::R8].m_fmt = GL_LUMINANCE; + setTextureFormat(TextureFormat::RGBA4, GL_ZERO, GL_ZERO, GL_ZERO); + setTextureFormat(TextureFormat::RGB5A1, GL_ZERO, GL_ZERO, GL_ZERO); + + if (!isTextureFormatValid(TextureFormat::R8) ) + { + // GL core has to use GL_R8 Issue#208, GLES2 has to use GL_LUMINANCE issue#226 + s_textureFormat[TextureFormat::R8].m_internalFmt = GL_LUMINANCE; + s_textureFormat[TextureFormat::R8].m_fmt = GL_LUMINANCE; + } } for (uint32_t ii = BX_ENABLED(BX_PLATFORM_IOS) ? TextureFormat::Unknown : 0 // skip test on iOS! @@ -2278,7 +2277,8 @@ namespace bgfx { namespace gl : 0 ; - if (NULL == glPolygonMode) + if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) + || NULL == glPolygonMode) { glPolygonMode = stubPolygonMode; } @@ -2303,11 +2303,18 @@ namespace bgfx { namespace gl g_caps.supported |= false || s_extension[Extension::EXT_texture_array].m_supported || s_extension[Extension::EXT_gpu_shader4].m_supported - || !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || (!!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) && !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) ) ? BGFX_CAPS_TEXTURE_2D_ARRAY : 0 ; + g_caps.supported |= false + || s_extension[Extension::EXT_gpu_shader4].m_supported + || (!!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) && !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) ) + ? BGFX_CAPS_VERTEX_ID + : 0 + ; + g_caps.supported |= false || s_extension[Extension::ARB_texture_cube_map_array].m_supported || s_extension[Extension::EXT_texture_cube_map_array].m_supported @@ -2315,52 +2322,60 @@ namespace bgfx { namespace gl : 0 ; - g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) ); + g_caps.limits.maxTextureSize = uint16_t(glGet(GL_MAX_TEXTURE_SIZE) ); + g_caps.limits.maxTextureLayers = uint16_t(bx::max(glGet(GL_MAX_ARRAY_TEXTURE_LAYERS), 1) ); + g_caps.limits.maxComputeBindings = computeSupport ? BGFX_MAX_COMPUTE_BINDINGS : 0; + g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS; if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::EXT_draw_buffers ].m_supported || s_extension[Extension::WEBGL_draw_buffers].m_supported) { - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(glGet(GL_MAX_DRAW_BUFFERS) + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_clamp( + glGet(GL_MAX_DRAW_BUFFERS) + , 1 , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); } - // if (s_extension[Extension::ARB_clip_control].m_supported) - // { - // GL_CHECK(glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) ); - // g_caps.originBottomLeft = true; - // } - // else +// if (s_extension[Extension::ARB_clip_control].m_supported) +// { +// GL_CHECK(glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) ); +// g_caps.originBottomLeft = true; +// } +// else { g_caps.homogeneousDepth = true; g_caps.originBottomLeft = true; } - m_vaoSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_vertex_array_object].m_supported - || s_extension[Extension::OES_vertex_array_object].m_supported - ; + m_vaoSupport = !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) + && (!!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_vertex_array_object].m_supported + || s_extension[Extension::OES_vertex_array_object].m_supported + ); if (m_vaoSupport) { GL_CHECK(glGenVertexArrays(1, &m_vao) ); } - m_samplerObjectSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_sampler_objects].m_supported - ; + m_samplerObjectSupport = !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) + && (!!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_sampler_objects].m_supported + ); m_shadowSamplersSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::EXT_shadow_samplers].m_supported ; - m_programBinarySupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) - || s_extension[Extension::ARB_get_program_binary].m_supported - || s_extension[Extension::OES_get_program_binary].m_supported - || s_extension[Extension::IMG_shader_binary ].m_supported - ; + m_programBinarySupport = !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) + && (!!(BGFX_CONFIG_RENDERER_OPENGLES >= 30) + || s_extension[Extension::ARB_get_program_binary].m_supported + || s_extension[Extension::OES_get_program_binary].m_supported + || s_extension[Extension::IMG_shader_binary ].m_supported + ); m_textureSwizzleSupport = false || s_extension[Extension::ARB_texture_swizzle].m_supported @@ -2422,7 +2437,7 @@ namespace bgfx { namespace gl m_srgbWriteControlSupport = s_extension[Extension::EXT_sRGB_write_control].m_supported; m_borderColorSupport = s_extension[Extension::NV_texture_border_clamp].m_supported; - s_textureAddress[BGFX_TEXTURE_U_BORDER>>BGFX_TEXTURE_U_SHIFT] = s_extension[Extension::NV_texture_border_clamp].m_supported + s_textureAddress[BGFX_SAMPLER_U_BORDER>>BGFX_SAMPLER_U_SHIFT] = s_extension[Extension::NV_texture_border_clamp].m_supported ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE ; @@ -2499,19 +2514,10 @@ namespace bgfx { namespace gl GL_CHECK(glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) ); } - if (NULL == glFrameTerminatorGREMEDY - || !s_extension[Extension::GREMEDY_frame_terminator].m_supported) - { - glFrameTerminatorGREMEDY = stubFrameTerminatorGREMEDY; - } - if (NULL == glInsertEventMarker || !s_extension[Extension::EXT_debug_marker].m_supported) { - glInsertEventMarker = (NULL != glStringMarkerGREMEDY && s_extension[Extension::GREMEDY_string_marker].m_supported) - ? stubInsertEventMarkerGREMEDY - : stubInsertEventMarker - ; + glInsertEventMarker = stubInsertEventMarker; } setGraphicsDebuggerPresent(s_extension[Extension::EXT_debug_tool].m_supported); @@ -2542,8 +2548,6 @@ namespace bgfx { namespace gl bx::snprintf(s_viewName[ii], BGFX_CONFIG_MAX_VIEW_NAME_RESERVED+1, "%3d ", ii); } - ovrPostReset(); - m_needPresent = false; } @@ -2556,9 +2560,6 @@ namespace bgfx { namespace gl break; } - ovrPreReset(); - m_ovr.shutdown(); - m_glctx.destroy(); unloadRenderDoc(m_renderdocdll); @@ -2567,9 +2568,6 @@ namespace bgfx { namespace gl void shutdown() { - ovrPreReset(); - m_ovr.shutdown(); - if (m_vaoSupport) { GL_CHECK(glBindVertexArray(0) ); @@ -2619,7 +2617,7 @@ namespace bgfx { namespace gl return false; } - void flip(HMD& _hmd) override + void flip() override { if (m_flip) { @@ -2635,21 +2633,16 @@ namespace bgfx { namespace gl if (m_needPresent) { - m_ovr.flip(); - m_ovr.swap(_hmd); - // Ensure the back buffer is bound as the source of the flip GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo)); - // need to swap GL render context even if OVR is enabled to get - // the mirror texture in the output m_glctx.swap(); m_needPresent = false; } } } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override + void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } @@ -2670,7 +2663,7 @@ namespace bgfx { namespace gl { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -2685,7 +2678,7 @@ namespace bgfx { namespace gl m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -2701,7 +2694,7 @@ namespace bgfx { namespace gl m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -2711,7 +2704,7 @@ namespace bgfx { namespace gl m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) override + void createShader(ShaderHandle _handle, const Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } @@ -2732,9 +2725,10 @@ namespace bgfx { namespace gl m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override + void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); + return NULL; } void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override @@ -2825,7 +2819,7 @@ namespace bgfx { namespace gl } } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override { TextureGL& texture = m_textures[_handle.idx]; @@ -2840,7 +2834,7 @@ namespace bgfx { namespace gl tc.m_width = _width; tc.m_height = _height; tc.m_depth = 0; - tc.m_numLayers = 1; + tc.m_numLayers = _numLayers; tc.m_numMips = _numMips; tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; @@ -2873,11 +2867,11 @@ namespace bgfx { namespace gl m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; - m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); + m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat); } void destroyFrameBuffer(FrameBufferHandle _handle) override @@ -2889,8 +2883,12 @@ namespace bgfx { namespace gl if (m_numWindows > 1) { FrameBufferHandle handle = m_windows[m_numWindows]; - m_windows[denseIdx] = handle; - m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + m_windows[m_numWindows] = {kInvalidHandle}; + if (m_numWindows != denseIdx) + { + m_windows[denseIdx] = handle; + m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + } } } } @@ -2906,7 +2904,7 @@ namespace bgfx { namespace gl void* data = BX_ALLOC(g_allocator, size); bx::memSet(data, 0, size); m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name, m_uniforms[_handle.idx]); + m_uniformReg.add(_handle, _name); } void destroyUniform(UniformHandle _handle) override @@ -2919,8 +2917,8 @@ namespace bgfx { namespace gl void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { SwapChainGL* swapChain = NULL; - uint32_t width = m_resolution.m_width; - uint32_t height = m_resolution.m_height; + uint32_t width = m_resolution.width; + uint32_t height = m_resolution.height; if (isValid(_handle) ) { @@ -3011,8 +3009,8 @@ namespace bgfx { namespace gl GL_CHECK(glBindVertexArray(m_vao) ); } - uint32_t width = m_resolution.m_width; - uint32_t height = m_resolution.m_height; + uint32_t width = m_resolution.width; + uint32_t height = m_resolution.height; GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) ); GL_CHECK(glViewport(0, 0, width, height) ); @@ -3083,15 +3081,14 @@ namespace bgfx { namespace gl void updateResolution(const Resolution& _resolution) { - bool recenter = !!(_resolution.m_flags & BGFX_RESET_HMD_RECENTER); - m_maxAnisotropy = !!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) + m_maxAnisotropy = !!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) ? m_maxAnisotropyDefault : 0.0f ; if (s_extension[Extension::ARB_depth_clamp].m_supported) { - if (!!(_resolution.m_flags & BGFX_RESET_DEPTH_CLAMP) ) + if (!!(_resolution.reset & BGFX_RESET_DEPTH_CLAMP) ) { GL_CHECK(glEnable(GL_DEPTH_CLAMP) ); } @@ -3102,32 +3099,25 @@ namespace bgfx { namespace gl } const uint32_t maskFlags = ~(0 - | BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP | BGFX_RESET_SUSPEND ); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height + || (m_resolution.reset&maskFlags) != (_resolution.reset&maskFlags) ) { - uint32_t flags = _resolution.m_flags & (~BGFX_RESET_INTERNAL_FORCE); + uint32_t flags = _resolution.reset & (~BGFX_RESET_INTERNAL_FORCE); m_resolution = _resolution; - m_resolution.m_flags = flags; + m_resolution.reset = flags; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.resize(false, _resolution.width, _resolution.height); m_textVideoMem.clear(); - if ( (flags & BGFX_RESET_HMD) - && m_ovr.isInitialized() ) - { - flags &= ~BGFX_RESET_MSAA_MASK; - } - - setRenderContextSize(m_resolution.m_width - , m_resolution.m_height + setRenderContextSize(m_resolution.width + , m_resolution.height , flags ); updateCapture(); @@ -3137,25 +3127,10 @@ namespace bgfx { namespace gl m_frameBuffers[ii].postReset(); } - ovrPreReset(); - ovrPostReset(); - - if (m_ovr.isEnabled() ) - { - m_ovr.makeRenderTargetActive(); - } - else - { - m_currentFbo = 0; - } + m_currentFbo = 0; GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_currentFbo) ); } - - if (recenter) - { - m_ovr.recenter(); - } } void setShaderUniform4f(uint8_t /*_flags*/, uint32_t _regIndex, const void* _val, uint32_t _numRegs) @@ -3196,18 +3171,11 @@ namespace bgfx { namespace gl { m_needPresent |= true; - if (m_ovr.isEnabled() ) - { - m_ovr.makeRenderTargetActive(); - } - else - { - m_currentFbo = m_msaaBackBufferFbo; - } + m_currentFbo = m_msaaBackBufferFbo; if (m_srgbWriteControlSupport) { - if (0 != (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) ) + if (0 != (m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER) ) { GL_CHECK(glEnable(GL_FRAMEBUFFER_SRGB) ); } @@ -3309,8 +3277,8 @@ namespace bgfx { namespace gl GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) ); GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_msaaBackBufferFbo) ); GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0) ); - uint32_t width = m_resolution.m_width; - uint32_t height = m_resolution.m_height; + uint32_t width = m_resolution.width; + uint32_t height = m_resolution.height; GLenum filter = BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) ? GL_NEAREST : GL_LINEAR @@ -3362,7 +3330,7 @@ namespace bgfx { namespace gl void invalidateCache() { - if ( (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) + if ( (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) && m_samplerObjectSupport) { m_samplerStateCache.invalidate(); @@ -3371,16 +3339,16 @@ namespace bgfx { namespace gl void setSamplerState(uint32_t _stage, uint32_t _numMips, uint32_t _flags, const float _rgba[4]) { - if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) - || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) + if ( (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) + && m_samplerObjectSupport) { - if (0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) ) + if (0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ) { - const uint32_t index = (_flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT; + const uint32_t index = (_flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; - _flags &= ~BGFX_TEXTURE_RESERVED_MASK; - _flags &= BGFX_TEXTURE_SAMPLER_BITS_MASK; - _flags |= _numMips<>BGFX_TEXTURE_U_SHIFT] + , s_textureAddress[(_flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT] ) ); GL_CHECK(glSamplerParameteri(sampler , GL_TEXTURE_WRAP_T - , s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT] + , s_textureAddress[(_flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT] ) ); GL_CHECK(glSamplerParameteri(sampler , GL_TEXTURE_WRAP_R - , s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT] + , s_textureAddress[(_flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT] ) ); GLenum minFilter; @@ -3447,7 +3415,7 @@ namespace bgfx { namespace gl GL_CHECK(glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, _rgba) ); } - if (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) + if (0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC) ) && 0.0f < m_maxAnisotropy) { GL_CHECK(glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, m_maxAnisotropy) ); @@ -3456,7 +3424,7 @@ namespace bgfx { namespace gl if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) || m_shadowSamplersSupport) { - const uint32_t cmpFunc = (_flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT; + const uint32_t cmpFunc = (_flags&BGFX_SAMPLER_COMPARE_MASK)>>BGFX_SAMPLER_COMPARE_SHIFT; if (0 == cmpFunc) { GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_COMPARE_MODE, GL_NONE) ); @@ -3484,31 +3452,13 @@ namespace bgfx { namespace gl return _visible == (0 != _render->m_occlusion[_handle.idx]); } - void ovrPostReset() - { -#if BGFX_CONFIG_USE_OVR - if (m_resolution.m_flags & (BGFX_RESET_HMD|BGFX_RESET_HMD_DEBUG) ) - { - const uint32_t msaaSamples = 1 << ( (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) >> BGFX_RESET_MSAA_SHIFT); - m_ovr.postReset(msaaSamples, m_resolution.m_width, m_resolution.m_height); - } -#endif // BGFX_CONFIG_USE_OVR - } - - void ovrPreReset() - { -#if BGFX_CONFIG_USE_OVR - m_ovr.preReset(); -#endif // BGFX_CONFIG_USE_OVR - } - void updateCapture() { - if (m_resolution.m_flags&BGFX_RESET_CAPTURE) + if (m_resolution.reset&BGFX_RESET_CAPTURE) { - m_captureSize = m_resolution.m_width*m_resolution.m_height*4; + m_captureSize = m_resolution.width*m_resolution.height*4; m_capture = BX_REALLOC(g_allocator, m_capture, m_captureSize); - g_callback->captureBegin(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, TextureFormat::BGRA8, true); + g_callback->captureBegin(m_resolution.width, m_resolution.height, m_resolution.width*4, TextureFormat::BGRA8, true); } else { @@ -3522,8 +3472,8 @@ namespace bgfx { namespace gl { GL_CHECK(glReadPixels(0 , 0 - , m_resolution.m_width - , m_resolution.m_height + , m_resolution.width + , m_resolution.height , m_readPixelsFmt , GL_UNSIGNED_BYTE , m_capture @@ -3533,11 +3483,11 @@ namespace bgfx { namespace gl { bimg::imageSwizzleBgra8( m_capture - , m_resolution.m_width*4 - , m_resolution.m_width - , m_resolution.m_height + , m_resolution.width*4 + , m_resolution.width + , m_resolution.height , m_capture - , m_resolution.m_width*4 + , m_resolution.width*4 ); } @@ -3933,19 +3883,14 @@ namespace bgfx { namespace gl Workaround m_workaround; GLuint m_currentFbo; - - VR m_ovr; -#if BGFX_CONFIG_USE_OVR - VRImplOVRGL m_ovrRender; -#endif // BGFX_CONFIG_USE_OVR }; RendererContextGL* s_renderGL; - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { s_renderGL = BX_NEW(g_allocator, RendererContextGL); - if (!s_renderGL->init() ) + if (!s_renderGL->init(_init) ) { BX_DELETE(g_allocator, s_renderGL); s_renderGL = NULL; @@ -3971,264 +3916,13 @@ namespace bgfx { namespace gl BX_UNUSED(complete); } -#if BGFX_CONFIG_USE_OVR - - VRImplOVRGL::VRImplOVRGL() - : m_depthRbo(0) - , m_msaaTexture(0) - , m_msaaTarget(0) - , m_textureSwapChain(NULL) - , m_mirrorTexture(NULL) - { - bx::memSet(&m_eyeTarget, 0, sizeof(m_eyeTarget) ); - } - - static void setDefaultSamplerState() - { - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ); - GL_CHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ); - } - - bool VRImplOVRGL::createSwapChain(const VRDesc& _desc, int _msaaSamples, int _mirrorWidth, int _mirrorHeight) - { - if (!m_session) - { - return false; - } - - if (NULL == m_textureSwapChain) - { - const GLsizei width = _desc.m_eyeSize[0].m_w + _desc.m_eyeSize[1].m_w; - const GLsizei height = bx::uint16_max(_desc.m_eyeSize[0].m_h, _desc.m_eyeSize[1].m_h); - - ovrTextureSwapChainDesc swapchainDesc = {}; - swapchainDesc.Type = ovrTexture_2D; - swapchainDesc.Width = width; - swapchainDesc.Height = height; - swapchainDesc.MipLevels = 1; - swapchainDesc.ArraySize = 1; - swapchainDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - swapchainDesc.SampleCount = 1; - swapchainDesc.StaticImage = ovrFalse; - - ovrResult result = ovr_CreateTextureSwapChainGL(m_session, &swapchainDesc, &m_textureSwapChain); - if (!OVR_SUCCESS(result) ) - { - destroySwapChain(); - return false; - } - - m_renderLayer.Header.Flags |= ovrLayerFlag_TextureOriginAtBottomLeft; - for (int eye = 0; eye < 2; ++eye) - { - m_renderLayer.ColorTexture[eye] = m_textureSwapChain; - } - - // create depth buffer - GL_CHECK(glGenRenderbuffers(1, &m_depthRbo)); - GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthRbo)); - if (_msaaSamples > 1) - { - GL_CHECK(glRenderbufferStorageMultisample(GL_RENDERBUFFER, _msaaSamples, GL_DEPTH_COMPONENT32F, width, height)); - } - else - { - GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT32F, width, height)); - } - GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0)); - - int count; - result = ovr_GetTextureSwapChainLength(m_session, m_textureSwapChain, &count); - if (!OVR_SUCCESS(result) ) - { - destroySwapChain(); - return false; - } - - BX_CHECK(count <= BX_COUNTOF(m_eyeTarget), "Too many OVR swap chain textures. %d", count); - for (int ii = 0; ii < count; ++ii) - { - GLuint texture; - ovr_GetTextureSwapChainBufferGL(m_session, m_textureSwapChain, ii, &texture); - - // create eye target - GL_CHECK(glGenFramebuffers(1, &m_eyeTarget[ii]) ); - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_eyeTarget[ii]) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0) ); - if (2 > _msaaSamples && 0 != m_depthRbo) - { - GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthRbo) ); - } - frameBufferValidate(); - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0) ); - } - - // create MSAA target - if (1 < _msaaSamples) - { - GL_CHECK(glGenTextures(1, &m_msaaTexture) ); - GL_CHECK(glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_msaaTexture) ); - GL_CHECK(glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, _msaaSamples, GL_RGBA, width, height, GL_TRUE) ); - setDefaultSamplerState(); - - GL_CHECK(glGenFramebuffers(1, &m_msaaTarget) ); - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaTarget) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_msaaTexture, 0) ); - if (0 != m_depthRbo) - { - GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthRbo) ); - } - frameBufferValidate(); - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0) ); - } - } - - if (NULL == m_mirrorTexture) - { - m_mirrorFbo = 0; - - ovrMirrorTextureDesc mirrorDesc = {}; - mirrorDesc.Width = _mirrorWidth; - mirrorDesc.Height = _mirrorHeight; - mirrorDesc.Format = OVR_FORMAT_R8G8B8A8_UNORM_SRGB; - - // Fallback to doing nothing if mirror was not created. This is to prevent errors with fast window resizes - ovr_CreateMirrorTextureGL(m_session, &mirrorDesc, &m_mirrorTexture); - if (m_mirrorTexture) - { - m_mirrorWidth = _mirrorWidth; - m_mirrorHeight = _mirrorHeight; - - // Configure the mirror read buffer - GLuint texId; - ovr_GetMirrorTextureBufferGL(m_session, m_mirrorTexture, &texId); - GL_CHECK(glGenFramebuffers(1, &m_mirrorFbo) ); - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_mirrorFbo) ); - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texId, 0) ); - GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0) ); - frameBufferValidate(); - GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, 0) ); - } - } - - return true; - } - - void VRImplOVRGL::destroySwapChain() - { - destroyMirror(); - - if (0 != m_msaaTarget) - { - GL_CHECK(glDeleteFramebuffers(1, &m_msaaTarget) ); - m_msaaTarget = 0; - } - - if (0 != m_msaaTexture) - { - GL_CHECK(glDeleteTextures(1, &m_msaaTexture) ); - m_msaaTexture = 0; - } - - if (0 != m_depthRbo) - { - GL_CHECK(glDeleteRenderbuffers(1, &m_depthRbo) ); - m_depthRbo = 0; - } - - for (int ii = 0, nn = BX_COUNTOF(m_eyeTarget); ii < nn; ++ii) - { - if (0 != m_eyeTarget[ii]) - { - GL_CHECK(glDeleteFramebuffers(1, &m_eyeTarget[ii]) ); - m_eyeTarget[ii] = 0; - } - } - - if (NULL != m_textureSwapChain) - { - ovr_DestroyTextureSwapChain(m_session, m_textureSwapChain); - m_textureSwapChain = NULL; - } - } - - void VRImplOVRGL::destroyMirror() - { - if (NULL != m_mirrorTexture) - { - GL_CHECK(glDeleteFramebuffers(1, &m_mirrorFbo) ); - ovr_DestroyMirrorTexture(m_session, m_mirrorTexture); - m_mirrorTexture = NULL; - } - } - - void VRImplOVRGL::makeRenderTargetActive(const VRDesc& /*_desc*/) - { - if (0 != m_msaaTarget) - { - s_renderGL->m_currentFbo = m_msaaTarget; - } - else - { - int index; - ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain, &index); - s_renderGL->m_currentFbo = m_eyeTarget[index]; - } - } - - bool VRImplOVRGL::submitSwapChain(const VRDesc& _desc) - { - BX_CHECK(NULL != m_textureSwapChain, "VRImplOVRGL submitted without a valid swap chain"); - - if (0 != m_msaaTarget) - { - const uint32_t width = _desc.m_eyeSize[0].m_w+_desc.m_eyeSize[1].m_w; - const uint32_t height = _desc.m_eyeSize[0].m_h; - - int index; - ovr_GetTextureSwapChainCurrentIndex(m_session, m_textureSwapChain, &index); - - // resolve MSAA - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_msaaTarget) ); - GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_eyeTarget[index]) ); - GL_CHECK(glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST) ); - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); - } - - ovrResult result = ovr_CommitTextureSwapChain(m_session, m_textureSwapChain); - if (!OVR_SUCCESS(result) ) - { - return false; - } - - ovrLayerHeader* layerList = &m_renderLayer.Header; - result = ovr_SubmitFrame(m_session, 0, &m_viewScale, &layerList, 1); - if (!OVR_SUCCESS(result) ) - { - return false; - } - - if (result != ovrSuccess_NotVisible && NULL != m_mirrorTexture) - { - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_mirrorFbo) ); - GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0) ); - GL_CHECK(glBlitFramebuffer(0, m_mirrorHeight, m_mirrorWidth, 0, 0, 0, m_mirrorWidth, m_mirrorHeight, GL_COLOR_BUFFER_BIT, GL_NEAREST) ); - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, 0) ); - } - - return true; - } - -#endif // BGFX_CONFIG_USE_OVR - const char* glslTypeName(GLuint _type) { #define GLSL_TYPE(_ty) case _ty: return #_ty switch (_type) { + GLSL_TYPE(GL_BOOL); GLSL_TYPE(GL_INT); GLSL_TYPE(GL_INT_VEC2); GLSL_TYPE(GL_INT_VEC3); @@ -4586,19 +4280,14 @@ namespace bgfx { namespace gl num = bx::uint32_max(num, 1); - int offset = 0; - char* array = const_cast(bx::strFind(name, '[') ); - if (NULL != array) + int32_t offset = 0; + const bx::StringView array = bx::strFind(name, '['); + if (!array.isEmpty() ) { + name[array.getPtr() - name] = '\0'; BX_TRACE("--- %s", name); - *array = '\0'; - array++; - char* end = const_cast(bx::strFind(array, ']') ); - if (NULL != end) - { // Some devices (Amazon Fire) might not return terminating brace. - *end = '\0'; - offset = atoi(array); - } + const bx::StringView end = bx::strFind(array.getPtr()+1, ']'); + bx::fromString(&offset, bx::StringView(array.getPtr()+1, end.getPtr() ) ); } switch (gltype) @@ -4822,6 +4511,19 @@ namespace bgfx { namespace gl } } + void ProgramGL::unbindAttributes() + { + for(uint32_t ii = 0, iiEnd = m_usedCount; ii < iiEnd; ++ii) + { + if(Attrib::Count == m_unboundUsedAttrib[ii]) + { + Attrib::Enum attr = Attrib::Enum(m_used[ii]); + GLint loc = m_attributes[attr]; + GL_CHECK(glDisableVertexAttribArray(loc)); + } + } + } + void ProgramGL::bindInstanceData(uint32_t _stride, uint32_t _baseVertex) const { uint32_t baseVertex = _baseVertex; @@ -4835,6 +4537,15 @@ namespace bgfx { namespace gl } } + void ProgramGL::unbindInstanceData() const + { + for(uint32_t ii = 0; 0xffff != m_instanceData[ii]; ++ii) + { + GLint loc = m_instanceData[ii]; + GL_CHECK(glDisableVertexAttribArray(loc)); + } + } + void IndexBufferGL::destroy() { GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) ); @@ -4847,7 +4558,7 @@ namespace bgfx { namespace gl GL_CHECK(glDeleteBuffers(1, &m_id) ); } - bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint32_t _flags) + bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint64_t _flags) { m_target = _target; m_numMips = _numMips; @@ -4909,8 +4620,7 @@ namespace bgfx { namespace gl , _depth ) ); } - - if (computeWrite) + else if (computeWrite) { if (_target == GL_TEXTURE_3D) { @@ -4933,7 +4643,7 @@ namespace bgfx { namespace gl } } - setSamplerState(_flags, NULL); + setSamplerState(uint32_t(_flags), NULL); if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && TextureFormat::BGRA8 == m_requestedFormat @@ -4993,7 +4703,7 @@ namespace bgfx { namespace gl return true; } - void TextureGL::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) + void TextureGL::create(const Memory* _mem, uint64_t _flags, uint8_t _skip) { bimg::ImageContainer imageContainer; @@ -5150,7 +4860,9 @@ namespace bgfx { namespace gl if (convert) { - imageDecodeToRgba8(temp + imageDecodeToRgba8( + g_allocator + , temp , mip.m_data , mip.m_width , mip.m_height @@ -5228,7 +4940,7 @@ namespace bgfx { namespace gl void TextureGL::destroy() { - if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) + if (0 == (m_flags & BGFX_SAMPLER_INTERNAL_SHARED) && 0 != m_id) { GL_CHECK(glBindTexture(m_target, 0) ); @@ -5246,7 +4958,7 @@ namespace bgfx { namespace gl void TextureGL::overrideInternal(uintptr_t _ptr) { destroy(); - m_flags |= BGFX_TEXTURE_INTERNAL_SHARED; + m_flags |= BGFX_SAMPLER_INTERNAL_SHARED; m_id = (GLuint)_ptr; } @@ -5269,7 +4981,7 @@ namespace bgfx { namespace gl && !s_textureFormat[m_requestedFormat].m_supported && !s_renderGL->m_textureSwizzleSupport ; - const bool unpackRowLength = BX_IGNORE_C4127(!!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported); + const bool unpackRowLength = !!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported; const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_requestedFormat) ); const bool convert = false || (compressed && m_textureFormat != m_requestedFormat) @@ -5296,7 +5008,7 @@ namespace bgfx { namespace gl if (!unpackRowLength) { - bimg::imageCopy(temp, width, height, bpp, srcpitch, data); + bimg::imageCopy(temp, width, height, 1, bpp, srcpitch, data); data = temp; } @@ -5319,15 +5031,16 @@ namespace bgfx { namespace gl if (convert) { - bimg::imageDecodeToRgba8(temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); + bimg::imageDecodeToRgba8(g_allocator, temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) ); data = temp; srcpitch = rectpitch; } - if (!unpackRowLength - && !convert) + if (BX_IGNORE_C4127(true + && !unpackRowLength + && !convert) ) { - bimg::imageCopy(temp, width, height, bpp, srcpitch, data); + bimg::imageCopy(temp, width, height, 1, bpp, srcpitch, data); data = temp; } @@ -5364,18 +5077,18 @@ namespace bgfx { namespace gl { // Force point sampling when texture format doesn't support linear sampling. _flags &= ~(0 - | BGFX_TEXTURE_MIN_MASK - | BGFX_TEXTURE_MAG_MASK - | BGFX_TEXTURE_MIP_MASK + | BGFX_SAMPLER_MIN_MASK + | BGFX_SAMPLER_MAG_MASK + | BGFX_SAMPLER_MIP_MASK ); _flags |= 0 - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MAG_POINT - | BGFX_TEXTURE_MIP_POINT + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MAG_POINT + | BGFX_SAMPLER_MIP_POINT ; } - const uint32_t flags = (0 != (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) ? m_flags : _flags) & BGFX_TEXTURE_SAMPLER_BITS_MASK; + const uint32_t flags = (0 != (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? m_flags : _flags) & BGFX_SAMPLER_BITS_MASK; bool hasBorderColor = false; bx::HashMurmur2A murmur; @@ -5383,9 +5096,9 @@ namespace bgfx { namespace gl murmur.add(flags); if (NULL != _rgba) { - if (BGFX_TEXTURE_U_BORDER == (flags & BGFX_TEXTURE_U_BORDER) - || BGFX_TEXTURE_V_BORDER == (flags & BGFX_TEXTURE_V_BORDER) - || BGFX_TEXTURE_W_BORDER == (flags & BGFX_TEXTURE_W_BORDER) ) + if (BGFX_SAMPLER_U_BORDER == (flags & BGFX_SAMPLER_U_BORDER) + || BGFX_SAMPLER_V_BORDER == (flags & BGFX_SAMPLER_V_BORDER) + || BGFX_SAMPLER_W_BORDER == (flags & BGFX_SAMPLER_W_BORDER) ) { murmur.add(_rgba, 16); hasBorderColor = true; @@ -5399,8 +5112,8 @@ namespace bgfx { namespace gl const GLenum targetMsaa = m_target; const uint8_t numMips = m_numMips; - GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_S, s_textureAddress[(flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]) ); - GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_T, s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]) ); + GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_S, s_textureAddress[(flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT]) ); + GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_T, s_textureAddress[(flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT]) ); if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::APPLE_texture_max_level].m_supported) @@ -5410,7 +5123,7 @@ namespace bgfx { namespace gl if (target == GL_TEXTURE_3D) { - GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_R, s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]) ); + GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_R, s_textureAddress[(flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT]) ); } GLenum magFilter; @@ -5430,7 +5143,7 @@ namespace bgfx { namespace gl GL_CHECK(glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, _rgba) ); } - if (0 != (flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) + if (0 != (flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC) ) && 0.0f < s_renderGL->m_maxAnisotropy) { GL_CHECK(glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, s_renderGL->m_maxAnisotropy) ); @@ -5439,7 +5152,7 @@ namespace bgfx { namespace gl if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_renderGL->m_shadowSamplersSupport) { - const uint32_t cmpFunc = (flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT; + const uint32_t cmpFunc = (flags&BGFX_SAMPLER_COMPARE_MASK)>>BGFX_SAMPLER_COMPARE_SHIFT; if (0 == cmpFunc) { GL_CHECK(glTexParameteri(target, GL_TEXTURE_COMPARE_MODE, GL_NONE) ); @@ -5457,11 +5170,11 @@ namespace bgfx { namespace gl void TextureGL::commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]) { - const uint32_t flags = 0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) + const uint32_t flags = 0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? _flags - : m_flags + : uint32_t(m_flags) ; - const uint32_t index = (flags & BGFX_TEXTURE_BORDER_COLOR_MASK) >> BGFX_TEXTURE_BORDER_COLOR_SHIFT; + const uint32_t index = (flags & BGFX_SAMPLER_BORDER_COLOR_MASK) >> BGFX_SAMPLER_BORDER_COLOR_SHIFT; GL_CHECK(glActiveTexture(GL_TEXTURE0+_stage) ); GL_CHECK(glBindTexture(m_target, m_id) ); @@ -5492,11 +5205,12 @@ namespace bgfx { namespace gl } } - void TextureGL::resolve() const + void TextureGL::resolve(uint8_t _resolve) const { const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK); if (renderTarget - && 1 < m_numMips) + && 1 < m_numMips + && 0 != (_resolve & BGFX_RESOLVE_AUTO_GEN_MIPS) ) { GL_CHECK(glBindTexture(m_target, m_id) ); GL_CHECK(glGenerateMipmap(m_target) ); @@ -5504,23 +5218,6 @@ namespace bgfx { namespace gl } } - void writeString(bx::WriterI* _writer, const char* _str) - { - bx::write(_writer, _str, (int32_t)bx::strLen(_str) ); - } - - void writeStringf(bx::WriterI* _writer, const char* _format, ...) - { - char temp[512]; - - va_list argList; - va_start(argList, _format); - int len = bx::vsnprintf(temp, BX_COUNTOF(temp), _format, argList); - va_end(argList); - - bx::write(_writer, temp, len); - } - void strins(char* _str, const char* _insert) { size_t len = bx::strLen(_insert); @@ -5528,7 +5225,7 @@ namespace bgfx { namespace gl bx::memCopy(_str, _insert, len); } - void ShaderGL::create(Memory* _mem) + void ShaderGL::create(const Memory* _mem) { bx::MemoryReader reader(_mem->data, _mem->size); m_hash = bx::hash(_mem->data, _mem->size); @@ -5536,25 +5233,38 @@ namespace bgfx { namespace gl uint32_t magic; bx::read(&reader, magic); - switch (magic) + if (isShaderType(magic, 'C') ) { - case BGFX_CHUNK_MAGIC_CSH: m_type = GL_COMPUTE_SHADER; break; - case BGFX_CHUNK_MAGIC_FSH: m_type = GL_FRAGMENT_SHADER; break; - case BGFX_CHUNK_MAGIC_VSH: m_type = GL_VERTEX_SHADER; break; - - default: - BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic); - break; + m_type = GL_COMPUTE_SHADER; + } + else if (isShaderType(magic, 'F') ) + { + m_type = GL_FRAGMENT_SHADER; + } + else if (isShaderType(magic, 'V') ) + { + m_type = GL_VERTEX_SHADER; } - uint32_t iohash; - bx::read(&reader, iohash); + uint32_t hashIn; + bx::read(&reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) + { + hashOut = hashIn; + } + else + { + bx::read(&reader, hashOut); + } uint16_t count; bx::read(&reader, count); BX_TRACE("%s Shader consts %d" - , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute" + , getShaderTypeName(magic) , count ); @@ -5584,53 +5294,49 @@ namespace bgfx { namespace gl bx::read(&reader, shaderSize); m_id = glCreateShader(m_type); - BX_WARN(0 != m_id, "Failed to create %s shader." - , BGFX_CHUNK_MAGIC_FSH == magic ? "fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "vertex" : "compute" - ); + BX_WARN(0 != m_id, "Failed to create shader."); - const char* code = (const char*)reader.getDataPtr(); + bx::StringView code( (const char*)reader.getDataPtr(), shaderSize); if (0 != m_id) { if (GL_COMPUTE_SHADER != m_type && 0 != bx::strCmp(code, "#version 430", 12) ) { - int32_t codeLen = (int32_t)bx::strLen(code); - int32_t tempLen = codeLen + (4<<10); + int32_t tempLen = code.getLength() + (4<<10); char* temp = (char*)alloca(tempLen); bx::StaticMemoryBlockWriter writer(temp, tempLen); + bx::Error err; + if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) && BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) ) { - writeString(&writer, - "#define centroid\n" - "#define flat\n" - "#define noperspective\n" - "#define smooth\n" + bx::write(&writer + , "#define centroid\n" + "#define flat\n" + "#define noperspective\n" + "#define smooth\n" ); bool usesDerivatives = s_extension[Extension::OES_standard_derivatives].m_supported - && bx::findIdentifierMatch(code, s_OES_standard_derivatives) + && !bx::findIdentifierMatch(code, s_OES_standard_derivatives).isEmpty() ; - bool usesFragData = !!bx::findIdentifierMatch(code, "gl_FragData"); + const bool usesFragData = !bx::findIdentifierMatch(code, "gl_FragData").isEmpty(); + const bool usesFragDepth = !bx::findIdentifierMatch(code, "gl_FragDepth").isEmpty(); + const bool usesShadowSamplers = !bx::findIdentifierMatch(code, s_EXT_shadow_samplers).isEmpty(); + const bool usesTextureLod = !bx::findIdentifierMatch(code, s_EXT_shader_texture_lod).isEmpty(); + const bool usesFragmentOrdering = !bx::findIdentifierMatch(code, "beginFragmentShaderOrdering").isEmpty(); - bool usesFragDepth = !!bx::findIdentifierMatch(code, "gl_FragDepth"); - - bool usesShadowSamplers = !!bx::findIdentifierMatch(code, s_EXT_shadow_samplers); - - bool usesTexture3D = s_extension[Extension::OES_texture_3D].m_supported - && bx::findIdentifierMatch(code, s_texture3D) + const bool usesTexture3D = true + && s_extension[Extension::OES_texture_3D].m_supported + && !bx::findIdentifierMatch(code, s_texture3D).isEmpty() ; - bool usesTextureLod = !!bx::findIdentifierMatch(code, s_EXT_shader_texture_lod); - - bool usesFragmentOrdering = !!bx::findIdentifierMatch(code, "beginFragmentShaderOrdering"); - if (usesDerivatives) { - writeString(&writer, "#extension GL_OES_standard_derivatives : enable\n"); + bx::write(&writer, "#extension GL_OES_standard_derivatives : enable\n"); } if (usesFragData) @@ -5639,9 +5345,7 @@ namespace bgfx { namespace gl || s_extension[Extension::WEBGL_draw_buffers].m_supported , "EXT_draw_buffers is used but not supported by GLES2 driver." ); - writeString(&writer - , "#extension GL_EXT_draw_buffers : enable\n" - ); + bx::write(&writer, "#extension GL_EXT_draw_buffers : enable\n"); } bool insertFragDepth = false; @@ -5650,7 +5354,7 @@ namespace bgfx { namespace gl BX_WARN(s_extension[Extension::EXT_frag_depth].m_supported, "EXT_frag_depth is used but not supported by GLES2 driver."); if (s_extension[Extension::EXT_frag_depth].m_supported) { - writeString(&writer + bx::write(&writer , "#extension GL_EXT_frag_depth : enable\n" "#define bgfx_FragDepth gl_FragDepthEXT\n" ); @@ -5659,7 +5363,7 @@ namespace bgfx { namespace gl bx::snprintf(str, BX_COUNTOF(str), "%s float gl_FragDepthEXT;\n" , s_extension[Extension::OES_fragment_precision_high].m_supported ? "highp" : "mediump" ); - writeString(&writer, str); + bx::write(&writer, str); } else { @@ -5671,7 +5375,7 @@ namespace bgfx { namespace gl { if (s_renderGL->m_shadowSamplersSupport) { - writeString(&writer + bx::write(&writer , "#extension GL_EXT_shadow_samplers : enable\n" "#define shadow2D shadow2DEXT\n" "#define shadow2DProj shadow2DProjEXT\n" @@ -5679,7 +5383,7 @@ namespace bgfx { namespace gl } else { - writeString(&writer + bx::write(&writer , "#define sampler2DShadow sampler2D\n" "#define shadow2D(_sampler, _coord) step(_coord.z, texture2D(_sampler, _coord.xy).x)\n" "#define shadow2DProj(_sampler, _coord) step(_coord.z/_coord.w, texture2DProj(_sampler, _coord).x)\n" @@ -5689,7 +5393,7 @@ namespace bgfx { namespace gl if (usesTexture3D) { - writeString(&writer, "#extension GL_OES_texture_3D : enable\n"); + bx::write(&writer, "#extension GL_OES_texture_3D : enable\n"); } if (usesTextureLod) @@ -5701,33 +5405,33 @@ namespace bgfx { namespace gl if (s_extension[Extension::ARB_shader_texture_lod].m_supported) { - writeString(&writer + bx::write(&writer , "#extension GL_ARB_shader_texture_lod : enable\n" - "#define texture2DLod texture2DLodARB\n" - "#define texture2DProjLod texture2DProjLodARB\n" - "#define textureCubeLod textureCubeLodARB\n" - "#define texture2DGrad texture2DGradARB\n" + "#define texture2DLod texture2DLodARB\n" + "#define texture2DProjLod texture2DProjLodARB\n" + "#define textureCubeLod textureCubeLodARB\n" + "#define texture2DGrad texture2DGradARB\n" "#define texture2DProjGrad texture2DProjGradARB\n" - "#define textureCubeGrad textureCubeGradARB\n" + "#define textureCubeGrad textureCubeGradARB\n" ); } else { if(s_extension[Extension::EXT_shader_texture_lod].m_supported) { - writeString(&writer - , "#extension GL_EXT_shader_texture_lod : enable\n" - "#define texture2DLod texture2DLodEXT\n" - "#define texture2DProjLod texture2DProjLodEXT\n" - "#define textureCubeLod textureCubeLodEXT\n" - ); + bx::write(&writer + , "#extension GL_EXT_shader_texture_lod : enable\n" + "#define texture2DLod texture2DLodEXT\n" + "#define texture2DProjLod texture2DProjLodEXT\n" + "#define textureCubeLod textureCubeLodEXT\n" + ); } else { - writeString(&writer + bx::write(&writer , "#define texture2DLod(_sampler, _coord, _level) texture2D(_sampler, _coord)\n" - "#define texture2DProjLod(_sampler, _coord, _level) texture2DProj(_sampler, _coord)\n" - "#define textureCubeLod(_sampler, _coord, _level) textureCube(_sampler, _coord)\n" + "#define texture2DProjLod(_sampler, _coord, _level) texture2DProj(_sampler, _coord)\n" + "#define textureCubeLod(_sampler, _coord, _level) textureCube(_sampler, _coord)\n" ); } } @@ -5737,42 +5441,47 @@ namespace bgfx { namespace gl { if (s_extension[Extension::INTEL_fragment_shader_ordering].m_supported) { - writeString(&writer, "#extension GL_INTEL_fragment_shader_ordering : enable\n"); + bx::write(&writer, "#extension GL_INTEL_fragment_shader_ordering : enable\n"); } else { - writeString(&writer, "#define beginFragmentShaderOrdering()\n"); + bx::write(&writer, "#define beginFragmentShaderOrdering()\n"); } } - writeStringf(&writer, "precision %s float;\n" - , m_type == GL_FRAGMENT_SHADER ? "mediump" : "highp" - ); + bx::write(&writer, &err, "precision %s float;\n" + , m_type == GL_FRAGMENT_SHADER ? "mediump" : "highp" + ); - bx::write(&writer, code, codeLen); + bx::write(&writer, code); bx::write(&writer, '\0'); if (insertFragDepth) { - const char* entry = bx::strFind(temp, "void main ()"); - if (NULL != entry) + bx::StringView shader(temp); + bx::StringView entry = bx::strFind(shader, "void main ()"); + if (!entry.isEmpty() ) { - char* brace = const_cast(bx::strFind(entry, "{") ); - if (NULL != brace) + entry.set(entry.getTerm(), shader.getTerm() ); + bx::StringView brace = bx::strFind(entry, "{"); + if (!brace.isEmpty() ) { - const char* end = bx::strmb(brace, '{', '}'); - if (NULL != end) + bx::StringView block = bx::strFindBlock(bx::StringView(brace.getPtr(), shader.getTerm() ), '{', '}'); + if (!block.isEmpty() ) { - strins(brace+1, "\n float bgfx_FragDepth = 0.0;\n"); + strins(const_cast(brace.getPtr()+1), "\n float bgfx_FragDepth = 0.0;\n"); } } } } // Replace all instances of gl_FragDepth with bgfx_FragDepth. - for (const char* fragDepth = bx::findIdentifierMatch(temp, "gl_FragDepth"); NULL != fragDepth; fragDepth = bx::findIdentifierMatch(fragDepth, "gl_FragDepth") ) + for (bx::StringView fragDepth = bx::findIdentifierMatch(temp, "gl_FragDepth") + ; !fragDepth.isEmpty() + ; fragDepth = bx::findIdentifierMatch(fragDepth, "gl_FragDepth") + ) { - char* insert = const_cast(fragDepth); + char* insert = const_cast(fragDepth.getPtr() ); strins(insert, "bg"); bx::memCopy(insert + 2, "fx", 2); } @@ -5782,86 +5491,94 @@ namespace bgfx { namespace gl { const bool usesTextureLod = true && s_extension[Extension::ARB_shader_texture_lod].m_supported - && bx::findIdentifierMatch(code, s_ARB_shader_texture_lod) + && !bx::findIdentifierMatch(code, s_ARB_shader_texture_lod).isEmpty() ; - const bool usesGpuShader4 = !!bx::findIdentifierMatch(code, s_EXT_gpu_shader4); - const bool usesGpuShader5 = !!bx::findIdentifierMatch(code, s_ARB_gpu_shader5); - const bool usesIUsamplers = !!bx::findIdentifierMatch(code, s_uisamplers); - const bool usesTexelFetch = !!bx::findIdentifierMatch(code, s_texelFetch); - const bool usesTextureArray = !!bx::findIdentifierMatch(code, s_textureArray); - const bool usesTexture3D = !!bx::findIdentifierMatch(code, s_texture3D); - const bool usesTextureMS = !!bx::findIdentifierMatch(code, s_ARB_texture_multisample); - const bool usesPacking = !!bx::findIdentifierMatch(code, s_ARB_shading_language_packing); + const bool usesGpuShader4 = !bx::findIdentifierMatch(code, s_EXT_gpu_shader4).isEmpty(); + const bool usesGpuShader5 = !bx::findIdentifierMatch(code, s_ARB_gpu_shader5).isEmpty(); + const bool usesIUsamplers = !bx::findIdentifierMatch(code, s_uisamplers).isEmpty(); + const bool usesUint = !bx::findIdentifierMatch(code, s_uint).isEmpty(); + const bool usesTexelFetch = !bx::findIdentifierMatch(code, s_texelFetch).isEmpty(); + const bool usesTextureArray = !bx::findIdentifierMatch(code, s_textureArray).isEmpty(); + const bool usesTexture3D = !bx::findIdentifierMatch(code, s_texture3D).isEmpty(); + const bool usesTextureMS = !bx::findIdentifierMatch(code, s_ARB_texture_multisample).isEmpty(); + const bool usesPacking = !bx::findIdentifierMatch(code, s_ARB_shading_language_packing).isEmpty(); + const bool usesInterpQ = !bx::findIdentifierMatch(code, s_intepolationQualifier).isEmpty(); uint32_t version = BX_ENABLED(BX_PLATFORM_OSX) ? 120 - : usesTextureArray || usesTexture3D || usesIUsamplers|| usesTexelFetch || usesGpuShader5 ? 130 + : usesTextureArray + || usesTexture3D + || usesIUsamplers + || usesUint + || usesTexelFetch + || usesGpuShader5 + || usesInterpQ ? 130 : usesTextureLod ? 120 : 120 ; if (0 != version) { - writeStringf(&writer, "#version %d\n", version); + bx::write(&writer, &err, "#version %d\n", version); } if (usesTextureLod) { if (m_type == GL_FRAGMENT_SHADER) { - writeString(&writer + bx::write(&writer , "#extension GL_ARB_shader_texture_lod : enable\n" - "#define texture2DGrad texture2DGradARB\n" + "#define texture2DGrad texture2DGradARB\n" "#define texture2DProjGrad texture2DProjGradARB\n" - "#define textureCubeGrad textureCubeGradARB\n" + "#define textureCubeGrad textureCubeGradARB\n" ); } } if (usesGpuShader4) { - writeString(&writer, "#extension GL_EXT_gpu_shader4 : enable\n"); + bx::write(&writer, "#extension GL_EXT_gpu_shader4 : enable\n"); } if (usesGpuShader5) { - writeString(&writer, "#extension GL_ARB_gpu_shader5 : enable\n"); + bx::write(&writer, "#extension GL_ARB_gpu_shader5 : enable\n"); } if (usesPacking) { - writeString(&writer, "#extension GL_ARB_shading_language_packing : enable\n"); + bx::write(&writer, "#extension GL_ARB_shading_language_packing : enable\n"); } if (usesTextureMS) { - writeString(&writer, "#extension GL_ARB_texture_multisample : enable\n"); + bx::write(&writer, "#extension GL_ARB_texture_multisample : enable\n"); } if (usesTextureArray) { - writeString(&writer, "#extension GL_EXT_texture_array : enable\n"); + bx::write(&writer, "#extension GL_EXT_texture_array : enable\n"); if (BX_ENABLED(BX_PLATFORM_OSX) ) { - writeString(&writer, "#define texture2DArrayLodEXT texture2DArray\n"); + bx::write(&writer, "#define texture2DArrayLodEXT texture2DArray\n"); } else { - writeString(&writer, "#define texture2DArrayLodEXT texture2DArrayLod\n"); + bx::write(&writer, "#define texture2DArrayLodEXT texture2DArrayLod\n"); } } if (usesTexture3D) { - writeString(&writer, "#define texture3DEXT texture3D\n"); + bx::write(&writer, "#define texture3DEXT texture3D\n"); if (BX_ENABLED(BX_PLATFORM_OSX) ) { - writeString(&writer, "#define texture3DLodEXT texture3D\n"); + bx::write(&writer, "#define texture3DLodEXT texture3D\n"); } else { - writeString(&writer, "#define texture3DLodEXT texture3DLod\n"); + bx::write(&writer, "#define texture3DLodEXT texture3DLod\n"); } } @@ -5869,23 +5586,23 @@ namespace bgfx { namespace gl { if (m_type == GL_FRAGMENT_SHADER) { - writeString(&writer, "#define varying in\n"); + bx::write(&writer, "#define varying in\n"); } else { - writeString(&writer, "#define attribute in\n"); - writeString(&writer, "#define varying out\n"); + bx::write(&writer, "#define attribute in\n"); + bx::write(&writer, "#define varying out\n"); } uint32_t fragData = 0; - if (!!bx::findIdentifierMatch(code, "gl_FragData") ) + if (!bx::findIdentifierMatch(code, "gl_FragData").isEmpty() ) { for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); - fragData = bx::uint32_max(fragData, NULL == bx::strFind(code, tmpFragData) ? 0 : ii+1); + fragData = bx::uint32_max(fragData, bx::strFind(code, tmpFragData).isEmpty() ? 0 : ii+1); } BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!"); @@ -5893,39 +5610,47 @@ namespace bgfx { namespace gl if (0 != fragData) { - writeStringf(&writer, "out vec4 bgfx_FragData[%d];\n", fragData); - writeString(&writer, "#define gl_FragData bgfx_FragData\n"); + bx::write(&writer, &err, "out vec4 bgfx_FragData[%d];\n", fragData); + bx::write(&writer, "#define gl_FragData bgfx_FragData\n"); } else { - writeString(&writer, "out vec4 bgfx_FragColor;\n"); - writeString(&writer, "#define gl_FragColor bgfx_FragColor\n"); + bx::write(&writer, "out vec4 bgfx_FragColor;\n"); + bx::write(&writer, "#define gl_FragColor bgfx_FragColor\n"); } } else { if (m_type == GL_FRAGMENT_SHADER) { - writeString(&writer, "#define in varying\n"); + bx::write(&writer, "#define in varying\n"); } else { - writeString(&writer, "#define in attribute\n"); - writeString(&writer, "#define out varying\n"); + bx::write(&writer + , "#define in attribute\n" + "#define out varying\n" + ); } } - writeString(&writer, - "#define lowp\n" - "#define mediump\n" - "#define highp\n" + bx::write(&writer, + "#define lowp\n" + "#define mediump\n" + "#define highp\n" + ); + + if (!usesInterpQ) + { + bx::write(&writer, "#define centroid\n" "#define flat\n" "#define noperspective\n" "#define smooth\n" ); + } - bx::write(&writer, code, codeLen); + bx::write(&writer, code); bx::write(&writer, '\0'); } else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31) @@ -5933,105 +5658,114 @@ namespace bgfx { namespace gl { if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) { - writeString(&writer + bx::write(&writer, &err , "#version 300 es\n" - "precision mediump float;\n" + "precision %s float;\n" + , m_type == GL_FRAGMENT_SHADER ? "mediump" : "highp" ); } else { - writeString(&writer, "#version 140\n"); + bx::write(&writer, "#version 140\n"); } - writeString(&writer, "#define texture2DLod textureLod\n"); - writeString(&writer, "#define texture3DLod textureLod\n"); - writeString(&writer, "#define textureCubeLod textureLod\n"); - writeString(&writer, "#define texture2DGrad textureGrad\n"); - writeString(&writer, "#define texture3DGrad textureGrad\n"); - writeString(&writer, "#define textureCubeGrad textureGrad\n"); + bx::write(&writer + , "#define texture2DLod textureLod\n" + "#define texture3DLod textureLod\n" + "#define textureCubeLod textureLod\n" + "#define texture2DGrad textureGrad\n" + "#define texture3DGrad textureGrad\n" + "#define textureCubeGrad textureGrad\n" + ); if (m_type == GL_FRAGMENT_SHADER) { - writeString(&writer, "#define varying in\n"); - writeString(&writer, "#define texture2D texture\n"); - writeString(&writer, "#define texture2DProj textureProj\n"); + bx::write(&writer + , "#define varying in\n" + "#define texture2D texture\n" + "#define texture2DProj textureProj\n" + ); if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ) { - writeString(&writer, "#define shadow2D(_sampler, _coord) vec2(textureProj(_sampler, vec4(_coord, 1.0) ) )\n"); - writeString(&writer, "#define shadow2DProj(_sampler, _coord) vec2(textureProj(_sampler, _coord) ) )\n"); + bx::write(&writer, "#define shadow2D(_sampler, _coord) vec2(textureProj(_sampler, vec4(_coord, 1.0) ) )\n"); + bx::write(&writer, "#define shadow2DProj(_sampler, _coord) vec2(textureProj(_sampler, _coord) ) )\n"); } else { - writeString(&writer, "#define shadow2D(_sampler, _coord) (textureProj(_sampler, vec4(_coord, 1.0) ) )\n"); - writeString(&writer, "#define shadow2DProj(_sampler, _coord) (textureProj(_sampler, _coord) ) )\n"); + bx::write(&writer, "#define shadow2D(_sampler, _coord) (textureProj(_sampler, vec4(_coord, 1.0) ) )\n"); + bx::write(&writer, "#define shadow2DProj(_sampler, _coord) (textureProj(_sampler, _coord) ) )\n"); } - writeString(&writer, "#define texture3D texture\n"); - writeString(&writer, "#define textureCube texture\n"); + bx::write(&writer, "#define texture3D texture\n"); + bx::write(&writer, "#define textureCube texture\n"); uint32_t fragData = 0; - if (!!bx::findIdentifierMatch(code, "gl_FragData") ) + if (!bx::findIdentifierMatch(code, "gl_FragData").isEmpty() ) { for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii) { char tmpFragData[16]; bx::snprintf(tmpFragData, BX_COUNTOF(tmpFragData), "gl_FragData[%d]", ii); - fragData = bx::uint32_max(fragData, NULL == bx::strFind(code, tmpFragData) ? 0 : ii+1); + fragData = bx::max(fragData, bx::strFind(code, tmpFragData).isEmpty() ? 0 : ii+1); } BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!"); } - if (!!bx::findIdentifierMatch(code, "beginFragmentShaderOrdering") ) + if (!bx::findIdentifierMatch(code, "beginFragmentShaderOrdering").isEmpty() ) { if (s_extension[Extension::INTEL_fragment_shader_ordering].m_supported) { - writeString(&writer, "#extension GL_INTEL_fragment_shader_ordering : enable\n"); + bx::write(&writer, "#extension GL_INTEL_fragment_shader_ordering : enable\n"); } else { - writeString(&writer, "#define beginFragmentShaderOrdering()\n"); + bx::write(&writer, "#define beginFragmentShaderOrdering()\n"); } } - if (!!bx::findIdentifierMatch(code, s_ARB_texture_multisample) ) + if (!bx::findIdentifierMatch(code, s_ARB_texture_multisample).isEmpty() ) { - writeString(&writer, "#extension GL_ARB_texture_multisample : enable\n"); + bx::write(&writer, "#extension GL_ARB_texture_multisample : enable\n"); } if (0 != fragData) { - writeStringf(&writer, "out vec4 bgfx_FragData[%d];\n", fragData); - writeString(&writer, "#define gl_FragData bgfx_FragData\n"); + bx::write(&writer, &err, "out vec4 bgfx_FragData[%d];\n", fragData); + bx::write(&writer, "#define gl_FragData bgfx_FragData\n"); } else { - writeString(&writer, "out vec4 bgfx_FragColor;\n"); - writeString(&writer, "#define gl_FragColor bgfx_FragColor\n"); + bx::write(&writer + , "out vec4 bgfx_FragColor;\n" + "#define gl_FragColor bgfx_FragColor\n" + ); } } else { - writeString(&writer, "#define attribute in\n"); - writeString(&writer, "#define varying out\n"); + bx::write(&writer + , "#define attribute in\n" + "#define varying out\n" + ); } if (!BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) ) { - writeString(&writer - , "#define lowp\n" - "#define mediump\n" - "#define highp\n" - ); + bx::write(&writer + , "#define lowp\n" + "#define mediump\n" + "#define highp\n" + ); } - bx::write(&writer, code, codeLen); + bx::write(&writer, code.getPtr(), code.getLength() ); bx::write(&writer, '\0'); } - code = temp; + code.set(temp); } else if (GL_COMPUTE_SHADER == m_type) { @@ -6040,15 +5774,17 @@ namespace bgfx { namespace gl char* temp = (char*)alloca(tempLen); bx::StaticMemoryBlockWriter writer(temp, tempLen); - writeString(&writer, "#version 430\n"); - writeString(&writer, "#define texture2DLod textureLod\n"); - writeString(&writer, "#define texture3DLod textureLod\n"); - writeString(&writer, "#define textureCubeLod textureLod\n"); - writeString(&writer, "#define texture2DGrad textureGrad\n"); - writeString(&writer, "#define texture3DGrad textureGrad\n"); - writeString(&writer, "#define textureCubeGrad textureGrad\n"); + bx::write(&writer + , "#version 430\n" + "#define texture2DLod textureLod\n" + "#define texture3DLod textureLod\n" + "#define textureCubeLod textureLod\n" + "#define texture2DGrad textureGrad\n" + "#define texture3DGrad textureGrad\n" + "#define textureCubeGrad textureGrad\n" + ); - bx::write(&writer, code+bx::strLen("#version 430"), codeLen); + bx::write(&writer, code.getPtr()+bx::strLen("#version 430"), codeLen); bx::write(&writer, '\0'); code = temp; @@ -6072,10 +5808,10 @@ namespace bgfx { namespace gl if (err.isOk() ) { str[len] = '\0'; - const char* eol = bx::streol(str); - if (eol != str) + bx::StringView eol = bx::strFindEol(str); + if (eol.getPtr() != str) { - *const_cast(eol) = '\0'; + *const_cast(eol.getPtr() ) = '\0'; } BX_TRACE("%3d %s", line, str); } @@ -6140,15 +5876,16 @@ namespace bgfx { namespace gl uint32_t colorIdx = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - const TextureGL& texture = s_renderGL->m_textures[handle.idx]; + const TextureGL& texture = s_renderGL->m_textures[at.handle.idx]; if (0 == colorIdx) { - m_width = bx::uint32_max(texture.m_width >> m_attachment[ii].mip, 1); - m_height = bx::uint32_max(texture.m_height >> m_attachment[ii].mip, 1); + m_width = bx::uint32_max(texture.m_width >> at.mip, 1); + m_height = bx::uint32_max(texture.m_height >> at.mip, 1); } GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx; @@ -6177,25 +5914,60 @@ namespace bgfx { namespace gl if (0 != texture.m_rbo) { - GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER - , attachment - , GL_RENDERBUFFER - , texture.m_rbo - ) ); +#if !(BGFX_CONFIG_RENDERER_OPENGL >= 30 || BGFX_CONFIG_RENDERER_OPENGLES >= 30) + if (GL_DEPTH_STENCIL_ATTACHMENT == attachment) + { + GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER + , GL_DEPTH_ATTACHMENT + , GL_RENDERBUFFER + , texture.m_rbo + ) ); + GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER + , GL_STENCIL_ATTACHMENT + , GL_RENDERBUFFER + , texture.m_rbo + ) ); + } + else +#endif + { + GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER + , attachment + , GL_RENDERBUFFER + , texture.m_rbo + ) ); + } + } + else if (Access::Write == at.access) + { + if (1 < texture.m_depth + && !texture.isCubeMap()) + { + GL_CHECK(glFramebufferTextureLayer(GL_FRAMEBUFFER + , attachment + , texture.m_id + , at.mip + , at.layer + ) ); + } + else + { + GLenum target = texture.isCubeMap() + ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + at.layer + : texture.m_target + ; + + GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER + , attachment + , target + , texture.m_id + , at.mip + ) ); + } } else { - GLenum target = texture.isCubeMap() - ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer - : texture.m_target - ; - - GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER - , attachment - , target - , texture.m_id - , m_attachment[ii].mip - ) ); + BX_CHECK(false, ""); } needResolve |= (0 != texture.m_rbo) && (0 != texture.m_id); @@ -6234,10 +6006,11 @@ namespace bgfx { namespace gl colorIdx = 0; for (uint32_t ii = 0; ii < m_numTh; ++ii) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - const TextureGL& texture = s_renderGL->m_textures[handle.idx]; + const TextureGL& texture = s_renderGL->m_textures[at.handle.idx]; if (0 != texture.m_id) { @@ -6247,7 +6020,7 @@ namespace bgfx { namespace gl ++colorIdx; GLenum target = texture.isCubeMap() - ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + m_attachment[ii].layer + ? GL_TEXTURE_CUBE_MAP_POSITIVE_X + at.layer : texture.m_target ; @@ -6255,7 +6028,7 @@ namespace bgfx { namespace gl , attachment , target , texture.m_id - , m_attachment[ii].mip + , at.mip ) ); } } @@ -6269,9 +6042,9 @@ namespace bgfx { namespace gl } } - void FrameBufferGL::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) + void FrameBufferGL::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) { - BX_UNUSED(_depthFormat); + BX_UNUSED(_format, _depthFormat); m_swapChain = s_renderGL->m_glctx.createSwapChain(_nwh); m_width = _width; m_height = _height; @@ -6307,35 +6080,51 @@ namespace bgfx { namespace gl { if (0 != m_fbo[1]) { - GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) ); - GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0) ); - GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[1]) ); - GL_CHECK(glBlitFramebuffer(0 - , 0 - , m_width - , m_height - , 0 - , 0 - , m_width - , m_height - , GL_COLOR_BUFFER_BIT - , GL_LINEAR - ) ); + uint32_t colorIdx = 0; + for (uint32_t ii = 0; ii < m_numTh; ++ii) + { + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) + { + const TextureGL& texture = s_renderGL->m_textures[at.handle.idx]; + + bimg::TextureFormat::Enum format = bimg::TextureFormat::Enum(texture.m_textureFormat); + if (!bimg::isDepth(format) ) + { + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) ); + GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[1]) ); + GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0 + colorIdx) ); + GL_CHECK(glDrawBuffer(GL_COLOR_ATTACHMENT0 + colorIdx) ); + colorIdx++; + GL_CHECK(glBlitFramebuffer(0 + , 0 + , m_width + , m_height + , 0 + , 0 + , m_width + , m_height + , GL_COLOR_BUFFER_BIT + , GL_LINEAR + ) ); + } + } + } + GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) ); GL_CHECK(glReadBuffer(GL_NONE) ); GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) ); } - if (0 < m_numTh) + for (uint32_t ii = 0; ii < m_numTh; ++ii) { - for (uint32_t ii = 0; ii < m_numTh; ++ii) + const Attachment& at = m_attachment[ii]; + + if (isValid(at.handle) ) { - TextureHandle handle = m_attachment[ii].handle; - if (isValid(handle) ) - { - const TextureGL& texture = s_renderGL->m_textures[handle.idx]; - texture.resolve(); - } + const TextureGL& texture = s_renderGL->m_textures[at.handle.idx]; + texture.resolve(at.resolve); } } } @@ -6521,6 +6310,7 @@ namespace bgfx { namespace gl } GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) ); + GL_CHECK(glFrontFace(GL_CW) ); updateResolution(_render->m_resolution); @@ -6557,23 +6347,19 @@ namespace bgfx { namespace gl RenderBind currentBind; currentBind.clear(); - _render->m_hmdInitialized = m_ovr.isInitialized(); - - const bool hmdEnabled = m_ovr.isEnabled(); + const bool hmdEnabled = false; static ViewState viewState; viewState.reset(_render, hmdEnabled); uint16_t programIdx = kInvalidHandle; + uint16_t boundProgramIdx = kInvalidHandle; SortKey key; uint16_t view = UINT16_MAX; FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS }; BlitState bs(_render); - int32_t resolutionHeight = hmdEnabled - ? _render->m_hmd.height - : _render->m_resolution.m_height - ; + int32_t resolutionHeight = _render->m_resolution.height; uint32_t blendFactor = 0; uint8_t primIndex; @@ -6600,6 +6386,7 @@ namespace bgfx { namespace gl || (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && s_extension[Extension::ARB_compute_shader].m_supported) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) ; + const uint32_t maxComputeBindings = g_caps.limits.maxComputeBindings; uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {}; @@ -6663,10 +6450,7 @@ namespace bgfx { namespace gl if (_render->m_view[view].m_fbh.idx != fbh.idx) { fbh = _render->m_view[view].m_fbh; - resolutionHeight = hmdEnabled - ? _render->m_hmd.height - : _render->m_resolution.m_height - ; + resolutionHeight = _render->m_resolution.height; resolutionHeight = setFrameBuffer(fbh, resolutionHeight, discardFlags); } @@ -6706,15 +6490,8 @@ namespace bgfx { namespace gl GL_CHECK(glInsertEventMarker(0, viewName) ); } - if (m_ovr.isEnabled() ) - { - m_ovr.getViewport(eye, &viewState.m_rect); - } - else - { - viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2; - viewState.m_rect.m_width /= 2; - } + viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2; + viewState.m_rect.m_width /= 2; } else { @@ -6776,7 +6553,7 @@ namespace bgfx { namespace gl GL_CHECK(glUseProgram(program.m_id) ); GLbitfield barrier = 0; - for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) + for (uint32_t ii = 0; ii < maxComputeBindings; ++ii) { const Binding& bind = renderBind.m_bind[ii]; if (kInvalidHandle != bind.m_idx) @@ -6786,22 +6563,30 @@ namespace bgfx { namespace gl case Binding::Texture: { TextureGL& texture = m_textures[bind.m_idx]; - texture.commit(ii, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + texture.commit(ii, bind.m_samplerFlags, _render->m_colorPalette); } break; case Binding::Image: { - const TextureGL& texture = m_textures[bind.m_idx]; - GL_CHECK(glBindImageTexture(ii - , texture.m_id - , bind.m_un.m_compute.m_mip - , texture.isCubeMap() ? GL_TRUE : GL_FALSE - , 0 - , s_access[bind.m_un.m_compute.m_access] - , s_imageFormat[bind.m_un.m_compute.m_format]) - ); - barrier |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; + if (Access::Read == bind.m_access) + { + TextureGL& texture = m_textures[bind.m_idx]; + texture.commit(ii, uint32_t(texture.m_flags), _render->m_colorPalette); + } + else + { + const TextureGL& texture = m_textures[bind.m_idx]; + GL_CHECK(glBindImageTexture(ii + , texture.m_id + , bind.m_mip + , texture.isCubeMap() ? GL_TRUE : GL_FALSE + , 0 + , s_access[bind.m_access] + , s_imageFormat[bind.m_format]) + ); + barrier |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; + } } break; @@ -6893,25 +6678,43 @@ namespace bgfx { namespace gl const RenderDraw& draw = renderItem.draw; const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); - if (isValid(draw.m_occlusionQuery) - && !hasOcclusionQuery - && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) ) { - continue; + const bool occluded = true + && isValid(draw.m_occlusionQuery) + && !hasOcclusionQuery + && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) + ; + + if (occluded + || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) + { + if (resetState) + { + currentState.clear(); + currentState.m_scissor = !draw.m_scissor; + currentBind.clear(); + } + + continue; + } } const uint64_t newFlags = draw.m_stateFlags; uint64_t changedFlags = currentState.m_stateFlags ^ draw.m_stateFlags; + currentState.m_stateFlags = newFlags; const uint64_t newStencil = draw.m_stencil; uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil; + currentState.m_stencil = newStencil; if (resetState) { currentState.clear(); currentState.m_scissor = !draw.m_scissor; - changedFlags = BGFX_STATE_MASK; + changedFlags = BGFX_STATE_MASK; changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK); + currentState.m_stateFlags = newFlags; + currentState.m_stencil = newStencil; currentBind.clear(); } @@ -6941,10 +6744,6 @@ namespace bgfx { namespace gl { Rect scissorRect; scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); - if (scissorRect.isZeroArea() ) - { - continue; - } GL_CHECK(glEnable(GL_SCISSOR_TEST) ); GL_CHECK(glScissor(scissorRect.m_x @@ -6955,9 +6754,6 @@ namespace bgfx { namespace gl } } - currentState.m_stateFlags = newFlags; - currentState.m_stencil = newStencil; - if (0 != changedStencil) { if (0 != newStencil) @@ -7005,10 +6801,10 @@ namespace bgfx { namespace gl if ( (0 | BGFX_STATE_CULL_MASK - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_MASK - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_BLEND_MASK | BGFX_STATE_BLEND_EQUATION_MASK | BGFX_STATE_ALPHA_REF_MASK @@ -7021,12 +6817,12 @@ namespace bgfx { namespace gl { if (BGFX_STATE_CULL_MASK & changedFlags) { - if (BGFX_STATE_CULL_CW & newFlags) + if (BGFX_STATE_CULL_CCW & newFlags) { GL_CHECK(glEnable(GL_CULL_FACE) ); GL_CHECK(glCullFace(GL_BACK) ); } - else if (BGFX_STATE_CULL_CCW & newFlags) + else if (BGFX_STATE_CULL_CW & newFlags) { GL_CHECK(glEnable(GL_CULL_FACE) ); GL_CHECK(glCullFace(GL_FRONT) ); @@ -7037,9 +6833,9 @@ namespace bgfx { namespace gl } } - if (BGFX_STATE_DEPTH_WRITE & changedFlags) + if (BGFX_STATE_WRITE_Z & changedFlags) { - GL_CHECK(glDepthMask(!!(BGFX_STATE_DEPTH_WRITE & newFlags) ) ); + GL_CHECK(glDepthMask(!!(BGFX_STATE_WRITE_Z & newFlags) ) ); } if (BGFX_STATE_DEPTH_TEST_MASK & changedFlags) @@ -7053,7 +6849,7 @@ namespace bgfx { namespace gl } else { - if (BGFX_STATE_DEPTH_WRITE & newFlags) + if (BGFX_STATE_WRITE_Z & newFlags) { GL_CHECK(glEnable(GL_DEPTH_TEST) ); GL_CHECK(glDepthFunc(GL_ALWAYS) ); @@ -7105,11 +6901,13 @@ namespace bgfx { namespace gl } } - if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags) + if ( (BGFX_STATE_WRITE_A|BGFX_STATE_WRITE_RGB) & changedFlags) { - GLboolean alpha = !!(newFlags&BGFX_STATE_ALPHA_WRITE); - GLboolean rgb = !!(newFlags&BGFX_STATE_RGB_WRITE); - GL_CHECK(glColorMask(rgb, rgb, rgb, alpha) ); + const GLboolean rr = !!(newFlags&BGFX_STATE_WRITE_R); + const GLboolean gg = !!(newFlags&BGFX_STATE_WRITE_G); + const GLboolean bb = !!(newFlags&BGFX_STATE_WRITE_B); + const GLboolean aa = !!(newFlags&BGFX_STATE_WRITE_A); + GL_CHECK(glColorMask(rr, gg, bb, aa) ); } if ( ( (0 @@ -7274,9 +7072,9 @@ namespace bgfx { namespace gl { const Binding& bind = renderBind.m_bind[stage]; Binding& current = currentBind.m_bind[stage]; - if (current.m_idx != bind.m_idx - || current.m_type != bind.m_type - || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags + if (current.m_idx != bind.m_idx + || current.m_type != bind.m_type + || current.m_samplerFlags != bind.m_samplerFlags || programChanged) { if (kInvalidHandle != bind.m_idx) @@ -7286,7 +7084,7 @@ namespace bgfx { namespace gl case Binding::Texture: { TextureGL& texture = m_textures[bind.m_idx]; - texture.commit(stage, bind.m_un.m_draw.m_textureFlags, _render->m_colorPalette); + texture.commit(stage, bind.m_samplerFlags, _render->m_colorPalette); } break; @@ -7390,22 +7188,35 @@ namespace bgfx { namespace gl if (bindAttribs || diffStartVertex) { - program.bindAttributesBegin(); - for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) - ; 0 != streamMask - ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) - ) + if(kInvalidHandle != boundProgramIdx) { - streamMask >>= ntz; - idx += ntz; - - currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; - - const VertexBufferGL& vb = m_vertexBuffers[draw.m_stream[idx].m_handle.idx]; - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; - GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); - program.bindAttributes(m_vertexDecls[decl], draw.m_stream[idx].m_startVertex); + ProgramGL& boundProgram = m_program[boundProgramIdx]; + boundProgram.unbindAttributes(); } + + boundProgramIdx = programIdx; + + program.bindAttributesBegin(); + + if (UINT8_MAX != draw.m_streamMask) + { + for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask) + ) + { + streamMask >>= ntz; + idx += ntz; + + currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; + + const VertexBufferGL& vb = m_vertexBuffers[draw.m_stream[idx].m_handle.idx]; + uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; + GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); + program.bindAttributes(m_vertexDecls[decl], draw.m_stream[idx].m_startVertex); + } + } + program.bindAttributesEnd(); if (isValid(draw.m_instanceDataBuffer) ) @@ -7560,6 +7371,11 @@ namespace bgfx { namespace gl m_occlusionQuery.end(); } + if(isValid(draw.m_instanceDataBuffer)) + { + program.unbindInstanceData(); + } + statsNumPrimsSubmitted[primIndex] += numPrimsSubmitted; statsNumPrimsRendered[primIndex] += numPrimsRendered; statsNumInstances[primIndex] += numInstances; @@ -7568,6 +7384,12 @@ namespace bgfx { namespace gl } } + if(kInvalidHandle != boundProgramIdx) + { + ProgramGL& boundProgram = m_program[boundProgramIdx]; + boundProgram.unbindAttributes(); + } + submitBlit(bs, BGFX_CONFIG_MAX_VIEWS); blitMsaaFbo(); @@ -7579,7 +7401,7 @@ namespace bgfx { namespace gl if (0 < _render->m_numRenderItems) { - if (0 != (m_resolution.m_flags & BGFX_RESET_FLUSH_AFTER_RENDER) ) + if (0 != (m_resolution.reset & BGFX_RESET_FLUSH_AFTER_RENDER) ) { GL_CHECK(glFlush() ); } @@ -7629,7 +7451,9 @@ namespace bgfx { namespace gl perfStats.gpuTimerFreq = 1000000000; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; + perfStats.numBlit = _render->m_numBlitItems; perfStats.maxGpuLatency = maxGpuLatency; + bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); perfStats.gpuMemoryMax = -INT64_MAX; perfStats.gpuMemoryUsed = -INT64_MAX; @@ -7648,7 +7472,8 @@ namespace bgfx { namespace gl tvm.clear(); uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f, " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " + tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f + , " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " , getRendererName() ); tvm.printf(0, pos++, 0x8f, " Vendor: %s ", m_vendor); @@ -7661,27 +7486,23 @@ namespace bgfx { namespace gl tvm.printf(0, pos++, 0x8f, " Memory: %s (process) ", processMemoryUsed); pos = 10; - tvm.printf(10, pos++, 0x8e, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " + tvm.printf(10, pos++, 0x8b, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " , double(frameTime)*toMs , double(min)*toMs , double(max)*toMs , freq/frameTime ); - char hmd[16]; - bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' '); - - const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy " - , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' + const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; + tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " + , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<m_numRenderItems , statsKeyType[0] , statsKeyType[1] @@ -7695,8 +7516,8 @@ namespace bgfx { namespace gl for (uint32_t ii = 0; ii < BX_COUNTOF(s_primInfo); ++ii) { - tvm.printf(10, pos++, 0x8e, " %10s: %7d (#inst: %5d), submitted: %7d " - , s_primName[ii] + tvm.printf(10, pos++, 0x8b, " %10s: %7d (#inst: %5d), submitted: %7d " + , getName(Topology::Enum(ii) ) , statsNumPrimsRendered[ii] , statsNumInstances[ii] , statsNumPrimsSubmitted[ii] @@ -7705,18 +7526,18 @@ namespace bgfx { namespace gl if (NULL != m_renderdocdll) { - tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] "); + tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] "); } - tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); + tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); +// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); + tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); + tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); pos++; - tvm.printf(10, pos++, 0x8e, " State cache: "); - tvm.printf(10, pos++, 0x8e, " Sampler "); - tvm.printf(10, pos++, 0x8e, " %6d " + tvm.printf(10, pos++, 0x8b, " State cache: "); + tvm.printf(10, pos++, 0x8b, " Sampler "); + tvm.printf(10, pos++, 0x8b, " %6d " , m_samplerStateCache.getCount() ); @@ -7744,19 +7565,19 @@ namespace bgfx { namespace gl bx::prettify(tmp1, BX_COUNTOF(tmp1), vboFree[1]); bx::prettify(tmp2, BX_COUNTOF(tmp2), vboFree[2]); bx::prettify(tmp3, BX_COUNTOF(tmp3), vboFree[3]); - tvm.printf(10, pos++, 0x8e, " VBO: %10s, %10s, %10s, %10s ", tmp0, tmp1, tmp2, tmp3); + tvm.printf(10, pos++, 0x8b, " VBO: %10s, %10s, %10s, %10s ", tmp0, tmp1, tmp2, tmp3); bx::prettify(tmp0, BX_COUNTOF(tmp0), texFree[0]); bx::prettify(tmp1, BX_COUNTOF(tmp1), texFree[1]); bx::prettify(tmp2, BX_COUNTOF(tmp2), texFree[2]); bx::prettify(tmp3, BX_COUNTOF(tmp3), texFree[3]); - tvm.printf(10, pos++, 0x8e, " Texture: %10s, %10s, %10s, %10s ", tmp0, tmp1, tmp2, tmp3); + tvm.printf(10, pos++, 0x8b, " Texture: %10s, %10s, %10s, %10s ", tmp0, tmp1, tmp2, tmp3); bx::prettify(tmp0, BX_COUNTOF(tmp0), rbfFree[0]); bx::prettify(tmp1, BX_COUNTOF(tmp1), rbfFree[1]); bx::prettify(tmp2, BX_COUNTOF(tmp2), rbfFree[2]); bx::prettify(tmp3, BX_COUNTOF(tmp3), rbfFree[3]); - tvm.printf(10, pos++, 0x8e, " Render Buffer: %10s, %10s, %10s, %10s ", tmp0, tmp1, tmp2, tmp3); + tvm.printf(10, pos++, 0x8b, " Render Buffer: %10s, %10s, %10s, %10s ", tmp0, tmp1, tmp2, tmp3); } else if (s_extension[Extension::NVX_gpu_memory_info].m_supported) { @@ -7780,23 +7601,23 @@ namespace bgfx { namespace gl char tmp1[16]; bx::prettify(tmp0, BX_COUNTOF(tmp0), dedicated); - tvm.printf(10, pos++, 0x8e, " Dedicated: %10s ", tmp0); + tvm.printf(10, pos++, 0x8b, " Dedicated: %10s ", tmp0); bx::prettify(tmp0, BX_COUNTOF(tmp0), currAvail); bx::prettify(tmp1, BX_COUNTOF(tmp1), totalAvail); - tvm.printf(10, pos++, 0x8e, " Available: %10s / %10s ", tmp0, tmp1); + tvm.printf(10, pos++, 0x8b, " Available: %10s / %10s ", tmp0, tmp1); bx::prettify(tmp0, BX_COUNTOF(tmp0), evictedCount); bx::prettify(tmp1, BX_COUNTOF(tmp1), evictedMemory); - tvm.printf(10, pos++, 0x8e, " Eviction: %10s / %10s ", tmp0, tmp1); + tvm.printf(10, pos++, 0x8b, " Eviction: %10s / %10s ", tmp0, tmp1); } #endif // BGFX_CONFIG_RENDERER_OPENGL pos++; double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8e, " Capture: %7.4f [ms] ", captureMs); + tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms] ", captureMs); - uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attr[2] = { 0x8c, 0x8a }; uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %7.4f [ms] ", double(_render->m_waitSubmit)*toMs); tvm.printf(10, pos++, attr[(attrIndex+1)&1], " Render wait: %7.4f [ms] ", double(_render->m_waitRender)*toMs); @@ -7811,8 +7632,6 @@ namespace bgfx { namespace gl { blit(this, _textVideoMemBlitter, _render->m_textVideoMem); } - - GL_CHECK(glFrameTerminatorGREMEDY() ); } } } // namespace bgfx @@ -7820,8 +7639,9 @@ namespace bgfx { namespace gl namespace bgfx { namespace gl { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_gl.h b/3rdparty/bgfx/src/renderer_gl.h index 0e890a245ba..bccee98fe48 100644 --- a/3rdparty/bgfx/src/renderer_gl.h +++ b/3rdparty/bgfx/src/renderer_gl.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -12,7 +12,6 @@ || BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_LINUX \ || BX_PLATFORM_NX \ - || BX_PLATFORM_QNX \ || BX_PLATFORM_RPI \ || BX_PLATFORM_STEAMLINK \ || BX_PLATFORM_WINDOWS \ @@ -114,8 +113,6 @@ typedef uint64_t GLuint64; #endif // BGFX_CONFIG_RENDERER_OPENGL #include "renderer.h" -#include "hmd.h" -#include "hmd_openvr.h" #include "debug_renderdoc.h" #ifndef GL_LUMINANCE @@ -458,6 +455,66 @@ typedef uint64_t GLuint64; # define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 #endif // GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT +#ifndef ATC_RGB_AMD + #define GL_ATC_RGB_AMD 0x8C92 +#endif + +#ifndef GL_ATC_RGBA_EXPLICIT_ALPHA_AMD +# define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#endif + +#ifndef ATC_RGBA_INTERPOLATED_ALPHA_AMD +# define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +#ifndef GL_COMPRESSED_RGBA_ASTC_4x4_KHR +# define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#endif + +#ifndef GL_COMPRESSED_RGBA_ASTC_5x5_KHR +# define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#endif + +#ifndef GL_COMPRESSED_RGBA_ASTC_6x6_KHR +# define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#endif + +#ifndef GL_COMPRESSED_RGBA_ASTC_8x5_KHR +# define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#endif + +#ifndef GL_COMPRESSED_RGBA_ASTC_8x6_KHR +# define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#endif + +#ifndef GL_COMPRESSED_RGBA_ASTC_10x5_KHR +# define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#endif + +#ifndef GL_COMPRESSED_SRGB8_ASTC_4x4_KHR +# define GL_COMPRESSED_SRGB8_ASTC_4x4_KHR 0x93D0 +#endif + +#ifndef GL_COMPRESSED_SRGB8_ASTC_5x5_KHR +# define GL_COMPRESSED_SRGB8_ASTC_5x5_KHR 0x93D2 +#endif + +#ifndef GL_COMPRESSED_SRGB8_ASTC_6x6_KHR +# define GL_COMPRESSED_SRGB8_ASTC_6x6_KHR 0x93D4 +#endif + +#ifndef GL_COMPRESSED_SRGB8_ASTC_8x5_KHR +# define GL_COMPRESSED_SRGB8_ASTC_8x5_KHR 0x93D5 +#endif + +#ifndef GL_COMPRESSED_SRGB8_ASTC_8x6_KHR +# define GL_COMPRESSED_SRGB8_ASTC_8x6_KHR 0x93D6 +#endif + +#ifndef GL_COMPRESSED_SRGB8_ASTC_10x5_KHR +# define GL_COMPRESSED_SRGB8_ASTC_10x5_KHR 0x93D8 +#endif + #ifndef GL_COMPRESSED_RGBA_BPTC_UNORM_ARB # define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C #endif // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB @@ -526,6 +583,10 @@ typedef uint64_t GLuint64; # define GL_MAX_DRAW_BUFFERS 0x8824 #endif // GL_MAX_DRAW_BUFFERS +#ifndef GL_MAX_ARRAY_TEXTURE_LAYERS +# define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#endif // GL_MAX_ARRAY_TEXTURE_LAYERS + #ifndef GL_QUERY_RESULT # define GL_QUERY_RESULT 0x8866 #endif // GL_QUERY_RESULT @@ -1177,14 +1238,14 @@ namespace bgfx { namespace gl { } - bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint32_t _flags); - void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); + bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, uint64_t _flags); + void create(const Memory* _mem, uint64_t _flags, uint8_t _skip); void destroy(); void overrideInternal(uintptr_t _ptr); void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); void setSamplerState(uint32_t _flags, const float _rgba[4]); void commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]); - void resolve() const; + void resolve(uint8_t _resolve) const; bool isCubeMap() const { @@ -1199,7 +1260,7 @@ namespace bgfx { namespace gl GLenum m_target; GLenum m_fmt; GLenum m_type; - uint32_t m_flags; + uint64_t m_flags; uint32_t m_currentSamplerHash; uint32_t m_width; uint32_t m_height; @@ -1218,7 +1279,7 @@ namespace bgfx { namespace gl { } - void create(Memory* _mem); + void create(const Memory* _mem); void destroy(); GLuint m_id; @@ -1238,7 +1299,7 @@ namespace bgfx { namespace gl } void create(uint8_t _num, const Attachment* _attachment); - void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); + void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat); void postReset(); uint16_t destroy(); void resolve(); @@ -1268,6 +1329,7 @@ namespace bgfx { namespace gl void destroy(); void init(); void bindInstanceData(uint32_t _stride, uint32_t _baseVertex = 0) const; + void unbindInstanceData() const; void bindAttributesBegin() { @@ -1289,6 +1351,8 @@ namespace bgfx { namespace gl } } + void unbindAttributes(); + GLuint m_id; uint8_t m_unboundUsedAttrib[Attrib::Count]; // For tracking unbound used attributes between begin()/end(). @@ -1480,6 +1544,13 @@ namespace bgfx { namespace gl { } + LineReader(const bx::StringView& _str) + : m_str(_str.getPtr() ) + , m_pos(0) + , m_size(_str.getLength() ) + { + } + virtual int32_t read(void* _data, int32_t _size, bx::Error* _err) override { if (m_str[m_pos] == '\0' @@ -1491,7 +1562,7 @@ namespace bgfx { namespace gl uint32_t pos = m_pos; const char* str = &m_str[pos]; - const char* nl = bx::strnl(str); + const char* nl = bx::strFindNl(str).getPtr(); pos += (uint32_t)(nl - str); const char* eol = &m_str[pos]; diff --git a/3rdparty/bgfx/src/renderer_gnm.cpp b/3rdparty/bgfx/src/renderer_gnm.cpp index 5d7b10715bb..cb34386bc56 100644 --- a/3rdparty/bgfx/src/renderer_gnm.cpp +++ b/3rdparty/bgfx/src/renderer_gnm.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -33,8 +33,9 @@ BGFX_DECLARE_EMBEDDED_SHADER(fs_clear7); namespace bgfx { namespace gnm { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h index 805fa1eaff7..95e038405dc 100644 --- a/3rdparty/bgfx/src/renderer_mtl.h +++ b/3rdparty/bgfx/src/renderer_mtl.h @@ -31,9 +31,11 @@ namespace bgfx { namespace mtl #endif } - inline bool macOSVersionEqualOrGreater(NSInteger _majorVersion, - NSInteger _minorVersion, - NSInteger _patchVersion) + inline bool macOSVersionEqualOrGreater( + NSInteger _majorVersion + , NSInteger _minorVersion + , NSInteger _patchVersion + ) { #if BX_PLATFORM_OSX NSOperatingSystemVersion v = [[NSProcessInfo processInfo] operatingSystemVersion]; @@ -52,11 +54,11 @@ namespace bgfx { namespace mtl #define MTL_MAX_FRAMES_IN_FLIGHT (3) -#define MTL_CLASS(name) \ - class name \ - { \ - public: \ - name(id _obj = nil) : m_obj(_obj) {} \ +#define MTL_CLASS(name) \ + class name \ + { \ + public: \ + name(id _obj = nil) : m_obj(_obj) {} \ operator id () const { return m_obj; } \ id m_obj; @@ -65,23 +67,45 @@ namespace bgfx { namespace mtl typedef void (*mtlCallback)(void* userData); MTL_CLASS(BlitCommandEncoder) - void copyFromTexture(id _sourceTexture, NSUInteger _sourceSlice, NSUInteger _sourceLevel, MTLOrigin _sourceOrigin, MTLSize _sourceSize, - id _destinationTexture, NSUInteger _destinationSlice, NSUInteger _destinationLevel, MTLOrigin _destinationOrigin) + void copyFromTexture( + id _sourceTexture + , NSUInteger _sourceSlice + , NSUInteger _sourceLevel + , MTLOrigin _sourceOrigin + , MTLSize _sourceSize + , id _destinationTexture + , NSUInteger _destinationSlice + , NSUInteger _destinationLevel + , MTLOrigin _destinationOrigin + ) { [m_obj copyFromTexture:_sourceTexture sourceSlice:_sourceSlice sourceLevel:_sourceLevel sourceOrigin:_sourceOrigin sourceSize:_sourceSize toTexture:_destinationTexture destinationSlice:_destinationSlice destinationLevel:_destinationLevel destinationOrigin:_destinationOrigin]; } - void copyFromBuffer(id _sourceBuffer, NSUInteger _sourceOffset, id _destinationBuffer, - NSUInteger _destinationOffset, NSUInteger _size) + void copyFromBuffer( + id _sourceBuffer + , NSUInteger _sourceOffset + , id _destinationBuffer + , NSUInteger _destinationOffset + , NSUInteger _size + ) { [m_obj copyFromBuffer:_sourceBuffer sourceOffset:_sourceOffset toBuffer:_destinationBuffer destinationOffset:_destinationOffset size:_size]; } - void copyFromBuffer(id _sourceBuffer, NSUInteger _sourceOffset, NSUInteger _sourceBytesPerRow, - NSUInteger _sourceBytesPerImage, MTLSize _sourceSize, id _destinationTexture, - NSUInteger _destinationSlice, NSUInteger _destinationLevel, MTLOrigin _destinationOrigin) + void copyFromBuffer( + id _sourceBuffer + , NSUInteger _sourceOffset + , NSUInteger _sourceBytesPerRow + , NSUInteger _sourceBytesPerImage + , MTLSize _sourceSize + , id _destinationTexture + , NSUInteger _destinationSlice + , NSUInteger _destinationLevel + , MTLOrigin _destinationOrigin + ) { [m_obj copyFromBuffer:_sourceBuffer sourceOffset:_sourceOffset sourceBytesPerRow:_sourceBytesPerRow sourceBytesPerImage:_sourceBytesPerImage sourceSize:_sourceSize toTexture:_destinationTexture @@ -120,7 +144,7 @@ namespace bgfx { namespace mtl MTL_CLASS(CommandBuffer) // Creating Command Encoders - id renderCommandEncoderWithDescriptor( MTLRenderPassDescriptor* _renderPassDescriptor){ + id renderCommandEncoderWithDescriptor(MTLRenderPassDescriptor* _renderPassDescriptor){ return [m_obj renderCommandEncoderWithDescriptor:_renderPassDescriptor]; } @@ -281,7 +305,11 @@ namespace bgfx { namespace mtl return state; } - id newRenderPipelineStateWithDescriptor(MTLRenderPipelineDescriptor* _descriptor, MTLPipelineOption _options, MTLRenderPipelineReflection** _reflection) + id newRenderPipelineStateWithDescriptor( + MTLRenderPipelineDescriptor* _descriptor + , MTLPipelineOption _options + , MTLRenderPipelineReflection** _reflection + ) { NSError* error; id state = [m_obj newRenderPipelineStateWithDescriptor:_descriptor options:_options reflection:_reflection error:&error]; @@ -325,7 +353,10 @@ namespace bgfx { namespace mtl MTL_CLASS_END MTL_CLASS(Function) - NSArray* vertexAttributes() { return m_obj.vertexAttributes; } + NSArray* vertexAttributes() + { + return m_obj.vertexAttributes; + } void setLabel(const char* _label) { @@ -337,7 +368,10 @@ namespace bgfx { namespace mtl MTL_CLASS_END MTL_CLASS(Library) - id newFunctionWithName(const char* _functionName) { return [m_obj newFunctionWithName:@(_functionName)]; } + id newFunctionWithName(const char* _functionName) + { + return [m_obj newFunctionWithName:@(_functionName)]; + } MTL_CLASS_END MTL_CLASS(RenderCommandEncoder) @@ -431,12 +465,24 @@ namespace bgfx { namespace mtl //Drawing Geometric Primitives //NOTE: not exposing functions without instanceCount, it seems they are just wrappers - void drawIndexedPrimitives(MTLPrimitiveType _primitiveType, NSUInteger _indexCount, MTLIndexType _indexType, id _indexBuffer, NSUInteger _indexBufferOffset, NSUInteger _instanceCount) + void drawIndexedPrimitives( + MTLPrimitiveType _primitiveType + , NSUInteger _indexCount + , MTLIndexType _indexType + , id _indexBuffer + , NSUInteger _indexBufferOffset + , NSUInteger _instanceCount + ) { [m_obj drawIndexedPrimitives:_primitiveType indexCount:_indexCount indexType:_indexType indexBuffer:_indexBuffer indexBufferOffset:_indexBufferOffset instanceCount:_instanceCount]; } - void drawPrimitives(MTLPrimitiveType _primitiveType, NSUInteger _vertexStart, NSUInteger _vertexCount, NSUInteger _instanceCount) + void drawPrimitives( + MTLPrimitiveType _primitiveType + , NSUInteger _vertexStart + , NSUInteger _vertexCount + , NSUInteger _instanceCount + ) { [m_obj drawPrimitives:_primitiveType vertexStart:_vertexStart vertexCount:_vertexCount instanceCount:_instanceCount]; } @@ -603,10 +649,10 @@ namespace bgfx { namespace mtl return [_str UTF8String]; } -#define MTL_RELEASE(_obj) \ +#define MTL_RELEASE(_obj) \ BX_MACRO_BLOCK_BEGIN \ - [_obj release]; \ - _obj = nil; \ + [_obj release]; \ + _obj = nil; \ BX_MACRO_BLOCK_END // end of c++ wrapper @@ -670,7 +716,9 @@ namespace bgfx { namespace mtl , m_bufferIndex(0) { for (uint32_t ii = 0; ii < MTL_MAX_FRAMES_IN_FLIGHT; ++ii) + { m_buffers[ii] = NULL; + } } void create(uint32_t _size, void* _data, uint16_t _flags, uint16_t _stride = 0, bool _vertex = false); @@ -682,6 +730,7 @@ namespace bgfx { namespace mtl { MTL_RELEASE(m_buffers[ii]); } + m_dynamic = false; } @@ -726,6 +775,7 @@ namespace bgfx { namespace mtl } Function m_function; + uint32_t m_hash; }; struct ProgramMtl @@ -748,10 +798,6 @@ namespace bgfx { namespace mtl void create(const ShaderMtl* _vsh, const ShaderMtl* _fsh); void destroy(); - RenderPipelineState getRenderPipelineState(uint64_t _state, uint32_t _rgba, FrameBufferHandle _fbHandle, VertexDeclHandle _declHandle, uint16_t _numInstanceData); - - StateCacheT m_renderPipelineStateCache; - uint8_t m_used[Attrib::Count+1]; // dense uint32_t m_attributes[Attrib::Count]; // sparse uint32_t m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT+1]; @@ -772,6 +818,7 @@ namespace bgfx { namespace mtl bgfx::UniformHandle m_uniform; bool m_fragment; }; + SamplerInfo m_samplers[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS]; uint32_t m_samplerCount; @@ -791,7 +838,7 @@ namespace bgfx { namespace mtl TextureMtl() : m_ptr(NULL) - , m_ptrMSAA(NULL) + , m_ptrMsaa(NULL) , m_ptrStencil(NULL) , m_sampler(NULL) , m_flags(0) @@ -802,20 +849,36 @@ namespace bgfx { namespace mtl { } - void create(const Memory* _mem, uint32_t _flags, uint8_t _skip); + void create(const Memory* _mem, uint64_t _flags, uint8_t _skip); + void destroy() { MTL_RELEASE(m_ptr); MTL_RELEASE(m_ptrStencil); } - void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); - void commit(uint8_t _stage, bool _vertex, bool _fragment, uint32_t _flags = BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER); + + void update( + uint8_t _side + , uint8_t _mip + , const Rect& _rect + , uint16_t _z + , uint16_t _depth + , uint16_t _pitch + , const Memory* _mem + ); + + void commit( + uint8_t _stage + , bool _vertex + , bool _fragment + , uint32_t _flags = BGFX_SAMPLER_INTERNAL_DEFAULT + ); Texture m_ptr; - Texture m_ptrMSAA; + Texture m_ptrMsaa; Texture m_ptrStencil; // for emulating packed depth/stencil formats - only for iOS8... SamplerState m_sampler; - uint32_t m_flags; + uint64_t m_flags; uint32_t m_width; uint32_t m_height; uint32_t m_depth; @@ -825,6 +888,35 @@ namespace bgfx { namespace mtl uint8_t m_numMips; }; + struct FrameBufferMtl; + + struct SwapChainMtl + { + SwapChainMtl() + : m_metalLayer(nil) + , m_drawable(nil) + , m_backBufferColorMsaa() + , m_backBufferDepth() + , m_backBufferStencil() + , m_maxAnisotropy(0) + { + } + + ~SwapChainMtl(); + + void init(void* _nwh); + void resize(FrameBufferMtl &_frameBuffer, uint32_t _width, uint32_t _height, uint32_t _flags); + + id currentDrawable(); + + CAMetalLayer* m_metalLayer; + id m_drawable; + Texture m_backBufferColorMsaa; + Texture m_backBufferDepth; + Texture m_backBufferStencil; + uint32_t m_maxAnisotropy; + }; + struct FrameBufferMtl { FrameBufferMtl() @@ -836,11 +928,18 @@ namespace bgfx { namespace mtl } void create(uint8_t _num, const Attachment* _attachment); - void create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat); + void create( + uint16_t _denseIdx + , void* _nwh + , uint32_t _width + , uint32_t _height + , TextureFormat::Enum _format + , TextureFormat::Enum _depthFormat + ); void postReset(); uint16_t destroy(); -// SwapChainMtl* m_swapChain; + SwapChainMtl* m_swapChain; uint32_t m_width; uint32_t m_height; uint16_t m_denseIdx; @@ -854,7 +953,9 @@ namespace bgfx { namespace mtl struct CommandQueueMtl { - CommandQueueMtl() : m_releaseWriteIndex(0), m_releaseReadIndex(0) + CommandQueueMtl() + : m_releaseWriteIndex(0) + , m_releaseReadIndex(0) { } @@ -880,7 +981,7 @@ namespace bgfx { namespace mtl struct TimerQueryMtl { TimerQueryMtl() - : m_control(4) + : m_control(4) { } diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index 1b1251dbad9..d104f7130d6 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -18,44 +18,6 @@ #define UNIFORM_BUFFER_SIZE (8*1024*1024) -/* - // known metal shader generation issues: - 03-raymarch: OSX10.11.3 nothing is visible ( depth/color swap in fragment output struct fixed this ) - 24-nbody: no generated compute shaders for metal - -Known issues(driver problems??): - OSX mac mini(late 2014), OSX10.11.3 : nanovg-rendering: color writemask off causes problem... - 03-raymarch: OSX nothing is visible ( depth/color order should be swapped in fragment output struct) - works fine with newer OSX - iPad mini 2, iOS 8.1.1: 21-deferred: scissor not working properly - 26-occlusion: query doesn't work with two rendercommandencoders - Only on this device ( no problem on iPad Air 2 with iOS9.3.1) - - TODOs: - - support multiple vertex buffers: 34-mvs - - - framebufferMtl and TextureMtl resolve - - - FrameBufferMtl::postReset recreate framebuffer??? - - renderpass load/resolve - - capture with msaa: 07-callback - - implement fb discard. problematic with multiple views that has same fb... - - msaa color/depth/stencil is not saved. could have problem when we switch back to msaa framebuffer - - refactor store/load actions to support msaa/discard/capture/readback etc... - - - finish savescreenshot with screenshotbegin/end - - - support multiple windows: 22-windows - - multithreading with multiple commandbuffer - - - compute and drawindirect: 24-nbody (needs compute shaders) - - INFO: - - 15-shadowmaps-simple (example needs modification mtxCrop znew = z * 0.5 + 0.5 is not needed ) could be hacked in shader too - - */ - namespace bgfx { namespace mtl { static char s_viewName[BGFX_CONFIG_MAX_VIEWS][BGFX_CONFIG_MAX_VIEW_NAME]; @@ -76,16 +38,7 @@ namespace bgfx { namespace mtl { MTLPrimitiveTypeLineStrip, 2, 1, 1 }, { MTLPrimitiveTypePoint, 1, 1, 0 }, }; - - static const char* s_primName[] = - { - "TriList", - "TriStrip", - "Line", - "LineStrip", - "Point", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName) ); + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo) ); static const char* s_attribName[] = { @@ -254,102 +207,155 @@ namespace bgfx { namespace mtl static TextureFormatInfo s_textureFormat[] = { - { MTLPixelFormat(130) /*BC1_RGBA*/, MTLPixelFormat(131) /*BC1_RGBA_sRGB*/ }, // BC1 - { MTLPixelFormat(132) /*BC2_RGBA*/, MTLPixelFormat(133) /*BC2_RGBA_sRGB*/ }, // BC2 - { MTLPixelFormat(134) /*BC3_RGBA*/, MTLPixelFormat(135) /*BC3_RGBA_sRGB*/ }, // BC3 - { MTLPixelFormat(140) /*BC4_RUnorm*/, MTLPixelFormatInvalid }, // BC4 - { MTLPixelFormat(142) /*BC5_RGUnorm*/, MTLPixelFormatInvalid }, // BC5 - { MTLPixelFormat(150) /*BC6H_RGBFloat*/, MTLPixelFormatInvalid }, // BC6H - { MTLPixelFormat(152) /*BC7_RGBAUnorm*/, MTLPixelFormat(153) /*BC7_RGBAUnorm_sRGB*/ }, // BC7 - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ETC1 - { MTLPixelFormat(180) /*ETC2_RGB8*/, MTLPixelFormat(181) /*ETC2_RGB8_sRGB*/ }, // ETC2 - { MTLPixelFormat(178) /*EAC_RGBA8*/, MTLPixelFormat(179) /*EAC_RGBA8_sRGB*/ }, // ETC2A - { MTLPixelFormat(182) /*ETC2_RGB8A1*/, MTLPixelFormat(183) /*ETC2_RGB8A1_sRGB*/ }, // ETC2A1 - { MTLPixelFormat(160) /*PVRTC_RGB_2BPP*/, MTLPixelFormat(161) /*PVRTC_RGB_2BPP_sRGB*/ }, // PTC12 - { MTLPixelFormat(162) /*PVRTC_RGB_4BPP*/, MTLPixelFormat(163) /*PVRTC_RGB_4BPP_sRGB*/ }, // PTC14 - { MTLPixelFormat(164) /*PVRTC_RGBA_2BPP*/, MTLPixelFormat(165) /*PVRTC_RGBA_2BPP_sRGB*/ }, // PTC12A - { MTLPixelFormat(166) /*PVRTC_RGBA_4BPP*/, MTLPixelFormat(167) /*PVRTC_RGBA_4BPP_sRGB*/ }, // PTC14A - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // PTC22 - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // PTC24 - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // Unknown - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // R1 - { MTLPixelFormatA8Unorm, MTLPixelFormatInvalid }, // A8 - { MTLPixelFormatR8Unorm, MTLPixelFormat(11) /*R8Unorm_sRGB*/ }, // R8 - { MTLPixelFormatR8Sint, MTLPixelFormatInvalid }, // R8I - { MTLPixelFormatR8Uint, MTLPixelFormatInvalid }, // R8U - { MTLPixelFormatR8Snorm, MTLPixelFormatInvalid }, // R8S - { MTLPixelFormatR16Unorm, MTLPixelFormatInvalid }, // R16 - { MTLPixelFormatR16Sint, MTLPixelFormatInvalid }, // R16I - { MTLPixelFormatR16Uint, MTLPixelFormatInvalid }, // R16U - { MTLPixelFormatR16Float, MTLPixelFormatInvalid }, // R16F - { MTLPixelFormatR16Snorm, MTLPixelFormatInvalid }, // R16S - { MTLPixelFormatR32Sint, MTLPixelFormatInvalid }, // R32I - { MTLPixelFormatR32Uint, MTLPixelFormatInvalid }, // R32U - { MTLPixelFormatR32Float, MTLPixelFormatInvalid }, // R32F - { MTLPixelFormatRG8Unorm, MTLPixelFormat(31) /*RG8Unorm_sRGB*/ }, // RG8 - { MTLPixelFormatRG8Sint, MTLPixelFormatInvalid }, // RG8I - { MTLPixelFormatRG8Uint, MTLPixelFormatInvalid }, // RG8U - { MTLPixelFormatRG8Snorm, MTLPixelFormatInvalid }, // RG8S - { MTLPixelFormatRG16Unorm, MTLPixelFormatInvalid }, // RG16 - { MTLPixelFormatRG16Sint, MTLPixelFormatInvalid }, // RG16I - { MTLPixelFormatRG16Uint, MTLPixelFormatInvalid }, // RG16U - { MTLPixelFormatRG16Float, MTLPixelFormatInvalid }, // RG16F - { MTLPixelFormatRG16Snorm, MTLPixelFormatInvalid }, // RG16S - { MTLPixelFormatRG32Sint, MTLPixelFormatInvalid }, // RG32I - { MTLPixelFormatRG32Uint, MTLPixelFormatInvalid }, // RG32U - { MTLPixelFormatRG32Float, MTLPixelFormatInvalid }, // RG32F - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8 - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8I - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8U - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8S - { MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid }, // RGB9E5F - { MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB }, // BGRA8 - { MTLPixelFormatRGBA8Unorm, MTLPixelFormatRGBA8Unorm_sRGB }, // RGBA8 - { MTLPixelFormatRGBA8Sint, MTLPixelFormatInvalid }, // RGBA8I - { MTLPixelFormatRGBA8Uint, MTLPixelFormatInvalid }, // RGBA8U - { MTLPixelFormatRGBA8Snorm, MTLPixelFormatInvalid }, // RGBA8S - { MTLPixelFormatRGBA16Unorm, MTLPixelFormatInvalid }, // RGBA16 - { MTLPixelFormatRGBA16Sint, MTLPixelFormatInvalid }, // RGBA16I - { MTLPixelFormatRGBA16Uint, MTLPixelFormatInvalid }, // RGBA16U - { MTLPixelFormatRGBA16Float, MTLPixelFormatInvalid }, // RGBA16F - { MTLPixelFormatRGBA16Snorm, MTLPixelFormatInvalid }, // RGBA16S - { MTLPixelFormatRGBA32Sint, MTLPixelFormatInvalid }, // RGBA32I - { MTLPixelFormatRGBA32Uint, MTLPixelFormatInvalid }, // RGBA32U - { MTLPixelFormatRGBA32Float, MTLPixelFormatInvalid }, // RGBA32F - { MTLPixelFormat(40) /*B5G6R5Unorm*/, MTLPixelFormatInvalid }, // R5G6B5 - { MTLPixelFormat(42) /*ABGR4Unorm*/, MTLPixelFormatInvalid }, // RGBA4 - { MTLPixelFormat(41) /*A1BGR5Unorm*/, MTLPixelFormatInvalid }, // RGB5A1 - { MTLPixelFormatRGB10A2Unorm, MTLPixelFormatInvalid }, // RGB10A2 - { MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid }, // RG11B10F - { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // UnknownDepth - { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D16 - { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D24 - { MTLPixelFormat(255) /*Depth24Unorm_Stencil8*/,MTLPixelFormatInvalid }, // D24S8 - { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D32 - { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D16F - { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D24F - { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D32F - { MTLPixelFormatStencil8, MTLPixelFormatInvalid }, // D0S8 + { MTLPixelFormat(130/*BC1_RGBA*/), MTLPixelFormat(131/*BC1_RGBA_sRGB*/) }, // BC1 + { MTLPixelFormat(132/*BC2_RGBA*/), MTLPixelFormat(133/*BC2_RGBA_sRGB*/) }, // BC2 + { MTLPixelFormat(134/*BC3_RGBA*/), MTLPixelFormat(135/*BC3_RGBA_sRGB*/) }, // BC3 + { MTLPixelFormat(140/*BC4_RUnorm*/), MTLPixelFormatInvalid }, // BC4 + { MTLPixelFormat(142/*BC5_RGUnorm*/), MTLPixelFormatInvalid }, // BC5 + { MTLPixelFormat(150/*BC6H_RGBFloat*/), MTLPixelFormatInvalid }, // BC6H + { MTLPixelFormat(152/*BC7_RGBAUnorm*/), MTLPixelFormat(153/*BC7_RGBAUnorm_sRGB*/) }, // BC7 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ETC1 + { MTLPixelFormat(180/*ETC2_RGB8*/), MTLPixelFormat(181/*ETC2_RGB8_sRGB*/) }, // ETC2 + { MTLPixelFormat(178/*EAC_RGBA8*/), MTLPixelFormat(179/*EAC_RGBA8_sRGB*/) }, // ETC2A + { MTLPixelFormat(182/*ETC2_RGB8A1*/), MTLPixelFormat(183/*ETC2_RGB8A1_sRGB*/) }, // ETC2A1 + { MTLPixelFormat(160/*PVRTC_RGB_2BPP*/), MTLPixelFormat(161/*PVRTC_RGB_2BPP_sRGB*/) }, // PTC12 + { MTLPixelFormat(162/*PVRTC_RGB_4BPP*/), MTLPixelFormat(163/*PVRTC_RGB_4BPP_sRGB*/) }, // PTC14 + { MTLPixelFormat(164/*PVRTC_RGBA_2BPP*/), MTLPixelFormat(165/*PVRTC_RGBA_2BPP_sRGB*/) }, // PTC12A + { MTLPixelFormat(166/*PVRTC_RGBA_4BPP*/), MTLPixelFormat(167/*PVRTC_RGBA_4BPP_sRGB*/) }, // PTC14A + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // PTC22 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // PTC24 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ATC + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ATCE + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ATCI +#if BX_PLATFORM_IOS + { MTLPixelFormatASTC_4x4_LDR, MTLPixelFormatASTC_4x4_sRGB }, // ASTC4x4 + { MTLPixelFormatASTC_5x5_LDR, MTLPixelFormatASTC_5x5_sRGB }, // ASTC5x5 + { MTLPixelFormatASTC_6x6_LDR, MTLPixelFormatASTC_6x6_sRGB }, // ASTC6x6 + { MTLPixelFormatASTC_8x5_LDR, MTLPixelFormatASTC_8x5_sRGB }, // ASTC8x5 + { MTLPixelFormatASTC_8x6_LDR, MTLPixelFormatASTC_8x6_sRGB }, // ASTC8x6 + { MTLPixelFormatASTC_10x5_LDR, MTLPixelFormatASTC_10x5_sRGB }, // ASTC10x5 +#else + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ASTC4x4 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ASTC5x5 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ASTC6x6 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ASTC8x5 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ASTC8x6 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // ASTC10x5 +#endif + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // Unknown + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // R1 + { MTLPixelFormatA8Unorm, MTLPixelFormatInvalid }, // A8 + { MTLPixelFormatR8Unorm, MTLPixelFormat(11/*R8Unorm_sRGB*/) }, // R8 + { MTLPixelFormatR8Sint, MTLPixelFormatInvalid }, // R8I + { MTLPixelFormatR8Uint, MTLPixelFormatInvalid }, // R8U + { MTLPixelFormatR8Snorm, MTLPixelFormatInvalid }, // R8S + { MTLPixelFormatR16Unorm, MTLPixelFormatInvalid }, // R16 + { MTLPixelFormatR16Sint, MTLPixelFormatInvalid }, // R16I + { MTLPixelFormatR16Uint, MTLPixelFormatInvalid }, // R16U + { MTLPixelFormatR16Float, MTLPixelFormatInvalid }, // R16F + { MTLPixelFormatR16Snorm, MTLPixelFormatInvalid }, // R16S + { MTLPixelFormatR32Sint, MTLPixelFormatInvalid }, // R32I + { MTLPixelFormatR32Uint, MTLPixelFormatInvalid }, // R32U + { MTLPixelFormatR32Float, MTLPixelFormatInvalid }, // R32F + { MTLPixelFormatRG8Unorm, MTLPixelFormat(31/*RG8Unorm_sRGB*/) }, // RG8 + { MTLPixelFormatRG8Sint, MTLPixelFormatInvalid }, // RG8I + { MTLPixelFormatRG8Uint, MTLPixelFormatInvalid }, // RG8U + { MTLPixelFormatRG8Snorm, MTLPixelFormatInvalid }, // RG8S + { MTLPixelFormatRG16Unorm, MTLPixelFormatInvalid }, // RG16 + { MTLPixelFormatRG16Sint, MTLPixelFormatInvalid }, // RG16I + { MTLPixelFormatRG16Uint, MTLPixelFormatInvalid }, // RG16U + { MTLPixelFormatRG16Float, MTLPixelFormatInvalid }, // RG16F + { MTLPixelFormatRG16Snorm, MTLPixelFormatInvalid }, // RG16S + { MTLPixelFormatRG32Sint, MTLPixelFormatInvalid }, // RG32I + { MTLPixelFormatRG32Uint, MTLPixelFormatInvalid }, // RG32U + { MTLPixelFormatRG32Float, MTLPixelFormatInvalid }, // RG32F + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8 + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8I + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8U + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // RGB8S + { MTLPixelFormatRGB9E5Float, MTLPixelFormatInvalid }, // RGB9E5F + { MTLPixelFormatBGRA8Unorm, MTLPixelFormatBGRA8Unorm_sRGB }, // BGRA8 + { MTLPixelFormatRGBA8Unorm, MTLPixelFormatRGBA8Unorm_sRGB }, // RGBA8 + { MTLPixelFormatRGBA8Sint, MTLPixelFormatInvalid }, // RGBA8I + { MTLPixelFormatRGBA8Uint, MTLPixelFormatInvalid }, // RGBA8U + { MTLPixelFormatRGBA8Snorm, MTLPixelFormatInvalid }, // RGBA8S + { MTLPixelFormatRGBA16Unorm, MTLPixelFormatInvalid }, // RGBA16 + { MTLPixelFormatRGBA16Sint, MTLPixelFormatInvalid }, // RGBA16I + { MTLPixelFormatRGBA16Uint, MTLPixelFormatInvalid }, // RGBA16U + { MTLPixelFormatRGBA16Float, MTLPixelFormatInvalid }, // RGBA16F + { MTLPixelFormatRGBA16Snorm, MTLPixelFormatInvalid }, // RGBA16S + { MTLPixelFormatRGBA32Sint, MTLPixelFormatInvalid }, // RGBA32I + { MTLPixelFormatRGBA32Uint, MTLPixelFormatInvalid }, // RGBA32U + { MTLPixelFormatRGBA32Float, MTLPixelFormatInvalid }, // RGBA32F + { MTLPixelFormat(40/*B5G6R5Unorm*/), MTLPixelFormatInvalid }, // R5G6B5 + { MTLPixelFormat(42/*ABGR4Unorm*/), MTLPixelFormatInvalid }, // RGBA4 + { MTLPixelFormat(41/*A1BGR5Unorm*/), MTLPixelFormatInvalid }, // RGB5A1 + { MTLPixelFormatRGB10A2Unorm, MTLPixelFormatInvalid }, // RGB10A2 + { MTLPixelFormatRG11B10Float, MTLPixelFormatInvalid }, // RG11B10F + { MTLPixelFormatInvalid, MTLPixelFormatInvalid }, // UnknownDepth + { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D16 + { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D24 + { MTLPixelFormat(255/*Depth24Unorm_Stencil8*/), MTLPixelFormatInvalid }, // D24S8 + { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D32 + { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D16F + { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D24F + { MTLPixelFormatDepth32Float, MTLPixelFormatInvalid }, // D32F + { MTLPixelFormatStencil8, MTLPixelFormatInvalid }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) ); - int s_msaa[5] = { 1,2,4,8,16 }; + int s_msaa[] = + { + 1, + 2, + 4, + 8, + 16, + }; + + static UniformType::Enum convertMtlType(MTLDataType _type) + { + switch (_type) + { + case MTLDataTypeUInt: + case MTLDataTypeInt: + return UniformType::Int1; + + case MTLDataTypeFloat: + case MTLDataTypeFloat2: + case MTLDataTypeFloat3: + case MTLDataTypeFloat4: + return UniformType::Vec4; + + case MTLDataTypeFloat3x3: + return UniformType::Mat3; + + case MTLDataTypeFloat4x4: + return UniformType::Mat4; + + default: + break; + }; + + BX_CHECK(false, "Unrecognized Mtl Data type 0x%04x.", _type); + return UniformType::End; + } #define SHADER_FUNCTION_NAME ("xlatMtlMain") #define SHADER_UNIFORM_NAME ("_mtl_u") + struct RendererContextMtl; + static RendererContextMtl* s_renderMtl; + + struct RendererContextMtl : public RendererContextI { RendererContextMtl() - : m_metalLayer(NULL) - , m_backBufferPixelFormatHash(0) - , m_maxAnisotropy(1) - , m_bufferIndex(0) - , m_numWindows(1) + : m_bufferIndex(0) + , m_numWindows(0) , m_rtMsaa(false) , m_capture(NULL) , m_captureSize(0) - , m_drawable(NULL) , m_saveScreenshot(false) { } @@ -358,74 +364,30 @@ namespace bgfx { namespace mtl { } - bool init() + bool init(const Init& _init) { + BX_UNUSED(_init); BX_TRACE("Init."); m_fbh.idx = kInvalidHandle; bx::memSet(m_uniforms, 0, sizeof(m_uniforms) ); bx::memSet(&m_resolution, 0, sizeof(m_resolution) ); - if (NULL != NSClassFromString(@"MTKView") ) + m_device = (id)g_platformData.context; + + if (NULL == m_device) { - MTKView *view = (MTKView *)g_platformData.nwh; - if (NULL != view && [view isKindOfClass:NSClassFromString(@"MTKView")]) - { - m_metalLayer = (CAMetalLayer *)view.layer; - } + m_device = MTLCreateSystemDefaultDevice(); } - if (NULL != NSClassFromString(@"CAMetalLayer") ) - { - if (NULL == m_metalLayer) -#if BX_PLATFORM_IOS - { - CAMetalLayer* metalLayer = (CAMetalLayer*)g_platformData.nwh; - if (NULL == metalLayer - || ![metalLayer isKindOfClass:NSClassFromString(@"CAMetalLayer")]) - { - BX_WARN(NULL != m_device, "Unable to create Metal device. Please set platform data window to a CAMetalLayer"); - return false; - } - - m_metalLayer = metalLayer; - } -#elif BX_PLATFORM_OSX - { - NSObject* nvh = (NSObject*)g_platformData.nwh; - if ([nvh isKindOfClass:[CAMetalLayer class]]) - { - CAMetalLayer* metalLayer = (CAMetalLayer*)g_platformData.nwh; - m_metalLayer = metalLayer; - } - else - { - NSWindow* nsWindow = (NSWindow*)g_platformData.nwh; - [nsWindow.contentView setWantsLayer:YES]; - m_metalLayer = [CAMetalLayer layer]; - [nsWindow.contentView setLayer:m_metalLayer]; - } - } -#endif // BX_PLATFORM_* - - m_device = (id)g_platformData.context; - - if (NULL == m_device) - { - m_device = MTLCreateSystemDefaultDevice(); - } - } - - if (NULL == m_device - || NULL == m_metalLayer) + if (NULL == m_device) { BX_WARN(NULL != m_device, "Unable to create Metal device."); return false; } retain(m_device); - m_metalLayer.device = m_device; - m_metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; + createFrameBuffer(m_fbh, g_platformData.nwh, 0, 0, TextureFormat::Unknown, TextureFormat::UnknownDepth); m_cmd.init(m_device); BGFX_FATAL(NULL != m_cmd.m_commandQueue, Fatal::UnableToInitialize, "Unable to create Metal device."); @@ -438,11 +400,12 @@ namespace bgfx { namespace mtl m_textureDescriptor = newTextureDescriptor(); m_samplerDescriptor = newSamplerDescriptor(); - for (uint8_t i=0; i < MTL_MAX_FRAMES_IN_FLIGHT; ++i) + for (uint8_t ii = 0; ii < MTL_MAX_FRAMES_IN_FLIGHT; ++ii) { - m_uniformBuffers[i] = m_device.newBufferWithLength(UNIFORM_BUFFER_SIZE, 0); + m_uniformBuffers[ii] = m_device.newBufferWithLength(UNIFORM_BUFFER_SIZE, 0); } - m_uniformBufferVertexOffset = 0; + + m_uniformBufferVertexOffset = 0; m_uniformBufferFragmentOffset = 0; const char* vshSource = @@ -483,26 +446,27 @@ namespace bgfx { namespace mtl release(lib); reset(m_renderPipelineDescriptor); - m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_metalLayer.pixelFormat; - m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function; + m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_mainFrameBuffer.m_swapChain->m_metalLayer.pixelFormat; + m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function; m_renderPipelineDescriptor.fragmentFunction = m_screenshotBlitProgram.m_fsh->m_function; m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor); g_caps.supported |= (0 - | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL - | BGFX_CAPS_TEXTURE_COMPARE_ALL + | BGFX_CAPS_ALPHA_TO_COVERAGE + | BGFX_CAPS_BLEND_INDEPENDENT + | BGFX_CAPS_FRAGMENT_DEPTH + | BGFX_CAPS_INDEX32 + | BGFX_CAPS_INSTANCING + | BGFX_CAPS_OCCLUSION_QUERY + | BGFX_CAPS_SWAP_CHAIN + | BGFX_CAPS_TEXTURE_2D_ARRAY | BGFX_CAPS_TEXTURE_3D + | BGFX_CAPS_TEXTURE_BLIT + | BGFX_CAPS_TEXTURE_COMPARE_ALL + | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL + | BGFX_CAPS_TEXTURE_READ_BACK | BGFX_CAPS_VERTEX_ATTRIB_HALF | BGFX_CAPS_VERTEX_ATTRIB_UINT10 - | BGFX_CAPS_INSTANCING - | BGFX_CAPS_FRAGMENT_DEPTH - | BGFX_CAPS_BLEND_INDEPENDENT - | BGFX_CAPS_INDEX32 - | BGFX_CAPS_TEXTURE_BLIT - | BGFX_CAPS_TEXTURE_READ_BACK - | BGFX_CAPS_OCCLUSION_QUERY - | BGFX_CAPS_ALPHA_TO_COVERAGE - | BGFX_CAPS_TEXTURE_2D_ARRAY ); if (BX_ENABLED(BX_PLATFORM_IOS) ) @@ -525,7 +489,8 @@ namespace bgfx { namespace mtl g_caps.supported |= BGFX_CAPS_TEXTURE_CUBE_ARRAY; } - //todo: vendor id, device id, gpu enum + g_caps.limits.maxTextureLayers = 2048; + g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS; m_hasPixelFormatDepth32Float_Stencil8 = false || BX_ENABLED(BX_PLATFORM_OSX) @@ -629,7 +594,7 @@ namespace bgfx { namespace mtl } } - for (uint32_t ii=1; ii<5; ++ii) + for (uint32_t ii = 1; ii < 5; ++ii) { if (!m_device.supportsTextureSampleCount(s_msaa[ii]) ) { @@ -655,6 +620,8 @@ namespace bgfx { namespace mtl m_occlusionQuery.postReset(); m_gpuTimer.shutdown(); + m_pipelineStateCache.invalidate(); + for (uint32_t ii = 0; ii < BX_COUNTOF(m_shaders); ++ii) { m_shaders[ii].destroy(); @@ -680,8 +647,11 @@ namespace bgfx { namespace mtl MTL_RELEASE(m_textureDescriptor); MTL_RELEASE(m_samplerDescriptor); - MTL_RELEASE(m_backBufferDepth); - MTL_RELEASE(m_backBufferStencil); + MTL_RELEASE(m_mainFrameBuffer.m_swapChain->m_backBufferDepth); + if (BX_ENABLED(BX_PLATFORM_IOS) ) + { + MTL_RELEASE(m_mainFrameBuffer.m_swapChain->m_backBufferStencil); + } for (uint8_t i=0; i < MTL_MAX_FRAMES_IN_FLIGHT; ++i) { @@ -701,7 +671,7 @@ namespace bgfx { namespace mtl return BGFX_RENDERER_METAL_NAME; } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override + void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags); } @@ -722,7 +692,7 @@ namespace bgfx { namespace mtl { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -737,7 +707,7 @@ namespace bgfx { namespace mtl m_indexBuffers[_handle.idx].create(_size, NULL, _flags); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -753,7 +723,7 @@ namespace bgfx { namespace mtl m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data); } @@ -763,7 +733,7 @@ namespace bgfx { namespace mtl m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) override + void createShader(ShaderHandle _handle, const Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } @@ -783,9 +753,10 @@ namespace bgfx { namespace mtl m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) override + void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override { m_textures[_handle.idx].create(_mem, _flags, _skip); + return NULL; } void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override @@ -812,15 +783,18 @@ namespace bgfx { namespace mtl uint32_t srcWidth = bx::uint32_max(1, texture.m_ptr.width() >> _mip); uint32_t srcHeight = bx::uint32_max(1, texture.m_ptr.height() >> _mip); - const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(texture.m_textureFormat) ); - MTLRegion region = { { 0, 0, 0 }, { srcWidth, srcHeight, 1 } }; + MTLRegion region = + { + { 0, 0, 0 }, + { srcWidth, srcHeight, 1 }, + }; texture.m_ptr.getBytes(_data, srcWidth*bpp/8, 0, region, _mip, 0); - } - void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips) override + void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers) override { TextureMtl& texture = m_textures[_handle.idx]; @@ -835,7 +809,7 @@ namespace bgfx { namespace mtl tc.m_width = _width; tc.m_height = _height; tc.m_depth = 0; - tc.m_numLayers = 1; + tc.m_numLayers = _numLayers; tc.m_numMips = _numMips; tc.m_format = TextureFormat::Enum(texture.m_requestedFormat); tc.m_cubeMap = false; @@ -869,11 +843,19 @@ namespace bgfx { namespace mtl m_frameBuffers[_handle.idx].create(_num, _attachment); } - void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) override + void createFrameBuffer(FrameBufferHandle _handle, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) override { uint16_t denseIdx = m_numWindows++; m_windows[denseIdx] = _handle; - m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _depthFormat); + if (!isValid(_handle)) + { + m_mainFrameBuffer.create(denseIdx, _nwh, _width, _height, _format, _depthFormat); + } + else + { + m_frameBuffers[_handle.idx].create(denseIdx, _nwh, _width, _height, _format, _depthFormat); + m_frameBuffers[_handle.idx].m_swapChain->resize(m_frameBuffers[_handle.idx], _width, _height, 0);//_resolution.reset); + } } void destroyFrameBuffer(FrameBufferHandle _handle) override @@ -885,8 +867,12 @@ namespace bgfx { namespace mtl if (m_numWindows > 1) { FrameBufferHandle handle = m_windows[m_numWindows]; - m_windows[denseIdx] = handle; - m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + m_windows[m_numWindows] = {kInvalidHandle}; + if (m_numWindows != denseIdx) + { + m_windows[denseIdx] = handle; + m_frameBuffers[handle.idx].m_denseIdx = denseIdx; + } } } } @@ -902,7 +888,7 @@ namespace bgfx { namespace mtl void* data = BX_ALLOC(g_allocator, size); bx::memSet(data, 0, size); m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name, data); + m_uniformReg.add(_handle, _name); } void destroyUniform(UniformHandle _handle) override @@ -912,14 +898,12 @@ namespace bgfx { namespace mtl m_uniformReg.remove(_handle); } - //cmdPre void requestScreenShotPre(const char* _filePath) { BX_UNUSED(_filePath); m_saveScreenshot = true; } - //cmdPost void requestScreenShot(FrameBufferHandle _handle, const char* _filePath) override { BX_UNUSED(_handle); @@ -941,14 +925,15 @@ namespace bgfx { namespace mtl m_screenshotTarget.getBytes(data, 4*width, 0, region, 0, 0); - g_callback->screenShot(_filePath - , m_screenshotTarget.width() - , m_screenshotTarget.height() - , width*4 - , data - , length - , false - ); + g_callback->screenShot( + _filePath + , m_screenshotTarget.width() + , m_screenshotTarget.height() + , width*4 + , data + , length + , false + ); BX_FREE(g_allocator, data); @@ -1011,29 +996,29 @@ namespace bgfx { namespace mtl { RenderCommandEncoder rce = m_renderCommandEncoder; - uint32_t width = m_resolution.m_width; - uint32_t height = m_resolution.m_height; - - //if (m_ovr.isEnabled() ) - //{ - // m_ovr.getSize(width, height); - //} + uint32_t width = m_resolution.width; + uint32_t height = m_resolution.height; FrameBufferHandle fbh = BGFX_INVALID_HANDLE; if (NULL == rce || m_renderCommandEncoderFrameBufferHandle.idx != kInvalidHandle) { - if (m_renderCommandEncoder ) + if (m_renderCommandEncoder) + { m_renderCommandEncoder.endEncoding(); + } RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor(); setFrameBuffer(renderPassDescriptor, fbh); renderPassDescriptor.colorAttachments[0].loadAction = MTLLoadActionLoad; - renderPassDescriptor.colorAttachments[0].storeAction = NULL != renderPassDescriptor.colorAttachments[0].resolveTexture ? - MTLStoreActionMultisampleResolve : MTLStoreActionStore; + renderPassDescriptor.colorAttachments[0].storeAction = + NULL != renderPassDescriptor.colorAttachments[0].resolveTexture + ? MTLStoreActionMultisampleResolve + : MTLStoreActionStore + ; rce = m_commandBuffer.renderCommandEncoderWithDescriptor(renderPassDescriptor); m_renderCommandEncoder = rce; @@ -1048,18 +1033,25 @@ namespace bgfx { namespace mtl rce.setCullMode(MTLCullModeNone); uint64_t state = 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS ; setDepthStencilState(state); - ProgramMtl& program = m_program[_blitter.m_program.idx]; - RenderPipelineState pipelineState = program.getRenderPipelineState(state, 0, fbh, _blitter.m_vb->decl, 0); - rce.setRenderPipelineState(pipelineState); + RenderPipelineState pso = getPipelineState( + state + , 0 + , fbh + , _blitter.m_vb->decl + , _blitter.m_program.idx + , 0 + ); + rce.setRenderPipelineState(pso); - uint32_t vertexUniformBufferSize = program.m_vshConstantBufferSize; + ProgramMtl& program = m_program[_blitter.m_program.idx]; + uint32_t vertexUniformBufferSize = program.m_vshConstantBufferSize; uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize; if (vertexUniformBufferSize ) @@ -1105,18 +1097,22 @@ namespace bgfx { namespace mtl return false; } - void flip(HMD& /*_hmd*/) override + void flip() override { if (NULL == m_commandBuffer) { return; } - // Present and commit the command buffer - if (NULL != m_drawable) + for (uint32_t ii = 0, num = m_numWindows; ii < num; ++ii) { - m_commandBuffer.presentDrawable(m_drawable); - MTL_RELEASE(m_drawable); + FrameBufferMtl& frameBuffer = ii == 0 ? m_mainFrameBuffer : m_frameBuffers[m_windows[ii].idx]; + if (NULL != frameBuffer.m_swapChain && + frameBuffer.m_swapChain->m_drawable) + { + m_commandBuffer.presentDrawable(frameBuffer.m_swapChain->m_drawable); + MTL_RELEASE(frameBuffer.m_swapChain->m_drawable); + } } m_cmd.kick(true); @@ -1125,97 +1121,27 @@ namespace bgfx { namespace mtl void updateResolution(const Resolution& _resolution) { - m_maxAnisotropy = !!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) + m_mainFrameBuffer.m_swapChain->m_maxAnisotropy = !!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) ? 16 : 1 ; const uint32_t maskFlags = ~(0 - | BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP | BGFX_RESET_SUSPEND ); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || (m_resolution.m_flags&maskFlags) != (_resolution.m_flags&maskFlags) ) + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height + || (m_resolution.reset&maskFlags) != (_resolution.reset&maskFlags) ) { - int sampleCount = s_msaa[(_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; - - MTLPixelFormat prevMetalLayerPixelFormat = m_metalLayer.pixelFormat; - - m_metalLayer.drawableSize = CGSizeMake(_resolution.m_width, _resolution.m_height); - m_metalLayer.pixelFormat = (m_resolution.m_flags & BGFX_RESET_SRGB_BACKBUFFER) - ? MTLPixelFormatBGRA8Unorm_sRGB - : MTLPixelFormatBGRA8Unorm - ; + MTLPixelFormat prevMetalLayerPixelFormat = m_mainFrameBuffer.m_swapChain->m_metalLayer.pixelFormat; m_resolution = _resolution; - m_resolution.m_flags &= ~BGFX_RESET_INTERNAL_FORCE; + m_resolution.reset &= ~BGFX_RESET_INTERNAL_FORCE; - m_textureDescriptor.textureType = sampleCount > 1 ? MTLTextureType2DMultisample : MTLTextureType2D; - - if (m_hasPixelFormatDepth32Float_Stencil8) - m_textureDescriptor.pixelFormat = MTLPixelFormatDepth32Float_Stencil8; - else - m_textureDescriptor.pixelFormat = MTLPixelFormatDepth32Float; - - m_textureDescriptor.width = _resolution.m_width; - m_textureDescriptor.height = _resolution.m_height; - m_textureDescriptor.depth = 1; - m_textureDescriptor.mipmapLevelCount = 1; - m_textureDescriptor.sampleCount = sampleCount; - m_textureDescriptor.arrayLength = 1; - if (m_iOS9Runtime - || m_macOS11Runtime) - { - m_textureDescriptor.cpuCacheMode = MTLCPUCacheModeDefaultCache; - m_textureDescriptor.storageMode = MTLStorageModePrivate; - m_textureDescriptor.usage = MTLTextureUsageRenderTarget; - } - - if (NULL != m_backBufferDepth) - { - release(m_backBufferDepth); - } - - m_backBufferDepth = m_device.newTextureWithDescriptor(m_textureDescriptor); - - if (NULL != m_backBufferStencil) - { - release(m_backBufferStencil); - } - - if (m_hasPixelFormatDepth32Float_Stencil8) - { - m_backBufferStencil = m_backBufferDepth; - retain(m_backBufferStencil); - } - else - { - m_textureDescriptor.pixelFormat = MTLPixelFormatStencil8; - m_backBufferStencil = m_device.newTextureWithDescriptor(m_textureDescriptor); - } - - if (sampleCount > 1) - { - if (NULL != m_backBufferColorMSAA) - { - release(m_backBufferColorMSAA); - } - m_textureDescriptor.pixelFormat = m_metalLayer.pixelFormat; - m_backBufferColorMSAA = m_device.newTextureWithDescriptor(m_textureDescriptor); - } - - bx::HashMurmur2A murmur; - murmur.begin(); - murmur.add(1); - murmur.add( (uint32_t)m_metalLayer.pixelFormat); - murmur.add( (uint32_t)m_backBufferDepth.pixelFormat() ); - murmur.add( (uint32_t)m_backBufferStencil.pixelFormat() ); - murmur.add( (uint32_t)sampleCount); - m_backBufferPixelFormatHash = murmur.end(); + m_mainFrameBuffer.m_swapChain->resize(m_mainFrameBuffer, _resolution.width, _resolution.height, _resolution.reset); for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii) { @@ -1224,15 +1150,15 @@ namespace bgfx { namespace mtl updateCapture(); - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.resize(false, _resolution.width, _resolution.height); m_textVideoMem.clear(); - if (prevMetalLayerPixelFormat != m_metalLayer.pixelFormat) + if (prevMetalLayerPixelFormat != m_mainFrameBuffer.m_swapChain->m_metalLayer.pixelFormat) { MTL_RELEASE(m_screenshotBlitRenderPipelineState) reset(m_renderPipelineDescriptor); - m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_metalLayer.pixelFormat; - m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function; + m_renderPipelineDescriptor.colorAttachments[0].pixelFormat = m_mainFrameBuffer.m_swapChain->m_metalLayer.pixelFormat; + m_renderPipelineDescriptor.vertexFunction = m_screenshotBlitProgram.m_vsh->m_function; m_renderPipelineDescriptor.fragmentFunction = m_screenshotBlitProgram.m_fsh->m_function; m_screenshotBlitRenderPipelineState = m_device.newRenderPipelineStateWithDescriptor(m_renderPipelineDescriptor); } @@ -1242,11 +1168,11 @@ namespace bgfx { namespace mtl void updateCapture() { - if (m_resolution.m_flags&BGFX_RESET_CAPTURE) + if (m_resolution.reset&BGFX_RESET_CAPTURE) { - m_captureSize = m_resolution.m_width*m_resolution.m_height*4; + m_captureSize = m_resolution.width*m_resolution.height*4; m_capture = BX_REALLOC(g_allocator, m_capture, m_captureSize); - g_callback->captureBegin(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, TextureFormat::BGRA8, false); + g_callback->captureBegin(m_resolution.width, m_resolution.height, m_resolution.width*4, TextureFormat::BGRA8, false); } else { @@ -1268,9 +1194,9 @@ namespace bgfx { namespace mtl m_cmd.kick(false, true); m_commandBuffer = 0; - MTLRegion region = { { 0, 0, 0 }, { m_resolution.m_width, m_resolution.m_height, 1 } }; + MTLRegion region = { { 0, 0, 0 }, { m_resolution.width, m_resolution.height, 1 } }; - m_screenshotTarget.getBytes(m_capture, 4*m_resolution.m_width, 0, region, 0, 0); + m_screenshotTarget.getBytes(m_capture, 4*m_resolution.width, 0, region, 0, 0); m_commandBuffer = m_cmd.alloc(); @@ -1278,11 +1204,11 @@ namespace bgfx { namespace mtl { bimg::imageSwizzleBgra8( m_capture - , m_resolution.m_width*4 - , m_resolution.m_width - , m_resolution.m_height + , m_resolution.width*4 + , m_resolution.width + , m_resolution.height , m_capture - , m_resolution.m_width*4 + , m_resolution.width*4 ); } @@ -1383,12 +1309,12 @@ namespace bgfx { namespace mtl } #define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \ - case UniformType::_uniform: \ - case UniformType::_uniform|BGFX_UNIFORM_FRAGMENTBIT: \ - { \ - setShaderUniform(uint8_t(type), loc, data, num); \ - } \ - break; + case UniformType::_uniform: \ + case UniformType::_uniform|BGFX_UNIFORM_FRAGMENTBIT: \ + { \ + setShaderUniform(uint8_t(type), loc, data, num); \ + } \ + break; switch ( (uint32_t)type) { @@ -1416,8 +1342,8 @@ namespace bgfx { namespace mtl } break; - CASE_IMPLEMENT_UNIFORM(Int1, I, int); - CASE_IMPLEMENT_UNIFORM(Vec4, F, float); + CASE_IMPLEMENT_UNIFORM(Int1, I, int); + CASE_IMPLEMENT_UNIFORM(Vec4, F, float); CASE_IMPLEMENT_UNIFORM(Mat4, F, float); case UniformType::End: @@ -1446,25 +1372,24 @@ namespace bgfx { namespace mtl } else { - width = m_resolution.m_width; - height = m_resolution.m_height; + width = m_resolution.width; + height = m_resolution.height; } - uint64_t state = 0; - state |= _clear.m_flags & BGFX_CLEAR_COLOR ? BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE : 0; - state |= _clear.m_flags & BGFX_CLEAR_DEPTH ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_DEPTH_WRITE : 0; + state |= _clear.m_flags & BGFX_CLEAR_COLOR ? BGFX_STATE_WRITE_RGB|BGFX_STATE_WRITE_A : 0; + state |= _clear.m_flags & BGFX_CLEAR_DEPTH ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_WRITE_Z : 0; uint64_t stencil = 0; stencil |= _clear.m_flags & BGFX_CLEAR_STENCIL ? 0 - | BGFX_STENCIL_TEST_ALWAYS - | BGFX_STENCIL_FUNC_REF(_clear.m_stencil) - | BGFX_STENCIL_FUNC_RMASK(0xff) - | BGFX_STENCIL_OP_FAIL_S_REPLACE - | BGFX_STENCIL_OP_FAIL_Z_REPLACE - | BGFX_STENCIL_OP_PASS_Z_REPLACE - : 0 - ; + | BGFX_STENCIL_TEST_ALWAYS + | BGFX_STENCIL_FUNC_REF(_clear.m_stencil) + | BGFX_STENCIL_FUNC_RMASK(0xff) + | BGFX_STENCIL_OP_FAIL_S_REPLACE + | BGFX_STENCIL_OP_FAIL_Z_REPLACE + | BGFX_STENCIL_OP_PASS_Z_REPLACE + : 0 + ; setDepthStencilState(state, stencil); @@ -1476,8 +1401,16 @@ namespace bgfx { namespace mtl numMrt = bx::uint32_max(1, fb.m_num); } - ProgramMtl& program = m_program[_clearQuad.m_program[numMrt-1].idx]; - m_renderCommandEncoder.setRenderPipelineState(program.getRenderPipelineState(state, 0, fbh, _clearQuad.m_vb->decl, 0) ); + const ProgramMtl& program = m_program[_clearQuad.m_program[numMrt-1].idx]; + RenderPipelineState pso = getPipelineState( + state + , 0 + , fbh + , _clearQuad.m_vb->decl + , _clearQuad.m_program[numMrt-1].idx + , 0 + ); + m_renderCommandEncoder.setRenderPipelineState(pso); uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize; @@ -1569,26 +1502,30 @@ namespace bgfx { namespace mtl void setFrameBuffer(RenderPassDescriptor renderPassDescriptor, FrameBufferHandle _fbh, bool _msaa = true) { - if (!isValid(_fbh) ) + if (!isValid(_fbh) || m_frameBuffers[_fbh.idx].m_swapChain) { - if (NULL != m_backBufferColorMSAA) + SwapChainMtl* swapChain = + !isValid(_fbh) ? + m_mainFrameBuffer.m_swapChain : + m_frameBuffers[_fbh.idx].m_swapChain; + if (NULL != m_backBufferColorMsaa) { - renderPassDescriptor.colorAttachments[0].texture = m_backBufferColorMSAA; + renderPassDescriptor.colorAttachments[0].texture = swapChain->m_backBufferColorMsaa; renderPassDescriptor.colorAttachments[0].resolveTexture = NULL != m_screenshotTarget ? m_screenshotTarget.m_obj - : currentDrawable().texture + : swapChain->currentDrawable().texture ; } else { renderPassDescriptor.colorAttachments[0].texture = NULL != m_screenshotTarget ? m_screenshotTarget.m_obj - : currentDrawable().texture + : swapChain->currentDrawable().texture ; } - renderPassDescriptor.depthAttachment.texture = m_backBufferDepth; - renderPassDescriptor.stencilAttachment.texture = m_backBufferStencil; + renderPassDescriptor.depthAttachment.texture = swapChain->m_backBufferDepth; + renderPassDescriptor.stencilAttachment.texture = swapChain->m_backBufferStencil; } else { @@ -1597,11 +1534,11 @@ namespace bgfx { namespace mtl for (uint32_t ii = 0; ii < frameBuffer.m_num; ++ii) { const TextureMtl& texture = m_textures[frameBuffer.m_colorHandle[ii].idx]; - renderPassDescriptor.colorAttachments[ii].texture = texture.m_ptrMSAA - ? texture.m_ptrMSAA + renderPassDescriptor.colorAttachments[ii].texture = texture.m_ptrMsaa + ? texture.m_ptrMsaa : texture.m_ptr ; - renderPassDescriptor.colorAttachments[ii].resolveTexture = texture.m_ptrMSAA + renderPassDescriptor.colorAttachments[ii].resolveTexture = texture.m_ptrMsaa ? texture.m_ptr.m_obj : NULL ; @@ -1610,8 +1547,8 @@ namespace bgfx { namespace mtl if (isValid(frameBuffer.m_depthHandle) ) { const TextureMtl& texture = m_textures[frameBuffer.m_depthHandle.idx]; - renderPassDescriptor.depthAttachment.texture = texture.m_ptrMSAA - ? texture.m_ptrMSAA + renderPassDescriptor.depthAttachment.texture = texture.m_ptrMsaa + ? texture.m_ptrMsaa : texture.m_ptr ; renderPassDescriptor.stencilAttachment.texture = texture.m_ptrStencil; @@ -1625,8 +1562,8 @@ namespace bgfx { namespace mtl } else { - renderPassDescriptor.stencilAttachment.texture = texture.m_ptrMSAA - ? texture.m_ptrMSAA + renderPassDescriptor.stencilAttachment.texture = texture.m_ptrMsaa + ? texture.m_ptrMsaa : texture.m_ptrStencil ; } @@ -1640,12 +1577,12 @@ namespace bgfx { namespace mtl void setDepthStencilState(uint64_t _state, uint64_t _stencil = 0) { - _state &= BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK; + _state &= BGFX_STATE_WRITE_Z|BGFX_STATE_DEPTH_TEST_MASK; uint32_t fstencil = unpackStencil(0, _stencil); uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT; - _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK); + _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, ~BGFX_STENCIL_FUNC_REF_MASK); bx::HashMurmur2A murmur; murmur.begin(); @@ -1658,7 +1595,7 @@ namespace bgfx { namespace mtl { DepthStencilDescriptor desc = m_depthStencilDescriptor; uint32_t func = (_state&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT; - desc.depthWriteEnabled = !!(BGFX_STATE_DEPTH_WRITE & _state); + desc.depthWriteEnabled = !!(BGFX_STATE_WRITE_Z & _state); desc.depthCompareFunction = s_cmpFunc[func]; uint32_t bstencil = unpackStencil(1, _stencil); @@ -1668,7 +1605,7 @@ namespace bgfx { namespace mtl if (0 != _stencil) { StencilDescriptor frontFaceDesc = m_frontFaceStencilDescriptor; - StencilDescriptor backfaceDesc = m_backFaceStencilDescriptor; + StencilDescriptor backfaceDesc = m_backFaceStencilDescriptor; uint32_t readMask = (fstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT; uint32_t writeMask = 0xff; @@ -1688,7 +1625,7 @@ namespace bgfx { namespace mtl backfaceDesc.writeMask = writeMask; desc.frontFaceStencil = frontFaceDesc; - desc.backFaceStencil = backfaceDesc; + desc.backFaceStencil = backfaceDesc; } else { @@ -1705,30 +1642,429 @@ namespace bgfx { namespace mtl m_renderCommandEncoder.setStencilReferenceValue(ref); } + RenderPipelineState getPipelineState( + uint64_t _state + , uint32_t _rgba + , FrameBufferHandle _fbh + , uint8_t _numStreams + , const VertexDecl** _vertexDecls + , uint16_t _programIdx + , uint8_t _numInstanceData + ) + { + _state &= (0 + | BGFX_STATE_BLEND_MASK + | BGFX_STATE_BLEND_EQUATION_MASK + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_INDEPENDENT + | BGFX_STATE_MSAA + | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE + ); + + const bool independentBlendEnable = !!(BGFX_STATE_BLEND_INDEPENDENT & _state); + ProgramMtl& program = m_program[_programIdx]; + + bx::HashMurmur2A murmur; + murmur.begin(); + murmur.add(_state); + murmur.add(independentBlendEnable ? _rgba : 0); + murmur.add(_numInstanceData); + + if (!isValid(_fbh) ) + { + murmur.add(m_backBufferPixelFormatHash); + } + else + { + FrameBufferMtl& frameBuffer = m_frameBuffers[_fbh.idx]; + murmur.add(frameBuffer.m_pixelFormatHash); + } + + murmur.add(program.m_vsh->m_hash); + if (NULL != program.m_fsh) + { + murmur.add(program.m_fsh->m_hash); + } + + for (uint8_t ii = 0; ii < _numStreams; ++ii) + { + murmur.add(_vertexDecls[ii]->m_hash); + } + + uint32_t hash = murmur.end(); + + RenderPipelineState pso = m_pipelineStateCache.find(hash); + if (NULL == pso) + { + RenderPipelineDescriptor pd = m_renderPipelineDescriptor; + reset(pd); + + pd.alphaToCoverageEnabled = !!(BGFX_STATE_BLEND_ALPHA_TO_COVERAGE & _state); + + uint32_t frameBufferAttachment = 1; + + if (!isValid(_fbh) || s_renderMtl->m_frameBuffers[_fbh.idx].m_swapChain) + { + SwapChainMtl* swapChain = + !isValid(_fbh) ? + s_renderMtl->m_mainFrameBuffer.m_swapChain : + s_renderMtl->m_frameBuffers[_fbh.idx].m_swapChain; + pd.sampleCount = NULL != swapChain->m_backBufferColorMsaa ? swapChain->m_backBufferColorMsaa.sampleCount() : 1; + pd.colorAttachments[0].pixelFormat = swapChain->currentDrawable().texture.pixelFormat; + pd.depthAttachmentPixelFormat = swapChain->m_backBufferDepth.m_obj.pixelFormat; + pd.stencilAttachmentPixelFormat = swapChain->m_backBufferStencil.m_obj.pixelFormat; + } + else + { + const FrameBufferMtl& frameBuffer = m_frameBuffers[_fbh.idx]; + frameBufferAttachment = frameBuffer.m_num; + + for (uint32_t ii = 0; ii < frameBuffer.m_num; ++ii) + { + const TextureMtl& texture = m_textures[frameBuffer.m_colorHandle[ii].idx]; + pd.sampleCount = NULL != texture.m_ptrMsaa + ? texture.m_ptrMsaa.sampleCount() + : 1 + ; + pd.colorAttachments[ii].pixelFormat = texture.m_ptr.m_obj.pixelFormat; + } + + if (isValid(frameBuffer.m_depthHandle) ) + { + const TextureMtl& texture = m_textures[frameBuffer.m_depthHandle.idx]; + pd.depthAttachmentPixelFormat = texture.m_ptr.m_obj.pixelFormat; + if (NULL != texture.m_ptrStencil) + { + pd.stencilAttachmentPixelFormat = texture.m_ptrStencil.m_obj.pixelFormat; + } + else + { + if (texture.m_textureFormat == TextureFormat::D24S8) + { + pd.stencilAttachmentPixelFormat = texture.m_ptr.m_obj.pixelFormat; + } + } + } + } + + const uint32_t blend = uint32_t( (_state&BGFX_STATE_BLEND_MASK )>>BGFX_STATE_BLEND_SHIFT); + const uint32_t equation = uint32_t( (_state&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT); + + const uint32_t srcRGB = (blend )&0xf; + const uint32_t dstRGB = (blend>> 4)&0xf; + const uint32_t srcA = (blend>> 8)&0xf; + const uint32_t dstA = (blend>>12)&0xf; + + const uint32_t equRGB = (equation )&0x7; + const uint32_t equA = (equation>>3)&0x7; + + uint8_t writeMask = 0; + writeMask |= (_state&BGFX_STATE_WRITE_R) ? MTLColorWriteMaskRed : 0; + writeMask |= (_state&BGFX_STATE_WRITE_G) ? MTLColorWriteMaskGreen : 0; + writeMask |= (_state&BGFX_STATE_WRITE_B) ? MTLColorWriteMaskBlue : 0; + writeMask |= (_state&BGFX_STATE_WRITE_A) ? MTLColorWriteMaskAlpha : 0; + + for (uint32_t ii = 0; ii < (independentBlendEnable ? 1 : frameBufferAttachment); ++ii) + { + RenderPipelineColorAttachmentDescriptor drt = pd.colorAttachments[ii]; + + drt.blendingEnabled = !!(BGFX_STATE_BLEND_MASK & _state); + + drt.sourceRGBBlendFactor = s_blendFactor[srcRGB][0]; + drt.destinationRGBBlendFactor = s_blendFactor[dstRGB][0]; + drt.rgbBlendOperation = s_blendEquation[equRGB]; + + drt.sourceAlphaBlendFactor = s_blendFactor[srcA][1]; + drt.destinationAlphaBlendFactor = s_blendFactor[dstA][1]; + drt.alphaBlendOperation = s_blendEquation[equA]; + + drt.writeMask = writeMask; + } + + if (independentBlendEnable) + { + for (uint32_t ii = 1, rgba = _rgba; ii < frameBufferAttachment; ++ii, rgba >>= 11) + { + RenderPipelineColorAttachmentDescriptor drt = pd.colorAttachments[ii]; + + drt.blendingEnabled = 0 != (rgba&0x7ff); + + const uint32_t src = (rgba )&0xf; + const uint32_t dst = (rgba>>4)&0xf; + const uint32_t equationIndex = (rgba>>8)&0x7; + + drt.sourceRGBBlendFactor = s_blendFactor[src][0]; + drt.destinationRGBBlendFactor = s_blendFactor[dst][0]; + drt.rgbBlendOperation = s_blendEquation[equationIndex]; + + drt.sourceAlphaBlendFactor = s_blendFactor[src][1]; + drt.destinationAlphaBlendFactor = s_blendFactor[dst][1]; + drt.alphaBlendOperation = s_blendEquation[equationIndex]; + + drt.writeMask = writeMask; + } + } + + pd.vertexFunction = program.m_vsh->m_function; + pd.fragmentFunction = program.m_fsh != NULL ? program.m_fsh->m_function : NULL; + + VertexDescriptor vertexDesc = m_vertexDescriptor; + reset(vertexDesc); + + bool attrSet[Attrib::Count] = {}; + + uint8_t stream = 0; + for (; stream < _numStreams; ++stream) + { + const VertexDecl& vertexDecl = *_vertexDecls[stream]; + for (uint32_t ii = 0; Attrib::Count != program.m_used[ii]; ++ii) + { + Attrib::Enum attr = Attrib::Enum(program.m_used[ii]); + const uint32_t loc = program.m_attributes[attr]; + + uint8_t num; + AttribType::Enum type; + bool normalized; + bool asInt; + vertexDecl.decode(attr, num, type, normalized, asInt); + BX_CHECK(num <= 4, "num must be <= 4"); + + if (UINT16_MAX != vertexDecl.m_attributes[attr]) + { + vertexDesc.attributes[loc].format = s_attribType[type][num-1][normalized?1:0]; + vertexDesc.attributes[loc].bufferIndex = stream+1; + vertexDesc.attributes[loc].offset = vertexDecl.m_offset[attr]; + + BX_TRACE("attrib: %s format: %d offset: %d", s_attribName[attr], (int)vertexDesc.attributes[loc].format, (int)vertexDesc.attributes[loc].offset); + + attrSet[attr] = true; + } + } + + vertexDesc.layouts[stream+1].stride = vertexDecl.getStride(); + vertexDesc.layouts[stream+1].stepFunction = MTLVertexStepFunctionPerVertex; + } + + for (uint32_t ii = 0; Attrib::Count != program.m_used[ii]; ++ii) + { + Attrib::Enum attr = Attrib::Enum(program.m_used[ii]); + const uint32_t loc = program.m_attributes[attr]; + if (!attrSet[attr]) + { + vertexDesc.attributes[loc].format = MTLVertexFormatUChar2; + vertexDesc.attributes[loc].bufferIndex = 1; + vertexDesc.attributes[loc].offset = 0; + } + } + + if (0 < _numInstanceData) + { + for (uint32_t ii = 0; UINT16_MAX != program.m_instanceData[ii]; ++ii) + { + const uint32_t loc = program.m_instanceData[ii]; + vertexDesc.attributes[loc].format = MTLVertexFormatFloat4; + vertexDesc.attributes[loc].bufferIndex = stream+1; + vertexDesc.attributes[loc].offset = ii*16; + } + + vertexDesc.layouts[stream+1].stride = _numInstanceData * 16; + vertexDesc.layouts[stream+1].stepFunction = MTLVertexStepFunctionPerInstance; + vertexDesc.layouts[stream+1].stepRate = 1; + } + + pd.vertexDescriptor = vertexDesc; + + if (program.m_processedUniforms) + { + pso = m_device.newRenderPipelineStateWithDescriptor(pd); + } + else + { + program.m_numPredefined = 0; + RenderPipelineReflection reflection = NULL; + pso = m_device.newRenderPipelineStateWithDescriptor(pd, MTLPipelineOptionBufferTypeInfo, &reflection); + + if (NULL != reflection) + { + for (uint32_t shaderType = 0; shaderType < 2; ++shaderType) + { + UniformBuffer*& constantBuffer = shaderType == 0 + ? program.m_vshConstantBuffer + : program.m_fshConstantBuffer + ; + uint8_t fragmentBit = (1 == shaderType ? BGFX_UNIFORM_FRAGMENTBIT : 0); + + for (MTLArgument* arg in (shaderType == 0 ? reflection.vertexArguments : reflection.fragmentArguments) ) + { + BX_TRACE("arg: %s type:%d", utf8String(arg.name), arg.type); + if (arg.active) + { + if (arg.type == MTLArgumentTypeBuffer + && 0 == bx::strCmp(utf8String(arg.name), SHADER_UNIFORM_NAME) ) + { + BX_CHECK( arg.index == 0, "Uniform buffer must be in the buffer slot 0."); + BX_CHECK( MTLDataTypeStruct == arg.bufferDataType, "%s's type must be a struct",SHADER_UNIFORM_NAME ); + + if (MTLDataTypeStruct == arg.bufferDataType) + { + if (shaderType == 0) + { + program.m_vshConstantBufferSize = (uint32_t)arg.bufferDataSize; + program.m_vshConstantBufferAlignmentMask = (uint32_t)arg.bufferAlignment - 1; + } + else + { + program.m_fshConstantBufferSize = (uint32_t)arg.bufferDataSize; + program.m_fshConstantBufferAlignmentMask = (uint32_t)arg.bufferAlignment - 1; + } + + for (MTLStructMember* uniform in arg.bufferStructType.members ) + { + const char* name = utf8String(uniform.name); + BX_TRACE("uniform: %s type:%d", name, uniform.dataType); + + MTLDataType dataType = uniform.dataType; + uint32_t num = 1; + + if (dataType == MTLDataTypeArray) + { + dataType = uniform.arrayType.elementType; + num = (uint32_t)uniform.arrayType.arrayLength; + } + + switch (dataType) + { + case MTLDataTypeFloat4: num *= 1; break; + case MTLDataTypeFloat4x4: num *= 4; break; + case MTLDataTypeFloat3x3: num *= 3; break; + + default: + BX_WARN(0, "Unsupported uniform MTLDataType: %d", uniform.dataType); + break; + } + + PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name); + if (PredefinedUniform::Count != predefined) + { + program.m_predefined[program.m_numPredefined].m_loc = uint32_t(uniform.offset); + program.m_predefined[program.m_numPredefined].m_count = uint16_t(num); + program.m_predefined[program.m_numPredefined].m_type = uint8_t(predefined|fragmentBit); + ++program.m_numPredefined; + } + else + { + const UniformRegInfo* info = m_uniformReg.find(name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); + + if (NULL != info) + { + if (NULL == constantBuffer) + { + constantBuffer = UniformBuffer::create(1024); + } + + UniformType::Enum type = convertMtlType(dataType); + constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), uint32_t(uniform.offset), info->m_handle, uint16_t(num) ); + BX_TRACE("store %s %d offset:%d", name, info->m_handle, uint32_t(uniform.offset) ); + } + } + } + } + } + else if (arg.type == MTLArgumentTypeTexture) + { + const char* name = utf8String(arg.name); + const UniformRegInfo* info = m_uniformReg.find(name); + BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); + + if (NULL != info) + { + if (program.m_samplerCount >= BGFX_CONFIG_MAX_TEXTURE_SAMPLERS) + { + BX_WARN(NULL != info, "Too many samplers in shader(only %d is supported). User defined uniform '%s' won't be set.", BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, name); + } + else + { + program.m_samplers[program.m_samplerCount].m_index = uint32_t(arg.index); + program.m_samplers[program.m_samplerCount].m_uniform = info->m_handle; + program.m_samplers[program.m_samplerCount].m_fragment = fragmentBit ? 1 : 0; + ++program.m_samplerCount; + BX_TRACE("texture %s %d index:%d", name, info->m_handle, uint32_t(arg.index) ); + } + } + } + else if (arg.type == MTLArgumentTypeSampler) + { + BX_TRACE("sampler: %s index:%d", utf8String(arg.name), arg.index); + } + } + } + + if (NULL != constantBuffer) + { + constantBuffer->finish(); + } + } + } + + program.m_processedUniforms = true; + } + + m_pipelineStateCache.add(hash, pso); + } + + return pso; + } + + RenderPipelineState getPipelineState( + uint64_t _state + , uint32_t _rgba + , FrameBufferHandle _fbh + , VertexDeclHandle _declHandle + , uint16_t _programIdx + , uint16_t _numInstanceData + ) + { + const VertexDecl* decl = &m_vertexDecls[_declHandle.idx]; + return getPipelineState( + _state + , _rgba + , _fbh + , 1 + , &decl + , _programIdx + , _numInstanceData + ); + } + SamplerState getSamplerState(uint32_t _flags) { - _flags &= BGFX_TEXTURE_SAMPLER_BITS_MASK; + _flags &= BGFX_SAMPLER_BITS_MASK; SamplerState sampler = m_samplerStateCache.find(_flags); if (NULL == sampler) { - m_samplerDescriptor.sAddressMode = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]; - m_samplerDescriptor.tAddressMode = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]; - m_samplerDescriptor.rAddressMode = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]; - m_samplerDescriptor.minFilter = s_textureFilterMinMag[(_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT]; - m_samplerDescriptor.magFilter = s_textureFilterMinMag[(_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT]; - m_samplerDescriptor.mipFilter = s_textureFilterMip[(_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT]; + m_samplerDescriptor.sAddressMode = s_textureAddress[(_flags&BGFX_SAMPLER_U_MASK)>>BGFX_SAMPLER_U_SHIFT]; + m_samplerDescriptor.tAddressMode = s_textureAddress[(_flags&BGFX_SAMPLER_V_MASK)>>BGFX_SAMPLER_V_SHIFT]; + m_samplerDescriptor.rAddressMode = s_textureAddress[(_flags&BGFX_SAMPLER_W_MASK)>>BGFX_SAMPLER_W_SHIFT]; + m_samplerDescriptor.minFilter = s_textureFilterMinMag[(_flags&BGFX_SAMPLER_MIN_MASK)>>BGFX_SAMPLER_MIN_SHIFT]; + m_samplerDescriptor.magFilter = s_textureFilterMinMag[(_flags&BGFX_SAMPLER_MAG_MASK)>>BGFX_SAMPLER_MAG_SHIFT]; + m_samplerDescriptor.mipFilter = s_textureFilterMip[(_flags&BGFX_SAMPLER_MIP_MASK)>>BGFX_SAMPLER_MIP_SHIFT]; m_samplerDescriptor.lodMinClamp = 0; m_samplerDescriptor.lodMaxClamp = FLT_MAX; m_samplerDescriptor.normalizedCoordinates = TRUE; - m_samplerDescriptor.maxAnisotropy = (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) ) ) ? m_maxAnisotropy : 1; + m_samplerDescriptor.maxAnisotropy = (0 != (_flags & (BGFX_SAMPLER_MIN_ANISOTROPIC|BGFX_SAMPLER_MAG_ANISOTROPIC) ) ) ? m_mainFrameBuffer.m_swapChain->m_maxAnisotropy : 1; if (m_macOS11Runtime || [m_device supportsFeatureSet:(MTLFeatureSet)4 /*MTLFeatureSet_iOS_GPUFamily3_v1*/]) { - const uint32_t cmpFunc = (_flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT; - m_samplerDescriptor.compareFunction = 0 == cmpFunc ? MTLCompareFunctionNever : s_cmpFunc[cmpFunc]; + const uint32_t cmpFunc = (_flags&BGFX_SAMPLER_COMPARE_MASK)>>BGFX_SAMPLER_COMPARE_SHIFT; + m_samplerDescriptor.compareFunction = 0 == cmpFunc + ? MTLCompareFunctionNever + : s_cmpFunc[cmpFunc] + ; } sampler = m_device.newSamplerStateWithDescriptor(m_samplerDescriptor); @@ -1770,14 +2106,13 @@ namespace bgfx { namespace mtl return m_drawable; } - - Device m_device; - OcclusionQueryMTL m_occlusionQuery; - TimerQueryMtl m_gpuTimer; - CommandQueueMtl m_cmd; + Device m_device; + OcclusionQueryMTL m_occlusionQuery; + TimerQueryMtl m_gpuTimer; + CommandQueueMtl m_cmd; CAMetalLayer* m_metalLayer; - Texture m_backBufferColorMSAA; + Texture m_backBufferColorMsaa; Texture m_backBufferDepth; Texture m_backBufferStencil; uint32_t m_backBufferPixelFormatHash; @@ -1802,13 +2137,15 @@ namespace bgfx { namespace mtl ShaderMtl m_shaders[BGFX_CONFIG_MAX_SHADERS]; ProgramMtl m_program[BGFX_CONFIG_MAX_PROGRAMS]; TextureMtl m_textures[BGFX_CONFIG_MAX_TEXTURES]; + FrameBufferMtl m_mainFrameBuffer; FrameBufferMtl m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS]; VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS]; UniformRegistry m_uniformReg; void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS]; - StateCacheT m_depthStencilStateCache; - StateCacheT m_samplerStateCache; + StateCacheT m_pipelineStateCache; + StateCacheT m_depthStencilStateCache; + StateCacheT m_samplerStateCache; TextVideoMem m_textVideoMem; @@ -1829,27 +2166,25 @@ namespace bgfx { namespace mtl SamplerDescriptor m_samplerDescriptor; // currently active objects data - id m_drawable; - bool m_saveScreenshot; - Texture m_screenshotTarget; - ShaderMtl m_screenshotBlitProgramVsh; - ShaderMtl m_screenshotBlitProgramFsh; - ProgramMtl m_screenshotBlitProgram; - RenderPipelineState m_screenshotBlitRenderPipelineState; + id m_drawable; + bool m_saveScreenshot; + Texture m_screenshotTarget; + ShaderMtl m_screenshotBlitProgramVsh; + ShaderMtl m_screenshotBlitProgramFsh; + ProgramMtl m_screenshotBlitProgram; + RenderPipelineState m_screenshotBlitRenderPipelineState; - CommandBuffer m_commandBuffer; - CommandBuffer m_prevCommandBuffer; - BlitCommandEncoder m_blitCommandEncoder; - RenderCommandEncoder m_renderCommandEncoder; - FrameBufferHandle m_renderCommandEncoderFrameBufferHandle; + CommandBuffer m_commandBuffer; + CommandBuffer m_prevCommandBuffer; + BlitCommandEncoder m_blitCommandEncoder; + RenderCommandEncoder m_renderCommandEncoder; + FrameBufferHandle m_renderCommandEncoderFrameBufferHandle; }; - static RendererContextMtl* s_renderMtl; - - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { s_renderMtl = BX_NEW(g_allocator, RendererContextMtl); - if (!s_renderMtl->init() ) + if (!s_renderMtl->init(_init) ) { BX_DELETE(g_allocator, s_renderMtl); s_renderMtl = NULL; @@ -1876,28 +2211,27 @@ namespace bgfx { namespace mtl uint32_t magic; bx::read(&reader, magic); - switch (magic) + uint32_t hashIn; + bx::read(&reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) { - case BGFX_CHUNK_MAGIC_CSH: - case BGFX_CHUNK_MAGIC_FSH: - case BGFX_CHUNK_MAGIC_VSH: - break; - - default: - BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic); - break; + hashOut = hashIn; + } + else + { + bx::read(&reader, hashOut); } - - uint32_t iohash; - bx::read(&reader, iohash); uint16_t count; bx::read(&reader, count); BX_TRACE("%s Shader consts %d" - , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute" - , count - ); + , getShaderTypeName(magic) + , count + ); for (uint32_t ii = 0; ii < count; ++ii) { @@ -1938,20 +2272,24 @@ namespace bgfx { namespace mtl BGFX_FATAL(NULL != m_function , bgfx::Fatal::InvalidShader , "Failed to create %s shader." - , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute" + , getShaderTypeName(magic) ); + + bx::HashMurmur2A murmur; + murmur.begin(); + murmur.add(hashIn); + murmur.add(hashOut); + murmur.add(code, shaderSize); +// murmur.add(numAttrs); +// murmur.add(m_attrMask, numAttrs); + m_hash = murmur.end(); } void ProgramMtl::create(const ShaderMtl* _vsh, const ShaderMtl* _fsh) { BX_CHECK(NULL != _vsh->m_function.m_obj, "Vertex shader doesn't exist."); m_vsh = _vsh; - - if (NULL != _fsh) - { - BX_CHECK(NULL != _fsh->m_function.m_obj, "Fragment shader doesn't exist."); - m_fsh = _fsh; - } + m_fsh = _fsh; // get attributes bx::memSet(m_attributes, 0xff, sizeof(m_attributes) ); @@ -1988,6 +2326,7 @@ namespace bgfx { namespace mtl } } } + m_used[used] = Attrib::Count; m_instanceData[instUsed] = UINT16_MAX; } @@ -2009,375 +2348,16 @@ namespace bgfx { namespace mtl m_fshConstantBuffer = NULL; } - m_vshConstantBufferSize = 0; + m_vshConstantBufferSize = 0; m_vshConstantBufferAlignmentMask = 0; - m_fshConstantBufferSize = 0; + m_fshConstantBufferSize = 0; m_fshConstantBufferAlignmentMask = 0; - m_samplerCount = 0; - + m_samplerCount = 0; m_processedUniforms = false; - m_numPredefined = 0; - - m_renderPipelineStateCache.invalidate(); + m_numPredefined = 0; } - UniformType::Enum convertMtlType(MTLDataType _type) - { - switch (_type) - { - case MTLDataTypeUInt: - case MTLDataTypeInt: - return UniformType::Int1; - - case MTLDataTypeFloat: - case MTLDataTypeFloat2: - case MTLDataTypeFloat3: - case MTLDataTypeFloat4: - return UniformType::Vec4; - - case MTLDataTypeFloat3x3: - return UniformType::Mat3; - - case MTLDataTypeFloat4x4: - return UniformType::Mat4; - - default: - break; - }; - - BX_CHECK(false, "Unrecognized Mtl Data type 0x%04x.", _type); - return UniformType::End; - } - - RenderPipelineState ProgramMtl::getRenderPipelineState(uint64_t _state, uint32_t _rgba, FrameBufferHandle _fbHandle, VertexDeclHandle _declHandle, uint16_t _numInstanceData) - { - _state &= (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE|BGFX_STATE_BLEND_INDEPENDENT|BGFX_STATE_MSAA|BGFX_STATE_BLEND_ALPHA_TO_COVERAGE); - - bool independentBlendEnable = !!(BGFX_STATE_BLEND_INDEPENDENT & _state); - - bx::HashMurmur2A murmur; - murmur.begin(); - murmur.add(_state); - murmur.add(independentBlendEnable ? _rgba : 0); - if (!isValid(_fbHandle) ) - { - murmur.add(s_renderMtl->m_backBufferPixelFormatHash); - } - else - { - FrameBufferMtl& frameBuffer = s_renderMtl->m_frameBuffers[_fbHandle.idx]; - murmur.add(frameBuffer.m_pixelFormatHash); - } - murmur.add(s_renderMtl->m_vertexDecls[_declHandle.idx].m_hash); - murmur.add(_numInstanceData); - uint32_t hash = murmur.end(); - - RenderPipelineState rps = m_renderPipelineStateCache.find(hash); - if (NULL == rps) - { - RenderPipelineDescriptor& pd = s_renderMtl->m_renderPipelineDescriptor; - reset(pd); - - pd.alphaToCoverageEnabled = !!(BGFX_STATE_BLEND_ALPHA_TO_COVERAGE & _state); - - uint32_t frameBufferAttachment = 1; - - if (!isValid(_fbHandle) ) - { - pd.sampleCount = NULL != s_renderMtl->m_backBufferColorMSAA ? s_renderMtl->m_backBufferColorMSAA.sampleCount() : 1; - pd.colorAttachments[0].pixelFormat = s_renderMtl->currentDrawable().texture.pixelFormat; - pd.depthAttachmentPixelFormat = s_renderMtl->m_backBufferDepth.m_obj.pixelFormat; - pd.stencilAttachmentPixelFormat = s_renderMtl->m_backBufferStencil.m_obj.pixelFormat; - } - else - { - FrameBufferMtl& frameBuffer = s_renderMtl->m_frameBuffers[_fbHandle.idx]; - frameBufferAttachment = frameBuffer.m_num; - - for (uint32_t ii = 0; ii < frameBuffer.m_num; ++ii) - { - const TextureMtl& texture = s_renderMtl->m_textures[frameBuffer.m_colorHandle[ii].idx]; - pd.sampleCount = NULL != texture.m_ptrMSAA - ? texture.m_ptrMSAA.sampleCount() - : 1 - ; - pd.colorAttachments[ii].pixelFormat = texture.m_ptr.m_obj.pixelFormat; - } - - if (isValid(frameBuffer.m_depthHandle) ) - { - const TextureMtl& texture = s_renderMtl->m_textures[frameBuffer.m_depthHandle.idx]; - pd.depthAttachmentPixelFormat = texture.m_ptr.m_obj.pixelFormat; - if (NULL != texture.m_ptrStencil) - { - pd.stencilAttachmentPixelFormat = texture.m_ptrStencil.m_obj.pixelFormat; - } - else - { - if (texture.m_textureFormat == TextureFormat::D24S8) - { - pd.stencilAttachmentPixelFormat = texture.m_ptr.m_obj.pixelFormat; - } - } - } - } - - const uint32_t blend = uint32_t( (_state&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT); - const uint32_t equation = uint32_t( (_state&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT); - - const uint32_t srcRGB = (blend )&0xf; - const uint32_t dstRGB = (blend>> 4)&0xf; - const uint32_t srcA = (blend>> 8)&0xf; - const uint32_t dstA = (blend>>12)&0xf; - - const uint32_t equRGB = (equation )&0x7; - const uint32_t equA = (equation>>3)&0x7; - - uint8_t writeMask = (_state&BGFX_STATE_ALPHA_WRITE) ? MTLColorWriteMaskAlpha : 0; - writeMask |= (_state&BGFX_STATE_RGB_WRITE) ? MTLColorWriteMaskRed|MTLColorWriteMaskGreen|MTLColorWriteMaskBlue : 0; - - for (uint32_t ii = 0; ii < (independentBlendEnable ? 1 : frameBufferAttachment); ++ii) - { - RenderPipelineColorAttachmentDescriptor drt = pd.colorAttachments[ii]; - - drt.blendingEnabled = !!(BGFX_STATE_BLEND_MASK & _state); - - drt.sourceRGBBlendFactor = s_blendFactor[srcRGB][0]; - drt.destinationRGBBlendFactor = s_blendFactor[dstRGB][0]; - drt.rgbBlendOperation = s_blendEquation[equRGB]; - - drt.sourceAlphaBlendFactor = s_blendFactor[srcA][1]; - drt.destinationAlphaBlendFactor = s_blendFactor[dstA][1]; - drt.alphaBlendOperation = s_blendEquation[equA]; - - drt.writeMask = writeMask; - } - - if (independentBlendEnable) - { - for (uint32_t ii = 1, rgba = _rgba; ii < frameBufferAttachment; ++ii, rgba >>= 11) - { - RenderPipelineColorAttachmentDescriptor drt = pd.colorAttachments[ii]; - - drt.blendingEnabled = 0 != (rgba&0x7ff); - - const uint32_t src = (rgba )&0xf; - const uint32_t dst = (rgba>>4)&0xf; - const uint32_t equationIndex = (rgba>>8)&0x7; - - drt.sourceRGBBlendFactor = s_blendFactor[src][0]; - drt.destinationRGBBlendFactor = s_blendFactor[dst][0]; - drt.rgbBlendOperation = s_blendEquation[equationIndex]; - - drt.sourceAlphaBlendFactor = s_blendFactor[src][1]; - drt.destinationAlphaBlendFactor = s_blendFactor[dst][1]; - drt.alphaBlendOperation = s_blendEquation[equationIndex]; - - drt.writeMask = writeMask; - } - } - - pd.vertexFunction = m_vsh->m_function; - pd.fragmentFunction = m_fsh->m_function; - - if (isValid(_declHandle) ) - { - VertexDescriptor vertexDesc = s_renderMtl->m_vertexDescriptor; - reset(vertexDesc); - - VertexDecl &vertexDecl = s_renderMtl->m_vertexDecls[_declHandle.idx]; - for (uint32_t ii = 0; Attrib::Count != m_used[ii]; ++ii) - { - Attrib::Enum attr = Attrib::Enum(m_used[ii]); - uint32_t loc = m_attributes[attr]; - - uint8_t num; - AttribType::Enum type; - bool normalized; - bool asInt; - vertexDecl.decode(attr, num, type, normalized, asInt); - BX_CHECK(num <= 4, "num must be <=4"); - - if (UINT16_MAX != vertexDecl.m_attributes[attr]) - { - vertexDesc.attributes[loc].format = s_attribType[type][num-1][normalized?1:0]; - vertexDesc.attributes[loc].bufferIndex = 1; - vertexDesc.attributes[loc].offset = vertexDecl.m_offset[attr]; - - BX_TRACE("attrib:%s format: %d offset:%d", s_attribName[attr], (int)vertexDesc.attributes[loc].format, (int)vertexDesc.attributes[loc].offset); - } - else - { // NOTE: missing attribute: using dummy attribute with smallest possible size - vertexDesc.attributes[loc].format = MTLVertexFormatUChar2; - vertexDesc.attributes[loc].bufferIndex = 1; - vertexDesc.attributes[loc].offset = 0; - } - } - - vertexDesc.layouts[1].stride = vertexDecl.getStride(); - vertexDesc.layouts[1].stepFunction = MTLVertexStepFunctionPerVertex; - - BX_TRACE("stride: %d", (int)vertexDesc.layouts[1].stride); - - if (0 < _numInstanceData) - { - for (uint32_t ii = 0; UINT16_MAX != m_instanceData[ii]; ++ii) - { - uint32_t loc = m_instanceData[ii]; - vertexDesc.attributes[loc].format = MTLVertexFormatFloat4; - vertexDesc.attributes[loc].bufferIndex = 2; - vertexDesc.attributes[loc].offset = ii*16; - } - - vertexDesc.layouts[2].stride = _numInstanceData * 16; - vertexDesc.layouts[2].stepFunction = MTLVertexStepFunctionPerInstance; - vertexDesc.layouts[2].stepRate = 1; - } - - pd.vertexDescriptor = vertexDesc; - } - - if (m_processedUniforms) - { - rps = s_renderMtl->m_device.newRenderPipelineStateWithDescriptor(pd); - } - else - { - m_numPredefined = 0; - RenderPipelineReflection reflection = NULL; - rps = s_renderMtl->m_device.newRenderPipelineStateWithDescriptor(pd, MTLPipelineOptionBufferTypeInfo, &reflection); - - if (NULL != reflection) - { - for (uint32_t shaderType = 0; shaderType < 2; ++shaderType) - { - UniformBuffer*& constantBuffer = (shaderType == 0 ? m_vshConstantBuffer : m_fshConstantBuffer); - uint8_t fragmentBit = (1 == shaderType ? BGFX_UNIFORM_FRAGMENTBIT : 0); - - for (MTLArgument* arg in (shaderType == 0 ? reflection.vertexArguments : reflection.fragmentArguments) ) - { - BX_TRACE("arg: %s type:%d", utf8String(arg.name), arg.type); - if (arg.active) - { - if (arg.type == MTLArgumentTypeBuffer - && 0 == bx::strCmp(utf8String(arg.name), SHADER_UNIFORM_NAME) ) - { - BX_CHECK( arg.index == 0, "Uniform buffer must be in the buffer slot 0."); - BX_CHECK( MTLDataTypeStruct == arg.bufferDataType, "%s's type must be a struct",SHADER_UNIFORM_NAME ); - - if (MTLDataTypeStruct == arg.bufferDataType) - { - if (shaderType == 0) - { - m_vshConstantBufferSize = (uint32_t)arg.bufferDataSize; - m_vshConstantBufferAlignmentMask = (uint32_t)arg.bufferAlignment - 1; - } - else - { - m_fshConstantBufferSize = (uint32_t)arg.bufferDataSize; - m_fshConstantBufferAlignmentMask = (uint32_t)arg.bufferAlignment - 1; - } - - for (MTLStructMember* uniform in arg.bufferStructType.members ) - { - const char* name = utf8String(uniform.name); - BX_TRACE("uniform: %s type:%d", name, uniform.dataType); - - MTLDataType dataType = uniform.dataType; - uint32_t num = 1; - - if (dataType == MTLDataTypeArray) - { - dataType = uniform.arrayType.elementType; - num = (uint32_t)uniform.arrayType.arrayLength; - } - - switch (dataType) { - case MTLDataTypeFloat4: num *= 1; break; - case MTLDataTypeFloat4x4: num *= 4; break; - case MTLDataTypeFloat3x3: num *= 3; break; - - default: - BX_WARN(0, "Unsupported uniform MTLDataType: %d", uniform.dataType); - break; - } - - PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name); - if (PredefinedUniform::Count != predefined) - { - m_predefined[m_numPredefined].m_loc = uint32_t(uniform.offset); - m_predefined[m_numPredefined].m_count = uint16_t(num); - m_predefined[m_numPredefined].m_type = uint8_t(predefined|fragmentBit); - m_numPredefined++; - } - else - { - const UniformRegInfo* info = s_renderMtl->m_uniformReg.find(name); - BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); - - if (NULL != info) - { - if (NULL == constantBuffer) - { - constantBuffer = UniformBuffer::create(1024); - } - - UniformType::Enum type = convertMtlType(dataType); - constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), uint32_t(uniform.offset), info->m_handle, uint16_t(num) ); - BX_TRACE("store %s %d offset:%d", name, info->m_handle, uint32_t(uniform.offset) ); - } - } - - } - } - } - else if (arg.type == MTLArgumentTypeTexture) - { - const char* name = utf8String(arg.name); - const UniformRegInfo* info = s_renderMtl->m_uniformReg.find(name); - BX_WARN(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name); - - if (NULL != info) - { - if ( m_samplerCount >= BGFX_CONFIG_MAX_TEXTURE_SAMPLERS) - { - BX_WARN(NULL != info, "Too many samplers in shader(only %d is supported). User defined uniform '%s' won't be set.", BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, name); - } - else - { - m_samplers[m_samplerCount].m_index = uint32_t(arg.index); - m_samplers[m_samplerCount].m_uniform = info->m_handle; - m_samplers[m_samplerCount].m_fragment = fragmentBit ? 1 : 0; - ++m_samplerCount; - BX_TRACE("texture %s %d index:%d", name, info->m_handle, uint32_t(arg.index) ); - } - } - } - else if (arg.type == MTLArgumentTypeSampler) - { - BX_TRACE("sampler: %s index:%d", utf8String(arg.name), arg.index); - } - } - } - - if (NULL != constantBuffer) - { - constantBuffer->finish(); - } - } - } - - m_processedUniforms = true; - } - - m_renderPipelineStateCache.add(hash, rps); - } - - return rps; - } - - void BufferMtl::create(uint32_t _size, void* _data, uint16_t _flags, uint16_t _stride, bool _vertex) { BX_UNUSED(_stride, _vertex); @@ -2389,7 +2369,9 @@ namespace bgfx { namespace mtl if (NULL == _data) { for (uint32_t ii = 0; ii < MTL_MAX_FRAMES_IN_FLIGHT; ++ii) + { m_buffers[ii] = s_renderMtl->m_device.newBufferWithLength(_size, 0); + } } else { @@ -2437,16 +2419,16 @@ namespace bgfx { namespace mtl { m_decl = _declHandle; uint16_t stride = isValid(_declHandle) - ? s_renderMtl->m_vertexDecls[_declHandle.idx].m_stride - : 0 - ; + ? s_renderMtl->m_vertexDecls[_declHandle.idx].m_stride + : 0 + ; BufferMtl::create(_size, _data, _flags, stride, true); } - void TextureMtl::create(const Memory* _mem, uint32_t _flags, uint8_t _skip) + void TextureMtl::create(const Memory* _mem, uint64_t _flags, uint8_t _skip) { - m_sampler = s_renderMtl->getSamplerState(_flags); + m_sampler = s_renderMtl->getSamplerState(uint32_t(_flags) ); bimg::ImageContainer imageContainer; @@ -2460,14 +2442,14 @@ namespace bgfx { namespace mtl const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod); const uint16_t numLayers = imageContainer.m_numLayers; - m_flags = _flags; - m_width = textureWidth; - m_height = textureHeight; - m_depth = imageContainer.m_depth; + m_flags = _flags; + m_width = textureWidth; + m_height = textureHeight; + m_depth = imageContainer.m_depth; m_requestedFormat = uint8_t(imageContainer.m_format); m_textureFormat = uint8_t(getViableTextureFormat(imageContainer) ); const bool convert = m_textureFormat != m_requestedFormat; - const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); + const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) ); TextureDescriptor desc = s_renderMtl->m_textureDescriptor; @@ -2502,7 +2484,6 @@ namespace bgfx { namespace mtl m_numMips = numMips; const uint16_t numSides = numLayers * (imageContainer.m_cubeMap ? 6 : 1); - const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) ); const bool writeOnly = 0 != (_flags&BGFX_TEXTURE_RT_WRITE_ONLY); const bool computeWrite = 0 != (_flags&BGFX_TEXTURE_COMPUTE_WRITE); @@ -2510,18 +2491,18 @@ namespace bgfx { namespace mtl const bool srgb = 0 != (_flags&BGFX_TEXTURE_SRGB); BX_TRACE("Texture %3d: %s (requested: %s), layers %d, %dx%d%s RT[%c], WO[%c], CW[%c], sRGB[%c]" - , this - s_renderMtl->m_textures - , getName( (TextureFormat::Enum)m_textureFormat) - , getName( (TextureFormat::Enum)m_requestedFormat) - , numLayers - , textureWidth - , textureHeight - , imageContainer.m_cubeMap ? "x6" : "" - , renderTarget ? 'x' : '.' - , writeOnly ? 'x' : '.' - , computeWrite ? 'x' : '.' - , srgb ? 'x' : '.' - ); + , this - s_renderMtl->m_textures + , getName( (TextureFormat::Enum)m_textureFormat) + , getName( (TextureFormat::Enum)m_requestedFormat) + , numLayers + , textureWidth + , textureHeight + , imageContainer.m_cubeMap ? "x6" : "" + , renderTarget ? 'x' : '.' + , writeOnly ? 'x' : '.' + , computeWrite ? 'x' : '.' + , srgb ? 'x' : '.' + ); const uint32_t msaaQuality = bx::uint32_satsub( (_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1); int sampleCount = s_msaa[msaaQuality]; @@ -2557,7 +2538,7 @@ namespace bgfx { namespace mtl desc.storageMode = (MTLStorageMode)(false || writeOnly || bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) ) - ? 2 /*MTLStorageModePrivate*/ + ? 2 /* MTLStorageModePrivate */ : (BX_ENABLED(BX_PLATFORM_IOS) ? 0 /* MTLStorageModeShared */ : 1 /* MTLStorageModeManaged */ @@ -2581,12 +2562,14 @@ namespace bgfx { namespace mtl { desc.textureType = MTLTextureType2DMultisample; desc.sampleCount = sampleCount; + if (s_renderMtl->m_iOS9Runtime || s_renderMtl->m_macOS11Runtime) { - desc.storageMode = (MTLStorageMode)( 2 /*MTLStorageModePrivate*/); + desc.storageMode = (MTLStorageMode)(2 /* MTLStorageModePrivate */); } - m_ptrMSAA = s_renderMtl->m_device.newTextureWithDescriptor(desc); + + m_ptrMsaa = s_renderMtl->m_device.newTextureWithDescriptor(desc); } if (m_requestedFormat == TextureFormat::D24S8 @@ -2621,7 +2604,9 @@ namespace bgfx { namespace mtl if (convert) { - bimg::imageDecodeToBgra8(temp + bimg::imageDecodeToBgra8( + g_allocator + , temp , mip.m_data , mip.m_width , mip.m_height @@ -2694,7 +2679,9 @@ namespace bgfx { namespace mtl if (convert) { temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height); - bimg::imageDecodeToBgra8(temp + bimg::imageDecodeToBgra8( + g_allocator + , temp , data , _rect.m_width , _rect.m_height @@ -2758,30 +2745,199 @@ namespace bgfx { namespace mtl { s_renderMtl->m_renderCommandEncoder.setVertexTexture(m_ptr, _stage); s_renderMtl->m_renderCommandEncoder.setVertexSamplerState( - 0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) + 0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? s_renderMtl->getSamplerState(_flags) - : m_sampler, _stage); + : m_sampler + , _stage + ); } if (_fragment) { s_renderMtl->m_renderCommandEncoder.setFragmentTexture(m_ptr, _stage); s_renderMtl->m_renderCommandEncoder.setFragmentSamplerState( - 0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & _flags) + 0 == (BGFX_SAMPLER_INTERNAL_DEFAULT & _flags) ? s_renderMtl->getSamplerState(_flags) - : m_sampler, _stage); + : m_sampler + , _stage + ); } } + SwapChainMtl::~SwapChainMtl() + { + MTL_RELEASE(m_backBufferDepth); + if (BX_ENABLED(BX_PLATFORM_IOS) ) + { + MTL_RELEASE(m_backBufferStencil); + } + } + + void SwapChainMtl::init(void* _nwh) + { + if (NULL != NSClassFromString(@"MTKView") ) + { + MTKView *view = (MTKView *)_nwh; + if (NULL != view && [view isKindOfClass:NSClassFromString(@"MTKView")]) + { + m_metalLayer = (CAMetalLayer *)view.layer; + } + } + + if (NULL != NSClassFromString(@"CAMetalLayer") ) + { + if (NULL == m_metalLayer) +#if BX_PLATFORM_IOS + { + CAMetalLayer* metalLayer = (CAMetalLayer*)_nwh; + if (NULL == metalLayer + || ![metalLayer isKindOfClass:NSClassFromString(@"CAMetalLayer")]) + { + BX_WARN(NULL != metalLayer, "Unable to create Metal device. Please set platform data window to a CAMetalLayer"); + return; + } + + m_metalLayer = metalLayer; + } +#elif BX_PLATFORM_OSX + { + NSObject* nvh = (NSObject*)_nwh; + if ([nvh isKindOfClass:[CAMetalLayer class]]) + { + CAMetalLayer* metalLayer = (CAMetalLayer*)_nwh; + m_metalLayer = metalLayer; + } + else + { + NSWindow* nsWindow = (NSWindow*)_nwh; + [nsWindow.contentView setWantsLayer:YES]; + m_metalLayer = [CAMetalLayer layer]; + [nsWindow.contentView setLayer:m_metalLayer]; + } + } +#endif // BX_PLATFORM_* + } + + if (NULL == m_metalLayer) + { + BX_WARN(NULL != s_renderMtl->m_device, "Unable to create Metal device."); + return; + } + + m_metalLayer.device = s_renderMtl->m_device; + m_metalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; + m_metalLayer.magnificationFilter = kCAFilterNearest; + } + + void SwapChainMtl::resize(FrameBufferMtl &_frameBuffer, uint32_t _width, uint32_t _height, uint32_t _flags) + { + int sampleCount = s_msaa[(_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT]; + +#if BX_PLATFORM_OSX > 101300 + m_metalLayer.displaySyncEnabled = 0 != (_flags&BGFX_RESET_VSYNC); +#endif // BX_PLATFORM_OSX > 101300 + + m_metalLayer.drawableSize = CGSizeMake(_width, _height); + m_metalLayer.pixelFormat = (_flags & BGFX_RESET_SRGB_BACKBUFFER) + ? MTLPixelFormatBGRA8Unorm_sRGB + : MTLPixelFormatBGRA8Unorm + ; + + TextureDescriptor desc = s_renderMtl->m_textureDescriptor; + + desc.textureType = sampleCount > 1 ? MTLTextureType2DMultisample : MTLTextureType2D; + + if (s_renderMtl->m_hasPixelFormatDepth32Float_Stencil8) + { + desc.pixelFormat = MTLPixelFormatDepth32Float_Stencil8; + } + else + { + desc.pixelFormat = MTLPixelFormatDepth32Float; + } + + desc.width = _width; + desc.height = _height; + desc.depth = 1; + desc.mipmapLevelCount = 1; + desc.sampleCount = sampleCount; + desc.arrayLength = 1; + + if (s_renderMtl->m_iOS9Runtime + || s_renderMtl->m_macOS11Runtime) + { + desc.cpuCacheMode = MTLCPUCacheModeDefaultCache; + desc.storageMode = MTLStorageModePrivate; + desc.usage = MTLTextureUsageRenderTarget; + } + + if (NULL != m_backBufferDepth) + { + release(m_backBufferDepth); + } + + m_backBufferDepth = s_renderMtl->m_device.newTextureWithDescriptor(desc); + + if (NULL != m_backBufferStencil) + { + release(m_backBufferStencil); + } + + if (s_renderMtl->m_hasPixelFormatDepth32Float_Stencil8) + { + m_backBufferStencil = m_backBufferDepth; + retain(m_backBufferStencil); + } + else + { + desc.pixelFormat = MTLPixelFormatStencil8; + m_backBufferStencil = s_renderMtl->m_device.newTextureWithDescriptor(desc); + } + + if ( sampleCount > 1 ) + { + if (NULL != m_backBufferColorMsaa) + { + release(m_backBufferColorMsaa); + } + + desc.pixelFormat = m_metalLayer.pixelFormat; + m_backBufferColorMsaa = s_renderMtl->m_device.newTextureWithDescriptor(desc); + } + + bx::HashMurmur2A murmur; + murmur.begin(); + murmur.add(1); + murmur.add((uint32_t)m_metalLayer.pixelFormat); + murmur.add((uint32_t)m_backBufferDepth.pixelFormat()); + murmur.add((uint32_t)m_backBufferStencil.pixelFormat()); + murmur.add((uint32_t)sampleCount); + _frameBuffer.m_pixelFormatHash = murmur.end(); + } + + id SwapChainMtl::currentDrawable() + { + if (m_drawable == nil) + { + m_drawable = m_metalLayer.nextDrawable; + retain(m_drawable); // keep alive to be useable at 'flip' + } + + return m_drawable; + } + void FrameBufferMtl::create(uint8_t _num, const Attachment* _attachment) { + m_swapChain = NULL; m_denseIdx = UINT16_MAX; - m_num = 0; - m_width = 0; + m_num = 0; + m_width = 0; m_height = 0; + for (uint32_t ii = 0; ii < _num; ++ii) { TextureHandle handle = _attachment[ii].handle; + if (isValid(handle) ) { const TextureMtl& texture = s_renderMtl->m_textures[handle.idx]; @@ -2806,43 +2962,57 @@ namespace bgfx { namespace mtl bx::HashMurmur2A murmur; murmur.begin(); - murmur.add(m_num); + for (uint32_t ii = 0; ii < m_num; ++ii) { const TextureMtl& texture = s_renderMtl->m_textures[m_colorHandle[ii].idx]; - murmur.add( (uint32_t)texture.m_ptr.pixelFormat() ); + murmur.add(uint32_t(texture.m_ptr.pixelFormat() ) ); } + if (!isValid(m_depthHandle) ) { - murmur.add( (uint32_t)MTLPixelFormatInvalid); - murmur.add( (uint32_t)MTLPixelFormatInvalid); + murmur.add(uint32_t(MTLPixelFormatInvalid) ); + murmur.add(uint32_t(MTLPixelFormatInvalid) ); } else { const TextureMtl& depthTexture = s_renderMtl->m_textures[m_depthHandle.idx]; - murmur.add( (uint32_t)depthTexture.m_ptr.pixelFormat() ); - murmur.add( (uint32_t)(NULL != depthTexture.m_ptrStencil ? depthTexture.m_ptrStencil.pixelFormat() : MTLPixelFormatInvalid) ); + murmur.add(uint32_t(depthTexture.m_ptr.pixelFormat() ) ); + murmur.add(NULL != depthTexture.m_ptrStencil + ? uint32_t(depthTexture.m_ptrStencil.pixelFormat() ) + : uint32_t(MTLPixelFormatInvalid) + ); } - murmur.add(1); //SampleCount + + murmur.add(1); // SampleCount m_pixelFormatHash = murmur.end(); } - void FrameBufferMtl::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _depthFormat) + void FrameBufferMtl::create(uint16_t _denseIdx, void* _nwh, uint32_t _width, uint32_t _height, TextureFormat::Enum _format, TextureFormat::Enum _depthFormat) { - BX_UNUSED(_denseIdx, _nwh, _width, _height, _depthFormat); + BX_UNUSED(_format, _depthFormat); + m_swapChain = BX_NEW(g_allocator, SwapChainMtl); + m_width = _width; + m_height = _height; + m_denseIdx = _denseIdx; - BX_WARN(false, "FrameBufferMtl::create not yet implemented"); + m_swapChain->init(_nwh); } void FrameBufferMtl::postReset() { - BX_WARN(false, "FrameBufferMtl::postReset not yet implemented"); } uint16_t FrameBufferMtl::destroy() { + if (NULL != m_swapChain) + { + BX_DELETE(g_allocator, m_swapChain); + m_swapChain = NULL; + } + m_num = 0; m_depthHandle.idx = kInvalidHandle; @@ -2874,6 +3044,7 @@ namespace bgfx { namespace mtl static void commandBufferFinishedCallback(void* _data) { CommandQueueMtl* queue = (CommandQueueMtl*)_data; + if (queue) { queue->m_framesSemaphore.post(); @@ -2891,6 +3062,7 @@ namespace bgfx { namespace mtl } m_activeCommandBuffer.commit(); + if (_waitForFinish) { m_activeCommandBuffer.waitUntilCompleted(); @@ -2933,10 +3105,12 @@ namespace bgfx { namespace mtl m_releaseReadIndex = (m_releaseReadIndex + 1) % MTL_MAX_FRAMES_IN_FLIGHT; ResourceArray& ra = m_release[m_releaseReadIndex]; + for (ResourceArray::iterator it = ra.begin(), itEnd = ra.end(); it != itEnd; ++it) { bgfx::mtl::release(*it); } + ra.clear(); } @@ -2949,7 +3123,7 @@ namespace bgfx { namespace mtl { } - static void setTimestamp(void* _data) + static void setTimestamp(void* _data) { *( (int64_t*)_data) = bx::getHPCounter(); } @@ -3003,7 +3177,7 @@ namespace bgfx { namespace mtl } Query& query = m_query[m_control.m_current]; - query.m_handle = _handle; + query.m_handle = _handle; uint32_t offset = _handle.idx * 8; _rce.setVisibilityResultMode(MTLVisibilityResultModeBoolean, offset); } @@ -3019,6 +3193,7 @@ namespace bgfx { namespace mtl void OcclusionQueryMTL::resolve(Frame* _render, bool _wait) { BX_UNUSED(_wait); + while (0 != m_control.available() ) { Query& query = m_query[m_control.m_read]; @@ -3158,8 +3333,8 @@ namespace bgfx { namespace mtl { if (m_screenshotTarget) { - if (m_screenshotTarget.width() != m_resolution.m_width - || m_screenshotTarget.height() != m_resolution.m_height) + if (m_screenshotTarget.width() != m_resolution.width + || m_screenshotTarget.height() != m_resolution.height) { MTL_RELEASE(m_screenshotTarget); } @@ -3168,9 +3343,9 @@ namespace bgfx { namespace mtl if (NULL == m_screenshotTarget) { m_textureDescriptor.textureType = MTLTextureType2D; - m_textureDescriptor.pixelFormat = m_metalLayer.pixelFormat; - m_textureDescriptor.width = m_resolution.m_width; - m_textureDescriptor.height = m_resolution.m_height; + m_textureDescriptor.pixelFormat = m_mainFrameBuffer.m_swapChain->m_metalLayer.pixelFormat; + m_textureDescriptor.width = m_resolution.width; + m_textureDescriptor.height = m_resolution.height; m_textureDescriptor.depth = 1; m_textureDescriptor.mipmapLevelCount = 1; m_textureDescriptor.sampleCount = 1; @@ -3228,8 +3403,6 @@ namespace bgfx { namespace mtl RenderBind currentBind; currentBind.clear(); - _render->m_hmdInitialized = false; - const bool hmdEnabled = false; static ViewState viewState; viewState.reset(_render, hmdEnabled); @@ -3353,8 +3526,8 @@ namespace bgfx { namespace mtl fbh = _render->m_view[view].m_fbh; - uint32_t width = m_resolution.m_width; - uint32_t height = m_resolution.m_height; + uint32_t width = m_resolution.width; + uint32_t height = m_resolution.height; if (isValid(fbh) ) { @@ -3364,10 +3537,11 @@ namespace bgfx { namespace mtl } clearWithRenderPass = true - && 0 == viewRect.m_x - && 0 == viewRect.m_y - && width == viewRect.m_width - && height == viewRect.m_height; + && 0 == viewRect.m_x + && 0 == viewRect.m_y + && width == viewRect.m_width + && height == viewRect.m_height + ; setFrameBuffer(renderPassDescriptor, fbh); @@ -3418,7 +3592,7 @@ namespace bgfx { namespace mtl ? MTLLoadActionClear : MTLLoadActionLoad ; - depthAttachment.storeAction = NULL != m_backBufferColorMSAA + depthAttachment.storeAction = NULL != m_mainFrameBuffer.m_swapChain->m_backBufferColorMsaa ? MTLStoreActionDontCare : MTLStoreActionStore ; @@ -3432,7 +3606,7 @@ namespace bgfx { namespace mtl ? MTLLoadActionClear : MTLLoadActionLoad ; - stencilAttachment.storeAction = NULL != m_backBufferColorMSAA + stencilAttachment.storeAction = NULL != m_mainFrameBuffer.m_swapChain->m_backBufferColorMsaa ? MTLStoreActionDontCare : MTLStoreActionStore ; @@ -3452,15 +3626,15 @@ namespace bgfx { namespace mtl RenderPassDepthAttachmentDescriptor depthAttachment = renderPassDescriptor.depthAttachment; if (NULL != depthAttachment.texture) { - depthAttachment.loadAction = MTLLoadActionLoad; + depthAttachment.loadAction = MTLLoadActionLoad; depthAttachment.storeAction = MTLStoreActionStore; } RenderPassStencilAttachmentDescriptor stencilAttachment = renderPassDescriptor.stencilAttachment; if (NULL != stencilAttachment.texture) { - stencilAttachment.loadAction = MTLLoadActionLoad; - stencilAttachment.storeAction = MTLStoreActionStore; + stencilAttachment.loadAction = MTLLoadActionLoad; + stencilAttachment.storeAction = MTLStoreActionStore; } } @@ -3470,7 +3644,7 @@ namespace bgfx { namespace mtl MTL_RELEASE(renderPassDescriptor); } - rce.setTriangleFillMode(wireframe? MTLTriangleFillModeLines : MTLTriangleFillModeFill); + rce.setTriangleFillMode(wireframe ? MTLTriangleFillModeLines : MTLTriangleFillModeFill); if (BX_ENABLED(BGFX_CONFIG_DEBUG_MTL) ) { @@ -3513,11 +3687,25 @@ namespace bgfx { namespace mtl const RenderDraw& draw = renderItem.draw; const bool hasOcclusionQuery = 0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); - if (isValid(draw.m_occlusionQuery) - && !hasOcclusionQuery - && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) ) { - continue; + const bool occluded = true + && isValid(draw.m_occlusionQuery) + && !hasOcclusionQuery + && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) + ; + + if (occluded + || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) + { + if (resetState) + { + currentState.clear(); + currentState.m_scissor = !draw.m_scissor; + currentBind.clear(); + } + + continue; + } } const uint64_t newFlags = draw.m_stateFlags; @@ -3579,11 +3767,6 @@ namespace bgfx { namespace mtl Rect scissorRect; scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); - if (scissorRect.isZeroArea() ) - { - continue; - } - rc.x = scissorRect.m_x; rc.y = scissorRect.m_y; rc.width = scissorRect.m_width; @@ -3593,7 +3776,10 @@ namespace bgfx { namespace mtl rce.setScissorRect(rc); } - if ( (BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK) & changedFlags + if ( (0 + | BGFX_STATE_WRITE_Z + | BGFX_STATE_DEPTH_TEST_MASK + ) & changedFlags || 0 != changedStencil) { setDepthStencilState(newFlags,newStencil); @@ -3608,7 +3794,7 @@ namespace bgfx { namespace mtl if (BGFX_STATE_CULL_MASK & changedFlags) { const uint64_t pt = newFlags&BGFX_STATE_CULL_MASK; - uint8_t cullIndex = uint8_t(pt>>BGFX_STATE_CULL_SHIFT); + const uint8_t cullIndex = uint8_t(pt>>BGFX_STATE_CULL_SHIFT); rce.setCullMode(s_cullMode[cullIndex]); } @@ -3643,18 +3829,63 @@ namespace bgfx { namespace mtl bool constantsChanged = draw.m_uniformBegin < draw.m_uniformEnd; rendererUpdateUniforms(this, _render->m_uniformBuffer[draw.m_uniformIdx], draw.m_uniformBegin, draw.m_uniformEnd); + bool vertexStreamChanged = hasVertexStreamChanged(currentState, draw); + if (key.m_program != programIdx - || (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE|BGFX_STATE_BLEND_INDEPENDENT|BGFX_STATE_MSAA|BGFX_STATE_BLEND_ALPHA_TO_COVERAGE) & changedFlags - || currentState.m_streamMask != draw.m_streamMask - || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx - || currentState.m_stream[0].m_decl.idx != draw.m_stream[0].m_decl.idx - || currentState.m_instanceDataStride != draw.m_instanceDataStride + || vertexStreamChanged + || (0 + | BGFX_STATE_BLEND_MASK + | BGFX_STATE_BLEND_EQUATION_MASK + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_BLEND_INDEPENDENT + | BGFX_STATE_MSAA + | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE + ) & changedFlags || ( (blendFactor != draw.m_rgba) && !!(newFlags & BGFX_STATE_BLEND_INDEPENDENT) ) ) { programIdx = key.m_program; - currentState.m_streamMask = draw.m_streamMask; - currentState.m_stream[0].m_decl = draw.m_stream[0].m_decl; - currentState.m_instanceDataStride = draw.m_instanceDataStride; + + currentState.m_streamMask = draw.m_streamMask; + currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; + currentState.m_instanceDataOffset = draw.m_instanceDataOffset; + currentState.m_instanceDataStride = draw.m_instanceDataStride; + + const VertexDecl* decls[BGFX_CONFIG_MAX_VERTEX_STREAMS]; + + uint32_t numVertices = draw.m_numVertices; + uint8_t numStreams = 0; + for (uint32_t idx = 0, streamMask = draw.m_streamMask, ntz = bx::uint32_cnttz(streamMask) + ; 0 != streamMask + ; streamMask >>= 1, idx += 1, ntz = bx::uint32_cnttz(streamMask), ++numStreams + ) + { + streamMask >>= ntz; + idx += ntz; + + currentState.m_stream[idx].m_decl = draw.m_stream[idx].m_decl; + currentState.m_stream[idx].m_handle = draw.m_stream[idx].m_handle; + currentState.m_stream[idx].m_startVertex = draw.m_stream[idx].m_startVertex; + + const uint16_t handle = draw.m_stream[idx].m_handle.idx; + const VertexBufferMtl& vb = m_vertexBuffers[handle]; + const uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[idx].m_decl.idx : vb.m_decl.idx; + const VertexDecl& vertexDecl = m_vertexDecls[decl]; + const uint32_t stride = vertexDecl.m_stride; + + decls[numStreams] = &vertexDecl; + + numVertices = bx::uint32_min(UINT32_MAX == draw.m_numVertices + ? vb.m_size/stride + : draw.m_numVertices + , numVertices + ); + const uint32_t offset = draw.m_stream[idx].m_startVertex * stride; + + rce.setVertexBuffer(vb.getBuffer(), offset, idx+1); + } + + currentState.m_numVertices = numVertices; if (kInvalidHandle == programIdx) { @@ -3666,30 +3897,39 @@ namespace bgfx { namespace mtl ProgramMtl& program = m_program[programIdx]; currentProgram = &program; - RenderPipelineState pipelineState = NULL; + RenderPipelineState pso = NULL; - if (isValid(draw.m_stream[0].m_handle) ) + if (0 < numStreams) { - uint16_t handle = draw.m_stream[0].m_handle.idx; - const VertexBufferMtl& vb = m_vertexBuffers[handle]; - VertexDeclHandle decl; - decl.idx = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - - pipelineState = program.getRenderPipelineState(newFlags, draw.m_rgba, fbh, decl, draw.m_instanceDataStride/16); + pso = getPipelineState( + newFlags + , draw.m_rgba + , fbh + , numStreams + , decls + , programIdx + , draw.m_instanceDataStride/16 + ); } - if (NULL == pipelineState) + if (NULL == pso) { currentProgram = NULL; programIdx = kInvalidHandle; continue; } - rce.setRenderPipelineState(pipelineState); + rce.setRenderPipelineState(pso); + } + + if (isValid(draw.m_instanceDataBuffer) ) + { + const VertexBufferMtl& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; + rce.setVertexBuffer(inst.getBuffer(), draw.m_instanceDataOffset, numStreams+1); } programChanged = - constantsChanged = true; + constantsChanged = true; } if (kInvalidHandle != programIdx) @@ -3699,14 +3939,14 @@ namespace bgfx { namespace mtl uint32_t vertexUniformBufferSize = program.m_vshConstantBufferSize; uint32_t fragmentUniformBufferSize = program.m_fshConstantBufferSize; - if (vertexUniformBufferSize) + if (0 != vertexUniformBufferSize) { m_uniformBufferVertexOffset = BX_ALIGN_MASK(m_uniformBufferVertexOffset, program.m_vshConstantBufferAlignmentMask); rce.setVertexBuffer(m_uniformBuffer, m_uniformBufferVertexOffset, 0); } m_uniformBufferFragmentOffset = m_uniformBufferVertexOffset + vertexUniformBufferSize; - if (fragmentUniformBufferSize) + if (0 != fragmentUniformBufferSize) { m_uniformBufferFragmentOffset = BX_ALIGN_MASK(m_uniformBufferFragmentOffset, program.m_fshConstantBufferAlignmentMask); rce.setFragmentBuffer(m_uniformBuffer, m_uniformBufferFragmentOffset, 0); @@ -3747,18 +3987,18 @@ namespace bgfx { namespace mtl const Binding& bind = renderBind.m_bind[stage]; Binding& current = currentBind.m_bind[stage]; - if (current.m_idx != bind.m_idx - || current.m_un.m_draw.m_textureFlags != bind.m_un.m_draw.m_textureFlags + if (current.m_idx != bind.m_idx + || current.m_samplerFlags != bind.m_samplerFlags || programChanged) { if (kInvalidHandle != bind.m_idx) { TextureMtl& texture = m_textures[bind.m_idx]; texture.commit(samplerInfo.m_index - , !samplerInfo.m_fragment - , samplerInfo.m_fragment - , bind.m_un.m_draw.m_textureFlags - ); + , !samplerInfo.m_fragment + , samplerInfo.m_fragment + , bind.m_samplerFlags + ); } } @@ -3766,37 +4006,6 @@ namespace bgfx { namespace mtl } } - if (currentState.m_streamMask != draw.m_streamMask - || currentState.m_stream[0].m_handle.idx != draw.m_stream[0].m_handle.idx - || currentState.m_stream[0].m_startVertex != draw.m_stream[0].m_startVertex - || currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx - || currentState.m_instanceDataOffset != draw.m_instanceDataOffset) - { - currentState.m_streamMask = draw.m_streamMask; - currentState.m_stream[0].m_handle = draw.m_stream[0].m_handle; - currentState.m_stream[0].m_startVertex = draw.m_stream[0].m_startVertex; - currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx; - currentState.m_instanceDataOffset = draw.m_instanceDataOffset; - - uint16_t handle = draw.m_stream[0].m_handle.idx; - if (kInvalidHandle != handle) - { - const VertexBufferMtl& vb = m_vertexBuffers[handle]; - - uint16_t decl = !isValid(vb.m_decl) ? draw.m_stream[0].m_decl.idx : vb.m_decl.idx; - const VertexDecl& vertexDecl = m_vertexDecls[decl]; - uint32_t offset = draw.m_stream[0].m_startVertex * vertexDecl.getStride(); - - rce.setVertexBuffer(vb.getBuffer(), offset, 1); - - if (isValid(draw.m_instanceDataBuffer) ) - { - const VertexBufferMtl& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx]; - rce.setVertexBuffer(inst.getBuffer(), draw.m_instanceDataOffset, 2); - } - } - } - if (0 != currentState.m_streamMask) { uint32_t numVertices = draw.m_numVertices; @@ -3902,8 +4111,8 @@ namespace bgfx { namespace mtl static int64_t min = frameTime; static int64_t max = frameTime; - min = bx::int64_min(min, frameTime); - max = bx::int64_max(max, frameTime); + min = bx::min(min, frameTime); + max = bx::max(max, frameTime); static uint32_t maxGpuLatency = 0; static double maxGpuElapsed = 0.0f; @@ -3930,7 +4139,9 @@ namespace bgfx { namespace mtl perfStats.gpuTimerFreq = m_gpuTimer.m_frequency; perfStats.numDraw = statsKeyType[0]; perfStats.numCompute = statsKeyType[1]; + perfStats.numBlit = _render->m_numBlitItems; perfStats.maxGpuLatency = maxGpuLatency; + bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); perfStats.gpuMemoryMax = -INT64_MAX; perfStats.gpuMemoryUsed = -INT64_MAX; @@ -3952,62 +4163,63 @@ namespace bgfx { namespace mtl tvm.clear(); uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f, " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " - , getRendererName() - ); + tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f + , " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " + , getRendererName() + ); pos = 10; - tvm.printf(10, pos++, 0x8e, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " - , double(frameTime)*toMs - , double(min)*toMs - , double(max)*toMs - , freq/frameTime - ); + tvm.printf(10, pos++, 0x8b, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " + , double(frameTime)*toMs + , double(min)*toMs + , double(max)*toMs + , freq/frameTime + ); - const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " - , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' - , 0 != msaa ? '\xfe' : ' ' - , 1<>BGFX_RESET_MSAA_SHIFT; + tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " + , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' + , 0 != msaa ? '\xfe' : ' ' + , 1<m_numRenderItems - , statsKeyType[0] - , statsKeyType[1] - , elapsedCpuMs - , elapsedCpuMs > maxGpuElapsed ? '>' : '<' - , maxGpuElapsed - , maxGpuLatency - ); + tvm.printf(10, pos++, 0x8b, " Submitted: %4d (draw %4d, compute %4d) / CPU %3.4f [ms] %c GPU %3.4f [ms] (latency %d)" + , _render->m_numRenderItems + , statsKeyType[0] + , statsKeyType[1] + , elapsedCpuMs + , elapsedCpuMs > maxGpuElapsed ? '>' : '<' + , maxGpuElapsed + , maxGpuLatency + ); maxGpuLatency = 0; maxGpuElapsed = 0.0; - for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii) + for (uint32_t ii = 0; ii < Topology::Count; ++ii) { - tvm.printf(10, pos++, 0x8e, " %10s: %7d (#inst: %5d), submitted: %7d" - , s_primName[ii] - , statsNumPrimsRendered[ii] - , statsNumInstances[ii] - , statsNumPrimsSubmitted[ii] - ); + tvm.printf(10, pos++, 0x8b, " %10s: %7d (#inst: %5d), submitted: %7d" + , getName(Topology::Enum(ii) ) + , statsNumPrimsRendered[ii] + , statsNumInstances[ii] + , statsNumPrimsSubmitted[ii] + ); } - tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); + tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); +// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); + tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); + tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); pos++; double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8e, " Capture: %3.4f [ms]", captureMs); + tvm.printf(10, pos++, 0x8b, " Capture: %3.4f [ms]", captureMs); - uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attr[2] = { 0x8c, 0x8a }; uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; - tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %3.4f [ms]", _render->m_waitSubmit*toMs); + tvm.printf(10, pos++, attr[attrIndex &1], " Submit wait: %3.4f [ms]", _render->m_waitSubmit*toMs); tvm.printf(10, pos++, attr[(attrIndex+1)&1], " Render wait: %3.4f [ms]", _render->m_waitRender*toMs); min = frameTime; @@ -4036,7 +4248,7 @@ namespace bgfx { namespace mtl if (m_screenshotTarget) { RenderPassDescriptor renderPassDescriptor = newRenderPassDescriptor(); - renderPassDescriptor.colorAttachments[0].texture = currentDrawable().texture; + renderPassDescriptor.colorAttachments[0].texture = m_mainFrameBuffer.m_swapChain->currentDrawable().texture; renderPassDescriptor.colorAttachments[0].storeAction = MTLStoreActionStore; rce = m_commandBuffer.renderCommandEncoderWithDescriptor(renderPassDescriptor); @@ -4045,7 +4257,7 @@ namespace bgfx { namespace mtl rce.setRenderPipelineState(m_screenshotBlitRenderPipelineState); - rce.setFragmentSamplerState(getSamplerState(BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP|BGFX_TEXTURE_MIN_POINT|BGFX_TEXTURE_MAG_POINT|BGFX_TEXTURE_MIP_POINT), 0); + rce.setFragmentSamplerState(getSamplerState(BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP|BGFX_SAMPLER_MIN_POINT|BGFX_SAMPLER_MAG_POINT|BGFX_SAMPLER_MIP_POINT), 0); rce.setFragmentTexture(m_screenshotTarget, 0); rce.drawPrimitives(MTLPrimitiveTypeTriangle, 0, 3, 1); @@ -4060,8 +4272,9 @@ namespace bgfx { namespace mtl namespace bgfx { namespace mtl { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_noop.cpp b/3rdparty/bgfx/src/renderer_noop.cpp index 02debefedc3..c4977464ff8 100644 --- a/3rdparty/bgfx/src/renderer_noop.cpp +++ b/3rdparty/bgfx/src/renderer_noop.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -22,7 +22,6 @@ namespace bgfx { namespace noop | BGFX_CAPS_FRAGMENT_ORDERING | BGFX_CAPS_GRAPHICS_DEBUGGER | BGFX_CAPS_HIDPI - | BGFX_CAPS_HMD | BGFX_CAPS_INDEX32 | BGFX_CAPS_INSTANCING | BGFX_CAPS_OCCLUSION_QUERY @@ -38,6 +37,36 @@ namespace bgfx { namespace noop | BGFX_CAPS_VERTEX_ATTRIB_HALF | BGFX_CAPS_VERTEX_ATTRIB_UINT10 ; + + // Pretend all features are available for all texture formats. + for (uint32_t formatIdx = 0; formatIdx < TextureFormat::Count; ++formatIdx) + { + g_caps.formats[formatIdx] = 0 + | BGFX_CAPS_FORMAT_TEXTURE_NONE + | BGFX_CAPS_FORMAT_TEXTURE_2D + | BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB + | BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED + | BGFX_CAPS_FORMAT_TEXTURE_3D + | BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB + | BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED + | BGFX_CAPS_FORMAT_TEXTURE_CUBE + | BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB + | BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED + | BGFX_CAPS_FORMAT_TEXTURE_VERTEX + | BGFX_CAPS_FORMAT_TEXTURE_IMAGE + | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER + | BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA + | BGFX_CAPS_FORMAT_TEXTURE_MSAA + | BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN + ; + } + + // Pretend we have no limits + g_caps.limits.maxTextureSize = 16384; + g_caps.limits.maxTextureLayers = 2048; + g_caps.limits.maxComputeBindings = g_caps.limits.maxTextureSamplers; + g_caps.limits.maxFBAttachments = BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; + g_caps.limits.maxVertexStreams = BGFX_CONFIG_MAX_VERTEX_STREAMS; } ~RendererContextNOOP() @@ -59,11 +88,11 @@ namespace bgfx { namespace noop return false; } - void flip(HMD& /*_hmd*/) override + void flip() override { } - void createIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/, uint16_t /*_flags*/) override + void createIndexBuffer(IndexBufferHandle /*_handle*/, const Memory* /*_mem*/, uint16_t /*_flags*/) override { } @@ -79,7 +108,7 @@ namespace bgfx { namespace noop { } - void createVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint16_t /*_flags*/) override + void createVertexBuffer(VertexBufferHandle /*_handle*/, const Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/, uint16_t /*_flags*/) override { } @@ -91,7 +120,7 @@ namespace bgfx { namespace noop { } - void updateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) override + void updateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, const Memory* /*_mem*/) override { } @@ -103,7 +132,7 @@ namespace bgfx { namespace noop { } - void updateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) override + void updateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, const Memory* /*_mem*/) override { } @@ -111,7 +140,7 @@ namespace bgfx { namespace noop { } - void createShader(ShaderHandle /*_handle*/, Memory* /*_mem*/) override + void createShader(ShaderHandle /*_handle*/, const Memory* /*_mem*/) override { } @@ -127,8 +156,9 @@ namespace bgfx { namespace noop { } - void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) override + void* createTexture(TextureHandle /*_handle*/, const Memory* /*_mem*/, uint64_t /*_flags*/, uint8_t /*_skip*/) override { + return NULL; } void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override @@ -147,7 +177,7 @@ namespace bgfx { namespace noop { } - void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) override + void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/, uint16_t /*_numLayers*/) override { } @@ -168,7 +198,7 @@ namespace bgfx { namespace noop { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) override + void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_format*/, TextureFormat::Enum /*_depthFormat*/) override { } @@ -208,8 +238,24 @@ namespace bgfx { namespace noop { } - void submit(Frame* /*_render*/, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& /*_textVideoMemBlitter*/) override + void submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& /*_textVideoMemBlitter*/) override { + const int64_t timerFreq = bx::getHPFrequency(); + const int64_t timeBegin = bx::getHPCounter(); + + Stats& perfStats = _render->m_perfStats; + perfStats.cpuTimeBegin = timeBegin; + perfStats.cpuTimeEnd = timeBegin; + perfStats.cpuTimerFreq = timerFreq; + + perfStats.gpuTimeBegin = 0; + perfStats.gpuTimeEnd = 0; + perfStats.gpuTimerFreq = 1000000000; + + bx::memSet(perfStats.numPrims, 0, sizeof(perfStats.numPrims) ); + + perfStats.gpuMemoryMax = -INT64_MAX; + perfStats.gpuMemoryUsed = -INT64_MAX; } void blitSetup(TextVideoMemBlitter& /*_blitter*/) override @@ -223,8 +269,9 @@ namespace bgfx { namespace noop static RendererContextNOOP* s_renderNOOP; - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); s_renderNOOP = BX_NEW(g_allocator, RendererContextNOOP); return s_renderNOOP; } diff --git a/3rdparty/bgfx/src/renderer_vk.cpp b/3rdparty/bgfx/src/renderer_vk.cpp index 5468aebc6a7..b3843e03047 100644 --- a/3rdparty/bgfx/src/renderer_vk.cpp +++ b/3rdparty/bgfx/src/renderer_vk.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -25,18 +25,11 @@ namespace bgfx { namespace vk { VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, 3, 3, 0 }, { VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP, 3, 1, 2 }, { VK_PRIMITIVE_TOPOLOGY_LINE_LIST, 2, 2, 0 }, + { VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, 2, 1, 1 }, { VK_PRIMITIVE_TOPOLOGY_POINT_LIST, 1, 1, 0 }, { VK_PRIMITIVE_TOPOLOGY_MAX_ENUM, 0, 0, 0 }, }; - - static const char* s_primName[] = - { - "TriList", - "TriStrip", - "Line", - "Point", - }; - BX_STATIC_ASSERT(BX_COUNTOF(s_primInfo) == BX_COUNTOF(s_primName)+1); + BX_STATIC_ASSERT(Topology::Count == BX_COUNTOF(s_primInfo)-1); static const uint32_t s_checkMsaa[] = { @@ -160,6 +153,15 @@ VK_IMPORT_DEVICE { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // PTC14A { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // PTC22 { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // PTC24 + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ATC + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ATCE + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ATCI + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ASTC4x4 + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ASTC5x5 + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ASTC6x6 + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ASTC8x5 + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ASTC8x6 + { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // ASTC10x5 { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // Unknown { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // R1 { VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED }, // A8 @@ -257,7 +259,7 @@ VK_IMPORT_DEVICE }; BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) ); - uint32_t fillVertexDecl(VkPipelineVertexInputStateCreateInfo& _vertexInputState, const VertexDecl& _decl) + uint32_t fillVertexDecl(const ShaderVK* _vsh, VkPipelineVertexInputStateCreateInfo& _vertexInputState, const VertexDecl& _decl) { VkVertexInputBindingDescription* inputBinding = const_cast(_vertexInputState.pVertexBindingDescriptions); VkVertexInputAttributeDescription* inputAttrib = const_cast(_vertexInputState.pVertexAttributeDescriptions); @@ -272,8 +274,8 @@ VK_IMPORT_DEVICE { if (UINT16_MAX != _decl.m_attributes[attr]) { - inputAttrib->location = numAttribs; - inputAttrib->binding = 0; + inputAttrib->location = _vsh->m_attrRemap[attr]; + inputAttrib->binding = 0; if (0 == _decl.m_attributes[attr]) { @@ -570,6 +572,12 @@ VK_IMPORT_DEVICE void setImageMemoryBarrier(VkCommandBuffer _commandBuffer, VkImage _image, VkImageLayout _oldLayout, VkImageLayout _newLayout) { + BX_CHECK(true + && _newLayout != VK_IMAGE_LAYOUT_UNDEFINED + && _newLayout != VK_IMAGE_LAYOUT_PREINITIALIZED + , "_newLayout cannot use VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED." + ); + VkAccessFlags srcAccessMask = 0; VkAccessFlags dstAccessMask = 0; VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; @@ -606,6 +614,7 @@ VK_IMPORT_DEVICE break; case VK_IMAGE_LAYOUT_PREINITIALIZED: + srcAccessMask |= VK_ACCESS_HOST_WRITE_BIT | VK_ACCESS_TRANSFER_WRITE_BIT; break; case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR: @@ -676,7 +685,7 @@ VK_IMPORT_DEVICE imb.subresourceRange.layerCount = 1; vkCmdPipelineBarrier(_commandBuffer , VK_PIPELINE_STAGE_ALL_COMMANDS_BIT - , VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT + , VK_PIPELINE_STAGE_ALL_COMMANDS_BIT , 0 , 0 , NULL @@ -691,8 +700,8 @@ VK_IMPORT_DEVICE { RendererContextVK() : m_allocatorCb(NULL) - , m_renderdocdll(NULL) - , m_vulkan1dll(NULL) + , m_renderDocDll(NULL) + , m_vulkan1Dll(NULL) , m_maxAnisotropy(1) , m_depthClamp(false) , m_wireframe(false) @@ -703,7 +712,7 @@ VK_IMPORT_DEVICE { } - bool init() + bool init(const Init& _init) { BX_UNUSED(s_checkMsaa, s_textureAddress); @@ -734,8 +743,13 @@ VK_IMPORT_DEVICE m_qfiGraphics = UINT32_MAX; m_qfiCompute = UINT32_MAX; - m_renderdocdll = loadRenderDoc(); - m_vulkan1dll = bx::dlopen( + if (_init.debug + || _init.profile) + { + m_renderDocDll = loadRenderDoc(); + } + + m_vulkan1Dll = bx::dlopen( #if BX_PLATFORM_WINDOWS "vulkan-1.dll" #elif BX_PLATFORM_ANDROID @@ -745,7 +759,7 @@ VK_IMPORT_DEVICE #endif // BX_PLATFORM_* ); - if (NULL == m_vulkan1dll) + if (NULL == m_vulkan1Dll) { BX_TRACE("Init error: Failed to load vulkan dynamic library."); goto error; @@ -754,10 +768,10 @@ VK_IMPORT_DEVICE errorState = ErrorState::LoadedVulkan1; BX_TRACE("Shared library functions:"); -#define VK_IMPORT_FUNC(_optional, _func) \ - _func = (PFN_##_func)bx::dlsym(m_vulkan1dll, #_func); \ - BX_TRACE("\t%p " #_func, _func); \ - imported &= _optional || NULL != _func +#define VK_IMPORT_FUNC(_optional, _func) \ + _func = (PFN_##_func)bx::dlsym(m_vulkan1Dll, #_func); \ + BX_TRACE("\t%p " #_func, _func); \ + imported &= _optional || NULL != _func VK_IMPORT #undef VK_IMPORT_FUNC @@ -838,9 +852,10 @@ VK_IMPORT errorState = ErrorState::InstanceCreated; BX_TRACE("Instance functions:"); -#define VK_IMPORT_INSTANCE_FUNC(_optional, _func) \ + +#define VK_IMPORT_INSTANCE_FUNC(_optional, _func) \ _func = (PFN_##_func)vkGetInstanceProcAddr(m_instance, #_func); \ - BX_TRACE("\t%p " #_func, _func); \ + BX_TRACE("\t%p " #_func, _func); \ imported &= _optional || NULL != _func VK_IMPORT_INSTANCE #undef VK_IMPORT_INSTANCE_FUNC @@ -852,6 +867,7 @@ VK_IMPORT_INSTANCE } m_debugReportCallback = VK_NULL_HANDLE; + if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) { VkDebugReportCallbackCreateInfoEXT drcb; @@ -961,8 +977,9 @@ VK_IMPORT_INSTANCE g_caps.vendorId = uint16_t(m_deviceProperties.vendorID); g_caps.deviceId = uint16_t(m_deviceProperties.deviceID); - g_caps.limits.maxTextureSize = m_deviceProperties.limits.maxImageDimension2D; - g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_deviceProperties.limits.maxFragmentOutputAttachments, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxTextureSize = m_deviceProperties.limits.maxImageDimension2D; + g_caps.limits.maxFBAttachments = uint8_t(bx::uint32_min(m_deviceProperties.limits.maxFragmentOutputAttachments, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) ); + g_caps.limits.maxComputeBindings = BGFX_MAX_COMPUTE_BINDINGS; { // VkFormatProperties fp; @@ -1187,7 +1204,7 @@ VK_IMPORT_DEVICE ad[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; ad[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; ad[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - ad[0].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + ad[0].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; ad[0].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; ad[1].flags = 0; ad[1].format = m_backBufferDepthStencilFormat; @@ -1196,7 +1213,7 @@ VK_IMPORT_DEVICE ad[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE; ad[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; ad[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - ad[1].initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; + ad[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; ad[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; VkAttachmentReference colorAr[1]; @@ -1282,14 +1299,23 @@ VK_IMPORT_DEVICE if (VK_SUCCESS != result) { - VkXcbSurfaceCreateInfoKHR sci; - sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; - sci.pNext = NULL; - sci.flags = 0; - sci.connection = (xcb_connection_t*)g_platformData.ndt; - union { void* ptr; xcb_window_t window; } cast = { g_platformData.nwh }; - sci.window = cast.window; - result = vkCreateXcbSurfaceKHR(m_instance, &sci, m_allocatorCb, &m_surface); + void* xcbdll = bx::dlopen("libX11-xcb.so.1"); + if (NULL != xcbdll) + { + typedef xcb_connection_t* (*PFN_XGETXCBCONNECTION)(Display*); + PFN_XGETXCBCONNECTION XGetXCBConnection = (PFN_XGETXCBCONNECTION)bx::dlsym(xcbdll, "XGetXCBConnection"); + + VkXcbSurfaceCreateInfoKHR sci; + sci.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; + sci.pNext = NULL; + sci.flags = 0; + sci.connection = XGetXCBConnection( (Display*)g_platformData.ndt); + union { void* ptr; xcb_window_t window; } cast = { g_platformData.nwh }; + sci.window = cast.window; + result = vkCreateXcbSurfaceKHR(m_instance, &sci, m_allocatorCb, &m_surface); + + bx::dlclose(xcbdll); + } } } #else @@ -1361,8 +1387,8 @@ VK_IMPORT_DEVICE m_sci.minImageCount = BX_COUNTOF(m_backBufferColorImage); m_sci.imageFormat = surfaceFormats[surfaceFormatIdx].format; m_sci.imageColorSpace = surfaceFormats[surfaceFormatIdx].colorSpace; - m_sci.imageExtent.width = 1280; - m_sci.imageExtent.height = 720; + m_sci.imageExtent.width = _init.resolution.width; + m_sci.imageExtent.height = _init.resolution.height; m_sci.imageArrayLayers = 1; m_sci.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; m_sci.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; @@ -1434,7 +1460,7 @@ VK_IMPORT_DEVICE ici.sharingMode = VK_SHARING_MODE_EXCLUSIVE; ici.queueFamilyIndexCount = 0; //m_sci.queueFamilyIndexCount; ici.pQueueFamilyIndices = NULL; //m_sci.pQueueFamilyIndices; - ici.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; + ici.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; result = vkCreateImage(m_device, &ici, m_allocatorCb, &m_backBufferDepthStencilImage); if (VK_SUCCESS != result) @@ -1766,11 +1792,13 @@ VK_IMPORT_DEVICE vkDestroy(m_pipelineLayout); vkDestroy(m_descriptorSetLayout); vkDestroy(m_descriptorPool); + BX_FALLTHROUGH; case ErrorState::CommandBuffersCreated: vkFreeCommandBuffers(m_device, m_commandPool, BX_COUNTOF(m_commandBuffers), m_commandBuffers); vkDestroy(m_commandPool); vkDestroy(m_fence); + BX_FALLTHROUGH; case ErrorState::SwapchainCreated: for (uint32_t ii = 0; ii < BX_COUNTOF(m_backBufferColorImageView); ++ii) @@ -1791,15 +1819,19 @@ VK_IMPORT_DEVICE } } vkDestroy(m_swapchain); + BX_FALLTHROUGH; case ErrorState::SurfaceCreated: vkDestroySurfaceKHR(m_instance, m_surface, m_allocatorCb); + BX_FALLTHROUGH; case ErrorState::RenderPassCreated: vkDestroy(m_renderPass); + BX_FALLTHROUGH; case ErrorState::DeviceCreated: vkDestroyDevice(m_device, m_allocatorCb); + BX_FALLTHROUGH; case ErrorState::InstanceCreated: if (VK_NULL_HANDLE != m_debugReportCallback) @@ -1808,12 +1840,14 @@ VK_IMPORT_DEVICE } vkDestroyInstance(m_instance, m_allocatorCb); + BX_FALLTHROUGH; case ErrorState::LoadedVulkan1: - bx::dlclose(m_vulkan1dll); - m_vulkan1dll = NULL; + bx::dlclose(m_vulkan1Dll); + m_vulkan1Dll = NULL; m_allocatorCb = NULL; - unloadRenderDoc(m_renderdocdll); + unloadRenderDoc(m_renderDocDll); + BX_FALLTHROUGH; case ErrorState::Default: break; @@ -1905,10 +1939,10 @@ VK_IMPORT_DEVICE vkDestroyInstance(m_instance, m_allocatorCb); - bx::dlclose(m_vulkan1dll); - m_vulkan1dll = NULL; + bx::dlclose(m_vulkan1Dll); + m_vulkan1Dll = NULL; m_allocatorCb = NULL; - unloadRenderDoc(m_renderdocdll); + unloadRenderDoc(m_renderDocDll); } RendererType::Enum getRendererType() const override @@ -1926,7 +1960,7 @@ VK_IMPORT_DEVICE return false; } - void flip(HMD& /*_hmd*/) override + void flip() override { if (VK_NULL_HANDLE != m_swapchain) { @@ -1943,7 +1977,7 @@ VK_IMPORT_DEVICE } } - void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem, uint16_t _flags) override + void createIndexBuffer(IndexBufferHandle _handle, const Memory* _mem, uint16_t _flags) override { m_indexBuffers[_handle.idx].create(_mem->size, _mem->data, _flags, false); } @@ -1964,7 +1998,7 @@ VK_IMPORT_DEVICE { } - void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override + void createVertexBuffer(VertexBufferHandle _handle, const Memory* _mem, VertexDeclHandle _declHandle, uint16_t _flags) override { m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle, _flags); } @@ -1979,7 +2013,7 @@ VK_IMPORT_DEVICE m_indexBuffers[_handle.idx].create(_size, NULL, _flags, false); } - void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { BX_UNUSED(_handle, _offset, _size, _mem); // m_indexBuffers[_handle.idx].update(m_commandBuffer, _offset, bx::uint32_min(_size, _mem->size), _mem->data); @@ -1996,7 +2030,7 @@ VK_IMPORT_DEVICE m_vertexBuffers[_handle.idx].create(_size, NULL, decl, _flags); } - void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) override + void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, const Memory* _mem) override { BX_UNUSED(_handle, _offset, _size, _mem); // m_vertexBuffers[_handle.idx].update(m_commandBuffer, _offset, bx::uint32_min(_size, _mem->size), _mem->data); @@ -2007,7 +2041,7 @@ VK_IMPORT_DEVICE m_vertexBuffers[_handle.idx].destroy(); } - void createShader(ShaderHandle _handle, Memory* _mem) override + void createShader(ShaderHandle _handle, const Memory* _mem) override { m_shaders[_handle.idx].create(_mem); } @@ -2027,8 +2061,9 @@ VK_IMPORT_DEVICE m_program[_handle.idx].destroy(); } - void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) override + void* createTexture(TextureHandle /*_handle*/, const Memory* /*_mem*/, uint64_t /*_flags*/, uint8_t /*_skip*/) override { + return NULL; } void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override @@ -2047,7 +2082,7 @@ VK_IMPORT_DEVICE { } - void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/) override + void resizeTexture(TextureHandle /*_handle*/, uint16_t /*_width*/, uint16_t /*_height*/, uint8_t /*_numMips*/, uint16_t /*_numLayers*/) override { } @@ -2068,7 +2103,7 @@ VK_IMPORT_DEVICE { } - void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_depthFormat*/) override + void createFrameBuffer(FrameBufferHandle /*_handle*/, void* /*_nwh*/, uint32_t /*_width*/, uint32_t /*_height*/, TextureFormat::Enum /*_format*/, TextureFormat::Enum /*_depthFormat*/) override { } @@ -2087,7 +2122,7 @@ VK_IMPORT_DEVICE void* data = BX_ALLOC(g_allocator, size); bx::memSet(data, 0, size); m_uniforms[_handle.idx] = data; - m_uniformReg.add(_handle, _name, data); + m_uniformReg.add(_handle, _name); } void destroyUniform(UniformHandle _handle) override @@ -2141,7 +2176,7 @@ VK_IMPORT_DEVICE void updateResolution(const Resolution& _resolution) { - if (!!(_resolution.m_flags & BGFX_RESET_MAXANISOTROPY) ) + if (!!(_resolution.reset & BGFX_RESET_MAXANISOTROPY) ) { m_maxAnisotropy = UINT32_MAX; } @@ -2150,7 +2185,7 @@ VK_IMPORT_DEVICE m_maxAnisotropy = 1; } - bool depthClamp = !!(_resolution.m_flags & BGFX_RESET_DEPTH_CLAMP); + bool depthClamp = !!(_resolution.reset & BGFX_RESET_DEPTH_CLAMP); if (m_depthClamp != depthClamp) { @@ -2158,20 +2193,20 @@ VK_IMPORT_DEVICE m_pipelineStateCache.invalidate(); } - uint32_t flags = _resolution.m_flags & ~(BGFX_RESET_HMD_RECENTER | BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP); + uint32_t flags = _resolution.reset & ~(BGFX_RESET_MAXANISOTROPY | BGFX_RESET_DEPTH_CLAMP); - if (m_resolution.m_width != _resolution.m_width - || m_resolution.m_height != _resolution.m_height - || m_resolution.m_flags != flags) + if (m_resolution.width != _resolution.width + || m_resolution.height != _resolution.height + || m_resolution.reset != flags) { flags &= ~BGFX_RESET_INTERNAL_FORCE; - bool resize = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK) == (_resolution.m_flags&BGFX_RESET_MSAA_MASK); + bool resize = (m_resolution.reset&BGFX_RESET_MSAA_MASK) == (_resolution.reset&BGFX_RESET_MSAA_MASK); m_resolution = _resolution; - m_resolution.m_flags = flags; + m_resolution.reset = flags; - m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height); + m_textVideoMem.resize(false, _resolution.width, _resolution.height); m_textVideoMem.clear(); #if 1 @@ -2376,16 +2411,11 @@ VK_IMPORT_DEVICE { VkPipelineColorBlendAttachmentState* bas = const_cast(_desc.pAttachments); - uint8_t writeMask = (_state & BGFX_STATE_ALPHA_WRITE) - ? VK_COLOR_COMPONENT_A_BIT - : 0 - ; - writeMask |= (_state & BGFX_STATE_RGB_WRITE) - ? VK_COLOR_COMPONENT_R_BIT - | VK_COLOR_COMPONENT_G_BIT - | VK_COLOR_COMPONENT_B_BIT - : 0 - ; + uint8_t writeMask = 0; + writeMask |= (_state & BGFX_STATE_WRITE_R) ? VK_COLOR_COMPONENT_R_BIT : 0; + writeMask |= (_state & BGFX_STATE_WRITE_G) ? VK_COLOR_COMPONENT_G_BIT : 0; + writeMask |= (_state & BGFX_STATE_WRITE_B) ? VK_COLOR_COMPONENT_B_BIT : 0; + writeMask |= (_state & BGFX_STATE_WRITE_A) ? VK_COLOR_COMPONENT_A_BIT : 0; bas->blendEnable = !!(BGFX_STATE_BLEND_MASK & _state); @@ -2492,7 +2522,7 @@ VK_IMPORT_DEVICE _desc.pNext = NULL; _desc.flags = 0; _desc.depthTestEnable = 0 != func; - _desc.depthWriteEnable = !!(BGFX_STATE_DEPTH_WRITE & _state); + _desc.depthWriteEnable = !!(BGFX_STATE_WRITE_Z & _state); _desc.depthCompareOp = s_cmpFunc[func]; _desc.depthBoundsTestEnable = VK_FALSE; @@ -2539,7 +2569,7 @@ VK_IMPORT_DEVICE decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr; } - uint32_t num = fillVertexDecl(_vertexInputState, decl); + uint32_t num = fillVertexDecl(_program.m_vsh, _vertexInputState, decl); // const D3D12_INPUT_ELEMENT_DESC inst = { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D12_APPEND_ALIGNED_ELEMENT, D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1 }; @@ -2572,9 +2602,9 @@ VK_IMPORT_DEVICE ProgramVK& program = m_program[_programIdx]; _state &= 0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE - | BGFX_STATE_DEPTH_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A + | BGFX_STATE_WRITE_Z | BGFX_STATE_DEPTH_TEST_MASK | BGFX_STATE_BLEND_MASK | BGFX_STATE_BLEND_EQUATION_MASK @@ -2587,7 +2617,7 @@ VK_IMPORT_DEVICE | BGFX_STATE_PT_MASK ; - _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK); + _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, ~BGFX_STENCIL_FUNC_REF_MASK); VertexDecl decl; bx::memCopy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) ); @@ -2967,27 +2997,28 @@ VK_IMPORT_DEVICE // VK_CHECK(vkWaitForFences(m_device, 1, &m_fence, true, INT64_MAX) ); } - uint32_t selectMemoryType(uint32_t memoryTypeBits, uint32_t propertyFlags) + uint32_t selectMemoryType(uint32_t _memoryTypeBits, uint32_t _propertyFlags) const { - for (uint32_t ii = 0; ii < m_memoryProperties.memoryTypeCount; ++ii) + for (uint32_t ii = 0, num = m_memoryProperties.memoryTypeCount; ii < num; ++ii) { - if ( ( ((1<init() ) + if (!s_renderVK->init(_init) ) { BX_DELETE(g_allocator, s_renderVK); s_renderVK = NULL; @@ -3325,7 +3356,8 @@ VK_DESTROY bci.flags = 0; bci.size = _size; bci.usage = 0 - | (_vertex ? VK_BUFFER_USAGE_VERTEX_BUFFER_BIT : VK_BUFFER_USAGE_INDEX_BUFFER_BIT) + | (m_dynamic ? VK_BUFFER_USAGE_TRANSFER_DST_BIT : 0) + | (_vertex ? VK_BUFFER_USAGE_VERTEX_BUFFER_BIT : VK_BUFFER_USAGE_INDEX_BUFFER_BIT) ; bci.sharingMode = VK_SHARING_MODE_EXCLUSIVE; bci.queueFamilyIndexCount = 0; @@ -3405,21 +3437,35 @@ VK_DESTROY VkShaderStageFlagBits shaderStage; BX_UNUSED(shaderStage); - switch (magic) - { - case BGFX_CHUNK_MAGIC_CSH: shaderStage = VK_SHADER_STAGE_COMPUTE_BIT; break; - case BGFX_CHUNK_MAGIC_FSH: shaderStage = VK_SHADER_STAGE_FRAGMENT_BIT; break; - case BGFX_CHUNK_MAGIC_VSH: shaderStage = VK_SHADER_STAGE_VERTEX_BIT; break; - default: - BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic); - break; + if (isShaderType(magic, 'C') ) + { + shaderStage = VK_SHADER_STAGE_COMPUTE_BIT; + } + else if (isShaderType(magic, 'F') ) + { + shaderStage = VK_SHADER_STAGE_FRAGMENT_BIT; + } + else if (isShaderType(magic, 'V') ) + { + shaderStage = VK_SHADER_STAGE_VERTEX_BIT; } - bool fragment = BGFX_CHUNK_MAGIC_FSH == magic; + const bool fragment = isShaderType(magic, 'F'); - uint32_t iohash; - bx::read(&reader, iohash); + uint32_t hashIn; + bx::read(&reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) + { + hashOut = hashIn; + } + else + { + bx::read(&reader, hashOut); + } uint16_t count; bx::read(&reader, count); @@ -3428,7 +3474,7 @@ VK_DESTROY m_numUniforms = count; BX_TRACE("%s Shader consts %d" - , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute" + , getShaderTypeName(magic) , count ); @@ -3509,32 +3555,14 @@ VK_DESTROY uint32_t shaderSize; bx::read(&reader, shaderSize); -#if 1 const void* code = reader.getDataPtr(); bx::skip(&reader, shaderSize+1); - m_code = alloc( ( ( (shaderSize+3)/4)*4) ); - bx::memSet(m_code->data, 0, m_code->size); + m_code = alloc(shaderSize); bx::memCopy(m_code->data , code , shaderSize ); -#else -#include "../examples/runtime/shaders/spv/vert.spv.h" -#include "../examples/runtime/shaders/spv/frag.spv.h" - - shaderSize = BGFX_CHUNK_MAGIC_VSH == magic - ? sizeof(vs_cubes_spv) - : sizeof(fs_cubes_spv) - ; - m_code = alloc(shaderSize); - bx::memCopy(m_code->data - , BGFX_CHUNK_MAGIC_VSH == magic - ? vs_cubes_spv - : fs_cubes_spv - , shaderSize - ); -#endif // 0 VkShaderModuleCreateInfo smci; smci.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; @@ -3549,48 +3577,36 @@ VK_DESTROY , &m_module ) ); - bx::memSet(m_attrMask, 0, sizeof(m_attrMask) ); - m_attrMask[Attrib::Position] = UINT16_MAX; - m_attrMask[Attrib::Color0] = UINT16_MAX; - iohash = 0; + bx::memSet(m_attrMask, 0, sizeof(m_attrMask) ); + bx::memSet(m_attrRemap, 0, sizeof(m_attrRemap) ); - if (BGFX_CHUNK_MAGIC_VSH == magic) - { - m_predefined[0].m_loc = 0; - m_predefined[0].m_count = 4; - m_predefined[0].m_type = uint8_t(PredefinedUniform::ModelViewProj); - m_numPredefined = 1; - m_size = 64; - } - else - { - m_size = 0; - m_numPredefined = 0; - } + bx::read(&reader, m_numAttrs); - uint8_t numAttrs = 0; -// bx::read(&reader, numAttrs); -// -// for (uint32_t ii = 0; ii < numAttrs; ++ii) -// { -// uint16_t id; -// bx::read(&reader, id); -// -// Attrib::Enum attr = idToAttrib(id); -// -// if (Attrib::Count != attr) -// { -// m_attrMask[attr] = UINT16_MAX; -// } -// } + for (uint8_t ii = 0; ii < m_numAttrs; ++ii) + { + uint16_t id; + bx::read(&reader, id); + + Attrib::Enum attr = idToAttrib(id); + + if (Attrib::Count != attr) + { + m_attrMask[attr] = UINT16_MAX; + m_attrRemap[attr] = ii; + } + } bx::HashMurmur2A murmur; murmur.begin(); - murmur.add(iohash); + murmur.add(hashIn); + murmur.add(hashOut); murmur.add(m_code->data, m_code->size); - murmur.add(numAttrs); - murmur.add(m_attrMask, numAttrs); + murmur.add(m_numAttrs); + murmur.add(m_attrMask, m_numAttrs); + murmur.add(m_attrRemap, m_numAttrs); m_hash = murmur.end(); + + bx::read(&reader, m_size); } void ShaderVK::destroy() @@ -3663,8 +3679,6 @@ VK_DESTROY currentState.m_stateFlags = BGFX_STATE_NONE; currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE); - _render->m_hmdInitialized = false; - const bool hmdEnabled = false; ViewState viewState(_render, hmdEnabled); viewState.reset(_render, hmdEnabled); @@ -3696,6 +3710,9 @@ VK_DESTROY Rect viewScissorRect; viewScissorRect.clear(); + const uint32_t maxComputeBindings = g_caps.limits.maxComputeBindings; + BX_UNUSED(maxComputeBindings); + uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {}; uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {}; @@ -3840,7 +3857,7 @@ BX_UNUSED(currentSamplerStateIdx); clearQuad(clearRect, clr, _render->m_colorPalette); } - prim = s_primInfo[BX_COUNTOF(s_primName)]; // Force primitive type update. + prim = s_primInfo[Topology::Count]; // Force primitive type update. submitBlit(bs, view); } @@ -3880,7 +3897,7 @@ BX_UNUSED(currentSamplerStateIdx); // D3D12_GPU_DESCRIPTOR_HANDLE srvHandle[BGFX_MAX_COMPUTE_BINDINGS] = {}; // uint32_t samplerFlags[BGFX_MAX_COMPUTE_BINDINGS] = {}; // -// for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii) +// for (uint32_t ii = 0; ii < maxComputeBindings; ++ii) // { // const Binding& bind = renderBind.m_bind[ii]; // if (kInvalidHandle != bind.m_idx) @@ -3891,15 +3908,15 @@ BX_UNUSED(currentSamplerStateIdx); // { // TextureD3D12& texture = m_textures[bind.m_idx]; // -// if (Access::Read != bind.m_un.m_compute.m_access) +// if (Access::Read != bind.m_access) // { // texture.setState(m_commandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); -// scratchBuffer.allocUav(srvHandle[ii], texture, bind.m_un.m_compute.m_mip); +// scratchBuffer.allocUav(srvHandle[ii], texture, bind.m_mip); // } // else // { // texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); -// scratchBuffer.allocSrv(srvHandle[ii], texture, bind.m_un.m_compute.m_mip); +// scratchBuffer.allocSrv(srvHandle[ii], texture, bind.m_mip); // samplerFlags[ii] = texture.m_flags; // } // } @@ -3913,7 +3930,7 @@ BX_UNUSED(currentSamplerStateIdx); // : m_vertexBuffers[bind.m_idx] // ; // -// if (Access::Read != bind.m_un.m_compute.m_access) +// if (Access::Read != bind.m_access) // { // buffer.setState(m_commandList, D3D12_RESOURCE_STATE_UNORDERED_ACCESS); // scratchBuffer.allocUav(srvHandle[ii], buffer); @@ -3929,7 +3946,7 @@ BX_UNUSED(currentSamplerStateIdx); // } // } // -// uint16_t samplerStateIdx = getSamplerState(samplerFlags, BGFX_MAX_COMPUTE_BINDINGS, _render->m_colorPalette); +// uint16_t samplerStateIdx = getSamplerState(samplerFlags, maxComputeBindings, _render->m_colorPalette); // if (samplerStateIdx != currentSamplerStateIdx) // { // currentSamplerStateIdx = samplerStateIdx; @@ -4012,12 +4029,26 @@ BX_UNUSED(currentSamplerStateIdx); const RenderDraw& draw = renderItem.draw; const bool hasOcclusionQuery = false; //0 != (draw.m_stateFlags & BGFX_STATE_INTERNAL_OCCLUSION_QUERY); -// if (isValid(draw.m_occlusionQuery) -// && !hasOcclusionQuery -// && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) ) -// { -// continue; -// } + { + const bool occluded = false //true +// && isValid(draw.m_occlusionQuery) +// && !hasOcclusionQuery +// && !isVisible(_render, draw.m_occlusionQuery, 0 != (draw.m_submitFlags&BGFX_SUBMIT_INTERNAL_OCCLUSION_VISIBLE) ) + ; + + if (occluded + || _render->m_frameCache.isZeroArea(viewScissorRect, draw.m_scissor) ) + { +// if (resetState) +// { +// currentState.clear(); +// currentState.m_scissor = !draw.m_scissor; +// currentBind.clear(); +// } + + continue; + } + } const uint64_t newFlags = draw.m_stateFlags; uint64_t changedFlags = currentState.m_stateFlags ^ draw.m_stateFlags; @@ -4041,7 +4072,7 @@ BX_UNUSED(currentSamplerStateIdx); // wchar_t* viewNameW = s_viewNameW[view]; // viewNameW[3] = L' '; // PIX_ENDEVENT(); -// PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW); +// PIX_BEGINEVENT(toRgba8(0xff, 0x00, 0x00, 0xff), viewNameW); } commandListChanged = true; @@ -4127,8 +4158,8 @@ BX_UNUSED(currentSamplerStateIdx); // TextureD3D12& texture = m_textures[bind.m_idx]; // texture.setState(m_commandList, D3D12_RESOURCE_STATE_GENERIC_READ); // scratchBuffer.allocSrv(srvHandle[stage], texture); -// samplerFlags[stage] = (0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & bind.m_un.m_draw.m_textureFlags) -// ? bind.m_un.m_draw.m_textureFlags +// samplerFlags[stage] = (0 == (BGFX_TEXTURE_INTERNAL_DEFAULT_SAMPLER & bind.m_textureFlags) +// ? bind.m_textureFlags // : texture.m_flags // ) & (BGFX_TEXTURE_SAMPLER_BITS_MASK|BGFX_TEXTURE_BORDER_COLOR_MASK) // ; @@ -4223,10 +4254,6 @@ BX_UNUSED(currentSamplerStateIdx); restoreScissor = true; Rect scissorRect; scissorRect.setIntersect(viewScissorRect, _render->m_frameCache.m_rectCache.m_cache[scissor]); - if (scissorRect.isZeroArea() ) - { - continue; - } VkRect2D rc; rc.offset.x = scissorRect.m_x; @@ -4360,8 +4387,8 @@ BX_UNUSED(currentSamplerStateIdx); static int64_t min = frameTime; static int64_t max = frameTime; - min = bx::int64_min(min, frameTime); - max = bx::int64_max(max, frameTime); + min = bx::min(min, frameTime); + max = bx::max(max, frameTime); static uint32_t maxGpuLatency = 0; static double maxGpuElapsed = 0.0f; @@ -4371,8 +4398,8 @@ BX_UNUSED(maxGpuLatency, maxGpuElapsed, elapsedGpuMs); static int64_t presentMin = 0; //m_presentElapsed; static int64_t presentMax = 0; //m_presentElapsed; BX_UNUSED(presentMin, presentMax); -// presentMin = bx::int64_min(presentMin, m_presentElapsed); -// presentMax = bx::int64_max(presentMax, m_presentElapsed); +// presentMin = bx::min(presentMin, m_presentElapsed); +// presentMax = bx::max(presentMax, m_presentElapsed); // m_gpuTimer.end(m_commandList); @@ -4395,13 +4422,15 @@ BX_UNUSED(presentMin, presentMax); // perfStats.gpuTimerFreq = m_gpuTimer.m_frequency; // perfStats.numDraw = statsKeyType[0]; // perfStats.numCompute = statsKeyType[1]; + perfStats.numBlit = _render->m_numBlitItems; // perfStats.maxGpuLatency = maxGpuLatency; + bx::memCopy(perfStats.numPrims, statsNumPrimsRendered, sizeof(perfStats.numPrims) ); perfStats.gpuMemoryMax = -INT64_MAX; perfStats.gpuMemoryUsed = -INT64_MAX; if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) { -// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats"); +// PIX_BEGINEVENT(toRgba8(0x40, 0x40, 0x40, 0xff), L"debugstats"); // m_needPresent = true; TextVideoMem& tvm = m_textVideoMem; @@ -4417,7 +4446,7 @@ BX_UNUSED(presentMin, presentMax); tvm.clear(); uint16_t pos = 0; - tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f + tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x8c : 0x8f , " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " " , getRendererName() ); @@ -4469,74 +4498,70 @@ BX_UNUSED(presentMin, presentMax); // ); pos = 10; - tvm.printf(10, pos++, 0x8e, " Frame: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " + tvm.printf(10, pos++, 0x8b, " Frame: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS " , double(frameTime)*toMs , double(min)*toMs , double(max)*toMs , freq/frameTime ); -// tvm.printf(10, pos++, 0x8e, " Present: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] " +// tvm.printf(10, pos++, 0x8b, " Present: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] " // , double(m_presentElapsed)*toMs // , double(presentMin)*toMs // , double(presentMax)*toMs // ); - char hmd[16]; - bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' '); - - const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; - tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d%s, [%c] MaxAnisotropy " - , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' ' + const uint32_t msaa = (m_resolution.reset&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT; + tvm.printf(10, pos++, 0x8b, " Reset flags: [%c] vsync, [%c] MSAAx%d, [%c] MaxAnisotropy " + , !!(m_resolution.reset&BGFX_RESET_VSYNC) ? '\xfe' : ' ' , 0 != msaa ? '\xfe' : ' ' , 1<m_numRenderItems , statsKeyType[0] , statsKeyType[1] , elapsedCpuMs ); - for (uint32_t ii = 0; ii < BX_COUNTOF(s_primName); ++ii) + for (uint32_t ii = 0; ii < Topology::Count; ++ii) { - tvm.printf(10, pos++, 0x8e, " %9s: %7d (#inst: %5d), submitted: %7d " - , s_primName[ii] + tvm.printf(10, pos++, 0x8b, " %9s: %7d (#inst: %5d), submitted: %7d " + , getName(Topology::Enum(ii) ) , statsNumPrimsRendered[ii] , statsNumInstances[ii] , statsNumPrimsSubmitted[ii] ); } -// tvm.printf(10, pos++, 0x8e, " Batch: %7dx%d indirect, %7d immediate " +// tvm.printf(10, pos++, 0x8b, " Batch: %7dx%d indirect, %7d immediate " // , m_batch.m_stats.m_numIndirect[BatchD3D12::Draw] // , m_batch.m_maxDrawPerBatch // , m_batch.m_stats.m_numImmediate[BatchD3D12::Draw] // ); -// tvm.printf(10, pos++, 0x8e, " %7dx%d indirect, %7d immediate " +// tvm.printf(10, pos++, 0x8b, " %7dx%d indirect, %7d immediate " // , m_batch.m_stats.m_numIndirect[BatchD3D12::DrawIndexed] // , m_batch.m_maxDrawPerBatch // , m_batch.m_stats.m_numImmediate[BatchD3D12::DrawIndexed] // ); - if (NULL != m_renderdocdll) + if (NULL != m_renderDocDll) { - tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] "); + tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] "); } - tvm.printf(10, pos++, 0x8e, " Indices: %7d ", statsNumIndices); -// tvm.printf(10, pos++, 0x8e, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); - tvm.printf(10, pos++, 0x8e, " DVB size: %7d ", _render->m_vboffset); - tvm.printf(10, pos++, 0x8e, " DIB size: %7d ", _render->m_iboffset); + tvm.printf(10, pos++, 0x8b, " Indices: %7d ", statsNumIndices); +// tvm.printf(10, pos++, 0x8b, " Uniform size: %7d, Max: %7d ", _render->m_uniformEnd, _render->m_uniformMax); + tvm.printf(10, pos++, 0x8b, " DVB size: %7d ", _render->m_vboffset); + tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset); pos++; - tvm.printf(10, pos++, 0x8e, " State cache: "); - tvm.printf(10, pos++, 0x8e, " PSO | Sampler | Bind | Queued "); - tvm.printf(10, pos++, 0x8e, " %6d " //| %6d | %6d | %6d " + tvm.printf(10, pos++, 0x8b, " State cache: "); + tvm.printf(10, pos++, 0x8b, " PSO | Sampler | Bind | Queued "); + tvm.printf(10, pos++, 0x8b, " %6d " //| %6d | %6d | %6d " , m_pipelineStateCache.getCount() // , m_samplerStateCache.getCount() // , bindLru.getCount() @@ -4545,9 +4570,9 @@ BX_UNUSED(presentMin, presentMax); pos++; double captureMs = double(captureElapsed)*toMs; - tvm.printf(10, pos++, 0x8e, " Capture: %7.4f [ms] ", captureMs); + tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms] ", captureMs); - uint8_t attr[2] = { 0x89, 0x8a }; + uint8_t attr[2] = { 0x8c, 0x8a }; uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender; tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %7.4f [ms] ", _render->m_waitSubmit*toMs); @@ -4565,7 +4590,7 @@ BX_UNUSED(presentMin, presentMax); } else if (_render->m_debug & BGFX_DEBUG_TEXT) { -// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext"); +// PIX_BEGINEVENT(toRgba8(0x40, 0x40, 0x40, 0xff), L"debugtext"); blit(this, _textVideoMemBlitter, _render->m_textVideoMem); @@ -4598,8 +4623,9 @@ BX_UNUSED(presentMin, presentMax); namespace bgfx { namespace vk { - RendererContextI* rendererCreate() + RendererContextI* rendererCreate(const Init& _init) { + BX_UNUSED(_init); return NULL; } diff --git a/3rdparty/bgfx/src/renderer_vk.h b/3rdparty/bgfx/src/renderer_vk.h index 90c352b5940..bd7ea608916 100644 --- a/3rdparty/bgfx/src/renderer_vk.h +++ b/3rdparty/bgfx/src/renderer_vk.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -32,21 +32,21 @@ #include "renderer.h" #include "debug_renderdoc.h" -#define VK_IMPORT \ - VK_IMPORT_FUNC(false, vkCreateInstance); \ - VK_IMPORT_FUNC(false, vkGetInstanceProcAddr); \ - VK_IMPORT_FUNC(false, vkGetDeviceProcAddr); \ +#define VK_IMPORT \ + VK_IMPORT_FUNC(false, vkCreateInstance); \ + VK_IMPORT_FUNC(false, vkGetInstanceProcAddr); \ + VK_IMPORT_FUNC(false, vkGetDeviceProcAddr); \ VK_IMPORT_FUNC(false, vkEnumerateInstanceExtensionProperties); \ - VK_IMPORT_FUNC(false, vkEnumerateInstanceLayerProperties); \ + VK_IMPORT_FUNC(false, vkEnumerateInstanceLayerProperties); \ #define VK_IMPORT_INSTANCE_ANDROID \ VK_IMPORT_INSTANCE_FUNC(true, vkCreateAndroidSurfaceKHR); -#define VK_IMPORT_INSTANCE_LINUX \ - VK_IMPORT_INSTANCE_FUNC(true, vkCreateXlibSurfaceKHR); \ +#define VK_IMPORT_INSTANCE_LINUX \ + VK_IMPORT_INSTANCE_FUNC(true, vkCreateXlibSurfaceKHR); \ VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXlibPresentationSupportKHR); \ - VK_IMPORT_INSTANCE_FUNC(true, vkCreateXcbSurfaceKHR); \ - VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXcbPresentationSupportKHR); \ + VK_IMPORT_INSTANCE_FUNC(true, vkCreateXcbSurfaceKHR); \ + VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceXcbPresentationSupportKHR); \ // VK_IMPORT_INSTANCE_FUNC(true, vkCreateWaylandSurfaceKHR); // VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceWaylandPresentationSupportKHR); @@ -57,143 +57,144 @@ VK_IMPORT_INSTANCE_FUNC(true, vkCreateWin32SurfaceKHR); \ VK_IMPORT_INSTANCE_FUNC(true, vkGetPhysicalDeviceWin32PresentationSupportKHR); -#define VK_IMPORT_INSTANCE \ - VK_IMPORT_INSTANCE_FUNC(false, vkDestroyInstance); \ - VK_IMPORT_INSTANCE_FUNC(false, vkEnumeratePhysicalDevices); \ - VK_IMPORT_INSTANCE_FUNC(false, vkEnumerateDeviceExtensionProperties); \ - VK_IMPORT_INSTANCE_FUNC(false, vkEnumerateDeviceLayerProperties); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceProperties); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceFormatProperties); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceImageFormatProperties); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceMemoryProperties); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceQueueFamilyProperties); \ +#define VK_IMPORT_INSTANCE \ + VK_IMPORT_INSTANCE_FUNC(false, vkDestroyInstance); \ + VK_IMPORT_INSTANCE_FUNC(false, vkEnumeratePhysicalDevices); \ + VK_IMPORT_INSTANCE_FUNC(false, vkEnumerateDeviceExtensionProperties); \ + VK_IMPORT_INSTANCE_FUNC(false, vkEnumerateDeviceLayerProperties); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceProperties); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceFormatProperties); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceImageFormatProperties); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceMemoryProperties); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceQueueFamilyProperties); \ VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceCapabilitiesKHR); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceFormatsKHR); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceFormatsKHR); \ VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfacePresentModesKHR); \ - VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceSupportKHR); \ - VK_IMPORT_INSTANCE_FUNC(false, vkCreateDevice); \ - VK_IMPORT_INSTANCE_FUNC(false, vkDestroyDevice); \ - VK_IMPORT_INSTANCE_FUNC(false, vkDestroySurfaceKHR); \ - /* VK_EXT_debug_report */ \ - VK_IMPORT_INSTANCE_FUNC(true, vkCreateDebugReportCallbackEXT); \ - VK_IMPORT_INSTANCE_FUNC(true, vkDestroyDebugReportCallbackEXT); \ - VK_IMPORT_INSTANCE_FUNC(true, vkDebugReportMessageEXT); \ + VK_IMPORT_INSTANCE_FUNC(false, vkGetPhysicalDeviceSurfaceSupportKHR); \ + VK_IMPORT_INSTANCE_FUNC(false, vkCreateDevice); \ + VK_IMPORT_INSTANCE_FUNC(false, vkDestroyDevice); \ + VK_IMPORT_INSTANCE_FUNC(false, vkDestroySurfaceKHR); \ + /* VK_EXT_debug_report */ \ + VK_IMPORT_INSTANCE_FUNC(true, vkCreateDebugReportCallbackEXT); \ + VK_IMPORT_INSTANCE_FUNC(true, vkDestroyDebugReportCallbackEXT); \ + VK_IMPORT_INSTANCE_FUNC(true, vkDebugReportMessageEXT); \ VK_IMPORT_INSTANCE_PLATFORM -#define VK_IMPORT_DEVICE \ - VK_IMPORT_DEVICE_FUNC(false, vkGetDeviceQueue); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateSwapchainKHR); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroySwapchainKHR); \ - VK_IMPORT_DEVICE_FUNC(false, vkGetSwapchainImagesKHR); \ - VK_IMPORT_DEVICE_FUNC(false, vkAcquireNextImageKHR); \ - VK_IMPORT_DEVICE_FUNC(false, vkQueuePresentKHR); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateFence); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyFence); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateSemaphore); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroySemaphore); \ - VK_IMPORT_DEVICE_FUNC(false, vkResetFences); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateCommandPool); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyCommandPool); \ - VK_IMPORT_DEVICE_FUNC(false, vkResetCommandPool); \ - VK_IMPORT_DEVICE_FUNC(false, vkAllocateCommandBuffers); \ - VK_IMPORT_DEVICE_FUNC(false, vkFreeCommandBuffers); \ - VK_IMPORT_DEVICE_FUNC(false, vkGetBufferMemoryRequirements); \ - VK_IMPORT_DEVICE_FUNC(false, vkGetImageMemoryRequirements); \ - VK_IMPORT_DEVICE_FUNC(false, vkAllocateMemory); \ - VK_IMPORT_DEVICE_FUNC(false, vkFreeMemory); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateImage); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyImage); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateImageView); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyImageView); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateBuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyBuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateFramebuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyFramebuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateRenderPass); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyRenderPass); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateShaderModule); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyShaderModule); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreatePipelineCache); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipelineCache); \ - VK_IMPORT_DEVICE_FUNC(false, vkGetPipelineCacheData); \ - VK_IMPORT_DEVICE_FUNC(false, vkMergePipelineCaches); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateGraphicsPipelines); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateComputePipelines); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipeline); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreatePipelineLayout); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipelineLayout); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateSampler); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroySampler); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateDescriptorSetLayout); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyDescriptorSetLayout); \ - VK_IMPORT_DEVICE_FUNC(false, vkCreateDescriptorPool); \ - VK_IMPORT_DEVICE_FUNC(false, vkDestroyDescriptorPool); \ - VK_IMPORT_DEVICE_FUNC(false, vkResetDescriptorPool); \ - VK_IMPORT_DEVICE_FUNC(false, vkAllocateDescriptorSets); \ - VK_IMPORT_DEVICE_FUNC(false, vkFreeDescriptorSets); \ - VK_IMPORT_DEVICE_FUNC(false, vkUpdateDescriptorSets); \ - VK_IMPORT_DEVICE_FUNC(false, vkQueueSubmit); \ - VK_IMPORT_DEVICE_FUNC(false, vkQueueWaitIdle); \ - VK_IMPORT_DEVICE_FUNC(false, vkDeviceWaitIdle); \ - VK_IMPORT_DEVICE_FUNC(false, vkWaitForFences); \ - VK_IMPORT_DEVICE_FUNC(false, vkBeginCommandBuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkEndCommandBuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdPipelineBarrier); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdBeginRenderPass); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdEndRenderPass); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdSetViewport); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdDraw); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndexed); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndirect); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndexedIndirect); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdDispatch); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdDispatchIndirect); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdBindPipeline); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdSetStencilReference); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdSetBlendConstants); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdSetScissor); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdBindDescriptorSets); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdBindIndexBuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdBindVertexBuffers); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdUpdateBuffer); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdClearColorImage); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdClearDepthStencilImage); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdClearAttachments); \ - VK_IMPORT_DEVICE_FUNC(false, vkCmdResolveImage); \ - VK_IMPORT_DEVICE_FUNC(false, vkMapMemory); \ - VK_IMPORT_DEVICE_FUNC(false, vkUnmapMemory); \ - VK_IMPORT_DEVICE_FUNC(false, vkFlushMappedMemoryRanges); \ +#define VK_IMPORT_DEVICE \ + VK_IMPORT_DEVICE_FUNC(false, vkGetDeviceQueue); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateSwapchainKHR); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroySwapchainKHR); \ + VK_IMPORT_DEVICE_FUNC(false, vkGetSwapchainImagesKHR); \ + VK_IMPORT_DEVICE_FUNC(false, vkAcquireNextImageKHR); \ + VK_IMPORT_DEVICE_FUNC(false, vkQueuePresentKHR); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateFence); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyFence); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateSemaphore); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroySemaphore); \ + VK_IMPORT_DEVICE_FUNC(false, vkResetFences); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateCommandPool); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyCommandPool); \ + VK_IMPORT_DEVICE_FUNC(false, vkResetCommandPool); \ + VK_IMPORT_DEVICE_FUNC(false, vkAllocateCommandBuffers); \ + VK_IMPORT_DEVICE_FUNC(false, vkFreeCommandBuffers); \ + VK_IMPORT_DEVICE_FUNC(false, vkGetBufferMemoryRequirements); \ + VK_IMPORT_DEVICE_FUNC(false, vkGetImageMemoryRequirements); \ + VK_IMPORT_DEVICE_FUNC(false, vkAllocateMemory); \ + VK_IMPORT_DEVICE_FUNC(false, vkFreeMemory); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateImage); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyImage); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateImageView); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyImageView); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateFramebuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyFramebuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateRenderPass); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyRenderPass); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateShaderModule); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyShaderModule); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreatePipelineCache); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipelineCache); \ + VK_IMPORT_DEVICE_FUNC(false, vkGetPipelineCacheData); \ + VK_IMPORT_DEVICE_FUNC(false, vkMergePipelineCaches); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateGraphicsPipelines); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateComputePipelines); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipeline); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreatePipelineLayout); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyPipelineLayout); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateSampler); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroySampler); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateDescriptorSetLayout); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyDescriptorSetLayout); \ + VK_IMPORT_DEVICE_FUNC(false, vkCreateDescriptorPool); \ + VK_IMPORT_DEVICE_FUNC(false, vkDestroyDescriptorPool); \ + VK_IMPORT_DEVICE_FUNC(false, vkResetDescriptorPool); \ + VK_IMPORT_DEVICE_FUNC(false, vkAllocateDescriptorSets); \ + VK_IMPORT_DEVICE_FUNC(false, vkFreeDescriptorSets); \ + VK_IMPORT_DEVICE_FUNC(false, vkUpdateDescriptorSets); \ + VK_IMPORT_DEVICE_FUNC(false, vkQueueSubmit); \ + VK_IMPORT_DEVICE_FUNC(false, vkQueueWaitIdle); \ + VK_IMPORT_DEVICE_FUNC(false, vkDeviceWaitIdle); \ + VK_IMPORT_DEVICE_FUNC(false, vkWaitForFences); \ + VK_IMPORT_DEVICE_FUNC(false, vkBeginCommandBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkEndCommandBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdPipelineBarrier); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdBeginRenderPass); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdEndRenderPass); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdSetViewport); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdDraw); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndexed); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndirect); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdDrawIndexedIndirect); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdDispatch); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdDispatchIndirect); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdBindPipeline); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdSetStencilReference); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdSetBlendConstants); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdSetScissor); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdBindDescriptorSets); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdBindIndexBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdBindVertexBuffers); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdUpdateBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdClearColorImage); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdClearDepthStencilImage); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdClearAttachments); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdResolveImage); \ + VK_IMPORT_DEVICE_FUNC(false, vkCmdCopyBuffer); \ + VK_IMPORT_DEVICE_FUNC(false, vkMapMemory); \ + VK_IMPORT_DEVICE_FUNC(false, vkUnmapMemory); \ + VK_IMPORT_DEVICE_FUNC(false, vkFlushMappedMemoryRanges); \ VK_IMPORT_DEVICE_FUNC(false, vkInvalidateMappedMemoryRanges); \ - VK_IMPORT_DEVICE_FUNC(false, vkBindBufferMemory); \ - VK_IMPORT_DEVICE_FUNC(false, vkBindImageMemory); \ - /* VK_EXT_debug_marker */ \ - VK_IMPORT_DEVICE_FUNC(true, vkDebugMarkerSetObjectTagEXT); \ - VK_IMPORT_DEVICE_FUNC(true, vkDebugMarkerSetObjectNameEXT); \ - VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerBeginEXT); \ - VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerEndEXT); \ - VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerInsertEXT); \ + VK_IMPORT_DEVICE_FUNC(false, vkBindBufferMemory); \ + VK_IMPORT_DEVICE_FUNC(false, vkBindImageMemory); \ + /* VK_EXT_debug_marker */ \ + VK_IMPORT_DEVICE_FUNC(true, vkDebugMarkerSetObjectTagEXT); \ + VK_IMPORT_DEVICE_FUNC(true, vkDebugMarkerSetObjectNameEXT); \ + VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerBeginEXT); \ + VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerEndEXT); \ + VK_IMPORT_DEVICE_FUNC(true, vkCmdDebugMarkerInsertEXT); \ -#define VK_DESTROY \ - VK_DESTROY_FUNC(Buffer); \ - VK_DESTROY_FUNC(CommandPool); \ - VK_DESTROY_FUNC(DescriptorPool); \ +#define VK_DESTROY \ + VK_DESTROY_FUNC(Buffer); \ + VK_DESTROY_FUNC(CommandPool); \ + VK_DESTROY_FUNC(DescriptorPool); \ VK_DESTROY_FUNC(DescriptorSetLayout); \ - VK_DESTROY_FUNC(Fence); \ - VK_DESTROY_FUNC(Framebuffer); \ - VK_DESTROY_FUNC(Image); \ - VK_DESTROY_FUNC(ImageView); \ - VK_DESTROY_FUNC(Pipeline); \ - VK_DESTROY_FUNC(PipelineCache); \ - VK_DESTROY_FUNC(PipelineLayout); \ - VK_DESTROY_FUNC(RenderPass); \ - VK_DESTROY_FUNC(Semaphore); \ - VK_DESTROY_FUNC(ShaderModule); \ - VK_DESTROY_FUNC(SwapchainKHR); \ + VK_DESTROY_FUNC(Fence); \ + VK_DESTROY_FUNC(Framebuffer); \ + VK_DESTROY_FUNC(Image); \ + VK_DESTROY_FUNC(ImageView); \ + VK_DESTROY_FUNC(Pipeline); \ + VK_DESTROY_FUNC(PipelineCache); \ + VK_DESTROY_FUNC(PipelineLayout); \ + VK_DESTROY_FUNC(RenderPass); \ + VK_DESTROY_FUNC(Semaphore); \ + VK_DESTROY_FUNC(ShaderModule); \ + VK_DESTROY_FUNC(SwapchainKHR); \ -#define _VK_CHECK(_check, _call) \ - BX_MACRO_BLOCK_BEGIN \ - /*BX_TRACE(#_call);*/ \ - VkResult vkresult = _call; \ +#define _VK_CHECK(_check, _call) \ + BX_MACRO_BLOCK_BEGIN \ + /*BX_TRACE(#_call);*/ \ + VkResult vkresult = _call; \ _check(VK_SUCCESS == vkresult, #_call "; VK error 0x%x: %s", vkresult, getName(vkresult) ); \ BX_MACRO_BLOCK_END @@ -205,17 +206,18 @@ namespace bgfx { namespace vk { -#define VK_DESTROY_FUNC(_name) \ - struct Vk##_name \ - { \ - ::Vk##_name vk; \ - Vk##_name() {} \ - Vk##_name(::Vk##_name _vk) : vk(_vk) {} \ - operator ::Vk##_name() { return vk; } \ - operator ::Vk##_name() const { return vk; } \ - ::Vk##_name* operator &() { return &vk; } \ - const ::Vk##_name* operator &() const { return &vk; } \ - }; \ + +#define VK_DESTROY_FUNC(_name) \ + struct Vk##_name \ + { \ + ::Vk##_name vk; \ + Vk##_name() {} \ + Vk##_name(::Vk##_name _vk) : vk(_vk) {} \ + operator ::Vk##_name() { return vk; } \ + operator ::Vk##_name() const { return vk; } \ + ::Vk##_name* operator &() { return &vk; } \ + const ::Vk##_name* operator &() const { return &vk; } \ + }; \ BX_STATIC_ASSERT(sizeof(::Vk##_name) == sizeof(Vk##_name) ); \ void vkDestroy(Vk##_name&) VK_DESTROY @@ -379,11 +381,13 @@ VK_DESTROY PredefinedUniform m_predefined[PredefinedUniform::Count]; uint16_t m_attrMask[Attrib::Count]; + uint8_t m_attrRemap[Attrib::Count]; uint32_t m_hash; uint16_t m_numUniforms; uint16_t m_size; uint8_t m_numPredefined; + uint8_t m_numAttrs; }; struct ProgramVK diff --git a/3rdparty/bgfx/src/shader.cpp b/3rdparty/bgfx/src/shader.cpp index 6e967d534eb..f6dfb3e350d 100644 --- a/3rdparty/bgfx/src/shader.cpp +++ b/3rdparty/bgfx/src/shader.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -10,30 +10,36 @@ namespace bgfx { - static bool printAsm(uint32_t, const DxbcInstruction& _instruction, void* _userData) + static bool printAsm(uint32_t _offset, const DxbcInstruction& _instruction, void* _userData) { + BX_UNUSED(_offset); bx::WriterI* writer = reinterpret_cast(_userData); char temp[512]; toString(temp, sizeof(temp), _instruction); bx::write(writer, temp, (int32_t)bx::strLen(temp) ); + bx::write(writer, '\n'); return true; } - static bool printAsm(uint32_t, const Dx9bcInstruction& _instruction, void* _userData) + static bool printAsm(uint32_t _offset, const Dx9bcInstruction& _instruction, void* _userData) { + BX_UNUSED(_offset); bx::WriterI* writer = reinterpret_cast(_userData); char temp[512]; toString(temp, sizeof(temp), _instruction); bx::write(writer, temp, (int32_t)bx::strLen(temp) ); + bx::write(writer, '\n'); return true; } - static bool printAsm(uint32_t, const SpvInstruction& _instruction, void* _userData) + static bool printAsm(uint32_t _offset, const SpvInstruction& _instruction, void* _userData) { + BX_UNUSED(_offset); bx::WriterI* writer = reinterpret_cast(_userData); char temp[512]; toString(temp, sizeof(temp), _instruction); bx::write(writer, temp, (int32_t)bx::strLen(temp) ); + bx::write(writer, '\n'); return true; } @@ -69,14 +75,23 @@ namespace bgfx uint32_t magic; bx::peek(_reader, magic); - if (BGFX_CHUNK_MAGIC_CSH == magic - || BGFX_CHUNK_MAGIC_FSH == magic - || BGFX_CHUNK_MAGIC_VSH == magic) + if (isShaderBin(magic) ) { bx::read(_reader, magic); - uint32_t iohash; - bx::read(_reader, iohash, _err); + uint32_t hashIn; + bx::read(_reader, hashIn); + + uint32_t hashOut; + + if (isShaderVerLess(magic, 6) ) + { + hashOut = hashIn; + } + else + { + bx::read(_reader, hashOut); + } uint16_t count; bx::read(_reader, count, _err); diff --git a/3rdparty/bgfx/src/shader.h b/3rdparty/bgfx/src/shader.h index 8d1fcc16842..bd55dc91f90 100644 --- a/3rdparty/bgfx/src/shader.h +++ b/3rdparty/bgfx/src/shader.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/shader_dx9bc.cpp b/3rdparty/bgfx/src/shader_dx9bc.cpp index a136b9249bb..988bec096f0 100644 --- a/3rdparty/bgfx/src/shader_dx9bc.cpp +++ b/3rdparty/bgfx/src/shader_dx9bc.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/shader_dx9bc.h b/3rdparty/bgfx/src/shader_dx9bc.h index f549c9876c4..618955f9921 100644 --- a/3rdparty/bgfx/src/shader_dx9bc.h +++ b/3rdparty/bgfx/src/shader_dx9bc.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/shader_dxbc.cpp b/3rdparty/bgfx/src/shader_dxbc.cpp index 908fd11d65e..49da315b3e9 100644 --- a/3rdparty/bgfx/src/shader_dxbc.cpp +++ b/3rdparty/bgfx/src/shader_dxbc.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -147,7 +147,7 @@ namespace bgfx { 5, 0 }, // GATHER4_C { 5, 0 }, // GATHER4_PO { 0, 0 }, // GATHER4_PO_C - { 0, 0 }, // RCP + { 2, 0 }, // RCP { 0, 0 }, // F32TOF16 { 0, 0 }, // F16TOF32 { 0, 0 }, // UADDC @@ -156,8 +156,8 @@ namespace bgfx { 0, 0 }, // FIRSTBIT_HI { 0, 0 }, // FIRSTBIT_LO { 0, 0 }, // FIRSTBIT_SHI - { 0, 0 }, // UBFE - { 0, 0 }, // IBFE + { 4, 0 }, // UBFE + { 4, 0 }, // IBFE { 5, 0 }, // BFI { 0, 0 }, // BFREV { 5, 0 }, // SWAPC @@ -550,6 +550,17 @@ namespace bgfx }; BX_STATIC_ASSERT(BX_COUNTOF(s_dxbcOperandType) == DxbcOperandType::Count); + static const char* s_dxbcCustomDataClass[] = + { + "Comment", + "DebugInfo", + "Opaque", + "dcl_immediateConstantBuffer", + "ShaderMessage", + "ClipPlaneConstantMappingsForDx9", + }; + BX_STATIC_ASSERT(BX_COUNTOF(s_dxbcCustomDataClass) == DxbcCustomDataClass::Count); + #define DXBC_MAX_NAME_STRING 512 int32_t readString(bx::ReaderSeekerI* _reader, int64_t _offset, char* _out, uint32_t _max, bx::Error* _err) @@ -894,7 +905,6 @@ namespace bgfx // |+------------------------------- addressing mode 2 // +-------------------------------- extended - _operand.extended = 0 != (token & UINT32_C(0x80000000) ); _operand.numAddrModes = uint8_t( (token & UINT32_C(0x00300000) ) >> 20); _operand.addrMode[0] = uint8_t( (token & UINT32_C(0x01c00000) ) >> 22); _operand.addrMode[1] = uint8_t( (token & UINT32_C(0x0e000000) ) >> 25); @@ -904,9 +914,17 @@ namespace bgfx _operand.modeBits = uint8_t( (token & UINT32_C(0x00000ff0) ) >> 4) & "\x0f\xff\x03\x00"[_operand.mode]; _operand.num = uint8_t( (token & UINT32_C(0x00000003) ) ); - if (_operand.extended) + const bool extended = 0 != (token & UINT32_C(0x80000000) ); + if (extended) { - size += bx::read(_reader, _operand.extBits, _err); + uint32_t extBits = 0; + size += bx::read(_reader, extBits, _err); + + _operand.modifier = DxbcOperandModifier::Enum( (extBits & UINT32_C(0x00003fc0) ) >> 6); + } + else + { + _operand.modifier = DxbcOperandModifier::None; } switch (_operand.type) @@ -961,8 +979,10 @@ namespace bgfx { int32_t size = 0; + const bool extended = _operand.modifier != DxbcOperandModifier::None; + uint32_t token = 0; - token |= _operand.extended ? UINT32_C(0x80000000) : 0; + token |= extended ? UINT32_C(0x80000000) : 0; token |= (_operand.numAddrModes << 20) & UINT32_C(0x00300000); token |= (_operand.addrMode[0] << 22) & UINT32_C(0x01c00000); token |= (_operand.addrMode[1] << 25) & UINT32_C(0x0e000000); @@ -975,9 +995,13 @@ namespace bgfx size += bx::write(_writer, token, _err); - if (_operand.extended) + if (extended) { - size += bx::write(_writer, _operand.extBits); + uint32_t extBits = 0 + | ( (_operand.modifier << 6) & UINT32_C(0x00003fc0) ) + | 1 /* 1 == has extended operand modifier */ + ; + size += bx::write(_writer, extBits, _err); } switch (_operand.type) @@ -1028,7 +1052,7 @@ namespace bgfx int32_t read(bx::ReaderI* _reader, DxbcInstruction& _instruction, bx::Error* _err) { - uint32_t size = 0; + int32_t size = 0; uint32_t token; size += bx::read(_reader, token, _err); @@ -1068,18 +1092,26 @@ namespace bgfx _instruction.testNZ = false; _instruction.retType = DxbcResourceReturnType::Unused; + _instruction.customDataClass = DxbcCustomDataClass::Comment; + _instruction.customData.clear(); + switch (_instruction.opcode) { case DxbcOpcode::CUSTOMDATA: { -// uint32_t dataClass; - size += bx::read(_reader, _instruction.length); - for (uint32_t ii = 0, num = (_instruction.length-2)/4; ii < num; ++ii) - { - char temp[16]; - size += bx::read(_reader, temp, 16, _err); - } + _instruction.customDataClass = DxbcCustomDataClass::Enum( (token & UINT32_C(0xfffff800) ) >> 11); + _instruction.numOperands = 0; + size += bx::read(_reader, _instruction.length, _err); + for (uint32_t ii = 0, num = (_instruction.length-2); ii < num && _err->isOk(); ++ii) + { + uint32_t temp; + size += bx::read(_reader, temp, _err); + if (_err->isOk() ) + { + _instruction.customData.push_back(temp); + } + } } return size; @@ -1188,7 +1220,7 @@ namespace bgfx // +-------------------------------- extended uint32_t extBits; - size += bx::read(_reader, extBits); + size += bx::read(_reader, extBits, _err); extended = 0 != (extBits & UINT32_C(0x80000000) ); _instruction.extended[ii ] = DxbcInstruction::ExtendedType::Enum(extBits & UINT32_C(0x0000001f) ); _instruction.extended[ii+1] = DxbcInstruction::ExtendedType::Count; @@ -1315,10 +1347,22 @@ namespace bgfx : 0 ; + int32_t size =0; + switch (_instruction.opcode) { -// case DxbcOpcode::CUSTOMDATA: -// return size; + case DxbcOpcode::CUSTOMDATA: + { + token &= UINT32_C(0x000007ff); + token |= _instruction.customDataClass << 11; + + size += bx::write(_writer, token); + + uint32_t len = uint32_t(_instruction.customData.size()*sizeof(uint32_t) ); + size += bx::write(_writer, len/4+2, _err); + size += bx::write(_writer, _instruction.customData.data(), len, _err); + } + return size; case DxbcOpcode::DCL_CONSTANT_BUFFER: token |= _instruction.allowRefactoring ? UINT32_C(0x00000800) : 0; @@ -1364,7 +1408,6 @@ namespace bgfx break; } - uint32_t size =0; size += bx::write(_writer, token); for (uint32_t ii = 0; _instruction.extended[ii] != DxbcInstruction::ExtendedType::Count; ++ii) @@ -1444,31 +1487,98 @@ namespace bgfx return size; } + int32_t toString(char* _out, int32_t _size, DxbcOperandMode::Enum _mode, uint8_t _modeBits) + { + int32_t size = 0; + + switch (_mode) + { + case DxbcOperandMode::Mask: + if (0xf > _modeBits + && 0 < _modeBits) + { + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , ".%s%s%s%s" + , 0 == (_modeBits & 1) ? "" : "x" + , 0 == (_modeBits & 2) ? "" : "y" + , 0 == (_modeBits & 4) ? "" : "z" + , 0 == (_modeBits & 8) ? "" : "w" + ); + } + break; + + case DxbcOperandMode::Swizzle: + if (0xe4 != _modeBits) + { + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , ".%c%c%c%c" + , "xyzw"[(_modeBits )&0x3] + , "xyzw"[(_modeBits>>2)&0x3] + , "xyzw"[(_modeBits>>4)&0x3] + , "xyzw"[(_modeBits>>6)&0x3] + ); + } + break; + + case DxbcOperandMode::Scalar: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , ".%c" + , "xyzw"[_modeBits] + ); + break; + + default: + break; + } + + return size; + } + int32_t toString(char* _out, int32_t _size, const DxbcInstruction& _instruction) { int32_t size = 0; - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%s%s" - , getName(_instruction.opcode) - , _instruction.saturate ? "_sat" : "" - , _instruction.testNZ ? "_nz" : "" - ); + switch (_instruction.opcode) + { + case DxbcOpcode::CUSTOMDATA: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s" + , s_dxbcCustomDataClass[_instruction.customDataClass] + ); + break; + + case DxbcOpcode::IF: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s%s" + , getName(_instruction.opcode) + , _instruction.testNZ ? "_nz" : "_z" + ); + break; + + default: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s%s%s" + , getName(_instruction.opcode) + , _instruction.saturate ? "_sat" : "" + , _instruction.testNZ ? "_nz" : "" + ); + break; + } if (DxbcResourceDim::Unknown != _instruction.srv) { size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , " %s<%x>" - , s_dxbcSrvType[_instruction.srv] - , _instruction.value[0] - ); + , " %s<%x>" + , s_dxbcSrvType[_instruction.srv] + , _instruction.value[0] + ); } else if (0 < s_dxbcOpcodeInfo[_instruction.opcode].numValues) { size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , " %d" - , _instruction.value[0] - ); + , " %d" + , _instruction.value[0] + ); } for (uint32_t ii = 0; ii < _instruction.numOperands; ++ii) @@ -1480,12 +1590,23 @@ namespace bgfx || DxbcOperandAddrMode::Imm32 != operand.addrMode[0] ; + const char* preOperand = ""; + const char* postOperand = ""; + + switch (operand.modifier) + { + case DxbcOperandModifier::Neg: preOperand = "-"; postOperand = ""; break; + case DxbcOperandModifier::Abs: preOperand = "abs("; postOperand = ")"; break; + case DxbcOperandModifier::AbsNeg: preOperand = "-abs("; postOperand = ")"; break; + default: break; + } + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%s%s" - , 0 == ii ? " " : ", " - , operand.extended ? "*" : "" - , s_dxbcOperandType[operand.type] - ); + , "%s%s%s" + , 0 == ii ? " " : ", " + , preOperand + , s_dxbcOperandType[operand.type] + ); switch (operand.type) { @@ -1495,35 +1616,39 @@ namespace bgfx { union { uint32_t i; float f; } cast = { operand.un.imm32[jj] }; size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%f" - , 0 == jj ? "(" : ", " - , cast.f - ); + , "%s%f" + , 0 == jj ? "(" : ", " + , cast.f + ); } size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , ")" - ); + , ")" + ); break; default: break; } - const uint32_t first = DxbcOperandAddrMode::RegImm32 == operand.addrMode[0] ? 0 : 1; + const uint32_t first = false + || DxbcOperandType::ImmConstantBuffer == operand.type + || DxbcOperandAddrMode::RegImm32 == operand.addrMode[0] + ? 0 : 1 + ; if (0 == first) { size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "[" - ); + , "[" + ); } else { size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%d%s" - , operand.regIndex[0] - , array ? "[" : "" - ); + , "%d%s" + , operand.regIndex[0] + , array ? "[" : "" + ); } for (uint32_t jj = first, num = bx::uint32_min(operand.numAddrModes, BX_COUNTOF(operand.addrMode) ); jj < num; ++jj) @@ -1532,78 +1657,61 @@ namespace bgfx { case DxbcOperandAddrMode::Imm32: size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%d" - , operand.regIndex[jj] - ); + , "%d" + , operand.regIndex[jj] + ); break; case DxbcOperandAddrMode::Reg: size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s%d" - , s_dxbcOperandType[operand.subOperand[jj].type] - , operand.regIndex[jj] - ); + , "%s%d" + , s_dxbcOperandType[operand.subOperand[jj].type] + , operand.subOperand[jj].regIndex + ); + size += toString(&_out[size], bx::uint32_imax(0, _size-size) + , DxbcOperandMode::Enum(operand.subOperand[jj].mode) + , operand.subOperand[jj].modeBits + ); break; case DxbcOperandAddrMode::RegImm32: size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%d + %s%d" - , operand.regIndex[jj] - , s_dxbcOperandType[operand.subOperand[jj].type] - , operand.regIndex[jj] - ); + , "%d + %s%d" + , operand.regIndex[jj] + , s_dxbcOperandType[operand.subOperand[jj].type] + , operand.subOperand[jj].regIndex + ); + size += toString(&_out[size], bx::uint32_imax(0, _size-size) + , DxbcOperandMode::Enum(operand.subOperand[jj].mode) + , operand.subOperand[jj].modeBits + ); break; default: + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size), "???"); break; } } size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , "%s" - , array ? "]" : "" - ); + , "%s" + , array ? "]" : "" + ); - switch (operand.mode) - { - case DxbcOperandMode::Mask: - if (0xf > operand.modeBits - && 0 < operand.modeBits) - { - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , ".%s%s%s%s" - , 0 == (operand.modeBits & 1) ? "" : "x" - , 0 == (operand.modeBits & 2) ? "" : "y" - , 0 == (operand.modeBits & 4) ? "" : "z" - , 0 == (operand.modeBits & 8) ? "" : "w" - ); - } - break; + size += toString(&_out[size], bx::uint32_imax(0, _size-size), operand.mode, operand.modeBits); - case DxbcOperandMode::Swizzle: - if (0xe4 != operand.modeBits) - { - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , ".%c%c%c%c" - , "xyzw"[(operand.modeBits )&0x3] - , "xyzw"[(operand.modeBits>>2)&0x3] - , "xyzw"[(operand.modeBits>>4)&0x3] - , "xyzw"[(operand.modeBits>>6)&0x3] - ); - } - break; - - case DxbcOperandMode::Scalar: - size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) - , ".%c" - , "xyzw"[operand.modeBits] - ); - break; - - default: - break; - } + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , "%s" + , postOperand + ); + } + if (_instruction.opcode == DxbcOpcode::DCL_CONSTANT_BUFFER + && _instruction.allowRefactoring) + { + size += bx::snprintf(&_out[size], bx::uint32_imax(0, _size-size) + , ", dynamicIndexed" + ); } return size; @@ -1767,7 +1875,7 @@ namespace bgfx { case DXBC_CHUNK_SHADER_EX: _dxbc.shader.shex = true; - // fallthrough + BX_FALLTHROUGH; case DXBC_CHUNK_SHADER: size += read(_reader, _dxbc.shader, _err); @@ -1912,6 +2020,8 @@ namespace bgfx bx::MemoryBlock mb(g_allocator); bx::MemoryWriter writer(&mb); + int32_t total = 0; + for (uint32_t token = 0, numTokens = uint32_t(_src.byteCode.size() / sizeof(uint32_t) ); token < numTokens;) { DxbcInstruction instruction; @@ -1920,15 +2030,17 @@ namespace bgfx _fn(instruction, _userData); - write(&writer, instruction, _err); + bx::SizerWriter sw; + uint32_t length = instruction.length; + instruction.length = uint32_t(write(&sw, instruction, _err)/4); - token += instruction.length; + total += write(&writer, instruction, _err); + token += length; } uint8_t* data = (uint8_t*)mb.more(); - uint32_t size = uint32_t(bx::getSize(&writer) ); - _dst.byteCode.reserve(size); - bx::memCopy(_dst.byteCode.data(), data, size); + _dst.byteCode.resize(total); + bx::memCopy(_dst.byteCode.data(), data, total); } } // namespace bgfx diff --git a/3rdparty/bgfx/src/shader_dxbc.h b/3rdparty/bgfx/src/shader_dxbc.h index 04c9603eada..df87d7443a7 100644 --- a/3rdparty/bgfx/src/shader_dxbc.h +++ b/3rdparty/bgfx/src/shader_dxbc.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -448,9 +448,46 @@ namespace bgfx }; }; + struct DxbcOperandModifier + { + enum Enum + { + None, + Neg, + Abs, + AbsNeg, + + Count + }; + }; + + struct DxbcCustomDataClass + { + enum Enum + { + Comment, + DebugInfo, + Opaque, + ImmConstantBuffer, + ShaderMessage, + ClipPlaneConstantMappingsForDx9, + + Count + }; + }; + struct DxbcSubOperand { - DxbcSubOperand() { /* not pod */ } + DxbcSubOperand() + : type(DxbcOperandType::Temp) + , mode(0) + , modeBits(0) + , num(0) + , numAddrModes(0) + , addrMode(0) + , regIndex(0) + { + } DxbcOperandType::Enum type; uint8_t mode; @@ -463,14 +500,24 @@ namespace bgfx struct DxbcOperand { - DxbcOperand() { /* not pod */ } + DxbcOperand() + : type(DxbcOperandType::Temp) + , mode(DxbcOperandMode::Mask) + , modeBits(0) + , num(0) + , modifier(DxbcOperandModifier::None) + , numAddrModes(0) + { + bx::memSet(addrMode, 0, sizeof(addrMode) ); + bx::memSet(regIndex, 0, sizeof(regIndex) ); + bx::memSet(un.imm64, 0, sizeof(un.imm64) ); + } DxbcOperandType::Enum type; DxbcOperandMode::Enum mode; uint8_t modeBits; uint8_t num; - bool extended; - uint32_t extBits; + DxbcOperandModifier::Enum modifier; uint8_t numAddrModes; uint8_t addrMode[3]; @@ -546,6 +593,9 @@ namespace bgfx DxbcResourceReturnType::Enum resourceReturnTypes[4]; DxbcOperand operand[6]; + + DxbcCustomDataClass::Enum customDataClass; + stl::vector customData; }; int32_t read(bx::ReaderI* _reader, DxbcInstruction& _instruction, bx::Error* _err); diff --git a/3rdparty/bgfx/src/shader_spirv.cpp b/3rdparty/bgfx/src/shader_spirv.cpp index b859dbb5383..83b13c53b93 100644 --- a/3rdparty/bgfx/src/shader_spirv.cpp +++ b/3rdparty/bgfx/src/shader_spirv.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/shader_spirv.h b/3rdparty/bgfx/src/shader_spirv.h index e0f6807c97d..1fe1c934090 100644 --- a/3rdparty/bgfx/src/shader_spirv.h +++ b/3rdparty/bgfx/src/shader_spirv.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -15,8 +15,9 @@ BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, BX_MAKEFOURCC('S', 'H', 0 namespace bgfx { - // Reference: https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html - + // Reference(s): + // - https://web.archive.org/web/20181126035927/https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html + // struct SpvOpcode { enum Enum @@ -601,7 +602,7 @@ namespace bgfx bool hasType; bool hasResult; - SpvOperand operand[10]; + SpvOperand operand[32]; }; int32_t read(bx::ReaderI* _reader, SpvInstruction& _instruction, bx::Error* _err); diff --git a/3rdparty/bgfx/src/topology.cpp b/3rdparty/bgfx/src/topology.cpp index 0be14ded4fd..1a3e8b6f6ab 100644 --- a/3rdparty/bgfx/src/topology.cpp +++ b/3rdparty/bgfx/src/topology.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -37,6 +37,37 @@ namespace bgfx return _numIndices; } + inline bool isEven(uint32_t _num) + { + return 0 == (_num & 1); + } + + template + static uint32_t topologyConvertTriStripFlipWinding(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices) + { + const uint32_t numIndices = isEven(_numIndices) ? _numIndices + 1 : _numIndices; + + if (NULL != _dst) + { + return numIndices; + } + + IndexT* dst = (IndexT*)_dst; + IndexT* end = &dst[_dstSize/sizeof(IndexT)]; + + if (isEven(_numIndices) ) + { + *dst++ = _indices[_numIndices-1]; + } + + for (uint32_t ii = 1; ii <= _numIndices && dst < end; ++ii) + { + *dst++ = _indices[_numIndices - ii]; + } + + return numIndices; + } + template static uint32_t topologyConvertTriListToLineList(void* _dst, uint32_t _dstSize, const IndexT* _indices, uint32_t _numIndices, IndexT* _temp, SortT* _tempSort) { @@ -47,14 +78,14 @@ namespace bgfx const IndexT* tri = &_indices[ii]; IndexT i0 = tri[0], i1 = tri[1], i2 = tri[2]; - if (i0 > i1) { bx::xchg(i0, i1); } - if (i1 > i2) { bx::xchg(i1, i2); } - if (i0 > i1) { bx::xchg(i0, i1); } + if (i0 > i1) { bx::swap(i0, i1); } + if (i1 > i2) { bx::swap(i1, i2); } + if (i0 > i1) { bx::swap(i0, i1); } BX_CHECK(i0 < i1 && i1 < i2, ""); - dst[0] = i0; dst[1] = i1; - dst[2] = i1; dst[3] = i2; - dst[4] = i0; dst[5] = i2; + dst[1] = i0; dst[0] = i1; + dst[3] = i1; dst[2] = i2; + dst[5] = i0; dst[4] = i2; dst += 6; } @@ -83,11 +114,19 @@ namespace bgfx dst = (IndexT*)_dst; IndexT* end = &dst[_dstSize/sizeof(IndexT)]; SortT last = sorted[0]; + + { + union Un { SortT key; struct { IndexT i0; IndexT i1; } u16; } un = { sorted[0] }; + dst[0] = un.u16.i0; + dst[1] = un.u16.i1; + dst += 2; + } + for (uint32_t ii = 1; ii < _numIndices && dst < end; ++ii) { if (last != sorted[ii]) { - union Un { SortT key; struct { IndexT i0; IndexT i1; } u16; } un = { last }; + union Un { SortT key; struct { IndexT i0; IndexT i1; } u16; } un = { sorted[ii] }; dst[0] = un.u16.i0; dst[1] = un.u16.i1; dst += 2; @@ -95,14 +134,6 @@ namespace bgfx } } - if (dst < end) - { - union Un { SortT key; struct { IndexT i0; IndexT i1; } u16; } un = { last }; - dst[0] = un.u16.i0; - dst[1] = un.u16.i1; - dst += 2; - } - num = uint32_t(dst - (IndexT*)_dst); } @@ -195,6 +226,14 @@ namespace bgfx return topologyConvertTriListFlipWinding(_dst, _dstSize, (const uint16_t*)_indices, _numIndices); + case TopologyConvert::TriStripFlipWinding: + if (_index32) + { + return topologyConvertTriStripFlipWinding(_dst, _dstSize, (const uint32_t*)_indices, _numIndices); + } + + return topologyConvertTriStripFlipWinding(_dst, _dstSize, (const uint16_t*)_indices, _numIndices); + case TopologyConvert::TriListToLineList: if (NULL == _allocator) { @@ -223,6 +262,16 @@ namespace bgfx return 0; } + inline float fmin3(float _a, float _b, float _c) + { + return bx::min(_a, _b, _c); + } + + inline float fmax3(float _a, float _b, float _c) + { + return bx::max(_a, _b, _c); + } + inline float favg3(float _a, float _b, float _c) { return (_a + _b + _c) * 1.0f/3.0f; @@ -243,7 +292,7 @@ namespace bgfx { float tmp[3]; bx::vec3Sub(tmp, _pos, vertexPos(_vertices, _stride, _index) ); - return bx::fsqrt(bx::vec3Dot(tmp, tmp) ); + return bx::sqrt(bx::vec3Dot(tmp, tmp) ); } typedef float (*KeyFn)(float, float, float); diff --git a/3rdparty/bgfx/src/topology.h b/3rdparty/bgfx/src/topology.h index 156a6cafe33..896e6e572f8 100644 --- a/3rdparty/bgfx/src/topology.h +++ b/3rdparty/bgfx/src/topology.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/vertexdecl.cpp b/3rdparty/bgfx/src/vertexdecl.cpp index ba00480dcd3..6c6358626d1 100644 --- a/3rdparty/bgfx/src/vertexdecl.cpp +++ b/3rdparty/bgfx/src/vertexdecl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -10,7 +10,6 @@ #include #include -#include "config.h" #include "vertexdecl.h" namespace bgfx @@ -122,64 +121,35 @@ namespace bgfx static const char* s_attrName[] = { - "Attrib::Position", - "Attrib::Normal", - "Attrib::Tangent", - "Attrib::Bitangent", - "Attrib::Color0", - "Attrib::Color1", - "Attrib::Color2", - "Attrib::Color3", - "Attrib::Indices", - "Attrib::Weights", - "Attrib::TexCoord0", - "Attrib::TexCoord1", - "Attrib::TexCoord2", - "Attrib::TexCoord3", - "Attrib::TexCoord4", - "Attrib::TexCoord5", - "Attrib::TexCoord6", - "Attrib::TexCoord7", + "P", "Attrib::Position", + "N", "Attrib::Normal", + "T", "Attrib::Tangent", + "B", "Attrib::Bitangent", + "C0", "Attrib::Color0", + "C1", "Attrib::Color1", + "C2", "Attrib::Color2", + "C3", "Attrib::Color3", + "I", "Attrib::Indices", + "W", "Attrib::Weights", + "T0", "Attrib::TexCoord0", + "T1", "Attrib::TexCoord1", + "T2", "Attrib::TexCoord2", + "T3", "Attrib::TexCoord3", + "T4", "Attrib::TexCoord4", + "T5", "Attrib::TexCoord5", + "T6", "Attrib::TexCoord6", + "T7", "Attrib::TexCoord7", }; - BX_STATIC_ASSERT(BX_COUNTOF(s_attrName) == Attrib::Count); + BX_STATIC_ASSERT(BX_COUNTOF(s_attrName) == Attrib::Count*2); + + const char* getAttribNameShort(Attrib::Enum _attr) + { + return s_attrName[_attr*2+0]; + } const char* getAttribName(Attrib::Enum _attr) { - return s_attrName[_attr]; - } - - void dump(const VertexDecl& _decl) - { - if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) - { - bx::debugPrintf("vertexdecl %08x (%08x), stride %d\n" - , _decl.m_hash - , bx::hash(_decl.m_attributes) - , _decl.m_stride - ); - - for (uint32_t attr = 0; attr < Attrib::Count; ++attr) - { - if (UINT16_MAX != _decl.m_attributes[attr]) - { - uint8_t num; - AttribType::Enum type; - bool normalized; - bool asInt; - _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt); - - bx::debugPrintf("\tattr %d - %s, num %d, type %d, norm %d, asint %d, offset %d\n" - , attr - , getAttribName(Attrib::Enum(attr) ) - , num - , type - , normalized - , asInt - , _decl.m_offset[attr] - ); - } - } - } + return s_attrName[_attr*2+1]; } struct AttribToId diff --git a/3rdparty/bgfx/src/vertexdecl.h b/3rdparty/bgfx/src/vertexdecl.h index f0461848197..2b80b1f50c3 100644 --- a/3rdparty/bgfx/src/vertexdecl.h +++ b/3rdparty/bgfx/src/vertexdecl.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -17,8 +17,8 @@ namespace bgfx /// Returns attribute name. const char* getAttribName(Attrib::Enum _attr); - /// Dump vertex declaration into debug output. - void dump(const VertexDecl& _decl); + /// + const char* getAttribNameShort(Attrib::Enum _attr); /// Attrib::Enum idToAttrib(uint16_t id); diff --git a/3rdparty/bgfx/src/vs_clear.bin.h b/3rdparty/bgfx/src/vs_clear.bin.h index 628f94fcbc2..f884364e3fb 100644 --- a/3rdparty/bgfx/src/vs_clear.bin.h +++ b/3rdparty/bgfx/src/vs_clear.bin.h @@ -12,139 +12,44 @@ static const uint8_t vs_clear_glsl[164] = 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, // ion = tmpvar_1;. 0x7d, 0x0a, 0x0a, 0x00, // }... }; -static const uint8_t vs_clear_spv[2083] = +static const uint8_t vs_clear_spv[568] = { - 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x08, 0x00, 0x00, 0x03, 0x02, // VSH............. - 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, // #.........za.... + 0x56, 0x53, 0x48, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x02, 0x00, 0x00, 0x03, 0x02, // VSH.......$..... + 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, // #.........O..... 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, // ................ 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, // ..GLSL.std.450.. 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. - 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x03, 0x00, // ................ - 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, // ................ - 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xf9, 0x03, // ..main.......... - 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xf9, 0x03, // ..Output........ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // ......gl_Positio - 0x6e, 0x00, 0x05, 0x00, 0x05, 0x00, 0x1f, 0x17, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, // n.........@main( - 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x1b, 0x00, 0x00, 0x61, 0x5f, // vf3;..........a_ - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0f, 0x12, // position........ - 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x05, 0x00, // .._varying_..... - 0x05, 0x00, 0xd5, 0x5d, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, // ...]..a_position - 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // ..........a_posi - 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x40, 0x65, // tion..........@e - 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, // ntryPointOutput_ - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, // gl_Position..... - 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, // ......param..... - 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, // ......$Global... - 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x01, 0x00, // Rect............ - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, // ..u_viewTexel... - 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view - 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ - 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x0b, // invView......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ......u_proj.... - 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, // ..........u_invP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, // roj............. - 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, // ..u_viewProj.... - 0x07, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, // ..........u_invV - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xc5, 0x0b, // iewProj......... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, // ......u_model... - 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // ..........u_mode - 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, // lView........... - 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // ..u_modelViewPro - 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, // j.............u_ - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x04, 0x00, 0xcf, 0x03, // alphaRef4....... - 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcd, 0x0f, // ..Output........ + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, // ..........main.. + 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, // ..'...*......... + 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, // ..............ma + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x27, 0x00, 0x00, 0x00, 0x61, 0x5f, // in........'...a_ + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x2a, 0x00, // position......*. 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, // ..@entryPointOut - 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x1e, 0x00, // put...G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x0b, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x06, 0x00, // ......G...|..... - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x00, 0x00, // ..@...H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#.......H..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ......#.......H. - 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x03, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#...`...H..... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x05, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#.......H..... - 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, // ..........#... . - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x07, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#...`...H..... - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x09, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, // ..#.......H..... - 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x04, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, // ..............H. - 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, // ..........#..... - 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, // ..H............. - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x0b, 0x00, // ......H......... - 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xc5, 0x0b, // ..#... ...G..... - 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x1e, 0x00, // ......G......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, // ..............!. - 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, // .. ............. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, // ...... ......... - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, // ................ - 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xc8, 0x08, 0x00, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x95, 0x02, // ..!............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x76, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf9, 0x03, // .. ...v......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+............. - 0x80, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, // .? ............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, // ..;............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, // .. ............. - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x03, 0x00, // ..;............. - 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, // ......e......... - 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... - 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, // ..+.......j... . - 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, // ......|...e...j. - 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xc5, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, // ................ - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, // ..e...e...e...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x7c, 0x05, 0x00, 0x00, 0x65, 0x00, // ..e...e...|...e. - 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x02, 0x00, 0xcf, 0x03, // ..e............. - 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4c, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xcf, 0x03, // .. ...L......... - 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4c, 0x06, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x03, 0x00, // ..;...L......... - 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, // ..6............. - 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x79, 0x61, 0x00, 0x00, 0x3b, 0x00, // ..........ya..;. - 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xd5, 0x5d, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3e, 0x00, // .......]......>. - 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0xd5, 0x5d, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0xf9, 0x03, // .......]..9..... - 0x00, 0x00, 0xf5, 0x53, 0x00, 0x00, 0x1f, 0x17, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x51, 0x00, // ...S..........Q. - 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf8, 0x21, 0x00, 0x00, 0xf5, 0x53, 0x00, 0x00, 0x00, 0x00, // .......!...S.... - 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0xf8, 0x21, 0x00, 0x00, 0xfd, 0x00, // ..>........!.... - 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x1f, 0x17, // ..8...6......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x08, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, // ..........7..... - 0x00, 0x00, 0xa6, 0x1b, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xd7, 0x58, 0x00, 0x00, 0x3b, 0x00, // ...........X..;. - 0x04, 0x00, 0x76, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..v...........=. - 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0xa6, 0x1b, 0x00, 0x00, 0x51, 0x00, // ......#V......Q. - 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x45, 0x3c, 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0x00, 0x00, // ......E<..#V.... - 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x25, 0x5f, 0x00, 0x00, 0x23, 0x56, // ..Q.......%_..#V - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x52, // ......Q........R - 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, // ..#V......P..... - 0x00, 0x00, 0x78, 0x31, 0x00, 0x00, 0x45, 0x3c, 0x00, 0x00, 0x25, 0x5f, 0x00, 0x00, 0x0c, 0x52, // ..x1..E<..%_...R - 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x34, 0x24, // ......A.......4$ - 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x34, 0x24, // ..........>...4$ - 0x00, 0x00, 0x78, 0x31, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xf9, 0x03, 0x00, 0x00, 0xba, 0x3a, // ..x1..=........: - 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xba, 0x3a, 0x00, 0x00, 0x38, 0x00, // ...........:..8. - 0x01, 0x00, 0x00, // ... + 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, // put.gl_Position. + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...'......... + 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // ..G...*......... + 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, // ..........!..... + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, // .............. . + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, // ................ + 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, // ..+............. + 0x80, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, // .? ...&......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, // ..;...&...'..... + 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, // .. ...)......... + 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x03, 0x00, // ..;...)...*..... + 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // ..6............. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, // ..............=. + 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x51, 0x00, // ......(...'...Q. + 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, // ......8...(..... + 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x28, 0x00, // ..Q.......9...(. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3a, 0x00, // ......Q.......:. + 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x09, 0x00, // ..(.......P..... + 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, // ..;...8...9...:. + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3f, 0x00, // ..............?. + 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4e, 0x00, // ..9...R.......N. + 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..?...;.......>. + 0x03, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, // ..*...N.......8. + 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, // ........ }; static const uint8_t vs_clear_dx9[175] = { diff --git a/3rdparty/bgfx/src/vs_clear.sc b/3rdparty/bgfx/src/vs_clear.sc index 2cd4aef3f7f..39abd06d212 100644 --- a/3rdparty/bgfx/src/vs_clear.sc +++ b/3rdparty/bgfx/src/vs_clear.sc @@ -1,7 +1,7 @@ $input a_position /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/src/vs_debugfont.bin.h b/3rdparty/bgfx/src/vs_debugfont.bin.h index 5a6517c5adf..a1bac2f0fe8 100644 --- a/3rdparty/bgfx/src/vs_debugfont.bin.h +++ b/3rdparty/bgfx/src/vs_debugfont.bin.h @@ -33,239 +33,99 @@ static const uint8_t vs_debugfont_glsl[503] = 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // color1 = a_color 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // 1;.}... }; -static const uint8_t vs_debugfont_spv[3689] = +static const uint8_t vs_debugfont_spv[1456] = { 0x56, 0x53, 0x48, 0x05, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x44, 0x0e, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, // D.....#......... - 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // Ta.............. + 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... + 0x80, 0x05, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x08, 0x00, // ......#......... + 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x8a, 0x14, 0x00, 0x00, // main............ - 0xa6, 0x14, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, // ................ - 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0xc3, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // ....Output...... - 0xc3, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // ........gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion............. - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0xc3, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // ........v_color1 - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................ - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x08, 0x00, // v_texcoord0..... - 0x1f, 0x11, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, // ....@main(vf4;vf - 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // 4;vf3;vf2;...... - 0x8f, 0x22, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ."..a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xf3, 0x54, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // .....T..a_color1 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........NJ..a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xd8, 0x4e, 0x00, 0x00, // sition.......N.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0xa4, 0x03, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // .....?..a_color1 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x8a, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, // ............a_co - 0x6c, 0x6f, 0x72, 0x31, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xed, 0x2c, 0x00, 0x00, // lor1.........,.. - 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_position...... - 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // ....a_position.. - 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....@,..a_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, // rd0.........a_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, // xcoord0......... - 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, // flattenTemp..... - 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .U..param....... - 0x6f, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // o8..param....... - 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // .8..param....... - 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // ....param....... - 0xd8, 0x0c, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x5f, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // utput_gl_Positio - 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x64, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, // n.......d...Outp - 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ut......d....... - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x64, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // d.......v_color1 - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ........d....... - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, // v_texcoord0..... - 0xcd, 0x0f, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd9, 0x05, 0x00, 0x00, // utput...G....... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ....@...H....... - 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xa4, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xa4, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xa4, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0xa4, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0xa4, 0x03, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x03, 0x00, 0x00, // ........H....... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0xa4, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8a, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd8, 0x0c, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xcd, 0x0f, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x06, 0x00, 0xc3, 0x04, 0x00, 0x00, // ................ - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x07, 0x00, 0x98, 0x01, 0x00, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, // !............... - 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, // ............ ... - 0x40, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // @............... - 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... - 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... - 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, // ...........?+... - 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, // ............,... - 0x1d, 0x00, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ................ - 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... - 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........,....... - 0x74, 0x01, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // t............... - 0x8a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, // ....+........... - 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, // ....,........... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... - 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // .......+....... - 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xd9, 0x05, 0x00, 0x00, // j... ........... - 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0xa4, 0x03, 0x00, 0x00, // e...j........... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ........e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0xd9, 0x05, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....e...e....... - 0x20, 0x00, 0x04, 0x00, 0x21, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x03, 0x00, 0x00, // ...!........... - 0x3b, 0x00, 0x04, 0x00, 0x21, 0x06, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...!...B....... - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // +.......)....... - 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ...........e... - 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x8a, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x91, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x1e, 0x00, 0x05, 0x00, 0x64, 0x04, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....d........... - 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x64, 0x04, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xe1, 0x06, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, // d...;........... - 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x92, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ........... - 0x13, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ....6........... - 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, // ............Sa.. - 0x3b, 0x00, 0x04, 0x00, 0x40, 0x07, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;...@........... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........U...... - 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;.......o8...... - 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;........8...... - 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, // =........A...... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x8a, 0x14, 0x00, 0x00, // =........?...... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xed, 0x2c, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // =........,...... - 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, // =.......@,...... - 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >....U...A..>... - 0x6f, 0x38, 0x00, 0x00, 0xc6, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, // o8...?..>....8.. - 0xed, 0x2c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, // .,..>.......@,.. - 0x39, 0x00, 0x08, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x1f, 0x11, 0x00, 0x00, // 9.......I&...... - 0x85, 0x55, 0x00, 0x00, 0x6f, 0x38, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, // .U..o8...8...... - 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >.......I&..A... - 0x9a, 0x02, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....T4.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, // =...........T4.. - 0x3e, 0x00, 0x03, 0x00, 0xd8, 0x0c, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0x27, 0x41, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....'A.......... - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdf, 0x1c, 0x00, 0x00, 0x27, 0x41, 0x00, 0x00, // =...........'A.. - 0x41, 0x00, 0x05, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x0d, 0x4e, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, // A........N...... - 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0d, 0x4e, 0x00, 0x00, 0xdf, 0x1c, 0x00, 0x00, // ....>....N...... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc1, 0x4d, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, // A........M...... - 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xe0, 0x1c, 0x00, 0x00, // ....=........... - 0xc1, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x0e, 0x4e, 0x00, 0x00, // .M..A........N.. - 0xcd, 0x0f, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0e, 0x4e, 0x00, 0x00, // ........>....N.. - 0xe0, 0x1c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x90, 0x02, 0x00, 0x00, 0xc2, 0x4d, 0x00, 0x00, // ....A........M.. - 0x08, 0x10, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ........=....... - 0xe1, 0x1c, 0x00, 0x00, 0xc2, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x92, 0x02, 0x00, 0x00, // .....M..A....... - 0x01, 0x5c, 0x00, 0x00, 0xcd, 0x0f, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ............>... - 0x01, 0x5c, 0x00, 0x00, 0xe1, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, // ............8... - 0x36, 0x00, 0x05, 0x00, 0xc3, 0x04, 0x00, 0x00, 0x1f, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... - 0x98, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x8f, 0x22, 0x00, 0x00, // ....7........".. - 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf3, 0x54, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // 7........T..7... - 0x95, 0x02, 0x00, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, // ....NJ..7....... - 0xd8, 0x4e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x7e, 0x58, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .N......~X..;... - 0x40, 0x07, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // @...........A... - 0x9a, 0x02, 0x00, 0x00, 0x83, 0x2e, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ................ - 0x3e, 0x00, 0x03, 0x00, 0x83, 0x2e, 0x00, 0x00, 0x88, 0x05, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...........A... - 0x9a, 0x02, 0x00, 0x00, 0x76, 0x39, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // ....v9.......... - 0x3e, 0x00, 0x03, 0x00, 0x76, 0x39, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // >...v9..t...A... - 0x90, 0x02, 0x00, 0x00, 0x2a, 0x39, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, // ....*9.......... - 0x3e, 0x00, 0x03, 0x00, 0x2a, 0x39, 0x00, 0x00, 0x1f, 0x07, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...*9......=... - 0x18, 0x00, 0x00, 0x00, 0xd5, 0x18, 0x00, 0x00, 0x4e, 0x4a, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ........NJ..Q... - 0x0d, 0x00, 0x00, 0x00, 0x5a, 0x3b, 0x00, 0x00, 0xd5, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....Z;.......... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2a, 0x48, 0x00, 0x00, 0xd5, 0x18, 0x00, 0x00, // Q.......*H...... - 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4a, 0x54, 0x00, 0x00, // ....Q.......JT.. - 0xd5, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, // ........P....... - 0xa3, 0x33, 0x00, 0x00, 0x5a, 0x3b, 0x00, 0x00, 0x2a, 0x48, 0x00, 0x00, 0x4a, 0x54, 0x00, 0x00, // .3..Z;..*H..JT.. - 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x48, 0x2d, 0x00, 0x00, // ....A.......H-.. - 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // B...)...=...e... - 0x12, 0x3e, 0x00, 0x00, 0x48, 0x2d, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, // .>..H-.......... - 0xbe, 0x3c, 0x00, 0x00, 0xa3, 0x33, 0x00, 0x00, 0x12, 0x3e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // .<...3...>..A... - 0x9a, 0x02, 0x00, 0x00, 0x7e, 0x39, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, // ....~9.......... - 0x3e, 0x00, 0x03, 0x00, 0x7e, 0x39, 0x00, 0x00, 0xbe, 0x3c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...~9...<..=... - 0x13, 0x00, 0x00, 0x00, 0x3c, 0x22, 0x00, 0x00, 0xd8, 0x4e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ....<"...N..A... - 0x90, 0x02, 0x00, 0x00, 0x4c, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, // ....L=.......... - 0x3e, 0x00, 0x03, 0x00, 0x4c, 0x3d, 0x00, 0x00, 0x3c, 0x22, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...L=..<"..=... - 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x22, 0x00, 0x00, 0x8f, 0x22, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ....="..."..A... - 0x9a, 0x02, 0x00, 0x00, 0x4d, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....M=.......... - 0x3e, 0x00, 0x03, 0x00, 0x4d, 0x3d, 0x00, 0x00, 0x3d, 0x22, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...M=..="..=... - 0x1d, 0x00, 0x00, 0x00, 0x3e, 0x22, 0x00, 0x00, 0xf3, 0x54, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // ....>"...T..A... - 0x9a, 0x02, 0x00, 0x00, 0x4e, 0x3d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, // ....N=.......... - 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x3d, 0x00, 0x00, 0x3e, 0x22, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // >...N=..>"..=... - 0xc3, 0x04, 0x00, 0x00, 0x0d, 0x53, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, // .....S.......... - 0x0d, 0x53, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .S..8.... + 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................ + 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, // main....D...G... + 0x4b, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // K...O......._... + 0x62, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, // b...f........... + 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, // ............main + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, // ........*...$Glo + 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x07, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // bal.....*....... + 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. + 0x05, 0x00, 0x03, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // ....,........... + 0x44, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // D...a_color0.... + 0x05, 0x00, 0x05, 0x00, 0x47, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, // ....G...a_color1 + 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........K...a_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x4f, 0x00, 0x00, 0x00, // sition......O... + 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, // a_texcoord0..... + 0x5c, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // ....@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // utput.gl_Positio + 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // n......._...@ent + 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, // ryPointOutput.v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, 0x62, 0x00, 0x00, 0x00, // color0......b... + 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, // @entryPointOutpu + 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, // t.v_color1...... + 0x66, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // f...@entryPointO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // utput.v_texcoord + 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0...H...*....... + 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....H...*....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x2a, 0x00, 0x00, 0x00, // #.......H...*... + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ............G... + 0x2a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x2c, 0x00, 0x00, 0x00, // *.......G...,... + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x44, 0x00, 0x00, 0x00, // ".......G...D... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x47, 0x00, 0x00, 0x00, // ........G...G... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4b, 0x00, 0x00, 0x00, // ........G...K... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x4f, 0x00, 0x00, 0x00, // ........G...O... + 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5c, 0x00, 0x00, 0x00, // ........G....... + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x5f, 0x00, 0x00, 0x00, // ........G..._... + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x62, 0x00, 0x00, 0x00, // ........G...b... + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x66, 0x00, 0x00, 0x00, // ........G...f... + 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, // ................ + 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... + 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... + 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ + 0x06, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00, // ................ + 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // .......+....... + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x17, 0x00, 0x00, 0x00, // .......?+....... + 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x29, 0x00, 0x00, 0x00, // #...........)... + 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, 0x2a, 0x00, 0x00, 0x00, // ............*... + 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // )... ...+....... + 0x2a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, // *...;...+...,... + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // .... ...-....... + 0x29, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // )... ...C....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // ....;...C...D... + 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x43, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, // ....;...C...G... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...J....... + 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, // ....;...J...K... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // .... ...N....... + 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, // ....;...N...O... + 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...[....... + 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ....;...[....... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, // ....;...[..._... + 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, // ....;...[...b... + 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // .... ...e....... + 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, // ....;...e...f... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....6........... + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, // ................ + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // =.......E...D... + 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, // =.......H...G... + 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, // =.......L...K... + 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, // =.......P...O... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, // Q...........L... + 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // ....Q........... + 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // L.......Q....... + 0x81, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // ....L.......P... + 0x07, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, // ................ + 0x81, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x2d, 0x00, 0x00, 0x00, // ........A...-... + 0x83, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ....,...#...=... + 0x29, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // )............... + 0x07, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, // ................ + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, // Q............... + 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, // ................ + 0xb3, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, // ....R........... + 0x8f, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ............>... + 0x5c, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x00, 0x00, 0x00, // ........>..._... + 0x45, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x62, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, // E...>...b...H... + 0x3e, 0x00, 0x03, 0x00, 0x66, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, // >...f...P....... + 0x38, 0x00, 0x01, 0x00, 0x00, 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // 8.............@. }; static const uint8_t vs_debugfont_dx9[385] = { diff --git a/3rdparty/bgfx/src/vs_debugfont.sc b/3rdparty/bgfx/src/vs_debugfont.sc index 17ae521b9dd..8c09d62a6a7 100644 --- a/3rdparty/bgfx/src/vs_debugfont.sc +++ b/3rdparty/bgfx/src/vs_debugfont.sc @@ -2,7 +2,7 @@ $input a_position, a_color0, a_color1, a_texcoord0 $output v_color0, v_color1, v_texcoord0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/geometryc/geometryc.cpp b/3rdparty/bgfx/tools/geometryc/geometryc.cpp index d1d6e014b01..1e1f175e102 100644 --- a/3rdparty/bgfx/tools/geometryc/geometryc.cpp +++ b/3rdparty/bgfx/tools/geometryc/geometryc.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -126,7 +126,7 @@ long int fsize(FILE* _file) void triangleReorder(uint16_t* _indices, uint32_t _numIndices, uint32_t _numVertices, uint16_t _cacheSize) { uint16_t* newIndexList = new uint16_t[_numIndices]; - Forsyth::OptimizeFaces(_indices, _numIndices, _numVertices, newIndexList, _cacheSize); + Forsyth::OptimizeFaces(_indices, _numIndices, _numVertices, 0, newIndexList, _cacheSize); bx::memCopy(_indices, newIndexList, _numIndices*2); delete [] newIndexList; } @@ -370,7 +370,7 @@ void help(const char* _error = NULL) fprintf(stderr , "geometryc, bgfx geometry compiler tool, version %d.%d.%d.\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" + "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" , BGFX_GEOMETRYC_VERSION_MAJOR , BGFX_GEOMETRYC_VERSION_MINOR @@ -450,7 +450,10 @@ int main(int _argc, const char* _argv[]) const char* scaleArg = cmdLine.findOption('s', "scale"); if (NULL != scaleArg) { - scale = (float)atof(scaleArg); + if (!bx::fromString(&scale, scaleArg)) + { + scale = 1.0f; + } } bool compress = cmdLine.hasArg('c', "compress"); @@ -504,10 +507,11 @@ int main(int _argc, const char* _argv[]) uint32_t len = sizeof(commandLine); int argc; char* argv[64]; - const char* next = data; - do + + for (bx::StringView next(data, size); !next.isEmpty(); ) { next = bx::tokenizeCommandLine(next, commandLine, len, argc, argv, BX_COUNTOF(argv), '\n'); + if (0 < argc) { if (0 == bx::strCmp(argv[0], "#") ) @@ -537,60 +541,63 @@ int main(int _argc, const char* _argv[]) } else { - index.m_vbc = 0; + index.m_vbc = 0; } - const char* vertex = argv[edge+1]; - char* texcoord = const_cast(bx::strFind(vertex, '/') ); - if (NULL != texcoord) { - *texcoord++ = '\0'; - - char* normal = const_cast(bx::strFind(texcoord, '/') ); - if (NULL != normal) + bx::StringView triplet(argv[edge + 1]); + bx::StringView vertex(triplet); + bx::StringView texcoord = bx::strFind(triplet, '/'); + if (!texcoord.isEmpty()) { - *normal++ = '\0'; - int32_t nn; - bx::fromString(&nn, normal); - index.m_normal = (nn < 0) ? nn+numNormals : nn-1; + vertex.set(vertex.getPtr(), texcoord.getPtr()); + + const bx::StringView normal = bx::strFind(bx::StringView(texcoord.getPtr() + 1, triplet.getTerm()), '/'); + if (!normal.isEmpty()) + { + int32_t nn; + bx::fromString(&nn, bx::StringView(normal.getPtr() + 1, triplet.getTerm())); + index.m_normal = (nn < 0) ? nn + numNormals : nn - 1; + } + + texcoord.set(texcoord.getPtr() + 1, normal.getPtr()); + + // https://en.wikipedia.org/wiki/Wavefront_.obj_file#Vertex_Normal_Indices_Without_Texture_Coordinate_Indices + if (!texcoord.isEmpty()) + { + int32_t tex; + bx::fromString(&tex, texcoord); + index.m_texcoord = (tex < 0) ? tex + numTexcoords : tex - 1; + } } - // https://en.wikipedia.org/wiki/Wavefront_.obj_file#Vertex_Normal_Indices_Without_Texture_Coordinate_Indices - if(*texcoord != '\0') - { - int32_t tex; - bx::fromString(&tex, texcoord); - index.m_texcoord = (tex < 0) ? tex+numTexcoords : tex-1; - } + int32_t pos; + bx::fromString(&pos, vertex); + index.m_position = (pos < 0) ? pos + numPositions : pos - 1; } - int32_t pos; - bx::fromString(&pos, vertex); - index.m_position = (pos < 0) ? pos+numPositions : pos-1; - - uint64_t hash0 = index.m_position; - uint64_t hash1 = uint64_t(index.m_texcoord)<<20; - uint64_t hash2 = uint64_t(index.m_normal)<<40; - uint64_t hash3 = uint64_t(index.m_vbc)<<60; - uint64_t hash = hash0^hash1^hash2^hash3; + const uint64_t hash0 = uint64_t(index.m_position)<< 0; + const uint64_t hash1 = uint64_t(index.m_texcoord)<<20; + const uint64_t hash2 = uint64_t(index.m_normal )<<40; + const uint64_t hash3 = uint64_t(index.m_vbc )<<60; + const uint64_t hash = hash0^hash1^hash2^hash3; stl::pair result = indexMap.insert(stl::make_pair(hash, index) ); if (!result.second) { Index3& oldIndex = result.first->second; BX_UNUSED(oldIndex); - BX_CHECK(oldIndex.m_position == index.m_position + BX_CHECK(true + && oldIndex.m_position == index.m_position && oldIndex.m_texcoord == index.m_texcoord - && oldIndex.m_normal == index.m_normal + && oldIndex.m_normal == index.m_normal , "Hash collision!" ); } switch (edge) { - case 0: - case 1: - case 2: + case 0: case 1: case 2: triangle.m_index[edge] = hash; if (2 == edge) { @@ -613,6 +620,7 @@ int main(int _argc, const char* _argv[]) triangle.m_index[1] = triangle.m_index[2]; triangle.m_index[2] = hash; } + triangles.push_back(triangle); break; } @@ -635,9 +643,9 @@ int main(int _argc, const char* _argv[]) if (0 == bx::strCmp(argv[0], "vn") ) { Vector3 normal; - normal.x = (float)atof(argv[1]); - normal.y = (float)atof(argv[2]); - normal.z = (float)atof(argv[3]); + bx::fromString(&normal.x, argv[1]); + bx::fromString(&normal.y, argv[2]); + bx::fromString(&normal.z, argv[3]); normals.push_back(normal); } @@ -653,16 +661,19 @@ int main(int _argc, const char* _argv[]) else if (0 == bx::strCmp(argv[0], "vt") ) { Vector3 texcoord; - texcoord.x = (float)atof(argv[1]); texcoord.y = 0.0f; texcoord.z = 0.0f; + + bx::fromString(&texcoord.x, argv[1]); + switch (argc) { case 4: - texcoord.z = (float)atof(argv[3]); - // fallthrough + bx::fromString(&texcoord.z, argv[3]); + BX_FALLTHROUGH; + case 3: - texcoord.y = (float)atof(argv[2]); + bx::fromString(&texcoord.y, argv[2]); break; default: @@ -673,13 +684,18 @@ int main(int _argc, const char* _argv[]) } else { - float px = (float)atof(argv[1]); - float py = (float)atof(argv[2]); - float pz = (float)atof(argv[3]); - float pw = 1.0f; + float px, py, pz, pw; + bx::fromString(&px, argv[1]); + bx::fromString(&py, argv[2]); + bx::fromString(&pz, argv[3]); + if (argc > 4) { - pw = (float)atof(argv[4]); + bx::fromString(&pw, argv[4]); + } + else + { + pw = 1.0f; } float invW = scale/pw; @@ -726,7 +742,6 @@ int main(int _argc, const char* _argv[]) ++num; } - while ('\0' != *next); group.m_numTriangles = (uint32_t)(triangles.size() ) - group.m_startTriangle; if (0 < group.m_numTriangles) @@ -838,6 +853,7 @@ int main(int _argc, const char* _argv[]) break; } } + decl.end(); uint32_t stride = decl.getStride(); @@ -877,7 +893,7 @@ int main(int _argc, const char* _argv[]) for (uint32_t tri = groupIt->m_startTriangle, end = tri + groupIt->m_numTriangles; tri < end; ++tri) { if (0 != bx::strCmp(material.c_str(), groupIt->m_material.c_str() ) - || 65533 < numVertices) + || 65533 <= numVertices) { prim.m_numVertices = numVertices - prim.m_startVertex; prim.m_numIndices = numIndices - prim.m_startIndex; @@ -900,7 +916,8 @@ int main(int _argc, const char* _argv[]) triangleReorder(indexData + prim1.m_startIndex, prim1.m_numIndices, numVertices, 32); if (compress) { - triangleCompress(&memWriter + triangleCompress( + &memWriter , indexData + prim1.m_startIndex , prim1.m_numIndices , vertexData + prim1.m_startVertex @@ -930,11 +947,11 @@ int main(int _argc, const char* _argv[]) } vertices = vertexData; - indices = indexData; + indices = indexData; numVertices = 0; - numIndices = 0; + numIndices = 0; prim.m_startVertex = 0; - prim.m_startIndex = 0; + prim.m_startIndex = 0; ++numPrimitives; material = groupIt->m_material; diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.cpp b/3rdparty/bgfx/tools/shaderc/shaderc.cpp index f8d22df4fd1..bc92f90570d 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -13,12 +13,13 @@ extern "C" #include } // extern "C" -#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x3) -#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x5) -#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x5) +#define BGFX_SHADER_BIN_VERSION 6 +#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', BGFX_SHADER_BIN_VERSION) +#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', BGFX_SHADER_BIN_VERSION) +#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', BGFX_SHADER_BIN_VERSION) #define BGFX_SHADERC_VERSION_MAJOR 1 -#define BGFX_SHADERC_VERSION_MINOR 6 +#define BGFX_SHADERC_VERSION_MINOR 16 namespace bgfx { @@ -112,8 +113,12 @@ namespace bgfx "uint2", "uint3", "uint4", + "isampler2D", + "usampler2D", "isampler3D", "usampler3D", + "isamplerCube", + "usamplerCube", NULL }; @@ -164,6 +169,7 @@ namespace bgfx , preferFlowControl(false) , backwardsCompatibility(false) , warningsAreErrors(false) + , keepIntermediate(false) , optimize(false) , optimizationLevel(3) { @@ -188,6 +194,7 @@ namespace bgfx "\t preferFlowControl: %s\n" "\t backwardsCompatibility: %s\n" "\t warningsAreErrors: %s\n" + "\t keepIntermediate: %s\n" "\t optimize: %s\n" "\t optimizationLevel: %d\n" @@ -207,18 +214,25 @@ namespace bgfx , preferFlowControl ? "true" : "false" , backwardsCompatibility ? "true" : "false" , warningsAreErrors ? "true" : "false" + , keepIntermediate ? "true" : "false" , optimize ? "true" : "false" , optimizationLevel ); - for(size_t i=0; i Buffer; Buffer m_buffer; }; @@ -400,8 +414,18 @@ namespace bgfx class File { public: - File(const char* _filePath) + File() : m_data(NULL) + , m_size(0) + { + } + + ~File() + { + delete [] m_data; + } + + void load(const bx::FilePath& _filePath) { bx::FileReader reader; if (bx::open(&reader, _filePath) ) @@ -423,11 +447,6 @@ namespace bgfx } } - ~File() - { - delete [] m_data; - } - const char* getData() const { return m_data; @@ -464,12 +483,12 @@ namespace bgfx replace[len] = '\0'; BX_CHECK(len >= bx::strLen(_replace), ""); - for (const char* ptr = bx::strFind(_str, _find) - ; NULL != ptr - ; ptr = bx::strFind(ptr + len, _find) + for (bx::StringView ptr = bx::strFind(_str, _find) + ; !ptr.isEmpty() + ; ptr = bx::strFind(ptr.getPtr() + len, _find) ) { - bx::memCopy(const_cast(ptr), replace, len); + bx::memCopy(const_cast(ptr.getPtr() ), replace, len); } } @@ -552,7 +571,7 @@ namespace bgfx m_tagptr->data = (void*)fppError; m_tagptr++; - m_tagptr->tag = FPPTAG_IGNOREVERSION; + m_tagptr->tag = FPPTAG_SHOWVERSION; m_tagptr->data = (void*)0; m_tagptr++; @@ -605,16 +624,16 @@ namespace bgfx { char* start = scratch(_includeDir); - for (char* split = const_cast(bx::strFind(start, ';') ) - ; NULL != split - ; split = const_cast(bx::strFind(start, ';') ) + for (bx::StringView split = bx::strFind(start, ';') + ; !split.isEmpty() + ; split = bx::strFind(start, ';') ) { - *split = '\0'; + *const_cast(split.getPtr() ) = '\0'; m_tagptr->tag = FPPTAG_INCLUDE_DIR; m_tagptr->data = start; m_tagptr++; - start = split + 1; + start = const_cast(split.getPtr() ) + 1; } m_tagptr->tag = FPPTAG_INCLUDE_DIR; @@ -638,8 +657,10 @@ namespace bgfx int32_t len = bx::strLen(_input)+1; char* temp = new char[len]; - bx::eolLF(temp, len, _input); - m_input += temp; + bx::StringView normalized = bx::normalizeEolLf(temp, len, _input); + std::string str; + str.assign(normalized.getPtr(), normalized.getTerm() ); + m_input += str; delete [] temp; fppTag* tagptr = m_tagptr; @@ -720,7 +741,7 @@ namespace bgfx uint32_t parseInOut(InOut& _inout, const char* _str, const char* _eol) { uint32_t hash = 0; - _str = bx::strws(_str); + _str = bx::strLTrimSpace(_str).getPtr(); if (_str < _eol) { @@ -734,7 +755,7 @@ namespace bgfx std::string token; token.assign(_str, delim-_str); _inout.push_back(token); - _str = bx::strws(delim + 1); + _str = bx::strLTrimSpace(delim + 1).getPtr(); } } while (delim < _eol && _str < _eol && NULL != delim); @@ -759,12 +780,12 @@ namespace bgfx bx::snprintf(find, sizeof(find), "gl_FragData[%d]", _idx); char replace[32]; - bx::snprintf(replace, sizeof(replace), "gl_FragData_%d_", _idx); + bx::snprintf(replace, sizeof(replace), "bgfx_FragData%d", _idx); strReplace(_data, find, replace); _preprocessor.writef( - " \\\n\t%sout vec4 gl_FragData_%d_ : SV_TARGET%d" + " \\\n\t%sout vec4 bgfx_FragData%d : SV_TARGET%d" , _comma ? ", " : " " , _idx , _idx @@ -779,13 +800,10 @@ namespace bgfx strReplace(_data, find, "bgfx_VoidFrag"); } - const char* baseName(const char* _filePath) + bx::StringView baseName(const bx::StringView& _filePath) { bx::FilePath fp(_filePath); - char tmp[bx::kMaxFilePath]; - bx::strCopy(tmp, BX_COUNTOF(tmp), fp.getFileName() ); - const char* base = bx::strFind(_filePath, tmp); - return base; + return bx::strFind(_filePath, fp.getBaseName() ); } // c - compute @@ -816,7 +834,7 @@ namespace bgfx fprintf(stderr , "shaderc, bgfx shader compiler tool, version %d.%d.%d.\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" + "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" , BGFX_SHADERC_VERSION_MAJOR , BGFX_SHADERC_VERSION_MINOR @@ -831,9 +849,9 @@ namespace bgfx " -h, --help Help.\n" " -v, --version Version information only.\n" " -f Input file path.\n" - " -i Include path (for multiple paths use use -i multiple times).\n" + " -i Include path (for multiple paths use -i multiple times).\n" " -o Output file path.\n" - " --bin2c Generate C header file.\n" + " --bin2c [array name] Generate C header file. If array name is not specified base file name will be used as name.\n" " --depends Generate makefile style depends file.\n" " --platform Target platform.\n" " android\n" @@ -865,8 +883,14 @@ namespace bgfx ); } + bx::StringView nextWord(bx::StringView& _parse) + { + bx::StringView word = bx::strWord(bx::strLTrimSpace(_parse) ); + _parse = bx::strLTrimSpace(bx::StringView(word.getTerm(), _parse.getTerm() ) ); + return word; + } - bool compileShader(const char* _varying, char* _shader, uint32_t _shaderLen, Options& _options, bx::FileWriter* _writer) + bool compileShader(const char* _varying, const char* _comment, char* _shader, uint32_t _shaderLen, Options& _options, bx::FileWriter* _writer) { uint32_t glsl = 0; uint32_t essl = 0; @@ -909,7 +933,7 @@ namespace bgfx } else { - glsl = atoi(profile); + bx::fromString(&glsl, profile); } } else @@ -919,14 +943,20 @@ namespace bgfx Preprocessor preprocessor(_options.inputFilePath.c_str(), 0 != essl); - for(size_t i=0; i<_options.includeDirs.size(); ++i) - preprocessor.addInclude(_options.includeDirs[i].c_str()); + for (size_t ii = 0; ii < _options.includeDirs.size(); ++ii) + { + preprocessor.addInclude(_options.includeDirs[ii].c_str() ); + } - for(size_t i=0; i<_options.defines.size(); ++i) - preprocessor.setDefine(_options.defines[i].c_str()); + for (size_t ii = 0; ii < _options.defines.size(); ++ii) + { + preprocessor.setDefine(_options.defines[ii].c_str() ); + } - for(size_t i=0; i<_options.dependencies.size(); ++i) - preprocessor.addDependency(_options.dependencies[i].c_str()); + for (size_t ii = 0; ii < _options.dependencies.size(); ++ii) + { + preprocessor.addDependency(_options.dependencies[ii].c_str() ); + } preprocessor.setDefaultDefine("BX_PLATFORM_ANDROID"); preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN"); @@ -1029,30 +1059,34 @@ namespace bgfx bool compiled = false; VaryingMap varyingMap; - const char* parse = _varying; + bx::StringView parse(_varying); + bx::StringView term(parse); - while (NULL != parse - && *parse != '\0') + bool usesInterpolationQualifiers = false; + + while (!parse.isEmpty() ) { - parse = bx::strws(parse); - const char* eol = bx::strFind(parse, ';'); - if (NULL == eol) + parse = bx::strLTrimSpace(parse); + bx::StringView eol = bx::strFind(parse, ';'); + if (eol.isEmpty() ) { - eol = bx::streol(parse); + eol = bx::strFindEol(parse); } - if (NULL != eol) + if (!eol.isEmpty() ) { - const char* precision = NULL; - const char* interpolation = NULL; - const char* typen = parse; + eol.set(eol.getPtr() + 1, parse.getTerm() ); + + bx::StringView precision; + bx::StringView interpolation; + bx::StringView typen = nextWord(parse); if (0 == bx::strCmp(typen, "lowp", 4) || 0 == bx::strCmp(typen, "mediump", 7) || 0 == bx::strCmp(typen, "highp", 5) ) { precision = typen; - typen = parse = bx::strws(bx::strword(parse) ); + typen = nextWord(parse); } if (0 == bx::strCmp(typen, "flat", 4) @@ -1061,35 +1095,45 @@ namespace bgfx || 0 == bx::strCmp(typen, "centroid", 8) ) { interpolation = typen; - typen = parse = bx::strws(bx::strword(parse) ); + typen = nextWord(parse); + usesInterpolationQualifiers = true; } - const char* name = parse = bx::strws(bx::strword(parse) ); - const char* column = parse = bx::strws(bx::strword(parse) ); - const char* semantics = parse = bx::strws( (*parse == ':' ? ++parse : parse) ); - const char* assign = parse = bx::strws(bx::strword(parse) ); - const char* init = parse = bx::strws( (*parse == '=' ? ++parse : parse) ); + bx::StringView name = nextWord(parse); + bx::StringView column = bx::strSubstr(parse, 0, 1); + bx::StringView semantics; + if (0 == bx::strCmp(column, ":", 1) ) + { + parse = bx::strLTrimSpace(bx::StringView(parse.getPtr() + 1, parse.getTerm() ) ); + semantics = nextWord(parse); + } - if (typen < eol - && name < eol - && column < eol - && ':' == *column - && semantics < eol) + bx::StringView assign = bx::strSubstr(parse, 0, 1); + bx::StringView init; + if (0 == bx::strCmp(assign, "=", 1)) + { + parse = bx::strLTrimSpace(bx::StringView(parse.getPtr() + 1, parse.getTerm() ) ); + init.set(parse.getPtr(), eol.getPtr() ); + } + + if (!typen.isEmpty() + && !name.isEmpty() + && !semantics.isEmpty() ) { Varying var; - if (NULL != precision) + if (!precision.isEmpty() ) { - var.m_precision.assign(precision, bx::strword(precision)-precision); + var.m_precision.assign(precision.getPtr(), precision.getTerm() ); } - if (NULL != interpolation) + if (!interpolation.isEmpty() ) { - var.m_interpolation.assign(interpolation, bx::strword(interpolation)-interpolation); + var.m_interpolation.assign(interpolation.getPtr(), interpolation.getTerm() ); } - var.m_type.assign(typen, bx::strword(typen)-typen); - var.m_name.assign(name, bx::strword(name)-name); - var.m_semantics.assign(semantics, bx::strword(semantics)-semantics); + var.m_type.assign(typen.getPtr(), typen.getTerm() ); + var.m_name.assign(name.getPtr(), name.getTerm() ); + var.m_semantics.assign(semantics.getPtr(), semantics.getTerm() ); if (d3d == 9 && var.m_semantics == "BITANGENT") @@ -1097,17 +1141,15 @@ namespace bgfx var.m_semantics = "BINORMAL"; } - if (assign < eol - && '=' == *assign - && init < eol) + if (!init.isEmpty() ) { - var.m_init.assign(init, eol-init); + var.m_init.assign(init.getPtr(), init.getTerm() ); } varyingMap.insert(std::make_pair(var.m_name, var) ); } - parse = bx::strws(bx::strnl(eol) ); + parse = bx::strLTrimSpace(bx::strFindNl(bx::StringView(eol.getPtr(), term.getTerm() ) ) ); } } @@ -1124,16 +1166,21 @@ namespace bgfx data = _shader; uint32_t size = _shaderLen; - const size_t padding = 4096; + const size_t padding = 16384; if (!raw) { // To avoid commented code being recognized as used feature, // first preprocess pass is used to strip all comments before // substituting code. - preprocessor.run(data); + bool ok = preprocessor.run(data); delete [] data; + if (!ok) + { + return false; + } + size = (uint32_t)preprocessor.m_preprocessed.size(); data = new char[size+padding+1]; bx::memCopy(data, preprocessor.m_preprocessed.c_str(), size); @@ -1142,27 +1189,27 @@ namespace bgfx strNormalizeEol(data); - input = const_cast(bx::strws(data) ); + input = const_cast(bx::strLTrimSpace(data).getPtr() ); while (input[0] == '$') { - const char* str = bx::strws(input+1); - const char* eol = bx::streol(str); - const char* nl = bx::strnl(eol); - input = const_cast(nl); + const char* str = bx::strLTrimSpace(input+1).getPtr(); + bx::StringView eol = bx::strFindEol(str); + bx::StringView nl = bx::strFindNl(eol); + input = const_cast(nl.getPtr() ); if (0 == bx::strCmp(str, "input", 5) ) { str += 5; - const char* comment = bx::strFind(str, "//"); - eol = NULL != comment && comment < eol ? comment : eol; - inputHash = parseInOut(shaderInputs, str, eol); + bx::StringView comment = bx::strFind(str, "//"); + eol = !comment.isEmpty() && comment.getPtr() < eol.getPtr() ? comment.getPtr() : eol; + inputHash = parseInOut(shaderInputs, str, eol.getPtr() ); } else if (0 == bx::strCmp(str, "output", 6) ) { str += 6; - const char* comment = bx::strFind(str, "//"); - eol = NULL != comment && comment < eol ? comment : eol; - outputHash = parseInOut(shaderOutputs, str, eol); + bx::StringView comment = bx::strFind(str, "//"); + eol = !comment.isEmpty() && comment.getPtr() < eol.getPtr() ? comment.getPtr() : eol; + outputHash = parseInOut(shaderOutputs, str, eol.getPtr() ); } else if (0 == bx::strCmp(str, "raw", 3) ) { @@ -1170,7 +1217,7 @@ namespace bgfx str += 3; } - input = const_cast(bx::strws(input) ); + input = const_cast(bx::strLTrimSpace(input).getPtr() ); } } @@ -1180,15 +1227,18 @@ namespace bgfx { bx::write(_writer, BGFX_CHUNK_MAGIC_FSH); bx::write(_writer, inputHash); + bx::write(_writer, uint32_t(0) ); } else if ('v' == _options.shaderType) { bx::write(_writer, BGFX_CHUNK_MAGIC_VSH); + bx::write(_writer, uint32_t(0) ); bx::write(_writer, outputHash); } else { bx::write(_writer, BGFX_CHUNK_MAGIC_CSH); + bx::write(_writer, uint32_t(0) ); bx::write(_writer, outputHash); } @@ -1214,8 +1264,8 @@ namespace bgfx } else if ('c' == _options.shaderType) // Compute { - char* entry = const_cast(bx::strFind(input, "void main()") ); - if (NULL == entry) + bx::StringView entry = bx::strFind(input, "void main()"); + if (entry.isEmpty() ) { fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); } @@ -1228,6 +1278,11 @@ namespace bgfx } else { + if (0 != pssl) + { + preprocessor.writef(getPsslPreamble() ); + } + preprocessor.writef( "#define lowp\n" "#define mediump\n" @@ -1246,17 +1301,17 @@ namespace bgfx "#define mat4 float4x4\n" ); - entry[4] = '_'; + *const_cast(entry.getPtr() + 4) = '_'; preprocessor.writef("#define void_main()"); preprocessor.writef(" \\\n\tvoid main("); uint32_t arg = 0; - const bool hasLocalInvocationID = NULL != bx::strFind(input, "gl_LocalInvocationID"); - const bool hasLocalInvocationIndex = NULL != bx::strFind(input, "gl_LocalInvocationIndex"); - const bool hasGlobalInvocationID = NULL != bx::strFind(input, "gl_GlobalInvocationID"); - const bool hasWorkGroupID = NULL != bx::strFind(input, "gl_WorkGroupID"); + const bool hasLocalInvocationID = !bx::strFind(input, "gl_LocalInvocationID").isEmpty(); + const bool hasLocalInvocationIndex = !bx::strFind(input, "gl_LocalInvocationIndex").isEmpty(); + const bool hasGlobalInvocationID = !bx::strFind(input, "gl_GlobalInvocationID").isEmpty(); + const bool hasWorkGroupID = !bx::strFind(input, "gl_WorkGroupID").isEmpty(); if (hasLocalInvocationID) { @@ -1297,9 +1352,6 @@ namespace bgfx if (preprocessor.run(input) ) { - //BX_TRACE("Input file: %s", filePath); - //BX_TRACE("Output file: %s", outFilePath); - if (_options.preprocessOnly) { bx::write(_writer, preprocessor.m_preprocessed.c_str(), (int32_t)preprocessor.m_preprocessed.size() ); @@ -1308,14 +1360,15 @@ namespace bgfx } { + std::string code; + bx::write(_writer, BGFX_CHUNK_MAGIC_CSH); + bx::write(_writer, uint32_t(0) ); bx::write(_writer, outputHash); if (0 != glsl || 0 != essl) { - std::string code; - if (essl) { bx::stringPrintf(code, "#version 310 es\n"); @@ -1325,8 +1378,9 @@ namespace bgfx bx::stringPrintf(code, "#version %d\n", glsl == 0 ? 430 : glsl); } - code += preprocessor.m_preprocessed; #if 1 + code += preprocessor.m_preprocessed; + bx::write(_writer, uint16_t(0) ); uint32_t shaderSize = (uint32_t)code.size(); @@ -1336,20 +1390,29 @@ namespace bgfx compiled = true; #else + code += _comment; + code += preprocessor.m_preprocessed; + compiled = compileGLSLShader(cmdLine, essl, code, writer); #endif // 0 } - else if (0 != spirv) - { - compiled = compileSPIRVShader(_options, 0, preprocessor.m_preprocessed, _writer); - } - else if (0 != pssl) - { - compiled = compilePSSLShader(_options, 0, preprocessor.m_preprocessed, _writer); - } else { - compiled = compileHLSLShader(_options, d3d, preprocessor.m_preprocessed, _writer); + code += _comment; + code += preprocessor.m_preprocessed; + + if (0 != spirv) + { + compiled = compileSPIRVShader(_options, 0, code, _writer); + } + else if (0 != pssl) + { + compiled = compilePSSLShader(_options, 0, code, _writer); + } + else + { + compiled = compileHLSLShader(_options, d3d, code, _writer); + } } } @@ -1372,8 +1435,9 @@ namespace bgfx } else // Vertex/Fragment { - char* entry = const_cast(bx::strFind(input, "void main()") ); - if (NULL == entry) + bx::StringView shader(input); + bx::StringView entry = bx::strFind(shader, "void main()"); + if (entry.isEmpty() ) { fprintf(stderr, "Shader entry point 'void main()' is not found.\n"); } @@ -1439,6 +1503,11 @@ namespace bgfx } else { + if (0 != pssl) + { + preprocessor.writef(getPsslPreamble() ); + } + preprocessor.writef( "#define lowp\n" "#define mediump\n" @@ -1468,21 +1537,21 @@ namespace bgfx ); } - entry[4] = '_'; + *const_cast(entry.getPtr() + 4) = '_'; if ('f' == _options.shaderType) { - const char* insert = bx::strFind(entry, "{"); - if (NULL != insert) + bx::StringView insert = bx::strFind(bx::StringView(entry.getPtr(), shader.getTerm() ), "{"); + if (!insert.isEmpty() ) { - insert = strInsert(const_cast(insert+1), "\nvec4 bgfx_VoidFrag = vec4_splat(0.0);\n"); + insert = strInsert(const_cast(insert.getPtr()+1), "\nvec4 bgfx_VoidFrag = vec4_splat(0.0);\n"); } - const bool hasFragColor = NULL != bx::strFind(input, "gl_FragColor"); - const bool hasFragCoord = NULL != bx::strFind(input, "gl_FragCoord") || hlsl > 3 || hlsl == 2; - const bool hasFragDepth = NULL != bx::strFind(input, "gl_FragDepth"); - const bool hasFrontFacing = NULL != bx::strFind(input, "gl_FrontFacing"); - const bool hasPrimitiveId = NULL != bx::strFind(input, "gl_PrimitiveID"); + const bool hasFragColor = !bx::strFind(input, "gl_FragColor").isEmpty(); + const bool hasFragCoord = !bx::strFind(input, "gl_FragCoord").isEmpty() || hlsl > 3 || hlsl == 2; + const bool hasFragDepth = !bx::strFind(input, "gl_FragDepth").isEmpty(); + const bool hasFrontFacing = !bx::strFind(input, "gl_FrontFacing").isEmpty(); + const bool hasPrimitiveId = !bx::strFind(input, "gl_PrimitiveID").isEmpty(); bool hasFragData[8] = {}; uint32_t numFragData = 0; @@ -1490,7 +1559,7 @@ namespace bgfx { char temp[32]; bx::snprintf(temp, BX_COUNTOF(temp), "gl_FragData[%d]", ii); - hasFragData[ii] = NULL != bx::strFind(input, temp); + hasFragData[ii] = !bx::strFind(input, temp).isEmpty(); numFragData += hasFragData[ii]; } @@ -1498,18 +1567,18 @@ namespace bgfx { // GL errors when both gl_FragColor and gl_FragData is used. // This will trigger the same error with HLSL compiler too. - preprocessor.writef("#define gl_FragColor gl_FragData_0_\n"); + preprocessor.writef("#define gl_FragColor bgfx_FragData0\n"); // If it has gl_FragData or gl_FragColor, color target at // index 0 exists, otherwise shader is not modifying color // targets. hasFragData[0] |= hasFragColor || d3d < 11; - if (NULL != insert + if (!insert.isEmpty() && d3d < 11 && !hasFragColor) { - insert = strInsert(const_cast(insert+1), "\ngl_FragColor = bgfx_VoidFrag;\n"); + insert = strInsert(const_cast(insert.getPtr()+1), "\ngl_FragColor = bgfx_VoidFrag;\n"); } } @@ -1565,18 +1634,27 @@ namespace bgfx ); } - if (hasFrontFacing - && hlsl >= 3) + if (hasFrontFacing) { - preprocessor.writef( - " \\\n\t%sfloat __vface : VFACE" - , arg++ > 0 ? ", " : " " - ); + if (hlsl == 3) + { + preprocessor.writef( + " \\\n\t%sfloat __vface : VFACE" + , arg++ > 0 ? ", " : " " + ); + } + else + { + preprocessor.writef( + " \\\n\t%sbool gl_FrontFacing : SV_IsFrontFace" + , arg++ > 0 ? ", " : " " + ); + } } if (hasPrimitiveId) { - if (d3d > 9) + if (hlsl > 3) { preprocessor.writef( " \\\n\t%suint gl_PrimitiveID : SV_PrimitiveID" @@ -1596,32 +1674,26 @@ namespace bgfx if (hasFrontFacing) { - if (hlsl >= 3) + if (hlsl == 3) { preprocessor.writef( - "#define gl_FrontFacing (__vface <= 0.0)\n" - ); - } - else - { - preprocessor.writef( - "#define gl_FrontFacing false\n" + "#define gl_FrontFacing (__vface >= 0.0)\n" ); } } } else if ('v' == _options.shaderType) { - const bool hasVertexId = NULL != bx::strFind(input, "gl_VertexID"); - const bool hasInstanceId = NULL != bx::strFind(input, "gl_InstanceID"); + const bool hasVertexId = !bx::strFind(input, "gl_VertexID").isEmpty(); + const bool hasInstanceId = !bx::strFind(input, "gl_InstanceID").isEmpty(); - const char* brace = bx::strFind(entry, "{"); - if (NULL != brace) + bx::StringView brace = bx::strFind(bx::StringView(entry.getPtr(), shader.getTerm() ), "{"); + if (!brace.isEmpty() ) { - const char* end = bx::strmb(brace, '{', '}'); - if (NULL != end) + bx::StringView block = bx::strFindBlock(bx::StringView(brace.getPtr(), shader.getTerm() ), '{', '}'); + if (!block.isEmpty() ) { - strInsert(const_cast(end), "__RETURN__;\n"); + strInsert(const_cast(block.getTerm()-1), "__RETURN__;\n"); } } @@ -1637,8 +1709,18 @@ namespace bgfx if (varyingIt != varyingMap.end() ) { const Varying& var = varyingIt->second; - preprocessor.writef("\t%s %s : %s;\n", var.m_type.c_str(), var.m_name.c_str(), var.m_semantics.c_str() ); - preprocessor.writef("#define %s _varying_.%s\n", var.m_name.c_str(), var.m_name.c_str() ); + preprocessor.writef( + "\t%s %s %s : %s;\n" + , interpolationDx11(var.m_interpolation.c_str() ) + , var.m_type.c_str() + , var.m_name.c_str() + , var.m_semantics.c_str() + ); + preprocessor.writef( + "#define %s _varying_.%s\n" + , var.m_name.c_str() + , var.m_name.c_str() + ); } } preprocessor.writef( @@ -1730,6 +1812,13 @@ namespace bgfx // ); } + if (0 != spirv) + { + preprocessor.writef( + "\tgl_Position.y = -gl_Position.y; \\\n" + ); + } + preprocessor.writef( "\treturn _varying_" ); @@ -1760,19 +1849,24 @@ namespace bgfx } { + std::string code; + if ('f' == _options.shaderType) { bx::write(_writer, BGFX_CHUNK_MAGIC_FSH); bx::write(_writer, inputHash); + bx::write(_writer, uint32_t(0) ); } else if ('v' == _options.shaderType) { bx::write(_writer, BGFX_CHUNK_MAGIC_VSH); + bx::write(_writer, uint32_t(0) ); bx::write(_writer, outputHash); } else { bx::write(_writer, BGFX_CHUNK_MAGIC_CSH); + bx::write(_writer, uint32_t(0) ); bx::write(_writer, outputHash); } @@ -1780,26 +1874,30 @@ namespace bgfx || 0 != essl || 0 != metal) { - std::string code; + if (!bx::strFind(preprocessor.m_preprocessed.c_str(), "layout(std430").isEmpty() ) + { + glsl = 430; + } if (glsl < 400) { const bool usesTextureLod = false - || !!bx::findIdentifierMatch(input, s_ARB_shader_texture_lod) - || !!bx::findIdentifierMatch(input, s_EXT_shader_texture_lod) + || !bx::findIdentifierMatch(input, s_ARB_shader_texture_lod).isEmpty() + || !bx::findIdentifierMatch(input, s_EXT_shader_texture_lod).isEmpty() ; - const bool usesInstanceID = !!bx::strFind(input, "gl_InstanceID"); - const bool usesGpuShader4 = !!bx::findIdentifierMatch(input, s_EXT_gpu_shader4); - const bool usesGpuShader5 = !!bx::findIdentifierMatch(input, s_ARB_gpu_shader5); - const bool usesTexelFetch = !!bx::findIdentifierMatch(input, s_texelFetch); - const bool usesTextureMS = !!bx::findIdentifierMatch(input, s_ARB_texture_multisample); - const bool usesTextureArray = !!bx::findIdentifierMatch(input, s_textureArray); - const bool usesPacking = !!bx::findIdentifierMatch(input, s_ARB_shading_language_packing); + const bool usesInstanceID = !bx::findIdentifierMatch(input, "gl_InstanceID").isEmpty(); + const bool usesGpuShader4 = !bx::findIdentifierMatch(input, s_EXT_gpu_shader4).isEmpty(); + const bool usesGpuShader5 = !bx::findIdentifierMatch(input, s_ARB_gpu_shader5).isEmpty(); + const bool usesTexelFetch = !bx::findIdentifierMatch(input, s_texelFetch).isEmpty(); + const bool usesTextureMS = !bx::findIdentifierMatch(input, s_ARB_texture_multisample).isEmpty(); + const bool usesTextureArray = !bx::findIdentifierMatch(input, s_textureArray).isEmpty(); + const bool usesPacking = !bx::findIdentifierMatch(input, s_ARB_shading_language_packing).isEmpty(); if (0 == essl) { const bool need130 = 120 == glsl && (false - || bx::findIdentifierMatch(input, s_130) + || !bx::findIdentifierMatch(input, s_130).isEmpty() + || usesInterpolationQualifiers || usesTexelFetch ); @@ -1813,6 +1911,13 @@ namespace bgfx glsl = 130; } + if (need130) + { + bx::stringPrintf(code, "#define varying %s\n" + , 'f' == _options.shaderType ? "in" : "out" + ); + } + if (usesInstanceID) { bx::stringPrintf(code @@ -1908,7 +2013,7 @@ namespace bgfx { bx::stringPrintf(code , "#define bgfxShadow2D(_sampler, _coord) vec4_splat(texture(_sampler, _coord))\n" - "#define bgfxShadow2DProj(_sampler, _coord) vec4_splat(textureProj(_sampler, _coord))\n" + "#define bgfxShadow2DProj(_sampler, _coord) vec4_splat(textureProj(_sampler, _coord))\n" ); } else @@ -1921,37 +2026,89 @@ namespace bgfx } else { + if (usesInterpolationQualifiers) + { + bx::stringPrintf(code, "#version 300 es\n"); + bx::stringPrintf(code, "#define attribute in\n"); + bx::stringPrintf(code, "#define varying %s\n" + , 'f' == _options.shaderType ? "in" : "out" + ); + } + else if (essl == 2) + { + code += + "mat2 transpose(mat2 _mtx)\n" + "{\n" + " vec2 v0 = _mtx[0];\n" + " vec2 v1 = _mtx[1];\n" + "\n" + " return mat2(\n" + " vec2(v0.x, v1.x)\n" + " , vec2(v0.y, v1.y)\n" + " );\n" + "}\n" + "\n" + "mat3 transpose(mat3 _mtx)\n" + "{\n" + " vec3 v0 = _mtx[0];\n" + " vec3 v1 = _mtx[1];\n" + " vec3 v2 = _mtx[2];\n" + "\n" + " return mat3(\n" + " vec3(v0.x, v1.x, v2.x)\n" + " , vec3(v0.y, v1.y, v2.y)\n" + " , vec3(v0.z, v1.z, v2.z)\n" + " );\n" + "}\n" + "\n" + "mat4 transpose(mat4 _mtx)\n" + "{\n" + " vec4 v0 = _mtx[0];\n" + " vec4 v1 = _mtx[1];\n" + " vec4 v2 = _mtx[2];\n" + " vec4 v3 = _mtx[3];\n" + "\n" + " return mat4(\n" + " vec4(v0.x, v1.x, v2.x, v3.x)\n" + " , vec4(v0.y, v1.y, v2.y, v3.y)\n" + " , vec4(v0.z, v1.z, v2.z, v3.z)\n" + " , vec4(v0.w, v1.w, v2.w, v3.w)\n" + " );\n" + "}\n" + ; + } + // Pretend that all extensions are available. // This will be stripped later. if (usesTextureLod) { bx::stringPrintf(code , "#extension GL_EXT_shader_texture_lod : enable\n" - "#define texture2DLod texture2DLodEXT\n" - "#define texture2DGrad texture2DGradEXT\n" - "#define texture2DProjLod texture2DProjLodEXT\n" - "#define texture2DProjGrad texture2DProjGradEXT\n" - "#define textureCubeLod textureCubeLodEXT\n" - "#define textureCubeGrad textureCubeGradEXT\n" + "#define texture2DLod texture2DLodEXT\n" + "#define texture2DGrad texture2DGradEXT\n" + "#define texture2DProjLod texture2DProjLodEXT\n" + "#define texture2DProjGrad texture2DProjGradEXT\n" + "#define textureCubeLod textureCubeLodEXT\n" + "#define textureCubeGrad textureCubeGradEXT\n" ); } - if (NULL != bx::findIdentifierMatch(input, s_OES_standard_derivatives) ) + if (!bx::findIdentifierMatch(input, s_OES_standard_derivatives).isEmpty() ) { bx::stringPrintf(code, "#extension GL_OES_standard_derivatives : enable\n"); } - if (NULL != bx::findIdentifierMatch(input, s_OES_texture_3D) ) + if (!bx::findIdentifierMatch(input, s_OES_texture_3D).isEmpty() ) { bx::stringPrintf(code, "#extension GL_OES_texture_3D : enable\n"); } - if (NULL != bx::findIdentifierMatch(input, s_EXT_shadow_samplers) ) + if (!bx::findIdentifierMatch(input, s_EXT_shadow_samplers).isEmpty() ) { bx::stringPrintf(code , "#extension GL_EXT_shadow_samplers : enable\n" - "#define shadow2D shadow2DEXT\n" - "#define shadow2DProj shadow2DProjEXT\n" + "#define shadow2D shadow2DEXT\n" + "#define shadow2DProj shadow2DProjEXT\n" ); } @@ -1969,11 +2126,11 @@ namespace bgfx ); } - if (NULL != bx::findIdentifierMatch(input, "gl_FragDepth") ) + if (!bx::findIdentifierMatch(input, "gl_FragDepth").isEmpty() ) { bx::stringPrintf(code , "#extension GL_EXT_frag_depth : enable\n" - "#define gl_FragDepth gl_FragDepthEXT\n" + "#define gl_FragDepth gl_FragDepthEXT\n" ); } @@ -1984,22 +2141,42 @@ namespace bgfx ); } - bx::stringPrintf(code, - "#define ivec2 vec2\n" - "#define ivec3 vec3\n" - "#define ivec4 vec4\n" - ); + bx::stringPrintf(code + , "#define ivec2 vec2\n" + "#define ivec3 vec3\n" + "#define ivec4 vec4\n" + ); } } else { bx::stringPrintf(code, "#version %d\n", glsl); - } - code += preprocessor.m_preprocessed; + bx::stringPrintf(code + , "#define texture2DLod textureLod\n" + "#define texture2DGrad textureGrad\n" + "#define texture2DProjLod textureProjLod\n" + "#define texture2DProjGrad textureProjGrad\n" + "#define textureCubeLod textureLod\n" + "#define textureCubeGrad textureGrad\n" + "#define texture3D texture\n" + ); + + bx::stringPrintf(code, "#define attribute in\n"); + bx::stringPrintf(code, "#define varying %s\n" + , 'f' == _options.shaderType ? "in" : "out" + ); + + bx::stringPrintf(code + , "#define bgfxShadow2D(_sampler, _coord) vec4_splat(texture(_sampler, _coord))\n" + "#define bgfxShadow2DProj(_sampler, _coord) vec4_splat(textureProj(_sampler, _coord))\n" + ); + } if (glsl > 400) { + code += preprocessor.m_preprocessed; + bx::write(_writer, uint16_t(0) ); uint32_t shaderSize = (uint32_t)code.size(); @@ -2011,36 +2188,29 @@ namespace bgfx } else { - compiled = compileGLSLShader(_options - , metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl - , code - , _writer - ); + code += _comment; + code += preprocessor.m_preprocessed; + + compiled = compileGLSLShader(_options, metal ? BX_MAKEFOURCC('M', 'T', 'L', 0) : essl, code, _writer); } } - else if (0 != spirv) - { - compiled = compileSPIRVShader(_options - , 0 - , preprocessor.m_preprocessed - , _writer - ); - } - else if (0 != pssl) - { - compiled = compilePSSLShader(_options - , 0 - , preprocessor.m_preprocessed - , _writer - ); - } else { - compiled = compileHLSLShader(_options - , d3d - , preprocessor.m_preprocessed - , _writer - ); + code += _comment; + code += preprocessor.m_preprocessed; + + if (0 != spirv) + { + compiled = compileSPIRVShader(_options, 0, code, _writer); + } + else if (0 != pssl) + { + compiled = compilePSSLShader(_options, 0, code, _writer); + } + else + { + compiled = compileHLSLShader(_options, d3d, code, _writer); + } } } @@ -2134,14 +2304,15 @@ namespace bgfx options.profile = profile; } - { // hlsl only - options.debugInformation = cmdLine.hasArg('\0', "debug"); - options.avoidFlowControl = cmdLine.hasArg('\0', "avoid-flow-control"); - options.noPreshader = cmdLine.hasArg('\0', "no-preshader"); - options.partialPrecision = cmdLine.hasArg('\0', "partial-precision"); - options.preferFlowControl = cmdLine.hasArg('\0', "prefer-flow-control"); + { + options.debugInformation = cmdLine.hasArg('\0', "debug"); + options.avoidFlowControl = cmdLine.hasArg('\0', "avoid-flow-control"); + options.noPreshader = cmdLine.hasArg('\0', "no-preshader"); + options.partialPrecision = cmdLine.hasArg('\0', "partial-precision"); + options.preferFlowControl = cmdLine.hasArg('\0', "prefer-flow-control"); options.backwardsCompatibility = cmdLine.hasArg('\0', "backwards-compatibility"); - options.warningsAreErrors = cmdLine.hasArg('\0', "Werror"); + options.warningsAreErrors = cmdLine.hasArg('\0', "Werror"); + options.keepIntermediate = cmdLine.hasArg('\0', "keep-intermediate"); uint32_t optimization = 3; if (cmdLine.hasArg(optimization, 'O') ) @@ -2151,38 +2322,45 @@ namespace bgfx } } - const char* bin2c = NULL; + bx::StringView bin2c; if (cmdLine.hasArg("bin2c") ) { - bin2c = cmdLine.findOption("bin2c"); - if (NULL == bin2c) + const char* bin2cArg = cmdLine.findOption("bin2c"); + if (NULL != bin2cArg) + { + bin2c.set(bin2cArg); + } + else { bin2c = baseName(outFilePath); - uint32_t len = (uint32_t)bx::strLen(bin2c); - char* temp = (char*)alloca(len+1); - for (char *out = temp; *bin2c != '\0';) + if (!bin2c.isEmpty() ) { - char ch = *bin2c++; - if (isalnum(ch) ) + char* temp = (char*)alloca(bin2c.getLength()+1); + for (uint32_t ii = 0, num = bin2c.getLength(); ii < num; ++ii) { - *out++ = ch; + char ch = bin2c.getPtr()[ii]; + if (bx::isAlphaNum(ch) ) + { + temp[ii] = ch; + } + else + { + temp[ii] = '_'; + } } - else - { - *out++ = '_'; - } - } - temp[len] = '\0'; - bin2c = temp; + temp[bin2c.getLength()] = '\0'; + + bin2c = temp; + } } } - bool depends = cmdLine.hasArg("depends"); + options.depends = cmdLine.hasArg("depends"); options.preprocessOnly = cmdLine.hasArg("preprocess"); const char* includeDir = cmdLine.findOption('i'); - BX_TRACE("depends: %d", depends); + BX_TRACE("depends: %d", options.depends); BX_TRACE("preprocessOnly: %d", options.preprocessOnly); BX_TRACE("includeDir: %s", includeDir); @@ -2194,30 +2372,32 @@ namespace bgfx std::string dir; { - const char* base = baseName(filePath); + bx::FilePath fp(filePath); + bx::StringView path(fp.getPath() ); - if (base != filePath) - { - dir.assign(filePath, base-filePath); - options.includeDirs.push_back(dir.c_str()); - } + dir.assign(path.getPtr(), path.getTerm() ); + options.includeDirs.push_back(dir); } const char* defines = cmdLine.findOption("define"); while (NULL != defines && '\0' != *defines) { - defines = bx::strws(defines); - const char* eol = bx::strFind(defines, ';'); - if (NULL == eol) - { - eol = defines + bx::strLen(defines); - } - std::string define(defines, eol); + defines = bx::strLTrimSpace(defines).getPtr(); + bx::StringView eol = bx::strFind(defines, ';'); + std::string define(defines, eol.getPtr() ); options.defines.push_back(define.c_str() ); - defines = ';' == *eol ? eol+1 : eol; + defines = ';' == *eol.getPtr() ? eol.getPtr()+1 : eol.getPtr(); } + std::string commandLineComment = "// shaderc command line:\n//"; + for (int32_t ii = 0, num = cmdLine.getNum(); ii < num; ++ii) + { + commandLineComment += " "; + commandLineComment += cmdLine.get(ii); + } + commandLineComment += "\n\n"; + bool compiled = false; bx::FileReader reader; @@ -2227,21 +2407,27 @@ namespace bgfx } else { - std::string defaultVarying = dir + "varying.def.sc"; - const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() ); - File attribdef(varyingdef); - const char* parse = attribdef.getData(); - if (NULL != parse - && *parse != '\0') + const char* varying = NULL; + File attribdef; + + if ('c' != options.shaderType) { - options.dependencies.push_back(varyingdef); - } - else - { - fprintf(stderr, "ERROR: Failed to parse varying def file: \"%s\" No input/output semantics will be generated in the code!\n", varyingdef); + std::string defaultVarying = dir + "varying.def.sc"; + const char* varyingdef = cmdLine.findOption("varyingdef", defaultVarying.c_str() ); + attribdef.load(varyingdef); + varying = attribdef.getData(); + if (NULL != varying + && *varying != '\0') + { + options.dependencies.push_back(varyingdef); + } + else + { + fprintf(stderr, "ERROR: Failed to parse varying def file: \"%s\" No input/output semantics will be generated in the code!\n", varyingdef); + } } - const size_t padding = 4096; + const size_t padding = 16384; uint32_t size = (uint32_t)bx::getSize(&reader); char* data = new char[size+padding+1]; size = (uint32_t)bx::read(&reader, data, size); @@ -2262,7 +2448,7 @@ namespace bgfx bx::FileWriter* writer = NULL; - if (NULL != bin2c) + if (!bin2c.isEmpty() ) { writer = new Bin2cWriter(bin2c); } @@ -2277,8 +2463,7 @@ namespace bgfx return bx::kExitFailure; } - if ( compileShader(attribdef.getData(), data, size, options, writer) ) - compiled = true; + compiled = compileShader(varying, commandLineComment.c_str(), data, size, options, writer); bx::close(writer); delete writer; diff --git a/3rdparty/bgfx/tools/shaderc/shaderc.h b/3rdparty/bgfx/tools/shaderc/shaderc.h index ef69add4ba1..1a2c78f12c8 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc.h +++ b/3rdparty/bgfx/tools/shaderc/shaderc.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -45,9 +45,7 @@ namespace bgfx #endif // SHADERC_CONFIG_HLSL #include -#include #include -#include #include #include #include @@ -89,7 +87,7 @@ namespace bgfx uint32_t pos = m_pos; const char* str = &m_str[pos]; - const char* nl = bx::strnl(str); + const char* nl = bx::strFindNl(str).getPtr(); pos += (uint32_t)(nl - str); const char* eol = &m_str[pos]; @@ -107,6 +105,8 @@ namespace bgfx uint32_t m_size; }; + bx::StringView nextWord(bx::StringView& _parse); + #define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10) #define BGFX_UNIFORM_SAMPLERBIT UINT8_C(0x20) @@ -152,6 +152,7 @@ namespace bgfx bool preferFlowControl; bool backwardsCompatibility; bool warningsAreErrors; + bool keepIntermediate; bool optimize; uint32_t optimizationLevel; @@ -169,6 +170,8 @@ namespace bgfx bool compilePSSLShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer); bool compileSPIRVShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer); + const char* getPsslPreamble(); + } // namespace bgfx #endif // SHADERC_H_HEADER_GUARD diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp index 7d2a0a1cd60..1547b3beab5 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_glsl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -62,6 +62,7 @@ namespace bgfx { namespace glsl printCode(_code.c_str(), line, start, end, column); fprintf(stderr, "Error: %s\n", log); + glslopt_shader_delete(shader); glslopt_cleanup(ctx); return false; } @@ -71,7 +72,7 @@ namespace bgfx { namespace glsl // Trim all directives. while ('#' == *optimizedShader) { - optimizedShader = bx::strnl(optimizedShader); + optimizedShader = bx::strFindNl(optimizedShader).getPtr(); } { @@ -103,17 +104,15 @@ namespace bgfx { namespace glsl if (target != kGlslTargetMetal) { - const char* parse = optimizedShader; + bx::StringView parse(optimizedShader); - while (NULL != parse - && *parse != '\0') + while (!parse.isEmpty() ) { - parse = bx::strws(parse); - const char* eol = bx::strFind(parse, ';'); - if (NULL != eol) + parse = bx::strLTrimSpace(parse); + bx::StringView eol = bx::strFind(parse, ';'); + if (!eol.isEmpty() ) { - const char* qualifier = parse; - parse = bx::strws(bx::strword(parse) ); + bx::StringView qualifier = nextWord(parse); if (0 == bx::strCmp(qualifier, "attribute", 9) || 0 == bx::strCmp(qualifier, "varying", 7) @@ -122,39 +121,38 @@ namespace bgfx { namespace glsl ) { // skip attributes and varyings. - parse = eol + 1; + parse.set(eol.getPtr() + 1, parse.getTerm() ); continue; } if (0 == bx::strCmp(parse, "tmpvar", 6) ) { // skip temporaries - parse = eol + 1; + parse.set(eol.getPtr() + 1, parse.getTerm() ); continue; } if (0 != bx::strCmp(qualifier, "uniform", 7) ) { // end if there is no uniform keyword. - parse = NULL; + parse.clear(); continue; } - const char* precision = NULL; - const char* typen = parse; + bx::StringView precision; + bx::StringView typen = nextWord(parse); if (0 == bx::strCmp(typen, "lowp", 4) || 0 == bx::strCmp(typen, "mediump", 7) || 0 == bx::strCmp(typen, "highp", 5) ) { precision = typen; - typen = parse = bx::strws(bx::strword(parse) ); + typen = nextWord(parse); } BX_UNUSED(precision); char uniformType[256]; - parse = bx::strword(parse); if (0 == bx::strCmp(typen, "sampler", 7) ) { @@ -162,26 +160,20 @@ namespace bgfx { namespace glsl } else { - bx::strCopy(uniformType, int32_t(parse-typen+1), typen); + bx::strCopy(uniformType, BX_COUNTOF(uniformType), typen); } - const char* name = parse = bx::strws(parse); + bx::StringView name = nextWord(parse); - char uniformName[256]; uint8_t num = 1; - const char* array = bx::strFind(bx::StringView(name, int32_t(eol-parse) ), "["); - if (NULL != array) + bx::StringView array = bx::strSubstr(parse, 0, 1); + if (0 == bx::strCmp(array, "[", 1) ) { - bx::strCopy(uniformName, int32_t(array-name+1), name); + parse = bx::strLTrimSpace(bx::StringView(parse.getPtr() + 1, parse.getTerm() ) ); - char arraySize[32]; - const char* end = bx::strFind(bx::StringView(array, int32_t(eol-array) ), "]"); - bx::strCopy(arraySize, int32_t(end-array), array+1); - num = uint8_t(atoi(arraySize) ); - } - else - { - bx::strCopy(uniformName, int32_t(eol-name+1), name); + uint32_t tmp; + bx::fromString(&tmp, parse); + num = uint8_t(tmp); } Uniform un; @@ -189,58 +181,63 @@ namespace bgfx { namespace glsl if (UniformType::Count != un.type) { - BX_TRACE("name: %s (type %d, num %d)", uniformName, un.type, num); + un.name.assign(name.getPtr(), name.getTerm()); + + BX_TRACE("name: %s (type %d, num %d)", un.name.c_str(), un.type, num); - un.name = uniformName; un.num = num; un.regIndex = 0; un.regCount = num; uniforms.push_back(un); } - parse = eol + 1; + parse = bx::strLTrimSpace(bx::strFindNl(bx::StringView(eol.getPtr(), parse.getTerm() ) ) ); } } } else { - const char* parse = bx::strFind(optimizedShader, "struct xlatMtlShaderUniform {"); - const char* end = parse; - if (NULL != parse) + const bx::StringView optShader(optimizedShader); + bx::StringView parse = bx::strFind(optimizedShader, "struct xlatMtlShaderUniform {"); + bx::StringView end = parse; + if (!parse.isEmpty() ) { - parse += bx::strLen("struct xlatMtlShaderUniform {"); - end = bx::strFind(parse, "};"); + parse.set(parse.getPtr() + bx::strLen("struct xlatMtlShaderUniform {"), optShader.getTerm() ); + end = bx::strFind(parse, "};"); } - while ( parse < end - && *parse != '\0') + while ( parse.getPtr() < end.getPtr() + && !parse.isEmpty() ) { - parse = bx::strws(parse); - const char* eol = bx::strFind(parse, ';'); - if (NULL != eol) + parse.set(bx::strLTrimSpace(parse).getPtr(), optShader.getTerm() ); + const bx::StringView eol = bx::strFind(parse, ';'); + if (!eol.isEmpty() ) { - const char* typen = parse; + const char* typen = parse.getPtr(); char uniformType[256]; - parse = bx::strword(parse); - bx::strCopy(uniformType, int32_t(parse-typen+1), typen); - const char* name = parse = bx::strws(parse); + parse = bx::strWord(parse).getPtr(); + bx::strCopy(uniformType, int32_t(parse.getPtr()-typen+1), typen); + const char* name = bx::strLTrimSpace(parse).getPtr(); + parse.set(name, optShader.getTerm() ); char uniformName[256]; uint8_t num = 1; - const char* array = bx::strFind(bx::StringView(name, int32_t(eol-parse) ), "["); - if (NULL != array) + bx::StringView array = bx::strFind(bx::StringView(name, int32_t(eol.getPtr()-parse.getPtr() ) ), "["); + if (!array.isEmpty() ) { - bx::strCopy(uniformName, int32_t(array-name+1), name); + bx::strCopy(uniformName, int32_t(array.getPtr()-name+1), name); char arraySize[32]; - const char* arrayEnd = bx::strFind(bx::StringView(array, int32_t(eol-array) ), "]"); - bx::strCopy(arraySize, int32_t(arrayEnd-array), array+1); - num = uint8_t(atoi(arraySize) ); + bx::StringView arrayEnd = bx::strFind(bx::StringView(array.getPtr(), int32_t(eol.getPtr()-array.getPtr() ) ), "]"); + bx::strCopy(arraySize, int32_t(arrayEnd.getPtr()-array.getPtr() ), array.getPtr()+1); + uint32_t tmp; + bx::fromString(&tmp, arraySize); + num = uint8_t(tmp); } else { - bx::strCopy(uniformName, int32_t(eol-name+1), name); + bx::strCopy(uniformName, int32_t(eol.getPtr()-name+1), name); } Uniform un; @@ -257,7 +254,7 @@ namespace bgfx { namespace glsl uniforms.push_back(un); } - parse = eol + 1; + parse = eol.getPtr() + 1; } } } @@ -298,6 +295,7 @@ namespace bgfx { namespace glsl writeFile(disasmfp.c_str(), optimizedShader, shaderSize); } + glslopt_shader_delete(shader); glslopt_cleanup(ctx); return true; diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp index f68c20c5984..82b7c1e2068 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_hlsl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -522,11 +522,11 @@ namespace bgfx { namespace hlsl , bindDesc.BindCount ); - const char * end = bx::strFind(bindDesc.Name, "Sampler"); - if (NULL != end) + bx::StringView end = bx::strFind(bindDesc.Name, "Sampler"); + if (!end.isEmpty() ) { Uniform un; - un.name.assign(bindDesc.Name, (end - bindDesc.Name) ); + un.name.assign(bindDesc.Name, (end.getPtr() - bindDesc.Name) ); un.type = UniformType::Enum(BGFX_UNIFORM_SAMPLERBIT | UniformType::Int1); un.num = 1; un.regIndex = uint16_t(bindDesc.BindPoint); @@ -624,8 +624,17 @@ namespace bgfx { namespace hlsl int32_t start = 0; int32_t end = INT32_MAX; + if (!hlslfp.empty()) + { + bx::StringView logfp = bx::strFind(log, hlslfp.c_str() ); + if (!logfp.isEmpty() ) + { + log = logfp.getPtr() + hlslfp.length(); + } + } + bool found = false - || 2 == sscanf(log, "(%u,%u):", &line, &column) + || 2 == sscanf(log, "(%u,%u", &line, &column) || 2 == sscanf(log, " :%u:%u: ", &line, &column) ; @@ -694,7 +703,7 @@ namespace bgfx { namespace hlsl // included in the uniform blob that the application must upload // we can't just remove them, because unused functions might still reference // them and cause a compile error when they're gone - if (!!bx::findIdentifierMatch(strLine.c_str(), it->c_str() ) ) + if (!bx::findIdentifierMatch(strLine.c_str(), it->c_str() ).isEmpty() ) { strLine = strLine.replace(index, strLength, "static"); unusedUniforms.erase(it); diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp index 87fe5584670..1b103624ae7 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_pssl.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -14,4 +14,9 @@ namespace bgfx return false; } + const char* getPsslPreamble() + { + return ""; + } + } // namespace bgfx diff --git a/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp b/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp index d25bfe5386e..1f2e165de0b 100644 --- a/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp +++ b/3rdparty/bgfx/tools/shaderc/shaderc_spirv.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -9,6 +9,7 @@ BX_PRAGMA_DIAGNOSTIC_PUSH() BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4100) // error C4100: 'inclusionDepth' : unreferenced formal parameter BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4265) // error C4265: 'spv::spirvbin_t': class has virtual functions, but destructor is not virtual BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wshadow") // warning: declaration of 'userData' shadows a member of 'glslang::TShader::Includer::IncludeResult' +#define ENABLE_OPT 1 #include #include #include @@ -136,16 +137,26 @@ namespace bgfx { namespace spirv 8, // MaxCullDistances 8, // MaxCombinedClipAndCullDistances 4, // MaxSamples - { // limits - 1, // nonInductiveForLoops - 1, // whileLoops - 1, // doWhileLoops - 1, // generalUniformIndexing - 1, // generalAttributeMatrixVectorIndexing - 1, // generalVaryingIndexing - 1, // generalSamplerIndexing - 1, // generalVariableIndexing - 1, // generalConstantMatrixVectorIndexing + 0, // maxMeshOutputVerticesNV; + 0, // maxMeshOutputPrimitivesNV; + 0, // maxMeshWorkGroupSizeX_NV; + 0, // maxMeshWorkGroupSizeY_NV; + 0, // maxMeshWorkGroupSizeZ_NV; + 0, // maxTaskWorkGroupSizeX_NV; + 0, // maxTaskWorkGroupSizeY_NV; + 0, // maxTaskWorkGroupSizeZ_NV; + 0, // maxMeshViewCountNV + + { // limits + true, // nonInductiveForLoops + true, // whileLoops + true, // doWhileLoops + true, // generalUniformIndexing + true, // generalAttributeMatrixVectorIndexing + true, // generalVaryingIndexing + true, // generalSamplerIndexing + true, // generalVariableIndexing + true, // generalConstantMatrixVectorIndexing }, }; @@ -468,7 +479,7 @@ namespace bgfx { namespace spirv return true; } -#define DBG(...) +#define DBG(...) // bx::debugPrintf(__VA_ARGS__) void disassemble(bx::WriterI* _writer, bx::ReaderSeekerI* _reader, bx::Error* _err) { @@ -517,18 +528,6 @@ namespace bgfx { namespace spirv } } - struct DebugOutputWriter : public bx::WriterI - { - virtual int32_t write(const void* _data, int32_t _size, bx::Error*) override - { - char* out = (char*)alloca(_size + 1); - bx::memCopy(out, _data, _size); - out[_size] = '\0'; - printf("%s", out); - return _size; - } - }; - static EShLanguage getLang(char _p) { switch (_p) @@ -545,7 +544,43 @@ namespace bgfx { namespace spirv // fprintf(stderr, "%s\n", _message); // } - static bool compile(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer) + static const char* s_attribName[] = + { + "a_position", + "a_normal", + "a_tangent", + "a_bitangent", + "a_color0", + "a_color1", + "a_color2", + "a_color3", + "a_indices", + "a_weight", + "a_texcoord0", + "a_texcoord1", + "a_texcoord2", + "a_texcoord3", + "a_texcoord4", + "a_texcoord5", + "a_texcoord6", + "a_texcoord7", + }; + BX_STATIC_ASSERT(bgfx::Attrib::Count == BX_COUNTOF(s_attribName) ); + + bgfx::Attrib::Enum toAttribEnum(const bx::StringView& _name) + { + for (uint8_t ii = 0; ii < Attrib::Count; ++ii) + { + if (0 == bx::strCmp(s_attribName[ii], _name) ) + { + return bgfx::Attrib::Enum(ii); + } + } + + return bgfx::Attrib::Count; + } + + static bool compile(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer, bool _firstPass) { BX_UNUSED(_version); @@ -582,7 +617,6 @@ namespace bgfx { namespace spirv ); bool linked = false; bool validated = true; - bool optimized = true; if (!compiled) { @@ -595,13 +629,13 @@ namespace bgfx { namespace spirv int32_t start = 0; int32_t end = INT32_MAX; - const char* err = bx::strFind(log, "ERROR:"); + bx::StringView err = bx::strFind(log, "ERROR:"); bool found = false; - if (NULL != err) + if (!err.isEmpty() ) { - found = 2 == sscanf(err, "ERROR: %u:%u: '", &source, &line); + found = 2 == sscanf(err.getPtr(), "ERROR: %u:%u: '", &source, &line); if (found) { ++line; @@ -637,7 +671,59 @@ namespace bgfx { namespace spirv } else { + uint16_t size = 0; + program->buildReflection(); + + if (_firstPass) + { + const size_t strLength = bx::strLen("uniform"); + + // first time through, we just find unused uniforms and get rid of them + std::string output; + bx::Error err; + LineReader reader(_code.c_str() ); + while (err.isOk() ) + { + char str[4096]; + int32_t len = bx::read(&reader, str, BX_COUNTOF(str), &err); + if (err.isOk() ) + { + std::string strLine(str, len); + + size_t index = strLine.find("uniform "); + if (index != std::string::npos) + { + bool found = false; + + for (int32_t ii = 0, num = program->getNumLiveUniformVariables(); ii < num; ++ii) + { + // matching lines like: uniform u_name; + // we want to replace "uniform" with "static" so that it's no longer + // included in the uniform blob that the application must upload + // we can't just remove them, because unused functions might still reference + // them and cause a compile error when they're gone + if (!bx::findIdentifierMatch(strLine.c_str(), program->getUniformName(ii) ).isEmpty() ) + { + found = true; + break; + } + } + + if (!found) + { + strLine = strLine.replace(index, strLength, "static"); + } + } + + output += strLine; + } + } + + // recompile with the unused uniforms converted to statics + return compile(_options, _version, output.c_str(), _writer, false); + } + { uint16_t count = (uint16_t)program->getNumLiveUniformVariables(); bx::write(_writer, count); @@ -647,6 +733,12 @@ namespace bgfx { namespace spirv { Uniform un; un.name = program->getUniformName(ii); + + un.num = uint8_t(program->getUniformArraySize(ii) ); + const uint32_t offset = program->getUniformBufferOffset(ii); + un.regIndex = uint16_t(offset); + un.regCount = un.num; + switch (program->getUniformType(ii)) { case 0x1404: // GL_INT: @@ -657,17 +749,18 @@ namespace bgfx { namespace spirv break; case 0x8B5B: // GL_FLOAT_MAT3: un.type = UniformType::Mat3; + un.regCount *= 3; break; case 0x8B5C: // GL_FLOAT_MAT4: un.type = UniformType::Mat4; + un.regCount *= 4; break; default: un.type = UniformType::End; break; } - un.num = uint8_t(program->getUniformArraySize(ii) ); - un.regIndex = 0; - un.regCount = un.num; + + size += un.regCount*16; uint8_t nameSize = (uint8_t)un.name.size(); bx::write(_writer, nameSize); @@ -695,58 +788,41 @@ namespace bgfx { namespace spirv glslang::TIntermediate* intermediate = program->getIntermediate(stage); std::vector spirv; - glslang::GlslangToSpv(*intermediate, spirv); - spv::spirvbin_t spvBin; - spvBin.remap( - spirv - , 0 - | spv::spirvbin_t::DCE_ALL - | spv::spirvbin_t::OPT_ALL - | spv::spirvbin_t::MAP_ALL -// | spv::spirvbin_t::STRIP - ); + + glslang::SpvOptions options; + options.disableOptimizer = false; + + glslang::GlslangToSpv(*intermediate, spirv, &options); bx::Error err; - DebugOutputWriter writer; + bx::WriterI* writer = bx::getDebugOut(); bx::MemoryReader reader(spirv.data(), uint32_t(spirv.size()*4) ); - disassemble(&writer, &reader, &err); + disassemble(writer, &reader, &err); -#if 0 - spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_0); - tools.SetMessageConsumer(printError); - validated = tools.Validate(spirv); + uint32_t shaderSize = (uint32_t)spirv.size()*sizeof(uint32_t); + bx::write(_writer, shaderSize); + bx::write(_writer, spirv.data(), shaderSize); + uint8_t nul = 0; + bx::write(_writer, nul); - if (!validated) + // + const uint8_t numAttr = (uint8_t)program->getNumLiveAttributes(); + bx::write(_writer, numAttr); + + for (uint8_t ii = 0; ii < numAttr; ++ii) { - std::string out; - tools.Disassemble(spirv, &out); - printf("%s\n", out.c_str()); + bgfx::Attrib::Enum attr = toAttribEnum(program->getAttributeName(ii) ); + if (bgfx::Attrib::Count != attr) + { + bx::write(_writer, bgfx::attribToId(attr) ); + } + else + { + bx::write(_writer, uint16_t(UINT16_MAX) ); + } } - if (validated) - { - spvtools::Optimizer optm(SPV_ENV_VULKAN_1_0); - optm.SetMessageConsumer(printError); - optm - .RegisterPass(spvtools::CreateStripDebugInfoPass() ) -// .RegisterPass(spvtools::CreateSetSpecConstantDefaultValuePass({ {1, "42" } }) ) - .RegisterPass(spvtools::CreateFreezeSpecConstantValuePass() ) - .RegisterPass(spvtools::CreateFoldSpecConstantOpAndCompositePass() ) - .RegisterPass(spvtools::CreateEliminateDeadConstantPass() ) - .RegisterPass(spvtools::CreateUnifyConstantPass() ) - ; - optimized = optm.Run(spirv.data(), spirv.size(), &spirv); - } -#endif // 0 - - if (optimized) - { - uint32_t shaderSize = (uint32_t)spirv.size()*sizeof(uint32_t); - bx::write(_writer, shaderSize); - bx::write(_writer, spirv.data(), shaderSize); - uint8_t nul = 0; - bx::write(_writer, nul); - } + bx::write(_writer, size); } } @@ -755,14 +831,14 @@ namespace bgfx { namespace spirv glslang::FinalizeProcess(); - return compiled && linked && validated && optimized; + return compiled && linked && validated; } } // namespace spirv bool compileSPIRVShader(const Options& _options, uint32_t _version, const std::string& _code, bx::WriterI* _writer) { - return spirv::compile(_options, _version, _code, _writer); + return spirv::compile(_options, _version, _code, _writer, true); } } // namespace bgfx diff --git a/3rdparty/bgfx/tools/texturev/common.sh b/3rdparty/bgfx/tools/texturev/common.sh index c91876813ca..8518cd143c2 100644 --- a/3rdparty/bgfx/tools/texturev/common.sh +++ b/3rdparty/bgfx/tools/texturev/common.sh @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -8,9 +8,21 @@ uniform vec4 u_params; #define u_textureLod u_params.x #define u_textureLayer u_params.y +#define u_inLinear u_params.z #define u_ev u_params.w +vec3 toLinear(vec3 _rgb) +{ + return pow(abs(_rgb), vec3_splat(2.2) ); +} + +vec3 toGamma(vec3 _rgb) +{ + return pow(abs(_rgb), vec3_splat(1.0/2.2) ); +} + vec4 toEv(vec4 _color) { - return vec4(_color.xyz * pow(2.0, u_ev), _color.w); + vec3 rgb = mix(toLinear(_color.xyz), _color.xyz, u_inLinear); + return vec4(toGamma(rgb * pow(2.0, u_ev) ), _color.w); } diff --git a/3rdparty/bgfx/tools/texturev/fs_texture.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture.bin.h index 35a97c15ad8..cd641968a53 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture.bin.h @@ -1,435 +1,320 @@ -static const uint8_t fs_texture_glsl[467] = +static const uint8_t fs_texture_glsl[522] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xa4, 0x01, 0x00, 0x00, 0x76, 0x61, // olor..........va - 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 - 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // v_color0;.varyi - 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, // ng highp vec3 v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // texcoord0;.unifo - 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, // rm highp vec4 u_ - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // params;.uniform - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // sampler2D s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, // olor;.void main - 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, // ().{. mediump v - 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // ec4 tmpvar_1;. - 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // lowp vec4 _color - 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // _2;. _color_2 = - 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, // (texture2DLod - 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, // (s_texColor, v - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x2c, 0x20, 0x75, // _texcoord0.xy, u - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, // _params.x) * v_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, // olor0);. lowp v - 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, // ec4 tmpvar_3;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, // tmpvar_3.xyz = ( - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, // _color_2.xyz * e - 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x29, // xp2(u_params.w)) - 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, // ;. tmpvar_3.w = - 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x74, // _color_2.w;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // mpvar_1 = tmpvar - 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // _3;. gl_FragCol - 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, // or = tmpvar_1;.} - 0x0a, 0x0a, 0x00, // ... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd7, 0x01, // texColor........ + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, // ..varying vec4 v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, // _color0;.varying + 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec3 v_texcoord + 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // 0;.uniform vec4 + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, // u_params;.unifor + 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, // m sampler2D s_te + 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, // xColor;.void mai + 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x63, // n ().{. vec4 _c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // olor_1;. _color + 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, // _1 = (texture2DL + 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, // od (s_texColor, + 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x2c, 0x20, // v_texcoord0.xy, + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, // u_params.x) * v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // color0);. vec4 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_2;. tmpv + 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, // ar_2.xyz = pow ( + 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, // abs((. mix (p + 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // ow (abs(_color_1 + 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, // .xyz), vec3(2.2, + 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, // 2.2, 2.2)), _co + 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, // lor_1.xyz, u_par + 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, // ams.z). * . + 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // exp2(u_params.w + 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x30, 0x2e, 0x34, // ). )), vec3(0.4 + 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, // 545454, 0.454545 + 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, // 4, 0.4545454));. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, // tmpvar_2.w = _ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, // color_1.w;. gl_ + 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // FragColor = tmpv + 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ar_2;.}... }; -static const uint8_t fs_texture_spv[4458] = +static const uint8_t fs_texture_spv[1957] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x4c, 0x11, 0x00, 0x00, 0x03, 0x02, 0x23, // ams......L.....# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0xfc, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........a..... - 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... - 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .w...t.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0xce, 0x14, 0x00, 0x00, 0x62, 0x67, 0x66, // n............bgf - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, // xTexture2DLod(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x66, // 2D-p1-t211;vf2;f - 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, // 1;.......~..._sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // mpler.m_sampler. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ........._sample - 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, // r.m_texture..... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, // ....._coord..... - 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x06, // ....._level..... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x74, 0x6f, 0x45, 0x76, 0x28, 0x76, 0x66, // .....e...toEv(vf - 0x34, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x5f, 0x63, 0x6f, // 4;..........._co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, // lor..........@ma - 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, // in(vf4;vf3;vf4;. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x62, 0x25, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....b%..v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x7a, 0x30, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0........z0..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x92, 0x55, 0x00, // excoord0......U. - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, // .....a...BgfxSam - 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, // pler2D.......a.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // .....m_sampler.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, // .....a.......m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, // exture.......... - 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, // .flattenTemp.... - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....s_texColorS - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, // ampler.......... - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, // .s_texColorTextu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, // re...........s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // exColor.m_sample - 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, // r........P...s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // exColor.m_textur - 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x24, 0x47, 0x6c, // e............$Gl - 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // obal............ - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewRect..... - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, // .........u_viewT - 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // exel............ - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xb2, 0x01, 0x00, // .u_view......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, // .....u_invView.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .............u_p - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, // roj............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_invProj...... - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .........u_viewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, // roj............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .u_invViewProj.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m - 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, // odel............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, // .u_modelView.... - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xb2, 0x01, 0x00, // ViewProj........ - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, // .....u_alphaRef4 - 0x00, 0x06, 0x00, 0x06, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .............u_p - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // arams........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // .............bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .jO..param...... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....color...... - 0x00, 0xa1, 0x48, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..H..param...... - 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..+..param...... - 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..+..param...... - 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..+..param...... - 0x00, 0x5e, 0x29, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // .^)..param...... - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..+..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....w...v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........<..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, // excoord0.....t.. - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // _0_.......U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am........8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, // FragData_0_..G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xe4, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .........@...H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, // .#... ...H...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .........#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, // .#.......H...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, // .#... ...H...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, // .........#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, // .#.......H...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, // .#.......H...... - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // .0...G.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...B..."...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...w.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...t.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. - 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, // .y.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x13, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, // .............!.. - 0x00, 0x53, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, // .S.......y...... - 0x00, 0x90, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0x1f, 0x01, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, // .........!...}.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, // .....a.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x09, 0x00, // . ...........a.. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...z.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...z.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, // . .............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, // .;.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...{.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, // .;...{.......... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, // . .............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, // .;.......P...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. - 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x04, // ............@... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0xe4, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // .....e...j...... - 0x00, 0xb2, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0xe4, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.......e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x2f, 0x04, 0x00, // ......... .../.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0xb2, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x2f, 0x04, 0x00, // .........;.../.. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ./.......+...... - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .........+...... - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // .........;...... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .w....... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .t....... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, // .Sa..;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, // .....;........8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, // .....=.......!C. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, // .....=........3. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, // .....P...a...^ . - 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, // .!C...3..>...... - 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, // .^ ..A...y....V. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, // ......V..>...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, // .....A........@. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, // .........=...... - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, // ......@..>...P.. - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .....=........+. - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, // .w...=........<. - 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .t...>....U...+. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....8...<..9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, // ......&.......U. - 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ..8......=...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, // .........>...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .........8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x0b, 0x00, // .............S.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...y...~...7.. - 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, // .........7...... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, // ......_..=...... - 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, // .!A..~...V...... - 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, // .`5......!A..=.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......"......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, // ......G......X.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, // .....(=..`5...". - 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, // ......G......(=. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..........5..=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....).......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......B......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....T-......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // .....g-......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xb4, 0x42, 0x00, // ......1..)....B. - 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xee, 0x31, 0x00, // .T-..g-.......1. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x0c, 0x00, // .8...6.......e.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .........7...... - 0x00, 0xa4, 0x11, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x58, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........X...=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x4f, 0x00, 0x08, // .....@R......O.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x16, 0x1c, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0x40, 0x52, 0x00, // .........@R..@R. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x6a, 0x55, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....jU..B.../.. - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // .....=........Q. - 0x00, 0x6a, 0x55, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x49, 0x00, // .jU..........TI. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // ..............Q. - 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x16, 0x1c, 0x00, // ................ - 0x00, 0x54, 0x49, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x45, 0x47, 0x00, // .TI..A.......EG. - 0x00, 0xa4, 0x11, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x45, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .?>..EG..Q...... - 0x00, 0x56, 0x44, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .VD..........Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, // .....OT......... - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x91, 0x1e, 0x00, // .Q........#..... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x54, 0x00, // .....P........T. - 0x00, 0x56, 0x44, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x3f, 0x3e, 0x00, // .VD..OT...#..?>. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0x1d, 0x54, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......T..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x62, 0x25, 0x00, 0x00, 0x37, 0x00, 0x03, // .7.......b%..7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x7a, 0x30, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .....z0..7...... - 0x00, 0x92, 0x55, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x5e, 0x00, 0x00, 0x3b, 0x00, 0x04, // ..U.......^..;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....jO......;.. - 0x00, 0x79, 0x04, 0x00, 0x00, 0xa1, 0x48, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y....H......;.. - 0x00, 0x13, 0x03, 0x00, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......+......;.. - 0x00, 0x90, 0x02, 0x00, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......+......;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......+......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5e, 0x29, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....^)......>.. - 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .jO......9...... - 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x6a, 0x4f, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....5...jO..=.. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x29, 0x4c, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....)L......>.. - 0x00, 0xa1, 0x48, 0x00, 0x00, 0x29, 0x4c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, // ..H..)L..=...... - 0x00, 0x50, 0x1e, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8b, 0x2b, 0x00, // .P...P...>....+. - 0x00, 0x50, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x65, 0x5d, 0x00, // .P...=.......e]. - 0x00, 0x7a, 0x30, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x3e, 0x43, 0x00, // .z0..O.......>C. - 0x00, 0x65, 0x5d, 0x00, 0x00, 0x65, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .e]..e]......... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0x3e, 0x43, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....+..>C..A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x4d, 0x3a, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....M:..B.../.. - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x22, 0x5c, 0x00, // .....=.......".. - 0x00, 0x4d, 0x3a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc4, 0x2b, 0x00, 0x00, 0x22, 0x5c, 0x00, // .M:..>....+..".. - 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0xce, 0x14, 0x00, // .9.............. - 0x00, 0xa1, 0x48, 0x00, 0x00, 0x8b, 0x2b, 0x00, 0x00, 0x8c, 0x2b, 0x00, 0x00, 0xc4, 0x2b, 0x00, // ..H...+...+...+. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x41, 0x1c, 0x00, 0x00, 0x62, 0x25, 0x00, // .=.......A...b%. - 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xfb, 0x61, 0x00, 0x00, 0x18, 0x0e, 0x00, // ..........a..... - 0x00, 0x41, 0x1c, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5e, 0x29, 0x00, 0x00, 0xfb, 0x61, 0x00, // .A...>...^)...a. - 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xdb, 0x49, 0x00, 0x00, 0x65, 0x0c, 0x00, // .9........I..e.. - 0x00, 0x5e, 0x29, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x92, 0x55, 0x00, 0x00, 0xdb, 0x49, 0x00, // .^)..>....U...I. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x80, 0x07, 0x00, // _params......... + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x31, 0x01, 0x00, // ...#.........1.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, // n............... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // .main........... + 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, // .BgfxSampler2D.. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, // .............m_s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // ampler.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // .....m_texture.. + 0x00, 0x05, 0x00, 0x05, 0x00, 0x38, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....8...s_texCo + 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // lor......:...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // exColorSampler.. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....=...s_texCo + 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // lorTexture...... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .x...$Global.... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // .x.......u_param + 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // s........z...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0xae, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .........v_color + 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xbd, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...=..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...=...!...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...x.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...x...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...z..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0xae, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x15, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x37, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .7...........;.. + 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .7...8....... .. + 0x00, 0x39, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .9...........;.. + 0x00, 0x39, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .9...:....... .. + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .<...........;.. + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .<...=.......... + 0x00, 0x40, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .@... .......+.. + 0x00, 0x40, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, // .@...E.......... + 0x00, 0x49, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .I.......+...... + 0x00, 0x65, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .e......@+...... + 0x00, 0x6d, 0x00, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x1e, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, // .m.../..>....x.. + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...y...... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, // .x...;...y...z.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........{... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, // .....+...{...|.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...}...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, // ....@+...{...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, // .....+...{...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xad, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xad, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x15, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00, 0x00, 0x2f, 0x01, 0x00, // .....,......./.. + 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, // .e...e...e...,.. + 0x00, 0x15, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, // .....0...m...m.. + 0x00, 0x6d, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .m...6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, // .=.......;...:.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .=.......>...=.. + 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, // .P.......?...;.. + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // .>...>...8...?.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, // .=.............. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x15, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xb2, 0x00, 0x00, // .=.............. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, // .=...........8.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x01, 0x00, 0x00, 0xd9, 0x00, 0x00, // .Q.......+...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, // .....Q.......,.. + 0x00, 0xd9, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, // .........O...... + 0x00, 0xdb, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, // .....A...}...... + 0x00, 0x7a, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .z...E.......=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, // .............V.. + 0x00, 0x49, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x2b, 0x01, 0x00, // .I.......,...+.. + 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, // .X.............. + 0x00, 0xdb, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, // ................ + 0x00, 0x4f, 0x00, 0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, // .O.............. + 0x00, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x06, 0x00, 0x15, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x15, 0x00, 0x00, // ................ + 0x00, 0x13, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, // ................ + 0x00, 0x2f, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, // ./...A...}...... + 0x00, 0x7a, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .z...E...|...=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, // .............P.. + 0x00, 0x15, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, // ................ + 0x00, 0xfd, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // .....O.......... + 0x00, 0xe1, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x15, 0x00, 0x00, 0x00, 0x1d, 0x01, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0xfe, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, // .....A...}...... + 0x00, 0x7a, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .z...E.......=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, // ................ + 0x00, 0x88, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x15, 0x00, 0x00, // ................ + 0x00, 0x06, 0x01, 0x00, 0x00, 0x1d, 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x06, // ................ + 0x00, 0x15, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....!.......... + 0x00, 0x06, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x15, 0x00, 0x00, 0x00, 0x23, 0x01, 0x00, // .............#.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x21, 0x01, 0x00, 0x00, 0x30, 0x01, 0x00, // .........!...0.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0xe1, 0x00, 0x00, // .Q.............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, // .....Q.......... + 0x00, 0x23, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .#.......Q...... + 0x00, 0x0b, 0x01, 0x00, 0x00, 0x23, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .....#.......Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x23, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // .........#...... + 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, // .P.............. + 0x00, 0x0b, 0x01, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, // .............>.. + 0x00, 0xbd, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .............8.. + 0x00, 0x00, 0x00, 0x10, 0x00, // ..... }; -static const uint8_t fs_texture_dx9[395] = +static const uint8_t fs_texture_dx9[615] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color0......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x5c, 0x01, 0x00, 0x00, 0x00, 0x03, // rams............ - 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x83, 0x00, // ....,.CTAB...... - 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ..|...D......... - 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..P.......`..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ......l.......s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ..........u_para - 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, // ms.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......ps_3_0.Mic - 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, // 10.1..Q......... - 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, // .?.............. - 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, // ................ - 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x01, 0x00, // ................ - 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, // .............._. - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x0e, 0x00, // ................ - 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, // ................ - 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, // ................ - 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, // _texColor0...... + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x34, 0x02, // u_params......4. + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........,.CTAB.. + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, // ......|...D..... + 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, // ......P.......`. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........l..... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // params.......... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, // ..........ps_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, // ler 10.1..Q..... + 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2f, 0xba, // .....?.......@/. + 0xe8, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, // .>.............. + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, // ................ + 0xd0, 0xa0, 0x01, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ + 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, // .._............. + 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x8b, 0x0f, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, // ........U....... + 0x04, 0x80, 0x01, 0x00, 0xaa, 0x8b, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x01, 0x00, // ................ + 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, // ................ + 0xaa, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, // ........U....... + 0x04, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x02, 0x00, 0xe4, 0x81, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x07, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x07, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x01, 0x80, 0x00, 0x00, 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, // ................ + 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x05, 0x00, // U............... + 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xff, 0xa0, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x00, 0x08, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, // ................ + 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, // ....U........... + 0xaa, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... }; -static const uint8_t fs_texture_dx11[518] = +static const uint8_t fs_texture_dx11[770] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x44, 0x58, // olor0.........DX - 0x42, 0x43, 0xbb, 0xf8, 0x2e, 0xf1, 0x8c, 0xe2, 0x59, 0x67, 0xdb, 0xb3, 0x5d, 0x86, 0xc8, 0x7f, // BC......Yg..]... - 0x7a, 0x5d, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // z]............,. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO - 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xf8, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..SHDR....@...>. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, // ..Z....`......X. - 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. - 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, // ..........b...2. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......e.... .... - 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x12, 0x00, // ..h............. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......:. ....... - 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x10, // ..H...........F. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......` - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... - 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..8...........F. - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, // ......F.......8. - 0x00, 0x07, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, // ..r ............ - 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, // ..F.......6.... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......:.......>. - 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ...... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xcc, 0x02, // texColor0....... + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xab, 0xa0, 0x24, 0x5b, 0x96, 0x54, 0x64, 0xb7, 0x42, 0xe5, // ..DXBC..$[.Td.B. + 0xe8, 0xdd, 0xe9, 0x4c, 0x84, 0x1c, 0x01, 0x00, 0x00, 0x00, 0xcc, 0x02, 0x00, 0x00, 0x03, 0x00, // ...L............ + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, // ..........SV_TAR + 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xf0, 0x01, 0x00, 0x00, 0x40, 0x00, // GET...SHDR....@. + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..|...Y...F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ......Z....`.... + 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X....p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, // ..b...........b. + 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..2.......e.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, // ......h.......H. + 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, // ..........F..... + 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..F~.......`.... + 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // .... .........8. + 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, // ..F......./...r. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x01, 0x00, // ......F......... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, // ..6.... ......:. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, // ......8...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xcd, 0xcc, // ..F........@.... + 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, // .@...@...@...... + 0x00, 0x05, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..r.......F..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..2...r.......F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, // ......F.......F. + 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, // ..A.......2...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..F.......F..... + 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, // ..............:. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, // .........8...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ....../...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // ..F...........8. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..r.......F..... + 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, // ...@../..>/..>/. + 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, // .>........r .... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, // ..F.......>..... + 0x10, 0x00, // .. }; -static const uint8_t fs_texture_mtl[808] = +static const uint8_t fs_texture_mtl[938] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, // ams..........usi - 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met - 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // float4 v_color - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, // 0;. float3 v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // xcoord0;.};.stru - 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // Output {. float - 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // 4 gl_FragColor;. - 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt - 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // . float4 u_para - 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // ms;.};.fragment - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain - 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta - 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [ - 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. , - 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, 0x6f, // texture2d s_texColor [ - 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, // [texture(0)]], s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, // ampler _mtlsmp_s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, // _texColor [[samp - 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // ler(0)]]).{. xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu - 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // t _mtl_o;. floa - 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t4 _color_1 = 0; - 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x73, // . _color_1 = (s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // _texColor.sample - 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // (_mtlsmp_s_texCo - 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, // lor, (float2)(_m - 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // tl_i.v_texcoord0 - 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // .xy), level(_mtl - 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x20, // _u.u_params.x)) - 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // * _mtl_i.v_color - 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, // 0);. float4 tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // var_2 = 0;. tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x63, 0x6f, // var_2.xyz = (_co - 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, 0x78, 0x70, 0x32, // lor_1.xyz * exp2 + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x03, // FSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, // ut {. float4 v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // color0;. float3 + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, // v_texcoord0;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, // haderOutput {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // float4 gl_FragCo + 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // lor;.};.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // orm {. float4 u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, // _params;.};.frag + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ment xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // erOutput xlatMtl + 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // Main (xlatMtlSha + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, // derInput _mtl_i + 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // nstant xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, // aderUniform& _mt + 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // l_u [[buffer(0)] + 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // ]. , texture2 + 0x64, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // d s_texCo + 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, // lor [[texture(0) + 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ]], sampler _mtl + 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, // smp_s_texColor [ + 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, // [sampler(0)]]).{ + 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // . xlatMtlShader + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, // Output _mtl_o;. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // float4 _color_1 + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, // = 0;. _color_1 + 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // = (s_texColor.s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float + 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // 2)(_mtl_i.v_texc + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, // oord0.xy), level 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // (_mtl_u.u_params - 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // .w));. tmpvar_2 - 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x3b, // .w = _color_1.w; - 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // . _mtl_o.gl_Fra - 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // gColor = tmpvar_ - 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // 2;. return _mtl - 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _o;.}... + 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // .x)) * _mtl_i.v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // color0);. float + 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_2 = 0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_2.xyz = + 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, // pow (abs((. + 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, // mix (pow (abs(_c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, // olor_1.xyz), flo + 0x61, 0x74, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, // at3(2.2, 2.2, 2. + 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, // 2)), _color_1.xy + 0x7a, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // z, _mtl_u.u_para + 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // ms.z). * . + 0x65, 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, // exp2(_mtl_u.u_pa + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x66, 0x6c, // rams.w). )), fl + 0x6f, 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, // oat3(0.4545454, + 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, // 0.4545454, 0.454 + 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // 5454));. tmpvar + 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, // _2.w = _color_1. + 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, // w;. _mtl_o.gl_F + 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva + 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // r_2;. return _m + 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... }; extern const uint8_t* fs_texture_pssl; extern const uint32_t fs_texture_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture.sc b/3rdparty/bgfx/tools/texturev/fs_texture.sc index d25cc94272f..07994ca9f6c 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_3d.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_3d.bin.h index bdc9822e8df..4c5339dc3b1 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_3d.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture_3d.bin.h @@ -1,453 +1,336 @@ -static const uint8_t fs_texture_3d_glsl[548] = +static const uint8_t fs_texture_3d_glsl[592] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xf5, 0x01, 0x00, 0x00, 0x76, 0x61, // olor..........va - 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 - 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // v_color0;.varyi - 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, // ng highp vec3 v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // texcoord0;.unifo - 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, // rm highp vec4 u_ - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // params;.uniform - 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x33, 0x44, 0x20, 0x73, // lowp sampler3D s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // _texColor;.void - 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, // main ().{. high - 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // p vec3 tmpvar_1; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, // . tmpvar_1.xy = - 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, // v_texcoord0.xy; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, // . tmpvar_1.z = - 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x6d, 0x65, // u_params.y;. me - 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // diump vec4 tmpva - 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // r_2;. lowp vec4 - 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, // _color_3;. _co - 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // lor_3 = (texture - 0x33, 0x44, 0x4c, 0x6f, 0x64, 0x45, 0x58, 0x54, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // 3DLodEXT (s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, // olor, tmpvar_1, - 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, // u_params.x) * v_ - 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, // color0);. lowp - 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, // vec4 tmpvar_4;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_4.xyz = - 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, // (_color_3.xyz * - 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, // exp2(u_params.w) - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, // );. tmpvar_4.w - 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, // = _color_3.w;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // tmpvar_2 = tmpva - 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // r_4;. gl_FragCo - 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, // lor = tmpvar_2;. - 0x7d, 0x0a, 0x0a, 0x00, // }... -}; -static const uint8_t fs_texture_3d_spv[4562] = -{ - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb4, 0x11, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // .........Ta..... - 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... - 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .w...t.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0x53, 0x16, 0x00, 0x00, 0x62, 0x67, 0x66, // n........S...bgf - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x33, 0x44, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, // xTexture3DLod(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x33, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x33, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x66, // 3D-p1-t311;vf3;f - 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, // 1;.......~..._sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // mpler.m_sampler. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ........._sample - 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, // r.m_texture..... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, // ....._coord..... - 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x06, // ....._level..... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x74, 0x6f, 0x45, 0x76, 0x28, 0x76, 0x66, // .....e...toEv(vf - 0x34, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x5f, 0x63, 0x6f, // 4;..........._co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, // lor..........@ma - 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, // in(vf4;vf3;vf4;. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ......>..v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........8..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x02, 0x44, 0x00, // excoord0......D. - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x06, 0x00, 0x64, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, // .....d...BgfxSam - 0x70, 0x6c, 0x65, 0x72, 0x33, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x09, 0x00, // pler3D.......d.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // .....m_sampler.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x64, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, // .....d.......m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, // exture.......... - 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, // .flattenTemp.... - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....s_texColorS - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, // ampler.......... - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, // .s_texColorTextu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, // re...........s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // exColor.m_sample - 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, // r........P...s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // exColor.m_textur - 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, // e........1...$Gl - 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // obal.....1...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewRect..... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, // .1.......u_viewT - 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // exel.....1...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // .u_view......1.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, // .....u_invView.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .....1.......u_p - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // roj......1...... - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_invProj...... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .1.......u_viewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // roj......1...... - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .u_invViewProj.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .....1.......u_m - 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // odel.....1...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, // .u_modelView.... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .1.......u_model - 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // ViewProj.....1.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, // .....u_alphaRef4 - 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .....1.......u_p - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // arams........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // .............bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x13, 0x57, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..W..param...... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....color...... - 0x00, 0x4a, 0x50, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .JP..param...... - 0x00, 0x34, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .43..param...... - 0x00, 0x35, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .53..param...... - 0x00, 0x6d, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .m3..param...... - 0x00, 0x07, 0x31, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // ..1..param...... - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..+..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....w...v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........<..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, // excoord0.....t.. - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // _0_.......U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am........8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, // FragData_0_..G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0x2a, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .*.......@...H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .1.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#... ...H...1.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .1.......#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, // .1.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#... ...H...1.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, // .1.......#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, // .1.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, // .1.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // .0...G...1...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...B..."...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...w.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...t.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. - 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, // .y.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x97, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x14, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, // .............!.. - 0x00, 0x70, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x14, 0x03, 0x00, // .p.......y...... - 0x00, 0x95, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0x1f, 0x01, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, // .........!...}.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x1e, 0x00, 0x04, 0x00, 0x64, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x97, 0x00, 0x00, // .....d.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x09, 0x00, // . ...........d.. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...z.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...z.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, // . .............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, // .;.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...{.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, // .;...{.......... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x97, 0x00, 0x00, // . .............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, // .;.......P...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. - 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x97, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x04, // ............@... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // .*...e...j...... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .1...........e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...*...e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xae, 0x08, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xae, 0x08, 0x00, // .....1...;...... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ./.......+...... - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .........+...... - 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .........+...... - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // .........;...... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .w....... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .t....... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, // .Sa..;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, // .....;........8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, // .....=.......!C. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, // .....=........3. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x64, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, // .....P...d...^ . - 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, // .!C...3..>...... - 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, // .^ ..A...y....V. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, // ......V..>...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x14, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, // .....A........@. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, // .........=...... - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, // ......@..>...P.. - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .....=........+. - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, // .w...=........<. - 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .t...>....U...+. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....8...<..9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, // ......&.......U. - 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ..8......=...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, // .........>...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .........8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x53, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0b, 0x00, // .....S.......p.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...y...~...7.. - 0x00, 0x14, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, // .........7...... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x97, 0x00, 0x00, // ......_..=...... - 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, // .!A..~...V...... - 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, // .`5......!A..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......"......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, // ......G......X.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, // .....(=..`5...". - 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, // ......G......(=. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..........5..=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....).......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......B......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....T-......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // .....g-......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xb4, 0x42, 0x00, // ......1..)....B. - 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xee, 0x31, 0x00, // .T-..g-.......1. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x0c, 0x00, // .8...6.......e.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .........7...... - 0x00, 0xa4, 0x11, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x58, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........X...=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x4f, 0x00, 0x08, // .....@R......O.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x16, 0x1c, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0x40, 0x52, 0x00, // .........@R..@R. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x6a, 0x55, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....jU..B.../.. - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // .....=........Q. - 0x00, 0x6a, 0x55, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x49, 0x00, // .jU..........TI. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // ..............Q. - 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x16, 0x1c, 0x00, // ................ - 0x00, 0x54, 0x49, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x45, 0x47, 0x00, // .TI..A.......EG. - 0x00, 0xa4, 0x11, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x45, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .?>..EG..Q...... - 0x00, 0x56, 0x44, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .VD..........Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, // .....OT......... - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x91, 0x1e, 0x00, // .Q........#..... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x54, 0x00, // .....P........T. - 0x00, 0x56, 0x44, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x3f, 0x3e, 0x00, // .VD..OT...#..?>. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0x1d, 0x54, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......T..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........>..7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......8..7...... - 0x00, 0x02, 0x44, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf0, 0x1b, 0x00, 0x00, 0x3b, 0x00, 0x04, // ..D..........;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......W......;.. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y...JP......;.. - 0x00, 0x14, 0x03, 0x00, 0x00, 0x34, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....43......;.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x35, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....53......;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....m3......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......1......>.. - 0x00, 0x13, 0x57, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..W......9...... - 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....5....W..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0xa1, 0x48, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x4f, 0x00, 0x07, // ......H...8..O.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0x70, 0x45, 0x00, 0x00, 0xa1, 0x48, 0x00, 0x00, 0xa1, 0x48, 0x00, // .....pE...H...H. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, // .........A...... - 0x00, 0xad, 0x5c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0d, 0x0a, 0x00, // .....B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf6, 0x1d, 0x00, 0x00, 0xad, 0x5c, 0x00, // .=.............. - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x81, 0x46, 0x00, 0x00, 0x70, 0x45, 0x00, // .Q........F..pE. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd1, 0x55, 0x00, // .....Q........U. - 0x00, 0x70, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, // .pE......P...... - 0x00, 0xcd, 0x44, 0x00, 0x00, 0x81, 0x46, 0x00, 0x00, 0xd1, 0x55, 0x00, 0x00, 0xf6, 0x1d, 0x00, // ..D...F...U..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x51, 0x00, 0x00, 0x14, 0x11, 0x00, // .=.......!Q..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x21, 0x51, 0x00, 0x00, 0x3d, 0x00, 0x04, // .>...JP..!Q..=.. - 0x00, 0x97, 0x00, 0x00, 0x00, 0x0c, 0x26, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......&..P...>.. - 0x00, 0x34, 0x33, 0x00, 0x00, 0x0c, 0x26, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x33, 0x00, // .43...&..>...53. - 0x00, 0xcd, 0x44, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x3d, 0x32, 0x00, // ..D..A.......=2. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0x3d, 0x32, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....L...=2..>.. - 0x00, 0x6d, 0x33, 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, // .m3..L...9...... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0x53, 0x16, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x34, 0x33, 0x00, // .....S...JP..43. - 0x00, 0x35, 0x33, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // .53..m3..=...... - 0x00, 0xea, 0x23, 0x00, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..#...>......... - 0x00, 0x25, 0x1f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0xea, 0x23, 0x00, 0x00, 0x3e, 0x00, 0x03, // .%........#..>.. - 0x00, 0x07, 0x31, 0x00, 0x00, 0x25, 0x1f, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..1..%...9...... - 0x00, 0x84, 0x51, 0x00, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..Q..e....1..>.. - 0x00, 0x02, 0x44, 0x00, 0x00, 0x84, 0x51, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ..D...Q......8.. - 0x00, 0x00, // .. -}; -static const uint8_t fs_texture_3d_dx9[367] = -{ - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color0......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x03, // rams......@..... - 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x83, 0x00, // ....,.CTAB...... - 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ..|...D......... - 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..P.......`..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ......l.......s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0d, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ..........u_para - 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, // ms.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......ps_3_0.Mic - 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // 10.1............ - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x08, 0x0f, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x03, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, // ................ - 0x14, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, // .._............. - 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, // ................ - 0xe4, 0x90, 0x0e, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ - 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... -}; -static const uint8_t fs_texture_3d_dx11[562] = -{ - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x44, 0x58, // olor0.........DX - 0x42, 0x43, 0x94, 0xc2, 0x00, 0x72, 0x53, 0x84, 0x86, 0xd2, 0xd0, 0xc1, 0x19, 0xc6, 0x64, 0xb3, // BC...rS.......d. - 0x01, 0x36, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // .6............,. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO - 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x24, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x49, 0x00, // ..SHDR$...@...I. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x28, // ..Z....`......X( - 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. - 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, // ..........b...2. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......e.... .... - 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x00, // ..h.......6...2. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, // ......F.......6. - 0x00, 0x06, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, // ..B......... ... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......H......... - 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..F.......F~.... - 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, // ...`........ ... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8......... - 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, // ..F.......F..... - 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3a, 0x80, // ..............:. - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x20, // .........8...r - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // ......F......... - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, // ......6.... .... - 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, // ..:.......>..... - 0x10, 0x00, // .. -}; -static const uint8_t fs_texture_3d_mtl[891] = -{ - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x5d, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, // ams......]...usi - 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met - 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // float4 v_color - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, // 0;. float3 v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // xcoord0;.};.stru - 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // Output {. float - 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // 4 gl_FragColor;. - 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt - 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // . float4 u_para - 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // ms;.};.fragment - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain - 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta - 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [ - 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. , - 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x33, 0x64, 0x3c, 0x66, 0x6c, 0x6f, // texture3d s_texColor [ - 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, // [texture(0)]], s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, // ampler _mtlsmp_s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, // _texColor [[samp - 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // ler(0)]]).{. xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu - 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // t _mtl_o;. floa - 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t3 tmpvar_1 = 0; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, // . tmpvar_1.xy = - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // _mtl_i.v_texcoo + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1d, 0x02, // texColor........ + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, // ..varying vec4 v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, // _color0;.varying + 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec3 v_texcoord + 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // 0;.uniform vec4 + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, // u_params;.unifor + 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x33, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, // m sampler3D s_te + 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, // xColor;.void mai + 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, // n ().{. vec3 tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_1;. tmpvar + 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // _1.xy = v_texcoo 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // rd0.xy;. tmpvar - 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // _1.z = _mtl_u.u_ - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // params.y;. floa - 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t4 _color_2 = 0; - 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x73, // . _color_2 = (s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // _texColor.sample - 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // (_mtlsmp_s_texCo - 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x74, 0x6d, // lor, (float3)(tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, // pvar_1), level(_ - 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, // mtl_u.u_params.x - 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, // )) * _mtl_i.v_co - 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // lor0);. float4 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_3 = 0;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, // tmpvar_3.xyz = ( - 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, // _color_2.xyz * e - 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, // xp2(_mtl_u.u_par - 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ams.w));. tmpva - 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // r_3.w = _color_2 - 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, // .w;. _mtl_o.gl_ - 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // FragColor = tmpv - 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, // ar_3;. return _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // mtl_o;.}... + 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _1.z = u_params. + 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // y;. vec4 _color + 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, // _2;. _color_2 = + 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x33, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x28, // (texture3DLod ( + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, // s_texColor, tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, // ar_1, u_params.x + 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, // ) * v_color0);. + 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, // vec4 tmpvar_3;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, // tmpvar_3.xyz = + 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, // pow (abs((. + 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, // mix (pow (abs(_c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, // olor_2.xyz), vec + 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, // 3(2.2, 2.2, 2.2) + 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x2c, // ), _color_2.xyz, + 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, // u_params.z). + 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, // * . exp2(u_pa + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x76, 0x65, // rams.w). )), ve + 0x63, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, // c3(0.4545454, 0. + 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, // 4545454, 0.45454 + 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, // 54));. tmpvar_3 + 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x3b, // .w = _color_2.w; + 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // . gl_FragColor + 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // = tmpvar_3;.}... +}; +static const uint8_t fs_texture_3d_spv[2033] = +{ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xcc, 0x07, 0x00, // _params......... + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x3b, 0x01, 0x00, // ...#.........;.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, // n............... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // .main........... + 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x33, 0x44, 0x00, 0x00, // .BgfxSampler3D.. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, // .............m_s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // ampler.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // .....m_texture.. + 0x00, 0x05, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....6...s_texCo + 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x38, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // lor......8...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // exColorSampler.. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....;...s_texCo + 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // lorTexture...... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .v...$Global.... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // .v.......u_param + 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // s........x...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .........v_color + 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xc2, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;...!...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...v.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...v...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...x..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .5...........;.. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .5...6....... .. + 0x00, 0x37, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .7...........;.. + 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .7...8....... .. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .:...........;.. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .:...;.......... + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .>... .......+.. + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, // .>...C.......... + 0x00, 0x47, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .G.......+...... + 0x00, 0x63, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .c......@+...... + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x1e, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, // .k.../..>....v.. + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...w...... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // .v...;...w...x.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........y... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, // .....+...y...z.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...{...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, // ....@+...y...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, // .....+...y...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, // .....+...y...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb2, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb6, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xc1, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x39, 0x01, 0x00, // .....,.......9.. + 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, // .c...c...c...,.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, // .....:...k...k.. + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .k...6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, // .=.......9...8.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, // .=.......<...;.. + 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, // .P.......=...9.. + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .<...>...6...=.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, // .=.............. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, // .=.............. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // .A...{.......x.. + 0x00, 0x43, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .C.......=...... + 0x00, 0xe1, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .........Q...... + 0x00, 0xe2, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, // .P.............. + 0x00, 0xe3, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, // .........=...... + 0x00, 0xe5, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....6...Q...... + 0x00, 0x35, 0x01, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .5...........Q.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....6.......... + 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // .A...{.......x.. + 0x00, 0x43, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .C.......=...... + 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x47, 0x00, 0x00, // .........V...G.. + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0x35, 0x01, 0x00, 0x00, 0x58, 0x00, 0x07, // .....6...5...X.. + 0x00, 0x0e, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x00, // ................ + 0x00, 0xeb, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, // .............O.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x04, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1d, 0x01, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x39, 0x01, 0x00, // .............9.. + 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x78, 0x00, 0x00, // .A...{.......x.. + 0x00, 0x43, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .C...z...=...... + 0x00, 0x07, 0x01, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, // .........P...... + 0x00, 0x08, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, // ................ + 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, // .O.............. + 0x00, 0xeb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // .........'...... + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x1d, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, // ................ + 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x78, 0x00, 0x00, // .A...{.......x.. + 0x00, 0x43, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .C.......=...... + 0x00, 0x0e, 0x01, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, // ................ + 0x00, 0x0e, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, // ................ + 0x00, 0x27, 0x01, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, // .'.............. + 0x00, 0x2b, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, // .+.............. + 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // .........-...... + 0x00, 0x1a, 0x00, 0x00, 0x00, 0x2b, 0x01, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, // .....+...:...Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x2d, 0x01, 0x00, // .Q...........-.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x15, 0x01, 0x00, // .....Q.......... + 0x00, 0x2d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .-.......Q...... + 0x00, 0x16, 0x01, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, // .....-.......P.. + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x15, 0x01, 0x00, // ................ + 0x00, 0x16, 0x01, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc2, 0x00, 0x00, // .........>...... + 0x00, 0x17, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, // .........8...... + 0x00, // . +}; +static const uint8_t fs_texture_3d_dx9[611] = +{ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, // _texColor0...... + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x30, 0x02, // u_params......0. + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........,.CTAB.. + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, // ......|...D..... + 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, // ......P.......`. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........l..... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0d, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // params.......... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, // ..........ps_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, // ler 10.1..Q..... + 0x0f, 0xa0, 0xcd, 0xcc, 0x0c, 0x40, 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....@/..>...... + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0xa0, 0x00, 0x08, 0x0f, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0x80, 0x01, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x14, 0xa0, 0x5f, 0x00, // .............._. + 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, // ................ + 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x0f, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, // ................ + 0x02, 0x80, 0x01, 0x00, 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, // ....U........... + 0xaa, 0x8b, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x05, 0x00, // ................ + 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, // ................ + 0x02, 0x80, 0x01, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, // ....U........... + 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x02, 0x00, 0xe4, 0x81, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ................ + 0xaa, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ................ + 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, // ................ + 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x8b, 0x0f, 0x00, // ............U... + 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x55, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, // ........U....... + 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, 0x00, 0x00, // ................ + 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0xff, 0xff, // U............... + 0x00, 0x00, 0x00, // ... +}; +static const uint8_t fs_texture_3d_dx11[814] = +{ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xf8, 0x02, // texColor0....... + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x86, 0x82, 0x66, 0xf4, 0x03, 0xd8, 0x4a, 0x8f, 0x13, 0x90, // ..DXBC..f...J... + 0xfc, 0x02, 0x5a, 0xc4, 0x38, 0x2a, 0x01, 0x00, 0x00, 0x00, 0xf8, 0x02, 0x00, 0x00, 0x03, 0x00, // ..Z.8*.......... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, // ..........SV_TAR + 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x1c, 0x02, 0x00, 0x00, 0x40, 0x00, // GET...SHDR....@. + 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ......Y...F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ......Z....`.... + 0x00, 0x00, 0x58, 0x28, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X(...p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, // ..b...........b. + 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..2.......e.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, // ......h.......6. + 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, // ..2.......F..... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, // ..6...B......... + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, // .........H..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, // ......F.......F~ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, // .......`........ + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, // .........8..... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, // ......F.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, // ....../...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ..F...........6. + 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, // ... ......:..... + 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, // ..8...r.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0xcd, 0xcc, // .......@.....@.. + 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x00, // .@...@........r. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..r.......F..... + 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x41, 0x00, // ..F.......F...A. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2...r..... + 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // .... .........F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, // ......F......... + 0x00, 0x06, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, // ..........:. ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8...r..... + 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ../...r.......F. + 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, // ..........8...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ + 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, // ../..>/..>/..>.. + 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ......r ......F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ......>....... +}; +static const uint8_t fs_texture_3d_mtl[1021] = +{ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0x03, // FSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, // ut {. float4 v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // color0;. float3 + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, // v_texcoord0;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, // haderOutput {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // float4 gl_FragCo + 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // lor;.};.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // orm {. float4 u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, // _params;.};.frag + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ment xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // erOutput xlatMtl + 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // Main (xlatMtlSha + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, // derInput _mtl_i + 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // nstant xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, // aderUniform& _mt + 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // l_u [[buffer(0)] + 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x33, // ]. , texture3 + 0x64, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // d s_texCo + 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, // lor [[texture(0) + 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // ]], sampler _mtl + 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, // smp_s_texColor [ + 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, // [sampler(0)]]).{ + 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // . xlatMtlShader + 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, // Output _mtl_o;. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // float3 tmpvar_1 + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // = 0;. tmpvar_1 + 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, // .xy = _mtl_i.v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x74, // excoord0.xy;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // mpvar_1.z = _mtl + 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, // _u.u_params.y;. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // float4 _color_2 + 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // = 0;. _color_2 + 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, // = (s_texColor.s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, // ample(_mtlsmp_s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, // texColor, (float + 0x33, 0x29, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2c, 0x20, 0x6c, 0x65, // 3)(tmpvar_1), le + 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, // vel(_mtl_u.u_par + 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // ams.x)) * _mtl_i + 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // .v_color0);. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, // oat4 tmpvar_3 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, // 0;. tmpvar_3.xy + 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, // z = pow (abs((. + 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, // mix (pow (abs + 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, // (_color_2.xyz), + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, // float3(2.2, 2.2, + 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // 2.2)), _color_2 + 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // .xyz, _mtl_u.u_p + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, // arams.z). * . + 0x20, 0x20, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // exp2(_mtl_u.u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, // _params.w). )), + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, // float3(0.454545 + 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, // 4, 0.4545454, 0. + 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 4545454));. tmp + 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // var_3.w = _color + 0x5f, 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // _2.w;. _mtl_o.g + 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, // l_FragColor = tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, // pvar_3;. return + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... }; extern const uint8_t* fs_texture_3d_pssl; extern const uint32_t fs_texture_3d_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_3d.sc b/3rdparty/bgfx/tools/texturev/fs_texture_3d.sc index a26526073de..230eaa3a5d2 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_3d.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture_3d.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h index 50dfbbd9f78..2e0c2352c10 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture_array.bin.h @@ -1,458 +1,339 @@ -static const uint8_t fs_texture_array_glsl[553] = +static const uint8_t fs_texture_array_glsl[602] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xfa, 0x01, 0x00, 0x00, 0x76, 0x61, // olor..........va - 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 - 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // v_color0;.varyi - 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, // ng highp vec3 v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // texcoord0;.unifo - 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, // rm highp vec4 u_ - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // params;.uniform - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, 0x79, 0x20, 0x73, // sampler2DArray s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, // _texColor;.void - 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, // main ().{. high - 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // p vec3 tmpvar_1; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, // . tmpvar_1.xy = - 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, // v_texcoord0.xy; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, // . tmpvar_1.z = - 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x6d, 0x65, // u_params.y;. me - 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // diump vec4 tmpva - 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // r_2;. lowp vec4 - 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, // _color_3;. _co - 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // lor_3 = (texture - 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, 0x79, 0x4c, 0x6f, 0x64, 0x45, 0x58, 0x54, 0x20, 0x28, 0x73, // 2DArrayLodEXT (s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // _texColor, tmpva - 0x72, 0x5f, 0x31, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, // r_1, u_params.x) - 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, // * v_color0);. - 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // lowp vec4 tmpvar - 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, // _4;. tmpvar_4.x - 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x78, // yz = (_color_3.x - 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // yz * exp2(u_para - 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ms.w));. tmpvar - 0x5f, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, // _4.w = _color_3. - 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, // w;. tmpvar_2 = - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // tmpvar_4;. gl_F - 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva - 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_2;.}... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x27, 0x02, // texColor......'. + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, // ..varying vec4 v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, // _color0;.varying + 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec3 v_texcoord + 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // 0;.uniform vec4 + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, // u_params;.unifor + 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, 0x79, // m sampler2DArray + 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // s_texColor;.voi + 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, // d main ().{. ve + 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c3 tmpvar_1;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x74, // mpvar_1.xy = v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x74, // excoord0.xy;. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x75, 0x5f, 0x70, 0x61, // mpvar_1.z = u_pa + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, // rams.y;. vec4 _ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // color_2;. _colo + 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, // r_2 = (texture2D + 0x41, 0x72, 0x72, 0x61, 0x79, 0x4c, 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ArrayLod (s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2c, 0x20, // olor, tmpvar_1, + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, // u_params.x) * v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // color0);. vec4 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_3;. tmpv + 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, // ar_3.xyz = pow ( + 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, // abs((. mix (p + 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, // ow (abs(_color_2 + 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, // .xyz), vec3(2.2, + 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, // 2.2, 2.2)), _co + 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, // lor_2.xyz, u_par + 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, // ams.z). * . + 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // exp2(u_params.w + 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x30, 0x2e, 0x34, // ). )), vec3(0.4 + 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, // 545454, 0.454545 + 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, // 4, 0.4545454));. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, // tmpvar_3.w = _ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, // color_2.w;. gl_ + 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // FragColor = tmpv + 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ar_3;.}... }; -static const uint8_t fs_texture_array_spv[4578] = +static const uint8_t fs_texture_array_spv[2037] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xc4, 0x11, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // .........Ta..... - 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... - 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .w...t.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x13, 0x00, 0xc8, 0x10, 0x00, 0x00, 0x62, 0x67, 0x66, // n............bgf - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, 0x79, 0x4c, // xTexture2DArrayL - 0x6f, 0x64, 0x28, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, // od(struct-BgfxSa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, 0x79, 0x2d, 0x70, 0x31, 0x2d, // mpler2DArray-p1- - 0x74, 0x41, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, // tA211;vf3;f1;... - 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // .....~..._sample - 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, // r.m_sampler..... - 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, // ....._sampler.m_ - 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, // texture......... - 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x7f, 0x15, 0x00, // ._coord......... - 0x00, 0x5f, 0x6c, 0x6f, 0x64, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, // ._lod........5.. - 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, // .vec4_splat(f1;. - 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x05, // ........._x..... - 0x00, 0x65, 0x0c, 0x00, 0x00, 0x74, 0x6f, 0x45, 0x76, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, // .e...toEv(vf4;.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // ........._color. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, // f4;vf3;vf4;..... - 0x00, 0x08, 0x3e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..>..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // ......8..v_texco - 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x02, 0x44, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ord0......D..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x07, // FragData_0_..... - 0x00, 0x21, 0x0a, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // .!...BgfxSampler - 0x32, 0x44, 0x41, 0x72, 0x72, 0x61, 0x79, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x21, 0x0a, 0x00, // 2DArray......!.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // .....m_sampler.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, // .....!.......m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, // exture.......... - 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, // .flattenTemp.... - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....s_texColorS - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, // ampler.......... - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, // .s_texColorTextu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, // re...........s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // exColor.m_sample - 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, // r........P...s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // exColor.m_textur - 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x24, 0x47, 0x6c, // e........1...$Gl - 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // obal.....1...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewRect..... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, // .1.......u_viewT - 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // exel.....1...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // .u_view......1.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, // .....u_invView.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .....1.......u_p - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // roj......1...... - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_invProj...... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .1.......u_viewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // roj......1...... - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .u_invViewProj.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .....1.......u_m - 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // odel.....1...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, // .u_modelView.... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .1.......u_model - 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // ViewProj.....1.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, // .....u_alphaRef4 - 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .....1.......u_p - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, // arams........B.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // .............bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0x13, 0x57, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..W..param...... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....color...... - 0x00, 0x4a, 0x50, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .JP..param...... - 0x00, 0x34, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .43..param...... - 0x00, 0x35, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .53..param...... - 0x00, 0x6d, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .m3..param...... - 0x00, 0x07, 0x31, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // ..1..param...... - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..+..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....w...v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........<..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, // excoord0.....t.. + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd0, 0x07, 0x00, // _params......... + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x3b, 0x01, 0x00, // ...#.........;.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xc2, 0x00, 0x00, // n............... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x09, 0x00, 0x00, // .main........... + 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x41, 0x72, // .BgfxSampler2DAr + 0x72, 0x61, 0x79, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ray............. + 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .m_sampler...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, // .........m_textu + 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // re.......6...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x38, 0x00, 0x00, // exColor......8.. + 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, // .s_texColorSampl + 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // er.......;...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // exColorTexture.. + 0x00, 0x05, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, // .....v...$Global + 0x00, 0x06, 0x00, 0x06, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .....v.......u_p + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, // arams........x.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, // .............v_c + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb7, 0x00, 0x00, // olor0........... 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // _0_.......U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am........8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, // FragData_0_..G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0x2a, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .*.......@...H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .1.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#... ...H...1.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .1.......#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, // .1.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#... ...H...1.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, // .1.......#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .1...........H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, // .1.......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...1.......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...1...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, // .1.......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // .0...G...1...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...B..."...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...w.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...t.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. - 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, // .y.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0xd6, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x53, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // .S.............. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, // .............!.. - 0x00, 0xa9, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x53, 0x03, 0x00, // .........y...S.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, 0x00, 0x1f, 0x01, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, // .........!...}.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x1e, 0x00, 0x04, 0x00, 0x21, 0x0a, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xd6, 0x00, 0x00, // .....!.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x21, 0x0a, 0x00, // . ...........!.. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...z.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...z.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x54, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, // . ...T.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x54, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...T.......... - 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...{.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, // .;...{.......... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x55, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, // . ...U.......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x55, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, // .;...U...P...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // .+.............. - 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x04, // ............@... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .e.............. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ..... .......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // .*...e...j...... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .1...........e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...*...e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xae, 0x08, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xae, 0x08, 0x00, // .....1...;...... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ./.......+...... - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .........+...... - 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .........+...... - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // .........;...... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .w....... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .t....... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, // .Sa..;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, // .....;........8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, // .....=.......!C. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, // .....=........3. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x21, 0x0a, 0x00, 0x00, 0x5e, 0x20, 0x00, // .....P...!...^ . - 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, // .!C...3..>...... - 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, // .^ ..A...y....V. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, // ......V..>...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x53, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, // .....A...S....@. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xd6, 0x00, 0x00, // .........=...... - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, // ......@..>...P.. - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .....=........+. - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, // .w...=........<. - 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .t...>....U...+. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....8...<..9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, // ......&.......U. - 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ..8......=...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, // .........>...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .........8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xc8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, // ................ - 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...y...~...7.. - 0x00, 0x53, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, // .S.......7...... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x7f, 0x15, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xd6, 0x00, 0x00, // ......_..=...... - 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, // .!A..~...V...... - 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, // .`5......!A..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......"......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x7f, 0x15, 0x00, 0x00, 0x58, 0x00, 0x07, // ......G......X.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, // .....(=..`5...". - 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, // ......G......(=. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..........5..=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....).......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......B......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....T-......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // .....g-......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xb4, 0x42, 0x00, // ......1..)....B. - 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xee, 0x31, 0x00, // .T-..g-.......1. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x0c, 0x00, // .8...6.......e.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .........7...... - 0x00, 0xa4, 0x11, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x58, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........X...=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x4f, 0x00, 0x08, // .....@R......O.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x16, 0x1c, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0x40, 0x52, 0x00, // .........@R..@R. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x6a, 0x55, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....jU..B.../.. - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // .....=........Q. - 0x00, 0x6a, 0x55, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x49, 0x00, // .jU..........TI. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // ..............Q. - 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x16, 0x1c, 0x00, // ................ - 0x00, 0x54, 0x49, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x45, 0x47, 0x00, // .TI..A.......EG. - 0x00, 0xa4, 0x11, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x45, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .?>..EG..Q...... - 0x00, 0x56, 0x44, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .VD..........Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, // .....OT......... - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x91, 0x1e, 0x00, // .Q........#..... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x54, 0x00, // .....P........T. - 0x00, 0x56, 0x44, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x3f, 0x3e, 0x00, // .VD..OT...#..?>. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0x1d, 0x54, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......T..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........>..7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......8..7...... - 0x00, 0x02, 0x44, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf0, 0x1b, 0x00, 0x00, 0x3b, 0x00, 0x04, // ..D..........;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......W......;.. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y...JP......;.. - 0x00, 0x53, 0x03, 0x00, 0x00, 0x34, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .S...43......;.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x35, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....53......;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....m3......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......1......>.. - 0x00, 0x13, 0x57, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..W......9...... - 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....5....W..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0xa1, 0x48, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x4f, 0x00, 0x07, // ......H...8..O.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0x70, 0x45, 0x00, 0x00, 0xa1, 0x48, 0x00, 0x00, 0xa1, 0x48, 0x00, // .....pE...H...H. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, // .........A...... - 0x00, 0xad, 0x5c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0d, 0x0a, 0x00, // .....B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf6, 0x1d, 0x00, 0x00, 0xad, 0x5c, 0x00, // .=.............. - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x81, 0x46, 0x00, 0x00, 0x70, 0x45, 0x00, // .Q........F..pE. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd1, 0x55, 0x00, // .....Q........U. - 0x00, 0x70, 0x45, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, // .pE......P...... - 0x00, 0xcd, 0x44, 0x00, 0x00, 0x81, 0x46, 0x00, 0x00, 0xd1, 0x55, 0x00, 0x00, 0xf6, 0x1d, 0x00, // ..D...F...U..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x51, 0x00, 0x00, 0x14, 0x11, 0x00, // .=.......!Q..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x21, 0x51, 0x00, 0x00, 0x3d, 0x00, 0x04, // .>...JP..!Q..=.. - 0x00, 0xd6, 0x00, 0x00, 0x00, 0x0c, 0x26, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......&..P...>.. - 0x00, 0x34, 0x33, 0x00, 0x00, 0x0c, 0x26, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x33, 0x00, // .43...&..>...53. - 0x00, 0xcd, 0x44, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x3d, 0x32, 0x00, // ..D..A.......=2. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0x3d, 0x32, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....L...=2..>.. - 0x00, 0x6d, 0x33, 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, // .m3..L...9...... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0xc8, 0x10, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x34, 0x33, 0x00, // .........JP..43. - 0x00, 0x35, 0x33, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // .53..m3..=...... - 0x00, 0xea, 0x23, 0x00, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..#...>......... - 0x00, 0x25, 0x1f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0xea, 0x23, 0x00, 0x00, 0x3e, 0x00, 0x03, // .%........#..>.. - 0x00, 0x07, 0x31, 0x00, 0x00, 0x25, 0x1f, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..1..%...9...... - 0x00, 0x84, 0x51, 0x00, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..Q..e....1..>.. - 0x00, 0x02, 0x44, 0x00, 0x00, 0x84, 0x51, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ..D...Q......8.. - 0x00, 0x00, // .. + 0x00, 0xc2, 0x00, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, // .....bgfx_FragDa + 0x74, 0x61, 0x30, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // ta0..G...;...".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, // .....G...;...!.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....H...v...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, // .#.......G...v.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G...x...".. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc2, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, // ......... ...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // ................ + 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0x17, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x20, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, // . ...5.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // .;...5...6...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // . ...7.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // .;...7...8...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // . ...:.......... + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .;...:...;...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....>... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+...>...C...... + 0x00, 0x1b, 0x00, 0x03, 0x00, 0x47, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .....G.......+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2b, 0x00, 0x04, // .....c......@+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x1e, 0x00, 0x03, // .....k.../..>... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, // .v....... ...w.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, // .....v...;...w.. + 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // .x...........y.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // . .......+...y.. + 0x00, 0x7a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, // .z....... ...{.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .........+...... + 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // ........@+...y.. + 0x00, 0x87, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // .........+...y.. + 0x00, 0x9e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // .........+...y.. + 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb2, 0x00, 0x00, // ......... ...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb2, 0x00, 0x00, // .........;...... + 0x00, 0xb3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb6, 0x00, 0x00, // ......... ...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb6, 0x00, 0x00, // .........;...... + 0x00, 0xb7, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xc1, 0x00, 0x00, // ......... ...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xc1, 0x00, 0x00, // .........;...... + 0x00, 0xc2, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, // .........,...... + 0x00, 0x39, 0x01, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, // .9...c...c...c.. + 0x00, 0x2c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, 0x00, 0x6b, 0x00, 0x00, // .,.......:...k.. + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, // .k...k...6...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, // .....=.......9.. + 0x00, 0x38, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, // .8...=.......<.. + 0x00, 0x3b, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .;...P.......=.. + 0x00, 0x39, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x00, 0x00, // .9...<...>...6.. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, // .=...=.......... + 0x00, 0xb3, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, // .....=.......... + 0x00, 0xb7, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, // .....A...{...... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .x...C.......=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, // .Q.............. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, // .....P.......... + 0x00, 0xe2, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. + 0x00, 0x09, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .........6...Q.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x35, 0x01, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....5.......... + 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0xe5, 0x00, 0x00, // .Q.......6...... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, // .....A...{...... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .x...C.......=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, // .............V.. + 0x00, 0x47, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0x35, 0x01, 0x00, // .G.......6...5.. + 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, // .X.............. + 0x00, 0xe4, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x85, 0x00, 0x05, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, // ................ + 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, // .O.............. + 0x00, 0xeb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x1d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, // ................ + 0x00, 0x39, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, // .9...A...{...... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .x...C...z...=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x50, 0x00, 0x06, // .............P.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, // ................ + 0x00, 0x07, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, // .....O.......... + 0x00, 0xeb, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, // .............'.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x1d, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, // ................ + 0x00, 0x08, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x00, // .....A...{...... + 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, // .x...C.......=.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, // ................ + 0x00, 0x86, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x10, 0x01, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x06, // .....'.......... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2b, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .....+.......... + 0x00, 0x10, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, // .............-.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x2b, 0x01, 0x00, 0x00, 0x3a, 0x01, 0x00, // .........+...:.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, // .Q.............. + 0x00, 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, // .....Q.......... + 0x00, 0x2d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .-.......Q...... + 0x00, 0x15, 0x01, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .....-.......Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // .........-...... + 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0x14, 0x01, 0x00, // .P.............. + 0x00, 0x15, 0x01, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0x13, 0x01, 0x00, 0x00, 0x3e, 0x00, 0x03, // .............>.. + 0x00, 0xc2, 0x00, 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .............8.. + 0x00, 0x00, 0x00, 0x10, 0x00, // ..... }; -static const uint8_t fs_texture_array_dx9[395] = +static const uint8_t fs_texture_array_dx9[615] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color0......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x5c, 0x01, 0x00, 0x00, 0x00, 0x03, // rams............ - 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x83, 0x00, // ....,.CTAB...... - 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ..|...D......... - 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..P.......`..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ......l.......s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ..........u_para - 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, // ms.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......ps_3_0.Mic - 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, // 10.1..Q......... - 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, // .?.............. - 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, // ................ - 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x01, 0x00, // ................ - 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, // .............._. - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x0e, 0x00, // ................ - 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, // ................ - 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, // ................ - 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, // _texColor0...... + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x34, 0x02, // u_params......4. + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........,.CTAB.. + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, // ......|...D..... + 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, // ......P.......`. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........l..... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // params.......... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, // ..........ps_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, // ler 10.1..Q..... + 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2f, 0xba, // .....?.......@/. + 0xe8, 0x3e, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, // .>.............. + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, // ................ + 0xd0, 0xa0, 0x01, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ + 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, // .._............. + 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x8b, 0x0f, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, // ........U....... + 0x04, 0x80, 0x01, 0x00, 0xaa, 0x8b, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x01, 0x00, // ................ + 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, // ................ + 0xaa, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, // ........U....... + 0x04, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x02, 0x00, 0xe4, 0x81, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x07, 0x80, 0x00, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x07, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x01, 0x80, 0x00, 0x00, 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, // ................ + 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x05, 0x00, // U............... + 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xff, 0xa0, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x00, 0x08, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, // ................ + 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, // ....U........... + 0xaa, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... }; -static const uint8_t fs_texture_array_dx11[562] = +static const uint8_t fs_texture_array_dx11[814] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x44, 0x58, // olor0.........DX - 0x42, 0x43, 0x68, 0x4c, 0x12, 0x3a, 0x9d, 0xa5, 0x3e, 0x99, 0x56, 0x28, 0xfa, 0x22, 0xcf, 0x30, // BChL.:..>.V(.".0 - 0xa5, 0x58, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // .X............,. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO - 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x24, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x49, 0x00, // ..SHDR$...@...I. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x40, // ..Z....`......X@ - 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. - 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, // ..........b...2. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......e.... .... - 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x00, // ..h.......6...2. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, // ......F.......6. - 0x00, 0x06, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, 0x20, 0x00, 0x00, 0x00, // ..B......... ... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......H......... - 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, // ..F.......F~.... - 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, // ...`........ ... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8......... - 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, // ..F.......F..... - 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x12, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3a, 0x80, // ..............:. - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x20, // .........8...r - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // ......F......... - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, // ......6.... .... - 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, // ..:.......>..... - 0x10, 0x00, // .. + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xf8, 0x02, // texColor0....... + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x77, 0x19, 0xf0, 0x17, 0xe9, 0x7f, 0x9c, 0x60, 0x64, 0x2e, // ..DXBCw......`d. + 0x99, 0x47, 0xa5, 0xb8, 0x85, 0xdb, 0x01, 0x00, 0x00, 0x00, 0xf8, 0x02, 0x00, 0x00, 0x03, 0x00, // .G.............. + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, // ..........SV_TAR + 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x1c, 0x02, 0x00, 0x00, 0x40, 0x00, // GET...SHDR....@. + 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ......Y...F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ......Z....`.... + 0x00, 0x00, 0x58, 0x40, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X@...p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, // ..b...........b. + 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..2.......e.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x36, 0x00, // ......h.......6. + 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, // ..2.......F..... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x06, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x80, // ..6...B......... + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, // .........H..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, // ......F.......F~ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, // .......`........ + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, // .........8..... + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, // ......F.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, // ....../...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ..F...........6. + 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, // ... ......:..... + 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, // ..8...r.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0xcd, 0xcc, // .......@.....@.. + 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x00, // .@...@........r. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..r.......F..... + 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x41, 0x00, // ..F.......F...A. + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2...r..... + 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // .... .........F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, // ......F......... + 0x00, 0x06, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, // ..........:. ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8...r..... + 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ../...r.......F. + 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, // ..........8...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ + 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, // ../..>/..>/..>.. + 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ......r ......F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ......>....... }; -static const uint8_t fs_texture_array_mtl[924] = +static const uint8_t fs_texture_array_mtl[1054] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x7e, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, // ams......~...usi - 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met - 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // float4 v_color - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, // 0;. float3 v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // xcoord0;.};.stru - 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // Output {. float - 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // 4 gl_FragColor;. - 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt - 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // . float4 u_para - 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // ms;.};.fragment - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain - 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta - 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [ - 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. , - 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x5f, 0x61, 0x72, 0x72, // texture2d_arr - 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ay s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, // olor [[texture(0 - 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, // )]], sampler _mt - 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, // lsmp_s_texColor - 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, // [[sampler(0)]]). - 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // {. xlatMtlShade - 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, // rOutput _mtl_o;. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // float3 tmpvar_ - 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 1 = 0;. tmpvar_ - 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, // 1.xy = _mtl_i.v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, // texcoord0.xy;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, // tmpvar_1.z = _mt - 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x79, 0x3b, 0x0a, // l_u.u_params.y;. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // float4 _color_ - 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // 2 = 0;. _color_ - 0x32, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, // 2 = (s_texColor. - 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, // sample(_mtlsmp_s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, // _texColor, (floa - 0x74, 0x32, 0x29, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x78, // t2)((tmpvar_1).x - 0x79, 0x29, 0x2c, 0x20, 0x28, 0x75, 0x69, 0x6e, 0x74, 0x29, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, // y), (uint)((tmpv - 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x7a, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, // ar_1).z), level( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params. - 0x78, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, // x)) * _mtl_i.v_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // olor0);. float4 - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_3 = 0;. - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_3.xyz = - 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, // (_color_2.xyz * - 0x65, 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, // exp2(_mtl_u.u_pa - 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // rams.w));. tmpv - 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // ar_3.w = _color_ - 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, // 2.w;. _mtl_o.gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp - 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, // var_3;. return - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // _mtl_o;.}... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x04, // FSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, // ut {. float4 v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // color0;. float3 + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, // v_texcoord0;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, // haderOutput {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // float4 gl_FragCo + 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // lor;.};.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // orm {. float4 u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, // _params;.};.frag + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ment xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // erOutput xlatMtl + 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // Main (xlatMtlSha + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, // derInput _mtl_i + 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // nstant xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, // aderUniform& _mt + 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // l_u [[buffer(0)] + 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // ]. , texture2 + 0x64, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, // d_array s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, // _texColor [[text + 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ure(0)]], sample + 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // r _mtlsmp_s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, // olor [[sampler(0 + 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // )]]).{. xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, // ShaderOutput _mt + 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, // l_o;. float3 tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_1 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // pvar_1.xy = _mtl + 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, // _i.v_texcoord0.x + 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, // y;. tmpvar_1.z + 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // = _mtl_u.u_param + 0x73, 0x2e, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, // s.y;. float4 _c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, // olor_2 = 0;. _c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // olor_2 = (s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, // olor.sample(_mtl + 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, // smp_s_texColor, + 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // (float2)((tmpvar + 0x5f, 0x31, 0x29, 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x28, 0x75, 0x69, 0x6e, 0x74, 0x29, 0x28, // _1).xy), (uint)( + 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x2e, 0x7a, 0x29, 0x2c, 0x20, 0x6c, // (tmpvar_1).z), l + 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, // evel(_mtl_u.u_pa + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // rams.x)) * _mtl_ + 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, // i.v_color0);. f + 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, // loat4 tmpvar_3 = + 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, // 0;. tmpvar_3.x + 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, // yz = pow (abs((. + 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, // mix (pow (ab + 0x73, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, // s(_color_2.xyz), + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, // float3(2.2, 2.2 + 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // , 2.2)), _color_ + 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // 2.xyz, _mtl_u.u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, // params.z). * . + 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, // exp2(_mtl_u. + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, // u_params.w). )) + 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, // , float3(0.45454 + 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, // 54, 0.4545454, 0 + 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // .4545454));. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // pvar_3.w = _colo + 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, // r_2.w;. _mtl_o. + 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, // gl_FragColor = t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, // mpvar_3;. retur + 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // n _mtl_o;.}... }; extern const uint8_t* fs_texture_array_pssl; extern const uint32_t fs_texture_array_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_array.sc b/3rdparty/bgfx/tools/texturev/fs_texture_array.sc index 8649b8b32c3..51d02db1dcc 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_array.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture_array.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_cube.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_cube.bin.h index 778f93fe009..c06bee315ea 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_cube.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture_cube.bin.h @@ -1,529 +1,405 @@ -static const uint8_t fs_texture_cube_glsl[714] = +static const uint8_t fs_texture_cube_glsl[746] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x03, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, 0x75, 0x5f, 0x6d, 0x74, 0x78, // olor.......u_mtx - 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0x8f, 0x02, 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, // ..........varyin - 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, // g highp vec4 v_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, // olor0;.varying h - 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // ighp vec3 v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, // oord0;.uniform h - 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ighp vec4 u_para - 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, // ms;.uniform lowp - 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, // samplerCube s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // exColor;.uniform - 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x74, // highp mat4 u_mt - 0x78, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, // x;.void main (). - 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, // {. highp vec3 t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1;. tmpva - 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // r_1.z = 1.0;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x28, // mpvar_1.xy = ((( - 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x2a, // v_texcoord0.xy * - 0x20, 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x76, // 2.0) - 1.0) * v - 0x65, 0x63, 0x32, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x2d, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, // ec2(1.0, -1.0)); - 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, // . highp vec4 tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_2;. tmpvar - 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // _2.w = 0.0;. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // pvar_2.xyz = tmp - 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, // var_1;. mediump - 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, // vec4 tmpvar_3;. - 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, // lowp vec4 _col - 0x6f, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x34, // or_4;. _color_4 - 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, // = (textureCubeL - 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, // od (s_texColo - 0x72, 0x2c, 0x20, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x28, 0x75, 0x5f, // r, normalize((u_ - 0x6d, 0x74, 0x78, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, // mtx * tmpvar_2). - 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, // xyz), u_params.x - 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, // ) * v_color0);. - 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // lowp vec4 tmpva - 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x2e, // r_5;. tmpvar_5. - 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x34, 0x2e, // xyz = (_color_4. - 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, // xyz * exp2(u_par - 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ams.w));. tmpva - 0x72, 0x5f, 0x35, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x34, // r_5.w = _color_4 - 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x20, 0x3d, // .w;. tmpvar_3 = - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x35, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, // tmpvar_5;. gl_ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, 0x75, // texColor.......u + 0x5f, 0x6d, 0x74, 0x78, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, 0xab, 0x02, 0x00, 0x00, 0x76, 0x61, // _mtx..........va + 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // rying vec4 v_col + 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, // or0;.varying vec + 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, // 3 v_texcoord0;.u + 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, // niform vec4 u_pa + 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, // rams;.uniform sa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // mplerCube s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x61, // olor;.uniform ma + 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, // t4 u_mtx;.void m + 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, // ain ().{. vec3 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_1;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, // ar_1.z = 1.0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x28, // tmpvar_1.xy = (( + 0x28, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x20, // (v_texcoord0.xy + 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, // * 2.0) - 1.0) * + 0x76, 0x65, 0x63, 0x32, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x2d, 0x31, 0x2e, 0x30, 0x29, 0x29, // vec2(1.0, -1.0)) + 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ;. vec4 tmpvar_ + 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, // 2;. tmpvar_2.w + 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // = 0.0;. tmpvar_ + 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // 2.xyz = tmpvar_1 + 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // ;. vec4 _color_ + 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, // 3;. _color_3 = + 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, // (textureCubeLod + 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x6e, 0x6f, 0x72, // (s_texColor, nor + 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x28, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x20, 0x2a, 0x20, // malize((u_mtx * + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, // tmpvar_2).xyz), + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, 0x5f, // u_params.x) * v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // color0);. vec4 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_4;. tmpv + 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, // ar_4.xyz = pow ( + 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, // abs((. mix (p + 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, // ow (abs(_color_3 + 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, // .xyz), vec3(2.2, + 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, // 2.2, 2.2)), _co + 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, // lor_3.xyz, u_par + 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, // ams.z). * . + 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, // exp2(u_params.w + 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x30, 0x2e, 0x34, // ). )), vec3(0.4 + 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, // 545454, 0.454545 + 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, // 4, 0.4545454));. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, // tmpvar_4.w = _ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, // color_3.w;. gl_ 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, // FragColor = tmpv - 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ar_3;.}... + 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ar_4;.}... }; -static const uint8_t fs_texture_cube_spv[5050] = +static const uint8_t fs_texture_cube_spv[2425] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x05, 0x75, 0x5f, 0x6d, 0x74, 0x78, // FSH........u_mtx - 0x14, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, // .......u_params. - 0x01, 0x00, 0x00, 0x01, 0x00, 0x90, 0x13, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, // ...........#.... - 0x00, 0x02, 0x00, 0x08, 0x00, 0xae, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, // ......b......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, // .............GLS - 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, // L.std.450....... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, // ................ - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x77, 0x0e, 0x00, // .....main....w.. - 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x1f, 0x16, 0x00, // .t.............. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, // ................ - 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x05, 0x00, 0x11, 0x00, 0xf4, 0x10, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x54, 0x65, 0x78, // .........bgfxTex - 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, 0x72, 0x75, // tureCubeLod(stru - 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, // ct-BgfxSamplerCu - 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x43, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x66, // be-p1-tC11;vf3;f - 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, // 1;.......~..._sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // mpler.m_sampler. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ........._sample - 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, // r.m_texture..... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, // ....._coord..... - 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x06, // ....._level..... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x74, 0x6f, 0x45, 0x76, 0x28, 0x76, 0x66, // .....e...toEv(vf - 0x34, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x5f, 0x63, 0x6f, // 4;..........._co - 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, // lor..........@ma - 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, // in(vf4;vf3;vf4;. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ......>..v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........8..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x02, 0x44, 0x00, // excoord0......D. - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, // .....g...BgfxSam - 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, // plerCube.....g.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // .....m_sampler.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, // .....g.......m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, // exture.......... - 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, // .flattenTemp.... - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....s_texColorS - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, // ampler.......... - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, // .s_texColorTextu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, // re...........s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // exColor.m_sample - 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, // r........P...s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // exColor.m_textur - 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x24, 0x47, 0x6c, // e............$Gl - 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // obal............ - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_viewRect..... - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, // .........u_viewT - 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, // exel............ - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x0b, 0x00, // .u_view......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, // .....u_invView.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .............u_p - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, // roj............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .u_invProj...... - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // .........u_viewP - 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, // roj............. - 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .u_invViewProj.. - 0x00, 0x06, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .............u_m - 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, // odel............ - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, // .u_modelView.... - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .........u_model - 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x0b, 0x00, // ViewProj........ - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, // .....u_alphaRef4 - 0x00, 0x06, 0x00, 0x06, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, // .............u_p - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // arams........... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, // .....u_mtx...... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, // .B.............. - 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, // .bgfx_VoidFrag.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x13, 0x57, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......W..param.. - 0x00, 0x05, 0x00, 0x03, 0x00, 0x46, 0x17, 0x00, 0x00, 0x64, 0x69, 0x72, 0x00, 0x05, 0x00, 0x04, // .....F...dir.... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....color...... - 0x00, 0x34, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .43..param...... - 0x00, 0x35, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .53..param...... - 0x00, 0x36, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .63..param...... - 0x00, 0x6d, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .m3..param...... - 0x00, 0x07, 0x31, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // ..1..param...... - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..+..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....w...v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........<..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, // excoord0.....t.. - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // _0_.......U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am........8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, // FragData_0_..G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0x2a, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .*.......@...H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // .#... ...H...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .........#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // .#.......H...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // .#... ...H...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, // .........#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // .#.......H...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, // .........#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H.............. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // .#.......H...... - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, // .........#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...........#.. - 0x00, 0x30, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0d, 0x00, 0x00, // .0...H.......... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x0d, 0x00, 0x00, // .....H.......... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x40, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0xa4, 0x0b, 0x00, // .#...@...H...... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, // .............G.. - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, // .........G...B.. - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, // .".......G...w.. - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, // .........G...t.. - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, // .........G...... - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, // .!.............. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... ...y...... - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x19, 0x00, 0x09, 0x00, 0x98, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x75, // FSH............u + 0x5f, 0x6d, 0x74, 0x78, 0x14, 0x01, 0x10, 0x00, 0x04, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // _mtx.......u_par + 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x48, 0x09, 0x00, 0x00, 0x03, 0x02, 0x23, // ams......H.....# + 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x5b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // .........[...... + 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... + 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... + 0x00, 0xc5, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x67, 0x66, // n............Bgf + 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, 0x06, // xSamplerCube.... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, // .........m_sampl + 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // er.............. + 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // .m_texture...... + 0x00, 0x36, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, // .6...s_texColor. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x38, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....8...s_texCo + 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, // lorSampler...... + 0x00, 0x3b, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, // .;...s_texColorT + 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, // exture.......w.. + 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x77, 0x00, 0x00, // .$Global.....w.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, // .....u_params... + 0x00, 0x06, 0x00, 0x05, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .....w.......u_m + 0x74, 0x78, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tx.......y...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .........v_color + 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd4, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;...!...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...w.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....H...w...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .....H...w...... + 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x77, 0x00, 0x00, // .#.......H...w.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, // .............G.. + 0x00, 0x77, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, // .w.......G...y.. + 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc5, 0x00, 0x00, // .".......G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xc9, 0x00, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd4, 0x00, 0x00, // .........G...... + 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, // .!.............. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. + 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x98, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x74, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....!...t...... - 0x00, 0x79, 0x04, 0x00, 0x00, 0x15, 0x03, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, // .y.............. - 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, // .!.............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // . .............. - 0x00, 0x21, 0x00, 0x04, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, // .!.............. - 0x00, 0x21, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, // .!...}.......... - 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x67, 0x09, 0x00, // .............g.. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, // ......... ...!.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x67, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, // .....g... ...z.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, // .........;...z.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, // ......... ...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, // .........;...... - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, // ......... ...{.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, // .........;...{.. - 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, // ......... ...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, // .........;...... - 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .P.......+...... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, // ................ - 0x00, 0x98, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x40, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // ....@....e...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....+.......j.. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, // . .......*...e.. - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x10, 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, // .j.............. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .....e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2a, 0x07, 0x00, // .e...e...e...*.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .e...e.......... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x5e, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // .e... ...^...... - 0x00, 0xa4, 0x0b, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x5e, 0x02, 0x00, 0x00, 0x42, 0x13, 0x00, // .....;...^...B.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, 0x00, // .....+.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x41, 0x03, 0x00, // ....?+.......A.. - 0x00, 0x00, 0x00, 0x80, 0xbf, 0x2c, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .....,.......... - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x03, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .....A...+...... - 0x00, 0x32, 0x0a, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, // .2....... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // .....e...+...... - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ......... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // .........;...... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .w....... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .t....... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, // .Sa..;...!...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, // .....;........8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, // .....=.......!C. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, // .....=........3. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x67, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, // .....P...g...^ . - 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, // .!C...3..>...... - 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, // .^ ..A...y....V. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, // ......V..>...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x15, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, // .....A........@. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, // .........=...... - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, // ......@..>...P.. - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .....=........+. - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, // .w...=........<. - 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .t...>....U...+. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....8...<..9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, // ......&.......U. - 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ..8......=...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, // .........>...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .........8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x0b, 0x00, // .............t.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...y...~...7.. - 0x00, 0x15, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, // .........7...... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, // ......_..=...... - 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, // .!A..~...V...... - 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, // .`5......!A..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......"......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, // ......G......X.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, // .....(=..`5...". - 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, // ......G......(=. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, // .8...6.......5.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..........5..=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....).......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......B......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....T-......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, // .....g-......P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xb4, 0x42, 0x00, // ......1..)....B. - 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xee, 0x31, 0x00, // .T-..g-.......1. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x0c, 0x00, // .8...6.......e.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .........7...... - 0x00, 0xa4, 0x11, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x58, 0x2e, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........X...=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x4f, 0x00, 0x08, // .....@R......O.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x16, 0x1c, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0x40, 0x52, 0x00, // .........@R..@R. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x6a, 0x55, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....jU..B.../.. - 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // .....=........Q. - 0x00, 0x6a, 0x55, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x49, 0x00, // .jU..........TI. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0xdf, 0x51, 0x00, // ..............Q. - 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x16, 0x1c, 0x00, // ................ - 0x00, 0x54, 0x49, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x45, 0x47, 0x00, // .TI..A.......EG. - 0x00, 0xa4, 0x11, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........=...... - 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x45, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .?>..EG..Q...... - 0x00, 0x56, 0x44, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .VD..........Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, // .....OT......... - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x91, 0x1e, 0x00, // .Q........#..... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x54, 0x00, // .....P........T. - 0x00, 0x56, 0x44, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0xf7, 0x23, 0x00, 0x00, 0x3f, 0x3e, 0x00, // .VD..OT...#..?>. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0x1d, 0x54, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ......T..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........>..7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // ......8..7...... - 0x00, 0x02, 0x44, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf0, 0x1b, 0x00, 0x00, 0x3b, 0x00, 0x04, // ..D..........;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......W......;.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x46, 0x17, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....F.......;.. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x34, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y...43......;.. - 0x00, 0x15, 0x03, 0x00, 0x00, 0x35, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....53......;.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x36, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....63......;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .....m3......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......1......>.. - 0x00, 0x13, 0x57, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..W......9...... - 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....5....W..=.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0x58, 0x4e, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x4f, 0x00, 0x07, // .....XN...8..O.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0x4f, 0x5d, 0x00, 0x00, 0x58, 0x4e, 0x00, 0x00, 0x58, 0x4e, 0x00, // .....O]..XN..XN. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, // ................ - 0x00, 0x9e, 0x4d, 0x00, 0x00, 0x4f, 0x5d, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, // ..M..O]......P.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, // ......6......... - 0x00, 0x83, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x78, 0x39, 0x00, 0x00, 0x9e, 0x4d, 0x00, // .........x9...M. - 0x00, 0xfe, 0x36, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0a, 0x1e, 0x00, // ..6............. - 0x00, 0x78, 0x39, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // .x9......Q...... - 0x00, 0x41, 0x4b, 0x00, 0x00, 0x0a, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .AK..........Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x71, 0x24, 0x00, 0x00, 0x0a, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, // .....q$......... - 0x00, 0x50, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x44, 0x00, 0x00, 0x41, 0x4b, 0x00, // .P........D..AK. - 0x00, 0x71, 0x24, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x46, 0x17, 0x00, // .q$......>...F.. - 0x00, 0x0d, 0x44, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa4, 0x30, 0x00, // ..D..=........0. - 0x00, 0x46, 0x17, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x84, 0x30, 0x00, // .F...Q........0. - 0x00, 0xa4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ..0......Q...... - 0x00, 0x8d, 0x56, 0x00, 0x00, 0xa4, 0x30, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // ..V...0......Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xad, 0x62, 0x00, 0x00, 0xa4, 0x30, 0x00, 0x00, 0x02, 0x00, 0x00, // ......b...0..... - 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x06, 0x42, 0x00, 0x00, 0x84, 0x30, 0x00, // .P........B...0. - 0x00, 0x8d, 0x56, 0x00, 0x00, 0xad, 0x62, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x41, 0x00, 0x05, // ..V...b......A.. - 0x00, 0xe2, 0x02, 0x00, 0x00, 0x72, 0x22, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x32, 0x0a, 0x00, // .....r"..B...2.. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x46, 0x34, 0x00, 0x00, 0x72, 0x22, 0x00, // .=...e...F4..r". - 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x25, 0x00, 0x00, 0x06, 0x42, 0x00, // ..........%...B. - 0x00, 0x46, 0x34, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x11, 0x49, 0x00, // .F4..O........I. - 0x00, 0x01, 0x25, 0x00, 0x00, 0x01, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..%...%......... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x3c, 0x00, // ..............<. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x11, 0x49, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....E....I..>.. - 0x00, 0x46, 0x17, 0x00, 0x00, 0x95, 0x3c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .F....<..=...... - 0x00, 0x92, 0x3d, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x34, 0x33, 0x00, // ..=......>...43. - 0x00, 0x92, 0x3d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, 0x00, 0xf9, 0x25, 0x00, // ..=..=........%. - 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x33, 0x00, 0x00, 0xf9, 0x25, 0x00, // .P...>...53...%. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x45, 0x26, 0x00, 0x00, 0x46, 0x17, 0x00, // .=.......E&..F.. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x33, 0x00, 0x00, 0x45, 0x26, 0x00, 0x00, 0x41, 0x00, 0x06, // .>...63..E&..A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0xb3, 0x3b, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......;..B.../.. - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4c, 0x19, 0x00, // .....=.......L.. - 0x00, 0xb3, 0x3b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x4c, 0x19, 0x00, // ..;..>...m3..L.. - 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0xf4, 0x10, 0x00, // .9.............. - 0x00, 0x34, 0x33, 0x00, 0x00, 0x35, 0x33, 0x00, 0x00, 0x36, 0x33, 0x00, 0x00, 0x6d, 0x33, 0x00, // .43..53..63..m3. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xea, 0x23, 0x00, 0x00, 0x08, 0x3e, 0x00, // .=........#...>. - 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x25, 0x1f, 0x00, 0x00, 0x18, 0x0e, 0x00, // .........%...... - 0x00, 0xea, 0x23, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x07, 0x31, 0x00, 0x00, 0x25, 0x1f, 0x00, // ..#..>....1..%.. - 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x84, 0x51, 0x00, 0x00, 0x65, 0x0c, 0x00, // .9........Q..e.. - 0x00, 0x07, 0x31, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x02, 0x44, 0x00, 0x00, 0x84, 0x51, 0x00, // ..1..>....D...Q. - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ................ + 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ..... ...5...... + 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .....;...5...6.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // ..... ...7...... + 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, // .....;...7...8.. + 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ..... ...:...... + 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, // .....;...:...;.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........>... .. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // .....+...>...?.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, // .....+...>...C.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x47, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, // .........G...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, // .+.......c...... + 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x2f, 0xba, 0xe8, // @+.......k.../.. + 0x3e, 0x18, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // >....v.......... + 0x00, 0x1e, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, // .....w.......v.. + 0x00, 0x20, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, // . ...x.......w.. + 0x00, 0x3b, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .;...x...y...... + 0x00, 0x15, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....z... ...... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .+...z...{...... + 0x00, 0x20, 0x00, 0x04, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // . ...|.......... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. + 0x40, 0x2b, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // @+...z.......... + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. + 0x00, 0x17, 0x00, 0x04, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, // .+.............. + 0x3f, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, // ?+.............. + 0xbf, 0x2c, 0x00, 0x05, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .,.............. + 0x00, 0xa3, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xae, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, // .v...+...z...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xd3, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x05, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x58, 0x01, 0x00, // .....,.......X.. + 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, // .........,...... + 0x00, 0x59, 0x01, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, // .Y...c...c...c.. + 0x00, 0x2c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5a, 0x01, 0x00, 0x00, 0x6b, 0x00, 0x00, // .,.......Z...k.. + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, // .k...k...6...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, // .....=.......9.. + 0x00, 0x38, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, // .8...=.......<.. + 0x00, 0x3b, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .;...P.......=.. + 0x00, 0x39, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x00, 0x00, // .9...<...>...6.. + 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, // .=...=.......... + 0x00, 0xc5, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, // .....=.......... + 0x00, 0xc9, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, // .....O.......... + 0x00, 0xca, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x8e, 0x00, 0x05, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, // ................ + 0x00, 0x87, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, // ................ + 0x00, 0xf2, 0x00, 0x00, 0x00, 0x58, 0x01, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x9c, 0x00, 0x00, // .....X.......... + 0x00, 0xf5, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, // .Q.............. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, // .....P.......... + 0x00, 0xf6, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, // ................ + 0x00, 0x41, 0x00, 0x05, 0x00, 0xae, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, // .A...........y.. + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x76, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, // .?...=...v...... + 0x00, 0xfe, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ + 0x00, 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, // .........O...... + 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, // .........E...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x36, 0x00, 0x00, // .=...........6.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x03, 0x01, 0x00, // .Q.......T...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x55, 0x01, 0x00, // .....Q.......U.. + 0x00, 0x03, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7c, 0x00, 0x00, // .........A...|.. + 0x00, 0x05, 0x01, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, // .....y...C...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, // .=.............. + 0x00, 0x56, 0x00, 0x05, 0x00, 0x47, 0x00, 0x00, 0x00, 0x17, 0x01, 0x00, 0x00, 0x55, 0x01, 0x00, // .V...G.......U.. + 0x00, 0x54, 0x01, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1a, 0x01, 0x00, // .T...X.......... + 0x00, 0x17, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x01, 0x00, // ................ + 0x00, 0x85, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x1a, 0x01, 0x00, // ................ + 0x00, 0xc6, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x01, 0x00, // .....O.......#.. + 0x00, 0x0a, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3a, 0x01, 0x00, // .............:.. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, // .........#...... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, // .....<.......... + 0x00, 0x3a, 0x01, 0x00, 0x00, 0x59, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7c, 0x00, 0x00, // .:...Y...A...|.. + 0x00, 0x25, 0x01, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, // .%...y...C...{.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x26, 0x01, 0x00, 0x00, 0x25, 0x01, 0x00, // .=.......&...%.. + 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x26, 0x01, 0x00, // .P.......'...&.. + 0x00, 0x26, 0x01, 0x00, 0x00, 0x26, 0x01, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, // .&...&...O...... + 0x00, 0x29, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // .).............. + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x46, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, // .F...........<.. + 0x00, 0x29, 0x01, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7c, 0x00, 0x00, // .)...'...A...|.. + 0x00, 0x2c, 0x01, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, // .,...y...C...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, // .=.......-...,.. + 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2e, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x1a, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x2d, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, // .........-...... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00, 0x46, 0x01, 0x00, 0x00, 0x2e, 0x01, 0x00, // ...../...F...... + 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // .........J...... + 0x00, 0x04, 0x00, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, // ...../.......... + 0x00, 0x4c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x4a, 0x01, 0x00, // .L...........J.. + 0x00, 0x5a, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x01, 0x00, // .Z...Q.......2.. + 0x00, 0x0a, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .........Q...... + 0x00, 0x33, 0x01, 0x00, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .3...L.......Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // .....4...L...... + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x35, 0x01, 0x00, 0x00, 0x4c, 0x01, 0x00, // .Q.......5...L.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, // .....P.......6.. + 0x00, 0x33, 0x01, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x35, 0x01, 0x00, 0x00, 0x32, 0x01, 0x00, // .3...4...5...2.. + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x36, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.......6...... + 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, // .8.....P. }; -static const uint8_t fs_texture_cube_dx9[535] = +static const uint8_t fs_texture_cube_dx9[779] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x03, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, 0x75, 0x5f, 0x6d, 0x74, // Color0......u_mt - 0x78, 0x14, 0x01, 0x00, 0x00, 0x03, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // x.......u_params - 0x12, 0x01, 0x03, 0x00, 0x01, 0x00, 0xdc, 0x01, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, // ................ - 0x37, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x03, // 7.CTAB.......... - 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0xa8, 0x00, // ................ - 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x64, 0x00, // ..X...........d. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, // ......t......... - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x02, 0x00, // ..|............. - 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ..............s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x00, // ..........u_mtx. - 0xab, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, // ..u_params...... - 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, // ..............ps - 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft ( - 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C - 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, // ompiler 10.1..Q. - 0x00, 0x05, 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, // .........@...... - 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .?.............. - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x03, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x04, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x55, 0xa0, 0x05, 0x00, // ............U... - 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe6, 0xa0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x0e, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x90, 0xa0, 0x04, 0x00, // ........U....... - 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // ................ - 0xf9, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ - 0xe4, 0xa0, 0x24, 0x00, 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, // ..$............. - 0x00, 0x02, 0x01, 0x00, 0x08, 0x80, 0x03, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, // .........._..... - 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ - 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x0e, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ - 0x01, 0x80, 0x03, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, // ................ - 0xe4, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, // ................ - 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, // _texColor0...... + 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x14, 0x01, 0x00, 0x00, 0x03, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // u_mtx.......u_pa + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x03, 0x00, 0x01, 0x00, 0xcc, 0x02, 0x00, 0x00, 0x00, 0x03, // rams............ + 0xff, 0xff, 0xfe, 0xff, 0x37, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0xaf, 0x00, // ....7.CTAB...... + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ + 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ......X......... + 0x02, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, // ..d.......t..... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, // ......|......... + 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x6d, 0x74, 0x78, 0x00, 0xab, 0xab, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, // mtx............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, // ......u_params.. + 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, // ..ps_3_0.Microso + 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, // ft (R) HLSL Shad + 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, // er Compiler 10.1 + 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x04, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // ..Q..........@.. + 0x80, 0xbf, 0x00, 0x00, 0x80, 0x3f, 0xcd, 0xcc, 0x0c, 0x40, 0x51, 0x00, 0x00, 0x05, 0x05, 0x00, // .....?...@Q..... + 0x0f, 0xa0, 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ../..>.......... + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x80, 0x01, 0x00, // ................ + 0xe4, 0x90, 0x04, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ........U....... + 0x03, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0xe6, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x0e, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x90, 0xa0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ....U........... + 0x07, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xf9, 0x80, 0x02, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x24, 0x00, // ..............$. + 0x00, 0x02, 0x01, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x08, 0x80, 0x03, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ......_......... + 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, // ................ + 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x8b, 0x0f, 0x00, // ............U... + 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, 0xaa, 0x8b, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, // ................ + 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x05, 0x00, 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x02, 0x00, // ................ + 0xe4, 0x80, 0x04, 0x00, 0xff, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, // ................ + 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x02, 0x80, 0x01, 0x00, 0x55, 0x80, 0x0e, 0x00, // ............U... + 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ + 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x02, 0x00, 0xe4, 0x81, 0x04, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x03, 0x00, 0xaa, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................ + 0xe4, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x03, 0x00, 0xff, 0xa0, 0x05, 0x00, // ................ + 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0f, 0x00, // ................ + 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, // ................ + 0x02, 0x80, 0x00, 0x00, 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, // ....U........... + 0xaa, 0x8b, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x05, 0x00, // ................ + 0x00, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, // ........U....... + 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... }; -static const uint8_t fs_texture_cube_dx11[810] = +static const uint8_t fs_texture_cube_dx11[1062] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x03, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x14, // ams.......u_mtx. - 0x00, 0x10, 0x00, 0x04, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // ......s_texColor - 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xec, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x2a, 0x10, // 0.........DXBC*. - 0xda, 0x86, 0x24, 0x10, 0x4f, 0x29, 0xc5, 0x7f, 0x19, 0xe1, 0xc7, 0x60, 0x89, 0xb4, 0x01, 0x00, // ..$.O).....`.... - 0x00, 0x00, 0xec, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, // ..........,..... - 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, // ......ISGNl..... - 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ......P......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......b......... - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x53, 0x56, // ..............SV - 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, // _POSITION.COLOR. - 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, // TEXCOORD..OSGN,. - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // .......... ..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, // ..SV_TARGET...SH - 0x44, 0x52, 0x10, 0x02, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x59, 0x00, // DR....@.......Y. - 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5a, 0x00, // ..F. .........Z. - 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, 0x00, 0x04, 0x00, 0x70, // ...`......X0...p - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, // ......UU..b..... - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, // ......b...2..... - 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, // ..e.... ......h. - 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0f, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2...2..... - 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, // ..F........@.... - 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // .@...@.........@ - 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, // ..8...2.......F. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // .......@.....?.. - 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xe2, 0x00, // ..........8..... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x89, // ......V......... - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, // .........2...r. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ......F. ....... - 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x07, 0x10, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ......r.......F. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ......F. ....... - 0x00, 0x00, 0x10, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..............F. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, // ......F.......D. - 0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........:..... - 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x0f, // ..8...r......... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, // ......F.......H. - 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..........F..... - 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..F~.......`.... - 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // .... .........8. - 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ..........F..... - 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x12, 0x00, // ..F............. - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......:. ....... - 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..8...r ......F. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ..............6. - 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, // ... ......:..... - 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x50, 0x00, // ..>.....P. + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x75, 0x5f, // _params.......u_ + 0x6d, 0x74, 0x78, 0x14, 0x00, 0x10, 0x00, 0x04, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // mtx.......s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xe4, 0x03, 0x00, 0x00, 0x44, 0x58, // olor0.........DX + 0x42, 0x43, 0xb0, 0x62, 0x27, 0x2c, 0xcd, 0x2b, 0x52, 0x62, 0x21, 0x09, 0x5c, 0x97, 0xe9, 0xc6, // BC.b',.+Rb!..... + 0x0d, 0x4f, 0x01, 0x00, 0x00, 0x00, 0xe4, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // .O............,. + 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ + 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, // ................ + 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO + 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS + 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. + 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x08, 0x03, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xc2, 0x00, // ..SHDR....@..... + 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, // ..Y...F. ....... + 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, // ..Z....`......X0 + 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. + 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, // ..........b...2. + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......e.... .... + 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0f, 0x32, 0x00, // ..h.......2...2. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....@...@...... + 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, // ...@............ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8...2..... + 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, // ..F........@.... + 0x80, 0x3f, 0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // .?............8. + 0x00, 0x08, 0xe2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x00, 0x00, 0x00, // ..........V..... + 0x00, 0x00, 0x06, 0x89, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, // .... .........2. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, // ..r.......F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x07, // ................ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x82, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ... + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..F.......F..... + 0x00, 0x00, 0x44, 0x00, 0x00, 0x05, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, // ..D...........:. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8...r..... + 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..H...........F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......` + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... + 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..8...........F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2f, 0x00, // ......F......./. + 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, // ..r.......F..... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, // ......6.... .... + 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, // ..:.......8...r. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, // ......F........@ + 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0x00, 0x00, // .....@...@...@.. + 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, // ......r.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, // ..F.......F..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, // ..F...A.......2. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, // ..r......... ... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ......F.......F. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // ..:. .........8. + 0x00, 0x07, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, // ..r............. + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, // ..F......./...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, // ......F......... + 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..8...r.......F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, // .......@../..>/. + 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x20, // .>/..>........r + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......F.......>. + 0x00, 0x01, 0x00, 0x00, 0x50, 0x00, // ....P. }; -static const uint8_t fs_texture_cube_mtl[1049] = +static const uint8_t fs_texture_cube_mtl[1167] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x04, // ams.......u_mtx. - 0x01, 0x00, 0x00, 0x01, 0x00, 0xef, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, // .........using n - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, // amespace metal;. - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // struct xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // aderInput {. fl - 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, // oat4 v_color0;. - 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float3 v_texcoo - 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // rd0;.};.struct x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, // latMtlShaderOutp - 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, // ut {. float4 gl - 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, // _FragColor;.};.s - 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // truct xlatMtlSha - 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, // derUniform {. f - 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, // loat4 u_params;. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x74, 0x78, // float4x4 u_mtx - 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, // ;.};.fragment xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, // t xlatMtlMain (x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, // latMtlShaderInpu - 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, // t _mtl_i [[stage - 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, // _in]], constant - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, // xlatMtlShaderUni - 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, // form& _mtl_u [[b - 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, // uffer(0)]]. , - 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x63, 0x75, 0x62, 0x65, 0x3c, 0x66, 0x6c, 0x6f, // texturecube s_texColor [ - 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, // [texture(0)]], s - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, // ampler _mtlsmp_s - 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, // _texColor [[samp - 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, // ler(0)]]).{. xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, // atMtlShaderOutpu - 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // t _mtl_o;. floa - 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, // t3 tmpvar_1 = 0; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, // . tmpvar_1.z = - 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // 1.0;. tmpvar_1. - 0x78, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, // xy = (((_mtl_i.v - 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, // _texcoord0.xy * - 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x66, 0x6c, // 2.0) - 1.0) * fl - 0x6f, 0x61, 0x74, 0x32, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x2d, 0x31, 0x2e, 0x30, 0x29, 0x29, // oat2(1.0, -1.0)) - 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ;. float4 tmpva - 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // r_2 = 0;. tmpva - 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // r_2.w = 0.0;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, // mpvar_2.xyz = tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // pvar_1;. float4 - 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // _color_3 = 0;. - 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, // _color_3 = (s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, // exColor.sample(_ - 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, // mtlsmp_s_texColo - 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, 0x6e, 0x6f, 0x72, 0x6d, // r, (float3)(norm - 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, // alize((_mtl_u.u_ - 0x6d, 0x74, 0x78, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, // mtx * tmpvar_2). - 0x78, 0x79, 0x7a, 0x29, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, // xyz)), level(_mt - 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, // l_u.u_params.x)) - 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // * _mtl_i.v_colo - 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, // r0);. float4 tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_4 = 0;. tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x63, // pvar_4.xyz = (_c - 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, 0x78, 0x70, // olor_3.xyz * exp - 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // 2(_mtl_u.u_param - 0x73, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // s.w));. tmpvar_ - 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x77, // 4.w = _color_3.w - 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr - 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar - 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // _4;. return _mt - 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x04, // FSH...........|. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, // ut {. float4 v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // color0;. float3 + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, // v_texcoord0;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, // haderOutput {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // float4 gl_FragCo + 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // lor;.};.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // orm {. float4 u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // _params;. float + 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, // 4x4 u_mtx;.};.fr + 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // agment xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // aderOutput xlatM + 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // tlMain (xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // haderInput _mtl_ + 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, // i [[stage_in]], + 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // constant xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, // ShaderUniform& _ + 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, // mtl_u [[buffer(0 + 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // )]]. , textur + 0x65, 0x63, 0x75, 0x62, 0x65, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, // ecube s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // exColor [[textur + 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, // e(0)]], sampler + 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // _mtlsmp_s_texCol + 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // or [[sampler(0)] + 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // ]).{. xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // aderOutput _mtl_ + 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, // o;. float3 tmpv + 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1 = 0;. tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, // ar_1.z = 1.0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x28, 0x28, // tmpvar_1.xy = (( + 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // (_mtl_i.v_texcoo + 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x2e, 0x30, 0x29, 0x20, 0x2d, 0x20, // rd0.xy * 2.0) - + 0x31, 0x2e, 0x30, 0x29, 0x20, 0x2a, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x31, 0x2e, // 1.0) * float2(1. + 0x30, 0x2c, 0x20, 0x2d, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // 0, -1.0));. flo + 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, // at4 tmpvar_2 = 0 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, // ;. tmpvar_2.w = + 0x20, 0x30, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // 0.0;. tmpvar_2 + 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // .xyz = tmpvar_1; + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // . float4 _color + 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _3 = 0;. _color + 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // _3 = (s_texColor + 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // .sample(_mtlsmp_ + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, // s_texColor, (flo + 0x61, 0x74, 0x33, 0x29, 0x28, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x28, 0x28, // at3)(normalize(( + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x74, 0x78, 0x20, 0x2a, 0x20, 0x74, // _mtl_u.u_mtx * t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x29, 0x2c, 0x20, // mpvar_2).xyz)), + 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, // level(_mtl_u.u_p + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, // arams.x)) * _mtl + 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, // _i.v_color0);. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, // float4 tmpvar_4 + 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, // = 0;. tmpvar_4. + 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, // xyz = pow (abs(( + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, // . mix (pow (a + 0x62, 0x73, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x29, // bs(_color_3.xyz) + 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, // , float3(2.2, 2. + 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // 2, 2.2)), _color + 0x5f, 0x33, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // _3.xyz, _mtl_u.u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, // _params.z). * + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // . exp2(_mtl_u + 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, // .u_params.w). ) + 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, // ), float3(0.4545 + 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, // 454, 0.4545454, + 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, // 0.4545454));. t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, // mpvar_4.w = _col + 0x6f, 0x72, 0x5f, 0x33, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // or_3.w;. _mtl_o + 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // .gl_FragColor = + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // tmpvar_4;. retu + 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... }; extern const uint8_t* fs_texture_cube_pssl; extern const uint32_t fs_texture_cube_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_cube.sc b/3rdparty/bgfx/tools/texturev/fs_texture_cube.sc index 33e4e06b1eb..091bffd5169 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_cube.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture_cube.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_cube2.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_cube2.bin.h index e1d11380236..0c7a950ce43 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_cube2.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture_cube2.bin.h @@ -1,430 +1,317 @@ -static const uint8_t fs_texture_cube2_glsl[473] = +static const uint8_t fs_texture_cube2_glsl[523] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xaa, 0x01, 0x00, 0x00, 0x76, 0x61, // olor..........va - 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // rying highp vec4 - 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, // v_color0;.varyi - 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, // ng highp vec3 v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // texcoord0;.unifo - 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, // rm highp vec4 u_ - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, // params;.uniform - 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, // lowp samplerCube - 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // s_texColor;.voi - 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6d, 0x65, // d main ().{. me - 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // diump vec4 tmpva - 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // r_1;. lowp vec4 - 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, // _color_2;. _co - 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, // lor_2 = (texture - 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // CubeLod (s_te - 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // xColor, v_texcoo - 0x72, 0x64, 0x30, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, // rd0, u_params.x) - 0x20, 0x2a, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, // * v_color0);. - 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // lowp vec4 tmpvar - 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x2e, 0x78, // _3;. tmpvar_3.x - 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, 0x78, // yz = (_color_2.x - 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // yz * exp2(u_para - 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ms.w));. tmpvar - 0x5f, 0x33, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x32, 0x2e, // _3.w = _color_2. - 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // w;. tmpvar_1 = - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, // tmpvar_3;. gl_F - 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ragColor = tmpva - 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // r_1;.}... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd8, 0x01, // texColor........ + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, // ..varying vec4 v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, // _color0;.varying + 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec3 v_texcoord + 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // 0;.uniform vec4 + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, // u_params;.unifor + 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x20, 0x73, 0x5f, // m samplerCube s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, // texColor;.void m + 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // ain ().{. vec4 + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, // _color_1;. _col + 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, // or_1 = (textureC + 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // ubeLod (s_texCol + 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2c, // or, v_texcoord0, + 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x20, 0x2a, 0x20, 0x76, // u_params.x) * v + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, // _color0);. vec4 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x70, 0x6f, 0x77, 0x20, // var_2.xyz = pow + 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x69, 0x78, 0x20, 0x28, // (abs((. mix ( + 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, // pow (abs(_color_ + 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x32, 0x2e, 0x32, // 1.xyz), vec3(2.2 + 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, // , 2.2, 2.2)), _c + 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, // olor_1.xyz, u_pa + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, // rams.z). * . + 0x20, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // exp2(u_params. + 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x33, 0x28, 0x30, 0x2e, // w). )), vec3(0. + 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, // 4545454, 0.45454 + 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, // 54, 0.4545454)); + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, // . tmpvar_2.w = + 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // _color_1.w;. gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, // _FragColor = tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // var_2;.}... }; -static const uint8_t fs_texture_cube2_spv[4402] = +static const uint8_t fs_texture_cube2_spv[1913] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x14, 0x11, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // .........Ta..... - 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... - 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .w...t.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x11, 0x00, 0xf4, 0x10, 0x00, 0x00, 0x62, 0x67, 0x66, // n............bgf - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x43, 0x75, 0x62, 0x65, 0x4c, 0x6f, 0x64, 0x28, // xTextureCubeLod( - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, // struct-BgfxSampl - 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x43, 0x31, 0x31, 0x3b, 0x76, // erCube-p1-tC11;v - 0x66, 0x33, 0x3b, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, // f3;f1;.......~.. - 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, // ._sampler.m_samp - 0x6c, 0x65, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, // ler.........._sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, // mpler.m_texture. - 0x00, 0x05, 0x00, 0x04, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, // ........._coord. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, // ........._level. - 0x00, 0x05, 0x00, 0x06, 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, // .....5...vec4_sp - 0x6c, 0x61, 0x74, 0x28, 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, // lat(f1;......... - 0x00, 0x5f, 0x78, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x74, 0x6f, 0x45, // ._x......e...toE - 0x76, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xa4, 0x11, 0x00, // v(vf4;.......... - 0x00, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, // ._color......... - 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, // .@main(vf4;vf3;v - 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x76, 0x5f, 0x63, // f4;.......>..v_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcb, 0x38, 0x00, // olor0.........8. - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0x02, 0x44, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // ..D..gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, // _0_......g...Bgf - 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, 0x00, 0x06, 0x00, 0x06, // xSamplerCube.... - 0x00, 0x67, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, // .g.......m_sampl - 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x67, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, // er.......g...... - 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // .m_texture...... - 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, // .....flattenTemp - 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .........s_texCo - 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, // lorSampler...... - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, // .....s_texColorT - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, // exture.......... - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, // .s_texColor.m_sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, // mpler........P.. - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, // .s_texColor.m_te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, // xture........1.. - 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // .$Global.....1.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, // .....u_viewRect. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .....1.......u_v - 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // iewTexel.....1.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_view..... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .1.......u_invVi - 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, // ew.......1...... - 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // .u_proj......1.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .....u_invProj.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .....1.......u_v - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x31, 0x06, 0x00, // iewProj......1.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // .....u_invViewPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, // oj.......1...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, // .u_model.....1.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // .....u_modelView - 0x00, 0x06, 0x00, 0x07, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .....1.......u_m - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, // odelViewProj.... - 0x00, 0x31, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, // .1.......u_alpha - 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x06, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0c, 0x00, 0x00, // Ref4.....1...... - 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, // .u_params....... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, // .B.............. - 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, // .bgfx_VoidFrag.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x13, 0x57, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......W..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x18, 0x0e, 0x00, 0x00, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, // .........color.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // .....JP..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x34, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // .....43..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x35, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // .....53..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // .....m3..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x07, 0x31, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......1..param.. - 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ......+..v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, // 0........w...v_c - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, // olor0.........<. - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, // .v_texcoord0.... - 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // .t...v_texcoord0 - 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // .........gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, // Data_0_.......U. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, // .param........8. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, // .param.......... - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, // .param.......... - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G......."...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.......!...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G......."...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.......!...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // .G...*.......@.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x01, 0x00, 0x00, // .....H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, // .#.......H...1.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#... ...H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .1.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...1.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x03, 0x00, 0x00, // .`...H...1...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .1.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...1.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x05, 0x00, 0x00, // .....H...1...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#... ...H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .1.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...1.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, // .`...H...1...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .1.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...1.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // .....H...1...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, // .........H...1.. - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0x31, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .1.............. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...1.......#.. - 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x31, 0x06, 0x00, 0x00, 0x0c, 0x00, 0x00, // . ...H...1...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x31, 0x06, 0x00, // .#...0...G...1.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, // .....G...B...".. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...w...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G...t...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, // .....G.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, // .............!.. - 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, // ................ - 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, // . ...y.......... - 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, // ......... ...... - 0x00, 0x98, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, // . .............. - 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, // . .............. - 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // . .............. - 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // ................ - 0x00, 0x21, 0x00, 0x07, 0x00, 0x74, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, // .!...t.......y.. - 0x00, 0x15, 0x03, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, // .............!.. - 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x04, // .............!.. - 0x00, 0x1f, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x06, // .............!.. - 0x00, 0x7d, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, // .}.............. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x67, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, // .........g...... - 0x00, 0x98, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... ...!...... - 0x00, 0x67, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // .g... ...z...... - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, // .....;...z...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ..... .......... - 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x16, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, // .....;.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // ..... ...{...... - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, // .....;...{...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, // ..... .......... - 0x00, 0x98, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, // .....;.......P.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, // .....+.......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x98, 0x00, 0x00, // ................ - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x40, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // @....e.......... - 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, // .+.......j... .. - 0x00, 0x1c, 0x00, 0x04, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, // .....*...e...j.. - 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x31, 0x06, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....1.......... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x2a, 0x07, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...*...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .e........... .. - 0x00, 0xae, 0x08, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x06, 0x00, 0x00, 0x3b, 0x00, 0x04, // .........1...;.. - 0x00, 0xae, 0x08, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .....B.......+.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // ...../.......+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....w....... .. - 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x96, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....t....... .. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. - 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................ - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x21, 0x00, 0x00, // .....Sa..;...!.. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .........;...... - 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, // ..U......;...... - 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..8......;...... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x98, 0x00, 0x00, // .!C......=...... - 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x67, 0x09, 0x00, // ..3......P...g.. - 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, // .^ ..!C...3..>.. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, // .....^ ..A...y.. - 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..V..........=.. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..........V..>.. - 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x15, 0x03, 0x00, // .........A...... - 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..@..........=.. - 0x00, 0x98, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..........@..>.. - 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // .P.......=...... - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, // ..+..w...=...... - 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, // ..<..t...>....U. - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, // ..+..>....8...<. - 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, // .9........&..... - 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, // ..U...8......=.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, // .............>.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .............8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x74, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, // .t...7...y...~.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x15, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...........7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, // .........7...... - 0x00, 0x2e, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, // .........._..=.. - 0x00, 0x98, 0x00, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, // .............=.. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, // .....!A..~...V.. - 0x00, 0xfe, 0x01, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, // .....`5......!A. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, // .=........"..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, 0x00, // .=........G..... - 0x00, 0x58, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, // .X.......(=..`5. - 0x00, 0x95, 0x22, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..".......G..... - 0x00, 0x28, 0x3d, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .(=..8...6...... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .5...........7.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xc6, 0x35, 0x00, // ..............5. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x29, 0x1a, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......)...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xb4, 0x42, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=........B..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......T-..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .=.......g-..... - 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0x31, 0x00, 0x00, 0x29, 0x1a, 0x00, // .P........1..).. - 0x00, 0xb4, 0x42, 0x00, 0x00, 0x54, 0x2d, 0x00, 0x00, 0x67, 0x2d, 0x00, 0x00, 0xfe, 0x00, 0x02, // ..B..T-..g-..... - 0x00, 0xee, 0x31, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..1..8...6...... - 0x00, 0x65, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x37, 0x00, 0x03, // .e...........7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xa4, 0x11, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x58, 0x2e, 0x00, // .............X.. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00, 0xa4, 0x11, 0x00, // .=.......@R..... - 0x00, 0x4f, 0x00, 0x08, 0x00, 0x18, 0x00, 0x00, 0x00, 0x16, 0x1c, 0x00, 0x00, 0x40, 0x52, 0x00, // .O...........@R. - 0x00, 0x40, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .@R............. - 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x6a, 0x55, 0x00, 0x00, 0x42, 0x13, 0x00, // .A.......jU..B.. - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ./.......=...... - 0x00, 0xdf, 0x51, 0x00, 0x00, 0x6a, 0x55, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, // ..Q..jU......... - 0x00, 0x54, 0x49, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, // .TI............. - 0x00, 0xdf, 0x51, 0x00, 0x00, 0x8e, 0x00, 0x05, 0x00, 0x18, 0x00, 0x00, 0x00, 0x91, 0x1e, 0x00, // ..Q............. - 0x00, 0x16, 0x1c, 0x00, 0x00, 0x54, 0x49, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, // .....TI..A...... - 0x00, 0x45, 0x47, 0x00, 0x00, 0xa4, 0x11, 0x00, 0x00, 0x13, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .EG..........=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x45, 0x47, 0x00, 0x00, 0x51, 0x00, 0x05, // .....?>..EG..Q.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x56, 0x44, 0x00, 0x00, 0x91, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, // .....VD......... - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0x91, 0x1e, 0x00, // .Q.......OT..... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf7, 0x23, 0x00, // .....Q........#. - 0x00, 0x91, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // .........P...... - 0x00, 0x1d, 0x54, 0x00, 0x00, 0x56, 0x44, 0x00, 0x00, 0x4f, 0x54, 0x00, 0x00, 0xf7, 0x23, 0x00, // ..T..VD..OT...#. - 0x00, 0x3f, 0x3e, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x1d, 0x54, 0x00, 0x00, 0x38, 0x00, 0x01, // .?>.......T..8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0x7d, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x08, 0x3e, 0x00, // .}...7........>. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........8..7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x02, 0x44, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0xf0, 0x1b, 0x00, // ......D......... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x13, 0x57, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........W..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x07, 0x00, 0x00, // .;...y...JP..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x34, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......43..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x35, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......53..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.......m3..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........1..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x13, 0x57, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, // .>....W......9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x13, 0x57, 0x00, // .........5....W. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xd2, 0x53, 0x00, 0x00, 0x14, 0x11, 0x00, // .=........S..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x4a, 0x50, 0x00, 0x00, 0xd2, 0x53, 0x00, 0x00, 0x3d, 0x00, 0x04, // .>...JP...S..=.. - 0x00, 0x98, 0x00, 0x00, 0x00, 0xf9, 0x25, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......%..P...>.. - 0x00, 0x34, 0x33, 0x00, 0x00, 0xf9, 0x25, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, // .43...%..=...... - 0x00, 0x45, 0x26, 0x00, 0x00, 0xcb, 0x38, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x35, 0x33, 0x00, // .E&...8..>...53. - 0x00, 0x45, 0x26, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, 0x00, 0xb3, 0x3b, 0x00, // .E&..A........;. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .B.../.......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0xb3, 0x3b, 0x00, 0x00, 0x3e, 0x00, 0x03, // .....L....;..>.. - 0x00, 0x6d, 0x33, 0x00, 0x00, 0x4c, 0x19, 0x00, 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, // .m3..L...9...... - 0x00, 0x18, 0x0e, 0x00, 0x00, 0xf4, 0x10, 0x00, 0x00, 0x4a, 0x50, 0x00, 0x00, 0x34, 0x33, 0x00, // .........JP..43. - 0x00, 0x35, 0x33, 0x00, 0x00, 0x6d, 0x33, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // .53..m3..=...... - 0x00, 0xea, 0x23, 0x00, 0x00, 0x08, 0x3e, 0x00, 0x00, 0x85, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..#...>......... - 0x00, 0x25, 0x1f, 0x00, 0x00, 0x18, 0x0e, 0x00, 0x00, 0xea, 0x23, 0x00, 0x00, 0x3e, 0x00, 0x03, // .%........#..>.. - 0x00, 0x07, 0x31, 0x00, 0x00, 0x25, 0x1f, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..1..%...9...... - 0x00, 0x84, 0x51, 0x00, 0x00, 0x65, 0x0c, 0x00, 0x00, 0x07, 0x31, 0x00, 0x00, 0x3e, 0x00, 0x03, // ..Q..e....1..>.. - 0x00, 0x02, 0x44, 0x00, 0x00, 0x84, 0x51, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // ..D...Q......8.. - 0x00, 0x00, // .. + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x54, 0x07, 0x00, // _params......T.. + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x2d, 0x01, 0x00, // ...#.........-.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, // n............... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // .main........... + 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x43, 0x75, 0x62, 0x65, // .BgfxSamplerCube + 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, // .............m_s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // ampler.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // .....m_texture.. + 0x00, 0x05, 0x00, 0x05, 0x00, 0x36, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....6...s_texCo + 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x38, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // lor......8...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // exColorSampler.. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....;...s_texCo + 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // lorTexture...... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .v...$Global.... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // .v.......u_param + 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // s........x...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0xab, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .........v_color + 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xba, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...;...!...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...v.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...v...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x78, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...x..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xba, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .5...........;.. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .5...6....... .. + 0x00, 0x37, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .7...........;.. + 0x00, 0x37, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .7...8....... .. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .:...........;.. + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .:...;.......... + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .>... .......+.. + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, // .>...C.......... + 0x00, 0x47, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .G.......+...... + 0x00, 0x63, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x0c, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .c......@+...... + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x1e, 0x00, 0x03, 0x00, 0x76, 0x00, 0x00, // .k.../..>....v.. + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...w...... + 0x00, 0x76, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x77, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // .v...;...w...x.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // .........y... .. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, // .....+...y...z.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... ...{...... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, // .....+.......... + 0x00, 0x00, 0x00, 0x00, 0x40, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, // ....@+...y...... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x79, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .....+...y...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xaa, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xae, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xae, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, // .....;.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xb9, 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, // .....;.......... + 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2b, 0x01, 0x00, // .....,.......+.. + 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x06, // .c...c...c...,.. + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, // .....,...k...k.. + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .k...6.......... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, // ................ + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, // .=.......9...8.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, // .=.......<...;.. + 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, // .P.......=...9.. + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x36, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, // .<...>...6...=.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, // .=.............. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, // .=.............. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .=...........6.. + 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0xd6, 0x00, 0x00, // .Q.......'...... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, // .....Q.......(.. + 0x00, 0xd6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, // .........A...{.. + 0x00, 0xd8, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, // .....x...C...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, // .=.............. + 0x00, 0x56, 0x00, 0x05, 0x00, 0x47, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, // .V...G.......(.. + 0x00, 0x27, 0x01, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, // .'...X.......... + 0x00, 0xea, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, // ................ + 0x00, 0x85, 0x00, 0x05, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, // ................ + 0x00, 0xac, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x00, // .....O.......... + 0x00, 0xdd, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x01, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, // ................ + 0x00, 0x0d, 0x01, 0x00, 0x00, 0x2b, 0x01, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, // .....+...A...{.. + 0x00, 0xf8, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, // .....x...C...z.. + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, // .=.............. + 0x00, 0x50, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, // .P.............. + 0x00, 0xf9, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, // .........O...... + 0x00, 0xfc, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x19, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x0f, 0x01, 0x00, // ................ + 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x7b, 0x00, 0x00, // .........A...{.. + 0x00, 0xff, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, // .....x...C...... + 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, // .=.............. + 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x1a, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x8e, 0x00, 0x05, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x19, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x06, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, // ................ + 0x00, 0x1f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1d, 0x01, 0x00, // ................ + 0x00, 0x2c, 0x01, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, // .,...Q.......... + 0x00, 0xdd, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .........Q...... + 0x00, 0x06, 0x01, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x1f, 0x01, 0x00, // .Q.............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, // .....P.......... + 0x00, 0x06, 0x01, 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, // ................ + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xba, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.............. + 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // .8....... }; -static const uint8_t fs_texture_cube2_dx9[367] = +static const uint8_t fs_texture_cube2_dx9[611] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color0......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x03, // rams......@..... - 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x83, 0x00, // ....,.CTAB...... - 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ..|...D......... - 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..P.......`..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ......l.......s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ..........u_para - 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, // ms.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......ps_3_0.Mic - 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // 10.1............ - 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x07, 0x90, 0x1f, 0x00, // ................ - 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x07, 0x80, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ - 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, // .._............. - 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, // ................ - 0xe4, 0x90, 0x0e, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, // ................ - 0x00, 0x03, 0x00, 0x08, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, // ................ - 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x00, 0x00, 0xff, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, // _texColor0...... + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x30, 0x02, // u_params......0. + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........,.CTAB.. + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, // ......|...D..... + 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, // ......P.......`. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........l..... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0e, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // params.......... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, // ..........ps_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, // ler 10.1..Q..... + 0x0f, 0xa0, 0xcd, 0xcc, 0x0c, 0x40, 0x2f, 0xba, 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .....@/..>...... + 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................ + 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x01, 0x00, 0x07, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x98, 0x00, 0x08, 0x0f, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, // ................ + 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, // .............._. + 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x05, 0x00, // ................ + 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x0f, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, // ................ + 0x02, 0x80, 0x01, 0x00, 0x55, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, // ....U........... + 0xaa, 0x8b, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x08, 0x80, 0x01, 0x00, 0xff, 0x80, 0x05, 0x00, // ................ + 0x00, 0x03, 0x01, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0xa0, 0x0e, 0x00, // ................ + 0x00, 0x02, 0x02, 0x00, 0x01, 0x80, 0x01, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, // ................ + 0x02, 0x80, 0x01, 0x00, 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x80, 0x01, 0x00, // ....U........... + 0xaa, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x00, // ................ + 0xe4, 0x90, 0x02, 0x00, 0xe4, 0x81, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ................ + 0xaa, 0xa0, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x08, 0x80, 0x00, 0x00, 0xff, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, // ................ + 0xff, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, // ................ + 0x00, 0x8b, 0x0f, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x8b, 0x0f, 0x00, // ............U... + 0x00, 0x02, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x55, 0xa0, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, // ........U....... + 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x02, 0x80, 0x00, 0x00, // ................ + 0x55, 0x80, 0x0e, 0x00, 0x00, 0x02, 0x00, 0x08, 0x04, 0x80, 0x00, 0x00, 0xaa, 0x80, 0xff, 0xff, // U............... + 0x00, 0x00, 0x00, // ... }; -static const uint8_t fs_texture_cube2_dx11[518] = +static const uint8_t fs_texture_cube2_dx11[770] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x44, 0x58, // olor0.........DX - 0x42, 0x43, 0xfc, 0xf2, 0xa1, 0xb7, 0xc5, 0x09, 0xb3, 0x83, 0x63, 0x68, 0xd6, 0xf3, 0x54, 0x14, // BC........ch..T. - 0xd1, 0xbc, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..............,. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO - 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xf8, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x3e, 0x00, // ..SHDR....@...>. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x30, // ..Z....`......X0 - 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. - 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x72, 0x10, // ..........b...r. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ......e.... .... - 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x12, 0x00, // ..h............. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......:. ....... - 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x12, // ..H...........F. - 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......` - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... - 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..8...........F. - 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, // ......F.......8. - 0x00, 0x07, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, // ..r ............ - 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, // ..F.......6.... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, // ......:.......>. - 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ...... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xcc, 0x02, // texColor0....... + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x32, 0x0d, 0xe1, 0x0b, 0xad, 0x35, 0x1f, 0xb7, 0x80, 0x3e, // ..DXBC2....5...> + 0xa3, 0x13, 0x8a, 0x22, 0xfa, 0x7a, 0x01, 0x00, 0x00, 0x00, 0xcc, 0x02, 0x00, 0x00, 0x03, 0x00, // ...".z.......... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, // ..........SV_TAR + 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xf0, 0x01, 0x00, 0x00, 0x40, 0x00, // GET...SHDR....@. + 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..|...Y...F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ......Z....`.... + 0x00, 0x00, 0x58, 0x30, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X0...p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, // ..b...........b. + 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..r.......e.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x48, 0x00, // ......h.......H. + 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x02, 0x00, // ..........F..... + 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..F~.......`.... + 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // .... .........8. + 0x00, 0x07, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, // ..........F..... + 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, // ..F......./...r. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x01, 0x00, // ......F......... + 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, // ..6.... ......:. + 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, // ......8...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0xcd, 0xcc, // ..F........@.... + 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0xcd, 0xcc, 0x0c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, // .@...@...@...... + 0x00, 0x05, 0x72, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..r.......F..... + 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..2...r.......F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x02, // ......F.......F. + 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0x72, 0x00, // ..A.......2...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x01, 0x00, // ..F.......F..... + 0x00, 0x00, 0x19, 0x00, 0x00, 0x06, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, // ..............:. + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0x72, 0x00, // .........8...r. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, // ..............F. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x06, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, // ....../...r..... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // ..F...........8. + 0x00, 0x0a, 0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, // ..r.......F..... + 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, 0xe8, 0x3e, 0x2f, 0xba, // ...@../..>/..>/. + 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, // .>........r .... + 0x00, 0x00, 0x46, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, // ..F.......>..... + 0x10, 0x00, // .. }; -static const uint8_t fs_texture_cube2_mtl[807] = +static const uint8_t fs_texture_cube2_mtl[937] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, // ams..........usi - 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met - 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // float4 v_color - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, // 0;. float3 v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, // xcoord0;.};.stru - 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // ct xlatMtlShader - 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // Output {. float - 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, // 4 gl_FragColor;. - 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // };.struct xlatMt - 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, // lShaderUniform { - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // . float4 u_para - 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, // ms;.};.fragment - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, // put xlatMtlMain - 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, // (xlatMtlShaderIn - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, // put _mtl_i [[sta - 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, // ge_in]], constan - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, // t xlatMtlShaderU - 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, // niform& _mtl_u [ - 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, // [buffer(0)]]. , - 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x63, 0x75, 0x62, 0x65, 0x3c, 0x66, // texturecube s_texColor - 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, // [[texture(0)]], - 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, // sampler _mtlsmp - 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, // _s_texColor [[sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // mpler(0)]]).{. - 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // put _mtl_o;. fl - 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // oat4 _color_1 = - 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 0;. _color_1 = - 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, // (s_texColor.samp - 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, // le(_mtlsmp_s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x29, 0x28, // Color, (float3)( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // _mtl_i.v_texcoor - 0x64, 0x30, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // d0), level(_mtl_ - 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2a, // u.u_params.x)) * - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_i.v_color0 - 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, // );. float4 tmpv - 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_2 = 0;. tmpv - 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x63, 0x6f, 0x6c, // ar_2.xyz = (_col - 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x2a, 0x20, 0x65, 0x78, 0x70, 0x32, 0x28, // or_1.xyz * exp2( + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x03, // FSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, // ut {. float4 v_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, // color0;. float3 + 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, // v_texcoord0;.}; + 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, // .struct xlatMtlS + 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, // haderOutput {. + 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, // float4 gl_FragCo + 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, // lor;.};.struct x + 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif + 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, // orm {. float4 u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, // _params;.};.frag + 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ment xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // erOutput xlatMtl + 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, // Main (xlatMtlSha + 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, // derInput _mtl_i + 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, // [[stage_in]], co + 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // nstant xlatMtlSh + 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, // aderUniform& _mt + 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, // l_u [[buffer(0)] + 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x63, // ]. , texturec + 0x75, 0x62, 0x65, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, // ube s_tex + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, // Color [[texture( + 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, // 0)]], sampler _m + 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // tlsmp_s_texColor + 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, // [[sampler(0)]]) + 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // .{. xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // erOutput _mtl_o; + 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // . float4 _color + 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // _1 = 0;. _color + 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // _1 = (s_texColor + 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, // .sample(_mtlsmp_ + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, // s_texColor, (flo + 0x61, 0x74, 0x33, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, // at3)(_mtl_i.v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, // xcoord0), level( 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, // _mtl_u.u_params. - 0x77, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, // w));. tmpvar_2. - 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x3b, 0x0a, // w = _color_1.w;. - 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // _mtl_o.gl_Frag - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // Color = tmpvar_2 - 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ;. return _mtl_ - 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // o;.}... + 0x78, 0x29, 0x29, 0x20, 0x2a, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x63, // x)) * _mtl_i.v_c + 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // olor0);. float4 + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, // tmpvar_2 = 0;. + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, // tmpvar_2.xyz = + 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, // pow (abs((. m + 0x69, 0x78, 0x20, 0x28, 0x70, 0x6f, 0x77, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x5f, 0x63, 0x6f, // ix (pow (abs(_co + 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, 0x61, // lor_1.xyz), floa + 0x74, 0x33, 0x28, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, 0x2c, 0x20, 0x32, 0x2e, 0x32, // t3(2.2, 2.2, 2.2 + 0x29, 0x29, 0x2c, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, // )), _color_1.xyz + 0x2c, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // , _mtl_u.u_param + 0x73, 0x2e, 0x7a, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x65, // s.z). * . e + 0x78, 0x70, 0x32, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, // xp2(_mtl_u.u_par + 0x61, 0x6d, 0x73, 0x2e, 0x77, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x66, 0x6c, 0x6f, // ams.w). )), flo + 0x61, 0x74, 0x33, 0x28, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, // at3(0.4545454, 0 + 0x2e, 0x34, 0x35, 0x34, 0x35, 0x34, 0x35, 0x34, 0x2c, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x34, 0x35, // .4545454, 0.4545 + 0x34, 0x35, 0x34, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 454));. tmpvar_ + 0x32, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x5f, 0x31, 0x2e, 0x77, // 2.w = _color_1.w + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, // ;. _mtl_o.gl_Fr + 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // agColor = tmpvar + 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // _2;. return _mt + 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... }; extern const uint8_t* fs_texture_cube2_pssl; extern const uint32_t fs_texture_cube2_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_cube2.sc b/3rdparty/bgfx/tools/texturev/fs_texture_cube2.sc index 411834f4302..df1521f0ba1 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_cube2.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture_cube2.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_msdf.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_msdf.bin.h index 1cb252812ae..aeccab82506 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_msdf.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture_msdf.bin.h @@ -1,508 +1,292 @@ -static const uint8_t fs_texture_msdf_glsl[598] = +static const uint8_t fs_texture_msdf_glsl[483] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x27, 0x02, 0x00, 0x00, 0x76, 0x61, // olor......'...va - 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, // rying highp vec3 - 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, // v_texcoord0;.un - 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // iform highp vec4 - 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // u_params;.unifo - 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, // rm sampler2D s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // exColor;.void ma - 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, // in ().{. lowp v - 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // ec3 tmpvar_1;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, // tmpvar_1 = textu - 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // re2DLod (s_te + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0xb0, 0x01, // texColor........ + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, // ..varying vec3 v + 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // _texcoord0;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // orm vec4 u_param + 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s;.uniform sampl + 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, // er2D s_texColor; + 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{. + 0x20, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // vec3 tmpvar_1; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x65, // . tmpvar_1 = te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // xture2DLod (s_te 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // xColor, v_texcoo 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // rd0.xy, u_params - 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, // .x).xyz;. lowp - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, // float tmpvar_2;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x61, // tmpvar_2 = (ma - 0x78, 0x20, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // x (min (tmpvar_1 - 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x2c, // .x, tmpvar_1.y), - 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, // min (. max ( - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_1.x, tmpv - 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, // ar_1.y). , tmpv - 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x29, 0x29, 0x20, 0x2d, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x3b, // ar_1.z)) - 0.5); - 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, // . lowp float tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // pvar_3;. tmpvar - 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, // _3 = clamp (((tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x2f, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x61, // pvar_2 / . (a - 0x62, 0x73, 0x28, 0x64, 0x46, 0x64, 0x78, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, // bs(dFdx(tmpvar_2 - 0x29, 0x29, 0x20, 0x2b, 0x20, 0x61, 0x62, 0x73, 0x28, 0x64, 0x46, 0x64, 0x79, 0x28, 0x74, 0x6d, // )) + abs(dFdy(tm - 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, // pvar_2))). ) + - 0x30, 0x2e, 0x35, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, // 0.5), 0.0, 1.0); - 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, // . mediump vec4 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, // tmpvar_4;. tmpv - 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x74, 0x6d, 0x70, 0x76, // ar_4 = vec4(tmpv - 0x61, 0x72, 0x5f, 0x33, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // ar_3);. gl_Frag - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // Color = tmpvar_4 - 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // ;.}... + 0x2e, 0x78, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // .x).xyz;. float + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x6d, 0x69, // var_2 = (max (mi + 0x6e, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x2c, 0x20, 0x74, // n (tmpvar_1.x, t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x2c, 0x20, 0x6d, 0x69, 0x6e, 0x20, // mpvar_1.y), min + 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // (. max (tmpva + 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // r_1.x, tmpvar_1. + 0x79, 0x29, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // y). , tmpvar_1. + 0x7a, 0x29, 0x29, 0x20, 0x2d, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // z)) - 0.5);. gl + 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, // _FragColor = vec + 0x34, 0x28, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // 4(clamp (((tmpva + 0x72, 0x5f, 0x32, 0x20, 0x2f, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, // r_2 / . (abs( + 0x64, 0x46, 0x64, 0x78, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x20, // dFdx(tmpvar_2)) + 0x2b, 0x20, 0x61, 0x62, 0x73, 0x28, 0x64, 0x46, 0x64, 0x79, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, // + abs(dFdy(tmpva + 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, // r_2))). ) + 0.5 + 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x7d, // ), 0.0, 1.0));.} + 0x0a, 0x0a, 0x00, // ... }; -static const uint8_t fs_texture_msdf_spv[5178] = +static const uint8_t fs_texture_msdf_spv[1817] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x14, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x53, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // .........Sb..... - 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... - 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .w...t.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0xce, 0x14, 0x00, 0x00, 0x62, 0x67, 0x66, // n............bgf - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, // xTexture2DLod(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x66, // 2D-p1-t211;vf2;f - 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, // 1;.......~..._sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // mpler.m_sampler. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ........._sample - 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, // r.m_texture..... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, // ....._coord..... - 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x07, // ....._level..... - 0x00, 0xd2, 0x0c, 0x00, 0x00, 0x6d, 0x69, 0x78, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, // .....mix(vf4;vf4 - 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, 0x00, // ;vf4;........... - 0x00, 0x5f, 0x61, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, 0x00, // ._a.........._b. - 0x00, 0x05, 0x00, 0x03, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x5f, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, // ........._t..... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x05, 0x00, 0xee, 0x0b, 0x00, 0x00, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x6e, 0x28, // .........median( - 0x76, 0x66, 0x33, 0x3b, 0x00, 0x05, 0x00, 0x04, 0x00, 0xd0, 0x0f, 0x00, 0x00, 0x5f, 0x76, 0x61, // vf3;........._va - 0x6c, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, // l............@ma - 0x69, 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, // in(vf4;vf3;vf4;. - 0x00, 0x05, 0x00, 0x05, 0x00, 0x61, 0x58, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....aX..v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xcd, 0x48, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........H..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x97, 0x3e, 0x00, // excoord0......>. - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, // .....a...BgfxSam - 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, // pler2D.......a.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // .....m_sampler.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, // .....a.......m_t - 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, // exture.......... - 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, // .flattenTemp.... - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, // .....s_texColorS - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, // ampler.......... - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, // .s_texColorTextu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, // re...........s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // exColor.m_sample - 0x72, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, // r........P...s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, // exColor.m_textur - 0x65, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, // e............bgf - 0x78, 0x5f, 0x56, 0x6f, 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // x_VoidFrag...... - 0x00, 0xa8, 0x51, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..Q..param...... - 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x62, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x05, 0x00, 0x04, // .z...bgColor.... - 0x00, 0x04, 0x05, 0x00, 0x00, 0x66, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x05, 0x00, 0x04, // .....fgColor.... - 0x00, 0xb0, 0x16, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, // .....sample..... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .]...$Global.... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, // .].......u_viewR - 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, // ect......]...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, // .u_viewTexel.... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, // .].......u_view. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, // .....].......u_i - 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // nvView.......].. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_proj..... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, // .].......u_invPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, // oj.......]...... - 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, // .u_viewProj..... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .].......u_invVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // ewProj.......].. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, // .....u_model.... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // .].......u_model - 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, // View.....]...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, // .u_modelViewProj - 0x00, 0x06, 0x00, 0x06, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, // .....].......u_a - 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5d, 0x0a, 0x00, // lphaRef4.....].. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, // .....u_params... - 0x00, 0x05, 0x00, 0x03, 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....B.......... - 0x00, 0xdf, 0x4a, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..J..param...... - 0x00, 0xc9, 0x2d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..-..param...... - 0x00, 0xca, 0x2d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..-..param...... - 0x00, 0xcb, 0x2d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..-..param...... - 0x00, 0xbd, 0x0e, 0x00, 0x00, 0x73, 0x69, 0x67, 0x44, 0x69, 0x73, 0x74, 0x00, 0x05, 0x00, 0x04, // .....sigDist.... - 0x00, 0xcc, 0x2d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..-..param...... - 0x00, 0x69, 0x0e, 0x00, 0x00, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x00, 0x05, 0x00, 0x04, // .i...opacity.... - 0x00, 0xcd, 0x2d, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // ..-..param...... - 0x00, 0x02, 0x2e, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // .....param...... - 0x00, 0x9c, 0x2b, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // ..+..param...... - 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..+..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .....w...v_color - 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0.........<..v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, // excoord0.....t.. - 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, // .v_texcoord0.... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // .....gl_FragData - 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, // _0_.......U..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, // am........8..par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, // am...........par - 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // am...........gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, // FragData_0_..G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....".......G.. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .....!.......G.. - 0x00, 0xef, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .........@...H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .].......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...].......#.. - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H...]...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .....H...]...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // .#... ...H...].. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .]...........H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, // .].......#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...].......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...]...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...]...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // .#.......H...].. - 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .]...........H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, // .].......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...].......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H...]...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x06, 0x00, 0x00, // .....H...]...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // .#... ...H...].. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .]...........H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, // .].......#...`.. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...].......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...]...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...]...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // .#.......H...].. - 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, // .............H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .]...........H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, // .].......#...... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // .H...].......... - 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...]...... - 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...]...... - 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, // .#.......H...].. - 0x00, 0x0a, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .............H.. - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, // .].......#... .. - 0x00, 0x48, 0x00, 0x05, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...].......#.. - 0x00, 0x30, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, // .0...G...]...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...B..."...... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...w.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G...t.......... - 0x00, 0x47, 0x00, 0x04, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. - 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, // .........!...... - 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, // .y.............. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x13, 0x03, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x13, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x90, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, // .............!.. - 0x00, 0x53, 0x0b, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, // .S.......y...... - 0x00, 0x90, 0x02, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0xbb, 0x00, 0x00, // .........!...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, // ................ - 0x00, 0x21, 0x00, 0x04, 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, // .!.............. - 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, // . .............. - 0x00, 0x21, 0x00, 0x04, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x95, 0x02, 0x00, // .!.............. - 0x00, 0x21, 0x00, 0x06, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, // .!...}.......... - 0x00, 0x95, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, // .............a.. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, // .....a... ...z.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, // .........;...z.. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, // ......... ...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, // .........;...... - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, // ......... ...{.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, // .........;...{.. - 0x00, 0x14, 0x11, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // . .......+...... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, // ......... ...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, // .........;...... - 0x00, 0x50, 0x13, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .P.......+...... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, // ................ - 0x00, 0x96, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x0a, 0x00, // .....+.......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x00, // .....+.......... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7a, 0x0b, 0x00, // .....,.......z.. - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, // ................ - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, // .+.............. - 0x3f, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, // ?,.............. - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, // ................ - 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .e...........+.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, // .....j... ...... - 0x00, 0xef, 0x09, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, // .....e...j...... - 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .]...........e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0xef, 0x09, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e.......e...e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x17, 0x01, 0x00, // ......... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x5d, 0x0a, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x17, 0x01, 0x00, // .....]...;...... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, // .B.......+...... - 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, // ./....... ...... - 0x00, 0x02, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .........+...... - 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // ........? ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, // .........;...... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .w....... ...... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, // .........;...... - 0x00, 0x74, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .t....... ...... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, // .........;...... - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // .........6...... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, // ................ - 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, // .Sa..;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, // .....;........U. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, // .....;........8. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, // .....;.......... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, // .....=.......!C. - 0x00, 0xb2, 0x0c, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, // .....=........3. - 0x00, 0xee, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, // .....P...a...^ . - 0x00, 0x21, 0x43, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, // .!C...3..>...... - 0x00, 0x5e, 0x20, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, // .^ ..A...y....V. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, // ......V..>...... - 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, // .....A........@. - 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, // .........=...... - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, // ......@..>...P.. - 0x00, 0xd3, 0x1e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .....=........+. - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, // .w...=........<. - 0x00, 0x74, 0x14, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, // .t...>....U...+. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....8...<..9.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, // ......&.......U. - 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ..8......=...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, // .........>...... - 0x00, 0xce, 0x1c, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .........8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x0b, 0x00, // .............S.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...y...~...7.. - 0x00, 0x13, 0x03, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, // .........7...... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, // ......_..=...... - 0x00, 0x9c, 0x5c, 0x00, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .........=...... - 0x00, 0x21, 0x41, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, // .!A..~...V...... - 0x00, 0x60, 0x35, 0x00, 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, // .`5......!A..=.. - 0x00, 0x13, 0x00, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, // ......"......=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, // ......G......X.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, // .....(=..`5...". - 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, // ......G......(=. - 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd2, 0x0c, 0x00, // .8...6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .........7...... - 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc7, 0x0e, 0x00, // .....7.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. - 0x00, 0x6d, 0x51, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x48, 0x1b, 0x00, // .mQ..=.......H.. - 0x00, 0xc6, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5e, 0x40, 0x00, // .....=.......^@. - 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x3f, 0x00, // .....=.......e?. - 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5a, 0x42, 0x00, // .............ZB. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x48, 0x1b, 0x00, 0x00, 0x5e, 0x40, 0x00, // .........H...^@. - 0x00, 0x65, 0x3f, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x5a, 0x42, 0x00, 0x00, 0x38, 0x00, 0x01, // .e?......ZB..8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.......5...... - 0x00, 0xef, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0xb1, 0x24, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ......$..=...... - 0x00, 0x75, 0x56, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .uV......=...... - 0x00, 0xba, 0x4d, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // ..M......=...... - 0x00, 0x5a, 0x38, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .Z8......=...... - 0x00, 0x6d, 0x38, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // .m8......P...... - 0x00, 0xd9, 0x20, 0x00, 0x00, 0x75, 0x56, 0x00, 0x00, 0xba, 0x4d, 0x00, 0x00, 0x5a, 0x38, 0x00, // .. ..uV...M..Z8. - 0x00, 0x6d, 0x38, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0xd9, 0x20, 0x00, 0x00, 0x38, 0x00, 0x01, // .m8....... ..8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xee, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0xf0, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0xd0, 0x0f, 0x00, // .....7.......... - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x50, 0x3a, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, // .....P:..A...... - 0x00, 0x7a, 0x23, 0x00, 0x00, 0xd0, 0x0f, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, // .z#..........=.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x27, 0x30, 0x00, 0x00, 0x7a, 0x23, 0x00, 0x00, 0x41, 0x00, 0x05, // .....'0..z#..A.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x0c, 0x3e, 0x00, 0x00, 0xd0, 0x0f, 0x00, 0x00, 0x0d, 0x0a, 0x00, // ......>......... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x88, 0x5b, 0x00, 0x00, 0x0c, 0x3e, 0x00, // .=........[...>. - 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xab, 0x1e, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x25, 0x00, 0x00, 0x00, 0x27, 0x30, 0x00, 0x00, 0x88, 0x5b, 0x00, 0x00, 0x41, 0x00, 0x05, // .%...'0...[..A.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x96, 0x2d, 0x00, 0x00, 0xd0, 0x0f, 0x00, 0x00, 0x0a, 0x0a, 0x00, // ......-......... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x41, 0x33, 0x00, 0x00, 0x96, 0x2d, 0x00, // .=.......A3...-. - 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x0f, 0x3e, 0x00, 0x00, 0xd0, 0x0f, 0x00, // .A........>..... - 0x00, 0x0d, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xd2, 0x47, 0x00, // .....=........G. - 0x00, 0x0f, 0x3e, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfa, 0x52, 0x00, // ..>...........R. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x41, 0x33, 0x00, 0x00, 0xd2, 0x47, 0x00, // .....(...A3...G. - 0x00, 0x41, 0x00, 0x05, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x90, 0x28, 0x00, 0x00, 0xd0, 0x0f, 0x00, // .A........(..... - 0x00, 0x10, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0d, 0x38, 0x00, // .....=........8. - 0x00, 0x90, 0x28, 0x00, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x26, 0x5b, 0x00, // ..(..........&[. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0xfa, 0x52, 0x00, 0x00, 0x0d, 0x38, 0x00, // .....%....R...8. - 0x00, 0x0c, 0x00, 0x07, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x14, 0x5a, 0x00, 0x00, 0x01, 0x00, 0x00, // ..........Z..... - 0x00, 0x28, 0x00, 0x00, 0x00, 0xab, 0x1e, 0x00, 0x00, 0x26, 0x5b, 0x00, 0x00, 0xfe, 0x00, 0x02, // .(.......&[..... - 0x00, 0x14, 0x5a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, // ..Z..8...6...... - 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, // .........}...7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x61, 0x58, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, // .....aX..7...... - 0x00, 0xcd, 0x48, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x97, 0x3e, 0x00, // ..H..7........>. - 0x00, 0xf8, 0x00, 0x02, 0x00, 0x04, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ......a..;...... - 0x00, 0xa8, 0x51, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, // ..Q......;...y.. - 0x00, 0xdf, 0x4a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, // ..J......;...... - 0x00, 0xc9, 0x2d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, // ..-......;...... - 0x00, 0xca, 0x2d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ..-......;...... - 0x00, 0xcb, 0x2d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, // ..-......;...... - 0x00, 0xcc, 0x2d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..-......;...... - 0x00, 0xcd, 0x2d, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // ..-......;...... - 0x00, 0x02, 0x2e, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, // .........;...... - 0x00, 0x9c, 0x2b, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa8, 0x51, 0x00, // ..+......>....Q. - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, // .....9.......... - 0x00, 0x35, 0x13, 0x00, 0x00, 0xa8, 0x51, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, // .5....Q..=...... - 0x00, 0x67, 0x4e, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xdf, 0x4a, 0x00, // .gN......>....J. - 0x00, 0x67, 0x4e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x8e, 0x20, 0x00, // .gN..=........ . - 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xc9, 0x2d, 0x00, 0x00, 0x8e, 0x20, 0x00, // .P...>....-... . - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0xa3, 0x5f, 0x00, 0x00, 0xcd, 0x48, 0x00, // .=........_...H. - 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x7c, 0x45, 0x00, 0x00, 0xa3, 0x5f, 0x00, // .O.......|E..._. - 0x00, 0xa3, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .._..........>.. - 0x00, 0xca, 0x2d, 0x00, 0x00, 0x7c, 0x45, 0x00, 0x00, 0x41, 0x00, 0x06, 0x00, 0x8b, 0x02, 0x00, // ..-..|E..A...... - 0x00, 0x8b, 0x3c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, 0x00, 0x0a, 0x0a, 0x00, // ..<..B.../...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x60, 0x5e, 0x00, 0x00, 0x8b, 0x3c, 0x00, // .=.......`^...<. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xcb, 0x2d, 0x00, 0x00, 0x60, 0x5e, 0x00, 0x00, 0x39, 0x00, 0x08, // .>....-..`^..9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x00, 0x00, 0xce, 0x14, 0x00, 0x00, 0xdf, 0x4a, 0x00, // ......J.......J. - 0x00, 0xc9, 0x2d, 0x00, 0x00, 0xca, 0x2d, 0x00, 0x00, 0xcb, 0x2d, 0x00, 0x00, 0x4f, 0x00, 0x08, // ..-...-...-..O.. - 0x00, 0x18, 0x00, 0x00, 0x00, 0xb0, 0x16, 0x00, 0x00, 0xa9, 0x4a, 0x00, 0x00, 0xa9, 0x4a, 0x00, // ..........J...J. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .............>.. - 0x00, 0xcc, 0x2d, 0x00, 0x00, 0xb0, 0x16, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ..-......9...... - 0x00, 0xb1, 0x38, 0x00, 0x00, 0xee, 0x0b, 0x00, 0x00, 0xcc, 0x2d, 0x00, 0x00, 0x83, 0x00, 0x05, // ..8.......-..... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbd, 0x0e, 0x00, 0x00, 0xb1, 0x38, 0x00, 0x00, 0xfc, 0x00, 0x00, // ..........8..... - 0x00, 0xd1, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xf6, 0x38, 0x00, 0x00, 0xbd, 0x0e, 0x00, // ..........8..... - 0x00, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfa, 0x4e, 0x00, 0x00, 0xbd, 0x0e, 0x00, // ..........N..... - 0x00, 0xf6, 0x38, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xa3, 0x4c, 0x00, // ..8...........L. - 0x00, 0xfa, 0x4e, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0d, 0x00, 0x00, // ..N............. - 0x00, 0x69, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0xa3, 0x4c, 0x00, // .i.......+....L. - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // .........P...... - 0x00, 0x52, 0x62, 0x00, 0x00, 0x69, 0x0e, 0x00, 0x00, 0x69, 0x0e, 0x00, 0x00, 0x69, 0x0e, 0x00, // .Rb..i...i...i.. - 0x00, 0x69, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xcd, 0x2d, 0x00, 0x00, 0x7a, 0x0b, 0x00, // .i...>....-..z.. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x02, 0x2e, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>...........>.. - 0x00, 0x9c, 0x2b, 0x00, 0x00, 0x52, 0x62, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ..+..Rb..9...... - 0x00, 0x97, 0x29, 0x00, 0x00, 0xd2, 0x0c, 0x00, 0x00, 0xcd, 0x2d, 0x00, 0x00, 0x02, 0x2e, 0x00, // ..).......-..... - 0x00, 0x9c, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x97, 0x3e, 0x00, 0x00, 0x97, 0x29, 0x00, // ..+..>....>...). - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .....8.... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xf4, 0x06, 0x00, // _params......... + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x03, 0x01, 0x00, // ...#............ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, // n............... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // .main........... + 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, // .BgfxSampler2D.. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, // .............m_s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // ampler.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // .....m_texture.. + 0x00, 0x05, 0x00, 0x05, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....-...s_texCo + 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // lor....../...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // exColorSampler.. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x32, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....2...s_texCo + 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // lorTexture...... + 0x00, 0x70, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .p...$Global.... + 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // .p.......u_param + 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // s........r...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0x95, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .........v_color + 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x99, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xa4, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...2..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x32, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...2...!...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...p.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x70, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...p...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x72, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...r..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x99, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // . ........... .. + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .,...........;.. + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .,...-....... .. + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ...../....... .. + 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .1...........;.. + 0x00, 0x31, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .1...2.......... + 0x00, 0x35, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .5... .......+.. + 0x00, 0x35, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, // .5...:.......... + 0x00, 0x3e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, // .>...........R.. + 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x52, 0x00, 0x00, // . .......+...R.. + 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .S.......+...... + 0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, // .g.......,...... + 0x00, 0x6b, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, // .k...g...g...g.. + 0x00, 0x67, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, // .g...+.......m.. + 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, // ....?,.......n.. + 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, // .m...m...m...m.. + 0x00, 0x1e, 0x00, 0x03, 0x00, 0x70, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....p....... .. + 0x00, 0x71, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .q.......p...;.. + 0x00, 0x71, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .q...r....... .. + 0x00, 0x79, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .y...........+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x00, 0x04, // ............? .. + 0x00, 0x94, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x94, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x98, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......... ...;.. + 0x00, 0x98, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0xa3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0xa3, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, // .........=...... + 0x00, 0x30, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .0.../...=...... + 0x00, 0x33, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, // .3...2...P...... + 0x00, 0x34, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .4...0...3...>.. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, // .-...4...=... .. + 0x00, 0x9a, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, // .........=...... + 0x00, 0xc7, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....-...Q...... + 0x00, 0x01, 0x01, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, // .O.............. + 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x79, 0x00, 0x00, 0x00, 0xca, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, // .y.......r...:.. + 0x00, 0x53, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, // .S...=.......... + 0x00, 0xca, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, // .....V...>...... + 0x00, 0x02, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, // .........X...... + 0x00, 0xea, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0xcb, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, // .....Q.......... + 0x00, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .........Q...... + 0x00, 0xef, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, // .............%.. + 0x00, 0xed, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // .........Q...... + 0x00, 0xf2, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x28, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .(...........Q.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x25, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x07, // .%.............. + 0x00, 0x07, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, // .............(.. + 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0xd0, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x04, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x88, 0x00, 0x05, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, // ................ + 0x00, 0x81, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, // ................ + 0x00, 0x82, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, // .....+.......g.. + 0x00, 0x6d, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, // .m...P.......... + 0x00, 0xd6, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, // ................ + 0x00, 0x0c, 0x00, 0x08, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x2e, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, // .....k...n...... + 0x00, 0x3e, 0x00, 0x03, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, // .>.............. + 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, // .8....... }; -static const uint8_t fs_texture_msdf_dx9[495] = +static const uint8_t fs_texture_msdf_dx9[499] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color0......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x03, // rams............ - 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x83, 0x00, // ....,.CTAB...... - 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ..|...D......... - 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..P.......`..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ......l.......s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ..........u_para - 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, // ms.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......ps_3_0.Mic - 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, // 10.1..Q......... - 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x3f, 0x1f, 0x00, // .?...........?.. - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, // ................ - 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ - 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, // .._............. - 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x55, 0x81, 0x00, 0x00, // ............U... - 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, // ..X............. - 0xe1, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, // ................ - 0xaa, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00, // ....U........... - 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x02, 0x00, // ................ - 0x00, 0x80, 0x01, 0x00, 0xaa, 0xa0, 0x5b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, // ......[......... - 0x00, 0x80, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ - 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x00, 0x00, 0x55, 0x8b, 0x06, 0x00, // ............U... - 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ........U....... - 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0xff, 0xa0, 0x01, 0x00, // ........U....... - 0x00, 0x02, 0x00, 0x08, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ............... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, // _texColor0...... + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xc0, 0x01, // u_params........ + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........,.CTAB.. + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, // ......|...D..... + 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, // ......P.......`. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........l..... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // params.......... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, // ..........ps_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, // ler 10.1..Q..... + 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, // .....?.......... + 0x00, 0x3f, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, // .?.............. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ......_......... + 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ + 0x55, 0x81, 0x00, 0x00, 0x00, 0x80, 0x58, 0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, // U.....X......... + 0xff, 0x80, 0x00, 0x00, 0xe1, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0x00, 0x03, 0x01, 0x00, // ................ + 0x01, 0x80, 0x00, 0x00, 0xaa, 0x80, 0x00, 0x00, 0x55, 0x80, 0x0b, 0x00, 0x00, 0x03, 0x02, 0x00, // ........U....... + 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x01, 0x80, 0x02, 0x00, 0x00, 0x80, 0x01, 0x00, 0xaa, 0xa0, 0x5b, 0x00, 0x00, 0x02, 0x00, 0x00, // ..........[..... + 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, // ................ + 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x00, 0x00, // ................ + 0x55, 0x8b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x04, 0x00, // U...........U... + 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, // ............U... + 0xff, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, // ................ + 0x00, 0x00, 0x00, // ... }; -static const uint8_t fs_texture_msdf_dx11[670] = +static const uint8_t fs_texture_msdf_dx11[674] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x44, 0x58, // olor0.....l...DX - 0x42, 0x43, 0xde, 0xd6, 0xcf, 0x5a, 0x51, 0xb1, 0xc9, 0x93, 0x7e, 0x1e, 0x77, 0x4e, 0x30, 0x56, // BC...ZQ...~.wN0V - 0xcd, 0x6a, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // .j....l.......,. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO - 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x90, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x64, 0x00, // ..SHDR....@...d. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, // ..Z....`......X. - 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. - 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..2.......e.... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, // ......h.......H. - 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, // ..........F..... - 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..F~.......`.... - 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, // .... .........4. - 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x07, 0x52, 0x00, // ..........3...R. - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x06, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x03, // ......V......... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, // ......4......... - 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, // ..*............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ................ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x0b, 0x00, // .......@........ - 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, // .."............. - 0x00, 0x00, 0x0c, 0x00, 0x00, 0x05, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......B......... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, // .........."..... - 0x00, 0x00, 0x2a, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..*............. - 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x07, 0x12, 0x00, // ................ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ................ + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x6c, 0x02, // texColor0.....l. + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xde, 0xd6, 0xcf, 0x5a, 0x51, 0xb1, 0xc9, 0x93, 0x7e, 0x1e, // ..DXBC...ZQ...~. + 0x77, 0x4e, 0x30, 0x56, 0xcd, 0x6a, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x03, 0x00, // wN0V.j....l..... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, // ..........SV_TAR + 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x90, 0x01, 0x00, 0x00, 0x40, 0x00, // GET...SHDR....@. + 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..d...Y...F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ......Z....`.... + 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X....p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, // ..b...2.......e. + 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, // ... ......h..... + 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, // ..H...........F. + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......` + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... + 0x00, 0x00, 0x34, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..4............. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, // ..............3. + 0x00, 0x07, 0x52, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x06, 0x10, 0x00, 0x00, 0x00, // ..R.......V..... + 0x00, 0x00, 0x06, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x07, 0x12, 0x00, // ..........4..... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......*......... 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ...........@.... - 0x00, 0x3f, 0x36, 0x20, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // .?6 ... ........ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ......>....... + 0x00, 0xbf, 0x0b, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......"......... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x05, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........B..... + 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x22, 0x00, // ..............". + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, // ......*......... + 0x00, 0x00, 0x1a, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, // ................ + 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x12, 0x00, // ................ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, // ...............@ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x20, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // .....?6 ... .... + 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, // ..........>..... + 0x10, 0x00, // .. }; -static const uint8_t fs_texture_msdf_mtl[890] = +static const uint8_t fs_texture_msdf_mtl[879] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x5c, 0x03, 0x00, 0x00, 0x75, 0x73, 0x69, // ams..........usi - 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met - 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // float3 v_texco - 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // ord0;.};.struct + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x03, // FSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, // ut {. float3 v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // texcoord0;.};.st + 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // erOutput {. flo + 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // at4 gl_FragColor + 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ;.};.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, // {. float4 u_pa + 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, // rams;.};.fragmen + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // utput xlatMtlMai + 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // n (xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, // Input _mtl_i [[s + 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, // tage_in]], const + 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // ant xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // rUniform& _mtl_u + 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, // [[buffer(0)]]. + 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, // , texture2d s_texColor + 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, // [[texture(0)]], + 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, // sampler _mtlsmp + 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, // _s_texColor [[sa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // mpler(0)]]).{. 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // put {. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // l_FragColor;.};. - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // struct xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, // aderUniform {. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, // float4 u_params; - 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // .};.fragment xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput - 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, // xlatMtlMain (xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, // atMtlShaderInput - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // _mtl_i [[stage_ - 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, // in]], constant x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif - 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, // orm& _mtl_u [[bu - 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, // ffer(0)]]. , - 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, // texture2d - 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, // s_texColor [[te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, // xture(0)]], samp - 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, // ler _mtlsmp_s_te - 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // xColor [[sampler - 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // (0)]]).{. xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, // tlShaderOutput _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, // mtl_o;. float3 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_1 = 0;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, // tmpvar_1 = s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, // Color.sample(_mt - 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, // lsmp_s_texColor, - 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // (float2)(_mtl_i - 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x29, // .v_texcoord0.xy) - 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // , level(_mtl_u.u - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x2e, 0x78, 0x79, 0x7a, 0x3b, // _params.x)).xyz; - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // . float tmpvar_ - 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 2 = 0;. tmpvar_ - 0x32, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x74, // 2 = (max (min (t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1.x, tmpva - 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x2c, 0x20, 0x6d, 0x69, 0x6e, 0x20, 0x28, 0x0a, 0x20, 0x20, // r_1.y), min (. - 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, // max (tmpvar_1. - 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x0a, 0x20, // x, tmpvar_1.y). - 0x20, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x29, 0x29, 0x20, // , tmpvar_1.z)) - 0x2d, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // - 0.5);. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, // .gl_FragColor = - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, // float4(clamp ((( - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x2f, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_2 / . - 0x28, 0x61, 0x62, 0x73, 0x28, 0x64, 0x66, 0x64, 0x78, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // (abs(dfdx(tmpvar - 0x5f, 0x32, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x61, 0x62, 0x73, 0x28, 0x64, 0x66, 0x64, 0x79, 0x28, // _2)) + abs(dfdy( - 0x2d, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, // -tmpvar_2))). ) - 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, // + 0.5), 0.0, 1. - 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, // 0));. return _m - 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tl_o;.}... + 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // put _mtl_o;. fl + 0x6f, 0x61, 0x74, 0x33, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // oat3 tmpvar_1 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 0;. tmpvar_1 = + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s_texColor.sampl + 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // e(_mtlsmp_s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, // olor, (float2)(_ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord + 0x30, 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, // 0.xy), level(_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, // l_u.u_params.x)) + 0x2e, 0x78, 0x79, 0x7a, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, // .xyz;. float tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, // pvar_2 = 0;. tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x6d, // pvar_2 = (max (m + 0x69, 0x6e, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x2c, 0x20, // in (tmpvar_1.x, + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x79, 0x29, 0x2c, 0x20, 0x6d, 0x69, 0x6e, // tmpvar_1.y), min + 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x6d, 0x61, 0x78, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, // (. max (tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // ar_1.x, tmpvar_1 + 0x2e, 0x79, 0x29, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // .y). , tmpvar_1 + 0x2e, 0x7a, 0x29, 0x29, 0x20, 0x2d, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // .z)) - 0.5);. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol + 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x63, 0x6c, 0x61, 0x6d, // or = float4(clam + 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x2f, 0x20, // p (((tmpvar_2 / + 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x64, 0x66, 0x64, 0x78, 0x28, 0x74, // . (abs(dfdx(t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x61, 0x62, 0x73, 0x28, // mpvar_2)) + abs( + 0x64, 0x66, 0x64, 0x79, 0x28, 0x2d, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x29, // dfdy(-tmpvar_2)) + 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x2c, 0x20, 0x30, 0x2e, // ). ) + 0.5), 0. + 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, // 0, 1.0));. retu + 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // rn _mtl_o;.}... }; extern const uint8_t* fs_texture_msdf_pssl; extern const uint32_t fs_texture_msdf_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_msdf.sc b/3rdparty/bgfx/tools/texturev/fs_texture_msdf.sc index 509b8b90628..224cca0d4e7 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_msdf.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture_msdf.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_sdf.bin.h b/3rdparty/bgfx/tools/texturev/fs_texture_sdf.bin.h index 0891dc5b03d..3babccd2aff 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_sdf.bin.h +++ b/3rdparty/bgfx/tools/texturev/fs_texture_sdf.bin.h @@ -1,442 +1,301 @@ -static const uint8_t fs_texture_sdf_glsl[415] = +static const uint8_t fs_texture_sdf_glsl[575] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x70, 0x01, 0x00, 0x00, 0x76, 0x61, // olor......p...va - 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, // rying highp vec3 - 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, // v_texcoord0;.un - 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // iform highp vec4 - 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, // u_params;.unifo - 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, // rm sampler2D s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, // exColor;.void ma - 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, // in ().{. lowp v - 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, // ec4 tmpvar_1;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, // tmpvar_1 = textu - 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x20, 0x20, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // re2DLod (s_te + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0c, 0x02, // texColor........ + 0x00, 0x00, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, // ..varying vec3 v + 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, // _texcoord0;.unif + 0x6f, 0x72, 0x6d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // orm vec4 u_param + 0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s;.uniform sampl + 0x65, 0x72, 0x32, 0x44, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, // er2D s_texColor; + 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{. + 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, // vec4 tmpvar_1; + 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x74, 0x65, // . tmpvar_1 = te + 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x20, 0x28, 0x73, 0x5f, 0x74, 0x65, // xture2DLod (s_te 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // xColor, v_texcoo 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x2c, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, // rd0.xy, u_params - 0x2e, 0x78, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // .x);. lowp vec4 - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // tmpvar_2;. tmp - 0x76, 0x61, 0x72, 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x63, 0x6c, 0x61, // var_2 = vec4(cla - 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // mp (((tmpvar_1.x - 0x20, 0x2f, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x64, 0x46, 0x64, // / . (abs(dFd - 0x78, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2b, // x(tmpvar_1.x)) + - 0x20, 0x61, 0x62, 0x73, 0x28, 0x64, 0x46, 0x64, 0x79, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // abs(dFdy(tmpvar - 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, // _1.x))). ) + 0. - 0x35, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, // 5), 0.0, 1.0));. - 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, // gl_FragColor = - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // tmpvar_2;.}... + 0x2e, 0x78, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, // .x);. float tmp + 0x76, 0x61, 0x72, 0x5f, 0x32, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_2;. tmpvar_ + 0x32, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x64, 0x46, 0x64, 0x78, 0x28, 0x74, 0x6d, // 2 = (abs(dFdx(tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x61, 0x62, 0x73, // pvar_1.x)) + abs + 0x28, 0x64, 0x46, 0x64, 0x79, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // (dFdy(tmpvar_1.x + 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, 0x64, 0x67, // )));. float edg + 0x65, 0x30, 0x5f, 0x33, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x33, 0x20, // e0_3;. edge0_3 + 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // = (0.5 - tmpvar_ + 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, // 2);. float tmpv + 0x61, 0x72, 0x5f, 0x34, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, // ar_4;. tmpvar_4 + 0x20, 0x3d, 0x20, 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, // = clamp (((tmpv + 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x33, // ar_1.x - edge0_3 + 0x29, 0x20, 0x2f, 0x20, 0x28, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2b, // ) / (. (0.5 + + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2d, 0x20, // tmpvar_2). - + 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x33, 0x29, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, // edge0_3)), 0.0, + 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, // 1.0);. gl_FragC + 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x63, 0x6c, 0x61, 0x6d, // olor = vec4(clam + 0x70, 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x2a, 0x20, 0x28, // p ((tmpvar_4 * ( + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x2a, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, // tmpvar_4 * . + 0x28, 0x33, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, 0x20, 0x74, 0x6d, // (3.0 - (2.0 * tm + 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, 0x2c, 0x20, 0x30, // pvar_4)). )), 0 + 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .0, 1.0));.}... }; -static const uint8_t fs_texture_sdf_spv[4638] = +static const uint8_t fs_texture_sdf_spv[1637] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x03, 0x02, 0x23, // ams............# - 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x54, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, // .........Ta..... - 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, // ................ - 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, // .GLSL.std.450... - 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x08, // ................ - 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, // .........main... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x74, 0x14, 0x00, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x03, // .w...t.......... - 0x00, 0x1f, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, // ................ - 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai - 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x10, 0x00, 0xce, 0x14, 0x00, 0x00, 0x62, 0x67, 0x66, // n............bgf - 0x78, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x4c, 0x6f, 0x64, 0x28, 0x73, 0x74, // xTexture2DLod(st - 0x72, 0x75, 0x63, 0x74, 0x2d, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // ruct-BgfxSampler - 0x32, 0x44, 0x2d, 0x70, 0x31, 0x2d, 0x74, 0x32, 0x31, 0x31, 0x3b, 0x76, 0x66, 0x32, 0x3b, 0x66, // 2D-p1-t211;vf2;f - 0x31, 0x3b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x5f, 0x73, 0x61, // 1;.......~..._sa - 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, // mpler.m_sampler. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, // ........._sample - 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x05, 0x00, 0x04, // r.m_texture..... - 0x00, 0xe7, 0x15, 0x00, 0x00, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x05, 0x00, 0x04, // ....._coord..... - 0x00, 0x2e, 0x12, 0x00, 0x00, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x00, 0x05, 0x00, 0x07, // ....._level..... - 0x00, 0xd2, 0x0c, 0x00, 0x00, 0x6d, 0x69, 0x78, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x34, // .....mix(vf4;vf4 - 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc6, 0x0e, 0x00, // ;vf4;........... - 0x00, 0x5f, 0x61, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x5f, 0x62, 0x00, // ._a.........._b. - 0x00, 0x05, 0x00, 0x03, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0x5f, 0x74, 0x00, 0x00, 0x05, 0x00, 0x06, // ........._t..... - 0x00, 0x35, 0x13, 0x00, 0x00, 0x76, 0x65, 0x63, 0x34, 0x5f, 0x73, 0x70, 0x6c, 0x61, 0x74, 0x28, // .5...vec4_splat( - 0x66, 0x31, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x5f, 0x78, 0x00, // f1;.........._x. - 0x00, 0x05, 0x00, 0x07, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, // .........@main(v - 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x34, 0x3b, 0x00, 0x00, 0x05, 0x00, 0x05, // f4;vf3;vf4;..... - 0x00, 0xf5, 0x25, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // ..%..v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x6f, 0x59, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // .....oY..v_texco - 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xe9, 0x4d, 0x00, 0x00, 0x67, 0x6c, 0x5f, // ord0......M..gl_ - 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x05, 0x00, 0x06, // FragData_0_..... - 0x00, 0x61, 0x09, 0x00, 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // .a...BgfxSampler - 0x32, 0x44, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x61, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, // 2D.......a...... - 0x00, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, // .m_sampler...... - 0x00, 0x61, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, // .a.......m_textu - 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, // re...........fla - 0x74, 0x74, 0x65, 0x6e, 0x54, 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x07, 0x00, 0xb2, 0x0c, 0x00, // ttenTemp........ - 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, // .s_texColorSampl - 0x65, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0xee, 0x0e, 0x00, 0x00, 0x73, 0x5f, 0x74, // er...........s_t - 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // exColorTexture.. - 0x00, 0x05, 0x00, 0x08, 0x00, 0x14, 0x11, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .........s_texCo - 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, // lor.m_sampler... - 0x00, 0x05, 0x00, 0x08, 0x00, 0x50, 0x13, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....P...s_texCo - 0x6c, 0x6f, 0x72, 0x2e, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, // lor.m_texture... - 0x00, 0x05, 0x00, 0x06, 0x00, 0xa0, 0x11, 0x00, 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x56, 0x6f, // .........bgfx_Vo - 0x69, 0x64, 0x46, 0x72, 0x61, 0x67, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xc1, 0x47, 0x00, // idFrag........G. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x7a, 0x0b, 0x00, // .param.......z.. - 0x00, 0x62, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x05, 0x00, // .bgColor........ - 0x00, 0x66, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x05, 0x00, 0x04, 0x00, 0xbd, 0x0e, 0x00, // .fgColor........ - 0x00, 0x73, 0x69, 0x67, 0x44, 0x69, 0x73, 0x74, 0x00, 0x05, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, // .sigDist.....$.. - 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x09, 0x00, // .$Global.....$.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, // .....u_viewRect. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .....$.......u_v - 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // iewTexel.....$.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, // .....u_view..... - 0x00, 0x24, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, // .$.......u_invVi - 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, // ew.......$...... - 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x09, 0x00, // .u_proj......$.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // .....u_invProj.. - 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, // .....$.......u_v - 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x06, 0x00, 0x07, 0x00, 0x24, 0x09, 0x00, // iewProj......$.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, // .....u_invViewPr - 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, // oj.......$...... - 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x09, 0x00, // .u_model.....$.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // .....u_modelView - 0x00, 0x06, 0x00, 0x07, 0x00, 0x24, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, // .....$.......u_m - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, // odelViewProj.... - 0x00, 0x24, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, // .$.......u_alpha - 0x52, 0x65, 0x66, 0x34, 0x00, 0x06, 0x00, 0x06, 0x00, 0x24, 0x09, 0x00, 0x00, 0x0c, 0x00, 0x00, // Ref4.....$...... - 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, // .u_params....... - 0x00, 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x31, 0x5a, 0x00, // .B...........1Z. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe2, 0x23, 0x00, // .param........#. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe3, 0x23, 0x00, // .param........#. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe4, 0x23, 0x00, // .param........#. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x69, 0x0e, 0x00, // .param.......i.. - 0x00, 0x6f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x00, 0x05, 0x00, 0x04, 0x00, 0xe5, 0x23, 0x00, // .opacity......#. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x1b, 0x24, 0x00, // .param........$. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0xb5, 0x21, 0x00, // .param........!. - 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xf4, 0x2b, 0x00, // .param........+. - 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, // .v_color0....... - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, // .w...v_color0... - 0x00, 0x05, 0x00, 0x05, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // ......<..v_texco - 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, 0x74, 0x14, 0x00, 0x00, 0x76, 0x5f, 0x74, // ord0.....t...v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0xce, 0x1c, 0x00, // excoord0........ - 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, // .gl_FragData_0_. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......U..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // ......8..param.. - 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x00, 0x00, // .........param.. - 0x00, 0x05, 0x00, 0x06, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // .........gl_Frag - 0x44, 0x61, 0x74, 0x61, 0x5f, 0x30, 0x5f, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, // Data_0_..G...... - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xb2, 0x0c, 0x00, // .".......G...... - 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, // .!.......G...... - 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xee, 0x0e, 0x00, // .".......G...... - 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x94, 0x01, 0x00, // .!.......G...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // .....@...H...$.. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0x24, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .$.......#...... - 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...$.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...$.......#.. - 0x00, 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, // . ...H...$...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...`...H.. - 0x00, 0x24, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .$.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...$.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...$.......#.. - 0x00, 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, // .....H...$...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0x24, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .$.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...$.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...$.......#.. - 0x00, 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, // . ...H...$...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#...`...H.. - 0x00, 0x24, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .$.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...$.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...$.......#.. - 0x00, 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, // .....H...$...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#.......H.. - 0x00, 0x24, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, // .$.............. - 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, // .H...$.......... - 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...$.......#.. - 0x00, 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, // .....H...$...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x09, 0x00, // .........H...$.. - 0x00, 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x48, 0x00, 0x05, // .....#... ...H.. - 0x00, 0x24, 0x09, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x30, 0x0a, 0x00, // .$.......#...0.. - 0x00, 0x47, 0x00, 0x03, 0x00, 0x24, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .G...$.......G.. - 0x00, 0x42, 0x13, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .B...".......G.. - 0x00, 0x77, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .w...........G.. - 0x00, 0x74, 0x14, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, // .t...........G.. - 0x00, 0xd1, 0x0d, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, // ................ - 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, // .....!.......... - 0x00, 0x1a, 0x00, 0x02, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x79, 0x04, 0x00, // ......... ...y.. - 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x96, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, // . .............. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x13, 0x03, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x90, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8a, 0x02, 0x00, // ......... ...... - 0x00, 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, // ................ - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x07, 0x00, 0x53, 0x0b, 0x00, // .........!...S.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x79, 0x04, 0x00, 0x00, 0x13, 0x03, 0x00, 0x00, 0x90, 0x02, 0x00, // .....y.......... - 0x00, 0x8a, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....!.......... - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x21, 0x00, 0x04, // .............!.. - 0x00, 0xef, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ - 0x00, 0x18, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, // .............!.. - 0x00, 0x7d, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, // .}.............. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x00, 0x61, 0x09, 0x00, 0x00, 0xfc, 0x01, 0x00, // .........a...... - 0x00, 0x96, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, // ..... .......... - 0x00, 0x61, 0x09, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, // .a... ...z...... - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7a, 0x04, 0x00, 0x00, 0xb2, 0x0c, 0x00, // .....;...z...... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ..... .......... - 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x14, 0x03, 0x00, 0x00, 0xee, 0x0e, 0x00, // .....;.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, // ..... ...{...... - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x7b, 0x04, 0x00, 0x00, 0x14, 0x11, 0x00, // .....;...{...... - 0x00, 0x06, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, // ............. .. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0b, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, // ..... .......... - 0x00, 0x96, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x15, 0x03, 0x00, 0x00, 0x50, 0x13, 0x00, // .....;.......P.. - 0x00, 0x06, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, // .....+.......... - 0x00, 0x01, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x96, 0x00, 0x00, // ................ - 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, // .+.............. - 0x00, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x0c, 0x0a, 0x00, // .,.......z...... - 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, // .............+.. - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x07, // ............?,.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, // ................ - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, // .............e.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // ................ - 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, // . .......+...... - 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x94, 0x01, 0x00, // .j... .......... - 0x00, 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0f, 0x00, 0x24, 0x09, 0x00, // .e...j.......$.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .........e...e.. - 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, // .e...e...e...e.. - 0x00, 0x94, 0x01, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, // .....e...e...... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xa1, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x24, 0x09, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0xa1, 0x0b, 0x00, 0x00, 0x42, 0x13, 0x00, // .$...;.......B.. - 0x00, 0x02, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2f, 0x0a, 0x00, // .....+......./.. - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x8b, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, // ..... .......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, // .....+.......... - 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, // ....? .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x77, 0x0e, 0x00, // .....;.......w.. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, // ..... .......... - 0x00, 0x18, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x74, 0x14, 0x00, // .....;.......t.. - 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ..... .......... - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0xd1, 0x0d, 0x00, // .....;.......... - 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, // .....6.......... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, // .............Sa. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........U..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, // .;........8..... - 0x00, 0x3b, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, // .;.............. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x43, 0x00, 0x00, 0xb2, 0x0c, 0x00, // .=.......!C..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00, 0x00, 0xee, 0x0e, 0x00, // .=........3..... - 0x00, 0x50, 0x00, 0x05, 0x00, 0x61, 0x09, 0x00, 0x00, 0x5e, 0x20, 0x00, 0x00, 0x21, 0x43, 0x00, // .P...a...^ ..!C. - 0x00, 0x02, 0x33, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x08, 0x10, 0x00, 0x00, 0x5e, 0x20, 0x00, // ..3..>.......^ . - 0x00, 0x41, 0x00, 0x05, 0x00, 0x79, 0x04, 0x00, 0x00, 0xf4, 0x56, 0x00, 0x00, 0x08, 0x10, 0x00, // .A...y....V..... - 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x1f, 0x1f, 0x00, // .....=.......... - 0x00, 0xf4, 0x56, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x14, 0x11, 0x00, 0x00, 0x1f, 0x1f, 0x00, // ..V..>.......... - 0x00, 0x41, 0x00, 0x05, 0x00, 0x13, 0x03, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, // .A........@..... - 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0xd3, 0x1e, 0x00, // .....=.......... - 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x50, 0x13, 0x00, 0x00, 0xd3, 0x1e, 0x00, // ..@..>...P...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x77, 0x0e, 0x00, // .=........+..w.. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x74, 0x14, 0x00, // .=........<..t.. - 0x00, 0x3e, 0x00, 0x03, 0x00, 0x85, 0x55, 0x00, 0x00, 0xf4, 0x2b, 0x00, 0x00, 0x3e, 0x00, 0x03, // .>....U...+..>.. - 0x00, 0x95, 0x38, 0x00, 0x00, 0x03, 0x3c, 0x00, 0x00, 0x39, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, // ..8...<..9...... - 0x00, 0xbd, 0x26, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, // ..&.......U...8. - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xce, 0x1c, 0x00, // .....=.......... - 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xd1, 0x0d, 0x00, 0x00, 0xce, 0x1c, 0x00, // .....>.......... - 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // .....8...6...... - 0x00, 0xce, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x0b, 0x00, 0x00, 0x37, 0x00, 0x03, // .........S...7.. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x7e, 0x17, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x13, 0x03, 0x00, // .y...~...7...... - 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x90, 0x02, 0x00, 0x00, 0xe7, 0x15, 0x00, // .....7.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. - 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, 0x00, 0x9c, 0x5c, 0x00, // .._..=.......... - 0x00, 0xf7, 0x0d, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x21, 0x41, 0x00, // .....=.......!A. - 0x00, 0x7e, 0x17, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x60, 0x35, 0x00, // .~...V.......`5. - 0x00, 0x9c, 0x5c, 0x00, 0x00, 0x21, 0x41, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, // .....!A..=...... - 0x00, 0x95, 0x22, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, // .."......=...... - 0x00, 0x05, 0x47, 0x00, 0x00, 0x2e, 0x12, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, // ..G......X...... - 0x00, 0x28, 0x3d, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 0x02, 0x00, 0x00, // .(=..`5..."..... - 0x00, 0x05, 0x47, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x28, 0x3d, 0x00, 0x00, 0x38, 0x00, 0x01, // ..G......(=..8.. - 0x00, 0x36, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd2, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, // .6.............. - 0x00, 0xbb, 0x00, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc6, 0x0e, 0x00, // .....7.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xc7, 0x0e, 0x00, 0x00, 0x37, 0x00, 0x03, // .7...........7.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xd9, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x6d, 0x51, 0x00, // .............mQ. - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x48, 0x1b, 0x00, 0x00, 0xc6, 0x0e, 0x00, // .=.......H...... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5e, 0x40, 0x00, 0x00, 0xc7, 0x0e, 0x00, // .=.......^@..... - 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x3f, 0x00, 0x00, 0xd9, 0x0e, 0x00, // .=.......e?..... - 0x00, 0x0c, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x5a, 0x42, 0x00, 0x00, 0x01, 0x00, 0x00, // .........ZB..... - 0x00, 0x2e, 0x00, 0x00, 0x00, 0x48, 0x1b, 0x00, 0x00, 0x5e, 0x40, 0x00, 0x00, 0x65, 0x3f, 0x00, // .....H...^@..e?. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0x5a, 0x42, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // .....ZB..8...6.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, // .....5.......... - 0x00, 0x37, 0x00, 0x03, 0x00, 0x8a, 0x02, 0x00, 0x00, 0xdd, 0x0e, 0x00, 0x00, 0xf8, 0x00, 0x02, // .7.............. - 0x00, 0xb1, 0x24, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x75, 0x56, 0x00, // ..$..=.......uV. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xba, 0x4d, 0x00, // .....=........M. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5a, 0x38, 0x00, // .....=.......Z8. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6d, 0x38, 0x00, // .....=.......m8. - 0x00, 0xdd, 0x0e, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xd9, 0x20, 0x00, // .....P........ . - 0x00, 0x75, 0x56, 0x00, 0x00, 0xba, 0x4d, 0x00, 0x00, 0x5a, 0x38, 0x00, 0x00, 0x6d, 0x38, 0x00, // .uV...M..Z8..m8. - 0x00, 0xfe, 0x00, 0x02, 0x00, 0xd9, 0x20, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x36, 0x00, 0x05, // ...... ..8...6.. - 0x00, 0x08, 0x00, 0x00, 0x00, 0xcc, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, // .............}.. - 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0xf5, 0x25, 0x00, 0x00, 0x37, 0x00, 0x03, // .7........%..7.. - 0x00, 0x95, 0x02, 0x00, 0x00, 0x6f, 0x59, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, // .....oY..7...... - 0x00, 0xe9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x1d, 0x57, 0x00, 0x00, 0x3b, 0x00, 0x04, // ..M.......W..;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xc1, 0x47, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......G......;.. - 0x00, 0x79, 0x04, 0x00, 0x00, 0x31, 0x5a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .y...1Z......;.. - 0x00, 0x13, 0x03, 0x00, 0x00, 0xe2, 0x23, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......#......;.. - 0x00, 0x90, 0x02, 0x00, 0x00, 0xe3, 0x23, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......#......;.. - 0x00, 0x8a, 0x02, 0x00, 0x00, 0xe4, 0x23, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......#......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xe5, 0x23, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......#......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0x1b, 0x24, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......$......;.. - 0x00, 0x9a, 0x02, 0x00, 0x00, 0xb5, 0x21, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......!......>.. - 0x00, 0xc1, 0x47, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x39, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, // ..G......9...... - 0x00, 0xa0, 0x11, 0x00, 0x00, 0x35, 0x13, 0x00, 0x00, 0xc1, 0x47, 0x00, 0x00, 0x3d, 0x00, 0x04, // .....5....G..=.. - 0x00, 0xfc, 0x01, 0x00, 0x00, 0x80, 0x44, 0x00, 0x00, 0x14, 0x11, 0x00, 0x00, 0x3e, 0x00, 0x03, // ......D......>.. - 0x00, 0x31, 0x5a, 0x00, 0x00, 0x80, 0x44, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x96, 0x00, 0x00, // .1Z...D..=...... - 0x00, 0xe0, 0x2f, 0x00, 0x00, 0x50, 0x13, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe2, 0x23, 0x00, // ../..P...>....#. - 0x00, 0xe0, 0x2f, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x76, 0x24, 0x00, // ../..=.......v$. - 0x00, 0x6f, 0x59, 0x00, 0x00, 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x95, 0x3b, 0x00, // .oY..O........;. - 0x00, 0x76, 0x24, 0x00, 0x00, 0x76, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .v$..v$......... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe3, 0x23, 0x00, 0x00, 0x95, 0x3b, 0x00, 0x00, 0x41, 0x00, 0x06, // .>....#...;..A.. - 0x00, 0x8b, 0x02, 0x00, 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x2f, 0x0a, 0x00, // ......K..B.../.. - 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x79, 0x54, 0x00, // .....=.......yT. - 0x00, 0xdd, 0x4b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe4, 0x23, 0x00, 0x00, 0x79, 0x54, 0x00, // ..K..>....#..yT. - 0x00, 0x39, 0x00, 0x08, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0b, 0x19, 0x00, 0x00, 0xce, 0x14, 0x00, // .9.............. - 0x00, 0x31, 0x5a, 0x00, 0x00, 0xe2, 0x23, 0x00, 0x00, 0xe3, 0x23, 0x00, 0x00, 0xe4, 0x23, 0x00, // .1Z...#...#...#. - 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xbd, 0x0e, 0x00, 0x00, 0x0b, 0x19, 0x00, // .Q.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe2, 0x19, 0x00, // ................ - 0x00, 0xbd, 0x0e, 0x00, 0x00, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0xe4, 0x3e, 0x00, // ..............>. - 0x00, 0xbd, 0x0e, 0x00, 0x00, 0xe2, 0x19, 0x00, 0x00, 0x81, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, // ................ - 0x00, 0xf5, 0x5b, 0x00, 0x00, 0xe4, 0x3e, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, // ..[...>......... - 0x00, 0x0d, 0x00, 0x00, 0x00, 0x69, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, // .....i.......+.. - 0x00, 0xf5, 0x5b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, // ..[..........P.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0x6b, 0x58, 0x00, 0x00, 0x69, 0x0e, 0x00, 0x00, 0x69, 0x0e, 0x00, // .....kX..i...i.. - 0x00, 0x69, 0x0e, 0x00, 0x00, 0x69, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe5, 0x23, 0x00, // .i...i...>....#. - 0x00, 0x7a, 0x0b, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x1b, 0x24, 0x00, 0x00, 0x04, 0x05, 0x00, // .z...>....$..... - 0x00, 0x3e, 0x00, 0x03, 0x00, 0xb5, 0x21, 0x00, 0x00, 0x6b, 0x58, 0x00, 0x00, 0x39, 0x00, 0x07, // .>....!..kX..9.. - 0x00, 0x1d, 0x00, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, 0xd2, 0x0c, 0x00, 0x00, 0xe5, 0x23, 0x00, // ..............#. - 0x00, 0x1b, 0x24, 0x00, 0x00, 0xb5, 0x21, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0xe9, 0x4d, 0x00, // ..$...!..>....M. - 0x00, 0xb0, 0x1f, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // .........8.... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x40, 0x06, 0x00, // _params......@.. + 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0xe2, 0x00, 0x00, // ...#............ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, // ................ + 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, // .....GLSL.std.45 + 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // 0............... + 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, // .............mai + 0x6e, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, // n............... + 0x00, 0x10, 0x00, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, // ................ + 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, // ................ + 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // .main........... + 0x00, 0x42, 0x67, 0x66, 0x78, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x00, 0x00, // .BgfxSampler2D.. + 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x73, // .............m_s + 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x09, 0x00, 0x00, // ampler.......... + 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, // .....m_texture.. + 0x00, 0x05, 0x00, 0x05, 0x00, 0x29, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .....)...s_texCo + 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x05, 0x00, 0x07, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, // lor......+...s_t + 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x00, // exColorSampler.. + 0x00, 0x05, 0x00, 0x07, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // .........s_texCo + 0x6c, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, // lorTexture...... + 0x00, 0x58, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, 0x06, 0x00, 0x06, // .X...$Global.... + 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, // .X.......u_param + 0x73, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // s........Z...... + 0x00, 0x05, 0x00, 0x05, 0x00, 0x81, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // .........v_color + 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x85, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, // 0............v_t + 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x06, 0x00, 0x90, 0x00, 0x00, // excoord0........ + 0x00, 0x62, 0x67, 0x66, 0x78, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x30, 0x00, // .bgfx_FragData0. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G......."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.......!...... + 0x00, 0x48, 0x00, 0x05, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, // .H...X.......#.. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // .....G...X...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G...Z..."...... + 0x00, 0x47, 0x00, 0x04, 0x00, 0x81, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x85, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // .G.............. + 0x00, 0x47, 0x00, 0x04, 0x00, 0x90, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .G.............. + 0x00, 0x13, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, // .........!...... + 0x00, 0x02, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, // ................ + 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, // ..... .......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x04, // ................ + 0x00, 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, // ................ + 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // . ........... .. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .(...........;.. + 0x00, 0x28, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .(...)....... .. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .*...........;.. + 0x00, 0x2a, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .*...+....... .. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .-...........;.. + 0x00, 0x2d, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .-.............. + 0x00, 0x31, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .1... .......+.. + 0x00, 0x31, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, // .1...6.......... + 0x00, 0x3a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // .:.......+...... + 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, // .O.......,...... + 0x00, 0x53, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, // .S...O...O...O.. + 0x00, 0x4f, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, // .O...+.......U.. + 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, // ....?,.......V.. + 0x00, 0x55, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, // .U...U...U...U.. + 0x00, 0x1e, 0x00, 0x03, 0x00, 0x58, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .....X....... .. + 0x00, 0x59, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .Y.......X...;.. + 0x00, 0x59, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, // .Y...Z.......... + 0x00, 0x61, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .a... .......+.. + 0x00, 0x61, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // .a...b....... .. + 0x00, 0x63, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, // .c...........+.. + 0x00, 0x07, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x00, 0x04, // .....l......? .. + 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x84, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // ......... ...;.. + 0x00, 0x84, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, // ............. .. + 0x00, 0x8f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, // .............;.. + 0x00, 0x8f, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, // .............6.. + 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ + 0x00, 0xf8, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, // .........=...... + 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, // .,...+...=...... + 0x00, 0x2f, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x50, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, // ./.......P...... + 0x00, 0x30, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .0...,.../...>.. + 0x00, 0x29, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, // .)...0...=... .. + 0x00, 0x86, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, // .........=...... + 0x00, 0xb3, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, // .....)...Q...... + 0x00, 0xe0, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, // .............Q.. + 0x00, 0x08, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x4f, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, // .O.............. + 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x00, 0x06, // .............A.. + 0x00, 0x63, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, // .c.......Z...6.. + 0x00, 0x62, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, // .b...=.......... + 0x00, 0xb6, 0x00, 0x00, 0x00, 0x56, 0x00, 0x05, 0x00, 0x3a, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, // .....V...:...... + 0x00, 0xe1, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x58, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, // .........X...... + 0x00, 0xd8, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x00, 0xb7, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, // .....Q.......... + 0x00, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0xbb, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x83, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, // ................ + 0x00, 0xbe, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x81, 0x00, 0x05, // .....l.......... + 0x00, 0x07, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, // .........l...... + 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x31, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, // .1.............. + 0x00, 0x0c, 0x00, 0x08, 0x00, 0x07, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, // ................ + 0x00, 0x2b, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, // .+.......O...U.. + 0x00, 0x50, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, // .P.............. + 0x00, 0xc4, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, // ................ + 0x00, 0x0e, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, // ................ + 0x00, 0x53, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, // .S...V.......>.. + 0x00, 0x90, 0x00, 0x00, 0x00, 0xdd, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, // .............8.. + 0x00, 0x00, 0x00, 0x10, 0x00, // ..... }; -static const uint8_t fs_texture_sdf_dx9[411] = +static const uint8_t fs_texture_sdf_dx9[535] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, // FSH........s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, // Color0......u_pa - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0x6c, 0x01, 0x00, 0x00, 0x00, 0x03, // rams......l..... - 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x83, 0x00, // ....,.CTAB...... - 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, // ................ - 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ..|...D......... - 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, // ..P.......`..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x5f, // ......l.......s_ - 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, // texColor........ - 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, // ..........u_para - 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, // ms.............. - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, // ......ps_3_0.Mic - 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, // rosoft (R) HLSL - 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, // Shader Compiler - 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, 0x0f, 0xa0, 0x00, 0x00, // 10.1..Q......... - 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, // .?.......?...... - 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ - 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, // ................ - 0xd0, 0xa0, 0x00, 0x00, 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, // ................ - 0x00, 0xa0, 0x5f, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, // .._............. - 0xe4, 0xa0, 0x5b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x5c, 0x00, // ..[............. - 0x00, 0x02, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, // ................ - 0x02, 0x80, 0x00, 0x00, 0xaa, 0x8b, 0x00, 0x00, 0x55, 0x8b, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, // ........U....... - 0x02, 0x80, 0x00, 0x00, 0x55, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ....U........... - 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0xaa, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, // ....U........... - 0x1f, 0x80, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ........... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x73, // FSH............s + 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, // _texColor0...... + 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x01, 0x00, 0x00, 0x01, 0x00, 0xe4, 0x01, // u_params........ + 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xfe, 0xff, 0x2c, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // ........,.CTAB.. + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, // ................ + 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, // ......|...D..... + 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, // ......P.......`. + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........l..... + 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, // ..s_texColor.... + 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_ + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x00, 0xab, 0xab, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // params.......... + 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, // ..........ps_3_0 + 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, // .Microsoft (R) H + 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, // LSL Shader Compi + 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0x51, 0x00, 0x00, 0x05, 0x01, 0x00, // ler 10.1..Q..... + 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, // .....?.......?.. + 0x00, 0x00, 0x51, 0x00, 0x00, 0x05, 0x02, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, // ..Q............. + 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // @@.............. + 0x00, 0x80, 0x00, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, // ................ + 0x0f, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0x80, 0x01, 0x00, 0xd0, 0xa0, 0x00, 0x00, // ................ + 0xc4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, // .............._. + 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x00, 0x08, 0xe4, 0xa0, 0x5b, 0x00, // ..............[. + 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x5c, 0x00, 0x00, 0x02, 0x00, 0x00, // ................ + 0x04, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, // ................ + 0xaa, 0x8b, 0x00, 0x00, 0x55, 0x8b, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, // ....U........... + 0x55, 0x80, 0x01, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, // U............... + 0x55, 0x81, 0x01, 0x00, 0xaa, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x05, 0x80, 0x00, 0x00, // U............... + 0x55, 0x81, 0x00, 0x00, 0xe4, 0x80, 0x06, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, // U............... + 0xaa, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x11, 0x80, 0x00, 0x00, 0x55, 0x80, 0x00, 0x00, // ............U... + 0x00, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, // ................ + 0x00, 0xa0, 0x02, 0x00, 0x55, 0xa0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ....U........... + 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, // ................ + 0x00, 0x80, 0x00, 0x00, 0x55, 0x80, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x1f, 0x80, 0x00, 0x00, // ....U........... + 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00, // ....... }; -static const uint8_t fs_texture_sdf_dx11[558] = +static const uint8_t fs_texture_sdf_dx11[778] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x02, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // ams.......s_texC - 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x44, 0x58, // olor0.........DX - 0x42, 0x43, 0xcc, 0xff, 0xbd, 0x63, 0x8b, 0x9e, 0xee, 0x37, 0x7b, 0x13, 0xc3, 0xb6, 0x5c, 0x48, // BC...c...7{....H - 0xab, 0xbe, 0x01, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, // ..............,. - 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x6c, 0x00, // ..........ISGNl. - 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........P..... - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, // ................ - 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // ................ - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........b..... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x03, // ................ - 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, // ..SV_POSITION.CO - 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, // LOR.TEXCOORD..OS - 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, // GN,........... . - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, // ......SV_TARGET. - 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x20, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, // ..SHDR ...@...H. - 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // ..Y...F. ....... - 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, // ..Z....`......X. - 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, // ...p......UU..b. - 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..2.......e.... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, // ......h.......H. - 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, // ..........F..... - 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ..F~.......`.... - 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, // .... ........... - 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, // .."............. - 0x00, 0x00, 0x0c, 0x00, 0x00, 0x05, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......B......... - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, // .........."..... - 0x00, 0x00, 0x2a, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..*............. - 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x07, 0x12, 0x00, // ................ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ................ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ...........@.... - 0x00, 0x3f, 0x36, 0x20, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, // .?6 ... ........ - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // ......>....... + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x75, // FSH............u + 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x73, 0x5f, // _params.......s_ + 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd4, 0x02, // texColor0....... + 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x03, 0x0d, 0x91, 0x21, 0x8e, 0x75, 0xa6, 0x21, 0xba, 0xe2, // ..DXBC...!.u.!.. + 0x0d, 0xbb, 0xa4, 0xa3, 0xae, 0x51, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x02, 0x00, 0x00, 0x03, 0x00, // .....Q.......... + 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0x49, 0x53, // ..,...........IS + 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, // GNl...........P. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, // ..............b. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................ + 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, // ......SV_POSITIO + 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, // N.COLOR.TEXCOORD + 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, // ..OSGN,......... + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, // .. ............. + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, // ..........SV_TAR + 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0xf8, 0x01, 0x00, 0x00, 0x40, 0x00, // GET...SHDR....@. + 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..~...Y...F. ... + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, // ......Z....`.... + 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, // ..X....p......UU + 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, // ..b...2.......e. + 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, // ... ......h..... + 0x00, 0x00, 0x48, 0x00, 0x00, 0x0c, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, // ..H...........F. + 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, // ......F~.......` + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ ....... + 0x00, 0x00, 0x0b, 0x00, 0x00, 0x05, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // ......"......... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x05, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, // ..........B..... + 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x22, 0x00, // ..............". + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, // ......*......... + 0x00, 0x00, 0x1a, 0x00, 0x10, 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x00, 0x07, 0x42, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, // ..B............. + 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x22, 0x00, // ...@.....?....". + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, // ..........A..... + 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x08, 0x52, 0x00, // ...@.....?....R. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x05, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, // ......V...A..... + 0x00, 0x00, 0x06, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0a, 0x22, 0x00, // ..............". + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // .......@.....?.. + 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00, // .?...?...?*..... + 0x00, 0x00, 0x38, 0x20, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, // ..8 ............ + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, // ..............2. + 0x00, 0x09, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, // .."............. + 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, // ...@.......@.... + 0x40, 0x40, 0x38, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, // @@8............. + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, // ..............8. + 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x0a, 0xf2, 0x20, // ..........3.... + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, // ...............@ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, // .....?...?...?.. + 0x80, 0x3f, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, // .?>....... }; -static const uint8_t fs_texture_sdf_mtl[757] = +static const uint8_t fs_texture_sdf_mtl[979] = { - 0x46, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x08, 0x75, 0x5f, 0x70, 0x61, 0x72, // FSH........u_par - 0x61, 0x6d, 0x73, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0xd7, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, // ams..........usi - 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, // ng namespace met - 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // al;.struct xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, // tlShaderInput {. - 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // float3 v_texco - 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // ord0;.};.struct + 0x46, 0x53, 0x48, 0x06, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, // FSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, // ut {. float3 v_ + 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, // texcoord0;.};.st + 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, // ruct xlatMtlShad + 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // erOutput {. flo + 0x61, 0x74, 0x34, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, // at4 gl_FragColor + 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ;.};.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, // {. float4 u_pa + 0x72, 0x61, 0x6d, 0x73, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, // rams;.};.fragmen + 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO + 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, // utput xlatMtlMai + 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // n (xlatMtlShader + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, // Input _mtl_i [[s + 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, // tage_in]], const + 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, // ant xlatMtlShade + 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, // rUniform& _mtl_u + 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, // [[buffer(0)]]. + 0x20, 0x2c, 0x20, 0x20, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, // , texture2d s_texColor + 0x20, 0x5b, 0x5b, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, // [[texture(0)]], + 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, // sampler _mtlsmp + 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, // _s_texColor [[sa + 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, // mpler(0)]]).{. 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut - 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // put {. float4 g - 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, // l_FragColor;.};. - 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, // struct xlatMtlSh - 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, // aderUniform {. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3b, // float4 u_params; - 0x0a, 0x7d, 0x3b, 0x0a, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // .};.fragment xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput - 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, // xlatMtlMain (xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, // atMtlShaderInput - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, // _mtl_i [[stage_ - 0x69, 0x6e, 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, // in]], constant x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, // latMtlShaderUnif - 0x6f, 0x72, 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, // orm& _mtl_u [[bu - 0x66, 0x66, 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x0a, 0x20, 0x20, 0x2c, 0x20, 0x20, 0x20, // ffer(0)]]. , - 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x64, 0x3c, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x3e, // texture2d - 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x74, 0x65, // s_texColor [[te - 0x78, 0x74, 0x75, 0x72, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x2c, 0x20, 0x73, 0x61, 0x6d, 0x70, // xture(0)]], samp - 0x6c, 0x65, 0x72, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, // ler _mtlsmp_s_te - 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x5b, 0x5b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, // xColor [[sampler - 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // (0)]]).{. xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, // tlShaderOutput _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // mtl_o;. float4 - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_1 = 0;. - 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x73, 0x5f, 0x74, 0x65, 0x78, // tmpvar_1 = s_tex - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x28, 0x5f, 0x6d, 0x74, // Color.sample(_mt - 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, // lsmp_s_texColor, - 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, // (float2)(_mtl_i - 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x2e, 0x78, 0x79, 0x29, // .v_texcoord0.xy) - 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, // , level(_mtl_u.u - 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // _params.x));. _ - 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, // mtl_o.gl_FragCol - 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x63, 0x6c, 0x61, 0x6d, // or = float4(clam - 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x20, // p (((tmpvar_1.x - 0x2f, 0x20, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x64, 0x66, 0x64, 0x78, // / . (abs(dfdx - 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2b, 0x20, // (tmpvar_1.x)) + - 0x61, 0x62, 0x73, 0x28, 0x64, 0x66, 0x64, 0x79, 0x28, 0x2d, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // abs(dfdy(-tmpvar - 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x20, 0x2b, 0x20, 0x30, 0x2e, // _1.x))). ) + 0. - 0x35, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, // 5), 0.0, 1.0));. - 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, // return _mtl_o; - 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // .}... + 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // put _mtl_o;. fl + 0x6f, 0x61, 0x74, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // oat4 tmpvar_1 = + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, // 0;. tmpvar_1 = + 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x73, 0x61, 0x6d, 0x70, 0x6c, // s_texColor.sampl + 0x65, 0x28, 0x5f, 0x6d, 0x74, 0x6c, 0x73, 0x6d, 0x70, 0x5f, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x43, // e(_mtlsmp_s_texC + 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x28, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x29, 0x28, 0x5f, // olor, (float2)(_ + 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // mtl_i.v_texcoord + 0x30, 0x2e, 0x78, 0x79, 0x29, 0x2c, 0x20, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x28, 0x5f, 0x6d, 0x74, // 0.xy), level(_mt + 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x78, 0x29, 0x29, // l_u.u_params.x)) + 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // ;. float tmpvar + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // _2 = 0;. tmpvar + 0x5f, 0x32, 0x20, 0x3d, 0x20, 0x28, 0x61, 0x62, 0x73, 0x28, 0x64, 0x66, 0x64, 0x78, 0x28, 0x74, // _2 = (abs(dfdx(t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x29, 0x29, 0x20, 0x2b, 0x20, 0x61, 0x62, // mpvar_1.x)) + ab + 0x73, 0x28, 0x64, 0x66, 0x64, 0x79, 0x28, 0x2d, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // s(dfdy(-tmpvar_1 + 0x2e, 0x78, 0x29, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x65, // .x)));. float e + 0x64, 0x67, 0x65, 0x30, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x65, 0x64, // dge0_3 = 0;. ed + 0x67, 0x65, 0x30, 0x5f, 0x33, 0x20, 0x3d, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2d, 0x20, 0x74, // ge0_3 = (0.5 - t + 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x32, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, // mpvar_2);. floa + 0x74, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // t tmpvar_4 = 0;. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x3d, 0x20, 0x63, 0x6c, 0x61, // tmpvar_4 = cla + 0x6d, 0x70, 0x20, 0x28, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // mp (((tmpvar_1.x + 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, 0x33, 0x29, 0x20, 0x2f, 0x20, 0x28, 0x0a, // - edge0_3) / (. + 0x20, 0x20, 0x20, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x20, 0x2b, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // (0.5 + tmpva + 0x72, 0x5f, 0x32, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x2d, 0x20, 0x65, 0x64, 0x67, 0x65, 0x30, 0x5f, // r_2). - edge0_ + 0x33, 0x29, 0x29, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // 3)), 0.0, 1.0);. + 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, // _mtl_o.gl_Frag + 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x28, 0x63, // Color = float4(c + 0x6c, 0x61, 0x6d, 0x70, 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, // lamp ((tmpvar_4 + 0x2a, 0x20, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x20, 0x2a, 0x20, 0x0a, 0x20, // * (tmpvar_4 * . + 0x20, 0x20, 0x20, 0x28, 0x33, 0x2e, 0x30, 0x20, 0x2d, 0x20, 0x28, 0x32, 0x2e, 0x30, 0x20, 0x2a, // (3.0 - (2.0 * + 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x34, 0x29, 0x29, 0x0a, 0x20, 0x20, 0x29, 0x29, // tmpvar_4)). )) + 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x20, 0x20, // , 0.0, 1.0));. + 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, // return _mtl_o;.} + 0x0a, 0x0a, 0x00, // ... }; extern const uint8_t* fs_texture_sdf_pssl; extern const uint32_t fs_texture_sdf_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/fs_texture_sdf.sc b/3rdparty/bgfx/tools/texturev/fs_texture_sdf.sc index b0c6fdc1d86..1a0f0bbaeed 100644 --- a/3rdparty/bgfx/tools/texturev/fs_texture_sdf.sc +++ b/3rdparty/bgfx/tools/texturev/fs_texture_sdf.sc @@ -1,7 +1,7 @@ $input v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -15,6 +15,9 @@ void main() vec4 fgColor = vec4(1.0, 1.0, 1.0, 1.0); float sigDist = texture2DLod(s_texColor, v_texcoord0.xy, u_textureLod).x; - float opacity = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0); + float width = fwidth(sigDist); + float edge = 0.5; + float opacity = clamp(smoothstep(edge - width, edge + width, sigDist), 0.0, 1.0); + gl_FragColor = mix(bgColor, fgColor, opacity); } diff --git a/3rdparty/bgfx/tools/texturev/makefile b/3rdparty/bgfx/tools/texturev/makefile index 733ae658a22..c5c113b7579 100644 --- a/3rdparty/bgfx/tools/texturev/makefile +++ b/3rdparty/bgfx/tools/texturev/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause # diff --git a/3rdparty/bgfx/tools/texturev/texturev.cpp b/3rdparty/bgfx/tools/texturev/texturev.cpp index ff4d93311a9..edd3b9b1a6b 100644 --- a/3rdparty/bgfx/tools/texturev/texturev.cpp +++ b/3rdparty/bgfx/tools/texturev/texturev.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -50,7 +50,7 @@ namespace stl = tinystl; #define IMAGE_VIEW_ID 1 #define BGFX_TEXTUREV_VERSION_MAJOR 1 -#define BGFX_TEXTUREV_VERSION_MINOR 0 +#define BGFX_TEXTUREV_VERSION_MINOR 1 const float kEvMin = -10.0f; const float kEvMax = 20.0f; @@ -76,6 +76,7 @@ static const char* s_supportedExt[] = "dds", "exr", "gif", + "gnf", "jpg", "jpeg", "hdr", @@ -95,6 +96,7 @@ struct Binding App, View, Help, + About, Count }; @@ -187,11 +189,18 @@ static const InputBinding s_bindingHelp[] = INPUT_BINDING_END }; +static const InputBinding s_bindingAbout[] = +{ + { entry::Key::Esc, entry::Modifier::None, 1, NULL, "view about" }, + INPUT_BINDING_END +}; + static const char* s_bindingName[] = { "App", "View", "Help", + "About", }; BX_STATIC_ASSERT(Binding::Count == BX_COUNTOF(s_bindingName) ); @@ -200,6 +209,7 @@ static const InputBinding* s_binding[] = s_bindingApp, s_bindingView, s_bindingHelp, + s_bindingAbout, }; BX_STATIC_ASSERT(Binding::Count == BX_COUNTOF(s_binding) ); @@ -225,15 +235,21 @@ struct View , m_flipH(0.0f) , m_flipV(0.0f) , m_transitionTime(1.0f) + , m_width(1280) + , m_height(720) , m_filter(true) , m_fit(true) , m_alpha(false) , m_help(false) + , m_about(false) , m_info(false) , m_files(false) , m_sdf(false) + , m_inLinear(false) { load(); + + m_textureInfo.format = bgfx::TextureFormat::Count; } ~View() @@ -308,7 +324,7 @@ struct View float ev = m_ev; bx::fromString(&ev, _argv[2]); - m_ev = bx::fclamp(ev, kEvMin, kEvMax); + m_ev = bx::clamp(ev, kEvMin, kEvMax); } else { @@ -406,7 +422,7 @@ struct View m_zoom = zoom; } - m_zoom = bx::fclamp(m_zoom, 0.01f, 10.0f); + m_zoom = bx::clamp(m_zoom, 0.01f, 10.0f); } else { @@ -430,7 +446,7 @@ struct View m_angle = bx::toRad(angle); } - m_angle = bx::fwrap(m_angle, bx::kPi*2.0f); + m_angle = bx::wrap(m_angle, bx::kPi*2.0f); } else { @@ -478,7 +494,7 @@ struct View { float time; bx::fromString(&time, _argv[2]); - m_transitionTime = bx::fclamp(time, 0.0f, 5.0f); + m_transitionTime = bx::clamp(time, 0.0f, 5.0f); } else { @@ -574,6 +590,10 @@ struct View { m_help ^= true; } + else if (0 == bx::strCmp(_argv[1], "about") ) + { + m_about ^= true; + } else if (0 == bx::strCmp(_argv[1], "save") ) { save(); @@ -616,10 +636,11 @@ struct View { if (0 == (item->d_type & DT_DIR) ) { - const char* ext = bx::strRFind(item->d_name, '.'); - if (NULL != ext) + const bx::StringView fileName(item->d_name); + bx::StringView ext = bx::strRFind(fileName, '.'); + if (!ext.isEmpty() ) { - ext += 1; + ext.set(ext.getPtr()+1, fileName.getTerm() ); bool supported = false; for (uint32_t ii = 0; ii < BX_COUNTOF(s_supportedExt); ++ii) { @@ -679,6 +700,16 @@ struct View { m_transitionTime = 1.0f; } + + if (!bx::fromString(&m_width, settings.get("view/width") ) ) + { + m_width = 1280; + } + + if (!bx::fromString(&m_height, settings.get("view/height") ) ) + { + m_height = 720; + } } } @@ -695,6 +726,12 @@ struct View bx::toString(tmp, sizeof(tmp), m_transitionTime); settings.set("view/transition", tmp); + bx::toString(tmp, sizeof(tmp), m_width); + settings.set("view/width", tmp); + + bx::toString(tmp, sizeof(tmp), m_height); + settings.set("view/height", tmp); + bx::FileWriter writer; if (bx::open(&writer, filePath) ) { @@ -729,13 +766,17 @@ struct View float m_flipH; float m_flipV; float m_transitionTime; + uint32_t m_width; + uint32_t m_height; bool m_filter; bool m_fit; bool m_alpha; bool m_help; + bool m_about; bool m_info; bool m_files; bool m_sdf; + bool m_inLinear; }; int cmdView(CmdContext* /*_context*/, void* _userData, int _argc, char const* const* _argv) @@ -957,23 +998,31 @@ struct InterpolatorT float getValue() { - - if (duration > 0.0) + if (isActive() ) { const double freq = double(bx::getHPFrequency() ); int64_t now = bx::getHPCounter(); float time = (float)(double(now - offset) / freq); - float lerp = bx::fclamp(time, 0.0, duration) / duration; + float lerp = bx::clamp(time, 0.0f, duration) / duration; return lerpT(from, to, easeT(lerp) ); } return to; } + + bool isActive() const + { + const double freq = double(bx::getHPFrequency() ); + int64_t now = bx::getHPCounter(); + float time = (float)(double(now - offset) / freq); + float lerp = bx::clamp(time, 0.0f, duration) / duration; + return lerp < 1.0f; + } }; -typedef InterpolatorT Interpolator; +typedef InterpolatorT Interpolator; typedef InterpolatorT InterpolatorAngle; -typedef InterpolatorT InterpolatorLinear; +typedef InterpolatorT InterpolatorLinear; void keyBindingHelp(const char* _bindings, const char* _description) { @@ -1046,6 +1095,8 @@ void associate() bx::stringPrintf(str, "xdg-mime default texturev.desktop image/%s\n", ext); } + bx::stringPrintf(str, "xdg-mime default texturev.desktop image/x-dds\n"); + str += "\n"; bx::FileWriter writer; @@ -1076,7 +1127,7 @@ void help(const char* _error = NULL) fprintf(stderr , "texturev, bgfx texture viewer tool, version %d.%d.%d.\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" + "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" , BGFX_TEXTUREV_VERSION_MAJOR , BGFX_TEXTUREV_VERSION_MINOR @@ -1131,10 +1182,7 @@ int _main_(int _argc, char** _argv) return bx::kExitFailure; } - uint32_t width = 1280; - uint32_t height = 720; - uint32_t debug = BGFX_DEBUG_TEXT; - uint32_t reset = BGFX_RESET_VSYNC; + uint32_t debug = BGFX_DEBUG_TEXT; inputAddBindings(s_bindingName[Binding::App], s_binding[Binding::App]); inputAddBindings(s_bindingName[Binding::View], s_binding[Binding::View]); @@ -1142,8 +1190,15 @@ int _main_(int _argc, char** _argv) View view; cmdAdd("view", cmdView, &view); - bgfx::init(); - bgfx::reset(width, height, reset); + entry::setWindowFlags(entry::WindowHandle{0}, ENTRY_WINDOW_FLAG_ASPECT_RATIO, false); + entry::setWindowSize(entry::WindowHandle{0}, view.m_width, view.m_height); + + bgfx::Init init; + init.resolution.width = view.m_width; + init.resolution.width = view.m_height; + init.resolution.reset = BGFX_RESET_VSYNC; + + bgfx::init(init); // Set view 0 clear state. bgfx::setViewClear(BACKGROUND_VIEW_ID @@ -1220,9 +1275,9 @@ int _main_(int _argc, char** _argv) checkerBoard = bgfx::createTexture2D(checkerBoardSize, checkerBoardSize, false, 1 , bgfx::TextureFormat::BGRA8 , 0 - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_MAG_POINT + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_MAG_POINT , mem ); } @@ -1230,6 +1285,7 @@ int _main_(int _argc, char** _argv) float speed = 0.37f; float time = 0.0f; + Interpolator menuFade(5.0f); Interpolator mip(0.0f); Interpolator layer(0.0f); InterpolatorLinear ev(0.0f); @@ -1241,6 +1297,24 @@ int _main_(int _argc, char** _argv) InterpolatorAngle angx(0.0f); InterpolatorAngle angy(0.0f); + auto anyActive = [&]() -> bool + { + return false + || ImGui::MouseOverArea() + || menuFade.isActive() + || mip.isActive() + || layer.isActive() + || ev.isActive() + || zoom.isActive() + || scale.isActive() + || posx.isActive() + || posy.isActive() + || angle.isActive() + || angx.isActive() + || angy.isActive() + ; + }; + const char* filePath = _argc < 2 ? "" : _argv[1]; std::string path = filePath; @@ -1252,106 +1326,88 @@ int _main_(int _argc, char** _argv) int exitcode = bx::kExitSuccess; bgfx::TextureHandle texture = BGFX_INVALID_HANDLE; - if (view.m_fileList.empty() ) - { - exitcode = bx::kExitFailure; - if (2 > _argc) - { - help("File path is not specified."); - } - else - { - fprintf(stderr, "Unable to load '%s' texture.\n", filePath); - } - } - else { uint32_t fileIndex = 0; bool dragging = false; + entry::WindowState windowState; entry::MouseState mouseStatePrev; - entry::MouseState mouseState; - while (!entry::processEvents(width, height, debug, reset, &mouseState) ) + while (!entry::processWindowEvents(windowState, debug, init.resolution.reset) ) { + const entry::MouseState& mouseState = windowState.m_mouse; + view.m_width = windowState.m_width; + view.m_height = windowState.m_height; + + if (!windowState.m_dropFile.isEmpty() ) + { + view.updateFileList(windowState.m_dropFile); + windowState.m_dropFile.clear(); + } + imguiBeginFrame(mouseState.m_mx , mouseState.m_my , (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0) | (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0) | (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0) , mouseState.m_mz - , uint16_t(width) - , uint16_t(height) + , uint16_t(view.m_width) + , uint16_t(view.m_height) ); - static bool help = false; - static bool mouseDelta = false; - if (!mouseDelta) + bool modalWindow = view.m_help || view.m_about; + bool overArea = false + || ImGui::GetMousePos().y <= ImGui::GetTextLineHeightWithSpacing() + || ImGui::MouseOverArea() + ; + overArea &= !modalWindow; + + if (overArea) { - mouseStatePrev = mouseState; - mouseDelta = true; + menuFade.set(5.0f, 0.25f); + } + else if (modalWindow) + { + menuFade.reset(0.0f); + } + else + { + menuFade.set(0.0f, 2.0f); } - int32_t zoomDelta = mouseState.m_mz - mouseStatePrev.m_mz; - if (zoomDelta != 0) + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, bx::clamp(menuFade.getValue(), 0.0f, 1.0f) ); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f); + + if (ImGui::BeginMainMenuBar() ) { - char exec[64]; - bx::snprintf(exec, BX_COUNTOF(exec), "view zoom %+f", -zoomDelta*0.1f); - cmdExec(exec); - } - - const float xDelta = float(mouseStatePrev.m_mx - mouseState.m_mx); - const float yDelta = float(mouseStatePrev.m_my - mouseState.m_my); - - if (!ImGui::MouseOverArea() - && !help - && mouseState.m_buttons[entry::MouseButton::Left] != mouseStatePrev.m_buttons[entry::MouseButton::Left]) - { - dragging = !!mouseState.m_buttons[entry::MouseButton::Left]; - } - - if (dragging) - { - if (view.m_textureInfo.cubeMap - && Geometry::Quad == view.m_cubeMapGeo) + if (ImGui::BeginMenu("File")) { - char exec[64]; - bx::snprintf(exec, BX_COUNTOF(exec), "view cubemap %+f %+f", -yDelta, -xDelta); - cmdExec(exec); - } - else - { - char exec[64]; - bx::snprintf(exec, BX_COUNTOF(exec), "view pan %+f %+f", xDelta, yDelta); - cmdExec(exec); - } - } + if (ImGui::MenuItem("Show File List", NULL, view.m_files) ) + { + cmdExec("view files"); + } - mouseStatePrev = mouseState; + ImGui::Separator(); + if (ImGui::MenuItem("Exit") ) + { + cmdExec("exit"); + } - if (ImGui::BeginPopupContextVoid("Menu") ) - { - if (ImGui::MenuItem("Files", NULL, view.m_files) ) - { - cmdExec("view files"); + ImGui::EndMenu(); } - if (ImGui::MenuItem("Info", NULL, view.m_info) ) + if (ImGui::BeginMenu("View") ) { - cmdExec("view info"); - } + if (ImGui::MenuItem("Info", NULL, view.m_info) ) + { + cmdExec("view info"); + } -// if (ImGui::MenuItem("Save As") ) - { - } + if (ImGui::MenuItem("Reset") ) + { + cmdExec(s_resetCmd); + } - if (ImGui::MenuItem("Reset") ) - { - cmdExec(s_resetCmd); - } - - ImGui::Separator(); - if (ImGui::BeginMenu("Options")) - { + ImGui::Separator(); bool filter = view.m_filter; if (ImGui::MenuItem("Filter", NULL, &filter) ) { @@ -1424,21 +1480,107 @@ int _main_(int _argc, char** _argv) ImGui::EndMenu(); } - ImGui::Separator(); - if (ImGui::MenuItem("Help") ) + if (ImGui::BeginMenu("Help") ) { - cmdExec("view help"); + if (ImGui::MenuItem("View Help") ) + { + cmdExec("view help"); + } + + ImGui::Separator(); + if (ImGui::MenuItem("About") ) + { + cmdExec("view about"); + } + + ImGui::EndMenu(); } - ImGui::Separator(); - if (ImGui::MenuItem("Exit") ) + if (0 != view.m_fileList.size() ) { - cmdExec("exit"); + ImGui::Separator(); + ImGui::TextColored( + ImVec4(0.0f, 1.0f, 1.0f, 1.0f) + , view.m_fileList[view.m_fileIndex].c_str() + ); + + ImGui::Separator(); + const char* name = ""; + if (view.m_textureInfo.cubeMap) + { + name = " CubeMap"; + } + else if (1 < view.m_textureInfo.depth) + { + name = " 3D"; + view.m_textureInfo.numLayers = view.m_textureInfo.depth; + } + else if (1 < view.m_textureInfo.numLayers) + { + name = " 2D Array"; + } + + ImGui::Text("%d x %d%s, mips: %d, layers %d, %s" + , view.m_textureInfo.width + , view.m_textureInfo.height + , name + , view.m_textureInfo.numMips + , view.m_textureInfo.numLayers + , bimg::getName(bimg::TextureFormat::Enum(view.m_textureInfo.format) ) + ); } - ImGui::EndPopup(); + ImGui::EndMainMenuBar(); } + ImGui::PopStyleVar(2); + + static bool help = false; + static bool about = false; + static bool mouseDelta = false; + if (!mouseDelta) + { + mouseStatePrev = mouseState; + mouseDelta = true; + } + + int32_t zoomDelta = overArea ? 0 : mouseState.m_mz - mouseStatePrev.m_mz; + if (zoomDelta != 0) + { + char exec[64]; + bx::snprintf(exec, BX_COUNTOF(exec), "view zoom %+f", -zoomDelta*0.1f); + cmdExec(exec); + } + + const float xDelta = float(mouseStatePrev.m_mx - mouseState.m_mx); + const float yDelta = float(mouseStatePrev.m_my - mouseState.m_my); + + if (!overArea + && !help + && mouseState.m_buttons[entry::MouseButton::Left] != mouseStatePrev.m_buttons[entry::MouseButton::Left]) + { + dragging = !!mouseState.m_buttons[entry::MouseButton::Left]; + } + + if (dragging) + { + if (view.m_textureInfo.cubeMap + && Geometry::Quad == view.m_cubeMapGeo) + { + char exec[64]; + bx::snprintf(exec, BX_COUNTOF(exec), "view cubemap %+f %+f", -yDelta, -xDelta); + cmdExec(exec); + } + else + { + char exec[64]; + bx::snprintf(exec, BX_COUNTOF(exec), "view pan %+f %+f", xDelta, yDelta); + cmdExec(exec); + } + } + + mouseStatePrev = mouseState; + if (help != view.m_help) { if (!help) @@ -1456,60 +1598,105 @@ int _main_(int _argc, char** _argv) help = view.m_help; } + if (about != view.m_about) + { + if (!about) + { + ImGui::OpenPopup("About"); + inputRemoveBindings(s_bindingName[Binding::View]); + inputAddBindings(s_bindingName[Binding::About], s_binding[Binding::About]); + } + else + { + inputRemoveBindings(s_bindingName[Binding::About]); + inputAddBindings(s_bindingName[Binding::View], s_binding[Binding::View]); + } + + about = view.m_about; + } + if (view.m_info) { - if (ImGui::Begin("Info", NULL, ImVec2(300.0f, 200.0f) ) ) + ImGui::SetNextWindowSize( + ImVec2(300.0f, 320.0f) + , ImGuiCond_FirstUseEver + ); + + if (ImGui::Begin("Info", &view.m_info) ) { if (ImGui::BeginChild("##info", ImVec2(0.0f, 0.0f) ) ) { - ImGui::Text("Dimensions: %d x %d" - , view.m_textureInfo.width - , view.m_textureInfo.height - ); + if (!bgfx::isValid(texture) ) + { + ImGui::Text("Texture is not loaded."); + } + else + { + ImGui::Text("Name: %s", view.m_fileList[view.m_fileIndex].c_str() ); - ImGui::Text("Format: %s" - , bimg::getName(bimg::TextureFormat::Enum(view.m_textureInfo.format) ) - ); + ImGui::Text("Dimensions: %d x %d" + , view.m_textureInfo.width + , view.m_textureInfo.height + ); - ImGui::Text("Layers: %d / %d" - , view.m_layer - , view.m_textureInfo.numLayers - 1 - ); + ImGui::Text("Format: %s" + , bimg::getName(bimg::TextureFormat::Enum(view.m_textureInfo.format) ) + ); - ImGui::Text("Mips: %d / %d" - , view.m_mip - , view.m_textureInfo.numMips - 1 - ); + uint32_t numLayers = view.m_textureInfo.numLayers; + if (1 < view.m_textureInfo.depth) + { + numLayers = bx::max(1, view.m_textureInfo.depth >> view.m_mip); + } + view.m_layer = bx::clamp(view.m_layer, 0, numLayers - 1); + ImGui::SliderInt("Layer", (int32_t*)&view.m_layer, 0, numLayers - 1); + ImGui::SliderInt("Mip", (int32_t*)&view.m_mip, 0, view.m_textureInfo.numMips - 1); - ImGui::RangeSliderFloat("EV range", &view.m_evMin, &view.m_evMax, kEvMin, kEvMax); - ImGui::SliderFloat("EV", &view.m_ev, view.m_evMin, view.m_evMax); + ImGui::Separator(); + + ImGui::Checkbox("Input linear", &view.m_inLinear); + ImGui::RangeSliderFloat("EV range", &view.m_evMin, &view.m_evMax, kEvMin, kEvMax); + ImGui::SliderFloat("EV", &view.m_ev, view.m_evMin, view.m_evMax); + + ImGui::Separator(); + + ImGui::Checkbox("Fit to window", &view.m_fit); + ImGui::SliderFloat("Scale", &view.m_zoom, 0.01f, 10.0f); + } ImGui::EndChild(); } - ImGui::End(); } + + ImGui::End(); } if (view.m_files) { char temp[bx::kMaxFilePath]; bx::snprintf(temp, BX_COUNTOF(temp), "%s##File", view.m_path.get() ); - if (ImGui::Begin(temp, NULL, ImVec2(400.0f, 400.0f) ) ) + + ImGui::SetNextWindowSize( + ImVec2(400.0f, 400.0f) + , ImGuiCond_FirstUseEver + ); + + if (ImGui::Begin(temp, &view.m_files) ) { if (ImGui::BeginChild("##file_list", ImVec2(0.0f, 0.0f) ) ) { ImGui::PushFont(ImGui::Font::Mono); const float itemHeight = ImGui::GetTextLineHeightWithSpacing(); const float listHeight = - std::max(1.0f, bx::ffloor(ImGui::GetWindowHeight()/itemHeight) ) + bx::max(1.0f, bx::floor(ImGui::GetWindowHeight()/itemHeight) ) * itemHeight ; ImGui::PushItemWidth(-1); if (ImGui::ListBoxHeader("##empty", ImVec2(0.0f, listHeight) ) ) { - const int32_t itemCount = int32_t(view.m_fileList.size() ); + const int32_t itemCount = int32_t(view.m_fileList.size() ); int32_t start, end; ImGui::CalcListClipping(itemCount, itemHeight, &start, &end); @@ -1547,25 +1734,39 @@ int _main_(int _argc, char** _argv) ImGui::PopFont(); ImGui::EndChild(); } - - ImGui::End(); } + + ImGui::End(); } - if (ImGui::BeginPopupModal("Help", NULL, ImGuiWindowFlags_AlwaysAutoResize) ) + if (ImGui::BeginPopupModal("About", &view.m_about, ImGuiWindowFlags_AlwaysAutoResize) ) { ImGui::SetWindowFontScale(1.0f); ImGui::Text( "texturev, bgfx texture viewer tool " ICON_KI_WRENCH ", version %d.%d.%d.\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" + "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n" , BGFX_TEXTUREV_VERSION_MAJOR , BGFX_TEXTUREV_VERSION_MINOR , BGFX_API_VERSION ); - ImGui::Separator(); - ImGui::NextLine(); + + ImGui::Dummy(ImVec2(0.0f, 0.0f) ); + ImGui::SameLine(ImGui::GetWindowWidth() - 136.0f); + if (ImGui::Button("Close", ImVec2(128.0f, 0.0f) ) + || !view.m_about) + { + view.m_about = false; + ImGui::CloseCurrentPopup(); + } + + ImGui::EndPopup(); + } + + if (ImGui::BeginPopupModal("Help", &view.m_help, ImGuiWindowFlags_AlwaysAutoResize) ) + { + ImGui::SetWindowFontScale(1.0f); ImGui::Text("Key bindings:\n\n"); @@ -1619,8 +1820,8 @@ int _main_(int _argc, char** _argv) imguiEndFrame(); - if (!bgfx::isValid(texture) - || view.m_fileIndex != fileIndex) + if ( (!bgfx::isValid(texture) || view.m_fileIndex != fileIndex) + && 0 != view.m_fileList.size() ) { if (bgfx::isValid(texture) ) { @@ -1635,25 +1836,32 @@ int _main_(int _argc, char** _argv) bimg::Orientation::Enum orientation; texture = loadTexture(fp.get() , 0 - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP - | BGFX_TEXTURE_W_CLAMP + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP + | BGFX_SAMPLER_W_CLAMP , 0 , &view.m_textureInfo , &orientation ); - switch (orientation) + bimg::TextureFormat::Enum format = bimg::TextureFormat::Enum(view.m_textureInfo.format); + + if (format < bimg::TextureFormat::Count) { - default: - case bimg::Orientation::R0: cmdExec("view orientation\nview orientation z 0"); break; - case bimg::Orientation::R90: cmdExec("view orientation\nview orientation z -90"); break; - case bimg::Orientation::R180: cmdExec("view orientation\nview orientation z -180"); break; - case bimg::Orientation::R270: cmdExec("view orientation\nview orientation z -270"); break; - case bimg::Orientation::HFlip: cmdExec("view orientation\nview orientation x -180"); break; - case bimg::Orientation::HFlipR90: cmdExec("view orientation\nview orientation z -90\nview orientation x -180"); break; - case bimg::Orientation::HFlipR270: cmdExec("view orientation\nview orientation z -270\nview orientation x -180"); break; - case bimg::Orientation::VFlip: cmdExec("view orientation\nview orientation y -180"); break; + view.m_inLinear = bimg::isFloat(format); + + switch (orientation) + { + default: + case bimg::Orientation::R0: cmdExec("view orientation\nview orientation z 0"); break; + case bimg::Orientation::R90: cmdExec("view orientation\nview orientation z -90"); break; + case bimg::Orientation::R180: cmdExec("view orientation\nview orientation z -180"); break; + case bimg::Orientation::R270: cmdExec("view orientation\nview orientation z -270"); break; + case bimg::Orientation::HFlip: cmdExec("view orientation\nview orientation x -180"); break; + case bimg::Orientation::HFlipR90: cmdExec("view orientation\nview orientation z -90\nview orientation x -180"); break; + case bimg::Orientation::HFlipR270: cmdExec("view orientation\nview orientation z -270\nview orientation x -180"); break; + case bimg::Orientation::VFlip: cmdExec("view orientation\nview orientation y -180"); break; + } } std::string title; @@ -1688,6 +1896,7 @@ int _main_(int _argc, char** _argv) { bx::stringPrintf(title, "Failed to load %s!", filePath); } + entry::WindowHandle handle = { 0 }; entry::setWindowTitle(handle, title.c_str() ); } @@ -1710,8 +1919,8 @@ int _main_(int _argc, char** _argv) bx::mtxOrtho( ortho , 0.0f - , float(width) - , float(height) + , float(view.m_width) + , float(view.m_height) , 0.0f , 0.0f , 1000.0f @@ -1719,24 +1928,24 @@ int _main_(int _argc, char** _argv) , caps->homogeneousDepth ); bgfx::setViewTransform(BACKGROUND_VIEW_ID, NULL, ortho); - bgfx::setViewRect(BACKGROUND_VIEW_ID, 0, 0, uint16_t(width), uint16_t(height) ); + bgfx::setViewRect(BACKGROUND_VIEW_ID, 0, 0, uint16_t(view.m_width), uint16_t(view.m_height) ); setGeometry(Geometry::Quad , 0 , 0 - , width - , height - , view.m_alpha ? UINT32_MAX : 0 - , float(width )/float(checkerBoardSize) - , float(height)/float(checkerBoardSize) + , view.m_width + , view.m_height + , view.m_alpha || !bgfx::isValid(texture) ? UINT32_MAX : 0 + , float(view.m_width )/float(checkerBoardSize) + , float(view.m_height)/float(checkerBoardSize) ); bgfx::setTexture(0 , s_texColor , checkerBoard ); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A ); bgfx::submit(BACKGROUND_VIEW_ID , textureProgram @@ -1746,17 +1955,17 @@ int _main_(int _argc, char** _argv) float py = posy.getValue(); bx::mtxOrtho( ortho - , px-width/2.0f - , px+width/2.0f - , py+height/2.0f - , py-height/2.0f + , px-view.m_width/2.0f + , px+view.m_width/2.0f + , py+view.m_height/2.0f + , py-view.m_height/2.0f , -10.0f , 10.0f , 0.0f , caps->homogeneousDepth ); bgfx::setViewTransform(IMAGE_VIEW_ID, NULL, ortho); - bgfx::setViewRect(IMAGE_VIEW_ID, 0, 0, uint16_t(width), uint16_t(height) ); + bgfx::setViewRect(IMAGE_VIEW_ID, 0, 0, uint16_t(view.m_width), uint16_t(view.m_height) ); bgfx::dbgTextClear(); @@ -1768,11 +1977,11 @@ int _main_(int _argc, char** _argv) float wh[3] = { float(view.m_textureInfo.width), float(view.m_textureInfo.height), 0.0f }; float result[3]; bx::vec3MulMtx(result, wh, orientation); - result[0] = bx::fround(bx::fabs(result[0]) ); - result[1] = bx::fround(bx::fabs(result[1]) ); + result[0] = bx::round(bx::abs(result[0]) ); + result[1] = bx::round(bx::abs(result[1]) ); - scale.set(bx::fmin(float(width) / result[0] - , float(height) / result[1]) + scale.set(bx::min(float(view.m_width) / result[0] + , float(view.m_height) / result[1]) , 0.1f*view.m_transitionTime ); } @@ -1808,22 +2017,22 @@ int _main_(int _argc, char** _argv) layer.set(float(view.m_layer), 0.25f*view.m_transitionTime); ev.set(view.m_ev, 0.5f*view.m_transitionTime); - float params[4] = { mip.getValue(), layer.getValue(), 0.0f, ev.getValue() }; + float params[4] = { mip.getValue(), layer.getValue(), view.m_inLinear ? 1.0f : 0.0f, ev.getValue() }; if (1 < view.m_textureInfo.depth) { - params[1] = layer.getValue()/view.m_textureInfo.depth; + params[1] = layer.getValue()/float(bx::max(1, view.m_textureInfo.depth >> view.m_mip) ); } bgfx::setUniform(u_params, params); const uint32_t textureFlags = 0 - | BGFX_TEXTURE_U_CLAMP - | BGFX_TEXTURE_V_CLAMP - | BGFX_TEXTURE_W_CLAMP + | BGFX_SAMPLER_U_CLAMP + | BGFX_SAMPLER_V_CLAMP + | BGFX_SAMPLER_W_CLAMP | (view.m_filter ? 0 : 0 - | BGFX_TEXTURE_MIN_POINT - | BGFX_TEXTURE_MIP_POINT - | BGFX_TEXTURE_MAG_POINT + | BGFX_SAMPLER_MIN_POINT + | BGFX_SAMPLER_MIP_POINT + | BGFX_SAMPLER_MAG_POINT ) ; @@ -1833,8 +2042,8 @@ int _main_(int _argc, char** _argv) , textureFlags ); bgfx::setState(0 - | BGFX_STATE_RGB_WRITE - | BGFX_STATE_ALPHA_WRITE + | BGFX_STATE_WRITE_RGB + | BGFX_STATE_WRITE_A | (view.m_alpha ? BGFX_STATE_BLEND_ALPHA : BGFX_STATE_NONE) ); @@ -1866,9 +2075,23 @@ int _main_(int _argc, char** _argv) } } - bgfx::submit(IMAGE_VIEW_ID, program); + if (bgfx::isValid(texture) ) + { + bgfx::submit(IMAGE_VIEW_ID, program); + } + else + { + bgfx::discard(); + } bgfx::frame(); + + // Slow down when nothing is animating... + if (!dragging + && !anyActive() ) + { + bx::sleep(100); + } } } @@ -1886,6 +2109,7 @@ int _main_(int _argc, char** _argv) bgfx::destroy(textureCubeProgram); bgfx::destroy(textureCube2Program); bgfx::destroy(textureSdfProgram); + bgfx::destroy(textureMsdfProgram); bgfx::destroy(texture3DProgram); imguiDestroy(); diff --git a/3rdparty/bgfx/tools/texturev/vs_texture.bin.h b/3rdparty/bgfx/tools/texturev/vs_texture.bin.h index 91284dcef7c..9f9ee0d9644 100644 --- a/3rdparty/bgfx/tools/texturev/vs_texture.bin.h +++ b/3rdparty/bgfx/tools/texturev/vs_texture.bin.h @@ -1,353 +1,229 @@ -static const uint8_t vs_texture_glsl[434] = +static const uint8_t vs_texture_glsl[396] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x8d, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ....attribute hi - 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 a_color - 0x30, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, // 0;.attribute hig - 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // hp vec3 a_positi - 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // on;.attribute hi - 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // ghp vec3 a_texco - 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, // ord0;.varying hi - 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 v_color - 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 0;.varying highp - 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec3 v_texcoord - 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 0;.uniform highp + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, // _modelViewProj.. + 0x00, 0x00, 0x01, 0x00, 0x63, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, // ....c...attribut + 0x65, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // e vec4 a_color0; + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, // .attribute vec3 + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, // a_position;.attr + 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, // ibute vec3 a_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, // coord0;.varying + 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, // vec4 v_color0;.v + 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, // arying vec3 v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // xcoord0;.uniform 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // mat4 u_modelVie 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, // wProj;.void main - 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // ().{. highp ve - 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c4 tmpvar_1;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, // mpvar_1.zw = vec - 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, // 2(0.0, 1.0);. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, // mpvar_1.xy = a_p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // osition.xy;. gl - 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, // _Position = (u_m - 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, // odelViewProj * t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x74, 0x65, // mpvar_1);. v_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // xcoord0 = a_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // oord0;. v_color - 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, // 0 = a_color0;.}. - 0x0a, 0x00, // .. + 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // ().{. vec4 tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_1;. tmpvar_ + 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, // 1.zw = vec2(0.0, + 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // 1.0);. tmpvar_ + 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // 1.xy = a_positio + 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // n.xy;. gl_Posit + 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // ion = (u_modelVi + 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ewProj * tmpvar_ + 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // 1);. v_texcoord + 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, // 0 = a_texcoord0; + 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, // . v_color0 = a_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // color0;.}... }; -static const uint8_t vs_texture_spv[3189] = +static const uint8_t vs_texture_spv[1266] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x50, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, // P.....#......... - 0x37, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 7b.............. - 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std - 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... - 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x78, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // x...Output...... - 0x78, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // x.......gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion.....x....... - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x78, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // x.......v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, // n(vf4;vf3;vf3;.. - 0x05, 0x00, 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ....O...a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........:...a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, // sition.......M.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ........$Global. - 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // ewRect.......... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ............u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew.............. - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0x00, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ........u_proj.. - 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, // vProj........... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ............u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0x00, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ........u_model. - 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ............u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, // delView......... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj............. - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, // _modelViewProj.. + 0x00, 0x00, 0x04, 0x00, 0xc0, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // ..........#..... + 0x07, 0x00, 0x08, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, // ............GLSL + 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, // .std.450........ + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, // ....main....=... + 0x41, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, // A...D...O...R... + 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, // V............... + 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, // ........main.... + 0x05, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ....%...$Global. + 0x06, 0x00, 0x07, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ....%.......u_mo + 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, // delViewProj..... + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3d, 0x00, 0x00, 0x00, // '...........=... 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent + 0x41, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // A...a_position.. + 0x05, 0x00, 0x05, 0x00, 0x44, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....D...a_texcoo + 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // rd0.....O...@ent 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO + 0x52, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // R...@entryPointO 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo + 0x05, 0x00, 0x0a, 0x00, 0x56, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....V...@entryPo 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, // oord0...G....... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ....@...H....... + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // oord0...H...%... + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x25, 0x00, 0x00, 0x00, // ........H...%... 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ........#....... - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0x00, 0x09, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x00, 0x09, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0x00, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x00, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ................ - 0x48, 0x00, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H............... - 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...........#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H........... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, // ........H....... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0x00, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ........G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x78, 0x04, 0x00, 0x00, // ............x... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x44, 0x09, 0x00, 0x00, 0x78, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, // D...x........... - 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xf5, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x78, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // x........... ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, // ...?,........... - 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,.......,....... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... - 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // .......+....... - 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x08, 0x04, 0x00, 0x00, // j... ........... - 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x00, 0x09, 0x00, 0x00, // e...j........... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ........e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0x08, 0x04, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....e...e....... - 0x20, 0x00, 0x04, 0x00, 0x7d, 0x0b, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, // ...}........... - 0x3b, 0x00, 0x04, 0x00, 0x7d, 0x0b, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;...}...B....... - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // +.......)....... - 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ...........e... - 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;.......v....... - 0x20, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... - 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ........Sa..;... - 0xf5, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .....U......;... - 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .....8......;... - 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... - 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....A......=... - 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....?......=... - 0x18, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ....@,......>... - 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, // .U...A..>....8.. - 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, // .?..>.......@,.. - 0x39, 0x00, 0x07, 0x00, 0x78, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x9e, 0x15, 0x00, 0x00, // 9...x...I&...... - 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .U...8......>... - 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // ....I&..A....... - 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // T4..........=... - 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ........T4..>... - 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........A....... - 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .@..........=... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .... ....@..>... - 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, // v... ...A....... - 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .@..........=... - 0x18, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .....-...@..>... - 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, // .....-......8... - 0x36, 0x00, 0x05, 0x00, 0x78, 0x04, 0x00, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6...x........... - 0x44, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, // D...7.......O... - 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // 7.......:...7... - 0x95, 0x02, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x5f, 0x57, 0x00, 0x00, // .....M......_W.. - 0x3b, 0x00, 0x04, 0x00, 0xf5, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A.......d-...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, // ....>...d-...... - 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........8...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x00, // ....>....8..,... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x19, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, // =...........:... - 0x4f, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0xbe, 0x2f, 0x00, 0x00, 0x10, 0x19, 0x00, 0x00, // O......../...... - 0x10, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // ............Q... - 0x0d, 0x00, 0x00, 0x00, 0x36, 0x62, 0x00, 0x00, 0xbe, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6b.../...... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x98, 0x1b, 0x00, 0x00, 0xbe, 0x2f, 0x00, 0x00, // Q............/.. - 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, // ....P........2.. - 0x36, 0x62, 0x00, 0x00, 0x98, 0x1b, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // 6b.............. - 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, // A.......),..B... - 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, // )...=...e....<.. - 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, // ),...........;.. - 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // .2...<..A....... - 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // _8..........>... - 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // _8...;..=....... - 0x1d, 0x21, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, // .!...M..A....... - 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // -<..........>... - 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // -<...!..=....... - 0x1e, 0x21, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // .!..O...A....... - 0x2e, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .<..........>... - 0x2e, 0x3c, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x78, 0x04, 0x00, 0x00, // .<...!..=...x... - 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, // G:..........G:.. - 0x38, 0x00, 0x01, 0x00, 0x00, // 8.... + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // %............... + 0x47, 0x00, 0x03, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // G...%.......G... + 0x27, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // '...".......G... + 0x3d, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // =...........G... + 0x41, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // A...........G... + 0x44, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // D...........G... + 0x4f, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // O...........G... + 0x52, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // R...........G... + 0x56, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, // V............... + 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....!........... + 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ........ ....... + 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ................ + 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ................ + 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... + 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, // ...........?+... + 0x06, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // ............+... + 0x14, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ + 0x24, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, // $............... + 0x25, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, // %...$... ...&... + 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, // ....%...;...&... + 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x28, 0x00, 0x00, 0x00, // '....... ...(... + 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....$... ...<... + 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3c, 0x00, 0x00, 0x00, // ........;...<... + 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, // =....... ...@... + 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, // ........;...@... + 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x40, 0x00, 0x00, 0x00, // A.......;...@... + 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, // D....... ...N... + 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, // ........;...N... + 0x4f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4e, 0x00, 0x00, 0x00, // O.......;...N... + 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, // R....... ...U... + 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x55, 0x00, 0x00, 0x00, // ........;...U... + 0x56, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, // V.......6....... + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // ................ + 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, // ....=.......>... + 0x3d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, // =...=.......B... + 0x41, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, // A...=.......E... + 0x44, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, // D...Q.......o... + 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // B.......Q....... + 0x70, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // p...B.......P... + 0x07, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, // ....q...o...p... + 0x1a, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x28, 0x00, 0x00, 0x00, // ........A...(... + 0x72, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // r...'.......=... + 0x24, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // $...s...r....... + 0x07, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, // ....t...q...s... + 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, // Q.......{...t... + 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, // ............|... + 0x7b, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, // {...R........... + 0x7c, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // |...t.......>... + 0x4f, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x52, 0x00, 0x00, 0x00, // O.......>...R... + 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x56, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, // >...>...V...E... + 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, // ....8........... + 0x40, 0x00, // @. }; -static const uint8_t vs_texture_dx9[329] = +static const uint8_t vs_texture_dx9[333] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x24, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x21, 0x00, 0x43, 0x54, 0x41, 0x42, // $.........!.CTAB - 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, // ....W........... - 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ........P...0... - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........@....... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. - 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, // vs_3_0.Microsoft - 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // (R) HLSL Shader - 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, // Compiler 10.1.. - 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, // ................ - 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, // ................ - 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ................ - 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ......U......... - 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, // ................ - 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, // ................ - 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x07, 0xe0, // ................ - 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ......... + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, // _modelViewProj.. + 0x00, 0x00, 0x04, 0x00, 0x24, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x21, 0x00, // ....$.........!. + 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, // CTAB....W....... + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ............P... + 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // 0...........@... + 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP + 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, // roj............. + 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....vs_3_0.Micro + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x31, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // .1.............. + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ + 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ + 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, // ..........U..... + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................ + 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, // ................ + 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, // ................ + 0x02, 0x00, 0x07, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. }; -static const uint8_t vs_texture_dx11[582] = +static const uint8_t vs_texture_dx11[586] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x18, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xa1, 0x0d, 0xa3, 0xb8, 0x34, 0x19, 0x93, 0x74, // ....DXBC....4..t - 0x94, 0x6c, 0x61, 0x11, 0xe8, 0x09, 0x5f, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, // .la..._,........ - 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, // ....,........... - 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNh........... - 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // P............... - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........V....... - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00, // ................ - 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // _............... - 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, // ........COLOR.PO - 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, // SITION.TEXCOORD. - 0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // OSGNl........... - 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // P............... - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ - 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // b............... - 0x02, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT - 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, // ION.COLOR.TEXCOO - 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x44, 0x52, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, // RD..SHDR....@... - 0x40, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // @...Y...F. ..... - 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ...._........... - 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, // _...2......._... - 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, // r.......g.... .. - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, // ........e.... .. - 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....e...r ...... - 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, // h.......8....... - 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // ....V.......F. . - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, // ........2....... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. ......... - 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F....... - 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ..... ......F... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....F. ......... - 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // 6.... ......F... - 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....6...r ...... - 0x46, 0x12, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, // F.......>....... - 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ....@. + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, // _modelViewProj.. + 0x00, 0x00, 0x04, 0x00, 0x18, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0xa1, 0x0d, 0xa3, 0xb8, // ........DXBC.... + 0x34, 0x19, 0x93, 0x74, 0x94, 0x6c, 0x61, 0x11, 0xe8, 0x09, 0x5f, 0x2c, 0x01, 0x00, 0x00, 0x00, // 4..t.la..._,.... + 0x18, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // ........,....... + 0x10, 0x01, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....ISGNh....... + 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....P........... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, // ............V... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x07, 0x03, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...._........... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // ............COLO + 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, // R.POSITION.TEXCO + 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ORD.OSGNl....... + 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....P........... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....b........... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, // ............SV_P + 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, // OSITION.COLOR.TE + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x44, 0x52, 0x00, 0x01, 0x00, 0x00, // XCOORD..SHDR.... + 0x40, 0x00, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, // @...@...Y...F. . + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, // ........_....... + 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ...._...2....... + 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, // _...r.......g... + 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // . ..........e... + 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, 0x10, 0x00, // . ......e...r .. + 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, // ....h.......8... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........V....... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, // F. .........2... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F. ..... + 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ............F... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ......... ...... + 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // F.......F. ..... + 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....6.... ...... + 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, // F.......6...r .. + 0x02, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>... + 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ........@. }; -static const uint8_t vs_texture_mtl[793] = +static const uint8_t vs_texture_mtl[775] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0xf4, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, // ....using namesp - 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // ace metal;.struc - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // t xlatMtlShaderI - 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // nput {. float4 - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, // a_color0 [[attri - 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // bute(0)]];. flo - 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, // at3 a_position [ - 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, // [attribute(1)]]; - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // . float3 a_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, // oord0 [[attribut - 0x65, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // e(2)]];.};.struc - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 - 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, // gl_Position [[p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // osition]];. flo - 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, // at4 v_color0;. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // float3 v_texcoor - 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, // d0;.};.struct xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, // atMtlShaderUnifo - 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, // rm {. float4x4 - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, // u_modelViewProj; - 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.vertex xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, // tlShaderOutput x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, // latMtlMain (xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, // MtlShaderInput _ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, // mtl_i [[stage_in - 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // ]], constant xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor - 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, // m& _mtl_u [[buff - 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, // er(0)]]).{. xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // _mtl_o;. float - 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_1 = 0;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, // tmpvar_1.zw = - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, // float2(0.0, 1.0) - 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, // ;. tmpvar_1.xy - 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, // = _mtl_i.a_posit - 0x69, 0x6f, 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // ion.xy;. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, // .gl_Position = ( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // _mtl_u.u_modelVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ewProj * tmpvar_ - 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, // 1);. _mtl_o.v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // excoord0 = _mtl_ - 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, // i.a_texcoord0;. - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_o.v_color0 - 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // = _mtl_i.a_colo - 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // r0;. return _mt - 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xf4, 0x02, // VSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, // ut {. float4 a_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, // color0 [[attribu + 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // te(0)]];. float + 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, // 3 a_position [[a + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // ttribute(1)]];. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float3 a_texcoo + 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, // rd0 [[attribute( + 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // 2)]];.};.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut + 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // put {. float4 g + 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, // l_Position [[pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // ition]];. float + 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // 4 v_color0;. fl + 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // oat3 v_texcoord0 + 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ;.};.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, // {. float4x4 u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, // modelViewProj;.} + 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // ;.vertex xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, // ShaderOutput xla + 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // tMtlMain (xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, // lShaderInput _mt + 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, // l_i [[stage_in]] + 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // , constant xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, // tlShaderUniform& + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, // _mtl_u [[buffer + 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // (0)]]).{. xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, // tlShaderOutput _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // mtl_o;. float4 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_1 = 0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x7a, 0x77, 0x20, 0x3d, 0x20, 0x66, 0x6c, // tmpvar_1.zw = fl + 0x6f, 0x61, 0x74, 0x32, 0x28, 0x30, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, // oat2(0.0, 1.0);. + 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x20, 0x3d, 0x20, // tmpvar_1.xy = + 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, // _mtl_i.a_positio + 0x6e, 0x2e, 0x78, 0x79, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // n.xy;. _mtl_o.g + 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, // l_Position = (_m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // tl_u.u_modelView + 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, // Proj * tmpvar_1) + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, // ;. _mtl_o.v_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // coord0 = _mtl_i. + 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // a_texcoord0;. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // mtl_o.v_color0 = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_i.a_color0 + 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ;. return _mtl_ + 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // o;.}... }; extern const uint8_t* vs_texture_pssl; extern const uint32_t vs_texture_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/vs_texture.sc b/3rdparty/bgfx/tools/texturev/vs_texture.sc index 9aff8ef4ca1..e5a1df84083 100644 --- a/3rdparty/bgfx/tools/texturev/vs_texture.sc +++ b/3rdparty/bgfx/tools/texturev/vs_texture.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0, a_color0 $output v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bgfx/tools/texturev/vs_texture_cube.bin.h b/3rdparty/bgfx/tools/texturev/vs_texture_cube.bin.h index 05cbbc8b213..e66ba7320db 100644 --- a/3rdparty/bgfx/tools/texturev/vs_texture_cube.bin.h +++ b/3rdparty/bgfx/tools/texturev/vs_texture_cube.bin.h @@ -1,352 +1,232 @@ -static const uint8_t vs_texture_cube_glsl[420] = +static const uint8_t vs_texture_cube_glsl[382] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x7f, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // ....attribute hi - 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 a_color - 0x30, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, 0x67, // 0;.attribute hig - 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // hp vec3 a_positi - 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x68, 0x69, // on;.attribute hi - 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, // ghp vec3 a_texco - 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, // ord0;.varying hi - 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ghp vec4 v_color - 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 0;.varying highp - 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // vec3 v_texcoord - 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, // 0;.uniform highp + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, // _modelViewProj.. + 0x00, 0x00, 0x01, 0x00, 0x55, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, // ....U...attribut + 0x65, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // e vec4 a_color0; + 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, // .attribute vec3 + 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, // a_position;.attr + 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, // ibute vec3 a_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, // coord0;.varying + 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, // vec4 v_color0;.v + 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, // arying vec3 v_te + 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // xcoord0;.uniform 0x20, 0x6d, 0x61, 0x74, 0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // mat4 u_modelVie 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, // wProj;.void main - 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x20, 0x76, 0x65, // ().{. highp ve - 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, // c4 tmpvar_1;. t - 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, // mpvar_1.w = 1.0; - 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, // . tmpvar_1.xyz - 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, // = a_position;. - 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, // gl_Position = (u - 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, // _modelViewProj * - 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, // tmpvar_1);. v_ - 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x74, 0x65, // texcoord0 = a_te - 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, // xcoord0;. v_col - 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // or0 = a_color0;. - 0x7d, 0x0a, 0x0a, 0x00, // }... + 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, // ().{. vec4 tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // var_1;. tmpvar_ + 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, // 1.w = 1.0;. tmp + 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x70, 0x6f, // var_1.xyz = a_po + 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, // sition;. gl_Pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, // ition = (u_model + 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // ViewProj * tmpva + 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // r_1);. v_texcoo + 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, // rd0 = a_texcoord + 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, 0x20, // 0;. v_color0 = + 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // a_color0;.}... }; -static const uint8_t vs_texture_cube_spv[3165] = +static const uint8_t vs_texture_cube_spv[1270] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0x38, 0x0c, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, // 8.....#......... - 0x36, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, // 6b.............. - 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, // ........GLSL.std - 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // .450............ - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, // ................ - 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, // main............ - 0x95, 0x0e, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........v....... - 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ................ - 0x1f, 0x16, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, // ....main........ - 0x78, 0x04, 0x00, 0x00, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // x...Output...... - 0x78, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, // x.......gl_Posit - 0x69, 0x6f, 0x6e, 0x00, 0x06, 0x00, 0x06, 0x00, 0x78, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ion.....x....... - 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, // v_color0........ - 0x78, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // x.......v_texcoo - 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x07, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x40, 0x6d, 0x61, 0x69, // rd0.........@mai - 0x6e, 0x28, 0x76, 0x66, 0x34, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x76, 0x66, 0x33, 0x3b, 0x00, 0x00, // n(vf4;vf3;vf3;.. - 0x05, 0x00, 0x05, 0x00, 0x4f, 0x2e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // ....O...a_color0 - 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // ........:...a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb9, 0x4d, 0x00, 0x00, // sition.......M.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x0f, 0x12, 0x00, 0x00, 0x5f, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, // ...._varying_... - 0x05, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ....^...$Global. - 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ....^.......u_vi - 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, // ewRect......^... - 0x01, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, // ....u_viewTexel. - 0x06, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, // ....^.......u_vi - 0x65, 0x77, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ew......^....... - 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // u_invView....... - 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ^.......u_proj.. - 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ....^.......u_in - 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, // vProj.......^... - 0x06, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, // ....u_viewProj.. - 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x69, 0x6e, // ....^.......u_in - 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x05, 0x00, // vViewProj....... - 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, // ^.......u_model. - 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ....^.......u_mo - 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x06, 0x00, 0x07, 0x00, 0x5e, 0x05, 0x00, 0x00, // delView.....^... - 0x0a, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP - 0x72, 0x6f, 0x6a, 0x00, 0x06, 0x00, 0x06, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, // roj.....^....... - 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, 0x34, 0x00, 0x05, 0x00, 0x03, 0x00, // u_alphaRef4..... - 0x42, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xb8, 0x41, 0x00, 0x00, // B............A.. + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, // _modelViewProj.. + 0x00, 0x00, 0x04, 0x00, 0xc4, 0x04, 0x00, 0x00, 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // ..........#..... + 0x07, 0x00, 0x08, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, // ................ + 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x4c, 0x53, 0x4c, // ............GLSL + 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, // .std.450........ + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ + 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, // ....main....<... + 0x40, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, // @...C...N...Q... + 0x55, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, // U............... + 0x05, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, // ........main.... + 0x05, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00, // ....$...$Global. + 0x06, 0x00, 0x07, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, // ....$.......u_mo + 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x05, 0x00, 0x03, 0x00, // delViewProj..... + 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x3c, 0x00, 0x00, 0x00, // &...........<... 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, // a_color0........ - 0x89, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, 0x00, 0x00, // ....a_color0.... - 0x05, 0x00, 0x05, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, // .....?..a_positi - 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, // on..........a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x40, 0x2c, 0x00, 0x00, // sition......@,.. - 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x05, 0x00, // a_texcoord0..... - 0x95, 0x0e, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, // ....a_texcoord0. - 0x05, 0x00, 0x05, 0x00, 0x08, 0x10, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x54, // ........flattenT - 0x65, 0x6d, 0x70, 0x00, 0x05, 0x00, 0x04, 0x00, 0x85, 0x55, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // emp......U..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x95, 0x38, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m........8..para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, // m...........para - 0x6d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x95, 0x15, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // m...........@ent + 0x40, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, // @...a_position.. + 0x05, 0x00, 0x05, 0x00, 0x43, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // ....C...a_texcoo + 0x72, 0x64, 0x30, 0x00, 0x05, 0x00, 0x0a, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, // rd0.....N...@ent 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x67, 0x6c, // ryPointOutput.gl 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x09, 0x00, // _Position....... - 0x76, 0x13, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // v...@entryPointO + 0x51, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x4f, // Q...@entryPointO 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x00, 0x00, // utput.v_color0.. - 0x05, 0x00, 0x0a, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ........@entryPo + 0x05, 0x00, 0x0a, 0x00, 0x55, 0x00, 0x00, 0x00, 0x40, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, // ....U...@entryPo 0x69, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, // intOutput.v_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, // oord0...G....... - 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ....@...H...^... + 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, // oord0...H...$... + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x24, 0x00, 0x00, 0x00, // ........H...$... 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x5e, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^.......#....... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0x20, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ...H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x03, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0x5e, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0xa0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ....H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x05, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x5e, 0x05, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0x20, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, // ...H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x07, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#...`...H... - 0x5e, 0x05, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0xa0, 0x01, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ....H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x09, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, // ....#.......H... - 0x5e, 0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // ^............... - 0x48, 0x00, 0x04, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // H...^........... - 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // H...^.......#... - 0xe0, 0x09, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // ....H...^....... - 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x05, 0x00, 0x5e, 0x05, 0x00, 0x00, // ........H...^... - 0x0b, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x47, 0x00, 0x03, 0x00, // ....#... ...G... - 0x5e, 0x05, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x42, 0x13, 0x00, 0x00, // ^.......G...B... - 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x89, 0x14, 0x00, 0x00, // ".......G....... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0xa6, 0x14, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x0e, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x95, 0x15, 0x00, 0x00, // ........G....... - 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x76, 0x13, 0x00, 0x00, // ........G...v... - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x8b, 0x17, 0x00, 0x00, // ........G....... - 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, // ................ - 0x21, 0x00, 0x03, 0x00, 0x02, 0x05, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, // !............... - 0x0d, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, // .... ........... - 0x0d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, // ................ - 0x0d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x95, 0x02, 0x00, 0x00, // ........ ....... - 0x07, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x05, 0x00, 0x78, 0x04, 0x00, 0x00, // ............x... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x21, 0x00, 0x06, 0x00, // ............!... - 0x44, 0x09, 0x00, 0x00, 0x78, 0x04, 0x00, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, // D...x........... - 0x95, 0x02, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0xf5, 0x06, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // .... ........... - 0x78, 0x04, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // x........... ... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, // ....+........... - 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ....+........... - 0x00, 0x00, 0x80, 0x3f, 0x2c, 0x00, 0x07, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, // ...?,........... - 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, // ................ - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // +............... - 0x2b, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // +............... - 0x2c, 0x00, 0x06, 0x00, 0x18, 0x00, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, // ,.......,....... - 0x0c, 0x0a, 0x00, 0x00, 0x0c, 0x0a, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, // ........+....... - 0x0b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, 0x65, 0x00, 0x00, 0x00, // ............e... - 0x1d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // ................ - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, // .......+....... - 0x6a, 0x0a, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0x00, 0xab, 0x03, 0x00, 0x00, // j... ........... - 0x65, 0x00, 0x00, 0x00, 0x6a, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x5e, 0x05, 0x00, 0x00, // e...j.......^... - 0x1d, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ........e...e... - 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // e...e...e...e... - 0xab, 0x03, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ....e...e....... - 0x20, 0x00, 0x04, 0x00, 0xdb, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5e, 0x05, 0x00, 0x00, // ...........^... - 0x3b, 0x00, 0x04, 0x00, 0xdb, 0x07, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ;.......B....... - 0x2b, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, // +.......)....... - 0x20, 0x00, 0x04, 0x00, 0xe2, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, // ...........e... - 0x20, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9b, 0x02, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x96, 0x02, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ;............... - 0x20, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x95, 0x15, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x3b, 0x00, 0x04, 0x00, 0x9c, 0x02, 0x00, 0x00, 0x76, 0x13, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;.......v....... - 0x20, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, // ............... - 0x3b, 0x00, 0x04, 0x00, 0x97, 0x02, 0x00, 0x00, 0x8b, 0x17, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ;............... - 0x36, 0x00, 0x05, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6............... - 0x02, 0x05, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x53, 0x61, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ........Sa..;... - 0xf5, 0x06, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // ............;... - 0x9a, 0x02, 0x00, 0x00, 0x85, 0x55, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .....U......;... - 0x95, 0x02, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, // .....8......;... - 0x95, 0x02, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ............=... - 0x1d, 0x00, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x89, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....A......=... - 0x18, 0x00, 0x00, 0x00, 0xd9, 0x3f, 0x00, 0x00, 0xa6, 0x14, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .....?......=... - 0x18, 0x00, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, 0x95, 0x0e, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ....@,......>... - 0x85, 0x55, 0x00, 0x00, 0xb8, 0x41, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x95, 0x38, 0x00, 0x00, // .U...A..>....8.. - 0xd9, 0x3f, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x40, 0x2c, 0x00, 0x00, // .?..>.......@,.. - 0x39, 0x00, 0x07, 0x00, 0x78, 0x04, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x9e, 0x15, 0x00, 0x00, // 9...x...I&...... - 0x85, 0x55, 0x00, 0x00, 0x95, 0x38, 0x00, 0x00, 0x9a, 0x16, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .U...8......>... - 0x08, 0x10, 0x00, 0x00, 0x49, 0x26, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // ....I&..A....... - 0x54, 0x34, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0b, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // T4..........=... - 0x1d, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x54, 0x34, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // ........T4..>... - 0x95, 0x15, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, // ........A....... - 0xee, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x0e, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .@..........=... - 0x1d, 0x00, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0xee, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .... ....@..>... - 0x76, 0x13, 0x00, 0x00, 0x20, 0x1f, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, // v... ...A....... - 0xef, 0x40, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x11, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // .@..........=... - 0x18, 0x00, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xef, 0x40, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // .....-...@..>... - 0x8b, 0x17, 0x00, 0x00, 0x13, 0x2d, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, // .....-......8... - 0x36, 0x00, 0x05, 0x00, 0x78, 0x04, 0x00, 0x00, 0x9e, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 6...x........... - 0x44, 0x09, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, // D...7.......O... - 0x37, 0x00, 0x03, 0x00, 0x95, 0x02, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, 0x37, 0x00, 0x03, 0x00, // 7.......:...7... - 0x95, 0x02, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x5f, 0x57, 0x00, 0x00, // .....M......_W.. - 0x3b, 0x00, 0x04, 0x00, 0xf5, 0x06, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, // ;............... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x64, 0x2d, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A.......d-...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x64, 0x2d, 0x00, 0x00, 0x04, 0x05, 0x00, 0x00, // ....>...d-...... - 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0b, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........8...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x0b, 0x38, 0x00, 0x00, 0x2c, 0x0a, 0x00, 0x00, // ....>....8..,... - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x3a, 0x19, 0x00, 0x00, // =.......5b..:... - 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3b, 0x3a, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, // Q.......;:..5b.. - 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0b, 0x47, 0x00, 0x00, // ....Q........G.. - 0x35, 0x62, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x0d, 0x00, 0x00, 0x00, // 5b......Q....... - 0x2b, 0x53, 0x00, 0x00, 0x35, 0x62, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x07, 0x00, // +S..5b......P... - 0x1d, 0x00, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0x3b, 0x3a, 0x00, 0x00, 0x0b, 0x47, 0x00, 0x00, // .....2..;:...G.. - 0x2b, 0x53, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, 0xe2, 0x02, 0x00, 0x00, // +S......A....... - 0x29, 0x2c, 0x00, 0x00, 0x42, 0x13, 0x00, 0x00, 0x29, 0x0a, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, // ),..B...)...=... - 0x65, 0x00, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, 0x29, 0x2c, 0x00, 0x00, 0x90, 0x00, 0x05, 0x00, // e....<..),...... - 0x1d, 0x00, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, 0x84, 0x32, 0x00, 0x00, 0xf3, 0x3c, 0x00, 0x00, // .....;...2...<.. - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A......._8...... - 0x0b, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x5f, 0x38, 0x00, 0x00, 0x9f, 0x3b, 0x00, 0x00, // ....>..._8...;.. - 0x3d, 0x00, 0x04, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, 0xb9, 0x4d, 0x00, 0x00, // =........!...M.. - 0x41, 0x00, 0x05, 0x00, 0x95, 0x02, 0x00, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A.......-<...... - 0x11, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2d, 0x3c, 0x00, 0x00, 0x1d, 0x21, 0x00, 0x00, // ....>...-<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, 0x4f, 0x2e, 0x00, 0x00, // =........!..O... - 0x41, 0x00, 0x05, 0x00, 0x9a, 0x02, 0x00, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // A........<...... - 0x0e, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x2e, 0x3c, 0x00, 0x00, 0x1e, 0x21, 0x00, 0x00, // ....>....<...!.. - 0x3d, 0x00, 0x04, 0x00, 0x78, 0x04, 0x00, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x0f, 0x12, 0x00, 0x00, // =...x...G:...... - 0xfe, 0x00, 0x02, 0x00, 0x47, 0x3a, 0x00, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, // ....G:..8.... + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, // $............... + 0x47, 0x00, 0x03, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // G...$.......G... + 0x26, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // &...".......G... + 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // <...........G... + 0x40, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // @...........G... + 0x43, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // C...........G... + 0x4e, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // N...........G... + 0x51, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, // Q...........G... + 0x55, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, // U............... + 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....!........... + 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ........ ....... + 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, // ................ + 0x09, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x04, 0x00, // ................ + 0x14, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x04, 0x00, // .... .......+... + 0x06, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x2b, 0x00, 0x04, 0x00, // ...........?+... + 0x14, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x04, 0x00, // ................ + 0x23, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0x00, // #............... + 0x24, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // $...#... ...%... + 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x25, 0x00, 0x00, 0x00, // ....$...;...%... + 0x26, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x27, 0x00, 0x00, 0x00, // &....... ...'... + 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // ....#... ...;... + 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3b, 0x00, 0x00, 0x00, // ........;...;... + 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, // <....... ...?... + 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, // ........;...?... + 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x3f, 0x00, 0x00, 0x00, // @.......;...?... + 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // C....... ...M... + 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // ........;...M... + 0x4e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x4d, 0x00, 0x00, 0x00, // N.......;...M... + 0x51, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, // Q....... ...T... + 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x54, 0x00, 0x00, 0x00, // ........;...T... + 0x55, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, // U.......6....... + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, // ................ + 0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, // ....=.......=... + 0x3c, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, // <...=.......A... + 0x40, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, // @...=.......D... + 0x43, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, // C...Q.......m... + 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, // A.......Q....... + 0x6e, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, // n...A.......Q... + 0x06, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ....o...A....... + 0x50, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, // P.......p...m... + 0x6e, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x41, 0x00, 0x05, 0x00, // n...o.......A... + 0x27, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, // '...q...&....... + 0x3d, 0x00, 0x04, 0x00, 0x23, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, // =...#...r...q... + 0x90, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, // ........s...p... + 0x72, 0x00, 0x00, 0x00, 0x51, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, // r...Q.......z... + 0x73, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, // s............... + 0x7b, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x52, 0x00, 0x06, 0x00, 0x07, 0x00, 0x00, 0x00, // {...z...R....... + 0x99, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....{...s....... + 0x3e, 0x00, 0x03, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, // >...N.......>... + 0x51, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x55, 0x00, 0x00, 0x00, // Q...=...>...U... + 0x44, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x38, 0x00, 0x01, 0x00, 0x00, 0x03, 0x05, 0x00, // D.......8....... + 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // ....@. }; -static const uint8_t vs_texture_cube_dx9[349] = +static const uint8_t vs_texture_cube_dx9[353] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x38, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x21, 0x00, 0x43, 0x54, 0x41, 0x42, // 8.........!.CTAB - 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, // ....W........... - 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, // ........P...0... - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........@....... - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, // u_modelViewProj. - 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, // vs_3_0.Microsoft - 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, // (R) HLSL Shader - 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, // Compiler 10.1.. - 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, // ................ - 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, // ................ - 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, // ................ - 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, // ................ - 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, // ......U......... - 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, // ................ - 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................ - 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, // ................ - 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, // ................ - 0x02, 0x00, 0x07, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00, // ............. + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, // _modelViewProj.. + 0x00, 0x00, 0x04, 0x00, 0x38, 0x01, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x21, 0x00, // ....8.........!. + 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, // CTAB....W....... + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ............P... + 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // 0...........@... + 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, // ....u_modelViewP + 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, // roj............. + 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....vs_3_0.Micro + 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh + 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x31, 0x30, // ader Compiler 10 + 0x2e, 0x31, 0x00, 0xab, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // .1.............. + 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................ + 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, // ................ + 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, // ................ + 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x07, 0xe0, 0x05, 0x00, 0x00, 0x03, // ................ + 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, // ..........U..... + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, // ................ + 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0xaa, 0x90, // ................ + 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, // ................ + 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, // ................ + 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, 0x07, 0xe0, 0x02, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, // ................ + 0x00, // . }; -static const uint8_t vs_texture_cube_dx11[622] = +static const uint8_t vs_texture_cube_dx11[626] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, // elViewProj...... - 0x40, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x52, 0x1b, 0xf0, 0x79, 0x87, 0x20, 0xa0, 0x2d, // @...DXBCR..y. .- - 0xbc, 0x22, 0x0f, 0xb3, 0x05, 0x0c, 0xbf, 0x92, 0x01, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, // ."..........@... - 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, // ....,........... - 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // ISGNh........... - 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // P............... - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........V....... - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, // ................ - 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // _............... - 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, // ........COLOR.PO - 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, // SITION.TEXCOORD. - 0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, // OSGNl........... - 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // P............... - 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................ - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................ - 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // b............... - 0x02, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT - 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, // ION.COLOR.TEXCOO - 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x44, 0x52, 0x28, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, // RD..SHDR(...@... - 0x4a, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // J...Y...F. ..... - 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ...._........... - 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, // _...r......._... - 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, // r.......g.... .. - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, // ........e.... .. - 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....e...r ...... - 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, // h.......8....... - 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // ....V.......F. . - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, // ........2....... - 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....F. ......... - 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F....... - 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // 2...........F. . - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ - 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, // F............ .. - 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, // ....F.......F. . - 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // ........6.... .. - 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // ....F.......6... - 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // r ......F....... - 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, 0x40, 0x00, // >...........@. + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, // VSH............u + 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x00, // _modelViewProj.. + 0x00, 0x00, 0x04, 0x00, 0x40, 0x02, 0x00, 0x00, 0x44, 0x58, 0x42, 0x43, 0x52, 0x1b, 0xf0, 0x79, // ....@...DXBCR..y + 0x87, 0x20, 0xa0, 0x2d, 0xbc, 0x22, 0x0f, 0xb3, 0x05, 0x0c, 0xbf, 0x92, 0x01, 0x00, 0x00, 0x00, // . .-.".......... + 0x40, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, // @.......,....... + 0x10, 0x01, 0x00, 0x00, 0x49, 0x53, 0x47, 0x4e, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ....ISGNh....... + 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....P........... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, // ............V... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x07, 0x07, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ...._........... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, // ............COLO + 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, // R.POSITION.TEXCO + 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x4e, 0x6c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ORD.OSGNl....... + 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ....P........... + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, // ................ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................ + 0x0f, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....b........... + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, // ............SV_P + 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, // OSITION.COLOR.TE + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x44, 0x52, 0x28, 0x01, 0x00, 0x00, // XCOORD..SHDR(... + 0x40, 0x00, 0x01, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00, // @...J...Y...F. . + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, // ........_....... + 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ...._...r....... + 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, // _...r.......g... + 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // . ..........e... + 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x72, 0x20, 0x10, 0x00, // . ......e...r .. + 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, // ....h.......8... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........V....... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, // F. .........2... + 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // ........F. ..... + 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // ............F... + 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2........... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, // F. ............. + 0x01, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, // ....F........... + 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // . ......F....... + 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // F. .........6... + 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // . ......F....... + 0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, // 6...r ......F... + 0x02, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x03, 0x05, 0x00, 0x01, 0x00, 0x10, 0x00, // ....>........... + 0x40, 0x00, // @. }; -static const uint8_t vs_texture_cube_mtl[777] = +static const uint8_t vs_texture_cube_mtl[759] = { - 0x56, 0x53, 0x48, 0x05, 0x01, 0x83, 0xf2, 0xe1, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH........u_mod - 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x04, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj...... - 0xe4, 0x02, 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, // ....using namesp - 0x61, 0x63, 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // ace metal;.struc - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, // t xlatMtlShaderI - 0x6e, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // nput {. float4 - 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, // a_color0 [[attri - 0x62, 0x75, 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // bute(0)]];. flo - 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, // at3 a_position [ - 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, // [attribute(1)]]; - 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // . float3 a_texc - 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, // oord0 [[attribut - 0x65, 0x28, 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, // e(2)]];.};.struc - 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, // t xlatMtlShaderO - 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, // utput {. float4 - 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, // gl_Position [[p - 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, // osition]];. flo - 0x61, 0x74, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, // at4 v_color0;. - 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, // float3 v_texcoor - 0x64, 0x30, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, // d0;.};.struct xl - 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, // atMtlShaderUnifo - 0x72, 0x6d, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, // rm {. float4x4 - 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, // u_modelViewProj; - 0x0a, 0x7d, 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // .};.vertex xlatM - 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, // tlShaderOutput x - 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, // latMtlMain (xlat - 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, // MtlShaderInput _ - 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, // mtl_i [[stage_in - 0x5d, 0x5d, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, // ]], constant xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, // tMtlShaderUnifor - 0x6d, 0x26, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, // m& _mtl_u [[buff - 0x65, 0x72, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, // er(0)]]).{. xla - 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, // tMtlShaderOutput - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // _mtl_o;. float - 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, // 4 tmpvar_1 = 0;. - 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, // tmpvar_1.w = 1 - 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, // .0;. tmpvar_1.x - 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, // yz = _mtl_i.a_po - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, // sition;. _mtl_o - 0x2e, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, // .gl_Position = ( - 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, // _mtl_u.u_modelVi - 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // ewProj * tmpvar_ - 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, // 1);. _mtl_o.v_t - 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // excoord0 = _mtl_ - 0x69, 0x2e, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, // i.a_texcoord0;. - 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_o.v_color0 - 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, // = _mtl_i.a_colo - 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, // r0;. return _mt - 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // l_o;.}... + 0x56, 0x53, 0x48, 0x06, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0xf2, 0xe1, 0x00, 0x00, 0xe4, 0x02, // VSH............. + 0x00, 0x00, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, // ..using namespac + 0x65, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x6c, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // e metal;.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, // xlatMtlShaderInp + 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x61, 0x5f, // ut {. float4 a_ + 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, // color0 [[attribu + 0x74, 0x65, 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // te(0)]];. float + 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x61, // 3 a_position [[a + 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, 0x31, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, // ttribute(1)]];. + 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, // float3 a_texcoo + 0x72, 0x64, 0x30, 0x20, 0x5b, 0x5b, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x28, // rd0 [[attribute( + 0x32, 0x29, 0x5d, 0x5d, 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, // 2)]];.};.struct + 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, // xlatMtlShaderOut + 0x70, 0x75, 0x74, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, 0x67, // put {. float4 g + 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x5b, 0x5b, 0x70, 0x6f, 0x73, // l_Position [[pos + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5d, 0x5d, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, // ition]];. float + 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, // 4 v_color0;. fl + 0x6f, 0x61, 0x74, 0x33, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, // oat3 v_texcoord0 + 0x3b, 0x0a, 0x7d, 0x3b, 0x0a, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, // ;.};.struct xlat + 0x4d, 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, // MtlShaderUniform + 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x78, 0x34, 0x20, 0x75, 0x5f, // {. float4x4 u_ + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x3b, 0x0a, 0x7d, // modelViewProj;.} + 0x3b, 0x0a, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, 0x6c, // ;.vertex xlatMtl + 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x78, 0x6c, 0x61, // ShaderOutput xla + 0x74, 0x4d, 0x74, 0x6c, 0x4d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x78, 0x6c, 0x61, 0x74, 0x4d, 0x74, // tMtlMain (xlatMt + 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x20, 0x5f, 0x6d, 0x74, // lShaderInput _mt + 0x6c, 0x5f, 0x69, 0x20, 0x5b, 0x5b, 0x73, 0x74, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x5d, 0x5d, // l_i [[stage_in]] + 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // , constant xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x26, // tlShaderUniform& + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x75, 0x20, 0x5b, 0x5b, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, // _mtl_u [[buffer + 0x28, 0x30, 0x29, 0x5d, 0x5d, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x78, 0x6c, 0x61, 0x74, 0x4d, // (0)]]).{. xlatM + 0x74, 0x6c, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x5f, // tlShaderOutput _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x3b, 0x0a, 0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x34, 0x20, // mtl_o;. float4 + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x30, 0x3b, 0x0a, 0x20, 0x20, // tmpvar_1 = 0;. + 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, // tmpvar_1.w = 1.0 + 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, // ;. tmpvar_1.xyz + 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, // = _mtl_i.a_posi + 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x67, // tion;. _mtl_o.g + 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x5f, 0x6d, // l_Position = (_m + 0x74, 0x6c, 0x5f, 0x75, 0x2e, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, // tl_u.u_modelView + 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, // Proj * tmpvar_1) + 0x3b, 0x0a, 0x20, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x74, 0x65, 0x78, // ;. _mtl_o.v_tex + 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, // coord0 = _mtl_i. + 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x5f, // a_texcoord0;. _ + 0x6d, 0x74, 0x6c, 0x5f, 0x6f, 0x2e, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // mtl_o.v_color0 = + 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, 0x69, 0x2e, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, // _mtl_i.a_color0 + 0x3b, 0x0a, 0x20, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x5f, 0x6d, 0x74, 0x6c, 0x5f, // ;. return _mtl_ + 0x6f, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00, // o;.}... }; extern const uint8_t* vs_texture_cube_pssl; extern const uint32_t vs_texture_cube_pssl_size; diff --git a/3rdparty/bgfx/tools/texturev/vs_texture_cube.sc b/3rdparty/bgfx/tools/texturev/vs_texture_cube.sc index fa081555d37..e5d82b89de7 100644 --- a/3rdparty/bgfx/tools/texturev/vs_texture_cube.sc +++ b/3rdparty/bgfx/tools/texturev/vs_texture_cube.sc @@ -2,7 +2,7 @@ $input a_position, a_texcoord0, a_color0 $output v_texcoord0, v_color0 /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ diff --git a/3rdparty/bimg/.appveyor.yml b/3rdparty/bimg/.appveyor.yml index b72256f290b..4d54558e367 100644 --- a/3rdparty/bimg/.appveyor.yml +++ b/3rdparty/bimg/.appveyor.yml @@ -5,7 +5,6 @@ os: environment: matrix: - - TOOLSET: vs2015 - TOOLSET: vs2017 configuration: diff --git a/3rdparty/bimg/.travis.yml b/3rdparty/bimg/.travis.yml index 9ca3a5ce83e..c656c72ade1 100644 --- a/3rdparty/bimg/.travis.yml +++ b/3rdparty/bimg/.travis.yml @@ -11,15 +11,15 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gcc-4.8 - - g++-4.8 + - gcc-5 + - g++-5 - clang before_script: git clone https://github.com/bkaradzic/bx ../bx script: - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make build CXX="g++-4.8" CC="gcc-4.8"; fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make build CXX="g++-5" CC="gcc-5"; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then make build; fi branches: @@ -29,4 +29,4 @@ branches: notifications: email: false -osx_image: xcode7.3 +osx_image: xcode9.3 diff --git a/3rdparty/bimg/3rdparty/astc/astc_averages_and_directions.cpp b/3rdparty/bimg/3rdparty/astc/astc_averages_and_directions.cpp new file mode 100644 index 00000000000..ece97d07fb1 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_averages_and_directions.cpp @@ -0,0 +1,627 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Implements functions for finding dominant direction of a set of + * colors, using ARM patent pending method. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +#include +#include "mathlib.h" + +#ifdef DEBUG_CAPTURE_NAN + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif + + #include +#endif + +/* routines to compute average colors and dominant directions for blocks with 3 and 4 components. */ + +/* + for a full block, functions to compute averages and dominant directions. The averages and directions are computed separately for each partition. + We have separate versions for blocks with and without alpha, since the processing for blocks with alpha is significantly more expensive. + The direction vectors it produces are NOT normalized. +*/ +void compute_averages_and_directions_rgba(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, + const float4 * color_scalefactors, + float4 * averages, float4 * directions_rgba, float3 * directions_gba, float3 * directions_rba, float3 * directions_rga, float3 * directions_rgb) +{ + int i; + int partition_count = pt->partition_count; + int partition; + + for (partition = 0; partition < partition_count; partition++) + { + const uint8_t *weights = pt->texels_of_partition[partition]; + int texelcount = pt->texels_per_partition[partition]; + + float4 base_sum = float4(0, 0, 0, 0); + float partition_weight = 0.0f; + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = ewb->texel_weight[iwt]; + float4 texel_datum = float4(blk->work_data[4 * iwt], + blk->work_data[4 * iwt + 1], + blk->work_data[4 * iwt + 2], + blk->work_data[4 * iwt + 3]) * weight; + partition_weight += weight; + + base_sum = base_sum + texel_datum; + } + + float4 average = base_sum * 1.0f / MAX(partition_weight, 1e-7f); + averages[partition] = average * color_scalefactors[partition]; + + + float4 sum_xp = float4(0, 0, 0, 0); + float4 sum_yp = float4(0, 0, 0, 0); + float4 sum_zp = float4(0, 0, 0, 0); + float4 sum_wp = float4(0, 0, 0, 0); + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = ewb->texel_weight[iwt]; + float4 texel_datum = float4(blk->work_data[4 * iwt], + blk->work_data[4 * iwt + 1], + blk->work_data[4 * iwt + 2], + blk->work_data[4 * iwt + 3]); + texel_datum = (texel_datum - average) * weight; + + if (texel_datum.x > 0.0f) + sum_xp = sum_xp + texel_datum; + if (texel_datum.y > 0.0f) + sum_yp = sum_yp + texel_datum; + if (texel_datum.z > 0.0f) + sum_zp = sum_zp + texel_datum; + if (texel_datum.w > 0.0f) + sum_wp = sum_wp + texel_datum; + } + + float prod_xp = dot(sum_xp, sum_xp); + float prod_yp = dot(sum_yp, sum_yp); + float prod_zp = dot(sum_zp, sum_zp); + float prod_wp = dot(sum_wp, sum_wp); + + float4 best_vector = sum_xp; + float best_sum = prod_xp; + if (prod_yp > best_sum) + { + best_vector = sum_yp; + best_sum = prod_yp; + } + if (prod_zp > best_sum) + { + best_vector = sum_zp; + best_sum = prod_zp; + } + if (prod_wp > best_sum) + { + best_vector = sum_wp; + best_sum = prod_wp; + } + + directions_rgba[partition] = best_vector; + directions_rgb[partition] = best_vector.xyz; + directions_rga[partition] = best_vector.xyw; + directions_rba[partition] = best_vector.xzw; + directions_gba[partition] = best_vector.yzw; + } +} + + + + +void compute_averages_and_directions_rgb(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, + const float4 * color_scalefactors, float3 * averages, float3 * directions_rgb, float2 * directions_rg, float2 * directions_rb, float2 * directions_gb) +{ + int i; + int partition_count = pt->partition_count; + int partition; + + const float *texel_weights = ewb->texel_weight_rgb; + + for (partition = 0; partition < partition_count; partition++) + { + const uint8_t *weights = pt->texels_of_partition[partition]; + int texelcount = pt->texels_per_partition[partition]; + + float3 base_sum = float3(0, 0, 0); + float partition_weight = 0.0f; + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = texel_weights[iwt]; + float3 texel_datum = float3(blk->work_data[4 * iwt], + blk->work_data[4 * iwt + 1], + blk->work_data[4 * iwt + 2]) * weight; + partition_weight += weight; + + base_sum = base_sum + texel_datum; + } + + float4 csf = color_scalefactors[partition]; + float3 average = base_sum * 1.0f / MAX(partition_weight, 1e-7f); + averages[partition] = average * csf.xyz; + + + float3 sum_xp = float3(0, 0, 0); + float3 sum_yp = float3(0, 0, 0); + float3 sum_zp = float3(0, 0, 0); + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = texel_weights[iwt]; + float3 texel_datum = float3(blk->work_data[4 * iwt], + blk->work_data[4 * iwt + 1], + blk->work_data[4 * iwt + 2]); + texel_datum = (texel_datum - average) * weight; + + if (texel_datum.x > 0.0f) + sum_xp = sum_xp + texel_datum; + if (texel_datum.y > 0.0f) + sum_yp = sum_yp + texel_datum; + if (texel_datum.z > 0.0f) + sum_zp = sum_zp + texel_datum; + } + + float prod_xp = dot(sum_xp, sum_xp); + float prod_yp = dot(sum_yp, sum_yp); + float prod_zp = dot(sum_zp, sum_zp); + + float3 best_vector = sum_xp; + float best_sum = prod_xp; + if (prod_yp > best_sum) + { + best_vector = sum_yp; + best_sum = prod_yp; + } + if (prod_zp > best_sum) + { + best_vector = sum_zp; + best_sum = prod_zp; + } + + directions_rgb[partition] = best_vector; + directions_gb[partition] = best_vector.yz; + directions_rb[partition] = best_vector.xz; + directions_rg[partition] = best_vector.xy; + } +} + +void compute_averages_and_directions_3_components(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, + const float3 * color_scalefactors, int component1, int component2, int component3, float3 * averages, float3 * directions) +{ + int i; + int partition_count = pt->partition_count; + int partition; + + const float *texel_weights; + if (component1 == 1 && component2 == 2 && component3 == 3) + texel_weights = ewb->texel_weight_gba; + else if (component1 == 0 && component2 == 2 && component3 == 3) + texel_weights = ewb->texel_weight_rba; + else if (component1 == 0 && component2 == 1 && component3 == 3) + texel_weights = ewb->texel_weight_rga; + else if (component1 == 0 && component2 == 1 && component3 == 2) + texel_weights = ewb->texel_weight_rgb; + else + { + texel_weights = ewb->texel_weight_gba; + ASTC_CODEC_INTERNAL_ERROR; + } + + + for (partition = 0; partition < partition_count; partition++) + { + const uint8_t *weights = pt->texels_of_partition[partition]; + int texelcount = pt->texels_per_partition[partition]; + + float3 base_sum = float3(0, 0, 0); + float partition_weight = 0.0f; + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = texel_weights[iwt]; + float3 texel_datum = float3(blk->work_data[4 * iwt + component1], + blk->work_data[4 * iwt + component2], + blk->work_data[4 * iwt + component3]) * weight; + partition_weight += weight; + + base_sum = base_sum + texel_datum; + } + + float3 csf = color_scalefactors[partition]; + + float3 average = base_sum * 1.0f / MAX(partition_weight, 1e-7f); + averages[partition] = average * csf.xyz; + + + float3 sum_xp = float3(0, 0, 0); + float3 sum_yp = float3(0, 0, 0); + float3 sum_zp = float3(0, 0, 0); + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = texel_weights[iwt]; + float3 texel_datum = float3(blk->work_data[4 * iwt + component1], + blk->work_data[4 * iwt + component2], + blk->work_data[4 * iwt + component3]); + texel_datum = (texel_datum - average) * weight; + + if (texel_datum.x > 0.0f) + sum_xp = sum_xp + texel_datum; + if (texel_datum.y > 0.0f) + sum_yp = sum_yp + texel_datum; + if (texel_datum.z > 0.0f) + sum_zp = sum_zp + texel_datum; + } + + float prod_xp = dot(sum_xp, sum_xp); + float prod_yp = dot(sum_yp, sum_yp); + float prod_zp = dot(sum_zp, sum_zp); + + float3 best_vector = sum_xp; + float best_sum = prod_xp; + if (prod_yp > best_sum) + { + best_vector = sum_yp; + best_sum = prod_yp; + } + if (prod_zp > best_sum) + { + best_vector = sum_zp; + best_sum = prod_zp; + } + + if (dot(best_vector, best_vector) < 1e-18) + best_vector = float3(1, 1, 1); + directions[partition] = best_vector; + } + +} + + + + +void compute_averages_and_directions_2_components(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, const float2 * color_scalefactors, int component1, int component2, float2 * averages, float2 * directions) +{ + int i; + int partition_count = pt->partition_count; + int partition; + + const float *texel_weights; + if (component1 == 0 && component2 == 1) + texel_weights = ewb->texel_weight_rg; + else if (component1 == 0 && component2 == 2) + texel_weights = ewb->texel_weight_rb; + else if (component1 == 1 && component2 == 2) + texel_weights = ewb->texel_weight_gb; + else + { + texel_weights = ewb->texel_weight_rg; + // unsupported set of color components. + ASTC_CODEC_INTERNAL_ERROR; + exit(1); + } + + + for (partition = 0; partition < partition_count; partition++) + { + const uint8_t *weights = pt->texels_of_partition[partition]; + int texelcount = pt->texels_per_partition[partition]; + + float2 base_sum = float2(0, 0); + float partition_weight = 0.0f; + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = texel_weights[iwt]; + float2 texel_datum = float2(blk->work_data[4 * iwt + component1], + blk->work_data[4 * iwt + component2]) * weight; + partition_weight += weight; + + base_sum = base_sum + texel_datum; + } + + float2 csf = color_scalefactors[partition]; + + float2 average = base_sum * 1.0f / MAX(partition_weight, 1e-7f); + averages[partition] = average * csf.xy; + + + float2 sum_xp = float2(0, 0); + float2 sum_yp = float2(0, 0); + + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float weight = texel_weights[iwt]; + float2 texel_datum = float2(blk->work_data[4 * iwt + component1], + blk->work_data[4 * iwt + component2]); + texel_datum = (texel_datum - average) * weight; + + if (texel_datum.x > 0.0f) + sum_xp = sum_xp + texel_datum; + if (texel_datum.y > 0.0f) + sum_yp = sum_yp + texel_datum; + } + + float prod_xp = dot(sum_xp, sum_xp); + float prod_yp = dot(sum_yp, sum_yp); + + float2 best_vector = sum_xp; + float best_sum = prod_xp; + if (prod_yp > best_sum) + { + best_vector = sum_yp; + best_sum = prod_yp; + } + + directions[partition] = best_vector; + } + +} + + +#define XPASTE(x,y) x##y +#define PASTE(x,y) XPASTE(x,y) + +#define TWO_COMPONENT_ERROR_FUNC( funcname, c0_iwt, c1_iwt, c01_name, c01_rname ) \ +float funcname( \ + const partition_info *pt, \ + const imageblock *blk, \ + const error_weight_block *ewb, \ + const processed_line2 *plines, \ + float *length_of_lines \ + ) \ + { \ + int i; \ + float errorsum = 0.0f; \ + int partition; \ + for(partition=0; partitionpartition_count; partition++) \ + { \ + const uint8_t *weights = pt->texels_of_partition[ partition ]; \ + int texelcount = pt->texels_per_partition[ partition ]; \ + float lowparam = 1e10f; \ + float highparam = -1e10f; \ + processed_line2 l = plines[partition]; \ + if( ewb->contains_zeroweight_texels ) \ + { \ + for(i=0;i PASTE(texel_weight_ , c01_rname) [i]; \ + if( texel_weight > 1e-20f ) \ + { \ + float2 point = float2(blk->work_data[4*iwt + c0_iwt], blk->work_data[4*iwt + c1_iwt] ); \ + float param = dot( point, l.bs ); \ + float2 rp1 = l.amod + param*l.bis; \ + float2 dist = rp1 - point; \ + float4 ews = ewb->error_weights[iwt]; \ + errorsum += dot( ews. c01_name, dist*dist ); \ + if( param < lowparam ) lowparam = param; \ + if( param > highparam ) highparam = param; \ + } \ + } \ + } \ + else \ + { \ + for(i=0;iwork_data[4*iwt + c0_iwt], blk->work_data[4*iwt + c1_iwt] ); \ + float param = dot( point, l.bs ); \ + float2 rp1 = l.amod + param*l.bis; \ + float2 dist = rp1 - point; \ + float4 ews = ewb->error_weights[iwt]; \ + errorsum += dot( ews. c01_name, dist*dist ); \ + if( param < lowparam ) lowparam = param; \ + if( param > highparam ) highparam = param; \ + } \ + } \ + float linelen = highparam - lowparam; \ + if( !(linelen > 1e-7f) ) \ + linelen = 1e-7f; \ + length_of_lines[partition] = linelen; \ + } \ + return errorsum; \ + } + + +TWO_COMPONENT_ERROR_FUNC(compute_error_squared_rg, 0, 1, xy, rg) +TWO_COMPONENT_ERROR_FUNC(compute_error_squared_rb, 0, 2, xz, rb) +TWO_COMPONENT_ERROR_FUNC(compute_error_squared_gb, 1, 2, yz, gb) +TWO_COMPONENT_ERROR_FUNC(compute_error_squared_ra, 0, 3, zw, ra) + +// function to compute the error across a tile when using a particular set of +// lines for a particular partitioning. Also compute the length of each +// color-space line in each partitioning. + +#define THREE_COMPONENT_ERROR_FUNC( funcname, c0_iwt, c1_iwt, c2_iwt, c012_name, c012_rname ) \ +float funcname( \ + const partition_info *pt, \ + const imageblock *blk, \ + const error_weight_block *ewb, \ + const processed_line3 *plines, \ + float *length_of_lines \ + ) \ + { \ + int i; \ + float errorsum = 0.0f; \ + int partition; \ + for(partition=0; partitionpartition_count; partition++) \ + { \ + const uint8_t *weights = pt->texels_of_partition[ partition ]; \ + int texelcount = pt->texels_per_partition[ partition ]; \ + float lowparam = 1e10f; \ + float highparam = -1e10f; \ + processed_line3 l = plines[partition]; \ + if( ewb->contains_zeroweight_texels ) \ + { \ + for(i=0;i PASTE(texel_weight_ , c012_rname) [i]; \ + if( texel_weight > 1e-20f ) \ + { \ + float3 point = float3(blk->work_data[4*iwt + c0_iwt], blk->work_data[4*iwt + c1_iwt], blk->work_data[4*iwt + c2_iwt] ); \ + float param = dot( point, l.bs ); \ + float3 rp1 = l.amod + param*l.bis; \ + float3 dist = rp1 - point; \ + float4 ews = ewb->error_weights[iwt]; \ + errorsum += dot( ews. c012_name, dist*dist ); \ + if( param < lowparam ) lowparam = param; \ + if( param > highparam ) highparam = param; \ + } \ + } \ + } \ + else \ + { \ + for(i=0;iwork_data[4*iwt + c0_iwt], blk->work_data[4*iwt + c1_iwt], blk->work_data[4*iwt + c2_iwt] ); \ + float param = dot( point, l.bs ); \ + float3 rp1 = l.amod + param*l.bis; \ + float3 dist = rp1 - point; \ + float4 ews = ewb->error_weights[iwt]; \ + errorsum += dot( ews. c012_name, dist*dist ); \ + if( param < lowparam ) lowparam = param; \ + if( param > highparam ) highparam = param; \ + } \ + } \ + float linelen = highparam - lowparam; \ + if( !(linelen > 1e-7f) ) \ + linelen = 1e-7f; \ + length_of_lines[partition] = linelen; \ + } \ + return errorsum; \ + } + +THREE_COMPONENT_ERROR_FUNC(compute_error_squared_gba, 1, 2, 3, yzw, gba) +THREE_COMPONENT_ERROR_FUNC(compute_error_squared_rba, 0, 2, 3, xzw, rba) +THREE_COMPONENT_ERROR_FUNC(compute_error_squared_rga, 0, 1, 3, xyw, rga) +THREE_COMPONENT_ERROR_FUNC(compute_error_squared_rgb, 0, 1, 2, xyz, rgb) + +float compute_error_squared_rgba(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line4 * plines, float *length_of_lines) +{ + int i; + + float errorsum = 0.0f; + int partition; + for (partition = 0; partition < pt->partition_count; partition++) + { + const uint8_t *weights = pt->texels_of_partition[partition]; + int texelcount = pt->texels_per_partition[partition]; + float lowparam = 1e10; + float highparam = -1e10; + + processed_line4 l = plines[partition]; + + if (ewb->contains_zeroweight_texels) + { + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + if (ewb->texel_weight[iwt] > 1e-20) + { + float4 point = float4(blk->work_data[4 * iwt], blk->work_data[4 * iwt + 1], blk->work_data[4 * iwt + 2], blk->work_data[4 * iwt + 3]); + float param = dot(point, l.bs); + float4 rp1 = l.amod + param * l.bis; + float4 dist = rp1 - point; + float4 ews = ewb->error_weights[iwt]; + errorsum += dot(ews, dist * dist); + if (param < lowparam) + lowparam = param; + if (param > highparam) + highparam = param; + } + } + } + else + { + for (i = 0; i < texelcount; i++) + { + int iwt = weights[i]; + float4 point = float4(blk->work_data[4 * iwt], blk->work_data[4 * iwt + 1], blk->work_data[4 * iwt + 2], blk->work_data[4 * iwt + 3]); + float param = dot(point, l.bs); + float4 rp1 = l.amod + param * l.bis; + float4 dist = rp1 - point; + float4 ews = ewb->error_weights[iwt]; + errorsum += dot(ews, dist * dist); + if (param < lowparam) + lowparam = param; + if (param > highparam) + highparam = param; + } + } + + float linelen = highparam - lowparam; + if (!(linelen > 1e-7f)) + linelen = 1e-7f; + length_of_lines[partition] = linelen; + } + + return errorsum; +} + + + +// function to compute the error across a tile when using a particular line for +// a particular partition. +float compute_error_squared_rgb_single_partition(int partition_to_test, int xdim, int ydim, int zdim, const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line3 * lin // the line for the partition. + ) +{ + int i; + + int texels_per_block = xdim * ydim * zdim; + + float errorsum = 0.0f; + + for (i = 0; i < texels_per_block; i++) + { + int partition = pt->partition_of_texel[i]; + float texel_weight = ewb->texel_weight_rgb[i]; + if (partition != partition_to_test || texel_weight < 1e-20) + continue; + float3 point = float3(blk->work_data[4 * i], blk->work_data[4 * i + 1], blk->work_data[4 * i + 2]); + + float param = dot(point, lin->bs); + float3 rp1 = lin->amod + param * lin->bis; + float3 dist = rp1 - point; + float4 ews = ewb->error_weights[i]; + + errorsum += dot(ews.xyz, dist * dist); + } + return errorsum; +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_block_sizes2.cpp b/3rdparty/bimg/3rdparty/astc/astc_block_sizes2.cpp new file mode 100644 index 00000000000..8d42d71c35b --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_block_sizes2.cpp @@ -0,0 +1,977 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief For ASTC, generate the block size descriptor and the associated + * decimation tables. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +extern const float percentile_table_4x4[2048]; +extern const float percentile_table_4x5[2048]; +extern const float percentile_table_4x6[2048]; +extern const float percentile_table_4x8[2048]; +extern const float percentile_table_4x10[2048]; +extern const float percentile_table_4x12[2048]; +extern const float percentile_table_5x4[2048]; +extern const float percentile_table_5x5[2048]; +extern const float percentile_table_5x6[2048]; +extern const float percentile_table_5x8[2048]; +extern const float percentile_table_5x10[2048]; +extern const float percentile_table_5x12[2048]; +extern const float percentile_table_6x4[2048]; +extern const float percentile_table_6x5[2048]; +extern const float percentile_table_6x6[2048]; +extern const float percentile_table_6x8[2048]; +extern const float percentile_table_6x10[2048]; +extern const float percentile_table_6x12[2048]; +extern const float percentile_table_8x4[2048]; +extern const float percentile_table_8x5[2048]; +extern const float percentile_table_8x6[2048]; +extern const float percentile_table_8x8[2048]; +extern const float percentile_table_8x10[2048]; +extern const float percentile_table_8x12[2048]; +extern const float percentile_table_10x4[2048]; +extern const float percentile_table_10x5[2048]; +extern const float percentile_table_10x6[2048]; +extern const float percentile_table_10x8[2048]; +extern const float percentile_table_10x10[2048]; +extern const float percentile_table_10x12[2048]; +extern const float percentile_table_12x4[2048]; +extern const float percentile_table_12x5[2048]; +extern const float percentile_table_12x6[2048]; +extern const float percentile_table_12x8[2048]; +extern const float percentile_table_12x10[2048]; +extern const float percentile_table_12x12[2048]; + +const float *get_2d_percentile_table(int blockdim_x, int blockdim_y) +{ + switch (blockdim_x) + { + case 4: + switch (blockdim_y) + { + case 4: + return percentile_table_4x4; + case 5: + return percentile_table_4x5; + case 6: + return percentile_table_4x6; + case 8: + return percentile_table_4x8; + case 10: + return percentile_table_4x10; + case 12: + return percentile_table_4x12; + } + break; + case 5: + switch (blockdim_y) + { + case 4: + return percentile_table_5x4; + case 5: + return percentile_table_5x5; + case 6: + return percentile_table_5x6; + case 8: + return percentile_table_5x8; + case 10: + return percentile_table_5x10; + case 12: + return percentile_table_5x12; + } + break; + + case 6: + switch (blockdim_y) + { + case 4: + return percentile_table_6x4; + case 5: + return percentile_table_6x5; + case 6: + return percentile_table_6x6; + case 8: + return percentile_table_6x8; + case 10: + return percentile_table_6x10; + case 12: + return percentile_table_6x12; + } + break; + + case 8: + switch (blockdim_y) + { + case 4: + return percentile_table_8x4; + case 5: + return percentile_table_8x5; + case 6: + return percentile_table_8x6; + case 8: + return percentile_table_8x8; + case 10: + return percentile_table_8x10; + case 12: + return percentile_table_8x12; + } + break; + + case 10: + switch (blockdim_y) + { + case 4: + return percentile_table_10x4; + case 5: + return percentile_table_10x5; + case 6: + return percentile_table_10x6; + case 8: + return percentile_table_10x8; + case 10: + return percentile_table_10x10; + case 12: + return percentile_table_10x12; + } + break; + + case 12: + switch (blockdim_y) + { + case 4: + return percentile_table_12x4; + case 5: + return percentile_table_12x5; + case 6: + return percentile_table_12x6; + case 8: + return percentile_table_12x8; + case 10: + return percentile_table_12x10; + case 12: + return percentile_table_12x12; + } + break; + default: + break; + } + + return NULL; // should never happen. +} + +// stubbed for the time being. +static const float dummy_percentile_table_3d[2048] = { 0 }; +const float *get_3d_percentile_table(int blockdim_x, int blockdim_y, int blockdim_z) +{ + IGNORE(blockdim_x); + IGNORE(blockdim_y); + IGNORE(blockdim_z); + return dummy_percentile_table_3d; +} + + + +// return 0 on invalid mode, 1 on valid mode. +static int decode_block_mode_2d(int blockmode, int *Nval, int *Mval, int *dual_weight_plane, int *quant_mode) +{ + int base_quant_mode = (blockmode >> 4) & 1; + int H = (blockmode >> 9) & 1; + int D = (blockmode >> 10) & 1; + + int A = (blockmode >> 5) & 0x3; + + int N = 0, M = 0; + + if ((blockmode & 3) != 0) + { + base_quant_mode |= (blockmode & 3) << 1; + int B = (blockmode >> 7) & 3; + switch ((blockmode >> 2) & 3) + { + case 0: + N = B + 4; + M = A + 2; + break; + case 1: + N = B + 8; + M = A + 2; + break; + case 2: + N = A + 2; + M = B + 8; + break; + case 3: + B &= 1; + if (blockmode & 0x100) + { + N = B + 2; + M = A + 2; + } + else + { + N = A + 2; + M = B + 6; + } + break; + } + } + else + { + base_quant_mode |= ((blockmode >> 2) & 3) << 1; + if (((blockmode >> 2) & 3) == 0) + return 0; + int B = (blockmode >> 9) & 3; + switch ((blockmode >> 7) & 3) + { + case 0: + N = 12; + M = A + 2; + break; + case 1: + N = A + 2; + M = 12; + break; + case 2: + N = A + 6; + M = B + 6; + D = 0; + H = 0; + break; + case 3: + switch ((blockmode >> 5) & 3) + { + case 0: + N = 6; + M = 10; + break; + case 1: + N = 10; + M = 6; + break; + case 2: + case 3: + return 0; + } + break; + } + } + + int weight_count = N * M * (D + 1); + int qmode = (base_quant_mode - 2) + 6 * H; + + int weightbits = compute_ise_bitcount(weight_count, (quantization_method) qmode); + if (weight_count > MAX_WEIGHTS_PER_BLOCK || weightbits < MIN_WEIGHT_BITS_PER_BLOCK || weightbits > MAX_WEIGHT_BITS_PER_BLOCK) + return 0; + + *Nval = N; + *Mval = M; + *dual_weight_plane = D; + *quant_mode = qmode; + return 1; +} + + +static int decode_block_mode_3d(int blockmode, int *Nval, int *Mval, int *Qval, int *dual_weight_plane, int *quant_mode) +{ + int base_quant_mode = (blockmode >> 4) & 1; + int H = (blockmode >> 9) & 1; + int D = (blockmode >> 10) & 1; + + int A = (blockmode >> 5) & 0x3; + + int N = 0, M = 0, Q = 0; + + if ((blockmode & 3) != 0) + { + base_quant_mode |= (blockmode & 3) << 1; + int B = (blockmode >> 7) & 3; + int C = (blockmode >> 2) & 0x3; + N = A + 2; + M = B + 2; + Q = C + 2; + } + else + { + base_quant_mode |= ((blockmode >> 2) & 3) << 1; + if (((blockmode >> 2) & 3) == 0) + return 0; + int B = (blockmode >> 9) & 3; + if (((blockmode >> 7) & 3) != 3) + { + D = 0; + H = 0; + } + switch ((blockmode >> 7) & 3) + { + case 0: + N = 6; + M = B + 2; + Q = A + 2; + break; + case 1: + N = A + 2; + M = 6; + Q = B + 2; + break; + case 2: + N = A + 2; + M = B + 2; + Q = 6; + break; + case 3: + N = 2; + M = 2; + Q = 2; + switch ((blockmode >> 5) & 3) + { + case 0: + N = 6; + break; + case 1: + M = 6; + break; + case 2: + Q = 6; + break; + case 3: + return 0; + } + break; + } + } + + int weight_count = N * M * Q * (D + 1); + int qmode = (base_quant_mode - 2) + 6 * H; + + int weightbits = compute_ise_bitcount(weight_count, (quantization_method) qmode); + if (weight_count > MAX_WEIGHTS_PER_BLOCK || weightbits < MIN_WEIGHT_BITS_PER_BLOCK || weightbits > MAX_WEIGHT_BITS_PER_BLOCK) + return 0; + + *Nval = N; + *Mval = M; + *Qval = Q; + *dual_weight_plane = D; + *quant_mode = qmode; + return 1; +} + + + + +static void initialize_decimation_table_2d( + // dimensions of the block + int xdim, int ydim, + // number of grid points in 2d weight grid + int x_weights, int y_weights, decimation_table * dt) +{ + int i, j; + int x, y; + + int texels_per_block = xdim * ydim; + int weights_per_block = x_weights * y_weights; + + int weightcount_of_texel[MAX_TEXELS_PER_BLOCK]; + int grid_weights_of_texel[MAX_TEXELS_PER_BLOCK][4]; + int weights_of_texel[MAX_TEXELS_PER_BLOCK][4]; + + int texelcount_of_weight[MAX_WEIGHTS_PER_BLOCK]; + int texels_of_weight[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; + int texelweights_of_weight[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; + + for (i = 0; i < weights_per_block; i++) + texelcount_of_weight[i] = 0; + for (i = 0; i < texels_per_block; i++) + weightcount_of_texel[i] = 0; + + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + int texel = y * xdim + x; + + int x_weight = (((1024 + xdim / 2) / (xdim - 1)) * x * (x_weights - 1) + 32) >> 6; + int y_weight = (((1024 + ydim / 2) / (ydim - 1)) * y * (y_weights - 1) + 32) >> 6; + + int x_weight_frac = x_weight & 0xF; + int y_weight_frac = y_weight & 0xF; + int x_weight_int = x_weight >> 4; + int y_weight_int = y_weight >> 4; + int qweight[4]; + int weight[4]; + qweight[0] = x_weight_int + y_weight_int * x_weights; + qweight[1] = qweight[0] + 1; + qweight[2] = qweight[0] + x_weights; + qweight[3] = qweight[2] + 1; + + // truncated-precision bilinear interpolation. + int prod = x_weight_frac * y_weight_frac; + + weight[3] = (prod + 8) >> 4; + weight[1] = x_weight_frac - weight[3]; + weight[2] = y_weight_frac - weight[3]; + weight[0] = 16 - x_weight_frac - y_weight_frac + weight[3]; + + for (i = 0; i < 4; i++) + if (weight[i] != 0) + { + grid_weights_of_texel[texel][weightcount_of_texel[texel]] = qweight[i]; + weights_of_texel[texel][weightcount_of_texel[texel]] = weight[i]; + weightcount_of_texel[texel]++; + texels_of_weight[qweight[i]][texelcount_of_weight[qweight[i]]] = texel; + texelweights_of_weight[qweight[i]][texelcount_of_weight[qweight[i]]] = weight[i]; + texelcount_of_weight[qweight[i]]++; + } + } + + for (i = 0; i < texels_per_block; i++) + { + dt->texel_num_weights[i] = weightcount_of_texel[i]; + + // ensure that all 4 entries are actually initialized. + // This allows a branch-free implementation of compute_value_of_texel_flt() + for (j = 0; j < 4; j++) + { + dt->texel_weights_int[i][j] = 0; + dt->texel_weights_float[i][j] = 0.0f; + dt->texel_weights[i][j] = 0; + } + + for (j = 0; j < weightcount_of_texel[i]; j++) + { + dt->texel_weights_int[i][j] = weights_of_texel[i][j]; + dt->texel_weights_float[i][j] = static_cast < float >(weights_of_texel[i][j]) * (1.0f / TEXEL_WEIGHT_SUM); + dt->texel_weights[i][j] = grid_weights_of_texel[i][j]; + } + } + + for (i = 0; i < weights_per_block; i++) + { + dt->weight_num_texels[i] = texelcount_of_weight[i]; + + + for (j = 0; j < texelcount_of_weight[i]; j++) + { + dt->weight_texel[i][j] = texels_of_weight[i][j]; + dt->weights_int[i][j] = texelweights_of_weight[i][j]; + dt->weights_flt[i][j] = static_cast < float >(texelweights_of_weight[i][j]); + } + } + + dt->num_texels = texels_per_block; + dt->num_weights = weights_per_block; + + +} + + + + +static void initialize_decimation_table_3d( + // dimensions of the block + int xdim, int ydim, int zdim, + // number of grid points in 3d weight grid + int x_weights, int y_weights, int z_weights, decimation_table * dt) +{ + int i, j; + int x, y, z; + + int texels_per_block = xdim * ydim * zdim; + int weights_per_block = x_weights * y_weights * z_weights; + + int weightcount_of_texel[MAX_TEXELS_PER_BLOCK]; + int grid_weights_of_texel[MAX_TEXELS_PER_BLOCK][4]; + int weights_of_texel[MAX_TEXELS_PER_BLOCK][4]; + + int texelcount_of_weight[MAX_WEIGHTS_PER_BLOCK]; + int texels_of_weight[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; + int texelweights_of_weight[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; + + for (i = 0; i < weights_per_block; i++) + texelcount_of_weight[i] = 0; + for (i = 0; i < texels_per_block; i++) + weightcount_of_texel[i] = 0; + + for (z = 0; z < zdim; z++) + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + int texel = (z * ydim + y) * xdim + x; + + int x_weight = (((1024 + xdim / 2) / (xdim - 1)) * x * (x_weights - 1) + 32) >> 6; + int y_weight = (((1024 + ydim / 2) / (ydim - 1)) * y * (y_weights - 1) + 32) >> 6; + int z_weight = (((1024 + zdim / 2) / (zdim - 1)) * z * (z_weights - 1) + 32) >> 6; + + int x_weight_frac = x_weight & 0xF; + int y_weight_frac = y_weight & 0xF; + int z_weight_frac = z_weight & 0xF; + int x_weight_int = x_weight >> 4; + int y_weight_int = y_weight >> 4; + int z_weight_int = z_weight >> 4; + int qweight[4]; + int weight[4]; + qweight[0] = (z_weight_int * y_weights + y_weight_int) * x_weights + x_weight_int; + qweight[3] = ((z_weight_int + 1) * y_weights + (y_weight_int + 1)) * x_weights + (x_weight_int + 1); + + // simplex interpolation + int fs = x_weight_frac; + int ft = y_weight_frac; + int fp = z_weight_frac; + + int cas = ((fs > ft) << 2) + ((ft > fp) << 1) + ((fs > fp)); + int N = x_weights; + int NM = x_weights * y_weights; + + int s1, s2, w0, w1, w2, w3; + switch (cas) + { + case 7: + s1 = 1; + s2 = N; + w0 = 16 - fs; + w1 = fs - ft; + w2 = ft - fp; + w3 = fp; + break; + case 3: + s1 = N; + s2 = 1; + w0 = 16 - ft; + w1 = ft - fs; + w2 = fs - fp; + w3 = fp; + break; + case 5: + s1 = 1; + s2 = NM; + w0 = 16 - fs; + w1 = fs - fp; + w2 = fp - ft; + w3 = ft; + break; + case 4: + s1 = NM; + s2 = 1; + w0 = 16 - fp; + w1 = fp - fs; + w2 = fs - ft; + w3 = ft; + break; + case 2: + s1 = N; + s2 = NM; + w0 = 16 - ft; + w1 = ft - fp; + w2 = fp - fs; + w3 = fs; + break; + case 0: + s1 = NM; + s2 = N; + w0 = 16 - fp; + w1 = fp - ft; + w2 = ft - fs; + w3 = fs; + break; + + default: + s1 = NM; + s2 = N; + w0 = 16 - fp; + w1 = fp - ft; + w2 = ft - fs; + w3 = fs; + break; + } + + qweight[1] = qweight[0] + s1; + qweight[2] = qweight[1] + s2; + weight[0] = w0; + weight[1] = w1; + weight[2] = w2; + weight[3] = w3; + + /* + for(i=0;i<4;i++) weight[i] <<= 4; */ + + for (i = 0; i < 4; i++) + if (weight[i] != 0) + { + grid_weights_of_texel[texel][weightcount_of_texel[texel]] = qweight[i]; + weights_of_texel[texel][weightcount_of_texel[texel]] = weight[i]; + weightcount_of_texel[texel]++; + texels_of_weight[qweight[i]][texelcount_of_weight[qweight[i]]] = texel; + texelweights_of_weight[qweight[i]][texelcount_of_weight[qweight[i]]] = weight[i]; + texelcount_of_weight[qweight[i]]++; + } + } + + for (i = 0; i < texels_per_block; i++) + { + dt->texel_num_weights[i] = weightcount_of_texel[i]; + + // ensure that all 4 entries are actually initialized. + // This allows a branch-free implementation of compute_value_of_texel_flt() + for (j = 0; j < 4; j++) + { + dt->texel_weights_int[i][j] = 0; + dt->texel_weights_float[i][j] = 0.0f; + dt->texel_weights[i][j] = 0; + } + + for (j = 0; j < weightcount_of_texel[i]; j++) + { + dt->texel_weights_int[i][j] = weights_of_texel[i][j]; + dt->texel_weights_float[i][j] = static_cast < float >(weights_of_texel[i][j]) * (1.0f / TEXEL_WEIGHT_SUM); + dt->texel_weights[i][j] = grid_weights_of_texel[i][j]; + } + } + + for (i = 0; i < weights_per_block; i++) + { + dt->weight_num_texels[i] = texelcount_of_weight[i]; + for (j = 0; j < texelcount_of_weight[i]; j++) + { + dt->weight_texel[i][j] = texels_of_weight[i][j]; + dt->weights_int[i][j] = texelweights_of_weight[i][j]; + dt->weights_flt[i][j] = static_cast < float >(texelweights_of_weight[i][j]); + } + } + + dt->num_texels = texels_per_block; + dt->num_weights = weights_per_block; +} + + + +void construct_block_size_descriptor_2d(int xdim, int ydim, block_size_descriptor * bsd) +{ + int decimation_mode_index[256]; // for each of the 256 entries in the decim_table_array, its index + int decimation_mode_count = 0; + + int i; + int x_weights; + int y_weights; + + for (i = 0; i < 256; i++) + { + decimation_mode_index[i] = -1; + } + + // gather all the infill-modes that can be used with the current block size + for (x_weights = 2; x_weights <= 12; x_weights++) + for (y_weights = 2; y_weights <= 12; y_weights++) + { + if (x_weights * y_weights > MAX_WEIGHTS_PER_BLOCK) + continue; + decimation_table *dt = new decimation_table; + decimation_mode_index[y_weights * 16 + x_weights] = decimation_mode_count; + initialize_decimation_table_2d(xdim, ydim, x_weights, y_weights, dt); + + int weight_count = x_weights * y_weights; + + int maxprec_1plane = -1; + int maxprec_2planes = -1; + for (i = 0; i < 12; i++) + { + int bits_1plane = compute_ise_bitcount(weight_count, (quantization_method) i); + int bits_2planes = compute_ise_bitcount(2 * weight_count, (quantization_method) i); + if (bits_1plane >= MIN_WEIGHT_BITS_PER_BLOCK && bits_1plane <= MAX_WEIGHT_BITS_PER_BLOCK) + maxprec_1plane = i; + if (bits_2planes >= MIN_WEIGHT_BITS_PER_BLOCK && bits_2planes <= MAX_WEIGHT_BITS_PER_BLOCK) + maxprec_2planes = i; + } + + if (2 * x_weights * y_weights > MAX_WEIGHTS_PER_BLOCK) + maxprec_2planes = -1; + + bsd->permit_encode[decimation_mode_count] = (x_weights <= xdim && y_weights <= ydim); + + bsd->decimation_mode_samples[decimation_mode_count] = weight_count; + bsd->decimation_mode_maxprec_1plane[decimation_mode_count] = maxprec_1plane; + bsd->decimation_mode_maxprec_2planes[decimation_mode_count] = maxprec_2planes; + bsd->decimation_tables[decimation_mode_count] = dt; + + decimation_mode_count++; + } + + for (i = 0; i < MAX_DECIMATION_MODES; i++) + { + bsd->decimation_mode_percentile[i] = 1.0f; + } + + for (i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++) + { + bsd->permit_encode[i] = 0; + bsd->decimation_mode_samples[i] = 0; + bsd->decimation_mode_maxprec_1plane[i] = -1; + bsd->decimation_mode_maxprec_2planes[i] = -1; + } + + bsd->decimation_mode_count = decimation_mode_count; + + const float *percentiles = get_2d_percentile_table(xdim, ydim); + + // then construct the list of block formats + for (i = 0; i < 2048; i++) + { + int x_weights, y_weights; + int is_dual_plane; + int quantization_mode; + int fail = 0; + int permit_encode = 1; + + if (decode_block_mode_2d(i, &x_weights, &y_weights, &is_dual_plane, &quantization_mode)) + { + if (x_weights > xdim || y_weights > ydim) + permit_encode = 0; + } + else + { + fail = 1; + permit_encode = 0; + } + + if (fail) + { + bsd->block_modes[i].decimation_mode = -1; + bsd->block_modes[i].quantization_mode = -1; + bsd->block_modes[i].is_dual_plane = -1; + bsd->block_modes[i].permit_encode = 0; + bsd->block_modes[i].permit_decode = 0; + bsd->block_modes[i].percentile = 1.0f; + } + else + { + int decimation_mode = decimation_mode_index[y_weights * 16 + x_weights]; + bsd->block_modes[i].decimation_mode = decimation_mode; + bsd->block_modes[i].quantization_mode = quantization_mode; + bsd->block_modes[i].is_dual_plane = is_dual_plane; + bsd->block_modes[i].permit_encode = permit_encode; + bsd->block_modes[i].permit_decode = permit_encode; // disallow decode of grid size larger than block size. + bsd->block_modes[i].percentile = percentiles[i]; + + if (bsd->decimation_mode_percentile[decimation_mode] > percentiles[i]) + bsd->decimation_mode_percentile[decimation_mode] = percentiles[i]; + } + + } + + if (xdim * ydim <= 64) + { + bsd->texelcount_for_bitmap_partitioning = xdim * ydim; + for (i = 0; i < xdim * ydim; i++) + bsd->texels_for_bitmap_partitioning[i] = i; + } + + else + { + // pick 64 random texels for use with bitmap partitioning. + int arr[MAX_TEXELS_PER_BLOCK]; + for (i = 0; i < xdim * ydim; i++) + arr[i] = 0; + int arr_elements_set = 0; + while (arr_elements_set < 64) + { + int idx = rand() % (xdim * ydim); + if (arr[idx] == 0) + { + arr_elements_set++; + arr[idx] = 1; + } + } + int texel_weights_written = 0; + int idx = 0; + while (texel_weights_written < 64) + { + if (arr[idx]) + bsd->texels_for_bitmap_partitioning[texel_weights_written++] = idx; + idx++; + } + bsd->texelcount_for_bitmap_partitioning = 64; + + } +} + + + +void construct_block_size_descriptor_3d(int xdim, int ydim, int zdim, block_size_descriptor * bsd) +{ + int decimation_mode_index[512]; // for each of the 512 entries in the decim_table_array, its index + int decimation_mode_count = 0; + + int i; + int x_weights; + int y_weights; + int z_weights; + + for (i = 0; i < 512; i++) + { + decimation_mode_index[i] = -1; + } + + // gather all the infill-modes that can be used with the current block size + for (x_weights = 2; x_weights <= 6; x_weights++) + for (y_weights = 2; y_weights <= 6; y_weights++) + for (z_weights = 2; z_weights <= 6; z_weights++) + { + if ((x_weights * y_weights * z_weights) > MAX_WEIGHTS_PER_BLOCK) + continue; + decimation_table *dt = new decimation_table; + decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights] = decimation_mode_count; + initialize_decimation_table_3d(xdim, ydim, zdim, x_weights, y_weights, z_weights, dt); + + int weight_count = x_weights * y_weights * z_weights; + + int maxprec_1plane = -1; + int maxprec_2planes = -1; + for (i = 0; i < 12; i++) + { + int bits_1plane = compute_ise_bitcount(weight_count, (quantization_method) i); + int bits_2planes = compute_ise_bitcount(2 * weight_count, (quantization_method) i); + if (bits_1plane >= MIN_WEIGHT_BITS_PER_BLOCK && bits_1plane <= MAX_WEIGHT_BITS_PER_BLOCK) + maxprec_1plane = i; + if (bits_2planes >= MIN_WEIGHT_BITS_PER_BLOCK && bits_2planes <= MAX_WEIGHT_BITS_PER_BLOCK) + maxprec_2planes = i; + } + + if ((2 * x_weights * y_weights * z_weights) > MAX_WEIGHTS_PER_BLOCK) + maxprec_2planes = -1; + + bsd->permit_encode[decimation_mode_count] = (x_weights <= xdim && y_weights <= ydim && z_weights <= zdim); + + bsd->decimation_mode_samples[decimation_mode_count] = weight_count; + bsd->decimation_mode_maxprec_1plane[decimation_mode_count] = maxprec_1plane; + bsd->decimation_mode_maxprec_2planes[decimation_mode_count] = maxprec_2planes; + bsd->decimation_tables[decimation_mode_count] = dt; + + decimation_mode_count++; + } + + for (i = 0; i < MAX_DECIMATION_MODES; i++) + { + bsd->decimation_mode_percentile[i] = 1.0f; + } + + for (i = decimation_mode_count; i < MAX_DECIMATION_MODES; i++) + { + bsd->permit_encode[i] = 0; + bsd->decimation_mode_samples[i] = 0; + bsd->decimation_mode_maxprec_1plane[i] = -1; + bsd->decimation_mode_maxprec_2planes[i] = -1; + } + + bsd->decimation_mode_count = decimation_mode_count; + + const float *percentiles = get_3d_percentile_table(xdim, ydim, zdim); + + // then construct the list of block formats + for (i = 0; i < 2048; i++) + { + int x_weights, y_weights, z_weights; + int is_dual_plane; + int quantization_mode; + int fail = 0; + int permit_encode = 1; + + if (decode_block_mode_3d(i, &x_weights, &y_weights, &z_weights, &is_dual_plane, &quantization_mode)) + { + if (x_weights > xdim || y_weights > ydim || z_weights > zdim) + permit_encode = 0; + } + else + { + fail = 1; + permit_encode = 0; + } + if (fail) + { + bsd->block_modes[i].decimation_mode = -1; + bsd->block_modes[i].quantization_mode = -1; + bsd->block_modes[i].is_dual_plane = -1; + bsd->block_modes[i].permit_encode = 0; + bsd->block_modes[i].permit_decode = 0; + bsd->block_modes[i].percentile = 1.0f; + } + else + { + int decimation_mode = decimation_mode_index[z_weights * 64 + y_weights * 8 + x_weights]; + bsd->block_modes[i].decimation_mode = decimation_mode; + bsd->block_modes[i].quantization_mode = quantization_mode; + bsd->block_modes[i].is_dual_plane = is_dual_plane; + bsd->block_modes[i].permit_encode = permit_encode; + bsd->block_modes[i].permit_decode = permit_encode; + bsd->block_modes[i].percentile = percentiles[i]; + + if (bsd->decimation_mode_percentile[decimation_mode] > percentiles[i]) + bsd->decimation_mode_percentile[decimation_mode] = percentiles[i]; + } + + } + + if (xdim * ydim * zdim <= 64) + { + bsd->texelcount_for_bitmap_partitioning = xdim * ydim * zdim; + for (i = 0; i < xdim * ydim * zdim; i++) + bsd->texels_for_bitmap_partitioning[i] = i; + } + + else + { + // pick 64 random texels for use with bitmap partitioning. + int arr[MAX_TEXELS_PER_BLOCK]; + for (i = 0; i < xdim * ydim * zdim; i++) + arr[i] = 0; + int arr_elements_set = 0; + while (arr_elements_set < 64) + { + int idx = rand() % (xdim * ydim * zdim); + if (arr[idx] == 0) + { + arr_elements_set++; + arr[idx] = 1; + } + } + int texel_weights_written = 0; + int idx = 0; + while (texel_weights_written < 64) + { + if (arr[idx]) + bsd->texels_for_bitmap_partitioning[texel_weights_written++] = idx; + idx++; + } + bsd->texelcount_for_bitmap_partitioning = 64; + } +} + + + + +static block_size_descriptor *bsd_pointers[4096]; + +// function to obtain a block size descriptor. If the descriptor does not exist, +// it is created as needed. Should not be called from within multi-threaded code. +const block_size_descriptor *get_block_size_descriptor(int xdim, int ydim, int zdim) +{ + int bsd_index = xdim + (ydim << 4) + (zdim << 8); + if (bsd_pointers[bsd_index] == NULL) + { + block_size_descriptor *bsd = new block_size_descriptor; + if (zdim > 1) + construct_block_size_descriptor_3d(xdim, ydim, zdim, bsd); + else + construct_block_size_descriptor_2d(xdim, ydim, bsd); + + bsd_pointers[bsd_index] = bsd; + } + return bsd_pointers[bsd_index]; +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_codec_internals.h b/3rdparty/bimg/3rdparty/astc/astc_codec_internals.h new file mode 100644 index 00000000000..13356ae2c3b --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_codec_internals.h @@ -0,0 +1,816 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012, 2018 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Internal function and data declarations for ASTC codec. + */ +/*----------------------------------------------------------------------------*/ + +#ifndef ASTC_CODEC_INTERNALS_INCLUDED + +#define ASTC_CODEC_INTERNALS_INCLUDED + +#include +#include +#include +#include "mathlib.h" + +#ifndef MIN + #define MIN(x,y) ((x)<(y)?(x):(y)) +#endif + +#ifndef MAX + #define MAX(x,y) ((x)>(y)?(x):(y)) +#endif + +// Macro to silence warnings on ignored parameters. +// The presence of this macro should be a signal to look at refactoring. +#define IGNORE(param) ((void)¶m) + +#define astc_isnan(p) ((p)!=(p)) + +// ASTC parameters +#define MAX_TEXELS_PER_BLOCK 216 +#define MAX_WEIGHTS_PER_BLOCK 64 +#define MIN_WEIGHT_BITS_PER_BLOCK 24 +#define MAX_WEIGHT_BITS_PER_BLOCK 96 +#define PARTITION_BITS 10 +#define PARTITION_COUNT (1 << PARTITION_BITS) + +// the sum of weights for one texel. +#define TEXEL_WEIGHT_SUM 16 +#define MAX_DECIMATION_MODES 87 +#define MAX_WEIGHT_MODES 2048 + +// error reporting for codec internal errors. +#define ASTC_CODEC_INTERNAL_ERROR astc_codec_internal_error(__FILE__, __LINE__) + +void astc_codec_internal_error(const char *filename, int linenumber); + +// uncomment this macro to enable checking for inappropriate NaNs; +// works on Linux only, and slows down encoding significantly. +// #define DEBUG_CAPTURE_NAN + +// the PRINT_DIAGNOSTICS macro enables the -diag command line switch, +// which can be used to look for codec bugs +#define DEBUG_PRINT_DIAGNOSTICS + +#ifdef DEBUG_PRINT_DIAGNOSTICS + extern int print_diagnostics; +#endif + +extern int print_tile_errors; +extern int print_statistics; + +extern int perform_srgb_transform; +extern int rgb_force_use_of_hdr; +extern int alpha_force_use_of_hdr; + +struct processed_line2 +{ + float2 amod; + float2 bs; + float2 bis; +}; +struct processed_line3 +{ + float3 amod; + float3 bs; + float3 bis; +}; +struct processed_line4 +{ + float4 amod; + float4 bs; + float4 bis; +}; + +enum astc_decode_mode +{ + DECODE_LDR_SRGB, + DECODE_LDR, + DECODE_HDR +}; + + +/* + Partition table representation: + For each block size, we have 3 tables, each with 1024 partitionings; + these three tables correspond to 2, 3 and 4 partitions respectively. + For each partitioning, we have: + * a 4-entry table indicating how many texels there are in each of the 4 partitions. + This may be from 0 to a very large value. + * a table indicating the partition index of each of the texels in the block. + Each index may be 0, 1, 2 or 3. + * Each element in the table is an uint8_t indicating partition index (0, 1, 2 or 3) +*/ + +struct partition_info +{ + int partition_count; + uint8_t texels_per_partition[4]; + uint8_t partition_of_texel[MAX_TEXELS_PER_BLOCK]; + uint8_t texels_of_partition[4][MAX_TEXELS_PER_BLOCK]; + + uint64_t coverage_bitmaps[4]; // used for the purposes of k-means partition search. +}; + + + + +/* + In ASTC, we don't necessarily provide a weight for every texel. + As such, for each block size, there are a number of patterns where some texels + have their weights computed as a weighted average of more than 1 weight. + As such, the codec uses a data structure that tells us: for each texel, which + weights it is a combination of for each weight, which texels it contributes to. + The decimation_table is this data structure. +*/ +struct decimation_table +{ + int num_texels; + int num_weights; + uint8_t texel_num_weights[MAX_TEXELS_PER_BLOCK]; // number of indices that go into the calculation for a texel + uint8_t texel_weights_int[MAX_TEXELS_PER_BLOCK][4]; // the weight to assign to each weight + float texel_weights_float[MAX_TEXELS_PER_BLOCK][4]; // the weight to assign to each weight + uint8_t texel_weights[MAX_TEXELS_PER_BLOCK][4]; // the weights that go into a texel calculation + uint8_t weight_num_texels[MAX_WEIGHTS_PER_BLOCK]; // the number of texels that a given weight contributes to + uint8_t weight_texel[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; // the texels that the weight contributes to + uint8_t weights_int[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; // the weights that the weight contributes to a texel. + float weights_flt[MAX_WEIGHTS_PER_BLOCK][MAX_TEXELS_PER_BLOCK]; // the weights that the weight contributes to a texel. +}; + + + + +/* + data structure describing information that pertains to a block size and its associated block modes. +*/ +struct block_mode +{ + int8_t decimation_mode; + int8_t quantization_mode; + int8_t is_dual_plane; + int8_t permit_encode; + int8_t permit_decode; + float percentile; +}; + + +struct block_size_descriptor +{ + int decimation_mode_count; + int decimation_mode_samples[MAX_DECIMATION_MODES]; + int decimation_mode_maxprec_1plane[MAX_DECIMATION_MODES]; + int decimation_mode_maxprec_2planes[MAX_DECIMATION_MODES]; + float decimation_mode_percentile[MAX_DECIMATION_MODES]; + int permit_encode[MAX_DECIMATION_MODES]; + const decimation_table *decimation_tables[MAX_DECIMATION_MODES + 1]; + block_mode block_modes[MAX_WEIGHT_MODES]; + + // for the k-means bed bitmap partitioning algorithm, we don't + // want to consider more than 64 texels; this array specifies + // which 64 texels (if that many) to consider. + int texelcount_for_bitmap_partitioning; + int texels_for_bitmap_partitioning[64]; +}; + +// data structure representing one block of an image. +// it is expanded to float prior to processing to save some computation time +// on conversions to/from uint8_t (this also allows us to handle HDR textures easily) +struct imageblock +{ + float orig_data[MAX_TEXELS_PER_BLOCK * 4]; // original input data + float work_data[MAX_TEXELS_PER_BLOCK * 4]; // the data that we will compress, either linear or LNS (0..65535 in both cases) + float deriv_data[MAX_TEXELS_PER_BLOCK * 4]; // derivative of the conversion function used, used to modify error weighting + + uint8_t rgb_lns[MAX_TEXELS_PER_BLOCK]; // 1 if RGB data are being treated as LNS + uint8_t alpha_lns[MAX_TEXELS_PER_BLOCK]; // 1 if Alpha data are being treated as LNS + uint8_t nan_texel[MAX_TEXELS_PER_BLOCK]; // 1 if the texel is a NaN-texel. + + float red_min, red_max; + float green_min, green_max; + float blue_min, blue_max; + float alpha_min, alpha_max; + int grayscale; // 1 if R=G=B for every pixel, 0 otherwise + + int xpos, ypos, zpos; +}; + + +struct error_weighting_params +{ + float rgb_power; + float rgb_base_weight; + float rgb_mean_weight; + float rgb_stdev_weight; + float alpha_power; + float alpha_base_weight; + float alpha_mean_weight; + float alpha_stdev_weight; + float rgb_mean_and_stdev_mixing; + int mean_stdev_radius; + int enable_rgb_scale_with_alpha; + int alpha_radius; + int ra_normal_angular_scale; + float block_artifact_suppression; + float rgba_weights[4]; + + float block_artifact_suppression_expanded[MAX_TEXELS_PER_BLOCK]; + + // parameters that deal with heuristic codec speedups + int partition_search_limit; + float block_mode_cutoff; + float texel_avg_error_limit; + float partition_1_to_2_limit; + float lowest_correlation_cutoff; + int max_refinement_iters; +}; + + + + +void update_imageblock_flags(imageblock * pb, int xdim, int ydim, int zdim); + + +void imageblock_initialize_orig_from_work(imageblock * pb, int pixelcount); + + +void imageblock_initialize_work_from_orig(imageblock * pb, int pixelcount); + + + +/* + Data structure representing error weighting for one block of an image. this is used as + a multiplier for the error weight to apply to each color component when computing PSNR. + + This weighting has several uses: it's usable for RA, GA, BA, A weighting, which is useful + for alpha-textures it's usable for HDR textures, where weighting should be approximately inverse to + luminance it's usable for perceptual weighting, where we assign higher weight to low-variability + regions than to high-variability regions. it's usable for suppressing off-edge block content in + case the texture doesn't actually extend to the edge of the block. + + For the default case (everything is evenly weighted), every weight is 1. For the RA,GA,BA,A case, + we multiply the R,G,B weights with that of the alpha. + + Putting the same weight in every component should result in the default case. + The following relations should hold: + + texel_weight_rg[i] = (texel_weight_r[i] + texel_weight_g[i]) / 2 + texel_weight_lum[i] = (texel_weight_r[i] + texel_weight_g[i] + texel_weight_b[i]) / 3 + texel_weight[i] = (texel_weight_r[i] + texel_weight_g[i] + texel_weight_b[i] + texel_weight_a[i] / 4 + */ + +struct error_weight_block +{ + float4 error_weights[MAX_TEXELS_PER_BLOCK]; + float texel_weight[MAX_TEXELS_PER_BLOCK]; + float texel_weight_gba[MAX_TEXELS_PER_BLOCK]; + float texel_weight_rba[MAX_TEXELS_PER_BLOCK]; + float texel_weight_rga[MAX_TEXELS_PER_BLOCK]; + float texel_weight_rgb[MAX_TEXELS_PER_BLOCK]; + + float texel_weight_rg[MAX_TEXELS_PER_BLOCK]; + float texel_weight_rb[MAX_TEXELS_PER_BLOCK]; + float texel_weight_gb[MAX_TEXELS_PER_BLOCK]; + float texel_weight_ra[MAX_TEXELS_PER_BLOCK]; + + float texel_weight_r[MAX_TEXELS_PER_BLOCK]; + float texel_weight_g[MAX_TEXELS_PER_BLOCK]; + float texel_weight_b[MAX_TEXELS_PER_BLOCK]; + float texel_weight_a[MAX_TEXELS_PER_BLOCK]; + + int contains_zeroweight_texels; +}; + + + +struct error_weight_block_orig +{ + float4 error_weights[MAX_TEXELS_PER_BLOCK]; +}; + + +// enumeration of all the quantization methods we support under this format. +enum quantization_method +{ + QUANT_2 = 0, + QUANT_3 = 1, + QUANT_4 = 2, + QUANT_5 = 3, + QUANT_6 = 4, + QUANT_8 = 5, + QUANT_10 = 6, + QUANT_12 = 7, + QUANT_16 = 8, + QUANT_20 = 9, + QUANT_24 = 10, + QUANT_32 = 11, + QUANT_40 = 12, + QUANT_48 = 13, + QUANT_64 = 14, + QUANT_80 = 15, + QUANT_96 = 16, + QUANT_128 = 17, + QUANT_160 = 18, + QUANT_192 = 19, + QUANT_256 = 20 +}; + + +/* + In ASTC, we support relatively many combinations of weight precisions and weight transfer functions. + As such, for each combination we support, we have a hardwired data structure. + + This structure provides the following information: A table, used to estimate the closest quantized + weight for a given floating-point weight. For each quantized weight, the corresponding unquantized + and floating-point values. For each quantized weight, a previous-value and a next-value. +*/ + +struct quantization_and_transfer_table +{ + quantization_method method; + uint8_t unquantized_value[32]; // 0..64 + float unquantized_value_flt[32]; // 0..1 + uint8_t prev_quantized_value[32]; + uint8_t next_quantized_value[32]; + uint8_t closest_quantized_weight[1025]; +}; + +extern const quantization_and_transfer_table quant_and_xfer_tables[12]; + + + +enum endpoint_formats +{ + FMT_LUMINANCE = 0, + FMT_LUMINANCE_DELTA = 1, + FMT_HDR_LUMINANCE_LARGE_RANGE = 2, + FMT_HDR_LUMINANCE_SMALL_RANGE = 3, + FMT_LUMINANCE_ALPHA = 4, + FMT_LUMINANCE_ALPHA_DELTA = 5, + FMT_RGB_SCALE = 6, + FMT_HDR_RGB_SCALE = 7, + FMT_RGB = 8, + FMT_RGB_DELTA = 9, + FMT_RGB_SCALE_ALPHA = 10, + FMT_HDR_RGB = 11, + FMT_RGBA = 12, + FMT_RGBA_DELTA = 13, + FMT_HDR_RGB_LDR_ALPHA = 14, + FMT_HDR_RGBA = 15, +}; + + + +struct symbolic_compressed_block +{ + int error_block; // 1 marks error block, 0 marks non-error-block. + int block_mode; // 0 to 2047. Negative value marks constant-color block (-1: FP16, -2:UINT16) + int partition_count; // 1 to 4; Zero marks a constant-color block. + int partition_index; // 0 to 1023 + int color_formats[4]; // color format for each endpoint color pair. + int color_formats_matched; // color format for all endpoint pairs are matched. + int color_values[4][12]; // quantized endpoint color pairs. + int color_quantization_level; + uint8_t plane1_weights[MAX_WEIGHTS_PER_BLOCK]; // quantized and decimated weights + uint8_t plane2_weights[MAX_WEIGHTS_PER_BLOCK]; + int plane2_color_component; // color component for the secondary plane of weights + int constant_color[4]; // constant-color, as FP16 or UINT16. Used for constant-color blocks only. +}; + + +struct physical_compressed_block +{ + uint8_t data[16]; +}; + + + + +const block_size_descriptor *get_block_size_descriptor(int xdim, int ydim, int zdim); + + +// *********************************************************** +// functions and data pertaining to quantization and encoding +// ********************************************************** +extern const uint8_t color_quantization_tables[21][256]; +extern const uint8_t color_unquantization_tables[21][256]; + +void encode_ise(int quantization_level, int elements, const uint8_t * input_data, uint8_t * output_data, int bit_offset); + +void decode_ise(int quantization_level, int elements, const uint8_t * input_data, uint8_t * output_data, int bit_offset); + +int compute_ise_bitcount(int items, quantization_method quant); + +void build_quantization_mode_table(void); +extern int quantization_mode_table[17][128]; + + +// ********************************************** +// functions and data pertaining to partitioning +// ********************************************** + +// function to get a pointer to a partition table or an array thereof. +const partition_info *get_partition_table(int xdim, int ydim, int zdim, int partition_count); + + + + +// functions to compute color averages and dominant directions +// for each partition in a block + + +void compute_averages_and_directions_rgb(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, + const float4 * color_scalefactors, float3 * averages, float3 * directions_rgb, float2 * directions_rg, float2 * directions_rb, float2 * directions_gb); + + + +void compute_averages_and_directions_rgba(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, + const float4 * color_scalefactors, + float4 * averages, float4 * directions_rgba, float3 * directions_gba, float3 * directions_rba, float3 * directions_rga, float3 * directions_rgb); + + +void compute_averages_and_directions_3_components(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, + const float3 * color_scalefactors, int component1, int component2, int component3, float3 * averages, float3 * directions); + +void compute_averages_and_directions_2_components(const partition_info * pt, + const imageblock * blk, + const error_weight_block * ewb, const float2 * color_scalefactors, int component1, int component2, float2 * averages, float2 * directions); + +// functions to compute error value across a tile given a partitioning +// (with the assumption that each partitioning has colors lying on a line where +// they are represented with infinite precision. Also return the length of the line +// segments that the partition's colors are actually projected onto. +float compute_error_squared_gba(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines, + // output: computed length of the partitioning's line. This is not part of the + // error introduced by partitioning itself, but us used to estimate the error introduced by quantization + float *length_of_lines); + +float compute_error_squared_rba(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines, + // output: computed length of the partitioning's line. This is not part of the + // error introduced by partitioning itself, but us used to estimate the error introduced by quantization + float *length_of_lines); + +float compute_error_squared_rga(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines, + // output: computed length of the partitioning's line. This is not part of the + // error introduced by partitioning itself, but us used to estimate the error introduced by quantization + float *length_of_lines); + +float compute_error_squared_rgb(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line3 * plines, + // output: computed length of the partitioning's line. This is not part of the + // error introduced by partitioning itself, but us used to estimate the error introduced by quantization + float *length_of_lines); + + +float compute_error_squared_rgba(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line4 * lines, // one line for each of the partitions. The lines are assumed to be normalized. + float *length_of_lines); + +float compute_error_squared_rg(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines); + +float compute_error_squared_rb(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines); + +float compute_error_squared_gb(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines); + +float compute_error_squared_ra(const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line2 * plines, float *length_of_lines); + + +// functions to compute error value across a tile for a particular line function +// for a single partition. +float compute_error_squared_rgb_single_partition(int partition_to_test, int xdim, int ydim, int zdim, const partition_info * pt, // the partition that we use when computing the squared-error. + const imageblock * blk, const error_weight_block * ewb, const processed_line3 * lin // the line for the partition. + ); + + + +// for each partition, compute its color weightings. +void compute_partition_error_color_weightings(int xdim, int ydim, int zdim, const error_weight_block * ewb, const partition_info * pi, float4 error_weightings[4], float4 color_scalefactors[4]); + + + +// function to find the best partitioning for a given block. + +void find_best_partitionings(int partition_search_limit, int xdim, int ydim, int zdim, int partition_count, const imageblock * pb, const error_weight_block * ewb, int candidates_to_return, + // best partitionings to use if the endpoint colors are assumed to be uncorrelated + int *best_partitions_uncorrellated, + // best partitionings to use if the endpoint colors have the same chroma + int *best_partitions_samechroma, + // best partitionings to use if dual plane of weights are present + int *best_partitions_dual_weight_planes); + + +// use k-means clustering to compute a partition ordering for a block. +void kmeans_compute_partition_ordering(int xdim, int ydim, int zdim, int partition_count, const imageblock * blk, int *ordering); + + + + +// ********************************************************* +// functions and data pertaining to images and imageblocks +// ********************************************************* + +struct astc_codec_image +{ + uint8_t ***imagedata8; + uint16_t ***imagedata16; + int xsize; + int ysize; + int zsize; + int padding; +}; + +void destroy_image(astc_codec_image * img); +astc_codec_image *allocate_image(int bitness, int xsize, int ysize, int zsize, int padding); +void initialize_image(astc_codec_image * img); +void fill_image_padding_area(astc_codec_image * img); + + +extern float4 ***input_averages; +extern float4 ***input_variances; +extern float ***input_alpha_averages; + + +// the entries here : 0=red, 1=green, 2=blue, 3=alpha, 4=0.0, 5=1.0 +struct swizzlepattern +{ + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t a; +}; + + + +int determine_image_channels(const astc_codec_image * img); + +// function to compute regional averages and variances for an image +void compute_averages_and_variances(const astc_codec_image * img, float rgb_power_to_use, float alpha_power_to_use, int avg_kernel_radius, int var_kernel_radius, swizzlepattern swz); + + +/* + Functions to load image from file. + If successful, return an astc_codec_image object. + If unsuccessful, returns NULL. + + *result is used to return a result. In case of a successfully loaded image, bits[2:0] + of *result indicate how many components are present, and bit[7] indicate whether + the input image was LDR or HDR (0=LDR, 1=HDR). + + In case of failure, *result is given a negative value. +*/ + + +astc_codec_image *load_ktx_uncompressed_image(const char *filename, int padding, int *result); +astc_codec_image *load_dds_uncompressed_image(const char *filename, int padding, int *result); +astc_codec_image *load_tga_image(const char *tga_filename, int padding, int *result); +astc_codec_image *load_image_with_stb(const char *filename, int padding, int *result); + +astc_codec_image *astc_codec_load_image(const char *filename, int padding, int *result); +int astc_codec_unlink(const char *filename); + +// function to store image to file +// If successful, returns the number of channels in input image +// If unsuccessful, returns a negative number. +int store_ktx_uncompressed_image(const astc_codec_image * img, const char *filename, int bitness); +int store_dds_uncompressed_image(const astc_codec_image * img, const char *filename, int bitness); +int store_tga_image(const astc_codec_image * img, const char *tga_filename, int bitness); + +int astc_codec_store_image(const astc_codec_image * img, const char *filename, int bitness, const char **format_string); + +int get_output_filename_enforced_bitness(const char *filename); + + +// compute a bunch of error metrics +void compute_error_metrics(int input_image_is_hdr, int input_components, const astc_codec_image * img1, const astc_codec_image * img2, int low_fstop, int high_fstop, int psnrmode); + +// fetch an image-block from the input file +void fetch_imageblock(const astc_codec_image * img, imageblock * pb, // picture-block to initialize with image data + // block dimensions + int xdim, int ydim, int zdim, + // position in picture to fetch block from + int xpos, int ypos, int zpos, swizzlepattern swz); + + +// write an image block to the output file buffer. +// the data written are taken from orig_data. +void write_imageblock(astc_codec_image * img, const imageblock * pb, // picture-block to initialize with image data + // block dimensions + int xdim, int ydim, int zdim, + // position in picture to write block to. + int xpos, int ypos, int zpos, swizzlepattern swz); + + +// helper function to check whether a given picture-block has alpha that is not +// just uniformly 1. +int imageblock_uses_alpha(int xdim, int ydim, int zdim, const imageblock * pb); + + +float compute_imageblock_difference(int xdim, int ydim, int zdim, const imageblock * p1, const imageblock * p2, const error_weight_block * ewb); + + + + + +// *********************************************************** +// functions pertaining to computing texel weights for a block +// *********************************************************** + + +struct endpoints +{ + int partition_count; + float4 endpt0[4]; + float4 endpt1[4]; +}; + + +struct endpoints_and_weights +{ + endpoints ep; + float weights[MAX_TEXELS_PER_BLOCK]; + float weight_error_scale[MAX_TEXELS_PER_BLOCK]; +}; + + +void compute_endpoints_and_ideal_weights_1_plane(int xdim, int ydim, int zdim, const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, endpoints_and_weights * ei); + +void compute_endpoints_and_ideal_weights_2_planes(int xdim, int ydim, int zdim, const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, int separate_component, + endpoints_and_weights * ei1, // for the three components of the primary plane of weights + endpoints_and_weights * ei2 // for the remaining component. + ); + +void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * eai, const decimation_table * it, float *weight_set, float *weights); + +void compute_ideal_quantized_weights_for_decimation_table(const endpoints_and_weights * eai, + const decimation_table * it, + float low_bound, float high_bound, const float *weight_set_in, float *weight_set_out, uint8_t * quantized_weight_set, int quantization_level); + + +float compute_error_of_weight_set(const endpoints_and_weights * eai, const decimation_table * it, const float *weights); + + +float compute_value_of_texel_flt(int texel_to_get, const decimation_table * it, const float *weights); + + +int compute_value_of_texel_int(int texel_to_get, const decimation_table * it, const int *weights); + + +void merge_endpoints(const endpoints * ep1, // contains three of the color components + const endpoints * ep2, // contains the remaining color component + int separate_component, endpoints * res); + +// functions dealing with color endpoints + +// function to pack a pair of color endpoints into a series of integers. +// the format used may or may not match the format specified; +// the return value is the format actually used. +int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, float2 luminances, int format, int *output, int quantization_level); + + +// unpack a pair of color endpoints from a series of integers. +void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1); + + +struct encoding_choice_errors +{ + float rgb_scale_error; // error of using LDR RGB-scale instead of complete endpoints. + float rgb_luma_error; // error of using HDR RGB-scale instead of complete endpoints. + float luminance_error; // error of using luminance instead of RGB + float alpha_drop_error; // error of discarding alpha + float rgb_drop_error; // error of discarding RGB + int can_offset_encode; + int can_blue_contract; +}; + +// buffers used to store intermediate data in compress_symbolic_block_fixed_partition_*() +struct compress_fixed_partition_buffers +{ + endpoints_and_weights* ei1; + endpoints_and_weights* ei2; + endpoints_and_weights* eix1; + endpoints_and_weights* eix2; + float *decimated_quantized_weights; + float *decimated_weights; + float *flt_quantized_decimated_quantized_weights; + uint8_t *u8_quantized_decimated_quantized_weights; +}; + +struct compress_symbolic_block_buffers +{ + error_weight_block *ewb; + error_weight_block_orig *ewbo; + symbolic_compressed_block *tempblocks; + imageblock *temp; + compress_fixed_partition_buffers *plane1; + compress_fixed_partition_buffers *planes2; +}; + +void compute_encoding_choice_errors(int xdim, int ydim, int zdim, const imageblock * pb, const partition_info * pi, const error_weight_block * ewb, + int separate_component, // component that is separated out in 2-plane mode, -1 in 1-plane mode + encoding_choice_errors * eci); + + + +void determine_optimal_set_of_endpoint_formats_to_use(int xdim, int ydim, int zdim, const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, const endpoints * ep, + int separate_component, // separate color component for 2-plane mode; -1 for single-plane mode + // bitcounts and errors computed for the various quantization methods + const int *qwt_bitcounts, const float *qwt_errors, + // output data + int partition_format_specifiers[4][4], int quantized_weight[4], int quantization_level[4], int quantization_level_mod[4]); + + +void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantization_mode, endpoints * ep, // contains the endpoints we wish to update + float4 * rgbs_vectors, // used to return RGBS-vectors for endpoint mode #6 + float4 * rgbo_vectors, // used to return RGBS-vectors for endpoint mode #7 + float2 * lum_vectors, // used to return luminance-vectors. + const uint8_t * weight_set, // the current set of weight values + const uint8_t * plane2_weight_set, // NULL if plane 2 is not actually used. + int plane2_color_component, // color component for 2nd plane of weights; -1 if the 2nd plane of weights is not present + const partition_info * pi, const decimation_table * it, const imageblock * pb, // picture-block containing the actual data. + const error_weight_block * ewb); + + + +void expand_block_artifact_suppression(int xdim, int ydim, int zdim, error_weighting_params * ewp); + +// Function to set error weights for each color component for each texel in a block. +// Returns the sum of all the error values set. +float prepare_error_weight_block(const astc_codec_image * input_image, + // dimensions of error weight block. + int xdim, int ydim, int zdim, const error_weighting_params * ewp, const imageblock * blk, error_weight_block * ewb, error_weight_block_orig * ewbo); + + +// functions pertaining to weight alignment +void prepare_angular_tables(void); + +void compute_angular_endpoints_1plane(float mode_cutoff, + const block_size_descriptor * bsd, + const float *decimated_quantized_weights, const float *decimated_weights, float low_value[MAX_WEIGHT_MODES], float high_value[MAX_WEIGHT_MODES]); + +void compute_angular_endpoints_2planes(float mode_cutoff, + const block_size_descriptor * bsd, + const float *decimated_quantized_weights, + const float *decimated_weights, + float low_value1[MAX_WEIGHT_MODES], float high_value1[MAX_WEIGHT_MODES], float low_value2[MAX_WEIGHT_MODES], float high_value2[MAX_WEIGHT_MODES]); + + + + +/* *********************************** high-level encode and decode functions ************************************ */ + +float compress_symbolic_block(const astc_codec_image * input_image, + astc_decode_mode decode_mode, int xdim, int ydim, int zdim, const error_weighting_params * ewp, const imageblock * blk, symbolic_compressed_block * scb, + compress_symbolic_block_buffers * tmpbuf); + + +float4 lerp_color_flt(const float4 color0, const float4 color1, float weight, // 0..1 + float plane2_weight, // 0..1 + int plane2_color_component // 0..3; -1 if only one plane of weights is present. + ); + + +ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 color1, int weight, // 0..64 + int plane2_weight, // 0..64 + int plane2_color_component // 0..3; -1 if only one plane of weights is present. + ); + + +void decompress_symbolic_block(astc_decode_mode decode_mode, + // dimensions of block + int xdim, int ydim, int zdim, + // position of block + int xpos, int ypos, int zpos, const symbolic_compressed_block * scb, imageblock * blk); + + +physical_compressed_block symbolic_to_physical(int xdim, int ydim, int zdim, const symbolic_compressed_block * sc); + +void physical_to_symbolic(int xdim, int ydim, int zdim, physical_compressed_block pb, symbolic_compressed_block * res); + + +uint16_t unorm16_to_sf16(uint16_t p); +uint16_t lns_to_sf16(uint16_t p); + + +#endif diff --git a/3rdparty/bimg/3rdparty/astc/astc_color_quantize.cpp b/3rdparty/bimg/3rdparty/astc/astc_color_quantize.cpp new file mode 100644 index 00000000000..caa2ba8033f --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_color_quantize.cpp @@ -0,0 +1,2096 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Color quantization functions for ASTC. + */ +/*----------------------------------------------------------------------------*/ + +#include + +#include "astc_codec_internals.h" +#include "softfloat.h" +#include + +#ifdef DEBUG_PRINT_DIAGNOSTICS + #include +#endif + +/* + quantize an LDR RGB color. Since this is a fall-back encoding, we cannot actually + fail but must just go on until we can produce a sensible result. + + Due to how this encoding works, color0 cannot be larger than color1; as such, + if color0 is actually larger than color1, then color0 is reduced and color1 is + increased until color0 is no longer larger than color1. +*/ +static inline int cqt_lookup(int quantization_level, int value) +{ + if (value < 0) + value = 0; + else if (value > 255) + value = 255; + return color_quantization_tables[quantization_level][value]; +} + +// clamp an input value to [0,255]; NaN is turned into 0 +static inline float clamp255(float val) +{ + if (val > 255.0f) + val = 255.0f; + else if (val > 0.0f) + { + // deliberately empty + // switching the order of calculation here will fail to handle 0. + } + else + val = 0.0f; + + return val; +} + + + +// clamp an input value to [0,1]; Nan is turned into 0. + +static inline float clamp01(float val) +{ + if (val > 1.0f) + val = 1.0f; + else if (val > 0.0f) + { + // deliberately empty + // switching the order of calculation here will fail to handle 0. + } + else + val = 0.0f; + + return val; +} + + + +void quantize_rgb(float4 color0, // LDR: 0=lowest, 255=highest + float4 color1, int output[6], int quantization_level) +{ + color0.xyz = color0.xyz * (1.0f / 257.0f); + color1.xyz = color1.xyz * (1.0f / 257.0f); + + + float r0 = clamp255(color0.x); + float g0 = clamp255(color0.y); + float b0 = clamp255(color0.z); + + float r1 = clamp255(color1.x); + float g1 = clamp255(color1.y); + float b1 = clamp255(color1.z); + + int ri0, gi0, bi0, ri1, gi1, bi1; + int ri0b, gi0b, bi0b, ri1b, gi1b, bi1b; + float rgb0_addon = 0.5f; + float rgb1_addon = 0.5f; + int iters = 0; + do + { + ri0 = cqt_lookup(quantization_level, (int)floor(r0 + rgb0_addon)); + gi0 = cqt_lookup(quantization_level, (int)floor(g0 + rgb0_addon)); + bi0 = cqt_lookup(quantization_level, (int)floor(b0 + rgb0_addon)); + ri1 = cqt_lookup(quantization_level, (int)floor(r1 + rgb1_addon)); + gi1 = cqt_lookup(quantization_level, (int)floor(g1 + rgb1_addon)); + bi1 = cqt_lookup(quantization_level, (int)floor(b1 + rgb1_addon)); + + ri0b = color_unquantization_tables[quantization_level][ri0]; + gi0b = color_unquantization_tables[quantization_level][gi0]; + bi0b = color_unquantization_tables[quantization_level][bi0]; + ri1b = color_unquantization_tables[quantization_level][ri1]; + gi1b = color_unquantization_tables[quantization_level][gi1]; + bi1b = color_unquantization_tables[quantization_level][bi1]; + + rgb0_addon -= 0.2f; + rgb1_addon += 0.2f; + iters++; + } + while (ri0b + gi0b + bi0b > ri1b + gi1b + bi1b); + + output[0] = ri0; + output[1] = ri1; + output[2] = gi0; + output[3] = gi1; + output[4] = bi0; + output[5] = bi1; +} + + +/* + quantize an RGBA color. */ +void quantize_rgba(float4 color0, float4 color1, int output[8], int quantization_level) +{ + color0.w = color0.w * (1.0f / 257.0f); + color1.w = color1.w * (1.0f / 257.0f); + + float a0 = clamp255(color0.w); + float a1 = clamp255(color1.w); + int ai0 = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)]; + int ai1 = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)]; + + output[6] = ai0; + output[7] = ai1; + + quantize_rgb(color0, color1, output, quantization_level); +} + + + +/* + attempt to quantize RGB endpoint values with blue-contraction. Returns 1 on failure, 0 on success. */ +int try_quantize_rgb_blue_contract(float4 color0, // assumed to be the smaller color + float4 color1, // assumed to be the larger color + int output[6], int quantization_level) +{ + color0.xyz = color0.xyz * (1.0f / 257.0f); + color1.xyz = color1.xyz * (1.0f / 257.0f); + + float r0 = color0.x; + float g0 = color0.y; + float b0 = color0.z; + + float r1 = color1.x; + float g1 = color1.y; + float b1 = color1.z; + + // inverse blue-contraction. This can produce an overflow; + // just bail out immediately if this is the case. + r0 += (r0 - b0); + g0 += (g0 - b0); + r1 += (r1 - b1); + g1 += (g1 - b1); + + if (r0 < 0.0f || r0 > 255.0f || g0 < 0.0f || g0 > 255.0f || b0 < 0.0f || b0 > 255.0f || + r1 < 0.0f || r1 > 255.0f || g1 < 0.0f || g1 > 255.0f || b1 < 0.0f || b1 > 255.0f) + { + return 0; + } + + // quantize the inverse-blue-contracted color + int ri0 = color_quantization_tables[quantization_level][(int)floor(r0 + 0.5f)]; + int gi0 = color_quantization_tables[quantization_level][(int)floor(g0 + 0.5f)]; + int bi0 = color_quantization_tables[quantization_level][(int)floor(b0 + 0.5f)]; + int ri1 = color_quantization_tables[quantization_level][(int)floor(r1 + 0.5f)]; + int gi1 = color_quantization_tables[quantization_level][(int)floor(g1 + 0.5f)]; + int bi1 = color_quantization_tables[quantization_level][(int)floor(b1 + 0.5f)]; + + // then unquantize again + int ru0 = color_unquantization_tables[quantization_level][ri0]; + int gu0 = color_unquantization_tables[quantization_level][gi0]; + int bu0 = color_unquantization_tables[quantization_level][bi0]; + int ru1 = color_unquantization_tables[quantization_level][ri1]; + int gu1 = color_unquantization_tables[quantization_level][gi1]; + int bu1 = color_unquantization_tables[quantization_level][bi1]; + + // if color #1 is not larger than color #0, then blue-contraction is not a valid approach. + // note that blue-contraction and quantization may itself change this order, which is why + // we must only test AFTER blue-contraction. + if (ru1 + gu1 + bu1 <= ru0 + gu0 + bu0) + return 0; + + output[0] = ri1; + output[1] = ri0; + output[2] = gi1; + output[3] = gi0; + output[4] = bi1; + output[5] = bi0; + + return 1; +} + + + + +/* + quantize an RGBA color with blue-contraction */ +int try_quantize_rgba_blue_contract(float4 color0, float4 color1, int output[8], int quantization_level) +{ + color0.w = color0.w * (1.0f / 257.0f); + color1.w = color1.w * (1.0f / 257.0f); + + float a0 = clamp255(color0.w); + float a1 = clamp255(color1.w); + + output[7] = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)]; + output[6] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)]; + + return try_quantize_rgb_blue_contract(color0, color1, output, quantization_level); +} + + +// delta-encoding: +// at decode time, we move one bit from the offset to the base and seize another bit as a sign bit; +// we then unquantize both values as if they contain one extra bit. + +// if the sum of the offsets is nonnegative, then we encode a regular delta. + + +/* + attempt to quantize an RGB endpoint value with delta-encoding. */ + +int try_quantize_rgb_delta(float4 color0, float4 color1, int output[6], int quantization_level) +{ + color0.xyz = color0.xyz * (1.0f / 257.0f); + color1.xyz = color1.xyz * (1.0f / 257.0f); + + float r0 = clamp255(color0.x); + float g0 = clamp255(color0.y); + float b0 = clamp255(color0.z); + + float r1 = clamp255(color1.x); + float g1 = clamp255(color1.y); + float b1 = clamp255(color1.z); + + // transform r0 to unorm9 + int r0a = (int)floor(r0 + 0.5f); + int g0a = (int)floor(g0 + 0.5f); + int b0a = (int)floor(b0 + 0.5f); + r0a <<= 1; + g0a <<= 1; + b0a <<= 1; + + // mask off the top bit + int r0b = r0a & 0xFF; + int g0b = g0a & 0xFF; + int b0b = b0a & 0xFF; + + // quantize, then unquantize in order to get a value that we take + // differences against. + int r0be = color_quantization_tables[quantization_level][r0b]; + int g0be = color_quantization_tables[quantization_level][g0b]; + int b0be = color_quantization_tables[quantization_level][b0b]; + + r0b = color_unquantization_tables[quantization_level][r0be]; + g0b = color_unquantization_tables[quantization_level][g0be]; + b0b = color_unquantization_tables[quantization_level][b0be]; + r0b |= r0a & 0x100; // final unquantized-values for endpoint 0. + g0b |= g0a & 0x100; + b0b |= b0a & 0x100; + + // then, get hold of the second value + int r1d = (int)floor(r1 + 0.5f); + int g1d = (int)floor(g1 + 0.5f); + int b1d = (int)floor(b1 + 0.5f); + + r1d <<= 1; + g1d <<= 1; + b1d <<= 1; + // and take differences! + r1d -= r0b; + g1d -= g0b; + b1d -= b0b; + + // check if the difference is too large to be encodable. + if (r1d > 63 || g1d > 63 || b1d > 63 || r1d < -64 || g1d < -64 || b1d < -64) + return 0; + + // insert top bit of the base into the offset + r1d &= 0x7F; + g1d &= 0x7F; + b1d &= 0x7F; + + r1d |= (r0b & 0x100) >> 1; + g1d |= (g0b & 0x100) >> 1; + b1d |= (b0b & 0x100) >> 1; + + // then quantize & unquantize; if this causes any of the top two bits to flip, + // then encoding fails, since we have then corrupted either the top bit of the base + // or the sign bit of the offset. + int r1de = color_quantization_tables[quantization_level][r1d]; + int g1de = color_quantization_tables[quantization_level][g1d]; + int b1de = color_quantization_tables[quantization_level][b1d]; + + int r1du = color_unquantization_tables[quantization_level][r1de]; + int g1du = color_unquantization_tables[quantization_level][g1de]; + int b1du = color_unquantization_tables[quantization_level][b1de]; + + if (((r1d ^ r1du) | (g1d ^ g1du) | (b1d ^ b1du)) & 0xC0) + return 0; + + // check that the sum of the encoded offsets is nonnegative, else encoding fails + r1du &= 0x7f; + g1du &= 0x7f; + b1du &= 0x7f; + if (r1du & 0x40) + r1du -= 0x80; + if (g1du & 0x40) + g1du -= 0x80; + if (b1du & 0x40) + b1du -= 0x80; + if (r1du + g1du + b1du < 0) + return 0; + + // check that the offsets produce legitimate sums as well. + r1du += r0b; + g1du += g0b; + b1du += b0b; + if (r1du < 0 || r1du > 0x1FF || g1du < 0 || g1du > 0x1FF || b1du < 0 || b1du > 0x1FF) + return 0; + + // OK, we've come this far; we can now encode legitimate values. + output[0] = r0be; + output[1] = r1de; + output[2] = g0be; + output[3] = g1de; + output[4] = b0be; + output[5] = b1de; + + return 1; +} + + +int try_quantize_rgb_delta_blue_contract(float4 color0, float4 color1, int output[6], int quantization_level) +{ + color0.xyz = color0.xyz * (1.0f / 257.0f); + color1.xyz = color1.xyz * (1.0f / 257.0f); + + // switch around endpoint colors already at start. + float r0 = color1.x; + float g0 = color1.y; + float b0 = color1.z; + + float r1 = color0.x; + float g1 = color0.y; + float b1 = color0.z; + + // inverse blue-contraction. This step can perform an overflow, in which case + // we will bail out immediately. + r0 += (r0 - b0); + g0 += (g0 - b0); + r1 += (r1 - b1); + g1 += (g1 - b1); + + if (r0 < 0.0f || r0 > 255.0f || g0 < 0.0f || g0 > 255.0f || b0 < 0.0f || b0 > 255.0f || r1 < 0.0f || r1 > 255.0f || g1 < 0.0f || g1 > 255.0f || b1 < 0.0f || b1 > 255.0f) + return 0; + + // transform r0 to unorm9 + int r0a = (int)floor(r0 + 0.5f); + int g0a = (int)floor(g0 + 0.5f); + int b0a = (int)floor(b0 + 0.5f); + r0a <<= 1; + g0a <<= 1; + b0a <<= 1; + + // mask off the top bit + int r0b = r0a & 0xFF; + int g0b = g0a & 0xFF; + int b0b = b0a & 0xFF; + + // quantize, then unquantize in order to get a value that we take + // differences against. + int r0be = color_quantization_tables[quantization_level][r0b]; + int g0be = color_quantization_tables[quantization_level][g0b]; + int b0be = color_quantization_tables[quantization_level][b0b]; + + r0b = color_unquantization_tables[quantization_level][r0be]; + g0b = color_unquantization_tables[quantization_level][g0be]; + b0b = color_unquantization_tables[quantization_level][b0be]; + r0b |= r0a & 0x100; // final unquantized-values for endpoint 0. + g0b |= g0a & 0x100; + b0b |= b0a & 0x100; + + // then, get hold of the second value + int r1d = (int)floor(r1 + 0.5f); + int g1d = (int)floor(g1 + 0.5f); + int b1d = (int)floor(b1 + 0.5f); + + r1d <<= 1; + g1d <<= 1; + b1d <<= 1; + // and take differences! + r1d -= r0b; + g1d -= g0b; + b1d -= b0b; + + // check if the difference is too large to be encodable. + if (r1d > 63 || g1d > 63 || b1d > 63 || r1d < -64 || g1d < -64 || b1d < -64) + return 0; + + // insert top bit of the base into the offset + r1d &= 0x7F; + g1d &= 0x7F; + b1d &= 0x7F; + + r1d |= (r0b & 0x100) >> 1; + g1d |= (g0b & 0x100) >> 1; + b1d |= (b0b & 0x100) >> 1; + + // then quantize & unquantize; if this causes any of the top two bits to flip, + // then encoding fails, since we have then corrupted either the top bit of the base + // or the sign bit of the offset. + int r1de = color_quantization_tables[quantization_level][r1d]; + int g1de = color_quantization_tables[quantization_level][g1d]; + int b1de = color_quantization_tables[quantization_level][b1d]; + + int r1du = color_unquantization_tables[quantization_level][r1de]; + int g1du = color_unquantization_tables[quantization_level][g1de]; + int b1du = color_unquantization_tables[quantization_level][b1de]; + + if (((r1d ^ r1du) | (g1d ^ g1du) | (b1d ^ b1du)) & 0xC0) + return 0; + + // check that the sum of the encoded offsets is negative, else encoding fails + // note that this is inverse of the test for non-blue-contracted RGB. + r1du &= 0x7f; + g1du &= 0x7f; + b1du &= 0x7f; + if (r1du & 0x40) + r1du -= 0x80; + if (g1du & 0x40) + g1du -= 0x80; + if (b1du & 0x40) + b1du -= 0x80; + if (r1du + g1du + b1du >= 0) + return 0; + + // check that the offsets produce legitimate sums as well. + r1du += r0b; + g1du += g0b; + b1du += b0b; + if (r1du < 0 || r1du > 0x1FF || g1du < 0 || g1du > 0x1FF || b1du < 0 || b1du > 0x1FF) + return 0; + + // OK, we've come this far; we can now encode legitimate values. + output[0] = r0be; + output[1] = r1de; + output[2] = g0be; + output[3] = g1de; + output[4] = b0be; + output[5] = b1de; + + return 1; +} + + +int try_quantize_alpha_delta(float4 color0, float4 color1, int output[8], int quantization_level) +{ + color0.w = color0.w * (1.0f / 257.0f); + color1.w = color1.w * (1.0f / 257.0f); + + // the calculation for alpha-delta is exactly the same as for RGB-delta; see + // the RGB-delta function for comments. + float a0 = clamp255(color0.w); + float a1 = clamp255(color1.w); + + int a0a = (int)floor(a0 + 0.5f); + a0a <<= 1; + int a0b = a0a & 0xFF; + int a0be = color_quantization_tables[quantization_level][a0b]; + a0b = color_unquantization_tables[quantization_level][a0be]; + a0b |= a0a & 0x100; + int a1d = (int)floor(a1 + 0.5f); + a1d <<= 1; + a1d -= a0b; + if (a1d > 63 || a1d < -64) + return 0; + a1d &= 0x7F; + a1d |= (a0b & 0x100) >> 1; + int a1de = color_quantization_tables[quantization_level][a1d]; + int a1du = color_unquantization_tables[quantization_level][a1de]; + if ((a1d ^ a1du) & 0xC0) + return 0; + a1du &= 0x7F; + if (a1du & 0x40) + a1du -= 0x80; + a1du += a0b; + if (a1du < 0 || a1du > 0x1FF) + return 0; + output[6] = a0be; + output[7] = a1de; + return 1; +} + + + +int try_quantize_luminance_alpha_delta(float4 color0, float4 color1, int output[8], int quantization_level) +{ + float l0 = clamp255((color0.x + color0.y + color0.z) * ((1.0f / 3.0f) * (1.0f / 257.0f))); + float l1 = clamp255((color1.x + color1.y + color1.z) * ((1.0f / 3.0f) * (1.0f / 257.0f))); + float a0 = clamp255(color0.w * (1.0f / 257.0f)); + float a1 = clamp255(color1.w * (1.0f / 257.0f)); + + int l0a = (int)floor(l0 + 0.5f); + int a0a = (int)floor(a0 + 0.5f); + l0a <<= 1; + a0a <<= 1; + int l0b = l0a & 0xFF; + int a0b = a0a & 0xFF; + int l0be = color_quantization_tables[quantization_level][l0b]; + int a0be = color_quantization_tables[quantization_level][a0b]; + l0b = color_unquantization_tables[quantization_level][l0be]; + a0b = color_unquantization_tables[quantization_level][a0be]; + l0b |= l0a & 0x100; + a0b |= a0a & 0x100; + int l1d = (int)floor(l1 + 0.5f); + int a1d = (int)floor(a1 + 0.5f); + l1d <<= 1; + a1d <<= 1; + l1d -= l0b; + a1d -= a0b; + if (l1d > 63 || l1d < -64) + return 0; + if (a1d > 63 || a1d < -64) + return 0; + l1d &= 0x7F; + a1d &= 0x7F; + l1d |= (l0b & 0x100) >> 1; + a1d |= (a0b & 0x100) >> 1; + + int l1de = color_quantization_tables[quantization_level][l1d]; + int a1de = color_quantization_tables[quantization_level][a1d]; + int l1du = color_unquantization_tables[quantization_level][l1de]; + int a1du = color_unquantization_tables[quantization_level][a1de]; + if ((l1d ^ l1du) & 0xC0) + return 0; + if ((a1d ^ a1du) & 0xC0) + return 0; + l1du &= 0x7F; + a1du &= 0x7F; + if (l1du & 0x40) + l1du -= 0x80; + if (a1du & 0x40) + a1du -= 0x80; + l1du += l0b; + a1du += a0b; + if (l1du < 0 || l1du > 0x1FF) + return 0; + if (a1du < 0 || a1du > 0x1FF) + return 0; + output[0] = l0be; + output[1] = l1de; + output[2] = a0be; + output[3] = a1de; + + return 1; +} + + + + +int try_quantize_rgba_delta(float4 color0, float4 color1, int output[8], int quantization_level) +{ + int alpha_delta_res = try_quantize_alpha_delta(color0, color1, output, quantization_level); + + if (alpha_delta_res == 0) + return 0; + + return try_quantize_rgb_delta(color0, color1, output, quantization_level); +} + + +int try_quantize_rgba_delta_blue_contract(float4 color0, float4 color1, int output[8], int quantization_level) +{ + // notice that for the alpha encoding, we are swapping around color0 and color1; + // this is because blue-contraction involves swapping around the two colors. + int alpha_delta_res = try_quantize_alpha_delta(color1, color0, output, quantization_level); + + if (alpha_delta_res == 0) + return 0; + + return try_quantize_rgb_delta_blue_contract(color0, color1, output, quantization_level); +} + + + +void quantize_rgbs_new(float4 rgbs_color, // W component is a desired-scale to apply, in the range 0..1 + int output[4], int quantization_level) +{ + rgbs_color.xyz = rgbs_color.xyz * (1.0f / 257.0f); + + float r = clamp255(rgbs_color.x); + float g = clamp255(rgbs_color.y); + float b = clamp255(rgbs_color.z); + + int ri = color_quantization_tables[quantization_level][(int)floor(r + 0.5f)]; + int gi = color_quantization_tables[quantization_level][(int)floor(g + 0.5f)]; + int bi = color_quantization_tables[quantization_level][(int)floor(b + 0.5f)]; + + int ru = color_unquantization_tables[quantization_level][ri]; + int gu = color_unquantization_tables[quantization_level][gi]; + int bu = color_unquantization_tables[quantization_level][bi]; + + float oldcolorsum = rgbs_color.x + rgbs_color.y + rgbs_color.z; + float newcolorsum = (float)(ru + gu + bu); + + float scale = clamp01(rgbs_color.w * (oldcolorsum + 1e-10f) / (newcolorsum + 1e-10f)); + + int scale_idx = (int)floor(scale * 256.0f + 0.5f); + + if (scale_idx < 0) + scale_idx = 0; + else if (scale_idx > 255) + scale_idx = 255; + + output[0] = ri; + output[1] = gi; + output[2] = bi; + output[3] = color_quantization_tables[quantization_level][scale_idx]; +} + + + +void quantize_rgbs_alpha_new(float4 color0, float4 color1, float4 rgbs_color, int output[6], int quantization_level) +{ + color0.w = color0.w * (1.0f / 257.0f); + color1.w = color1.w * (1.0f / 257.0f); + + float a0 = clamp255(color0.w); + float a1 = clamp255(color1.w); + + int ai0 = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)]; + int ai1 = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)]; + + output[4] = ai0; + output[5] = ai1; + + quantize_rgbs_new(rgbs_color, output, quantization_level); +} + + + +void quantize_luminance(float4 color0, float4 color1, int output[2], int quantization_level) +{ + color0.xyz = color0.xyz * (1.0f / 257.0f); + color1.xyz = color1.xyz * (1.0f / 257.0f); + + float lum0 = clamp255((color0.x + color0.y + color0.z) * (1.0f / 3.0f)); + float lum1 = clamp255((color1.x + color1.y + color1.z) * (1.0f / 3.0f)); + + if (lum0 > lum1) + { + float avg = (lum0 + lum1) * 0.5f; + lum0 = avg; + lum1 = avg; + } + + output[0] = color_quantization_tables[quantization_level][(int)floor(lum0 + 0.5f)]; + output[1] = color_quantization_tables[quantization_level][(int)floor(lum1 + 0.5f)]; +} + + + + + + +void quantize_luminance_alpha(float4 color0, float4 color1, int output[4], int quantization_level) +{ + color0 = color0 * (1.0f / 257.0f); + color1 = color1 * (1.0f / 257.0f); + + float lum0 = clamp255((color0.x + color0.y + color0.z) * (1.0f / 3.0f)); + float lum1 = clamp255((color1.x + color1.y + color1.z) * (1.0f / 3.0f)); + float a0 = clamp255(color0.w); + float a1 = clamp255(color1.w); + + // if the endpoints are *really* close, then pull them apart slightly; + // this affords for >8 bits precision for normal maps. + if (quantization_level > 18 && fabs(lum0 - lum1) < 3.0f) + { + if (lum0 < lum1) + { + lum0 -= 0.5f; + lum1 += 0.5f; + } + else + { + lum0 += 0.5f; + lum1 -= 0.5f; + } + lum0 = clamp255(lum0); + lum1 = clamp255(lum1); + } + if (quantization_level > 18 && fabs(a0 - a1) < 3.0f) + { + if (a0 < a1) + { + a0 -= 0.5f; + a1 += 0.5f; + } + else + { + a0 += 0.5f; + a1 -= 0.5f; + } + a0 = clamp255(a0); + a1 = clamp255(a1); + } + + + output[0] = color_quantization_tables[quantization_level][(int)floor(lum0 + 0.5f)]; + output[1] = color_quantization_tables[quantization_level][(int)floor(lum1 + 0.5f)]; + output[2] = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)]; + output[3] = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)]; +} + + +void quantize0(float4 color0, float4 color1, int output[8], int quantization_level) +{ + IGNORE(color0); + IGNORE(color1); + IGNORE(output); + IGNORE(quantization_level); + + int i; + for (i = 0; i < 8; i++) + output[i] = 0; +} + + +// quantize and unquantize a number, wile making sure to retain the top two bits. +static inline void quantize_and_unquantize_retain_top_two_bits(int quantization_level, int value_to_quantize, // 0 to 255. + int *quantized_value, int *unquantized_value) +{ + + int perform_loop; + int quantval; + int uquantval; + + do + { + quantval = color_quantization_tables[quantization_level][value_to_quantize]; + uquantval = color_unquantization_tables[quantization_level][quantval]; + + // perform looping if the top two bits were modified by quant/unquant + perform_loop = (value_to_quantize & 0xC0) != (uquantval & 0xC0); + + if ((uquantval & 0xC0) > (value_to_quantize & 0xC0)) + { + // quant/unquant rounded UP so that the top two bits changed; + // decrement the input value in hopes that this will avoid rounding up. + value_to_quantize--; + } + else if ((uquantval & 0xC0) < (value_to_quantize & 0xC0)) + { + // quant/unquant rounded DOWN so that the top two bits changed; + // decrement the input value in hopes that this will avoid rounding down. + value_to_quantize--; + } + } + while (perform_loop); + + *quantized_value = quantval; + *unquantized_value = uquantval; +} + + +// quantize and unquantize a number, wile making sure to retain the top four bits. +static inline void quantize_and_unquantize_retain_top_four_bits(int quantization_level, int value_to_quantize, // 0 to 255. + int *quantized_value, int *unquantized_value) +{ + + int perform_loop; + int quantval; + int uquantval; + + do + { + quantval = color_quantization_tables[quantization_level][value_to_quantize]; + uquantval = color_unquantization_tables[quantization_level][quantval]; + + // perform looping if the top two bits were modified by quant/unquant + perform_loop = (value_to_quantize & 0xF0) != (uquantval & 0xF0); + + if ((uquantval & 0xF0) > (value_to_quantize & 0xF0)) + { + // quant/unquant rounded UP so that the top two bits changed; + // decrement the input value in hopes that this will avoid rounding up. + value_to_quantize--; + } + else if ((uquantval & 0xF0) < (value_to_quantize & 0xF0)) + { + // quant/unquant rounded DOWN so that the top two bits changed; + // decrement the input value in hopes that this will avoid rounding down. + value_to_quantize--; + } + } + while (perform_loop); + + *quantized_value = quantval; + *unquantized_value = uquantval; +} + +// quantize and unquantize a number, wile making sure to retain the top two bits. +static inline void quantize_and_unquantize_retain_top_bit(int quantization_level, int value_to_quantize, // 0 to 255. + int *quantized_value, int *unquantized_value) +{ + + int perform_loop; + int quantval; + int uquantval; + + do + { + quantval = color_quantization_tables[quantization_level][value_to_quantize]; + uquantval = color_unquantization_tables[quantization_level][quantval]; + + // perform looping if the top two bits were modified by quant/unquant + perform_loop = (value_to_quantize & 0x80) != (uquantval & 0x80); + + if ((uquantval & 0x80) > (value_to_quantize & 0x80)) + { + // quant/unquant rounded UP so that the top two bits changed; + // decrement the input value in hopes that this will avoid rounding up. + value_to_quantize--; + } + else if ((uquantval & 0x80) < (value_to_quantize & 0x80)) + { + // quant/unquant rounded DOWN so that the top two bits changed; + // decrement the input value in hopes that this will avoid rounding down. + value_to_quantize--; + } + } + while (perform_loop); + + *quantized_value = quantval; + *unquantized_value = uquantval; +} + + + + + +/* + HDR color encoding, take #3 */ + + +void quantize_hdr_rgbo3(float4 color, int output[4], int quantization_level) +{ + color.xyz = color.xyz + color.www; + + if (!(color.x > 0.0f)) + color.x = 0.0f; + else if (color.x > 65535.0f) + color.x = 65535.0f; + + if (!(color.y > 0.0f)) + color.y = 0.0f; + else if (color.y > 65535.0f) + color.y = 65535.0f; + + if (!(color.z > 0.0f)) + color.z = 0.0f; + else if (color.z > 65535.0f) + color.z = 65535.0f; + + if (!(color.w > 0.0f)) + color.w = 0.0f; + else if (color.w > 65535.0f) + color.w = 65535.0f; + + float4 color_bak = color; + int majcomp; + if (color.x > color.y && color.x > color.z) + majcomp = 0; // red is largest component + else if (color.y > color.z) + majcomp = 1; // green is largest component + else + majcomp = 2; // blue is largest component + + // swap around the red component and the largest component. + switch (majcomp) + { + case 1: + color = color.yxzw; + break; + case 2: + color = color.zyxw; + break; + default: + break; + } + + static const int mode_bits[5][3] = { + {11, 5, 7}, + {11, 6, 5}, + {10, 5, 8}, + {9, 6, 7}, + {8, 7, 6} + }; + + + static const float mode_cutoffs[5][2] = { + {1024, 4096}, + {2048, 1024}, + {2048, 16384}, + {8192, 16384}, + {32768, 16384} + }; + + static const float mode_rscales[5] = { + 32.0f, + 32.0f, + 64.0f, + 128.0f, + 256.0f, + }; + + static const float mode_scales[5] = { + 1.0f / 32.0f, + 1.0f / 32.0f, + 1.0f / 64.0f, + 1.0f / 128.0f, + 1.0f / 256.0f, + }; + + float r_base = color.x; + float g_base = color.x - color.y; + float b_base = color.x - color.z; + float s_base = color.w; + + int mode; + for (mode = 0; mode < 5; mode++) + { + if (g_base > mode_cutoffs[mode][0] || b_base > mode_cutoffs[mode][0] || s_base > mode_cutoffs[mode][1]) + { + continue; + } + + // encode the mode into a 4-bit vector. + int mode_enc = mode < 4 ? (mode | (majcomp << 2)) : (majcomp | 0xC); + + float mode_scale = mode_scales[mode]; + float mode_rscale = mode_rscales[mode]; + + int gb_intcutoff = 1 << mode_bits[mode][1]; + int s_intcutoff = 1 << mode_bits[mode][2]; + + // first, quantize and unquantize R. + int r_intval = (int)floor(r_base * mode_scale + 0.5f); + + int r_lowbits = r_intval & 0x3f; + + r_lowbits |= (mode_enc & 3) << 6; + + int r_quantval; + int r_uquantval; + quantize_and_unquantize_retain_top_two_bits(quantization_level, r_lowbits, &r_quantval, &r_uquantval); + + r_intval = (r_intval & ~0x3f) | (r_uquantval & 0x3f); + float r_fval = r_intval * mode_rscale; + + + // next, recompute G and B, then quantize and unquantize them. + float g_fval = r_fval - color.y; + float b_fval = r_fval - color.z; + if (g_fval < 0.0f) + g_fval = 0.0f; + else if (g_fval > 65535.0f) + g_fval = 65535.0f; + if (b_fval < 0.0f) + b_fval = 0.0f; + else if (b_fval > 65535.0f) + b_fval = 65535.0f; + + int g_intval = (int)floor(g_fval * mode_scale + 0.5f); + int b_intval = (int)floor(b_fval * mode_scale + 0.5f); + + + if (g_intval >= gb_intcutoff || b_intval >= gb_intcutoff) + { + continue; + } + + int g_lowbits = g_intval & 0x1f; + int b_lowbits = b_intval & 0x1f; + + int bit0 = 0; + int bit1 = 0; + int bit2 = 0; + int bit3 = 0; + + switch (mode) + { + case 0: + case 2: + bit0 = (r_intval >> 9) & 1; + break; + case 1: + case 3: + bit0 = (r_intval >> 8) & 1; + break; + case 4: + case 5: + bit0 = (g_intval >> 6) & 1; + break; + } + + switch (mode) + { + case 0: + case 1: + case 2: + case 3: + bit2 = (r_intval >> 7) & 1; + break; + case 4: + case 5: + bit2 = (b_intval >> 6) & 1; + break; + } + + switch (mode) + { + case 0: + case 2: + bit1 = (r_intval >> 8) & 1; + break; + case 1: + case 3: + case 4: + case 5: + bit1 = (g_intval >> 5) & 1; + break; + } + + switch (mode) + { + case 0: + bit3 = (r_intval >> 10) & 1; + break; + case 2: + bit3 = (r_intval >> 6) & 1; + break; + case 1: + case 3: + case 4: + case 5: + bit3 = (b_intval >> 5) & 1; + break; + } + + g_lowbits |= (mode_enc & 0x4) << 5; + b_lowbits |= (mode_enc & 0x8) << 4; + + g_lowbits |= bit0 << 6; + g_lowbits |= bit1 << 5; + b_lowbits |= bit2 << 6; + b_lowbits |= bit3 << 5; + + int g_quantval; + int b_quantval; + int g_uquantval; + int b_uquantval; + + quantize_and_unquantize_retain_top_four_bits(quantization_level, g_lowbits, &g_quantval, &g_uquantval); + + quantize_and_unquantize_retain_top_four_bits(quantization_level, b_lowbits, &b_quantval, &b_uquantval); + + g_intval = (g_intval & ~0x1f) | (g_uquantval & 0x1f); + b_intval = (b_intval & ~0x1f) | (b_uquantval & 0x1f); + + g_fval = g_intval * mode_rscale; + b_fval = b_intval * mode_rscale; + + + // finally, recompute the scale value, based on the errors + // introduced to red, green and blue. + + // If the error is positive, then the R,G,B errors combined have raised the color + // value overall; as such, the scale value needs to be increased. + float rgb_errorsum = (r_fval - color.x) + (r_fval - g_fval - color.y) + (r_fval - b_fval - color.z); + + float s_fval = s_base + rgb_errorsum * (1.0f / 3.0f); + if (s_fval < 0.0f) + s_fval = 0.0f; + else if (s_fval > 1e9) + s_fval = 1e9; + + int s_intval = (int)floor(s_fval * mode_scale + 0.5f); + + if (s_intval >= s_intcutoff) + { + continue; + } + + int s_lowbits = s_intval & 0x1f; + + int bit4; + int bit5; + int bit6; + switch (mode) + { + case 1: + bit6 = (r_intval >> 9) & 1; + break; + default: + bit6 = (s_intval >> 5) & 1; + break; + } + + switch (mode) + { + case 4: + bit5 = (r_intval >> 7) & 1; + break; + case 1: + bit5 = (r_intval >> 10) & 1; + break; + default: + bit5 = (s_intval >> 6) & 1; + break; + } + + switch (mode) + { + case 2: + bit4 = (s_intval >> 7) & 1; + break; + default: + bit4 = (r_intval >> 6) & 1; + break; + } + + + s_lowbits |= bit6 << 5; + s_lowbits |= bit5 << 6; + s_lowbits |= bit4 << 7; + + int s_quantval; + int s_uquantval; + + quantize_and_unquantize_retain_top_four_bits(quantization_level, s_lowbits, &s_quantval, &s_uquantval); + + s_intval = (s_intval & ~0x1f) | (s_uquantval & 0x1f); + s_fval = s_intval * mode_rscale; + output[0] = r_quantval; + output[1] = g_quantval; + output[2] = b_quantval; + output[3] = s_quantval; + + return; + } + + // failed to encode any of the modes above? In that case, + // encode using mode #5. + int i; + + float vals[4]; + int ivals[4]; + vals[0] = color_bak.x; + vals[1] = color_bak.y; + vals[2] = color_bak.z; + vals[3] = color_bak.w; + + float cvals[3]; + + for (i = 0; i < 3; i++) + { + if (vals[i] < 0.0f) + vals[i] = 0.0f; + else if (vals[i] > 65020.0f) + vals[i] = 65020.0f; + + ivals[i] = (int)floor(vals[i] * (1.0f / 512.0f) + 0.5f); + cvals[i] = ivals[i] * 512.0f; + } + + float rgb_errorsum = (cvals[0] - vals[0]) + (cvals[1] - vals[1]) + (cvals[2] - vals[2]); + vals[3] += rgb_errorsum * (1.0f / 3.0f); + + if (vals[3] < 0.0f) + vals[3] = 0.0f; + else if (vals[3] > 65020.0f) + vals[3] = 65020.0f; + + ivals[3] = (int)floor(vals[3] * (1.0f / 512.0f) + 0.5f); + + int encvals[4]; + + encvals[0] = (ivals[0] & 0x3f) | 0xC0; + encvals[1] = (ivals[1] & 0x7f) | 0x80; + encvals[2] = (ivals[2] & 0x7f) | 0x80; + encvals[3] = (ivals[3] & 0x7f) | ((ivals[0] & 0x40) << 1); + + for (i = 0; i < 4; i++) + { + int dummy; + quantize_and_unquantize_retain_top_four_bits(quantization_level, encvals[i], &(output[i]), &dummy); + } + + return; +} + + + + + + + +void quantize_hdr_rgb3(float4 color0, float4 color1, int output[6], int quantization_level) +{ + if (!(color0.x > 0.0f)) + color0.x = 0.0f; + else if (color0.x > 65535.0f) + color0.x = 65535.0f; + + if (!(color0.y > 0.0f)) + color0.y = 0.0f; + else if (color0.y > 65535.0f) + color0.y = 65535.0f; + + if (!(color0.z > 0.0f)) + color0.z = 0.0f; + else if (color0.z > 65535.0f) + color0.z = 65535.0f; + + if (!(color1.x > 0.0f)) + color1.x = 0.0f; + else if (color1.x > 65535.0f) + color1.x = 65535.0f; + + if (!(color1.y > 0.0f)) + color1.y = 0.0f; + else if (color1.y > 65535.0f) + color1.y = 65535.0f; + + if (!(color1.z > 0.0f)) + color1.z = 0.0f; + else if (color1.z > 65535.0f) + color1.z = 65535.0f; + + float4 color0_bak = color0; + float4 color1_bak = color1; + + int majcomp; + if (color1.x > color1.y && color1.x > color1.z) + majcomp = 0; // red is largest + else if (color1.y > color1.z) + majcomp = 1; // green is largest + else + majcomp = 2; // blue is largest + + // swizzle the components + switch (majcomp) + { + case 1: // red-green swap + color0 = color0.yxzw; + color1 = color1.yxzw; + break; + case 2: // red-blue swap + color0 = color0.zyxw; + color1 = color1.zyxw; + break; + default: + break; + } + + float a_base = color1.x; + if (a_base < 0.0f) + a_base = 0.0f; + else if (a_base > 65535.0f) + a_base = 65535.0f; + + + float b0_base = a_base - color1.y; + float b1_base = a_base - color1.z; + float c_base = a_base - color0.x; + float d0_base = a_base - b0_base - c_base - color0.y; + float d1_base = a_base - b1_base - c_base - color0.z; + + + + // number of bits in the various fields in the various modes + static const int mode_bits[8][4] = { + {9, 7, 6, 7}, + {9, 8, 6, 6}, + {10, 6, 7, 7}, + {10, 7, 7, 6}, + {11, 8, 6, 5}, + {11, 6, 8, 6}, + {12, 7, 7, 5}, + {12, 6, 7, 6} + }; + + // cutoffs to use for the computed values of a,b,c,d, assuming the + // range 0..65535 are LNS values corresponding to fp16. + static const float mode_cutoffs[8][4] = { + {16384, 8192, 8192, 8}, // mode 0: 9,7,6,7 + {32768, 8192, 4096, 8}, // mode 1: 9,8,6,6 + {4096, 8192, 4096, 4}, // mode 2: 10,6,7,7 + {8192, 8192, 2048, 4}, // mode 3: 10,7,7,6 + {8192, 2048, 512, 2}, // mode 4: 11,8,6,5 + {2048, 8192, 1024, 2}, // mode 5: 11,6,8,6 + {2048, 2048, 256, 1}, // mode 6: 12,7,7,5 + {1024, 2048, 512, 1}, // mode 7: 12,6,7,6 + }; + + static const float mode_scales[8] = { + 1.0f / 128.0f, + 1.0f / 128.0f, + 1.0f / 64.0f, + 1.0f / 64.0f, + 1.0f / 32.0f, + 1.0f / 32.0f, + 1.0f / 16.0f, + 1.0f / 16.0f, + }; + + // scaling factors when going from what was encoded in the mode to 16 bits. + static const float mode_rscales[8] = { + 128.0f, + 128.0f, + 64.0f, + 64.0f, + 32.0f, + 32.0f, + 16.0f, + 16.0f + }; + + + // try modes one by one, with the highest-precision mode first. + int mode; + for (mode = 7; mode >= 0; mode--) + { + // for each mode, test if we can in fact accommodate + // the computed b,c,d values. If we clearly can't, then we skip to the next mode. + + float b_cutoff = mode_cutoffs[mode][0]; + float c_cutoff = mode_cutoffs[mode][1]; + float d_cutoff = mode_cutoffs[mode][2]; + + if (b0_base > b_cutoff || b1_base > b_cutoff || c_base > c_cutoff || fabs(d0_base) > d_cutoff || fabs(d1_base) > d_cutoff) + { + continue; + } + + float mode_scale = mode_scales[mode]; + float mode_rscale = mode_rscales[mode]; + + int b_intcutoff = 1 << mode_bits[mode][1]; + int c_intcutoff = 1 << mode_bits[mode][2]; + int d_intcutoff = 1 << (mode_bits[mode][3] - 1); + + // first, quantize and unquantize A, with the assumption that its high bits can be handled safely. + int a_intval = (int)floor(a_base * mode_scale + 0.5f); + int a_lowbits = a_intval & 0xFF; + + int a_quantval = color_quantization_tables[quantization_level][a_lowbits]; + int a_uquantval = color_unquantization_tables[quantization_level][a_quantval]; + a_intval = (a_intval & ~0xFF) | a_uquantval; + float a_fval = a_intval * mode_rscale; + + // next, recompute C, then quantize and unquantize it + float c_fval = a_fval - color0.x; + if (c_fval < 0.0f) + c_fval = 0.0f; + else if (c_fval > 65535.0f) + c_fval = 65535.0f; + + int c_intval = (int)floor(c_fval * mode_scale + 0.5f); + + if (c_intval >= c_intcutoff) + { + continue; + } + + int c_lowbits = c_intval & 0x3f; + + c_lowbits |= (mode & 1) << 7; + c_lowbits |= (a_intval & 0x100) >> 2; + + int c_quantval; + int c_uquantval; + quantize_and_unquantize_retain_top_two_bits(quantization_level, c_lowbits, &c_quantval, &c_uquantval); + c_intval = (c_intval & ~0x3F) | (c_uquantval & 0x3F); + c_fval = c_intval * mode_rscale; + + + // next, recompute B0 and B1, then quantize and unquantize them + float b0_fval = a_fval - color1.y; + float b1_fval = a_fval - color1.z; + if (b0_fval < 0.0f) + b0_fval = 0.0f; + else if (b0_fval > 65535.0f) + b0_fval = 65535.0f; + if (b1_fval < 0.0f) + b1_fval = 0.0f; + else if (b1_fval > 65535.0f) + b1_fval = 65535.0f; + + int b0_intval = (int)floor(b0_fval * mode_scale + 0.5f); + int b1_intval = (int)floor(b1_fval * mode_scale + 0.5f); + + if (b0_intval >= b_intcutoff || b1_intval >= b_intcutoff) + { + continue; + } + + + + int b0_lowbits = b0_intval & 0x3f; + int b1_lowbits = b1_intval & 0x3f; + + int bit0 = 0; + int bit1 = 0; + switch (mode) + { + case 0: + case 1: + case 3: + case 4: + case 6: + bit0 = (b0_intval >> 6) & 1; + break; + case 2: + case 5: + case 7: + bit0 = (a_intval >> 9) & 1; + break; + } + + switch (mode) + { + case 0: + case 1: + case 3: + case 4: + case 6: + bit1 = (b1_intval >> 6) & 1; + break; + case 2: + bit1 = (c_intval >> 6) & 1; + break; + case 5: + case 7: + bit1 = (a_intval >> 10) & 1; + break; + } + + b0_lowbits |= bit0 << 6; + b1_lowbits |= bit1 << 6; + + b0_lowbits |= ((mode >> 1) & 1) << 7; + b1_lowbits |= ((mode >> 2) & 1) << 7; + + int b0_quantval; + int b1_quantval; + int b0_uquantval; + int b1_uquantval; + + quantize_and_unquantize_retain_top_two_bits(quantization_level, b0_lowbits, &b0_quantval, &b0_uquantval); + + quantize_and_unquantize_retain_top_two_bits(quantization_level, b1_lowbits, &b1_quantval, &b1_uquantval); + + b0_intval = (b0_intval & ~0x3f) | (b0_uquantval & 0x3f); + b1_intval = (b1_intval & ~0x3f) | (b1_uquantval & 0x3f); + b0_fval = b0_intval * mode_rscale; + b1_fval = b1_intval * mode_rscale; + + + // finally, recompute D0 and D1, then quantize and unquantize them + float d0_fval = a_fval - b0_fval - c_fval - color0.y; + float d1_fval = a_fval - b1_fval - c_fval - color0.z; + + if (d0_fval < -65535.0f) + d0_fval = -65535.0f; + else if (d0_fval > 65535.0f) + d0_fval = 65535.0f; + + if (d1_fval < -65535.0f) + d1_fval = -65535.0f; + else if (d1_fval > 65535.0f) + d1_fval = 65535.0f; + + int d0_intval = (int)floor(d0_fval * mode_scale + 0.5f); + int d1_intval = (int)floor(d1_fval * mode_scale + 0.5f); + + if (abs(d0_intval) >= d_intcutoff || abs(d1_intval) >= d_intcutoff) + continue; + + // d0_intval += mode_dbiases[mode]; + // d1_intval += mode_dbiases[mode]; + + int d0_lowbits = d0_intval & 0x1f; + int d1_lowbits = d1_intval & 0x1f; + + int bit2 = 0; + int bit3 = 0; + int bit4; + int bit5; + switch (mode) + { + case 0: + case 2: + bit2 = (d0_intval >> 6) & 1; + break; + case 1: + case 4: + bit2 = (b0_intval >> 7) & 1; + break; + case 3: + bit2 = (a_intval >> 9) & 1; + break; + case 5: + bit2 = (c_intval >> 7) & 1; + break; + case 6: + case 7: + bit2 = (a_intval >> 11) & 1; + break; + } + switch (mode) + { + case 0: + case 2: + bit3 = (d1_intval >> 6) & 1; + break; + case 1: + case 4: + bit3 = (b1_intval >> 7) & 1; + break; + case 3: + case 5: + case 6: + case 7: + bit3 = (c_intval >> 6) & 1; + break; + } + + switch (mode) + { + case 4: + case 6: + bit4 = (a_intval >> 9) & 1; + bit5 = (a_intval >> 10) & 1; + break; + default: + bit4 = (d0_intval >> 5) & 1; + bit5 = (d1_intval >> 5) & 1; + break; + } + + d0_lowbits |= bit2 << 6; + d1_lowbits |= bit3 << 6; + d0_lowbits |= bit4 << 5; + d1_lowbits |= bit5 << 5; + + d0_lowbits |= (majcomp & 1) << 7; + d1_lowbits |= ((majcomp >> 1) & 1) << 7; + + int d0_quantval; + int d1_quantval; + int d0_uquantval; + int d1_uquantval; + + quantize_and_unquantize_retain_top_four_bits(quantization_level, d0_lowbits, &d0_quantval, &d0_uquantval); + + quantize_and_unquantize_retain_top_four_bits(quantization_level, d1_lowbits, &d1_quantval, &d1_uquantval); + + output[0] = a_quantval; + output[1] = c_quantval; + output[2] = b0_quantval; + output[3] = b1_quantval; + output[4] = d0_quantval; + output[5] = d1_quantval; + return; + } + + // neither of the modes fit? In this case, we will use a flat representation + // for storing data, using 8 bits for red and green, and 7 bits for blue. + // This gives color accuracy roughly similar to LDR 4:4:3 which is not at all great + // but usable. This representation is used if the light color is more than 4x the + // color value of the dark color. + int i; + float vals[6]; + vals[0] = color0_bak.x; + vals[1] = color1_bak.x; + vals[2] = color0_bak.y; + vals[3] = color1_bak.y; + vals[4] = color0_bak.z; + vals[5] = color1_bak.z; + + + for (i = 0; i < 6; i++) + { + if (vals[i] < 0.0f) + vals[i] = 0.0f; + else if (vals[i] > 65020.0f) + vals[i] = 65020.0f; + } + for (i = 0; i < 4; i++) + { + int idx = (int)floor(vals[i] * 1.0f / 256.0f + 0.5f); + output[i] = color_quantization_tables[quantization_level][idx]; + } + for (i = 4; i < 6; i++) + { + int dummy; + int idx = (int)floor(vals[i] * 1.0f / 512.0f + 0.5f) + 128; + quantize_and_unquantize_retain_top_two_bits(quantization_level, idx, &(output[i]), &dummy); + } + + return; +} + + + + + +void quantize_hdr_rgb_ldr_alpha3(float4 color0, float4 color1, int output[8], int quantization_level) +{ + color0.w *= (1.0f / 257.0f); + color1.w *= (1.0f / 257.0f); + + quantize_hdr_rgb3(color0, color1, output, quantization_level); + + float a0 = clamp255(color0.w); + float a1 = clamp255(color1.w); + int ai0 = color_quantization_tables[quantization_level][(int)floor(a0 + 0.5f)]; + int ai1 = color_quantization_tables[quantization_level][(int)floor(a1 + 0.5f)]; + + output[6] = ai0; + output[7] = ai1; +} + + + +void quantize_hdr_luminance_large_range3(float4 color0, float4 color1, int output[2], int quantization_level) +{ + + float lum1 = (color1.x + color1.y + color1.z) * (1.0f / 3.0f); + float lum0 = (color0.x + color0.y + color0.z) * (1.0f / 3.0f); + + if (lum1 < lum0) + { + float avg = (lum0 + lum1) * 0.5f; + lum0 = avg; + lum1 = avg; + } + + int ilum1 = static_cast < int >(floor(lum1 + 0.5f)); + int ilum0 = static_cast < int >(floor(lum0 + 0.5f)); + + // find the closest encodable point in the upper half of the code-point space + int upper_v0 = (ilum0 + 128) >> 8; + int upper_v1 = (ilum1 + 128) >> 8; + + if (upper_v0 < 0) + upper_v0 = 0; + else if (upper_v0 > 255) + upper_v0 = 255; + + if (upper_v1 < 0) + upper_v1 = 0; + else if (upper_v1 > 255) + upper_v1 = 255; + + // find the closest encodable point in the lower half of the code-point space + int lower_v0 = (ilum1 + 256) >> 8; + int lower_v1 = ilum0 >> 8; + + if (lower_v0 < 0) + lower_v0 = 0; + else if (lower_v0 > 255) + lower_v0 = 255; + + if (lower_v1 < 0) + lower_v1 = 0; + else if (lower_v1 > 255) + lower_v1 = 255; + + // determine the distance between the point in code-point space and the input value + int upper0_dec = upper_v0 << 8; + int upper1_dec = upper_v1 << 8; + int lower0_dec = (lower_v1 << 8) + 128; + int lower1_dec = (lower_v0 << 8) - 128; + + + int upper0_diff = upper0_dec - ilum0; + int upper1_diff = upper1_dec - ilum1; + int lower0_diff = lower0_dec - ilum0; + int lower1_diff = lower1_dec - ilum1; + + int upper_error = (upper0_diff * upper0_diff) + (upper1_diff * upper1_diff); + int lower_error = (lower0_diff * lower0_diff) + (lower1_diff * lower1_diff); + + int v0, v1; + if (upper_error < lower_error) + { + v0 = upper_v0; + v1 = upper_v1; + } + else + { + v0 = lower_v0; + v1 = lower_v1; + } + + // OK; encode. + output[0] = color_quantization_tables[quantization_level][v0]; + output[1] = color_quantization_tables[quantization_level][v1]; +} + + + +int try_quantize_hdr_luminance_small_range3(float4 color0, float4 color1, int output[2], int quantization_level) +{ + float lum1 = (color1.x + color1.y + color1.z) * (1.0f / 3.0f); + float lum0 = (color0.x + color0.y + color0.z) * (1.0f / 3.0f); + + if (lum1 < lum0) + { + float avg = (lum0 + lum1) * 0.5f; + lum0 = avg; + lum1 = avg; + } + + int ilum1 = static_cast < int >(floor(lum1 + 0.5f)); + int ilum0 = static_cast < int >(floor(lum0 + 0.5f)); + + // difference of more than a factor-of-2 results in immediate failure. + if (ilum1 - ilum0 > 2048) + return 0; + + int lowval, highval, diffval; + int v0, v1; + int v0e, v1e; + int v0d, v1d; + + // first, try to encode the high-precision submode + lowval = (ilum0 + 16) >> 5; + highval = (ilum1 + 16) >> 5; + + if (lowval < 0) + lowval = 0; + else if (lowval > 2047) + lowval = 2047; + + if (highval < 0) + highval = 0; + else if (highval > 2047) + highval = 2047; + + v0 = lowval & 0x7F; + v0e = color_quantization_tables[quantization_level][v0]; + v0d = color_unquantization_tables[quantization_level][v0e]; + if ((v0d & 0x80) == 0x80) + goto LOW_PRECISION_SUBMODE; + + lowval = (lowval & ~0x7F) | (v0d & 0x7F); + diffval = highval - lowval; + if (diffval < 0 || diffval > 15) + goto LOW_PRECISION_SUBMODE; + + v1 = ((lowval >> 3) & 0xF0) | diffval; + v1e = color_quantization_tables[quantization_level][v1]; + v1d = color_unquantization_tables[quantization_level][v1e]; + if ((v1d & 0xF0) != (v1 & 0xF0)) + goto LOW_PRECISION_SUBMODE; + + output[0] = v0e; + output[1] = v1e; + return 1; + + + // failed to encode the high-precision submode; well, then try to encode the + // low-precision submode. + LOW_PRECISION_SUBMODE: + + lowval = (ilum0 + 32) >> 6; + highval = (ilum1 + 32) >> 6; + if (lowval < 0) + lowval = 0; + else if (lowval > 1023) + lowval = 1023; + if (highval < 0) + highval = 0; + else if (highval > 1023) + highval = 1023; + + v0 = (lowval & 0x7F) | 0x80; + v0e = color_quantization_tables[quantization_level][v0]; + v0d = color_unquantization_tables[quantization_level][v0e]; + if ((v0d & 0x80) == 0) + return 0; + + lowval = (lowval & ~0x7F) | (v0d & 0x7F); + diffval = highval - lowval; + if (diffval < 0 || diffval > 31) + return 0; + + v1 = ((lowval >> 2) & 0xE0) | diffval; + v1e = color_quantization_tables[quantization_level][v1]; + v1d = color_unquantization_tables[quantization_level][v1e]; + if ((v1d & 0xE0) != (v1 & 0xE0)) + return 0;; + + output[0] = v0e; + output[1] = v1e; + return 1; +} + + +void quantize_hdr_alpha3(float alpha0, float alpha1, int output[2], int quantization_level) +{ + int i; + + if (alpha0 < 0) + alpha0 = 0; + else if (alpha0 > 65280) + alpha0 = 65280; + + if (alpha1 < 0) + alpha1 = 0; + else if (alpha1 > 65280) + alpha1 = 65280; + + int ialpha0 = static_cast < int >(floor(alpha0 + 0.5f)); + int ialpha1 = static_cast < int >(floor(alpha1 + 0.5f)); + + int val0, val1, diffval; + int v6, v7; + int v6e, v7e; + int v6d, v7d; + + // try to encode one of the delta submodes, in decreasing-precision order. + for (i = 2; i >= 0; i--) + { + val0 = (ialpha0 + (128 >> i)) >> (8 - i); + val1 = (ialpha1 + (128 >> i)) >> (8 - i); + + v6 = (val0 & 0x7F) | ((i & 1) << 7); + v6e = color_quantization_tables[quantization_level][v6]; + v6d = color_unquantization_tables[quantization_level][v6e]; + + if ((v6 ^ v6d) & 0x80) + continue; + + val0 = (val0 & ~0x7f) | (v6d & 0x7f); + diffval = val1 - val0; + int cutoff = 32 >> i; + int mask = 2 * cutoff - 1; + + if (diffval < -cutoff || diffval >= cutoff) + continue; + + v7 = ((i & 2) << 6) | ((val0 >> 7) << (6 - i)) | (diffval & mask); + v7e = color_quantization_tables[quantization_level][v7]; + v7d = color_unquantization_tables[quantization_level][v7e]; + + static const int testbits[3] = { 0xE0, 0xF0, 0xF8 }; + + if ((v7 ^ v7d) & testbits[i]) + continue; + + output[0] = v6e; + output[1] = v7e; + return; + } + + // could not encode any of the delta modes; instead encode a flat value + val0 = (ialpha0 + 256) >> 9; + val1 = (ialpha1 + 256) >> 9; + v6 = val0 | 0x80; + v7 = val1 | 0x80; + + v6e = color_quantization_tables[quantization_level][v6]; + v7e = color_quantization_tables[quantization_level][v7]; + output[0] = v6e; + output[1] = v7e; + + return; +} + + + +void quantize_hdr_rgb_alpha3(float4 color0, float4 color1, int output[8], int quantization_level) +{ + quantize_hdr_rgb3(color0, color1, output, quantization_level); + quantize_hdr_alpha3(color0.w, color1.w, output + 6, quantization_level); +} + + + +/* + Quantize a color. When quantizing an RGB or RGBA color, the quantizer may choose a + delta-based representation; as such, it will report back the format it actually used. +*/ +int pack_color_endpoints(astc_decode_mode decode_mode, float4 color0, float4 color1, float4 rgbs_color, float4 rgbo_color, float2 luminances, // ! Unused + int format, int *output, int quantization_level) +{ + + IGNORE(luminances); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : format=%d quantization_level=%d\n", __func__, format, quantization_level); + printf("Color 0: <%g %g %g %g>\n", color0.x, color0.y, color0.z, color0.w); + printf("Color 1: <%g %g %g %g>\n", color1.x, color1.y, color1.z, color1.w); + + } + #endif + + // we do not support negative colors. + color0.x = MAX(color0.x, 0.0f); + color0.y = MAX(color0.y, 0.0f); + color0.z = MAX(color0.z, 0.0f); + color0.w = MAX(color0.w, 0.0f); + color1.x = MAX(color1.x, 0.0f); + color1.y = MAX(color1.y, 0.0f); + color1.z = MAX(color1.z, 0.0f); + color1.w = MAX(color1.w, 0.0f); + + + int retval; + + switch (format) + { + case FMT_RGB: + if (quantization_level <= 18) + { + if (try_quantize_rgb_delta_blue_contract(color0, color1, output, quantization_level)) + { + retval = FMT_RGB_DELTA; + break; + } + if (try_quantize_rgb_delta(color0, color1, output, quantization_level)) + { + retval = FMT_RGB_DELTA; + break; + } + } + if (try_quantize_rgb_blue_contract(color0, color1, output, quantization_level)) + { + retval = FMT_RGB; + break; + } + quantize_rgb(color0, color1, output, quantization_level); + retval = FMT_RGB; + break; + + case FMT_RGBA: + if (quantization_level <= 18) + { + if (try_quantize_rgba_delta_blue_contract(color0, color1, output, quantization_level)) + { + retval = FMT_RGBA_DELTA; + break; + } + if (try_quantize_rgba_delta(color0, color1, output, quantization_level)) + { + retval = FMT_RGBA_DELTA; + break; + } + } + if (try_quantize_rgba_blue_contract(color0, color1, output, quantization_level)) + { + retval = FMT_RGBA; + break; + } + quantize_rgba(color0, color1, output, quantization_level); + retval = FMT_RGBA; + break; + + case FMT_RGB_SCALE: + quantize_rgbs_new(rgbs_color, output, quantization_level); + // quantize_rgbs( color0, color1, output, quantization_level ); + retval = FMT_RGB_SCALE; + break; + + case FMT_HDR_RGB_SCALE: + quantize_hdr_rgbo3(rgbo_color, output, quantization_level); + + // quantize_hdr_rgb_scale( rgbo_color, output, quantization_level ); + retval = FMT_HDR_RGB_SCALE; + break; + + case FMT_HDR_RGB: + quantize_hdr_rgb3(color0, color1, output, quantization_level); + + // quantize_hdr_rgb_rgba( color0, color1, 0, output, quantization_level ); + retval = FMT_HDR_RGB; + break; + + case FMT_RGB_SCALE_ALPHA: + quantize_rgbs_alpha_new(color0, color1, rgbs_color, output, quantization_level); + // quantize_rgbs_alpha( color0, color1, output, quantization_level ); + retval = FMT_RGB_SCALE_ALPHA; + break; + + case FMT_HDR_LUMINANCE_SMALL_RANGE: + case FMT_HDR_LUMINANCE_LARGE_RANGE: + if (try_quantize_hdr_luminance_small_range3(color0, color1, output, quantization_level)) + { + retval = FMT_HDR_LUMINANCE_SMALL_RANGE; + break; + } + quantize_hdr_luminance_large_range3(color0, color1, output, quantization_level); + retval = FMT_HDR_LUMINANCE_LARGE_RANGE; + break; + + case FMT_LUMINANCE: + quantize_luminance(color0, color1, output, quantization_level); + retval = FMT_LUMINANCE; + break; + + case FMT_LUMINANCE_ALPHA: + if (quantization_level <= 18) + { + if (try_quantize_luminance_alpha_delta(color0, color1, output, quantization_level)) + { + retval = FMT_LUMINANCE_ALPHA_DELTA; + break; + } + } + quantize_luminance_alpha(color0, color1, output, quantization_level); + retval = FMT_LUMINANCE_ALPHA; + break; + + case FMT_HDR_RGB_LDR_ALPHA: + quantize_hdr_rgb_ldr_alpha3(color0, color1, output, quantization_level); + retval = FMT_HDR_RGB_LDR_ALPHA; + break; + + case FMT_HDR_RGBA: + quantize_hdr_rgb_alpha3(color0, color1, output, quantization_level); + retval = FMT_HDR_RGBA; + break; + + default: + ASTC_CODEC_INTERNAL_ERROR; + quantize0(color0, color1, output, quantization_level); + retval = FMT_LUMINANCE; + break; + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + int i; + printf("Quantized to format %d\n", retval); + printf("Quantized color:"); + + for (i = 0; i < 8; i++) + printf(" %X", output[i]); + + ushort4 res0; + ushort4 res1; + int rgb_hdr; + int alpha_hdr; + int nan_endpoint; + + unpack_color_endpoints(decode_mode, retval, quantization_level, output, &rgb_hdr, &alpha_hdr, &nan_endpoint, &res0, &res1); + printf("rgb-hdr=%d alpha-hdr=%d nan-endpoint=%d\n", rgb_hdr, alpha_hdr, nan_endpoint); + + printf("Unquantized color 0: <%u %u %u %u>\n", res0.x, res0.y, res0.z, res0.w); + printf("Unquantized color 1: <%u %u %u %u>\n", res1.x, res1.y, res1.z, res1.w); + printf("\n\n"); + } + #endif + + return retval; +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_color_unquantize.cpp b/3rdparty/bimg/3rdparty/astc/astc_color_unquantize.cpp new file mode 100644 index 00000000000..5090cfdfd75 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_color_unquantize.cpp @@ -0,0 +1,970 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Color unquantization functions for ASTC. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +#include "mathlib.h" +#include "softfloat.h" + +int rgb_delta_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + // unquantize the color endpoints + int r0 = color_unquantization_tables[quantization_level][input[0]]; + int g0 = color_unquantization_tables[quantization_level][input[2]]; + int b0 = color_unquantization_tables[quantization_level][input[4]]; + + int r1 = color_unquantization_tables[quantization_level][input[1]]; + int g1 = color_unquantization_tables[quantization_level][input[3]]; + int b1 = color_unquantization_tables[quantization_level][input[5]]; + + // perform the bit-transfer procedure + r0 |= (r1 & 0x80) << 1; + g0 |= (g1 & 0x80) << 1; + b0 |= (b1 & 0x80) << 1; + r1 &= 0x7F; + g1 &= 0x7F; + b1 &= 0x7F; + if (r1 & 0x40) + r1 -= 0x80; + if (g1 & 0x40) + g1 -= 0x80; + if (b1 & 0x40) + b1 -= 0x80; + + r0 >>= 1; + g0 >>= 1; + b0 >>= 1; + r1 >>= 1; + g1 >>= 1; + b1 >>= 1; + + int rgbsum = r1 + g1 + b1; + + r1 += r0; + g1 += g0; + b1 += b0; + + + int retval; + + int r0e, g0e, b0e; + int r1e, g1e, b1e; + + if (rgbsum >= 0) + { + r0e = r0; + g0e = g0; + b0e = b0; + + r1e = r1; + g1e = g1; + b1e = b1; + + retval = 0; + } + else + { + r0e = (r1 + b1) >> 1; + g0e = (g1 + b1) >> 1; + b0e = b1; + + r1e = (r0 + b0) >> 1; + g1e = (g0 + b0) >> 1; + b1e = b0; + + retval = 1; + } + + if (r0e < 0) + r0e = 0; + else if (r0e > 255) + r0e = 255; + + if (g0e < 0) + g0e = 0; + else if (g0e > 255) + g0e = 255; + + if (b0e < 0) + b0e = 0; + else if (b0e > 255) + b0e = 255; + + if (r1e < 0) + r1e = 0; + else if (r1e > 255) + r1e = 255; + + if (g1e < 0) + g1e = 0; + else if (g1e > 255) + g1e = 255; + + if (b1e < 0) + b1e = 0; + else if (b1e > 255) + b1e = 255; + + output0->x = r0e; + output0->y = g0e; + output0->z = b0e; + output0->w = 0xFF; + + output1->x = r1e; + output1->y = g1e; + output1->z = b1e; + output1->w = 0xFF; + + return retval; +} + + +int rgb_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + + int ri0b = color_unquantization_tables[quantization_level][input[0]]; + int ri1b = color_unquantization_tables[quantization_level][input[1]]; + int gi0b = color_unquantization_tables[quantization_level][input[2]]; + int gi1b = color_unquantization_tables[quantization_level][input[3]]; + int bi0b = color_unquantization_tables[quantization_level][input[4]]; + int bi1b = color_unquantization_tables[quantization_level][input[5]]; + + if (ri0b + gi0b + bi0b > ri1b + gi1b + bi1b) + { + // blue-contraction + ri0b = (ri0b + bi0b) >> 1; + gi0b = (gi0b + bi0b) >> 1; + ri1b = (ri1b + bi1b) >> 1; + gi1b = (gi1b + bi1b) >> 1; + + output0->x = ri1b; + output0->y = gi1b; + output0->z = bi1b; + output0->w = 255; + + output1->x = ri0b; + output1->y = gi0b; + output1->z = bi0b; + output1->w = 255; + return 1; + } + else + { + output0->x = ri0b; + output0->y = gi0b; + output0->z = bi0b; + output0->w = 255; + + output1->x = ri1b; + output1->y = gi1b; + output1->z = bi1b; + output1->w = 255; + return 0; + } +} + + + + +void rgba_unpack(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int order = rgb_unpack(input, quantization_level, output0, output1); + if (order == 0) + { + output0->w = color_unquantization_tables[quantization_level][input[6]]; + output1->w = color_unquantization_tables[quantization_level][input[7]]; + } + else + { + output0->w = color_unquantization_tables[quantization_level][input[7]]; + output1->w = color_unquantization_tables[quantization_level][input[6]]; + } +} + + + +void rgba_delta_unpack(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int a0 = color_unquantization_tables[quantization_level][input[6]]; + int a1 = color_unquantization_tables[quantization_level][input[7]]; + a0 |= (a1 & 0x80) << 1; + a1 &= 0x7F; + if (a1 & 0x40) + a1 -= 0x80; + a0 >>= 1; + a1 >>= 1; + a1 += a0; + + if (a1 < 0) + a1 = 0; + else if (a1 > 255) + a1 = 255; + + int order = rgb_delta_unpack(input, quantization_level, output0, output1); + if (order == 0) + { + output0->w = a0; + output1->w = a1; + } + else + { + output0->w = a1; + output1->w = a0; + } +} + + +void rgb_scale_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int ir = color_unquantization_tables[quantization_level][input[0]]; + int ig = color_unquantization_tables[quantization_level][input[1]]; + int ib = color_unquantization_tables[quantization_level][input[2]]; + + int iscale = color_unquantization_tables[quantization_level][input[3]]; + + *output1 = ushort4(ir, ig, ib, 255); + *output0 = ushort4((ir * iscale) >> 8, (ig * iscale) >> 8, (ib * iscale) >> 8, 255); +} + + + +void rgb_scale_alpha_unpack(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + rgb_scale_unpack(input, quantization_level, output0, output1); + output0->w = color_unquantization_tables[quantization_level][input[4]]; + output1->w = color_unquantization_tables[quantization_level][input[5]]; + +} + + +void luminance_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int lum0 = color_unquantization_tables[quantization_level][input[0]]; + int lum1 = color_unquantization_tables[quantization_level][input[1]]; + *output0 = ushort4(lum0, lum0, lum0, 255); + *output1 = ushort4(lum1, lum1, lum1, 255); +} + + +void luminance_delta_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int v0 = color_unquantization_tables[quantization_level][input[0]]; + int v1 = color_unquantization_tables[quantization_level][input[1]]; + int l0 = (v0 >> 2) | (v1 & 0xC0); + int l1 = l0 + (v1 & 0x3F); + + if (l1 > 255) + l1 = 255; + + *output0 = ushort4(l0, l0, l0, 255); + *output1 = ushort4(l1, l1, l1, 255); +} + + + + +void luminance_alpha_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int lum0 = color_unquantization_tables[quantization_level][input[0]]; + int lum1 = color_unquantization_tables[quantization_level][input[1]]; + int alpha0 = color_unquantization_tables[quantization_level][input[2]]; + int alpha1 = color_unquantization_tables[quantization_level][input[3]]; + *output0 = ushort4(lum0, lum0, lum0, alpha0); + *output1 = ushort4(lum1, lum1, lum1, alpha1); +} + + +void luminance_alpha_delta_unpack(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int lum0 = color_unquantization_tables[quantization_level][input[0]]; + int lum1 = color_unquantization_tables[quantization_level][input[1]]; + int alpha0 = color_unquantization_tables[quantization_level][input[2]]; + int alpha1 = color_unquantization_tables[quantization_level][input[3]]; + + lum0 |= (lum1 & 0x80) << 1; + alpha0 |= (alpha1 & 0x80) << 1; + lum1 &= 0x7F; + alpha1 &= 0x7F; + if (lum1 & 0x40) + lum1 -= 0x80; + if (alpha1 & 0x40) + alpha1 -= 0x80; + + lum0 >>= 1; + lum1 >>= 1; + alpha0 >>= 1; + alpha1 >>= 1; + lum1 += lum0; + alpha1 += alpha0; + + if (lum1 < 0) + lum1 = 0; + else if (lum1 > 255) + lum1 = 255; + + if (alpha1 < 0) + alpha1 = 0; + else if (alpha1 > 255) + alpha1 = 255; + + *output0 = ushort4(lum0, lum0, lum0, alpha0); + *output1 = ushort4(lum1, lum1, lum1, alpha1); +} + + + + +// RGB-offset format +void hdr_rgbo_unpack3(const int input[4], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int v0 = color_unquantization_tables[quantization_level][input[0]]; + int v1 = color_unquantization_tables[quantization_level][input[1]]; + int v2 = color_unquantization_tables[quantization_level][input[2]]; + int v3 = color_unquantization_tables[quantization_level][input[3]]; + + int modeval = ((v0 & 0xC0) >> 6) | (((v1 & 0x80) >> 7) << 2) | (((v2 & 0x80) >> 7) << 3); + + int majcomp; + int mode; + if ((modeval & 0xC) != 0xC) + { + majcomp = modeval >> 2; + mode = modeval & 3; + } + else if (modeval != 0xF) + { + majcomp = modeval & 3; + mode = 4; + } + else + { + majcomp = 0; + mode = 5; + } + + int red = v0 & 0x3F; + int green = v1 & 0x1F; + int blue = v2 & 0x1F; + int scale = v3 & 0x1F; + + int bit0 = (v1 >> 6) & 1; + int bit1 = (v1 >> 5) & 1; + int bit2 = (v2 >> 6) & 1; + int bit3 = (v2 >> 5) & 1; + int bit4 = (v3 >> 7) & 1; + int bit5 = (v3 >> 6) & 1; + int bit6 = (v3 >> 5) & 1; + + int ohcomp = 1 << mode; + + if (ohcomp & 0x30) + green |= bit0 << 6; + if (ohcomp & 0x3A) + green |= bit1 << 5; + if (ohcomp & 0x30) + blue |= bit2 << 6; + if (ohcomp & 0x3A) + blue |= bit3 << 5; + + if (ohcomp & 0x3D) + scale |= bit6 << 5; + if (ohcomp & 0x2D) + scale |= bit5 << 6; + if (ohcomp & 0x04) + scale |= bit4 << 7; + + if (ohcomp & 0x3B) + red |= bit4 << 6; + if (ohcomp & 0x04) + red |= bit3 << 6; + + if (ohcomp & 0x10) + red |= bit5 << 7; + if (ohcomp & 0x0F) + red |= bit2 << 7; + + if (ohcomp & 0x05) + red |= bit1 << 8; + if (ohcomp & 0x0A) + red |= bit0 << 8; + + if (ohcomp & 0x05) + red |= bit0 << 9; + if (ohcomp & 0x02) + red |= bit6 << 9; + + if (ohcomp & 0x01) + red |= bit3 << 10; + if (ohcomp & 0x02) + red |= bit5 << 10; + + + // expand to 12 bits. + static const int shamts[6] = { 1, 1, 2, 3, 4, 5 }; + int shamt = shamts[mode]; + red <<= shamt; + green <<= shamt; + blue <<= shamt; + scale <<= shamt; + + // on modes 0 to 4, the values stored for "green" and "blue" are differentials, + // not absolute values. + if (mode != 5) + { + green = red - green; + blue = red - blue; + } + + // switch around components. + int temp; + switch (majcomp) + { + case 1: + temp = red; + red = green; + green = temp; + break; + case 2: + temp = red; + red = blue; + blue = temp; + break; + default: + break; + } + + + int red0 = red - scale; + int green0 = green - scale; + int blue0 = blue - scale; + + // clamp to [0,0xFFF]. + if (red < 0) + red = 0; + if (green < 0) + green = 0; + if (blue < 0) + blue = 0; + + if (red0 < 0) + red0 = 0; + if (green0 < 0) + green0 = 0; + if (blue0 < 0) + blue0 = 0; + + *output0 = ushort4(red0 << 4, green0 << 4, blue0 << 4, 0x7800); + *output1 = ushort4(red << 4, green << 4, blue << 4, 0x7800); +} + + + +void hdr_rgb_unpack3(const int input[6], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + + int v0 = color_unquantization_tables[quantization_level][input[0]]; + int v1 = color_unquantization_tables[quantization_level][input[1]]; + int v2 = color_unquantization_tables[quantization_level][input[2]]; + int v3 = color_unquantization_tables[quantization_level][input[3]]; + int v4 = color_unquantization_tables[quantization_level][input[4]]; + int v5 = color_unquantization_tables[quantization_level][input[5]]; + + // extract all the fixed-placement bitfields + int modeval = ((v1 & 0x80) >> 7) | (((v2 & 0x80) >> 7) << 1) | (((v3 & 0x80) >> 7) << 2); + + int majcomp = ((v4 & 0x80) >> 7) | (((v5 & 0x80) >> 7) << 1); + + if (majcomp == 3) + { + *output0 = ushort4(v0 << 8, v2 << 8, (v4 & 0x7F) << 9, 0x7800); + *output1 = ushort4(v1 << 8, v3 << 8, (v5 & 0x7F) << 9, 0x7800); + return; + } + + int a = v0 | ((v1 & 0x40) << 2); + int b0 = v2 & 0x3f; + int b1 = v3 & 0x3f; + int c = v1 & 0x3f; + int d0 = v4 & 0x7f; + int d1 = v5 & 0x7f; + + // get hold of the number of bits in 'd0' and 'd1' + static const int dbits_tab[8] = { 7, 6, 7, 6, 5, 6, 5, 6 }; + int dbits = dbits_tab[modeval]; + + // extract six variable-placement bits + int bit0 = (v2 >> 6) & 1; + int bit1 = (v3 >> 6) & 1; + + int bit2 = (v4 >> 6) & 1; + int bit3 = (v5 >> 6) & 1; + int bit4 = (v4 >> 5) & 1; + int bit5 = (v5 >> 5) & 1; + + + // and prepend the variable-placement bits depending on mode. + int ohmod = 1 << modeval; // one-hot-mode + if (ohmod & 0xA4) + a |= bit0 << 9; + if (ohmod & 0x8) + a |= bit2 << 9; + if (ohmod & 0x50) + a |= bit4 << 9; + + if (ohmod & 0x50) + a |= bit5 << 10; + if (ohmod & 0xA0) + a |= bit1 << 10; + + if (ohmod & 0xC0) + a |= bit2 << 11; + + if (ohmod & 0x4) + c |= bit1 << 6; + if (ohmod & 0xE8) + c |= bit3 << 6; + + if (ohmod & 0x20) + c |= bit2 << 7; + + + if (ohmod & 0x5B) + b0 |= bit0 << 6; + if (ohmod & 0x5B) + b1 |= bit1 << 6; + + if (ohmod & 0x12) + b0 |= bit2 << 7; + if (ohmod & 0x12) + b1 |= bit3 << 7; + + if (ohmod & 0xAF) + d0 |= bit4 << 5; + if (ohmod & 0xAF) + d1 |= bit5 << 5; + if (ohmod & 0x5) + d0 |= bit2 << 6; + if (ohmod & 0x5) + d1 |= bit3 << 6; + + // sign-extend 'd0' and 'd1' + // note: this code assumes that signed right-shift actually sign-fills, not zero-fills. + int32_t d0x = d0; + int32_t d1x = d1; + int sx_shamt = 32 - dbits; + d0x <<= sx_shamt; + d0x >>= sx_shamt; + d1x <<= sx_shamt; + d1x >>= sx_shamt; + d0 = d0x; + d1 = d1x; + + // expand all values to 12 bits, with left-shift as needed. + int val_shamt = (modeval >> 1) ^ 3; + a <<= val_shamt; + b0 <<= val_shamt; + b1 <<= val_shamt; + c <<= val_shamt; + d0 <<= val_shamt; + d1 <<= val_shamt; + + // then compute the actual color values. + int red1 = a; + int green1 = a - b0; + int blue1 = a - b1; + int red0 = a - c; + int green0 = a - b0 - c - d0; + int blue0 = a - b1 - c - d1; + + // clamp the color components to [0,2^12 - 1] + if (red0 < 0) + red0 = 0; + else if (red0 > 0xFFF) + red0 = 0xFFF; + + if (green0 < 0) + green0 = 0; + else if (green0 > 0xFFF) + green0 = 0xFFF; + + if (blue0 < 0) + blue0 = 0; + else if (blue0 > 0xFFF) + blue0 = 0xFFF; + + if (red1 < 0) + red1 = 0; + else if (red1 > 0xFFF) + red1 = 0xFFF; + + if (green1 < 0) + green1 = 0; + else if (green1 > 0xFFF) + green1 = 0xFFF; + + if (blue1 < 0) + blue1 = 0; + else if (blue1 > 0xFFF) + blue1 = 0xFFF; + + + // switch around the color components + int temp0, temp1; + switch (majcomp) + { + case 1: // switch around red and green + temp0 = red0; + temp1 = red1; + red0 = green0; + red1 = green1; + green0 = temp0; + green1 = temp1; + break; + case 2: // switch around red and blue + temp0 = red0; + temp1 = red1; + red0 = blue0; + red1 = blue1; + blue0 = temp0; + blue1 = temp1; + break; + case 0: // no switch + break; + } + + *output0 = ushort4(red0 << 4, green0 << 4, blue0 << 4, 0x7800); + *output1 = ushort4(red1 << 4, green1 << 4, blue1 << 4, 0x7800); +} + + + + +void hdr_rgb_ldr_alpha_unpack3(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + hdr_rgb_unpack3(input, quantization_level, output0, output1); + + int v6 = color_unquantization_tables[quantization_level][input[6]]; + int v7 = color_unquantization_tables[quantization_level][input[7]]; + output0->w = v6; + output1->w = v7; +} + + + +void hdr_luminance_small_range_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int v0 = color_unquantization_tables[quantization_level][input[0]]; + int v1 = color_unquantization_tables[quantization_level][input[1]]; + + int y0, y1; + if (v0 & 0x80) + { + y0 = ((v1 & 0xE0) << 4) | ((v0 & 0x7F) << 2); + y1 = (v1 & 0x1F) << 2; + } + else + { + y0 = ((v1 & 0xF0) << 4) | ((v0 & 0x7F) << 1); + y1 = (v1 & 0xF) << 1; + } + + y1 += y0; + if (y1 > 0xFFF) + y1 = 0xFFF; + + *output0 = ushort4(y0 << 4, y0 << 4, y0 << 4, 0x7800); + *output1 = ushort4(y1 << 4, y1 << 4, y1 << 4, 0x7800); +} + + +void hdr_luminance_large_range_unpack(const int input[2], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + int v0 = color_unquantization_tables[quantization_level][input[0]]; + int v1 = color_unquantization_tables[quantization_level][input[1]]; + + int y0, y1; + if (v1 >= v0) + { + y0 = v0 << 4; + y1 = v1 << 4; + } + else + { + y0 = (v1 << 4) + 8; + y1 = (v0 << 4) - 8; + } + *output0 = ushort4(y0 << 4, y0 << 4, y0 << 4, 0x7800); + *output1 = ushort4(y1 << 4, y1 << 4, y1 << 4, 0x7800); +} + + + +void hdr_alpha_unpack(const int input[2], int quantization_level, int *a0, int *a1) +{ + + int v6 = color_unquantization_tables[quantization_level][input[0]]; + int v7 = color_unquantization_tables[quantization_level][input[1]]; + + int selector = ((v6 >> 7) & 1) | ((v7 >> 6) & 2); + v6 &= 0x7F; + v7 &= 0x7F; + if (selector == 3) + { + *a0 = v6 << 5; + *a1 = v7 << 5; + } + else + { + v6 |= (v7 << (selector + 1)) & 0x780; + v7 &= (0x3f >> selector); + v7 ^= 32 >> selector; + v7 -= 32 >> selector; + v6 <<= (4 - selector); + v7 <<= (4 - selector); + v7 += v6; + + if (v7 < 0) + v7 = 0; + else if (v7 > 0xFFF) + v7 = 0xFFF; + + *a0 = v6; + *a1 = v7; + } + + *a0 <<= 4; + *a1 <<= 4; +} + + + +void hdr_rgb_hdr_alpha_unpack3(const int input[8], int quantization_level, ushort4 * output0, ushort4 * output1) +{ + hdr_rgb_unpack3(input, quantization_level, output0, output1); + + int alpha0, alpha1; + hdr_alpha_unpack(input + 6, quantization_level, &alpha0, &alpha1); + + output0->w = alpha0; + output1->w = alpha1; +} + + + + + + +void unpack_color_endpoints(astc_decode_mode decode_mode, int format, int quantization_level, const int *input, int *rgb_hdr, int *alpha_hdr, int *nan_endpoint, ushort4 * output0, ushort4 * output1) +{ + *nan_endpoint = 0; + + switch (format) + { + case FMT_LUMINANCE: + *rgb_hdr = 0; + *alpha_hdr = 0; + luminance_unpack(input, quantization_level, output0, output1); + break; + + case FMT_LUMINANCE_DELTA: + *rgb_hdr = 0; + *alpha_hdr = 0; + luminance_delta_unpack(input, quantization_level, output0, output1); + break; + + case FMT_HDR_LUMINANCE_SMALL_RANGE: + *rgb_hdr = 1; + *alpha_hdr = -1; + hdr_luminance_small_range_unpack(input, quantization_level, output0, output1); + break; + + case FMT_HDR_LUMINANCE_LARGE_RANGE: + *rgb_hdr = 1; + *alpha_hdr = -1; + hdr_luminance_large_range_unpack(input, quantization_level, output0, output1); + break; + + case FMT_LUMINANCE_ALPHA: + *rgb_hdr = 0; + *alpha_hdr = 0; + luminance_alpha_unpack(input, quantization_level, output0, output1); + break; + + case FMT_LUMINANCE_ALPHA_DELTA: + *rgb_hdr = 0; + *alpha_hdr = 0; + luminance_alpha_delta_unpack(input, quantization_level, output0, output1); + break; + + case FMT_RGB_SCALE: + *rgb_hdr = 0; + *alpha_hdr = 0; + rgb_scale_unpack(input, quantization_level, output0, output1); + break; + + case FMT_RGB_SCALE_ALPHA: + *rgb_hdr = 0; + *alpha_hdr = 0; + rgb_scale_alpha_unpack(input, quantization_level, output0, output1); + break; + + case FMT_HDR_RGB_SCALE: + *rgb_hdr = 1; + *alpha_hdr = -1; + hdr_rgbo_unpack3(input, quantization_level, output0, output1); + break; + + case FMT_RGB: + *rgb_hdr = 0; + *alpha_hdr = 0; + rgb_unpack(input, quantization_level, output0, output1); + break; + + case FMT_RGB_DELTA: + *rgb_hdr = 0; + *alpha_hdr = 0; + rgb_delta_unpack(input, quantization_level, output0, output1); + break; + + case FMT_HDR_RGB: + *rgb_hdr = 1; + *alpha_hdr = -1; + hdr_rgb_unpack3(input, quantization_level, output0, output1); + break; + + case FMT_RGBA: + *rgb_hdr = 0; + *alpha_hdr = 0; + rgba_unpack(input, quantization_level, output0, output1); + break; + + case FMT_RGBA_DELTA: + *rgb_hdr = 0; + *alpha_hdr = 0; + rgba_delta_unpack(input, quantization_level, output0, output1); + break; + + case FMT_HDR_RGB_LDR_ALPHA: + *rgb_hdr = 1; + *alpha_hdr = 0; + hdr_rgb_ldr_alpha_unpack3(input, quantization_level, output0, output1); + break; + + case FMT_HDR_RGBA: + *rgb_hdr = 1; + *alpha_hdr = 1; + hdr_rgb_hdr_alpha_unpack3(input, quantization_level, output0, output1); + break; + + default: + ASTC_CODEC_INTERNAL_ERROR; + } + + + + if (*alpha_hdr == -1) + { + if (alpha_force_use_of_hdr) + { + output0->w = 0x7800; + output1->w = 0x7800; + *alpha_hdr = 1; + } + else + { + output0->w = 0x00FF; + output1->w = 0x00FF; + *alpha_hdr = 0; + } + } + + + + switch (decode_mode) + { + case DECODE_LDR_SRGB: + if (*rgb_hdr == 1) + { + output0->x = 0xFF00; + output0->y = 0x0000; + output0->z = 0xFF00; + output0->w = 0xFF00; + output1->x = 0xFF00; + output1->y = 0x0000; + output1->z = 0xFF00; + output1->w = 0xFF00; + } + else + { + output0->x *= 257; + output0->y *= 257; + output0->z *= 257; + output0->w *= 257; + output1->x *= 257; + output1->y *= 257; + output1->z *= 257; + output1->w *= 257; + } + *rgb_hdr = 0; + *alpha_hdr = 0; + break; + + case DECODE_LDR: + if (*rgb_hdr == 1) + { + output0->x = 0xFFFF; + output0->y = 0xFFFF; + output0->z = 0xFFFF; + output0->w = 0xFFFF; + output1->x = 0xFFFF; + output1->y = 0xFFFF; + output1->z = 0xFFFF; + output1->w = 0xFFFF; + *nan_endpoint = 1; + } + else + { + output0->x *= 257; + output0->y *= 257; + output0->z *= 257; + output0->w *= 257; + output1->x *= 257; + output1->y *= 257; + output1->z *= 257; + output1->w *= 257; + } + *rgb_hdr = 0; + *alpha_hdr = 0; + break; + + case DECODE_HDR: + + if (*rgb_hdr == 0) + { + output0->x *= 257; + output0->y *= 257; + output0->z *= 257; + output1->x *= 257; + output1->y *= 257; + output1->z *= 257; + } + if (*alpha_hdr == 0) + { + output0->w *= 257; + output1->w *= 257; + } + break; + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_compress_symbolic.cpp b/3rdparty/bimg/3rdparty/astc/astc_compress_symbolic.cpp new file mode 100644 index 00000000000..152ca05472c --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_compress_symbolic.cpp @@ -0,0 +1,1792 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Compress a block of colors, expressed as a symbolic block, for ASTC. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +#include "softfloat.h" +#include +#include +#include + +#ifdef DEBUG_CAPTURE_NAN + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif + + #include +#endif + +#include + +int realign_weights(astc_decode_mode decode_mode, + int xdim, int ydim, int zdim, const imageblock * blk, const error_weight_block * ewb, symbolic_compressed_block * scb, uint8_t * weight_set8, uint8_t * plane2_weight_set8) +{ + int i, j; + + // get the appropriate partition descriptor. + int partition_count = scb->partition_count; + const partition_info *pt = get_partition_table(xdim, ydim, zdim, partition_count); + pt += scb->partition_index; + + // get the appropriate block descriptor + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + const decimation_table *const *ixtab2 = bsd->decimation_tables; + + const decimation_table *it = ixtab2[bsd->block_modes[scb->block_mode].decimation_mode]; + + int is_dual_plane = bsd->block_modes[scb->block_mode].is_dual_plane; + + // get quantization-parameters + int weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode; + + + // decode the color endpoints + ushort4 color_endpoint0[4]; + ushort4 color_endpoint1[4]; + int rgb_hdr[4]; + int alpha_hdr[4]; + int nan_endpoint[4]; + + + for (i = 0; i < partition_count; i++) + unpack_color_endpoints(decode_mode, + scb->color_formats[i], scb->color_quantization_level, scb->color_values[i], &rgb_hdr[i], &alpha_hdr[i], &nan_endpoint[i], &(color_endpoint0[i]), &(color_endpoint1[i])); + + + float uq_plane1_weights[MAX_WEIGHTS_PER_BLOCK]; + float uq_plane2_weights[MAX_WEIGHTS_PER_BLOCK]; + int weight_count = it->num_weights; + + // read and unquantize the weights. + + const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_level]); + + for (i = 0; i < weight_count; i++) + { + uq_plane1_weights[i] = qat->unquantized_value_flt[weight_set8[i]]; + } + if (is_dual_plane) + { + for (i = 0; i < weight_count; i++) + uq_plane2_weights[i] = qat->unquantized_value_flt[plane2_weight_set8[i]]; + } + + + int plane2_color_component = is_dual_plane ? scb->plane2_color_component : -1; + + // for each weight, unquantize the weight, use it to compute a color and a color error. + // then, increment the weight until the color error stops decreasing + // then, decrement the weight until the color error stops increasing + + #define COMPUTE_ERROR( errorvar ) \ + errorvar = 0.0f; \ + for(j=0;jweight_texel[i][j]; \ + int partition = pt->partition_of_texel[texel]; \ + float plane1_weight = compute_value_of_texel_flt( texel, it, uq_plane1_weights ); \ + float plane2_weight = 0.0f; \ + if( is_dual_plane ) \ + plane2_weight = compute_value_of_texel_flt( texel, it, uq_plane2_weights ); \ + int int_plane1_weight = static_cast(floor( plane1_weight*64.0f + 0.5f ) ); \ + int int_plane2_weight = static_cast(floor( plane2_weight*64.0f + 0.5f ) ); \ + ushort4 lrp_color = lerp_color_int( \ + decode_mode, \ + color_endpoint0[partition], \ + color_endpoint1[partition], \ + int_plane1_weight, \ + int_plane2_weight, \ + plane2_color_component ); \ + float4 color = float4( lrp_color.x, lrp_color.y, lrp_color.z, lrp_color.w ); \ + float4 origcolor = float4( \ + blk->work_data[4*texel], \ + blk->work_data[4*texel+1], \ + blk->work_data[4*texel+2], \ + blk->work_data[4*texel+3] ); \ + float4 error_weight = ewb->error_weights[texel]; \ + float4 colordiff = color - origcolor; \ + errorvar += dot( colordiff*colordiff, error_weight ); \ + } + + + int adjustments = 0; + + for (i = 0; i < weight_count; i++) + { + int current_wt = weight_set8[i]; + int texels_to_evaluate = it->weight_num_texels[i]; + + float current_error; + + COMPUTE_ERROR(current_error); + + // increment until error starts increasing. + while (1) + { + int next_wt = qat->next_quantized_value[current_wt]; + if (next_wt == current_wt) + break; + uq_plane1_weights[i] = qat->unquantized_value_flt[next_wt]; + float next_error; + COMPUTE_ERROR(next_error); + if (next_error < current_error) + { + // succeeded, increment the weight + current_wt = next_wt; + current_error = next_error; + adjustments++; + } + else + { + // failed, back out the attempted increment + uq_plane1_weights[i] = qat->unquantized_value_flt[current_wt]; + break; + } + } + // decrement until error starts increasing + while (1) + { + int prev_wt = qat->prev_quantized_value[current_wt]; + if (prev_wt == current_wt) + break; + uq_plane1_weights[i] = qat->unquantized_value_flt[prev_wt]; + float prev_error; + COMPUTE_ERROR(prev_error); + if (prev_error < current_error) + { + // succeeded, decrement the weight + current_wt = prev_wt; + current_error = prev_error; + adjustments++; + } + else + { + // failed, back out the attempted decrement + uq_plane1_weights[i] = qat->unquantized_value_flt[current_wt]; + break; + } + } + + weight_set8[i] = current_wt; + } + + if (!is_dual_plane) + return adjustments; + + // processing of the second plane of weights + for (i = 0; i < weight_count; i++) + { + int current_wt = plane2_weight_set8[i]; + int texels_to_evaluate = it->weight_num_texels[i]; + + float current_error; + + COMPUTE_ERROR(current_error); + + // increment until error starts increasing. + while (1) + { + int next_wt = qat->next_quantized_value[current_wt]; + if (next_wt == current_wt) + break; + uq_plane2_weights[i] = qat->unquantized_value_flt[next_wt]; + float next_error; + COMPUTE_ERROR(next_error); + if (next_error < current_error) + { + // succeeded, increment the weight + current_wt = next_wt; + current_error = next_error; + adjustments++; + } + else + { + // failed, back out the attempted increment + uq_plane2_weights[i] = qat->unquantized_value_flt[current_wt]; + break; + } + } + // decrement until error starts increasing + while (1) + { + int prev_wt = qat->prev_quantized_value[current_wt]; + if (prev_wt == current_wt) + break; + uq_plane2_weights[i] = qat->unquantized_value_flt[prev_wt]; + float prev_error; + COMPUTE_ERROR(prev_error); + if (prev_error < current_error) + { + // succeeded, decrement the weight + current_wt = prev_wt; + current_error = prev_error; + adjustments++; + } + else + { + // failed, back out the attempted decrement + uq_plane2_weights[i] = qat->unquantized_value_flt[current_wt]; + break; + } + } + + plane2_weight_set8[i] = current_wt; + } + + return adjustments; +} + +/* + function for compressing a block symbolically, given that we have already decided on a partition +*/ + + + +static void compress_symbolic_block_fixed_partition_1_plane(astc_decode_mode decode_mode, + float mode_cutoff, + int max_refinement_iters, + int xdim, int ydim, int zdim, + int partition_count, int partition_index, + const imageblock * blk, const error_weight_block * ewb, symbolic_compressed_block * scb, + compress_fixed_partition_buffers * tmpbuf) +{ + int i, j, k; + + + static const int free_bits_for_partition_count[5] = { 0, 115 - 4, 111 - 4 - PARTITION_BITS, 108 - 4 - PARTITION_BITS, 105 - 4 - PARTITION_BITS }; + + const partition_info *pi = get_partition_table(xdim, ydim, zdim, partition_count); + pi += partition_index; + + // first, compute ideal weights and endpoint colors, under thre assumption that + // there is no quantization or decimation going on. + endpoints_and_weights *ei = tmpbuf->ei1; + endpoints_and_weights *eix = tmpbuf->eix1; + compute_endpoints_and_ideal_weights_1_plane(xdim, ydim, zdim, pi, blk, ewb, ei); + + // next, compute ideal weights and endpoint colors for every decimation. + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + const decimation_table *const *ixtab2 = bsd->decimation_tables; + // int block_mode_count = bsd->single_plane_block_mode_count; + + + float *decimated_quantized_weights = tmpbuf->decimated_quantized_weights; + float *decimated_weights = tmpbuf->decimated_weights; + float *flt_quantized_decimated_quantized_weights = tmpbuf->flt_quantized_decimated_quantized_weights; + uint8_t *u8_quantized_decimated_quantized_weights = tmpbuf->u8_quantized_decimated_quantized_weights; + + // for each decimation mode, compute an ideal set of weights + // (that is, weights computed with the assumption that they are not quantized) + for (i = 0; i < MAX_DECIMATION_MODES; i++) + { + if (bsd->permit_encode[i] == 0 || bsd->decimation_mode_maxprec_1plane[i] < 0 || bsd->decimation_mode_percentile[i] > mode_cutoff) + continue; + eix[i] = *ei; + compute_ideal_weights_for_decimation_table(&(eix[i]), ixtab2[i], decimated_quantized_weights + i * MAX_WEIGHTS_PER_BLOCK, decimated_weights + i * MAX_WEIGHTS_PER_BLOCK); + + } + + // compute maximum colors for the endpoints and ideal weights. + // for each endpoint-and-ideal-weight pair, compute the smallest weight value + // that will result in a color value greater than 1. + + + float4 min_ep = float4(10, 10, 10, 10); + for (i = 0; i < partition_count; i++) + { + #ifdef DEBUG_CAPTURE_NAN + fedisableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + float4 ep = (float4(1, 1, 1, 1) - ei->ep.endpt0[i]) / (ei->ep.endpt1[i] - ei->ep.endpt0[i]); + if (ep.x > 0.5f && ep.x < min_ep.x) + min_ep.x = ep.x; + if (ep.y > 0.5f && ep.y < min_ep.y) + min_ep.y = ep.y; + if (ep.z > 0.5f && ep.z < min_ep.z) + min_ep.z = ep.z; + if (ep.w > 0.5f && ep.w < min_ep.w) + min_ep.w = ep.w; + + #ifdef DEBUG_CAPTURE_NAN + feenableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + } + + float min_wt_cutoff = MIN(MIN(min_ep.x, min_ep.y), MIN(min_ep.z, min_ep.w)); + + // for each mode, use the angular method to compute a shift. + float weight_low_value[MAX_WEIGHT_MODES]; + float weight_high_value[MAX_WEIGHT_MODES]; + + compute_angular_endpoints_1plane(mode_cutoff, bsd, decimated_quantized_weights, decimated_weights, weight_low_value, weight_high_value); + + // for each mode (which specifies a decimation and a quantization): + // * compute number of bits needed for the quantized weights. + // * generate an optimized set of quantized weights. + // * compute quantization errors for the mode. + + int qwt_bitcounts[MAX_WEIGHT_MODES]; + float qwt_errors[MAX_WEIGHT_MODES]; + + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (bsd->block_modes[i].permit_encode == 0 || bsd->block_modes[i].is_dual_plane != 0 || bsd->block_modes[i].percentile > mode_cutoff) + { + qwt_errors[i] = 1e38f; + continue; + } + if (weight_high_value[i] > 1.02f * min_wt_cutoff) + weight_high_value[i] = 1.0f; + + int decimation_mode = bsd->block_modes[i].decimation_mode; + if (bsd->decimation_mode_percentile[decimation_mode] > mode_cutoff) + ASTC_CODEC_INTERNAL_ERROR; + + + // compute weight bitcount for the mode + int bits_used_by_weights = compute_ise_bitcount(ixtab2[decimation_mode]->num_weights, + (quantization_method) bsd->block_modes[i].quantization_mode); + int bitcount = free_bits_for_partition_count[partition_count] - bits_used_by_weights; + if (bitcount <= 0 || bits_used_by_weights < 24 || bits_used_by_weights > 96) + { + qwt_errors[i] = 1e38f; + continue; + } + qwt_bitcounts[i] = bitcount; + + + // then, generate the optimized set of weights for the weight mode. + compute_ideal_quantized_weights_for_decimation_table(&(eix[decimation_mode]), + ixtab2[decimation_mode], + weight_low_value[i], weight_high_value[i], + decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * decimation_mode, + flt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * i, + u8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * i, + bsd->block_modes[i].quantization_mode); + + // then, compute weight-errors for the weight mode. + qwt_errors[i] = compute_error_of_weight_set(&(eix[decimation_mode]), ixtab2[decimation_mode], flt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * i); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Block mode %d -> weight error = %f\n", i, qwt_errors[i]); + #endif + } + + // for each weighting mode, determine the optimal combination of color endpoint encodings + // and weight encodings; return results for the 4 best-looking modes. + + int partition_format_specifiers[4][4]; + int quantized_weight[4]; + int color_quantization_level[4]; + int color_quantization_level_mod[4]; + determine_optimal_set_of_endpoint_formats_to_use(xdim, ydim, zdim, pi, blk, ewb, &(ei->ep), -1, // used to flag that we are in single-weight mode + qwt_bitcounts, qwt_errors, partition_format_specifiers, quantized_weight, color_quantization_level, color_quantization_level_mod); + + + // then iterate over the 4 believed-to-be-best modes to find out which one is + // actually best. + for (i = 0; i < 4; i++) + { + uint8_t *u8_weight_src; + int weights_to_copy; + + if (quantized_weight[i] < 0) + { + scb->error_block = 1; + scb++; + continue; + } + + int decimation_mode = bsd->block_modes[quantized_weight[i]].decimation_mode; + int weight_quantization_mode = bsd->block_modes[quantized_weight[i]].quantization_mode; + const decimation_table *it = ixtab2[decimation_mode]; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Selected mode = %d\n", quantized_weight[i]); + printf("Selected decimation mode = %d\n", decimation_mode); + printf("Selected weight-quantization mode = %d\n", weight_quantization_mode); + } + #endif + + u8_weight_src = u8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * quantized_weight[i]; + + weights_to_copy = it->num_weights; + + // recompute the ideal color endpoints before storing them. + float4 rgbs_colors[4]; + float4 rgbo_colors[4]; + float2 lum_intervals[4]; + + int l; + for (l = 0; l < max_refinement_iters; l++) + { + recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &(eix[decimation_mode].ep), rgbs_colors, rgbo_colors, lum_intervals, u8_weight_src, NULL, -1, pi, it, blk, ewb); + + // quantize the chosen color + + // store the colors for the block + for (j = 0; j < partition_count; j++) + { + scb->color_formats[j] = pack_color_endpoints(decode_mode, + eix[decimation_mode].ep.endpt0[j], + eix[decimation_mode].ep.endpt1[j], + rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]); + } + + + // if all the color endpoint modes are the same, we get a few more + // bits to store colors; let's see if we can take advantage of this: + // requantize all the colors and see if the endpoint modes remain the same; + // if they do, then exploit it. + scb->color_formats_matched = 0; + + if ((partition_count >= 2 && scb->color_formats[0] == scb->color_formats[1] + && color_quantization_level != color_quantization_level_mod) + && (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3]))))) + { + int colorvals[4][12]; + int color_formats_mod[4]; + for (j = 0; j < partition_count; j++) + { + color_formats_mod[j] = pack_color_endpoints(decode_mode, + eix[decimation_mode].ep.endpt0[j], + eix[decimation_mode].ep.endpt1[j], + rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]); + } + if (color_formats_mod[0] == color_formats_mod[1] + && (partition_count == 2 || (color_formats_mod[0] == color_formats_mod[2] && (partition_count == 3 || (color_formats_mod[0] == color_formats_mod[3]))))) + { + scb->color_formats_matched = 1; + for (j = 0; j < 4; j++) + for (k = 0; k < 12; k++) + scb->color_values[j][k] = colorvals[j][k]; + for (j = 0; j < 4; j++) + scb->color_formats[j] = color_formats_mod[j]; + } + } + + + // store header fields + scb->partition_count = partition_count; + scb->partition_index = partition_index; + scb->color_quantization_level = scb->color_formats_matched ? color_quantization_level_mod[i] : color_quantization_level[i]; + scb->block_mode = quantized_weight[i]; + scb->error_block = 0; + + if (scb->color_quantization_level < 4) + { + scb->error_block = 1; // should never happen, but cannot prove it impossible. + } + + // perform a final pass over the weights to try to improve them. + int adjustments = realign_weights(decode_mode, + xdim, ydim, zdim, + blk, ewb, scb, + u8_weight_src, + NULL); + + if (adjustments == 0) + break; + } + + for (j = 0; j < weights_to_copy; j++) + scb->plane1_weights[j] = u8_weight_src[j]; + + scb++; + } + +} + + + + + + +static void compress_symbolic_block_fixed_partition_2_planes(astc_decode_mode decode_mode, + float mode_cutoff, + int max_refinement_iters, + int xdim, int ydim, int zdim, + int partition_count, int partition_index, + int separate_component, const imageblock * blk, const error_weight_block * ewb, + symbolic_compressed_block * scb, + compress_fixed_partition_buffers * tmpbuf) +{ + int i, j, k; + + static const int free_bits_for_partition_count[5] = + { 0, 113 - 4, 109 - 4 - PARTITION_BITS, 106 - 4 - PARTITION_BITS, 103 - 4 - PARTITION_BITS }; + + const partition_info *pi = get_partition_table(xdim, ydim, zdim, partition_count); + pi += partition_index; + + // first, compute ideal weights and endpoint colors + endpoints_and_weights *ei1 = tmpbuf->ei1; + endpoints_and_weights *ei2 = tmpbuf->ei2; + endpoints_and_weights *eix1 = tmpbuf->eix1; + endpoints_and_weights *eix2 = tmpbuf->eix2; + compute_endpoints_and_ideal_weights_2_planes(xdim, ydim, zdim, pi, blk, ewb, separate_component, ei1, ei2); + + // next, compute ideal weights and endpoint colors for every decimation. + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + const decimation_table *const *ixtab2 = bsd->decimation_tables; + + + float *decimated_quantized_weights = tmpbuf->decimated_quantized_weights; + float *decimated_weights = tmpbuf->decimated_weights; + float *flt_quantized_decimated_quantized_weights = tmpbuf->flt_quantized_decimated_quantized_weights; + uint8_t *u8_quantized_decimated_quantized_weights = tmpbuf->u8_quantized_decimated_quantized_weights; + + // for each decimation mode, compute an ideal set of weights + for (i = 0; i < MAX_DECIMATION_MODES; i++) + { + if (bsd->permit_encode[i] == 0 || bsd->decimation_mode_maxprec_2planes[i] < 0 || bsd->decimation_mode_percentile[i] > mode_cutoff) + continue; + + eix1[i] = *ei1; + eix2[i] = *ei2; + compute_ideal_weights_for_decimation_table(&(eix1[i]), ixtab2[i], decimated_quantized_weights + (2 * i) * MAX_WEIGHTS_PER_BLOCK, decimated_weights + (2 * i) * MAX_WEIGHTS_PER_BLOCK); + compute_ideal_weights_for_decimation_table(&(eix2[i]), ixtab2[i], decimated_quantized_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, decimated_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK); + } + + // compute maximum colors for the endpoints and ideal weights. + // for each endpoint-and-ideal-weight pair, compute the smallest weight value + // that will result in a color value greater than 1. + + float4 min_ep1 = float4(10, 10, 10, 10); + float4 min_ep2 = float4(10, 10, 10, 10); + for (i = 0; i < partition_count; i++) + { + + #ifdef DEBUG_CAPTURE_NAN + fedisableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + float4 ep1 = (float4(1, 1, 1, 1) - ei1->ep.endpt0[i]) / (ei1->ep.endpt1[i] - ei1->ep.endpt0[i]); + if (ep1.x > 0.5f && ep1.x < min_ep1.x) + min_ep1.x = ep1.x; + if (ep1.y > 0.5f && ep1.y < min_ep1.y) + min_ep1.y = ep1.y; + if (ep1.z > 0.5f && ep1.z < min_ep1.z) + min_ep1.z = ep1.z; + if (ep1.w > 0.5f && ep1.w < min_ep1.w) + min_ep1.w = ep1.w; + float4 ep2 = (float4(1, 1, 1, 1) - ei2->ep.endpt0[i]) / (ei2->ep.endpt1[i] - ei2->ep.endpt0[i]); + if (ep2.x > 0.5f && ep2.x < min_ep2.x) + min_ep2.x = ep2.x; + if (ep2.y > 0.5f && ep2.y < min_ep2.y) + min_ep2.y = ep2.y; + if (ep2.z > 0.5f && ep2.z < min_ep2.z) + min_ep2.z = ep2.z; + if (ep2.w > 0.5f && ep2.w < min_ep2.w) + min_ep2.w = ep2.w; + + #ifdef DEBUG_CAPTURE_NAN + feenableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + } + + float min_wt_cutoff1, min_wt_cutoff2; + switch (separate_component) + { + case 0: + min_wt_cutoff2 = min_ep2.x; + min_ep1.x = 1e30f; + break; + case 1: + min_wt_cutoff2 = min_ep2.y; + min_ep1.y = 1e30f; + break; + case 2: + min_wt_cutoff2 = min_ep2.z; + min_ep1.z = 1e30f; + break; + case 3: + min_wt_cutoff2 = min_ep2.w; + min_ep1.w = 1e30f; + break; + default: + min_wt_cutoff2 = 1e30f; + } + + min_wt_cutoff1 = MIN(MIN(min_ep1.x, min_ep1.y), MIN(min_ep1.z, min_ep1.w)); + + float weight_low_value1[MAX_WEIGHT_MODES]; + float weight_high_value1[MAX_WEIGHT_MODES]; + float weight_low_value2[MAX_WEIGHT_MODES]; + float weight_high_value2[MAX_WEIGHT_MODES]; + + compute_angular_endpoints_2planes(mode_cutoff, bsd, decimated_quantized_weights, decimated_weights, weight_low_value1, weight_high_value1, weight_low_value2, weight_high_value2); + + // for each mode (which specifies a decimation and a quantization): + // * generate an optimized set of quantized weights. + // * compute quantization errors for each mode + // * compute number of bits needed for the quantized weights. + + int qwt_bitcounts[MAX_WEIGHT_MODES]; + float qwt_errors[MAX_WEIGHT_MODES]; + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (bsd->block_modes[i].permit_encode == 0 || bsd->block_modes[i].is_dual_plane != 1 || bsd->block_modes[i].percentile > mode_cutoff) + { + qwt_errors[i] = 1e38f; + continue; + } + int decimation_mode = bsd->block_modes[i].decimation_mode; + + if (weight_high_value1[i] > 1.02f * min_wt_cutoff1) + weight_high_value1[i] = 1.0f; + if (weight_high_value2[i] > 1.02f * min_wt_cutoff2) + weight_high_value2[i] = 1.0f; + + // compute weight bitcount for the mode + int bits_used_by_weights = compute_ise_bitcount(2 * ixtab2[decimation_mode]->num_weights, + (quantization_method) bsd->block_modes[i].quantization_mode); + int bitcount = free_bits_for_partition_count[partition_count] - bits_used_by_weights; + if (bitcount <= 0 || bits_used_by_weights < 24 || bits_used_by_weights > 96) + { + qwt_errors[i] = 1e38f; + continue; + } + qwt_bitcounts[i] = bitcount; + + + // then, generate the optimized set of weights for the mode. + compute_ideal_quantized_weights_for_decimation_table(&(eix1[decimation_mode]), + ixtab2[decimation_mode], + weight_low_value1[i], + weight_high_value1[i], + decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * decimation_mode), + flt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i), + u8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i), bsd->block_modes[i].quantization_mode); + compute_ideal_quantized_weights_for_decimation_table(&(eix2[decimation_mode]), + ixtab2[decimation_mode], + weight_low_value2[i], + weight_high_value2[i], + decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * decimation_mode + 1), + flt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i + 1), + u8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i + 1), bsd->block_modes[i].quantization_mode); + + + // then, compute quantization errors for the block mode. + qwt_errors[i] = + compute_error_of_weight_set(&(eix1[decimation_mode]), + ixtab2[decimation_mode], + flt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i)) + + compute_error_of_weight_set(&(eix2[decimation_mode]), ixtab2[decimation_mode], flt_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * i + 1)); + } + + + // decide the optimal combination of color endpoint encodings and weight encoodings. + int partition_format_specifiers[4][4]; + int quantized_weight[4]; + int color_quantization_level[4]; + int color_quantization_level_mod[4]; + + endpoints epm; + merge_endpoints(&(ei1->ep), &(ei2->ep), separate_component, &epm); + + determine_optimal_set_of_endpoint_formats_to_use(xdim, ydim, zdim, + pi, + blk, + ewb, + &epm, separate_component, qwt_bitcounts, qwt_errors, partition_format_specifiers, quantized_weight, color_quantization_level, color_quantization_level_mod); + + for (i = 0; i < 4; i++) + { + if (quantized_weight[i] < 0) + { + scb->error_block = 1; + scb++; + continue; + } + + uint8_t *u8_weight1_src; + uint8_t *u8_weight2_src; + int weights_to_copy; + + int decimation_mode = bsd->block_modes[quantized_weight[i]].decimation_mode; + int weight_quantization_mode = bsd->block_modes[quantized_weight[i]].quantization_mode; + const decimation_table *it = ixtab2[decimation_mode]; + + u8_weight1_src = u8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * quantized_weight[i]); + u8_weight2_src = u8_quantized_decimated_quantized_weights + MAX_WEIGHTS_PER_BLOCK * (2 * quantized_weight[i] + 1); + + + weights_to_copy = it->num_weights; + + // recompute the ideal color endpoints before storing them. + merge_endpoints(&(eix1[decimation_mode].ep), &(eix2[decimation_mode].ep), separate_component, &epm); + + float4 rgbs_colors[4]; + float4 rgbo_colors[4]; + float2 lum_intervals[4]; + + int l; + for (l = 0; l < max_refinement_iters; l++) + { + recompute_ideal_colors(xdim, ydim, zdim, weight_quantization_mode, &epm, rgbs_colors, rgbo_colors, lum_intervals, u8_weight1_src, u8_weight2_src, separate_component, pi, it, blk, ewb); + + // store the colors for the block + for (j = 0; j < partition_count; j++) + { + scb->color_formats[j] = pack_color_endpoints(decode_mode, + epm.endpt0[j], + epm.endpt1[j], + rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], scb->color_values[j], color_quantization_level[i]); + } + scb->color_formats_matched = 0; + + if ((partition_count >= 2 && scb->color_formats[0] == scb->color_formats[1] + && color_quantization_level != color_quantization_level_mod) + && (partition_count == 2 || (scb->color_formats[0] == scb->color_formats[2] && (partition_count == 3 || (scb->color_formats[0] == scb->color_formats[3]))))) + { + int colorvals[4][12]; + int color_formats_mod[4]; + for (j = 0; j < partition_count; j++) + { + color_formats_mod[j] = pack_color_endpoints(decode_mode, + epm.endpt0[j], + epm.endpt1[j], + rgbs_colors[j], rgbo_colors[j], lum_intervals[j], partition_format_specifiers[i][j], colorvals[j], color_quantization_level_mod[i]); + } + if (color_formats_mod[0] == color_formats_mod[1] + && (partition_count == 2 || (color_formats_mod[0] == color_formats_mod[2] && (partition_count == 3 || (color_formats_mod[0] == color_formats_mod[3]))))) + { + scb->color_formats_matched = 1; + for (j = 0; j < 4; j++) + for (k = 0; k < 12; k++) + scb->color_values[j][k] = colorvals[j][k]; + for (j = 0; j < 4; j++) + scb->color_formats[j] = color_formats_mod[j]; + } + } + + + // store header fields + scb->partition_count = partition_count; + scb->partition_index = partition_index; + scb->color_quantization_level = scb->color_formats_matched ? color_quantization_level_mod[i] : color_quantization_level[i]; + scb->block_mode = quantized_weight[i]; + scb->plane2_color_component = separate_component; + scb->error_block = 0; + + if (scb->color_quantization_level < 4) + { + scb->error_block = 1; // should never happen, but cannot prove it impossible + } + + int adjustments = realign_weights(decode_mode, + xdim, ydim, zdim, + blk, ewb, scb, + u8_weight1_src, + u8_weight2_src); + + if (adjustments == 0) + break; + } + + for (j = 0; j < weights_to_copy; j++) + { + scb->plane1_weights[j] = u8_weight1_src[j]; + scb->plane2_weights[j] = u8_weight2_src[j]; + } + + scb++; + } + +} + + + + + +void expand_block_artifact_suppression(int xdim, int ydim, int zdim, error_weighting_params * ewp) +{ + int x, y, z; + float centerpos_x = (xdim - 1) * 0.5f; + float centerpos_y = (ydim - 1) * 0.5f; + float centerpos_z = (zdim - 1) * 0.5f; + float *bef = ewp->block_artifact_suppression_expanded; + + for (z = 0; z < zdim; z++) + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + float xdif = (x - centerpos_x) / xdim; + float ydif = (y - centerpos_y) / ydim; + float zdif = (z - centerpos_z) / zdim; + + float wdif = 0.36f; + float dist = sqrt(xdif * xdif + ydif * ydif + zdif * zdif + wdif * wdif); + *bef = pow(dist, ewp->block_artifact_suppression); + bef++; + } +} + + + +// Function to set error weights for each color component for each texel in a block. +// Returns the sum of all the error values set. + +float prepare_error_weight_block(const astc_codec_image * input_image, + int xdim, int ydim, int zdim, const error_weighting_params * ewp, const imageblock * blk, error_weight_block * ewb, error_weight_block_orig * ewbo) +{ + + int x, y, z; + int idx = 0; + + int any_mean_stdev_weight = + ewp->rgb_base_weight != 1.0 || ewp->alpha_base_weight != 1.0 || ewp->rgb_mean_weight != 0.0 || ewp->rgb_stdev_weight != 0.0 || ewp->alpha_mean_weight != 0.0 || ewp->alpha_stdev_weight != 0.0; + + float4 color_weights = float4(ewp->rgba_weights[0], + ewp->rgba_weights[1], + ewp->rgba_weights[2], + ewp->rgba_weights[3]); + + ewb->contains_zeroweight_texels = 0; + + for (z = 0; z < zdim; z++) + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + int xpos = x + blk->xpos; + int ypos = y + blk->ypos; + int zpos = z + blk->zpos; + + if (xpos >= input_image->xsize || ypos >= input_image->ysize || zpos >= input_image->zsize) + { + float4 weights = float4(1e-11f, 1e-11f, 1e-11f, 1e-11f); + ewb->error_weights[idx] = weights; + ewb->contains_zeroweight_texels = 1; + } + else + { + float4 error_weight = float4(ewp->rgb_base_weight, + ewp->rgb_base_weight, + ewp->rgb_base_weight, + ewp->alpha_base_weight); + + if (any_mean_stdev_weight) + { + float4 avg = input_averages[zpos][ypos][xpos]; + if (avg.x < 6e-5f) + avg.x = 6e-5f; + if (avg.y < 6e-5f) + avg.y = 6e-5f; + if (avg.z < 6e-5f) + avg.z = 6e-5f; + if (avg.w < 6e-5f) + avg.w = 6e-5f; + /* + printf("avg: %f %f %f %f\n", avg.x, avg.y, avg.z, avg.w ); */ + avg = avg * avg; + + float4 variance = input_variances[zpos][ypos][xpos]; + variance = variance * variance; + + float favg = (avg.x + avg.y + avg.z) * (1.0f / 3.0f); + float fvar = (variance.x + variance.y + variance.z) * (1.0f / 3.0f); + + float mixing = ewp->rgb_mean_and_stdev_mixing; + avg.xyz = float3(favg, favg, favg) * mixing + avg.xyz * (1.0f - mixing); + variance.xyz = float3(fvar, fvar, fvar) * mixing + variance.xyz * (1.0f - mixing); + + float4 stdev = float4(sqrt(MAX(variance.x, 0.0f)), + sqrt(MAX(variance.y, 0.0f)), + sqrt(MAX(variance.z, 0.0f)), + sqrt(MAX(variance.w, 0.0f))); + + avg.xyz = avg.xyz * ewp->rgb_mean_weight; + avg.w = avg.w * ewp->alpha_mean_weight; + stdev.xyz = stdev.xyz * ewp->rgb_stdev_weight; + stdev.w = stdev.w * ewp->alpha_stdev_weight; + error_weight = error_weight + avg + stdev; + + error_weight = float4(1.0f, 1.0f, 1.0f, 1.0f) / error_weight; + } + + if (ewp->ra_normal_angular_scale) + { + float x = (blk->orig_data[4 * idx] - 0.5f) * 2.0f; + float y = (blk->orig_data[4 * idx + 3] - 0.5f) * 2.0f; + float denom = 1.0f - x * x - y * y; + if (denom < 0.1f) + denom = 0.1f; + denom = 1.0f / denom; + error_weight.x *= 1.0f + x * x * denom; + error_weight.w *= 1.0f + y * y * denom; + } + + if (ewp->enable_rgb_scale_with_alpha) + { + float alpha_scale; + if (ewp->alpha_radius != 0) + alpha_scale = input_alpha_averages[zpos][ypos][xpos]; + else + alpha_scale = blk->orig_data[4 * idx + 3]; + if (alpha_scale < 0.0001f) + alpha_scale = 0.0001f; + alpha_scale *= alpha_scale; + error_weight.xyz = error_weight.xyz * alpha_scale; + } + error_weight = error_weight * color_weights; + error_weight = error_weight * ewp->block_artifact_suppression_expanded[idx]; + + // if we perform a conversion from linear to sRGB, then we multiply + // the weight with the derivative of the linear->sRGB transform function. + if (perform_srgb_transform) + { + float r = blk->orig_data[4 * idx]; + float g = blk->orig_data[4 * idx + 1]; + float b = blk->orig_data[4 * idx + 2]; + if (r < 0.0031308f) + r = 12.92f; + else + r = 0.4396f * pow(r, -0.58333f); + if (g < 0.0031308f) + g = 12.92f; + else + g = 0.4396f * pow(g, -0.58333f); + if (b < 0.0031308f) + b = 12.92f; + else + b = 0.4396f * pow(b, -0.58333f); + error_weight.x *= r; + error_weight.y *= g; + error_weight.z *= b; + } + + /* + printf("%f %f %f %f\n", error_weight.x, error_weight.y, error_weight.z, error_weight.w ); + */ + + // when we loaded the block to begin with, we applied a transfer function + // and computed the derivative of the transfer function. However, the + // error-weight computation so far is based on the original color values, + // not the transfer-function values. As such, we must multiply the + // error weights by the derivative of the inverse of the transfer function, + // which is equivalent to dividing by the derivative of the transfer + // function. + + ewbo->error_weights[idx] = error_weight; + + error_weight.x /= (blk->deriv_data[4 * idx] * blk->deriv_data[4 * idx] * 1e-10f); + error_weight.y /= (blk->deriv_data[4 * idx + 1] * blk->deriv_data[4 * idx + 1] * 1e-10f); + error_weight.z /= (blk->deriv_data[4 * idx + 2] * blk->deriv_data[4 * idx + 2] * 1e-10f); + error_weight.w /= (blk->deriv_data[4 * idx + 3] * blk->deriv_data[4 * idx + 3] * 1e-10f); + + /* + printf("--> %f %f %f %f\n", error_weight.x, error_weight.y, error_weight.z, error_weight.w ); + */ + + ewb->error_weights[idx] = error_weight; + if (dot(error_weight, float4(1, 1, 1, 1)) < 1e-10f) + ewb->contains_zeroweight_texels = 1; + } + idx++; + } + + int i; + + float4 error_weight_sum = float4(0, 0, 0, 0); + int texels_per_block = xdim * ydim * zdim; + + for (i = 0; i < texels_per_block; i++) + { + error_weight_sum = error_weight_sum + ewb->error_weights[i]; + + ewb->texel_weight_r[i] = ewb->error_weights[i].x; + ewb->texel_weight_g[i] = ewb->error_weights[i].y; + ewb->texel_weight_b[i] = ewb->error_weights[i].z; + ewb->texel_weight_a[i] = ewb->error_weights[i].w; + + ewb->texel_weight_rg[i] = (ewb->error_weights[i].x + ewb->error_weights[i].y) * 0.5f; + ewb->texel_weight_rb[i] = (ewb->error_weights[i].x + ewb->error_weights[i].z) * 0.5f; + ewb->texel_weight_gb[i] = (ewb->error_weights[i].y + ewb->error_weights[i].z) * 0.5f; + ewb->texel_weight_ra[i] = (ewb->error_weights[i].x + ewb->error_weights[i].w) * 0.5f; + + ewb->texel_weight_gba[i] = (ewb->error_weights[i].y + ewb->error_weights[i].z + ewb->error_weights[i].w) * 0.333333f; + ewb->texel_weight_rba[i] = (ewb->error_weights[i].x + ewb->error_weights[i].z + ewb->error_weights[i].w) * 0.333333f; + ewb->texel_weight_rga[i] = (ewb->error_weights[i].x + ewb->error_weights[i].y + ewb->error_weights[i].w) * 0.333333f; + ewb->texel_weight_rgb[i] = (ewb->error_weights[i].x + ewb->error_weights[i].y + ewb->error_weights[i].z) * 0.333333f; + ewb->texel_weight[i] = (ewb->error_weights[i].x + ewb->error_weights[i].y + ewb->error_weights[i].z + ewb->error_weights[i].w) * 0.25f; + } + + return dot(error_weight_sum, float4(1, 1, 1, 1)); +} + + +/* + functions to analyze block statistical properties: + * simple properties: * mean * variance + * covariance-matrix correllation coefficients + */ + + +// compute averages and covariance matrices for 4 components +static void compute_covariance_matrix(int xdim, int ydim, int zdim, const imageblock * blk, const error_weight_block * ewb, mat4 * cov_matrix) +{ + int i; + + int texels_per_block = xdim * ydim * zdim; + + float r_sum = 0.0f; + float g_sum = 0.0f; + float b_sum = 0.0f; + float a_sum = 0.0f; + float rr_sum = 0.0f; + float gg_sum = 0.0f; + float bb_sum = 0.0f; + float aa_sum = 0.0f; + float rg_sum = 0.0f; + float rb_sum = 0.0f; + float ra_sum = 0.0f; + float gb_sum = 0.0f; + float ga_sum = 0.0f; + float ba_sum = 0.0f; + + float weight_sum = 0.0f; + + for (i = 0; i < texels_per_block; i++) + { + float weight = ewb->texel_weight[i]; + if (weight < 0.0f) + ASTC_CODEC_INTERNAL_ERROR; + weight_sum += weight; + float r = blk->work_data[4 * i]; + float g = blk->work_data[4 * i + 1]; + float b = blk->work_data[4 * i + 2]; + float a = blk->work_data[4 * i + 3]; + r_sum += r * weight; + rr_sum += r * (r * weight); + rg_sum += g * (r * weight); + rb_sum += b * (r * weight); + ra_sum += a * (r * weight); + g_sum += g * weight; + gg_sum += g * (g * weight); + gb_sum += b * (g * weight); + ga_sum += a * (g * weight); + b_sum += b * weight; + bb_sum += b * (b * weight); + ba_sum += a * (b * weight); + a_sum += a * weight; + aa_sum += a * (a * weight); + } + + float rpt = 1.0f / MAX(weight_sum, 1e-7f); + float rs = r_sum; + float gs = g_sum; + float bs = b_sum; + float as = a_sum; + + cov_matrix->v[0] = float4(rr_sum - rs * rs * rpt, rg_sum - rs * gs * rpt, rb_sum - rs * bs * rpt, ra_sum - rs * as * rpt); + cov_matrix->v[1] = float4(rg_sum - rs * gs * rpt, gg_sum - gs * gs * rpt, gb_sum - gs * bs * rpt, ga_sum - gs * as * rpt); + cov_matrix->v[2] = float4(rb_sum - rs * bs * rpt, gb_sum - gs * bs * rpt, bb_sum - bs * bs * rpt, ba_sum - bs * as * rpt); + cov_matrix->v[3] = float4(ra_sum - rs * as * rpt, ga_sum - gs * as * rpt, ba_sum - bs * as * rpt, aa_sum - as * as * rpt); + +} + + + +void prepare_block_statistics(int xdim, int ydim, int zdim, const imageblock * blk, const error_weight_block * ewb, int *is_normal_map, float *lowest_correl) +{ + int i; + + mat4 cov_matrix; + + compute_covariance_matrix(xdim, ydim, zdim, blk, ewb, &cov_matrix); + + // use the covariance matrix to compute + // correllation coefficients + float rr_var = cov_matrix.v[0].x; + float gg_var = cov_matrix.v[1].y; + float bb_var = cov_matrix.v[2].z; + float aa_var = cov_matrix.v[3].w; + + float rg_correlation = cov_matrix.v[0].y / sqrt(MAX(rr_var * gg_var, 1e-30f)); + float rb_correlation = cov_matrix.v[0].z / sqrt(MAX(rr_var * bb_var, 1e-30f)); + float ra_correlation = cov_matrix.v[0].w / sqrt(MAX(rr_var * aa_var, 1e-30f)); + float gb_correlation = cov_matrix.v[1].z / sqrt(MAX(gg_var * bb_var, 1e-30f)); + float ga_correlation = cov_matrix.v[1].w / sqrt(MAX(gg_var * aa_var, 1e-30f)); + float ba_correlation = cov_matrix.v[2].w / sqrt(MAX(bb_var * aa_var, 1e-30f)); + + if (astc_isnan(rg_correlation)) + rg_correlation = 1.0f; + if (astc_isnan(rb_correlation)) + rb_correlation = 1.0f; + if (astc_isnan(ra_correlation)) + ra_correlation = 1.0f; + if (astc_isnan(gb_correlation)) + gb_correlation = 1.0f; + if (astc_isnan(ga_correlation)) + ga_correlation = 1.0f; + if (astc_isnan(ba_correlation)) + ba_correlation = 1.0f; + + float lowest_correlation = MIN(fabs(rg_correlation), fabs(rb_correlation)); + lowest_correlation = MIN(lowest_correlation, fabs(ra_correlation)); + lowest_correlation = MIN(lowest_correlation, fabs(gb_correlation)); + lowest_correlation = MIN(lowest_correlation, fabs(ga_correlation)); + lowest_correlation = MIN(lowest_correlation, fabs(ba_correlation)); + *lowest_correl = lowest_correlation; + + // compute a "normal-map" factor + // this factor should be exactly 0.0 for a normal map, while it may be all over the + // place for anything that is NOT a normal map. We can probably assume that a factor + // of less than 0.2f represents a normal map. + + float nf_sum = 0.0f; + + int texels_per_block = xdim * ydim * zdim; + + for (i = 0; i < texels_per_block; i++) + { + float3 val = float3(blk->orig_data[4 * i], + blk->orig_data[4 * i + 1], + blk->orig_data[4 * i + 2]); + val = (val - float3(0.5f, 0.5f, 0.5f)) * 2.0f; + float length_squared = dot(val, val); + float nf = fabs(length_squared - 1.0f); + nf_sum += nf; + } + float nf_avg = nf_sum / texels_per_block; + *is_normal_map = nf_avg < 0.2; +} + + + + + +void compress_constant_color_block(int xdim, int ydim, int zdim, const imageblock * blk, const error_weight_block * ewb, symbolic_compressed_block * scb) +{ + int texel_count = xdim * ydim * zdim; + int i; + + float4 color_sum = float4(0, 0, 0, 0); + float4 color_weight_sum = float4(0, 0, 0, 0); + + const float *clp = blk->work_data; + for (i = 0; i < texel_count; i++) + { + float4 weights = ewb->error_weights[i]; + float4 color_data = float4(clp[4 * i], clp[4 * i + 1], clp[4 * i + 2], clp[4 * i + 3]); + color_sum = color_sum + (color_data * weights); + color_weight_sum = color_weight_sum + weights; + } + + float4 avg_color = color_sum / color_weight_sum; + + int use_fp16 = blk->rgb_lns[0]; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Averaged color: %f %f %f %f\n", avg_color.x, avg_color.y, avg_color.z, avg_color.w); + } + #endif + + // convert the color + if (blk->rgb_lns[0]) + { + int avg_red = static_cast < int >(floor(avg_color.x + 0.5f)); + int avg_green = static_cast < int >(floor(avg_color.y + 0.5f)); + int avg_blue = static_cast < int >(floor(avg_color.z + 0.5f)); + + if (avg_red < 0) + avg_red = 0; + else if (avg_red > 65535) + avg_red = 65535; + + if (avg_green < 0) + avg_green = 0; + else if (avg_green > 65535) + avg_green = 65535; + + if (avg_blue < 0) + avg_blue = 0; + else if (avg_blue > 65535) + avg_blue = 65535; + + avg_color.x = sf16_to_float(lns_to_sf16(avg_red)); + avg_color.y = sf16_to_float(lns_to_sf16(avg_green)); + avg_color.z = sf16_to_float(lns_to_sf16(avg_blue)); + } + else + { + avg_color.x *= (1.0f / 65535.0f); + avg_color.y *= (1.0f / 65535.0f); + avg_color.z *= (1.0f / 65535.0f); + } + if (blk->alpha_lns[0]) + { + int avg_alpha = static_cast < int >(floor(avg_color.w + 0.5f)); + + if (avg_alpha < 0) + avg_alpha = 0; + else if (avg_alpha > 65535) + avg_alpha = 65535; + + avg_color.w = sf16_to_float(lns_to_sf16(avg_alpha)); + } + else + { + avg_color.w *= (1.0f / 65535.0f); + } + +#ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Averaged color: %f %f %f %f (%d)\n", avg_color.x, avg_color.y, avg_color.z, avg_color.w, use_fp16); + + } +#endif + + if (use_fp16) + { + scb->error_block = 0; + scb->block_mode = -1; + scb->partition_count = 0; + scb->constant_color[0] = float_to_sf16(avg_color.x, SF_NEARESTEVEN); + scb->constant_color[1] = float_to_sf16(avg_color.y, SF_NEARESTEVEN); + scb->constant_color[2] = float_to_sf16(avg_color.z, SF_NEARESTEVEN); + scb->constant_color[3] = float_to_sf16(avg_color.w, SF_NEARESTEVEN); + } + + else + { + scb->error_block = 0; + scb->block_mode = -2; + scb->partition_count = 0; + float red = avg_color.x; + float green = avg_color.y; + float blue = avg_color.z; + float alpha = avg_color.w; + if (red < 0) + red = 0; + else if (red > 1) + red = 1; + if (green < 0) + green = 0; + else if (green > 1) + green = 1; + if (blue < 0) + blue = 0; + else if (blue > 1) + blue = 1; + if (alpha < 0) + alpha = 0; + else if (alpha > 1) + alpha = 1; + scb->constant_color[0] = static_cast < int >(floor(red * 65535.0f + 0.5f)); + scb->constant_color[1] = static_cast < int >(floor(green * 65535.0f + 0.5f)); + scb->constant_color[2] = static_cast < int >(floor(blue * 65535.0f + 0.5f)); + scb->constant_color[3] = static_cast < int >(floor(alpha * 65535.0f + 0.5f)); + } +} + +int block_mode_histogram[2048]; + +float compress_symbolic_block(const astc_codec_image * input_image, + astc_decode_mode decode_mode, int xdim, int ydim, int zdim, const error_weighting_params * ewp, const imageblock * blk, symbolic_compressed_block * scb, + compress_symbolic_block_buffers * tmpbuf) +{ + int i, j; + int xpos = blk->xpos; + int ypos = blk->ypos; + int zpos = blk->zpos; + + int x, y, z; + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Diagnostics of block of dimension %d x %d x %d\n\n", xdim, ydim, zdim); + + printf("XPos: %d YPos: %d ZPos: %d\n", xpos, ypos, zpos); + + printf("Red-min: %f Red-max: %f\n", blk->red_min, blk->red_max); + printf("Green-min: %f Green-max: %f\n", blk->green_min, blk->green_max); + printf("Blue-min: %f Blue-max: %f\n", blk->blue_min, blk->blue_max); + printf("Alpha-min: %f Alpha-max: %f\n", blk->alpha_min, blk->alpha_max); + printf("Grayscale: %d\n", blk->grayscale); + + for (z = 0; z < zdim; z++) + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + int idx = ((z * ydim + y) * xdim + x) * 4; + printf("Texel (%d %d %d) : orig=< %g, %g, %g, %g >, work=< %g, %g, %g, %g >\n", + x, y, z, + blk->orig_data[idx], + blk->orig_data[idx + 1], blk->orig_data[idx + 2], blk->orig_data[idx + 3], blk->work_data[idx], blk->work_data[idx + 1], blk->work_data[idx + 2], blk->work_data[idx + 3]); + } + printf("\n"); + } + #endif + + + if (blk->red_min == blk->red_max && blk->green_min == blk->green_max && blk->blue_min == blk->blue_max && blk->alpha_min == blk->alpha_max) + { + + // detected a constant-color block. Encode as FP16 if using HDR + scb->error_block = 0; + + if (rgb_force_use_of_hdr) + { + scb->block_mode = -1; + scb->partition_count = 0; + scb->constant_color[0] = float_to_sf16(blk->orig_data[0], SF_NEARESTEVEN); + scb->constant_color[1] = float_to_sf16(blk->orig_data[1], SF_NEARESTEVEN); + scb->constant_color[2] = float_to_sf16(blk->orig_data[2], SF_NEARESTEVEN); + scb->constant_color[3] = float_to_sf16(blk->orig_data[3], SF_NEARESTEVEN); + } + else + { + // Encode as UNORM16 if NOT using HDR. + scb->block_mode = -2; + scb->partition_count = 0; + float red = blk->orig_data[0]; + float green = blk->orig_data[1]; + float blue = blk->orig_data[2]; + float alpha = blk->orig_data[3]; + if (red < 0) + red = 0; + else if (red > 1) + red = 1; + if (green < 0) + green = 0; + else if (green > 1) + green = 1; + if (blue < 0) + blue = 0; + else if (blue > 1) + blue = 1; + if (alpha < 0) + alpha = 0; + else if (alpha > 1) + alpha = 1; + scb->constant_color[0] = (int)floor(red * 65535.0f + 0.5f); + scb->constant_color[1] = (int)floor(green * 65535.0f + 0.5f); + scb->constant_color[2] = (int)floor(blue * 65535.0f + 0.5f); + scb->constant_color[3] = (int)floor(alpha * 65535.0f + 0.5f); + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Block is single-color <%4.4X %4.4X %4.4X %4.4X>\n", scb->constant_color[0], scb->constant_color[1], scb->constant_color[2], scb->constant_color[3]); + } + #endif + + if (print_tile_errors) + printf("0\n"); + + physical_compressed_block psb = symbolic_to_physical(xdim, ydim, zdim, scb); + physical_to_symbolic(xdim, ydim, zdim, psb, scb); + + return 0.0f; + } + + error_weight_block *ewb = tmpbuf->ewb; + error_weight_block_orig *ewbo = tmpbuf->ewbo; + + float error_weight_sum = prepare_error_weight_block(input_image, + xdim, ydim, zdim, + ewp, blk, ewb, ewbo); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("\n"); + for (z = 0; z < zdim; z++) + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + int idx = (z * ydim + y) * xdim + x; + printf("ErrorWeight (%d %d %d) : < %g, %g, %g, %g >\n", x, y, z, ewb->error_weights[idx].x, ewb->error_weights[idx].y, ewb->error_weights[idx].z, ewb->error_weights[idx].w); + } + printf("\n"); + } + #endif + + symbolic_compressed_block *tempblocks = tmpbuf->tempblocks; + + float error_of_best_block = 1e20f; + // int modesel=0; + + imageblock *temp = tmpbuf->temp; + + float best_errorvals_in_modes[17]; + for (i = 0; i < 17; i++) + best_errorvals_in_modes[i] = 1e30f; + + int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk); + + + // compression of average-color blocks disabled for the time being; + // they produce extremely severe block artifacts. +#if 0 + // first, compress an averaged-color block + compress_constant_color_block(xdim, ydim, zdim, blk, ewb, scb); + + decompress_symbolic_block(decode_mode, xdim, ydim, zdim, xpos, ypos, zpos, scb, temp); + + float avgblock_errorval = compute_imageblock_difference(xdim, ydim, zdim, + blk, temp, ewb) * 4.0f; // bias somewhat against the average-color block. + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("\n-----------------------------------\n"); + printf("Average-color block test completed\n"); + printf("Resulting error value: %g\n", avgblock_errorval); + } + #endif + + + if (avgblock_errorval < error_of_best_block) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Accepted as better than previous-best-error, which was %g\n", error_of_best_block); + #endif + + error_of_best_block = avgblock_errorval; + // *scb = tempblocks[j]; + modesel = 0; + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("-----------------------------------\n"); + } + #endif +#endif + + + float mode_cutoff = ewp->block_mode_cutoff; + + // next, test mode #0. This mode uses 1 plane of weights and 1 partition. + // we test it twice, first with a modecutoff of 0, then with the specified mode-cutoff. + // This causes an early-out that speeds up encoding of "easy" content. + + float modecutoffs[2]; + float errorval_mult[2] = { 2.5, 1 }; + modecutoffs[0] = 0; + modecutoffs[1] = mode_cutoff; + + #if 0 + if ((error_of_best_block / error_weight_sum) < ewp->texel_avg_error_limit) + goto END_OF_TESTS; + #endif + + float best_errorval_in_mode; + for (i = 0; i < 2; i++) + { + compress_symbolic_block_fixed_partition_1_plane(decode_mode, modecutoffs[i], ewp->max_refinement_iters, xdim, ydim, zdim, 1, // partition count + 0, // partition index + blk, ewb, tempblocks, tmpbuf->plane1); + + best_errorval_in_mode = 1e30f; + for (j = 0; j < 4; j++) + { + if (tempblocks[j].error_block) + continue; + decompress_symbolic_block(decode_mode, xdim, ydim, zdim, xpos, ypos, zpos, tempblocks + j, temp); + float errorval = compute_imageblock_difference(xdim, ydim, zdim, + blk, temp, ewb) * errorval_mult[i]; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("\n-----------------------------------\n"); + printf("Single-weight partition test 0 (1 partition) completed\n"); + printf("Resulting error value: %g\n", errorval); + } + #endif + + if (errorval < best_errorval_in_mode) + best_errorval_in_mode = errorval; + + if (errorval < error_of_best_block) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Accepted as better than previous-best-error, which was %g\n", error_of_best_block); + #endif + + error_of_best_block = errorval; + *scb = tempblocks[j]; + + // modesel = 0; + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("-----------------------------------\n"); + } + #endif + } + + best_errorvals_in_modes[0] = best_errorval_in_mode; + if ((error_of_best_block / error_weight_sum) < ewp->texel_avg_error_limit) + goto END_OF_TESTS; + } + + int is_normal_map; + float lowest_correl; + prepare_block_statistics(xdim, ydim, zdim, blk, ewb, &is_normal_map, &lowest_correl); + + if (is_normal_map && lowest_correl < 0.99f) + lowest_correl = 0.99f; + + // next, test the four possible 1-partition, 2-planes modes + for (i = 0; i < 4; i++) + { + + if (lowest_correl > ewp->lowest_correlation_cutoff) + continue; + + if (blk->grayscale && i != 3) + continue; + + if (!uses_alpha && i == 3) + continue; + + compress_symbolic_block_fixed_partition_2_planes(decode_mode, mode_cutoff, ewp->max_refinement_iters, xdim, ydim, zdim, 1, // partition count + 0, // partition index + i, // the color component to test a separate plane of weights for. + blk, ewb, tempblocks, tmpbuf->planes2); + + best_errorval_in_mode = 1e30f; + for (j = 0; j < 4; j++) + { + if (tempblocks[j].error_block) + continue; + decompress_symbolic_block(decode_mode, xdim, ydim, zdim, xpos, ypos, zpos, tempblocks + j, temp); + float errorval = compute_imageblock_difference(xdim, ydim, zdim, + blk, temp, ewb); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("\n-----------------------------------\n"); + printf("Dual-weight partition test %d (1 partition) completed\n", i); + printf("Resulting error value: %g\n", errorval); + } + #endif + + if (errorval < best_errorval_in_mode) + best_errorval_in_mode = errorval; + + if (errorval < error_of_best_block) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Accepted as better than previous-best-error, which was %g\n", error_of_best_block); + #endif + + error_of_best_block = errorval; + *scb = tempblocks[j]; + + // modesel = i+1; + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("-----------------------------------\n"); + } + #endif + + best_errorvals_in_modes[i + 1] = best_errorval_in_mode; + } + + if ((error_of_best_block / error_weight_sum) < ewp->texel_avg_error_limit) + goto END_OF_TESTS; + } + + // find best blocks for 2, 3 and 4 partitions + int partition_count; + for (partition_count = 2; partition_count <= 4; partition_count++) + { + int partition_indices_1plane[2]; + int partition_indices_2planes[2]; + + find_best_partitionings(ewp->partition_search_limit, + xdim, ydim, zdim, partition_count, blk, ewb, 1, + &(partition_indices_1plane[0]), &(partition_indices_1plane[1]), &(partition_indices_2planes[0])); + + for (i = 0; i < 2; i++) + { + compress_symbolic_block_fixed_partition_1_plane(decode_mode, mode_cutoff, ewp->max_refinement_iters, xdim, ydim, zdim, partition_count, partition_indices_1plane[i], blk, ewb, tempblocks, tmpbuf->plane1); + + best_errorval_in_mode = 1e30f; + for (j = 0; j < 4; j++) + { + if (tempblocks[j].error_block) + continue; + decompress_symbolic_block(decode_mode, xdim, ydim, zdim, xpos, ypos, zpos, tempblocks + j, temp); + float errorval = compute_imageblock_difference(xdim, ydim, zdim, + blk, temp, ewb); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("\n-----------------------------------\n"); + printf("Single-weight partition test %d (%d partitions) completed\n", i, partition_count); + printf("Resulting error value: %g\n", errorval); + } + #endif + + if (errorval < best_errorval_in_mode) + best_errorval_in_mode = errorval; + + if (errorval < error_of_best_block) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Accepted as better than previous-best-error, which was %g\n", error_of_best_block); + #endif + + error_of_best_block = errorval; + *scb = tempblocks[j]; + + // modesel = 4*(partition_count-2) + 5 + i; + } + } + + best_errorvals_in_modes[4 * (partition_count - 2) + 5 + i] = best_errorval_in_mode; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("-----------------------------------\n"); + } + #endif + + if ((error_of_best_block / error_weight_sum) < ewp->texel_avg_error_limit) + goto END_OF_TESTS; + } + + + if (partition_count == 2 && !is_normal_map && MIN(best_errorvals_in_modes[5], best_errorvals_in_modes[6]) > (best_errorvals_in_modes[0] * ewp->partition_1_to_2_limit)) + goto END_OF_TESTS; + + // don't bother to check 4 partitions for dual plane of weightss, ever. + if (partition_count == 4) + break; + + for (i = 0; i < 2; i++) + { + if (lowest_correl > ewp->lowest_correlation_cutoff) + continue; + compress_symbolic_block_fixed_partition_2_planes(decode_mode, + mode_cutoff, + ewp->max_refinement_iters, + xdim, ydim, zdim, + partition_count, + partition_indices_2planes[i] & (PARTITION_COUNT - 1), partition_indices_2planes[i] >> PARTITION_BITS, + blk, ewb, tempblocks, tmpbuf->planes2); + + best_errorval_in_mode = 1e30f; + for (j = 0; j < 4; j++) + { + if (tempblocks[j].error_block) + continue; + decompress_symbolic_block(decode_mode, xdim, ydim, zdim, xpos, ypos, zpos, tempblocks + j, temp); + + float errorval = compute_imageblock_difference(xdim, ydim, zdim, + blk, temp, ewb); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("\n-----------------------------------\n"); + printf("Dual-weight partition test %d (%d partitions) completed\n", i, partition_count); + printf("Resulting error value: %g\n", errorval); + } + #endif + + if (errorval < best_errorval_in_mode) + best_errorval_in_mode = errorval; + + if (errorval < error_of_best_block) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Accepted as better than previous-best-error, which was %g\n", error_of_best_block); + #endif + + error_of_best_block = errorval; + *scb = tempblocks[j]; + + // modesel = 4*(partition_count-2) + 5 + 2 + i; + } + } + + best_errorvals_in_modes[4 * (partition_count - 2) + 5 + 2 + i] = best_errorval_in_mode; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("-----------------------------------\n"); + } + #endif + + if ((error_of_best_block / error_weight_sum) < ewp->texel_avg_error_limit) + goto END_OF_TESTS; + } + } + + END_OF_TESTS: + + #if 0 + if (print_statistics) + { + for (i = 0; i < 13; i++) + printf("%f ", best_errorvals_in_modes[i]); + + printf("%d %f %f %f ", modesel, error_of_best_block, + MIN(best_errorvals_in_modes[1], best_errorvals_in_modes[2]) / best_errorvals_in_modes[0], + MIN(MIN(best_errorvals_in_modes[7], best_errorvals_in_modes[8]), best_errorvals_in_modes[9]) / best_errorvals_in_modes[0]); + + printf("\n"); + } + #endif + + if (scb->block_mode >= 0) + block_mode_histogram[scb->block_mode & 0x7ff]++; + + + // compress/decompress to a physical block + physical_compressed_block psb = symbolic_to_physical(xdim, ydim, zdim, scb); + physical_to_symbolic(xdim, ydim, zdim, psb, scb); + + + if (print_tile_errors) + printf("%g\n", error_of_best_block); + + + // mean squared error per color component. + return error_of_best_block / ((float)xdim * ydim * zdim); +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_compute_variance.cpp b/3rdparty/bimg/3rdparty/astc/astc_compute_variance.cpp new file mode 100644 index 00000000000..782bd1dd021 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_compute_variance.cpp @@ -0,0 +1,524 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief ASTC functions to calculate, for each pixel and each color component, + * its variance within an NxN footprint; we want N to be parametric. + * + * The routine below uses summed area tables in order to perform the + * computation in O(1) time per pixel, independent of big N is. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +#include +#include "mathlib.h" +#include "softfloat.h" + +float4 *** input_averages; +float *** input_alpha_averages; +float4 *** input_variances; + +#include + +// routine to compute averages and variances for a pixel region. +// The routine computes both in a single pass, using a summed-area table +// to decouple the running time from the averaging/variance kernel size. + +static void compute_pixel_region_variance(const astc_codec_image * img, float rgb_power_to_use, float alpha_power_to_use, swizzlepattern swz, int use_z_axis, + int source_xoffset,int source_yoffset, int source_zoffset, // position of upper-left pixel in data set + int xsize, int ysize, int zsize, // the size of the region to actually compute averages and variances for. + int avg_var_kernel_radius, int alpha_kernel_radius, + int dest_xoffset, int dest_yoffset, int dest_zoffset) +{ + int x, y, z; + + int kernel_radius = MAX(avg_var_kernel_radius, alpha_kernel_radius); + int kerneldim = 2 * kernel_radius + 1; + + // allocate memory + int xpadsize = xsize + kerneldim; + int ypadsize = ysize + kerneldim; + int zpadsize = zsize + (use_z_axis ? kerneldim : 1); + + double4 ***varbuf1 = new double4 **[zpadsize]; + double4 ***varbuf2 = new double4 **[zpadsize]; + varbuf1[0] = new double4 *[ypadsize * zpadsize]; + varbuf2[0] = new double4 *[ypadsize * zpadsize]; + varbuf1[0][0] = new double4[xpadsize * ypadsize * zpadsize]; + varbuf2[0][0] = new double4[xpadsize * ypadsize * zpadsize]; + + + for (z = 1; z < zpadsize; z++) + { + varbuf1[z] = varbuf1[0] + ypadsize * z; + varbuf2[z] = varbuf2[0] + ypadsize * z; + varbuf1[z][0] = varbuf1[0][0] + xpadsize * ypadsize * z; + varbuf2[z][0] = varbuf2[0][0] + xpadsize * ypadsize * z; + } + + for (z = 0; z < zpadsize; z++) + for (y = 1; y < ypadsize; y++) + { + varbuf1[z][y] = varbuf1[z][0] + xpadsize * y; + varbuf2[z][y] = varbuf2[z][0] + xpadsize * y; + } + + int powers_are_1 = (rgb_power_to_use == 1.0f) && (alpha_power_to_use == 1.0f); + + + // load x and x^2 values into the allocated buffers + if (img->imagedata8) + { + uint8_t data[6]; + data[4] = 0; + data[5] = 255; + + for (z = 0; z < zpadsize - 1; z++) + { + int z_src = z + source_zoffset - (use_z_axis ? kernel_radius : 0); + for (y = 0; y < ypadsize - 1; y++) + { + int y_src = y + source_yoffset - kernel_radius; + for (x = 0; x < xpadsize - 1; x++) + { + int x_src = x + source_xoffset - kernel_radius; + data[0] = img->imagedata8[z_src][y_src][4 * x_src + 0]; + data[1] = img->imagedata8[z_src][y_src][4 * x_src + 1]; + data[2] = img->imagedata8[z_src][y_src][4 * x_src + 2]; + data[3] = img->imagedata8[z_src][y_src][4 * x_src + 3]; + + uint8_t r = data[swz.r]; + uint8_t g = data[swz.g]; + uint8_t b = data[swz.b]; + uint8_t a = data[swz.a]; + + double4 d = double4(r * (1.0 / 255.0), + g * (1.0 / 255.0), + b * (1.0 / 255.0), + a * (1.0 / 255.0)); + + if (perform_srgb_transform) + { + d.x = (d.x <= 0.04045) ? d.x * (1.0 / 12.92) : (d.x <= 1) ? pow((d.x + 0.055) * (1.0 / 1.055), 2.4) : d.x; + d.y = (d.y <= 0.04045) ? d.y * (1.0 / 12.92) : (d.y <= 1) ? pow((d.y + 0.055) * (1.0 / 1.055), 2.4) : d.y; + d.z = (d.z <= 0.04045) ? d.z * (1.0 / 12.92) : (d.z <= 1) ? pow((d.z + 0.055) * (1.0 / 1.055), 2.4) : d.z; + } + + if (!powers_are_1) + { + d.x = pow(MAX(d.x, 1e-6), (double)rgb_power_to_use); + d.y = pow(MAX(d.y, 1e-6), (double)rgb_power_to_use); + d.z = pow(MAX(d.z, 1e-6), (double)rgb_power_to_use); + d.w = pow(MAX(d.w, 1e-6), (double)alpha_power_to_use); + } + + varbuf1[z][y][x] = d; + varbuf2[z][y][x] = d * d; + } + } + } + } + else + { + uint16_t data[6]; + data[4] = 0; + data[5] = 0x3C00; // 1.0 encoded as FP16. + + for (z = 0; z < zpadsize - 1; z++) + { + int z_src = z + source_zoffset - (use_z_axis ? kernel_radius : 0); + for (y = 0; y < ypadsize - 1; y++) + { + int y_src = y + source_yoffset - kernel_radius; + for (x = 0; x < xpadsize - 1; x++) + { + int x_src = x + source_xoffset - kernel_radius; + data[0] = img->imagedata16[z_src][y_src][4 * x_src]; + data[1] = img->imagedata16[z_src][y_src][4 * x_src + 1]; + data[2] = img->imagedata16[z_src][y_src][4 * x_src + 2]; + data[3] = img->imagedata16[z_src][y_src][4 * x_src + 3]; + + uint16_t r = data[swz.r]; + uint16_t g = data[swz.g]; + uint16_t b = data[swz.b]; + uint16_t a = data[swz.a]; + + double4 d = double4(sf16_to_float(r), + sf16_to_float(g), + sf16_to_float(b), + sf16_to_float(a)); + + if (perform_srgb_transform) + { + d.x = (d.x <= 0.04045) ? d.x * (1.0 / 12.92) : (d.x <= 1) ? pow((d.x + 0.055) * (1.0 / 1.055), 2.4) : d.x; + d.y = (d.y <= 0.04045) ? d.y * (1.0 / 12.92) : (d.y <= 1) ? pow((d.y + 0.055) * (1.0 / 1.055), 2.4) : d.y; + d.z = (d.z <= 0.04045) ? d.z * (1.0 / 12.92) : (d.z <= 1) ? pow((d.z + 0.055) * (1.0 / 1.055), 2.4) : d.z; + } + + if (!powers_are_1) + { + d.x = pow(MAX(d.x, 1e-6), (double)rgb_power_to_use); + d.y = pow(MAX(d.y, 1e-6), (double)rgb_power_to_use); + d.z = pow(MAX(d.z, 1e-6), (double)rgb_power_to_use); + d.w = pow(MAX(d.w, 1e-6), (double)alpha_power_to_use); + } + + varbuf1[z][y][x] = d; + varbuf2[z][y][x] = d * d; + } + } + } + } + + + + // pad out buffers with 0s + for (z = 0; z < zpadsize; z++) + { + for (y = 0; y < ypadsize; y++) + { + varbuf1[z][y][xpadsize - 1] = double4(0.0, 0.0, 0.0, 0.0); + varbuf2[z][y][xpadsize - 1] = double4(0.0, 0.0, 0.0, 0.0); + } + for (x = 0; x < xpadsize; x++) + { + varbuf1[z][ypadsize - 1][x] = double4(0.0, 0.0, 0.0, 0.0); + varbuf2[z][ypadsize - 1][x] = double4(0.0, 0.0, 0.0, 0.0); + } + } + + if (use_z_axis) + for (y = 0; y < ypadsize; y++) + for (x = 0; x < xpadsize; x++) + { + varbuf1[zpadsize - 1][y][x] = double4(0.0, 0.0, 0.0, 0.0); + varbuf2[zpadsize - 1][y][x] = double4(0.0, 0.0, 0.0, 0.0); + } + + + // generate summed-area tables for x and x2; this is done in-place + for (z = 0; z < zpadsize; z++) + for (y = 0; y < ypadsize; y++) + { + double4 summa1 = double4(0.0, 0.0, 0.0, 0.0); + double4 summa2 = double4(0.0, 0.0, 0.0, 0.0); + for (x = 0; x < xpadsize; x++) + { + double4 val1 = varbuf1[z][y][x]; + double4 val2 = varbuf2[z][y][x]; + varbuf1[z][y][x] = summa1; + varbuf2[z][y][x] = summa2; + summa1 = summa1 + val1; + summa2 = summa2 + val2; + } + } + + for (z = 0; z < zpadsize; z++) + for (x = 0; x < xpadsize; x++) + { + double4 summa1 = double4(0.0, 0.0, 0.0, 0.0); + double4 summa2 = double4(0.0, 0.0, 0.0, 0.0); + for (y = 0; y < ypadsize; y++) + { + double4 val1 = varbuf1[z][y][x]; + double4 val2 = varbuf2[z][y][x]; + varbuf1[z][y][x] = summa1; + varbuf2[z][y][x] = summa2; + summa1 = summa1 + val1; + summa2 = summa2 + val2; + } + } + + if (use_z_axis) + for (y = 0; y < ypadsize; y++) + for (x = 0; x < xpadsize; x++) + { + double4 summa1 = double4(0.0, 0.0, 0.0, 0.0); + double4 summa2 = double4(0.0, 0.0, 0.0, 0.0); + for (z = 0; z < zpadsize; z++) + { + double4 val1 = varbuf1[z][y][x]; + double4 val2 = varbuf2[z][y][x]; + varbuf1[z][y][x] = summa1; + varbuf2[z][y][x] = summa2; + summa1 = summa1 + val1; + summa2 = summa2 + val2; + } + } + + + int avg_var_kerneldim = 2 * avg_var_kernel_radius + 1; + int alpha_kerneldim = 2 * alpha_kernel_radius + 1; + + + // compute a few constants used in the variance-calculation. + double avg_var_samples; + double alpha_rsamples; + double mul1; + + if (use_z_axis) + { + avg_var_samples = avg_var_kerneldim * avg_var_kerneldim * avg_var_kerneldim; + alpha_rsamples = 1.0 / (alpha_kerneldim * alpha_kerneldim * alpha_kerneldim); + } + else + { + avg_var_samples = avg_var_kerneldim * avg_var_kerneldim; + alpha_rsamples = 1.0 / (alpha_kerneldim * alpha_kerneldim); + } + + + double avg_var_rsamples = 1.0 / avg_var_samples; + if (avg_var_samples == 1) + mul1 = 1.0; + else + mul1 = 1.0 / (avg_var_samples * (avg_var_samples - 1)); + + + double mul2 = avg_var_samples * mul1; + + + // use the summed-area tables to compute variance for each sample-neighborhood + if (use_z_axis) + { + for (z = 0; z < zsize; z++) + { + int z_src = z + kernel_radius; + int z_dst = z + dest_zoffset; + for (y = 0; y < ysize; y++) + { + int y_src = y + kernel_radius; + int y_dst = y + dest_yoffset; + + for (x = 0; x < xsize; x++) + { + int x_src = x + kernel_radius; + int x_dst = x + dest_xoffset; + + // summed-area table lookups for alpha average + double vasum = + (varbuf1[z_src + 1][y_src - alpha_kernel_radius][x_src - alpha_kernel_radius].w + - varbuf1[z_src + 1][y_src - alpha_kernel_radius][x_src + alpha_kernel_radius + 1].w + - varbuf1[z_src + 1][y_src + alpha_kernel_radius + 1][x_src - alpha_kernel_radius].w + + varbuf1[z_src + 1][y_src + alpha_kernel_radius + 1][x_src + alpha_kernel_radius + 1].w) - + (varbuf1[z_src][y_src - alpha_kernel_radius][x_src - alpha_kernel_radius].w + - varbuf1[z_src][y_src - alpha_kernel_radius][x_src + alpha_kernel_radius + 1].w + - varbuf1[z_src][y_src + alpha_kernel_radius + 1][x_src - alpha_kernel_radius].w + varbuf1[z_src][y_src + alpha_kernel_radius + 1][x_src + alpha_kernel_radius + 1].w); + input_alpha_averages[z_dst][y_dst][x_dst] = static_cast < float >(vasum * alpha_rsamples); + + + // summed-area table lookups for RGBA average + double4 v0sum = + (varbuf1[z_src + 1][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf1[z_src + 1][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf1[z_src + 1][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + + varbuf1[z_src + 1][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]) - + (varbuf1[z_src][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf1[z_src][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]); + + double4 avg = v0sum * avg_var_rsamples; + + float4 favg = float4(static_cast < float >(avg.x), + static_cast < float >(avg.y), + static_cast < float >(avg.z), + static_cast < float >(avg.w)); + input_averages[z_dst][y_dst][x_dst] = favg; + + + // summed-area table lookups for variance + double4 v1sum = + (varbuf1[z_src + 1][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf1[z_src + 1][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf1[z_src + 1][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + + varbuf1[z_src + 1][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]) - + (varbuf1[z_src][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf1[z_src][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]); + double4 v2sum = + (varbuf2[z_src + 1][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf2[z_src + 1][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf2[z_src + 1][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + + varbuf2[z_src + 1][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]) - + (varbuf2[z_src][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf2[z_src][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf2[z_src][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + varbuf2[z_src][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]); + + // the actual variance + double4 variance = mul2 * v2sum - mul1 * (v1sum * v1sum); + + float4 fvar = float4(static_cast < float >(variance.x), + static_cast < float >(variance.y), + static_cast < float >(variance.z), + static_cast < float >(variance.w)); + input_variances[z_dst][y_dst][x_dst] = fvar; + } + } + } + } + else + { + for (z = 0; z < zsize; z++) + { + int z_src = z; + int z_dst = z + dest_zoffset; + for (y = 0; y < ysize; y++) + { + int y_src = y + kernel_radius; + int y_dst = y + dest_yoffset; + + for (x = 0; x < xsize; x++) + { + int x_src = x + kernel_radius; + int x_dst = x + dest_xoffset; + + // summed-area table lookups for alpha average + double vasum = + varbuf1[z_src][y_src - alpha_kernel_radius][x_src - alpha_kernel_radius].w + - varbuf1[z_src][y_src - alpha_kernel_radius][x_src + alpha_kernel_radius + 1].w + - varbuf1[z_src][y_src + alpha_kernel_radius + 1][x_src - alpha_kernel_radius].w + varbuf1[z_src][y_src + alpha_kernel_radius + 1][x_src + alpha_kernel_radius + 1].w; + input_alpha_averages[z_dst][y_dst][x_dst] = static_cast < float >(vasum * alpha_rsamples); + + + // summed-area table lookups for RGBA average + double4 v0sum = + varbuf1[z_src][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf1[z_src][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]; + + double4 avg = v0sum * avg_var_rsamples; + + float4 favg = float4(static_cast < float >(avg.x), + static_cast < float >(avg.y), + static_cast < float >(avg.z), + static_cast < float >(avg.w)); + input_averages[z_dst][y_dst][x_dst] = favg; + + + // summed-area table lookups for variance + double4 v1sum = + varbuf1[z_src][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf1[z_src][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + varbuf1[z_src][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]; + double4 v2sum = + varbuf2[z_src][y_src - avg_var_kernel_radius][x_src - avg_var_kernel_radius] + - varbuf2[z_src][y_src - avg_var_kernel_radius][x_src + avg_var_kernel_radius + 1] + - varbuf2[z_src][y_src + avg_var_kernel_radius + 1][x_src - avg_var_kernel_radius] + varbuf2[z_src][y_src + avg_var_kernel_radius + 1][x_src + avg_var_kernel_radius + 1]; + + // the actual variance + double4 variance = mul2 * v2sum - mul1 * (v1sum * v1sum); + + float4 fvar = float4(static_cast < float >(variance.x), + static_cast < float >(variance.y), + static_cast < float >(variance.z), + static_cast < float >(variance.w)); + input_variances[z_dst][y_dst][x_dst] = fvar; + } + } + } + } + delete[]varbuf2[0][0]; + delete[]varbuf1[0][0]; + delete[]varbuf2[0]; + delete[]varbuf1[0]; + delete[]varbuf2; + delete[]varbuf1; +} + + +static void allocate_input_average_and_variance_buffers(int xsize, int ysize, int zsize) +{ + int y, z; + if (input_averages) + { + delete[]input_averages[0][0]; + delete[]input_averages[0]; + delete[]input_averages; + } + if (input_variances) + { + delete[]input_variances[0][0]; + delete[]input_variances[0]; + delete[]input_variances; + } + if (input_alpha_averages) + { + delete[]input_alpha_averages[0][0]; + delete[]input_alpha_averages[0]; + delete[]input_alpha_averages; + } + + input_averages = new float4 **[zsize]; + input_variances = new float4 **[zsize]; + input_alpha_averages = new float **[zsize]; + + + input_averages[0] = new float4 *[ysize * zsize]; + input_variances[0] = new float4 *[ysize * zsize]; + input_alpha_averages[0] = new float *[ysize * zsize]; + + input_averages[0][0] = new float4[xsize * ysize * zsize]; + input_variances[0][0] = new float4[xsize * ysize * zsize]; + input_alpha_averages[0][0] = new float[xsize * ysize * zsize]; + + for (z = 1; z < zsize; z++) + { + input_averages[z] = input_averages[0] + z * ysize; + input_variances[z] = input_variances[0] + z * ysize; + input_alpha_averages[z] = input_alpha_averages[0] + z * ysize; + + input_averages[z][0] = input_averages[0][0] + z * ysize * xsize; + input_variances[z][0] = input_variances[0][0] + z * ysize * xsize; + input_alpha_averages[z][0] = input_alpha_averages[0][0] + z * ysize * xsize; + } + + for (z = 0; z < zsize; z++) + for (y = 1; y < ysize; y++) + { + input_averages[z][y] = input_averages[z][0] + y * xsize; + input_variances[z][y] = input_variances[z][0] + y * xsize; + input_alpha_averages[z][y] = input_alpha_averages[z][0] + y * xsize; + } + +} + + +// compute averages and variances for the current input image. +void compute_averages_and_variances(const astc_codec_image * img, float rgb_power_to_use, float alpha_power_to_use, int avg_var_kernel_radius, int alpha_kernel_radius, swizzlepattern swz) +{ + int xsize = img->xsize; + int ysize = img->ysize; + int zsize = img->zsize; + allocate_input_average_and_variance_buffers(xsize, ysize, zsize); + + + int x, y, z; + for (z = 0; z < zsize; z += 32) + { + int zblocksize = MIN(32, zsize - z); + for (y = 0; y < ysize; y += 32) + { + int yblocksize = MIN(32, ysize - y); + for (x = 0; x < xsize; x += 32) + { + int xblocksize = MIN(32, xsize - x); + compute_pixel_region_variance(img, + rgb_power_to_use, + alpha_power_to_use, + swz, + (zsize > 1), + x + img->padding, + y + img->padding, z + (zsize > 1 ? img->padding : 0), xblocksize, yblocksize, zblocksize, avg_var_kernel_radius, alpha_kernel_radius, x, y, z); + } + } + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_decompress_symbolic.cpp b/3rdparty/bimg/3rdparty/astc/astc_decompress_symbolic.cpp new file mode 100644 index 00000000000..89ff3441b30 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_decompress_symbolic.cpp @@ -0,0 +1,317 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Decompress a block of colors, expressed as a symbolic block, + * for ASTC. + */ +/*----------------------------------------------------------------------------*/ + +#include + +#include "astc_codec_internals.h" + +#include "softfloat.h" +#include + +int compute_value_of_texel_int(int texel_to_get, const decimation_table * it, const int *weights) +{ + int i; + int summed_value = 8; + int weights_to_evaluate = it->texel_num_weights[texel_to_get]; + for (i = 0; i < weights_to_evaluate; i++) + { + summed_value += weights[it->texel_weights[texel_to_get][i]] * it->texel_weights_int[texel_to_get][i]; + } + return summed_value >> 4; +} + + +ushort4 lerp_color_int(astc_decode_mode decode_mode, ushort4 color0, ushort4 color1, int weight, int plane2_weight, int plane2_color_component // -1 in 1-plane mode + ) +{ + int4 ecolor0 = int4(color0.x, color0.y, color0.z, color0.w); + int4 ecolor1 = int4(color1.x, color1.y, color1.z, color1.w); + + int4 eweight1 = int4(weight, weight, weight, weight); + switch (plane2_color_component) + { + case 0: + eweight1.x = plane2_weight; + break; + case 1: + eweight1.y = plane2_weight; + break; + case 2: + eweight1.z = plane2_weight; + break; + case 3: + eweight1.w = plane2_weight; + break; + default: + break; + } + + int4 eweight0 = int4(64, 64, 64, 64) - eweight1; + + if (decode_mode == DECODE_LDR_SRGB) + { + ecolor0 = ecolor0 >> 8; + ecolor1 = ecolor1 >> 8; + } + int4 color = (ecolor0 * eweight0) + (ecolor1 * eweight1) + int4(32, 32, 32, 32); + color = color >> 6; + if (decode_mode == DECODE_LDR_SRGB) + color = color | (color << 8); + + ushort4 rcolor = ushort4(color.x, color.y, color.z, color.w); + return rcolor; +} + + +void decompress_symbolic_block(astc_decode_mode decode_mode, + int xdim, int ydim, int zdim, // dimensions of block + int xpos, int ypos, int zpos, // position of block + const symbolic_compressed_block * scb, imageblock * blk) +{ + blk->xpos = xpos; + blk->ypos = ypos; + blk->zpos = zpos; + + int i; + + // if we detected an error-block, blow up immediately. + if (scb->error_block) + { + if (decode_mode == DECODE_LDR_SRGB) + { + for (i = 0; i < xdim * ydim * zdim; i++) + { + blk->orig_data[4 * i] = 1.0f; + blk->orig_data[4 * i + 1] = 0.0f; + blk->orig_data[4 * i + 2] = 1.0f; + blk->orig_data[4 * i + 3] = 1.0f; + blk->rgb_lns[i] = 0; + blk->alpha_lns[i] = 0; + blk->nan_texel[i] = 0; + } + } + else + { + for (i = 0; i < xdim * ydim * zdim; i++) + { + blk->orig_data[4 * i] = 0.0f; + blk->orig_data[4 * i + 1] = 0.0f; + blk->orig_data[4 * i + 2] = 0.0f; + blk->orig_data[4 * i + 3] = 0.0f; + blk->rgb_lns[i] = 0; + blk->alpha_lns[i] = 0; + blk->nan_texel[i] = 1; + } + } + + imageblock_initialize_work_from_orig(blk, xdim * ydim * zdim); + update_imageblock_flags(blk, xdim, ydim, zdim); + return; + } + + + + + if (scb->block_mode < 0) + { + float red = 0, green = 0, blue = 0, alpha = 0; + int use_lns = 0; + int use_nan = 0; + + if (scb->block_mode == -2) + { + // For sRGB decoding, we should return only the top 8 bits. + int mask = (decode_mode == DECODE_LDR_SRGB) ? 0xFF00 : 0xFFFF; + + red = sf16_to_float(unorm16_to_sf16(scb->constant_color[0] & mask)); + green = sf16_to_float(unorm16_to_sf16(scb->constant_color[1] & mask)); + blue = sf16_to_float(unorm16_to_sf16(scb->constant_color[2] & mask)); + alpha = sf16_to_float(unorm16_to_sf16(scb->constant_color[3] & mask)); + use_lns = 0; + use_nan = 0; + } + else + { + switch (decode_mode) + { + case DECODE_LDR_SRGB: + red = 1.0f; + green = 0.0f; + blue = 1.0f; + alpha = 1.0f; + use_lns = 0; + use_nan = 0; + break; + case DECODE_LDR: + red = 0.0f; + green = 0.0f; + blue = 0.0f; + alpha = 0.0f; + use_lns = 0; + use_nan = 1; + break; + case DECODE_HDR: + // constant-color block; unpack from FP16 to FP32. + red = sf16_to_float(scb->constant_color[0]); + green = sf16_to_float(scb->constant_color[1]); + blue = sf16_to_float(scb->constant_color[2]); + alpha = sf16_to_float(scb->constant_color[3]); + use_lns = 1; + use_nan = 0; + break; + } + } + + for (i = 0; i < xdim * ydim * zdim; i++) + { + blk->orig_data[4 * i] = red; + blk->orig_data[4 * i + 1] = green; + blk->orig_data[4 * i + 2] = blue; + blk->orig_data[4 * i + 3] = alpha; + blk->rgb_lns[i] = use_lns; + blk->alpha_lns[i] = use_lns; + blk->nan_texel[i] = use_nan; + } + + + imageblock_initialize_work_from_orig(blk, xdim * ydim * zdim); + update_imageblock_flags(blk, xdim, ydim, zdim); + return; + } + + + // get the appropriate partition-table entry + int partition_count = scb->partition_count; + const partition_info *pt = get_partition_table(xdim, ydim, zdim, partition_count); + pt += scb->partition_index; + + // get the appropriate block descriptor + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + const decimation_table *const *ixtab2 = bsd->decimation_tables; + + + const decimation_table *it = ixtab2[bsd->block_modes[scb->block_mode].decimation_mode]; + + int is_dual_plane = bsd->block_modes[scb->block_mode].is_dual_plane; + + int weight_quantization_level = bsd->block_modes[scb->block_mode].quantization_mode; + + + // decode the color endpoints + ushort4 color_endpoint0[4]; + ushort4 color_endpoint1[4]; + int rgb_hdr_endpoint[4]; + int alpha_hdr_endpoint[4]; + int nan_endpoint[4]; + + for (i = 0; i < partition_count; i++) + unpack_color_endpoints(decode_mode, + scb->color_formats[i], + scb->color_quantization_level, scb->color_values[i], &(rgb_hdr_endpoint[i]), &(alpha_hdr_endpoint[i]), &(nan_endpoint[i]), &(color_endpoint0[i]), &(color_endpoint1[i])); + + + + + + // first unquantize the weights + int uq_plane1_weights[MAX_WEIGHTS_PER_BLOCK]; + int uq_plane2_weights[MAX_WEIGHTS_PER_BLOCK]; + int weight_count = it->num_weights; + + + const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_level]); + + for (i = 0; i < weight_count; i++) + { + uq_plane1_weights[i] = qat->unquantized_value[scb->plane1_weights[i]]; + } + if (is_dual_plane) + { + for (i = 0; i < weight_count; i++) + uq_plane2_weights[i] = qat->unquantized_value[scb->plane2_weights[i]]; + } + + + // then undecimate them. + int weights[MAX_TEXELS_PER_BLOCK]; + int plane2_weights[MAX_TEXELS_PER_BLOCK]; + + + int texels_per_block = xdim * ydim * zdim; + for (i = 0; i < texels_per_block; i++) + weights[i] = compute_value_of_texel_int(i, it, uq_plane1_weights); + + if (is_dual_plane) + for (i = 0; i < texels_per_block; i++) + plane2_weights[i] = compute_value_of_texel_int(i, it, uq_plane2_weights); + + + int plane2_color_component = scb->plane2_color_component; + + + // now that we have endpoint colors and weights, we can unpack actual colors for + // each texel. + for (i = 0; i < texels_per_block; i++) + { + int partition = pt->partition_of_texel[i]; + + ushort4 color = lerp_color_int(decode_mode, + color_endpoint0[partition], + color_endpoint1[partition], + weights[i], + plane2_weights[i], + is_dual_plane ? plane2_color_component : -1); + + blk->rgb_lns[i] = rgb_hdr_endpoint[partition]; + blk->alpha_lns[i] = alpha_hdr_endpoint[partition]; + blk->nan_texel[i] = nan_endpoint[partition]; + + blk->work_data[4 * i] = color.x; + blk->work_data[4 * i + 1] = color.y; + blk->work_data[4 * i + 2] = color.z; + blk->work_data[4 * i + 3] = color.w; + } + + imageblock_initialize_orig_from_work(blk, xdim * ydim * zdim); + + update_imageblock_flags(blk, xdim, ydim, zdim); +} + + + +float compute_imageblock_difference(int xdim, int ydim, int zdim, const imageblock * p1, const imageblock * p2, const error_weight_block * ewb) +{ + int i; + int texels_per_block = xdim * ydim * zdim; + float summa = 0.0f; + const float *f1 = p1->work_data; + const float *f2 = p2->work_data; + for (i = 0; i < texels_per_block; i++) + { + float rdiff = fabsf(f1[4 * i] - f2[4 * i]); + float gdiff = fabs(f1[4 * i + 1] - f2[4 * i + 1]); + float bdiff = fabs(f1[4 * i + 2] - f2[4 * i + 2]); + float adiff = fabs(f1[4 * i + 3] - f2[4 * i + 3]); + rdiff = MIN(rdiff, 1e15f); + gdiff = MIN(gdiff, 1e15f); + bdiff = MIN(bdiff, 1e15f); + adiff = MIN(adiff, 1e15f); + + summa += rdiff * rdiff * ewb->error_weights[i].x + gdiff * gdiff * ewb->error_weights[i].y + bdiff * bdiff * ewb->error_weights[i].z + adiff * adiff * ewb->error_weights[i].w; + } + + return summa; +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_encoding_choice_error.cpp b/3rdparty/bimg/3rdparty/astc/astc_encoding_choice_error.cpp new file mode 100644 index 00000000000..5da893bb44b --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_encoding_choice_error.cpp @@ -0,0 +1,310 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Determine color errors for ASTC compression. + * + * We assume that there are two independent sources of color error in + * any given partition. + * + * These are: + * * quantization errors + * * encoding choice errors + * + * Encoding choice errors are errors that come due to encoding choice, + * such as: + * * using luminance instead of RGB + * * using RGB-scale instead of two RGB endpoints. + * * dropping Alpha + * + * Quantization errors occur due to the limited precision we use for + * storing numbers. + * + * Quantization errors generally scale with quantization level, but are + * not actually independent of color encoding. In particular: + * * if we can use offset encoding then quantization error is halved. + * * if we can use blue-contraction, quantization error for red and + * green is halved. + * * quantization error is higher for the HDR endpoint modes. + * + * Other than these errors, quantization error is assumed to be + * proportional to the quantization step. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +#include + +#ifdef DEBUG_PRINT_DIAGNOSTICS + #include +#endif + +// helper function to merge two endpoint-colors +void merge_endpoints(const endpoints * ep1, // contains three of the color components + const endpoints * ep2, // contains the remaining color component + int separate_component, endpoints * res) +{ + int i; + int partition_count = ep1->partition_count; + res->partition_count = partition_count; + for (i = 0; i < partition_count; i++) + { + res->endpt0[i] = ep1->endpt0[i]; + res->endpt1[i] = ep1->endpt1[i]; + } + + switch (separate_component) + { + case 0: + for (i = 0; i < partition_count; i++) + { + res->endpt0[i].x = ep2->endpt0[i].x; + res->endpt1[i].x = ep2->endpt1[i].x; + } + break; + case 1: + for (i = 0; i < partition_count; i++) + { + res->endpt0[i].y = ep2->endpt0[i].y; + res->endpt1[i].y = ep2->endpt1[i].y; + } + break; + case 2: + for (i = 0; i < partition_count; i++) + { + res->endpt0[i].z = ep2->endpt0[i].z; + res->endpt1[i].z = ep2->endpt1[i].z; + } + break; + case 3: + for (i = 0; i < partition_count; i++) + { + res->endpt0[i].w = ep2->endpt0[i].w; + res->endpt1[i].w = ep2->endpt1[i].w; + } + break; + } +} + + + +/* + for a given set of input colors and a given partitioning, determine: color error that results + from RGB-scale encoding (relevant for LDR only) color error that results from RGB-lumashift encoding + (relevant for HDR only) color error that results from luminance-encoding color error that results + form dropping alpha. whether we are eligible for offset encoding whether we are eligible for + blue-contraction + + The input data are: color data partitioning error-weight data + */ + + +void compute_encoding_choice_errors(int xdim, int ydim, int zdim, const imageblock * pb, const partition_info * pi, const error_weight_block * ewb, + int separate_component, // component that is separated out in 2-plane mode, -1 in 1-plane mode + encoding_choice_errors * eci) +{ + int i; + + int partition_count = pi->partition_count; + + int texels_per_block = xdim * ydim * zdim; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : texels-per-block=%dx%dx%d, separate_component=%d, partition-count=%d\n", __func__, xdim, ydim, zdim, separate_component, partition_count); + } + #endif + + float3 averages[4]; + float3 directions_rgb[4]; + float2 directions_rg[4]; + float2 directions_rb[4]; + float2 directions_gb[4]; + + float4 error_weightings[4]; + float4 color_scalefactors[4]; + float4 inverse_color_scalefactors[4]; + + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pi, error_weightings, color_scalefactors); + + compute_averages_and_directions_rgb(pi, pb, ewb, color_scalefactors, averages, directions_rgb, directions_rg, directions_rb, directions_gb); + + line3 uncorr_rgb_lines[4]; + line3 samechroma_rgb_lines[4]; // for LDR-RGB-scale + line3 rgb_luma_lines[4]; // for HDR-RGB-scale + line3 luminance_lines[4]; + + processed_line3 proc_uncorr_rgb_lines[4]; + processed_line3 proc_samechroma_rgb_lines[4]; // for LDR-RGB-scale + processed_line3 proc_rgb_luma_lines[4]; // for HDR-RGB-scale + processed_line3 proc_luminance_lines[4]; + + + for (i = 0; i < partition_count; i++) + { + inverse_color_scalefactors[i].x = 1.0f / MAX(color_scalefactors[i].x, 1e-7f); + inverse_color_scalefactors[i].y = 1.0f / MAX(color_scalefactors[i].y, 1e-7f); + inverse_color_scalefactors[i].z = 1.0f / MAX(color_scalefactors[i].z, 1e-7f); + inverse_color_scalefactors[i].w = 1.0f / MAX(color_scalefactors[i].w, 1e-7f); + + + uncorr_rgb_lines[i].a = averages[i]; + if (dot(directions_rgb[i], directions_rgb[i]) == 0.0f) + uncorr_rgb_lines[i].b = normalize(float3(color_scalefactors[i].xyz)); + else + uncorr_rgb_lines[i].b = normalize(directions_rgb[i]); + + samechroma_rgb_lines[i].a = float3(0, 0, 0); + if (dot(averages[i], averages[i]) < 1e-20) + samechroma_rgb_lines[i].b = normalize(float3(color_scalefactors[i].xyz)); + else + samechroma_rgb_lines[i].b = normalize(averages[i]); + + rgb_luma_lines[i].a = averages[i]; + rgb_luma_lines[i].b = normalize(color_scalefactors[i].xyz); + + luminance_lines[i].a = float3(0, 0, 0); + luminance_lines[i].b = normalize(color_scalefactors[i].xyz); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Partition %d\n", i); + printf("Average = <%g %g %g>\n", averages[i].x, averages[i].y, averages[i].z); + printf("Uncorr-rgb-line = <%g %g %g> + t<%g %g %g>\n", + uncorr_rgb_lines[i].a.x, uncorr_rgb_lines[i].a.y, uncorr_rgb_lines[i].a.z, uncorr_rgb_lines[i].b.x, uncorr_rgb_lines[i].b.y, uncorr_rgb_lines[i].b.z); + printf("Samechroma-line = t<%g %g %g>\n", samechroma_rgb_lines[i].b.x, samechroma_rgb_lines[i].b.y, samechroma_rgb_lines[i].b.z); + } + #endif + + proc_uncorr_rgb_lines[i].amod = (uncorr_rgb_lines[i].a - uncorr_rgb_lines[i].b * dot(uncorr_rgb_lines[i].a, uncorr_rgb_lines[i].b)) * inverse_color_scalefactors[i].xyz; + proc_uncorr_rgb_lines[i].bs = uncorr_rgb_lines[i].b * color_scalefactors[i].xyz; + proc_uncorr_rgb_lines[i].bis = uncorr_rgb_lines[i].b * inverse_color_scalefactors[i].xyz; + + proc_samechroma_rgb_lines[i].amod = (samechroma_rgb_lines[i].a - samechroma_rgb_lines[i].b * dot(samechroma_rgb_lines[i].a, samechroma_rgb_lines[i].b)) * inverse_color_scalefactors[i].xyz; + proc_samechroma_rgb_lines[i].bs = samechroma_rgb_lines[i].b * color_scalefactors[i].xyz; + proc_samechroma_rgb_lines[i].bis = samechroma_rgb_lines[i].b * inverse_color_scalefactors[i].xyz; + + proc_rgb_luma_lines[i].amod = (rgb_luma_lines[i].a - rgb_luma_lines[i].b * dot(rgb_luma_lines[i].a, rgb_luma_lines[i].b)) * inverse_color_scalefactors[i].xyz; + proc_rgb_luma_lines[i].bs = rgb_luma_lines[i].b * color_scalefactors[i].xyz; + proc_rgb_luma_lines[i].bis = rgb_luma_lines[i].b * inverse_color_scalefactors[i].xyz; + + proc_luminance_lines[i].amod = (luminance_lines[i].a - luminance_lines[i].b * dot(luminance_lines[i].a, luminance_lines[i].b)) * inverse_color_scalefactors[i].xyz; + proc_luminance_lines[i].bs = luminance_lines[i].b * color_scalefactors[i].xyz; + proc_luminance_lines[i].bis = luminance_lines[i].b * inverse_color_scalefactors[i].xyz; + + } + + + + float uncorr_rgb_error[4]; + float samechroma_rgb_error[4]; + float rgb_luma_error[4]; + float luminance_rgb_error[4]; + + + for (i = 0; i < partition_count; i++) + { + + uncorr_rgb_error[i] = compute_error_squared_rgb_single_partition(i, xdim, ydim, zdim, pi, pb, ewb, &(proc_uncorr_rgb_lines[i])); + + samechroma_rgb_error[i] = compute_error_squared_rgb_single_partition(i, xdim, ydim, zdim, pi, pb, ewb, &(proc_samechroma_rgb_lines[i])); + + rgb_luma_error[i] = compute_error_squared_rgb_single_partition(i, xdim, ydim, zdim, pi, pb, ewb, &(proc_rgb_luma_lines[i])); + + luminance_rgb_error[i] = compute_error_squared_rgb_single_partition(i, xdim, ydim, zdim, pi, pb, ewb, &(proc_luminance_lines[i])); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Partition %d : uncorr-error=%g samechroma-error=%g rgb-luma-error=%g lum-error=%g\n", + i, uncorr_rgb_error[i], samechroma_rgb_error[i], rgb_luma_error[i], luminance_rgb_error[i]); + } + #endif + } + + // compute the error that arises from just ditching alpha and RGB + float alpha_drop_error[4]; + float rgb_drop_error[4]; + for (i = 0; i < partition_count; i++) + { + alpha_drop_error[i] = 0; + rgb_drop_error[i] = 0; + } + for (i = 0; i < texels_per_block; i++) + { + int partition = pi->partition_of_texel[i]; + float alpha = pb->work_data[4 * i + 3]; + float default_alpha = pb->alpha_lns[i] ? (float)0x7800 : (float)0xFFFF; + + float omalpha = alpha - default_alpha; + alpha_drop_error[partition] += omalpha * omalpha * ewb->error_weights[i].w; + float red = pb->work_data[4 * i]; + float green = pb->work_data[4 * i + 1]; + float blue = pb->work_data[4 * i + 2]; + rgb_drop_error[partition] += red * red * ewb->error_weights[i].x + green * green * ewb->error_weights[i].y + blue * blue * ewb->error_weights[i].z; + } + + // check if we are eligible for blue-contraction and offset-encoding + + endpoints ep; + if (separate_component == -1) + { + endpoints_and_weights ei; + compute_endpoints_and_ideal_weights_1_plane(xdim, ydim, zdim, pi, pb, ewb, &ei); + ep = ei.ep; + } + else + { + endpoints_and_weights ei1, ei2; + compute_endpoints_and_ideal_weights_2_planes(xdim, ydim, zdim, pi, pb, ewb, separate_component, &ei1, &ei2); + + merge_endpoints(&(ei1.ep), &(ei2.ep), separate_component, &ep); + } + + int eligible_for_offset_encode[4]; + int eligible_for_blue_contraction[4]; + + for (i = 0; i < partition_count; i++) + { + float4 endpt0 = ep.endpt0[i]; + float4 endpt1 = ep.endpt1[i]; + float4 endpt_dif = endpt1 - endpt0; + if (fabs(endpt_dif.x) < (0.12 * 65535.0f) && fabs(endpt_dif.y) < (0.12 * 65535.0f) && fabs(endpt_dif.z) < (0.12 * 65535.0f)) + eligible_for_offset_encode[i] = 1; + else + eligible_for_offset_encode[i] = 0; + endpt0.x += (endpt0.x - endpt0.z); + endpt0.y += (endpt0.y - endpt0.z); + endpt1.x += (endpt1.x - endpt1.z); + endpt1.y += (endpt1.y - endpt1.z); + if (endpt0.x > (0.01f * 65535.0f) && endpt0.x < (0.99f * 65535.0f) + && endpt1.x > (0.01f * 65535.0f) && endpt1.x < (0.99f * 65535.0f) + && endpt0.y > (0.01f * 65535.0f) && endpt0.y < (0.99f * 65535.0f) && endpt1.y > (0.01f * 65535.0f) && endpt1.y < (0.99f * 65535.0f)) + eligible_for_blue_contraction[i] = 1; + else + eligible_for_blue_contraction[i] = 0; + } + + + // finally, gather up our results + for (i = 0; i < partition_count; i++) + { + eci[i].rgb_scale_error = (samechroma_rgb_error[i] - uncorr_rgb_error[i]) * 0.7f; // empirical + eci[i].rgb_luma_error = (rgb_luma_error[i] - uncorr_rgb_error[i]) * 1.5f; // wild guess + eci[i].luminance_error = (luminance_rgb_error[i] - uncorr_rgb_error[i]) * 3.0f; // empirical + eci[i].alpha_drop_error = alpha_drop_error[i] * 3.0f; + eci[i].rgb_drop_error = rgb_drop_error[i] * 3.0f; + eci[i].can_offset_encode = eligible_for_offset_encode[i]; + eci[i].can_blue_contract = eligible_for_blue_contraction[i]; + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_find_best_partitioning.cpp b/3rdparty/bimg/3rdparty/astc/astc_find_best_partitioning.cpp new file mode 100644 index 00000000000..f53ab1c9b3e --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_find_best_partitioning.cpp @@ -0,0 +1,865 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief ASTC encoding of texture + * + * major step 1: + * * find best partitioning assuming uncorrelated colors + * * find best partitioning assuming RGBS color representation + * + * finding best partitioning for a block: + * * for each available partitioning: + * * compute mean-color-value and dominant direction. + * * this defines two lines, both of which go through the + * mean-color-value: + * * one line has a direction defined by the dominant direction; + * this line is used to assess the error from using an uncorrelated + * color representation. + * * the other line goes through (0,0,0,1) and is used to assess the + * error from using an RGBS color representation. + * * we then compute, as a sum across the block, the squared-errors + * that result from using the dominant-direction-lines and the + * squared-errors that result from using the 0001-lines. + */ +/*----------------------------------------------------------------------------*/ + +/* + * Partition table representation: + * We have 3 tables, each with 1024 partitionings + * (these correspond to the 3x128 hardware partitionings crossed with all the + * partition-transform modes in the hardware.) + * + * For each partitioning, we have: + * * a 4-entry table indicating how many texels there are in each of the 4 + * partitions. this may be from 2 to about 60 or so. + * * a 64-entry table indicating the partition index of each of the 64 texels + * in the block. each index may be 0, 1, 2 or 3. + * + * each element in the table is an uint8_t indicating partition index (0, 1, 2 or 3) + */ + +#include + +#include "astc_codec_internals.h" + +#ifdef DEBUG_PRINT_DIAGNOSTICS + #include +#endif + +#include "mathlib.h" + +int imageblock_uses_alpha(int xdim, int ydim, int zdim, const imageblock * pb) +{ + IGNORE(xdim); + IGNORE(ydim); + IGNORE(zdim); + + return pb->alpha_max != pb->alpha_min; +} + +static void compute_alpha_minmax(int xdim, int ydim, int zdim, const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, float *alpha_min, float *alpha_max) +{ + int i; + int partition_count = pt->partition_count; + + int texels_per_block = xdim * ydim * zdim; + + for (i = 0; i < partition_count; i++) + { + alpha_min[i] = 1e38f; + alpha_max[i] = -1e38f; + } + + for (i = 0; i < texels_per_block; i++) + { + if (ewb->texel_weight[i] > 1e-10) + { + int partition = pt->partition_of_texel[i]; + float alphaval = blk->work_data[4 * i + 3]; + if (alphaval > alpha_max[partition]) + alpha_max[partition] = alphaval; + if (alphaval < alpha_min[partition]) + alpha_min[partition] = alphaval; + } + } + + for (i = 0; i < partition_count; i++) + { + if (alpha_min[i] >= alpha_max[i]) + { + alpha_min[i] = 0; + alpha_max[i] = 1e-10f; + } + } +} + + +static void compute_rgb_minmax(int xdim, + int ydim, + int zdim, + const partition_info * pt, + const imageblock * blk, const error_weight_block * ewb, float *red_min, float *red_max, float *green_min, float *green_max, float *blue_min, float *blue_max) +{ + int i; + int partition_count = pt->partition_count; + int texels_per_block = xdim * ydim * zdim; + + for (i = 0; i < partition_count; i++) + { + red_min[i] = 1e38f; + red_max[i] = -1e38f; + green_min[i] = 1e38f; + green_max[i] = -1e38f; + blue_min[i] = 1e38f; + blue_max[i] = -1e38f; + } + + for (i = 0; i < texels_per_block; i++) + { + if (ewb->texel_weight[i] > 1e-10f) + { + int partition = pt->partition_of_texel[i]; + float redval = blk->work_data[4 * i]; + float greenval = blk->work_data[4 * i + 1]; + float blueval = blk->work_data[4 * i + 2]; + if (redval > red_max[partition]) + red_max[partition] = redval; + if (redval < red_min[partition]) + red_min[partition] = redval; + if (greenval > green_max[partition]) + green_max[partition] = greenval; + if (greenval < green_min[partition]) + green_min[partition] = greenval; + if (blueval > blue_max[partition]) + blue_max[partition] = blueval; + if (blueval < blue_min[partition]) + blue_min[partition] = blueval; + } + } + for (i = 0; i < partition_count; i++) + { + if (red_min[i] >= red_max[i]) + { + red_min[i] = 0.0f; + red_max[i] = 1e-10f; + } + if (green_min[i] >= green_max[i]) + { + green_min[i] = 0.0f; + green_max[i] = 1e-10f; + } + if (blue_min[i] >= blue_max[i]) + { + blue_min[i] = 0.0f; + blue_max[i] = 1e-10f; + } + } +} + + + +void compute_partition_error_color_weightings(int xdim, int ydim, int zdim, const error_weight_block * ewb, const partition_info * pi, float4 error_weightings[4], float4 color_scalefactors[4]) +{ + int i; + int texels_per_block = xdim * ydim * zdim; + int pcnt = pi->partition_count; + for (i = 0; i < pcnt; i++) + error_weightings[i] = float4(1e-12f, 1e-12f, 1e-12f, 1e-12f); + for (i = 0; i < texels_per_block; i++) + { + int part = pi->partition_of_texel[i]; + error_weightings[part] = error_weightings[part] + ewb->error_weights[i]; + } + for (i = 0; i < pcnt; i++) + { + error_weightings[i] = error_weightings[i] * (1.0f / pi->texels_per_partition[i]); + } + for (i = 0; i < pcnt; i++) + { + color_scalefactors[i].x = sqrt(error_weightings[i].x); + color_scalefactors[i].y = sqrt(error_weightings[i].y); + color_scalefactors[i].z = sqrt(error_weightings[i].z); + color_scalefactors[i].w = sqrt(error_weightings[i].w); + } + +} + + +/* + main function to identify the best partitioning for a given number of texels */ + + +void find_best_partitionings(int partition_search_limit, int xdim, int ydim, int zdim, int partition_count, + const imageblock * pb, const error_weight_block * ewb, int candidates_to_return, + // best partitionings to use if the endpoint colors are assumed to be uncorrelated + int *best_partitions_uncorrellated, + // best partitionings to use if the endpoint colors have the same chroma + int *best_partitions_samechroma, + // best partitionings to use if using dual plane of weights + int *best_partitions_dual_weight_planes) +{ + + + int i, j; + + int texels_per_block = xdim * ydim * zdim; + + // constant used to estimate quantization error for a given partitioning; + // the optimal value for this constant depends on bitrate. + // These constants have been determined empirically. + + float weight_imprecision_estim = 100; + + if (texels_per_block <= 20) + weight_imprecision_estim = 0.03f; + else if (texels_per_block <= 31) + weight_imprecision_estim = 0.04f; + else if (texels_per_block <= 41) + weight_imprecision_estim = 0.05f; + else + weight_imprecision_estim = 0.055f; + + + int partition_sequence[PARTITION_COUNT]; + + kmeans_compute_partition_ordering(xdim, ydim, zdim, partition_count, pb, partition_sequence); + + + float weight_imprecision_estim_squared = weight_imprecision_estim * weight_imprecision_estim; + +#ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("weight_imprecision_estim = %g\n", weight_imprecision_estim); +#endif + + int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, pb); + + const partition_info *ptab = get_partition_table(xdim, ydim, zdim, partition_count); + + // partitioning errors assuming uncorrelated-chrominance endpoints + float uncorr_errors[PARTITION_COUNT]; + // partitioning errors assuming same-chrominance endpoints + float samechroma_errors[PARTITION_COUNT]; + + // partitioning errors assuming that one of the color channels + // is uncorrelated from all the other ones + float separate_errors[4 * PARTITION_COUNT]; + + + float *separate_red_errors = separate_errors; + float *separate_green_errors = separate_errors + PARTITION_COUNT; + float *separate_blue_errors = separate_errors + 2 * PARTITION_COUNT; + float *separate_alpha_errors = separate_errors + 3 * PARTITION_COUNT; + + int defacto_search_limit = PARTITION_COUNT - 1; + + if (uses_alpha) + { + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partition testing with alpha, %d partitions\n\n", partition_count); + #endif + + for (i = 0; i < PARTITION_COUNT; i++) + { + int partition = partition_sequence[i]; + int bk_partition_count = ptab[partition].partition_count; + + if (bk_partition_count < partition_count) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partitioning %d-%d: invalid\n", partition_count, partition); + #endif + + uncorr_errors[i] = 1e35f; + samechroma_errors[i] = 1e35f; + separate_red_errors[i] = 1e35f; + separate_green_errors[i] = 1e35f; + separate_blue_errors[i] = 1e35f; + separate_alpha_errors[i] = 1e35f; + continue; + } + // the sentinel value for partitions above the search limit must be smaller + // than the sentinel value for invalid partitions + if (i >= partition_search_limit) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partitioning %d-%d: excluded from testing\n", partition_count, partition); + #endif + + defacto_search_limit = i; + + uncorr_errors[i] = 1e34f; + samechroma_errors[i] = 1e34f; + separate_red_errors[i] = 1e34f; + separate_green_errors[i] = 1e34f; + separate_blue_errors[i] = 1e34f; + separate_alpha_errors[i] = 1e34f; + break; + } + + // compute the weighting to give to each color channel + // in each partition. + float4 error_weightings[4]; + float4 color_scalefactors[4]; + float4 inverse_color_scalefactors[4]; + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, ptab + partition, error_weightings, color_scalefactors); + + for (j = 0; j < partition_count; j++) + { + inverse_color_scalefactors[j].x = 1.0f / MAX(color_scalefactors[j].x, 1e-7f); + inverse_color_scalefactors[j].y = 1.0f / MAX(color_scalefactors[j].y, 1e-7f); + inverse_color_scalefactors[j].z = 1.0f / MAX(color_scalefactors[j].z, 1e-7f); + inverse_color_scalefactors[j].w = 1.0f / MAX(color_scalefactors[j].w, 1e-7f); + } + + float4 averages[4]; + float4 directions_rgba[4]; + float3 directions_gba[4]; + float3 directions_rba[4]; + float3 directions_rga[4]; + float3 directions_rgb[4]; + + compute_averages_and_directions_rgba(ptab + partition, pb, ewb, color_scalefactors, averages, directions_rgba, directions_gba, directions_rba, directions_rga, directions_rgb); + + line4 uncorr_lines[4]; + line4 samechroma_lines[4]; + line3 separate_red_lines[4]; + line3 separate_green_lines[4]; + line3 separate_blue_lines[4]; + line3 separate_alpha_lines[4]; + + processed_line4 proc_uncorr_lines[4]; + processed_line4 proc_samechroma_lines[4]; + processed_line3 proc_separate_red_lines[4]; + processed_line3 proc_separate_green_lines[4]; + processed_line3 proc_separate_blue_lines[4]; + processed_line3 proc_separate_alpha_lines[4]; + + float uncorr_linelengths[4]; + float samechroma_linelengths[4]; + float separate_red_linelengths[4]; + float separate_green_linelengths[4]; + float separate_blue_linelengths[4]; + float separate_alpha_linelengths[4]; + + + + for (j = 0; j < partition_count; j++) + { + uncorr_lines[j].a = averages[j]; + if (dot(directions_rgba[j], directions_rgba[j]) == 0.0f) + uncorr_lines[j].b = normalize(float4(1, 1, 1, 1)); + else + uncorr_lines[j].b = normalize(directions_rgba[j]); + + proc_uncorr_lines[j].amod = (uncorr_lines[j].a - uncorr_lines[j].b * dot(uncorr_lines[j].a, uncorr_lines[j].b)) * inverse_color_scalefactors[j]; + proc_uncorr_lines[j].bs = (uncorr_lines[j].b * color_scalefactors[j]); + proc_uncorr_lines[j].bis = (uncorr_lines[j].b * inverse_color_scalefactors[j]); + + + samechroma_lines[j].a = float4(0, 0, 0, 0); + if (dot(averages[j], averages[j]) == 0) + samechroma_lines[j].b = normalize(float4(1, 1, 1, 1)); + else + samechroma_lines[j].b = normalize(averages[j]); + + proc_samechroma_lines[j].amod = (samechroma_lines[j].a - samechroma_lines[j].b * dot(samechroma_lines[j].a, samechroma_lines[j].b)) * inverse_color_scalefactors[j]; + proc_samechroma_lines[j].bs = (samechroma_lines[j].b * color_scalefactors[j]); + proc_samechroma_lines[j].bis = (samechroma_lines[j].b * inverse_color_scalefactors[j]); + + separate_red_lines[j].a = averages[j].yzw; + if (dot(directions_gba[j], directions_gba[j]) == 0.0f) + separate_red_lines[j].b = normalize(float3(1, 1, 1)); + else + separate_red_lines[j].b = normalize(directions_gba[j]); + + separate_green_lines[j].a = averages[j].xzw; + if (dot(directions_rba[j], directions_rba[j]) == 0.0f) + separate_green_lines[j].b = normalize(float3(1, 1, 1)); + else + separate_green_lines[j].b = normalize(directions_rba[j]); + + separate_blue_lines[j].a = averages[j].xyw; + if (dot(directions_rga[j], directions_rga[j]) == 0.0f) + separate_blue_lines[j].b = normalize(float3(1, 1, 1)); + else + separate_blue_lines[j].b = normalize(directions_rga[j]); + + separate_alpha_lines[j].a = averages[j].xyz; + if (dot(directions_rgb[j], directions_rgb[j]) == 0.0f) + separate_alpha_lines[j].b = normalize(float3(1, 1, 1)); + else + separate_alpha_lines[j].b = normalize(directions_rgb[j]); + + proc_separate_red_lines[j].amod = (separate_red_lines[j].a - separate_red_lines[j].b * dot(separate_red_lines[j].a, separate_red_lines[j].b)) * inverse_color_scalefactors[j].yzw; + proc_separate_red_lines[j].bs = (separate_red_lines[j].b * color_scalefactors[j].yzw); + proc_separate_red_lines[j].bis = (separate_red_lines[j].b * inverse_color_scalefactors[j].yzw); + + proc_separate_green_lines[j].amod = + (separate_green_lines[j].a - separate_green_lines[j].b * dot(separate_green_lines[j].a, separate_green_lines[j].b)) * inverse_color_scalefactors[j].xzw; + proc_separate_green_lines[j].bs = (separate_green_lines[j].b * color_scalefactors[j].xzw); + proc_separate_green_lines[j].bis = (separate_green_lines[j].b * inverse_color_scalefactors[j].xzw); + + proc_separate_blue_lines[j].amod = (separate_blue_lines[j].a - separate_blue_lines[j].b * dot(separate_blue_lines[j].a, separate_blue_lines[j].b)) * inverse_color_scalefactors[j].xyw; + proc_separate_blue_lines[j].bs = (separate_blue_lines[j].b * color_scalefactors[j].xyw); + proc_separate_blue_lines[j].bis = (separate_blue_lines[j].b * inverse_color_scalefactors[j].xyw); + + proc_separate_alpha_lines[j].amod = + (separate_alpha_lines[j].a - separate_alpha_lines[j].b * dot(separate_alpha_lines[j].a, separate_alpha_lines[j].b)) * inverse_color_scalefactors[j].xyz; + proc_separate_alpha_lines[j].bs = (separate_alpha_lines[j].b * color_scalefactors[j].xyz); + proc_separate_alpha_lines[j].bis = (separate_alpha_lines[j].b * inverse_color_scalefactors[j].xyz); + + } + + float uncorr_error = compute_error_squared_rgba(ptab + partition, + pb, + ewb, + proc_uncorr_lines, + uncorr_linelengths); + float samechroma_error = compute_error_squared_rgba(ptab + partition, + pb, + ewb, + proc_samechroma_lines, + samechroma_linelengths); + + + float separate_red_error = compute_error_squared_gba(ptab + partition, + pb, + ewb, + proc_separate_red_lines, + separate_red_linelengths); + + float separate_green_error = compute_error_squared_rba(ptab + partition, + pb, + ewb, + proc_separate_green_lines, + separate_green_linelengths); + + float separate_blue_error = compute_error_squared_rga(ptab + partition, + pb, + ewb, + proc_separate_blue_lines, + separate_blue_linelengths); + + float separate_alpha_error = compute_error_squared_rgb(ptab + partition, + pb, + ewb, + proc_separate_alpha_lines, + separate_alpha_linelengths); + + // compute minimum & maximum alpha values in each partition + float red_min[4], red_max[4]; + float green_min[4], green_max[4]; + float blue_min[4], blue_max[4]; + float alpha_min[4], alpha_max[4]; + compute_alpha_minmax(xdim, ydim, zdim, ptab + partition, pb, ewb, alpha_min, alpha_max); + + compute_rgb_minmax(xdim, ydim, zdim, ptab + partition, pb, ewb, red_min, red_max, green_min, green_max, blue_min, blue_max); + + /* + Compute an estimate of error introduced by weight quantization imprecision. + This error is computed as follows, for each partition + 1: compute the principal-axis vector (full length) in error-space + 2: convert the principal-axis vector to regular RGB-space + 3: scale the vector by a constant that estimates average quantization error + 4: for each texel, square the vector, then do a dot-product with the texel's error weight; + sum up the results across all texels. + 4(optimized): square the vector once, then do a dot-product with the average texel error, + then multiply by the number of texels. + */ + + for (j = 0; j < partition_count; j++) + { + float tpp = (float)(ptab[partition].texels_per_partition[j]); + + float4 ics = inverse_color_scalefactors[j]; + float4 error_weights = error_weightings[j] * (tpp * weight_imprecision_estim_squared); + + float4 uncorr_vector = (uncorr_lines[j].b * uncorr_linelengths[j]) * ics; + float4 samechroma_vector = (samechroma_lines[j].b * samechroma_linelengths[j]) * ics; + float3 separate_red_vector = (separate_red_lines[j].b * separate_red_linelengths[j]) * ics.yzw; + float3 separate_green_vector = (separate_green_lines[j].b * separate_green_linelengths[j]) * ics.xzw; + float3 separate_blue_vector = (separate_blue_lines[j].b * separate_blue_linelengths[j]) * ics.xyw; + float3 separate_alpha_vector = (separate_alpha_lines[j].b * separate_alpha_linelengths[j]) * ics.xyz; + + uncorr_vector = uncorr_vector * uncorr_vector; + samechroma_vector = samechroma_vector * samechroma_vector; + separate_red_vector = separate_red_vector * separate_red_vector; + separate_green_vector = separate_green_vector * separate_green_vector; + separate_blue_vector = separate_blue_vector * separate_blue_vector; + separate_alpha_vector = separate_alpha_vector * separate_alpha_vector; + + uncorr_error += dot(uncorr_vector, error_weights); + samechroma_error += dot(samechroma_vector, error_weights); + separate_red_error += dot(separate_red_vector, error_weights.yzw); + separate_green_error += dot(separate_green_vector, error_weights.xzw); + separate_blue_error += dot(separate_blue_vector, error_weights.xyw); + separate_alpha_error += dot(separate_alpha_vector, error_weights.xyz); + + float red_scalar = (red_max[j] - red_min[j]); + float green_scalar = (green_max[j] - green_min[j]); + float blue_scalar = (blue_max[j] - blue_min[j]); + float alpha_scalar = (alpha_max[j] - alpha_min[j]); + red_scalar *= red_scalar; + green_scalar *= green_scalar; + blue_scalar *= blue_scalar; + alpha_scalar *= alpha_scalar; + separate_red_error += red_scalar * error_weights.x; + separate_green_error += green_scalar * error_weights.y; + separate_blue_error += blue_scalar * error_weights.z; + separate_alpha_error += alpha_scalar * error_weights.w; + } + + uncorr_errors[i] = uncorr_error; + samechroma_errors[i] = samechroma_error; + separate_red_errors[i] = separate_red_error; + separate_green_errors[i] = separate_green_error; + separate_blue_errors[i] = separate_blue_error; + separate_alpha_errors[i] = separate_alpha_error; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partitioning %d-%d errors: uncorr=%g, samechroma=%g, sep-alpha=%g\n", partition_count, i, uncorr_error, samechroma_error, separate_alpha_error); + #endif + } + } + else + { + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partition testing without alpha, %d partitions\n", partition_count); + #endif + + + + for (i = 0; i < PARTITION_COUNT; i++) + { + + int partition = partition_sequence[i]; + + int bk_partition_count = ptab[partition].partition_count; + if (bk_partition_count < partition_count) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partitioning %d-%d: invalid\n", partition_count, i); + #endif + + uncorr_errors[i] = 1e35f; + samechroma_errors[i] = 1e35f; + separate_red_errors[i] = 1e35f; + separate_green_errors[i] = 1e35f; + separate_blue_errors[i] = 1e35f; + continue; + } + // the sentinel value for valid partitions above the search limit must be smaller + // than the sentinel value for invalid partitions + if (i >= partition_search_limit) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf(" Partitioning %d-%d: excluded from testing\n", partition_count, partition); + #endif + + defacto_search_limit = i; + uncorr_errors[i] = 1e34f; + samechroma_errors[i] = 1e34f; + separate_red_errors[i] = 1e34f; + separate_green_errors[i] = 1e34f; + separate_blue_errors[i] = 1e34f; + break; + + } + + // compute the weighting to give to each color channel + // in each partition. + float4 error_weightings[4]; + float4 color_scalefactors[4]; + float4 inverse_color_scalefactors[4]; + + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, ptab + partition, error_weightings, color_scalefactors); + + for (j = 0; j < partition_count; j++) + { + inverse_color_scalefactors[j].x = 1.0f / MAX(color_scalefactors[j].x, 1e-7f); + inverse_color_scalefactors[j].y = 1.0f / MAX(color_scalefactors[j].y, 1e-7f); + inverse_color_scalefactors[j].z = 1.0f / MAX(color_scalefactors[j].z, 1e-7f); + inverse_color_scalefactors[j].w = 1.0f / MAX(color_scalefactors[j].w, 1e-7f); + } + + float3 averages[4]; + float3 directions_rgb[4]; + float2 directions_rg[4]; + float2 directions_rb[4]; + float2 directions_gb[4]; + + compute_averages_and_directions_rgb(ptab + partition, pb, ewb, color_scalefactors, averages, directions_rgb, directions_rg, directions_rb, directions_gb); + + line3 uncorr_lines[4]; + line3 samechroma_lines[4]; + line2 separate_red_lines[4]; + line2 separate_green_lines[4]; + line2 separate_blue_lines[4]; + + processed_line3 proc_uncorr_lines[4]; + processed_line3 proc_samechroma_lines[4]; + + processed_line2 proc_separate_red_lines[4]; + processed_line2 proc_separate_green_lines[4]; + processed_line2 proc_separate_blue_lines[4]; + + float uncorr_linelengths[4]; + float samechroma_linelengths[4]; + float separate_red_linelengths[4]; + float separate_green_linelengths[4]; + float separate_blue_linelengths[4]; + + for (j = 0; j < partition_count; j++) + { + uncorr_lines[j].a = averages[j]; + if (dot(directions_rgb[j], directions_rgb[j]) == 0.0f) + uncorr_lines[j].b = normalize(float3(1, 1, 1)); + else + uncorr_lines[j].b = normalize(directions_rgb[j]); + + + samechroma_lines[j].a = float3(0, 0, 0); + + if (dot(averages[j], averages[j]) == 0.0f) + samechroma_lines[j].b = normalize(float3(1, 1, 1)); + else + samechroma_lines[j].b = normalize(averages[j]); + + proc_uncorr_lines[j].amod = (uncorr_lines[j].a - uncorr_lines[j].b * dot(uncorr_lines[j].a, uncorr_lines[j].b)) * inverse_color_scalefactors[j].xyz; + proc_uncorr_lines[j].bs = (uncorr_lines[j].b * color_scalefactors[j].xyz); + proc_uncorr_lines[j].bis = (uncorr_lines[j].b * inverse_color_scalefactors[j].xyz); + + proc_samechroma_lines[j].amod = (samechroma_lines[j].a - samechroma_lines[j].b * dot(samechroma_lines[j].a, samechroma_lines[j].b)) * inverse_color_scalefactors[j].xyz; + proc_samechroma_lines[j].bs = (samechroma_lines[j].b * color_scalefactors[j].xyz); + proc_samechroma_lines[j].bis = (samechroma_lines[j].b * inverse_color_scalefactors[j].xyz); + + separate_red_lines[j].a = averages[j].yz; + if (dot(directions_gb[j], directions_gb[j]) == 0.0f) + separate_red_lines[j].b = normalize(float2(1, 1)); + else + separate_red_lines[j].b = normalize(directions_gb[j]); + + separate_green_lines[j].a = averages[j].xz; + if (dot(directions_rb[j], directions_rb[j]) == 0.0f) + separate_green_lines[j].b = normalize(float2(1, 1)); + else + separate_green_lines[j].b = normalize(directions_rb[j]); + + separate_blue_lines[j].a = averages[j].xy; + if (dot(directions_rg[j], directions_rg[j]) == 0.0f) + separate_blue_lines[j].b = normalize(float2(1, 1)); + else + separate_blue_lines[j].b = normalize(directions_rg[j]); + + proc_separate_red_lines[j].amod = (separate_red_lines[j].a - separate_red_lines[j].b * dot(separate_red_lines[j].a, separate_red_lines[j].b)) * inverse_color_scalefactors[j].yz; + proc_separate_red_lines[j].bs = (separate_red_lines[j].b * color_scalefactors[j].yz); + proc_separate_red_lines[j].bis = (separate_red_lines[j].b * inverse_color_scalefactors[j].yz); + + proc_separate_green_lines[j].amod = + (separate_green_lines[j].a - separate_green_lines[j].b * dot(separate_green_lines[j].a, separate_green_lines[j].b)) * inverse_color_scalefactors[j].xz; + proc_separate_green_lines[j].bs = (separate_green_lines[j].b * color_scalefactors[j].xz); + proc_separate_green_lines[j].bis = (separate_green_lines[j].b * inverse_color_scalefactors[j].xz); + + proc_separate_blue_lines[j].amod = (separate_blue_lines[j].a - separate_blue_lines[j].b * dot(separate_blue_lines[j].a, separate_blue_lines[j].b)) * inverse_color_scalefactors[j].xy; + proc_separate_blue_lines[j].bs = (separate_blue_lines[j].b * color_scalefactors[j].xy); + proc_separate_blue_lines[j].bis = (separate_blue_lines[j].b * inverse_color_scalefactors[j].xy); + + } + + float uncorr_error = compute_error_squared_rgb(ptab + partition, + pb, + ewb, + proc_uncorr_lines, + uncorr_linelengths); + float samechroma_error = compute_error_squared_rgb(ptab + partition, + pb, + ewb, + proc_samechroma_lines, + samechroma_linelengths); + + float separate_red_error = compute_error_squared_gb(ptab + partition, + pb, + ewb, + proc_separate_red_lines, + separate_red_linelengths); + + float separate_green_error = compute_error_squared_rb(ptab + partition, + pb, + ewb, + proc_separate_green_lines, + separate_green_linelengths); + + float separate_blue_error = compute_error_squared_rg(ptab + partition, + pb, + ewb, + proc_separate_blue_lines, + separate_blue_linelengths); + + float red_min[4], red_max[4]; + float green_min[4], green_max[4]; + float blue_min[4], blue_max[4]; + + + compute_rgb_minmax(xdim, ydim, zdim, ptab + partition, pb, ewb, red_min, red_max, green_min, green_max, blue_min, blue_max); + + + + /* + compute an estimate of error introduced by weight imprecision. + This error is computed as follows, for each partition + 1: compute the principal-axis vector (full length) in error-space + 2: convert the principal-axis vector to regular RGB-space + 3: scale the vector by a constant that estimates average quantization error. + 4: for each texel, square the vector, then do a dot-product with the texel's error weight; + sum up the results across all texels. + 4(optimized): square the vector once, then do a dot-product with the average texel error, + then multiply by the number of texels. + */ + + + for (j = 0; j < partition_count; j++) + { + float tpp = (float)(ptab[partition].texels_per_partition[j]); + + float3 ics = inverse_color_scalefactors[j].xyz; + float3 error_weights = error_weightings[j].xyz * (tpp * weight_imprecision_estim_squared); + + float3 uncorr_vector = (uncorr_lines[j].b * uncorr_linelengths[j]) * ics; + float3 samechroma_vector = (samechroma_lines[j].b * samechroma_linelengths[j]) * ics; + + float2 separate_red_vector = (separate_red_lines[j].b * separate_red_linelengths[j]) * ics.yz; + float2 separate_green_vector = (separate_green_lines[j].b * separate_green_linelengths[j]) * ics.xz; + float2 separate_blue_vector = (separate_blue_lines[j].b * separate_blue_linelengths[j]) * ics.xy; + + uncorr_vector = uncorr_vector * uncorr_vector; + samechroma_vector = samechroma_vector * samechroma_vector; + separate_red_vector = separate_red_vector * separate_red_vector; + separate_green_vector = separate_green_vector * separate_green_vector; + separate_blue_vector = separate_blue_vector * separate_blue_vector; + + uncorr_error += dot(uncorr_vector, error_weights); + samechroma_error += dot(samechroma_vector, error_weights); + separate_red_error += dot(separate_red_vector, error_weights.yz); + separate_green_error += dot(separate_green_vector, error_weights.xz); + separate_blue_error += dot(separate_blue_vector, error_weights.xy); + + float red_scalar = (red_max[j] - red_min[j]); + float green_scalar = (green_max[j] - green_min[j]); + float blue_scalar = (blue_max[j] - blue_min[j]); + + red_scalar *= red_scalar; + green_scalar *= green_scalar; + blue_scalar *= blue_scalar; + + separate_red_error += red_scalar * error_weights.x; + separate_green_error += green_scalar * error_weights.y; + separate_blue_error += blue_scalar * error_weights.z; + } + + + uncorr_errors[i] = uncorr_error; + samechroma_errors[i] = samechroma_error; + + separate_red_errors[i] = separate_red_error; + separate_green_errors[i] = separate_green_error; + separate_blue_errors[i] = separate_blue_error; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Partitioning %d-%d errors: uncorr=%f, samechroma=%f, sep-red=%f, sep-green=%f, sep-blue=%f\n", + partition_count, partition, uncorr_error, samechroma_error, separate_red_error, separate_green_error, separate_blue_error); + #endif + } + } + + + for (i = 0; i < candidates_to_return; i++) + { + int best_uncorr_partition = 0; + int best_samechroma_partition = 0; + float best_uncorr_error = 1e30f; + float best_samechroma_error = 1e30f; + for (j = 0; j <= defacto_search_limit; j++) + { + if (uncorr_errors[j] < best_uncorr_error) + { + best_uncorr_partition = j; + best_uncorr_error = uncorr_errors[j]; + } + } + best_partitions_uncorrellated[i] = partition_sequence[best_uncorr_partition]; + uncorr_errors[best_uncorr_partition] = 1e30f; + samechroma_errors[best_uncorr_partition] = 1e30f; + + for (j = 0; j <= defacto_search_limit; j++) + { + if (samechroma_errors[j] < best_samechroma_error) + { + best_samechroma_partition = j; + best_samechroma_error = samechroma_errors[j]; + } + } + best_partitions_samechroma[i] = partition_sequence[best_samechroma_partition]; + samechroma_errors[best_samechroma_partition] = 1e30f; + uncorr_errors[best_samechroma_partition] = 1e30f; + } + + for (i = 0; i < 2 * candidates_to_return; i++) + { + int best_partition = 0; + float best_partition_error = 1e30f; + + for (j = 0; j <= defacto_search_limit; j++) + { + if (1 || !uses_alpha) + { + if (separate_errors[j] < best_partition_error) + { + best_partition = j; + best_partition_error = separate_errors[j]; + } + if (separate_errors[j + PARTITION_COUNT] < best_partition_error) + { + best_partition = j + PARTITION_COUNT; + best_partition_error = separate_errors[j + PARTITION_COUNT]; + } + if (separate_errors[j + 2 * PARTITION_COUNT] < best_partition_error) + { + best_partition = j + 2 * PARTITION_COUNT; + best_partition_error = separate_errors[j + 2 * PARTITION_COUNT]; + } + } + if (uses_alpha) + { + if (separate_errors[j + 3 * PARTITION_COUNT] < best_partition_error) + { + best_partition = j + 3 * PARTITION_COUNT; + best_partition_error = separate_errors[j + 3 * PARTITION_COUNT]; + } + } + } + + separate_errors[best_partition] = 1e30f; + best_partition = ((best_partition >> PARTITION_BITS) << PARTITION_BITS) | partition_sequence[best_partition & (PARTITION_COUNT - 1)]; + best_partitions_dual_weight_planes[i] = best_partition; + } + +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_ideal_endpoints_and_weights.cpp b/3rdparty/bimg/3rdparty/astc/astc_ideal_endpoints_and_weights.cpp new file mode 100644 index 00000000000..89d697d136f --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_ideal_endpoints_and_weights.cpp @@ -0,0 +1,2163 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions for computing color endpoints and texel weights. + */ +/*----------------------------------------------------------------------------*/ + +#include + +#include "astc_codec_internals.h" + +#ifdef DEBUG_PRINT_DIAGNOSTICS +#include +#endif + + +#ifdef DEBUG_CAPTURE_NAN + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif + + #include +#endif + +static void compute_endpoints_and_ideal_weights_1_component(int xdim, int ydim, int zdim, + const partition_info * pt, const imageblock * blk, + const error_weight_block * ewb, endpoints_and_weights * ei, + int component) +{ + int i; + + int partition_count = pt->partition_count; + ei->ep.partition_count = partition_count; + + float lowvalues[4], highvalues[4]; + float partition_error_scale[4]; + float linelengths_rcp[4]; + + int texels_per_block = xdim * ydim * zdim; + + const float *error_weights; + switch (component) + { + case 0: + error_weights = ewb->texel_weight_r; + break; + case 1: + error_weights = ewb->texel_weight_g; + break; + case 2: + error_weights = ewb->texel_weight_b; + break; + case 3: + error_weights = ewb->texel_weight_a; + break; + default: + error_weights = ewb->texel_weight_r; + ASTC_CODEC_INTERNAL_ERROR; + } + + + for (i = 0; i < partition_count; i++) + { + lowvalues[i] = 1e10; + highvalues[i] = -1e10; + } + + for (i = 0; i < texels_per_block; i++) + { + if (error_weights[i] > 1e-10) + { + float value = blk->work_data[4 * i + component]; + int partition = pt->partition_of_texel[i]; + if (value < lowvalues[partition]) + lowvalues[partition] = value; + if (value > highvalues[partition]) + highvalues[partition] = value; + } + } + + for (i = 0; i < partition_count; i++) + { + float diff = highvalues[i] - lowvalues[i]; + if (diff < 0) + { + lowvalues[i] = 0; + highvalues[i] = 0; + } + if (diff < 1e-7f) + diff = 1e-7f; + partition_error_scale[i] = diff * diff; + linelengths_rcp[i] = 1.0f / diff; + } + + for (i = 0; i < texels_per_block; i++) + { + float value = blk->work_data[4 * i + component]; + int partition = pt->partition_of_texel[i]; + value -= lowvalues[partition]; + value *= linelengths_rcp[partition]; + if (value > 1.0f) + value = 1.0f; + else if (!(value > 0.0f)) + value = 0.0f; + + ei->weights[i] = value; + ei->weight_error_scale[i] = partition_error_scale[partition] * error_weights[i]; + if (astc_isnan(ei->weight_error_scale[i])) + { + ASTC_CODEC_INTERNAL_ERROR; + } + } + + for (i = 0; i < partition_count; i++) + { + ei->ep.endpt0[i] = float4(blk->red_min, blk->green_min, blk->blue_min, blk->alpha_min); + ei->ep.endpt1[i] = float4(blk->red_max, blk->green_max, blk->blue_max, blk->alpha_max); + switch (component) + { + case 0: // red/x + ei->ep.endpt0[i].x = lowvalues[i]; + ei->ep.endpt1[i].x = highvalues[i]; + break; + case 1: // green/y + ei->ep.endpt0[i].y = lowvalues[i]; + ei->ep.endpt1[i].y = highvalues[i]; + break; + case 2: // blue/z + ei->ep.endpt0[i].z = lowvalues[i]; + ei->ep.endpt1[i].z = highvalues[i]; + break; + case 3: // alpha/w + ei->ep.endpt0[i].w = lowvalues[i]; + ei->ep.endpt1[i].w = highvalues[i]; + break; + } + } + + // print all the data that this function computes. + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s: %dx%dx%d texels, %d partitions, component=%d\n", __func__, xdim, ydim, zdim, partition_count, component); + printf("Endpoints:\n"); + for (i = 0; i < partition_count; i++) + { + printf("%d Low: <%g> => <%g %g %g %g>\n", i, lowvalues[i], ei->ep.endpt0[i].x, ei->ep.endpt0[i].y, ei->ep.endpt0[i].z, ei->ep.endpt0[i].w); + printf("%d High: <%g> => <%g %g %g %g>\n", i, highvalues[i], ei->ep.endpt1[i].x, ei->ep.endpt1[i].y, ei->ep.endpt1[i].z, ei->ep.endpt1[i].w); + } + printf("Ideal-weights:\n"); + + for (i = 0; i < texels_per_block; i++) + { + printf("%3d <%2d %2d %2d>=> %g (weight=%g)\n", i, i % xdim, (i / xdim) % ydim, i / (xdim * ydim), ei->weights[i], ei->weight_error_scale[i]); + } + printf("\n"); + } + #endif +} + + +static void compute_endpoints_and_ideal_weights_2_components(int xdim, int ydim, int zdim, const partition_info * pt, + const imageblock * blk, const error_weight_block * ewb, + endpoints_and_weights * ei, int component1, int component2) +{ + int i; + + int partition_count = pt->partition_count; + ei->ep.partition_count = partition_count; + + float4 error_weightings[4]; + float4 color_scalefactors[4]; + + float2 scalefactors[4]; + + const float *error_weights; + if (component1 == 0 && component2 == 1) + error_weights = ewb->texel_weight_rg; + else if (component1 == 0 && component2 == 2) + error_weights = ewb->texel_weight_rb; + else if (component1 == 1 && component2 == 2) + error_weights = ewb->texel_weight_gb; + else + { + error_weights = ewb->texel_weight_rg; + ASTC_CODEC_INTERNAL_ERROR; + } + + int texels_per_block = xdim * ydim * zdim; + + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pt, error_weightings, color_scalefactors); + + for (i = 0; i < partition_count; i++) + { + float s1 = 0, s2 = 0; + switch (component1) + { + case 0: + s1 = color_scalefactors[i].x; + break; + case 1: + s1 = color_scalefactors[i].y; + break; + case 2: + s1 = color_scalefactors[i].z; + break; + case 3: + s1 = color_scalefactors[i].w; + break; + } + + switch (component2) + { + case 0: + s2 = color_scalefactors[i].x; + break; + case 1: + s2 = color_scalefactors[i].y; + break; + case 2: + s2 = color_scalefactors[i].z; + break; + case 3: + s2 = color_scalefactors[i].w; + break; + } + scalefactors[i] = normalize(float2(s1, s2)) * 1.41421356f; + } + + + float lowparam[4], highparam[4]; + + float2 averages[4]; + float2 directions[4]; + + line2 lines[4]; + float scale[4]; + float length_squared[4]; + + + for (i = 0; i < partition_count; i++) + { + lowparam[i] = 1e10; + highparam[i] = -1e10; + } + + + compute_averages_and_directions_2_components(pt, blk, ewb, scalefactors, component1, component2, averages, directions); + + for (i = 0; i < partition_count; i++) + { + float2 egv = directions[i]; + if (egv.x + egv.y < 0.0f) + directions[i] = float2(0, 0) - egv; + } + + for (i = 0; i < partition_count; i++) + { + lines[i].a = averages[i]; + if (dot(directions[i], directions[i]) == 0.0f) + lines[i].b = normalize(float2(1, 1)); + else + lines[i].b = normalize(directions[i]); + } + + + for (i = 0; i < texels_per_block; i++) + { + if (error_weights[i] > 1e-10) + { + int partition = pt->partition_of_texel[i]; + float2 point = float2(blk->work_data[4 * i + component1], blk->work_data[4 * i + component2]) * scalefactors[partition]; + line2 l = lines[partition]; + float param = dot(point - l.a, l.b); + ei->weights[i] = param; + if (param < lowparam[partition]) + lowparam[partition] = param; + if (param > highparam[partition]) + highparam[partition] = param; + } + else + { + ei->weights[i] = -1e38f; + } + } + + float2 lowvalues[4]; + float2 highvalues[4]; + + + for (i = 0; i < partition_count; i++) + { + float length = highparam[i] - lowparam[i]; + if (length < 0) // case for when none of the texels had any weight + { + lowparam[i] = 0.0f; + highparam[i] = 1e-7f; + } + + // it is possible for a uniform-color partition to produce length=0; this + // causes NaN-production and NaN-propagation later on. Set length to + // a small value to avoid this problem. + if (length < 1e-7f) + length = 1e-7f; + + length_squared[i] = length * length; + scale[i] = 1.0f / length; + + float2 ep0 = lines[i].a + lines[i].b * lowparam[i]; + float2 ep1 = lines[i].a + lines[i].b * highparam[i]; + + ep0 = ep0 / scalefactors[i]; + ep1 = ep1 / scalefactors[i]; + + lowvalues[i] = ep0; + highvalues[i] = ep1; + } + + + for (i = 0; i < partition_count; i++) + { + ei->ep.endpt0[i] = float4(blk->red_min, blk->green_min, blk->blue_min, blk->alpha_min); + ei->ep.endpt1[i] = float4(blk->red_max, blk->green_max, blk->blue_max, blk->alpha_max); + + float2 ep0 = lowvalues[i]; + float2 ep1 = highvalues[i]; + + switch (component1) + { + case 0: + ei->ep.endpt0[i].x = ep0.x; + ei->ep.endpt1[i].x = ep1.x; + break; + case 1: + ei->ep.endpt0[i].y = ep0.x; + ei->ep.endpt1[i].y = ep1.x; + break; + case 2: + ei->ep.endpt0[i].z = ep0.x; + ei->ep.endpt1[i].z = ep1.x; + break; + case 3: + ei->ep.endpt0[i].w = ep0.x; + ei->ep.endpt1[i].w = ep1.x; + break; + } + switch (component2) + { + case 0: + ei->ep.endpt0[i].x = ep0.y; + ei->ep.endpt1[i].x = ep1.y; + break; + case 1: + ei->ep.endpt0[i].y = ep0.y; + ei->ep.endpt1[i].y = ep1.y; + break; + case 2: + ei->ep.endpt0[i].z = ep0.y; + ei->ep.endpt1[i].z = ep1.y; + break; + case 3: + ei->ep.endpt0[i].w = ep0.y; + ei->ep.endpt1[i].w = ep1.y; + break; + } + } + + for (i = 0; i < texels_per_block; i++) + { + int partition = pt->partition_of_texel[i]; + float idx = (ei->weights[i] - lowparam[partition]) * scale[partition]; + if (idx > 1.0f) + idx = 1.0f; + else if (!(idx > 0.0f)) + idx = 0.0f; + + ei->weights[i] = idx; + ei->weight_error_scale[i] = length_squared[partition] * error_weights[i]; + if (astc_isnan(ei->weight_error_scale[i])) + { + ASTC_CODEC_INTERNAL_ERROR; + } + } + + // print all the data that this function computes. + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s: %dx%dx%d texels, %d partitions, component1=%d, component2=%d\n", __func__, xdim, ydim, zdim, partition_count, component1, component2); + printf("Endpoints:\n"); + for (i = 0; i < partition_count; i++) + { + printf("%d Low: <%g %g> => <%g %g %g %g>\n", i, lowvalues[i].x, lowvalues[i].y, ei->ep.endpt0[i].x, ei->ep.endpt0[i].y, ei->ep.endpt0[i].z, ei->ep.endpt0[i].w); + printf("%d High: <%g %g> => <%g %g %g %g>\n", i, highvalues[i].x, highvalues[i].y, ei->ep.endpt1[i].x, ei->ep.endpt1[i].y, ei->ep.endpt1[i].z, ei->ep.endpt1[i].w); + } + printf("Ideal-weights:\n"); + + for (i = 0; i < texels_per_block; i++) + { + printf("%3d <%2d %2d %2d>=> %g (weight=%g)\n", i, i % xdim, (i / xdim) % ydim, i / (xdim * ydim), ei->weights[i], ei->weight_error_scale[i]); + } + printf("\n"); + } + #endif +} + +static void compute_endpoints_and_ideal_weights_3_components(int xdim, int ydim, int zdim, const partition_info * pt, + const imageblock * blk, const error_weight_block * ewb, + endpoints_and_weights * ei, int component1, int component2, int component3) +{ + int i; + + int partition_count = pt->partition_count; + ei->ep.partition_count = partition_count; + + float4 error_weightings[4]; + float4 color_scalefactors[4]; + + float3 scalefactors[4]; + + int texels_per_block = xdim * ydim * zdim; + + const float *error_weights; + if (component1 == 1 && component2 == 2 && component3 == 3) + error_weights = ewb->texel_weight_gba; + else if (component1 == 0 && component2 == 2 && component3 == 3) + error_weights = ewb->texel_weight_rba; + else if (component1 == 0 && component2 == 1 && component3 == 3) + error_weights = ewb->texel_weight_rga; + else if (component1 == 0 && component2 == 1 && component3 == 2) + error_weights = ewb->texel_weight_rgb; + else + { + error_weights = ewb->texel_weight_gba; + ASTC_CODEC_INTERNAL_ERROR; + } + + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pt, error_weightings, color_scalefactors); + + for (i = 0; i < partition_count; i++) + { + float s1 = 0, s2 = 0, s3 = 0; + switch (component1) + { + case 0: + s1 = color_scalefactors[i].x; + break; + case 1: + s1 = color_scalefactors[i].y; + break; + case 2: + s1 = color_scalefactors[i].z; + break; + case 3: + s1 = color_scalefactors[i].w; + break; + } + + switch (component2) + { + case 0: + s2 = color_scalefactors[i].x; + break; + case 1: + s2 = color_scalefactors[i].y; + break; + case 2: + s2 = color_scalefactors[i].z; + break; + case 3: + s2 = color_scalefactors[i].w; + break; + } + + switch (component3) + { + case 0: + s3 = color_scalefactors[i].x; + break; + case 1: + s3 = color_scalefactors[i].y; + break; + case 2: + s3 = color_scalefactors[i].z; + break; + case 3: + s3 = color_scalefactors[i].w; + break; + } + scalefactors[i] = normalize(float3(s1, s2, s3)) * 1.73205080f; + } + + + float lowparam[4], highparam[4]; + + float3 averages[4]; + float3 directions[4]; + + line3 lines[4]; + float scale[4]; + float length_squared[4]; + + + for (i = 0; i < partition_count; i++) + { + lowparam[i] = 1e10; + highparam[i] = -1e10; + } + + compute_averages_and_directions_3_components(pt, blk, ewb, scalefactors, component1, component2, component3, averages, directions); + + for (i = 0; i < partition_count; i++) + { + float3 direc = directions[i]; + if (direc.x + direc.y + direc.z < 0.0f) + directions[i] = float3(0, 0, 0) - direc; + } + + for (i = 0; i < partition_count; i++) + { + lines[i].a = averages[i]; + if (dot(directions[i], directions[i]) == 0.0f) + lines[i].b = normalize(float3(1, 1, 1)); + else + lines[i].b = normalize(directions[i]); + } + + + for (i = 0; i < texels_per_block; i++) + { + if (error_weights[i] > 1e-10) + { + int partition = pt->partition_of_texel[i]; + float3 point = float3(blk->work_data[4 * i + component1], blk->work_data[4 * i + component2], blk->work_data[4 * i + component3]) * scalefactors[partition]; + line3 l = lines[partition]; + float param = dot(point - l.a, l.b); + ei->weights[i] = param; + if (param < lowparam[partition]) + lowparam[partition] = param; + if (param > highparam[partition]) + highparam[partition] = param; + } + else + { + ei->weights[i] = -1e38f; + } + } + + float3 lowvalues[4]; + float3 highvalues[4]; + + + for (i = 0; i < partition_count; i++) + { + float length = highparam[i] - lowparam[i]; + if (length < 0) // case for when none of the texels had any weight + { + lowparam[i] = 0.0f; + highparam[i] = 1e-7f; + } + + // it is possible for a uniform-color partition to produce length=0; this + // causes NaN-production and NaN-propagation later on. Set length to + // a small value to avoid this problem. + if (length < 1e-7f) + length = 1e-7f; + + length_squared[i] = length * length; + scale[i] = 1.0f / length; + + float3 ep0 = lines[i].a + lines[i].b * lowparam[i]; + float3 ep1 = lines[i].a + lines[i].b * highparam[i]; + + ep0 = ep0 / scalefactors[i]; + ep1 = ep1 / scalefactors[i]; + + + lowvalues[i] = ep0; + highvalues[i] = ep1; + } + + + for (i = 0; i < partition_count; i++) + { + ei->ep.endpt0[i] = float4(blk->red_min, blk->green_min, blk->blue_min, blk->alpha_min); + ei->ep.endpt1[i] = float4(blk->red_max, blk->green_max, blk->blue_max, blk->alpha_max); + + + float3 ep0 = lowvalues[i]; + float3 ep1 = highvalues[i]; + + switch (component1) + { + case 0: + ei->ep.endpt0[i].x = ep0.x; + ei->ep.endpt1[i].x = ep1.x; + break; + case 1: + ei->ep.endpt0[i].y = ep0.x; + ei->ep.endpt1[i].y = ep1.x; + break; + case 2: + ei->ep.endpt0[i].z = ep0.x; + ei->ep.endpt1[i].z = ep1.x; + break; + case 3: + ei->ep.endpt0[i].w = ep0.x; + ei->ep.endpt1[i].w = ep1.x; + break; + } + switch (component2) + { + case 0: + ei->ep.endpt0[i].x = ep0.y; + ei->ep.endpt1[i].x = ep1.y; + break; + case 1: + ei->ep.endpt0[i].y = ep0.y; + ei->ep.endpt1[i].y = ep1.y; + break; + case 2: + ei->ep.endpt0[i].z = ep0.y; + ei->ep.endpt1[i].z = ep1.y; + break; + case 3: + ei->ep.endpt0[i].w = ep0.y; + ei->ep.endpt1[i].w = ep1.y; + break; + } + switch (component3) + { + case 0: + ei->ep.endpt0[i].x = ep0.z; + ei->ep.endpt1[i].x = ep1.z; + break; + case 1: + ei->ep.endpt0[i].y = ep0.z; + ei->ep.endpt1[i].y = ep1.z; + break; + case 2: + ei->ep.endpt0[i].z = ep0.z; + ei->ep.endpt1[i].z = ep1.z; + break; + case 3: + ei->ep.endpt0[i].w = ep0.z; + ei->ep.endpt1[i].w = ep1.z; + break; + } + } + + for (i = 0; i < texels_per_block; i++) + { + int partition = pt->partition_of_texel[i]; + float idx = (ei->weights[i] - lowparam[partition]) * scale[partition]; + if (idx > 1.0f) + idx = 1.0f; + else if (!(idx > 0.0f)) + idx = 0.0f; + + ei->weights[i] = idx; + ei->weight_error_scale[i] = length_squared[partition] * error_weights[i]; + if (astc_isnan(ei->weight_error_scale[i])) + { + ASTC_CODEC_INTERNAL_ERROR; + } + } + + // print all the data that this function computes. + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s: %dx%dx%d texels, %d partitions, component1=%d, component2=%d, component3=%d\n", __func__, xdim, ydim, zdim, partition_count, component1, component2, component3); + printf("Endpoints:\n"); + for (i = 0; i < partition_count; i++) + { + printf("%d Low: <%g %g %f> => <%g %g %g %g>\n", i, lowvalues[i].x, lowvalues[i].y, lowvalues[i].z, ei->ep.endpt0[i].x, ei->ep.endpt0[i].y, ei->ep.endpt0[i].z, ei->ep.endpt0[i].w); + printf("%d High: <%g %g %g> => <%g %g %g %g>\n", i, highvalues[i].x, highvalues[i].y, highvalues[i].z, ei->ep.endpt1[i].x, ei->ep.endpt1[i].y, ei->ep.endpt1[i].z, ei->ep.endpt1[i].w); + } + printf("Ideal-weights:\n"); + + for (i = 0; i < texels_per_block; i++) + { + printf("%3d <%2d %2d %2d>=> %g (weight=%g)\n", i, (i % xdim), (i / xdim) % ydim, i / (xdim * ydim), ei->weights[i], ei->weight_error_scale[i]); + } + printf("\n"); + } + #endif +} + + + +static void compute_endpoints_and_ideal_weights_rgba(int xdim, int ydim, int zdim, const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, endpoints_and_weights * ei) +{ + int i; + + + const float *error_weights = ewb->texel_weight; + + int partition_count = pt->partition_count; + float lowparam[4], highparam[4]; + for (i = 0; i < partition_count; i++) + { + lowparam[i] = 1e10; + highparam[i] = -1e10; + } + + float4 averages[4]; + float4 directions_rgba[4]; + float3 directions_gba[4]; + float3 directions_rba[4]; + float3 directions_rga[4]; + float3 directions_rgb[4]; + + line4 lines[4]; + + float scale[4]; + float length_squared[4]; + + float4 error_weightings[4]; + float4 color_scalefactors[4]; + float4 scalefactors[4]; + + int texels_per_block = xdim * ydim * zdim; + + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pt, error_weightings, color_scalefactors); + + for (i = 0; i < partition_count; i++) + scalefactors[i] = normalize(color_scalefactors[i]) * 2.0f; + + + + compute_averages_and_directions_rgba(pt, blk, ewb, scalefactors, averages, directions_rgba, directions_gba, directions_rba, directions_rga, directions_rgb); + + // if the direction-vector ends up pointing from light to dark, FLIP IT! + // this will make the first endpoint the darkest one. + for (i = 0; i < partition_count; i++) + { + float4 direc = directions_rgba[i]; + if (direc.x + direc.y + direc.z < 0.0f) + directions_rgba[i] = float4(0, 0, 0, 0) - direc; + } + + for (i = 0; i < partition_count; i++) + { + lines[i].a = averages[i]; + if (dot(directions_rgba[i], directions_rgba[i]) == 0.0f) + lines[i].b = normalize(float4(1, 1, 1, 1)); + else + lines[i].b = normalize(directions_rgba[i]); + } + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + for (i = 0; i < partition_count; i++) + { + printf("Direction-vector %d: <%f %f %f %f>\n", i, directions_rgba[i].x, directions_rgba[i].y, directions_rgba[i].z, directions_rgba[i].w); + printf("Line %d A: <%f %f %f %f>\n", i, lines[i].a.x, lines[i].a.y, lines[i].a.z, lines[i].a.w); + printf("Line %d B: <%f %f %f %f>\n", i, lines[i].b.x, lines[i].b.y, lines[i].b.z, lines[i].b.w); + printf("Scalefactors %d: <%f %f %f %f>\n", i, scalefactors[i].x, scalefactors[i].y, scalefactors[i].z, scalefactors[i].w); + } + } + #endif + + + for (i = 0; i < texels_per_block; i++) + { + if (error_weights[i] > 1e-10) + { + int partition = pt->partition_of_texel[i]; + + float4 point = float4(blk->work_data[4 * i], blk->work_data[4 * i + 1], blk->work_data[4 * i + 2], blk->work_data[4 * i + 3]) * scalefactors[partition]; + line4 l = lines[partition]; + + float param = dot(point - l.a, l.b); + ei->weights[i] = param; + if (param < lowparam[partition]) + lowparam[partition] = param; + if (param > highparam[partition]) + highparam[partition] = param; + } + else + { + ei->weights[i] = -1e38f; + } + } + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + for (i = 0; i < partition_count; i++) + printf("Partition %d: Lowparam=%f Highparam=%f\n", i, lowparam[i], highparam[i]); + } + #endif + + + for (i = 0; i < partition_count; i++) + { + float length = highparam[i] - lowparam[i]; + if (length < 0) + { + lowparam[i] = 0.0f; + highparam[i] = 1e-7f; + } + + + // it is possible for a uniform-color partition to produce length=0; this + // causes NaN-production and NaN-propagation later on. Set length to + // a small value to avoid this problem. + if (length < 1e-7f) + length = 1e-7f; + + length_squared[i] = length * length; + scale[i] = 1.0f / length; + + ei->ep.endpt0[i] = (lines[i].a + lines[i].b * lowparam[i]) / scalefactors[i]; + ei->ep.endpt1[i] = (lines[i].a + lines[i].b * highparam[i]) / scalefactors[i]; + } + + for (i = 0; i < texels_per_block; i++) + { + int partition = pt->partition_of_texel[i]; + float idx = (ei->weights[i] - lowparam[partition]) * scale[partition]; + if (idx > 1.0f) + idx = 1.0f; + else if (!(idx > 0.0f)) + idx = 0.0f; + ei->weights[i] = idx; + ei->weight_error_scale[i] = error_weights[i] * length_squared[partition]; + if (astc_isnan(ei->weight_error_scale[i])) + { + ASTC_CODEC_INTERNAL_ERROR; + } + } + + + // print all the data that this function computes. + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s: %dx%dx%d texels, %d partitions\n", __func__, xdim, ydim, zdim, partition_count); + printf("Endpoints:\n"); + for (i = 0; i < partition_count; i++) + { + printf("%d Low: <%g %g %g %g>\n", i, ei->ep.endpt0[i].x, ei->ep.endpt0[i].y, ei->ep.endpt0[i].z, ei->ep.endpt0[i].w); + printf("%d High: <%g %g %g %g>\n", i, ei->ep.endpt1[i].x, ei->ep.endpt1[i].y, ei->ep.endpt1[i].z, ei->ep.endpt1[i].w); + } + printf("\nIdeal-weights:\n"); + + for (i = 0; i < texels_per_block; i++) + { + printf("%3d <%2d %2d %2d>=> %g (weight=%g)\n", i, i % xdim, (i / xdim) % ydim, i / (xdim * ydim), ei->weights[i], ei->weight_error_scale[i]); + } + printf("\n\n"); + } + #endif + +} + + + +/* + + For a given partitioning, compute: for each partition, the ideal endpoint colors; + these define a color line for the partition. for each pixel, the ideal position of the pixel on the partition's + color line. for each pixel, the length of the color line. + + These data allow us to assess the error introduced by removing and quantizing the per-pixel weights. + + */ + +void compute_endpoints_and_ideal_weights_1_plane(int xdim, int ydim, int zdim, const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, endpoints_and_weights * ei) +{ + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("%s: texels_per_block=%dx%dx%d\n\n", __func__, xdim, ydim, zdim); + #endif + + int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk); + if (uses_alpha) + { + compute_endpoints_and_ideal_weights_rgba(xdim, ydim, zdim, pt, blk, ewb, ei); + } + else + { + compute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei, 0, 1, 2); + } +} + + + +void compute_endpoints_and_ideal_weights_2_planes(int xdim, int ydim, int zdim, const partition_info * pt, + const imageblock * blk, const error_weight_block * ewb, int separate_component, + endpoints_and_weights * ei1, endpoints_and_weights * ei2) +{ + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("%s: texels_per_block=%dx%dx%d, separate_component=%d\n\n", __func__, xdim, ydim, zdim, separate_component); + #endif + + int uses_alpha = imageblock_uses_alpha(xdim, ydim, zdim, blk); + switch (separate_component) + { + case 0: // separate weights for red + if (uses_alpha == 1) + compute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 1, 2, 3); + else + compute_endpoints_and_ideal_weights_2_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 1, 2); + compute_endpoints_and_ideal_weights_1_component(xdim, ydim, zdim, pt, blk, ewb, ei2, 0); + break; + + case 1: // separate weights for green + if (uses_alpha == 1) + compute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 2, 3); + else + compute_endpoints_and_ideal_weights_2_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 2); + compute_endpoints_and_ideal_weights_1_component(xdim, ydim, zdim, pt, blk, ewb, ei2, 1); + break; + + case 2: // separate weights for blue + if (uses_alpha == 1) + compute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 1, 3); + else + compute_endpoints_and_ideal_weights_2_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 1); + compute_endpoints_and_ideal_weights_1_component(xdim, ydim, zdim, pt, blk, ewb, ei2, 2); + break; + + case 3: // separate weights for alpha + if (uses_alpha == 0) + { + ASTC_CODEC_INTERNAL_ERROR; + } + compute_endpoints_and_ideal_weights_3_components(xdim, ydim, zdim, pt, blk, ewb, ei1, 0, 1, 2); + + compute_endpoints_and_ideal_weights_1_component(xdim, ydim, zdim, pt, blk, ewb, ei2, 3); + break; + } + +} + + + +/* + After having computed ideal weights for the case where a weight exists for + every texel, we want to compute the ideal weights for the case where weights + exist only for some texels. + + We do this with a steepest-descent grid solver; this works as follows: + + * First, for each actual weight, perform a weighted averaging based on the + texels affected by the weight. + * Then, set step size to + * Then, repeat: + 1: First, compute for each weight how much the error will change + if we change the weight by an infinitesimal amount. + 2: This produces a vector that points the direction we should step in. + Normalize this vector. + 3: Perform a step + 4: Check if the step actually improved the error. If it did, perform + another step in the same direction; repeat until error no longer + improves. If the *first* step did not improve error, then we halve + the step size. + 5: If the step size dropped down below , + then we quit, else we go back to #1. + + Subroutines: one routine to apply a step and compute the step's effect on + the error one routine to compute the error change of an infinitesimal + weight change + + Data structures needed: + For every decimation pattern, we need: + * For each weight, a list of tuples that tell which texels + the weight influences. + * For each texel, a list of tuples that tell which weights + go into a given texel. +*/ + +float compute_value_of_texel_flt(int texel_to_get, const decimation_table * it, const float *weights) +{ + const uint8_t *texel_weights = it->texel_weights[texel_to_get]; + const float *texel_weights_float = it->texel_weights_float[texel_to_get]; + + return + (weights[texel_weights[0]] * texel_weights_float[0] + weights[texel_weights[1]] * texel_weights_float[1]) + (weights[texel_weights[2]] * texel_weights_float[2] + weights[texel_weights[3]] * texel_weights_float[3]); +} + + +static inline float compute_error_of_texel(const endpoints_and_weights * eai, int texel_to_get, const decimation_table * it, const float *weights) +{ + float current_value = compute_value_of_texel_flt(texel_to_get, it, weights); + float valuedif = current_value - eai->weights[texel_to_get]; + return valuedif * valuedif * eai->weight_error_scale[texel_to_get]; +} + +/* + helper function: given + * for each texel, an ideal weight and an error-modifier these are contained + in an endpoints_and_weights data structure. + * a weight_table data structure + * for each weight, its current value + + compute the change to overall error that results from adding N to the weight +*/ + + +// this routine is rather heavily optimized since it consumes a lot of CPU time. +void compute_two_error_changes_from_perturbing_weight_infill(const endpoints_and_weights * eai, const decimation_table * it, + float *infilled_weights, int weight_to_perturb, + float perturbation1, float perturbation2, float *res1, float *res2) +{ + int num_weights = it->weight_num_texels[weight_to_perturb]; + float error_change0 = 0.0f; + float error_change1 = 0.0f; + int i; + + const uint8_t *weight_texel_ptr = it->weight_texel[weight_to_perturb]; + const float *weights_ptr = it->weights_flt[weight_to_perturb]; + for (i = num_weights - 1; i >= 0; i--) + { + uint8_t weight_texel = weight_texel_ptr[i]; + float weights = weights_ptr[i]; + + float scale = eai->weight_error_scale[weight_texel] * weights; + float old_weight = infilled_weights[weight_texel]; + float ideal_weight = eai->weights[weight_texel]; + + error_change0 += weights * scale; + error_change1 += (old_weight - ideal_weight) * scale; + } + *res1 = error_change0 * (perturbation1 * perturbation1 * (1.0f / (TEXEL_WEIGHT_SUM * TEXEL_WEIGHT_SUM))) + error_change1 * (perturbation1 * (2.0f / TEXEL_WEIGHT_SUM)); + *res2 = error_change0 * (perturbation2 * perturbation2 * (1.0f / (TEXEL_WEIGHT_SUM * TEXEL_WEIGHT_SUM))) + error_change1 * (perturbation2 * (2.0f / TEXEL_WEIGHT_SUM)); +} + + + +float compute_error_of_weight_set(const endpoints_and_weights * eai, const decimation_table * it, const float *weights) +{ + int i; + int texel_count = it->num_texels; + float error_summa = 0.0; + for (i = 0; i < texel_count; i++) + error_summa += compute_error_of_texel(eai, i, it, weights); + return error_summa; +} + + +/* + Given a complete weight set and a decimation table, try to + compute the optimal weight set (assuming infinite precision) + given the selected decimation table. +*/ + +void compute_ideal_weights_for_decimation_table(const endpoints_and_weights * eai, const decimation_table * it, float *weight_set, float *weights) +{ + int i, j, k; + + int blockdim = (int)floor(sqrt((float)it->num_texels) + 0.5f); + int texels_per_block = it->num_texels; + int weight_count = it->num_weights; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : decimation from %d to %d weights\n\n", __func__, it->num_texels, it->num_weights); + printf("Input weight set:\n"); + for (i = 0; i < it->num_texels; i++) + { + printf("%3d <%2d %2d> : %g\n", i, i % blockdim, i / blockdim, eai->weights[i]); + } + printf("\n"); + } + #endif + + + // perform a shortcut in the case of a complete decimation table + if (texels_per_block == weight_count) + { + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("%s : no decimation actually needed: early-out\n\n", __func__); + #endif + + for (i = 0; i < it->num_texels; i++) + { + int texel = it->weight_texel[i][0]; + weight_set[i] = eai->weights[texel]; + weights[i] = eai->weight_error_scale[texel]; + } + return; + } + + + // if the shortcut is not available, we will instead compute a simple estimate + // and perform three rounds of refinement on that estimate. + + float initial_weight_set[MAX_WEIGHTS_PER_BLOCK]; + float infilled_weights[MAX_TEXELS_PER_BLOCK]; + + // compute an initial average for each weight. + for (i = 0; i < weight_count; i++) + { + int texel_count = it->weight_num_texels[i]; + + float weight_weight = 1e-10f; // to avoid 0/0 later on + float initial_weight = 0.0f; + for (j = 0; j < texel_count; j++) + { + int texel = it->weight_texel[i][j]; + float weight = it->weights_flt[i][j]; + float contrib_weight = weight * eai->weight_error_scale[texel]; + weight_weight += contrib_weight; + initial_weight += eai->weights[texel] * contrib_weight; + } + + weights[i] = weight_weight; + weight_set[i] = initial_weight / weight_weight; // this is the 0/0 that is to be avoided. + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + // stash away the initial-weight estimates for later printing + for (i = 0; i < weight_count; i++) + initial_weight_set[i] = weight_set[i]; + } + #endif + + + for (i = 0; i < texels_per_block; i++) + { + infilled_weights[i] = compute_value_of_texel_flt(i, it, weight_set); + } + + const float stepsizes[2] = { 0.25f, 0.125f }; + + for (j = 0; j < 2; j++) + { + float stepsize = stepsizes[j]; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Pass %d, step=%f \n", j, stepsize); + #endif + + for (i = 0; i < weight_count; i++) + { + float weight_val = weight_set[i]; + float error_change_up, error_change_down; + compute_two_error_changes_from_perturbing_weight_infill(eai, it, infilled_weights, i, stepsize, -stepsize, &error_change_up, &error_change_down); + + /* + assume that the error-change function behaves like a quadratic function in the interval examined, + with "error_change_up" and "error_change_down" defining the function at the endpoints + of the interval. Then, find the position where the function's derivative is zero. + + The "fabs(b) >= a" check tests several conditions in one: + if a is negative, then the 2nd derivative of the function is negative; + in this case, f'(x)=0 will maximize error. + If fabs(b) > fabs(a), then f'(x)=0 will lie outside the interval altogether. + If a and b are both 0, then set step to 0; + otherwise, we end up computing 0/0, which produces a lethal NaN. + We can get an a=b=0 situation if an error weight is 0 in the wrong place. + */ + + float step; + float a = (error_change_up + error_change_down) * 2.0f; + float b = error_change_down - error_change_up; + if (fabs(b) >= a) + { + if (a <= 0.0f) + { + if (error_change_up < error_change_down) + step = 1; + else if (error_change_up > error_change_down) + step = -1; + + else + step = 0; + + } + else + { + if (a < 1e-10f) + a = 1e-10f; + step = b / a; + if (step < -1.0f) + step = -1.0f; + else if (step > 1.0f) + step = 1.0f; + } + } + else + step = b / a; + + + step *= stepsize; + float new_weight_val = weight_val + step; + + // update the weight + weight_set[i] = new_weight_val; + // update the infilled-weights + int num_weights = it->weight_num_texels[i]; + float perturbation = (new_weight_val - weight_val) * (1.0f / TEXEL_WEIGHT_SUM); + const uint8_t *weight_texel_ptr = it->weight_texel[i]; + const float *weights_ptr = it->weights_flt[i]; + for (k = num_weights - 1; k >= 0; k--) + { + uint8_t weight_texel = weight_texel_ptr[k]; + float weight_weight = weights_ptr[k]; + infilled_weights[weight_texel] += perturbation * weight_weight; + } + + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("\n"); + #endif + } + + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Error weights, initial-estimates, final-results\n"); + for (i = 0; i < weight_count; i++) + { + printf("%2d -> weight=%g, initial=%g final=%g\n", i, weights[i], initial_weight_set[i], weight_set[i]); + } + printf("\n"); + } + #endif + + return; +} + + + + +/* + For a decimation table, try to compute an optimal weight set, assuming + that the weights are quantized and subject to a transfer function. + + We do this as follows: + First, we take the initial weights and quantize them. This is our initial estimate. + Then, go through the weights one by one; try to perturb then up and down one weight at a + time; apply any perturbations that improve overall error + Repeat until we have made a complete processing pass over all weights without + triggering any perturbations *OR* we have run 4 full passes. +*/ + +void compute_ideal_quantized_weights_for_decimation_table(const endpoints_and_weights * eai, + const decimation_table * it, + float low_bound, float high_bound, const float *weight_set_in, float *weight_set_out, uint8_t * quantized_weight_set, int quantization_level) +{ + int i; + int weight_count = it->num_weights; + int texels_per_block = it->num_texels; + + const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[quantization_level]); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : texels-per-block=%d, weights=%d, quantization-level=%d\n\n", __func__, texels_per_block, weight_count, quantization_level); + + printf("Weight values before quantization:\n"); + for (i = 0; i < weight_count; i++) + printf("%3d : %g\n", i, weight_set_in[i]); + + printf("Low-bound: %f High-bound: %f\n", low_bound, high_bound); + } + #endif + + + // quantize the weight set using both the specified low/high bounds and the + // standard 0..1 weight bounds. + + /* + WTF issue that we need to examine some time + */ + + if (!((high_bound - low_bound) > 0.5f)) + { + low_bound = 0.0f; + high_bound = 1.0f; + } + + float rscale = high_bound - low_bound; + float scale = 1.0f / rscale; + + // rescale the weights so that + // low_bound -> 0 + // high_bound -> 1 + // OK: first, subtract low_bound, then divide by (high_bound - low_bound) + + for (i = 0; i < weight_count; i++) + weight_set_out[i] = (weight_set_in[i] - low_bound) * scale; + + + + static const float quantization_step_table[12] = { + 1.0f / 1.0f, + 1.0f / 2.0f, + 1.0f / 3.0f, + 1.0f / 4.0f, + 1.0f / 5.0f, + 1.0f / 7.0f, + 1.0f / 9.0f, + 1.0f / 11.0f, + 1.0f / 15.0f, + 1.0f / 19.0f, + 1.0f / 23.0f, + 1.0f / 31.0f, + }; + + float quantization_cutoff = quantization_step_table[quantization_level] * 0.333f; + + + int is_perturbable[MAX_WEIGHTS_PER_BLOCK]; + int perturbable_count = 0; + + // quantize the weight set + for (i = 0; i < weight_count; i++) + { + float ix0 = weight_set_out[i]; + if (ix0 < 0.0f) + ix0 = 0.0f; + if (ix0 > 1.0f) + ix0 = 1.0f; + float ix = ix0; + + ix *= 1024.0f; + int ix2 = (int)floor(ix + 0.5f); + int weight = qat->closest_quantized_weight[ix2]; + + ix = qat->unquantized_value_flt[weight]; + weight_set_out[i] = ix; + quantized_weight_set[i] = weight; + + // test whether the error of the weight is greater than 1/3 of the weight spacing; + // if it is not, then it is flagged as "not perturbable". This causes a + // quality loss of about 0.002 dB, which is totally worth the speedup we're getting. + is_perturbable[i] = 0; + if (fabs(ix - ix0) > quantization_cutoff) + { + is_perturbable[i] = 1; + perturbable_count++; + } + } + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Weight values after initial quantization:\n"); + for (i = 0; i < weight_count; i++) + printf("%3d : %g <%d>\n", i, weight_set_out[i], quantized_weight_set[i]); + } + #endif + + + + + // if the decimation table is complete, the quantization above was all we needed to do, + // so we can early-out. + if (it->num_weights == it->num_texels) + { + // invert the weight-scaling that was done initially + // 0 -> low_bound + // 1 -> high_bound + + rscale = high_bound - low_bound; + for (i = 0; i < weight_count; i++) + weight_set_out[i] = (weight_set_out[i] * rscale) + low_bound; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Weight values after adjustment:\n"); + for (i = 0; i < weight_count; i++) + printf("%3d : %g <%d> \n", i, weight_set_out[i], quantized_weight_set[i], weight_set_out[i] - weight_set_in[i]); + printf("\n"); + printf("%s: Early-out\n\n", __func__); + + } + #endif + + return; + } + + + int weights_tested = 0; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + int perturbation_count = 0; + #endif + + // if no weights are flagged as perturbable, don't try to perturb them. + // if only one weight is flagged as perturbable, perturbation is also pointless. + if (perturbable_count > 1) + { + endpoints_and_weights eaix; + for (i = 0; i < texels_per_block; i++) + { + eaix.weights[i] = (eai->weights[i] - low_bound) * scale; + eaix.weight_error_scale[i] = eai->weight_error_scale[i]; + } + + float infilled_weights[MAX_TEXELS_PER_BLOCK]; + for (i = 0; i < texels_per_block; i++) + infilled_weights[i] = compute_value_of_texel_flt(i, it, weight_set_out); + + int weight_to_perturb = 0; + int weights_since_last_perturbation = 0; + int num_weights = it->num_weights; + + while (weights_since_last_perturbation < num_weights && weights_tested < num_weights * 4) + { + int do_quant_mod = 0; + if (is_perturbable[weight_to_perturb]) + { + + int weight_val = quantized_weight_set[weight_to_perturb]; + int weight_next_up = qat->next_quantized_value[weight_val]; + int weight_next_down = qat->prev_quantized_value[weight_val]; + float flt_weight_val = qat->unquantized_value_flt[weight_val]; + float flt_weight_next_up = qat->unquantized_value_flt[weight_next_up]; + float flt_weight_next_down = qat->unquantized_value_flt[weight_next_down]; + + + int do_quant_mod = 0; + + float error_change_up, error_change_down; + + // compute the error change from perturbing the weight either up or down. + compute_two_error_changes_from_perturbing_weight_infill(&eaix, + it, + infilled_weights, + weight_to_perturb, + (flt_weight_next_up - flt_weight_val), (flt_weight_next_down - flt_weight_val), &error_change_up, &error_change_down); + + int new_weight_val; + float flt_new_weight_val; + if (weight_val != weight_next_up && error_change_up < 0.0f) + { + do_quant_mod = 1; + new_weight_val = weight_next_up; + flt_new_weight_val = flt_weight_next_up; + } + else if (weight_val != weight_next_down && error_change_down < 0.0f) + { + do_quant_mod = 1; + new_weight_val = weight_next_down; + flt_new_weight_val = flt_weight_next_down; + } + + + if (do_quant_mod) + { + + // update the weight. + weight_set_out[weight_to_perturb] = flt_new_weight_val; + quantized_weight_set[weight_to_perturb] = new_weight_val; + + // update the infilled-weights + int num_weights = it->weight_num_texels[weight_to_perturb]; + float perturbation = (flt_new_weight_val - flt_weight_val) * (1.0f / TEXEL_WEIGHT_SUM); + const uint8_t *weight_texel_ptr = it->weight_texel[weight_to_perturb]; + const float *weights_ptr = it->weights_flt[weight_to_perturb]; + for (i = num_weights - 1; i >= 0; i--) + { + uint8_t weight_texel = weight_texel_ptr[i]; + float weights = weights_ptr[i]; + infilled_weights[weight_texel] += perturbation * weights; + } + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Perturbation of weight %d : %g\n", weight_to_perturb, perturbation * (float)TEXEL_WEIGHT_SUM); + perturbation_count++; + } + #endif + } + } + + if (do_quant_mod) + weights_since_last_perturbation = 0; + else + weights_since_last_perturbation++; + + weight_to_perturb++; + if (weight_to_perturb >= num_weights) + weight_to_perturb -= num_weights; + + weights_tested++; + } + } + + // invert the weight-scaling that was done initially + // 0 -> low_bound + // 1 -> high_bound + + + for (i = 0; i < weight_count; i++) + weight_set_out[i] = (weight_set_out[i] * rscale) + low_bound; + + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%d weights, %d weight tests, %d perturbations\n", weight_count, weights_tested, perturbation_count); + printf("Weight values after adjustment:\n"); + for (i = 0; i < weight_count; i++) + printf("%3d : %g <%d>\n", i, weight_set_out[i], quantized_weight_set[i]); + printf("\n"); + } + #endif + +} + + + + + + +static inline float mat_square_sum(mat2 p) +{ + float a = p.v[0].x; + float b = p.v[0].y; + float c = p.v[1].x; + float d = p.v[1].y; + return a * a + b * b + c * c + d * d; +} + + + + + + + + + + +/* + for a given weight set, we wish to recompute the colors so that they are optimal for a particular weight set. */ +void recompute_ideal_colors(int xdim, int ydim, int zdim, int weight_quantization_mode, endpoints * ep, // contains the endpoints we wish to update + float4 * rgbs_vectors, // used to return RGBS-vectors. (endpoint mode #6) + float4 * rgbo_vectors, // used to return RGBO-vectors. (endpoint mode #7) + float2 * lum_vectors, // used to return luminance-vectors. + const uint8_t * weight_set8, // the current set of weight values + const uint8_t * plane2_weight_set8, // NULL if plane 2 is not actually used. + int plane2_color_component, // color component for 2nd plane of weights; -1 if the 2nd plane of weights is not present + const partition_info * pi, const decimation_table * it, const imageblock * pb, // picture-block containing the actual data. + const error_weight_block * ewb) +{ + int i, j; + + int texels_per_block = xdim * ydim * zdim; + + const quantization_and_transfer_table *qat = &(quant_and_xfer_tables[weight_quantization_mode]); + + float weight_set[MAX_WEIGHTS_PER_BLOCK]; + float plane2_weight_set[MAX_WEIGHTS_PER_BLOCK]; + + for (i = 0; i < it->num_weights; i++) + { + weight_set[i] = qat->unquantized_value_flt[weight_set8[i]]; + } + if (plane2_weight_set8) + { + for (i = 0; i < it->num_weights; i++) + plane2_weight_set[i] = qat->unquantized_value_flt[plane2_weight_set8[i]]; + } + + int partition_count = pi->partition_count; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : %dx%dx%d texels_per_block, %d partitions, plane2-color-component=%d\n\n", __func__, xdim, ydim, zdim, partition_count, plane2_color_component); + + printf("Pre-adjustment endpoint-colors: \n"); + for (i = 0; i < partition_count; i++) + { + printf("%d Low <%g %g %g %g>\n", i, ep->endpt0[i].x, ep->endpt0[i].y, ep->endpt0[i].z, ep->endpt0[i].w); + printf("%d High <%g %g %g %g>\n", i, ep->endpt1[i].x, ep->endpt1[i].y, ep->endpt1[i].z, ep->endpt1[i].w); + } + } + #endif + + + mat2 pmat1_red[4], pmat1_green[4], pmat1_blue[4], pmat1_alpha[4], pmat1_lum[4], pmat1_scale[4]; // matrices for plane of weights 1 + mat2 pmat2_red[4], pmat2_green[4], pmat2_blue[4], pmat2_alpha[4]; // matrices for plane of weights 2 + float2 red_vec[4]; + float2 green_vec[4]; + float2 blue_vec[4]; + float2 alpha_vec[4]; + float2 lum_vec[4]; + float2 scale_vec[4]; + + for (i = 0; i < partition_count; i++) + { + for (j = 0; j < 2; j++) + { + pmat1_red[i].v[j] = float2(0, 0); + pmat2_red[i].v[j] = float2(0, 0); + pmat1_green[i].v[j] = float2(0, 0); + pmat2_green[i].v[j] = float2(0, 0); + pmat1_blue[i].v[j] = float2(0, 0); + pmat2_blue[i].v[j] = float2(0, 0); + pmat1_alpha[i].v[j] = float2(0, 0); + pmat2_alpha[i].v[j] = float2(0, 0); + pmat1_lum[i].v[j] = float2(0, 0); + pmat1_scale[i].v[j] = float2(0, 0); + } + red_vec[i] = float2(0, 0); + green_vec[i] = float2(0, 0); + blue_vec[i] = float2(0, 0); + alpha_vec[i] = float2(0, 0); + lum_vec[i] = float2(0, 0); + scale_vec[i] = float2(0, 0); + } + + + float wmin1[4], wmax1[4]; + float wmin2[4], wmax2[4]; + float red_weight_sum[4]; + float green_weight_sum[4]; + float blue_weight_sum[4]; + float alpha_weight_sum[4]; + float lum_weight_sum[4]; + float scale_weight_sum[4]; + + float red_weight_weight_sum[4]; + float green_weight_weight_sum[4]; + float blue_weight_weight_sum[4]; + + float psum[4]; // sum of (weight * qweight^2) across (red,green,blue) + float qsum[4]; // sum of (weight * qweight * texelval) across (red,green,blue) + + + for (i = 0; i < partition_count; i++) + { + wmin1[i] = 1.0f; + wmax1[i] = 0.0f; + wmin2[i] = 1.0f; + wmax2[i] = 0.0f; + red_weight_sum[i] = 1e-17f; + green_weight_sum[i] = 1e-17f; + blue_weight_sum[i] = 1e-17f; + alpha_weight_sum[i] = 1e-17f; + + lum_weight_sum[i] = 1e-17f; + scale_weight_sum[i] = 1e-17f; + + red_weight_weight_sum[i] = 1e-17f; + green_weight_weight_sum[i] = 1e-17f; + blue_weight_weight_sum[i] = 1e-17f; + + psum[i] = 1e-17f; + qsum[i] = 1e-17f; + } + + + // for each partition, compute the direction that an RGB-scale color endpoint pair would have. + float3 rgb_sum[4]; + float3 rgb_weight_sum[4]; + float3 scale_directions[4]; + float scale_min[4]; + float scale_max[4]; + float lum_min[4]; + float lum_max[4]; + + for (i = 0; i < partition_count; i++) + { + rgb_sum[i] = float3(1e-17f, 1e-17f, 1e-17f); + rgb_weight_sum[i] = float3(1e-17f, 1e-17f, 1e-17f); + } + + + for (i = 0; i < texels_per_block; i++) + { + float3 rgb = float3(pb->work_data[4 * i], pb->work_data[4 * i + 1], pb->work_data[4 * i + 2]); + float3 rgb_weight = float3(ewb->texel_weight_r[i], + ewb->texel_weight_g[i], + ewb->texel_weight_b[i]); + + int part = pi->partition_of_texel[i]; + rgb_sum[part] = rgb_sum[part] + (rgb * rgb_weight); + rgb_weight_sum[part] = rgb_weight_sum[part] + rgb_weight; + } + + for (i = 0; i < partition_count; i++) + { + scale_directions[i] = normalize(rgb_sum[i] / rgb_weight_sum[i]); + scale_max[i] = 0.0f; + scale_min[i] = 1e10f; + lum_max[i] = 0.0f; + lum_min[i] = 1e10f; + } + + + + + + for (i = 0; i < texels_per_block; i++) + { + float r = pb->work_data[4 * i]; + float g = pb->work_data[4 * i + 1]; + float b = pb->work_data[4 * i + 2]; + float a = pb->work_data[4 * i + 3]; + + int part = pi->partition_of_texel[i]; + float idx0 = it ? compute_value_of_texel_flt(i, it, weight_set) : weight_set[i]; + float om_idx0 = 1.0f - idx0; + + if (idx0 > wmax1[part]) + wmax1[part] = idx0; + if (idx0 < wmin1[part]) + wmin1[part] = idx0; + + float red_weight = ewb->texel_weight_r[i]; + float green_weight = ewb->texel_weight_g[i]; + float blue_weight = ewb->texel_weight_b[i]; + float alpha_weight = ewb->texel_weight_a[i]; + + float lum_weight = (red_weight + green_weight + blue_weight); + float scale_weight = lum_weight; + + float lum = (r * red_weight + g * green_weight + b * blue_weight) / lum_weight; + float3 scale_direction = scale_directions[part]; + float scale = dot(scale_direction, float3(r, g, b)); + if (lum < lum_min[part]) + lum_min[part] = scale; + if (lum > lum_max[part]) + lum_max[part] = scale; + if (scale < scale_min[part]) + scale_min[part] = scale; + if (scale > scale_max[part]) + scale_max[part] = scale; + + + red_weight_sum[part] += red_weight; + green_weight_sum[part] += green_weight; + blue_weight_sum[part] += blue_weight; + alpha_weight_sum[part] += alpha_weight; + lum_weight_sum[part] += lum_weight; + scale_weight_sum[part] += scale_weight; + + + pmat1_red[part].v[0].x += om_idx0 * om_idx0 * red_weight; + pmat1_red[part].v[0].y += idx0 * om_idx0 * red_weight; + pmat1_red[part].v[1].x += idx0 * om_idx0 * red_weight; + pmat1_red[part].v[1].y += idx0 * idx0 * red_weight; + + pmat1_green[part].v[0].x += om_idx0 * om_idx0 * green_weight; + pmat1_green[part].v[0].y += idx0 * om_idx0 * green_weight; + pmat1_green[part].v[1].x += idx0 * om_idx0 * green_weight; + pmat1_green[part].v[1].y += idx0 * idx0 * green_weight; + + pmat1_blue[part].v[0].x += om_idx0 * om_idx0 * blue_weight; + pmat1_blue[part].v[0].y += idx0 * om_idx0 * blue_weight; + pmat1_blue[part].v[1].x += idx0 * om_idx0 * blue_weight; + pmat1_blue[part].v[1].y += idx0 * idx0 * blue_weight; + + pmat1_alpha[part].v[0].x += om_idx0 * om_idx0 * alpha_weight; + pmat1_alpha[part].v[0].y += idx0 * om_idx0 * alpha_weight; + pmat1_alpha[part].v[1].x += idx0 * om_idx0 * alpha_weight; + pmat1_alpha[part].v[1].y += idx0 * idx0 * alpha_weight; + + pmat1_lum[part].v[0].x += om_idx0 * om_idx0 * lum_weight; + pmat1_lum[part].v[0].y += idx0 * om_idx0 * lum_weight; + pmat1_lum[part].v[1].x += idx0 * om_idx0 * lum_weight; + pmat1_lum[part].v[1].y += idx0 * idx0 * lum_weight; + + pmat1_scale[part].v[0].x += om_idx0 * om_idx0 * scale_weight; + pmat1_scale[part].v[0].y += idx0 * om_idx0 * scale_weight; + pmat1_scale[part].v[1].x += idx0 * om_idx0 * scale_weight; + pmat1_scale[part].v[1].y += idx0 * idx0 * scale_weight; + + float idx1 = 0.0f, om_idx1 = 0.0f; + if (plane2_weight_set8) + { + idx1 = it ? compute_value_of_texel_flt(i, it, plane2_weight_set) : plane2_weight_set[i]; + om_idx1 = 1.0f - idx1; + if (idx1 > wmax2[part]) + wmax2[part] = idx1; + if (idx1 < wmin2[part]) + wmin2[part] = idx1; + + pmat2_red[part].v[0].x += om_idx1 * om_idx1 * red_weight; + pmat2_red[part].v[0].y += idx1 * om_idx1 * red_weight; + pmat2_red[part].v[1].x += idx1 * om_idx1 * red_weight; + pmat2_red[part].v[1].y += idx1 * idx1 * red_weight; + + pmat2_green[part].v[0].x += om_idx1 * om_idx1 * green_weight; + pmat2_green[part].v[0].y += idx1 * om_idx1 * green_weight; + pmat2_green[part].v[1].x += idx1 * om_idx1 * green_weight; + pmat2_green[part].v[1].y += idx1 * idx1 * green_weight; + + pmat2_blue[part].v[0].x += om_idx1 * om_idx1 * blue_weight; + pmat2_blue[part].v[0].y += idx1 * om_idx1 * blue_weight; + pmat2_blue[part].v[1].x += idx1 * om_idx1 * blue_weight; + pmat2_blue[part].v[1].y += idx1 * idx1 * blue_weight; + + pmat2_alpha[part].v[0].x += om_idx1 * om_idx1 * alpha_weight; + pmat2_alpha[part].v[0].y += idx1 * om_idx1 * alpha_weight; + pmat2_alpha[part].v[1].x += idx1 * om_idx1 * alpha_weight; + pmat2_alpha[part].v[1].y += idx1 * idx1 * alpha_weight; + } + + float red_idx = (plane2_color_component == 0) ? idx1 : idx0; + float green_idx = (plane2_color_component == 1) ? idx1 : idx0; + float blue_idx = (plane2_color_component == 2) ? idx1 : idx0; + float alpha_idx = (plane2_color_component == 3) ? idx1 : idx0; + + + red_vec[part].x += (red_weight * r) * (1.0f - red_idx); + green_vec[part].x += (green_weight * g) * (1.0f - green_idx); + blue_vec[part].x += (blue_weight * b) * (1.0f - blue_idx); + alpha_vec[part].x += (alpha_weight * a) * (1.0f - alpha_idx); + lum_vec[part].x += (lum_weight * lum) * om_idx0; + scale_vec[part].x += (scale_weight * scale) * om_idx0; + + red_vec[part].y += (red_weight * r) * red_idx; + green_vec[part].y += (green_weight * g) * green_idx; + blue_vec[part].y += (blue_weight * b) * blue_idx; + alpha_vec[part].y += (alpha_weight * a) * alpha_idx; + lum_vec[part].y += (lum_weight * lum) * idx0; + scale_vec[part].y += (scale_weight * scale) * idx0; + + red_weight_weight_sum[part] += red_weight * red_idx; + green_weight_weight_sum[part] += green_weight * green_idx; + blue_weight_weight_sum[part] += blue_weight * blue_idx; + + psum[part] += red_weight * red_idx * red_idx + green_weight * green_idx * green_idx + blue_weight * blue_idx * blue_idx; + + } + + // calculations specific to mode #7, the HDR RGB-scale mode. + float red_sum[4]; + float green_sum[4]; + float blue_sum[4]; + for (i = 0; i < partition_count; i++) + { + red_sum[i] = red_vec[i].x + red_vec[i].y; + green_sum[i] = green_vec[i].x + green_vec[i].y; + blue_sum[i] = blue_vec[i].x + blue_vec[i].y; + qsum[i] = red_vec[i].y + green_vec[i].y + blue_vec[i].y; + } + + // RGB+offset for HDR endpoint mode #7 + int rgbo_fail[4]; + for (i = 0; i < partition_count; i++) + { + mat4 mod7_mat; + mod7_mat.v[0] = float4(red_weight_sum[i], 0.0f, 0.0f, red_weight_weight_sum[i]); + mod7_mat.v[1] = float4(0.0f, green_weight_sum[i], 0.0f, green_weight_weight_sum[i]); + mod7_mat.v[2] = float4(0.0f, 0.0f, blue_weight_sum[i], blue_weight_weight_sum[i]); + mod7_mat.v[3] = float4(red_weight_weight_sum[i], green_weight_weight_sum[i], blue_weight_weight_sum[i], psum[i]); + + float4 vect = float4(red_sum[i], green_sum[i], blue_sum[i], qsum[i]); + + #ifdef DEBUG_CAPTURE_NAN + fedisableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + mat4 rmod7_mat = invert(mod7_mat); + float4 rgbovec = transform(rmod7_mat, vect); + rgbo_vectors[i] = rgbovec; + + // we will occasionally get a failure due to a singular matrix. Record whether such a + // failure has taken place; if it did, compute rgbo_vectors[] with a different method + // later on. + float chkval = dot(rgbovec, rgbovec); + rgbo_fail[i] = chkval != chkval; + + #ifdef DEBUG_CAPTURE_NAN + feenableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + } + + + + // initialize the luminance and scale vectors with a reasonable default, + // just in case the subsequent calculation blows up. + for (i = 0; i < partition_count; i++) + { + + #ifdef DEBUG_CAPTURE_NAN + fedisableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + float scalediv = scale_min[i] / scale_max[i]; + if (!(scalediv > 0.0f)) + scalediv = 0.0f; // set to zero if scalediv is zero, negative, or NaN. + + #ifdef DEBUG_CAPTURE_NAN + feenableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + if (scalediv > 1.0f) + scalediv = 1.0f; + + rgbs_vectors[i] = float4(scale_directions[i] * scale_max[i], scalediv); + lum_vectors[i] = float2(lum_min[i], lum_max[i]); + } + + + + for (i = 0; i < partition_count; i++) + { + + if (wmin1[i] >= wmax1[i] * 0.999) + { + // if all weights in the partition were equal, then just take average + // of all colors in the partition and use that as both endpoint colors. + float4 avg = float4((red_vec[i].x + red_vec[i].y) / red_weight_sum[i], + (green_vec[i].x + green_vec[i].y) / green_weight_sum[i], + (blue_vec[i].x + blue_vec[i].y) / blue_weight_sum[i], + (alpha_vec[i].x + alpha_vec[i].y) / alpha_weight_sum[i]); + + if (plane2_color_component != 0 && avg.x == avg.x) + ep->endpt0[i].x = ep->endpt1[i].x = avg.x; + if (plane2_color_component != 1 && avg.y == avg.y) + ep->endpt0[i].y = ep->endpt1[i].y = avg.y; + if (plane2_color_component != 2 && avg.z == avg.z) + ep->endpt0[i].z = ep->endpt1[i].z = avg.z; + if (plane2_color_component != 3 && avg.w == avg.w) + ep->endpt0[i].w = ep->endpt1[i].w = avg.w; + + rgbs_vectors[i] = float4(scale_directions[i] * scale_max[i], 1.0f); + float lumval = (red_vec[i].x + red_vec[i].y + green_vec[i].x + green_vec[i].y + blue_vec[i].x + blue_vec[i].y) / (red_weight_sum[i] + green_weight_sum[i] + blue_weight_sum[i]); + lum_vectors[i] = float2(lumval, lumval); + } + + else + { + + // otherwise, complete the analytic calculation of ideal-endpoint-values + // for the given set of texel weights and pixel colors. + + #ifdef DEBUG_CAPTURE_NAN + fedisableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + float red_det1 = determinant(pmat1_red[i]); + float green_det1 = determinant(pmat1_green[i]); + float blue_det1 = determinant(pmat1_blue[i]); + float alpha_det1 = determinant(pmat1_alpha[i]); + float lum_det1 = determinant(pmat1_lum[i]); + float scale_det1 = determinant(pmat1_scale[i]); + + float red_mss1 = mat_square_sum(pmat1_red[i]); + float green_mss1 = mat_square_sum(pmat1_green[i]); + float blue_mss1 = mat_square_sum(pmat1_blue[i]); + float alpha_mss1 = mat_square_sum(pmat1_alpha[i]); + float lum_mss1 = mat_square_sum(pmat1_lum[i]); + float scale_mss1 = mat_square_sum(pmat1_scale[i]); + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Plane-1 partition %d determinants: R=%g G=%g B=%g A=%g L=%g S=%g\n", i, red_det1, green_det1, blue_det1, alpha_det1, lum_det1, scale_det1); + #endif + + pmat1_red[i] = invert(pmat1_red[i]); + pmat1_green[i] = invert(pmat1_green[i]); + pmat1_blue[i] = invert(pmat1_blue[i]); + pmat1_alpha[i] = invert(pmat1_alpha[i]); + pmat1_lum[i] = invert(pmat1_lum[i]); + pmat1_scale[i] = invert(pmat1_scale[i]); + + float4 ep0 = float4(dot(pmat1_red[i].v[0], red_vec[i]), + dot(pmat1_green[i].v[0], green_vec[i]), + dot(pmat1_blue[i].v[0], blue_vec[i]), + dot(pmat1_alpha[i].v[0], alpha_vec[i])); + float4 ep1 = float4(dot(pmat1_red[i].v[1], red_vec[i]), + dot(pmat1_green[i].v[1], green_vec[i]), + dot(pmat1_blue[i].v[1], blue_vec[i]), + dot(pmat1_alpha[i].v[1], alpha_vec[i])); + + float lum_ep0 = dot(pmat1_lum[i].v[0], lum_vec[i]); + float lum_ep1 = dot(pmat1_lum[i].v[1], lum_vec[i]); + float scale_ep0 = dot(pmat1_scale[i].v[0], scale_vec[i]); + float scale_ep1 = dot(pmat1_scale[i].v[1], scale_vec[i]); + + + if (plane2_color_component != 0 && fabs(red_det1) > (red_mss1 * 1e-4f) && ep0.x == ep0.x && ep1.x == ep1.x) + { + ep->endpt0[i].x = ep0.x; + ep->endpt1[i].x = ep1.x; + } + if (plane2_color_component != 1 && fabs(green_det1) > (green_mss1 * 1e-4f) && ep0.y == ep0.y && ep1.y == ep1.y) + { + ep->endpt0[i].y = ep0.y; + ep->endpt1[i].y = ep1.y; + } + if (plane2_color_component != 2 && fabs(blue_det1) > (blue_mss1 * 1e-4f) && ep0.z == ep0.z && ep1.z == ep1.z) + { + ep->endpt0[i].z = ep0.z; + ep->endpt1[i].z = ep1.z; + } + if (plane2_color_component != 3 && fabs(alpha_det1) > (alpha_mss1 * 1e-4f) && ep0.w == ep0.w && ep1.w == ep1.w) + { + ep->endpt0[i].w = ep0.w; + ep->endpt1[i].w = ep1.w; + } + + if (fabs(lum_det1) > (lum_mss1 * 1e-4f) && lum_ep0 == lum_ep0 && lum_ep1 == lum_ep1 && lum_ep0 < lum_ep1) + { + lum_vectors[i].x = lum_ep0; + lum_vectors[i].y = lum_ep1; + } + if (fabs(scale_det1) > (scale_mss1 * 1e-4f) && scale_ep0 == scale_ep0 && scale_ep1 == scale_ep1 && scale_ep0 < scale_ep1) + { + float scalediv = scale_ep0 / scale_ep1; + rgbs_vectors[i] = float4(scale_directions[i] * scale_ep1, scalediv); + } + + + #ifdef DEBUG_CAPTURE_NAN + feenableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + } + + if (plane2_weight_set8) + { + if (wmin2[i] >= wmax2[i] * 0.999) + { + // if all weights in the partition were equal, then just take average + // of all colors in the partition and use that as both endpoint colors. + float4 avg = float4((red_vec[i].x + red_vec[i].y) / red_weight_sum[i], + (green_vec[i].x + green_vec[i].y) / green_weight_sum[i], + (blue_vec[i].x + blue_vec[i].y) / blue_weight_sum[i], + (alpha_vec[i].x + alpha_vec[i].y) / alpha_weight_sum[i]); + + if (plane2_color_component == 0 && avg.x == avg.x) + ep->endpt0[i].x = ep->endpt1[i].x = avg.x; + if (plane2_color_component == 1 && avg.y == avg.y) + ep->endpt0[i].y = ep->endpt1[i].y = avg.y; + if (plane2_color_component == 2 && avg.z == avg.z) + ep->endpt0[i].z = ep->endpt1[i].z = avg.z; + if (plane2_color_component == 3 && avg.w == avg.w) + ep->endpt0[i].w = ep->endpt1[i].w = avg.w; + } + else + { + + #ifdef DEBUG_CAPTURE_NAN + fedisableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + // otherwise, complete the analytic calculation of ideal-endpoint-values + // for the given set of texel weights and pixel colors. + float red_det2 = determinant(pmat2_red[i]); + float green_det2 = determinant(pmat2_green[i]); + float blue_det2 = determinant(pmat2_blue[i]); + float alpha_det2 = determinant(pmat2_alpha[i]); + + float red_mss2 = mat_square_sum(pmat2_red[i]); + float green_mss2 = mat_square_sum(pmat2_green[i]); + float blue_mss2 = mat_square_sum(pmat2_blue[i]); + float alpha_mss2 = mat_square_sum(pmat2_alpha[i]); + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("Plane-2 partition %d determinants: R=%g G=%g B=%g A=%g\n", i, red_det2, green_det2, blue_det2, alpha_det2); + #endif + + pmat2_red[i] = invert(pmat2_red[i]); + pmat2_green[i] = invert(pmat2_green[i]); + pmat2_blue[i] = invert(pmat2_blue[i]); + pmat2_alpha[i] = invert(pmat2_alpha[i]); + float4 ep0 = float4(dot(pmat2_red[i].v[0], red_vec[i]), + dot(pmat2_green[i].v[0], green_vec[i]), + dot(pmat2_blue[i].v[0], blue_vec[i]), + dot(pmat2_alpha[i].v[0], alpha_vec[i])); + float4 ep1 = float4(dot(pmat2_red[i].v[1], red_vec[i]), + dot(pmat2_green[i].v[1], green_vec[i]), + dot(pmat2_blue[i].v[1], blue_vec[i]), + dot(pmat2_alpha[i].v[1], alpha_vec[i])); + + if (plane2_color_component == 0 && fabs(red_det2) > (red_mss2 * 1e-4f) && ep0.x == ep0.x && ep1.x == ep1.x) + { + ep->endpt0[i].x = ep0.x; + ep->endpt1[i].x = ep1.x; + } + if (plane2_color_component == 1 && fabs(green_det2) > (green_mss2 * 1e-4f) && ep0.y == ep0.y && ep1.y == ep1.y) + { + ep->endpt0[i].y = ep0.y; + ep->endpt1[i].y = ep1.y; + } + if (plane2_color_component == 2 && fabs(blue_det2) > (blue_mss2 * 1e-4f) && ep0.z == ep0.z && ep1.z == ep1.z) + { + ep->endpt0[i].z = ep0.z; + ep->endpt1[i].z = ep1.z; + } + if (plane2_color_component == 3 && fabs(alpha_det2) > (alpha_mss2 * 1e-4f) && ep0.w == ep0.w && ep1.w == ep1.w) + { + ep->endpt0[i].w = ep0.w; + ep->endpt1[i].w = ep1.w; + } + + #ifdef DEBUG_CAPTURE_NAN + feenableexcept(FE_DIVBYZERO | FE_INVALID); + #endif + + } + } + } + + // if the calculation of an RGB-offset vector failed, try to compute + // a somewhat-sensible value anyway + for (i = 0; i < partition_count; i++) + if (rgbo_fail[i]) + { + float4 v0 = ep->endpt0[i]; + float4 v1 = ep->endpt1[i]; + float avgdif = dot(v1.xyz - v0.xyz, float3(1, 1, 1)) * (1.0f / 3.0f); + if (avgdif <= 0.0f) + avgdif = 0.0f; + float4 avg = (v0 + v1) * 0.5f; + float4 ep0 = avg - float4(avgdif, avgdif, avgdif, avgdif) * 0.5f; + + rgbo_vectors[i] = float4(ep0.xyz, avgdif); + } + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("Post-adjustment endpoint-colors: \n"); + for (i = 0; i < partition_count; i++) + { + printf("%d Low <%g %g %g %g>\n", i, ep->endpt0[i].x, ep->endpt0[i].y, ep->endpt0[i].z, ep->endpt0[i].w); + printf("%d High <%g %g %g %g>\n", i, ep->endpt1[i].x, ep->endpt1[i].y, ep->endpt1[i].z, ep->endpt1[i].w); + + printf("%d RGBS: <%g %g %g %g>\n", i, rgbs_vectors[i].x, rgbs_vectors[i].y, rgbs_vectors[i].z, rgbs_vectors[i].w); + + printf("%d RGBO <%g %g %g %g>\n", i, rgbo_vectors[i].x, rgbo_vectors[i].y, rgbo_vectors[i].z, rgbo_vectors[i].w); + + printf("%d Lum: <%g %g>\n", i, lum_vectors[i].x, lum_vectors[i].y); + } + } + #endif + +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_imageblock.cpp b/3rdparty/bimg/3rdparty/astc/astc_imageblock.cpp new file mode 100644 index 00000000000..8740b4cb037 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_imageblock.cpp @@ -0,0 +1,324 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions for managing ASTC codec images. + */ +/*----------------------------------------------------------------------------*/ + +#include + +#include "astc_codec_internals.h" + +#include "softfloat.h" +#include +#include + +// conversion functions between the LNS representation and the FP16 representation. + +float float_to_lns(float p) +{ + + if (astc_isnan(p) || p <= 1.0f / 67108864.0f) + { + // underflow or NaN value, return 0. + // We count underflow if the input value is smaller than 2^-26. + return 0; + } + + if (fabs(p) >= 65536.0f) + { + // overflow, return a +INF value + return 65535; + } + + int expo; + float normfrac = frexp(p, &expo); + float p1; + if (expo < -13) + { + // input number is smaller than 2^-14. In this case, multiply by 2^25. + p1 = p * 33554432.0f; + expo = 0; + } + else + { + expo += 14; + p1 = (normfrac - 0.5f) * 4096.0f; + } + + if (p1 < 384.0f) + p1 *= 4.0f / 3.0f; + else if (p1 <= 1408.0f) + p1 += 128.0f; + else + p1 = (p1 + 512.0f) * (4.0f / 5.0f); + + p1 += expo * 2048.0f; + return p1 + 1.0f; +} + + + +uint16_t lns_to_sf16(uint16_t p) +{ + + uint16_t mc = p & 0x7FF; + uint16_t ec = p >> 11; + uint16_t mt; + if (mc < 512) + mt = 3 * mc; + else if (mc < 1536) + mt = 4 * mc - 512; + else + mt = 5 * mc - 2048; + + uint16_t res = (ec << 10) | (mt >> 3); + if (res >= 0x7BFF) + res = 0x7BFF; + return res; +} + + +// conversion function from 16-bit LDR value to FP16. +// note: for LDR interpolation, it is impossible to get a denormal result; +// this simplifies the conversion. +// FALSE; we can receive a very small UNORM16 through the constant-block. +uint16_t unorm16_to_sf16(uint16_t p) +{ + if (p == 0xFFFF) + return 0x3C00; // value of 1.0 . + if (p < 4) + return p << 8; + + int lz = clz32(p) - 16; + p <<= (lz + 1); + p >>= 6; + p |= (14 - lz) << 10; + return p; +} + + + + + +void imageblock_initialize_deriv_from_work_and_orig(imageblock * pb, int pixelcount) +{ + int i; + + const float *fptr = pb->orig_data; + const float *wptr = pb->work_data; + float *dptr = pb->deriv_data; + + for (i = 0; i < pixelcount; i++) + { + + // compute derivatives for RGB first + if (pb->rgb_lns[i]) + { + float r = MAX(fptr[0], 6e-5f); + float g = MAX(fptr[1], 6e-5f); + float b = MAX(fptr[2], 6e-5f); + + float rderiv = (float_to_lns(r * 1.05f) - float_to_lns(r)) / (r * 0.05f); + float gderiv = (float_to_lns(g * 1.05f) - float_to_lns(g)) / (g * 0.05f); + float bderiv = (float_to_lns(b * 1.05f) - float_to_lns(b)) / (b * 0.05f); + + // the derivative may not actually take values smaller than 1/32 or larger than 2^25; + // if it does, we clamp it. + if (rderiv < (1.0f / 32.0f)) + rderiv = (1.0f / 32.0f); + else if (rderiv > 33554432.0f) + rderiv = 33554432.0f; + + if (gderiv < (1.0f / 32.0f)) + gderiv = (1.0f / 32.0f); + else if (gderiv > 33554432.0f) + gderiv = 33554432.0f; + + if (bderiv < (1.0f / 32.0f)) + bderiv = (1.0f / 32.0f); + else if (bderiv > 33554432.0f) + bderiv = 33554432.0f; + + dptr[0] = rderiv; + dptr[1] = gderiv; + dptr[2] = bderiv; + } + else + { + dptr[0] = 65535.0f; + dptr[1] = 65535.0f; + dptr[2] = 65535.0f; + } + + + // then compute derivatives for Alpha + if (pb->alpha_lns[i]) + { + float a = MAX(fptr[3], 6e-5f); + float aderiv = (float_to_lns(a * 1.05f) - float_to_lns(a)) / (a * 0.05f); + // the derivative may not actually take values smaller than 1/32 or larger than 2^25; + // if it does, we clamp it. + if (aderiv < (1.0f / 32.0f)) + aderiv = (1.0f / 32.0f); + else if (aderiv > 33554432.0f) + aderiv = 33554432.0f; + + dptr[3] = aderiv; + } + else + { + dptr[3] = 65535.0f; + } + + fptr += 4; + wptr += 4; + dptr += 4; + } +} + + + + +// helper function to initialize the work-data from the orig-data +void imageblock_initialize_work_from_orig(imageblock * pb, int pixelcount) +{ + int i; + float *fptr = pb->orig_data; + float *wptr = pb->work_data; + + for (i = 0; i < pixelcount; i++) + { + if (pb->rgb_lns[i]) + { + wptr[0] = float_to_lns(fptr[0]); + wptr[1] = float_to_lns(fptr[1]); + wptr[2] = float_to_lns(fptr[2]); + } + else + { + wptr[0] = fptr[0] * 65535.0f; + wptr[1] = fptr[1] * 65535.0f; + wptr[2] = fptr[2] * 65535.0f; + } + + if (pb->alpha_lns[i]) + { + wptr[3] = float_to_lns(fptr[3]); + } + else + { + wptr[3] = fptr[3] * 65535.0f; + } + fptr += 4; + wptr += 4; + } + + imageblock_initialize_deriv_from_work_and_orig(pb, pixelcount); +} + + + + +// helper function to initialize the orig-data from the work-data +void imageblock_initialize_orig_from_work(imageblock * pb, int pixelcount) +{ + int i; + float *fptr = pb->orig_data; + float *wptr = pb->work_data; + + for (i = 0; i < pixelcount; i++) + { + if (pb->rgb_lns[i]) + { + fptr[0] = sf16_to_float(lns_to_sf16((uint16_t) wptr[0])); + fptr[1] = sf16_to_float(lns_to_sf16((uint16_t) wptr[1])); + fptr[2] = sf16_to_float(lns_to_sf16((uint16_t) wptr[2])); + } + else + { + fptr[0] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[0])); + fptr[1] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[1])); + fptr[2] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[2])); + } + + if (pb->alpha_lns[i]) + { + fptr[3] = sf16_to_float(lns_to_sf16((uint16_t) wptr[3])); + } + else + { + fptr[3] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[3])); + } + + fptr += 4; + wptr += 4; + } + + imageblock_initialize_deriv_from_work_and_orig(pb, pixelcount); +} + + +/* + For an imageblock, update its flags. + + The updating is done based on work_data, not orig_data. +*/ +void update_imageblock_flags(imageblock * pb, int xdim, int ydim, int zdim) +{ + int i; + float red_min = 1e38f, red_max = -1e38f; + float green_min = 1e38f, green_max = -1e38f; + float blue_min = 1e38f, blue_max = -1e38f; + float alpha_min = 1e38f, alpha_max = -1e38f; + + int texels_per_block = xdim * ydim * zdim; + + int grayscale = 1; + + for (i = 0; i < texels_per_block; i++) + { + float red = pb->work_data[4 * i]; + float green = pb->work_data[4 * i + 1]; + float blue = pb->work_data[4 * i + 2]; + float alpha = pb->work_data[4 * i + 3]; + if (red < red_min) + red_min = red; + if (red > red_max) + red_max = red; + if (green < green_min) + green_min = green; + if (green > green_max) + green_max = green; + if (blue < blue_min) + blue_min = blue; + if (blue > blue_max) + blue_max = blue; + if (alpha < alpha_min) + alpha_min = alpha; + if (alpha > alpha_max) + alpha_max = alpha; + + if (grayscale == 1 && (red != green || red != blue)) + grayscale = 0; + } + + pb->red_min = red_min; + pb->red_max = red_max; + pb->green_min = green_min; + pb->green_max = green_max; + pb->blue_min = blue_min; + pb->blue_max = blue_max; + pb->alpha_min = alpha_min; + pb->alpha_max = alpha_max; + pb->grayscale = grayscale; +} + diff --git a/3rdparty/bimg/3rdparty/astc/astc_integer_sequence.cpp b/3rdparty/bimg/3rdparty/astc/astc_integer_sequence.cpp new file mode 100644 index 00000000000..58c706a96d8 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_integer_sequence.cpp @@ -0,0 +1,649 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions to encode/decode data using Bounded Integer Sequence + * Encoding. + */ +/*----------------------------------------------------------------------------*/ +#include "astc_codec_internals.h" + // unpacked quint triplets for each packed-quint value +static const uint8_t quints_of_integer[128][3] = { + {0, 0, 0}, {1, 0, 0}, {2, 0, 0}, {3, 0, 0}, + {4, 0, 0}, {0, 4, 0}, {4, 4, 0}, {4, 4, 4}, + {0, 1, 0}, {1, 1, 0}, {2, 1, 0}, {3, 1, 0}, + {4, 1, 0}, {1, 4, 0}, {4, 4, 1}, {4, 4, 4}, + {0, 2, 0}, {1, 2, 0}, {2, 2, 0}, {3, 2, 0}, + {4, 2, 0}, {2, 4, 0}, {4, 4, 2}, {4, 4, 4}, + {0, 3, 0}, {1, 3, 0}, {2, 3, 0}, {3, 3, 0}, + {4, 3, 0}, {3, 4, 0}, {4, 4, 3}, {4, 4, 4}, + {0, 0, 1}, {1, 0, 1}, {2, 0, 1}, {3, 0, 1}, + {4, 0, 1}, {0, 4, 1}, {4, 0, 4}, {0, 4, 4}, + {0, 1, 1}, {1, 1, 1}, {2, 1, 1}, {3, 1, 1}, + {4, 1, 1}, {1, 4, 1}, {4, 1, 4}, {1, 4, 4}, + {0, 2, 1}, {1, 2, 1}, {2, 2, 1}, {3, 2, 1}, + {4, 2, 1}, {2, 4, 1}, {4, 2, 4}, {2, 4, 4}, + {0, 3, 1}, {1, 3, 1}, {2, 3, 1}, {3, 3, 1}, + {4, 3, 1}, {3, 4, 1}, {4, 3, 4}, {3, 4, 4}, + {0, 0, 2}, {1, 0, 2}, {2, 0, 2}, {3, 0, 2}, + {4, 0, 2}, {0, 4, 2}, {2, 0, 4}, {3, 0, 4}, + {0, 1, 2}, {1, 1, 2}, {2, 1, 2}, {3, 1, 2}, + {4, 1, 2}, {1, 4, 2}, {2, 1, 4}, {3, 1, 4}, + {0, 2, 2}, {1, 2, 2}, {2, 2, 2}, {3, 2, 2}, + {4, 2, 2}, {2, 4, 2}, {2, 2, 4}, {3, 2, 4}, + {0, 3, 2}, {1, 3, 2}, {2, 3, 2}, {3, 3, 2}, + {4, 3, 2}, {3, 4, 2}, {2, 3, 4}, {3, 3, 4}, + {0, 0, 3}, {1, 0, 3}, {2, 0, 3}, {3, 0, 3}, + {4, 0, 3}, {0, 4, 3}, {0, 0, 4}, {1, 0, 4}, + {0, 1, 3}, {1, 1, 3}, {2, 1, 3}, {3, 1, 3}, + {4, 1, 3}, {1, 4, 3}, {0, 1, 4}, {1, 1, 4}, + {0, 2, 3}, {1, 2, 3}, {2, 2, 3}, {3, 2, 3}, + {4, 2, 3}, {2, 4, 3}, {0, 2, 4}, {1, 2, 4}, + {0, 3, 3}, {1, 3, 3}, {2, 3, 3}, {3, 3, 3}, + {4, 3, 3}, {3, 4, 3}, {0, 3, 4}, {1, 3, 4}, +}; + +// packed quint-value for every unpacked quint-triplet +// indexed by [high][middle][low] +static const uint8_t integer_of_quints[5][5][5] = { + { + {0, 1, 2, 3, 4,}, + {8, 9, 10, 11, 12,}, + {16, 17, 18, 19, 20,}, + {24, 25, 26, 27, 28,}, + {5, 13, 21, 29, 6,}, + }, + { + {32, 33, 34, 35, 36,}, + {40, 41, 42, 43, 44,}, + {48, 49, 50, 51, 52,}, + {56, 57, 58, 59, 60,}, + {37, 45, 53, 61, 14,}, + }, + { + {64, 65, 66, 67, 68,}, + {72, 73, 74, 75, 76,}, + {80, 81, 82, 83, 84,}, + {88, 89, 90, 91, 92,}, + {69, 77, 85, 93, 22,}, + }, + { + {96, 97, 98, 99, 100,}, + {104, 105, 106, 107, 108,}, + {112, 113, 114, 115, 116,}, + {120, 121, 122, 123, 124,}, + {101, 109, 117, 125, 30,}, + }, + { + {102, 103, 70, 71, 38,}, + {110, 111, 78, 79, 46,}, + {118, 119, 86, 87, 54,}, + {126, 127, 94, 95, 62,}, + {39, 47, 55, 63, 31,}, + }, +}; + +// unpacked trit quintuplets for each packed-quint value +static const uint8_t trits_of_integer[256][5] = { + {0, 0, 0, 0, 0}, {1, 0, 0, 0, 0}, {2, 0, 0, 0, 0}, {0, 0, 2, 0, 0}, + {0, 1, 0, 0, 0}, {1, 1, 0, 0, 0}, {2, 1, 0, 0, 0}, {1, 0, 2, 0, 0}, + {0, 2, 0, 0, 0}, {1, 2, 0, 0, 0}, {2, 2, 0, 0, 0}, {2, 0, 2, 0, 0}, + {0, 2, 2, 0, 0}, {1, 2, 2, 0, 0}, {2, 2, 2, 0, 0}, {2, 0, 2, 0, 0}, + {0, 0, 1, 0, 0}, {1, 0, 1, 0, 0}, {2, 0, 1, 0, 0}, {0, 1, 2, 0, 0}, + {0, 1, 1, 0, 0}, {1, 1, 1, 0, 0}, {2, 1, 1, 0, 0}, {1, 1, 2, 0, 0}, + {0, 2, 1, 0, 0}, {1, 2, 1, 0, 0}, {2, 2, 1, 0, 0}, {2, 1, 2, 0, 0}, + {0, 0, 0, 2, 2}, {1, 0, 0, 2, 2}, {2, 0, 0, 2, 2}, {0, 0, 2, 2, 2}, + {0, 0, 0, 1, 0}, {1, 0, 0, 1, 0}, {2, 0, 0, 1, 0}, {0, 0, 2, 1, 0}, + {0, 1, 0, 1, 0}, {1, 1, 0, 1, 0}, {2, 1, 0, 1, 0}, {1, 0, 2, 1, 0}, + {0, 2, 0, 1, 0}, {1, 2, 0, 1, 0}, {2, 2, 0, 1, 0}, {2, 0, 2, 1, 0}, + {0, 2, 2, 1, 0}, {1, 2, 2, 1, 0}, {2, 2, 2, 1, 0}, {2, 0, 2, 1, 0}, + {0, 0, 1, 1, 0}, {1, 0, 1, 1, 0}, {2, 0, 1, 1, 0}, {0, 1, 2, 1, 0}, + {0, 1, 1, 1, 0}, {1, 1, 1, 1, 0}, {2, 1, 1, 1, 0}, {1, 1, 2, 1, 0}, + {0, 2, 1, 1, 0}, {1, 2, 1, 1, 0}, {2, 2, 1, 1, 0}, {2, 1, 2, 1, 0}, + {0, 1, 0, 2, 2}, {1, 1, 0, 2, 2}, {2, 1, 0, 2, 2}, {1, 0, 2, 2, 2}, + {0, 0, 0, 2, 0}, {1, 0, 0, 2, 0}, {2, 0, 0, 2, 0}, {0, 0, 2, 2, 0}, + {0, 1, 0, 2, 0}, {1, 1, 0, 2, 0}, {2, 1, 0, 2, 0}, {1, 0, 2, 2, 0}, + {0, 2, 0, 2, 0}, {1, 2, 0, 2, 0}, {2, 2, 0, 2, 0}, {2, 0, 2, 2, 0}, + {0, 2, 2, 2, 0}, {1, 2, 2, 2, 0}, {2, 2, 2, 2, 0}, {2, 0, 2, 2, 0}, + {0, 0, 1, 2, 0}, {1, 0, 1, 2, 0}, {2, 0, 1, 2, 0}, {0, 1, 2, 2, 0}, + {0, 1, 1, 2, 0}, {1, 1, 1, 2, 0}, {2, 1, 1, 2, 0}, {1, 1, 2, 2, 0}, + {0, 2, 1, 2, 0}, {1, 2, 1, 2, 0}, {2, 2, 1, 2, 0}, {2, 1, 2, 2, 0}, + {0, 2, 0, 2, 2}, {1, 2, 0, 2, 2}, {2, 2, 0, 2, 2}, {2, 0, 2, 2, 2}, + {0, 0, 0, 0, 2}, {1, 0, 0, 0, 2}, {2, 0, 0, 0, 2}, {0, 0, 2, 0, 2}, + {0, 1, 0, 0, 2}, {1, 1, 0, 0, 2}, {2, 1, 0, 0, 2}, {1, 0, 2, 0, 2}, + {0, 2, 0, 0, 2}, {1, 2, 0, 0, 2}, {2, 2, 0, 0, 2}, {2, 0, 2, 0, 2}, + {0, 2, 2, 0, 2}, {1, 2, 2, 0, 2}, {2, 2, 2, 0, 2}, {2, 0, 2, 0, 2}, + {0, 0, 1, 0, 2}, {1, 0, 1, 0, 2}, {2, 0, 1, 0, 2}, {0, 1, 2, 0, 2}, + {0, 1, 1, 0, 2}, {1, 1, 1, 0, 2}, {2, 1, 1, 0, 2}, {1, 1, 2, 0, 2}, + {0, 2, 1, 0, 2}, {1, 2, 1, 0, 2}, {2, 2, 1, 0, 2}, {2, 1, 2, 0, 2}, + {0, 2, 2, 2, 2}, {1, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 0, 2, 2, 2}, + {0, 0, 0, 0, 1}, {1, 0, 0, 0, 1}, {2, 0, 0, 0, 1}, {0, 0, 2, 0, 1}, + {0, 1, 0, 0, 1}, {1, 1, 0, 0, 1}, {2, 1, 0, 0, 1}, {1, 0, 2, 0, 1}, + {0, 2, 0, 0, 1}, {1, 2, 0, 0, 1}, {2, 2, 0, 0, 1}, {2, 0, 2, 0, 1}, + {0, 2, 2, 0, 1}, {1, 2, 2, 0, 1}, {2, 2, 2, 0, 1}, {2, 0, 2, 0, 1}, + {0, 0, 1, 0, 1}, {1, 0, 1, 0, 1}, {2, 0, 1, 0, 1}, {0, 1, 2, 0, 1}, + {0, 1, 1, 0, 1}, {1, 1, 1, 0, 1}, {2, 1, 1, 0, 1}, {1, 1, 2, 0, 1}, + {0, 2, 1, 0, 1}, {1, 2, 1, 0, 1}, {2, 2, 1, 0, 1}, {2, 1, 2, 0, 1}, + {0, 0, 1, 2, 2}, {1, 0, 1, 2, 2}, {2, 0, 1, 2, 2}, {0, 1, 2, 2, 2}, + {0, 0, 0, 1, 1}, {1, 0, 0, 1, 1}, {2, 0, 0, 1, 1}, {0, 0, 2, 1, 1}, + {0, 1, 0, 1, 1}, {1, 1, 0, 1, 1}, {2, 1, 0, 1, 1}, {1, 0, 2, 1, 1}, + {0, 2, 0, 1, 1}, {1, 2, 0, 1, 1}, {2, 2, 0, 1, 1}, {2, 0, 2, 1, 1}, + {0, 2, 2, 1, 1}, {1, 2, 2, 1, 1}, {2, 2, 2, 1, 1}, {2, 0, 2, 1, 1}, + {0, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {2, 0, 1, 1, 1}, {0, 1, 2, 1, 1}, + {0, 1, 1, 1, 1}, {1, 1, 1, 1, 1}, {2, 1, 1, 1, 1}, {1, 1, 2, 1, 1}, + {0, 2, 1, 1, 1}, {1, 2, 1, 1, 1}, {2, 2, 1, 1, 1}, {2, 1, 2, 1, 1}, + {0, 1, 1, 2, 2}, {1, 1, 1, 2, 2}, {2, 1, 1, 2, 2}, {1, 1, 2, 2, 2}, + {0, 0, 0, 2, 1}, {1, 0, 0, 2, 1}, {2, 0, 0, 2, 1}, {0, 0, 2, 2, 1}, + {0, 1, 0, 2, 1}, {1, 1, 0, 2, 1}, {2, 1, 0, 2, 1}, {1, 0, 2, 2, 1}, + {0, 2, 0, 2, 1}, {1, 2, 0, 2, 1}, {2, 2, 0, 2, 1}, {2, 0, 2, 2, 1}, + {0, 2, 2, 2, 1}, {1, 2, 2, 2, 1}, {2, 2, 2, 2, 1}, {2, 0, 2, 2, 1}, + {0, 0, 1, 2, 1}, {1, 0, 1, 2, 1}, {2, 0, 1, 2, 1}, {0, 1, 2, 2, 1}, + {0, 1, 1, 2, 1}, {1, 1, 1, 2, 1}, {2, 1, 1, 2, 1}, {1, 1, 2, 2, 1}, + {0, 2, 1, 2, 1}, {1, 2, 1, 2, 1}, {2, 2, 1, 2, 1}, {2, 1, 2, 2, 1}, + {0, 2, 1, 2, 2}, {1, 2, 1, 2, 2}, {2, 2, 1, 2, 2}, {2, 1, 2, 2, 2}, + {0, 0, 0, 1, 2}, {1, 0, 0, 1, 2}, {2, 0, 0, 1, 2}, {0, 0, 2, 1, 2}, + {0, 1, 0, 1, 2}, {1, 1, 0, 1, 2}, {2, 1, 0, 1, 2}, {1, 0, 2, 1, 2}, + {0, 2, 0, 1, 2}, {1, 2, 0, 1, 2}, {2, 2, 0, 1, 2}, {2, 0, 2, 1, 2}, + {0, 2, 2, 1, 2}, {1, 2, 2, 1, 2}, {2, 2, 2, 1, 2}, {2, 0, 2, 1, 2}, + {0, 0, 1, 1, 2}, {1, 0, 1, 1, 2}, {2, 0, 1, 1, 2}, {0, 1, 2, 1, 2}, + {0, 1, 1, 1, 2}, {1, 1, 1, 1, 2}, {2, 1, 1, 1, 2}, {1, 1, 2, 1, 2}, + {0, 2, 1, 1, 2}, {1, 2, 1, 1, 2}, {2, 2, 1, 1, 2}, {2, 1, 2, 1, 2}, + {0, 2, 2, 2, 2}, {1, 2, 2, 2, 2}, {2, 2, 2, 2, 2}, {2, 1, 2, 2, 2}, +}; + +// packed trit-value for every unpacked trit-quintuplet +// indexed by [high][][][][low] +static const uint8_t integer_of_trits[3][3][3][3][3] = { + { + { + { + {0, 1, 2,}, + {4, 5, 6,}, + {8, 9, 10,}, + }, + { + {16, 17, 18,}, + {20, 21, 22,}, + {24, 25, 26,}, + }, + { + {3, 7, 15,}, + {19, 23, 27,}, + {12, 13, 14,}, + }, + }, + { + { + {32, 33, 34,}, + {36, 37, 38,}, + {40, 41, 42,}, + }, + { + {48, 49, 50,}, + {52, 53, 54,}, + {56, 57, 58,}, + }, + { + {35, 39, 47,}, + {51, 55, 59,}, + {44, 45, 46,}, + }, + }, + { + { + {64, 65, 66,}, + {68, 69, 70,}, + {72, 73, 74,}, + }, + { + {80, 81, 82,}, + {84, 85, 86,}, + {88, 89, 90,}, + }, + { + {67, 71, 79,}, + {83, 87, 91,}, + {76, 77, 78,}, + }, + }, + }, + { + { + { + {128, 129, 130,}, + {132, 133, 134,}, + {136, 137, 138,}, + }, + { + {144, 145, 146,}, + {148, 149, 150,}, + {152, 153, 154,}, + }, + { + {131, 135, 143,}, + {147, 151, 155,}, + {140, 141, 142,}, + }, + }, + { + { + {160, 161, 162,}, + {164, 165, 166,}, + {168, 169, 170,}, + }, + { + {176, 177, 178,}, + {180, 181, 182,}, + {184, 185, 186,}, + }, + { + {163, 167, 175,}, + {179, 183, 187,}, + {172, 173, 174,}, + }, + }, + { + { + {192, 193, 194,}, + {196, 197, 198,}, + {200, 201, 202,}, + }, + { + {208, 209, 210,}, + {212, 213, 214,}, + {216, 217, 218,}, + }, + { + {195, 199, 207,}, + {211, 215, 219,}, + {204, 205, 206,}, + }, + }, + }, + { + { + { + {96, 97, 98,}, + {100, 101, 102,}, + {104, 105, 106,}, + }, + { + {112, 113, 114,}, + {116, 117, 118,}, + {120, 121, 122,}, + }, + { + {99, 103, 111,}, + {115, 119, 123,}, + {108, 109, 110,}, + }, + }, + { + { + {224, 225, 226,}, + {228, 229, 230,}, + {232, 233, 234,}, + }, + { + {240, 241, 242,}, + {244, 245, 246,}, + {248, 249, 250,}, + }, + { + {227, 231, 239,}, + {243, 247, 251,}, + {236, 237, 238,}, + }, + }, + { + { + {28, 29, 30,}, + {60, 61, 62,}, + {92, 93, 94,}, + }, + { + {156, 157, 158,}, + {188, 189, 190,}, + {220, 221, 222,}, + }, + { + {31, 63, 127,}, + {159, 191, 255,}, + {252, 253, 254,}, + }, + }, + }, +}; + + + +void find_number_of_bits_trits_quints(int quantization_level, int *bits, int *trits, int *quints) +{ + *bits = 0; + *trits = 0; + *quints = 0; + switch (quantization_level) + { + case QUANT_2: + *bits = 1; + break; + case QUANT_3: + *bits = 0; + *trits = 1; + break; + case QUANT_4: + *bits = 2; + break; + case QUANT_5: + *bits = 0; + *quints = 1; + break; + case QUANT_6: + *bits = 1; + *trits = 1; + break; + case QUANT_8: + *bits = 3; + break; + case QUANT_10: + *bits = 1; + *quints = 1; + break; + case QUANT_12: + *bits = 2; + *trits = 1; + break; + case QUANT_16: + *bits = 4; + break; + case QUANT_20: + *bits = 2; + *quints = 1; + break; + case QUANT_24: + *bits = 3; + *trits = 1; + break; + case QUANT_32: + *bits = 5; + break; + case QUANT_40: + *bits = 3; + *quints = 1; + break; + case QUANT_48: + *bits = 4; + *trits = 1; + break; + case QUANT_64: + *bits = 6; + break; + case QUANT_80: + *bits = 4; + *quints = 1; + break; + case QUANT_96: + *bits = 5; + *trits = 1; + break; + case QUANT_128: + *bits = 7; + break; + case QUANT_160: + *bits = 5; + *quints = 1; + break; + case QUANT_192: + *bits = 6; + *trits = 1; + break; + case QUANT_256: + *bits = 8; + break; + } +} + + +// routine to write up to 8 bits +static inline void write_bits(int value, int bitcount, int bitoffset, uint8_t * ptr) +{ + int mask = (1 << bitcount) - 1; + value &= mask; + ptr += bitoffset >> 3; + bitoffset &= 7; + value <<= bitoffset; + mask <<= bitoffset; + mask = ~mask; + + ptr[0] &= mask; + ptr[0] |= value; + ptr[1] &= mask >> 8; + ptr[1] |= value >> 8; +} + + +// routine to read up to 8 bits +static inline int read_bits(int bitcount, int bitoffset, const uint8_t * ptr) +{ + int mask = (1 << bitcount) - 1; + ptr += bitoffset >> 3; + bitoffset &= 7; + int value = ptr[0] | (ptr[1] << 8); + value >>= bitoffset; + value &= mask; + return value; +} + + + + +void encode_ise(int quantization_level, int elements, const uint8_t * input_data, uint8_t * output_data, int bit_offset) +{ + int i; + uint8_t lowparts[64]; + uint8_t highparts[69]; // 64 elements + 5 elements for padding + uint8_t tq_blocks[22]; // trit-blocks or quint-blocks + + int bits, trits, quints; + find_number_of_bits_trits_quints(quantization_level, &bits, &trits, &quints); + + for (i = 0; i < elements; i++) + { + lowparts[i] = input_data[i] & ((1 << bits) - 1); + highparts[i] = input_data[i] >> bits; + } + for (i = elements; i < elements + 5; i++) + highparts[i] = 0; // padding before we start constructing trit-blocks or quint-blocks + + // construct trit-blocks or quint-blocks as necessary + if (trits) + { + int trit_blocks = (elements + 4) / 5; + for (i = 0; i < trit_blocks; i++) + tq_blocks[i] = integer_of_trits[highparts[5 * i + 4]][highparts[5 * i + 3]][highparts[5 * i + 2]][highparts[5 * i + 1]][highparts[5 * i]]; + } + if (quints) + { + int quint_blocks = (elements + 2) / 3; + for (i = 0; i < quint_blocks; i++) + tq_blocks[i] = integer_of_quints[highparts[3 * i + 2]][highparts[3 * i + 1]][highparts[3 * i]]; + } + + // then, write out the actual bits. + int lcounter = 0; + int hcounter = 0; + for (i = 0; i < elements; i++) + { + write_bits(lowparts[i], bits, bit_offset, output_data); + bit_offset += bits; + if (trits) + { + static const int bits_to_write[5] = { 2, 2, 1, 2, 1 }; + static const int block_shift[5] = { 0, 2, 4, 5, 7 }; + static const int next_lcounter[5] = { 1, 2, 3, 4, 0 }; + static const int hcounter_incr[5] = { 0, 0, 0, 0, 1 }; + write_bits(tq_blocks[hcounter] >> block_shift[lcounter], bits_to_write[lcounter], bit_offset, output_data); + bit_offset += bits_to_write[lcounter]; + hcounter += hcounter_incr[lcounter]; + lcounter = next_lcounter[lcounter]; + } + if (quints) + { + static const int bits_to_write[3] = { 3, 2, 2 }; + static const int block_shift[3] = { 0, 3, 5 }; + static const int next_lcounter[3] = { 1, 2, 0 }; + static const int hcounter_incr[3] = { 0, 0, 1 }; + write_bits(tq_blocks[hcounter] >> block_shift[lcounter], bits_to_write[lcounter], bit_offset, output_data); + bit_offset += bits_to_write[lcounter]; + hcounter += hcounter_incr[lcounter]; + lcounter = next_lcounter[lcounter]; + } + } +} + + + + +void decode_ise(int quantization_level, int elements, const uint8_t * input_data, uint8_t * output_data, int bit_offset) +{ + int i; + // note: due to how the trit/quint-block unpacking is done in this function, + // we may write more temporary results than the number of outputs + // The maximum actual number of results is 64 bit, but we keep 4 additional elements + // of padding. + uint8_t results[68]; + uint8_t tq_blocks[22]; // trit-blocks or quint-blocks + + int bits, trits, quints; + find_number_of_bits_trits_quints(quantization_level, &bits, &trits, &quints); + + int lcounter = 0; + int hcounter = 0; + + // trit-blocks or quint-blocks must be zeroed out before we collect them in the loop below. + for (i = 0; i < 22; i++) + tq_blocks[i] = 0; + + // collect bits for each element, as well as bits for any trit-blocks and quint-blocks. + for (i = 0; i < elements; i++) + { + results[i] = read_bits(bits, bit_offset, input_data); + bit_offset += bits; + if (trits) + { + static const int bits_to_read[5] = { 2, 2, 1, 2, 1 }; + static const int block_shift[5] = { 0, 2, 4, 5, 7 }; + static const int next_lcounter[5] = { 1, 2, 3, 4, 0 }; + static const int hcounter_incr[5] = { 0, 0, 0, 0, 1 }; + int tdata = read_bits(bits_to_read[lcounter], bit_offset, input_data); + bit_offset += bits_to_read[lcounter]; + tq_blocks[hcounter] |= tdata << block_shift[lcounter]; + hcounter += hcounter_incr[lcounter]; + lcounter = next_lcounter[lcounter]; + } + if (quints) + { + static const int bits_to_read[3] = { 3, 2, 2 }; + static const int block_shift[3] = { 0, 3, 5 }; + static const int next_lcounter[3] = { 1, 2, 0 }; + static const int hcounter_incr[3] = { 0, 0, 1 }; + int tdata = read_bits(bits_to_read[lcounter], bit_offset, input_data); + bit_offset += bits_to_read[lcounter]; + tq_blocks[hcounter] |= tdata << block_shift[lcounter]; + hcounter += hcounter_incr[lcounter]; + lcounter = next_lcounter[lcounter]; + } + } + + + // unpack trit-blocks or quint-blocks as needed + if (trits) + { + int trit_blocks = (elements + 4) / 5; + for (i = 0; i < trit_blocks; i++) + { + const uint8_t *tritptr = trits_of_integer[tq_blocks[i]]; + results[5 * i] |= tritptr[0] << bits; + results[5 * i + 1] |= tritptr[1] << bits; + results[5 * i + 2] |= tritptr[2] << bits; + results[5 * i + 3] |= tritptr[3] << bits; + results[5 * i + 4] |= tritptr[4] << bits; + } + } + + if (quints) + { + int quint_blocks = (elements + 2) / 3; + for (i = 0; i < quint_blocks; i++) + { + const uint8_t *quintptr = quints_of_integer[tq_blocks[i]]; + results[3 * i] |= quintptr[0] << bits; + results[3 * i + 1] |= quintptr[1] << bits; + results[3 * i + 2] |= quintptr[2] << bits; + } + } + + for (i = 0; i < elements; i++) + output_data[i] = results[i]; +} + + + + +int compute_ise_bitcount(int items, quantization_method quant) +{ + switch (quant) + { + case QUANT_2: + return items; + case QUANT_3: + return (8 * items + 4) / 5; + case QUANT_4: + return 2 * items; + case QUANT_5: + return (7 * items + 2) / 3; + case QUANT_6: + return (13 * items + 4) / 5; + case QUANT_8: + return 3 * items; + case QUANT_10: + return (10 * items + 2) / 3; + case QUANT_12: + return (18 * items + 4) / 5; + case QUANT_16: + return items * 4; + case QUANT_20: + return (13 * items + 2) / 3; + case QUANT_24: + return (23 * items + 4) / 5; + case QUANT_32: + return 5 * items; + case QUANT_40: + return (16 * items + 2) / 3; + case QUANT_48: + return (28 * items + 4) / 5; + case QUANT_64: + return 6 * items; + case QUANT_80: + return (19 * items + 2) / 3; + case QUANT_96: + return (33 * items + 4) / 5; + case QUANT_128: + return 7 * items; + case QUANT_160: + return (22 * items + 2) / 3; + case QUANT_192: + return (38 * items + 4) / 5; + case QUANT_256: + return 8 * items; + default: + return 100000; + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_kmeans_partitioning.cpp b/3rdparty/bimg/3rdparty/astc/astc_kmeans_partitioning.cpp new file mode 100644 index 00000000000..13fd4abc40b --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_kmeans_partitioning.cpp @@ -0,0 +1,520 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief approximate k-means cluster partitioning. Do this in 2 stages + * + * 1: basic clustering, a couple of passes just to get a few clusters + * 2: clustering based on line, a few passes until it seems to + * stabilize. + * + * After clustering is done, we use the clustering result to construct + * one bitmap for each partition. We then scan though the partition table, + * counting how well the bitmaps matched. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +// for k++ means, we need pseudo-random numbers, however using random numbers directly +// results in irreproducible encoding results. As such, we will instead +// just supply a handful of numbers from random.org, and apply an algorithm similar +// to XKCD #221. (http://xkcd.com/221/) +// cluster the texels using the k++ means clustering initialization algorithm. + +void kpp_initialize(int xdim, int ydim, int zdim, int partition_count, const imageblock * blk, float4 * cluster_centers) +{ + int i; + + int texels_per_block = xdim * ydim * zdim; + + int cluster_center_samples[4]; + // pick a random sample as first center-point. + cluster_center_samples[0] = 145897 /* number from random.org */ % texels_per_block; + int samples_selected = 1; + + float distances[MAX_TEXELS_PER_BLOCK]; + + // compute the distance to the first point. + int sample = cluster_center_samples[0]; + float4 center_color = float4(blk->work_data[4 * sample], + blk->work_data[4 * sample + 1], + blk->work_data[4 * sample + 2], + blk->work_data[4 * sample + 3]); + + float distance_sum = 0.0f; + for (i = 0; i < texels_per_block; i++) + { + float4 color = float4(blk->work_data[4 * i], + blk->work_data[4 * i + 1], + blk->work_data[4 * i + 2], + blk->work_data[4 * i + 3]); + float4 diff = color - center_color; + float distance = dot(diff, diff); + distance_sum += distance; + distances[i] = distance; + } + + // more numbers from random.org + float cluster_cutoffs[25] = { + 0.952312f, 0.206893f, 0.835984f, 0.507813f, 0.466170f, + 0.872331f, 0.488028f, 0.866394f, 0.363093f, 0.467905f, + 0.812967f, 0.626220f, 0.932770f, 0.275454f, 0.832020f, + 0.362217f, 0.318558f, 0.240113f, 0.009190f, 0.983995f, + 0.566812f, 0.347661f, 0.731960f, 0.156391f, 0.297786f + }; + + while (1) + { + // pick a point in a weighted-random fashion. + float summa = 0.0f; + float distance_cutoff = distance_sum * cluster_cutoffs[samples_selected + 5 * partition_count]; + for (i = 0; i < texels_per_block; i++) + { + summa += distances[i]; + if (summa >= distance_cutoff) + break; + } + sample = i; + if (sample >= texels_per_block) + sample = texels_per_block - 1; + + + cluster_center_samples[samples_selected] = sample; + samples_selected++; + if (samples_selected >= partition_count) + break; + + // update the distances with the new point. + center_color = float4(blk->work_data[4 * sample], blk->work_data[4 * sample + 1], blk->work_data[4 * sample + 2], blk->work_data[4 * sample + 3]); + + distance_sum = 0.0f; + for (i = 0; i < texels_per_block; i++) + { + float4 color = float4(blk->work_data[4 * i], + blk->work_data[4 * i + 1], + blk->work_data[4 * i + 2], + blk->work_data[4 * i + 3]); + float4 diff = color - center_color; + float distance = dot(diff, diff); + distance = MIN(distance, distances[i]); + distance_sum += distance; + distances[i] = distance; + } + } + + // finally, gather up the results. + for (i = 0; i < partition_count; i++) + { + int sample = cluster_center_samples[i]; + float4 color = float4(blk->work_data[4 * sample], + blk->work_data[4 * sample + 1], + blk->work_data[4 * sample + 2], + blk->work_data[4 * sample + 3]); + cluster_centers[i] = color; + } +} + + +// basic K-means clustering: given a set of cluster centers, +// assign each texel to a partition +void basic_kmeans_assign_pass(int xdim, int ydim, int zdim, int partition_count, const imageblock * blk, const float4 * cluster_centers, int *partition_of_texel) +{ + int i, j; + + int texels_per_block = xdim * ydim * zdim; + + float distances[MAX_TEXELS_PER_BLOCK]; + float4 center_color = cluster_centers[0]; + + int texels_per_partition[4]; + + texels_per_partition[0] = texels_per_block; + for (i = 1; i < partition_count; i++) + texels_per_partition[i] = 0; + + + for (i = 0; i < texels_per_block; i++) + { + float4 color = float4(blk->work_data[4 * i], + blk->work_data[4 * i + 1], + blk->work_data[4 * i + 2], + blk->work_data[4 * i + 3]); + float4 diff = color - center_color; + float distance = dot(diff, diff); + distances[i] = distance; + partition_of_texel[i] = 0; + } + + + + for (j = 1; j < partition_count; j++) + { + float4 center_color = cluster_centers[j]; + + for (i = 0; i < texels_per_block; i++) + { + float4 color = float4(blk->work_data[4 * i], + blk->work_data[4 * i + 1], + blk->work_data[4 * i + 2], + blk->work_data[4 * i + 3]); + float4 diff = color - center_color; + float distance = dot(diff, diff); + if (distance < distances[i]) + { + distances[i] = distance; + texels_per_partition[partition_of_texel[i]]--; + texels_per_partition[j]++; + partition_of_texel[i] = j; + } + } + } + + // it is possible to get a situation where one of the partitions ends up + // without any texels. In this case, we assign texel N to partition N; + // this is silly, but ensures that every partition retains at least one texel. + // Reassigning a texel in this manner may cause another partition to go empty, + // so if we actually did a reassignment, we run the whole loop over again. + int problem_case; + do + { + problem_case = 0; + for (i = 0; i < partition_count; i++) + { + if (texels_per_partition[i] == 0) + { + texels_per_partition[partition_of_texel[i]]--; + texels_per_partition[i]++; + partition_of_texel[i] = i; + problem_case = 1; + } + } + } + while (problem_case != 0); + +} + + +// basic k-means clustering: given a set of cluster assignments +// for the texels, find the center position of each cluster. +void basic_kmeans_update(int xdim, int ydim, int zdim, int partition_count, const imageblock * blk, const int *partition_of_texel, float4 * cluster_centers) +{ + int i; + + int texels_per_block = xdim * ydim * zdim; + + float4 color_sum[4]; + int weight_sum[4]; + + for (i = 0; i < partition_count; i++) + { + color_sum[i] = float4(0, 0, 0, 0); + weight_sum[i] = 0; + } + + + // first, find the center-of-gravity in each cluster + for (i = 0; i < texels_per_block; i++) + { + float4 color = float4(blk->work_data[4 * i], + blk->work_data[4 * i + 1], + blk->work_data[4 * i + 2], + blk->work_data[4 * i + 3]); + int part = partition_of_texel[i]; + color_sum[part] = color_sum[part] + color; + weight_sum[part]++; + } + + for (i = 0; i < partition_count; i++) + { + cluster_centers[i] = color_sum[i] * (1.0f / weight_sum[i]); + } +} + + + + +// after a few rounds of k-means-clustering, we should have a set of 2, 3 or 4 partitions; +// we then turn this set into 2, 3 or 4 bitmaps. Then, for each of the 1024 partitions, +// we try to match the bitmaps as well as possible. + + + + +static inline int bitcount(uint64_t p) +{ + if (sizeof(void *) > 4) + { + uint64_t mask1 = 0x5555555555555555ULL; + uint64_t mask2 = 0x3333333333333333ULL; + uint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL; + // best-known algorithm for 64-bit bitcount, assuming 64-bit processor + // should probably be adapted for use with 32-bit processors and/or processors + // with a POPCNT instruction, but leave that for later. + p -= (p >> 1) & mask1; + p = (p & mask2) + ((p >> 2) & mask2); + p += p >> 4; + p &= mask3; + p *= 0x0101010101010101ULL; + p >>= 56; + return (int)p; + } + else + { + // on 32-bit processor, split the 64-bit input argument in two, + // and bitcount each half separately. + uint32_t p1 = (uint32_t) p; + uint32_t p2 = (uint32_t) (p >> 32); + uint32_t mask1 = 0x55555555U; + uint32_t mask2 = 0x33333333U; + uint32_t mask3 = 0x0F0F0F0FU; + p1 = p1 - ((p1 >> 1) & mask1); + p2 = p2 - ((p2 >> 1) & mask1); + p1 = (p1 & mask2) + ((p1 >> 2) & mask2); + p2 = (p2 & mask2) + ((p2 >> 2) & mask2); + p1 += p1 >> 4; + p2 += p2 >> 4; + p1 &= mask3; + p2 &= mask3; + p1 += p2; + p1 *= 0x01010101U; + p1 >>= 24; + return (int)p1; + } +} + + +// compute the bit-mismatch for a partitioning in 2-partition mode +static inline int partition_mismatch2(uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1) +{ + int v1 = bitcount(a0 ^ b0) + bitcount(a1 ^ b1); + int v2 = bitcount(a0 ^ b1) + bitcount(a1 ^ b0); + return MIN(v1, v2); +} + + +// compute the bit-mismatch for a partitioning in 3-partition mode +static inline int partition_mismatch3(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t b0, uint64_t b1, uint64_t b2) +{ + int p00 = bitcount(a0 ^ b0); + int p01 = bitcount(a0 ^ b1); + int p02 = bitcount(a0 ^ b2); + + int p10 = bitcount(a1 ^ b0); + int p11 = bitcount(a1 ^ b1); + int p12 = bitcount(a1 ^ b2); + + int p20 = bitcount(a2 ^ b0); + int p21 = bitcount(a2 ^ b1); + int p22 = bitcount(a2 ^ b2); + + int s0 = p11 + p22; + int s1 = p12 + p21; + int v0 = MIN(s0, s1) + p00; + + int s2 = p10 + p22; + int s3 = p12 + p20; + int v1 = MIN(s2, s3) + p01; + + int s4 = p10 + p21; + int s5 = p11 + p20; + int v2 = MIN(s4, s5) + p02; + + if (v1 < v0) + v0 = v1; + if (v2 < v0) + v0 = v2; + + // 9 add, 5 MIN + + return v0; +} + +static inline int MIN3(int a, int b, int c) +{ + int d = MIN(a, b); + return MIN(c, d); +} + +// compute the bit-mismatch for a partitioning in 4-partition mode +static inline int partition_mismatch4(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t b0, uint64_t b1, uint64_t b2, uint64_t b3) +{ + int p00 = bitcount(a0 ^ b0); + int p01 = bitcount(a0 ^ b1); + int p02 = bitcount(a0 ^ b2); + int p03 = bitcount(a0 ^ b3); + + int p10 = bitcount(a1 ^ b0); + int p11 = bitcount(a1 ^ b1); + int p12 = bitcount(a1 ^ b2); + int p13 = bitcount(a1 ^ b3); + + int p20 = bitcount(a2 ^ b0); + int p21 = bitcount(a2 ^ b1); + int p22 = bitcount(a2 ^ b2); + int p23 = bitcount(a2 ^ b3); + + int p30 = bitcount(a3 ^ b0); + int p31 = bitcount(a3 ^ b1); + int p32 = bitcount(a3 ^ b2); + int p33 = bitcount(a3 ^ b3); + + int mx23 = MIN(p22 + p33, p23 + p32); + int mx13 = MIN(p21 + p33, p23 + p31); + int mx12 = MIN(p21 + p32, p22 + p31); + int mx03 = MIN(p20 + p33, p23 + p30); + int mx02 = MIN(p20 + p32, p22 + p30); + int mx01 = MIN(p21 + p30, p20 + p31); + + int v0 = p00 + MIN3(p11 + mx23, p12 + mx13, p13 + mx12); + int v1 = p01 + MIN3(p10 + mx23, p12 + mx03, p13 + mx02); + int v2 = p02 + MIN3(p11 + mx03, p10 + mx13, p13 + mx01); + int v3 = p03 + MIN3(p11 + mx02, p12 + mx01, p10 + mx12); + + int x0 = MIN(v0, v1); + int x1 = MIN(v2, v3); + return MIN(x0, x1); + + // 16 bitcount, 17 MIN, 28 ADD +} + + + +void count_partition_mismatch_bits(int xdim, int ydim, int zdim, int partition_count, const uint64_t bitmaps[4], int bitcounts[PARTITION_COUNT]) +{ + int i; + const partition_info *pi = get_partition_table(xdim, ydim, zdim, partition_count); + + if (partition_count == 2) + { + uint64_t bm0 = bitmaps[0]; + uint64_t bm1 = bitmaps[1]; + for (i = 0; i < PARTITION_COUNT; i++) + { + if (pi->partition_count == 2) + { + bitcounts[i] = partition_mismatch2(bm0, bm1, pi->coverage_bitmaps[0], pi->coverage_bitmaps[1]); + } + else + bitcounts[i] = 255; + pi++; + } + } + else if (partition_count == 3) + { + uint64_t bm0 = bitmaps[0]; + uint64_t bm1 = bitmaps[1]; + uint64_t bm2 = bitmaps[2]; + for (i = 0; i < PARTITION_COUNT; i++) + { + if (pi->partition_count == 3) + { + bitcounts[i] = partition_mismatch3(bm0, bm1, bm2, pi->coverage_bitmaps[0], pi->coverage_bitmaps[1], pi->coverage_bitmaps[2]); + } + else + bitcounts[i] = 255; + pi++; + } + } + else if (partition_count == 4) + { + uint64_t bm0 = bitmaps[0]; + uint64_t bm1 = bitmaps[1]; + uint64_t bm2 = bitmaps[2]; + uint64_t bm3 = bitmaps[3]; + for (i = 0; i < PARTITION_COUNT; i++) + { + if (pi->partition_count == 4) + { + bitcounts[i] = partition_mismatch4(bm0, bm1, bm2, bm3, pi->coverage_bitmaps[0], pi->coverage_bitmaps[1], pi->coverage_bitmaps[2], pi->coverage_bitmaps[3]); + } + else + bitcounts[i] = 255; + pi++; + } + } + +} + + +// counting-sort on the mismatch-bits, thereby +// sorting the partitions into an ordering. + +void get_partition_ordering_by_mismatch_bits(const int mismatch_bits[PARTITION_COUNT], int partition_ordering[PARTITION_COUNT]) +{ + int i; + + int mscount[256]; + for (i = 0; i < 256; i++) + mscount[i] = 0; + + for (i = 0; i < PARTITION_COUNT; i++) + mscount[mismatch_bits[i]]++; + + int summa = 0; + for (i = 0; i < 256; i++) + { + int cnt = mscount[i]; + mscount[i] = summa; + summa += cnt; + } + + for (i = 0; i < PARTITION_COUNT; i++) + { + int idx = mscount[mismatch_bits[i]]++; + partition_ordering[idx] = i; + } +} + + + + +void kmeans_compute_partition_ordering(int xdim, int ydim, int zdim, int partition_count, const imageblock * blk, int *ordering) +{ + int i; + + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + + float4 cluster_centers[4]; + int partition_of_texel[MAX_TEXELS_PER_BLOCK]; + + // 3 passes of plain k-means partitioning + for (i = 0; i < 3; i++) + { + if (i == 0) + kpp_initialize(xdim, ydim, zdim, partition_count, blk, cluster_centers); + else + basic_kmeans_update(xdim, ydim, zdim, partition_count, blk, partition_of_texel, cluster_centers); + + basic_kmeans_assign_pass(xdim, ydim, zdim, partition_count, blk, cluster_centers, partition_of_texel); + } + + // at this point, we have a near-ideal partitioning. + + // construct bitmaps + uint64_t bitmaps[4]; + for (i = 0; i < 4; i++) + bitmaps[i] = 0ULL; + + int texels_to_process = bsd->texelcount_for_bitmap_partitioning; + for (i = 0; i < texels_to_process; i++) + { + int idx = bsd->texels_for_bitmap_partitioning[i]; + bitmaps[partition_of_texel[idx]] |= 1ULL << i; + } + + int bitcounts[PARTITION_COUNT]; + // for each entry in the partition table, count bits of partition-mismatch. + count_partition_mismatch_bits(xdim, ydim, zdim, partition_count, bitmaps, bitcounts); + + // finally, sort the partitions by bits-of-partition-mismatch + get_partition_ordering_by_mismatch_bits(bitcounts, ordering); + +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_lib.cpp b/3rdparty/bimg/3rdparty/astc/astc_lib.cpp new file mode 100644 index 00000000000..f587236e54d --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_lib.cpp @@ -0,0 +1,681 @@ +/*----------------------------------------------------------------------------*/ +/** + * @author Andrew Willmott + * + * @brief Library api for astc codec, to be used as an alternative to astc_toplevel.cpp + */ +/*----------------------------------------------------------------------------*/ + + +#include "astc_lib.h" + +#include "astc_codec_internals.h" + +#include +#include + +// Globals declared in astc_codec_internals.h +int perform_srgb_transform = 0; +int alpha_force_use_of_hdr = 0; +int rgb_force_use_of_hdr = 0; +int print_tile_errors = 0; + +#ifdef DEBUG_PRINT_DIAGNOSTICS + int print_diagnostics = 0; + int diagnostics_tile = -1; +#endif + +// ASTC code expects this to be defined +void astc_codec_internal_error(const char* filename, int line) +{ + fprintf(stderr, "ASTC encode error @ %s:%d\n", filename, line); +} + +// @todo add HDR variants + +namespace +{ + static bool s_tables_initialised = false; + + inline void init_tables() + { + if (!s_tables_initialised) + { + prepare_angular_tables(); + build_quantization_mode_table(); + + s_tables_initialised = true; + } + } + + const swizzlepattern k_swizzles[] = + { + { 0, 1, 2, 3 }, // ASTC_RGBA + { 2, 1, 0, 3 }, // ASTC_BGRA + }; + + void alloc_temp_buffers(compress_symbolic_block_buffers* temp_buffers) + { + temp_buffers->ewb = new error_weight_block; + temp_buffers->ewbo = new error_weight_block_orig; + temp_buffers->tempblocks = new symbolic_compressed_block[4]; + temp_buffers->temp = new imageblock; + + temp_buffers->planes2 = new compress_fixed_partition_buffers; + temp_buffers->planes2->ei1 = new endpoints_and_weights; + temp_buffers->planes2->ei2 = new endpoints_and_weights; + temp_buffers->planes2->eix1 = new endpoints_and_weights[MAX_DECIMATION_MODES]; + temp_buffers->planes2->eix2 = new endpoints_and_weights[MAX_DECIMATION_MODES]; + temp_buffers->planes2->decimated_quantized_weights = new float[2 * MAX_DECIMATION_MODES * MAX_WEIGHTS_PER_BLOCK]; + temp_buffers->planes2->decimated_weights = new float[2 * MAX_DECIMATION_MODES * MAX_WEIGHTS_PER_BLOCK]; + temp_buffers->planes2->flt_quantized_decimated_quantized_weights = new float[2 * MAX_WEIGHT_MODES * MAX_WEIGHTS_PER_BLOCK]; + temp_buffers->planes2->u8_quantized_decimated_quantized_weights = new uint8_t[2 * MAX_WEIGHT_MODES * MAX_WEIGHTS_PER_BLOCK]; + temp_buffers->plane1 = temp_buffers->planes2; + } + + void free_temp_buffers(compress_symbolic_block_buffers* temp_buffers) + { + delete[] temp_buffers->planes2->decimated_quantized_weights; + delete[] temp_buffers->planes2->decimated_weights; + delete[] temp_buffers->planes2->flt_quantized_decimated_quantized_weights; + delete[] temp_buffers->planes2->u8_quantized_decimated_quantized_weights; + delete[] temp_buffers->planes2->eix1; + delete[] temp_buffers->planes2->eix2; + delete temp_buffers->planes2->ei1; + delete temp_buffers->planes2->ei2; + delete temp_buffers->planes2; + + delete[] temp_buffers->tempblocks; + delete temp_buffers->temp; + delete temp_buffers->ewbo; + delete temp_buffers->ewb; + } + + + // More direct version of the astc_codec_image routine, which operates on a + // more conventional 2D image layout. Doesn't support padding, so + // mean_stdev_radius and alpha_radius etc. must be zero. + void to_imageblock + ( + imageblock* pb, + const uint8_t* src_data, + int src_stride, + int xpos, + int ypos, + int xsize, + int ysize, + int xdim, + int ydim, + swizzlepattern swz, + bool srgb + ) + { + float* fptr = pb->orig_data; + + pb->xpos = xpos; + pb->ypos = ypos; + pb->zpos = 0; + + float data[6]; + data[4] = 0; + data[5] = 1; + + for (int y = 0; y < ydim; y++) + { + for (int x = 0; x < xdim; x++) + { + int xi = xpos + x; + int yi = ypos + y; + + if (xi >= xsize) + xi = xsize - 1; + if (yi >= ysize) + yi = ysize - 1; + + int offset = src_stride * yi + 4 * xi; + + int r = src_data[offset + 0]; + int g = src_data[offset + 1]; + int b = src_data[offset + 2]; + int a = src_data[offset + 3]; + + data[0] = r / 255.0f; + data[1] = g / 255.0f; + data[2] = b / 255.0f; + data[3] = a / 255.0f; + + fptr[0] = data[swz.r]; + fptr[1] = data[swz.g]; + fptr[2] = data[swz.b]; + fptr[3] = data[swz.a]; + + fptr += 4; + } + } + + // perform sRGB-to-linear transform on input data, if requested. + int pixelcount = xdim * ydim; + + if (srgb) + { + fptr = pb->orig_data; + + for (int i = 0; i < pixelcount; i++) + { + float r = fptr[0]; + float g = fptr[1]; + float b = fptr[2]; + + if (r <= 0.04045f) + r = r * (1.0f / 12.92f); + else if (r <= 1) + r = pow((r + 0.055f) * (1.0f / 1.055f), 2.4f); + + if (g <= 0.04045f) + g = g * (1.0f / 12.92f); + else if (g <= 1) + g = pow((g + 0.055f) * (1.0f / 1.055f), 2.4f); + + if (b <= 0.04045f) + b = b * (1.0f / 12.92f); + else if (b <= 1) + b = pow((b + 0.055f) * (1.0f / 1.055f), 2.4f); + + fptr[0] = r; + fptr[1] = g; + fptr[2] = b; + + fptr += 4; + } + } + + for (int i = 0; i < pixelcount; i++) + { + pb->rgb_lns [i] = 0; + pb->alpha_lns[i] = 0; + pb->nan_texel[i] = 0; + } + + imageblock_initialize_work_from_orig(pb, pixelcount); + + update_imageblock_flags(pb, xdim, ydim, 1); + } + + void encode_astc + ( + const uint8_t* src, + int src_stride, + swizzlepattern src_swz, + int xsize, + int ysize, + int xdim, + int ydim, + const error_weighting_params* ewp, + astc_decode_mode decode_mode, + uint8_t* dst + ) + { + int xblocks = (xsize + xdim - 1) / xdim; + int yblocks = (ysize + ydim - 1) / ydim; + + get_block_size_descriptor(xdim, ydim, 1); + get_partition_table(xdim, ydim, 1, 0); + + imageblock pb; + + compress_symbolic_block_buffers temp_buffers; + alloc_temp_buffers(&temp_buffers); + + astc_codec_image image_info = { nullptr, nullptr, xsize, ysize, 1, 0 }; + + for (int y = 0; y < yblocks; y++) + for (int x = 0; x < xblocks; x++) + { + to_imageblock(&pb, src, src_stride, x * xdim, y * ydim, xsize, ysize, xdim, ydim, src_swz, decode_mode == DECODE_LDR_SRGB); + + symbolic_compressed_block scb; + compress_symbolic_block(&image_info, decode_mode, xdim, ydim, 1, ewp, &pb, &scb, &temp_buffers); + + physical_compressed_block pcb = symbolic_to_physical(xdim, ydim, 1, &scb); + + uint8_t* dst_block = dst + (y * xblocks + x) * 16; + + *(physical_compressed_block*) dst_block = pcb; + } + + free_temp_buffers(&temp_buffers); + } + + void init_ewp(error_weighting_params& ewp) + { + ewp.rgb_power = 1.0f; + ewp.alpha_power = 1.0f; + ewp.rgb_base_weight = 1.0f; + ewp.alpha_base_weight = 1.0f; + ewp.rgb_mean_weight = 0.0f; + ewp.rgb_stdev_weight = 0.0f; + ewp.alpha_mean_weight = 0.0f; + ewp.alpha_stdev_weight = 0.0f; + + ewp.rgb_mean_and_stdev_mixing = 0.0f; + ewp.mean_stdev_radius = 0; + ewp.enable_rgb_scale_with_alpha = 0; + ewp.alpha_radius = 0; + + ewp.block_artifact_suppression = 0.0f; + ewp.rgba_weights[0] = 1.0f; + ewp.rgba_weights[1] = 1.0f; + ewp.rgba_weights[2] = 1.0f; + ewp.rgba_weights[3] = 1.0f; + ewp.ra_normal_angular_scale = 0; + } + + void setup_ewp(ASTC_COMPRESS_MODE mode, int ydim, int xdim, error_weighting_params& ewp) + { + float oplimit_autoset = 0.0; + float dblimit_autoset_2d = 0.0; + float bmc_autoset = 0.0; + float mincorrel_autoset = 0.0; + + int plimit_autoset = -1; + int maxiters_autoset = 0; + int pcdiv = 1; + + float log10_texels_2d = log((float)(xdim * ydim)) / log(10.0f); + + if (mode == ASTC_COMPRESS_VERY_FAST) + { + plimit_autoset = 2; + oplimit_autoset = 1.0; + dblimit_autoset_2d = MAX(70 - 35 * log10_texels_2d, 53 - 19 * log10_texels_2d); + bmc_autoset = 25; + mincorrel_autoset = 0.5; + maxiters_autoset = 1; + + switch (ydim) + { + case 4: + pcdiv = 240; + break; + case 5: + pcdiv = 56; + break; + case 6: + pcdiv = 64; + break; + case 8: + pcdiv = 47; + break; + case 10: + pcdiv = 36; + break; + case 12: + pcdiv = 30; + break; + default: + pcdiv = 30; + break; + } + } + else if (mode == ASTC_COMPRESS_FAST) + { + plimit_autoset = 4; + oplimit_autoset = 1.0; + mincorrel_autoset = 0.5; + dblimit_autoset_2d = MAX(85 - 35 * log10_texels_2d, 63 - 19 * log10_texels_2d); + bmc_autoset = 50; + maxiters_autoset = 1; + + switch (ydim) + { + case 4: + pcdiv = 60; + break; + case 5: + pcdiv = 27; + break; + case 6: + pcdiv = 30; + break; + case 8: + pcdiv = 24; + break; + case 10: + pcdiv = 16; + break; + case 12: + pcdiv = 20; + break; + default: + pcdiv = 20; + break; + }; + } + else if (mode == ASTC_COMPRESS_MEDIUM) + { + plimit_autoset = 25; + oplimit_autoset = 1.2f; + mincorrel_autoset = 0.75f; + dblimit_autoset_2d = MAX(95 - 35 * log10_texels_2d, 70 - 19 * log10_texels_2d); + bmc_autoset = 75; + maxiters_autoset = 2; + + switch (ydim) + { + case 4: + pcdiv = 25; + break; + case 5: + pcdiv = 15; + break; + case 6: + pcdiv = 15; + break; + case 8: + pcdiv = 10; + break; + case 10: + pcdiv = 8; + break; + case 12: + pcdiv = 6; + break; + default: + pcdiv = 6; + break; + }; + } + else if (mode == ASTC_COMPRESS_THOROUGH) + { + plimit_autoset = 100; + oplimit_autoset = 2.5f; + mincorrel_autoset = 0.95f; + dblimit_autoset_2d = MAX(105 - 35 * log10_texels_2d, 77 - 19 * log10_texels_2d); + bmc_autoset = 95; + maxiters_autoset = 4; + + switch (ydim) + { + case 4: + pcdiv = 12; + break; + case 5: + pcdiv = 7; + break; + case 6: + pcdiv = 7; + break; + case 8: + pcdiv = 5; + break; + case 10: + pcdiv = 4; + break; + case 12: + pcdiv = 3; + break; + default: + pcdiv = 3; + break; + }; + } + else if (mode == ASTC_COMPRESS_EXHAUSTIVE) + { + plimit_autoset = PARTITION_COUNT; + oplimit_autoset = 1000.0f; + mincorrel_autoset = 0.99f; + dblimit_autoset_2d = 999.0f; + bmc_autoset = 100; + maxiters_autoset = 4; + + switch (ydim) + { + case 4: + pcdiv = 3; + break; + case 5: + pcdiv = 1; + break; + case 6: + pcdiv = 1; + break; + case 8: + pcdiv = 1; + break; + case 10: + pcdiv = 1; + break; + case 12: + pcdiv = 1; + break; + default: + pcdiv = 1; + break; + } + } + + int partitions_to_test = plimit_autoset; + float dblimit_2d = dblimit_autoset_2d; + float oplimit = oplimit_autoset; + float mincorrel = mincorrel_autoset; + + int maxiters = maxiters_autoset; + ewp.max_refinement_iters = maxiters; + + ewp.block_mode_cutoff = bmc_autoset / 100.0f; + + float texel_avg_error_limit_2d; + + if (rgb_force_use_of_hdr == 0) + { + texel_avg_error_limit_2d = pow(0.1f, dblimit_2d * 0.1f) * 65535.0f * 65535.0f; + } + else + { + texel_avg_error_limit_2d = 0.0f; + } + ewp.partition_1_to_2_limit = oplimit; + ewp.lowest_correlation_cutoff = mincorrel; + + if (partitions_to_test < 1) + partitions_to_test = 1; + else if (partitions_to_test > PARTITION_COUNT) + partitions_to_test = PARTITION_COUNT; + ewp.partition_search_limit = partitions_to_test; + + ewp.texel_avg_error_limit = texel_avg_error_limit_2d; + + expand_block_artifact_suppression(xdim, ydim, 1, &ewp); + } +} + +size_t astc_compressed_size(int w, int h, int bw, int bh) +{ + int nx = (w + bw - 1) / bw; + int ny = (h + bh - 1) / bh; + + return nx * ny * 16; +} + +void astc_compress +( + int src_width, + int src_height, + const uint8_t* src_data, + ASTC_CHANNELS src_channels, + int src_stride, + + int block_width, + int block_height, + ASTC_COMPRESS_MODE compress_mode, + ASTC_DECODE_MODE decode_mode, + uint8_t* dst_data +) +{ + init_tables(); + + error_weighting_params ewp; + init_ewp(ewp); + setup_ewp(compress_mode, block_width, block_height, ewp); + + if (src_stride == 0) + src_stride = src_width * 4; + + encode_astc + ( + src_data, + src_stride, + k_swizzles[src_channels], + src_width, src_height, + block_width, block_height, + &ewp, + (astc_decode_mode) decode_mode, + dst_data + ); +} + +namespace +{ + // More direct version of the astc_codec_image routine, which operates on a + // more conventional 2D image layout. + void from_imageblock(int xdim, int ydim, const imageblock* pb, bool srgb, swizzlepattern swz, uint8_t* dst_data, int dst_stride) + { + const float* fptr = pb->orig_data; + const uint8_t* nptr = pb->nan_texel; + + for (int y = 0; y < ydim; y++) + { + for (int x = 0; x < xdim; x++) + { + if (*nptr) + { + // NaN-pixel, but we can't display it. Display purple instead. + dst_data[4 * x + swz.r] = 0xFF; + dst_data[4 * x + swz.g] = 0x00; + dst_data[4 * x + swz.b] = 0xFF; + dst_data[4 * x + swz.a] = 0xFF; + } + else + { + float r = fptr[0]; + float g = fptr[1]; + float b = fptr[2]; + float a = fptr[3]; + + if (srgb) + { + if (r <= 0.0031308f) + r = r * 12.92f; + else if (r <= 1) + r = 1.055f * pow(r, (1.0f / 2.4f)) - 0.055f; + + if (g <= 0.0031308f) + g = g * 12.92f; + else if (g <= 1) + g = 1.055f * pow(g, (1.0f / 2.4f)) - 0.055f; + + if (b <= 0.0031308f) + b = b * 12.92f; + else if (b <= 1) + b = 1.055f * pow(b, (1.0f / 2.4f)) - 0.055f; + } + + // clamp to [0,1] + if (r > 1.0f) + r = 1.0f; + if (g > 1.0f) + g = 1.0f; + if (b > 1.0f) + b = 1.0f; + if (a > 1.0f) + a = 1.0f; + + // pack the data + dst_data[4 * x + swz.r] = uint8_t(floorf(r * 255.0f + 0.5f)); + dst_data[4 * x + swz.g] = uint8_t(floorf(g * 255.0f + 0.5f)); + dst_data[4 * x + swz.b] = uint8_t(floorf(b * 255.0f + 0.5f)); + dst_data[4 * x + swz.a] = uint8_t(floorf(a * 255.0f + 0.5f)); + } + + fptr += 4; + nptr++; + } + + dst_data += dst_stride; + } + } +} + +void astc_decompress +( + const uint8_t* src_data, + int xdim, + int ydim, + ASTC_DECODE_MODE decode_mode, + + int xsize, + int ysize, + uint8_t* dst_data, + ASTC_CHANNELS dst_channels, + int dst_stride +) +{ + init_tables(); + + int xblocks = (xsize + xdim - 1) / xdim; + int yblocks = (ysize + ydim - 1) / ydim; + + if (dst_stride == 0) + dst_stride = 4 * xsize; + + imageblock pb; + + for (int y = 0; y < yblocks; y++) + { + int ypos = y * ydim; + int clamp_ydim = MIN(ysize - ypos, ydim); + + uint8_t* dst_row = dst_data + ypos * dst_stride; + + for (int x = 0; x < xblocks; x++) + { + int xpos = x * xdim; + int clamp_xdim = MIN(xsize - xpos, xdim); + + physical_compressed_block pcb = *(const physical_compressed_block *) src_data; + symbolic_compressed_block scb; + + physical_to_symbolic(xdim, ydim, 1, pcb, &scb); + decompress_symbolic_block((astc_decode_mode) decode_mode, xdim, ydim, 1, xpos, ypos, 0, &scb, &pb); + + from_imageblock(clamp_xdim, clamp_ydim, &pb, decode_mode == ASTC_DECODE_LDR_SRGB, k_swizzles[dst_channels], dst_row + xpos * 4, dst_stride); + + src_data += 16; + } + } +} + +// Relevant astc source files. These aren't set up for a bulk build yet though. +#ifdef DISABLED + #include "astc_block_sizes2.cpp" + #include "astc_color_quantize.cpp" + #include "astc_color_unquantize.cpp" + #include "astc_compress_symbolic.cpp" + #include "astc_compute_variance.cpp" + #include "astc_decompress_symbolic.cpp" + #include "astc_encoding_choice_error.cpp" + #include "astc_find_best_partitioning.cpp" + #include "astc_ideal_endpoints_and_weights.cpp" + #include "astc_imageblock.cpp" + #include "astc_integer_sequence.cpp" + #include "astc_kmeans_partitioning.cpp" + #include "astc_partition_tables.cpp" + #include "astc_percentile_tables.cpp" + #include "astc_pick_best_endpoint_format.cpp" + #include "astc_quantization.cpp" + #include "astc_symbolic_physical.cpp" + #include "astc_weight_align.cpp" + #include "astc_weight_quant_xfer_tables.cpp" + #include "mathlib.cpp" + #include "softfloat.cpp" +#endif diff --git a/3rdparty/bimg/3rdparty/astc/astc_lib.h b/3rdparty/bimg/3rdparty/astc/astc_lib.h new file mode 100644 index 00000000000..373f33b82ea --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_lib.h @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/** + * @author Andrew Willmott + * + * @brief Library api for astc codec, to be used as an alternative to astc_toplevel.cpp + */ +/*----------------------------------------------------------------------------*/ + +#ifndef ASTC_LIB_H +#define ASTC_LIB_H + +#include +#include + +enum ASTC_COMPRESS_MODE // Trade-off compression quality for speed +{ + ASTC_COMPRESS_VERY_FAST, + ASTC_COMPRESS_FAST, + ASTC_COMPRESS_MEDIUM, + ASTC_COMPRESS_THOROUGH, + ASTC_COMPRESS_EXHAUSTIVE, +}; + +enum ASTC_DECODE_MODE +{ + ASTC_DECODE_LDR_SRGB, // texture will be decompressed to 8-bit SRGB + ASTC_DECODE_LDR_LINEAR, // texture will be decompressed to 8-bit linear + ASTC_DECODE_HDR // texture will be decompressed to 16-bit linear +}; + +enum ASTC_CHANNELS +{ + ASTC_RGBA, + ASTC_BGRA +}; + + +size_t astc_compressed_size(int block_width, int block_height, int width, int height); +//!< Returns size of the compressed data for a width x height source image, assuming the given block size + +void astc_compress +( + int src_width, + int src_height, + const uint8_t* src_data, + ASTC_CHANNELS src_channels, + int src_stride, + + int block_width, + int block_height, + ASTC_COMPRESS_MODE compress_mode, + ASTC_DECODE_MODE decode_mode, + uint8_t* dst_data +); +//!< Compress 8-bit rgba source image into dst_data (expected to be of size astc_compressed_size(...)) + +void astc_decompress +( + const uint8_t* src_data, + int block_width, + int block_height, + ASTC_DECODE_MODE decode_mode, + + int dst_width, + int dst_height, + uint8_t* dst_data, + ASTC_CHANNELS dst_channels, + int dst_stride +); +//!< Decompress astc source image into 8-bit rgba destination image. + +#endif + diff --git a/3rdparty/bimg/3rdparty/astc/astc_partition_tables.cpp b/3rdparty/bimg/3rdparty/astc/astc_partition_tables.cpp new file mode 100644 index 00000000000..7e0a46011c8 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_partition_tables.cpp @@ -0,0 +1,323 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions to generate partition tables for ASTC. + * + * We generate tables only for the block sizes that have actually been + * specified to the codec. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +static partition_info **partition_tables[4096]; + +/* + Produce a canonicalized representation of a partition pattern + + The largest possible such representation is 432 bits, equal to 7 uint64_t values. +*/ +static void gen_canonicalized_partition_table(int texel_count, const uint8_t * partition_table, uint64_t canonicalized[7]) +{ + int i; + for (i = 0; i < 7; i++) + canonicalized[i] = 0; + + int mapped_index[4]; + int map_weight_count = 0; + for (i = 0; i < 4; i++) + mapped_index[i] = -1; + + for (i = 0; i < texel_count; i++) + { + int index = partition_table[i]; + if (mapped_index[index] == -1) + mapped_index[index] = map_weight_count++; + uint64_t xlat_index = mapped_index[index]; + canonicalized[i >> 5] |= xlat_index << (2 * (i & 0x1F)); + } +} + + +static int compare_canonicalized_partition_tables(const uint64_t part1[7], const uint64_t part2[7]) +{ + if (part1[0] != part2[0]) + return 0; + if (part1[1] != part2[1]) + return 0; + if (part1[2] != part2[2]) + return 0; + if (part1[3] != part2[3]) + return 0; + if (part1[4] != part2[4]) + return 0; + if (part1[5] != part2[5]) + return 0; + if (part1[6] != part2[6]) + return 0; + return 1; +} + + +/* + For a partition table, detect partitionings that are equivalent, then mark them as invalid. This reduces the number of partitions that the codec has to consider and thus improves encode + performance. */ +static void partition_table_zap_equal_elements(int xdim, int ydim, int zdim, partition_info * pi) +{ + int partition_tables_zapped = 0; + + int texel_count = xdim * ydim * zdim; + + int i, j; + uint64_t *canonicalizeds = new uint64_t[PARTITION_COUNT * 7]; + + + for (i = 0; i < PARTITION_COUNT; i++) + { + gen_canonicalized_partition_table(texel_count, pi[i].partition_of_texel, canonicalizeds + i * 7); + } + + for (i = 0; i < PARTITION_COUNT; i++) + { + for (j = 0; j < i; j++) + { + if (compare_canonicalized_partition_tables(canonicalizeds + 7 * i, canonicalizeds + 7 * j)) + { + pi[i].partition_count = 0; + partition_tables_zapped++; + break; + } + } + } + delete[]canonicalizeds; +} + + +uint32_t hash52(uint32_t inp) +{ + inp ^= inp >> 15; + + inp *= 0xEEDE0891; // (2^4+1)*(2^7+1)*(2^17-1) + inp ^= inp >> 5; + inp += inp << 16; + inp ^= inp >> 7; + inp ^= inp >> 3; + inp ^= inp << 6; + inp ^= inp >> 17; + return inp; +} + + + +int select_partition(int seed, int x, int y, int z, int partitioncount, int small_block) +{ + if (small_block) + { + x <<= 1; + y <<= 1; + z <<= 1; + } + + seed += (partitioncount - 1) * 1024; + + uint32_t rnum = hash52(seed); + + uint8_t seed1 = rnum & 0xF; + uint8_t seed2 = (rnum >> 4) & 0xF; + uint8_t seed3 = (rnum >> 8) & 0xF; + uint8_t seed4 = (rnum >> 12) & 0xF; + uint8_t seed5 = (rnum >> 16) & 0xF; + uint8_t seed6 = (rnum >> 20) & 0xF; + uint8_t seed7 = (rnum >> 24) & 0xF; + uint8_t seed8 = (rnum >> 28) & 0xF; + uint8_t seed9 = (rnum >> 18) & 0xF; + uint8_t seed10 = (rnum >> 22) & 0xF; + uint8_t seed11 = (rnum >> 26) & 0xF; + uint8_t seed12 = ((rnum >> 30) | (rnum << 2)) & 0xF; + + // squaring all the seeds in order to bias their distribution + // towards lower values. + seed1 *= seed1; + seed2 *= seed2; + seed3 *= seed3; + seed4 *= seed4; + seed5 *= seed5; + seed6 *= seed6; + seed7 *= seed7; + seed8 *= seed8; + seed9 *= seed9; + seed10 *= seed10; + seed11 *= seed11; + seed12 *= seed12; + + + int sh1, sh2, sh3; + if (seed & 1) + { + sh1 = (seed & 2 ? 4 : 5); + sh2 = (partitioncount == 3 ? 6 : 5); + } + else + { + sh1 = (partitioncount == 3 ? 6 : 5); + sh2 = (seed & 2 ? 4 : 5); + } + sh3 = (seed & 0x10) ? sh1 : sh2; + + seed1 >>= sh1; + seed2 >>= sh2; + seed3 >>= sh1; + seed4 >>= sh2; + seed5 >>= sh1; + seed6 >>= sh2; + seed7 >>= sh1; + seed8 >>= sh2; + + seed9 >>= sh3; + seed10 >>= sh3; + seed11 >>= sh3; + seed12 >>= sh3; + + + + int a = seed1 * x + seed2 * y + seed11 * z + (rnum >> 14); + int b = seed3 * x + seed4 * y + seed12 * z + (rnum >> 10); + int c = seed5 * x + seed6 * y + seed9 * z + (rnum >> 6); + int d = seed7 * x + seed8 * y + seed10 * z + (rnum >> 2); + + + // apply the saw + a &= 0x3F; + b &= 0x3F; + c &= 0x3F; + d &= 0x3F; + + // remove some of the components if we are to output < 4 partitions. + if (partitioncount <= 3) + d = 0; + if (partitioncount <= 2) + c = 0; + if (partitioncount <= 1) + b = 0; + + int partition; + if (a >= b && a >= c && a >= d) + partition = 0; + else if (b >= c && b >= d) + partition = 1; + else if (c >= d) + partition = 2; + else + partition = 3; + return partition; +} + + + +void generate_one_partition_table(int xdim, int ydim, int zdim, int partition_count, int partition_index, partition_info * pt) +{ + int small_block = (xdim * ydim * zdim) < 32; + + uint8_t *partition_of_texel = pt->partition_of_texel; + int x, y, z, i; + + + for (z = 0; z < zdim; z++) + for (y = 0; y < ydim; y++) + for (x = 0; x < xdim; x++) + { + uint8_t part = select_partition(partition_index, x, y, z, partition_count, small_block); + *partition_of_texel++ = part; + } + + + int texels_per_block = xdim * ydim * zdim; + + int counts[4]; + for (i = 0; i < 4; i++) + counts[i] = 0; + + for (i = 0; i < texels_per_block; i++) + { + int partition = pt->partition_of_texel[i]; + pt->texels_of_partition[partition][counts[partition]++] = i; + } + + for (i = 0; i < 4; i++) + pt->texels_per_partition[i] = counts[i]; + + if (counts[0] == 0) + pt->partition_count = 0; + else if (counts[1] == 0) + pt->partition_count = 1; + else if (counts[2] == 0) + pt->partition_count = 2; + else if (counts[3] == 0) + pt->partition_count = 3; + else + pt->partition_count = 4; + + + + for (i = 0; i < 4; i++) + pt->coverage_bitmaps[i] = 0ULL; + + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + int texels_to_process = bsd->texelcount_for_bitmap_partitioning; + for (i = 0; i < texels_to_process; i++) + { + int idx = bsd->texels_for_bitmap_partitioning[i]; + pt->coverage_bitmaps[pt->partition_of_texel[idx]] |= 1ULL << i; + } + +} + +static void generate_partition_tables(int xdim, int ydim, int zdim) +{ + int i; + + + partition_info *one_partition = new partition_info; + partition_info *two_partitions = new partition_info[1024]; + partition_info *three_partitions = new partition_info[1024]; + partition_info *four_partitions = new partition_info[1024]; + + partition_info **partition_table = new partition_info *[5]; + partition_table[0] = NULL; + partition_table[1] = one_partition; + partition_table[2] = two_partitions; + partition_table[3] = three_partitions; + partition_table[4] = four_partitions; + + generate_one_partition_table(xdim, ydim, zdim, 1, 0, one_partition); + for (i = 0; i < 1024; i++) + { + generate_one_partition_table(xdim, ydim, zdim, 2, i, two_partitions + i); + generate_one_partition_table(xdim, ydim, zdim, 3, i, three_partitions + i); + generate_one_partition_table(xdim, ydim, zdim, 4, i, four_partitions + i); + } + + partition_table_zap_equal_elements(xdim, ydim, zdim, two_partitions); + partition_table_zap_equal_elements(xdim, ydim, zdim, three_partitions); + partition_table_zap_equal_elements(xdim, ydim, zdim, four_partitions); + + partition_tables[xdim + 16 * ydim + 256 * zdim] = partition_table; +} + + +const partition_info *get_partition_table(int xdim, int ydim, int zdim, int partition_count) +{ + int ptindex = xdim + 16 * ydim + 256 * zdim; + if (partition_tables[ptindex] == NULL) + generate_partition_tables(xdim, ydim, zdim); + + return partition_tables[ptindex][partition_count]; +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_percentile_tables.cpp b/3rdparty/bimg/3rdparty/astc/astc_percentile_tables.cpp new file mode 100644 index 00000000000..6b96ef8cf72 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_percentile_tables.cpp @@ -0,0 +1,4768 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Percentile tables for ASTC. + */ +/*----------------------------------------------------------------------------*/ + +extern const float percentile_table_4x4[2048]; +extern const float percentile_table_4x5[2048]; +extern const float percentile_table_4x6[2048]; +extern const float percentile_table_4x8[2048]; +extern const float percentile_table_4x10[2048]; +extern const float percentile_table_4x12[2048]; +extern const float percentile_table_5x4[2048]; +extern const float percentile_table_5x5[2048]; +extern const float percentile_table_5x6[2048]; +extern const float percentile_table_5x8[2048]; +extern const float percentile_table_5x10[2048]; +extern const float percentile_table_5x12[2048]; +extern const float percentile_table_6x4[2048]; +extern const float percentile_table_6x5[2048]; +extern const float percentile_table_6x6[2048]; +extern const float percentile_table_6x8[2048]; +extern const float percentile_table_6x10[2048]; +extern const float percentile_table_6x12[2048]; +extern const float percentile_table_8x4[2048]; +extern const float percentile_table_8x5[2048]; +extern const float percentile_table_8x6[2048]; +extern const float percentile_table_8x8[2048]; +extern const float percentile_table_8x10[2048]; +extern const float percentile_table_8x12[2048]; +extern const float percentile_table_10x4[2048]; +extern const float percentile_table_10x5[2048]; +extern const float percentile_table_10x6[2048]; +extern const float percentile_table_10x8[2048]; +extern const float percentile_table_10x10[2048]; +extern const float percentile_table_10x12[2048]; +extern const float percentile_table_12x4[2048]; +extern const float percentile_table_12x5[2048]; +extern const float percentile_table_12x6[2048]; +extern const float percentile_table_12x8[2048]; +extern const float percentile_table_12x10[2048]; +extern const float percentile_table_12x12[2048]; + + +const float percentile_table_4x4[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.8661f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7732f, 0.8567f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7818f, 0.8914f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.4578f, 0.5679f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4183f, 0.4961f, 0.5321f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9151f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9400f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9678f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8111f, 0.8833f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8299f, 0.8988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9182f, 0.9692f, 0.9820f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9663f, 0.9911f, 0.8707f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9088f, 0.9374f, 0.8793f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8750f, 0.8952f, 0.7356f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2746f, 0.0000f, 0.0772f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.1487f, 0.2193f, 0.3263f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9917f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9996f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9516f, 0.9838f, 0.9927f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9731f, 0.9906f, 0.9448f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9900f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9991f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.9987f, 0.9936f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9985f, 0.9615f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9269f, 0.9577f, 0.9057f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9023f, 0.9241f, 0.7499f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9757f, 0.9846f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9922f, 0.9932f, 0.9792f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9881f, 0.9494f, 0.8178f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9780f, 0.8518f, 0.6206f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9472f, 0.7191f, 0.7003f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8356f, 0.3772f, 0.9971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9769f, 0.9875f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, 0.9941f, 0.9861f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9956f, 0.9982f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9868f, 0.9854f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9888f, 0.9811f, 0.9706f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9894f, 0.9425f, 0.8465f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9718f, 0.8614f, 0.6422f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9648f, 0.9212f, 0.8412f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9596f, 0.9557f, 0.9537f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9999f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, 0.9984f, 0.9958f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9952f, 0.9994f, 0.9633f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9829f, 0.9120f, 0.8042f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9744f, 0.9296f, 0.9349f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9993f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9998f, 0.9802f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8874f, 0.5963f, 0.9323f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8239f, 0.7625f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6625f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7895f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_4x5[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.8886f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7962f, 0.9052f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8118f, 0.9315f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7247f, 0.8069f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7789f, 0.8308f, 0.8434f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.4129f, 0.4395f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3795f, 0.3370f, 0.1853f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9566f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8585f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8946f, 0.9102f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9502f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9739f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8854f, 0.9554f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9150f, 0.9748f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7849f, 0.8689f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8214f, 0.7729f, 0.8016f, + 1.0000f, 0.9172f, 0.9659f, 0.9781f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9701f, 0.9873f, 0.8394f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9457f, 0.9637f, 0.9334f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9236f, 0.9407f, 0.7395f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6662f, 0.6019f, 0.7169f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5436f, 0.7007f, 0.7907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.0000f, 0.2718f, 0.5740f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.0959f, 0.5888f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9996f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9928f, 0.9995f, 0.9986f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.9998f, 0.9879f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9441f, 0.9773f, 0.9256f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9812f, 0.9789f, 0.8975f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9992f, 0.9949f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9990f, 0.9541f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9690f, 0.9841f, 0.9730f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9425f, 0.9602f, 0.8354f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9001f, 0.6261f, 0.6370f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8549f, 0.8473f, 0.6477f, + 1.0000f, 1.0000f, 0.9648f, 0.9867f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9910f, 0.9884f, 0.9827f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9890f, 0.9670f, 0.9077f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9855f, 0.9276f, 0.6753f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9711f, 0.7668f, 0.5272f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9295f, 0.5087f, 0.9971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9488f, 0.6570f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7537f, 0.9590f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9982f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9848f, 0.9932f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9955f, 0.9936f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9797f, 0.9720f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9680f, 0.9861f, 0.9353f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.9987f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9976f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.9905f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9915f, 0.9919f, 0.9819f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9895f, 0.9389f, 0.8512f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9764f, 0.8917f, 0.4628f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9756f, 0.8262f, 0.6148f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9372f, 0.6843f, 0.6926f, + 1.0000f, 0.9614f, 0.9194f, 0.8723f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9473f, 0.9515f, 0.9625f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7322f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9126f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9991f, 0.9978f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9999f, 0.9579f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9900f, 0.8789f, 0.7088f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9805f, 0.8620f, 0.9026f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8822f, 0.8655f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8166f, 0.9943f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.9997f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9999f, 0.9834f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9215f, 0.5589f, 0.9528f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8756f, 0.7604f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4861f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7467f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_4x6[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7443f, 0.8512f, + 1.0000f, 1.0000f, 1.0000f, 0.8929f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7596f, 0.8882f, + 1.0000f, 1.0000f, 0.8221f, 0.9144f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7051f, 0.6993f, + 1.0000f, 1.0000f, 0.8355f, 0.9440f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7830f, 0.7737f, 0.7389f, + 1.0000f, 1.0000f, 0.7918f, 0.8542f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2729f, 0.4793f, 0.1616f, + 1.0000f, 0.8322f, 0.8760f, 0.8995f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4122f, 0.2349f, 0.0000f, + 1.0000f, 1.0000f, 0.6930f, 0.7495f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7225f, 0.5849f, 0.3642f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9695f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9526f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9550f, 0.9840f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9654f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9824f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9036f, 0.9718f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9414f, 0.9800f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8600f, 0.9466f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8859f, 0.8735f, 0.8451f, + 1.0000f, 0.9271f, 0.9605f, 0.9733f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9177f, 0.9626f, 0.9401f, + 1.0000f, 0.9711f, 0.9893f, 0.8255f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9209f, 0.9616f, 0.6804f, + 1.0000f, 0.9584f, 0.9635f, 0.9110f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5268f, 0.4632f, 0.8387f, + 1.0000f, 0.9161f, 0.9316f, 0.7167f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5749f, 0.6867f, 0.8973f, + 1.0000f, 0.7784f, 0.6674f, 0.8115f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0882f, 0.5113f, 1.0000f, + 1.0000f, 0.6455f, 0.8040f, 0.8628f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3374f, 1.0000f, 1.0000f, + 1.0000f, 0.3093f, 0.5529f, 0.8289f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3896f, 0.8811f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 0.9992f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9997f, 0.9830f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9913f, 0.9538f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9871f, 0.9645f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9991f, 0.9921f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9991f, 0.9514f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9761f, 0.9909f, 0.9851f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9490f, 0.9755f, 0.8835f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9286f, 0.7110f, 0.8187f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8951f, 0.9193f, 0.8077f, + 1.0000f, 1.0000f, 0.9679f, 0.9917f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9794f, 0.9703f, 0.9453f, + 1.0000f, 0.9906f, 0.9941f, 0.9856f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9812f, 0.9561f, 0.7876f, + 1.0000f, 0.9866f, 0.9748f, 0.9127f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9687f, 0.7335f, 0.9478f, + 1.0000f, 0.9898f, 0.9387f, 0.7280f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9074f, 0.6294f, 1.0000f, + 1.0000f, 0.9671f, 0.8419f, 0.5944f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9256f, 0.9960f, 1.0000f, + 1.0000f, 0.9502f, 0.6039f, 0.9985f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6607f, 1.0000f, 1.0000f, + 1.0000f, 0.9775f, 0.6127f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8656f, 0.9225f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9975f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9845f, 0.9946f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.9966f, 0.9955f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, 0.9768f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9740f, 0.9835f, 0.9330f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9986f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.9902f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.9880f, 0.9781f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9889f, 0.9301f, 0.8906f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9787f, 0.9055f, 0.4955f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9806f, 0.8000f, 0.4303f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9015f, 0.6211f, 0.5645f, + 1.0000f, 0.9663f, 0.9240f, 0.8709f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8151f, 1.0000f, 1.0000f, + 1.0000f, 0.9573f, 0.9595f, 0.9726f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9359f, 1.0000f, 1.0000f, + 1.0000f, 0.7644f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9344f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9987f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9983f, 0.9972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9935f, 0.9997f, 0.9373f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9885f, 0.8683f, 0.6534f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9818f, 0.8571f, 0.8786f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7960f, 0.7546f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6376f, 0.9930f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, 0.9999f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9927f, 0.9999f, 0.9875f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9092f, 0.5405f, 0.9427f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8482f, 0.6740f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4469f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7691f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_4x8[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6540f, 0.8090f, 1.0000f, 1.0000f, 0.9047f, 0.9767f, + 1.0000f, 1.0000f, 1.0000f, 0.9273f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6869f, 0.8003f, 0.8742f, 1.0000f, 1.0000f, 0.9569f, 0.9887f, + 1.0000f, 1.0000f, 0.8833f, 0.9454f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7850f, 0.6687f, 0.3938f, 1.0000f, 1.0000f, 0.8390f, 0.8033f, + 1.0000f, 1.0000f, 0.8724f, 0.9732f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6489f, 0.6254f, 0.2363f, 1.0000f, 0.8524f, 0.8851f, 0.8117f, + 1.0000f, 1.0000f, 0.8481f, 0.9106f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1043f, 0.1756f, 0.1402f, 1.0000f, 0.8647f, 0.7274f, 0.3414f, + 1.0000f, 0.9000f, 0.9174f, 0.9444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3601f, 0.0000f, 0.4370f, 1.0000f, 0.7036f, 0.6435f, 0.2612f, + 1.0000f, 1.0000f, 0.8143f, 0.8586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8195f, 0.7196f, 0.5069f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9120f, 0.9463f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8920f, 0.9544f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7626f, 0.7881f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7524f, 0.8413f, 0.3226f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8220f, 0.4960f, 0.0657f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5448f, 0.2826f, 0.2081f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9846f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9693f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9673f, 0.9927f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9858f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9921f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9435f, 0.9866f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9738f, 0.9915f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9200f, 0.9750f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9134f, 0.9308f, 0.8903f, + 1.0000f, 0.9405f, 0.9645f, 0.9687f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8606f, 0.7077f, 0.7420f, 1.0000f, 0.9825f, 0.9880f, 0.9761f, + 1.0000f, 0.9834f, 0.9829f, 0.7943f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7593f, 0.7757f, 0.7724f, 1.0000f, 0.9608f, 0.9800f, 0.8436f, + 1.0000f, 0.9600f, 0.9615f, 0.9319f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3037f, 0.8869f, 1.0000f, 1.0000f, 0.5767f, 0.7455f, 0.9577f, + 1.0000f, 0.9212f, 0.9363f, 0.6953f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5917f, 1.0000f, 1.0000f, 1.0000f, 0.7311f, 0.8761f, 0.9331f, + 1.0000f, 0.8295f, 0.6995f, 0.8815f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4085f, 0.8545f, 1.0000f, + 1.0000f, 0.6911f, 0.8686f, 0.9062f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6734f, 1.0000f, 1.0000f, + 1.0000f, 0.4502f, 0.7157f, 0.9092f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5613f, 0.9491f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8319f, 0.9016f, 0.9160f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9630f, 0.8503f, 0.8459f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4628f, 0.7912f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6124f, 0.8969f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5172f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9997f, 0.9981f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9999f, 0.9638f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, 0.9913f, 0.9285f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9854f, 0.9719f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9995f, 0.9901f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9986f, 0.9395f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9795f, 0.9904f, 0.9850f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9473f, 0.9784f, 0.8627f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9623f, 0.7692f, 0.8705f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9385f, 0.9592f, 0.8367f, + 1.0000f, 1.0000f, 0.9773f, 0.9930f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9518f, 0.9225f, 0.8062f, 1.0000f, 0.9907f, 0.9552f, 0.9261f, + 1.0000f, 0.9968f, 0.9944f, 0.9891f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9561f, 0.8343f, 0.9999f, 1.0000f, 0.9805f, 0.9509f, 0.6058f, + 1.0000f, 0.9961f, 0.9877f, 0.9535f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9425f, 0.9910f, 1.0000f, 1.0000f, 0.9526f, 0.6190f, 0.8270f, + 1.0000f, 0.9942f, 0.9744f, 0.8245f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7559f, 1.0000f, 1.0000f, 1.0000f, 0.8565f, 0.3782f, 1.0000f, + 1.0000f, 0.9815f, 0.8886f, 0.7235f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8779f, 1.0000f, 1.0000f, 1.0000f, 0.9652f, 0.9949f, 1.0000f, + 1.0000f, 0.9755f, 0.7384f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6639f, 1.0000f, 1.0000f, + 1.0000f, 0.9838f, 0.6590f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9077f, 0.9147f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9810f, 0.9353f, 0.6826f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9584f, 0.8953f, 0.6379f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9342f, 0.5271f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7973f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9700f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9237f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9969f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9894f, 0.9951f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9966f, 0.9955f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9869f, 0.9725f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9789f, 0.9873f, 0.9415f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 0.9953f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, 0.9935f, 0.9884f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9680f, 0.9249f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9862f, 0.9374f, 0.4852f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9820f, 0.8170f, 0.4740f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8985f, 0.6780f, 0.5691f, + 1.0000f, 0.9659f, 0.9296f, 0.9031f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5843f, 1.0000f, 1.0000f, + 1.0000f, 0.9482f, 0.9666f, 0.9842f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8797f, 1.0000f, 1.0000f, + 1.0000f, 0.8666f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9713f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9998f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9932f, 0.9990f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9918f, 0.9999f, 0.9187f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9897f, 0.7788f, 0.5362f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9778f, 0.7819f, 0.7347f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7117f, 0.6317f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5530f, 0.9937f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9959f, 1.0000f, 0.9985f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9500f, 0.5989f, 0.9706f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8936f, 0.7490f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4231f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7659f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_4x10[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8566f, 0.9251f, 1.0000f, 1.0000f, 0.9271f, 0.9827f, + 1.0000f, 1.0000f, 1.0000f, 0.9436f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8821f, 0.9344f, 0.9492f, 1.0000f, 1.0000f, 0.9428f, 0.9930f, + 1.0000f, 1.0000f, 0.8766f, 0.9560f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8938f, 0.7784f, 0.3546f, 1.0000f, 1.0000f, 0.8646f, 0.8199f, + 1.0000f, 1.0000f, 0.8737f, 0.9734f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7535f, 0.7283f, 0.2504f, 1.0000f, 0.8807f, 0.9012f, 0.8281f, + 1.0000f, 1.0000f, 0.8874f, 0.9280f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7759f, 0.3657f, 0.2921f, 1.0000f, 0.8913f, 0.7955f, 0.3984f, + 1.0000f, 0.9160f, 0.9412f, 0.9671f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6872f, 0.0745f, 0.6100f, 1.0000f, 0.7706f, 0.7381f, 0.3187f, + 1.0000f, 1.0000f, 0.8301f, 0.8707f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8468f, 0.7733f, 0.5470f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8047f, 0.7932f, 1.0000f, 1.0000f, 0.9395f, 0.9712f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8358f, 0.8692f, 0.8320f, 1.0000f, 1.0000f, 0.9060f, 0.9627f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8024f, 0.6745f, 0.2645f, 1.0000f, 1.0000f, 0.8377f, 0.8630f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7250f, 0.2193f, 0.2008f, 1.0000f, 0.8220f, 0.8926f, 0.4195f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7112f, 0.1026f, 0.4946f, 1.0000f, 0.8598f, 0.6657f, 0.3055f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3767f, 0.1538f, 1.0000f, 1.0000f, 0.6913f, 0.4682f, 0.4591f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5926f, 0.7979f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5866f, 0.6366f, 0.6562f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6994f, 0.4296f, 0.1289f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6701f, 0.3312f, 0.3434f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0378f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1783f, 0.2350f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9921f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9784f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9831f, 0.9939f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9614f, 0.9924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9884f, 0.9951f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9420f, 0.9815f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9387f, 0.9461f, 0.8661f, + 1.0000f, 0.9567f, 0.9659f, 0.9652f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8834f, 0.8339f, 0.9000f, 1.0000f, 0.9857f, 0.9896f, 0.9760f, + 1.0000f, 0.9901f, 0.9819f, 0.7622f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8135f, 0.9083f, 0.8900f, 1.0000f, 0.9594f, 0.9798f, 0.8002f, + 1.0000f, 0.9677f, 0.9515f, 0.8861f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5178f, 0.8550f, 1.0000f, 1.0000f, 0.5985f, 0.7810f, 0.9500f, + 1.0000f, 0.9105f, 0.9201f, 0.6788f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7316f, 1.0000f, 1.0000f, 1.0000f, 0.7650f, 0.8534f, 0.9469f, + 1.0000f, 0.8485f, 0.7476f, 0.9036f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5025f, 0.9072f, 1.0000f, + 1.0000f, 0.7678f, 0.8793f, 0.9221f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7594f, 1.0000f, 1.0000f, + 1.0000f, 0.4772f, 0.7835f, 0.9191f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6044f, 0.9689f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6465f, 0.7034f, 0.9231f, 1.0000f, 0.8451f, 0.9308f, 0.9665f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7349f, 0.8241f, 0.9445f, 1.0000f, 0.9850f, 0.8976f, 0.9149f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6314f, 1.0000f, 1.0000f, 1.0000f, 0.6610f, 0.9261f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7860f, 0.9379f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7147f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5326f, 0.6155f, 0.9573f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5253f, 0.8582f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9988f, 0.9974f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9998f, 0.9530f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9839f, 0.8722f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9770f, 0.9353f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9991f, 0.9890f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9993f, 0.9139f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9854f, 0.9919f, 0.9878f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9545f, 0.9846f, 0.8677f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9640f, 0.7446f, 0.8501f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9241f, 0.9476f, 0.8432f, + 1.0000f, 1.0000f, 0.9779f, 0.9978f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9587f, 0.8887f, 0.6209f, 1.0000f, 0.9871f, 0.9553f, 0.9317f, + 1.0000f, 0.9946f, 0.9959f, 0.9928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9181f, 0.6830f, 0.9999f, 1.0000f, 0.9750f, 0.9335f, 0.5610f, + 1.0000f, 0.9960f, 0.9916f, 0.9707f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9048f, 0.9484f, 1.0000f, 1.0000f, 0.9507f, 0.6415f, 0.7506f, + 1.0000f, 0.9914f, 0.9739f, 0.8614f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5398f, 1.0000f, 1.0000f, 1.0000f, 0.8517f, 0.2785f, 1.0000f, + 1.0000f, 0.9835f, 0.9299f, 0.8069f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9601f, 1.0000f, 1.0000f, 1.0000f, 0.9684f, 0.9926f, 1.0000f, + 1.0000f, 0.9864f, 0.8414f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7414f, 1.0000f, 1.0000f, + 1.0000f, 0.9806f, 0.7565f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9289f, 0.9362f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9646f, 0.8156f, 0.9811f, 1.0000f, 0.9843f, 0.9128f, 0.7181f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9211f, 0.6953f, 1.0000f, 1.0000f, 0.9453f, 0.9094f, 0.5542f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9326f, 1.0000f, 1.0000f, 1.0000f, 0.9701f, 0.4859f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7216f, 1.0000f, 1.0000f, 1.0000f, 0.7884f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9789f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8848f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9580f, 0.8752f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9370f, 0.9620f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9765f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9904f, 0.9985f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9935f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9887f, 0.9981f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9977f, 0.9962f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9723f, 0.9793f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9744f, 0.9874f, 0.8964f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9950f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9971f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9976f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 0.9937f, 0.9941f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9909f, 0.9718f, 0.9523f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9881f, 0.9607f, 0.5805f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9868f, 0.8396f, 0.4496f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8780f, 0.7073f, 0.5743f, + 1.0000f, 0.9729f, 0.9404f, 0.9117f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4398f, 1.0000f, 1.0000f, + 1.0000f, 0.9695f, 0.9633f, 0.9893f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7908f, 1.0000f, 1.0000f, + 1.0000f, 0.8951f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9823f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9997f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9906f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, 0.9984f, 0.9955f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9899f, 0.9999f, 0.9024f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.8113f, 0.5679f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9775f, 0.8261f, 0.8091f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6262f, 0.4091f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3877f, 0.9802f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9911f, 1.0000f, 0.9982f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9538f, 0.6514f, 0.9755f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9171f, 0.8178f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5103f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8988f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_4x12[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8570f, 0.9351f, 1.0000f, 1.0000f, 0.9461f, 0.9884f, + 1.0000f, 1.0000f, 1.0000f, 0.9476f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8944f, 0.9376f, 0.9581f, 1.0000f, 1.0000f, 0.9811f, 0.9855f, + 1.0000f, 1.0000f, 0.8777f, 0.9658f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9121f, 0.8362f, 0.4335f, 1.0000f, 1.0000f, 0.8910f, 0.8445f, + 1.0000f, 1.0000f, 0.9001f, 0.9751f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7894f, 0.7758f, 0.3577f, 1.0000f, 0.9024f, 0.9256f, 0.8509f, + 1.0000f, 1.0000f, 0.9301f, 0.9384f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7873f, 0.5440f, 0.4410f, 1.0000f, 0.9013f, 0.8413f, 0.4701f, + 1.0000f, 0.9468f, 0.9618f, 0.9630f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7346f, 0.1421f, 0.7373f, 1.0000f, 0.8184f, 0.8105f, 0.3846f, + 1.0000f, 1.0000f, 0.8656f, 0.9141f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8886f, 0.8002f, 0.6091f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5378f, 1.0000f, 1.0000f, 1.0000f, 0.6809f, 1.0000f, 0.8396f, 0.8125f, 0.5731f, 1.0000f, 0.9438f, 0.9669f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6042f, 1.0000f, 1.0000f, 1.0000f, 0.6916f, 0.8311f, 0.8752f, 0.8585f, 0.3390f, 1.0000f, 0.9247f, 0.9600f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6616f, 1.0000f, 1.0000f, 1.0000f, 0.1980f, 0.8165f, 0.7143f, 0.3757f, 0.6363f, 1.0000f, 0.8294f, 0.8477f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4913f, 1.0000f, 1.0000f, 1.0000f, 0.1094f, 0.7507f, 0.2782f, 0.2886f, 1.0000f, 0.8222f, 0.8898f, 0.3091f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0310f, 1.0000f, 1.0000f, 1.0000f, 0.5560f, 0.7686f, 0.1850f, 0.6319f, 1.0000f, 0.9191f, 0.7050f, 0.2461f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5675f, 0.2231f, 1.0000f, 1.0000f, 0.6985f, 0.4180f, 0.4557f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8145f, 0.8826f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8023f, 0.7710f, 0.6274f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8328f, 0.5182f, 0.1259f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7290f, 0.2349f, 0.4100f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6951f, 0.0862f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3292f, 0.4773f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9896f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9874f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9865f, 0.9955f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7113f, 0.7782f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7981f, 0.8493f, 0.4484f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7082f, 0.2106f, 0.2571f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6183f, 0.0618f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4259f, 0.1570f, 1.0000f, 1.0000f, 1.0000f, 0.9717f, 0.9958f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1715f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9922f, 0.9966f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9391f, 0.9848f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9574f, 0.9675f, 0.8990f, + 1.0000f, 0.9841f, 0.9587f, 0.9624f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9034f, 0.8540f, 0.9309f, 1.0000f, 0.9732f, 0.9837f, 0.9686f, + 1.0000f, 0.9912f, 0.9827f, 0.7481f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8276f, 0.9399f, 0.8790f, 1.0000f, 0.9343f, 0.9760f, 0.7612f, + 1.0000f, 0.9746f, 0.9612f, 0.8967f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6406f, 0.8863f, 1.0000f, 1.0000f, 0.6138f, 0.8065f, 0.9265f, + 1.0000f, 0.9359f, 0.9292f, 0.6733f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7938f, 1.0000f, 1.0000f, 1.0000f, 0.7637f, 0.8599f, 0.9680f, + 1.0000f, 0.8670f, 0.7232f, 0.8979f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5945f, 0.9483f, 1.0000f, + 1.0000f, 0.7661f, 0.8738f, 0.9423f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8345f, 1.0000f, 1.0000f, + 1.0000f, 0.4981f, 0.8429f, 0.9533f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6695f, 0.9795f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4017f, 1.0000f, 1.0000f, 1.0000f, 0.9707f, 0.6880f, 0.7828f, 0.9519f, 1.0000f, 0.8203f, 0.9162f, 0.9505f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6229f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8044f, 0.8851f, 0.9727f, 1.0000f, 0.9770f, 0.8628f, 0.8711f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6656f, 1.0000f, 1.0000f, 1.0000f, 0.5842f, 0.9099f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7734f, 0.9078f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7401f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5116f, 0.7916f, 0.9498f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6492f, 0.9741f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9971f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9996f, 0.9948f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9989f, 0.9219f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9756f, 0.8524f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9653f, 0.9446f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5617f, 0.8697f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7261f, 0.9702f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9994f, 0.9917f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9986f, 0.9238f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9799f, 0.9920f, 0.9851f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9554f, 0.9787f, 0.8555f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9696f, 0.7805f, 0.8614f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9318f, 0.9540f, 0.8933f, + 1.0000f, 1.0000f, 0.9815f, 0.9981f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9326f, 0.8764f, 0.5894f, 1.0000f, 0.9915f, 0.9407f, 0.9200f, + 1.0000f, 0.9940f, 0.9982f, 0.9946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9152f, 0.6449f, 1.0000f, 1.0000f, 0.9722f, 0.9526f, 0.5249f, + 1.0000f, 0.9960f, 0.9893f, 0.9774f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8956f, 0.9210f, 1.0000f, 1.0000f, 0.9647f, 0.6845f, 0.7586f, + 1.0000f, 0.9951f, 0.9868f, 0.8874f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4843f, 1.0000f, 1.0000f, 1.0000f, 0.8724f, 0.2989f, 1.0000f, + 1.0000f, 0.9877f, 0.9453f, 0.8258f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9593f, 1.0000f, 1.0000f, 1.0000f, 0.9779f, 0.9931f, 1.0000f, + 1.0000f, 0.9834f, 0.8814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7850f, 1.0000f, 1.0000f, + 1.0000f, 0.9858f, 0.8240f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9512f, 0.9791f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9664f, 1.0000f, 1.0000f, 1.0000f, 0.9942f, 0.9547f, 0.8085f, 0.9335f, 1.0000f, 0.9823f, 0.8802f, 0.6575f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9283f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9067f, 0.5502f, 1.0000f, 1.0000f, 0.9088f, 0.8642f, 0.3484f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9228f, 1.0000f, 1.0000f, 1.0000f, 0.9415f, 0.3668f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5994f, 1.0000f, 1.0000f, 1.0000f, 0.7560f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9636f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8461f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9561f, 0.7018f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8921f, 0.9171f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9368f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9991f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9808f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9927f, 0.9962f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9887f, 0.9933f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9929f, 0.9956f, 0.9975f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9898f, 0.9804f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9890f, 0.9925f, 0.9274f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9131f, 0.7534f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9987f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9110f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9949f, 0.9936f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9737f, 0.9567f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9830f, 0.9641f, 0.5787f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9844f, 0.8379f, 0.5048f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8839f, 0.7455f, 0.6771f, + 1.0000f, 0.9819f, 0.9430f, 0.9181f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2677f, 1.0000f, 1.0000f, + 1.0000f, 0.9712f, 0.9691f, 0.9880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7202f, 1.0000f, 1.0000f, + 1.0000f, 0.9490f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9974f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9998f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 1.0000f, 0.9904f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9907f, 0.9992f, 0.9944f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, 0.9998f, 0.9056f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9909f, 0.7959f, 0.4630f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9765f, 0.7173f, 0.7318f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6533f, 0.3193f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3931f, 0.9783f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 1.0000f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9871f, 0.7428f, 0.9901f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9606f, 0.9045f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5315f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8683f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_5x4[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9496f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8709f, 0.9575f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9171f, 0.9748f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7120f, 0.8199f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7195f, 0.8475f, 0.8778f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.8093f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7545f, 0.8939f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7609f, 0.8637f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8146f, 0.7796f, 0.7858f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.4100f, 0.4583f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3782f, 0.3366f, 0.1850f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9259f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9468f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9789f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8600f, 0.9338f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8996f, 0.9424f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9871f, 0.9983f, 0.9979f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9960f, 0.9996f, 0.9853f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9691f, 0.9797f, 0.9711f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9375f, 0.9680f, 0.8560f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7043f, 0.5964f, 0.6432f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6090f, 0.6709f, 0.7735f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9279f, 0.9550f, 0.8744f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9701f, 0.9537f, 0.8386f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8879f, 0.5694f, 0.6328f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8247f, 0.8295f, 0.6886f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.0000f, 0.2712f, 0.5397f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.0963f, 0.5833f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9937f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9440f, 0.9832f, 0.9914f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9756f, 0.9930f, 0.9075f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9993f, 0.9943f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9995f, 0.9612f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9563f, 0.9781f, 0.9482f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9509f, 0.9600f, 0.7919f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9846f, 0.9901f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9955f, 0.9949f, 0.9922f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9891f, 0.9319f, 0.8673f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9773f, 0.8910f, 0.4347f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9635f, 0.8035f, 0.5226f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9148f, 0.5045f, 0.9972f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9839f, 0.9624f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9647f, 0.9818f, 0.8812f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9739f, 0.8431f, 0.6214f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9409f, 0.6619f, 0.6966f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9523f, 0.6526f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7410f, 0.9658f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9982f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9720f, 0.9905f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, 0.9876f, 0.9910f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9987f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9918f, 0.9896f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9865f, 0.9881f, 0.9811f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9886f, 0.9669f, 0.9238f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9804f, 0.9392f, 0.6799f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9926f, 0.9100f, 0.7478f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9825f, 0.9023f, 0.9216f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4818f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7267f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8518f, 0.8968f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8341f, 0.9952f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9991f, 0.9974f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, 0.9995f, 0.9588f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9859f, 0.9049f, 0.7977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9765f, 0.9299f, 0.9357f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9994f, 0.9986f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9999f, 0.9730f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9124f, 0.5547f, 0.9454f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8846f, 0.7672f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7339f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9194f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_5x5[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9673f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8974f, 0.9705f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9498f, 0.9880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7791f, 0.9035f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8333f, 0.9204f, 0.9408f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6652f, 0.7473f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6369f, 0.6289f, 0.4604f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.7754f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6903f, 0.8953f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7639f, 0.8932f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8120f, 0.8089f, 0.7862f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6844f, 0.7250f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6955f, 0.6206f, 0.3520f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2657f, 0.4988f, 0.1727f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5175f, 0.1199f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9727f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8910f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9055f, 0.9093f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9665f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9131f, 0.9740f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9510f, 0.9875f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8027f, 0.9112f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8448f, 0.8392f, 0.8528f, + 1.0000f, 0.9910f, 0.9977f, 0.9974f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9976f, 0.9998f, 0.9802f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9772f, 0.9892f, 0.9845f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9568f, 0.9747f, 0.8704f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7678f, 0.7431f, 0.8728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6783f, 0.8888f, 0.8421f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3271f, 0.5343f, 0.8182f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3750f, 0.8502f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9168f, 0.9522f, 0.8304f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9713f, 0.9448f, 0.7598f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9290f, 0.6512f, 0.7056f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8798f, 0.8630f, 0.7515f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3020f, 0.6100f, 0.8243f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4798f, 0.8866f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2212f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4198f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9934f, 0.9986f, 0.9991f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9997f, 0.9813f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9435f, 0.9657f, 0.9186f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9835f, 0.9734f, 0.8752f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9993f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9990f, 0.9931f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9996f, 0.9600f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9766f, 0.9900f, 0.9870f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9620f, 0.9790f, 0.8680f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9557f, 0.7202f, 0.7298f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9274f, 0.9150f, 0.7556f, + 1.0000f, 1.0000f, 0.9830f, 0.9888f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9951f, 0.9955f, 0.9953f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9913f, 0.9590f, 0.9222f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9796f, 0.9257f, 0.5728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9630f, 0.7006f, 0.3980f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8775f, 0.4409f, 0.9903f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9697f, 0.6582f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8058f, 0.9074f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9784f, 0.9681f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9461f, 0.9778f, 0.8605f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9856f, 0.8995f, 0.7344f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9648f, 0.7717f, 0.8475f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9689f, 0.6442f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7962f, 0.9336f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9421f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8151f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9984f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9865f, 0.9969f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9946f, 0.9958f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9760f, 0.9819f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9610f, 0.9840f, 0.9546f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9987f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9936f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9928f, 0.9919f, 0.9851f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9896f, 0.9579f, 0.9239f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9753f, 0.9305f, 0.5978f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9808f, 0.9015f, 0.7154f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9639f, 0.8213f, 0.7929f, + 1.0000f, 0.9922f, 0.9395f, 0.7388f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9925f, 0.9321f, 0.9534f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5473f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7995f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8363f, 0.9351f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8274f, 0.9983f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9996f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 1.0000f, 0.9916f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9941f, 0.9995f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.9999f, 0.9486f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9884f, 0.8554f, 0.6717f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9824f, 0.8655f, 0.9366f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8844f, 0.8580f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7828f, 0.9960f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 0.9997f, 0.9978f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.9994f, 0.9720f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9381f, 0.5602f, 0.9473f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8821f, 0.7105f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5854f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7896f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_5x6[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7676f, 0.8675f, + 1.0000f, 1.0000f, 1.0000f, 0.9864f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7053f, 0.9024f, + 1.0000f, 1.0000f, 0.9386f, 0.9764f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7801f, 0.7480f, + 1.0000f, 1.0000f, 0.9611f, 0.9896f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8218f, 0.8480f, 0.8548f, + 1.0000f, 1.0000f, 0.8503f, 0.9257f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8005f, 0.6960f, 0.3353f, + 1.0000f, 0.8947f, 0.9459f, 0.9561f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6706f, 0.6054f, 0.2768f, + 1.0000f, 1.0000f, 0.7892f, 0.8033f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2041f, 0.1229f, 0.0000f, + 1.0000f, 0.7546f, 0.6863f, 0.4459f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3735f, 0.1652f, 0.2428f, + 1.0000f, 1.0000f, 1.0000f, 0.8695f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8914f, 0.9111f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8267f, 0.9097f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8613f, 0.8655f, 0.8194f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7412f, 0.8060f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7739f, 0.6811f, 0.4847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7978f, 0.6426f, 0.3562f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6252f, 0.4722f, 0.0797f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9822f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9675f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9641f, 0.9852f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9826f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9889f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9352f, 0.9793f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9648f, 0.9912f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8994f, 0.9701f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9083f, 0.9192f, 0.8846f, + 1.0000f, 0.9938f, 0.9983f, 0.9985f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9232f, 0.9570f, 0.9270f, + 1.0000f, 0.9993f, 0.9999f, 0.9808f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9219f, 0.9543f, 0.6541f, + 1.0000f, 0.9753f, 0.9879f, 0.9779f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6188f, 0.5981f, 0.9069f, + 1.0000f, 0.9449f, 0.9689f, 0.8593f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7008f, 0.7950f, 0.9340f, + 1.0000f, 0.8292f, 0.8315f, 0.9166f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3094f, 0.7513f, 1.0000f, + 1.0000f, 0.7303f, 0.9293f, 0.8880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5724f, 1.0000f, 1.0000f, + 1.0000f, 0.4322f, 0.7265f, 0.8387f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5815f, 0.9363f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9054f, 0.9516f, 0.8115f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9774f, 0.9329f, 0.7377f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9305f, 0.6369f, 0.7226f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8734f, 0.8457f, 0.7645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4184f, 0.6759f, 0.8897f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5631f, 0.9375f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4043f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6122f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, 0.9991f, 0.9981f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9999f, 0.9798f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, 0.9918f, 0.9469f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9886f, 0.9655f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9996f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9993f, 0.9926f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9995f, 0.9430f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9844f, 0.9934f, 0.9883f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9595f, 0.9860f, 0.8930f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9626f, 0.7580f, 0.8715f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9419f, 0.9587f, 0.8754f, + 1.0000f, 1.0000f, 0.9736f, 0.9956f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9784f, 0.9669f, 0.9552f, + 1.0000f, 0.9945f, 0.9948f, 0.9976f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9682f, 0.9478f, 0.7832f, + 1.0000f, 0.9921f, 0.9603f, 0.9039f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9742f, 0.8434f, 0.9695f, + 1.0000f, 0.9789f, 0.9282f, 0.5534f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9440f, 0.7141f, 1.0000f, + 1.0000f, 0.9634f, 0.7446f, 0.3889f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9497f, 0.9903f, 1.0000f, + 1.0000f, 0.8828f, 0.4971f, 0.9909f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6912f, 1.0000f, 1.0000f, + 1.0000f, 0.9507f, 0.4594f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8978f, 1.0000f, 1.0000f, + 1.0000f, 0.7708f, 0.7612f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9835f, 0.9725f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9534f, 0.9813f, 0.8863f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9747f, 0.9152f, 0.7862f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9731f, 0.8243f, 0.8634f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9719f, 0.7097f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8772f, 0.9179f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9713f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8142f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9959f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9831f, 0.9943f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9929f, 0.9964f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9803f, 0.9868f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9817f, 0.9946f, 0.9408f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.9986f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9967f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9931f, 0.9952f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.9875f, 0.9769f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9893f, 0.9525f, 0.9206f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9707f, 0.9245f, 0.5433f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9839f, 0.8571f, 0.5900f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9317f, 0.7185f, 0.6652f, + 1.0000f, 0.9941f, 0.9488f, 0.7922f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8363f, 1.0000f, 1.0000f, + 1.0000f, 0.9900f, 0.9578f, 0.9662f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9618f, 1.0000f, 1.0000f, + 1.0000f, 0.5093f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8410f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8339f, 0.9397f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8526f, 0.9975f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9998f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 1.0000f, 0.9872f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9989f, 0.9954f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9848f, 0.9999f, 0.9139f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9915f, 0.8791f, 0.6311f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9856f, 0.8810f, 0.8963f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7770f, 0.7341f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6597f, 0.9984f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9950f, 0.9997f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 1.0000f, 0.9758f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9009f, 0.5208f, 0.9125f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8168f, 0.6484f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5321f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8087f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_5x8[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7170f, 0.8180f, 1.0000f, 1.0000f, 0.9306f, 0.9785f, + 1.0000f, 1.0000f, 1.0000f, 0.9950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6965f, 0.8011f, 0.8628f, 1.0000f, 1.0000f, 0.9641f, 0.9929f, + 1.0000f, 1.0000f, 0.9698f, 0.9907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8033f, 0.7695f, 0.5461f, 1.0000f, 1.0000f, 0.8906f, 0.8389f, + 1.0000f, 1.0000f, 0.9849f, 0.9943f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7269f, 0.7332f, 0.3842f, 1.0000f, 0.9127f, 0.9202f, 0.8794f, + 1.0000f, 1.0000f, 0.9070f, 0.9559f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7034f, 0.3723f, 0.2234f, 1.0000f, 0.8946f, 0.7922f, 0.3594f, + 1.0000f, 0.9242f, 0.9635f, 0.9682f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6392f, 0.0795f, 0.6486f, 1.0000f, 0.7642f, 0.7103f, 0.3052f, + 1.0000f, 1.0000f, 0.8823f, 0.8660f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0406f, 0.0000f, 1.0000f, 1.0000f, 0.7898f, 0.3960f, 0.1575f, + 1.0000f, 0.8530f, 0.7721f, 0.5161f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1334f, 0.2435f, 1.0000f, 1.0000f, 0.7069f, 0.3461f, 0.4915f, + 1.0000f, 1.0000f, 1.0000f, 0.9138f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9288f, 0.9617f, + 1.0000f, 1.0000f, 0.9366f, 0.9407f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9160f, 0.9468f, + 1.0000f, 1.0000f, 0.8933f, 0.9340f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8139f, 0.8408f, + 1.0000f, 0.9212f, 0.9105f, 0.8580f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8352f, 0.8809f, 0.4176f, + 1.0000f, 1.0000f, 0.8220f, 0.8893f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8780f, 0.5863f, 0.1090f, + 1.0000f, 0.8426f, 0.7589f, 0.5668f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6343f, 0.3327f, 0.2762f, + 1.0000f, 0.8720f, 0.7451f, 0.5388f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6818f, 0.2028f, 0.2913f, + 1.0000f, 0.7507f, 0.6293f, 0.2599f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4473f, 0.1808f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9896f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9781f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9823f, 0.9956f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9937f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9954f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9579f, 0.9919f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9838f, 0.9931f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9391f, 0.9827f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9374f, 0.9518f, 0.9034f, + 1.0000f, 0.9982f, 0.9996f, 0.9986f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8612f, 0.7136f, 0.7301f, 1.0000f, 0.9801f, 0.9909f, 0.9734f, + 1.0000f, 0.9995f, 0.9993f, 0.9789f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7669f, 0.7422f, 0.7773f, 1.0000f, 0.9664f, 0.9820f, 0.8240f, + 1.0000f, 0.9769f, 0.9901f, 0.9773f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4378f, 0.9438f, 1.0000f, 1.0000f, 0.6531f, 0.8119f, 0.9692f, + 1.0000f, 0.9460f, 0.9793f, 0.8750f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6780f, 1.0000f, 1.0000f, 1.0000f, 0.8054f, 0.9116f, 0.9629f, + 1.0000f, 0.8596f, 0.8201f, 0.9399f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5237f, 0.8644f, 1.0000f, + 1.0000f, 0.7824f, 0.9357f, 0.9022f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7534f, 1.0000f, 1.0000f, + 1.0000f, 0.4659f, 0.8496f, 0.8997f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6741f, 0.9747f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8972f, 0.9423f, 0.7945f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8334f, 0.9171f, 0.9222f, + 1.0000f, 0.9805f, 0.9182f, 0.6930f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9687f, 0.8735f, 0.8563f, + 1.0000f, 0.9415f, 0.6702f, 0.7850f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5799f, 0.8444f, 1.0000f, + 1.0000f, 0.8879f, 0.8461f, 0.8160f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7000f, 0.9383f, 1.0000f, + 1.0000f, 0.4831f, 0.7799f, 0.9315f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5602f, 1.0000f, 1.0000f, + 1.0000f, 0.6191f, 0.9572f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6242f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7967f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9988f, 0.9972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9997f, 0.9539f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9890f, 0.9192f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9869f, 0.9724f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9995f, 0.9914f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9987f, 0.9232f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9835f, 0.9933f, 0.9893f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9511f, 0.9812f, 0.8705f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9708f, 0.8076f, 0.9081f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9532f, 0.9703f, 0.8690f, + 1.0000f, 1.0000f, 0.9884f, 0.9991f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9445f, 0.9332f, 0.8297f, 1.0000f, 0.9856f, 0.9760f, 0.9605f, + 1.0000f, 0.9981f, 0.9959f, 0.9989f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9623f, 0.8278f, 0.9999f, 1.0000f, 0.9872f, 0.9552f, 0.6660f, + 1.0000f, 0.9979f, 0.9899f, 0.9525f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9676f, 0.9922f, 1.0000f, 1.0000f, 0.9598f, 0.6894f, 0.8513f, + 1.0000f, 0.9912f, 0.9430f, 0.6139f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8546f, 1.0000f, 1.0000f, 1.0000f, 0.8985f, 0.4070f, 1.0000f, + 1.0000f, 0.9752f, 0.8259f, 0.4566f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9475f, 1.0000f, 1.0000f, 1.0000f, 0.9058f, 0.9453f, 1.0000f, + 1.0000f, 0.8919f, 0.5734f, 0.9973f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4998f, 1.0000f, 1.0000f, + 1.0000f, 0.9566f, 0.4281f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9504f, 1.0000f, 1.0000f, + 1.0000f, 0.8098f, 0.6575f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9887f, 0.9756f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9875f, 0.9647f, 0.7479f, + 1.0000f, 0.9653f, 0.9842f, 0.8959f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9670f, 0.9270f, 0.7203f, + 1.0000f, 0.9878f, 0.9483f, 0.8865f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9545f, 0.5978f, 1.0000f, + 1.0000f, 0.9765f, 0.9046f, 0.9490f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8479f, 1.0000f, 1.0000f, + 1.0000f, 0.9777f, 0.7875f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9093f, 1.0000f, 1.0000f, + 1.0000f, 0.9279f, 0.9585f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7362f, 1.0000f, 1.0000f, + 1.0000f, 0.9743f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8315f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, 0.9980f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 0.9969f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9852f, 0.9926f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9960f, 0.9963f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9816f, 0.9845f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9831f, 0.9882f, 0.9592f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 0.9996f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9946f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9966f, 0.9924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9659f, 0.9297f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9714f, 0.9611f, 0.4745f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9862f, 0.8371f, 0.5080f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8851f, 0.7393f, 0.6035f, + 1.0000f, 0.9976f, 0.9808f, 0.9149f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6439f, 1.0000f, 1.0000f, + 1.0000f, 0.9965f, 0.9729f, 0.9917f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9251f, 1.0000f, 1.0000f, + 1.0000f, 0.5922f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9349f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8837f, 0.9497f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8765f, 0.9992f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9994f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 1.0000f, 0.9738f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9797f, 0.9985f, 0.9935f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9904f, 0.9999f, 0.9010f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9866f, 0.7747f, 0.5533f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9719f, 0.7989f, 0.7562f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7616f, 0.6618f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6087f, 0.9975f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 1.0000f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9941f, 0.9998f, 0.9859f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9261f, 0.5314f, 0.9323f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8675f, 0.6856f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3191f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7236f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_5x10[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8828f, 0.9380f, 1.0000f, 1.0000f, 0.9474f, 0.9876f, + 1.0000f, 1.0000f, 1.0000f, 0.9969f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9001f, 0.9507f, 0.9435f, 1.0000f, 1.0000f, 0.9629f, 0.9920f, + 1.0000f, 1.0000f, 0.9747f, 0.9932f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9144f, 0.8460f, 0.4607f, 1.0000f, 1.0000f, 0.8863f, 0.8325f, + 1.0000f, 1.0000f, 0.9864f, 0.9957f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8000f, 0.7799f, 0.3655f, 1.0000f, 0.9060f, 0.9291f, 0.8517f, + 1.0000f, 1.0000f, 0.9234f, 0.9619f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7902f, 0.3573f, 0.2754f, 1.0000f, 0.9172f, 0.8197f, 0.3042f, + 1.0000f, 0.9550f, 0.9704f, 0.9787f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7244f, 0.0600f, 0.6069f, 1.0000f, 0.7961f, 0.7590f, 0.2856f, + 1.0000f, 1.0000f, 0.8770f, 0.8851f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5834f, 0.1053f, 1.0000f, 1.0000f, 0.8246f, 0.4735f, 0.1961f, + 1.0000f, 0.8503f, 0.7861f, 0.4860f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2949f, 0.5229f, 1.0000f, 1.0000f, 0.7710f, 0.3896f, 0.6023f, + 1.0000f, 1.0000f, 1.0000f, 0.9275f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8614f, 0.8180f, 1.0000f, 1.0000f, 0.9461f, 0.9783f, + 1.0000f, 1.0000f, 0.9358f, 0.9421f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8474f, 0.8885f, 0.8356f, 1.0000f, 1.0000f, 0.9298f, 0.9798f, + 1.0000f, 1.0000f, 0.9126f, 0.9415f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8430f, 0.7410f, 0.3736f, 1.0000f, 1.0000f, 0.8719f, 0.8928f, + 1.0000f, 0.9321f, 0.9098f, 0.8586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7733f, 0.3401f, 0.2651f, 1.0000f, 0.8745f, 0.9217f, 0.4542f, + 1.0000f, 1.0000f, 0.8654f, 0.9107f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7686f, 0.1264f, 0.5169f, 1.0000f, 0.9040f, 0.7056f, 0.2329f, + 1.0000f, 0.8840f, 0.8074f, 0.6534f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5046f, 0.1459f, 1.0000f, 1.0000f, 0.7120f, 0.3314f, 0.5107f, + 1.0000f, 0.8874f, 0.7841f, 0.5784f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4128f, 0.2091f, 1.0000f, 1.0000f, 0.7514f, 0.3225f, 0.5682f, + 1.0000f, 0.7778f, 0.6958f, 0.2441f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1650f, 1.0000f, 1.0000f, 1.0000f, 0.6114f, 0.3816f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6415f, 0.8110f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5576f, 0.6495f, 0.6684f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7302f, 0.5465f, 0.1821f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7273f, 0.4671f, 0.4923f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6203f, 0.0829f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2546f, 0.4985f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9947f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9813f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0322f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9867f, 0.9970f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9794f, 0.9904f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9858f, 0.9968f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9428f, 0.9840f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9556f, 0.9613f, 0.8896f, + 1.0000f, 0.9990f, 0.9988f, 0.9993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9117f, 0.8401f, 0.9079f, 1.0000f, 0.9827f, 0.9897f, 0.9767f, + 1.0000f, 0.9996f, 0.9998f, 0.9881f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8386f, 0.9283f, 0.9242f, 1.0000f, 0.9579f, 0.9771f, 0.8092f, + 1.0000f, 0.9779f, 0.9849f, 0.9759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6247f, 0.9069f, 1.0000f, 1.0000f, 0.6374f, 0.8145f, 0.9365f, + 1.0000f, 0.9487f, 0.9717f, 0.8531f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8038f, 1.0000f, 1.0000f, 1.0000f, 0.7981f, 0.8817f, 0.9730f, + 1.0000f, 0.9030f, 0.8694f, 0.9680f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5882f, 0.8805f, 1.0000f, + 1.0000f, 0.8230f, 0.9650f, 0.9538f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7941f, 1.0000f, 1.0000f, + 1.0000f, 0.3975f, 0.8668f, 0.8960f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7088f, 0.9685f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8781f, 0.9441f, 0.7882f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6925f, 0.7213f, 0.9250f, 1.0000f, 0.8707f, 0.9344f, 0.9722f, + 1.0000f, 0.9873f, 0.9154f, 0.6991f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7663f, 0.8416f, 0.9635f, 1.0000f, 0.9861f, 0.9135f, 0.9190f, + 1.0000f, 0.9267f, 0.6720f, 0.7540f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7488f, 1.0000f, 1.0000f, 1.0000f, 0.7182f, 0.9448f, 1.0000f, + 1.0000f, 0.8573f, 0.8163f, 0.8056f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8489f, 0.9739f, 1.0000f, + 1.0000f, 0.5288f, 0.8278f, 0.9624f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6611f, 1.0000f, 1.0000f, + 1.0000f, 0.6823f, 0.9775f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6891f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8627f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4478f, 0.6290f, 0.9660f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5629f, 0.8641f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 0.9986f, 0.9960f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9998f, 0.9306f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9763f, 0.8559f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9690f, 0.9329f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9988f, 0.9892f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9994f, 0.9011f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9846f, 0.9934f, 0.9928f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9591f, 0.9902f, 0.8732f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9665f, 0.7755f, 0.8545f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9468f, 0.9525f, 0.8371f, + 1.0000f, 1.0000f, 0.9855f, 0.9995f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9574f, 0.8980f, 0.7024f, 1.0000f, 0.9895f, 0.9806f, 0.9562f, + 1.0000f, 0.9980f, 0.9991f, 0.9994f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9455f, 0.7330f, 1.0000f, 1.0000f, 0.9823f, 0.9640f, 0.5930f, + 1.0000f, 0.9955f, 0.9843f, 0.9500f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9181f, 0.9481f, 1.0000f, 1.0000f, 0.9351f, 0.6857f, 0.7436f, + 1.0000f, 0.9899f, 0.9791f, 0.6789f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6159f, 1.0000f, 1.0000f, 1.0000f, 0.8758f, 0.2214f, 1.0000f, + 1.0000f, 0.9918f, 0.8793f, 0.5977f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9020f, 1.0000f, 1.0000f, 1.0000f, 0.8445f, 0.9050f, 1.0000f, + 1.0000f, 0.9258f, 0.6648f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4411f, 1.0000f, 1.0000f, + 1.0000f, 0.9694f, 0.4342f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9519f, 1.0000f, 1.0000f, + 1.0000f, 0.7921f, 0.7151f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9852f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9907f, 0.9816f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9675f, 0.8681f, 0.9926f, 1.0000f, 0.9916f, 0.9387f, 0.7639f, + 1.0000f, 0.9585f, 0.9914f, 0.8991f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9372f, 0.7615f, 1.0000f, 1.0000f, 0.9494f, 0.9088f, 0.6332f, + 1.0000f, 0.9909f, 0.9645f, 0.8917f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9655f, 1.0000f, 1.0000f, 1.0000f, 0.9544f, 0.4798f, 1.0000f, + 1.0000f, 0.9836f, 0.9225f, 0.9531f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7383f, 1.0000f, 1.0000f, 1.0000f, 0.8128f, 1.0000f, 1.0000f, + 1.0000f, 0.9820f, 0.8263f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9199f, 1.0000f, 1.0000f, + 1.0000f, 0.9568f, 0.9870f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6573f, 1.0000f, 1.0000f, + 1.0000f, 0.9743f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8341f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9608f, 0.9208f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9394f, 0.9726f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9708f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9952f, 0.9976f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9922f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, 0.9938f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9911f, 0.9973f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9965f, 0.9966f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9755f, 0.9884f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9602f, 0.9833f, 0.9163f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9950f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9942f, 0.9930f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.9974f, 0.9964f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.9735f, 0.9670f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9802f, 0.9597f, 0.5407f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9887f, 0.8294f, 0.3135f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8949f, 0.7356f, 0.5347f, + 1.0000f, 0.9990f, 0.9940f, 0.9336f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4200f, 1.0000f, 1.0000f, + 1.0000f, 0.9971f, 0.9713f, 0.9954f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8600f, 1.0000f, 1.0000f, + 1.0000f, 0.6754f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9408f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8970f, 0.9513f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 1.0000f, 1.0000f, + 1.0000f, 0.8939f, 0.9986f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9999f, 0.9993f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9997f, 0.9751f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9889f, 0.9992f, 0.9962f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9699f, 0.9997f, 0.8310f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9878f, 0.7462f, 0.5521f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9830f, 0.8019f, 0.8214f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6455f, 0.4052f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4271f, 0.9809f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 0.9999f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 1.0000f, 0.9924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9401f, 0.5733f, 0.9314f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8907f, 0.7566f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3488f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7820f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_5x12[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8780f, 0.9349f, 1.0000f, 1.0000f, 0.9364f, 0.9901f, + 1.0000f, 1.0000f, 1.0000f, 0.9975f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9180f, 0.9637f, 0.9656f, 1.0000f, 1.0000f, 0.9733f, 0.9894f, + 1.0000f, 1.0000f, 0.9802f, 0.9969f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9172f, 0.8662f, 0.5213f, 1.0000f, 1.0000f, 0.9146f, 0.8459f, + 1.0000f, 1.0000f, 0.9914f, 0.9959f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8116f, 0.8244f, 0.4387f, 1.0000f, 0.9313f, 0.9320f, 0.8625f, + 1.0000f, 1.0000f, 0.9589f, 0.9742f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8289f, 0.4504f, 0.4006f, 1.0000f, 0.9104f, 0.8562f, 0.3463f, + 1.0000f, 0.9494f, 0.9864f, 0.9861f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7709f, 0.0893f, 0.6998f, 1.0000f, 0.8274f, 0.7886f, 0.3091f, + 1.0000f, 1.0000f, 0.9069f, 0.9188f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5676f, 0.1455f, 1.0000f, 1.0000f, 0.8362f, 0.5805f, 0.2600f, + 1.0000f, 0.8846f, 0.8197f, 0.5586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4675f, 0.6560f, 1.0000f, 1.0000f, 0.8099f, 0.4897f, 0.7086f, + 1.0000f, 1.0000f, 1.0000f, 0.9506f, 0.5058f, 1.0000f, 1.0000f, 1.0000f, 0.6937f, 1.0000f, 0.8698f, 0.8304f, 0.5929f, 1.0000f, 0.9540f, 0.9721f, + 1.0000f, 1.0000f, 0.9605f, 0.9616f, 0.6722f, 1.0000f, 1.0000f, 1.0000f, 0.7223f, 0.8835f, 0.8745f, 0.8889f, 0.3242f, 1.0000f, 0.9450f, 0.9642f, + 1.0000f, 1.0000f, 0.9391f, 0.9568f, 0.7142f, 1.0000f, 1.0000f, 1.0000f, 0.3317f, 0.8523f, 0.7828f, 0.4842f, 0.7446f, 1.0000f, 0.8549f, 0.8587f, + 1.0000f, 0.9557f, 0.9268f, 0.8710f, 0.6050f, 1.0000f, 1.0000f, 1.0000f, 0.1696f, 0.7997f, 0.4265f, 0.4326f, 1.0000f, 0.8498f, 0.8909f, 0.3167f, + 1.0000f, 1.0000f, 0.8757f, 0.9244f, 0.6816f, 1.0000f, 1.0000f, 1.0000f, 0.6457f, 0.7789f, 0.1325f, 0.5541f, 1.0000f, 0.8939f, 0.6968f, 0.2032f, + 1.0000f, 0.9129f, 0.8066f, 0.6280f, 0.0533f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5312f, 0.1581f, 1.0000f, 1.0000f, 0.7169f, 0.2931f, 0.4787f, + 1.0000f, 0.8929f, 0.8149f, 0.6526f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5450f, 0.3874f, 1.0000f, 1.0000f, 0.7423f, 0.3391f, 0.5763f, + 1.0000f, 0.8333f, 0.7646f, 0.3535f, 0.6422f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2241f, 1.0000f, 1.0000f, 1.0000f, 0.6785f, 0.3807f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8674f, 0.9033f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8347f, 0.7942f, 0.6690f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8734f, 0.5496f, 0.2141f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7749f, 0.3603f, 0.5970f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7375f, 0.0330f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3012f, 0.3739f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9929f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6492f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9923f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0720f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9856f, 0.9963f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7513f, 0.7961f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8376f, 0.8536f, 0.4618f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7468f, 0.2849f, 0.4137f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7114f, 0.1048f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6207f, 0.1186f, 1.0000f, 1.0000f, 1.0000f, 0.9799f, 0.9960f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1811f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 0.9967f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5263f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9573f, 0.9910f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2429f, 1.0000f, 1.0000f, 1.0000f, 0.9562f, 0.9792f, 0.8977f, + 1.0000f, 0.9987f, 0.9976f, 0.9994f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9357f, 0.8445f, 0.9535f, 1.0000f, 0.9769f, 0.9828f, 0.9680f, + 1.0000f, 0.9998f, 1.0000f, 0.9899f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8650f, 0.9438f, 0.9196f, 1.0000f, 0.9237f, 0.9762f, 0.7729f, + 1.0000f, 0.9844f, 0.9892f, 0.9795f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7301f, 0.9398f, 1.0000f, 1.0000f, 0.6244f, 0.8165f, 0.8919f, + 1.0000f, 0.9675f, 0.9853f, 0.8485f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8612f, 1.0000f, 1.0000f, 1.0000f, 0.7847f, 0.8802f, 0.9847f, + 1.0000f, 0.9051f, 0.8722f, 0.9578f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6387f, 0.9024f, 1.0000f, + 1.0000f, 0.8318f, 0.9611f, 0.9600f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8432f, 1.0000f, 1.0000f, + 1.0000f, 0.4446f, 0.8996f, 0.9405f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7351f, 0.9816f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8768f, 0.9431f, 0.7808f, 0.4202f, 1.0000f, 1.0000f, 1.0000f, 0.9703f, 0.7249f, 0.8181f, 0.9716f, 1.0000f, 0.8213f, 0.9260f, 0.9475f, + 1.0000f, 0.9850f, 0.9163f, 0.6626f, 0.6317f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8133f, 0.8987f, 0.9841f, 1.0000f, 0.9750f, 0.8879f, 0.9213f, + 1.0000f, 0.9488f, 0.6877f, 0.7688f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7867f, 1.0000f, 1.0000f, 1.0000f, 0.6130f, 0.9204f, 1.0000f, + 1.0000f, 0.8968f, 0.8418f, 0.8228f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8032f, 0.9512f, 1.0000f, + 1.0000f, 0.4951f, 0.8390f, 0.9651f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6010f, 1.0000f, 1.0000f, + 1.0000f, 0.6658f, 0.9781f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7667f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9155f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5162f, 0.8049f, 0.9694f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6846f, 0.9784f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9988f, 0.9912f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9994f, 0.9005f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.9758f, 0.8259f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9551f, 0.9384f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5888f, 0.8813f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7491f, 0.9729f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9993f, 0.9921f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9991f, 0.9060f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9831f, 0.9925f, 0.9869f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9500f, 0.9777f, 0.8574f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9670f, 0.7979f, 0.8511f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9463f, 0.9661f, 0.9298f, + 1.0000f, 1.0000f, 0.9917f, 0.9996f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9482f, 0.9112f, 0.6352f, 1.0000f, 0.9887f, 0.9523f, 0.9517f, + 1.0000f, 0.9999f, 0.9989f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9078f, 0.7057f, 1.0000f, 1.0000f, 0.9595f, 0.9646f, 0.5110f, + 1.0000f, 0.9984f, 0.9938f, 0.9773f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9121f, 0.9015f, 1.0000f, 1.0000f, 0.9707f, 0.6754f, 0.7196f, + 1.0000f, 0.9940f, 0.9872f, 0.7769f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5005f, 1.0000f, 1.0000f, 1.0000f, 0.8948f, 0.1922f, 1.0000f, + 1.0000f, 0.9858f, 0.8824f, 0.5720f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8899f, 1.0000f, 1.0000f, 1.0000f, 0.9411f, 0.9335f, 1.0000f, + 1.0000f, 0.9229f, 0.7275f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5358f, 1.0000f, 1.0000f, + 1.0000f, 0.9631f, 0.5847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9788f, 1.0000f, 1.0000f, + 1.0000f, 0.8686f, 0.8014f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9890f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9919f, 0.9927f, 0.9546f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9584f, 0.8404f, 0.9689f, 1.0000f, 0.9954f, 0.9095f, 0.6907f, + 1.0000f, 0.9685f, 0.9941f, 0.9290f, 0.9086f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9252f, 0.6168f, 1.0000f, 1.0000f, 0.9283f, 0.8857f, 0.4072f, + 1.0000f, 0.9943f, 0.9806f, 0.9275f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9444f, 1.0000f, 1.0000f, 1.0000f, 0.9469f, 0.2685f, 1.0000f, + 1.0000f, 0.9885f, 0.9666f, 0.9825f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5405f, 1.0000f, 1.0000f, 1.0000f, 0.7580f, 1.0000f, 1.0000f, + 1.0000f, 0.9946f, 0.8791f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8637f, 1.0000f, 1.0000f, + 1.0000f, 0.9698f, 0.9903f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5631f, 1.0000f, 1.0000f, + 1.0000f, 0.9834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8600f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9738f, 0.7923f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9221f, 0.9371f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9378f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9754f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.9955f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 0.9949f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9972f, 0.9933f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9867f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9725f, 0.9877f, 0.9305f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9342f, 0.8082f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9418f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9962f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9951f, 0.9952f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9819f, 0.9626f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9882f, 0.9529f, 0.4562f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.8958f, 0.3672f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9042f, 0.7535f, 0.6090f, + 1.0000f, 0.9993f, 0.9897f, 0.9621f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2515f, 1.0000f, 1.0000f, + 1.0000f, 0.9978f, 0.9837f, 0.9970f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7602f, 1.0000f, 1.0000f, + 1.0000f, 0.7905f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9138f, 0.9457f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9934f, 1.0000f, 1.0000f, + 1.0000f, 0.9327f, 0.9987f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9992f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 1.0000f, 0.9822f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9956f, 0.9985f, 0.9874f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9880f, 0.9998f, 0.8472f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9908f, 0.7326f, 0.4731f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9425f, 0.7399f, 0.7624f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7027f, 0.2767f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3941f, 0.9812f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, 1.0000f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9931f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9809f, 0.6593f, 0.9766f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9746f, 0.8868f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2341f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7558f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_6x4[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9673f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8992f, 0.9737f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9398f, 0.9849f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7787f, 0.8814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8128f, 0.8718f, 0.9182f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9354f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9262f, 0.9793f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8501f, 0.9493f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8559f, 0.8693f, 0.8377f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7200f, 0.7741f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7542f, 0.6070f, 0.3882f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6630f, 0.8167f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6893f, 0.8641f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7078f, 0.6828f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7595f, 0.7647f, 0.6763f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2717f, 0.4628f, 0.0876f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4109f, 0.2335f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9467f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9664f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9823f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8743f, 0.9454f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9054f, 0.9628f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9904f, 0.9993f, 0.9982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9974f, 0.9998f, 0.9817f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9787f, 0.9897f, 0.9834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9530f, 0.9767f, 0.8767f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8205f, 0.7318f, 0.8008f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7259f, 0.8048f, 0.8471f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9967f, 0.9893f, 0.9427f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9959f, 0.9828f, 0.9619f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9231f, 0.7139f, 0.8242f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8883f, 0.9294f, 0.8277f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3079f, 0.5404f, 0.8311f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3622f, 0.8614f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9073f, 0.9384f, 0.8949f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8928f, 0.9148f, 0.5980f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4291f, 0.5542f, 0.8837f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 1.0000f, + 1.0000f, 0.5667f, 0.7434f, 0.8905f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9998f, + 1.0000f, 0.1611f, 0.4950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9656f, 0.9844f, 0.9934f, + 1.0000f, 0.3359f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9811f, 0.9920f, 0.9165f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9987f, 0.9908f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9988f, 0.9564f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9698f, 0.9799f, 0.9598f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9553f, 0.9638f, 0.7878f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9881f, 0.9928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9948f, 0.9980f, 0.9950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9876f, 0.9413f, 0.8860f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9752f, 0.9130f, 0.5107f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9690f, 0.8530f, 0.5777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9441f, 0.6160f, 0.9985f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9858f, 0.9714f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9730f, 0.9868f, 0.9247f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9781f, 0.8089f, 0.4789f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9092f, 0.6244f, 0.5880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9745f, 0.6409f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8587f, 0.9215f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9722f, 0.9647f, 0.8790f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9805f, 0.9198f, 0.7377f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9681f, 0.6955f, 0.9608f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9979f, + 1.0000f, 0.9309f, 0.6327f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9977f, + 1.0000f, 0.9481f, 0.9961f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9706f, 0.9911f, + 1.0000f, 0.6560f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9926f, 0.9923f, 0.9946f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9914f, 0.9901f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9885f, 0.9863f, 0.9760f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9872f, 0.9774f, 0.9505f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9889f, 0.9576f, 0.7488f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9917f, 0.9013f, 0.6696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9854f, 0.8971f, 0.8668f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4462f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7695f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8345f, 0.7965f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6489f, 0.9983f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8440f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9999f, + 1.0000f, 0.9541f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9999f, 0.9971f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9994f, 0.9976f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9931f, 0.9998f, 0.9518f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 0.9369f, 0.7921f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9839f, 0.9278f, 0.9325f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9990f, 0.9941f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, 0.9999f, 0.9587f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9033f, 0.5262f, 0.9340f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8409f, 0.7016f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7833f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9111f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_6x5[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9817f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9250f, 0.9803f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9595f, 0.9914f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8438f, 0.9238f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8903f, 0.9454f, 0.9562f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7381f, 0.8169f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7219f, 0.6800f, 0.5402f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9620f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9587f, 0.9847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9045f, 0.9696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9090f, 0.9325f, 0.8704f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7951f, 0.7921f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7766f, 0.6848f, 0.4307f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8008f, 0.6425f, 0.3692f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6596f, 0.5073f, 0.0799f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6702f, 0.8143f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7040f, 0.8816f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7600f, 0.7419f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7980f, 0.8246f, 0.7891f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7633f, 0.6896f, 0.3081f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6364f, 0.6026f, 0.2805f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9866f, + 1.0000f, 0.2115f, 0.1301f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8951f, + 1.0000f, 0.4014f, 0.1727f, 0.2470f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9420f, 0.9300f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9825f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9881f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9263f, 0.9812f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9628f, 0.9891f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8524f, 0.9186f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8798f, 0.8626f, 0.8545f, + 1.0000f, 0.9939f, 0.9989f, 0.9978f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9993f, 0.9996f, 0.9755f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9799f, 0.9922f, 0.9908f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9604f, 0.9838f, 0.8919f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8415f, 0.8344f, 0.9288f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7531f, 0.9225f, 0.8834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4445f, 0.6235f, 0.8886f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5191f, 0.8967f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9979f, 0.9874f, 0.9349f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9959f, 0.9834f, 0.9675f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9544f, 0.7494f, 0.8586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9408f, 0.9535f, 0.8645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4167f, 0.7456f, 0.8320f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5864f, 0.9465f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3509f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6167f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8935f, 0.9199f, 0.8742f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8665f, 0.9029f, 0.5948f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5687f, 0.6301f, 0.9431f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 1.0000f, + 1.0000f, 0.6484f, 0.8195f, 0.9385f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9997f, + 1.0000f, 0.3314f, 0.7733f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9996f, 0.9991f, + 1.0000f, 0.6098f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9998f, 0.9842f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9570f, 0.9775f, 0.9312f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9862f, 0.9780f, 0.8852f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9993f, 0.9925f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9991f, 0.9487f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9765f, 0.9895f, 0.9808f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9507f, 0.9760f, 0.8565f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9517f, 0.7342f, 0.7700f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9337f, 0.9133f, 0.7799f, + 1.0000f, 1.0000f, 0.9851f, 0.9977f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9980f, 0.9956f, 0.9962f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9870f, 0.9644f, 0.9212f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9722f, 0.9396f, 0.5301f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9579f, 0.7566f, 0.3857f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8779f, 0.4950f, 0.9957f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9683f, 0.7175f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8761f, 0.9014f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9885f, 0.9794f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9750f, 0.9932f, 0.9443f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9830f, 0.8606f, 0.5777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9373f, 0.7302f, 0.6752f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9612f, 0.4702f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7861f, 0.7667f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9690f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8296f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9667f, 0.9716f, 0.8684f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9739f, 0.9361f, 0.6992f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9785f, 0.8035f, 0.9821f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9990f, + 1.0000f, 0.9636f, 0.7260f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9986f, + 1.0000f, 0.9553f, 0.9930f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9904f, 0.9954f, + 1.0000f, 0.6650f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9948f, 0.9982f, + 1.0000f, 0.8998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9790f, 0.9770f, + 1.0000f, 0.9952f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9703f, 0.9911f, 0.9660f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, 0.9981f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9950f, 0.9972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9917f, 0.9935f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9888f, 0.9898f, 0.9859f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9901f, 0.9710f, 0.9119f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9733f, 0.9476f, 0.5594f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9728f, 0.9104f, 0.7830f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9652f, 0.8461f, 0.8116f, + 1.0000f, 0.9944f, 0.9275f, 0.7131f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9937f, 0.9173f, 0.9147f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4827f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8221f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8368f, 0.8392f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7086f, 0.9984f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8503f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9999f, 0.9999f, + 1.0000f, 0.9744f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, 0.9946f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 0.9997f, 0.9976f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9941f, 0.9999f, 0.9526f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9920f, 0.8723f, 0.6944f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9855f, 0.8482f, 0.9160f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9060f, 0.8869f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8271f, 0.9965f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9927f, 0.9985f, 0.9992f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9877f, 0.9998f, 0.9497f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9075f, 0.4576f, 0.8983f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8063f, 0.6541f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5499f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8090f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_6x6[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8106f, 0.8853f, + 1.0000f, 1.0000f, 1.0000f, 0.9930f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7864f, 0.9450f, + 1.0000f, 1.0000f, 0.9513f, 0.9905f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8216f, 0.8013f, + 1.0000f, 1.0000f, 0.9714f, 0.9946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8453f, 0.8645f, 0.8629f, + 1.0000f, 1.0000f, 0.8899f, 0.9579f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8525f, 0.7728f, 0.4573f, + 1.0000f, 0.9120f, 0.9600f, 0.9709f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7079f, 0.7007f, 0.2804f, + 1.0000f, 1.0000f, 0.8434f, 0.8542f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7615f, 0.3425f, 0.0000f, + 1.0000f, 0.8340f, 0.7439f, 0.5516f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6893f, 0.2428f, 0.2979f, + 1.0000f, 1.0000f, 1.0000f, 0.9744f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9764f, 0.9869f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9177f, 0.9724f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9199f, 0.9401f, 0.8679f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8379f, 0.8560f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8279f, 0.7219f, 0.5251f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8471f, 0.7185f, 0.4349f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6933f, 0.5759f, 0.2166f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.6970f, 0.8397f, 0.0794f, 1.0000f, 1.0000f, 1.0000f, 0.0403f, 1.0000f, 1.0000f, 1.0000f, 0.3571f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8320f, 0.9095f, 0.1892f, 1.0000f, 1.0000f, 1.0000f, 0.1171f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7916f, 0.7837f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8259f, 0.8489f, 0.8083f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7965f, 0.7528f, 0.4100f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6853f, 0.6812f, 0.3279f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9897f, + 1.0000f, 0.7252f, 0.3130f, 0.1542f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9807f, + 1.0000f, 0.6646f, 0.2621f, 0.3846f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9833f, 0.9944f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9903f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9908f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9458f, 0.9895f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9719f, 0.9889f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9252f, 0.9749f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9357f, 0.9375f, 0.8957f, + 1.0000f, 0.9957f, 0.9997f, 0.9982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9607f, 0.9729f, 0.9155f, + 1.0000f, 0.9989f, 0.9999f, 0.9794f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9409f, 0.9572f, 0.6555f, + 1.0000f, 0.9773f, 0.9910f, 0.9844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6508f, 0.6154f, 0.9056f, + 1.0000f, 0.9466f, 0.9803f, 0.8823f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7114f, 0.8151f, 0.9434f, + 1.0000f, 0.8869f, 0.8760f, 0.9392f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3710f, 0.9015f, 1.0000f, + 1.0000f, 0.7941f, 0.9426f, 0.9082f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6312f, 1.0000f, 1.0000f, + 1.0000f, 0.5069f, 0.8129f, 0.8928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6411f, 0.9586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9978f, 0.9913f, 0.9302f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9988f, 0.9826f, 0.9482f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9543f, 0.7284f, 0.8695f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9242f, 0.9339f, 0.8986f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4975f, 0.8360f, 0.8884f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6460f, 0.9647f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5680f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6601f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9132f, 0.9166f, 0.8416f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8728f, 0.9029f, 0.5837f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5908f, 0.6261f, 0.9292f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 1.0000f, + 1.0000f, 0.6362f, 0.8195f, 0.9282f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9999f, + 1.0000f, 0.4781f, 0.9043f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9995f, 0.9986f, + 1.0000f, 0.7043f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9999f, 0.9786f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9940f, 0.9593f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9887f, 0.9687f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9996f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9981f, 0.9841f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9974f, 0.9188f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9777f, 0.9915f, 0.9881f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9474f, 0.9830f, 0.8943f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9621f, 0.7700f, 0.8711f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9330f, 0.9550f, 0.8838f, + 1.0000f, 1.0000f, 0.9925f, 0.9987f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9818f, 0.9790f, 0.9703f, + 1.0000f, 0.9969f, 0.9984f, 0.9996f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9854f, 0.9698f, 0.8662f, + 1.0000f, 0.9942f, 0.9628f, 0.9143f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9768f, 0.8776f, 0.9754f, + 1.0000f, 0.9739f, 0.9498f, 0.5161f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9505f, 0.7408f, 1.0000f, + 1.0000f, 0.9653f, 0.8037f, 0.4225f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9348f, 0.9918f, 1.0000f, + 1.0000f, 0.8507f, 0.5341f, 0.9892f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7469f, 1.0000f, 1.0000f, + 1.0000f, 0.9520f, 0.4880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9490f, 1.0000f, 1.0000f, + 1.0000f, 0.8173f, 0.7557f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9875f, 0.9867f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9682f, 0.9952f, 0.9614f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9848f, 0.8791f, 0.6099f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9321f, 0.7499f, 0.7315f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9418f, 0.5430f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8238f, 0.7586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9535f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6208f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9692f, 0.9798f, 0.8913f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9811f, 0.9383f, 0.7378f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, + 1.0000f, 0.9670f, 0.8300f, 0.9822f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9980f, + 1.0000f, 0.9665f, 0.7347f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9955f, + 1.0000f, 0.9565f, 0.9934f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9815f, 0.9947f, + 1.0000f, 0.7149f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.9961f, 0.9976f, + 1.0000f, 0.9659f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9863f, 0.9938f, + 1.0000f, 0.9951f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9759f, 0.9977f, 0.9640f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9900f, 0.9954f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9927f, 0.9958f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9857f, 0.9782f, 0.9837f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9920f, 0.9557f, 0.9272f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9734f, 0.9231f, 0.5598f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9851f, 0.8612f, 0.6039f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9262f, 0.7755f, 0.6689f, + 1.0000f, 0.9949f, 0.9311f, 0.7890f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8578f, 1.0000f, 1.0000f, + 1.0000f, 0.9960f, 0.9366f, 0.9442f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9634f, 1.0000f, 1.0000f, + 1.0000f, 0.4464f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7671f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9001f, 0.9107f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7783f, 0.9998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8744f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9990f, 0.9997f, + 1.0000f, 0.9676f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9932f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9860f, 0.9994f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9872f, 1.0000f, 0.9210f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 0.9069f, 0.6771f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9884f, 0.8972f, 0.9221f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8060f, 0.7989f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6730f, 0.9988f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9878f, 0.9992f, 0.9985f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9923f, 0.9998f, 0.9528f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8807f, 0.3973f, 0.8595f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7643f, 0.5978f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4681f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7811f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_6x8[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7507f, 0.8312f, 1.0000f, 1.0000f, 0.9510f, 0.9872f, + 1.0000f, 1.0000f, 1.0000f, 0.9960f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7791f, 0.8374f, 0.8893f, 1.0000f, 1.0000f, 0.9809f, 0.9948f, + 1.0000f, 1.0000f, 0.9710f, 0.9957f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8389f, 0.7750f, 0.5758f, 1.0000f, 1.0000f, 0.8996f, 0.8296f, + 1.0000f, 1.0000f, 0.9880f, 0.9956f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7361f, 0.7599f, 0.3527f, 1.0000f, 0.9236f, 0.9323f, 0.8634f, + 1.0000f, 1.0000f, 0.9331f, 0.9540f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7483f, 0.4613f, 0.2516f, 1.0000f, 0.9254f, 0.8264f, 0.4148f, + 1.0000f, 0.9441f, 0.9799f, 0.9751f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7013f, 0.1466f, 0.7850f, 1.0000f, 0.7870f, 0.7459f, 0.3889f, + 1.0000f, 1.0000f, 0.8858f, 0.8905f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6250f, 0.0671f, 1.0000f, 1.0000f, 0.8434f, 0.4063f, 0.1118f, + 1.0000f, 0.8578f, 0.7947f, 0.5703f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3140f, 0.4470f, 1.0000f, 1.0000f, 0.7261f, 0.2774f, 0.4683f, + 1.0000f, 1.0000f, 1.0000f, 0.9918f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9600f, 0.9795f, + 1.0000f, 1.0000f, 0.9890f, 0.9950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9306f, 0.9573f, + 1.0000f, 1.0000f, 0.9551f, 0.9818f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8216f, 0.8535f, + 1.0000f, 0.9516f, 0.9534f, 0.9040f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8620f, 0.9083f, 0.4231f, + 1.0000f, 1.0000f, 0.8962f, 0.9007f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9157f, 0.6601f, 0.1800f, + 1.0000f, 0.8916f, 0.7966f, 0.5647f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6677f, 0.3618f, 0.3343f, + 1.0000f, 0.9167f, 0.7927f, 0.5342f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7386f, 0.1634f, 0.3020f, + 1.0000f, 0.7687f, 0.6559f, 0.2897f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5591f, 0.1293f, 1.0000f, + 1.0000f, 1.0000f, 0.7435f, 0.8798f, 0.6474f, 1.0000f, 1.0000f, 1.0000f, 0.1950f, 1.0000f, 1.0000f, 1.0000f, 0.5959f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9051f, 0.9314f, 0.5085f, 1.0000f, 1.0000f, 1.0000f, 0.2645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8507f, 0.8248f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8881f, 0.8973f, 0.8419f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8564f, 0.8059f, 0.5150f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7411f, 0.7729f, 0.4394f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, + 1.0000f, 0.7984f, 0.5279f, 0.2378f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9862f, + 1.0000f, 0.7531f, 0.4313f, 0.5909f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9864f, 0.9927f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9947f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9646f, 0.9920f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9827f, 0.9940f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9461f, 0.9839f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9474f, 0.9568f, 0.8674f, + 1.0000f, 0.9972f, 0.9996f, 0.9991f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8700f, 0.7129f, 0.7156f, 1.0000f, 0.9915f, 0.9922f, 0.9770f, + 1.0000f, 0.9998f, 0.9999f, 0.9815f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7708f, 0.7337f, 0.7771f, 1.0000f, 0.9651f, 0.9902f, 0.8449f, + 1.0000f, 0.9792f, 0.9931f, 0.9885f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4819f, 0.9546f, 1.0000f, 1.0000f, 0.6639f, 0.8232f, 0.9697f, + 1.0000f, 0.9454f, 0.9774f, 0.9093f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7043f, 1.0000f, 1.0000f, 1.0000f, 0.8022f, 0.9115f, 0.9631f, + 1.0000f, 0.8822f, 0.8761f, 0.9378f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6340f, 0.9207f, 1.0000f, + 1.0000f, 0.8095f, 0.9562f, 0.9197f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8182f, 1.0000f, 1.0000f, + 1.0000f, 0.5019f, 0.9029f, 0.9281f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7209f, 0.9777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9995f, 0.9925f, 0.9467f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8687f, 0.9347f, 0.9289f, + 1.0000f, 0.9990f, 0.9851f, 0.9589f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9719f, 0.8869f, 0.8846f, + 1.0000f, 0.9675f, 0.7889f, 0.9072f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6058f, 0.8521f, 1.0000f, + 1.0000f, 0.9413f, 0.9492f, 0.9339f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7182f, 0.9400f, 1.0000f, + 1.0000f, 0.4953f, 0.9136f, 0.9272f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6714f, 1.0000f, 1.0000f, + 1.0000f, 0.7101f, 0.9802f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6918f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7665f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9245f, 0.9187f, 0.8492f, 0.5531f, 1.0000f, 1.0000f, 1.0000f, 0.0934f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8606f, 0.8951f, 0.5215f, 0.2100f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6295f, 0.6886f, 0.9522f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, + 1.0000f, 0.6750f, 0.8550f, 0.9528f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9996f, + 1.0000f, 0.6009f, 0.9498f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.9995f, 0.9980f, + 1.0000f, 0.8148f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 1.0000f, 0.9504f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9911f, 0.9298f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9875f, 0.9731f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9987f, 0.9788f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9971f, 0.8984f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9684f, 0.9898f, 0.9833f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9363f, 0.9743f, 0.8358f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9665f, 0.7643f, 0.8737f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9370f, 0.9610f, 0.8786f, + 1.0000f, 1.0000f, 0.9942f, 0.9964f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9693f, 0.9661f, 0.8592f, 1.0000f, 0.9913f, 0.9755f, 0.9688f, + 1.0000f, 0.9988f, 0.9970f, 0.9993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9723f, 0.9177f, 1.0000f, 1.0000f, 0.9883f, 0.9762f, 0.6982f, + 1.0000f, 0.9938f, 0.9888f, 0.9595f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9605f, 0.9895f, 1.0000f, 1.0000f, 0.9486f, 0.7235f, 0.8774f, + 1.0000f, 0.9867f, 0.9679f, 0.5809f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8464f, 1.0000f, 1.0000f, 1.0000f, 0.9146f, 0.3977f, 1.0000f, + 1.0000f, 0.9739f, 0.8404f, 0.3800f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9727f, 1.0000f, 1.0000f, 1.0000f, 0.8648f, 0.9226f, 1.0000f, + 1.0000f, 0.8939f, 0.5469f, 0.9983f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4542f, 1.0000f, 1.0000f, + 1.0000f, 0.9480f, 0.3251f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9217f, 1.0000f, 1.0000f, + 1.0000f, 0.7621f, 0.6518f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9621f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9935f, 0.9936f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9836f, 0.9848f, 0.7831f, + 1.0000f, 0.9878f, 0.9959f, 0.9714f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9702f, 0.9406f, 0.7811f, + 1.0000f, 0.9953f, 0.9385f, 0.7312f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9579f, 0.6430f, 1.0000f, + 1.0000f, 0.9641f, 0.8749f, 0.8810f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8478f, 1.0000f, 1.0000f, + 1.0000f, 0.9584f, 0.6385f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9061f, 1.0000f, 1.0000f, + 1.0000f, 0.8280f, 0.8199f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6950f, 1.0000f, 1.0000f, + 1.0000f, 0.9434f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6155f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9806f, 0.9766f, 0.9104f, 0.0354f, 1.0000f, 1.0000f, 1.0000f, 0.4752f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9900f, 0.9427f, 0.7577f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, + 1.0000f, 0.9785f, 0.9125f, 0.9977f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9994f, + 1.0000f, 0.9812f, 0.8077f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9929f, + 1.0000f, 0.9616f, 0.9968f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 0.9905f, + 1.0000f, 0.7908f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, 0.9954f, 0.9984f, + 1.0000f, 0.9557f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9821f, 0.9909f, + 1.0000f, 0.9853f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9830f, 0.9924f, 0.9636f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9978f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9973f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9706f, 0.9981f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.9945f, 0.9933f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9392f, 0.9263f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9670f, 0.9355f, 0.3709f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9907f, 0.8165f, 0.4886f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8724f, 0.7287f, 0.5860f, + 1.0000f, 0.9992f, 0.9759f, 0.8661f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6819f, 1.0000f, 1.0000f, + 1.0000f, 0.9986f, 0.9747f, 0.9842f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9447f, 1.0000f, 1.0000f, + 1.0000f, 0.5406f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9420f, 0.9656f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 1.0000f, 1.0000f, + 1.0000f, 0.9018f, 0.9996f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9999f, 0.9999f, + 1.0000f, 0.9626f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9781f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9824f, 0.9994f, 0.9969f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9856f, 0.9998f, 0.8928f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9859f, 0.8003f, 0.6107f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9845f, 0.8113f, 0.8131f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8041f, 0.7073f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6785f, 0.9989f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9893f, 1.0000f, 0.9987f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9870f, 1.0000f, 0.9735f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8327f, 0.3436f, 0.8343f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7554f, 0.6203f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2239f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6852f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_6x10[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9113f, 0.9605f, 1.0000f, 1.0000f, 0.9651f, 0.9905f, + 1.0000f, 1.0000f, 1.0000f, 0.9986f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9297f, 0.9572f, 0.9655f, 1.0000f, 1.0000f, 0.9680f, 0.9938f, + 1.0000f, 1.0000f, 0.9769f, 0.9966f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9434f, 0.8648f, 0.4724f, 1.0000f, 1.0000f, 0.9029f, 0.8206f, + 1.0000f, 1.0000f, 0.9929f, 0.9937f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8133f, 0.7768f, 0.4066f, 1.0000f, 0.9338f, 0.9224f, 0.8220f, + 1.0000f, 1.0000f, 0.9384f, 0.9696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8118f, 0.4443f, 0.3663f, 1.0000f, 0.9358f, 0.8449f, 0.3799f, + 1.0000f, 0.9624f, 0.9881f, 0.9847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7514f, 0.0924f, 0.7271f, 1.0000f, 0.8057f, 0.7892f, 0.3453f, + 1.0000f, 1.0000f, 0.8889f, 0.8976f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7575f, 0.0336f, 1.0000f, 1.0000f, 0.8849f, 0.4385f, 0.1879f, + 1.0000f, 0.8909f, 0.8072f, 0.5233f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3074f, 0.3933f, 1.0000f, 1.0000f, 0.7857f, 0.2391f, 0.5425f, + 1.0000f, 1.0000f, 1.0000f, 0.9927f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8869f, 0.8500f, 1.0000f, 1.0000f, 0.9712f, 0.9720f, + 1.0000f, 1.0000f, 0.9890f, 0.9970f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8985f, 0.9391f, 0.8695f, 1.0000f, 1.0000f, 0.9446f, 0.9736f, + 1.0000f, 1.0000f, 0.9659f, 0.9844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8659f, 0.7674f, 0.4262f, 1.0000f, 1.0000f, 0.8474f, 0.8900f, + 1.0000f, 0.9692f, 0.9783f, 0.9020f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7804f, 0.4000f, 0.3231f, 1.0000f, 0.8838f, 0.9397f, 0.4559f, + 1.0000f, 1.0000f, 0.9246f, 0.9311f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7994f, 0.1379f, 0.6466f, 1.0000f, 0.9208f, 0.7374f, 0.3153f, + 1.0000f, 0.9201f, 0.8397f, 0.6361f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5610f, 0.1510f, 1.0000f, 1.0000f, 0.7219f, 0.3523f, 0.5786f, + 1.0000f, 0.9177f, 0.8423f, 0.5185f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5656f, 0.1641f, 1.0000f, 1.0000f, 0.7875f, 0.2300f, 0.4935f, + 1.0000f, 0.8192f, 0.6885f, 0.2571f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1230f, 1.0000f, 1.0000f, 1.0000f, 0.6501f, 0.2916f, 1.0000f, + 1.0000f, 1.0000f, 0.7712f, 0.9063f, 0.6824f, 1.0000f, 1.0000f, 1.0000f, 0.2659f, 1.0000f, 0.6762f, 0.7749f, 0.7348f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9216f, 0.9193f, 0.6252f, 1.0000f, 1.0000f, 1.0000f, 0.2995f, 0.6215f, 0.7030f, 0.6915f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8550f, 0.8318f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7654f, 0.5869f, 0.2099f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8994f, 0.8752f, 0.8277f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7534f, 0.4778f, 0.5086f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9011f, 0.8624f, 0.5987f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6666f, 0.1080f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7909f, 0.8291f, 0.4987f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4197f, 0.6026f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9932f, + 1.0000f, 0.8088f, 0.5700f, 0.2747f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6289f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, + 1.0000f, 0.7731f, 0.4670f, 0.6855f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0749f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9903f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5948f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9799f, 0.9958f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9886f, 0.9922f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9525f, 0.9790f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9628f, 0.9610f, 0.8487f, + 1.0000f, 0.9992f, 0.9991f, 0.9990f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9254f, 0.8817f, 0.9231f, 1.0000f, 0.9836f, 0.9925f, 0.9776f, + 1.0000f, 0.9997f, 0.9999f, 0.9897f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8636f, 0.9331f, 0.9504f, 1.0000f, 0.9577f, 0.9838f, 0.8148f, + 1.0000f, 0.9821f, 0.9899f, 0.9849f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6730f, 0.9046f, 1.0000f, 1.0000f, 0.6103f, 0.8162f, 0.9096f, + 1.0000f, 0.9428f, 0.9793f, 0.8740f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8512f, 1.0000f, 1.0000f, 1.0000f, 0.7555f, 0.8763f, 0.9684f, + 1.0000f, 0.9283f, 0.8938f, 0.9762f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6601f, 0.9003f, 1.0000f, + 1.0000f, 0.8525f, 0.9747f, 0.9520f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8263f, 1.0000f, 1.0000f, + 1.0000f, 0.4133f, 0.8706f, 0.9276f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7470f, 0.9812f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9985f, 0.9913f, 0.9546f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7323f, 0.7245f, 0.9104f, 1.0000f, 0.8806f, 0.9552f, 0.9664f, + 1.0000f, 0.9997f, 0.9901f, 0.9637f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7786f, 0.8331f, 0.9765f, 1.0000f, 0.9892f, 0.9261f, 0.9557f, + 1.0000f, 0.9705f, 0.7944f, 0.8948f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7693f, 1.0000f, 1.0000f, 1.0000f, 0.7059f, 0.9452f, 1.0000f, + 1.0000f, 0.9458f, 0.9498f, 0.9351f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8671f, 0.9672f, 1.0000f, + 1.0000f, 0.5282f, 0.9304f, 0.9541f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7297f, 1.0000f, 1.0000f, + 1.0000f, 0.7635f, 0.9883f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7492f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8041f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9161f, 0.8929f, 0.8103f, 0.6431f, 1.0000f, 1.0000f, 1.0000f, 0.2832f, 0.5037f, 0.6064f, 0.9728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8575f, 0.8828f, 0.4501f, 0.3732f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5743f, 0.8344f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5829f, 0.6794f, 0.9440f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.6698f, 0.8587f, 0.9581f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9994f, + 1.0000f, 0.6944f, 0.9755f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9989f, 0.9961f, + 1.0000f, 0.8784f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9996f, 0.9365f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9806f, 0.8718f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9724f, 0.9470f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9964f, 0.9709f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9973f, 0.8773f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9802f, 0.9915f, 0.9857f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9324f, 0.9824f, 0.8384f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9481f, 0.7423f, 0.8235f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9185f, 0.9422f, 0.8358f, + 1.0000f, 1.0000f, 0.9935f, 0.9989f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9596f, 0.9290f, 0.7615f, 1.0000f, 0.9918f, 0.9740f, 0.9830f, + 1.0000f, 0.9977f, 0.9995f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9403f, 0.7595f, 1.0000f, 1.0000f, 0.9701f, 0.9633f, 0.6534f, + 1.0000f, 0.9951f, 0.9688f, 0.9591f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9169f, 0.9562f, 1.0000f, 1.0000f, 0.9536f, 0.6634f, 0.7398f, + 1.0000f, 0.9888f, 0.9531f, 0.7113f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7002f, 1.0000f, 1.0000f, 1.0000f, 0.8537f, 0.2204f, 1.0000f, + 1.0000f, 0.9773f, 0.8729f, 0.4325f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8919f, 1.0000f, 1.0000f, 1.0000f, 0.8611f, 0.8410f, 1.0000f, + 1.0000f, 0.9129f, 0.6141f, 0.9975f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3593f, 1.0000f, 1.0000f, + 1.0000f, 0.9410f, 0.3866f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9071f, 1.0000f, 1.0000f, + 1.0000f, 0.7927f, 0.5909f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9088f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9941f, 0.9971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9732f, 0.9145f, 0.9950f, 1.0000f, 0.9969f, 0.9345f, 0.7839f, + 1.0000f, 0.9841f, 0.9974f, 0.9796f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9509f, 0.8010f, 1.0000f, 1.0000f, 0.9493f, 0.9515f, 0.6973f, + 1.0000f, 0.9920f, 0.9378f, 0.8026f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9487f, 1.0000f, 1.0000f, 1.0000f, 0.9646f, 0.4884f, 1.0000f, + 1.0000f, 0.9779f, 0.9153f, 0.8957f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7447f, 1.0000f, 1.0000f, 1.0000f, 0.8249f, 1.0000f, 1.0000f, + 1.0000f, 0.9751f, 0.7140f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8859f, 1.0000f, 1.0000f, + 1.0000f, 0.9080f, 0.9371f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5330f, 1.0000f, 1.0000f, + 1.0000f, 0.9464f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6325f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9943f, 0.9833f, 0.9137f, 0.7166f, 1.0000f, 1.0000f, 1.0000f, 0.6178f, 0.9615f, 0.9317f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9949f, 0.9567f, 0.7821f, 0.0544f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9601f, 0.9867f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9947f, + 1.0000f, 0.9815f, 0.8966f, 0.9981f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9668f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9956f, 0.9994f, + 1.0000f, 0.9786f, 0.8599f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9869f, + 1.0000f, 0.9743f, 0.9982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9874f, + 1.0000f, 0.8462f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9954f, 0.9965f, + 1.0000f, 0.9476f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9879f, 0.9852f, + 1.0000f, 0.9911f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9827f, 0.9980f, 0.9239f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9944f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9959f, 0.9960f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9917f, 0.9967f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, 0.9864f, 0.9934f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 0.9037f, 0.9642f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9758f, 0.9676f, 0.3382f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9895f, 0.8177f, 0.2481f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8371f, 0.6396f, 0.4616f, + 1.0000f, 0.9992f, 0.9931f, 0.9268f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5378f, 1.0000f, 1.0000f, + 1.0000f, 0.9993f, 0.9876f, 0.9983f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8562f, 1.0000f, 1.0000f, + 1.0000f, 0.5518f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9121f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9619f, 0.9716f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9416f, 0.9995f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8879f, 1.0000f, 1.0000f, 0.5472f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9995f, 0.9998f, + 1.0000f, 0.9586f, 1.0000f, 1.0000f, 0.1993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, 0.9809f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9859f, 0.9972f, 0.9940f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9872f, 0.9997f, 0.8795f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.8683f, 0.5565f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9862f, 0.8304f, 0.7977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7192f, 0.4831f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5136f, 0.9909f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9907f, 0.9998f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9818f, 1.0000f, 0.9854f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9054f, 0.3309f, 0.8436f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7961f, 0.6568f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1765f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7086f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_6x12[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9358f, 0.9687f, 1.0000f, 1.0000f, 0.9758f, 0.9938f, + 1.0000f, 1.0000f, 1.0000f, 0.9976f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9388f, 0.9790f, 0.9579f, 1.0000f, 1.0000f, 0.9956f, 0.9959f, + 1.0000f, 1.0000f, 0.9823f, 0.9981f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9393f, 0.8955f, 0.5579f, 1.0000f, 1.0000f, 0.9352f, 0.8171f, + 1.0000f, 1.0000f, 0.9961f, 0.9958f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8496f, 0.8435f, 0.4922f, 1.0000f, 0.9433f, 0.9471f, 0.8360f, + 1.0000f, 1.0000f, 0.9751f, 0.9655f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8472f, 0.5535f, 0.4179f, 1.0000f, 0.9323f, 0.8920f, 0.4065f, + 1.0000f, 0.9817f, 0.9834f, 0.9907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8254f, 0.1082f, 0.7436f, 1.0000f, 0.8460f, 0.7976f, 0.3593f, + 1.0000f, 1.0000f, 0.9410f, 0.9212f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8100f, 0.0675f, 1.0000f, 1.0000f, 0.9170f, 0.5706f, 0.2586f, + 1.0000f, 0.9232f, 0.8531f, 0.6146f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4290f, 0.5024f, 1.0000f, 1.0000f, 0.8588f, 0.3338f, 0.6441f, + 1.0000f, 1.0000f, 1.0000f, 0.9893f, 0.5788f, 1.0000f, 1.0000f, 1.0000f, 0.7577f, 1.0000f, 0.9112f, 0.8718f, 0.6181f, 1.0000f, 0.9829f, 0.9864f, + 1.0000f, 1.0000f, 0.9903f, 0.9939f, 0.7260f, 1.0000f, 1.0000f, 1.0000f, 0.7673f, 0.8972f, 0.9119f, 0.8837f, 0.3715f, 1.0000f, 0.9724f, 0.9663f, + 1.0000f, 1.0000f, 0.9802f, 0.9871f, 0.7457f, 1.0000f, 1.0000f, 1.0000f, 0.3891f, 0.8980f, 0.8185f, 0.5219f, 0.7857f, 1.0000f, 0.8769f, 0.8610f, + 1.0000f, 0.9787f, 0.9854f, 0.9127f, 0.6964f, 1.0000f, 1.0000f, 1.0000f, 0.1538f, 0.8410f, 0.4767f, 0.4973f, 1.0000f, 0.8893f, 0.9225f, 0.2978f, + 1.0000f, 1.0000f, 0.9427f, 0.9279f, 0.7066f, 1.0000f, 1.0000f, 1.0000f, 0.6938f, 0.8565f, 0.1859f, 0.6345f, 1.0000f, 0.9259f, 0.7749f, 0.2331f, + 1.0000f, 0.9539f, 0.8484f, 0.6628f, 0.0953f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6598f, 0.2242f, 1.0000f, 1.0000f, 0.7616f, 0.3196f, 0.5264f, + 1.0000f, 0.9498f, 0.8903f, 0.6280f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6214f, 0.2151f, 1.0000f, 1.0000f, 0.8295f, 0.2420f, 0.4664f, + 1.0000f, 0.8738f, 0.7394f, 0.3531f, 0.6473f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1202f, 1.0000f, 1.0000f, 1.0000f, 0.7236f, 0.3051f, 1.0000f, + 1.0000f, 1.0000f, 0.8085f, 0.9252f, 0.6885f, 1.0000f, 1.0000f, 1.0000f, 0.3469f, 1.0000f, 0.9052f, 0.9205f, 0.7635f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9534f, 0.9518f, 0.7188f, 1.0000f, 1.0000f, 1.0000f, 0.3654f, 0.9029f, 0.8423f, 0.7164f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9455f, 0.8385f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9239f, 0.6312f, 0.2750f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9272f, 0.9370f, 0.8599f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8321f, 0.3833f, 0.6377f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9060f, 0.9134f, 0.5936f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8213f, 0.0524f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8654f, 0.8856f, 0.5074f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4716f, 0.5124f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, + 1.0000f, 0.8334f, 0.7212f, 0.3950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7477f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, + 1.0000f, 0.8938f, 0.5747f, 0.7351f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0193f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.9929f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0371f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8114f, 0.8448f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6112f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8911f, 0.9067f, 0.5356f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8069f, 0.3404f, 0.4819f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7804f, 0.1429f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7116f, 0.1645f, 1.0000f, 1.0000f, 1.0000f, 0.9847f, 0.9932f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2668f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9937f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6042f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9744f, 0.9873f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1961f, 1.0000f, 1.0000f, 1.0000f, 0.9731f, 0.9774f, 0.8676f, + 1.0000f, 0.9978f, 0.9990f, 0.9994f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9422f, 0.8643f, 0.9588f, 1.0000f, 0.9808f, 0.9866f, 0.9646f, + 1.0000f, 0.9998f, 0.9993f, 0.9890f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8749f, 0.9329f, 0.9341f, 1.0000f, 0.9292f, 0.9784f, 0.7875f, + 1.0000f, 0.9842f, 0.9946f, 0.9857f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7415f, 0.9265f, 1.0000f, 1.0000f, 0.5900f, 0.8038f, 0.8865f, + 1.0000f, 0.9524f, 0.9899f, 0.8846f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8818f, 1.0000f, 1.0000f, 1.0000f, 0.7518f, 0.8554f, 0.9826f, + 1.0000f, 0.9097f, 0.8929f, 0.9716f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6990f, 0.9191f, 1.0000f, + 1.0000f, 0.8632f, 0.9690f, 0.9598f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8778f, 1.0000f, 1.0000f, + 1.0000f, 0.4612f, 0.9105f, 0.9616f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7786f, 0.9850f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9989f, 0.9954f, 0.9574f, 0.4506f, 1.0000f, 1.0000f, 1.0000f, 0.9702f, 0.7557f, 0.8268f, 0.9748f, 1.0000f, 0.8398f, 0.9405f, 0.9593f, + 1.0000f, 0.9990f, 0.9919f, 0.9638f, 0.6077f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8241f, 0.9298f, 0.9915f, 1.0000f, 0.9839f, 0.8963f, 0.9364f, + 1.0000f, 0.9771f, 0.8199f, 0.9021f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8054f, 1.0000f, 1.0000f, 1.0000f, 0.5828f, 0.8542f, 1.0000f, + 1.0000f, 0.9529f, 0.9492f, 0.9564f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8023f, 0.9559f, 1.0000f, + 1.0000f, 0.5446f, 0.9198f, 0.9629f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6007f, 1.0000f, 1.0000f, + 1.0000f, 0.7943f, 0.9877f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8144f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9005f, 0.8875f, 0.7840f, 0.7016f, 1.0000f, 1.0000f, 1.0000f, 0.2503f, 0.5664f, 0.8129f, 0.9761f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8808f, 0.8519f, 0.3774f, 0.4870f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7091f, 0.9764f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6567f, 0.6717f, 0.9347f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 1.0000f, + 1.0000f, 0.6858f, 0.8281f, 0.9694f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, + 1.0000f, 0.6775f, 0.9698f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9982f, 0.9934f, + 1.0000f, 0.8687f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9996f, 0.9044f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9768f, 0.8507f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.9667f, 0.9438f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5864f, 0.8827f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7596f, 0.9741f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9970f, 0.9734f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9975f, 0.8697f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9705f, 0.9861f, 0.9793f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9037f, 0.9642f, 0.8227f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9482f, 0.7373f, 0.8373f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9317f, 0.9476f, 0.9184f, + 1.0000f, 1.0000f, 0.9982f, 0.9984f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9611f, 0.9607f, 0.6911f, 1.0000f, 0.9950f, 0.9713f, 0.9569f, + 1.0000f, 0.9994f, 0.9992f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9671f, 0.7538f, 1.0000f, 1.0000f, 0.9875f, 0.9659f, 0.5971f, + 1.0000f, 0.9935f, 0.9852f, 0.9845f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9162f, 0.8728f, 1.0000f, 1.0000f, 0.9926f, 0.6688f, 0.6658f, + 1.0000f, 0.9927f, 0.9796f, 0.7711f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5401f, 1.0000f, 1.0000f, 1.0000f, 0.9013f, 0.1752f, 1.0000f, + 1.0000f, 0.9924f, 0.8788f, 0.5491f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8621f, 1.0000f, 1.0000f, 1.0000f, 0.9246f, 0.7959f, 1.0000f, + 1.0000f, 0.9513f, 0.6746f, 0.9997f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4345f, 1.0000f, 1.0000f, + 1.0000f, 0.9820f, 0.4235f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9382f, 1.0000f, 1.0000f, + 1.0000f, 0.8347f, 0.6536f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9090f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9965f, 0.9991f, 0.9544f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.9620f, 0.8708f, 0.9683f, 1.0000f, 0.9901f, 0.9651f, 0.7909f, + 1.0000f, 0.9971f, 0.9996f, 0.9837f, 0.9075f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9720f, 0.6504f, 1.0000f, 1.0000f, 0.9583f, 0.9285f, 0.5173f, + 1.0000f, 0.9964f, 0.9487f, 0.8576f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9444f, 1.0000f, 1.0000f, 1.0000f, 0.9679f, 0.3124f, 1.0000f, + 1.0000f, 0.9911f, 0.9304f, 0.9082f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5310f, 1.0000f, 1.0000f, 1.0000f, 0.7730f, 1.0000f, 1.0000f, + 1.0000f, 0.9882f, 0.7283f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8798f, 1.0000f, 1.0000f, + 1.0000f, 0.9310f, 0.9148f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2827f, 1.0000f, 1.0000f, + 1.0000f, 0.9781f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7041f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9941f, 0.9917f, 0.8989f, 0.7140f, 1.0000f, 1.0000f, 1.0000f, 0.6831f, 0.9905f, 0.7992f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9968f, 0.9755f, 0.7692f, 0.0818f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9449f, 0.9465f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, + 1.0000f, 0.9895f, 0.8884f, 0.9962f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9460f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9984f, + 1.0000f, 0.9814f, 0.8007f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9508f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9955f, + 1.0000f, 0.9727f, 0.9988f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9859f, 0.9951f, + 1.0000f, 0.7926f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9923f, 0.9993f, + 1.0000f, 0.9376f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9921f, 0.9738f, + 1.0000f, 0.9884f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9811f, 0.9831f, 0.9399f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9634f, 0.8308f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9549f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.9966f, 0.9868f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 0.9709f, 0.9155f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 0.9177f, 0.3267f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9931f, 0.8946f, 0.2903f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9335f, 0.6803f, 0.4399f, + 1.0000f, 0.9995f, 0.9945f, 0.9554f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4122f, 1.0000f, 1.0000f, + 1.0000f, 0.9997f, 0.9880f, 0.9942f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7654f, 1.0000f, 1.0000f, + 1.0000f, 0.7498f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9602f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9805f, 0.9897f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 1.0000f, 1.0000f, + 1.0000f, 0.9141f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8158f, 1.0000f, 1.0000f, 0.6409f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, + 1.0000f, 0.9503f, 1.0000f, 1.0000f, 0.2058f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 1.0000f, 0.9777f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9913f, 0.9995f, 0.9909f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9625f, 0.9996f, 0.8665f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.7892f, 0.4559f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9675f, 0.7767f, 0.7306f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7329f, 0.4008f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4453f, 0.9799f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9886f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 1.0000f, 0.9888f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9416f, 0.5622f, 0.9219f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8997f, 0.7822f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1318f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6247f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_8x4[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5963f, 0.7486f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9848f, 1.0000f, 0.6398f, 0.7224f, 0.8643f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9457f, 0.9860f, 1.0000f, 0.7062f, 0.6776f, 0.3793f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9709f, 0.9926f, 1.0000f, 0.6455f, 0.6093f, 0.2651f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8467f, 0.9265f, 1.0000f, 0.1066f, 0.2089f, 0.1762f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9062f, 0.9314f, 0.9622f, 1.0000f, 0.3263f, 0.0000f, 0.4242f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9684f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9578f, 0.9940f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9175f, 0.9677f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9161f, 0.9372f, 0.8867f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8299f, 0.8797f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8323f, 0.7413f, 0.5665f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8917f, 0.9715f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9495f, 0.9852f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8491f, 0.8088f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8622f, 0.8900f, 0.8197f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8683f, 0.7659f, 0.3625f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7522f, 0.6725f, 0.2412f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9703f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9016f, 0.9426f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8779f, 0.9447f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7592f, 0.7852f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9885f, + 1.0000f, 0.7820f, 0.8558f, 0.3060f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9909f, + 1.0000f, 0.8396f, 0.4941f, 0.0653f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9436f, 0.9738f, + 1.0000f, 0.5503f, 0.2856f, 0.1425f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9513f, 0.9798f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9968f, 0.9992f, 0.9977f, 1.0000f, 0.7945f, 0.6278f, 0.7185f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9990f, 0.9998f, 0.9636f, 1.0000f, 0.6672f, 0.7339f, 0.7692f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9794f, 0.9918f, 0.9871f, 1.0000f, 0.4107f, 0.8884f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9505f, 0.9749f, 0.8741f, 1.0000f, 0.6512f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8951f, 0.7975f, 0.8833f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8116f, 0.8815f, 0.9119f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9978f, 0.9907f, 0.9228f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9995f, 0.9844f, 0.9696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9600f, 0.7883f, 0.8850f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9383f, 0.9563f, 0.8444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4499f, 0.6826f, 0.9032f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5238f, 0.9290f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9808f, 0.9875f, 0.9690f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9585f, 0.9726f, 0.8372f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5745f, 0.7757f, 0.9615f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 1.0000f, + 1.0000f, 0.7264f, 0.8984f, 0.9349f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, + 1.0000f, 0.3446f, 0.8580f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9826f, 0.9901f, 0.9949f, + 1.0000f, 0.6566f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9912f, 0.9953f, 0.9147f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8143f, 0.8663f, 0.9105f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 1.0000f, + 1.0000f, 0.9486f, 0.8033f, 0.8420f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9987f, + 1.0000f, 0.4726f, 0.8536f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9994f, 0.9923f, + 1.0000f, 0.6338f, 0.8934f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9991f, 0.9467f, + 1.0000f, 0.5047f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9835f, 0.9856f, 0.9629f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9607f, 0.9743f, 0.7914f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9789f, 0.9895f, 1.0000f, 0.9253f, 0.8601f, 0.8004f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9976f, 0.9888f, 0.9955f, 1.0000f, 0.9522f, 0.7557f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9904f, 0.9530f, 0.9188f, 1.0000f, 0.9547f, 0.9938f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9759f, 0.9302f, 0.4614f, 1.0000f, 0.7104f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9764f, 0.9091f, 0.6875f, 1.0000f, 0.9000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9593f, 0.7301f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9754f, 0.9812f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9784f, 0.9817f, 0.9405f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9769f, 0.8170f, 0.4834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8967f, 0.6972f, 0.5585f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9822f, 0.6924f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9077f, 0.9215f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9830f, 0.9643f, 0.9278f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9664f, 0.9415f, 0.6156f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, + 1.0000f, 0.9539f, 0.6030f, 0.8249f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9983f, + 1.0000f, 0.8703f, 0.3956f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9993f, + 1.0000f, 0.9555f, 0.9928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9732f, 0.9898f, + 1.0000f, 0.7018f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9951f, 0.9966f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9779f, 0.9337f, 0.7145f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9959f, 0.9974f, + 1.0000f, 0.9671f, 0.8760f, 0.6619f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9965f, + 1.0000f, 0.9477f, 0.5146f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9982f, + 1.0000f, 0.8061f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9931f, 0.9920f, 0.9915f, + 1.0000f, 0.9570f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.9891f, 0.9657f, + 1.0000f, 0.9360f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9947f, 0.9774f, 0.8274f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9867f, 0.8223f, 0.5420f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9803f, 0.7789f, 0.7626f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4376f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7376f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7725f, 0.6217f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5894f, 0.9936f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5821f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9996f, 0.9994f, + 1.0000f, 0.9047f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9933f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9997f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9997f, 0.9721f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, 0.9394f, 0.8348f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9863f, 0.9326f, 0.9241f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9989f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9882f, 0.9990f, 0.9961f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9878f, 0.9999f, 0.9202f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9133f, 0.5329f, 0.9650f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8514f, 0.7450f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8722f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9839f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_8x5[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6120f, 0.7696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9884f, 1.0000f, 0.6510f, 0.7169f, 0.8592f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9559f, 0.9917f, 1.0000f, 0.7477f, 0.7506f, 0.4645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9756f, 0.9915f, 1.0000f, 0.6919f, 0.7135f, 0.4257f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8997f, 0.9452f, 1.0000f, 0.6803f, 0.3829f, 0.3319f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9256f, 0.9644f, 0.9682f, 1.0000f, 0.6067f, 0.1057f, 0.6598f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.7850f, 0.9046f, 1.0000f, 0.0406f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8524f, 0.7722f, 0.6420f, 1.0000f, 0.1579f, 0.2461f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9765f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9751f, 0.9971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9301f, 0.9847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9265f, 0.9518f, 0.9058f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8641f, 0.8673f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8324f, 0.7774f, 0.5302f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8959f, 0.7589f, 0.5644f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7669f, 0.6465f, 0.2254f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9092f, 0.9809f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9638f, 0.9866f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8880f, 0.8455f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8985f, 0.9168f, 0.8735f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8972f, 0.8142f, 0.3585f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7748f, 0.6956f, 0.2776f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, + 1.0000f, 0.8225f, 0.3945f, 0.0782f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9511f, + 1.0000f, 0.7299f, 0.2913f, 0.4359f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9609f, 0.9655f, + 1.0000f, 1.0000f, 0.9158f, 0.9525f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9034f, 0.9437f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8285f, 0.8472f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, + 1.0000f, 0.8305f, 0.9081f, 0.3712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, + 1.0000f, 0.8720f, 0.5899f, 0.1814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9545f, 0.9931f, + 1.0000f, 0.6172f, 0.3049f, 0.3185f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9869f, 0.9956f, + 1.0000f, 0.7030f, 0.2045f, 0.2621f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9336f, 0.9660f, + 1.0000f, 0.4456f, 0.1321f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9362f, 0.9237f, 0.9137f, + 1.0000f, 0.9978f, 0.9994f, 0.9972f, 1.0000f, 0.7825f, 0.5958f, 0.7100f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9994f, 0.9999f, 0.9596f, 1.0000f, 0.6555f, 0.7235f, 0.7391f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9813f, 0.9900f, 0.9893f, 1.0000f, 0.5442f, 0.9489f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9474f, 0.9789f, 0.8657f, 1.0000f, 0.7800f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8689f, 0.8608f, 0.9371f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7989f, 0.9345f, 0.8894f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5509f, 0.7616f, 0.9413f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6224f, 0.9539f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9996f, 0.9910f, 0.9126f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9993f, 0.9777f, 0.9677f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9742f, 0.8184f, 0.9022f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9496f, 0.9666f, 0.8766f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4904f, 0.8344f, 0.8907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6722f, 0.9649f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4988f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7966f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9828f, 0.9836f, 0.9737f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9571f, 0.9708f, 0.8363f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6326f, 0.8400f, 0.9797f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 1.0000f, + 1.0000f, 0.8011f, 0.9199f, 0.9627f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9997f, + 1.0000f, 0.5227f, 0.8704f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9998f, 0.9998f, + 1.0000f, 0.7449f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, 0.9879f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9603f, 0.9773f, 0.9246f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 0.9793f, 0.8558f, + 1.0000f, 0.8034f, 0.8795f, 0.9148f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, + 1.0000f, 0.9444f, 0.8099f, 0.8245f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, + 1.0000f, 0.5775f, 0.9010f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9992f, 0.9890f, + 1.0000f, 0.7330f, 0.9353f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9989f, 0.9208f, + 1.0000f, 0.5577f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9843f, 0.9953f, 0.9850f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9552f, 0.9863f, 0.8838f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9698f, 0.8056f, 0.8121f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9503f, 0.9189f, 0.8205f, + 1.0000f, 1.0000f, 0.9873f, 0.9857f, 1.0000f, 0.9178f, 0.8507f, 0.8382f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9970f, 0.9922f, 0.9983f, 1.0000f, 0.9621f, 0.7420f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9903f, 0.9578f, 0.9388f, 1.0000f, 0.9615f, 0.9935f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9703f, 0.9327f, 0.4553f, 1.0000f, 0.7920f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9718f, 0.8265f, 0.4155f, 1.0000f, 0.9584f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8853f, 0.5373f, 0.9948f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9747f, 0.7943f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9227f, 0.9274f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9840f, 0.9854f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9713f, 0.9944f, 0.9565f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9801f, 0.8419f, 0.5070f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8867f, 0.7361f, 0.5839f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9429f, 0.4051f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7897f, 0.6993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9805f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8489f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9785f, 0.9824f, 0.9532f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9832f, 0.9590f, 0.6880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, + 1.0000f, 0.9723f, 0.7066f, 0.8625f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9993f, + 1.0000f, 0.8947f, 0.4734f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9980f, + 1.0000f, 0.9115f, 0.9459f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9926f, 0.9967f, + 1.0000f, 0.4820f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9969f, 0.9990f, + 1.0000f, 0.9466f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9781f, 0.9898f, + 1.0000f, 0.9961f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9733f, 0.9905f, 0.9821f, + 1.0000f, 0.9769f, 0.9379f, 0.7643f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9982f, + 1.0000f, 0.9671f, 0.8810f, 0.7267f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9924f, + 1.0000f, 0.9632f, 0.6014f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9887f, 0.9977f, + 1.0000f, 0.8751f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9920f, 0.9913f, + 1.0000f, 0.9104f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.9895f, 0.9481f, + 1.0000f, 0.7561f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9876f, 0.9693f, 0.6275f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 0.9688f, 0.8934f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9817f, 0.9283f, 0.9318f, + 1.0000f, 0.9942f, 0.8437f, 0.5710f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9882f, 0.8163f, 0.7874f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3452f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7203f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8078f, 0.6763f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6681f, 0.9964f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6640f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9986f, 0.9984f, + 1.0000f, 0.9292f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, 0.9999f, 0.9908f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, 0.9991f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 1.0000f, 0.9760f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9069f, 0.7534f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.8824f, 0.9421f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9396f, 0.8921f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8575f, 0.9929f, 1.0000f, + 1.0000f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9728f, 0.9990f, 0.9986f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9860f, 1.0000f, 0.8781f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9218f, 0.5149f, 0.9405f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8541f, 0.6842f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6374f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9309f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_8x6[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6348f, 0.7860f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8285f, 0.9042f, + 1.0000f, 1.0000f, 1.0000f, 0.9940f, 1.0000f, 0.6847f, 0.7223f, 0.8700f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7983f, 0.9615f, + 1.0000f, 1.0000f, 0.9487f, 0.9920f, 1.0000f, 0.7690f, 0.7645f, 0.4879f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8948f, 0.8713f, + 1.0000f, 1.0000f, 0.9808f, 0.9956f, 1.0000f, 0.6912f, 0.7029f, 0.4162f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9254f, 0.9272f, 0.9100f, + 1.0000f, 1.0000f, 0.9263f, 0.9493f, 1.0000f, 0.7141f, 0.4679f, 0.4243f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9081f, 0.8499f, 0.5771f, + 1.0000f, 0.9382f, 0.9724f, 0.9625f, 1.0000f, 0.6704f, 0.2426f, 0.8042f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7798f, 0.8117f, 0.3822f, + 1.0000f, 1.0000f, 0.8969f, 0.9011f, 1.0000f, 0.6075f, 0.0672f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8203f, 0.5325f, 0.1476f, + 1.0000f, 0.8857f, 0.7943f, 0.5976f, 1.0000f, 0.3069f, 0.5075f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7599f, 0.3735f, 0.4746f, + 1.0000f, 1.0000f, 1.0000f, 0.9801f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9845f, 0.9983f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9469f, 0.9779f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9397f, 0.9546f, 0.8787f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8774f, 0.8991f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8555f, 0.8022f, 0.5612f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9128f, 0.7623f, 0.5264f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7776f, 0.6470f, 0.2700f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9338f, 0.9885f, 0.7429f, 1.0000f, 1.0000f, 1.0000f, 0.1977f, 1.0000f, 1.0000f, 1.0000f, 0.5823f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9716f, 0.9912f, 0.4944f, 1.0000f, 1.0000f, 1.0000f, 0.1297f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8980f, 0.8410f, 0.5386f, 1.0000f, 1.0000f, 1.0000f, 0.0899f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9109f, 0.9322f, 0.8569f, 0.2287f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9219f, 0.8348f, 0.3994f, 0.0352f, 1.0000f, 1.0000f, 1.0000f, 0.4610f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8003f, 0.7327f, 0.3909f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9937f, + 1.0000f, 0.8528f, 0.4078f, 0.1113f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9905f, + 1.0000f, 0.7249f, 0.2834f, 0.4398f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9907f, 0.9974f, + 1.0000f, 1.0000f, 0.9361f, 0.9707f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9353f, 0.9529f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8169f, 0.8394f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, + 1.0000f, 0.8470f, 0.8925f, 0.3268f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, + 1.0000f, 0.8903f, 0.6510f, 0.2565f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9698f, 0.9948f, + 1.0000f, 0.6741f, 0.3553f, 0.4470f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9914f, 0.9957f, + 1.0000f, 0.7196f, 0.1815f, 0.2957f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9463f, 0.9872f, + 1.0000f, 0.5503f, 0.1651f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9594f, 0.9600f, 0.9183f, + 1.0000f, 0.9981f, 0.9993f, 0.9973f, 1.0000f, 0.7922f, 0.6124f, 0.6880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9605f, 0.9689f, 0.9137f, + 1.0000f, 0.9995f, 0.9998f, 0.9579f, 1.0000f, 0.6777f, 0.7000f, 0.7301f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9511f, 0.9430f, 0.6550f, + 1.0000f, 0.9736f, 0.9870f, 0.9827f, 1.0000f, 0.5926f, 0.9517f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7169f, 0.6971f, 0.9410f, + 1.0000f, 0.9306f, 0.9752f, 0.8316f, 1.0000f, 0.7819f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7881f, 0.8799f, 0.9720f, + 1.0000f, 0.8762f, 0.8725f, 0.9568f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5139f, 0.9443f, 1.0000f, + 1.0000f, 0.8134f, 0.9505f, 0.9022f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7454f, 1.0000f, 1.0000f, + 1.0000f, 0.5445f, 0.8687f, 0.9246f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7085f, 0.9775f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9997f, 0.9926f, 0.9071f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9994f, 0.9836f, 0.9636f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9666f, 0.7840f, 0.8750f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9437f, 0.9589f, 0.8846f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5010f, 0.8914f, 0.9237f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7353f, 0.9848f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6666f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9853f, 0.9856f, 0.9685f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9646f, 0.9794f, 0.8363f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6430f, 0.8455f, 0.9740f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, + 1.0000f, 0.7963f, 0.9201f, 0.9620f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9996f, + 1.0000f, 0.6307f, 0.9061f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9999f, 0.9996f, + 1.0000f, 0.8379f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, 0.9883f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9928f, 0.9703f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9951f, 0.9656f, + 1.0000f, 0.8219f, 0.8738f, 0.9289f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 1.0000f, + 1.0000f, 0.9631f, 0.8080f, 0.8582f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 0.5874f, 0.9174f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9992f, 0.9768f, + 1.0000f, 0.7552f, 0.9297f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9980f, 0.8881f, + 1.0000f, 0.6589f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9824f, 0.9962f, 0.9895f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9535f, 0.9862f, 0.9032f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9744f, 0.8268f, 0.8937f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9562f, 0.9694f, 0.9210f, + 1.0000f, 1.0000f, 0.9818f, 0.9787f, 1.0000f, 0.9403f, 0.8649f, 0.8332f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9814f, 0.9821f, 0.9764f, + 1.0000f, 0.9979f, 0.9867f, 0.9976f, 1.0000f, 0.9573f, 0.7755f, 0.9998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9888f, 0.9811f, 0.9090f, + 1.0000f, 0.9953f, 0.9417f, 0.9001f, 1.0000f, 0.9680f, 0.9935f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9842f, 0.9390f, 0.9898f, + 1.0000f, 0.9783f, 0.9165f, 0.3171f, 1.0000f, 0.8236f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9748f, 0.8440f, 1.0000f, + 1.0000f, 0.9641f, 0.8061f, 0.3646f, 1.0000f, 0.9584f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9499f, 0.9878f, 1.0000f, + 1.0000f, 0.8596f, 0.5202f, 0.9982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8675f, 1.0000f, 1.0000f, + 1.0000f, 0.9424f, 0.5558f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9551f, 1.0000f, 1.0000f, + 1.0000f, 0.8252f, 0.8098f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9916f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9890f, 0.9947f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9902f, 0.9924f, 0.9712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9790f, 0.8151f, 0.4541f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9147f, 0.7504f, 0.6026f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9346f, 0.3459f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7528f, 0.6171f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9368f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5718f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9760f, 0.9859f, 0.9651f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9772f, 0.9756f, 0.7479f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, + 1.0000f, 0.9728f, 0.7114f, 0.9052f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9986f, + 1.0000f, 0.9156f, 0.4322f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9959f, + 1.0000f, 0.9280f, 0.9330f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9909f, 0.9963f, + 1.0000f, 0.4814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9984f, 1.0000f, + 1.0000f, 0.9192f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9864f, 0.9954f, + 1.0000f, 0.9481f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9900f, 0.9971f, 0.9833f, + 1.0000f, 0.9805f, 0.9456f, 0.8301f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.9992f, + 1.0000f, 0.9732f, 0.9119f, 0.7902f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 0.9851f, + 1.0000f, 0.9661f, 0.6627f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9893f, 0.9978f, + 1.0000f, 0.8869f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9931f, 0.9918f, 0.9880f, + 1.0000f, 0.8959f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 0.9540f, 0.9675f, + 1.0000f, 0.6941f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9830f, 0.9557f, 0.6218f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 0.9314f, 0.7057f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9523f, 0.8636f, 0.8425f, + 1.0000f, 0.9930f, 0.8822f, 0.6389f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8662f, 1.0000f, 1.0000f, + 1.0000f, 0.9922f, 0.8810f, 0.8485f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9450f, 1.0000f, 1.0000f, + 1.0000f, 0.2138f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6813f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8622f, 0.7379f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7275f, 0.9988f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7734f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9990f, 0.9986f, + 1.0000f, 0.9670f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 1.0000f, 0.9875f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9942f, 0.9991f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.9999f, 0.9475f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9228f, 0.7576f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9950f, 0.8892f, 0.9610f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8609f, 0.8186f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7668f, 0.9985f, 1.0000f, + 1.0000f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9798f, 0.9999f, 0.9964f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9839f, 1.0000f, 0.9375f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8542f, 0.3364f, 0.8834f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7404f, 0.6265f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5665f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8514f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_8x8[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6539f, 0.8057f, 1.0000f, 1.0000f, 0.8190f, 0.8664f, 1.0000f, 1.0000f, 0.9665f, 0.9926f, + 1.0000f, 1.0000f, 1.0000f, 0.9969f, 1.0000f, 0.7563f, 0.7444f, 0.8563f, 1.0000f, 0.8161f, 0.8706f, 0.8925f, 1.0000f, 1.0000f, 0.9863f, 0.9956f, + 1.0000f, 1.0000f, 0.9786f, 0.9960f, 1.0000f, 0.8529f, 0.8117f, 0.5924f, 1.0000f, 0.9100f, 0.8609f, 0.6746f, 1.0000f, 1.0000f, 0.9382f, 0.8726f, + 1.0000f, 1.0000f, 0.9941f, 0.9942f, 1.0000f, 0.7543f, 0.7979f, 0.4968f, 1.0000f, 0.8368f, 0.8493f, 0.5366f, 1.0000f, 0.9476f, 0.9487f, 0.9213f, + 1.0000f, 1.0000f, 0.9326f, 0.9588f, 1.0000f, 0.7205f, 0.6146f, 0.5412f, 1.0000f, 0.7849f, 0.6074f, 0.3232f, 1.0000f, 0.9498f, 0.8642f, 0.5125f, + 1.0000f, 0.9562f, 0.9712f, 0.9698f, 1.0000f, 0.7113f, 0.3712f, 0.9158f, 1.0000f, 0.7947f, 0.2448f, 0.9190f, 1.0000f, 0.8456f, 0.8102f, 0.4805f, + 1.0000f, 1.0000f, 0.8795f, 0.8987f, 1.0000f, 0.6447f, 0.1531f, 1.0000f, 1.0000f, 0.7065f, 0.0985f, 1.0000f, 1.0000f, 0.8736f, 0.4914f, 0.1851f, + 1.0000f, 0.8907f, 0.8010f, 0.5802f, 1.0000f, 0.5176f, 0.6629f, 1.0000f, 1.0000f, 0.4582f, 0.6110f, 1.0000f, 1.0000f, 0.7602f, 0.3314f, 0.5590f, + 1.0000f, 1.0000f, 1.0000f, 0.9792f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9762f, 0.9823f, + 1.0000f, 1.0000f, 0.9932f, 0.9990f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9638f, 0.9661f, + 1.0000f, 1.0000f, 0.9723f, 0.9817f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8969f, 0.9198f, + 1.0000f, 0.9642f, 0.9743f, 0.9091f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9040f, 0.9332f, 0.5633f, + 1.0000f, 1.0000f, 0.9022f, 0.9221f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9313f, 0.7040f, 0.2718f, + 1.0000f, 0.8716f, 0.8219f, 0.5843f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6991f, 0.4215f, 0.5021f, + 1.0000f, 0.9376f, 0.7749f, 0.5457f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8072f, 0.2258f, 0.3938f, + 1.0000f, 0.7882f, 0.6802f, 0.3150f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6250f, 0.2059f, 1.0000f, + 1.0000f, 1.0000f, 0.9626f, 0.9968f, 0.7963f, 1.0000f, 1.0000f, 1.0000f, 0.1272f, 1.0000f, 1.0000f, 1.0000f, 0.4638f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9916f, 0.9966f, 0.5502f, 1.0000f, 1.0000f, 1.0000f, 0.1745f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9345f, 0.8852f, 0.6478f, 1.0000f, 1.0000f, 1.0000f, 0.1132f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9523f, 0.9613f, 0.8943f, 0.2981f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9459f, 0.8916f, 0.4694f, 0.6417f, 1.0000f, 1.0000f, 1.0000f, 0.6216f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8176f, 0.8132f, 0.4860f, 0.0667f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, + 1.0000f, 0.8843f, 0.5074f, 0.2159f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9914f, + 1.0000f, 0.7714f, 0.3556f, 0.5719f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9919f, 0.9989f, + 1.0000f, 1.0000f, 0.9657f, 0.9848f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9705f, 0.9548f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8653f, 0.8815f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9874f, + 1.0000f, 0.9057f, 0.9228f, 0.4750f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, + 1.0000f, 0.9258f, 0.7361f, 0.3476f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9806f, 0.9961f, + 1.0000f, 0.7228f, 0.4080f, 0.6037f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 0.9939f, + 1.0000f, 0.7766f, 0.2539f, 0.4468f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9694f, 0.9909f, + 1.0000f, 0.6569f, 0.3635f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9709f, 0.9843f, 0.8996f, + 1.0000f, 0.9990f, 0.9988f, 0.9974f, 1.0000f, 0.7732f, 0.5884f, 0.7136f, 1.0000f, 0.8766f, 0.7273f, 0.7382f, 1.0000f, 0.9927f, 0.9959f, 0.9846f, + 1.0000f, 0.9998f, 0.9994f, 0.9592f, 1.0000f, 0.6600f, 0.6913f, 0.7403f, 1.0000f, 0.7931f, 0.7339f, 0.7464f, 1.0000f, 0.9809f, 0.9904f, 0.8674f, + 1.0000f, 0.9634f, 0.9833f, 0.9780f, 1.0000f, 0.6317f, 0.9605f, 1.0000f, 1.0000f, 0.6000f, 0.9691f, 1.0000f, 1.0000f, 0.7296f, 0.8695f, 0.9889f, + 1.0000f, 0.9265f, 0.9684f, 0.8394f, 1.0000f, 0.8342f, 1.0000f, 1.0000f, 1.0000f, 0.7914f, 1.0000f, 1.0000f, 1.0000f, 0.8552f, 0.9492f, 0.9841f, + 1.0000f, 0.8468f, 0.8233f, 0.9465f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6858f, 0.9236f, 1.0000f, + 1.0000f, 0.7816f, 0.9436f, 0.8598f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8685f, 1.0000f, 1.0000f, + 1.0000f, 0.4279f, 0.8898f, 0.9430f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7484f, 0.9759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9998f, 0.9944f, 0.9279f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9133f, 0.9370f, 0.9401f, + 1.0000f, 0.9998f, 0.9853f, 0.9719f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9828f, 0.8978f, 0.8870f, + 1.0000f, 0.9654f, 0.8275f, 0.9049f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6659f, 0.9125f, 1.0000f, + 1.0000f, 0.9543f, 0.9702f, 0.9320f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8247f, 0.9680f, 1.0000f, + 1.0000f, 0.4342f, 0.9083f, 0.9448f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7898f, 1.0000f, 1.0000f, + 1.0000f, 0.7523f, 0.9851f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7159f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7621f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9887f, 0.9883f, 0.9716f, 0.6774f, 1.0000f, 1.0000f, 1.0000f, 0.0827f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9740f, 0.9771f, 0.8586f, 0.2894f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7016f, 0.8776f, 0.9858f, 0.6509f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 0.8419f, 0.9442f, 0.9768f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, + 1.0000f, 0.7089f, 0.9272f, 1.0000f, 0.3396f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9999f, 0.9986f, + 1.0000f, 0.9031f, 1.0000f, 1.0000f, 0.2806f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9996f, 0.9676f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9955f, 0.9538f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9900f, 0.9726f, + 1.0000f, 0.8328f, 0.8756f, 0.9117f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.9557f, 0.8147f, 0.8540f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.6351f, 0.9388f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.9971f, 0.9579f, + 1.0000f, 0.8355f, 0.9618f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9951f, 0.8381f, + 1.0000f, 0.7696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9630f, 0.9870f, 0.9867f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9306f, 0.9646f, 0.8288f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9736f, 0.8205f, 0.9108f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9553f, 0.9650f, 0.9293f, + 1.0000f, 1.0000f, 0.9876f, 0.9872f, 1.0000f, 0.9596f, 0.8879f, 0.8431f, 1.0000f, 0.9601f, 0.9687f, 0.8805f, 1.0000f, 0.9907f, 0.9746f, 0.9831f, + 1.0000f, 0.9992f, 0.9938f, 0.9985f, 1.0000f, 0.9339f, 0.8026f, 0.9997f, 1.0000f, 0.9753f, 0.9166f, 1.0000f, 1.0000f, 0.9893f, 0.9936f, 0.7783f, + 1.0000f, 0.9947f, 0.9407f, 0.9358f, 1.0000f, 0.9798f, 0.9983f, 1.0000f, 1.0000f, 0.9783f, 0.9897f, 1.0000f, 1.0000f, 0.9825f, 0.8261f, 0.9503f, + 1.0000f, 0.9812f, 0.9413f, 0.4405f, 1.0000f, 0.8824f, 1.0000f, 1.0000f, 1.0000f, 0.9528f, 1.0000f, 1.0000f, 1.0000f, 0.9351f, 0.5546f, 1.0000f, + 1.0000f, 0.9820f, 0.7995f, 0.1638f, 1.0000f, 0.9508f, 1.0000f, 1.0000f, 1.0000f, 0.9777f, 1.0000f, 1.0000f, 1.0000f, 0.8934f, 0.8785f, 1.0000f, + 1.0000f, 0.8620f, 0.4525f, 0.9899f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5320f, 1.0000f, 1.0000f, + 1.0000f, 0.9570f, 0.3789f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8575f, 1.0000f, 1.0000f, + 1.0000f, 0.7658f, 0.5225f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8406f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9930f, 0.9978f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9895f, 0.9789f, 0.8960f, + 1.0000f, 0.9913f, 0.9935f, 0.9948f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9774f, 0.9583f, 0.8087f, + 1.0000f, 0.9865f, 0.9066f, 0.5677f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9733f, 0.7677f, 1.0000f, + 1.0000f, 0.9300f, 0.8444f, 0.7640f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9174f, 1.0000f, 1.0000f, + 1.0000f, 0.9673f, 0.4010f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9250f, 1.0000f, 1.0000f, + 1.0000f, 0.7799f, 0.6284f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6718f, 1.0000f, 1.0000f, + 1.0000f, 0.9150f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3864f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9803f, 0.9856f, 0.9765f, 0.6966f, 1.0000f, 1.0000f, 1.0000f, 0.5963f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9838f, 0.9801f, 0.8833f, 0.0503f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9929f, + 1.0000f, 0.9669f, 0.8042f, 0.9814f, 0.3067f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9972f, + 1.0000f, 0.9518f, 0.6181f, 1.0000f, 0.2356f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9973f, + 1.0000f, 0.9206f, 0.9182f, 1.0000f, 0.0271f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9976f, + 1.0000f, 0.5761f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9979f, 0.9991f, + 1.0000f, 0.8952f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9952f, 0.9970f, + 1.0000f, 0.8315f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9836f, 0.9924f, 0.9891f, + 1.0000f, 0.9749f, 0.9566f, 0.8746f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9984f, + 1.0000f, 0.9918f, 0.9364f, 0.8631f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9945f, + 1.0000f, 0.9795f, 0.7318f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9881f, 0.9902f, + 1.0000f, 0.9454f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9921f, 0.9609f, 0.9860f, + 1.0000f, 0.9424f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9471f, 0.9286f, + 1.0000f, 0.6940f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9756f, 0.9394f, 0.4148f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9243f, 0.6384f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9418f, 0.7866f, 0.7251f, + 1.0000f, 0.9982f, 0.9513f, 0.7424f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7182f, 1.0000f, 1.0000f, + 1.0000f, 0.9962f, 0.9482f, 0.9729f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9575f, 1.0000f, 1.0000f, + 1.0000f, 0.1408f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6689f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9533f, 0.9141f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8861f, 0.9996f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9005f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9999f, 0.9967f, + 1.0000f, 0.9949f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9993f, 0.9975f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9922f, 0.9999f, 0.9981f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9911f, 1.0000f, 0.8889f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9014f, 0.6886f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9885f, 0.8505f, 0.9074f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8481f, 0.7832f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7582f, 0.9994f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9997f, 0.9985f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9879f, 1.0000f, 0.9622f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8302f, 0.2629f, 0.8517f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7504f, 0.5273f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1955f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6830f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_8x10[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8029f, 0.8183f, 1.0000f, 1.0000f, 0.9742f, 0.9767f, 1.0000f, 1.0000f, 0.9905f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 0.9980f, 1.0000f, 0.7921f, 0.8421f, 0.8718f, 1.0000f, 0.9775f, 0.9700f, 0.9587f, 1.0000f, 1.0000f, 0.9598f, 0.9960f, + 1.0000f, 1.0000f, 0.9851f, 0.9976f, 1.0000f, 0.9128f, 0.9270f, 0.5965f, 1.0000f, 0.9576f, 0.9361f, 0.6235f, 1.0000f, 1.0000f, 0.9553f, 0.8776f, + 1.0000f, 1.0000f, 0.9891f, 0.9934f, 1.0000f, 0.8587f, 0.8324f, 0.4406f, 1.0000f, 0.9156f, 0.8737f, 0.5514f, 1.0000f, 0.9684f, 0.9671f, 0.8883f, + 1.0000f, 1.0000f, 0.9750f, 0.9595f, 1.0000f, 0.8490f, 0.7375f, 0.5859f, 1.0000f, 0.9053f, 0.6035f, 0.5065f, 1.0000f, 0.9668f, 0.9014f, 0.4294f, + 1.0000f, 0.9764f, 0.9914f, 0.9819f, 1.0000f, 0.8866f, 0.4180f, 0.8958f, 1.0000f, 0.8875f, 0.1874f, 0.8248f, 1.0000f, 0.8998f, 0.8468f, 0.4064f, + 1.0000f, 1.0000f, 0.9322f, 0.8785f, 1.0000f, 0.7309f, 0.2514f, 1.0000f, 1.0000f, 0.8512f, 0.0364f, 1.0000f, 1.0000f, 0.9233f, 0.5297f, 0.1973f, + 1.0000f, 0.9221f, 0.8143f, 0.4872f, 1.0000f, 0.6655f, 0.7173f, 1.0000f, 1.0000f, 0.5017f, 0.4773f, 1.0000f, 1.0000f, 0.8618f, 0.2848f, 0.4723f, + 1.0000f, 1.0000f, 1.0000f, 0.9927f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9644f, 0.9099f, 1.0000f, 1.0000f, 0.9884f, 0.9874f, + 1.0000f, 1.0000f, 0.9948f, 0.9953f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9661f, 0.9616f, 0.9121f, 1.0000f, 1.0000f, 0.9634f, 0.9756f, + 1.0000f, 1.0000f, 0.9733f, 0.9946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9459f, 0.8804f, 0.5593f, 1.0000f, 1.0000f, 0.9436f, 0.9328f, + 1.0000f, 0.9718f, 0.9917f, 0.9038f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8925f, 0.5749f, 0.4969f, 1.0000f, 0.9606f, 0.9630f, 0.6103f, + 1.0000f, 1.0000f, 0.9440f, 0.9468f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8892f, 0.2768f, 0.7770f, 1.0000f, 0.9674f, 0.8209f, 0.4515f, + 1.0000f, 0.9691f, 0.8813f, 0.6847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7242f, 0.2250f, 1.0000f, 1.0000f, 0.8156f, 0.4620f, 0.6569f, + 1.0000f, 0.9569f, 0.8545f, 0.5473f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7265f, 0.1574f, 1.0000f, 1.0000f, 0.8747f, 0.3429f, 0.5251f, + 1.0000f, 0.8917f, 0.7102f, 0.3149f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2067f, 1.0000f, 1.0000f, 1.0000f, 0.7788f, 0.4351f, 1.0000f, + 1.0000f, 1.0000f, 0.9703f, 0.9956f, 0.8934f, 1.0000f, 1.0000f, 1.0000f, 0.1472f, 1.0000f, 0.7219f, 0.7999f, 0.5341f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9893f, 0.9975f, 0.6766f, 1.0000f, 1.0000f, 1.0000f, 0.2599f, 0.7053f, 0.7889f, 0.7353f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9609f, 0.9149f, 0.7621f, 1.0000f, 1.0000f, 1.0000f, 0.1368f, 0.8577f, 0.7460f, 0.3756f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9658f, 0.9627f, 0.9022f, 0.4004f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8727f, 0.6202f, 0.6451f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9561f, 0.9246f, 0.5895f, 0.7541f, 1.0000f, 1.0000f, 1.0000f, 0.6683f, 0.7640f, 0.1675f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9240f, 0.9077f, 0.6001f, 0.1155f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6298f, 0.7003f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, + 1.0000f, 0.9195f, 0.5786f, 0.2998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7287f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, + 1.0000f, 0.8974f, 0.3820f, 0.6329f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0921f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.9999f, + 1.0000f, 1.0000f, 0.9591f, 0.9780f, 0.0790f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9772f, 0.9454f, 0.5930f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9294f, 0.9046f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, + 1.0000f, 0.9499f, 0.9426f, 0.5112f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, + 1.0000f, 0.9486f, 0.8566f, 0.4568f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9868f, 0.9988f, + 1.0000f, 0.8639f, 0.5205f, 0.6793f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9911f, + 1.0000f, 0.8849f, 0.3361f, 0.5633f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9849f, 0.9931f, + 1.0000f, 0.7905f, 0.4237f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9816f, 0.9876f, 0.8698f, + 1.0000f, 0.9989f, 0.9989f, 0.9988f, 1.0000f, 0.7937f, 0.5554f, 0.6900f, 1.0000f, 0.9371f, 0.8900f, 0.9311f, 1.0000f, 0.9919f, 0.9940f, 0.9786f, + 1.0000f, 0.9999f, 0.9999f, 0.9753f, 1.0000f, 0.6421f, 0.6978f, 0.7439f, 1.0000f, 0.9030f, 0.9381f, 0.9584f, 1.0000f, 0.9715f, 0.9928f, 0.8669f, + 1.0000f, 0.9565f, 0.9811f, 0.9730f, 1.0000f, 0.6169f, 0.9525f, 1.0000f, 1.0000f, 0.7678f, 0.9350f, 1.0000f, 1.0000f, 0.6820f, 0.8629f, 0.9620f, + 1.0000f, 0.9107f, 0.9602f, 0.8299f, 1.0000f, 0.8044f, 1.0000f, 1.0000f, 1.0000f, 0.9189f, 1.0000f, 1.0000f, 1.0000f, 0.8287f, 0.9176f, 0.9853f, + 1.0000f, 0.8966f, 0.8608f, 0.9759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7126f, 0.9069f, 1.0000f, + 1.0000f, 0.8337f, 0.9482f, 0.9412f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8261f, 1.0000f, 1.0000f, + 1.0000f, 0.3221f, 0.7839f, 0.9339f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7150f, 0.9169f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9995f, 0.9920f, 0.9421f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7562f, 0.7331f, 0.9114f, 1.0000f, 0.9345f, 0.9529f, 0.9770f, + 1.0000f, 0.9997f, 0.9897f, 0.9678f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8058f, 0.8708f, 0.9904f, 1.0000f, 0.9938f, 0.9387f, 0.9778f, + 1.0000f, 0.9681f, 0.8433f, 0.8991f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8349f, 1.0000f, 1.0000f, 1.0000f, 0.7753f, 0.9736f, 1.0000f, + 1.0000f, 0.9613f, 0.9623f, 0.9508f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9317f, 0.9888f, 1.0000f, + 1.0000f, 0.4921f, 0.9355f, 0.9739f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8222f, 1.0000f, 1.0000f, + 1.0000f, 0.8235f, 0.9872f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7805f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7873f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9857f, 0.9886f, 0.9654f, 0.7953f, 1.0000f, 1.0000f, 1.0000f, 0.1775f, 0.5710f, 0.6069f, 0.9796f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9804f, 0.9862f, 0.8766f, 0.4122f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5823f, 0.8115f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7581f, 0.8840f, 0.9909f, 0.8087f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, + 1.0000f, 0.8409f, 0.9431f, 0.9835f, 0.0191f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 0.8014f, 0.9521f, 1.0000f, 0.5430f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9996f, 0.9978f, + 1.0000f, 0.9366f, 1.0000f, 1.0000f, 0.3074f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9402f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9900f, 0.9084f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9806f, 0.9464f, + 1.0000f, 0.8397f, 0.8942f, 0.9202f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, + 1.0000f, 0.9557f, 0.8101f, 0.8822f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6598f, 0.9392f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9943f, 0.9572f, + 1.0000f, 0.8386f, 0.9648f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9955f, 0.8170f, + 1.0000f, 0.8689f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9706f, 0.9846f, 0.9860f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9061f, 0.9855f, 0.8445f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9397f, 0.7659f, 0.8534f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9258f, 0.9512f, 0.9162f, + 1.0000f, 1.0000f, 0.9991f, 0.9992f, 1.0000f, 0.9922f, 0.8479f, 0.7734f, 1.0000f, 0.9783f, 0.9724f, 0.8501f, 1.0000f, 0.9970f, 0.9930f, 0.9761f, + 1.0000f, 0.9967f, 0.9997f, 0.9997f, 1.0000f, 0.9491f, 0.7418f, 1.0000f, 1.0000f, 0.9828f, 0.8456f, 1.0000f, 1.0000f, 0.9844f, 0.9944f, 0.7716f, + 1.0000f, 0.9987f, 0.9954f, 0.9300f, 1.0000f, 0.9840f, 0.9978f, 1.0000f, 1.0000f, 0.9799f, 0.9687f, 1.0000f, 1.0000f, 0.9814f, 0.7697f, 0.8831f, + 1.0000f, 0.9925f, 0.9694f, 0.4461f, 1.0000f, 0.8073f, 1.0000f, 1.0000f, 1.0000f, 0.7856f, 1.0000f, 1.0000f, 1.0000f, 0.9709f, 0.3497f, 1.0000f, + 1.0000f, 0.9958f, 0.8598f, 0.2684f, 1.0000f, 0.9252f, 1.0000f, 1.0000f, 1.0000f, 0.8982f, 1.0000f, 1.0000f, 1.0000f, 0.9288f, 0.6711f, 1.0000f, + 1.0000f, 0.9416f, 0.5159f, 0.9998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3627f, 1.0000f, 1.0000f, + 1.0000f, 0.9882f, 0.2341f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8555f, 1.0000f, 1.0000f, + 1.0000f, 0.8129f, 0.3944f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6267f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9935f, 0.9981f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9912f, 0.9473f, 0.9974f, 1.0000f, 0.9977f, 0.9580f, 0.8659f, + 1.0000f, 0.9981f, 0.9985f, 0.9947f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9824f, 0.8374f, 1.0000f, 1.0000f, 0.9890f, 0.9333f, 0.7396f, + 1.0000f, 0.9979f, 0.9477f, 0.6391f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9712f, 1.0000f, 1.0000f, 1.0000f, 0.9916f, 0.6136f, 1.0000f, + 1.0000f, 0.9533f, 0.8312f, 0.7521f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7984f, 1.0000f, 1.0000f, 1.0000f, 0.9305f, 1.0000f, 1.0000f, + 1.0000f, 0.9826f, 0.4823f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9537f, 1.0000f, 1.0000f, + 1.0000f, 0.9006f, 0.6627f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4672f, 1.0000f, 1.0000f, + 1.0000f, 0.9516f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2923f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9745f, 0.9788f, 0.9727f, 0.8196f, 1.0000f, 1.0000f, 1.0000f, 0.3882f, 0.9936f, 0.8950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9949f, 0.9821f, 0.9276f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9641f, 0.9907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 0.9801f, 0.8361f, 0.9549f, 0.7028f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9651f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9747f, 1.0000f, + 1.0000f, 0.9878f, 0.6360f, 1.0000f, 0.2159f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9866f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9880f, + 1.0000f, 0.9637f, 0.9227f, 1.0000f, 0.0654f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9983f, + 1.0000f, 0.6952f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9991f, + 1.0000f, 0.9208f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9971f, + 1.0000f, 0.7969f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9952f, 0.9495f, + 1.0000f, 0.9959f, 0.9664f, 0.8523f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9992f, + 1.0000f, 0.9831f, 0.9182f, 0.8274f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9957f, + 1.0000f, 0.9870f, 0.7501f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9996f, + 1.0000f, 0.9092f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9902f, 0.9837f, + 1.0000f, 0.9504f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9942f, 0.9895f, 0.9376f, + 1.0000f, 0.7078f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 0.9809f, 0.3562f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.8909f, 0.3292f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9264f, 0.7196f, 0.5386f, + 1.0000f, 0.9997f, 0.9794f, 0.8649f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6926f, 1.0000f, 1.0000f, + 1.0000f, 0.9996f, 0.9450f, 0.9721f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9214f, 1.0000f, 1.0000f, + 1.0000f, 0.2427f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6540f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9445f, 0.9545f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 1.0000f, 1.0000f, + 1.0000f, 0.9282f, 0.9993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8857f, 1.0000f, 1.0000f, 0.7480f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9994f, 0.9986f, + 1.0000f, 0.9791f, 1.0000f, 1.0000f, 0.1039f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9842f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0517f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9833f, 0.9984f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9864f, 0.9998f, 0.8794f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.8679f, 0.6739f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.9142f, 0.9407f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7822f, 0.6874f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6511f, 0.9899f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9932f, 0.9994f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9697f, 1.0000f, 0.9541f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9135f, 0.3692f, 0.8756f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7601f, 0.5671f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1263f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6481f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_8x12[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8054f, 0.8341f, 1.0000f, 1.0000f, 0.9810f, 0.9675f, 1.0000f, 1.0000f, 0.9943f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 0.9986f, 1.0000f, 0.8624f, 0.8820f, 0.8375f, 1.0000f, 0.9572f, 0.9701f, 0.9819f, 1.0000f, 1.0000f, 0.9868f, 0.9979f, + 1.0000f, 1.0000f, 0.9915f, 0.9972f, 1.0000f, 0.9009f, 0.9330f, 0.6438f, 1.0000f, 0.9640f, 0.9394f, 0.6551f, 1.0000f, 1.0000f, 0.9521f, 0.8586f, + 1.0000f, 1.0000f, 0.9962f, 0.9975f, 1.0000f, 0.9383f, 0.8132f, 0.4939f, 1.0000f, 0.9373f, 0.9017f, 0.5792f, 1.0000f, 0.9525f, 0.9604f, 0.8652f, + 1.0000f, 1.0000f, 0.9899f, 0.9672f, 1.0000f, 0.9053f, 0.7622f, 0.5825f, 1.0000f, 0.9208f, 0.6175f, 0.5434f, 1.0000f, 0.9583f, 0.9232f, 0.3895f, + 1.0000f, 0.9765f, 0.9813f, 0.9742f, 1.0000f, 0.8845f, 0.4758f, 0.8948f, 1.0000f, 0.8595f, 0.1803f, 0.8282f, 1.0000f, 0.9038f, 0.8196f, 0.3837f, + 1.0000f, 1.0000f, 0.9436f, 0.9136f, 1.0000f, 0.7854f, 0.3658f, 1.0000f, 1.0000f, 0.8419f, 0.0601f, 1.0000f, 1.0000f, 0.9478f, 0.5757f, 0.2737f, + 1.0000f, 0.9466f, 0.8397f, 0.5278f, 1.0000f, 0.7148f, 0.7692f, 1.0000f, 1.0000f, 0.5071f, 0.4518f, 1.0000f, 1.0000f, 0.8901f, 0.3415f, 0.5509f, + 1.0000f, 1.0000f, 1.0000f, 0.9940f, 0.6145f, 1.0000f, 1.0000f, 1.0000f, 0.8495f, 1.0000f, 0.9607f, 0.9220f, 0.6381f, 1.0000f, 0.9945f, 0.9969f, + 1.0000f, 1.0000f, 0.9961f, 0.9995f, 0.8246f, 1.0000f, 1.0000f, 1.0000f, 0.8080f, 0.9440f, 0.9634f, 0.9238f, 0.4567f, 1.0000f, 0.9863f, 0.9898f, + 1.0000f, 1.0000f, 0.9779f, 0.9934f, 0.8184f, 1.0000f, 1.0000f, 1.0000f, 0.5358f, 0.9418f, 0.9123f, 0.6323f, 0.8093f, 1.0000f, 0.9357f, 0.8725f, + 1.0000f, 0.9882f, 0.9885f, 0.9279f, 0.8067f, 1.0000f, 1.0000f, 1.0000f, 0.2212f, 0.9002f, 0.5891f, 0.6235f, 1.0000f, 0.9449f, 0.9389f, 0.4420f, + 1.0000f, 1.0000f, 0.9453f, 0.9335f, 0.7823f, 1.0000f, 1.0000f, 1.0000f, 0.7775f, 0.8837f, 0.3086f, 0.7792f, 1.0000f, 0.9506f, 0.7884f, 0.2665f, + 1.0000f, 0.9760f, 0.8760f, 0.6893f, 0.1970f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7395f, 0.3598f, 1.0000f, 1.0000f, 0.8209f, 0.3287f, 0.5858f, + 1.0000f, 0.9723f, 0.8987f, 0.6113f, 0.1450f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7169f, 0.1631f, 1.0000f, 1.0000f, 0.8484f, 0.1888f, 0.3476f, + 1.0000f, 0.9176f, 0.7511f, 0.3951f, 0.6660f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1357f, 1.0000f, 1.0000f, 1.0000f, 0.7473f, 0.2879f, 1.0000f, + 1.0000f, 1.0000f, 0.9762f, 0.9920f, 0.9074f, 1.0000f, 1.0000f, 1.0000f, 0.2133f, 1.0000f, 0.9494f, 0.9445f, 0.6467f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9911f, 0.9973f, 0.7082f, 1.0000f, 1.0000f, 1.0000f, 0.3537f, 0.9547f, 0.8803f, 0.7657f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9794f, 0.9268f, 0.7942f, 1.0000f, 1.0000f, 1.0000f, 0.2592f, 0.9490f, 0.7293f, 0.4615f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9852f, 0.9715f, 0.9319f, 0.5156f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9422f, 0.5546f, 0.7314f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9558f, 0.9510f, 0.6410f, 0.7355f, 1.0000f, 1.0000f, 1.0000f, 0.7273f, 0.8662f, 0.1062f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9482f, 0.9088f, 0.6352f, 0.2368f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6051f, 0.6687f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, + 1.0000f, 0.9565f, 0.6265f, 0.4370f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7675f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, + 1.0000f, 0.9130f, 0.5197f, 0.7567f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0320f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9985f, + 1.0000f, 1.0000f, 0.9835f, 0.9822f, 0.2443f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8795f, 0.8615f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9666f, 0.9486f, 0.4166f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9413f, 0.9189f, 0.5618f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9150f, 0.9156f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8861f, 0.5027f, 0.5653f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, + 1.0000f, 0.9624f, 0.9431f, 0.5723f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8716f, 0.3154f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, + 1.0000f, 0.9621f, 0.8689f, 0.4850f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7434f, 0.2053f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9953f, + 1.0000f, 0.8925f, 0.5238f, 0.7037f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4270f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9931f, + 1.0000f, 0.9169f, 0.4711f, 0.6633f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6942f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9865f, 0.9896f, + 1.0000f, 0.8536f, 0.5318f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1541f, 1.0000f, 1.0000f, 1.0000f, 0.9824f, 0.9928f, 0.8743f, + 1.0000f, 0.9989f, 0.9992f, 0.9987f, 1.0000f, 0.7839f, 0.5396f, 0.6792f, 1.0000f, 0.9698f, 0.9081f, 0.9726f, 1.0000f, 0.9887f, 0.9854f, 0.9656f, + 1.0000f, 0.9996f, 0.9999f, 0.9842f, 1.0000f, 0.6523f, 0.6740f, 0.7211f, 1.0000f, 0.9102f, 0.9398f, 0.9600f, 1.0000f, 0.9614f, 0.9859f, 0.8294f, + 1.0000f, 0.9744f, 0.9846f, 0.9787f, 1.0000f, 0.6818f, 0.9663f, 1.0000f, 1.0000f, 0.7986f, 0.9517f, 1.0000f, 1.0000f, 0.6294f, 0.8430f, 0.9362f, + 1.0000f, 0.9067f, 0.9579f, 0.8318f, 1.0000f, 0.8040f, 1.0000f, 1.0000f, 1.0000f, 0.9408f, 1.0000f, 1.0000f, 1.0000f, 0.7870f, 0.8853f, 0.9880f, + 1.0000f, 0.8786f, 0.8566f, 0.9533f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7104f, 0.9163f, 1.0000f, + 1.0000f, 0.8119f, 0.9631f, 0.9352f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8634f, 1.0000f, 1.0000f, + 1.0000f, 0.3352f, 0.8027f, 0.9576f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7252f, 0.9341f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9983f, 0.9966f, 0.9474f, 0.5114f, 1.0000f, 1.0000f, 1.0000f, 0.9659f, 0.8013f, 0.8546f, 0.9908f, 1.0000f, 0.9024f, 0.9457f, 0.9647f, + 1.0000f, 0.9998f, 0.9923f, 0.9808f, 0.6019f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8576f, 0.9529f, 0.9963f, 1.0000f, 0.9891f, 0.9313f, 0.9637f, + 1.0000f, 0.9769f, 0.8680f, 0.9116f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8917f, 1.0000f, 1.0000f, 1.0000f, 0.6990f, 0.9182f, 1.0000f, + 1.0000f, 0.9678f, 0.9597f, 0.9728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8812f, 0.9653f, 1.0000f, + 1.0000f, 0.4895f, 0.9250f, 0.9739f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6843f, 1.0000f, 1.0000f, + 1.0000f, 0.8107f, 0.9844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8452f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8474f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9932f, 0.9925f, 0.9784f, 0.8222f, 1.0000f, 1.0000f, 1.0000f, 0.0960f, 0.5923f, 0.7999f, 0.9906f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9736f, 0.9789f, 0.8734f, 0.3778f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7415f, 0.9627f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7759f, 0.9273f, 0.9974f, 0.7928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.8933f, 0.9514f, 0.9876f, 0.0163f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, + 1.0000f, 0.8329f, 0.9586f, 1.0000f, 0.5472f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9988f, 0.9967f, + 1.0000f, 0.9569f, 1.0000f, 1.0000f, 0.3018f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9997f, 0.9201f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9754f, 0.8909f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9772f, 0.9427f, + 1.0000f, 0.8671f, 0.8698f, 0.9346f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6579f, 0.8707f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9551f, 0.8258f, 0.8505f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7726f, 0.9806f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6966f, 0.9669f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9968f, 0.9544f, + 1.0000f, 0.8778f, 0.9767f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.8234f, + 1.0000f, 0.8964f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9325f, 0.9752f, 0.9720f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8893f, 0.9540f, 0.8171f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9296f, 0.7743f, 0.8364f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9368f, 0.9470f, 0.9262f, + 1.0000f, 1.0000f, 0.9992f, 0.9995f, 1.0000f, 0.9889f, 0.8829f, 0.7604f, 1.0000f, 0.9562f, 0.9837f, 0.7971f, 1.0000f, 0.9850f, 0.9747f, 0.9826f, + 1.0000f, 1.0000f, 0.9999f, 0.9990f, 1.0000f, 0.9590f, 0.7585f, 1.0000f, 1.0000f, 0.9950f, 0.7899f, 0.9999f, 1.0000f, 0.9989f, 0.9927f, 0.7375f, + 1.0000f, 0.9976f, 0.9782f, 0.9749f, 1.0000f, 0.9774f, 0.9980f, 1.0000f, 1.0000f, 0.9681f, 0.9143f, 1.0000f, 1.0000f, 0.9965f, 0.7060f, 0.7640f, + 1.0000f, 0.9986f, 0.9883f, 0.5689f, 1.0000f, 0.8158f, 1.0000f, 1.0000f, 1.0000f, 0.6917f, 1.0000f, 1.0000f, 1.0000f, 0.9833f, 0.2291f, 1.0000f, + 1.0000f, 0.9984f, 0.8769f, 0.1717f, 1.0000f, 0.9378f, 1.0000f, 1.0000f, 1.0000f, 0.8941f, 1.0000f, 1.0000f, 1.0000f, 0.9195f, 0.7014f, 1.0000f, + 1.0000f, 0.9302f, 0.4805f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3718f, 1.0000f, 1.0000f, + 1.0000f, 0.9918f, 0.3221f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8643f, 1.0000f, 1.0000f, + 1.0000f, 0.8526f, 0.4469f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6205f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9970f, 0.9980f, 0.9801f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9831f, 0.8994f, 0.9731f, 1.0000f, 0.9949f, 0.9799f, 0.8352f, + 1.0000f, 0.9973f, 0.9985f, 0.9954f, 0.8885f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9856f, 0.7530f, 1.0000f, 1.0000f, 0.9839f, 0.9403f, 0.5955f, + 1.0000f, 0.9998f, 0.9291f, 0.7548f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9796f, 1.0000f, 1.0000f, 1.0000f, 0.9757f, 0.4218f, 1.0000f, + 1.0000f, 0.9684f, 0.9109f, 0.9095f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6495f, 1.0000f, 1.0000f, 1.0000f, 0.8515f, 1.0000f, 1.0000f, + 1.0000f, 0.9930f, 0.5582f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8972f, 1.0000f, 1.0000f, + 1.0000f, 0.8751f, 0.6868f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1262f, 1.0000f, 1.0000f, + 1.0000f, 0.9777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4060f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9995f, 0.9921f, 0.9718f, 0.8408f, 1.0000f, 1.0000f, 1.0000f, 0.4320f, 0.9894f, 0.8306f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9971f, 0.9815f, 0.9308f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9791f, 0.9593f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9861f, 0.8463f, 0.9939f, 0.7454f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9686f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9870f, 0.9941f, + 1.0000f, 0.9867f, 0.6766f, 1.0000f, 0.2518f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9644f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9912f, + 1.0000f, 0.9828f, 0.9712f, 1.0000f, 0.1163f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9707f, 0.9892f, + 1.0000f, 0.7190f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9978f, 0.9872f, + 1.0000f, 0.9214f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 0.9958f, + 1.0000f, 0.7808f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.9917f, 0.9536f, + 1.0000f, 0.9956f, 0.9610f, 0.8956f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9689f, 0.8605f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9977f, + 1.0000f, 0.9944f, 0.9244f, 0.7913f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9462f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9878f, + 1.0000f, 0.9874f, 0.7957f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9998f, + 1.0000f, 0.9226f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9947f, 0.9734f, + 1.0000f, 0.9555f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9848f, 0.8869f, + 1.0000f, 0.7709f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9914f, 0.9617f, 0.2949f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, 0.9285f, 0.2808f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9709f, 0.7126f, 0.4007f, + 1.0000f, 0.9995f, 0.9650f, 0.9031f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5987f, 1.0000f, 1.0000f, + 1.0000f, 0.9999f, 0.9803f, 0.9955f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8877f, 1.0000f, 1.0000f, + 1.0000f, 0.4113f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7492f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9704f, 0.9502f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9498f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9256f, 1.0000f, 1.0000f, 0.7334f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, + 1.0000f, 0.9935f, 1.0000f, 1.0000f, 0.0731f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9817f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0468f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9692f, 0.9959f, 0.9901f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9903f, 0.9997f, 0.9046f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.8441f, 0.6082f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9952f, 0.8270f, 0.8556f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8145f, 0.6606f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6713f, 0.9909f, 1.0000f, + 1.0000f, 0.9997f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 1.0000f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9904f, 1.0000f, 0.9695f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8979f, 0.4663f, 0.9060f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8386f, 0.7231f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0849f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4984f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_10x4[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8283f, 0.9411f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9911f, 1.0000f, 0.8198f, 0.8943f, 0.9580f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9666f, 0.9914f, 1.0000f, 0.8649f, 0.7945f, 0.3479f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9856f, 0.9971f, 1.0000f, 0.7514f, 0.7303f, 0.3081f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8956f, 0.9461f, 1.0000f, 0.7426f, 0.3814f, 0.2020f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9385f, 0.9530f, 0.9764f, 1.0000f, 0.6902f, 0.0741f, 0.6157f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9734f, 1.0000f, 1.0000f, 0.7894f, 0.8086f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9724f, 0.9930f, 1.0000f, 0.8017f, 0.8803f, 0.8262f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9377f, 0.9777f, 1.0000f, 0.7655f, 0.7131f, 0.3217f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9368f, 0.9485f, 0.8846f, 1.0000f, 0.7204f, 0.2192f, 0.2356f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8514f, 0.9082f, 1.0000f, 0.7237f, 0.1048f, 0.4972f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8633f, 0.7710f, 0.6434f, 1.0000f, 0.3704f, 0.1327f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9224f, 0.9768f, 1.0000f, 1.0000f, 0.5507f, 0.7736f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9672f, 0.9919f, 1.0000f, 0.5135f, 0.6036f, 0.5645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8696f, 0.8364f, 1.0000f, 0.6584f, 0.4134f, 0.1824f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8861f, 0.9172f, 0.8459f, 1.0000f, 0.6485f, 0.3593f, 0.5054f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8995f, 0.8177f, 0.4801f, 1.0000f, 0.0383f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7790f, 0.7816f, 0.2803f, 1.0000f, 0.1601f, 0.2510f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9816f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9117f, 0.9634f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9093f, 0.9685f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8421f, 0.8665f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9935f, + 1.0000f, 0.8383f, 0.9058f, 0.4236f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9937f, + 1.0000f, 0.8832f, 0.6727f, 0.2658f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9523f, 0.9828f, + 1.0000f, 0.6941f, 0.4888f, 0.3352f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9696f, 0.9845f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9963f, 0.9989f, 0.9966f, 1.0000f, 0.8727f, 0.8344f, 0.9331f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9995f, 0.9999f, 0.9627f, 1.0000f, 0.7919f, 0.9244f, 0.9284f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9842f, 0.9923f, 0.9895f, 1.0000f, 0.5780f, 0.8712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9678f, 0.9835f, 0.8817f, 1.0000f, 0.7683f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9293f, 0.8477f, 0.9139f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8601f, 0.9070f, 0.9350f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9983f, 0.9801f, 0.8773f, 1.0000f, 0.5911f, 0.7167f, 0.9500f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9982f, 0.9702f, 0.9394f, 1.0000f, 0.7056f, 0.8303f, 0.9477f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9641f, 0.7485f, 0.8681f, 1.0000f, 0.6632f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9214f, 0.9538f, 0.8440f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5435f, 0.7600f, 0.9234f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6215f, 0.9654f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9781f, 0.9849f, 0.9729f, 1.0000f, 0.4620f, 0.6327f, 0.9182f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9594f, 0.9749f, 0.8132f, 1.0000f, 0.5214f, 0.8916f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6381f, 0.7969f, 0.9552f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 0.7763f, 0.8742f, 0.9428f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, + 1.0000f, 0.4032f, 0.9033f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9881f, 0.9926f, 0.9956f, + 1.0000f, 0.7018f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9939f, 0.9045f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8617f, 0.9312f, 0.9608f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 1.0000f, + 1.0000f, 0.9785f, 0.9020f, 0.8888f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, + 1.0000f, 0.6773f, 0.9341f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9990f, 0.9906f, + 1.0000f, 0.8040f, 0.9322f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9988f, 0.9264f, + 1.0000f, 0.7270f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9793f, 0.9820f, 0.9508f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9690f, 0.9718f, 0.7572f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9965f, 0.9916f, 1.0000f, 0.9614f, 0.8402f, 0.6818f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9981f, 0.9921f, 0.9984f, 1.0000f, 0.9161f, 0.6981f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9986f, 0.9621f, 0.9573f, 1.0000f, 0.9105f, 0.9420f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9869f, 0.9444f, 0.6097f, 1.0000f, 0.5289f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9813f, 0.9566f, 0.8109f, 1.0000f, 0.9587f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9773f, 0.8567f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9878f, 0.9838f, 1.0000f, 0.9493f, 0.7456f, 0.9903f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9859f, 0.9852f, 0.9008f, 1.0000f, 0.9274f, 0.6861f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9809f, 0.8241f, 0.4433f, 1.0000f, 0.9303f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8929f, 0.7093f, 0.5576f, 1.0000f, 0.7397f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9759f, 0.7628f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9193f, 0.9128f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9872f, 0.9601f, 0.9150f, 1.0000f, 0.9453f, 0.7993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9739f, 0.9403f, 0.5712f, 1.0000f, 0.8902f, 0.9824f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9469f, 0.6535f, 0.7335f, 1.0000f, 0.9647f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9994f, + 1.0000f, 0.8532f, 0.2943f, 1.0000f, 1.0000f, 0.9955f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9990f, + 1.0000f, 0.9436f, 0.9901f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9713f, 0.9951f, + 1.0000f, 0.7868f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.9962f, 0.9975f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9797f, 0.9254f, 0.7543f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.9985f, + 1.0000f, 0.9545f, 0.8969f, 0.6271f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.9941f, + 1.0000f, 0.9660f, 0.4714f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9898f, 0.9974f, + 1.0000f, 0.8063f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9932f, 0.9887f, 0.9945f, + 1.0000f, 0.9707f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9893f, 0.9884f, 0.9754f, + 1.0000f, 0.8982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9890f, 0.8584f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9943f, 0.8323f, 0.5846f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9790f, 0.8495f, 0.8154f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5973f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8875f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6680f, 0.3923f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4527f, 0.9831f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4335f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9997f, 0.9996f, + 1.0000f, 0.7842f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9998f, 0.9947f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 1.0000f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 1.0000f, 0.9909f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9516f, 0.8758f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9928f, 0.9559f, 0.9359f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9862f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9805f, 0.9980f, 0.9949f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9866f, 0.9995f, 0.8550f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9203f, 0.5363f, 0.9744f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8220f, 0.7366f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8788f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9875f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_10x5[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8462f, 0.9403f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9942f, 1.0000f, 0.8593f, 0.9155f, 0.9673f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9628f, 0.9948f, 1.0000f, 0.8912f, 0.8324f, 0.4420f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9895f, 0.9959f, 1.0000f, 0.7946f, 0.7847f, 0.3829f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9332f, 0.9648f, 1.0000f, 0.7965f, 0.3746f, 0.2759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9547f, 0.9812f, 0.9758f, 1.0000f, 0.7256f, 0.0857f, 0.6373f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8371f, 0.9247f, 1.0000f, 0.6694f, 0.0608f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9051f, 0.8356f, 0.7286f, 1.0000f, 0.2660f, 0.5139f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9774f, 1.0000f, 1.0000f, 0.8133f, 0.8022f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9778f, 0.9926f, 1.0000f, 0.8240f, 0.8854f, 0.8387f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9450f, 0.9853f, 1.0000f, 0.8169f, 0.7423f, 0.3906f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9430f, 0.9541f, 0.8741f, 1.0000f, 0.7591f, 0.3143f, 0.4061f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8842f, 0.8753f, 1.0000f, 0.7614f, 0.1271f, 0.5615f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8418f, 0.7723f, 0.5785f, 1.0000f, 0.5261f, 0.1800f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8956f, 0.8096f, 0.6461f, 1.0000f, 0.4489f, 0.1966f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8151f, 0.7369f, 0.2098f, 1.0000f, 0.1456f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9346f, 0.9885f, 1.0000f, 1.0000f, 0.5322f, 0.7701f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9782f, 0.9950f, 1.0000f, 0.5014f, 0.5558f, 0.5947f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8967f, 0.8402f, 1.0000f, 0.6731f, 0.5728f, 0.2558f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9061f, 0.9198f, 0.8805f, 1.0000f, 0.7038f, 0.5078f, 0.6543f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9206f, 0.8307f, 0.3321f, 1.0000f, 0.6240f, 0.1081f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8115f, 0.7448f, 0.2857f, 1.0000f, 0.2954f, 0.5840f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, + 1.0000f, 0.8648f, 0.5500f, 0.1633f, 1.0000f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9530f, + 1.0000f, 0.7765f, 0.3662f, 0.5201f, 1.0000f, 0.0325f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9668f, 0.9602f, + 1.0000f, 1.0000f, 0.9173f, 0.9512f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9223f, 0.9575f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8830f, 0.9010f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, + 1.0000f, 0.8564f, 0.9181f, 0.4820f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, + 1.0000f, 0.9138f, 0.6836f, 0.2226f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9737f, 0.9976f, + 1.0000f, 0.7134f, 0.3233f, 0.4624f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9882f, 0.9936f, + 1.0000f, 0.7679f, 0.3050f, 0.4281f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9286f, 0.9697f, + 1.0000f, 0.6149f, 0.2340f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9481f, 0.9375f, 0.9271f, + 1.0000f, 0.9980f, 0.9996f, 0.9967f, 1.0000f, 0.8900f, 0.8448f, 0.9396f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9997f, 0.9998f, 0.9353f, 1.0000f, 0.8003f, 0.9309f, 0.9263f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9847f, 0.9947f, 0.9934f, 1.0000f, 0.6938f, 0.9190f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9524f, 0.9832f, 0.8817f, 1.0000f, 0.8688f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9071f, 0.8978f, 0.9687f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8550f, 0.9653f, 0.9437f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6102f, 0.8274f, 0.9710f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7165f, 0.9732f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9972f, 0.9798f, 0.8578f, 1.0000f, 0.6329f, 0.7315f, 0.9741f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9992f, 0.9728f, 0.9214f, 1.0000f, 0.7342f, 0.8040f, 0.9607f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9597f, 0.7658f, 0.8701f, 1.0000f, 0.7545f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9443f, 0.9518f, 0.8675f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4210f, 0.8187f, 0.9020f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7070f, 0.9558f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6051f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8634f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9815f, 0.9908f, 0.9724f, 1.0000f, 0.3492f, 0.6194f, 0.9147f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9536f, 0.9766f, 0.7984f, 1.0000f, 0.4885f, 0.8989f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6619f, 0.8291f, 0.9317f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 0.7867f, 0.8999f, 0.9719f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.5999f, 0.8792f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9999f, 0.9996f, + 1.0000f, 0.7786f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9994f, 0.9924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9754f, 0.9879f, 0.9361f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9838f, 0.8477f, + 1.0000f, 0.8661f, 0.9324f, 0.9638f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 1.0000f, + 1.0000f, 0.9828f, 0.9110f, 0.9041f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9995f, + 1.0000f, 0.7102f, 0.9658f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9987f, 0.9906f, + 1.0000f, 0.8506f, 0.9678f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9989f, 0.9031f, + 1.0000f, 0.6657f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9868f, 0.9922f, 0.9871f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9581f, 0.9887f, 0.8521f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9801f, 0.7907f, 0.8059f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9475f, 0.9129f, 0.8223f, + 1.0000f, 1.0000f, 0.9919f, 0.9978f, 1.0000f, 0.9570f, 0.8621f, 0.7397f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9954f, 0.9986f, 0.9962f, 1.0000f, 0.9382f, 0.7497f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9961f, 0.9663f, 0.9618f, 1.0000f, 0.9231f, 0.9706f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9862f, 0.9456f, 0.5672f, 1.0000f, 0.6285f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9794f, 0.8779f, 0.5894f, 1.0000f, 0.8934f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8923f, 0.6971f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9715f, 0.8866f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9643f, 0.9633f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9930f, 0.9873f, 1.0000f, 0.9494f, 0.7636f, 0.9971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9805f, 0.9850f, 0.9424f, 1.0000f, 0.9368f, 0.7568f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9856f, 0.8078f, 0.3407f, 1.0000f, 0.9417f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9091f, 0.7226f, 0.5382f, 1.0000f, 0.7521f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9279f, 0.4139f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7926f, 0.7005f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9469f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8727f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9901f, 0.9701f, 0.9294f, 1.0000f, 0.9389f, 0.7807f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9819f, 0.9302f, 0.6503f, 1.0000f, 0.8945f, 0.9915f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, + 1.0000f, 0.9488f, 0.6870f, 0.7473f, 1.0000f, 0.9750f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9994f, + 1.0000f, 0.8766f, 0.2451f, 1.0000f, 1.0000f, 0.9945f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9990f, + 1.0000f, 0.8714f, 0.9120f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9932f, 0.9966f, + 1.0000f, 0.4351f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9997f, 0.9993f, + 1.0000f, 0.9623f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9844f, 0.9890f, + 1.0000f, 0.9876f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9745f, 0.9903f, 0.9822f, + 1.0000f, 0.9898f, 0.9506f, 0.7887f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9955f, + 1.0000f, 0.9586f, 0.9081f, 0.6801f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9893f, + 1.0000f, 0.9591f, 0.4950f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9958f, + 1.0000f, 0.8607f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9865f, 0.9911f, + 1.0000f, 0.9339f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.9770f, 0.9564f, + 1.0000f, 0.6418f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9808f, 0.9762f, 0.6581f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9917f, 0.9683f, 0.9101f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9835f, 0.9612f, 0.9553f, + 1.0000f, 0.9963f, 0.8340f, 0.5442f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9825f, 0.8205f, 0.8257f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3577f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7744f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6904f, 0.3984f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4690f, 0.9790f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4557f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9991f, 0.9973f, + 1.0000f, 0.8433f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9999f, 0.9993f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 1.0000f, 0.9859f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9410f, 0.7827f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 0.9239f, 0.9463f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9692f, 0.8878f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8889f, 0.9928f, 1.0000f, + 1.0000f, 0.9975f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9841f, 0.9974f, 0.9913f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9786f, 0.9984f, 0.8492f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9255f, 0.4755f, 0.9164f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8535f, 0.7196f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6766f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9500f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_10x6[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8941f, 0.9467f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8379f, 0.9490f, + 1.0000f, 1.0000f, 1.0000f, 0.9941f, 1.0000f, 0.8989f, 0.9438f, 0.9693f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8151f, 0.9709f, + 1.0000f, 1.0000f, 0.9775f, 0.9933f, 1.0000f, 0.9080f, 0.8642f, 0.4327f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9163f, 0.8850f, + 1.0000f, 1.0000f, 0.9867f, 0.9931f, 1.0000f, 0.8135f, 0.7809f, 0.4020f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9368f, 0.9362f, 0.9130f, + 1.0000f, 1.0000f, 0.9517f, 0.9765f, 1.0000f, 0.8240f, 0.4618f, 0.4733f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9355f, 0.8951f, 0.6674f, + 1.0000f, 0.9665f, 0.9847f, 0.9792f, 1.0000f, 0.7557f, 0.1083f, 0.7349f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8352f, 0.8595f, 0.5053f, + 1.0000f, 1.0000f, 0.9245f, 0.9223f, 1.0000f, 0.7599f, 0.0550f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8419f, 0.5920f, 0.1947f, + 1.0000f, 0.9147f, 0.8338f, 0.6978f, 1.0000f, 0.3094f, 0.3954f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7977f, 0.4386f, 0.5523f, + 1.0000f, 1.0000f, 1.0000f, 0.9862f, 1.0000f, 1.0000f, 0.8406f, 0.8392f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9876f, 0.9902f, 1.0000f, 0.8509f, 0.9097f, 0.8458f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9568f, 0.9839f, 1.0000f, 0.8269f, 0.7827f, 0.4145f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9578f, 0.9614f, 0.8471f, 1.0000f, 0.7736f, 0.3680f, 0.4444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8764f, 0.8742f, 1.0000f, 0.7679f, 0.1488f, 0.6830f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8687f, 0.7698f, 0.5151f, 1.0000f, 0.5568f, 0.2373f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9266f, 0.7945f, 0.5747f, 1.0000f, 0.5339f, 0.2167f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7912f, 0.6891f, 0.2565f, 1.0000f, 0.0936f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9528f, 0.9936f, 0.7844f, 1.0000f, 0.5293f, 0.7536f, 0.2275f, 1.0000f, 1.0000f, 1.0000f, 0.7063f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9824f, 0.9957f, 0.6204f, 0.5386f, 0.5432f, 0.5703f, 0.1226f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9017f, 0.8497f, 0.7324f, 0.6769f, 0.5792f, 0.3172f, 0.1722f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9062f, 0.9230f, 0.8432f, 0.3542f, 0.7035f, 0.5003f, 0.6920f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9315f, 0.8283f, 0.3817f, 0.7274f, 0.6044f, 0.1606f, 1.0000f, 0.5878f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8041f, 0.7660f, 0.3471f, 0.0336f, 0.4082f, 0.6706f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, + 1.0000f, 0.8891f, 0.4790f, 0.1362f, 0.5199f, 0.6243f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9950f, + 1.0000f, 0.7755f, 0.2752f, 0.4902f, 0.1835f, 0.0761f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9939f, 0.9989f, + 1.0000f, 1.0000f, 0.9450f, 0.9724f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9381f, 0.9750f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8709f, 0.8970f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, + 1.0000f, 0.8365f, 0.9294f, 0.4267f, 0.6125f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, + 1.0000f, 0.9122f, 0.7199f, 0.3248f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9681f, 0.9942f, + 1.0000f, 0.7299f, 0.3886f, 0.6003f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9919f, 0.9975f, + 1.0000f, 0.8057f, 0.2472f, 0.4502f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9632f, 0.9869f, + 1.0000f, 0.6575f, 0.2842f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9661f, 0.9786f, 0.9252f, + 1.0000f, 0.9972f, 0.9986f, 0.9974f, 1.0000f, 0.9106f, 0.8653f, 0.9601f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9677f, 0.9697f, 0.9088f, + 1.0000f, 0.9996f, 0.9996f, 0.9419f, 1.0000f, 0.8181f, 0.9501f, 0.9685f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9689f, 0.9507f, 0.6541f, + 1.0000f, 0.9779f, 0.9954f, 0.9849f, 1.0000f, 0.7172f, 0.9201f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7468f, 0.7249f, 0.9208f, + 1.0000f, 0.9259f, 0.9815f, 0.8484f, 1.0000f, 0.8829f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7862f, 0.8775f, 0.9799f, + 1.0000f, 0.9114f, 0.9139f, 0.9743f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6506f, 0.9705f, 1.0000f, + 1.0000f, 0.8618f, 0.9739f, 0.9444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8166f, 1.0000f, 1.0000f, + 1.0000f, 0.5613f, 0.9193f, 0.9563f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7619f, 0.9890f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9980f, 0.9818f, 0.8607f, 1.0000f, 0.6471f, 0.7444f, 0.9645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9991f, 0.9736f, 0.9321f, 1.0000f, 0.7224f, 0.8254f, 0.9720f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9479f, 0.7491f, 0.8311f, 1.0000f, 0.7928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9186f, 0.9280f, 0.8445f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4206f, 0.8676f, 0.9301f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7397f, 0.9809f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6949f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8009f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9864f, 0.9881f, 0.9747f, 1.0000f, 0.3611f, 0.6164f, 0.9155f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9636f, 0.9758f, 0.8025f, 1.0000f, 0.4676f, 0.8839f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6359f, 0.8088f, 0.9335f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, + 1.0000f, 0.7718f, 0.8931f, 0.9673f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9999f, + 1.0000f, 0.6642f, 0.9071f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9998f, 0.9996f, + 1.0000f, 0.8120f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9998f, 0.9926f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9963f, 0.9754f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9955f, 0.9796f, + 1.0000f, 0.8797f, 0.9400f, 0.9619f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 1.0000f, + 1.0000f, 0.9812f, 0.9216f, 0.9170f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9997f, + 1.0000f, 0.7007f, 0.9653f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9976f, 0.9649f, + 1.0000f, 0.8583f, 0.9554f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9969f, 0.8731f, + 1.0000f, 0.7090f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9859f, 0.9923f, 0.9914f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9549f, 0.9896f, 0.8786f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9802f, 0.8522f, 0.8818f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9713f, 0.9582f, 0.9407f, + 1.0000f, 1.0000f, 0.9885f, 0.9894f, 1.0000f, 0.9761f, 0.9008f, 0.7792f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9806f, 0.9640f, 0.9878f, + 1.0000f, 0.9986f, 0.9953f, 0.9995f, 1.0000f, 0.9610f, 0.8104f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9833f, 0.9830f, 0.9237f, + 1.0000f, 0.9982f, 0.9308f, 0.9432f, 1.0000f, 0.9461f, 0.9728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9904f, 0.9539f, 0.9944f, + 1.0000f, 0.9605f, 0.9596f, 0.3748f, 1.0000f, 0.6609f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9821f, 0.8860f, 1.0000f, + 1.0000f, 0.9857f, 0.8807f, 0.4560f, 1.0000f, 0.9026f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9425f, 0.9929f, 1.0000f, + 1.0000f, 0.9035f, 0.6435f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9394f, 1.0000f, 1.0000f, + 1.0000f, 0.9836f, 0.6861f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9732f, 1.0000f, 1.0000f, + 1.0000f, 0.8961f, 0.8559f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9883f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9912f, 0.9906f, 1.0000f, 0.9669f, 0.8225f, 0.9989f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9717f, 0.9947f, 0.9388f, 1.0000f, 0.9473f, 0.8210f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9841f, 0.7961f, 0.2929f, 1.0000f, 0.9484f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8881f, 0.7118f, 0.4846f, 1.0000f, 0.7640f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9178f, 0.3324f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7578f, 0.6321f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9273f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6397f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9967f, 0.9827f, 0.9533f, 1.0000f, 0.9455f, 0.7878f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9844f, 0.9558f, 0.6800f, 1.0000f, 0.9044f, 0.9921f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, + 1.0000f, 0.9623f, 0.6738f, 0.7513f, 1.0000f, 0.9701f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9999f, + 1.0000f, 0.8921f, 0.2659f, 1.0000f, 1.0000f, 0.9928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9959f, 0.9978f, + 1.0000f, 0.8698f, 0.8325f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9887f, 0.9979f, + 1.0000f, 0.3399f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9980f, 0.9999f, + 1.0000f, 0.8911f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9918f, 0.9988f, + 1.0000f, 0.9348f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9892f, 0.9958f, 0.9910f, + 1.0000f, 0.9852f, 0.9328f, 0.8534f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 0.9992f, + 1.0000f, 0.9544f, 0.9342f, 0.7421f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.9871f, + 1.0000f, 0.9587f, 0.4953f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9900f, 0.9934f, + 1.0000f, 0.8571f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9854f, 0.9925f, 0.9874f, + 1.0000f, 0.9053f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9496f, 0.9768f, + 1.0000f, 0.5246f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9657f, 0.9573f, 0.5962f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 0.9627f, 0.7895f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9772f, 0.8998f, 0.8980f, + 1.0000f, 0.9966f, 0.8547f, 0.6085f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8753f, 1.0000f, 1.0000f, + 1.0000f, 0.9916f, 0.7993f, 0.8630f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9523f, 1.0000f, 1.0000f, + 1.0000f, 0.2057f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7145f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7373f, 0.5103f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5835f, 0.9782f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5478f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9990f, + 1.0000f, 0.8720f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, 0.9961f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9997f, 0.9984f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.9999f, 0.9789f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9592f, 0.8072f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9413f, 0.9512f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9375f, 0.8871f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8195f, 0.9988f, 1.0000f, + 1.0000f, 0.9985f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9898f, 0.9993f, 0.9951f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9908f, 0.9993f, 0.8297f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8665f, 0.3015f, 0.8901f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7773f, 0.5658f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6282f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9287f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_10x8[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9515f, 0.9479f, 1.0000f, 1.0000f, 0.8697f, 0.8771f, 1.0000f, 1.0000f, 0.9852f, 0.9958f, + 1.0000f, 1.0000f, 1.0000f, 0.9911f, 1.0000f, 0.9611f, 0.9295f, 0.9716f, 1.0000f, 0.8951f, 0.9092f, 0.9403f, 1.0000f, 1.0000f, 0.9972f, 0.9990f, + 1.0000f, 1.0000f, 0.9844f, 0.9969f, 1.0000f, 0.9664f, 0.9466f, 0.6276f, 1.0000f, 0.9493f, 0.9133f, 0.7285f, 1.0000f, 1.0000f, 0.9671f, 0.9099f, + 1.0000f, 1.0000f, 0.9965f, 0.9962f, 1.0000f, 0.9506f, 0.8726f, 0.6061f, 1.0000f, 0.8687f, 0.8894f, 0.5709f, 1.0000f, 0.9763f, 0.9710f, 0.9254f, + 1.0000f, 1.0000f, 0.9651f, 0.9654f, 1.0000f, 0.9339f, 0.6408f, 0.6024f, 1.0000f, 0.8967f, 0.7477f, 0.4102f, 1.0000f, 0.9697f, 0.9447f, 0.6344f, + 1.0000f, 0.9838f, 0.9908f, 0.9749f, 1.0000f, 0.8789f, 0.2292f, 0.8488f, 1.0000f, 0.9085f, 0.4279f, 0.9377f, 1.0000f, 0.9323f, 0.8919f, 0.5870f, + 1.0000f, 1.0000f, 0.9489f, 0.9408f, 1.0000f, 0.8587f, 0.0655f, 1.0000f, 1.0000f, 0.8077f, 0.1170f, 1.0000f, 1.0000f, 0.9272f, 0.5831f, 0.2550f, + 1.0000f, 0.9497f, 0.8762f, 0.6703f, 1.0000f, 0.5236f, 0.5095f, 1.0000f, 1.0000f, 0.6501f, 0.6867f, 1.0000f, 1.0000f, 0.8943f, 0.3798f, 0.6470f, + 1.0000f, 1.0000f, 1.0000f, 0.9858f, 1.0000f, 1.0000f, 0.9397f, 0.8885f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9925f, 0.9871f, + 1.0000f, 1.0000f, 0.9879f, 0.9977f, 1.0000f, 0.9532f, 0.9427f, 0.8477f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9890f, 0.9784f, + 1.0000f, 1.0000f, 0.9647f, 0.9866f, 1.0000f, 0.9192f, 0.8807f, 0.5458f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9248f, 0.9260f, + 1.0000f, 0.9792f, 0.9856f, 0.8618f, 1.0000f, 0.9113f, 0.5750f, 0.5909f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9502f, 0.9644f, 0.6136f, + 1.0000f, 1.0000f, 0.9355f, 0.8735f, 1.0000f, 0.8911f, 0.3399f, 0.7919f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9722f, 0.8576f, 0.4565f, + 1.0000f, 0.9328f, 0.8179f, 0.5142f, 1.0000f, 0.7394f, 0.3860f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8466f, 0.5281f, 0.6098f, + 1.0000f, 0.9626f, 0.8454f, 0.5500f, 1.0000f, 0.7352f, 0.3026f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9140f, 0.3179f, 0.4941f, + 1.0000f, 0.8975f, 0.7239f, 0.3255f, 1.0000f, 0.2379f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7670f, 0.2871f, 1.0000f, + 1.0000f, 1.0000f, 0.9746f, 0.9918f, 0.9035f, 1.0000f, 0.7019f, 0.8062f, 0.1283f, 1.0000f, 1.0000f, 1.0000f, 0.5326f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9875f, 0.9948f, 0.6787f, 0.6618f, 0.6439f, 0.5627f, 0.1819f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9688f, 0.8716f, 0.8311f, 0.8016f, 0.7216f, 0.3922f, 0.1716f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9731f, 0.9553f, 0.8834f, 0.4337f, 0.8780f, 0.5948f, 0.6994f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9528f, 0.9160f, 0.4620f, 0.8407f, 0.7069f, 0.3103f, 1.0000f, 0.4162f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9078f, 0.8207f, 0.4220f, 0.0000f, 0.6731f, 0.6892f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9936f, + 1.0000f, 0.8998f, 0.5542f, 0.2015f, 0.7779f, 0.6841f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, + 1.0000f, 0.8648f, 0.2948f, 0.5044f, 0.1610f, 0.1052f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9991f, + 1.0000f, 1.0000f, 0.9725f, 0.9787f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9771f, 0.9577f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9371f, 0.9361f, 0.0921f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, + 1.0000f, 0.9585f, 0.9737f, 0.6207f, 0.6171f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9898f, + 1.0000f, 0.9704f, 0.8544f, 0.4837f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9903f, 0.9991f, + 1.0000f, 0.8565f, 0.4784f, 0.7118f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9942f, 0.9949f, + 1.0000f, 0.9020f, 0.3470f, 0.5415f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9850f, 0.9932f, + 1.0000f, 0.7968f, 0.4509f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9896f, 0.9909f, 0.9071f, + 1.0000f, 0.9987f, 0.9993f, 0.9974f, 1.0000f, 0.9027f, 0.8668f, 0.9565f, 1.0000f, 0.8860f, 0.7436f, 0.7576f, 1.0000f, 0.9959f, 0.9947f, 0.9829f, + 1.0000f, 0.9997f, 0.9999f, 0.9545f, 1.0000f, 0.8431f, 0.9413f, 0.9811f, 1.0000f, 0.8107f, 0.7537f, 0.7633f, 1.0000f, 0.9864f, 0.9929f, 0.8744f, + 1.0000f, 0.9604f, 0.9867f, 0.9827f, 1.0000f, 0.8032f, 0.9470f, 1.0000f, 1.0000f, 0.6560f, 0.9678f, 1.0000f, 1.0000f, 0.7652f, 0.8877f, 0.9774f, + 1.0000f, 0.9064f, 0.9755f, 0.8359f, 1.0000f, 0.9127f, 1.0000f, 1.0000f, 1.0000f, 0.7832f, 1.0000f, 1.0000f, 1.0000f, 0.8607f, 0.9596f, 0.9880f, + 1.0000f, 0.8658f, 0.8816f, 0.9622f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7814f, 0.9510f, 1.0000f, + 1.0000f, 0.8273f, 0.9713f, 0.9461f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9289f, 1.0000f, 1.0000f, + 1.0000f, 0.5189f, 0.9179f, 0.9728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8193f, 0.9719f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9982f, 0.9834f, 0.8851f, 1.0000f, 0.6531f, 0.7498f, 0.9278f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9317f, 0.9456f, 0.9437f, + 1.0000f, 0.9985f, 0.9707f, 0.9283f, 1.0000f, 0.7518f, 0.8165f, 0.9825f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9877f, 0.9056f, 0.8959f, + 1.0000f, 0.9418f, 0.7743f, 0.8522f, 1.0000f, 0.8511f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7143f, 0.9049f, 1.0000f, + 1.0000f, 0.9366f, 0.9387f, 0.9266f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8335f, 0.9782f, 1.0000f, + 1.0000f, 0.3329f, 0.7984f, 0.9350f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8868f, 1.0000f, 1.0000f, + 1.0000f, 0.7191f, 0.9212f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7761f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7952f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9891f, 0.9807f, 0.9740f, 0.8047f, 0.3669f, 0.5585f, 0.9224f, 0.0517f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9619f, 0.9789f, 0.8323f, 0.4043f, 0.4452f, 0.8419f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7093f, 0.8707f, 0.9700f, 0.8500f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.8260f, 0.9186f, 0.9823f, 0.0191f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.7167f, 0.9005f, 1.0000f, 0.6814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, 0.9975f, + 1.0000f, 0.8628f, 1.0000f, 1.0000f, 0.1918f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9997f, 0.9752f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0789f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9983f, 0.9640f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9927f, 0.9818f, + 1.0000f, 0.9106f, 0.9475f, 0.9573f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 1.0000f, + 1.0000f, 0.9884f, 0.9334f, 0.9382f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 0.7689f, 0.9684f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9964f, 0.9536f, + 1.0000f, 0.8935f, 0.9779f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9966f, 0.9943f, 0.8122f, + 1.0000f, 0.7797f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9588f, 0.9848f, 0.9694f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9218f, 0.9681f, 0.8247f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9557f, 0.8371f, 0.8983f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9561f, 0.9600f, 0.9312f, + 1.0000f, 1.0000f, 0.9963f, 0.9995f, 1.0000f, 0.9901f, 0.8753f, 0.8234f, 1.0000f, 0.9941f, 0.9766f, 0.8843f, 1.0000f, 0.9967f, 0.9893f, 0.9809f, + 1.0000f, 0.9995f, 0.9989f, 0.9980f, 1.0000f, 0.9630f, 0.8220f, 1.0000f, 1.0000f, 0.9913f, 0.9120f, 1.0000f, 1.0000f, 0.9920f, 0.9944f, 0.8298f, + 1.0000f, 0.9973f, 0.9983f, 0.9523f, 1.0000f, 0.9840f, 0.9804f, 1.0000f, 1.0000f, 0.9873f, 0.9888f, 1.0000f, 1.0000f, 0.9970f, 0.8555f, 0.9661f, + 1.0000f, 0.9935f, 0.9820f, 0.4675f, 1.0000f, 0.7308f, 1.0000f, 1.0000f, 1.0000f, 0.9344f, 1.0000f, 1.0000f, 1.0000f, 0.9836f, 0.6918f, 1.0000f, + 1.0000f, 0.9906f, 0.9013f, 0.2200f, 1.0000f, 0.9166f, 1.0000f, 1.0000f, 1.0000f, 0.9882f, 1.0000f, 1.0000f, 1.0000f, 0.9675f, 0.8902f, 1.0000f, + 1.0000f, 0.9423f, 0.5371f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6590f, 1.0000f, 1.0000f, + 1.0000f, 0.9842f, 0.4889f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9236f, 1.0000f, 1.0000f, + 1.0000f, 0.9042f, 0.5986f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7867f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9979f, 0.9956f, 1.0000f, 0.9895f, 0.8136f, 0.9760f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9869f, 0.9933f, 0.9242f, + 1.0000f, 0.9965f, 0.9984f, 0.9569f, 1.0000f, 0.9549f, 0.7884f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9928f, 0.9581f, 0.8383f, + 1.0000f, 0.9432f, 0.9153f, 0.3536f, 1.0000f, 0.9776f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.7707f, 1.0000f, + 1.0000f, 0.9633f, 0.7557f, 0.4993f, 1.0000f, 0.7614f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9484f, 1.0000f, 1.0000f, + 1.0000f, 0.9886f, 0.2465f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9658f, 1.0000f, 1.0000f, + 1.0000f, 0.8347f, 0.3603f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6969f, 1.0000f, 1.0000f, + 1.0000f, 0.9607f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2712f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9757f, 0.9905f, 0.9637f, 0.7902f, 0.9592f, 0.6376f, 1.0000f, 0.6241f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9900f, 0.9831f, 0.7849f, 0.1502f, 0.8443f, 0.9768f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 0.9854f, 0.7457f, 0.8597f, 0.5791f, 0.9147f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9997f, + 1.0000f, 0.9519f, 0.3733f, 1.0000f, 0.2792f, 0.9916f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 0.9998f, + 1.0000f, 0.9691f, 0.6943f, 1.0000f, 0.0378f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.9999f, + 1.0000f, 0.3982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9985f, 1.0000f, + 1.0000f, 0.8798f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, 0.9968f, + 1.0000f, 0.6759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9799f, 0.9975f, 0.9937f, + 1.0000f, 0.9971f, 0.9734f, 0.8927f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9917f, + 1.0000f, 0.9860f, 0.9300f, 0.8151f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, 0.9921f, + 1.0000f, 0.9802f, 0.6310f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, 0.9996f, + 1.0000f, 0.8825f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9986f, 0.9797f, + 1.0000f, 0.9451f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9931f, 0.9668f, + 1.0000f, 0.4730f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9952f, 0.9743f, 0.4395f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9615f, 0.6647f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9794f, 0.8286f, 0.7373f, + 1.0000f, 0.9981f, 0.9306f, 0.7595f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7725f, 1.0000f, 1.0000f, + 1.0000f, 0.9950f, 0.9230f, 0.9816f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9846f, 1.0000f, 1.0000f, + 1.0000f, 0.1394f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6675f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8395f, 0.7330f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7263f, 0.9914f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7044f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9998f, 0.9990f, + 1.0000f, 0.8990f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9814f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9923f, 0.9998f, 0.9988f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.9994f, 0.9540f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9392f, 0.8000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9442f, 0.9205f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9173f, 0.8638f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8092f, 0.9994f, 1.0000f, + 1.0000f, 0.9976f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 0.9995f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9862f, 0.9987f, 0.9199f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8678f, 0.2109f, 0.8533f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7936f, 0.5668f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2632f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7415f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_10x10[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9686f, 0.9633f, 1.0000f, 1.0000f, 0.9876f, 0.9703f, 1.0000f, 1.0000f, 0.9951f, 0.9984f, + 1.0000f, 1.0000f, 1.0000f, 0.9987f, 1.0000f, 0.9597f, 0.9643f, 0.9819f, 1.0000f, 0.9912f, 0.9804f, 0.9869f, 1.0000f, 1.0000f, 0.9981f, 0.9988f, + 1.0000f, 1.0000f, 0.9866f, 0.9992f, 1.0000f, 0.9719f, 0.9513f, 0.6842f, 1.0000f, 0.9677f, 0.9562f, 0.6732f, 1.0000f, 1.0000f, 0.9855f, 0.8914f, + 1.0000f, 1.0000f, 0.9976f, 0.9965f, 1.0000f, 0.9489f, 0.9125f, 0.6280f, 1.0000f, 0.9555f, 0.9218f, 0.5776f, 1.0000f, 0.9848f, 0.9797f, 0.9019f, + 1.0000f, 1.0000f, 0.9722f, 0.9737f, 1.0000f, 0.9587f, 0.7179f, 0.6996f, 1.0000f, 0.9485f, 0.6921f, 0.6084f, 1.0000f, 0.9680f, 0.9464f, 0.5482f, + 1.0000f, 0.9928f, 0.9888f, 0.9630f, 1.0000f, 0.9316f, 0.3859f, 0.9151f, 1.0000f, 0.9447f, 0.3221f, 0.8991f, 1.0000f, 0.9326f, 0.8735f, 0.5210f, + 1.0000f, 1.0000f, 0.9365f, 0.9047f, 1.0000f, 0.8590f, 0.1201f, 1.0000f, 1.0000f, 0.8610f, 0.0462f, 1.0000f, 1.0000f, 0.9540f, 0.5048f, 0.2354f, + 1.0000f, 0.9551f, 0.8452f, 0.5669f, 1.0000f, 0.6051f, 0.6704f, 1.0000f, 1.0000f, 0.5983f, 0.6150f, 1.0000f, 1.0000f, 0.8866f, 0.3154f, 0.5406f, + 1.0000f, 1.0000f, 1.0000f, 0.9933f, 1.0000f, 1.0000f, 0.9700f, 0.8930f, 1.0000f, 1.0000f, 0.9765f, 0.9073f, 1.0000f, 1.0000f, 0.9902f, 0.9934f, + 1.0000f, 1.0000f, 0.9981f, 0.9982f, 1.0000f, 0.9750f, 0.9306f, 0.8620f, 1.0000f, 0.9620f, 0.9649f, 0.9113f, 1.0000f, 1.0000f, 0.9873f, 0.9878f, + 1.0000f, 1.0000f, 0.9914f, 0.9909f, 1.0000f, 0.9438f, 0.9067f, 0.5915f, 1.0000f, 0.9614f, 0.9212f, 0.6344f, 1.0000f, 1.0000f, 0.9509f, 0.9341f, + 1.0000f, 0.9852f, 0.9853f, 0.8669f, 1.0000f, 0.9356f, 0.5949f, 0.6407f, 1.0000f, 0.9346f, 0.6376f, 0.4882f, 1.0000f, 0.9729f, 0.9817f, 0.6647f, + 1.0000f, 1.0000f, 0.9573f, 0.9224f, 1.0000f, 0.9274f, 0.4705f, 0.8707f, 1.0000f, 0.9403f, 0.4174f, 0.8396f, 1.0000f, 0.9793f, 0.8539f, 0.5595f, + 1.0000f, 0.9601f, 0.8529f, 0.5705f, 1.0000f, 0.8121f, 0.5007f, 1.0000f, 1.0000f, 0.8227f, 0.3286f, 1.0000f, 1.0000f, 0.9005f, 0.4838f, 0.7513f, + 1.0000f, 0.9580f, 0.8753f, 0.4567f, 1.0000f, 0.7422f, 0.4275f, 1.0000f, 1.0000f, 0.8005f, 0.2434f, 1.0000f, 1.0000f, 0.9144f, 0.3582f, 0.6117f, + 1.0000f, 0.8841f, 0.6788f, 0.2513f, 1.0000f, 0.3348f, 1.0000f, 1.0000f, 1.0000f, 0.2949f, 1.0000f, 1.0000f, 1.0000f, 0.8093f, 0.4613f, 1.0000f, + 1.0000f, 1.0000f, 0.9864f, 0.9965f, 0.8998f, 1.0000f, 0.7243f, 0.8107f, 0.0803f, 1.0000f, 0.7755f, 0.8807f, 0.4324f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9950f, 0.9978f, 0.6895f, 0.7113f, 0.7020f, 0.5330f, 0.1295f, 0.7285f, 0.8149f, 0.7201f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9716f, 0.9012f, 0.8314f, 0.8162f, 0.7403f, 0.4018f, 0.1665f, 0.8953f, 0.7566f, 0.3912f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9826f, 0.9683f, 0.9087f, 0.4518f, 0.8983f, 0.5740f, 0.7068f, 1.0000f, 0.8882f, 0.6815f, 0.6676f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9697f, 0.9468f, 0.5558f, 0.8507f, 0.7495f, 0.3965f, 1.0000f, 0.4659f, 0.8350f, 0.2666f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9434f, 0.8815f, 0.5520f, 0.0320f, 0.7157f, 0.7929f, 1.0000f, 1.0000f, 0.7477f, 0.7804f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, + 1.0000f, 0.9501f, 0.5129f, 0.2591f, 0.7670f, 0.6869f, 1.0000f, 1.0000f, 1.0000f, 0.7601f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 0.9157f, 0.3086f, 0.5089f, 0.2273f, 0.1008f, 1.0000f, 1.0000f, 1.0000f, 0.1575f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9998f, + 1.0000f, 1.0000f, 0.9782f, 0.9947f, 0.3018f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9861f, 0.9815f, 0.6439f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9533f, 0.9300f, 0.2022f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, + 1.0000f, 0.9694f, 0.9476f, 0.6589f, 0.6500f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, + 1.0000f, 0.9832f, 0.8922f, 0.5632f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9925f, 0.9988f, + 1.0000f, 0.9033f, 0.5170f, 0.7771f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9944f, + 1.0000f, 0.8824f, 0.3804f, 0.6469f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9953f, 0.9770f, + 1.0000f, 0.8290f, 0.5291f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9921f, 0.8798f, + 1.0000f, 0.9995f, 0.9992f, 0.9980f, 1.0000f, 0.9230f, 0.8849f, 0.9590f, 1.0000f, 0.9375f, 0.8938f, 0.9370f, 1.0000f, 0.9952f, 0.9968f, 0.9891f, + 1.0000f, 0.9998f, 0.9999f, 0.9623f, 1.0000f, 0.8640f, 0.9493f, 0.9881f, 1.0000f, 0.9163f, 0.9521f, 0.9779f, 1.0000f, 0.9857f, 0.9874f, 0.8890f, + 1.0000f, 0.9529f, 0.9871f, 0.9802f, 1.0000f, 0.8078f, 0.9544f, 1.0000f, 1.0000f, 0.8049f, 0.9442f, 1.0000f, 1.0000f, 0.7091f, 0.8906f, 0.9671f, + 1.0000f, 0.9206f, 0.9652f, 0.8302f, 1.0000f, 0.9175f, 1.0000f, 1.0000f, 1.0000f, 0.9040f, 1.0000f, 1.0000f, 1.0000f, 0.8408f, 0.9336f, 0.9905f, + 1.0000f, 0.9026f, 0.8833f, 0.9784f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7531f, 0.9407f, 1.0000f, + 1.0000f, 0.8580f, 0.9611f, 0.9774f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8961f, 1.0000f, 1.0000f, + 1.0000f, 0.3694f, 0.8697f, 0.9674f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7548f, 0.9384f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9986f, 0.9900f, 0.8968f, 1.0000f, 0.7044f, 0.7787f, 0.9517f, 1.0000f, 0.7975f, 0.7738f, 0.9060f, 1.0000f, 0.9295f, 0.9662f, 0.9760f, + 1.0000f, 0.9985f, 0.9788f, 0.9351f, 1.0000f, 0.7459f, 0.8189f, 0.9899f, 1.0000f, 0.8385f, 0.8560f, 0.9927f, 1.0000f, 0.9859f, 0.9451f, 0.9813f, + 1.0000f, 0.9398f, 0.7653f, 0.8486f, 1.0000f, 0.8762f, 1.0000f, 1.0000f, 1.0000f, 0.8550f, 1.0000f, 1.0000f, 1.0000f, 0.7990f, 0.9862f, 1.0000f, + 1.0000f, 0.9188f, 0.9268f, 0.9119f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9235f, 0.9923f, 1.0000f, + 1.0000f, 0.3638f, 0.8497f, 0.9668f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9194f, 1.0000f, 1.0000f, + 1.0000f, 0.7721f, 0.9481f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7346f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7704f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9916f, 0.9926f, 0.9742f, 0.8201f, 0.3525f, 0.5368f, 0.9252f, 0.1389f, 0.6017f, 0.5846f, 0.9800f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9692f, 0.9834f, 0.8570f, 0.4373f, 0.4071f, 0.8277f, 1.0000f, 1.0000f, 0.6312f, 0.8326f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7135f, 0.8858f, 0.9594f, 0.8362f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.8430f, 0.9389f, 0.9836f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, + 1.0000f, 0.8020f, 0.9460f, 1.0000f, 0.7306f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9995f, 0.9964f, + 1.0000f, 0.9285f, 1.0000f, 1.0000f, 0.2108f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9655f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0909f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9918f, 0.9200f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9830f, 0.9607f, + 1.0000f, 0.9290f, 0.9421f, 0.9604f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 0.9828f, 0.9246f, 0.9525f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.7851f, 0.9734f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9943f, 0.9505f, + 1.0000f, 0.9106f, 0.9840f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9922f, 0.7867f, + 1.0000f, 0.8945f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9636f, 0.9886f, 0.9732f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9132f, 0.9640f, 0.8441f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9472f, 0.7687f, 0.8373f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9321f, 0.9331f, 0.8976f, + 1.0000f, 1.0000f, 0.9970f, 0.9996f, 1.0000f, 0.9956f, 0.9182f, 0.8475f, 1.0000f, 0.9569f, 0.9838f, 0.8688f, 1.0000f, 0.9911f, 0.9938f, 0.9884f, + 1.0000f, 1.0000f, 0.9954f, 0.9995f, 1.0000f, 0.9896f, 0.8725f, 1.0000f, 1.0000f, 0.9972f, 0.9258f, 1.0000f, 1.0000f, 0.9915f, 0.9963f, 0.8176f, + 1.0000f, 1.0000f, 0.9985f, 0.9393f, 1.0000f, 0.9850f, 0.9937f, 1.0000f, 1.0000f, 0.9822f, 0.9705f, 1.0000f, 1.0000f, 0.9993f, 0.7636f, 0.8899f, + 1.0000f, 0.9903f, 0.9844f, 0.3467f, 1.0000f, 0.7883f, 1.0000f, 1.0000f, 1.0000f, 0.8252f, 1.0000f, 1.0000f, 1.0000f, 0.9617f, 0.4750f, 1.0000f, + 1.0000f, 0.9984f, 0.9053f, 0.2192f, 1.0000f, 0.9093f, 1.0000f, 1.0000f, 1.0000f, 0.9497f, 1.0000f, 1.0000f, 1.0000f, 0.9416f, 0.7365f, 1.0000f, + 1.0000f, 0.9811f, 0.4965f, 0.9930f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5251f, 1.0000f, 1.0000f, + 1.0000f, 0.9967f, 0.2879f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8716f, 1.0000f, 1.0000f, + 1.0000f, 0.8600f, 0.4470f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5880f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9974f, 0.9971f, 1.0000f, 0.9969f, 0.8630f, 0.9966f, 1.0000f, 0.9889f, 0.9241f, 0.9946f, 1.0000f, 0.9962f, 0.9767f, 0.8874f, + 1.0000f, 0.9973f, 0.9999f, 0.9762f, 1.0000f, 0.9689f, 0.8135f, 1.0000f, 1.0000f, 0.9868f, 0.8744f, 1.0000f, 1.0000f, 0.9936f, 0.9708f, 0.8064f, + 1.0000f, 0.9990f, 0.9138f, 0.3409f, 1.0000f, 0.9786f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, 1.0000f, 1.0000f, 1.0000f, 0.9957f, 0.6530f, 1.0000f, + 1.0000f, 0.9665f, 0.7584f, 0.6215f, 1.0000f, 0.7960f, 1.0000f, 1.0000f, 1.0000f, 0.8214f, 1.0000f, 1.0000f, 1.0000f, 0.9263f, 1.0000f, 1.0000f, + 1.0000f, 0.9932f, 0.2809f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9576f, 1.0000f, 1.0000f, + 1.0000f, 0.8789f, 0.4794f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4923f, 1.0000f, 1.0000f, + 1.0000f, 0.9727f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.1844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9894f, 0.9931f, 0.9646f, 0.8518f, 0.9740f, 0.6760f, 1.0000f, 0.3749f, 0.9755f, 0.8771f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9972f, 0.9806f, 0.8419f, 0.0162f, 0.8659f, 0.9745f, 1.0000f, 1.0000f, 0.9566f, 0.9892f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, + 1.0000f, 0.9955f, 0.7384f, 0.9080f, 0.7326f, 0.9169f, 1.0000f, 1.0000f, 1.0000f, 0.9791f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.9986f, + 1.0000f, 0.9714f, 0.4225f, 1.0000f, 0.1933f, 0.9795f, 1.0000f, 1.0000f, 1.0000f, 0.9809f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, + 1.0000f, 0.9757f, 0.7914f, 1.0000f, 0.1105f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 0.9997f, + 1.0000f, 0.5444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9977f, 0.9994f, 0.9940f, + 1.0000f, 0.8678f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.6618f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 1.0000f, 0.9897f, + 1.0000f, 0.9991f, 0.9658f, 0.9429f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 1.0000f, + 1.0000f, 0.9942f, 0.9425f, 0.8780f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9846f, + 1.0000f, 0.9939f, 0.6971f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9711f, + 1.0000f, 0.9455f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9724f, 0.9777f, + 1.0000f, 0.9752f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9883f, 0.9412f, + 1.0000f, 0.5811f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9982f, 0.9879f, 0.4421f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9536f, 0.4123f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9583f, 0.7820f, 0.6183f, + 1.0000f, 0.9994f, 0.9772f, 0.8035f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7264f, 1.0000f, 1.0000f, + 1.0000f, 0.9959f, 0.9627f, 0.9908f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9379f, 1.0000f, 1.0000f, + 1.0000f, 0.1755f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9100f, 0.8338f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 1.0000f, 1.0000f, + 1.0000f, 0.8265f, 0.9995f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7899f, 1.0000f, 1.0000f, 0.7619f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9747f, 1.0000f, 1.0000f, 0.0584f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, 0.9824f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0694f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9979f, 0.9990f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9842f, 1.0000f, 0.9311f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.9361f, 0.7836f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9919f, 0.9279f, 0.9548f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8649f, 0.7440f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7945f, 0.9959f, 1.0000f, + 1.0000f, 0.9941f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9961f, 1.0000f, 0.9960f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9990f, 0.9559f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8464f, 0.2739f, 0.8240f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7222f, 0.6248f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1483f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6559f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_10x12[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9716f, 0.9549f, 1.0000f, 1.0000f, 0.9881f, 0.9817f, 1.0000f, 1.0000f, 0.9984f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, 0.9617f, 0.9697f, 0.9825f, 1.0000f, 0.9916f, 0.9941f, 0.9689f, 1.0000f, 1.0000f, 0.9980f, 0.9967f, + 1.0000f, 1.0000f, 0.9940f, 0.9997f, 1.0000f, 0.9641f, 0.9573f, 0.7080f, 1.0000f, 0.9918f, 0.9662f, 0.6854f, 1.0000f, 1.0000f, 0.9815f, 0.8889f, + 1.0000f, 1.0000f, 0.9986f, 0.9932f, 1.0000f, 0.9604f, 0.8881f, 0.6661f, 1.0000f, 0.9456f, 0.9130f, 0.6171f, 1.0000f, 0.9600f, 0.9718f, 0.8502f, + 1.0000f, 1.0000f, 0.9899f, 0.9695f, 1.0000f, 0.9535f, 0.7366f, 0.7328f, 1.0000f, 0.9656f, 0.6923f, 0.6142f, 1.0000f, 0.9768f, 0.9189f, 0.4897f, + 1.0000f, 0.9924f, 0.9956f, 0.9650f, 1.0000f, 0.9349f, 0.4381f, 0.9238f, 1.0000f, 0.9344f, 0.3154f, 0.8961f, 1.0000f, 0.9270f, 0.8531f, 0.4604f, + 1.0000f, 1.0000f, 0.9731f, 0.8982f, 1.0000f, 0.9222f, 0.2598f, 1.0000f, 1.0000f, 0.8512f, 0.0780f, 1.0000f, 1.0000f, 0.9411f, 0.5059f, 0.1684f, + 1.0000f, 0.9853f, 0.8463f, 0.5987f, 1.0000f, 0.7036f, 0.7578f, 1.0000f, 1.0000f, 0.5618f, 0.5823f, 1.0000f, 1.0000f, 0.9093f, 0.2466f, 0.4938f, + 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.6877f, 1.0000f, 0.9506f, 0.9112f, 0.8695f, 1.0000f, 0.9909f, 0.9042f, 0.6611f, 1.0000f, 0.9971f, 0.9973f, + 1.0000f, 1.0000f, 0.9974f, 0.9945f, 0.8704f, 0.9827f, 0.9296f, 0.8642f, 0.7829f, 0.9553f, 0.9673f, 0.9380f, 0.4690f, 1.0000f, 0.9977f, 0.9878f, + 1.0000f, 1.0000f, 0.9936f, 0.9937f, 0.8453f, 0.9626f, 0.9036f, 0.6373f, 0.5889f, 0.9782f, 0.9155f, 0.6586f, 0.8293f, 1.0000f, 0.9483f, 0.9081f, + 1.0000f, 0.9770f, 0.9960f, 0.8975f, 0.7997f, 0.9502f, 0.6401f, 0.6686f, 0.2911f, 0.9460f, 0.6316f, 0.6259f, 1.0000f, 0.9647f, 0.9653f, 0.5176f, + 1.0000f, 1.0000f, 0.9539f, 0.9143f, 0.7943f, 0.9415f, 0.5253f, 0.8772f, 0.8247f, 0.9546f, 0.4239f, 0.8443f, 1.0000f, 0.9667f, 0.8114f, 0.3782f, + 1.0000f, 0.9475f, 0.8596f, 0.5652f, 0.2972f, 0.8259f, 0.5789f, 1.0000f, 1.0000f, 0.7983f, 0.4472f, 1.0000f, 1.0000f, 0.8624f, 0.3886f, 0.6508f, + 1.0000f, 0.9756f, 0.8669f, 0.5440f, 0.3675f, 0.7915f, 0.5583f, 1.0000f, 1.0000f, 0.7814f, 0.2532f, 1.0000f, 1.0000f, 0.9275f, 0.1836f, 0.4092f, + 1.0000f, 0.9254f, 0.6991f, 0.3033f, 0.7123f, 0.4979f, 1.0000f, 1.0000f, 1.0000f, 0.2196f, 1.0000f, 1.0000f, 1.0000f, 0.7439f, 0.3214f, 1.0000f, + 1.0000f, 1.0000f, 0.9913f, 0.9990f, 0.9260f, 1.0000f, 0.7166f, 0.8163f, 0.1280f, 1.0000f, 0.9804f, 0.9570f, 0.5137f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9986f, 0.9958f, 0.6808f, 0.7347f, 0.7269f, 0.5512f, 0.2056f, 0.9692f, 0.9311f, 0.7956f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9912f, 0.9330f, 0.8432f, 0.8578f, 0.8151f, 0.4516f, 0.2333f, 0.9808f, 0.7643f, 0.4815f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9791f, 0.9659f, 0.9233f, 0.5098f, 0.9023f, 0.6230f, 0.7385f, 1.0000f, 0.9398f, 0.6112f, 0.7403f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9765f, 0.9490f, 0.5687f, 0.8738f, 0.8088f, 0.4042f, 1.0000f, 0.6081f, 0.9160f, 0.1911f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9195f, 0.8835f, 0.5548f, 0.0989f, 0.7544f, 0.7770f, 1.0000f, 1.0000f, 0.7101f, 0.7594f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.9580f, 0.6050f, 0.3332f, 0.7527f, 0.7228f, 1.0000f, 1.0000f, 1.0000f, 0.8075f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, + 1.0000f, 0.9393f, 0.3938f, 0.6482f, 0.2400f, 0.1760f, 1.0000f, 1.0000f, 1.0000f, 0.0560f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9998f, + 1.0000f, 1.0000f, 0.9736f, 0.9949f, 0.3729f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9362f, 0.8827f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9895f, 0.9772f, 0.4191f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9402f, 0.9494f, 0.6287f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9664f, 0.9577f, 0.2127f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9200f, 0.5291f, 0.5955f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, + 1.0000f, 0.9786f, 0.9836f, 0.6900f, 0.6710f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8904f, 0.3506f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, + 1.0000f, 0.9594f, 0.8940f, 0.6019f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8304f, 0.2849f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9964f, + 1.0000f, 0.8968f, 0.5403f, 0.7901f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5756f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9953f, + 1.0000f, 0.9463f, 0.4856f, 0.7144f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7492f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9840f, 0.9846f, + 1.0000f, 0.8236f, 0.5856f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1607f, 1.0000f, 1.0000f, 1.0000f, 0.9910f, 0.9903f, 0.8559f, + 1.0000f, 0.9983f, 0.9999f, 0.9988f, 1.0000f, 0.9367f, 0.8747f, 0.9723f, 1.0000f, 0.9713f, 0.9100f, 0.9777f, 1.0000f, 0.9908f, 0.9905f, 0.9823f, + 1.0000f, 0.9998f, 0.9998f, 0.9524f, 1.0000f, 0.8713f, 0.9498f, 0.9708f, 1.0000f, 0.9002f, 0.9584f, 0.9849f, 1.0000f, 0.9597f, 0.9860f, 0.8493f, + 1.0000f, 0.9610f, 0.9926f, 0.9847f, 1.0000f, 0.8550f, 0.9753f, 1.0000f, 1.0000f, 0.8315f, 0.9620f, 1.0000f, 1.0000f, 0.6760f, 0.8540f, 0.9183f, + 1.0000f, 0.9178f, 0.9763f, 0.8270f, 1.0000f, 0.9487f, 1.0000f, 1.0000f, 1.0000f, 0.9353f, 1.0000f, 1.0000f, 1.0000f, 0.8063f, 0.9320f, 0.9884f, + 1.0000f, 0.8873f, 0.8521f, 0.9799f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7692f, 0.9371f, 1.0000f, + 1.0000f, 0.8200f, 0.9590f, 0.9531f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8587f, 1.0000f, 1.0000f, + 1.0000f, 0.3620f, 0.8788f, 0.9784f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7660f, 0.9629f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9959f, 0.9900f, 0.9049f, 0.5366f, 0.6946f, 0.7858f, 0.9520f, 0.9687f, 0.8348f, 0.8911f, 0.9876f, 1.0000f, 0.9172f, 0.9635f, 0.9810f, + 1.0000f, 0.9996f, 0.9893f, 0.9467f, 0.6560f, 0.7627f, 0.8023f, 0.9914f, 1.0000f, 0.8843f, 0.9556f, 0.9977f, 1.0000f, 0.9874f, 0.9306f, 0.9793f, + 1.0000f, 0.9448f, 0.7970f, 0.8651f, 1.0000f, 0.9118f, 1.0000f, 1.0000f, 1.0000f, 0.8954f, 1.0000f, 1.0000f, 1.0000f, 0.7058f, 0.9513f, 1.0000f, + 1.0000f, 0.9444f, 0.9431f, 0.9452f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8812f, 0.9898f, 1.0000f, + 1.0000f, 0.3834f, 0.8392f, 0.9644f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8326f, 1.0000f, 1.0000f, + 1.0000f, 0.7676f, 0.9427f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8370f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9935f, 0.9873f, 0.9741f, 0.7887f, 0.3990f, 0.5329f, 0.9291f, 0.0443f, 0.6534f, 0.8422f, 0.9928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9802f, 0.9806f, 0.8606f, 0.3391f, 0.4334f, 0.8188f, 1.0000f, 1.0000f, 0.7561f, 0.9869f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7708f, 0.9062f, 0.9955f, 0.8359f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.8858f, 0.9738f, 0.9886f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 0.8050f, 0.9423f, 1.0000f, 0.7248f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9993f, 0.9968f, + 1.0000f, 0.9149f, 1.0000f, 1.0000f, 0.1529f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9385f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1367f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9788f, 0.9228f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9829f, 0.9542f, + 1.0000f, 0.9325f, 0.9623f, 0.9567f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6831f, 0.9009f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9919f, 0.9440f, 0.9779f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7799f, 0.9842f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9999f, + 1.0000f, 0.8101f, 0.9758f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9887f, 0.9280f, + 1.0000f, 0.9211f, 0.9879f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9934f, 0.8037f, + 1.0000f, 0.9137f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9471f, 0.9638f, 0.9613f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8721f, 0.9479f, 0.8010f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9249f, 0.7510f, 0.8282f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9068f, 0.9265f, 0.9339f, + 1.0000f, 1.0000f, 1.0000f, 0.9994f, 1.0000f, 0.9997f, 0.9358f, 0.8851f, 1.0000f, 0.9733f, 0.9726f, 0.7929f, 1.0000f, 0.9966f, 0.9896f, 0.9684f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9868f, 0.8763f, 1.0000f, 1.0000f, 0.9710f, 0.8819f, 1.0000f, 1.0000f, 0.9987f, 0.9969f, 0.7873f, + 1.0000f, 0.9984f, 0.9927f, 0.9389f, 1.0000f, 0.9855f, 0.9989f, 1.0000f, 1.0000f, 0.9832f, 0.9166f, 1.0000f, 1.0000f, 0.9676f, 0.7308f, 0.8402f, + 1.0000f, 0.9976f, 0.9509f, 0.5721f, 1.0000f, 0.8212f, 1.0000f, 1.0000f, 1.0000f, 0.7457f, 1.0000f, 1.0000f, 1.0000f, 0.9871f, 0.2787f, 1.0000f, + 1.0000f, 0.9992f, 0.8804f, 0.1092f, 1.0000f, 0.8989f, 1.0000f, 1.0000f, 1.0000f, 0.8896f, 1.0000f, 1.0000f, 1.0000f, 0.9751f, 0.6428f, 1.0000f, + 1.0000f, 0.9335f, 0.4427f, 0.9946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4732f, 1.0000f, 1.0000f, + 1.0000f, 0.9962f, 0.2661f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8947f, 1.0000f, 1.0000f, + 1.0000f, 0.8660f, 0.4647f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4141f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9994f, 0.9988f, 0.9743f, 0.9951f, 0.8918f, 0.9844f, 0.9992f, 0.9979f, 0.9075f, 0.9902f, 1.0000f, 0.9857f, 0.9906f, 0.8678f, + 1.0000f, 0.9979f, 0.9989f, 0.9890f, 0.9217f, 0.9821f, 0.8224f, 1.0000f, 1.0000f, 0.9957f, 0.7754f, 1.0000f, 1.0000f, 0.9705f, 0.9607f, 0.7187f, + 1.0000f, 0.9988f, 0.9560f, 0.5215f, 1.0000f, 0.9406f, 1.0000f, 1.0000f, 1.0000f, 0.9892f, 1.0000f, 1.0000f, 1.0000f, 0.9970f, 0.4774f, 1.0000f, + 1.0000f, 0.9681f, 0.8412f, 0.7289f, 1.0000f, 0.8337f, 1.0000f, 1.0000f, 1.0000f, 0.6969f, 1.0000f, 1.0000f, 1.0000f, 0.8796f, 1.0000f, 1.0000f, + 1.0000f, 0.9950f, 0.3094f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9419f, 1.0000f, 1.0000f, + 1.0000f, 0.8381f, 0.5477f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1984f, 1.0000f, 1.0000f, + 1.0000f, 0.9721f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2265f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9933f, 0.9961f, 0.9746f, 0.8126f, 0.9728f, 0.6636f, 1.0000f, 0.3449f, 0.9948f, 0.8730f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9990f, 0.9944f, 0.9029f, 0.0172f, 0.8615f, 0.9760f, 1.0000f, 1.0000f, 0.9795f, 0.9851f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9991f, 0.8139f, 0.9376f, 0.7013f, 0.9301f, 1.0000f, 1.0000f, 1.0000f, 0.9748f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9943f, + 1.0000f, 0.9838f, 0.6784f, 1.0000f, 0.1186f, 0.9974f, 1.0000f, 1.0000f, 1.0000f, 0.9563f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9999f, + 1.0000f, 0.9775f, 0.8473f, 1.0000f, 0.1451f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 0.9939f, + 1.0000f, 0.6201f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 1.0000f, 0.9982f, + 1.0000f, 0.9106f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.9982f, + 1.0000f, 0.6344f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9999f, 0.9866f, + 1.0000f, 1.0000f, 0.9864f, 0.9587f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9929f, 0.8996f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.9942f, + 1.0000f, 0.9987f, 0.9700f, 0.8933f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9670f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, + 1.0000f, 0.9968f, 0.7724f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9834f, 0.9930f, + 1.0000f, 0.9244f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9952f, 0.9813f, + 1.0000f, 0.9315f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9528f, 0.9055f, + 1.0000f, 0.6455f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9797f, 0.9517f, 0.3273f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9286f, 0.3564f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9678f, 0.7611f, 0.4560f, + 1.0000f, 0.9999f, 0.9819f, 0.8633f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7207f, 1.0000f, 1.0000f, + 1.0000f, 0.9976f, 0.9917f, 0.9859f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8687f, 1.0000f, 1.0000f, + 1.0000f, 0.2725f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6735f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9435f, 0.8755f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8780f, 0.9882f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8483f, 1.0000f, 1.0000f, 0.7421f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, + 1.0000f, 0.9703f, 1.0000f, 1.0000f, 0.0320f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9995f, 0.9862f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0885f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9889f, 0.9995f, 0.9923f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9921f, 1.0000f, 0.9087f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9938f, 0.9016f, 0.7475f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.8866f, 0.9206f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8926f, 0.7739f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7785f, 0.9954f, 1.0000f, + 1.0000f, 0.9947f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9922f, 0.9971f, 0.9995f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, 0.9632f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8569f, 0.4287f, 0.9124f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8176f, 0.5923f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0673f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5019f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_12x4[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3987f, 1.0000f, 0.8105f, 0.9465f, 0.6269f, 1.0000f, 1.0000f, 1.0000f, 0.4786f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9946f, 0.4927f, 0.8691f, 0.9409f, 0.9569f, 0.6578f, 1.0000f, 1.0000f, 1.0000f, 0.3330f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9774f, 0.9944f, 0.6317f, 0.9052f, 0.8220f, 0.4495f, 0.2254f, 1.0000f, 1.0000f, 1.0000f, 0.6854f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9899f, 0.9969f, 0.4996f, 0.7915f, 0.7847f, 0.3712f, 0.2484f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9222f, 0.9576f, 0.0327f, 0.7824f, 0.5463f, 0.2705f, 0.5641f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9588f, 0.9649f, 0.9819f, 0.0000f, 0.7730f, 0.1103f, 0.7281f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9765f, 1.0000f, 1.0000f, 0.8239f, 0.8201f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9752f, 0.9908f, 1.0000f, 0.8276f, 0.8844f, 0.8735f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9556f, 0.9815f, 1.0000f, 0.8485f, 0.7369f, 0.4165f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9516f, 0.9700f, 0.9086f, 1.0000f, 0.7451f, 0.2920f, 0.3618f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9140f, 0.9393f, 1.0000f, 0.7892f, 0.1733f, 0.6363f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8957f, 0.8434f, 0.7064f, 1.0000f, 0.5583f, 0.1276f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9232f, 0.9870f, 1.0000f, 1.0000f, 0.8023f, 0.9005f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9643f, 0.9885f, 1.0000f, 0.7396f, 0.7581f, 0.5865f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8804f, 0.8417f, 1.0000f, 0.8124f, 0.5064f, 0.1583f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9119f, 0.9280f, 0.8615f, 1.0000f, 0.7251f, 0.3026f, 0.4857f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9242f, 0.8646f, 0.5754f, 1.0000f, 0.7129f, 0.0626f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7937f, 0.8085f, 0.3805f, 1.0000f, 0.3230f, 0.4715f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9791f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9350f, 0.9756f, 1.0000f, 1.0000f, 0.7032f, 0.7530f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9289f, 0.9613f, 1.0000f, 0.7607f, 0.8348f, 0.4076f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8469f, 0.8502f, 1.0000f, 0.7097f, 0.2132f, 0.4338f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, + 1.0000f, 0.8383f, 0.9028f, 0.3427f, 1.0000f, 0.6778f, 0.0888f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, + 1.0000f, 0.9192f, 0.6998f, 0.2005f, 1.0000f, 0.5199f, 0.1431f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9722f, 0.9911f, + 1.0000f, 0.7191f, 0.4643f, 0.2370f, 1.0000f, 0.1870f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9880f, 0.9913f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9983f, 0.9986f, 0.9933f, 0.5399f, 0.9017f, 0.8400f, 0.9384f, 0.9543f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9991f, 0.9995f, 0.9434f, 0.6659f, 0.8182f, 0.9162f, 0.8777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9851f, 0.9922f, 0.9841f, 1.0000f, 0.6410f, 0.8920f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9550f, 0.9848f, 0.8706f, 1.0000f, 0.7958f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9367f, 0.8451f, 0.9307f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8749f, 0.9202f, 0.9473f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9989f, 0.9787f, 0.8583f, 1.0000f, 0.6891f, 0.8144f, 0.9844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9973f, 0.9727f, 0.9359f, 1.0000f, 0.8044f, 0.9270f, 0.9637f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9716f, 0.7980f, 0.8763f, 1.0000f, 0.6497f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9495f, 0.9563f, 0.8969f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5919f, 0.8330f, 0.9582f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6928f, 0.9827f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9811f, 0.9855f, 0.9683f, 1.0000f, 0.4570f, 0.8567f, 0.9342f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9450f, 0.9625f, 0.7777f, 1.0000f, 0.6816f, 0.9803f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6454f, 0.8163f, 0.9261f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 0.7801f, 0.8908f, 0.9601f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 0.5523f, 0.9426f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9888f, 0.9947f, 0.9953f, + 1.0000f, 0.7682f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9935f, 0.9936f, 0.9130f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8294f, 0.9172f, 0.9442f, 1.0000f, 0.5697f, 0.8993f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 1.0000f, + 1.0000f, 0.9799f, 0.8661f, 0.8981f, 1.0000f, 0.8257f, 0.9834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9985f, + 1.0000f, 0.6220f, 0.9040f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9991f, 0.9920f, + 1.0000f, 0.7870f, 0.9063f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9993f, 0.9376f, + 1.0000f, 0.7556f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9925f, 0.9882f, 0.9672f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9795f, 0.9778f, 0.7657f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9893f, 0.9977f, 0.9417f, 0.9732f, 0.8365f, 0.6171f, 0.9996f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9968f, 0.9972f, 0.9942f, 0.8001f, 0.9151f, 0.6739f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9958f, 0.9770f, 0.9595f, 1.0000f, 0.9182f, 0.9074f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9906f, 0.9689f, 0.6021f, 1.0000f, 0.5267f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9891f, 0.9619f, 0.8312f, 1.0000f, 0.9742f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9830f, 0.8882f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9660f, 0.9823f, 1.0000f, 0.9401f, 0.7424f, 0.9711f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9737f, 0.9864f, 0.9108f, 1.0000f, 0.9315f, 0.5810f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9877f, 0.8630f, 0.5334f, 1.0000f, 0.9324f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8933f, 0.7632f, 0.6537f, 1.0000f, 0.6071f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9861f, 0.8599f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9509f, 0.9631f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9867f, 0.9530f, 0.9298f, 1.0000f, 0.9458f, 0.7339f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9783f, 0.9480f, 0.5132f, 1.0000f, 0.8676f, 0.9502f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, + 1.0000f, 0.9655f, 0.6964f, 0.7222f, 1.0000f, 0.9251f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9994f, + 1.0000f, 0.8535f, 0.2596f, 1.0000f, 1.0000f, 0.9536f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, + 1.0000f, 0.9808f, 0.9896f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9858f, 0.9938f, + 1.0000f, 0.8519f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9951f, 0.9982f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9837f, 0.8895f, 0.6699f, 1.0000f, 0.8870f, 0.7504f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9987f, + 1.0000f, 0.9487f, 0.8551f, 0.3897f, 1.0000f, 0.8791f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9940f, + 1.0000f, 0.9333f, 0.3130f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9931f, 0.9980f, + 1.0000f, 0.7310f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9961f, 0.9967f, + 1.0000f, 0.9677f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9929f, 0.9904f, + 1.0000f, 0.8720f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9927f, 0.9965f, 0.8945f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9916f, 0.8065f, 0.4418f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9761f, 0.7478f, 0.7706f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5970f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8857f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6619f, 0.3522f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4252f, 0.9607f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2814f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9992f, 0.9994f, + 1.0000f, 0.7160f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9959f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9997f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 1.0000f, 0.9874f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9706f, 0.9212f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9956f, 0.9747f, 0.9666f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9962f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9918f, 0.9996f, 0.9949f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9954f, 0.9996f, 0.8831f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9523f, 0.6121f, 0.9694f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8817f, 0.7753f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9097f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9901f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_12x5[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3385f, 1.0000f, 0.8818f, 0.9311f, 0.6057f, 1.0000f, 1.0000f, 1.0000f, 0.4810f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9964f, 0.5033f, 0.8904f, 0.9448f, 0.9478f, 0.6751f, 1.0000f, 1.0000f, 1.0000f, 0.2676f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9709f, 0.9951f, 0.6474f, 0.9174f, 0.8674f, 0.5245f, 0.3884f, 1.0000f, 1.0000f, 1.0000f, 0.7693f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9930f, 0.9961f, 0.6015f, 0.8068f, 0.8243f, 0.4456f, 0.3816f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9518f, 0.9659f, 0.6327f, 0.8317f, 0.4635f, 0.3678f, 0.7032f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9685f, 0.9763f, 0.9802f, 0.0329f, 0.7475f, 0.1053f, 0.6912f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8447f, 0.9466f, 0.0000f, 0.7305f, 0.0894f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9265f, 0.8518f, 0.7498f, 0.6437f, 0.4517f, 0.6364f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 0.9872f, 1.0000f, 1.0000f, 0.8462f, 0.8490f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9826f, 0.9955f, 1.0000f, 0.8700f, 0.9032f, 0.8883f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9567f, 0.9851f, 1.0000f, 0.8585f, 0.8050f, 0.4923f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9627f, 0.9705f, 0.8840f, 1.0000f, 0.7979f, 0.4016f, 0.5141f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8974f, 0.9077f, 1.0000f, 0.8015f, 0.1211f, 0.5671f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9022f, 0.8198f, 0.6137f, 1.0000f, 0.5581f, 0.1343f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9296f, 0.8531f, 0.7227f, 1.0000f, 0.5760f, 0.2593f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8611f, 0.8033f, 0.2759f, 1.0000f, 0.1907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9415f, 0.9895f, 1.0000f, 1.0000f, 0.8228f, 0.9086f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9689f, 0.9937f, 1.0000f, 0.7672f, 0.7793f, 0.6214f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9140f, 0.8712f, 1.0000f, 0.8347f, 0.5847f, 0.2424f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9333f, 0.9319f, 0.8687f, 1.0000f, 0.7753f, 0.4272f, 0.6718f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9289f, 0.8545f, 0.3748f, 1.0000f, 0.7587f, 0.0520f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8101f, 0.7773f, 0.3310f, 1.0000f, 0.3460f, 0.4334f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, + 1.0000f, 0.8749f, 0.5932f, 0.1797f, 1.0000f, 0.6816f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9729f, + 1.0000f, 0.8213f, 0.4752f, 0.6098f, 1.0000f, 0.0710f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9832f, 0.9645f, + 1.0000f, 1.0000f, 0.9484f, 0.9781f, 1.0000f, 1.0000f, 0.7254f, 0.7543f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9340f, 0.9733f, 1.0000f, 0.7888f, 0.8649f, 0.3609f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.8662f, 0.8725f, 1.0000f, 0.7356f, 0.2840f, 0.5974f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9945f, + 1.0000f, 0.8598f, 0.9059f, 0.3535f, 1.0000f, 0.7089f, 0.1575f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, + 1.0000f, 0.9041f, 0.6943f, 0.1460f, 1.0000f, 0.6510f, 0.1686f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9880f, 0.9977f, + 1.0000f, 0.7061f, 0.2920f, 0.4145f, 1.0000f, 0.2016f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9943f, 0.9966f, + 1.0000f, 0.7961f, 0.3155f, 0.4080f, 1.0000f, 0.5296f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9578f, 0.9737f, + 1.0000f, 0.6880f, 0.2228f, 1.0000f, 1.0000f, 0.2330f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9663f, 0.9572f, 0.9422f, + 1.0000f, 0.9980f, 0.9971f, 0.9949f, 0.5088f, 0.9003f, 0.8376f, 0.9191f, 0.9507f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9982f, 0.9995f, 0.9122f, 0.6615f, 0.8433f, 0.9304f, 0.9113f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9874f, 0.9953f, 0.9893f, 1.0000f, 0.7331f, 0.9368f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9513f, 0.9823f, 0.8559f, 1.0000f, 0.8955f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9148f, 0.8862f, 0.9541f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8636f, 0.9636f, 0.9650f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5890f, 0.8390f, 0.9717f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7280f, 0.9835f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9990f, 0.9741f, 0.8361f, 1.0000f, 0.7200f, 0.8419f, 0.9890f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9978f, 0.9622f, 0.9157f, 1.0000f, 0.8134f, 0.9490f, 0.9713f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9588f, 0.7943f, 0.8807f, 1.0000f, 0.7713f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9501f, 0.9641f, 0.9216f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4867f, 0.8984f, 0.9395f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7453f, 0.9785f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6848f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9165f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9770f, 0.9806f, 0.9557f, 1.0000f, 0.4694f, 0.8572f, 0.9460f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9347f, 0.9617f, 0.7609f, 1.0000f, 0.6974f, 0.9842f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6581f, 0.8166f, 0.9068f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.7925f, 0.8945f, 0.9777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9999f, + 1.0000f, 0.6290f, 0.8965f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9999f, 0.9997f, + 1.0000f, 0.8258f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9813f, 0.9926f, 0.9281f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9883f, 0.8504f, + 1.0000f, 0.8332f, 0.9131f, 0.9326f, 1.0000f, 0.5626f, 0.9199f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, 1.0000f, + 1.0000f, 0.9721f, 0.8760f, 0.9257f, 1.0000f, 0.8476f, 0.9888f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9984f, + 1.0000f, 0.6252f, 0.9381f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9991f, 0.9909f, + 1.0000f, 0.8150f, 0.9441f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9992f, 0.9241f, + 1.0000f, 0.6176f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9898f, 0.9942f, 0.9900f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9792f, 0.9907f, 0.8924f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9774f, 0.8288f, 0.8182f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9608f, 0.9409f, 0.8303f, + 1.0000f, 1.0000f, 0.9957f, 0.9905f, 0.9402f, 0.9551f, 0.8624f, 0.6546f, 0.9989f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9948f, 0.9959f, 0.9973f, 0.7851f, 0.9472f, 0.7429f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9952f, 0.9361f, 0.9530f, 1.0000f, 0.8914f, 0.8851f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9809f, 0.9697f, 0.4978f, 1.0000f, 0.5346f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9920f, 0.9182f, 0.6684f, 1.0000f, 0.8893f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8934f, 0.7145f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9863f, 0.9013f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9654f, 0.9752f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9598f, 0.9914f, 1.0000f, 0.9672f, 0.7733f, 0.9756f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9816f, 0.9869f, 0.9104f, 1.0000f, 0.9495f, 0.6401f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9938f, 0.8273f, 0.4208f, 1.0000f, 0.9249f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8784f, 0.7565f, 0.5490f, 1.0000f, 0.5716f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9701f, 0.5803f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8118f, 0.7997f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9799f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9233f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9860f, 0.9795f, 0.9429f, 1.0000f, 0.9546f, 0.7869f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9829f, 0.9524f, 0.5443f, 1.0000f, 0.9095f, 0.9725f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 0.9667f, 0.6650f, 0.7117f, 1.0000f, 0.9435f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9996f, + 1.0000f, 0.8829f, 0.2123f, 1.0000f, 1.0000f, 0.9693f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9995f, + 1.0000f, 0.8994f, 0.9224f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, 0.9967f, + 1.0000f, 0.5395f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9970f, 0.9996f, + 1.0000f, 0.9744f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9885f, 0.9935f, + 1.0000f, 0.9845f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9680f, 0.9902f, 0.9877f, + 1.0000f, 0.9866f, 0.9354f, 0.7380f, 1.0000f, 0.9273f, 0.7813f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.9962f, + 1.0000f, 0.9676f, 0.8795f, 0.4396f, 1.0000f, 0.8873f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9981f, 0.9911f, + 1.0000f, 0.9593f, 0.2510f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9932f, + 1.0000f, 0.7630f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9956f, 0.9965f, + 1.0000f, 0.8772f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9854f, 0.9767f, + 1.0000f, 0.5194f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9933f, 0.9916f, 0.7003f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9928f, 0.9759f, 0.9375f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9918f, 0.9603f, 0.9839f, + 1.0000f, 0.9979f, 0.7832f, 0.4576f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9819f, 0.7906f, 0.7651f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3077f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7405f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6784f, 0.3232f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3950f, 0.9788f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, 0.9996f, + 1.0000f, 0.7520f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, 0.9946f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 1.0000f, 0.9998f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9960f, 1.0000f, 0.9968f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9562f, 0.8737f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9535f, 0.9454f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9631f, 0.9050f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9388f, 0.9974f, 1.0000f, + 1.0000f, 0.9998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9848f, 0.9989f, 0.9922f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9857f, 0.9999f, 0.8405f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9748f, 0.5536f, 0.9583f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9208f, 0.8085f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7173f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9613f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_12x6[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.4495f, 1.0000f, 0.9421f, 0.9517f, 0.7621f, 1.0000f, 1.0000f, 1.0000f, 0.4827f, 1.0000f, 0.8797f, 0.9512f, + 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.6889f, 0.9444f, 0.9633f, 0.9713f, 0.7033f, 1.0000f, 1.0000f, 1.0000f, 0.2638f, 1.0000f, 0.8294f, 0.9784f, + 1.0000f, 1.0000f, 0.9823f, 0.9970f, 0.6859f, 0.9375f, 0.9393f, 0.5485f, 0.3832f, 1.0000f, 1.0000f, 1.0000f, 0.7745f, 1.0000f, 0.9591f, 0.9129f, + 1.0000f, 1.0000f, 0.9882f, 0.9939f, 0.7113f, 0.8930f, 0.8759f, 0.5041f, 0.3565f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9665f, 0.9507f, 0.9281f, + 1.0000f, 1.0000f, 0.9836f, 0.9730f, 0.7294f, 0.8913f, 0.5839f, 0.4607f, 0.7344f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9532f, 0.9416f, 0.7269f, + 1.0000f, 0.9778f, 0.9935f, 0.9828f, 0.0834f, 0.8558f, 0.1109f, 0.7512f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9201f, 0.9084f, 0.5666f, + 1.0000f, 1.0000f, 0.9608f, 0.9471f, 0.0187f, 0.8450f, 0.0373f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9187f, 0.7466f, 0.3132f, + 1.0000f, 0.9668f, 0.8905f, 0.7218f, 0.6538f, 0.4989f, 0.4881f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9165f, 0.6078f, 0.6734f, + 1.0000f, 1.0000f, 1.0000f, 0.9864f, 1.0000f, 1.0000f, 0.9357f, 0.8768f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9820f, 0.9980f, 1.0000f, 0.8730f, 0.9351f, 0.9029f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9756f, 0.9866f, 1.0000f, 0.9037f, 0.8815f, 0.5438f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9759f, 0.9812f, 0.8593f, 1.0000f, 0.8778f, 0.4935f, 0.5753f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9587f, 0.9158f, 1.0000f, 0.8922f, 0.1996f, 0.6637f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9497f, 0.8462f, 0.6472f, 1.0000f, 0.6947f, 0.2723f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9746f, 0.9288f, 0.6918f, 1.0000f, 0.7394f, 0.1897f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9256f, 0.7825f, 0.3766f, 1.0000f, 0.1350f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9433f, 0.9957f, 0.8437f, 1.0000f, 0.8963f, 0.9235f, 0.3495f, 1.0000f, 1.0000f, 1.0000f, 0.7663f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9878f, 0.9916f, 0.7556f, 0.8740f, 0.8334f, 0.6505f, 0.1794f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9560f, 0.8399f, 0.7844f, 0.9005f, 0.6797f, 0.3632f, 0.1231f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9616f, 0.9492f, 0.8570f, 0.5195f, 0.8852f, 0.4662f, 0.7087f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9541f, 0.9180f, 0.4381f, 0.8109f, 0.8690f, 0.0976f, 1.0000f, 0.6404f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8824f, 0.8347f, 0.3958f, 0.0687f, 0.5530f, 0.5621f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, + 1.0000f, 0.9398f, 0.5881f, 0.2094f, 0.6829f, 0.8060f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, + 1.0000f, 0.8980f, 0.3699f, 0.6266f, 0.1691f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9972f, 0.9942f, + 1.0000f, 1.0000f, 0.9649f, 0.9896f, 1.0000f, 1.0000f, 0.8373f, 0.7919f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9595f, 0.9810f, 1.0000f, 0.8870f, 0.8996f, 0.4081f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9091f, 0.8581f, 0.0535f, 0.8139f, 0.4143f, 0.6154f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, + 1.0000f, 0.9339f, 0.9215f, 0.3284f, 0.6116f, 0.8487f, 0.2463f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, + 1.0000f, 0.9683f, 0.7991f, 0.2283f, 1.0000f, 0.7489f, 0.3054f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9908f, 0.9988f, + 1.0000f, 0.8281f, 0.3355f, 0.5246f, 1.0000f, 0.3208f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9975f, 0.9960f, + 1.0000f, 0.9021f, 0.2551f, 0.3895f, 1.0000f, 0.6604f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9899f, 0.9975f, + 1.0000f, 0.7684f, 0.2373f, 1.0000f, 1.0000f, 0.2189f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9940f, 0.9927f, 0.9600f, + 1.0000f, 0.9982f, 0.9982f, 0.9919f, 0.4204f, 0.9122f, 0.8360f, 0.9455f, 0.9242f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, 0.9657f, 0.8896f, + 1.0000f, 0.9983f, 0.9998f, 0.9194f, 0.5709f, 0.8523f, 0.9208f, 0.9487f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9698f, 0.9427f, 0.6766f, + 1.0000f, 0.9676f, 0.9870f, 0.9804f, 1.0000f, 0.7599f, 0.9275f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7956f, 0.7882f, 0.9326f, + 1.0000f, 0.9099f, 0.9750f, 0.8267f, 1.0000f, 0.8861f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8184f, 0.9136f, 0.9876f, + 1.0000f, 0.9114f, 0.8887f, 0.9793f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7004f, 0.9621f, 1.0000f, + 1.0000f, 0.8604f, 0.9661f, 0.9653f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8321f, 1.0000f, 1.0000f, + 1.0000f, 0.5961f, 0.9269f, 0.9680f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8026f, 0.9850f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9991f, 0.9737f, 0.8254f, 1.0000f, 0.7578f, 0.8412f, 0.9815f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9977f, 0.9706f, 0.9173f, 1.0000f, 0.8154f, 0.9381f, 0.9787f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9522f, 0.7725f, 0.8511f, 1.0000f, 0.8043f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9313f, 0.9404f, 0.9107f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5093f, 0.8939f, 0.9564f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7974f, 0.9645f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7805f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8955f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9796f, 0.9743f, 0.9578f, 1.0000f, 0.5296f, 0.8626f, 0.9569f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9502f, 0.9672f, 0.7938f, 1.0000f, 0.7140f, 0.9726f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6192f, 0.8169f, 0.8700f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7704f, 0.8546f, 0.9765f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.7192f, 0.9068f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9997f, 0.9999f, + 1.0000f, 0.8475f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, 0.9933f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9936f, 0.9807f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9961f, 0.9798f, + 1.0000f, 0.8535f, 0.9262f, 0.9476f, 1.0000f, 0.5796f, 0.8680f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9998f, + 1.0000f, 0.9762f, 0.8749f, 0.9013f, 1.0000f, 0.8076f, 0.9874f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9984f, 0.9971f, + 1.0000f, 0.6370f, 0.9144f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9984f, 0.9733f, + 1.0000f, 0.8307f, 0.9410f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9966f, 0.8637f, + 1.0000f, 0.6336f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9848f, 0.9963f, 0.9910f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9723f, 0.9868f, 0.8972f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9894f, 0.8878f, 0.9052f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9790f, 0.9691f, 0.9551f, + 1.0000f, 1.0000f, 0.9892f, 0.9945f, 0.9060f, 0.9833f, 0.8615f, 0.7166f, 0.9967f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.9818f, 0.9923f, + 1.0000f, 0.9965f, 0.9981f, 0.9988f, 0.6702f, 0.9687f, 0.7901f, 0.9998f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9857f, 0.9838f, 0.9465f, + 1.0000f, 0.9965f, 0.9918f, 0.9387f, 1.0000f, 0.9555f, 0.8227f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9801f, 0.9629f, 0.9941f, + 1.0000f, 0.9952f, 0.9781f, 0.3426f, 1.0000f, 0.5575f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9950f, 0.9076f, 1.0000f, + 1.0000f, 0.9985f, 0.9294f, 0.5392f, 1.0000f, 0.8834f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9872f, 0.9951f, 1.0000f, + 1.0000f, 0.9546f, 0.6670f, 0.9968f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8988f, 1.0000f, 1.0000f, + 1.0000f, 0.9937f, 0.7370f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9716f, 1.0000f, 1.0000f, + 1.0000f, 0.9229f, 0.8947f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9641f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9978f, 0.9913f, 1.0000f, 0.9845f, 0.7785f, 0.9709f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9898f, 0.9926f, 0.9449f, 1.0000f, 0.9527f, 0.6571f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9964f, 0.9222f, 0.2892f, 1.0000f, 0.9604f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9740f, 0.7244f, 0.4551f, 1.0000f, 0.5921f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9859f, 0.4020f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8720f, 0.6438f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9720f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7060f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9886f, 0.9840f, 0.9482f, 1.0000f, 0.9775f, 0.7319f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9884f, 0.9537f, 0.6000f, 1.0000f, 0.8787f, 0.9438f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.9831f, 0.6229f, 0.6039f, 1.0000f, 0.9332f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.9151f, 0.1467f, 1.0000f, 1.0000f, 0.9363f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9987f, + 1.0000f, 0.9612f, 0.7863f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9994f, + 1.0000f, 0.4264f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9958f, 1.0000f, + 1.0000f, 0.9249f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9915f, 0.9997f, + 1.0000f, 0.8659f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9911f, 0.9992f, 0.9976f, + 1.0000f, 0.9901f, 0.9637f, 0.7765f, 1.0000f, 0.9460f, 0.7443f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9948f, 0.9953f, + 1.0000f, 0.9772f, 0.8843f, 0.5345f, 1.0000f, 0.8212f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 0.9852f, + 1.0000f, 0.9855f, 0.2975f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9930f, + 1.0000f, 0.8093f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9929f, 0.9991f, 0.9946f, + 1.0000f, 0.9045f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9947f, 0.9954f, 0.9769f, + 1.0000f, 0.2809f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9962f, 0.9903f, 0.6976f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9888f, 0.8425f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9890f, 0.9301f, 0.9320f, + 1.0000f, 0.9921f, 0.8499f, 0.4772f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8710f, 1.0000f, 1.0000f, + 1.0000f, 0.9825f, 0.8198f, 0.8240f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9582f, 1.0000f, 1.0000f, + 1.0000f, 0.1579f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6301f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7534f, 0.4323f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5145f, 0.9573f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4438f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, + 1.0000f, 0.8009f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, 0.9880f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9956f, 1.0000f, 0.9989f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9979f, 1.0000f, 0.9753f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9695f, 0.8806f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9843f, 0.9702f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9625f, 0.8648f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8386f, 0.9995f, 1.0000f, + 1.0000f, 0.9932f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, 0.9990f, 0.9905f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9996f, 0.8669f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9345f, 0.4718f, 0.9307f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8124f, 0.7419f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7642f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9369f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_12x8[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5588f, 1.0000f, 0.9555f, 0.9382f, 0.7966f, 1.0000f, 0.8855f, 0.9307f, 0.5111f, 1.0000f, 0.9837f, 0.9961f, + 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.7459f, 0.9753f, 0.9716f, 0.9745f, 0.7119f, 0.9180f, 0.9366f, 0.9447f, 0.2944f, 1.0000f, 0.9984f, 0.9977f, + 1.0000f, 1.0000f, 0.9795f, 0.9985f, 0.7823f, 0.9875f, 0.9631f, 0.6537f, 0.5466f, 0.9551f, 0.9497f, 0.7555f, 0.8055f, 1.0000f, 0.9832f, 0.9372f, + 1.0000f, 1.0000f, 0.9958f, 0.9928f, 0.7856f, 0.9324f, 0.9187f, 0.5956f, 0.4727f, 0.9296f, 0.9130f, 0.6180f, 1.0000f, 0.9859f, 0.9798f, 0.9590f, + 1.0000f, 1.0000f, 0.9783f, 0.9547f, 0.7142f, 0.9340f, 0.6273f, 0.5989f, 0.7756f, 0.9280f, 0.7721f, 0.4374f, 1.0000f, 0.9722f, 0.9488f, 0.6334f, + 1.0000f, 0.9903f, 0.9917f, 0.9750f, 0.1410f, 0.9042f, 0.2259f, 0.8376f, 1.0000f, 0.9136f, 0.4580f, 0.9216f, 1.0000f, 0.9251f, 0.8903f, 0.6054f, + 1.0000f, 1.0000f, 0.9719f, 0.9433f, 0.1210f, 0.9035f, 0.0611f, 1.0000f, 1.0000f, 0.8465f, 0.1681f, 1.0000f, 1.0000f, 0.9605f, 0.6566f, 0.3930f, + 1.0000f, 0.9786f, 0.8707f, 0.6808f, 0.6622f, 0.5338f, 0.4921f, 1.0000f, 1.0000f, 0.7419f, 0.7593f, 1.0000f, 1.0000f, 0.9302f, 0.5017f, 0.7399f, + 1.0000f, 1.0000f, 1.0000f, 0.9957f, 1.0000f, 1.0000f, 0.9582f, 0.9028f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9948f, + 1.0000f, 1.0000f, 0.9952f, 0.9942f, 1.0000f, 0.9734f, 0.9679f, 0.9143f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9916f, 0.9924f, + 1.0000f, 1.0000f, 0.9899f, 0.9852f, 1.0000f, 0.9313f, 0.9174f, 0.6242f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9666f, 0.9506f, + 1.0000f, 0.9878f, 0.9918f, 0.8600f, 1.0000f, 0.9392f, 0.6211f, 0.6980f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9768f, 0.9841f, 0.6705f, + 1.0000f, 1.0000f, 0.9707f, 0.8863f, 1.0000f, 0.9103f, 0.3685f, 0.7839f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9685f, 0.8779f, 0.4678f, + 1.0000f, 0.9773f, 0.8529f, 0.5381f, 1.0000f, 0.7498f, 0.4530f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9007f, 0.5779f, 0.6117f, + 1.0000f, 0.9790f, 0.8847f, 0.6086f, 1.0000f, 0.7358f, 0.2569f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9334f, 0.4479f, 0.5851f, + 1.0000f, 0.9423f, 0.7612f, 0.3988f, 1.0000f, 0.1593f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8341f, 0.4159f, 1.0000f, + 1.0000f, 1.0000f, 0.9815f, 0.9983f, 0.9049f, 1.0000f, 0.9377f, 0.9110f, 0.1767f, 1.0000f, 1.0000f, 1.0000f, 0.6480f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9925f, 0.9938f, 0.7252f, 0.9465f, 0.8871f, 0.6731f, 0.2795f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9656f, 0.8688f, 0.8364f, 0.9620f, 0.7337f, 0.5507f, 0.0864f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9793f, 0.9645f, 0.8590f, 0.3871f, 0.9329f, 0.5887f, 0.8069f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9725f, 0.9257f, 0.4046f, 0.8725f, 0.8993f, 0.2338f, 1.0000f, 0.4268f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9240f, 0.8539f, 0.4214f, 0.0177f, 0.6594f, 0.7209f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, + 1.0000f, 0.9535f, 0.5815f, 0.2492f, 0.7649f, 0.8139f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, + 1.0000f, 0.9070f, 0.3300f, 0.5742f, 0.0985f, 0.0349f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9969f, 0.9981f, + 1.0000f, 1.0000f, 0.9809f, 0.9877f, 1.0000f, 1.0000f, 0.8152f, 0.7981f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9755f, 0.9842f, 1.0000f, 0.9205f, 0.8770f, 0.5064f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9397f, 0.8956f, 0.2720f, 0.8971f, 0.5294f, 0.7050f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9934f, + 1.0000f, 0.9470f, 0.9543f, 0.5204f, 0.4776f, 0.8697f, 0.4103f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9887f, + 1.0000f, 0.9698f, 0.7919f, 0.3017f, 1.0000f, 0.7950f, 0.5249f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9894f, 0.9987f, + 1.0000f, 0.8486f, 0.3432f, 0.6508f, 1.0000f, 0.5158f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9988f, + 1.0000f, 0.8895f, 0.2016f, 0.3496f, 1.0000f, 0.7004f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9935f, 0.9974f, + 1.0000f, 0.7806f, 0.2870f, 1.0000f, 1.0000f, 0.3090f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9872f, 0.9921f, 0.9350f, + 1.0000f, 0.9995f, 0.9970f, 0.9964f, 0.4426f, 0.9077f, 0.8669f, 0.9479f, 0.9413f, 0.9156f, 0.7439f, 0.7379f, 1.0000f, 0.9956f, 0.9992f, 0.9788f, + 1.0000f, 0.9999f, 0.9998f, 0.9285f, 0.5627f, 0.8678f, 0.9246f, 0.9676f, 1.0000f, 0.8166f, 0.7668f, 0.7686f, 1.0000f, 0.9910f, 0.9926f, 0.8926f, + 1.0000f, 0.9418f, 0.9883f, 0.9807f, 1.0000f, 0.8268f, 0.9601f, 1.0000f, 1.0000f, 0.7274f, 0.9739f, 1.0000f, 1.0000f, 0.8293f, 0.9021f, 0.9943f, + 1.0000f, 0.8941f, 0.9642f, 0.8192f, 1.0000f, 0.9442f, 1.0000f, 1.0000f, 1.0000f, 0.8218f, 1.0000f, 1.0000f, 1.0000f, 0.8919f, 0.9766f, 0.9950f, + 1.0000f, 0.8813f, 0.8560f, 0.9737f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8179f, 0.9567f, 1.0000f, + 1.0000f, 0.8305f, 0.9539f, 0.9408f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9527f, 1.0000f, 1.0000f, + 1.0000f, 0.5424f, 0.9274f, 0.9776f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8125f, 0.9760f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9984f, 0.9854f, 0.8497f, 1.0000f, 0.7888f, 0.8839f, 0.9863f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9623f, 0.9510f, 0.9514f, + 1.0000f, 0.9959f, 0.9649f, 0.9263f, 1.0000f, 0.8387f, 0.9519f, 0.9813f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9828f, 0.9193f, 0.9228f, + 1.0000f, 0.9523f, 0.7872f, 0.8421f, 1.0000f, 0.8805f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7631f, 0.9428f, 1.0000f, + 1.0000f, 0.9222f, 0.9437f, 0.9361f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8761f, 0.9873f, 1.0000f, + 1.0000f, 0.3748f, 0.8243f, 0.9594f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8978f, 1.0000f, 1.0000f, + 1.0000f, 0.7517f, 0.9291f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7935f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8743f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9826f, 0.9802f, 0.9616f, 0.8454f, 0.5666f, 0.8788f, 0.9704f, 0.1105f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9612f, 0.9688f, 0.8011f, 0.4970f, 0.7316f, 0.9870f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6650f, 0.8610f, 0.9403f, 0.8432f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.8098f, 0.9149f, 0.9811f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7231f, 0.9162f, 1.0000f, 0.7574f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, 0.9989f, + 1.0000f, 0.8620f, 1.0000f, 1.0000f, 0.1504f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9804f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0481f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9966f, 0.9742f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.9839f, + 1.0000f, 0.8949f, 0.9461f, 0.9493f, 1.0000f, 0.6022f, 0.8911f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9999f, + 1.0000f, 0.9834f, 0.9116f, 0.9578f, 1.0000f, 0.8410f, 0.9929f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, + 1.0000f, 0.7164f, 0.9531f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9954f, 0.9563f, + 1.0000f, 0.8580f, 0.9713f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9914f, 0.8280f, + 1.0000f, 0.6422f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9659f, 0.9937f, 0.9848f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9211f, 0.9830f, 0.8399f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9758f, 0.8734f, 0.9199f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9771f, 0.9763f, 0.9701f, + 1.0000f, 1.0000f, 0.9999f, 0.9893f, 0.9123f, 0.9945f, 0.8830f, 0.7704f, 0.9897f, 0.9933f, 0.9728f, 0.8317f, 1.0000f, 0.9986f, 0.9920f, 0.9962f, + 1.0000f, 0.9998f, 0.9999f, 0.9960f, 0.6678f, 0.9634f, 0.8329f, 1.0000f, 1.0000f, 0.9907f, 0.9083f, 1.0000f, 1.0000f, 0.9988f, 0.9992f, 0.8752f, + 1.0000f, 0.9999f, 0.9970f, 0.9318f, 1.0000f, 0.9900f, 0.9387f, 1.0000f, 1.0000f, 0.9973f, 0.9885f, 1.0000f, 1.0000f, 0.9995f, 0.8476f, 0.9502f, + 1.0000f, 0.9981f, 0.9846f, 0.3162f, 1.0000f, 0.6858f, 1.0000f, 1.0000f, 1.0000f, 0.8716f, 1.0000f, 1.0000f, 1.0000f, 0.9932f, 0.7996f, 1.0000f, + 1.0000f, 0.9977f, 0.8796f, 0.2097f, 1.0000f, 0.8640f, 1.0000f, 1.0000f, 1.0000f, 0.9800f, 1.0000f, 1.0000f, 1.0000f, 0.9731f, 0.9097f, 1.0000f, + 1.0000f, 0.9710f, 0.4873f, 0.9844f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7073f, 1.0000f, 1.0000f, + 1.0000f, 0.9818f, 0.4824f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9268f, 1.0000f, 1.0000f, + 1.0000f, 0.9063f, 0.6907f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8256f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9982f, 0.9857f, 1.0000f, 0.9912f, 0.8040f, 0.9880f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9850f, 0.9890f, 0.9234f, + 1.0000f, 0.9940f, 0.9975f, 0.9781f, 1.0000f, 0.9586f, 0.7739f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9913f, 0.9638f, 0.8549f, + 1.0000f, 0.9973f, 0.8963f, 0.2644f, 1.0000f, 0.9672f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.7904f, 1.0000f, + 1.0000f, 0.9609f, 0.6782f, 0.3810f, 1.0000f, 0.6393f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9669f, 1.0000f, 1.0000f, + 1.0000f, 0.9820f, 0.3366f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9822f, 1.0000f, 1.0000f, + 1.0000f, 0.8649f, 0.4629f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7790f, 1.0000f, 1.0000f, + 1.0000f, 0.9778f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.3232f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9980f, 0.9930f, 0.9682f, 0.8570f, 0.9868f, 0.7773f, 1.0000f, 0.7097f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9975f, 0.9575f, 0.7027f, 0.2178f, 0.9014f, 0.9571f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9865f, 0.7187f, 0.6757f, 0.6451f, 0.9168f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 1.0000f, + 1.0000f, 0.9695f, 0.1934f, 1.0000f, 0.2415f, 0.9627f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, + 1.0000f, 0.9662f, 0.6833f, 1.0000f, 0.1314f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9965f, 0.9965f, + 1.0000f, 0.3622f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9990f, 1.0000f, + 1.0000f, 0.8879f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9888f, 0.9994f, + 1.0000f, 0.6148f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9955f, 0.9978f, 0.9953f, + 1.0000f, 0.9963f, 0.9747f, 0.8084f, 1.0000f, 0.9692f, 0.7295f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9972f, + 1.0000f, 0.9824f, 0.9056f, 0.7479f, 1.0000f, 0.8630f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9947f, + 1.0000f, 0.9909f, 0.4321f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9968f, + 1.0000f, 0.8444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9891f, 0.9896f, + 1.0000f, 0.9356f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9976f, 0.9652f, + 1.0000f, 0.1851f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9941f, 0.9882f, 0.5923f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9856f, 0.7536f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, 0.8822f, 0.8518f, + 1.0000f, 0.9939f, 0.8934f, 0.6932f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8112f, 1.0000f, 1.0000f, + 1.0000f, 0.9982f, 0.8887f, 0.9475f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9922f, 1.0000f, 1.0000f, + 1.0000f, 0.0739f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5704f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8231f, 0.6883f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6956f, 0.9866f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6364f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 1.0000f, 1.0000f, + 1.0000f, 0.9090f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9905f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9906f, 0.9997f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9946f, 0.9996f, 0.9484f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9971f, 0.9559f, 0.8026f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9598f, 0.9451f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9456f, 0.8508f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8659f, 0.9979f, 1.0000f, + 1.0000f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9991f, 0.9979f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9902f, 0.9998f, 0.9345f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9000f, 0.3559f, 0.8985f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8353f, 0.6303f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5548f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8205f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_12x10[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6207f, 1.0000f, 0.9776f, 0.9505f, 0.7947f, 1.0000f, 0.9931f, 0.9859f, 0.4908f, 1.0000f, 0.9972f, 0.9997f, + 1.0000f, 1.0000f, 1.0000f, 0.9980f, 0.7324f, 0.9738f, 0.9791f, 0.9809f, 0.7362f, 0.9959f, 0.9913f, 0.9638f, 0.2599f, 1.0000f, 0.9977f, 0.9994f, + 1.0000f, 1.0000f, 0.9957f, 0.9991f, 0.7556f, 0.9800f, 0.9550f, 0.6656f, 0.5596f, 0.9935f, 0.9709f, 0.7168f, 0.8272f, 1.0000f, 0.9874f, 0.9291f, + 1.0000f, 1.0000f, 0.9961f, 0.9844f, 0.8027f, 0.9422f, 0.9112f, 0.6472f, 0.4826f, 0.9821f, 0.9340f, 0.6631f, 1.0000f, 0.9882f, 0.9592f, 0.9172f, + 1.0000f, 1.0000f, 0.9898f, 0.9717f, 0.7343f, 0.9572f, 0.7065f, 0.6914f, 0.8340f, 0.9606f, 0.7208f, 0.6299f, 1.0000f, 0.9833f, 0.9493f, 0.5704f, + 1.0000f, 0.9922f, 0.9852f, 0.9539f, 0.2317f, 0.9211f, 0.3620f, 0.8999f, 1.0000f, 0.9194f, 0.3453f, 0.9068f, 1.0000f, 0.9687f, 0.8601f, 0.5523f, + 1.0000f, 1.0000f, 0.9535f, 0.9074f, 0.1950f, 0.8782f, 0.0978f, 1.0000f, 1.0000f, 0.9386f, 0.1450f, 1.0000f, 1.0000f, 0.9489f, 0.5947f, 0.3046f, + 1.0000f, 0.9760f, 0.8551f, 0.5845f, 0.6847f, 0.6047f, 0.6176f, 1.0000f, 1.0000f, 0.6731f, 0.7147f, 1.0000f, 1.0000f, 0.9020f, 0.4045f, 0.6500f, + 1.0000f, 1.0000f, 1.0000f, 0.9963f, 1.0000f, 1.0000f, 0.9666f, 0.9296f, 1.0000f, 1.0000f, 0.9856f, 0.9395f, 1.0000f, 1.0000f, 0.9986f, 0.9972f, + 1.0000f, 1.0000f, 0.9960f, 0.9991f, 1.0000f, 0.9589f, 0.9452f, 0.9148f, 1.0000f, 0.9876f, 0.9881f, 0.9061f, 1.0000f, 1.0000f, 0.9956f, 0.9728f, + 1.0000f, 1.0000f, 0.9905f, 0.9837f, 1.0000f, 0.9582f, 0.8941f, 0.6527f, 1.0000f, 0.9733f, 0.9448f, 0.6754f, 1.0000f, 1.0000f, 0.9798f, 0.9528f, + 1.0000f, 0.9871f, 0.9947f, 0.8712f, 1.0000f, 0.9404f, 0.6358f, 0.7106f, 1.0000f, 0.9579f, 0.6605f, 0.6329f, 1.0000f, 0.9813f, 0.9817f, 0.6824f, + 1.0000f, 1.0000f, 0.9750f, 0.9200f, 1.0000f, 0.9532f, 0.4742f, 0.8629f, 1.0000f, 0.9565f, 0.4614f, 0.8620f, 1.0000f, 0.9893f, 0.8948f, 0.5913f, + 1.0000f, 0.9755f, 0.8738f, 0.6144f, 1.0000f, 0.8000f, 0.5739f, 1.0000f, 1.0000f, 0.8307f, 0.3565f, 1.0000f, 1.0000f, 0.9250f, 0.5486f, 0.7470f, + 1.0000f, 0.9787f, 0.8919f, 0.5375f, 1.0000f, 0.7488f, 0.4148f, 1.0000f, 1.0000f, 0.8373f, 0.3164f, 1.0000f, 1.0000f, 0.9265f, 0.4524f, 0.6681f, + 1.0000f, 0.9426f, 0.6980f, 0.2734f, 1.0000f, 0.2862f, 1.0000f, 1.0000f, 1.0000f, 0.4388f, 1.0000f, 1.0000f, 1.0000f, 0.8190f, 0.5560f, 1.0000f, + 1.0000f, 1.0000f, 0.9879f, 0.9975f, 0.9118f, 1.0000f, 0.9501f, 0.9270f, 0.1541f, 1.0000f, 0.7790f, 0.8730f, 0.5300f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9951f, 0.9973f, 0.6801f, 0.9648f, 0.8591f, 0.6778f, 0.1875f, 0.7849f, 0.8284f, 0.6936f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9767f, 0.8903f, 0.8226f, 0.9730f, 0.7505f, 0.5810f, 0.0442f, 0.9047f, 0.7700f, 0.5262f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9863f, 0.9714f, 0.8880f, 0.3340f, 0.9609f, 0.6387f, 0.8166f, 1.0000f, 0.8864f, 0.7044f, 0.7267f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9896f, 0.9485f, 0.4950f, 0.8395f, 0.9034f, 0.3675f, 1.0000f, 0.3782f, 0.8541f, 0.2667f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9430f, 0.8703f, 0.4867f, 0.0177f, 0.7188f, 0.8014f, 1.0000f, 1.0000f, 0.7961f, 0.7685f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.9286f, 0.5109f, 0.2245f, 0.7654f, 0.8521f, 1.0000f, 1.0000f, 1.0000f, 0.8066f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, + 1.0000f, 0.9013f, 0.2798f, 0.4990f, 0.0771f, 0.1074f, 1.0000f, 1.0000f, 1.0000f, 0.2099f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9999f, + 1.0000f, 1.0000f, 0.9887f, 0.9901f, 0.4295f, 1.0000f, 0.8469f, 0.8078f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9740f, 0.9802f, 0.6870f, 0.9516f, 0.8848f, 0.4658f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9557f, 0.9260f, 0.3396f, 0.9228f, 0.5632f, 0.7023f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, + 1.0000f, 0.9561f, 0.9568f, 0.5225f, 0.5148f, 0.9223f, 0.4342f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, + 1.0000f, 0.9866f, 0.8561f, 0.4247f, 1.0000f, 0.8459f, 0.6014f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9916f, 0.9994f, + 1.0000f, 0.8832f, 0.3993f, 0.7286f, 1.0000f, 0.6079f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9932f, + 1.0000f, 0.9160f, 0.2025f, 0.4097f, 1.0000f, 0.7001f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9941f, 0.9915f, + 1.0000f, 0.7606f, 0.3282f, 1.0000f, 1.0000f, 0.3728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9827f, 0.9962f, 0.9054f, + 1.0000f, 0.9994f, 0.9997f, 0.9988f, 0.4479f, 0.9473f, 0.8840f, 0.9575f, 0.9460f, 0.9481f, 0.9041f, 0.9400f, 1.0000f, 0.9936f, 0.9979f, 0.9869f, + 1.0000f, 0.9998f, 0.9998f, 0.9391f, 0.5775f, 0.8790f, 0.9301f, 0.9743f, 1.0000f, 0.9177f, 0.9554f, 0.9825f, 1.0000f, 0.9911f, 0.9929f, 0.9087f, + 1.0000f, 0.9335f, 0.9672f, 0.9654f, 1.0000f, 0.8438f, 0.9619f, 1.0000f, 1.0000f, 0.8129f, 0.9657f, 1.0000f, 1.0000f, 0.7761f, 0.8934f, 0.9925f, + 1.0000f, 0.8956f, 0.9596f, 0.7877f, 1.0000f, 0.9359f, 1.0000f, 1.0000f, 1.0000f, 0.9439f, 1.0000f, 1.0000f, 1.0000f, 0.8872f, 0.9622f, 0.9963f, + 1.0000f, 0.8970f, 0.8648f, 0.9684f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7820f, 0.9435f, 1.0000f, + 1.0000f, 0.8249f, 0.9632f, 0.9735f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9100f, 1.0000f, 1.0000f, + 1.0000f, 0.3889f, 0.8531f, 0.9701f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7589f, 0.9363f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9986f, 0.9757f, 0.8815f, 1.0000f, 0.8153f, 0.8807f, 0.9854f, 1.0000f, 0.7987f, 0.7905f, 0.9136f, 1.0000f, 0.9651f, 0.9782f, 0.9848f, + 1.0000f, 0.9990f, 0.9720f, 0.9330f, 1.0000f, 0.8823f, 0.9669f, 0.9914f, 1.0000f, 0.8318f, 0.8685f, 0.9939f, 1.0000f, 0.9902f, 0.9612f, 0.9769f, + 1.0000f, 0.9354f, 0.7522f, 0.8104f, 1.0000f, 0.9106f, 1.0000f, 1.0000f, 1.0000f, 0.8721f, 1.0000f, 1.0000f, 1.0000f, 0.8261f, 0.9771f, 1.0000f, + 1.0000f, 0.9081f, 0.9234f, 0.9183f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9306f, 0.9937f, 1.0000f, + 1.0000f, 0.3941f, 0.8581f, 0.9806f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9349f, 1.0000f, 1.0000f, + 1.0000f, 0.7669f, 0.9586f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7776f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8406f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9892f, 0.9839f, 0.9689f, 0.8773f, 0.6112f, 0.8610f, 0.9811f, 0.1716f, 0.5980f, 0.6238f, 0.9796f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9635f, 0.9762f, 0.8237f, 0.5187f, 0.7399f, 0.9753f, 1.0000f, 1.0000f, 0.6415f, 0.8449f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.6706f, 0.8765f, 0.9497f, 0.8511f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, + 1.0000f, 0.8141f, 0.9166f, 0.9857f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.7731f, 0.9543f, 1.0000f, 0.7228f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9998f, 0.9996f, + 1.0000f, 0.8978f, 1.0000f, 1.0000f, 0.1169f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9675f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.0559f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9953f, 0.9512f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9868f, 0.9712f, + 1.0000f, 0.9316f, 0.9456f, 0.9603f, 1.0000f, 0.6553f, 0.9124f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, + 1.0000f, 0.9846f, 0.9239f, 0.9692f, 1.0000f, 0.8384f, 0.9969f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, + 1.0000f, 0.7380f, 0.9443f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9924f, 0.9377f, + 1.0000f, 0.8896f, 0.9823f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 0.9927f, 0.7805f, + 1.0000f, 0.7863f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9722f, 0.9835f, 0.9841f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9368f, 0.9725f, 0.8501f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9663f, 0.8040f, 0.8667f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9520f, 0.9372f, 0.9629f, + 1.0000f, 1.0000f, 0.9987f, 0.9999f, 0.9477f, 0.9923f, 0.9154f, 0.7834f, 0.9982f, 0.9920f, 0.9794f, 0.8363f, 1.0000f, 0.9982f, 0.9948f, 0.9899f, + 1.0000f, 0.9990f, 0.9975f, 1.0000f, 0.7086f, 0.9819f, 0.8756f, 1.0000f, 1.0000f, 0.9967f, 0.9189f, 1.0000f, 1.0000f, 0.9971f, 0.9960f, 0.8676f, + 1.0000f, 0.9981f, 0.9509f, 0.9413f, 1.0000f, 0.9842f, 0.9468f, 1.0000f, 1.0000f, 0.9946f, 0.9909f, 1.0000f, 1.0000f, 0.9944f, 0.8116f, 0.9130f, + 1.0000f, 0.9976f, 0.9907f, 0.2986f, 1.0000f, 0.7573f, 1.0000f, 1.0000f, 1.0000f, 0.8490f, 1.0000f, 1.0000f, 1.0000f, 0.9952f, 0.5879f, 1.0000f, + 1.0000f, 0.9978f, 0.8963f, 0.1264f, 1.0000f, 0.8747f, 1.0000f, 1.0000f, 1.0000f, 0.9681f, 1.0000f, 1.0000f, 1.0000f, 0.9660f, 0.8427f, 1.0000f, + 1.0000f, 0.9895f, 0.5337f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5668f, 1.0000f, 1.0000f, + 1.0000f, 0.9918f, 0.2925f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9094f, 1.0000f, 1.0000f, + 1.0000f, 0.8639f, 0.4569f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6444f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9985f, 0.9940f, 1.0000f, 0.9973f, 0.8351f, 0.9903f, 1.0000f, 0.9980f, 0.9326f, 0.9989f, 1.0000f, 1.0000f, 0.9933f, 0.8985f, + 1.0000f, 0.9943f, 0.9955f, 0.9873f, 1.0000f, 0.9745f, 0.7746f, 1.0000f, 1.0000f, 0.9938f, 0.9006f, 1.0000f, 1.0000f, 0.9945f, 0.9789f, 0.7974f, + 1.0000f, 0.9850f, 0.9524f, 0.2388f, 1.0000f, 0.9599f, 1.0000f, 1.0000f, 1.0000f, 0.9942f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.7127f, 1.0000f, + 1.0000f, 0.9773f, 0.7247f, 0.4198f, 1.0000f, 0.6892f, 1.0000f, 1.0000f, 1.0000f, 0.8571f, 1.0000f, 1.0000f, 1.0000f, 0.9382f, 1.0000f, 1.0000f, + 1.0000f, 0.9884f, 0.2172f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9642f, 1.0000f, 1.0000f, + 1.0000f, 0.8480f, 0.4434f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6269f, 1.0000f, 1.0000f, + 1.0000f, 0.9311f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2529f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9999f, 0.9981f, 0.9645f, 0.8911f, 0.9990f, 0.7919f, 1.0000f, 0.5031f, 0.9778f, 0.8992f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9970f, 0.9886f, 0.8417f, 0.0322f, 0.9281f, 0.9678f, 1.0000f, 1.0000f, 0.9706f, 0.9889f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9983f, + 1.0000f, 0.9950f, 0.7891f, 0.9206f, 0.7435f, 0.9142f, 1.0000f, 1.0000f, 1.0000f, 0.9861f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 1.0000f, + 1.0000f, 0.9780f, 0.2459f, 1.0000f, 0.0876f, 0.9764f, 1.0000f, 1.0000f, 1.0000f, 0.9928f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9815f, 0.7453f, 1.0000f, 0.1796f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 0.9993f, + 1.0000f, 0.5449f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 1.0000f, 0.9995f, + 1.0000f, 0.8888f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9974f, 1.0000f, + 1.0000f, 0.3223f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9991f, 0.9878f, + 1.0000f, 0.9952f, 0.9695f, 0.8856f, 1.0000f, 0.9703f, 0.8091f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9964f, + 1.0000f, 0.9864f, 0.9275f, 0.7715f, 1.0000f, 0.8799f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9983f, + 1.0000f, 0.9785f, 0.4700f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9949f, 0.9910f, + 1.0000f, 0.8658f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9977f, + 1.0000f, 0.9626f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9970f, 0.9804f, + 1.0000f, 0.3836f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9954f, 0.9930f, 0.5070f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9546f, 0.5412f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9831f, 0.8202f, 0.7305f, + 1.0000f, 0.9993f, 0.9321f, 0.7622f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7638f, 1.0000f, 1.0000f, + 1.0000f, 0.9906f, 0.9217f, 0.9698f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9345f, 1.0000f, 1.0000f, + 1.0000f, 0.0665f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.4784f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8694f, 0.8214f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, 1.0000f, + 1.0000f, 0.8295f, 0.9829f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7417f, 1.0000f, 1.0000f, 0.8178f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 1.0000f, 0.9996f, + 1.0000f, 0.9255f, 1.0000f, 1.0000f, 0.1357f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, 0.9965f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1629f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9919f, 0.9996f, 0.9966f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9967f, 0.9984f, 0.9616f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, 0.9464f, 0.7933f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9417f, 0.9748f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9027f, 0.8053f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8329f, 0.9992f, 1.0000f, + 1.0000f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9890f, 1.0000f, 0.9984f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 1.0000f, 0.9409f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8926f, 0.3509f, 0.9244f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7540f, 0.6579f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3105f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6958f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; + +const float percentile_table_12x12[2048] = { + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6459f, 1.0000f, 0.9751f, 0.9422f, 0.8309f, 1.0000f, 0.9931f, 0.9934f, 0.5189f, 1.0000f, 0.9984f, 0.9983f, + 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.8017f, 0.9895f, 0.9892f, 0.9881f, 0.7254f, 0.9869f, 0.9932f, 0.9621f, 0.2345f, 1.0000f, 0.9979f, 0.9988f, + 1.0000f, 1.0000f, 0.9882f, 0.9996f, 0.7782f, 0.9961f, 0.9574f, 0.7435f, 0.5997f, 0.9965f, 0.9644f, 0.7057f, 0.8481f, 1.0000f, 0.9914f, 0.9132f, + 1.0000f, 1.0000f, 0.9990f, 0.9919f, 0.8255f, 0.9789f, 0.9227f, 0.6933f, 0.5375f, 0.9716f, 0.9361f, 0.6779f, 1.0000f, 0.9858f, 0.9781f, 0.9066f, + 1.0000f, 1.0000f, 0.9834f, 0.9545f, 0.7662f, 0.9394f, 0.6975f, 0.7216f, 0.8351f, 0.9755f, 0.7097f, 0.6513f, 1.0000f, 0.9863f, 0.9178f, 0.4660f, + 1.0000f, 0.9725f, 0.9933f, 0.9434f, 0.2471f, 0.9189f, 0.3612f, 0.9206f, 1.0000f, 0.9402f, 0.3160f, 0.9155f, 1.0000f, 0.9609f, 0.8537f, 0.4868f, + 1.0000f, 1.0000f, 0.9701f, 0.8698f, 0.3053f, 0.8945f, 0.1802f, 1.0000f, 1.0000f, 0.9097f, 0.1414f, 1.0000f, 1.0000f, 0.9735f, 0.5781f, 0.2594f, + 1.0000f, 0.9799f, 0.8628f, 0.5549f, 0.7235f, 0.6824f, 0.6996f, 1.0000f, 1.0000f, 0.6566f, 0.6802f, 1.0000f, 1.0000f, 0.9138f, 0.3107f, 0.6348f, + 1.0000f, 1.0000f, 1.0000f, 0.9960f, 0.7016f, 1.0000f, 0.9711f, 0.9184f, 0.8830f, 1.0000f, 0.9853f, 0.9378f, 0.6710f, 1.0000f, 0.9975f, 0.9957f, + 1.0000f, 1.0000f, 0.9975f, 0.9999f, 0.8723f, 0.9875f, 0.9486f, 0.9398f, 0.8210f, 0.9647f, 0.9783f, 0.9021f, 0.5149f, 1.0000f, 0.9980f, 0.9926f, + 1.0000f, 1.0000f, 0.9947f, 0.9888f, 0.8966f, 0.9873f, 0.9252f, 0.7117f, 0.6615f, 0.9718f, 0.9475f, 0.7137f, 0.8952f, 1.0000f, 0.9596f, 0.9339f, + 1.0000f, 0.9923f, 0.9870f, 0.8878f, 0.8637f, 0.9464f, 0.6891f, 0.7469f, 0.4040f, 0.9507f, 0.6756f, 0.6869f, 1.0000f, 0.9830f, 0.9704f, 0.5812f, + 1.0000f, 1.0000f, 0.9593f, 0.9167f, 0.8068f, 0.9558f, 0.5302f, 0.8806f, 0.8233f, 0.9825f, 0.4531f, 0.8915f, 1.0000f, 0.9739f, 0.8443f, 0.3467f, + 1.0000f, 0.9836f, 0.8757f, 0.5651f, 0.2714f, 0.7977f, 0.6291f, 1.0000f, 1.0000f, 0.8116f, 0.4268f, 1.0000f, 1.0000f, 0.9109f, 0.3660f, 0.6540f, + 1.0000f, 0.9921f, 0.9172f, 0.5515f, 0.5480f, 0.7737f, 0.5446f, 1.0000f, 1.0000f, 0.8341f, 0.3317f, 1.0000f, 1.0000f, 0.9161f, 0.2772f, 0.5265f, + 1.0000f, 0.9531f, 0.7273f, 0.2944f, 0.7452f, 0.4618f, 1.0000f, 1.0000f, 1.0000f, 0.3755f, 1.0000f, 1.0000f, 1.0000f, 0.8092f, 0.3851f, 1.0000f, + 1.0000f, 1.0000f, 0.9887f, 0.9982f, 0.9281f, 1.0000f, 0.9658f, 0.9352f, 0.1329f, 1.0000f, 0.9864f, 0.9410f, 0.5030f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9988f, 0.9984f, 0.6954f, 0.9479f, 0.8814f, 0.7157f, 0.2014f, 0.9811f, 0.9453f, 0.7796f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9809f, 0.9084f, 0.8663f, 0.9661f, 0.8030f, 0.6263f, 0.0965f, 0.9913f, 0.7895f, 0.5717f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9680f, 0.9757f, 0.9059f, 0.3993f, 0.9748f, 0.6663f, 0.8592f, 1.0000f, 0.9688f, 0.6912f, 0.7937f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9706f, 0.9639f, 0.5227f, 0.8500f, 0.9247f, 0.3368f, 1.0000f, 0.4827f, 0.9335f, 0.1946f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9561f, 0.8619f, 0.4909f, 0.0437f, 0.7752f, 0.8518f, 1.0000f, 1.0000f, 0.7347f, 0.7767f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.9677f, 0.5749f, 0.2886f, 0.7291f, 0.8372f, 1.0000f, 1.0000f, 1.0000f, 0.8681f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9996f, + 1.0000f, 0.9313f, 0.3265f, 0.6234f, 0.1063f, 0.2147f, 1.0000f, 1.0000f, 1.0000f, 0.1153f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9978f, 1.0000f, + 1.0000f, 1.0000f, 0.9856f, 0.9986f, 0.4990f, 1.0000f, 0.8413f, 0.8128f, 1.0000f, 1.0000f, 0.9348f, 0.8452f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9954f, 0.9803f, 0.4949f, 0.9457f, 0.9257f, 0.5339f, 1.0000f, 0.9872f, 0.9691f, 0.6591f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9721f, 0.9272f, 0.4087f, 0.9641f, 0.5875f, 0.7631f, 1.0000f, 0.9535f, 0.5843f, 0.6687f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, + 1.0000f, 0.9723f, 0.9445f, 0.6147f, 0.6206f, 0.8789f, 0.4703f, 1.0000f, 1.0000f, 0.9149f, 0.4444f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9890f, + 1.0000f, 0.9841f, 0.8610f, 0.4313f, 1.0000f, 0.8176f, 0.6117f, 1.0000f, 1.0000f, 0.8740f, 0.2408f, 1.0000f, 1.0000f, 1.0000f, 0.9986f, 0.9985f, + 1.0000f, 0.8994f, 0.4178f, 0.7486f, 1.0000f, 0.6431f, 1.0000f, 1.0000f, 1.0000f, 0.6404f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 0.9916f, + 1.0000f, 0.9300f, 0.2829f, 0.5584f, 1.0000f, 0.7417f, 1.0000f, 1.0000f, 1.0000f, 0.8298f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9963f, 0.9964f, + 1.0000f, 0.8244f, 0.4575f, 1.0000f, 1.0000f, 0.4744f, 1.0000f, 1.0000f, 1.0000f, 0.2214f, 1.0000f, 1.0000f, 1.0000f, 0.9944f, 0.9900f, 0.8838f, + 1.0000f, 0.9996f, 0.9997f, 0.9984f, 0.4786f, 0.9295f, 0.8862f, 0.9633f, 0.9490f, 0.9672f, 0.9200f, 0.9730f, 1.0000f, 0.9956f, 0.9946f, 0.9742f, + 1.0000f, 0.9999f, 0.9991f, 0.9603f, 0.5967f, 0.8870f, 0.9430f, 0.9650f, 1.0000f, 0.9322f, 0.9555f, 0.9787f, 1.0000f, 0.9815f, 0.9866f, 0.8893f, + 1.0000f, 0.9482f, 0.9813f, 0.9524f, 1.0000f, 0.8715f, 0.9805f, 1.0000f, 1.0000f, 0.8773f, 0.9766f, 1.0000f, 1.0000f, 0.7196f, 0.8930f, 0.9764f, + 1.0000f, 0.8959f, 0.9606f, 0.7825f, 1.0000f, 0.9460f, 1.0000f, 1.0000f, 1.0000f, 0.9630f, 1.0000f, 1.0000f, 1.0000f, 0.8383f, 0.9521f, 0.9948f, + 1.0000f, 0.8490f, 0.8140f, 0.9565f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7502f, 0.9386f, 1.0000f, + 1.0000f, 0.7810f, 0.9382f, 0.9636f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8320f, 1.0000f, 1.0000f, + 1.0000f, 0.2999f, 0.8646f, 0.9777f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7600f, 0.9696f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9997f, 0.9850f, 0.9027f, 0.5618f, 0.8055f, 0.9001f, 0.9974f, 0.9685f, 0.8509f, 0.8556f, 0.9959f, 1.0000f, 0.9441f, 0.9774f, 0.9762f, + 1.0000f, 0.9965f, 0.9693f, 0.9242f, 0.6376f, 0.8423f, 0.9666f, 0.9922f, 1.0000f, 0.8987f, 0.9669f, 0.9991f, 1.0000f, 0.9938f, 0.9528f, 0.9891f, + 1.0000f, 0.9612f, 0.7923f, 0.8574f, 1.0000f, 0.9237f, 1.0000f, 1.0000f, 1.0000f, 0.9344f, 1.0000f, 1.0000f, 1.0000f, 0.7535f, 0.9768f, 1.0000f, + 1.0000f, 0.9449f, 0.9374f, 0.9517f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9040f, 0.9955f, 1.0000f, + 1.0000f, 0.3213f, 0.8923f, 0.9708f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8765f, 1.0000f, 1.0000f, + 1.0000f, 0.7552f, 0.9548f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7839f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8706f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9918f, 0.9807f, 0.9627f, 0.8546f, 0.6176f, 0.8781f, 0.9819f, 0.0866f, 0.6733f, 0.8288f, 0.9937f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9744f, 0.9737f, 0.8199f, 0.3803f, 0.7519f, 0.9930f, 1.0000f, 1.0000f, 0.7615f, 0.9885f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.7365f, 0.9090f, 0.9793f, 0.8277f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8528f, 0.9568f, 0.9837f, 0.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9990f, 0.9999f, + 1.0000f, 0.7722f, 0.9414f, 1.0000f, 0.6847f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9977f, 0.9969f, + 1.0000f, 0.8885f, 1.0000f, 1.0000f, 0.0762f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 0.9624f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1243f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9920f, 0.9276f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9827f, 0.9500f, + 1.0000f, 0.9304f, 0.9600f, 0.9571f, 1.0000f, 0.6639f, 0.9078f, 1.0000f, 1.0000f, 0.7310f, 0.8980f, 1.0000f, 1.0000f, 1.0000f, 0.9989f, 1.0000f, + 1.0000f, 0.9896f, 0.9211f, 0.9675f, 1.0000f, 0.8362f, 0.9969f, 1.0000f, 1.0000f, 0.8004f, 0.9848f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, + 1.0000f, 0.7853f, 0.9779f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9941f, 0.9331f, + 1.0000f, 0.9120f, 0.9894f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9999f, 0.9899f, 0.7867f, + 1.0000f, 0.8222f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9365f, 0.9746f, 0.9653f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9034f, 0.9538f, 0.7964f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9581f, 0.8043f, 0.8462f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9357f, 0.9493f, 0.9390f, + 1.0000f, 1.0000f, 0.9983f, 0.9987f, 0.9103f, 0.9995f, 0.9426f, 0.8973f, 0.9978f, 0.9971f, 0.9839f, 0.8152f, 1.0000f, 0.9945f, 0.9970f, 0.9795f, + 1.0000f, 0.9991f, 0.9998f, 0.9973f, 0.7647f, 0.9728f, 0.9114f, 1.0000f, 1.0000f, 0.9976f, 0.9216f, 0.9999f, 1.0000f, 0.9981f, 0.9844f, 0.8164f, + 1.0000f, 0.9999f, 0.9828f, 0.9541f, 1.0000f, 0.9797f, 0.9664f, 1.0000f, 1.0000f, 0.9785f, 0.9590f, 1.0000f, 1.0000f, 0.9980f, 0.7568f, 0.8854f, + 1.0000f, 0.9843f, 0.9832f, 0.4132f, 1.0000f, 0.8187f, 1.0000f, 1.0000f, 1.0000f, 0.8393f, 1.0000f, 1.0000f, 1.0000f, 0.9683f, 0.4401f, 1.0000f, + 1.0000f, 0.9952f, 0.8565f, 0.0654f, 1.0000f, 0.9144f, 1.0000f, 1.0000f, 1.0000f, 0.9126f, 1.0000f, 1.0000f, 1.0000f, 0.9867f, 0.7177f, 1.0000f, + 1.0000f, 0.9884f, 0.2654f, 0.9999f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.5906f, 1.0000f, 1.0000f, + 1.0000f, 0.9927f, 0.1728f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8672f, 1.0000f, 1.0000f, + 1.0000f, 0.8731f, 0.5070f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.3946f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 0.9986f, 1.0000f, 0.9929f, 0.9979f, 0.8655f, 0.9861f, 0.9990f, 0.9902f, 0.9262f, 0.9732f, 1.0000f, 0.9972f, 0.9943f, 0.8583f, + 1.0000f, 0.9939f, 0.9846f, 0.9698f, 0.9047f, 0.9772f, 0.7991f, 1.0000f, 1.0000f, 0.9948f, 0.8403f, 1.0000f, 1.0000f, 0.9967f, 0.9878f, 0.7328f, + 1.0000f, 0.9942f, 0.9587f, 0.3898f, 1.0000f, 0.9791f, 1.0000f, 1.0000f, 1.0000f, 0.9851f, 1.0000f, 1.0000f, 1.0000f, 0.9958f, 0.6087f, 1.0000f, + 1.0000f, 0.9406f, 0.7707f, 0.5410f, 1.0000f, 0.7881f, 1.0000f, 1.0000f, 1.0000f, 0.7077f, 1.0000f, 1.0000f, 1.0000f, 0.9286f, 1.0000f, 1.0000f, + 1.0000f, 0.9910f, 0.2280f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9511f, 1.0000f, 1.0000f, + 1.0000f, 0.8601f, 0.4223f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.2533f, 1.0000f, 1.0000f, + 1.0000f, 0.9821f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.2080f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9959f, 0.9713f, 0.9753f, 0.8471f, 0.9879f, 0.8331f, 1.0000f, 0.3708f, 0.9967f, 0.9014f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9966f, 0.9877f, 0.8689f, 0.0321f, 0.9577f, 0.9770f, 1.0000f, 1.0000f, 0.9817f, 0.9940f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9992f, + 1.0000f, 0.9928f, 0.8080f, 0.9497f, 0.7037f, 0.9222f, 1.0000f, 1.0000f, 1.0000f, 0.9859f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9615f, 0.5110f, 1.0000f, 0.0206f, 0.9907f, 1.0000f, 1.0000f, 1.0000f, 0.9801f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9973f, 0.9992f, + 1.0000f, 0.9369f, 0.7400f, 1.0000f, 0.1654f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9991f, 0.9962f, + 1.0000f, 0.5684f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 0.9909f, 1.0000f, + 1.0000f, 0.8938f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9968f, 0.9992f, + 1.0000f, 0.4488f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9987f, 0.9955f, 0.9898f, + 1.0000f, 0.9936f, 0.9855f, 0.8900f, 1.0000f, 0.9584f, 0.7950f, 1.0000f, 1.0000f, 0.9953f, 0.9072f, 1.0000f, 1.0000f, 1.0000f, 0.9997f, 1.0000f, + 1.0000f, 0.9905f, 0.9655f, 0.8266f, 1.0000f, 0.9232f, 1.0000f, 1.0000f, 1.0000f, 0.9504f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 0.9981f, 0.6320f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9998f, 1.0000f, + 1.0000f, 0.9008f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9823f, 0.9618f, + 1.0000f, 0.9195f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9988f, 0.9935f, 0.9468f, + 1.0000f, 0.3515f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9915f, 0.9904f, 0.3418f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9985f, 0.9471f, 0.4357f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9924f, 0.7909f, 0.6057f, + 1.0000f, 0.9971f, 0.9903f, 0.8822f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.7382f, 1.0000f, 1.0000f, + 1.0000f, 0.9989f, 0.9912f, 0.9759f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9326f, 1.0000f, 1.0000f, + 1.0000f, 0.1874f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.5936f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.9290f, 0.8748f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8104f, 0.9963f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 0.8433f, 1.0000f, 1.0000f, 0.7692f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, + 1.0000f, 0.9514f, 1.0000f, 1.0000f, 0.0546f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9993f, 1.0000f, 0.9949f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1497f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9976f, 0.9950f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, 0.9994f, 0.9418f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9908f, 0.9309f, 0.7584f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9951f, 0.9267f, 0.9318f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9437f, 0.7677f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8797f, 0.9994f, 1.0000f, + 1.0000f, 0.9982f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9994f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9995f, 0.9995f, 0.9551f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.9053f, 0.3564f, 0.8908f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.8846f, 0.6486f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.1577f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 0.6027f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, + 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, 1.0000f, +}; diff --git a/3rdparty/bimg/3rdparty/astc/astc_pick_best_endpoint_format.cpp b/3rdparty/bimg/3rdparty/astc/astc_pick_best_endpoint_format.cpp new file mode 100644 index 00000000000..5c6360ddc91 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_pick_best_endpoint_format.cpp @@ -0,0 +1,938 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions to pick the best ASTC endpoint format for a given block. + */ +/*----------------------------------------------------------------------------*/ +#include "astc_codec_internals.h" + +#ifdef DEBUG_PRINT_DIAGNOSTICS + #include +#endif + +#include + +/* + functions to determine, for a given partitioning, which color endpoint formats are the best to use. + + */ + + +// for a given partition, compute for every (integer-component-count, quantization-level) +// the color error. + + +static void compute_color_error_for_every_integer_count_and_quantization_level(int encode_hdr_rgb, // 1 = perform HDR encoding, 0 = perform LDR encoding. + int encode_hdr_alpha, int partition_index, const partition_info * pi, + const encoding_choice_errors * eci, // pointer to the structure for the CURRENT partition. + const endpoints * ep, float4 error_weightings[4], + // arrays to return results back through. + float best_error[21][4], int format_of_choice[21][4]) +{ + int i, j; + int partition_size = pi->texels_per_partition[partition_index]; + + static const float baseline_quant_error[21] = { + (65536.0f * 65536.0f / 18.0f), // 2 values, 1 step + (65536.0f * 65536.0f / 18.0f) / (2 * 2), // 3 values, 2 steps + (65536.0f * 65536.0f / 18.0f) / (3 * 3), // 4 values, 3 steps + (65536.0f * 65536.0f / 18.0f) / (4 * 4), // 5 values + (65536.0f * 65536.0f / 18.0f) / (5 * 5), + (65536.0f * 65536.0f / 18.0f) / (7 * 7), + (65536.0f * 65536.0f / 18.0f) / (9 * 9), + (65536.0f * 65536.0f / 18.0f) / (11 * 11), + (65536.0f * 65536.0f / 18.0f) / (15 * 15), + (65536.0f * 65536.0f / 18.0f) / (19 * 19), + (65536.0f * 65536.0f / 18.0f) / (23 * 23), + (65536.0f * 65536.0f / 18.0f) / (31 * 31), + (65536.0f * 65536.0f / 18.0f) / (39 * 39), + (65536.0f * 65536.0f / 18.0f) / (47 * 47), + (65536.0f * 65536.0f / 18.0f) / (63 * 63), + (65536.0f * 65536.0f / 18.0f) / (79 * 79), + (65536.0f * 65536.0f / 18.0f) / (95 * 95), + (65536.0f * 65536.0f / 18.0f) / (127 * 127), + (65536.0f * 65536.0f / 18.0f) / (159 * 159), + (65536.0f * 65536.0f / 18.0f) / (191 * 191), + (65536.0f * 65536.0f / 18.0f) / (255 * 255) + }; + + float4 ep0 = ep->endpt0[partition_index]; + float4 ep1 = ep->endpt1[partition_index]; + + float ep0_max = MAX(MAX(ep0.x, ep0.y), ep0.z); + float ep0_min = MIN(MIN(ep0.x, ep0.y), ep0.z); + float ep1_max = MAX(MAX(ep1.x, ep1.y), ep1.z); + float ep1_min = MIN(MIN(ep1.x, ep1.y), ep1.z); + + ep0_min = MAX(ep0_min, 0.0f); + ep1_min = MAX(ep1_min, 0.0f); + ep0_max = MAX(ep0_max, 1e-10f); + ep1_max = MAX(ep1_max, 1e-10f); + + float4 error_weight = error_weightings[partition_index]; + + float error_weight_rgbsum = error_weight.x + error_weight.y + error_weight.z; + + float range_upper_limit_rgb = encode_hdr_rgb ? 61440.0f : 65535.0f; + float range_upper_limit_alpha = encode_hdr_alpha ? 61440.0f : 65535.0f; + + // it is possible to get endpoint colors significantly outside [0,upper-limit] + // even if the input data are safely contained in [0,upper-limit]; + // we need to add an error term for this situation, + float4 ep0_range_error_high; + float4 ep1_range_error_high; + float4 ep0_range_error_low; + float4 ep1_range_error_low; + + ep0_range_error_high.x = MAX(0.0f, ep0.x - range_upper_limit_rgb); + ep0_range_error_high.y = MAX(0.0f, ep0.y - range_upper_limit_rgb); + ep0_range_error_high.z = MAX(0.0f, ep0.z - range_upper_limit_rgb); + ep0_range_error_high.w = MAX(0.0f, ep0.w - range_upper_limit_alpha); + ep1_range_error_high.x = MAX(0.0f, ep1.x - range_upper_limit_rgb); + ep1_range_error_high.y = MAX(0.0f, ep1.y - range_upper_limit_rgb); + ep1_range_error_high.z = MAX(0.0f, ep1.z - range_upper_limit_rgb); + ep1_range_error_high.w = MAX(0.0f, ep1.w - range_upper_limit_alpha); + + ep0_range_error_low.x = MIN(0.0f, ep0.x); + ep0_range_error_low.y = MIN(0.0f, ep0.y); + ep0_range_error_low.z = MIN(0.0f, ep0.z); + ep0_range_error_low.w = MIN(0.0f, ep0.w); + ep1_range_error_low.x = MIN(0.0f, ep1.x); + ep1_range_error_low.y = MIN(0.0f, ep1.y); + ep1_range_error_low.z = MIN(0.0f, ep1.z); + ep1_range_error_low.w = MIN(0.0f, ep1.w); + + float4 sum_range_error = + (ep0_range_error_low * ep0_range_error_low) + (ep1_range_error_low * ep1_range_error_low) + (ep0_range_error_high * ep0_range_error_high) + (ep1_range_error_high * ep1_range_error_high); + float rgb_range_error = dot(sum_range_error.xyz, error_weight.xyz) * 0.5f * partition_size; + float alpha_range_error = sum_range_error.w * error_weight.w * 0.5f * partition_size; + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : partition=%d\nrgb-error_wt=%f alpha_error_wt=%f\n", __func__, partition_index, error_weight_rgbsum, error_weight.w); + + printf("ep0 = %f %f %f %f\n", ep0.x, ep0.y, ep0.z, ep0.w); + printf("ep1 = %f %f %f %f\n", ep1.x, ep1.y, ep1.z, ep1.w); + + + printf("rgb_range_error = %f, alpha_range_error = %f\n", rgb_range_error, alpha_range_error); + + printf("rgb-luma-error: %f\n", eci->rgb_luma_error); + } + #endif + + if (encode_hdr_rgb) + { + + // collect some statistics + float af, cf; + if (ep1.x > ep1.y && ep1.x > ep1.z) + { + af = ep1.x; + cf = ep1.x - ep0.x; + } + else if (ep1.y > ep1.z) + { + af = ep1.y; + cf = ep1.y - ep0.y; + } + else + { + af = ep1.z; + cf = ep1.z - ep0.z; + } + + float bf = af - ep1_min; // estimate of color-component spread in high endpoint color + float3 prd = ep1.xyz - float3(cf, cf, cf); + float3 pdif = prd - ep0.xyz; + // estimate of color-component spread in low endpoint color + float df = MAX(MAX(fabs(pdif.x), fabs(pdif.y)), fabs(pdif.z)); + + int b = (int)bf; + int c = (int)cf; + int d = (int)df; + + + // determine which one of the 6 submodes is likely to be used in + // case of an RGBO-mode + int rgbo_mode = 5; // 7 bits per component + // mode 4: 8 7 6 + if (b < 32768 && c < 16384) + rgbo_mode = 4; + // mode 3: 9 6 7 + if (b < 8192 && c < 16384) + rgbo_mode = 3; + // mode 2: 10 5 8 + if (b < 2048 && c < 16384) + rgbo_mode = 2; + // mode 1: 11 6 5 + if (b < 2048 && c < 1024) + rgbo_mode = 1; + // mode 0: 11 5 7 + if (b < 1024 && c < 4096) + rgbo_mode = 0; + + // determine which one of the 9 submodes is likely to be used in + // case of an RGB-mode. + int rgb_mode = 8; // 8 bits per component, except 7 bits for blue + + // mode 0: 9 7 6 7 + if (b < 16384 && c < 8192 && d < 8192) + rgb_mode = 0; + // mode 1: 9 8 6 6 + if (b < 32768 && c < 8192 && d < 4096) + rgb_mode = 1; + // mode 2: 10 6 7 7 + if (b < 4096 && c < 8192 && d < 4096) + rgb_mode = 2; + // mode 3: 10 7 7 6 + if (b < 8192 && c < 8192 && d < 2048) + rgb_mode = 3; + // mode 4: 11 8 6 5 + if (b < 8192 && c < 2048 && d < 512) + rgb_mode = 4; + // mode 5: 11 6 8 6 + if (b < 2048 && c < 8192 && d < 1024) + rgb_mode = 5; + // mode 6: 12 7 7 5 + if (b < 2048 && c < 2048 && d < 256) + rgb_mode = 6; + // mode 7: 12 6 7 6 + if (b < 1024 && c < 2048 && d < 512) + rgb_mode = 7; + + + static const float rgbo_error_scales[6] = { 4.0f, 4.0f, 16.0f, 64.0f, 256.0f, 1024.0f }; + static const float rgb_error_scales[9] = { 64.0f, 64.0f, 16.0f, 16.0f, 4.0f, 4.0f, 1.0f, 1.0f, 384.0f }; + + float mode7mult = rgbo_error_scales[rgbo_mode] * 0.0015f; // empirically determined .... + float mode11mult = rgb_error_scales[rgb_mode] * 0.010f; // empirically determined .... + + + float lum_high = (ep1.x + ep1.y + ep1.z) * (1.0f / 3.0f); + float lum_low = (ep0.x + ep0.y + ep0.z) * (1.0f / 3.0f); + float lumdif = lum_high - lum_low; + float mode23mult = lumdif < 960 ? 4.0f : lumdif < 3968 ? 16.0f : 128.0f; + + mode23mult *= 0.0005f; // empirically determined .... + + + + // pick among the available HDR endpoint modes + for (i = 0; i < 8; i++) + { + best_error[i][3] = 1e30f; + format_of_choice[i][3] = encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA; + best_error[i][2] = 1e30f; + format_of_choice[i][2] = FMT_HDR_RGB; + best_error[i][1] = 1e30f; + format_of_choice[i][1] = FMT_HDR_RGB_SCALE; + best_error[i][0] = 1e30f; + format_of_choice[i][0] = FMT_HDR_LUMINANCE_LARGE_RANGE; + } + + + for (i = 8; i < 21; i++) + { + // base_quant_error should depend on the scale-factor that would be used + // during actual encode of the color value. + + float base_quant_error = baseline_quant_error[i] * partition_size * 1.0f; + float rgb_quantization_error = error_weight_rgbsum * base_quant_error * 2.0f; + float alpha_quantization_error = error_weight.w * base_quant_error * 2.0f; + float rgba_quantization_error = rgb_quantization_error + alpha_quantization_error; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("rgba-quant = %f can_offset_encode=%d\n", rgba_quantization_error, eci->can_offset_encode); + #endif + + // for 8 integers, we have two encodings: one with HDR alpha and another one + // with LDR alpha. + + float full_hdr_rgba_error = rgba_quantization_error + rgb_range_error + alpha_range_error; + best_error[i][3] = full_hdr_rgba_error; + format_of_choice[i][3] = encode_hdr_alpha ? FMT_HDR_RGBA : FMT_HDR_RGB_LDR_ALPHA; + + // for 6 integers, we have one HDR-RGB encoding + float full_hdr_rgb_error = (rgb_quantization_error * mode11mult) + rgb_range_error + eci->alpha_drop_error; + best_error[i][2] = full_hdr_rgb_error; + format_of_choice[i][2] = FMT_HDR_RGB; + + // for 4 integers, we have one HDR-RGB-Scale encoding + float hdr_rgb_scale_error = (rgb_quantization_error * mode7mult) + rgb_range_error + eci->alpha_drop_error + eci->rgb_luma_error; + + best_error[i][1] = hdr_rgb_scale_error; + format_of_choice[i][1] = FMT_HDR_RGB_SCALE; + + // for 2 integers, we assume luminance-with-large-range + float hdr_luminance_error = (rgb_quantization_error * mode23mult) + rgb_range_error + eci->alpha_drop_error + eci->luminance_error; + best_error[i][0] = hdr_luminance_error; + format_of_choice[i][0] = FMT_HDR_LUMINANCE_LARGE_RANGE; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + for (j = 0; j < 4; j++) + { + printf("(hdr) quant-level=%d ints=%d format=%d error=%f\n", i, j, format_of_choice[i][j], best_error[i][j]); + } + } + #endif + } + } + + + else + { + for (i = 0; i < 4; i++) + { + best_error[i][3] = 1e30f; + best_error[i][2] = 1e30f; + best_error[i][1] = 1e30f; + best_error[i][0] = 1e30f; + + format_of_choice[i][3] = FMT_RGBA; + format_of_choice[i][2] = FMT_RGB; + format_of_choice[i][1] = FMT_RGB_SCALE; + format_of_choice[i][0] = FMT_LUMINANCE; + } + + + // pick among the available LDR endpoint modes + for (i = 4; i < 21; i++) + { + float base_quant_error = baseline_quant_error[i] * partition_size * 1.0f; + float rgb_quantization_error = error_weight_rgbsum * base_quant_error; + float alpha_quantization_error = error_weight.w * base_quant_error; + float rgba_quantization_error = rgb_quantization_error + alpha_quantization_error; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + printf("rgba-quant = %f can_offset_encode=%d\n", rgba_quantization_error, eci->can_offset_encode); + #endif + + // for 8 integers, the available encodings are: + // full LDR RGB-Alpha + float full_ldr_rgba_error = rgba_quantization_error; + if (eci->can_blue_contract) + full_ldr_rgba_error *= 0.625f; + if (eci->can_offset_encode && i <= 18) + full_ldr_rgba_error *= 0.5f; + full_ldr_rgba_error += rgb_range_error + alpha_range_error; + + best_error[i][3] = full_ldr_rgba_error; + format_of_choice[i][3] = FMT_RGBA; + + // for 6 integers, we have: + // - an LDR-RGB encoding + // - an RGBS + Alpha encoding (LDR) + + float full_ldr_rgb_error = rgb_quantization_error; + if (eci->can_blue_contract) + full_ldr_rgb_error *= 0.5f; + if (eci->can_offset_encode && i <= 18) + full_ldr_rgb_error *= 0.25f; + full_ldr_rgb_error += eci->alpha_drop_error + rgb_range_error; + + float rgbs_alpha_error = rgba_quantization_error + eci->rgb_scale_error + rgb_range_error + alpha_range_error; + + if (rgbs_alpha_error < full_ldr_rgb_error) + { + best_error[i][2] = rgbs_alpha_error; + format_of_choice[i][2] = FMT_RGB_SCALE_ALPHA; + } + else + { + best_error[i][2] = full_ldr_rgb_error; + format_of_choice[i][2] = FMT_RGB; + } + + + // for 4 integers, we have a Luminance-Alpha encoding and the RGBS encoding + float ldr_rgbs_error = rgb_quantization_error + eci->alpha_drop_error + eci->rgb_scale_error + rgb_range_error; + + float lum_alpha_error = rgba_quantization_error + eci->luminance_error + rgb_range_error + alpha_range_error; + + if (ldr_rgbs_error < lum_alpha_error) + { + best_error[i][1] = ldr_rgbs_error; + format_of_choice[i][1] = FMT_RGB_SCALE; + } + else + { + best_error[i][1] = lum_alpha_error; + format_of_choice[i][1] = FMT_LUMINANCE_ALPHA; + } + + + // for 2 integers, we have a Luminance-encoding and an Alpha-encoding. + float luminance_error = rgb_quantization_error + eci->alpha_drop_error + eci->luminance_error + rgb_range_error; + + best_error[i][0] = luminance_error; + format_of_choice[i][0] = FMT_LUMINANCE; + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + for (j = 0; j < 4; j++) + { + printf(" (ldr) quant-level=%d ints=%d format=%d error=%f\n", i, j, format_of_choice[i][j], best_error[i][j]); + } + } + #endif + } + } +} + + + +// for 1 partition, find the best combination (one format + a quantization level) for a given bitcount + +static void one_partition_find_best_combination_for_bitcount(float combined_best_error[21][4], + int formats_of_choice[21][4], int bits_available, int *best_quantization_level, int *best_formats, float *error_of_best_combination) +{ + int i; + int best_integer_count = -1; + float best_integer_count_error = 1e20f; + for (i = 0; i < 4; i++) + { + // compute the quantization level for a given number of integers and a given number of bits. + int quantization_level = quantization_mode_table[i + 1][bits_available]; + if (quantization_level == -1) + continue; // used to indicate the case where we don't have enough bits to represent a given endpoint format at all. + if (combined_best_error[quantization_level][i] < best_integer_count_error) + { + best_integer_count_error = combined_best_error[quantization_level][i]; + best_integer_count = i; + } + } + + int ql = quantization_mode_table[best_integer_count + 1][bits_available]; + + *best_quantization_level = ql; + *error_of_best_combination = best_integer_count_error; + if (ql >= 0) + *best_formats = formats_of_choice[ql][best_integer_count]; + else + *best_formats = FMT_LUMINANCE; + +} + + + +// for 2 partitions, find the best format combinations for every (quantization-mode, integer-count) combination + +static void two_partitions_find_best_combination_for_every_quantization_and_integer_count(float best_error[2][21][4], // indexed by (partition, quant-level, integer-pair-count-minus-1) + int format_of_choice[2][21][4], + float combined_best_error[21][7], // indexed by (quant-level, integer-pair-count-minus-2) + int formats_of_choice[21][7][2]) +{ + int i, j; + + for (i = 0; i < 21; i++) + for (j = 0; j < 7; j++) + combined_best_error[i][j] = 1e30f; + + int quant; + for (quant = 5; quant < 21; quant++) + { + for (i = 0; i < 4; i++) // integer-count for first endpoint-pair + { + for (j = 0; j < 4; j++) // integer-count for second endpoint-pair + { + int low2 = MIN(i, j); + int high2 = MAX(i, j); + if ((high2 - low2) > 1) + continue; + + int intcnt = i + j; + float errorterm = MIN(best_error[0][quant][i] + best_error[1][quant][j], 1e10f); + if (errorterm <= combined_best_error[quant][intcnt]) + { + combined_best_error[quant][intcnt] = errorterm; + formats_of_choice[quant][intcnt][0] = format_of_choice[0][quant][i]; + formats_of_choice[quant][intcnt][1] = format_of_choice[1][quant][j]; + } + } + } + } +} + + +// for 2 partitions, find the best combination (two formats + a quantization level) for a given bitcount + +static void two_partitions_find_best_combination_for_bitcount(float combined_best_error[21][7], + int formats_of_choice[21][7][2], + int bits_available, int *best_quantization_level, int *best_quantization_level_mod, int *best_formats, float *error_of_best_combination) +{ + int i; + + int best_integer_count = 0; + float best_integer_count_error = 1e20f; + int integer_count; + + for (integer_count = 2; integer_count <= 8; integer_count++) + { + // compute the quantization level for a given number of integers and a given number of bits. + int quantization_level = quantization_mode_table[integer_count][bits_available]; + if (quantization_level == -1) + break; // used to indicate the case where we don't have enough bits to represent a given endpoint format at all. + float integer_count_error = combined_best_error[quantization_level][integer_count - 2]; + if (integer_count_error < best_integer_count_error) + { + best_integer_count_error = integer_count_error; + best_integer_count = integer_count; + } + } + + int ql = quantization_mode_table[best_integer_count][bits_available]; + int ql_mod = quantization_mode_table[best_integer_count][bits_available + 2]; + + *best_quantization_level = ql; + *best_quantization_level_mod = ql_mod; + *error_of_best_combination = best_integer_count_error; + if (ql >= 0) + { + for (i = 0; i < 2; i++) + best_formats[i] = formats_of_choice[ql][best_integer_count - 2][i]; + } + else + { + for (i = 0; i < 2; i++) + best_formats[i] = FMT_LUMINANCE; + } +} + + + + +// for 3 partitions, find the best format combinations for every (quantization-mode, integer-count) combination + +static void three_partitions_find_best_combination_for_every_quantization_and_integer_count(float best_error[3][21][4], // indexed by (partition, quant-level, integer-count) + int format_of_choice[3][21][4], float combined_best_error[21][10], int formats_of_choice[21][10][3]) +{ + int i, j, k; + + for (i = 0; i < 21; i++) + for (j = 0; j < 10; j++) + combined_best_error[i][j] = 1e30f; + + int quant; + for (quant = 5; quant < 21; quant++) + { + for (i = 0; i < 4; i++) // integer-count for first endpoint-pair + { + for (j = 0; j < 4; j++) // integer-count for second endpoint-pair + { + int low2 = MIN(i, j); + int high2 = MAX(i, j); + if ((high2 - low2) > 1) + continue; + for (k = 0; k < 4; k++) // integer-count for third endpoint-pair + { + int low3 = MIN(k, low2); + int high3 = MAX(k, high2); + if ((high3 - low3) > 1) + continue; + + int intcnt = i + j + k; + float errorterm = MIN(best_error[0][quant][i] + best_error[1][quant][j] + best_error[2][quant][k], 1e10f); + if (errorterm <= combined_best_error[quant][intcnt]) + { + combined_best_error[quant][intcnt] = errorterm; + formats_of_choice[quant][intcnt][0] = format_of_choice[0][quant][i]; + formats_of_choice[quant][intcnt][1] = format_of_choice[1][quant][j]; + formats_of_choice[quant][intcnt][2] = format_of_choice[2][quant][k]; + } + } + } + } + } +} + + +// for 3 partitions, find the best combination (three formats + a quantization level) for a given bitcount + +static void three_partitions_find_best_combination_for_bitcount(float combined_best_error[21][10], + int formats_of_choice[21][10][3], + int bits_available, int *best_quantization_level, int *best_quantization_level_mod, int *best_formats, float *error_of_best_combination) +{ + int i; + + int best_integer_count = 0; + float best_integer_count_error = 1e20f; + int integer_count; + + for (integer_count = 3; integer_count <= 9; integer_count++) + { + // compute the quantization level for a given number of integers and a given number of bits. + int quantization_level = quantization_mode_table[integer_count][bits_available]; + if (quantization_level == -1) + break; // used to indicate the case where we don't have enough bits to represent a given endpoint format at all. + float integer_count_error = combined_best_error[quantization_level][integer_count - 3]; + if (integer_count_error < best_integer_count_error) + { + best_integer_count_error = integer_count_error; + best_integer_count = integer_count; + } + } + + int ql = quantization_mode_table[best_integer_count][bits_available]; + int ql_mod = quantization_mode_table[best_integer_count][bits_available + 5]; + + *best_quantization_level = ql; + *best_quantization_level_mod = ql_mod; + *error_of_best_combination = best_integer_count_error; + if (ql >= 0) + { + for (i = 0; i < 3; i++) + best_formats[i] = formats_of_choice[ql][best_integer_count - 3][i]; + } + else + { + for (i = 0; i < 3; i++) + best_formats[i] = FMT_LUMINANCE; + } +} + + + + +// for 4 partitions, find the best format combinations for every (quantization-mode, integer-count) combination + +static void four_partitions_find_best_combination_for_every_quantization_and_integer_count(float best_error[4][21][4], // indexed by (partition, quant-level, integer-count) + int format_of_choice[4][21][4], float combined_best_error[21][13], int formats_of_choice[21][13][4]) +{ + int i, j, k, l; + + for (i = 0; i < 21; i++) + for (j = 0; j < 13; j++) + combined_best_error[i][j] = 1e30f; + + int quant; + for (quant = 5; quant < 21; quant++) + { + for (i = 0; i < 4; i++) // integer-count for first endpoint-pair + { + for (j = 0; j < 4; j++) // integer-count for second endpoint-pair + { + int low2 = MIN(i, j); + int high2 = MAX(i, j); + if ((high2 - low2) > 1) + continue; + for (k = 0; k < 4; k++) // integer-count for third endpoint-pair + { + int low3 = MIN(k, low2); + int high3 = MAX(k, high2); + if ((high3 - low3) > 1) + continue; + for (l = 0; l < 4; l++) // integer-count for fourth endpoint-pair + { + int low4 = MIN(l, low3); + int high4 = MAX(l, high3); + if ((high4 - low4) > 1) + continue; + + int intcnt = i + j + k + l; + float errorterm = MIN(best_error[0][quant][i] + best_error[1][quant][j] + best_error[2][quant][k] + best_error[3][quant][l], 1e10f); + if (errorterm <= combined_best_error[quant][intcnt]) + { + combined_best_error[quant][intcnt] = errorterm; + formats_of_choice[quant][intcnt][0] = format_of_choice[0][quant][i]; + formats_of_choice[quant][intcnt][1] = format_of_choice[1][quant][j]; + formats_of_choice[quant][intcnt][2] = format_of_choice[2][quant][k]; + formats_of_choice[quant][intcnt][3] = format_of_choice[3][quant][l]; + } + } + } + } + } + } +} + + + + + + +// for 4 partitions, find the best combination (four formats + a quantization level) for a given bitcount + +static void four_partitions_find_best_combination_for_bitcount(float combined_best_error[21][13], + int formats_of_choice[21][13][4], + int bits_available, int *best_quantization_level, int *best_quantization_level_mod, int *best_formats, float *error_of_best_combination) +{ + int i; + int best_integer_count = 0; + float best_integer_count_error = 1e20f; + int integer_count; + + for (integer_count = 4; integer_count <= 9; integer_count++) + { + // compute the quantization level for a given number of integers and a given number of bits. + int quantization_level = quantization_mode_table[integer_count][bits_available]; + if (quantization_level == -1) + break; // used to indicate the case where we don't have enough bits to represent a given endpoint format at all. + float integer_count_error = combined_best_error[quantization_level][integer_count - 4]; + if (integer_count_error < best_integer_count_error) + { + best_integer_count_error = integer_count_error; + best_integer_count = integer_count; + } + } + + int ql = quantization_mode_table[best_integer_count][bits_available]; + int ql_mod = quantization_mode_table[best_integer_count][bits_available + 8]; + + *best_quantization_level = ql; + *best_quantization_level_mod = ql_mod; + *error_of_best_combination = best_integer_count_error; + if (ql >= 0) + { + for (i = 0; i < 4; i++) + best_formats[i] = formats_of_choice[ql][best_integer_count - 4][i]; + } + else + { + for (i = 0; i < 4; i++) + best_formats[i] = FMT_LUMINANCE; + } +} + + + +/* + The determine_optimal_set_of_endpoint_formats_to_use() function. + + It identifies, for each mode, which set of color endpoint encodings + produces the best overall result. It then reports back which 4 modes + look best, along with the ideal color encoding combination for each. + + It takes as input: + a partitioning an imageblock, + a set of color endpoints. + for each mode, the number of bits available for color encoding and the error incurred by quantization. + in case of 2 plane of weights, a specifier for which color component to use for the second plane of weights. + + It delivers as output for each of the 4 selected modes: + format specifier + for each partition + quantization level to use + modified quantization level to use + (when all format specifiers are equal) + */ + +void determine_optimal_set_of_endpoint_formats_to_use(int xdim, int ydim, int zdim, + const partition_info * pt, const imageblock * blk, const error_weight_block * ewb, + const endpoints * ep, + int separate_component, // separate color component for 2-plane mode; -1 for single-plane mode + // bitcounts and errors computed for the various quantization methods + const int *qwt_bitcounts, const float *qwt_errors, + // output data + int partition_format_specifiers[4][4], int quantized_weight[4], + int quantization_level[4], int quantization_level_mod[4]) +{ + int i, j; + int partition_count = pt->partition_count; + + int encode_hdr_rgb = blk->rgb_lns[0]; + int encode_hdr_alpha = blk->alpha_lns[0]; + + + // call a helper function to compute the errors that result from various + // encoding choices (such as using luminance instead of RGB, discarding Alpha, + // using RGB-scale in place of two separate RGB endpoints and so on) + encoding_choice_errors eci[4]; + compute_encoding_choice_errors(xdim, ydim, zdim, blk, pt, ewb, separate_component, eci); + + // for each partition, compute the error weights to apply for that partition. + float4 error_weightings[4]; + float4 dummied_color_scalefactors[4]; // only used to receive data + compute_partition_error_color_weightings(xdim, ydim, zdim, ewb, pt, error_weightings, dummied_color_scalefactors); + + + float best_error[4][21][4]; + int format_of_choice[4][21][4]; + for (i = 0; i < partition_count; i++) + compute_color_error_for_every_integer_count_and_quantization_level(encode_hdr_rgb, encode_hdr_alpha, i, pt, &(eci[i]), ep, error_weightings, best_error[i], format_of_choice[i]); + + float errors_of_best_combination[MAX_WEIGHT_MODES]; + int best_quantization_levels[MAX_WEIGHT_MODES]; + int best_quantization_levels_mod[MAX_WEIGHT_MODES]; + int best_ep_formats[MAX_WEIGHT_MODES][4]; + + // code for the case where the block contains 1 partition + if (partition_count == 1) + { + int best_quantization_level; + int best_format; + float error_of_best_combination; + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (qwt_errors[i] >= 1e29f) + { + errors_of_best_combination[i] = 1e30f; + continue; + } + + one_partition_find_best_combination_for_bitcount(best_error[0], format_of_choice[0], qwt_bitcounts[i], &best_quantization_level, &best_format, &error_of_best_combination); + error_of_best_combination += qwt_errors[i]; + + errors_of_best_combination[i] = error_of_best_combination; + best_quantization_levels[i] = best_quantization_level; + best_quantization_levels_mod[i] = best_quantization_level; + best_ep_formats[i][0] = best_format; + } + } + + // code for the case where the block contains 2 partitions + else if (partition_count == 2) + { + int best_quantization_level; + int best_quantization_level_mod; + int best_formats[2]; + float error_of_best_combination; + + float combined_best_error[21][7]; + int formats_of_choice[21][7][2]; + + two_partitions_find_best_combination_for_every_quantization_and_integer_count(best_error, format_of_choice, combined_best_error, formats_of_choice); + + + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (qwt_errors[i] >= 1e29f) + { + errors_of_best_combination[i] = 1e30f; + continue; + } + + two_partitions_find_best_combination_for_bitcount(combined_best_error, formats_of_choice, qwt_bitcounts[i], + &best_quantization_level, &best_quantization_level_mod, best_formats, &error_of_best_combination); + + error_of_best_combination += qwt_errors[i]; + + errors_of_best_combination[i] = error_of_best_combination; + best_quantization_levels[i] = best_quantization_level; + best_quantization_levels_mod[i] = best_quantization_level_mod; + best_ep_formats[i][0] = best_formats[0]; + best_ep_formats[i][1] = best_formats[1]; + } + } + + // code for the case where the block contains 3 partitions + else if (partition_count == 3) + { + int best_quantization_level; + int best_quantization_level_mod; + int best_formats[3]; + float error_of_best_combination; + + float combined_best_error[21][10]; + int formats_of_choice[21][10][3]; + + three_partitions_find_best_combination_for_every_quantization_and_integer_count(best_error, format_of_choice, combined_best_error, formats_of_choice); + + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (qwt_errors[i] >= 1e29f) + { + errors_of_best_combination[i] = 1e30f; + continue; + } + + three_partitions_find_best_combination_for_bitcount(combined_best_error, + formats_of_choice, qwt_bitcounts[i], &best_quantization_level, &best_quantization_level_mod, best_formats, &error_of_best_combination); + error_of_best_combination += qwt_errors[i]; + + errors_of_best_combination[i] = error_of_best_combination; + best_quantization_levels[i] = best_quantization_level; + best_quantization_levels_mod[i] = best_quantization_level_mod; + best_ep_formats[i][0] = best_formats[0]; + best_ep_formats[i][1] = best_formats[1]; + best_ep_formats[i][2] = best_formats[2]; + } + } + + // code for the case where the block contains 4 partitions + else if (partition_count == 4) + { + int best_quantization_level; + int best_quantization_level_mod; + int best_formats[4]; + float error_of_best_combination; + + float combined_best_error[21][13]; + int formats_of_choice[21][13][4]; + + four_partitions_find_best_combination_for_every_quantization_and_integer_count(best_error, format_of_choice, combined_best_error, formats_of_choice); + + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (qwt_errors[i] >= 1e29f) + { + errors_of_best_combination[i] = 1e30f; + continue; + } + four_partitions_find_best_combination_for_bitcount(combined_best_error, + formats_of_choice, qwt_bitcounts[i], &best_quantization_level, &best_quantization_level_mod, best_formats, &error_of_best_combination); + error_of_best_combination += qwt_errors[i]; + + errors_of_best_combination[i] = error_of_best_combination; + best_quantization_levels[i] = best_quantization_level; + best_quantization_levels_mod[i] = best_quantization_level_mod; + best_ep_formats[i][0] = best_formats[0]; + best_ep_formats[i][1] = best_formats[1]; + best_ep_formats[i][2] = best_formats[2]; + best_ep_formats[i][3] = best_formats[3]; + } + } + + // finally, go through the results and pick the 4 best-looking modes. + + int best_error_weights[4]; + + for (i = 0; i < 4; i++) + { + float best_ep_error = 1e30f; + int best_error_index = -1; + for (j = 0; j < MAX_WEIGHT_MODES; j++) + { + if (errors_of_best_combination[j] < best_ep_error && best_quantization_levels[j] >= 5) + { + best_ep_error = errors_of_best_combination[j]; + best_error_index = j; + } + } + best_error_weights[i] = best_error_index; + + if(best_error_index >= 0) + { + errors_of_best_combination[best_error_index] = 1e30f; + } + } + + for (i = 0; i < 4; i++) + { + quantized_weight[i] = best_error_weights[i]; + if (quantized_weight[i] >= 0) + { + quantization_level[i] = best_quantization_levels[best_error_weights[i]]; + quantization_level_mod[i] = best_quantization_levels_mod[best_error_weights[i]]; + for (j = 0; j < partition_count; j++) + { + partition_format_specifiers[i][j] = best_ep_formats[best_error_weights[i]][j]; + } + } + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_quantization.cpp b/3rdparty/bimg/3rdparty/astc/astc_quantization.cpp new file mode 100644 index 00000000000..183c5a334a5 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_quantization.cpp @@ -0,0 +1,558 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions and data table related to data quantization in ASTC. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +const uint8_t color_quantization_tables[21][256] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, + }, + { + 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, + }, + { + 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1, 1, 1, + }, + { + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, + 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, + 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, + 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, + 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, + 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, + 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, + 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, + }, + { + 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, + 16, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 2, 2, + 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 18, 18, 18, 18, 18, + 18, 26, 26, 26, 26, 26, 26, 26, 34, 34, 34, 34, 34, 34, 4, 4, + 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 20, 20, 20, 20, 20, + 20, 20, 28, 28, 28, 28, 28, 28, 36, 36, 36, 36, 36, 36, 36, 6, + 6, 6, 6, 6, 6, 14, 14, 14, 14, 14, 14, 14, 22, 22, 22, 22, + 22, 22, 30, 30, 30, 30, 30, 30, 30, 38, 38, 38, 38, 38, 38, 38, + 39, 39, 39, 39, 39, 39, 39, 31, 31, 31, 31, 31, 31, 31, 23, 23, + 23, 23, 23, 23, 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7, + 7, 37, 37, 37, 37, 37, 37, 37, 29, 29, 29, 29, 29, 29, 21, 21, + 21, 21, 21, 21, 21, 13, 13, 13, 13, 13, 13, 5, 5, 5, 5, 5, + 5, 5, 35, 35, 35, 35, 35, 35, 27, 27, 27, 27, 27, 27, 27, 19, + 19, 19, 19, 19, 19, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, + 3, 3, 33, 33, 33, 33, 33, 33, 33, 25, 25, 25, 25, 25, 25, 17, + 17, 17, 17, 17, 17, 17, 9, 9, 9, 9, 9, 9, 1, 1, 1, 1, + }, + { + 0, 0, 0, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32, 2, 2, + 2, 2, 2, 18, 18, 18, 18, 18, 18, 34, 34, 34, 34, 34, 4, 4, + 4, 4, 4, 4, 20, 20, 20, 20, 20, 36, 36, 36, 36, 36, 6, 6, + 6, 6, 6, 6, 22, 22, 22, 22, 22, 38, 38, 38, 38, 38, 38, 8, + 8, 8, 8, 8, 24, 24, 24, 24, 24, 24, 40, 40, 40, 40, 40, 10, + 10, 10, 10, 10, 26, 26, 26, 26, 26, 26, 42, 42, 42, 42, 42, 12, + 12, 12, 12, 12, 12, 28, 28, 28, 28, 28, 44, 44, 44, 44, 44, 14, + 14, 14, 14, 14, 14, 30, 30, 30, 30, 30, 46, 46, 46, 46, 46, 46, + 47, 47, 47, 47, 47, 47, 31, 31, 31, 31, 31, 15, 15, 15, 15, 15, + 15, 45, 45, 45, 45, 45, 29, 29, 29, 29, 29, 13, 13, 13, 13, 13, + 13, 43, 43, 43, 43, 43, 27, 27, 27, 27, 27, 27, 11, 11, 11, 11, + 11, 41, 41, 41, 41, 41, 25, 25, 25, 25, 25, 25, 9, 9, 9, 9, + 9, 39, 39, 39, 39, 39, 39, 23, 23, 23, 23, 23, 7, 7, 7, 7, + 7, 7, 37, 37, 37, 37, 37, 21, 21, 21, 21, 21, 5, 5, 5, 5, + 5, 5, 35, 35, 35, 35, 35, 19, 19, 19, 19, 19, 19, 3, 3, 3, + 3, 3, 33, 33, 33, 33, 33, 17, 17, 17, 17, 17, 17, 1, 1, 1, + }, + { + 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, + 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, + 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, + 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, + 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, + 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, + 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, + 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, + 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, + 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, + 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, + 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, + 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, + 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, + 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, + 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, 62, 62, 62, 63, 63, 63, + }, + { + 0, 0, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 2, + 2, 2, 18, 18, 18, 34, 34, 34, 50, 50, 50, 50, 66, 66, 66, 4, + 4, 4, 20, 20, 20, 36, 36, 36, 36, 52, 52, 52, 68, 68, 68, 6, + 6, 6, 22, 22, 22, 38, 38, 38, 38, 54, 54, 54, 70, 70, 70, 8, + 8, 8, 24, 24, 24, 24, 40, 40, 40, 56, 56, 56, 72, 72, 72, 10, + 10, 10, 26, 26, 26, 26, 42, 42, 42, 58, 58, 58, 74, 74, 74, 12, + 12, 12, 12, 28, 28, 28, 44, 44, 44, 60, 60, 60, 76, 76, 76, 14, + 14, 14, 14, 30, 30, 30, 46, 46, 46, 62, 62, 62, 78, 78, 78, 78, + 79, 79, 79, 79, 63, 63, 63, 47, 47, 47, 31, 31, 31, 15, 15, 15, + 15, 77, 77, 77, 61, 61, 61, 45, 45, 45, 29, 29, 29, 13, 13, 13, + 13, 75, 75, 75, 59, 59, 59, 43, 43, 43, 27, 27, 27, 27, 11, 11, + 11, 73, 73, 73, 57, 57, 57, 41, 41, 41, 25, 25, 25, 25, 9, 9, + 9, 71, 71, 71, 55, 55, 55, 39, 39, 39, 39, 23, 23, 23, 7, 7, + 7, 69, 69, 69, 53, 53, 53, 37, 37, 37, 37, 21, 21, 21, 5, 5, + 5, 67, 67, 67, 51, 51, 51, 51, 35, 35, 35, 19, 19, 19, 3, 3, + 3, 65, 65, 65, 49, 49, 49, 49, 33, 33, 33, 17, 17, 17, 1, 1, + }, + { + 0, 0, 32, 32, 64, 64, 64, 2, 2, 2, 34, 34, 66, 66, 66, 4, + 4, 4, 36, 36, 68, 68, 68, 6, 6, 6, 38, 38, 70, 70, 70, 8, + 8, 8, 40, 40, 40, 72, 72, 10, 10, 10, 42, 42, 42, 74, 74, 12, + 12, 12, 44, 44, 44, 76, 76, 14, 14, 14, 46, 46, 46, 78, 78, 16, + 16, 16, 48, 48, 48, 80, 80, 80, 18, 18, 50, 50, 50, 82, 82, 82, + 20, 20, 52, 52, 52, 84, 84, 84, 22, 22, 54, 54, 54, 86, 86, 86, + 24, 24, 56, 56, 56, 88, 88, 88, 26, 26, 58, 58, 58, 90, 90, 90, + 28, 28, 60, 60, 60, 92, 92, 92, 30, 30, 62, 62, 62, 94, 94, 94, + 95, 95, 95, 63, 63, 63, 31, 31, 93, 93, 93, 61, 61, 61, 29, 29, + 91, 91, 91, 59, 59, 59, 27, 27, 89, 89, 89, 57, 57, 57, 25, 25, + 87, 87, 87, 55, 55, 55, 23, 23, 85, 85, 85, 53, 53, 53, 21, 21, + 83, 83, 83, 51, 51, 51, 19, 19, 81, 81, 81, 49, 49, 49, 17, 17, + 17, 79, 79, 47, 47, 47, 15, 15, 15, 77, 77, 45, 45, 45, 13, 13, + 13, 75, 75, 43, 43, 43, 11, 11, 11, 73, 73, 41, 41, 41, 9, 9, + 9, 71, 71, 71, 39, 39, 7, 7, 7, 69, 69, 69, 37, 37, 5, 5, + 5, 67, 67, 67, 35, 35, 3, 3, 3, 65, 65, 65, 33, 33, 1, 1, + }, + { + 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, + 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, + 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, + 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, + 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, + 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, + 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, + 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, + 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, + 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, + 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, + 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, + 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, + 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, + 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, + 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127, + }, + { + 0, 32, 32, 64, 96, 96, 128, 128, 2, 34, 34, 66, 98, 98, 130, 130, + 4, 36, 36, 68, 100, 100, 132, 132, 6, 38, 38, 70, 102, 102, 134, 134, + 8, 40, 40, 72, 104, 104, 136, 136, 10, 42, 42, 74, 106, 106, 138, 138, + 12, 44, 44, 76, 108, 108, 140, 140, 14, 46, 46, 78, 110, 110, 142, 142, + 16, 48, 48, 80, 112, 112, 144, 144, 18, 50, 50, 82, 114, 114, 146, 146, + 20, 52, 52, 84, 116, 116, 148, 148, 22, 54, 54, 86, 118, 118, 150, 150, + 24, 56, 56, 88, 120, 120, 152, 152, 26, 58, 58, 90, 122, 122, 154, 154, + 28, 60, 60, 92, 124, 124, 156, 156, 30, 62, 62, 94, 126, 126, 158, 158, + 159, 159, 127, 127, 95, 63, 63, 31, 157, 157, 125, 125, 93, 61, 61, 29, + 155, 155, 123, 123, 91, 59, 59, 27, 153, 153, 121, 121, 89, 57, 57, 25, + 151, 151, 119, 119, 87, 55, 55, 23, 149, 149, 117, 117, 85, 53, 53, 21, + 147, 147, 115, 115, 83, 51, 51, 19, 145, 145, 113, 113, 81, 49, 49, 17, + 143, 143, 111, 111, 79, 47, 47, 15, 141, 141, 109, 109, 77, 45, 45, 13, + 139, 139, 107, 107, 75, 43, 43, 11, 137, 137, 105, 105, 73, 41, 41, 9, + 135, 135, 103, 103, 71, 39, 39, 7, 133, 133, 101, 101, 69, 37, 37, 5, + 131, 131, 99, 99, 67, 35, 35, 3, 129, 129, 97, 97, 65, 33, 33, 1, + }, + { + 0, 64, 128, 128, 2, 66, 130, 130, 4, 68, 132, 132, 6, 70, 134, 134, + 8, 72, 136, 136, 10, 74, 138, 138, 12, 76, 140, 140, 14, 78, 142, 142, + 16, 80, 144, 144, 18, 82, 146, 146, 20, 84, 148, 148, 22, 86, 150, 150, + 24, 88, 152, 152, 26, 90, 154, 154, 28, 92, 156, 156, 30, 94, 158, 158, + 32, 96, 160, 160, 34, 98, 162, 162, 36, 100, 164, 164, 38, 102, 166, 166, + 40, 104, 168, 168, 42, 106, 170, 170, 44, 108, 172, 172, 46, 110, 174, 174, + 48, 112, 176, 176, 50, 114, 178, 178, 52, 116, 180, 180, 54, 118, 182, 182, + 56, 120, 184, 184, 58, 122, 186, 186, 60, 124, 188, 188, 62, 126, 190, 190, + 191, 191, 127, 63, 189, 189, 125, 61, 187, 187, 123, 59, 185, 185, 121, 57, + 183, 183, 119, 55, 181, 181, 117, 53, 179, 179, 115, 51, 177, 177, 113, 49, + 175, 175, 111, 47, 173, 173, 109, 45, 171, 171, 107, 43, 169, 169, 105, 41, + 167, 167, 103, 39, 165, 165, 101, 37, 163, 163, 99, 35, 161, 161, 97, 33, + 159, 159, 95, 31, 157, 157, 93, 29, 155, 155, 91, 27, 153, 153, 89, 25, + 151, 151, 87, 23, 149, 149, 85, 21, 147, 147, 83, 19, 145, 145, 81, 17, + 143, 143, 79, 15, 141, 141, 77, 13, 139, 139, 75, 11, 137, 137, 73, 9, + 135, 135, 71, 7, 133, 133, 69, 5, 131, 131, 67, 3, 129, 129, 65, 1, + }, + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + }, +}; + + +const uint8_t color_unquantization_tables[21][256] = { + { + 0, 255, + }, + { + 0, 128, 255, + }, + { + 0, 85, 170, 255, + }, + { + 0, 64, 128, 192, 255, + }, + { + 0, 255, 51, 204, 102, 153, + }, + { + 0, 36, 73, 109, 146, 182, 219, 255, + }, + { + 0, 255, 28, 227, 56, 199, 84, 171, 113, 142, + }, + { + 0, 255, 69, 186, 23, 232, 92, 163, 46, 209, 116, 139, + }, + { + 0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255, + }, + { + 0, 255, 67, 188, 13, 242, 80, 175, 27, 228, 94, 161, 40, 215, 107, 148, + 54, 201, 121, 134, + }, + { + 0, 255, 33, 222, 66, 189, 99, 156, 11, 244, 44, 211, 77, 178, 110, 145, + 22, 233, 55, 200, 88, 167, 121, 134, + }, + { + 0, 8, 16, 24, 33, 41, 49, 57, 66, 74, 82, 90, 99, 107, 115, 123, + 132, 140, 148, 156, 165, 173, 181, 189, 198, 206, 214, 222, 231, 239, 247, 255, + }, + { + 0, 255, 32, 223, 65, 190, 97, 158, 6, 249, 39, 216, 71, 184, 104, 151, + 13, 242, 45, 210, 78, 177, 110, 145, 19, 236, 52, 203, 84, 171, 117, 138, + 26, 229, 58, 197, 91, 164, 123, 132, + }, + { + 0, 255, 16, 239, 32, 223, 48, 207, 65, 190, 81, 174, 97, 158, 113, 142, + 5, 250, 21, 234, 38, 217, 54, 201, 70, 185, 86, 169, 103, 152, 119, 136, + 11, 244, 27, 228, 43, 212, 59, 196, 76, 179, 92, 163, 108, 147, 124, 131, + }, + { + 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, + 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125, + 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, + 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255, + }, + { + 0, 255, 16, 239, 32, 223, 48, 207, 64, 191, 80, 175, 96, 159, 112, 143, + 3, 252, 19, 236, 35, 220, 51, 204, 67, 188, 83, 172, 100, 155, 116, 139, + 6, 249, 22, 233, 38, 217, 54, 201, 71, 184, 87, 168, 103, 152, 119, 136, + 9, 246, 25, 230, 42, 213, 58, 197, 74, 181, 90, 165, 106, 149, 122, 133, + 13, 242, 29, 226, 45, 210, 61, 194, 77, 178, 93, 162, 109, 146, 125, 130, + }, + { + 0, 255, 8, 247, 16, 239, 24, 231, 32, 223, 40, 215, 48, 207, 56, 199, + 64, 191, 72, 183, 80, 175, 88, 167, 96, 159, 104, 151, 112, 143, 120, 135, + 2, 253, 10, 245, 18, 237, 26, 229, 35, 220, 43, 212, 51, 204, 59, 196, + 67, 188, 75, 180, 83, 172, 91, 164, 99, 156, 107, 148, 115, 140, 123, 132, + 5, 250, 13, 242, 21, 234, 29, 226, 37, 218, 45, 210, 53, 202, 61, 194, + 70, 185, 78, 177, 86, 169, 94, 161, 102, 153, 110, 145, 118, 137, 126, 129, + }, + { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, + 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, + 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, + 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, + 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, + 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 191, + 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, 221, 223, + 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, + }, + { + 0, 255, 8, 247, 16, 239, 24, 231, 32, 223, 40, 215, 48, 207, 56, 199, + 64, 191, 72, 183, 80, 175, 88, 167, 96, 159, 104, 151, 112, 143, 120, 135, + 1, 254, 9, 246, 17, 238, 25, 230, 33, 222, 41, 214, 49, 206, 57, 198, + 65, 190, 73, 182, 81, 174, 89, 166, 97, 158, 105, 150, 113, 142, 121, 134, + 3, 252, 11, 244, 19, 236, 27, 228, 35, 220, 43, 212, 51, 204, 59, 196, + 67, 188, 75, 180, 83, 172, 91, 164, 99, 156, 107, 148, 115, 140, 123, 132, + 4, 251, 12, 243, 20, 235, 28, 227, 36, 219, 44, 211, 52, 203, 60, 195, + 68, 187, 76, 179, 84, 171, 92, 163, 100, 155, 108, 147, 116, 139, 124, 131, + 6, 249, 14, 241, 22, 233, 30, 225, 38, 217, 46, 209, 54, 201, 62, 193, + 70, 185, 78, 177, 86, 169, 94, 161, 102, 153, 110, 145, 118, 137, 126, 129, + }, + { + 0, 255, 4, 251, 8, 247, 12, 243, 16, 239, 20, 235, 24, 231, 28, 227, + 32, 223, 36, 219, 40, 215, 44, 211, 48, 207, 52, 203, 56, 199, 60, 195, + 64, 191, 68, 187, 72, 183, 76, 179, 80, 175, 84, 171, 88, 167, 92, 163, + 96, 159, 100, 155, 104, 151, 108, 147, 112, 143, 116, 139, 120, 135, 124, 131, + 1, 254, 5, 250, 9, 246, 13, 242, 17, 238, 21, 234, 25, 230, 29, 226, + 33, 222, 37, 218, 41, 214, 45, 210, 49, 206, 53, 202, 57, 198, 61, 194, + 65, 190, 69, 186, 73, 182, 77, 178, 81, 174, 85, 170, 89, 166, 93, 162, + 97, 158, 101, 154, 105, 150, 109, 146, 113, 142, 117, 138, 121, 134, 125, 130, + 2, 253, 6, 249, 10, 245, 14, 241, 18, 237, 22, 233, 26, 229, 30, 225, + 34, 221, 38, 217, 42, 213, 46, 209, 50, 205, 54, 201, 58, 197, 62, 193, + 66, 189, 70, 185, 74, 181, 78, 177, 82, 173, 86, 169, 90, 165, 94, 161, + 98, 157, 102, 153, 106, 149, 110, 145, 114, 141, 118, 137, 122, 133, 126, 129, + }, + { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + }, +}; + +// quantization_mode_table[integercount/2][bits] gives +// us the quantization level for a given integer count and number of bits that +// the integer may fit into. This is needed for color decoding, +// and for the color encoding. +int quantization_mode_table[17][128]; + +void build_quantization_mode_table(void) +{ + int i, j; + for (i = 0; i <= 16; i++) + for (j = 0; j < 128; j++) + quantization_mode_table[i][j] = -1; + + for (i = 0; i < 21; i++) + for (j = 1; j <= 16; j++) + { + int p = compute_ise_bitcount(2 * j, (quantization_method) i); + if (p < 128) + quantization_mode_table[j][p] = i; + } + for (i = 0; i <= 16; i++) + { + int largest_value_so_far = -1; + for (j = 0; j < 128; j++) + { + if (quantization_mode_table[i][j] > largest_value_so_far) + largest_value_so_far = quantization_mode_table[i][j]; + else + quantization_mode_table[i][j] = largest_value_so_far; + } + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_symbolic_physical.cpp b/3rdparty/bimg/3rdparty/astc/astc_symbolic_physical.cpp new file mode 100644 index 00000000000..d395b8cfcd0 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_symbolic_physical.cpp @@ -0,0 +1,431 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Functions to convert a compressed block between the symbolic and + * the physical representation. + */ +/*----------------------------------------------------------------------------*/ + +#include "astc_codec_internals.h" + +// routine to write up to 8 bits +static inline void write_bits(int value, int bitcount, int bitoffset, uint8_t * ptr) +{ + int mask = (1 << bitcount) - 1; + value &= mask; + ptr += bitoffset >> 3; + bitoffset &= 7; + value <<= bitoffset; + mask <<= bitoffset; + mask = ~mask; + + ptr[0] &= mask; + ptr[0] |= value; + ptr[1] &= mask >> 8; + ptr[1] |= value >> 8; +} + + +// routine to read up to 8 bits +static inline int read_bits(int bitcount, int bitoffset, const uint8_t * ptr) +{ + int mask = (1 << bitcount) - 1; + ptr += bitoffset >> 3; + bitoffset &= 7; + int value = ptr[0] | (ptr[1] << 8); + value >>= bitoffset; + value &= mask; + return value; +} + + +int bitrev8(int p) +{ + p = ((p & 0xF) << 4) | ((p >> 4) & 0xF); + p = ((p & 0x33) << 2) | ((p >> 2) & 0x33); + p = ((p & 0x55) << 1) | ((p >> 1) & 0x55); + return p; +} + + + + +physical_compressed_block symbolic_to_physical(int xdim, int ydim, int zdim, const symbolic_compressed_block * sc) +{ + int i, j; + physical_compressed_block res; + + + if (sc->block_mode == -2) + { + // UNORM16 constant-color block. + // This encodes separate constant-color blocks. There is currently + // no attempt to coalesce them into larger void-extents. + + static const uint8_t cbytes[8] = { 0xFC, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + for (i = 0; i < 8; i++) + res.data[i] = cbytes[i]; + + for (i = 0; i < 4; i++) + { + res.data[2 * i + 8] = sc->constant_color[i] & 0xFF; + res.data[2 * i + 9] = (sc->constant_color[i] >> 8) & 0xFF; + } + return res; + } + + + if (sc->block_mode == -1) + { + // FP16 constant-color block. + // This encodes separate constant-color blocks. There is currently + // no attempt to coalesce them into larger void-extents. + + static const uint8_t cbytes[8] = { 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; + for (i = 0; i < 8; i++) + res.data[i] = cbytes[i]; + + for (i = 0; i < 4; i++) + { + res.data[2 * i + 8] = sc->constant_color[i] & 0xFF; + res.data[2 * i + 9] = (sc->constant_color[i] >> 8) & 0xFF; + } + return res; + } + + + + int partition_count = sc->partition_count; + + // first, compress the weights. They are encoded as an ordinary + // integer-sequence, then bit-reversed + uint8_t weightbuf[16]; + for (i = 0; i < 16; i++) + weightbuf[i] = 0; + + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + const decimation_table *const *ixtab2 = bsd->decimation_tables; + + + int weight_count = ixtab2[bsd->block_modes[sc->block_mode].decimation_mode]->num_weights; + int weight_quantization_method = bsd->block_modes[sc->block_mode].quantization_mode; + int is_dual_plane = bsd->block_modes[sc->block_mode].is_dual_plane; + + int real_weight_count = is_dual_plane ? 2 * weight_count : weight_count; + + int bits_for_weights = compute_ise_bitcount(real_weight_count, + (quantization_method) weight_quantization_method); + + + if (is_dual_plane) + { + uint8_t weights[64]; + for (i = 0; i < weight_count; i++) + { + weights[2 * i] = sc->plane1_weights[i]; + weights[2 * i + 1] = sc->plane2_weights[i]; + } + encode_ise(weight_quantization_method, real_weight_count, weights, weightbuf, 0); + } + else + { + encode_ise(weight_quantization_method, weight_count, sc->plane1_weights, weightbuf, 0); + } + + for (i = 0; i < 16; i++) + res.data[i] = bitrev8(weightbuf[15 - i]); + + write_bits(sc->block_mode, 11, 0, res.data); + write_bits(partition_count - 1, 2, 11, res.data); + + int below_weights_pos = 128 - bits_for_weights; + + // encode partition index and color endpoint types for blocks with + // 2 or more partitions. + if (partition_count > 1) + { + write_bits(sc->partition_index, 6, 13, res.data); + write_bits(sc->partition_index >> 6, PARTITION_BITS - 6, 19, res.data); + + if (sc->color_formats_matched) + { + write_bits(sc->color_formats[0] << 2, 6, 13 + PARTITION_BITS, res.data); + } + else + { + // go through the selected endpoint type classes for each partition + // in order to determine the lowest class present. + int low_class = 4; + for (i = 0; i < partition_count; i++) + { + int class_of_format = sc->color_formats[i] >> 2; + if (class_of_format < low_class) + low_class = class_of_format; + } + if (low_class == 3) + low_class = 2; + int encoded_type = low_class + 1; + int bitpos = 2; + for (i = 0; i < partition_count; i++) + { + int classbit_of_format = (sc->color_formats[i] >> 2) - low_class; + + encoded_type |= classbit_of_format << bitpos; + bitpos++; + } + for (i = 0; i < partition_count; i++) + { + int lowbits_of_format = sc->color_formats[i] & 3; + encoded_type |= lowbits_of_format << bitpos; + bitpos += 2; + } + int encoded_type_lowpart = encoded_type & 0x3F; + int encoded_type_highpart = encoded_type >> 6; + int encoded_type_highpart_size = (3 * partition_count) - 4; + int encoded_type_highpart_pos = 128 - bits_for_weights - encoded_type_highpart_size; + write_bits(encoded_type_lowpart, 6, 13 + PARTITION_BITS, res.data); + write_bits(encoded_type_highpart, encoded_type_highpart_size, encoded_type_highpart_pos, res.data); + + below_weights_pos -= encoded_type_highpart_size; + } + } + + else + write_bits(sc->color_formats[0], 4, 13, res.data); + + // in dual-plane mode, encode the color component of the second plane of weights + if (is_dual_plane) + write_bits(sc->plane2_color_component, 2, below_weights_pos - 2, res.data); + + // finally, encode the color bits + // first, get hold of all the color components to encode + uint8_t values_to_encode[32]; + int valuecount_to_encode = 0; + for (i = 0; i < sc->partition_count; i++) + { + int vals = 2 * (sc->color_formats[i] >> 2) + 2; + for (j = 0; j < vals; j++) + values_to_encode[j + valuecount_to_encode] = sc->color_values[i][j]; + valuecount_to_encode += vals; + } + // then, encode an ISE based on them. + encode_ise(sc->color_quantization_level, valuecount_to_encode, values_to_encode, res.data, (sc->partition_count == 1 ? 17 : 19 + PARTITION_BITS)); + + return res; +} + + +void physical_to_symbolic(int xdim, int ydim, int zdim, physical_compressed_block pb, symbolic_compressed_block * res) +{ + uint8_t bswapped[16]; + int i, j; + + res->error_block = 0; + + // get hold of the block-size descriptor and the decimation tables. + const block_size_descriptor *bsd = get_block_size_descriptor(xdim, ydim, zdim); + const decimation_table *const *ixtab2 = bsd->decimation_tables; + + // extract header fields + int block_mode = read_bits(11, 0, pb.data); + + + if ((block_mode & 0x1FF) == 0x1FC) + { + // void-extent block! + + // check what format the data has + if (block_mode & 0x200) + res->block_mode = -1; // floating-point + else + res->block_mode = -2; // unorm16. + + res->partition_count = 0; + for (i = 0; i < 4; i++) + { + res->constant_color[i] = pb.data[2 * i + 8] | (pb.data[2 * i + 9] << 8); + } + + // additionally, check that the void-extent + if (zdim == 1) + { + // 2D void-extent + int rsvbits = read_bits(2, 10, pb.data); + if (rsvbits != 3) + res->error_block = 1; + + int vx_low_s = read_bits(8, 12, pb.data) | (read_bits(5, 12 + 8, pb.data) << 8); + int vx_high_s = read_bits(8, 25, pb.data) | (read_bits(5, 25 + 8, pb.data) << 8); + int vx_low_t = read_bits(8, 38, pb.data) | (read_bits(5, 38 + 8, pb.data) << 8); + int vx_high_t = read_bits(8, 51, pb.data) | (read_bits(5, 51 + 8, pb.data) << 8); + + int all_ones = vx_low_s == 0x1FFF && vx_high_s == 0x1FFF && vx_low_t == 0x1FFF && vx_high_t == 0x1FFF; + + if ((vx_low_s >= vx_high_s || vx_low_t >= vx_high_t) && !all_ones) + res->error_block = 1; + } + else + { + // 3D void-extent + int vx_low_s = read_bits(9, 10, pb.data); + int vx_high_s = read_bits(9, 19, pb.data); + int vx_low_t = read_bits(9, 28, pb.data); + int vx_high_t = read_bits(9, 37, pb.data); + int vx_low_p = read_bits(9, 46, pb.data); + int vx_high_p = read_bits(9, 55, pb.data); + + int all_ones = vx_low_s == 0x1FF && vx_high_s == 0x1FF && vx_low_t == 0x1FF && vx_high_t == 0x1FF && vx_low_p == 0x1FF && vx_high_p == 0x1FF; + + if ((vx_low_s >= vx_high_s || vx_low_t >= vx_high_t || vx_low_p >= vx_high_p) && !all_ones) + res->error_block = 1; + } + + return; + } + + if (bsd->block_modes[block_mode].permit_decode == 0) + { + res->error_block = 1; + return; + } + + int weight_count = ixtab2[bsd->block_modes[block_mode].decimation_mode]->num_weights; + int weight_quantization_method = bsd->block_modes[block_mode].quantization_mode; + int is_dual_plane = bsd->block_modes[block_mode].is_dual_plane; + + int real_weight_count = is_dual_plane ? 2 * weight_count : weight_count; + + int partition_count = read_bits(2, 11, pb.data) + 1; + + res->block_mode = block_mode; + res->partition_count = partition_count; + + for (i = 0; i < 16; i++) + bswapped[i] = bitrev8(pb.data[15 - i]); + + int bits_for_weights = compute_ise_bitcount(real_weight_count, + (quantization_method) weight_quantization_method); + + int below_weights_pos = 128 - bits_for_weights; + + if (is_dual_plane) + { + uint8_t indices[64]; + decode_ise(weight_quantization_method, real_weight_count, bswapped, indices, 0); + for (i = 0; i < weight_count; i++) + { + res->plane1_weights[i] = indices[2 * i]; + res->plane2_weights[i] = indices[2 * i + 1]; + } + } + else + { + decode_ise(weight_quantization_method, weight_count, bswapped, res->plane1_weights, 0); + } + + if (is_dual_plane && partition_count == 4) + res->error_block = 1; + + + + res->color_formats_matched = 0; + + // then, determine the format of each endpoint pair + int color_formats[4]; + int encoded_type_highpart_size = 0; + if (partition_count == 1) + { + color_formats[0] = read_bits(4, 13, pb.data); + res->partition_index = 0; + } + else + { + encoded_type_highpart_size = (3 * partition_count) - 4; + below_weights_pos -= encoded_type_highpart_size; + int encoded_type = read_bits(6, 13 + PARTITION_BITS, pb.data) | (read_bits(encoded_type_highpart_size, below_weights_pos, pb.data) << 6); + int baseclass = encoded_type & 0x3; + if (baseclass == 0) + { + for (i = 0; i < partition_count; i++) + { + color_formats[i] = (encoded_type >> 2) & 0xF; + } + below_weights_pos += encoded_type_highpart_size; + res->color_formats_matched = 1; + encoded_type_highpart_size = 0; + } + else + { + int bitpos = 2; + baseclass--; + for (i = 0; i < partition_count; i++) + { + color_formats[i] = (((encoded_type >> bitpos) & 1) + baseclass) << 2; + bitpos++; + } + for (i = 0; i < partition_count; i++) + { + color_formats[i] |= (encoded_type >> bitpos) & 3; + bitpos += 2; + } + } + res->partition_index = read_bits(6, 13, pb.data) | (read_bits(PARTITION_BITS - 6, 19, pb.data) << 6); + + } + for (i = 0; i < partition_count; i++) + res->color_formats[i] = color_formats[i]; + + + // then, determine the number of integers we need to unpack for the endpoint pairs + int color_integer_count = 0; + for (i = 0; i < partition_count; i++) + { + int endpoint_class = color_formats[i] >> 2; + color_integer_count += (endpoint_class + 1) * 2; + } + + if (color_integer_count > 18) + res->error_block = 1; + + // then, determine the color endpoint format to use for these integers + static const int color_bits_arr[5] = { -1, 115 - 4, 113 - 4 - PARTITION_BITS, 113 - 4 - PARTITION_BITS, 113 - 4 - PARTITION_BITS }; + int color_bits = color_bits_arr[partition_count] - bits_for_weights - encoded_type_highpart_size; + if (is_dual_plane) + color_bits -= 2; + if (color_bits < 0) + color_bits = 0; + + int color_quantization_level = quantization_mode_table[color_integer_count >> 1][color_bits]; + res->color_quantization_level = color_quantization_level; + if (color_quantization_level < 4) + res->error_block = 1; + + + // then unpack the integer-bits + uint8_t values_to_decode[32]; + decode_ise(color_quantization_level, color_integer_count, pb.data, values_to_decode, (partition_count == 1 ? 17 : 19 + PARTITION_BITS)); + + // and distribute them over the endpoint types + int valuecount_to_decode = 0; + + for (i = 0; i < partition_count; i++) + { + int vals = 2 * (color_formats[i] >> 2) + 2; + for (j = 0; j < vals; j++) + res->color_values[i][j] = values_to_decode[j + valuecount_to_decode]; + valuecount_to_decode += vals; + } + + // get hold of color component for second-plane in the case of dual plane of weights. + if (is_dual_plane) + res->plane2_color_component = read_bits(2, below_weights_pos - 2, pb.data); + +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_weight_align.cpp b/3rdparty/bimg/3rdparty/astc/astc_weight_align.cpp new file mode 100644 index 00000000000..789438fd137 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_weight_align.cpp @@ -0,0 +1,600 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Angular-sum algorithm for weight alignment. + * + * This algorithm works as follows: + * * we compute a complex number P as (cos s*i, sin s*i) for each + * weight, where i is the input value and s is a scaling factor + * based on the spacing between the weights. + * * we then add together complex numbers for all the weights. + * * we then compute the length and angle of the resulting sum. + * + * This should produce the following results: + * * perfect alignment results in a vector whose length is equal to + * the sum of lengths of all inputs + * * even distribution results in a vector of length 0. + * * all samples identical results in perfect alignment for every + * scaling. + * + * For each scaling factor within a given set, we compute an alignment + * factor from 0 to 1. This should then result in some scalings standing + * out as having particularly good alignment factors; we can use this to + * produce a set of candidate scale/shift values for various quantization + * levels; we should then actually try them and see what happens. + * + * Assuming N quantization steps, the scaling factor becomes s=2*PI*(N-1); + * we should probably have about 1 scaling factor for every 1/4 + * quantization step (perhaps 1/8 for low levels of quantization) + */ +/*----------------------------------------------------------------------------*/ + +#define _USE_MATH_DEFINES // for M_PI on windows + +#include +#include "astc_codec_internals.h" + +#ifdef DEBUG_PRINT_DIAGNOSTICS + #include +#endif + +static const float angular_steppings[] = { + 1.0, 1.125, + 1.25, 1.375, + 1.5, 1.625, + 1.75, 1.875, + + 2.0, 2.25, 2.5, 2.75, + 3.0, 3.25, 3.5, 3.75, + 4.0, 4.25, 4.5, 4.75, + 5.0, 5.25, 5.5, 5.75, + 6.0, 6.25, 6.5, 6.75, + 7.0, 7.25, 7.5, 7.75, + + 8.0, 8.5, + 9.0, 9.5, + 10.0, 10.5, + 11.0, 11.5, + 12.0, 12.5, + 13.0, 13.5, + 14.0, 14.5, + 15.0, 15.5, + 16.0, 16.5, + 17.0, 17.5, + 18.0, 18.5, + 19.0, 19.5, + 20.0, 20.5, + 21.0, 21.5, + 22.0, 22.5, + 23.0, 23.5, + 24.0, 24.5, + 25.0, 25.5, + 26.0, 26.5, + 27.0, 27.5, + 28.0, 28.5, + 29.0, 29.5, + 30.0, 30.5, + 31.0, 31.5, + 32.0, 32.5, + 33.0, 33.5, + 34.0, 34.5, + 35.0, 35.5, +}; + +#define ANGULAR_STEPS ((int)(sizeof(angular_steppings)/sizeof(angular_steppings[0]))) + +static float stepsizes[ANGULAR_STEPS]; +static float stepsizes_sqr[ANGULAR_STEPS]; + +static int max_angular_steps_needed_for_quant_level[13]; + +// we store sine/cosine values for 64 possible weight values; this causes +// slight quality loss compared to using sin() and cos() directly. + +#define SINCOS_STEPS 64 + +static float sin_table[SINCOS_STEPS][ANGULAR_STEPS]; +static float cos_table[SINCOS_STEPS][ANGULAR_STEPS]; + +void prepare_angular_tables(void) +{ + int i, j; + int max_angular_steps_needed_for_quant_steps[40]; + for (i = 0; i < ANGULAR_STEPS; i++) + { + stepsizes[i] = 1.0f / angular_steppings[i]; + stepsizes_sqr[i] = stepsizes[i] * stepsizes[i]; + + for (j = 0; j < SINCOS_STEPS; j++) + { + sin_table[j][i] = static_cast < float >(sin((2.0f * M_PI / (SINCOS_STEPS - 1.0f)) * angular_steppings[i] * j)); + cos_table[j][i] = static_cast < float >(cos((2.0f * M_PI / (SINCOS_STEPS - 1.0f)) * angular_steppings[i] * j)); + } + + int p = static_cast < int >(floor(angular_steppings[i])) + 1; + max_angular_steps_needed_for_quant_steps[p] = MIN(i + 1, ANGULAR_STEPS - 1); + } + + + // yes, the next-to-last entry is supposed to have the value 33. This because under + // ASTC, the 32-weight mode leaves a double-sized hole in the middle of the + // weight space, so we are better off matching 33 weights than 32. + static const int steps_of_level[] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 33, 36 }; + + for (i = 0; i < 13; i++) + max_angular_steps_needed_for_quant_level[i] = max_angular_steps_needed_for_quant_steps[steps_of_level[i]]; + +} + + +union if32 +{ + float f; + int32_t s; + uint32_t u; +}; + + +// function to compute angular sums; then, from the +// angular sums, compute alignment factor and offset. + +/* static inline */ +void compute_angular_offsets(int samplecount, const float *samples, const float *sample_weights, int max_angular_steps, float *offsets) +{ + int i, j; + + float anglesum_x[ANGULAR_STEPS]; + float anglesum_y[ANGULAR_STEPS]; + + for (i = 0; i < max_angular_steps; i++) + { + anglesum_x[i] = 0; + anglesum_y[i] = 0; + } + + + // compute the angle-sums. + for (i = 0; i < samplecount; i++) + { + float sample = samples[i]; + float sample_weight = sample_weights[i]; + if32 p; + p.f = (sample * (SINCOS_STEPS - 1.0f)) + 12582912.0f; + unsigned int isample = p.u & 0x3F; + + const float *sinptr = sin_table[isample]; + const float *cosptr = cos_table[isample]; + + for (j = 0; j < max_angular_steps; j++) + { + float cp = cosptr[j]; + float sp = sinptr[j]; + + anglesum_x[j] += cp * sample_weight; + anglesum_y[j] += sp * sample_weight; + } + } + + // post-process the angle-sums + for (i = 0; i < max_angular_steps; i++) + { + float angle = atan2(anglesum_y[i], anglesum_x[i]); // positive angle -> positive offset + offsets[i] = angle * (stepsizes[i] * (1.0f / (2.0f * (float)M_PI))); + } +} + + + +// for a given step-size and a given offset, compute the +// lowest and highest weight that results from quantizing using the stepsize & offset. +// also, compute the resulting error. + + +/* static inline */ +void compute_lowest_and_highest_weight(int samplecount, const float *samples, const float *sample_weights, + int max_angular_steps, const float *offsets, + int8_t * lowest_weight, int8_t * highest_weight, + float *error, float *cut_low_weight_error, float *cut_high_weight_error) +{ + int i; + + int sp; + + float error_from_forcing_weight_down[60]; + float error_from_forcing_weight_either_way[60]; + for (i = 0; i < 60; i++) + { + error_from_forcing_weight_down[i] = 0; + error_from_forcing_weight_either_way[i] = 0; + } + + // weight + 12 + static const unsigned int idxtab[256] = { + + 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, + + 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11 + }; + + + + for (sp = 0; sp < max_angular_steps; sp++) + { + unsigned int minidx_bias12 = 55; + unsigned int maxidx_bias12 = 0; + + float errval = 0.0f; + + float rcp_stepsize = angular_steppings[sp]; + float offset = offsets[sp]; + + float scaled_offset = rcp_stepsize * offset; + + + for (i = 0; i < samplecount - 1; i += 2) + { + float wt1 = sample_weights[i]; + float wt2 = sample_weights[i + 1]; + if32 p1, p2; + float sval1 = (samples[i] * rcp_stepsize) - scaled_offset; + float sval2 = (samples[i + 1] * rcp_stepsize) - scaled_offset; + p1.f = sval1 + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion + p2.f = sval2 + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion + float isval1 = p1.f - 12582912.0f; + float isval2 = p2.f - 12582912.0f; + float dif1 = sval1 - isval1; + float dif2 = sval2 - isval2; + + errval += (dif1 * wt1) * dif1; + errval += (dif2 * wt2) * dif2; + + // table lookups that really perform a minmax function. + unsigned int idx1_bias12 = idxtab[p1.u & 0xFF]; + unsigned int idx2_bias12 = idxtab[p2.u & 0xFF]; + + if (idx1_bias12 < minidx_bias12) + minidx_bias12 = idx1_bias12; + if (idx1_bias12 > maxidx_bias12) + maxidx_bias12 = idx1_bias12; + if (idx2_bias12 < minidx_bias12) + minidx_bias12 = idx2_bias12; + if (idx2_bias12 > maxidx_bias12) + maxidx_bias12 = idx2_bias12; + + error_from_forcing_weight_either_way[idx1_bias12] += wt1; + error_from_forcing_weight_down[idx1_bias12] += (dif1 * wt1); + + error_from_forcing_weight_either_way[idx2_bias12] += wt2; + error_from_forcing_weight_down[idx2_bias12] += (dif2 * wt2); + } + + if (samplecount & 1) + { + i = samplecount - 1; + float wt = sample_weights[i]; + if32 p; + float sval = (samples[i] * rcp_stepsize) - scaled_offset; + p.f = sval + 12582912.0f; // FP representation abuse to avoid floor() and float->int conversion + float isval = p.f - 12582912.0f; + float dif = sval - isval; + + errval += (dif * wt) * dif; + + unsigned int idx_bias12 = idxtab[p.u & 0xFF]; + + if (idx_bias12 < minidx_bias12) + minidx_bias12 = idx_bias12; + if (idx_bias12 > maxidx_bias12) + maxidx_bias12 = idx_bias12; + + error_from_forcing_weight_either_way[idx_bias12] += wt; + error_from_forcing_weight_down[idx_bias12] += dif * wt; + } + + + lowest_weight[sp] = (int)minidx_bias12 - 12; + highest_weight[sp] = (int)maxidx_bias12 - 12; + error[sp] = errval; + + // the cut_(lowest/highest)_weight_error indicate the error that results from + // forcing samples that should have had the (lowest/highest) weight value + // one step (up/down). + cut_low_weight_error[sp] = error_from_forcing_weight_either_way[minidx_bias12] - 2.0f * error_from_forcing_weight_down[minidx_bias12]; + cut_high_weight_error[sp] = error_from_forcing_weight_either_way[maxidx_bias12] + 2.0f * error_from_forcing_weight_down[maxidx_bias12]; + + // clear out the error-from-forcing values we actually used in this pass + // so that these are clean for the next pass. + unsigned int ui; + for (ui = minidx_bias12 & ~0x3; ui <= maxidx_bias12; ui += 4) + { + error_from_forcing_weight_either_way[ui] = 0; + error_from_forcing_weight_down[ui] = 0; + error_from_forcing_weight_either_way[ui + 1] = 0; + error_from_forcing_weight_down[ui + 1] = 0; + error_from_forcing_weight_either_way[ui + 2] = 0; + error_from_forcing_weight_down[ui + 2] = 0; + error_from_forcing_weight_either_way[ui + 3] = 0; + error_from_forcing_weight_down[ui + 3] = 0; + } + } + + + for (sp = 0; sp < max_angular_steps; sp++) + { + float errscale = stepsizes_sqr[sp]; + error[sp] *= errscale; + cut_low_weight_error[sp] *= errscale; + cut_high_weight_error[sp] *= errscale; + } +} + + + +// main function for running the angular algorithm. + + +void compute_angular_endpoints_for_quantization_levels(int samplecount, const float *samples, const float *sample_weights, int max_quantization_level, float low_value[12], float high_value[12]) +{ + int i; + + + max_quantization_level++; // Temporarily increase level - needs refinement + + static const int quantization_steps_for_level[13] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 33, 36 }; + int max_quantization_steps = quantization_steps_for_level[max_quantization_level]; + + float offsets[ANGULAR_STEPS]; + + int max_angular_steps = max_angular_steps_needed_for_quant_level[max_quantization_level]; + + compute_angular_offsets(samplecount, samples, sample_weights, max_angular_steps, offsets); + + + // the +4 offsets are to allow for vectorization within compute_lowest_and_highest_weight(). + int8_t lowest_weight[ANGULAR_STEPS + 4]; + int8_t highest_weight[ANGULAR_STEPS + 4]; + float error[ANGULAR_STEPS + 4]; + + float cut_low_weight_error[ANGULAR_STEPS + 4]; + float cut_high_weight_error[ANGULAR_STEPS + 4]; + + compute_lowest_and_highest_weight(samplecount, samples, sample_weights, max_angular_steps, offsets, lowest_weight, highest_weight, error, cut_low_weight_error, cut_high_weight_error); + + + #ifdef DEBUG_PRINT_DIAGNOSTICS + if (print_diagnostics) + { + printf("%s : max-angular-steps=%d \n", __func__, max_angular_steps); + printf("Samplecount=%d, max_quantization_level=%d\n", samplecount, max_quantization_level); + for (i = 0; i < samplecount; i++) + printf("Sample %d : %f (weight %f)\n", i, samples[i], sample_weights[i]); + + for (i = 0; i < max_angular_steps; i++) + { + printf("%d: offset=%f error=%f lowest=%d highest=%d cl=%f ch=%f\n", i, offsets[i], error[i], lowest_weight[i], highest_weight[i], cut_low_weight_error[i], cut_high_weight_error[i]); + } + printf("\n"); + } + #endif + + // for each quantization level, find the best error terms. + float best_errors[40]; + int best_scale[40]; + uint8_t cut_low_weight[40]; + + for (i = 0; i < (max_quantization_steps + 4); i++) + { + best_errors[i] = 1e30f; + best_scale[i] = -1; // Indicates no solution found + cut_low_weight[i] = 0; + } + + + + for (i = 0; i < max_angular_steps; i++) + { + int samplecount = highest_weight[i] - lowest_weight[i] + 1; + if (samplecount >= (max_quantization_steps + 4)) + { + continue; + } + if (samplecount < 2) + samplecount = 2; + + if (best_errors[samplecount] > error[i]) + { + best_errors[samplecount] = error[i]; + best_scale[samplecount] = i; + cut_low_weight[samplecount] = 0; + } + + float error_cut_low = error[i] + cut_low_weight_error[i]; + float error_cut_high = error[i] + cut_high_weight_error[i]; + float error_cut_low_high = error[i] + cut_low_weight_error[i] + cut_high_weight_error[i]; + + if (best_errors[samplecount - 1] > error_cut_low) + { + best_errors[samplecount - 1] = error_cut_low; + best_scale[samplecount - 1] = i; + cut_low_weight[samplecount - 1] = 1; + } + + if (best_errors[samplecount - 1] > error_cut_high) + { + best_errors[samplecount - 1] = error_cut_high; + best_scale[samplecount - 1] = i; + cut_low_weight[samplecount - 1] = 0; + } + + if (best_errors[samplecount - 2] > error_cut_low_high) + { + best_errors[samplecount - 2] = error_cut_low_high; + best_scale[samplecount - 2] = i; + cut_low_weight[samplecount - 2] = 1; + } + + } + + // if we got a better error-value for a low sample count than for a high one, + // use the low sample count error value for the higher sample count as well. + for (i = 3; i <= max_quantization_steps; i++) + { + if (best_errors[i] > best_errors[i - 1]) + { + best_errors[i] = best_errors[i - 1]; + best_scale[i] = best_scale[i - 1]; + cut_low_weight[i] = cut_low_weight[i - 1]; + } + } + + + max_quantization_level--; // Decrease level again (see corresponding ++, above) + + static const int ql_weights[12] = { 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 33 }; + for (i = 0; i <= max_quantization_level; i++) + { + int q = ql_weights[i]; + int bsi = best_scale[q]; + + // Did we find anything? + if(bsi < 0) + { + printf("ERROR: Unable to find an encoding within the specified error limits. Please revise the error limit values and try again.\n"); + exit(1); + } + + float stepsize = stepsizes[bsi]; + int lwi = lowest_weight[bsi] + cut_low_weight[q]; + int hwi = lwi + q - 1; + float offset = offsets[bsi]; + + low_value[i] = offset + lwi * stepsize; + high_value[i] = offset + hwi * stepsize; + } + +} + + +// helper functions that will compute ideal angular-endpoints +// for a given set of weights and a given block size descriptors + +void compute_angular_endpoints_1plane(float mode_cutoff, const block_size_descriptor * bsd, + const float *decimated_quantized_weights, const float *decimated_weights, + float low_value[MAX_WEIGHT_MODES], float high_value[MAX_WEIGHT_MODES]) +{ + int i; + float low_values[MAX_DECIMATION_MODES][12]; + float high_values[MAX_DECIMATION_MODES][12]; + + for (i = 0; i < MAX_DECIMATION_MODES; i++) + { + int samplecount = bsd->decimation_mode_samples[i]; + int quant_mode = bsd->decimation_mode_maxprec_1plane[i]; + float percentile = bsd->decimation_mode_percentile[i]; + int permit_encode = bsd->permit_encode[i]; + if (permit_encode == 0 || samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff) + continue; + + + compute_angular_endpoints_for_quantization_levels(samplecount, + decimated_quantized_weights + i * MAX_WEIGHTS_PER_BLOCK, + decimated_weights + i * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values[i], high_values[i]); + } + + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (bsd->block_modes[i].is_dual_plane != 0 || bsd->block_modes[i].percentile > mode_cutoff) + continue; + int quant_mode = bsd->block_modes[i].quantization_mode; + int decim_mode = bsd->block_modes[i].decimation_mode; + + low_value[i] = low_values[decim_mode][quant_mode]; + high_value[i] = high_values[decim_mode][quant_mode]; + } + +} + + + +void compute_angular_endpoints_2planes(float mode_cutoff, + const block_size_descriptor * bsd, + const float *decimated_quantized_weights, + const float *decimated_weights, + float low_value1[MAX_WEIGHT_MODES], float high_value1[MAX_WEIGHT_MODES], float low_value2[MAX_WEIGHT_MODES], float high_value2[MAX_WEIGHT_MODES]) +{ + int i; + float low_values1[MAX_DECIMATION_MODES][12]; + float high_values1[MAX_DECIMATION_MODES][12]; + float low_values2[MAX_DECIMATION_MODES][12]; + float high_values2[MAX_DECIMATION_MODES][12]; + + for (i = 0; i < MAX_DECIMATION_MODES; i++) + { + int samplecount = bsd->decimation_mode_samples[i]; + int quant_mode = bsd->decimation_mode_maxprec_2planes[i]; + float percentile = bsd->decimation_mode_percentile[i]; + int permit_encode = bsd->permit_encode[i]; + if (permit_encode == 0 || samplecount < 1 || quant_mode < 0 || percentile > mode_cutoff) + continue; + + compute_angular_endpoints_for_quantization_levels(samplecount, + decimated_quantized_weights + 2 * i * MAX_WEIGHTS_PER_BLOCK, + decimated_weights + 2 * i * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values1[i], high_values1[i]); + + compute_angular_endpoints_for_quantization_levels(samplecount, + decimated_quantized_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, + decimated_weights + (2 * i + 1) * MAX_WEIGHTS_PER_BLOCK, quant_mode, low_values2[i], high_values2[i]); + + } + + for (i = 0; i < MAX_WEIGHT_MODES; i++) + { + if (bsd->block_modes[i].is_dual_plane != 1 || bsd->block_modes[i].percentile > mode_cutoff) + continue; + int quant_mode = bsd->block_modes[i].quantization_mode; + int decim_mode = bsd->block_modes[i].decimation_mode; + + low_value1[i] = low_values1[decim_mode][quant_mode]; + high_value1[i] = high_values1[decim_mode][quant_mode]; + low_value2[i] = low_values2[decim_mode][quant_mode]; + high_value2[i] = high_values2[decim_mode][quant_mode]; + } +} diff --git a/3rdparty/bimg/3rdparty/astc/astc_weight_quant_xfer_tables.cpp b/3rdparty/bimg/3rdparty/astc/astc_weight_quant_xfer_tables.cpp new file mode 100644 index 00000000000..4294735021d --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/astc_weight_quant_xfer_tables.cpp @@ -0,0 +1,1003 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Quantization transfer tables for ASTC. + */ +/*----------------------------------------------------------------------------*/ + + +#include "astc_codec_internals.h" + +const quantization_and_transfer_table quant_and_xfer_tables[12] = { + // quantization method 0, range 0..1 + { + QUANT_2, + {0, 64,}, + { + 0.000000, 1.000000,}, + {0, 0,}, + {1, 1,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, + }, + }, + + + + + // quantization method 1, range 0..2 + { + QUANT_3, + {0, 32, 64,}, + { + 0.000000, 0.500000, 1.000000,}, + {0, 0, 1,}, + {1, 2, 2,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, + }, + }, + + + + + // quantization method 2, range 0..3 + { + QUANT_4, + {0, 21, 43, 64,}, + { + 0.000000, 0.328125, 0.671875, 1.000000,}, + {0, 0, 1, 2,}, + {1, 2, 3, 3,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, + }, + }, + + + + + // quantization method 3, range 0..4 + { + QUANT_5, + {0, 16, 32, 48, 64,}, + { + 0.000000, 0.250000, 0.500000, 0.750000, + 1.000000,}, + {0, 0, 1, 2, 3,}, + {1, 2, 3, 4, 4,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, + }, + }, + + + + + // quantization method 4, range 0..5 + { + QUANT_6, + {0, 64, 12, 52, 25, 39,}, + { + 0.000000, 1.000000, 0.187500, 0.812500, + 0.390625, 0.609375,}, + {0, 3, 0, 5, 2, 4,}, + {2, 1, 4, 1, 5, 3,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, + }, + }, + + + + + // quantization method 5, range 0..7 + { + QUANT_8, + {0, 9, 18, 27, 37, 46, 55, 64,}, + { + 0.000000, 0.140625, 0.281250, 0.421875, + 0.578125, 0.718750, 0.859375, 1.000000,}, + {0, 0, 1, 2, 3, 4, 5, 6,}, + {1, 2, 3, 4, 5, 6, 7, 7,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, + }, + }, + + + + + // quantization method 6, range 0..9 + { + QUANT_10, + {0, 64, 7, 57, 14, 50, 21, 43, 28, 36,}, + { + 0.000000, 1.000000, 0.109375, 0.890625, + 0.218750, 0.781250, 0.328125, 0.671875, + 0.437500, 0.562500,}, + {0, 3, 0, 5, 2, 7, 4, 9, 6, 8,}, + {2, 1, 4, 1, 6, 3, 8, 5, 9, 7,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, + }, + }, + + + + + // quantization method 7, range 0..11 + { + QUANT_12, + {0, 64, 17, 47, 5, 59, 23, 41, 11, 53, 28, 36,}, + { + 0.000000, 1.000000, 0.265625, 0.734375, + 0.078125, 0.921875, 0.359375, 0.640625, + 0.171875, 0.828125, 0.437500, 0.562500,}, + {0, 5, 8, 7, 0, 9, 2, 11, 4, 3, 6, 10,}, + {4, 1, 6, 9, 8, 1, 10, 3, 2, 5, 11, 7,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, + }, + }, + + + + + // quantization method 8, range 0..15 + { + QUANT_16, + {0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64,}, + { + 0.000000, 0.062500, 0.125000, 0.187500, + 0.265625, 0.328125, 0.390625, 0.453125, + 0.546875, 0.609375, 0.671875, 0.734375, + 0.812500, 0.875000, 0.937500, 1.000000,}, + {0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,}, + {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, + }, + }, + + + + + // quantization method 9, range 0..19 + { + QUANT_20, + {0, 64, 16, 48, 3, 61, 19, 45, 6, 58, 23, 41, 9, 55, 26, 38, 13, 51, 29, 35,}, + { + 0.000000, 1.000000, 0.250000, 0.750000, + 0.046875, 0.953125, 0.296875, 0.703125, + 0.093750, 0.906250, 0.359375, 0.640625, + 0.140625, 0.859375, 0.406250, 0.593750, + 0.203125, 0.796875, 0.453125, 0.546875,}, + {0, 5, 16, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 17, 10, 19, 12, 3, 14, 18,}, + {4, 1, 6, 17, 8, 1, 10, 3, 12, 5, 14, 7, 16, 9, 18, 11, 2, 13, 19, 15,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, + }, + }, + + + + + // quantization method 10, range 0..23 + { + QUANT_24, + {0, 64, 8, 56, 16, 48, 24, 40, 2, 62, 11, 53, 19, 45, 27, 37, 5, 59, 13, 51, 22, 42, 30, 34,}, + { + 0.000000, 1.000000, 0.125000, 0.875000, + 0.250000, 0.750000, 0.375000, 0.625000, + 0.031250, 0.968750, 0.171875, 0.828125, + 0.296875, 0.703125, 0.421875, 0.578125, + 0.078125, 0.921875, 0.203125, 0.796875, + 0.343750, 0.656250, 0.468750, 0.531250,}, + {0, 9, 16, 11, 18, 13, 20, 15, 0, 17, 2, 19, 4, 21, 6, 23, 8, 3, 10, 5, 12, 7, 14, 22,}, + {8, 1, 10, 17, 12, 19, 14, 21, 16, 1, 18, 3, 20, 5, 22, 7, 2, 9, 4, 11, 6, 13, 23, 15,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, + }, + }, + + + + + // quantization method 11, range 0..31 + { + QUANT_32, + {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,}, + { + 0.000000, 0.031250, 0.062500, 0.093750, + 0.125000, 0.156250, 0.187500, 0.218750, + 0.250000, 0.281250, 0.312500, 0.343750, + 0.375000, 0.406250, 0.437500, 0.468750, + 0.531250, 0.562500, 0.593750, 0.625000, + 0.656250, 0.687500, 0.718750, 0.750000, + 0.781250, 0.812500, 0.843750, 0.875000, + 0.906250, 0.937500, 0.968750, 1.000000,}, + {0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,}, + {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31,}, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, + 31, + }, + }, + +}; diff --git a/3rdparty/bimg/3rdparty/astc/license.txt b/3rdparty/bimg/3rdparty/astc/license.txt new file mode 100644 index 00000000000..a33bccd57e7 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/license.txt @@ -0,0 +1,137 @@ +END USER LICENCE AGREEMENT FOR THE MALI ASTC SPECIFICATION AND SOFTWARE CODEC, +VERSION: 1.3 + +THIS END USER LICENCE AGREEMENT ("LICENCE") IS A LEGAL AGREEMENT BETWEEN YOU +(EITHER A SINGLE INDIVIDUAL, OR SINGLE LEGAL ENTITY) AND ARM LIMITED ("ARM") +FOR THE USE OF THE SOFTWARE ACCOMPANYING THIS LICENCE. ARM IS ONLY WILLING +TO LICENSE THE SOFTWARE TO YOU ON CONDITION THAT YOU ACCEPT ALL OF THE TERMS +IN THIS LICENCE. BY CLICKING "I AGREE" OR BY INSTALLING OR OTHERWISE USING +OR COPYING THE SOFTWARE YOU INDICATE THAT YOU AGREE TO BE BOUND BY ALL THE +TERMS OF THIS LICENCE. + +IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENCE, ARM IS UNWILLING TO LICENSE +THE SOFTWARE TO YOU AND YOU MAY NOT INSTALL, USE OR COPY THE SOFTWARE. + +1. DEFINITIONS. + +"Authorised Purpose" means the use of the Software solely to develop products +and tools which implement the Khronos ASTC specification to; +(i) compress texture images into ASTC format ("Compression Results"); +(ii) distribute such Compression Results to third parties; and +(iii) decompress texture images stored in ASTC format. + +"Software" means the source code and Software binaries accompanying this +Licence, and any printed, electronic or online documentation supplied with it, +in all cases relating to the MALI ASTC SPECIFICATION AND SOFTWARE CODEC. + +2. LICENCE GRANT. + +ARM hereby grants to you, subject to the terms and conditions of this Licence, +a nonexclusive, nontransferable, free of charge, royalty free, worldwide +licence to use, copy, modify and (subject to Clause 3 below) distribute the +Software solely for the Authorised Purpose. + +No right is granted to use the Software to develop hardware. + +Notwithstanding the foregoing, nothing in this Licence prevents you from +using the Software to develop products that conform to an application +programming interface specification issued by The Khronos Group Inc. +("Khronos"), provided that you have licences to develop such products +under the relevant Khronos agreements. + + 3. RESTRICTIONS ON USE OF THE SOFTWARE. + +RESTRICTIONS ON TRANSFER OF LICENSED RIGHTS: The rights granted to you under +this Licence may not be assigned by you to any third party without the prior +written consent of ARM. + +TITLE AND RESERVATION OF RIGHTS: You acquire no rights to the Software other +than as expressly provided by this Licence. The Software is licensed not sold. +ARM does not transfer title to the Software to you. In no event shall the +licences granted in Clause 2 be construed as granting you expressly or by +implication, estoppel or otherwise, licences to any ARM technology other than +the Software. + +NOTICES: You shall not remove from the Software any copyright notice or other +notice (whether ARM's or its licensor's), and you shall ensure that any such +notice is reproduced in any copies of the whole or any part of the Software +made by you. You shall not use ARM's or its licensor's name, logo or +trademarks to market Compression Results. If you distribute the Software to a +third party, you agree to include a copy of this Licence with such +distribution. + +4. NO SUPPORT. + +ARM has no obligation to support or to continue providing or updating any of +the Software. + +5. NO WARRANTIES. + +YOU AGREE THAT THE SOFTWARE IS LICENSED "AS IS", AND THAT ARM EXPRESSLY +DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS OR OTHER TERMS, EXPRESS, +IMPLIED OR STATUTORY, TO THE FULLEST EXTENT PERMITTED BY LAW. YOU EXPRESSLY +ASSUME ALL LIABILITIES AND RISKS, FOR USE OR OPERATION OF ANY APPLICATION +PROGRAMS YOU CREATE WITH THE SOFTWARE, AND YOU ASSUME THE ENTIRE COST OF ALL +NECESSARY SERVICING, REPAIR OR CORRECTION. + +6. LIMITATION OF LIABILITY. + +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL ARM BE +LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +(INCLUDING LOSS OF PROFITS) ARISING OUT OF THE USE OR INABILITY TO USE THE +SOFTWARE WHETHER BASED ON A CLAIM UNDER CONTRACT, TORT OR OTHER LEGAL THEORY, +EVEN IF ARM WAS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +ARM does not seek to limit or exclude liability for death or personal injury +arising from ARM's negligence and because some jurisdictions do not permit the +exclusion or limitation of liability for consequential or incidental damages +the above limitation relating to liability for consequential damages may not +apply to you. + +NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS LICENCE, THE +MAXIMUM LIABILITY OF ARM TO YOU IN AGGREGATE FOR ALL CLAIMS MADE AGAINST ARM +IN CONTRACT TORT OR OTHERWISE UNDER OR IN CONNECTION WITH THE SUBJECT MATTER +OF THIS LICENCE SHALL NOT EXCEED THE GREATER OF THE TOTAL OF SUMS PAID BY YOU +TO ARM (IF ANY) FOR THIS LICENCE AND US$5.00. + +7. U.S. GOVERNMENT END USERS. + +US Government Restrictions: Use, duplication, reproduction, release, +modification, disclosure or transfer of this commercial product and +accompanying documentation is restricted in accordance with the terms +of this Licence. + +8. TERM AND TERMINATION. + +This Licence shall remain in force until terminated by you or by ARM. Without +prejudice to any of its other rights if you are in breach of any of the terms +and conditions of this Licence then ARM may terminate this Licence immediately +upon giving written notice to you. You may terminate this Licence at any time. + +Upon termination of this Licence by you or by ARM you shall stop using the +Software and destroy all copies of the Software in your possession together +with all documentation and related materials. The provisions of Clauses 1, 3, +4, 5, 6, 7, 8 and 9 shall survive termination of this Licence. + +9. GENERAL. + +This Licence is governed by English Law. Except where ARM agrees otherwise in +a written contract signed by you and ARM, this is the only agreement between +you and ARM relating to the Software and it may only be modified by written +agreement between you and ARM. Except as expressly agreed in writing, this +Licence may not be modified by purchase orders, advertising or other +representation by any person. If any clause in this Licence is held by a court +of law to be illegal or unenforceable the remaining provisions of this Licence +shall not be affected thereby. The failure by ARM to enforce any of the +provisions of this Licence, unless waived in writing, shall not constitute a +waiver of ARM's rights to enforce such provision or any other provision of +this Licence in the future. + +You agree to comply fully with all laws and regulations of the United States +and other countries ("Export Laws") to assure that the Software is not; +(1) exported, directly or indirectly, in violation of Export Laws, either to +any countries that are subject to U.S.A. export restrictions or to any end +user who has been prohibited from participating in the U.S.A. export +transactions by any federal agency of the U.S.A. government; or +(2) intended to be used for any purpose prohibited by Export Laws, including, +without limitation, nuclear, chemical, or biological weapons proliferation. diff --git a/3rdparty/bimg/3rdparty/astc/mathlib.cpp b/3rdparty/bimg/3rdparty/astc/mathlib.cpp new file mode 100644 index 00000000000..aa6eac1ff5b --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/mathlib.cpp @@ -0,0 +1,781 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Library of math functions. + */ +/*----------------------------------------------------------------------------*/ + +#define _USE_MATH_DEFINES // for M_PI on windows + +#include +#include +#include +#include +#include "mathlib.h" + +#ifdef WIN32 + double cbrt(double n) + { + return n < 0 ? -pow(-n, 1.0 / 3.0) : pow(n, 1.0 / 3.0); + } +#endif + +/************************** + basic OpenCL functions +**************************/ + +float inversesqrt(float p) +{ + return 1.0f / sqrt(p); +} +float acospi(float p) +{ + return static_cast < float >(acos(p) * (1.0f / M_PI)); +}; +float sinpi(float p) +{ + return static_cast < float >(sin(p * M_PI)); +} +float cospi(float p) +{ + return static_cast < float >(cos(p * M_PI)); +} + + +float nan(int p) +{ + union + { + int p; + float q; + } v; + v.p = p | 0x7FC00000U; + return v.q; +} + +#if !defined(_MSC_VER) && (__cplusplus < 201103L) +float fmax(float p, float q) +{ + if (p != p) + return q; + if (q != q) + return p; + if (p > q) + return p; + return q; +} + +float fmin(float p, float q) +{ + if (p != p) + return q; + if (q != q) + return p; + if (p < q) + return p; + return q; +} +#endif // C++11 + +float2 fmax(float2 p, float2 q) +{ + return float2(fmax(p.x, q.x), fmax(p.y, q.y)); +} + +float3 fmax(float3 p, float3 q) +{ + return float3(fmax(p.x, q.x), fmax(p.y, q.y), fmax(p.z, q.z)); +} + +float4 fmax(float4 p, float4 q) +{ + return float4(fmax(p.x, q.x), fmax(p.y, q.y), fmax(p.z, q.z), fmax(p.w, q.w)); +} + + +float2 fmin(float2 p, float2 q) +{ + return float2(fmin(p.x, q.x), fmin(p.y, q.y)); +} + +float3 fmin(float3 p, float3 q) +{ + return float3(fmin(p.x, q.x), fmin(p.y, q.y), fmin(p.z, q.z)); +} + +float4 fmin(float4 p, float4 q) +{ + return float4(fmin(p.x, q.x), fmin(p.y, q.y), fmin(p.z, q.z), fmin(p.w, q.w)); +} + +/* + float dot( float2 p, float2 q ) { return p.x*q.x + p.y*q.y; } float dot( float3 p, float3 q ) { return p.x*q.x + p.y*q.y + p.z*q.z; } float dot( float4 p, float4 q ) { return p.x*q.x + p.y*q.y + + p.z*q.z + p.w*q.w; } */ + +float3 cross(float3 p, float3 q) +{ + return p.yzx * q.zxy - p.zxy * q.yzx; +} + +float4 cross(float4 p, float4 q) +{ + return float4(p.yzx * q.zxy - p.zxy * q.yzx, 0.0f); +} + +float length(float2 p) +{ + return sqrt(dot(p, p)); +} + +float length(float3 p) +{ + return sqrt(dot(p, p)); +} + +float length(float4 p) +{ + return sqrt(dot(p, p)); +} + +float length_sqr(float2 p) +{ + return dot(p, p); +} + +float length_sqr(float3 p) +{ + return dot(p, p); +} + +float length_sqr(float4 p) +{ + return dot(p, p); +} + + +float distance(float2 p, float2 q) +{ + return length(q - p); +} + +float distance(float3 p, float3 q) +{ + return length(q - p); +} + +float distance(float4 p, float4 q) +{ + return length(q - p); +} + +float distance_sqr(float2 p, float2 q) +{ + return length_sqr(q - p); +} + +float distance_sqr(float3 p, float3 q) +{ + return length_sqr(q - p); +} + +float distance_sqr(float4 p, float4 q) +{ + return length_sqr(q - p); +} + + +float2 normalize(float2 p) +{ + return p / length(p); +} + +float3 normalize(float3 p) +{ + return p / length(p); +} + +float4 normalize(float4 p) +{ + return p / length(p); +} + + +/************************************************** + matrix functions, for 2x2, 3x3 and 4x4 matrices: + + * trace + * determinant + * transform + * inverse + * adjugate + * characteristic polynomial + * eigenvalue + * eigenvector + + additionally, root solver + for 2nd, 3rd and 4th degree monic polynomials. + +*************************************************/ + +/* + struct mat2 { float2 v[2]; }; + struct mat3 { float3 v[3]; }; + struct mat4 { float4 v[4]; }; +*/ + +float trace(mat2 p) +{ + return p.v[0].x + p.v[1].y; +} + +float trace(mat3 p) +{ + return p.v[0].x + p.v[1].y + p.v[2].z; +} + +float trace(mat4 p) +{ + return p.v[0].x + p.v[1].y + p.v[2].z + p.v[3].w; +} + +float determinant(mat2 p) +{ + float2 v = p.v[0].xy * p.v[1].yx; + return v.x - v.y; +} + +float determinant(mat3 p) +{ + return dot(p.v[0], cross(p.v[1], p.v[2])); +} + +float determinant(mat4 p) +{ + return dot(p.v[0], + float4(dot(p.v[1].yzw, cross(p.v[2].yzw, p.v[3].yzw)), + -dot(p.v[1].xzw, cross(p.v[2].xzw, p.v[3].xzw)), dot(p.v[1].xyw, cross(p.v[2].xyw, p.v[3].xyw)), -dot(p.v[1].xyz, cross(p.v[2].xyz, p.v[3].xyz)))); +} + + +/* + characteristic polynomials for matrices. These polynomials are monic, meaning that the coefficient of the highest component is 1; this component is omitted. The first component is the constant + part. */ + +float2 characteristic_poly(mat2 p) +{ + return float2(determinant(p), -trace(p)); +} + + +float3 characteristic_poly(mat3 p) +{ + float2 v1 = (p.v[0].xy * p.v[1].yx) + (p.v[0].xz * p.v[2].zx) + (p.v[1].yz * p.v[2].zy); + + return float3(-determinant(p), v1.x - v1.y, -trace(p)); +} + + +float4 characteristic_poly(mat4 p) +{ + float2 v1 = (p.v[0].xy * p.v[1].yx) + (p.v[0].xz * p.v[2].zx) + (p.v[0].xw * p.v[3].wx) + (p.v[1].yz * p.v[2].zy) + (p.v[1].yw * p.v[3].wy) + (p.v[2].zw * p.v[3].wz); + + return float4(determinant(p), + -dot(p.v[1].yzw, cross(p.v[2].yzw, p.v[3].yzw)) + - dot(p.v[0].xzw, cross(p.v[2].xzw, p.v[3].xzw)) - dot(p.v[0].xyw, cross(p.v[1].xyw, p.v[3].xyw)) - dot(p.v[0].xyz, cross(p.v[1].xyz, p.v[2].xyz)), v1.x - v1.y, -trace(p)); +} + + +/* + Root finders for monic polynomials (highest coefficient is equal to 1) + + Returns a vector with length equal to the number of roots that the polynomial has; + for roots that do not genuinely exist, we return NaN. + + The polynomial is basically + + poly(n) = p.x + p.y*n + p.z*n^2 + p.w*n^3 + + (including only the components of the vector that actually exist; the next coefficient + has the value 1, and the remaining ones have value 0. ) + */ + + +float2 solve_monic(float2 p) +{ + float v = sqrt(p.y * p.y - 4 * p.x); + return (p.yy + float2(v, -v)) * -0.5f; +} + +float3 solve_monic(float3 p) +{ + + p = p * (1.0f / 3.0f); + + float pz = p.z; + + // compute a normalization value to scale the vector by. + // The normalization factor is divided by 2^20. + // This is supposed to make internal calculations unlikely + // to overflow while also making underflows unlikely. + float scal = 1.0f; + + float cx = static_cast < float >(cbrt(fabs(p.x))); + float cy = static_cast < float >(cbrt(fabs(p.y))); + scal = fmax(fmax(fabsf(p.z), cx), cy * cy) * (1.0f / 1048576.0f); + float rscal = 1.0f / scal; + p = p * float3(rscal * rscal * rscal, rscal * rscal, rscal); + + float bb = p.z * p.z; // div scal^2 + + float nq = bb - p.y; // div scal^2 + float r = 1.5f * (p.y * p.z - p.x) - p.z * bb; // div scal^3 + float nq3 = nq * nq * nq; // div scal^6 + float r2 = r * r; // div scal^6 + + if (nq3 < r2) + { + // one root + float root = sqrt(r2 - nq3); // div scal^3 + float s = static_cast < float >(cbrt(r + root)); // div scal + float t = static_cast < float >(cbrt(r - root)); // div scal + return float3((s + t) * scal - pz, nan(0), nan(0)); + } + else + { + // three roots + float phi_r = inversesqrt(nq3); // div scal ^ -3 + float phi_root = static_cast < float >(cbrt(phi_r * nq3)); // div scal + float theta = acospi(r * phi_r); + theta *= 1.0f / 3.0f; + float ncprod = phi_root * cospi(theta); + float dev = 1.73205080756887729353f * phi_root * sinpi(theta); + return float3(2 * ncprod, -dev - ncprod, dev - ncprod) * scal - pz; + } +} + + +/* + * This function is not overflow-safe. Use with care. + */ +float4 solve_monic(float4 p) +{ + + // step 1: depress the input polynomial + float bias = p.w * 0.25f; + float3 qv = float3((-3.0f / 256.0f) * p.w * p.w, (1.0f / 8.0f) * p.w, (-3.0 / 8.0f)); + float3 rv = float3((1.0f / 16.0f) * p.z * p.w - (1.0f / 4.0f) * p.y, (-1.0f / 2.0f) * p.z, 0.0f); + float3 qx = float3(qv * p.w + rv) * p.w + p.xyz; + + // step 2: solve a cubic equation to get hold of a parameter p. + float3 monicp = float3(-qx.y * qx.y, (qx.z * qx.z) - (4.0f * qx.x), 2.0f * qx.z); + float4 v = float4(solve_monic(monicp), 1e-37f); + + // the cubic equation may have multiple solutions; at least one of them + // is numerically at least nonnegative (but may have become negative as a result of + // a roundoff error). We use fmax() to extract this value or a very small positive value. + float2 v2 = fmax(v.xy, v.zw); + float p2 = fmax(v2.x, v2.y); // p^2 + float pr = inversesqrt(p2); // 1/p + float pm = p2 * pr; // p + + // step 3: use the solution for the cubic equation to set up two quadratic equations; + // these two equations then result in the 4 possible roots. + float f1 = qx.z + p2; + float f2 = qx.y * pr; + float s = 0.5f * (f1 + f2); + float q = 0.5f * (f1 - f2); + + float4 res = float4(solve_monic(float2(q, pm)), + solve_monic(float2(s, -pm))); + + // finally, order the results and apply the bias. + if (res.x != res.x) + return res.zwxy - bias; + else + return res - bias; +} + + + +float2 transform(mat2 p, float2 q) +{ + return float2(dot(p.v[0], q), dot(p.v[1], q)); +} + + +float3 transform(mat3 p, float3 q) +{ + return float3(dot(p.v[0], q), dot(p.v[1], q), dot(p.v[2], q)); +} + + +float4 transform(mat4 p, float4 q) +{ + return float4(dot(p.v[0], q), dot(p.v[1], q), dot(p.v[2], q), dot(p.v[3], q)); +} + + + +mat2 adjugate(mat2 p) +{ + mat2 res; + res.v[0] = float2(p.v[1].y, -p.v[0].y); + res.v[1] = float2(-p.v[1].x, p.v[0].x); + return res; +} + + + +mat2 invert(mat2 p) +{ + float rdet = 1.0f / determinant(p); + mat2 res; + res.v[0] = float2(p.v[1].y, -p.v[0].y) * rdet; + res.v[1] = float2(-p.v[1].x, p.v[0].x) * rdet; + return res; +} + + + +mat3 adjugate(mat3 p) +{ + mat3 res; + float3 prd0 = cross(p.v[1], p.v[2]); + float3 prd1 = cross(p.v[2], p.v[0]); + float3 prd2 = cross(p.v[0], p.v[1]); + res.v[0] = float3(prd0.x, prd1.x, prd2.x); + res.v[1] = float3(prd0.y, prd1.y, prd2.y); + res.v[2] = float3(prd0.z, prd1.z, prd2.z); + return res; +} + + + +mat3 invert(mat3 p) +{ + float3 cross0 = cross(p.v[1], p.v[2]); + float det = dot(cross0, p.v[0]); + float rdet = 1.0f / det; + mat3 res; + float3 prd0 = cross0 * rdet; + float3 prd1 = cross(p.v[2], p.v[0]) * rdet; + float3 prd2 = cross(p.v[0], p.v[1]) * rdet; + res.v[0] = float3(prd0.x, prd1.x, prd2.x); + res.v[1] = float3(prd0.y, prd1.y, prd2.y); + res.v[2] = float3(prd0.z, prd1.z, prd2.z); + return res; +} + + + +mat4 adjugate(mat4 p) +{ + mat4 res; + + float3 bpc0 = cross(p.v[2].yzw, p.v[3].yzw); + float3 tpc0 = cross(p.v[0].yzw, p.v[1].yzw); + res.v[0] = float4(dot(bpc0, p.v[1].yzw), -dot(bpc0, p.v[0].yzw), dot(tpc0, p.v[3].yzw), -dot(tpc0, p.v[2].yzw)); + + float3 bpc1 = cross(p.v[2].xzw, p.v[3].xzw); + float3 tpc1 = cross(p.v[0].xzw, p.v[1].xzw); + res.v[1] = float4(-dot(bpc1, p.v[1].xzw), dot(bpc1, p.v[0].xzw), -dot(tpc1, p.v[3].xzw), dot(tpc1, p.v[2].xzw)); + + float3 bpc2 = cross(p.v[2].xyw, p.v[3].xyw); + float3 tpc2 = cross(p.v[0].xyw, p.v[1].xyw); + res.v[2] = float4(dot(bpc2, p.v[1].xyw), -dot(bpc2, p.v[0].xyw), dot(tpc2, p.v[3].xyw), -dot(tpc2, p.v[2].xyw)); + + float3 bpc3 = cross(p.v[2].xyz, p.v[3].xyz); + float3 tpc3 = cross(p.v[0].xyz, p.v[1].xyz); + res.v[3] = float4(-dot(bpc3, p.v[1].xyz), dot(bpc3, p.v[0].xyz), -dot(tpc3, p.v[3].xyz), dot(tpc3, p.v[2].xyz)); + + return res; +} + + + +mat4 invert(mat4 p) +{ + // cross products between the bottom two rows + float3 bpc0 = cross(p.v[2].yzw, p.v[3].yzw); + float3 bpc1 = cross(p.v[2].xzw, p.v[3].xzw); + float3 bpc2 = cross(p.v[2].xyw, p.v[3].xyw); + float3 bpc3 = cross(p.v[2].xyz, p.v[3].xyz); + + // dot-products for the top rows + float4 row1 = float4(dot(bpc0, p.v[1].yzw), + -dot(bpc1, p.v[1].xzw), + dot(bpc2, p.v[1].xyw), + -dot(bpc3, p.v[1].xyz)); + + float det = dot(p.v[0], row1); + float rdet = 1.0f / det; + + mat4 res; + + float3 tpc0 = cross(p.v[0].yzw, p.v[1].yzw); + res.v[0] = float4(row1.x, -dot(bpc0, p.v[0].yzw), dot(tpc0, p.v[3].yzw), -dot(tpc0, p.v[2].yzw)) * rdet; + + float3 tpc1 = cross(p.v[0].xzw, p.v[1].xzw); + res.v[1] = float4(row1.y, dot(bpc1, p.v[0].xzw), -dot(tpc1, p.v[3].xzw), dot(tpc1, p.v[2].xzw)) * rdet; + float3 tpc2 = cross(p.v[0].xyw, p.v[1].xyw); + + res.v[2] = float4(row1.z, -dot(bpc2, p.v[0].xyw), dot(tpc2, p.v[3].xyw), -dot(tpc2, p.v[2].xyw)) * rdet; + + float3 tpc3 = cross(p.v[0].xyz, p.v[1].xyz); + res.v[3] = float4(row1.w, dot(bpc3, p.v[0].xyz), -dot(tpc3, p.v[3].xyz), dot(tpc3, p.v[2].xyz)) * rdet; + + + return res; +} + + + +float2 eigenvalues(mat2 p) +{ + return solve_monic(characteristic_poly(p)); +} + +float3 eigenvalues(mat3 p) +{ + return solve_monic(characteristic_poly(p)); +} + +float4 eigenvalues(mat4 p) +{ + return solve_monic(characteristic_poly(p)); +} + +float2 eigenvector(mat2 p, float eigvl) +{ + // for a mat2, we first reverse-subtract the eigenvalue from the matrix diagonal, + // then return whichever row had the larger sum-of-absolute-values. + float4 v = float4(p.v[0], p.v[1]); + v.xw = eigvl - v.xw; + if (fabs(v.x) + fabs(v.y) > fabs(v.z) + fabs(v.w)) + return v.yx; + else + return v.wz; +} + + +float3 eigenvector(mat3 p, float eigvl) +{ + // for a mat3, we obtain the eigenvector as follows: + // step 1: subtract the eigenvalue from the matrix diagonal + // step 2: take two cross products between rows in the matrix + // step 3: return whichever of the cross products resulted in a longer vector. + + float3 r0 = p.v[0]; + float3 r1 = p.v[1]; + float3 r2 = p.v[2]; + + r0.x = r0.x - eigvl; + r1.y = r1.y - eigvl; + r2.z = r2.z - eigvl; + + float3 v1 = cross(r0, r1); + float3 v2 = cross(r1, r2); + + float len1 = dot(v1, v1); + float len2 = dot(v2, v2); + return len1 > len2 ? v1 : v2; +} + + +// generalized cross product: 3 vectors with 4 components each. +// The result is a vector that is perpendicular to all the three specified vectors. + +// it works in the sense that it produces a perpendicular-to-everything vector, +// but it has not been tested whether it points in the "right" direction. +float4 gcross(float4 p, float4 q, float4 r) +{ + return float4(dot(p.yzw, cross(q.yzw, r.yzw)), -dot(p.xzw, cross(q.xzw, r.xzw)), dot(p.xyw, cross(q.xyw, r.xyw)), -dot(p.xyz, cross(q.xyz, r.xyz))); +} + + + +float4 eigenvector(mat4 p, float eigvl) +{ + float4 r0 = p.v[0]; + float4 r1 = p.v[1]; + float4 r2 = p.v[2]; + float4 r3 = p.v[3]; + + r0.x = r0.x - eigvl; + r1.y = r1.y - eigvl; + r2.z = r2.z - eigvl; + r3.w = r3.w - eigvl; + + // generate four candidate vectors using the generalized cross product. + // These will in general point in the same direction (or 180 degree opposite), + // however they will have different lengths. Pick the longest one. + float3 tpc0 = cross(r0.yzw, r1.yzw); + float3 tpc1 = cross(r0.xzw, r1.xzw); + float3 tpc2 = cross(r0.xyw, r1.xyw); + float3 tpc3 = cross(r0.xyz, r1.xyz); + + float4 v1 = float4(dot(r2.yzw, tpc0), + -dot(r2.xzw, tpc1), + dot(r2.xyw, tpc2), + -dot(r2.xyz, tpc3)); + + float4 v2 = float4(dot(r3.yzw, tpc0), + -dot(r3.xzw, tpc1), + dot(r3.xyw, tpc2), + -dot(r3.xyz, tpc3)); + + float3 bpc0 = cross(r2.yzw, r3.yzw); + float3 bpc1 = cross(r2.xzw, r3.xzw); + float3 bpc2 = cross(r2.xyw, r3.xyw); + float3 bpc3 = cross(r2.xyz, r3.xyz); + + float4 v3 = float4(dot(r0.yzw, bpc0), + -dot(r0.xzw, bpc1), + dot(r0.xyw, bpc2), + -dot(r0.xyz, bpc3)); + + float4 v4 = float4(dot(r1.yzw, bpc0), + -dot(r1.xzw, bpc1), + dot(r1.xyw, bpc2), + -dot(r1.xyz, bpc3)); + + float len1 = dot(v1, v1); + float len2 = dot(v2, v2); + float len3 = dot(v3, v3); + float len4 = dot(v4, v4); + + if (fmax(len1, len2) > fmax(len3, len4)) + return len1 > len2 ? v1 : v2; + else + return len3 > len4 ? v3 : v4; +} + + +// matrix multiply + +mat2 operator *(mat2 a, mat2 b) +{ + mat2 res; + res.v[0] = a.v[0].x * b.v[0] + a.v[0].y * b.v[1]; + res.v[1] = a.v[1].x * b.v[0] + a.v[1].y * b.v[1]; + return res; +} + +mat3 operator *(mat3 a, mat3 b) +{ + mat3 res; + res.v[0] = a.v[0].x * b.v[0] + a.v[0].y * b.v[1] + a.v[0].z * b.v[2]; + res.v[1] = a.v[1].x * b.v[0] + a.v[1].y * b.v[1] + a.v[1].z * b.v[2]; + res.v[2] = a.v[2].x * b.v[0] + a.v[2].y * b.v[1] + a.v[2].z * b.v[2]; + return res; +} + +mat4 operator *(mat4 a, mat4 b) +{ + mat4 res; + res.v[0] = a.v[0].x * b.v[0] + a.v[0].y * b.v[1] + a.v[0].z * b.v[2] + a.v[0].w * b.v[3]; + res.v[1] = a.v[1].x * b.v[0] + a.v[1].y * b.v[1] + a.v[1].z * b.v[2] + a.v[1].w * b.v[3]; + res.v[2] = a.v[2].x * b.v[0] + a.v[2].y * b.v[1] + a.v[2].z * b.v[2] + a.v[2].w * b.v[3]; + res.v[3] = a.v[3].x * b.v[0] + a.v[3].y * b.v[1] + a.v[3].z * b.v[2] + a.v[3].w * b.v[3]; + return res; +} + + + +/************************* + +simple geometric functions + +*************************/ + + +// return parameter value for the point on the line closest to the specified point +float param_nearest_on_line(float2 point, line2 line) +{ + return dot(point - line.a, line.b) / dot(line.b, line.b); +} + +float param_nearest_on_line(float3 point, line3 line) +{ + return dot(point - line.a, line.b) / dot(line.b, line.b); +} + +float param_nearest_on_line(float4 point, line4 line) +{ + return dot(point - line.a, line.b) / dot(line.b, line.b); +} + + +// return distance between point and line +float point_line_distance(float2 point, line2 line) +{ + return distance(point, line.a + line.b * param_nearest_on_line(point, line)); +} + +float point_line_distance(float3 point, line3 line) +{ + return distance(point, line.a + line.b * param_nearest_on_line(point, line)); +} + +float point_line_distance(float4 point, line4 line) +{ + return distance(point, line.a + line.b * param_nearest_on_line(point, line)); +} + + +float point_line_distance_sqr(float2 point, line2 line) +{ + return distance_sqr(point, line.a + line.b * param_nearest_on_line(point, line)); +} + +float point_line_distance_sqr(float3 point, line3 line) +{ + return distance_sqr(point, line.a + line.b * param_nearest_on_line(point, line)); +} + +float point_line_distance_sqr(float4 point, line4 line) +{ + return distance_sqr(point, line.a + line.b * param_nearest_on_line(point, line)); +} + + + +// distance between plane/hyperplane in 3D and 4D +float point_plane_3d_distance(float3 point, plane_3d plane) +{ + return dot(point - plane.root_point, plane.normal); +} + + +float point_hyperplane_4d_distance(float4 point, hyperplane_4d plane) +{ + return dot(point - plane.root_point, plane.normal); +} + + +// helper functions to produce a 3D plane from three points and a 4D hyperplane from four points. +plane_3d generate_plane_from_points(float3 point0, float3 point1, float3 point2) +{ + plane_3d res; + res.root_point = point0; + res.normal = normalize(cross(point1 - point0, point2 - point0)); + return res; +} + +hyperplane_4d generate_hyperplane_from_points(float4 point0, float4 point1, float4 point2, float4 point3) +{ + hyperplane_4d res; + res.root_point = point0; + res.normal = normalize(gcross(point1 - point0, point2 - point0, point3 - point0)); + return res; +} + + diff --git a/3rdparty/bimg/3rdparty/astc/mathlib.h b/3rdparty/bimg/3rdparty/astc/mathlib.h new file mode 100644 index 00000000000..377ea0e21f2 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/mathlib.h @@ -0,0 +1,200 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012, 2018 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Internal math library declarations for ASTC codec. + */ +/*----------------------------------------------------------------------------*/ + +#ifndef MATHLIB_H_INCLUDED + +#define MATHLIB_H_INCLUDED + +#include "vectypes.h" + +// basic OpenCL functions +float inversesqrt(float p); +float acospi(float p); +float sinpi(float p); +float cospi(float p); + +float nan(int p); + +#if !defined(_MSC_VER) && (__cplusplus < 201103L) +float fmax(float p, float q); +float fmin(float p, float q); +#endif // C++11 + +float2 fmax(float2 p, float2 q); + +float3 fmax(float3 p, float3 q); + +float4 fmax(float4 p, float4 q); +float2 fmin(float2 p, float2 q); +float3 fmin(float3 p, float3 q); +float4 fmin(float4 p, float4 q); + +/* + float dot( float2 p, float2 q ); + float dot( float3 p, float3 q ); + float dot( float4 p, float4 q ); +*/ + +static inline float dot(float2 p, float2 q) +{ + return p.x * q.x + p.y * q.y; +} +static inline float dot(float3 p, float3 q) +{ + return p.x * q.x + p.y * q.y + p.z * q.z; +} +static inline float dot(float4 p, float4 q) +{ + return p.x * q.x + p.y * q.y + p.z * q.z + p.w * q.w; +} + + +float3 cross(float3 p, float3 q); +float4 cross(float4 p, float4 q); + +float length(float2 p); +float length(float3 p); +float length(float4 p); + +float length_sqr(float2 p); +float length_sqr(float3 p); +float length_sqr(float4 p); + +float distance(float2 p, float2 q); +float distance(float3 p, float3 q); +float distance(float4 p, float4 q); + +float distance_sqr(float2 p, float2 q); +float distance_sqr(float3 p, float3 q); +float distance_sqr(float4 p, float4 q); + +float2 normalize(float2 p); +float3 normalize(float3 p); +float4 normalize(float4 p); + + + +// functions other than just basic OpenCL functions + +float4 gcross(float4 p, float4 q, float4 r); + +struct mat2 +{ + float2 v[2]; +}; +struct mat3 +{ + float3 v[3]; +}; +struct mat4 +{ + float4 v[4]; +}; + +float trace(mat2 p); +float trace(mat3 p); +float trace(mat4 p); + +float determinant(mat2 p); +float determinant(mat3 p); +float determinant(mat4 p); + +float2 characteristic_poly(mat2 p); +float3 characteristic_poly(mat3 p); +float4 characteristic_poly(mat4 p); + +float2 solve_monic(float2 p); +float3 solve_monic(float3 p); +float4 solve_monic(float4 p); + +float2 transform(mat2 p, float2 q); +float3 transform(mat3 p, float3 q); +float4 transform(mat4 p, float4 q); + +mat2 adjugate(mat2 p); +mat3 adjugate(mat3 p); +mat4 adjugate(mat4 p); + +mat2 invert(mat2 p); +mat3 invert(mat3 p); +mat4 invert(mat4 p); + +float2 eigenvalues(mat2 p); +float3 eigenvalues(mat3 p); +float4 eigenvalues(mat4 p); + +float2 eigenvector(mat2 p, float eigvl); +float3 eigenvector(mat3 p, float eigvl); +float4 eigenvector(mat4 p, float eigvl); + +mat2 operator *(mat2 a, mat2 b); +mat3 operator *(mat3 a, mat3 b); +mat4 operator *(mat4 a, mat4 b); + + + +// parametric line, 2D: The line is given by line = a + b*t. +struct line2 +{ + float2 a; + float2 b; +}; + +// parametric line, 3D +struct line3 +{ + float3 a; + float3 b; +}; + +struct line4 +{ + float4 a; + float4 b; +}; + +// plane/hyperplane defined by a point and a normal vector +struct plane_3d +{ + float3 root_point; + float3 normal; // normalized +}; + +struct hyperplane_4d +{ + float4 root_point; + float4 normal; // normalized +}; + +float param_nearest_on_line(float2 point, line2 line); +float param_nearest_on_line(float3 point, line3 line); +float param_nearest_on_line(float4 point, line4 line); + +float point_line_distance(float2 point, line2 line); +float point_line_distance(float3 point, line3 line); +float point_line_distance(float4 point, line4 line); + +float point_line_distance_sqr(float2 point, line2 line); +float point_line_distance_sqr(float3 point, line3 line); +float point_line_distance_sqr(float4 point, line4 line); + +float point_plane_3d_distance(float3 point, plane_3d plane); +float point_hyperplane_4d_distance(float4 point, hyperplane_4d plane); + +plane_3d generate_plane_from_points(float3 point0, float3 point1, float3 point2); +hyperplane_4d generate_hyperplane_from_points(float4 point0, float4 point1, float4 point2, float4 point3); + + +#endif diff --git a/3rdparty/bimg/3rdparty/astc/readme.txt b/3rdparty/bimg/3rdparty/astc/readme.txt new file mode 100644 index 00000000000..17ad54eb81c --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/readme.txt @@ -0,0 +1 @@ +Library version of astc-encoder, from https://github.com/andrewwillmott/astc-encoder. diff --git a/3rdparty/bimg/3rdparty/astc/softfloat.cpp b/3rdparty/bimg/3rdparty/astc/softfloat.cpp new file mode 100644 index 00000000000..11131bcac37 --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/softfloat.cpp @@ -0,0 +1,398 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Soft IEEE-754 floating point library. + */ +/*----------------------------------------------------------------------------*/ + +#include "softfloat.h" + +#define SOFTFLOAT_INLINE + +/****************************************** + helper functions and their lookup tables + ******************************************/ +/* count leading zeros functions. Only used when the input is nonzero. */ + +#if defined(__GNUC__) && (defined(__i386) || defined(__amd64)) +#elif defined(__arm__) && defined(__ARMCC_VERSION) +#elif defined(__arm__) && defined(__GNUC__) +#else + /* table used for the slow default versions. */ + static const uint8_t clz_table[256] = + { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; +#endif + + +/* + 32-bit count-leading-zeros function: use the Assembly instruction whenever possible. */ +SOFTFLOAT_INLINE uint32_t clz32(uint32_t inp) +{ + #if defined(__GNUC__) && (defined(__i386) || defined(__amd64)) + uint32_t bsr; + __asm__("bsrl %1, %0": "=r"(bsr):"r"(inp | 1)); + return 31 - bsr; + #else + #if defined(__arm__) && defined(__ARMCC_VERSION) + return __clz(inp); /* armcc builtin */ + #else + #if defined(__arm__) && defined(__GNUC__) + uint32_t lz; + __asm__("clz %0, %1": "=r"(lz):"r"(inp)); + return lz; + #else + /* slow default version */ + uint32_t summa = 24; + if (inp >= UINT32_C(0x10000)) + { + inp >>= 16; + summa -= 16; + } + if (inp >= UINT32_C(0x100)) + { + inp >>= 8; + summa -= 8; + } + return summa + clz_table[inp]; + #endif + #endif + #endif +} + +static SOFTFLOAT_INLINE uint32_t rtne_shift32(uint32_t inp, uint32_t shamt) +{ + uint32_t vl1 = UINT32_C(1) << shamt; + uint32_t inp2 = inp + (vl1 >> 1); /* added 0.5 ULP */ + uint32_t msk = (inp | UINT32_C(1)) & vl1; /* nonzero if odd. '| 1' forces it to 1 if the shamt is 0. */ + msk--; /* negative if even, nonnegative if odd. */ + inp2 -= (msk >> 31); /* subtract epsilon before shift if even. */ + inp2 >>= shamt; + return inp2; +} + +static SOFTFLOAT_INLINE uint32_t rtna_shift32(uint32_t inp, uint32_t shamt) +{ + uint32_t vl1 = (UINT32_C(1) << shamt) >> 1; + inp += vl1; + inp >>= shamt; + return inp; +} + + +static SOFTFLOAT_INLINE uint32_t rtup_shift32(uint32_t inp, uint32_t shamt) +{ + uint32_t vl1 = UINT32_C(1) << shamt; + inp += vl1; + inp--; + inp >>= shamt; + return inp; +} + + + + +/* convert from FP16 to FP32. */ +sf32 sf16_to_sf32(sf16 inp) +{ + uint32_t inpx = inp; + + /* + This table contains, for every FP16 sign/exponent value combination, + the difference between the input FP16 value and the value obtained + by shifting the correct FP32 result right by 13 bits. + This table allows us to handle every case except denormals and NaN + with just 1 table lookup, 2 shifts and 1 add. + */ + + #define WITH_MB(a) INT32_C((a) | (1 << 31)) + static const int32_t tbl[64] = + { + WITH_MB(0x00000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), + INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), + INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), + INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), INT32_C(0x1C000), WITH_MB(0x38000), + WITH_MB(0x38000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), + INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), + INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), + INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), INT32_C(0x54000), WITH_MB(0x70000) + }; + + int32_t res = tbl[inpx >> 10]; + res += inpx; + + /* the normal cases: the MSB of 'res' is not set. */ + if (res >= 0) /* signed compare */ + return res << 13; + + /* Infinity and Zero: the bottom 10 bits of 'res' are clear. */ + if ((res & UINT32_C(0x3FF)) == 0) + return res << 13; + + /* NaN: the exponent field of 'inp' is not zero; NaNs must be quietened. */ + if ((inpx & 0x7C00) != 0) + return (res << 13) | UINT32_C(0x400000); + + /* the remaining cases are Denormals. */ + { + uint32_t sign = (inpx & UINT32_C(0x8000)) << 16; + uint32_t mskval = inpx & UINT32_C(0x7FFF); + uint32_t leadingzeroes = clz32(mskval); + mskval <<= leadingzeroes; + return (mskval >> 8) + ((0x85 - leadingzeroes) << 23) + sign; + } +} + +/* Conversion routine that converts from FP32 to FP16. It supports denormals and all rounding modes. If a NaN is given as input, it is quietened. */ + +sf16 sf32_to_sf16(sf32 inp, roundmode rmode) +{ + /* for each possible sign/exponent combination, store a case index. This gives a 512-byte table */ + static const uint8_t tab[512] = { + 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 50, + + 5, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 55, + }; + + /* many of the cases below use a case-dependent magic constant. So we look up a magic constant before actually performing the switch. This table allows us to group cases, thereby minimizing code + size. */ + static const uint32_t tabx[60] = { + UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0x8000), UINT32_C(0x80000000), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), + UINT32_C(1), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0x8000), UINT32_C(0x8001), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), + UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), UINT32_C(0x8000), + UINT32_C(0xC8001FFF), UINT32_C(0xC8000000), UINT32_C(0xC8000000), UINT32_C(0xC8000FFF), UINT32_C(0xC8001000), + UINT32_C(0x58000000), UINT32_C(0x38001FFF), UINT32_C(0x58000000), UINT32_C(0x58000FFF), UINT32_C(0x58001000), + UINT32_C(0x7C00), UINT32_C(0x7BFF), UINT32_C(0x7BFF), UINT32_C(0x7C00), UINT32_C(0x7C00), + UINT32_C(0xFBFF), UINT32_C(0xFC00), UINT32_C(0xFBFF), UINT32_C(0xFC00), UINT32_C(0xFC00), + UINT32_C(0x90000000), UINT32_C(0x90000000), UINT32_C(0x90000000), UINT32_C(0x90000000), UINT32_C(0x90000000), + UINT32_C(0x20000000), UINT32_C(0x20000000), UINT32_C(0x20000000), UINT32_C(0x20000000), UINT32_C(0x20000000) + }; + + uint32_t p; + uint32_t idx = rmode + tab[inp >> 23]; + uint32_t vlx = tabx[idx]; + switch (idx) + { + /* + Positive number which may be Infinity or NaN. + We need to check whether it is NaN; if it is, quieten it by setting the top bit of the mantissa. + (If we don't do this quieting, then a NaN that is distinguished only by having + its low-order bits set, would be turned into an INF. */ + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + /* + the input value is 0x7F800000 or 0xFF800000 if it is INF. + By subtracting 1, we get 7F7FFFFF or FF7FFFFF, that is, bit 23 becomes zero. + For NaNs, however, this operation will keep bit 23 with the value 1. + We can then extract bit 23, and logical-OR bit 9 of the result with this + bit in order to quieten the NaN (a Quiet NaN is a NaN where the top bit + of the mantissa is set.) + */ + p = (inp - 1) & UINT32_C(0x800000); /* zero if INF, nonzero if NaN. */ + return ((inp + vlx) >> 13) | (p >> 14); + /* + positive, exponent = 0, round-mode == UP; need to check whether number actually is 0. + If it is, then return 0, else return 1 (the smallest representable nonzero number) + */ + case 0: + /* + -inp will set the MSB if the input number is nonzero. + Thus (-inp) >> 31 will turn into 0 if the input number is 0 and 1 otherwise. + */ + return (uint32_t) (-(int32_t) inp) >> 31; + + /* + negative, exponent = , round-mode == DOWN, need to check whether number is + actually 0. If it is, return 0x8000 ( float -0.0 ) + Else return the smallest negative number ( 0x8001 ) */ + case 6: + /* + in this case 'vlx' is 0x80000000. By subtracting the input value from it, + we obtain a value that is 0 if the input value is in fact zero and has + the MSB set if it isn't. We then right-shift the value by 31 places to + get a value that is 0 if the input is -0.0 and 1 otherwise. + */ + return ((vlx - inp) >> 31) + UINT32_C(0x8000); + + /* + for all other cases involving underflow/overflow, we don't need to + do actual tests; we just return 'vlx'. + */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + return vlx; + + /* + for normal numbers, 'vlx' is the difference between the FP32 value of a number and the + FP16 representation of the same number left-shifted by 13 places. In addition, a rounding constant is + baked into 'vlx': for rounding-away-from zero, the constant is 2^13 - 1, causing roundoff away + from zero. for round-to-nearest away, the constant is 2^12, causing roundoff away from zero. + for round-to-nearest-even, the constant is 2^12 - 1. This causes correct round-to-nearest-even + except for odd input numbers. For odd input numbers, we need to add 1 to the constant. */ + + /* normal number, all rounding modes except round-to-nearest-even: */ + case 30: + case 31: + case 32: + case 34: + case 35: + case 36: + case 37: + case 39: + return (inp + vlx) >> 13; + + /* normal number, round-to-nearest-even. */ + case 33: + case 38: + p = inp + vlx; + p += (inp >> 13) & 1; + return p >> 13; + + /* + the various denormal cases. These are not expected to be common, so their performance is a bit + less important. For each of these cases, we need to extract an exponent and a mantissa + (including the implicit '1'!), and then right-shift the mantissa by a shift-amount that + depends on the exponent. The shift must apply the correct rounding mode. 'vlx' is used to supply the + sign of the resulting denormal number. + */ + case 21: + case 22: + case 25: + case 27: + /* denormal, round towards zero. */ + p = 126 - ((inp >> 23) & 0xFF); + return (((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000)) >> p) | vlx; + case 20: + case 26: + /* denormal, round away from zero. */ + p = 126 - ((inp >> 23) & 0xFF); + return rtup_shift32((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000), p) | vlx; + case 24: + case 29: + /* denormal, round to nearest-away */ + p = 126 - ((inp >> 23) & 0xFF); + return rtna_shift32((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000), p) | vlx; + case 23: + case 28: + /* denormal, round to nearest-even. */ + p = 126 - ((inp >> 23) & 0xFF); + return rtne_shift32((inp & UINT32_C(0x7FFFFF)) + UINT32_C(0x800000), p) | vlx; + } + + return 0; +} + + + +typedef union if32_ +{ + uint32_t u; + int32_t s; + float f; +} if32; + +/* convert from soft-float to native-float */ + +float sf16_to_float(sf16 p) +{ + if32 i; + i.u = sf16_to_sf32(p); + return i.f; +} + +/* convert from native-float to soft-float */ + +sf16 float_to_sf16(float p, roundmode rm) +{ + if32 i; + i.f = p; + return sf32_to_sf16(i.u, rm); +} diff --git a/3rdparty/bimg/3rdparty/astc/softfloat.h b/3rdparty/bimg/3rdparty/astc/softfloat.h new file mode 100644 index 00000000000..1cf9ba767fb --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/softfloat.h @@ -0,0 +1,95 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Soft IEEE-754 floating point library. + */ +/*----------------------------------------------------------------------------*/ + +#ifndef SOFTFLOAT_H_INCLUDED + +#define SOFTFLOAT_H_INCLUDED + +#if defined __cplusplus +extern "C" +{ +#endif + +#if defined __cplusplus && !defined(_MSC_VER) + + /* if compiling as C++, we need to define these macros in order to obtain all the macros in stdint.h . */ + #define __STDC_LIMIT_MACROS + #define __STDC_CONSTANT_MACROS + #include + +#else + + typedef unsigned char uint8_t; + typedef signed char int8_t; + typedef unsigned short uint16_t; + typedef signed short int16_t; + typedef unsigned int uint32_t; + typedef signed int int32_t; + +#endif + + +uint32_t clz32(uint32_t p); + + +/* targets that don't have UINT32_C probably don't have the rest of C99s stdint.h */ +#ifndef UINT32_C + + #define PASTE(a) a + #define UINT64_C(a) PASTE(a##ULL) + #define UINT32_C(a) PASTE(a##U) + #define INT64_C(a) PASTE(a##LL) + #define INT32_C(a) a + + #define PRIX32 "X" + #define PRId32 "d" + #define PRIu32 "u" + #define PRIX64 "LX" + #define PRId64 "Ld" + #define PRIu64 "Lu" + +#endif + + /* sized soft-float types. These are mapped to the sized integer types of C99, instead of C's + floating-point types; this is because the library needs to maintain exact, bit-level control on all + operations on these data types. */ + typedef uint16_t sf16; + typedef uint32_t sf32; + + /* the five rounding modes that IEEE-754r defines */ + typedef enum + { + SF_UP = 0, /* round towards positive infinity */ + SF_DOWN = 1, /* round towards negative infinity */ + SF_TOZERO = 2, /* round towards zero */ + SF_NEARESTEVEN = 3, /* round toward nearest value; if mid-between, round to even value */ + SF_NEARESTAWAY = 4 /* round toward nearest value; if mid-between, round away from zero */ + } roundmode; + + /* narrowing float->float conversions */ + sf16 sf32_to_sf16(sf32, roundmode); + + /* widening float->float conversions */ + sf32 sf16_to_sf32(sf16); + + sf16 float_to_sf16(float, roundmode); + float sf16_to_float(sf16); + + +#if defined __cplusplus +} +#endif + +#endif diff --git a/3rdparty/bimg/3rdparty/astc/vectypes.h b/3rdparty/bimg/3rdparty/astc/vectypes.h new file mode 100644 index 00000000000..aa206d72adc --- /dev/null +++ b/3rdparty/bimg/3rdparty/astc/vectypes.h @@ -0,0 +1,16209 @@ +/*----------------------------------------------------------------------------*/ +/** + * This confidential and proprietary software may be used only as + * authorised by a licensing agreement from ARM Limited + * (C) COPYRIGHT 2011-2012 ARM Limited + * ALL RIGHTS RESERVED + * + * The entire notice above must be reproduced on all authorised + * copies and copies may only be made to the extent permitted + * by a licensing agreement from ARM Limited. + * + * @brief Template library for fixed-size vectors. + */ +/*----------------------------------------------------------------------------*/ + +#include +#include + +typedef unsigned int uint; +typedef unsigned short ushort; +typedef unsigned long ulong; +typedef unsigned char uchar; +typedef signed char schar; + +template < typename vtype > class vtype2; + +template < typename vtype > class vtype3; + +template < typename vtype > class vtype4; + +template < typename vtype > struct vtype2_xx_ref +{ + vtype2 < vtype > *v; + vtype2_xx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xy_ref +{ + vtype2 < vtype > *v; + vtype2_xy_ref(vtype2 < vtype > *p):v(p) + { + }; + inline vtype2_xy_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype2_yx_ref +{ + vtype2 < vtype > *v; + vtype2_yx_ref(vtype2 < vtype > *p):v(p) + { + }; + inline vtype2_yx_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype2_yy_ref +{ + vtype2 < vtype > *v; + vtype2_yy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xx_ref +{ + vtype3 < vtype > *v; + vtype3_xx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xy_ref +{ + vtype3 < vtype > *v; + vtype3_xy_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_xy_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype3_xz_ref +{ + vtype3 < vtype > *v; + vtype3_xz_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_xz_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype3_yx_ref +{ + vtype3 < vtype > *v; + vtype3_yx_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_yx_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype3_yy_ref +{ + vtype3 < vtype > *v; + vtype3_yy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yz_ref +{ + vtype3 < vtype > *v; + vtype3_yz_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_yz_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype3_zx_ref +{ + vtype3 < vtype > *v; + vtype3_zx_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_zx_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype3_zy_ref +{ + vtype3 < vtype > *v; + vtype3_zy_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_zy_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype3_zz_ref +{ + vtype3 < vtype > *v; + vtype3_zz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xx_ref +{ + vtype4 < vtype > *v; + vtype4_xx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xy_ref +{ + vtype4 < vtype > *v; + vtype4_xy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xy_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_xz_ref +{ + vtype4 < vtype > *v; + vtype4_xz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xz_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_xw_ref +{ + vtype4 < vtype > *v; + vtype4_xw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xw_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_yx_ref +{ + vtype4 < vtype > *v; + vtype4_yx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yx_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_yy_ref +{ + vtype4 < vtype > *v; + vtype4_yy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yz_ref +{ + vtype4 < vtype > *v; + vtype4_yz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yz_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_yw_ref +{ + vtype4 < vtype > *v; + vtype4_yw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yw_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_zx_ref +{ + vtype4 < vtype > *v; + vtype4_zx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zx_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_zy_ref +{ + vtype4 < vtype > *v; + vtype4_zy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zy_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_zz_ref +{ + vtype4 < vtype > *v; + vtype4_zz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zw_ref +{ + vtype4 < vtype > *v; + vtype4_zw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zw_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_wx_ref +{ + vtype4 < vtype > *v; + vtype4_wx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wx_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_wy_ref +{ + vtype4 < vtype > *v; + vtype4_wy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wy_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_wz_ref +{ + vtype4 < vtype > *v; + vtype4_wz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wz_ref & operator=(const vtype2 < vtype > &); +}; +template < typename vtype > struct vtype4_ww_ref +{ + vtype4 < vtype > *v; + vtype4_ww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xxx_ref +{ + vtype2 < vtype > *v; + vtype2_xxx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xxy_ref +{ + vtype2 < vtype > *v; + vtype2_xxy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xyx_ref +{ + vtype2 < vtype > *v; + vtype2_xyx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xyy_ref +{ + vtype2 < vtype > *v; + vtype2_xyy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yxx_ref +{ + vtype2 < vtype > *v; + vtype2_yxx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yxy_ref +{ + vtype2 < vtype > *v; + vtype2_yxy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yyx_ref +{ + vtype2 < vtype > *v; + vtype2_yyx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yyy_ref +{ + vtype2 < vtype > *v; + vtype2_yyy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxx_ref +{ + vtype3 < vtype > *v; + vtype3_xxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxy_ref +{ + vtype3 < vtype > *v; + vtype3_xxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxz_ref +{ + vtype3 < vtype > *v; + vtype3_xxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyx_ref +{ + vtype3 < vtype > *v; + vtype3_xyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyy_ref +{ + vtype3 < vtype > *v; + vtype3_xyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyz_ref +{ + vtype3 < vtype > *v; + vtype3_xyz_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_xyz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype3_xzx_ref +{ + vtype3 < vtype > *v; + vtype3_xzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzy_ref +{ + vtype3 < vtype > *v; + vtype3_xzy_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_xzy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype3_xzz_ref +{ + vtype3 < vtype > *v; + vtype3_xzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxx_ref +{ + vtype3 < vtype > *v; + vtype3_yxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxy_ref +{ + vtype3 < vtype > *v; + vtype3_yxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxz_ref +{ + vtype3 < vtype > *v; + vtype3_yxz_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_yxz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype3_yyx_ref +{ + vtype3 < vtype > *v; + vtype3_yyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyy_ref +{ + vtype3 < vtype > *v; + vtype3_yyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyz_ref +{ + vtype3 < vtype > *v; + vtype3_yyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzx_ref +{ + vtype3 < vtype > *v; + vtype3_yzx_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_yzx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype3_yzy_ref +{ + vtype3 < vtype > *v; + vtype3_yzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzz_ref +{ + vtype3 < vtype > *v; + vtype3_yzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxx_ref +{ + vtype3 < vtype > *v; + vtype3_zxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxy_ref +{ + vtype3 < vtype > *v; + vtype3_zxy_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_zxy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype3_zxz_ref +{ + vtype3 < vtype > *v; + vtype3_zxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyx_ref +{ + vtype3 < vtype > *v; + vtype3_zyx_ref(vtype3 < vtype > *p):v(p) + { + }; + inline vtype3_zyx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype3_zyy_ref +{ + vtype3 < vtype > *v; + vtype3_zyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyz_ref +{ + vtype3 < vtype > *v; + vtype3_zyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzx_ref +{ + vtype3 < vtype > *v; + vtype3_zzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzy_ref +{ + vtype3 < vtype > *v; + vtype3_zzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzz_ref +{ + vtype3 < vtype > *v; + vtype3_zzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxx_ref +{ + vtype4 < vtype > *v; + vtype4_xxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxy_ref +{ + vtype4 < vtype > *v; + vtype4_xxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxz_ref +{ + vtype4 < vtype > *v; + vtype4_xxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxw_ref +{ + vtype4 < vtype > *v; + vtype4_xxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyx_ref +{ + vtype4 < vtype > *v; + vtype4_xyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyy_ref +{ + vtype4 < vtype > *v; + vtype4_xyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyz_ref +{ + vtype4 < vtype > *v; + vtype4_xyz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xyz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_xyw_ref +{ + vtype4 < vtype > *v; + vtype4_xyw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xyw_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_xzx_ref +{ + vtype4 < vtype > *v; + vtype4_xzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzy_ref +{ + vtype4 < vtype > *v; + vtype4_xzy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xzy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_xzz_ref +{ + vtype4 < vtype > *v; + vtype4_xzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzw_ref +{ + vtype4 < vtype > *v; + vtype4_xzw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xzw_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_xwx_ref +{ + vtype4 < vtype > *v; + vtype4_xwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwy_ref +{ + vtype4 < vtype > *v; + vtype4_xwy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xwy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_xwz_ref +{ + vtype4 < vtype > *v; + vtype4_xwz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xwz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_xww_ref +{ + vtype4 < vtype > *v; + vtype4_xww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxx_ref +{ + vtype4 < vtype > *v; + vtype4_yxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxy_ref +{ + vtype4 < vtype > *v; + vtype4_yxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxz_ref +{ + vtype4 < vtype > *v; + vtype4_yxz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yxz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_yxw_ref +{ + vtype4 < vtype > *v; + vtype4_yxw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yxw_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_yyx_ref +{ + vtype4 < vtype > *v; + vtype4_yyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyy_ref +{ + vtype4 < vtype > *v; + vtype4_yyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyz_ref +{ + vtype4 < vtype > *v; + vtype4_yyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyw_ref +{ + vtype4 < vtype > *v; + vtype4_yyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzx_ref +{ + vtype4 < vtype > *v; + vtype4_yzx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yzx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_yzy_ref +{ + vtype4 < vtype > *v; + vtype4_yzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzz_ref +{ + vtype4 < vtype > *v; + vtype4_yzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzw_ref +{ + vtype4 < vtype > *v; + vtype4_yzw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yzw_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_ywx_ref +{ + vtype4 < vtype > *v; + vtype4_ywx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_ywx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_ywy_ref +{ + vtype4 < vtype > *v; + vtype4_ywy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywz_ref +{ + vtype4 < vtype > *v; + vtype4_ywz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_ywz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_yww_ref +{ + vtype4 < vtype > *v; + vtype4_yww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxx_ref +{ + vtype4 < vtype > *v; + vtype4_zxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxy_ref +{ + vtype4 < vtype > *v; + vtype4_zxy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zxy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_zxz_ref +{ + vtype4 < vtype > *v; + vtype4_zxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxw_ref +{ + vtype4 < vtype > *v; + vtype4_zxw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zxw_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_zyx_ref +{ + vtype4 < vtype > *v; + vtype4_zyx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zyx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_zyy_ref +{ + vtype4 < vtype > *v; + vtype4_zyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyz_ref +{ + vtype4 < vtype > *v; + vtype4_zyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyw_ref +{ + vtype4 < vtype > *v; + vtype4_zyw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zyw_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_zzx_ref +{ + vtype4 < vtype > *v; + vtype4_zzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzy_ref +{ + vtype4 < vtype > *v; + vtype4_zzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzz_ref +{ + vtype4 < vtype > *v; + vtype4_zzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzw_ref +{ + vtype4 < vtype > *v; + vtype4_zzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwx_ref +{ + vtype4 < vtype > *v; + vtype4_zwx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zwx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_zwy_ref +{ + vtype4 < vtype > *v; + vtype4_zwy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zwy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_zwz_ref +{ + vtype4 < vtype > *v; + vtype4_zwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zww_ref +{ + vtype4 < vtype > *v; + vtype4_zww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxx_ref +{ + vtype4 < vtype > *v; + vtype4_wxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxy_ref +{ + vtype4 < vtype > *v; + vtype4_wxy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wxy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_wxz_ref +{ + vtype4 < vtype > *v; + vtype4_wxz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wxz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_wxw_ref +{ + vtype4 < vtype > *v; + vtype4_wxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyx_ref +{ + vtype4 < vtype > *v; + vtype4_wyx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wyx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_wyy_ref +{ + vtype4 < vtype > *v; + vtype4_wyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyz_ref +{ + vtype4 < vtype > *v; + vtype4_wyz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wyz_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_wyw_ref +{ + vtype4 < vtype > *v; + vtype4_wyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzx_ref +{ + vtype4 < vtype > *v; + vtype4_wzx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wzx_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_wzy_ref +{ + vtype4 < vtype > *v; + vtype4_wzy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wzy_ref & operator=(const vtype3 < vtype > &); +}; +template < typename vtype > struct vtype4_wzz_ref +{ + vtype4 < vtype > *v; + vtype4_wzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzw_ref +{ + vtype4 < vtype > *v; + vtype4_wzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwx_ref +{ + vtype4 < vtype > *v; + vtype4_wwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwy_ref +{ + vtype4 < vtype > *v; + vtype4_wwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwz_ref +{ + vtype4 < vtype > *v; + vtype4_wwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_www_ref +{ + vtype4 < vtype > *v; + vtype4_www_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xxxx_ref +{ + vtype2 < vtype > *v; + vtype2_xxxx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xxxy_ref +{ + vtype2 < vtype > *v; + vtype2_xxxy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xxyx_ref +{ + vtype2 < vtype > *v; + vtype2_xxyx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xxyy_ref +{ + vtype2 < vtype > *v; + vtype2_xxyy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xyxx_ref +{ + vtype2 < vtype > *v; + vtype2_xyxx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xyxy_ref +{ + vtype2 < vtype > *v; + vtype2_xyxy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xyyx_ref +{ + vtype2 < vtype > *v; + vtype2_xyyx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_xyyy_ref +{ + vtype2 < vtype > *v; + vtype2_xyyy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yxxx_ref +{ + vtype2 < vtype > *v; + vtype2_yxxx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yxxy_ref +{ + vtype2 < vtype > *v; + vtype2_yxxy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yxyx_ref +{ + vtype2 < vtype > *v; + vtype2_yxyx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yxyy_ref +{ + vtype2 < vtype > *v; + vtype2_yxyy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yyxx_ref +{ + vtype2 < vtype > *v; + vtype2_yyxx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yyxy_ref +{ + vtype2 < vtype > *v; + vtype2_yyxy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yyyx_ref +{ + vtype2 < vtype > *v; + vtype2_yyyx_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype2_yyyy_ref +{ + vtype2 < vtype > *v; + vtype2_yyyy_ref(vtype2 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxxx_ref +{ + vtype3 < vtype > *v; + vtype3_xxxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxxy_ref +{ + vtype3 < vtype > *v; + vtype3_xxxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxxz_ref +{ + vtype3 < vtype > *v; + vtype3_xxxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxyx_ref +{ + vtype3 < vtype > *v; + vtype3_xxyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxyy_ref +{ + vtype3 < vtype > *v; + vtype3_xxyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxyz_ref +{ + vtype3 < vtype > *v; + vtype3_xxyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxzx_ref +{ + vtype3 < vtype > *v; + vtype3_xxzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxzy_ref +{ + vtype3 < vtype > *v; + vtype3_xxzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xxzz_ref +{ + vtype3 < vtype > *v; + vtype3_xxzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyxx_ref +{ + vtype3 < vtype > *v; + vtype3_xyxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyxy_ref +{ + vtype3 < vtype > *v; + vtype3_xyxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyxz_ref +{ + vtype3 < vtype > *v; + vtype3_xyxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyyx_ref +{ + vtype3 < vtype > *v; + vtype3_xyyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyyy_ref +{ + vtype3 < vtype > *v; + vtype3_xyyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyyz_ref +{ + vtype3 < vtype > *v; + vtype3_xyyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyzx_ref +{ + vtype3 < vtype > *v; + vtype3_xyzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyzy_ref +{ + vtype3 < vtype > *v; + vtype3_xyzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xyzz_ref +{ + vtype3 < vtype > *v; + vtype3_xyzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzxx_ref +{ + vtype3 < vtype > *v; + vtype3_xzxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzxy_ref +{ + vtype3 < vtype > *v; + vtype3_xzxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzxz_ref +{ + vtype3 < vtype > *v; + vtype3_xzxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzyx_ref +{ + vtype3 < vtype > *v; + vtype3_xzyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzyy_ref +{ + vtype3 < vtype > *v; + vtype3_xzyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzyz_ref +{ + vtype3 < vtype > *v; + vtype3_xzyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzzx_ref +{ + vtype3 < vtype > *v; + vtype3_xzzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzzy_ref +{ + vtype3 < vtype > *v; + vtype3_xzzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_xzzz_ref +{ + vtype3 < vtype > *v; + vtype3_xzzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxxx_ref +{ + vtype3 < vtype > *v; + vtype3_yxxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxxy_ref +{ + vtype3 < vtype > *v; + vtype3_yxxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxxz_ref +{ + vtype3 < vtype > *v; + vtype3_yxxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxyx_ref +{ + vtype3 < vtype > *v; + vtype3_yxyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxyy_ref +{ + vtype3 < vtype > *v; + vtype3_yxyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxyz_ref +{ + vtype3 < vtype > *v; + vtype3_yxyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxzx_ref +{ + vtype3 < vtype > *v; + vtype3_yxzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxzy_ref +{ + vtype3 < vtype > *v; + vtype3_yxzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yxzz_ref +{ + vtype3 < vtype > *v; + vtype3_yxzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyxx_ref +{ + vtype3 < vtype > *v; + vtype3_yyxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyxy_ref +{ + vtype3 < vtype > *v; + vtype3_yyxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyxz_ref +{ + vtype3 < vtype > *v; + vtype3_yyxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyyx_ref +{ + vtype3 < vtype > *v; + vtype3_yyyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyyy_ref +{ + vtype3 < vtype > *v; + vtype3_yyyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyyz_ref +{ + vtype3 < vtype > *v; + vtype3_yyyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyzx_ref +{ + vtype3 < vtype > *v; + vtype3_yyzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyzy_ref +{ + vtype3 < vtype > *v; + vtype3_yyzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yyzz_ref +{ + vtype3 < vtype > *v; + vtype3_yyzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzxx_ref +{ + vtype3 < vtype > *v; + vtype3_yzxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzxy_ref +{ + vtype3 < vtype > *v; + vtype3_yzxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzxz_ref +{ + vtype3 < vtype > *v; + vtype3_yzxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzyx_ref +{ + vtype3 < vtype > *v; + vtype3_yzyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzyy_ref +{ + vtype3 < vtype > *v; + vtype3_yzyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzyz_ref +{ + vtype3 < vtype > *v; + vtype3_yzyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzzx_ref +{ + vtype3 < vtype > *v; + vtype3_yzzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzzy_ref +{ + vtype3 < vtype > *v; + vtype3_yzzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_yzzz_ref +{ + vtype3 < vtype > *v; + vtype3_yzzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxxx_ref +{ + vtype3 < vtype > *v; + vtype3_zxxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxxy_ref +{ + vtype3 < vtype > *v; + vtype3_zxxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxxz_ref +{ + vtype3 < vtype > *v; + vtype3_zxxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxyx_ref +{ + vtype3 < vtype > *v; + vtype3_zxyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxyy_ref +{ + vtype3 < vtype > *v; + vtype3_zxyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxyz_ref +{ + vtype3 < vtype > *v; + vtype3_zxyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxzx_ref +{ + vtype3 < vtype > *v; + vtype3_zxzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxzy_ref +{ + vtype3 < vtype > *v; + vtype3_zxzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zxzz_ref +{ + vtype3 < vtype > *v; + vtype3_zxzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyxx_ref +{ + vtype3 < vtype > *v; + vtype3_zyxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyxy_ref +{ + vtype3 < vtype > *v; + vtype3_zyxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyxz_ref +{ + vtype3 < vtype > *v; + vtype3_zyxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyyx_ref +{ + vtype3 < vtype > *v; + vtype3_zyyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyyy_ref +{ + vtype3 < vtype > *v; + vtype3_zyyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyyz_ref +{ + vtype3 < vtype > *v; + vtype3_zyyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyzx_ref +{ + vtype3 < vtype > *v; + vtype3_zyzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyzy_ref +{ + vtype3 < vtype > *v; + vtype3_zyzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zyzz_ref +{ + vtype3 < vtype > *v; + vtype3_zyzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzxx_ref +{ + vtype3 < vtype > *v; + vtype3_zzxx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzxy_ref +{ + vtype3 < vtype > *v; + vtype3_zzxy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzxz_ref +{ + vtype3 < vtype > *v; + vtype3_zzxz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzyx_ref +{ + vtype3 < vtype > *v; + vtype3_zzyx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzyy_ref +{ + vtype3 < vtype > *v; + vtype3_zzyy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzyz_ref +{ + vtype3 < vtype > *v; + vtype3_zzyz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzzx_ref +{ + vtype3 < vtype > *v; + vtype3_zzzx_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzzy_ref +{ + vtype3 < vtype > *v; + vtype3_zzzy_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype3_zzzz_ref +{ + vtype3 < vtype > *v; + vtype3_zzzz_ref(vtype3 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxxx_ref +{ + vtype4 < vtype > *v; + vtype4_xxxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxxy_ref +{ + vtype4 < vtype > *v; + vtype4_xxxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxxz_ref +{ + vtype4 < vtype > *v; + vtype4_xxxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxxw_ref +{ + vtype4 < vtype > *v; + vtype4_xxxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxyx_ref +{ + vtype4 < vtype > *v; + vtype4_xxyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxyy_ref +{ + vtype4 < vtype > *v; + vtype4_xxyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxyz_ref +{ + vtype4 < vtype > *v; + vtype4_xxyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxyw_ref +{ + vtype4 < vtype > *v; + vtype4_xxyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxzx_ref +{ + vtype4 < vtype > *v; + vtype4_xxzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxzy_ref +{ + vtype4 < vtype > *v; + vtype4_xxzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxzz_ref +{ + vtype4 < vtype > *v; + vtype4_xxzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxzw_ref +{ + vtype4 < vtype > *v; + vtype4_xxzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxwx_ref +{ + vtype4 < vtype > *v; + vtype4_xxwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxwy_ref +{ + vtype4 < vtype > *v; + vtype4_xxwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxwz_ref +{ + vtype4 < vtype > *v; + vtype4_xxwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xxww_ref +{ + vtype4 < vtype > *v; + vtype4_xxww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyxx_ref +{ + vtype4 < vtype > *v; + vtype4_xyxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyxy_ref +{ + vtype4 < vtype > *v; + vtype4_xyxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyxz_ref +{ + vtype4 < vtype > *v; + vtype4_xyxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyxw_ref +{ + vtype4 < vtype > *v; + vtype4_xyxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyyx_ref +{ + vtype4 < vtype > *v; + vtype4_xyyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyyy_ref +{ + vtype4 < vtype > *v; + vtype4_xyyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyyz_ref +{ + vtype4 < vtype > *v; + vtype4_xyyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyyw_ref +{ + vtype4 < vtype > *v; + vtype4_xyyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyzx_ref +{ + vtype4 < vtype > *v; + vtype4_xyzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyzy_ref +{ + vtype4 < vtype > *v; + vtype4_xyzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyzz_ref +{ + vtype4 < vtype > *v; + vtype4_xyzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xyzw_ref +{ + vtype4 < vtype > *v; + vtype4_xyzw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xyzw_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_xywx_ref +{ + vtype4 < vtype > *v; + vtype4_xywx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xywy_ref +{ + vtype4 < vtype > *v; + vtype4_xywy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xywz_ref +{ + vtype4 < vtype > *v; + vtype4_xywz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xywz_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_xyww_ref +{ + vtype4 < vtype > *v; + vtype4_xyww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzxx_ref +{ + vtype4 < vtype > *v; + vtype4_xzxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzxy_ref +{ + vtype4 < vtype > *v; + vtype4_xzxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzxz_ref +{ + vtype4 < vtype > *v; + vtype4_xzxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzxw_ref +{ + vtype4 < vtype > *v; + vtype4_xzxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzyx_ref +{ + vtype4 < vtype > *v; + vtype4_xzyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzyy_ref +{ + vtype4 < vtype > *v; + vtype4_xzyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzyz_ref +{ + vtype4 < vtype > *v; + vtype4_xzyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzyw_ref +{ + vtype4 < vtype > *v; + vtype4_xzyw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xzyw_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_xzzx_ref +{ + vtype4 < vtype > *v; + vtype4_xzzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzzy_ref +{ + vtype4 < vtype > *v; + vtype4_xzzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzzz_ref +{ + vtype4 < vtype > *v; + vtype4_xzzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzzw_ref +{ + vtype4 < vtype > *v; + vtype4_xzzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzwx_ref +{ + vtype4 < vtype > *v; + vtype4_xzwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzwy_ref +{ + vtype4 < vtype > *v; + vtype4_xzwy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xzwy_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_xzwz_ref +{ + vtype4 < vtype > *v; + vtype4_xzwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xzww_ref +{ + vtype4 < vtype > *v; + vtype4_xzww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwxx_ref +{ + vtype4 < vtype > *v; + vtype4_xwxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwxy_ref +{ + vtype4 < vtype > *v; + vtype4_xwxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwxz_ref +{ + vtype4 < vtype > *v; + vtype4_xwxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwxw_ref +{ + vtype4 < vtype > *v; + vtype4_xwxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwyx_ref +{ + vtype4 < vtype > *v; + vtype4_xwyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwyy_ref +{ + vtype4 < vtype > *v; + vtype4_xwyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwyz_ref +{ + vtype4 < vtype > *v; + vtype4_xwyz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xwyz_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_xwyw_ref +{ + vtype4 < vtype > *v; + vtype4_xwyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwzx_ref +{ + vtype4 < vtype > *v; + vtype4_xwzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwzy_ref +{ + vtype4 < vtype > *v; + vtype4_xwzy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_xwzy_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_xwzz_ref +{ + vtype4 < vtype > *v; + vtype4_xwzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwzw_ref +{ + vtype4 < vtype > *v; + vtype4_xwzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwwx_ref +{ + vtype4 < vtype > *v; + vtype4_xwwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwwy_ref +{ + vtype4 < vtype > *v; + vtype4_xwwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwwz_ref +{ + vtype4 < vtype > *v; + vtype4_xwwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_xwww_ref +{ + vtype4 < vtype > *v; + vtype4_xwww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxxx_ref +{ + vtype4 < vtype > *v; + vtype4_yxxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxxy_ref +{ + vtype4 < vtype > *v; + vtype4_yxxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxxz_ref +{ + vtype4 < vtype > *v; + vtype4_yxxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxxw_ref +{ + vtype4 < vtype > *v; + vtype4_yxxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxyx_ref +{ + vtype4 < vtype > *v; + vtype4_yxyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxyy_ref +{ + vtype4 < vtype > *v; + vtype4_yxyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxyz_ref +{ + vtype4 < vtype > *v; + vtype4_yxyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxyw_ref +{ + vtype4 < vtype > *v; + vtype4_yxyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxzx_ref +{ + vtype4 < vtype > *v; + vtype4_yxzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxzy_ref +{ + vtype4 < vtype > *v; + vtype4_yxzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxzz_ref +{ + vtype4 < vtype > *v; + vtype4_yxzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxzw_ref +{ + vtype4 < vtype > *v; + vtype4_yxzw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yxzw_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_yxwx_ref +{ + vtype4 < vtype > *v; + vtype4_yxwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxwy_ref +{ + vtype4 < vtype > *v; + vtype4_yxwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yxwz_ref +{ + vtype4 < vtype > *v; + vtype4_yxwz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yxwz_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_yxww_ref +{ + vtype4 < vtype > *v; + vtype4_yxww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyxx_ref +{ + vtype4 < vtype > *v; + vtype4_yyxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyxy_ref +{ + vtype4 < vtype > *v; + vtype4_yyxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyxz_ref +{ + vtype4 < vtype > *v; + vtype4_yyxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyxw_ref +{ + vtype4 < vtype > *v; + vtype4_yyxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyyx_ref +{ + vtype4 < vtype > *v; + vtype4_yyyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyyy_ref +{ + vtype4 < vtype > *v; + vtype4_yyyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyyz_ref +{ + vtype4 < vtype > *v; + vtype4_yyyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyyw_ref +{ + vtype4 < vtype > *v; + vtype4_yyyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyzx_ref +{ + vtype4 < vtype > *v; + vtype4_yyzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyzy_ref +{ + vtype4 < vtype > *v; + vtype4_yyzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyzz_ref +{ + vtype4 < vtype > *v; + vtype4_yyzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyzw_ref +{ + vtype4 < vtype > *v; + vtype4_yyzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yywx_ref +{ + vtype4 < vtype > *v; + vtype4_yywx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yywy_ref +{ + vtype4 < vtype > *v; + vtype4_yywy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yywz_ref +{ + vtype4 < vtype > *v; + vtype4_yywz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yyww_ref +{ + vtype4 < vtype > *v; + vtype4_yyww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzxx_ref +{ + vtype4 < vtype > *v; + vtype4_yzxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzxy_ref +{ + vtype4 < vtype > *v; + vtype4_yzxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzxz_ref +{ + vtype4 < vtype > *v; + vtype4_yzxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzxw_ref +{ + vtype4 < vtype > *v; + vtype4_yzxw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yzxw_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_yzyx_ref +{ + vtype4 < vtype > *v; + vtype4_yzyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzyy_ref +{ + vtype4 < vtype > *v; + vtype4_yzyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzyz_ref +{ + vtype4 < vtype > *v; + vtype4_yzyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzyw_ref +{ + vtype4 < vtype > *v; + vtype4_yzyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzzx_ref +{ + vtype4 < vtype > *v; + vtype4_yzzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzzy_ref +{ + vtype4 < vtype > *v; + vtype4_yzzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzzz_ref +{ + vtype4 < vtype > *v; + vtype4_yzzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzzw_ref +{ + vtype4 < vtype > *v; + vtype4_yzzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzwx_ref +{ + vtype4 < vtype > *v; + vtype4_yzwx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_yzwx_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_yzwy_ref +{ + vtype4 < vtype > *v; + vtype4_yzwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzwz_ref +{ + vtype4 < vtype > *v; + vtype4_yzwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_yzww_ref +{ + vtype4 < vtype > *v; + vtype4_yzww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywxx_ref +{ + vtype4 < vtype > *v; + vtype4_ywxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywxy_ref +{ + vtype4 < vtype > *v; + vtype4_ywxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywxz_ref +{ + vtype4 < vtype > *v; + vtype4_ywxz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_ywxz_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_ywxw_ref +{ + vtype4 < vtype > *v; + vtype4_ywxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywyx_ref +{ + vtype4 < vtype > *v; + vtype4_ywyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywyy_ref +{ + vtype4 < vtype > *v; + vtype4_ywyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywyz_ref +{ + vtype4 < vtype > *v; + vtype4_ywyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywyw_ref +{ + vtype4 < vtype > *v; + vtype4_ywyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywzx_ref +{ + vtype4 < vtype > *v; + vtype4_ywzx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_ywzx_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_ywzy_ref +{ + vtype4 < vtype > *v; + vtype4_ywzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywzz_ref +{ + vtype4 < vtype > *v; + vtype4_ywzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywzw_ref +{ + vtype4 < vtype > *v; + vtype4_ywzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywwx_ref +{ + vtype4 < vtype > *v; + vtype4_ywwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywwy_ref +{ + vtype4 < vtype > *v; + vtype4_ywwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywwz_ref +{ + vtype4 < vtype > *v; + vtype4_ywwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_ywww_ref +{ + vtype4 < vtype > *v; + vtype4_ywww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxxx_ref +{ + vtype4 < vtype > *v; + vtype4_zxxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxxy_ref +{ + vtype4 < vtype > *v; + vtype4_zxxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxxz_ref +{ + vtype4 < vtype > *v; + vtype4_zxxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxxw_ref +{ + vtype4 < vtype > *v; + vtype4_zxxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxyx_ref +{ + vtype4 < vtype > *v; + vtype4_zxyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxyy_ref +{ + vtype4 < vtype > *v; + vtype4_zxyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxyz_ref +{ + vtype4 < vtype > *v; + vtype4_zxyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxyw_ref +{ + vtype4 < vtype > *v; + vtype4_zxyw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zxyw_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_zxzx_ref +{ + vtype4 < vtype > *v; + vtype4_zxzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxzy_ref +{ + vtype4 < vtype > *v; + vtype4_zxzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxzz_ref +{ + vtype4 < vtype > *v; + vtype4_zxzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxzw_ref +{ + vtype4 < vtype > *v; + vtype4_zxzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxwx_ref +{ + vtype4 < vtype > *v; + vtype4_zxwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxwy_ref +{ + vtype4 < vtype > *v; + vtype4_zxwy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zxwy_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_zxwz_ref +{ + vtype4 < vtype > *v; + vtype4_zxwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zxww_ref +{ + vtype4 < vtype > *v; + vtype4_zxww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyxx_ref +{ + vtype4 < vtype > *v; + vtype4_zyxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyxy_ref +{ + vtype4 < vtype > *v; + vtype4_zyxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyxz_ref +{ + vtype4 < vtype > *v; + vtype4_zyxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyxw_ref +{ + vtype4 < vtype > *v; + vtype4_zyxw_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zyxw_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_zyyx_ref +{ + vtype4 < vtype > *v; + vtype4_zyyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyyy_ref +{ + vtype4 < vtype > *v; + vtype4_zyyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyyz_ref +{ + vtype4 < vtype > *v; + vtype4_zyyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyyw_ref +{ + vtype4 < vtype > *v; + vtype4_zyyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyzx_ref +{ + vtype4 < vtype > *v; + vtype4_zyzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyzy_ref +{ + vtype4 < vtype > *v; + vtype4_zyzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyzz_ref +{ + vtype4 < vtype > *v; + vtype4_zyzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyzw_ref +{ + vtype4 < vtype > *v; + vtype4_zyzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zywx_ref +{ + vtype4 < vtype > *v; + vtype4_zywx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zywx_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_zywy_ref +{ + vtype4 < vtype > *v; + vtype4_zywy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zywz_ref +{ + vtype4 < vtype > *v; + vtype4_zywz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zyww_ref +{ + vtype4 < vtype > *v; + vtype4_zyww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzxx_ref +{ + vtype4 < vtype > *v; + vtype4_zzxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzxy_ref +{ + vtype4 < vtype > *v; + vtype4_zzxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzxz_ref +{ + vtype4 < vtype > *v; + vtype4_zzxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzxw_ref +{ + vtype4 < vtype > *v; + vtype4_zzxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzyx_ref +{ + vtype4 < vtype > *v; + vtype4_zzyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzyy_ref +{ + vtype4 < vtype > *v; + vtype4_zzyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzyz_ref +{ + vtype4 < vtype > *v; + vtype4_zzyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzyw_ref +{ + vtype4 < vtype > *v; + vtype4_zzyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzzx_ref +{ + vtype4 < vtype > *v; + vtype4_zzzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzzy_ref +{ + vtype4 < vtype > *v; + vtype4_zzzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzzz_ref +{ + vtype4 < vtype > *v; + vtype4_zzzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzzw_ref +{ + vtype4 < vtype > *v; + vtype4_zzzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzwx_ref +{ + vtype4 < vtype > *v; + vtype4_zzwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzwy_ref +{ + vtype4 < vtype > *v; + vtype4_zzwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzwz_ref +{ + vtype4 < vtype > *v; + vtype4_zzwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zzww_ref +{ + vtype4 < vtype > *v; + vtype4_zzww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwxx_ref +{ + vtype4 < vtype > *v; + vtype4_zwxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwxy_ref +{ + vtype4 < vtype > *v; + vtype4_zwxy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zwxy_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_zwxz_ref +{ + vtype4 < vtype > *v; + vtype4_zwxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwxw_ref +{ + vtype4 < vtype > *v; + vtype4_zwxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwyx_ref +{ + vtype4 < vtype > *v; + vtype4_zwyx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_zwyx_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_zwyy_ref +{ + vtype4 < vtype > *v; + vtype4_zwyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwyz_ref +{ + vtype4 < vtype > *v; + vtype4_zwyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwyw_ref +{ + vtype4 < vtype > *v; + vtype4_zwyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwzx_ref +{ + vtype4 < vtype > *v; + vtype4_zwzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwzy_ref +{ + vtype4 < vtype > *v; + vtype4_zwzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwzz_ref +{ + vtype4 < vtype > *v; + vtype4_zwzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwzw_ref +{ + vtype4 < vtype > *v; + vtype4_zwzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwwx_ref +{ + vtype4 < vtype > *v; + vtype4_zwwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwwy_ref +{ + vtype4 < vtype > *v; + vtype4_zwwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwwz_ref +{ + vtype4 < vtype > *v; + vtype4_zwwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_zwww_ref +{ + vtype4 < vtype > *v; + vtype4_zwww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxxx_ref +{ + vtype4 < vtype > *v; + vtype4_wxxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxxy_ref +{ + vtype4 < vtype > *v; + vtype4_wxxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxxz_ref +{ + vtype4 < vtype > *v; + vtype4_wxxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxxw_ref +{ + vtype4 < vtype > *v; + vtype4_wxxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxyx_ref +{ + vtype4 < vtype > *v; + vtype4_wxyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxyy_ref +{ + vtype4 < vtype > *v; + vtype4_wxyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxyz_ref +{ + vtype4 < vtype > *v; + vtype4_wxyz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wxyz_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_wxyw_ref +{ + vtype4 < vtype > *v; + vtype4_wxyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxzx_ref +{ + vtype4 < vtype > *v; + vtype4_wxzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxzy_ref +{ + vtype4 < vtype > *v; + vtype4_wxzy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wxzy_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_wxzz_ref +{ + vtype4 < vtype > *v; + vtype4_wxzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxzw_ref +{ + vtype4 < vtype > *v; + vtype4_wxzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxwx_ref +{ + vtype4 < vtype > *v; + vtype4_wxwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxwy_ref +{ + vtype4 < vtype > *v; + vtype4_wxwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxwz_ref +{ + vtype4 < vtype > *v; + vtype4_wxwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wxww_ref +{ + vtype4 < vtype > *v; + vtype4_wxww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyxx_ref +{ + vtype4 < vtype > *v; + vtype4_wyxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyxy_ref +{ + vtype4 < vtype > *v; + vtype4_wyxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyxz_ref +{ + vtype4 < vtype > *v; + vtype4_wyxz_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wyxz_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_wyxw_ref +{ + vtype4 < vtype > *v; + vtype4_wyxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyyx_ref +{ + vtype4 < vtype > *v; + vtype4_wyyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyyy_ref +{ + vtype4 < vtype > *v; + vtype4_wyyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyyz_ref +{ + vtype4 < vtype > *v; + vtype4_wyyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyyw_ref +{ + vtype4 < vtype > *v; + vtype4_wyyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyzx_ref +{ + vtype4 < vtype > *v; + vtype4_wyzx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wyzx_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_wyzy_ref +{ + vtype4 < vtype > *v; + vtype4_wyzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyzz_ref +{ + vtype4 < vtype > *v; + vtype4_wyzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyzw_ref +{ + vtype4 < vtype > *v; + vtype4_wyzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wywx_ref +{ + vtype4 < vtype > *v; + vtype4_wywx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wywy_ref +{ + vtype4 < vtype > *v; + vtype4_wywy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wywz_ref +{ + vtype4 < vtype > *v; + vtype4_wywz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wyww_ref +{ + vtype4 < vtype > *v; + vtype4_wyww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzxx_ref +{ + vtype4 < vtype > *v; + vtype4_wzxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzxy_ref +{ + vtype4 < vtype > *v; + vtype4_wzxy_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wzxy_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_wzxz_ref +{ + vtype4 < vtype > *v; + vtype4_wzxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzxw_ref +{ + vtype4 < vtype > *v; + vtype4_wzxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzyx_ref +{ + vtype4 < vtype > *v; + vtype4_wzyx_ref(vtype4 < vtype > *p):v(p) + { + }; + inline vtype4_wzyx_ref & operator=(const vtype4 < vtype > &); +}; +template < typename vtype > struct vtype4_wzyy_ref +{ + vtype4 < vtype > *v; + vtype4_wzyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzyz_ref +{ + vtype4 < vtype > *v; + vtype4_wzyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzyw_ref +{ + vtype4 < vtype > *v; + vtype4_wzyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzzx_ref +{ + vtype4 < vtype > *v; + vtype4_wzzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzzy_ref +{ + vtype4 < vtype > *v; + vtype4_wzzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzzz_ref +{ + vtype4 < vtype > *v; + vtype4_wzzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzzw_ref +{ + vtype4 < vtype > *v; + vtype4_wzzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzwx_ref +{ + vtype4 < vtype > *v; + vtype4_wzwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzwy_ref +{ + vtype4 < vtype > *v; + vtype4_wzwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzwz_ref +{ + vtype4 < vtype > *v; + vtype4_wzwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wzww_ref +{ + vtype4 < vtype > *v; + vtype4_wzww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwxx_ref +{ + vtype4 < vtype > *v; + vtype4_wwxx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwxy_ref +{ + vtype4 < vtype > *v; + vtype4_wwxy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwxz_ref +{ + vtype4 < vtype > *v; + vtype4_wwxz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwxw_ref +{ + vtype4 < vtype > *v; + vtype4_wwxw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwyx_ref +{ + vtype4 < vtype > *v; + vtype4_wwyx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwyy_ref +{ + vtype4 < vtype > *v; + vtype4_wwyy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwyz_ref +{ + vtype4 < vtype > *v; + vtype4_wwyz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwyw_ref +{ + vtype4 < vtype > *v; + vtype4_wwyw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwzx_ref +{ + vtype4 < vtype > *v; + vtype4_wwzx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwzy_ref +{ + vtype4 < vtype > *v; + vtype4_wwzy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwzz_ref +{ + vtype4 < vtype > *v; + vtype4_wwzz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwzw_ref +{ + vtype4 < vtype > *v; + vtype4_wwzw_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwwx_ref +{ + vtype4 < vtype > *v; + vtype4_wwwx_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwwy_ref +{ + vtype4 < vtype > *v; + vtype4_wwwy_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwwz_ref +{ + vtype4 < vtype > *v; + vtype4_wwwz_ref(vtype4 < vtype > *p):v(p) + { + }; +}; +template < typename vtype > struct vtype4_wwww_ref +{ + vtype4 < vtype > *v; + vtype4_wwww_ref(vtype4 < vtype > *p):v(p) + { + }; +}; + +template < typename vtype > class vtype2 +{ + public: + vtype x, y; + vtype2() + { + }; + vtype2(vtype p, vtype q):x(p), y(q) + { + }; + vtype2(const vtype2 & p):x(p.x), y(p.y) + { + }; + inline vtype2(const vtype2_xx_ref < vtype > &v); + inline vtype2(const vtype2_xy_ref < vtype > &v); + inline vtype2(const vtype2_yx_ref < vtype > &v); + inline vtype2(const vtype2_yy_ref < vtype > &v); + inline vtype2(const vtype3_xx_ref < vtype > &v); + inline vtype2(const vtype3_xy_ref < vtype > &v); + inline vtype2(const vtype3_xz_ref < vtype > &v); + inline vtype2(const vtype3_yx_ref < vtype > &v); + inline vtype2(const vtype3_yy_ref < vtype > &v); + inline vtype2(const vtype3_yz_ref < vtype > &v); + inline vtype2(const vtype3_zx_ref < vtype > &v); + inline vtype2(const vtype3_zy_ref < vtype > &v); + inline vtype2(const vtype3_zz_ref < vtype > &v); + inline vtype2(const vtype4_xx_ref < vtype > &v); + inline vtype2(const vtype4_xy_ref < vtype > &v); + inline vtype2(const vtype4_xz_ref < vtype > &v); + inline vtype2(const vtype4_xw_ref < vtype > &v); + inline vtype2(const vtype4_yx_ref < vtype > &v); + inline vtype2(const vtype4_yy_ref < vtype > &v); + inline vtype2(const vtype4_yz_ref < vtype > &v); + inline vtype2(const vtype4_yw_ref < vtype > &v); + inline vtype2(const vtype4_zx_ref < vtype > &v); + inline vtype2(const vtype4_zy_ref < vtype > &v); + inline vtype2(const vtype4_zz_ref < vtype > &v); + inline vtype2(const vtype4_zw_ref < vtype > &v); + inline vtype2(const vtype4_wx_ref < vtype > &v); + inline vtype2(const vtype4_wy_ref < vtype > &v); + inline vtype2(const vtype4_wz_ref < vtype > &v); + inline vtype2(const vtype4_ww_ref < vtype > &v); + vtype2_xx_ref < vtype > xx() + { + return vtype2_xx_ref < vtype > (this); + } + vtype2_xy_ref < vtype > xy() + { + return vtype2_xy_ref < vtype > (this); + } + vtype2_yx_ref < vtype > yx() + { + return vtype2_yx_ref < vtype > (this); + } + vtype2_yy_ref < vtype > yy() + { + return vtype2_yy_ref < vtype > (this); + } + vtype2_xxx_ref < vtype > xxx() + { + return vtype2_xxx_ref < vtype > (this); + } + vtype2_xxy_ref < vtype > xxy() + { + return vtype2_xxy_ref < vtype > (this); + } + vtype2_xyx_ref < vtype > xyx() + { + return vtype2_xyx_ref < vtype > (this); + } + vtype2_xyy_ref < vtype > xyy() + { + return vtype2_xyy_ref < vtype > (this); + } + vtype2_yxx_ref < vtype > yxx() + { + return vtype2_yxx_ref < vtype > (this); + } + vtype2_yxy_ref < vtype > yxy() + { + return vtype2_yxy_ref < vtype > (this); + } + vtype2_yyx_ref < vtype > yyx() + { + return vtype2_yyx_ref < vtype > (this); + } + vtype2_yyy_ref < vtype > yyy() + { + return vtype2_yyy_ref < vtype > (this); + } + vtype2_xxxx_ref < vtype > xxxx() + { + return vtype2_xxxx_ref < vtype > (this); + } + vtype2_xxxy_ref < vtype > xxxy() + { + return vtype2_xxxy_ref < vtype > (this); + } + vtype2_xxyx_ref < vtype > xxyx() + { + return vtype2_xxyx_ref < vtype > (this); + } + vtype2_xxyy_ref < vtype > xxyy() + { + return vtype2_xxyy_ref < vtype > (this); + } + vtype2_xyxx_ref < vtype > xyxx() + { + return vtype2_xyxx_ref < vtype > (this); + } + vtype2_xyxy_ref < vtype > xyxy() + { + return vtype2_xyxy_ref < vtype > (this); + } + vtype2_xyyx_ref < vtype > xyyx() + { + return vtype2_xyyx_ref < vtype > (this); + } + vtype2_xyyy_ref < vtype > xyyy() + { + return vtype2_xyyy_ref < vtype > (this); + } + vtype2_yxxx_ref < vtype > yxxx() + { + return vtype2_yxxx_ref < vtype > (this); + } + vtype2_yxxy_ref < vtype > yxxy() + { + return vtype2_yxxy_ref < vtype > (this); + } + vtype2_yxyx_ref < vtype > yxyx() + { + return vtype2_yxyx_ref < vtype > (this); + } + vtype2_yxyy_ref < vtype > yxyy() + { + return vtype2_yxyy_ref < vtype > (this); + } + vtype2_yyxx_ref < vtype > yyxx() + { + return vtype2_yyxx_ref < vtype > (this); + } + vtype2_yyxy_ref < vtype > yyxy() + { + return vtype2_yyxy_ref < vtype > (this); + } + vtype2_yyyx_ref < vtype > yyyx() + { + return vtype2_yyyx_ref < vtype > (this); + } + vtype2_yyyy_ref < vtype > yyyy() + { + return vtype2_yyyy_ref < vtype > (this); + } +}; + +template < typename vtype > class vtype3 +{ + public: + vtype x, y, z; + vtype3() + { + }; + vtype3(vtype p, vtype q, vtype r):x(p), y(q), z(r) + { + }; + vtype3(const vtype3 & p):x(p.x), y(p.y), z(p.z) + { + }; + vtype3(vtype p, const vtype2 < vtype > &q):x(p), y(q.x), z(q.y) + { + }; + vtype3(const vtype2 < vtype > &p, vtype q):x(p.x), y(p.y), z(q) + { + }; + inline vtype3(const vtype2_xxx_ref < vtype > &v); + inline vtype3(const vtype2_xxy_ref < vtype > &v); + inline vtype3(const vtype2_xyx_ref < vtype > &v); + inline vtype3(const vtype2_xyy_ref < vtype > &v); + inline vtype3(const vtype2_yxx_ref < vtype > &v); + inline vtype3(const vtype2_yxy_ref < vtype > &v); + inline vtype3(const vtype2_yyx_ref < vtype > &v); + inline vtype3(const vtype2_yyy_ref < vtype > &v); + inline vtype3(const vtype3_xxx_ref < vtype > &v); + inline vtype3(const vtype3_xxy_ref < vtype > &v); + inline vtype3(const vtype3_xxz_ref < vtype > &v); + inline vtype3(const vtype3_xyx_ref < vtype > &v); + inline vtype3(const vtype3_xyy_ref < vtype > &v); + inline vtype3(const vtype3_xyz_ref < vtype > &v); + inline vtype3(const vtype3_xzx_ref < vtype > &v); + inline vtype3(const vtype3_xzy_ref < vtype > &v); + inline vtype3(const vtype3_xzz_ref < vtype > &v); + inline vtype3(const vtype3_yxx_ref < vtype > &v); + inline vtype3(const vtype3_yxy_ref < vtype > &v); + inline vtype3(const vtype3_yxz_ref < vtype > &v); + inline vtype3(const vtype3_yyx_ref < vtype > &v); + inline vtype3(const vtype3_yyy_ref < vtype > &v); + inline vtype3(const vtype3_yyz_ref < vtype > &v); + inline vtype3(const vtype3_yzx_ref < vtype > &v); + inline vtype3(const vtype3_yzy_ref < vtype > &v); + inline vtype3(const vtype3_yzz_ref < vtype > &v); + inline vtype3(const vtype3_zxx_ref < vtype > &v); + inline vtype3(const vtype3_zxy_ref < vtype > &v); + inline vtype3(const vtype3_zxz_ref < vtype > &v); + inline vtype3(const vtype3_zyx_ref < vtype > &v); + inline vtype3(const vtype3_zyy_ref < vtype > &v); + inline vtype3(const vtype3_zyz_ref < vtype > &v); + inline vtype3(const vtype3_zzx_ref < vtype > &v); + inline vtype3(const vtype3_zzy_ref < vtype > &v); + inline vtype3(const vtype3_zzz_ref < vtype > &v); + inline vtype3(const vtype4_xxx_ref < vtype > &v); + inline vtype3(const vtype4_xxy_ref < vtype > &v); + inline vtype3(const vtype4_xxz_ref < vtype > &v); + inline vtype3(const vtype4_xxw_ref < vtype > &v); + inline vtype3(const vtype4_xyx_ref < vtype > &v); + inline vtype3(const vtype4_xyy_ref < vtype > &v); + inline vtype3(const vtype4_xyz_ref < vtype > &v); + inline vtype3(const vtype4_xyw_ref < vtype > &v); + inline vtype3(const vtype4_xzx_ref < vtype > &v); + inline vtype3(const vtype4_xzy_ref < vtype > &v); + inline vtype3(const vtype4_xzz_ref < vtype > &v); + inline vtype3(const vtype4_xzw_ref < vtype > &v); + inline vtype3(const vtype4_xwx_ref < vtype > &v); + inline vtype3(const vtype4_xwy_ref < vtype > &v); + inline vtype3(const vtype4_xwz_ref < vtype > &v); + inline vtype3(const vtype4_xww_ref < vtype > &v); + inline vtype3(const vtype4_yxx_ref < vtype > &v); + inline vtype3(const vtype4_yxy_ref < vtype > &v); + inline vtype3(const vtype4_yxz_ref < vtype > &v); + inline vtype3(const vtype4_yxw_ref < vtype > &v); + inline vtype3(const vtype4_yyx_ref < vtype > &v); + inline vtype3(const vtype4_yyy_ref < vtype > &v); + inline vtype3(const vtype4_yyz_ref < vtype > &v); + inline vtype3(const vtype4_yyw_ref < vtype > &v); + inline vtype3(const vtype4_yzx_ref < vtype > &v); + inline vtype3(const vtype4_yzy_ref < vtype > &v); + inline vtype3(const vtype4_yzz_ref < vtype > &v); + inline vtype3(const vtype4_yzw_ref < vtype > &v); + inline vtype3(const vtype4_ywx_ref < vtype > &v); + inline vtype3(const vtype4_ywy_ref < vtype > &v); + inline vtype3(const vtype4_ywz_ref < vtype > &v); + inline vtype3(const vtype4_yww_ref < vtype > &v); + inline vtype3(const vtype4_zxx_ref < vtype > &v); + inline vtype3(const vtype4_zxy_ref < vtype > &v); + inline vtype3(const vtype4_zxz_ref < vtype > &v); + inline vtype3(const vtype4_zxw_ref < vtype > &v); + inline vtype3(const vtype4_zyx_ref < vtype > &v); + inline vtype3(const vtype4_zyy_ref < vtype > &v); + inline vtype3(const vtype4_zyz_ref < vtype > &v); + inline vtype3(const vtype4_zyw_ref < vtype > &v); + inline vtype3(const vtype4_zzx_ref < vtype > &v); + inline vtype3(const vtype4_zzy_ref < vtype > &v); + inline vtype3(const vtype4_zzz_ref < vtype > &v); + inline vtype3(const vtype4_zzw_ref < vtype > &v); + inline vtype3(const vtype4_zwx_ref < vtype > &v); + inline vtype3(const vtype4_zwy_ref < vtype > &v); + inline vtype3(const vtype4_zwz_ref < vtype > &v); + inline vtype3(const vtype4_zww_ref < vtype > &v); + inline vtype3(const vtype4_wxx_ref < vtype > &v); + inline vtype3(const vtype4_wxy_ref < vtype > &v); + inline vtype3(const vtype4_wxz_ref < vtype > &v); + inline vtype3(const vtype4_wxw_ref < vtype > &v); + inline vtype3(const vtype4_wyx_ref < vtype > &v); + inline vtype3(const vtype4_wyy_ref < vtype > &v); + inline vtype3(const vtype4_wyz_ref < vtype > &v); + inline vtype3(const vtype4_wyw_ref < vtype > &v); + inline vtype3(const vtype4_wzx_ref < vtype > &v); + inline vtype3(const vtype4_wzy_ref < vtype > &v); + inline vtype3(const vtype4_wzz_ref < vtype > &v); + inline vtype3(const vtype4_wzw_ref < vtype > &v); + inline vtype3(const vtype4_wwx_ref < vtype > &v); + inline vtype3(const vtype4_wwy_ref < vtype > &v); + inline vtype3(const vtype4_wwz_ref < vtype > &v); + inline vtype3(const vtype4_www_ref < vtype > &v); + vtype3_xx_ref < vtype > xx() + { + return vtype3_xx_ref < vtype > (this); + } + vtype3_xy_ref < vtype > xy() + { + return vtype3_xy_ref < vtype > (this); + } + vtype3_xz_ref < vtype > xz() + { + return vtype3_xz_ref < vtype > (this); + } + vtype3_yx_ref < vtype > yx() + { + return vtype3_yx_ref < vtype > (this); + } + vtype3_yy_ref < vtype > yy() + { + return vtype3_yy_ref < vtype > (this); + } + vtype3_yz_ref < vtype > yz() + { + return vtype3_yz_ref < vtype > (this); + } + vtype3_zx_ref < vtype > zx() + { + return vtype3_zx_ref < vtype > (this); + } + vtype3_zy_ref < vtype > zy() + { + return vtype3_zy_ref < vtype > (this); + } + vtype3_zz_ref < vtype > zz() + { + return vtype3_zz_ref < vtype > (this); + } + vtype3_xxx_ref < vtype > xxx() + { + return vtype3_xxx_ref < vtype > (this); + } + vtype3_xxy_ref < vtype > xxy() + { + return vtype3_xxy_ref < vtype > (this); + } + vtype3_xxz_ref < vtype > xxz() + { + return vtype3_xxz_ref < vtype > (this); + } + vtype3_xyx_ref < vtype > xyx() + { + return vtype3_xyx_ref < vtype > (this); + } + vtype3_xyy_ref < vtype > xyy() + { + return vtype3_xyy_ref < vtype > (this); + } + vtype3_xyz_ref < vtype > xyz() + { + return vtype3_xyz_ref < vtype > (this); + } + vtype3_xzx_ref < vtype > xzx() + { + return vtype3_xzx_ref < vtype > (this); + } + vtype3_xzy_ref < vtype > xzy() + { + return vtype3_xzy_ref < vtype > (this); + } + vtype3_xzz_ref < vtype > xzz() + { + return vtype3_xzz_ref < vtype > (this); + } + vtype3_yxx_ref < vtype > yxx() + { + return vtype3_yxx_ref < vtype > (this); + } + vtype3_yxy_ref < vtype > yxy() + { + return vtype3_yxy_ref < vtype > (this); + } + vtype3_yxz_ref < vtype > yxz() + { + return vtype3_yxz_ref < vtype > (this); + } + vtype3_yyx_ref < vtype > yyx() + { + return vtype3_yyx_ref < vtype > (this); + } + vtype3_yyy_ref < vtype > yyy() + { + return vtype3_yyy_ref < vtype > (this); + } + vtype3_yyz_ref < vtype > yyz() + { + return vtype3_yyz_ref < vtype > (this); + } + vtype3_yzx_ref < vtype > yzx() + { + return vtype3_yzx_ref < vtype > (this); + } + vtype3_yzy_ref < vtype > yzy() + { + return vtype3_yzy_ref < vtype > (this); + } + vtype3_yzz_ref < vtype > yzz() + { + return vtype3_yzz_ref < vtype > (this); + } + vtype3_zxx_ref < vtype > zxx() + { + return vtype3_zxx_ref < vtype > (this); + } + vtype3_zxy_ref < vtype > zxy() + { + return vtype3_zxy_ref < vtype > (this); + } + vtype3_zxz_ref < vtype > zxz() + { + return vtype3_zxz_ref < vtype > (this); + } + vtype3_zyx_ref < vtype > zyx() + { + return vtype3_zyx_ref < vtype > (this); + } + vtype3_zyy_ref < vtype > zyy() + { + return vtype3_zyy_ref < vtype > (this); + } + vtype3_zyz_ref < vtype > zyz() + { + return vtype3_zyz_ref < vtype > (this); + } + vtype3_zzx_ref < vtype > zzx() + { + return vtype3_zzx_ref < vtype > (this); + } + vtype3_zzy_ref < vtype > zzy() + { + return vtype3_zzy_ref < vtype > (this); + } + vtype3_zzz_ref < vtype > zzz() + { + return vtype3_zzz_ref < vtype > (this); + } + vtype3_xxxx_ref < vtype > xxxx() + { + return vtype3_xxxx_ref < vtype > (this); + } + vtype3_xxxy_ref < vtype > xxxy() + { + return vtype3_xxxy_ref < vtype > (this); + } + vtype3_xxxz_ref < vtype > xxxz() + { + return vtype3_xxxz_ref < vtype > (this); + } + vtype3_xxyx_ref < vtype > xxyx() + { + return vtype3_xxyx_ref < vtype > (this); + } + vtype3_xxyy_ref < vtype > xxyy() + { + return vtype3_xxyy_ref < vtype > (this); + } + vtype3_xxyz_ref < vtype > xxyz() + { + return vtype3_xxyz_ref < vtype > (this); + } + vtype3_xxzx_ref < vtype > xxzx() + { + return vtype3_xxzx_ref < vtype > (this); + } + vtype3_xxzy_ref < vtype > xxzy() + { + return vtype3_xxzy_ref < vtype > (this); + } + vtype3_xxzz_ref < vtype > xxzz() + { + return vtype3_xxzz_ref < vtype > (this); + } + vtype3_xyxx_ref < vtype > xyxx() + { + return vtype3_xyxx_ref < vtype > (this); + } + vtype3_xyxy_ref < vtype > xyxy() + { + return vtype3_xyxy_ref < vtype > (this); + } + vtype3_xyxz_ref < vtype > xyxz() + { + return vtype3_xyxz_ref < vtype > (this); + } + vtype3_xyyx_ref < vtype > xyyx() + { + return vtype3_xyyx_ref < vtype > (this); + } + vtype3_xyyy_ref < vtype > xyyy() + { + return vtype3_xyyy_ref < vtype > (this); + } + vtype3_xyyz_ref < vtype > xyyz() + { + return vtype3_xyyz_ref < vtype > (this); + } + vtype3_xyzx_ref < vtype > xyzx() + { + return vtype3_xyzx_ref < vtype > (this); + } + vtype3_xyzy_ref < vtype > xyzy() + { + return vtype3_xyzy_ref < vtype > (this); + } + vtype3_xyzz_ref < vtype > xyzz() + { + return vtype3_xyzz_ref < vtype > (this); + } + vtype3_xzxx_ref < vtype > xzxx() + { + return vtype3_xzxx_ref < vtype > (this); + } + vtype3_xzxy_ref < vtype > xzxy() + { + return vtype3_xzxy_ref < vtype > (this); + } + vtype3_xzxz_ref < vtype > xzxz() + { + return vtype3_xzxz_ref < vtype > (this); + } + vtype3_xzyx_ref < vtype > xzyx() + { + return vtype3_xzyx_ref < vtype > (this); + } + vtype3_xzyy_ref < vtype > xzyy() + { + return vtype3_xzyy_ref < vtype > (this); + } + vtype3_xzyz_ref < vtype > xzyz() + { + return vtype3_xzyz_ref < vtype > (this); + } + vtype3_xzzx_ref < vtype > xzzx() + { + return vtype3_xzzx_ref < vtype > (this); + } + vtype3_xzzy_ref < vtype > xzzy() + { + return vtype3_xzzy_ref < vtype > (this); + } + vtype3_xzzz_ref < vtype > xzzz() + { + return vtype3_xzzz_ref < vtype > (this); + } + vtype3_yxxx_ref < vtype > yxxx() + { + return vtype3_yxxx_ref < vtype > (this); + } + vtype3_yxxy_ref < vtype > yxxy() + { + return vtype3_yxxy_ref < vtype > (this); + } + vtype3_yxxz_ref < vtype > yxxz() + { + return vtype3_yxxz_ref < vtype > (this); + } + vtype3_yxyx_ref < vtype > yxyx() + { + return vtype3_yxyx_ref < vtype > (this); + } + vtype3_yxyy_ref < vtype > yxyy() + { + return vtype3_yxyy_ref < vtype > (this); + } + vtype3_yxyz_ref < vtype > yxyz() + { + return vtype3_yxyz_ref < vtype > (this); + } + vtype3_yxzx_ref < vtype > yxzx() + { + return vtype3_yxzx_ref < vtype > (this); + } + vtype3_yxzy_ref < vtype > yxzy() + { + return vtype3_yxzy_ref < vtype > (this); + } + vtype3_yxzz_ref < vtype > yxzz() + { + return vtype3_yxzz_ref < vtype > (this); + } + vtype3_yyxx_ref < vtype > yyxx() + { + return vtype3_yyxx_ref < vtype > (this); + } + vtype3_yyxy_ref < vtype > yyxy() + { + return vtype3_yyxy_ref < vtype > (this); + } + vtype3_yyxz_ref < vtype > yyxz() + { + return vtype3_yyxz_ref < vtype > (this); + } + vtype3_yyyx_ref < vtype > yyyx() + { + return vtype3_yyyx_ref < vtype > (this); + } + vtype3_yyyy_ref < vtype > yyyy() + { + return vtype3_yyyy_ref < vtype > (this); + } + vtype3_yyyz_ref < vtype > yyyz() + { + return vtype3_yyyz_ref < vtype > (this); + } + vtype3_yyzx_ref < vtype > yyzx() + { + return vtype3_yyzx_ref < vtype > (this); + } + vtype3_yyzy_ref < vtype > yyzy() + { + return vtype3_yyzy_ref < vtype > (this); + } + vtype3_yyzz_ref < vtype > yyzz() + { + return vtype3_yyzz_ref < vtype > (this); + } + vtype3_yzxx_ref < vtype > yzxx() + { + return vtype3_yzxx_ref < vtype > (this); + } + vtype3_yzxy_ref < vtype > yzxy() + { + return vtype3_yzxy_ref < vtype > (this); + } + vtype3_yzxz_ref < vtype > yzxz() + { + return vtype3_yzxz_ref < vtype > (this); + } + vtype3_yzyx_ref < vtype > yzyx() + { + return vtype3_yzyx_ref < vtype > (this); + } + vtype3_yzyy_ref < vtype > yzyy() + { + return vtype3_yzyy_ref < vtype > (this); + } + vtype3_yzyz_ref < vtype > yzyz() + { + return vtype3_yzyz_ref < vtype > (this); + } + vtype3_yzzx_ref < vtype > yzzx() + { + return vtype3_yzzx_ref < vtype > (this); + } + vtype3_yzzy_ref < vtype > yzzy() + { + return vtype3_yzzy_ref < vtype > (this); + } + vtype3_yzzz_ref < vtype > yzzz() + { + return vtype3_yzzz_ref < vtype > (this); + } + vtype3_zxxx_ref < vtype > zxxx() + { + return vtype3_zxxx_ref < vtype > (this); + } + vtype3_zxxy_ref < vtype > zxxy() + { + return vtype3_zxxy_ref < vtype > (this); + } + vtype3_zxxz_ref < vtype > zxxz() + { + return vtype3_zxxz_ref < vtype > (this); + } + vtype3_zxyx_ref < vtype > zxyx() + { + return vtype3_zxyx_ref < vtype > (this); + } + vtype3_zxyy_ref < vtype > zxyy() + { + return vtype3_zxyy_ref < vtype > (this); + } + vtype3_zxyz_ref < vtype > zxyz() + { + return vtype3_zxyz_ref < vtype > (this); + } + vtype3_zxzx_ref < vtype > zxzx() + { + return vtype3_zxzx_ref < vtype > (this); + } + vtype3_zxzy_ref < vtype > zxzy() + { + return vtype3_zxzy_ref < vtype > (this); + } + vtype3_zxzz_ref < vtype > zxzz() + { + return vtype3_zxzz_ref < vtype > (this); + } + vtype3_zyxx_ref < vtype > zyxx() + { + return vtype3_zyxx_ref < vtype > (this); + } + vtype3_zyxy_ref < vtype > zyxy() + { + return vtype3_zyxy_ref < vtype > (this); + } + vtype3_zyxz_ref < vtype > zyxz() + { + return vtype3_zyxz_ref < vtype > (this); + } + vtype3_zyyx_ref < vtype > zyyx() + { + return vtype3_zyyx_ref < vtype > (this); + } + vtype3_zyyy_ref < vtype > zyyy() + { + return vtype3_zyyy_ref < vtype > (this); + } + vtype3_zyyz_ref < vtype > zyyz() + { + return vtype3_zyyz_ref < vtype > (this); + } + vtype3_zyzx_ref < vtype > zyzx() + { + return vtype3_zyzx_ref < vtype > (this); + } + vtype3_zyzy_ref < vtype > zyzy() + { + return vtype3_zyzy_ref < vtype > (this); + } + vtype3_zyzz_ref < vtype > zyzz() + { + return vtype3_zyzz_ref < vtype > (this); + } + vtype3_zzxx_ref < vtype > zzxx() + { + return vtype3_zzxx_ref < vtype > (this); + } + vtype3_zzxy_ref < vtype > zzxy() + { + return vtype3_zzxy_ref < vtype > (this); + } + vtype3_zzxz_ref < vtype > zzxz() + { + return vtype3_zzxz_ref < vtype > (this); + } + vtype3_zzyx_ref < vtype > zzyx() + { + return vtype3_zzyx_ref < vtype > (this); + } + vtype3_zzyy_ref < vtype > zzyy() + { + return vtype3_zzyy_ref < vtype > (this); + } + vtype3_zzyz_ref < vtype > zzyz() + { + return vtype3_zzyz_ref < vtype > (this); + } + vtype3_zzzx_ref < vtype > zzzx() + { + return vtype3_zzzx_ref < vtype > (this); + } + vtype3_zzzy_ref < vtype > zzzy() + { + return vtype3_zzzy_ref < vtype > (this); + } + vtype3_zzzz_ref < vtype > zzzz() + { + return vtype3_zzzz_ref < vtype > (this); + } +}; + +template < typename vtype > class vtype4 +{ + public: + vtype x, y, z, w; + vtype4() + { + }; + vtype4(vtype p, vtype q, vtype r, vtype s):x(p), y(q), z(r), w(s) + { + }; + vtype4(const vtype2 < vtype > &p, const vtype2 < vtype > &q):x(p.x), y(p.y), z(q.x), w(q.y) + { + }; + vtype4(const vtype2 < vtype > &p, vtype q, vtype r):x(p.x), y(p.y), z(q), w(r) + { + }; + vtype4(vtype p, const vtype2 < vtype > &q, vtype r):x(p), y(q.x), z(q.y), w(r) + { + }; + vtype4(vtype p, vtype q, const vtype2 < vtype > &r):x(p), y(q), z(r.x), w(r.y) + { + }; + vtype4(const vtype3 < vtype > &p, vtype q):x(p.x), y(p.y), z(p.z), w(q) + { + }; + vtype4(vtype p, const vtype3 < vtype > &q):x(p), y(q.x), z(q.y), w(q.z) + { + }; + vtype4(const vtype4 & p):x(p.x), y(p.y), z(p.z), w(p.w) + { + }; + inline vtype4(const vtype2_xxxx_ref < vtype > &v); + inline vtype4(const vtype2_xxxy_ref < vtype > &v); + inline vtype4(const vtype2_xxyx_ref < vtype > &v); + inline vtype4(const vtype2_xxyy_ref < vtype > &v); + inline vtype4(const vtype2_xyxx_ref < vtype > &v); + inline vtype4(const vtype2_xyxy_ref < vtype > &v); + inline vtype4(const vtype2_xyyx_ref < vtype > &v); + inline vtype4(const vtype2_xyyy_ref < vtype > &v); + inline vtype4(const vtype2_yxxx_ref < vtype > &v); + inline vtype4(const vtype2_yxxy_ref < vtype > &v); + inline vtype4(const vtype2_yxyx_ref < vtype > &v); + inline vtype4(const vtype2_yxyy_ref < vtype > &v); + inline vtype4(const vtype2_yyxx_ref < vtype > &v); + inline vtype4(const vtype2_yyxy_ref < vtype > &v); + inline vtype4(const vtype2_yyyx_ref < vtype > &v); + inline vtype4(const vtype2_yyyy_ref < vtype > &v); + inline vtype4(const vtype3_xxxx_ref < vtype > &v); + inline vtype4(const vtype3_xxxy_ref < vtype > &v); + inline vtype4(const vtype3_xxxz_ref < vtype > &v); + inline vtype4(const vtype3_xxyx_ref < vtype > &v); + inline vtype4(const vtype3_xxyy_ref < vtype > &v); + inline vtype4(const vtype3_xxyz_ref < vtype > &v); + inline vtype4(const vtype3_xxzx_ref < vtype > &v); + inline vtype4(const vtype3_xxzy_ref < vtype > &v); + inline vtype4(const vtype3_xxzz_ref < vtype > &v); + inline vtype4(const vtype3_xyxx_ref < vtype > &v); + inline vtype4(const vtype3_xyxy_ref < vtype > &v); + inline vtype4(const vtype3_xyxz_ref < vtype > &v); + inline vtype4(const vtype3_xyyx_ref < vtype > &v); + inline vtype4(const vtype3_xyyy_ref < vtype > &v); + inline vtype4(const vtype3_xyyz_ref < vtype > &v); + inline vtype4(const vtype3_xyzx_ref < vtype > &v); + inline vtype4(const vtype3_xyzy_ref < vtype > &v); + inline vtype4(const vtype3_xyzz_ref < vtype > &v); + inline vtype4(const vtype3_xzxx_ref < vtype > &v); + inline vtype4(const vtype3_xzxy_ref < vtype > &v); + inline vtype4(const vtype3_xzxz_ref < vtype > &v); + inline vtype4(const vtype3_xzyx_ref < vtype > &v); + inline vtype4(const vtype3_xzyy_ref < vtype > &v); + inline vtype4(const vtype3_xzyz_ref < vtype > &v); + inline vtype4(const vtype3_xzzx_ref < vtype > &v); + inline vtype4(const vtype3_xzzy_ref < vtype > &v); + inline vtype4(const vtype3_xzzz_ref < vtype > &v); + inline vtype4(const vtype3_yxxx_ref < vtype > &v); + inline vtype4(const vtype3_yxxy_ref < vtype > &v); + inline vtype4(const vtype3_yxxz_ref < vtype > &v); + inline vtype4(const vtype3_yxyx_ref < vtype > &v); + inline vtype4(const vtype3_yxyy_ref < vtype > &v); + inline vtype4(const vtype3_yxyz_ref < vtype > &v); + inline vtype4(const vtype3_yxzx_ref < vtype > &v); + inline vtype4(const vtype3_yxzy_ref < vtype > &v); + inline vtype4(const vtype3_yxzz_ref < vtype > &v); + inline vtype4(const vtype3_yyxx_ref < vtype > &v); + inline vtype4(const vtype3_yyxy_ref < vtype > &v); + inline vtype4(const vtype3_yyxz_ref < vtype > &v); + inline vtype4(const vtype3_yyyx_ref < vtype > &v); + inline vtype4(const vtype3_yyyy_ref < vtype > &v); + inline vtype4(const vtype3_yyyz_ref < vtype > &v); + inline vtype4(const vtype3_yyzx_ref < vtype > &v); + inline vtype4(const vtype3_yyzy_ref < vtype > &v); + inline vtype4(const vtype3_yyzz_ref < vtype > &v); + inline vtype4(const vtype3_yzxx_ref < vtype > &v); + inline vtype4(const vtype3_yzxy_ref < vtype > &v); + inline vtype4(const vtype3_yzxz_ref < vtype > &v); + inline vtype4(const vtype3_yzyx_ref < vtype > &v); + inline vtype4(const vtype3_yzyy_ref < vtype > &v); + inline vtype4(const vtype3_yzyz_ref < vtype > &v); + inline vtype4(const vtype3_yzzx_ref < vtype > &v); + inline vtype4(const vtype3_yzzy_ref < vtype > &v); + inline vtype4(const vtype3_yzzz_ref < vtype > &v); + inline vtype4(const vtype3_zxxx_ref < vtype > &v); + inline vtype4(const vtype3_zxxy_ref < vtype > &v); + inline vtype4(const vtype3_zxxz_ref < vtype > &v); + inline vtype4(const vtype3_zxyx_ref < vtype > &v); + inline vtype4(const vtype3_zxyy_ref < vtype > &v); + inline vtype4(const vtype3_zxyz_ref < vtype > &v); + inline vtype4(const vtype3_zxzx_ref < vtype > &v); + inline vtype4(const vtype3_zxzy_ref < vtype > &v); + inline vtype4(const vtype3_zxzz_ref < vtype > &v); + inline vtype4(const vtype3_zyxx_ref < vtype > &v); + inline vtype4(const vtype3_zyxy_ref < vtype > &v); + inline vtype4(const vtype3_zyxz_ref < vtype > &v); + inline vtype4(const vtype3_zyyx_ref < vtype > &v); + inline vtype4(const vtype3_zyyy_ref < vtype > &v); + inline vtype4(const vtype3_zyyz_ref < vtype > &v); + inline vtype4(const vtype3_zyzx_ref < vtype > &v); + inline vtype4(const vtype3_zyzy_ref < vtype > &v); + inline vtype4(const vtype3_zyzz_ref < vtype > &v); + inline vtype4(const vtype3_zzxx_ref < vtype > &v); + inline vtype4(const vtype3_zzxy_ref < vtype > &v); + inline vtype4(const vtype3_zzxz_ref < vtype > &v); + inline vtype4(const vtype3_zzyx_ref < vtype > &v); + inline vtype4(const vtype3_zzyy_ref < vtype > &v); + inline vtype4(const vtype3_zzyz_ref < vtype > &v); + inline vtype4(const vtype3_zzzx_ref < vtype > &v); + inline vtype4(const vtype3_zzzy_ref < vtype > &v); + inline vtype4(const vtype3_zzzz_ref < vtype > &v); + inline vtype4(const vtype4_xxxx_ref < vtype > &v); + inline vtype4(const vtype4_xxxy_ref < vtype > &v); + inline vtype4(const vtype4_xxxz_ref < vtype > &v); + inline vtype4(const vtype4_xxxw_ref < vtype > &v); + inline vtype4(const vtype4_xxyx_ref < vtype > &v); + inline vtype4(const vtype4_xxyy_ref < vtype > &v); + inline vtype4(const vtype4_xxyz_ref < vtype > &v); + inline vtype4(const vtype4_xxyw_ref < vtype > &v); + inline vtype4(const vtype4_xxzx_ref < vtype > &v); + inline vtype4(const vtype4_xxzy_ref < vtype > &v); + inline vtype4(const vtype4_xxzz_ref < vtype > &v); + inline vtype4(const vtype4_xxzw_ref < vtype > &v); + inline vtype4(const vtype4_xxwx_ref < vtype > &v); + inline vtype4(const vtype4_xxwy_ref < vtype > &v); + inline vtype4(const vtype4_xxwz_ref < vtype > &v); + inline vtype4(const vtype4_xxww_ref < vtype > &v); + inline vtype4(const vtype4_xyxx_ref < vtype > &v); + inline vtype4(const vtype4_xyxy_ref < vtype > &v); + inline vtype4(const vtype4_xyxz_ref < vtype > &v); + inline vtype4(const vtype4_xyxw_ref < vtype > &v); + inline vtype4(const vtype4_xyyx_ref < vtype > &v); + inline vtype4(const vtype4_xyyy_ref < vtype > &v); + inline vtype4(const vtype4_xyyz_ref < vtype > &v); + inline vtype4(const vtype4_xyyw_ref < vtype > &v); + inline vtype4(const vtype4_xyzx_ref < vtype > &v); + inline vtype4(const vtype4_xyzy_ref < vtype > &v); + inline vtype4(const vtype4_xyzz_ref < vtype > &v); + inline vtype4(const vtype4_xyzw_ref < vtype > &v); + inline vtype4(const vtype4_xywx_ref < vtype > &v); + inline vtype4(const vtype4_xywy_ref < vtype > &v); + inline vtype4(const vtype4_xywz_ref < vtype > &v); + inline vtype4(const vtype4_xyww_ref < vtype > &v); + inline vtype4(const vtype4_xzxx_ref < vtype > &v); + inline vtype4(const vtype4_xzxy_ref < vtype > &v); + inline vtype4(const vtype4_xzxz_ref < vtype > &v); + inline vtype4(const vtype4_xzxw_ref < vtype > &v); + inline vtype4(const vtype4_xzyx_ref < vtype > &v); + inline vtype4(const vtype4_xzyy_ref < vtype > &v); + inline vtype4(const vtype4_xzyz_ref < vtype > &v); + inline vtype4(const vtype4_xzyw_ref < vtype > &v); + inline vtype4(const vtype4_xzzx_ref < vtype > &v); + inline vtype4(const vtype4_xzzy_ref < vtype > &v); + inline vtype4(const vtype4_xzzz_ref < vtype > &v); + inline vtype4(const vtype4_xzzw_ref < vtype > &v); + inline vtype4(const vtype4_xzwx_ref < vtype > &v); + inline vtype4(const vtype4_xzwy_ref < vtype > &v); + inline vtype4(const vtype4_xzwz_ref < vtype > &v); + inline vtype4(const vtype4_xzww_ref < vtype > &v); + inline vtype4(const vtype4_xwxx_ref < vtype > &v); + inline vtype4(const vtype4_xwxy_ref < vtype > &v); + inline vtype4(const vtype4_xwxz_ref < vtype > &v); + inline vtype4(const vtype4_xwxw_ref < vtype > &v); + inline vtype4(const vtype4_xwyx_ref < vtype > &v); + inline vtype4(const vtype4_xwyy_ref < vtype > &v); + inline vtype4(const vtype4_xwyz_ref < vtype > &v); + inline vtype4(const vtype4_xwyw_ref < vtype > &v); + inline vtype4(const vtype4_xwzx_ref < vtype > &v); + inline vtype4(const vtype4_xwzy_ref < vtype > &v); + inline vtype4(const vtype4_xwzz_ref < vtype > &v); + inline vtype4(const vtype4_xwzw_ref < vtype > &v); + inline vtype4(const vtype4_xwwx_ref < vtype > &v); + inline vtype4(const vtype4_xwwy_ref < vtype > &v); + inline vtype4(const vtype4_xwwz_ref < vtype > &v); + inline vtype4(const vtype4_xwww_ref < vtype > &v); + inline vtype4(const vtype4_yxxx_ref < vtype > &v); + inline vtype4(const vtype4_yxxy_ref < vtype > &v); + inline vtype4(const vtype4_yxxz_ref < vtype > &v); + inline vtype4(const vtype4_yxxw_ref < vtype > &v); + inline vtype4(const vtype4_yxyx_ref < vtype > &v); + inline vtype4(const vtype4_yxyy_ref < vtype > &v); + inline vtype4(const vtype4_yxyz_ref < vtype > &v); + inline vtype4(const vtype4_yxyw_ref < vtype > &v); + inline vtype4(const vtype4_yxzx_ref < vtype > &v); + inline vtype4(const vtype4_yxzy_ref < vtype > &v); + inline vtype4(const vtype4_yxzz_ref < vtype > &v); + inline vtype4(const vtype4_yxzw_ref < vtype > &v); + inline vtype4(const vtype4_yxwx_ref < vtype > &v); + inline vtype4(const vtype4_yxwy_ref < vtype > &v); + inline vtype4(const vtype4_yxwz_ref < vtype > &v); + inline vtype4(const vtype4_yxww_ref < vtype > &v); + inline vtype4(const vtype4_yyxx_ref < vtype > &v); + inline vtype4(const vtype4_yyxy_ref < vtype > &v); + inline vtype4(const vtype4_yyxz_ref < vtype > &v); + inline vtype4(const vtype4_yyxw_ref < vtype > &v); + inline vtype4(const vtype4_yyyx_ref < vtype > &v); + inline vtype4(const vtype4_yyyy_ref < vtype > &v); + inline vtype4(const vtype4_yyyz_ref < vtype > &v); + inline vtype4(const vtype4_yyyw_ref < vtype > &v); + inline vtype4(const vtype4_yyzx_ref < vtype > &v); + inline vtype4(const vtype4_yyzy_ref < vtype > &v); + inline vtype4(const vtype4_yyzz_ref < vtype > &v); + inline vtype4(const vtype4_yyzw_ref < vtype > &v); + inline vtype4(const vtype4_yywx_ref < vtype > &v); + inline vtype4(const vtype4_yywy_ref < vtype > &v); + inline vtype4(const vtype4_yywz_ref < vtype > &v); + inline vtype4(const vtype4_yyww_ref < vtype > &v); + inline vtype4(const vtype4_yzxx_ref < vtype > &v); + inline vtype4(const vtype4_yzxy_ref < vtype > &v); + inline vtype4(const vtype4_yzxz_ref < vtype > &v); + inline vtype4(const vtype4_yzxw_ref < vtype > &v); + inline vtype4(const vtype4_yzyx_ref < vtype > &v); + inline vtype4(const vtype4_yzyy_ref < vtype > &v); + inline vtype4(const vtype4_yzyz_ref < vtype > &v); + inline vtype4(const vtype4_yzyw_ref < vtype > &v); + inline vtype4(const vtype4_yzzx_ref < vtype > &v); + inline vtype4(const vtype4_yzzy_ref < vtype > &v); + inline vtype4(const vtype4_yzzz_ref < vtype > &v); + inline vtype4(const vtype4_yzzw_ref < vtype > &v); + inline vtype4(const vtype4_yzwx_ref < vtype > &v); + inline vtype4(const vtype4_yzwy_ref < vtype > &v); + inline vtype4(const vtype4_yzwz_ref < vtype > &v); + inline vtype4(const vtype4_yzww_ref < vtype > &v); + inline vtype4(const vtype4_ywxx_ref < vtype > &v); + inline vtype4(const vtype4_ywxy_ref < vtype > &v); + inline vtype4(const vtype4_ywxz_ref < vtype > &v); + inline vtype4(const vtype4_ywxw_ref < vtype > &v); + inline vtype4(const vtype4_ywyx_ref < vtype > &v); + inline vtype4(const vtype4_ywyy_ref < vtype > &v); + inline vtype4(const vtype4_ywyz_ref < vtype > &v); + inline vtype4(const vtype4_ywyw_ref < vtype > &v); + inline vtype4(const vtype4_ywzx_ref < vtype > &v); + inline vtype4(const vtype4_ywzy_ref < vtype > &v); + inline vtype4(const vtype4_ywzz_ref < vtype > &v); + inline vtype4(const vtype4_ywzw_ref < vtype > &v); + inline vtype4(const vtype4_ywwx_ref < vtype > &v); + inline vtype4(const vtype4_ywwy_ref < vtype > &v); + inline vtype4(const vtype4_ywwz_ref < vtype > &v); + inline vtype4(const vtype4_ywww_ref < vtype > &v); + inline vtype4(const vtype4_zxxx_ref < vtype > &v); + inline vtype4(const vtype4_zxxy_ref < vtype > &v); + inline vtype4(const vtype4_zxxz_ref < vtype > &v); + inline vtype4(const vtype4_zxxw_ref < vtype > &v); + inline vtype4(const vtype4_zxyx_ref < vtype > &v); + inline vtype4(const vtype4_zxyy_ref < vtype > &v); + inline vtype4(const vtype4_zxyz_ref < vtype > &v); + inline vtype4(const vtype4_zxyw_ref < vtype > &v); + inline vtype4(const vtype4_zxzx_ref < vtype > &v); + inline vtype4(const vtype4_zxzy_ref < vtype > &v); + inline vtype4(const vtype4_zxzz_ref < vtype > &v); + inline vtype4(const vtype4_zxzw_ref < vtype > &v); + inline vtype4(const vtype4_zxwx_ref < vtype > &v); + inline vtype4(const vtype4_zxwy_ref < vtype > &v); + inline vtype4(const vtype4_zxwz_ref < vtype > &v); + inline vtype4(const vtype4_zxww_ref < vtype > &v); + inline vtype4(const vtype4_zyxx_ref < vtype > &v); + inline vtype4(const vtype4_zyxy_ref < vtype > &v); + inline vtype4(const vtype4_zyxz_ref < vtype > &v); + inline vtype4(const vtype4_zyxw_ref < vtype > &v); + inline vtype4(const vtype4_zyyx_ref < vtype > &v); + inline vtype4(const vtype4_zyyy_ref < vtype > &v); + inline vtype4(const vtype4_zyyz_ref < vtype > &v); + inline vtype4(const vtype4_zyyw_ref < vtype > &v); + inline vtype4(const vtype4_zyzx_ref < vtype > &v); + inline vtype4(const vtype4_zyzy_ref < vtype > &v); + inline vtype4(const vtype4_zyzz_ref < vtype > &v); + inline vtype4(const vtype4_zyzw_ref < vtype > &v); + inline vtype4(const vtype4_zywx_ref < vtype > &v); + inline vtype4(const vtype4_zywy_ref < vtype > &v); + inline vtype4(const vtype4_zywz_ref < vtype > &v); + inline vtype4(const vtype4_zyww_ref < vtype > &v); + inline vtype4(const vtype4_zzxx_ref < vtype > &v); + inline vtype4(const vtype4_zzxy_ref < vtype > &v); + inline vtype4(const vtype4_zzxz_ref < vtype > &v); + inline vtype4(const vtype4_zzxw_ref < vtype > &v); + inline vtype4(const vtype4_zzyx_ref < vtype > &v); + inline vtype4(const vtype4_zzyy_ref < vtype > &v); + inline vtype4(const vtype4_zzyz_ref < vtype > &v); + inline vtype4(const vtype4_zzyw_ref < vtype > &v); + inline vtype4(const vtype4_zzzx_ref < vtype > &v); + inline vtype4(const vtype4_zzzy_ref < vtype > &v); + inline vtype4(const vtype4_zzzz_ref < vtype > &v); + inline vtype4(const vtype4_zzzw_ref < vtype > &v); + inline vtype4(const vtype4_zzwx_ref < vtype > &v); + inline vtype4(const vtype4_zzwy_ref < vtype > &v); + inline vtype4(const vtype4_zzwz_ref < vtype > &v); + inline vtype4(const vtype4_zzww_ref < vtype > &v); + inline vtype4(const vtype4_zwxx_ref < vtype > &v); + inline vtype4(const vtype4_zwxy_ref < vtype > &v); + inline vtype4(const vtype4_zwxz_ref < vtype > &v); + inline vtype4(const vtype4_zwxw_ref < vtype > &v); + inline vtype4(const vtype4_zwyx_ref < vtype > &v); + inline vtype4(const vtype4_zwyy_ref < vtype > &v); + inline vtype4(const vtype4_zwyz_ref < vtype > &v); + inline vtype4(const vtype4_zwyw_ref < vtype > &v); + inline vtype4(const vtype4_zwzx_ref < vtype > &v); + inline vtype4(const vtype4_zwzy_ref < vtype > &v); + inline vtype4(const vtype4_zwzz_ref < vtype > &v); + inline vtype4(const vtype4_zwzw_ref < vtype > &v); + inline vtype4(const vtype4_zwwx_ref < vtype > &v); + inline vtype4(const vtype4_zwwy_ref < vtype > &v); + inline vtype4(const vtype4_zwwz_ref < vtype > &v); + inline vtype4(const vtype4_zwww_ref < vtype > &v); + inline vtype4(const vtype4_wxxx_ref < vtype > &v); + inline vtype4(const vtype4_wxxy_ref < vtype > &v); + inline vtype4(const vtype4_wxxz_ref < vtype > &v); + inline vtype4(const vtype4_wxxw_ref < vtype > &v); + inline vtype4(const vtype4_wxyx_ref < vtype > &v); + inline vtype4(const vtype4_wxyy_ref < vtype > &v); + inline vtype4(const vtype4_wxyz_ref < vtype > &v); + inline vtype4(const vtype4_wxyw_ref < vtype > &v); + inline vtype4(const vtype4_wxzx_ref < vtype > &v); + inline vtype4(const vtype4_wxzy_ref < vtype > &v); + inline vtype4(const vtype4_wxzz_ref < vtype > &v); + inline vtype4(const vtype4_wxzw_ref < vtype > &v); + inline vtype4(const vtype4_wxwx_ref < vtype > &v); + inline vtype4(const vtype4_wxwy_ref < vtype > &v); + inline vtype4(const vtype4_wxwz_ref < vtype > &v); + inline vtype4(const vtype4_wxww_ref < vtype > &v); + inline vtype4(const vtype4_wyxx_ref < vtype > &v); + inline vtype4(const vtype4_wyxy_ref < vtype > &v); + inline vtype4(const vtype4_wyxz_ref < vtype > &v); + inline vtype4(const vtype4_wyxw_ref < vtype > &v); + inline vtype4(const vtype4_wyyx_ref < vtype > &v); + inline vtype4(const vtype4_wyyy_ref < vtype > &v); + inline vtype4(const vtype4_wyyz_ref < vtype > &v); + inline vtype4(const vtype4_wyyw_ref < vtype > &v); + inline vtype4(const vtype4_wyzx_ref < vtype > &v); + inline vtype4(const vtype4_wyzy_ref < vtype > &v); + inline vtype4(const vtype4_wyzz_ref < vtype > &v); + inline vtype4(const vtype4_wyzw_ref < vtype > &v); + inline vtype4(const vtype4_wywx_ref < vtype > &v); + inline vtype4(const vtype4_wywy_ref < vtype > &v); + inline vtype4(const vtype4_wywz_ref < vtype > &v); + inline vtype4(const vtype4_wyww_ref < vtype > &v); + inline vtype4(const vtype4_wzxx_ref < vtype > &v); + inline vtype4(const vtype4_wzxy_ref < vtype > &v); + inline vtype4(const vtype4_wzxz_ref < vtype > &v); + inline vtype4(const vtype4_wzxw_ref < vtype > &v); + inline vtype4(const vtype4_wzyx_ref < vtype > &v); + inline vtype4(const vtype4_wzyy_ref < vtype > &v); + inline vtype4(const vtype4_wzyz_ref < vtype > &v); + inline vtype4(const vtype4_wzyw_ref < vtype > &v); + inline vtype4(const vtype4_wzzx_ref < vtype > &v); + inline vtype4(const vtype4_wzzy_ref < vtype > &v); + inline vtype4(const vtype4_wzzz_ref < vtype > &v); + inline vtype4(const vtype4_wzzw_ref < vtype > &v); + inline vtype4(const vtype4_wzwx_ref < vtype > &v); + inline vtype4(const vtype4_wzwy_ref < vtype > &v); + inline vtype4(const vtype4_wzwz_ref < vtype > &v); + inline vtype4(const vtype4_wzww_ref < vtype > &v); + inline vtype4(const vtype4_wwxx_ref < vtype > &v); + inline vtype4(const vtype4_wwxy_ref < vtype > &v); + inline vtype4(const vtype4_wwxz_ref < vtype > &v); + inline vtype4(const vtype4_wwxw_ref < vtype > &v); + inline vtype4(const vtype4_wwyx_ref < vtype > &v); + inline vtype4(const vtype4_wwyy_ref < vtype > &v); + inline vtype4(const vtype4_wwyz_ref < vtype > &v); + inline vtype4(const vtype4_wwyw_ref < vtype > &v); + inline vtype4(const vtype4_wwzx_ref < vtype > &v); + inline vtype4(const vtype4_wwzy_ref < vtype > &v); + inline vtype4(const vtype4_wwzz_ref < vtype > &v); + inline vtype4(const vtype4_wwzw_ref < vtype > &v); + inline vtype4(const vtype4_wwwx_ref < vtype > &v); + inline vtype4(const vtype4_wwwy_ref < vtype > &v); + inline vtype4(const vtype4_wwwz_ref < vtype > &v); + inline vtype4(const vtype4_wwww_ref < vtype > &v); + vtype4_xx_ref < vtype > xx() + { + return vtype4_xx_ref < vtype > (this); + } + vtype4_xy_ref < vtype > xy() + { + return vtype4_xy_ref < vtype > (this); + } + vtype4_xz_ref < vtype > xz() + { + return vtype4_xz_ref < vtype > (this); + } + vtype4_xw_ref < vtype > xw() + { + return vtype4_xw_ref < vtype > (this); + } + vtype4_yx_ref < vtype > yx() + { + return vtype4_yx_ref < vtype > (this); + } + vtype4_yy_ref < vtype > yy() + { + return vtype4_yy_ref < vtype > (this); + } + vtype4_yz_ref < vtype > yz() + { + return vtype4_yz_ref < vtype > (this); + } + vtype4_yw_ref < vtype > yw() + { + return vtype4_yw_ref < vtype > (this); + } + vtype4_zx_ref < vtype > zx() + { + return vtype4_zx_ref < vtype > (this); + } + vtype4_zy_ref < vtype > zy() + { + return vtype4_zy_ref < vtype > (this); + } + vtype4_zz_ref < vtype > zz() + { + return vtype4_zz_ref < vtype > (this); + } + vtype4_zw_ref < vtype > zw() + { + return vtype4_zw_ref < vtype > (this); + } + vtype4_wx_ref < vtype > wx() + { + return vtype4_wx_ref < vtype > (this); + } + vtype4_wy_ref < vtype > wy() + { + return vtype4_wy_ref < vtype > (this); + } + vtype4_wz_ref < vtype > wz() + { + return vtype4_wz_ref < vtype > (this); + } + vtype4_ww_ref < vtype > ww() + { + return vtype4_ww_ref < vtype > (this); + } + vtype4_xxx_ref < vtype > xxx() + { + return vtype4_xxx_ref < vtype > (this); + } + vtype4_xxy_ref < vtype > xxy() + { + return vtype4_xxy_ref < vtype > (this); + } + vtype4_xxz_ref < vtype > xxz() + { + return vtype4_xxz_ref < vtype > (this); + } + vtype4_xxw_ref < vtype > xxw() + { + return vtype4_xxw_ref < vtype > (this); + } + vtype4_xyx_ref < vtype > xyx() + { + return vtype4_xyx_ref < vtype > (this); + } + vtype4_xyy_ref < vtype > xyy() + { + return vtype4_xyy_ref < vtype > (this); + } + vtype4_xyz_ref < vtype > xyz() + { + return vtype4_xyz_ref < vtype > (this); + } + vtype4_xyw_ref < vtype > xyw() + { + return vtype4_xyw_ref < vtype > (this); + } + vtype4_xzx_ref < vtype > xzx() + { + return vtype4_xzx_ref < vtype > (this); + } + vtype4_xzy_ref < vtype > xzy() + { + return vtype4_xzy_ref < vtype > (this); + } + vtype4_xzz_ref < vtype > xzz() + { + return vtype4_xzz_ref < vtype > (this); + } + vtype4_xzw_ref < vtype > xzw() + { + return vtype4_xzw_ref < vtype > (this); + } + vtype4_xwx_ref < vtype > xwx() + { + return vtype4_xwx_ref < vtype > (this); + } + vtype4_xwy_ref < vtype > xwy() + { + return vtype4_xwy_ref < vtype > (this); + } + vtype4_xwz_ref < vtype > xwz() + { + return vtype4_xwz_ref < vtype > (this); + } + vtype4_xww_ref < vtype > xww() + { + return vtype4_xww_ref < vtype > (this); + } + vtype4_yxx_ref < vtype > yxx() + { + return vtype4_yxx_ref < vtype > (this); + } + vtype4_yxy_ref < vtype > yxy() + { + return vtype4_yxy_ref < vtype > (this); + } + vtype4_yxz_ref < vtype > yxz() + { + return vtype4_yxz_ref < vtype > (this); + } + vtype4_yxw_ref < vtype > yxw() + { + return vtype4_yxw_ref < vtype > (this); + } + vtype4_yyx_ref < vtype > yyx() + { + return vtype4_yyx_ref < vtype > (this); + } + vtype4_yyy_ref < vtype > yyy() + { + return vtype4_yyy_ref < vtype > (this); + } + vtype4_yyz_ref < vtype > yyz() + { + return vtype4_yyz_ref < vtype > (this); + } + vtype4_yyw_ref < vtype > yyw() + { + return vtype4_yyw_ref < vtype > (this); + } + vtype4_yzx_ref < vtype > yzx() + { + return vtype4_yzx_ref < vtype > (this); + } + vtype4_yzy_ref < vtype > yzy() + { + return vtype4_yzy_ref < vtype > (this); + } + vtype4_yzz_ref < vtype > yzz() + { + return vtype4_yzz_ref < vtype > (this); + } + vtype4_yzw_ref < vtype > yzw() + { + return vtype4_yzw_ref < vtype > (this); + } + vtype4_ywx_ref < vtype > ywx() + { + return vtype4_ywx_ref < vtype > (this); + } + vtype4_ywy_ref < vtype > ywy() + { + return vtype4_ywy_ref < vtype > (this); + } + vtype4_ywz_ref < vtype > ywz() + { + return vtype4_ywz_ref < vtype > (this); + } + vtype4_yww_ref < vtype > yww() + { + return vtype4_yww_ref < vtype > (this); + } + vtype4_zxx_ref < vtype > zxx() + { + return vtype4_zxx_ref < vtype > (this); + } + vtype4_zxy_ref < vtype > zxy() + { + return vtype4_zxy_ref < vtype > (this); + } + vtype4_zxz_ref < vtype > zxz() + { + return vtype4_zxz_ref < vtype > (this); + } + vtype4_zxw_ref < vtype > zxw() + { + return vtype4_zxw_ref < vtype > (this); + } + vtype4_zyx_ref < vtype > zyx() + { + return vtype4_zyx_ref < vtype > (this); + } + vtype4_zyy_ref < vtype > zyy() + { + return vtype4_zyy_ref < vtype > (this); + } + vtype4_zyz_ref < vtype > zyz() + { + return vtype4_zyz_ref < vtype > (this); + } + vtype4_zyw_ref < vtype > zyw() + { + return vtype4_zyw_ref < vtype > (this); + } + vtype4_zzx_ref < vtype > zzx() + { + return vtype4_zzx_ref < vtype > (this); + } + vtype4_zzy_ref < vtype > zzy() + { + return vtype4_zzy_ref < vtype > (this); + } + vtype4_zzz_ref < vtype > zzz() + { + return vtype4_zzz_ref < vtype > (this); + } + vtype4_zzw_ref < vtype > zzw() + { + return vtype4_zzw_ref < vtype > (this); + } + vtype4_zwx_ref < vtype > zwx() + { + return vtype4_zwx_ref < vtype > (this); + } + vtype4_zwy_ref < vtype > zwy() + { + return vtype4_zwy_ref < vtype > (this); + } + vtype4_zwz_ref < vtype > zwz() + { + return vtype4_zwz_ref < vtype > (this); + } + vtype4_zww_ref < vtype > zww() + { + return vtype4_zww_ref < vtype > (this); + } + vtype4_wxx_ref < vtype > wxx() + { + return vtype4_wxx_ref < vtype > (this); + } + vtype4_wxy_ref < vtype > wxy() + { + return vtype4_wxy_ref < vtype > (this); + } + vtype4_wxz_ref < vtype > wxz() + { + return vtype4_wxz_ref < vtype > (this); + } + vtype4_wxw_ref < vtype > wxw() + { + return vtype4_wxw_ref < vtype > (this); + } + vtype4_wyx_ref < vtype > wyx() + { + return vtype4_wyx_ref < vtype > (this); + } + vtype4_wyy_ref < vtype > wyy() + { + return vtype4_wyy_ref < vtype > (this); + } + vtype4_wyz_ref < vtype > wyz() + { + return vtype4_wyz_ref < vtype > (this); + } + vtype4_wyw_ref < vtype > wyw() + { + return vtype4_wyw_ref < vtype > (this); + } + vtype4_wzx_ref < vtype > wzx() + { + return vtype4_wzx_ref < vtype > (this); + } + vtype4_wzy_ref < vtype > wzy() + { + return vtype4_wzy_ref < vtype > (this); + } + vtype4_wzz_ref < vtype > wzz() + { + return vtype4_wzz_ref < vtype > (this); + } + vtype4_wzw_ref < vtype > wzw() + { + return vtype4_wzw_ref < vtype > (this); + } + vtype4_wwx_ref < vtype > wwx() + { + return vtype4_wwx_ref < vtype > (this); + } + vtype4_wwy_ref < vtype > wwy() + { + return vtype4_wwy_ref < vtype > (this); + } + vtype4_wwz_ref < vtype > wwz() + { + return vtype4_wwz_ref < vtype > (this); + } + vtype4_www_ref < vtype > www() + { + return vtype4_www_ref < vtype > (this); + } + vtype4_xxxx_ref < vtype > xxxx() + { + return vtype4_xxxx_ref < vtype > (this); + } + vtype4_xxxy_ref < vtype > xxxy() + { + return vtype4_xxxy_ref < vtype > (this); + } + vtype4_xxxz_ref < vtype > xxxz() + { + return vtype4_xxxz_ref < vtype > (this); + } + vtype4_xxxw_ref < vtype > xxxw() + { + return vtype4_xxxw_ref < vtype > (this); + } + vtype4_xxyx_ref < vtype > xxyx() + { + return vtype4_xxyx_ref < vtype > (this); + } + vtype4_xxyy_ref < vtype > xxyy() + { + return vtype4_xxyy_ref < vtype > (this); + } + vtype4_xxyz_ref < vtype > xxyz() + { + return vtype4_xxyz_ref < vtype > (this); + } + vtype4_xxyw_ref < vtype > xxyw() + { + return vtype4_xxyw_ref < vtype > (this); + } + vtype4_xxzx_ref < vtype > xxzx() + { + return vtype4_xxzx_ref < vtype > (this); + } + vtype4_xxzy_ref < vtype > xxzy() + { + return vtype4_xxzy_ref < vtype > (this); + } + vtype4_xxzz_ref < vtype > xxzz() + { + return vtype4_xxzz_ref < vtype > (this); + } + vtype4_xxzw_ref < vtype > xxzw() + { + return vtype4_xxzw_ref < vtype > (this); + } + vtype4_xxwx_ref < vtype > xxwx() + { + return vtype4_xxwx_ref < vtype > (this); + } + vtype4_xxwy_ref < vtype > xxwy() + { + return vtype4_xxwy_ref < vtype > (this); + } + vtype4_xxwz_ref < vtype > xxwz() + { + return vtype4_xxwz_ref < vtype > (this); + } + vtype4_xxww_ref < vtype > xxww() + { + return vtype4_xxww_ref < vtype > (this); + } + vtype4_xyxx_ref < vtype > xyxx() + { + return vtype4_xyxx_ref < vtype > (this); + } + vtype4_xyxy_ref < vtype > xyxy() + { + return vtype4_xyxy_ref < vtype > (this); + } + vtype4_xyxz_ref < vtype > xyxz() + { + return vtype4_xyxz_ref < vtype > (this); + } + vtype4_xyxw_ref < vtype > xyxw() + { + return vtype4_xyxw_ref < vtype > (this); + } + vtype4_xyyx_ref < vtype > xyyx() + { + return vtype4_xyyx_ref < vtype > (this); + } + vtype4_xyyy_ref < vtype > xyyy() + { + return vtype4_xyyy_ref < vtype > (this); + } + vtype4_xyyz_ref < vtype > xyyz() + { + return vtype4_xyyz_ref < vtype > (this); + } + vtype4_xyyw_ref < vtype > xyyw() + { + return vtype4_xyyw_ref < vtype > (this); + } + vtype4_xyzx_ref < vtype > xyzx() + { + return vtype4_xyzx_ref < vtype > (this); + } + vtype4_xyzy_ref < vtype > xyzy() + { + return vtype4_xyzy_ref < vtype > (this); + } + vtype4_xyzz_ref < vtype > xyzz() + { + return vtype4_xyzz_ref < vtype > (this); + } + vtype4_xyzw_ref < vtype > xyzw() + { + return vtype4_xyzw_ref < vtype > (this); + } + vtype4_xywx_ref < vtype > xywx() + { + return vtype4_xywx_ref < vtype > (this); + } + vtype4_xywy_ref < vtype > xywy() + { + return vtype4_xywy_ref < vtype > (this); + } + vtype4_xywz_ref < vtype > xywz() + { + return vtype4_xywz_ref < vtype > (this); + } + vtype4_xyww_ref < vtype > xyww() + { + return vtype4_xyww_ref < vtype > (this); + } + vtype4_xzxx_ref < vtype > xzxx() + { + return vtype4_xzxx_ref < vtype > (this); + } + vtype4_xzxy_ref < vtype > xzxy() + { + return vtype4_xzxy_ref < vtype > (this); + } + vtype4_xzxz_ref < vtype > xzxz() + { + return vtype4_xzxz_ref < vtype > (this); + } + vtype4_xzxw_ref < vtype > xzxw() + { + return vtype4_xzxw_ref < vtype > (this); + } + vtype4_xzyx_ref < vtype > xzyx() + { + return vtype4_xzyx_ref < vtype > (this); + } + vtype4_xzyy_ref < vtype > xzyy() + { + return vtype4_xzyy_ref < vtype > (this); + } + vtype4_xzyz_ref < vtype > xzyz() + { + return vtype4_xzyz_ref < vtype > (this); + } + vtype4_xzyw_ref < vtype > xzyw() + { + return vtype4_xzyw_ref < vtype > (this); + } + vtype4_xzzx_ref < vtype > xzzx() + { + return vtype4_xzzx_ref < vtype > (this); + } + vtype4_xzzy_ref < vtype > xzzy() + { + return vtype4_xzzy_ref < vtype > (this); + } + vtype4_xzzz_ref < vtype > xzzz() + { + return vtype4_xzzz_ref < vtype > (this); + } + vtype4_xzzw_ref < vtype > xzzw() + { + return vtype4_xzzw_ref < vtype > (this); + } + vtype4_xzwx_ref < vtype > xzwx() + { + return vtype4_xzwx_ref < vtype > (this); + } + vtype4_xzwy_ref < vtype > xzwy() + { + return vtype4_xzwy_ref < vtype > (this); + } + vtype4_xzwz_ref < vtype > xzwz() + { + return vtype4_xzwz_ref < vtype > (this); + } + vtype4_xzww_ref < vtype > xzww() + { + return vtype4_xzww_ref < vtype > (this); + } + vtype4_xwxx_ref < vtype > xwxx() + { + return vtype4_xwxx_ref < vtype > (this); + } + vtype4_xwxy_ref < vtype > xwxy() + { + return vtype4_xwxy_ref < vtype > (this); + } + vtype4_xwxz_ref < vtype > xwxz() + { + return vtype4_xwxz_ref < vtype > (this); + } + vtype4_xwxw_ref < vtype > xwxw() + { + return vtype4_xwxw_ref < vtype > (this); + } + vtype4_xwyx_ref < vtype > xwyx() + { + return vtype4_xwyx_ref < vtype > (this); + } + vtype4_xwyy_ref < vtype > xwyy() + { + return vtype4_xwyy_ref < vtype > (this); + } + vtype4_xwyz_ref < vtype > xwyz() + { + return vtype4_xwyz_ref < vtype > (this); + } + vtype4_xwyw_ref < vtype > xwyw() + { + return vtype4_xwyw_ref < vtype > (this); + } + vtype4_xwzx_ref < vtype > xwzx() + { + return vtype4_xwzx_ref < vtype > (this); + } + vtype4_xwzy_ref < vtype > xwzy() + { + return vtype4_xwzy_ref < vtype > (this); + } + vtype4_xwzz_ref < vtype > xwzz() + { + return vtype4_xwzz_ref < vtype > (this); + } + vtype4_xwzw_ref < vtype > xwzw() + { + return vtype4_xwzw_ref < vtype > (this); + } + vtype4_xwwx_ref < vtype > xwwx() + { + return vtype4_xwwx_ref < vtype > (this); + } + vtype4_xwwy_ref < vtype > xwwy() + { + return vtype4_xwwy_ref < vtype > (this); + } + vtype4_xwwz_ref < vtype > xwwz() + { + return vtype4_xwwz_ref < vtype > (this); + } + vtype4_xwww_ref < vtype > xwww() + { + return vtype4_xwww_ref < vtype > (this); + } + vtype4_yxxx_ref < vtype > yxxx() + { + return vtype4_yxxx_ref < vtype > (this); + } + vtype4_yxxy_ref < vtype > yxxy() + { + return vtype4_yxxy_ref < vtype > (this); + } + vtype4_yxxz_ref < vtype > yxxz() + { + return vtype4_yxxz_ref < vtype > (this); + } + vtype4_yxxw_ref < vtype > yxxw() + { + return vtype4_yxxw_ref < vtype > (this); + } + vtype4_yxyx_ref < vtype > yxyx() + { + return vtype4_yxyx_ref < vtype > (this); + } + vtype4_yxyy_ref < vtype > yxyy() + { + return vtype4_yxyy_ref < vtype > (this); + } + vtype4_yxyz_ref < vtype > yxyz() + { + return vtype4_yxyz_ref < vtype > (this); + } + vtype4_yxyw_ref < vtype > yxyw() + { + return vtype4_yxyw_ref < vtype > (this); + } + vtype4_yxzx_ref < vtype > yxzx() + { + return vtype4_yxzx_ref < vtype > (this); + } + vtype4_yxzy_ref < vtype > yxzy() + { + return vtype4_yxzy_ref < vtype > (this); + } + vtype4_yxzz_ref < vtype > yxzz() + { + return vtype4_yxzz_ref < vtype > (this); + } + vtype4_yxzw_ref < vtype > yxzw() + { + return vtype4_yxzw_ref < vtype > (this); + } + vtype4_yxwx_ref < vtype > yxwx() + { + return vtype4_yxwx_ref < vtype > (this); + } + vtype4_yxwy_ref < vtype > yxwy() + { + return vtype4_yxwy_ref < vtype > (this); + } + vtype4_yxwz_ref < vtype > yxwz() + { + return vtype4_yxwz_ref < vtype > (this); + } + vtype4_yxww_ref < vtype > yxww() + { + return vtype4_yxww_ref < vtype > (this); + } + vtype4_yyxx_ref < vtype > yyxx() + { + return vtype4_yyxx_ref < vtype > (this); + } + vtype4_yyxy_ref < vtype > yyxy() + { + return vtype4_yyxy_ref < vtype > (this); + } + vtype4_yyxz_ref < vtype > yyxz() + { + return vtype4_yyxz_ref < vtype > (this); + } + vtype4_yyxw_ref < vtype > yyxw() + { + return vtype4_yyxw_ref < vtype > (this); + } + vtype4_yyyx_ref < vtype > yyyx() + { + return vtype4_yyyx_ref < vtype > (this); + } + vtype4_yyyy_ref < vtype > yyyy() + { + return vtype4_yyyy_ref < vtype > (this); + } + vtype4_yyyz_ref < vtype > yyyz() + { + return vtype4_yyyz_ref < vtype > (this); + } + vtype4_yyyw_ref < vtype > yyyw() + { + return vtype4_yyyw_ref < vtype > (this); + } + vtype4_yyzx_ref < vtype > yyzx() + { + return vtype4_yyzx_ref < vtype > (this); + } + vtype4_yyzy_ref < vtype > yyzy() + { + return vtype4_yyzy_ref < vtype > (this); + } + vtype4_yyzz_ref < vtype > yyzz() + { + return vtype4_yyzz_ref < vtype > (this); + } + vtype4_yyzw_ref < vtype > yyzw() + { + return vtype4_yyzw_ref < vtype > (this); + } + vtype4_yywx_ref < vtype > yywx() + { + return vtype4_yywx_ref < vtype > (this); + } + vtype4_yywy_ref < vtype > yywy() + { + return vtype4_yywy_ref < vtype > (this); + } + vtype4_yywz_ref < vtype > yywz() + { + return vtype4_yywz_ref < vtype > (this); + } + vtype4_yyww_ref < vtype > yyww() + { + return vtype4_yyww_ref < vtype > (this); + } + vtype4_yzxx_ref < vtype > yzxx() + { + return vtype4_yzxx_ref < vtype > (this); + } + vtype4_yzxy_ref < vtype > yzxy() + { + return vtype4_yzxy_ref < vtype > (this); + } + vtype4_yzxz_ref < vtype > yzxz() + { + return vtype4_yzxz_ref < vtype > (this); + } + vtype4_yzxw_ref < vtype > yzxw() + { + return vtype4_yzxw_ref < vtype > (this); + } + vtype4_yzyx_ref < vtype > yzyx() + { + return vtype4_yzyx_ref < vtype > (this); + } + vtype4_yzyy_ref < vtype > yzyy() + { + return vtype4_yzyy_ref < vtype > (this); + } + vtype4_yzyz_ref < vtype > yzyz() + { + return vtype4_yzyz_ref < vtype > (this); + } + vtype4_yzyw_ref < vtype > yzyw() + { + return vtype4_yzyw_ref < vtype > (this); + } + vtype4_yzzx_ref < vtype > yzzx() + { + return vtype4_yzzx_ref < vtype > (this); + } + vtype4_yzzy_ref < vtype > yzzy() + { + return vtype4_yzzy_ref < vtype > (this); + } + vtype4_yzzz_ref < vtype > yzzz() + { + return vtype4_yzzz_ref < vtype > (this); + } + vtype4_yzzw_ref < vtype > yzzw() + { + return vtype4_yzzw_ref < vtype > (this); + } + vtype4_yzwx_ref < vtype > yzwx() + { + return vtype4_yzwx_ref < vtype > (this); + } + vtype4_yzwy_ref < vtype > yzwy() + { + return vtype4_yzwy_ref < vtype > (this); + } + vtype4_yzwz_ref < vtype > yzwz() + { + return vtype4_yzwz_ref < vtype > (this); + } + vtype4_yzww_ref < vtype > yzww() + { + return vtype4_yzww_ref < vtype > (this); + } + vtype4_ywxx_ref < vtype > ywxx() + { + return vtype4_ywxx_ref < vtype > (this); + } + vtype4_ywxy_ref < vtype > ywxy() + { + return vtype4_ywxy_ref < vtype > (this); + } + vtype4_ywxz_ref < vtype > ywxz() + { + return vtype4_ywxz_ref < vtype > (this); + } + vtype4_ywxw_ref < vtype > ywxw() + { + return vtype4_ywxw_ref < vtype > (this); + } + vtype4_ywyx_ref < vtype > ywyx() + { + return vtype4_ywyx_ref < vtype > (this); + } + vtype4_ywyy_ref < vtype > ywyy() + { + return vtype4_ywyy_ref < vtype > (this); + } + vtype4_ywyz_ref < vtype > ywyz() + { + return vtype4_ywyz_ref < vtype > (this); + } + vtype4_ywyw_ref < vtype > ywyw() + { + return vtype4_ywyw_ref < vtype > (this); + } + vtype4_ywzx_ref < vtype > ywzx() + { + return vtype4_ywzx_ref < vtype > (this); + } + vtype4_ywzy_ref < vtype > ywzy() + { + return vtype4_ywzy_ref < vtype > (this); + } + vtype4_ywzz_ref < vtype > ywzz() + { + return vtype4_ywzz_ref < vtype > (this); + } + vtype4_ywzw_ref < vtype > ywzw() + { + return vtype4_ywzw_ref < vtype > (this); + } + vtype4_ywwx_ref < vtype > ywwx() + { + return vtype4_ywwx_ref < vtype > (this); + } + vtype4_ywwy_ref < vtype > ywwy() + { + return vtype4_ywwy_ref < vtype > (this); + } + vtype4_ywwz_ref < vtype > ywwz() + { + return vtype4_ywwz_ref < vtype > (this); + } + vtype4_ywww_ref < vtype > ywww() + { + return vtype4_ywww_ref < vtype > (this); + } + vtype4_zxxx_ref < vtype > zxxx() + { + return vtype4_zxxx_ref < vtype > (this); + } + vtype4_zxxy_ref < vtype > zxxy() + { + return vtype4_zxxy_ref < vtype > (this); + } + vtype4_zxxz_ref < vtype > zxxz() + { + return vtype4_zxxz_ref < vtype > (this); + } + vtype4_zxxw_ref < vtype > zxxw() + { + return vtype4_zxxw_ref < vtype > (this); + } + vtype4_zxyx_ref < vtype > zxyx() + { + return vtype4_zxyx_ref < vtype > (this); + } + vtype4_zxyy_ref < vtype > zxyy() + { + return vtype4_zxyy_ref < vtype > (this); + } + vtype4_zxyz_ref < vtype > zxyz() + { + return vtype4_zxyz_ref < vtype > (this); + } + vtype4_zxyw_ref < vtype > zxyw() + { + return vtype4_zxyw_ref < vtype > (this); + } + vtype4_zxzx_ref < vtype > zxzx() + { + return vtype4_zxzx_ref < vtype > (this); + } + vtype4_zxzy_ref < vtype > zxzy() + { + return vtype4_zxzy_ref < vtype > (this); + } + vtype4_zxzz_ref < vtype > zxzz() + { + return vtype4_zxzz_ref < vtype > (this); + } + vtype4_zxzw_ref < vtype > zxzw() + { + return vtype4_zxzw_ref < vtype > (this); + } + vtype4_zxwx_ref < vtype > zxwx() + { + return vtype4_zxwx_ref < vtype > (this); + } + vtype4_zxwy_ref < vtype > zxwy() + { + return vtype4_zxwy_ref < vtype > (this); + } + vtype4_zxwz_ref < vtype > zxwz() + { + return vtype4_zxwz_ref < vtype > (this); + } + vtype4_zxww_ref < vtype > zxww() + { + return vtype4_zxww_ref < vtype > (this); + } + vtype4_zyxx_ref < vtype > zyxx() + { + return vtype4_zyxx_ref < vtype > (this); + } + vtype4_zyxy_ref < vtype > zyxy() + { + return vtype4_zyxy_ref < vtype > (this); + } + vtype4_zyxz_ref < vtype > zyxz() + { + return vtype4_zyxz_ref < vtype > (this); + } + vtype4_zyxw_ref < vtype > zyxw() + { + return vtype4_zyxw_ref < vtype > (this); + } + vtype4_zyyx_ref < vtype > zyyx() + { + return vtype4_zyyx_ref < vtype > (this); + } + vtype4_zyyy_ref < vtype > zyyy() + { + return vtype4_zyyy_ref < vtype > (this); + } + vtype4_zyyz_ref < vtype > zyyz() + { + return vtype4_zyyz_ref < vtype > (this); + } + vtype4_zyyw_ref < vtype > zyyw() + { + return vtype4_zyyw_ref < vtype > (this); + } + vtype4_zyzx_ref < vtype > zyzx() + { + return vtype4_zyzx_ref < vtype > (this); + } + vtype4_zyzy_ref < vtype > zyzy() + { + return vtype4_zyzy_ref < vtype > (this); + } + vtype4_zyzz_ref < vtype > zyzz() + { + return vtype4_zyzz_ref < vtype > (this); + } + vtype4_zyzw_ref < vtype > zyzw() + { + return vtype4_zyzw_ref < vtype > (this); + } + vtype4_zywx_ref < vtype > zywx() + { + return vtype4_zywx_ref < vtype > (this); + } + vtype4_zywy_ref < vtype > zywy() + { + return vtype4_zywy_ref < vtype > (this); + } + vtype4_zywz_ref < vtype > zywz() + { + return vtype4_zywz_ref < vtype > (this); + } + vtype4_zyww_ref < vtype > zyww() + { + return vtype4_zyww_ref < vtype > (this); + } + vtype4_zzxx_ref < vtype > zzxx() + { + return vtype4_zzxx_ref < vtype > (this); + } + vtype4_zzxy_ref < vtype > zzxy() + { + return vtype4_zzxy_ref < vtype > (this); + } + vtype4_zzxz_ref < vtype > zzxz() + { + return vtype4_zzxz_ref < vtype > (this); + } + vtype4_zzxw_ref < vtype > zzxw() + { + return vtype4_zzxw_ref < vtype > (this); + } + vtype4_zzyx_ref < vtype > zzyx() + { + return vtype4_zzyx_ref < vtype > (this); + } + vtype4_zzyy_ref < vtype > zzyy() + { + return vtype4_zzyy_ref < vtype > (this); + } + vtype4_zzyz_ref < vtype > zzyz() + { + return vtype4_zzyz_ref < vtype > (this); + } + vtype4_zzyw_ref < vtype > zzyw() + { + return vtype4_zzyw_ref < vtype > (this); + } + vtype4_zzzx_ref < vtype > zzzx() + { + return vtype4_zzzx_ref < vtype > (this); + } + vtype4_zzzy_ref < vtype > zzzy() + { + return vtype4_zzzy_ref < vtype > (this); + } + vtype4_zzzz_ref < vtype > zzzz() + { + return vtype4_zzzz_ref < vtype > (this); + } + vtype4_zzzw_ref < vtype > zzzw() + { + return vtype4_zzzw_ref < vtype > (this); + } + vtype4_zzwx_ref < vtype > zzwx() + { + return vtype4_zzwx_ref < vtype > (this); + } + vtype4_zzwy_ref < vtype > zzwy() + { + return vtype4_zzwy_ref < vtype > (this); + } + vtype4_zzwz_ref < vtype > zzwz() + { + return vtype4_zzwz_ref < vtype > (this); + } + vtype4_zzww_ref < vtype > zzww() + { + return vtype4_zzww_ref < vtype > (this); + } + vtype4_zwxx_ref < vtype > zwxx() + { + return vtype4_zwxx_ref < vtype > (this); + } + vtype4_zwxy_ref < vtype > zwxy() + { + return vtype4_zwxy_ref < vtype > (this); + } + vtype4_zwxz_ref < vtype > zwxz() + { + return vtype4_zwxz_ref < vtype > (this); + } + vtype4_zwxw_ref < vtype > zwxw() + { + return vtype4_zwxw_ref < vtype > (this); + } + vtype4_zwyx_ref < vtype > zwyx() + { + return vtype4_zwyx_ref < vtype > (this); + } + vtype4_zwyy_ref < vtype > zwyy() + { + return vtype4_zwyy_ref < vtype > (this); + } + vtype4_zwyz_ref < vtype > zwyz() + { + return vtype4_zwyz_ref < vtype > (this); + } + vtype4_zwyw_ref < vtype > zwyw() + { + return vtype4_zwyw_ref < vtype > (this); + } + vtype4_zwzx_ref < vtype > zwzx() + { + return vtype4_zwzx_ref < vtype > (this); + } + vtype4_zwzy_ref < vtype > zwzy() + { + return vtype4_zwzy_ref < vtype > (this); + } + vtype4_zwzz_ref < vtype > zwzz() + { + return vtype4_zwzz_ref < vtype > (this); + } + vtype4_zwzw_ref < vtype > zwzw() + { + return vtype4_zwzw_ref < vtype > (this); + } + vtype4_zwwx_ref < vtype > zwwx() + { + return vtype4_zwwx_ref < vtype > (this); + } + vtype4_zwwy_ref < vtype > zwwy() + { + return vtype4_zwwy_ref < vtype > (this); + } + vtype4_zwwz_ref < vtype > zwwz() + { + return vtype4_zwwz_ref < vtype > (this); + } + vtype4_zwww_ref < vtype > zwww() + { + return vtype4_zwww_ref < vtype > (this); + } + vtype4_wxxx_ref < vtype > wxxx() + { + return vtype4_wxxx_ref < vtype > (this); + } + vtype4_wxxy_ref < vtype > wxxy() + { + return vtype4_wxxy_ref < vtype > (this); + } + vtype4_wxxz_ref < vtype > wxxz() + { + return vtype4_wxxz_ref < vtype > (this); + } + vtype4_wxxw_ref < vtype > wxxw() + { + return vtype4_wxxw_ref < vtype > (this); + } + vtype4_wxyx_ref < vtype > wxyx() + { + return vtype4_wxyx_ref < vtype > (this); + } + vtype4_wxyy_ref < vtype > wxyy() + { + return vtype4_wxyy_ref < vtype > (this); + } + vtype4_wxyz_ref < vtype > wxyz() + { + return vtype4_wxyz_ref < vtype > (this); + } + vtype4_wxyw_ref < vtype > wxyw() + { + return vtype4_wxyw_ref < vtype > (this); + } + vtype4_wxzx_ref < vtype > wxzx() + { + return vtype4_wxzx_ref < vtype > (this); + } + vtype4_wxzy_ref < vtype > wxzy() + { + return vtype4_wxzy_ref < vtype > (this); + } + vtype4_wxzz_ref < vtype > wxzz() + { + return vtype4_wxzz_ref < vtype > (this); + } + vtype4_wxzw_ref < vtype > wxzw() + { + return vtype4_wxzw_ref < vtype > (this); + } + vtype4_wxwx_ref < vtype > wxwx() + { + return vtype4_wxwx_ref < vtype > (this); + } + vtype4_wxwy_ref < vtype > wxwy() + { + return vtype4_wxwy_ref < vtype > (this); + } + vtype4_wxwz_ref < vtype > wxwz() + { + return vtype4_wxwz_ref < vtype > (this); + } + vtype4_wxww_ref < vtype > wxww() + { + return vtype4_wxww_ref < vtype > (this); + } + vtype4_wyxx_ref < vtype > wyxx() + { + return vtype4_wyxx_ref < vtype > (this); + } + vtype4_wyxy_ref < vtype > wyxy() + { + return vtype4_wyxy_ref < vtype > (this); + } + vtype4_wyxz_ref < vtype > wyxz() + { + return vtype4_wyxz_ref < vtype > (this); + } + vtype4_wyxw_ref < vtype > wyxw() + { + return vtype4_wyxw_ref < vtype > (this); + } + vtype4_wyyx_ref < vtype > wyyx() + { + return vtype4_wyyx_ref < vtype > (this); + } + vtype4_wyyy_ref < vtype > wyyy() + { + return vtype4_wyyy_ref < vtype > (this); + } + vtype4_wyyz_ref < vtype > wyyz() + { + return vtype4_wyyz_ref < vtype > (this); + } + vtype4_wyyw_ref < vtype > wyyw() + { + return vtype4_wyyw_ref < vtype > (this); + } + vtype4_wyzx_ref < vtype > wyzx() + { + return vtype4_wyzx_ref < vtype > (this); + } + vtype4_wyzy_ref < vtype > wyzy() + { + return vtype4_wyzy_ref < vtype > (this); + } + vtype4_wyzz_ref < vtype > wyzz() + { + return vtype4_wyzz_ref < vtype > (this); + } + vtype4_wyzw_ref < vtype > wyzw() + { + return vtype4_wyzw_ref < vtype > (this); + } + vtype4_wywx_ref < vtype > wywx() + { + return vtype4_wywx_ref < vtype > (this); + } + vtype4_wywy_ref < vtype > wywy() + { + return vtype4_wywy_ref < vtype > (this); + } + vtype4_wywz_ref < vtype > wywz() + { + return vtype4_wywz_ref < vtype > (this); + } + vtype4_wyww_ref < vtype > wyww() + { + return vtype4_wyww_ref < vtype > (this); + } + vtype4_wzxx_ref < vtype > wzxx() + { + return vtype4_wzxx_ref < vtype > (this); + } + vtype4_wzxy_ref < vtype > wzxy() + { + return vtype4_wzxy_ref < vtype > (this); + } + vtype4_wzxz_ref < vtype > wzxz() + { + return vtype4_wzxz_ref < vtype > (this); + } + vtype4_wzxw_ref < vtype > wzxw() + { + return vtype4_wzxw_ref < vtype > (this); + } + vtype4_wzyx_ref < vtype > wzyx() + { + return vtype4_wzyx_ref < vtype > (this); + } + vtype4_wzyy_ref < vtype > wzyy() + { + return vtype4_wzyy_ref < vtype > (this); + } + vtype4_wzyz_ref < vtype > wzyz() + { + return vtype4_wzyz_ref < vtype > (this); + } + vtype4_wzyw_ref < vtype > wzyw() + { + return vtype4_wzyw_ref < vtype > (this); + } + vtype4_wzzx_ref < vtype > wzzx() + { + return vtype4_wzzx_ref < vtype > (this); + } + vtype4_wzzy_ref < vtype > wzzy() + { + return vtype4_wzzy_ref < vtype > (this); + } + vtype4_wzzz_ref < vtype > wzzz() + { + return vtype4_wzzz_ref < vtype > (this); + } + vtype4_wzzw_ref < vtype > wzzw() + { + return vtype4_wzzw_ref < vtype > (this); + } + vtype4_wzwx_ref < vtype > wzwx() + { + return vtype4_wzwx_ref < vtype > (this); + } + vtype4_wzwy_ref < vtype > wzwy() + { + return vtype4_wzwy_ref < vtype > (this); + } + vtype4_wzwz_ref < vtype > wzwz() + { + return vtype4_wzwz_ref < vtype > (this); + } + vtype4_wzww_ref < vtype > wzww() + { + return vtype4_wzww_ref < vtype > (this); + } + vtype4_wwxx_ref < vtype > wwxx() + { + return vtype4_wwxx_ref < vtype > (this); + } + vtype4_wwxy_ref < vtype > wwxy() + { + return vtype4_wwxy_ref < vtype > (this); + } + vtype4_wwxz_ref < vtype > wwxz() + { + return vtype4_wwxz_ref < vtype > (this); + } + vtype4_wwxw_ref < vtype > wwxw() + { + return vtype4_wwxw_ref < vtype > (this); + } + vtype4_wwyx_ref < vtype > wwyx() + { + return vtype4_wwyx_ref < vtype > (this); + } + vtype4_wwyy_ref < vtype > wwyy() + { + return vtype4_wwyy_ref < vtype > (this); + } + vtype4_wwyz_ref < vtype > wwyz() + { + return vtype4_wwyz_ref < vtype > (this); + } + vtype4_wwyw_ref < vtype > wwyw() + { + return vtype4_wwyw_ref < vtype > (this); + } + vtype4_wwzx_ref < vtype > wwzx() + { + return vtype4_wwzx_ref < vtype > (this); + } + vtype4_wwzy_ref < vtype > wwzy() + { + return vtype4_wwzy_ref < vtype > (this); + } + vtype4_wwzz_ref < vtype > wwzz() + { + return vtype4_wwzz_ref < vtype > (this); + } + vtype4_wwzw_ref < vtype > wwzw() + { + return vtype4_wwzw_ref < vtype > (this); + } + vtype4_wwwx_ref < vtype > wwwx() + { + return vtype4_wwwx_ref < vtype > (this); + } + vtype4_wwwy_ref < vtype > wwwy() + { + return vtype4_wwwy_ref < vtype > (this); + } + vtype4_wwwz_ref < vtype > wwwz() + { + return vtype4_wwwz_ref < vtype > (this); + } + vtype4_wwww_ref < vtype > wwww() + { + return vtype4_wwww_ref < vtype > (this); + } +}; + +template < typename vtype > vtype2_xy_ref < vtype > &vtype2_xy_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + return *this; +} + +template < typename vtype > vtype2_yx_ref < vtype > &vtype2_yx_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + return *this; +} + +template < typename vtype > vtype3_xy_ref < vtype > &vtype3_xy_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + return *this; +} + +template < typename vtype > vtype3_xz_ref < vtype > &vtype3_xz_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + return *this; +} + +template < typename vtype > vtype3_yx_ref < vtype > &vtype3_yx_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + return *this; +} + +template < typename vtype > vtype3_yz_ref < vtype > &vtype3_yz_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + return *this; +} + +template < typename vtype > vtype3_zx_ref < vtype > &vtype3_zx_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + return *this; +} + +template < typename vtype > vtype3_zy_ref < vtype > &vtype3_zy_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + return *this; +} + +template < typename vtype > vtype3_xyz_ref < vtype > &vtype3_xyz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype3_xzy_ref < vtype > &vtype3_xzy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype3_yxz_ref < vtype > &vtype3_yxz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype3_yzx_ref < vtype > &vtype3_yzx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype3_zxy_ref < vtype > &vtype3_zxy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype3_zyx_ref < vtype > &vtype3_zyx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_xy_ref < vtype > &vtype4_xy_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + return *this; +} + +template < typename vtype > vtype4_xz_ref < vtype > &vtype4_xz_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + return *this; +} + +template < typename vtype > vtype4_xw_ref < vtype > &vtype4_xw_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->x = other.x; + v->w = other.y; + return *this; +} + +template < typename vtype > vtype4_yx_ref < vtype > &vtype4_yx_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + return *this; +} + +template < typename vtype > vtype4_yz_ref < vtype > &vtype4_yz_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + return *this; +} + +template < typename vtype > vtype4_yw_ref < vtype > &vtype4_yw_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->y = other.x; + v->w = other.y; + return *this; +} + +template < typename vtype > vtype4_zx_ref < vtype > &vtype4_zx_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + return *this; +} + +template < typename vtype > vtype4_zy_ref < vtype > &vtype4_zy_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + return *this; +} + +template < typename vtype > vtype4_zw_ref < vtype > &vtype4_zw_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->z = other.x; + v->w = other.y; + return *this; +} + +template < typename vtype > vtype4_wx_ref < vtype > &vtype4_wx_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->w = other.x; + v->x = other.y; + return *this; +} + +template < typename vtype > vtype4_wy_ref < vtype > &vtype4_wy_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->w = other.x; + v->y = other.y; + return *this; +} + +template < typename vtype > vtype4_wz_ref < vtype > &vtype4_wz_ref < vtype >::operator=(const vtype2 < vtype > &other) +{ + v->w = other.x; + v->z = other.y; + return *this; +} + +template < typename vtype > vtype4_xyz_ref < vtype > &vtype4_xyz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype4_xyw_ref < vtype > &vtype4_xyw_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + v->w = other.z; + return *this; +} + +template < typename vtype > vtype4_xzy_ref < vtype > &vtype4_xzy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype4_xzw_ref < vtype > &vtype4_xzw_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + v->w = other.z; + return *this; +} + +template < typename vtype > vtype4_xwy_ref < vtype > &vtype4_xwy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->w = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype4_xwz_ref < vtype > &vtype4_xwz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->x = other.x; + v->w = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype4_yxz_ref < vtype > &vtype4_yxz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype4_yxw_ref < vtype > &vtype4_yxw_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + v->w = other.z; + return *this; +} + +template < typename vtype > vtype4_yzx_ref < vtype > &vtype4_yzx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_yzw_ref < vtype > &vtype4_yzw_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + v->w = other.z; + return *this; +} + +template < typename vtype > vtype4_ywx_ref < vtype > &vtype4_ywx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->w = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_ywz_ref < vtype > &vtype4_ywz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->y = other.x; + v->w = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype4_zxy_ref < vtype > &vtype4_zxy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype4_zxw_ref < vtype > &vtype4_zxw_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + v->w = other.z; + return *this; +} + +template < typename vtype > vtype4_zyx_ref < vtype > &vtype4_zyx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_zyw_ref < vtype > &vtype4_zyw_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + v->w = other.z; + return *this; +} + +template < typename vtype > vtype4_zwx_ref < vtype > &vtype4_zwx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->w = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_zwy_ref < vtype > &vtype4_zwy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->z = other.x; + v->w = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype4_wxy_ref < vtype > &vtype4_wxy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->w = other.x; + v->x = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype4_wxz_ref < vtype > &vtype4_wxz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->w = other.x; + v->x = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype4_wyx_ref < vtype > &vtype4_wyx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->w = other.x; + v->y = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_wyz_ref < vtype > &vtype4_wyz_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->w = other.x; + v->y = other.y; + v->z = other.z; + return *this; +} + +template < typename vtype > vtype4_wzx_ref < vtype > &vtype4_wzx_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->w = other.x; + v->z = other.y; + v->x = other.z; + return *this; +} + +template < typename vtype > vtype4_wzy_ref < vtype > &vtype4_wzy_ref < vtype >::operator=(const vtype3 < vtype > &other) +{ + v->w = other.x; + v->z = other.y; + v->y = other.z; + return *this; +} + +template < typename vtype > vtype4_xyzw_ref < vtype > &vtype4_xyzw_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + v->z = other.z; + v->w = other.w; + return *this; +} + +template < typename vtype > vtype4_xywz_ref < vtype > &vtype4_xywz_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->x = other.x; + v->y = other.y; + v->w = other.z; + v->z = other.w; + return *this; +} + +template < typename vtype > vtype4_xzyw_ref < vtype > &vtype4_xzyw_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + v->y = other.z; + v->w = other.w; + return *this; +} + +template < typename vtype > vtype4_xzwy_ref < vtype > &vtype4_xzwy_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->x = other.x; + v->z = other.y; + v->w = other.z; + v->y = other.w; + return *this; +} + +template < typename vtype > vtype4_xwyz_ref < vtype > &vtype4_xwyz_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->x = other.x; + v->w = other.y; + v->y = other.z; + v->z = other.w; + return *this; +} + +template < typename vtype > vtype4_xwzy_ref < vtype > &vtype4_xwzy_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->x = other.x; + v->w = other.y; + v->z = other.z; + v->y = other.w; + return *this; +} + +template < typename vtype > vtype4_yxzw_ref < vtype > &vtype4_yxzw_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + v->z = other.z; + v->w = other.w; + return *this; +} + +template < typename vtype > vtype4_yxwz_ref < vtype > &vtype4_yxwz_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->y = other.x; + v->x = other.y; + v->w = other.z; + v->z = other.w; + return *this; +} + +template < typename vtype > vtype4_yzxw_ref < vtype > &vtype4_yzxw_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + v->x = other.z; + v->w = other.w; + return *this; +} + +template < typename vtype > vtype4_yzwx_ref < vtype > &vtype4_yzwx_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->y = other.x; + v->z = other.y; + v->w = other.z; + v->x = other.w; + return *this; +} + +template < typename vtype > vtype4_ywxz_ref < vtype > &vtype4_ywxz_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->y = other.x; + v->w = other.y; + v->x = other.z; + v->z = other.w; + return *this; +} + +template < typename vtype > vtype4_ywzx_ref < vtype > &vtype4_ywzx_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->y = other.x; + v->w = other.y; + v->z = other.z; + v->x = other.w; + return *this; +} + +template < typename vtype > vtype4_zxyw_ref < vtype > &vtype4_zxyw_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + v->y = other.z; + v->w = other.w; + return *this; +} + +template < typename vtype > vtype4_zxwy_ref < vtype > &vtype4_zxwy_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->z = other.x; + v->x = other.y; + v->w = other.z; + v->y = other.w; + return *this; +} + +template < typename vtype > vtype4_zyxw_ref < vtype > &vtype4_zyxw_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + v->x = other.z; + v->w = other.w; + return *this; +} + +template < typename vtype > vtype4_zywx_ref < vtype > &vtype4_zywx_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->z = other.x; + v->y = other.y; + v->w = other.z; + v->x = other.w; + return *this; +} + +template < typename vtype > vtype4_zwxy_ref < vtype > &vtype4_zwxy_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->z = other.x; + v->w = other.y; + v->x = other.z; + v->y = other.w; + return *this; +} + +template < typename vtype > vtype4_zwyx_ref < vtype > &vtype4_zwyx_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->z = other.x; + v->w = other.y; + v->y = other.z; + v->x = other.w; + return *this; +} + +template < typename vtype > vtype4_wxyz_ref < vtype > &vtype4_wxyz_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->w = other.x; + v->x = other.y; + v->y = other.z; + v->z = other.w; + return *this; +} + +template < typename vtype > vtype4_wxzy_ref < vtype > &vtype4_wxzy_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->w = other.x; + v->x = other.y; + v->z = other.z; + v->y = other.w; + return *this; +} + +template < typename vtype > vtype4_wyxz_ref < vtype > &vtype4_wyxz_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->w = other.x; + v->y = other.y; + v->x = other.z; + v->z = other.w; + return *this; +} + +template < typename vtype > vtype4_wyzx_ref < vtype > &vtype4_wyzx_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->w = other.x; + v->y = other.y; + v->z = other.z; + v->x = other.w; + return *this; +} + +template < typename vtype > vtype4_wzxy_ref < vtype > &vtype4_wzxy_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->w = other.x; + v->z = other.y; + v->x = other.z; + v->y = other.w; + return *this; +} + +template < typename vtype > vtype4_wzyx_ref < vtype > &vtype4_wzyx_ref < vtype >::operator=(const vtype4 < vtype > &other) +{ + v->w = other.x; + v->z = other.y; + v->y = other.z; + v->x = other.w; + return *this; +} + +template < typename vtype > vtype2 < vtype >::vtype2(const vtype2_xx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype2_xy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype2_yx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype2_yy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_xx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_xy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_xz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_yx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_yy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_yz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_zx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_zy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype3_zz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_xx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_xy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_xz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_xw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_yx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_yy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_yz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_yw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_zx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_zy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_zz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_zw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_wx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_wy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_wz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; +} +template < typename vtype > vtype2 < vtype >::vtype2(const vtype4_ww_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_xxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_xxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_xyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_xyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_yxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_yxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_yyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype2_yyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_xzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_yzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype3_zzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xxw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xyw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xzw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xwx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xwy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xwz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_xww_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yxw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yyw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yzw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_ywx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_ywy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_ywz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_yww_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zxw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zyw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zzw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zwx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zwy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zwz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_zww_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wxx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wxy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wxz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wxw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wyx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wyy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wyz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wyw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wzx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wzy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wzz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wzw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->w; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wwx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->x; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wwy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->y; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_wwz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->z; +} +template < typename vtype > vtype3 < vtype >::vtype3(const vtype4_www_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xxxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xxxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xxyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xxyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xyxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xyxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xyyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_xyyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yxxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yxxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yxyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yxyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yyxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yyxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yyyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype2_yyyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xxzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xyzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_xzzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yxzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yyzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_yzzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zxzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zyzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype3_zzzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxxw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxyw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxzw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxwx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxwy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxwz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xxww_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->x; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyxw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyyw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyzw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xywx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xywy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xywz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xyww_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->y; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzxw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzyw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzzw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzwx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzwy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzwz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xzww_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->z; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwxx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwxy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwxz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwxw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwyx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwyy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwyz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwyw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwzx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwzy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwzz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwzw_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwwx_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwwy_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwwz_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_xwww_ref < vtype > &v) +{ + x = v.v->x; + y = v.v->w; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxxw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxyw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxzw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxwx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxwy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxwz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yxww_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->x; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyxw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyyw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyzw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yywx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yywy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yywz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yyww_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->y; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzxw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzyw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzzw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzwx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzwy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzwz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_yzww_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->z; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywxx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywxy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywxz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywxw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywyx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywyy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywyz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywyw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywzx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywzy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywzz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywzw_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywwx_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywwy_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywwz_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_ywww_ref < vtype > &v) +{ + x = v.v->y; + y = v.v->w; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxxw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxyw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxzw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxwx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxwy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxwz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zxww_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->x; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyxw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyyw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyzw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zywx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zywy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zywz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zyww_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->y; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzxw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzyw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzzw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzwx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzwy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzwz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zzww_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->z; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwxx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwxy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwxz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwxw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwyx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwyy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwyz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwyw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwzx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwzy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwzz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwzw_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwwx_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwwy_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwwz_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_zwww_ref < vtype > &v) +{ + x = v.v->z; + y = v.v->w; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxxx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxxy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxxz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxxw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxyx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxyy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxyz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxyw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxzx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxzy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxzz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxzw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxwx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxwy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxwz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wxww_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->x; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyxx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyxy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyxz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyxw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyyx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyyy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyyz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyyw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyzx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyzy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyzz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyzw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wywx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wywy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wywz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wyww_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->y; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzxx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzxy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzxz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzxw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzyx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzyy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzyz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzyw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzzx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzzy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzzz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzzw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzwx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzwy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzwz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wzww_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->z; + z = v.v->w; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwxx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->x; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwxy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->x; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwxz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->x; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwxw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->x; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwyx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->y; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwyy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->y; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwyz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->y; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwyw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->y; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwzx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->z; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwzy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->z; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwzz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->z; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwzw_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->z; + w = v.v->w; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwwx_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->w; + w = v.v->x; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwwy_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->w; + w = v.v->y; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwwz_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->w; + w = v.v->z; +} +template < typename vtype > vtype4 < vtype >::vtype4(const vtype4_wwww_ref < vtype > &v) +{ + x = v.v->w; + y = v.v->w; + z = v.v->w; + w = v.v->w; +} +typedef vtype2 < float >float2; +typedef vtype3 < float >float3; +typedef vtype4 < float >float4; +typedef vtype2 < double >double2; +typedef vtype3 < double >double3; +typedef vtype4 < double >double4; +typedef vtype2 < int >int2; +typedef vtype3 < int >int3; +typedef vtype4 < int >int4; +typedef vtype2 < uint > uint2; +typedef vtype3 < uint > uint3; +typedef vtype4 < uint > uint4; +typedef vtype2 < short >short2; +typedef vtype3 < short >short3; +typedef vtype4 < short >short4; +typedef vtype2 < ushort > ushort2; +typedef vtype3 < ushort > ushort3; +typedef vtype4 < ushort > ushort4; +typedef vtype2 < long >long2; +typedef vtype3 < long >long3; +typedef vtype4 < long >long4; +typedef vtype2 < ulong > ulong2; +typedef vtype3 < ulong > ulong3; +typedef vtype4 < ulong > ulong4; +static inline float2 operator+(float2 p, float2 q) +{ + return float2(p.x + q.x, p.y + q.y); +} +static inline float3 operator+(float3 p, float3 q) +{ + return float3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline float4 operator+(float4 p, float4 q) +{ + return float4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline float2 operator+(float2 p, float q) +{ + return float2(p.x + q, p.y + q); +} +static inline float3 operator+(float3 p, float q) +{ + return float3(p.x + q, p.y + q, p.z + q); +} +static inline float4 operator+(float4 p, float q) +{ + return float4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline float2 operator+(float p, float2 q) +{ + return float2(p + q.x, p + q.y); +} +static inline float3 operator+(float p, float3 q) +{ + return float3(p + q.x, p + q.y, p + q.z); +} +static inline float4 operator+(float p, float4 q) +{ + return float4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline double2 operator+(double2 p, double2 q) +{ + return double2(p.x + q.x, p.y + q.y); +} +static inline double3 operator+(double3 p, double3 q) +{ + return double3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline double4 operator+(double4 p, double4 q) +{ + return double4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline double2 operator+(double2 p, double q) +{ + return double2(p.x + q, p.y + q); +} +static inline double3 operator+(double3 p, double q) +{ + return double3(p.x + q, p.y + q, p.z + q); +} +static inline double4 operator+(double4 p, double q) +{ + return double4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline double2 operator+(double p, double2 q) +{ + return double2(p + q.x, p + q.y); +} +static inline double3 operator+(double p, double3 q) +{ + return double3(p + q.x, p + q.y, p + q.z); +} +static inline double4 operator+(double p, double4 q) +{ + return double4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline int2 operator+(int2 p, int2 q) +{ + return int2(p.x + q.x, p.y + q.y); +} +static inline int3 operator+(int3 p, int3 q) +{ + return int3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline int4 operator+(int4 p, int4 q) +{ + return int4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline int2 operator+(int2 p, int q) +{ + return int2(p.x + q, p.y + q); +} +static inline int3 operator+(int3 p, int q) +{ + return int3(p.x + q, p.y + q, p.z + q); +} +static inline int4 operator+(int4 p, int q) +{ + return int4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline int2 operator+(int p, int2 q) +{ + return int2(p + q.x, p + q.y); +} +static inline int3 operator+(int p, int3 q) +{ + return int3(p + q.x, p + q.y, p + q.z); +} +static inline int4 operator+(int p, int4 q) +{ + return int4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline uint2 operator+(uint2 p, uint2 q) +{ + return uint2(p.x + q.x, p.y + q.y); +} +static inline uint3 operator+(uint3 p, uint3 q) +{ + return uint3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline uint4 operator+(uint4 p, uint4 q) +{ + return uint4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline uint2 operator+(uint2 p, uint q) +{ + return uint2(p.x + q, p.y + q); +} +static inline uint3 operator+(uint3 p, uint q) +{ + return uint3(p.x + q, p.y + q, p.z + q); +} +static inline uint4 operator+(uint4 p, uint q) +{ + return uint4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline uint2 operator+(uint p, uint2 q) +{ + return uint2(p + q.x, p + q.y); +} +static inline uint3 operator+(uint p, uint3 q) +{ + return uint3(p + q.x, p + q.y, p + q.z); +} +static inline uint4 operator+(uint p, uint4 q) +{ + return uint4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline short2 operator+(short2 p, short2 q) +{ + return short2(p.x + q.x, p.y + q.y); +} +static inline short3 operator+(short3 p, short3 q) +{ + return short3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline short4 operator+(short4 p, short4 q) +{ + return short4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline short2 operator+(short2 p, short q) +{ + return short2(p.x + q, p.y + q); +} +static inline short3 operator+(short3 p, short q) +{ + return short3(p.x + q, p.y + q, p.z + q); +} +static inline short4 operator+(short4 p, short q) +{ + return short4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline short2 operator+(short p, short2 q) +{ + return short2(p + q.x, p + q.y); +} +static inline short3 operator+(short p, short3 q) +{ + return short3(p + q.x, p + q.y, p + q.z); +} +static inline short4 operator+(short p, short4 q) +{ + return short4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline ushort2 operator+(ushort2 p, ushort2 q) +{ + return ushort2(p.x + q.x, p.y + q.y); +} +static inline ushort3 operator+(ushort3 p, ushort3 q) +{ + return ushort3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline ushort4 operator+(ushort4 p, ushort4 q) +{ + return ushort4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline ushort2 operator+(ushort2 p, ushort q) +{ + return ushort2(p.x + q, p.y + q); +} +static inline ushort3 operator+(ushort3 p, ushort q) +{ + return ushort3(p.x + q, p.y + q, p.z + q); +} +static inline ushort4 operator+(ushort4 p, ushort q) +{ + return ushort4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline ushort2 operator+(ushort p, ushort2 q) +{ + return ushort2(p + q.x, p + q.y); +} +static inline ushort3 operator+(ushort p, ushort3 q) +{ + return ushort3(p + q.x, p + q.y, p + q.z); +} +static inline ushort4 operator+(ushort p, ushort4 q) +{ + return ushort4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline long2 operator+(long2 p, long2 q) +{ + return long2(p.x + q.x, p.y + q.y); +} +static inline long3 operator+(long3 p, long3 q) +{ + return long3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline long4 operator+(long4 p, long4 q) +{ + return long4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline long2 operator+(long2 p, long q) +{ + return long2(p.x + q, p.y + q); +} +static inline long3 operator+(long3 p, long q) +{ + return long3(p.x + q, p.y + q, p.z + q); +} +static inline long4 operator+(long4 p, long q) +{ + return long4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline long2 operator+(long p, long2 q) +{ + return long2(p + q.x, p + q.y); +} +static inline long3 operator+(long p, long3 q) +{ + return long3(p + q.x, p + q.y, p + q.z); +} +static inline long4 operator+(long p, long4 q) +{ + return long4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline ulong2 operator+(ulong2 p, ulong2 q) +{ + return ulong2(p.x + q.x, p.y + q.y); +} +static inline ulong3 operator+(ulong3 p, ulong3 q) +{ + return ulong3(p.x + q.x, p.y + q.y, p.z + q.z); +} +static inline ulong4 operator+(ulong4 p, ulong4 q) +{ + return ulong4(p.x + q.x, p.y + q.y, p.z + q.z, p.w + q.w); +} +static inline ulong2 operator+(ulong2 p, ulong q) +{ + return ulong2(p.x + q, p.y + q); +} +static inline ulong3 operator+(ulong3 p, ulong q) +{ + return ulong3(p.x + q, p.y + q, p.z + q); +} +static inline ulong4 operator+(ulong4 p, ulong q) +{ + return ulong4(p.x + q, p.y + q, p.z + q, p.w + q); +} +static inline ulong2 operator+(ulong p, ulong2 q) +{ + return ulong2(p + q.x, p + q.y); +} +static inline ulong3 operator+(ulong p, ulong3 q) +{ + return ulong3(p + q.x, p + q.y, p + q.z); +} +static inline ulong4 operator+(ulong p, ulong4 q) +{ + return ulong4(p + q.x, p + q.y, p + q.z, p + q.w); +} +static inline float2 operator-(float2 p, float2 q) +{ + return float2(p.x - q.x, p.y - q.y); +} +static inline float3 operator-(float3 p, float3 q) +{ + return float3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline float4 operator-(float4 p, float4 q) +{ + return float4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline float2 operator-(float2 p, float q) +{ + return float2(p.x - q, p.y - q); +} +static inline float3 operator-(float3 p, float q) +{ + return float3(p.x - q, p.y - q, p.z - q); +} +static inline float4 operator-(float4 p, float q) +{ + return float4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline float2 operator-(float p, float2 q) +{ + return float2(p - q.x, p - q.y); +} +static inline float3 operator-(float p, float3 q) +{ + return float3(p - q.x, p - q.y, p - q.z); +} +static inline float4 operator-(float p, float4 q) +{ + return float4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline double2 operator-(double2 p, double2 q) +{ + return double2(p.x - q.x, p.y - q.y); +} +static inline double3 operator-(double3 p, double3 q) +{ + return double3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline double4 operator-(double4 p, double4 q) +{ + return double4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline double2 operator-(double2 p, double q) +{ + return double2(p.x - q, p.y - q); +} +static inline double3 operator-(double3 p, double q) +{ + return double3(p.x - q, p.y - q, p.z - q); +} +static inline double4 operator-(double4 p, double q) +{ + return double4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline double2 operator-(double p, double2 q) +{ + return double2(p - q.x, p - q.y); +} +static inline double3 operator-(double p, double3 q) +{ + return double3(p - q.x, p - q.y, p - q.z); +} +static inline double4 operator-(double p, double4 q) +{ + return double4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline int2 operator-(int2 p, int2 q) +{ + return int2(p.x - q.x, p.y - q.y); +} +static inline int3 operator-(int3 p, int3 q) +{ + return int3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline int4 operator-(int4 p, int4 q) +{ + return int4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline int2 operator-(int2 p, int q) +{ + return int2(p.x - q, p.y - q); +} +static inline int3 operator-(int3 p, int q) +{ + return int3(p.x - q, p.y - q, p.z - q); +} +static inline int4 operator-(int4 p, int q) +{ + return int4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline int2 operator-(int p, int2 q) +{ + return int2(p - q.x, p - q.y); +} +static inline int3 operator-(int p, int3 q) +{ + return int3(p - q.x, p - q.y, p - q.z); +} +static inline int4 operator-(int p, int4 q) +{ + return int4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline uint2 operator-(uint2 p, uint2 q) +{ + return uint2(p.x - q.x, p.y - q.y); +} +static inline uint3 operator-(uint3 p, uint3 q) +{ + return uint3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline uint4 operator-(uint4 p, uint4 q) +{ + return uint4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline uint2 operator-(uint2 p, uint q) +{ + return uint2(p.x - q, p.y - q); +} +static inline uint3 operator-(uint3 p, uint q) +{ + return uint3(p.x - q, p.y - q, p.z - q); +} +static inline uint4 operator-(uint4 p, uint q) +{ + return uint4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline uint2 operator-(uint p, uint2 q) +{ + return uint2(p - q.x, p - q.y); +} +static inline uint3 operator-(uint p, uint3 q) +{ + return uint3(p - q.x, p - q.y, p - q.z); +} +static inline uint4 operator-(uint p, uint4 q) +{ + return uint4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline short2 operator-(short2 p, short2 q) +{ + return short2(p.x - q.x, p.y - q.y); +} +static inline short3 operator-(short3 p, short3 q) +{ + return short3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline short4 operator-(short4 p, short4 q) +{ + return short4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline short2 operator-(short2 p, short q) +{ + return short2(p.x - q, p.y - q); +} +static inline short3 operator-(short3 p, short q) +{ + return short3(p.x - q, p.y - q, p.z - q); +} +static inline short4 operator-(short4 p, short q) +{ + return short4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline short2 operator-(short p, short2 q) +{ + return short2(p - q.x, p - q.y); +} +static inline short3 operator-(short p, short3 q) +{ + return short3(p - q.x, p - q.y, p - q.z); +} +static inline short4 operator-(short p, short4 q) +{ + return short4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline ushort2 operator-(ushort2 p, ushort2 q) +{ + return ushort2(p.x - q.x, p.y - q.y); +} +static inline ushort3 operator-(ushort3 p, ushort3 q) +{ + return ushort3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline ushort4 operator-(ushort4 p, ushort4 q) +{ + return ushort4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline ushort2 operator-(ushort2 p, ushort q) +{ + return ushort2(p.x - q, p.y - q); +} +static inline ushort3 operator-(ushort3 p, ushort q) +{ + return ushort3(p.x - q, p.y - q, p.z - q); +} +static inline ushort4 operator-(ushort4 p, ushort q) +{ + return ushort4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline ushort2 operator-(ushort p, ushort2 q) +{ + return ushort2(p - q.x, p - q.y); +} +static inline ushort3 operator-(ushort p, ushort3 q) +{ + return ushort3(p - q.x, p - q.y, p - q.z); +} +static inline ushort4 operator-(ushort p, ushort4 q) +{ + return ushort4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline long2 operator-(long2 p, long2 q) +{ + return long2(p.x - q.x, p.y - q.y); +} +static inline long3 operator-(long3 p, long3 q) +{ + return long3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline long4 operator-(long4 p, long4 q) +{ + return long4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline long2 operator-(long2 p, long q) +{ + return long2(p.x - q, p.y - q); +} +static inline long3 operator-(long3 p, long q) +{ + return long3(p.x - q, p.y - q, p.z - q); +} +static inline long4 operator-(long4 p, long q) +{ + return long4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline long2 operator-(long p, long2 q) +{ + return long2(p - q.x, p - q.y); +} +static inline long3 operator-(long p, long3 q) +{ + return long3(p - q.x, p - q.y, p - q.z); +} +static inline long4 operator-(long p, long4 q) +{ + return long4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline ulong2 operator-(ulong2 p, ulong2 q) +{ + return ulong2(p.x - q.x, p.y - q.y); +} +static inline ulong3 operator-(ulong3 p, ulong3 q) +{ + return ulong3(p.x - q.x, p.y - q.y, p.z - q.z); +} +static inline ulong4 operator-(ulong4 p, ulong4 q) +{ + return ulong4(p.x - q.x, p.y - q.y, p.z - q.z, p.w - q.w); +} +static inline ulong2 operator-(ulong2 p, ulong q) +{ + return ulong2(p.x - q, p.y - q); +} +static inline ulong3 operator-(ulong3 p, ulong q) +{ + return ulong3(p.x - q, p.y - q, p.z - q); +} +static inline ulong4 operator-(ulong4 p, ulong q) +{ + return ulong4(p.x - q, p.y - q, p.z - q, p.w - q); +} +static inline ulong2 operator-(ulong p, ulong2 q) +{ + return ulong2(p - q.x, p - q.y); +} +static inline ulong3 operator-(ulong p, ulong3 q) +{ + return ulong3(p - q.x, p - q.y, p - q.z); +} +static inline ulong4 operator-(ulong p, ulong4 q) +{ + return ulong4(p - q.x, p - q.y, p - q.z, p - q.w); +} +static inline float2 operator*(float2 p, float2 q) +{ + return float2(p.x * q.x, p.y * q.y); +} +static inline float3 operator*(float3 p, float3 q) +{ + return float3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline float4 operator*(float4 p, float4 q) +{ + return float4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline float2 operator*(float2 p, float q) +{ + return float2(p.x * q, p.y * q); +} +static inline float3 operator*(float3 p, float q) +{ + return float3(p.x * q, p.y * q, p.z * q); +} +static inline float4 operator*(float4 p, float q) +{ + return float4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline float2 operator*(float p, float2 q) +{ + return float2(p * q.x, p * q.y); +} +static inline float3 operator*(float p, float3 q) +{ + return float3(p * q.x, p * q.y, p * q.z); +} +static inline float4 operator*(float p, float4 q) +{ + return float4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline double2 operator*(double2 p, double2 q) +{ + return double2(p.x * q.x, p.y * q.y); +} +static inline double3 operator*(double3 p, double3 q) +{ + return double3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline double4 operator*(double4 p, double4 q) +{ + return double4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline double2 operator*(double2 p, double q) +{ + return double2(p.x * q, p.y * q); +} +static inline double3 operator*(double3 p, double q) +{ + return double3(p.x * q, p.y * q, p.z * q); +} +static inline double4 operator*(double4 p, double q) +{ + return double4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline double2 operator*(double p, double2 q) +{ + return double2(p * q.x, p * q.y); +} +static inline double3 operator*(double p, double3 q) +{ + return double3(p * q.x, p * q.y, p * q.z); +} +static inline double4 operator*(double p, double4 q) +{ + return double4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline int2 operator*(int2 p, int2 q) +{ + return int2(p.x * q.x, p.y * q.y); +} +static inline int3 operator*(int3 p, int3 q) +{ + return int3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline int4 operator*(int4 p, int4 q) +{ + return int4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline int2 operator*(int2 p, int q) +{ + return int2(p.x * q, p.y * q); +} +static inline int3 operator*(int3 p, int q) +{ + return int3(p.x * q, p.y * q, p.z * q); +} +static inline int4 operator*(int4 p, int q) +{ + return int4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline int2 operator*(int p, int2 q) +{ + return int2(p * q.x, p * q.y); +} +static inline int3 operator*(int p, int3 q) +{ + return int3(p * q.x, p * q.y, p * q.z); +} +static inline int4 operator*(int p, int4 q) +{ + return int4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline uint2 operator*(uint2 p, uint2 q) +{ + return uint2(p.x * q.x, p.y * q.y); +} +static inline uint3 operator*(uint3 p, uint3 q) +{ + return uint3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline uint4 operator*(uint4 p, uint4 q) +{ + return uint4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline uint2 operator*(uint2 p, uint q) +{ + return uint2(p.x * q, p.y * q); +} +static inline uint3 operator*(uint3 p, uint q) +{ + return uint3(p.x * q, p.y * q, p.z * q); +} +static inline uint4 operator*(uint4 p, uint q) +{ + return uint4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline uint2 operator*(uint p, uint2 q) +{ + return uint2(p * q.x, p * q.y); +} +static inline uint3 operator*(uint p, uint3 q) +{ + return uint3(p * q.x, p * q.y, p * q.z); +} +static inline uint4 operator*(uint p, uint4 q) +{ + return uint4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline short2 operator*(short2 p, short2 q) +{ + return short2(p.x * q.x, p.y * q.y); +} +static inline short3 operator*(short3 p, short3 q) +{ + return short3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline short4 operator*(short4 p, short4 q) +{ + return short4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline short2 operator*(short2 p, short q) +{ + return short2(p.x * q, p.y * q); +} +static inline short3 operator*(short3 p, short q) +{ + return short3(p.x * q, p.y * q, p.z * q); +} +static inline short4 operator*(short4 p, short q) +{ + return short4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline short2 operator*(short p, short2 q) +{ + return short2(p * q.x, p * q.y); +} +static inline short3 operator*(short p, short3 q) +{ + return short3(p * q.x, p * q.y, p * q.z); +} +static inline short4 operator*(short p, short4 q) +{ + return short4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline ushort2 operator*(ushort2 p, ushort2 q) +{ + return ushort2(p.x * q.x, p.y * q.y); +} +static inline ushort3 operator*(ushort3 p, ushort3 q) +{ + return ushort3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline ushort4 operator*(ushort4 p, ushort4 q) +{ + return ushort4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline ushort2 operator*(ushort2 p, ushort q) +{ + return ushort2(p.x * q, p.y * q); +} +static inline ushort3 operator*(ushort3 p, ushort q) +{ + return ushort3(p.x * q, p.y * q, p.z * q); +} +static inline ushort4 operator*(ushort4 p, ushort q) +{ + return ushort4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline ushort2 operator*(ushort p, ushort2 q) +{ + return ushort2(p * q.x, p * q.y); +} +static inline ushort3 operator*(ushort p, ushort3 q) +{ + return ushort3(p * q.x, p * q.y, p * q.z); +} +static inline ushort4 operator*(ushort p, ushort4 q) +{ + return ushort4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline long2 operator*(long2 p, long2 q) +{ + return long2(p.x * q.x, p.y * q.y); +} +static inline long3 operator*(long3 p, long3 q) +{ + return long3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline long4 operator*(long4 p, long4 q) +{ + return long4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline long2 operator*(long2 p, long q) +{ + return long2(p.x * q, p.y * q); +} +static inline long3 operator*(long3 p, long q) +{ + return long3(p.x * q, p.y * q, p.z * q); +} +static inline long4 operator*(long4 p, long q) +{ + return long4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline long2 operator*(long p, long2 q) +{ + return long2(p * q.x, p * q.y); +} +static inline long3 operator*(long p, long3 q) +{ + return long3(p * q.x, p * q.y, p * q.z); +} +static inline long4 operator*(long p, long4 q) +{ + return long4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline ulong2 operator*(ulong2 p, ulong2 q) +{ + return ulong2(p.x * q.x, p.y * q.y); +} +static inline ulong3 operator*(ulong3 p, ulong3 q) +{ + return ulong3(p.x * q.x, p.y * q.y, p.z * q.z); +} +static inline ulong4 operator*(ulong4 p, ulong4 q) +{ + return ulong4(p.x * q.x, p.y * q.y, p.z * q.z, p.w * q.w); +} +static inline ulong2 operator*(ulong2 p, ulong q) +{ + return ulong2(p.x * q, p.y * q); +} +static inline ulong3 operator*(ulong3 p, ulong q) +{ + return ulong3(p.x * q, p.y * q, p.z * q); +} +static inline ulong4 operator*(ulong4 p, ulong q) +{ + return ulong4(p.x * q, p.y * q, p.z * q, p.w * q); +} +static inline ulong2 operator*(ulong p, ulong2 q) +{ + return ulong2(p * q.x, p * q.y); +} +static inline ulong3 operator*(ulong p, ulong3 q) +{ + return ulong3(p * q.x, p * q.y, p * q.z); +} +static inline ulong4 operator*(ulong p, ulong4 q) +{ + return ulong4(p * q.x, p * q.y, p * q.z, p * q.w); +} +static inline float2 operator/(float2 p, float2 q) +{ + return float2(p.x / q.x, p.y / q.y); +} +static inline float3 operator/(float3 p, float3 q) +{ + return float3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline float4 operator/(float4 p, float4 q) +{ + return float4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline float2 operator/(float2 p, float q) +{ + return float2(p.x / q, p.y / q); +} +static inline float3 operator/(float3 p, float q) +{ + return float3(p.x / q, p.y / q, p.z / q); +} +static inline float4 operator/(float4 p, float q) +{ + return float4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline float2 operator/(float p, float2 q) +{ + return float2(p / q.x, p / q.y); +} +static inline float3 operator/(float p, float3 q) +{ + return float3(p / q.x, p / q.y, p / q.z); +} +static inline float4 operator/(float p, float4 q) +{ + return float4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline double2 operator/(double2 p, double2 q) +{ + return double2(p.x / q.x, p.y / q.y); +} +static inline double3 operator/(double3 p, double3 q) +{ + return double3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline double4 operator/(double4 p, double4 q) +{ + return double4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline double2 operator/(double2 p, double q) +{ + return double2(p.x / q, p.y / q); +} +static inline double3 operator/(double3 p, double q) +{ + return double3(p.x / q, p.y / q, p.z / q); +} +static inline double4 operator/(double4 p, double q) +{ + return double4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline double2 operator/(double p, double2 q) +{ + return double2(p / q.x, p / q.y); +} +static inline double3 operator/(double p, double3 q) +{ + return double3(p / q.x, p / q.y, p / q.z); +} +static inline double4 operator/(double p, double4 q) +{ + return double4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline int2 operator/(int2 p, int2 q) +{ + return int2(p.x / q.x, p.y / q.y); +} +static inline int3 operator/(int3 p, int3 q) +{ + return int3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline int4 operator/(int4 p, int4 q) +{ + return int4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline int2 operator/(int2 p, int q) +{ + return int2(p.x / q, p.y / q); +} +static inline int3 operator/(int3 p, int q) +{ + return int3(p.x / q, p.y / q, p.z / q); +} +static inline int4 operator/(int4 p, int q) +{ + return int4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline int2 operator/(int p, int2 q) +{ + return int2(p / q.x, p / q.y); +} +static inline int3 operator/(int p, int3 q) +{ + return int3(p / q.x, p / q.y, p / q.z); +} +static inline int4 operator/(int p, int4 q) +{ + return int4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline uint2 operator/(uint2 p, uint2 q) +{ + return uint2(p.x / q.x, p.y / q.y); +} +static inline uint3 operator/(uint3 p, uint3 q) +{ + return uint3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline uint4 operator/(uint4 p, uint4 q) +{ + return uint4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline uint2 operator/(uint2 p, uint q) +{ + return uint2(p.x / q, p.y / q); +} +static inline uint3 operator/(uint3 p, uint q) +{ + return uint3(p.x / q, p.y / q, p.z / q); +} +static inline uint4 operator/(uint4 p, uint q) +{ + return uint4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline uint2 operator/(uint p, uint2 q) +{ + return uint2(p / q.x, p / q.y); +} +static inline uint3 operator/(uint p, uint3 q) +{ + return uint3(p / q.x, p / q.y, p / q.z); +} +static inline uint4 operator/(uint p, uint4 q) +{ + return uint4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline short2 operator/(short2 p, short2 q) +{ + return short2(p.x / q.x, p.y / q.y); +} +static inline short3 operator/(short3 p, short3 q) +{ + return short3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline short4 operator/(short4 p, short4 q) +{ + return short4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline short2 operator/(short2 p, short q) +{ + return short2(p.x / q, p.y / q); +} +static inline short3 operator/(short3 p, short q) +{ + return short3(p.x / q, p.y / q, p.z / q); +} +static inline short4 operator/(short4 p, short q) +{ + return short4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline short2 operator/(short p, short2 q) +{ + return short2(p / q.x, p / q.y); +} +static inline short3 operator/(short p, short3 q) +{ + return short3(p / q.x, p / q.y, p / q.z); +} +static inline short4 operator/(short p, short4 q) +{ + return short4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline ushort2 operator/(ushort2 p, ushort2 q) +{ + return ushort2(p.x / q.x, p.y / q.y); +} +static inline ushort3 operator/(ushort3 p, ushort3 q) +{ + return ushort3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline ushort4 operator/(ushort4 p, ushort4 q) +{ + return ushort4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline ushort2 operator/(ushort2 p, ushort q) +{ + return ushort2(p.x / q, p.y / q); +} +static inline ushort3 operator/(ushort3 p, ushort q) +{ + return ushort3(p.x / q, p.y / q, p.z / q); +} +static inline ushort4 operator/(ushort4 p, ushort q) +{ + return ushort4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline ushort2 operator/(ushort p, ushort2 q) +{ + return ushort2(p / q.x, p / q.y); +} +static inline ushort3 operator/(ushort p, ushort3 q) +{ + return ushort3(p / q.x, p / q.y, p / q.z); +} +static inline ushort4 operator/(ushort p, ushort4 q) +{ + return ushort4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline long2 operator/(long2 p, long2 q) +{ + return long2(p.x / q.x, p.y / q.y); +} +static inline long3 operator/(long3 p, long3 q) +{ + return long3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline long4 operator/(long4 p, long4 q) +{ + return long4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline long2 operator/(long2 p, long q) +{ + return long2(p.x / q, p.y / q); +} +static inline long3 operator/(long3 p, long q) +{ + return long3(p.x / q, p.y / q, p.z / q); +} +static inline long4 operator/(long4 p, long q) +{ + return long4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline long2 operator/(long p, long2 q) +{ + return long2(p / q.x, p / q.y); +} +static inline long3 operator/(long p, long3 q) +{ + return long3(p / q.x, p / q.y, p / q.z); +} +static inline long4 operator/(long p, long4 q) +{ + return long4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline ulong2 operator/(ulong2 p, ulong2 q) +{ + return ulong2(p.x / q.x, p.y / q.y); +} +static inline ulong3 operator/(ulong3 p, ulong3 q) +{ + return ulong3(p.x / q.x, p.y / q.y, p.z / q.z); +} +static inline ulong4 operator/(ulong4 p, ulong4 q) +{ + return ulong4(p.x / q.x, p.y / q.y, p.z / q.z, p.w / q.w); +} +static inline ulong2 operator/(ulong2 p, ulong q) +{ + return ulong2(p.x / q, p.y / q); +} +static inline ulong3 operator/(ulong3 p, ulong q) +{ + return ulong3(p.x / q, p.y / q, p.z / q); +} +static inline ulong4 operator/(ulong4 p, ulong q) +{ + return ulong4(p.x / q, p.y / q, p.z / q, p.w / q); +} +static inline ulong2 operator/(ulong p, ulong2 q) +{ + return ulong2(p / q.x, p / q.y); +} +static inline ulong3 operator/(ulong p, ulong3 q) +{ + return ulong3(p / q.x, p / q.y, p / q.z); +} +static inline ulong4 operator/(ulong p, ulong4 q) +{ + return ulong4(p / q.x, p / q.y, p / q.z, p / q.w); +} +static inline int2 operator%(int2 p, int2 q) +{ + return int2(p.x % q.x, p.y % q.y); +} +static inline int3 operator%(int3 p, int3 q) +{ + return int3(p.x % q.x, p.y % q.y, p.z % q.z); +} +static inline int4 operator%(int4 p, int4 q) +{ + return int4(p.x % q.x, p.y % q.y, p.z % q.z, p.w % q.w); +} +static inline int2 operator%(int2 p, int q) +{ + return int2(p.x % q, p.y % q); +} +static inline int3 operator%(int3 p, int q) +{ + return int3(p.x % q, p.y % q, p.z % q); +} +static inline int4 operator%(int4 p, int q) +{ + return int4(p.x % q, p.y % q, p.z % q, p.w % q); +} +static inline int2 operator%(int p, int2 q) +{ + return int2(p % q.x, p % q.y); +} +static inline int3 operator%(int p, int3 q) +{ + return int3(p % q.x, p % q.y, p % q.z); +} +static inline int4 operator%(int p, int4 q) +{ + return int4(p % q.x, p % q.y, p % q.z, p % q.w); +} +static inline uint2 operator%(uint2 p, uint2 q) +{ + return uint2(p.x % q.x, p.y % q.y); +} +static inline uint3 operator%(uint3 p, uint3 q) +{ + return uint3(p.x % q.x, p.y % q.y, p.z % q.z); +} +static inline uint4 operator%(uint4 p, uint4 q) +{ + return uint4(p.x % q.x, p.y % q.y, p.z % q.z, p.w % q.w); +} +static inline uint2 operator%(uint2 p, uint q) +{ + return uint2(p.x % q, p.y % q); +} +static inline uint3 operator%(uint3 p, uint q) +{ + return uint3(p.x % q, p.y % q, p.z % q); +} +static inline uint4 operator%(uint4 p, uint q) +{ + return uint4(p.x % q, p.y % q, p.z % q, p.w % q); +} +static inline uint2 operator%(uint p, uint2 q) +{ + return uint2(p % q.x, p % q.y); +} +static inline uint3 operator%(uint p, uint3 q) +{ + return uint3(p % q.x, p % q.y, p % q.z); +} +static inline uint4 operator%(uint p, uint4 q) +{ + return uint4(p % q.x, p % q.y, p % q.z, p % q.w); +} +static inline short2 operator%(short2 p, short2 q) +{ + return short2(p.x % q.x, p.y % q.y); +} +static inline short3 operator%(short3 p, short3 q) +{ + return short3(p.x % q.x, p.y % q.y, p.z % q.z); +} +static inline short4 operator%(short4 p, short4 q) +{ + return short4(p.x % q.x, p.y % q.y, p.z % q.z, p.w % q.w); +} +static inline short2 operator%(short2 p, short q) +{ + return short2(p.x % q, p.y % q); +} +static inline short3 operator%(short3 p, short q) +{ + return short3(p.x % q, p.y % q, p.z % q); +} +static inline short4 operator%(short4 p, short q) +{ + return short4(p.x % q, p.y % q, p.z % q, p.w % q); +} +static inline short2 operator%(short p, short2 q) +{ + return short2(p % q.x, p % q.y); +} +static inline short3 operator%(short p, short3 q) +{ + return short3(p % q.x, p % q.y, p % q.z); +} +static inline short4 operator%(short p, short4 q) +{ + return short4(p % q.x, p % q.y, p % q.z, p % q.w); +} +static inline ushort2 operator%(ushort2 p, ushort2 q) +{ + return ushort2(p.x % q.x, p.y % q.y); +} +static inline ushort3 operator%(ushort3 p, ushort3 q) +{ + return ushort3(p.x % q.x, p.y % q.y, p.z % q.z); +} +static inline ushort4 operator%(ushort4 p, ushort4 q) +{ + return ushort4(p.x % q.x, p.y % q.y, p.z % q.z, p.w % q.w); +} +static inline ushort2 operator%(ushort2 p, ushort q) +{ + return ushort2(p.x % q, p.y % q); +} +static inline ushort3 operator%(ushort3 p, ushort q) +{ + return ushort3(p.x % q, p.y % q, p.z % q); +} +static inline ushort4 operator%(ushort4 p, ushort q) +{ + return ushort4(p.x % q, p.y % q, p.z % q, p.w % q); +} +static inline ushort2 operator%(ushort p, ushort2 q) +{ + return ushort2(p % q.x, p % q.y); +} +static inline ushort3 operator%(ushort p, ushort3 q) +{ + return ushort3(p % q.x, p % q.y, p % q.z); +} +static inline ushort4 operator%(ushort p, ushort4 q) +{ + return ushort4(p % q.x, p % q.y, p % q.z, p % q.w); +} +static inline long2 operator%(long2 p, long2 q) +{ + return long2(p.x % q.x, p.y % q.y); +} +static inline long3 operator%(long3 p, long3 q) +{ + return long3(p.x % q.x, p.y % q.y, p.z % q.z); +} +static inline long4 operator%(long4 p, long4 q) +{ + return long4(p.x % q.x, p.y % q.y, p.z % q.z, p.w % q.w); +} +static inline long2 operator%(long2 p, long q) +{ + return long2(p.x % q, p.y % q); +} +static inline long3 operator%(long3 p, long q) +{ + return long3(p.x % q, p.y % q, p.z % q); +} +static inline long4 operator%(long4 p, long q) +{ + return long4(p.x % q, p.y % q, p.z % q, p.w % q); +} +static inline long2 operator%(long p, long2 q) +{ + return long2(p % q.x, p % q.y); +} +static inline long3 operator%(long p, long3 q) +{ + return long3(p % q.x, p % q.y, p % q.z); +} +static inline long4 operator%(long p, long4 q) +{ + return long4(p % q.x, p % q.y, p % q.z, p % q.w); +} +static inline ulong2 operator%(ulong2 p, ulong2 q) +{ + return ulong2(p.x % q.x, p.y % q.y); +} +static inline ulong3 operator%(ulong3 p, ulong3 q) +{ + return ulong3(p.x % q.x, p.y % q.y, p.z % q.z); +} +static inline ulong4 operator%(ulong4 p, ulong4 q) +{ + return ulong4(p.x % q.x, p.y % q.y, p.z % q.z, p.w % q.w); +} +static inline ulong2 operator%(ulong2 p, ulong q) +{ + return ulong2(p.x % q, p.y % q); +} +static inline ulong3 operator%(ulong3 p, ulong q) +{ + return ulong3(p.x % q, p.y % q, p.z % q); +} +static inline ulong4 operator%(ulong4 p, ulong q) +{ + return ulong4(p.x % q, p.y % q, p.z % q, p.w % q); +} +static inline ulong2 operator%(ulong p, ulong2 q) +{ + return ulong2(p % q.x, p % q.y); +} +static inline ulong3 operator%(ulong p, ulong3 q) +{ + return ulong3(p % q.x, p % q.y, p % q.z); +} +static inline ulong4 operator%(ulong p, ulong4 q) +{ + return ulong4(p % q.x, p % q.y, p % q.z, p % q.w); +} +static inline int2 operator&(int2 p, int2 q) +{ + return int2(p.x & q.x, p.y & q.y); +} +static inline int3 operator&(int3 p, int3 q) +{ + return int3(p.x & q.x, p.y & q.y, p.z & q.z); +} +static inline int4 operator&(int4 p, int4 q) +{ + return int4(p.x & q.x, p.y & q.y, p.z & q.z, p.w & q.w); +} +static inline int2 operator&(int2 p, int q) +{ + return int2(p.x & q, p.y & q); +} +static inline int3 operator&(int3 p, int q) +{ + return int3(p.x & q, p.y & q, p.z & q); +} +static inline int4 operator&(int4 p, int q) +{ + return int4(p.x & q, p.y & q, p.z & q, p.w & q); +} +static inline int2 operator&(int p, int2 q) +{ + return int2(p & q.x, p & q.y); +} +static inline int3 operator&(int p, int3 q) +{ + return int3(p & q.x, p & q.y, p & q.z); +} +static inline int4 operator&(int p, int4 q) +{ + return int4(p & q.x, p & q.y, p & q.z, p & q.w); +} +static inline uint2 operator&(uint2 p, uint2 q) +{ + return uint2(p.x & q.x, p.y & q.y); +} +static inline uint3 operator&(uint3 p, uint3 q) +{ + return uint3(p.x & q.x, p.y & q.y, p.z & q.z); +} +static inline uint4 operator&(uint4 p, uint4 q) +{ + return uint4(p.x & q.x, p.y & q.y, p.z & q.z, p.w & q.w); +} +static inline uint2 operator&(uint2 p, uint q) +{ + return uint2(p.x & q, p.y & q); +} +static inline uint3 operator&(uint3 p, uint q) +{ + return uint3(p.x & q, p.y & q, p.z & q); +} +static inline uint4 operator&(uint4 p, uint q) +{ + return uint4(p.x & q, p.y & q, p.z & q, p.w & q); +} +static inline uint2 operator&(uint p, uint2 q) +{ + return uint2(p & q.x, p & q.y); +} +static inline uint3 operator&(uint p, uint3 q) +{ + return uint3(p & q.x, p & q.y, p & q.z); +} +static inline uint4 operator&(uint p, uint4 q) +{ + return uint4(p & q.x, p & q.y, p & q.z, p & q.w); +} +static inline short2 operator&(short2 p, short2 q) +{ + return short2(p.x & q.x, p.y & q.y); +} +static inline short3 operator&(short3 p, short3 q) +{ + return short3(p.x & q.x, p.y & q.y, p.z & q.z); +} +static inline short4 operator&(short4 p, short4 q) +{ + return short4(p.x & q.x, p.y & q.y, p.z & q.z, p.w & q.w); +} +static inline short2 operator&(short2 p, short q) +{ + return short2(p.x & q, p.y & q); +} +static inline short3 operator&(short3 p, short q) +{ + return short3(p.x & q, p.y & q, p.z & q); +} +static inline short4 operator&(short4 p, short q) +{ + return short4(p.x & q, p.y & q, p.z & q, p.w & q); +} +static inline short2 operator&(short p, short2 q) +{ + return short2(p & q.x, p & q.y); +} +static inline short3 operator&(short p, short3 q) +{ + return short3(p & q.x, p & q.y, p & q.z); +} +static inline short4 operator&(short p, short4 q) +{ + return short4(p & q.x, p & q.y, p & q.z, p & q.w); +} +static inline ushort2 operator&(ushort2 p, ushort2 q) +{ + return ushort2(p.x & q.x, p.y & q.y); +} +static inline ushort3 operator&(ushort3 p, ushort3 q) +{ + return ushort3(p.x & q.x, p.y & q.y, p.z & q.z); +} +static inline ushort4 operator&(ushort4 p, ushort4 q) +{ + return ushort4(p.x & q.x, p.y & q.y, p.z & q.z, p.w & q.w); +} +static inline ushort2 operator&(ushort2 p, ushort q) +{ + return ushort2(p.x & q, p.y & q); +} +static inline ushort3 operator&(ushort3 p, ushort q) +{ + return ushort3(p.x & q, p.y & q, p.z & q); +} +static inline ushort4 operator&(ushort4 p, ushort q) +{ + return ushort4(p.x & q, p.y & q, p.z & q, p.w & q); +} +static inline ushort2 operator&(ushort p, ushort2 q) +{ + return ushort2(p & q.x, p & q.y); +} +static inline ushort3 operator&(ushort p, ushort3 q) +{ + return ushort3(p & q.x, p & q.y, p & q.z); +} +static inline ushort4 operator&(ushort p, ushort4 q) +{ + return ushort4(p & q.x, p & q.y, p & q.z, p & q.w); +} +static inline long2 operator&(long2 p, long2 q) +{ + return long2(p.x & q.x, p.y & q.y); +} +static inline long3 operator&(long3 p, long3 q) +{ + return long3(p.x & q.x, p.y & q.y, p.z & q.z); +} +static inline long4 operator&(long4 p, long4 q) +{ + return long4(p.x & q.x, p.y & q.y, p.z & q.z, p.w & q.w); +} +static inline long2 operator&(long2 p, long q) +{ + return long2(p.x & q, p.y & q); +} +static inline long3 operator&(long3 p, long q) +{ + return long3(p.x & q, p.y & q, p.z & q); +} +static inline long4 operator&(long4 p, long q) +{ + return long4(p.x & q, p.y & q, p.z & q, p.w & q); +} +static inline long2 operator&(long p, long2 q) +{ + return long2(p & q.x, p & q.y); +} +static inline long3 operator&(long p, long3 q) +{ + return long3(p & q.x, p & q.y, p & q.z); +} +static inline long4 operator&(long p, long4 q) +{ + return long4(p & q.x, p & q.y, p & q.z, p & q.w); +} +static inline ulong2 operator&(ulong2 p, ulong2 q) +{ + return ulong2(p.x & q.x, p.y & q.y); +} +static inline ulong3 operator&(ulong3 p, ulong3 q) +{ + return ulong3(p.x & q.x, p.y & q.y, p.z & q.z); +} +static inline ulong4 operator&(ulong4 p, ulong4 q) +{ + return ulong4(p.x & q.x, p.y & q.y, p.z & q.z, p.w & q.w); +} +static inline ulong2 operator&(ulong2 p, ulong q) +{ + return ulong2(p.x & q, p.y & q); +} +static inline ulong3 operator&(ulong3 p, ulong q) +{ + return ulong3(p.x & q, p.y & q, p.z & q); +} +static inline ulong4 operator&(ulong4 p, ulong q) +{ + return ulong4(p.x & q, p.y & q, p.z & q, p.w & q); +} +static inline ulong2 operator&(ulong p, ulong2 q) +{ + return ulong2(p & q.x, p & q.y); +} +static inline ulong3 operator&(ulong p, ulong3 q) +{ + return ulong3(p & q.x, p & q.y, p & q.z); +} +static inline ulong4 operator&(ulong p, ulong4 q) +{ + return ulong4(p & q.x, p & q.y, p & q.z, p & q.w); +} +static inline int2 operator|(int2 p, int2 q) +{ + return int2(p.x | q.x, p.y | q.y); +} +static inline int3 operator|(int3 p, int3 q) +{ + return int3(p.x | q.x, p.y | q.y, p.z | q.z); +} +static inline int4 operator|(int4 p, int4 q) +{ + return int4(p.x | q.x, p.y | q.y, p.z | q.z, p.w | q.w); +} +static inline int2 operator|(int2 p, int q) +{ + return int2(p.x | q, p.y | q); +} +static inline int3 operator|(int3 p, int q) +{ + return int3(p.x | q, p.y | q, p.z | q); +} +static inline int4 operator|(int4 p, int q) +{ + return int4(p.x | q, p.y | q, p.z | q, p.w | q); +} +static inline int2 operator|(int p, int2 q) +{ + return int2(p | q.x, p | q.y); +} +static inline int3 operator|(int p, int3 q) +{ + return int3(p | q.x, p | q.y, p | q.z); +} +static inline int4 operator|(int p, int4 q) +{ + return int4(p | q.x, p | q.y, p | q.z, p | q.w); +} +static inline uint2 operator|(uint2 p, uint2 q) +{ + return uint2(p.x | q.x, p.y | q.y); +} +static inline uint3 operator|(uint3 p, uint3 q) +{ + return uint3(p.x | q.x, p.y | q.y, p.z | q.z); +} +static inline uint4 operator|(uint4 p, uint4 q) +{ + return uint4(p.x | q.x, p.y | q.y, p.z | q.z, p.w | q.w); +} +static inline uint2 operator|(uint2 p, uint q) +{ + return uint2(p.x | q, p.y | q); +} +static inline uint3 operator|(uint3 p, uint q) +{ + return uint3(p.x | q, p.y | q, p.z | q); +} +static inline uint4 operator|(uint4 p, uint q) +{ + return uint4(p.x | q, p.y | q, p.z | q, p.w | q); +} +static inline uint2 operator|(uint p, uint2 q) +{ + return uint2(p | q.x, p | q.y); +} +static inline uint3 operator|(uint p, uint3 q) +{ + return uint3(p | q.x, p | q.y, p | q.z); +} +static inline uint4 operator|(uint p, uint4 q) +{ + return uint4(p | q.x, p | q.y, p | q.z, p | q.w); +} +static inline short2 operator|(short2 p, short2 q) +{ + return short2(p.x | q.x, p.y | q.y); +} +static inline short3 operator|(short3 p, short3 q) +{ + return short3(p.x | q.x, p.y | q.y, p.z | q.z); +} +static inline short4 operator|(short4 p, short4 q) +{ + return short4(p.x | q.x, p.y | q.y, p.z | q.z, p.w | q.w); +} +static inline short2 operator|(short2 p, short q) +{ + return short2(p.x | q, p.y | q); +} +static inline short3 operator|(short3 p, short q) +{ + return short3(p.x | q, p.y | q, p.z | q); +} +static inline short4 operator|(short4 p, short q) +{ + return short4(p.x | q, p.y | q, p.z | q, p.w | q); +} +static inline short2 operator|(short p, short2 q) +{ + return short2(p | q.x, p | q.y); +} +static inline short3 operator|(short p, short3 q) +{ + return short3(p | q.x, p | q.y, p | q.z); +} +static inline short4 operator|(short p, short4 q) +{ + return short4(p | q.x, p | q.y, p | q.z, p | q.w); +} +static inline ushort2 operator|(ushort2 p, ushort2 q) +{ + return ushort2(p.x | q.x, p.y | q.y); +} +static inline ushort3 operator|(ushort3 p, ushort3 q) +{ + return ushort3(p.x | q.x, p.y | q.y, p.z | q.z); +} +static inline ushort4 operator|(ushort4 p, ushort4 q) +{ + return ushort4(p.x | q.x, p.y | q.y, p.z | q.z, p.w | q.w); +} +static inline ushort2 operator|(ushort2 p, ushort q) +{ + return ushort2(p.x | q, p.y | q); +} +static inline ushort3 operator|(ushort3 p, ushort q) +{ + return ushort3(p.x | q, p.y | q, p.z | q); +} +static inline ushort4 operator|(ushort4 p, ushort q) +{ + return ushort4(p.x | q, p.y | q, p.z | q, p.w | q); +} +static inline ushort2 operator|(ushort p, ushort2 q) +{ + return ushort2(p | q.x, p | q.y); +} +static inline ushort3 operator|(ushort p, ushort3 q) +{ + return ushort3(p | q.x, p | q.y, p | q.z); +} +static inline ushort4 operator|(ushort p, ushort4 q) +{ + return ushort4(p | q.x, p | q.y, p | q.z, p | q.w); +} +static inline long2 operator|(long2 p, long2 q) +{ + return long2(p.x | q.x, p.y | q.y); +} +static inline long3 operator|(long3 p, long3 q) +{ + return long3(p.x | q.x, p.y | q.y, p.z | q.z); +} +static inline long4 operator|(long4 p, long4 q) +{ + return long4(p.x | q.x, p.y | q.y, p.z | q.z, p.w | q.w); +} +static inline long2 operator|(long2 p, long q) +{ + return long2(p.x | q, p.y | q); +} +static inline long3 operator|(long3 p, long q) +{ + return long3(p.x | q, p.y | q, p.z | q); +} +static inline long4 operator|(long4 p, long q) +{ + return long4(p.x | q, p.y | q, p.z | q, p.w | q); +} +static inline long2 operator|(long p, long2 q) +{ + return long2(p | q.x, p | q.y); +} +static inline long3 operator|(long p, long3 q) +{ + return long3(p | q.x, p | q.y, p | q.z); +} +static inline long4 operator|(long p, long4 q) +{ + return long4(p | q.x, p | q.y, p | q.z, p | q.w); +} +static inline ulong2 operator|(ulong2 p, ulong2 q) +{ + return ulong2(p.x | q.x, p.y | q.y); +} +static inline ulong3 operator|(ulong3 p, ulong3 q) +{ + return ulong3(p.x | q.x, p.y | q.y, p.z | q.z); +} +static inline ulong4 operator|(ulong4 p, ulong4 q) +{ + return ulong4(p.x | q.x, p.y | q.y, p.z | q.z, p.w | q.w); +} +static inline ulong2 operator|(ulong2 p, ulong q) +{ + return ulong2(p.x | q, p.y | q); +} +static inline ulong3 operator|(ulong3 p, ulong q) +{ + return ulong3(p.x | q, p.y | q, p.z | q); +} +static inline ulong4 operator|(ulong4 p, ulong q) +{ + return ulong4(p.x | q, p.y | q, p.z | q, p.w | q); +} +static inline ulong2 operator|(ulong p, ulong2 q) +{ + return ulong2(p | q.x, p | q.y); +} +static inline ulong3 operator|(ulong p, ulong3 q) +{ + return ulong3(p | q.x, p | q.y, p | q.z); +} +static inline ulong4 operator|(ulong p, ulong4 q) +{ + return ulong4(p | q.x, p | q.y, p | q.z, p | q.w); +} +static inline int2 operator^(int2 p, int2 q) +{ + return int2(p.x ^ q.x, p.y ^ q.y); +} +static inline int3 operator^(int3 p, int3 q) +{ + return int3(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z); +} +static inline int4 operator^(int4 p, int4 q) +{ + return int4(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z, p.w ^ q.w); +} +static inline int2 operator^(int2 p, int q) +{ + return int2(p.x ^ q, p.y ^ q); +} +static inline int3 operator^(int3 p, int q) +{ + return int3(p.x ^ q, p.y ^ q, p.z ^ q); +} +static inline int4 operator^(int4 p, int q) +{ + return int4(p.x ^ q, p.y ^ q, p.z ^ q, p.w ^ q); +} +static inline int2 operator^(int p, int2 q) +{ + return int2(p ^ q.x, p ^ q.y); +} +static inline int3 operator^(int p, int3 q) +{ + return int3(p ^ q.x, p ^ q.y, p ^ q.z); +} +static inline int4 operator^(int p, int4 q) +{ + return int4(p ^ q.x, p ^ q.y, p ^ q.z, p ^ q.w); +} +static inline uint2 operator^(uint2 p, uint2 q) +{ + return uint2(p.x ^ q.x, p.y ^ q.y); +} +static inline uint3 operator^(uint3 p, uint3 q) +{ + return uint3(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z); +} +static inline uint4 operator^(uint4 p, uint4 q) +{ + return uint4(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z, p.w ^ q.w); +} +static inline uint2 operator^(uint2 p, uint q) +{ + return uint2(p.x ^ q, p.y ^ q); +} +static inline uint3 operator^(uint3 p, uint q) +{ + return uint3(p.x ^ q, p.y ^ q, p.z ^ q); +} +static inline uint4 operator^(uint4 p, uint q) +{ + return uint4(p.x ^ q, p.y ^ q, p.z ^ q, p.w ^ q); +} +static inline uint2 operator^(uint p, uint2 q) +{ + return uint2(p ^ q.x, p ^ q.y); +} +static inline uint3 operator^(uint p, uint3 q) +{ + return uint3(p ^ q.x, p ^ q.y, p ^ q.z); +} +static inline uint4 operator^(uint p, uint4 q) +{ + return uint4(p ^ q.x, p ^ q.y, p ^ q.z, p ^ q.w); +} +static inline short2 operator^(short2 p, short2 q) +{ + return short2(p.x ^ q.x, p.y ^ q.y); +} +static inline short3 operator^(short3 p, short3 q) +{ + return short3(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z); +} +static inline short4 operator^(short4 p, short4 q) +{ + return short4(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z, p.w ^ q.w); +} +static inline short2 operator^(short2 p, short q) +{ + return short2(p.x ^ q, p.y ^ q); +} +static inline short3 operator^(short3 p, short q) +{ + return short3(p.x ^ q, p.y ^ q, p.z ^ q); +} +static inline short4 operator^(short4 p, short q) +{ + return short4(p.x ^ q, p.y ^ q, p.z ^ q, p.w ^ q); +} +static inline short2 operator^(short p, short2 q) +{ + return short2(p ^ q.x, p ^ q.y); +} +static inline short3 operator^(short p, short3 q) +{ + return short3(p ^ q.x, p ^ q.y, p ^ q.z); +} +static inline short4 operator^(short p, short4 q) +{ + return short4(p ^ q.x, p ^ q.y, p ^ q.z, p ^ q.w); +} +static inline ushort2 operator^(ushort2 p, ushort2 q) +{ + return ushort2(p.x ^ q.x, p.y ^ q.y); +} +static inline ushort3 operator^(ushort3 p, ushort3 q) +{ + return ushort3(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z); +} +static inline ushort4 operator^(ushort4 p, ushort4 q) +{ + return ushort4(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z, p.w ^ q.w); +} +static inline ushort2 operator^(ushort2 p, ushort q) +{ + return ushort2(p.x ^ q, p.y ^ q); +} +static inline ushort3 operator^(ushort3 p, ushort q) +{ + return ushort3(p.x ^ q, p.y ^ q, p.z ^ q); +} +static inline ushort4 operator^(ushort4 p, ushort q) +{ + return ushort4(p.x ^ q, p.y ^ q, p.z ^ q, p.w ^ q); +} +static inline ushort2 operator^(ushort p, ushort2 q) +{ + return ushort2(p ^ q.x, p ^ q.y); +} +static inline ushort3 operator^(ushort p, ushort3 q) +{ + return ushort3(p ^ q.x, p ^ q.y, p ^ q.z); +} +static inline ushort4 operator^(ushort p, ushort4 q) +{ + return ushort4(p ^ q.x, p ^ q.y, p ^ q.z, p ^ q.w); +} +static inline long2 operator^(long2 p, long2 q) +{ + return long2(p.x ^ q.x, p.y ^ q.y); +} +static inline long3 operator^(long3 p, long3 q) +{ + return long3(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z); +} +static inline long4 operator^(long4 p, long4 q) +{ + return long4(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z, p.w ^ q.w); +} +static inline long2 operator^(long2 p, long q) +{ + return long2(p.x ^ q, p.y ^ q); +} +static inline long3 operator^(long3 p, long q) +{ + return long3(p.x ^ q, p.y ^ q, p.z ^ q); +} +static inline long4 operator^(long4 p, long q) +{ + return long4(p.x ^ q, p.y ^ q, p.z ^ q, p.w ^ q); +} +static inline long2 operator^(long p, long2 q) +{ + return long2(p ^ q.x, p ^ q.y); +} +static inline long3 operator^(long p, long3 q) +{ + return long3(p ^ q.x, p ^ q.y, p ^ q.z); +} +static inline long4 operator^(long p, long4 q) +{ + return long4(p ^ q.x, p ^ q.y, p ^ q.z, p ^ q.w); +} +static inline ulong2 operator^(ulong2 p, ulong2 q) +{ + return ulong2(p.x ^ q.x, p.y ^ q.y); +} +static inline ulong3 operator^(ulong3 p, ulong3 q) +{ + return ulong3(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z); +} +static inline ulong4 operator^(ulong4 p, ulong4 q) +{ + return ulong4(p.x ^ q.x, p.y ^ q.y, p.z ^ q.z, p.w ^ q.w); +} +static inline ulong2 operator^(ulong2 p, ulong q) +{ + return ulong2(p.x ^ q, p.y ^ q); +} +static inline ulong3 operator^(ulong3 p, ulong q) +{ + return ulong3(p.x ^ q, p.y ^ q, p.z ^ q); +} +static inline ulong4 operator^(ulong4 p, ulong q) +{ + return ulong4(p.x ^ q, p.y ^ q, p.z ^ q, p.w ^ q); +} +static inline ulong2 operator^(ulong p, ulong2 q) +{ + return ulong2(p ^ q.x, p ^ q.y); +} +static inline ulong3 operator^(ulong p, ulong3 q) +{ + return ulong3(p ^ q.x, p ^ q.y, p ^ q.z); +} +static inline ulong4 operator^(ulong p, ulong4 q) +{ + return ulong4(p ^ q.x, p ^ q.y, p ^ q.z, p ^ q.w); +} +static inline int2 operator<<(int2 p, int2 q) +{ + return int2(p.x << q.x, p.y << q.y); +} +static inline int3 operator<<(int3 p, int3 q) +{ + return int3(p.x << q.x, p.y << q.y, p.z << q.z); +} +static inline int4 operator<<(int4 p, int4 q) +{ + return int4(p.x << q.x, p.y << q.y, p.z << q.z, p.w << q.w); +} +static inline int2 operator<<(int2 p, int q) +{ + return int2(p.x << q, p.y << q); +} +static inline int3 operator<<(int3 p, int q) +{ + return int3(p.x << q, p.y << q, p.z << q); +} +static inline int4 operator<<(int4 p, int q) +{ + return int4(p.x << q, p.y << q, p.z << q, p.w << q); +} +static inline int2 operator<<(int p, int2 q) +{ + return int2(p << q.x, p << q.y); +} +static inline int3 operator<<(int p, int3 q) +{ + return int3(p << q.x, p << q.y, p << q.z); +} +static inline int4 operator<<(int p, int4 q) +{ + return int4(p << q.x, p << q.y, p << q.z, p << q.w); +} +static inline uint2 operator<<(uint2 p, uint2 q) +{ + return uint2(p.x << q.x, p.y << q.y); +} +static inline uint3 operator<<(uint3 p, uint3 q) +{ + return uint3(p.x << q.x, p.y << q.y, p.z << q.z); +} +static inline uint4 operator<<(uint4 p, uint4 q) +{ + return uint4(p.x << q.x, p.y << q.y, p.z << q.z, p.w << q.w); +} +static inline uint2 operator<<(uint2 p, uint q) +{ + return uint2(p.x << q, p.y << q); +} +static inline uint3 operator<<(uint3 p, uint q) +{ + return uint3(p.x << q, p.y << q, p.z << q); +} +static inline uint4 operator<<(uint4 p, uint q) +{ + return uint4(p.x << q, p.y << q, p.z << q, p.w << q); +} +static inline uint2 operator<<(uint p, uint2 q) +{ + return uint2(p << q.x, p << q.y); +} +static inline uint3 operator<<(uint p, uint3 q) +{ + return uint3(p << q.x, p << q.y, p << q.z); +} +static inline uint4 operator<<(uint p, uint4 q) +{ + return uint4(p << q.x, p << q.y, p << q.z, p << q.w); +} +static inline short2 operator<<(short2 p, short2 q) +{ + return short2(p.x << q.x, p.y << q.y); +} +static inline short3 operator<<(short3 p, short3 q) +{ + return short3(p.x << q.x, p.y << q.y, p.z << q.z); +} +static inline short4 operator<<(short4 p, short4 q) +{ + return short4(p.x << q.x, p.y << q.y, p.z << q.z, p.w << q.w); +} +static inline short2 operator<<(short2 p, short q) +{ + return short2(p.x << q, p.y << q); +} +static inline short3 operator<<(short3 p, short q) +{ + return short3(p.x << q, p.y << q, p.z << q); +} +static inline short4 operator<<(short4 p, short q) +{ + return short4(p.x << q, p.y << q, p.z << q, p.w << q); +} +static inline short2 operator<<(short p, short2 q) +{ + return short2(p << q.x, p << q.y); +} +static inline short3 operator<<(short p, short3 q) +{ + return short3(p << q.x, p << q.y, p << q.z); +} +static inline short4 operator<<(short p, short4 q) +{ + return short4(p << q.x, p << q.y, p << q.z, p << q.w); +} +static inline ushort2 operator<<(ushort2 p, ushort2 q) +{ + return ushort2(p.x << q.x, p.y << q.y); +} +static inline ushort3 operator<<(ushort3 p, ushort3 q) +{ + return ushort3(p.x << q.x, p.y << q.y, p.z << q.z); +} +static inline ushort4 operator<<(ushort4 p, ushort4 q) +{ + return ushort4(p.x << q.x, p.y << q.y, p.z << q.z, p.w << q.w); +} +static inline ushort2 operator<<(ushort2 p, ushort q) +{ + return ushort2(p.x << q, p.y << q); +} +static inline ushort3 operator<<(ushort3 p, ushort q) +{ + return ushort3(p.x << q, p.y << q, p.z << q); +} +static inline ushort4 operator<<(ushort4 p, ushort q) +{ + return ushort4(p.x << q, p.y << q, p.z << q, p.w << q); +} +static inline ushort2 operator<<(ushort p, ushort2 q) +{ + return ushort2(p << q.x, p << q.y); +} +static inline ushort3 operator<<(ushort p, ushort3 q) +{ + return ushort3(p << q.x, p << q.y, p << q.z); +} +static inline ushort4 operator<<(ushort p, ushort4 q) +{ + return ushort4(p << q.x, p << q.y, p << q.z, p << q.w); +} +static inline long2 operator<<(long2 p, long2 q) +{ + return long2(p.x << q.x, p.y << q.y); +} +static inline long3 operator<<(long3 p, long3 q) +{ + return long3(p.x << q.x, p.y << q.y, p.z << q.z); +} +static inline long4 operator<<(long4 p, long4 q) +{ + return long4(p.x << q.x, p.y << q.y, p.z << q.z, p.w << q.w); +} +static inline long2 operator<<(long2 p, long q) +{ + return long2(p.x << q, p.y << q); +} +static inline long3 operator<<(long3 p, long q) +{ + return long3(p.x << q, p.y << q, p.z << q); +} +static inline long4 operator<<(long4 p, long q) +{ + return long4(p.x << q, p.y << q, p.z << q, p.w << q); +} +static inline long2 operator<<(long p, long2 q) +{ + return long2(p << q.x, p << q.y); +} +static inline long3 operator<<(long p, long3 q) +{ + return long3(p << q.x, p << q.y, p << q.z); +} +static inline long4 operator<<(long p, long4 q) +{ + return long4(p << q.x, p << q.y, p << q.z, p << q.w); +} +static inline ulong2 operator<<(ulong2 p, ulong2 q) +{ + return ulong2(p.x << q.x, p.y << q.y); +} +static inline ulong3 operator<<(ulong3 p, ulong3 q) +{ + return ulong3(p.x << q.x, p.y << q.y, p.z << q.z); +} +static inline ulong4 operator<<(ulong4 p, ulong4 q) +{ + return ulong4(p.x << q.x, p.y << q.y, p.z << q.z, p.w << q.w); +} +static inline ulong2 operator<<(ulong2 p, ulong q) +{ + return ulong2(p.x << q, p.y << q); +} +static inline ulong3 operator<<(ulong3 p, ulong q) +{ + return ulong3(p.x << q, p.y << q, p.z << q); +} +static inline ulong4 operator<<(ulong4 p, ulong q) +{ + return ulong4(p.x << q, p.y << q, p.z << q, p.w << q); +} +static inline ulong2 operator<<(ulong p, ulong2 q) +{ + return ulong2(p << q.x, p << q.y); +} +static inline ulong3 operator<<(ulong p, ulong3 q) +{ + return ulong3(p << q.x, p << q.y, p << q.z); +} +static inline ulong4 operator<<(ulong p, ulong4 q) +{ + return ulong4(p << q.x, p << q.y, p << q.z, p << q.w); +} +static inline int2 operator>>(int2 p, int2 q) +{ + return int2(p.x >> q.x, p.y >> q.y); +} +static inline int3 operator>>(int3 p, int3 q) +{ + return int3(p.x >> q.x, p.y >> q.y, p.z >> q.z); +} +static inline int4 operator>>(int4 p, int4 q) +{ + return int4(p.x >> q.x, p.y >> q.y, p.z >> q.z, p.w >> q.w); +} +static inline int2 operator>>(int2 p, int q) +{ + return int2(p.x >> q, p.y >> q); +} +static inline int3 operator>>(int3 p, int q) +{ + return int3(p.x >> q, p.y >> q, p.z >> q); +} +static inline int4 operator>>(int4 p, int q) +{ + return int4(p.x >> q, p.y >> q, p.z >> q, p.w >> q); +} +static inline int2 operator>>(int p, int2 q) +{ + return int2(p >> q.x, p >> q.y); +} +static inline int3 operator>>(int p, int3 q) +{ + return int3(p >> q.x, p >> q.y, p >> q.z); +} +static inline int4 operator>>(int p, int4 q) +{ + return int4(p >> q.x, p >> q.y, p >> q.z, p >> q.w); +} +static inline uint2 operator>>(uint2 p, uint2 q) +{ + return uint2(p.x >> q.x, p.y >> q.y); +} +static inline uint3 operator>>(uint3 p, uint3 q) +{ + return uint3(p.x >> q.x, p.y >> q.y, p.z >> q.z); +} +static inline uint4 operator>>(uint4 p, uint4 q) +{ + return uint4(p.x >> q.x, p.y >> q.y, p.z >> q.z, p.w >> q.w); +} +static inline uint2 operator>>(uint2 p, uint q) +{ + return uint2(p.x >> q, p.y >> q); +} +static inline uint3 operator>>(uint3 p, uint q) +{ + return uint3(p.x >> q, p.y >> q, p.z >> q); +} +static inline uint4 operator>>(uint4 p, uint q) +{ + return uint4(p.x >> q, p.y >> q, p.z >> q, p.w >> q); +} +static inline uint2 operator>>(uint p, uint2 q) +{ + return uint2(p >> q.x, p >> q.y); +} +static inline uint3 operator>>(uint p, uint3 q) +{ + return uint3(p >> q.x, p >> q.y, p >> q.z); +} +static inline uint4 operator>>(uint p, uint4 q) +{ + return uint4(p >> q.x, p >> q.y, p >> q.z, p >> q.w); +} +static inline short2 operator>>(short2 p, short2 q) +{ + return short2(p.x >> q.x, p.y >> q.y); +} +static inline short3 operator>>(short3 p, short3 q) +{ + return short3(p.x >> q.x, p.y >> q.y, p.z >> q.z); +} +static inline short4 operator>>(short4 p, short4 q) +{ + return short4(p.x >> q.x, p.y >> q.y, p.z >> q.z, p.w >> q.w); +} +static inline short2 operator>>(short2 p, short q) +{ + return short2(p.x >> q, p.y >> q); +} +static inline short3 operator>>(short3 p, short q) +{ + return short3(p.x >> q, p.y >> q, p.z >> q); +} +static inline short4 operator>>(short4 p, short q) +{ + return short4(p.x >> q, p.y >> q, p.z >> q, p.w >> q); +} +static inline short2 operator>>(short p, short2 q) +{ + return short2(p >> q.x, p >> q.y); +} +static inline short3 operator>>(short p, short3 q) +{ + return short3(p >> q.x, p >> q.y, p >> q.z); +} +static inline short4 operator>>(short p, short4 q) +{ + return short4(p >> q.x, p >> q.y, p >> q.z, p >> q.w); +} +static inline ushort2 operator>>(ushort2 p, ushort2 q) +{ + return ushort2(p.x >> q.x, p.y >> q.y); +} +static inline ushort3 operator>>(ushort3 p, ushort3 q) +{ + return ushort3(p.x >> q.x, p.y >> q.y, p.z >> q.z); +} +static inline ushort4 operator>>(ushort4 p, ushort4 q) +{ + return ushort4(p.x >> q.x, p.y >> q.y, p.z >> q.z, p.w >> q.w); +} +static inline ushort2 operator>>(ushort2 p, ushort q) +{ + return ushort2(p.x >> q, p.y >> q); +} +static inline ushort3 operator>>(ushort3 p, ushort q) +{ + return ushort3(p.x >> q, p.y >> q, p.z >> q); +} +static inline ushort4 operator>>(ushort4 p, ushort q) +{ + return ushort4(p.x >> q, p.y >> q, p.z >> q, p.w >> q); +} +static inline ushort2 operator>>(ushort p, ushort2 q) +{ + return ushort2(p >> q.x, p >> q.y); +} +static inline ushort3 operator>>(ushort p, ushort3 q) +{ + return ushort3(p >> q.x, p >> q.y, p >> q.z); +} +static inline ushort4 operator>>(ushort p, ushort4 q) +{ + return ushort4(p >> q.x, p >> q.y, p >> q.z, p >> q.w); +} +static inline long2 operator>>(long2 p, long2 q) +{ + return long2(p.x >> q.x, p.y >> q.y); +} +static inline long3 operator>>(long3 p, long3 q) +{ + return long3(p.x >> q.x, p.y >> q.y, p.z >> q.z); +} +static inline long4 operator>>(long4 p, long4 q) +{ + return long4(p.x >> q.x, p.y >> q.y, p.z >> q.z, p.w >> q.w); +} +static inline long2 operator>>(long2 p, long q) +{ + return long2(p.x >> q, p.y >> q); +} +static inline long3 operator>>(long3 p, long q) +{ + return long3(p.x >> q, p.y >> q, p.z >> q); +} +static inline long4 operator>>(long4 p, long q) +{ + return long4(p.x >> q, p.y >> q, p.z >> q, p.w >> q); +} +static inline long2 operator>>(long p, long2 q) +{ + return long2(p >> q.x, p >> q.y); +} +static inline long3 operator>>(long p, long3 q) +{ + return long3(p >> q.x, p >> q.y, p >> q.z); +} +static inline long4 operator>>(long p, long4 q) +{ + return long4(p >> q.x, p >> q.y, p >> q.z, p >> q.w); +} +static inline ulong2 operator>>(ulong2 p, ulong2 q) +{ + return ulong2(p.x >> q.x, p.y >> q.y); +} +static inline ulong3 operator>>(ulong3 p, ulong3 q) +{ + return ulong3(p.x >> q.x, p.y >> q.y, p.z >> q.z); +} +static inline ulong4 operator>>(ulong4 p, ulong4 q) +{ + return ulong4(p.x >> q.x, p.y >> q.y, p.z >> q.z, p.w >> q.w); +} +static inline ulong2 operator>>(ulong2 p, ulong q) +{ + return ulong2(p.x >> q, p.y >> q); +} +static inline ulong3 operator>>(ulong3 p, ulong q) +{ + return ulong3(p.x >> q, p.y >> q, p.z >> q); +} +static inline ulong4 operator>>(ulong4 p, ulong q) +{ + return ulong4(p.x >> q, p.y >> q, p.z >> q, p.w >> q); +} +static inline ulong2 operator>>(ulong p, ulong2 q) +{ + return ulong2(p >> q.x, p >> q.y); +} +static inline ulong3 operator>>(ulong p, ulong3 q) +{ + return ulong3(p >> q.x, p >> q.y, p >> q.z); +} +static inline ulong4 operator>>(ulong p, ulong4 q) +{ + return ulong4(p >> q.x, p >> q.y, p >> q.z, p >> q.w); +} +static inline int2 operator==(float2 p, float2 q) +{ + return int2(p.x == q.x, p.y == q.y); +} +static inline int3 operator==(float3 p, float3 q) +{ + return int3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline int4 operator==(float4 p, float4 q) +{ + return int4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline int2 operator==(float2 p, float q) +{ + return int2(p.x == q, p.y == q); +} +static inline int3 operator==(float3 p, float q) +{ + return int3(p.x == q, p.y == q, p.z == q); +} +static inline int4 operator==(float4 p, float q) +{ + return int4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline int2 operator==(float p, float2 q) +{ + return int2(p == q.x, p == q.y); +} +static inline int3 operator==(float p, float3 q) +{ + return int3(p == q.x, p == q.y, p == q.z); +} +static inline int4 operator==(float p, float4 q) +{ + return int4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline long2 operator==(double2 p, double2 q) +{ + return long2(p.x == q.x, p.y == q.y); +} +static inline long3 operator==(double3 p, double3 q) +{ + return long3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline long4 operator==(double4 p, double4 q) +{ + return long4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline long2 operator==(double2 p, double q) +{ + return long2(p.x == q, p.y == q); +} +static inline long3 operator==(double3 p, double q) +{ + return long3(p.x == q, p.y == q, p.z == q); +} +static inline long4 operator==(double4 p, double q) +{ + return long4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline long2 operator==(double p, double2 q) +{ + return long2(p == q.x, p == q.y); +} +static inline long3 operator==(double p, double3 q) +{ + return long3(p == q.x, p == q.y, p == q.z); +} +static inline long4 operator==(double p, double4 q) +{ + return long4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline int2 operator==(int2 p, int2 q) +{ + return int2(p.x == q.x, p.y == q.y); +} +static inline int3 operator==(int3 p, int3 q) +{ + return int3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline int4 operator==(int4 p, int4 q) +{ + return int4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline int2 operator==(int2 p, int q) +{ + return int2(p.x == q, p.y == q); +} +static inline int3 operator==(int3 p, int q) +{ + return int3(p.x == q, p.y == q, p.z == q); +} +static inline int4 operator==(int4 p, int q) +{ + return int4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline int2 operator==(int p, int2 q) +{ + return int2(p == q.x, p == q.y); +} +static inline int3 operator==(int p, int3 q) +{ + return int3(p == q.x, p == q.y, p == q.z); +} +static inline int4 operator==(int p, int4 q) +{ + return int4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline int2 operator==(uint2 p, uint2 q) +{ + return int2(p.x == q.x, p.y == q.y); +} +static inline int3 operator==(uint3 p, uint3 q) +{ + return int3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline int4 operator==(uint4 p, uint4 q) +{ + return int4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline int2 operator==(uint2 p, uint q) +{ + return int2(p.x == q, p.y == q); +} +static inline int3 operator==(uint3 p, uint q) +{ + return int3(p.x == q, p.y == q, p.z == q); +} +static inline int4 operator==(uint4 p, uint q) +{ + return int4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline int2 operator==(uint p, uint2 q) +{ + return int2(p == q.x, p == q.y); +} +static inline int3 operator==(uint p, uint3 q) +{ + return int3(p == q.x, p == q.y, p == q.z); +} +static inline int4 operator==(uint p, uint4 q) +{ + return int4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline short2 operator==(short2 p, short2 q) +{ + return short2(p.x == q.x, p.y == q.y); +} +static inline short3 operator==(short3 p, short3 q) +{ + return short3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline short4 operator==(short4 p, short4 q) +{ + return short4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline short2 operator==(short2 p, short q) +{ + return short2(p.x == q, p.y == q); +} +static inline short3 operator==(short3 p, short q) +{ + return short3(p.x == q, p.y == q, p.z == q); +} +static inline short4 operator==(short4 p, short q) +{ + return short4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline short2 operator==(short p, short2 q) +{ + return short2(p == q.x, p == q.y); +} +static inline short3 operator==(short p, short3 q) +{ + return short3(p == q.x, p == q.y, p == q.z); +} +static inline short4 operator==(short p, short4 q) +{ + return short4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline short2 operator==(ushort2 p, ushort2 q) +{ + return short2(p.x == q.x, p.y == q.y); +} +static inline short3 operator==(ushort3 p, ushort3 q) +{ + return short3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline short4 operator==(ushort4 p, ushort4 q) +{ + return short4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline short2 operator==(ushort2 p, ushort q) +{ + return short2(p.x == q, p.y == q); +} +static inline short3 operator==(ushort3 p, ushort q) +{ + return short3(p.x == q, p.y == q, p.z == q); +} +static inline short4 operator==(ushort4 p, ushort q) +{ + return short4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline short2 operator==(ushort p, ushort2 q) +{ + return short2(p == q.x, p == q.y); +} +static inline short3 operator==(ushort p, ushort3 q) +{ + return short3(p == q.x, p == q.y, p == q.z); +} +static inline short4 operator==(ushort p, ushort4 q) +{ + return short4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline long2 operator==(long2 p, long2 q) +{ + return long2(p.x == q.x, p.y == q.y); +} +static inline long3 operator==(long3 p, long3 q) +{ + return long3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline long4 operator==(long4 p, long4 q) +{ + return long4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline long2 operator==(long2 p, long q) +{ + return long2(p.x == q, p.y == q); +} +static inline long3 operator==(long3 p, long q) +{ + return long3(p.x == q, p.y == q, p.z == q); +} +static inline long4 operator==(long4 p, long q) +{ + return long4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline long2 operator==(long p, long2 q) +{ + return long2(p == q.x, p == q.y); +} +static inline long3 operator==(long p, long3 q) +{ + return long3(p == q.x, p == q.y, p == q.z); +} +static inline long4 operator==(long p, long4 q) +{ + return long4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline long2 operator==(ulong2 p, ulong2 q) +{ + return long2(p.x == q.x, p.y == q.y); +} +static inline long3 operator==(ulong3 p, ulong3 q) +{ + return long3(p.x == q.x, p.y == q.y, p.z == q.z); +} +static inline long4 operator==(ulong4 p, ulong4 q) +{ + return long4(p.x == q.x, p.y == q.y, p.z == q.z, p.w == q.w); +} +static inline long2 operator==(ulong2 p, ulong q) +{ + return long2(p.x == q, p.y == q); +} +static inline long3 operator==(ulong3 p, ulong q) +{ + return long3(p.x == q, p.y == q, p.z == q); +} +static inline long4 operator==(ulong4 p, ulong q) +{ + return long4(p.x == q, p.y == q, p.z == q, p.w == q); +} +static inline long2 operator==(ulong p, ulong2 q) +{ + return long2(p == q.x, p == q.y); +} +static inline long3 operator==(ulong p, ulong3 q) +{ + return long3(p == q.x, p == q.y, p == q.z); +} +static inline long4 operator==(ulong p, ulong4 q) +{ + return long4(p == q.x, p == q.y, p == q.z, p == q.w); +} +static inline int2 operator!=(float2 p, float2 q) +{ + return int2(p.x != q.x, p.y != q.y); +} +static inline int3 operator!=(float3 p, float3 q) +{ + return int3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline int4 operator!=(float4 p, float4 q) +{ + return int4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline int2 operator!=(float2 p, float q) +{ + return int2(p.x != q, p.y != q); +} +static inline int3 operator!=(float3 p, float q) +{ + return int3(p.x != q, p.y != q, p.z != q); +} +static inline int4 operator!=(float4 p, float q) +{ + return int4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline int2 operator!=(float p, float2 q) +{ + return int2(p != q.x, p != q.y); +} +static inline int3 operator!=(float p, float3 q) +{ + return int3(p != q.x, p != q.y, p != q.z); +} +static inline int4 operator!=(float p, float4 q) +{ + return int4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline long2 operator!=(double2 p, double2 q) +{ + return long2(p.x != q.x, p.y != q.y); +} +static inline long3 operator!=(double3 p, double3 q) +{ + return long3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline long4 operator!=(double4 p, double4 q) +{ + return long4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline long2 operator!=(double2 p, double q) +{ + return long2(p.x != q, p.y != q); +} +static inline long3 operator!=(double3 p, double q) +{ + return long3(p.x != q, p.y != q, p.z != q); +} +static inline long4 operator!=(double4 p, double q) +{ + return long4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline long2 operator!=(double p, double2 q) +{ + return long2(p != q.x, p != q.y); +} +static inline long3 operator!=(double p, double3 q) +{ + return long3(p != q.x, p != q.y, p != q.z); +} +static inline long4 operator!=(double p, double4 q) +{ + return long4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline int2 operator!=(int2 p, int2 q) +{ + return int2(p.x != q.x, p.y != q.y); +} +static inline int3 operator!=(int3 p, int3 q) +{ + return int3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline int4 operator!=(int4 p, int4 q) +{ + return int4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline int2 operator!=(int2 p, int q) +{ + return int2(p.x != q, p.y != q); +} +static inline int3 operator!=(int3 p, int q) +{ + return int3(p.x != q, p.y != q, p.z != q); +} +static inline int4 operator!=(int4 p, int q) +{ + return int4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline int2 operator!=(int p, int2 q) +{ + return int2(p != q.x, p != q.y); +} +static inline int3 operator!=(int p, int3 q) +{ + return int3(p != q.x, p != q.y, p != q.z); +} +static inline int4 operator!=(int p, int4 q) +{ + return int4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline int2 operator!=(uint2 p, uint2 q) +{ + return int2(p.x != q.x, p.y != q.y); +} +static inline int3 operator!=(uint3 p, uint3 q) +{ + return int3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline int4 operator!=(uint4 p, uint4 q) +{ + return int4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline int2 operator!=(uint2 p, uint q) +{ + return int2(p.x != q, p.y != q); +} +static inline int3 operator!=(uint3 p, uint q) +{ + return int3(p.x != q, p.y != q, p.z != q); +} +static inline int4 operator!=(uint4 p, uint q) +{ + return int4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline int2 operator!=(uint p, uint2 q) +{ + return int2(p != q.x, p != q.y); +} +static inline int3 operator!=(uint p, uint3 q) +{ + return int3(p != q.x, p != q.y, p != q.z); +} +static inline int4 operator!=(uint p, uint4 q) +{ + return int4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline short2 operator!=(short2 p, short2 q) +{ + return short2(p.x != q.x, p.y != q.y); +} +static inline short3 operator!=(short3 p, short3 q) +{ + return short3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline short4 operator!=(short4 p, short4 q) +{ + return short4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline short2 operator!=(short2 p, short q) +{ + return short2(p.x != q, p.y != q); +} +static inline short3 operator!=(short3 p, short q) +{ + return short3(p.x != q, p.y != q, p.z != q); +} +static inline short4 operator!=(short4 p, short q) +{ + return short4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline short2 operator!=(short p, short2 q) +{ + return short2(p != q.x, p != q.y); +} +static inline short3 operator!=(short p, short3 q) +{ + return short3(p != q.x, p != q.y, p != q.z); +} +static inline short4 operator!=(short p, short4 q) +{ + return short4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline short2 operator!=(ushort2 p, ushort2 q) +{ + return short2(p.x != q.x, p.y != q.y); +} +static inline short3 operator!=(ushort3 p, ushort3 q) +{ + return short3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline short4 operator!=(ushort4 p, ushort4 q) +{ + return short4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline short2 operator!=(ushort2 p, ushort q) +{ + return short2(p.x != q, p.y != q); +} +static inline short3 operator!=(ushort3 p, ushort q) +{ + return short3(p.x != q, p.y != q, p.z != q); +} +static inline short4 operator!=(ushort4 p, ushort q) +{ + return short4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline short2 operator!=(ushort p, ushort2 q) +{ + return short2(p != q.x, p != q.y); +} +static inline short3 operator!=(ushort p, ushort3 q) +{ + return short3(p != q.x, p != q.y, p != q.z); +} +static inline short4 operator!=(ushort p, ushort4 q) +{ + return short4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline long2 operator!=(long2 p, long2 q) +{ + return long2(p.x != q.x, p.y != q.y); +} +static inline long3 operator!=(long3 p, long3 q) +{ + return long3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline long4 operator!=(long4 p, long4 q) +{ + return long4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline long2 operator!=(long2 p, long q) +{ + return long2(p.x != q, p.y != q); +} +static inline long3 operator!=(long3 p, long q) +{ + return long3(p.x != q, p.y != q, p.z != q); +} +static inline long4 operator!=(long4 p, long q) +{ + return long4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline long2 operator!=(long p, long2 q) +{ + return long2(p != q.x, p != q.y); +} +static inline long3 operator!=(long p, long3 q) +{ + return long3(p != q.x, p != q.y, p != q.z); +} +static inline long4 operator!=(long p, long4 q) +{ + return long4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline long2 operator!=(ulong2 p, ulong2 q) +{ + return long2(p.x != q.x, p.y != q.y); +} +static inline long3 operator!=(ulong3 p, ulong3 q) +{ + return long3(p.x != q.x, p.y != q.y, p.z != q.z); +} +static inline long4 operator!=(ulong4 p, ulong4 q) +{ + return long4(p.x != q.x, p.y != q.y, p.z != q.z, p.w != q.w); +} +static inline long2 operator!=(ulong2 p, ulong q) +{ + return long2(p.x != q, p.y != q); +} +static inline long3 operator!=(ulong3 p, ulong q) +{ + return long3(p.x != q, p.y != q, p.z != q); +} +static inline long4 operator!=(ulong4 p, ulong q) +{ + return long4(p.x != q, p.y != q, p.z != q, p.w != q); +} +static inline long2 operator!=(ulong p, ulong2 q) +{ + return long2(p != q.x, p != q.y); +} +static inline long3 operator!=(ulong p, ulong3 q) +{ + return long3(p != q.x, p != q.y, p != q.z); +} +static inline long4 operator!=(ulong p, ulong4 q) +{ + return long4(p != q.x, p != q.y, p != q.z, p != q.w); +} +static inline int2 operator>(float2 p, float2 q) +{ + return int2(p.x > q.x, p.y > q.y); +} +static inline int3 operator>(float3 p, float3 q) +{ + return int3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline int4 operator>(float4 p, float4 q) +{ + return int4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline int2 operator>(float2 p, float q) +{ + return int2(p.x > q, p.y > q); +} +static inline int3 operator>(float3 p, float q) +{ + return int3(p.x > q, p.y > q, p.z > q); +} +static inline int4 operator>(float4 p, float q) +{ + return int4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline int2 operator>(float p, float2 q) +{ + return int2(p > q.x, p > q.y); +} +static inline int3 operator>(float p, float3 q) +{ + return int3(p > q.x, p > q.y, p > q.z); +} +static inline int4 operator>(float p, float4 q) +{ + return int4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline long2 operator>(double2 p, double2 q) +{ + return long2(p.x > q.x, p.y > q.y); +} +static inline long3 operator>(double3 p, double3 q) +{ + return long3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline long4 operator>(double4 p, double4 q) +{ + return long4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline long2 operator>(double2 p, double q) +{ + return long2(p.x > q, p.y > q); +} +static inline long3 operator>(double3 p, double q) +{ + return long3(p.x > q, p.y > q, p.z > q); +} +static inline long4 operator>(double4 p, double q) +{ + return long4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline long2 operator>(double p, double2 q) +{ + return long2(p > q.x, p > q.y); +} +static inline long3 operator>(double p, double3 q) +{ + return long3(p > q.x, p > q.y, p > q.z); +} +static inline long4 operator>(double p, double4 q) +{ + return long4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline int2 operator>(int2 p, int2 q) +{ + return int2(p.x > q.x, p.y > q.y); +} +static inline int3 operator>(int3 p, int3 q) +{ + return int3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline int4 operator>(int4 p, int4 q) +{ + return int4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline int2 operator>(int2 p, int q) +{ + return int2(p.x > q, p.y > q); +} +static inline int3 operator>(int3 p, int q) +{ + return int3(p.x > q, p.y > q, p.z > q); +} +static inline int4 operator>(int4 p, int q) +{ + return int4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline int2 operator>(int p, int2 q) +{ + return int2(p > q.x, p > q.y); +} +static inline int3 operator>(int p, int3 q) +{ + return int3(p > q.x, p > q.y, p > q.z); +} +static inline int4 operator>(int p, int4 q) +{ + return int4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline int2 operator>(uint2 p, uint2 q) +{ + return int2(p.x > q.x, p.y > q.y); +} +static inline int3 operator>(uint3 p, uint3 q) +{ + return int3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline int4 operator>(uint4 p, uint4 q) +{ + return int4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline int2 operator>(uint2 p, uint q) +{ + return int2(p.x > q, p.y > q); +} +static inline int3 operator>(uint3 p, uint q) +{ + return int3(p.x > q, p.y > q, p.z > q); +} +static inline int4 operator>(uint4 p, uint q) +{ + return int4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline int2 operator>(uint p, uint2 q) +{ + return int2(p > q.x, p > q.y); +} +static inline int3 operator>(uint p, uint3 q) +{ + return int3(p > q.x, p > q.y, p > q.z); +} +static inline int4 operator>(uint p, uint4 q) +{ + return int4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline short2 operator>(short2 p, short2 q) +{ + return short2(p.x > q.x, p.y > q.y); +} +static inline short3 operator>(short3 p, short3 q) +{ + return short3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline short4 operator>(short4 p, short4 q) +{ + return short4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline short2 operator>(short2 p, short q) +{ + return short2(p.x > q, p.y > q); +} +static inline short3 operator>(short3 p, short q) +{ + return short3(p.x > q, p.y > q, p.z > q); +} +static inline short4 operator>(short4 p, short q) +{ + return short4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline short2 operator>(short p, short2 q) +{ + return short2(p > q.x, p > q.y); +} +static inline short3 operator>(short p, short3 q) +{ + return short3(p > q.x, p > q.y, p > q.z); +} +static inline short4 operator>(short p, short4 q) +{ + return short4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline short2 operator>(ushort2 p, ushort2 q) +{ + return short2(p.x > q.x, p.y > q.y); +} +static inline short3 operator>(ushort3 p, ushort3 q) +{ + return short3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline short4 operator>(ushort4 p, ushort4 q) +{ + return short4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline short2 operator>(ushort2 p, ushort q) +{ + return short2(p.x > q, p.y > q); +} +static inline short3 operator>(ushort3 p, ushort q) +{ + return short3(p.x > q, p.y > q, p.z > q); +} +static inline short4 operator>(ushort4 p, ushort q) +{ + return short4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline short2 operator>(ushort p, ushort2 q) +{ + return short2(p > q.x, p > q.y); +} +static inline short3 operator>(ushort p, ushort3 q) +{ + return short3(p > q.x, p > q.y, p > q.z); +} +static inline short4 operator>(ushort p, ushort4 q) +{ + return short4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline long2 operator>(long2 p, long2 q) +{ + return long2(p.x > q.x, p.y > q.y); +} +static inline long3 operator>(long3 p, long3 q) +{ + return long3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline long4 operator>(long4 p, long4 q) +{ + return long4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline long2 operator>(long2 p, long q) +{ + return long2(p.x > q, p.y > q); +} +static inline long3 operator>(long3 p, long q) +{ + return long3(p.x > q, p.y > q, p.z > q); +} +static inline long4 operator>(long4 p, long q) +{ + return long4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline long2 operator>(long p, long2 q) +{ + return long2(p > q.x, p > q.y); +} +static inline long3 operator>(long p, long3 q) +{ + return long3(p > q.x, p > q.y, p > q.z); +} +static inline long4 operator>(long p, long4 q) +{ + return long4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline long2 operator>(ulong2 p, ulong2 q) +{ + return long2(p.x > q.x, p.y > q.y); +} +static inline long3 operator>(ulong3 p, ulong3 q) +{ + return long3(p.x > q.x, p.y > q.y, p.z > q.z); +} +static inline long4 operator>(ulong4 p, ulong4 q) +{ + return long4(p.x > q.x, p.y > q.y, p.z > q.z, p.w > q.w); +} +static inline long2 operator>(ulong2 p, ulong q) +{ + return long2(p.x > q, p.y > q); +} +static inline long3 operator>(ulong3 p, ulong q) +{ + return long3(p.x > q, p.y > q, p.z > q); +} +static inline long4 operator>(ulong4 p, ulong q) +{ + return long4(p.x > q, p.y > q, p.z > q, p.w > q); +} +static inline long2 operator>(ulong p, ulong2 q) +{ + return long2(p > q.x, p > q.y); +} +static inline long3 operator>(ulong p, ulong3 q) +{ + return long3(p > q.x, p > q.y, p > q.z); +} +static inline long4 operator>(ulong p, ulong4 q) +{ + return long4(p > q.x, p > q.y, p > q.z, p > q.w); +} +static inline int2 operator<(float2 p, float2 q) +{ + return int2(p.x < q.x, p.y < q.y); +} +static inline int3 operator<(float3 p, float3 q) +{ + return int3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline int4 operator<(float4 p, float4 q) +{ + return int4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline int2 operator<(float2 p, float q) +{ + return int2(p.x < q, p.y < q); +} +static inline int3 operator<(float3 p, float q) +{ + return int3(p.x < q, p.y < q, p.z < q); +} +static inline int4 operator<(float4 p, float q) +{ + return int4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline int2 operator<(float p, float2 q) +{ + return int2(p < q.x, p < q.y); +} +static inline int3 operator<(float p, float3 q) +{ + return int3(p < q.x, p < q.y, p < q.z); +} +static inline int4 operator<(float p, float4 q) +{ + return int4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline long2 operator<(double2 p, double2 q) +{ + return long2(p.x < q.x, p.y < q.y); +} +static inline long3 operator<(double3 p, double3 q) +{ + return long3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline long4 operator<(double4 p, double4 q) +{ + return long4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline long2 operator<(double2 p, double q) +{ + return long2(p.x < q, p.y < q); +} +static inline long3 operator<(double3 p, double q) +{ + return long3(p.x < q, p.y < q, p.z < q); +} +static inline long4 operator<(double4 p, double q) +{ + return long4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline long2 operator<(double p, double2 q) +{ + return long2(p < q.x, p < q.y); +} +static inline long3 operator<(double p, double3 q) +{ + return long3(p < q.x, p < q.y, p < q.z); +} +static inline long4 operator<(double p, double4 q) +{ + return long4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline int2 operator<(int2 p, int2 q) +{ + return int2(p.x < q.x, p.y < q.y); +} +static inline int3 operator<(int3 p, int3 q) +{ + return int3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline int4 operator<(int4 p, int4 q) +{ + return int4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline int2 operator<(int2 p, int q) +{ + return int2(p.x < q, p.y < q); +} +static inline int3 operator<(int3 p, int q) +{ + return int3(p.x < q, p.y < q, p.z < q); +} +static inline int4 operator<(int4 p, int q) +{ + return int4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline int2 operator<(int p, int2 q) +{ + return int2(p < q.x, p < q.y); +} +static inline int3 operator<(int p, int3 q) +{ + return int3(p < q.x, p < q.y, p < q.z); +} +static inline int4 operator<(int p, int4 q) +{ + return int4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline int2 operator<(uint2 p, uint2 q) +{ + return int2(p.x < q.x, p.y < q.y); +} +static inline int3 operator<(uint3 p, uint3 q) +{ + return int3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline int4 operator<(uint4 p, uint4 q) +{ + return int4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline int2 operator<(uint2 p, uint q) +{ + return int2(p.x < q, p.y < q); +} +static inline int3 operator<(uint3 p, uint q) +{ + return int3(p.x < q, p.y < q, p.z < q); +} +static inline int4 operator<(uint4 p, uint q) +{ + return int4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline int2 operator<(uint p, uint2 q) +{ + return int2(p < q.x, p < q.y); +} +static inline int3 operator<(uint p, uint3 q) +{ + return int3(p < q.x, p < q.y, p < q.z); +} +static inline int4 operator<(uint p, uint4 q) +{ + return int4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline short2 operator<(short2 p, short2 q) +{ + return short2(p.x < q.x, p.y < q.y); +} +static inline short3 operator<(short3 p, short3 q) +{ + return short3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline short4 operator<(short4 p, short4 q) +{ + return short4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline short2 operator<(short2 p, short q) +{ + return short2(p.x < q, p.y < q); +} +static inline short3 operator<(short3 p, short q) +{ + return short3(p.x < q, p.y < q, p.z < q); +} +static inline short4 operator<(short4 p, short q) +{ + return short4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline short2 operator<(short p, short2 q) +{ + return short2(p < q.x, p < q.y); +} +static inline short3 operator<(short p, short3 q) +{ + return short3(p < q.x, p < q.y, p < q.z); +} +static inline short4 operator<(short p, short4 q) +{ + return short4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline short2 operator<(ushort2 p, ushort2 q) +{ + return short2(p.x < q.x, p.y < q.y); +} +static inline short3 operator<(ushort3 p, ushort3 q) +{ + return short3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline short4 operator<(ushort4 p, ushort4 q) +{ + return short4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline short2 operator<(ushort2 p, ushort q) +{ + return short2(p.x < q, p.y < q); +} +static inline short3 operator<(ushort3 p, ushort q) +{ + return short3(p.x < q, p.y < q, p.z < q); +} +static inline short4 operator<(ushort4 p, ushort q) +{ + return short4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline short2 operator<(ushort p, ushort2 q) +{ + return short2(p < q.x, p < q.y); +} +static inline short3 operator<(ushort p, ushort3 q) +{ + return short3(p < q.x, p < q.y, p < q.z); +} +static inline short4 operator<(ushort p, ushort4 q) +{ + return short4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline long2 operator<(long2 p, long2 q) +{ + return long2(p.x < q.x, p.y < q.y); +} +static inline long3 operator<(long3 p, long3 q) +{ + return long3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline long4 operator<(long4 p, long4 q) +{ + return long4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline long2 operator<(long2 p, long q) +{ + return long2(p.x < q, p.y < q); +} +static inline long3 operator<(long3 p, long q) +{ + return long3(p.x < q, p.y < q, p.z < q); +} +static inline long4 operator<(long4 p, long q) +{ + return long4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline long2 operator<(long p, long2 q) +{ + return long2(p < q.x, p < q.y); +} +static inline long3 operator<(long p, long3 q) +{ + return long3(p < q.x, p < q.y, p < q.z); +} +static inline long4 operator<(long p, long4 q) +{ + return long4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline long2 operator<(ulong2 p, ulong2 q) +{ + return long2(p.x < q.x, p.y < q.y); +} +static inline long3 operator<(ulong3 p, ulong3 q) +{ + return long3(p.x < q.x, p.y < q.y, p.z < q.z); +} +static inline long4 operator<(ulong4 p, ulong4 q) +{ + return long4(p.x < q.x, p.y < q.y, p.z < q.z, p.w < q.w); +} +static inline long2 operator<(ulong2 p, ulong q) +{ + return long2(p.x < q, p.y < q); +} +static inline long3 operator<(ulong3 p, ulong q) +{ + return long3(p.x < q, p.y < q, p.z < q); +} +static inline long4 operator<(ulong4 p, ulong q) +{ + return long4(p.x < q, p.y < q, p.z < q, p.w < q); +} +static inline long2 operator<(ulong p, ulong2 q) +{ + return long2(p < q.x, p < q.y); +} +static inline long3 operator<(ulong p, ulong3 q) +{ + return long3(p < q.x, p < q.y, p < q.z); +} +static inline long4 operator<(ulong p, ulong4 q) +{ + return long4(p < q.x, p < q.y, p < q.z, p < q.w); +} +static inline int2 operator>=(float2 p, float2 q) +{ + return int2(p.x >= q.x, p.y >= q.y); +} +static inline int3 operator>=(float3 p, float3 q) +{ + return int3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline int4 operator>=(float4 p, float4 q) +{ + return int4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline int2 operator>=(float2 p, float q) +{ + return int2(p.x >= q, p.y >= q); +} +static inline int3 operator>=(float3 p, float q) +{ + return int3(p.x >= q, p.y >= q, p.z >= q); +} +static inline int4 operator>=(float4 p, float q) +{ + return int4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline int2 operator>=(float p, float2 q) +{ + return int2(p >= q.x, p >= q.y); +} +static inline int3 operator>=(float p, float3 q) +{ + return int3(p >= q.x, p >= q.y, p >= q.z); +} +static inline int4 operator>=(float p, float4 q) +{ + return int4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline long2 operator>=(double2 p, double2 q) +{ + return long2(p.x >= q.x, p.y >= q.y); +} +static inline long3 operator>=(double3 p, double3 q) +{ + return long3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline long4 operator>=(double4 p, double4 q) +{ + return long4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline long2 operator>=(double2 p, double q) +{ + return long2(p.x >= q, p.y >= q); +} +static inline long3 operator>=(double3 p, double q) +{ + return long3(p.x >= q, p.y >= q, p.z >= q); +} +static inline long4 operator>=(double4 p, double q) +{ + return long4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline long2 operator>=(double p, double2 q) +{ + return long2(p >= q.x, p >= q.y); +} +static inline long3 operator>=(double p, double3 q) +{ + return long3(p >= q.x, p >= q.y, p >= q.z); +} +static inline long4 operator>=(double p, double4 q) +{ + return long4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline int2 operator>=(int2 p, int2 q) +{ + return int2(p.x >= q.x, p.y >= q.y); +} +static inline int3 operator>=(int3 p, int3 q) +{ + return int3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline int4 operator>=(int4 p, int4 q) +{ + return int4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline int2 operator>=(int2 p, int q) +{ + return int2(p.x >= q, p.y >= q); +} +static inline int3 operator>=(int3 p, int q) +{ + return int3(p.x >= q, p.y >= q, p.z >= q); +} +static inline int4 operator>=(int4 p, int q) +{ + return int4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline int2 operator>=(int p, int2 q) +{ + return int2(p >= q.x, p >= q.y); +} +static inline int3 operator>=(int p, int3 q) +{ + return int3(p >= q.x, p >= q.y, p >= q.z); +} +static inline int4 operator>=(int p, int4 q) +{ + return int4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline int2 operator>=(uint2 p, uint2 q) +{ + return int2(p.x >= q.x, p.y >= q.y); +} +static inline int3 operator>=(uint3 p, uint3 q) +{ + return int3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline int4 operator>=(uint4 p, uint4 q) +{ + return int4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline int2 operator>=(uint2 p, uint q) +{ + return int2(p.x >= q, p.y >= q); +} +static inline int3 operator>=(uint3 p, uint q) +{ + return int3(p.x >= q, p.y >= q, p.z >= q); +} +static inline int4 operator>=(uint4 p, uint q) +{ + return int4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline int2 operator>=(uint p, uint2 q) +{ + return int2(p >= q.x, p >= q.y); +} +static inline int3 operator>=(uint p, uint3 q) +{ + return int3(p >= q.x, p >= q.y, p >= q.z); +} +static inline int4 operator>=(uint p, uint4 q) +{ + return int4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline short2 operator>=(short2 p, short2 q) +{ + return short2(p.x >= q.x, p.y >= q.y); +} +static inline short3 operator>=(short3 p, short3 q) +{ + return short3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline short4 operator>=(short4 p, short4 q) +{ + return short4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline short2 operator>=(short2 p, short q) +{ + return short2(p.x >= q, p.y >= q); +} +static inline short3 operator>=(short3 p, short q) +{ + return short3(p.x >= q, p.y >= q, p.z >= q); +} +static inline short4 operator>=(short4 p, short q) +{ + return short4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline short2 operator>=(short p, short2 q) +{ + return short2(p >= q.x, p >= q.y); +} +static inline short3 operator>=(short p, short3 q) +{ + return short3(p >= q.x, p >= q.y, p >= q.z); +} +static inline short4 operator>=(short p, short4 q) +{ + return short4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline short2 operator>=(ushort2 p, ushort2 q) +{ + return short2(p.x >= q.x, p.y >= q.y); +} +static inline short3 operator>=(ushort3 p, ushort3 q) +{ + return short3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline short4 operator>=(ushort4 p, ushort4 q) +{ + return short4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline short2 operator>=(ushort2 p, ushort q) +{ + return short2(p.x >= q, p.y >= q); +} +static inline short3 operator>=(ushort3 p, ushort q) +{ + return short3(p.x >= q, p.y >= q, p.z >= q); +} +static inline short4 operator>=(ushort4 p, ushort q) +{ + return short4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline short2 operator>=(ushort p, ushort2 q) +{ + return short2(p >= q.x, p >= q.y); +} +static inline short3 operator>=(ushort p, ushort3 q) +{ + return short3(p >= q.x, p >= q.y, p >= q.z); +} +static inline short4 operator>=(ushort p, ushort4 q) +{ + return short4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline long2 operator>=(long2 p, long2 q) +{ + return long2(p.x >= q.x, p.y >= q.y); +} +static inline long3 operator>=(long3 p, long3 q) +{ + return long3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline long4 operator>=(long4 p, long4 q) +{ + return long4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline long2 operator>=(long2 p, long q) +{ + return long2(p.x >= q, p.y >= q); +} +static inline long3 operator>=(long3 p, long q) +{ + return long3(p.x >= q, p.y >= q, p.z >= q); +} +static inline long4 operator>=(long4 p, long q) +{ + return long4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline long2 operator>=(long p, long2 q) +{ + return long2(p >= q.x, p >= q.y); +} +static inline long3 operator>=(long p, long3 q) +{ + return long3(p >= q.x, p >= q.y, p >= q.z); +} +static inline long4 operator>=(long p, long4 q) +{ + return long4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline long2 operator>=(ulong2 p, ulong2 q) +{ + return long2(p.x >= q.x, p.y >= q.y); +} +static inline long3 operator>=(ulong3 p, ulong3 q) +{ + return long3(p.x >= q.x, p.y >= q.y, p.z >= q.z); +} +static inline long4 operator>=(ulong4 p, ulong4 q) +{ + return long4(p.x >= q.x, p.y >= q.y, p.z >= q.z, p.w >= q.w); +} +static inline long2 operator>=(ulong2 p, ulong q) +{ + return long2(p.x >= q, p.y >= q); +} +static inline long3 operator>=(ulong3 p, ulong q) +{ + return long3(p.x >= q, p.y >= q, p.z >= q); +} +static inline long4 operator>=(ulong4 p, ulong q) +{ + return long4(p.x >= q, p.y >= q, p.z >= q, p.w >= q); +} +static inline long2 operator>=(ulong p, ulong2 q) +{ + return long2(p >= q.x, p >= q.y); +} +static inline long3 operator>=(ulong p, ulong3 q) +{ + return long3(p >= q.x, p >= q.y, p >= q.z); +} +static inline long4 operator>=(ulong p, ulong4 q) +{ + return long4(p >= q.x, p >= q.y, p >= q.z, p >= q.w); +} +static inline int2 operator<=(float2 p, float2 q) +{ + return int2(p.x <= q.x, p.y <= q.y); +} +static inline int3 operator<=(float3 p, float3 q) +{ + return int3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline int4 operator<=(float4 p, float4 q) +{ + return int4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline int2 operator<=(float2 p, float q) +{ + return int2(p.x <= q, p.y <= q); +} +static inline int3 operator<=(float3 p, float q) +{ + return int3(p.x <= q, p.y <= q, p.z <= q); +} +static inline int4 operator<=(float4 p, float q) +{ + return int4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline int2 operator<=(float p, float2 q) +{ + return int2(p <= q.x, p <= q.y); +} +static inline int3 operator<=(float p, float3 q) +{ + return int3(p <= q.x, p <= q.y, p <= q.z); +} +static inline int4 operator<=(float p, float4 q) +{ + return int4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline long2 operator<=(double2 p, double2 q) +{ + return long2(p.x <= q.x, p.y <= q.y); +} +static inline long3 operator<=(double3 p, double3 q) +{ + return long3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline long4 operator<=(double4 p, double4 q) +{ + return long4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline long2 operator<=(double2 p, double q) +{ + return long2(p.x <= q, p.y <= q); +} +static inline long3 operator<=(double3 p, double q) +{ + return long3(p.x <= q, p.y <= q, p.z <= q); +} +static inline long4 operator<=(double4 p, double q) +{ + return long4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline long2 operator<=(double p, double2 q) +{ + return long2(p <= q.x, p <= q.y); +} +static inline long3 operator<=(double p, double3 q) +{ + return long3(p <= q.x, p <= q.y, p <= q.z); +} +static inline long4 operator<=(double p, double4 q) +{ + return long4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline int2 operator<=(int2 p, int2 q) +{ + return int2(p.x <= q.x, p.y <= q.y); +} +static inline int3 operator<=(int3 p, int3 q) +{ + return int3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline int4 operator<=(int4 p, int4 q) +{ + return int4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline int2 operator<=(int2 p, int q) +{ + return int2(p.x <= q, p.y <= q); +} +static inline int3 operator<=(int3 p, int q) +{ + return int3(p.x <= q, p.y <= q, p.z <= q); +} +static inline int4 operator<=(int4 p, int q) +{ + return int4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline int2 operator<=(int p, int2 q) +{ + return int2(p <= q.x, p <= q.y); +} +static inline int3 operator<=(int p, int3 q) +{ + return int3(p <= q.x, p <= q.y, p <= q.z); +} +static inline int4 operator<=(int p, int4 q) +{ + return int4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline int2 operator<=(uint2 p, uint2 q) +{ + return int2(p.x <= q.x, p.y <= q.y); +} +static inline int3 operator<=(uint3 p, uint3 q) +{ + return int3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline int4 operator<=(uint4 p, uint4 q) +{ + return int4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline int2 operator<=(uint2 p, uint q) +{ + return int2(p.x <= q, p.y <= q); +} +static inline int3 operator<=(uint3 p, uint q) +{ + return int3(p.x <= q, p.y <= q, p.z <= q); +} +static inline int4 operator<=(uint4 p, uint q) +{ + return int4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline int2 operator<=(uint p, uint2 q) +{ + return int2(p <= q.x, p <= q.y); +} +static inline int3 operator<=(uint p, uint3 q) +{ + return int3(p <= q.x, p <= q.y, p <= q.z); +} +static inline int4 operator<=(uint p, uint4 q) +{ + return int4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline short2 operator<=(short2 p, short2 q) +{ + return short2(p.x <= q.x, p.y <= q.y); +} +static inline short3 operator<=(short3 p, short3 q) +{ + return short3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline short4 operator<=(short4 p, short4 q) +{ + return short4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline short2 operator<=(short2 p, short q) +{ + return short2(p.x <= q, p.y <= q); +} +static inline short3 operator<=(short3 p, short q) +{ + return short3(p.x <= q, p.y <= q, p.z <= q); +} +static inline short4 operator<=(short4 p, short q) +{ + return short4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline short2 operator<=(short p, short2 q) +{ + return short2(p <= q.x, p <= q.y); +} +static inline short3 operator<=(short p, short3 q) +{ + return short3(p <= q.x, p <= q.y, p <= q.z); +} +static inline short4 operator<=(short p, short4 q) +{ + return short4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline short2 operator<=(ushort2 p, ushort2 q) +{ + return short2(p.x <= q.x, p.y <= q.y); +} +static inline short3 operator<=(ushort3 p, ushort3 q) +{ + return short3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline short4 operator<=(ushort4 p, ushort4 q) +{ + return short4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline short2 operator<=(ushort2 p, ushort q) +{ + return short2(p.x <= q, p.y <= q); +} +static inline short3 operator<=(ushort3 p, ushort q) +{ + return short3(p.x <= q, p.y <= q, p.z <= q); +} +static inline short4 operator<=(ushort4 p, ushort q) +{ + return short4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline short2 operator<=(ushort p, ushort2 q) +{ + return short2(p <= q.x, p <= q.y); +} +static inline short3 operator<=(ushort p, ushort3 q) +{ + return short3(p <= q.x, p <= q.y, p <= q.z); +} +static inline short4 operator<=(ushort p, ushort4 q) +{ + return short4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline long2 operator<=(long2 p, long2 q) +{ + return long2(p.x <= q.x, p.y <= q.y); +} +static inline long3 operator<=(long3 p, long3 q) +{ + return long3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline long4 operator<=(long4 p, long4 q) +{ + return long4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline long2 operator<=(long2 p, long q) +{ + return long2(p.x <= q, p.y <= q); +} +static inline long3 operator<=(long3 p, long q) +{ + return long3(p.x <= q, p.y <= q, p.z <= q); +} +static inline long4 operator<=(long4 p, long q) +{ + return long4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline long2 operator<=(long p, long2 q) +{ + return long2(p <= q.x, p <= q.y); +} +static inline long3 operator<=(long p, long3 q) +{ + return long3(p <= q.x, p <= q.y, p <= q.z); +} +static inline long4 operator<=(long p, long4 q) +{ + return long4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline long2 operator<=(ulong2 p, ulong2 q) +{ + return long2(p.x <= q.x, p.y <= q.y); +} +static inline long3 operator<=(ulong3 p, ulong3 q) +{ + return long3(p.x <= q.x, p.y <= q.y, p.z <= q.z); +} +static inline long4 operator<=(ulong4 p, ulong4 q) +{ + return long4(p.x <= q.x, p.y <= q.y, p.z <= q.z, p.w <= q.w); +} +static inline long2 operator<=(ulong2 p, ulong q) +{ + return long2(p.x <= q, p.y <= q); +} +static inline long3 operator<=(ulong3 p, ulong q) +{ + return long3(p.x <= q, p.y <= q, p.z <= q); +} +static inline long4 operator<=(ulong4 p, ulong q) +{ + return long4(p.x <= q, p.y <= q, p.z <= q, p.w <= q); +} +static inline long2 operator<=(ulong p, ulong2 q) +{ + return long2(p <= q.x, p <= q.y); +} +static inline long3 operator<=(ulong p, ulong3 q) +{ + return long3(p <= q.x, p <= q.y, p <= q.z); +} +static inline long4 operator<=(ulong p, ulong4 q) +{ + return long4(p <= q.x, p <= q.y, p <= q.z, p <= q.w); +} +static inline int2 operator&&(float2 p, float2 q) +{ + return int2(p.x && q.x, p.y && q.y); +} +static inline int3 operator&&(float3 p, float3 q) +{ + return int3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline int4 operator&&(float4 p, float4 q) +{ + return int4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline int2 operator&&(float2 p, float q) +{ + return int2(p.x && q, p.y && q); +} +static inline int3 operator&&(float3 p, float q) +{ + return int3(p.x && q, p.y && q, p.z && q); +} +static inline int4 operator&&(float4 p, float q) +{ + return int4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline int2 operator&&(float p, float2 q) +{ + return int2(p && q.x, p && q.y); +} +static inline int3 operator&&(float p, float3 q) +{ + return int3(p && q.x, p && q.y, p && q.z); +} +static inline int4 operator&&(float p, float4 q) +{ + return int4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline long2 operator&&(double2 p, double2 q) +{ + return long2(p.x && q.x, p.y && q.y); +} +static inline long3 operator&&(double3 p, double3 q) +{ + return long3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline long4 operator&&(double4 p, double4 q) +{ + return long4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline long2 operator&&(double2 p, double q) +{ + return long2(p.x && q, p.y && q); +} +static inline long3 operator&&(double3 p, double q) +{ + return long3(p.x && q, p.y && q, p.z && q); +} +static inline long4 operator&&(double4 p, double q) +{ + return long4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline long2 operator&&(double p, double2 q) +{ + return long2(p && q.x, p && q.y); +} +static inline long3 operator&&(double p, double3 q) +{ + return long3(p && q.x, p && q.y, p && q.z); +} +static inline long4 operator&&(double p, double4 q) +{ + return long4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline int2 operator&&(int2 p, int2 q) +{ + return int2(p.x && q.x, p.y && q.y); +} +static inline int3 operator&&(int3 p, int3 q) +{ + return int3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline int4 operator&&(int4 p, int4 q) +{ + return int4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline int2 operator&&(int2 p, int q) +{ + return int2(p.x && q, p.y && q); +} +static inline int3 operator&&(int3 p, int q) +{ + return int3(p.x && q, p.y && q, p.z && q); +} +static inline int4 operator&&(int4 p, int q) +{ + return int4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline int2 operator&&(int p, int2 q) +{ + return int2(p && q.x, p && q.y); +} +static inline int3 operator&&(int p, int3 q) +{ + return int3(p && q.x, p && q.y, p && q.z); +} +static inline int4 operator&&(int p, int4 q) +{ + return int4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline int2 operator&&(uint2 p, uint2 q) +{ + return int2(p.x && q.x, p.y && q.y); +} +static inline int3 operator&&(uint3 p, uint3 q) +{ + return int3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline int4 operator&&(uint4 p, uint4 q) +{ + return int4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline int2 operator&&(uint2 p, uint q) +{ + return int2(p.x && q, p.y && q); +} +static inline int3 operator&&(uint3 p, uint q) +{ + return int3(p.x && q, p.y && q, p.z && q); +} +static inline int4 operator&&(uint4 p, uint q) +{ + return int4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline int2 operator&&(uint p, uint2 q) +{ + return int2(p && q.x, p && q.y); +} +static inline int3 operator&&(uint p, uint3 q) +{ + return int3(p && q.x, p && q.y, p && q.z); +} +static inline int4 operator&&(uint p, uint4 q) +{ + return int4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline short2 operator&&(short2 p, short2 q) +{ + return short2(p.x && q.x, p.y && q.y); +} +static inline short3 operator&&(short3 p, short3 q) +{ + return short3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline short4 operator&&(short4 p, short4 q) +{ + return short4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline short2 operator&&(short2 p, short q) +{ + return short2(p.x && q, p.y && q); +} +static inline short3 operator&&(short3 p, short q) +{ + return short3(p.x && q, p.y && q, p.z && q); +} +static inline short4 operator&&(short4 p, short q) +{ + return short4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline short2 operator&&(short p, short2 q) +{ + return short2(p && q.x, p && q.y); +} +static inline short3 operator&&(short p, short3 q) +{ + return short3(p && q.x, p && q.y, p && q.z); +} +static inline short4 operator&&(short p, short4 q) +{ + return short4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline short2 operator&&(ushort2 p, ushort2 q) +{ + return short2(p.x && q.x, p.y && q.y); +} +static inline short3 operator&&(ushort3 p, ushort3 q) +{ + return short3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline short4 operator&&(ushort4 p, ushort4 q) +{ + return short4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline short2 operator&&(ushort2 p, ushort q) +{ + return short2(p.x && q, p.y && q); +} +static inline short3 operator&&(ushort3 p, ushort q) +{ + return short3(p.x && q, p.y && q, p.z && q); +} +static inline short4 operator&&(ushort4 p, ushort q) +{ + return short4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline short2 operator&&(ushort p, ushort2 q) +{ + return short2(p && q.x, p && q.y); +} +static inline short3 operator&&(ushort p, ushort3 q) +{ + return short3(p && q.x, p && q.y, p && q.z); +} +static inline short4 operator&&(ushort p, ushort4 q) +{ + return short4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline long2 operator&&(long2 p, long2 q) +{ + return long2(p.x && q.x, p.y && q.y); +} +static inline long3 operator&&(long3 p, long3 q) +{ + return long3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline long4 operator&&(long4 p, long4 q) +{ + return long4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline long2 operator&&(long2 p, long q) +{ + return long2(p.x && q, p.y && q); +} +static inline long3 operator&&(long3 p, long q) +{ + return long3(p.x && q, p.y && q, p.z && q); +} +static inline long4 operator&&(long4 p, long q) +{ + return long4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline long2 operator&&(long p, long2 q) +{ + return long2(p && q.x, p && q.y); +} +static inline long3 operator&&(long p, long3 q) +{ + return long3(p && q.x, p && q.y, p && q.z); +} +static inline long4 operator&&(long p, long4 q) +{ + return long4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline long2 operator&&(ulong2 p, ulong2 q) +{ + return long2(p.x && q.x, p.y && q.y); +} +static inline long3 operator&&(ulong3 p, ulong3 q) +{ + return long3(p.x && q.x, p.y && q.y, p.z && q.z); +} +static inline long4 operator&&(ulong4 p, ulong4 q) +{ + return long4(p.x && q.x, p.y && q.y, p.z && q.z, p.w && q.w); +} +static inline long2 operator&&(ulong2 p, ulong q) +{ + return long2(p.x && q, p.y && q); +} +static inline long3 operator&&(ulong3 p, ulong q) +{ + return long3(p.x && q, p.y && q, p.z && q); +} +static inline long4 operator&&(ulong4 p, ulong q) +{ + return long4(p.x && q, p.y && q, p.z && q, p.w && q); +} +static inline long2 operator&&(ulong p, ulong2 q) +{ + return long2(p && q.x, p && q.y); +} +static inline long3 operator&&(ulong p, ulong3 q) +{ + return long3(p && q.x, p && q.y, p && q.z); +} +static inline long4 operator&&(ulong p, ulong4 q) +{ + return long4(p && q.x, p && q.y, p && q.z, p && q.w); +} +static inline int2 operator||(float2 p, float2 q) +{ + return int2(p.x || q.x, p.y || q.y); +} +static inline int3 operator||(float3 p, float3 q) +{ + return int3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline int4 operator||(float4 p, float4 q) +{ + return int4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline int2 operator||(float2 p, float q) +{ + return int2(p.x || q, p.y || q); +} +static inline int3 operator||(float3 p, float q) +{ + return int3(p.x || q, p.y || q, p.z || q); +} +static inline int4 operator||(float4 p, float q) +{ + return int4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline int2 operator||(float p, float2 q) +{ + return int2(p || q.x, p || q.y); +} +static inline int3 operator||(float p, float3 q) +{ + return int3(p || q.x, p || q.y, p || q.z); +} +static inline int4 operator||(float p, float4 q) +{ + return int4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline long2 operator||(double2 p, double2 q) +{ + return long2(p.x || q.x, p.y || q.y); +} +static inline long3 operator||(double3 p, double3 q) +{ + return long3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline long4 operator||(double4 p, double4 q) +{ + return long4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline long2 operator||(double2 p, double q) +{ + return long2(p.x || q, p.y || q); +} +static inline long3 operator||(double3 p, double q) +{ + return long3(p.x || q, p.y || q, p.z || q); +} +static inline long4 operator||(double4 p, double q) +{ + return long4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline long2 operator||(double p, double2 q) +{ + return long2(p || q.x, p || q.y); +} +static inline long3 operator||(double p, double3 q) +{ + return long3(p || q.x, p || q.y, p || q.z); +} +static inline long4 operator||(double p, double4 q) +{ + return long4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline int2 operator||(int2 p, int2 q) +{ + return int2(p.x || q.x, p.y || q.y); +} +static inline int3 operator||(int3 p, int3 q) +{ + return int3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline int4 operator||(int4 p, int4 q) +{ + return int4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline int2 operator||(int2 p, int q) +{ + return int2(p.x || q, p.y || q); +} +static inline int3 operator||(int3 p, int q) +{ + return int3(p.x || q, p.y || q, p.z || q); +} +static inline int4 operator||(int4 p, int q) +{ + return int4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline int2 operator||(int p, int2 q) +{ + return int2(p || q.x, p || q.y); +} +static inline int3 operator||(int p, int3 q) +{ + return int3(p || q.x, p || q.y, p || q.z); +} +static inline int4 operator||(int p, int4 q) +{ + return int4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline int2 operator||(uint2 p, uint2 q) +{ + return int2(p.x || q.x, p.y || q.y); +} +static inline int3 operator||(uint3 p, uint3 q) +{ + return int3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline int4 operator||(uint4 p, uint4 q) +{ + return int4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline int2 operator||(uint2 p, uint q) +{ + return int2(p.x || q, p.y || q); +} +static inline int3 operator||(uint3 p, uint q) +{ + return int3(p.x || q, p.y || q, p.z || q); +} +static inline int4 operator||(uint4 p, uint q) +{ + return int4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline int2 operator||(uint p, uint2 q) +{ + return int2(p || q.x, p || q.y); +} +static inline int3 operator||(uint p, uint3 q) +{ + return int3(p || q.x, p || q.y, p || q.z); +} +static inline int4 operator||(uint p, uint4 q) +{ + return int4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline short2 operator||(short2 p, short2 q) +{ + return short2(p.x || q.x, p.y || q.y); +} +static inline short3 operator||(short3 p, short3 q) +{ + return short3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline short4 operator||(short4 p, short4 q) +{ + return short4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline short2 operator||(short2 p, short q) +{ + return short2(p.x || q, p.y || q); +} +static inline short3 operator||(short3 p, short q) +{ + return short3(p.x || q, p.y || q, p.z || q); +} +static inline short4 operator||(short4 p, short q) +{ + return short4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline short2 operator||(short p, short2 q) +{ + return short2(p || q.x, p || q.y); +} +static inline short3 operator||(short p, short3 q) +{ + return short3(p || q.x, p || q.y, p || q.z); +} +static inline short4 operator||(short p, short4 q) +{ + return short4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline short2 operator||(ushort2 p, ushort2 q) +{ + return short2(p.x || q.x, p.y || q.y); +} +static inline short3 operator||(ushort3 p, ushort3 q) +{ + return short3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline short4 operator||(ushort4 p, ushort4 q) +{ + return short4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline short2 operator||(ushort2 p, ushort q) +{ + return short2(p.x || q, p.y || q); +} +static inline short3 operator||(ushort3 p, ushort q) +{ + return short3(p.x || q, p.y || q, p.z || q); +} +static inline short4 operator||(ushort4 p, ushort q) +{ + return short4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline short2 operator||(ushort p, ushort2 q) +{ + return short2(p || q.x, p || q.y); +} +static inline short3 operator||(ushort p, ushort3 q) +{ + return short3(p || q.x, p || q.y, p || q.z); +} +static inline short4 operator||(ushort p, ushort4 q) +{ + return short4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline long2 operator||(long2 p, long2 q) +{ + return long2(p.x || q.x, p.y || q.y); +} +static inline long3 operator||(long3 p, long3 q) +{ + return long3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline long4 operator||(long4 p, long4 q) +{ + return long4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline long2 operator||(long2 p, long q) +{ + return long2(p.x || q, p.y || q); +} +static inline long3 operator||(long3 p, long q) +{ + return long3(p.x || q, p.y || q, p.z || q); +} +static inline long4 operator||(long4 p, long q) +{ + return long4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline long2 operator||(long p, long2 q) +{ + return long2(p || q.x, p || q.y); +} +static inline long3 operator||(long p, long3 q) +{ + return long3(p || q.x, p || q.y, p || q.z); +} +static inline long4 operator||(long p, long4 q) +{ + return long4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline long2 operator||(ulong2 p, ulong2 q) +{ + return long2(p.x || q.x, p.y || q.y); +} +static inline long3 operator||(ulong3 p, ulong3 q) +{ + return long3(p.x || q.x, p.y || q.y, p.z || q.z); +} +static inline long4 operator||(ulong4 p, ulong4 q) +{ + return long4(p.x || q.x, p.y || q.y, p.z || q.z, p.w || q.w); +} +static inline long2 operator||(ulong2 p, ulong q) +{ + return long2(p.x || q, p.y || q); +} +static inline long3 operator||(ulong3 p, ulong q) +{ + return long3(p.x || q, p.y || q, p.z || q); +} +static inline long4 operator||(ulong4 p, ulong q) +{ + return long4(p.x || q, p.y || q, p.z || q, p.w || q); +} +static inline long2 operator||(ulong p, ulong2 q) +{ + return long2(p || q.x, p || q.y); +} +static inline long3 operator||(ulong p, ulong3 q) +{ + return long3(p || q.x, p || q.y, p || q.z); +} +static inline long4 operator||(ulong p, ulong4 q) +{ + return long4(p || q.x, p || q.y, p || q.z, p || q.w); +} +static inline float2 convert_float2(float2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(float3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(float4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(double2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(double3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(double4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(int2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(int3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(int4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(uint2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(uint3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(uint4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(short2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(short3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(short4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(ushort2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(ushort3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(ushort4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(long2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(long3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(long4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline float2 convert_float2(ulong2 p) +{ + return float2((float)p.x, (float)p.y); +} +static inline float3 convert_float3(ulong3 p) +{ + return float3((float)p.x, (float)p.y, (float)p.z); +} +static inline float4 convert_float4(ulong4 p) +{ + return float4((float)p.x, (float)p.y, (float)p.z, (float)p.w); +} +static inline double2 convert_double2(float2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(float3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(float4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(double2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(double3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(double4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(int2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(int3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(int4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(uint2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(uint3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(uint4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(short2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(short3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(short4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(ushort2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(ushort3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(ushort4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(long2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(long3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(long4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline double2 convert_double2(ulong2 p) +{ + return double2((double)p.x, (double)p.y); +} +static inline double3 convert_double3(ulong3 p) +{ + return double3((double)p.x, (double)p.y, (double)p.z); +} +static inline double4 convert_double4(ulong4 p) +{ + return double4((double)p.x, (double)p.y, (double)p.z, (double)p.w); +} +static inline int2 convert_int2(float2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(float3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(float4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(double2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(double3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(double4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(int2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(int3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(int4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(uint2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(uint3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(uint4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(short2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(short3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(short4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(ushort2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(ushort3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(ushort4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(long2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(long3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(long4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline int2 convert_int2(ulong2 p) +{ + return int2((int)p.x, (int)p.y); +} +static inline int3 convert_int3(ulong3 p) +{ + return int3((int)p.x, (int)p.y, (int)p.z); +} +static inline int4 convert_int4(ulong4 p) +{ + return int4((int)p.x, (int)p.y, (int)p.z, (int)p.w); +} +static inline uint2 convert_uint2(float2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(float3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(float4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(double2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(double3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(double4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(int2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(int3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(int4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(uint2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(uint3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(uint4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(short2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(short3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(short4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(ushort2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(ushort3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(ushort4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(long2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(long3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(long4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline uint2 convert_uint2(ulong2 p) +{ + return uint2((uint) p.x, (uint) p.y); +} +static inline uint3 convert_uint3(ulong3 p) +{ + return uint3((uint) p.x, (uint) p.y, (uint) p.z); +} +static inline uint4 convert_uint4(ulong4 p) +{ + return uint4((uint) p.x, (uint) p.y, (uint) p.z, (uint) p.w); +} +static inline short2 convert_short2(float2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(float3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(float4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(double2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(double3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(double4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(int2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(int3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(int4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(uint2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(uint3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(uint4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(short2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(short3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(short4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(ushort2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(ushort3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(ushort4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(long2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(long3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(long4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline short2 convert_short2(ulong2 p) +{ + return short2((short)p.x, (short)p.y); +} +static inline short3 convert_short3(ulong3 p) +{ + return short3((short)p.x, (short)p.y, (short)p.z); +} +static inline short4 convert_short4(ulong4 p) +{ + return short4((short)p.x, (short)p.y, (short)p.z, (short)p.w); +} +static inline ushort2 convert_ushort2(float2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(float3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(float4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(double2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(double3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(double4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(int2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(int3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(int4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(uint2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(uint3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(uint4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(short2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(short3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(short4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(ushort2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(ushort3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(ushort4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(long2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(long3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(long4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline ushort2 convert_ushort2(ulong2 p) +{ + return ushort2((ushort) p.x, (ushort) p.y); +} +static inline ushort3 convert_ushort3(ulong3 p) +{ + return ushort3((ushort) p.x, (ushort) p.y, (ushort) p.z); +} +static inline ushort4 convert_ushort4(ulong4 p) +{ + return ushort4((ushort) p.x, (ushort) p.y, (ushort) p.z, (ushort) p.w); +} +static inline long2 convert_long2(float2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(float3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(float4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(double2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(double3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(double4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(int2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(int3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(int4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(uint2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(uint3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(uint4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(short2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(short3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(short4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(ushort2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(ushort3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(ushort4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(long2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(long3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(long4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline long2 convert_long2(ulong2 p) +{ + return long2((long)p.x, (long)p.y); +} +static inline long3 convert_long3(ulong3 p) +{ + return long3((long)p.x, (long)p.y, (long)p.z); +} +static inline long4 convert_long4(ulong4 p) +{ + return long4((long)p.x, (long)p.y, (long)p.z, (long)p.w); +} +static inline ulong2 convert_ulong2(float2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(float3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(float4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(double2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(double3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(double4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(int2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(int3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(int4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(uint2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(uint3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(uint4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(short2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(short3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(short4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(ushort2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(ushort3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(ushort4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(long2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(long3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(long4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline ulong2 convert_ulong2(ulong2 p) +{ + return ulong2((ulong) p.x, (ulong) p.y); +} +static inline ulong3 convert_ulong3(ulong3 p) +{ + return ulong3((ulong) p.x, (ulong) p.y, (ulong) p.z); +} +static inline ulong4 convert_ulong4(ulong4 p) +{ + return ulong4((ulong) p.x, (ulong) p.y, (ulong) p.z, (ulong) p.w); +} +static inline float2 as_float2(float2 inp) +{ + float2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline int2 as_int2(float2 inp) +{ + int2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline uint2 as_uint2(float2 inp) +{ + uint2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline double2 as_double2(double2 inp) +{ + double2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline long2 as_long2(double2 inp) +{ + long2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline ulong2 as_ulong2(double2 inp) +{ + ulong2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline float2 as_float2(int2 inp) +{ + float2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline int2 as_int2(int2 inp) +{ + int2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline uint2 as_uint2(int2 inp) +{ + uint2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline float2 as_float2(uint2 inp) +{ + float2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline int2 as_int2(uint2 inp) +{ + int2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline uint2 as_uint2(uint2 inp) +{ + uint2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline short2 as_short2(short2 inp) +{ + short2 val1; + memcpy(&val1, &inp, 4); + return val1; +} +static inline ushort2 as_ushort2(short2 inp) +{ + ushort2 val1; + memcpy(&val1, &inp, 4); + return val1; +} +static inline short2 as_short2(ushort2 inp) +{ + short2 val1; + memcpy(&val1, &inp, 4); + return val1; +} +static inline ushort2 as_ushort2(ushort2 inp) +{ + ushort2 val1; + memcpy(&val1, &inp, 4); + return val1; +} +static inline double2 as_double2(long2 inp) +{ + double2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline long2 as_long2(long2 inp) +{ + long2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline ulong2 as_ulong2(long2 inp) +{ + ulong2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline double2 as_double2(ulong2 inp) +{ + double2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline long2 as_long2(ulong2 inp) +{ + long2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline ulong2 as_ulong2(ulong2 inp) +{ + ulong2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline short4 as_short4(float2 inp) +{ + short4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline ushort4 as_ushort4(float2 inp) +{ + ushort4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline float4 as_float4(double2 inp) +{ + float4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline int4 as_int4(double2 inp) +{ + int4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline uint4 as_uint4(double2 inp) +{ + uint4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline short4 as_short4(int2 inp) +{ + short4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline ushort4 as_ushort4(int2 inp) +{ + ushort4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline short4 as_short4(uint2 inp) +{ + short4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline ushort4 as_ushort4(uint2 inp) +{ + ushort4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline float4 as_float4(long2 inp) +{ + float4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline int4 as_int4(long2 inp) +{ + int4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline uint4 as_uint4(long2 inp) +{ + uint4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline float4 as_float4(ulong2 inp) +{ + float4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline int4 as_int4(ulong2 inp) +{ + int4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline uint4 as_uint4(ulong2 inp) +{ + uint4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline float3 as_float3(float3 inp) +{ + float3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline int3 as_int3(float3 inp) +{ + int3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline uint3 as_uint3(float3 inp) +{ + uint3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline double3 as_double3(double3 inp) +{ + double3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline long3 as_long3(double3 inp) +{ + long3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline ulong3 as_ulong3(double3 inp) +{ + ulong3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline float3 as_float3(int3 inp) +{ + float3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline int3 as_int3(int3 inp) +{ + int3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline uint3 as_uint3(int3 inp) +{ + uint3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline float3 as_float3(uint3 inp) +{ + float3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline int3 as_int3(uint3 inp) +{ + int3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline uint3 as_uint3(uint3 inp) +{ + uint3 val1; + memcpy(&val1, &inp, 12); + return val1; +} +static inline short3 as_short3(short3 inp) +{ + short3 val1; + memcpy(&val1, &inp, 6); + return val1; +} +static inline ushort3 as_ushort3(short3 inp) +{ + ushort3 val1; + memcpy(&val1, &inp, 6); + return val1; +} +static inline short3 as_short3(ushort3 inp) +{ + short3 val1; + memcpy(&val1, &inp, 6); + return val1; +} +static inline ushort3 as_ushort3(ushort3 inp) +{ + ushort3 val1; + memcpy(&val1, &inp, 6); + return val1; +} +static inline double3 as_double3(long3 inp) +{ + double3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline long3 as_long3(long3 inp) +{ + long3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline ulong3 as_ulong3(long3 inp) +{ + ulong3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline double3 as_double3(ulong3 inp) +{ + double3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline long3 as_long3(ulong3 inp) +{ + long3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline ulong3 as_ulong3(ulong3 inp) +{ + ulong3 val1; + memcpy(&val1, &inp, 24); + return val1; +} +static inline double2 as_double2(float4 inp) +{ + double2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline long2 as_long2(float4 inp) +{ + long2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline ulong2 as_ulong2(float4 inp) +{ + ulong2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline double2 as_double2(int4 inp) +{ + double2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline long2 as_long2(int4 inp) +{ + long2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline ulong2 as_ulong2(int4 inp) +{ + ulong2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline double2 as_double2(uint4 inp) +{ + double2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline long2 as_long2(uint4 inp) +{ + long2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline ulong2 as_ulong2(uint4 inp) +{ + ulong2 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline float2 as_float2(short4 inp) +{ + float2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline int2 as_int2(short4 inp) +{ + int2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline uint2 as_uint2(short4 inp) +{ + uint2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline float2 as_float2(ushort4 inp) +{ + float2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline int2 as_int2(ushort4 inp) +{ + int2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline uint2 as_uint2(ushort4 inp) +{ + uint2 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline float4 as_float4(float4 inp) +{ + float4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline int4 as_int4(float4 inp) +{ + int4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline uint4 as_uint4(float4 inp) +{ + uint4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline double4 as_double4(double4 inp) +{ + double4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline long4 as_long4(double4 inp) +{ + long4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline ulong4 as_ulong4(double4 inp) +{ + ulong4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline float4 as_float4(int4 inp) +{ + float4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline int4 as_int4(int4 inp) +{ + int4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline uint4 as_uint4(int4 inp) +{ + uint4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline float4 as_float4(uint4 inp) +{ + float4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline int4 as_int4(uint4 inp) +{ + int4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline uint4 as_uint4(uint4 inp) +{ + uint4 val1; + memcpy(&val1, &inp, 16); + return val1; +} +static inline short4 as_short4(short4 inp) +{ + short4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline ushort4 as_ushort4(short4 inp) +{ + ushort4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline short4 as_short4(ushort4 inp) +{ + short4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline ushort4 as_ushort4(ushort4 inp) +{ + ushort4 val1; + memcpy(&val1, &inp, 8); + return val1; +} +static inline double4 as_double4(long4 inp) +{ + double4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline long4 as_long4(long4 inp) +{ + long4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline ulong4 as_ulong4(long4 inp) +{ + ulong4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline double4 as_double4(ulong4 inp) +{ + double4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline long4 as_long4(ulong4 inp) +{ + long4 val1; + memcpy(&val1, &inp, 32); + return val1; +} +static inline ulong4 as_ulong4(ulong4 inp) +{ + ulong4 val1; + memcpy(&val1, &inp, 32); + return val1; +} + +#define xx xx() +#define xy xy() +#define xz xz() +#define xw xw() +#define yx yx() +#define yy yy() +#define yz yz() +#define yw yw() +#define zx zx() +#define zy zy() +#define zz zz() +#define zw zw() +#define wx wx() +#define wy wy() +#define wz wz() +#define ww ww() +#define xxx xxx() +#define xxy xxy() +#define xxz xxz() +#define xxw xxw() +#define xyx xyx() +#define xyy xyy() +#define xyz xyz() +#define xyw xyw() +#define xzx xzx() +#define xzy xzy() +#define xzz xzz() +#define xzw xzw() +#define xwx xwx() +#define xwy xwy() +#define xwz xwz() +#define xww xww() +#define yxx yxx() +#define yxy yxy() +#define yxz yxz() +#define yxw yxw() +#define yyx yyx() +#define yyy yyy() +#define yyz yyz() +#define yyw yyw() +#define yzx yzx() +#define yzy yzy() +#define yzz yzz() +#define yzw yzw() +#define ywx ywx() +#define ywy ywy() +#define ywz ywz() +#define yww yww() +#define zxx zxx() +#define zxy zxy() +#define zxz zxz() +#define zxw zxw() +#define zyx zyx() +#define zyy zyy() +#define zyz zyz() +#define zyw zyw() +#define zzx zzx() +#define zzy zzy() +#define zzz zzz() +#define zzw zzw() +#define zwx zwx() +#define zwy zwy() +#define zwz zwz() +#define zww zww() +#define wxx wxx() +#define wxy wxy() +#define wxz wxz() +#define wxw wxw() +#define wyx wyx() +#define wyy wyy() +#define wyz wyz() +#define wyw wyw() +#define wzx wzx() +#define wzy wzy() +#define wzz wzz() +#define wzw wzw() +#define wwx wwx() +#define wwy wwy() +#define wwz wwz() +#define www www() +#define xxxx xxxx() +#define xxxy xxxy() +#define xxxz xxxz() +#define xxxw xxxw() +#define xxyx xxyx() +#define xxyy xxyy() +#define xxyz xxyz() +#define xxyw xxyw() +#define xxzx xxzx() +#define xxzy xxzy() +#define xxzz xxzz() +#define xxzw xxzw() +#define xxwx xxwx() +#define xxwy xxwy() +#define xxwz xxwz() +#define xxww xxww() +#define xyxx xyxx() +#define xyxy xyxy() +#define xyxz xyxz() +#define xyxw xyxw() +#define xyyx xyyx() +#define xyyy xyyy() +#define xyyz xyyz() +#define xyyw xyyw() +#define xyzx xyzx() +#define xyzy xyzy() +#define xyzz xyzz() +#define xyzw xyzw() +#define xywx xywx() +#define xywy xywy() +#define xywz xywz() +#define xyww xyww() +#define xzxx xzxx() +#define xzxy xzxy() +#define xzxz xzxz() +#define xzxw xzxw() +#define xzyx xzyx() +#define xzyy xzyy() +#define xzyz xzyz() +#define xzyw xzyw() +#define xzzx xzzx() +#define xzzy xzzy() +#define xzzz xzzz() +#define xzzw xzzw() +#define xzwx xzwx() +#define xzwy xzwy() +#define xzwz xzwz() +#define xzww xzww() +#define xwxx xwxx() +#define xwxy xwxy() +#define xwxz xwxz() +#define xwxw xwxw() +#define xwyx xwyx() +#define xwyy xwyy() +#define xwyz xwyz() +#define xwyw xwyw() +#define xwzx xwzx() +#define xwzy xwzy() +#define xwzz xwzz() +#define xwzw xwzw() +#define xwwx xwwx() +#define xwwy xwwy() +#define xwwz xwwz() +#define xwww xwww() +#define yxxx yxxx() +#define yxxy yxxy() +#define yxxz yxxz() +#define yxxw yxxw() +#define yxyx yxyx() +#define yxyy yxyy() +#define yxyz yxyz() +#define yxyw yxyw() +#define yxzx yxzx() +#define yxzy yxzy() +#define yxzz yxzz() +#define yxzw yxzw() +#define yxwx yxwx() +#define yxwy yxwy() +#define yxwz yxwz() +#define yxww yxww() +#define yyxx yyxx() +#define yyxy yyxy() +#define yyxz yyxz() +#define yyxw yyxw() +#define yyyx yyyx() +#define yyyy yyyy() +#define yyyz yyyz() +#define yyyw yyyw() +#define yyzx yyzx() +#define yyzy yyzy() +#define yyzz yyzz() +#define yyzw yyzw() +#define yywx yywx() +#define yywy yywy() +#define yywz yywz() +#define yyww yyww() +#define yzxx yzxx() +#define yzxy yzxy() +#define yzxz yzxz() +#define yzxw yzxw() +#define yzyx yzyx() +#define yzyy yzyy() +#define yzyz yzyz() +#define yzyw yzyw() +#define yzzx yzzx() +#define yzzy yzzy() +#define yzzz yzzz() +#define yzzw yzzw() +#define yzwx yzwx() +#define yzwy yzwy() +#define yzwz yzwz() +#define yzww yzww() +#define ywxx ywxx() +#define ywxy ywxy() +#define ywxz ywxz() +#define ywxw ywxw() +#define ywyx ywyx() +#define ywyy ywyy() +#define ywyz ywyz() +#define ywyw ywyw() +#define ywzx ywzx() +#define ywzy ywzy() +#define ywzz ywzz() +#define ywzw ywzw() +#define ywwx ywwx() +#define ywwy ywwy() +#define ywwz ywwz() +#define ywww ywww() +#define zxxx zxxx() +#define zxxy zxxy() +#define zxxz zxxz() +#define zxxw zxxw() +#define zxyx zxyx() +#define zxyy zxyy() +#define zxyz zxyz() +#define zxyw zxyw() +#define zxzx zxzx() +#define zxzy zxzy() +#define zxzz zxzz() +#define zxzw zxzw() +#define zxwx zxwx() +#define zxwy zxwy() +#define zxwz zxwz() +#define zxww zxww() +#define zyxx zyxx() +#define zyxy zyxy() +#define zyxz zyxz() +#define zyxw zyxw() +#define zyyx zyyx() +#define zyyy zyyy() +#define zyyz zyyz() +#define zyyw zyyw() +#define zyzx zyzx() +#define zyzy zyzy() +#define zyzz zyzz() +#define zyzw zyzw() +#define zywx zywx() +#define zywy zywy() +#define zywz zywz() +#define zyww zyww() +#define zzxx zzxx() +#define zzxy zzxy() +#define zzxz zzxz() +#define zzxw zzxw() +#define zzyx zzyx() +#define zzyy zzyy() +#define zzyz zzyz() +#define zzyw zzyw() +#define zzzx zzzx() +#define zzzy zzzy() +#define zzzz zzzz() +#define zzzw zzzw() +#define zzwx zzwx() +#define zzwy zzwy() +#define zzwz zzwz() +#define zzww zzww() +#define zwxx zwxx() +#define zwxy zwxy() +#define zwxz zwxz() +#define zwxw zwxw() +#define zwyx zwyx() +#define zwyy zwyy() +#define zwyz zwyz() +#define zwyw zwyw() +#define zwzx zwzx() +#define zwzy zwzy() +#define zwzz zwzz() +#define zwzw zwzw() +#define zwwx zwwx() +#define zwwy zwwy() +#define zwwz zwwz() +#define zwww zwww() +#define wxxx wxxx() +#define wxxy wxxy() +#define wxxz wxxz() +#define wxxw wxxw() +#define wxyx wxyx() +#define wxyy wxyy() +#define wxyz wxyz() +#define wxyw wxyw() +#define wxzx wxzx() +#define wxzy wxzy() +#define wxzz wxzz() +#define wxzw wxzw() +#define wxwx wxwx() +#define wxwy wxwy() +#define wxwz wxwz() +#define wxww wxww() +#define wyxx wyxx() +#define wyxy wyxy() +#define wyxz wyxz() +#define wyxw wyxw() +#define wyyx wyyx() +#define wyyy wyyy() +#define wyyz wyyz() +#define wyyw wyyw() +#define wyzx wyzx() +#define wyzy wyzy() +#define wyzz wyzz() +#define wyzw wyzw() +#define wywx wywx() +#define wywy wywy() +#define wywz wywz() +#define wyww wyww() +#define wzxx wzxx() +#define wzxy wzxy() +#define wzxz wzxz() +#define wzxw wzxw() +#define wzyx wzyx() +#define wzyy wzyy() +#define wzyz wzyz() +#define wzyw wzyw() +#define wzzx wzzx() +#define wzzy wzzy() +#define wzzz wzzz() +#define wzzw wzzw() +#define wzwx wzwx() +#define wzwy wzwy() +#define wzwz wzwz() +#define wzww wzww() +#define wwxx wwxx() +#define wwxy wwxy() +#define wwxz wwxz() +#define wwxw wwxw() +#define wwyx wwyx() +#define wwyy wwyy() +#define wwyz wwyz() +#define wwyw wwyw() +#define wwzx wwzx() +#define wwzy wwzy() +#define wwzz wwzz() +#define wwzw wwzw() +#define wwwx wwwx() +#define wwwy wwwy() +#define wwwz wwwz() +#define wwww wwww() diff --git a/3rdparty/bimg/3rdparty/nvtt/nvcore/debug.h b/3rdparty/bimg/3rdparty/nvtt/nvcore/debug.h index 61fbd2fcf46..31d0f51a584 100644 --- a/3rdparty/bimg/3rdparty/nvtt/nvcore/debug.h +++ b/3rdparty/bimg/3rdparty/nvtt/nvcore/debug.h @@ -165,7 +165,7 @@ NVCORE_API void NV_CDECL nvDebugPrint( const char *msg, ... ) __attribute__((for namespace nv { inline bool isValidPtr(const void * ptr) { - #if NV_CPU_X86_64 + #if NV_CPU_X86_64 || NV_CPU_AARCH64 if (ptr == NULL) return true; if (reinterpret_cast(ptr) < 0x10000ULL) return false; if (reinterpret_cast(ptr) >= 0x000007FFFFFEFFFFULL) return false; diff --git a/3rdparty/bimg/3rdparty/nvtt/nvtt.cpp b/3rdparty/bimg/3rdparty/nvtt/nvtt.cpp index ef0cec6e34f..0cc0df481eb 100644 --- a/3rdparty/bimg/3rdparty/nvtt/nvtt.cpp +++ b/3rdparty/bimg/3rdparty/nvtt/nvtt.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #include "nvtt.h" @@ -50,9 +50,9 @@ namespace nvtt for (uint32_t blockX = 0; blockX < ZOH::Tile::TILE_W; ++blockX) { nv::Vector4 color = srcRgba[blockY*srcRgbaStride + blockX]; - zohTile.data[blockY][blockX].x = float(int16_t(bx::halfFromFloat(color.x) ) ); - zohTile.data[blockY][blockX].y = float(int16_t(bx::halfFromFloat(color.y) ) ); - zohTile.data[blockY][blockX].z = float(int16_t(bx::halfFromFloat(color.z) ) ); + zohTile.data[blockY][blockX].x = float(int16_t(bx::halfFromFloat(bx::max(color.x, 0.0f) ) ) ); + zohTile.data[blockY][blockX].y = float(int16_t(bx::halfFromFloat(bx::max(color.y, 0.0f) ) ) ); + zohTile.data[blockY][blockX].z = float(int16_t(bx::halfFromFloat(bx::max(color.z, 0.0f) ) ) ); } } diff --git a/3rdparty/bimg/3rdparty/stb/stb_image.h b/3rdparty/bimg/3rdparty/stb/stb_image.h index 3ce6d8fa11e..d7d3e1ab9c9 100644 --- a/3rdparty/bimg/3rdparty/stb/stb_image.h +++ b/3rdparty/bimg/3rdparty/stb/stb_image.h @@ -1,3 +1,9 @@ +#if defined(__has_warning) +# if __has_warning("-Wcomma") +# pragma GCC diagnostic ignored "-Wcomma" // Possible misuse of comma operator here +# endif +#endif + #if defined(_MSC_VER) # pragma warning(disable:4244) // warning C4244: '=': conversion from 'int' to 'stbi__uint16', possible loss of data # pragma warning(disable:4245) // warning C4245: 'argument': conversion from 'int' to 'char', signed/unsigned mismatch diff --git a/3rdparty/bimg/3rdparty/stb/stb_image_resize.h b/3rdparty/bimg/3rdparty/stb/stb_image_resize.h index b507e0498a4..031ca99dc35 100644 --- a/3rdparty/bimg/3rdparty/stb/stb_image_resize.h +++ b/3rdparty/bimg/3rdparty/stb/stb_image_resize.h @@ -1,4 +1,4 @@ -/* stb_image_resize - v0.94 - public domain image resizing +/* stb_image_resize - v0.95 - public domain image resizing by Jorge L Rodriguez (@VinoBS) - 2014 http://github.com/nothings/stb @@ -156,8 +156,10 @@ Jorge L Rodriguez: Implementation Sean Barrett: API design, optimizations Aras Pranckevicius: bugfix - + Nathan Reed: warning fixes + REVISIONS + 0.95 (2017-07-23) fixed warnings 0.94 (2017-03-18) fixed warnings 0.93 (2017-03-03) fixed bug with certain combinations of heights 0.92 (2017-01-02) fix integer overflow on large (>2GB) images @@ -393,8 +395,9 @@ STBIRDEF int stbir_resize_region( const void *input_pixels , int input_w , int #ifndef STBIR_MALLOC #include -#define STBIR_MALLOC(size,c) malloc(size) -#define STBIR_FREE(ptr,c) free(ptr) +// use comma operator to evaluate c, to avoid "unused parameter" warnings +#define STBIR_MALLOC(size,c) ((void)(c), malloc(size)) +#define STBIR_FREE(ptr,c) ((void)(c), free(ptr)) #endif #ifndef _MSC_VER @@ -983,7 +986,7 @@ static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max) return (m); } - return n; // NOTREACHED + // NOTREACHED default: STBIR_ASSERT(!"Unimplemented edge type"); diff --git a/3rdparty/bimg/3rdparty/tinyexr/tinyexr.h b/3rdparty/bimg/3rdparty/tinyexr/tinyexr.h index b0998b68de5..3255bbc7350 100644 --- a/3rdparty/bimg/3rdparty/tinyexr/tinyexr.h +++ b/3rdparty/bimg/3rdparty/tinyexr/tinyexr.h @@ -1,5 +1,5 @@ /* -Copyright (c) 2014 - 2016, Syoyo Fujita +Copyright (c) 2014 - 2018, Syoyo Fujita and many contributors. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -9,7 +9,7 @@ modification, are permitted provided that the following conditions are met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of the nor the + * Neither the name of the Syoyo Fujita nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -115,6 +115,9 @@ extern "C" { #define TINYEXR_ERROR_CANT_OPEN_FILE (-6) #define TINYEXR_ERROR_UNSUPPORTED_FORMAT (-7) #define TINYEXR_ERROR_INVALID_HEADER (-8) +#define TINYEXR_ERROR_UNSUPPORTED_FEATURE (-9) +#define TINYEXR_ERROR_CANT_WRITE_FILE (-10) +#define TINYEXR_ERROR_SERIALZATION_FAILED (-11) // @note { OpenEXR file format: http://www.openexr.com/openexrfilelayout.pdf } @@ -123,7 +126,8 @@ extern "C" { #define TINYEXR_PIXELTYPE_HALF (1) #define TINYEXR_PIXELTYPE_FLOAT (2) -#define TINYEXR_MAX_ATTRIBUTES (128) +#define TINYEXR_MAX_HEADER_ATTRIBUTES (1024) +#define TINYEXR_MAX_CUSTOM_ATTRIBUTES (128) #define TINYEXR_COMPRESSIONTYPE_NONE (0) #define TINYEXR_COMPRESSIONTYPE_RLE (1) @@ -205,7 +209,8 @@ typedef struct _EXRHeader { // Custom attributes(exludes required attributes(e.g. `channels`, // `compression`, etc) int num_custom_attributes; - EXRAttribute custom_attributes[TINYEXR_MAX_ATTRIBUTES]; + EXRAttribute *custom_attributes; // array of EXRAttribute. size = + // `num_custom_attributes`. EXRChannelInfo *channels; // [num_channels] @@ -259,7 +264,8 @@ typedef struct _DeepImage { } DeepImage; // @deprecated { to be removed. } -// Loads single-frame OpenEXR image. Assume EXR image contains RGB(A) channels. +// Loads single-frame OpenEXR image. Assume EXR image contains A(single channel +// alpha) or RGB(A) channels. // Application must free image data as returned by `out_rgba` // Result image format is: float x RGBA x width x hight // Returns negative value and may set error string in `err` when there's an @@ -269,10 +275,18 @@ extern int LoadEXR(float **out_rgba, int *width, int *height, // @deprecated { to be removed. } // Saves single-frame OpenEXR image. Assume EXR image contains RGB(A) channels. -// components must be 3(RGB) or 4(RGBA). -// Result image format is: float x RGB(A) x width x hight -extern int SaveEXR(const float *data, int width, int height, int components, - const char *filename); +// components must be 1(Grayscale), 3(RGB) or 4(RGBA). +// Input image format is: `float x width x height`, or `float x RGB(A) x width x +// hight` +// Save image as fp16(HALF) format when `save_as_fp16` is positive non-zero +// value. +// Save image as fp32(FLOAT) format when `save_as_fp16` is 0. +// Use ZIP compression by default. +// Returns negative value and may set error string in `err` when there's an +// error +extern int SaveEXR(const float *data, const int width, const int height, + const int components, const int save_as_fp16, + const char *filename, const char **err); // Initialize EXRHeader struct extern void InitEXRHeader(EXRHeader *exr_header); @@ -286,6 +300,9 @@ extern int FreeEXRHeader(EXRHeader *exr_header); // Free's internal data of EXRImage struct extern int FreeEXRImage(EXRImage *exr_image); +// Free's error message +extern void FreeEXRErrorMessage(const char *msg); + // Parse EXR version header of a file. extern int ParseEXRVersionFromFile(EXRVersion *version, const char *filename); @@ -294,10 +311,14 @@ extern int ParseEXRVersionFromMemory(EXRVersion *version, const unsigned char *memory, size_t size); // Parse single-part OpenEXR header from a file and initialize `EXRHeader`. +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int ParseEXRHeaderFromFile(EXRHeader *header, const EXRVersion *version, const char *filename, const char **err); // Parse single-part OpenEXR header from a memory and initialize `EXRHeader`. +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int ParseEXRHeaderFromMemory(EXRHeader *header, const EXRVersion *version, const unsigned char *memory, size_t size, @@ -305,6 +326,8 @@ extern int ParseEXRHeaderFromMemory(EXRHeader *header, // Parse multi-part OpenEXR headers from a file and initialize `EXRHeader*` // array. +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int ParseEXRMultipartHeaderFromFile(EXRHeader ***headers, int *num_headers, const EXRVersion *version, @@ -313,6 +336,8 @@ extern int ParseEXRMultipartHeaderFromFile(EXRHeader ***headers, // Parse multi-part OpenEXR headers from a memory and initialize `EXRHeader*` // array +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int ParseEXRMultipartHeaderFromMemory(EXRHeader ***headers, int *num_headers, const EXRVersion *version, @@ -324,6 +349,8 @@ extern int ParseEXRMultipartHeaderFromMemory(EXRHeader ***headers, // Application can free EXRImage using `FreeEXRImage` // Returns negative value and may set error string in `err` when there's an // error +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int LoadEXRImageFromFile(EXRImage *image, const EXRHeader *header, const char *filename, const char **err); @@ -333,10 +360,11 @@ extern int LoadEXRImageFromFile(EXRImage *image, const EXRHeader *header, // Application can free EXRImage using `FreeEXRImage` // Returns negative value and may set error string in `err` when there's an // error +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int LoadEXRImageFromMemory(EXRImage *image, const EXRHeader *header, const unsigned char *memory, - const size_t size, - const char **err); + const size_t size, const char **err); // Loads multi-part OpenEXR image from a file. // Application must setup `ParseEXRMultipartHeaderFromFile` before calling this @@ -344,6 +372,8 @@ extern int LoadEXRImageFromMemory(EXRImage *image, const EXRHeader *header, // Application can free EXRImage using `FreeEXRImage` // Returns negative value and may set error string in `err` when there's an // error +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int LoadEXRMultipartImageFromFile(EXRImage *images, const EXRHeader **headers, unsigned int num_parts, @@ -356,24 +386,30 @@ extern int LoadEXRMultipartImageFromFile(EXRImage *images, // Application can free EXRImage using `FreeEXRImage` // Returns negative value and may set error string in `err` when there's an // error +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int LoadEXRMultipartImageFromMemory(EXRImage *images, const EXRHeader **headers, unsigned int num_parts, const unsigned char *memory, - const char **err); + const size_t size, const char **err); // Saves multi-channel, single-frame OpenEXR image to a file. // Returns negative value and may set error string in `err` when there's an // error +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int SaveEXRImageToFile(const EXRImage *image, const EXRHeader *exr_header, const char *filename, const char **err); // Saves multi-channel, single-frame OpenEXR image to a memory. // Image is compressed using EXRImage.compression value. -// Return the number of bytes if succes. -// Returns negative value and may set error string in `err` when there's an -// error +// Return the number of bytes if success. +// Return zero and will set error string in `err` when there's an +// error. +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern size_t SaveEXRImageToMemory(const EXRImage *image, const EXRHeader *exr_header, unsigned char **memory, const char **err); @@ -382,6 +418,8 @@ extern size_t SaveEXRImageToMemory(const EXRImage *image, // Application must free memory of variables in DeepImage(image, offset_table) // Returns negative value and may set error string in `err` when there's an // error +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() extern int LoadDeepEXR(DeepImage *out_image, const char *filename, const char **err); @@ -402,30 +440,40 @@ extern int LoadDeepEXR(DeepImage *out_image, const char *filename, // For emscripten. // Loads single-frame OpenEXR image from memory. Assume EXR image contains // RGB(A) channels. -// `out_rgba` must have enough memory(at least sizeof(float) x 4(RGBA) x width x -// hight) // Returns negative value and may set error string in `err` when there's an // error -extern int LoadEXRFromMemory(float *out_rgba, const unsigned char *memory, - size_t size, const char **err); +// When there was an error message, Application must free `err` with +// FreeEXRErrorMessage() +extern int LoadEXRFromMemory(float **out_rgba, int *width, int *height, + const unsigned char *memory, size_t size, + const char **err); #ifdef __cplusplus } #endif +#endif // TINYEXR_H_ + #ifdef TINYEXR_IMPLEMENTATION +#ifndef TINYEXR_IMPLEMENTATION_DEIFNED +#define TINYEXR_IMPLEMENTATION_DEIFNED + #include #include #include #include #include +#include #include +#include #include #include -// @todo { remove including tinyexr.h } -#include "tinyexr.h" +#if __cplusplus > 199711L +// C++11 +#include +#endif // __cplusplus > 199711L #ifdef _OPENMP #include @@ -433,7 +481,9 @@ extern int LoadEXRFromMemory(float *out_rgba, const unsigned char *memory, #if TINYEXR_USE_MINIZ #else -#include "zlib.h" +// Issue #46. Please include your own zlib-compatible API header before +// including `tinyexr.h` +//#include "zlib.h" #endif #if TINYEXR_USE_ZFP @@ -477,6 +527,30 @@ namespace miniz { #pragma clang diagnostic ignored "-Wsign-conversion" #pragma clang diagnostic ignored "-Wc++11-extensions" #pragma clang diagnostic ignored "-Wconversion" +#pragma clang diagnostic ignored "-Wunused-function" +#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#pragma clang diagnostic ignored "-Wundef" + +#if __has_warning("-Wcomma") +#pragma clang diagnostic ignored "-Wcomma" +#endif + +#if __has_warning("-Wmacro-redefined") +#pragma clang diagnostic ignored "-Wmacro-redefined" +#endif + +#if __has_warning("-Wcast-qual") +#pragma clang diagnostic ignored "-Wcast-qual" +#endif + +#if __has_warning("-Wzero-as-null-pointer-constant") +#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif + +#if __has_warning("-Wtautological-constant-compare") +#pragma clang diagnostic ignored "-Wtautological-constant-compare" +#endif + #endif /* miniz.c v1.15 - public domain deflate/inflate, zlib-subset, ZIP @@ -736,7 +810,7 @@ namespace miniz { #ifndef MINIZ_HEADER_INCLUDED #define MINIZ_HEADER_INCLUDED -#include +//#include // Defines to completely disable specific portions of miniz.c: // If all macros here are defined the only functionality remaining will be @@ -754,7 +828,7 @@ namespace miniz { #define MINIZ_NO_TIME // Define MINIZ_NO_ARCHIVE_APIS to disable all ZIP archive API's. -//#define MINIZ_NO_ARCHIVE_APIS +#define MINIZ_NO_ARCHIVE_APIS // Define MINIZ_NO_ARCHIVE_APIS to disable all writing related ZIP archive // API's. @@ -784,7 +858,7 @@ namespace miniz { #endif #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS) -#include +//#include #endif #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \ @@ -792,8 +866,6 @@ namespace miniz { defined(i386) || defined(__ia64__) || defined(__x86_64__) // MINIZ_X86_OR_X64_CPU is only used to help set the below macros. #define MINIZ_X86_OR_X64_CPU 1 -#else -#define MINIZ_X86_OR_X64_CPU 0 #endif #if defined(__sparcv9) @@ -805,7 +877,7 @@ namespace miniz { #endif #endif -#if 1 // MINIZ_X86_OR_X64_CPU +#if MINIZ_X86_OR_X64_CPU // Set MINIZ_USE_UNALIGNED_LOADS_AND_STORES to 1 on CPU's that permit efficient // integer loads and stores from unaligned addresses. //#define MINIZ_USE_UNALIGNED_LOADS_AND_STORES 1 @@ -1816,8 +1888,8 @@ typedef unsigned char mz_validate_uint16[sizeof(mz_uint16) == 2 ? 1 : -1]; typedef unsigned char mz_validate_uint32[sizeof(mz_uint32) == 4 ? 1 : -1]; typedef unsigned char mz_validate_uint64[sizeof(mz_uint64) == 8 ? 1 : -1]; -#include -#include +//#include +//#include #define MZ_ASSERT(x) assert(x) @@ -1917,11 +1989,11 @@ static void def_free_func(void *opaque, void *address) { (void)opaque, (void)address; MZ_FREE(address); } -static void *def_realloc_func(void *opaque, void *address, size_t items, - size_t size) { - (void)opaque, (void)address, (void)items, (void)size; - return MZ_REALLOC(address, items * size); -} +// static void *def_realloc_func(void *opaque, void *address, size_t items, +// size_t size) { +// (void)opaque, (void)address, (void)items, (void)size; +// return MZ_REALLOC(address, items * size); +//} const char *mz_version(void) { return MZ_VERSION; } @@ -4378,9 +4450,8 @@ mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits, // C and C99, so no big deal) #pragma warning(disable : 4244) // 'initializing': conversion from '__int64' to // 'int', possible loss of data -#pragma warning( \ - disable : 4267) // 'argument': conversion from '__int64' to 'int', - // possible loss of data +#pragma warning(disable : 4267) // 'argument': conversion from '__int64' to + // 'int', possible loss of data #pragma warning(disable : 4996) // 'strdup': The POSIX name for this item is // deprecated. Instead, use the ISO C and C++ // conformant name: _strdup. @@ -4510,6 +4581,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h, // ------------------- .ZIP archive reading #ifndef MINIZ_NO_ARCHIVE_APIS +#error "No arvhive APIs" #ifdef MINIZ_NO_STDIO #define MZ_FILE void * @@ -6878,7 +6950,11 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, #ifdef __clang__ #pragma clang diagnostic pop #endif -} + +#ifdef _MSC_VER +#pragma warning(pop) +#endif +} // namespace miniz #else // Reuse MINIZ_LITTE_ENDIAN macro @@ -6903,8 +6979,26 @@ void *mz_zip_extract_archive_file_to_heap(const char *pZip_filename, // return bint.c[0] == 1; //} +static void SetErrorMessage(const std::string &msg, const char **err) { + if (err) { +#ifdef _WIN32 + (*err) = _strdup(msg.c_str()); +#else + (*err) = strdup(msg.c_str()); +#endif + } +} + static const int kEXRVersionSize = 8; +static void cpy2(unsigned short *dst_val, const unsigned short *src_val) { + unsigned char *dst = reinterpret_cast(dst_val); + const unsigned char *src = reinterpret_cast(src_val); + + dst[0] = src[0]; + dst[1] = src[1]; +} + static void swap2(unsigned short *val) { #ifdef MINIZ_LITTLE_ENDIAN (void)val; @@ -6918,6 +7012,36 @@ static void swap2(unsigned short *val) { #endif } +static void cpy4(int *dst_val, const int *src_val) { + unsigned char *dst = reinterpret_cast(dst_val); + const unsigned char *src = reinterpret_cast(src_val); + + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; +} + +static void cpy4(unsigned int *dst_val, const unsigned int *src_val) { + unsigned char *dst = reinterpret_cast(dst_val); + const unsigned char *src = reinterpret_cast(src_val); + + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; +} + +static void cpy4(float *dst_val, const float *src_val) { + unsigned char *dst = reinterpret_cast(dst_val); + const unsigned char *src = reinterpret_cast(src_val); + + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; +} + static void swap4(unsigned int *val) { #ifdef MINIZ_LITTLE_ENDIAN (void)val; @@ -6933,6 +7057,22 @@ static void swap4(unsigned int *val) { #endif } +#if 0 +static void cpy8(tinyexr::tinyexr_uint64 *dst_val, const tinyexr::tinyexr_uint64 *src_val) { + unsigned char *dst = reinterpret_cast(dst_val); + const unsigned char *src = reinterpret_cast(src_val); + + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[2]; + dst[3] = src[3]; + dst[4] = src[4]; + dst[5] = src[5]; + dst[6] = src[6]; + dst[7] = src[7]; +} +#endif + static void swap8(tinyexr::tinyexr_uint64 *val) { #ifdef MINIZ_LITTLE_ENDIAN (void)val; @@ -7068,11 +7208,27 @@ static FP16 float_to_half_full(FP32 f) { // #define IMF_B44_COMPRESSION 6 // #define IMF_B44A_COMPRESSION 7 -static const char *ReadString(std::string *s, const char *ptr) { +#ifdef __clang__ +#pragma clang diagnostic push + +#if __has_warning("-Wzero-as-null-pointer-constant") +#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#endif + +#endif + +static const char *ReadString(std::string *s, const char *ptr, size_t len) { // Read untile NULL(\0). const char *p = ptr; const char *q = ptr; - while ((*q) != 0) q++; + while ((size_t(q - ptr) < len) && (*q) != 0) { + q++; + } + + if (size_t(q - ptr) >= len) { + (*s) = std::string(); + return NULL; + } (*s) = std::string(p, q); @@ -7109,6 +7265,24 @@ static bool ReadAttribute(std::string *name, std::string *type, memcpy(&data_len, marker, sizeof(uint32_t)); tinyexr::swap4(reinterpret_cast(&data_len)); + if (data_len == 0) { + if ((*type).compare("string") == 0) { + // Accept empty string attribute. + + marker += sizeof(uint32_t); + size -= sizeof(uint32_t); + + *marker_size = name_len + 1 + type_len + 1 + sizeof(uint32_t); + + data->resize(1); + (*data)[0] = '\0'; + + return true; + } else { + return false; + } + } + marker += sizeof(uint32_t); size -= sizeof(uint32_t); @@ -7199,7 +7373,7 @@ typedef struct { } } HeaderInfo; -static void ReadChannelInfo(std::vector &channels, +static bool ReadChannelInfo(std::vector &channels, const std::vector &data) { const char *p = reinterpret_cast(&data.at(0)); @@ -7208,7 +7382,24 @@ static void ReadChannelInfo(std::vector &channels, break; } ChannelInfo info; - p = ReadString(&info.name, p); + + tinyexr_int64 data_len = static_cast(data.size()) - + (p - reinterpret_cast(data.data())); + if (data_len < 0) { + return false; + } + + p = ReadString(&info.name, p, size_t(data_len)); + if ((p == NULL) && (info.name.empty())) { + // Buffer overrun. Issue #51. + return false; + } + + const unsigned char *data_end = + reinterpret_cast(p) + 16; + if (data_end >= (data.data() + data.size())) { + return false; + } memcpy(&info.pixel_type, p, sizeof(int)); p += 4; @@ -7225,6 +7416,8 @@ static void ReadChannelInfo(std::vector &channels, channels.push_back(info); } + + return true; } static void WriteChannelInfo(std::vector &data, @@ -7341,22 +7534,36 @@ static void CompressZip(unsigned char *dst, compressedSize = outSize; #endif + + // Use uncompressed data when compressed data is larger than uncompressed. + // (Issue 40) + if (compressedSize >= src_size) { + compressedSize = src_size; + memcpy(dst, src, src_size); + } } -static void DecompressZip(unsigned char *dst, +static bool DecompressZip(unsigned char *dst, unsigned long *uncompressed_size /* inout */, const unsigned char *src, unsigned long src_size) { + if ((*uncompressed_size) == src_size) { + // Data is not compressed(Issue 40). + memcpy(dst, src, src_size); + return true; + } std::vector tmpBuf(*uncompressed_size); #if TINYEXR_USE_MINIZ int ret = miniz::mz_uncompress(&tmpBuf.at(0), uncompressed_size, src, src_size); - assert(ret == miniz::MZ_OK); - (void)ret; + if (miniz::MZ_OK != ret) { + return false; + } #else int ret = uncompress(&tmpBuf.at(0), uncompressed_size, src, src_size); - assert(ret == Z_OK); - (void)ret; + if (Z_OK != ret) { + return false; + } #endif // @@ -7396,6 +7603,8 @@ static void DecompressZip(unsigned char *dst, break; } } + + return true; } // RLE code from OpenEXR -------------------------------------- @@ -7405,6 +7614,20 @@ static void DecompressZip(unsigned char *dst, #pragma clang diagnostic ignored "-Wsign-conversion" #endif +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4204) // nonstandard extension used : non-constant + // aggregate initializer (also supported by GNU + // C and C99, so no big deal) +#pragma warning(disable : 4244) // 'initializing': conversion from '__int64' to + // 'int', possible loss of data +#pragma warning(disable : 4267) // 'argument': conversion from '__int64' to + // 'int', possible loss of data +#pragma warning(disable : 4996) // 'strdup': The POSIX name for this item is + // deprecated. Instead, use the ISO C and C++ + // conformant name: _strdup. +#endif + const int MIN_RUN_LENGTH = 3; const int MAX_RUN_LENGTH = 127; @@ -7497,6 +7720,7 @@ static int rleUncompress(int inLength, int maxLength, const signed char in[], #ifdef __clang__ #pragma clang diagnostic pop #endif + // End of RLE code from OpenEXR ----------------------------------- static void CompressRle(unsigned char *dst, @@ -7557,11 +7781,24 @@ static void CompressRle(unsigned char *dst, assert(outSize > 0); compressedSize = static_cast(outSize); + + // Use uncompressed data when compressed data is larger than uncompressed. + // (Issue 40) + if (compressedSize >= src_size) { + compressedSize = src_size; + memcpy(dst, src, src_size); + } } static void DecompressRle(unsigned char *dst, const unsigned long uncompressed_size, const unsigned char *src, unsigned long src_size) { + if (uncompressed_size == src_size) { + // Data is not compressed(Issue 40). + memcpy(dst, src, src_size); + return; + } + std::vector tmpBuf(uncompressed_size); int ret = rleUncompress(static_cast(src_size), @@ -7620,6 +7857,12 @@ static void DecompressRle(unsigned char *dst, #pragma clang diagnostic ignored "-Wsign-conversion" #pragma clang diagnostic ignored "-Wc++11-extensions" #pragma clang diagnostic ignored "-Wconversion" +#pragma clang diagnostic ignored "-Wc++98-compat-pedantic" + +#if __has_warning("-Wcast-qual") +#pragma clang diagnostic ignored "-Wcast-qual" +#endif + #endif // @@ -8097,8 +8340,8 @@ static void hufBuildEncTable( // for all array entries. // - int hlink[HUF_ENCSIZE]; - long long *fHeap[HUF_ENCSIZE]; + std::vector hlink(HUF_ENCSIZE); + std::vector fHeap(HUF_ENCSIZE); *im = 0; @@ -8157,8 +8400,8 @@ static void hufBuildEncTable( std::make_heap(&fHeap[0], &fHeap[nf], FHeapCompare()); - long long scode[HUF_ENCSIZE]; - memset(scode, 0, sizeof(long long) * HUF_ENCSIZE); + std::vector scode(HUF_ENCSIZE); + memset(scode.data(), 0, sizeof(long long) * HUF_ENCSIZE); while (nf > 1) { // @@ -8230,8 +8473,8 @@ static void hufBuildEncTable( // code table from scode into frq. // - hufCanonicalCodeTable(scode); - memcpy(frq, scode, sizeof(long long) * HUF_ENCSIZE); + hufCanonicalCodeTable(scode.data()); + memcpy(frq, scode.data(), sizeof(long long) * HUF_ENCSIZE); } // @@ -8567,26 +8810,62 @@ static int hufEncode // return: output size (in bits) lc += 8; \ } -#define getCode(po, rlc, c, lc, in, out, oe) \ - { \ - if (po == rlc) { \ - if (lc < 8) getChar(c, lc, in); \ - \ - lc -= 8; \ - \ - unsigned char cs = (c >> lc); \ - \ - if (out + cs > oe) return false; \ - \ - unsigned short s = out[-1]; \ - \ - while (cs-- > 0) *out++ = s; \ - } else if (out < oe) { \ - *out++ = po; \ - } else { \ - return false; \ - } \ +#if 0 +#define getCode(po, rlc, c, lc, in, out, ob, oe) \ + { \ + if (po == rlc) { \ + if (lc < 8) getChar(c, lc, in); \ + \ + lc -= 8; \ + \ + unsigned char cs = (c >> lc); \ + \ + if (out + cs > oe) return false; \ + \ + /* TinyEXR issue 78 */ \ + unsigned short s = out[-1]; \ + \ + while (cs-- > 0) *out++ = s; \ + } else if (out < oe) { \ + *out++ = po; \ + } else { \ + return false; \ + } \ } +#else +static bool getCode(int po, int rlc, long long &c, int &lc, const char *&in, + const char *in_end, unsigned short *&out, + const unsigned short *ob, const unsigned short *oe) { + (void)ob; + if (po == rlc) { + if (lc < 8) { + /* TinyEXR issue 78 */ + if ((in + 1) >= in_end) { + return false; + } + + getChar(c, lc, in); + } + + lc -= 8; + + unsigned char cs = (c >> lc); + + if (out + cs > oe) return false; + + // Bounds check for safety + if ((out - 1) <= ob) return false; + unsigned short s = out[-1]; + + while (cs-- > 0) *out++ = s; + } else if (out < oe) { + *out++ = po; + } else { + return false; + } + return true; +} +#endif // // Decode (uncompress) ni bits based on encoding & decoding tables: @@ -8602,8 +8881,8 @@ static bool hufDecode(const long long *hcode, // i : encoding table { long long c = 0; int lc = 0; - unsigned short *outb = out; - unsigned short *oe = out + no; + unsigned short *outb = out; // begin + unsigned short *oe = out + no; // end const char *ie = in + (ni + 7) / 8; // input byte size // @@ -8626,7 +8905,16 @@ static bool hufDecode(const long long *hcode, // i : encoding table // lc -= pl.len; - getCode(pl.lit, rlc, c, lc, in, out, oe); + // std::cout << "lit = " << pl.lit << std::endl; + // std::cout << "rlc = " << rlc << std::endl; + // std::cout << "c = " << c << std::endl; + // std::cout << "lc = " << lc << std::endl; + // std::cout << "in = " << in << std::endl; + // std::cout << "out = " << out << std::endl; + // std::cout << "oe = " << oe << std::endl; + if (!getCode(pl.lit, rlc, c, lc, in, ie, out, outb, oe)) { + return false; + } } else { if (!pl.p) { return false; @@ -8653,7 +8941,9 @@ static bool hufDecode(const long long *hcode, // i : encoding table // lc -= l; - getCode(pl.p[j], rlc, c, lc, in, out, oe); + if (!getCode(pl.p[j], rlc, c, lc, in, ie, out, outb, oe)) { + return false; + } break; } } @@ -8680,7 +8970,9 @@ static bool hufDecode(const long long *hcode, // i : encoding table if (pl.len) { lc -= pl.len; - getCode(pl.lit, rlc, c, lc, in, out, oe); + if (!getCode(pl.lit, rlc, c, lc, in, ie, out, outb, oe)) { + return false; + } } else { return false; // invalidCode(); // wrong (long) code @@ -8695,7 +8987,7 @@ static bool hufDecode(const long long *hcode, // i : encoding table return true; } -static void countFrequencies(long long freq[HUF_ENCSIZE], +static void countFrequencies(std::vector &freq, const unsigned short data[/*n*/], int n) { for (int i = 0; i < HUF_ENCSIZE; ++i) freq[i] = 0; @@ -8726,21 +9018,21 @@ static int hufCompress(const unsigned short raw[], int nRaw, char compressed[]) { if (nRaw == 0) return 0; - long long freq[HUF_ENCSIZE]; + std::vector freq(HUF_ENCSIZE); countFrequencies(freq, raw, nRaw); int im = 0; int iM = 0; - hufBuildEncTable(freq, &im, &iM); + hufBuildEncTable(freq.data(), &im, &iM); char *tableStart = compressed + 20; char *tableEnd = tableStart; - hufPackEncTable(freq, im, iM, &tableEnd); + hufPackEncTable(freq.data(), im, iM, &tableEnd); int tableLength = tableEnd - tableStart; char *dataStart = tableEnd; - int nBits = hufEncode(freq, raw, nRaw, iM, dataStart); + int nBits = hufEncode(freq.data(), raw, nRaw, iM, dataStart); int data_length = (nBits + 7) / 8; writeUInt(compressed, im); @@ -8753,9 +9045,9 @@ static int hufCompress(const unsigned short raw[], int nRaw, } static bool hufUncompress(const char compressed[], int nCompressed, - unsigned short raw[], int nRaw) { + std::vector *raw) { if (nCompressed == 0) { - if (nRaw != 0) return false; + if (raw->size() != 0) return false; return false; } @@ -8796,7 +9088,8 @@ static bool hufUncompress(const char compressed[], int nCompressed, } hufBuildDecTable(&freq.at(0), im, iM, &hdec.at(0)); - hufDecode(&freq.at(0), &hdec.at(0), ptr, nBits, iM, nRaw, raw); + hufDecode(&freq.at(0), &hdec.at(0), ptr, nBits, iM, raw->size(), + raw->data()); } // catch (...) //{ @@ -8877,11 +9170,15 @@ static void applyLut(const unsigned short lut[USHORT_RANGE], #pragma clang diagnostic pop #endif // __clang__ -static bool CompressPiz(unsigned char *outPtr, unsigned int &outSize, +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +static bool CompressPiz(unsigned char *outPtr, unsigned int *outSize, const unsigned char *inPtr, size_t inSize, const std::vector &channelInfo, int data_width, int num_lines) { - unsigned char bitmap[BITMAP_SIZE]; + std::vector bitmap(BITMAP_SIZE); unsigned short minNonZero; unsigned short maxNonZero; @@ -8932,12 +9229,12 @@ static bool CompressPiz(unsigned char *outPtr, unsigned int &outSize, } } - bitmapFromData(&tmpBuffer.at(0), static_cast(tmpBuffer.size()), bitmap, - minNonZero, maxNonZero); + bitmapFromData(&tmpBuffer.at(0), static_cast(tmpBuffer.size()), + bitmap.data(), minNonZero, maxNonZero); - unsigned short lut[USHORT_RANGE]; - unsigned short maxValue = forwardLutFromBitmap(bitmap, lut); - applyLut(lut, &tmpBuffer.at(0), static_cast(tmpBuffer.size())); + std::vector lut(USHORT_RANGE); + unsigned short maxValue = forwardLutFromBitmap(bitmap.data(), lut.data()); + applyLut(lut.data(), &tmpBuffer.at(0), static_cast(tmpBuffer.size())); // // Store range compression info in _outBuffer @@ -8984,17 +9281,30 @@ static bool CompressPiz(unsigned char *outPtr, unsigned int &outSize, hufCompress(&tmpBuffer.at(0), static_cast(tmpBuffer.size()), buf); memcpy(lengthPtr, &length, sizeof(int)); - outSize = static_cast( + (*outSize) = static_cast( (reinterpret_cast(buf) - outPtr) + static_cast(length)); + + // Use uncompressed data when compressed data is larger than uncompressed. + // (Issue 40) + if ((*outSize) >= inSize) { + (*outSize) = static_cast(inSize); + memcpy(outPtr, inPtr, inSize); + } return true; } static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr, - size_t tmpBufSize, int num_channels, + size_t tmpBufSize, size_t inLen, int num_channels, const EXRChannelInfo *channels, int data_width, int num_lines) { - unsigned char bitmap[BITMAP_SIZE]; + if (inLen == tmpBufSize) { + // Data is not compressed(Issue 40). + memcpy(outPtr, inPtr, inLen); + return true; + } + + std::vector bitmap(BITMAP_SIZE); unsigned short minNonZero; unsigned short maxNonZero; @@ -9004,11 +9314,13 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr, return false; #endif - memset(bitmap, 0, BITMAP_SIZE); + memset(bitmap.data(), 0, BITMAP_SIZE); const unsigned char *ptr = inPtr; - minNonZero = *(reinterpret_cast(ptr)); - maxNonZero = *(reinterpret_cast(ptr + 2)); + // minNonZero = *(reinterpret_cast(ptr)); + tinyexr::cpy2(&minNonZero, reinterpret_cast(ptr)); + // maxNonZero = *(reinterpret_cast(ptr + 2)); + tinyexr::cpy2(&maxNonZero, reinterpret_cast(ptr + 2)); ptr += 4; if (maxNonZero >= BITMAP_SIZE) { @@ -9021,9 +9333,9 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr, ptr += maxNonZero - minNonZero + 1; } - unsigned short lut[USHORT_RANGE]; - memset(lut, 0, sizeof(unsigned short) * USHORT_RANGE); - unsigned short maxValue = reverseLutFromBitmap(bitmap, lut); + std::vector lut(USHORT_RANGE); + memset(lut.data(), 0, sizeof(unsigned short) * USHORT_RANGE); + unsigned short maxValue = reverseLutFromBitmap(bitmap.data(), lut.data()); // // Huffman decoding @@ -9031,12 +9343,12 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr, int length; - length = *(reinterpret_cast(ptr)); + // length = *(reinterpret_cast(ptr)); + tinyexr::cpy4(&length, reinterpret_cast(ptr)); ptr += sizeof(int); std::vector tmpBuffer(tmpBufSize); - hufUncompress(reinterpret_cast(ptr), length, &tmpBuffer.at(0), - static_cast(tmpBufSize)); + hufUncompress(reinterpret_cast(ptr), length, &tmpBuffer); // // Wavelet decoding @@ -9077,7 +9389,7 @@ static bool DecompressPiz(unsigned char *outPtr, const unsigned char *inPtr, // Expand the pixel data to their original range // - applyLut(lut, &tmpBuffer.at(0), static_cast(tmpBufSize)); + applyLut(lut.data(), &tmpBuffer.at(0), static_cast(tmpBufSize)); for (int y = 0; y < num_lines; y++) { for (size_t i = 0; i < channelData.size(); ++i) { @@ -9168,6 +9480,11 @@ static bool DecompressZfp(float *dst, int dst_width, int dst_num_lines, const ZFPCompressionParam ¶m) { size_t uncompressed_size = dst_width * dst_num_lines * num_channels; + if (uncompressed_size == src_size) { + // Data is not compressed(Issue 40). + memcpy(dst, src, src_size); + } + zfp_stream *zfp = NULL; zfp_field *field = NULL; @@ -9297,7 +9614,8 @@ bool CompressZfp(std::vector *outBuf, unsigned int *outSize, // ----------------------------------------------------------------- // -static void DecodePixelData(/* out */ unsigned char **out_images, +// TODO(syoyo): Refactor function arguments. +static bool DecodePixelData(/* out */ unsigned char **out_images, const int *requested_pixel_types, const unsigned char *data_ptr, size_t data_len, int compression_type, int line_order, int width, @@ -9309,15 +9627,19 @@ static void DecodePixelData(/* out */ unsigned char **out_images, const std::vector &channel_offset_list) { if (compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { // PIZ #if TINYEXR_USE_PIZ + if ((width == 0) || (num_lines == 0) || (pixel_data_size == 0)) { + // Invalid input #90 + return false; + } + // Allocate original data size. std::vector outBuf(static_cast( static_cast(width * num_lines) * pixel_data_size)); - size_t tmpBufLen = static_cast( - static_cast(width * num_lines) * pixel_data_size); + size_t tmpBufLen = outBuf.size(); bool ret = tinyexr::DecompressPiz( reinterpret_cast(&outBuf.at(0)), data_ptr, tmpBufLen, - static_cast(num_channels), channels, width, num_lines); + data_len, static_cast(num_channels), channels, width, num_lines); assert(ret); (void)ret; @@ -9341,7 +9663,10 @@ static void DecodePixelData(/* out */ unsigned char **out_images, for (size_t u = 0; u < static_cast(width); u++) { FP16 hf; - hf.u = line_ptr[u]; + // hf.u = line_ptr[u]; + // use `cpy` to avoid unaligned memory access when compiler's + // optimization is on. + tinyexr::cpy2(&(hf.u), line_ptr + u); tinyexr::swap2(reinterpret_cast(&hf.u)); @@ -9384,7 +9709,9 @@ static void DecodePixelData(/* out */ unsigned char **out_images, &outBuf.at(v * pixel_data_size * static_cast(width) + channel_offset_list[c] * static_cast(width))); for (size_t u = 0; u < static_cast(width); u++) { - unsigned int val = line_ptr[u]; + unsigned int val; + // val = line_ptr[u]; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(&val); @@ -9410,7 +9737,9 @@ static void DecodePixelData(/* out */ unsigned char **out_images, v * pixel_data_size * static_cast(x_stride) + channel_offset_list[c] * static_cast(x_stride))); for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; + float val; + // val = line_ptr[u]; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(reinterpret_cast(&val)); @@ -9434,6 +9763,7 @@ static void DecodePixelData(/* out */ unsigned char **out_images, } #else assert(0 && "PIZ is enabled in this build"); + return false; #endif } else if (compression_type == TINYEXR_COMPRESSIONTYPE_ZIPS || @@ -9443,11 +9773,13 @@ static void DecodePixelData(/* out */ unsigned char **out_images, static_cast(num_lines) * pixel_data_size); - unsigned long dstLen = outBuf.size(); + unsigned long dstLen = static_cast(outBuf.size()); assert(dstLen > 0); - tinyexr::DecompressZip(reinterpret_cast(&outBuf.at(0)), - &dstLen, data_ptr, - static_cast(data_len)); + if (!tinyexr::DecompressZip( + reinterpret_cast(&outBuf.at(0)), &dstLen, data_ptr, + static_cast(data_len))) { + return false; + } // For ZIP_COMPRESSION: // pixel sample data for channel 0 for scanline 0 @@ -9469,7 +9801,8 @@ static void DecodePixelData(/* out */ unsigned char **out_images, for (size_t u = 0; u < static_cast(width); u++) { tinyexr::FP16 hf; - hf.u = line_ptr[u]; + // hf.u = line_ptr[u]; + tinyexr::cpy2(&(hf.u), line_ptr + u); tinyexr::swap2(reinterpret_cast(&hf.u)); @@ -9512,7 +9845,9 @@ static void DecodePixelData(/* out */ unsigned char **out_images, &outBuf.at(v * pixel_data_size * static_cast(width) + channel_offset_list[c] * static_cast(width))); for (size_t u = 0; u < static_cast(width); u++) { - unsigned int val = line_ptr[u]; + unsigned int val; + // val = line_ptr[u]; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(&val); @@ -9538,7 +9873,9 @@ static void DecodePixelData(/* out */ unsigned char **out_images, &outBuf.at(v * pixel_data_size * static_cast(width) + channel_offset_list[c] * static_cast(width))); for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; + float val; + // val = line_ptr[u]; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(reinterpret_cast(&val)); @@ -9558,6 +9895,7 @@ static void DecodePixelData(/* out */ unsigned char **out_images, } } else { assert(0); + return false; } } } else if (compression_type == TINYEXR_COMPRESSIONTYPE_RLE) { @@ -9566,7 +9904,7 @@ static void DecodePixelData(/* out */ unsigned char **out_images, static_cast(num_lines) * pixel_data_size); - unsigned long dstLen = outBuf.size(); + unsigned long dstLen = static_cast(outBuf.size()); assert(dstLen > 0); tinyexr::DecompressRle(reinterpret_cast(&outBuf.at(0)), dstLen, data_ptr, @@ -9592,7 +9930,8 @@ static void DecodePixelData(/* out */ unsigned char **out_images, for (size_t u = 0; u < static_cast(width); u++) { tinyexr::FP16 hf; - hf.u = line_ptr[u]; + // hf.u = line_ptr[u]; + tinyexr::cpy2(&(hf.u), line_ptr + u); tinyexr::swap2(reinterpret_cast(&hf.u)); @@ -9635,7 +9974,9 @@ static void DecodePixelData(/* out */ unsigned char **out_images, &outBuf.at(v * pixel_data_size * static_cast(width) + channel_offset_list[c] * static_cast(width))); for (size_t u = 0; u < static_cast(width); u++) { - unsigned int val = line_ptr[u]; + unsigned int val; + // val = line_ptr[u]; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(&val); @@ -9661,7 +10002,9 @@ static void DecodePixelData(/* out */ unsigned char **out_images, &outBuf.at(v * pixel_data_size * static_cast(width) + channel_offset_list[c] * static_cast(width))); for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; + float val; + // val = line_ptr[u]; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(reinterpret_cast(&val)); @@ -9681,6 +10024,7 @@ static void DecodePixelData(/* out */ unsigned char **out_images, } } else { assert(0); + return false; } } } else if (compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { @@ -9689,7 +10033,7 @@ static void DecodePixelData(/* out */ unsigned char **out_images, if (!FindZFPCompressionParam(&zfp_compression_param, attributes, num_attributes)) { assert(0); - return; + return false; } // Allocate original data size. @@ -9723,7 +10067,8 @@ static void DecodePixelData(/* out */ unsigned char **out_images, &outBuf.at(v * pixel_data_size * static_cast(width) + channel_offset_list[c] * static_cast(width))); for (size_t u = 0; u < static_cast(width); u++) { - float val = line_ptr[u]; + float val; + tinyexr::cpy4(&val, line_ptr + u); tinyexr::swap4(reinterpret_cast(&val)); @@ -9743,6 +10088,7 @@ static void DecodePixelData(/* out */ unsigned char **out_images, } } else { assert(0); + return false; } } #else @@ -9750,94 +10096,130 @@ static void DecodePixelData(/* out */ unsigned char **out_images, (void)num_attributes; (void)num_channels; assert(0); + return false; #endif } else if (compression_type == TINYEXR_COMPRESSIONTYPE_NONE) { for (size_t c = 0; c < num_channels; c++) { - if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { - const unsigned short *line_ptr = - reinterpret_cast( - data_ptr + - c * static_cast(width) * sizeof(unsigned short)); + for (size_t v = 0; v < static_cast(num_lines); v++) { + if (channels[c].pixel_type == TINYEXR_PIXELTYPE_HALF) { + const unsigned short *line_ptr = + reinterpret_cast( + data_ptr + v * pixel_data_size * size_t(width) + + channel_offset_list[c] * static_cast(width)); - if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { - unsigned short *outLine = - reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; + if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { + unsigned short *outLine = + reinterpret_cast(out_images[c]); + if (line_order == 0) { + outLine += (size_t(y) + v) * size_t(x_stride); + } else { + outLine += + (size_t(height) - 1 - (size_t(y) + v)) * size_t(x_stride); + } + + for (int u = 0; u < width; u++) { + tinyexr::FP16 hf; + + // hf.u = line_ptr[u]; + tinyexr::cpy2(&(hf.u), line_ptr + u); + + tinyexr::swap2(reinterpret_cast(&hf.u)); + + outLine[u] = hf.u; + } + } else if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { + float *outLine = reinterpret_cast(out_images[c]); + if (line_order == 0) { + outLine += (size_t(y) + v) * size_t(x_stride); + } else { + outLine += + (size_t(height) - 1 - (size_t(y) + v)) * size_t(x_stride); + } + + if (reinterpret_cast(line_ptr + width) > + (data_ptr + data_len)) { + // Insufficient data size + return false; + } + + for (int u = 0; u < width; u++) { + tinyexr::FP16 hf; + + // address may not be aliged. use byte-wise copy for safety.#76 + // hf.u = line_ptr[u]; + tinyexr::cpy2(&(hf.u), line_ptr + u); + + tinyexr::swap2(reinterpret_cast(&hf.u)); + + tinyexr::FP32 f32 = half_to_float(hf); + + outLine[u] = f32.f; + } } else { - outLine += (height - 1 - y) * x_stride; + assert(0); + return false; } + } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { + const float *line_ptr = reinterpret_cast( + data_ptr + v * pixel_data_size * size_t(width) + + channel_offset_list[c] * static_cast(width)); - for (int u = 0; u < width; u++) { - tinyexr::FP16 hf; - - hf.u = line_ptr[u]; - - tinyexr::swap2(reinterpret_cast(&hf.u)); - - outLine[u] = hf.u; - } - } else if (requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { float *outLine = reinterpret_cast(out_images[c]); if (line_order == 0) { - outLine += y * x_stride; + outLine += (size_t(y) + v) * size_t(x_stride); } else { - outLine += (height - 1 - y) * x_stride; + outLine += + (size_t(height) - 1 - (size_t(y) + v)) * size_t(x_stride); + } + + if (reinterpret_cast(line_ptr + width) > + (data_ptr + data_len)) { + // Insufficient data size + return false; } for (int u = 0; u < width; u++) { - tinyexr::FP16 hf; + float val; + tinyexr::cpy4(&val, line_ptr + u); - hf.u = line_ptr[u]; + tinyexr::swap4(reinterpret_cast(&val)); - tinyexr::swap2(reinterpret_cast(&hf.u)); - - tinyexr::FP32 f32 = half_to_float(hf); - - outLine[u] = f32.f; + outLine[u] = val; } - } else { - assert(0); - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_FLOAT) { - const float *line_ptr = reinterpret_cast( - data_ptr + c * static_cast(width) * sizeof(float)); + } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { + const unsigned int *line_ptr = reinterpret_cast( + data_ptr + v * pixel_data_size * size_t(width) + + channel_offset_list[c] * static_cast(width)); - float *outLine = reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; - } else { - outLine += (height - 1 - y) * x_stride; - } + unsigned int *outLine = + reinterpret_cast(out_images[c]); + if (line_order == 0) { + outLine += (size_t(y) + v) * size_t(x_stride); + } else { + outLine += + (size_t(height) - 1 - (size_t(y) + v)) * size_t(x_stride); + } - for (int u = 0; u < width; u++) { - float val = line_ptr[u]; + for (int u = 0; u < width; u++) { + if (reinterpret_cast(line_ptr + u) >= + (data_ptr + data_len)) { + // Corrupsed data? + return false; + } - tinyexr::swap4(reinterpret_cast(&val)); + unsigned int val; + tinyexr::cpy4(&val, line_ptr + u); - outLine[u] = val; - } - } else if (channels[c].pixel_type == TINYEXR_PIXELTYPE_UINT) { - const unsigned int *line_ptr = reinterpret_cast( - data_ptr + c * static_cast(width) * sizeof(unsigned int)); + tinyexr::swap4(reinterpret_cast(&val)); - unsigned int *outLine = reinterpret_cast(out_images[c]); - if (line_order == 0) { - outLine += y * x_stride; - } else { - outLine += (height - 1 - y) * x_stride; - } - - for (int u = 0; u < width; u++) { - unsigned int val = line_ptr[u]; - - tinyexr::swap4(reinterpret_cast(&val)); - - outLine[u] = val; + outLine[u] = val; + } } } } } + + return true; } static void DecodeTiledPixelData( @@ -9873,7 +10255,7 @@ static void DecodeTiledPixelData( num_channels, channels, channel_offset_list); } -static void ComputeChannelLayout(std::vector *channel_offset_list, +static bool ComputeChannelLayout(std::vector *channel_offset_list, int *pixel_data_size, size_t *channel_offset, int num_channels, const EXRChannelInfo *channels) { @@ -9894,9 +10276,11 @@ static void ComputeChannelLayout(std::vector *channel_offset_list, (*pixel_data_size) += sizeof(unsigned int); (*channel_offset) += sizeof(unsigned int); } else { - assert(0); + // ??? + return false; } } + return true; } static unsigned char **AllocateImage(int num_channels, @@ -10004,8 +10388,11 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, // Read attributes size_t orig_size = size; - for (;;) { + for (size_t nattr = 0; nattr < TINYEXR_MAX_HEADER_ATTRIBUTES; nattr++) { if (0 == size) { + if (err) { + (*err) += "Insufficient data size for attributes.\n"; + } return TINYEXR_ERROR_INVALID_DATA; } else if (marker[0] == '\0') { size--; @@ -10018,6 +10405,9 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, size_t marker_size; if (!tinyexr::ReadAttribute(&attr_name, &attr_type, &data, &marker_size, marker, size)) { + if (err) { + (*err) += "Failed to read attribute.\n"; + } return TINYEXR_ERROR_INVALID_DATA; } marker += marker_size; @@ -10042,8 +10432,7 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, } else if (attr_name.compare("compression") == 0) { bool ok = false; - if ((data[0] >= TINYEXR_COMPRESSIONTYPE_NONE) && - (data[0] < TINYEXR_COMPRESSIONTYPE_PIZ)) { + if (data[0] < TINYEXR_COMPRESSIONTYPE_PIZ) { ok = true; } @@ -10087,11 +10476,16 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, // xSampling: int // ySampling: int - ReadChannelInfo(info->channels, data); + if (!ReadChannelInfo(info->channels, data)) { + if (err) { + (*err) += "Failed to parse channel info.\n"; + } + return TINYEXR_ERROR_INVALID_DATA; + } if (info->channels.size() < 1) { if (err) { - (*err) = "# of channels is zero."; + (*err) += "# of channels is zero.\n"; } return TINYEXR_ERROR_INVALID_DATA; } @@ -10099,63 +10493,81 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, has_channels = true; } else if (attr_name.compare("dataWindow") == 0) { - memcpy(&info->data_window[0], &data.at(0), sizeof(int)); - memcpy(&info->data_window[1], &data.at(4), sizeof(int)); - memcpy(&info->data_window[2], &data.at(8), sizeof(int)); - memcpy(&info->data_window[3], &data.at(12), sizeof(int)); - tinyexr::swap4(reinterpret_cast(&info->data_window[0])); - tinyexr::swap4(reinterpret_cast(&info->data_window[1])); - tinyexr::swap4(reinterpret_cast(&info->data_window[2])); - tinyexr::swap4(reinterpret_cast(&info->data_window[3])); - - has_data_window = true; + if (data.size() >= 16) { + memcpy(&info->data_window[0], &data.at(0), sizeof(int)); + memcpy(&info->data_window[1], &data.at(4), sizeof(int)); + memcpy(&info->data_window[2], &data.at(8), sizeof(int)); + memcpy(&info->data_window[3], &data.at(12), sizeof(int)); + tinyexr::swap4(reinterpret_cast(&info->data_window[0])); + tinyexr::swap4(reinterpret_cast(&info->data_window[1])); + tinyexr::swap4(reinterpret_cast(&info->data_window[2])); + tinyexr::swap4(reinterpret_cast(&info->data_window[3])); + has_data_window = true; + } } else if (attr_name.compare("displayWindow") == 0) { - memcpy(&info->display_window[0], &data.at(0), sizeof(int)); - memcpy(&info->display_window[1], &data.at(4), sizeof(int)); - memcpy(&info->display_window[2], &data.at(8), sizeof(int)); - memcpy(&info->display_window[3], &data.at(12), sizeof(int)); - tinyexr::swap4( - reinterpret_cast(&info->display_window[0])); - tinyexr::swap4( - reinterpret_cast(&info->display_window[1])); - tinyexr::swap4( - reinterpret_cast(&info->display_window[2])); - tinyexr::swap4( - reinterpret_cast(&info->display_window[3])); + if (data.size() >= 16) { + memcpy(&info->display_window[0], &data.at(0), sizeof(int)); + memcpy(&info->display_window[1], &data.at(4), sizeof(int)); + memcpy(&info->display_window[2], &data.at(8), sizeof(int)); + memcpy(&info->display_window[3], &data.at(12), sizeof(int)); + tinyexr::swap4( + reinterpret_cast(&info->display_window[0])); + tinyexr::swap4( + reinterpret_cast(&info->display_window[1])); + tinyexr::swap4( + reinterpret_cast(&info->display_window[2])); + tinyexr::swap4( + reinterpret_cast(&info->display_window[3])); - has_display_window = true; + has_display_window = true; + } } else if (attr_name.compare("lineOrder") == 0) { - info->line_order = static_cast(data[0]); - has_line_order = true; + if (data.size() >= 1) { + info->line_order = static_cast(data[0]); + has_line_order = true; + } } else if (attr_name.compare("pixelAspectRatio") == 0) { - memcpy(&info->pixel_aspect_ratio, &data.at(0), sizeof(float)); - tinyexr::swap4( - reinterpret_cast(&info->pixel_aspect_ratio)); - has_pixel_aspect_ratio = true; + if (data.size() >= sizeof(float)) { + memcpy(&info->pixel_aspect_ratio, &data.at(0), sizeof(float)); + tinyexr::swap4( + reinterpret_cast(&info->pixel_aspect_ratio)); + has_pixel_aspect_ratio = true; + } } else if (attr_name.compare("screenWindowCenter") == 0) { - memcpy(&info->screen_window_center[0], &data.at(0), sizeof(float)); - memcpy(&info->screen_window_center[1], &data.at(4), sizeof(float)); - tinyexr::swap4( - reinterpret_cast(&info->screen_window_center[0])); - tinyexr::swap4( - reinterpret_cast(&info->screen_window_center[1])); - has_screen_window_center = true; + if (data.size() >= 8) { + memcpy(&info->screen_window_center[0], &data.at(0), sizeof(float)); + memcpy(&info->screen_window_center[1], &data.at(4), sizeof(float)); + tinyexr::swap4( + reinterpret_cast(&info->screen_window_center[0])); + tinyexr::swap4( + reinterpret_cast(&info->screen_window_center[1])); + has_screen_window_center = true; + } } else if (attr_name.compare("screenWindowWidth") == 0) { - memcpy(&info->screen_window_width, &data.at(0), sizeof(float)); - tinyexr::swap4( - reinterpret_cast(&info->screen_window_width)); + if (data.size() >= sizeof(float)) { + memcpy(&info->screen_window_width, &data.at(0), sizeof(float)); + tinyexr::swap4( + reinterpret_cast(&info->screen_window_width)); - has_screen_window_width = true; + has_screen_window_width = true; + } } else if (attr_name.compare("chunkCount") == 0) { - memcpy(&info->chunk_count, &data.at(0), sizeof(int)); - tinyexr::swap4(reinterpret_cast(&info->chunk_count)); + if (data.size() >= sizeof(int)) { + memcpy(&info->chunk_count, &data.at(0), sizeof(int)); + tinyexr::swap4(reinterpret_cast(&info->chunk_count)); + } } else { - // Custom attribute(up to TINYEXR_MAX_ATTRIBUTES) - if (info->attributes.size() < TINYEXR_MAX_ATTRIBUTES) { + // Custom attribute(up to TINYEXR_MAX_CUSTOM_ATTRIBUTES) + if (info->attributes.size() < TINYEXR_MAX_CUSTOM_ATTRIBUTES) { EXRAttribute attrib; +#ifdef _MSC_VER + strncpy_s(attrib.name, attr_name.c_str(), 255); + strncpy_s(attrib.type, attr_type.c_str(), 255); +#else strncpy(attrib.name, attr_name.c_str(), 255); - attrib.name[255] = '\0'; strncpy(attrib.type, attr_type.c_str(), 255); +#endif + attrib.name[255] = '\0'; attrib.type[255] = '\0'; attrib.size = static_cast(data.size()); attrib.value = static_cast(malloc(data.size())); @@ -10189,7 +10601,7 @@ static int ParseEXRHeader(HeaderInfo *info, bool *empty_header, } if (!has_data_window) { - ss_err << "\"dataWindow\" attribute not found in the header." + ss_err << "\"dataWindow\" attribute not found in the header or invalid." << std::endl; } @@ -10249,7 +10661,11 @@ static void ConvertHeader(EXRHeader *exr_header, const HeaderInfo &info) { exr_header->channels = static_cast(malloc( sizeof(EXRChannelInfo) * static_cast(exr_header->num_channels))); for (size_t c = 0; c < static_cast(exr_header->num_channels); c++) { +#ifdef _MSC_VER + strncpy_s(exr_header->channels[c].name, info.channels[c].name.c_str(), 255); +#else strncpy(exr_header->channels[c].name, info.channels[c].name.c_str(), 255); +#endif // manually add '\0' for safety. exr_header->channels[c].name[255] = '\0'; @@ -10272,15 +10688,30 @@ static void ConvertHeader(EXRHeader *exr_header, const HeaderInfo &info) { exr_header->requested_pixel_types[c] = info.channels[c].pixel_type; } - assert(info.attributes.size() < TINYEXR_MAX_ATTRIBUTES); exr_header->num_custom_attributes = static_cast(info.attributes.size()); - for (size_t i = 0; i < info.attributes.size(); i++) { - memcpy(exr_header->custom_attributes[i].name, info.attributes[i].name, 256); - memcpy(exr_header->custom_attributes[i].type, info.attributes[i].type, 256); - exr_header->custom_attributes[i].size = info.attributes[i].size; - // Just copy poiner - exr_header->custom_attributes[i].value = info.attributes[i].value; + if (exr_header->num_custom_attributes > 0) { + // TODO(syoyo): Report warning when # of attributes exceeds + // `TINYEXR_MAX_CUSTOM_ATTRIBUTES` + if (exr_header->num_custom_attributes > TINYEXR_MAX_CUSTOM_ATTRIBUTES) { + exr_header->num_custom_attributes = TINYEXR_MAX_CUSTOM_ATTRIBUTES; + } + + exr_header->custom_attributes = static_cast(malloc( + sizeof(EXRAttribute) * size_t(exr_header->num_custom_attributes))); + + for (size_t i = 0; i < info.attributes.size(); i++) { + memcpy(exr_header->custom_attributes[i].name, info.attributes[i].name, + 256); + memcpy(exr_header->custom_attributes[i].type, info.attributes[i].type, + 256); + exr_header->custom_attributes[i].size = info.attributes[i].size; + // Just copy poiner + exr_header->custom_attributes[i].value = info.attributes[i].value; + } + + } else { + exr_header->custom_attributes = NULL; } exr_header->header_len = info.header_len; @@ -10288,7 +10719,8 @@ static void ConvertHeader(EXRHeader *exr_header, const HeaderInfo &info) { static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header, const std::vector &offsets, - const unsigned char *head) { + const unsigned char *head, const size_t size, + std::string *err) { int num_channels = exr_header->num_channels; int num_scanline_blocks = 1; @@ -10308,25 +10740,40 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header, std::vector channel_offset_list; int pixel_data_size = 0; size_t channel_offset = 0; - tinyexr::ComputeChannelLayout(&channel_offset_list, &pixel_data_size, - &channel_offset, num_channels, - exr_header->channels); + if (!tinyexr::ComputeChannelLayout(&channel_offset_list, &pixel_data_size, + &channel_offset, num_channels, + exr_header->channels)) { + if (err) { + (*err) += "Failed to compute channel layout.\n"; + } + return TINYEXR_ERROR_INVALID_DATA; + } + + bool invalid_data = false; // TODO(LTE): Use atomic lock for MT safety. if (exr_header->tiled) { size_t num_tiles = offsets.size(); // = # of blocks exr_image->tiles = static_cast( - malloc(sizeof(EXRTile) * static_cast(num_tiles))); + calloc(sizeof(EXRTile), static_cast(num_tiles))); for (size_t tile_idx = 0; tile_idx < num_tiles; tile_idx++) { // Allocate memory for each tile. exr_image->tiles[tile_idx].images = tinyexr::AllocateImage( num_channels, exr_header->channels, exr_header->requested_pixel_types, - data_width, data_height); + exr_header->tile_size_x, exr_header->tile_size_y); // 16 byte: tile coordinates // 4 byte : data size // ~ : data(uncompressed or compressed) + if (offsets[tile_idx] + sizeof(int) * 5 > size) { + if (err) { + (*err) += "Insufficient data size.\n"; + } + return TINYEXR_ERROR_INVALID_DATA; + } + + size_t data_size = size - size_t(offsets[tile_idx] + sizeof(int) * 5); const unsigned char *data_ptr = reinterpret_cast(head + offsets[tile_idx]); @@ -10338,14 +10785,24 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header, tinyexr::swap4(reinterpret_cast(&tile_coordinates[3])); // @todo{ LoD } - assert(tile_coordinates[2] == 0); - assert(tile_coordinates[3] == 0); + if (tile_coordinates[2] != 0) { + return TINYEXR_ERROR_UNSUPPORTED_FEATURE; + } + if (tile_coordinates[3] != 0) { + return TINYEXR_ERROR_UNSUPPORTED_FEATURE; + } int data_len; memcpy(&data_len, data_ptr + 16, sizeof(int)); // 16 = sizeof(tile_coordinates) tinyexr::swap4(reinterpret_cast(&data_len)); - assert(data_len >= 4); + + if (data_len < 4 || size_t(data_len) > data_size) { + if (err) { + (*err) += "Insufficient data length.\n"; + } + return TINYEXR_ERROR_INVALID_DATA; + } // Move to data addr: 20 = 16 + 4; data_ptr += 20; @@ -10382,42 +10839,68 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header, #endif for (int y = 0; y < static_cast(num_blocks); y++) { size_t y_idx = static_cast(y); - const unsigned char *data_ptr = - reinterpret_cast(head + offsets[y_idx]); - // 4 byte: scan line - // 4 byte: data size - // ~ : pixel data(uncompressed or compressed) - int line_no; - memcpy(&line_no, data_ptr, sizeof(int)); - int data_len; - memcpy(&data_len, data_ptr + 4, sizeof(int)); - tinyexr::swap4(reinterpret_cast(&line_no)); - tinyexr::swap4(reinterpret_cast(&data_len)); - int end_line_no = (std::min)(line_no + num_scanline_blocks, - (exr_header->data_window[3] + 1)); + if (offsets[y_idx] + sizeof(int) * 2 > size) { + invalid_data = true; + } else { + // 4 byte: scan line + // 4 byte: data size + // ~ : pixel data(uncompressed or compressed) + size_t data_size = size - size_t(offsets[y_idx] + sizeof(int) * 2); + const unsigned char *data_ptr = + reinterpret_cast(head + offsets[y_idx]); - int num_lines = end_line_no - line_no; - assert(num_lines > 0); + int line_no; + memcpy(&line_no, data_ptr, sizeof(int)); + int data_len; + memcpy(&data_len, data_ptr + 4, sizeof(int)); + tinyexr::swap4(reinterpret_cast(&line_no)); + tinyexr::swap4(reinterpret_cast(&data_len)); - // Move to data addr: 8 = 4 + 4; - data_ptr += 8; + if (size_t(data_len) > data_size) { + invalid_data = true; + } else { + int end_line_no = (std::min)(line_no + num_scanline_blocks, + (exr_header->data_window[3] + 1)); - // Adjust line_no with data_window.bmin.y - line_no -= exr_header->data_window[1]; + int num_lines = end_line_no - line_no; + // assert(num_lines > 0); - tinyexr::DecodePixelData( - exr_image->images, exr_header->requested_pixel_types, data_ptr, - static_cast(data_len), exr_header->compression_type, - exr_header->line_order, data_width, data_height, data_width, y, - line_no, num_lines, static_cast(pixel_data_size), - static_cast(exr_header->num_custom_attributes), - exr_header->custom_attributes, - static_cast(exr_header->num_channels), exr_header->channels, - channel_offset_list); + if (num_lines <= 0) { + invalid_data = true; + } else { + // Move to data addr: 8 = 4 + 4; + data_ptr += 8; + + // Adjust line_no with data_window.bmin.y + line_no -= exr_header->data_window[1]; + + if (line_no < 0) { + invalid_data = true; + } else { + if (!tinyexr::DecodePixelData( + exr_image->images, exr_header->requested_pixel_types, + data_ptr, static_cast(data_len), + exr_header->compression_type, exr_header->line_order, + data_width, data_height, data_width, y, line_no, + num_lines, static_cast(pixel_data_size), + static_cast(exr_header->num_custom_attributes), + exr_header->custom_attributes, + static_cast(exr_header->num_channels), + exr_header->channels, channel_offset_list)) { + invalid_data = true; + } + } + } + } + } } // omp parallel } + if (invalid_data) { + return TINYEXR_ERROR_INVALID_DATA; + } + // Overwrite `pixel_type` with `requested_pixel_type`. { for (int c = 0; c < exr_header->num_channels; c++) { @@ -10435,38 +10918,47 @@ static int DecodeChunk(EXRImage *exr_image, const EXRHeader *exr_header, return TINYEXR_SUCCESS; } -static void ReconstructLineOffsets(std::vector *offsets, size_t n, const unsigned char *head, const unsigned char *marker, const size_t size) -{ +static bool ReconstructLineOffsets( + std::vector *offsets, size_t n, + const unsigned char *head, const unsigned char *marker, const size_t size) { assert(head < marker); assert(offsets->size() == n); for (size_t i = 0; i < n; i++) { size_t offset = static_cast(marker - head); - assert(offset < size); // Offset should not exceed whole EXR file/data size. + // Offset should not exceed whole EXR file/data size. + if ((offset + sizeof(tinyexr::tinyexr_uint64)) >= size) { + return false; + } int y; - int data_len; + unsigned int data_len; memcpy(&y, marker, sizeof(int)); memcpy(&data_len, marker + 4, sizeof(unsigned int)); + if (data_len >= size) { + return false; + } + tinyexr::swap4(reinterpret_cast(&y)); tinyexr::swap4(reinterpret_cast(&data_len)); (*offsets)[i] = offset; - marker += data_len + 8; // 8 = 4 bytes(y) + 4 bytes(data_len) + marker += data_len + 8; // 8 = 4 bytes(y) + 4 bytes(data_len) } + + return true; } static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, const unsigned char *head, - const unsigned char *marker, const size_t size, const char **err) { + const unsigned char *marker, const size_t size, + const char **err) { if (exr_image == NULL || exr_header == NULL || head == NULL || marker == NULL || (size <= tinyexr::kEXRVersionSize)) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage("Invalid argument for DecodeEXRImage().", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } @@ -10479,11 +10971,28 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, num_scanline_blocks = 16; } - int data_width = exr_header->data_window[2] - exr_header->data_window[0] + 1; - int data_height = exr_header->data_window[3] - exr_header->data_window[1] + 1; + int data_width = exr_header->data_window[2] - exr_header->data_window[0]; + if (data_width >= std::numeric_limits::max()) { + // Issue 63 + tinyexr::SetErrorMessage("Invalid data window value", err); + return TINYEXR_ERROR_INVALID_DATA; + } + data_width++; + + int data_height = exr_header->data_window[3] - exr_header->data_window[1]; + if (data_height >= std::numeric_limits::max()) { + tinyexr::SetErrorMessage("Invalid data height value", err); + return TINYEXR_ERROR_INVALID_DATA; + } + data_height++; + + if ((data_width < 0) || (data_height < 0)) { + tinyexr::SetErrorMessage("data window or data height is negative.", err); + return TINYEXR_ERROR_INVALID_DATA; + } // Read offset tables. - size_t num_blocks; + size_t num_blocks = 0; if (exr_header->chunk_count > 0) { // Use `chunkCount` attribute. @@ -10517,8 +11026,18 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, for (size_t y = 0; y < num_blocks; y++) { tinyexr::tinyexr_uint64 offset; + // Issue #81 + if ((marker + sizeof(tinyexr_uint64)) >= (head + size)) { + tinyexr::SetErrorMessage("Insufficient data size in offset table.", err); + return TINYEXR_ERROR_INVALID_DATA; + } + memcpy(&offset, marker, sizeof(tinyexr::tinyexr_uint64)); tinyexr::swap8(&offset); + if (offset >= size) { + tinyexr::SetErrorMessage("Invalid offset value in DecodeEXRImage.", err); + return TINYEXR_ERROR_INVALID_DATA; + } marker += sizeof(tinyexr::tinyexr_uint64); // = 8 offsets[y] = offset; } @@ -10527,18 +11046,49 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, // See OpenEXR/IlmImf/ImfScanLineInputFile.cpp::readLineOffsets() for details. for (size_t y = 0; y < num_blocks; y++) { if (offsets[y] <= 0) { - // TODO(syoyo) Report as warning. - //if (err) { + // TODO(syoyo) Report as warning? + // if (err) { // stringstream ss; // ss << "Incomplete lineOffsets." << std::endl; // (*err) += ss.str(); //} - ReconstructLineOffsets(&offsets, num_blocks, head, marker, size); - break; + bool ret = + ReconstructLineOffsets(&offsets, num_blocks, head, marker, size); + if (ret) { + // OK + break; + } else { + tinyexr::SetErrorMessage( + "Cannot reconstruct lineOffset table in DecodeEXRImage.", err); + return TINYEXR_ERROR_INVALID_DATA; + } } } - return DecodeChunk(exr_image, exr_header, offsets, head); + { + std::string e; + int ret = DecodeChunk(exr_image, exr_header, offsets, head, size, &e); + + if (ret != TINYEXR_SUCCESS) { + if (!e.empty()) { + tinyexr::SetErrorMessage(e, err); + } + + // release memory(if exists) + if ((exr_header->num_channels > 0) && exr_image && exr_image->images) { + for (size_t c = 0; c < size_t(exr_header->num_channels); c++) { + if (exr_image->images[c]) { + free(exr_image->images[c]); + exr_image->images[c] = NULL; + } + } + free(exr_image->images); + exr_image->images = NULL; + } + } + + return ret; + } } } // namespace tinyexr @@ -10546,9 +11096,7 @@ static int DecodeEXRImage(EXRImage *exr_image, const EXRHeader *exr_header, int LoadEXR(float **out_rgba, int *width, int *height, const char *filename, const char **err) { if (out_rgba == NULL) { - if (err) { - (*err) = "Invalid argument.\n"; - } + tinyexr::SetErrorMessage("Invalid argument for LoadEXR()", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } @@ -10561,13 +11109,14 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename, { int ret = ParseEXRVersionFromFile(&exr_version, filename); if (ret != TINYEXR_SUCCESS) { + tinyexr::SetErrorMessage("Invalid EXR header.", err); return ret; } if (exr_version.multipart || exr_version.non_image) { - if (err) { - (*err) = "Loading multipart or DeepImage is not supported yet.\n"; - } + tinyexr::SetErrorMessage( + "Loading multipart or DeepImage is not supported in LoadEXR() API", + err); return TINYEXR_ERROR_INVALID_DATA; // @fixme. } } @@ -10575,6 +11124,7 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename, { int ret = ParseEXRHeaderFromFile(&exr_header, &exr_version, filename, err); if (ret != TINYEXR_SUCCESS) { + FreeEXRHeader(&exr_header); return ret; } } @@ -10589,6 +11139,7 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename, { int ret = LoadEXRImageFromFile(&exr_image, &exr_header, filename, err); if (ret != TINYEXR_SUCCESS) { + FreeEXRHeader(&exr_header); return ret; } } @@ -10610,46 +11161,98 @@ int LoadEXR(float **out_rgba, int *width, int *height, const char *filename, } } - if (idxR == -1) { - if (err) { - (*err) = "R channel not found\n"; + if ((idxA == 0) && (idxR == -1) && (idxG == -1) && (idxB == -1)) { + // Alpha channel only. + + if (exr_header.tiled) { + // todo.implement this + } + (*out_rgba) = reinterpret_cast( + malloc(4 * sizeof(float) * static_cast(exr_image.width) * + static_cast(exr_image.height))); + for (int i = 0; i < exr_image.width * exr_image.height; i++) { + const float val = reinterpret_cast(exr_image.images)[0][i]; + (*out_rgba)[4 * i + 0] = val; + (*out_rgba)[4 * i + 1] = val; + (*out_rgba)[4 * i + 2] = val; + (*out_rgba)[4 * i + 3] = val; + } + } else { + // Assume RGB(A) + + if (idxR == -1) { + tinyexr::SetErrorMessage("R channel not found", err); + + // @todo { free exr_image } + FreeEXRHeader(&exr_header); + return TINYEXR_ERROR_INVALID_DATA; } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - - if (idxG == -1) { - if (err) { - (*err) = "G channel not found\n"; + if (idxG == -1) { + tinyexr::SetErrorMessage("G channel not found", err); + // @todo { free exr_image } + FreeEXRHeader(&exr_header); + return TINYEXR_ERROR_INVALID_DATA; } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - if (idxB == -1) { - if (err) { - (*err) = "B channel not found\n"; + if (idxB == -1) { + tinyexr::SetErrorMessage("B channel not found", err); + // @todo { free exr_image } + FreeEXRHeader(&exr_header); + return TINYEXR_ERROR_INVALID_DATA; } - // @todo { free exr_image } - return TINYEXR_ERROR_INVALID_DATA; - } - (*out_rgba) = reinterpret_cast( - malloc(4 * sizeof(float) * static_cast(exr_image.width) * - static_cast(exr_image.height))); - for (int i = 0; i < exr_image.width * exr_image.height; i++) { - (*out_rgba)[4 * i + 0] = - reinterpret_cast(exr_image.images)[idxR][i]; - (*out_rgba)[4 * i + 1] = - reinterpret_cast(exr_image.images)[idxG][i]; - (*out_rgba)[4 * i + 2] = - reinterpret_cast(exr_image.images)[idxB][i]; - if (idxA != -1) { - (*out_rgba)[4 * i + 3] = - reinterpret_cast(exr_image.images)[idxA][i]; + (*out_rgba) = reinterpret_cast( + malloc(4 * sizeof(float) * static_cast(exr_image.width) * + static_cast(exr_image.height))); + if (exr_header.tiled) { + for (int it = 0; it < exr_image.num_tiles; it++) { + for (int j = 0; j < exr_header.tile_size_y; j++) + for (int i = 0; i < exr_header.tile_size_x; i++) { + const int ii = + exr_image.tiles[it].offset_x * exr_header.tile_size_x + i; + const int jj = + exr_image.tiles[it].offset_y * exr_header.tile_size_y + j; + const int idx = ii + jj * exr_image.width; + + // out of region check. + if (ii >= exr_image.width) { + continue; + } + if (jj >= exr_image.height) { + continue; + } + const int srcIdx = i + j * exr_header.tile_size_x; + unsigned char **src = exr_image.tiles[it].images; + (*out_rgba)[4 * idx + 0] = + reinterpret_cast(src)[idxR][srcIdx]; + (*out_rgba)[4 * idx + 1] = + reinterpret_cast(src)[idxG][srcIdx]; + (*out_rgba)[4 * idx + 2] = + reinterpret_cast(src)[idxB][srcIdx]; + if (idxA != -1) { + (*out_rgba)[4 * idx + 3] = + reinterpret_cast(src)[idxA][srcIdx]; + } else { + (*out_rgba)[4 * idx + 3] = 1.0; + } + } + } } else { - (*out_rgba)[4 * i + 3] = 1.0; + for (int i = 0; i < exr_image.width * exr_image.height; i++) { + (*out_rgba)[4 * i + 0] = + reinterpret_cast(exr_image.images)[idxR][i]; + (*out_rgba)[4 * i + 1] = + reinterpret_cast(exr_image.images)[idxG][i]; + (*out_rgba)[4 * i + 2] = + reinterpret_cast(exr_image.images)[idxB][i]; + if (idxA != -1) { + (*out_rgba)[4 * i + 3] = + reinterpret_cast(exr_image.images)[idxA][i]; + } else { + (*out_rgba)[4 * i + 3] = 1.0; + } + } } } @@ -10666,15 +11269,17 @@ int ParseEXRHeaderFromMemory(EXRHeader *exr_header, const EXRVersion *version, const unsigned char *memory, size_t size, const char **err) { if (memory == NULL || exr_header == NULL) { - if (err) { - (*err) = "Invalid argument.\n"; - } + tinyexr::SetErrorMessage( + "Invalid argument. `memory` or `exr_header` argument is null in " + "ParseEXRHeaderFromMemory()", + err); // Invalid argument return TINYEXR_ERROR_INVALID_ARGUMENT; } if (size < tinyexr::kEXRVersionSize) { + tinyexr::SetErrorMessage("Insufficient header/data size.\n", err); return TINYEXR_ERROR_INVALID_DATA; } @@ -10689,7 +11294,7 @@ int ParseEXRHeaderFromMemory(EXRHeader *exr_header, const EXRVersion *version, if (ret != TINYEXR_SUCCESS) { if (err && !err_str.empty()) { - (*err) = strdup(err_str.c_str()); // May leak + tinyexr::SetErrorMessage(err_str, err); } } @@ -10701,12 +11306,11 @@ int ParseEXRHeaderFromMemory(EXRHeader *exr_header, const EXRVersion *version, return ret; } -int LoadEXRFromMemory(float *out_rgba, const unsigned char *memory, size_t size, +int LoadEXRFromMemory(float **out_rgba, int *width, int *height, + const unsigned char *memory, size_t size, const char **err) { if (out_rgba == NULL || memory == NULL) { - if (err) { - (*err) = "Invalid argument.\n"; - } + tinyexr::SetErrorMessage("Invalid argument for LoadEXRFromMemory", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } @@ -10718,6 +11322,7 @@ int LoadEXRFromMemory(float *out_rgba, const unsigned char *memory, size_t size, int ret = ParseEXRVersionFromMemory(&exr_version, memory, size); if (ret != TINYEXR_SUCCESS) { + tinyexr::SetErrorMessage("Failed to parse EXR version", err); return ret; } @@ -10726,6 +11331,13 @@ int LoadEXRFromMemory(float *out_rgba, const unsigned char *memory, size_t size, return ret; } + // Read HALF channel as FLOAT. + for (int i = 0; i < exr_header.num_channels; i++) { + if (exr_header.pixel_types[i] == TINYEXR_PIXELTYPE_HALF) { + exr_header.requested_pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT; + } + } + InitEXRImage(&exr_image); ret = LoadEXRImageFromMemory(&exr_image, &exr_header, memory, size, err); if (ret != TINYEXR_SUCCESS) { @@ -10750,65 +11362,102 @@ int LoadEXRFromMemory(float *out_rgba, const unsigned char *memory, size_t size, } if (idxR == -1) { - if (err) { - (*err) = "R channel not found\n"; - } + tinyexr::SetErrorMessage("R channel not found", err); // @todo { free exr_image } return TINYEXR_ERROR_INVALID_DATA; } if (idxG == -1) { - if (err) { - (*err) = "G channel not found\n"; - } + tinyexr::SetErrorMessage("G channel not found", err); // @todo { free exr_image } return TINYEXR_ERROR_INVALID_DATA; } if (idxB == -1) { - if (err) { - (*err) = "B channel not found\n"; - } + tinyexr::SetErrorMessage("B channel not found", err); // @todo { free exr_image } return TINYEXR_ERROR_INVALID_DATA; } - // Assume `out_rgba` have enough memory allocated. - for (int i = 0; i < exr_image.width * exr_image.height; i++) { - out_rgba[4 * i + 0] = reinterpret_cast(exr_image.images)[idxR][i]; - out_rgba[4 * i + 1] = reinterpret_cast(exr_image.images)[idxG][i]; - out_rgba[4 * i + 2] = reinterpret_cast(exr_image.images)[idxB][i]; - if (idxA > 0) { - out_rgba[4 * i + 3] = - reinterpret_cast(exr_image.images)[idxA][i]; - } else { - out_rgba[4 * i + 3] = 1.0; + (*out_rgba) = reinterpret_cast( + malloc(4 * sizeof(float) * static_cast(exr_image.width) * + static_cast(exr_image.height))); + + if (exr_header.tiled) { + for (int it = 0; it < exr_image.num_tiles; it++) { + for (int j = 0; j < exr_header.tile_size_y; j++) + for (int i = 0; i < exr_header.tile_size_x; i++) { + const int ii = + exr_image.tiles[it].offset_x * exr_header.tile_size_x + i; + const int jj = + exr_image.tiles[it].offset_y * exr_header.tile_size_y + j; + const int idx = ii + jj * exr_image.width; + + // out of region check. + if (ii >= exr_image.width) { + continue; + } + if (jj >= exr_image.height) { + continue; + } + const int srcIdx = i + j * exr_header.tile_size_x; + unsigned char **src = exr_image.tiles[it].images; + (*out_rgba)[4 * idx + 0] = + reinterpret_cast(src)[idxR][srcIdx]; + (*out_rgba)[4 * idx + 1] = + reinterpret_cast(src)[idxG][srcIdx]; + (*out_rgba)[4 * idx + 2] = + reinterpret_cast(src)[idxB][srcIdx]; + if (idxA != -1) { + (*out_rgba)[4 * idx + 3] = + reinterpret_cast(src)[idxA][srcIdx]; + } else { + (*out_rgba)[4 * idx + 3] = 1.0; + } + } + } + } else { + for (int i = 0; i < exr_image.width * exr_image.height; i++) { + (*out_rgba)[4 * i + 0] = + reinterpret_cast(exr_image.images)[idxR][i]; + (*out_rgba)[4 * i + 1] = + reinterpret_cast(exr_image.images)[idxG][i]; + (*out_rgba)[4 * i + 2] = + reinterpret_cast(exr_image.images)[idxB][i]; + if (idxA != -1) { + (*out_rgba)[4 * i + 3] = + reinterpret_cast(exr_image.images)[idxA][i]; + } else { + (*out_rgba)[4 * i + 3] = 1.0; + } } } + (*width) = exr_image.width; + (*height) = exr_image.height; + + FreeEXRHeader(&exr_header); + FreeEXRImage(&exr_image); + return TINYEXR_SUCCESS; } int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header, const char *filename, const char **err) { if (exr_image == NULL) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage("Invalid argument for LoadEXRImageFromFile", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } -#if 0 //def _WIN32 +#ifdef _WIN32 FILE *fp = NULL; fopen_s(&fp, filename, "rb"); #else FILE *fp = fopen(filename, "rb"); #endif if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } + tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err); return TINYEXR_ERROR_CANT_OPEN_FILE; } @@ -10818,6 +11467,12 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header, filesize = static_cast(ftell(fp)); fseek(fp, 0, SEEK_SET); + if (filesize < 16) { + tinyexr::SetErrorMessage("File size too short " + std::string(filename), + err); + return TINYEXR_ERROR_INVALID_FILE; + } + std::vector buf(filesize); // @todo { use mmap } { size_t ret; @@ -10827,22 +11482,22 @@ int LoadEXRImageFromFile(EXRImage *exr_image, const EXRHeader *exr_header, (void)ret; } - return LoadEXRImageFromMemory(exr_image, exr_header, &buf.at(0), filesize, err); + return LoadEXRImageFromMemory(exr_image, exr_header, &buf.at(0), filesize, + err); } int LoadEXRImageFromMemory(EXRImage *exr_image, const EXRHeader *exr_header, - const unsigned char *memory, const size_t size, const char **err) { - if (exr_image == NULL || memory == NULL || (size < tinyexr::kEXRVersionSize)) { - if (err) { - (*err) = "Invalid argument."; - } + const unsigned char *memory, const size_t size, + const char **err) { + if (exr_image == NULL || memory == NULL || + (size < tinyexr::kEXRVersionSize)) { + tinyexr::SetErrorMessage("Invalid argument for LoadEXRImageFromMemory", + err); return TINYEXR_ERROR_INVALID_ARGUMENT; } if (exr_header->header_len == 0) { - if (err) { - (*err) = "EXRHeader is not initialized."; - } + tinyexr::SetErrorMessage("EXRHeader variable is not initialized.", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } @@ -10850,7 +11505,8 @@ int LoadEXRImageFromMemory(EXRImage *exr_image, const EXRHeader *exr_header, const unsigned char *marker = reinterpret_cast( memory + exr_header->header_len + 8); // +8 for magic number + version header. - return tinyexr::DecodeEXRImage(exr_image, exr_header, head, marker, size, err); + return tinyexr::DecodeEXRImage(exr_image, exr_header, head, marker, size, + err); } size_t SaveEXRImageToMemory(const EXRImage *exr_image, @@ -10858,26 +11514,22 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, unsigned char **memory_out, const char **err) { if (exr_image == NULL || memory_out == NULL || exr_header->compression_type < 0) { - if (err) { - (*err) = "Invalid argument."; - } - return 0; // @fixme + tinyexr::SetErrorMessage("Invalid argument for SaveEXRImageToMemory", err); + return 0; } #if !TINYEXR_USE_PIZ if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - if (err) { - (*err) = "PIZ compression is not supported in this build."; - } + tinyexr::SetErrorMessage("PIZ compression is not supported in this build", + err); return 0; } #endif #if !TINYEXR_USE_ZFP if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - if (err) { - (*err) = "ZFP compression is not supported in this build."; - } + tinyexr::SetErrorMessage("ZFP compression is not supported in this build", + err); return 0; } #endif @@ -10885,9 +11537,8 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, #if TINYEXR_USE_ZFP for (size_t i = 0; i < static_cast(exr_header->num_channels); i++) { if (exr_header->requested_pixel_types[i] != TINYEXR_PIXELTYPE_FLOAT) { - if (err) { - (*err) = "Pixel type must be FLOAT for ZFP compression."; - } + tinyexr::SetErrorMessage("Pixel type must be FLOAT for ZFP compression", + err); return 0; } } @@ -11035,8 +11686,6 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, sizeof( tinyexr::tinyexr_int64); // sizeof(header) + sizeof(offsetTable) - std::vector data; - std::vector > data_list( static_cast(num_blocks)); std::vector channel_offset_list( @@ -11097,6 +11746,11 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { for (int y = 0; y < h; y++) { + // Assume increasing Y + float *line_ptr = reinterpret_cast(&buf.at( + static_cast(pixel_data_size * y * exr_image->width) + + channel_offset_list[c] * + static_cast(exr_image->width))); for (int x = 0; x < exr_image->width; x++) { tinyexr::FP16 h16; h16.u = reinterpret_cast( @@ -11106,30 +11760,27 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, tinyexr::swap4(reinterpret_cast(&f32.f)); - // Assume increasing Y - float *line_ptr = reinterpret_cast(&buf.at( - static_cast(pixel_data_size * y * exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = f32.f; + // line_ptr[x] = f32.f; + tinyexr::cpy4(line_ptr + x, &(f32.f)); } } } else if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { for (int y = 0; y < h; y++) { + // Assume increasing Y + unsigned short *line_ptr = reinterpret_cast( + &buf.at(static_cast(pixel_data_size * y * + exr_image->width) + + channel_offset_list[c] * + static_cast(exr_image->width))); for (int x = 0; x < exr_image->width; x++) { unsigned short val = reinterpret_cast( exr_image->images)[c][(y + start_y) * exr_image->width + x]; tinyexr::swap2(&val); - // Assume increasing Y - unsigned short *line_ptr = reinterpret_cast( - &buf.at(static_cast(pixel_data_size * y * - exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = val; + // line_ptr[x] = val; + tinyexr::cpy2(line_ptr + x, &val); } } } else { @@ -11139,6 +11790,12 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, } else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_HALF) { for (int y = 0; y < h; y++) { + // Assume increasing Y + unsigned short *line_ptr = reinterpret_cast( + &buf.at(static_cast(pixel_data_size * y * + exr_image->width) + + channel_offset_list[c] * + static_cast(exr_image->width))); for (int x = 0; x < exr_image->width; x++) { tinyexr::FP32 f32; f32.f = reinterpret_cast( @@ -11149,30 +11806,26 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, tinyexr::swap2(reinterpret_cast(&h16.u)); - // Assume increasing Y - unsigned short *line_ptr = reinterpret_cast( - &buf.at(static_cast(pixel_data_size * y * - exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = h16.u; + // line_ptr[x] = h16.u; + tinyexr::cpy2(line_ptr + x, &(h16.u)); } } } else if (exr_header->requested_pixel_types[c] == TINYEXR_PIXELTYPE_FLOAT) { for (int y = 0; y < h; y++) { + // Assume increasing Y + float *line_ptr = reinterpret_cast(&buf.at( + static_cast(pixel_data_size * y * exr_image->width) + + channel_offset_list[c] * + static_cast(exr_image->width))); for (int x = 0; x < exr_image->width; x++) { float val = reinterpret_cast( exr_image->images)[c][(y + start_y) * exr_image->width + x]; tinyexr::swap4(reinterpret_cast(&val)); - // Assume increasing Y - float *line_ptr = reinterpret_cast(&buf.at( - static_cast(pixel_data_size * y * exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = val; + // line_ptr[x] = val; + tinyexr::cpy4(line_ptr + x, &val); } } } else { @@ -11180,18 +11833,18 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, } } else if (exr_header->pixel_types[c] == TINYEXR_PIXELTYPE_UINT) { for (int y = 0; y < h; y++) { + // Assume increasing Y + unsigned int *line_ptr = reinterpret_cast(&buf.at( + static_cast(pixel_data_size * y * exr_image->width) + + channel_offset_list[c] * static_cast(exr_image->width))); for (int x = 0; x < exr_image->width; x++) { unsigned int val = reinterpret_cast( exr_image->images)[c][(y + start_y) * exr_image->width + x]; tinyexr::swap4(&val); - // Assume increasing Y - unsigned int *line_ptr = reinterpret_cast(&buf.at( - static_cast(pixel_data_size * y * exr_image->width) + - channel_offset_list[c] * - static_cast(exr_image->width))); - line_ptr[x] = val; + // line_ptr[x] = val; + tinyexr::cpy4(line_ptr + x, &val); } } } @@ -11216,16 +11869,17 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, } else if ((exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIPS) || (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZIP)) { #if TINYEXR_USE_MINIZ - std::vector block( - tinyexr::miniz::mz_compressBound(buf.size())); + std::vector block(tinyexr::miniz::mz_compressBound( + static_cast(buf.size()))); #else - std::vector block(compressBound(buf.size())); + std::vector block( + compressBound(static_cast(buf.size()))); #endif tinyexr::tinyexr_uint64 outSize = block.size(); tinyexr::CompressZip(&block.at(0), outSize, reinterpret_cast(&buf.at(0)), - buf.size()); + static_cast(buf.size())); // 4 byte: scan line // 4 byte: data size @@ -11250,7 +11904,7 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, tinyexr::CompressRle(&block.at(0), outSize, reinterpret_cast(&buf.at(0)), - buf.size()); + static_cast(buf.size())); // 4 byte: scan line // 4 byte: data size @@ -11270,13 +11924,13 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, } else if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { #if TINYEXR_USE_PIZ unsigned int bufLen = - 1024 + static_cast( - 1.2 * static_cast( - buf.size())); // @fixme { compute good bound. } + 8192 + static_cast( + 2 * static_cast( + buf.size())); // @fixme { compute good bound. } std::vector block(bufLen); unsigned int outSize = static_cast(block.size()); - CompressPiz(&block.at(0), outSize, + CompressPiz(&block.at(0), &outSize, reinterpret_cast(&buf.at(0)), buf.size(), channels, exr_image->width, h); @@ -11331,13 +11985,12 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, } // omp parallel for (size_t i = 0; i < static_cast(num_blocks); i++) { - data.insert(data.end(), data_list[i].begin(), data_list[i].end()); - offsets[i] = offset; tinyexr::swap8(reinterpret_cast(&offsets[i])); offset += data_list[i].size(); } + size_t totalSize = static_cast(offset); { memory.insert( memory.end(), reinterpret_cast(&offsets.at(0)), @@ -11345,85 +11998,102 @@ size_t SaveEXRImageToMemory(const EXRImage *exr_image, sizeof(tinyexr::tinyexr_uint64) * static_cast(num_blocks)); } - { memory.insert(memory.end(), data.begin(), data.end()); } + if ( memory.size() == 0 ) { + tinyexr::SetErrorMessage("Output memory size is zero", err); + return 0; + } - assert(memory.size() > 0); - - (*memory_out) = static_cast(malloc(memory.size())); + (*memory_out) = static_cast(malloc(totalSize)); memcpy((*memory_out), &memory.at(0), memory.size()); + unsigned char *memory_ptr = *memory_out + memory.size(); - return memory.size(); // OK + for (size_t i = 0; i < static_cast(num_blocks); i++) { + memcpy(memory_ptr, &data_list[i].at(0), data_list[i].size()); + memory_ptr += data_list[i].size(); + } + + return totalSize; // OK } int SaveEXRImageToFile(const EXRImage *exr_image, const EXRHeader *exr_header, const char *filename, const char **err) { if (exr_image == NULL || filename == NULL || exr_header->compression_type < 0) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage("Invalid argument for SaveEXRImageToFile", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } #if !TINYEXR_USE_PIZ if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_PIZ) { - if (err) { - (*err) = "PIZ compression is not supported in this build."; - } - return 0; + tinyexr::SetErrorMessage("PIZ compression is not supported in this build", + err); + return TINYEXR_ERROR_UNSUPPORTED_FEATURE; } #endif #if !TINYEXR_USE_ZFP if (exr_header->compression_type == TINYEXR_COMPRESSIONTYPE_ZFP) { - if (err) { - (*err) = "ZFP compression is not supported in this build."; - } - return 0; + tinyexr::SetErrorMessage("ZFP compression is not supported in this build", + err); + return TINYEXR_ERROR_UNSUPPORTED_FEATURE; } #endif -#if 0 //def _WIN32 +#ifdef _WIN32 FILE *fp = NULL; fopen_s(&fp, filename, "wb"); #else FILE *fp = fopen(filename, "wb"); #endif if (!fp) { - if (err) { - (*err) = "Cannot write a file."; - } - return TINYEXR_ERROR_CANT_OPEN_FILE; + tinyexr::SetErrorMessage("Cannot write a file", err); + return TINYEXR_ERROR_CANT_WRITE_FILE; } unsigned char *mem = NULL; size_t mem_size = SaveEXRImageToMemory(exr_image, exr_header, &mem, err); + if (mem_size == 0) { + return TINYEXR_ERROR_SERIALZATION_FAILED; + } + size_t written_size = 0; if ((mem_size > 0) && mem) { - fwrite(mem, 1, mem_size, fp); + written_size = fwrite(mem, 1, mem_size, fp); } free(mem); fclose(fp); + if (written_size != mem_size) { + tinyexr::SetErrorMessage("Cannot write a file", err); + return TINYEXR_ERROR_CANT_WRITE_FILE; + } + return TINYEXR_SUCCESS; } int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { if (deep_image == NULL) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage("Invalid argument for LoadDeepEXR", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } - FILE *fp = fopen(filename, "rb"); - if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } +#ifdef _MSC_VER + FILE *fp = NULL; + errno_t errcode = fopen_s(&fp, filename, "rb"); + if ((0 != errcode) || (!fp)) { + tinyexr::SetErrorMessage("Cannot read a file " + std::string(filename), + err); return TINYEXR_ERROR_CANT_OPEN_FILE; } +#else + FILE *fp = fopen(filename, "rb"); + if (!fp) { + tinyexr::SetErrorMessage("Cannot read a file " + std::string(filename), + err); + return TINYEXR_ERROR_CANT_OPEN_FILE; + } +#endif size_t filesize; // Compute size @@ -11433,9 +12103,8 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { if (filesize == 0) { fclose(fp); - if (err) { - (*err) = "File size is zero."; - } + tinyexr::SetErrorMessage("File size is zero : " + std::string(filename), + err); return TINYEXR_ERROR_INVALID_FILE; } @@ -11456,9 +12125,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { const char header[] = {0x76, 0x2f, 0x31, 0x01}; if (memcmp(marker, header, 4) != 0) { - if (err) { - (*err) = "Invalid magic number."; - } + tinyexr::SetErrorMessage("Invalid magic number", err); return TINYEXR_ERROR_INVALID_MAGIC_NUMBER; } marker += 4; @@ -11469,9 +12136,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { // ver 2.0, scanline, deep bit on(0x800) // must be [2, 0, 0, 0] if (marker[0] != 2 || marker[1] != 8 || marker[2] != 0 || marker[3] != 0) { - if (err) { - (*err) = "Unsupported version or scanline."; - } + tinyexr::SetErrorMessage("Unsupported version or scanline", err); return TINYEXR_ERROR_UNSUPPORTED_FORMAT; } @@ -11493,6 +12158,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { if (0 == size) { return TINYEXR_ERROR_INVALID_DATA; } else if (marker[0] == '\0') { + marker++; size--; break; } @@ -11511,9 +12177,9 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { if (attr_name.compare("compression") == 0) { compression_type = data[0]; if (compression_type > TINYEXR_COMPRESSIONTYPE_PIZ) { - if (err) { - (*err) = "Unsupported compression type."; - } + std::stringstream ss; + ss << "Unsupported compression type : " << compression_type; + tinyexr::SetErrorMessage(ss.str(), err); return TINYEXR_ERROR_UNSUPPORTED_FORMAT; } @@ -11529,14 +12195,15 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { // xSampling: int // ySampling: int - tinyexr::ReadChannelInfo(channels, data); + if (!tinyexr::ReadChannelInfo(channels, data)) { + tinyexr::SetErrorMessage("Failed to parse channel info", err); + return TINYEXR_ERROR_INVALID_DATA; + } num_channels = static_cast(channels.size()); if (num_channels < 1) { - if (err) { - (*err) = "Invalid channels format."; - } + tinyexr::SetErrorMessage("Invalid channels format", err); return TINYEXR_ERROR_INVALID_DATA; } @@ -11608,9 +12275,7 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { #endif // OK } else { - if (err) { - (*err) = "Unsupported format."; - } + tinyexr::SetErrorMessage("Unsupported compression format", err); return TINYEXR_ERROR_UNSUPPORTED_FORMAT; } @@ -11664,10 +12329,14 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { // decode pixel offset table. { - unsigned long dstLen = pixelOffsetTable.size() * sizeof(int); - tinyexr::DecompressZip( - reinterpret_cast(&pixelOffsetTable.at(0)), &dstLen, - data_ptr + 28, static_cast(packedOffsetTableSize)); + unsigned long dstLen = + static_cast(pixelOffsetTable.size() * sizeof(int)); + if (!tinyexr::DecompressZip( + reinterpret_cast(&pixelOffsetTable.at(0)), + &dstLen, data_ptr + 28, + static_cast(packedOffsetTableSize))) { + return false; + } assert(dstLen == pixelOffsetTable.size() * sizeof(int)); for (size_t i = 0; i < static_cast(data_width); i++) { @@ -11681,11 +12350,15 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { // decode sample data. { unsigned long dstLen = static_cast(unpackedSampleDataSize); - tinyexr::DecompressZip( - reinterpret_cast(&sample_data.at(0)), &dstLen, - data_ptr + 28 + packedOffsetTableSize, - static_cast(packedSampleDataSize)); - assert(dstLen == static_cast(unpackedSampleDataSize)); + if (dstLen) { + if (!tinyexr::DecompressZip( + reinterpret_cast(&sample_data.at(0)), &dstLen, + data_ptr + 28 + packedOffsetTableSize, + static_cast(packedSampleDataSize))) { + return false; + } + assert(dstLen == static_cast(unpackedSampleDataSize)); + } } // decode sample @@ -11730,8 +12403,10 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { if (channels[c].pixel_type == 0) { // UINT for (size_t x = 0; x < static_cast(samples_per_line); x++) { - unsigned int ui = *reinterpret_cast( - &sample_data.at(data_offset + x * sizeof(int))); + unsigned int ui; + unsigned int *src_ptr = reinterpret_cast( + &sample_data.at(size_t(data_offset) + x * sizeof(int))); + tinyexr::cpy4(&ui, src_ptr); deep_image->image[c][y][x] = static_cast(ui); // @fixme } data_offset += @@ -11739,16 +12414,19 @@ int LoadDeepEXR(DeepImage *deep_image, const char *filename, const char **err) { } else if (channels[c].pixel_type == 1) { // half for (size_t x = 0; x < static_cast(samples_per_line); x++) { tinyexr::FP16 f16; - f16.u = *reinterpret_cast( - &sample_data.at(data_offset + x * sizeof(short))); + const unsigned short *src_ptr = reinterpret_cast( + &sample_data.at(size_t(data_offset) + x * sizeof(short))); + tinyexr::cpy2(&(f16.u), src_ptr); tinyexr::FP32 f32 = half_to_float(f16); deep_image->image[c][y][x] = f32.f; } data_offset += sizeof(short) * static_cast(samples_per_line); } else { // float for (size_t x = 0; x < static_cast(samples_per_line); x++) { - float f = *reinterpret_cast( - &sample_data.at(data_offset + x * sizeof(float))); + float f; + const float *src_ptr = reinterpret_cast( + &sample_data.at(size_t(data_offset) + x * sizeof(float))); + tinyexr::cpy4(&f, src_ptr); deep_image->image[c][y][x] = f; } data_offset += sizeof(float) * static_cast(samples_per_line); @@ -11785,6 +12463,15 @@ void InitEXRImage(EXRImage *exr_image) { exr_image->images = NULL; exr_image->tiles = NULL; + + exr_image->num_tiles = 0; +} + +void FreeEXRErrorMessage(const char *msg) { + if (msg) { + free(reinterpret_cast(const_cast(msg))); + } + return; } void InitEXRHeader(EXRHeader *exr_header) { @@ -11818,6 +12505,10 @@ int FreeEXRHeader(EXRHeader *exr_header) { } } + if (exr_header->custom_attributes) { + free(exr_header->custom_attributes); + } + return TINYEXR_SUCCESS; } @@ -11847,6 +12538,7 @@ int FreeEXRImage(EXRImage *exr_image) { free(exr_image->tiles[tid].images); } } + free(exr_image->tiles); } return TINYEXR_SUCCESS; @@ -11855,22 +12547,19 @@ int FreeEXRImage(EXRImage *exr_image) { int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version, const char *filename, const char **err) { if (exr_header == NULL || exr_version == NULL || filename == NULL) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage("Invalid argument for ParseEXRHeaderFromFile", + err); return TINYEXR_ERROR_INVALID_ARGUMENT; } -#if 0 //def _WIN32 +#ifdef _WIN32 FILE *fp = NULL; fopen_s(&fp, filename, "rb"); #else FILE *fp = fopen(filename, "rb"); #endif if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } + tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err); return TINYEXR_ERROR_CANT_OPEN_FILE; } @@ -11888,9 +12577,8 @@ int ParseEXRHeaderFromFile(EXRHeader *exr_header, const EXRVersion *exr_version, fclose(fp); if (ret != filesize) { - if (err) { - (*err) = "fread error."; - } + tinyexr::SetErrorMessage("fread() error on " + std::string(filename), + err); return TINYEXR_ERROR_INVALID_FILE; } } @@ -11907,10 +12595,13 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers, if (memory == NULL || exr_headers == NULL || num_headers == NULL || exr_version == NULL) { // Invalid argument + tinyexr::SetErrorMessage( + "Invalid argument for ParseEXRMultipartHeaderFromMemory", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } if (size < tinyexr::kEXRVersionSize) { + tinyexr::SetErrorMessage("Data size too short", err); return TINYEXR_ERROR_INVALID_DATA; } @@ -11929,9 +12620,7 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers, marker, marker_size); if (ret != TINYEXR_SUCCESS) { - if (err) { - (*err) = strdup(err_str.c_str()); // may leak - } + tinyexr::SetErrorMessage(err_str, err); return ret; } @@ -11942,9 +12631,8 @@ int ParseEXRMultipartHeaderFromMemory(EXRHeader ***exr_headers, // `chunkCount` must exist in the header. if (info.chunk_count == 0) { - if (err) { - (*err) = "`chunkCount' attribute is not found in the header."; - } + tinyexr::SetErrorMessage( + "`chunkCount' attribute is not found in the header.", err); return TINYEXR_ERROR_INVALID_DATA; } @@ -11979,22 +12667,19 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers, const char *filename, const char **err) { if (exr_headers == NULL || num_headers == NULL || exr_version == NULL || filename == NULL) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage( + "Invalid argument for ParseEXRMultipartHeaderFromFile()", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } -#if 0 //def _WIN32 +#ifdef _WIN32 FILE *fp = NULL; fopen_s(&fp, filename, "rb"); #else FILE *fp = fopen(filename, "rb"); #endif if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } + tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err); return TINYEXR_ERROR_CANT_OPEN_FILE; } @@ -12012,9 +12697,7 @@ int ParseEXRMultipartHeaderFromFile(EXRHeader ***exr_headers, int *num_headers, fclose(fp); if (ret != filesize) { - if (err) { - (*err) = "fread error."; - } + tinyexr::SetErrorMessage("`fread' error. file may be corrupted.", err); return TINYEXR_ERROR_INVALID_FILE; } } @@ -12085,7 +12768,7 @@ int ParseEXRVersionFromFile(EXRVersion *version, const char *filename) { return TINYEXR_ERROR_INVALID_ARGUMENT; } -#if 0 //def _WIN32 +#ifdef _WIN32 FILE *fp = NULL; fopen_s(&fp, filename, "rb"); #else @@ -12120,12 +12803,11 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images, const EXRHeader **exr_headers, unsigned int num_parts, const unsigned char *memory, - const char **err) { + const size_t size, const char **err) { if (exr_images == NULL || exr_headers == NULL || num_parts == 0 || - memory == NULL) { - if (err) { - (*err) = "Invalid argument."; - } + memory == NULL || (size <= tinyexr::kEXRVersionSize)) { + tinyexr::SetErrorMessage( + "Invalid argument for LoadEXRMultipartImageFromMemory()", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } @@ -12133,9 +12815,7 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images, size_t total_header_size = 0; for (unsigned int i = 0; i < num_parts; i++) { if (exr_headers[i]->header_len == 0) { - if (err) { - (*err) = "EXRHeader is not initialized."; - } + tinyexr::SetErrorMessage("EXRHeader variable is not initialized.", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } @@ -12169,6 +12849,12 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images, memcpy(&offset, marker, 8); tinyexr::swap8(&offset); + if (offset >= size) { + tinyexr::SetErrorMessage("Invalid offset size in EXR header chunks.", + err); + return TINYEXR_ERROR_INVALID_DATA; + } + offset_table[c] = offset + 4; // +4 to skip 'part number' marker += 8; } @@ -12190,14 +12876,19 @@ int LoadEXRMultipartImageFromMemory(EXRImage *exr_images, tinyexr::swap4(&part_no); if (part_no != i) { - assert(0); + tinyexr::SetErrorMessage("Invalid `part number' in EXR header chunks.", + err); return TINYEXR_ERROR_INVALID_DATA; } } + std::string e; int ret = tinyexr::DecodeChunk(&exr_images[i], exr_headers[i], offset_table, - memory); + memory, size, &e); if (ret != TINYEXR_SUCCESS) { + if (!e.empty()) { + tinyexr::SetErrorMessage(e, err); + } return ret; } } @@ -12210,22 +12901,19 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images, unsigned int num_parts, const char *filename, const char **err) { if (exr_images == NULL || exr_headers == NULL || num_parts == 0) { - if (err) { - (*err) = "Invalid argument."; - } + tinyexr::SetErrorMessage( + "Invalid argument for LoadEXRMultipartImageFromFile", err); return TINYEXR_ERROR_INVALID_ARGUMENT; } -#if 0 //def _WIN32 +#ifdef _WIN32 FILE *fp = NULL; fopen_s(&fp, filename, "rb"); #else FILE *fp = fopen(filename, "rb"); #endif if (!fp) { - if (err) { - (*err) = "Cannot read file."; - } + tinyexr::SetErrorMessage("Cannot read file " + std::string(filename), err); return TINYEXR_ERROR_CANT_OPEN_FILE; } @@ -12245,42 +12933,55 @@ int LoadEXRMultipartImageFromFile(EXRImage *exr_images, } return LoadEXRMultipartImageFromMemory(exr_images, exr_headers, num_parts, - &buf.at(0), err); + &buf.at(0), filesize, err); } int SaveEXR(const float *data, int width, int height, int components, - const char *outfilename) { - if (components == 3 || components == 4) { + const int save_as_fp16, const char *outfilename, const char **err) { + if ((components == 1) || components == 3 || components == 4) { // OK } else { + std::stringstream ss; + ss << "Unsupported component value : " << components << std::endl; + + tinyexr::SetErrorMessage(ss.str(), err); return TINYEXR_ERROR_INVALID_ARGUMENT; } - // Assume at least 16x16 pixels. - if (width < 16) return TINYEXR_ERROR_INVALID_ARGUMENT; - if (height < 16) return TINYEXR_ERROR_INVALID_ARGUMENT; - EXRHeader header; InitEXRHeader(&header); + if ((width < 16) && (height < 16)) { + // No compression for small image. + header.compression_type = TINYEXR_COMPRESSIONTYPE_NONE; + } else { + header.compression_type = TINYEXR_COMPRESSIONTYPE_ZIP; + } + EXRImage image; InitEXRImage(&image); image.num_channels = components; std::vector images[4]; - images[0].resize(static_cast(width * height)); - images[1].resize(static_cast(width * height)); - images[2].resize(static_cast(width * height)); - images[3].resize(static_cast(width * height)); - // Split RGB(A)RGB(A)RGB(A)... into R, G and B(and A) layers - for (size_t i = 0; i < static_cast(width * height); i++) { - images[0][i] = data[static_cast(components) * i + 0]; - images[1][i] = data[static_cast(components) * i + 1]; - images[2][i] = data[static_cast(components) * i + 2]; - if (components == 4) { - images[3][i] = data[static_cast(components) * i + 3]; + if (components == 1) { + images[0].resize(static_cast(width * height)); + memcpy(images[0].data(), data, sizeof(float) * size_t(width * height)); + } else { + images[0].resize(static_cast(width * height)); + images[1].resize(static_cast(width * height)); + images[2].resize(static_cast(width * height)); + images[3].resize(static_cast(width * height)); + + // Split RGB(A)RGB(A)RGB(A)... into R, G and B(and A) layers + for (size_t i = 0; i < static_cast(width * height); i++) { + images[0][i] = data[static_cast(components) * i + 0]; + images[1][i] = data[static_cast(components) * i + 1]; + images[2][i] = data[static_cast(components) * i + 2]; + if (components == 4) { + images[3][i] = data[static_cast(components) * i + 3]; + } } } @@ -12290,10 +12991,12 @@ int SaveEXR(const float *data, int width, int height, int components, image_ptr[1] = &(images[2].at(0)); // B image_ptr[2] = &(images[1].at(0)); // G image_ptr[3] = &(images[0].at(0)); // R - } else { + } else if (components == 3) { image_ptr[0] = &(images[2].at(0)); // B image_ptr[1] = &(images[1].at(0)); // G image_ptr[2] = &(images[0].at(0)); // R + } else if (components == 1) { + image_ptr[0] = &(images[0].at(0)); // A } image.images = reinterpret_cast(image_ptr); @@ -12305,21 +13008,41 @@ int SaveEXR(const float *data, int width, int height, int components, sizeof(EXRChannelInfo) * static_cast(header.num_channels))); // Must be (A)BGR order, since most of EXR viewers expect this channel order. if (components == 4) { +#ifdef _MSC_VER + strncpy_s(header.channels[0].name, "A", 255); + strncpy_s(header.channels[1].name, "B", 255); + strncpy_s(header.channels[2].name, "G", 255); + strncpy_s(header.channels[3].name, "R", 255); +#else strncpy(header.channels[0].name, "A", 255); - header.channels[0].name[strlen("A")] = '\0'; strncpy(header.channels[1].name, "B", 255); - header.channels[1].name[strlen("B")] = '\0'; strncpy(header.channels[2].name, "G", 255); - header.channels[2].name[strlen("G")] = '\0'; strncpy(header.channels[3].name, "R", 255); +#endif + header.channels[0].name[strlen("A")] = '\0'; + header.channels[1].name[strlen("B")] = '\0'; + header.channels[2].name[strlen("G")] = '\0'; header.channels[3].name[strlen("R")] = '\0'; - } else { + } else if (components == 3) { +#ifdef _MSC_VER + strncpy_s(header.channels[0].name, "B", 255); + strncpy_s(header.channels[1].name, "G", 255); + strncpy_s(header.channels[2].name, "R", 255); +#else strncpy(header.channels[0].name, "B", 255); - header.channels[0].name[strlen("B")] = '\0'; strncpy(header.channels[1].name, "G", 255); - header.channels[1].name[strlen("G")] = '\0'; strncpy(header.channels[2].name, "R", 255); +#endif + header.channels[0].name[strlen("B")] = '\0'; + header.channels[1].name[strlen("G")] = '\0'; header.channels[2].name[strlen("R")] = '\0'; + } else { +#ifdef _MSC_VER + strncpy_s(header.channels[0].name, "A", 255); +#else + strncpy(header.channels[0].name, "A", 255); +#endif + header.channels[0].name[strlen("A")] = '\0'; } header.pixel_types = static_cast( @@ -12329,13 +13052,18 @@ int SaveEXR(const float *data, int width, int height, int components, for (int i = 0; i < header.num_channels; i++) { header.pixel_types[i] = TINYEXR_PIXELTYPE_FLOAT; // pixel type of input image - header.requested_pixel_types[i] = - TINYEXR_PIXELTYPE_HALF; // pixel type of output image to be stored in - // .EXR + + if (save_as_fp16 > 0) { + header.requested_pixel_types[i] = + TINYEXR_PIXELTYPE_HALF; // save with half(fp16) pixel format + } else { + header.requested_pixel_types[i] = + TINYEXR_PIXELTYPE_FLOAT; // save with float(fp32) pixel format(i.e. + // no precision reduction) + } } - const char *err; - int ret = SaveEXRImageToFile(&image, &header, outfilename, &err); + int ret = SaveEXRImageToFile(&image, &header, outfilename, err); if (ret != TINYEXR_SUCCESS) { return ret; } @@ -12347,10 +13075,10 @@ int SaveEXR(const float *data, int width, int height, int components, return ret; } -#ifdef _MSC_VER -#pragma warning(pop) +#ifdef __clang__ +// zero-as-null-ppinter-constant +#pragma clang diagnostic pop #endif -#endif - -#endif // TINYEXR_H_ +#endif // TINYEXR_IMPLEMENTATION_DEIFNED +#endif // TINYEXR_IMPLEMENTATION diff --git a/3rdparty/bimg/LICENSE b/3rdparty/bimg/LICENSE index dd17ed45ef3..3df43e30a2a 100644 --- a/3rdparty/bimg/LICENSE +++ b/3rdparty/bimg/LICENSE @@ -1,4 +1,4 @@ -Copyright 2010-2017 Branimir Karadzic. All rights reserved. +Copyright 2010-2018 Branimir Karadzic. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/3rdparty/bimg/README.md b/3rdparty/bimg/README.md index 076039ebb18..f918ab634d4 100644 --- a/3rdparty/bimg/README.md +++ b/3rdparty/bimg/README.md @@ -23,7 +23,7 @@ https://github.com/bkaradzic/bimg - Copyright 2010-2017 Branimir Karadzic. All rights reserved. + Copyright 2010-2018 Branimir Karadzic. All rights reserved. https://github.com/bkaradzic/bimg diff --git a/3rdparty/bimg/include/bimg/bimg.h b/3rdparty/bimg/include/bimg/bimg.h index d4b13029b86..337bce8afd7 100644 --- a/3rdparty/bimg/include/bimg/bimg.h +++ b/3rdparty/bimg/include/bimg/bimg.h @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #ifndef BIMG_IMAGE_H_HEADER_GUARD @@ -9,7 +9,7 @@ #include // uint32_t #include // NULL -#define BIMG_API_VERSION UINT32_C(5) +#define BIMG_API_VERSION UINT32_C(7) namespace bx { @@ -65,6 +65,15 @@ namespace bimg PTC14A, //!< PVRTC1 RGBA 4BPP PTC22, //!< PVRTC2 RGBA 2BPP PTC24, //!< PVRTC2 RGBA 4BPP + ATC, //!< ATC RGB 4BPP + ATCE, //!< ATCE RGBA 8 BPP explicit alpha + ATCI, //!< ATCI RGBA 8 BPP interpolated alpha + ASTC4x4, //!< ASTC 4x4 8.0 BPP + ASTC5x5, //!< ASTC 5x5 5.12 BPP + ASTC6x6, //!< ASTC 6x6 3.56 BPP + ASTC8x5, //!< ASTC 8x5 3.20 BPP + ASTC8x6, //!< ASTC 8x6 2.67 BPP + ASTC10x5, //!< ASTC 10x5 2.56 BPP Unknown, // Compressed formats above. @@ -231,6 +240,9 @@ namespace bimg /// Returns true if texture format is valid. bool isValid(TextureFormat::Enum _format); + /// returns true if texture format encoding is float. + bool isFloat(TextureFormat::Enum _format); + /// Returns bits per pixel. uint8_t getBitsPerPixel(TextureFormat::Enum _format); @@ -288,6 +300,7 @@ namespace bimg , uint32_t _height , uint32_t _depth , uint32_t _srcPitch + , uint32_t _dstPitch , const void* _src ); @@ -301,6 +314,9 @@ namespace bimg , const void* _src ); + /// + void imageRgba32fToLinear(ImageContainer* _imageContainer); + /// void imageRgba32fToGamma( void* _dst @@ -311,6 +327,9 @@ namespace bimg , const void* _src ); + /// + void imageRgba32fToGamma(ImageContainer* _imageContainer); + /// void imageRgba32fLinearDownsample2x2( void* _dst @@ -321,12 +340,23 @@ namespace bimg , const void* _src ); + /// + void imageRgba32fDownsample2x2( + void* _dst + , uint32_t _width + , uint32_t _height + , uint32_t _depth + , uint32_t _srcPitch + , const void* _src + ); + /// void imageRgba32fDownsample2x2NormalMap( void* _dst , uint32_t _width , uint32_t _height , uint32_t _srcPitch + , uint32_t _dstPitch , const void* _src ); @@ -345,6 +375,7 @@ namespace bimg void* _dst , uint32_t _height , uint32_t _srcPitch + , uint32_t _depth , const void* _src , uint32_t _dstPitch ); @@ -354,6 +385,7 @@ namespace bimg void* _dst , uint32_t _width , uint32_t _height + , uint32_t _depth , uint32_t _bpp , uint32_t _srcPitch , const void* _src @@ -397,7 +429,8 @@ namespace bimg /// bool imageConvert( - void* _dst + bx::AllocatorI* _allocator + , void* _dst , TextureFormat::Enum _dstFormat , const void* _src , TextureFormat::Enum _srcFormat @@ -419,6 +452,7 @@ namespace bimg bx::AllocatorI* _allocator , TextureFormat::Enum _dstFormat , const ImageContainer& _input + , bool _convertMips = true ); /// @@ -458,11 +492,35 @@ namespace bimg , uint32_t _height , uint32_t _srcPitch , const void* _src - , bool _grayscale + , TextureFormat::Enum _format , bool _yflip , bx::Error* _err = NULL ); + /// + int32_t imageWriteExr( + bx::WriterI* _writer + , uint32_t _width + , uint32_t _height + , uint32_t _srcPitch + , const void* _src + , TextureFormat::Enum _format + , bool _yflip + , bx::Error* _err + ); + + /// + int32_t imageWriteHdr( + bx::WriterI* _writer + , uint32_t _width + , uint32_t _height + , uint32_t _srcPitch + , const void* _src + , TextureFormat::Enum _format + , bool _yflip + , bx::Error* _err + ); + /// int32_t imageWriteDds( bx::WriterI* _writer @@ -481,6 +539,7 @@ namespace bimg , uint32_t _height , uint32_t _depth , uint8_t _numMips + , uint32_t _numLayers , const void* _src , bx::Error* _err = NULL ); @@ -533,6 +592,14 @@ namespace bimg , bx::Error* _err ); + /// + ImageContainer* imageParseGnf( + bx::AllocatorI* _allocator + , const void* _src + , uint32_t _size + , bx::Error* _err + ); + /// void imageDecodeToR8( bx::AllocatorI* _allocator @@ -547,7 +614,8 @@ namespace bimg /// void imageDecodeToBgra8( - void* _dst + bx::AllocatorI* _allocator + , void* _dst , const void* _src , uint32_t _width , uint32_t _height @@ -557,7 +625,8 @@ namespace bimg /// void imageDecodeToRgba8( - void* _dst + bx::AllocatorI* _allocator + , void* _dst , const void* _src , uint32_t _width , uint32_t _height diff --git a/3rdparty/bimg/include/bimg/decode.h b/3rdparty/bimg/include/bimg/decode.h index a5758807cce..d092b2f7ec7 100644 --- a/3rdparty/bimg/include/bimg/decode.h +++ b/3rdparty/bimg/include/bimg/decode.h @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #ifndef BIMG_DECODE_H_HEADER_GUARD diff --git a/3rdparty/bimg/include/bimg/encode.h b/3rdparty/bimg/include/bimg/encode.h index 3c6d4c685d4..326728d2700 100644 --- a/3rdparty/bimg/include/bimg/encode.h +++ b/3rdparty/bimg/include/bimg/encode.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ @@ -24,7 +24,8 @@ namespace bimg /// void imageEncodeFromRgba8( - void* _dst + bx::AllocatorI* _allocator + , void* _dst , const void* _src , uint32_t _width , uint32_t _height @@ -86,7 +87,6 @@ namespace bimg , uint32_t _width , uint32_t _height , uint32_t _srcPitch - , float _edge , const void* _src ); @@ -126,6 +126,49 @@ namespace bimg , float _alphaRef ); + /// + ImageContainer* imageCubemapFromLatLongRgba32F( + bx::AllocatorI* _allocator + , const ImageContainer& _input + , bool _useBilinearInterpolation + , bx::Error* _err + ); + + /// + ImageContainer* imageCubemapFromStripRgba32F( + bx::AllocatorI* _allocator + , const ImageContainer& _input + , bx::Error* _err + ); + + /// + ImageContainer* imageGenerateMips( + bx::AllocatorI* _allocator + , const ImageContainer& _image + ); + + struct LightingModel + { + enum Enum + { + Phong, + PhongBrdf, + Blinn, + BlinnBrdf, + Ggx, + + Count + }; + }; + + /// + ImageContainer* imageCubemapRadianceFilter( + bx::AllocatorI* _allocator + , const ImageContainer& _image + , LightingModel::Enum _lightingModel + , bx::Error* _err + ); + } // namespace bimg #endif // BIMG_ENCODE_H_HEADER_GUARD diff --git a/3rdparty/bimg/makefile b/3rdparty/bimg/makefile index 02593d533d5..cd11a89f7b6 100644 --- a/3rdparty/bimg/makefile +++ b/3rdparty/bimg/makefile @@ -1,5 +1,5 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. # License: https://github.com/bkaradzic/bimg#license-bsd-2-clause # @@ -39,27 +39,22 @@ clean: ## Clean all intermediate files. @mkdir .build projgen: ## Generate project files for all configurations. - $(GENIE) --with-tools vs2012 - $(GENIE) --with-tools vs2013 - $(GENIE) --with-tools vs2015 $(GENIE) --with-tools vs2017 $(GENIE) --with-tools --gcc=mingw-gcc gmake $(GENIE) --with-tools --gcc=linux-gcc gmake $(GENIE) --with-tools --gcc=osx gmake - $(GENIE) --with-tools --xcode=osx xcode4 - $(GENIE) --with-tools --xcode=ios xcode4 + $(GENIE) --with-tools --xcode=osx xcode8 + $(GENIE) --with-tools --xcode=ios xcode8 $(GENIE) --gcc=freebsd gmake - $(GENIE) --gcc=android-arm gmake - $(GENIE) --gcc=android-mips gmake - $(GENIE) --gcc=android-x86 gmake - $(GENIE) --gcc=asmjs gmake - $(GENIE) --gcc=ios-arm gmake - $(GENIE) --gcc=ios-arm64 gmake - $(GENIE) --gcc=ios-simulator gmake - $(GENIE) --gcc=nacl gmake - $(GENIE) --gcc=nacl-arm gmake - $(GENIE) --gcc=pnacl gmake - $(GENIE) --gcc=rpi gmake + $(GENIE) --gcc=android-arm gmake + $(GENIE) --gcc=android-mips gmake + $(GENIE) --gcc=android-x86 gmake + $(GENIE) --gcc=asmjs gmake + $(GENIE) --gcc=ios-arm gmake + $(GENIE) --gcc=ios-arm64 gmake + $(GENIE) --gcc=ios-simulator gmake + $(GENIE) --gcc=ios-simulator64 gmake + $(GENIE) --gcc=rpi gmake .build/projects/gmake-android-arm: $(GENIE) --gcc=android-arm gmake @@ -95,15 +90,11 @@ asmjs: asmjs-debug asmjs-release ## Build - Emscripten Debug and Release .build/projects/gmake-linux: $(GENIE) --with-tools --gcc=linux-gcc gmake -linux-debug32: .build/projects/gmake-linux ## Build - Linux x86 Debug - $(MAKE) -R -C .build/projects/gmake-linux config=debug32 -linux-release32: .build/projects/gmake-linux ## Build - Linux x86 Release - $(MAKE) -R -C .build/projects/gmake-linux config=release32 linux-debug64: .build/projects/gmake-linux ## Build - Linux x64 Debug $(MAKE) -R -C .build/projects/gmake-linux config=debug64 linux-release64: .build/projects/gmake-linux ## Build - Linux x64 Release $(MAKE) -R -C .build/projects/gmake-linux config=release64 -linux: linux-debug32 linux-release32 linux-debug64 linux-release64 ## Build - Linux x86/x64 Debug and Release +linux: linux-debug64 linux-release64 ## Build - Linux x64 Debug and Release .build/projects/gmake-freebsd: $(GENIE) --with-tools --gcc=freebsd gmake @@ -141,42 +132,6 @@ mingw-clang-release64: .build/projects/gmake-mingw-clang ## Build - MinGW Clang $(MAKE) -R -C .build/projects/gmake-mingw-clang config=release64 mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64 ## Build - MinGW Clang x86/x64 Debug and Release -.build/projects/vs2012: - $(GENIE) --with-tools vs2012 -vs2012-debug32: .build/projects/vs2012 ## Build - VS2012 x86 Debug - devenv .build/projects/vs2012/bimg.sln /Build "Debug|Win32" -vs2012-release32: .build/projects/vs2012 ## Build - VS2012 x86 Release - devenv .build/projects/vs2012/bimg.sln /Build "Release|Win32" -vs2012-debug64: .build/projects/vs2012 ## Build - VS2012 x64 Debug - devenv .build/projects/vs2012/bimg.sln /Build "Debug|x64" -vs2012-release64: .build/projects/vs2012 ## Build - VS2012 x64 Release - devenv .build/projects/vs2012/bimg.sln /Build "Release|x64" -vs2012: vs2012-debug32 vs2012-release32 vs2012-debug64 vs2012-release64 ## Build - VS2012 x86/x64 Debug and Release - -.build/projects/vs2013: - $(GENIE) --with-tools vs2013 -vs2013-debug32: .build/projects/vs2013 ## Build - VS2013 x86 Debug - devenv .build/projects/vs2013/bimg.sln /Build "Debug|Win32" -vs2013-release32: .build/projects/vs2013 ## Build - VS2013 x86 Release - devenv .build/projects/vs2013/bimg.sln /Build "Release|Win32" -vs2013-debug64: .build/projects/vs2013 ## Build - VS2013 x64 Debug - devenv .build/projects/vs2013/bimg.sln /Build "Debug|x64" -vs2013-release64: .build/projects/vs2013 ## Build - VS2013 x64 Release - devenv .build/projects/vs2013/bimg.sln /Build "Release|x64" -vs2013: vs2013-debug32 vs2013-release32 vs2013-debug64 vs2013-release64 ## Build - VS2013 x86/x64 Debug and Release - -.build/projects/vs2015: - $(GENIE) --with-tools vs2015 -vs2015-debug32: .build/projects/vs2015 ## Build - VS2015 x86 Debug - devenv .build/projects/vs2015/bimg.sln /Build "Debug|Win32" -vs2015-release32: .build/projects/vs2015 ## Build - VS2015 x86 Release - devenv .build/projects/vs2015/bimg.sln /Build "Release|Win32" -vs2015-debug64: .build/projects/vs2015 ## Build - VS2015 x64 Debug - devenv .build/projects/vs2015/bimg.sln /Build "Debug|x64" -vs2015-release64: .build/projects/vs2015 ## Build - VS2015 x64 Release - devenv .build/projects/vs2015/bimg.sln /Build "Release|x64" -vs2015: vs2015-debug32 vs2015-release32 vs2015-debug64 vs2015-release64 ## Build - VS2015 x86/x64 Debug and Release - .build/projects/vs2017: $(GENIE) --with-tools vs2017 vs2017-debug32: .build/projects/vs2017 ## Build - vs2017 x86 Debug @@ -189,45 +144,13 @@ vs2017-release64: .build/projects/vs2017 ## Build - vs2017 x64 Release devenv .build/projects/vs2017/bimg.sln /Build "Release|x64" vs2017: vs2017-debug32 vs2017-release32 vs2017-debug64 vs2017-release64 ## Build - vs2017 x86/x64 Debug and Release -.build/projects/gmake-nacl: - $(GENIE) --gcc=nacl gmake -nacl-debug32: .build/projects/gmake-nacl ## Build - Native Client x86 Debug - $(MAKE) -R -C .build/projects/gmake-nacl config=debug32 -nacl-release32: .build/projects/gmake-nacl ## Build - Native Client x86 Release - $(MAKE) -R -C .build/projects/gmake-nacl config=release32 -nacl-debug64: .build/projects/gmake-nacl ## Build - Native Client x64 Debug - $(MAKE) -R -C .build/projects/gmake-nacl config=debug64 -nacl-release64: .build/projects/gmake-nacl ## Build - Native Client x64 Release - $(MAKE) -R -C .build/projects/gmake-nacl config=release64 -nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64 ## Build - Native Client x86/x64 Debug and Release - -.build/projects/gmake-nacl-arm: - $(GENIE) --gcc=nacl-arm gmake -nacl-arm-debug: .build/projects/gmake-nacl-arm ## Build - Native Client ARM Debug - $(MAKE) -R -C .build/projects/gmake-nacl-arm config=debug -nacl-arm-release: .build/projects/gmake-nacl-arm ## Build - Native Client ARM Release - $(MAKE) -R -C .build/projects/gmake-nacl-arm config=release -nacl-arm: nacl-arm-debug32 nacl-arm-release32 ## Build - Native Client ARM Debug and Release - -.build/projects/gmake-pnacl: - $(GENIE) --gcc=pnacl gmake -pnacl-debug: .build/projects/gmake-pnacl ## Build - Portable Native Client Debug - $(MAKE) -R -C .build/projects/gmake-pnacl config=debug -pnacl-release: .build/projects/gmake-pnacl ## Build - Portable Native Client Release - $(MAKE) -R -C .build/projects/gmake-pnacl config=release -pnacl: pnacl-debug pnacl-release ## Build - Portable Native Client Debug and Release - .build/projects/gmake-osx: $(GENIE) --with-tools --gcc=osx gmake -osx-debug32: .build/projects/gmake-osx ## Build - OSX x86 Debug - $(MAKE) -C .build/projects/gmake-osx config=debug32 -osx-release32: .build/projects/gmake-osx ## Build - OSX x86 Release - $(MAKE) -C .build/projects/gmake-osx config=release32 osx-debug64: .build/projects/gmake-osx ## Build - OSX x64 Debug $(MAKE) -C .build/projects/gmake-osx config=debug64 osx-release64: .build/projects/gmake-osx ## Build - OSX x64 Release $(MAKE) -C .build/projects/gmake-osx config=release64 -osx: osx-debug32 osx-release32 osx-debug64 osx-release64 ## Build - OSX x86/x64 Debug and Release +osx: osx-debug64 osx-release64 ## Build - OSX x64 Debug and Release .build/projects/gmake-ios-arm: $(GENIE) --gcc=ios-arm gmake @@ -253,6 +176,14 @@ ios-simulator-release: .build/projects/gmake-ios-simulator ## Build - iOS Simula $(MAKE) -R -C .build/projects/gmake-ios-simulator config=release ios-simulator: ios-simulator-debug ios-simulator-release ## Build - iOS Simulator Debug and Release +.build/projects/gmake-ios-simulator64: + $(GENIE) --gcc=ios-simulator64 gmake +ios-simulator64-debug: .build/projects/gmake-ios-simulator64 ## Build - iOS Simulator 64 Debug + $(MAKE) -R -C .build/projects/gmake-ios-simulator64 config=debug +ios-simulator64-release: .build/projects/gmake-ios-simulator64 ## Build - iOS Simulator 64 Release + $(MAKE) -R -C .build/projects/gmake-ios-simulator64 config=release +ios-simulator64: ios-simulator64-debug ios-simulator64-release ## Build - iOS Simulator 64 Debug and Release + .build/projects/gmake-rpi: $(GENIE) --gcc=rpi gmake rpi-debug: .build/projects/gmake-rpi ## Build - RasberryPi Debug @@ -338,7 +269,7 @@ texturev: .build/projects/$(BUILD_PROJECT_DIR) ## Build texturev tool. $(SILENT) $(MAKE) -C .build/projects/$(BUILD_PROJECT_DIR) texturev config=$(BUILD_TOOLS_CONFIG) $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/texturev$(BUILD_TOOLS_SUFFIX)$(EXE) tools/bin/$(OS)/texturev$(EXE) -tools: geometryc shaderc texturec texturev ## Build tools. +tools: texturec ## Build tools. clean-tools: ## Clean tools projects. -$(SILENT) rm -r .build/projects/$(BUILD_PROJECT_DIR) diff --git a/3rdparty/bimg/scripts/bimg.lua b/3rdparty/bimg/scripts/bimg.lua index b1f56d1d225..a70460ef092 100644 --- a/3rdparty/bimg/scripts/bimg.lua +++ b/3rdparty/bimg/scripts/bimg.lua @@ -1,8 +1,18 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- +function filesexist(_srcPath, _dstPath, _files) + for _, file in ipairs(_files) do + file = path.getrelative(_srcPath, file) + local filePath = path.join(_dstPath, file) + if not os.isfile(filePath) then return false end + end + + return true +end + project "bimg" kind "StaticLib" @@ -14,6 +24,7 @@ project "bimg" files { path.join(BIMG_DIR, "include/**"), path.join(BIMG_DIR, "src/image.*"), + path.join(BIMG_DIR, "src/image_gnf.cpp"), } configuration { "linux-*" } diff --git a/3rdparty/bimg/scripts/bimg_decode.lua b/3rdparty/bimg/scripts/bimg_decode.lua index 743d0ec59e1..ca045ed1b92 100644 --- a/3rdparty/bimg/scripts/bimg_decode.lua +++ b/3rdparty/bimg/scripts/bimg_decode.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- diff --git a/3rdparty/bimg/scripts/bimg_encode.lua b/3rdparty/bimg/scripts/bimg_encode.lua index 44021dc44a7..06649108b82 100644 --- a/3rdparty/bimg/scripts/bimg_encode.lua +++ b/3rdparty/bimg/scripts/bimg_encode.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- @@ -17,6 +17,7 @@ project "bimg_encode" files { path.join(BIMG_DIR, "include/**"), path.join(BIMG_DIR, "src/image_encode.*"), + path.join(BIMG_DIR, "src/image_cubemap_filter.*"), path.join(BIMG_DIR, "3rdparty/libsquish/**.cpp"), path.join(BIMG_DIR, "3rdparty/libsquish/**.h"), path.join(BIMG_DIR, "3rdparty/edtaa3/**.cpp"), @@ -29,6 +30,8 @@ project "bimg_encode" path.join(BIMG_DIR, "3rdparty/nvtt/**.h"), path.join(BIMG_DIR, "3rdparty/pvrtc/**.cpp"), path.join(BIMG_DIR, "3rdparty/pvrtc/**.h"), + path.join(BIMG_DIR, "3rdparty/astc/**.cpp"), + path.join(BIMG_DIR, "3rdparty/astc/**.h"), path.join(BIMG_DIR, "3rdparty/tinyexr/**.h"), path.join(BIMG_DIR, "3rdparty/iqa/include/**.h"), path.join(BIMG_DIR, "3rdparty/iqa/source/**.c"), diff --git a/3rdparty/bimg/scripts/genie.lua b/3rdparty/bimg/scripts/genie.lua index b22c4dd26ce..93acdfb712f 100644 --- a/3rdparty/bimg/scripts/genie.lua +++ b/3rdparty/bimg/scripts/genie.lua @@ -1,6 +1,6 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. --- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. +-- License: https://github.com/bkaradzic/bimg#license-bsd-2-clause -- newoption { diff --git a/3rdparty/bimg/scripts/texturec.lua b/3rdparty/bimg/scripts/texturec.lua index 02f6bb65d41..9bb3ef63649 100644 --- a/3rdparty/bimg/scripts/texturec.lua +++ b/3rdparty/bimg/scripts/texturec.lua @@ -1,6 +1,6 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. --- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. +-- License: https://github.com/bkaradzic/bimg#license-bsd-2-clause -- project "texturec" @@ -9,27 +9,9 @@ project "texturec" includedirs { path.join(BX_DIR, "include"), path.join(BIMG_DIR, "include"), - path.join(BIMG_DIR, "3rdparty"), - path.join(BIMG_DIR, "3rdparty/nvtt"), - path.join(BIMG_DIR, "3rdparty/iqa/include"), } files { - path.join(BIMG_DIR, "3rdparty/libsquish/**.cpp"), - path.join(BIMG_DIR, "3rdparty/libsquish/**.h"), - path.join(BIMG_DIR, "3rdparty/edtaa3/**.cpp"), - path.join(BIMG_DIR, "3rdparty/edtaa3/**.h"), - path.join(BIMG_DIR, "3rdparty/etc1/**.cpp"), - path.join(BIMG_DIR, "3rdparty/etc1/**.h"), - path.join(BIMG_DIR, "3rdparty/etc2/**.cpp"), - path.join(BIMG_DIR, "3rdparty/etc2/**.hpp"), - path.join(BIMG_DIR, "3rdparty/nvtt/**.cpp"), - path.join(BIMG_DIR, "3rdparty/nvtt/**.h"), - path.join(BIMG_DIR, "3rdparty/pvrtc/**.cpp"), - path.join(BIMG_DIR, "3rdparty/pvrtc/**.h"), - path.join(BIMG_DIR, "3rdparty/tinyexr/**.h"), - path.join(BIMG_DIR, "3rdparty/iqa/include/**.h"), - path.join(BIMG_DIR, "3rdparty/iqa/source/**.c"), path.join(BIMG_DIR, "tools/texturec/**.cpp"), path.join(BIMG_DIR, "tools/texturec/**.h"), } diff --git a/3rdparty/bimg/src/bimg_p.h b/3rdparty/bimg/src/bimg_p.h index 45baeaad8be..c74531d2b5e 100644 --- a/3rdparty/bimg/src/bimg_p.h +++ b/3rdparty/bimg/src/bimg_p.h @@ -1,8 +1,11 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ +#ifndef BIMG_P_H_HEADER_GUARD +#define BIMG_P_H_HEADER_GUARD + #include #include #include @@ -12,9 +15,14 @@ #include #define BIMG_CHUNK_MAGIC_TEX BX_MAKEFOURCC('T', 'E', 'X', 0x0) +#define BIMG_CHUNK_MAGIC_GNF BX_MAKEFOURCC('G', 'N', 'F', ' ') BX_ERROR_RESULT(BIMG_ERROR, BX_MAKEFOURCC('b', 'i', 'm', 'g') ); +#ifndef BIMG_CONFIG_ASTC_DECODE +# define BIMG_CONFIG_ASTC_DECODE 0 +#endif // BIMG_CONFIG_ASTC_DECODE + namespace bimg { struct Memory @@ -39,8 +47,8 @@ namespace bimg { if (_hasMips) { - const uint32_t max = bx::uint32_max(bx::uint32_max(_width, _height), _depth); - const uint32_t num = 1 + uint32_t(bx::flog2(float(max) ) ); + const uint32_t max = bx::max(_width, _height, _depth); + const uint32_t num = 1 + uint32_t(bx::log2(float(max) ) ); return uint8_t(num); } @@ -71,4 +79,13 @@ namespace bimg , uint32_t _srcPitch ); + /// + bool imageParseGnf( + ImageContainer& _imageContainer + , bx::ReaderSeekerI* _reader + , bx::Error* _err + ); + } // namespace bimg + +#endif // BIMG_P_H_HEADER_GUARD diff --git a/3rdparty/bimg/src/image.cpp b/3rdparty/bimg/src/image.cpp index 9b34985cb16..6bf0d5245da 100644 --- a/3rdparty/bimg/src/image.cpp +++ b/3rdparty/bimg/src/image.cpp @@ -1,102 +1,115 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #include "bimg_p.h" #include +#if BIMG_CONFIG_ASTC_DECODE +# include "../3rdparty/astc/astc_lib.h" +#endif // BIMG_CONFIG_ASTC_DECODE + namespace bimg { static const ImageBlockInfo s_imageBlockInfo[] = { - // +-------------------------------------------- bits per pixel - // | +----------------------------------------- block width - // | | +-------------------------------------- block height - // | | | +---------------------------------- block size - // | | | | +------------------------------- min blocks x - // | | | | | +---------------------------- min blocks y - // | | | | | | +------------------------ depth bits - // | | | | | | | +--------------------- stencil bits - // | | | | | | | | +---+---+---+----- r, g, b, a bits - // | | | | | | | | r g b a +-- encoding type - // | | | | | | | | | | | | | - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC1 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC2 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC3 - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC4 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC5 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC6H - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC7 - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC1 - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2 - { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2A - { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2A1 - { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC12 - { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC14 - { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC12A - { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC14A - { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC22 - { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC24 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Count) }, // Unknown - { 1, 8, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R1 - { 8, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 8, uint8_t(bx::EncodingType::Unorm) }, // A8 - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R8 - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R8I - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R8U - { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // R8S - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R16 - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R16I - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R16U - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // R16F - { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // R16S - { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R32I - { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R32U - { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // R32F - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // RG8 - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG8I - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG8U - { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // RG8S - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // RG16 - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG16I - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG16U - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Float) }, // RG16F - { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // RG16S - { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG32I - { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG32U - { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Float) }, // RG32F - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Unorm) }, // RGB8 - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Int ) }, // RGB8I - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Uint ) }, // RGB8U - { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Snorm) }, // RGB8S - { 32, 1, 1, 4, 1, 1, 0, 0, 9, 9, 9, 5, uint8_t(bx::EncodingType::Float) }, // RGB9E5F - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Unorm) }, // BGRA8 - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Unorm) }, // RGBA8 - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Int ) }, // RGBA8I - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Uint ) }, // RGBA8U - { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Snorm) }, // RGBA8S - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Unorm) }, // RGBA16 - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Int ) }, // RGBA16I - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Uint ) }, // RGBA16U - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Float) }, // RGBA16F - { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Snorm) }, // RGBA16S - { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Int ) }, // RGBA32I - { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Uint ) }, // RGBA32U - { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Float) }, // RGBA32F - { 16, 1, 1, 2, 1, 1, 0, 0, 5, 6, 5, 0, uint8_t(bx::EncodingType::Unorm) }, // R5G6B5 - { 16, 1, 1, 2, 1, 1, 0, 0, 4, 4, 4, 4, uint8_t(bx::EncodingType::Unorm) }, // RGBA4 - { 16, 1, 1, 2, 1, 1, 0, 0, 5, 5, 5, 1, uint8_t(bx::EncodingType::Unorm) }, // RGB5A1 - { 32, 1, 1, 4, 1, 1, 0, 0, 10, 10, 10, 2, uint8_t(bx::EncodingType::Unorm) }, // RGB10A2 - { 32, 1, 1, 4, 1, 1, 0, 0, 11, 11, 10, 0, uint8_t(bx::EncodingType::Unorm) }, // RG11B10F - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Count) }, // UnknownDepth - { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D16 - { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D24 - { 32, 1, 1, 4, 1, 1, 24, 8, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D24S8 - { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D32 - { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D16F - { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D24F - { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D32F - { 8, 1, 1, 1, 1, 1, 0, 8, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D0S8 + // +--------------------------------------------- bits per pixel + // | +----------------------------------------- block width + // | | +-------------------------------------- block height + // | | | +---------------------------------- block size + // | | | | +------------------------------- min blocks x + // | | | | | +---------------------------- min blocks y + // | | | | | | +------------------------ depth bits + // | | | | | | | +--------------------- stencil bits + // | | | | | | | | +---+---+---+----- r, g, b, a bits + // | | | | | | | | r g b a +-- encoding type + // | | | | | | | | | | | | | + { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC1 + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC2 + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC3 + { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC4 + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC5 + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // BC6H + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // BC7 + { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC1 + { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2 + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2A + { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ETC2A1 + { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC12 + { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC14 + { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC12A + { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC14A + { 2, 8, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC22 + { 4, 4, 4, 8, 2, 2, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // PTC24 + { 4, 4, 4, 8, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ATC + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ATCE + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ATCI + { 8, 4, 4, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ASTC4x4 + { 6, 5, 5, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ASTC5x5 + { 4, 6, 6, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ASTC6x6 + { 4, 8, 5, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ASTC8x5 + { 3, 8, 6, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ASTC8x6 + { 3, 10, 5, 16, 1, 1, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // ASTC10x5 + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Count) }, // Unknown + { 1, 8, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R1 + { 8, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 8, uint8_t(bx::EncodingType::Unorm) }, // A8 + { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R8 + { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R8I + { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R8U + { 8, 1, 1, 1, 1, 1, 0, 0, 8, 0, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // R8S + { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // R16 + { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R16I + { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R16U + { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // R16F + { 16, 1, 1, 2, 1, 1, 0, 0, 16, 0, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // R16S + { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Int ) }, // R32I + { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // R32U + { 32, 1, 1, 4, 1, 1, 0, 0, 32, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // R32F + { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // RG8 + { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG8I + { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG8U + { 16, 1, 1, 2, 1, 1, 0, 0, 8, 8, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // RG8S + { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // RG16 + { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG16I + { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG16U + { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Float) }, // RG16F + { 32, 1, 1, 4, 1, 1, 0, 0, 16, 16, 0, 0, uint8_t(bx::EncodingType::Snorm) }, // RG16S + { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Int ) }, // RG32I + { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Uint ) }, // RG32U + { 64, 1, 1, 8, 1, 1, 0, 0, 32, 32, 0, 0, uint8_t(bx::EncodingType::Float) }, // RG32F + { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Unorm) }, // RGB8 + { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Int ) }, // RGB8I + { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Uint ) }, // RGB8U + { 24, 1, 1, 3, 1, 1, 0, 0, 8, 8, 8, 0, uint8_t(bx::EncodingType::Snorm) }, // RGB8S + { 32, 1, 1, 4, 1, 1, 0, 0, 9, 9, 9, 5, uint8_t(bx::EncodingType::Float) }, // RGB9E5F + { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Unorm) }, // BGRA8 + { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Unorm) }, // RGBA8 + { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Int ) }, // RGBA8I + { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Uint ) }, // RGBA8U + { 32, 1, 1, 4, 1, 1, 0, 0, 8, 8, 8, 8, uint8_t(bx::EncodingType::Snorm) }, // RGBA8S + { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Unorm) }, // RGBA16 + { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Int ) }, // RGBA16I + { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Uint ) }, // RGBA16U + { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Float) }, // RGBA16F + { 64, 1, 1, 8, 1, 1, 0, 0, 16, 16, 16, 16, uint8_t(bx::EncodingType::Snorm) }, // RGBA16S + { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Int ) }, // RGBA32I + { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Uint ) }, // RGBA32U + { 128, 1, 1, 16, 1, 1, 0, 0, 32, 32, 32, 32, uint8_t(bx::EncodingType::Float) }, // RGBA32F + { 16, 1, 1, 2, 1, 1, 0, 0, 5, 6, 5, 0, uint8_t(bx::EncodingType::Unorm) }, // R5G6B5 + { 16, 1, 1, 2, 1, 1, 0, 0, 4, 4, 4, 4, uint8_t(bx::EncodingType::Unorm) }, // RGBA4 + { 16, 1, 1, 2, 1, 1, 0, 0, 5, 5, 5, 1, uint8_t(bx::EncodingType::Unorm) }, // RGB5A1 + { 32, 1, 1, 4, 1, 1, 0, 0, 10, 10, 10, 2, uint8_t(bx::EncodingType::Unorm) }, // RGB10A2 + { 32, 1, 1, 4, 1, 1, 0, 0, 11, 11, 10, 0, uint8_t(bx::EncodingType::Unorm) }, // RG11B10F + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Count) }, // UnknownDepth + { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D16 + { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D24 + { 32, 1, 1, 4, 1, 1, 24, 8, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D24S8 + { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D32 + { 16, 1, 1, 2, 1, 1, 16, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D16F + { 24, 1, 1, 3, 1, 1, 24, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D24F + { 32, 1, 1, 4, 1, 1, 32, 0, 0, 0, 0, 0, uint8_t(bx::EncodingType::Float) }, // D32F + { 8, 1, 1, 1, 1, 1, 0, 8, 0, 0, 0, 0, uint8_t(bx::EncodingType::Unorm) }, // D0S8 }; BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) ); @@ -119,6 +132,15 @@ namespace bimg "PTC14A", // PTC14A "PTC22", // PTC22 "PTC24", // PTC24 + "ATC", // ATC + "ATCE", // ATCE + "ATCI", // ATCI + "ASTC4x4", // ASTC4x4 + "ASTC5x5", // ASTC5x5 + "ASTC6x6", // ASTC6x6 + "ASTC8x5", // ASTC8x5 + "ASTC8x6", // ASTC8x6 + "ASTC10x5", // ASTC10x5 "", // Unknown "R1", // R1 "A8", // A8 @@ -208,6 +230,11 @@ namespace bimg ; } + bool isFloat(TextureFormat::Enum _format) + { + return uint8_t(bx::EncodingType::Float) == s_imageBlockInfo[_format].encoding; + } + uint8_t getBitsPerPixel(TextureFormat::Enum _format) { return s_imageBlockInfo[_format].bitsPerPixel; @@ -253,9 +280,9 @@ namespace bimg const uint16_t minBlockX = blockInfo.minBlockX; const uint16_t minBlockY = blockInfo.minBlockY; - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth )*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); + _width = bx::max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth )*blockWidth); + _height = bx::max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); + _depth = bx::max(1, _depth); uint8_t numMips = calcNumMips(true, _width, _height, _depth); @@ -270,10 +297,11 @@ namespace bimg const uint16_t blockHeight = blockInfo.blockHeight; const uint16_t minBlockX = blockInfo.minBlockX; const uint16_t minBlockY = blockInfo.minBlockY; + const uint8_t blockSize = blockInfo.blockSize; - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); + _width = bx::max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); + _height = bx::max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); + _depth = bx::max(1, _depth); const uint8_t numMips = calcNumMips(_hasMips, _width, _height, _depth); const uint32_t sides = _cubeMap ? 6 : 1; @@ -284,11 +312,11 @@ namespace bimg for (uint32_t lod = 0; lod < numMips; ++lod) { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); + width = bx::max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); + height = bx::max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); + depth = bx::max(1, depth); - size += uint32_t(uint64_t(width*height*depth)*bpp/8 * sides); + size += uint32_t(uint64_t(width/blockWidth * height/blockHeight * depth)*blockSize * sides); width >>= 1; height >>= 1; @@ -335,7 +363,7 @@ namespace bimg } } - void imageRgba8Downsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) + void imageRgba8Downsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, uint32_t _dstPitch, const void* _src) { const uint32_t dstWidth = _width/2; const uint32_t dstHeight = _height/2; @@ -346,40 +374,40 @@ namespace bimg return; } - uint8_t* dst = (uint8_t*)_dst; const uint8_t* src = (const uint8_t*)_src; for (uint32_t zz = 0; zz < _depth; ++zz) { for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) { + uint8_t* dst = (uint8_t*)_dst + _dstPitch*yy; const uint8_t* rgba = src; for (uint32_t xx = 0; xx < dstWidth; ++xx, rgba += 8, dst += 4) { - float rr = bx::fpow(rgba[ 0], 2.2f); - float gg = bx::fpow(rgba[ 1], 2.2f); - float bb = bx::fpow(rgba[ 2], 2.2f); - float aa = rgba[ 3]; - rr += bx::fpow(rgba[ 4], 2.2f); - gg += bx::fpow(rgba[ 5], 2.2f); - bb += bx::fpow(rgba[ 6], 2.2f); - aa += rgba[ 7]; - rr += bx::fpow(rgba[_srcPitch+0], 2.2f); - gg += bx::fpow(rgba[_srcPitch+1], 2.2f); - bb += bx::fpow(rgba[_srcPitch+2], 2.2f); - aa += rgba[_srcPitch+3]; - rr += bx::fpow(rgba[_srcPitch+4], 2.2f); - gg += bx::fpow(rgba[_srcPitch+5], 2.2f); - bb += bx::fpow(rgba[_srcPitch+6], 2.2f); - aa += rgba[_srcPitch+7]; + float rr = bx::toLinear(rgba[ 0]); + float gg = bx::toLinear(rgba[ 1]); + float bb = bx::toLinear(rgba[ 2]); + float aa = rgba[ 3]; + rr += bx::toLinear(rgba[ 4]); + gg += bx::toLinear(rgba[ 5]); + bb += bx::toLinear(rgba[ 6]); + aa += rgba[ 7]; + rr += bx::toLinear(rgba[_srcPitch+0]); + gg += bx::toLinear(rgba[_srcPitch+1]); + bb += bx::toLinear(rgba[_srcPitch+2]); + aa += rgba[_srcPitch+3]; + rr += bx::toLinear(rgba[_srcPitch+4]); + gg += bx::toLinear(rgba[_srcPitch+5]); + bb += bx::toLinear(rgba[_srcPitch+6]); + aa += rgba[_srcPitch+7]; rr *= 0.25f; gg *= 0.25f; bb *= 0.25f; aa *= 0.25f; - rr = bx::fpow(rr, 1.0f/2.2f); - gg = bx::fpow(gg, 1.0f/2.2f); - bb = bx::fpow(bb, 1.0f/2.2f); + rr = bx::toGamma(rr); + gg = bx::toGamma(gg); + bb = bx::toGamma(bb); dst[0] = (uint8_t)rr; dst[1] = (uint8_t)gg; dst[2] = (uint8_t)bb; @@ -389,7 +417,44 @@ namespace bimg } } - void imageRgba8Downsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) + BX_SIMD_INLINE bx::simd128_t simd_to_linear(bx::simd128_t _a) + { + using namespace bx; + const simd128_t f12_92 = simd_ld(12.92f, 12.92f, 12.92f, 1.0f); + const simd128_t f0_055 = simd_ld(0.055f, 0.055f, 0.055f, 0.0f); + const simd128_t f1_055 = simd_ld(1.055f, 1.055f, 1.055f, 1.0f); + const simd128_t f2_4 = simd_ld(2.4f, 2.4f, 2.4f, 1.0f); + const simd128_t f0_04045 = simd_ld(0.04045f, 0.04045f, 0.04045f, 0.0f); + const simd128_t lo = simd_div(_a, f12_92); + const simd128_t tmp0 = simd_add(_a, f0_055); + const simd128_t tmp1 = simd_div(tmp0, f1_055); + const simd128_t hi = simd_pow(tmp1, f2_4); + const simd128_t mask = simd_cmple(_a, f0_04045); + const simd128_t result = simd_selb(mask, hi, lo); + + return result; + } + + BX_SIMD_INLINE bx::simd128_t simd_to_gamma(bx::simd128_t _a) + { + using namespace bx; + const simd128_t f12_92 = simd_ld(12.92f, 12.92f, 12.92f, 1.0f); + const simd128_t f0_055 = simd_ld(0.055f, 0.055f, 0.055f, 0.0f); + const simd128_t f1_055 = simd_ld(1.055f, 1.055f, 1.055f, 1.0f); + const simd128_t f1o2_4 = simd_ld(1.0f/2.4f, 1.0f/2.4f, 1.0f/2.4f, 1.0f); + const simd128_t f0_0031308 = simd_ld(0.0031308f, 0.0031308f, 0.0031308f, 0.0f); + const simd128_t lo = simd_mul(_a, f12_92); + const simd128_t absa = simd_abs(_a); + const simd128_t tmp0 = simd_pow(absa, f1o2_4); + const simd128_t tmp1 = simd_mul(tmp0, f1_055); + const simd128_t hi = simd_sub(tmp1, f0_055); + const simd128_t mask = simd_cmple(_a, f0_0031308); + const simd128_t result = simd_selb(mask, hi, lo); + + return result; + } + + void imageRgba8Downsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, uint32_t _dstPitch, const void* _src) { const uint32_t dstWidth = _width/2; const uint32_t dstHeight = _height/2; @@ -400,7 +465,6 @@ namespace bimg return; } - uint8_t* dst = (uint8_t*)_dst; const uint8_t* src = (const uint8_t*)_src; using namespace bx; @@ -410,14 +474,13 @@ namespace bimg const simd128_t pmask = simd_ild(0xff, 0x7f80, 0xff0000, 0x7f800000); const simd128_t wflip = simd_ild(0, 0, 0, 0x80000000); const simd128_t wadd = simd_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f); - const simd128_t gamma = simd_ld(1.0f/2.2f, 1.0f/2.2f, 1.0f/2.2f, 1.0f); - const simd128_t linear = simd_ld(2.2f, 2.2f, 2.2f, 1.0f); const simd128_t quater = simd_splat(0.25f); for (uint32_t zz = 0; zz < _depth; ++zz) { for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) { + uint8_t* dst = (uint8_t*)_dst + _dstPitch*yy; const uint8_t* rgba = src; for (uint32_t xx = 0; xx < dstWidth; ++xx, rgba += 8, dst += 4) { @@ -447,16 +510,16 @@ namespace bimg const simd128_t abgr2n = simd_mul(abgr2c, unpack); const simd128_t abgr3n = simd_mul(abgr3c, unpack); - const simd128_t abgr0l = simd_pow(abgr0n, linear); - const simd128_t abgr1l = simd_pow(abgr1n, linear); - const simd128_t abgr2l = simd_pow(abgr2n, linear); - const simd128_t abgr3l = simd_pow(abgr3n, linear); + const simd128_t abgr0l = simd_to_linear(abgr0n); + const simd128_t abgr1l = simd_to_linear(abgr1n); + const simd128_t abgr2l = simd_to_linear(abgr2n); + const simd128_t abgr3l = simd_to_linear(abgr3n); const simd128_t sum0 = simd_add(abgr0l, abgr1l); const simd128_t sum1 = simd_add(abgr2l, abgr3l); const simd128_t sum2 = simd_add(sum0, sum1); const simd128_t avg0 = simd_mul(sum2, quater); - const simd128_t avg1 = simd_pow(avg0, gamma); + const simd128_t avg1 = simd_to_gamma(avg0); const simd128_t avg2 = simd_mul(avg1, pack); const simd128_t ftoi0 = simd_ftoi(avg2); @@ -488,15 +551,37 @@ namespace bimg float* fd = ( float*)(dst + offset); const float* fs = (const float*)(src + offset); - fd[0] = bx::fpow(fs[0], 1.0f/2.2f); - fd[1] = bx::fpow(fs[1], 1.0f/2.2f); - fd[2] = bx::fpow(fs[2], 1.0f/2.2f); - fd[3] = fs[3]; + fd[0] = bx::toLinear(fs[0]); + fd[1] = bx::toLinear(fs[1]); + fd[2] = bx::toLinear(fs[2]); + fd[3] = fs[3]; } } } } + void imageRgba32fToLinear(ImageContainer* _imageContainer) + { + const uint16_t numSides = _imageContainer->m_numLayers * (_imageContainer->m_cubeMap ? 6 : 1); + + for (uint16_t side = 0; side < numSides; ++side) + { + bimg::ImageMip mip; + bimg::imageGetRawData(*_imageContainer, side, 0, _imageContainer->m_data, _imageContainer->m_size, mip); + + const uint32_t pitch = _imageContainer->m_width*16; + const uint32_t slice = _imageContainer->m_height*pitch; + + for (uint32_t zz = 0, depth = _imageContainer->m_depth; zz < depth; ++zz) + { + const uint32_t srcDataStep = uint32_t(bx::floor(zz * _imageContainer->m_depth / float(depth) ) ); + const uint8_t* srcData = &mip.m_data[srcDataStep*slice]; + + imageRgba32fToLinear(const_cast(srcData), mip.m_width, mip.m_height, 1, pitch, srcData); + } + } + } + void imageRgba32fToGamma(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) { uint8_t* dst = ( uint8_t*)_dst; @@ -512,19 +597,42 @@ namespace bimg float* fd = ( float*)(dst + offset); const float* fs = (const float*)(src + offset); - fd[0] = bx::fpow(fs[0], 2.2f); - fd[1] = bx::fpow(fs[1], 2.2f); - fd[2] = bx::fpow(fs[2], 2.2f); - fd[3] = fs[3]; + fd[0] = bx::toGamma(fs[0]); + fd[1] = bx::toGamma(fs[1]); + fd[2] = bx::toGamma(fs[2]); + fd[3] = fs[3]; } } } } + void imageRgba32fToGamma(ImageContainer* _imageContainer) + { + const uint16_t numSides = _imageContainer->m_numLayers * (_imageContainer->m_cubeMap ? 6 : 1); + + for (uint16_t side = 0; side < numSides; ++side) + { + bimg::ImageMip mip; + bimg::imageGetRawData(*_imageContainer, side, 0, _imageContainer->m_data, _imageContainer->m_size, mip); + + const uint32_t pitch = _imageContainer->m_width*16; + const uint32_t slice = _imageContainer->m_height*pitch; + + for (uint32_t zz = 0, depth = _imageContainer->m_depth; zz < depth; ++zz) + { + const uint32_t srcDataStep = uint32_t(bx::floor(zz * _imageContainer->m_depth / float(depth) ) ); + const uint8_t* srcData = &mip.m_data[srcDataStep*slice]; + + imageRgba32fToGamma(const_cast(srcData), mip.m_width, mip.m_height, 1, pitch, srcData); + } + } + } + void imageRgba32fLinearDownsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) { const uint32_t dstWidth = _width/2; const uint32_t dstHeight = _height/2; + const uint32_t dstDepth = _depth/2; if (0 == dstWidth || 0 == dstHeight) @@ -535,7 +643,7 @@ namespace bimg const uint8_t* src = (const uint8_t*)_src; uint8_t* dst = (uint8_t*)_dst; - for (uint32_t zz = 0; zz < _depth; ++zz) + if (0 == dstDepth) { for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) { @@ -565,15 +673,84 @@ namespace bimg xyz[2] += rgba1[6]; xyz[3] += rgba1[7]; - xyz[0] *= 0.25f; - xyz[1] *= 0.25f; - xyz[2] *= 0.25f; - xyz[3] *= 0.25f; + xyz[0] *= 1.0f/4.0f; + xyz[1] *= 1.0f/4.0f; + xyz[2] *= 1.0f/4.0f; + xyz[3] *= 1.0f/4.0f; bx::packRgba32F(dst, xyz); } } } + else + { + const uint32_t slicePitch = _srcPitch*_height; + + for (uint32_t zz = 0; zz < dstDepth; ++zz, src += slicePitch) + { + for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) + { + const float* rgba0 = (const float*)&src[0]; + const float* rgba1 = (const float*)&src[_srcPitch]; + const float* rgba2 = (const float*)&src[slicePitch]; + const float* rgba3 = (const float*)&src[slicePitch+_srcPitch]; + for (uint32_t xx = 0 + ; xx < dstWidth + ; ++xx, rgba0 += 8, rgba1 += 8, rgba2 += 8, rgba3 += 8, dst += 16 + ) + { + float xyz[4]; + + xyz[0] = rgba0[0]; + xyz[1] = rgba0[1]; + xyz[2] = rgba0[2]; + xyz[3] = rgba0[3]; + + xyz[0] += rgba0[4]; + xyz[1] += rgba0[5]; + xyz[2] += rgba0[6]; + xyz[3] += rgba0[7]; + + xyz[0] += rgba1[0]; + xyz[1] += rgba1[1]; + xyz[2] += rgba1[2]; + xyz[3] += rgba1[3]; + + xyz[0] += rgba1[4]; + xyz[1] += rgba1[5]; + xyz[2] += rgba1[6]; + xyz[3] += rgba1[7]; + + xyz[0] += rgba2[0]; + xyz[1] += rgba2[1]; + xyz[2] += rgba2[2]; + xyz[3] += rgba2[3]; + + xyz[0] += rgba2[4]; + xyz[1] += rgba2[5]; + xyz[2] += rgba2[6]; + xyz[3] += rgba2[7]; + + xyz[0] += rgba3[0]; + xyz[1] += rgba3[1]; + xyz[2] += rgba3[2]; + xyz[3] += rgba3[3]; + + xyz[0] += rgba3[4]; + xyz[1] += rgba3[5]; + xyz[2] += rgba3[6]; + xyz[3] += rgba3[7]; + + xyz[0] *= 1.0f/8.0f; + xyz[1] *= 1.0f/8.0f; + xyz[2] *= 1.0f/8.0f; + xyz[3] *= 1.0f/8.0f; + + bx::packRgba32F(dst, xyz); + } + } + } + } } void imageRgba32fLinearDownsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) @@ -581,7 +758,137 @@ namespace bimg imageRgba32fLinearDownsample2x2Ref(_dst, _width, _height, _depth, _srcPitch, _src); } - void imageRgba32fDownsample2x2NormalMapRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src) + void imageRgba32fDownsample2x2Ref(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) + { + const uint32_t dstWidth = _width/2; + const uint32_t dstHeight = _height/2; + const uint32_t dstDepth = _depth/2; + + if (0 == dstWidth + || 0 == dstHeight) + { + return; + } + + const uint8_t* src = (const uint8_t*)_src; + uint8_t* dst = (uint8_t*)_dst; + + if (0 == dstDepth) + { + for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) + { + const float* rgba0 = (const float*)&src[0]; + const float* rgba1 = (const float*)&src[_srcPitch]; + for (uint32_t xx = 0; xx < dstWidth; ++xx, rgba0 += 8, rgba1 += 8, dst += 16) + { + float xyz[4]; + + xyz[0] = bx::toLinear(rgba0[0]); + xyz[1] = bx::toLinear(rgba0[1]); + xyz[2] = bx::toLinear(rgba0[2]); + xyz[3] = rgba0[3]; + + xyz[0] += bx::toLinear(rgba0[4]); + xyz[1] += bx::toLinear(rgba0[5]); + xyz[2] += bx::toLinear(rgba0[6]); + xyz[3] += rgba0[7]; + + xyz[0] += bx::toLinear(rgba1[0]); + xyz[1] += bx::toLinear(rgba1[1]); + xyz[2] += bx::toLinear(rgba1[2]); + xyz[3] += rgba1[3]; + + xyz[0] += bx::toLinear(rgba1[4]); + xyz[1] += bx::toLinear(rgba1[5]); + xyz[2] += bx::toLinear(rgba1[6]); + xyz[3] += rgba1[7]; + + xyz[0] = bx::toGamma(xyz[0]/4.0f); + xyz[1] = bx::toGamma(xyz[1]/4.0f); + xyz[2] = bx::toGamma(xyz[2]/4.0f); + xyz[3] = xyz[3]/4.0f; + + bx::packRgba32F(dst, xyz); + } + } + } + else + { + const uint32_t slicePitch = _srcPitch*_height; + + for (uint32_t zz = 0; zz < dstDepth; ++zz, src += slicePitch) + { + for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) + { + const float* rgba0 = (const float*)&src[0]; + const float* rgba1 = (const float*)&src[_srcPitch]; + const float* rgba2 = (const float*)&src[slicePitch]; + const float* rgba3 = (const float*)&src[slicePitch+_srcPitch]; + for (uint32_t xx = 0 + ; xx < dstWidth + ; ++xx, rgba0 += 8, rgba1 += 8, rgba2 += 8, rgba3 += 8, dst += 16 + ) + { + float xyz[4]; + + xyz[0] = bx::toLinear(rgba0[0]); + xyz[1] = bx::toLinear(rgba0[1]); + xyz[2] = bx::toLinear(rgba0[2]); + xyz[3] = rgba0[3]; + + xyz[0] += bx::toLinear(rgba0[4]); + xyz[1] += bx::toLinear(rgba0[5]); + xyz[2] += bx::toLinear(rgba0[6]); + xyz[3] += rgba0[7]; + + xyz[0] += bx::toLinear(rgba1[0]); + xyz[1] += bx::toLinear(rgba1[1]); + xyz[2] += bx::toLinear(rgba1[2]); + xyz[3] += rgba1[3]; + + xyz[0] += bx::toLinear(rgba1[4]); + xyz[1] += bx::toLinear(rgba1[5]); + xyz[2] += bx::toLinear(rgba1[6]); + xyz[3] += rgba1[7]; + + xyz[0] += bx::toLinear(rgba2[0]); + xyz[1] += bx::toLinear(rgba2[1]); + xyz[2] += bx::toLinear(rgba2[2]); + xyz[3] += rgba2[3]; + + xyz[0] += bx::toLinear(rgba2[4]); + xyz[1] += bx::toLinear(rgba2[5]); + xyz[2] += bx::toLinear(rgba2[6]); + xyz[3] += rgba2[7]; + + xyz[0] += bx::toLinear(rgba3[0]); + xyz[1] += bx::toLinear(rgba3[1]); + xyz[2] += bx::toLinear(rgba3[2]); + xyz[3] += rgba3[3]; + + xyz[0] += bx::toLinear(rgba3[4]); + xyz[1] += bx::toLinear(rgba3[5]); + xyz[2] += bx::toLinear(rgba3[6]); + xyz[3] += rgba3[7]; + + xyz[0] = bx::toGamma(xyz[0]/8.0f); + xyz[1] = bx::toGamma(xyz[1]/8.0f); + xyz[2] = bx::toGamma(xyz[2]/8.0f); + xyz[3] = xyz[3]/8.0f; + + bx::packRgba32F(dst, xyz); + } + } + } + } + } + + void imageRgba32fDownsample2x2(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, const void* _src) + { + imageRgba32fDownsample2x2Ref(_dst, _width, _height, _depth, _srcPitch, _src); + } + + void imageRgba32fDownsample2x2NormalMapRef(void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, uint32_t _dstPitch, const void* _src) { const uint32_t dstWidth = _width/2; const uint32_t dstHeight = _height/2; @@ -593,12 +900,14 @@ namespace bimg } const uint8_t* src = (const uint8_t*)_src; - uint8_t* dst = (uint8_t*)_dst; for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstHeight; ++yy, src += ystep) { const float* rgba0 = (const float*)&src[0]; const float* rgba1 = (const float*)&src[_srcPitch]; + + uint8_t* dst = (uint8_t*)_dst + _dstPitch*yy; + for (uint32_t xx = 0; xx < dstWidth; ++xx, rgba0 += 8, rgba1 += 8, dst += 16) { float xyz[3]; @@ -619,14 +928,14 @@ namespace bimg xyz[1] += rgba1[5]; xyz[2] += rgba1[6]; - bx::vec3Norm( (float*)dst, xyz); + bx::store(dst, bx::normalize(bx::load(xyz) ) ); } } } - void imageRgba32fDownsample2x2NormalMap(void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src) + void imageRgba32fDownsample2x2NormalMap(void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, uint32_t _dstPitch, const void* _src) { - imageRgba32fDownsample2x2NormalMapRef(_dst, _width, _height, _srcPitch, _src); + imageRgba32fDownsample2x2NormalMapRef(_dst, _width, _height, _srcPitch, _dstPitch, _src); } void imageSwizzleBgra8Ref(void* _dst, uint32_t _dstPitch, uint32_t _width, uint32_t _height, const void* _src, uint32_t _srcPitch) @@ -697,19 +1006,22 @@ namespace bimg } } - void imageCopy(void* _dst, uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch) + void imageCopy(void* _dst, uint32_t _height, uint32_t _srcPitch, uint32_t _depth, const void* _src, uint32_t _dstPitch) { const uint32_t pitch = bx::uint32_min(_srcPitch, _dstPitch); const uint8_t* src = (uint8_t*)_src; uint8_t* dst = (uint8_t*)_dst; - bx::memCopy(dst, src, pitch, _height, _srcPitch, _dstPitch); + for (uint32_t zz = 0; zz < _depth; ++zz, src += _srcPitch*_height, dst += _dstPitch*_height) + { + bx::memCopy(dst, src, pitch, _height, _srcPitch, _dstPitch); + } } - void imageCopy(void* _dst, uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src) + void imageCopy(void* _dst, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _bpp, uint32_t _srcPitch, const void* _src) { const uint32_t dstPitch = _width*_bpp/8; - imageCopy(_dst, _height, _srcPitch, _src, dstPitch); + imageCopy(_dst, _height, _srcPitch, _depth, _src, dstPitch); } struct PackUnpack @@ -737,6 +1049,15 @@ namespace bimg { NULL, NULL }, // PTC14A { NULL, NULL }, // PTC22 { NULL, NULL }, // PTC24 + { NULL, NULL }, // ATC + { NULL, NULL }, // ATCE + { NULL, NULL }, // ATCI + { NULL, NULL }, // ASTC4x4 + { NULL, NULL }, // ASTC5x5 + { NULL, NULL }, // ASTC6x6 + { NULL, NULL }, // ASTC8x5 + { NULL, NULL }, // ASTC8x6 + { NULL, NULL }, // ASTC10x5 { NULL, NULL }, // Unknown { NULL, NULL }, // R1 { bx::packR8, bx::unpackR8 }, // A8 @@ -854,13 +1175,31 @@ namespace bimg } } - bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch) + bool imageConvert(bx::AllocatorI* _allocator, void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch) { UnpackFn unpack = s_packUnpack[_srcFormat].unpack; PackFn pack = s_packUnpack[_dstFormat].pack; if (NULL == pack || NULL == unpack) { + switch (_dstFormat) + { + case TextureFormat::RGBA8: + imageDecodeToRgba8(_allocator, _dst, _src, _width, _height, _width*4, _srcFormat); + return true; + + case TextureFormat::BGRA8: + imageDecodeToBgra8(_allocator, _dst, _src, _width, _height, _width*4, _srcFormat); + return true; + + case TextureFormat::RGBA32F: + imageDecodeToRgba32f(_allocator, _dst, _src, _width, _height, 1, _width*16, _srcFormat); + return true; + + default: + break; + } + return false; } @@ -871,20 +1210,20 @@ namespace bimg return true; } - bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _depth) + bool imageConvert(bx::AllocatorI* _allocator, void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _depth) { const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; if (_dstFormat == _srcFormat) { - bx::memCopy(_dst, _src, _width*_height*_depth*srcBpp/8); + bx::memCopy(_dst, _src, _width*_height*_depth*(srcBpp/8) ); return true; } - return imageConvert(_dst, _dstFormat, _src, _srcFormat, _width, _height, _depth, _width*srcBpp/8); + return imageConvert(_allocator, _dst, _dstFormat, _src, _srcFormat, _width, _height, _depth, _width*srcBpp/8); } - ImageContainer* imageConvert(bx::AllocatorI* _allocator, TextureFormat::Enum _dstFormat, const ImageContainer& _input) + ImageContainer* imageConvert(bx::AllocatorI* _allocator, TextureFormat::Enum _dstFormat, const ImageContainer& _input, bool _convertMips) { ImageContainer* output = imageAlloc(_allocator , _dstFormat @@ -893,14 +1232,14 @@ namespace bimg , uint16_t(_input.m_depth) , _input.m_numLayers , _input.m_cubeMap - , 1 < _input.m_numMips + , _convertMips && 1 < _input.m_numMips ); const uint16_t numSides = _input.m_numLayers * (_input.m_cubeMap ? 6 : 1); for (uint16_t side = 0; side < numSides; ++side) { - for (uint8_t lod = 0, num = _input.m_numMips; lod < num; ++lod) + for (uint8_t lod = 0, num = _convertMips ? _input.m_numMips : 1; lod < num; ++lod) { ImageMip mip; if (imageGetRawData(_input, side, lod, _input.m_data, _input.m_size, mip) ) @@ -909,14 +1248,16 @@ namespace bimg imageGetRawData(*output, side, lod, output->m_data, output->m_size, dstMip); uint8_t* dstData = const_cast(dstMip.m_data); - bool ok = imageConvert(dstData - , _dstFormat - , mip.m_data - , mip.m_format - , mip.m_width - , mip.m_height - , mip.m_depth - ); + bool ok = imageConvert( + _allocator + , dstData + , _dstFormat + , mip.m_data + , mip.m_format + , mip.m_width + , mip.m_height + , mip.m_depth + ); BX_CHECK(ok, "Conversion from %s to %s failed!" , getName(_input.m_format) , getName(output->m_format) @@ -1125,19 +1466,1052 @@ namespace bimg } } - static const int32_t s_etc1Mod[8][4] = - { - { 2, 8, -2, -8}, - { 5, 17, -5, -17}, - { 9, 29, -9, -29}, - { 13, 42, -13, -42}, - { 18, 60, -18, -60}, - { 24, 80, -24, -80}, - { 33, 106, -33, -106}, - { 47, 183, -47, -183}, + // BC6H, BC7 + // + // Reference(s): + // - https://web.archive.org/web/20181126035446/https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_compression_bptc.txt + // - https://web.archive.org/web/20181126035538/https://docs.microsoft.com/en-us/windows/desktop/direct3d11/bc6h-format + // + static const uint16_t s_bptcP2[] = + { // 3210 0000000000 1111111111 2222222222 3333333333 + 0xcccc, // 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 + 0x8888, // 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 + 0xeeee, // 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1 + 0xecc8, // 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1 + 0xc880, // 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1 + 0xfeec, // 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 + 0xfec8, // 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 + 0xec80, // 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1 + 0xc800, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1 + 0xffec, // 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 0xfe80, // 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1 + 0xe800, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1 + 0xffe8, // 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 0xff00, // 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 + 0xfff0, // 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + 0xf000, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 + 0xf710, // 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1 + 0x008e, // 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 + 0x7100, // 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0 + 0x08ce, // 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0 + 0x008c, // 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 + 0x7310, // 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0 + 0x3100, // 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 + 0x8cce, // 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1 + 0x088c, // 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 + 0x3110, // 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 + 0x6666, // 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0 + 0x366c, // 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0 + 0x17e8, // 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0 + 0x0ff0, // 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 + 0x718e, // 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0 + 0x399c, // 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0 + 0xaaaa, // 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 + 0xf0f0, // 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1 + 0x5a5a, // 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0 + 0x33cc, // 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0 + 0x3c3c, // 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0 + 0x55aa, // 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 + 0x9696, // 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1 + 0xa55a, // 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 + 0x73ce, // 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0 + 0x13c8, // 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 + 0x324c, // 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0 + 0x3bdc, // 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0 + 0x6996, // 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 + 0xc33c, // 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1 + 0x9966, // 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1 + 0x0660, // 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0 + 0x0272, // 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0 + 0x04e4, // 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0 + 0x4e40, // 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0 + 0x2720, // 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0 + 0xc936, // 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1 + 0x936c, // 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1 + 0x39c6, // 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0 + 0x639c, // 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0 + 0x9336, // 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1 + 0x9cc6, // 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1 + 0x817e, // 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1 + 0xe718, // 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1 + 0xccf0, // 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 + 0x0fcc, // 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 + 0x7744, // 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0 + 0xee22, // 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1 }; - static const uint8_t s_etc2Mod[8] = { 3, 6, 11, 16, 23, 32, 41, 64 }; + static const uint32_t s_bptcP3[] = + { // 76543210 0000 1111 2222 3333 4444 5555 6666 7777 + 0xaa685050, // 0, 0, 1, 1, 0, 0, 1, 1, 0, 2, 2, 1, 2, 2, 2, 2 + 0x6a5a5040, // 0, 0, 0, 1, 0, 0, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1 + 0x5a5a4200, // 0, 0, 0, 0, 2, 0, 0, 1, 2, 2, 1, 1, 2, 2, 1, 1 + 0x5450a0a8, // 0, 2, 2, 2, 0, 0, 2, 2, 0, 0, 1, 1, 0, 1, 1, 1 + 0xa5a50000, // 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 2, 2 + 0xa0a05050, // 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 2, 2 + 0x5555a0a0, // 0, 0, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 + 0x5a5a5050, // 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1 + 0xaa550000, // 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2 + 0xaa555500, // 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2 + 0xaaaa5500, // 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 + 0x90909090, // 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2 + 0x94949494, // 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2, 0, 1, 1, 2 + 0xa4a4a4a4, // 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2 + 0xa9a59450, // 0, 0, 1, 1, 0, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2 + 0x2a0a4250, // 0, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 0, 2, 2, 2, 0 + 0xa5945040, // 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 2, 1, 1, 2, 2 + 0x0a425054, // 0, 1, 1, 1, 0, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 0 + 0xa5a5a500, // 0, 0, 0, 0, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2 + 0x55a0a0a0, // 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 1, 1, 1, 1 + 0xa8a85454, // 0, 1, 1, 1, 0, 1, 1, 1, 0, 2, 2, 2, 0, 2, 2, 2 + 0x6a6a4040, // 0, 0, 0, 1, 0, 0, 0, 1, 2, 2, 2, 1, 2, 2, 2, 1 + 0xa4a45000, // 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 2, 2, 0, 1, 2, 2 + 0x1a1a0500, // 0, 0, 0, 0, 1, 1, 0, 0, 2, 2, 1, 0, 2, 2, 1, 0 + 0x0050a4a4, // 0, 1, 2, 2, 0, 1, 2, 2, 0, 0, 1, 1, 0, 0, 0, 0 + 0xaaa59090, // 0, 0, 1, 2, 0, 0, 1, 2, 1, 1, 2, 2, 2, 2, 2, 2 + 0x14696914, // 0, 1, 1, 0, 1, 2, 2, 1, 1, 2, 2, 1, 0, 1, 1, 0 + 0x69691400, // 0, 0, 0, 0, 0, 1, 1, 0, 1, 2, 2, 1, 1, 2, 2, 1 + 0xa08585a0, // 0, 0, 2, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 0, 2, 2 + 0xaa821414, // 0, 1, 1, 0, 0, 1, 1, 0, 2, 0, 0, 2, 2, 2, 2, 2 + 0x50a4a450, // 0, 0, 1, 1, 0, 1, 2, 2, 0, 1, 2, 2, 0, 0, 1, 1 + 0x6a5a0200, // 0, 0, 0, 0, 2, 0, 0, 0, 2, 2, 1, 1, 2, 2, 2, 1 + 0xa9a58000, // 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 2, 2, 1, 2, 2, 2 + 0x5090a0a8, // 0, 2, 2, 2, 0, 0, 2, 2, 0, 0, 1, 2, 0, 0, 1, 1 + 0xa8a09050, // 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, 2, 2, 0, 2, 2, 2 + 0x24242424, // 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 0 + 0x00aa5500, // 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 0, 0, 0, 0 + 0x24924924, // 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0 + 0x24499224, // 0, 1, 2, 0, 2, 0, 1, 2, 1, 2, 0, 1, 0, 1, 2, 0 + 0x50a50a50, // 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1 + 0x500aa550, // 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 0, 0, 0, 0, 1, 1 + 0xaaaa4444, // 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2 + 0x66660000, // 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 1, 2, 1, 2, 1 + 0xa5a0a5a0, // 0, 0, 2, 2, 1, 1, 2, 2, 0, 0, 2, 2, 1, 1, 2, 2 + 0x50a050a0, // 0, 0, 2, 2, 0, 0, 1, 1, 0, 0, 2, 2, 0, 0, 1, 1 + 0x69286928, // 0, 2, 2, 0, 1, 2, 2, 1, 0, 2, 2, 0, 1, 2, 2, 1 + 0x44aaaa44, // 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 0, 1 + 0x66666600, // 0, 0, 0, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1 + 0xaa444444, // 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 2, 2, 2 + 0x54a854a8, // 0, 2, 2, 2, 0, 1, 1, 1, 0, 2, 2, 2, 0, 1, 1, 1 + 0x95809580, // 0, 0, 0, 2, 1, 1, 1, 2, 0, 0, 0, 2, 1, 1, 1, 2 + 0x96969600, // 0, 0, 0, 0, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2 + 0xa85454a8, // 0, 2, 2, 2, 0, 1, 1, 1, 0, 1, 1, 1, 0, 2, 2, 2 + 0x80959580, // 0, 0, 0, 2, 1, 1, 1, 2, 1, 1, 1, 2, 0, 0, 0, 2 + 0xaa141414, // 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 2, 2, 2, 2 + 0x96960000, // 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 2, 2, 1, 1, 2 + 0xaaaa1414, // 0, 1, 1, 0, 0, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2 + 0xa05050a0, // 0, 0, 2, 2, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 2, 2 + 0xa0a5a5a0, // 0, 0, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 0, 0, 2, 2 + 0x96000000, // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 2 + 0x40804080, // 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1 + 0xa9a8a9a8, // 0, 2, 2, 2, 1, 2, 2, 2, 0, 2, 2, 2, 1, 2, 2, 2 + 0xaaaaaa44, // 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 + 0x2a4a5254, // 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0 + }; + + static const uint8_t s_bptcA2[] = + { + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, + 15, 2, 8, 2, 2, 8, 8, 15, + 2, 8, 2, 2, 8, 8, 2, 2, + 15, 15, 6, 8, 2, 8, 15, 15, + 2, 8, 2, 2, 2, 15, 15, 6, + 6, 2, 6, 8, 15, 15, 2, 2, + 15, 15, 15, 15, 15, 2, 2, 15, + }; + + static const uint8_t s_bptcA3[2][64] = + { + { + 3, 3, 15, 15, 8, 3, 15, 15, + 8, 8, 6, 6, 6, 5, 3, 3, + 3, 3, 8, 15, 3, 3, 6, 10, + 5, 8, 8, 6, 8, 5, 15, 15, + 8, 15, 3, 5, 6, 10, 8, 15, + 15, 3, 15, 5, 15, 15, 15, 15, + 3, 15, 5, 5, 5, 8, 5, 10, + 5, 10, 8, 13, 15, 12, 3, 3, + }, + { + 15, 8, 8, 3, 15, 15, 3, 8, + 15, 15, 15, 15, 15, 15, 15, 8, + 15, 8, 15, 3, 15, 8, 15, 8, + 3, 15, 6, 10, 15, 15, 10, 8, + 15, 3, 15, 10, 10, 8, 9, 10, + 6, 15, 8, 15, 3, 6, 6, 8, + 15, 3, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 3, 15, 15, 8, + }, + }; + + static const uint8_t s_bptcFactors[3][16] = + { + { 0, 21, 43, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 9, 18, 27, 37, 46, 55, 64, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64 }, + }; + + struct BitReader + { + BitReader(const uint8_t* _data, uint16_t _bitPos = 0) + : m_data(_data) + , m_bitPos(_bitPos) + { + } + + uint16_t read(uint8_t _numBits) + { + const uint16_t pos = m_bitPos / 8; + const uint16_t shift = m_bitPos & 7; + uint32_t data = 0; + bx::memCopy(&data, &m_data[pos], bx::min(4, 16-pos) ); + m_bitPos += _numBits; + return uint16_t( (data >> shift) & ( (1 << _numBits)-1) ); + } + + uint16_t peek(uint16_t _offset, uint8_t _numBits) + { + const uint16_t bitPos = m_bitPos + _offset; + const uint16_t shift = bitPos & 7; + uint16_t pos = bitPos / 8; + uint32_t data = 0; + bx::memCopy(&data, &m_data[pos], bx::min(4, 16-pos) ); + return uint8_t( (data >> shift) & ( (1 << _numBits)-1) ); + } + + const uint8_t* m_data; + uint16_t m_bitPos; + }; + + uint16_t bc6hUnquantize(uint16_t _value, bool _signed, uint8_t _endpointBits) + { + const uint16_t maxValue = 1<<(_endpointBits-1); + + if (_signed) + { + if (_endpointBits >= 16) + { + return _value; + } + + const bool sign = !!(_value & 0x8000); + _value &= 0x7fff; + + uint16_t unq; + + if (0 == _value) + { + unq = 0; + } + else if (_value >= maxValue-1) + { + unq = 0x7fff; + } + else + { + unq = ( (_value<<15) + 0x4000) >> (_endpointBits-1); + } + + return sign ? -unq : unq; + } + + if (_endpointBits >= 15) + { + return _value; + } + + if (0 == _value) + { + return 0; + } + + if (_value == maxValue) + { + return UINT16_MAX; + } + + return ( (_value<<15) + 0x4000) >> (_endpointBits-1); + } + + uint16_t bc6hUnquantizeFinal(uint16_t _value, bool _signed) + { + if (_signed) + { + const uint16_t sign = _value & 0x8000; + _value &= 0x7fff; + + return ( (_value * 31) >> 5) | sign; + } + + return (_value * 31) >> 6; + } + + uint16_t signExtend(uint16_t _value, uint8_t _numBits) + { + const uint16_t mask = 1 << (_numBits - 1); + const uint16_t result = (_value ^ mask) - mask; + + return result; + } + + struct Bc6hModeInfo + { + uint8_t transformed; + uint8_t partitionBits; + uint8_t endpointBits; + uint8_t deltaBits[3]; + }; + + static const Bc6hModeInfo s_bc6hModeInfo[] = + { // +--------------------------- transformed + // | +------------------------ partition bits + // | | +--------------------- endpoint bits + // | | | +-------------- delta bits + { 1, 5, 10, { 5, 5, 5 } }, // 00 2-bits + { 1, 5, 7, { 6, 6, 6 } }, // 01 + { 1, 5, 11, { 5, 4, 4 } }, // 00010 5-bits + { 0, 0, 10, { 10, 10, 10 } }, // 00011 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 1, 5, 11, { 4, 5, 4 } }, // 00110 + { 1, 0, 11, { 9, 9, 9 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 1, 5, 11, { 4, 4, 5 } }, // 00010 + { 1, 0, 12, { 8, 8, 8 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 1, 5, 9, { 5, 5, 5 } }, // 00010 + { 1, 0, 16, { 4, 4, 4 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 1, 5, 8, { 6, 5, 5 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 1, 5, 8, { 5, 6, 5 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 1, 5, 8, { 5, 5, 6 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 0, 0, { 0, 0, 0 } }, // - + { 0, 5, 6, { 6, 6, 6 } }, // 00010 + { 0, 0, 0, { 0, 0, 0 } }, // - + }; + + void decodeBlockBc6h(uint16_t _dst[16*3], const uint8_t _src[16], bool _signed) + { + BitReader bit(_src); + + uint8_t mode = uint8_t(bit.read(2) ); + if (mode & 2) + { + // 5-bit mode + mode |= bit.read(3) << 2; + } + + const Bc6hModeInfo& mi = s_bc6hModeInfo[mode]; + if (0 == mi.endpointBits) + { + bx::memSet(_dst, 0, 16*3*2); + return; + } + + uint16_t epR[4] = { /* rw, rx, ry, rz */ }; + uint16_t epG[4] = { /* gw, gx, gy, gz */ }; + uint16_t epB[4] = { /* bw, bx, by, bz */ }; + + switch (mode) + { + case 0: + epG[2] |= bit.read( 1) << 4; + epB[2] |= bit.read( 1) << 4; + epB[3] |= bit.read( 1) << 4; + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 5) << 0; + epG[3] |= bit.read( 1) << 4; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 3; + break; + + case 1: + epG[2] |= bit.read( 1) << 5; + epG[3] |= bit.read( 1) << 4; + epG[3] |= bit.read( 1) << 5; + epR[0] |= bit.read( 7) << 0; + epB[3] |= bit.read( 1) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 1) << 4; + epG[0] |= bit.read( 7) << 0; + epB[2] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 2; + epG[2] |= bit.read( 1) << 4; + epB[0] |= bit.read( 7) << 0; + epB[3] |= bit.read( 1) << 3; + epB[3] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 4; + epR[1] |= bit.read( 6) << 0; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 6) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 6) << 0; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 6) << 0; + epR[3] |= bit.read( 6) << 0; + break; + + case 2: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 5) << 0; + epR[0] |= bit.read( 1) << 10; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 4) << 0; + epG[0] |= bit.read( 1) << 10; + epB[3] |= bit.read( 1) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 4) << 0; + epB[0] |= bit.read( 1) << 10; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 3; + break; + + case 3: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read(10) << 0; + epG[1] |= bit.read(10) << 0; + epB[1] |= bit.read(10) << 0; + break; + + case 6: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 4) << 0; + epR[0] |= bit.read( 1) << 10; + epG[3] |= bit.read( 1) << 4; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 5) << 0; + epG[0] |= bit.read( 1) << 10; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 4) << 0; + epB[0] |= bit.read( 1) << 10; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 4) << 0; + epB[3] |= bit.read( 1) << 0; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 4) << 0; + epG[2] |= bit.read( 1) << 4; + epB[3] |= bit.read( 1) << 3; + break; + + case 7: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 9) << 0; + epR[0] |= bit.read( 1) << 10; + epG[1] |= bit.read( 9) << 0; + epG[0] |= bit.read( 1) << 10; + epB[1] |= bit.read( 9) << 0; + epB[0] |= bit.read( 1) << 10; + break; + + case 10: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 4) << 0; + epR[0] |= bit.read( 1) << 10; + epB[2] |= bit.read( 1) << 4; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 4) << 0; + epG[0] |= bit.read( 1) << 10; + epB[3] |= bit.read( 1) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 5) << 0; + epB[0] |= bit.read( 1) << 10; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 4) << 0; + epB[3] |= bit.read( 1) << 1; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 4) << 0; + epB[3] |= bit.read( 1) << 4; + epB[3] |= bit.read( 1) << 3; + break; + + case 11: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 8) << 0; + epR[0] |= bit.read( 1) << 11; + epR[0] |= bit.read( 1) << 10; + epG[1] |= bit.read( 8) << 0; + epG[0] |= bit.read( 1) << 11; + epG[0] |= bit.read( 1) << 10; + epB[1] |= bit.read( 8) << 0; + epB[0] |= bit.read( 1) << 11; + epB[0] |= bit.read( 1) << 10; + break; + + case 14: + epR[0] |= bit.read( 9) << 0; + epB[2] |= bit.read( 1) << 4; + epG[0] |= bit.read( 9) << 0; + epG[2] |= bit.read( 1) << 4; + epB[0] |= bit.read( 9) << 0; + epB[3] |= bit.read( 1) << 4; + epR[1] |= bit.read( 5) << 0; + epG[3] |= bit.read( 1) << 4; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 3; + break; + + case 15: + epR[0] |= bit.read(10) << 0; + epG[0] |= bit.read(10) << 0; + epB[0] |= bit.read(10) << 0; + epR[1] |= bit.read( 4) << 0; + epR[0] |= bit.read( 1) << 15; + epR[0] |= bit.read( 1) << 14; + epR[0] |= bit.read( 1) << 13; + epR[0] |= bit.read( 1) << 12; + epR[0] |= bit.read( 1) << 11; + epR[0] |= bit.read( 1) << 10; + epG[1] |= bit.read( 4) << 0; + epG[0] |= bit.read( 1) << 15; + epG[0] |= bit.read( 1) << 14; + epG[0] |= bit.read( 1) << 13; + epG[0] |= bit.read( 1) << 12; + epG[0] |= bit.read( 1) << 11; + epG[0] |= bit.read( 1) << 10; + epB[1] |= bit.read( 4) << 0; + epB[0] |= bit.read( 1) << 15; + epB[0] |= bit.read( 1) << 14; + epB[0] |= bit.read( 1) << 13; + epB[0] |= bit.read( 1) << 12; + epB[0] |= bit.read( 1) << 11; + epB[0] |= bit.read( 1) << 10; + break; + + case 18: + epR[0] |= bit.read( 8) << 0; + epG[3] |= bit.read( 1) << 4; + epB[2] |= bit.read( 1) << 4; + epG[0] |= bit.read( 8) << 0; + epB[3] |= bit.read( 1) << 2; + epG[2] |= bit.read( 1) << 4; + epB[0] |= bit.read( 8) << 0; + epB[3] |= bit.read( 1) << 3; + epB[3] |= bit.read( 1) << 4; + epR[1] |= bit.read( 6) << 0; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 6) << 0; + epR[3] |= bit.read( 6) << 0; + break; + + case 22: + epR[0] |= bit.read( 8) << 0; + epB[3] |= bit.read( 1) << 0; + epB[2] |= bit.read( 1) << 4; + epG[0] |= bit.read( 8) << 0; + epG[2] |= bit.read( 1) << 5; + epG[2] |= bit.read( 1) << 4; + epB[0] |= bit.read( 8) << 0; + epG[3] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 4; + epR[1] |= bit.read( 5) << 0; + epG[3] |= bit.read( 1) << 4; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 6) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 3; + break; + + case 26: + epR[0] |= bit.read( 8) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 1) << 4; + epG[0] |= bit.read( 8) << 0; + epB[2] |= bit.read( 1) << 5; + epG[2] |= bit.read( 1) << 4; + epB[0] |= bit.read( 8) << 0; + epB[3] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 4; + epR[1] |= bit.read( 5) << 0; + epG[3] |= bit.read( 1) << 4; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 6) << 0; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 2; + epR[3] |= bit.read( 5) << 0; + epB[3] |= bit.read( 1) << 3; + break; + + case 30: + epR[0] |= bit.read( 6) << 0; + epG[3] |= bit.read( 1) << 4; + epB[3] |= bit.read( 1) << 0; + epB[3] |= bit.read( 1) << 1; + epB[2] |= bit.read( 1) << 4; + epG[0] |= bit.read( 6) << 0; + epG[2] |= bit.read( 1) << 5; + epB[2] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 2; + epG[2] |= bit.read( 1) << 4; + epB[0] |= bit.read( 6) << 0; + epG[3] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 3; + epB[3] |= bit.read( 1) << 5; + epB[3] |= bit.read( 1) << 4; + epR[1] |= bit.read( 6) << 0; + epG[2] |= bit.read( 4) << 0; + epG[1] |= bit.read( 6) << 0; + epG[3] |= bit.read( 4) << 0; + epB[1] |= bit.read( 6) << 0; + epB[2] |= bit.read( 4) << 0; + epR[2] |= bit.read( 6) << 0; + epR[3] |= bit.read( 6) << 0; + break; + + default: + break; + } + + if (_signed) + { + epR[0] = signExtend(epR[0], mi.endpointBits); + epG[0] = signExtend(epG[0], mi.endpointBits); + epB[0] = signExtend(epB[0], mi.endpointBits); + } + + const uint8_t numSubsets = !!mi.partitionBits + 1; + + for (uint8_t ii = 1, num = numSubsets*2; ii < num; ++ii) + { + if (_signed + || mi.transformed) + { + epR[ii] = signExtend(epR[ii], mi.deltaBits[0]); + epG[ii] = signExtend(epG[ii], mi.deltaBits[1]); + epB[ii] = signExtend(epB[ii], mi.deltaBits[2]); + } + + if (mi.transformed) + { + const uint16_t mask = (1<> idx) & 1; + indexAnchor = subsetIndex ? s_bptcA2[partitionSetIdx] : 0; + } + + const uint8_t anchor = idx == indexAnchor; + const uint8_t num = indexBits - anchor; + const uint8_t index = (uint8_t)bit.read(num); + + const uint8_t fc = factors[index]; + const uint8_t fca = 64 - fc; + const uint8_t fcb = fc; + + subsetIndex *= 2; + uint16_t rr = bc6hUnquantizeFinal( (epR[subsetIndex]*fca + epR[subsetIndex + 1]*fcb + 32) >> 6, _signed); + uint16_t gg = bc6hUnquantizeFinal( (epG[subsetIndex]*fca + epG[subsetIndex + 1]*fcb + 32) >> 6, _signed); + uint16_t bb = bc6hUnquantizeFinal( (epB[subsetIndex]*fca + epB[subsetIndex + 1]*fcb + 32) >> 6, _signed); + + uint16_t* rgba = &_dst[idx*3]; + rgba[0] = rr; + rgba[1] = gg; + rgba[2] = bb; + } + } + } + + void decodeBlockBc6h(float _dst[16*4], const uint8_t _src[16]) + { + uint16_t tmp[16*3]; + + decodeBlockBc6h(tmp, _src, true); + + for (uint32_t ii = 0; ii < 16; ++ii) + { + _dst[ii*4+0] = bx::halfToFloat(tmp[ii*3+0]); + _dst[ii*4+1] = bx::halfToFloat(tmp[ii*3+1]); + _dst[ii*4+2] = bx::halfToFloat(tmp[ii*3+2]); + _dst[ii*4+3] = 1.0f; + } + } + + struct Bc7ModeInfo + { + uint8_t numSubsets; + uint8_t partitionBits; + uint8_t rotationBits; + uint8_t indexSelectionBits; + uint8_t colorBits; + uint8_t alphaBits; + uint8_t endpointPBits; + uint8_t sharedPBits; + uint8_t indexBits[2]; + }; + + static const Bc7ModeInfo s_bp7ModeInfo[] = + { // +---------------------------- num subsets + // | +------------------------- partition bits + // | | +---------------------- rotation bits + // | | | +------------------- index selection bits + // | | | | +---------------- color bits + // | | | | | +------------- alpha bits + // | | | | | | +---------- endpoint P-bits + // | | | | | | | +------- shared P-bits + // | | | | | | | | +-- 2x index bits + { 3, 4, 0, 0, 4, 0, 1, 0, { 3, 0 } }, // 0 + { 2, 6, 0, 0, 6, 0, 0, 1, { 3, 0 } }, // 1 + { 3, 6, 0, 0, 5, 0, 0, 0, { 2, 0 } }, // 2 + { 2, 6, 0, 0, 7, 0, 1, 0, { 2, 0 } }, // 3 + { 1, 0, 2, 1, 5, 6, 0, 0, { 2, 3 } }, // 4 + { 1, 0, 2, 0, 7, 8, 0, 0, { 2, 2 } }, // 5 + { 1, 0, 0, 0, 7, 7, 1, 0, { 4, 0 } }, // 6 + { 2, 6, 0, 0, 5, 5, 1, 0, { 2, 0 } }, // 7 + }; + + void decodeBlockBc7(uint8_t _dst[16*4], const uint8_t _src[16]) + { + BitReader bit(_src); + + uint8_t mode = 0; + for (; mode < 8 && 0 == bit.read(1); ++mode) + { + } + + if (mode == 8) + { + bx::memSet(_dst, 0, 16*4); + return; + } + + const Bc7ModeInfo& mi = s_bp7ModeInfo[mode]; + const uint8_t modePBits = 0 != mi.endpointPBits + ? mi.endpointPBits + : mi.sharedPBits + ; + + const uint8_t partitionSetIdx = uint8_t(bit.read(mi.partitionBits) ); + const uint8_t rotationMode = uint8_t(bit.read(mi.rotationBits) ); + const uint8_t indexSelectionMode = uint8_t(bit.read(mi.indexSelectionBits) ); + + uint8_t epR[6]; + uint8_t epG[6]; + uint8_t epB[6]; + uint8_t epA[6]; + + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + epR[ii*2+0] = uint8_t(bit.read(mi.colorBits) << modePBits); + epR[ii*2+1] = uint8_t(bit.read(mi.colorBits) << modePBits); + } + + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + epG[ii*2+0] = uint8_t(bit.read(mi.colorBits) << modePBits); + epG[ii*2+1] = uint8_t(bit.read(mi.colorBits) << modePBits); + } + + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + epB[ii*2+0] = uint8_t(bit.read(mi.colorBits) << modePBits); + epB[ii*2+1] = uint8_t(bit.read(mi.colorBits) << modePBits); + } + + if (mi.alphaBits) + { + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + epA[ii*2+0] = uint8_t(bit.read(mi.alphaBits) << modePBits); + epA[ii*2+1] = uint8_t(bit.read(mi.alphaBits) << modePBits); + } + } + else + { + bx::memSet(epA, 0xff, 6); + } + + if (0 != modePBits) + { + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + const uint8_t pda = uint8_t( bit.read(modePBits) ); + const uint8_t pdb = uint8_t(0 == mi.sharedPBits ? bit.read(modePBits) : pda); + + epR[ii*2+0] |= pda; + epR[ii*2+1] |= pdb; + epG[ii*2+0] |= pda; + epG[ii*2+1] |= pdb; + epB[ii*2+0] |= pda; + epB[ii*2+1] |= pdb; + epA[ii*2+0] |= pda; + epA[ii*2+1] |= pdb; + } + } + + const uint8_t colorBits = mi.colorBits + modePBits; + + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + epR[ii*2+0] = bitRangeConvert(epR[ii*2+0], colorBits, 8); + epR[ii*2+1] = bitRangeConvert(epR[ii*2+1], colorBits, 8); + epG[ii*2+0] = bitRangeConvert(epG[ii*2+0], colorBits, 8); + epG[ii*2+1] = bitRangeConvert(epG[ii*2+1], colorBits, 8); + epB[ii*2+0] = bitRangeConvert(epB[ii*2+0], colorBits, 8); + epB[ii*2+1] = bitRangeConvert(epB[ii*2+1], colorBits, 8); + } + + if (mi.alphaBits) + { + const uint8_t alphaBits = mi.alphaBits + modePBits; + + for (uint8_t ii = 0; ii < mi.numSubsets; ++ii) + { + epA[ii*2+0] = bitRangeConvert(epA[ii*2+0], alphaBits, 8); + epA[ii*2+1] = bitRangeConvert(epA[ii*2+1], alphaBits, 8); + } + } + + const bool hasIndexBits1 = 0 != mi.indexBits[1]; + + const uint8_t* factors[] = + { + s_bptcFactors[mi.indexBits[0]-2], + hasIndexBits1 ? s_bptcFactors[mi.indexBits[1]-2] : factors[0], + }; + + uint16_t offset[2] = + { + 0, + uint16_t(mi.numSubsets*(16*mi.indexBits[0]-1) ), + }; + + for (uint8_t yy = 0; yy < 4; ++yy) + { + for (uint8_t xx = 0; xx < 4; ++xx) + { + const uint8_t idx = yy*4+xx; + + uint8_t subsetIndex = 0; + uint8_t indexAnchor = 0; + switch (mi.numSubsets) + { + case 2: + subsetIndex = (s_bptcP2[partitionSetIdx] >> idx) & 1; + indexAnchor = 0 != subsetIndex ? s_bptcA2[partitionSetIdx] : 0; + break; + + case 3: + subsetIndex = (s_bptcP3[partitionSetIdx] >> (2*idx) ) & 3; + indexAnchor = 0 != subsetIndex ? s_bptcA3[subsetIndex-1][partitionSetIdx] : 0; + break; + + default: + break; + } + + const uint8_t anchor = idx == indexAnchor; + const uint8_t num[2] = + { + uint8_t( mi.indexBits[0] - anchor ), + uint8_t(hasIndexBits1 ? mi.indexBits[1] - anchor : 0), + }; + + const uint8_t index[2] = + { + (uint8_t)bit.peek(offset[0], num[0]), + hasIndexBits1 ? (uint8_t)bit.peek(offset[1], num[1]) : index[0], + }; + + offset[0] += num[0]; + offset[1] += num[1]; + + const uint8_t fc = factors[ indexSelectionMode][index[ indexSelectionMode] ]; + const uint8_t fa = factors[!indexSelectionMode][index[!indexSelectionMode] ]; + + const uint8_t fca = 64 - fc; + const uint8_t fcb = fc; + const uint8_t faa = 64 - fa; + const uint8_t fab = fa; + + subsetIndex *= 2; + uint8_t rr = uint8_t(uint16_t(epR[subsetIndex]*fca + epR[subsetIndex + 1]*fcb + 32) >> 6); + uint8_t gg = uint8_t(uint16_t(epG[subsetIndex]*fca + epG[subsetIndex + 1]*fcb + 32) >> 6); + uint8_t bb = uint8_t(uint16_t(epB[subsetIndex]*fca + epB[subsetIndex + 1]*fcb + 32) >> 6); + uint8_t aa = uint8_t(uint16_t(epA[subsetIndex]*faa + epA[subsetIndex + 1]*fab + 32) >> 6); + + switch (rotationMode) + { + case 1: bx::swap(aa, rr); break; + case 2: bx::swap(aa, gg); break; + case 3: bx::swap(aa, bb); break; + default: break; + }; + + uint8_t* bgra = &_dst[idx*4]; + bgra[0] = bb; + bgra[1] = gg; + bgra[2] = rr; + bgra[3] = aa; + } + } + } + + // ATC + // + void decodeBlockATC(uint8_t _dst[16*4], const uint8_t _src[8]) + { + uint8_t colors[4*4]; + + uint32_t c0 = _src[0] | (_src[1] << 8); + uint32_t c1 = _src[2] | (_src[3] << 8); + + if (0 == (c0 & 0x8000) ) + { + colors[ 0] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8); + colors[ 1] = bitRangeConvert( (c0>> 5)&0x1f, 5, 8); + colors[ 2] = bitRangeConvert( (c0>>10)&0x1f, 5, 8); + + colors[12] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8); + colors[13] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8); + colors[14] = bitRangeConvert( (c1>>11)&0x1f, 5, 8); + + colors[ 4] = (2 * colors[0] + colors[12]) / 3; + colors[ 5] = (2 * colors[1] + colors[13]) / 3; + colors[ 6] = (2 * colors[2] + colors[14]) / 3; + + colors[ 8] = (colors[0] + 2 * colors[12]) / 3; + colors[ 9] = (colors[1] + 2 * colors[13]) / 3; + colors[10] = (colors[2] + 2 * colors[14]) / 3; + } + else + { + colors[ 0] = 0; + colors[ 1] = 0; + colors[ 2] = 0; + + colors[ 8] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8); + colors[ 9] = bitRangeConvert( (c0>> 5)&0x1f, 5, 8); + colors[10] = bitRangeConvert( (c0>>10)&0x1f, 5, 8); + + colors[12] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8); + colors[13] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8); + colors[14] = bitRangeConvert( (c1>>11)&0x1f, 5, 8); + + colors[ 4] = colors[ 8] - colors[12] / 4; + colors[ 5] = colors[ 9] - colors[13] / 4; + colors[ 6] = colors[10] - colors[14] / 4; + } + + for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2) + { + int32_t idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 4; + _dst[ii+0] = colors[idx+0]; + _dst[ii+1] = colors[idx+1]; + _dst[ii+2] = colors[idx+2]; + _dst[ii+3] = colors[idx+3]; + } + } + + static const int32_t s_etc1Mod[8][4] = + { + { 2, 8, -2, -8 }, + { 5, 17, -5, -17 }, + { 9, 29, -9, -29 }, + { 13, 42, -13, -42 }, + { 18, 60, -18, -60 }, + { 24, 80, -24, -80 }, + { 33, 106, -33, -106 }, + { 47, 183, -47, -183 }, + }; + + static const uint8_t s_etc2Mod[] = { 3, 6, 11, 16, 23, 32, 41, 64 }; uint8_t uint8_sat(int32_t _a) { @@ -1770,18 +3144,18 @@ namespace bimg const uint16_t minBlockX = blockInfo.minBlockX; const uint16_t minBlockY = blockInfo.minBlockY; - _width = bx::uint16_max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); - _height = bx::uint16_max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); - _depth = bx::uint16_max(1, _depth); - _numLayers = bx::uint16_max(1, _numLayers); + _width = bx::max(blockWidth * minBlockX, ( (_width + blockWidth - 1) / blockWidth)*blockWidth); + _height = bx::max(blockHeight * minBlockY, ( (_height + blockHeight - 1) / blockHeight)*blockHeight); + _depth = bx::max(1, _depth); + _numLayers = bx::max(1, _numLayers); const uint8_t numMips = _hasMips ? imageGetNumMips(_format, _width, _height, _depth) : 1; uint32_t size = imageGetSize(NULL, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, _format); - ImageContainer* imageContainer = (ImageContainer*)BX_ALLOC(_allocator, size + sizeof(ImageContainer) ); + ImageContainer* imageContainer = (ImageContainer*)BX_ALIGNED_ALLOC(_allocator, size + BX_ALIGN_16(sizeof(ImageContainer) ), 16); imageContainer->m_allocator = _allocator; - imageContainer->m_data = imageContainer + 1; + imageContainer->m_data = bx::alignPtr(imageContainer + 1, 0, 16); imageContainer->m_format = _format; imageContainer->m_orientation = Orientation::R0; imageContainer->m_size = size; @@ -1807,7 +3181,7 @@ namespace bimg void imageFree(ImageContainer* _imageContainer) { - BX_FREE(_imageContainer->m_allocator, _imageContainer); + BX_ALIGNED_FREE(_imageContainer->m_allocator, _imageContainer, 16); } // DDS @@ -1825,6 +3199,22 @@ namespace bimg #define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U') #define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0') +#define DDS_ETC1 BX_MAKEFOURCC('E', 'T', 'C', '1') +#define DDS_ETC2 BX_MAKEFOURCC('E', 'T', 'C', '2') +#define DDS_ET2A BX_MAKEFOURCC('E', 'T', '2', 'A') +#define DDS_PTC2 BX_MAKEFOURCC('P', 'T', 'C', '2') +#define DDS_PTC4 BX_MAKEFOURCC('P', 'T', 'C', '4') +#define DDS_ATC BX_MAKEFOURCC('A', 'T', 'C', ' ') +#define DDS_ATCE BX_MAKEFOURCC('A', 'T', 'C', 'E') +#define DDS_ATCI BX_MAKEFOURCC('A', 'T', 'C', 'I') +#define DDS_ASTC4x4 BX_MAKEFOURCC('A', 'S', '4', '4') +#define DDS_ASTC5x5 BX_MAKEFOURCC('A', 'S', '5', '5') +#define DDS_ASTC6x6 BX_MAKEFOURCC('A', 'S', '6', '6') +#define DDS_ASTC8x5 BX_MAKEFOURCC('A', 'S', '8', '5') +#define DDS_ASTC8x6 BX_MAKEFOURCC('A', 'S', '8', '6') +#define DDS_ASTC10x5 BX_MAKEFOURCC('A', 'S', ':', '5') + +#define DDS_R8G8B8 20 #define DDS_A8R8G8B8 21 #define DDS_R5G6B5 23 #define DDS_A1R5G5B5 25 @@ -1931,35 +3321,52 @@ namespace bimg static const TranslateDdsFormat s_translateDdsFourccFormat[] = { - { DDS_DXT1, TextureFormat::BC1, false }, - { DDS_DXT2, TextureFormat::BC2, false }, - { DDS_DXT3, TextureFormat::BC2, false }, - { DDS_DXT4, TextureFormat::BC3, false }, - { DDS_DXT5, TextureFormat::BC3, false }, - { DDS_ATI1, TextureFormat::BC4, false }, - { DDS_BC4U, TextureFormat::BC4, false }, - { DDS_ATI2, TextureFormat::BC5, false }, - { DDS_BC5U, TextureFormat::BC5, false }, - { DDS_A16B16G16R16, TextureFormat::RGBA16, false }, - { DDS_A16B16G16R16F, TextureFormat::RGBA16F, false }, - { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8, false }, - { DDPF_INDEXED, TextureFormat::R8, false }, - { DDPF_LUMINANCE, TextureFormat::R8, false }, - { DDPF_ALPHA, TextureFormat::R8, false }, - { DDS_R16F, TextureFormat::R16F, false }, - { DDS_R32F, TextureFormat::R32F, false }, - { DDS_A8L8, TextureFormat::RG8, false }, - { DDS_G16R16, TextureFormat::RG16, false }, - { DDS_G16R16F, TextureFormat::RG16F, false }, - { DDS_G32R32F, TextureFormat::RG32F, false }, - { DDS_A8R8G8B8, TextureFormat::BGRA8, false }, - { DDS_A16B16G16R16, TextureFormat::RGBA16, false }, - { DDS_A16B16G16R16F, TextureFormat::RGBA16F, false }, - { DDS_A32B32G32R32F, TextureFormat::RGBA32F, false }, - { DDS_R5G6B5, TextureFormat::R5G6B5, false }, - { DDS_A4R4G4B4, TextureFormat::RGBA4, false }, - { DDS_A1R5G5B5, TextureFormat::RGB5A1, false }, - { DDS_A2B10G10R10, TextureFormat::RGB10A2, false }, + { DDS_DXT1, TextureFormat::BC1, false }, + { DDS_DXT2, TextureFormat::BC2, false }, + { DDS_DXT3, TextureFormat::BC2, false }, + { DDS_DXT4, TextureFormat::BC3, false }, + { DDS_DXT5, TextureFormat::BC3, false }, + { DDS_ATI1, TextureFormat::BC4, false }, + { DDS_BC4U, TextureFormat::BC4, false }, + { DDS_ATI2, TextureFormat::BC5, false }, + { DDS_BC5U, TextureFormat::BC5, false }, + + { DDS_ETC1, TextureFormat::ETC1, false }, + { DDS_ETC2, TextureFormat::ETC2, false }, + { DDS_ET2A, TextureFormat::ETC2A, false }, + { DDS_PTC2, TextureFormat::PTC12A, false }, + { DDS_PTC4, TextureFormat::PTC14A, false }, + { DDS_ATC , TextureFormat::ATC, false }, + { DDS_ATCE, TextureFormat::ATCE, false }, + { DDS_ATCI, TextureFormat::ATCI, false }, + { DDS_ASTC4x4, TextureFormat::ASTC4x4, false }, + { DDS_ASTC5x5, TextureFormat::ASTC5x5, false }, + { DDS_ASTC6x6, TextureFormat::ASTC6x6, false }, + { DDS_ASTC8x5, TextureFormat::ASTC8x5, false }, + { DDS_ASTC8x6, TextureFormat::ASTC8x6, false }, + { DDS_ASTC10x5, TextureFormat::ASTC10x5, false }, + + { DDS_A16B16G16R16, TextureFormat::RGBA16, false }, + { DDS_A16B16G16R16F, TextureFormat::RGBA16F, false }, + { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8, false }, + { DDPF_INDEXED, TextureFormat::R8, false }, + { DDPF_LUMINANCE, TextureFormat::R8, false }, + { DDPF_ALPHA, TextureFormat::R8, false }, + { DDS_R16F, TextureFormat::R16F, false }, + { DDS_R32F, TextureFormat::R32F, false }, + { DDS_A8L8, TextureFormat::RG8, false }, + { DDS_G16R16, TextureFormat::RG16, false }, + { DDS_G16R16F, TextureFormat::RG16F, false }, + { DDS_G32R32F, TextureFormat::RG32F, false }, + { DDS_R8G8B8, TextureFormat::RGB8, false }, + { DDS_A8R8G8B8, TextureFormat::BGRA8, false }, + { DDS_A16B16G16R16, TextureFormat::RGBA16, false }, + { DDS_A16B16G16R16F, TextureFormat::RGBA16F, false }, + { DDS_A32B32G32R32F, TextureFormat::RGBA32F, false }, + { DDS_R5G6B5, TextureFormat::R5G6B5, false }, + { DDS_A4R4G4B4, TextureFormat::RGBA4, false }, + { DDS_A1R5G5B5, TextureFormat::RGB5A1, false }, + { DDS_A2B10G10R10, TextureFormat::RGB10A2, false }, }; static const TranslateDdsFormat s_translateDxgiFormat[] = @@ -2019,6 +3426,7 @@ namespace bimg { 16, DDPF_RGB, { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 }, TextureFormat::R5G6B5 }, { 16, DDPF_RGB, { 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 }, TextureFormat::RGB5A1 }, { 24, DDPF_RGB, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, TextureFormat::RGB8 }, + { 24, DDPF_RGB, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 }, TextureFormat::RGB8 }, { 32, DDPF_RGB, { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, TextureFormat::BGRA8 }, { 32, DDPF_RGB|DDPF_ALPHAPIXELS, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, TextureFormat::RGBA8 }, { 32, DDPF_BUMPDUDV, { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, TextureFormat::RGBA8S }, @@ -2104,8 +3512,8 @@ namespace bimg } uint32_t dxgiFormat = 0; - uint32_t arraySize = 1; - if (DDPF_FOURCC == pixelFlags + uint32_t arraySize = 1; + if (DDPF_FOURCC == (pixelFlags & DDPF_FOURCC) && DDS_DX10 == fourcc) { total += bx::read(_reader, dxgiFormat, _err); @@ -2261,6 +3669,21 @@ namespace bimg #define KTX_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 #define KTX_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 #define KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define KTX_ATC_RGB_AMD 0x8C92 +#define KTX_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define KTX_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#define KTX_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define KTX_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define KTX_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define KTX_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define KTX_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define KTX_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 #define KTX_A8 0x803C #define KTX_R8 0x8229 @@ -2370,6 +3793,15 @@ namespace bimg { KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, KTX_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT, KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, KTX_ZERO, }, // PTC14A { KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG, KTX_ZERO, KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG, KTX_ZERO, }, // PTC22 { KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG, KTX_ZERO, KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG, KTX_ZERO, }, // PTC24 + { KTX_ATC_RGB_AMD, KTX_ZERO, KTX_ATC_RGB_AMD, KTX_ZERO, }, // ATC + { KTX_ATC_RGBA_EXPLICIT_ALPHA_AMD, KTX_ZERO, KTX_ATC_RGBA_EXPLICIT_ALPHA_AMD, KTX_ZERO, }, // ATCE + { KTX_ATC_RGBA_INTERPOLATED_ALPHA_AMD, KTX_ZERO, KTX_ATC_RGBA_INTERPOLATED_ALPHA_AMD, KTX_ZERO, }, // ATCI + { KTX_COMPRESSED_RGBA_ASTC_4x4_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, KTX_COMPRESSED_RGBA_ASTC_4x4_KHR, KTX_ZERO, }, // ASTC4x4 + { KTX_COMPRESSED_RGBA_ASTC_5x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, KTX_COMPRESSED_RGBA_ASTC_5x5_KHR, KTX_ZERO, }, // ASTC5x5 + { KTX_COMPRESSED_RGBA_ASTC_6x6_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, KTX_COMPRESSED_RGBA_ASTC_6x6_KHR, KTX_ZERO, }, // ASTC6x6 + { KTX_COMPRESSED_RGBA_ASTC_8x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, KTX_COMPRESSED_RGBA_ASTC_8x5_KHR, KTX_ZERO, }, // ASTC8x5 + { KTX_COMPRESSED_RGBA_ASTC_8x6_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, KTX_COMPRESSED_RGBA_ASTC_8x6_KHR, KTX_ZERO, }, // ASTC8x6 + { KTX_COMPRESSED_RGBA_ASTC_10x5_KHR, KTX_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, KTX_COMPRESSED_RGBA_ASTC_10x5_KHR, KTX_ZERO, }, // ASTC10x5 { KTX_ZERO, KTX_ZERO, KTX_ZERO, KTX_ZERO, }, // Unknown { KTX_ZERO, KTX_ZERO, KTX_ZERO, KTX_ZERO, }, // R1 { KTX_ALPHA, KTX_ZERO, KTX_ALPHA, KTX_UNSIGNED_BYTE, }, // A8 @@ -2528,8 +3960,8 @@ namespace bimg _imageContainer.m_depth = depth; _imageContainer.m_format = format; _imageContainer.m_orientation = Orientation::R0; - _imageContainer.m_numLayers = uint16_t(bx::uint32_max(numberOfArrayElements, 1) ); - _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) ); + _imageContainer.m_numLayers = uint16_t(bx::max(numberOfArrayElements, 1) ); + _imageContainer.m_numMips = uint8_t(bx::max(numMips, 1) ); _imageContainer.m_hasAlpha = hasAlpha; _imageContainer.m_cubeMap = numFaces > 1; _imageContainer.m_ktx = true; @@ -2694,7 +4126,7 @@ namespace bimg _imageContainer.m_format = format; _imageContainer.m_orientation = Orientation::R0; _imageContainer.m_numLayers = 1; - _imageContainer.m_numMips = uint8_t(bx::uint32_max(numMips, 1) ); + _imageContainer.m_numMips = uint8_t(bx::max(numMips, 1) ); _imageContainer.m_hasAlpha = hasAlpha; _imageContainer.m_cubeMap = numFaces > 1; _imageContainer.m_ktx = false; @@ -2728,6 +4160,10 @@ namespace bimg { return imageParsePvr3(_imageContainer, _reader, _err); } + else if (BIMG_CHUNK_MAGIC_GNF == magic) + { + return imageParseGnf(_imageContainer, _reader, _err); + } else if (BIMG_CHUNK_MAGIC_TEX == magic) { TextureCreate tc; @@ -2789,18 +4225,18 @@ namespace bimg { uint32_t size = imageGetSize(NULL, uint16_t(_width), uint16_t(_height), 0, false, false, 1, TextureFormat::RGBA8); void* temp = BX_ALLOC(_allocator, size); - imageDecodeToRgba8(temp, _src, _width, _height, _width*4, _srcFormat); - imageConvert(dst, TextureFormat::R8, temp, TextureFormat::RGBA8, _width, _height, 1, _width*4); + imageDecodeToRgba8(_allocator, temp, _src, _width, _height, _width*4, _srcFormat); + imageConvert(_allocator, dst, TextureFormat::R8, temp, TextureFormat::RGBA8, _width, _height, 1, _width*4); BX_FREE(_allocator, temp); } else { - imageConvert(dst, TextureFormat::R8, src, _srcFormat, _width, _height, 1, srcPitch); + imageConvert(_allocator, dst, TextureFormat::R8, src, _srcFormat, _width, _height, 1, srcPitch); } } } - void imageDecodeToBgra8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) + void imageDecodeToBgra8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) { const uint8_t* src = (const uint8_t*)_src; uint8_t* dst = (uint8_t*)_dst; @@ -2898,7 +4334,7 @@ namespace bimg { float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; - float nz = bx::fsqrt(1.0f - nx*nx - ny*ny); + float nz = bx::sqrt(1.0f - nx*nx - ny*ny); temp[ii*4+0] = uint8_t( (nz + 1.0f)*255.0f/2.0f); temp[ii*4+3] = 0; } @@ -2912,6 +4348,40 @@ namespace bimg } break; + case TextureFormat::BC6H: + { + ImageContainer* rgba32f = imageAlloc(_allocator + , TextureFormat::RGBA32F + , uint16_t(_width) + , uint16_t(_height) + , uint16_t(1) + , 1 + , false + , false + ); + imageDecodeToRgba32f(_allocator, rgba32f->m_data, _src, _width, _height, 1, _width*16, _srcFormat); + imageConvert(_allocator, _dst, TextureFormat::BGRA8, rgba32f->m_data, TextureFormat::RGBA32F, _width, _height, 1, _width*16); + imageFree(rgba32f); + } + break; + + case TextureFormat::BC7: + for (uint32_t yy = 0; yy < height; ++yy) + { + for (uint32_t xx = 0; xx < width; ++xx) + { + decodeBlockBc7(temp, src); + src += 16; + + uint8_t* block = &dst[yy*_dstPitch*4 + xx*16]; + bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16); + bx::memCopy(&block[1*_dstPitch], &temp[16], 16); + bx::memCopy(&block[2*_dstPitch], &temp[32], 16); + bx::memCopy(&block[3*_dstPitch], &temp[48], 16); + } + } + break; + case TextureFormat::ETC1: case TextureFormat::ETC2: for (uint32_t yy = 0; yy < height; ++yy) @@ -2992,6 +4462,87 @@ namespace bimg imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff) ); break; + case TextureFormat::ATC: + for (uint32_t yy = 0; yy < height; ++yy) + { + for (uint32_t xx = 0; xx < width; ++xx) + { + decodeBlockATC(temp, src); + src += 8; + + uint8_t* block = &dst[(yy*_dstPitch+xx*4)*4]; + bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16); + bx::memCopy(&block[1*_dstPitch], &temp[16], 16); + bx::memCopy(&block[2*_dstPitch], &temp[32], 16); + bx::memCopy(&block[3*_dstPitch], &temp[48], 16); + } + } + break; + + case TextureFormat::ATCE: + for (uint32_t yy = 0; yy < height; ++yy) + { + for (uint32_t xx = 0; xx < width; ++xx) + { + decodeBlockDxt23A(temp+3, src); + src += 8; + decodeBlockATC(temp, src); + src += 8; + + uint8_t* block = &dst[(yy*_dstPitch+xx*4)*4]; + bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16); + bx::memCopy(&block[1*_dstPitch], &temp[16], 16); + bx::memCopy(&block[2*_dstPitch], &temp[32], 16); + bx::memCopy(&block[3*_dstPitch], &temp[48], 16); + } + } + break; + + case TextureFormat::ATCI: + for (uint32_t yy = 0; yy < height; ++yy) + { + for (uint32_t xx = 0; xx < width; ++xx) + { + decodeBlockDxt45A(temp+3, src); + src += 8; + decodeBlockATC(temp, src); + src += 8; + + uint8_t* block = &dst[(yy*_dstPitch+xx*4)*4]; + bx::memCopy(&block[0*_dstPitch], &temp[ 0], 16); + bx::memCopy(&block[1*_dstPitch], &temp[16], 16); + bx::memCopy(&block[2*_dstPitch], &temp[32], 16); + bx::memCopy(&block[3*_dstPitch], &temp[48], 16); + } + } + break; + + case TextureFormat::ASTC4x4: + case TextureFormat::ASTC5x5: + case TextureFormat::ASTC6x6: + case TextureFormat::ASTC8x5: + case TextureFormat::ASTC8x6: + case TextureFormat::ASTC10x5: +#if BIMG_CONFIG_ASTC_DECODE + astc_decompress + ( + (const uint8_t*) _src, + s_imageBlockInfo[_srcFormat].blockWidth, + s_imageBlockInfo[_srcFormat].blockHeight, + ASTC_DECODE_LDR_LINEAR, + + _width, + _height, + (uint8_t*) _dst, + ASTC_BGRA, + _dstPitch + ); +#else + BX_WARN(false, "ASTC decoder is not implemented."); + imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00) ); +#endif + break; + case TextureFormat::RGBA8: { const uint32_t srcPitch = _width * 4; @@ -3011,7 +4562,7 @@ namespace bimg { const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel; const uint32_t srcPitch = _width * srcBpp / 8; - if (!imageConvert(_dst, TextureFormat::BGRA8, _src, _srcFormat, _width, _height, 1, srcPitch) ) + if (!imageConvert(_allocator, _dst, TextureFormat::BGRA8, _src, _srcFormat, _width, _height, 1, srcPitch) ) { // Failed to convert, just make ugly red-yellow checkerboard texture. imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00) ); @@ -3021,7 +4572,7 @@ namespace bimg } } - void imageDecodeToRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) + void imageDecodeToRgba8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _dstPitch, TextureFormat::Enum _srcFormat) { switch (_srcFormat) { @@ -3043,7 +4594,7 @@ namespace bimg default: { const uint32_t srcPitch = _width * 4; - imageDecodeToBgra8(_dst, _src, _width, _height, _dstPitch, _srcFormat); + imageDecodeToBgra8(_allocator, _dst, _src, _width, _height, _dstPitch, _srcFormat); imageSwizzleBgra8(_dst, _dstPitch, _width, _height, _dst, srcPitch); } break; @@ -3069,10 +4620,10 @@ namespace bimg const uint8_t* rgba = src; for (uint32_t xx = 0; xx < dstWidth; ++xx, rgba += 4, dst += 4) { - dst[0] = bx::fpow(rgba[0], 2.2f); - dst[1] = bx::fpow(rgba[1], 2.2f); - dst[2] = bx::fpow(rgba[2], 2.2f); - dst[3] = rgba[3]; + dst[0] = bx::toLinear(rgba[0]); + dst[1] = bx::toLinear(rgba[1]); + dst[2] = bx::toLinear(rgba[2]); + dst[3] = rgba[3]; } } } @@ -3092,7 +4643,7 @@ namespace bimg const uint8_t* src = (const uint8_t*)_src; using namespace bx; - const simd128_t unpack = simd_ld(1.0f, 1.0f/256.0f, 1.0f/65536.0f, 1.0f/16777216.0f); + const simd128_t unpack = simd_ld(1.0f/256.0f, 1.0f/256.0f/256.0f, 1.0f/65536.0f/256.0f, 1.0f/16777216.0f/256.0f); const simd128_t umask = simd_ild(0xff, 0xff00, 0xff0000, 0xff000000); const simd128_t wflip = simd_ild(0, 0, 0, 0x80000000); const simd128_t wadd = simd_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f); @@ -3148,7 +4699,7 @@ namespace bimg { float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f; float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f; - float nz = bx::fsqrt(1.0f - nx*nx - ny*ny); + float nz = bx::sqrt(1.0f - nx*nx - ny*ny); const uint32_t offset = (yy*4 + ii/4)*_width*16 + (xx*4 + ii%4)*16; float* block = (float*)&dst[offset]; @@ -3162,6 +4713,31 @@ namespace bimg } break; + case TextureFormat::BC6H: + { + uint32_t width = _width/4; + uint32_t height = _height/4; + + const uint8_t* srcData = src; + + for (uint32_t yy = 0; yy < height; ++yy) + { + for (uint32_t xx = 0; xx < width; ++xx) + { + float tmp[16*4]; + decodeBlockBc6h(tmp, srcData); + srcData += 16; + + uint8_t* block = (uint8_t*)&dst[yy*_dstPitch*4 + xx*64]; + bx::memCopy(&block[0*_dstPitch], &tmp[ 0], 64); + bx::memCopy(&block[1*_dstPitch], &tmp[16], 64); + bx::memCopy(&block[2*_dstPitch], &tmp[32], 64); + bx::memCopy(&block[3*_dstPitch], &tmp[48], 64); + } + } + } + break; + case TextureFormat::RGBA32F: bx::memCopy(dst, src, _dstPitch*_height); break; @@ -3171,13 +4747,13 @@ namespace bimg { uint32_t size = imageGetSize(NULL, uint16_t(_width), uint16_t(_height), 0, false, false, 1, TextureFormat::RGBA8); void* temp = BX_ALLOC(_allocator, size); - imageDecodeToRgba8(temp, src, _width, _height, _width*4, _srcFormat); + imageDecodeToRgba8(_allocator, temp, src, _width, _height, _width*4, _srcFormat); imageRgba8ToRgba32f(dst, _width, _height, _width*4, temp); BX_FREE(_allocator, temp); } else { - imageConvert(dst, TextureFormat::RGBA32F, src, _srcFormat, _width, _height, 1, srcPitch); + imageConvert(_allocator, dst, TextureFormat::RGBA32F, src, _srcFormat, _width, _height, 1, srcPitch); } break; } @@ -3221,11 +4797,15 @@ namespace bimg for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod) { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); + width = bx::max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); + height = bx::max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); + depth = bx::max(1, depth); - const uint32_t mipSize = width*height*depth*bpp/8; + const uint32_t mipSize = width/blockWidth * height/blockHeight * depth * blockSize; + if (mipSize != width*height*depth*bpp/8) + { + BX_TRACE("x"); + } const uint32_t size = mipSize*numSides; uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE); @@ -3236,6 +4816,8 @@ namespace bimg for (uint16_t side = 0; side < numSides; ++side) { + BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size); + if (side == _side && lod == _lod) { @@ -3253,7 +4835,6 @@ namespace bimg offset += mipSize; - BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size); BX_UNUSED(_size); } @@ -3272,11 +4853,13 @@ namespace bimg for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod) { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); + BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size); - uint32_t size = width*height*depth*bpp/8; + width = bx::max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); + height = bx::max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); + depth = bx::max(1, depth); + + uint32_t mipSize = width/blockWidth * height/blockHeight * depth * blockSize; if (side == _side && lod == _lod) @@ -3285,7 +4868,7 @@ namespace bimg _mip.m_height = height; _mip.m_depth = depth; _mip.m_blockSize = blockSize; - _mip.m_size = size; + _mip.m_size = mipSize; _mip.m_data = &data[offset]; _mip.m_bpp = bpp; _mip.m_format = format; @@ -3293,9 +4876,8 @@ namespace bimg return true; } - offset += size; + offset += mipSize; - BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size); BX_UNUSED(_size); width >>= 1; @@ -3385,10 +4967,25 @@ namespace bimg bx::WriterI* m_writer; }; - int32_t imageWritePng(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip, bx::Error* _err) + int32_t imageWritePng(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, TextureFormat::Enum _format, bool _yflip, bx::Error* _err) { BX_ERROR_SCOPE(_err); + switch (_format) + { + case TextureFormat::R8: + case TextureFormat::RGBA8: + case TextureFormat::BGRA8: + break; + + default: + BX_ERROR_SET(_err, BIMG_ERROR, "PNG: Unsupported texture format."); + return 0; + } + + const bool grayscale = TextureFormat::R8 == _format; + const bool bgra = TextureFormat::BGRA8 == _format; + int32_t total = 0; total += bx::write(_writer, "\x89PNG\r\n\x1a\n", _err); total += bx::write(_writer, bx::toBigEndian(13), _err); @@ -3401,7 +4998,7 @@ namespace bimg total += bx::writeRep(&writerC, 0, 3, _err); total += bx::write(_writer, bx::toBigEndian(writerC.end() ), _err); - const uint32_t bpp = _grayscale ? 8 : 32; + const uint32_t bpp = grayscale ? 8 : 32; const uint32_t stride = _width*bpp/8; const uint16_t zlen = bx::toLittleEndian(uint16_t(stride + 1) ); const uint16_t zlenC = bx::toLittleEndian(~zlen); @@ -3430,25 +5027,25 @@ namespace bimg total += bx::write(&writerA, uint8_t(0), _err); - if (_grayscale) - { - total += bx::write(&writerA, data, stride, _err); - } - else + if (bgra) { for (uint32_t xx = 0; xx < _width; ++xx) { - const uint8_t* bgra = &data[xx*4]; - const uint8_t bb = bgra[0]; - const uint8_t gg = bgra[1]; - const uint8_t rr = bgra[2]; - const uint8_t aa = bgra[3]; + const uint8_t* texel = &data[xx*4]; + const uint8_t bb = texel[0]; + const uint8_t gg = texel[1]; + const uint8_t rr = texel[2]; + const uint8_t aa = texel[3]; total += bx::write(&writerA, rr, _err); total += bx::write(&writerA, gg, _err); total += bx::write(&writerA, bb, _err); total += bx::write(&writerA, aa, _err); } } + else + { + total += bx::write(&writerA, data, stride, _err); + } data += step; } @@ -3463,12 +5060,191 @@ namespace bimg return total; } + int32_t imageWriteExr(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, TextureFormat::Enum _format, bool _yflip, bx::Error* _err) + { + BX_ERROR_SCOPE(_err); + + const uint32_t bpp = getBitsPerPixel(_format); + uint32_t bytesPerChannel = 0; + + switch (_format) + { + case TextureFormat::RGBA16F: + bytesPerChannel = 2; + break; + + default: + BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Unsupported texture format."); + return 0; + } + + int32_t total = 0; + total += bx::write(_writer, "v/1\x01", _err); + total += bx::writeLE(_writer, uint32_t(2), _err); + + total += bx::write(_writer, "channels", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "chlist", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(18*4+1), _err); + + const uint8_t cdata[] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 }; + // Order is always ABGR order because Photoshop and GIMP ignore these fields and + // assume it's in ABGR order. + total += bx::write(_writer, 'A', _err); + total += bx::write(_writer, cdata, BX_COUNTOF(cdata), _err); + total += bx::write(_writer, 'B', _err); + total += bx::write(_writer, cdata, BX_COUNTOF(cdata), _err); + total += bx::write(_writer, 'G', _err); + total += bx::write(_writer, cdata, BX_COUNTOF(cdata), _err); + total += bx::write(_writer, 'R', _err); + total += bx::write(_writer, cdata, BX_COUNTOF(cdata), _err); + total += bx::write(_writer, '\0', _err); + + total += bx::write(_writer, "compression", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "compression", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(1), _err); + total += bx::write(_writer, '\0', _err); // no compression + + total += bx::write(_writer, "dataWindow", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "box2i", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(16), _err); + total += bx::writeRep(_writer, '\0', 8, _err); + total += bx::writeLE(_writer, _width-1, _err); + total += bx::writeLE(_writer, _height-1, _err); + + total += bx::write(_writer, "displayWindow", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "box2i", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(16), _err); + total += bx::writeRep(_writer, '\0', 8, _err); + total += bx::writeLE(_writer, _width-1, _err); + total += bx::writeLE(_writer, _height-1, _err); + + total += bx::write(_writer, "lineOrder", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "lineOrder", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(1), _err); + total += bx::write(_writer, _yflip, _err); + + total += bx::write(_writer, "pixelAspectRatio", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "float", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(4), _err); + total += bx::writeLE(_writer, 1.0f, _err); + + total += bx::write(_writer, "screenWindowCenter", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "v2f", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(8), _err); + total += bx::writeRep(_writer, '\0', 8, _err); + + total += bx::write(_writer, "screenWindowWidth", _err); + total += bx::write(_writer, '\0', _err); + total += bx::write(_writer, "float", _err); + total += bx::write(_writer, '\0', _err); + total += bx::writeLE(_writer, uint32_t(4), _err); + total += bx::writeLE(_writer, 1.0f, _err); + + total += bx::write(_writer, '\0', _err); + + const uint32_t exrStride = _width*bpp/8; + + uint64_t offset = 0; + for (uint32_t yy = 0; yy < _height && _err->isOk(); ++yy) + { + total += bx::writeLE(_writer, (offset), _err); + offset += exrStride + 8 /* offset */; + } + + const uint8_t* data = (const uint8_t*)_src; + for (uint32_t yy = 0; yy < _height && _err->isOk(); ++yy) + { + total += bx::writeLE(_writer, yy, _err); + total += bx::writeLE(_writer, exrStride, _err); + + for (uint32_t xx = 0; xx < _width && _err->isOk(); ++xx) + { + total += bx::write(_writer, &data[xx*bpp/8+3*bytesPerChannel], bytesPerChannel, _err); + } + + for (uint32_t xx = 0; xx < _width && _err->isOk(); ++xx) + { + total += bx::write(_writer, &data[xx*bpp/8+2*bytesPerChannel], bytesPerChannel, _err); + } + + for (uint32_t xx = 0; xx < _width && _err->isOk(); ++xx) + { + total += bx::write(_writer, &data[xx*bpp/8+1*bytesPerChannel], bytesPerChannel, _err); + } + + for (uint32_t xx = 0; xx < _width && _err->isOk(); ++xx) + { + total += bx::write(_writer, &data[xx*bpp/8+0*bytesPerChannel], bytesPerChannel, _err); + } + + data += _srcPitch; + } + + return total; + } + + int32_t imageWriteHdr(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, TextureFormat::Enum _format, bool _yflip, bx::Error* _err) + { + BX_ERROR_SCOPE(_err); + + int32_t total = 0; + total += bx::write(_writer, "#?RADIANCE\n" , _err); + total += bx::write(_writer, "FORMAT=32-bit_rle_rgbe\n" , _err); + total += bx::write(_writer, '\n' , _err); + + total += bx::write(_writer, _err, "%cY %d +X %d\n", _yflip ? '+' : '-', _height, _width); + + UnpackFn unpack = getUnpack(_format); + const uint32_t bpp = getBitsPerPixel(_format); + + const uint8_t* data = (const uint8_t*)_src; + for (uint32_t yy = 0; yy < _height && _err->isOk(); ++yy) + { + for (uint32_t xx = 0; xx < _width && _err->isOk(); ++xx) + { + float rgba[4]; + unpack(rgba, &data[xx*bpp/8]); + + const float maxVal = bx::max(rgba[0], rgba[1], rgba[2]); + const float exp = bx::ceil(bx::log2(maxVal) ); + const float toRgb8 = 255.0f * 1.0f/bx::ldexp(1.0f, int(exp) ); + + uint8_t rgbe[4]; + rgbe[0] = uint8_t(rgba[0] * toRgb8); + rgbe[1] = uint8_t(rgba[1] * toRgb8); + rgbe[2] = uint8_t(rgba[2] * toRgb8); + rgbe[3] = uint8_t(exp+128.0f); + + total += bx::write(_writer, rgbe, 4, _err); + } + + data += _srcPitch; + } + + return total; + } + static int32_t imageWriteDdsHeader(bx::WriterI* _writer, TextureFormat::Enum _format, bool _cubeMap, uint32_t _width, uint32_t _height, uint32_t _depth, uint8_t _numMips, bx::Error* _err) { BX_ERROR_SCOPE(_err); - uint32_t ddspf = UINT32_MAX; - uint32_t dxgiFormat = UINT32_MAX; + uint32_t ddspf = UINT32_MAX; + uint32_t dxgiFormat = UINT32_MAX; + uint32_t fourccFormat = UINT32_MAX; for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsPixelFormat); ++ii) { @@ -3489,14 +5265,26 @@ namespace bimg break; } } - - if (UINT32_MAX == dxgiFormat) - { - BX_ERROR_SET(_err, BIMG_ERROR, "DDS: DXGI format not supported."); - return 0; - } } + if (UINT32_MAX == ddspf && UINT32_MAX == dxgiFormat) + { + for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFourccFormat); ++ii) + { + if (s_translateDdsFourccFormat[ii].m_textureFormat == _format) + { + fourccFormat = s_translateDdsFourccFormat[ii].m_format; + break; + } + } + } + + if (UINT32_MAX == ddspf && UINT32_MAX == dxgiFormat && UINT32_MAX == fourccFormat) + { + BX_ERROR_SET(_err, BIMG_ERROR, "DDS: output format not supported."); + return 0; + } + const uint32_t bpp = getBitsPerPixel(_format); uint32_t total = 0; @@ -3542,9 +5330,14 @@ namespace bimg { total += bx::write(_writer, uint32_t(8*sizeof(uint32_t) ), _err); // pixelFormatSize total += bx::write(_writer, uint32_t(DDPF_FOURCC), _err); - total += bx::write(_writer, uint32_t(DDS_DX10), _err); - total += bx::write(_writer, uint32_t(0), _err); // bitCount - total += bx::writeRep(_writer, 0, 4*sizeof(uint32_t), _err); // bitmask + + if (UINT32_MAX != fourccFormat) + total += bx::write(_writer, fourccFormat, _err); + else + total += bx::write(_writer, uint32_t(DDS_DX10), _err); + + total += bx::write(_writer, uint32_t(0), _err); // bitCount + total += bx::writeRep(_writer, 0, 4*sizeof(uint32_t), _err); // bitmask } uint32_t caps[4] = @@ -3657,15 +5450,15 @@ namespace bimg } const ImageBlockInfo& blockInfo = s_imageBlockInfo[_format]; - const uint8_t bpp = blockInfo.bitsPerPixel; const uint32_t blockWidth = blockInfo.blockWidth; const uint32_t blockHeight = blockInfo.blockHeight; const uint32_t minBlockX = blockInfo.minBlockX; const uint32_t minBlockY = blockInfo.minBlockY; + const uint8_t blockSize = blockInfo.blockSize; const uint8_t* src = (const uint8_t*)_src; - const uint32_t numLayers = bx::uint32_max(_numLayers, 1); + const uint32_t numLayers = bx::max(_numLayers, 1); const uint32_t numSides = _cubeMap ? 6 : 1; uint32_t width = _width; @@ -3674,12 +5467,12 @@ namespace bimg for (uint8_t lod = 0; lod < _numMips && _err->isOk(); ++lod) { - width = bx::uint32_max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); - height = bx::uint32_max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); - depth = bx::uint32_max(1, depth); + width = bx::max(blockWidth * minBlockX, ( (width + blockWidth - 1) / blockWidth )*blockWidth); + height = bx::max(blockHeight * minBlockY, ( (height + blockHeight - 1) / blockHeight)*blockHeight); + depth = bx::max(1, depth); - const uint32_t mipSize = width*height*depth*bpp/8; - const uint32_t size = mipSize*numLayers*numSides; + const uint32_t mipSize = width/blockWidth * height/blockHeight * depth * blockSize; + const uint32_t size = mipSize * numLayers * numSides; total += bx::write(_writer, size, _err); for (uint32_t layer = 0; layer < numLayers && _err->isOk(); ++layer) @@ -3721,7 +5514,7 @@ namespace bimg } const uint32_t numMips = _imageContainer.m_numMips; - const uint32_t numLayers = bx::uint32_max(_imageContainer.m_numLayers, 1); + const uint32_t numLayers = bx::max(_imageContainer.m_numLayers, 1); const uint32_t numSides = _imageContainer.m_cubeMap ? 6 : 1; for (uint8_t lod = 0; lod < numMips && _err->isOk(); ++lod) diff --git a/3rdparty/bimg/src/image_cubemap_filter.cpp b/3rdparty/bimg/src/image_cubemap_filter.cpp new file mode 100644 index 00000000000..a967926aa1c --- /dev/null +++ b/3rdparty/bimg/src/image_cubemap_filter.cpp @@ -0,0 +1,1202 @@ +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause + */ + +#include "bimg_p.h" +#include +#include + +namespace bimg +{ + /* + * Copyright 2014-2015 Dario Manesku. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + + // +----------+ + // |-z 2| + // | ^ +y | + // | | | + // | +---->+x | + // +----------+----------+----------+----------+ + // |+y 1|+y 4|+y 0|+y 5| + // | ^ -x | ^ +z | ^ +x | ^ -z | + // | | | | | | | | | + // | +---->+z | +---->+x | +---->-z | +---->-x | + // +----------+----------+----------+----------+ + // |+z 3| + // | ^ -y | + // | | | + // | +---->+x | + // +----------+ + // + struct CubeMapFace + { + enum Enum + { + PositiveX, + NegativeX, + PositiveY, + NegativeY, + PositiveZ, + NegativeZ, + + Count + }; + + struct Edge + { + enum Enum + { + Left, + Right, + Top, + Bottom, + + Count + }; + }; + + // --> U _____ + // | | | + // v | +Y | + // V _____|_____|_____ _____ + // | | | | | + // | -X | +Z | +X | -Z | + // |_____|_____|_____|_____| + // | | + // | -Y | + // |_____| + // + // Neighbour faces in order: left, right, top, bottom. + // FaceEdge is the edge that belongs to the neighbour face. + struct Neighbour + { + uint8_t m_faceIdx; + uint8_t m_faceEdge; + }; + + bx::Vec3 uv[3]; + }; + + static const CubeMapFace s_cubeMapFace[] = + { + {{ // +x face + { 0.0f, 0.0f, -1.0f }, // u -> -z + { 0.0f, -1.0f, 0.0f }, // v -> -y + { 1.0f, 0.0f, 0.0f }, // +x face + }}, + {{ // -x face + { 0.0f, 0.0f, 1.0f }, // u -> +z + { 0.0f, -1.0f, 0.0f }, // v -> -y + { -1.0f, 0.0f, 0.0f }, // -x face + }}, + {{ // +y face + { 1.0f, 0.0f, 0.0f }, // u -> +x + { 0.0f, 0.0f, 1.0f }, // v -> +z + { 0.0f, 1.0f, 0.0f }, // +y face + }}, + {{ // -y face + { 1.0f, 0.0f, 0.0f }, // u -> +x + { 0.0f, 0.0f, -1.0f }, // v -> -z + { 0.0f, -1.0f, 0.0f }, // -y face + }}, + {{ // +z face + { 1.0f, 0.0f, 0.0f }, // u -> +x + { 0.0f, -1.0f, 0.0f }, // v -> -y + { 0.0f, 0.0f, 1.0f }, // +z face + }}, + {{ // -z face + { -1.0f, 0.0f, 0.0f }, // u -> -x + { 0.0f, -1.0f, 0.0f }, // v -> -y + { 0.0f, 0.0f, -1.0f }, // -z face + }}, + }; + + static const CubeMapFace::Neighbour s_cubeMapFaceNeighbours[6][4] = + { + { // +X + { CubeMapFace::PositiveZ, CubeMapFace::Edge::Right }, + { CubeMapFace::NegativeZ, CubeMapFace::Edge::Left }, + { CubeMapFace::PositiveY, CubeMapFace::Edge::Right }, + { CubeMapFace::NegativeY, CubeMapFace::Edge::Right }, + }, + { // -X + { CubeMapFace::NegativeZ, CubeMapFace::Edge::Right }, + { CubeMapFace::PositiveZ, CubeMapFace::Edge::Left }, + { CubeMapFace::PositiveY, CubeMapFace::Edge::Left }, + { CubeMapFace::NegativeY, CubeMapFace::Edge::Left }, + }, + { // +Y + { CubeMapFace::NegativeX, CubeMapFace::Edge::Top }, + { CubeMapFace::PositiveX, CubeMapFace::Edge::Top }, + { CubeMapFace::NegativeZ, CubeMapFace::Edge::Top }, + { CubeMapFace::PositiveZ, CubeMapFace::Edge::Top }, + }, + { // -Y + { CubeMapFace::NegativeX, CubeMapFace::Edge::Bottom }, + { CubeMapFace::PositiveX, CubeMapFace::Edge::Bottom }, + { CubeMapFace::PositiveZ, CubeMapFace::Edge::Bottom }, + { CubeMapFace::NegativeZ, CubeMapFace::Edge::Bottom }, + }, + { // +Z + { CubeMapFace::NegativeX, CubeMapFace::Edge::Right }, + { CubeMapFace::PositiveX, CubeMapFace::Edge::Left }, + { CubeMapFace::PositiveY, CubeMapFace::Edge::Bottom }, + { CubeMapFace::NegativeY, CubeMapFace::Edge::Top }, + }, + { // -Z + { CubeMapFace::PositiveX, CubeMapFace::Edge::Right }, + { CubeMapFace::NegativeX, CubeMapFace::Edge::Left }, + { CubeMapFace::PositiveY, CubeMapFace::Edge::Top }, + { CubeMapFace::NegativeY, CubeMapFace::Edge::Bottom }, + }, + }; + + /// _u and _v should be center addressing and in [-1.0+invSize..1.0-invSize] range. + bx::Vec3 texelUvToDir(uint8_t _side, float _u, float _v) + { + const CubeMapFace& face = s_cubeMapFace[_side]; + + const bx::Vec3 tmp = + { + face.uv[0].x * _u + face.uv[1].x * _v + face.uv[2].x, + face.uv[0].y * _u + face.uv[1].y * _v + face.uv[2].y, + face.uv[0].z * _u + face.uv[1].z * _v + face.uv[2].z, + }; + + return bx::normalize(tmp); + } + + void dirToTexelUv(float& _outU, float& _outV, uint8_t& _outSide, const bx::Vec3& _dir) + { + const bx::Vec3 absVec = bx::abs(_dir); + const float max = bx::max(absVec.x, absVec.y, absVec.z); + + if (max == absVec.x) + { + _outSide = _dir.x >= 0.0f ? uint8_t(CubeMapFace::PositiveX) : uint8_t(CubeMapFace::NegativeX); + } + else if (max == absVec.y) + { + _outSide = _dir.y >= 0.0f ? uint8_t(CubeMapFace::PositiveY) : uint8_t(CubeMapFace::NegativeY); + } + else + { + _outSide = _dir.z >= 0.0f ? uint8_t(CubeMapFace::PositiveZ) : uint8_t(CubeMapFace::NegativeZ); + } + + const bx::Vec3 faceVec = bx::mul(_dir, 1.0f/max); + + _outU = (bx::dot(s_cubeMapFace[_outSide].uv[0], faceVec) + 1.0f) * 0.5f; + _outV = (bx::dot(s_cubeMapFace[_outSide].uv[1], faceVec) + 1.0f) * 0.5f; + } + + ImageContainer* imageCubemapFromLatLongRgba32F(bx::AllocatorI* _allocator, const ImageContainer& _input, bool _useBilinearInterpolation, bx::Error* _err) + { + BX_ERROR_SCOPE(_err); + + if (_input.m_depth != 1 + && _input.m_numLayers != 1 + && _input.m_format != TextureFormat::RGBA32F + && _input.m_width/2 != _input.m_height) + { + BX_ERROR_SET(_err, BIMG_ERROR, "Input image format is not equirectangular projection."); + return NULL; + } + + const uint32_t srcWidthMinusOne = _input.m_width-1; + const uint32_t srcHeightMinusOne = _input.m_height-1; + const uint32_t srcPitch = _input.m_width*16; + const uint32_t dstWidth = _input.m_height/2; + const uint32_t dstPitch = dstWidth*16; + const float invDstWidth = 1.0f / float(dstWidth); + + ImageContainer* output = imageAlloc(_allocator + , _input.m_format + , uint16_t(dstWidth) + , uint16_t(dstWidth) + , uint16_t(1) + , 1 + , true + , false + ); + + const uint8_t* srcData = (const uint8_t*)_input.m_data; + + for (uint8_t side = 0; side < 6 && _err->isOk(); ++side) + { + ImageMip mip; + imageGetRawData(*output, side, 0, output->m_data, output->m_size, mip); + + for (uint32_t yy = 0; yy < dstWidth; ++yy) + { + for (uint32_t xx = 0; xx < dstWidth; ++xx) + { + float* dstData = (float*)&mip.m_data[yy*dstPitch+xx*16]; + + const float uu = 2.0f*xx*invDstWidth - 1.0f; + const float vv = 2.0f*yy*invDstWidth - 1.0f; + + const bx::Vec3 dir = texelUvToDir(side, uu, vv); + + float srcU, srcV; + bx::toLatLong(&srcU, &srcV, dir); + + srcU *= srcWidthMinusOne; + srcV *= srcHeightMinusOne; + + if (_useBilinearInterpolation) + { + const uint32_t x0 = uint32_t(srcU); + const uint32_t y0 = uint32_t(srcV); + const uint32_t x1 = bx::min(x0 + 1, srcWidthMinusOne); + const uint32_t y1 = bx::min(y0 + 1, srcHeightMinusOne); + + const float* src0 = (const float*)&srcData[y0*srcPitch + x0*16]; + const float* src1 = (const float*)&srcData[y0*srcPitch + x1*16]; + const float* src2 = (const float*)&srcData[y1*srcPitch + x0*16]; + const float* src3 = (const float*)&srcData[y1*srcPitch + x1*16]; + + const float tx = srcU - float(int32_t(x0) ); + const float ty = srcV - float(int32_t(y0) ); + const float omtx = 1.0f - tx; + const float omty = 1.0f - ty; + + float p0[4]; + bx::vec4Mul(p0, src0, omtx*omty); + + float p1[4]; + bx::vec4Mul(p1, src1, tx*omty); + + float p2[4]; + bx::vec4Mul(p2, src2, omtx*ty); + + float p3[4]; + bx::vec4Mul(p3, src3, tx*ty); + + const float rr = p0[0] + p1[0] + p2[0] + p3[0]; + const float gg = p0[1] + p1[1] + p2[1] + p3[1]; + const float bb = p0[2] + p1[2] + p2[2] + p3[2]; + const float aa = p0[3] + p1[3] + p2[3] + p3[3]; + + dstData[0] = rr; + dstData[1] = gg; + dstData[2] = bb; + dstData[3] = aa; + } + else + { + const uint32_t x0 = uint32_t(srcU); + const uint32_t y0 = uint32_t(srcV); + const float* src0 = (const float*)&srcData[y0*srcPitch + x0*16]; + + dstData[0] = src0[0]; + dstData[1] = src0[1]; + dstData[2] = src0[2]; + dstData[3] = src0[3]; + } + + } + } + } + + return output; + } + + ImageContainer* imageCubemapFromStripRgba32F(bx::AllocatorI* _allocator, const ImageContainer& _input, bx::Error* _err) + { + BX_ERROR_SCOPE(_err); + + if (_input.m_depth != 1 + && _input.m_numLayers != 1 + && _input.m_format != TextureFormat::RGBA32F + && _input.m_width/6 != _input.m_height) + { + BX_ERROR_SET(_err, BIMG_ERROR, "Input image format is not strip projection."); + return NULL; + } + + const uint32_t srcPitch = _input.m_width*16; + const uint32_t dstWidth = _input.m_height; + const uint32_t dstPitch = dstWidth*16; + + ImageContainer* output = imageAlloc(_allocator + , _input.m_format + , uint16_t(dstWidth) + , uint16_t(dstWidth) + , uint16_t(1) + , 1 + , true + , false + ); + + const uint8_t* srcData = (const uint8_t*)_input.m_data; + + for (uint8_t side = 0; side < 6 && _err->isOk(); ++side, srcData += dstPitch) + { + ImageMip dstMip; + imageGetRawData(*output, side, 0, output->m_data, output->m_size, dstMip); + + bx::memCopy(const_cast(dstMip.m_data), srcData, dstPitch, dstWidth, srcPitch, dstPitch); + } + + return output; + } + + inline float areaElement(float _x, float _y) + { + return bx::atan2(_x*_y, bx::sqrt(_x*_x + _y*_y + 1.0f)); + } + + float texelSolidAngle(float _u, float _v, float _invFaceSize) + { + // Reference(s): + // - https://web.archive.org/web/20180614195754/http://www.mpia.de/~mathar/public/mathar20051002.pdf + // - https://web.archive.org/web/20180614195725/http://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/ + // + const float x0 = _u - _invFaceSize; + const float x1 = _u + _invFaceSize; + const float y0 = _v - _invFaceSize; + const float y1 = _v + _invFaceSize; + + return + + areaElement(x1, y1) + - areaElement(x0, y1) + - areaElement(x1, y0) + + areaElement(x0, y0) + ; + } + + ImageContainer* imageCubemapNormalSolidAngle(bx::AllocatorI* _allocator, uint32_t _size) + { + const uint32_t dstWidth = _size; + const uint32_t dstPitch = dstWidth*16; + const float texelSize = 1.0f / float(dstWidth); + + ImageContainer* output = imageAlloc(_allocator, TextureFormat::RGBA32F, uint16_t(dstWidth), uint16_t(dstWidth), 1, 1, true, false); + + for (uint8_t side = 0; side < 6; ++side) + { + ImageMip mip; + imageGetRawData(*output, side, 0, output->m_data, output->m_size, mip); + + for (uint32_t yy = 0; yy < dstWidth; ++yy) + { + for (uint32_t xx = 0; xx < dstWidth; ++xx) + { + float* dstData = (float*)&mip.m_data[yy*dstPitch+xx*16]; + + const float uu = float(xx)*texelSize*2.0f - 1.0f; + const float vv = float(yy)*texelSize*2.0f - 1.0f; + + bx::store(dstData, texelUvToDir(side, uu, vv) ); + dstData[3] = texelSolidAngle(uu, vv, texelSize); + } + } + } + + return output; + } + + struct Aabb + { + Aabb() + { + m_min[0] = bx::kFloatMax; + m_min[1] = bx::kFloatMax; + m_max[0] = -bx::kFloatMax; + m_max[1] = -bx::kFloatMax; + } + + void add(float _x, float _y) + { + m_min[0] = bx::min(m_min[0], _x); + m_min[1] = bx::min(m_min[1], _y); + m_max[0] = bx::max(m_max[0], _x); + m_max[1] = bx::max(m_max[1], _y); + } + + void clamp(float _min, float _max) + { + m_min[0] = bx::clamp(m_min[0], _min, _max); + m_min[1] = bx::clamp(m_min[1], _min, _max); + m_max[0] = bx::clamp(m_max[0], _min, _max); + m_max[1] = bx::clamp(m_max[1], _min, _max); + } + + bool isEmpty() const + { + // Has to have at least two points added so that no value is equal to initial state. + return ( (m_min[0] == bx::kFloatMax) + || (m_min[1] == bx::kFloatMax) + || (m_max[0] == -bx::kFloatMax) + || (m_max[1] == -bx::kFloatMax) + ); + } + + float m_min[2]; + float m_max[2]; + }; + + void calcFilterArea(Aabb* _outFilterArea, const bx::Vec3& _dir, float _filterSize) + { + /// ______ + /// | | + /// | | + /// | x | + /// |______| + /// + // Get face and hit coordinates. + float uu, vv; + uint8_t hitFaceIdx; + dirToTexelUv(uu, vv, hitFaceIdx, _dir); + + /// ........ + /// . . + /// . ___. + /// . | x | + /// ...|___| + /// + // Calculate hit face filter bounds. + Aabb hitFaceFilterBounds; + hitFaceFilterBounds.add(uu-_filterSize, vv-_filterSize); + hitFaceFilterBounds.add(uu+_filterSize, vv+_filterSize); + hitFaceFilterBounds.clamp(0.0f, 1.0f); + + // Output result for hit face. + bx::memCopy(&_outFilterArea[hitFaceIdx], &hitFaceFilterBounds, sizeof(Aabb)); + + /// Filter area might extend on neighbour faces. + /// Case when extending over the right edge: + /// + /// --> U + /// | ...... + /// v . . + /// V . . + /// . . + /// ....... ...... ....... + /// . . . . + /// . . .....__min . + /// . . . . | -> amount + /// ....... .....x.__|.... + /// . . . max + /// . ........ + /// . . + /// ...... + /// . . + /// . . + /// . . + /// ...... + /// + + struct NeighourFaceBleed + { + float m_amount; + float m_bbMin; + float m_bbMax; + }; + + const NeighourFaceBleed bleed[CubeMapFace::Edge::Count] = + { + { // Left + _filterSize - uu, + hitFaceFilterBounds.m_min[1], + hitFaceFilterBounds.m_max[1], + }, + { // Right + uu + _filterSize - 1.0f, + hitFaceFilterBounds.m_min[1], + hitFaceFilterBounds.m_max[1], + }, + { // Top + _filterSize - vv, + hitFaceFilterBounds.m_min[0], + hitFaceFilterBounds.m_max[0], + }, + { // Bottom + vv + _filterSize - 1.0f, + hitFaceFilterBounds.m_min[0], + hitFaceFilterBounds.m_max[0], + }, + }; + + // Determine bleeding for each side. + for (uint8_t side = 0; side < 4; ++side) + { + uint8_t currentFaceIdx = hitFaceIdx; + + for (float bleedAmount = bleed[side].m_amount; bleedAmount > 0.0f; bleedAmount -= 1.0f) + { + uint8_t neighbourFaceIdx = s_cubeMapFaceNeighbours[currentFaceIdx][side].m_faceIdx; + uint8_t neighbourFaceEdge = s_cubeMapFaceNeighbours[currentFaceIdx][side].m_faceEdge; + currentFaceIdx = neighbourFaceIdx; + + /// https://code.google.com/p/cubemapgen/source/browse/trunk/CCubeMapProcessor.cpp#773 + /// + /// Handle situations when bbMin and bbMax should be flipped. + /// + /// L - Left ....................T-T + /// R - Right v . + /// T - Top __________ . + /// B - Bottom . | . + /// . | . + /// . |<...R-T . + /// . | v v + /// .......... ..........|__________ __________ + /// . . . . . + /// . . . . . + /// . . . . . + /// . . . . . + /// __________ .......... .......... __________ + /// ^ | . ^ + /// . | . . + /// B-L..>| . . + /// | . . + /// |__________. . + /// ^ . + /// ....................B-B + /// + /// Those are: + /// B-L, B-B + /// T-R, T-T + /// (and in reverse order, R-T and L-B) + /// + /// If we add, R-R and L-L (which never occur), we get: + /// B-L, B-B + /// T-R, T-T + /// R-T, R-R + /// L-B, L-L + /// + /// And if L = 0, R = 1, T = 2, B = 3 as in NeighbourSides enumeration, + /// a general rule can be derived for when to flip bbMin and bbMax: + /// if ((a+b) == 3 || (a == b)) + /// { + /// ..flip bbMin and bbMax + /// } + /// + float bbMin = bleed[side].m_bbMin; + float bbMax = bleed[side].m_bbMax; + if ( (side == neighbourFaceEdge) + || (3 == (side + neighbourFaceEdge) ) ) + { + // Flip. + bbMin = 1.0f - bbMin; + bbMax = 1.0f - bbMax; + } + + switch (neighbourFaceEdge) + { + case CubeMapFace::Edge::Left: + { + /// --> U + /// | ............. + /// v . . + /// V x___ . + /// | | . + /// | | . + /// |___x . + /// . . + /// ............. + /// + _outFilterArea[neighbourFaceIdx].add(0.0f, bbMin); + _outFilterArea[neighbourFaceIdx].add(bleedAmount, bbMax); + } + break; + + case CubeMapFace::Edge::Right: + { + /// --> U + /// | ............. + /// v . . + /// V . x___. + /// . | | + /// . | | + /// . |___x + /// . . + /// ............. + /// + _outFilterArea[neighbourFaceIdx].add(1.0f - bleedAmount, bbMin); + _outFilterArea[neighbourFaceIdx].add(1.0f, bbMax); + } + break; + + case CubeMapFace::Edge::Top: + { + /// --> U + /// | ...x____ ... + /// v . | | . + /// V . |____x . + /// . . + /// . . + /// . . + /// ............ + /// + _outFilterArea[neighbourFaceIdx].add(bbMin, 0.0f); + _outFilterArea[neighbourFaceIdx].add(bbMax, bleedAmount); + } + break; + + case CubeMapFace::Edge::Bottom: + { + /// --> U + /// | ............ + /// v . . + /// V . . + /// . . + /// . x____ . + /// . | | . + /// ...|____x... + /// + _outFilterArea[neighbourFaceIdx].add(bbMin, 1.0f - bleedAmount); + _outFilterArea[neighbourFaceIdx].add(bbMax, 1.0f); + } + break; + } + + // Clamp bounding box to face size. + _outFilterArea[neighbourFaceIdx].clamp(0.0f, 1.0f); + } + } + } + + struct Sampler + { + Sampler(const ImageContainer& _image, uint16_t _side, float _lod, float (*func)(float) ) + { + const float lod = bx::clamp(_lod, 0.0f, float(_image.m_numMips - 1) ); + imageGetRawData( + _image + , _side + , uint8_t(func(lod) ) + , _image.m_data + , _image.m_size + , mip + ); + } + + ImageMip mip; + }; + + void texelFetch(float* _rgba, const Sampler& _sampler, uint32_t _u, uint32_t _v) + { + const uint32_t bpp = _sampler.mip.m_bpp; + const uint32_t pitch = _sampler.mip.m_width*bpp/8; + const uint8_t* texel = _sampler.mip.m_data + _v*pitch + _u*bpp/8; + + UnpackFn unpack = getUnpack(_sampler.mip.m_format); + unpack(_rgba, texel); + } + + void sampleCubeMap(float* _rgba, const ImageContainer& _image, const bx::Vec3& _dir, float _lod) + { + float uu, vv; + uint8_t side; + dirToTexelUv(uu, vv, side, _dir); + + const float fu = bx::fract(uu); + const float fv = bx::fract(vv); + const float fl = bx::fract(_lod); + + float rgbaA[4]; + { + Sampler sampler(_image, side, _lod, bx::floor); + const uint32_t widthMinusOne = sampler.mip.m_width-1; + + const uint32_t u0 = uint32_t(uu*widthMinusOne+0.5f); + const uint32_t v0 = uint32_t(vv*widthMinusOne+0.5f); + const uint32_t u1 = bx::min(u0 + 1, widthMinusOne); + const uint32_t v1 = bx::min(v0 + 1, widthMinusOne); + + float rgba00[4]; + texelFetch(rgba00, sampler, u0, v0); + + float rgba01[4]; + texelFetch(rgba01, sampler, u0, v1); + + float rgba10[4]; + texelFetch(rgba10, sampler, u1, v0); + + float rgba11[4]; + texelFetch(rgba11, sampler, u1, v1); + + rgbaA[0] = bx::lerp(bx::lerp(rgba00[0], rgba01[0], fv), bx::lerp(rgba10[0], rgba11[0], fv), fu); + rgbaA[1] = bx::lerp(bx::lerp(rgba00[1], rgba01[1], fv), bx::lerp(rgba10[1], rgba11[1], fv), fu); + rgbaA[2] = bx::lerp(bx::lerp(rgba00[2], rgba01[2], fv), bx::lerp(rgba10[2], rgba11[2], fv), fu); + rgbaA[3] = bx::lerp(bx::lerp(rgba00[3], rgba01[3], fv), bx::lerp(rgba10[3], rgba11[3], fv), fu); + } + + float rgbaB[4]; + { + Sampler sampler(_image, side, _lod, bx::ceil); + const uint32_t widthMinusOne = sampler.mip.m_width-1; + + const uint32_t u0 = uint32_t(uu*widthMinusOne+0.5f); + const uint32_t v0 = uint32_t(vv*widthMinusOne+0.5f); + const uint32_t u1 = bx::min(u0 + 1, widthMinusOne); + const uint32_t v1 = bx::min(v0 + 1, widthMinusOne); + + float rgba00[4]; + texelFetch(rgba00, sampler, u0, v0); + + float rgba01[4]; + texelFetch(rgba01, sampler, u0, v1); + + float rgba10[4]; + texelFetch(rgba10, sampler, u1, v0); + + float rgba11[4]; + texelFetch(rgba11, sampler, u1, v1); + + rgbaB[0] = bx::lerp(bx::lerp(rgba00[0], rgba01[0], fv), bx::lerp(rgba10[0], rgba11[0], fv), fu); + rgbaB[1] = bx::lerp(bx::lerp(rgba00[1], rgba01[1], fv), bx::lerp(rgba10[1], rgba11[1], fv), fu); + rgbaB[2] = bx::lerp(bx::lerp(rgba00[2], rgba01[2], fv), bx::lerp(rgba10[2], rgba11[2], fv), fu); + rgbaB[3] = bx::lerp(bx::lerp(rgba00[3], rgba01[3], fv), bx::lerp(rgba10[3], rgba11[3], fv), fu); + } + + _rgba[0] = bx::lerp(rgbaA[0], rgbaB[0], fl); + _rgba[1] = bx::lerp(rgbaA[1], rgbaB[1], fl); + _rgba[2] = bx::lerp(rgbaA[2], rgbaB[2], fl); + _rgba[3] = bx::lerp(rgbaA[3], rgbaB[3], fl); + } + + bx::Vec3 importanceSampleGgx(float _u, float _v, float _roughness, const bx::Vec3& _normal, const bx::Vec3& _tangentX, const bx::Vec3& _tangentY) + { + const float aa = bx::square(_roughness); + const float phi = bx::kPi2 * _u; + const float cosTheta = bx::sqrt( (1.0f - _v) / (1.0f + (bx::square(aa) - 1.0f) * _v) ); + const float sinTheta = bx::sqrt(bx::abs(1.0f - bx::square(cosTheta) ) ); + + const float hh[3] = + { + sinTheta * bx::cos(phi), + sinTheta * bx::sin(phi), + cosTheta, + }; + + return + { + _tangentX.x * hh[0] + _tangentY.x * hh[1] + _normal.x * hh[2], + _tangentX.y * hh[0] + _tangentY.y * hh[1] + _normal.y * hh[2], + _tangentX.z * hh[0] + _tangentY.z * hh[1] + _normal.z * hh[2], + }; + } + + float normalDistributionGgx(float _ndoth, float _roughness) + { + const float alpha = bx::square(_roughness); + const float alphaSq = bx::square(alpha); + const float denom = bx::square(_ndoth) * (alphaSq - 1.0f) + 1.0f; + const float denomSq = bx::square(denom); + return alphaSq/(bx::kPi * denomSq); + } + + void processFilterAreaGgx( + float* _result + , const ImageContainer& _image + , uint8_t _lod + , const bx::Vec3& _dir + , float _roughness + ) + { + ImageMip mip; + imageGetRawData(_image, 0, _lod, _image.m_data, _image.m_size, mip); + + const uint32_t bpp = getBitsPerPixel(_image.m_format); + + constexpr int32_t kNumSamples = 512; + const uint32_t pitch = mip.m_width*bpp/8; + const float widthMinusOne = float(mip.m_width-1); + const float mipBias = 0.5f*bx::log2(bx::square(float(_image.m_width) )/float(kNumSamples) ); + + UnpackFn unpack = getUnpack(_image.m_format); + + float color[3] = { 0.0f, 0.0f, 0.0f }; + float totalWeight = 0.0f; + + // Golden Ratio Sequences for Low-Discrepancy Sampling + // https://web.archive.org/web/20180717194847/https://www.graphics.rwth-aachen.de/publication/2/jgt.pdf + // + // kGoldenSection = (0.5f*bx::sqrt(5.0f) + 0.5f) - 1.0f = 0.61803398875f + // + const float kGoldenSection = 0.61803398875f; + float offset = kGoldenSection; + + bx::Vec3 tangentX; + bx::Vec3 tangentY; + bx::calcTangentFrame(tangentX, tangentY, _dir); + + for (uint32_t ii = 0; ii < kNumSamples; ++ii) + { + offset += kGoldenSection; + const float vv = ii/float(kNumSamples); + + const bx::Vec3 hh = importanceSampleGgx(offset, vv, _roughness, _dir, tangentX, tangentY); + const float ddoth2 = 2.0f * bx::dot(_dir, hh); + const bx::Vec3 ll = bx::sub(bx::mul(hh, ddoth2), _dir); + + const float ndotl = bx::clamp(bx::dot(_dir, ll), 0.0f, 1.0f); + + if (ndotl > 0.0f) + { + const float ndoth = bx::clamp(bx::dot(_dir, hh), 0.0f, 1.0f); + const float vdoth = ndoth; + + // Chapter 20. GPU-Based Importance Sampling + // http://archive.today/2018.07.14-004914/https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch20.html + // + const float pdf = normalDistributionGgx(ndoth, _roughness) * ndoth / (4.0f * vdoth); + const float lod = bx::max(0.0f, mipBias - 0.5f*bx::log2(pdf)); + + float rgba[4]; + sampleCubeMap(rgba, _image, ll, lod); + + // Optimized Reversible Tonemapper for Resolve + // https://web.archive.org/web/20180717182019/https://gpuopen.com/optimized-reversible-tonemapper-for-resolve/ + // "a single sample with a large HDR value can over-power all other samples" + // "instead accept a bias in the resolve and reduce the weighting of samples + // as a function of how bright they are" + // Include ndotl here to "fold the weighting into the tonemap operation" + // + const float tm = ndotl / (bx::max(rgba[0], rgba[1], rgba[2]) + 1.0f); + + color[0] += rgba[0] * tm; + color[1] += rgba[1] * tm; + color[2] += rgba[2] * tm; + totalWeight += ndotl; + } + } + + if (0.0f < totalWeight) + { + // Optimized Reversible Tonemapper for Resovle + // https://web.archive.org/web/20180717182019/https://gpuopen.com/optimized-reversible-tonemapper-for-resolve/ + // Average, then reverse the tonemapper + // + const float invWeight = 1.0f/totalWeight; + color[0] = color[0] * invWeight; + color[1] = color[1] * invWeight; + color[2] = color[2] * invWeight; + + const float invTm = 1.0f / (1.0f - bx::max(0.00001f, bx::max(color[0], color[1], color[2]))); + _result[0] = color[0] * invTm; + _result[1] = color[1] * invTm; + _result[2] = color[2] * invTm; + } + else + { + float uu, vv; + uint8_t face; + dirToTexelUv(uu, vv, face, _dir); + + imageGetRawData(_image, face, 0, _image.m_data, _image.m_size, mip); + + const uint32_t xx = uint32_t(uu*widthMinusOne); + const uint32_t yy = uint32_t(vv*widthMinusOne); + + float rgba[4]; + unpack(rgba, mip.m_data + yy*pitch + xx*bpp/8); + + _result[0] = rgba[0]; + _result[1] = rgba[1]; + _result[2] = rgba[2]; + } + } + + void processFilterArea( + float* _result + , const ImageContainer& _image + , const ImageContainer& _nsa + , uint8_t _lod + , const Aabb* _aabb + , const bx::Vec3& _dir + , float _specularPower + , float _specularAngle + ) + { + float color[3] = { 0.0f, 0.0f, 0.0f }; + float totalWeight = 0.0f; + + const uint32_t bpp = getBitsPerPixel(_image.m_format); + + UnpackFn unpack = getUnpack(_image.m_format); + + for (uint8_t side = 0; side < 6; ++side) + { + if (_aabb[side].isEmpty() ) + { + continue; + } + + ImageMip nsaMip; + imageGetRawData(_nsa, side, 0, _nsa.m_data, _nsa.m_size, nsaMip); + + ImageMip mip; + if (imageGetRawData(_image, side, _lod, _image.m_data, _image.m_size, mip) ) + { + const uint32_t pitch = mip.m_width*bpp/8; + const float widthMinusOne = float(mip.m_width-1); + const float texelSize = 1.0f/float(mip.m_width); + BX_UNUSED(texelSize); + + const uint32_t minX = uint32_t(_aabb[side].m_min[0] * widthMinusOne); + const uint32_t maxX = uint32_t(_aabb[side].m_max[0] * widthMinusOne); + const uint32_t minY = uint32_t(_aabb[side].m_min[1] * widthMinusOne); + const uint32_t maxY = uint32_t(_aabb[side].m_max[1] * widthMinusOne); + + for (uint32_t yy = minY; yy <= maxY; ++yy) + { + const uint8_t* row = mip.m_data + yy*pitch; + BX_UNUSED(row); + + for (uint32_t xx = minX; xx <= maxX; ++xx) + { + const float* normal = (const float*)&nsaMip.m_data[(yy*nsaMip.m_width+xx)*(nsaMip.m_bpp/8)]; + const float solidAngle = normal[3]; + const float ndotl = bx::clamp(bx::dot(bx::load(normal), _dir), 0.0f, 1.0f); + + if (ndotl >= _specularAngle) + { + const float weight = solidAngle * bx::pow(ndotl, _specularPower); + float rgba[4]; + unpack(rgba, row + xx*bpp/8); + + color[0] += rgba[0] * weight; + color[1] += rgba[1] * weight; + color[2] += rgba[2] * weight; + totalWeight += weight; + } + } + } + + if (0.0f < totalWeight) + { + const float invWeight = 1.0f/totalWeight; + _result[0] = color[0] * invWeight; + _result[1] = color[1] * invWeight; + _result[2] = color[2] * invWeight; + } + else + { + float uu, vv; + uint8_t face; + dirToTexelUv(uu, vv, face, _dir); + + imageGetRawData(_image, face, 0, _image.m_data, _image.m_size, mip); + + const uint32_t xx = uint32_t(uu*widthMinusOne); + const uint32_t yy = uint32_t(vv*widthMinusOne); + + float rgba[4]; + unpack(rgba, mip.m_data + yy*pitch + xx*bpp/8); + + _result[0] = rgba[0]; + _result[1] = rgba[1]; + _result[2] = rgba[2]; + } + } + } + } + + ImageContainer* imageGenerateMips(bx::AllocatorI* _allocator, const ImageContainer& _image) + { + if (_image.m_format != TextureFormat::RGBA8 + && _image.m_format != TextureFormat::RGBA32F) + { + return NULL; + } + + ImageContainer* output = imageAlloc(_allocator, _image.m_format, uint16_t(_image.m_width), uint16_t(_image.m_height), uint16_t(_image.m_depth), _image.m_numLayers, _image.m_cubeMap, true); + + const uint32_t numMips = output->m_numMips; + const uint32_t numLayers = output->m_numLayers; + const uint32_t numSides = output->m_cubeMap ? 6 : 1; + + for (uint32_t layer = 0; layer < numLayers; ++layer) + { + for (uint8_t side = 0; side < numSides; ++side) + { + ImageMip mip; + if (imageGetRawData(_image, uint16_t(layer*numSides + side), 0, _image.m_data, _image.m_size, mip) ) + { + for (uint8_t lod = 0; lod < numMips; ++lod) + { + ImageMip srcMip; + imageGetRawData(*output, uint16_t(layer*numSides + side), lod == 0 ? 0 : lod-1, output->m_data, output->m_size, srcMip); + + ImageMip dstMip; + imageGetRawData(*output, uint16_t(layer*numSides + side), lod, output->m_data, output->m_size, dstMip); + + uint8_t* dstData = const_cast(dstMip.m_data); + + if (0 == lod) + { + bx::memCopy(dstData, mip.m_data, mip.m_size); + } + else if (output->m_format == TextureFormat::RGBA8) + { + imageRgba8Downsample2x2( + dstData + , srcMip.m_width + , srcMip.m_height + , srcMip.m_depth + , srcMip.m_width*4 + , dstMip.m_width*4 + , srcMip.m_data + ); + } + else if (output->m_format == TextureFormat::RGBA32F) + { + imageRgba32fDownsample2x2( + dstData + , srcMip.m_width + , srcMip.m_height + , srcMip.m_depth + , srcMip.m_width*16 + , srcMip.m_data + ); + } + } + } + } + } + + return output; + } + + /// Returns the angle of cosine power function where the results are above a small empirical treshold. + static float cosinePowerFilterAngle(float _cosinePower) + { + // Bigger value leads to performance improvement but might hurt the results. + // 0.00001f was tested empirically and it gives almost the same values as reference. + const float treshold = 0.00001f; + + // Cosine power filter is: pow(cos(angle), power). + // We want the value of the angle above each result is <= treshold. + // So: angle = acos(pow(treshold, 1.0 / power)) + return bx::acos(bx::pow(treshold, 1.0f / _cosinePower)); + } + + float glossinessFor(float _mip, float _mipCount) + { + return bx::max(0.0f, 1.0f - _mip/(_mipCount-1.0000001f) ); + } + + float applyLightingModel(float _specularPower, LightingModel::Enum _lightingModel) + { + // Reference(s): + // - https://web.archive.org/web/20180622232018/https://seblagarde.wordpress.com/2012/06/10/amd-cubemapgen-for-physically-based-rendering/ + // - https://web.archive.org/web/20180622232041/https://seblagarde.wordpress.com/2012/03/29/relationship-between-phong-and-blinn-lighting-model/ + // + switch (_lightingModel) + { + case LightingModel::PhongBrdf: return _specularPower + 1.0f; + case LightingModel::Blinn: return _specularPower/4.0f; + case LightingModel::BlinnBrdf: return _specularPower/4.0f + 1.0f; + default: break; + }; + + return _specularPower; + } + + ImageContainer* imageCubemapRadianceFilter(bx::AllocatorI* _allocator, const ImageContainer& _image, LightingModel::Enum _lightingModel, bx::Error* _err) + { + if (!_image.m_cubeMap) + { + BX_ERROR_SET(_err, BIMG_ERROR, "Input image is not cubemap."); + return NULL; + } + + ImageContainer* input = imageConvert(_allocator, TextureFormat::RGBA32F, _image, true); + + if (1 >= input->m_numMips) + { + ImageContainer* temp = imageGenerateMips(_allocator, *input); + imageFree(input); + input = temp; + } + + ImageContainer* output = imageAlloc(_allocator, TextureFormat::RGBA32F, uint16_t(input->m_width), uint16_t(input->m_width), 1, 1, true, true); + + for (uint8_t side = 0; side < 6; ++side) + { + ImageMip srcMip; + imageGetRawData(*input, side, 0, input->m_data, input->m_size, srcMip); + + ImageMip dstMip; + imageGetRawData(*output, side, 0, output->m_data, output->m_size, dstMip); + + uint8_t* dstData = const_cast(dstMip.m_data); + + bx::memCopy(dstData, srcMip.m_data, srcMip.m_size); + } + + const float glossScale = 10.0f; + const float glossBias = 1.0f; + + for (uint8_t lod = 1, numMips = input->m_numMips; lod < numMips; ++lod) + { + ImageContainer* nsa = NULL; + + if (LightingModel::Ggx != _lightingModel) + { + nsa = imageCubemapNormalSolidAngle(_allocator, bx::max(_image.m_width>>lod, 1) ); + } + + for (uint8_t side = 0; side < 6; ++side) + { + ImageMip mip; + imageGetRawData(*output, side, lod, output->m_data, output->m_size, mip); + + const uint32_t dstWidth = mip.m_width; + const uint32_t dstPitch = dstWidth*16; + + const float minAngle = bx::atan2(1.0f, float(dstWidth) ); + const float maxAngle = bx::kPiHalf; + const float toFilterSize = 1.0f/(minAngle*dstWidth*2.0f); + const float glossiness = glossinessFor(lod, float(numMips) ); + const float roughness = 1.0f-glossiness; + const float specularPowerRef = bx::pow(2.0f, glossiness*glossScale + glossBias); + const float specularPower = applyLightingModel(specularPowerRef, _lightingModel); + const float filterAngle = bx::clamp(cosinePowerFilterAngle(specularPower), minAngle, maxAngle); + const float cosAngle = bx::max(0.0f, bx::cos(filterAngle) ); + const float texelSize = 1.0f/float(dstWidth); + const float filterSize = bx::max(texelSize, filterAngle * toFilterSize); + + for (uint32_t yy = 0; yy < dstWidth; ++yy) + { + for (uint32_t xx = 0; xx < dstWidth; ++xx) + { + float* dstData = (float*)&mip.m_data[yy*dstPitch+xx*16]; + + const float uu = float(xx)*texelSize*2.0f - 1.0f; + const float vv = float(yy)*texelSize*2.0f - 1.0f; + + bx::Vec3 dir = texelUvToDir(side, uu, vv); + + if (LightingModel::Ggx == _lightingModel) + { + processFilterAreaGgx(dstData, *input, lod, dir, roughness); + } + else + { + Aabb aabb[6]; + calcFilterArea(aabb, dir, filterSize); + + processFilterArea(dstData, *input, *nsa, lod, aabb, dir, specularPower, cosAngle); + } + } + } + } + + if (NULL != nsa) + { + imageFree(nsa); + } + } + + return output; + } + +} // namespace bimg diff --git a/3rdparty/bimg/src/image_decode.cpp b/3rdparty/bimg/src/image_decode.cpp index 37038f33053..0ce4023e89a 100644 --- a/3rdparty/bimg/src/image_decode.cpp +++ b/3rdparty/bimg/src/image_decode.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #include "bimg_p.h" @@ -56,8 +56,9 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Warray-bounds"); #if BX_COMPILER_GCC >= 60000 BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wmisleading-indentation"); BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wshift-negative-value"); -#elif BX_COMPILER_GCC >= 70000 +# if BX_COMPILER_GCC >= 70000 BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wimplicit-fallthrough"); +# endif // BX_COMPILER_GCC >= 70000 #endif // BX_COMPILER_GCC >= 60000_ #define STBI_MALLOC(_size) lodepng_malloc(_size) #define STBI_REALLOC(_ptr, _size) lodepng_realloc(_ptr, _size) @@ -104,7 +105,9 @@ namespace bimg switch (state.info_raw.bitdepth) { case 1: - format = bimg::TextureFormat::R1; + case 2: + case 4: + format = bimg::TextureFormat::R8; palette = false; supported = true; break; @@ -203,10 +206,11 @@ namespace bimg const uint8_t* copyData = data; TextureFormat::Enum dstFormat = format; - if (1 == state.info_raw.bitdepth) + if (1 == state.info_raw.bitdepth + || 2 == state.info_raw.bitdepth + || 4 == state.info_raw.bitdepth) { - dstFormat = bimg::TextureFormat::R8; - copyData = NULL; + copyData = NULL; } else if (16 == state.info_raw.bitdepth && LCT_RGB == state.info_raw.colortype) @@ -234,16 +238,49 @@ namespace bimg { for (uint32_t ii = 0, num = width*height/8; ii < num; ++ii) { - uint8_t value = data[ii]; - uint8_t* dst = (uint8_t*)output->m_data + ii * 8; - dst[0] = value & 0x01 ? 255 : 0; - dst[1] = value & 0x02 ? 255 : 0; - dst[2] = value & 0x04 ? 255 : 0; - dst[3] = value & 0x08 ? 255 : 0; - dst[4] = value & 0x10 ? 255 : 0; - dst[5] = value & 0x20 ? 255 : 0; - dst[6] = value & 0x40 ? 255 : 0; - dst[7] = value & 0x80 ? 255 : 0; + uint8_t* src = (uint8_t*)data + ii; + uint8_t eightBits = src[0]; + + uint8_t* dst = (uint8_t*)output->m_data + ii*8; + dst[0] = uint8_t( (eightBits>>7)&0x1)*255; + dst[1] = uint8_t( (eightBits>>6)&0x1)*255; + dst[2] = uint8_t( (eightBits>>5)&0x1)*255; + dst[3] = uint8_t( (eightBits>>4)&0x1)*255; + dst[4] = uint8_t( (eightBits>>3)&0x1)*255; + dst[5] = uint8_t( (eightBits>>2)&0x1)*255; + dst[6] = uint8_t( (eightBits>>1)&0x1)*255; + dst[7] = uint8_t( (eightBits )&0x1)*255; + + } + } + else if (2 == state.info_raw.bitdepth) + { + for (uint32_t ii = 0, num = width*height/4; ii < num; ++ii) + { + uint8_t* src = (uint8_t*)data + ii; + uint8_t eightBits = src[0]; + + uint8_t* dst = (uint8_t*)output->m_data + ii*4; + // Note: not exactly precise. + // Correct way: dst[0] = uint8_t(float( (eightBits>>6)&0x3)*(255.0f/4.0f) ); + dst[0] = uint8_t(uint32_t(((eightBits>>6)&0x3)*64)&0xff); + dst[1] = uint8_t(uint32_t(((eightBits>>4)&0x3)*64)&0xff); + dst[2] = uint8_t(uint32_t(((eightBits>>2)&0x3)*64)&0xff); + dst[3] = uint8_t(uint32_t(((eightBits )&0x3)*64)&0xff); + } + } + else if (4 == state.info_raw.bitdepth) + { + for (uint32_t ii = 0, num = width*height/2; ii < num; ++ii) + { + uint8_t* src = (uint8_t*)data + ii; + uint8_t eightBits = src[0]; + + uint8_t* dst = (uint8_t*)output->m_data + ii*2; + // Note: not exactly precise. + // Correct way: dst[0] = uint8_t(float( (eightBits>>4)&0xf)*(255.0f/16.0f) ); + dst[0] = uint8_t(uint32_t(((eightBits>>4)&0xf)*16)&0xff); + dst[1] = uint8_t(uint32_t(((eightBits )&0xf)*16)&0xff); } } else if (16 == state.info_raw.bitdepth @@ -436,7 +473,22 @@ namespace bimg } else { - BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image."); + switch (result) + { + case TINYEXR_ERROR_INVALID_MAGIC_NUMBER: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid magic number."); break; + case TINYEXR_ERROR_INVALID_EXR_VERSION: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid EXR version."); break; + case TINYEXR_ERROR_INVALID_ARGUMENT: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid argument."); break; + case TINYEXR_ERROR_INVALID_DATA: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid data."); break; + case TINYEXR_ERROR_INVALID_FILE: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid file."); break; +// case TINYEXR_ERROR_INVALID_PARAMETER: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid parameter."); break; + case TINYEXR_ERROR_CANT_OPEN_FILE: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Can't open file."); break; + case TINYEXR_ERROR_UNSUPPORTED_FORMAT: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Unsupported format."); break; + case TINYEXR_ERROR_INVALID_HEADER: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Invalid header."); break; + case TINYEXR_ERROR_UNSUPPORTED_FEATURE: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Unsupported feature."); break; + case TINYEXR_ERROR_CANT_WRITE_FILE: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Can't write file."); break; + case TINYEXR_ERROR_SERIALZATION_FAILED: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image. Serialization failed."); break; + default: BX_ERROR_SET(_err, BIMG_ERROR, "EXR: Failed to parse image."); break; + } } FreeEXRHeader(&exrHeader); @@ -661,6 +713,7 @@ namespace bimg ImageContainer* input = imageParseDds (_allocator, _data, _size, _err) ; input = NULL == input ? imageParseKtx (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParsePvr3 (_allocator, _data, _size, _err) : input; + input = NULL == input ? imageParseGnf (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseLodePng (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseTinyExr (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseJpeg (_allocator, _data, _size, _err) : input; diff --git a/3rdparty/bimg/src/image_encode.cpp b/3rdparty/bimg/src/image_encode.cpp index 708c4af2f47..09586fe5105 100644 --- a/3rdparty/bimg/src/image_encode.cpp +++ b/3rdparty/bimg/src/image_encode.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #include @@ -12,6 +12,7 @@ #include #include #include +#include BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4100) // warning C4100: 'alloc_context': unreferenced formal parameter @@ -35,7 +36,15 @@ namespace bimg }; BX_STATIC_ASSERT(Quality::Count == BX_COUNTOF(s_squishQuality) ); - void imageEncodeFromRgba8(void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, Quality::Enum _quality, bx::Error* _err) + static const ASTC_COMPRESS_MODE s_astcQuality[] = + { + ASTC_COMPRESS_MEDIUM, // Default + ASTC_COMPRESS_THOROUGH, // Highest + ASTC_COMPRESS_FAST, // Fastest + }; + BX_STATIC_ASSERT(Quality::Count == BX_COUNTOF(s_astcQuality)); + + void imageEncodeFromRgba8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, Quality::Enum _quality, bx::Error* _err) { const uint8_t* src = (const uint8_t*)_src; uint8_t* dst = (uint8_t*)_dst; @@ -89,7 +98,7 @@ namespace bimg for (uint32_t ii = 0; ii < 16; ++ii) { // BGRx bx::memCopy(&block[ii*4], &ptr[(ii%4)*srcPitch + (ii&~3)], 4); - bx::xchg(block[ii*4+0], block[ii*4+2]); + bx::swap(block[ii*4+0], block[ii*4+2]); } *dstBlock++ = ProcessRGB_ETC2(block); @@ -122,6 +131,22 @@ namespace bimg } break; + case TextureFormat::ASTC4x4: + case TextureFormat::ASTC5x5: + case TextureFormat::ASTC6x6: + case TextureFormat::ASTC8x5: + case TextureFormat::ASTC8x6: + case TextureFormat::ASTC10x5: + { + const bimg::ImageBlockInfo& astcBlockInfo = bimg::getBlockInfo(_format); + + ASTC_COMPRESS_MODE compress_mode = s_astcQuality[_quality]; + ASTC_DECODE_MODE decode_mode = ASTC_DECODE_LDR_LINEAR; + + astc_compress(_width, _height, src, ASTC_RGBA, srcPitch, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, compress_mode, decode_mode, dst); + } + break; + case TextureFormat::BGRA8: imageSwizzleBgra8(dst, dstPitch, _width, _height, src, srcPitch); break; @@ -131,7 +156,7 @@ namespace bimg break; default: - if (!imageConvert(dst, _format, src, TextureFormat::RGBA8, _width, _height, 1) ) + if (!imageConvert(_allocator, dst, _format, src, TextureFormat::RGBA8, _width, _height, 1) ) { BX_ERROR_SET(_err, BIMG_ERROR, "Unable to convert between input/output formats!"); } @@ -157,10 +182,10 @@ namespace bimg break; default: - if (!imageConvert(_dst, _dstFormat, _src, TextureFormat::RGBA32F, _width, _height, _depth) ) + if (!imageConvert(_allocator, _dst, _dstFormat, _src, TextureFormat::RGBA32F, _width, _height, _depth) ) { uint8_t* temp = (uint8_t*)BX_ALLOC(_allocator, _width*_height*_depth*4); - if (imageConvert(temp, TextureFormat::RGBA8, _src, TextureFormat::RGBA32F, _width, _height, _depth) ) + if (imageConvert(_allocator, temp, TextureFormat::RGBA8, _src, TextureFormat::RGBA32F, _width, _height, _depth) ) { for (uint32_t zz = 0; zz < _depth; ++zz) { @@ -175,15 +200,15 @@ namespace bimg const uint32_t offset = yoffset + xx; const float* input = (const float*)&src[offset * 16]; uint8_t* output = &temp[offset * 4]; - output[0] = uint8_t(bx::fsaturate(input[0])*255.0f + 0.5f); - output[1] = uint8_t(bx::fsaturate(input[1])*255.0f + 0.5f); - output[2] = uint8_t(bx::fsaturate(input[2])*255.0f + 0.5f); - output[3] = uint8_t(bx::fsaturate(input[3])*255.0f + 0.5f); + output[0] = uint8_t(bx::clamp(input[0], 0.0f, 1.0f)*255.0f + 0.5f); + output[1] = uint8_t(bx::clamp(input[1], 0.0f, 1.0f)*255.0f + 0.5f); + output[2] = uint8_t(bx::clamp(input[2], 0.0f, 1.0f)*255.0f + 0.5f); + output[3] = uint8_t(bx::clamp(input[3], 0.0f, 1.0f)*255.0f + 0.5f); } } } - imageEncodeFromRgba8(_dst, temp, _width, _height, _depth, _dstFormat, _quality, _err); + imageEncodeFromRgba8(_allocator, _dst, temp, _width, _height, _depth, _dstFormat, _quality, _err); } else { @@ -200,19 +225,25 @@ namespace bimg { switch (_dstFormat) { - case bimg::TextureFormat::BC1: - case bimg::TextureFormat::BC2: - case bimg::TextureFormat::BC3: - case bimg::TextureFormat::BC4: - case bimg::TextureFormat::BC5: - case bimg::TextureFormat::ETC1: - case bimg::TextureFormat::ETC2: - case bimg::TextureFormat::PTC14: - case bimg::TextureFormat::PTC14A: + case TextureFormat::BC1: + case TextureFormat::BC2: + case TextureFormat::BC3: + case TextureFormat::BC4: + case TextureFormat::BC5: + case TextureFormat::ETC1: + case TextureFormat::ETC2: + case TextureFormat::PTC14: + case TextureFormat::PTC14A: + case TextureFormat::ASTC4x4: + case TextureFormat::ASTC5x5: + case TextureFormat::ASTC6x6: + case TextureFormat::ASTC8x5: + case TextureFormat::ASTC8x6: + case TextureFormat::ASTC10x5: { uint8_t* temp = (uint8_t*)BX_ALLOC(_allocator, _width*_height*_depth*4); - imageDecodeToRgba8(temp, _src, _width, _height, _width*4, _srcFormat); - imageEncodeFromRgba8(_dst, temp, _width, _height, _depth, _dstFormat, _quality, _err); + imageDecodeToRgba8(_allocator, temp, _src, _width, _height, _width*4, _srcFormat); + imageEncodeFromRgba8(_allocator, _dst, temp, _width, _height, _depth, _dstFormat, _quality, _err); BX_FREE(_allocator, temp); } break; @@ -228,7 +259,10 @@ namespace bimg break; default: - BX_ERROR_SET(_err, BIMG_ERROR, "Unable to convert between input/output formats!"); + if (!imageConvert(_allocator, _dst, _dstFormat, _src, _srcFormat, _width, _height, 1) ) + { + BX_ERROR_SET(_err, BIMG_ERROR, "Unable to convert between input/output formats!"); + } break; } } @@ -260,17 +294,18 @@ namespace bimg imageGetRawData(*output, side, lod, output->m_data, output->m_size, dstMip); uint8_t* dstData = const_cast(dstMip.m_data); - imageEncode(_allocator - , dstData - , mip.m_data - , mip.m_format - , mip.m_width - , mip.m_height - , mip.m_depth - , _dstFormat - , _quality - , &err - ); + imageEncode( + _allocator + , dstData + , mip.m_data + , mip.m_format + , mip.m_width + , mip.m_height + , mip.m_depth + , _dstFormat + , _quality + , &err + ); } } } @@ -333,7 +368,7 @@ namespace bimg BX_FREE(_allocator, gy); } - void imageMakeDist(bx::AllocatorI* _allocator, void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, float _edge, const void* _src) + void imageMakeDist(bx::AllocatorI* _allocator, void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src) { const uint32_t numPixels = _width*_height; @@ -364,12 +399,9 @@ namespace bimg uint8_t* dst = (uint8_t*)_dst; - double edgeOffset = _edge*0.5; - double invEdge = 1.0/_edge; - for (uint32_t ii = 0; ii < numPixels; ++ii) { - double dist = bx::clamp( ( (outside[ii] - inside[ii])+edgeOffset) * invEdge, 0.0, 1.0); + double dist = bx::clamp( (outside[ii] - inside[ii]) * 1.0/16.0 + 0.5, 0.0, 1.0); dst[ii] = 255-uint8_t(dist * 255.0); } @@ -414,27 +446,38 @@ namespace bimg { bimg::ImageMip srcMip; bimg::imageGetRawData(*_src, side, 0, _src->m_data, _src->m_size, srcMip); - const float* srcData = (const float*)(srcMip.m_data); bimg::ImageMip dstMip; bimg::imageGetRawData(*_dst, side, 0, _dst->m_data, _dst->m_size, dstMip); - float* dstData = (float*)(dstMip.m_data); + uint8_t* dstData = const_cast(dstMip.m_data); - int result = stbir_resize_float_generic( - (const float*)srcData, _src->m_width, _src->m_height, _src->m_width*16 - , ( float*)dstData, _dst->m_width, _dst->m_height, _dst->m_width*16 - , 4, 3 - , STBIR_FLAG_ALPHA_PREMULTIPLIED - , STBIR_EDGE_CLAMP - , STBIR_FILTER_DEFAULT - , STBIR_COLORSPACE_LINEAR - , NULL - ); + const uint32_t srcPitch = _src->m_width*16; + const uint32_t srcSlice = _src->m_height*srcPitch; + const uint32_t dstPitch = _dst->m_width*16; + const uint32_t dstSlice = _dst->m_height*dstPitch; - if (1 != result) + for (uint32_t zz = 0, depth = _dst->m_depth; zz < depth; ++zz, dstData += dstSlice) { - return false; + const uint32_t srcDataStep = uint32_t(bx::floor(zz * _src->m_depth / float(_dst->m_depth) ) ); + const uint8_t* srcData = &srcMip.m_data[srcDataStep*srcSlice]; + + int result = stbir_resize_float_generic( + (const float*)srcData, _src->m_width, _src->m_height, srcPitch + , ( float*)dstData, _dst->m_width, _dst->m_height, dstPitch + , 4, 3 + , STBIR_FLAG_ALPHA_PREMULTIPLIED + , STBIR_EDGE_CLAMP + , STBIR_FILTER_BOX + , STBIR_COLORSPACE_LINEAR + , NULL + ); + + if (1 != result) + { + return false; + } } + } return true; @@ -545,7 +588,7 @@ namespace bimg { float rgba[4]; unpack(rgba, data); - rgba[3] = bx::fsaturate(rgba[3]*scale); + rgba[3] = bx::clamp(rgba[3]*scale, 0.0f, 1.0f); pack(data, rgba); } } diff --git a/3rdparty/bimg/src/image_gnf.cpp b/3rdparty/bimg/src/image_gnf.cpp new file mode 100644 index 00000000000..77c6d0a6332 --- /dev/null +++ b/3rdparty/bimg/src/image_gnf.cpp @@ -0,0 +1,37 @@ +/* + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause + */ + +#include "bimg_p.h" + +namespace bimg +{ + bool imageParseGnf(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader, bx::Error* _err) + { + BX_UNUSED(_imageContainer, _reader, _err); + BX_ERROR_SET(_err, BIMG_ERROR, "GNF: not supported."); + return false; + } + + ImageContainer* imageParseGnf(bx::AllocatorI* _allocator, const void* _src, uint32_t _size, bx::Error* _err) + { + BX_UNUSED(_allocator); + + bx::MemoryReader reader(_src, _size); + + uint32_t magic; + bx::read(&reader, magic); + + ImageContainer imageContainer; + if (BIMG_CHUNK_MAGIC_GNF != magic + || !imageParseGnf(imageContainer, &reader, _err) ) + { + return NULL; + } + + BX_ERROR_SET(_err, BIMG_ERROR, "GNF: not supported."); + return NULL; + } + +} // namespace bimg diff --git a/3rdparty/bimg/tools/texturec/texturec.cpp b/3rdparty/bimg/tools/texturec/texturec.cpp index 8b6d27dfc1b..b9ea4a2291f 100644 --- a/3rdparty/bimg/tools/texturec/texturec.cpp +++ b/3rdparty/bimg/tools/texturec/texturec.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bimg#license-bsd-2-clause */ #include @@ -21,57 +21,63 @@ #include #include #include -#include #include #define BIMG_TEXTUREC_VERSION_MAJOR 1 -#define BIMG_TEXTUREC_VERSION_MINOR 10 +#define BIMG_TEXTUREC_VERSION_MINOR 18 + +BX_ERROR_RESULT(TEXTRUREC_ERROR, BX_MAKEFOURCC('t', 'c', 0, 0) ); struct Options { - Options() - : maxSize(UINT32_MAX) - , edge(0.0f) - , format(bimg::TextureFormat::Count) - , quality(bimg::Quality::Default) - , mips(false) - , normalMap(false) - , iqa(false) - , sdf(false) - , alphaTest(false) - { - } - void dump() { DBG("Options:\n" "\t maxSize: %d\n" + "\t mipSkip: %d\n" "\t edge: %f\n" "\t format: %s\n" "\t mips: %s\n" "\tnormalMap: %s\n" "\t iqa: %s\n" + "\t pma: %s\n" "\t sdf: %s\n" + "\t radiance: %s\n" + "\t equirect: %s\n" + "\t strip: %s\n" + "\t linear: %s\n" , maxSize + , mipSkip , edge , bimg::getName(format) , mips ? "true" : "false" , normalMap ? "true" : "false" , iqa ? "true" : "false" + , pma ? "true" : "false" , sdf ? "true" : "false" + , radiance ? "true" : "false" + , equirect ? "true" : "false" + , strip ? "true" : "false" + , linear ? "true" : "false" ); } - uint32_t maxSize; - float edge; - bimg::TextureFormat::Enum format; - bimg::Quality::Enum quality; - bool mips; - bool normalMap; - bool iqa; - bool sdf; - bool alphaTest; + uint32_t maxSize = UINT32_MAX; + uint32_t mipSkip = 0; + float edge = 0.0f; + bimg::TextureFormat::Enum format = bimg::TextureFormat::Count; + bimg::Quality::Enum quality = bimg::Quality::Default; + bimg::LightingModel::Enum radiance = bimg::LightingModel::Count; + bool mips = false; + bool normalMap = false; + bool equirect = false; + bool strip = false; + bool iqa = false; + bool pma = false; + bool sdf = false; + bool alphaTest = false; + bool linear = false; }; void imageRgba32fNormalize(void* _dst, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src) @@ -86,14 +92,43 @@ void imageRgba32fNormalize(void* _dst, uint32_t _width, uint32_t _height, uint32 { float xyz[3]; - xyz[0] = rgba[0]; - xyz[1] = rgba[1]; - xyz[2] = rgba[2]; + xyz[0] = rgba[0]; + xyz[1] = rgba[1]; + xyz[2] = rgba[2]; bx::vec3Norm( (float*)dst, xyz); } } } +void imagePremultiplyAlpha(void* _inOut, uint32_t _width, uint32_t _height, uint32_t _depth, bimg::TextureFormat::Enum _format) +{ + uint8_t* inOut = (uint8_t*)_inOut; + uint32_t bpp = bimg::getBitsPerPixel(_format); + uint32_t pitch = _width*bpp/8; + + bimg::PackFn pack = bimg::getPack(_format); + bimg::UnpackFn unpack = bimg::getUnpack(_format); + + for (uint32_t zz = 0; zz < _depth; ++zz) + { + for (uint32_t yy = 0; yy < _height; ++yy) + { + for (uint32_t xx = 0; xx < _width; ++xx) + { + const uint32_t offset = yy*pitch + xx*bpp/8; + + float rgba[4]; + unpack(rgba, &inOut[offset]); + const float alpha = rgba[3]; + rgba[0] = bx::toGamma(bx::toLinear(rgba[0]) * alpha); + rgba[1] = bx::toGamma(bx::toLinear(rgba[1]) * alpha); + rgba[2] = bx::toGamma(bx::toLinear(rgba[2]) * alpha); + pack(&inOut[offset], rgba); + } + } + } +} + bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData, uint32_t _inputSize, const Options& _options, bx::Error* _err) { BX_ERROR_SCOPE(_err); @@ -110,8 +145,8 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData if (NULL != input) { - const bimg::TextureFormat::Enum inputFormat = input->m_format; - bimg::TextureFormat::Enum outputFormat = input->m_format; + bimg::TextureFormat::Enum inputFormat = input->m_format; + bimg::TextureFormat::Enum outputFormat = input->m_format; if (bimg::TextureFormat::Count != _options.format) { @@ -126,22 +161,82 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData const bimg::ImageBlockInfo& inputBlockInfo = bimg::getBlockInfo(inputFormat); const bimg::ImageBlockInfo& outputBlockInfo = bimg::getBlockInfo(outputFormat); const uint32_t blockWidth = outputBlockInfo.blockWidth; - const uint32_t blockHeight = outputBlockInfo.blockHeight; - const uint32_t minBlockX = outputBlockInfo.minBlockX; - const uint32_t minBlockY = outputBlockInfo.minBlockY; - uint32_t outputWidth = bx::uint32_max(blockWidth * minBlockX, ( (input->m_width + blockWidth - 1) / blockWidth )*blockWidth); - uint32_t outputHeight = bx::uint32_max(blockHeight * minBlockY, ( (input->m_height + blockHeight - 1) / blockHeight)*blockHeight); + const uint32_t blockHeight = outputBlockInfo.blockHeight; + const uint32_t minBlockX = outputBlockInfo.minBlockX; + const uint32_t minBlockY = outputBlockInfo.minBlockY; + uint32_t outputWidth = bx::max(blockWidth * minBlockX, ( (input->m_width + blockWidth - 1) / blockWidth )*blockWidth); + uint32_t outputHeight = bx::max(blockHeight * minBlockY, ( (input->m_height + blockHeight - 1) / blockHeight)*blockHeight); + uint32_t outputDepth = input->m_depth; - if (outputWidth > _options.maxSize - || outputHeight > _options.maxSize) + if (_options.mips + && _options.mipSkip != 0) { - if (outputWidth > outputHeight) + for (uint32_t ii = 0; ii < _options.mipSkip; ++ii) { + outputWidth = bx::max(blockWidth * minBlockX, ( ( (outputWidth>>1) + blockWidth - 1) / blockWidth )*blockWidth); + outputHeight = bx::max(blockHeight * minBlockY, ( ( (outputHeight>>1) + blockHeight - 1) / blockHeight)*blockHeight); + outputDepth = bx::max(outputDepth>>1, 1u); + } + } + + if (_options.equirect) + { + if (outputDepth == 1 + && outputWidth/2 == outputHeight) + { + if (outputWidth/2 > _options.maxSize) + { + outputWidth = _options.maxSize*4; + outputHeight = _options.maxSize*2; + } + } + else + { + bimg::imageFree(input); + + BX_ERROR_SET(_err, TEXTRUREC_ERROR, "Input image format is not equirectangular projection."); + return NULL; + } + } + else if (_options.strip) + { + if (outputDepth == 1 + && outputWidth/6 == outputHeight) + { + if (outputWidth/6 > _options.maxSize) + { + outputWidth = _options.maxSize*6; + outputHeight = _options.maxSize; + } + } + else + { + bimg::imageFree(input); + + BX_ERROR_SET(_err, TEXTRUREC_ERROR, "Input image format is not horizontal strip."); + return NULL; + } + } + else if (outputWidth > _options.maxSize + || outputHeight > _options.maxSize + || outputDepth > _options.maxSize) + { + if (outputDepth > outputWidth + && outputDepth > outputHeight) + { + outputWidth = outputWidth * _options.maxSize / outputDepth; + outputHeight = outputHeight * _options.maxSize / outputDepth; + outputDepth = _options.maxSize; + } + else if (outputWidth > outputHeight) + { + outputDepth = outputDepth * _options.maxSize / outputWidth; outputHeight = outputHeight * _options.maxSize / outputWidth; outputWidth = _options.maxSize; } else { + outputDepth = outputDepth * _options.maxSize / outputHeight; outputWidth = outputWidth * _options.maxSize / outputHeight; outputHeight = _options.maxSize; } @@ -158,29 +253,55 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData && !_options.sdf && !_options.alphaTest && !_options.normalMap + && !(_options.equirect || _options.strip) && !_options.iqa + && !_options.pma + && (bimg::LightingModel::Count == _options.radiance) ; - if (needResize) + if (!_options.sdf + && needResize) { - bimg::ImageContainer* src = bimg::imageConvert(_allocator, bimg::TextureFormat::RGBA32F, *input); + bimg::ImageContainer* src = bimg::imageConvert(_allocator, bimg::TextureFormat::RGBA32F, *input, false); bimg::ImageContainer* dst = bimg::imageAlloc( _allocator , bimg::TextureFormat::RGBA32F , uint16_t(outputWidth) , uint16_t(outputHeight) - , 1 + , uint16_t(outputDepth) , input->m_numLayers , input->m_cubeMap , false ); + if (!_options.linear) + { + bimg::imageRgba32fToLinear(src); + } + bimg::imageResizeRgba32fLinear(dst, src); + if (!_options.linear) + { + bimg::imageRgba32fToGamma(dst); + } + bimg::imageFree(src); bimg::imageFree(input); + if (bimg::isCompressed(inputFormat) ) + { + if (inputFormat == bimg::TextureFormat::BC6H) + { + inputFormat = bimg::TextureFormat::RGBA32F; + } + else + { + inputFormat = bimg::TextureFormat::RGBA8; + } + } + input = bimg::imageConvert(_allocator, inputFormat, *dst); bimg::imageFree(dst); } @@ -201,6 +322,55 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData return output; } + if (_options.equirect + || _options.strip) + { + bimg::ImageContainer* src = bimg::imageConvert(_allocator, bimg::TextureFormat::RGBA32F, *input); + bimg::imageFree(input); + + bimg::ImageContainer* dst; + + if (outputWidth/2 == outputHeight) + { + dst = bimg::imageCubemapFromLatLongRgba32F(_allocator, *src, true, _err); + bimg::imageFree(src); + } + else + { + dst = bimg::imageCubemapFromStripRgba32F(_allocator, *src, _err); + bimg::imageFree(src); + } + + if (!_err->isOk() ) + { + return NULL; + } + + input = bimg::imageConvert(_allocator, inputFormat, *dst); + bimg::imageFree(dst); + } + + if (bimg::LightingModel::Count != _options.radiance) + { + output = bimg::imageCubemapRadianceFilter(_allocator, *input, _options.radiance, _err); + + if (!_err->isOk() ) + { + return NULL; + } + + if (bimg::TextureFormat::RGBA32F != outputFormat) + { + bimg::ImageContainer* temp = bimg::imageEncode(_allocator, outputFormat, _options.quality, *output); + bimg::imageFree(output); + + output = temp; + } + + bimg::imageFree(input); + return output; + } + output = bimg::imageAlloc( _allocator , outputFormat @@ -226,6 +396,7 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData void* temp = NULL; + // Normal map. if (_options.normalMap) { uint32_t size = bimg::imageGetSize( @@ -300,6 +471,7 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData , dstMip.m_width , dstMip.m_height , dstMip.m_width*16 + , bx::strideAlign(dstMip.m_width/2, blockWidth)*16 , rgba ); @@ -328,7 +500,8 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData BX_FREE(_allocator, rgbaDst); } - else if ( (!bimg::isCompressed(input->m_format) && 8 != inputBlockInfo.rBits) + // HDR + else if ( (!bimg::isCompressed(inputFormat) && 8 != inputBlockInfo.rBits) || outputFormat == bimg::TextureFormat::BC6H || outputFormat == bimg::TextureFormat::BC7 ) @@ -357,6 +530,17 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData , mip.m_format ); + if (_options.pma) + { + imagePremultiplyAlpha( + rgba32f + , dstMip.m_width + , dstMip.m_height + , dstMip.m_depth + , bimg::TextureFormat::RGBA32F + ); + } + bimg::imageEncodeFromRgba32f(_allocator , dstData , rgba32f @@ -389,6 +573,17 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData , rgba32f ); + if (_options.pma) + { + imagePremultiplyAlpha( + rgba32f + , dstMip.m_width + , dstMip.m_height + , dstMip.m_depth + , bimg::TextureFormat::RGBA32F + ); + } + bimg::imageGetRawData(*output, side, lod, output->m_data, output->m_size, dstMip); dstData = const_cast(dstMip.m_data); @@ -415,6 +610,7 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData BX_FREE(_allocator, rgbaDst); } + // SDF else if (_options.sdf) { uint32_t size = bimg::imageGetSize( @@ -448,10 +644,10 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData , mip.m_width , mip.m_height , mip.m_width - , _options.edge , rgba ); } + // RGBA8 else { uint32_t size = bimg::imageGetSize( @@ -467,7 +663,9 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData temp = BX_ALLOC(_allocator, size); uint8_t* rgba = (uint8_t*)temp; - bimg::imageDecodeToRgba8(rgba + bimg::imageDecodeToRgba8( + _allocator + , rgba , mip.m_data , mip.m_width , mip.m_height @@ -494,9 +692,23 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData bx::memCopy(ref, rgba, size); } + if (_options.pma) + { + imagePremultiplyAlpha( + rgba + , dstMip.m_width + , dstMip.m_height + , dstMip.m_depth + , bimg::TextureFormat::RGBA8 + ); + } + bimg::imageGetRawData(*output, side, 0, output->m_data, output->m_size, dstMip); dstData = const_cast(dstMip.m_data); - bimg::imageEncodeFromRgba8(dstData + + bimg::imageEncodeFromRgba8( + _allocator + , dstData , rgba , dstMip.m_width , dstMip.m_height @@ -513,6 +725,7 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData , dstMip.m_height , dstMip.m_depth , dstMip.m_width*4 + , bx::strideAlign(dstMip.m_width/2, blockWidth)*4 , rgba ); @@ -528,10 +741,23 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData ); } + if (_options.pma) + { + imagePremultiplyAlpha( + rgba + , dstMip.m_width + , dstMip.m_height + , dstMip.m_depth + , bimg::TextureFormat::RGBA8 + ); + } + bimg::imageGetRawData(*output, side, lod, output->m_data, output->m_size, dstMip); dstData = const_cast(dstMip.m_data); - bimg::imageEncodeFromRgba8(dstData + bimg::imageEncodeFromRgba8( + _allocator + , dstData , rgba , dstMip.m_width , dstMip.m_height @@ -544,7 +770,9 @@ bimg::ImageContainer* convert(bx::AllocatorI* _allocator, const void* _inputData if (NULL != ref) { - bimg::imageDecodeToRgba8(rgba + bimg::imageDecodeToRgba8( + _allocator + , rgba , output->m_data , mip.m_width , mip.m_height @@ -596,8 +824,8 @@ void help(const char* _error = NULL, bool _showHelp = true) fprintf(stderr , "texturec, bgfx texture compiler tool, version %d.%d.%d.\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" - "License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause\n\n" + "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" + "License: https://github.com/bkaradzic/bimg#license-bsd-2-clause\n\n" , BIMG_TEXTUREC_VERSION_MAJOR , BIMG_TEXTUREC_VERSION_MINOR , BIMG_API_VERSION @@ -610,12 +838,12 @@ void help(const char* _error = NULL, bool _showHelp = true) "Supported file formats:\n" " *.bmp (input) Windows Bitmap.\n" " *.dds (input, output) Direct Draw Surface.\n" - " *.exr (input) OpenEXR.\n" + " *.exr (input, output) OpenEXR.\n" " *.gif (input) Graphics Interchange Format.\n" " *.jpg (input) JPEG Interchange Format.\n" - " *.hdr (input) Radiance RGBE.\n" + " *.hdr (input, output) Radiance RGBE.\n" " *.ktx (input, output) Khronos Texture.\n" - " *.png (input) Portable Network Graphics.\n" + " *.png (input, output) Portable Network Graphics.\n" " *.psd (input) Photoshop Document.\n" " *.pvr (input) PowerVR.\n" " *.tga (input) Targa.\n" @@ -629,17 +857,24 @@ void help(const char* _error = NULL, bool _showHelp = true) " -t Output format type (BC1/2/3/4/5, ETC1, PVR14, etc.).\n" " -q Encoding quality (default, fastest, highest).\n" " -m, --mips Generate mip-maps.\n" + " --mipskip Skip number of mips.\n" " -n, --normalmap Input texture is normal map.\n" - " --sdf Compute SDF texture.\n" + " --equirect Input texture is equirectangular projection of cubemap.\n" + " --strip Input texture is horizontal strip of cubemap.\n" + " --sdf Compute SDF texture.\n" " --ref Alpha reference value.\n" " --iqa Image Quality Assessment\n" + " --pma Premultiply alpha into RGB channel.\n" + " --linear Input and output texture is linear color space (gamma correction won't be applied).\n" " --max Maximum width/height (image will be scaled down and\n" " aspect ratio will be preserved.\n" + " --radiance Radiance cubemap filter. (Lighting model: Phong, PhongBrdf, Blinn, BlinnBrdf, GGX)\n" " --as Save as.\n" + " --formats List all supported formats.\n" " --validate *DEBUG* Validate that output image produced matches after loading.\n" "\n" - "For additional information, see https://github.com/bkaradzic/bgfx\n" + "For additional information, see https://github.com/bkaradzic/bimg\n" ); } @@ -658,6 +893,30 @@ void help(const char* _str, const bx::Error& _err) help(str.c_str(), false); } +class AlignedAllocator : public bx::AllocatorI +{ +public: + AlignedAllocator(bx::AllocatorI* _allocator, size_t _minAlignment) + : m_allocator(_allocator) + , m_minAlignment(_minAlignment) + { + } + + virtual void* realloc( + void* _ptr + , size_t _size + , size_t _align + , const char* _file + , uint32_t _line + ) + { + return m_allocator->realloc(_ptr, _size, bx::max(_align, m_minAlignment), _file, _line); + } + + bx::AllocatorI* m_allocator; + size_t m_minAlignment; +}; + int main(int _argc, const char* _argv[]) { bx::CommandLine cmdLine(_argc, _argv); @@ -679,6 +938,24 @@ int main(int _argc, const char* _argv[]) return bx::kExitFailure; } + if (cmdLine.hasArg("formats")) + { + printf("Uncompressed formats:\n"); + + for (int format = bimg::TextureFormat::Unknown + 1; format < bimg::TextureFormat::UnknownDepth; format++) + printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format)); + + for (int format = bimg::TextureFormat::UnknownDepth + 1; format < bimg::TextureFormat::Count; format++) + printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format)); + + printf("Compressed formats:\n"); + + for (int format = 0; format < bimg::TextureFormat::Unknown; format++) + printf(" %s\n", bimg::getName((bimg::TextureFormat::Enum) format)); + + return bx::kExitSuccess; + } + const char* inputFileName = cmdLine.findOption('f'); if (NULL == inputFileName) { @@ -693,10 +970,13 @@ int main(int _argc, const char* _argv[]) return bx::kExitFailure; } - const char* saveAs = cmdLine.findOption("as"); - saveAs = NULL == saveAs ? bx::strFindI(outputFileName, ".ktx") : saveAs; - saveAs = NULL == saveAs ? bx::strFindI(outputFileName, ".dds") : saveAs; - if (NULL == saveAs) + bx::StringView saveAs = cmdLine.findOption("as"); + saveAs = saveAs.isEmpty() ? bx::strFindI(outputFileName, ".ktx") : saveAs; + saveAs = saveAs.isEmpty() ? bx::strFindI(outputFileName, ".dds") : saveAs; + saveAs = saveAs.isEmpty() ? bx::strFindI(outputFileName, ".png") : saveAs; + saveAs = saveAs.isEmpty() ? bx::strFindI(outputFileName, ".exr") : saveAs; + saveAs = saveAs.isEmpty() ? bx::strFindI(outputFileName, ".hdr") : saveAs; + if (saveAs.isEmpty() ) { help("Output file format must be specified."); return bx::kExitFailure; @@ -704,36 +984,50 @@ int main(int _argc, const char* _argv[]) Options options; - const char* edgeOpt = cmdLine.findOption("sdf"); - if (NULL != edgeOpt) + const char* alphaRef = cmdLine.findOption("ref"); + if (NULL != alphaRef) { - options.sdf = true; - if (!bx::fromString(&options.edge, edgeOpt) ) + options.alphaTest = true; + if (!bx::fromString(&options.edge, alphaRef)) { - options.edge = 255.0f; - } - } - else - { - const char* alphaRef = cmdLine.findOption("ref"); - if (NULL != alphaRef) - { - options.alphaTest = true; - if (!bx::fromString(&options.edge, alphaRef)) - { - options.edge = 0.5f; - } + options.edge = 0.5f; } } - options.mips = cmdLine.hasArg('m', "mips"); - options.normalMap = cmdLine.hasArg('n', "normalmap"); - options.iqa = cmdLine.hasArg('\0', "iqa"); + options.sdf = cmdLine.hasArg("sdf"); + options.mips = cmdLine.hasArg('m', "mips"); + options.normalMap = cmdLine.hasArg('n', "normalmap"); + options.equirect = cmdLine.hasArg("equirect"); + options.strip = cmdLine.hasArg("strip"); + options.iqa = cmdLine.hasArg("iqa"); + options.pma = cmdLine.hasArg("pma"); + options.linear = cmdLine.hasArg("linear"); + + if (options.equirect + && options.strip) + { + help("Image can't be equirect and strip at the same time."); + return bx::kExitFailure; + } const char* maxSize = cmdLine.findOption("max"); if (NULL != maxSize) { - options.maxSize = atoi(maxSize); + if (!bx::fromString(&options.maxSize, maxSize) ) + { + help("Parsing `--max` failed."); + return bx::kExitFailure; + } + } + + const char* mipSkip = cmdLine.findOption("mipskip"); + if (NULL != mipSkip) + { + if (!bx::fromString(&options.mipSkip, mipSkip) ) + { + help("Parsing `--mipskip` failed."); + return bx::kExitFailure; + } } options.format = bimg::TextureFormat::Count; @@ -749,6 +1043,31 @@ int main(int _argc, const char* _argv[]) } } + if (!bx::strFindI(saveAs, "png").isEmpty() ) + { + if (options.format == bimg::TextureFormat::Count) + { + options.format = bimg::TextureFormat::RGBA8; + } + else if (options.format != bimg::TextureFormat::RGBA8) + { + help("Output PNG format must be RGBA8."); + return bx::kExitFailure; + } + } + else if (!bx::strFindI(saveAs, "exr").isEmpty() ) + { + if (options.format == bimg::TextureFormat::Count) + { + options.format = bimg::TextureFormat::RGBA16F; + } + else if (options.format != bimg::TextureFormat::RGBA16F) + { + help("Output EXR format must be RGBA16F."); + return bx::kExitFailure; + } + } + const char* quality = cmdLine.findOption('q'); if (NULL != quality) { @@ -763,6 +1082,21 @@ int main(int _argc, const char* _argv[]) } } + const char* radiance = cmdLine.findOption("radiance"); + if (NULL != radiance) + { + if (0 == bx::strCmpI(radiance, "phong" ) ) { options.radiance = bimg::LightingModel::Phong; } + else if (0 == bx::strCmpI(radiance, "phongbrdf") ) { options.radiance = bimg::LightingModel::PhongBrdf; } + else if (0 == bx::strCmpI(radiance, "blinn" ) ) { options.radiance = bimg::LightingModel::Blinn; } + else if (0 == bx::strCmpI(radiance, "blinnbrdf") ) { options.radiance = bimg::LightingModel::BlinnBrdf; } + else if (0 == bx::strCmpI(radiance, "ggx" ) ) { options.radiance = bimg::LightingModel::Ggx; } + else + { + help("Invalid radiance lighting model specified."); + return bx::kExitFailure; + } + } + const bool validate = cmdLine.hasArg("validate"); bx::Error err; @@ -780,7 +1114,9 @@ int main(int _argc, const char* _argv[]) return bx::kExitFailure; } - bx::DefaultAllocator allocator; + bx::DefaultAllocator defaultAllocator; + AlignedAllocator allocator(&defaultAllocator, 16); + uint8_t* inputData = (uint8_t*)BX_ALLOC(&allocator, inputSize); bx::read(&reader, inputData, inputSize, &err); @@ -801,14 +1137,62 @@ int main(int _argc, const char* _argv[]) bx::FileWriter writer; if (bx::open(&writer, outputFileName, false, &err) ) { - if (NULL != bx::strFindI(saveAs, "ktx") ) + if (!bx::strFindI(saveAs, "ktx").isEmpty() ) { bimg::imageWriteKtx(&writer, *output, output->m_data, output->m_size, &err); } - else if (NULL != bx::strFindI(saveAs, "dds") ) + else if (!bx::strFindI(saveAs, "dds").isEmpty() ) { bimg::imageWriteDds(&writer, *output, output->m_data, output->m_size, &err); } + else if (!bx::strFindI(saveAs, "png").isEmpty() ) + { + if (output->m_format != bimg::TextureFormat::RGBA8) + { + help("Incompatible output texture format. Output PNG format must be RGBA8.", err); + return bx::kExitFailure; + } + + bimg::ImageMip mip; + bimg::imageGetRawData(*output, 0, 0, output->m_data, output->m_size, mip); + bimg::imageWritePng(&writer + , mip.m_width + , mip.m_height + , mip.m_width*4 + , mip.m_data + , output->m_format + , false + , &err + ); + } + else if (!bx::strFindI(saveAs, "exr").isEmpty() ) + { + bimg::ImageMip mip; + bimg::imageGetRawData(*output, 0, 0, output->m_data, output->m_size, mip); + bimg::imageWriteExr(&writer + , mip.m_width + , mip.m_height + , mip.m_width*8 + , mip.m_data + , output->m_format + , false + , &err + ); + } + else if (!bx::strFindI(saveAs, "hdr").isEmpty() ) + { + bimg::ImageMip mip; + bimg::imageGetRawData(*output, 0, 0, output->m_data, output->m_size, mip); + bimg::imageWriteHdr(&writer + , mip.m_width + , mip.m_height + , mip.m_width*getBitsPerPixel(mip.m_format)/8 + , mip.m_data + , output->m_format + , false + , &err + ); + } bx::close(&writer); diff --git a/3rdparty/bx/.appveyor.yml b/3rdparty/bx/.appveyor.yml index 96ec072ce84..001d04317b3 100644 --- a/3rdparty/bx/.appveyor.yml +++ b/3rdparty/bx/.appveyor.yml @@ -5,7 +5,6 @@ os: environment: matrix: - - TOOLSET: vs2015 - TOOLSET: vs2017 configuration: diff --git a/3rdparty/bx/.gitignore b/3rdparty/bx/.gitignore index 042ef46800e..0e5ebcb0f79 100644 --- a/3rdparty/bx/.gitignore +++ b/3rdparty/bx/.gitignore @@ -4,3 +4,4 @@ .svn tags .DS_Store +.gdb_history diff --git a/3rdparty/bx/.travis.yml b/3rdparty/bx/.travis.yml index cffababe8a8..5f5538002bb 100644 --- a/3rdparty/bx/.travis.yml +++ b/3rdparty/bx/.travis.yml @@ -11,12 +11,12 @@ addons: sources: - ubuntu-toolchain-r-test packages: - - gcc-4.8 - - g++-4.8 + - gcc-5 + - g++-5 - clang script: - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make test CXX="g++-4.8" CC="gcc-4.8"; fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then make test CXX="g++-5" CC="gcc-5"; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then make test; fi branches: @@ -26,5 +26,4 @@ branches: notifications: email: false -osx_image: - xcode61 +osx_image: xcode9.3 diff --git a/3rdparty/bx/3rdparty/ini/ini.h b/3rdparty/bx/3rdparty/ini/ini.h index 394c19645a7..6adb2966790 100644 --- a/3rdparty/bx/3rdparty/ini/ini.h +++ b/3rdparty/bx/3rdparty/ini/ini.h @@ -496,7 +496,7 @@ ini_t* ini_create( void* memctx ) } -ini_t* ini_load( char const* data, void* memctx ) +ini_t* ini_load( char const* data, unsigned int len, void* memctx ) { ini_t* ini; char const* ptr; @@ -504,17 +504,19 @@ ini_t* ini_load( char const* data, void* memctx ) char const* start; char const* start2; int l; + char const* end; ini = ini_create( memctx ); ptr = data; + end = ptr + len; if( ptr ) { s = 0; - while( *ptr ) + while( ptr < end && *ptr ) { /* trim leading whitespace */ - while( *ptr && *ptr <=' ' ) + while( ptr < end && *ptr && *ptr <=' ' ) ++ptr; /* done? */ @@ -544,17 +546,17 @@ ini_t* ini_load( char const* data, void* memctx ) else { start = ptr; - while( *ptr && *ptr !='=' && *ptr != '\n' ) + while( ptr < end && *ptr && *ptr !='=' && *ptr != '\n' ) ++ptr; if( *ptr == '=' ) { l = (int)( ptr - start); ++ptr; - while( *ptr && *ptr <= ' ' && *ptr != '\n' ) + while( ptr < end && *ptr && *ptr <= ' ' && *ptr != '\n' ) ptr++; start2 = ptr; - while( *ptr && *ptr != '\n' ) + while( ptr < end && *ptr && *ptr != '\n' ) ++ptr; while( *(--ptr) <= ' ' ) (void)ptr; diff --git a/3rdparty/bx/LICENSE b/3rdparty/bx/LICENSE index dd17ed45ef3..3df43e30a2a 100644 --- a/3rdparty/bx/LICENSE +++ b/3rdparty/bx/LICENSE @@ -1,4 +1,4 @@ -Copyright 2010-2017 Branimir Karadzic. All rights reserved. +Copyright 2010-2018 Branimir Karadzic. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/3rdparty/bx/README.md b/3rdparty/bx/README.md index 69dfade5ccb..1d987c34f7f 100644 --- a/3rdparty/bx/README.md +++ b/3rdparty/bx/README.md @@ -23,7 +23,7 @@ https://github.com/bkaradzic/bx - Copyright 2010-2017 Branimir Karadzic. All rights reserved. + Copyright 2010-2018 Branimir Karadzic. All rights reserved. https://github.com/bkaradzic/bx diff --git a/3rdparty/bx/include/bx/allocator.h b/3rdparty/bx/include/bx/allocator.h index f920c08fa71..cfd1475ab52 100644 --- a/3rdparty/bx/include/bx/allocator.h +++ b/3rdparty/bx/include/bx/allocator.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/bx.h b/3rdparty/bx/include/bx/bx.h index a87a9b0f6d3..7c2d06162aa 100644 --- a/3rdparty/bx/include/bx/bx.h +++ b/3rdparty/bx/include/bx/bx.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -15,10 +15,9 @@ #include "platform.h" #include "config.h" #include "macros.h" -#include "debug.h" /// -#define BX_COUNTOF(_x) sizeof(bx::COUNTOF_REQUIRES_ARRAY_ARGUMENT(_x) ) +#define BX_COUNTOF(_x) sizeof(bx::CountOfRequireArrayArgumentT(_x) ) /// #define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) ) @@ -28,47 +27,51 @@ namespace bx { - const int32_t kExitSuccess = 0; - const int32_t kExitFailure = 1; + constexpr int32_t kExitSuccess = 0; + constexpr int32_t kExitFailure = 1; /// Template for avoiding MSVC: C4127: conditional expression is constant template - bool isEnabled(); + constexpr bool isEnabled(); - /// Exchange two values. + /// + template + constexpr bool isTriviallyCopyable(); + + /// Swap two values. template - void xchg(Ty& _a, Ty& _b); + void swap(Ty& _a, Ty& _b); - /// Exchange memory. - void xchg(void* _a, void* _b, size_t _numBytes); + /// Swap memory. + void swap(void* _a, void* _b, size_t _numBytes); /// Returns minimum of two values. template - Ty min(const Ty& _a, const Ty& _b); + constexpr Ty min(const Ty& _a, const Ty& _b); /// Returns maximum of two values. template - Ty max(const Ty& _a, const Ty& _b); + constexpr Ty max(const Ty& _a, const Ty& _b); /// Returns minimum of three values. template - Ty min(const Ty& _a, const Ty& _b, const Ty& _c); + constexpr Ty min(const Ty& _a, const Ty& _b, const Ty& _c); /// Returns maximum of three values. template - Ty max(const Ty& _a, const Ty& _b, const Ty& _c); + constexpr Ty max(const Ty& _a, const Ty& _b, const Ty& _c); /// Returns middle of three values. template - Ty mid(const Ty& _a, const Ty& _b, const Ty& _c); + constexpr Ty mid(const Ty& _a, const Ty& _b, const Ty& _c); /// Returns clamped value between min/max. template - Ty clamp(const Ty& _a, const Ty& _min, const Ty& _max); + constexpr Ty clamp(const Ty& _a, const Ty& _min, const Ty& _max); - // http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/ - template - char (&COUNTOF_REQUIRES_ARRAY_ARGUMENT(const T(&)[N]) )[N]; + /// Returns true if value is power of 2. + template + constexpr bool isPowerOf2(Ty _a); /// void memCopy(void* _dst, const void* _src, size_t _numBytes); diff --git a/3rdparty/bx/include/bx/commandline.h b/3rdparty/bx/include/bx/commandline.h index 61a7eb33760..dbd2af39427 100644 --- a/3rdparty/bx/include/bx/commandline.h +++ b/3rdparty/bx/include/bx/commandline.h @@ -1,18 +1,17 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #ifndef BX_COMMANDLINE_H_HEADER_GUARD #define BX_COMMANDLINE_H_HEADER_GUARD -#include "bx.h" +#include "string.h" namespace bx { - /// Reference: - /// http://msdn.microsoft.com/en-us/library/a1y7w461.aspx - const char* tokenizeCommandLine(const char* _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term = '\0'); + /// + StringView tokenizeCommandLine(const StringView& _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term = '\0'); /// class CommandLine diff --git a/3rdparty/bx/include/bx/config.h b/3rdparty/bx/include/bx/config.h index dea60b9d1f8..787859de6cf 100644 --- a/3rdparty/bx/include/bx/config.h +++ b/3rdparty/bx/include/bx/config.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -15,7 +15,6 @@ #ifndef BX_CONFIG_SUPPORTS_THREADING # define BX_CONFIG_SUPPORTS_THREADING !(0 \ || BX_PLATFORM_EMSCRIPTEN \ - || BX_CRT_NONE \ ) #endif // BX_CONFIG_SUPPORTS_THREADING diff --git a/3rdparty/bx/include/bx/cpu.h b/3rdparty/bx/include/bx/cpu.h index 40e67b603b7..a2e81a1a1ca 100644 --- a/3rdparty/bx/include/bx/cpu.h +++ b/3rdparty/bx/include/bx/cpu.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/debug.h b/3rdparty/bx/include/bx/debug.h index 58940ac19e6..80efaf97c87 100644 --- a/3rdparty/bx/include/bx/debug.h +++ b/3rdparty/bx/include/bx/debug.h @@ -1,12 +1,12 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #ifndef BX_DEBUG_H_HEADER_GUARD #define BX_DEBUG_H_HEADER_GUARD -#include "bx.h" +#include "string.h" namespace bx { @@ -16,6 +16,9 @@ namespace bx /// void debugOutput(const char* _out); + /// + void debugOutput(const StringView& _str); + /// void debugPrintfVargs(const char* _format, va_list _argList); diff --git a/3rdparty/bx/include/bx/easing.h b/3rdparty/bx/include/bx/easing.h index 96849030211..8581b975c9c 100644 --- a/3rdparty/bx/include/bx/easing.h +++ b/3rdparty/bx/include/bx/easing.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,10 +8,6 @@ #include "math.h" -// Reference: -// http://easings.net/ -// http://robertpenner.com/easing/ - namespace bx { /// @@ -97,7 +93,7 @@ namespace bx /// | /// | /// - float easeLinear(float _t); + BX_CONST_FUNC float easeLinear(float _t); /// Step. /// @@ -123,7 +119,7 @@ namespace bx /// | /// | /// - float easeStep(float _t); + BX_CONST_FUNC float easeStep(float _t); /// Smooth step. /// @@ -148,7 +144,7 @@ namespace bx /// | /// | /// - float easeSmoothStep(float _t); + BX_CONST_FUNC float easeSmoothStep(float _t); /// Quad. /// @@ -174,7 +170,7 @@ namespace bx /// | /// | /// - float easeInQuad(float _t); + BX_CONST_FUNC float easeInQuad(float _t); /// Out quad. /// @@ -200,7 +196,7 @@ namespace bx /// | /// | /// - float easeOutQuad(float _t); + BX_CONST_FUNC float easeOutQuad(float _t); /// In out quad. /// @@ -226,7 +222,7 @@ namespace bx /// | /// | /// - float easeInOutQuad(float _t); + BX_CONST_FUNC float easeInOutQuad(float _t); /// Out in quad. /// @@ -252,7 +248,7 @@ namespace bx /// | /// | /// - float easeOutInQuad(float _t); + BX_CONST_FUNC float easeOutInQuad(float _t); /// In cubic. /// @@ -278,7 +274,7 @@ namespace bx /// | /// | /// - float easeInCubic(float _t); + BX_CONST_FUNC float easeInCubic(float _t); /// Out cubic. /// @@ -304,7 +300,7 @@ namespace bx /// | /// | /// - float easeOutCubic(float _t); + BX_CONST_FUNC float easeOutCubic(float _t); /// In out cubic. /// @@ -330,7 +326,7 @@ namespace bx /// | /// | /// - float easeInOutCubic(float _t); + BX_CONST_FUNC float easeInOutCubic(float _t); /// Out in cubic. /// @@ -356,7 +352,7 @@ namespace bx /// | /// | /// - float easeOutInCubic(float _t); + BX_CONST_FUNC float easeOutInCubic(float _t); /// In quart. /// @@ -382,7 +378,7 @@ namespace bx /// | /// | /// - float easeInQuart(float _t); + BX_CONST_FUNC float easeInQuart(float _t); /// Out quart. /// @@ -408,7 +404,7 @@ namespace bx /// | /// | /// - float easeOutQuart(float _t); + BX_CONST_FUNC float easeOutQuart(float _t); /// In out quart. /// @@ -434,7 +430,7 @@ namespace bx /// | /// | /// - float easeInOutQuart(float _t); + BX_CONST_FUNC float easeInOutQuart(float _t); /// Out in quart. /// @@ -460,7 +456,7 @@ namespace bx /// | /// | /// - float easeOutInQuart(float _t); + BX_CONST_FUNC float easeOutInQuart(float _t); /// In quint. /// @@ -486,7 +482,7 @@ namespace bx /// | /// | /// - float easeInQuint(float _t); + BX_CONST_FUNC float easeInQuint(float _t); /// Out quint. /// @@ -512,7 +508,7 @@ namespace bx /// | /// | /// - float easeOutQuint(float _t); + BX_CONST_FUNC float easeOutQuint(float _t); /// In out quint. /// @@ -538,7 +534,7 @@ namespace bx /// | /// | /// - float easeInOutQuint(float _t); + BX_CONST_FUNC float easeInOutQuint(float _t); /// Out in quint. /// @@ -564,7 +560,7 @@ namespace bx /// | /// | /// - float easeOutInQuint(float _t); + BX_CONST_FUNC float easeOutInQuint(float _t); /// In sine. /// @@ -590,7 +586,7 @@ namespace bx /// | /// | /// - float easeInSine(float _t); + BX_CONST_FUNC float easeInSine(float _t); /// Out sine. /// @@ -616,7 +612,7 @@ namespace bx /// | /// | /// - float easeOutSine(float _t); + BX_CONST_FUNC float easeOutSine(float _t); /// In out sine. /// @@ -642,7 +638,7 @@ namespace bx /// | /// | /// - float easeInOutSine(float _t); + BX_CONST_FUNC float easeInOutSine(float _t); /// Out in sine. /// @@ -668,7 +664,7 @@ namespace bx /// | /// | /// - float easeOutInSine(float _t); + BX_CONST_FUNC float easeOutInSine(float _t); /// In exponential. /// @@ -694,7 +690,7 @@ namespace bx /// | /// | /// - float easeInExpo(float _t); + BX_CONST_FUNC float easeInExpo(float _t); /// Out exponential. /// @@ -720,7 +716,7 @@ namespace bx /// | /// | /// - float easeOutExpo(float _t); + BX_CONST_FUNC float easeOutExpo(float _t); /// In out exponential. /// @@ -746,7 +742,7 @@ namespace bx /// | /// | /// - float easeInOutExpo(float _t); + BX_CONST_FUNC float easeInOutExpo(float _t); /// Out in exponential. /// @@ -772,7 +768,7 @@ namespace bx /// | /// | /// - float easeOutInExpo(float _t); + BX_CONST_FUNC float easeOutInExpo(float _t); /// In circle. /// @@ -798,7 +794,7 @@ namespace bx /// | /// | /// - float easeInCirc(float _t); + BX_CONST_FUNC float easeInCirc(float _t); /// Out circle. /// @@ -824,7 +820,7 @@ namespace bx /// | /// | /// - float easeOutCirc(float _t); + BX_CONST_FUNC float easeOutCirc(float _t); /// In out circle. /// @@ -850,7 +846,7 @@ namespace bx /// | /// | /// - float easeInOutCirc(float _t); + BX_CONST_FUNC float easeInOutCirc(float _t); /// Out in circle. /// @@ -876,7 +872,7 @@ namespace bx /// | /// | /// - float easeOutInCirc(float _t); + BX_CONST_FUNC float easeOutInCirc(float _t); /// Out elastic. /// @@ -902,7 +898,7 @@ namespace bx /// | ***** /// | /// - float easeOutElastic(float _t); + BX_CONST_FUNC float easeOutElastic(float _t); /// In elastic. /// @@ -928,7 +924,7 @@ namespace bx /// | /// | /// - float easeInElastic(float _t); + BX_CONST_FUNC float easeInElastic(float _t); /// In out elastic. /// @@ -954,7 +950,7 @@ namespace bx /// | /// | /// - float easeInOutElastic(float _t); + BX_CONST_FUNC float easeInOutElastic(float _t); /// Out in elastic. /// @@ -980,7 +976,7 @@ namespace bx /// | /// | /// - float easeOutInElastic(float _t); + BX_CONST_FUNC float easeOutInElastic(float _t); /// In back. /// @@ -1006,7 +1002,7 @@ namespace bx /// | ****************** /// | /// - float easeInBack(float _t); + BX_CONST_FUNC float easeInBack(float _t); /// Out back. /// @@ -1032,7 +1028,7 @@ namespace bx /// | /// | /// - float easeOutBack(float _t); + BX_CONST_FUNC float easeOutBack(float _t); /// In out back. /// @@ -1058,7 +1054,7 @@ namespace bx /// | /// | /// - float easeInOutBack(float _t); + BX_CONST_FUNC float easeInOutBack(float _t); /// Out in back. /// @@ -1084,7 +1080,7 @@ namespace bx /// | /// | /// - float easeOutInBack(float _t); + BX_CONST_FUNC float easeOutInBack(float _t); /// Out bounce. /// @@ -1110,7 +1106,7 @@ namespace bx /// | /// | /// - float easeOutBounce(float _t); + BX_CONST_FUNC float easeOutBounce(float _t); /// In bounce. /// @@ -1136,7 +1132,7 @@ namespace bx /// | /// | /// - float easeInBounce(float _t); + BX_CONST_FUNC float easeInBounce(float _t); /// In out bounce. /// @@ -1162,7 +1158,7 @@ namespace bx /// | /// | /// - float easeInOutBounce(float _t); + BX_CONST_FUNC float easeInOutBounce(float _t); /// Out in bounce. /// @@ -1188,9 +1184,7 @@ namespace bx /// | /// | /// - float easeOutInBounce(float _t); - - float easeInOutLinear(float _t); + BX_CONST_FUNC float easeOutInBounce(float _t); } // namespace bx diff --git a/3rdparty/bx/include/bx/endian.h b/3rdparty/bx/include/bx/endian.h index fdc1933e35b..22965b5f31a 100644 --- a/3rdparty/bx/include/bx/endian.h +++ b/3rdparty/bx/include/bx/endian.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/error.h b/3rdparty/bx/include/bx/error.h index 47d6d8275a4..1eb220e7be0 100644 --- a/3rdparty/bx/include/bx/error.h +++ b/3rdparty/bx/include/bx/error.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -10,8 +10,7 @@ #define BX_ERROR_SET(_ptr, _result, _msg) \ BX_MACRO_BLOCK_BEGIN \ - BX_TRACE("Error %d: %s", _result.code, "" _msg); \ - _ptr->setError(_result, "" _msg); \ + (_ptr)->setError(_result, "" _msg); \ BX_MACRO_BLOCK_END #define BX_ERROR_USE_TEMP_WHEN_NULL(_ptr) \ diff --git a/3rdparty/bx/include/bx/file.h b/3rdparty/bx/include/bx/file.h index 144f965d2c4..4c0dd415f1b 100644 --- a/3rdparty/bx/include/bx/file.h +++ b/3rdparty/bx/include/bx/file.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/filepath.h b/3rdparty/bx/include/bx/filepath.h index 761f50c590d..c71a1695cfb 100644 --- a/3rdparty/bx/include/bx/filepath.h +++ b/3rdparty/bx/include/bx/filepath.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -14,16 +14,18 @@ BX_ERROR_RESULT(BX_ERROR_NOT_DIRECTORY, BX_MAKEFOURCC('b', 'x', 0, 1) ); namespace bx { - const int32_t kMaxFilePath = 1024; + constexpr int32_t kMaxFilePath = 1024; + /// Special predefined OS directories. /// struct Dir { - enum Enum /// + /// Special OS directories: + enum Enum { - Current, - Temp, - Home, + Current, //!< Current directory. + Temp, //!< Temporary directory. + Home, //!< User's home directory. Count }; @@ -41,66 +43,88 @@ namespace bx class FilePath { public: + /// Default constructor, creates empty file path. /// FilePath(); + /// Construct file path from special OS directory. /// FilePath(Dir::Enum _dir); + /// Construct file path from C string. /// FilePath(const char* _str); + /// Construct file path from string. /// FilePath(const StringView& _str); + /// Assign file path from string. /// FilePath& operator=(const StringView& _rhs); + /// Clear file path. + /// + void clear(); + + /// Set file path from special OS directory. /// void set(Dir::Enum _dir); + /// Set file path. /// void set(const StringView& _str); + /// Join directory to file path. /// void join(const StringView& _str); + /// Returns C string to file path. /// const char* get() const; /// If path is `/abv/gd/555/333/pod.mac` returns `/abv/gd/555/333/`. /// - const StringView getPath() const; + StringView getPath() const; /// If path is `/abv/gd/555/333/pod.mac` returns `pod.mac`. /// - const StringView getFileName() const; + StringView getFileName() const; /// If path is `/abv/gd/555/333/pod.mac` returns `pod`. /// - const StringView getBaseName() const; + StringView getBaseName() const; /// If path is `/abv/gd/555/333/pod.mac` returns `.mac`. /// - const StringView getExt() const; + StringView getExt() const; + /// Returns true if file path is absolute. /// bool isAbsolute() const; + /// Returns true if file path is empty. + /// + bool isEmpty() const; + private: char m_filePath[kMaxFilePath]; }; /// Creates a directory named `_filePath`. + /// bool make(const FilePath& _filePath, Error* _err = NULL); /// Creates a directory named `_filePath` along with all necessary parents. + /// bool makeAll(const FilePath& _filePath, Error* _err = NULL); /// Removes file or directory. + /// bool remove(const FilePath& _filePath, Error* _err = NULL); /// Removes file or directory recursivelly. + /// bool removeAll(const FilePath& _filePath, Error* _err = NULL); } // namespace bx diff --git a/3rdparty/bx/include/bx/float4x4_t.h b/3rdparty/bx/include/bx/float4x4_t.h index 0a144534928..3250d929db3 100644 --- a/3rdparty/bx/include/bx/float4x4_t.h +++ b/3rdparty/bx/include/bx/float4x4_t.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/handlealloc.h b/3rdparty/bx/include/bx/handlealloc.h index fc200f72cdc..21b07ccca63 100644 --- a/3rdparty/bx/include/bx/handlealloc.h +++ b/3rdparty/bx/include/bx/handlealloc.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/hash.h b/3rdparty/bx/include/bx/hash.h index 1dcd82e3f67..9ced6947c9f 100644 --- a/3rdparty/bx/include/bx/hash.h +++ b/3rdparty/bx/include/bx/hash.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/allocator.inl b/3rdparty/bx/include/bx/inline/allocator.inl index 7362d3fa06f..1ff5f647345 100644 --- a/3rdparty/bx/include/bx/inline/allocator.inl +++ b/3rdparty/bx/include/bx/inline/allocator.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -57,9 +57,10 @@ namespace bx inline void* alignedAlloc(AllocatorI* _allocator, size_t _size, size_t _align, const char* _file, uint32_t _line) { - size_t total = _size + _align; + const size_t align = max(_align, sizeof(uint32_t) );; + const size_t total = _size + align; uint8_t* ptr = (uint8_t*)alloc(_allocator, total, 0, _file, _line); - uint8_t* aligned = (uint8_t*)alignPtr(ptr, sizeof(uint32_t), _align); + uint8_t* aligned = (uint8_t*)alignPtr(ptr, sizeof(uint32_t), align); uint32_t* header = (uint32_t*)aligned - 1; *header = uint32_t(aligned - ptr); return aligned; @@ -84,9 +85,11 @@ namespace bx uint8_t* aligned = (uint8_t*)_ptr; uint32_t offset = *( (uint32_t*)aligned - 1); uint8_t* ptr = aligned - offset; - size_t total = _size + _align; + + const size_t align = max(_align, sizeof(uint32_t) );; + const size_t total = _size + align; ptr = (uint8_t*)realloc(_allocator, ptr, total, 0, _file, _line); - uint8_t* newAligned = (uint8_t*)alignPtr(ptr, sizeof(uint32_t), _align); + uint8_t* newAligned = (uint8_t*)alignPtr(ptr, sizeof(uint32_t), align); if (newAligned == aligned) { diff --git a/3rdparty/bx/include/bx/inline/bx.inl b/3rdparty/bx/include/bx/inline/bx.inl index 70a6e6dec5e..c17649a5d69 100644 --- a/3rdparty/bx/include/bx/inline/bx.inl +++ b/3rdparty/bx/include/bx/inline/bx.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -9,63 +9,81 @@ namespace bx { + // Reference(S): + // - https://web.archive.org/web/20181115035420/http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/ + // + template + char(&CountOfRequireArrayArgumentT(const Ty(&)[Num]))[Num]; + template - inline bool isEnabled() + inline constexpr bool isEnabled() { return true; } + template + inline constexpr bool isTriviallyCopyable() + { + return __is_trivially_copyable(Ty); + } + template<> - inline bool isEnabled() + inline constexpr bool isEnabled() { return false; } - inline bool ignoreC4127(bool _x) + inline constexpr bool ignoreC4127(bool _x) { return _x; } template - inline void xchg(Ty& _a, Ty& _b) + inline void swap(Ty& _a, Ty& _b) { Ty tmp = _a; _a = _b; _b = tmp; } template - inline Ty min(const Ty& _a, const Ty& _b) + inline constexpr Ty min(const Ty& _a, const Ty& _b) { return _a < _b ? _a : _b; } template - inline Ty max(const Ty& _a, const Ty& _b) + inline constexpr Ty max(const Ty& _a, const Ty& _b) { return _a > _b ? _a : _b; } template - inline Ty min(const Ty& _a, const Ty& _b, const Ty& _c) + inline constexpr Ty min(const Ty& _a, const Ty& _b, const Ty& _c) { return min(min(_a, _b), _c); } template - inline Ty max(const Ty& _a, const Ty& _b, const Ty& _c) + inline constexpr Ty max(const Ty& _a, const Ty& _b, const Ty& _c) { return max(max(_a, _b), _c); } template - inline Ty mid(const Ty& _a, const Ty& _b, const Ty& _c) + inline constexpr Ty mid(const Ty& _a, const Ty& _b, const Ty& _c) { return max(min(_a, _b), min(max(_a, _b), _c) ); } template - inline Ty clamp(const Ty& _a, const Ty& _min, const Ty& _max) + inline constexpr Ty clamp(const Ty& _a, const Ty& _min, const Ty& _max) { return max(min(_a, _max), _min); } + template + inline constexpr bool isPowerOf2(Ty _a) + { + return _a && !(_a & (_a - 1) ); + } + } // namespace bx diff --git a/3rdparty/bx/include/bx/inline/cpu.inl b/3rdparty/bx/include/bx/inline/cpu.inl index f4d8aa70047..3ff2a231fd3 100644 --- a/3rdparty/bx/include/bx/inline/cpu.inl +++ b/3rdparty/bx/include/bx/inline/cpu.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,6 +8,10 @@ #endif // BX_CPU_H_HEADER_GUARD #if BX_COMPILER_MSVC +# if BX_PLATFORM_WINRT +# include +# endif // BX_PLATFORM_WINRT + # include // _mm_fence extern "C" void _ReadBarrier(); @@ -31,9 +35,24 @@ extern "C" long _InterlockedCompareExchange(long volatile* _ptr, long _exchange, extern "C" int64_t _InterlockedCompareExchange64(int64_t volatile* _ptr, int64_t _exchange, int64_t _comparand); # pragma intrinsic(_InterlockedCompareExchange64) +#if (_MSC_VER == 1800) && !defined(FIXED_592562) && defined (_M_IX86) && !defined (_M_CEE_PURE) + +extern "C" long _InterlockedExchange(long volatile* _ptr, long _value); +# pragma intrinsic(_InterlockedExchange) + +__forceinline static void * _InterlockedExchangePointer_impl(void * volatile * _Target, void * _Value) +{ + return (void *)_InterlockedExchange((long volatile *) _Target, (long) _Value); +} +#define _InterlockedExchangePointer(p,v) _InterlockedExchangePointer_impl(p,v) + +#else + extern "C" void* _InterlockedExchangePointer(void* volatile* _ptr, void* _value); # pragma intrinsic(_InterlockedExchangePointer) +#endif + # if BX_PLATFORM_WINRT # define _InterlockedExchangeAdd64 InterlockedExchangeAdd64 # endif // BX_PLATFORM_WINRT diff --git a/3rdparty/bx/include/bx/inline/easing.inl b/3rdparty/bx/include/bx/inline/easing.inl index d1e64ed20c6..3cdab9a77cb 100644 --- a/3rdparty/bx/include/bx/inline/easing.inl +++ b/3rdparty/bx/include/bx/inline/easing.inl @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -7,16 +7,20 @@ # error "Must be included from bx/easing.h!" #endif // BX_EASING_H_HEADER_GUARD + // Reference(s): + // - https://web.archive.org/web/20181126040153/https://easings.net/ + // - https://web.archive.org/web/20181126040212/http://robertpenner.com/easing/ + // namespace bx { template - float easeOut(float _t) + BX_CONST_FUNC float easeOut(float _t) { return 1.0f - ease(1.0f - _t); } template - float easeMix(float _t) + BX_CONST_FUNC float easeMix(float _t) { return _t < 0.5f ? easeFrom0toH(2.0f*_t)*0.5f @@ -24,202 +28,202 @@ namespace bx ; } - inline float easeLinear(float _t) + inline BX_CONST_FUNC float easeLinear(float _t) { return _t; } - inline float easeStep(float _t) + inline BX_CONST_FUNC float easeStep(float _t) { return _t < 0.5f ? 0.0f : 1.0f; } - inline float easeSmoothStep(float _t) + inline BX_CONST_FUNC float easeSmoothStep(float _t) { - return fsq(_t)*(3.0f - 2.0f*_t); + return square(_t)*(3.0f - 2.0f*_t); } - inline float easeInQuad(float _t) + inline BX_CONST_FUNC float easeInQuad(float _t) { - return fsq(_t); + return square(_t); } - inline float easeOutQuad(float _t) + inline BX_CONST_FUNC float easeOutQuad(float _t) { return easeOut(_t); } - inline float easeInOutQuad(float _t) + inline BX_CONST_FUNC float easeInOutQuad(float _t) { return easeMix(_t); } - inline float easeOutInQuad(float _t) + inline BX_CONST_FUNC float easeOutInQuad(float _t) { return easeMix(_t); } - inline float easeInCubic(float _t) + inline BX_CONST_FUNC float easeInCubic(float _t) { return _t*_t*_t; } - inline float easeOutCubic(float _t) + inline BX_CONST_FUNC float easeOutCubic(float _t) { return easeOut(_t); } - inline float easeInOutCubic(float _t) + inline BX_CONST_FUNC float easeInOutCubic(float _t) { return easeMix(_t); } - inline float easeOutInCubic(float _t) + inline BX_CONST_FUNC float easeOutInCubic(float _t) { return easeMix(_t); } - inline float easeInQuart(float _t) + inline BX_CONST_FUNC float easeInQuart(float _t) { return _t*_t*_t*_t; } - inline float easeOutQuart(float _t) + inline BX_CONST_FUNC float easeOutQuart(float _t) { return easeOut(_t); } - inline float easeInOutQuart(float _t) + inline BX_CONST_FUNC float easeInOutQuart(float _t) { return easeMix(_t); } - inline float easeOutInQuart(float _t) + inline BX_CONST_FUNC float easeOutInQuart(float _t) { return easeMix(_t); } - inline float easeInQuint(float _t) + inline BX_CONST_FUNC float easeInQuint(float _t) { return _t*_t*_t*_t*_t; } - inline float easeOutQuint(float _t) + inline BX_CONST_FUNC float easeOutQuint(float _t) { return easeOut(_t); } - inline float easeInOutQuint(float _t) + inline BX_CONST_FUNC float easeInOutQuint(float _t) { return easeMix(_t); } - inline float easeOutInQuint(float _t) + inline BX_CONST_FUNC float easeOutInQuint(float _t) { return easeMix(_t); } - inline float easeInSine(float _t) + inline BX_CONST_FUNC float easeInSine(float _t) { - return 1.0f - fcos(_t*kPiHalf); + return 1.0f - cos(_t*kPiHalf); } - inline float easeOutSine(float _t) + inline BX_CONST_FUNC float easeOutSine(float _t) { return easeOut(_t); } - inline float easeInOutSine(float _t) + inline BX_CONST_FUNC float easeInOutSine(float _t) { return easeMix(_t); } - inline float easeOutInSine(float _t) + inline BX_CONST_FUNC float easeOutInSine(float _t) { return easeMix(_t); } - inline float easeInExpo(float _t) + inline BX_CONST_FUNC float easeInExpo(float _t) { - return fpow(2.0f, 10.0f * (_t - 1.0f) ) - 0.001f; + return pow(2.0f, 10.0f * (_t - 1.0f) ) - 0.001f; } - inline float easeOutExpo(float _t) + inline BX_CONST_FUNC float easeOutExpo(float _t) { return easeOut(_t); } - inline float easeInOutExpo(float _t) + inline BX_CONST_FUNC float easeInOutExpo(float _t) { return easeMix(_t); } - inline float easeOutInExpo(float _t) + inline BX_CONST_FUNC float easeOutInExpo(float _t) { return easeMix(_t); } - inline float easeInCirc(float _t) + inline BX_CONST_FUNC float easeInCirc(float _t) { - return -(fsqrt(1.0f - _t*_t) - 1.0f); + return -(sqrt(1.0f - _t*_t) - 1.0f); } - inline float easeOutCirc(float _t) + inline BX_CONST_FUNC float easeOutCirc(float _t) { return easeOut(_t); } - inline float easeInOutCirc(float _t) + inline BX_CONST_FUNC float easeInOutCirc(float _t) { return easeMix(_t); } - inline float easeOutInCirc(float _t) + inline BX_CONST_FUNC float easeOutInCirc(float _t) { return easeMix(_t); } - inline float easeOutElastic(float _t) + inline BX_CONST_FUNC float easeOutElastic(float _t) { - return fpow(2.0f, -10.0f*_t)*fsin( (_t-0.3f/4.0f)*(2.0f*kPi)/0.3f) + 1.0f; + return pow(2.0f, -10.0f*_t)*sin( (_t-0.3f/4.0f)*(2.0f*kPi)/0.3f) + 1.0f; } - inline float easeInElastic(float _t) + inline BX_CONST_FUNC float easeInElastic(float _t) { return easeOut(_t); } - inline float easeInOutElastic(float _t) + inline BX_CONST_FUNC float easeInOutElastic(float _t) { return easeMix(_t); } - inline float easeOutInElastic(float _t) + inline BX_CONST_FUNC float easeOutInElastic(float _t) { return easeMix(_t); } - inline float easeInBack(float _t) + inline BX_CONST_FUNC float easeInBack(float _t) { - return easeInCubic(_t) - _t*fsin(_t*kPi); + return easeInCubic(_t) - _t*sin(_t*kPi); } - inline float easeOutBack(float _t) + inline BX_CONST_FUNC float easeOutBack(float _t) { return easeOut(_t); } - inline float easeInOutBack(float _t) + inline BX_CONST_FUNC float easeInOutBack(float _t) { return easeMix(_t); } - inline float easeOutInBack(float _t) + inline BX_CONST_FUNC float easeOutInBack(float _t) { return easeMix(_t); } - inline float easeOutBounce(float _t) + inline BX_CONST_FUNC float easeOutBounce(float _t) { if (4.0f/11.0f > _t) { @@ -248,17 +252,17 @@ namespace bx ; } - inline float easeInBounce(float _t) + inline BX_CONST_FUNC float easeInBounce(float _t) { return easeOut(_t); } - inline float easeInOutBounce(float _t) + inline BX_CONST_FUNC float easeInOutBounce(float _t) { return easeMix(_t); } - inline float easeOutInBounce(float _t) + inline BX_CONST_FUNC float easeOutInBounce(float _t) { return easeMix(_t); } diff --git a/3rdparty/bx/include/bx/inline/endian.inl b/3rdparty/bx/include/bx/inline/endian.inl index 6ec7572c71c..332e2b6102a 100644 --- a/3rdparty/bx/include/bx/inline/endian.inl +++ b/3rdparty/bx/include/bx/inline/endian.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/error.inl b/3rdparty/bx/include/bx/inline/error.inl index ac16c6f9841..af5c31a1991 100644 --- a/3rdparty/bx/include/bx/inline/error.inl +++ b/3rdparty/bx/include/bx/inline/error.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/float4x4_t.inl b/3rdparty/bx/include/bx/inline/float4x4_t.inl index ea6873b5065..222c111c361 100644 --- a/3rdparty/bx/include/bx/inline/float4x4_t.inl +++ b/3rdparty/bx/include/bx/inline/float4x4_t.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/handlealloc.inl b/3rdparty/bx/include/bx/inline/handlealloc.inl index 3ca3d41ed57..3bb364b66b3 100644 --- a/3rdparty/bx/include/bx/inline/handlealloc.inl +++ b/3rdparty/bx/include/bx/inline/handlealloc.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/hash.inl b/3rdparty/bx/include/bx/inline/hash.inl index 41031bbab2b..18bee143c70 100644 --- a/3rdparty/bx/include/bx/inline/hash.inl +++ b/3rdparty/bx/include/bx/inline/hash.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -188,7 +188,7 @@ namespace bx template inline uint32_t hash(const Ty& _data) { - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); return hash(&_data, sizeof(Ty) ); } diff --git a/3rdparty/bx/include/bx/inline/math.inl b/3rdparty/bx/include/bx/inline/math.inl index d6b8c57523a..29c88797e94 100644 --- a/3rdparty/bx/include/bx/inline/math.inl +++ b/3rdparty/bx/include/bx/inline/math.inl @@ -1,54 +1,57 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ // FPU math lib -#ifndef BX_FPU_MATH_H_HEADER_GUARD -# error "Must be included from bx/fpumath.h!" -#endif // BX_FPU_MATH_H_HEADER_GUARD +#ifndef BX_MATH_H_HEADER_GUARD +# error "Must be included from bx/math.h!" +#endif // BX_MATH_H_HEADER_GUARD + +#include namespace bx { - inline float toRad(float _deg) + inline BX_CONST_FUNC float toRad(float _deg) { return _deg * kPi / 180.0f; } - inline float toDeg(float _rad) + inline BX_CONST_FUNC float toDeg(float _rad) { return _rad * 180.0f / kPi; } - inline uint32_t floatToBits(float _a) + inline BX_CONST_FUNC uint32_t floatToBits(float _a) { union { float f; uint32_t ui; } u = { _a }; return u.ui; } - inline float bitsToFloat(uint32_t _a) + inline BX_CONST_FUNC float bitsToFloat(uint32_t _a) { union { uint32_t ui; float f; } u = { _a }; return u.f; } - inline uint64_t doubleToBits(double _a) + inline BX_CONST_FUNC uint64_t doubleToBits(double _a) { union { double f; uint64_t ui; } u = { _a }; return u.ui; } - inline double bitsToDouble(uint64_t _a) + inline BX_CONST_FUNC double bitsToDouble(uint64_t _a) { union { uint64_t ui; double f; } u = { _a }; return u.f; } - inline uint32_t floatFlip(uint32_t _value) + inline BX_CONST_FUNC uint32_t floatFlip(uint32_t _value) { - // Reference: - // http://archive.fo/2012.12.08-212402/http://stereopsis.com/radix.html + // Reference(s): + // - http://archive.fo/2012.12.08-212402/http://stereopsis.com/radix.html + // const uint32_t tmp0 = uint32_sra(_value, 31); const uint32_t tmp1 = uint32_neg(tmp0); const uint32_t mask = uint32_or(tmp1, 0x80000000); @@ -56,197 +59,521 @@ namespace bx return result; } - inline bool isNan(float _f) + inline BX_CONST_FUNC bool isNan(float _f) { const uint32_t tmp = floatToBits(_f) & INT32_MAX; return tmp > UINT32_C(0x7f800000); } - inline bool isNan(double _f) + inline BX_CONST_FUNC bool isNan(double _f) { const uint64_t tmp = doubleToBits(_f) & INT64_MAX; return tmp > UINT64_C(0x7ff0000000000000); } - inline bool isFinite(float _f) + inline BX_CONST_FUNC bool isFinite(float _f) { const uint32_t tmp = floatToBits(_f) & INT32_MAX; return tmp < UINT32_C(0x7f800000); } - inline bool isFinite(double _f) + inline BX_CONST_FUNC bool isFinite(double _f) { const uint64_t tmp = doubleToBits(_f) & INT64_MAX; return tmp < UINT64_C(0x7ff0000000000000); } - inline bool isInfinite(float _f) + inline BX_CONST_FUNC bool isInfinite(float _f) { const uint32_t tmp = floatToBits(_f) & INT32_MAX; return tmp == UINT32_C(0x7f800000); } - inline bool isInfinite(double _f) + inline BX_CONST_FUNC bool isInfinite(double _f) { const uint64_t tmp = doubleToBits(_f) & INT64_MAX; return tmp == UINT64_C(0x7ff0000000000000); } - inline float fround(float _f) + inline BX_CONST_FUNC float round(float _f) { - return ffloor(_f + 0.5f); + return floor(_f + 0.5f); } - inline float fmin(float _a, float _b) + inline BX_CONST_FUNC float ceil(float _a) { - return _a < _b ? _a : _b; + return -floor(-_a); } - inline float fmax(float _a, float _b) - { - return _a > _b ? _a : _b; - } - - inline float fmin3(float _a, float _b, float _c) - { - return fmin(_a, fmin(_b, _c) ); - } - - inline float fmax3(float _a, float _b, float _c) - { - return fmax(_a, fmax(_b, _c) ); - } - - inline float fclamp(float _a, float _min, float _max) - { - return fmin(fmax(_a, _min), _max); - } - - inline float fsaturate(float _a) - { - return fclamp(_a, 0.0f, 1.0f); - } - - inline float flerp(float _a, float _b, float _t) + inline BX_CONSTEXPR_FUNC float lerp(float _a, float _b, float _t) { return _a + (_b - _a) * _t; } - inline float fsign(float _a) + inline BX_CONSTEXPR_FUNC float sign(float _a) { return _a < 0.0f ? -1.0f : 1.0f; } - inline float fsq(float _a) + inline BX_CONSTEXPR_FUNC float abs(float _a) + { + return _a < 0.0f ? -_a : _a; + } + + inline BX_CONSTEXPR_FUNC float square(float _a) { return _a * _a; } - inline float fexp2(float _a) + inline BX_CONST_FUNC float sin(float _a) { - return fpow(2.0f, _a); + return cos(_a - kPiHalf); } - inline float flog2(float _a) + inline BX_CONST_FUNC float sinh(float _a) { - return flog(_a) * kInvLogNat2; + return 0.5f*(exp(_a) - exp(-_a) ); } - inline float frsqrt(float _a) + inline BX_CONST_FUNC float asin(float _a) { - return 1.0f/fsqrt(_a); + return kPiHalf - acos(_a); } - inline float ffract(float _a) + inline BX_CONST_FUNC float cosh(float _a) { - return _a - ffloor(_a); + return 0.5f*(exp(_a) + exp(-_a) ); } - inline bool fequal(float _a, float _b, float _epsilon) + inline BX_CONST_FUNC float tan(float _a) { - // http://realtimecollisiondetection.net/blog/?p=89 - const float lhs = fabs(_a - _b); - const float rhs = _epsilon * fmax3(1.0f, fabs(_a), fabs(_b) ); - return lhs <= rhs; + return sin(_a) / cos(_a); } - inline bool fequal(const float* _a, const float* _b, uint32_t _num, float _epsilon) + inline BX_CONST_FUNC float tanh(float _a) { - bool equal = fequal(_a[0], _b[0], _epsilon); - for (uint32_t ii = 1; equal && ii < _num; ++ii) - { - equal = fequal(_a[ii], _b[ii], _epsilon); - } - return equal; - } + const float tmp0 = exp(2.0f*_a); + const float tmp1 = tmp0 - 1.0f; + const float tmp2 = tmp0 + 1.0f; + const float result = tmp1 / tmp2; - inline float fwrap(float _a, float _wrap) - { - const float mod = fmod(_a, _wrap); - const float result = mod < 0.0f ? _wrap + mod : mod; return result; } - inline float fstep(float _edge, float _a) + inline BX_CONST_FUNC float atan(float _a) + { + return atan2(_a, 1.0f); + } + + inline BX_CONST_FUNC float pow(float _a, float _b) + { + return exp(_b * log(_a) ); + } + + inline BX_CONST_FUNC float exp2(float _a) + { + return pow(2.0f, _a); + } + + inline BX_CONST_FUNC float log2(float _a) + { + return log(_a) * kInvLogNat2; + } + + inline BX_CONST_FUNC float rsqrtRef(float _a) + { + return pow(_a, -0.5f); + } + + inline BX_CONST_FUNC float sqrtRef(float _a) + { + if (_a < kNearZero) + { + return 0.0f; + } + + return 1.0f/rsqrtRef(_a); + } + + inline BX_CONST_FUNC float sqrtSimd(float _a) + { + const simd128_t aa = simd_splat(_a); + const simd128_t sqrta = simd_sqrt(aa); + float result; + simd_stx(&result, sqrta); + + return result; + } + + inline BX_CONST_FUNC float sqrt(float _a) + { +#if BX_CONFIG_SUPPORTS_SIMD + return sqrtSimd(_a); +#else + return sqrtRef(_a); +#endif // BX_CONFIG_SUPPORTS_SIMD + } + + inline BX_CONST_FUNC float rsqrtSimd(float _a) + { + if (_a < kNearZero) + { + return 0.0f; + } + + const simd128_t aa = simd_splat(_a); + const simd128_t rsqrta = simd_rsqrt_nr(aa); + float result; + simd_stx(&result, rsqrta); + + return result; + } + + inline BX_CONST_FUNC float rsqrt(float _a) + { +#if BX_CONFIG_SUPPORTS_SIMD + return rsqrtSimd(_a); +#else + return rsqrtRef(_a); +#endif // BX_CONFIG_SUPPORTS_SIMD + } + + inline BX_CONSTEXPR_FUNC float trunc(float _a) + { + return float(int(_a) ); + } + + inline BX_CONSTEXPR_FUNC float fract(float _a) + { + return _a - trunc(_a); + } + + inline BX_CONSTEXPR_FUNC float mad(float _a, float _b, float _c) + { + return _a * _b + _c; + } + + inline BX_CONST_FUNC float mod(float _a, float _b) + { + return _a - _b * floor(_a / _b); + } + + inline BX_CONSTEXPR_FUNC bool equal(float _a, float _b, float _epsilon) + { + // Reference(s): + // - https://web.archive.org/web/20181103180318/http://realtimecollisiondetection.net/blog/?p=89 + // + const float lhs = abs(_a - _b); + const float rhs = _epsilon * max(1.0f, abs(_a), abs(_b) ); + return lhs <= rhs; + } + + inline BX_CONST_FUNC bool equal(const float* _a, const float* _b, uint32_t _num, float _epsilon) + { + bool result = equal(_a[0], _b[0], _epsilon); + for (uint32_t ii = 1; result && ii < _num; ++ii) + { + result = equal(_a[ii], _b[ii], _epsilon); + } + return result; + } + + inline BX_CONST_FUNC float wrap(float _a, float _wrap) + { + const float tmp0 = mod(_a, _wrap); + const float result = tmp0 < 0.0f ? _wrap + tmp0 : tmp0; + return result; + } + + inline BX_CONSTEXPR_FUNC float step(float _edge, float _a) { return _a < _edge ? 0.0f : 1.0f; } - inline float fpulse(float _a, float _start, float _end) + inline BX_CONSTEXPR_FUNC float pulse(float _a, float _start, float _end) { - return fstep(_a, _start) - fstep(_a, _end); + return step(_a, _start) - step(_a, _end); } - inline float fsmoothstep(float _a) + inline BX_CONSTEXPR_FUNC float smoothStep(float _a) { - return fsq(_a)*(3.0f - 2.0f*_a); + return square(_a)*(3.0f - 2.0f*_a); } - inline float fbias(float _time, float _bias) + inline BX_CONSTEXPR_FUNC float bias(float _time, float _bias) { return _time / ( ( (1.0f/_bias - 2.0f)*(1.0f - _time) ) + 1.0f); } - inline float fgain(float _time, float _gain) + inline BX_CONSTEXPR_FUNC float gain(float _time, float _gain) { + // Reference(s): + // - Bias And Gain Are Your Friend + // https://web.archive.org/web/20181126040535/https://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/ + // https://web.archive.org/web/20181126040558/http://demofox.org/biasgain.html + // if (_time < 0.5f) { - return fbias(_time * 2.0f, _gain) * 0.5f; + return bias(_time * 2.0f, _gain) * 0.5f; } - return fbias(_time * 2.0f - 1.0f, 1.0f - _gain) * 0.5f + 0.5f; + return bias(_time * 2.0f - 1.0f, 1.0f - _gain) * 0.5f + 0.5f; } - inline float angleDiff(float _a, float _b) + inline BX_CONST_FUNC float angleDiff(float _a, float _b) { - const float dist = fwrap(_b - _a, kPi2); - return fwrap(dist*2.0f, kPi2) - dist; + const float dist = wrap(_b - _a, kPi2); + return wrap(dist*2.0f, kPi2) - dist; } - inline float angleLerp(float _a, float _b, float _t) + inline BX_CONST_FUNC float angleLerp(float _a, float _b, float _t) { return _a + angleDiff(_a, _b) * _t; } - inline void vec3Move(float* _result, const float* _a) + inline Vec3 load(const void* _ptr) { - _result[0] = _a[0]; - _result[1] = _a[1]; - _result[2] = _a[2]; + const float* ptr = reinterpret_cast(_ptr); + return + { + ptr[0], + ptr[1], + ptr[2], + }; } - inline void vec3Abs(float* _result, const float* _a) + inline void store(void* _ptr, const Vec3& _a) { - _result[0] = fabs(_a[0]); - _result[1] = fabs(_a[1]); - _result[2] = fabs(_a[2]); + float* ptr = reinterpret_cast(_ptr); + ptr[0] = _a.x; + ptr[1] = _a.y; + ptr[2] = _a.z; } - inline void vec3Neg(float* _result, const float* _a) + inline BX_CONSTEXPR_FUNC Vec3 abs(const Vec3& _a) { - _result[0] = -_a[0]; - _result[1] = -_a[1]; - _result[2] = -_a[2]; + return + { + abs(_a.x), + abs(_a.y), + abs(_a.z), + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 neg(const Vec3& _a) + { + return + { + -_a.x, + -_a.y, + -_a.z, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 add(const Vec3& _a, const Vec3& _b) + { + return + { + _a.x + _b.x, + _a.y + _b.y, + _a.z + _b.z, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 add(const Vec3& _a, float _b) + { + return + { + _a.x + _b, + _a.y + _b, + _a.z + _b, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 sub(const Vec3& _a, const Vec3& _b) + { + return + { + _a.x - _b.x, + _a.y - _b.y, + _a.z - _b.z, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 sub(const Vec3& _a, float _b) + { + return + { + _a.x - _b, + _a.y - _b, + _a.z - _b, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 mul(const Vec3& _a, const Vec3& _b) + { + return + { + _a.x * _b.x, + _a.y * _b.y, + _a.z * _b.z, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 mul(const Vec3& _a, float _b) + { + return + { + _a.x * _b, + _a.y * _b, + _a.z * _b, + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 mad(const Vec3& _a, const Vec3& _b, const Vec3& _c) + { + return add(mul(_a, _b), _c); + } + + inline BX_CONSTEXPR_FUNC float dot(const Vec3& _a, const Vec3& _b) + { + return _a.x*_b.x + _a.y*_b.y + _a.z*_b.z; + } + + inline BX_CONSTEXPR_FUNC Vec3 cross(const Vec3& _a, const Vec3& _b) + { + return + { + _a.y*_b.z - _a.z*_b.y, + _a.z*_b.x - _a.x*_b.z, + _a.x*_b.y - _a.y*_b.x, + }; + } + + inline BX_CONST_FUNC float length(const Vec3& _a) + { + return sqrt(dot(_a, _a) ); + } + + inline BX_CONSTEXPR_FUNC Vec3 lerp(const Vec3& _a, const Vec3& _b, float _t) + { + return + { + lerp(_a.x, _b.x, _t), + lerp(_a.y, _b.y, _t), + lerp(_a.z, _b.z, _t), + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 lerp(const Vec3& _a, const Vec3& _b, const Vec3& _t) + { + return + { + lerp(_a.x, _b.x, _t.x), + lerp(_a.y, _b.y, _t.y), + lerp(_a.z, _b.z, _t.z), + }; + } + + inline BX_CONST_FUNC Vec3 normalize(const Vec3& _a) + { + const float invLen = 1.0f/length(_a); + const Vec3 result = mul(_a, invLen); + return result; + } + + inline BX_CONSTEXPR_FUNC Vec3 min(const Vec3& _a, const Vec3& _b) + { + return + { + min(_a.x, _b.x), + min(_a.y, _b.y), + min(_a.z, _b.z), + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 max(const Vec3& _a, const Vec3& _b) + { + return + { + max(_a.x, _b.x), + max(_a.y, _b.y), + max(_a.z, _b.z), + }; + } + + inline BX_CONSTEXPR_FUNC Vec3 rcp(const Vec3& _a) + { + return + { + 1.0f / _a.x, + 1.0f / _a.y, + 1.0f / _a.z, + }; + } + + inline void calcTangentFrame(Vec3& _outT, Vec3& _outB, const Vec3& _n) + { + const float nx = _n.x; + const float ny = _n.y; + const float nz = _n.z; + + if (abs(nx) > abs(nz) ) + { + float invLen = 1.0f / sqrt(nx*nx + nz*nz); + _outT.x = -nz * invLen; + _outT.y = 0.0f; + _outT.z = nx * invLen; + } + else + { + float invLen = 1.0f / sqrt(ny*ny + nz*nz); + _outT.x = 0.0f; + _outT.y = nz * invLen; + _outT.z = -ny * invLen; + } + + _outB = cross(_n, _outT); + } + + inline void calcTangentFrame(Vec3& _outT, Vec3& _outB, const Vec3& _n, float _angle) + { + calcTangentFrame(_outT, _outB, _n); + + const float sa = sin(_angle); + const float ca = cos(_angle); + + _outT.x = -sa * _outB.x + ca * _outT.x; + _outT.y = -sa * _outB.y + ca * _outT.y; + _outT.z = -sa * _outB.z + ca * _outT.z; + + _outB = cross(_n, _outT); + } + + inline BX_CONST_FUNC Vec3 fromLatLong(float _u, float _v) + { + Vec3 result; + const float phi = _u * kPi2; + const float theta = _v * kPi; + + const float st = sin(theta); + const float sp = sin(phi); + const float ct = cos(theta); + const float cp = cos(phi); + + result.x = -st*sp; + result.y = ct; + result.z = -st*cp; + return result; + } + + inline void toLatLong(float* _outU, float* _outV, const Vec3& _dir) + { + const float phi = atan2(_dir.x, _dir.z); + const float theta = acos(_dir.y); + + *_outU = (bx::kPi + phi)/bx::kPi2; + *_outV = theta*bx::kInvPi; } inline void vec3Add(float* _result, const float* _a, const float* _b) @@ -256,13 +583,6 @@ namespace bx _result[2] = _a[2] + _b[2]; } - inline void vec3Add(float* _result, const float* _a, float _b) - { - _result[0] = _a[0] + _b; - _result[1] = _a[1] + _b; - _result[2] = _a[2] + _b; - } - inline void vec3Sub(float* _result, const float* _a, const float* _b) { _result[0] = _a[0] - _b[0]; @@ -270,13 +590,6 @@ namespace bx _result[2] = _a[2] - _b[2]; } - inline void vec3Sub(float* _result, const float* _a, float _b) - { - _result[0] = _a[0] - _b; - _result[1] = _a[1] - _b; - _result[2] = _a[2] - _b; - } - inline void vec3Mul(float* _result, const float* _a, const float* _b) { _result[0] = _a[0] * _b[0]; @@ -305,21 +618,7 @@ namespace bx inline float vec3Length(const float* _a) { - return fsqrt(vec3Dot(_a, _a) ); - } - - inline void vec3Lerp(float* _result, const float* _a, const float* _b, float _t) - { - _result[0] = flerp(_a[0], _b[0], _t); - _result[1] = flerp(_a[1], _b[1], _t); - _result[2] = flerp(_a[2], _b[2], _t); - } - - inline void vec3Lerp(float* _result, const float* _a, const float* _b, const float* _c) - { - _result[0] = flerp(_a[0], _b[0], _c[0]); - _result[1] = flerp(_a[1], _b[1], _c[1]); - _result[2] = flerp(_a[2], _b[2], _c[2]); + return sqrt(vec3Dot(_a, _a) ); } inline float vec3Norm(float* _result, const float* _a) @@ -332,87 +631,66 @@ namespace bx return len; } - inline void vec3Min(float* _result, const float* _a, const float* _b) - { - _result[0] = fmin(_a[0], _b[0]); - _result[1] = fmin(_a[1], _b[1]); - _result[2] = fmin(_a[2], _b[2]); - } - - inline void vec3Max(float* _result, const float* _a, const float* _b) - { - _result[0] = fmax(_a[0], _b[0]); - _result[1] = fmax(_a[1], _b[1]); - _result[2] = fmax(_a[2], _b[2]); - } - - inline void vec3Rcp(float* _result, const float* _a) - { - _result[0] = 1.0f / _a[0]; - _result[1] = 1.0f / _a[1]; - _result[2] = 1.0f / _a[2]; - } - inline void vec3TangentFrame(const float* _n, float* _t, float* _b) { const float nx = _n[0]; const float ny = _n[1]; const float nz = _n[2]; - if (bx::fabs(nx) > bx::fabs(nz) ) + if (abs(nx) > abs(nz) ) { - float invLen = 1.0f / bx::fsqrt(nx*nx + nz*nz); + float invLen = 1.0f / sqrt(nx*nx + nz*nz); _t[0] = -nz * invLen; _t[1] = 0.0f; _t[2] = nx * invLen; } else { - float invLen = 1.0f / bx::fsqrt(ny*ny + nz*nz); + float invLen = 1.0f / sqrt(ny*ny + nz*nz); _t[0] = 0.0f; _t[1] = nz * invLen; _t[2] = -ny * invLen; } - bx::vec3Cross(_b, _n, _t); + vec3Cross(_b, _n, _t); } inline void vec3TangentFrame(const float* _n, float* _t, float* _b, float _angle) { vec3TangentFrame(_n, _t, _b); - const float sa = fsin(_angle); - const float ca = fcos(_angle); + const float sa = sin(_angle); + const float ca = cos(_angle); _t[0] = -sa * _b[0] + ca * _t[0]; _t[1] = -sa * _b[1] + ca * _t[1]; _t[2] = -sa * _b[2] + ca * _t[2]; - bx::vec3Cross(_b, _n, _t); + vec3Cross(_b, _n, _t); } inline void vec3FromLatLong(float* _vec, float _u, float _v) { - const float phi = _u * bx::kPi2; - const float theta = _v * bx::kPi; + const float phi = _u * kPi2; + const float theta = _v * kPi; - const float st = bx::fsin(theta); - const float sp = bx::fsin(phi); - const float ct = bx::fcos(theta); - const float cp = bx::fcos(phi); + const float st = sin(theta); + const float sp = sin(phi); + const float ct = cos(theta); + const float cp = cos(phi); _vec[0] = -st*sp; - _vec[1] = ct; + _vec[1] = ct; _vec[2] = -st*cp; } - inline void vec3ToLatLong(float* _u, float* _v, const float* _vec) + inline void vec3ToLatLong(float* _outU, float* _outV, const float* _dir) { - const float phi = bx::fatan2(_vec[0], _vec[2]); - const float theta = bx::facos(_vec[1]); + const float phi = atan2(_dir[0], _dir[2]); + const float theta = acos(_dir[1]); - *_u = (bx::kPi + phi)*bx::kInvPi*0.5f; - *_v = theta*bx::kInvPi; + *_outU = (bx::kPi + phi)/bx::kPi2; + *_outV = theta*bx::kInvPi; } inline void quatIdentity(float* _result) @@ -488,7 +766,7 @@ namespace bx const float norm = quatDot(_quat, _quat); if (0.0f < norm) { - const float invNorm = 1.0f / fsqrt(norm); + const float invNorm = 1.0f / sqrt(norm); _result[0] = _quat[0] * invNorm; _result[1] = _quat[1] * invNorm; _result[2] = _quat[2] * invNorm; @@ -511,16 +789,16 @@ namespace bx const float zz = z * z; const float xx = x * x; - _result[0] = fatan2(2.0f * (x * w - y * z), 1.0f - 2.0f * (xx + zz) ); - _result[1] = fatan2(2.0f * (y * w + x * z), 1.0f - 2.0f * (yy + zz) ); - _result[2] = fasin (2.0f * (x * y + z * w) ); + _result[0] = atan2(2.0f * (x * w - y * z), 1.0f - 2.0f * (xx + zz) ); + _result[1] = atan2(2.0f * (y * w + x * z), 1.0f - 2.0f * (yy + zz) ); + _result[2] = asin (2.0f * (x * y + z * w) ); } inline void quatRotateAxis(float* _result, const float* _axis, float _angle) { const float ha = _angle * 0.5f; - const float ca = fcos(ha); - const float sa = fsin(ha); + const float ca = cos(ha); + const float sa = sin(ha); _result[0] = _axis[0] * sa; _result[1] = _axis[1] * sa; _result[2] = _axis[2] * sa; @@ -530,8 +808,8 @@ namespace bx inline void quatRotateX(float* _result, float _ax) { const float hx = _ax * 0.5f; - const float cx = fcos(hx); - const float sx = fsin(hx); + const float cx = cos(hx); + const float sx = sin(hx); _result[0] = sx; _result[1] = 0.0f; _result[2] = 0.0f; @@ -541,8 +819,8 @@ namespace bx inline void quatRotateY(float* _result, float _ay) { const float hy = _ay * 0.5f; - const float cy = fcos(hy); - const float sy = fsin(hy); + const float cy = cos(hy); + const float sy = sin(hy); _result[0] = 0.0f; _result[1] = sy; _result[2] = 0.0f; @@ -552,8 +830,8 @@ namespace bx inline void quatRotateZ(float* _result, float _az) { const float hz = _az * 0.5f; - const float cz = fcos(hz); - const float sz = fsin(hz); + const float cz = cos(hz); + const float sz = sin(hz); _result[0] = 0.0f; _result[1] = 0.0f; _result[2] = sz; @@ -702,6 +980,42 @@ namespace bx mtxQuatTranslation(_result, quat, _translation); } + inline Vec3 mul(const Vec3& _vec, const float* _mat) + { + Vec3 result; + result.x = _vec.x * _mat[0] + _vec.y * _mat[4] + _vec.z * _mat[ 8] + _mat[12]; + result.y = _vec.x * _mat[1] + _vec.y * _mat[5] + _vec.z * _mat[ 9] + _mat[13]; + result.z = _vec.x * _mat[2] + _vec.y * _mat[6] + _vec.z * _mat[10] + _mat[14]; + return result; + } + + inline Vec3 mulXyz0(const Vec3& _vec, const float* _mat) + { + Vec3 result; + result.x = _vec.x * _mat[0] + _vec.y * _mat[4] + _vec.z * _mat[ 8]; + result.y = _vec.x * _mat[1] + _vec.y * _mat[5] + _vec.z * _mat[ 9]; + result.z = _vec.x * _mat[2] + _vec.y * _mat[6] + _vec.z * _mat[10]; + return result; + } + + inline Vec3 mulH(const Vec3& _vec, const float* _mat) + { + const float xx = _vec.x * _mat[0] + _vec.y * _mat[4] + _vec.z * _mat[ 8] + _mat[12]; + const float yy = _vec.x * _mat[1] + _vec.y * _mat[5] + _vec.z * _mat[ 9] + _mat[13]; + const float zz = _vec.x * _mat[2] + _vec.y * _mat[6] + _vec.z * _mat[10] + _mat[14]; + const float ww = _vec.x * _mat[3] + _vec.y * _mat[7] + _vec.z * _mat[11] + _mat[15]; + const float invW = sign(ww) / ww; + + Vec3 result = + { + xx * invW, + yy * invW, + zz * invW, + }; + + return result; + } + inline void vec3MulMtx(float* _result, const float* _vec, const float* _mat) { _result[0] = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _mat[12]; @@ -722,12 +1036,28 @@ namespace bx float yy = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _mat[13]; float zz = _vec[0] * _mat[ 2] + _vec[1] * _mat[6] + _vec[2] * _mat[10] + _mat[14]; float ww = _vec[0] * _mat[ 3] + _vec[1] * _mat[7] + _vec[2] * _mat[11] + _mat[15]; - float invW = fsign(ww)/ww; + float invW = sign(ww)/ww; _result[0] = xx*invW; _result[1] = yy*invW; _result[2] = zz*invW; } + inline void vec4Mul(float* _result, const float* _a, const float* _b) + { + _result[0] = _a[0] * _b[0]; + _result[1] = _a[1] * _b[1]; + _result[2] = _a[2] * _b[2]; + _result[3] = _a[3] * _b[3]; + } + + inline void vec4Mul(float* _result, const float* _a, float _b) + { + _result[0] = _a[0] * _b; + _result[1] = _a[1] * _b; + _result[2] = _a[2] * _b; + _result[3] = _a[3] * _b; + } + inline void vec4MulMtx(float* _result, const float* _vec, const float* _mat) { _result[0] = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _vec[3] * _mat[12]; @@ -806,7 +1136,7 @@ namespace bx _dst[15] = _src[15]; } - inline void calcNormal(float _result[3], float _va[3], float _vb[3], float _vc[3]) + inline void calcNormal(float _result[3], const float _va[3], const float _vb[3], const float _vc[3]) { float ba[3]; vec3Sub(ba, _vb, _va); @@ -820,15 +1150,35 @@ namespace bx vec3Norm(_result, baxca); } - inline void calcPlane(float _result[4], float _va[3], float _vb[3], float _vc[3]) + inline void calcPlane(float _result[4], const float _va[3], const float _vb[3], const float _vc[3]) { float normal[3]; calcNormal(normal, _va, _vb, _vc); + calcPlane(_result, normal, _va); + } - _result[0] = normal[0]; - _result[1] = normal[1]; - _result[2] = normal[2]; - _result[3] = -vec3Dot(normal, _va); + inline void calcPlane(float _result[4], const float _normal[3], const float _pos[3]) + { + _result[0] = _normal[0]; + _result[1] = _normal[1]; + _result[2] = _normal[2]; + _result[3] = -vec3Dot(_normal, _pos); + } + + inline BX_CONST_FUNC float toLinear(float _a) + { + const float lo = _a / 12.92f; + const float hi = pow( (_a + 0.055f) / 1.055f, 2.4f); + const float result = lerp(hi, lo, _a <= 0.04045f); + return result; + } + + inline BX_CONST_FUNC float toGamma(float _a) + { + const float lo = _a * 12.92f; + const float hi = pow(abs(_a), 1.0f/2.4f) * 1.055f - 0.055f; + const float result = lerp(hi, lo, _a <= 0.0031308f); + return result; } } // namespace bx diff --git a/3rdparty/bx/include/bx/inline/mpscqueue.inl b/3rdparty/bx/include/bx/inline/mpscqueue.inl index 7a336788607..a22cf283815 100644 --- a/3rdparty/bx/include/bx/inline/mpscqueue.inl +++ b/3rdparty/bx/include/bx/inline/mpscqueue.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/mutex.inl b/3rdparty/bx/include/bx/inline/mutex.inl index 0d086bdc94c..971ebcaa6a8 100644 --- a/3rdparty/bx/include/bx/inline/mutex.inl +++ b/3rdparty/bx/include/bx/inline/mutex.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/pixelformat.inl b/3rdparty/bx/include/bx/inline/pixelformat.inl index 682417d7162..8ac02813521 100644 --- a/3rdparty/bx/include/bx/inline/pixelformat.inl +++ b/3rdparty/bx/include/bx/inline/pixelformat.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -11,7 +11,7 @@ namespace bx { inline uint32_t toUnorm(float _value, float _scale) { - return uint32_t(fround(fsaturate(_value) * _scale) ); + return uint32_t(round(clamp(_value, 0.0f, 1.0f) * _scale) ); } inline float fromUnorm(uint32_t _value, float _scale) @@ -21,14 +21,14 @@ namespace bx inline int32_t toSnorm(float _value, float _scale) { - return int32_t(fround( - fclamp(_value, -1.0f, 1.0f) * _scale) + return int32_t(round( + clamp(_value, -1.0f, 1.0f) * _scale) ); } inline float fromSnorm(int32_t _value, float _scale) { - return fmax(-1.0f, float(_value) / _scale); + return max(-1.0f, float(_value) / _scale); } // R8 @@ -707,30 +707,31 @@ namespace bx template inline void encodeRgbE(float* _dst, const float* _src) { - // Reference: - // https://www.opengl.org/registry/specs/EXT/texture_shared_exponent.txt + // Reference(s): + // - https://web.archive.org/web/20181126040035/https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_shared_exponent.txt + // const int32_t expMax = (1<>23) & 0xff) - 127) ) ) + 1 + expBias; - float denom = fpow(2.0f, float(expShared - expBias - MantissaBits) ); + float denom = pow(2.0f, float(expShared - expBias - MantissaBits) ); - if ( (1<(_offset, 0, m_top); break; case Whence::Current: - m_pos = int64_clamp(m_pos + _offset, 0, m_top); + m_pos = clamp(m_pos + _offset, 0, m_top); break; case Whence::End: - m_pos = int64_clamp(m_top - _offset, 0, m_top); + m_pos = clamp(m_top - _offset, 0, m_top); break; } @@ -128,7 +128,7 @@ namespace bx } int64_t remainder = m_top-m_pos; - int32_t size = uint32_min(_size, uint32_t(int64_min(remainder, INT32_MAX) ) ); + int32_t size = uint32_min(_size, uint32_t(min(remainder, INT32_MAX) ) ); m_pos += size; if (size != _size) { @@ -153,15 +153,15 @@ namespace bx switch (_whence) { case Whence::Begin: - m_pos = int64_clamp(_offset, 0, m_top); + m_pos = clamp(_offset, 0, m_top); break; case Whence::Current: - m_pos = int64_clamp(m_pos + _offset, 0, m_top); + m_pos = clamp(m_pos + _offset, 0, m_top); break; case Whence::End: - m_pos = int64_clamp(m_top - _offset, 0, m_top); + m_pos = clamp(m_top - _offset, 0, m_top); break; } @@ -173,7 +173,7 @@ namespace bx BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); int64_t remainder = m_top-m_pos; - int32_t size = uint32_min(_size, uint32_t(int64_min(remainder, INT32_MAX) ) ); + int32_t size = uint32_min(_size, uint32_t(min(remainder, INT32_MAX) ) ); memCopy(_data, &m_data[m_pos], size); m_pos += size; if (size != _size) @@ -216,15 +216,15 @@ namespace bx switch (_whence) { case Whence::Begin: - m_pos = int64_clamp(_offset, 0, m_top); + m_pos = clamp(_offset, 0, m_top); break; case Whence::Current: - m_pos = int64_clamp(m_pos + _offset, 0, m_top); + m_pos = clamp(m_pos + _offset, 0, m_top); break; case Whence::End: - m_pos = int64_clamp(m_top - _offset, 0, m_top); + m_pos = clamp(m_top - _offset, 0, m_top); break; } @@ -245,10 +245,10 @@ namespace bx } int64_t remainder = m_size-m_pos; - int32_t size = uint32_min(_size, uint32_t(int64_min(remainder, INT32_MAX) ) ); + int32_t size = uint32_min(_size, uint32_t(min(remainder, INT32_MAX) ) ); memCopy(&m_data[m_pos], _data, size); m_pos += size; - m_top = int64_max(m_top, m_pos); + m_top = max(m_top, m_pos); if (size != _size) { BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "MemoryWriter: write truncated."); @@ -276,7 +276,7 @@ namespace bx int32_t read(ReaderI* _reader, Ty& _value, Error* _err) { BX_ERROR_SCOPE(_err); - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); return _reader->read(&_value, sizeof(Ty), _err); } @@ -284,7 +284,7 @@ namespace bx int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian, Error* _err) { BX_ERROR_SCOPE(_err); - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); Ty value; int32_t result = _reader->read(&value, sizeof(Ty), _err); _value = toHostEndian(value, _fromLittleEndian); @@ -332,7 +332,7 @@ namespace bx int32_t write(WriterI* _writer, const Ty& _value, Error* _err) { BX_ERROR_SCOPE(_err); - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); return _writer->write(&_value, sizeof(Ty), _err); } @@ -340,7 +340,7 @@ namespace bx int32_t writeLE(WriterI* _writer, const Ty& _value, Error* _err) { BX_ERROR_SCOPE(_err); - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); Ty value = toLittleEndian(_value); int32_t result = _writer->write(&value, sizeof(Ty), _err); return result; @@ -350,34 +350,12 @@ namespace bx int32_t writeBE(WriterI* _writer, const Ty& _value, Error* _err) { BX_ERROR_SCOPE(_err); - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); Ty value = toBigEndian(_value); int32_t result = _writer->write(&value, sizeof(Ty), _err); return result; } - inline int32_t writePrintf(WriterI* _writer, const char* _format, ...) - { - va_list argList; - va_start(argList, _format); - - char temp[2048]; - char* out = temp; - int32_t max = sizeof(temp); - int32_t len = vsnprintf(out, max, _format, argList); - if (len > max) - { - out = (char*)alloca(len); - len = vsnprintf(out, len, _format, argList); - } - - int32_t size = write(_writer, out, len); - - va_end(argList); - - return size; - } - inline int64_t skip(SeekerI* _seeker, int64_t _offset) { return _seeker->seek(_offset, Whence::Current); @@ -417,7 +395,7 @@ namespace bx int32_t peek(ReaderSeekerI* _reader, Ty& _value, Error* _err) { BX_ERROR_SCOPE(_err); - BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) ); + BX_STATIC_ASSERT(isTriviallyCopyable() ); return peek(_reader, &_value, sizeof(Ty), _err); } diff --git a/3rdparty/bx/include/bx/inline/ringbuffer.inl b/3rdparty/bx/include/bx/inline/ringbuffer.inl index 9d8ab942edb..51f365546db 100644 --- a/3rdparty/bx/include/bx/inline/ringbuffer.inl +++ b/3rdparty/bx/include/bx/inline/ringbuffer.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/rng.inl b/3rdparty/bx/include/bx/inline/rng.inl index df6c8262c70..9577bb09aa9 100644 --- a/3rdparty/bx/include/bx/inline/rng.inl +++ b/3rdparty/bx/include/bx/inline/rng.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -60,48 +60,45 @@ namespace bx } template - inline void randUnitCircle(float _result[3], Rng* _rng) + inline bx::Vec3 randUnitCircle(Rng* _rng) { const float angle = frnd(_rng) * kPi2; - _result[0] = fcos(angle); - _result[1] = 0.0f; - _result[2] = fsin(angle); + return + { + cos(angle), + 0.0f, + sin(angle), + }; } template - inline void randUnitSphere(float _result[3], Rng* _rng) + inline bx::Vec3 randUnitSphere(Rng* _rng) { const float rand0 = frnd(_rng) * 2.0f - 1.0f; const float rand1 = frnd(_rng) * kPi2; - const float sqrtf1 = fsqrt(1.0f - rand0*rand0); + const float sqrtf1 = sqrt(1.0f - rand0*rand0); - _result[0] = sqrtf1 * fcos(rand1); - _result[1] = sqrtf1 * fsin(rand1); - _result[2] = rand0; + return + { + sqrtf1 * cos(rand1), + sqrtf1 * sin(rand1), + rand0, + }; } template - inline void randUnitHemisphere(float _result[3], Ty* _rng, const float _normal[3]) + inline bx::Vec3 randUnitHemisphere(Ty* _rng, const bx::Vec3& _normal) { - float dir[3]; - randUnitSphere(dir, _rng); + const bx::Vec3 dir = randUnitSphere(_rng); + const float ddotn = bx::dot(dir, _normal); - float DdotN = dir[0]*_normal[0] - + dir[1]*_normal[1] - + dir[2]*_normal[2] - ; - - if (0.0f > DdotN) + if (0.0f > ddotn) { - dir[0] = -dir[0]; - dir[1] = -dir[1]; - dir[2] = -dir[2]; + return bx::neg(dir); } - _result[0] = dir[0]; - _result[1] = dir[1]; - _result[2] = dir[2]; + return dir; } inline void generateSphereHammersley(void* _data, uint32_t _stride, uint32_t _num, float _scale) @@ -122,13 +119,13 @@ namespace bx const float phi = (ii + 0.5f) / _num; const float phirad = phi * kPi2; - const float st = fsqrt(1.0f-tt*tt) * _scale; + const float st = sqrt(1.0f-tt*tt) * _scale; float* xyz = (float*)data; data += _stride; - xyz[0] = st * fcos(phirad); - xyz[1] = st * fsin(phirad); + xyz[0] = st * cos(phirad); + xyz[1] = st * sin(phirad); xyz[2] = tt * _scale; } } @@ -141,7 +138,7 @@ namespace bx for (uint32_t ii = 0, num = _num-1; ii < num; ++ii) { uint32_t jj = ii + 1 + _rng->gen() % (num - ii); - bx::xchg(_array[ii], _array[jj]); + bx::swap(_array[ii], _array[jj]); } } diff --git a/3rdparty/bx/include/bx/inline/simd128_langext.inl b/3rdparty/bx/include/bx/inline/simd128_langext.inl index 9fa3f410bff..ac08ba7f9de 100644 --- a/3rdparty/bx/include/bx/inline/simd128_langext.inl +++ b/3rdparty/bx/include/bx/inline/simd128_langext.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -9,6 +9,8 @@ namespace bx { + BX_CONST_FUNC float sqrtRef(float); + #define ELEMx 0 #define ELEMy 1 #define ELEMz 2 @@ -318,10 +320,10 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf); BX_SIMD_FORCE_INLINE simd128_langext_t simd_sqrt(simd128_langext_t _a) { simd128_langext_t result; - result.vf[0] = sqrtf(_a.vf[0]); - result.vf[1] = sqrtf(_a.vf[1]); - result.vf[2] = sqrtf(_a.vf[2]); - result.vf[3] = sqrtf(_a.vf[3]); + result.vf[0] = sqrtRef(_a.vf[0]); + result.vf[1] = sqrtRef(_a.vf[1]); + result.vf[2] = sqrtRef(_a.vf[2]); + result.vf[3] = sqrtRef(_a.vf[3]); return result; } @@ -329,10 +331,10 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf); BX_SIMD_FORCE_INLINE simd128_langext_t simd_rsqrt_est(simd128_langext_t _a) { simd128_langext_t result; - result.vf[0] = 1.0f / sqrtf(_a.vf[0]); - result.vf[1] = 1.0f / sqrtf(_a.vf[1]); - result.vf[2] = 1.0f / sqrtf(_a.vf[2]); - result.vf[3] = 1.0f / sqrtf(_a.vf[3]); + result.vf[0] = 1.0f / sqrtRef(_a.vf[0]); + result.vf[1] = 1.0f / sqrtRef(_a.vf[1]); + result.vf[2] = 1.0f / sqrtRef(_a.vf[2]); + result.vf[3] = 1.0f / sqrtRef(_a.vf[3]); return result; } diff --git a/3rdparty/bx/include/bx/inline/simd128_neon.inl b/3rdparty/bx/include/bx/inline/simd128_neon.inl index 356b7c79901..95107eeaa27 100644 --- a/3rdparty/bx/include/bx/inline/simd128_neon.inl +++ b/3rdparty/bx/include/bx/inline/simd128_neon.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/simd128_ref.inl b/3rdparty/bx/include/bx/inline/simd128_ref.inl index 0ef8f68b1c1..6895b24f46a 100644 --- a/3rdparty/bx/include/bx/inline/simd128_ref.inl +++ b/3rdparty/bx/include/bx/inline/simd128_ref.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -9,6 +9,9 @@ namespace bx { + BX_CONST_FUNC float sqrt(float); + BX_CONST_FUNC float rsqrt(float); + #define ELEMx 0 #define ELEMy 1 #define ELEMz 2 @@ -364,10 +367,10 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf); BX_SIMD_FORCE_INLINE simd128_ref_t simd_sqrt(simd128_ref_t _a) { simd128_ref_t result; - result.fxyzw[0] = fsqrt(_a.fxyzw[0]); - result.fxyzw[1] = fsqrt(_a.fxyzw[1]); - result.fxyzw[2] = fsqrt(_a.fxyzw[2]); - result.fxyzw[3] = fsqrt(_a.fxyzw[3]); + result.fxyzw[0] = sqrt(_a.fxyzw[0]); + result.fxyzw[1] = sqrt(_a.fxyzw[1]); + result.fxyzw[2] = sqrt(_a.fxyzw[2]); + result.fxyzw[3] = sqrt(_a.fxyzw[3]); return result; } @@ -375,10 +378,10 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw , 0xf); BX_SIMD_FORCE_INLINE simd128_ref_t simd_rsqrt_est(simd128_ref_t _a) { simd128_ref_t result; - result.fxyzw[0] = 1.0f / fsqrt(_a.fxyzw[0]); - result.fxyzw[1] = 1.0f / fsqrt(_a.fxyzw[1]); - result.fxyzw[2] = 1.0f / fsqrt(_a.fxyzw[2]); - result.fxyzw[3] = 1.0f / fsqrt(_a.fxyzw[3]); + result.fxyzw[0] = rsqrt(_a.fxyzw[0]); + result.fxyzw[1] = rsqrt(_a.fxyzw[1]); + result.fxyzw[2] = rsqrt(_a.fxyzw[2]); + result.fxyzw[3] = rsqrt(_a.fxyzw[3]); return result; } diff --git a/3rdparty/bx/include/bx/inline/simd128_sse.inl b/3rdparty/bx/include/bx/inline/simd128_sse.inl index 69f37d153c3..229c1431fe3 100644 --- a/3rdparty/bx/include/bx/inline/simd128_sse.inl +++ b/3rdparty/bx/include/bx/inline/simd128_sse.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/simd128_swizzle.inl b/3rdparty/bx/include/bx/inline/simd128_swizzle.inl index e734ce91955..b1ff9a0d183 100644 --- a/3rdparty/bx/include/bx/inline/simd128_swizzle.inl +++ b/3rdparty/bx/include/bx/inline/simd128_swizzle.inl @@ -1,6 +1,6 @@ /* * Copyright 2010-2015 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #ifndef BX_SIMD_T_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/inline/simd256_avx.inl b/3rdparty/bx/include/bx/inline/simd256_avx.inl index c59cc80cfbe..4dd9c666f71 100644 --- a/3rdparty/bx/include/bx/inline/simd256_avx.inl +++ b/3rdparty/bx/include/bx/inline/simd256_avx.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/simd256_ref.inl b/3rdparty/bx/include/bx/inline/simd256_ref.inl index fd8d8897fe9..0c84d9d82a0 100644 --- a/3rdparty/bx/include/bx/inline/simd256_ref.inl +++ b/3rdparty/bx/include/bx/inline/simd256_ref.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/simd_ni.inl b/3rdparty/bx/include/bx/inline/simd_ni.inl index 6a0be796b7b..eb388513e88 100644 --- a/3rdparty/bx/include/bx/inline/simd_ni.inl +++ b/3rdparty/bx/include/bx/inline/simd_ni.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/sort.inl b/3rdparty/bx/include/bx/inline/sort.inl index 1f5dcf21690..27a085362da 100644 --- a/3rdparty/bx/include/bx/inline/sort.inl +++ b/3rdparty/bx/include/bx/inline/sort.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/spscqueue.inl b/3rdparty/bx/include/bx/inline/spscqueue.inl index 7469953be63..e0fae02ef29 100644 --- a/3rdparty/bx/include/bx/inline/spscqueue.inl +++ b/3rdparty/bx/include/bx/inline/spscqueue.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/inline/string.inl b/3rdparty/bx/include/bx/inline/string.inl index 4ee24003889..a387128679e 100644 --- a/3rdparty/bx/include/bx/inline/string.inl +++ b/3rdparty/bx/include/bx/inline/string.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -19,14 +19,13 @@ namespace bx char temp[2048]; char* out = temp; - int32_t len = bx::vsnprintf(out, sizeof(temp), _format, _argList); - if ( (int32_t)sizeof(temp) < len) + int32_t len = vsnprintf(out, sizeof(temp), _format, _argList); + if (int32_t(sizeof(temp) ) < len) { - out = (char*)alloca(len+1); - len = bx::vsnprintf(out, len, _format, _argList); + out = (char*)alloca(len); + len = vsnprintf(out, len, _format, _argList); } - out[len] = '\0'; - _out.append(out); + _out.append(out, out+len); } template @@ -59,9 +58,9 @@ namespace bx clear(); } - inline StringView::StringView(const StringView& _rhs) + inline StringView::StringView(const StringView& _rhs, int32_t _start, int32_t _len) { - set(_rhs.m_ptr, _rhs.m_len); + set(_rhs, _start, _len); } inline StringView& StringView::operator=(const char* _rhs) @@ -72,10 +71,25 @@ namespace bx inline StringView& StringView::operator=(const StringView& _rhs) { - set(_rhs.m_ptr, _rhs.m_len); + set(_rhs); return *this; } + inline StringView::StringView(char* _ptr) + { + set(_ptr, INT32_MAX); + } + + inline StringView::StringView(const char* _ptr) + { + set(_ptr, INT32_MAX); + } + + inline StringView::StringView(char* _ptr, int32_t _len) + { + set(_ptr, _len); + } + inline StringView::StringView(const char* _ptr, int32_t _len) { set(_ptr, _len); @@ -86,18 +100,30 @@ namespace bx set(_ptr, _term); } + template + inline StringView::StringView(const Ty& _container) + { + set(_container); + } + + inline void StringView::set(char* _ptr) + { + set(_ptr, INT32_MAX); + } + + inline void StringView::set(const char* _ptr) + { + set(_ptr, INT32_MAX); + } + inline void StringView::set(const char* _ptr, int32_t _len) { clear(); if (NULL != _ptr) { - int32_t len = strLen(_ptr, _len); - if (0 != len) - { - m_len = len; - m_ptr = _ptr; - } + m_len = INT32_MAX == _len ? strLen(_ptr) : _len; + m_ptr = _ptr; } } @@ -106,9 +132,17 @@ namespace bx set(_ptr, int32_t(_term-_ptr) ); } - inline void StringView::set(const StringView& _str) + template + inline void StringView::set(const Ty& _container) { - set(_str.m_ptr, _str.m_len); + set(_container.data(), int32_t(_container.length() ) ); + } + + inline void StringView::set(const StringView& _str, int32_t _start, int32_t _len) + { + const int32_t start = min(_start, _str.m_len); + const int32_t len = clamp(_str.m_len - start, 0, min(_len, _str.m_len) ); + set(_str.m_ptr + start, len); } inline void StringView::clear() @@ -202,4 +236,9 @@ namespace bx } } + inline StringView strSubstr(const StringView& _str, int32_t _start, int32_t _len) + { + return StringView(_str, _start, _len); + } + } // namespace bx diff --git a/3rdparty/bx/include/bx/inline/uint32_t.inl b/3rdparty/bx/include/bx/inline/uint32_t.inl index 8a66a07ca2d..2a17582b0db 100644 --- a/3rdparty/bx/include/bx/inline/uint32_t.inl +++ b/3rdparty/bx/include/bx/inline/uint32_t.inl @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -29,152 +29,162 @@ namespace bx { - inline uint32_t uint32_li(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_li(uint32_t _a) { return _a; } - inline uint32_t uint32_dec(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_dec(uint32_t _a) { return _a - 1; } - inline uint32_t uint32_inc(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_inc(uint32_t _a) { return _a + 1; } - inline uint32_t uint32_not(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_not(uint32_t _a) { return ~_a; } - inline uint32_t uint32_neg(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_neg(uint32_t _a) { return -(int32_t)_a; } - inline uint32_t uint32_ext(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_ext(uint32_t _a) { return ( (int32_t)_a)>>31; } - inline uint32_t uint32_and(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_and(uint32_t _a, uint32_t _b) { return _a & _b; } - inline uint32_t uint32_andc(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_andc(uint32_t _a, uint32_t _b) { return _a & ~_b; } - inline uint32_t uint32_xor(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_xor(uint32_t _a, uint32_t _b) { return _a ^ _b; } - inline uint32_t uint32_xorl(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_xorl(uint32_t _a, uint32_t _b) { return !_a != !_b; } - inline uint32_t uint32_or(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_or(uint32_t _a, uint32_t _b) { return _a | _b; } - inline uint32_t uint32_orc(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_orc(uint32_t _a, uint32_t _b) { return _a | ~_b; } - inline uint32_t uint32_sll(uint32_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint32_t uint32_sll(uint32_t _a, int32_t _sa) { return _a << _sa; } - inline uint32_t uint32_srl(uint32_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint32_t uint32_srl(uint32_t _a, int32_t _sa) { return _a >> _sa; } - inline uint32_t uint32_sra(uint32_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint32_t uint32_sra(uint32_t _a, int32_t _sa) { return ( (int32_t)_a) >> _sa; } - inline uint32_t uint32_rol(uint32_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint32_t uint32_rol(uint32_t _a, int32_t _sa) { return ( _a << _sa) | (_a >> (32-_sa) ); } - inline uint32_t uint32_ror(uint32_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint32_t uint32_ror(uint32_t _a, int32_t _sa) { return ( _a >> _sa) | (_a << (32-_sa) ); } - inline uint32_t uint32_add(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_add(uint32_t _a, uint32_t _b) { return _a + _b; } - inline uint32_t uint32_sub(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_iadd(uint32_t _a, uint32_t _b) + { + return int32_t(_a) + int32_t(_b); + } + + inline BX_CONSTEXPR_FUNC uint32_t uint32_sub(uint32_t _a, uint32_t _b) { return _a - _b; } - inline uint32_t uint32_mul(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_isub(uint32_t _a, uint32_t _b) + { + return int32_t(_a) - int32_t(_b); + } + + inline BX_CONSTEXPR_FUNC uint32_t uint32_mul(uint32_t _a, uint32_t _b) { return _a * _b; } - inline uint32_t uint32_div(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_div(uint32_t _a, uint32_t _b) { - return (_a / _b); + return _a / _b; } - inline uint32_t uint32_mod(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_mod(uint32_t _a, uint32_t _b) { - return (_a % _b); + return _a % _b; } - inline uint32_t uint32_cmpeq(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cmpeq(uint32_t _a, uint32_t _b) { return -(_a == _b); } - inline uint32_t uint32_cmpneq(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cmpneq(uint32_t _a, uint32_t _b) { return -(_a != _b); } - inline uint32_t uint32_cmplt(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cmplt(uint32_t _a, uint32_t _b) { return -(_a < _b); } - inline uint32_t uint32_cmple(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cmple(uint32_t _a, uint32_t _b) { return -(_a <= _b); } - inline uint32_t uint32_cmpgt(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cmpgt(uint32_t _a, uint32_t _b) { return -(_a > _b); } - inline uint32_t uint32_cmpge(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cmpge(uint32_t _a, uint32_t _b) { return -(_a >= _b); } - inline uint32_t uint32_setnz(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_setnz(uint32_t _a) { return -!!_a; } - inline uint32_t uint32_satadd(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_satadd(uint32_t _a, uint32_t _b) { const uint32_t add = uint32_add(_a, _b); const uint32_t lt = uint32_cmplt(add, _a); @@ -183,7 +193,7 @@ namespace bx return result; } - inline uint32_t uint32_satsub(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_satsub(uint32_t _a, uint32_t _b) { const uint32_t sub = uint32_sub(_a, _b); const uint32_t le = uint32_cmple(sub, _a); @@ -192,7 +202,7 @@ namespace bx return result; } - inline uint32_t uint32_satmul(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_satmul(uint32_t _a, uint32_t _b) { const uint64_t mul = (uint64_t)_a * (uint64_t)_b; const uint32_t hi = mul >> 32; @@ -202,7 +212,7 @@ namespace bx return result; } - inline uint32_t uint32_sels(uint32_t test, uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_sels(uint32_t test, uint32_t _a, uint32_t _b) { const uint32_t mask = uint32_ext(test); const uint32_t sel_a = uint32_and(_a, mask); @@ -212,7 +222,7 @@ namespace bx return (result); } - inline uint32_t uint32_selb(uint32_t _mask, uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_selb(uint32_t _mask, uint32_t _a, uint32_t _b) { const uint32_t sel_a = uint32_and(_a, _mask); const uint32_t sel_b = uint32_andc(_b, _mask); @@ -221,7 +231,7 @@ namespace bx return (result); } - inline uint32_t uint32_imin(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_imin(uint32_t _a, uint32_t _b) { const uint32_t a_sub_b = uint32_sub(_a, _b); const uint32_t result = uint32_sels(a_sub_b, _a, _b); @@ -229,7 +239,7 @@ namespace bx return result; } - inline uint32_t uint32_imax(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_imax(uint32_t _a, uint32_t _b) { const uint32_t b_sub_a = uint32_sub(_b, _a); const uint32_t result = uint32_sels(b_sub_a, _a, _b); @@ -237,27 +247,27 @@ namespace bx return result; } - inline uint32_t uint32_min(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_min(uint32_t _a, uint32_t _b) { return _a > _b ? _b : _a; } - inline uint32_t uint32_min(uint32_t _a, uint32_t _b, uint32_t _c) + inline BX_CONSTEXPR_FUNC uint32_t uint32_min(uint32_t _a, uint32_t _b, uint32_t _c) { return uint32_min(_a, uint32_min(_b, _c) ); } - inline uint32_t uint32_max(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_max(uint32_t _a, uint32_t _b) { return _a > _b ? _a : _b; } - inline uint32_t uint32_max(uint32_t _a, uint32_t _b, uint32_t _c) + inline BX_CONSTEXPR_FUNC uint32_t uint32_max(uint32_t _a, uint32_t _b, uint32_t _c) { return uint32_max(_a, uint32_max(_b, _c) ); } - inline uint32_t uint32_clamp(uint32_t _a, uint32_t _min, uint32_t _max) + inline BX_CONSTEXPR_FUNC uint32_t uint32_clamp(uint32_t _a, uint32_t _min, uint32_t _max) { const uint32_t tmp = uint32_max(_a, _min); const uint32_t result = uint32_min(tmp, _max); @@ -265,7 +275,7 @@ namespace bx return result; } - inline uint32_t uint32_iclamp(uint32_t _a, uint32_t _min, uint32_t _max) + inline BX_CONSTEXPR_FUNC uint32_t uint32_iclamp(uint32_t _a, uint32_t _min, uint32_t _max) { const uint32_t tmp = uint32_imax(_a, _min); const uint32_t result = uint32_imin(tmp, _max); @@ -273,7 +283,7 @@ namespace bx return result; } - inline uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max) + inline BX_CONSTEXPR_FUNC uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max) { const uint32_t inc = uint32_inc(_val); const uint32_t max_diff = uint32_sub(_max, _val); @@ -285,7 +295,7 @@ namespace bx return result; } - inline uint32_t uint32_decwrap(uint32_t _val, uint32_t _min, uint32_t _max) + inline BX_CONSTEXPR_FUNC uint32_t uint32_decwrap(uint32_t _val, uint32_t _min, uint32_t _max) { const uint32_t dec = uint32_dec(_val); const uint32_t min_diff = uint32_sub(_min, _val); @@ -297,7 +307,7 @@ namespace bx return result; } - inline uint32_t uint32_cntbits_ref(uint32_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cntbits(uint32_t _val) { const uint32_t tmp0 = uint32_srl(_val, 1); const uint32_t tmp1 = uint32_and(tmp0, 0x55555555); @@ -320,19 +330,7 @@ namespace bx return result; } - /// Count number of bits set. - inline uint32_t uint32_cntbits(uint32_t _val) - { -#if BX_COMPILER_GCC || BX_COMPILER_CLANG - return __builtin_popcount(_val); -#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS - return __popcnt(_val); -#else - return uint32_cntbits_ref(_val); -#endif // BX_COMPILER_ - } - - inline uint32_t uint32_cntlz_ref(uint32_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cntlz(uint32_t _val) { const uint32_t tmp0 = uint32_srl(_val, 1); const uint32_t tmp1 = uint32_or(tmp0, _val); @@ -350,21 +348,7 @@ namespace bx return result; } - /// Count number of leading zeros. - inline uint32_t uint32_cntlz(uint32_t _val) - { -#if BX_COMPILER_GCC || BX_COMPILER_CLANG - return __builtin_clz(_val); -#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS - unsigned long index; - _BitScanReverse(&index, _val); - return 31 - index; -#else - return uint32_cntlz_ref(_val); -#endif // BX_COMPILER_ - } - - inline uint32_t uint32_cnttz_ref(uint32_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint32_cnttz(uint32_t _val) { const uint32_t tmp0 = uint32_not(_val); const uint32_t tmp1 = uint32_dec(_val); @@ -374,25 +358,13 @@ namespace bx return result; } - inline uint32_t uint32_cnttz(uint32_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint32_part1by1(uint32_t _a) { -#if BX_COMPILER_GCC || BX_COMPILER_CLANG - return __builtin_ctz(_val); -#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS - unsigned long index; - _BitScanForward(&index, _val); - return index; -#else - return uint32_cnttz_ref(_val); -#endif // BX_COMPILER_ - } + // shuffle: + // ---- ---- ---- ---- fedc ba98 7654 3210 + // to: + // -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 - // shuffle: - // ---- ---- ---- ---- fedc ba98 7654 3210 - // to: - // -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 - inline uint32_t uint32_part1by1(uint32_t _a) - { const uint32_t val = uint32_and(_a, 0xffff); const uint32_t tmp0 = uint32_sll(val, 8); @@ -414,12 +386,13 @@ namespace bx return result; } - // shuffle: - // ---- ---- ---- ---- ---- --98 7654 3210 - // to: - // ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0 - inline uint32_t uint32_part1by2(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_part1by2(uint32_t _a) { + // shuffle: + // ---- ---- ---- ---- ---- --98 7654 3210 + // to: + // ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0 + const uint32_t val = uint32_and(_a, 0x3ff); const uint32_t tmp0 = uint32_sll(val, 16); @@ -441,19 +414,17 @@ namespace bx return result; } - inline uint32_t uint32_testpow2(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_testpow2(uint32_t _a) { - const uint32_t tmp0 = uint32_not(_a); - const uint32_t tmp1 = uint32_inc(tmp0); - const uint32_t tmp2 = uint32_and(_a, tmp1); - const uint32_t tmp3 = uint32_cmpeq(tmp2, _a); - const uint32_t tmp4 = uint32_cmpneq(_a, 0); - const uint32_t result = uint32_and(tmp3, tmp4); + const uint32_t tmp0 = uint32_dec(_a); + const uint32_t tmp1 = uint32_xor(_a, tmp0); + const uint32_t tmp2 = uint32_srl(tmp1, 1); + const uint32_t result = uint32_cmpeq(tmp2, tmp0); return result; } - inline uint32_t uint32_nextpow2(uint32_t _a) + inline BX_CONSTEXPR_FUNC uint32_t uint32_nextpow2(uint32_t _a) { const uint32_t tmp0 = uint32_dec(_a); const uint32_t tmp1 = uint32_srl(tmp0, 1); @@ -471,151 +442,7 @@ namespace bx return result; } - inline uint16_t halfFromFloat(float _a) - { - union { uint32_t ui; float flt; } ftou; - ftou.flt = _a; - - const uint32_t one = uint32_li(0x00000001); - const uint32_t f_s_mask = uint32_li(0x80000000); - const uint32_t f_e_mask = uint32_li(0x7f800000); - const uint32_t f_m_mask = uint32_li(0x007fffff); - const uint32_t f_m_hidden_bit = uint32_li(0x00800000); - const uint32_t f_m_round_bit = uint32_li(0x00001000); - const uint32_t f_snan_mask = uint32_li(0x7fc00000); - const uint32_t f_e_pos = uint32_li(0x00000017); - const uint32_t h_e_pos = uint32_li(0x0000000a); - const uint32_t h_e_mask = uint32_li(0x00007c00); - const uint32_t h_snan_mask = uint32_li(0x00007e00); - const uint32_t h_e_mask_value = uint32_li(0x0000001f); - const uint32_t f_h_s_pos_offset = uint32_li(0x00000010); - const uint32_t f_h_bias_offset = uint32_li(0x00000070); - const uint32_t f_h_m_pos_offset = uint32_li(0x0000000d); - const uint32_t h_nan_min = uint32_li(0x00007c01); - const uint32_t f_h_e_biased_flag = uint32_li(0x0000008f); - const uint32_t f_s = uint32_and(ftou.ui, f_s_mask); - const uint32_t f_e = uint32_and(ftou.ui, f_e_mask); - const uint16_t h_s = (uint16_t)uint32_srl(f_s, f_h_s_pos_offset); - const uint32_t f_m = uint32_and(ftou.ui, f_m_mask); - const uint16_t f_e_amount = (uint16_t)uint32_srl(f_e, f_e_pos); - const uint32_t f_e_half_bias = uint32_sub(f_e_amount, f_h_bias_offset); - const uint32_t f_snan = uint32_and(ftou.ui, f_snan_mask); - const uint32_t f_m_round_mask = uint32_and(f_m, f_m_round_bit); - const uint32_t f_m_round_offset = uint32_sll(f_m_round_mask, one); - const uint32_t f_m_rounded = uint32_add(f_m, f_m_round_offset); - const uint32_t f_m_denorm_sa = uint32_sub(one, f_e_half_bias); - const uint32_t f_m_with_hidden = uint32_or(f_m_rounded, f_m_hidden_bit); - const uint32_t f_m_denorm = uint32_srl(f_m_with_hidden, f_m_denorm_sa); - const uint32_t h_m_denorm = uint32_srl(f_m_denorm, f_h_m_pos_offset); - const uint32_t f_m_rounded_overflow = uint32_and(f_m_rounded, f_m_hidden_bit); - const uint32_t m_nan = uint32_srl(f_m, f_h_m_pos_offset); - const uint32_t h_em_nan = uint32_or(h_e_mask, m_nan); - const uint32_t h_e_norm_overflow_offset = uint32_inc(f_e_half_bias); - const uint32_t h_e_norm_overflow = uint32_sll(h_e_norm_overflow_offset, h_e_pos); - const uint32_t h_e_norm = uint32_sll(f_e_half_bias, h_e_pos); - const uint32_t h_m_norm = uint32_srl(f_m_rounded, f_h_m_pos_offset); - const uint32_t h_em_norm = uint32_or(h_e_norm, h_m_norm); - const uint32_t is_h_ndenorm_msb = uint32_sub(f_h_bias_offset, f_e_amount); - const uint32_t is_f_e_flagged_msb = uint32_sub(f_h_e_biased_flag, f_e_half_bias); - const uint32_t is_h_denorm_msb = uint32_not(is_h_ndenorm_msb); - const uint32_t is_f_m_eqz_msb = uint32_dec(f_m); - const uint32_t is_h_nan_eqz_msb = uint32_dec(m_nan); - const uint32_t is_f_inf_msb = uint32_and(is_f_e_flagged_msb, is_f_m_eqz_msb); - const uint32_t is_f_nan_underflow_msb = uint32_and(is_f_e_flagged_msb, is_h_nan_eqz_msb); - const uint32_t is_e_overflow_msb = uint32_sub(h_e_mask_value, f_e_half_bias); - const uint32_t is_h_inf_msb = uint32_or(is_e_overflow_msb, is_f_inf_msb); - const uint32_t is_f_nsnan_msb = uint32_sub(f_snan, f_snan_mask); - const uint32_t is_m_norm_overflow_msb = uint32_neg(f_m_rounded_overflow); - const uint32_t is_f_snan_msb = uint32_not(is_f_nsnan_msb); - const uint32_t h_em_overflow_result = uint32_sels(is_m_norm_overflow_msb, h_e_norm_overflow, h_em_norm); - const uint32_t h_em_nan_result = uint32_sels(is_f_e_flagged_msb, h_em_nan, h_em_overflow_result); - const uint32_t h_em_nan_underflow_result = uint32_sels(is_f_nan_underflow_msb, h_nan_min, h_em_nan_result); - const uint32_t h_em_inf_result = uint32_sels(is_h_inf_msb, h_e_mask, h_em_nan_underflow_result); - const uint32_t h_em_denorm_result = uint32_sels(is_h_denorm_msb, h_m_denorm, h_em_inf_result); - const uint32_t h_em_snan_result = uint32_sels(is_f_snan_msb, h_snan_mask, h_em_denorm_result); - const uint32_t h_result = uint32_or(h_s, h_em_snan_result); - - return (uint16_t)(h_result); - } - - inline float halfToFloat(uint16_t _a) - { - const uint32_t h_e_mask = uint32_li(0x00007c00); - const uint32_t h_m_mask = uint32_li(0x000003ff); - const uint32_t h_s_mask = uint32_li(0x00008000); - const uint32_t h_f_s_pos_offset = uint32_li(0x00000010); - const uint32_t h_f_e_pos_offset = uint32_li(0x0000000d); - const uint32_t h_f_bias_offset = uint32_li(0x0001c000); - const uint32_t f_e_mask = uint32_li(0x7f800000); - const uint32_t f_m_mask = uint32_li(0x007fffff); - const uint32_t h_f_e_denorm_bias = uint32_li(0x0000007e); - const uint32_t h_f_m_denorm_sa_bias = uint32_li(0x00000008); - const uint32_t f_e_pos = uint32_li(0x00000017); - const uint32_t h_e_mask_minus_one = uint32_li(0x00007bff); - const uint32_t h_e = uint32_and(_a, h_e_mask); - const uint32_t h_m = uint32_and(_a, h_m_mask); - const uint32_t h_s = uint32_and(_a, h_s_mask); - const uint32_t h_e_f_bias = uint32_add(h_e, h_f_bias_offset); - const uint32_t h_m_nlz = uint32_cntlz(h_m); - const uint32_t f_s = uint32_sll(h_s, h_f_s_pos_offset); - const uint32_t f_e = uint32_sll(h_e_f_bias, h_f_e_pos_offset); - const uint32_t f_m = uint32_sll(h_m, h_f_e_pos_offset); - const uint32_t f_em = uint32_or(f_e, f_m); - const uint32_t h_f_m_sa = uint32_sub(h_m_nlz, h_f_m_denorm_sa_bias); - const uint32_t f_e_denorm_unpacked = uint32_sub(h_f_e_denorm_bias, h_f_m_sa); - const uint32_t h_f_m = uint32_sll(h_m, h_f_m_sa); - const uint32_t f_m_denorm = uint32_and(h_f_m, f_m_mask); - const uint32_t f_e_denorm = uint32_sll(f_e_denorm_unpacked, f_e_pos); - const uint32_t f_em_denorm = uint32_or(f_e_denorm, f_m_denorm); - const uint32_t f_em_nan = uint32_or(f_e_mask, f_m); - const uint32_t is_e_eqz_msb = uint32_dec(h_e); - const uint32_t is_m_nez_msb = uint32_neg(h_m); - const uint32_t is_e_flagged_msb = uint32_sub(h_e_mask_minus_one, h_e); - const uint32_t is_zero_msb = uint32_andc(is_e_eqz_msb, is_m_nez_msb); - const uint32_t is_inf_msb = uint32_andc(is_e_flagged_msb, is_m_nez_msb); - const uint32_t is_denorm_msb = uint32_and(is_m_nez_msb, is_e_eqz_msb); - const uint32_t is_nan_msb = uint32_and(is_e_flagged_msb, is_m_nez_msb); - const uint32_t is_zero = uint32_ext(is_zero_msb); - const uint32_t f_zero_result = uint32_andc(f_em, is_zero); - const uint32_t f_denorm_result = uint32_sels(is_denorm_msb, f_em_denorm, f_zero_result); - const uint32_t f_inf_result = uint32_sels(is_inf_msb, f_e_mask, f_denorm_result); - const uint32_t f_nan_result = uint32_sels(is_nan_msb, f_em_nan, f_inf_result); - const uint32_t f_result = uint32_or(f_s, f_nan_result); - - union { uint32_t ui; float flt; } utof; - utof.ui = f_result; - return utof.flt; - } - - inline uint16_t uint16_min(uint16_t _a, uint16_t _b) - { - return _a > _b ? _b : _a; - } - - inline uint16_t uint16_max(uint16_t _a, uint16_t _b) - { - return _a < _b ? _b : _a; - } - - inline int64_t int64_min(int64_t _a, int64_t _b) - { - return _a < _b ? _a : _b; - } - - inline int64_t int64_max(int64_t _a, int64_t _b) - { - return _a > _b ? _a : _b; - } - - inline int64_t int64_clamp(int64_t _a, int64_t _min, int64_t _max) - { - const int64_t min = int64_min(_a, _max); - const int64_t result = int64_max(_min, min); - - return result; - } - - inline uint32_t uint64_cntbits_ref(uint64_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint64_cntbits(uint64_t _val) { const uint32_t lo = uint32_t(_val&UINT32_MAX); const uint32_t hi = uint32_t(_val>>32); @@ -625,19 +452,7 @@ namespace bx return total; } - /// Count number of bits set. - inline uint32_t uint64_cntbits(uint64_t _val) - { -#if BX_COMPILER_GCC || BX_COMPILER_CLANG - return __builtin_popcountll(_val); -#elif BX_COMPILER_MSVC && BX_ARCH_64BIT - return uint32_t(__popcnt64(_val) ); -#else - return uint64_cntbits_ref(_val); -#endif // BX_COMPILER_ - } - - inline uint32_t uint64_cntlz_ref(uint64_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint64_cntlz(uint64_t _val) { return _val & UINT64_C(0xffffffff00000000) ? uint32_cntlz(uint32_t(_val>>32) ) @@ -645,21 +460,7 @@ namespace bx ; } - /// Count number of leading zeros. - inline uint32_t uint64_cntlz(uint64_t _val) - { -#if BX_COMPILER_GCC || BX_COMPILER_CLANG - return __builtin_clzll(_val); -#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS && BX_ARCH_64BIT - unsigned long index; - _BitScanReverse64(&index, _val); - return uint32_t(63 - index); -#else - return uint64_cntlz_ref(_val); -#endif // BX_COMPILER_ - } - - inline uint32_t uint64_cnttz_ref(uint64_t _val) + inline BX_CONSTEXPR_FUNC uint32_t uint64_cnttz(uint64_t _val) { return _val & UINT64_C(0xffffffff) ? uint32_cnttz(uint32_t(_val) ) @@ -667,65 +468,51 @@ namespace bx ; } - inline uint32_t uint64_cnttz(uint64_t _val) - { -#if BX_COMPILER_GCC || BX_COMPILER_CLANG - return __builtin_ctzll(_val); -#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS && BX_ARCH_64BIT - unsigned long index; - _BitScanForward64(&index, _val); - return uint32_t(index); -#else - return uint64_cnttz_ref(_val); -#endif // BX_COMPILER_ - } - - inline uint64_t uint64_sll(uint64_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint64_t uint64_sll(uint64_t _a, int32_t _sa) { return _a << _sa; } - inline uint64_t uint64_srl(uint64_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint64_t uint64_srl(uint64_t _a, int32_t _sa) { return _a >> _sa; } - inline uint64_t uint64_sra(uint64_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint64_t uint64_sra(uint64_t _a, int32_t _sa) { return ( (int64_t)_a) >> _sa; } - inline uint64_t uint64_rol(uint64_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint64_t uint64_rol(uint64_t _a, int32_t _sa) { - return ( _a << _sa) | (_a >> (32-_sa) ); + return ( _a << _sa) | (_a >> (64-_sa) ); } - inline uint64_t uint64_ror(uint64_t _a, int _sa) + inline BX_CONSTEXPR_FUNC uint64_t uint64_ror(uint64_t _a, int32_t _sa) { - return ( _a >> _sa) | (_a << (32-_sa) ); + return ( _a >> _sa) | (_a << (64-_sa) ); } - inline uint64_t uint64_add(uint64_t _a, uint64_t _b) + inline BX_CONSTEXPR_FUNC uint64_t uint64_add(uint64_t _a, uint64_t _b) { return _a + _b; } - inline uint64_t uint64_sub(uint64_t _a, uint64_t _b) + inline BX_CONSTEXPR_FUNC uint64_t uint64_sub(uint64_t _a, uint64_t _b) { return _a - _b; } - inline uint64_t uint64_mul(uint64_t _a, uint64_t _b) + inline BX_CONSTEXPR_FUNC uint64_t uint64_mul(uint64_t _a, uint64_t _b) { return _a * _b; } - /// Greatest common divisor. - inline uint32_t uint32_gcd(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_gcd(uint32_t _a, uint32_t _b) { do { - uint32_t tmp = _a % _b; + const uint32_t tmp = uint32_mod(_a, _b); _a = _b; _b = tmp; } @@ -734,14 +521,12 @@ namespace bx return _a; } - /// Least common multiple. - inline uint32_t uint32_lcm(uint32_t _a, uint32_t _b) + inline BX_CONSTEXPR_FUNC uint32_t uint32_lcm(uint32_t _a, uint32_t _b) { return _a * (_b / uint32_gcd(_a, _b) ); } - /// Align to arbitrary stride. - inline uint32_t strideAlign(uint32_t _offset, uint32_t _stride) + inline BX_CONSTEXPR_FUNC uint32_t strideAlign(uint32_t _offset, uint32_t _stride) { const uint32_t mod = uint32_mod(_offset, _stride); const uint32_t add = uint32_sub(_stride, mod); @@ -752,8 +537,7 @@ namespace bx return result; } - /// Align to arbitrary stride and 16-bytes. - inline uint32_t strideAlign16(uint32_t _offset, uint32_t _stride) + inline BX_CONSTEXPR_FUNC uint32_t strideAlign16(uint32_t _offset, uint32_t _stride) { const uint32_t align = uint32_lcm(16, _stride); const uint32_t mod = uint32_mod(_offset, align); @@ -765,8 +549,7 @@ namespace bx return result; } - /// Align to arbitrary stride and 256-bytes. - inline uint32_t strideAlign256(uint32_t _offset, uint32_t _stride) + inline BX_CONSTEXPR_FUNC uint32_t strideAlign256(uint32_t _offset, uint32_t _stride) { const uint32_t align = uint32_lcm(256, _stride); const uint32_t mod = uint32_mod(_offset, align); @@ -778,4 +561,120 @@ namespace bx return result; } + inline BX_CONST_FUNC uint16_t halfFromFloat(float _a) + { + union { uint32_t ui; float flt; } ftou; + ftou.flt = _a; + + const uint32_t one = uint32_li(0x00000001); + const uint32_t f_s_mask = uint32_li(0x80000000); + const uint32_t f_e_mask = uint32_li(0x7f800000); + const uint32_t f_m_mask = uint32_li(0x007fffff); + const uint32_t f_m_hidden_bit = uint32_li(0x00800000); + const uint32_t f_m_round_bit = uint32_li(0x00001000); + const uint32_t f_snan_mask = uint32_li(0x7fc00000); + const uint32_t f_e_pos = uint32_li(0x00000017); + const uint32_t h_e_pos = uint32_li(0x0000000a); + const uint32_t h_e_mask = uint32_li(0x00007c00); + const uint32_t h_snan_mask = uint32_li(0x00007e00); + const uint32_t h_e_mask_value = uint32_li(0x0000001f); + const uint32_t f_h_s_pos_offset = uint32_li(0x00000010); + const uint32_t f_h_bias_offset = uint32_li(0x00000070); + const uint32_t f_h_m_pos_offset = uint32_li(0x0000000d); + const uint32_t h_nan_min = uint32_li(0x00007c01); + const uint32_t f_h_e_biased_flag = uint32_li(0x0000008f); + const uint32_t f_s = uint32_and(ftou.ui, f_s_mask); + const uint32_t f_e = uint32_and(ftou.ui, f_e_mask); + const uint16_t h_s = (uint16_t)uint32_srl(f_s, f_h_s_pos_offset); + const uint32_t f_m = uint32_and(ftou.ui, f_m_mask); + const uint16_t f_e_amount = (uint16_t)uint32_srl(f_e, f_e_pos); + const uint32_t f_e_half_bias = uint32_sub(f_e_amount, f_h_bias_offset); + const uint32_t f_snan = uint32_and(ftou.ui, f_snan_mask); + const uint32_t f_m_round_mask = uint32_and(f_m, f_m_round_bit); + const uint32_t f_m_round_offset = uint32_sll(f_m_round_mask, one); + const uint32_t f_m_rounded = uint32_add(f_m, f_m_round_offset); + const uint32_t f_m_denorm_sa = uint32_sub(one, f_e_half_bias); + const uint32_t f_m_with_hidden = uint32_or(f_m_rounded, f_m_hidden_bit); + const uint32_t f_m_denorm = uint32_srl(f_m_with_hidden, f_m_denorm_sa); + const uint32_t h_m_denorm = uint32_srl(f_m_denorm, f_h_m_pos_offset); + const uint32_t f_m_rounded_overflow = uint32_and(f_m_rounded, f_m_hidden_bit); + const uint32_t m_nan = uint32_srl(f_m, f_h_m_pos_offset); + const uint32_t h_em_nan = uint32_or(h_e_mask, m_nan); + const uint32_t h_e_norm_overflow_offset = uint32_inc(f_e_half_bias); + const uint32_t h_e_norm_overflow = uint32_sll(h_e_norm_overflow_offset, h_e_pos); + const uint32_t h_e_norm = uint32_sll(f_e_half_bias, h_e_pos); + const uint32_t h_m_norm = uint32_srl(f_m_rounded, f_h_m_pos_offset); + const uint32_t h_em_norm = uint32_or(h_e_norm, h_m_norm); + const uint32_t is_h_ndenorm_msb = uint32_sub(f_h_bias_offset, f_e_amount); + const uint32_t is_f_e_flagged_msb = uint32_sub(f_h_e_biased_flag, f_e_half_bias); + const uint32_t is_h_denorm_msb = uint32_not(is_h_ndenorm_msb); + const uint32_t is_f_m_eqz_msb = uint32_dec(f_m); + const uint32_t is_h_nan_eqz_msb = uint32_dec(m_nan); + const uint32_t is_f_inf_msb = uint32_and(is_f_e_flagged_msb, is_f_m_eqz_msb); + const uint32_t is_f_nan_underflow_msb = uint32_and(is_f_e_flagged_msb, is_h_nan_eqz_msb); + const uint32_t is_e_overflow_msb = uint32_sub(h_e_mask_value, f_e_half_bias); + const uint32_t is_h_inf_msb = uint32_or(is_e_overflow_msb, is_f_inf_msb); + const uint32_t is_f_nsnan_msb = uint32_sub(f_snan, f_snan_mask); + const uint32_t is_m_norm_overflow_msb = uint32_neg(f_m_rounded_overflow); + const uint32_t is_f_snan_msb = uint32_not(is_f_nsnan_msb); + const uint32_t h_em_overflow_result = uint32_sels(is_m_norm_overflow_msb, h_e_norm_overflow, h_em_norm); + const uint32_t h_em_nan_result = uint32_sels(is_f_e_flagged_msb, h_em_nan, h_em_overflow_result); + const uint32_t h_em_nan_underflow_result = uint32_sels(is_f_nan_underflow_msb, h_nan_min, h_em_nan_result); + const uint32_t h_em_inf_result = uint32_sels(is_h_inf_msb, h_e_mask, h_em_nan_underflow_result); + const uint32_t h_em_denorm_result = uint32_sels(is_h_denorm_msb, h_m_denorm, h_em_inf_result); + const uint32_t h_em_snan_result = uint32_sels(is_f_snan_msb, h_snan_mask, h_em_denorm_result); + const uint32_t h_result = uint32_or(h_s, h_em_snan_result); + + return (uint16_t)(h_result); + } + + inline BX_CONST_FUNC float halfToFloat(uint16_t _a) + { + const uint32_t h_e_mask = uint32_li(0x00007c00); + const uint32_t h_m_mask = uint32_li(0x000003ff); + const uint32_t h_s_mask = uint32_li(0x00008000); + const uint32_t h_f_s_pos_offset = uint32_li(0x00000010); + const uint32_t h_f_e_pos_offset = uint32_li(0x0000000d); + const uint32_t h_f_bias_offset = uint32_li(0x0001c000); + const uint32_t f_e_mask = uint32_li(0x7f800000); + const uint32_t f_m_mask = uint32_li(0x007fffff); + const uint32_t h_f_e_denorm_bias = uint32_li(0x0000007e); + const uint32_t h_f_m_denorm_sa_bias = uint32_li(0x00000008); + const uint32_t f_e_pos = uint32_li(0x00000017); + const uint32_t h_e_mask_minus_one = uint32_li(0x00007bff); + const uint32_t h_e = uint32_and(_a, h_e_mask); + const uint32_t h_m = uint32_and(_a, h_m_mask); + const uint32_t h_s = uint32_and(_a, h_s_mask); + const uint32_t h_e_f_bias = uint32_add(h_e, h_f_bias_offset); + const uint32_t h_m_nlz = uint32_cntlz(h_m); + const uint32_t f_s = uint32_sll(h_s, h_f_s_pos_offset); + const uint32_t f_e = uint32_sll(h_e_f_bias, h_f_e_pos_offset); + const uint32_t f_m = uint32_sll(h_m, h_f_e_pos_offset); + const uint32_t f_em = uint32_or(f_e, f_m); + const uint32_t h_f_m_sa = uint32_sub(h_m_nlz, h_f_m_denorm_sa_bias); + const uint32_t f_e_denorm_unpacked = uint32_sub(h_f_e_denorm_bias, h_f_m_sa); + const uint32_t h_f_m = uint32_sll(h_m, h_f_m_sa); + const uint32_t f_m_denorm = uint32_and(h_f_m, f_m_mask); + const uint32_t f_e_denorm = uint32_sll(f_e_denorm_unpacked, f_e_pos); + const uint32_t f_em_denorm = uint32_or(f_e_denorm, f_m_denorm); + const uint32_t f_em_nan = uint32_or(f_e_mask, f_m); + const uint32_t is_e_eqz_msb = uint32_dec(h_e); + const uint32_t is_m_nez_msb = uint32_neg(h_m); + const uint32_t is_e_flagged_msb = uint32_sub(h_e_mask_minus_one, h_e); + const uint32_t is_zero_msb = uint32_andc(is_e_eqz_msb, is_m_nez_msb); + const uint32_t is_inf_msb = uint32_andc(is_e_flagged_msb, is_m_nez_msb); + const uint32_t is_denorm_msb = uint32_and(is_m_nez_msb, is_e_eqz_msb); + const uint32_t is_nan_msb = uint32_and(is_e_flagged_msb, is_m_nez_msb); + const uint32_t is_zero = uint32_ext(is_zero_msb); + const uint32_t f_zero_result = uint32_andc(f_em, is_zero); + const uint32_t f_denorm_result = uint32_sels(is_denorm_msb, f_em_denorm, f_zero_result); + const uint32_t f_inf_result = uint32_sels(is_inf_msb, f_e_mask, f_denorm_result); + const uint32_t f_nan_result = uint32_sels(is_nan_msb, f_em_nan, f_inf_result); + const uint32_t f_result = uint32_or(f_s, f_nan_result); + + union { uint32_t ui; float flt; } utof; + utof.ui = f_result; + return utof.flt; + } + } // namespace bx diff --git a/3rdparty/bx/include/bx/macros.h b/3rdparty/bx/include/bx/macros.h index 79c624959f0..9c72182486b 100644 --- a/3rdparty/bx/include/bx/macros.h +++ b/3rdparty/bx/include/bx/macros.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -7,7 +7,6 @@ #define BX_MACROS_H_HEADER_GUARD #include "bx.h" -#include /// #if BX_COMPILER_MSVC @@ -19,7 +18,7 @@ # define BX_VA_ARGS_PASS(...) (__VA_ARGS__) #endif // BX_COMPILER_MSVC -#define BX_VA_ARGS_COUNT(...) BX_VA_ARGS_COUNT_ BX_VA_ARGS_PASS(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) +#define BX_VA_ARGS_COUNT(...) BX_VA_ARGS_COUNT_ BX_VA_ARGS_PASS(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) #define BX_VA_ARGS_COUNT_(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11, _a12, _a13, _a14, _a15, _a16, _last, ...) _last /// @@ -47,6 +46,7 @@ #define BX_ALIGN_256(_value) BX_ALIGN_MASK(_value, 0xff) #define BX_ALIGN_4096(_value) BX_ALIGN_MASK(_value, 0xfff) +/// #define BX_ALIGNOF(_type) __alignof(_type) #if defined(__has_feature) @@ -70,20 +70,27 @@ # define BX_UNLIKELY(_x) __builtin_expect(!!(_x), 0) # define BX_NO_INLINE __attribute__( (noinline) ) # define BX_NO_RETURN __attribute__( (noreturn) ) +# define BX_CONST_FUNC __attribute__( (const) ) + # if BX_COMPILER_GCC >= 70000 # define BX_FALLTHROUGH __attribute__( (fallthrough) ) # else # define BX_FALLTHROUGH BX_NOOP() # endif // BX_COMPILER_GCC >= 70000 + # define BX_NO_VTABLE # define BX_PRINTF_ARGS(_format, _args) __attribute__( (format(__printf__, _format, _args) ) ) + # if BX_CLANG_HAS_FEATURE(cxx_thread_local) # define BX_THREAD_LOCAL __thread # endif // BX_COMPILER_CLANG + # if (!BX_PLATFORM_OSX && (BX_COMPILER_GCC >= 40200)) || (BX_COMPILER_GCC >= 40500) # define BX_THREAD_LOCAL __thread # endif // BX_COMPILER_GCC + # define BX_ATTRIBUTE(_x) __attribute__( (_x) ) + # if BX_CRT_MSVC # define __stdcall # endif // BX_CRT_MSVC @@ -96,6 +103,7 @@ # define BX_UNLIKELY(_x) (_x) # define BX_NO_INLINE __declspec(noinline) # define BX_NO_RETURN +# define BX_CONST_FUNC __declspec(noalias) # define BX_FALLTHROUGH BX_NOOP() # define BX_NO_VTABLE __declspec(novtable) # define BX_PRINTF_ARGS(_format, _args) @@ -105,6 +113,11 @@ # error "Unknown BX_COMPILER_?" #endif +/// The return value of the function is solely a function of the arguments. +/// +#define BX_CONSTEXPR_FUNC constexpr BX_CONST_FUNC + +/// #define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__) /// @@ -190,27 +203,21 @@ # define BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC(_x) #endif // BX_COMPILER_ -/// -#if BX_COMPILER_MSVC -# define BX_TYPE_IS_POD(t) (!__is_class(t) || __is_pod(t)) -#else -# define BX_TYPE_IS_POD(t) std::is_pod::value -#endif /// #define BX_CLASS_NO_DEFAULT_CTOR(_class) \ - private: _class() + private: _class() #define BX_CLASS_NO_COPY(_class) \ - private: _class(const _class& _rhs) + private: _class(const _class& _rhs) #define BX_CLASS_NO_ASSIGNMENT(_class) \ - private: _class& operator=(const _class& _rhs) + private: _class& operator=(const _class& _rhs) -#define BX_CLASS_ALLOCATOR(_class) \ - public: void* operator new(size_t _size); \ - public: void operator delete(void* _ptr); \ - public: void* operator new[](size_t _size); \ - public: void operator delete[](void* _ptr) +#define BX_CLASS_ALLOCATOR(_class) \ + public: void* operator new(size_t _size); \ + public: void operator delete(void* _ptr); \ + public: void* operator new[](size_t _size); \ + public: void operator delete[](void* _ptr) #define BX_CLASS_1(_class, _a1) BX_CONCATENATE(BX_CLASS_, _a1)(_class) #define BX_CLASS_2(_class, _a1, _a2) BX_CLASS_1(_class, _a1); BX_CLASS_1(_class, _a2) diff --git a/3rdparty/bx/include/bx/maputil.h b/3rdparty/bx/include/bx/maputil.h index 4c7e4aa9c2d..78ce6b6f84c 100644 --- a/3rdparty/bx/include/bx/maputil.h +++ b/3rdparty/bx/include/bx/maputil.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/math.h b/3rdparty/bx/include/bx/math.h index 66b0a51618d..c751efad50b 100644 --- a/3rdparty/bx/include/bx/math.h +++ b/3rdparty/bx/include/bx/math.h @@ -1,25 +1,33 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ // FPU math lib -#ifndef BX_FPU_MATH_H_HEADER_GUARD -#define BX_FPU_MATH_H_HEADER_GUARD +#ifndef BX_MATH_H_HEADER_GUARD +#define BX_MATH_H_HEADER_GUARD #include "bx.h" #include "uint32_t.h" namespace bx { - extern const float kPi; - extern const float kPi2; - extern const float kInvPi; - extern const float kPiHalf; - extern const float kSqrt2; - extern const float kInvLogNat2; - extern const float kHuge; + constexpr float kPi = 3.1415926535897932384626433832795f; + constexpr float kPi2 = 6.2831853071795864769252867665590f; + constexpr float kInvPi = 1.0f/kPi; + constexpr float kPiHalf = 1.5707963267948966192313216916398f; + constexpr float kPiQuarter = 0.7853981633974483096156608458199f; + constexpr float kSqrt2 = 1.4142135623730950488016887242097f; + constexpr float kLogNat10 = 2.3025850929940456840179914546844f; + constexpr float kInvLogNat2 = 1.4426950408889634073599246810019f; + constexpr float kLogNat2Hi = 0.6931471805599453094172321214582f; + constexpr float kLogNat2Lo = 1.90821492927058770002e-10f; + constexpr float kE = 2.7182818284590452353602874713527f; + constexpr float kNearZero = 1.0f/float(1 << 28); + constexpr float kFloatMin = 1.175494e-38f; + constexpr float kFloatMax = 3.402823e+38f; + extern const float kInfinity; /// typedef float (*LerpFn)(float _a, float _b, float _t); @@ -45,180 +53,294 @@ namespace bx }; /// - float toRad(float _deg); + struct Vec3 + { + float x, y, z; + }; + + /// Returns converted the argument _deg to radians. + /// + BX_CONST_FUNC float toRad(float _deg); + + /// Returns converted the argument _rad to degrees. + /// + BX_CONST_FUNC float toDeg(float _rad); + + /// Reinterprets the bit pattern of _a as uint32_t. + /// + BX_CONST_FUNC uint32_t floatToBits(float _a); + + /// Reinterprets the bit pattern of _a as float. + /// + BX_CONST_FUNC float bitsToFloat(uint32_t _a); + + /// Reinterprets the bit pattern of _a as uint64_t. + /// + BX_CONST_FUNC uint64_t doubleToBits(double _a); + + /// Reinterprets the bit pattern of _a as double. + /// + BX_CONST_FUNC double bitsToDouble(uint64_t _a); + + /// Returns sortable floating point value. + /// + BX_CONST_FUNC uint32_t floatFlip(uint32_t _value); + + /// Returns true if _f is a number that is NaN. + /// + BX_CONST_FUNC bool isNan(float _f); + + /// Returns true if _f is a number that is NaN. + /// + BX_CONST_FUNC bool isNan(double _f); + + /// Returns true if _f is not infinite and is not a NaN. + /// + BX_CONST_FUNC bool isFinite(float _f); + + /// Returns true if _f is not infinite and is not a NaN. + /// + BX_CONST_FUNC bool isFinite(double _f); + + /// Returns true if _f is infinite and is not a NaN. + /// + BX_CONST_FUNC bool isInfinite(float _f); + + /// Returns true if _f is infinite and is not a NaN. + /// + BX_CONST_FUNC bool isInfinite(double _f); + + /// Returns the largest integer value not greater than _f. + /// + BX_CONST_FUNC float floor(float _f); + + /// Returns the smallest integer value not less than _f. + /// + BX_CONST_FUNC float ceil(float _f); + + /// Returns the nearest integer value to _f, rounding halfway cases away from zero, + /// + BX_CONST_FUNC float round(float _f); + + /// Returns linear interpolation between two values _a and _b. + /// + BX_CONSTEXPR_FUNC float lerp(float _a, float _b, float _t); + + /// Returns the sign of _a. + /// + BX_CONSTEXPR_FUNC float sign(float _a); + + /// Returns the absolute of _a. + /// + BX_CONSTEXPR_FUNC float abs(float _a); + + /// Returns the square of _a. + /// + BX_CONSTEXPR_FUNC float square(float _a); + + /// Returns the cosine of the argument _a. + /// + BX_CONST_FUNC float sin(float _a); + + /// Returns hyperbolic sine of the argument _a. + /// + BX_CONST_FUNC float sinh(float _a); + + /// Returns radian angle between -pi/2 and +pi/2 whose sine is _a. + /// + BX_CONST_FUNC float asin(float _a); + + /// Returns the cosine of the argument _a. + /// + BX_CONST_FUNC float cos(float _a); + + /// Returns hyperbolic cosine of the argument _a. + /// + BX_CONST_FUNC float cosh(float _a); + + /// Returns radian angle between 0 and pi whose cosine is _a. + /// + BX_CONST_FUNC float acos(float _a); + + /// Returns the circular tangent of the radian argument _a. + /// + BX_CONST_FUNC float tan(float _a); + + /// Returns hyperbolic tangent of the argument _a. + /// + BX_CONST_FUNC float tanh(float _a); + + /// Returns radian angle between -pi/2 and +pi/2 whose tangent is _a. + /// + BX_CONST_FUNC float atan(float _a); + + /// Retruns the inverse tangent of _y/_x. + /// + BX_CONST_FUNC float atan2(float _y, float _x); + + /// Computes _a raised to the _b power. + /// + BX_CONST_FUNC float pow(float _a, float _b); + + /// Returns the result of multiplying _a by 2 raised to the power of the exponent. + /// + BX_CONST_FUNC float ldexp(float _a, int32_t _b); + + /// Returns decomposed given floating point value _a into a normalized fraction and + /// an integral power of two. + /// + float frexp(float _a, int32_t* _outExp); + + /// Returns e (2.71828...) raised to the _a power. + /// + BX_CONST_FUNC float exp(float _a); + + /// Returns 2 raised to the _a power. + /// + BX_CONST_FUNC float exp2(float _a); + + /// Returns the base e (2.71828...) logarithm of _a. + /// + BX_CONST_FUNC float log(float _a); + + /// Returns the base 2 logarithm of _a. + /// + BX_CONST_FUNC float log2(float _a); + + /// Returns the square root of _a. + /// + BX_CONST_FUNC float sqrt(float _a); + + /// Returns reciprocal square root of _a. + /// + BX_CONST_FUNC float rsqrt(float _a); + + /// Returns the nearest integer not greater in magnitude than _a. + /// + BX_CONSTEXPR_FUNC float trunc(float _a); + + /// Returns the fractional (or decimal) part of _a, which is greater than or equal to 0 + /// and less than 1. + /// + BX_CONSTEXPR_FUNC float fract(float _a); + + /// Returns result of multipla and add (_a * _b + _c). + /// + BX_CONSTEXPR_FUNC float mad(float _a, float _b, float _c); + + /// Returns the floating-point remainder of the division operation _a/_b. + /// + BX_CONST_FUNC float mod(float _a, float _b); /// - float toDeg(float _rad); + BX_CONSTEXPR_FUNC bool equal(float _a, float _b, float _epsilon); /// - uint32_t floatToBits(float _a); + BX_CONST_FUNC bool equal(const float* _a, const float* _b, uint32_t _num, float _epsilon); /// - float bitsToFloat(uint32_t _a); + BX_CONST_FUNC float wrap(float _a, float _wrap); /// - uint64_t doubleToBits(double _a); + BX_CONSTEXPR_FUNC float step(float _edge, float _a); /// - double bitsToDouble(uint64_t _a); + BX_CONSTEXPR_FUNC float pulse(float _a, float _start, float _end); /// - uint32_t floatFlip(uint32_t _value); + BX_CONSTEXPR_FUNC float smoothStep(float _a); /// - bool isNan(float _f); + BX_CONSTEXPR_FUNC float bias(float _time, float _bias); /// - bool isNan(double _f); + BX_CONSTEXPR_FUNC float gain(float _time, float _gain); /// - bool isFinite(float _f); + BX_CONST_FUNC float angleDiff(float _a, float _b); + + /// Returns shortest distance linear interpolation between two angles. + /// + BX_CONST_FUNC float angleLerp(float _a, float _b, float _t); /// - bool isFinite(double _f); + Vec3 load(const void* _ptr); /// - bool isInfinite(float _f); + void store(void* _ptr, const Vec3& _a); /// - bool isInfinite(double _f); + BX_CONSTEXPR_FUNC Vec3 abs(const Vec3& _a); /// - float ffloor(float _f); + BX_CONSTEXPR_FUNC Vec3 neg(const Vec3& _a); /// - float fceil(float _f); + BX_CONSTEXPR_FUNC Vec3 add(const Vec3& _a, const Vec3& _b); /// - float fround(float _f); + BX_CONSTEXPR_FUNC Vec3 add(const Vec3& _a, float _b); /// - float fmin(float _a, float _b); + BX_CONSTEXPR_FUNC Vec3 sub(const Vec3& _a, const Vec3& _b); /// - float fmax(float _a, float _b); + BX_CONSTEXPR_FUNC Vec3 sub(const Vec3& _a, float _b); /// - float fmin3(float _a, float _b, float _c); + BX_CONSTEXPR_FUNC Vec3 mul(const Vec3& _a, const Vec3& _b); /// - float fmax3(float _a, float _b, float _c); + BX_CONSTEXPR_FUNC Vec3 mul(const Vec3& _a, float _b); /// - float fclamp(float _a, float _min, float _max); + BX_CONSTEXPR_FUNC Vec3 mad(const Vec3& _a, const Vec3& _b, const Vec3& _c); /// - float fsaturate(float _a); + BX_CONSTEXPR_FUNC float dot(const Vec3& _a, const Vec3& _b); /// - float flerp(float _a, float _b, float _t); + BX_CONSTEXPR_FUNC Vec3 cross(const Vec3& _a, const Vec3& _b); /// - float fsign(float _a); + BX_CONST_FUNC float length(const Vec3& _a); /// - float fabs(float _a); + BX_CONSTEXPR_FUNC Vec3 lerp(const Vec3& _a, const Vec3& _b, float _t); /// - float fsq(float _a); + BX_CONSTEXPR_FUNC Vec3 lerp(const Vec3& _a, const Vec3& _b, const Vec3& _t); /// - float fsin(float _a); + BX_CONST_FUNC Vec3 normalize(const Vec3& _a); /// - float fasin(float _a); + BX_CONSTEXPR_FUNC Vec3 min(const Vec3& _a, const Vec3& _b); /// - float fcos(float _a); + BX_CONSTEXPR_FUNC Vec3 max(const Vec3& _a, const Vec3& _b); /// - float ftan(float _a); + BX_CONSTEXPR_FUNC Vec3 rcp(const Vec3& _a); /// - float facos(float _a); + void calcTangentFrame(Vec3& _outT, Vec3& _outB, const Vec3& _n); /// - float fatan2(float _y, float _x); + void calcTangentFrame(Vec3& _outT, Vec3& _outB, const Vec3& _n, float _angle); /// - float fpow(float _a, float _b); + BX_CONST_FUNC Vec3 fromLatLong(float _u, float _v); /// - float fexp2(float _a); - - /// - float flog(float _a); - - /// - float flog2(float _a); - - /// - float fsqrt(float _a); - - /// - float frsqrt(float _a); - - /// - float ffract(float _a); - - /// - float fmod(float _a, float _b); - - /// - bool fequal(float _a, float _b, float _epsilon); - - /// - bool fequal(const float* _a, const float* _b, uint32_t _num, float _epsilon); - - /// - float fwrap(float _a, float _wrap); - - /// - float fstep(float _edge, float _a); - - /// - float fpulse(float _a, float _start, float _end); - - /// - float fsmoothstep(float _a); - - // References: - // - Bias And Gain Are Your Friend - // http://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/ - // - http://demofox.org/biasgain.html - /// - float fbias(float _time, float _bias); - - /// - float fgain(float _time, float _gain); - - /// - float angleDiff(float _a, float _b); - - /// Shortest distance linear interpolation between two angles. - float angleLerp(float _a, float _b, float _t); - - /// - void vec3Move(float* _result, const float* _a); - - /// - void vec3Abs(float* _result, const float* _a); - - /// - void vec3Neg(float* _result, const float* _a); + void toLatLong(float* _outU, float* _outV, const Vec3& _dir); /// void vec3Add(float* _result, const float* _a, const float* _b); - /// - void vec3Add(float* _result, const float* _a, float _b); - /// void vec3Sub(float* _result, const float* _a, const float* _b); - /// - void vec3Sub(float* _result, const float* _a, float _b); - /// void vec3Mul(float* _result, const float* _a, const float* _b); @@ -234,24 +356,9 @@ namespace bx /// float vec3Length(const float* _a); - /// - void vec3Lerp(float* _result, const float* _a, const float* _b, float _t); - - /// - void vec3Lerp(float* _result, const float* _a, const float* _b, const float* _c); - /// float vec3Norm(float* _result, const float* _a); - /// - void vec3Min(float* _result, const float* _a, const float* _b); - - /// - void vec3Max(float* _result, const float* _a, const float* _b); - - /// - void vec3Rcp(float* _result, const float* _a); - /// Calculate tangent frame from normal. /// void vec3TangentFrame(const float* _n, float* _t, float* _b); @@ -263,8 +370,13 @@ namespace bx /// void vec3FromLatLong(float* _vec, float _u, float _v); + /// Convert direction to 2D latitude and longitude. /// - void vec3ToLatLong(float* _u, float* _v, const float* _vec); + /// @param[out] _outU U-coordinate. + /// @param[out] _outV V-coordinate. + /// @param[in] _dir Normalized direction vector. + /// + void vec3ToLatLong(float* _outU, float* _outV, const float* _dir); /// void quatIdentity(float* _result); @@ -333,13 +445,13 @@ namespace bx void mtxQuatTranslationHMD(float* _result, const float* _quat, const float* _translation); /// - void mtxLookAtLh(float* _result, const float* _eye, const float* _at, const float* _up = NULL); + void mtxLookAtLh(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up = { 0.0f, 1.0f, 0.0f }); /// - void mtxLookAtRh(float* _result, const float* _eye, const float* _at, const float* _up = NULL); + void mtxLookAtRh(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up = { 0.0f, 1.0f, 0.0f }); /// - void mtxLookAt(float* _result, const float* _eye, const float* _at, const float* _up = NULL); + void mtxLookAt(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up = { 0.0f, 1.0f, 0.0f }); /// void mtxProj(float* _result, float _ut, float _dt, float _lt, float _rt, float _near, float _far, bool _oglNdc); @@ -452,6 +564,12 @@ namespace bx /// void vec3MulMtxH(float* _result, const float* _vec, const float* _mat); + /// + void vec4Mul(float* _result, const float* _a, const float* _b); + + /// + void vec4Mul(float* _result, const float* _a, float _b); + /// void vec4MulMtx(float* _result, const float* _vec, const float* _mat); @@ -476,10 +594,13 @@ namespace bx void mtxViewFlipHandedness(float* _dst, const float* _src); /// - void calcNormal(float _result[3], float _va[3], float _vb[3], float _vc[3]); + void calcNormal(float _result[3], const float _va[3], const float _vb[3], const float _vc[3]); /// - void calcPlane(float _result[4], float _va[3], float _vb[3], float _vc[3]); + void calcPlane(float _result[4], const float _va[3], const float _vb[3], const float _vc[3]); + + /// + void calcPlane(float _result[4], const float _normal[3], const float _pos[3]); /// void calcLinearFit2D(float _result[2], const void* _points, uint32_t _stride, uint32_t _numPoints); @@ -493,8 +614,14 @@ namespace bx /// void hsvToRgb(float _rgb[3], const float _hsv[3]); + /// + BX_CONST_FUNC float toLinear(float _a); + + /// + BX_CONST_FUNC float toGamma(float _a); + } // namespace bx #include "inline/math.inl" -#endif // BX_FPU_MATH_H_HEADER_GUARD +#endif // BX_MATH_H_HEADER_GUARD diff --git a/3rdparty/bx/include/bx/mpscqueue.h b/3rdparty/bx/include/bx/mpscqueue.h index 1735e83038c..003dfe8f4f8 100644 --- a/3rdparty/bx/include/bx/mpscqueue.h +++ b/3rdparty/bx/include/bx/mpscqueue.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/mutex.h b/3rdparty/bx/include/bx/mutex.h index ac8ea7f03de..213fc68c70e 100644 --- a/3rdparty/bx/include/bx/mutex.h +++ b/3rdparty/bx/include/bx/mutex.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h index 3f52856dd3e..92edacd21d1 100644 --- a/3rdparty/bx/include/bx/os.h +++ b/3rdparty/bx/include/bx/os.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -7,6 +7,7 @@ #define BX_OS_H_HEADER_GUARD #include "debug.h" +#include "filepath.h" #if BX_PLATFORM_OSX # define BX_DL_EXT "dylib" @@ -31,22 +32,19 @@ namespace bx size_t getProcessMemoryUsed(); /// - void* dlopen(const char* _filePath); + void* dlopen(const FilePath& _filePath); /// void dlclose(void* _handle); /// - void* dlsym(void* _handle, const char* _symbol); + void* dlsym(void* _handle, const StringView& _symbol); /// - bool getenv(const char* _name, char* _out, uint32_t* _inOutSize); + bool getEnv(char* _out, uint32_t* _inOutSize, const StringView& _name); /// - void setenv(const char* _name, const char* _value); - - /// - void unsetenv(const char* _name); + void setEnv(const StringView& _name, const StringView& _value); /// int chdir(const char* _path); diff --git a/3rdparty/bx/include/bx/pixelformat.h b/3rdparty/bx/include/bx/pixelformat.h index ee2dd15bd31..c75b39836d5 100644 --- a/3rdparty/bx/include/bx/pixelformat.h +++ b/3rdparty/bx/include/bx/pixelformat.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/platform.h b/3rdparty/bx/include/bx/platform.h index 96b9202d704..e0031ec2c38 100644 --- a/3rdparty/bx/include/bx/platform.h +++ b/3rdparty/bx/include/bx/platform.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -11,10 +11,10 @@ #define BX_ARCH_64BIT 0 // Compiler -#define BX_COMPILER_CLANG 0 -#define BX_COMPILER_CLANG_ANALYZER 0 -#define BX_COMPILER_GCC 0 -#define BX_COMPILER_MSVC 0 +#define BX_COMPILER_CLANG 0 +#define BX_COMPILER_CLANG_ANALYZER 0 +#define BX_COMPILER_GCC 0 +#define BX_COMPILER_MSVC 0 // Endianess #define BX_CPU_ENDIAN_BIG 0 @@ -54,7 +54,6 @@ #define BX_PLATFORM_NX 0 #define BX_PLATFORM_OSX 0 #define BX_PLATFORM_PS4 0 -#define BX_PLATFORM_QNX 0 #define BX_PLATFORM_RPI 0 #define BX_PLATFORM_STEAMLINK 0 #define BX_PLATFORM_WINDOWS 0 @@ -81,34 +80,34 @@ #endif // // http://sourceforge.net/apps/mediawiki/predef/index.php?title=Architectures -#if defined(__arm__) || \ - defined(__aarch64__) || \ - defined(_M_ARM) +#if defined(__arm__) \ + || defined(__aarch64__) \ + || defined(_M_ARM) # undef BX_CPU_ARM # define BX_CPU_ARM 1 # define BX_CACHE_LINE_SIZE 64 -#elif defined(__MIPSEL__) || \ - defined(__mips_isa_rev) || \ - defined(__mips64) +#elif defined(__MIPSEL__) \ + || defined(__mips_isa_rev) \ + || defined(__mips64) # undef BX_CPU_MIPS # define BX_CPU_MIPS 1 # define BX_CACHE_LINE_SIZE 64 -#elif defined(_M_PPC) || \ - defined(__powerpc__) || \ - defined(__powerpc64__) +#elif defined(_M_PPC) \ + || defined(__powerpc__) \ + || defined(__powerpc64__) # undef BX_CPU_PPC # define BX_CPU_PPC 1 # define BX_CACHE_LINE_SIZE 128 -#elif defined(__riscv) || \ - defined(__riscv__) || \ - defined(RISCVEL) +#elif defined(__riscv) \ + || defined(__riscv__) \ + || defined(RISCVEL) # undef BX_CPU_RISCV # define BX_CPU_RISCV 1 # define BX_CACHE_LINE_SIZE 64 -#elif defined(_M_IX86) || \ - defined(_M_X64) || \ - defined(__i386__) || \ - defined(__x86_64__) +#elif defined(_M_IX86) \ + || defined(_M_X64) \ + || defined(__i386__) \ + || defined(__x86_64__) # undef BX_CPU_X86 # define BX_CPU_X86 1 # define BX_CACHE_LINE_SIZE 64 @@ -118,14 +117,14 @@ # define BX_CACHE_LINE_SIZE 64 #endif // -#if defined(__x86_64__) || \ - defined(_M_X64) || \ - defined(__aarch64__) || \ - defined(__64BIT__) || \ - defined(__mips64) || \ - defined(__powerpc64__) || \ - defined(__ppc64__) || \ - defined(__LP64__) +#if defined(__x86_64__) \ + || defined(_M_X64) \ + || defined(__aarch64__) \ + || defined(__64BIT__) \ + || defined(__mips64) \ + || defined(__powerpc64__) \ + || defined(__ppc64__) \ + || defined(__LP64__) # undef BX_ARCH_64BIT # define BX_ARCH_64BIT 64 #else @@ -201,9 +200,6 @@ #elif defined(__ORBIS__) # undef BX_PLATFORM_PS4 # define BX_PLATFORM_PS4 1 -#elif defined(__QNX__) -# undef BX_PLATFORM_QNX -# define BX_PLATFORM_QNX 1 #elif defined(__FreeBSD__) \ || defined(__FreeBSD_kernel__) \ || defined(__NetBSD__) \ @@ -215,8 +211,8 @@ # undef BX_PLATFORM_HURD # define BX_PLATFORM_HURD 1 #elif defined(__NX__) -# undef BX_PLATFORM_NX -# define BX_PLATFORM_NX 1 +# undef BX_PLATFORM_NX +# define BX_PLATFORM_NX 1 #endif // #if !BX_CRT_NONE @@ -250,49 +246,47 @@ # endif // BX_CRT_* #endif // !BX_CRT_NONE -#define BX_PLATFORM_POSIX (0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_EMSCRIPTEN \ - || BX_PLATFORM_HURD \ - || BX_PLATFORM_IOS \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_NX \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_PS4 \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_STEAMLINK \ - ) +#define BX_PLATFORM_POSIX (0 \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_EMSCRIPTEN \ + || BX_PLATFORM_HURD \ + || BX_PLATFORM_IOS \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_NX \ + || BX_PLATFORM_OSX \ + || BX_PLATFORM_PS4 \ + || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ + ) -#define BX_PLATFORM_NONE !(0 \ - || BX_PLATFORM_ANDROID \ - || BX_PLATFORM_BSD \ - || BX_PLATFORM_EMSCRIPTEN \ - || BX_PLATFORM_HURD \ - || BX_PLATFORM_IOS \ - || BX_PLATFORM_LINUX \ - || BX_PLATFORM_NX \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_PS4 \ - || BX_PLATFORM_QNX \ - || BX_PLATFORM_RPI \ - || BX_PLATFORM_STEAMLINK \ - || BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ - || BX_PLATFORM_XBOXONE \ - ) +#define BX_PLATFORM_NONE !(0 \ + || BX_PLATFORM_ANDROID \ + || BX_PLATFORM_BSD \ + || BX_PLATFORM_EMSCRIPTEN \ + || BX_PLATFORM_HURD \ + || BX_PLATFORM_IOS \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_NX \ + || BX_PLATFORM_OSX \ + || BX_PLATFORM_PS4 \ + || BX_PLATFORM_RPI \ + || BX_PLATFORM_STEAMLINK \ + || BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_WINRT \ + || BX_PLATFORM_XBOXONE \ + ) #if BX_COMPILER_GCC -# define BX_COMPILER_NAME "GCC " \ - BX_STRINGIZE(__GNUC__) "." \ - BX_STRINGIZE(__GNUC_MINOR__) "." \ - BX_STRINGIZE(__GNUC_PATCHLEVEL__) +# define BX_COMPILER_NAME "GCC " \ + BX_STRINGIZE(__GNUC__) "." \ + BX_STRINGIZE(__GNUC_MINOR__) "." \ + BX_STRINGIZE(__GNUC_PATCHLEVEL__) #elif BX_COMPILER_CLANG -# define BX_COMPILER_NAME "Clang " \ - BX_STRINGIZE(__clang_major__) "." \ - BX_STRINGIZE(__clang_minor__) "." \ - BX_STRINGIZE(__clang_patchlevel__) +# define BX_COMPILER_NAME "Clang " \ + BX_STRINGIZE(__clang_major__) "." \ + BX_STRINGIZE(__clang_minor__) "." \ + BX_STRINGIZE(__clang_patchlevel__) #elif BX_COMPILER_MSVC # if BX_COMPILER_MSVC >= 1910 // Visual Studio 2017 # define BX_COMPILER_NAME "MSVC 15.0" @@ -317,10 +311,10 @@ #elif BX_PLATFORM_BSD # define BX_PLATFORM_NAME "BSD" #elif BX_PLATFORM_EMSCRIPTEN -# define BX_PLATFORM_NAME "asm.js " \ - BX_STRINGIZE(__EMSCRIPTEN_major__) "." \ - BX_STRINGIZE(__EMSCRIPTEN_minor__) "." \ - BX_STRINGIZE(__EMSCRIPTEN_tiny__) +# define BX_PLATFORM_NAME "asm.js " \ + BX_STRINGIZE(__EMSCRIPTEN_major__) "." \ + BX_STRINGIZE(__EMSCRIPTEN_minor__) "." \ + BX_STRINGIZE(__EMSCRIPTEN_tiny__) #elif BX_PLATFORM_HURD # define BX_PLATFORM_NAME "Hurd" #elif BX_PLATFORM_IOS @@ -335,8 +329,6 @@ # define BX_PLATFORM_NAME "OSX" #elif BX_PLATFORM_PS4 # define BX_PLATFORM_NAME "PlayStation 4" -#elif BX_PLATFORM_QNX -# define BX_PLATFORM_NAME "QNX" #elif BX_PLATFORM_RPI # define BX_PLATFORM_NAME "RaspberryPi" #elif BX_PLATFORM_STEAMLINK diff --git a/3rdparty/bx/include/bx/process.h b/3rdparty/bx/include/bx/process.h index 47a1119ea37..8369829527b 100644 --- a/3rdparty/bx/include/bx/process.h +++ b/3rdparty/bx/include/bx/process.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/readerwriter.h b/3rdparty/bx/include/bx/readerwriter.h index 68c8227b540..0d8e13545a8 100644 --- a/3rdparty/bx/include/bx/readerwriter.h +++ b/3rdparty/bx/include/bx/readerwriter.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -7,9 +7,10 @@ #define BX_READERWRITER_H_HEADER_GUARD #include "allocator.h" -#include "error.h" #include "endian.h" +#include "error.h" #include "filepath.h" +#include "string.h" #include "uint32_t.h" BX_ERROR_RESULT(BX_ERROR_READERWRITER_OPEN, BX_MAKEFOURCC('R', 'W', 0, 1) ); @@ -256,10 +257,19 @@ namespace bx int32_t write(WriterI* _writer, const void* _data, int32_t _size, Error* _err = NULL); /// Write C string. - inline int32_t write(WriterI* _writer, const char* _str, Error* _err = NULL); + int32_t write(WriterI* _writer, const char* _str, Error* _err = NULL); /// Write string view. - inline int32_t write(WriterI* _writer, const StringView& _str, Error* _err = NULL); + int32_t write(WriterI* _writer, const StringView& _str, Error* _err = NULL); + + /// Write formated string. + int32_t write(WriterI* _writer, const StringView& _format, va_list _argList, Error* _err); + + /// Write formated string. + int32_t write(WriterI* _writer, Error* _err, const StringView* _format, ...); + + /// Write formated string. + int32_t write(WriterI* _writer, Error* _err, const char* _format, ...); /// Write repeat the same value. int32_t writeRep(WriterI* _writer, uint8_t _byte, int32_t _size, Error* _err = NULL); @@ -276,9 +286,6 @@ namespace bx template int32_t writeBE(WriterI* _writer, const Ty& _value, Error* _err = NULL); - /// Write formated string. - int32_t writePrintf(WriterI* _writer, const char* _format, ...); - /// Skip _offset bytes forward. int64_t skip(SeekerI* _seeker, int64_t _offset); diff --git a/3rdparty/bx/include/bx/ringbuffer.h b/3rdparty/bx/include/bx/ringbuffer.h index fd742503072..db44da8432e 100644 --- a/3rdparty/bx/include/bx/ringbuffer.h +++ b/3rdparty/bx/include/bx/ringbuffer.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/rng.h b/3rdparty/bx/include/bx/rng.h index 22fff273ebe..87ba511e513 100644 --- a/3rdparty/bx/include/bx/rng.h +++ b/3rdparty/bx/include/bx/rng.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -57,15 +57,15 @@ namespace bx /// Generate random point on unit circle. template - void randUnitCircle(float _result[3], Rng* _rng); + bx::Vec3 randUnitCircle(Rng* _rng); /// Generate random point on unit sphere. template - void randUnitSphere(float _result[3], Rng* _rng); + bx::Vec3 randUnitSphere(Rng* _rng); /// Generate random point on unit hemisphere. template - void randUnitHemisphere(float _result[3], Ty* _rng, const float _normal[3]); + bx::Vec3 randUnitHemisphere(Ty* _rng, const bx::Vec3& _normal); /// Sampling with Hammersley and Halton Points /// http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html diff --git a/3rdparty/bx/include/bx/semaphore.h b/3rdparty/bx/include/bx/semaphore.h index 867fa9e7cde..6d944ed2919 100644 --- a/3rdparty/bx/include/bx/semaphore.h +++ b/3rdparty/bx/include/bx/semaphore.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/settings.h b/3rdparty/bx/include/bx/settings.h index 018e4c3504a..7797cfac2bf 100644 --- a/3rdparty/bx/include/bx/settings.h +++ b/3rdparty/bx/include/bx/settings.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -29,7 +29,7 @@ namespace bx void load(const void* _data, uint32_t _len); /// - const char* get(const StringView& _name) const; + StringView get(const StringView& _name) const; /// void set(const StringView& _name, const StringView& _value = ""); diff --git a/3rdparty/bx/include/bx/simd_t.h b/3rdparty/bx/include/bx/simd_t.h index f63dcfba389..33c3f48a954 100644 --- a/3rdparty/bx/include/bx/simd_t.h +++ b/3rdparty/bx/include/bx/simd_t.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -7,7 +7,6 @@ #define BX_SIMD_T_H_HEADER_GUARD #include "bx.h" -#include "math.h" #define BX_SIMD_FORCE_INLINE BX_FORCE_INLINE #define BX_SIMD_INLINE inline @@ -17,6 +16,8 @@ #define BX_SIMD_NEON 0 #define BX_SIMD_SSE 0 +#define BX_CONFIG_SUPPORTS_SIMD 0 + #if defined(__AVX__) || defined(__AVX2__) # include # undef BX_SIMD_AVX @@ -39,7 +40,6 @@ && !BX_PLATFORM_EMSCRIPTEN \ && !BX_PLATFORM_IOS \ && BX_CLANG_HAS_EXTENSION(attribute_ext_vector_type) -# include # undef BX_SIMD_LANGEXT # define BX_SIMD_LANGEXT 1 #endif // @@ -485,6 +485,15 @@ BX_SIMD128_IMPLEMENT_TEST(xyzw); # include "inline/simd128_sse.inl" #endif // BX_SIMD_SSE +#if ( BX_SIMD_LANGEXT \ + || BX_SIMD_NEON \ + || BX_SIMD_SSE \ + || BX_SIMD_AVX \ + ) +# undef BX_CONFIG_SUPPORTS_SIMD +# define BX_CONFIG_SUPPORTS_SIMD 1 +#endif // BX_SIMD_* + namespace bx { union simd128_ref_t @@ -498,16 +507,13 @@ namespace bx # define BX_SIMD_WARN_REFERENCE_IMPL 0 #endif // BX_SIMD_WARN_REFERENCE_IMPL -#if !( BX_SIMD_LANGEXT \ - || BX_SIMD_NEON \ - || BX_SIMD_SSE \ - ) +#if !BX_CONFIG_SUPPORTS_SIMD # if BX_SIMD_WARN_REFERENCE_IMPL # pragma message("*** Using SIMD128 reference implementation! ***") # endif // BX_SIMD_WARN_REFERENCE_IMPL typedef simd128_ref_t simd128_t; -#endif // +#endif // BX_SIMD_REFERENCE struct simd256_ref_t { diff --git a/3rdparty/bx/include/bx/sort.h b/3rdparty/bx/include/bx/sort.h index 2f1511bab5a..1506fb8307b 100644 --- a/3rdparty/bx/include/bx/sort.h +++ b/3rdparty/bx/include/bx/sort.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/spscqueue.h b/3rdparty/bx/include/bx/spscqueue.h index c79b59547f9..f34b65dfada 100644 --- a/3rdparty/bx/include/bx/spscqueue.h +++ b/3rdparty/bx/include/bx/spscqueue.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/string.h b/3rdparty/bx/include/bx/string.h index 331bda889b3..e0800562d71 100644 --- a/3rdparty/bx/include/bx/string.h +++ b/3rdparty/bx/include/bx/string.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -10,12 +10,13 @@ namespace bx { + /// Units struct Units { - enum Enum + enum Enum //!< Units: { - Kilo, - Kibi, + Kilo, //!< SI units + Kibi, //!< IEC prefix }; }; @@ -27,7 +28,7 @@ namespace bx StringView(); /// - StringView(const StringView& _rhs); + StringView(const StringView& _rhs, int32_t _start = 0, int32_t _len = INT32_MAX); /// StringView& operator=(const char* _rhs); @@ -36,19 +37,42 @@ namespace bx StringView& operator=(const StringView& _rhs); /// - StringView(const char* _ptr, int32_t _len = INT32_MAX); + StringView(char* _ptr); + + /// + StringView(const char* _ptr); + + /// + StringView(char* _ptr, int32_t _len); + + /// + StringView(const char* _ptr, int32_t _len); /// StringView(const char* _ptr, const char* _term); /// - void set(const char* _ptr, int32_t _len = INT32_MAX); + template + explicit StringView(const Ty& _container); + + /// + void set(char* _ptr); + + /// + void set(const char* _ptr); + + /// + void set(const char* _ptr, int32_t _len); /// void set(const char* _ptr, const char* _term); /// - void set(const StringView& _str); + void set(const StringView& _str, int32_t _start = 0, int32_t _len = INT32_MAX); + + /// + template + void set(const Ty& _container); /// void clear(); @@ -100,64 +124,70 @@ namespace bx void clear(); }; - /// + /// Retruns true if character is part of space set. bool isSpace(char _ch); - /// + /// Returns true if string view contains only space characters. bool isSpace(const StringView& _str); - /// + /// Retruns true if character is uppercase. bool isUpper(char _ch); - /// + /// Returns true if string view contains only uppercase characters. bool isUpper(const StringView& _str); - /// + /// Retruns true if character is lowercase. bool isLower(char _ch); - /// + /// Returns true if string view contains only lowercase characters. bool isLower(const StringView& _str); - /// + /// Returns true if character is part of alphabet set. bool isAlpha(char _ch); - /// + /// Retruns true if string view contains only alphabet characters. bool isAlpha(const StringView& _str); - /// + /// Returns true if character is part of numeric set. bool isNumeric(char _ch); - /// + /// Retruns true if string view contains only numeric characters. bool isNumeric(const StringView& _str); - /// + /// Returns true if character is part of alpha numeric set. bool isAlphaNum(char _ch); - /// + /// Returns true if string view contains only alpha-numeric characters. bool isAlphaNum(const StringView& _str); - /// + /// Returns true if character is part of hexadecimal set. + bool isHexNum(char _ch); + + /// Returns true if string view contains only hexadecimal characters. + bool isHexNum(const StringView& _str); + + /// Returns true if character is printable. bool isPrint(char _ch); - /// + /// Returns true if string vieww contains only printable characters. bool isPrint(const StringView& _str); - /// + /// Retruns lower case character representing _ch. char toLower(char _ch); - /// + /// Lower case string in place assuming length passed is valid. void toLowerUnsafe(char* _inOutStr, int32_t _len); - /// + /// Lower case string in place. void toLower(char* _inOutStr, int32_t _max = INT32_MAX); - /// + /// Returns upper case character representing _ch. char toUpper(char _ch); - /// + /// Upper case string in place assuming length passed is valid. void toUpperUnsafe(char* _inOutStr, int32_t _len); - /// + /// Uppre case string in place. void toUpper(char* _inOutStr, int32_t _max = INT32_MAX); /// String compare. @@ -183,74 +213,71 @@ namespace bx int32_t strCat(char* _dst, int32_t _dstSize, const StringView& _str, int32_t _num = INT32_MAX); /// Find character in string. Limit search to _max characters. - const char* strFind(const StringView& _str, char _ch); + StringView strFind(const StringView& _str, char _ch); /// Find character in string in reverse. Limit search to _max characters. - const char* strRFind(const StringView& _str, char _ch); + StringView strRFind(const StringView& _str, char _ch); /// Find substring in string. Limit search to _max characters. - const char* strFind(const StringView& _str, const StringView& _find, int32_t _num = INT32_MAX); + StringView strFind(const StringView& _str, const StringView& _find, int32_t _num = INT32_MAX); /// Find substring in string. Case insensitive. Limit search to _max characters. - const char* strFindI(const StringView& _str, const StringView& _find, int32_t _num = INT32_MAX); + StringView strFindI(const StringView& _str, const StringView& _find, int32_t _num = INT32_MAX); - /// + /// Returns string view with characters _chars trimmed from left. StringView strLTrim(const StringView& _str, const StringView& _chars); - /// + /// Returns string view with whitespace characters trimmed from left. + StringView strLTrimSpace(const StringView& _str); + + /// Returns string view with non-whitespace characters trimmed from left. + StringView strLTrimNonSpace(const StringView& _str); + + /// Returns string view with characters _chars trimmed from right. StringView strRTrim(const StringView& _str, const StringView& _chars); - /// + /// Returns string view with characters _chars trimmed from left and right. StringView strTrim(const StringView& _str, const StringView& _chars); /// Find new line. Returns pointer after new line terminator. - const char* strnl(const char* _str); + StringView strFindNl(const StringView& _str); /// Find end of line. Retuns pointer to new line terminator. - const char* streol(const char* _str); + StringView strFindEol(const StringView& _str); - /// Skip whitespace. - const char* strws(const char* _str); + /// Returns StringView of word or empty. + StringView strWord(const StringView& _str); - /// Skip non-whitespace. - const char* strnws(const char* _str); - - /// Skip word. - const char* strword(const char* _str); + /// Returns substring in string. + StringView strSubstr(const StringView& _str, int32_t _start, int32_t _len = INT32_MAX); /// Find matching block. - const char* strmb(const char* _str, char _open, char _close); + StringView strFindBlock(const StringView& _str, char _open, char _close); // Normalize string to sane line endings. - void eolLF(char* _out, int32_t _size, const char* _str); + StringView normalizeEolLf(char* _out, int32_t _size, const StringView& _str); // Finds identifier. - const char* findIdentifierMatch(const char* _str, const char* _word); + StringView findIdentifierMatch(const StringView& _str, const StringView& _word); /// Finds any identifier from NULL terminated array of identifiers. - const char* findIdentifierMatch(const char* _str, const char* _words[]); + StringView findIdentifierMatch(const StringView& _str, const char** _words); /// Cross platform implementation of vsnprintf that returns number of /// characters which would have been written to the final string if /// enough space had been available. int32_t vsnprintf(char* _out, int32_t _max, const char* _format, va_list _argList); - /// Cross platform implementation of vsnwprintf that returns number of + /// Cross platform implementation of snprintf that returns number of /// characters which would have been written to the final string if /// enough space had been available. - int32_t vsnwprintf(wchar_t* _out, int32_t _max, const wchar_t* _format, va_list _argList); - - /// int32_t snprintf(char* _out, int32_t _max, const char* _format, ...); - /// - int32_t swnprintf(wchar_t* _out, int32_t _max, const wchar_t* _format, ...); - - /// + /// Templatized snprintf. template void stringPrintfVargs(Ty& _out, const char* _format, va_list _argList); - /// + /// Templatized snprintf. template void stringPrintf(Ty& _out, const char* _format, ...); @@ -261,37 +288,37 @@ namespace bx /// Convert size in bytes to human readable string kibi units. int32_t prettify(char* _out, int32_t _count, uint64_t _value, Units::Enum _units = Units::Kibi); - /// + /// Converts bool value to string. int32_t toString(char* _out, int32_t _max, bool _value); - /// + /// Converts double value to string. int32_t toString(char* _out, int32_t _max, double _value); - /// - int32_t toString(char* _out, int32_t _max, int32_t _value, uint32_t _base = 10); + /// Converts 32-bit integer value to string. + int32_t toString(char* _out, int32_t _max, int32_t _value, uint32_t _base = 10, char _separator = '\0'); - /// - int32_t toString(char* _out, int32_t _max, int64_t _value, uint32_t _base = 10); + /// Converts 64-bit integer value to string. + int32_t toString(char* _out, int32_t _max, int64_t _value, uint32_t _base = 10, char _separator = '\0'); - /// - int32_t toString(char* _out, int32_t _max, uint32_t _value, uint32_t _base = 10); + /// Converts 32-bit unsigned integer value to string. + int32_t toString(char* _out, int32_t _max, uint32_t _value, uint32_t _base = 10, char _separator = '\0'); - /// - int32_t toString(char* _out, int32_t _max, uint64_t _value, uint32_t _base = 10); + /// Converts 64-bit unsigned integer value to string. + int32_t toString(char* _out, int32_t _max, uint64_t _value, uint32_t _base = 10, char _separator = '\0'); - /// + /// Converts string to bool value. bool fromString(bool* _out, const StringView& _str); - /// + /// Converts string to float value. bool fromString(float* _out, const StringView& _str); - /// + /// Converts string to double value. bool fromString(double* _out, const StringView& _str); - /// + /// Converts string to 32-bit integer value. bool fromString(int32_t* _out, const StringView& _str); - /// + /// Converts string to 32-bit unsigned integer value. bool fromString(uint32_t* _out, const StringView& _str); } // namespace bx diff --git a/3rdparty/bx/include/bx/thread.h b/3rdparty/bx/include/bx/thread.h index 3ba17e681b4..087bd3d4a57 100644 --- a/3rdparty/bx/include/bx/thread.h +++ b/3rdparty/bx/include/bx/thread.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/timer.h b/3rdparty/bx/include/bx/timer.h index 31a109614b3..b0b0b403a8b 100644 --- a/3rdparty/bx/include/bx/timer.h +++ b/3rdparty/bx/include/bx/timer.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/bx/uint32_t.h b/3rdparty/bx/include/bx/uint32_t.h index 622e49ebe58..3d0afcb7124 100644 --- a/3rdparty/bx/include/bx/uint32_t.h +++ b/3rdparty/bx/include/bx/uint32_t.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,280 +8,230 @@ #include "bx.h" -#if BX_COMPILER_MSVC -# if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT -# include -# pragma intrinsic(_BitScanForward) -# pragma intrinsic(_BitScanReverse) -# if BX_ARCH_64BIT -# pragma intrinsic(_BitScanForward64) -# pragma intrinsic(_BitScanReverse64) -# endif // BX_ARCH_64BIT -# endif // BX_PLATFORM_WINDOWS -#endif // BX_COMPILER_MSVC - -#define BX_HALF_FLOAT_ZERO UINT16_C(0) -#define BX_HALF_FLOAT_HALF UINT16_C(0x3800) -#define BX_HALF_FLOAT_ONE UINT16_C(0x3c00) -#define BX_HALF_FLOAT_TWO UINT16_C(0x4000) - namespace bx { - /// - uint32_t uint32_li(uint32_t _a); + constexpr uint16_t kHalfFloatZero = UINT16_C(0); + constexpr uint16_t kHalfFloatHalf = UINT16_C(0x3800); + constexpr uint16_t kHalfFloatOne = UINT16_C(0x3c00); + constexpr uint16_t kHalfFloatTwo = UINT16_C(0x4000); /// - uint32_t uint32_dec(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_li(uint32_t _a); /// - uint32_t uint32_inc(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_dec(uint32_t _a); /// - uint32_t uint32_not(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_inc(uint32_t _a); /// - uint32_t uint32_neg(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_not(uint32_t _a); /// - uint32_t uint32_ext(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_neg(uint32_t _a); /// - uint32_t uint32_and(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_ext(uint32_t _a); /// - uint32_t uint32_andc(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_and(uint32_t _a, uint32_t _b); /// - uint32_t uint32_xor(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_andc(uint32_t _a, uint32_t _b); /// - uint32_t uint32_xorl(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_xor(uint32_t _a, uint32_t _b); /// - uint32_t uint32_or(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_xorl(uint32_t _a, uint32_t _b); /// - uint32_t uint32_orc(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_or(uint32_t _a, uint32_t _b); /// - uint32_t uint32_sll(uint32_t _a, int _sa); + BX_CONSTEXPR_FUNC uint32_t uint32_orc(uint32_t _a, uint32_t _b); /// - uint32_t uint32_srl(uint32_t _a, int _sa); + BX_CONSTEXPR_FUNC uint32_t uint32_sll(uint32_t _a, int32_t _sa); /// - uint32_t uint32_sra(uint32_t _a, int _sa); + BX_CONSTEXPR_FUNC uint32_t uint32_srl(uint32_t _a, int32_t _sa); /// - uint32_t uint32_rol(uint32_t _a, int _sa); + BX_CONSTEXPR_FUNC uint32_t uint32_sra(uint32_t _a, int32_t _sa); /// - uint32_t uint32_ror(uint32_t _a, int _sa); + BX_CONSTEXPR_FUNC uint32_t uint32_rol(uint32_t _a, int32_t _sa); /// - uint32_t uint32_add(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_ror(uint32_t _a, int32_t _sa); /// - uint32_t uint32_sub(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_add(uint32_t _a, uint32_t _b); /// - uint32_t uint32_mul(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_sub(uint32_t _a, uint32_t _b); /// - uint32_t uint32_div(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_mul(uint32_t _a, uint32_t _b); /// - uint32_t uint32_mod(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_div(uint32_t _a, uint32_t _b); /// - uint32_t uint32_cmpeq(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_mod(uint32_t _a, uint32_t _b); /// - uint32_t uint32_cmpneq(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_cmpeq(uint32_t _a, uint32_t _b); /// - uint32_t uint32_cmplt(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_cmpneq(uint32_t _a, uint32_t _b); /// - uint32_t uint32_cmple(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_cmplt(uint32_t _a, uint32_t _b); /// - uint32_t uint32_cmpgt(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_cmple(uint32_t _a, uint32_t _b); /// - uint32_t uint32_cmpge(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_cmpgt(uint32_t _a, uint32_t _b); /// - uint32_t uint32_setnz(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_cmpge(uint32_t _a, uint32_t _b); /// - uint32_t uint32_satadd(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_setnz(uint32_t _a); /// - uint32_t uint32_satsub(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_satadd(uint32_t _a, uint32_t _b); /// - uint32_t uint32_satmul(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_satsub(uint32_t _a, uint32_t _b); /// - uint32_t uint32_sels(uint32_t test, uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_satmul(uint32_t _a, uint32_t _b); /// - uint32_t uint32_selb(uint32_t _mask, uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_sels(uint32_t test, uint32_t _a, uint32_t _b); /// - uint32_t uint32_imin(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_selb(uint32_t _mask, uint32_t _a, uint32_t _b); /// - uint32_t uint32_imax(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_imin(uint32_t _a, uint32_t _b); /// - uint32_t uint32_min(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_imax(uint32_t _a, uint32_t _b); /// - uint32_t uint32_min(uint32_t _a, uint32_t _b, uint32_t _c); + BX_CONSTEXPR_FUNC uint32_t uint32_min(uint32_t _a, uint32_t _b); /// - uint32_t uint32_max(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_min(uint32_t _a, uint32_t _b, uint32_t _c); /// - uint32_t uint32_max(uint32_t _a, uint32_t _b, uint32_t _c); + BX_CONSTEXPR_FUNC uint32_t uint32_max(uint32_t _a, uint32_t _b); /// - uint32_t uint32_clamp(uint32_t _a, uint32_t _min, uint32_t _max); + BX_CONSTEXPR_FUNC uint32_t uint32_max(uint32_t _a, uint32_t _b, uint32_t _c); /// - uint32_t uint32_iclamp(uint32_t _a, uint32_t _min, uint32_t _max); + BX_CONSTEXPR_FUNC uint32_t uint32_clamp(uint32_t _a, uint32_t _min, uint32_t _max); /// - uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max); + BX_CONSTEXPR_FUNC uint32_t uint32_iclamp(uint32_t _a, uint32_t _min, uint32_t _max); /// - uint32_t uint32_decwrap(uint32_t _val, uint32_t _min, uint32_t _max); + BX_CONSTEXPR_FUNC uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max); /// - uint32_t uint32_cntbits_ref(uint32_t _val); + BX_CONSTEXPR_FUNC uint32_t uint32_decwrap(uint32_t _val, uint32_t _min, uint32_t _max); /// Count number of bits set. /// - uint32_t uint32_cntbits(uint32_t _val); - - /// - uint32_t uint32_cntlz_ref(uint32_t _val); + BX_CONSTEXPR_FUNC uint32_t uint32_cntbits(uint32_t _val); /// Count number of leading zeros. /// - uint32_t uint32_cntlz(uint32_t _val); + BX_CONSTEXPR_FUNC uint32_t uint32_cntlz(uint32_t _val); /// - uint32_t uint32_cnttz_ref(uint32_t _val); + BX_CONSTEXPR_FUNC uint32_t uint32_cnttz(uint32_t _val); /// - uint32_t uint32_cnttz(uint32_t _val); - - // shuffle: - // ---- ---- ---- ---- fedc ba98 7654 3210 - // to: - // -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0 - uint32_t uint32_part1by1(uint32_t _a); - - // shuffle: - // ---- ---- ---- ---- ---- --98 7654 3210 - // to: - // ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0 - /// - uint32_t uint32_part1by2(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_part1by1(uint32_t _a); /// - uint32_t uint32_testpow2(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_part1by2(uint32_t _a); /// - uint32_t uint32_nextpow2(uint32_t _a); + BX_CONSTEXPR_FUNC uint32_t uint32_testpow2(uint32_t _a); /// - uint16_t halfFromFloat(float _a); - - /// - float halfToFloat(uint16_t _a); - - /// - uint16_t uint16_min(uint16_t _a, uint16_t _b); - - /// - uint16_t uint16_max(uint16_t _a, uint16_t _b); - - /// - int64_t int64_min(int64_t _a, int64_t _b); - - /// - int64_t int64_max(int64_t _a, int64_t _b); - - /// - int64_t int64_clamp(int64_t _a, int64_t _min, int64_t _max); - - /// - uint32_t uint64_cntbits_ref(uint64_t _val); + BX_CONSTEXPR_FUNC uint32_t uint32_nextpow2(uint32_t _a); /// Count number of bits set. /// - uint32_t uint64_cntbits(uint64_t _val); - - /// - uint32_t uint64_cntlz_ref(uint64_t _val); + BX_CONSTEXPR_FUNC uint32_t uint64_cntbits(uint64_t _val); /// Count number of leading zeros. /// - uint32_t uint64_cntlz(uint64_t _val); + BX_CONSTEXPR_FUNC uint32_t uint64_cntlz(uint64_t _val); /// - uint32_t uint64_cnttz_ref(uint64_t _val); + BX_CONSTEXPR_FUNC uint32_t uint64_cnttz(uint64_t _val); /// - uint32_t uint64_cnttz(uint64_t _val); + BX_CONSTEXPR_FUNC uint64_t uint64_sll(uint64_t _a, int32_t _sa); /// - uint64_t uint64_sll(uint64_t _a, int _sa); + BX_CONSTEXPR_FUNC uint64_t uint64_srl(uint64_t _a, int32_t _sa); /// - uint64_t uint64_srl(uint64_t _a, int _sa); + BX_CONSTEXPR_FUNC uint64_t uint64_sra(uint64_t _a, int32_t _sa); /// - uint64_t uint64_sra(uint64_t _a, int _sa); + BX_CONSTEXPR_FUNC uint64_t uint64_rol(uint64_t _a, int32_t _sa); /// - uint64_t uint64_rol(uint64_t _a, int _sa); + BX_CONSTEXPR_FUNC uint64_t uint64_ror(uint64_t _a, int32_t _sa); /// - uint64_t uint64_ror(uint64_t _a, int _sa); + BX_CONSTEXPR_FUNC uint64_t uint64_add(uint64_t _a, uint64_t _b); /// - uint64_t uint64_add(uint64_t _a, uint64_t _b); + BX_CONSTEXPR_FUNC uint64_t uint64_sub(uint64_t _a, uint64_t _b); /// - uint64_t uint64_sub(uint64_t _a, uint64_t _b); - - /// - uint64_t uint64_mul(uint64_t _a, uint64_t _b); + BX_CONSTEXPR_FUNC uint64_t uint64_mul(uint64_t _a, uint64_t _b); /// Greatest common divisor. /// - uint32_t uint32_gcd(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_gcd(uint32_t _a, uint32_t _b); /// Least common multiple. /// - uint32_t uint32_lcm(uint32_t _a, uint32_t _b); + BX_CONSTEXPR_FUNC uint32_t uint32_lcm(uint32_t _a, uint32_t _b); /// Align to arbitrary stride. /// - uint32_t strideAlign(uint32_t _offset, uint32_t _stride); + BX_CONSTEXPR_FUNC uint32_t strideAlign(uint32_t _offset, uint32_t _stride); /// Align to arbitrary stride and 16-bytes. /// - uint32_t strideAlign16(uint32_t _offset, uint32_t _stride); + BX_CONSTEXPR_FUNC uint32_t strideAlign16(uint32_t _offset, uint32_t _stride); /// Align to arbitrary stride and 256-bytes. /// - uint32_t strideAlign256(uint32_t _offset, uint32_t _stride); + BX_CONSTEXPR_FUNC uint32_t strideAlign256(uint32_t _offset, uint32_t _stride); + + /// Convert float to half-float. + /// + BX_CONST_FUNC uint16_t halfFromFloat(float _a); + + /// Convert half-float to float. + /// + BX_CONST_FUNC float halfToFloat(uint16_t _a); } // namespace bx diff --git a/3rdparty/bx/include/bx/url.h b/3rdparty/bx/include/bx/url.h index 11172a47f9f..9e00d8348b4 100644 --- a/3rdparty/bx/include/bx/url.h +++ b/3rdparty/bx/include/bx/url.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/include/compat/mingw/sal.h b/3rdparty/bx/include/compat/mingw/sal.h index 5fe9e5d17c9..6487dfc8074 100644 --- a/3rdparty/bx/include/compat/mingw/sal.h +++ b/3rdparty/bx/include/compat/mingw/sal.h @@ -1,891 +1 @@ -#pragma once - -#if __GNUC__ >= 3 -# pragma GCC system_header -#endif - -#define __SAL_H_FULL_VER 1 - -//#define __null // << Conflicts with GCC internal type __null -#define __notnull -#define __maybenull -#define __readonly -#define __notreadonly -#define __maybereadonly -#define __valid -#define __notvalid -#define __maybevalid -#define __readableTo(extent) -#define __elem_readableTo(size) -#define __byte_readableTo(size) -#define __writableTo(size) -#define __elem_writableTo(size) -#define __byte_writableTo(size) -#define __deref -#define __pre -#define __post -#define __precond(expr) -#define __postcond(expr) -#define __exceptthat -#define __execeptthat -#define __inner_success(expr) -#define __inner_checkReturn __attribute__((warn_unused_result)) -#define __inner_typefix(ctype) -#define __inner_override -#define __inner_callback -#define __inner_blocksOn(resource) -#define __inner_fallthrough_dec -#define __inner_fallthrough -#define __refparam -#define __inner_control_entrypoint(category) -#define __inner_data_entrypoint(category) - -#define __ecount(size) -#define __bcount(size) -// #define __in // Conflicts with STL. -#define __in_ecount(size) -#define __in_bcount(size) -#define __in_z -#define __in_ecount_z(size) -#define __in_bcount_z(size) -#define __in_nz -#define __in_ecount_nz(size) -#define __in_bcount_nz(size) -#define __in_xcount_opt(size) -// #define __out // Conflicts with STL. -#define __out_ecount(size) -#define __out_bcount(size) -#define __out_ecount_part(size,length) -#define __out_bcount_part(size,length) -#define __out_ecount_full(size) -#define __out_bcount_full(size) -#define __out_z -#define __out_z_opt -#define __out_ecount_z(size) -#define __out_bcount_z(size) -#define __out_ecount_part_z(size,length) -#define __out_bcount_part_z(size,length) -#define __out_ecount_full_z(size) -#define __out_bcount_full_z(size) -#define __out_nz -#define __out_nz_opt -#define __out_ecount_nz(size) -#define __out_bcount_nz(size) -#define __inout -#define __inout_ecount(size) -#define __inout_bcount(size) -#define __inout_ecount_part(size,length) -#define __inout_bcount_part(size,length) -#define __inout_ecount_full(size) -#define __inout_bcount_full(size) -#define __inout_z -#define __inout_ecount_z(size) -#define __inout_bcount_z(size) -#define __inout_nz -#define __inout_ecount_nz(size) -#define __inout_bcount_nz(size) -#define __ecount_opt(size) -#define __bcount_opt(size) -#define __in_opt -#define __in_ecount_opt(size) -#define __in_bcount_opt(size) -#define __in_z_opt -#define __in_ecount_z_opt(size) -#define __in_bcount_z_opt(size) -#define __in_nz_opt -#define __in_ecount_nz_opt(size) -#define __in_bcount_nz_opt(size) -#define __out_opt -#define __out_ecount_opt(size) -#define __out_bcount_opt(size) -#define __out_ecount_part_opt(size,length) -#define __out_bcount_part_opt(size,length) -#define __out_ecount_full_opt(size) -#define __out_bcount_full_opt(size) -#define __out_ecount_z_opt(size) -#define __out_bcount_z_opt(size) -#define __out_ecount_part_z_opt(size,length) -#define __out_bcount_part_z_opt(size,length) -#define __out_ecount_full_z_opt(size) -#define __out_bcount_full_z_opt(size) -#define __out_ecount_nz_opt(size) -#define __out_bcount_nz_opt(size) -#define __inout_opt -#define __inout_ecount_opt(size) -#define __inout_bcount_opt(size) -#define __inout_ecount_part_opt(size,length) -#define __inout_bcount_part_opt(size,length) -#define __inout_ecount_full_opt(size) -#define __inout_bcount_full_opt(size) -#define __inout_z_opt -#define __inout_ecount_z_opt(size) -#define __inout_ecount_z_opt(size) -#define __inout_bcount_z_opt(size) -#define __inout_nz_opt -#define __inout_ecount_nz_opt(size) -#define __inout_bcount_nz_opt(size) -#define __deref_ecount(size) -#define __deref_bcount(size) -#define __deref_out -#define __deref_out_ecount(size) -#define __deref_out_bcount(size) -#define __deref_out_ecount_part(size,length) -#define __deref_out_bcount_part(size,length) -#define __deref_out_ecount_full(size) -#define __deref_out_bcount_full(size) -#define __deref_out_z -#define __deref_out_ecount_z(size) -#define __deref_out_bcount_z(size) -#define __deref_out_nz -#define __deref_out_ecount_nz(size) -#define __deref_out_bcount_nz(size) -#define __deref_inout -#define __deref_inout_z -#define __deref_inout_ecount(size) -#define __deref_inout_bcount(size) -#define __deref_inout_ecount_part(size,length) -#define __deref_inout_bcount_part(size,length) -#define __deref_inout_ecount_full(size) -#define __deref_inout_bcount_full(size) -#define __deref_inout_z -#define __deref_inout_ecount_z(size) -#define __deref_inout_bcount_z(size) -#define __deref_inout_nz -#define __deref_inout_ecount_nz(size) -#define __deref_inout_bcount_nz(size) -#define __deref_ecount_opt(size) -#define __deref_bcount_opt(size) -#define __deref_out_opt -#define __deref_out_ecount_opt(size) -#define __deref_out_bcount_opt(size) -#define __deref_out_ecount_part_opt(size,length) -#define __deref_out_bcount_part_opt(size,length) -#define __deref_out_ecount_full_opt(size) -#define __deref_out_bcount_full_opt(size) -#define __deref_out_z_opt -#define __deref_out_ecount_z_opt(size) -#define __deref_out_bcount_z_opt(size) -#define __deref_out_nz_opt -#define __deref_out_ecount_nz_opt(size) -#define __deref_out_bcount_nz_opt(size) -#define __deref_inout_opt -#define __deref_inout_ecount_opt(size) -#define __deref_inout_bcount_opt(size) -#define __deref_inout_ecount_part_opt(size,length) -#define __deref_inout_bcount_part_opt(size,length) -#define __deref_inout_ecount_full_opt(size) -#define __deref_inout_bcount_full_opt(size) -#define __deref_inout_z_opt -#define __deref_inout_ecount_z_opt(size) -#define __deref_inout_bcount_z_opt(size) -#define __deref_inout_nz_opt -#define __deref_inout_ecount_nz_opt(size) -#define __deref_inout_bcount_nz_opt(size) -#define __deref_opt_ecount(size) -#define __deref_opt_bcount(size) -#define __deref_opt_out -#define __deref_opt_out_z -#define __deref_opt_out_ecount(size) -#define __deref_opt_out_bcount(size) -#define __deref_opt_out_ecount_part(size,length) -#define __deref_opt_out_bcount_part(size,length) -#define __deref_opt_out_ecount_full(size) -#define __deref_opt_out_bcount_full(size) -#define __deref_opt_inout -#define __deref_opt_inout_ecount(size) -#define __deref_opt_inout_bcount(size) -#define __deref_opt_inout_ecount_part(size,length) -#define __deref_opt_inout_bcount_part(size,length) -#define __deref_opt_inout_ecount_full(size) -#define __deref_opt_inout_bcount_full(size) -#define __deref_opt_inout_z -#define __deref_opt_inout_ecount_z(size) -#define __deref_opt_inout_bcount_z(size) -#define __deref_opt_inout_nz -#define __deref_opt_inout_ecount_nz(size) -#define __deref_opt_inout_bcount_nz(size) -#define __deref_opt_ecount_opt(size) -#define __deref_opt_bcount_opt(size) -#define __deref_opt_out_opt -#define __deref_opt_out_ecount_opt(size) -#define __deref_opt_out_bcount_opt(size) -#define __deref_opt_out_ecount_part_opt(size,length) -#define __deref_opt_out_bcount_part_opt(size,length) -#define __deref_opt_out_ecount_full_opt(size) -#define __deref_opt_out_bcount_full_opt(size) -#define __deref_opt_out_z_opt -#define __deref_opt_out_ecount_z_opt(size) -#define __deref_opt_out_bcount_z_opt(size) -#define __deref_opt_out_nz_opt -#define __deref_opt_out_ecount_nz_opt(size) -#define __deref_opt_out_bcount_nz_opt(size) -#define __deref_opt_inout_opt -#define __deref_opt_inout_ecount_opt(size) -#define __deref_opt_inout_bcount_opt(size) -#define __deref_opt_inout_ecount_part_opt(size,length) -#define __deref_opt_inout_bcount_part_opt(size,length) -#define __deref_opt_inout_ecount_full_opt(size) -#define __deref_opt_inout_bcount_full_opt(size) -#define __deref_opt_inout_z_opt -#define __deref_opt_inout_ecount_z_opt(size) -#define __deref_opt_inout_bcount_z_opt(size) -#define __deref_opt_inout_nz_opt -#define __deref_opt_inout_ecount_nz_opt(size) -#define __deref_opt_inout_bcount_nz_opt(size) - -#define __success(expr) -#define __nullterminated -#define __nullnullterminated -#define __reserved -#define __checkReturn __inner_checkReturn -#define __typefix(ctype) -#define __override -#define __callback -#define __format_string -#define __blocksOn(resource) -#define __control_entrypoint(category) -#define __data_entrypoint(category) - -#define _Always_(annos) -#define _Analysis_noreturn_ -#define _Analysis_assume_(expr) -#define _At_(target, annos) -#define _At_buffer_(target, iter, bound, annos) -#define _COM_Outptr_ -#define _COM_Outptr_opt_ -#define _COM_Outptr_opt_result_maybenull_ -#define _COM_Outptr_result_maybenull_ -#define _Check_return_ -#define _Const_ -#define _Deref2_pre_readonly_ -#define _Deref_in_bound_ -#define _Deref_in_range_(lb,ub) -#define _Deref_inout_bound_ -#define _Deref_inout_z_ -#define _Deref_inout_z_bytecap_c_(size) -#define _Deref_inout_z_cap_c_(size) -#define _Deref_opt_out_ -#define _Deref_opt_out_opt_ -#define _Deref_opt_out_opt_z_ -#define _Deref_opt_out_z_ -#define _Deref_out_ -#define _Deref_out_bound_ -#define _Deref_out_opt_ -#define _Deref_out_opt_z_ -#define _Deref_out_range_(lb,ub) -#define _Deref_out_z_ -#define _Deref_out_z_bytecap_c_(size) -#define _Deref_out_z_cap_c_(size) -#define _Deref_post_bytecap_(size) -#define _Deref_post_bytecap_c_(size) -#define _Deref_post_bytecap_x_(size) -#define _Deref_post_bytecount_(size) -#define _Deref_post_bytecount_c_(size) -#define _Deref_post_bytecount_x_(size) -#define _Deref_post_cap_(size) -#define _Deref_post_cap_c_(size) -#define _Deref_post_cap_x_(size) -#define _Deref_post_count_(size) -#define _Deref_post_count_c_(size) -#define _Deref_post_count_x_(size) -#define _Deref_post_maybenull_ -#define _Deref_post_notnull_ -#define _Deref_post_null_ -#define _Deref_post_opt_bytecap_(size) -#define _Deref_post_opt_bytecap_c_(size) -#define _Deref_post_opt_bytecap_x_(size) -#define _Deref_post_opt_bytecount_(size) -#define _Deref_post_opt_bytecount_c_(size) -#define _Deref_post_opt_bytecount_x_(size) -#define _Deref_post_opt_cap_(size) -#define _Deref_post_opt_cap_c_(size) -#define _Deref_post_opt_cap_x_(size) -#define _Deref_post_opt_count_(size) -#define _Deref_post_opt_count_c_(size) -#define _Deref_post_opt_count_x_(size) -#define _Deref_post_opt_valid_ -#define _Deref_post_opt_valid_bytecap_(size) -#define _Deref_post_opt_valid_bytecap_c_(size) -#define _Deref_post_opt_valid_bytecap_x_(size) -#define _Deref_post_opt_valid_cap_(size) -#define _Deref_post_opt_valid_cap_c_(size) -#define _Deref_post_opt_valid_cap_x_(size) -#define _Deref_post_opt_z_ -#define _Deref_post_opt_z_bytecap_(size) -#define _Deref_post_opt_z_bytecap_c_(size) -#define _Deref_post_opt_z_bytecap_x_(size) -#define _Deref_post_opt_z_cap_(size) -#define _Deref_post_opt_z_cap_c_(size) -#define _Deref_post_opt_z_cap_x_(size) -#define _Deref_post_valid_ -#define _Deref_post_valid_bytecap_(size) -#define _Deref_post_valid_bytecap_c_(size) -#define _Deref_post_valid_bytecap_x_(size) -#define _Deref_post_valid_cap_(size) -#define _Deref_post_valid_cap_c_(size) -#define _Deref_post_valid_cap_x_(size) -#define _Deref_post_z_ -#define _Deref_post_z_bytecap_(size) -#define _Deref_post_z_bytecap_c_(size) -#define _Deref_post_z_bytecap_x_(size) -#define _Deref_post_z_cap_(size) -#define _Deref_post_z_cap_c_(size) -#define _Deref_post_z_cap_x_(size) -#define _Deref_pre_bytecap_(size) -#define _Deref_pre_bytecap_c_(size) -#define _Deref_pre_bytecap_x_(size) -#define _Deref_pre_bytecount_(size) -#define _Deref_pre_bytecount_c_(size) -#define _Deref_pre_bytecount_x_(size) -#define _Deref_pre_cap_(size) -#define _Deref_pre_cap_c_(size) -#define _Deref_pre_cap_x_(size) -#define _Deref_pre_count_(size) -#define _Deref_pre_count_c_(size) -#define _Deref_pre_count_x_(size) -#define _Deref_pre_invalid_ -#define _Deref_pre_maybenull_ -#define _Deref_pre_notnull_ -#define _Deref_pre_null_ -#define _Deref_pre_opt_bytecap_(size) -#define _Deref_pre_opt_bytecap_c_(size) -#define _Deref_pre_opt_bytecap_x_(size) -#define _Deref_pre_opt_bytecount_(size) -#define _Deref_pre_opt_bytecount_c_(size) -#define _Deref_pre_opt_bytecount_x_(size) -#define _Deref_pre_opt_cap_(size) -#define _Deref_pre_opt_cap_c_(size) -#define _Deref_pre_opt_cap_x_(size) -#define _Deref_pre_opt_count_(size) -#define _Deref_pre_opt_count_c_(size) -#define _Deref_pre_opt_count_x_(size) -#define _Deref_pre_opt_valid_ -#define _Deref_pre_opt_valid_bytecap_(size) -#define _Deref_pre_opt_valid_bytecap_c_(size) -#define _Deref_pre_opt_valid_bytecap_x_(size) -#define _Deref_pre_opt_valid_cap_(size) -#define _Deref_pre_opt_valid_cap_c_(size) -#define _Deref_pre_opt_valid_cap_x_(size) -#define _Deref_pre_opt_z_ -#define _Deref_pre_opt_z_bytecap_(size) -#define _Deref_pre_opt_z_bytecap_c_(size) -#define _Deref_pre_opt_z_bytecap_x_(size) -#define _Deref_pre_opt_z_cap_(size) -#define _Deref_pre_opt_z_cap_c_(size) -#define _Deref_pre_opt_z_cap_x_(size) -#define _Deref_pre_readonly_ -#define _Deref_pre_valid_ -#define _Deref_pre_valid_bytecap_(size) -#define _Deref_pre_valid_bytecap_c_(size) -#define _Deref_pre_valid_bytecap_x_(size) -#define _Deref_pre_valid_cap_(size) -#define _Deref_pre_valid_cap_c_(size) -#define _Deref_pre_valid_cap_x_(size) -#define _Deref_pre_writeonly_ -#define _Deref_pre_z_ -#define _Deref_pre_z_bytecap_(size) -#define _Deref_pre_z_bytecap_c_(size) -#define _Deref_pre_z_bytecap_x_(size) -#define _Deref_pre_z_cap_(size) -#define _Deref_pre_z_cap_c_(size) -#define _Deref_pre_z_cap_x_(size) -#define _Deref_prepost_bytecap_(size) -#define _Deref_prepost_bytecap_x_(size) -#define _Deref_prepost_bytecount_(size) -#define _Deref_prepost_bytecount_x_(size) -#define _Deref_prepost_cap_(size) -#define _Deref_prepost_cap_x_(size) -#define _Deref_prepost_count_(size) -#define _Deref_prepost_count_x_(size) -#define _Deref_prepost_opt_bytecap_(size) -#define _Deref_prepost_opt_bytecap_x_(size) -#define _Deref_prepost_opt_bytecount_(size) -#define _Deref_prepost_opt_bytecount_x_(size) -#define _Deref_prepost_opt_cap_(size) -#define _Deref_prepost_opt_cap_x_(size) -#define _Deref_prepost_opt_count_(size) -#define _Deref_prepost_opt_count_x_(size) -#define _Deref_prepost_opt_valid_ -#define _Deref_prepost_opt_valid_bytecap_(size) -#define _Deref_prepost_opt_valid_bytecap_x_(size) -#define _Deref_prepost_opt_valid_cap_(size) -#define _Deref_prepost_opt_valid_cap_x_(size) -#define _Deref_prepost_opt_z_ -#define _Deref_prepost_opt_z_bytecap_(size) -#define _Deref_prepost_opt_z_cap_(size) -#define _Deref_prepost_valid_ -#define _Deref_prepost_valid_bytecap_(size) -#define _Deref_prepost_valid_bytecap_x_(size) -#define _Deref_prepost_valid_cap_(size) -#define _Deref_prepost_valid_cap_x_(size) -#define _Deref_prepost_z_ -#define _Deref_prepost_z_bytecap_(size) -#define _Deref_prepost_z_cap_(size) -#define _Deref_ret_bound_ -#define _Deref_ret_opt_z_ -#define _Deref_ret_range_(lb,ub) -#define _Deref_ret_z_ -#define _Field_range_(min,max) -#define _Field_size_(size) -#define _Field_size_bytes_(size) -#define _Field_size_bytes_full_(size) -#define _Field_size_bytes_full_opt_(size) -#define _Field_size_bytes_opt_(size) -#define _Field_size_bytes_part_(size, count) -#define _Field_size_bytes_part_opt_(size, count) -#define _Field_size_full_(size) -#define _Field_size_full_opt_(size) -#define _Field_size_opt_(size) -#define _Field_size_part_(size, count) -#define _Field_size_part_opt_(size, count) -#define _Field_z_ -#define _Function_class_(x) -#define _Group_(annos) -#define _In_ -#define _In_bound_ -#define _In_bytecount_(size) -#define _In_bytecount_c_(size) -#define _In_bytecount_x_(size) -#define _In_count_(size) -#define _In_count_c_(size) -#define _In_count_x_(size) -#define _In_defensive_(annotes) -#define _In_opt_ -#define _In_opt_bytecount_(size) -#define _In_opt_bytecount_c_(size) -#define _In_opt_bytecount_x_(size) -#define _In_opt_count_(size) -#define _In_opt_count_c_(size) -#define _In_opt_count_x_(size) -#define _In_opt_ptrdiff_count_(size) -#define _In_opt_z_ -#define _In_opt_z_bytecount_(size) -#define _In_opt_z_bytecount_c_(size) -#define _In_opt_z_count_(size) -#define _In_opt_z_count_c_(size) -#define _In_ptrdiff_count_(size) -#define _In_range_(lb,ub) -#define _In_reads_(size) -#define _In_reads_bytes_(size) -#define _In_reads_bytes_opt_(size) -#define _In_reads_opt_(size) -#define _In_reads_opt_z_(size) -#define _In_reads_or_z_(size) -#define _In_reads_to_ptr_(ptr) -#define _In_reads_to_ptr_opt_(ptr) -#define _In_reads_to_ptr_opt_z_(ptr) -#define _In_reads_to_ptr_z_(ptr) -#define _In_reads_z_(size) -#define _In_z_ -#define _In_z_bytecount_(size) -#define _In_z_bytecount_c_(size) -#define _In_z_count_(size) -#define _In_z_count_c_(size) -#define _Inout_ -#define _Inout_bytecap_(size) -#define _Inout_bytecap_c_(size) -#define _Inout_bytecap_x_(size) -#define _Inout_bytecount_(size) -#define _Inout_bytecount_c_(size) -#define _Inout_bytecount_x_(size) -#define _Inout_cap_(size) -#define _Inout_cap_c_(size) -#define _Inout_cap_x_(size) -#define _Inout_count_(size) -#define _Inout_count_c_(size) -#define _Inout_count_x_(size) -#define _Inout_defensive_(annotes) -#define _Inout_opt_ -#define _Inout_opt_bytecap_(size) -#define _Inout_opt_bytecap_c_(size) -#define _Inout_opt_bytecap_x_(size) -#define _Inout_opt_bytecount_(size) -#define _Inout_opt_bytecount_c_(size) -#define _Inout_opt_bytecount_x_(size) -#define _Inout_opt_cap_(size) -#define _Inout_opt_cap_c_(size) -#define _Inout_opt_cap_x_(size) -#define _Inout_opt_count_(size) -#define _Inout_opt_count_c_(size) -#define _Inout_opt_count_x_(size) -#define _Inout_opt_ptrdiff_count_(size) -#define _Inout_opt_z_ -#define _Inout_opt_z_bytecap_(size) -#define _Inout_opt_z_bytecap_c_(size) -#define _Inout_opt_z_bytecap_x_(size) -#define _Inout_opt_z_bytecount_(size) -#define _Inout_opt_z_bytecount_c_(size) -#define _Inout_opt_z_cap_(size) -#define _Inout_opt_z_cap_c_(size) -#define _Inout_opt_z_cap_x_(size) -#define _Inout_opt_z_count_(size) -#define _Inout_opt_z_count_c_(size) -#define _Inout_ptrdiff_count_(size) -#define _Inout_updates_(size) -#define _Inout_updates_all_(size) -#define _Inout_updates_all_opt_(size) -#define _Inout_updates_bytes_(size) -#define _Inout_updates_bytes_all_(size) -#define _Inout_updates_bytes_all_opt_(size) -#define _Inout_updates_bytes_opt_(size) -#define _Inout_updates_bytes_to_(size,count) -#define _Inout_updates_bytes_to_opt_(size,count) -#define _Inout_updates_opt_(size) -#define _Inout_updates_opt_z_(size) -#define _Inout_updates_to_(size,count) -#define _Inout_updates_to_opt_(size,count) -#define _Inout_updates_z_(size) -#define _Inout_z_ -#define _Inout_z_bytecap_(size) -#define _Inout_z_bytecap_c_(size) -#define _Inout_z_bytecap_x_(size) -#define _Inout_z_bytecount_(size) -#define _Inout_z_bytecount_c_(size) -#define _Inout_z_cap_(size) -#define _Inout_z_cap_c_(size) -#define _Inout_z_cap_x_(size) -#define _Inout_z_count_(size) -#define _Inout_z_count_c_(size) -#define _Interlocked_operand_ -#define _Literal_ -#define _Maybe_raises_SEH_exception -#define _Maybe_raises_SEH_exception_ -#define _Maybenull_ -#define _Maybevalid_ -#define _Must_inspect_result_ -#define _Notliteral_ -#define _Notnull_ -#define _Notref_ -#define _Notvalid_ -#define _NullNull_terminated_ -#define _Null_ -#define _Null_terminated_ -#define _On_failure_(annos) -#define _Out_ -#define _Out_bound_ -#define _Out_bytecap_(size) -#define _Out_bytecap_c_(size) -#define _Out_bytecap_post_bytecount_(cap,count) -#define _Out_bytecap_x_(size) -#define _Out_bytecapcount_(capcount) -#define _Out_bytecapcount_x_(capcount) -#define _Out_cap_(size) -#define _Out_cap_c_(size) -#define _Out_cap_m_(mult,size) -#define _Out_cap_post_count_(cap,count) -#define _Out_cap_x_(size) -#define _Out_capcount_(capcount) -#define _Out_capcount_x_(capcount) -#define _Out_defensive_(annotes) -#define _Out_opt_ -#define _Out_opt_bytecap_(size) -#define _Out_opt_bytecap_c_(size) -#define _Out_opt_bytecap_post_bytecount_(cap,count) -#define _Out_opt_bytecap_x_(size) -#define _Out_opt_bytecapcount_(capcount) -#define _Out_opt_bytecapcount_x_(capcount) -#define _Out_opt_cap_(size) -#define _Out_opt_cap_c_(size) -#define _Out_opt_cap_m_(mult,size) -#define _Out_opt_cap_post_count_(cap,count) -#define _Out_opt_cap_x_(size) -#define _Out_opt_capcount_(capcount) -#define _Out_opt_capcount_x_(capcount) -#define _Out_opt_ptrdiff_cap_(size) -#define _Out_opt_z_bytecap_(size) -#define _Out_opt_z_bytecap_c_(size) -#define _Out_opt_z_bytecap_post_bytecount_(cap,count) -#define _Out_opt_z_bytecap_x_(size) -#define _Out_opt_z_bytecapcount_(capcount) -#define _Out_opt_z_cap_(size) -#define _Out_opt_z_cap_c_(size) -#define _Out_opt_z_cap_m_(mult,size) -#define _Out_opt_z_cap_post_count_(cap,count) -#define _Out_opt_z_cap_x_(size) -#define _Out_opt_z_capcount_(capcount) -#define _Out_ptrdiff_cap_(size) -#define _Out_range_(lb,ub) -#define _Out_writes_(size) -#define _Out_writes_all_(size) -#define _Out_writes_all_opt_(size) -#define _Out_writes_bytes_(size) -#define _Out_writes_bytes_all_(size) -#define _Out_writes_bytes_all_opt_(size) -#define _Out_writes_bytes_opt_(size) -#define _Out_writes_bytes_to_(size,count) -#define _Out_writes_bytes_to_opt_(size,count) -#define _Out_writes_opt_(size) -#define _Out_writes_opt_z_(size) -#define _Out_writes_to_(size,count) -#define _Out_writes_to_opt_(size,count) -#define _Out_writes_to_ptr_(ptr) -#define _Out_writes_to_ptr_opt_(ptr) -#define _Out_writes_to_ptr_opt_z_(ptr) -#define _Out_writes_to_ptr_z_(ptr) -#define _Out_writes_z_(size) -#define _Out_z_bytecap_(size) -#define _Out_z_bytecap_c_(size) -#define _Out_z_bytecap_post_bytecount_(cap,count) -#define _Out_z_bytecap_x_(size) -#define _Out_z_bytecapcount_(capcount) -#define _Out_z_cap_(size) -#define _Out_z_cap_c_(size) -#define _Out_z_cap_m_(mult,size) -#define _Out_z_cap_post_count_(cap,count) -#define _Out_z_cap_x_(size) -#define _Out_z_capcount_(capcount) -#define _Outptr_ -#define _Outptr_opt_ -#define _Outptr_opt_result_buffer_(size) -#define _Outptr_opt_result_buffer_all_(size) -#define _Outptr_opt_result_buffer_all_maybenull_(size) -#define _Outptr_opt_result_buffer_maybenull_(size) -#define _Outptr_opt_result_buffer_to_(size, count) -#define _Outptr_opt_result_buffer_to_maybenull_(size, count) -#define _Outptr_opt_result_bytebuffer_(size) -#define _Outptr_opt_result_bytebuffer_all_(size) -#define _Outptr_opt_result_bytebuffer_all_maybenull_(size) -#define _Outptr_opt_result_bytebuffer_maybenull_(size) -#define _Outptr_opt_result_bytebuffer_to_(size, count) -#define _Outptr_opt_result_bytebuffer_to_maybenull_(size, count) -#define _Outptr_opt_result_maybenull_ -#define _Outptr_opt_result_maybenull_z_ -#define _Outptr_opt_result_nullonfailure_ -#define _Outptr_opt_result_z_ -#define _Outptr_result_buffer_(size) -#define _Outptr_result_buffer_all_(size) -#define _Outptr_result_buffer_all_maybenull_(size) -#define _Outptr_result_buffer_maybenull_(size) -#define _Outptr_result_buffer_to_(size, count) -#define _Outptr_result_buffer_to_maybenull_(size, count) -#define _Outptr_result_bytebuffer_(size) -#define _Outptr_result_bytebuffer_all_(size) -#define _Outptr_result_bytebuffer_all_maybenull_(size) -#define _Outptr_result_bytebuffer_maybenull_(size) -#define _Outptr_result_bytebuffer_to_(size, count) -#define _Outptr_result_bytebuffer_to_maybenull_(size, count) -#define _Outptr_result_maybenull_ -#define _Outptr_result_maybenull_z_ -#define _Outptr_result_nullonfailure_ -#define _Outptr_result_z_ -#define _Outref_ -#define _Outref_result_buffer_(size) -#define _Outref_result_buffer_all_(size) -#define _Outref_result_buffer_all_maybenull_(size) -#define _Outref_result_buffer_maybenull_(size) -#define _Outref_result_buffer_to_(size, count) -#define _Outref_result_buffer_to_maybenull_(size, count) -#define _Outref_result_bytebuffer_(size) -#define _Outref_result_bytebuffer_all_(size) -#define _Outref_result_bytebuffer_all_maybenull_(size) -#define _Outref_result_bytebuffer_maybenull_(size) -#define _Outref_result_bytebuffer_to_(size, count) -#define _Outref_result_bytebuffer_to_maybenull_(size, count) -#define _Outref_result_maybenull_ -#define _Outref_result_nullonfailure_ -#define _Points_to_data_ -#define _Post_ -#define _Post_bytecap_(size) -#define _Post_bytecount_(size) -#define _Post_bytecount_c_(size) -#define _Post_bytecount_x_(size) -#define _Post_cap_(size) -#define _Post_count_(size) -#define _Post_count_c_(size) -#define _Post_count_x_(size) -#define _Post_defensive_ -#define _Post_equal_to_(expr) -#define _Post_invalid_ -#define _Post_maybenull_ -#define _Post_maybez_ -#define _Post_notnull_ -#define _Post_null_ -#define _Post_ptr_invalid_ -#define _Post_readable_byte_size_(size) -#define _Post_readable_size_(size) -#define _Post_satisfies_(cond) -#define _Post_valid_ -#define _Post_writable_byte_size_(size) -#define _Post_writable_size_(size) -#define _Post_z_ -#define _Post_z_bytecount_(size) -#define _Post_z_bytecount_c_(size) -#define _Post_z_bytecount_x_(size) -#define _Post_z_count_(size) -#define _Post_z_count_c_(size) -#define _Post_z_count_x_(size) -#define _Pre_ -#define _Pre_bytecap_(size) -#define _Pre_bytecap_c_(size) -#define _Pre_bytecap_x_(size) -#define _Pre_bytecount_(size) -#define _Pre_bytecount_c_(size) -#define _Pre_bytecount_x_(size) -#define _Pre_cap_(size) -#define _Pre_cap_c_(size) -#define _Pre_cap_c_one_ -#define _Pre_cap_for_(param) -#define _Pre_cap_m_(mult,size) -#define _Pre_cap_x_(size) -#define _Pre_count_(size) -#define _Pre_count_c_(size) -#define _Pre_count_x_(size) -#define _Pre_defensive_ -#define _Pre_equal_to_(expr) -#define _Pre_invalid_ -#define _Pre_maybenull_ -#define _Pre_notnull_ -#define _Pre_null_ -#define _Pre_opt_bytecap_(size) -#define _Pre_opt_bytecap_c_(size) -#define _Pre_opt_bytecap_x_(size) -#define _Pre_opt_bytecount_(size) -#define _Pre_opt_bytecount_c_(size) -#define _Pre_opt_bytecount_x_(size) -#define _Pre_opt_cap_(size) -#define _Pre_opt_cap_c_(size) -#define _Pre_opt_cap_c_one_ -#define _Pre_opt_cap_for_(param) -#define _Pre_opt_cap_m_(mult,size) -#define _Pre_opt_cap_x_(size) -#define _Pre_opt_count_(size) -#define _Pre_opt_count_c_(size) -#define _Pre_opt_count_x_(size) -#define _Pre_opt_ptrdiff_cap_(ptr) -#define _Pre_opt_ptrdiff_count_(ptr) -#define _Pre_opt_valid_ -#define _Pre_opt_valid_bytecap_(size) -#define _Pre_opt_valid_bytecap_c_(size) -#define _Pre_opt_valid_bytecap_x_(size) -#define _Pre_opt_valid_cap_(size) -#define _Pre_opt_valid_cap_c_(size) -#define _Pre_opt_valid_cap_x_(size) -#define _Pre_opt_z_ -#define _Pre_opt_z_bytecap_(size) -#define _Pre_opt_z_bytecap_c_(size) -#define _Pre_opt_z_bytecap_x_(size) -#define _Pre_opt_z_cap_(size) -#define _Pre_opt_z_cap_c_(size) -#define _Pre_opt_z_cap_x_(size) -#define _Pre_ptrdiff_cap_(ptr) -#define _Pre_ptrdiff_count_(ptr) -#define _Pre_readable_byte_size_(size) -#define _Pre_readable_size_(size) -#define _Pre_readonly_ -#define _Pre_satisfies_(cond) -#define _Pre_valid_ -#define _Pre_valid_bytecap_(size) -#define _Pre_valid_bytecap_c_(size) -#define _Pre_valid_bytecap_x_(size) -#define _Pre_valid_cap_(size) -#define _Pre_valid_cap_c_(size) -#define _Pre_valid_cap_x_(size) -#define _Pre_writable_byte_size_(size) -#define _Pre_writable_size_(size) -#define _Pre_writeonly_ -#define _Pre_z_ -#define _Pre_z_bytecap_(size) -#define _Pre_z_bytecap_c_(size) -#define _Pre_z_bytecap_x_(size) -#define _Pre_z_cap_(size) -#define _Pre_z_cap_c_(size) -#define _Pre_z_cap_x_(size) -#define _Prepost_bytecount_(size) -#define _Prepost_bytecount_c_(size) -#define _Prepost_bytecount_x_(size) -#define _Prepost_count_(size) -#define _Prepost_count_c_(size) -#define _Prepost_count_x_(size) -#define _Prepost_opt_bytecount_(size) -#define _Prepost_opt_bytecount_c_(size) -#define _Prepost_opt_bytecount_x_(size) -#define _Prepost_opt_count_(size) -#define _Prepost_opt_count_c_(size) -#define _Prepost_opt_count_x_(size) -#define _Prepost_opt_valid_ -#define _Prepost_opt_z_ -#define _Prepost_valid_ -#define _Prepost_z_ -#define _Printf_format_string_ -#define _Raises_SEH_exception_ -#define _Readable_bytes_(size) -#define _Readable_elements_(size) -#define _Reserved_ -#define _Result_nullonfailure_ -#define _Result_zeroonfailure_ -#define _Ret_ -#define _Ret_bound_ -#define _Ret_bytecap_(size) -#define _Ret_bytecap_c_(size) -#define _Ret_bytecap_x_(size) -#define _Ret_bytecount_(size) -#define _Ret_bytecount_c_(size) -#define _Ret_bytecount_x_(size) -#define _Ret_cap_(size) -#define _Ret_cap_c_(size) -#define _Ret_cap_x_(size) -#define _Ret_count_(size) -#define _Ret_count_c_(size) -#define _Ret_count_x_(size) -#define _Ret_maybenull_ -#define _Ret_maybenull_z_ -#define _Ret_notnull_ -#define _Ret_null_ -#define _Ret_opt_ -#define _Ret_opt_bytecap_(size) -#define _Ret_opt_bytecap_c_(size) -#define _Ret_opt_bytecap_x_(size) -#define _Ret_opt_bytecount_(size) -#define _Ret_opt_bytecount_c_(size) -#define _Ret_opt_bytecount_x_(size) -#define _Ret_opt_cap_(size) -#define _Ret_opt_cap_c_(size) -#define _Ret_opt_cap_x_(size) -#define _Ret_opt_count_(size) -#define _Ret_opt_count_c_(size) -#define _Ret_opt_count_x_(size) -#define _Ret_opt_valid_ -#define _Ret_opt_z_ -#define _Ret_opt_z_bytecap_(size) -#define _Ret_opt_z_bytecount_(size) -#define _Ret_opt_z_cap_(size) -#define _Ret_opt_z_count_(size) -#define _Ret_range_(lb,ub) -#define _Ret_valid_ -#define _Ret_writes_(size) -#define _Ret_writes_bytes_(size) -#define _Ret_writes_bytes_maybenull_(size) -#define _Ret_writes_bytes_to_(size,count) -#define _Ret_writes_bytes_to_maybenull_(size,count) -#define _Ret_writes_maybenull_(size) -#define _Ret_writes_maybenull_z_(size) -#define _Ret_writes_to_(size,count) -#define _Ret_writes_to_maybenull_(size,count) -#define _Ret_writes_z_(size) -#define _Ret_z_ -#define _Ret_z_bytecap_(size) -#define _Ret_z_bytecount_(size) -#define _Ret_z_cap_(size) -#define _Ret_z_count_(size) -#define _Return_type_success_(expr) -#define _Scanf_format_string_ -#define _Scanf_s_format_string_ -#define _Struct_size_bytes_(size) -#define _Success_(expr) -#define _Unchanged_(e) -#define _Use_decl_annotations_ -#define _Valid_ -#define _When_(expr, annos) -#define _Writable_bytes_(size) -#define _Writable_elements_(size) -#define __inner_callback -#define __inner_exceptthat -#define __inner_typefix(ctype) - -#ifndef __fallthrough -# define __fallthrough __inner_fallthrough -#endif - -#ifndef __analysis_assume -# define __analysis_assume(expr) -#endif +#include "salieri.h" diff --git a/3rdparty/bx/include/compat/mingw/salieri.h b/3rdparty/bx/include/compat/mingw/salieri.h new file mode 100644 index 00000000000..06d72075c3f --- /dev/null +++ b/3rdparty/bx/include/compat/mingw/salieri.h @@ -0,0 +1,1607 @@ +/** + * Salieri + * v1 + * + * Salieri is a header which contains definitions for the Microsoft + * source-code annotation language (SAL). It is *not* an + * implementation of SAL; that's for compilers and static analyzers. + * For the most part we just define macros to nothing. + * + * The goal is to allow projects to use SAL without creating a hard + * dependency on it (i.e., you can still use compilers other than + * MSVC). Simply include `salieri.h`, which you can/should distribute + * with your code, instead of ``. + * + * Multiple copies of Salieri can be included safely, even different + * versions. Including a newer version will simiply replace older + * definitions with newer ones, and including older versions will have + * no effect. + * + * I don't think anything in here is copyrightable, but just in case: + * + * To the extent possible under law, the author(s) have dedicated + * all copyright and related and neighboring rights to this software + * to the public domain worldwide. This software is distributed + * without any warranty. + * + * For details, see . + */ + +#if !defined(SALIERI_VERSION) || (SALIERI_VERSION < 1) + +/* TODO: figure out when first appeared. */ +#if defined(_MSC_VER) +# include +#endif + +/* The main concern for the implementation is that we don't want to + * replace annotations from , but we *do* want to replace + * annotations from older versions of Salieri. To keep track of + * everything, when we (Salieri) define a SAL annotation, we also + * define SALIERI_DEFINED_${annotation} (with the leading and trailing + * '-' stripped). Then, before redefining an annotation macro we + * check to make sure SALIERI_DEFINED_${annontation} is defined. + * + * This means you can safely use Salieri in a public header in your + * project. + */ + +/* Function Parameters & Return Value + * + * https://msdn.microsoft.com/en-us/library/hh916382.aspx + *****/ + +/* Pointer Parameters */ + +#if defined(_In_) && defined(SALIERI_DEFINED_In) +# undef _In_ +#endif +#if !defined(_In_) +# define _In_ +# define SALIERI_DEFINED_In +#endif + +#if defined(__in_bcount) && defined(SALIERI_DEFINED__in_bcount) +# undef __in_bcount +#endif +#if !defined(__in_bcount) +# define __in_bcount(s) +# define SALIERI_DEFINED__in_bcount(s) +#endif + +#if defined(__in_ecount) && defined(SALIERI_DEFINED__in_ecount) +# undef __in_ecount +#endif +#if !defined(__in_ecount) +# define __in_ecount(s) +# define SALIERI_DEFINED__in_ecount(s) +#endif + +#if defined(__in_ecount_opt) && defined(SALIERI_DEFINED__in_ecount_opt) +# undef __in_ecount_opt +#endif +#if !defined(__in_ecount_opt) +# define __in_ecount_opt(s) +# define SALIERI_DEFINED__in_ecount_opt(s) +#endif + +#if defined(_Out_) && defined(SALIERI_DEFINED_Out) +# undef _Out_ +#endif +#if !defined(_Out_) +# define _Out_ +# define SALIERI_DEFINED_Out +#endif + +#if defined(_Inout_) && defined(SALIERI_DEFINED_Inout) +# undef _Inout_ +#endif +#if !defined(_Inout_) +# define _Inout_ +# define SALIERI_DEFINED_Inout +#endif + +#if defined(_In_z_) && defined(SALIERI_DEFINED_In_z) +# undef _In_z_ +#endif +#if !defined(_In_z_) +# define _In_z_ +# define SALIERI_DEFINED_In_z +#endif + +#if defined(_Inout_z_) && defined(SALIERI_DEFINED_Inout_z) +# undef _Inout_z_ +#endif +#if !defined(_Inout_z_) +# define _Inout_z_ +# define SALIERI_DEFINED_Inout_z +#endif + +#if defined(_In_reads_) && defined(SALIERI_DEFINED_In_reads) +# undef _In_reads_ +#endif +#if !defined(_In_reads_) +# define _In_reads_(s) +# define SALIERI_DEFINED_In_reads +#endif + +#if defined(_In_reads_bytes_) && defined(SALIERI_DEFINED_In_reads_bytes) +# undef _In_reads_bytes_ +#endif +#if !defined(_In_reads_bytes_) +# define _In_reads_bytes_(s) +# define SALIERI_DEFINED_In_reads_bytes +#endif + +#if defined(_In_reads_z_) && defined(SALIERI_DEFINED_In_reads_z) +# undef _In_reads_z_ +#endif +#if !defined(_In_reads_z_) +# define _In_reads_z_(s) +# define SALIERI_DEFINED_In_reads_z +#endif + +#if defined(_In_reads_or_z_) && defined(SALIERI_DEFINED_In_reads_or_z) +# undef _In_reads_or_z_ +#endif +#if !defined(_In_reads_or_z_) +# define _In_reads_or_z_(s) +# define SALIERI_DEFINED_In_reads_or_z +#endif + +#if defined(_Out_writes_) && defined(SALIERI_DEFINED_Out_writes) +# undef _Out_writes_ +#endif +#if !defined(_Out_writes_) +# define _Out_writes_(s) +# define SALIERI_DEFINED_Out_writes +#endif + +#if defined(_Out_writes_bytes_) && defined(SALIERI_DEFINED_Out_writes_bytes) +# undef _Out_writes_bytes_ +#endif +#if !defined(_Out_writes_bytes_) +# define _Out_writes_bytes_(s) +# define SALIERI_DEFINED_Out_writes_bytes +#endif + +#if defined(_Out_writes_bytes_opt_) && defined(SALIERI_DEFINED_Out_writes_bytes_opt_) +# undef _Out_writes_bytes_opt_ +#endif +#if !defined(_Out_writes_bytes_opt_) +# define _Out_writes_bytes_opt_(s) +# define SALIERI_DEFINED_Out_writes_bytes_opt_ +#endif + +#if defined(_Out_writes_z_) && defined(SALIERI_DEFINED_Out_writes_z) +# undef _Out_writes_z_ +#endif +#if !defined(_Out_writes_z_) +# define _Out_writes_z_(s) +# define SALIERI_DEFINED_Out_writes_z +#endif + +#if defined(_Inout_updates_) && defined(SALIERI_DEFINED_Inout_updates) +# undef _Inout_updates_ +#endif +#if !defined(_Inout_updates_) +# define _Inout_updates_(s) +# define SALIERI_DEFINED_Inout_updates +#endif + +#if defined(_Inout_updates_bytes_) && defined(SALIERI_DEFINED_Inout_updates_bytes) +# undef _Inout_updates_bytes_ +#endif +#if !defined(_Inout_updates_bytes_) +# define _Inout_updates_bytes_(s) +# define SALIERI_DEFINED_Inout_updates_bytes +#endif + +#if defined(_Inout_updates_z_) && defined(SALIERI_DEFINED_Inout_updates_z) +# undef _Inout_updates_z_ +#endif +#if !defined(_Inout_updates_z_) +# define _Inout_updates_z_(s) +# define SALIERI_DEFINED_Inout_updates_z +#endif + +#if defined(_Out_writes_to_) && defined(SALIERI_DEFINED_Out_writes_to) +# undef _Out_writes_to_ +#endif +#if !defined(_Out_writes_to_) +# define _Out_writes_to_(s,c) +# define SALIERI_DEFINED_Out_writes_to +#endif + +#if defined(_Out_writes_bytes_to_) && defined(SALIERI_DEFINED_Out_writes_bytes_to) +# undef _Out_writes_bytes_to_ +#endif +#if !defined(_Out_writes_bytes_to_) +# define _Out_writes_bytes_to_(s,c) +# define SALIERI_DEFINED_Out_writes_bytes_to +#endif + +#if defined(_Out_writes_all_) && defined(SALIERI_DEFINED_Out_writes_all) +# undef _Out_writes_all_ +#endif +#if !defined(_Out_writes_all_) +# define _Out_writes_all_(s) +# define SALIERI_DEFINED_Out_writes_all +#endif + +#if defined(_Out_writes_bytes_all_) && defined(SALIERI_DEFINED_Out_writes_bytes_all) +# undef _Out_writes_bytes_all_ +#endif +#if !defined(_Out_writes_bytes_all_) +# define _Out_writes_bytes_all_(s) +# define SALIERI_DEFINED_Out_writes_bytes_all +#endif + +#if defined(_In_updates_to_) && defined(SALIERI_DEFINED_In_updates_to) +# undef _In_updates_to_ +#endif +#if !defined(_In_updates_to_) +# define _In_updates_to_(s,c) +# define SALIERI_DEFINED_In_updates_to +#endif + +#if defined(_In_updates_bytes_to_) && defined(SALIERI_DEFINED_In_updates_bytes_to) +# undef _In_updates_bytes_to_ +#endif +#if !defined(_In_updates_bytes_to_) +# define _In_updates_bytes_to_(s,c) +# define SALIERI_DEFINED_In_updates_bytes_to +#endif + +#if defined(_Inout_updates_z_) && defined(SALIERI_DEFINED_Inout_updates_z) +# undef _Inout_updates_z_ +#endif +#if !defined(_Inout_updates_z_) +# define _Inout_updates_z_(s) +# define SALIERI_DEFINED_Inout_updates_z +#endif + +#if defined(_Out_writes_to_) && defined(SALIERI_DEFINED_Out_writes_to) +# undef _Out_writes_to_ +#endif +#if !defined(_Out_writes_to_) +# define _Out_writes_to_(s,c) +# define SALIERI_DEFINED_Out_writes_to +#endif + +#if defined(_Out_writes_bytes_to_) && defined(SALIERI_DEFINED_Out_writes_bytes_to) +# undef _Out_writes_bytes_to_ +#endif +#if !defined(_Out_writes_bytes_to_) +# define _Out_writes_bytes_to_(s,c) +# define SALIERI_DEFINED_Out_writes_bytes_to +#endif + +#if defined(_Out_writes_all_) && defined(SALIERI_DEFINED_Out_writes_all) +# undef _Out_writes_all_ +#endif +#if !defined(_Out_writes_all_) +# define _Out_writes_all_(s) +# define SALIERI_DEFINED_Out_writes_all +#endif + +#if defined(_Out_writes_bytes_all_) && defined(SALIERI_DEFINED_Out_writes_bytes_all) +# undef _Out_writes_bytes_all_ +#endif +#if !defined(_Out_writes_bytes_all_) +# define _Out_writes_bytes_all_(s) +# define SALIERI_DEFINED_Out_writes_bytes_all +#endif + +#if defined(_Inout_updates_to_) && defined(SALIERI_DEFINED_Inout_updates_to) +# undef _Inout_updates_to_ +#endif +#if !defined(_Inout_updates_to_) +# define _Inout_updates_to_(s,c) +# define SALIERI_DEFINED_Inout_updates_to +#endif + +#if defined(_Inout_updates_bytes_to_) && defined(SALIERI_DEFINED_Inout_updates_bytes_to) +# undef _Inout_updates_bytes_to_ +#endif +#if !defined(_Inout_updates_bytes_to_) +# define _Inout_updates_bytes_to_(s,c) +# define SALIERI_DEFINED_Inout_updates_bytes_to +#endif + +#if defined(_Inout_updates_all_) && defined(SALIERI_DEFINED_Inout_updates_all) +# undef _Inout_updates_all_ +#endif +#if !defined(_Inout_updates_all_) +# define _Inout_updates_all_(s) +# define SALIERI_DEFINED_Inout_updates_all +#endif + +#if defined(_Inout_updates_bytes_all_) && defined(SALIERI_DEFINED_Inout_updates_bytes_all) +# undef _Inout_updates_bytes_all_ +#endif +#if !defined(_Inout_updates_bytes_all_) +# define _Inout_updates_bytes_all_(s) +# define SALIERI_DEFINED_Inout_updates_bytes_all +#endif + +#if defined(_In_reads_to_ptr_) && defined(SALIERI_DEFINED_In_reads_to_ptr) +# undef _In_reads_to_ptr_ +#endif +#if !defined(_In_reads_to_ptr_) +# define _In_reads_to_ptr_(p) +# define SALIERI_DEFINED_In_reads_to_ptr +#endif + +#if defined(_In_reads_to_ptr_z_) && defined(SALIERI_DEFINED_In_reads_to_ptr_z) +# undef _In_reads_to_ptr_z_ +#endif +#if !defined(_In_reads_to_ptr_z_) +# define _In_reads_to_ptr_z_(p) +# define SALIERI_DEFINED_In_reads_to_ptr_z +#endif + +#if defined(_Out_writes_to_ptr_) && defined(SALIERI_DEFINED_Out_writes_to_ptr) +# undef _Out_writes_to_ptr_ +#endif +#if !defined(_Out_writes_to_ptr_) +# define _Out_writes_to_ptr_(p) +# define SALIERI_DEFINED_Out_writes_to_ptr +#endif + +#if defined(_Out_writes_to_ptr_z_) && defined(SALIERI_DEFINED_Out_writes_to_ptr_z) +# undef _Out_writes_to_ptr_z_ +#endif +#if !defined(_Out_writes_to_ptr_z_) +# define _Out_writes_to_ptr_z_(p) +# define SALIERI_DEFINED_Out_writes_to_ptr_z +#endif + +/* Optional Pointer Parameters */ + +#if defined(_In_opt_) && defined(SALIERI_DEFINED_In_opt) +# undef _In_opt_ +#endif +#if !defined(_In_opt_) +# define _In_opt_ +# define SALIERI_DEFINED_In_opt +#endif + +#if defined(_Out_opt_) && defined(SALIERI_DEFINED_Out_opt) +# undef _Out_opt_ +#endif +#if !defined(_Out_opt_) +# define _Out_opt_ +# define SALIERI_DEFINED_Out_opt +#endif + +#if defined(_Inout_opt_) && defined(SALIERI_DEFINED_Inout_opt) +# undef _Inout_opt_ +#endif +#if !defined(_Inout_opt_) +# define _Inout_opt_ +# define SALIERI_DEFINED_Inout_opt +#endif + +#if defined(_In_opt_z_) && defined(SALIERI_DEFINED_In_opt_z) +# undef _In_opt_z_ +#endif +#if !defined(_In_opt_z_) +# define _In_opt_z_ +# define SALIERI_DEFINED_In_opt_z +#endif + +#if defined(_Inout_opt_z_) && defined(SALIERI_DEFINED_Inout_opt_z) +# undef _Inout_opt_z_ +#endif +#if !defined(_Inout_opt_z_) +# define _Inout_opt_z_ +# define SALIERI_DEFINED_Inout_opt_z +#endif + +#if defined(_Inout_opt_bytecount_) && defined(SALIERI_DEFINED_Inout_opt_bytecount_) +# undef _Inout_opt_bytecount_ +#endif +#if !defined(_Inout_opt_bytecount_) +# define _Inout_opt_bytecount_(s) +# define SALIERI_DEFINED_Inout_opt_bytecount_(s) +#endif + +#if defined(_In_reads_opt_) && defined(SALIERI_DEFINED_In_reads_opt) +# undef _In_reads_opt_ +#endif +#if !defined(_In_reads_opt_) +# define _In_reads_opt_(s) +# define SALIERI_DEFINED_In_reads_opt +#endif + +#if defined(_In_reads_bytes_opt_) && defined(SALIERI_DEFINED_In_reads_bytes_opt) +# undef _In_reads_bytes_opt_ +#endif +#if !defined(_In_reads_bytes_opt_) +# define _In_reads_bytes_opt_(s) +# define SALIERI_DEFINED_In_reads_bytes_opt +#endif + +#if defined(_In_reads_opt_z_) && defined(SALIERI_DEFINED_In_reads_opt_z) +# undef _In_reads_opt_z_ +#endif +#if !defined(_In_reads_opt_z_) +# define _In_reads_opt_z_(s) +# define SALIERI_DEFINED_In_reads_opt_z +#endif + +#if defined(_Out_writes_opt_) && defined(SALIERI_DEFINED_Out_writes_opt) +# undef _Out_writes_opt_ +#endif +#if !defined(_Out_writes_opt_) +# define _Out_writes_opt_(s) +# define SALIERI_DEFINED_Out_writes_opt +#endif + +#if defined(_Out_writes_bytes_) && defined(SALIERI_DEFINED_Out_writes_bytes) +# undef _Out_writes_bytes_ +#endif +#if !defined(_Out_writes_bytes_) +# define _Out_writes_bytes_(s) +# define SALIERI_DEFINED_Out_writes_bytes +#endif + +#if defined(_Out_writes_opt_z_) && defined(SALIERI_DEFINED_Out_writes_opt_z) +# undef _Out_writes_opt_z_ +#endif +#if !defined(_Out_writes_opt_z_) +# define _Out_writes_opt_z_(s) +# define SALIERI_DEFINED_Out_writes_opt_z +#endif + +#if defined(_Inout_updates_opt_) && defined(SALIERI_DEFINED_Inout_updates_opt) +# undef _Inout_updates_opt_ +#endif +#if !defined(_Inout_updates_opt_) +# define _Inout_updates_opt_(s) +# define SALIERI_DEFINED_Inout_updates_opt +#endif + +#if defined(_Inout_updates_bytes_opt_) && defined(SALIERI_DEFINED_Inout_updates_bytes_opt) +# undef _Inout_updates_bytes_opt_ +#endif +#if !defined(_Inout_updates_bytes_opt_) +# define _Inout_updates_bytes_opt_(s) +# define SALIERI_DEFINED_Inout_updates_bytes_opt +#endif + +#if defined(_Inout_updates_opt_z_) && defined(SALIERI_DEFINED_Inout_updates_opt_z) +# undef _Inout_updates_opt_z_ +#endif +#if !defined(_Inout_updates_opt_z_) +# define _Inout_updates_opt_z_(s) +# define SALIERI_DEFINED_Inout_updates_opt_z +#endif + +#if defined(_Out_writes_to_opt_) && defined(SALIERI_DEFINED_Out_writes_to_opt) +# undef _Out_writes_to_opt_ +#endif +#if !defined(_Out_writes_to_opt_) +# define _Out_writes_to_opt_(s,c) +# define SALIERI_DEFINED_Out_writes_to_opt +#endif + +#if defined(_Out_writes_bytes_to_opt_) && defined(SALIERI_DEFINED_Out_writes_bytes_to_opt) +# undef _Out_writes_bytes_to_opt_ +#endif +#if !defined(_Out_writes_bytes_to_opt_) +# define _Out_writes_bytes_to_opt_(s,c) +# define SALIERI_DEFINED_Out_writes_bytes_to_opt +#endif + +#if defined(_Out_writes_all_opt_) && defined(SALIERI_DEFINED_Out_writes_all_opt) +# undef _Out_writes_all_opt_ +#endif +#if !defined(_Out_writes_all_opt_) +# define _Out_writes_all_opt_(s) +# define SALIERI_DEFINED_Out_writes_all_opt +#endif + +#if defined(_Out_writes_bytes_all_opt_) && defined(SALIERI_DEFINED_Out_writes_bytes_all_opt) +# undef _Out_writes_bytes_all_opt_ +#endif +#if !defined(_Out_writes_bytes_all_opt_) +# define _Out_writes_bytes_all_opt_(s) +# define SALIERI_DEFINED_Out_writes_bytes_all_opt +#endif + +#if defined(_In_updates_to_opt_) && defined(SALIERI_DEFINED_In_updates_to_opt) +# undef _In_updates_to_opt_ +#endif +#if !defined(_In_updates_to_opt_) +# define _In_updates_to_opt_(s,c) +# define SALIERI_DEFINED_In_updates_to_opt +#endif + +#if defined(_In_updates_bytes_to_opt_) && defined(SALIERI_DEFINED_In_updates_bytes_to_opt) +# undef _In_updates_bytes_to_opt_ +#endif +#if !defined(_In_updates_bytes_to_opt_) +# define _In_updates_bytes_to_opt_(s,c) +# define SALIERI_DEFINED_In_updates_bytes_to_opt +#endif + +#if defined(_Inout_updates_all_opt_) && defined(SALIERI_DEFINED_Inout_updates_all_opt) +# undef _Inout_updates_all_opt_ +#endif +#if !defined(_Inout_updates_all_opt_) +# define _Inout_updates_all_opt_(s) +# define SALIERI_DEFINED_Inout_updates_all_opt +#endif + +#if defined(_Inout_updates_bytes_all_opt_) && defined(SALIERI_DEFINED_Inout_updates_bytes_all_opt) +# undef _Inout_updates_bytes_all_opt_ +#endif +#if !defined(_Inout_updates_bytes_all_opt_) +# define _Inout_updates_bytes_all_opt_(s) +# define SALIERI_DEFINED_Inout_updates_bytes_all_opt +#endif + +#if defined(_In_reads_to_ptr_opt_) && defined(SALIERI_DEFINED_In_reads_to_ptr_opt) +# undef _In_reads_to_ptr_opt_ +#endif +#if !defined(_In_reads_to_ptr_opt_) +# define _In_reads_to_ptr_opt_(p) +# define SALIERI_DEFINED_In_reads_to_ptr_opt +#endif + +#if defined(_In_reads_to_ptr_opt_z_) && defined(SALIERI_DEFINED_In_reads_to_ptr_opt_z) +# undef _In_reads_to_ptr_opt_z_ +#endif +#if !defined(_In_reads_to_ptr_opt_z_) +# define _In_reads_to_ptr_opt_z_(p) +# define SALIERI_DEFINED_In_reads_to_ptr_opt_z +#endif + +#if defined(_Out_writes_to_ptr_opt_) && defined(SALIERI_DEFINED_Out_writes_to_ptr_opt) +# undef _Out_writes_to_ptr_opt_ +#endif +#if !defined(_Out_writes_to_ptr_opt_) +# define _Out_writes_to_ptr_opt_(p) +# define SALIERI_DEFINED_Out_writes_to_ptr_opt +#endif + +#if defined(_Out_writes_to_ptr_opt_z_) && defined(SALIERI_DEFINED_Out_writes_to_ptr_opt_z) +# undef _Out_writes_to_ptr_opt_z_ +#endif +#if !defined(_Out_writes_to_ptr_opt_z_) +# define _Out_writes_to_ptr_opt_z_(p) +# define SALIERI_DEFINED_Out_writes_to_ptr_opt_z +#endif + +/* Output Pointer Parameters */ + +#if defined(_Outptr_) && defined(SALIERI_DEFINED_Outptr) +# undef _Outptr_ +#endif +#if !defined(_Outptr_) +# define _Outptr_ +# define SALIERI_DEFINED_Outptr +#endif + +#if defined(_Outptr_opt_) && defined(SALIERI_DEFINED_Outptr_opt) +# undef _Outptr_opt_ +#endif +#if !defined(_Outptr_opt_) +# define _Outptr_opt_ +# define SALIERI_DEFINED_Outptr_opt +#endif + +#if defined(_Outptr_result_maybenull_) && defined(SALIERI_DEFINED_Outptr_result_maybenull) +# undef _Outptr_result_maybenull_ +#endif +#if !defined(_Outptr_result_maybenull_) +# define _Outptr_result_maybenull_ +# define SALIERI_DEFINED_Outptr_result_maybenull +#endif + +#if defined(_Outptr_opt_result_maybenull_) && defined(SALIERI_DEFINED_Outptr_opt_result_maybenull) +# undef _Outptr_opt_result_maybenull_ +#endif +#if !defined(_Outptr_opt_result_maybenull_) +# define _Outptr_opt_result_maybenull_ +# define SALIERI_DEFINED_Outptr_opt_result_maybenull +#endif + +#if defined(_Outptr_result_z_) && defined(SALIERI_DEFINED_Outptr_result_z) +# undef _Outptr_result_z_ +#endif +#if !defined(_Outptr_result_z_) +# define _Outptr_result_z_ +# define SALIERI_DEFINED_Outptr_result_z +#endif + +#if defined(_Outptr_opt_result_z_) && defined(SALIERI_DEFINED_Outptr_opt_result_z) +# undef _Outptr_opt_result_z_ +#endif +#if !defined(_Outptr_opt_result_z_) +# define _Outptr_opt_result_z_ +# define SALIERI_DEFINED_Outptr_opt_result_z +#endif + +#if defined(_Outptr_result_maybenull_z_) && defined(SALIERI_DEFINED_Outptr_result_maybenull_z) +# undef _Outptr_result_maybenull_z_ +#endif +#if !defined(_Outptr_result_maybenull_z_) +# define _Outptr_result_maybenull_z_ +# define SALIERI_DEFINED_Outptr_result_maybenull_z +#endif + +#if defined(_Outptr_opt_result_maybenull_z_) && defined(SALIERI_DEFINED_Outptr_opt_result_maybenull_z) +# undef _Outptr_opt_result_maybenull_z_ +#endif +#if !defined(_Outptr_opt_result_maybenull_z_) +# define _Outptr_opt_result_maybenull_z_ +# define SALIERI_DEFINED_Outptr_opt_result_maybenull_z +#endif + +#if defined(_COM_Outptr_) && defined(SALIERI_DEFINED_COM_Outptr) +# undef _COM_Outptr_ +#endif +#if !defined(_COM_Outptr_) +# define _COM_Outptr_ +# define SALIERI_DEFINED_COM_Outptr +#endif + +#if defined(_COM_Outptr_opt_) && defined(SALIERI_DEFINED_COM_Outptr_opt) +# undef _COM_Outptr_opt_ +#endif +#if !defined(_COM_Outptr_opt_) +# define _COM_Outptr_opt_ +# define SALIERI_DEFINED_COM_Outptr_opt +#endif + +#if defined(_COM_Outptr_result_maybenull_) && defined(SALIERI_DEFINED_COM_Outptr_result_maybenull) +# undef _COM_Outptr_result_maybenull_ +#endif +#if !defined(_COM_Outptr_result_maybenull_) +# define _COM_Outptr_result_maybenull_ +# define SALIERI_DEFINED_COM_Outptr_result_maybenull +#endif + +#if defined(_COM_Outptr_opt_result_maybenull_) && defined(SALIERI_DEFINED_COM_Outptr_opt_result_maybenull) +# undef _COM_Outptr_opt_result_maybenull_ +#endif +#if !defined(_COM_Outptr_opt_result_maybenull_) +# define _COM_Outptr_opt_result_maybenull_ +# define SALIERI_DEFINED_COM_Outptr_opt_result_maybenull +#endif + +#if defined(_Outptr_opt_result_maybenull_) && defined(SALIERI_DEFINED_Outptr_opt_result_maybenull) +# undef _Outptr_opt_result_maybenull_ +#endif +#if !defined(_Outptr_opt_result_maybenull_) +# define _Outptr_opt_result_maybenull_ +# define SALIERI_DEFINED_Outptr_opt_result_maybenull +#endif + +#if defined(_Outptr_result_buffer_) && defined(SALIERI_DEFINED_Outptr_result_buffer) +# undef _Outptr_result_buffer_ +#endif +#if !defined(_Outptr_result_buffer_) +# define _Outptr_result_buffer_(s) +# define SALIERI_DEFINED_Outptr_result_buffer +#endif + +#if defined(_Outptr_result_bytebuffer_) && defined(SALIERI_DEFINED_Outptr_result_bytebuffer) +# undef _Outptr_result_bytebuffer_ +#endif +#if !defined(_Outptr_result_bytebuffer_) +# define _Outptr_result_bytebuffer_(s) +# define SALIERI_DEFINED_Outptr_result_bytebuffer +#endif + +#if defined(_Outptr_opt_result_buffer_) && defined(SALIERI_DEFINED_Outptr_opt_result_buffer) +# undef _Outptr_opt_result_buffer_ +#endif +#if !defined(_Outptr_opt_result_buffer_) +# define _Outptr_opt_result_buffer_(s) +# define SALIERI_DEFINED_Outptr_opt_result_buffer +#endif + +#if defined(_Outptr_opt_result_bytebuffer_) && defined(SALIERI_DEFINED_Outptr_opt_result_bytebuffer) +# undef _Outptr_opt_result_bytebuffer_ +#endif +#if !defined(_Outptr_opt_result_bytebuffer_) +# define _Outptr_opt_result_bytebuffer_(s) +# define SALIERI_DEFINED_Outptr_opt_result_bytebuffer +#endif + +#if defined(_Outptr_result_buffer_to_) && defined(SALIERI_DEFINED_Outptr_result_buffer_to) +# undef _Outptr_result_buffer_to_ +#endif +#if !defined(_Outptr_result_buffer_to_) +# define _Outptr_result_buffer_to_(s,c) +# define SALIERI_DEFINED_Outptr_result_buffer_to +#endif + +#if defined(_Outptr_result_bytebuffer_to_) && defined(SALIERI_DEFINED_Outptr_result_bytebuffer_to) +# undef _Outptr_result_bytebuffer_to_ +#endif +#if !defined(_Outptr_result_bytebuffer_to_) +# define _Outptr_result_bytebuffer_to_(s,c) +# define SALIERI_DEFINED_Outptr_result_bytebuffer_to +#endif + +#if defined(_Outptr_opt_result_buffer_to_) && defined(SALIERI_DEFINED_Outptr_opt_result_buffer_to) +# undef _Outptr_opt_result_buffer_to_ +#endif +#if !defined(_Outptr_opt_result_buffer_to_) +# define _Outptr_opt_result_buffer_to_(s,c) +# define SALIERI_DEFINED_Outptr_opt_result_buffer_to +#endif + +#if defined(_Outptr_opt_result_bytebuffer_to_) && defined(SALIERI_DEFINED_Outptr_opt_result_bytebuffer_to) +# undef _Outptr_opt_result_bytebuffer_to_ +#endif +#if !defined(_Outptr_opt_result_bytebuffer_to_) +# define _Outptr_opt_result_bytebuffer_to_(s,c) +# define SALIERI_DEFINED_Outptr_opt_result_bytebuffer_to +#endif + +#if defined(_Result_nullonfailure_) && defined(SALIERI_DEFINED_Result_nullonfailure) +# undef _Result_nullonfailure_ +#endif +#if !defined(_Result_nullonfailure_) +# define _Result_nullonfailure_ +# define SALIERI_DEFINED_Result_nullonfailure +#endif + +#if defined(_Result_zeroonfailure_) && defined(SALIERI_DEFINED_Result_zeroonfailure) +# undef _Result_zeroonfailure_ +#endif +#if !defined(_Result_zeroonfailure_) +# define _Result_zeroonfailure_ +# define SALIERI_DEFINED_Result_zeroonfailure +#endif + +#if defined(_Outptr_result_nullonfailure_) && defined(SALIERI_DEFINED_Outptr_result_nullonfailure) +# undef _Outptr_result_nullonfailure_ +#endif +#if !defined(_Outptr_result_nullonfailure_) +# define _Outptr_result_nullonfailure_ +# define SALIERI_DEFINED_Outptr_result_nullonfailure +#endif + +#if defined(_Outptr_opt_result_nullonfailure_) && defined(SALIERI_DEFINED_Outptr_opt_result_nullonfailure) +# undef _Outptr_opt_result_nullonfailure_ +#endif +#if !defined(_Outptr_opt_result_nullonfailure_) +# define _Outptr_opt_result_nullonfailure_ +# define SALIERI_DEFINED_Outptr_opt_result_nullonfailure +#endif + +#if defined(_Outref_result_nullonfailure_) && defined(SALIERI_DEFINED_Outref_result_nullonfailure) +# undef _Outref_result_nullonfailure_ +#endif +#if !defined(_Outref_result_nullonfailure_) +# define _Outref_result_nullonfailure_ +# define SALIERI_DEFINED_Outref_result_nullonfailure +#endif + +/* Output Reference Parameters */ + +#if defined(_Outref_) && defined(SALIERI_DEFINED_Outref) +# undef _Outref_ +#endif +#if !defined(_Outref_) +# define _Outref_ +# define SALIERI_DEFINED_Outref +#endif + +#if defined(_Outref_result_maybenull_) && defined(SALIERI_DEFINED_Outref_result_maybenull) +# undef _Outref_result_maybenull_ +#endif +#if !defined(_Outref_result_maybenull_) +# define _Outref_result_maybenull_ +# define SALIERI_DEFINED_Outref_result_maybenull +#endif + +#if defined(_Outref_result_buffer_) && defined(SALIERI_DEFINED_Outref_result_buffer) +# undef _Outref_result_buffer_ +#endif +#if !defined(_Outref_result_buffer_) +# define _Outref_result_buffer_(s) +# define SALIERI_DEFINED_Outref_result_buffer +#endif + +#if defined(_Outref_result_bytebuffer_) && defined(SALIERI_DEFINED_Outref_result_bytebuffer) +# undef _Outref_result_bytebuffer_ +#endif +#if !defined(_Outref_result_bytebuffer_) +# define _Outref_result_bytebuffer_(s) +# define SALIERI_DEFINED_Outref_result_bytebuffer +#endif + +#if defined(_Outref_result_buffer_to_) && defined(SALIERI_DEFINED_Outref_result_buffer_to) +# undef _Outref_result_buffer_to_ +#endif +#if !defined(_Outref_result_buffer_to_) +# define _Outref_result_buffer_to_(s,c) +# define SALIERI_DEFINED_Outref_result_buffer_to +#endif + +#if defined(_Outref_result_bytebuffer_to_) && defined(SALIERI_DEFINED_Outref_result_bytebuffer_to) +# undef _Outref_result_bytebuffer_to_ +#endif +#if !defined(_Outref_result_bytebuffer_to_) +# define _Outref_result_bytebuffer_to_(s,c) +# define SALIERI_DEFINED_Outref_result_bytebuffer_to +#endif + +#if defined(_Outref_result_buffer_all_) && defined(SALIERI_DEFINED_Outref_result_buffer_all) +# undef _Outref_result_buffer_all_ +#endif +#if !defined(_Outref_result_buffer_all_) +# define _Outref_result_buffer_all_(s) +# define SALIERI_DEFINED_Outref_result_buffer_all +#endif + +#if defined(_Outref_result_bytebuffer_all_) && defined(SALIERI_DEFINED_Outref_result_bytebuffer_all) +# undef _Outref_result_bytebuffer_all_ +#endif +#if !defined(_Outref_result_bytebuffer_all_) +# define _Outref_result_bytebuffer_all_(s) +# define SALIERI_DEFINED_Outref_result_bytebuffer_all +#endif + +#if defined(_Outref_result_buffer_maybenull_) && defined(SALIERI_DEFINED_Outref_result_buffer_maybenull) +# undef _Outref_result_buffer_maybenull_ +#endif +#if !defined(_Outref_result_buffer_maybenull_) +# define _Outref_result_buffer_maybenull_(s) +# define SALIERI_DEFINED_Outref_result_buffer_maybenull +#endif + +#if defined(_Outref_result_bytebuffer_maybenull_) && defined(SALIERI_DEFINED_Outref_result_bytebuffer_maybenull) +# undef _Outref_result_bytebuffer_maybenull_ +#endif +#if !defined(_Outref_result_bytebuffer_maybenull_) +# define _Outref_result_bytebuffer_maybenull_(s) +# define SALIERI_DEFINED_Outref_result_bytebuffer_maybenull +#endif + +#if defined(_Outref_result_buffer_to_maybenull_) && defined(SALIERI_DEFINED_Outref_result_buffer_to_maybenull) +# undef _Outref_result_buffer_to_maybenull_ +#endif +#if !defined(_Outref_result_buffer_to_maybenull_) +# define _Outref_result_buffer_to_maybenull_(s,c) +# define SALIERI_DEFINED_Outref_result_buffer_to_maybenull +#endif + +#if defined(_Outref_result_bytebuffer_to_maybenull_) && defined(SALIERI_DEFINED_Outref_result_bytebuffer_to_maybenull) +# undef _Outref_result_bytebuffer_to_maybenull_ +#endif +#if !defined(_Outref_result_bytebuffer_to_maybenull_) +# define _Outref_result_bytebuffer_to_maybenull_(s,c) +# define SALIERI_DEFINED_Outref_result_bytebuffer_to_maybenull +#endif + +#if defined(_Outref_result_buffer_all_maybenull_) && defined(SALIERI_DEFINED_Outref_result_buffer_all_maybenull) +# undef _Outref_result_buffer_all_maybenull_ +#endif +#if !defined(_Outref_result_buffer_all_maybenull_) +# define _Outref_result_buffer_all_maybenull_(s) +# define SALIERI_DEFINED_Outref_result_buffer_all_maybenull +#endif + +#if defined(_Outref_result_bytebuffer_all_maybenull_) && defined(SALIERI_DEFINED_Outref_result_bytebuffer_all_maybenull) +# undef _Outref_result_bytebuffer_all_maybenull_ +#endif +#if !defined(_Outref_result_bytebuffer_all_maybenull_) +# define _Outref_result_bytebuffer_all_maybenull_(s) +# define SALIERI_DEFINED_Outref_result_bytebuffer_all_maybenull +#endif + +/* Return Values */ + +#if defined(_Ret_z_) && defined(SALIERI_DEFINED_Ret_z) +# undef _Ret_z_ +#endif +#if !defined(_Ret_z_) +# define _Ret_z_ +# define SALIERI_DEFINED_Ret_z +#endif + +#if defined(_Ret_writes_) && defined(SALIERI_DEFINED_Ret_writes) +# undef _Ret_writes_ +#endif +#if !defined(_Ret_writes_) +# define _Ret_writes_(s) +# define SALIERI_DEFINED_Ret_writes +#endif + +#if defined(_Ret_writes_bytes_) && defined(SALIERI_DEFINED_Ret_writes_bytes) +# undef _Ret_writes_bytes_ +#endif +#if !defined(_Ret_writes_bytes_) +# define _Ret_writes_bytes_(s) +# define SALIERI_DEFINED_Ret_writes_bytes +#endif + +#if defined(_Ret_writes_z_) && defined(SALIERI_DEFINED_Ret_writes_z) +# undef _Ret_writes_z_ +#endif +#if !defined(_Ret_writes_z_) +# define _Ret_writes_z_(s) +# define SALIERI_DEFINED_Ret_writes_z +#endif + +#if defined(_Ret_writes_to_) && defined(SALIERI_DEFINED_Ret_writes_to) +# undef _Ret_writes_to_ +#endif +#if !defined(_Ret_writes_to_) +# define _Ret_writes_to_(s,c) +# define SALIERI_DEFINED_Ret_writes_to +#endif + +#if defined(_Ret_writes_maybenull_) && defined(SALIERI_DEFINED_Ret_writes_maybenull) +# undef _Ret_writes_maybenull_ +#endif +#if !defined(_Ret_writes_maybenull_) +# define _Ret_writes_maybenull_(s) +# define SALIERI_DEFINED_Ret_writes_maybenull +#endif + +#if defined(_Ret_writes_to_maybenull_) && defined(SALIERI_DEFINED_Ret_writes_to_maybenull) +# undef _Ret_writes_to_maybenull_ +#endif +#if !defined(_Ret_writes_to_maybenull_) +# define _Ret_writes_to_maybenull_(s) +# define SALIERI_DEFINED_Ret_writes_to_maybenull +#endif + +#if defined(_Ret_writes_maybenull_z_) && defined(SALIERI_DEFINED_Ret_writes_maybenull_z) +# undef _Ret_writes_maybenull_z_ +#endif +#if !defined(_Ret_writes_maybenull_z_) +# define _Ret_writes_maybenull_z_(s) +# define SALIERI_DEFINED_Ret_writes_maybenull_z +#endif + +#if defined(_Ret_maybenull_) && defined(SALIERI_DEFINED_Ret_maybenull) +# undef _Ret_maybenull_ +#endif +#if !defined(_Ret_maybenull_) +# define _Ret_maybenull_ +# define SALIERI_DEFINED_Ret_maybenull +#endif + +#if defined(_Ret_maybenull_z_) && defined(SALIERI_DEFINED_Ret_maybenull_z) +# undef _Ret_maybenull_z_ +#endif +#if !defined(_Ret_maybenull_z_) +# define _Ret_maybenull_z_ +# define SALIERI_DEFINED_Ret_maybenull_z +#endif + +#if defined(_Ret_null_) && defined(SALIERI_DEFINED_Ret_null) +# undef _Ret_null_ +#endif +#if !defined(_Ret_null_) +# define _Ret_null_ +# define SALIERI_DEFINED_Ret_null +#endif + +#if defined(_Ret_notnull_) && defined(SALIERI_DEFINED_Ret_notnull) +# undef _Ret_notnull_ +#endif +#if !defined(_Ret_notnull_) +# define _Ret_notnull_ +# define SALIERI_DEFINED_Ret_notnull +#endif + +#if defined(_Ret_writes_bytes_to_) && defined(SALIERI_DEFINED_Ret_writes_bytes_to) +# undef _Ret_writes_bytes_to_ +#endif +#if !defined(_Ret_writes_bytes_to_) +# define _Ret_writes_bytes_to_ +# define SALIERI_DEFINED_Ret_writes_bytes_to +#endif + +#if defined(_Ret_writes_bytes_to_) && defined(SALIERI_DEFINED_Ret_writes_bytes_to) +# undef _Ret_writes_bytes_to_ +#endif +#if !defined(_Ret_writes_bytes_to_) +# define _Ret_writes_bytes_to_ +# define SALIERI_DEFINED_Ret_writes_bytes_to +#endif + +#if defined(_Ret_writes_bytes_maybenull_) && defined(SALIERI_DEFINED_Ret_writes_bytes_maybenull) +# undef _Ret_writes_bytes_maybenull_ +#endif +#if !defined(_Ret_writes_bytes_maybenull_) +# define _Ret_writes_bytes_maybenull_ +# define SALIERI_DEFINED_Ret_writes_bytes_maybenull +#endif + +#if defined(_Ret_writes_bytes_to_maybenull_) && defined(SALIERI_DEFINED_Ret_writes_bytes_to_maybenull) +# undef _Ret_writes_bytes_to_maybenull_ +#endif +#if !defined(_Ret_writes_bytes_to_maybenull_) +# define _Ret_writes_bytes_to_maybenull_ +# define SALIERI_DEFINED_Ret_writes_bytes_to_maybenull +#endif + +/* Other Common Annotations */ + +#if defined(_In_range_) && defined(SALIERI_DEFINED_In_range) +# undef _In_range_ +#endif +#if !defined(_In_range_) +# define _In_range_(low, hi) +# define SALIERI_DEFINED_In_range +#endif + +#if defined(_Out_range_) && defined(SALIERI_DEFINED_Out_range) +# undef _Out_range_ +#endif +#if !defined(_Out_range_) +# define _Out_range_(low, hi) +# define SALIERI_DEFINED_Out_range +#endif + +#if defined(_Ret_range_) && defined(SALIERI_DEFINED_Ret_range) +# undef _Ret_range_ +#endif +#if !defined(_Ret_range_) +# define _Ret_range_(low, hi) +# define SALIERI_DEFINED_Ret_range +#endif + +#if defined(_Deref_in_range_) && defined(SALIERI_DEFINED_Deref_in_range) +# undef _Deref_in_range_ +#endif +#if !defined(_Deref_in_range_) +# define _Deref_in_range_(low, hi) +# define SALIERI_DEFINED_Deref_in_range +#endif + +#if defined(_Deref_out_range_) && defined(SALIERI_DEFINED_Deref_out_range) +# undef _Deref_out_range_ +#endif +#if !defined(_Deref_out_range_) +# define _Deref_out_range_(low, hi) +# define SALIERI_DEFINED_Deref_out_range +#endif + +#if defined(_Deref_inout_range_) && defined(SALIERI_DEFINED_Deref_inout_range) +# undef _Deref_inout_range_ +#endif +#if !defined(_Deref_inout_range_) +# define _Deref_inout_range_(low, hi) +# define SALIERI_DEFINED_Deref_inout_range +#endif + +#if defined(_Field_range_) && defined(SALIERI_DEFINED_Field_range) +# undef _Field_range_ +#endif +#if !defined(_Field_range_) +# define _Field_range_(low, hi) +# define SALIERI_DEFINED_Field_range +#endif + +#if defined(_Pre_equal_to_) && defined(SALIERI_DEFINED_Pre_equal_to) +# undef _Pre_equal_to_ +#endif +#if !defined(_Pre_equal_to_) +# define _Pre_equal_to_(expr) +# define SALIERI_DEFINED_Pre_equal_to +#endif + +#if defined(_Post_equal_to_) && defined(SALIERI_DEFINED_Post_equal_to) +# undef _Post_equal_to_ +#endif +#if !defined(_Post_equal_to_) +# define _Post_equal_to_(expr) +# define SALIERI_DEFINED_Post_equal_to +#endif + +#if defined(_Struct_size_bytes_) && defined(SALIERI_DEFINED_Struct_size_bytes) +# undef _Struct_size_bytes_ +#endif +#if !defined(_Struct_size_bytes_) +# define _Struct_size_bytes_(size) +# define SALIERI_DEFINED_Struct_size_bytes +#endif + +/* Annotating Function Behavior + * + * https://msdn.microsoft.com/en-us/library/jj159529.aspx + *****/ + +#if defined(_Called_from_function_class_) && defined(SALIERI_DEFINED_Called_from_function_class) +# undef _Called_from_function_class_ +#endif +#if !defined(_Called_from_function_class_) +# define _Called_from_function_class_(name) +# define SALIERI_DEFINED_Called_from_function_class +#endif + +#if defined(_Check_return_) && defined(SALIERI_DEFINED_Check_return) +# undef _Check_return_ +#endif +#if !defined(_Check_return_) +# define _Check_return_ +# define SALIERI_DEFINED_Check_return +#endif + +#if defined(_Function_class_) && defined(SALIERI_DEFINED_Function_class) +# undef _Function_class_ +#endif +#if !defined(_Function_class_) +# define _Function_class_(name) +# define SALIERI_DEFINED_Function_class +#endif + +#if defined(_Raises_SEH_exception_) && defined(SALIERI_DEFINED_Raises_SEH_exception) +# undef _Raises_SEH_exception_ +#endif +#if !defined(_Raises_SEH_exception_) +# define _Raises_SEH_exception_ +# define SALIERI_DEFINED_Raises_SEH_exception +#endif + +#if defined(_Must_inspect_result_) && defined(SALIERI_DEFINED_Must_inspect_result) +# undef _Must_inspect_result_ +#endif +#if !defined(_Must_inspect_result_) +# define _Must_inspect_result_ +# define SALIERI_DEFINED_Must_inspect_result +#endif + +#if defined(_Use_decl_annotations_) && defined(SALIERI_DEFINED_Use_decl_annotations) +# undef _Use_decl_annotations_ +#endif +#if !defined(_Use_decl_annotations_) +# define _Use_decl_annotations_ +# define SALIERI_DEFINED_Use_decl_annotations +#endif + +#if defined(_Always_) && defined(SALIERI_DEFINED_Always) +# undef _Always_ +#endif +#if !defined(_Always_) +# define _Always_(anno_list) +# define SALIERI_DEFINED_Always +#endif + +#if defined(_On_failure_) && defined(SALIERI_DEFINED_On_failure) +# undef _On_failure_ +#endif +#if !defined(_On_failure_) +# define _On_failure_(anno_list) +# define SALIERI_DEFINED_On_failure +#endif + +#if defined(_Return_type_success_) && defined(SALIERI_DEFINED_Return_type_success) +# undef _Return_type_success_ +#endif +#if !defined(_Return_type_success_) +# define _Return_type_success_(expr) +# define SALIERI_DEFINED_Return_type_success +#endif + +#if defined(_Success_) && defined(SALIERI_DEFINED_Success) +# undef _Success_ +#endif +#if !defined(_Success_) +# define _Success_(expr) +# define SALIERI_DEFINED_Success +#endif + +/* Annotating Structs and Classes + * + * https://msdn.microsoft.com/en-us/library/jj159528.aspx + *****/ + +#if defined(_Field_range_) && defined(SALIERI_DEFINED_Field_range) +# undef _Field_range_ +#endif +#if !defined(_Field_range_) +# define _Field_range_(low, high) +# define SALIERI_DEFINED_Field_range +#endif + +#if defined(_Field_size_) && defined(SALIERI_DEFINED_Field_size) +# undef _Field_size_ +#endif +#if !defined(_Field_size_) +# define _Field_size_(size) +# define SALIERI_DEFINED_Field_size +#endif + +#if defined(_Field_size_part_) && defined(SALIERI_DEFINED_Field_size_part) +# undef _Field_size_part_ +#endif +#if !defined(_Field_size_part_) +# define _Field_size_part_(size) +# define SALIERI_DEFINED_Field_size_part +#endif + +#if defined(_Field_size_opt_) && defined(SALIERI_DEFINED_Field_size_opt) +# undef _Field_size_opt_ +#endif +#if !defined(_Field_size_opt_) +# define _Field_size_opt_(size) +# define SALIERI_DEFINED_Field_size_opt +#endif + +#if defined(_Field_size_bytes_) && defined(SALIERI_DEFINED_Field_size_bytes) +# undef _Field_size_bytes_ +#endif +#if !defined(_Field_size_bytes_) +# define _Field_size_bytes_(size) +# define SALIERI_DEFINED_Field_size_bytes +#endif + +#if defined(_Field_size_bytes_opt_) && defined(SALIERI_DEFINED_Field_size_bytes_opt) +# undef _Field_size_bytes_opt_ +#endif +#if !defined(_Field_size_bytes_opt_) +# define _Field_size_bytes_opt_(size) +# define SALIERI_DEFINED_Field_size_bytes_opt +#endif + +#if defined(_Field_size_part_) && defined(SALIERI_DEFINED_Field_size_part) +# undef _Field_size_part_ +#endif +#if !defined(_Field_size_part_) +# define _Field_size_part_(size, count) +# define SALIERI_DEFINED_Field_size_part +#endif + +#if defined(_Field_size_part_opt_) && defined(SALIERI_DEFINED_Field_size_part_opt) +# undef _Field_size_part_opt_ +#endif +#if !defined(_Field_size_part_opt_) +# define _Field_size_part_opt_(size, count) +# define SALIERI_DEFINED_Field_size_part_opt +#endif + +#if defined(_Field_size_bytes_part_) && defined(SALIERI_DEFINED_Field_size_bytes_part) +# undef _Field_size_bytes_part_ +#endif +#if !defined(_Field_size_bytes_part_) +# define _Field_size_bytes_part_(size, count) +# define SALIERI_DEFINED_Field_size_bytes_part +#endif + +#if defined(_Field_size_bytes_part_opt_) && defined(SALIERI_DEFINED_Field_size_bytes_part_opt) +# undef _Field_size_bytes_part_opt_ +#endif +#if !defined(_Field_size_bytes_part_opt_) +# define _Field_size_bytes_part_opt_(size, count) +# define SALIERI_DEFINED_Field_size_bytes_part_opt +#endif + +#if defined(_Field_size_full_) && defined(SALIERI_DEFINED_Field_size_full) +# undef _Field_size_full_ +#endif +#if !defined(_Field_size_full_) +# define _Field_size_full_(size) +# define SALIERI_DEFINED_Field_size_full +#endif + +#if defined(_Field_size_full_opt_) && defined(SALIERI_DEFINED_Field_size_full_opt) +# undef _Field_size_full_opt_ +#endif +#if !defined(_Field_size_full_opt_) +# define _Field_size_full_opt_(size) +# define SALIERI_DEFINED_Field_size_full_opt +#endif + +#if defined(_Field_size_bytes_full_) && defined(SALIERI_DEFINED_Field_size_bytes_full) +# undef _Field_size_bytes_full_ +#endif +#if !defined(_Field_size_bytes_full_) +# define _Field_size_bytes_full_(size) +# define SALIERI_DEFINED_Field_size_bytes_full +#endif + +#if defined(_Field_size_bytes_full_opt_) && defined(SALIERI_DEFINED_Field_size_bytes_full_opt) +# undef _Field_size_bytes_full_opt_ +#endif +#if !defined(_Field_size_bytes_full_opt_) +# define _Field_size_bytes_full_opt_(size) +# define SALIERI_DEFINED_Field_size_bytes_full_opt +#endif + +#if defined(_Struct_size_bytes_) && defined(SALIERI_DEFINED_Struct_size_bytes) +# undef _Struct_size_bytes_ +#endif +#if !defined(_Struct_size_bytes_) +# define _Struct_size_bytes_(size) +# define SALIERI_DEFINED_Struct_size_bytes +#endif + +/* Annotating Locking Behavior + * + * https://msdn.microsoft.com/en-us/library/hh916381.aspx + *****/ + +#if defined(_Acquires_exclusive_lock_) && defined(SALIERI_DEFINED_Acquires_exclusive_lock) +# undef _Acquires_exclusive_lock_ +#endif +#if !defined(_Acquires_exclusive_lock_) +# define _Acquires_exclusive_lock_(expr) +# define SALIERI_DEFINED_Acquires_exclusive_lock +#endif + +#if defined(_Acquires_lock_) && defined(SALIERI_DEFINED_Acquires_lock) +# undef _Acquires_lock_ +#endif +#if !defined(_Acquires_lock_) +# define _Acquires_lock_(expr) +# define SALIERI_DEFINED_Acquires_lock +#endif + +#if defined(_Acquires_nonreentrant_lock_) && defined(SALIERI_DEFINED_Acquires_nonreentrant_lock) +# undef _Acquires_nonreentrant_lock_ +#endif +#if !defined(_Acquires_nonreentrant_lock_) +# define _Acquires_nonreentrant_lock_(expr) +# define SALIERI_DEFINED_Acquires_nonreentrant_lock +#endif + +#if defined(_Acquires_shared_lock_) && defined(SALIERI_DEFINED_Acquires_shared_lock) +# undef _Acquires_shared_lock_ +#endif +#if !defined(_Acquires_shared_lock_) +# define _Acquires_shared_lock_(expr) +# define SALIERI_DEFINED_Acquires_shared_lock +#endif + +#if defined(_Create_lock_level_) && defined(SALIERI_DEFINED_Create_lock_level) +# undef _Create_lock_level_ +#endif +#if !defined(_Create_lock_level_) +# define _Create_lock_level_(name) +# define SALIERI_DEFINED_Create_lock_level +#endif + +#if defined(_Has_lock_kind_) && defined(SALIERI_DEFINED_Has_lock_kind) +# undef _Has_lock_kind_ +#endif +#if !defined(_Has_lock_kind_) +# define _Has_lock_kind_(kind) +# define SALIERI_DEFINED_Has_lock_kind +#endif + +#if defined(_Has_lock_level_) && defined(SALIERI_DEFINED_Has_lock_level) +# undef _Has_lock_level_ +#endif +#if !defined(_Has_lock_level_) +# define _Has_lock_level_(name) +# define SALIERI_DEFINED_Has_lock_level +#endif + +#if defined(_Lock_level_order_) && defined(SALIERI_DEFINED_Lock_level_order) +# undef _Lock_level_order_ +#endif +#if !defined(_Lock_level_order_) +# define _Lock_level_order_(name1, name2) +# define SALIERI_DEFINED_Lock_level_order +#endif + +#if defined(_Post_same_lock_) && defined(SALIERI_DEFINED_Post_same_lock) +# undef _Post_same_lock_ +#endif +#if !defined(_Post_same_lock_) +# define _Post_same_lock_(expr1, expr2) +# define SALIERI_DEFINED_Post_same_lock +#endif + +#if defined(_Releases_exclusive_lock_) && defined(SALIERI_DEFINED_Releases_exclusive_lock) +# undef _Releases_exclusive_lock_ +#endif +#if !defined(_Releases_exclusive_lock_) +# define _Releases_exclusive_lock_(expr) +# define SALIERI_DEFINED_Releases_exclusive_lock +#endif + +#if defined(_Releases_lock_) && defined(SALIERI_DEFINED_Releases_lock) +# undef _Releases_lock_ +#endif +#if !defined(_Releases_lock_) +# define _Releases_lock_(expr) +# define SALIERI_DEFINED_Releases_lock +#endif + +#if defined(_Releases_nonreentrant_lock_) && defined(SALIERI_DEFINED_Releases_nonreentrant_lock) +# undef _Releases_nonreentrant_lock_ +#endif +#if !defined(_Releases_nonreentrant_lock_) +# define _Releases_nonreentrant_lock_(expr) +# define SALIERI_DEFINED_Releases_nonreentrant_lock +#endif + +#if defined(_Releases_shared_lock_) && defined(SALIERI_DEFINED_Releases_shared_lock) +# undef _Releases_shared_lock_ +#endif +#if !defined(_Releases_shared_lock_) +# define _Releases_shared_lock_(expr) +# define SALIERI_DEFINED_Releases_shared_lock +#endif + +#if defined(_Requires_lock_held_) && defined(SALIERI_DEFINED_Requires_lock_held) +# undef _Requires_lock_held_ +#endif +#if !defined(_Requires_lock_held_) +# define _Requires_lock_held_(expr) +# define SALIERI_DEFINED_Requires_lock_held +#endif + +#if defined(_Requires_lock_not_held_) && defined(SALIERI_DEFINED_Requires_lock_not_held) +# undef _Requires_lock_not_held_ +#endif +#if !defined(_Requires_lock_not_held_) +# define _Requires_lock_not_held_(expr) +# define SALIERI_DEFINED_Requires_lock_not_held +#endif + +#if defined(_Requires_no_locks_held_) && defined(SALIERI_DEFINED_Requires_no_locks_held) +# undef _Requires_no_locks_held_ +#endif +#if !defined(_Requires_no_locks_held_) +# define _Requires_no_locks_held_ +# define SALIERI_DEFINED_Requires_no_locks_held +#endif + +#if defined(_Requires_shared_lock_held_) && defined(SALIERI_DEFINED_Requires_shared_lock_held) +# undef _Requires_shared_lock_held_ +#endif +#if !defined(_Requires_shared_lock_held_) +# define _Requires_shared_lock_held_(expr) +# define SALIERI_DEFINED_Requires_shared_lock_held +#endif + +#if defined(_Requires_exclusive_lock_held_) && defined(SALIERI_DEFINED_Requires_exclusive_lock_held) +# undef _Requires_exclusive_lock_held_ +#endif +#if !defined(_Requires_exclusive_lock_held_) +# define _Requires_exclusive_lock_held_(expr) +# define SALIERI_DEFINED_Requires_exclusive_lock_held +#endif + +/* Shared Data Access Annotations */ + +#if defined(_Guarded_by_) && defined(SALIERI_DEFINED_Guarded_by) +# undef _Guarded_by_ +#endif +#if !defined(_Guarded_by_) +# define _Guarded_by_(expr) +# define SALIERI_DEFINED_Guarded_by +#endif + +#if defined(_Interlocked_) && defined(SALIERI_DEFINED_Interlocked) +# undef _Interlocked_ +#endif +#if !defined(_Interlocked_) +# define _Interlocked_ +# define SALIERI_DEFINED_Interlocked +#endif + +#if defined(_Interlocked_operand_) && defined(SALIERI_DEFINED_Interlocked_operand) +# undef _Interlocked_operand_ +#endif +#if !defined(_Interlocked_operand_) +# define _Interlocked_operand_ +# define SALIERI_DEFINED_Interlocked_operand +#endif + +#if defined(_Write_guarded_by_) && defined(SALIERI_DEFINED_Write_guarded_by) +# undef _Write_guarded_by_ +#endif +#if !defined(_Write_guarded_by_) +# define _Write_guarded_by_(expr) +# define SALIERI_DEFINED_Write_guarded_by +#endif + +/* Specifying When and Where an Annotation Applies + * + * https://msdn.microsoft.com/en-us/library/jj159526.aspx + *****/ + +#if defined(_At_) && defined(SALIERI_DEFINED_At) +# undef _At_ +#endif +#if !defined(_At_) +# define _At_(expr, anno_list) +# define SALIERI_DEFINED_At +#endif + +#if defined(_At_buffer_) && defined(SALIERI_DEFINED_At_buffer) +# undef _At_buffer_ +#endif +#if !defined(_At_buffer_) +# define _At_buffer_(expr, iter, elem_count, anno_list) +# define SALIERI_DEFINED_At_buffer +#endif + +#if defined(_Group_) && defined(SALIERI_DEFINED_Group) +# undef _Group_ +#endif +#if !defined(_Group_) +# define _Group_(anno_list) +# define SALIERI_DEFINED_Group +#endif + +#if defined(_When_) && defined(SALIERI_DEFINED_When) +# undef _When_ +#endif +#if !defined(_When_) +# define _When_(expr, anno_list) +# define SALIERI_DEFINED_When +#endif + +/* Intrinsic Functions + * + * https://msdn.microsoft.com/en-us/library/jj159527.aspx + *****/ + +/* General Purpose */ + +#if defined(_Curr_) && defined(SALIERI_DEFINED_Curr) +# undef _Curr_ +#endif +#if !defined(_Curr_) +# define _Curr_ +# define SALIERI_DEFINED_Curr +#endif + +#if defined(_Inexpressible_) && defined(SALIERI_DEFINED_Inexpressible) +# undef _Inexpressible_ +#endif +#if !defined(_Inexpressible_) +# define _Inexpressible_(expr) +# define SALIERI_DEFINED_Inexpressible +#endif + +#if defined(_Nullterm_length_) && defined(SALIERI_DEFINED_Nullterm_length) +# undef _Nullterm_length_ +#endif +#if !defined(_Nullterm_length_) +# define _Nullterm_length_(param) +# define SALIERI_DEFINED_Nullterm_length +#endif + +#if defined(_Old_) && defined(SALIERI_DEFINED_Old) +# undef _Old_ +#endif +#if !defined(_Old_) +# define _Old_(expr) +# define SALIERI_DEFINED_Old +#endif + +#if defined(_Param_) && defined(SALIERI_DEFINED_Param) +# undef _Param_ +#endif +#if !defined(_Param_) +# define _Param_(n) +# define SALIERI_DEFINED_Param +#endif + +/* String Specific */ + +#if defined(_String_length_) && defined(SALIERI_DEFINED_String_length) +# undef _String_length_ +#endif +#if !defined(_String_length_) +# define _String_length_(param) +# define SALIERI_DEFINED_String_length +#endif + +#if defined(SALIERI_VERSION) +# undef SALIERI_VERSION +#endif + +#define SALIERI_VERSION 1 + +#endif /* !defined(SALIERI_VERSION) || (SALIERI_VERSION < X) */ diff --git a/3rdparty/bx/makefile b/3rdparty/bx/makefile index e377204ee35..65e55a7715e 100644 --- a/3rdparty/bx/makefile +++ b/3rdparty/bx/makefile @@ -1,13 +1,12 @@ # -# Copyright 2011-2017 Branimir Karadzic. All rights reserved. -# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause +# Copyright 2011-2018 Branimir Karadzic. All rights reserved. +# License: https://github.com/bkaradzic/bx#license-bsd-2-clause # GENIE=../bx/tools/bin/$(OS)/genie all: - $(GENIE) vs2012 - $(GENIE) vs2013 + $(GENIE) vs2017 $(GENIE) --gcc=android-arm gmake $(GENIE) --gcc=android-mips gmake $(GENIE) --gcc=android-x86 gmake @@ -16,7 +15,8 @@ all: $(GENIE) --gcc=osx gmake $(GENIE) --gcc=ios-arm gmake $(GENIE) --gcc=ios-simulator gmake - $(GENIE) xcode4 + $(GENIE) --gcc=ios-simulator64 gmake + $(GENIE) xcode8 .build/projects/gmake-android-arm: $(GENIE) --gcc=android-arm gmake @@ -44,15 +44,11 @@ android-x86: android-x86-debug android-x86-release .build/projects/gmake-linux: $(GENIE) --gcc=linux-gcc gmake -linux-debug32: .build/projects/gmake-linux - make -R -C .build/projects/gmake-linux config=debug32 -linux-release32: .build/projects/gmake-linux - make -R -C .build/projects/gmake-linux config=release32 linux-debug64: .build/projects/gmake-linux make -R -C .build/projects/gmake-linux config=debug64 linux-release64: .build/projects/gmake-linux make -R -C .build/projects/gmake-linux config=release64 -linux: linux-debug32 linux-release32 linux-debug64 linux-release64 +linux: linux-debug64 linux-release64 .build/projects/gmake-mingw-gcc: $(GENIE) --gcc=mingw-gcc gmake @@ -78,23 +74,16 @@ mingw-clang-release64: .build/projects/gmake-mingw-clang make -R -C .build/projects/gmake-mingw-clang config=release64 mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64 -.build/projects/vs2012: - $(GENIE) vs2012 - -.build/projects/vs2013: - $(GENIE) vs2013 +.build/projects/vs2017: + $(GENIE) vs2017 .build/projects/gmake-osx: $(GENIE) --gcc=osx gmake -osx-debug32: .build/projects/gmake-osx - make -C .build/projects/gmake-osx config=debug32 -osx-release32: .build/projects/gmake-osx - make -C .build/projects/gmake-osx config=release32 osx-debug64: .build/projects/gmake-osx make -C .build/projects/gmake-osx config=debug64 osx-release64: .build/projects/gmake-osx make -C .build/projects/gmake-osx config=release64 -osx: osx-debug32 osx-release32 osx-debug64 osx-release64 +osx: osx-debug64 osx-release64 .build/projects/gmake-ios-arm: $(GENIE) --gcc=ios-arm gmake @@ -112,6 +101,14 @@ ios-simulator-release: .build/projects/gmake-ios-simulator make -R -C .build/projects/gmake-ios-simulator config=release ios-simulator: ios-simulator-debug ios-simulator-release +.build/projects/gmake-ios-simulator64: + $(GENIE) --gcc=ios-simulator64 gmake +ios-simulator64-debug: .build/projects/gmake-ios-simulator64 + make -R -C .build/projects/gmake-ios-simulator64 config=debug +ios-simulator64-release: .build/projects/gmake-ios-simulator64 + make -R -C .build/projects/gmake-ios-simulator64 config=release +ios-simulator64: ios-simulator64-debug ios-simulator64-release + rebuild-shaders: make -R -C examples rebuild @@ -151,10 +148,11 @@ else OS=windows BUILD_PROJECT_DIR=gmake-mingw-gcc BUILD_OUTPUT_DIR=win32_mingw-gcc -BUILD_TOOLS_CONFIG=release32 +BUILD_TOOLS_CONFIG=release64 EXE=.exe endif +# bin2c .build/osx64_clang/bin/bin2cRelease: .build/projects/gmake-osx $(SILENT) make -C .build/projects/gmake-osx bin2c config=$(BUILD_TOOLS_CONFIG) @@ -170,10 +168,36 @@ tools/bin/linux/bin2c: .build/linux64_gcc/bin/bin2cRelease .build/win64_mingw-gcc/bin/bin2cRelease.exe: .build/projects/gmake-mingw-gcc $(SILENT) make -C .build/projects/gmake-mingw-gcc bin2c config=$(BUILD_TOOLS_CONFIG) -tools/bin/windows/bin2c.exe: .build/win64_mingw-gcc/bin/bin2cRelease +tools/bin/windows/bin2c.exe: .build/win64_mingw-gcc/bin/bin2cRelease.exe $(SILENT) cp $(<) $(@) -tools: tools/bin/$(OS)/bin2c$(EXE) +bin2c: tools/bin/$(OS)/bin2c$(EXE) + +# lemon +.build/osx64_clang/bin/lemonRelease: .build/projects/gmake-osx + $(SILENT) make -C .build/projects/gmake-osx lemon config=$(BUILD_TOOLS_CONFIG) + +tools/bin/darwin/lemon: .build/osx64_clang/bin/lemonRelease + $(SILENT) cp $(<) $(@) + +.build/linux64_gcc/bin/lemonRelease: .build/projects/gmake-linux + $(SILENT) make -C .build/projects/gmake-linux lemon config=$(BUILD_TOOLS_CONFIG) + +tools/bin/linux/lemon: .build/linux64_gcc/bin/lemonRelease + $(SILENT) cp $(<) $(@) + +.build/win64_mingw-gcc/bin/lemonRelease.exe: .build/projects/gmake-mingw-gcc + $(SILENT) make -C .build/projects/gmake-mingw-gcc lemon config=$(BUILD_TOOLS_CONFIG) + +tools/bin/windows/lemon.exe: .build/win64_mingw-gcc/bin/lemonRelease.exe + $(SILENT) cp $(<) $(@) + +tools/bin/$(OS)/lempar.c: tools/lemon/lempar.c + $(SILENT) cp $(<) $(@) + +lemon: tools/bin/$(OS)/lemon$(EXE) tools/bin/$(OS)/lempar.c + +tools: bin2c lemon dist: tools/bin/darwin/bin2c tools/bin/linux/bin2c tools/bin/windows/bin2c.exe diff --git a/3rdparty/bx/scripts/bin2c.lua b/3rdparty/bx/scripts/bin2c.lua index 0b1acdcefcb..fc4dec96c69 100644 --- a/3rdparty/bx/scripts/bin2c.lua +++ b/3rdparty/bx/scripts/bin2c.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- diff --git a/3rdparty/bx/scripts/bx.lua b/3rdparty/bx/scripts/bx.lua index 0f2f3ef0596..bb0d17ade18 100644 --- a/3rdparty/bx/scripts/bx.lua +++ b/3rdparty/bx/scripts/bx.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- @@ -15,6 +15,7 @@ project "bx" path.join(BX_DIR, "include/**.h"), path.join(BX_DIR, "include/**.inl"), path.join(BX_DIR, "src/**.cpp"), + path.join(BX_DIR, "scripts/**.natvis"), } configuration { "Debug" } diff --git a/3rdparty/bx/scripts/bx.natvis b/3rdparty/bx/scripts/bx.natvis new file mode 100644 index 00000000000..e1394d2b483 --- /dev/null +++ b/3rdparty/bx/scripts/bx.natvis @@ -0,0 +1,10 @@ + + + + {m_ptr,[m_len]s8} + m_ptr,[m_len]s8 + + m_ptr,[m_len] + + + diff --git a/3rdparty/bx/scripts/genie.lua b/3rdparty/bx/scripts/genie.lua index aab0a8a5620..3cdb23e7c60 100644 --- a/3rdparty/bx/scripts/genie.lua +++ b/3rdparty/bx/scripts/genie.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- @@ -39,6 +39,7 @@ end dofile "bx.lua" dofile "bin2c.lua" +dofile "lemon.lua" project "bx.test" kind "ConsoleApp" diff --git a/3rdparty/bx/scripts/lemon.lua b/3rdparty/bx/scripts/lemon.lua new file mode 100644 index 00000000000..21024fd80b9 --- /dev/null +++ b/3rdparty/bx/scripts/lemon.lua @@ -0,0 +1,22 @@ +-- +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. +-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause +-- + +project "lemon" + kind "ConsoleApp" + + files { + path.join(BX_DIR, "tools/lemon/lemon.c") + } + + configuration { "not vs*" } + buildoptions { + "-Wno-implicit-fallthrough", + "-Wno-sign-compare", + "-Wno-unused-parameter", + } + + configuration {} + + strip() diff --git a/3rdparty/bx/scripts/tinystl.natvis b/3rdparty/bx/scripts/tinystl.natvis new file mode 100644 index 00000000000..d1d07eb7c54 --- /dev/null +++ b/3rdparty/bx/scripts/tinystl.natvis @@ -0,0 +1,72 @@ + + + + {{ size={last - first} }} + + last - first + capacity - first + + last - first + first + + + + + + {{ size={m_buffer.last - m_buffer.first} }} + + m_buffer + + + + + {{ size={m_size} }} + + m_size + m_buckets.last - m_buckets.first + + *m_buckets.first + next + first + + + + + + {{ size={m_size} }} + + m_size + m_buckets.last - m_buckets.first + + *m_buckets.first + next + second + + + + + + {m_first,[m_last - m_first]na} + m_first,[m_last - m_first]na + + m_last - m_first + m_capacity - m_first + + m_last - m_first + m_first + + + + + + {m_str,[m_size]na} + m_str,[m_size]na + + m_size + + m_size + m_str + + + + diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index 076b8fbac60..03f97089b7b 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -1,5 +1,5 @@ -- --- Copyright 2010-2017 Branimir Karadzic. All rights reserved. +-- Copyright 2010-2018 Branimir Karadzic. All rights reserved. -- License: https://github.com/bkaradzic/bx#license-bsd-2-clause -- @@ -50,7 +50,6 @@ function toolchain(_buildDir, _libDir) description = "Choose GCC flavor", allowed = { { "android-arm", "Android - ARM" }, - { "android-mips", "Android - MIPS" }, { "android-x86", "Android - x86" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, @@ -64,6 +63,7 @@ function toolchain(_buildDir, _libDir) { "ios-arm", "iOS - ARM" }, { "ios-arm64", "iOS - ARM64" }, { "ios-simulator", "iOS - Simulator" }, + { "ios-simulator64", "iOS - Simulator 64" }, { "tvos-arm64", "tvOS - ARM64" }, { "tvos-simulator", "tvOS - Simulator" }, { "mingw-gcc", "MinGW" }, @@ -71,7 +71,6 @@ function toolchain(_buildDir, _libDir) { "netbsd", "NetBSD" }, { "osx", "OSX" }, { "orbis", "Orbis" }, - { "qnx-arm", "QNX/Blackberry - ARM" }, { "riscv", "RISC-V" }, { "rpi", "RaspberryPi" }, }, @@ -90,10 +89,7 @@ function toolchain(_buildDir, _libDir) { "vs2013-xp", "Visual Studio 2013 targeting XP" }, { "vs2015-xp", "Visual Studio 2015 targeting XP" }, { "vs2017-xp", "Visual Studio 2017 targeting XP" }, - { "winphone8", "Windows Phone 8.0" }, - { "winphone81", "Windows Phone 8.1" }, - { "winstore81", "Windows Store 8.1" }, - { "winstore82", "Universal Windows App" }, + { "winstore100", "Universal Windows App 10.0" }, { "durango", "Durango" }, { "orbis", "Orbis" }, }, @@ -122,6 +118,12 @@ function toolchain(_buildDir, _libDir) description = "Set iOS target version (default: 8.0).", } + newoption { + trigger = "with-macos", + value = "#", + description = "Set macOS target version (default 10.11).", + } + newoption { trigger = "with-tvos", value = "#", @@ -170,6 +172,11 @@ function toolchain(_buildDir, _libDir) iosPlatform = _OPTIONS["with-ios"] end + local macosPlatform = "" + if _OPTIONS["with-macos"] then + macosPlatform = _OPTIONS["with-macos"] + end + local tvosPlatform = "" if _OPTIONS["with-tvos"] then tvosPlatform = _OPTIONS["with-tvos"] @@ -211,25 +218,12 @@ function toolchain(_buildDir, _libDir) premake.gcc.llvm = true location (path.join(_buildDir, "projects", _ACTION .. "-android-arm")) - elseif "android-mips" == _OPTIONS["gcc"] then - - if not os.getenv("ANDROID_NDK_MIPS") - or not os.getenv("ANDROID_NDK_CLANG") - or not os.getenv("ANDROID_NDK_ROOT") then - print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.") - end - - premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" - premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++" - premake.gcc.llvm = true - location (path.join(_buildDir, "projects", _ACTION .. "-android-mips")) - elseif "android-x86" == _OPTIONS["gcc"] then if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_CLANG") or not os.getenv("ANDROID_NDK_ROOT") then - print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.") + print("Set ANDROID_NDK_CLANG, ANDROID_NDK_X86, and ANDROID_NDK_ROOT environment variables.") end premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" @@ -265,6 +259,12 @@ function toolchain(_buildDir, _libDir) premake.gcc.ar = "ar" location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator")) + elseif "ios-simulator64" == _OPTIONS["gcc"] then + premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" + premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" + premake.gcc.ar = "ar" + location (path.join(_buildDir, "projects", _ACTION .. "-ios-simulator64")) + elseif "tvos-arm64" == _OPTIONS["gcc"] then premake.gcc.cc = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" premake.gcc.cxx = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" @@ -377,24 +377,13 @@ function toolchain(_buildDir, _libDir) premake.gcc.ar = orbisToolchain .. "ar" location (path.join(_buildDir, "projects", _ACTION .. "-orbis")) - elseif "qnx-arm" == _OPTIONS["gcc"] then - - if not os.getenv("QNX_HOST") then - print("Set QNX_HOST environment variable.") - end - - premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc" - premake.gcc.cxx = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-g++" - premake.gcc.ar = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-ar" - location (path.join(_buildDir, "projects", _ACTION .. "-qnx-arm")) - elseif "rpi" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-rpi")) elseif "riscv" == _OPTIONS["gcc"] then - premake.gcc.cc = "$(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-gcc" - premake.gcc.cxx = "$(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-g++" - premake.gcc.ar = "$(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-ar" + premake.gcc.cc = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc" + premake.gcc.cxx = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-g++" + premake.gcc.ar = "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar" location (path.join(_buildDir, "projects", _ACTION .. "-riscv")) end @@ -418,28 +407,12 @@ function toolchain(_buildDir, _libDir) end location (path.join(_buildDir, "projects", _ACTION .. "-clang")) - elseif "winphone8" == _OPTIONS["vs"] then - premake.vstudio.toolset = "v110_wp80" - location (path.join(_buildDir, "projects", _ACTION .. "-winphone8")) - - elseif "winphone81" == _OPTIONS["vs"] then - premake.vstudio.toolset = "v120_wp81" - premake.vstudio.storeapp = "8.1" - platforms { "ARM" } - location (path.join(_buildDir, "projects", _ACTION .. "-winphone81")) - - elseif "winstore81" == _OPTIONS["vs"] then - premake.vstudio.toolset = "v120" - premake.vstudio.storeapp = "8.1" - platforms { "ARM" } - location (path.join(_buildDir, "projects", _ACTION .. "-winstore81")) - - elseif "winstore82" == _OPTIONS["vs"] then - premake.vstudio.toolset = "v140" - premake.vstudio.storeapp = "8.2" + elseif "winstore100" == _OPTIONS["vs"] then + premake.vstudio.toolset = "v141" + premake.vstudio.storeapp = "10.0" platforms { "ARM" } - location (path.join(_buildDir, "projects", _ACTION .. "-winstore82")) + location (path.join(_buildDir, "projects", _ACTION .. "-winstore100")) elseif "durango" == _OPTIONS["vs"] then if not os.getenv("DurangoXDK") then @@ -477,17 +450,26 @@ function toolchain(_buildDir, _libDir) end - elseif _ACTION == "xcode4" then + elseif _ACTION == "xcode4" + or _ACTION == "xcode8" + or _ACTION == "xcode9" then + local action = premake.action.current() + local str_or = function(str, def) + return #str > 0 and str or def + end if "osx" == _OPTIONS["xcode"] then + action.xcode.macOSTargetPlatformVersion = str_or(macosPlatform, "10.11") premake.xcode.toolset = "macosx" location (path.join(_buildDir, "projects", _ACTION .. "-osx")) elseif "ios" == _OPTIONS["xcode"] then + action.xcode.iOSTargetPlatformVersion = str_or(iosPlatform, "8.0") premake.xcode.toolset = "iphoneos" location (path.join(_buildDir, "projects", _ACTION .. "-ios")) elseif "tvos" == _OPTIONS["xcode"] then + action.xcode.tvOSTargetPlatformVersion = str_or(tvosPlatform, "9.0") premake.xcode.toolset = "appletvos" location (path.join(_buildDir, "projects", _ACTION .. "-tvos")) end @@ -554,6 +536,7 @@ function toolchain(_buildDir, _libDir) "_WIN32", "_HAS_EXCEPTIONS=0", "_HAS_ITERATOR_DEBUGGING=0", + "_ITERATOR_DEBUG_LEVEL=0", "_SCL_SECURE=0", "_SECURE_SCL=0", "_SCL_SECURE_NO_WARNINGS", @@ -619,10 +602,16 @@ function toolchain(_buildDir, _libDir) targetdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/bin")) objdir (path.join(_buildDir, "win64_" .. _ACTION .. "-clang/obj")) - configuration { "winphone8* or winstore8*" } + configuration { "winstore*" } removeflags { "StaticRuntime", - "NoExceptions", + "NoBufferSecurityCheck", + } + buildoptions { + "/wd4530", -- vccorlib.h(1345): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc + } + linkoptions { + "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata } configuration { "*-gcc* or osx" } @@ -645,7 +634,7 @@ function toolchain(_buildDir, _libDir) "-Wundef", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } linkoptions { "-Wl,--gc-sections", @@ -727,7 +716,6 @@ function toolchain(_buildDir, _libDir) -- "-Wduplicated-branches", -- "-Wduplicated-cond", -- "-Wjump-misses-init", - "-Wlogical-op", "-Wshadow", -- "-Wnull-dereference", "-Wunused-value", @@ -735,7 +723,7 @@ function toolchain(_buildDir, _libDir) -- "-Wuseless-cast", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } links { "rt", @@ -746,6 +734,11 @@ function toolchain(_buildDir, _libDir) "-Wl,--as-needed", } + configuration { "linux-gcc*" } + buildoptions { + "-Wlogical-op", + } + configuration { "linux-gcc*", "x32" } targetdir (path.join(_buildDir, "linux32_gcc/bin")) objdir (path.join(_buildDir, "linux32_gcc/obj")) @@ -787,7 +780,7 @@ function toolchain(_buildDir, _libDir) "-Wundef", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } links { "rt", @@ -806,7 +799,7 @@ function toolchain(_buildDir, _libDir) "-Wundef", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } links { "rt", @@ -823,6 +816,7 @@ function toolchain(_buildDir, _libDir) } includedirs { "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include", + "${ANDROID_NDK_ROOT}/sysroot/usr/include", "$(ANDROID_NDK_ROOT)/sources/android/native_app_glue", } linkoptions { @@ -834,7 +828,7 @@ function toolchain(_buildDir, _libDir) "m", "android", "log", - "c++", + "c++_shared", "gcc", } buildoptions { @@ -847,7 +841,7 @@ function toolchain(_buildDir, _libDir) "-Wundef", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } linkoptions { "-no-canonical-prefixes", @@ -866,7 +860,7 @@ function toolchain(_buildDir, _libDir) "__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it. } buildoptions { - "-std=c++11", + "-std=c++14", "-Wfatal-errors", "-Wunused-value", "-Wundef", @@ -885,12 +879,10 @@ function toolchain(_buildDir, _libDir) targetdir (path.join(_buildDir, "android-arm/bin")) objdir (path.join(_buildDir, "android-arm/obj")) libdirs { - path.join(_libDir, "lib/android-arm"), "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a", } includedirs { - "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/include", - "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include", + "$(ANDROID_NDK_ROOT)/sysroot/usr/include/arm-linux-androideabi", } buildoptions { "-gcc-toolchain $(ANDROID_NDK_ARM)", @@ -913,42 +905,14 @@ function toolchain(_buildDir, _libDir) "-Wl,--fix-cortex-a8", } - configuration { "android-mips" } - targetdir (path.join(_buildDir, "android-mips/bin")) - objdir (path.join(_buildDir, "android-mips/obj")) - libdirs { - path.join(_libDir, "lib/android-mips"), - "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips", - } - includedirs { - "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips/include", - } - buildoptions { - "-gcc-toolchain $(ANDROID_NDK_MIPS)", - "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"), - "-target mipsel-none-linux-android", - "-mips32", - "-Wunused-value", - "-Wundef", - } - linkoptions { - "-gcc-toolchain $(ANDROID_NDK_MIPS)", - "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"), - path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"), - path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"), - "-target mipsel-none-linux-android", - "-mips32", - } - configuration { "android-x86" } targetdir (path.join(_buildDir, "android-x86/bin")) objdir (path.join(_buildDir, "android-x86/obj")) libdirs { - path.join(_libDir, "lib/android-x86"), "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86", } includedirs { - "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86/include", + "$(ANDROID_NDK_ROOT)/sysroot/usr/include/x86_64-linux-android", } buildoptions { "-gcc-toolchain $(ANDROID_NDK_X86)", @@ -982,7 +946,7 @@ function toolchain(_buildDir, _libDir) "-Wundef", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } configuration { "freebsd" } @@ -1042,10 +1006,10 @@ function toolchain(_buildDir, _libDir) configuration { "osx" } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } buildoptions_objcpp { - "-std=c++11", + "-std=c++14", } buildoptions { "-Wfatal-errors", @@ -1060,10 +1024,10 @@ function toolchain(_buildDir, _libDir) "-lc++", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } buildoptions_objcpp { - "-std=c++11", + "-std=c++14", } buildoptions { "-Wfatal-errors", @@ -1072,7 +1036,7 @@ function toolchain(_buildDir, _libDir) } includedirs { path.join(bxDir, "include/compat/ios") } - configuration { "xcode4", "ios*" } + configuration { "xcode*", "ios*" } targetdir (path.join(_buildDir, "ios-arm/bin")) objdir (path.join(_buildDir, "ios-arm/obj")) @@ -1129,6 +1093,24 @@ function toolchain(_buildDir, _libDir) "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk", } + configuration { "ios-simulator64" } + targetdir (path.join(_buildDir, "ios-simulator64/bin")) + objdir (path.join(_buildDir, "ios-simulator64/obj")) + libdirs { path.join(_libDir, "lib/ios-simulator64") } + linkoptions { + "-mios-simulator-version-min=7.0", + "-arch x86_64", + "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk", + "-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/usr/lib/system", + "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/Frameworks", + "-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk/System/Library/PrivateFrameworks", + } + buildoptions { + "-mios-simulator-version-min=7.0", + "-arch x86_64", + "--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" ..iosPlatform .. ".sdk", + } + configuration { "tvos*" } linkoptions { "-lc++", @@ -1140,7 +1122,7 @@ function toolchain(_buildDir, _libDir) } includedirs { path.join(bxDir, "include/compat/ios") } - configuration { "xcode4", "tvos*" } + configuration { "xcode*", "tvos*" } targetdir (path.join(_buildDir, "tvos-arm64/bin")) objdir (path.join(_buildDir, "tvos-arm64/obj")) @@ -1190,21 +1172,7 @@ function toolchain(_buildDir, _libDir) "$(SCE_ORBIS_SDK_DIR)/target/include_common", } buildoptions_cpp { - "-std=c++11", - } - - configuration { "qnx-arm" } - targetdir (path.join(_buildDir, "qnx-arm/bin")) - objdir (path.join(_buildDir, "qnx-arm/obj")) - libdirs { path.join(_libDir, "lib/qnx-arm") } --- includedirs { path.join(bxDir, "include/compat/qnx") } - buildoptions { - "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0 - "-Wunused-value", - "-Wundef", - } - buildoptions_cpp { - "-std=c++11", + "-std=c++14", } configuration { "rpi" } @@ -1223,7 +1191,7 @@ function toolchain(_buildDir, _libDir) "-Wundef", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } includedirs { "/opt/vc/include", @@ -1246,16 +1214,16 @@ function toolchain(_buildDir, _libDir) "__MISC_VISIBLE", } includedirs { - "$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf/include", + "$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf/include", path.join(bxDir, "include/compat/riscv"), } buildoptions { "-Wunused-value", "-Wundef", - "--sysroot=$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf", + "--sysroot=$(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/riscv64-unknown-elf", } buildoptions_cpp { - "-std=c++11", + "-std=c++14", } configuration {} -- reset configuration @@ -1271,12 +1239,6 @@ function strip() "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\"" } - configuration { "android-mips", "Release" } - postbuildcommands { - "$(SILENT) echo Stripping symbols.", - "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\"" - } - configuration { "android-x86", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.", @@ -1305,21 +1267,24 @@ function strip() postbuildcommands { "$(SILENT) echo Running asmjs finalize.", "$(SILENT) \"$(EMSCRIPTEN)/emcc\" -O2 " + +-- .. "-s ALLOW_MEMORY_GROWTH=1 " +-- .. "-s ASSERTIONS=2 " -- .. "-s EMTERPRETIFY=1 " -- .. "-s EMTERPRETIFY_ASYNC=1 " + .. "-s PRECISE_F32=1 " .. "-s TOTAL_MEMORY=268435456 " --- .. "-s ALLOW_MEMORY_GROWTH=1 " -- .. "-s USE_WEBGL2=1 " + .. "--memory-init-file 1 " .. "\"$(TARGET)\" -o \"$(TARGET)\".html " -- .. "--preload-file ../../../examples/runtime@/ " - .. "-s PRECISE_F32=1" } configuration { "riscv" } postbuildcommands { "$(SILENT) echo Stripping symbols.", - "$(SILENT) $(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-strip -s \"$(TARGET)\"" + "$(SILENT) $(FREEDOM_E_SDK)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-strip -s \"$(TARGET)\"" } configuration {} -- reset configuration diff --git a/3rdparty/bx/src/allocator.cpp b/3rdparty/bx/src/allocator.cpp index e3b5b37c826..c26677edb25 100644 --- a/3rdparty/bx/src/allocator.cpp +++ b/3rdparty/bx/src/allocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/src/amalgamated.cpp b/3rdparty/bx/src/amalgamated.cpp index 7eaf04a58aa..d3f896b1416 100644 --- a/3rdparty/bx/src/amalgamated.cpp +++ b/3rdparty/bx/src/amalgamated.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "allocator.cpp" diff --git a/3rdparty/bx/src/bx.cpp b/3rdparty/bx/src/bx.cpp index ae9743e45a7..659cb5917cf 100644 --- a/3rdparty/bx/src/bx.cpp +++ b/3rdparty/bx/src/bx.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -13,14 +13,14 @@ namespace bx { - void xchg(void* _a, void* _b, size_t _numBytes) + void swap(void* _a, void* _b, size_t _numBytes) { uint8_t* lhs = (uint8_t*)_a; uint8_t* rhs = (uint8_t*)_b; const uint8_t* end = rhs + _numBytes; while (rhs != end) { - xchg(*lhs++, *rhs++); + swap(*lhs++, *rhs++); } } diff --git a/3rdparty/bx/src/bx_p.h b/3rdparty/bx/src/bx_p.h index df37a2c5791..d4b00084de3 100644 --- a/3rdparty/bx/src/bx_p.h +++ b/3rdparty/bx/src/bx_p.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -40,5 +40,6 @@ BX_MACRO_BLOCK_END #include +#include #endif // BX_P_H_HEADER_GUARD diff --git a/3rdparty/bx/src/commandline.cpp b/3rdparty/bx/src/commandline.cpp index de658261c41..df322560b56 100644 --- a/3rdparty/bx/src/commandline.cpp +++ b/3rdparty/bx/src/commandline.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -9,12 +9,14 @@ namespace bx { - // Reference: - // http://msdn.microsoft.com/en-us/library/a1y7w461.aspx - const char* tokenizeCommandLine(const char* _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term) + // Reference(s): + // - https://web.archive.org/web/20180629044234/https://msdn.microsoft.com/en-us/library/a1y7w461.aspx + // + StringView tokenizeCommandLine(const StringView& _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term) { int32_t argc = 0; - const char* curr = _commandLine; + const char* curr = _commandLine.getPtr(); + const char* end = _commandLine.getTerm(); char* currOut = _buffer; char term = ' '; bool sub = false; @@ -30,7 +32,7 @@ namespace bx ParserState state = SkipWhitespace; - while ('\0' != *curr + while (end != curr && _term != *curr && argc < _maxArgvs) { @@ -64,7 +66,7 @@ namespace bx state = Escape; } else if ('"' == *curr - && '"' != term) + && '"' != term) { sub = !sub; } @@ -135,7 +137,7 @@ namespace bx ++curr; } - return curr; + return StringView(curr, _commandLine.getTerm() ); } CommandLine::CommandLine(int32_t _argc, char const* const* _argv) diff --git a/3rdparty/bx/src/crtnone.cpp b/3rdparty/bx/src/crtnone.cpp index 85028212133..93579515c7f 100644 --- a/3rdparty/bx/src/crtnone.cpp +++ b/3rdparty/bx/src/crtnone.cpp @@ -1,15 +1,22 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "bx_p.h" #include +#include +#include #include -#include +#include #if BX_CRT_NONE +#include "crt0.h" + +#define NOT_IMPLEMENTED() \ + { bx::debugPrintf("crtnone: %s not implemented\n", BX_FUNCTION); abort(); } + extern "C" void* memcpy(void* _dst, const void* _src, size_t _numBytes) { bx::memCopy(_dst, _src, _numBytes); @@ -81,6 +88,11 @@ extern "C" int32_t strncmp(const char* _lhs, const char* _rhs, size_t _max) return bx::strCmp(_lhs, _rhs, _max); } +extern "C" int32_t strcasecmp(const char* _lhs, const char* _rhs) +{ + return bx::strCmpI(_lhs, _rhs); +} + extern "C" const char* strstr(const char* _str, const char* _find) { return bx::strFind(_str, _find); @@ -97,7 +109,7 @@ extern "C" int isprint(int _ch) return bx::isPrint(_ch); } -extern "C" int toupper (int _ch) +extern "C" int toupper(int _ch) { return bx::toUpper(_ch); } @@ -110,13 +122,16 @@ extern "C" size_t mbstowcs(wchar_t* _dst, const char* _src, size_t _max) extern "C" char* strdup(const char* _src) { - BX_UNUSED(_src); - return NULL; + uint32_t size = bx::strLen(_src)+1; + char* dup = (char*)malloc(size); + bx::strCopy(dup, size, _src); + return dup; } extern "C" long int strtol(const char* _str, char** _end, int _base) { BX_UNUSED(_str, _end, _base); + NOT_IMPLEMENTED(); return -1; } @@ -125,32 +140,29 @@ extern "C" int abs(int _value) return _value >= 0 ? _value : -_value; } -extern "C" float fabsf(float _value) +extern "C" float fabsf(float _x) { - return _value >= 0.0f ? _value : -_value; + return bx::abs(_x); } -extern "C" double fabs(double _value) +extern "C" double fabs(double _x) { - return _value >= 0.0 ? _value : -_value; + return bx::abs(_x); } extern "C" double ldexp(double _x, int _exp) { - BX_UNUSED(_x, _exp); - return 0.0; + return bx::ldexp(float(_x), _exp); } extern "C" float expf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::exp(_x); } extern "C" float logf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::log(_x); } extern "C" float log10f(float _x) @@ -159,88 +171,74 @@ extern "C" float log10f(float _x) return 0.0f; } -extern "C" float powf(float _x) +extern "C" float powf(float _x, float _y) { - BX_UNUSED(_x); - return 0.0f; + return bx::pow(_x, _y); } -extern "C" double pow(double _x) +extern "C" double pow(double _x, float _y) { - BX_UNUSED(_x); - return 0.0; + return bx::pow(_x, _y); } extern "C" float sinf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::sin(_x); } extern "C" float cosf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::cos(_x); } extern "C" float tanf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::tan(_x); } extern "C" float atan2f(float _y, float _x) { - BX_UNUSED(_y, _x); - return 0.0f; + return bx::atan2(_y, _x); } extern "C" float sqrtf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::sqrt(_x); } extern "C" double sqrt(double _x) { - BX_UNUSED(_x); - return 0.0; + return bx::sqrt(_x); } extern "C" float ceilf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::ceil(_x); } extern "C" double ceil(double _x) { - BX_UNUSED(_x); - return 0.0; + return bx::ceil(_x); } extern "C" float floorf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::floor(_x); } extern "C" double floor(double _x) { - BX_UNUSED(_x); - return 0.0; + return bx::floor(_x); } extern "C" float acosf(float _x) { - BX_UNUSED(_x); - return 0.0f; + return bx::acos(_x); } extern "C" float fmodf(float _numer, float _denom) { - BX_UNUSED(_numer, _denom); - return 0.0f; + return bx::mod(_numer, _denom); } extern "C" int atoi(const char* _str) @@ -257,21 +255,24 @@ extern "C" double atof(const char* _str) return result; } -extern "C" struct DIR* opendir(const char* dirname) +extern "C" struct DIR* opendir(const char* _dirname) { - BX_UNUSED(dirname); + BX_UNUSED(_dirname); +// NOT_IMPLEMENTED(); return NULL; } -extern "C" struct dirent* readdir(struct DIR* dirp) +extern "C" struct dirent* readdir(struct DIR* _dirp) { - BX_UNUSED(dirp); + BX_UNUSED(_dirp); + NOT_IMPLEMENTED(); return NULL; } -extern "C" int closedir (struct DIR* dirp) +extern "C" int closedir(struct DIR* _dirp) { - BX_UNUSED(dirp); + BX_UNUSED(_dirp); + NOT_IMPLEMENTED(); return 0; } @@ -300,8 +301,13 @@ extern "C" int snprintf(char* _out, size_t _max, const char* _format, ...) extern "C" int printf(const char* _format, ...) { - BX_UNUSED(_format); - return -1; + va_list argList; + va_start(argList, _format); + bx::WriterI* writer = bx::getStdOut(); + bx::Error err; + int32_t len = bx::write(writer, &err, _format, argList); + va_end(argList); + return len; } struct FILE @@ -337,172 +343,270 @@ FILE * stdout; extern "C" FILE* fopen(const char* _filename, const char* _mode) { BX_UNUSED(_filename, _mode); + bx::debugPrintf("fopen(\"%s\", \"%s\");\n", _filename, _mode); +// NOT_IMPLEMENTED(); return NULL; } extern "C" int fclose(FILE* _stream) { BX_UNUSED(_stream); - return -1; + bx::debugPrintf("fclose(%p);\n", _stream); +// NOT_IMPLEMENTED(); + return 0; } extern "C" size_t fread(void* _ptr, size_t _size, size_t _count, FILE* _stream) { BX_UNUSED(_ptr, _size, _count, _stream); + NOT_IMPLEMENTED(); return -1; } extern "C" size_t fwrite(const void* _ptr, size_t _size, size_t _count, FILE* _stream) { BX_UNUSED(_ptr, _size, _count, _stream); + NOT_IMPLEMENTED(); return -1; } extern "C" int fseek(FILE* _stream, long int _offset, int _origin) { BX_UNUSED(_stream, _offset, _origin); + NOT_IMPLEMENTED(); return -1; } extern "C" int fseeko64(FILE* _stream, off64_t _offset, int _whence) { BX_UNUSED(_stream, _offset, _whence); + NOT_IMPLEMENTED(); return -1; } extern "C" long int ftell(FILE* _stream) { BX_UNUSED(_stream); + NOT_IMPLEMENTED(); return -1; } extern "C" off64_t ftello64(FILE* _stream) { BX_UNUSED(_stream); + NOT_IMPLEMENTED(); return -1; } extern "C" int feof(FILE* _stream) { BX_UNUSED(_stream); + NOT_IMPLEMENTED(); return -1; } extern "C" int ferror(FILE* _stream) { BX_UNUSED(_stream); + NOT_IMPLEMENTED(); return -1; } extern "C" FILE* popen(const char* _command, const char* _type) { BX_UNUSED(_command, _type); + NOT_IMPLEMENTED(); return NULL; } extern "C" int pclose(FILE* _stream) { BX_UNUSED(_stream); + NOT_IMPLEMENTED(); return -1; } extern "C" int execvp(const char* _file, char* const _argv[]) { BX_UNUSED(_file, _argv); + NOT_IMPLEMENTED(); return -1; } +typedef int32_t clockid_t; + +inline void toTimespecNs(timespec& _ts, int64_t _nsecs) +{ + _ts.tv_sec = _nsecs/INT64_C(1000000000); + _ts.tv_nsec = _nsecs%INT64_C(1000000000); +} + +extern "C" int clock_gettime(clockid_t _clock, struct timespec* _ts) +{ + BX_UNUSED(_clock); + int64_t now = crt0::getHPCounter(); + toTimespecNs(*_ts, now); + return 0; +} + extern "C" long syscall(long _num, ...) { - BX_UNUSED(_num); - return -1; + va_list argList; + va_start(argList, _num); + + long result = -1; + + switch (_num) + { + case 39: + result = crt0::processGetId(); + break; + + case 228: + { + clockid_t arg0 = va_arg(argList, clockid_t); + timespec* arg1 = va_arg(argList, timespec*); + result = clock_gettime(arg0, arg1); + } + break; + + default: + bx::debugPrintf("? syscall %d\n", _num); + break; + } + + va_end(argList); + + return result; } extern "C" long sysconf(int name) { BX_UNUSED(name); + NOT_IMPLEMENTED(); return -1; } -extern "C" pid_t fork() +extern "C" pid_t fork(void) { + NOT_IMPLEMENTED(); return -1; } -extern "C" int sched_yield() +extern "C" int sched_yield(void) { + NOT_IMPLEMENTED(); return -1; } extern "C" int prctl(int _option, unsigned long _arg2, unsigned long _arg3, unsigned long _arg4, unsigned long _arg5) { BX_UNUSED(_option, _arg2, _arg3, _arg4, _arg5); + NOT_IMPLEMENTED(); return -1; } extern "C" int chdir(const char* _path) { BX_UNUSED(_path); + bx::debugPrintf("chdir(%s) not implemented!\n", _path); return -1; } extern "C" char* getcwd(char* _buf, size_t _size) { BX_UNUSED(_buf, _size); + NOT_IMPLEMENTED(); return NULL; } extern "C" char* getenv(const char* _name) { - BX_UNUSED(_name); - return NULL; + return const_cast(crt0::getEnv(_name) ); } extern "C" int setenv(const char* _name, const char* _value, int _overwrite) { BX_UNUSED(_name, _value, _overwrite); + bx::debugPrintf("setenv(%s, %s, %d) not implemented!\n", _name, _value, _overwrite); return -1; } extern "C" int unsetenv(const char* _name) { BX_UNUSED(_name); + bx::debugPrintf("unsetenv(%s) not implemented!\n", _name); return -1; } -extern "C" time_t time(time_t* _arg) +#if 0 +struct timeval { - BX_UNUSED(_arg); - return -1; -} + time_t tv_sec; + suseconds_t tv_usec; +}; + +struct timespec +{ + time_t tv_sec; + long tv_nsec; +}; +#endif // extern "C" int gettimeofday(struct timeval* _tv, struct timezone* _tz) { - BX_UNUSED(_tv, _tz); - return -1; + BX_UNUSED(_tz); + + timespec ts; + + if (NULL == _tv) + { + return 0; + } + + clock_gettime(0 /*CLOCK_REALTIME*/, &ts); + _tv->tv_sec = ts.tv_sec; + _tv->tv_usec = (int)ts.tv_nsec / 1000; + return 0; +} + +typedef int64_t time_t; + +extern "C" time_t time(time_t* _arg) +{ + timespec ts; + clock_gettime(0 /*CLOCK_REALTIME*/, &ts); + time_t result = ts.tv_sec; + + if (NULL != _arg) + { + *_arg = result; + } + + return result; } extern "C" void* realloc(void* _ptr, size_t _size) { - BX_UNUSED(_ptr, _size); - return NULL; + return crt0::realloc(_ptr, _size); } extern "C" void* malloc(size_t _size) { - return ::realloc(NULL, _size); + return crt0::realloc(NULL, _size); } extern "C" void free(void* _ptr) { - BX_UNUSED(_ptr); + crt0::realloc(_ptr, 0); } #endif // BX_PLATFORM_* -extern "C" void abort() +extern "C" void abort(void) { - while (true) {}; + bx::debugPrintf("crtnone: abort called!\n"); + crt0::exit(bx::kExitFailure); } extern "C" void __assert_fail(const char* _assertion, const char* _file, uint32_t _line, const char* _function) @@ -517,7 +621,7 @@ void operator delete(void*) { } -extern "C" void __cxa_pure_virtual() +extern "C" void __cxa_pure_virtual(void) { } @@ -527,7 +631,7 @@ extern "C" int __cxa_atexit(void (*_dtorFn)(void*), void* _arg, void* _dsoHandle return 0; } -extern "C" void __gxx_personality_v0() +extern "C" void __gxx_personality_v0(void) { } @@ -577,17 +681,17 @@ namespace __cxxabiv1 __extension__ typedef int __guard __attribute__( (mode(__DI__) ) ); - extern "C" int __cxa_guard_acquire (__guard* _g) + extern "C" int __cxa_guard_acquire(__guard* _g) { return !*(char*)(_g); } - extern "C" void __cxa_guard_release (__guard* _g) + extern "C" void __cxa_guard_release(__guard* _g) { *(char*)_g = 1; } - extern "C" void __cxa_guard_abort (__guard* _g) + extern "C" void __cxa_guard_abort(__guard* _g) { BX_UNUSED(_g); } diff --git a/3rdparty/bx/src/debug.cpp b/3rdparty/bx/src/debug.cpp index d08fc9903e6..8e8bae122a6 100644 --- a/3rdparty/bx/src/debug.cpp +++ b/3rdparty/bx/src/debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -9,10 +9,12 @@ #include // WriterI #include // PRIx* -#if BX_PLATFORM_ANDROID +#if BX_CRT_NONE +# include "crt0.h" +#elif BX_PLATFORM_ANDROID # include #elif BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ + || BX_PLATFORM_WINRT \ || BX_PLATFORM_XBOXONE extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str); #elif BX_PLATFORM_IOS || BX_PLATFORM_OSX @@ -49,16 +51,19 @@ namespace bx void debugOutput(const char* _out) { -#if BX_PLATFORM_ANDROID +#if BX_CRT_NONE + crt0::debugOutput(_out); +#elif BX_PLATFORM_ANDROID # ifndef BX_ANDROID_LOG_TAG # define BX_ANDROID_LOG_TAG "" # endif // BX_ANDROID_LOG_TAG __android_log_write(ANDROID_LOG_DEBUG, BX_ANDROID_LOG_TAG, _out); #elif BX_PLATFORM_WINDOWS \ - || BX_PLATFORM_WINRT \ + || BX_PLATFORM_WINRT \ || BX_PLATFORM_XBOXONE OutputDebugStringA(_out); -#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX +#elif BX_PLATFORM_IOS \ + || BX_PLATFORM_OSX # if defined(__OBJC__) NSLog(@"%s", _out); # else @@ -66,14 +71,33 @@ namespace bx # endif // defined(__OBJC__) #elif 0 // BX_PLATFORM_EMSCRIPTEN emscripten_log(EM_LOG_CONSOLE, "%s", _out); -#elif !BX_CRT_NONE +#else fputs(_out, stdout); fflush(stdout); -#else - BX_UNUSED(_out); #endif // BX_PLATFORM_ } + void debugOutput(const StringView& _str) + { +#if BX_CRT_NONE + crt0::debugOutput(_str); +#else + const char* data = _str.getPtr(); + int32_t size = _str.getLength(); + + char temp[4096]; + while (0 != size) + { + uint32_t len = uint32_min(sizeof(temp)-1, size); + memCopy(temp, data, len); + temp[len] = '\0'; + data += len; + size -= len; + debugOutput(temp); + } +#endif // BX_CRT_NONE + } + void debugPrintfVargs(const char* _format, va_list _argList) { char temp[8192]; @@ -153,20 +177,8 @@ namespace bx virtual int32_t write(const void* _data, int32_t _size, Error* _err) override { BX_UNUSED(_err); - - int32_t total = 0; - - char temp[4096]; - while (total != _size) - { - uint32_t len = bx::uint32_min(sizeof(temp)-1, _size-total); - memCopy(temp, _data, len); - temp[len] = '\0'; - debugOutput(temp); - total += len; - } - - return total; + debugOutput(StringView( (const char*)_data, _size) ); + return _size; } }; diff --git a/3rdparty/bx/src/dtoa.cpp b/3rdparty/bx/src/dtoa.cpp index 6945210dad1..3c23ea516e1 100644 --- a/3rdparty/bx/src/dtoa.cpp +++ b/3rdparty/bx/src/dtoa.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -314,7 +314,8 @@ namespace bx if (p2 < delta) { *K += kappa; - GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * s_kPow10[-kappa]); + const int index = -static_cast(kappa); + GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * (index < 9 ? s_kPow10[-static_cast(kappa)] : 0)); return; } } @@ -466,12 +467,12 @@ namespace bx { for (int32_t ii = 0, jj = _len - 1; ii < jj; ++ii, --jj) { - xchg(_dst[ii], _dst[jj]); + swap(_dst[ii], _dst[jj]); } } template - int32_t toStringSigned(char* _dst, int32_t _max, Ty _value, uint32_t _base) + int32_t toStringSigned(char* _dst, int32_t _max, Ty _value, uint32_t _base, char _separator) { if (_base == 10 && _value < 0) @@ -482,10 +483,11 @@ namespace bx } _max = toString(_dst + 1 - , _max - 1 - , typename std::make_unsigned::type(-_value) - , _base - ); + , _max - 1 + , typename std::make_unsigned::type(-_value) + , _base + , _separator + ); if (_max == 0) { return 0; @@ -496,24 +498,25 @@ namespace bx } return toString(_dst - , _max - , typename std::make_unsigned::type(_value) - , _base - ); + , _max + , typename std::make_unsigned::type(_value) + , _base + , _separator + ); } - int32_t toString(char* _dst, int32_t _max, int32_t _value, uint32_t _base) + int32_t toString(char* _dst, int32_t _max, int32_t _value, uint32_t _base, char _separator) { - return toStringSigned(_dst, _max, _value, _base); + return toStringSigned(_dst, _max, _value, _base, _separator); } - int32_t toString(char* _dst, int32_t _max, int64_t _value, uint32_t _base) + int32_t toString(char* _dst, int32_t _max, int64_t _value, uint32_t _base, char _separator) { - return toStringSigned(_dst, _max, _value, _base); + return toStringSigned(_dst, _max, _value, _base, _separator); } template - int32_t toStringUnsigned(char* _dst, int32_t _max, Ty _value, uint32_t _base) + int32_t toStringUnsigned(char* _dst, int32_t _max, Ty _value, uint32_t _base, char _separator) { char data[32]; int32_t len = 0; @@ -524,6 +527,8 @@ namespace bx return 0; } + uint32_t count = 1; + do { const Ty rem = _value % _base; @@ -537,7 +542,16 @@ namespace bx data[len++] = char('a' + rem - 10); } - } while (_value != 0); + if ('\0' != _separator + && 0 == count%3 + && 0 != _value) + { + data[len++] = _separator; + } + + ++count; + } + while (0 != _value); if (_max < len + 1) { @@ -551,14 +565,14 @@ namespace bx return int32_t(len); } - int32_t toString(char* _dst, int32_t _max, uint32_t _value, uint32_t _base) + int32_t toString(char* _dst, int32_t _max, uint32_t _value, uint32_t _base, char _separator) { - return toStringUnsigned(_dst, _max, _value, _base); + return toStringUnsigned(_dst, _max, _value, _base, _separator); } - int32_t toString(char* _dst, int32_t _max, uint64_t _value, uint32_t _base) + int32_t toString(char* _dst, int32_t _max, uint64_t _value, uint32_t _base, char _separator) { - return toStringUnsigned(_dst, _max, _value, _base); + return toStringUnsigned(_dst, _max, _value, _base, _separator); } /* @@ -1106,11 +1120,12 @@ namespace bx bool fromString(int32_t* _out, const StringView& _str) { - const char* str = _str.getPtr(); - const char* term = _str.getTerm(); + StringView str = bx::strLTrimSpace(_str); - str = strws(str); - char ch = *str++; + const char* ptr = str.getPtr(); + const char* term = str.getTerm(); + + char ch = *ptr++; bool neg = false; switch (ch) { @@ -1119,13 +1134,13 @@ namespace bx break; default: - --str; + --ptr; break; } int32_t result = 0; - for (ch = *str++; isNumeric(ch) && str <= term; ch = *str++) + for (ch = *ptr++; isNumeric(ch) && ptr <= term; ch = *ptr++) { result = 10*result - (ch - '0'); } diff --git a/3rdparty/bx/src/easing.cpp b/3rdparty/bx/src/easing.cpp index 8ecb2d53299..e9f82b280de 100644 --- a/3rdparty/bx/src/easing.cpp +++ b/3rdparty/bx/src/easing.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/src/file.cpp b/3rdparty/bx/src/file.cpp index af74589c876..8a282cab91f 100644 --- a/3rdparty/bx/src/file.cpp +++ b/3rdparty/bx/src/file.cpp @@ -1,13 +1,17 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "bx_p.h" #include -#include -#include +#if BX_CRT_NONE +# include "crt0.h" +#else +# include +# include +#endif // !BX_CRT_NONE #ifndef BX_CONFIG_CRT_FILE_READER_WRITER # define BX_CONFIG_CRT_FILE_READER_WRITER !(0 \ @@ -47,8 +51,8 @@ namespace bx virtual int32_t write(const void* _data, int32_t _size, Error* _err) override { - BX_UNUSED(_data, _size, _err); - return 0; + BX_UNUSED(_data, _err); + return _size; } }; @@ -61,8 +65,7 @@ namespace bx || BX_PLATFORM_ANDROID \ || BX_PLATFORM_BSD \ || BX_PLATFORM_IOS \ - || BX_PLATFORM_OSX \ - || BX_PLATFORM_QNX + || BX_PLATFORM_OSX # define fseeko64 fseeko # define ftello64 ftello # elif BX_PLATFORM_PS4 @@ -223,6 +226,196 @@ namespace bx bool m_open; }; + ReaderI* getStdIn() + { + static FileReaderImpl s_stdIn(stdout); + return &s_stdIn; + } + + WriterI* getStdOut() + { + static FileWriterImpl s_stdOut(stdout); + return &s_stdOut; + } + + WriterI* getStdErr() + { + static FileWriterImpl s_stdOut(stderr); + return &s_stdOut; + } + +#elif BX_CRT_NONE + class FileReaderImpl : public FileReaderI + { + public: + FileReaderImpl(void* _file) + : m_fd(int32_t(intptr_t(_file) ) ) + , m_open(false) + { + } + + virtual ~FileReaderImpl() + { + close(); + } + + virtual bool open(const FilePath& _filePath, Error* _err) override + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + if (0 != m_fd) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_ALREADY_OPEN, "FileReader: File is already open."); + return false; + } + + m_fd = crt0::open(_filePath.get(), crt0::Open::Read, 0); + + if (0 >= m_fd) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "FileReader: Failed to open file."); + return false; + } + + m_open = true; + return true; + } + + virtual void close() override + { + if (m_open + && 0 != m_fd) + { + crt0::close(m_fd); + m_fd = 0; + } + } + + virtual int64_t seek(int64_t _offset, Whence::Enum _whence) override + { + BX_CHECK(0 != m_fd, "Reader/Writer file is not open."); + return crt0::seek(m_fd, _offset, crt0::Whence::Enum(_whence) ); + } + + virtual int32_t read(void* _data, int32_t _size, Error* _err) override + { + BX_CHECK(0 != m_fd, "Reader/Writer file is not open."); + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = crt0::read(m_fd, _data, _size); + if (size != _size) + { + BX_UNUSED(_err); +// if (0 != feof(m_file) ) +// { +// BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "FileReader: EOF."); +// } +// else if (0 != ferror(m_file) ) +// { +// BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "FileReader: read error."); +// } + + return size >= 0 ? size : 0; + } + + return size; + } + + private: + int32_t m_fd; + bool m_open; + }; + + class FileWriterImpl : public FileWriterI + { + public: + FileWriterImpl(void* _file) + : m_fd(int32_t(intptr_t(_file) ) ) + , m_open(false) + { + } + + virtual ~FileWriterImpl() + { + close(); + } + + virtual bool open(const FilePath& _filePath, bool _append, Error* _err) override + { + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + if (0 != m_fd) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_ALREADY_OPEN, "FileReader: File is already open."); + return false; + } + + m_fd = crt0::open(_filePath.get(), _append ? crt0::Open::Append : crt0::Open::Write, 0600); + + if (0 >= m_fd) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_OPEN, "FileWriter: Failed to open file."); + return false; + } + + m_open = true; + return true; + } + + virtual void close() override + { + if (m_open + && 0 != m_fd) + { + crt0::close(m_fd); + m_fd = 0; + } + } + + virtual int64_t seek(int64_t _offset, Whence::Enum _whence) override + { + BX_CHECK(0 != m_fd, "Reader/Writer file is not open."); + return crt0::seek(m_fd, _offset, crt0::Whence::Enum(_whence) ); + } + + virtual int32_t write(const void* _data, int32_t _size, Error* _err) override + { + BX_CHECK(0 != m_fd, "Reader/Writer file is not open."); + BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); + + int32_t size = crt0::write(m_fd, _data, _size); + if (size != _size) + { + BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "FileWriter: write failed."); + return size >= 0 ? size : 0; + } + + return size; + } + + private: + int32_t m_fd; + bool m_open; + }; + + ReaderI* getStdIn() + { + static FileReaderImpl s_stdIn( (void*)intptr_t(crt0::Io::In) ); + return &s_stdIn; + } + + WriterI* getStdOut() + { + static FileWriterImpl s_stdOut( (void*)intptr_t(crt0::Io::Out) ); + return &s_stdOut; + } + + WriterI* getStdErr() + { + static FileWriterImpl s_stdOut( (void*)intptr_t(crt0::Io::Err) ); + return &s_stdOut; + } + #else class FileReaderImpl : public FileReaderI @@ -262,8 +455,32 @@ namespace bx typedef NoopWriterImpl FileWriterImpl; + ReaderI* getStdIn() + { + static FileReaderImpl s_stdIn(NULL); + return &s_stdIn; + } + + WriterI* getStdOut() + { + static FileWriterImpl s_stdOut(NULL); + return &s_stdOut; + } + + WriterI* getStdErr() + { + static FileWriterImpl s_stdOut(NULL); + return &s_stdOut; + } + #endif // BX_CONFIG_CRT_FILE_READER_WRITER + WriterI* getNullOut() + { + static NoopWriterImpl s_nullOut(NULL); + return &s_nullOut; + } + FileReader::FileReader() { BX_STATIC_ASSERT(sizeof(FileReaderImpl) <= sizeof(m_internal) ); @@ -336,36 +553,16 @@ namespace bx return impl->write(_data, _size, _err); } - ReaderI* getStdIn() - { - static FileReaderImpl s_stdIn(stdout); - return &s_stdIn; - } - - WriterI* getStdOut() - { - static FileWriterImpl s_stdOut(stdout); - return &s_stdOut; - } - - WriterI* getStdErr() - { - static FileWriterImpl s_stdOut(stderr); - return &s_stdOut; - } - - WriterI* getNullOut() - { - static NoopWriterImpl s_nullOut(NULL); - return &s_nullOut; - } - bool stat(const FilePath& _filePath, FileInfo& _outFileInfo) { +#if BX_CRT_NONE + BX_UNUSED(_filePath, _outFileInfo); + return false; +#else _outFileInfo.m_size = 0; _outFileInfo.m_type = FileInfo::Count; -#if BX_COMPILER_MSVC +# if BX_COMPILER_MSVC struct ::_stat64 st; int32_t result = ::_stat64(_filePath.get(), &st); @@ -382,7 +579,7 @@ namespace bx { _outFileInfo.m_type = FileInfo::Directory; } -#else +# else struct ::stat st; int32_t result = ::stat(_filePath.get(), &st); if (0 != result) @@ -398,11 +595,12 @@ namespace bx { _outFileInfo.m_type = FileInfo::Directory; } -#endif // BX_COMPILER_MSVC +# endif // BX_COMPILER_MSVC _outFileInfo.m_size = st.st_size; return true; +#endif // BX_CRT_NONE } } // namespace bx diff --git a/3rdparty/bx/src/filepath.cpp b/3rdparty/bx/src/filepath.cpp index b8bbe279a59..0ee2fc171ad 100644 --- a/3rdparty/bx/src/filepath.cpp +++ b/3rdparty/bx/src/filepath.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,15 +8,17 @@ #include #include -#include // remove -#include // opendir +#if !BX_CRT_NONE +# include // remove +# include // opendir -#if BX_CRT_MSVC -# include // _getcwd -#else -# include // mkdir -# include // getcwd -#endif // BX_CRT_MSVC +# if BX_CRT_MSVC +# include // _getcwd +# else +# include // mkdir +# include // getcwd +# endif // BX_CRT_MSVC +#endif // 0 #if BX_PLATFORM_WINDOWS extern "C" __declspec(dllimport) unsigned long __stdcall GetTempPathA(unsigned long _max, char* _ptr); @@ -34,8 +36,9 @@ namespace bx static int32_t normalizeFilePath(char* _dst, int32_t _dstSize, const char* _src, int32_t _num) { - // Reference: Lexical File Names in Plan 9 or Getting Dot-Dot Right - // https://9p.io/sys/doc/lexnames.html + // Reference(s): + // - Lexical File Names in Plan 9 or Getting Dot-Dot Right + // https://web.archive.org/web/20180629044444/https://9p.io/sys/doc/lexnames.html const int32_t num = strLen(_src, _num); @@ -118,7 +121,6 @@ namespace bx break; } - BX_FALLTHROUGH; default: @@ -152,12 +154,12 @@ namespace bx return size; } - static bool getEnv(const char* _name, FileInfo::Enum _type, char* _out, uint32_t* _inOutSize) + static bool getEnv(char* _out, uint32_t* _inOutSize, const StringView& _name, FileInfo::Enum _type) { uint32_t len = *_inOutSize; *_out = '\0'; - if (getenv(_name, _out, &len) ) + if (getEnv(_out, &len, _name) ) { FileInfo fi; if (stat(_out, fi) @@ -175,7 +177,8 @@ namespace bx { #if BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE BX_UNUSED(_buffer, _size); return NULL; #elif BX_CRT_MSVC @@ -188,18 +191,22 @@ namespace bx static bool getCurrentPath(char* _out, uint32_t* _inOutSize) { uint32_t len = *_inOutSize; - pwd(_out, len); - *_inOutSize = strLen(_out); - return true; + if (NULL != pwd(_out, len)) + { + *_inOutSize = strLen(_out); + return true; + } + + return false; } static bool getHomePath(char* _out, uint32_t* _inOutSize) { return false #if BX_PLATFORM_WINDOWS - || getEnv("USERPROFILE", FileInfo::Directory, _out, _inOutSize) + || getEnv(_out, _inOutSize, "USERPROFILE", FileInfo::Directory) #endif // BX_PLATFORM_WINDOWS - || getEnv("HOME", FileInfo::Directory, _out, _inOutSize) + || getEnv(_out, _inOutSize, "HOME", FileInfo::Directory) ; } @@ -211,21 +218,21 @@ namespace bx *_inOutSize = len; return result; #else - static const char* s_tmp[] = + static const StringView s_tmp[] = { "TMPDIR", "TMP", "TEMP", "TEMPDIR", - NULL + "" }; - for (const char** tmp = s_tmp; *tmp != NULL; ++tmp) + for (const StringView* tmp = s_tmp; !tmp->isEmpty(); ++tmp) { uint32_t len = *_inOutSize; *_out = '\0'; - bool ok = getEnv(*tmp, FileInfo::Directory, _out, &len); + bool ok = getEnv(_out, &len, *tmp, FileInfo::Directory); if (ok && len != 0 @@ -275,6 +282,14 @@ namespace bx return *this; } + void FilePath::clear() + { + if (!isEmpty() ) + { + set(""); + } + } + void FilePath::set(Dir::Enum _dir) { char tmp[kMaxFilePath]; @@ -326,37 +341,37 @@ namespace bx return m_filePath; } - const StringView FilePath::getPath() const + StringView FilePath::getPath() const { - const char* end = strRFind(m_filePath, '/'); - if (NULL != end) + StringView end = strRFind(m_filePath, '/'); + if (!end.isEmpty() ) { - return StringView(m_filePath, end+1); + return StringView(m_filePath, end.getPtr()+1); } return StringView(); } - const StringView FilePath::getFileName() const + StringView FilePath::getFileName() const { - const char* fileName = strRFind(m_filePath, '/'); - if (NULL != fileName) + StringView fileName = strRFind(m_filePath, '/'); + if (!fileName.isEmpty() ) { - return StringView(fileName+1); + return StringView(fileName.getPtr()+1); } return get(); } - const StringView FilePath::getBaseName() const + StringView FilePath::getBaseName() const { const StringView fileName = getFileName(); if (!fileName.isEmpty() ) { - const char* ext = strFind(fileName, '.'); - if (ext != NULL) + StringView ext = strFind(fileName, '.'); + if (!ext.isEmpty() ) { - return StringView(fileName.getPtr(), ext); + return StringView(fileName.getPtr(), ext.getPtr() ); } return fileName; @@ -365,13 +380,12 @@ namespace bx return StringView(); } - const StringView FilePath::getExt() const + StringView FilePath::getExt() const { const StringView fileName = getFileName(); if (!fileName.isEmpty() ) { - const char* ext = strFind(fileName, '.'); - return StringView(ext); + return strFind(fileName, '.'); } return StringView(); @@ -384,6 +398,11 @@ namespace bx ; } + bool FilePath::isEmpty() const + { + return 0 == strCmp(m_filePath, "."); + } + bool make(const FilePath& _filePath, Error* _err) { BX_ERROR_SCOPE(_err); @@ -397,6 +416,9 @@ namespace bx int32_t result = ::_mkdir(_filePath.get() ); #elif BX_CRT_MINGW int32_t result = ::mkdir(_filePath.get()); +#elif BX_CRT_NONE + BX_UNUSED(_filePath); + int32_t result = -1; #else int32_t result = ::mkdir(_filePath.get(), 0700); #endif // BX_CRT_MSVC @@ -432,13 +454,13 @@ namespace bx return false; } - const StringView dir = strRTrim(_filePath.get(), "/"); - const char* slash = strRFind(dir, '/'); + const StringView dir = strRTrim(_filePath.get(), "/"); + const StringView slash = strRFind(dir, '/'); - if (NULL != slash - && slash - dir.getPtr() > 1) + if (!slash.isEmpty() + && slash.getPtr() - dir.getPtr() > 1) { - if (!makeAll(StringView(dir.getPtr(), slash), _err) ) + if (!makeAll(StringView(dir.getPtr(), slash.getPtr() ), _err) ) { return false; } @@ -471,6 +493,9 @@ namespace bx result = ::remove(_filePath.get() ); } } +#elif BX_CRT_NONE + BX_UNUSED(_filePath); + int32_t result = -1; #else int32_t result = ::remove(_filePath.get() ); #endif // BX_CRT_MSVC @@ -509,7 +534,12 @@ namespace bx return false; } -#if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX || BX_PLATFORM_OSX +#if BX_CRT_NONE + BX_UNUSED(_filePath); + return false; +#elif BX_PLATFORM_WINDOWS \ + || BX_PLATFORM_LINUX \ + || BX_PLATFORM_OSX DIR* dir = opendir(_filePath.get() ); if (NULL == dir) { @@ -535,7 +565,7 @@ namespace bx } closedir(dir); -#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX || BX_PLATFORM_OSX +#endif // !BX_CRT_NONE return remove(_filePath, _err); } diff --git a/3rdparty/bx/src/hash.cpp b/3rdparty/bx/src/hash.cpp index 4335443f245..7ae5e39cc80 100644 --- a/3rdparty/bx/src/hash.cpp +++ b/3rdparty/bx/src/hash.cpp @@ -1,6 +1,6 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. - * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "bx_p.h" diff --git a/3rdparty/bx/src/math.cpp b/3rdparty/bx/src/math.cpp index 8327570e936..ba0676e96bf 100644 --- a/3rdparty/bx/src/math.cpp +++ b/3rdparty/bx/src/math.cpp @@ -1,152 +1,302 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "bx_p.h" #include - -#include +#include namespace bx { - const float kPi = 3.1415926535897932384626433832795f; - const float kPi2 = 6.2831853071795864769252867665590f; - const float kInvPi = 1.0f/kPi; - const float kPiHalf = 1.5707963267948966192313216916398f; - const float kSqrt2 = 1.4142135623730950488016887242097f; - const float kInvLogNat2 = 1.4426950408889634073599246810019f; -#if BX_COMPILER_MSVC - const float kHuge = float(HUGE_VAL); -#else - const float kHuge = HUGE_VALF; -#endif // BX_COMPILER_MSVC + const float kInfinity = bitsToFloat(UINT32_C(0x7f800000) ); - float fabs(float _a) + namespace { - return ::fabsf(_a); - } + constexpr float kSinC2 = -0.16666667163372039794921875f; + constexpr float kSinC4 = 8.333347737789154052734375e-3f; + constexpr float kSinC6 = -1.9842604524455964565277099609375e-4f; + constexpr float kSinC8 = 2.760012648650445044040679931640625e-6f; + constexpr float kSinC10 = -2.50293279435709337121807038784027099609375e-8f; - float fsin(float _a) - { - return ::sinf(_a); - } + constexpr float kCosC2 = -0.5f; + constexpr float kCosC4 = 4.166664183139801025390625e-2f; + constexpr float kCosC6 = -1.388833043165504932403564453125e-3f; + constexpr float kCosC8 = 2.47562347794882953166961669921875e-5f; + constexpr float kCosC10 = -2.59630184018533327616751194000244140625e-7f; - float fasin(float _a) - { - return ::asinf(_a); - } + } // namespace - float fcos(float _a) + BX_CONST_FUNC float cos(float _a) { - return ::cosf(_a); - } + const float scaled = _a * 2.0f*kInvPi; + const float real = floor(scaled); + const float xx = _a - real * kPiHalf; + const int32_t bits = int32_t(real) & 3; - float ftan(float _a) - { - return ::tanf(_a); - } + float c0, c2, c4, c6, c8, c10; - float facos(float _a) - { - return ::acosf(_a); - } - - float fatan2(float _y, float _x) - { - return ::atan2f(_y, _x); - } - - float fpow(float _a, float _b) - { - return ::powf(_a, _b); - } - - float flog(float _a) - { - return ::logf(_a); - } - - float fsqrt(float _a) - { - return ::sqrtf(_a); - } - - float ffloor(float _f) - { - return ::floorf(_f); - } - - float fceil(float _f) - { - return ::ceilf(_f); - } - - float fmod(float _a, float _b) - { - return ::fmodf(_a, _b); - } - - void mtxLookAtImpl(float* _result, const float* _eye, const float* _view, const float* _up) - { - float up[3] = { 0.0f, 1.0f, 0.0f }; - if (NULL != _up) + if (bits == 0 + || bits == 2) { - up[0] = _up[0]; - up[1] = _up[1]; - up[2] = _up[2]; + c0 = 1.0f; + c2 = kCosC2; + c4 = kCosC4; + c6 = kCosC6; + c8 = kCosC8; + c10 = kCosC10; + } + else + { + c0 = xx; + c2 = kSinC2; + c4 = kSinC4; + c6 = kSinC6; + c8 = kSinC8; + c10 = kSinC10; } - float tmp[4]; - vec3Cross(tmp, up, _view); + const float xsq = square(xx); + const float tmp0 = mad(c10, xsq, c8 ); + const float tmp1 = mad(tmp0, xsq, c6 ); + const float tmp2 = mad(tmp1, xsq, c4 ); + const float tmp3 = mad(tmp2, xsq, c2 ); + const float tmp4 = mad(tmp3, xsq, 1.0); + const float result = tmp4 * c0; - float right[4]; - vec3Norm(right, tmp); + return bits == 1 || bits == 2 + ? -result + : result + ; + } - vec3Cross(up, _view, right); + namespace + { + constexpr float kAcosC0 = 1.5707288f; + constexpr float kAcosC1 = -0.2121144f; + constexpr float kAcosC2 = 0.0742610f; + constexpr float kAcosC3 = -0.0187293f; + + } // namespace + + BX_CONST_FUNC float acos(float _a) + { + const float absa = abs(_a); + const float tmp0 = mad(kAcosC3, absa, kAcosC2); + const float tmp1 = mad(tmp0, absa, kAcosC1); + const float tmp2 = mad(tmp1, absa, kAcosC0); + const float tmp3 = tmp2 * sqrt(1.0f - absa); + const float negate = float(_a < 0.0f); + const float tmp4 = tmp3 - 2.0f*negate*tmp3; + const float result = negate*kPi + tmp4; + + return result; + } + + namespace + { + constexpr float kAtan2C0 = -0.013480470f; + constexpr float kAtan2C1 = 0.057477314f; + constexpr float kAtan2C2 = -0.121239071f; + constexpr float kAtan2C3 = 0.195635925f; + constexpr float kAtan2C4 = -0.332994597f; + constexpr float kAtan2C5 = 0.999995630f; + + } // namespace + + BX_CONST_FUNC float atan2(float _y, float _x) + { + const float ax = abs(_x); + const float ay = abs(_y); + const float maxaxy = max(ax, ay); + const float minaxy = min(ax, ay); + + if (maxaxy == 0.0f) + { + return 0.0f*sign(_y); + } + + const float mxy = minaxy / maxaxy; + const float mxysq = square(mxy); + const float tmp0 = mad(kAtan2C0, mxysq, kAtan2C1); + const float tmp1 = mad(tmp0, mxysq, kAtan2C2); + const float tmp2 = mad(tmp1, mxysq, kAtan2C3); + const float tmp3 = mad(tmp2, mxysq, kAtan2C4); + const float tmp4 = mad(tmp3, mxysq, kAtan2C5); + const float tmp5 = tmp4 * mxy; + const float tmp6 = ay > ax ? kPiHalf - tmp5 : tmp5; + const float tmp7 = _x < 0.0f ? kPi - tmp6 : tmp6; + const float result = sign(_y)*tmp7; + + return result; + } + + BX_CONST_FUNC float ldexp(float _a, int32_t _b) + { + const uint32_t ftob = floatToBits(_a); + const uint32_t masked = uint32_and(ftob, UINT32_C(0xff800000) ); + const uint32_t expsign0 = uint32_sra(masked, 23); + const uint32_t tmp = uint32_iadd(expsign0, _b); + const uint32_t expsign1 = uint32_sll(tmp, 23); + const uint32_t mantissa = uint32_and(ftob, UINT32_C(0x007fffff) ); + const uint32_t bits = uint32_or(mantissa, expsign1); + const float result = bitsToFloat(bits); + + return result; + } + + float frexp(float _a, int32_t* _outExp) + { + const uint32_t ftob = floatToBits(_a); + const uint32_t masked0 = uint32_and(ftob, UINT32_C(0x7f800000) ); + const uint32_t exp0 = uint32_srl(masked0, 23); + const uint32_t masked1 = uint32_and(ftob, UINT32_C(0x807fffff) ); + const uint32_t bits = uint32_or(masked1, UINT32_C(0x3f000000) ); + const float result = bitsToFloat(bits); + + *_outExp = int32_t(exp0 - 0x7e); + + return result; + } + + namespace + { + constexpr float kExpC0 = 1.66666666666666019037e-01f; + constexpr float kExpC1 = -2.77777777770155933842e-03f; + constexpr float kExpC2 = 6.61375632143793436117e-05f; + constexpr float kExpC3 = -1.65339022054652515390e-06f; + constexpr float kExpC4 = 4.13813679705723846039e-08f; + + } // namespace + + BX_CONST_FUNC float exp(float _a) + { + if (abs(_a) <= kNearZero) + { + return _a + 1.0f; + } + + const float kk = round(_a*kInvLogNat2); + const float hi = _a - kk*kLogNat2Hi; + const float lo = kk*kLogNat2Lo; + const float hml = hi - lo; + const float hmlsq = square(hml); + const float tmp0 = mad(kExpC4, hmlsq, kExpC3); + const float tmp1 = mad(tmp0, hmlsq, kExpC2); + const float tmp2 = mad(tmp1, hmlsq, kExpC1); + const float tmp3 = mad(tmp2, hmlsq, kExpC0); + const float tmp4 = hml - hmlsq * tmp3; + const float tmp5 = hml*tmp4/(2.0f-tmp4); + const float tmp6 = 1.0f - ( (lo - tmp5) - hi); + const float result = ldexp(tmp6, int32_t(kk) ); + + return result; + } + + namespace + { + constexpr float kLogC0 = 6.666666666666735130e-01f; + constexpr float kLogC1 = 3.999999999940941908e-01f; + constexpr float kLogC2 = 2.857142874366239149e-01f; + constexpr float kLogC3 = 2.222219843214978396e-01f; + constexpr float kLogC4 = 1.818357216161805012e-01f; + constexpr float kLogC5 = 1.531383769920937332e-01f; + constexpr float kLogC6 = 1.479819860511658591e-01f; + + } // namespace + + BX_CONST_FUNC float log(float _a) + { + int32_t exp; + float ff = frexp(_a, &exp); + if (ff < kSqrt2*0.5f) + { + ff *= 2.0f; + --exp; + } + + ff -= 1.0f; + const float kk = float(exp); + const float hi = kk*kLogNat2Hi; + const float lo = kk*kLogNat2Lo; + const float ss = ff / (2.0f + ff); + const float s2 = square(ss); + const float s4 = square(s2); + + const float tmp0 = mad(kLogC6, s4, kLogC4); + const float tmp1 = mad(tmp0, s4, kLogC2); + const float tmp2 = mad(tmp1, s4, kLogC0); + const float t1 = s2*tmp2; + + const float tmp3 = mad(kLogC5, s4, kLogC3); + const float tmp4 = mad(tmp3, s4, kLogC1); + const float t2 = s4*tmp4; + + const float t12 = t1 + t2; + const float hfsq = 0.5f*square(ff); + const float result = hi - ( (hfsq - (ss*(hfsq+t12) + lo) ) - ff); + + return result; + } + + BX_CONST_FUNC float floor(float _a) + { + if (_a < 0.0f) + { + const float fr = fract(-_a); + const float result = -_a - fr; + + return -(0.0f != fr + ? result + 1.0f + : result) + ; + } + + return _a - fract(_a); + } + + static void mtxLookAtImpl(float* _result, const Vec3& _eye, const Vec3& _view, const Vec3& _up) + { + const Vec3 uxv = cross(_up, _view); + const Vec3 right = normalize(uxv); + const Vec3 up = cross(_view, right); memSet(_result, 0, sizeof(float)*16); - _result[ 0] = right[0]; - _result[ 1] = up[0]; - _result[ 2] = _view[0]; + _result[ 0] = right.x; + _result[ 1] = up.x; + _result[ 2] = _view.x; - _result[ 4] = right[1]; - _result[ 5] = up[1]; - _result[ 6] = _view[1]; + _result[ 4] = right.y; + _result[ 5] = up.y; + _result[ 6] = _view.y; - _result[ 8] = right[2]; - _result[ 9] = up[2]; - _result[10] = _view[2]; + _result[ 8] = right.z; + _result[ 9] = up.z; + _result[10] = _view.z; - _result[12] = -vec3Dot(right, _eye); - _result[13] = -vec3Dot(up, _eye); - _result[14] = -vec3Dot(_view, _eye); + _result[12] = -dot(right, _eye); + _result[13] = -dot(up, _eye); + _result[14] = -dot(_view, _eye); _result[15] = 1.0f; } - void mtxLookAtLh(float* _result, const float* _eye, const float* _at, const float* _up) + void mtxLookAtLh(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up) { - float tmp[4]; - vec3Sub(tmp, _at, _eye); - - float view[4]; - vec3Norm(view, tmp); + const Vec3 tmp = sub(_at, _eye); + const Vec3 view = normalize(tmp); mtxLookAtImpl(_result, _eye, view, _up); } - void mtxLookAtRh(float* _result, const float* _eye, const float* _at, const float* _up) + void mtxLookAtRh(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up) { - float tmp[4]; - vec3Sub(tmp, _eye, _at); - - float view[4]; - vec3Norm(view, tmp); + const Vec3 tmp = sub(_eye, _at); + const Vec3 view = normalize(tmp); mtxLookAtImpl(_result, _eye, view, _up); } - void mtxLookAt(float* _result, const float* _eye, const float* _at, const float* _up) + void mtxLookAt(float* _result, const Vec3& _eye, const Vec3& _at, const Vec3& _up) { mtxLookAtLh(_result, _eye, _at, _up); } @@ -189,7 +339,7 @@ namespace bx template void mtxProjImpl(float* _result, float _fovy, float _aspect, float _near, float _far, bool _oglNdc) { - const float height = 1.0f/ftan(toRad(_fovy)*0.5f); + const float height = 1.0f/tan(toRad(_fovy)*0.5f); const float width = height * 1.0f/_aspect; mtxProjXYWH(_result, 0.0f, 0.0f, width, height, _near, _far, _oglNdc); } @@ -286,7 +436,7 @@ namespace bx template void mtxProjInfImpl(float* _result, float _fovy, float _aspect, float _near, bool _oglNdc) { - const float height = 1.0f/ftan(toRad(_fovy)*0.5f); + const float height = 1.0f/tan(toRad(_fovy)*0.5f); const float width = height * 1.0f/_aspect; mtxProjInfXYWH(_result, 0.0f, 0.0f, width, height, _near, _oglNdc); } @@ -406,8 +556,8 @@ namespace bx void mtxRotateX(float* _result, float _ax) { - const float sx = fsin(_ax); - const float cx = fcos(_ax); + const float sx = sin(_ax); + const float cx = cos(_ax); memSet(_result, 0, sizeof(float)*16); _result[ 0] = 1.0f; @@ -420,8 +570,8 @@ namespace bx void mtxRotateY(float* _result, float _ay) { - const float sy = fsin(_ay); - const float cy = fcos(_ay); + const float sy = sin(_ay); + const float cy = cos(_ay); memSet(_result, 0, sizeof(float)*16); _result[ 0] = cy; @@ -434,8 +584,8 @@ namespace bx void mtxRotateZ(float* _result, float _az) { - const float sz = fsin(_az); - const float cz = fcos(_az); + const float sz = sin(_az); + const float cz = cos(_az); memSet(_result, 0, sizeof(float)*16); _result[ 0] = cz; @@ -448,10 +598,10 @@ namespace bx void mtxRotateXY(float* _result, float _ax, float _ay) { - const float sx = fsin(_ax); - const float cx = fcos(_ax); - const float sy = fsin(_ay); - const float cy = fcos(_ay); + const float sx = sin(_ax); + const float cx = cos(_ax); + const float sy = sin(_ay); + const float cy = cos(_ay); memSet(_result, 0, sizeof(float)*16); _result[ 0] = cy; @@ -467,12 +617,12 @@ namespace bx void mtxRotateXYZ(float* _result, float _ax, float _ay, float _az) { - const float sx = fsin(_ax); - const float cx = fcos(_ax); - const float sy = fsin(_ay); - const float cy = fcos(_ay); - const float sz = fsin(_az); - const float cz = fcos(_az); + const float sx = sin(_ax); + const float cx = cos(_ax); + const float sy = sin(_ay); + const float cy = cos(_ay); + const float sz = sin(_az); + const float cz = cos(_az); memSet(_result, 0, sizeof(float)*16); _result[ 0] = cy*cz; @@ -489,12 +639,12 @@ namespace bx void mtxRotateZYX(float* _result, float _ax, float _ay, float _az) { - const float sx = fsin(_ax); - const float cx = fcos(_ax); - const float sy = fsin(_ay); - const float cy = fcos(_ay); - const float sz = fsin(_az); - const float cz = fcos(_az); + const float sx = sin(_ax); + const float cx = cos(_ax); + const float sy = sin(_ay); + const float cy = cos(_ay); + const float sz = sin(_az); + const float cz = cos(_az); memSet(_result, 0, sizeof(float)*16); _result[ 0] = cy*cz; @@ -511,12 +661,12 @@ namespace bx void mtxSRT(float* _result, float _sx, float _sy, float _sz, float _ax, float _ay, float _az, float _tx, float _ty, float _tz) { - const float sx = fsin(_ax); - const float cx = fcos(_ax); - const float sy = fsin(_ay); - const float cy = fcos(_ay); - const float sz = fsin(_az); - const float cz = fcos(_az); + const float sx = sin(_ax); + const float cx = cos(_ax); + const float sy = sin(_ay); + const float cy = cos(_ay); + const float sz = sin(_az); + const float cz = cos(_az); const float sxsz = sx*sz; const float cycz = cy*cz; @@ -704,24 +854,24 @@ namespace bx const float gg = _rgb[1]; const float bb = _rgb[2]; - const float s0 = fstep(bb, gg); + const float s0 = step(bb, gg); - const float px = flerp(bb, gg, s0); - const float py = flerp(gg, bb, s0); - const float pz = flerp(-1.0f, 0.0f, s0); - const float pw = flerp(2.0f/3.0f, -1.0f/3.0f, s0); + const float px = lerp(bb, gg, s0); + const float py = lerp(gg, bb, s0); + const float pz = lerp(-1.0f, 0.0f, s0); + const float pw = lerp(2.0f/3.0f, -1.0f/3.0f, s0); - const float s1 = fstep(px, rr); + const float s1 = step(px, rr); - const float qx = flerp(px, rr, s1); + const float qx = lerp(px, rr, s1); const float qy = py; - const float qz = flerp(pw, pz, s1); - const float qw = flerp(rr, px, s1); + const float qz = lerp(pw, pz, s1); + const float qw = lerp(rr, px, s1); - const float dd = qx - fmin(qw, qy); + const float dd = qx - min(qw, qy); const float ee = 1.0e-10f; - _hsv[0] = fabs(qz + (qw - qy) / (6.0f * dd + ee) ); + _hsv[0] = abs(qz + (qw - qy) / (6.0f * dd + ee) ); _hsv[1] = dd / (qx + ee); _hsv[2] = qx; } @@ -732,13 +882,13 @@ namespace bx const float ss = _hsv[1]; const float vv = _hsv[2]; - const float px = fabs(ffract(hh + 1.0f ) * 6.0f - 3.0f); - const float py = fabs(ffract(hh + 2.0f/3.0f) * 6.0f - 3.0f); - const float pz = fabs(ffract(hh + 1.0f/3.0f) * 6.0f - 3.0f); + const float px = abs(fract(hh + 1.0f ) * 6.0f - 3.0f); + const float py = abs(fract(hh + 2.0f/3.0f) * 6.0f - 3.0f); + const float pz = abs(fract(hh + 1.0f/3.0f) * 6.0f - 3.0f); - _rgb[0] = vv * flerp(1.0f, fsaturate(px - 1.0f), ss); - _rgb[1] = vv * flerp(1.0f, fsaturate(py - 1.0f), ss); - _rgb[2] = vv * flerp(1.0f, fsaturate(pz - 1.0f), ss); + _rgb[0] = vv * lerp(1.0f, clamp(px - 1.0f, 0.0f, 1.0f), ss); + _rgb[1] = vv * lerp(1.0f, clamp(py - 1.0f, 0.0f, 1.0f), ss); + _rgb[2] = vv * lerp(1.0f, clamp(pz - 1.0f, 0.0f, 1.0f), ss); } } // namespace bx diff --git a/3rdparty/bx/src/mutex.cpp b/3rdparty/bx/src/mutex.cpp index 74e3c14cf28..27c6b63b709 100644 --- a/3rdparty/bx/src/mutex.cpp +++ b/3rdparty/bx/src/mutex.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,7 +8,10 @@ #if BX_CONFIG_SUPPORTS_THREADING -#if BX_PLATFORM_ANDROID \ +#if BX_CRT_NONE +# include +# include "crt0.h" +#elif BX_PLATFORM_ANDROID \ || BX_PLATFORM_LINUX \ || BX_PLATFORM_IOS \ || BX_PLATFORM_OSX \ @@ -24,7 +27,57 @@ namespace bx { -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + struct State + { + enum Enum + { + Unlocked, + Locked, + Contested, + }; + }; + + Mutex::Mutex() + { + BX_STATIC_ASSERT(sizeof(int32_t) <= sizeof(m_internal) ); + + uint32_t* futex = (uint32_t*)m_internal; + *futex = State::Unlocked; + } + + Mutex::~Mutex() + { + } + + void Mutex::lock() + { + uint32_t* futex = (uint32_t*)m_internal; + + if (State::Unlocked == bx::atomicCompareAndSwap(futex, State::Unlocked, State::Locked) ) + { + return; + } + + while (State::Unlocked != bx::atomicCompareAndSwap(futex, State::Locked, State::Contested) ) + { + crt0::futexWait(futex, State::Contested); + } + } + + void Mutex::unlock() + { + uint32_t* futex = (uint32_t*)m_internal; + + if (State::Contested == bx::atomicCompareAndSwap(futex, State::Locked, State::Unlocked) ) + { + crt0::futexWake(futex, State::Locked); + } + } + +#else + +# if BX_PLATFORM_WINDOWS \ || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT typedef CRITICAL_SECTION pthread_mutex_t; @@ -49,11 +102,11 @@ namespace bx inline int pthread_mutex_init(pthread_mutex_t* _mutex, pthread_mutexattr_t* /*_attr*/) { -#if BX_PLATFORM_WINRT +# if BX_PLATFORM_WINRT InitializeCriticalSectionEx(_mutex, 4000, 0); // docs recommend 4000 spincount as sane default -#else +# else InitializeCriticalSection(_mutex); -#endif // BX_PLATFORM_ +# endif // BX_PLATFORM_ return 0; } @@ -62,7 +115,7 @@ namespace bx DeleteCriticalSection(_mutex); return 0; } -#endif // BX_PLATFORM_ +# endif // BX_PLATFORM_ Mutex::Mutex() { @@ -70,13 +123,13 @@ namespace bx pthread_mutexattr_t attr; -#if BX_PLATFORM_WINDOWS \ +# if BX_PLATFORM_WINDOWS \ || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT -#else +# else pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); -#endif // BX_PLATFORM_ +# endif // BX_PLATFORM_ pthread_mutex_t* handle = (pthread_mutex_t*)m_internal; pthread_mutex_init(handle, &attr); @@ -99,6 +152,7 @@ namespace bx pthread_mutex_t* handle = (pthread_mutex_t*)m_internal; pthread_mutex_unlock(handle); } +#endif // BX_CRT_NONE } // namespace bx diff --git a/3rdparty/bx/src/os.cpp b/3rdparty/bx/src/os.cpp index d13ae7859c3..0e925bb2f90 100644 --- a/3rdparty/bx/src/os.cpp +++ b/3rdparty/bx/src/os.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,10 +8,6 @@ #include #include -#if !BX_PLATFORM_NONE - -#include - #if BX_CRT_MSVC # include #else @@ -51,11 +47,13 @@ # elif BX_PLATFORM_LINUX \ || BX_PLATFORM_RPI \ || BX_PLATFORM_STEAMLINK +# include // fopen # include // syscall # include # elif BX_PLATFORM_OSX # include // mach_task_basic_info # elif BX_PLATFORM_HURD +# include // fopen # include // pthread_self # elif BX_PLATFORM_ANDROID # include "debug.h" // getTid is not implemented... @@ -70,7 +68,8 @@ namespace bx #if BX_PLATFORM_WINDOWS ::Sleep(_ms); #elif BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE BX_UNUSED(_ms); debugOutput("sleep is not implemented"); debugBreak(); #else @@ -85,7 +84,8 @@ namespace bx #if BX_PLATFORM_WINDOWS ::SwitchToThread(); #elif BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE debugOutput("yield is not implemented"); debugBreak(); #else ::sched_yield(); @@ -171,18 +171,19 @@ namespace bx #endif // BX_PLATFORM_* } - void* dlopen(const char* _filePath) + void* dlopen(const FilePath& _filePath) { #if BX_PLATFORM_WINDOWS - return (void*)::LoadLibraryA(_filePath); + return (void*)::LoadLibraryA(_filePath.get() ); #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE BX_UNUSED(_filePath); return NULL; #else - return ::dlopen(_filePath, RTLD_LOCAL|RTLD_LAZY); + return ::dlopen(_filePath.get(), RTLD_LOCAL|RTLD_LAZY); #endif // BX_PLATFORM_ } @@ -193,42 +194,53 @@ namespace bx #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE BX_UNUSED(_handle); #else ::dlclose(_handle); #endif // BX_PLATFORM_ } - void* dlsym(void* _handle, const char* _symbol) + void* dlsym(void* _handle, const StringView& _symbol) { + const int32_t symbolMax = _symbol.getLength()+1; + char* symbol = (char*)alloca(symbolMax); + bx::strCopy(symbol, symbolMax, _symbol); + #if BX_PLATFORM_WINDOWS - return (void*)::GetProcAddress( (HMODULE)_handle, _symbol); + return (void*)::GetProcAddress( (HMODULE)_handle, symbol); #elif BX_PLATFORM_EMSCRIPTEN \ || BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT - BX_UNUSED(_handle, _symbol); + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE + BX_UNUSED(_handle, symbol); return NULL; #else - return ::dlsym(_handle, _symbol); + return ::dlsym(_handle, symbol); #endif // BX_PLATFORM_ } - bool getenv(const char* _name, char* _out, uint32_t* _inOutSize) + bool getEnv(char* _out, uint32_t* _inOutSize, const StringView& _name) { + const int32_t nameMax = _name.getLength()+1; + char* name = (char*)alloca(nameMax); + bx::strCopy(name, nameMax, _name); + #if BX_PLATFORM_WINDOWS - DWORD len = ::GetEnvironmentVariableA(_name, _out, *_inOutSize); + DWORD len = ::GetEnvironmentVariableA(name, _out, *_inOutSize); bool result = len != 0 && len < *_inOutSize; *_inOutSize = len; return result; #elif BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT - BX_UNUSED(_name, _out, _inOutSize); + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE + BX_UNUSED(name, _out, _inOutSize); return false; #else - const char* ptr = ::getenv(_name); + const char* ptr = ::getenv(name); uint32_t len = 0; bool result = false; if (NULL != ptr) @@ -247,29 +259,36 @@ namespace bx #endif // BX_PLATFORM_ } - void setenv(const char* _name, const char* _value) + void setEnv(const StringView& _name, const StringView& _value) { -#if BX_PLATFORM_WINDOWS - ::SetEnvironmentVariableA(_name, _value); -#elif BX_PLATFORM_PS4 \ - || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT - BX_UNUSED(_name, _value); -#else - ::setenv(_name, _value, 1); -#endif // BX_PLATFORM_ - } + const int32_t nameMax = _name.getLength()+1; + char* name = (char*)alloca(nameMax); + bx::strCopy(name, nameMax, _name); + + char* value = NULL; + if (!_value.isEmpty() ) + { + int32_t valueMax = _value.getLength()+1; + value = (char*)alloca(valueMax); + bx::strCopy(value, valueMax, _value); + } - void unsetenv(const char* _name) - { #if BX_PLATFORM_WINDOWS - ::SetEnvironmentVariableA(_name, NULL); + ::SetEnvironmentVariableA(name, value); #elif BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT - BX_UNUSED(_name); + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE + BX_UNUSED(name, value); #else - ::unsetenv(_name); + if (NULL != value) + { + ::setenv(name, value, 1); + } + else + { + ::unsetenv(name); + } #endif // BX_PLATFORM_ } @@ -277,7 +296,8 @@ namespace bx { #if BX_PLATFORM_PS4 \ || BX_PLATFORM_XBOXONE \ - || BX_PLATFORM_WINRT + || BX_PLATFORM_WINRT \ + || BX_CRT_NONE BX_UNUSED(_path); return -1; #elif BX_CRT_MSVC @@ -349,5 +369,3 @@ namespace bx } } // namespace bx - -#endif // !BX_PLATFORM_NONE diff --git a/3rdparty/bx/src/process.cpp b/3rdparty/bx/src/process.cpp index b748260eece..90d663b3f5a 100644 --- a/3rdparty/bx/src/process.cpp +++ b/3rdparty/bx/src/process.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/src/semaphore.cpp b/3rdparty/bx/src/semaphore.cpp index f321240be18..3663fe767b5 100644 --- a/3rdparty/bx/src/semaphore.cpp +++ b/3rdparty/bx/src/semaphore.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,8 +8,9 @@ #if BX_CONFIG_SUPPORTS_THREADING -#if BX_PLATFORM_OSX \ -|| BX_PLATFORM_IOS +#if BX_CRT_NONE +#elif BX_PLATFORM_OSX \ + || BX_PLATFORM_IOS # include #elif BX_PLATFORM_POSIX # include @@ -30,8 +31,10 @@ namespace bx { struct SemaphoreInternal { -#if BX_PLATFORM_OSX \ -|| BX_PLATFORM_IOS +#if BX_CRT_NONE + +#elif BX_PLATFORM_OSX \ + || BX_PLATFORM_IOS dispatch_semaphore_t m_handle; #elif BX_PLATFORM_POSIX pthread_mutex_t m_mutex; @@ -44,8 +47,28 @@ namespace bx #endif // BX_PLATFORM_ }; -#if BX_PLATFORM_OSX \ -|| BX_PLATFORM_IOS +#if BX_CRT_NONE + Semaphore::Semaphore() + { + BX_STATIC_ASSERT(sizeof(SemaphoreInternal) <= sizeof(m_internal) ); + } + + Semaphore::~Semaphore() + { + } + + void Semaphore::post(uint32_t _count) + { + BX_UNUSED(_count); + } + + bool Semaphore::wait(int32_t _msecs) + { + BX_UNUSED(_msecs); + return false; + } +#elif BX_PLATFORM_OSX \ + || BX_PLATFORM_IOS Semaphore::Semaphore() { @@ -78,7 +101,7 @@ namespace bx dispatch_time_t dt = 0 > _msecs ? DISPATCH_TIME_FOREVER - : dispatch_time(DISPATCH_TIME_NOW, _msecs*1000000) + : dispatch_time(DISPATCH_TIME_NOW, int64_t(_msecs)*1000000) ; return !dispatch_semaphore_wait(si->m_handle, dt); } @@ -98,13 +121,13 @@ namespace bx void toTimespecMs(timespec& _ts, int32_t _msecs) { - toTimespecNs(_ts, _msecs*1000000); + toTimespecNs(_ts, uint64_t(_msecs)*1000000); } void add(timespec& _ts, int32_t _msecs) { uint64_t ns = toNs(_ts); - toTimespecNs(_ts, ns + _msecs*1000000); + toTimespecNs(_ts, ns + uint64_t(_msecs)*1000000); } Semaphore::Semaphore() diff --git a/3rdparty/bx/src/settings.cpp b/3rdparty/bx/src/settings.cpp index 52b8d606c2c..e09e11f687f 100644 --- a/3rdparty/bx/src/settings.cpp +++ b/3rdparty/bx/src/settings.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -59,12 +59,11 @@ void Settings::load(const void* _data, uint32_t _len) } else { - BX_UNUSED(_len); - m_ini = ini_load( (const char*)_data, m_allocator); + m_ini = ini_load( (const char*)_data, _len, m_allocator); } } -const char* Settings::get(const StringView& _name) const +StringView Settings::get(const StringView& _name) const { ini_t* ini = INI_T(m_ini); @@ -85,7 +84,7 @@ const char* Settings::get(const StringView& _name) const int32_t property = ini_find_property(ini, section, fileName.getPtr(), fileName.getLength() ); if (INI_NOT_FOUND == property) { - return NULL; + return StringView(); } return ini_property_value(ini, section, property); diff --git a/3rdparty/bx/src/sort.cpp b/3rdparty/bx/src/sort.cpp index 3dc1069f56e..515b33f24f1 100644 --- a/3rdparty/bx/src/sort.cpp +++ b/3rdparty/bx/src/sort.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -27,12 +27,12 @@ namespace bx int32_t result = _fn(&data[ii*_stride], _pivot); if (0 > result) { - xchg(&data[ll*_stride], &data[ii*_stride], _stride); + swap(&data[ll*_stride], &data[ii*_stride], _stride); ++ll; } else if (0 == result) { - xchg(&data[gg*_stride], &data[ii*_stride], _stride); + swap(&data[gg*_stride], &data[ii*_stride], _stride); ++gg; ++ii; } diff --git a/3rdparty/bx/src/string.cpp b/3rdparty/bx/src/string.cpp index 5fe272548d0..7710028ae6d 100644 --- a/3rdparty/bx/src/string.cpp +++ b/3rdparty/bx/src/string.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -9,11 +9,6 @@ #include #include -#if !BX_CRT_NONE -# include // vsnprintf, vsnwprintf -# include // vswprintf -#endif // !BX_CRT_NONE - namespace bx { inline bool isInRange(char _ch, char _from, char _to) @@ -54,7 +49,18 @@ namespace bx bool isAlphaNum(char _ch) { - return isAlpha(_ch) || isNumeric(_ch); + return false + || isAlpha(_ch) + || isNumeric(_ch) + ; + } + + bool isHexNum(char _ch) + { + return false + || isInRange(toLower(_ch), 'a', 'f') + || isNumeric(_ch) + ; } bool isPrint(char _ch) @@ -110,6 +116,11 @@ namespace bx return isCharTest(_str); } + bool isHexNum(const StringView& _str) + { + return isCharTest(_str); + } + bool isPrint(const StringView& _str) { return isCharTest(_str); @@ -346,9 +357,15 @@ namespace bx return strFindUnsafe(_str, strLen(_str, _max), _ch); } - const char* strFind(const StringView& _str, char _ch) + StringView strFind(const StringView& _str, char _ch) { - return strFind(_str.getPtr(), _str.getLength(), _ch); + const char* ptr = strFindUnsafe(_str.getPtr(), _str.getLength(), _ch); + if (NULL == ptr) + { + return StringView(_str.getTerm(), _str.getTerm() ); + } + + return StringView(ptr, ptr+1); } inline const char* strRFindUnsafe(const char* _str, int32_t _len, char _ch) @@ -364,14 +381,15 @@ namespace bx return NULL; } - inline const char* strRFind(const char* _str, int32_t _max, char _ch) + StringView strRFind(const StringView& _str, char _ch) { - return strRFindUnsafe(_str, strLen(_str, _max), _ch); - } + const char* ptr = strRFindUnsafe(_str.getPtr(), _str.getLength(), _ch); + if (NULL == ptr) + { + return StringView(_str.getTerm(), _str.getTerm() ); + } - const char* strRFind(const StringView& _str, char _ch) - { - return strRFind(_str.getPtr(), _str.getLength(), _ch); + return StringView(ptr, ptr+1); } template @@ -379,8 +397,8 @@ namespace bx { const char* ptr = _str; - int32_t stringLen = strLen(_str, _strMax); - const int32_t findLen = strLen(_find, _findMax); + int32_t stringLen = _strMax; + const int32_t findLen = _findMax; for (; stringLen >= findLen; ++ptr, --stringLen) { @@ -415,24 +433,42 @@ namespace bx return NULL; } - const char* strFind(const StringView& _str, const StringView& _find, int32_t _num) + StringView strFind(const StringView& _str, const StringView& _find, int32_t _num) { - return strFind( + int32_t len = min(_find.getLength(), _num); + + const char* ptr = strFind( _str.getPtr() , _str.getLength() , _find.getPtr() - , min(_find.getLength(), _num) + , len ); + + if (NULL == ptr) + { + return StringView(_str.getTerm(), _str.getTerm() ); + } + + return StringView(ptr, len); } - const char* strFindI(const StringView& _str, const StringView& _find, int32_t _num) + StringView strFindI(const StringView& _str, const StringView& _find, int32_t _num) { - return strFind( + int32_t len = min(_find.getLength(), _num); + + const char* ptr = strFind( _str.getPtr() , _str.getLength() , _find.getPtr() - , min(_find.getLength(), _num) + , len ); + + if (NULL == ptr) + { + return StringView(_str.getTerm(), _str.getTerm() ); + } + + return StringView(ptr, len); } StringView strLTrim(const StringView& _str, const StringView& _chars) @@ -449,29 +485,53 @@ namespace bx } } - return StringView(); + return _str; + } + + StringView strLTrimSpace(const StringView& _str) + { + for (const char* ptr = _str.getPtr(), *term = _str.getTerm(); ptr != term; ++ptr) + { + if (!isSpace(*ptr) ) + { + return StringView(ptr, term); + } + } + + return StringView(_str.getTerm(), _str.getTerm() ); + } + + StringView strLTrimNonSpace(const StringView& _str) + { + for (const char* ptr = _str.getPtr(), *term = _str.getTerm(); ptr != term; ++ptr) + { + if (isSpace(*ptr) ) + { + return StringView(ptr, term); + } + } + + return StringView(_str.getTerm(), _str.getTerm() ); } StringView strRTrim(const StringView& _str, const StringView& _chars) { - if (_str.isEmpty() ) + if (!_str.isEmpty() ) { - return StringView(); - } + const char* ptr = _str.getPtr(); + const char* chars = _chars.getPtr(); + const uint32_t charsLen = _chars.getLength(); - const char* ptr = _str.getPtr(); - const char* chars = _chars.getPtr(); - const uint32_t charsLen = _chars.getLength(); - - for (int32_t len = _str.getLength(), ii = len-1; 0 <= ii; --ii) - { - if (NULL == strFindUnsafe(chars, charsLen, ptr[ii]) ) + for (int32_t len = _str.getLength(), ii = len - 1; 0 <= ii; --ii) { - return StringView(ptr, ii+1); + if (NULL == strFindUnsafe(chars, charsLen, ptr[ii])) + { + return StringView(ptr, ii + 1); + } } } - return StringView(); + return _str; } StringView strTrim(const StringView& _str, const StringView& _chars) @@ -479,92 +539,117 @@ namespace bx return strLTrim(strRTrim(_str, _chars), _chars); } - const char* strnl(const char* _str) + constexpr uint32_t kFindStep = 1024; + + StringView strFindNl(const StringView& _str) { - for (; '\0' != *_str; _str += strLen(_str, 1024) ) + StringView str(_str); + + for (; str.getPtr() != _str.getTerm() + ; str = StringView(min(str.getPtr() + kFindStep, _str.getTerm() ), min(str.getPtr() + kFindStep*2, _str.getTerm() ) ) + ) { - const char* eol = strFind(StringView(_str, 1024), "\r\n"); - if (NULL != eol) + StringView eol = strFind(str, "\r\n"); + if (!eol.isEmpty() ) { - return eol + 2; + return StringView(eol.getTerm(), _str.getTerm() ); } - eol = strFind(StringView(_str, 1024), "\n"); - if (NULL != eol) + eol = strFind(str, '\n'); + if (!eol.isEmpty() ) { - return eol + 1; + return StringView(eol.getTerm(), _str.getTerm() ); } } - return _str; + return StringView(_str.getTerm(), _str.getTerm() ); } - const char* streol(const char* _str) + StringView strFindEol(const StringView& _str) { - for (; '\0' != *_str; _str += strLen(_str, 1024) ) + StringView str(_str); + + for (; str.getPtr() != _str.getTerm() + ; str = StringView(min(str.getPtr() + kFindStep, _str.getTerm() ), min(str.getPtr() + kFindStep*2, _str.getTerm() ) ) + ) { - const char* eol = strFind(StringView(_str, 1024), "\r\n"); - if (NULL != eol) + StringView eol = strFind(str, "\r\n"); + if (!eol.isEmpty() ) { - return eol; + return StringView(eol.getPtr(), _str.getTerm() ); } - eol = strFind(StringView(_str, 1024), "\n"); - if (NULL != eol) + eol = strFind(str, '\n'); + if (!eol.isEmpty() ) { - return eol; + return StringView(eol.getPtr(), _str.getTerm() ); } } - return _str; + return StringView(_str.getTerm(), _str.getTerm() ); } - const char* strws(const char* _str) + static const char* strSkipWord(const char* _str, int32_t _max) { - for (; isSpace(*_str); ++_str) {}; - return _str; - } - - const char* strnws(const char* _str) - { - for (; !isSpace(*_str); ++_str) {}; - return _str; - } - - const char* strword(const char* _str) - { - for (char ch = *_str++; isAlphaNum(ch) || '_' == ch; ch = *_str++) {}; + for (char ch = *_str++; 0 < _max && (isAlphaNum(ch) || '_' == ch); ch = *_str++, --_max) {}; return _str-1; } - const char* strmb(const char* _str, char _open, char _close) + StringView strWord(const StringView& _str) { - int count = 0; - for (char ch = *_str++; ch != '\0' && count >= 0; ch = *_str++) + const char* ptr = _str.getPtr(); + const char* term = strSkipWord(ptr, _str.getLength() ); + return StringView(ptr, term); + } + + StringView strFindBlock(const StringView& _str, char _open, char _close) + { + const char* curr = _str.getPtr(); + const char* term = _str.getTerm(); + const char* start = NULL; + + int32_t count = 0; + for (char ch = *curr; curr != term && count >= 0; ch = *(++curr) ) { if (ch == _open) { - count++; + if (0 == count) + { + start = curr; + } + + ++count; } else if (ch == _close) { - count--; + --count; + + if (NULL == start) + { + break; + } + if (0 == count) { - return _str-1; + return StringView(start, curr+1); } } } - return NULL; + return StringView(term, term); } - void eolLF(char* _out, int32_t _size, const char* _str) + StringView normalizeEolLf(char* _out, int32_t _size, const StringView& _str) { + const char* start = _out; + const char* end = _out; + if (0 < _size) { - char* end = _out + _size - 1; - for (char ch = *_str++; ch != '\0' && _out < end; ch = *_str++) + const char* curr = _str.getPtr(); + const char* term = _str.getTerm(); + end = _out + _size; + for (char ch = *curr; curr != term && _out < end; ch = *(++curr) ) { if ('\r' != ch) { @@ -572,26 +657,25 @@ namespace bx } } - *_out = '\0'; + end = _out; } + + return StringView(start, end); } - const char* findIdentifierMatch(const char* _str, const char* _word) + StringView findIdentifierMatch(const StringView& _str, const StringView& _word) { - int32_t len = strLen(_word); - const char* ptr = strFind(_str, _word); - for (; NULL != ptr; ptr = strFind(ptr + len, _word) ) + const int32_t len = _word.getLength(); + StringView ptr = strFind(_str, _word); + for (; !ptr.isEmpty(); ptr = strFind(StringView(ptr.getPtr() + len, _str.getTerm() ), _word) ) { - if (ptr != _str) + char ch = *(ptr.getPtr() - 1); + if (isAlphaNum(ch) || '_' == ch) { - char ch = *(ptr - 1); - if (isAlphaNum(ch) || '_' == ch) - { - continue; - } + continue; } - char ch = ptr[len]; + ch = *(ptr.getPtr() + len); if (isAlphaNum(ch) || '_' == ch) { continue; @@ -600,21 +684,21 @@ namespace bx return ptr; } - return ptr; + return StringView(_str.getTerm(), _str.getTerm() ); } - const char* findIdentifierMatch(const char* _str, const char* _words[]) + StringView findIdentifierMatch(const StringView& _str, const char** _words) { - for (const char* word = *_words; NULL != word; ++_words, word = *_words) + for (StringView word = *_words; !word.isEmpty(); ++_words, word = *_words) { - const char* match = findIdentifierMatch(_str, word); - if (NULL != match) + StringView match = findIdentifierMatch(_str, word); + if (!match.isEmpty() ) { return match; } } - return NULL; + return StringView(_str.getTerm(), _str.getTerm() ); } namespace @@ -624,7 +708,7 @@ namespace bx Param() : width(0) , base(10) - , prec(6) + , prec(INT32_MAX) , fill(' ') , bits(0) , left(false) @@ -635,8 +719,8 @@ namespace bx } int32_t width; - uint32_t base; - uint32_t prec; + int32_t base; + int32_t prec; char fill; uint8_t bits; bool left; @@ -694,7 +778,7 @@ namespace bx static int32_t write(WriterI* _writer, const char* _str, const Param& _param, Error* _err) { - return write(_writer, _str, INT32_MAX, _param, _err); + return write(_writer, _str, _param.prec, _param, _err); } static int32_t write(WriterI* _writer, int32_t _i, const Param& _param, Error* _err) @@ -767,10 +851,11 @@ namespace bx const char* dot = strFind(str, INT32_MAX, '.'); if (NULL != dot) { + const int32_t prec = INT32_MAX == _param.prec ? 6 : _param.prec; const int32_t precLen = int32_t( dot - + uint32_min(_param.prec + _param.spec, 1) - + _param.prec + + uint32_min(prec + _param.spec, 1) + + prec - str ); if (precLen > len) @@ -802,9 +887,9 @@ namespace bx } } // anonymous namespace - int32_t write(WriterI* _writer, const char* _format, va_list _argList, Error* _err) + int32_t write(WriterI* _writer, const StringView& _format, va_list _argList, Error* _err) { - MemoryReader reader(_format, uint32_t(strLen(_format) ) ); + MemoryReader reader(_format.getPtr(), _format.getLength() ); int32_t size = 0; @@ -1014,11 +1099,18 @@ namespace bx } } - size += write(_writer, '\0', _err); - return size; } + int32_t write(WriterI* _writer, Error* _err, const StringView* _format, ...) + { + va_list argList; + va_start(argList, _format); + int32_t total = write(_writer, *_format, argList, _err); + va_end(argList); + return total; + } + int32_t write(WriterI* _writer, Error* _err, const char* _format, ...) { va_list argList; @@ -1028,12 +1120,11 @@ namespace bx return total; } - int32_t vsnprintfRef(char* _out, int32_t _max, const char* _format, va_list _argList) + int32_t vsnprintf(char* _out, int32_t _max, const char* _format, va_list _argList) { if (1 < _max) { - StaticMemoryBlockWriter writer(_out, uint32_t(_max-1) ); - _out[_max-1] = '\0'; + StaticMemoryBlockWriter writer(_out, uint32_t(_max) ); Error err; va_list argListCopy; @@ -1043,7 +1134,12 @@ namespace bx if (err.isOk() ) { - return size; + size += write(&writer, '\0', &err); + return size - 1 /* size without '\0' terminator */; + } + else + { + _out[_max-1] = '\0'; } } @@ -1054,31 +1150,7 @@ namespace bx int32_t size = write(&sizer, _format, argListCopy, &err); va_end(argListCopy); - return size - 1 /* size without '\0' terminator */; - } - - int32_t vsnprintf(char* _out, int32_t _max, const char* _format, va_list _argList) - { - va_list argList; - va_copy(argList, _argList); - int32_t total = 0; -#if BX_CRT_NONE - total = vsnprintfRef(_out, _max, _format, argList); -#elif BX_CRT_MSVC - int32_t len = -1; - if (NULL != _out) - { - va_list argListCopy; - va_copy(argListCopy, _argList); - len = ::vsnprintf_s(_out, _max, size_t(-1), _format, argListCopy); - va_end(argListCopy); - } - total = -1 == len ? ::_vscprintf(_format, argList) : len; -#else - total = ::vsnprintf(_out, _max, _format, argList); -#endif // BX_COMPILER_MSVC - va_end(argList); - return total; + return size; } int32_t snprintf(char* _out, int32_t _max, const char* _format, ...) @@ -1090,44 +1162,9 @@ namespace bx return total; } - int32_t vsnwprintf(wchar_t* _out, int32_t _max, const wchar_t* _format, va_list _argList) - { - va_list argList; - va_copy(argList, _argList); - int32_t total = 0; -#if BX_CRT_NONE - BX_UNUSED(_out, _max, _format, argList); -#elif BX_CRT_MSVC - int32_t len = -1; - if (NULL != _out) - { - va_list argListCopy; - va_copy(argListCopy, _argList); - len = ::_vsnwprintf_s(_out, _max, size_t(-1), _format, argListCopy); - va_end(argListCopy); - } - total = -1 == len ? ::_vscwprintf(_format, _argList) : len; -#elif BX_CRT_MINGW - total = ::vsnwprintf(_out, _max, _format, argList); -#else - total = ::vswprintf(_out, _max, _format, argList); -#endif // BX_COMPILER_MSVC - va_end(argList); - return total; - } + static const char s_units[] = { 'B', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' }; - int32_t swnprintf(wchar_t* _out, int32_t _max, const wchar_t* _format, ...) - { - va_list argList; - va_start(argList, _format); - int32_t len = vsnwprintf(_out, _max, _format, argList); - va_end(argList); - return len; - } - - static const char s_units[] = { 'B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' }; - - template + template inline int32_t prettify(char* _out, int32_t _count, uint64_t _value) { uint8_t idx = 0; @@ -1141,7 +1178,7 @@ namespace bx } return snprintf(_out, _count, "%0.2f %c%c%c", value - , s_units[idx] + , fn(s_units[idx]) , idx > 0 ? KiloCh0 : '\0' , KiloCh1 ); @@ -1151,10 +1188,10 @@ namespace bx { if (Units::Kilo == _units) { - return prettify<1000, 'B', '\0'>(_out, _count, _value); + return prettify<1000, 'B', '\0', toNoop>(_out, _count, _value); } - return prettify<1024, 'i', 'B'>(_out, _count, _value); + return prettify<1024, 'i', 'B', toUpper>(_out, _count, _value); } } // namespace bx diff --git a/3rdparty/bx/src/thread.cpp b/3rdparty/bx/src/thread.cpp index fe7f3491dc2..f52e0bdcbf4 100644 --- a/3rdparty/bx/src/thread.cpp +++ b/3rdparty/bx/src/thread.cpp @@ -1,12 +1,16 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "bx_p.h" #include -#if BX_PLATFORM_ANDROID \ +#if BX_CONFIG_SUPPORTS_THREADING + +#if BX_CRT_NONE +# include "crt0.h" +#elif BX_PLATFORM_ANDROID \ || BX_PLATFORM_LINUX \ || BX_PLATFORM_IOS \ || BX_PLATFORM_OSX \ @@ -32,8 +36,6 @@ using namespace Windows::System::Threading; # endif // BX_PLATFORM_WINRT #endif // BX_PLATFORM_ -#if BX_CONFIG_SUPPORTS_THREADING - namespace bx { static AllocatorI* getAllocator() @@ -44,7 +46,10 @@ namespace bx struct ThreadInternal { -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + static int32_t threadFunc(void* _arg); + int32_t m_handle; +#elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_WINRT \ || BX_PLATFORM_XBOXONE static DWORD WINAPI threadFunc(LPVOID _arg); @@ -56,7 +61,14 @@ namespace bx #endif // BX_PLATFORM_ }; -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + int32_t ThreadInternal::threadFunc(void* _arg) + { + Thread* thread = (Thread*)_arg; + int32_t result = thread->entry(); + return result; + } +#elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT DWORD WINAPI ThreadInternal::threadFunc(LPVOID _arg) @@ -90,7 +102,9 @@ namespace bx BX_STATIC_ASSERT(sizeof(ThreadInternal) <= sizeof(m_internal) ); ThreadInternal* ti = (ThreadInternal*)m_internal; -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + ti->m_handle = INT32_MIN; +#elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_WINRT \ || BX_PLATFORM_XBOXONE ti->m_handle = INVALID_HANDLE_VALUE; @@ -118,7 +132,9 @@ namespace bx m_running = true; ThreadInternal* ti = (ThreadInternal*)m_internal; -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + ti->m_handle = crt0::threadCreate(&ti->threadFunc, _userData, m_stackSize, _name); +#elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_XBOXONE ti->m_handle = ::CreateThread(NULL , m_stackSize @@ -170,7 +186,9 @@ namespace bx { BX_CHECK(m_running, "Not running!"); ThreadInternal* ti = (ThreadInternal*)m_internal; -#if BX_PLATFORM_WINDOWS +#if BX_CRT_NONE + crt0::threadJoin(ti->m_handle, NULL); +#elif BX_PLATFORM_WINDOWS WaitForSingleObject(ti->m_handle, INFINITE); GetExitCodeThread(ti->m_handle, (DWORD*)&m_exitCode); CloseHandle(ti->m_handle); @@ -207,18 +225,21 @@ namespace bx { ThreadInternal* ti = (ThreadInternal*)m_internal; BX_UNUSED(ti); -#if BX_PLATFORM_OSX || BX_PLATFORM_IOS +#if BX_CRT_NONE + BX_UNUSED(_name); +#elif BX_PLATFORM_OSX \ + || BX_PLATFORM_IOS pthread_setname_np(_name); #elif (BX_CRT_GLIBC >= 21200) && ! BX_PLATFORM_HURD pthread_setname_np(ti->m_handle, _name); #elif BX_PLATFORM_LINUX prctl(PR_SET_NAME,_name, 0, 0, 0); #elif BX_PLATFORM_BSD -# ifdef __NetBSD__ +# if defined(__NetBSD__) pthread_setname_np(ti->m_handle, "%s", (void*)_name); # else pthread_set_name_np(ti->m_handle, _name); -# endif // __NetBSD__ +# endif // defined(__NetBSD__) #elif BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC # pragma pack(push, 8) struct ThreadName @@ -276,14 +297,42 @@ namespace bx struct TlsDataInternal { -#if BX_PLATFORM_WINDOWS +#if BX_CRT_NONE +#elif BX_PLATFORM_WINDOWS uint32_t m_id; #elif !(BX_PLATFORM_XBOXONE || BX_PLATFORM_WINRT) pthread_key_t m_id; #endif // BX_PLATFORM_* }; -#if BX_PLATFORM_WINDOWS +#if BX_CRT_NONE + TlsData::TlsData() + { + BX_STATIC_ASSERT(sizeof(TlsDataInternal) <= sizeof(m_internal) ); + + TlsDataInternal* ti = (TlsDataInternal*)m_internal; + BX_UNUSED(ti); + } + + TlsData::~TlsData() + { + TlsDataInternal* ti = (TlsDataInternal*)m_internal; + BX_UNUSED(ti); + } + + void* TlsData::get() const + { + return NULL; + } + + void TlsData::set(void* _ptr) + { + BX_UNUSED(_ptr); + + TlsDataInternal* ti = (TlsDataInternal*)m_internal; + BX_UNUSED(ti); + } +#elif BX_PLATFORM_WINDOWS TlsData::TlsData() { BX_STATIC_ASSERT(sizeof(TlsDataInternal) <= sizeof(m_internal) ); diff --git a/3rdparty/bx/src/timer.cpp b/3rdparty/bx/src/timer.cpp index ad3bb1c32cb..8cfebdda7f5 100644 --- a/3rdparty/bx/src/timer.cpp +++ b/3rdparty/bx/src/timer.cpp @@ -1,12 +1,14 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "bx_p.h" #include -#if BX_PLATFORM_ANDROID +#if BX_CRT_NONE +# include "crt0.h" +#elif BX_PLATFORM_ANDROID # include // clock, clock_gettime #elif BX_PLATFORM_EMSCRIPTEN # include @@ -20,12 +22,12 @@ namespace bx { int64_t getHPCounter() { -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + int64_t i64 = crt0::getHPCounter(); +#elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT LARGE_INTEGER li; - // Performance counter value may unexpectedly leap forward - // http://support.microsoft.com/kb/274323 QueryPerformanceCounter(&li); int64_t i64 = li.QuadPart; #elif BX_PLATFORM_ANDROID @@ -47,7 +49,9 @@ namespace bx int64_t getHPFrequency() { -#if BX_PLATFORM_WINDOWS \ +#if BX_CRT_NONE + return INT64_C(1000000000); +#elif BX_PLATFORM_WINDOWS \ || BX_PLATFORM_XBOXONE \ || BX_PLATFORM_WINRT LARGE_INTEGER li; diff --git a/3rdparty/bx/src/url.cpp b/3rdparty/bx/src/url.cpp index 1dda39109bd..f58ecf5a9c3 100644 --- a/3rdparty/bx/src/url.cpp +++ b/3rdparty/bx/src/url.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bnet#license-bsd-2-clause */ @@ -24,22 +24,21 @@ namespace bx { clear(); - const char* start = _url.getPtr(); const char* term = _url.getTerm(); - const char* schemeEnd = strFind(StringView(start, term), "://"); - const char* hostStart = NULL != schemeEnd ? schemeEnd+3 : start; - const char* pathStart = strFind(StringView(hostStart, term), '/'); + StringView schemeEnd = strFind(_url, "://"); + const char* hostStart = !schemeEnd.isEmpty() ? schemeEnd.getTerm() : _url.getPtr(); + StringView path = strFind(StringView(hostStart, term), '/'); - if (NULL == schemeEnd - && NULL == pathStart) + if (schemeEnd.isEmpty() + && path.isEmpty() ) { return false; } - if (NULL != schemeEnd - && (NULL == pathStart || pathStart > schemeEnd) ) + if (!schemeEnd.isEmpty() + && (path.isEmpty() || path.getPtr() > schemeEnd.getPtr() ) ) { - StringView scheme(start, schemeEnd); + const StringView scheme(_url.getPtr(), schemeEnd.getPtr() ); if (!isAlpha(scheme) ) { @@ -49,63 +48,64 @@ namespace bx m_tokens[Scheme].set(scheme); } - if (NULL != pathStart) + if (!path.isEmpty() ) { - const char* queryStart = strFind(StringView(pathStart, term), '?'); - const char* fragmentStart = strFind(StringView(pathStart, term), '#'); + path.set(path.getPtr(), term); + const StringView query = strFind(path, '?'); + const StringView fragment = strFind(path, '#'); - if (NULL != fragmentStart - && fragmentStart < queryStart) + if (!fragment.isEmpty() + && fragment.getPtr() < query.getPtr() ) { return false; } - m_tokens[Path].set(pathStart - , NULL != queryStart ? queryStart - : NULL != fragmentStart ? fragmentStart + m_tokens[Path].set(path.getPtr() + , !query.isEmpty() ? query.getPtr() + : !fragment.isEmpty() ? fragment.getPtr() : term ); - if (NULL != queryStart) + if (!query.isEmpty() ) { - m_tokens[Query].set(queryStart+1 - , NULL != fragmentStart ? fragmentStart + m_tokens[Query].set(query.getPtr()+1 + , !fragment.isEmpty() ? fragment.getPtr() : term ); } - if (NULL != fragmentStart) + if (!fragment.isEmpty() ) { - m_tokens[Fragment].set(fragmentStart+1, term); + m_tokens[Fragment].set(fragment.getPtr()+1, term); } - term = pathStart; + term = path.getPtr(); } - const char* userPassEnd = strFind(StringView(hostStart, term), '@'); - const char* userPassStart = NULL != userPassEnd ? hostStart : NULL; - hostStart = NULL != userPassEnd ? userPassEnd+1 : hostStart; - const char* portStart = strFind(StringView(hostStart, term), ':'); + const StringView userPassEnd = strFind(StringView(hostStart, term), '@'); + const char* userPassStart = !userPassEnd.isEmpty() ? hostStart : NULL; + hostStart = !userPassEnd.isEmpty() ? userPassEnd.getPtr()+1 : hostStart; + const StringView portStart = strFind(StringView(hostStart, term), ':'); - m_tokens[Host].set(hostStart, NULL != portStart ? portStart : term); + m_tokens[Host].set(hostStart, !portStart.isEmpty() ? portStart.getPtr() : term); - if (NULL != portStart) + if (!portStart.isEmpty()) { - m_tokens[Port].set(portStart+1, term); + m_tokens[Port].set(portStart.getPtr()+1, term); } if (NULL != userPassStart) { - const char* passStart = strFind(StringView(userPassStart, userPassEnd), ':'); + StringView passStart = strFind(StringView(userPassStart, userPassEnd.getPtr() ), ':'); m_tokens[UserName].set(userPassStart - , NULL != passStart ? passStart - : userPassEnd + , !passStart.isEmpty() ? passStart.getPtr() + : userPassEnd.getPtr() ); - if (NULL != passStart) + if (!passStart.isEmpty() ) { - m_tokens[Password].set(passStart+1, userPassEnd); + m_tokens[Password].set(passStart.getPtr()+1, userPassEnd.getPtr() ); } } diff --git a/3rdparty/bx/tests/atomic_test.cpp b/3rdparty/bx/tests/atomic_test.cpp index 81b3318e8c0..04a623686e7 100644 --- a/3rdparty/bx/tests/atomic_test.cpp +++ b/3rdparty/bx/tests/atomic_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/crt_test.cpp b/3rdparty/bx/tests/crt_test.cpp index 6820c0f8a43..bda079036ee 100644 --- a/3rdparty/bx/tests/crt_test.cpp +++ b/3rdparty/bx/tests/crt_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/dbg.h b/3rdparty/bx/tests/dbg.h index 9ae46b35bbe..243dc234afc 100644 --- a/3rdparty/bx/tests/dbg.h +++ b/3rdparty/bx/tests/dbg.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/easing_test.cpp b/3rdparty/bx/tests/easing_test.cpp index 9bf3c996798..06944547f4a 100644 --- a/3rdparty/bx/tests/easing_test.cpp +++ b/3rdparty/bx/tests/easing_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -11,24 +11,25 @@ TEST_CASE("easing", "") { bx::WriterI* writer = bx::getNullOut(); + bx::Error err; for (uint32_t ee = 0; ee < bx::Easing::Count; ++ee) { - bx::writePrintf(writer, "\n\n%d\n", ee); + bx::write(writer, &err, "\n\n%d\n", ee); const bx::EaseFn easing = bx::getEaseFunc(bx::Easing::Enum(ee) ); const int32_t nx = 64; const int32_t ny = 10; - bx::writePrintf(writer, "\t/// ^\n"); + bx::write(writer, &err, "\t/// ^\n"); for (int32_t yy = ny+4; yy >= -5; --yy) { const float ys = float(yy )/float(ny); const float ye = float(yy+1.0)/float(ny); - bx::writePrintf(writer, "\t/// %c", yy != 0 ? '|' : '+'); + bx::write(writer, &err, "\t/// %c", yy != 0 ? '|' : '+'); for (int32_t xx = 0; xx < nx; ++xx) { @@ -41,18 +42,18 @@ TEST_CASE("easing", "") if (vv >= ys && vv < ye) { - bx::writePrintf(writer, "*"); + bx::write(writer, "*"); break; } } if (jj == 10) { - bx::writePrintf(writer, "%c", yy != 0 ? ' ' : '-'); + bx::write(writer, &err, "%c", yy != 0 ? ' ' : '-'); } } - bx::writePrintf(writer, "%s\n", yy != 0 ? "" : ">"); + bx::write(writer, &err, "%s\n", yy != 0 ? "" : ">"); } } } diff --git a/3rdparty/bx/tests/filepath_test.cpp b/3rdparty/bx/tests/filepath_test.cpp index 5b743c66c23..2662adeddf1 100644 --- a/3rdparty/bx/tests/filepath_test.cpp +++ b/3rdparty/bx/tests/filepath_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/handle_bench.cpp b/3rdparty/bx/tests/handle_bench.cpp index e5bd3007233..4effb59758e 100644 --- a/3rdparty/bx/tests/handle_bench.cpp +++ b/3rdparty/bx/tests/handle_bench.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -106,5 +106,8 @@ int main() extern void simd_bench(); simd_bench(); + extern void math_bench(); + math_bench(); + return bx::kExitSuccess; } diff --git a/3rdparty/bx/tests/handle_test.cpp b/3rdparty/bx/tests/handle_test.cpp index 05392922511..eb89b1f67a9 100644 --- a/3rdparty/bx/tests/handle_test.cpp +++ b/3rdparty/bx/tests/handle_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/hash_test.cpp b/3rdparty/bx/tests/hash_test.cpp index 8fbc542af94..1ec6702080e 100644 --- a/3rdparty/bx/tests/hash_test.cpp +++ b/3rdparty/bx/tests/hash_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/macros_test.cpp b/3rdparty/bx/tests/macros_test.cpp index 092bbd61726..e0d5ffae8b4 100644 --- a/3rdparty/bx/tests/macros_test.cpp +++ b/3rdparty/bx/tests/macros_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/main_test.cpp b/3rdparty/bx/tests/main_test.cpp index 261b62a2139..b9e9074a8ea 100644 --- a/3rdparty/bx/tests/main_test.cpp +++ b/3rdparty/bx/tests/main_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/math_bench.cpp b/3rdparty/bx/tests/math_bench.cpp new file mode 100644 index 00000000000..50a8b3d2301 --- /dev/null +++ b/3rdparty/bx/tests/math_bench.cpp @@ -0,0 +1,81 @@ +/* + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#include +#include +#include + +#include + +typedef float (*MathFn)(float); + +template +float mathTest(const char* _name) +{ + bx::WriterI* writer = bx::getStdOut(); + int64_t elapsed = -bx::getHPCounter(); + + float result = 0.0f; + const float max = 1389.0f; + + for (float xx = 0.0f; xx < max; xx += 0.1f) + { + result += mfn(xx); + } + + bx::Error err; + + elapsed += bx::getHPCounter(); + bx::write(writer, &err, "%-20s: %15f\n", _name, double(elapsed) ); + + return result; +} + +float rsqrt(float _a) +{ + return 1.0f/::sqrtf(_a); +} + +void math_bench() +{ + bx::WriterI* writer = bx::getStdOut(); + bx::Error err; + bx::write(writer, &err, "Math bench\n\n"); + + mathTest< ::sqrtf >(" ::sqrtf"); + mathTest("bx::sqrtRef"); + mathTest("bx::sqrtSimd"); + mathTest("bx::sqrt"); + + bx::write(writer, &err, "\n"); + mathTest< ::rsqrt >(" ::rsqrtf"); + mathTest("bx::rsqrtRef"); + mathTest("bx::rsqrtSimd"); + mathTest("bx::rsqrt"); + + bx::write(writer, &err, "\n"); + mathTest< ::sinf >(" ::sinf"); + mathTest("bx::sin"); + + bx::write(writer, &err, "\n"); + mathTest< ::asinf>(" ::asinf"); + mathTest("bx::asin"); + + bx::write(writer, &err, "\n"); + mathTest< ::cosf >(" ::cosf"); + mathTest("bx::cos"); + + bx::write(writer, &err, "\n"); + mathTest< ::acosf>(" ::acosf"); + mathTest("bx::acos"); + + bx::write(writer, &err, "\n"); + mathTest< ::tanf >(" ::tanf"); + mathTest("bx::tan"); + + bx::write(writer, &err, "\n"); + mathTest< ::atanf>(" ::atanf"); + mathTest("bx::atan"); +} diff --git a/3rdparty/bx/tests/math_test.cpp b/3rdparty/bx/tests/math_test.cpp index 2005a67908c..2eeac286282 100644 --- a/3rdparty/bx/tests/math_test.cpp +++ b/3rdparty/bx/tests/math_test.cpp @@ -1,13 +1,15 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "test.h" #include +#include + +#include #if !BX_COMPILER_MSVC || BX_COMPILER_MSVC >= 1800 -#include TEST_CASE("isFinite, isInfinite, isNan", "") { for (uint64_t ii = 0; ii < UINT32_MAX; ii += rand()%(1<<13)+1) @@ -20,16 +22,145 @@ TEST_CASE("isFinite, isInfinite, isNan", "") } #endif // !BX_COMPILER_MSVC || BX_COMPILER_MSVC >= 1800 - -bool flog2_test(float _a) +bool log2_test(float _a) { - return bx::flog2(_a) == bx::flog(_a) * (1.0f / bx::flog(2.0f) ); + return bx::log2(_a) == bx::log(_a) * (1.0f / bx::log(2.0f) ); } -TEST_CASE("flog2", "") +TEST_CASE("log2", "") { - flog2_test(0.0f); - flog2_test(256.0f); + log2_test(0.0f); + log2_test(256.0f); +} + +TEST_CASE("libm", "") +{ + bx::WriterI* writer = bx::getNullOut(); + + REQUIRE(1389.0f == bx::abs(-1389.0f) ); + REQUIRE(1389.0f == bx::abs( 1389.0f) ); + REQUIRE( 0.0f == bx::abs(-0.0f) ); + REQUIRE( 0.0f == bx::abs( 0.0f) ); + + REQUIRE(389.0f == bx::mod(1389.0f, 1000.0f) ); + REQUIRE(bx::isNan(bx::mod(0.0f, 0.0f) ) ); + + REQUIRE( 13.0f == bx::floor( 13.89f) ); + REQUIRE(-14.0f == bx::floor(-13.89f) ); + REQUIRE( 14.0f == bx::ceil( 13.89f) ); + REQUIRE(-13.0f == bx::ceil( -13.89f) ); + + REQUIRE( 13.0f == bx::trunc( 13.89f) ); + REQUIRE(-13.0f == bx::trunc(-13.89f) ); + REQUIRE(bx::equal( 0.89f, bx::fract( 13.89f), 0.000001f) ); + REQUIRE(bx::equal(-0.89f, bx::fract(-13.89f), 0.000001f) ); + + bx::Error err; + + for (int32_t yy = -10; yy < 10; ++yy) + { + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "ldexp(%f, %d) == %f (expected: %f)\n", xx, yy, bx::ldexp(xx, yy), ::ldexpf(xx, yy) ); + REQUIRE(bx::equal(bx::ldexp(xx, yy), ::ldexpf(xx, yy), 0.00001f) ); + } + } + + for (float xx = -80.0f; xx < 80.0f; xx += 0.1f) + { + bx::write(writer, &err, "exp(%f) == %f (expected: %f)\n", xx, bx::exp(xx), ::expf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::exp(xx), ::expf(xx), 0.00001f) ); + } + + for (float xx = 0.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "rsqrt(%f) == %f (expected: %f)\n", xx, bx::rsqrt(xx), 1.0f/::sqrtf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::rsqrt(xx), 1.0f/::sqrtf(xx), 0.00001f) ); + } + + for (float xx = 0.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "sqrt(%f) == %f (expected: %f)\n", xx, bx::sqrt(xx), ::sqrtf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::sqrt(xx), ::sqrtf(xx), 0.00001f) ); + } + + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "pow(1.389f, %f) == %f (expected: %f)\n", xx, bx::pow(1.389f, xx), ::powf(1.389f, xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::pow(1.389f, xx), ::powf(1.389f, xx), 0.00001f) ); + } + + for (float xx = -1.0f; xx < 1.0f; xx += 0.001f) + { + bx::write(writer, &err, "asin(%f) == %f (expected: %f)\n", xx, bx::asin(xx), ::asinf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::asin(xx), ::asinf(xx), 0.0001f) ); + } + + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "sin(%f) == %f (expected: %f)\n", xx, bx::sin(xx), ::sinf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::sin(xx), ::sinf(xx), 0.00001f) ); + } + + for (float xx = -1.0f; xx < 1.0f; xx += 0.1f) + { + bx::write(writer, &err, "sinh(%f) == %f (expected: %f)\n", xx, bx::sinh(xx), ::sinhf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::sinh(xx), ::sinhf(xx), 0.00001f) ); + } + + for (float xx = -1.0f; xx < 1.0f; xx += 0.001f) + { + bx::write(writer, &err, "acos(%f) == %f (expected: %f\n)", xx, bx::acos(xx), ::acosf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::acos(xx), ::acosf(xx), 0.0001f) ); + } + + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "cos(%f) == %f (expected: %f)\n", xx, bx::cos(xx), ::cosf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::cos(xx), ::cosf(xx), 0.00001f) ); + } + + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "tan(%f) == %f (expected: %f)\n", xx, bx::tan(xx), ::tanf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::tan(xx), ::tanf(xx), 0.001f) ); + } + + for (float xx = -1.0f; xx < 1.0f; xx += 0.1f) + { + bx::write(writer, &err, "tanh(%f) == %f (expected: %f\n", xx, bx::tanh(xx), ::tanhf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::tanh(xx), ::tanhf(xx), 0.00001f) ); + } + + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "atan(%f) == %f (expected: %f)\n", xx, bx::atan(xx), ::atanf(xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::atan(xx), ::atanf(xx), 0.00001f) ); + } + + for (float yy = -100.0f; yy < 100.0f; yy += 0.1f) + { + for (float xx = -100.0f; xx < 100.0f; xx += 0.1f) + { + bx::write(writer, &err, "atan2(%f, %f) == %f (expected: %f)\n", yy, xx, bx::atan2(yy, xx), ::atan2f(yy, xx) ); + REQUIRE(err.isOk() ); + REQUIRE(bx::equal(bx::atan2(yy, xx), ::atan2f(yy, xx), 0.00001f) ); + } + } + + REQUIRE(bx::equal(bx::atan2(0.0f, 0.0f), ::atan2f(0.0f, 0.0f), 0.00001f) ); } TEST_CASE("ToBits", "") @@ -40,7 +171,7 @@ TEST_CASE("ToBits", "") void mtxCheck(const float* _a, const float* _b) { - if (!bx::fequal(_a, _b, 16, 0.01f) ) + if (!bx::equal(_a, _b, 16, 0.01f) ) { DBG("\n" "A:\n" @@ -88,7 +219,7 @@ TEST_CASE("quaternion", "") float euler[3]; bx::quatToEuler(euler, quat); - CHECK(bx::fequal(euler[0], ax, 0.001f) ); + CHECK(bx::equal(euler[0], ax, 0.001f) ); bx::quatRotateY(quat, ay); bx::mtxQuat(mtxQ, quat); @@ -96,7 +227,7 @@ TEST_CASE("quaternion", "") mtxCheck(mtxQ, mtx); bx::quatToEuler(euler, quat); - CHECK(bx::fequal(euler[1], ay, 0.001f) ); + CHECK(bx::equal(euler[1], ay, 0.001f) ); bx::quatRotateZ(quat, az); bx::mtxQuat(mtxQ, quat); @@ -104,5 +235,5 @@ TEST_CASE("quaternion", "") mtxCheck(mtxQ, mtx); bx::quatToEuler(euler, quat); - CHECK(bx::fequal(euler[2], az, 0.001f) ); + CHECK(bx::equal(euler[2], az, 0.001f) ); } diff --git a/3rdparty/bx/tests/nlalloc_test.cpp b/3rdparty/bx/tests/nlalloc_test.cpp new file mode 100644 index 00000000000..91b0354926f --- /dev/null +++ b/3rdparty/bx/tests/nlalloc_test.cpp @@ -0,0 +1,195 @@ +/* + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#include "test.h" +#include +#include + +bx::DefaultAllocator g_allocator0; + +struct TinyStlAllocator +{ + static void* static_allocate(size_t _bytes) + { + return BX_ALLOC(&g_allocator0, _bytes); + } + + static void static_deallocate(void* _ptr, size_t /*_bytes*/) + { + if (NULL != _ptr) + { + BX_FREE(&g_allocator0, _ptr); + } + } +}; + +#define TINYSTL_ALLOCATOR ::TinyStlAllocator +#include + +namespace stl = tinystl; + +namespace bx +{ + struct Blk + { + static const uint64_t kInvalid = UINT64_MAX; + + Blk() + : ptr(kInvalid) + , size(0) + { + } + + Blk(uint64_t _ptr, uint32_t _size) + : ptr(_ptr) + , size(_size) + { + } + + uint64_t ptr; + uint32_t size; + }; + + inline bool operator<(const Blk& _lhs, const Blk& _rhs) + { + return _lhs.ptr < _rhs.ptr; + } + + inline bool isValid(const Blk& _blk) + { + return Blk::kInvalid != _blk.ptr; + } + + // First-fit non-local allocator. + class NonLocalAllocator + { + public: + NonLocalAllocator() + { + reset(); + } + + ~NonLocalAllocator() + { + } + + void reset() + { + m_free.clear(); + m_used = 0; + } + + void add(const Blk& _blk) + { + m_free.push_back(_blk); + } + + Blk remove() + { + BX_CHECK(0 == m_used, ""); + + if (0 < m_free.size() ) + { + Blk freeBlock = m_free.back(); + m_free.pop_back(); + return freeBlock; + } + + return Blk{}; + } + + Blk alloc(uint32_t _size) + { + _size = max(_size, 16u); + + for (FreeList::iterator it = m_free.begin(), itEnd = m_free.end(); it != itEnd; ++it) + { + if (it->size >= _size) + { + uint64_t ptr = it->ptr; + + if (it->size != _size) + { + it->size -= _size; + it->ptr += _size; + } + else + { + m_free.erase(it); + } + + m_used += _size; + return Blk{ ptr, _size }; + } + } + + // there is no block large enough. + return Blk{}; + } + + void free(const Blk& _blk) + { + m_used -= _blk.size; + m_free.push_back(_blk); + compact(); + } + + bool compact() + { + bx::quickSort( + m_free.begin() + , uint32_t(m_free.end() - m_free.begin() ) + , sizeof(Blk) + , [](const void* _a, const void* _b) -> int32_t { + const Blk& lhs = *(const Blk*)(_a); + const Blk& rhs = *(const Blk*)(_b); + return lhs < rhs ? -1 : 1; + }); + + for (FreeList::iterator it = m_free.begin(), next = it, itEnd = m_free.end(); next != itEnd;) + { + if ( (it->ptr + it->size) == next->ptr) + { + it->size += next->size; + next = m_free.erase(next); + } + else + { + it = next; + ++next; + } + } + + return 0 == m_used; + } + + uint32_t getUsed() const + { + return m_used; + } + + private: + typedef stl::vector FreeList; + FreeList m_free; + uint32_t m_used; + }; +} // namespace bx + +TEST_CASE("nlalloc") +{ + bx::NonLocalAllocator nla; + + bx::Blk blk; + + blk = nla.alloc(100); + REQUIRE(!isValid(blk) ); + nla.add(bx::Blk{0x1000, 100}); + + blk = nla.alloc(100); + REQUIRE(isValid(blk) ); + + nla.free(blk); + REQUIRE(0 == nla.getUsed() ); +} diff --git a/3rdparty/bx/tests/os_test.cpp b/3rdparty/bx/tests/os_test.cpp index 1589416e543..bf51c725e05 100644 --- a/3rdparty/bx/tests/os_test.cpp +++ b/3rdparty/bx/tests/os_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/queue_test.cpp b/3rdparty/bx/tests/queue_test.cpp index 81a2b44e676..4a4d5c9a325 100644 --- a/3rdparty/bx/tests/queue_test.cpp +++ b/3rdparty/bx/tests/queue_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/ringbuffer_test.cpp b/3rdparty/bx/tests/ringbuffer_test.cpp index 75d950184da..d0d2a426572 100644 --- a/3rdparty/bx/tests/ringbuffer_test.cpp +++ b/3rdparty/bx/tests/ringbuffer_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/rng_test.cpp b/3rdparty/bx/tests/rng_test.cpp index 89fef3f05d7..b5161f7167e 100644 --- a/3rdparty/bx/tests/rng_test.cpp +++ b/3rdparty/bx/tests/rng_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -41,38 +41,40 @@ void testRng(const char* _name, Ty* _rng) } bx::WriterI* writer = bx::getNullOut(); - bx::writePrintf(writer, "%s\n", _name); + bx::Error err; + + bx::write(writer, &err, "%s\n", _name); { - bx::writePrintf(writer, "\tbits histogram:\n"); + bx::write(writer, &err, "\tbits histogram:\n"); uint32_t min = UINT32_MAX; uint32_t max = 0; for (uint32_t ii = 0; ii < BX_COUNTOF(histBits); ++ii) { - bx::writePrintf(writer, "\t\t%3d: %d\n", ii, histBits[ii]); + bx::write(writer, &err, "\t\t%3d: %d\n", ii, histBits[ii]); min = bx::min(min, histBits[ii]); max = bx::max(max, histBits[ii]); } - bx::writePrintf(writer, "\tmin: %d, max: %d (diff: %d)\n", min, max, max-min); + bx::write(writer, &err, "\tmin: %d, max: %d (diff: %d)\n", min, max, max-min); REQUIRE(max-min < 8000); } { - bx::writePrintf(writer, "\tuint8_t histogram:\n"); + bx::write(writer, &err, "\tuint8_t histogram:\n"); uint32_t min = UINT32_MAX; uint32_t max = 0; for (uint32_t ii = 0; ii < BX_COUNTOF(histUint8); ++ii) { - bx::writePrintf(writer, "\t\t%3d: %d\n", ii, histUint8[ii]); + bx::write(writer, &err, "\t\t%3d: %d\n", ii, histUint8[ii]); min = bx::min(min, histUint8[ii]); max = bx::max(max, histUint8[ii]); } - bx::writePrintf(writer, "\tmin: %d, max: %d (diff: %d)\n", min, max, max-min); + bx::write(writer, &err, "\tmin: %d, max: %d (diff: %d)\n", min, max, max-min); REQUIRE(max-min < 8000); } diff --git a/3rdparty/bx/tests/run_test.cpp b/3rdparty/bx/tests/run_test.cpp index 1616fe33c2c..090c1186c0c 100644 --- a/3rdparty/bx/tests/run_test.cpp +++ b/3rdparty/bx/tests/run_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/settings_test.cpp b/3rdparty/bx/tests/settings_test.cpp index 9f94cfd9fa8..584397ad143 100644 --- a/3rdparty/bx/tests/settings_test.cpp +++ b/3rdparty/bx/tests/settings_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -27,12 +27,12 @@ TEST_CASE("Settings", "") bx::close(&writer); } - REQUIRE(NULL == settings.get("meh") ); + REQUIRE(settings.get("meh").isEmpty() ); REQUIRE(0 == bx::strCmp(settings.get("meh/podmac"), "true") ); REQUIRE(0 == bx::strCmp(settings.get("test/foo/bar/abvgd"), "1389") ); settings.remove("meh/podmac"); - REQUIRE(NULL == settings.get("meh/podmac") ); + REQUIRE(settings.get("meh/podmac").isEmpty() ); settings.clear(); @@ -43,7 +43,7 @@ TEST_CASE("Settings", "") bx::close(&reader); } - REQUIRE(NULL == settings.get("meh") ); + REQUIRE(settings.get("meh").isEmpty() ); REQUIRE(0 == bx::strCmp(settings.get("meh/podmac"), "true") ); REQUIRE(0 == bx::strCmp(settings.get("test/foo/bar/abvgd"), "1389") ); } diff --git a/3rdparty/bx/tests/simd_bench.cpp b/3rdparty/bx/tests/simd_bench.cpp index 0f0c9c4671c..66e26297aaf 100644 --- a/3rdparty/bx/tests/simd_bench.cpp +++ b/3rdparty/bx/tests/simd_bench.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -111,7 +111,7 @@ void simd_bench() for (uint32_t ii = 0; ii < numVertices; ++ii) { float* ptr = (float*)&src[ii]; - randUnitSphere(ptr, &rng); + bx::store(ptr, bx::randUnitSphere(&rng) ); ptr[3] = 1.0f; } @@ -121,10 +121,10 @@ void simd_bench() for (uint32_t ii = 0; ii < numVertices; ++ii) { float* ptr = (float*)&src[ii]; - ptr[0] = bx::fabs(ptr[0]); - ptr[1] = bx::fabs(ptr[1]); - ptr[2] = bx::fabs(ptr[2]); - ptr[3] = bx::fabs(ptr[3]); + ptr[0] = bx::abs(ptr[0]); + ptr[1] = bx::abs(ptr[1]); + ptr[2] = bx::abs(ptr[2]); + ptr[3] = bx::abs(ptr[3]); } simd_bench_pass(dst, src, numVertices); diff --git a/3rdparty/bx/tests/simd_test.cpp b/3rdparty/bx/tests/simd_test.cpp index fcdc7a9cb1f..3a211ca1054 100644 --- a/3rdparty/bx/tests/simd_test.cpp +++ b/3rdparty/bx/tests/simd_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -162,10 +162,10 @@ void simd_check_float( , _0, _1, _2, _3 ); - CHECK(bx::fequal(c.f[0], _0, 0.0001f) ); - CHECK(bx::fequal(c.f[1], _1, 0.0001f) ); - CHECK(bx::fequal(c.f[2], _2, 0.0001f) ); - CHECK(bx::fequal(c.f[3], _3, 0.0001f) ); + CHECK(bx::equal(c.f[0], _0, 0.0001f) ); + CHECK(bx::equal(c.f[1], _1, 0.0001f) ); + CHECK(bx::equal(c.f[2], _2, 0.0001f) ); + CHECK(bx::equal(c.f[3], _3, 0.0001f) ); } void simd_check_float( @@ -189,14 +189,14 @@ void simd_check_float( , _0, _1, _2, _3, _4, _5, _6, _7 ); - CHECK(bx::fequal(c.f[0], _0, 0.0001f) ); - CHECK(bx::fequal(c.f[1], _1, 0.0001f) ); - CHECK(bx::fequal(c.f[2], _2, 0.0001f) ); - CHECK(bx::fequal(c.f[3], _3, 0.0001f) ); - CHECK(bx::fequal(c.f[4], _4, 0.0001f) ); - CHECK(bx::fequal(c.f[5], _5, 0.0001f) ); - CHECK(bx::fequal(c.f[6], _6, 0.0001f) ); - CHECK(bx::fequal(c.f[7], _7, 0.0001f) ); + CHECK(bx::equal(c.f[0], _0, 0.0001f) ); + CHECK(bx::equal(c.f[1], _1, 0.0001f) ); + CHECK(bx::equal(c.f[2], _2, 0.0001f) ); + CHECK(bx::equal(c.f[3], _3, 0.0001f) ); + CHECK(bx::equal(c.f[4], _4, 0.0001f) ); + CHECK(bx::equal(c.f[5], _5, 0.0001f) ); + CHECK(bx::equal(c.f[6], _6, 0.0001f) ); + CHECK(bx::equal(c.f[7], _7, 0.0001f) ); } void simd_check_string(const char* _str, bx::simd128_t _a) diff --git a/3rdparty/bx/tests/sort_test.cpp b/3rdparty/bx/tests/sort_test.cpp index 0b078e23d90..e2a5a25449d 100644 --- a/3rdparty/bx/tests/sort_test.cpp +++ b/3rdparty/bx/tests/sort_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/string_test.cpp b/3rdparty/bx/tests/string_test.cpp index d848f3de142..b7c4ed8ab52 100644 --- a/3rdparty/bx/tests/string_test.cpp +++ b/3rdparty/bx/tests/string_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -8,9 +8,27 @@ #include #include #include +#include bx::AllocatorI* g_allocator; +TEST_CASE("stringPrintfTy", "") +{ + std::string test; + bx::stringPrintf(test, "printf into std::string."); + REQUIRE(0 == bx::strCmp(bx::StringView(test), "printf into std::string.") ); +} + +TEST_CASE("prettify", "") +{ + char tmp[1024]; + prettify(tmp, BX_COUNTOF(tmp), 4000, bx::Units::Kilo); + REQUIRE(0 == bx::strCmp(tmp, "4.00 kB") ); + + prettify(tmp, BX_COUNTOF(tmp), 4096, bx::Units::Kibi); + REQUIRE(0 == bx::strCmp(tmp, "4.00 KiB") ); +} + TEST_CASE("chars", "") { for (char ch = 'A'; ch <= 'Z'; ++ch) @@ -163,19 +181,19 @@ TEST_CASE("strCmpV sort", "") TEST_CASE("strRFind", "") { const char* test = "test"; - REQUIRE(NULL == bx::strRFind(bx::StringView(test, 0), 's') ); - REQUIRE(NULL == bx::strRFind(bx::StringView(test, 1), 's') ); - REQUIRE(&test[2] == bx::strRFind(test, 's') ); + REQUIRE(bx::strRFind(bx::StringView(test, 0), 's').isEmpty() ); + REQUIRE(bx::strRFind(bx::StringView(test, 1), 's').isEmpty() ); + REQUIRE(&test[2] == bx::strRFind(test, 's').getPtr() ); } TEST_CASE("strFindI", "") { const char* test = "The Quick Brown Fox Jumps Over The Lazy Dog."; - REQUIRE(NULL == bx::strFindI(bx::StringView(test, 8), "quick") ); - REQUIRE(NULL == bx::strFindI(test, "quick1") ); - REQUIRE(&test[4] == bx::strFindI(bx::StringView(test, 9), "quick") ); - REQUIRE(&test[4] == bx::strFindI(test, "quick") ); + REQUIRE(bx::strFindI(bx::StringView(test, 8), "quick").isEmpty() ); + REQUIRE(bx::strFindI(test, "quick1").isEmpty() ); + REQUIRE(&test[4] == bx::strFindI(bx::StringView(test, 9), "quick").getPtr() ); + REQUIRE(&test[4] == bx::strFindI(test, "quick").getPtr() ); } TEST_CASE("strFind", "") @@ -183,28 +201,77 @@ TEST_CASE("strFind", "") { const char* test = "test"; - REQUIRE(NULL == bx::strFind(bx::StringView(test, 0), 's') ); - REQUIRE(NULL == bx::strFind(bx::StringView(test, 2), 's') ); - REQUIRE(&test[2] == bx::strFind(test, 's') ); + REQUIRE(bx::strFind(bx::StringView(test, 0), 's').isEmpty() ); + REQUIRE(bx::strFind(bx::StringView(test, 2), 's').isEmpty() ); + REQUIRE(&test[2] == bx::strFind(test, 's').getPtr() ); } { const char* test = "The Quick Brown Fox Jumps Over The Lazy Dog."; - REQUIRE(NULL == bx::strFind(bx::StringView(test, 8), "quick") ); - REQUIRE(NULL == bx::strFind(test, "quick1") ); - REQUIRE(NULL == bx::strFind(bx::StringView(test, 9), "quick") ); - REQUIRE(NULL == bx::strFind(test, "quick") ); + REQUIRE(bx::strFind(bx::StringView(test, 8), "quick").isEmpty() ); + REQUIRE(bx::strFind(test, "quick1").isEmpty() ); + REQUIRE(bx::strFind(bx::StringView(test, 9), "quick").isEmpty() ); + REQUIRE(bx::strFind(test, "quick").isEmpty() ); - REQUIRE(NULL == bx::strFind(bx::StringView(test, 8), "Quick") ); - REQUIRE(NULL == bx::strFind(test, "Quick1") ); - REQUIRE(&test[4] == bx::strFind(bx::StringView(test, 9), "Quick") ); - REQUIRE(&test[4] == bx::strFind(test, "Quick") ); + REQUIRE(bx::strFind(bx::StringView(test, 8), "Quick").isEmpty() ); + REQUIRE(bx::strFind(test, "Quick1").isEmpty() ); + REQUIRE(&test[4] == bx::strFind(bx::StringView(test, 9), "Quick").getPtr() ); + REQUIRE(&test[4] == bx::strFind(test, "Quick").getPtr() ); - REQUIRE(NULL == bx::strFind("vgd", 'a') ); + REQUIRE(bx::strFind("vgd", 'a').isEmpty() ); } } +TEST_CASE("strSkip", "") +{ + const bx::StringView t0(" test X"); + + const bx::StringView t1 = bx::strLTrimSpace(t0); + REQUIRE(0 == bx::strCmp(t1, "test", 4) ); + + const bx::StringView t2 = bx::strLTrimNonSpace(t1); + REQUIRE(0 == bx::strCmp(t2, " X", 2) ); + + const bx::StringView t3("test"); + + const bx::StringView t4 = bx::strLTrimNonSpace(t3); + REQUIRE(t4.getTerm() == t4.getPtr() ); +} + +template +static bool testToStringS(Ty _value, const char* _expected, char _separator = '\0') +{ + char tmp[1024]; + int32_t num = bx::toString(tmp, BX_COUNTOF(tmp), _value, 10, _separator); + int32_t len = (int32_t)bx::strLen(_expected); + if (0 == bx::strCmp(tmp, _expected) + && num == len) + { + return true; + } + + printf("result '%s' (%d), expected '%s' (%d)\n", tmp, num, _expected, len); + return false; +} + +TEST_CASE("toString intXX_t/uintXX_t", "") +{ + REQUIRE(testToStringS(0, "0") ); + REQUIRE(testToStringS(-256, "-256") ); + REQUIRE(testToStringS(INT32_MAX, "2147483647") ); + REQUIRE(testToStringS(UINT32_MAX, "4294967295") ); + REQUIRE(testToStringS(INT64_MAX, "9223372036854775807") ); + REQUIRE(testToStringS(UINT64_MAX, "18446744073709551615") ); + + REQUIRE(testToStringS(0, "0", ',') ); + REQUIRE(testToStringS(-256, "-256", ',') ); + REQUIRE(testToStringS(INT32_MAX, "2,147,483,647", ',') ); + REQUIRE(testToStringS(UINT32_MAX, "4,294,967,295", ',') ); + REQUIRE(testToStringS(INT64_MAX, "9,223,372,036,854,775,807", ',') ); + REQUIRE(testToStringS(UINT64_MAX, "18,446,744,073,709,551,615", ',') ); +} + template static bool testToString(Ty _value, const char* _expected) { @@ -221,14 +288,6 @@ static bool testToString(Ty _value, const char* _expected) return false; } -TEST_CASE("toString int32_t/uint32_t", "") -{ - REQUIRE(testToString(0, "0") ); - REQUIRE(testToString(-256, "-256") ); - REQUIRE(testToString(INT32_MAX, "2147483647") ); - REQUIRE(testToString(UINT32_MAX, "4294967295") ); -} - TEST_CASE("toString double", "") { REQUIRE(testToString(0.0, "0.0") ); @@ -255,17 +314,20 @@ TEST_CASE("toString double", "") REQUIRE(testToString(0.000000000123123, "1.23123e-10") ); REQUIRE(testToString(0.0000000001, "1e-10") ); REQUIRE(testToString(-270.000000, "-270.0") ); + REQUIRE(testToString(2.225073858507201e-308, "2.225073858507201e-308") ); + REQUIRE(testToString(-79.39773355813419, "-79.39773355813419") ); } -static bool testFromString(double _value, const char* _input) +template +static bool testFromString(Ty _value, const char* _input) { char tmp[1024]; bx::toString(tmp, BX_COUNTOF(tmp), _value); - double lhs; + Ty lhs; bx::fromString(&lhs, tmp); - double rhs; + Ty rhs; bx::fromString(&rhs, _input); if (lhs == rhs) @@ -277,32 +339,57 @@ static bool testFromString(double _value, const char* _input) return false; } +TEST_CASE("fromString float", "") +{ + REQUIRE(testFromString(std::numeric_limits::min(), "1.175494351e-38") ); + REQUIRE(testFromString(std::numeric_limits::lowest(), "-3.402823466e+38") ); + REQUIRE(testFromString(std::numeric_limits::max(), "3.402823466e+38") ); +} + TEST_CASE("fromString double", "") { - REQUIRE(testFromString(0.0, "0.0") ); - REQUIRE(testFromString(-0.0, "-0.0") ); - REQUIRE(testFromString(1.0, "1.0") ); - REQUIRE(testFromString(-1.0, "-1.0") ); - REQUIRE(testFromString(1.2345, "1.2345") ); - REQUIRE(testFromString(1.2345678, "1.2345678") ); - REQUIRE(testFromString(0.123456789012, "0.123456789012") ); - REQUIRE(testFromString(1234567.8, "1234567.8") ); - REQUIRE(testFromString(-79.39773355813419, "-79.39773355813419") ); - REQUIRE(testFromString(0.000001, "0.000001") ); - REQUIRE(testFromString(0.0000001, "1e-7") ); - REQUIRE(testFromString(1e30, "1e30") ); - REQUIRE(testFromString(1.234567890123456e30, "1.234567890123456e30") ); - REQUIRE(testFromString(-5e-324, "-5e-324") ); - REQUIRE(testFromString(2.225073858507201e-308, "2.225073858507201e-308") ); - REQUIRE(testFromString(2.2250738585072014e-308, "2.2250738585072014e-308") ); - REQUIRE(testFromString(1.7976931348623157e308, "1.7976931348623157e308") ); - REQUIRE(testFromString(0.00000123123123, "0.00000123123123") ); - REQUIRE(testFromString(0.000000123123123, "1.23123123e-7") ); - REQUIRE(testFromString(123123.123, "123123.123") ); - REQUIRE(testFromString(1231231.23, "1231231.23") ); - REQUIRE(testFromString(0.000000000123123, "1.23123e-10") ); - REQUIRE(testFromString(0.0000000001, "1e-10") ); - REQUIRE(testFromString(-270.000000, "-270.0") ); + REQUIRE(testFromString(0.0, "0.0") ); + REQUIRE(testFromString(-0.0, "-0.0") ); + REQUIRE(testFromString(1.0, "1.0") ); + REQUIRE(testFromString(-1.0, "-1.0") ); + REQUIRE(testFromString(1.2345, "1.2345") ); + REQUIRE(testFromString(1.2345678, "1.2345678") ); + REQUIRE(testFromString(0.123456789012, "0.123456789012") ); + REQUIRE(testFromString(123456.789, "123456.789") ); + REQUIRE(testFromString(1234567.8, "1234567.8") ); + REQUIRE(testFromString(-79.39773355813419, "-79.39773355813419") ); + REQUIRE(testFromString(0.000001, "0.000001") ); + REQUIRE(testFromString(0.0000001, "1e-7") ); + REQUIRE(testFromString(1e30, "1e30") ); + REQUIRE(testFromString(1.234567890123456e30, "1.234567890123456e30") ); + REQUIRE(testFromString(-5e-324, "-5e-324") ); + REQUIRE(testFromString(2.225073858507201e-308, "2.225073858507201e-308") ); + REQUIRE(testFromString(2.2250738585072014e-308, "2.2250738585072014e-308") ); + REQUIRE(testFromString(1.7976931348623157e308, "1.7976931348623157e308") ); + REQUIRE(testFromString(0.00000123123123, "0.00000123123123") ); + REQUIRE(testFromString(0.000000123123123, "1.23123123e-7") ); + REQUIRE(testFromString(123123.123, "123123.123") ); + REQUIRE(testFromString(1231231.23, "1231231.23") ); + REQUIRE(testFromString(0.000000000123123, "1.23123e-10") ); + REQUIRE(testFromString(0.0000000001, "1e-10") ); + REQUIRE(testFromString(-270.000000, "-270.0") ); + REQUIRE(testFromString(2.2250738585072011e-308, "2.2250738585072011e-308") ); // https://web.archive.org/web/20181112222123/https://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/ + REQUIRE(testFromString(2.2250738585072009e-308, "2.2250738585072009e-308") ); // Max subnormal double + REQUIRE(testFromString(4.9406564584124654e-324, "4.9406564584124654e-324") ); // Min denormal + REQUIRE(testFromString(1.7976931348623157e+308, "1.7976931348623157e+308") ); // Max double + +// warning: magnitude of floating-point constant too small for type 'double'; minimum is 4.9406564584124654E-324 +// REQUIRE(testFromString(1e-10000, "0.0") ); // Must underflow +// integer literal is too large to be represented in any integer type +// REQUIRE(testFromString(18446744073709551616, "18446744073709551616.0") ); // 2^64 (max of uint64_t + 1, force to use double) +// REQUIRE(testFromString(-9223372036854775809, "-9223372036854775809.0") ); // -2^63 - 1(min of int64_t + 1, force to use double) + + REQUIRE(testFromString(0.9868011474609375, "0.9868011474609375") ); // https://github.com/miloyip/rapidjson/issues/120 + REQUIRE(testFromString(123e34, "123e34") ); + REQUIRE(testFromString(45913141877270640000.0, "45913141877270640000.0") ); + REQUIRE(testFromString(std::numeric_limits::min(), "2.2250738585072014e-308") ); + REQUIRE(testFromString(std::numeric_limits::lowest(), "-1.7976931348623158e+308") ); + REQUIRE(testFromString(std::numeric_limits::max(), "1.7976931348623158e+308") ); } static bool testFromString(int32_t _value, const char* _input) @@ -371,11 +458,11 @@ TEST_CASE("StringView", "") TEST_CASE("Trim", "") { REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "ab"), "vgd") ); - REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vagbd"), "") ); + REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vagbd"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strLTrim("abvgd", "vgd"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strLTrim("/555333/podmac/", "/"), "555333/podmac/") ); - REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "vagbd"), "") ); + REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "vagbd"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strRTrim("abvgd", "abv"), "abvgd") ); REQUIRE(0 == bx::strCmp(bx::strRTrim("/555333/podmac/", "/"), "/555333/podmac") ); @@ -389,3 +476,18 @@ TEST_CASE("Trim", "") bx::FilePath uri("/555333/podmac/"); REQUIRE(0 == bx::strCmp(bx::strTrim(uri.getPath(), "/"), "555333/podmac") ); } + +TEST_CASE("strWord", "") +{ + REQUIRE(bx::strWord(" abvgd-1389.0").isEmpty() ); + REQUIRE(0 == bx::strCmp(bx::strWord("abvgd-1389.0"), "abvgd") ); +} + +TEST_CASE("strFindBlock", "") +{ + const bx::StringView test0("{ { {} {} abvgd; {} } }"); + const bx::StringView test1(test0, 1); + + bx::StringView result = bx::strFindBlock(test1, '{', '}'); + REQUIRE(19 == result.getLength() ); +} diff --git a/3rdparty/bx/tests/test.h b/3rdparty/bx/tests/test.h index c4f0dcec320..43da95a56d2 100644 --- a/3rdparty/bx/tests/test.h +++ b/3rdparty/bx/tests/test.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/thread_test.cpp b/3rdparty/bx/tests/thread_test.cpp index 713781956fb..80db9b5b969 100644 --- a/3rdparty/bx/tests/thread_test.cpp +++ b/3rdparty/bx/tests/thread_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/tokenizecmd_test.cpp b/3rdparty/bx/tests/tokenizecmd_test.cpp index fece7ea2f25..e0910fef087 100644 --- a/3rdparty/bx/tests/tokenizecmd_test.cpp +++ b/3rdparty/bx/tests/tokenizecmd_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 Branimir Karadzic. All rights reserved. + * Copyright 2012-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/uint32_test.cpp b/3rdparty/bx/tests/uint32_test.cpp index ae214b88c22..bb7e0dccacd 100644 --- a/3rdparty/bx/tests/uint32_test.cpp +++ b/3rdparty/bx/tests/uint32_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ @@ -24,25 +24,18 @@ TEST_CASE("StrideAlign") TEST_CASE("uint32_cnt") { REQUIRE( 0 == bx::uint32_cnttz(UINT32_C(1) ) ); - REQUIRE( 0 == bx::uint32_cnttz_ref(UINT32_C(1) ) ); REQUIRE(31 == bx::uint32_cntlz(UINT32_C(1) ) ); - REQUIRE(31 == bx::uint32_cntlz_ref(UINT32_C(1) ) ); REQUIRE( 0 == bx::uint64_cnttz(UINT64_C(1) ) ); - REQUIRE( 0 == bx::uint64_cnttz_ref(UINT64_C(1) ) ); REQUIRE(63 == bx::uint64_cntlz(UINT64_C(1) ) ); - REQUIRE(63 == bx::uint64_cntlz_ref(UINT64_C(1) ) ); REQUIRE( 1 == bx::uint32_cntbits(1) ); - REQUIRE( 1 == bx::uint32_cntbits_ref(1) ); REQUIRE(16 == bx::uint32_cntbits(UINT16_MAX) ); - REQUIRE(16 == bx::uint32_cntbits_ref(UINT16_MAX) ); REQUIRE(32 == bx::uint32_cntbits(UINT32_MAX) ); - REQUIRE(32 == bx::uint32_cntbits_ref(UINT32_MAX) ); } TEST_CASE("uint32_part") @@ -69,3 +62,29 @@ TEST_CASE("halfTo/FromFloat", "") REQUIRE(orig == hff); } } + +TEST_CASE("uint32_testpow2", "") +{ + uint32_t shift = 0; + + for (uint32_t ii = 0; ii < UINT32_MAX; ++ii) + { + if (bx::uint32_testpow2(ii) ) + { + REQUIRE(ii == 1u << shift); + ++shift; + } + } +} + +TEST_CASE("uint32_roX", "") +{ + REQUIRE(bx::uint32_rol(0x80000000, 1) == 1); + REQUIRE(bx::uint32_ror(1, 1) == 0x80000000); +} + +TEST_CASE("uint64_roX", "") +{ + REQUIRE(bx::uint64_rol(0x8000000000000000, 1) == 1); + REQUIRE(bx::uint64_ror(1, 1) == 0x8000000000000000); +} diff --git a/3rdparty/bx/tests/url_test.cpp b/3rdparty/bx/tests/url_test.cpp index 504f4d2bc4d..50d2c3924d5 100644 --- a/3rdparty/bx/tests/url_test.cpp +++ b/3rdparty/bx/tests/url_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ diff --git a/3rdparty/bx/tests/vsnprintf_test.cpp b/3rdparty/bx/tests/vsnprintf_test.cpp index 8498ec39096..844f6363ce2 100644 --- a/3rdparty/bx/tests/vsnprintf_test.cpp +++ b/3rdparty/bx/tests/vsnprintf_test.cpp @@ -1,10 +1,12 @@ /* - * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * Copyright 2010-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ #include "test.h" #include +#include + #include #include @@ -17,10 +19,13 @@ TEST_CASE("vsnprintf NULL buffer", "No output buffer provided.") TEST_CASE("vsnprintf truncated", "Truncated output buffer.") { - char buffer[7]; + char buffer5[5]; // fit + REQUIRE(4 == bx::snprintf(buffer5, BX_COUNTOF(buffer5), "abvg") ); + REQUIRE(0 == bx::strCmp(buffer5, "abvg") ); - REQUIRE(10 == bx::snprintf(buffer, BX_COUNTOF(buffer), "Ten chars!") ); - REQUIRE(0 == bx::strCmp(buffer, "Ten ch") ); + char buffer7[7]; // truncate + REQUIRE(10 == bx::snprintf(buffer7, BX_COUNTOF(buffer7), "Ten chars!") ); + REQUIRE(0 == bx::strCmp(buffer7, "Ten ch") ); } static bool test(const char* _expected, const char* _format, ...) @@ -46,7 +51,7 @@ static bool test(const char* _expected, const char* _format, ...) return result; } -TEST_CASE("vsnprintf f", "") +TEST_CASE("vsnprintf f") { REQUIRE(test("1.337", "%0.3f", 1.337) ); REQUIRE(test(" 13.370", "%8.3f", 13.37) ); @@ -56,23 +61,14 @@ TEST_CASE("vsnprintf f", "") REQUIRE(test("nan ", "%-8f", std::numeric_limits::quiet_NaN() ) ); REQUIRE(test(" nan", "%8f", std::numeric_limits::quiet_NaN() ) ); - -#if !BX_CRT_MSVC - // BK - VS2015 CRT vsnprintf returns '-NAN(IND'. -# if BX_CRT_LIBCXX - // BK - Clang LibC vsnprintf returns 'NAN '. - REQUIRE(test("NAN ", "%-8F", -std::numeric_limits::quiet_NaN() ) ); -# else REQUIRE(test("-NAN ", "%-8F", -std::numeric_limits::quiet_NaN() ) ); -# endif // BX_CRT_LIBCXX -#endif // !BX_CRT_MSVC REQUIRE(test(" inf", "%8f", std::numeric_limits::infinity() ) ); REQUIRE(test("inf ", "%-8f", std::numeric_limits::infinity() ) ); REQUIRE(test(" -INF", "%8F", -std::numeric_limits::infinity() ) ); } -TEST_CASE("vsnprintf d/i/o/u/x", "") +TEST_CASE("vsnprintf d/i/o/u/x") { REQUIRE(test("1337", "%d", 1337) ); REQUIRE(test("1337 ", "%-20d", 1337) ); @@ -101,8 +97,6 @@ TEST_CASE("vsnprintf d/i/o/u/x", "") REQUIRE(test("000000000000edcb5433", "%020x", -0x1234abcd) ); REQUIRE(test("000000000000EDCB5433", "%020X", -0x1234abcd) ); -#if !BX_CRT_MSVC - // BK - VS2015 CRT vsnprintf doesn't support 'j' length sub-specifier? if (BX_ENABLED(BX_ARCH_32BIT) ) { REQUIRE(test("2147483647", "%jd", INTMAX_MAX) ); @@ -111,13 +105,12 @@ TEST_CASE("vsnprintf d/i/o/u/x", "") { REQUIRE(test("9223372036854775807", "%jd", INTMAX_MAX) ); } -#endif // !BX_CRT_MSVC REQUIRE(test("18446744073709551615", "%" PRIu64, UINT64_MAX) ); REQUIRE(test("ffffffffffffffff", "%016" PRIx64, UINT64_MAX) ); } -TEST_CASE("vsnprintf modifiers", "") +TEST_CASE("vsnprintf modifiers") { REQUIRE(test("| 1.000000|", "|%10f|", 1.0f) ); REQUIRE(test("|1.000000 |", "|%-10f|", 1.0f) ); @@ -132,36 +125,53 @@ TEST_CASE("vsnprintf modifiers", "") REQUIRE(test("|+1. |", "|%+#-10.0f|", 1.0f) ); } -TEST_CASE("vsnprintf p", "") +TEST_CASE("vsnprintf p") { -#if BX_CRT_MSVC - // BK - VS2015 CRT vsnprintf has different output for 'p' pointer specifier. - REQUIRE(test("0BADC0DE", "%p", (void*)0xbadc0de)); - REQUIRE(test("0BADC0DE ", "%-20p", (void*)0xbadc0de)); -#else REQUIRE(test("0xbadc0de", "%p", (void*)0xbadc0de) ); REQUIRE(test("0xbadc0de ", "%-20p", (void*)0xbadc0de) ); -#endif // BX_CRT_MSVC } -TEST_CASE("vsnprintf s", "") +TEST_CASE("vsnprintf s") { REQUIRE(test("(null)", "%s", NULL) ); } -TEST_CASE("vsnprintf g", "") +TEST_CASE("vsnprintf g") { - REQUIRE(test(" 0.01", "%7.3g", .01) ); - REQUIRE(test(" 0.0123", "%7.3G", .0123) ); - REQUIRE(test("1.23e+05", "%.3g", 123000.25) ); - REQUIRE(test("1e+05", "%.0g", 123000.25) ); + REQUIRE(test(" 0.01", "%7.2g", .01) ); + REQUIRE(test(" 0.0123", "%7.4G", .0123) ); +// REQUIRE(test("1.23e+05", "%.3g", 123000.25) ); +// REQUIRE(test("1e+05", "%.0g", 123000.25) ); } -TEST_CASE("vsnprintf", "") +TEST_CASE("vsnprintf") { REQUIRE(test("x", "%c", 'x') ); REQUIRE(test("x ", "%-20c", 'x') ); REQUIRE(test("hello ", "%-20s", "hello") ); REQUIRE(test("hello, world!", "%s, %s!", "hello", "world") ); + + bx::StringView str("0hello1world2"); + bx::StringView hello(str, 1, 5); + bx::StringView world(str, 7, 5); + REQUIRE(test("hello, world!", "%.*s, %.*s!" + , hello.getLength(), hello.getPtr() + , world.getLength(), world.getPtr() + ) ); +} + +TEST_CASE("vsnprintf write") +{ + char tmp[64]; + bx::StaticMemoryBlock mb(tmp, sizeof(tmp)); + bx::MemoryWriter writer(&mb); + + bx::Error err; + int32_t len = bx::write(&writer, &err, "%d", 1389); + REQUIRE(err.isOk()); + REQUIRE(len == 4); + + bx::StringView str(tmp, len); + REQUIRE(0 == bx::strCmp(str, "1389") ); } diff --git a/3rdparty/bx/tools/bin/darwin/bin2c b/3rdparty/bx/tools/bin/darwin/bin2c index eb1fa8e034c..cb1acca8021 100644 Binary files a/3rdparty/bx/tools/bin/darwin/bin2c and b/3rdparty/bx/tools/bin/darwin/bin2c differ diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie index aa81010239b..fd3624037ce 100755 Binary files a/3rdparty/bx/tools/bin/darwin/genie and b/3rdparty/bx/tools/bin/darwin/genie differ diff --git a/3rdparty/bx/tools/bin/darwin/lemon b/3rdparty/bx/tools/bin/darwin/lemon new file mode 100644 index 00000000000..f8cfcebbc1b Binary files /dev/null and b/3rdparty/bx/tools/bin/darwin/lemon differ diff --git a/3rdparty/bx/tools/bin/darwin/lempar.c b/3rdparty/bx/tools/bin/darwin/lempar.c new file mode 100644 index 00000000000..da81ddd4bc0 --- /dev/null +++ b/3rdparty/bx/tools/bin/darwin/lempar.c @@ -0,0 +1,981 @@ +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: +*/ +#include +/************ Begin %include sections from the grammar ************************/ +%% +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +%% +/**************** End makeheaders token definitions ***************************/ + +/* The next sections is a series of control #defines. +** various aspects of the generated parser. +** YYCODETYPE is the data type used to store the integer codes +** that represent terminal and non-terminal symbols. +** "unsigned char" is used if there are fewer than +** 256 symbols. Larger types otherwise. +** YYNOCODE is a number of type YYCODETYPE that is not used for +** any terminal or nonterminal symbol. +** YYFALLBACK If defined, this indicates that one or more tokens +** (also known as: "terminal symbols") have fall-back +** values which should be used if the original symbol +** would not parse. This permits keywords to sometimes +** be used as identifiers, for example. +** YYACTIONTYPE is the data type used for "action codes" - numbers +** that indicate what to do in response to the next +** token. +** ParseTOKENTYPE is the data type used for minor type for terminal +** symbols. Background: A "minor type" is a semantic +** value associated with a terminal or non-terminal +** symbols. For example, for an "ID" terminal symbol, +** the minor type might be the name of the identifier. +** Each non-terminal can have a different minor type. +** Terminal symbols all have the same minor type, though. +** This macros defines the minor type for terminal +** symbols. +** YYMINORTYPE is the data type used for all minor types. +** This is typically a union of many types, one of +** which is ParseTOKENTYPE. The entry in the union +** for terminal symbols is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. If +** zero the stack is dynamically sized using realloc() +** ParseARG_SDECL A static variable declaration for the %extra_argument +** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_STORE Code to store %extra_argument into yypParser +** ParseARG_FETCH Code to extract %extra_argument from yypParser +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YY_MAX_SHIFT Maximum value for shift actions +** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +** YY_MIN_REDUCE Minimum value for reduce actions +** YY_MAX_REDUCE Maximum value for reduce actions +** YY_ERROR_ACTION The yy_action[] code for syntax error +** YY_ACCEPT_ACTION The yy_action[] code for accept +** YY_NO_ACTION The yy_action[] code for no-op +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/************* Begin control #defines *****************************************/ +%% +/************* End control #defines *******************************************/ + +/* Define the yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the yytestcase() macro should be turned off. But it is useful +** for testing. +*/ +#ifndef yytestcase +# define yytestcase(X) +#endif + + +/* Next are the tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +** +** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +** and YY_MAX_REDUCE +** +** N == YY_ERROR_ACTION A syntax error has occurred. +** +** N == YY_ACCEPT_ACTION The parser accepts its input. +** +** N == YY_NO_ACTION No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as either: +** +** (A) N = yy_action[ yy_shift_ofst[S] + X ] +** (B) N = yy_default[S] +** +** The (A) formula is preferred. The B formula is used instead if: +** (1) The yy_shift_ofst[S]+X value is out of range, or +** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or +** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT. +** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that +** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X. +** Hence only tests (1) and (2) need to be evaluated.) +** +** The formulas above are for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +** +*********** Begin parsing tables **********************************************/ +%% +/********** End of lemon-generated parsing tables *****************************/ + +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +%% +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. +*/ +struct yyStackEntry { + YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ + YYCODETYPE major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + yyStackEntry *yytos; /* Pointer to top element of the stack */ +#ifdef YYTRACKMAXSTACKDEPTH + int yyhwm; /* High-water mark of the stack */ +#endif +#ifndef YYNOERRORRECOVERY + int yyerrcnt; /* Shifts left before out of the error */ +#endif + ParseARG_SDECL /* A place to hold %extra_argument */ +#if YYSTACKDEPTH<=0 + int yystksz; /* Current side of the stack */ + yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ +#else + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ +#endif +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +**
    +**
  • A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +**
  • A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +**
+** +** Outputs: +** None. +*/ +void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { +%% +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { +%% +}; +#endif /* NDEBUG */ + + +#if YYSTACKDEPTH<=0 +/* +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. +*/ +static int yyGrowStack(yyParser *p){ + int newSize; + int idx; + yyStackEntry *pNew; + + newSize = p->yystksz*2 + 100; + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; + }else{ + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + } + if( pNew ){ + p->yystack = pNew; + p->yytos = &p->yystack[idx]; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); + } +#endif + p->yystksz = newSize; + } + return pNew==0; +} +#endif + +/* Datatype of the argument to the memory allocated passed as the +** second argument to ParseAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. +*/ +#ifndef YYMALLOCARGTYPE +# define YYMALLOCARGTYPE size_t +#endif + +/* Initialize a new parser that has already been allocated. +*/ +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; +#ifdef YYTRACKMAXSTACKDEPTH + pParser->yyhwm = 0; +#endif +#if YYSTACKDEPTH<=0 + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; + } +#endif +#ifndef YYNOERRORRECOVERY + pParser->yyerrcnt = -1; +#endif + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; +#if YYSTACKDEPTH>0 + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to Parse and ParseFree. +*/ +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); + return pParser; +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + + +/* The following function deletes the "minor type" or semantic value +** associated with a symbol. The symbol can be either a terminal +** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +** a pointer to the value to be deleted. The code used to do the +** deletions is derived from the %destructor and/or %token_destructor +** directives of the input grammar. +*/ +static void yy_destructor( + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ +){ + ParseARG_FETCH; + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ +/********* Begin destructor definitions ***************************************/ +%% +/********* End destructor definitions *****************************************/ + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +*/ +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yy_destructor(pParser, yytos->major, &yytos->minor); +} + +/* +** Clear all secondary memory allocations from the parser +*/ +void ParseFinalize(void *p){ + yyParser *pParser = (yyParser*)p; + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** Deallocate and destroy a parser. Destructors are called for +** all stack elements before shutting the parser down. +** +** If the YYPARSEFREENEVERNULL macro exists (for example because it +** is defined in a %include section of the input grammar) then it is +** assumed that the input pointer is never NULL. +*/ +void ParseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ +#ifndef YYPARSEFREENEVERNULL + if( p==0 ) return; +#endif + ParseFinalize(p); + (*freeProc)(p); +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + +/* +** Return the peak depth of the stack for a parser. +*/ +#ifdef YYTRACKMAXSTACKDEPTH +int ParseStackPeak(void *p){ + yyParser *pParser = (yyParser*)p; + return pParser->yyhwm; +} +#endif + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +*/ +static unsigned int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yytos->stateno; + + if( stateno>=YY_MIN_REDUCE ) return stateno; + assert( stateno <= YY_SHIFT_COUNT ); + do{ + i = yy_shift_ofst[stateno]; + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + YYCODETYPE iFallback; /* Fallback token */ + if( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ + iLookAhead = iFallback; + continue; + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } + }while(1); +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; +#ifdef YYERRORSYMBOL + if( stateno>YY_REDUCE_COUNT ){ + return yy_default[stateno]; + } +#else + assert( stateno<=YY_REDUCE_COUNT ); +#endif + i = yy_reduce_ofst[stateno]; + assert( i!=YY_REDUCE_USE_DFLT ); + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; +#ifdef YYERRORSYMBOL + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + } +#else + assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ +/******** Begin %stack_overflow code ******************************************/ +%% +/******** End %stack_overflow code ********************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ +} + +/* +** Print tracing information for a SHIFT action +*/ +#ifndef NDEBUG +static void yyTraceShift(yyParser *yypParser, int yyNewState){ + if( yyTraceFILE ){ + if( yyNewStateyytos->major], + yyNewState); + }else{ + fprintf(yyTraceFILE,"%sShift '%s'\n", + yyTracePrompt,yyTokenName[yypParser->yytos->major]); + } + } +} +#else +# define yyTraceShift(X,Y) +#endif + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yytos++; +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>yypParser->yystackEnd ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + if( yyGrowStack(yypParser) ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } + } +#endif + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos = yypParser->yytos; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; + yytos->minor.yy0 = yyMinor; + yyTraceShift(yypParser, yyNewState); +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ +} yyRuleInfo[] = { +%% +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + ParseARG_FETCH; + yymsp = yypParser->yytos; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfo[yyruleno].nrhs; + fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, + yyRuleName[yyruleno], yymsp[yysize].stateno); + } +#endif /* NDEBUG */ + + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if( yyRuleInfo[yyruleno].nrhs==0 ){ +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + return; + } + yymsp = yypParser->yytos; + } +#endif + } + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ +/********** Begin reduce actions **********************************************/ +%% +/********** End reduce actions ************************************************/ + }; + assert( yyrulenoYY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); + + /* It is not possible for a REDUCE to be followed by an error */ + assert( yyact!=YY_ERROR_ACTION ); + + if( yyact==YY_ACCEPT_ACTION ){ + yypParser->yytos += yysize; + yy_accept(yypParser); + }else{ + yymsp += yysize+1; + yypParser->yytos = yymsp; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yyTraceShift(yypParser, yyact); + } +} + +/* +** The following code executes when the parse fails +*/ +#ifndef YYNOERRORRECOVERY +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ +/************ Begin %parse_failure code ***************************************/ +%% +/************ End %parse_failure code *****************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} +#endif /* YYNOERRORRECOVERY */ + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ +){ + ParseARG_FETCH; +#define TOKEN yyminor +/************ Begin %syntax_error code ****************************************/ +%% +/************ End %syntax_error code ******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ +/*********** Begin %parse_accept code *****************************************/ +%% +/*********** End %parse_accept code *******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "ParseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. +*/ +void Parse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + unsigned int yyact; /* The parser action. */ +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + int yyendofinput; /* True if we are at the end of input */ +#endif +#ifdef YYERRORSYMBOL + int yyerrorhit = 0; /* True if yymajor has invoked an error */ +#endif + yyParser *yypParser; /* The parser */ + + yypParser = (yyParser*)yyp; + assert( yypParser->yytos!=0 ); +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + yyendofinput = (yymajor==0); +#endif + ParseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + if( yyact <= YY_MAX_SHIFTREDUCE ){ + yy_shift(yypParser,yyact,yymajor,yyminor); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt--; +#endif + yymajor = YYNOCODE; + }else if( yyact <= YY_MAX_REDUCE ){ + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + }else{ + assert( yyact == YY_ERROR_ACTION ); + yyminorunion.yy0 = yyminor; +#ifdef YYERRORSYMBOL + int yymx; +#endif +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminor); + } + yymx = yypParser->yytos->major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); + yymajor = YYNOCODE; + }else{ + while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) >= YY_MIN_REDUCE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#elif defined(YYNOERRORRECOVERY) + /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + yy_syntax_error(yypParser,yymajor, yyminor); + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yymajor = YYNOCODE; + +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor, yyminor); + } + yypParser->yyerrcnt = 3; + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + } + yymajor = YYNOCODE; +#endif + } + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); +#ifndef NDEBUG + if( yyTraceFILE ){ + yyStackEntry *i; + char cDiv = '['; + fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } + fprintf(yyTraceFILE,"]\n"); + } +#endif + return; +} diff --git a/3rdparty/bx/tools/bin/linux/bin2c b/3rdparty/bx/tools/bin/linux/bin2c index b862dae33a5..ca595d9f82a 100644 Binary files a/3rdparty/bx/tools/bin/linux/bin2c and b/3rdparty/bx/tools/bin/linux/bin2c differ diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie index 6ad828c40ae..6c662eada50 100755 Binary files a/3rdparty/bx/tools/bin/linux/genie and b/3rdparty/bx/tools/bin/linux/genie differ diff --git a/3rdparty/bx/tools/bin/linux/lemon b/3rdparty/bx/tools/bin/linux/lemon new file mode 100644 index 00000000000..64d24ce47ab Binary files /dev/null and b/3rdparty/bx/tools/bin/linux/lemon differ diff --git a/3rdparty/bx/tools/bin/linux/lempar.c b/3rdparty/bx/tools/bin/linux/lempar.c new file mode 100644 index 00000000000..da81ddd4bc0 --- /dev/null +++ b/3rdparty/bx/tools/bin/linux/lempar.c @@ -0,0 +1,981 @@ +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: +*/ +#include +/************ Begin %include sections from the grammar ************************/ +%% +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +%% +/**************** End makeheaders token definitions ***************************/ + +/* The next sections is a series of control #defines. +** various aspects of the generated parser. +** YYCODETYPE is the data type used to store the integer codes +** that represent terminal and non-terminal symbols. +** "unsigned char" is used if there are fewer than +** 256 symbols. Larger types otherwise. +** YYNOCODE is a number of type YYCODETYPE that is not used for +** any terminal or nonterminal symbol. +** YYFALLBACK If defined, this indicates that one or more tokens +** (also known as: "terminal symbols") have fall-back +** values which should be used if the original symbol +** would not parse. This permits keywords to sometimes +** be used as identifiers, for example. +** YYACTIONTYPE is the data type used for "action codes" - numbers +** that indicate what to do in response to the next +** token. +** ParseTOKENTYPE is the data type used for minor type for terminal +** symbols. Background: A "minor type" is a semantic +** value associated with a terminal or non-terminal +** symbols. For example, for an "ID" terminal symbol, +** the minor type might be the name of the identifier. +** Each non-terminal can have a different minor type. +** Terminal symbols all have the same minor type, though. +** This macros defines the minor type for terminal +** symbols. +** YYMINORTYPE is the data type used for all minor types. +** This is typically a union of many types, one of +** which is ParseTOKENTYPE. The entry in the union +** for terminal symbols is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. If +** zero the stack is dynamically sized using realloc() +** ParseARG_SDECL A static variable declaration for the %extra_argument +** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_STORE Code to store %extra_argument into yypParser +** ParseARG_FETCH Code to extract %extra_argument from yypParser +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YY_MAX_SHIFT Maximum value for shift actions +** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +** YY_MIN_REDUCE Minimum value for reduce actions +** YY_MAX_REDUCE Maximum value for reduce actions +** YY_ERROR_ACTION The yy_action[] code for syntax error +** YY_ACCEPT_ACTION The yy_action[] code for accept +** YY_NO_ACTION The yy_action[] code for no-op +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/************* Begin control #defines *****************************************/ +%% +/************* End control #defines *******************************************/ + +/* Define the yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the yytestcase() macro should be turned off. But it is useful +** for testing. +*/ +#ifndef yytestcase +# define yytestcase(X) +#endif + + +/* Next are the tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +** +** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +** and YY_MAX_REDUCE +** +** N == YY_ERROR_ACTION A syntax error has occurred. +** +** N == YY_ACCEPT_ACTION The parser accepts its input. +** +** N == YY_NO_ACTION No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as either: +** +** (A) N = yy_action[ yy_shift_ofst[S] + X ] +** (B) N = yy_default[S] +** +** The (A) formula is preferred. The B formula is used instead if: +** (1) The yy_shift_ofst[S]+X value is out of range, or +** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or +** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT. +** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that +** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X. +** Hence only tests (1) and (2) need to be evaluated.) +** +** The formulas above are for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +** +*********** Begin parsing tables **********************************************/ +%% +/********** End of lemon-generated parsing tables *****************************/ + +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +%% +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. +*/ +struct yyStackEntry { + YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ + YYCODETYPE major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + yyStackEntry *yytos; /* Pointer to top element of the stack */ +#ifdef YYTRACKMAXSTACKDEPTH + int yyhwm; /* High-water mark of the stack */ +#endif +#ifndef YYNOERRORRECOVERY + int yyerrcnt; /* Shifts left before out of the error */ +#endif + ParseARG_SDECL /* A place to hold %extra_argument */ +#if YYSTACKDEPTH<=0 + int yystksz; /* Current side of the stack */ + yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ +#else + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ +#endif +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +**
    +**
  • A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +**
  • A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +**
+** +** Outputs: +** None. +*/ +void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { +%% +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { +%% +}; +#endif /* NDEBUG */ + + +#if YYSTACKDEPTH<=0 +/* +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. +*/ +static int yyGrowStack(yyParser *p){ + int newSize; + int idx; + yyStackEntry *pNew; + + newSize = p->yystksz*2 + 100; + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; + }else{ + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + } + if( pNew ){ + p->yystack = pNew; + p->yytos = &p->yystack[idx]; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); + } +#endif + p->yystksz = newSize; + } + return pNew==0; +} +#endif + +/* Datatype of the argument to the memory allocated passed as the +** second argument to ParseAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. +*/ +#ifndef YYMALLOCARGTYPE +# define YYMALLOCARGTYPE size_t +#endif + +/* Initialize a new parser that has already been allocated. +*/ +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; +#ifdef YYTRACKMAXSTACKDEPTH + pParser->yyhwm = 0; +#endif +#if YYSTACKDEPTH<=0 + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; + } +#endif +#ifndef YYNOERRORRECOVERY + pParser->yyerrcnt = -1; +#endif + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; +#if YYSTACKDEPTH>0 + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to Parse and ParseFree. +*/ +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); + return pParser; +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + + +/* The following function deletes the "minor type" or semantic value +** associated with a symbol. The symbol can be either a terminal +** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +** a pointer to the value to be deleted. The code used to do the +** deletions is derived from the %destructor and/or %token_destructor +** directives of the input grammar. +*/ +static void yy_destructor( + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ +){ + ParseARG_FETCH; + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ +/********* Begin destructor definitions ***************************************/ +%% +/********* End destructor definitions *****************************************/ + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +*/ +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yy_destructor(pParser, yytos->major, &yytos->minor); +} + +/* +** Clear all secondary memory allocations from the parser +*/ +void ParseFinalize(void *p){ + yyParser *pParser = (yyParser*)p; + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** Deallocate and destroy a parser. Destructors are called for +** all stack elements before shutting the parser down. +** +** If the YYPARSEFREENEVERNULL macro exists (for example because it +** is defined in a %include section of the input grammar) then it is +** assumed that the input pointer is never NULL. +*/ +void ParseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ +#ifndef YYPARSEFREENEVERNULL + if( p==0 ) return; +#endif + ParseFinalize(p); + (*freeProc)(p); +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + +/* +** Return the peak depth of the stack for a parser. +*/ +#ifdef YYTRACKMAXSTACKDEPTH +int ParseStackPeak(void *p){ + yyParser *pParser = (yyParser*)p; + return pParser->yyhwm; +} +#endif + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +*/ +static unsigned int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yytos->stateno; + + if( stateno>=YY_MIN_REDUCE ) return stateno; + assert( stateno <= YY_SHIFT_COUNT ); + do{ + i = yy_shift_ofst[stateno]; + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + YYCODETYPE iFallback; /* Fallback token */ + if( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ + iLookAhead = iFallback; + continue; + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } + }while(1); +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; +#ifdef YYERRORSYMBOL + if( stateno>YY_REDUCE_COUNT ){ + return yy_default[stateno]; + } +#else + assert( stateno<=YY_REDUCE_COUNT ); +#endif + i = yy_reduce_ofst[stateno]; + assert( i!=YY_REDUCE_USE_DFLT ); + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; +#ifdef YYERRORSYMBOL + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + } +#else + assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ +/******** Begin %stack_overflow code ******************************************/ +%% +/******** End %stack_overflow code ********************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ +} + +/* +** Print tracing information for a SHIFT action +*/ +#ifndef NDEBUG +static void yyTraceShift(yyParser *yypParser, int yyNewState){ + if( yyTraceFILE ){ + if( yyNewStateyytos->major], + yyNewState); + }else{ + fprintf(yyTraceFILE,"%sShift '%s'\n", + yyTracePrompt,yyTokenName[yypParser->yytos->major]); + } + } +} +#else +# define yyTraceShift(X,Y) +#endif + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yytos++; +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>yypParser->yystackEnd ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + if( yyGrowStack(yypParser) ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } + } +#endif + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos = yypParser->yytos; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; + yytos->minor.yy0 = yyMinor; + yyTraceShift(yypParser, yyNewState); +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ +} yyRuleInfo[] = { +%% +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + ParseARG_FETCH; + yymsp = yypParser->yytos; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfo[yyruleno].nrhs; + fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, + yyRuleName[yyruleno], yymsp[yysize].stateno); + } +#endif /* NDEBUG */ + + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if( yyRuleInfo[yyruleno].nrhs==0 ){ +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + return; + } + yymsp = yypParser->yytos; + } +#endif + } + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ +/********** Begin reduce actions **********************************************/ +%% +/********** End reduce actions ************************************************/ + }; + assert( yyrulenoYY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); + + /* It is not possible for a REDUCE to be followed by an error */ + assert( yyact!=YY_ERROR_ACTION ); + + if( yyact==YY_ACCEPT_ACTION ){ + yypParser->yytos += yysize; + yy_accept(yypParser); + }else{ + yymsp += yysize+1; + yypParser->yytos = yymsp; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yyTraceShift(yypParser, yyact); + } +} + +/* +** The following code executes when the parse fails +*/ +#ifndef YYNOERRORRECOVERY +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ +/************ Begin %parse_failure code ***************************************/ +%% +/************ End %parse_failure code *****************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} +#endif /* YYNOERRORRECOVERY */ + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ +){ + ParseARG_FETCH; +#define TOKEN yyminor +/************ Begin %syntax_error code ****************************************/ +%% +/************ End %syntax_error code ******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ +/*********** Begin %parse_accept code *****************************************/ +%% +/*********** End %parse_accept code *******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "ParseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. +*/ +void Parse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + unsigned int yyact; /* The parser action. */ +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + int yyendofinput; /* True if we are at the end of input */ +#endif +#ifdef YYERRORSYMBOL + int yyerrorhit = 0; /* True if yymajor has invoked an error */ +#endif + yyParser *yypParser; /* The parser */ + + yypParser = (yyParser*)yyp; + assert( yypParser->yytos!=0 ); +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + yyendofinput = (yymajor==0); +#endif + ParseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + if( yyact <= YY_MAX_SHIFTREDUCE ){ + yy_shift(yypParser,yyact,yymajor,yyminor); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt--; +#endif + yymajor = YYNOCODE; + }else if( yyact <= YY_MAX_REDUCE ){ + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + }else{ + assert( yyact == YY_ERROR_ACTION ); + yyminorunion.yy0 = yyminor; +#ifdef YYERRORSYMBOL + int yymx; +#endif +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminor); + } + yymx = yypParser->yytos->major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); + yymajor = YYNOCODE; + }else{ + while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) >= YY_MIN_REDUCE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#elif defined(YYNOERRORRECOVERY) + /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + yy_syntax_error(yypParser,yymajor, yyminor); + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yymajor = YYNOCODE; + +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor, yyminor); + } + yypParser->yyerrcnt = 3; + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + } + yymajor = YYNOCODE; +#endif + } + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); +#ifndef NDEBUG + if( yyTraceFILE ){ + yyStackEntry *i; + char cDiv = '['; + fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } + fprintf(yyTraceFILE,"]\n"); + } +#endif + return; +} diff --git a/3rdparty/bx/tools/bin/windows/bin2c.exe b/3rdparty/bx/tools/bin/windows/bin2c.exe index 143fffd09dd..2c01cdd8065 100644 Binary files a/3rdparty/bx/tools/bin/windows/bin2c.exe and b/3rdparty/bx/tools/bin/windows/bin2c.exe differ diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe index 71dbb2e11e9..4b0426c3ddb 100644 Binary files a/3rdparty/bx/tools/bin/windows/genie.exe and b/3rdparty/bx/tools/bin/windows/genie.exe differ diff --git a/3rdparty/bx/tools/bin/windows/lemon.exe b/3rdparty/bx/tools/bin/windows/lemon.exe new file mode 100644 index 00000000000..5de0c8d6fda Binary files /dev/null and b/3rdparty/bx/tools/bin/windows/lemon.exe differ diff --git a/3rdparty/bx/tools/bin/windows/lempar.c b/3rdparty/bx/tools/bin/windows/lempar.c new file mode 100644 index 00000000000..da81ddd4bc0 --- /dev/null +++ b/3rdparty/bx/tools/bin/windows/lempar.c @@ -0,0 +1,981 @@ +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: +*/ +#include +/************ Begin %include sections from the grammar ************************/ +%% +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +%% +/**************** End makeheaders token definitions ***************************/ + +/* The next sections is a series of control #defines. +** various aspects of the generated parser. +** YYCODETYPE is the data type used to store the integer codes +** that represent terminal and non-terminal symbols. +** "unsigned char" is used if there are fewer than +** 256 symbols. Larger types otherwise. +** YYNOCODE is a number of type YYCODETYPE that is not used for +** any terminal or nonterminal symbol. +** YYFALLBACK If defined, this indicates that one or more tokens +** (also known as: "terminal symbols") have fall-back +** values which should be used if the original symbol +** would not parse. This permits keywords to sometimes +** be used as identifiers, for example. +** YYACTIONTYPE is the data type used for "action codes" - numbers +** that indicate what to do in response to the next +** token. +** ParseTOKENTYPE is the data type used for minor type for terminal +** symbols. Background: A "minor type" is a semantic +** value associated with a terminal or non-terminal +** symbols. For example, for an "ID" terminal symbol, +** the minor type might be the name of the identifier. +** Each non-terminal can have a different minor type. +** Terminal symbols all have the same minor type, though. +** This macros defines the minor type for terminal +** symbols. +** YYMINORTYPE is the data type used for all minor types. +** This is typically a union of many types, one of +** which is ParseTOKENTYPE. The entry in the union +** for terminal symbols is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. If +** zero the stack is dynamically sized using realloc() +** ParseARG_SDECL A static variable declaration for the %extra_argument +** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_STORE Code to store %extra_argument into yypParser +** ParseARG_FETCH Code to extract %extra_argument from yypParser +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YY_MAX_SHIFT Maximum value for shift actions +** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +** YY_MIN_REDUCE Minimum value for reduce actions +** YY_MAX_REDUCE Maximum value for reduce actions +** YY_ERROR_ACTION The yy_action[] code for syntax error +** YY_ACCEPT_ACTION The yy_action[] code for accept +** YY_NO_ACTION The yy_action[] code for no-op +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/************* Begin control #defines *****************************************/ +%% +/************* End control #defines *******************************************/ + +/* Define the yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the yytestcase() macro should be turned off. But it is useful +** for testing. +*/ +#ifndef yytestcase +# define yytestcase(X) +#endif + + +/* Next are the tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +** +** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +** and YY_MAX_REDUCE +** +** N == YY_ERROR_ACTION A syntax error has occurred. +** +** N == YY_ACCEPT_ACTION The parser accepts its input. +** +** N == YY_NO_ACTION No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as either: +** +** (A) N = yy_action[ yy_shift_ofst[S] + X ] +** (B) N = yy_default[S] +** +** The (A) formula is preferred. The B formula is used instead if: +** (1) The yy_shift_ofst[S]+X value is out of range, or +** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or +** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT. +** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that +** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X. +** Hence only tests (1) and (2) need to be evaluated.) +** +** The formulas above are for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +** +*********** Begin parsing tables **********************************************/ +%% +/********** End of lemon-generated parsing tables *****************************/ + +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +%% +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. +*/ +struct yyStackEntry { + YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ + YYCODETYPE major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + yyStackEntry *yytos; /* Pointer to top element of the stack */ +#ifdef YYTRACKMAXSTACKDEPTH + int yyhwm; /* High-water mark of the stack */ +#endif +#ifndef YYNOERRORRECOVERY + int yyerrcnt; /* Shifts left before out of the error */ +#endif + ParseARG_SDECL /* A place to hold %extra_argument */ +#if YYSTACKDEPTH<=0 + int yystksz; /* Current side of the stack */ + yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ +#else + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ +#endif +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +**
    +**
  • A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +**
  • A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +**
+** +** Outputs: +** None. +*/ +void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { +%% +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { +%% +}; +#endif /* NDEBUG */ + + +#if YYSTACKDEPTH<=0 +/* +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. +*/ +static int yyGrowStack(yyParser *p){ + int newSize; + int idx; + yyStackEntry *pNew; + + newSize = p->yystksz*2 + 100; + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; + }else{ + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + } + if( pNew ){ + p->yystack = pNew; + p->yytos = &p->yystack[idx]; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); + } +#endif + p->yystksz = newSize; + } + return pNew==0; +} +#endif + +/* Datatype of the argument to the memory allocated passed as the +** second argument to ParseAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. +*/ +#ifndef YYMALLOCARGTYPE +# define YYMALLOCARGTYPE size_t +#endif + +/* Initialize a new parser that has already been allocated. +*/ +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; +#ifdef YYTRACKMAXSTACKDEPTH + pParser->yyhwm = 0; +#endif +#if YYSTACKDEPTH<=0 + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; + } +#endif +#ifndef YYNOERRORRECOVERY + pParser->yyerrcnt = -1; +#endif + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; +#if YYSTACKDEPTH>0 + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to Parse and ParseFree. +*/ +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); + return pParser; +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + + +/* The following function deletes the "minor type" or semantic value +** associated with a symbol. The symbol can be either a terminal +** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +** a pointer to the value to be deleted. The code used to do the +** deletions is derived from the %destructor and/or %token_destructor +** directives of the input grammar. +*/ +static void yy_destructor( + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ +){ + ParseARG_FETCH; + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ +/********* Begin destructor definitions ***************************************/ +%% +/********* End destructor definitions *****************************************/ + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +*/ +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yy_destructor(pParser, yytos->major, &yytos->minor); +} + +/* +** Clear all secondary memory allocations from the parser +*/ +void ParseFinalize(void *p){ + yyParser *pParser = (yyParser*)p; + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** Deallocate and destroy a parser. Destructors are called for +** all stack elements before shutting the parser down. +** +** If the YYPARSEFREENEVERNULL macro exists (for example because it +** is defined in a %include section of the input grammar) then it is +** assumed that the input pointer is never NULL. +*/ +void ParseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ +#ifndef YYPARSEFREENEVERNULL + if( p==0 ) return; +#endif + ParseFinalize(p); + (*freeProc)(p); +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + +/* +** Return the peak depth of the stack for a parser. +*/ +#ifdef YYTRACKMAXSTACKDEPTH +int ParseStackPeak(void *p){ + yyParser *pParser = (yyParser*)p; + return pParser->yyhwm; +} +#endif + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +*/ +static unsigned int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yytos->stateno; + + if( stateno>=YY_MIN_REDUCE ) return stateno; + assert( stateno <= YY_SHIFT_COUNT ); + do{ + i = yy_shift_ofst[stateno]; + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + YYCODETYPE iFallback; /* Fallback token */ + if( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ + iLookAhead = iFallback; + continue; + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } + }while(1); +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; +#ifdef YYERRORSYMBOL + if( stateno>YY_REDUCE_COUNT ){ + return yy_default[stateno]; + } +#else + assert( stateno<=YY_REDUCE_COUNT ); +#endif + i = yy_reduce_ofst[stateno]; + assert( i!=YY_REDUCE_USE_DFLT ); + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; +#ifdef YYERRORSYMBOL + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + } +#else + assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ +/******** Begin %stack_overflow code ******************************************/ +%% +/******** End %stack_overflow code ********************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ +} + +/* +** Print tracing information for a SHIFT action +*/ +#ifndef NDEBUG +static void yyTraceShift(yyParser *yypParser, int yyNewState){ + if( yyTraceFILE ){ + if( yyNewStateyytos->major], + yyNewState); + }else{ + fprintf(yyTraceFILE,"%sShift '%s'\n", + yyTracePrompt,yyTokenName[yypParser->yytos->major]); + } + } +} +#else +# define yyTraceShift(X,Y) +#endif + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yytos++; +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>yypParser->yystackEnd ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + if( yyGrowStack(yypParser) ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } + } +#endif + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos = yypParser->yytos; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; + yytos->minor.yy0 = yyMinor; + yyTraceShift(yypParser, yyNewState); +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ +} yyRuleInfo[] = { +%% +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + ParseARG_FETCH; + yymsp = yypParser->yytos; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfo[yyruleno].nrhs; + fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, + yyRuleName[yyruleno], yymsp[yysize].stateno); + } +#endif /* NDEBUG */ + + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if( yyRuleInfo[yyruleno].nrhs==0 ){ +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + return; + } + yymsp = yypParser->yytos; + } +#endif + } + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ +/********** Begin reduce actions **********************************************/ +%% +/********** End reduce actions ************************************************/ + }; + assert( yyrulenoYY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); + + /* It is not possible for a REDUCE to be followed by an error */ + assert( yyact!=YY_ERROR_ACTION ); + + if( yyact==YY_ACCEPT_ACTION ){ + yypParser->yytos += yysize; + yy_accept(yypParser); + }else{ + yymsp += yysize+1; + yypParser->yytos = yymsp; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yyTraceShift(yypParser, yyact); + } +} + +/* +** The following code executes when the parse fails +*/ +#ifndef YYNOERRORRECOVERY +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ +/************ Begin %parse_failure code ***************************************/ +%% +/************ End %parse_failure code *****************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} +#endif /* YYNOERRORRECOVERY */ + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ +){ + ParseARG_FETCH; +#define TOKEN yyminor +/************ Begin %syntax_error code ****************************************/ +%% +/************ End %syntax_error code ******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ +/*********** Begin %parse_accept code *****************************************/ +%% +/*********** End %parse_accept code *******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "ParseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. +*/ +void Parse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + unsigned int yyact; /* The parser action. */ +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + int yyendofinput; /* True if we are at the end of input */ +#endif +#ifdef YYERRORSYMBOL + int yyerrorhit = 0; /* True if yymajor has invoked an error */ +#endif + yyParser *yypParser; /* The parser */ + + yypParser = (yyParser*)yyp; + assert( yypParser->yytos!=0 ); +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + yyendofinput = (yymajor==0); +#endif + ParseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + if( yyact <= YY_MAX_SHIFTREDUCE ){ + yy_shift(yypParser,yyact,yymajor,yyminor); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt--; +#endif + yymajor = YYNOCODE; + }else if( yyact <= YY_MAX_REDUCE ){ + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + }else{ + assert( yyact == YY_ERROR_ACTION ); + yyminorunion.yy0 = yyminor; +#ifdef YYERRORSYMBOL + int yymx; +#endif +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminor); + } + yymx = yypParser->yytos->major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); + yymajor = YYNOCODE; + }else{ + while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) >= YY_MIN_REDUCE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#elif defined(YYNOERRORRECOVERY) + /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + yy_syntax_error(yypParser,yymajor, yyminor); + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yymajor = YYNOCODE; + +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor, yyminor); + } + yypParser->yyerrcnt = 3; + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + } + yymajor = YYNOCODE; +#endif + } + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); +#ifndef NDEBUG + if( yyTraceFILE ){ + yyStackEntry *i; + char cDiv = '['; + fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } + fprintf(yyTraceFILE,"]\n"); + } +#endif + return; +} diff --git a/3rdparty/bx/tools/bin2c/bin2c.cpp b/3rdparty/bx/tools/bin2c/bin2c.cpp index 414bce62a87..2c7f48d1de0 100644 --- a/3rdparty/bx/tools/bin2c/bin2c.cpp +++ b/3rdparty/bx/tools/bin2c/bin2c.cpp @@ -1,11 +1,9 @@ /* - * Copyright 2011-2017 Branimir Karadzic. All rights reserved. + * Copyright 2011-2018 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bx#license-bsd-2-clause */ -#include -#include - +#include #include #include #include @@ -13,8 +11,9 @@ class Bin2cWriter : public bx::WriterI { public: - Bin2cWriter(bx::WriterI* _writer, const char* _name) - : m_writer(_writer) + Bin2cWriter(bx::AllocatorI* _allocator, const bx::StringView& _name) + : m_mb(_allocator) + , m_mw(&m_mb) , m_name(_name) { } @@ -23,22 +22,29 @@ public: { } - virtual int32_t write(const void* _data, int32_t _size, bx::Error* /*_err*/ = NULL) override + virtual int32_t write(const void* _data, int32_t _size, bx::Error* _err) override { - const char* data = (const char*)_data; - m_buffer.insert(m_buffer.end(), data, data+_size); - return _size; + return bx::write(&m_mw, _data, _size, _err); } - void finish() + void output(bx::WriterI* m_writer) { #define HEX_DUMP_WIDTH 16 #define HEX_DUMP_SPACE_WIDTH 96 #define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s" - const uint8_t* data = &m_buffer[0]; - uint32_t size = (uint32_t)m_buffer.size(); + const char* data = (const char*)m_mb.more(0); + uint32_t size = uint32_t(bx::seek(&m_mw) ); - bx::writePrintf(m_writer, "static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size); + bx::Error err; + + bx::write( + m_writer + , &err + , "static const uint8_t %.*s[%d] =\n{\n" + , m_name.getLength() + , m_name.getPtr() + , size + ); if (NULL != data) { @@ -51,13 +57,13 @@ public: bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]); hexPos += 6; - ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.'; + ascii[asciiPos] = bx::isPrint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.'; asciiPos++; if (HEX_DUMP_WIDTH == asciiPos) { ascii[asciiPos] = '\0'; - bx::writePrintf(m_writer, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + bx::write(m_writer, &err, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); data += asciiPos; hexPos = 0; asciiPos = 0; @@ -67,54 +73,49 @@ public: if (0 != asciiPos) { ascii[asciiPos] = '\0'; - bx::writePrintf(m_writer, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); + bx::write(m_writer, &err, "\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii); } } - bx::writePrintf(m_writer, "};\n"); + bx::write(m_writer, &err, "};\n"); #undef HEX_DUMP_WIDTH #undef HEX_DUMP_SPACE_WIDTH #undef HEX_DUMP_FORMAT - - m_buffer.clear(); } - bx::WriterI* m_writer; - std::string m_name; - typedef std::vector Buffer; - Buffer m_buffer; + bx::MemoryBlock m_mb; + bx::MemoryWriter m_mw; + bx::StringView m_name; }; void help(const char* _error = NULL) { bx::WriterI* stdOut = bx::getStdOut(); + bx::Error err; if (NULL != _error) { - bx::writePrintf(stdOut, "Error:\n%s\n\n", _error); + bx::write(stdOut, &err, "Error:\n%s\n\n", _error); } - bx::writePrintf(stdOut + bx::write(stdOut, &err , "bin2c, binary to C\n" - "Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n" + "Copyright 2011-2018 Branimir Karadzic. All rights reserved.\n" "License: https://github.com/bkaradzic/bx#license-bsd-2-clause\n\n" ); - bx::writePrintf(stdOut + bx::write(stdOut, &err , "Usage: bin2c -f -o -n \n" - "\n" "Options:\n" " -f Input file path.\n" " -o Output file path.\n" " -n Array name.\n" - "\n" "For additional information, see https://github.com/bkaradzic/bx\n" ); } - int main(int _argc, const char* _argv[]) { bx::CommandLine cmdLine(_argc, _argv); @@ -125,24 +126,24 @@ int main(int _argc, const char* _argv[]) return bx::kExitFailure; } - const char* filePath = cmdLine.findOption('f'); - if (NULL == filePath) + bx::FilePath filePath = cmdLine.findOption('f'); + if (filePath.isEmpty() ) { help("Input file name must be specified."); return bx::kExitFailure; } - const char* outFilePath = cmdLine.findOption('o'); - if (NULL == outFilePath) + bx::FilePath outFilePath = cmdLine.findOption('o'); + if (outFilePath.isEmpty() ) { help("Output file name must be specified."); return bx::kExitFailure; } - const char* name = cmdLine.findOption('n'); - if (NULL == name) + bx::StringView name = cmdLine.findOption('n'); + if (name.isEmpty() ) { - name = "data"; + name.set("data"); } void* data = NULL; @@ -156,13 +157,15 @@ int main(int _argc, const char* _argv[]) bx::DefaultAllocator allocator; data = BX_ALLOC(&allocator, size); bx::read(&fr, data, size); + bx::close(&fr); bx::FileWriter fw; if (bx::open(&fw, outFilePath) ) { - Bin2cWriter writer(&fw, name); + Bin2cWriter writer(&allocator, name); bx::write(&writer, data, size); - writer.finish(); + + writer.output(&fw); bx::close(&fw); } diff --git a/3rdparty/bx/tools/lemon/lemon.c b/3rdparty/bx/tools/lemon/lemon.c new file mode 100644 index 00000000000..acc5450c993 --- /dev/null +++ b/3rdparty/bx/tools/lemon/lemon.c @@ -0,0 +1,5466 @@ +/* +** This file contains all sources (including headers) to the LEMON +** LALR(1) parser generator. The sources have been combined into a +** single file to make it easy to include LEMON in the source tree +** and Makefile of another program. +** +** The author of this program disclaims copyright. +*/ +#include +#include +#include +#include +#include +#include + +#define ISSPACE(X) isspace((unsigned char)(X)) +#define ISDIGIT(X) isdigit((unsigned char)(X)) +#define ISALNUM(X) isalnum((unsigned char)(X)) +#define ISALPHA(X) isalpha((unsigned char)(X)) +#define ISUPPER(X) isupper((unsigned char)(X)) +#define ISLOWER(X) islower((unsigned char)(X)) + + +#ifndef __WIN32__ +# if defined(_WIN32) || defined(WIN32) +# define __WIN32__ +# endif +#endif + +#ifdef __WIN32__ +#ifdef __cplusplus +extern "C" { +#endif +extern int access(const char *path, int mode); +#ifdef __cplusplus +} +#endif +#else +#include +#endif + +/* #define PRIVATE static */ +#define PRIVATE + +#ifdef TEST +#define MAXRHS 5 /* Set low to exercise exception code */ +#else +#define MAXRHS 1000 +#endif + +static int showPrecedenceConflict = 0; +static char *msort(char*,char**,int(*)(const char*,const char*)); + +/* +** Compilers are getting increasingly pedantic about type conversions +** as C evolves ever closer to Ada.... To work around the latest problems +** we have to define the following variant of strlen(). +*/ +#define lemonStrlen(X) ((int)strlen(X)) + +/* +** Compilers are starting to complain about the use of sprintf() and strcpy(), +** saying they are unsafe. So we define our own versions of those routines too. +** +** There are three routines here: lemon_sprintf(), lemon_vsprintf(), and +** lemon_addtext(). The first two are replacements for sprintf() and vsprintf(). +** The third is a helper routine for vsnprintf() that adds texts to the end of a +** buffer, making sure the buffer is always zero-terminated. +** +** The string formatter is a minimal subset of stdlib sprintf() supporting only +** a few simply conversions: +** +** %d +** %s +** %.*s +** +*/ +static void lemon_addtext( + char *zBuf, /* The buffer to which text is added */ + int *pnUsed, /* Slots of the buffer used so far */ + const char *zIn, /* Text to add */ + int nIn, /* Bytes of text to add. -1 to use strlen() */ + int iWidth /* Field width. Negative to left justify */ +){ + if( nIn<0 ) for(nIn=0; zIn[nIn]; nIn++){} + while( iWidth>nIn ){ zBuf[(*pnUsed)++] = ' '; iWidth--; } + if( nIn==0 ) return; + memcpy(&zBuf[*pnUsed], zIn, nIn); + *pnUsed += nIn; + while( (-iWidth)>nIn ){ zBuf[(*pnUsed)++] = ' '; iWidth++; } + zBuf[*pnUsed] = 0; +} +static int lemon_vsprintf(char *str, const char *zFormat, va_list ap){ + int i, j, k, c; + int nUsed = 0; + const char *z; + char zTemp[50]; + str[0] = 0; + for(i=j=0; (c = zFormat[i])!=0; i++){ + if( c=='%' ){ + int iWidth = 0; + lemon_addtext(str, &nUsed, &zFormat[j], i-j, 0); + c = zFormat[++i]; + if( ISDIGIT(c) || (c=='-' && ISDIGIT(zFormat[i+1])) ){ + if( c=='-' ) i++; + while( ISDIGIT(zFormat[i]) ) iWidth = iWidth*10 + zFormat[i++] - '0'; + if( c=='-' ) iWidth = -iWidth; + c = zFormat[i]; + } + if( c=='d' ){ + int v = va_arg(ap, int); + if( v<0 ){ + lemon_addtext(str, &nUsed, "-", 1, iWidth); + v = -v; + }else if( v==0 ){ + lemon_addtext(str, &nUsed, "0", 1, iWidth); + } + k = 0; + while( v>0 ){ + k++; + zTemp[sizeof(zTemp)-k] = (v%10) + '0'; + v /= 10; + } + lemon_addtext(str, &nUsed, &zTemp[sizeof(zTemp)-k], k, iWidth); + }else if( c=='s' ){ + z = va_arg(ap, const char*); + lemon_addtext(str, &nUsed, z, -1, iWidth); + }else if( c=='.' && memcmp(&zFormat[i], ".*s", 3)==0 ){ + i += 2; + k = va_arg(ap, int); + z = va_arg(ap, const char*); + lemon_addtext(str, &nUsed, z, k, iWidth); + }else if( c=='%' ){ + lemon_addtext(str, &nUsed, "%", 1, 0); + }else{ + fprintf(stderr, "illegal format\n"); + exit(1); + } + j = i+1; + } + } + lemon_addtext(str, &nUsed, &zFormat[j], i-j, 0); + return nUsed; +} +static int lemon_sprintf(char *str, const char *format, ...){ + va_list ap; + int rc; + va_start(ap, format); + rc = lemon_vsprintf(str, format, ap); + va_end(ap); + return rc; +} +static void lemon_strcpy(char *dest, const char *src){ + while( (*(dest++) = *(src++))!=0 ){} +} +static void lemon_strcat(char *dest, const char *src){ + while( *dest ) dest++; + lemon_strcpy(dest, src); +} + + +/* a few forward declarations... */ +struct rule; +struct lemon; +struct action; + +static struct action *Action_new(void); +static struct action *Action_sort(struct action *); + +/********** From the file "build.h" ************************************/ +void FindRulePrecedences(struct lemon*); +void FindFirstSets(struct lemon*); +void FindStates(struct lemon*); +void FindLinks(struct lemon*); +void FindFollowSets(struct lemon*); +void FindActions(struct lemon*); + +/********* From the file "configlist.h" *********************************/ +void Configlist_init(void); +struct config *Configlist_add(struct rule *, int); +struct config *Configlist_addbasis(struct rule *, int); +void Configlist_closure(struct lemon *); +void Configlist_sort(void); +void Configlist_sortbasis(void); +struct config *Configlist_return(void); +struct config *Configlist_basis(void); +void Configlist_eat(struct config *); +void Configlist_reset(void); + +/********* From the file "error.h" ***************************************/ +void ErrorMsg(const char *, int,const char *, ...); + +/****** From the file "option.h" ******************************************/ +enum option_type { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, + OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR}; +struct s_options { + enum option_type type; + const char *label; + char *arg; + const char *message; +}; +int OptInit(char**,struct s_options*,FILE*); +int OptNArgs(void); +char *OptArg(int); +void OptErr(int); +void OptPrint(void); + +/******** From the file "parse.h" *****************************************/ +void Parse(struct lemon *lemp); + +/********* From the file "plink.h" ***************************************/ +struct plink *Plink_new(void); +void Plink_add(struct plink **, struct config *); +void Plink_copy(struct plink **, struct plink *); +void Plink_delete(struct plink *); + +/********** From the file "report.h" *************************************/ +void Reprint(struct lemon *); +void ReportOutput(struct lemon *); +void ReportTable(struct lemon *, int); +void ReportHeader(struct lemon *); +void CompressTables(struct lemon *); +void ResortStates(struct lemon *); + +/********** From the file "set.h" ****************************************/ +void SetSize(int); /* All sets will be of size N */ +char *SetNew(void); /* A new set for element 0..N */ +void SetFree(char*); /* Deallocate a set */ +int SetAdd(char*,int); /* Add element to a set */ +int SetUnion(char *,char *); /* A <- A U B, thru element N */ +#define SetFind(X,Y) (X[Y]) /* True if Y is in set X */ + +/********** From the file "struct.h" *************************************/ +/* +** Principal data structures for the LEMON parser generator. +*/ + +typedef enum {LEMON_FALSE=0, LEMON_TRUE} Boolean; + +/* Symbols (terminals and nonterminals) of the grammar are stored +** in the following: */ +enum symbol_type { + TERMINAL, + NONTERMINAL, + MULTITERMINAL +}; +enum e_assoc { + LEFT, + RIGHT, + NONE, + UNK +}; +struct symbol { + const char *name; /* Name of the symbol */ + int index; /* Index number for this symbol */ + enum symbol_type type; /* Symbols are all either TERMINALS or NTs */ + struct rule *rule; /* Linked list of rules of this (if an NT) */ + struct symbol *fallback; /* fallback token in case this token doesn't parse */ + int prec; /* Precedence if defined (-1 otherwise) */ + enum e_assoc assoc; /* Associativity if precedence is defined */ + char *firstset; /* First-set for all rules of this symbol */ + Boolean lambda; /* True if NT and can generate an empty string */ + int useCnt; /* Number of times used */ + char *destructor; /* Code which executes whenever this symbol is + ** popped from the stack during error processing */ + int destLineno; /* Line number for start of destructor. Set to + ** -1 for duplicate destructors. */ + char *datatype; /* The data type of information held by this + ** object. Only used if type==NONTERMINAL */ + int dtnum; /* The data type number. In the parser, the value + ** stack is a union. The .yy%d element of this + ** union is the correct data type for this object */ + /* The following fields are used by MULTITERMINALs only */ + int nsubsym; /* Number of constituent symbols in the MULTI */ + struct symbol **subsym; /* Array of constituent symbols */ +}; + +/* Each production rule in the grammar is stored in the following +** structure. */ +struct rule { + struct symbol *lhs; /* Left-hand side of the rule */ + const char *lhsalias; /* Alias for the LHS (NULL if none) */ + int lhsStart; /* True if left-hand side is the start symbol */ + int ruleline; /* Line number for the rule */ + int nrhs; /* Number of RHS symbols */ + struct symbol **rhs; /* The RHS symbols */ + const char **rhsalias; /* An alias for each RHS symbol (NULL if none) */ + int line; /* Line number at which code begins */ + const char *code; /* The code executed when this rule is reduced */ + const char *codePrefix; /* Setup code before code[] above */ + const char *codeSuffix; /* Breakdown code after code[] above */ + int noCode; /* True if this rule has no associated C code */ + int codeEmitted; /* True if the code has been emitted already */ + struct symbol *precsym; /* Precedence symbol for this rule */ + int index; /* An index number for this rule */ + int iRule; /* Rule number as used in the generated tables */ + Boolean canReduce; /* True if this rule is ever reduced */ + Boolean doesReduce; /* Reduce actions occur after optimization */ + struct rule *nextlhs; /* Next rule with the same LHS */ + struct rule *next; /* Next rule in the global list */ +}; + +/* A configuration is a production rule of the grammar together with +** a mark (dot) showing how much of that rule has been processed so far. +** Configurations also contain a follow-set which is a list of terminal +** symbols which are allowed to immediately follow the end of the rule. +** Every configuration is recorded as an instance of the following: */ +enum cfgstatus { + COMPLETE, + INCOMPLETE +}; +struct config { + struct rule *rp; /* The rule upon which the configuration is based */ + int dot; /* The parse point */ + char *fws; /* Follow-set for this configuration only */ + struct plink *fplp; /* Follow-set forward propagation links */ + struct plink *bplp; /* Follow-set backwards propagation links */ + struct state *stp; /* Pointer to state which contains this */ + enum cfgstatus status; /* used during followset and shift computations */ + struct config *next; /* Next configuration in the state */ + struct config *bp; /* The next basis configuration */ +}; + +enum e_action { + SHIFT, + ACCEPT, + REDUCE, + ERROR, + SSCONFLICT, /* A shift/shift conflict */ + SRCONFLICT, /* Was a reduce, but part of a conflict */ + RRCONFLICT, /* Was a reduce, but part of a conflict */ + SH_RESOLVED, /* Was a shift. Precedence resolved conflict */ + RD_RESOLVED, /* Was reduce. Precedence resolved conflict */ + NOT_USED, /* Deleted by compression */ + SHIFTREDUCE /* Shift first, then reduce */ +}; + +/* Every shift or reduce operation is stored as one of the following */ +struct action { + struct symbol *sp; /* The look-ahead symbol */ + enum e_action type; + union { + struct state *stp; /* The new state, if a shift */ + struct rule *rp; /* The rule, if a reduce */ + } x; + struct symbol *spOpt; /* SHIFTREDUCE optimization to this symbol */ + struct action *next; /* Next action for this state */ + struct action *collide; /* Next action with the same hash */ +}; + +/* Each state of the generated parser's finite state machine +** is encoded as an instance of the following structure. */ +struct state { + struct config *bp; /* The basis configurations for this state */ + struct config *cfp; /* All configurations in this set */ + int statenum; /* Sequential number for this state */ + struct action *ap; /* List of actions for this state */ + int nTknAct, nNtAct; /* Number of actions on terminals and nonterminals */ + int iTknOfst, iNtOfst; /* yy_action[] offset for terminals and nonterms */ + int iDfltReduce; /* Default action is to REDUCE by this rule */ + struct rule *pDfltReduce;/* The default REDUCE rule. */ + int autoReduce; /* True if this is an auto-reduce state */ +}; +#define NO_OFFSET (-2147483647) + +/* A followset propagation link indicates that the contents of one +** configuration followset should be propagated to another whenever +** the first changes. */ +struct plink { + struct config *cfp; /* The configuration to which linked */ + struct plink *next; /* The next propagate link */ +}; + +/* The state vector for the entire parser generator is recorded as +** follows. (LEMON uses no global variables and makes little use of +** static variables. Fields in the following structure can be thought +** of as begin global variables in the program.) */ +struct lemon { + struct state **sorted; /* Table of states sorted by state number */ + struct rule *rule; /* List of all rules */ + struct rule *startRule; /* First rule */ + int nstate; /* Number of states */ + int nxstate; /* nstate with tail degenerate states removed */ + int nrule; /* Number of rules */ + int nsymbol; /* Number of terminal and nonterminal symbols */ + int nterminal; /* Number of terminal symbols */ + struct symbol **symbols; /* Sorted array of pointers to symbols */ + int errorcnt; /* Number of errors */ + struct symbol *errsym; /* The error symbol */ + struct symbol *wildcard; /* Token that matches anything */ + char *name; /* Name of the generated parser */ + char *arg; /* Declaration of the 3th argument to parser */ + char *tokentype; /* Type of terminal symbols in the parser stack */ + char *vartype; /* The default type of non-terminal symbols */ + char *start; /* Name of the start symbol for the grammar */ + char *stacksize; /* Size of the parser stack */ + char *include; /* Code to put at the start of the C file */ + char *error; /* Code to execute when an error is seen */ + char *overflow; /* Code to execute on a stack overflow */ + char *failure; /* Code to execute on parser failure */ + char *accept; /* Code to execute when the parser excepts */ + char *extracode; /* Code appended to the generated file */ + char *tokendest; /* Code to execute to destroy token data */ + char *vardest; /* Code for the default non-terminal destructor */ + char *filename; /* Name of the input file */ + char *outname; /* Name of the current output file */ + char *tokenprefix; /* A prefix added to token names in the .h file */ + int nconflict; /* Number of parsing conflicts */ + int nactiontab; /* Number of entries in the yy_action[] table */ + int tablesize; /* Total table size of all tables in bytes */ + int basisflag; /* Print only basis configurations */ + int has_fallback; /* True if any %fallback is seen in the grammar */ + int nolinenosflag; /* True if #line statements should not be printed */ + char *argv0; /* Name of the program */ +}; + +#define MemoryCheck(X) if((X)==0){ \ + extern void memory_error(); \ + memory_error(); \ +} + +/**************** From the file "table.h" *********************************/ +/* +** All code in this file has been automatically generated +** from a specification in the file +** "table.q" +** by the associative array code building program "aagen". +** Do not edit this file! Instead, edit the specification +** file, then rerun aagen. +*/ +/* +** Code for processing tables in the LEMON parser generator. +*/ +/* Routines for handling a strings */ + +const char *Strsafe(const char *); + +void Strsafe_init(void); +int Strsafe_insert(const char *); +const char *Strsafe_find(const char *); + +/* Routines for handling symbols of the grammar */ + +struct symbol *Symbol_new(const char *); +int Symbolcmpp(const void *, const void *); +void Symbol_init(void); +int Symbol_insert(struct symbol *, const char *); +struct symbol *Symbol_find(const char *); +struct symbol *Symbol_Nth(int); +int Symbol_count(void); +struct symbol **Symbol_arrayof(void); + +/* Routines to manage the state table */ + +int Configcmp(const char *, const char *); +struct state *State_new(void); +void State_init(void); +int State_insert(struct state *, struct config *); +struct state *State_find(struct config *); +struct state **State_arrayof(void); + +/* Routines used for efficiency in Configlist_add */ + +void Configtable_init(void); +int Configtable_insert(struct config *); +struct config *Configtable_find(struct config *); +void Configtable_clear(int(*)(struct config *)); + +/****************** From the file "action.c" *******************************/ +/* +** Routines processing parser actions in the LEMON parser generator. +*/ + +/* Allocate a new parser action */ +static struct action *Action_new(void){ + static struct action *freelist = 0; + struct action *newaction; + + if( freelist==0 ){ + int i; + int amt = 100; + freelist = (struct action *)calloc(amt, sizeof(struct action)); + if( freelist==0 ){ + fprintf(stderr,"Unable to allocate memory for a new parser action."); + exit(1); + } + for(i=0; inext; + return newaction; +} + +/* Compare two actions for sorting purposes. Return negative, zero, or +** positive if the first action is less than, equal to, or greater than +** the first +*/ +static int actioncmp( + struct action *ap1, + struct action *ap2 +){ + int rc; + rc = ap1->sp->index - ap2->sp->index; + if( rc==0 ){ + rc = (int)ap1->type - (int)ap2->type; + } + if( rc==0 && (ap1->type==REDUCE || ap1->type==SHIFTREDUCE) ){ + rc = ap1->x.rp->index - ap2->x.rp->index; + } + if( rc==0 ){ + rc = (int) (ap2 - ap1); + } + return rc; +} + +/* Sort parser actions */ +static struct action *Action_sort( + struct action *ap +){ + ap = (struct action *)msort((char *)ap,(char **)&ap->next, + (int(*)(const char*,const char*))actioncmp); + return ap; +} + +void Action_add( + struct action **app, + enum e_action type, + struct symbol *sp, + char *arg +){ + struct action *newaction; + newaction = Action_new(); + newaction->next = *app; + *app = newaction; + newaction->type = type; + newaction->sp = sp; + newaction->spOpt = 0; + if( type==SHIFT ){ + newaction->x.stp = (struct state *)arg; + }else{ + newaction->x.rp = (struct rule *)arg; + } +} +/********************** New code to implement the "acttab" module ***********/ +/* +** This module implements routines use to construct the yy_action[] table. +*/ + +/* +** The state of the yy_action table under construction is an instance of +** the following structure. +** +** The yy_action table maps the pair (state_number, lookahead) into an +** action_number. The table is an array of integers pairs. The state_number +** determines an initial offset into the yy_action array. The lookahead +** value is then added to this initial offset to get an index X into the +** yy_action array. If the aAction[X].lookahead equals the value of the +** of the lookahead input, then the value of the action_number output is +** aAction[X].action. If the lookaheads do not match then the +** default action for the state_number is returned. +** +** All actions associated with a single state_number are first entered +** into aLookahead[] using multiple calls to acttab_action(). Then the +** actions for that single state_number are placed into the aAction[] +** array with a single call to acttab_insert(). The acttab_insert() call +** also resets the aLookahead[] array in preparation for the next +** state number. +*/ +struct lookahead_action { + int lookahead; /* Value of the lookahead token */ + int action; /* Action to take on the given lookahead */ +}; +typedef struct acttab acttab; +struct acttab { + int nAction; /* Number of used slots in aAction[] */ + int nActionAlloc; /* Slots allocated for aAction[] */ + struct lookahead_action + *aAction, /* The yy_action[] table under construction */ + *aLookahead; /* A single new transaction set */ + int mnLookahead; /* Minimum aLookahead[].lookahead */ + int mnAction; /* Action associated with mnLookahead */ + int mxLookahead; /* Maximum aLookahead[].lookahead */ + int nLookahead; /* Used slots in aLookahead[] */ + int nLookaheadAlloc; /* Slots allocated in aLookahead[] */ +}; + +/* Return the number of entries in the yy_action table */ +#define acttab_size(X) ((X)->nAction) + +/* The value for the N-th entry in yy_action */ +#define acttab_yyaction(X,N) ((X)->aAction[N].action) + +/* The value for the N-th entry in yy_lookahead */ +#define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) + +/* Free all memory associated with the given acttab */ +void acttab_free(acttab *p){ + free( p->aAction ); + free( p->aLookahead ); + free( p ); +} + +/* Allocate a new acttab structure */ +acttab *acttab_alloc(void){ + acttab *p = (acttab *) calloc( 1, sizeof(*p) ); + if( p==0 ){ + fprintf(stderr,"Unable to allocate memory for a new acttab."); + exit(1); + } + memset(p, 0, sizeof(*p)); + return p; +} + +/* Add a new action to the current transaction set. +** +** This routine is called once for each lookahead for a particular +** state. +*/ +void acttab_action(acttab *p, int lookahead, int action){ + if( p->nLookahead>=p->nLookaheadAlloc ){ + p->nLookaheadAlloc += 25; + p->aLookahead = (struct lookahead_action *) realloc( p->aLookahead, + sizeof(p->aLookahead[0])*p->nLookaheadAlloc ); + if( p->aLookahead==0 ){ + fprintf(stderr,"malloc failed\n"); + exit(1); + } + } + if( p->nLookahead==0 ){ + p->mxLookahead = lookahead; + p->mnLookahead = lookahead; + p->mnAction = action; + }else{ + if( p->mxLookaheadmxLookahead = lookahead; + if( p->mnLookahead>lookahead ){ + p->mnLookahead = lookahead; + p->mnAction = action; + } + } + p->aLookahead[p->nLookahead].lookahead = lookahead; + p->aLookahead[p->nLookahead].action = action; + p->nLookahead++; +} + +/* +** Add the transaction set built up with prior calls to acttab_action() +** into the current action table. Then reset the transaction set back +** to an empty set in preparation for a new round of acttab_action() calls. +** +** Return the offset into the action table of the new transaction. +*/ +int acttab_insert(acttab *p){ + int i, j, k, n; + assert( p->nLookahead>0 ); + + /* Make sure we have enough space to hold the expanded action table + ** in the worst case. The worst case occurs if the transaction set + ** must be appended to the current action table + */ + n = p->mxLookahead + 1; + if( p->nAction + n >= p->nActionAlloc ){ + int oldAlloc = p->nActionAlloc; + p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20; + p->aAction = (struct lookahead_action *) realloc( p->aAction, + sizeof(p->aAction[0])*p->nActionAlloc); + if( p->aAction==0 ){ + fprintf(stderr,"malloc failed\n"); + exit(1); + } + for(i=oldAlloc; inActionAlloc; i++){ + p->aAction[i].lookahead = -1; + p->aAction[i].action = -1; + } + } + + /* Scan the existing action table looking for an offset that is a + ** duplicate of the current transaction set. Fall out of the loop + ** if and when the duplicate is found. + ** + ** i is the index in p->aAction[] where p->mnLookahead is inserted. + */ + for(i=p->nAction-1; i>=0; i--){ + if( p->aAction[i].lookahead==p->mnLookahead ){ + /* All lookaheads and actions in the aLookahead[] transaction + ** must match against the candidate aAction[i] entry. */ + if( p->aAction[i].action!=p->mnAction ) continue; + for(j=0; jnLookahead; j++){ + k = p->aLookahead[j].lookahead - p->mnLookahead + i; + if( k<0 || k>=p->nAction ) break; + if( p->aLookahead[j].lookahead!=p->aAction[k].lookahead ) break; + if( p->aLookahead[j].action!=p->aAction[k].action ) break; + } + if( jnLookahead ) continue; + + /* No possible lookahead value that is not in the aLookahead[] + ** transaction is allowed to match aAction[i] */ + n = 0; + for(j=0; jnAction; j++){ + if( p->aAction[j].lookahead<0 ) continue; + if( p->aAction[j].lookahead==j+p->mnLookahead-i ) n++; + } + if( n==p->nLookahead ){ + break; /* An exact match is found at offset i */ + } + } + } + + /* If no existing offsets exactly match the current transaction, find an + ** an empty offset in the aAction[] table in which we can add the + ** aLookahead[] transaction. + */ + if( i<0 ){ + /* Look for holes in the aAction[] table that fit the current + ** aLookahead[] transaction. Leave i set to the offset of the hole. + ** If no holes are found, i is left at p->nAction, which means the + ** transaction will be appended. */ + for(i=0; inActionAlloc - p->mxLookahead; i++){ + if( p->aAction[i].lookahead<0 ){ + for(j=0; jnLookahead; j++){ + k = p->aLookahead[j].lookahead - p->mnLookahead + i; + if( k<0 ) break; + if( p->aAction[k].lookahead>=0 ) break; + } + if( jnLookahead ) continue; + for(j=0; jnAction; j++){ + if( p->aAction[j].lookahead==j+p->mnLookahead-i ) break; + } + if( j==p->nAction ){ + break; /* Fits in empty slots */ + } + } + } + } + /* Insert transaction set at index i. */ + for(j=0; jnLookahead; j++){ + k = p->aLookahead[j].lookahead - p->mnLookahead + i; + p->aAction[k] = p->aLookahead[j]; + if( k>=p->nAction ) p->nAction = k+1; + } + p->nLookahead = 0; + + /* Return the offset that is added to the lookahead in order to get the + ** index into yy_action of the action */ + return i - p->mnLookahead; +} + +/********************** From the file "build.c" *****************************/ +/* +** Routines to construction the finite state machine for the LEMON +** parser generator. +*/ + +/* Find a precedence symbol of every rule in the grammar. +** +** Those rules which have a precedence symbol coded in the input +** grammar using the "[symbol]" construct will already have the +** rp->precsym field filled. Other rules take as their precedence +** symbol the first RHS symbol with a defined precedence. If there +** are not RHS symbols with a defined precedence, the precedence +** symbol field is left blank. +*/ +void FindRulePrecedences(struct lemon *xp) +{ + struct rule *rp; + for(rp=xp->rule; rp; rp=rp->next){ + if( rp->precsym==0 ){ + int i, j; + for(i=0; inrhs && rp->precsym==0; i++){ + struct symbol *sp = rp->rhs[i]; + if( sp->type==MULTITERMINAL ){ + for(j=0; jnsubsym; j++){ + if( sp->subsym[j]->prec>=0 ){ + rp->precsym = sp->subsym[j]; + break; + } + } + }else if( sp->prec>=0 ){ + rp->precsym = rp->rhs[i]; + } + } + } + } + return; +} + +/* Find all nonterminals which will generate the empty string. +** Then go back and compute the first sets of every nonterminal. +** The first set is the set of all terminal symbols which can begin +** a string generated by that nonterminal. +*/ +void FindFirstSets(struct lemon *lemp) +{ + int i, j; + struct rule *rp; + int progress; + + for(i=0; insymbol; i++){ + lemp->symbols[i]->lambda = LEMON_FALSE; + } + for(i=lemp->nterminal; insymbol; i++){ + lemp->symbols[i]->firstset = SetNew(); + } + + /* First compute all lambdas */ + do{ + progress = 0; + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->lhs->lambda ) continue; + for(i=0; inrhs; i++){ + struct symbol *sp = rp->rhs[i]; + assert( sp->type==NONTERMINAL || sp->lambda==LEMON_FALSE ); + if( sp->lambda==LEMON_FALSE ) break; + } + if( i==rp->nrhs ){ + rp->lhs->lambda = LEMON_TRUE; + progress = 1; + } + } + }while( progress ); + + /* Now compute all first sets */ + do{ + struct symbol *s1, *s2; + progress = 0; + for(rp=lemp->rule; rp; rp=rp->next){ + s1 = rp->lhs; + for(i=0; inrhs; i++){ + s2 = rp->rhs[i]; + if( s2->type==TERMINAL ){ + progress += SetAdd(s1->firstset,s2->index); + break; + }else if( s2->type==MULTITERMINAL ){ + for(j=0; jnsubsym; j++){ + progress += SetAdd(s1->firstset,s2->subsym[j]->index); + } + break; + }else if( s1==s2 ){ + if( s1->lambda==LEMON_FALSE ) break; + }else{ + progress += SetUnion(s1->firstset,s2->firstset); + if( s2->lambda==LEMON_FALSE ) break; + } + } + } + }while( progress ); + return; +} + +/* Compute all LR(0) states for the grammar. Links +** are added to between some states so that the LR(1) follow sets +** can be computed later. +*/ +PRIVATE struct state *getstate(struct lemon *); /* forward reference */ +void FindStates(struct lemon *lemp) +{ + struct symbol *sp; + struct rule *rp; + + Configlist_init(); + + /* Find the start symbol */ + if( lemp->start ){ + sp = Symbol_find(lemp->start); + if( sp==0 ){ + ErrorMsg(lemp->filename,0, +"The specified start symbol \"%s\" is not \ +in a nonterminal of the grammar. \"%s\" will be used as the start \ +symbol instead.",lemp->start,lemp->startRule->lhs->name); + lemp->errorcnt++; + sp = lemp->startRule->lhs; + } + }else{ + sp = lemp->startRule->lhs; + } + + /* Make sure the start symbol doesn't occur on the right-hand side of + ** any rule. Report an error if it does. (YACC would generate a new + ** start symbol in this case.) */ + for(rp=lemp->rule; rp; rp=rp->next){ + int i; + for(i=0; inrhs; i++){ + if( rp->rhs[i]==sp ){ /* FIX ME: Deal with multiterminals */ + ErrorMsg(lemp->filename,0, +"The start symbol \"%s\" occurs on the \ +right-hand side of a rule. This will result in a parser which \ +does not work properly.",sp->name); + lemp->errorcnt++; + } + } + } + + /* The basis configuration set for the first state + ** is all rules which have the start symbol as their + ** left-hand side */ + for(rp=sp->rule; rp; rp=rp->nextlhs){ + struct config *newcfp; + rp->lhsStart = 1; + newcfp = Configlist_addbasis(rp,0); + SetAdd(newcfp->fws,0); + } + + /* Compute the first state. All other states will be + ** computed automatically during the computation of the first one. + ** The returned pointer to the first state is not used. */ + (void)getstate(lemp); + return; +} + +/* Return a pointer to a state which is described by the configuration +** list which has been built from calls to Configlist_add. +*/ +PRIVATE void buildshifts(struct lemon *, struct state *); /* Forwd ref */ +PRIVATE struct state *getstate(struct lemon *lemp) +{ + struct config *cfp, *bp; + struct state *stp; + + /* Extract the sorted basis of the new state. The basis was constructed + ** by prior calls to "Configlist_addbasis()". */ + Configlist_sortbasis(); + bp = Configlist_basis(); + + /* Get a state with the same basis */ + stp = State_find(bp); + if( stp ){ + /* A state with the same basis already exists! Copy all the follow-set + ** propagation links from the state under construction into the + ** preexisting state, then return a pointer to the preexisting state */ + struct config *x, *y; + for(x=bp, y=stp->bp; x && y; x=x->bp, y=y->bp){ + Plink_copy(&y->bplp,x->bplp); + Plink_delete(x->fplp); + x->fplp = x->bplp = 0; + } + cfp = Configlist_return(); + Configlist_eat(cfp); + }else{ + /* This really is a new state. Construct all the details */ + Configlist_closure(lemp); /* Compute the configuration closure */ + Configlist_sort(); /* Sort the configuration closure */ + cfp = Configlist_return(); /* Get a pointer to the config list */ + stp = State_new(); /* A new state structure */ + MemoryCheck(stp); + stp->bp = bp; /* Remember the configuration basis */ + stp->cfp = cfp; /* Remember the configuration closure */ + stp->statenum = lemp->nstate++; /* Every state gets a sequence number */ + stp->ap = 0; /* No actions, yet. */ + State_insert(stp,stp->bp); /* Add to the state table */ + buildshifts(lemp,stp); /* Recursively compute successor states */ + } + return stp; +} + +/* +** Return true if two symbols are the same. +*/ +int same_symbol(struct symbol *a, struct symbol *b) +{ + int i; + if( a==b ) return 1; + if( a->type!=MULTITERMINAL ) return 0; + if( b->type!=MULTITERMINAL ) return 0; + if( a->nsubsym!=b->nsubsym ) return 0; + for(i=0; insubsym; i++){ + if( a->subsym[i]!=b->subsym[i] ) return 0; + } + return 1; +} + +/* Construct all successor states to the given state. A "successor" +** state is any state which can be reached by a shift action. +*/ +PRIVATE void buildshifts(struct lemon *lemp, struct state *stp) +{ + struct config *cfp; /* For looping thru the config closure of "stp" */ + struct config *bcfp; /* For the inner loop on config closure of "stp" */ + struct config *newcfg; /* */ + struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ + struct symbol *bsp; /* Symbol following the dot in configuration "bcfp" */ + struct state *newstp; /* A pointer to a successor state */ + + /* Each configuration becomes complete after it contibutes to a successor + ** state. Initially, all configurations are incomplete */ + for(cfp=stp->cfp; cfp; cfp=cfp->next) cfp->status = INCOMPLETE; + + /* Loop through all configurations of the state "stp" */ + for(cfp=stp->cfp; cfp; cfp=cfp->next){ + if( cfp->status==COMPLETE ) continue; /* Already used by inner loop */ + if( cfp->dot>=cfp->rp->nrhs ) continue; /* Can't shift this config */ + Configlist_reset(); /* Reset the new config set */ + sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ + + /* For every configuration in the state "stp" which has the symbol "sp" + ** following its dot, add the same configuration to the basis set under + ** construction but with the dot shifted one symbol to the right. */ + for(bcfp=cfp; bcfp; bcfp=bcfp->next){ + if( bcfp->status==COMPLETE ) continue; /* Already used */ + if( bcfp->dot>=bcfp->rp->nrhs ) continue; /* Can't shift this one */ + bsp = bcfp->rp->rhs[bcfp->dot]; /* Get symbol after dot */ + if( !same_symbol(bsp,sp) ) continue; /* Must be same as for "cfp" */ + bcfp->status = COMPLETE; /* Mark this config as used */ + newcfg = Configlist_addbasis(bcfp->rp,bcfp->dot+1); + Plink_add(&newcfg->bplp,bcfp); + } + + /* Get a pointer to the state described by the basis configuration set + ** constructed in the preceding loop */ + newstp = getstate(lemp); + + /* The state "newstp" is reached from the state "stp" by a shift action + ** on the symbol "sp" */ + if( sp->type==MULTITERMINAL ){ + int i; + for(i=0; insubsym; i++){ + Action_add(&stp->ap,SHIFT,sp->subsym[i],(char*)newstp); + } + }else{ + Action_add(&stp->ap,SHIFT,sp,(char *)newstp); + } + } +} + +/* +** Construct the propagation links +*/ +void FindLinks(struct lemon *lemp) +{ + int i; + struct config *cfp, *other; + struct state *stp; + struct plink *plp; + + /* Housekeeping detail: + ** Add to every propagate link a pointer back to the state to + ** which the link is attached. */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(cfp=stp->cfp; cfp; cfp=cfp->next){ + cfp->stp = stp; + } + } + + /* Convert all backlinks into forward links. Only the forward + ** links are used in the follow-set computation. */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(cfp=stp->cfp; cfp; cfp=cfp->next){ + for(plp=cfp->bplp; plp; plp=plp->next){ + other = plp->cfp; + Plink_add(&other->fplp,cfp); + } + } + } +} + +/* Compute all followsets. +** +** A followset is the set of all symbols which can come immediately +** after a configuration. +*/ +void FindFollowSets(struct lemon *lemp) +{ + int i; + struct config *cfp; + struct plink *plp; + int progress; + int change; + + for(i=0; instate; i++){ + for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ + cfp->status = INCOMPLETE; + } + } + + do{ + progress = 0; + for(i=0; instate; i++){ + for(cfp=lemp->sorted[i]->cfp; cfp; cfp=cfp->next){ + if( cfp->status==COMPLETE ) continue; + for(plp=cfp->fplp; plp; plp=plp->next){ + change = SetUnion(plp->cfp->fws,cfp->fws); + if( change ){ + plp->cfp->status = INCOMPLETE; + progress = 1; + } + } + cfp->status = COMPLETE; + } + } + }while( progress ); +} + +static int resolve_conflict(struct action *,struct action *); + +/* Compute the reduce actions, and resolve conflicts. +*/ +void FindActions(struct lemon *lemp) +{ + int i,j; + struct config *cfp; + struct state *stp; + struct symbol *sp; + struct rule *rp; + + /* Add all of the reduce actions + ** A reduce action is added for each element of the followset of + ** a configuration which has its dot at the extreme right. + */ + for(i=0; instate; i++){ /* Loop over all states */ + stp = lemp->sorted[i]; + for(cfp=stp->cfp; cfp; cfp=cfp->next){ /* Loop over all configurations */ + if( cfp->rp->nrhs==cfp->dot ){ /* Is dot at extreme right? */ + for(j=0; jnterminal; j++){ + if( SetFind(cfp->fws,j) ){ + /* Add a reduce action to the state "stp" which will reduce by the + ** rule "cfp->rp" if the lookahead symbol is "lemp->symbols[j]" */ + Action_add(&stp->ap,REDUCE,lemp->symbols[j],(char *)cfp->rp); + } + } + } + } + } + + /* Add the accepting token */ + if( lemp->start ){ + sp = Symbol_find(lemp->start); + if( sp==0 ) sp = lemp->startRule->lhs; + }else{ + sp = lemp->startRule->lhs; + } + /* Add to the first state (which is always the starting state of the + ** finite state machine) an action to ACCEPT if the lookahead is the + ** start nonterminal. */ + Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); + + /* Resolve conflicts */ + for(i=0; instate; i++){ + struct action *ap, *nap; + stp = lemp->sorted[i]; + /* assert( stp->ap ); */ + stp->ap = Action_sort(stp->ap); + for(ap=stp->ap; ap && ap->next; ap=ap->next){ + for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ + /* The two actions "ap" and "nap" have the same lookahead. + ** Figure out which one should be used */ + lemp->nconflict += resolve_conflict(ap,nap); + } + } + } + + /* Report an error for each rule that can never be reduced. */ + for(rp=lemp->rule; rp; rp=rp->next) rp->canReduce = LEMON_FALSE; + for(i=0; instate; i++){ + struct action *ap; + for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ + if( ap->type==REDUCE ) ap->x.rp->canReduce = LEMON_TRUE; + } + } + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->canReduce ) continue; + ErrorMsg(lemp->filename,rp->ruleline,"This rule can not be reduced.\n"); + lemp->errorcnt++; + } +} + +/* Resolve a conflict between the two given actions. If the +** conflict can't be resolved, return non-zero. +** +** NO LONGER TRUE: +** To resolve a conflict, first look to see if either action +** is on an error rule. In that case, take the action which +** is not associated with the error rule. If neither or both +** actions are associated with an error rule, then try to +** use precedence to resolve the conflict. +** +** If either action is a SHIFT, then it must be apx. This +** function won't work if apx->type==REDUCE and apy->type==SHIFT. +*/ +static int resolve_conflict( + struct action *apx, + struct action *apy +){ + struct symbol *spx, *spy; + int errcnt = 0; + assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ + if( apx->type==SHIFT && apy->type==SHIFT ){ + apy->type = SSCONFLICT; + errcnt++; + } + if( apx->type==SHIFT && apy->type==REDUCE ){ + spx = apx->sp; + spy = apy->x.rp->precsym; + if( spy==0 || spx->prec<0 || spy->prec<0 ){ + /* Not enough precedence information. */ + apy->type = SRCONFLICT; + errcnt++; + }else if( spx->prec>spy->prec ){ /* higher precedence wins */ + apy->type = RD_RESOLVED; + }else if( spx->precprec ){ + apx->type = SH_RESOLVED; + }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ /* Use operator */ + apy->type = RD_RESOLVED; /* associativity */ + }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ /* to break tie */ + apx->type = SH_RESOLVED; + }else{ + assert( spx->prec==spy->prec && spx->assoc==NONE ); + apx->type = ERROR; + } + }else if( apx->type==REDUCE && apy->type==REDUCE ){ + spx = apx->x.rp->precsym; + spy = apy->x.rp->precsym; + if( spx==0 || spy==0 || spx->prec<0 || + spy->prec<0 || spx->prec==spy->prec ){ + apy->type = RRCONFLICT; + errcnt++; + }else if( spx->prec>spy->prec ){ + apy->type = RD_RESOLVED; + }else if( spx->precprec ){ + apx->type = RD_RESOLVED; + } + }else{ + assert( + apx->type==SH_RESOLVED || + apx->type==RD_RESOLVED || + apx->type==SSCONFLICT || + apx->type==SRCONFLICT || + apx->type==RRCONFLICT || + apy->type==SH_RESOLVED || + apy->type==RD_RESOLVED || + apy->type==SSCONFLICT || + apy->type==SRCONFLICT || + apy->type==RRCONFLICT + ); + /* The REDUCE/SHIFT case cannot happen because SHIFTs come before + ** REDUCEs on the list. If we reach this point it must be because + ** the parser conflict had already been resolved. */ + } + return errcnt; +} +/********************* From the file "configlist.c" *************************/ +/* +** Routines to processing a configuration list and building a state +** in the LEMON parser generator. +*/ + +static struct config *freelist = 0; /* List of free configurations */ +static struct config *current = 0; /* Top of list of configurations */ +static struct config **currentend = 0; /* Last on list of configs */ +static struct config *basis = 0; /* Top of list of basis configs */ +static struct config **basisend = 0; /* End of list of basis configs */ + +/* Return a pointer to a new configuration */ +PRIVATE struct config *newconfig(void){ + struct config *newcfg; + if( freelist==0 ){ + int i; + int amt = 3; + freelist = (struct config *)calloc( amt, sizeof(struct config) ); + if( freelist==0 ){ + fprintf(stderr,"Unable to allocate memory for a new configuration."); + exit(1); + } + for(i=0; inext; + return newcfg; +} + +/* The configuration "old" is no longer used */ +PRIVATE void deleteconfig(struct config *old) +{ + old->next = freelist; + freelist = old; +} + +/* Initialized the configuration list builder */ +void Configlist_init(void){ + current = 0; + currentend = ¤t; + basis = 0; + basisend = &basis; + Configtable_init(); + return; +} + +/* Initialized the configuration list builder */ +void Configlist_reset(void){ + current = 0; + currentend = ¤t; + basis = 0; + basisend = &basis; + Configtable_clear(0); + return; +} + +/* Add another configuration to the configuration list */ +struct config *Configlist_add( + struct rule *rp, /* The rule */ + int dot /* Index into the RHS of the rule where the dot goes */ +){ + struct config *cfp, model; + + assert( currentend!=0 ); + model.rp = rp; + model.dot = dot; + cfp = Configtable_find(&model); + if( cfp==0 ){ + cfp = newconfig(); + cfp->rp = rp; + cfp->dot = dot; + cfp->fws = SetNew(); + cfp->stp = 0; + cfp->fplp = cfp->bplp = 0; + cfp->next = 0; + cfp->bp = 0; + *currentend = cfp; + currentend = &cfp->next; + Configtable_insert(cfp); + } + return cfp; +} + +/* Add a basis configuration to the configuration list */ +struct config *Configlist_addbasis(struct rule *rp, int dot) +{ + struct config *cfp, model; + + assert( basisend!=0 ); + assert( currentend!=0 ); + model.rp = rp; + model.dot = dot; + cfp = Configtable_find(&model); + if( cfp==0 ){ + cfp = newconfig(); + cfp->rp = rp; + cfp->dot = dot; + cfp->fws = SetNew(); + cfp->stp = 0; + cfp->fplp = cfp->bplp = 0; + cfp->next = 0; + cfp->bp = 0; + *currentend = cfp; + currentend = &cfp->next; + *basisend = cfp; + basisend = &cfp->bp; + Configtable_insert(cfp); + } + return cfp; +} + +/* Compute the closure of the configuration list */ +void Configlist_closure(struct lemon *lemp) +{ + struct config *cfp, *newcfp; + struct rule *rp, *newrp; + struct symbol *sp, *xsp; + int i, dot; + + assert( currentend!=0 ); + for(cfp=current; cfp; cfp=cfp->next){ + rp = cfp->rp; + dot = cfp->dot; + if( dot>=rp->nrhs ) continue; + sp = rp->rhs[dot]; + if( sp->type==NONTERMINAL ){ + if( sp->rule==0 && sp!=lemp->errsym ){ + ErrorMsg(lemp->filename,rp->line,"Nonterminal \"%s\" has no rules.", + sp->name); + lemp->errorcnt++; + } + for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ + newcfp = Configlist_add(newrp,0); + for(i=dot+1; inrhs; i++){ + xsp = rp->rhs[i]; + if( xsp->type==TERMINAL ){ + SetAdd(newcfp->fws,xsp->index); + break; + }else if( xsp->type==MULTITERMINAL ){ + int k; + for(k=0; knsubsym; k++){ + SetAdd(newcfp->fws, xsp->subsym[k]->index); + } + break; + }else{ + SetUnion(newcfp->fws,xsp->firstset); + if( xsp->lambda==LEMON_FALSE ) break; + } + } + if( i==rp->nrhs ) Plink_add(&cfp->fplp,newcfp); + } + } + } + return; +} + +/* Sort the configuration list */ +void Configlist_sort(void){ + current = (struct config*)msort((char*)current,(char**)&(current->next), + Configcmp); + currentend = 0; + return; +} + +/* Sort the basis configuration list */ +void Configlist_sortbasis(void){ + basis = (struct config*)msort((char*)current,(char**)&(current->bp), + Configcmp); + basisend = 0; + return; +} + +/* Return a pointer to the head of the configuration list and +** reset the list */ +struct config *Configlist_return(void){ + struct config *old; + old = current; + current = 0; + currentend = 0; + return old; +} + +/* Return a pointer to the head of the configuration list and +** reset the list */ +struct config *Configlist_basis(void){ + struct config *old; + old = basis; + basis = 0; + basisend = 0; + return old; +} + +/* Free all elements of the given configuration list */ +void Configlist_eat(struct config *cfp) +{ + struct config *nextcfp; + for(; cfp; cfp=nextcfp){ + nextcfp = cfp->next; + assert( cfp->fplp==0 ); + assert( cfp->bplp==0 ); + if( cfp->fws ) SetFree(cfp->fws); + deleteconfig(cfp); + } + return; +} +/***************** From the file "error.c" *********************************/ +/* +** Code for printing error message. +*/ + +void ErrorMsg(const char *filename, int lineno, const char *format, ...){ + va_list ap; + fprintf(stderr, "%s:%d: ", filename, lineno); + va_start(ap, format); + vfprintf(stderr,format,ap); + va_end(ap); + fprintf(stderr, "\n"); +} +/**************** From the file "main.c" ************************************/ +/* +** Main program file for the LEMON parser generator. +*/ + +/* Report an out-of-memory condition and abort. This function +** is used mostly by the "MemoryCheck" macro in struct.h +*/ +void memory_error(void){ + fprintf(stderr,"Out of memory. Aborting...\n"); + exit(1); +} + +static int nDefine = 0; /* Number of -D options on the command line */ +static char **azDefine = 0; /* Name of the -D macros */ + +/* This routine is called with the argument to each -D command-line option. +** Add the macro defined to the azDefine array. +*/ +static void handle_D_option(char *z){ + char **paz; + nDefine++; + azDefine = (char **) realloc(azDefine, sizeof(azDefine[0])*nDefine); + if( azDefine==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + paz = &azDefine[nDefine-1]; + *paz = (char *) malloc( lemonStrlen(z)+1 ); + if( *paz==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + lemon_strcpy(*paz, z); + for(z=*paz; *z && *z!='='; z++){} + *z = 0; +} + +static char *user_templatename = NULL; +static void handle_T_option(char *z){ + user_templatename = (char *) malloc( lemonStrlen(z)+1 ); + if( user_templatename==0 ){ + memory_error(); + } + lemon_strcpy(user_templatename, z); +} + +/* Merge together to lists of rules ordered by rule.iRule */ +static struct rule *Rule_merge(struct rule *pA, struct rule *pB){ + struct rule *pFirst = 0; + struct rule **ppPrev = &pFirst; + while( pA && pB ){ + if( pA->iRuleiRule ){ + *ppPrev = pA; + ppPrev = &pA->next; + pA = pA->next; + }else{ + *ppPrev = pB; + ppPrev = &pB->next; + pB = pB->next; + } + } + if( pA ){ + *ppPrev = pA; + }else{ + *ppPrev = pB; + } + return pFirst; +} + +/* +** Sort a list of rules in order of increasing iRule value +*/ +static struct rule *Rule_sort(struct rule *rp){ + int i; + struct rule *pNext; + struct rule *x[32]; + memset(x, 0, sizeof(x)); + while( rp ){ + pNext = rp->next; + rp->next = 0; + for(i=0; iuseCnt = 0; + + /* Parse the input file */ + Parse(&lem); + if( lem.errorcnt ) exit(lem.errorcnt); + if( lem.nrule==0 ){ + fprintf(stderr,"Empty grammar.\n"); + exit(1); + } + + /* Count and index the symbols of the grammar */ + Symbol_new("{default}"); + lem.nsymbol = Symbol_count(); + lem.symbols = Symbol_arrayof(); + for(i=0; iindex = i; + qsort(lem.symbols,lem.nsymbol,sizeof(struct symbol*), Symbolcmpp); + for(i=0; iindex = i; + while( lem.symbols[i-1]->type==MULTITERMINAL ){ i--; } + assert( strcmp(lem.symbols[i-1]->name,"{default}")==0 ); + lem.nsymbol = i - 1; + for(i=1; ISUPPER(lem.symbols[i]->name[0]); i++); + lem.nterminal = i; + + /* Assign sequential rule numbers. Start with 0. Put rules that have no + ** reduce action C-code associated with them last, so that the switch() + ** statement that selects reduction actions will have a smaller jump table. + */ + for(i=0, rp=lem.rule; rp; rp=rp->next){ + rp->iRule = rp->code ? i++ : -1; + } + for(rp=lem.rule; rp; rp=rp->next){ + if( rp->iRule<0 ) rp->iRule = i++; + } + lem.startRule = lem.rule; + lem.rule = Rule_sort(lem.rule); + + /* Generate a reprint of the grammar, if requested on the command line */ + if( rpflag ){ + Reprint(&lem); + }else{ + /* Initialize the size for all follow and first sets */ + SetSize(lem.nterminal+1); + + /* Find the precedence for every production rule (that has one) */ + FindRulePrecedences(&lem); + + /* Compute the lambda-nonterminals and the first-sets for every + ** nonterminal */ + FindFirstSets(&lem); + + /* Compute all LR(0) states. Also record follow-set propagation + ** links so that the follow-set can be computed later */ + lem.nstate = 0; + FindStates(&lem); + lem.sorted = State_arrayof(); + + /* Tie up loose ends on the propagation links */ + FindLinks(&lem); + + /* Compute the follow set of every reducible configuration */ + FindFollowSets(&lem); + + /* Compute the action tables */ + FindActions(&lem); + + /* Compress the action tables */ + if( compress==0 ) CompressTables(&lem); + + /* Reorder and renumber the states so that states with fewer choices + ** occur at the end. This is an optimization that helps make the + ** generated parser tables smaller. */ + if( noResort==0 ) ResortStates(&lem); + + /* Generate a report of the parser generated. (the "y.output" file) */ + if( !quiet ) ReportOutput(&lem); + + /* Generate the source code for the parser */ + ReportTable(&lem, mhflag); + + /* Produce a header file for use by the scanner. (This step is + ** omitted if the "-m" option is used because makeheaders will + ** generate the file for us.) */ + if( !mhflag ) ReportHeader(&lem); + } + if( statistics ){ + printf("Parser statistics:\n"); + stats_line("terminal symbols", lem.nterminal); + stats_line("non-terminal symbols", lem.nsymbol - lem.nterminal); + stats_line("total symbols", lem.nsymbol); + stats_line("rules", lem.nrule); + stats_line("states", lem.nxstate); + stats_line("conflicts", lem.nconflict); + stats_line("action table entries", lem.nactiontab); + stats_line("total table size (bytes)", lem.tablesize); + } + if( lem.nconflict > 0 ){ + fprintf(stderr,"%d parsing conflicts.\n",lem.nconflict); + } + + /* return 0 on success, 1 on failure. */ + exitcode = ((lem.errorcnt > 0) || (lem.nconflict > 0)) ? 1 : 0; + exit(exitcode); + return (exitcode); +} +/******************** From the file "msort.c" *******************************/ +/* +** A generic merge-sort program. +** +** USAGE: +** Let "ptr" be a pointer to some structure which is at the head of +** a null-terminated list. Then to sort the list call: +** +** ptr = msort(ptr,&(ptr->next),cmpfnc); +** +** In the above, "cmpfnc" is a pointer to a function which compares +** two instances of the structure and returns an integer, as in +** strcmp. The second argument is a pointer to the pointer to the +** second element of the linked list. This address is used to compute +** the offset to the "next" field within the structure. The offset to +** the "next" field must be constant for all structures in the list. +** +** The function returns a new pointer which is the head of the list +** after sorting. +** +** ALGORITHM: +** Merge-sort. +*/ + +/* +** Return a pointer to the next structure in the linked list. +*/ +#define NEXT(A) (*(char**)(((char*)A)+offset)) + +/* +** Inputs: +** a: A sorted, null-terminated linked list. (May be null). +** b: A sorted, null-terminated linked list. (May be null). +** cmp: A pointer to the comparison function. +** offset: Offset in the structure to the "next" field. +** +** Return Value: +** A pointer to the head of a sorted list containing the elements +** of both a and b. +** +** Side effects: +** The "next" pointers for elements in the lists a and b are +** changed. +*/ +static char *merge( + char *a, + char *b, + int (*cmp)(const char*,const char*), + int offset +){ + char *ptr, *head; + + if( a==0 ){ + head = b; + }else if( b==0 ){ + head = a; + }else{ + if( (*cmp)(a,b)<=0 ){ + ptr = a; + a = NEXT(a); + }else{ + ptr = b; + b = NEXT(b); + } + head = ptr; + while( a && b ){ + if( (*cmp)(a,b)<=0 ){ + NEXT(ptr) = a; + ptr = a; + a = NEXT(a); + }else{ + NEXT(ptr) = b; + ptr = b; + b = NEXT(b); + } + } + if( a ) NEXT(ptr) = a; + else NEXT(ptr) = b; + } + return head; +} + +/* +** Inputs: +** list: Pointer to a singly-linked list of structures. +** next: Pointer to pointer to the second element of the list. +** cmp: A comparison function. +** +** Return Value: +** A pointer to the head of a sorted list containing the elements +** orginally in list. +** +** Side effects: +** The "next" pointers for elements in list are changed. +*/ +#define LISTSIZE 30 +static char *msort( + char *list, + char **next, + int (*cmp)(const char*,const char*) +){ + unsigned long offset; + char *ep; + char *set[LISTSIZE]; + int i; + offset = (unsigned long)((char*)next - (char*)list); + for(i=0; istate = WAITING_FOR_DECL_KEYWORD; + }else if( ISLOWER(x[0]) ){ + psp->lhs = Symbol_new(x); + psp->nrhs = 0; + psp->lhsalias = 0; + psp->state = WAITING_FOR_ARROW; + }else if( x[0]=='{' ){ + if( psp->prevrule==0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, +"There is no prior rule upon which to attach the code \ +fragment which begins on this line."); + psp->errorcnt++; + }else if( psp->prevrule->code!=0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, +"Code fragment beginning on this line is not the first \ +to follow the previous rule."); + psp->errorcnt++; + }else{ + psp->prevrule->line = psp->tokenlineno; + psp->prevrule->code = &x[1]; + psp->prevrule->noCode = 0; + } + }else if( x[0]=='[' ){ + psp->state = PRECEDENCE_MARK_1; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Token \"%s\" should be either \"%%\" or a nonterminal name.", + x); + psp->errorcnt++; + } + break; + case PRECEDENCE_MARK_1: + if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "The precedence symbol must be a terminal."); + psp->errorcnt++; + }else if( psp->prevrule==0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "There is no prior rule to assign precedence \"[%s]\".",x); + psp->errorcnt++; + }else if( psp->prevrule->precsym!=0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, +"Precedence mark on this line is not the first \ +to follow the previous rule."); + psp->errorcnt++; + }else{ + psp->prevrule->precsym = Symbol_new(x); + } + psp->state = PRECEDENCE_MARK_2; + break; + case PRECEDENCE_MARK_2: + if( x[0]!=']' ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \"]\" on precedence mark."); + psp->errorcnt++; + } + psp->state = WAITING_FOR_DECL_OR_RULE; + break; + case WAITING_FOR_ARROW: + if( x[0]==':' && x[1]==':' && x[2]=='=' ){ + psp->state = IN_RHS; + }else if( x[0]=='(' ){ + psp->state = LHS_ALIAS_1; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Expected to see a \":\" following the LHS symbol \"%s\".", + psp->lhs->name); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case LHS_ALIAS_1: + if( ISALPHA(x[0]) ){ + psp->lhsalias = x; + psp->state = LHS_ALIAS_2; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "\"%s\" is not a valid alias for the LHS \"%s\"\n", + x,psp->lhs->name); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case LHS_ALIAS_2: + if( x[0]==')' ){ + psp->state = LHS_ALIAS_3; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case LHS_ALIAS_3: + if( x[0]==':' && x[1]==':' && x[2]=='=' ){ + psp->state = IN_RHS; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \"->\" following: \"%s(%s)\".", + psp->lhs->name,psp->lhsalias); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case IN_RHS: + if( x[0]=='.' ){ + struct rule *rp; + rp = (struct rule *)calloc( sizeof(struct rule) + + sizeof(struct symbol*)*psp->nrhs + sizeof(char*)*psp->nrhs, 1); + if( rp==0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Can't allocate enough memory for this rule."); + psp->errorcnt++; + psp->prevrule = 0; + }else{ + int i; + rp->ruleline = psp->tokenlineno; + rp->rhs = (struct symbol**)&rp[1]; + rp->rhsalias = (const char**)&(rp->rhs[psp->nrhs]); + for(i=0; inrhs; i++){ + rp->rhs[i] = psp->rhs[i]; + rp->rhsalias[i] = psp->alias[i]; + } + rp->lhs = psp->lhs; + rp->lhsalias = psp->lhsalias; + rp->nrhs = psp->nrhs; + rp->code = 0; + rp->noCode = 1; + rp->precsym = 0; + rp->index = psp->gp->nrule++; + rp->nextlhs = rp->lhs->rule; + rp->lhs->rule = rp; + rp->next = 0; + if( psp->firstrule==0 ){ + psp->firstrule = psp->lastrule = rp; + }else{ + psp->lastrule->next = rp; + psp->lastrule = rp; + } + psp->prevrule = rp; + } + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( ISALPHA(x[0]) ){ + if( psp->nrhs>=MAXRHS ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Too many symbols on RHS of rule beginning at \"%s\".", + x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + }else{ + psp->rhs[psp->nrhs] = Symbol_new(x); + psp->alias[psp->nrhs] = 0; + psp->nrhs++; + } + }else if( (x[0]=='|' || x[0]=='/') && psp->nrhs>0 ){ + struct symbol *msp = psp->rhs[psp->nrhs-1]; + if( msp->type!=MULTITERMINAL ){ + struct symbol *origsp = msp; + msp = (struct symbol *) calloc(1,sizeof(*msp)); + memset(msp, 0, sizeof(*msp)); + msp->type = MULTITERMINAL; + msp->nsubsym = 1; + msp->subsym = (struct symbol **) calloc(1,sizeof(struct symbol*)); + msp->subsym[0] = origsp; + msp->name = origsp->name; + psp->rhs[psp->nrhs-1] = msp; + } + msp->nsubsym++; + msp->subsym = (struct symbol **) realloc(msp->subsym, + sizeof(struct symbol*)*msp->nsubsym); + msp->subsym[msp->nsubsym-1] = Symbol_new(&x[1]); + if( ISLOWER(x[1]) || ISLOWER(msp->subsym[0]->name[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Cannot form a compound containing a non-terminal"); + psp->errorcnt++; + } + }else if( x[0]=='(' && psp->nrhs>0 ){ + psp->state = RHS_ALIAS_1; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Illegal character on RHS of rule: \"%s\".",x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case RHS_ALIAS_1: + if( ISALPHA(x[0]) ){ + psp->alias[psp->nrhs-1] = x; + psp->state = RHS_ALIAS_2; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "\"%s\" is not a valid alias for the RHS symbol \"%s\"\n", + x,psp->rhs[psp->nrhs-1]->name); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case RHS_ALIAS_2: + if( x[0]==')' ){ + psp->state = IN_RHS; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Missing \")\" following LHS alias name \"%s\".",psp->lhsalias); + psp->errorcnt++; + psp->state = RESYNC_AFTER_RULE_ERROR; + } + break; + case WAITING_FOR_DECL_KEYWORD: + if( ISALPHA(x[0]) ){ + psp->declkeyword = x; + psp->declargslot = 0; + psp->decllinenoslot = 0; + psp->insertLineMacro = 1; + psp->state = WAITING_FOR_DECL_ARG; + if( strcmp(x,"name")==0 ){ + psp->declargslot = &(psp->gp->name); + psp->insertLineMacro = 0; + }else if( strcmp(x,"include")==0 ){ + psp->declargslot = &(psp->gp->include); + }else if( strcmp(x,"code")==0 ){ + psp->declargslot = &(psp->gp->extracode); + }else if( strcmp(x,"token_destructor")==0 ){ + psp->declargslot = &psp->gp->tokendest; + }else if( strcmp(x,"default_destructor")==0 ){ + psp->declargslot = &psp->gp->vardest; + }else if( strcmp(x,"token_prefix")==0 ){ + psp->declargslot = &psp->gp->tokenprefix; + psp->insertLineMacro = 0; + }else if( strcmp(x,"syntax_error")==0 ){ + psp->declargslot = &(psp->gp->error); + }else if( strcmp(x,"parse_accept")==0 ){ + psp->declargslot = &(psp->gp->accept); + }else if( strcmp(x,"parse_failure")==0 ){ + psp->declargslot = &(psp->gp->failure); + }else if( strcmp(x,"stack_overflow")==0 ){ + psp->declargslot = &(psp->gp->overflow); + }else if( strcmp(x,"extra_argument")==0 ){ + psp->declargslot = &(psp->gp->arg); + psp->insertLineMacro = 0; + }else if( strcmp(x,"token_type")==0 ){ + psp->declargslot = &(psp->gp->tokentype); + psp->insertLineMacro = 0; + }else if( strcmp(x,"default_type")==0 ){ + psp->declargslot = &(psp->gp->vartype); + psp->insertLineMacro = 0; + }else if( strcmp(x,"stack_size")==0 ){ + psp->declargslot = &(psp->gp->stacksize); + psp->insertLineMacro = 0; + }else if( strcmp(x,"start_symbol")==0 ){ + psp->declargslot = &(psp->gp->start); + psp->insertLineMacro = 0; + }else if( strcmp(x,"left")==0 ){ + psp->preccounter++; + psp->declassoc = LEFT; + psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; + }else if( strcmp(x,"right")==0 ){ + psp->preccounter++; + psp->declassoc = RIGHT; + psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; + }else if( strcmp(x,"nonassoc")==0 ){ + psp->preccounter++; + psp->declassoc = NONE; + psp->state = WAITING_FOR_PRECEDENCE_SYMBOL; + }else if( strcmp(x,"destructor")==0 ){ + psp->state = WAITING_FOR_DESTRUCTOR_SYMBOL; + }else if( strcmp(x,"type")==0 ){ + psp->state = WAITING_FOR_DATATYPE_SYMBOL; + }else if( strcmp(x,"fallback")==0 ){ + psp->fallback = 0; + psp->state = WAITING_FOR_FALLBACK_ID; + }else if( strcmp(x,"token")==0 ){ + psp->state = WAITING_FOR_TOKEN_NAME; + }else if( strcmp(x,"wildcard")==0 ){ + psp->state = WAITING_FOR_WILDCARD_ID; + }else if( strcmp(x,"token_class")==0 ){ + psp->state = WAITING_FOR_CLASS_ID; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Unknown declaration keyword: \"%%%s\".",x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Illegal declaration keyword: \"%s\".",x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + break; + case WAITING_FOR_DESTRUCTOR_SYMBOL: + if( !ISALPHA(x[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol name missing after %%destructor keyword"); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + struct symbol *sp = Symbol_new(x); + psp->declargslot = &sp->destructor; + psp->decllinenoslot = &sp->destLineno; + psp->insertLineMacro = 1; + psp->state = WAITING_FOR_DECL_ARG; + } + break; + case WAITING_FOR_DATATYPE_SYMBOL: + if( !ISALPHA(x[0]) ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol name missing after %%type keyword"); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + struct symbol *sp = Symbol_find(x); + if((sp) && (sp->datatype)){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol %%type \"%s\" already defined", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + if (!sp){ + sp = Symbol_new(x); + } + psp->declargslot = &sp->datatype; + psp->insertLineMacro = 0; + psp->state = WAITING_FOR_DECL_ARG; + } + } + break; + case WAITING_FOR_PRECEDENCE_SYMBOL: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( ISUPPER(x[0]) ){ + struct symbol *sp; + sp = Symbol_new(x); + if( sp->prec>=0 ){ + ErrorMsg(psp->filename,psp->tokenlineno, + "Symbol \"%s\" has already be given a precedence.",x); + psp->errorcnt++; + }else{ + sp->prec = psp->preccounter; + sp->assoc = psp->declassoc; + } + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Can't assign a precedence to \"%s\".",x); + psp->errorcnt++; + } + break; + case WAITING_FOR_DECL_ARG: + if( x[0]=='{' || x[0]=='\"' || ISALNUM(x[0]) ){ + const char *zOld, *zNew; + char *zBuf, *z; + int nOld, n, nLine = 0, nNew, nBack; + int addLineMacro; + char zLine[50]; + zNew = x; + if( zNew[0]=='"' || zNew[0]=='{' ) zNew++; + nNew = lemonStrlen(zNew); + if( *psp->declargslot ){ + zOld = *psp->declargslot; + }else{ + zOld = ""; + } + nOld = lemonStrlen(zOld); + n = nOld + nNew + 20; + addLineMacro = !psp->gp->nolinenosflag && psp->insertLineMacro && + (psp->decllinenoslot==0 || psp->decllinenoslot[0]!=0); + if( addLineMacro ){ + for(z=psp->filename, nBack=0; *z; z++){ + if( *z=='\\' ) nBack++; + } + lemon_sprintf(zLine, "#line %d ", psp->tokenlineno); + nLine = lemonStrlen(zLine); + n += nLine + lemonStrlen(psp->filename) + nBack; + } + *psp->declargslot = (char *) realloc(*psp->declargslot, n); + zBuf = *psp->declargslot + nOld; + if( addLineMacro ){ + if( nOld && zBuf[-1]!='\n' ){ + *(zBuf++) = '\n'; + } + memcpy(zBuf, zLine, nLine); + zBuf += nLine; + *(zBuf++) = '"'; + for(z=psp->filename; *z; z++){ + if( *z=='\\' ){ + *(zBuf++) = '\\'; + } + *(zBuf++) = *z; + } + *(zBuf++) = '"'; + *(zBuf++) = '\n'; + } + if( psp->decllinenoslot && psp->decllinenoslot[0]==0 ){ + psp->decllinenoslot[0] = psp->tokenlineno; + } + memcpy(zBuf, zNew, nNew); + zBuf += nNew; + *zBuf = 0; + psp->state = WAITING_FOR_DECL_OR_RULE; + }else{ + ErrorMsg(psp->filename,psp->tokenlineno, + "Illegal argument to %%%s: %s",psp->declkeyword,x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + break; + case WAITING_FOR_FALLBACK_ID: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%fallback argument \"%s\" should be a token", x); + psp->errorcnt++; + }else{ + struct symbol *sp = Symbol_new(x); + if( psp->fallback==0 ){ + psp->fallback = sp; + }else if( sp->fallback ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "More than one fallback assigned to token %s", x); + psp->errorcnt++; + }else{ + sp->fallback = psp->fallback; + psp->gp->has_fallback = 1; + } + } + break; + case WAITING_FOR_TOKEN_NAME: + /* Tokens do not have to be declared before use. But they can be + ** in order to control their assigned integer number. The number for + ** each token is assigned when it is first seen. So by including + ** + ** %token ONE TWO THREE + ** + ** early in the grammar file, that assigns small consecutive values + ** to each of the tokens ONE TWO and THREE. + */ + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%token argument \"%s\" should be a token", x); + psp->errorcnt++; + }else{ + (void)Symbol_new(x); + } + break; + case WAITING_FOR_WILDCARD_ID: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( !ISUPPER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%wildcard argument \"%s\" should be a token", x); + psp->errorcnt++; + }else{ + struct symbol *sp = Symbol_new(x); + if( psp->gp->wildcard==0 ){ + psp->gp->wildcard = sp; + }else{ + ErrorMsg(psp->filename, psp->tokenlineno, + "Extra wildcard to token: %s", x); + psp->errorcnt++; + } + } + break; + case WAITING_FOR_CLASS_ID: + if( !ISLOWER(x[0]) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%token_class must be followed by an identifier: ", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else if( Symbol_find(x) ){ + ErrorMsg(psp->filename, psp->tokenlineno, + "Symbol \"%s\" already used", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + }else{ + psp->tkclass = Symbol_new(x); + psp->tkclass->type = MULTITERMINAL; + psp->state = WAITING_FOR_CLASS_TOKEN; + } + break; + case WAITING_FOR_CLASS_TOKEN: + if( x[0]=='.' ){ + psp->state = WAITING_FOR_DECL_OR_RULE; + }else if( ISUPPER(x[0]) || ((x[0]=='|' || x[0]=='/') && ISUPPER(x[1])) ){ + struct symbol *msp = psp->tkclass; + msp->nsubsym++; + msp->subsym = (struct symbol **) realloc(msp->subsym, + sizeof(struct symbol*)*msp->nsubsym); + if( !ISUPPER(x[0]) ) x++; + msp->subsym[msp->nsubsym-1] = Symbol_new(x); + }else{ + ErrorMsg(psp->filename, psp->tokenlineno, + "%%token_class argument \"%s\" should be a token", x); + psp->errorcnt++; + psp->state = RESYNC_AFTER_DECL_ERROR; + } + break; + case RESYNC_AFTER_RULE_ERROR: +/* if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; +** break; */ + case RESYNC_AFTER_DECL_ERROR: + if( x[0]=='.' ) psp->state = WAITING_FOR_DECL_OR_RULE; + if( x[0]=='%' ) psp->state = WAITING_FOR_DECL_KEYWORD; + break; + } +} + +/* Run the preprocessor over the input file text. The global variables +** azDefine[0] through azDefine[nDefine-1] contains the names of all defined +** macros. This routine looks for "%ifdef" and "%ifndef" and "%endif" and +** comments them out. Text in between is also commented out as appropriate. +*/ +static void preprocess_input(char *z){ + int i, j, k, n; + int exclude = 0; + int start = 0; + int lineno = 1; + int start_lineno = 1; + for(i=0; z[i]; i++){ + if( z[i]=='\n' ) lineno++; + if( z[i]!='%' || (i>0 && z[i-1]!='\n') ) continue; + if( strncmp(&z[i],"%endif",6)==0 && ISSPACE(z[i+6]) ){ + if( exclude ){ + exclude--; + if( exclude==0 ){ + for(j=start; jfilename; + ps.errorcnt = 0; + ps.state = INITIALIZE; + + /* Begin by reading the input file */ + fp = fopen(ps.filename,"rb"); + if( fp==0 ){ + ErrorMsg(ps.filename,0,"Can't open this file for reading."); + gp->errorcnt++; + return; + } + fseek(fp,0,2); + filesize = ftell(fp); + rewind(fp); + filebuf = (char *)malloc( filesize+1 ); + if( filesize>100000000 || filebuf==0 ){ + ErrorMsg(ps.filename,0,"Input file too large."); + gp->errorcnt++; + fclose(fp); + return; + } + if( fread(filebuf,1,filesize,fp)!=filesize ){ + ErrorMsg(ps.filename,0,"Can't read in all %d bytes of this file.", + filesize); + free(filebuf); + gp->errorcnt++; + fclose(fp); + return; + } + fclose(fp); + filebuf[filesize] = 0; + + /* Make an initial pass through the file to handle %ifdef and %ifndef */ + preprocess_input(filebuf); + + /* Now scan the text of the input file */ + lineno = 1; + for(cp=filebuf; (c= *cp)!=0; ){ + if( c=='\n' ) lineno++; /* Keep track of the line number */ + if( ISSPACE(c) ){ cp++; continue; } /* Skip all white space */ + if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments */ + cp+=2; + while( (c= *cp)!=0 && c!='\n' ) cp++; + continue; + } + if( c=='/' && cp[1]=='*' ){ /* Skip C style comments */ + cp+=2; + while( (c= *cp)!=0 && (c!='/' || cp[-1]!='*') ){ + if( c=='\n' ) lineno++; + cp++; + } + if( c ) cp++; + continue; + } + ps.tokenstart = cp; /* Mark the beginning of the token */ + ps.tokenlineno = lineno; /* Linenumber on which token begins */ + if( c=='\"' ){ /* String literals */ + cp++; + while( (c= *cp)!=0 && c!='\"' ){ + if( c=='\n' ) lineno++; + cp++; + } + if( c==0 ){ + ErrorMsg(ps.filename,startline, +"String starting on this line is not terminated before the end of the file."); + ps.errorcnt++; + nextcp = cp; + }else{ + nextcp = cp+1; + } + }else if( c=='{' ){ /* A block of C code */ + int level; + cp++; + for(level=1; (c= *cp)!=0 && (level>1 || c!='}'); cp++){ + if( c=='\n' ) lineno++; + else if( c=='{' ) level++; + else if( c=='}' ) level--; + else if( c=='/' && cp[1]=='*' ){ /* Skip comments */ + int prevc; + cp = &cp[2]; + prevc = 0; + while( (c= *cp)!=0 && (c!='/' || prevc!='*') ){ + if( c=='\n' ) lineno++; + prevc = c; + cp++; + } + }else if( c=='/' && cp[1]=='/' ){ /* Skip C++ style comments too */ + cp = &cp[2]; + while( (c= *cp)!=0 && c!='\n' ) cp++; + if( c ) lineno++; + }else if( c=='\'' || c=='\"' ){ /* String a character literals */ + int startchar, prevc; + startchar = c; + prevc = 0; + for(cp++; (c= *cp)!=0 && (c!=startchar || prevc=='\\'); cp++){ + if( c=='\n' ) lineno++; + if( prevc=='\\' ) prevc = 0; + else prevc = c; + } + } + } + if( c==0 ){ + ErrorMsg(ps.filename,ps.tokenlineno, +"C code starting on this line is not terminated before the end of the file."); + ps.errorcnt++; + nextcp = cp; + }else{ + nextcp = cp+1; + } + }else if( ISALNUM(c) ){ /* Identifiers */ + while( (c= *cp)!=0 && (ISALNUM(c) || c=='_') ) cp++; + nextcp = cp; + }else if( c==':' && cp[1]==':' && cp[2]=='=' ){ /* The operator "::=" */ + cp += 3; + nextcp = cp; + }else if( (c=='/' || c=='|') && ISALPHA(cp[1]) ){ + cp += 2; + while( (c = *cp)!=0 && (ISALNUM(c) || c=='_') ) cp++; + nextcp = cp; + }else{ /* All other (one character) operators */ + cp++; + nextcp = cp; + } + c = *cp; + *cp = 0; /* Null terminate the token */ + parseonetoken(&ps); /* Parse the token */ + *cp = (char)c; /* Restore the buffer */ + cp = nextcp; + } + free(filebuf); /* Release the buffer after parsing */ + gp->rule = ps.firstrule; + gp->errorcnt = ps.errorcnt; +} +/*************************** From the file "plink.c" *********************/ +/* +** Routines processing configuration follow-set propagation links +** in the LEMON parser generator. +*/ +static struct plink *plink_freelist = 0; + +/* Allocate a new plink */ +struct plink *Plink_new(void){ + struct plink *newlink; + + if( plink_freelist==0 ){ + int i; + int amt = 100; + plink_freelist = (struct plink *)calloc( amt, sizeof(struct plink) ); + if( plink_freelist==0 ){ + fprintf(stderr, + "Unable to allocate memory for a new follow-set propagation link.\n"); + exit(1); + } + for(i=0; inext; + return newlink; +} + +/* Add a plink to a plink list */ +void Plink_add(struct plink **plpp, struct config *cfp) +{ + struct plink *newlink; + newlink = Plink_new(); + newlink->next = *plpp; + *plpp = newlink; + newlink->cfp = cfp; +} + +/* Transfer every plink on the list "from" to the list "to" */ +void Plink_copy(struct plink **to, struct plink *from) +{ + struct plink *nextpl; + while( from ){ + nextpl = from->next; + from->next = *to; + *to = from; + from = nextpl; + } +} + +/* Delete every plink on the list */ +void Plink_delete(struct plink *plp) +{ + struct plink *nextpl; + + while( plp ){ + nextpl = plp->next; + plp->next = plink_freelist; + plink_freelist = plp; + plp = nextpl; + } +} +/*********************** From the file "report.c" **************************/ +/* +** Procedures for generating reports and tables in the LEMON parser generator. +*/ + +/* Generate a filename with the given suffix. Space to hold the +** name comes from malloc() and must be freed by the calling +** function. +*/ +PRIVATE char *file_makename(struct lemon *lemp, const char *suffix) +{ + char *name; + char *cp; + + name = (char*)malloc( lemonStrlen(lemp->filename) + lemonStrlen(suffix) + 5 ); + if( name==0 ){ + fprintf(stderr,"Can't allocate space for a filename.\n"); + exit(1); + } + lemon_strcpy(name,lemp->filename); + cp = strrchr(name,'.'); + if( cp ) *cp = 0; + lemon_strcat(name,suffix); + return name; +} + +/* Open a file with a name based on the name of the input file, +** but with a different (specified) suffix, and return a pointer +** to the stream */ +PRIVATE FILE *file_open( + struct lemon *lemp, + const char *suffix, + const char *mode +){ + FILE *fp; + + if( lemp->outname ) free(lemp->outname); + lemp->outname = file_makename(lemp, suffix); + fp = fopen(lemp->outname,mode); + if( fp==0 && *mode=='w' ){ + fprintf(stderr,"Can't open file \"%s\".\n",lemp->outname); + lemp->errorcnt++; + return 0; + } + return fp; +} + +/* Duplicate the input file without comments and without actions +** on rules */ +void Reprint(struct lemon *lemp) +{ + struct rule *rp; + struct symbol *sp; + int i, j, maxlen, len, ncolumns, skip; + printf("// Reprint of input file \"%s\".\n// Symbols:\n",lemp->filename); + maxlen = 10; + for(i=0; insymbol; i++){ + sp = lemp->symbols[i]; + len = lemonStrlen(sp->name); + if( len>maxlen ) maxlen = len; + } + ncolumns = 76/(maxlen+5); + if( ncolumns<1 ) ncolumns = 1; + skip = (lemp->nsymbol + ncolumns - 1)/ncolumns; + for(i=0; insymbol; j+=skip){ + sp = lemp->symbols[j]; + assert( sp->index==j ); + printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); + } + printf("\n"); + } + for(rp=lemp->rule; rp; rp=rp->next){ + printf("%s",rp->lhs->name); + /* if( rp->lhsalias ) printf("(%s)",rp->lhsalias); */ + printf(" ::="); + for(i=0; inrhs; i++){ + sp = rp->rhs[i]; + if( sp->type==MULTITERMINAL ){ + printf(" %s", sp->subsym[0]->name); + for(j=1; jnsubsym; j++){ + printf("|%s", sp->subsym[j]->name); + } + }else{ + printf(" %s", sp->name); + } + /* if( rp->rhsalias[i] ) printf("(%s)",rp->rhsalias[i]); */ + } + printf("."); + if( rp->precsym ) printf(" [%s]",rp->precsym->name); + /* if( rp->code ) printf("\n %s",rp->code); */ + printf("\n"); + } +} + +/* Print a single rule. +*/ +void RulePrint(FILE *fp, struct rule *rp, int iCursor){ + struct symbol *sp; + int i, j; + fprintf(fp,"%s ::=",rp->lhs->name); + for(i=0; i<=rp->nrhs; i++){ + if( i==iCursor ) fprintf(fp," *"); + if( i==rp->nrhs ) break; + sp = rp->rhs[i]; + if( sp->type==MULTITERMINAL ){ + fprintf(fp," %s", sp->subsym[0]->name); + for(j=1; jnsubsym; j++){ + fprintf(fp,"|%s",sp->subsym[j]->name); + } + }else{ + fprintf(fp," %s", sp->name); + } + } +} + +/* Print the rule for a configuration. +*/ +void ConfigPrint(FILE *fp, struct config *cfp){ + RulePrint(fp, cfp->rp, cfp->dot); +} + +/* #define TEST */ +#if 0 +/* Print a set */ +PRIVATE void SetPrint(out,set,lemp) +FILE *out; +char *set; +struct lemon *lemp; +{ + int i; + char *spacer; + spacer = ""; + fprintf(out,"%12s[",""); + for(i=0; interminal; i++){ + if( SetFind(set,i) ){ + fprintf(out,"%s%s",spacer,lemp->symbols[i]->name); + spacer = " "; + } + } + fprintf(out,"]\n"); +} + +/* Print a plink chain */ +PRIVATE void PlinkPrint(out,plp,tag) +FILE *out; +struct plink *plp; +char *tag; +{ + while( plp ){ + fprintf(out,"%12s%s (state %2d) ","",tag,plp->cfp->stp->statenum); + ConfigPrint(out,plp->cfp); + fprintf(out,"\n"); + plp = plp->next; + } +} +#endif + +/* Print an action to the given file descriptor. Return FALSE if +** nothing was actually printed. +*/ +int PrintAction( + struct action *ap, /* The action to print */ + FILE *fp, /* Print the action here */ + int indent /* Indent by this amount */ +){ + int result = 1; + switch( ap->type ){ + case SHIFT: { + struct state *stp = ap->x.stp; + fprintf(fp,"%*s shift %-7d",indent,ap->sp->name,stp->statenum); + break; + } + case REDUCE: { + struct rule *rp = ap->x.rp; + fprintf(fp,"%*s reduce %-7d",indent,ap->sp->name,rp->iRule); + RulePrint(fp, rp, -1); + break; + } + case SHIFTREDUCE: { + struct rule *rp = ap->x.rp; + fprintf(fp,"%*s shift-reduce %-7d",indent,ap->sp->name,rp->iRule); + RulePrint(fp, rp, -1); + break; + } + case ACCEPT: + fprintf(fp,"%*s accept",indent,ap->sp->name); + break; + case ERROR: + fprintf(fp,"%*s error",indent,ap->sp->name); + break; + case SRCONFLICT: + case RRCONFLICT: + fprintf(fp,"%*s reduce %-7d ** Parsing conflict **", + indent,ap->sp->name,ap->x.rp->iRule); + break; + case SSCONFLICT: + fprintf(fp,"%*s shift %-7d ** Parsing conflict **", + indent,ap->sp->name,ap->x.stp->statenum); + break; + case SH_RESOLVED: + if( showPrecedenceConflict ){ + fprintf(fp,"%*s shift %-7d -- dropped by precedence", + indent,ap->sp->name,ap->x.stp->statenum); + }else{ + result = 0; + } + break; + case RD_RESOLVED: + if( showPrecedenceConflict ){ + fprintf(fp,"%*s reduce %-7d -- dropped by precedence", + indent,ap->sp->name,ap->x.rp->iRule); + }else{ + result = 0; + } + break; + case NOT_USED: + result = 0; + break; + } + if( result && ap->spOpt ){ + fprintf(fp," /* because %s==%s */", ap->sp->name, ap->spOpt->name); + } + return result; +} + +/* Generate the "*.out" log file */ +void ReportOutput(struct lemon *lemp) +{ + int i; + struct state *stp; + struct config *cfp; + struct action *ap; + FILE *fp; + + fp = file_open(lemp,".out","wb"); + if( fp==0 ) return; + for(i=0; inxstate; i++){ + stp = lemp->sorted[i]; + fprintf(fp,"State %d:\n",stp->statenum); + if( lemp->basisflag ) cfp=stp->bp; + else cfp=stp->cfp; + while( cfp ){ + char buf[20]; + if( cfp->dot==cfp->rp->nrhs ){ + lemon_sprintf(buf,"(%d)",cfp->rp->iRule); + fprintf(fp," %5s ",buf); + }else{ + fprintf(fp," "); + } + ConfigPrint(fp,cfp); + fprintf(fp,"\n"); +#if 0 + SetPrint(fp,cfp->fws,lemp); + PlinkPrint(fp,cfp->fplp,"To "); + PlinkPrint(fp,cfp->bplp,"From"); +#endif + if( lemp->basisflag ) cfp=cfp->bp; + else cfp=cfp->next; + } + fprintf(fp,"\n"); + for(ap=stp->ap; ap; ap=ap->next){ + if( PrintAction(ap,fp,30) ) fprintf(fp,"\n"); + } + fprintf(fp,"\n"); + } + fprintf(fp, "----------------------------------------------------\n"); + fprintf(fp, "Symbols:\n"); + for(i=0; insymbol; i++){ + int j; + struct symbol *sp; + + sp = lemp->symbols[i]; + fprintf(fp, " %3d: %s", i, sp->name); + if( sp->type==NONTERMINAL ){ + fprintf(fp, ":"); + if( sp->lambda ){ + fprintf(fp, " "); + } + for(j=0; jnterminal; j++){ + if( sp->firstset && SetFind(sp->firstset, j) ){ + fprintf(fp, " %s", lemp->symbols[j]->name); + } + } + } + fprintf(fp, "\n"); + } + fclose(fp); + return; +} + +/* Search for the file "name" which is in the same directory as +** the exacutable */ +PRIVATE char *pathsearch(char *argv0, char *name, int modemask) +{ + const char *pathlist; + char *pathbufptr; + char *pathbuf; + char *path,*cp; + char c; + +#ifdef __WIN32__ + cp = strrchr(argv0,'\\'); +#else + cp = strrchr(argv0,'/'); +#endif + if( cp ){ + c = *cp; + *cp = 0; + path = (char *)malloc( lemonStrlen(argv0) + lemonStrlen(name) + 2 ); + if( path ) lemon_sprintf(path,"%s/%s",argv0,name); + *cp = c; + }else{ + pathlist = getenv("PATH"); + if( pathlist==0 ) pathlist = ".:/bin:/usr/bin"; + pathbuf = (char *) malloc( lemonStrlen(pathlist) + 1 ); + path = (char *)malloc( lemonStrlen(pathlist)+lemonStrlen(name)+2 ); + if( (pathbuf != 0) && (path!=0) ){ + pathbufptr = pathbuf; + lemon_strcpy(pathbuf, pathlist); + while( *pathbuf ){ + cp = strchr(pathbuf,':'); + if( cp==0 ) cp = &pathbuf[lemonStrlen(pathbuf)]; + c = *cp; + *cp = 0; + lemon_sprintf(path,"%s/%s",pathbuf,name); + *cp = c; + if( c==0 ) pathbuf[0] = 0; + else pathbuf = &cp[1]; + if( access(path,modemask)==0 ) break; + } + free(pathbufptr); + } + } + return path; +} + +/* Given an action, compute the integer value for that action +** which is to be put in the action table of the generated machine. +** Return negative if no action should be generated. +*/ +PRIVATE int compute_action(struct lemon *lemp, struct action *ap) +{ + int act; + switch( ap->type ){ + case SHIFT: act = ap->x.stp->statenum; break; + case SHIFTREDUCE: { + act = ap->x.rp->iRule + lemp->nstate; + /* Since a SHIFT is inherient after a prior REDUCE, convert any + ** SHIFTREDUCE action with a nonterminal on the LHS into a simple + ** REDUCE action: */ + if( ap->sp->index>=lemp->nterminal ) act += lemp->nrule; + break; + } + case REDUCE: act = ap->x.rp->iRule + lemp->nstate+lemp->nrule; break; + case ERROR: act = lemp->nstate + lemp->nrule*2; break; + case ACCEPT: act = lemp->nstate + lemp->nrule*2 + 1; break; + default: act = -1; break; + } + return act; +} + +#define LINESIZE 1000 +/* The next cluster of routines are for reading the template file +** and writing the results to the generated parser */ +/* The first function transfers data from "in" to "out" until +** a line is seen which begins with "%%". The line number is +** tracked. +** +** if name!=0, then any word that begin with "Parse" is changed to +** begin with *name instead. +*/ +PRIVATE void tplt_xfer(char *name, FILE *in, FILE *out, int *lineno) +{ + int i, iStart; + char line[LINESIZE]; + while( fgets(line,LINESIZE,in) && (line[0]!='%' || line[1]!='%') ){ + (*lineno)++; + iStart = 0; + if( name ){ + for(i=0; line[i]; i++){ + if( line[i]=='P' && strncmp(&line[i],"Parse",5)==0 + && (i==0 || !ISALPHA(line[i-1])) + ){ + if( i>iStart ) fprintf(out,"%.*s",i-iStart,&line[iStart]); + fprintf(out,"%s",name); + i += 4; + iStart = i+1; + } + } + } + fprintf(out,"%s",&line[iStart]); + } +} + +/* The next function finds the template file and opens it, returning +** a pointer to the opened file. */ +PRIVATE FILE *tplt_open(struct lemon *lemp) +{ + static char templatename[] = "lempar.c"; + char buf[1000]; + FILE *in; + char *tpltname; + char *cp; + + /* first, see if user specified a template filename on the command line. */ + if (user_templatename != 0) { + if( access(user_templatename,004)==-1 ){ + fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", + user_templatename); + lemp->errorcnt++; + return 0; + } + in = fopen(user_templatename,"rb"); + if( in==0 ){ + fprintf(stderr,"Can't open the template file \"%s\".\n", + user_templatename); + lemp->errorcnt++; + return 0; + } + return in; + } + + cp = strrchr(lemp->filename,'.'); + if( cp ){ + lemon_sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); + }else{ + lemon_sprintf(buf,"%s.lt",lemp->filename); + } + if( access(buf,004)==0 ){ + tpltname = buf; + }else if( access(templatename,004)==0 ){ + tpltname = templatename; + }else{ + tpltname = pathsearch(lemp->argv0,templatename,0); + } + if( tpltname==0 ){ + fprintf(stderr,"Can't find the parser driver template file \"%s\".\n", + templatename); + lemp->errorcnt++; + return 0; + } + in = fopen(tpltname,"rb"); + if( in==0 ){ + fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); + lemp->errorcnt++; + return 0; + } + return in; +} + +/* Print a #line directive line to the output file. */ +PRIVATE void tplt_linedir(FILE *out, int lineno, char *filename) +{ + fprintf(out,"#line %d \"",lineno); + while( *filename ){ + if( *filename == '\\' ) putc('\\',out); + putc(*filename,out); + filename++; + } + fprintf(out,"\"\n"); +} + +/* Print a string to the file and keep the linenumber up to date */ +PRIVATE void tplt_print(FILE *out, struct lemon *lemp, char *str, int *lineno) +{ + if( str==0 ) return; + while( *str ){ + putc(*str,out); + if( *str=='\n' ) (*lineno)++; + str++; + } + if( str[-1]!='\n' ){ + putc('\n',out); + (*lineno)++; + } + if (!lemp->nolinenosflag) { + (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); + } + return; +} + +/* +** The following routine emits code for the destructor for the +** symbol sp +*/ +void emit_destructor_code( + FILE *out, + struct symbol *sp, + struct lemon *lemp, + int *lineno +){ + char *cp = 0; + + if( sp->type==TERMINAL ){ + cp = lemp->tokendest; + if( cp==0 ) return; + fprintf(out,"{\n"); (*lineno)++; + }else if( sp->destructor ){ + cp = sp->destructor; + fprintf(out,"{\n"); (*lineno)++; + if( !lemp->nolinenosflag ){ + (*lineno)++; + tplt_linedir(out,sp->destLineno,lemp->filename); + } + }else if( lemp->vardest ){ + cp = lemp->vardest; + if( cp==0 ) return; + fprintf(out,"{\n"); (*lineno)++; + }else{ + assert( 0 ); /* Cannot happen */ + } + for(; *cp; cp++){ + if( *cp=='$' && cp[1]=='$' ){ + fprintf(out,"(yypminor->yy%d)",sp->dtnum); + cp++; + continue; + } + if( *cp=='\n' ) (*lineno)++; + fputc(*cp,out); + } + fprintf(out,"\n"); (*lineno)++; + if (!lemp->nolinenosflag) { + (*lineno)++; tplt_linedir(out,*lineno,lemp->outname); + } + fprintf(out,"}\n"); (*lineno)++; + return; +} + +/* +** Return TRUE (non-zero) if the given symbol has a destructor. +*/ +int has_destructor(struct symbol *sp, struct lemon *lemp) +{ + int ret; + if( sp->type==TERMINAL ){ + ret = lemp->tokendest!=0; + }else{ + ret = lemp->vardest!=0 || sp->destructor!=0; + } + return ret; +} + +/* +** Append text to a dynamically allocated string. If zText is 0 then +** reset the string to be empty again. Always return the complete text +** of the string (which is overwritten with each call). +** +** n bytes of zText are stored. If n==0 then all of zText up to the first +** \000 terminator is stored. zText can contain up to two instances of +** %d. The values of p1 and p2 are written into the first and second +** %d. +** +** If n==-1, then the previous character is overwritten. +*/ +PRIVATE char *append_str(const char *zText, int n, int p1, int p2){ + static char empty[1] = { 0 }; + static char *z = 0; + static int alloced = 0; + static int used = 0; + int c; + char zInt[40]; + if( zText==0 ){ + if( used==0 && z!=0 ) z[0] = 0; + used = 0; + return z; + } + if( n<=0 ){ + if( n<0 ){ + used += n; + assert( used>=0 ); + } + n = lemonStrlen(zText); + } + if( (int) (n+sizeof(zInt)*2+used) >= alloced ){ + alloced = n + sizeof(zInt)*2 + used + 200; + z = (char *) realloc(z, alloced); + } + if( z==0 ) return empty; + while( n-- > 0 ){ + c = *(zText++); + if( c=='%' && n>0 && zText[0]=='d' ){ + lemon_sprintf(zInt, "%d", p1); + p1 = p2; + lemon_strcpy(&z[used], zInt); + used += lemonStrlen(&z[used]); + zText++; + n--; + }else{ + z[used++] = (char)c; + } + } + z[used] = 0; + return z; +} + +/* +** Write and transform the rp->code string so that symbols are expanded. +** Populate the rp->codePrefix and rp->codeSuffix strings, as appropriate. +** +** Return 1 if the expanded code requires that "yylhsminor" local variable +** to be defined. +*/ +PRIVATE int translate_code(struct lemon *lemp, struct rule *rp){ + char *cp, *xp; + int i; + int rc = 0; /* True if yylhsminor is used */ + int dontUseRhs0 = 0; /* If true, use of left-most RHS label is illegal */ + const char *zSkip = 0; /* The zOvwrt comment within rp->code, or NULL */ + char lhsused = 0; /* True if the LHS element has been used */ + char lhsdirect; /* True if LHS writes directly into stack */ + char used[MAXRHS]; /* True for each RHS element which is used */ + char zLhs[50]; /* Convert the LHS symbol into this string */ + char zOvwrt[900]; /* Comment that to allow LHS to overwrite RHS */ + + for(i=0; inrhs; i++) used[i] = 0; + lhsused = 0; + + if( rp->code==0 ){ + static char newlinestr[2] = { '\n', '\0' }; + rp->code = newlinestr; + rp->line = rp->ruleline; + rp->noCode = 1; + }else{ + rp->noCode = 0; + } + + + if( rp->nrhs==0 ){ + /* If there are no RHS symbols, then writing directly to the LHS is ok */ + lhsdirect = 1; + }else if( rp->rhsalias[0]==0 ){ + /* The left-most RHS symbol has no value. LHS direct is ok. But + ** we have to call the distructor on the RHS symbol first. */ + lhsdirect = 1; + if( has_destructor(rp->rhs[0],lemp) ){ + append_str(0,0,0,0); + append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0, + rp->rhs[0]->index,1-rp->nrhs); + rp->codePrefix = Strsafe(append_str(0,0,0,0)); + rp->noCode = 0; + } + }else if( rp->lhsalias==0 ){ + /* There is no LHS value symbol. */ + lhsdirect = 1; + }else if( strcmp(rp->lhsalias,rp->rhsalias[0])==0 ){ + /* The LHS symbol and the left-most RHS symbol are the same, so + ** direct writing is allowed */ + lhsdirect = 1; + lhsused = 1; + used[0] = 1; + if( rp->lhs->dtnum!=rp->rhs[0]->dtnum ){ + ErrorMsg(lemp->filename,rp->ruleline, + "%s(%s) and %s(%s) share the same label but have " + "different datatypes.", + rp->lhs->name, rp->lhsalias, rp->rhs[0]->name, rp->rhsalias[0]); + lemp->errorcnt++; + } + }else{ + lemon_sprintf(zOvwrt, "/*%s-overwrites-%s*/", + rp->lhsalias, rp->rhsalias[0]); + zSkip = strstr(rp->code, zOvwrt); + if( zSkip!=0 ){ + /* The code contains a special comment that indicates that it is safe + ** for the LHS label to overwrite left-most RHS label. */ + lhsdirect = 1; + }else{ + lhsdirect = 0; + } + } + if( lhsdirect ){ + sprintf(zLhs, "yymsp[%d].minor.yy%d",1-rp->nrhs,rp->lhs->dtnum); + }else{ + rc = 1; + sprintf(zLhs, "yylhsminor.yy%d",rp->lhs->dtnum); + } + + append_str(0,0,0,0); + + /* This const cast is wrong but harmless, if we're careful. */ + for(cp=(char *)rp->code; *cp; cp++){ + if( cp==zSkip ){ + append_str(zOvwrt,0,0,0); + cp += lemonStrlen(zOvwrt)-1; + dontUseRhs0 = 1; + continue; + } + if( ISALPHA(*cp) && (cp==rp->code || (!ISALNUM(cp[-1]) && cp[-1]!='_')) ){ + char saved; + for(xp= &cp[1]; ISALNUM(*xp) || *xp=='_'; xp++); + saved = *xp; + *xp = 0; + if( rp->lhsalias && strcmp(cp,rp->lhsalias)==0 ){ + append_str(zLhs,0,0,0); + cp = xp; + lhsused = 1; + }else{ + for(i=0; inrhs; i++){ + if( rp->rhsalias[i] && strcmp(cp,rp->rhsalias[i])==0 ){ + if( i==0 && dontUseRhs0 ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label %s used after '%s'.", + rp->rhsalias[0], zOvwrt); + lemp->errorcnt++; + }else if( cp!=rp->code && cp[-1]=='@' ){ + /* If the argument is of the form @X then substituted + ** the token number of X, not the value of X */ + append_str("yymsp[%d].major",-1,i-rp->nrhs+1,0); + }else{ + struct symbol *sp = rp->rhs[i]; + int dtnum; + if( sp->type==MULTITERMINAL ){ + dtnum = sp->subsym[0]->dtnum; + }else{ + dtnum = sp->dtnum; + } + append_str("yymsp[%d].minor.yy%d",0,i-rp->nrhs+1, dtnum); + } + cp = xp; + used[i] = 1; + break; + } + } + } + *xp = saved; + } + append_str(cp, 1, 0, 0); + } /* End loop */ + + /* Main code generation completed */ + cp = append_str(0,0,0,0); + if( cp && cp[0] ) rp->code = Strsafe(cp); + append_str(0,0,0,0); + + /* Check to make sure the LHS has been used */ + if( rp->lhsalias && !lhsused ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label \"%s\" for \"%s(%s)\" is never used.", + rp->lhsalias,rp->lhs->name,rp->lhsalias); + lemp->errorcnt++; + } + + /* Generate destructor code for RHS minor values which are not referenced. + ** Generate error messages for unused labels and duplicate labels. + */ + for(i=0; inrhs; i++){ + if( rp->rhsalias[i] ){ + if( i>0 ){ + int j; + if( rp->lhsalias && strcmp(rp->lhsalias,rp->rhsalias[i])==0 ){ + ErrorMsg(lemp->filename,rp->ruleline, + "%s(%s) has the same label as the LHS but is not the left-most " + "symbol on the RHS.", + rp->rhs[i]->name, rp->rhsalias); + lemp->errorcnt++; + } + for(j=0; jrhsalias[j] && strcmp(rp->rhsalias[j],rp->rhsalias[i])==0 ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label %s used for multiple symbols on the RHS of a rule.", + rp->rhsalias[i]); + lemp->errorcnt++; + break; + } + } + } + if( !used[i] ){ + ErrorMsg(lemp->filename,rp->ruleline, + "Label %s for \"%s(%s)\" is never used.", + rp->rhsalias[i],rp->rhs[i]->name,rp->rhsalias[i]); + lemp->errorcnt++; + } + }else if( i>0 && has_destructor(rp->rhs[i],lemp) ){ + append_str(" yy_destructor(yypParser,%d,&yymsp[%d].minor);\n", 0, + rp->rhs[i]->index,i-rp->nrhs+1); + } + } + + /* If unable to write LHS values directly into the stack, write the + ** saved LHS value now. */ + if( lhsdirect==0 ){ + append_str(" yymsp[%d].minor.yy%d = ", 0, 1-rp->nrhs, rp->lhs->dtnum); + append_str(zLhs, 0, 0, 0); + append_str(";\n", 0, 0, 0); + } + + /* Suffix code generation complete */ + cp = append_str(0,0,0,0); + if( cp && cp[0] ){ + rp->codeSuffix = Strsafe(cp); + rp->noCode = 0; + } + + return rc; +} + +/* +** Generate code which executes when the rule "rp" is reduced. Write +** the code to "out". Make sure lineno stays up-to-date. +*/ +PRIVATE void emit_code( + FILE *out, + struct rule *rp, + struct lemon *lemp, + int *lineno +){ + const char *cp; + + /* Setup code prior to the #line directive */ + if( rp->codePrefix && rp->codePrefix[0] ){ + fprintf(out, "{%s", rp->codePrefix); + for(cp=rp->codePrefix; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; } + } + + /* Generate code to do the reduce action */ + if( rp->code ){ + if( !lemp->nolinenosflag ){ + (*lineno)++; + tplt_linedir(out,rp->line,lemp->filename); + } + fprintf(out,"{%s",rp->code); + for(cp=rp->code; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; } + fprintf(out,"}\n"); (*lineno)++; + if( !lemp->nolinenosflag ){ + (*lineno)++; + tplt_linedir(out,*lineno,lemp->outname); + } + } + + /* Generate breakdown code that occurs after the #line directive */ + if( rp->codeSuffix && rp->codeSuffix[0] ){ + fprintf(out, "%s", rp->codeSuffix); + for(cp=rp->codeSuffix; *cp; cp++){ if( *cp=='\n' ) (*lineno)++; } + } + + if( rp->codePrefix ){ + fprintf(out, "}\n"); (*lineno)++; + } + + return; +} + +/* +** Print the definition of the union used for the parser's data stack. +** This union contains fields for every possible data type for tokens +** and nonterminals. In the process of computing and printing this +** union, also set the ".dtnum" field of every terminal and nonterminal +** symbol. +*/ +void print_stack_union( + FILE *out, /* The output stream */ + struct lemon *lemp, /* The main info structure for this parser */ + int *plineno, /* Pointer to the line number */ + int mhflag /* True if generating makeheaders output */ +){ + int lineno = *plineno; /* The line number of the output */ + char **types; /* A hash table of datatypes */ + int arraysize; /* Size of the "types" array */ + int maxdtlength; /* Maximum length of any ".datatype" field. */ + char *stddt; /* Standardized name for a datatype */ + int i,j; /* Loop counters */ + unsigned hash; /* For hashing the name of a type */ + const char *name; /* Name of the parser */ + + /* Allocate and initialize types[] and allocate stddt[] */ + arraysize = lemp->nsymbol * 2; + types = (char**)calloc( arraysize, sizeof(char*) ); + if( types==0 ){ + fprintf(stderr,"Out of memory.\n"); + exit(1); + } + for(i=0; ivartype ){ + maxdtlength = lemonStrlen(lemp->vartype); + } + for(i=0; insymbol; i++){ + int len; + struct symbol *sp = lemp->symbols[i]; + if( sp->datatype==0 ) continue; + len = lemonStrlen(sp->datatype); + if( len>maxdtlength ) maxdtlength = len; + } + stddt = (char*)malloc( maxdtlength*2 + 1 ); + if( stddt==0 ){ + fprintf(stderr,"Out of memory.\n"); + exit(1); + } + + /* Build a hash table of datatypes. The ".dtnum" field of each symbol + ** is filled in with the hash index plus 1. A ".dtnum" value of 0 is + ** used for terminal symbols. If there is no %default_type defined then + ** 0 is also used as the .dtnum value for nonterminals which do not specify + ** a datatype using the %type directive. + */ + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + char *cp; + if( sp==lemp->errsym ){ + sp->dtnum = arraysize+1; + continue; + } + if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ + sp->dtnum = 0; + continue; + } + cp = sp->datatype; + if( cp==0 ) cp = lemp->vartype; + j = 0; + while( ISSPACE(*cp) ) cp++; + while( *cp ) stddt[j++] = *cp++; + while( j>0 && ISSPACE(stddt[j-1]) ) j--; + stddt[j] = 0; + if( lemp->tokentype && strcmp(stddt, lemp->tokentype)==0 ){ + sp->dtnum = 0; + continue; + } + hash = 0; + for(j=0; stddt[j]; j++){ + hash = hash*53 + stddt[j]; + } + hash = (hash & 0x7fffffff)%arraysize; + while( types[hash] ){ + if( strcmp(types[hash],stddt)==0 ){ + sp->dtnum = hash + 1; + break; + } + hash++; + if( hash>=(unsigned)arraysize ) hash = 0; + } + if( types[hash]==0 ){ + sp->dtnum = hash + 1; + types[hash] = (char*)malloc( lemonStrlen(stddt)+1 ); + if( types[hash]==0 ){ + fprintf(stderr,"Out of memory.\n"); + exit(1); + } + lemon_strcpy(types[hash],stddt); + } + } + + /* Print out the definition of YYTOKENTYPE and YYMINORTYPE */ + name = lemp->name ? lemp->name : "Parse"; + lineno = *plineno; + if( mhflag ){ fprintf(out,"#if INTERFACE\n"); lineno++; } + fprintf(out,"#define %sTOKENTYPE %s\n",name, + lemp->tokentype?lemp->tokentype:"void*"); lineno++; + if( mhflag ){ fprintf(out,"#endif\n"); lineno++; } + fprintf(out,"typedef union {\n"); lineno++; + fprintf(out," int yyinit;\n"); lineno++; + fprintf(out," %sTOKENTYPE yy0;\n",name); lineno++; + for(i=0; ierrsym->useCnt ){ + fprintf(out," int yy%d;\n",lemp->errsym->dtnum); lineno++; + } + free(stddt); + free(types); + fprintf(out,"} YYMINORTYPE;\n"); lineno++; + *plineno = lineno; +} + +/* +** Return the name of a C datatype able to represent values between +** lwr and upr, inclusive. If pnByte!=NULL then also write the sizeof +** for that type (1, 2, or 4) into *pnByte. +*/ +static const char *minimum_size_type(int lwr, int upr, int *pnByte){ + const char *zType = "int"; + int nByte = 4; + if( lwr>=0 ){ + if( upr<=255 ){ + zType = "unsigned char"; + nByte = 1; + }else if( upr<65535 ){ + zType = "unsigned short int"; + nByte = 2; + }else{ + zType = "unsigned int"; + nByte = 4; + } + }else if( lwr>=-127 && upr<=127 ){ + zType = "signed char"; + nByte = 1; + }else if( lwr>=-32767 && upr<32767 ){ + zType = "short"; + nByte = 2; + } + if( pnByte ) *pnByte = nByte; + return zType; +} + +/* +** Each state contains a set of token transaction and a set of +** nonterminal transactions. Each of these sets makes an instance +** of the following structure. An array of these structures is used +** to order the creation of entries in the yy_action[] table. +*/ +struct axset { + struct state *stp; /* A pointer to a state */ + int isTkn; /* True to use tokens. False for non-terminals */ + int nAction; /* Number of actions */ + int iOrder; /* Original order of action sets */ +}; + +/* +** Compare to axset structures for sorting purposes +*/ +static int axset_compare(const void *a, const void *b){ + struct axset *p1 = (struct axset*)a; + struct axset *p2 = (struct axset*)b; + int c; + c = p2->nAction - p1->nAction; + if( c==0 ){ + c = p1->iOrder - p2->iOrder; + } + assert( c!=0 || p1==p2 ); + return c; +} + +/* +** Write text on "out" that describes the rule "rp". +*/ +static void writeRuleText(FILE *out, struct rule *rp){ + int j; + fprintf(out,"%s ::=", rp->lhs->name); + for(j=0; jnrhs; j++){ + struct symbol *sp = rp->rhs[j]; + if( sp->type!=MULTITERMINAL ){ + fprintf(out," %s", sp->name); + }else{ + int k; + fprintf(out," %s", sp->subsym[0]->name); + for(k=1; knsubsym; k++){ + fprintf(out,"|%s",sp->subsym[k]->name); + } + } + } +} + + +/* Generate C source code for the parser */ +void ReportTable( + struct lemon *lemp, + int mhflag /* Output in makeheaders format if true */ +){ + FILE *out, *in; + char line[LINESIZE]; + int lineno; + struct state *stp; + struct action *ap; + struct rule *rp; + struct acttab *pActtab; + int i, j, n, sz; + int szActionType; /* sizeof(YYACTIONTYPE) */ + int szCodeType; /* sizeof(YYCODETYPE) */ + const char *name; + int mnTknOfst, mxTknOfst; + int mnNtOfst, mxNtOfst; + struct axset *ax; + + in = tplt_open(lemp); + if( in==0 ) return; + out = file_open(lemp,".c","wb"); + if( out==0 ){ + fclose(in); + return; + } + lineno = 1; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the include code, if any */ + tplt_print(out,lemp,lemp->include,&lineno); + if( mhflag ){ + char *incName = file_makename(lemp, ".h"); + fprintf(out,"#include \"%s\"\n", incName); lineno++; + free(incName); + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate #defines for all tokens */ + if( mhflag ){ + const char *prefix; + fprintf(out,"#if INTERFACE\n"); lineno++; + if( lemp->tokenprefix ) prefix = lemp->tokenprefix; + else prefix = ""; + for(i=1; interminal; i++){ + fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); + lineno++; + } + fprintf(out,"#endif\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the defines */ + fprintf(out,"#define YYCODETYPE %s\n", + minimum_size_type(0, lemp->nsymbol+1, &szCodeType)); lineno++; + fprintf(out,"#define YYNOCODE %d\n",lemp->nsymbol+1); lineno++; + fprintf(out,"#define YYACTIONTYPE %s\n", + minimum_size_type(0,lemp->nstate+lemp->nrule*2+5,&szActionType)); lineno++; + if( lemp->wildcard ){ + fprintf(out,"#define YYWILDCARD %d\n", + lemp->wildcard->index); lineno++; + } + print_stack_union(out,lemp,&lineno,mhflag); + fprintf(out, "#ifndef YYSTACKDEPTH\n"); lineno++; + if( lemp->stacksize ){ + fprintf(out,"#define YYSTACKDEPTH %s\n",lemp->stacksize); lineno++; + }else{ + fprintf(out,"#define YYSTACKDEPTH 100\n"); lineno++; + } + fprintf(out, "#endif\n"); lineno++; + if( mhflag ){ + fprintf(out,"#if INTERFACE\n"); lineno++; + } + name = lemp->name ? lemp->name : "Parse"; + if( lemp->arg && lemp->arg[0] ){ + i = lemonStrlen(lemp->arg); + while( i>=1 && ISSPACE(lemp->arg[i-1]) ) i--; + while( i>=1 && (ISALNUM(lemp->arg[i-1]) || lemp->arg[i-1]=='_') ) i--; + fprintf(out,"#define %sARG_SDECL %s;\n",name,lemp->arg); lineno++; + fprintf(out,"#define %sARG_PDECL ,%s\n",name,lemp->arg); lineno++; + fprintf(out,"#define %sARG_FETCH %s = yypParser->%s\n", + name,lemp->arg,&lemp->arg[i]); lineno++; + fprintf(out,"#define %sARG_STORE yypParser->%s = %s\n", + name,&lemp->arg[i],&lemp->arg[i]); lineno++; + }else{ + fprintf(out,"#define %sARG_SDECL\n",name); lineno++; + fprintf(out,"#define %sARG_PDECL\n",name); lineno++; + fprintf(out,"#define %sARG_FETCH\n",name); lineno++; + fprintf(out,"#define %sARG_STORE\n",name); lineno++; + } + if( mhflag ){ + fprintf(out,"#endif\n"); lineno++; + } + if( lemp->errsym->useCnt ){ + fprintf(out,"#define YYERRORSYMBOL %d\n",lemp->errsym->index); lineno++; + fprintf(out,"#define YYERRSYMDT yy%d\n",lemp->errsym->dtnum); lineno++; + } + if( lemp->has_fallback ){ + fprintf(out,"#define YYFALLBACK 1\n"); lineno++; + } + + /* Compute the action table, but do not output it yet. The action + ** table must be computed before generating the YYNSTATE macro because + ** we need to know how many states can be eliminated. + */ + ax = (struct axset *) calloc(lemp->nxstate*2, sizeof(ax[0])); + if( ax==0 ){ + fprintf(stderr,"malloc failed\n"); + exit(1); + } + for(i=0; inxstate; i++){ + stp = lemp->sorted[i]; + ax[i*2].stp = stp; + ax[i*2].isTkn = 1; + ax[i*2].nAction = stp->nTknAct; + ax[i*2+1].stp = stp; + ax[i*2+1].isTkn = 0; + ax[i*2+1].nAction = stp->nNtAct; + } + mxTknOfst = mnTknOfst = 0; + mxNtOfst = mnNtOfst = 0; + /* In an effort to minimize the action table size, use the heuristic + ** of placing the largest action sets first */ + for(i=0; inxstate*2; i++) ax[i].iOrder = i; + qsort(ax, lemp->nxstate*2, sizeof(ax[0]), axset_compare); + pActtab = acttab_alloc(); + for(i=0; inxstate*2 && ax[i].nAction>0; i++){ + stp = ax[i].stp; + if( ax[i].isTkn ){ + for(ap=stp->ap; ap; ap=ap->next){ + int action; + if( ap->sp->index>=lemp->nterminal ) continue; + action = compute_action(lemp, ap); + if( action<0 ) continue; + acttab_action(pActtab, ap->sp->index, action); + } + stp->iTknOfst = acttab_insert(pActtab); + if( stp->iTknOfstiTknOfst; + if( stp->iTknOfst>mxTknOfst ) mxTknOfst = stp->iTknOfst; + }else{ + for(ap=stp->ap; ap; ap=ap->next){ + int action; + if( ap->sp->indexnterminal ) continue; + if( ap->sp->index==lemp->nsymbol ) continue; + action = compute_action(lemp, ap); + if( action<0 ) continue; + acttab_action(pActtab, ap->sp->index, action); + } + stp->iNtOfst = acttab_insert(pActtab); + if( stp->iNtOfstiNtOfst; + if( stp->iNtOfst>mxNtOfst ) mxNtOfst = stp->iNtOfst; + } +#if 0 /* Uncomment for a trace of how the yy_action[] table fills out */ + { int jj, nn; + for(jj=nn=0; jjnAction; jj++){ + if( pActtab->aAction[jj].action<0 ) nn++; + } + printf("%4d: State %3d %s n: %2d size: %5d freespace: %d\n", + i, stp->statenum, ax[i].isTkn ? "Token" : "Var ", + ax[i].nAction, pActtab->nAction, nn); + } +#endif + } + free(ax); + + /* Mark rules that are actually used for reduce actions after all + ** optimizations have been applied + */ + for(rp=lemp->rule; rp; rp=rp->next) rp->doesReduce = LEMON_FALSE; + for(i=0; inxstate; i++){ + for(ap=lemp->sorted[i]->ap; ap; ap=ap->next){ + if( ap->type==REDUCE || ap->type==SHIFTREDUCE ){ + ap->x.rp->doesReduce = 1; + } + } + } + + /* Finish rendering the constants now that the action table has + ** been computed */ + fprintf(out,"#define YYNSTATE %d\n",lemp->nxstate); lineno++; + fprintf(out,"#define YYNRULE %d\n",lemp->nrule); lineno++; + fprintf(out,"#define YY_MAX_SHIFT %d\n",lemp->nxstate-1); lineno++; + fprintf(out,"#define YY_MIN_SHIFTREDUCE %d\n",lemp->nstate); lineno++; + i = lemp->nstate + lemp->nrule; + fprintf(out,"#define YY_MAX_SHIFTREDUCE %d\n", i-1); lineno++; + fprintf(out,"#define YY_MIN_REDUCE %d\n", i); lineno++; + i = lemp->nstate + lemp->nrule*2; + fprintf(out,"#define YY_MAX_REDUCE %d\n", i-1); lineno++; + fprintf(out,"#define YY_ERROR_ACTION %d\n", i); lineno++; + fprintf(out,"#define YY_ACCEPT_ACTION %d\n", i+1); lineno++; + fprintf(out,"#define YY_NO_ACTION %d\n", i+2); lineno++; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Now output the action table and its associates: + ** + ** yy_action[] A single table containing all actions. + ** yy_lookahead[] A table containing the lookahead for each entry in + ** yy_action. Used to detect hash collisions. + ** yy_shift_ofst[] For each state, the offset into yy_action for + ** shifting terminals. + ** yy_reduce_ofst[] For each state, the offset into yy_action for + ** shifting non-terminals after a reduce. + ** yy_default[] Default action for each state. + */ + + /* Output the yy_action table */ + lemp->nactiontab = n = acttab_size(pActtab); + lemp->tablesize += n*szActionType; + fprintf(out,"#define YY_ACTTAB_COUNT (%d)\n", n); lineno++; + fprintf(out,"static const YYACTIONTYPE yy_action[] = {\n"); lineno++; + for(i=j=0; instate + lemp->nrule + 2; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", action); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the yy_lookahead table */ + lemp->tablesize += n*szCodeType; + fprintf(out,"static const YYCODETYPE yy_lookahead[] = {\n"); lineno++; + for(i=j=0; insymbol; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", la); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the yy_shift_ofst[] table */ + n = lemp->nxstate; + while( n>0 && lemp->sorted[n-1]->iTknOfst==NO_OFFSET ) n--; + fprintf(out, "#define YY_SHIFT_USE_DFLT (%d)\n", lemp->nactiontab); lineno++; + fprintf(out, "#define YY_SHIFT_COUNT (%d)\n", n-1); lineno++; + fprintf(out, "#define YY_SHIFT_MIN (%d)\n", mnTknOfst); lineno++; + fprintf(out, "#define YY_SHIFT_MAX (%d)\n", mxTknOfst); lineno++; + fprintf(out, "static const %s yy_shift_ofst[] = {\n", + minimum_size_type(mnTknOfst, lemp->nterminal+lemp->nactiontab, &sz)); + lineno++; + lemp->tablesize += n*sz; + for(i=j=0; isorted[i]; + ofst = stp->iTknOfst; + if( ofst==NO_OFFSET ) ofst = lemp->nactiontab; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", ofst); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the yy_reduce_ofst[] table */ + fprintf(out, "#define YY_REDUCE_USE_DFLT (%d)\n", mnNtOfst-1); lineno++; + n = lemp->nxstate; + while( n>0 && lemp->sorted[n-1]->iNtOfst==NO_OFFSET ) n--; + fprintf(out, "#define YY_REDUCE_COUNT (%d)\n", n-1); lineno++; + fprintf(out, "#define YY_REDUCE_MIN (%d)\n", mnNtOfst); lineno++; + fprintf(out, "#define YY_REDUCE_MAX (%d)\n", mxNtOfst); lineno++; + fprintf(out, "static const %s yy_reduce_ofst[] = {\n", + minimum_size_type(mnNtOfst-1, mxNtOfst, &sz)); lineno++; + lemp->tablesize += n*sz; + for(i=j=0; isorted[i]; + ofst = stp->iNtOfst; + if( ofst==NO_OFFSET ) ofst = mnNtOfst - 1; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", ofst); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + + /* Output the default action table */ + fprintf(out, "static const YYACTIONTYPE yy_default[] = {\n"); lineno++; + n = lemp->nxstate; + lemp->tablesize += n*szActionType; + for(i=j=0; isorted[i]; + if( j==0 ) fprintf(out," /* %5d */ ", i); + fprintf(out, " %4d,", stp->iDfltReduce+lemp->nstate+lemp->nrule); + if( j==9 || i==n-1 ){ + fprintf(out, "\n"); lineno++; + j = 0; + }else{ + j++; + } + } + fprintf(out, "};\n"); lineno++; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the table of fallback tokens. + */ + if( lemp->has_fallback ){ + int mx = lemp->nterminal - 1; + while( mx>0 && lemp->symbols[mx]->fallback==0 ){ mx--; } + lemp->tablesize += (mx+1)*szCodeType; + for(i=0; i<=mx; i++){ + struct symbol *p = lemp->symbols[i]; + if( p->fallback==0 ){ + fprintf(out, " 0, /* %10s => nothing */\n", p->name); + }else{ + fprintf(out, " %3d, /* %10s => %s */\n", p->fallback->index, + p->name, p->fallback->name); + } + lineno++; + } + } + tplt_xfer(lemp->name, in, out, &lineno); + + /* Generate a table containing the symbolic name of every symbol + */ + for(i=0; insymbol; i++){ + lemon_sprintf(line,"\"%s\",",lemp->symbols[i]->name); + fprintf(out," %-15s",line); + if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } + } + if( (i&3)!=0 ){ fprintf(out,"\n"); lineno++; } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate a table containing a text string that describes every + ** rule in the rule set of the grammar. This information is used + ** when tracing REDUCE actions. + */ + for(i=0, rp=lemp->rule; rp; rp=rp->next, i++){ + assert( rp->iRule==i ); + fprintf(out," /* %3d */ \"", i); + writeRuleText(out, rp); + fprintf(out,"\",\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes every time a symbol is popped from + ** the stack while processing errors or while destroying the parser. + ** (In other words, generate the %destructor actions) + */ + if( lemp->tokendest ){ + int once = 1; + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + if( sp==0 || sp->type!=TERMINAL ) continue; + if( once ){ + fprintf(out, " /* TERMINAL Destructor */\n"); lineno++; + once = 0; + } + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; + } + for(i=0; insymbol && lemp->symbols[i]->type!=TERMINAL; i++); + if( insymbol ){ + emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); + fprintf(out," break;\n"); lineno++; + } + } + if( lemp->vardest ){ + struct symbol *dflt_sp = 0; + int once = 1; + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + if( sp==0 || sp->type==TERMINAL || + sp->index<=0 || sp->destructor!=0 ) continue; + if( once ){ + fprintf(out, " /* Default NON-TERMINAL Destructor */\n"); lineno++; + once = 0; + } + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; + dflt_sp = sp; + } + if( dflt_sp!=0 ){ + emit_destructor_code(out,dflt_sp,lemp,&lineno); + } + fprintf(out," break;\n"); lineno++; + } + for(i=0; insymbol; i++){ + struct symbol *sp = lemp->symbols[i]; + if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; + if( sp->destLineno<0 ) continue; /* Already emitted */ + fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; + + /* Combine duplicate destructors into a single case */ + for(j=i+1; jnsymbol; j++){ + struct symbol *sp2 = lemp->symbols[j]; + if( sp2 && sp2->type!=TERMINAL && sp2->destructor + && sp2->dtnum==sp->dtnum + && strcmp(sp->destructor,sp2->destructor)==0 ){ + fprintf(out," case %d: /* %s */\n", + sp2->index, sp2->name); lineno++; + sp2->destLineno = -1; /* Avoid emitting this destructor again */ + } + } + + emit_destructor_code(out,lemp->symbols[i],lemp,&lineno); + fprintf(out," break;\n"); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes whenever the parser stack overflows */ + tplt_print(out,lemp,lemp->overflow,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate the table of rule information + ** + ** Note: This code depends on the fact that rules are number + ** sequentually beginning with 0. + */ + for(rp=lemp->rule; rp; rp=rp->next){ + fprintf(out," { %d, %d },\n",rp->lhs->index,-rp->nrhs); lineno++; + } + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which execution during each REDUCE action */ + i = 0; + for(rp=lemp->rule; rp; rp=rp->next){ + i += translate_code(lemp, rp); + } + if( i ){ + fprintf(out," YYMINORTYPE yylhsminor;\n"); lineno++; + } + /* First output rules other than the default: rule */ + for(rp=lemp->rule; rp; rp=rp->next){ + struct rule *rp2; /* Other rules with the same action */ + if( rp->codeEmitted ) continue; + if( rp->noCode ){ + /* No C code actions, so this will be part of the "default:" rule */ + continue; + } + fprintf(out," case %d: /* ", rp->iRule); + writeRuleText(out, rp); + fprintf(out, " */\n"); lineno++; + for(rp2=rp->next; rp2; rp2=rp2->next){ + if( rp2->code==rp->code && rp2->codePrefix==rp->codePrefix + && rp2->codeSuffix==rp->codeSuffix ){ + fprintf(out," case %d: /* ", rp2->iRule); + writeRuleText(out, rp2); + fprintf(out," */ yytestcase(yyruleno==%d);\n", rp2->iRule); lineno++; + rp2->codeEmitted = 1; + } + } + emit_code(out,rp,lemp,&lineno); + fprintf(out," break;\n"); lineno++; + rp->codeEmitted = 1; + } + /* Finally, output the default: rule. We choose as the default: all + ** empty actions. */ + fprintf(out," default:\n"); lineno++; + for(rp=lemp->rule; rp; rp=rp->next){ + if( rp->codeEmitted ) continue; + assert( rp->noCode ); + fprintf(out," /* (%d) ", rp->iRule); + writeRuleText(out, rp); + if( rp->doesReduce ){ + fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++; + }else{ + fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n", + rp->iRule); lineno++; + } + } + fprintf(out," break;\n"); lineno++; + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes if a parse fails */ + tplt_print(out,lemp,lemp->failure,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes when a syntax error occurs */ + tplt_print(out,lemp,lemp->error,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Generate code which executes when the parser accepts its input */ + tplt_print(out,lemp,lemp->accept,&lineno); + tplt_xfer(lemp->name,in,out,&lineno); + + /* Append any addition code the user desires */ + tplt_print(out,lemp,lemp->extracode,&lineno); + + fclose(in); + fclose(out); + return; +} + +/* Generate a header file for the parser */ +void ReportHeader(struct lemon *lemp) +{ + FILE *out, *in; + const char *prefix; + char line[LINESIZE]; + char pattern[LINESIZE]; + int i; + + if( lemp->tokenprefix ) prefix = lemp->tokenprefix; + else prefix = ""; + in = file_open(lemp,".h","rb"); + if( in ){ + int nextChar; + for(i=1; interminal && fgets(line,LINESIZE,in); i++){ + lemon_sprintf(pattern,"#define %s%-30s %3d\n", + prefix,lemp->symbols[i]->name,i); + if( strcmp(line,pattern) ) break; + } + nextChar = fgetc(in); + fclose(in); + if( i==lemp->nterminal && nextChar==EOF ){ + /* No change in the file. Don't rewrite it. */ + return; + } + } + out = file_open(lemp,".h","wb"); + if( out ){ + for(i=1; interminal; i++){ + fprintf(out,"#define %s%-30s %3d\n",prefix,lemp->symbols[i]->name,i); + } + fclose(out); + } + return; +} + +/* Reduce the size of the action tables, if possible, by making use +** of defaults. +** +** In this version, we take the most frequent REDUCE action and make +** it the default. Except, there is no default if the wildcard token +** is a possible look-ahead. +*/ +void CompressTables(struct lemon *lemp) +{ + struct state *stp; + struct action *ap, *ap2, *nextap; + struct rule *rp, *rp2, *rbest; + int nbest, n; + int i; + int usesWildcard; + + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + nbest = 0; + rbest = 0; + usesWildcard = 0; + + for(ap=stp->ap; ap; ap=ap->next){ + if( ap->type==SHIFT && ap->sp==lemp->wildcard ){ + usesWildcard = 1; + } + if( ap->type!=REDUCE ) continue; + rp = ap->x.rp; + if( rp->lhsStart ) continue; + if( rp==rbest ) continue; + n = 1; + for(ap2=ap->next; ap2; ap2=ap2->next){ + if( ap2->type!=REDUCE ) continue; + rp2 = ap2->x.rp; + if( rp2==rbest ) continue; + if( rp2==rp ) n++; + } + if( n>nbest ){ + nbest = n; + rbest = rp; + } + } + + /* Do not make a default if the number of rules to default + ** is not at least 1 or if the wildcard token is a possible + ** lookahead. + */ + if( nbest<1 || usesWildcard ) continue; + + + /* Combine matching REDUCE actions into a single default */ + for(ap=stp->ap; ap; ap=ap->next){ + if( ap->type==REDUCE && ap->x.rp==rbest ) break; + } + assert( ap ); + ap->sp = Symbol_new("{default}"); + for(ap=ap->next; ap; ap=ap->next){ + if( ap->type==REDUCE && ap->x.rp==rbest ) ap->type = NOT_USED; + } + stp->ap = Action_sort(stp->ap); + + for(ap=stp->ap; ap; ap=ap->next){ + if( ap->type==SHIFT ) break; + if( ap->type==REDUCE && ap->x.rp!=rbest ) break; + } + if( ap==0 ){ + stp->autoReduce = 1; + stp->pDfltReduce = rbest; + } + } + + /* Make a second pass over all states and actions. Convert + ** every action that is a SHIFT to an autoReduce state into + ** a SHIFTREDUCE action. + */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(ap=stp->ap; ap; ap=ap->next){ + struct state *pNextState; + if( ap->type!=SHIFT ) continue; + pNextState = ap->x.stp; + if( pNextState->autoReduce && pNextState->pDfltReduce!=0 ){ + ap->type = SHIFTREDUCE; + ap->x.rp = pNextState->pDfltReduce; + } + } + } + + /* If a SHIFTREDUCE action specifies a rule that has a single RHS term + ** (meaning that the SHIFTREDUCE will land back in the state where it + ** started) and if there is no C-code associated with the reduce action, + ** then we can go ahead and convert the action to be the same as the + ** action for the RHS of the rule. + */ + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + for(ap=stp->ap; ap; ap=nextap){ + nextap = ap->next; + if( ap->type!=SHIFTREDUCE ) continue; + rp = ap->x.rp; + if( rp->noCode==0 ) continue; + if( rp->nrhs!=1 ) continue; +#if 1 + /* Only apply this optimization to non-terminals. It would be OK to + ** apply it to terminal symbols too, but that makes the parser tables + ** larger. */ + if( ap->sp->indexnterminal ) continue; +#endif + /* If we reach this point, it means the optimization can be applied */ + nextap = ap; + for(ap2=stp->ap; ap2 && (ap2==ap || ap2->sp!=rp->lhs); ap2=ap2->next){} + assert( ap2!=0 ); + ap->spOpt = ap2->sp; + ap->type = ap2->type; + ap->x = ap2->x; + } + } +} + + +/* +** Compare two states for sorting purposes. The smaller state is the +** one with the most non-terminal actions. If they have the same number +** of non-terminal actions, then the smaller is the one with the most +** token actions. +*/ +static int stateResortCompare(const void *a, const void *b){ + const struct state *pA = *(const struct state**)a; + const struct state *pB = *(const struct state**)b; + int n; + + n = pB->nNtAct - pA->nNtAct; + if( n==0 ){ + n = pB->nTknAct - pA->nTknAct; + if( n==0 ){ + n = pB->statenum - pA->statenum; + } + } + assert( n!=0 ); + return n; +} + + +/* +** Renumber and resort states so that states with fewer choices +** occur at the end. Except, keep state 0 as the first state. +*/ +void ResortStates(struct lemon *lemp) +{ + int i; + struct state *stp; + struct action *ap; + + for(i=0; instate; i++){ + stp = lemp->sorted[i]; + stp->nTknAct = stp->nNtAct = 0; + stp->iDfltReduce = lemp->nrule; /* Init dflt action to "syntax error" */ + stp->iTknOfst = NO_OFFSET; + stp->iNtOfst = NO_OFFSET; + for(ap=stp->ap; ap; ap=ap->next){ + int iAction = compute_action(lemp,ap); + if( iAction>=0 ){ + if( ap->sp->indexnterminal ){ + stp->nTknAct++; + }else if( ap->sp->indexnsymbol ){ + stp->nNtAct++; + }else{ + assert( stp->autoReduce==0 || stp->pDfltReduce==ap->x.rp ); + stp->iDfltReduce = iAction - lemp->nstate - lemp->nrule; + } + } + } + } + qsort(&lemp->sorted[1], lemp->nstate-1, sizeof(lemp->sorted[0]), + stateResortCompare); + for(i=0; instate; i++){ + lemp->sorted[i]->statenum = i; + } + lemp->nxstate = lemp->nstate; + while( lemp->nxstate>1 && lemp->sorted[lemp->nxstate-1]->autoReduce ){ + lemp->nxstate--; + } +} + + +/***************** From the file "set.c" ************************************/ +/* +** Set manipulation routines for the LEMON parser generator. +*/ + +static int size = 0; + +/* Set the set size */ +void SetSize(int n) +{ + size = n+1; +} + +/* Allocate a new set */ +char *SetNew(void){ + char *s; + s = (char*)calloc( size, 1); + if( s==0 ){ + extern void memory_error(); + memory_error(); + } + return s; +} + +/* Deallocate a set */ +void SetFree(char *s) +{ + free(s); +} + +/* Add a new element to the set. Return TRUE if the element was added +** and FALSE if it was already there. */ +int SetAdd(char *s, int e) +{ + int rv; + assert( e>=0 && esize = 1024; + x1a->count = 0; + x1a->tbl = (x1node*)calloc(1024, sizeof(x1node) + sizeof(x1node*)); + if( x1a->tbl==0 ){ + free(x1a); + x1a = 0; + }else{ + int i; + x1a->ht = (x1node**)&(x1a->tbl[1024]); + for(i=0; i<1024; i++) x1a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int Strsafe_insert(const char *data) +{ + x1node *np; + unsigned h; + unsigned ph; + + if( x1a==0 ) return 0; + ph = strhash(data); + h = ph & (x1a->size-1); + np = x1a->ht[h]; + while( np ){ + if( strcmp(np->data,data)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x1a->count>=x1a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x1 array; + array.size = arrSize = x1a->size*2; + array.count = x1a->count; + array.tbl = (x1node*)calloc(arrSize, sizeof(x1node) + sizeof(x1node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x1node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x1node *oldnp, *newnp; + oldnp = &(x1a->tbl[i]); + h = strhash(oldnp->data) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + free(x1a->tbl); + *x1a = array; + } + /* Insert the new data */ + h = ph & (x1a->size-1); + np = &(x1a->tbl[x1a->count++]); + np->data = data; + if( x1a->ht[h] ) x1a->ht[h]->from = &(np->next); + np->next = x1a->ht[h]; + x1a->ht[h] = np; + np->from = &(x1a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +const char *Strsafe_find(const char *key) +{ + unsigned h; + x1node *np; + + if( x1a==0 ) return 0; + h = strhash(key) & (x1a->size-1); + np = x1a->ht[h]; + while( np ){ + if( strcmp(np->data,key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Return a pointer to the (terminal or nonterminal) symbol "x". +** Create a new symbol if this is the first time "x" has been seen. +*/ +struct symbol *Symbol_new(const char *x) +{ + struct symbol *sp; + + sp = Symbol_find(x); + if( sp==0 ){ + sp = (struct symbol *)calloc(1, sizeof(struct symbol) ); + MemoryCheck(sp); + sp->name = Strsafe(x); + sp->type = ISUPPER(*x) ? TERMINAL : NONTERMINAL; + sp->rule = 0; + sp->fallback = 0; + sp->prec = -1; + sp->assoc = UNK; + sp->firstset = 0; + sp->lambda = LEMON_FALSE; + sp->destructor = 0; + sp->destLineno = 0; + sp->datatype = 0; + sp->useCnt = 0; + Symbol_insert(sp,sp->name); + } + sp->useCnt++; + return sp; +} + +/* Compare two symbols for sorting purposes. Return negative, +** zero, or positive if a is less then, equal to, or greater +** than b. +** +** Symbols that begin with upper case letters (terminals or tokens) +** must sort before symbols that begin with lower case letters +** (non-terminals). And MULTITERMINAL symbols (created using the +** %token_class directive) must sort at the very end. Other than +** that, the order does not matter. +** +** We find experimentally that leaving the symbols in their original +** order (the order they appeared in the grammar file) gives the +** smallest parser tables in SQLite. +*/ +int Symbolcmpp(const void *_a, const void *_b) +{ + const struct symbol *a = *(const struct symbol **) _a; + const struct symbol *b = *(const struct symbol **) _b; + int i1 = a->type==MULTITERMINAL ? 3 : a->name[0]>'Z' ? 2 : 1; + int i2 = b->type==MULTITERMINAL ? 3 : b->name[0]>'Z' ? 2 : 1; + return i1==i2 ? a->index - b->index : i1 - i2; +} + +/* There is one instance of the following structure for each +** associative array of type "x2". +*/ +struct s_x2 { + int size; /* The number of available slots. */ + /* Must be a power of 2 greater than or */ + /* equal to 1 */ + int count; /* Number of currently slots filled */ + struct s_x2node *tbl; /* The data stored here */ + struct s_x2node **ht; /* Hash table for lookups */ +}; + +/* There is one instance of this structure for every data element +** in an associative array of type "x2". +*/ +typedef struct s_x2node { + struct symbol *data; /* The data */ + const char *key; /* The key */ + struct s_x2node *next; /* Next entry with the same hash */ + struct s_x2node **from; /* Previous link */ +} x2node; + +/* There is only one instance of the array, which is the following */ +static struct s_x2 *x2a; + +/* Allocate a new associative array */ +void Symbol_init(void){ + if( x2a ) return; + x2a = (struct s_x2*)malloc( sizeof(struct s_x2) ); + if( x2a ){ + x2a->size = 128; + x2a->count = 0; + x2a->tbl = (x2node*)calloc(128, sizeof(x2node) + sizeof(x2node*)); + if( x2a->tbl==0 ){ + free(x2a); + x2a = 0; + }else{ + int i; + x2a->ht = (x2node**)&(x2a->tbl[128]); + for(i=0; i<128; i++) x2a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int Symbol_insert(struct symbol *data, const char *key) +{ + x2node *np; + unsigned h; + unsigned ph; + + if( x2a==0 ) return 0; + ph = strhash(key); + h = ph & (x2a->size-1); + np = x2a->ht[h]; + while( np ){ + if( strcmp(np->key,key)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x2a->count>=x2a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x2 array; + array.size = arrSize = x2a->size*2; + array.count = x2a->count; + array.tbl = (x2node*)calloc(arrSize, sizeof(x2node) + sizeof(x2node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x2node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x2node *oldnp, *newnp; + oldnp = &(x2a->tbl[i]); + h = strhash(oldnp->key) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->key = oldnp->key; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + free(x2a->tbl); + *x2a = array; + } + /* Insert the new data */ + h = ph & (x2a->size-1); + np = &(x2a->tbl[x2a->count++]); + np->key = key; + np->data = data; + if( x2a->ht[h] ) x2a->ht[h]->from = &(np->next); + np->next = x2a->ht[h]; + x2a->ht[h] = np; + np->from = &(x2a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +struct symbol *Symbol_find(const char *key) +{ + unsigned h; + x2node *np; + + if( x2a==0 ) return 0; + h = strhash(key) & (x2a->size-1); + np = x2a->ht[h]; + while( np ){ + if( strcmp(np->key,key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Return the n-th data. Return NULL if n is out of range. */ +struct symbol *Symbol_Nth(int n) +{ + struct symbol *data; + if( x2a && n>0 && n<=x2a->count ){ + data = x2a->tbl[n-1].data; + }else{ + data = 0; + } + return data; +} + +/* Return the size of the array */ +int Symbol_count() +{ + return x2a ? x2a->count : 0; +} + +/* Return an array of pointers to all data in the table. +** The array is obtained from malloc. Return NULL if memory allocation +** problems, or if the array is empty. */ +struct symbol **Symbol_arrayof() +{ + struct symbol **array; + int i,arrSize; + if( x2a==0 ) return 0; + arrSize = x2a->count; + array = (struct symbol **)calloc(arrSize, sizeof(struct symbol *)); + if( array ){ + for(i=0; itbl[i].data; + } + return array; +} + +/* Compare two configurations */ +int Configcmp(const char *_a,const char *_b) +{ + const struct config *a = (struct config *) _a; + const struct config *b = (struct config *) _b; + int x; + x = a->rp->index - b->rp->index; + if( x==0 ) x = a->dot - b->dot; + return x; +} + +/* Compare two states */ +PRIVATE int statecmp(struct config *a, struct config *b) +{ + int rc; + for(rc=0; rc==0 && a && b; a=a->bp, b=b->bp){ + rc = a->rp->index - b->rp->index; + if( rc==0 ) rc = a->dot - b->dot; + } + if( rc==0 ){ + if( a ) rc = 1; + if( b ) rc = -1; + } + return rc; +} + +/* Hash a state */ +PRIVATE unsigned statehash(struct config *a) +{ + unsigned h=0; + while( a ){ + h = h*571 + a->rp->index*37 + a->dot; + a = a->bp; + } + return h; +} + +/* Allocate a new state structure */ +struct state *State_new() +{ + struct state *newstate; + newstate = (struct state *)calloc(1, sizeof(struct state) ); + MemoryCheck(newstate); + return newstate; +} + +/* There is one instance of the following structure for each +** associative array of type "x3". +*/ +struct s_x3 { + int size; /* The number of available slots. */ + /* Must be a power of 2 greater than or */ + /* equal to 1 */ + int count; /* Number of currently slots filled */ + struct s_x3node *tbl; /* The data stored here */ + struct s_x3node **ht; /* Hash table for lookups */ +}; + +/* There is one instance of this structure for every data element +** in an associative array of type "x3". +*/ +typedef struct s_x3node { + struct state *data; /* The data */ + struct config *key; /* The key */ + struct s_x3node *next; /* Next entry with the same hash */ + struct s_x3node **from; /* Previous link */ +} x3node; + +/* There is only one instance of the array, which is the following */ +static struct s_x3 *x3a; + +/* Allocate a new associative array */ +void State_init(void){ + if( x3a ) return; + x3a = (struct s_x3*)malloc( sizeof(struct s_x3) ); + if( x3a ){ + x3a->size = 128; + x3a->count = 0; + x3a->tbl = (x3node*)calloc(128, sizeof(x3node) + sizeof(x3node*)); + if( x3a->tbl==0 ){ + free(x3a); + x3a = 0; + }else{ + int i; + x3a->ht = (x3node**)&(x3a->tbl[128]); + for(i=0; i<128; i++) x3a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int State_insert(struct state *data, struct config *key) +{ + x3node *np; + unsigned h; + unsigned ph; + + if( x3a==0 ) return 0; + ph = statehash(key); + h = ph & (x3a->size-1); + np = x3a->ht[h]; + while( np ){ + if( statecmp(np->key,key)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x3a->count>=x3a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x3 array; + array.size = arrSize = x3a->size*2; + array.count = x3a->count; + array.tbl = (x3node*)calloc(arrSize, sizeof(x3node) + sizeof(x3node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x3node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x3node *oldnp, *newnp; + oldnp = &(x3a->tbl[i]); + h = statehash(oldnp->key) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->key = oldnp->key; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + free(x3a->tbl); + *x3a = array; + } + /* Insert the new data */ + h = ph & (x3a->size-1); + np = &(x3a->tbl[x3a->count++]); + np->key = key; + np->data = data; + if( x3a->ht[h] ) x3a->ht[h]->from = &(np->next); + np->next = x3a->ht[h]; + x3a->ht[h] = np; + np->from = &(x3a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +struct state *State_find(struct config *key) +{ + unsigned h; + x3node *np; + + if( x3a==0 ) return 0; + h = statehash(key) & (x3a->size-1); + np = x3a->ht[h]; + while( np ){ + if( statecmp(np->key,key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Return an array of pointers to all data in the table. +** The array is obtained from malloc. Return NULL if memory allocation +** problems, or if the array is empty. */ +struct state **State_arrayof(void) +{ + struct state **array; + int i,arrSize; + if( x3a==0 ) return 0; + arrSize = x3a->count; + array = (struct state **)calloc(arrSize, sizeof(struct state *)); + if( array ){ + for(i=0; itbl[i].data; + } + return array; +} + +/* Hash a configuration */ +PRIVATE unsigned confighash(struct config *a) +{ + unsigned h=0; + h = h*571 + a->rp->index*37 + a->dot; + return h; +} + +/* There is one instance of the following structure for each +** associative array of type "x4". +*/ +struct s_x4 { + int size; /* The number of available slots. */ + /* Must be a power of 2 greater than or */ + /* equal to 1 */ + int count; /* Number of currently slots filled */ + struct s_x4node *tbl; /* The data stored here */ + struct s_x4node **ht; /* Hash table for lookups */ +}; + +/* There is one instance of this structure for every data element +** in an associative array of type "x4". +*/ +typedef struct s_x4node { + struct config *data; /* The data */ + struct s_x4node *next; /* Next entry with the same hash */ + struct s_x4node **from; /* Previous link */ +} x4node; + +/* There is only one instance of the array, which is the following */ +static struct s_x4 *x4a; + +/* Allocate a new associative array */ +void Configtable_init(void){ + if( x4a ) return; + x4a = (struct s_x4*)malloc( sizeof(struct s_x4) ); + if( x4a ){ + x4a->size = 64; + x4a->count = 0; + x4a->tbl = (x4node*)calloc(64, sizeof(x4node) + sizeof(x4node*)); + if( x4a->tbl==0 ){ + free(x4a); + x4a = 0; + }else{ + int i; + x4a->ht = (x4node**)&(x4a->tbl[64]); + for(i=0; i<64; i++) x4a->ht[i] = 0; + } + } +} +/* Insert a new record into the array. Return TRUE if successful. +** Prior data with the same key is NOT overwritten */ +int Configtable_insert(struct config *data) +{ + x4node *np; + unsigned h; + unsigned ph; + + if( x4a==0 ) return 0; + ph = confighash(data); + h = ph & (x4a->size-1); + np = x4a->ht[h]; + while( np ){ + if( Configcmp((const char *) np->data,(const char *) data)==0 ){ + /* An existing entry with the same key is found. */ + /* Fail because overwrite is not allows. */ + return 0; + } + np = np->next; + } + if( x4a->count>=x4a->size ){ + /* Need to make the hash table bigger */ + int i,arrSize; + struct s_x4 array; + array.size = arrSize = x4a->size*2; + array.count = x4a->count; + array.tbl = (x4node*)calloc(arrSize, sizeof(x4node) + sizeof(x4node*)); + if( array.tbl==0 ) return 0; /* Fail due to malloc failure */ + array.ht = (x4node**)&(array.tbl[arrSize]); + for(i=0; icount; i++){ + x4node *oldnp, *newnp; + oldnp = &(x4a->tbl[i]); + h = confighash(oldnp->data) & (arrSize-1); + newnp = &(array.tbl[i]); + if( array.ht[h] ) array.ht[h]->from = &(newnp->next); + newnp->next = array.ht[h]; + newnp->data = oldnp->data; + newnp->from = &(array.ht[h]); + array.ht[h] = newnp; + } + free(x4a->tbl); + *x4a = array; + } + /* Insert the new data */ + h = ph & (x4a->size-1); + np = &(x4a->tbl[x4a->count++]); + np->data = data; + if( x4a->ht[h] ) x4a->ht[h]->from = &(np->next); + np->next = x4a->ht[h]; + x4a->ht[h] = np; + np->from = &(x4a->ht[h]); + return 1; +} + +/* Return a pointer to data assigned to the given key. Return NULL +** if no such key. */ +struct config *Configtable_find(struct config *key) +{ + int h; + x4node *np; + + if( x4a==0 ) return 0; + h = confighash(key) & (x4a->size-1); + np = x4a->ht[h]; + while( np ){ + if( Configcmp((const char *) np->data,(const char *) key)==0 ) break; + np = np->next; + } + return np ? np->data : 0; +} + +/* Remove all data from the table. Pass each data to the function "f" +** as it is removed. ("f" may be null to avoid this step.) */ +void Configtable_clear(int(*f)(struct config *)) +{ + int i; + if( x4a==0 || x4a->count==0 ) return; + if( f ) for(i=0; icount; i++) (*f)(x4a->tbl[i].data); + for(i=0; isize; i++) x4a->ht[i] = 0; + x4a->count = 0; + return; +} diff --git a/3rdparty/bx/tools/lemon/lempar.c b/3rdparty/bx/tools/lemon/lempar.c new file mode 100644 index 00000000000..da81ddd4bc0 --- /dev/null +++ b/3rdparty/bx/tools/lemon/lempar.c @@ -0,0 +1,981 @@ +/* +** 2000-05-29 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Driver template for the LEMON parser generator. +** +** The "lemon" program processes an LALR(1) input grammar file, then uses +** this template to construct a parser. The "lemon" program inserts text +** at each "%%" line. Also, any "P-a-r-s-e" identifer prefix (without the +** interstitial "-" characters) contained in this template is changed into +** the value of the %name directive from the grammar. Otherwise, the content +** of this template is copied straight through into the generate parser +** source file. +** +** The following is the concatenation of all %include directives from the +** input grammar file: +*/ +#include +/************ Begin %include sections from the grammar ************************/ +%% +/**************** End of %include directives **********************************/ +/* These constants specify the various numeric values for terminal symbols +** in a format understandable to "makeheaders". This section is blank unless +** "lemon" is run with the "-m" command-line option. +***************** Begin makeheaders token definitions *************************/ +%% +/**************** End makeheaders token definitions ***************************/ + +/* The next sections is a series of control #defines. +** various aspects of the generated parser. +** YYCODETYPE is the data type used to store the integer codes +** that represent terminal and non-terminal symbols. +** "unsigned char" is used if there are fewer than +** 256 symbols. Larger types otherwise. +** YYNOCODE is a number of type YYCODETYPE that is not used for +** any terminal or nonterminal symbol. +** YYFALLBACK If defined, this indicates that one or more tokens +** (also known as: "terminal symbols") have fall-back +** values which should be used if the original symbol +** would not parse. This permits keywords to sometimes +** be used as identifiers, for example. +** YYACTIONTYPE is the data type used for "action codes" - numbers +** that indicate what to do in response to the next +** token. +** ParseTOKENTYPE is the data type used for minor type for terminal +** symbols. Background: A "minor type" is a semantic +** value associated with a terminal or non-terminal +** symbols. For example, for an "ID" terminal symbol, +** the minor type might be the name of the identifier. +** Each non-terminal can have a different minor type. +** Terminal symbols all have the same minor type, though. +** This macros defines the minor type for terminal +** symbols. +** YYMINORTYPE is the data type used for all minor types. +** This is typically a union of many types, one of +** which is ParseTOKENTYPE. The entry in the union +** for terminal symbols is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. If +** zero the stack is dynamically sized using realloc() +** ParseARG_SDECL A static variable declaration for the %extra_argument +** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_STORE Code to store %extra_argument into yypParser +** ParseARG_FETCH Code to extract %extra_argument from yypParser +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YY_MAX_SHIFT Maximum value for shift actions +** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions +** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions +** YY_MIN_REDUCE Minimum value for reduce actions +** YY_MAX_REDUCE Maximum value for reduce actions +** YY_ERROR_ACTION The yy_action[] code for syntax error +** YY_ACCEPT_ACTION The yy_action[] code for accept +** YY_NO_ACTION The yy_action[] code for no-op +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/************* Begin control #defines *****************************************/ +%% +/************* End control #defines *******************************************/ + +/* Define the yytestcase() macro to be a no-op if is not already defined +** otherwise. +** +** Applications can choose to define yytestcase() in the %include section +** to a macro that can assist in verifying code coverage. For production +** code the yytestcase() macro should be turned off. But it is useful +** for testing. +*/ +#ifndef yytestcase +# define yytestcase(X) +#endif + + +/* Next are the tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N <= YY_MAX_SHIFT Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then +** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE. +** +** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE +** and YY_MAX_REDUCE +** +** N == YY_ERROR_ACTION A syntax error has occurred. +** +** N == YY_ACCEPT_ACTION The parser accepts its input. +** +** N == YY_NO_ACTION No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as either: +** +** (A) N = yy_action[ yy_shift_ofst[S] + X ] +** (B) N = yy_default[S] +** +** The (A) formula is preferred. The B formula is used instead if: +** (1) The yy_shift_ofst[S]+X value is out of range, or +** (2) yy_lookahead[yy_shift_ofst[S]+X] is not equal to X, or +** (3) yy_shift_ofst[S] equal YY_SHIFT_USE_DFLT. +** (Implementation note: YY_SHIFT_USE_DFLT is chosen so that +** YY_SHIFT_USE_DFLT+X will be out of range for all possible lookaheads X. +** Hence only tests (1) and (2) need to be evaluated.) +** +** The formulas above are for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +** +*********** Begin parsing tables **********************************************/ +%% +/********** End of lemon-generated parsing tables *****************************/ + +/* The next table maps tokens (terminal symbols) into fallback tokens. +** If a construct like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +** +** This feature can be used, for example, to cause some keywords in a language +** to revert to identifiers if they keyword does not apply in the context where +** it appears. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +%% +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +** +** After the "shift" half of a SHIFTREDUCE action, the stateno field +** actually contains the reduce action for the second half of the +** SHIFTREDUCE. +*/ +struct yyStackEntry { + YYACTIONTYPE stateno; /* The state-number, or reduce action in SHIFTREDUCE */ + YYCODETYPE major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + yyStackEntry *yytos; /* Pointer to top element of the stack */ +#ifdef YYTRACKMAXSTACKDEPTH + int yyhwm; /* High-water mark of the stack */ +#endif +#ifndef YYNOERRORRECOVERY + int yyerrcnt; /* Shifts left before out of the error */ +#endif + ParseARG_SDECL /* A place to hold %extra_argument */ +#if YYSTACKDEPTH<=0 + int yystksz; /* Current side of the stack */ + yyStackEntry *yystack; /* The parser's stack */ + yyStackEntry yystk0; /* First stack entry */ +#else + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ + yyStackEntry *yystackEnd; /* Last entry in the stack */ +#endif +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +**
    +**
  • A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +**
  • A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +**
+** +** Outputs: +** None. +*/ +void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { +%% +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { +%% +}; +#endif /* NDEBUG */ + + +#if YYSTACKDEPTH<=0 +/* +** Try to increase the size of the parser stack. Return the number +** of errors. Return 0 on success. +*/ +static int yyGrowStack(yyParser *p){ + int newSize; + int idx; + yyStackEntry *pNew; + + newSize = p->yystksz*2 + 100; + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; + if( p->yystack==&p->yystk0 ){ + pNew = malloc(newSize*sizeof(pNew[0])); + if( pNew ) pNew[0] = p->yystk0; + }else{ + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + } + if( pNew ){ + p->yystack = pNew; + p->yytos = &p->yystack[idx]; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, p->yystksz, newSize); + } +#endif + p->yystksz = newSize; + } + return pNew==0; +} +#endif + +/* Datatype of the argument to the memory allocated passed as the +** second argument to ParseAlloc() below. This can be changed by +** putting an appropriate #define in the %include section of the input +** grammar. +*/ +#ifndef YYMALLOCARGTYPE +# define YYMALLOCARGTYPE size_t +#endif + +/* Initialize a new parser that has already been allocated. +*/ +void ParseInit(void *yypParser){ + yyParser *pParser = (yyParser*)yypParser; +#ifdef YYTRACKMAXSTACKDEPTH + pParser->yyhwm = 0; +#endif +#if YYSTACKDEPTH<=0 + pParser->yytos = NULL; + pParser->yystack = NULL; + pParser->yystksz = 0; + if( yyGrowStack(pParser) ){ + pParser->yystack = &pParser->yystk0; + pParser->yystksz = 1; + } +#endif +#ifndef YYNOERRORRECOVERY + pParser->yyerrcnt = -1; +#endif + pParser->yytos = pParser->yystack; + pParser->yystack[0].stateno = 0; + pParser->yystack[0].major = 0; +#if YYSTACKDEPTH>0 + pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to Parse and ParseFree. +*/ +void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); + if( pParser ) ParseInit(pParser); + return pParser; +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + + +/* The following function deletes the "minor type" or semantic value +** associated with a symbol. The symbol can be either a terminal +** or nonterminal. "yymajor" is the symbol code, and "yypminor" is +** a pointer to the value to be deleted. The code used to do the +** deletions is derived from the %destructor and/or %token_destructor +** directives of the input grammar. +*/ +static void yy_destructor( + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ +){ + ParseARG_FETCH; + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are *not* used + ** inside the C code. + */ +/********* Begin destructor definitions ***************************************/ +%% +/********* End destructor definitions *****************************************/ + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +*/ +static void yy_pop_parser_stack(yyParser *pParser){ + yyStackEntry *yytos; + assert( pParser->yytos!=0 ); + assert( pParser->yytos > pParser->yystack ); + yytos = pParser->yytos--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yy_destructor(pParser, yytos->major, &yytos->minor); +} + +/* +** Clear all secondary memory allocations from the parser +*/ +void ParseFinalize(void *p){ + yyParser *pParser = (yyParser*)p; + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); +#endif +} + +#ifndef Parse_ENGINEALWAYSONSTACK +/* +** Deallocate and destroy a parser. Destructors are called for +** all stack elements before shutting the parser down. +** +** If the YYPARSEFREENEVERNULL macro exists (for example because it +** is defined in a %include section of the input grammar) then it is +** assumed that the input pointer is never NULL. +*/ +void ParseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ +#ifndef YYPARSEFREENEVERNULL + if( p==0 ) return; +#endif + ParseFinalize(p); + (*freeProc)(p); +} +#endif /* Parse_ENGINEALWAYSONSTACK */ + +/* +** Return the peak depth of the stack for a parser. +*/ +#ifdef YYTRACKMAXSTACKDEPTH +int ParseStackPeak(void *p){ + yyParser *pParser = (yyParser*)p; + return pParser->yyhwm; +} +#endif + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +*/ +static unsigned int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yytos->stateno; + + if( stateno>=YY_MIN_REDUCE ) return stateno; + assert( stateno <= YY_SHIFT_COUNT ); + do{ + i = yy_shift_ofst[stateno]; + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ +#ifdef YYFALLBACK + YYCODETYPE iFallback; /* Fallback token */ + if( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */ + iLookAhead = iFallback; + continue; + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + if( +#if YY_SHIFT_MIN+YYWILDCARD<0 + j>=0 && +#endif +#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT + j0 + ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n", + yyTracePrompt, yyTokenName[iLookAhead], + yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } + }while(1); +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; +#ifdef YYERRORSYMBOL + if( stateno>YY_REDUCE_COUNT ){ + return yy_default[stateno]; + } +#else + assert( stateno<=YY_REDUCE_COUNT ); +#endif + i = yy_reduce_ofst[stateno]; + assert( i!=YY_REDUCE_USE_DFLT ); + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; +#ifdef YYERRORSYMBOL + if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + } +#else + assert( i>=0 && iyytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ +/******** Begin %stack_overflow code ******************************************/ +%% +/******** End %stack_overflow code ********************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ +} + +/* +** Print tracing information for a SHIFT action +*/ +#ifndef NDEBUG +static void yyTraceShift(yyParser *yypParser, int yyNewState){ + if( yyTraceFILE ){ + if( yyNewStateyytos->major], + yyNewState); + }else{ + fprintf(yyTraceFILE,"%sShift '%s'\n", + yyTracePrompt,yyTokenName[yypParser->yytos->major]); + } + } +} +#else +# define yyTraceShift(X,Y) +#endif + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + ParseTOKENTYPE yyMinor /* The minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yytos++; +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>yypParser->yystackEnd ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + if( yyGrowStack(yypParser) ){ + yypParser->yytos--; + yyStackOverflow(yypParser); + return; + } + } +#endif + if( yyNewState > YY_MAX_SHIFT ){ + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; + } + yytos = yypParser->yytos; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; + yytos->minor.yy0 = yyMinor; + yyTraceShift(yypParser, yyNewState); +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + signed char nrhs; /* Negative of the number of RHS symbols in the rule */ +} yyRuleInfo[] = { +%% +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +** +** The yyLookahead and yyLookaheadToken parameters provide reduce actions +** access to the lookahead token (if any). The yyLookahead will be YYNOCODE +** if the lookahead token has already been consumed. As this procedure is +** only called from one place, optimizing compilers will in-line it, which +** means that the extra parameters have no performance impact. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + unsigned int yyruleno, /* Number of the rule by which to reduce */ + int yyLookahead, /* Lookahead token, or YYNOCODE if none */ + ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + ParseARG_FETCH; + yymsp = yypParser->yytos; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + yysize = yyRuleInfo[yyruleno].nrhs; + fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, + yyRuleName[yyruleno], yymsp[yysize].stateno); + } +#endif /* NDEBUG */ + + /* Check that the stack is large enough to grow by a single entry + ** if the RHS of the rule is empty. This ensures that there is room + ** enough on the stack to push the LHS value */ + if( yyRuleInfo[yyruleno].nrhs==0 ){ +#ifdef YYTRACKMAXSTACKDEPTH + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ + yypParser->yyhwm++; + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yytos>=yypParser->yystackEnd ){ + yyStackOverflow(yypParser); + return; + } +#else + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ + if( yyGrowStack(yypParser) ){ + yyStackOverflow(yypParser); + return; + } + yymsp = yypParser->yytos; + } +#endif + } + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ +/********** Begin reduce actions **********************************************/ +%% +/********** End reduce actions ************************************************/ + }; + assert( yyrulenoYY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); + + /* It is not possible for a REDUCE to be followed by an error */ + assert( yyact!=YY_ERROR_ACTION ); + + if( yyact==YY_ACCEPT_ACTION ){ + yypParser->yytos += yysize; + yy_accept(yypParser); + }else{ + yymsp += yysize+1; + yypParser->yytos = yymsp; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yyTraceShift(yypParser, yyact); + } +} + +/* +** The following code executes when the parse fails +*/ +#ifndef YYNOERRORRECOVERY +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ +/************ Begin %parse_failure code ***************************************/ +%% +/************ End %parse_failure code *****************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} +#endif /* YYNOERRORRECOVERY */ + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + ParseTOKENTYPE yyminor /* The minor type of the error token */ +){ + ParseARG_FETCH; +#define TOKEN yyminor +/************ Begin %syntax_error code ****************************************/ +%% +/************ End %syntax_error code ******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + assert( yypParser->yytos==yypParser->yystack ); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ +/*********** Begin %parse_accept code *****************************************/ +%% +/*********** End %parse_accept code *******************************************/ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "ParseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. +*/ +void Parse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + unsigned int yyact; /* The parser action. */ +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + int yyendofinput; /* True if we are at the end of input */ +#endif +#ifdef YYERRORSYMBOL + int yyerrorhit = 0; /* True if yymajor has invoked an error */ +#endif + yyParser *yypParser; /* The parser */ + + yypParser = (yyParser*)yyp; + assert( yypParser->yytos!=0 ); +#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) + yyendofinput = (yymajor==0); +#endif + ParseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + if( yyact <= YY_MAX_SHIFTREDUCE ){ + yy_shift(yypParser,yyact,yymajor,yyminor); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt--; +#endif + yymajor = YYNOCODE; + }else if( yyact <= YY_MAX_REDUCE ){ + yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); + }else{ + assert( yyact == YY_ERROR_ACTION ); + yyminorunion.yy0 = yyminor; +#ifdef YYERRORSYMBOL + int yymx; +#endif +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminor); + } + yymx = yypParser->yytos->major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); + yymajor = YYNOCODE; + }else{ + while( yypParser->yytos >= yypParser->yystack + && yymx != YYERRORSYMBOL + && (yyact = yy_find_reduce_action( + yypParser->yytos->stateno, + YYERRORSYMBOL)) >= YY_MIN_REDUCE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#elif defined(YYNOERRORRECOVERY) + /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to + ** do any kind of error recovery. Instead, simply invoke the syntax + ** error routine and continue going as if nothing had happened. + ** + ** Applications can set this macro (for example inside %include) if + ** they intend to abandon the parse upon the first syntax error seen. + */ + yy_syntax_error(yypParser,yymajor, yyminor); + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yymajor = YYNOCODE; + +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor, yyminor); + } + yypParser->yyerrcnt = 3; + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); +#ifndef YYNOERRORRECOVERY + yypParser->yyerrcnt = -1; +#endif + } + yymajor = YYNOCODE; +#endif + } + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); +#ifndef NDEBUG + if( yyTraceFILE ){ + yyStackEntry *i; + char cDiv = '['; + fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); + cDiv = ' '; + } + fprintf(yyTraceFILE,"]\n"); + } +#endif + return; +} diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 7c1cc4acf4c..2ccfa749e19 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -1198,6 +1198,7 @@ project "bimg" files { MAME_DIR .. "3rdparty/bimg/src/image.cpp", + MAME_DIR .. "3rdparty/bimg/src/image_gnf.cpp", } -------------------------------------------------- @@ -1324,12 +1325,10 @@ end files { MAME_DIR .. "3rdparty/bgfx/src/bgfx.cpp", MAME_DIR .. "3rdparty/bgfx/src/debug_renderdoc.cpp", + MAME_DIR .. "3rdparty/bgfx/src/dxgi.cpp", MAME_DIR .. "3rdparty/bgfx/src/glcontext_egl.cpp", MAME_DIR .. "3rdparty/bgfx/src/glcontext_glx.cpp", MAME_DIR .. "3rdparty/bgfx/src/glcontext_wgl.cpp", - MAME_DIR .. "3rdparty/bgfx/src/hmd.cpp", - MAME_DIR .. "3rdparty/bgfx/src/hmd_ovr.cpp", - MAME_DIR .. "3rdparty/bgfx/src/hmd_openvr.cpp", MAME_DIR .. "3rdparty/bgfx/src/nvapi.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_d3d11.cpp", MAME_DIR .. "3rdparty/bgfx/src/renderer_d3d12.cpp", @@ -1347,8 +1346,9 @@ end MAME_DIR .. "3rdparty/bgfx/examples/common/imgui/imgui.cpp", MAME_DIR .. "3rdparty/bgfx/examples/common/nanovg/nanovg.cpp", MAME_DIR .. "3rdparty/bgfx/examples/common/nanovg/nanovg_bgfx.cpp", - MAME_DIR .. "3rdparty/bgfx/3rdparty/ocornut-imgui/imgui.cpp", - MAME_DIR .. "3rdparty/bgfx/3rdparty/ocornut-imgui/imgui_draw.cpp", + MAME_DIR .. "3rdparty/bgfx/3rdparty/dear-imgui/imgui.cpp", + MAME_DIR .. "3rdparty/bgfx/3rdparty/dear-imgui/imgui_draw.cpp", + MAME_DIR .. "3rdparty/bgfx/3rdparty/dear-imgui/imgui_widgets.cpp", } if _OPTIONS["targetos"]=="macosx" then files { diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 3e6abc628fa..39dcb3310cf 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -173,7 +173,7 @@ private: void refresh_typelist(); void update_cpu_view(device_t* device); static bool get_view_source(void* data, int idx, const char** out_text); - static int history_set(ImGuiTextEditCallbackData* data); + static int history_set(ImGuiInputTextCallbackData* data); running_machine* m_machine; int32_t m_mouse_x; @@ -531,7 +531,7 @@ void debug_imgui::handle_console(running_machine* machine) } } -int debug_imgui::history_set(ImGuiTextEditCallbackData* data) +int debug_imgui::history_set(ImGuiInputTextCallbackData* data) { if(view_main_console->console_history.size() == 0) return 0; @@ -1341,7 +1341,7 @@ void debug_imgui::draw_console() ImGui::PushItemWidth(-1.0f); if(ImGui::InputText("##console_input",view_main_console->console_input,512,flags,history_set)) view_main_console->exec_cmd = true; - if ((ImGui::IsRootWindowOrAnyChildFocused() && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0))) + if ((ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0))) ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget if(m_mount_open) { diff --git a/src/osd/modules/render/bgfx/chainentryreader.cpp b/src/osd/modules/render/bgfx/chainentryreader.cpp index 156827b0a96..bff221ec40c 100644 --- a/src/osd/modules/render/bgfx/chainentryreader.cpp +++ b/src/osd/modules/render/bgfx/chainentryreader.cpp @@ -89,8 +89,8 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s if (selection == "") { // create texture for specified file name - uint32_t flags = bilinear ? 0u : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); - flags |= clamp ? (BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_W_CLAMP) : 0u; + uint32_t flags = bilinear ? 0u : (BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT); + flags |= clamp ? (BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP) : 0u; bgfx_texture* texture = chains.textures().create_png_texture(chains.options().art_path(), texture_name, texture_name, flags, screen_index); if (texture == nullptr) { @@ -100,8 +100,8 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s else { // create texture for specified file name - uint32_t flags = bilinear ? 0u : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); - flags |= clamp ? (BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_W_CLAMP) : 0u; + uint32_t flags = bilinear ? 0u : (BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT); + flags |= clamp ? (BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP) : 0u; bgfx_texture* texture = chains.textures().create_png_texture(chains.options().art_path(), texture_name, texture_name, flags, screen_index); if (texture == nullptr) { @@ -153,8 +153,8 @@ bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, std::s if (file_extension == extension) { // create textures for all files containd in the path of the specified file name - uint32_t flags = bilinear ? 0u : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); - flags |= clamp ? (BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_W_CLAMP) : 0u; + uint32_t flags = bilinear ? 0u : (BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT); + flags |= clamp ? (BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_W_CLAMP) : 0u; bgfx_texture* texture = chains.textures().create_png_texture(chains.options().art_path(), file_path, file_path, flags, screen_index); if (texture == nullptr) { diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 39d12c6b53e..62df9be9613 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -297,7 +297,7 @@ void chain_manager::process_screen_quad(uint32_t view, uint32_t screen, render_p tex_width, tex_height, prim->texture.rowpixels, prim->texture.palette, prim->texture.base); std::string full_name = "screen" + std::to_string(screen); - bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); + bgfx_texture *texture = new bgfx_texture(full_name, bgfx::TextureFormat::RGBA8, tex_width, tex_height, mem, BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT); m_textures.add_provider(full_name, texture); const bool any_targets_rebuilt = m_targets.update_target_sizes(screen, tex_width, tex_height, TARGET_STYLE_GUEST); diff --git a/src/osd/modules/render/bgfx/depthreader.cpp b/src/osd/modules/render/bgfx/depthreader.cpp index b32eb426bb7..97502d9028e 100644 --- a/src/osd/modules/render/bgfx/depthreader.cpp +++ b/src/osd/modules/render/bgfx/depthreader.cpp @@ -27,7 +27,7 @@ uint64_t depth_reader::read_from_value(const Value& value, std::string prefix) if (value.HasMember("writeenable")) { if (!READER_CHECK(value["writeenable"].IsBool(), (prefix + "Value 'writeenable' must be a boolean\n").c_str())) return 0; - write_enable = value["writeenable"].GetBool() ? BGFX_STATE_DEPTH_WRITE : 0; + write_enable = value["writeenable"].GetBool() ? BGFX_STATE_WRITE_Z : 0; } uint64_t function = get_enum_from_value(value, "function", BGFX_STATE_DEPTH_TEST_ALWAYS, FUNCTION_NAMES, FUNCTION_COUNT); diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp index a5feee73b2e..cb912aba9ef 100644 --- a/src/osd/modules/render/bgfx/target.cpp +++ b/src/osd/modules/render/bgfx/target.cpp @@ -30,8 +30,8 @@ bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uin { m_width *= m_scale; m_height *= m_scale; - uint32_t wrap_mode = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; - uint32_t filter_mode = filter ? (BGFX_TEXTURE_MIN_ANISOTROPIC | BGFX_TEXTURE_MAG_ANISOTROPIC) : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT); + uint32_t wrap_mode = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP; + uint32_t filter_mode = filter ? (BGFX_SAMPLER_MIN_ANISOTROPIC | BGFX_SAMPLER_MAG_ANISOTROPIC) : (BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT); m_textures = new bgfx::TextureHandle[m_page_count]; m_targets = new bgfx::FrameBufferHandle[m_page_count]; diff --git a/src/osd/modules/render/bgfx/texture.h b/src/osd/modules/render/bgfx/texture.h index 577fa4c1792..7cb6d988150 100644 --- a/src/osd/modules/render/bgfx/texture.h +++ b/src/osd/modules/render/bgfx/texture.h @@ -21,7 +21,7 @@ class bgfx_texture : public bgfx_texture_handle_provider { public: bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, uint32_t flags, void* data); - bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, const bgfx::Memory* data, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP); + bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint16_t width, uint16_t height, const bgfx::Memory* data, uint32_t flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP); virtual ~bgfx_texture(); // Getters diff --git a/src/osd/modules/render/bgfx/texturemanager.h b/src/osd/modules/render/bgfx/texturemanager.h index da66dc2749c..3345a1b0ed6 100644 --- a/src/osd/modules/render/bgfx/texturemanager.h +++ b/src/osd/modules/render/bgfx/texturemanager.h @@ -29,8 +29,8 @@ public: texture_manager() { } ~texture_manager(); - bgfx_texture* create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data = nullptr, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP); - bgfx_texture* create_png_texture(std::string path, std::string file_name, std::string texture_name, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP, uint32_t screen = -1); + bgfx_texture* create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data = nullptr, uint32_t flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP); + bgfx_texture* create_png_texture(std::string path, std::string file_name, std::string texture_name, uint32_t flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP, uint32_t screen = -1); void add_provider(std::string name, bgfx_texture_handle_provider* texture); void remove_provider(std::string name, bool delete_provider = false); bgfx::TextureHandle create_or_update_mame_texture(uint32_t format, int width, int height diff --git a/src/osd/modules/render/bgfx/writereader.cpp b/src/osd/modules/render/bgfx/writereader.cpp index 6ec148f9e46..d466c4056cf 100644 --- a/src/osd/modules/render/bgfx/writereader.cpp +++ b/src/osd/modules/render/bgfx/writereader.cpp @@ -12,7 +12,7 @@ uint64_t write_reader::read_from_value(const Value& value) { - uint64_t rgb = get_bool(value, "rgb", false) ? BGFX_STATE_RGB_WRITE : 0; - uint64_t alpha = get_bool(value, "alpha", false) ? BGFX_STATE_ALPHA_WRITE : 0; + uint64_t rgb = get_bool(value, "rgb", false) ? BGFX_STATE_WRITE_RGB : 0; + uint64_t alpha = get_bool(value, "alpha", false) ? BGFX_STATE_WRITE_A : 0; return rgb | alpha; } diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 47863324ab3..0c483d9eb59 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -244,35 +244,40 @@ int renderer_bgfx::create() sdlSetWindow(std::dynamic_pointer_cast(win)->platform_window()); #endif std::string backend(m_options.bgfx_backend()); + bgfx::Init init; + init.type = bgfx::RendererType::Count; + init.vendorId = BGFX_PCI_ID_NONE; + init.resolution.width = wdim.width(); + init.resolution.height = wdim.height(); + init.resolution.reset = BGFX_RESET_NONE; if (backend == "auto") { - bgfx::init(); } else if (backend == "dx9" || backend == "d3d9") { - bgfx::init(bgfx::RendererType::Direct3D9); + init.type = bgfx::RendererType::Direct3D9; } else if (backend == "dx11" || backend == "d3d11") { - bgfx::init(bgfx::RendererType::Direct3D11); + init.type = bgfx::RendererType::Direct3D11; } else if (backend == "gles") { - bgfx::init(bgfx::RendererType::OpenGLES); + init.type = bgfx::RendererType::OpenGLES; } else if (backend == "glsl" || backend == "opengl") { - bgfx::init(bgfx::RendererType::OpenGL); + init.type = bgfx::RendererType::OpenGL; } else if (backend == "metal") { - bgfx::init(bgfx::RendererType::Metal); + init.type = bgfx::RendererType::Metal; } else { printf("Unknown backend type '%s', going with auto-detection\n", backend.c_str()); - bgfx::init(); } + bgfx::init(init); bgfx::reset(m_width[win->m_index], m_height[win->m_index], video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); // Enable debug text. bgfx::setDebug(m_options.bgfx_debug() ? BGFX_DEBUG_STATS : BGFX_DEBUG_TEXT); @@ -321,7 +326,7 @@ int renderer_bgfx::create() m_chains = new chain_manager(win->machine(), m_options, *m_textures, *m_targets, *m_effects, win->m_index, *this); m_sliders_dirty = true; - uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; + uint32_t flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP | BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT; m_texture_cache = m_textures->create_texture("#cache", bgfx::TextureFormat::RGBA8, CACHE_SIZE, CACHE_SIZE, nullptr, flags); memset(m_white, 0xff, sizeof(uint32_t) * 16 * 16); @@ -490,10 +495,10 @@ void renderer_bgfx::render_post_screen_quad(int view, render_primitive* prim, bg vertex(&vertices[4], x[2], y[2], 0, 0xffffffff, u[2], v[2]); vertex(&vertices[5], x[0], y[0], 0, 0xffffffff, u[0], v[0]); - uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; + uint32_t texture_flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP; if (video_config.filter == 0) { - texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; + texture_flags |= BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT; } uint32_t blend = PRIMFLAG_GET_BLENDMODE(prim->flags); @@ -550,10 +555,10 @@ void renderer_bgfx::render_textured_quad(render_primitive* prim, bgfx::Transient vertex(&vertices[4], x[2], y[2], 0, rgba, u[2], v[2]); vertex(&vertices[5], x[0], y[0], 0, rgba, u[0], v[0]); - uint32_t texture_flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP; + uint32_t texture_flags = BGFX_SAMPLER_U_CLAMP | BGFX_SAMPLER_V_CLAMP; if (video_config.filter == 0) { - texture_flags |= BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; + texture_flags |= BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT; } uint16_t tex_width(prim->texture.width); @@ -1061,7 +1066,7 @@ renderer_bgfx::buffer_status renderer_bgfx::buffer_primitives(bool atlas_valid, void renderer_bgfx::set_bgfx_state(uint32_t blend) { - uint64_t flags = BGFX_STATE_RGB_WRITE | BGFX_STATE_ALPHA_WRITE | BGFX_STATE_DEPTH_TEST_ALWAYS; + uint64_t flags = BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS; bgfx::setState(flags | bgfx_util::get_blend_state(blend)); }